From: Cris Di Sclafani Date: Thu, 29 Oct 2020 07:56:28 +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?a=commitdiff_plain;h=2ee54ebbb56db0ad72d3fe8081eac6234889fda2;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e30317d..35f07f0 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-28T12:14:05.297Z", "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-29T07:48:42.174Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index dc9444f..c621e57 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-28T12:14:05.297Z", "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-29T07:48:42.174Z", "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 f2e3bbf..9771996 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 _0xe84a=['integration','motionbar','urlForward','browser','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','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x479e3a,_0x1974af){var _0x1d1a3c=function(_0x604785){while(--_0x604785){_0x479e3a['push'](_0x479e3a['shift']());}};_0x1d1a3c(++_0x1974af);}(_0xe84a,0x81));var _0xae84=function(_0x2412fe,_0x344b72){_0x2412fe=_0x2412fe-0x0;var _0x231e29=_0xe84a[_0x2412fe];return _0x231e29;};'use strict';var Sequelize=require(_0xae84('0x0'));module[_0xae84('0x1')]={'name':{'type':Sequelize[_0xae84('0x2')],'get':function(_0x1a381e){return this[_0xae84('0x3')](_0xae84('0x4'));}},'action':{'type':Sequelize[_0xae84('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xae84('0x6'),_0xae84('0x7'),_0xae84('0x8'),'jscripty',_0xae84('0x9'),_0xae84('0xa'),'bot',_0xae84('0xb')]],'msg':_0xae84('0xc')}},'comment':_0xae84('0xc')},'data1':{'type':Sequelize[_0xae84('0x5')](0x1000),'comment':_0xae84('0xd')},'data2':{'type':Sequelize[_0xae84('0x5')](0x1000),'comment':_0xae84('0xe')},'data3':{'type':Sequelize[_0xae84('0x5')](0x1000),'comment':_0xae84('0xf')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0xae84('0x5')](0x1000)},'data6':{'type':Sequelize[_0xae84('0x5')]},'data7':{'type':Sequelize[_0xae84('0x10')]}}; \ No newline at end of file +var _0x9fcb=['STRING','integration','motionbar','urlForward','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT','exports','VIRTUAL','action'];(function(_0x547915,_0x43591c){var _0x8c935=function(_0x3b3359){while(--_0x3b3359){_0x547915['push'](_0x547915['shift']());}};_0x8c935(++_0x43591c);}(_0x9fcb,0x14d));var _0xb9fc=function(_0x30f278,_0x204e08){_0x30f278=_0x30f278-0x0;var _0x6b36cc=_0x9fcb[_0x30f278];return _0x6b36cc;};'use strict';var Sequelize=require('sequelize');module[_0xb9fc('0x0')]={'name':{'type':Sequelize[_0xb9fc('0x1')],'get':function(_0x5046e0){return this['getDataValue'](_0xb9fc('0x2'));}},'action':{'type':Sequelize[_0xb9fc('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xb9fc('0x4'),_0xb9fc('0x5'),'jscripty',_0xb9fc('0x6'),'browser',_0xb9fc('0x7'),'script']],'msg':_0xb9fc('0x8')}},'comment':_0xb9fc('0x8')},'data1':{'type':Sequelize[_0xb9fc('0x3')](0x1000),'comment':_0xb9fc('0x9')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xb9fc('0xa')},'data3':{'type':Sequelize[_0xb9fc('0x3')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xb9fc('0x3')](0x1000)},'data5':{'type':Sequelize[_0xb9fc('0x3')](0x1000)},'data6':{'type':Sequelize[_0xb9fc('0x3')]},'data7':{'type':Sequelize[_0xb9fc('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e81fc1c..e629aa2 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 _0xb40e=['update','then','destroy','end','error','stack','name','send','body','params','catch','Action','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x43ed8,_0x30ae88){var _0x378ce5=function(_0x423391){while(--_0x423391){_0x43ed8['push'](_0x43ed8['shift']());}};_0x378ce5(++_0x30ae88);}(_0xb40e,0x14f));var _0xeb40=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xb40e[_0xb8cfbe];return _0x227d51;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xeb40('0x0'));var zipdir=require(_0xeb40('0x1'));var jsonpatch=require(_0xeb40('0x2'));var rp=require(_0xeb40('0x3'));var moment=require(_0xeb40('0x4'));var BPromise=require(_0xeb40('0x5'));var Mustache=require(_0xeb40('0x6'));var util=require('util');var path=require(_0xeb40('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeb40('0x8'));var fs=require('fs');var _=require(_0xeb40('0x9'));var squel=require(_0xeb40('0xa'));var crypto=require(_0xeb40('0xb'));var jsforce=require(_0xeb40('0xc'));var deskjs=require(_0xeb40('0xd'));var toCsv=require(_0xeb40('0xe'));var querystring=require('querystring');var Papa=require(_0xeb40('0xf'));var Redis=require(_0xeb40('0x10'));var authService=require(_0xeb40('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeb40('0x12'));var hardwareService=require(_0xeb40('0x13'));var logger=require(_0xeb40('0x14'))('api');var utils=require(_0xeb40('0x15'));var config=require(_0xeb40('0x16'));var db=require(_0xeb40('0x17'))['db'];function respondWithStatusCode(_0x1913f2,_0x1d7f59){_0x1d7f59=_0x1d7f59||0xcc;return function(_0x1a11b0){if(_0x1a11b0){return _0x1913f2[_0xeb40('0x18')](_0x1d7f59);}return _0x1913f2[_0xeb40('0x19')](_0x1d7f59)['end']();};}function respondWithResult(_0x172c20,_0x4ee641){_0x4ee641=_0x4ee641||0xc8;return function(_0x247c33){if(_0x247c33){return _0x172c20[_0xeb40('0x19')](_0x4ee641)[_0xeb40('0x1a')](_0x247c33);}};}function respondWithFilteredResult(_0x417893,_0x54eca5){return function(_0x4c306c){if(_0x4c306c){var _0x3baf89=_0x4c306c[_0xeb40('0x1b')],_0x2c6144=_0x54eca5['offset'],_0x2b2172=_0x54eca5[_0xeb40('0x1c')]+_0x54eca5[_0xeb40('0x1d')],_0x597f72;if(_0x2b2172>=_0x3baf89){_0x2b2172=_0x3baf89;_0x597f72=0xc8;}else{_0x597f72=0xce;}_0x417893['status'](_0x597f72);return _0x417893[_0xeb40('0x1e')](_0xeb40('0x1f'),_0x2c6144+'-'+_0x2b2172+'/'+_0x3baf89)[_0xeb40('0x1a')](_0x4c306c);}return null;};}function patchUpdates(_0x3d69f2){return function(_0x20ca26){try{jsonpatch[_0xeb40('0x20')](_0x20ca26,_0x3d69f2,!![]);}catch(_0x309025){return BPromise['reject'](_0x309025);}return _0x20ca26['save']();};}function saveUpdates(_0x3c780e,_0x5dd107){return function(_0x53cf02){if(_0x53cf02){return _0x53cf02[_0xeb40('0x21')](_0x3c780e)[_0xeb40('0x22')](function(_0x28d19b){return _0x28d19b;});}return null;};}function removeEntity(_0xa85d96,_0x37935c){return function(_0x29ccf5){if(_0x29ccf5){return _0x29ccf5[_0xeb40('0x23')]()[_0xeb40('0x22')](function(){_0xa85d96['status'](0xcc)[_0xeb40('0x24')]();});}};}function handleEntityNotFound(_0x2e64b0,_0x497996){return function(_0x363bd){if(!_0x363bd){_0x2e64b0[_0xeb40('0x18')](0x194);}return _0x363bd;};}function handleError(_0x37f295,_0x5e0862){_0x5e0862=_0x5e0862||0x1f4;return function(_0x69ddd7){logger[_0xeb40('0x25')](_0x69ddd7[_0xeb40('0x26')]);if(_0x69ddd7[_0xeb40('0x27')]){delete _0x69ddd7[_0xeb40('0x27')];}_0x37f295[_0xeb40('0x19')](_0x5e0862)[_0xeb40('0x28')](_0x69ddd7);};}exports[_0xeb40('0x21')]=function(_0x2c8508,_0x344a29){if(_0x2c8508[_0xeb40('0x29')]['id']){delete _0x2c8508[_0xeb40('0x29')]['id'];}return db['Action']['find']({'where':{'id':_0x2c8508[_0xeb40('0x2a')]['id']}})['then'](handleEntityNotFound(_0x344a29,null))[_0xeb40('0x22')](saveUpdates(_0x2c8508[_0xeb40('0x29')],null))[_0xeb40('0x22')](respondWithResult(_0x344a29,null))[_0xeb40('0x2b')](handleError(_0x344a29,null));};exports[_0xeb40('0x23')]=function(_0x48422f,_0x21692c){return db[_0xeb40('0x2c')][_0xeb40('0x2d')]({'where':{'id':_0x48422f['params']['id']}})[_0xeb40('0x22')](handleEntityNotFound(_0x21692c,null))[_0xeb40('0x22')](removeEntity(_0x21692c,null))['catch'](handleError(_0x21692c,null));}; \ No newline at end of file +var _0x4545=['update','then','destroy','error','name','body','Action','find','catch','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save'];(function(_0x91151f,_0x163244){var _0x20c557=function(_0x5bd7bb){while(--_0x5bd7bb){_0x91151f['push'](_0x91151f['shift']());}};_0x20c557(++_0x163244);}(_0x4545,0xd1));var _0x5454=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4545[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5454('0x0'));var rimraf=require(_0x5454('0x1'));var zipdir=require(_0x5454('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5454('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5454('0x4'));var util=require(_0x5454('0x5'));var path=require(_0x5454('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5454('0x7'));var fs=require('fs');var _=require(_0x5454('0x8'));var squel=require('squel');var crypto=require(_0x5454('0x9'));var jsforce=require(_0x5454('0xa'));var deskjs=require(_0x5454('0xb'));var toCsv=require(_0x5454('0xc'));var querystring=require(_0x5454('0xd'));var Papa=require(_0x5454('0xe'));var Redis=require(_0x5454('0xf'));var authService=require(_0x5454('0x10'));var qs=require(_0x5454('0x11'));var as=require(_0x5454('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5454('0x13'));var utils=require('../../config/utils');var config=require(_0x5454('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb88a,_0x24f3f1){_0x24f3f1=_0x24f3f1||0xcc;return function(_0x49cdf3){if(_0x49cdf3){return _0x2eb88a[_0x5454('0x15')](_0x24f3f1);}return _0x2eb88a['status'](_0x24f3f1)[_0x5454('0x16')]();};}function respondWithResult(_0x11e0af,_0x38d51e){_0x38d51e=_0x38d51e||0xc8;return function(_0x2fc1d2){if(_0x2fc1d2){return _0x11e0af[_0x5454('0x17')](_0x38d51e)[_0x5454('0x18')](_0x2fc1d2);}};}function respondWithFilteredResult(_0x12153b,_0x4eca99){return function(_0x5cc54d){if(_0x5cc54d){var _0x50bbcd=_0x5cc54d[_0x5454('0x19')],_0x311f2c=_0x4eca99[_0x5454('0x1a')],_0x51e1fb=_0x4eca99['offset']+_0x4eca99[_0x5454('0x1b')],_0x2a2068;if(_0x51e1fb>=_0x50bbcd){_0x51e1fb=_0x50bbcd;_0x2a2068=0xc8;}else{_0x2a2068=0xce;}_0x12153b['status'](_0x2a2068);return _0x12153b['set'](_0x5454('0x1c'),_0x311f2c+'-'+_0x51e1fb+'/'+_0x50bbcd)[_0x5454('0x18')](_0x5cc54d);}return null;};}function patchUpdates(_0x321d32){return function(_0xa95a44){try{jsonpatch['apply'](_0xa95a44,_0x321d32,!![]);}catch(_0x5cbe8e){return BPromise[_0x5454('0x1d')](_0x5cbe8e);}return _0xa95a44[_0x5454('0x1e')]();};}function saveUpdates(_0x277664,_0x526fd9){return function(_0x4d3b46){if(_0x4d3b46){return _0x4d3b46[_0x5454('0x1f')](_0x277664)[_0x5454('0x20')](function(_0xa79148){return _0xa79148;});}return null;};}function removeEntity(_0x366c02,_0x43e219){return function(_0xbc81a6){if(_0xbc81a6){return _0xbc81a6[_0x5454('0x21')]()[_0x5454('0x20')](function(){_0x366c02[_0x5454('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d78a5,_0x498a0b){return function(_0x3f8849){if(!_0x3f8849){_0x2d78a5[_0x5454('0x15')](0x194);}return _0x3f8849;};}function handleError(_0x198792,_0xc02480){_0xc02480=_0xc02480||0x1f4;return function(_0x475033){logger[_0x5454('0x22')](_0x475033['stack']);if(_0x475033[_0x5454('0x23')]){delete _0x475033[_0x5454('0x23')];}_0x198792['status'](_0xc02480)['send'](_0x475033);};}exports[_0x5454('0x1f')]=function(_0x1407c0,_0x539f19){if(_0x1407c0[_0x5454('0x24')]['id']){delete _0x1407c0['body']['id'];}return db[_0x5454('0x25')][_0x5454('0x26')]({'where':{'id':_0x1407c0['params']['id']}})[_0x5454('0x20')](handleEntityNotFound(_0x539f19,null))[_0x5454('0x20')](saveUpdates(_0x1407c0[_0x5454('0x24')],null))[_0x5454('0x20')](respondWithResult(_0x539f19,null))[_0x5454('0x27')](handleError(_0x539f19,null));};exports[_0x5454('0x21')]=function(_0x27fc0e,_0x4ab0e1){return db[_0x5454('0x25')][_0x5454('0x26')]({'where':{'id':_0x27fc0e['params']['id']}})[_0x5454('0x20')](handleEntityNotFound(_0x4ab0e1,null))[_0x5454('0x20')](removeEntity(_0x4ab0e1,null))[_0x5454('0x27')](handleError(_0x4ab0e1,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 93ccca4..74f4ee1 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 _0xfa75=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfa75,0x136));var _0x5fa7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa75[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x5fa7('0x0'));var logger=require(_0x5fa7('0x1'))(_0x5fa7('0x2'));var moment=require('moment');var BPromise=require(_0x5fa7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5fa7('0x4'));var config=require(_0x5fa7('0x5'));var attributes=require(_0x5fa7('0x6'));module[_0x5fa7('0x7')]=function(_0x5880fc,_0x59cb05){return _0x5880fc['define'](_0x5fa7('0x8'),attributes,{'tableName':_0x5fa7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91d8=['bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api','moment'];(function(_0x5497f7,_0x431f2b){var _0x59b3f1=function(_0x3cde8b){while(--_0x3cde8b){_0x5497f7['push'](_0x5497f7['shift']());}};_0x59b3f1(++_0x431f2b);}(_0x91d8,0x96));var _0x891d=function(_0x44931a,_0x379717){_0x44931a=_0x44931a-0x0;var _0xf687de=_0x91d8[_0x44931a];return _0xf687de;};'use strict';var _=require(_0x891d('0x0'));var util=require('util');var logger=require(_0x891d('0x1'))(_0x891d('0x2'));var moment=require(_0x891d('0x3'));var BPromise=require(_0x891d('0x4'));var rp=require(_0x891d('0x5'));var fs=require('fs');var path=require(_0x891d('0x6'));var rimraf=require(_0x891d('0x7'));var config=require(_0x891d('0x8'));var attributes=require(_0x891d('0x9'));module[_0x891d('0xa')]=function(_0x10df51,_0x33cc82){return _0x10df51[_0x891d('0xb')](_0x891d('0xc'),attributes,{'tableName':_0x891d('0xd'),'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 36a28b7..9a86b61 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x484508,_0x5d4160){var _0x248d2e=function(_0x23f11c){while(--_0x23f11c){_0x484508['push'](_0x484508['shift']());}};_0x248d2e(++_0x5d4160);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x259e77,_0x52f430){var _0x1f93bd=function(_0x3c9ffe){while(--_0x3c9ffe){_0x259e77['push'](_0x259e77['shift']());}};_0x1f93bd(++_0x52f430);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 61a9ad4..c151262 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 _0x0041=['delete','/:id','isAuthenticated','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./action.controller','put','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0041,0x1a4));var _0x1004=function(_0x5dbc36,_0x5b72bd){_0x5dbc36=_0x5dbc36-0x0;var _0x2df984=_0x0041[_0x5dbc36];return _0x2df984;};'use strict';var multer=require(_0x1004('0x0'));var util=require(_0x1004('0x1'));var path=require(_0x1004('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1004('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1004('0x4'));var config=require(_0x1004('0x5'));var controller=require(_0x1004('0x6'));router[_0x1004('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1004('0x8')]);router[_0x1004('0x9')](_0x1004('0xa'),auth[_0x1004('0xb')](),controller['destroy']);module[_0x1004('0xc')]=router; \ No newline at end of file +var _0x0bb6=['delete','destroy','exports','util','express','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update'];(function(_0x1111ac,_0x27f3d9){var _0x2b30c6=function(_0xaa7256){while(--_0xaa7256){_0x1111ac['push'](_0x1111ac['shift']());}};_0x2b30c6(++_0x27f3d9);}(_0x0bb6,0xb3));var _0x60bb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0bb6[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x60bb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x60bb('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x60bb('0x2'));var config=require(_0x60bb('0x3'));var controller=require(_0x60bb('0x4'));router['put'](_0x60bb('0x5'),auth[_0x60bb('0x6')](),controller[_0x60bb('0x7')]);router[_0x60bb('0x8')](_0x60bb('0x5'),auth[_0x60bb('0x6')](),controller[_0x60bb('0x9')]);module[_0x60bb('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 32b3093..f99da77 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 _0x0832=['TEXT','sequelize','exports','STRING'];(function(_0x3a8a1e,_0x4504b3){var _0x589876=function(_0x503b2c){while(--_0x503b2c){_0x3a8a1e['push'](_0x3a8a1e['shift']());}};_0x589876(++_0x4504b3);}(_0x0832,0x1d5));var _0x2083=function(_0x7546eb,_0x22ea28){_0x7546eb=_0x7546eb-0x0;var _0x4836be=_0x0832[_0x7546eb];return _0x4836be;};'use strict';var Sequelize=require(_0x2083('0x0'));module[_0x2083('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x2083('0x2')]},'table':{'type':Sequelize[_0x2083('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x2083('0x3')]}}; \ No newline at end of file +var _0x1b24=['STRING','TEXT','sequelize','exports'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x1b24,0xfa));var _0x41b2=function(_0x2cf930,_0x3d8b3d){_0x2cf930=_0x2cf930-0x0;var _0x125bf9=_0x1b24[_0x2cf930];return _0x125bf9;};'use strict';var Sequelize=require(_0x41b2('0x0'));module[_0x41b2('0x1')]={'name':{'type':Sequelize[_0x41b2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x41b2('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x41b2('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index cf4f807..323a409 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 _0x57cf=['rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','select','table','metric','function','replace','format','order','orderBy','DESC','alias','joins','parse','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','MetricId','groupBy','Limited\x20Query:','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','IS\x20NULL','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','map','AnalyticCustomReport'];(function(_0x45f5db,_0x402f83){var _0x47d91e=function(_0x531f43){while(--_0x531f43){_0x45f5db['push'](_0x45f5db['shift']());}};_0x47d91e(++_0x402f83);}(_0x57cf,0x11b));var _0xf57c=function(_0x2ecdbe,_0x114206){_0x2ecdbe=_0x2ecdbe-0x0;var _0x44d6d4=_0x57cf[_0x2ecdbe];return _0x44d6d4;};'use strict';var pdf=require(_0xf57c('0x0'));var emlformat=require(_0xf57c('0x1'));var rimraf=require(_0xf57c('0x2'));var zipdir=require(_0xf57c('0x3'));var jsonpatch=require(_0xf57c('0x4'));var rp=require(_0xf57c('0x5'));var moment=require(_0xf57c('0x6'));var BPromise=require(_0xf57c('0x7'));var Mustache=require(_0xf57c('0x8'));var util=require(_0xf57c('0x9'));var path=require('path');var sox=require(_0xf57c('0xa'));var csv=require('to-csv');var ejs=require(_0xf57c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf57c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf57c('0xd'));var toCsv=require(_0xf57c('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf57c('0xf'));var authService=require(_0xf57c('0x10'));var qs=require(_0xf57c('0x11'));var as=require(_0xf57c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57c('0x13'))(_0xf57c('0x14'));var utils=require(_0xf57c('0x15'));var config=require('../../config/environment');var db=require(_0xf57c('0x16'))['db'];var dbH=require('../../mysqldb')[_0xf57c('0x17')];function respondWithStatusCode(_0x15e264,_0x4cc38b){_0x4cc38b=_0x4cc38b||0xcc;return function(_0x33e14e){if(_0x33e14e){return _0x15e264['sendStatus'](_0x4cc38b);}return _0x15e264[_0xf57c('0x18')](_0x4cc38b)['end']();};}function respondWithResult(_0x23c2b5,_0xc56c5){_0xc56c5=_0xc56c5||0xc8;return function(_0x79da63){if(_0x79da63){return _0x23c2b5[_0xf57c('0x18')](_0xc56c5)[_0xf57c('0x19')](_0x79da63);}};}function respondWithFilteredResult(_0x3d12a0,_0x1fb5f5){return function(_0x3163eb){if(_0x3163eb){var _0x517e09=_0x3163eb[_0xf57c('0x1a')],_0x33d8b5=_0x1fb5f5['offset'],_0x524084=_0x1fb5f5[_0xf57c('0x1b')]+_0x1fb5f5[_0xf57c('0x1c')],_0x3d461a;if(_0x524084>=_0x517e09){_0x524084=_0x517e09;_0x3d461a=0xc8;}else{_0x3d461a=0xce;}_0x3d12a0[_0xf57c('0x18')](_0x3d461a);return _0x3d12a0[_0xf57c('0x1d')](_0xf57c('0x1e'),_0x33d8b5+'-'+_0x524084+'/'+_0x517e09)['json'](_0x3163eb);}return null;};}function patchUpdates(_0x3c6e33){return function(_0x3cecb0){try{jsonpatch[_0xf57c('0x1f')](_0x3cecb0,_0x3c6e33,!![]);}catch(_0x586cbe){return BPromise['reject'](_0x586cbe);}return _0x3cecb0[_0xf57c('0x20')]();};}function saveUpdates(_0x1f8a65,_0x194c89){return function(_0x23a827){if(_0x23a827){return _0x23a827[_0xf57c('0x21')](_0x1f8a65)[_0xf57c('0x22')](function(_0xea8ee8){return _0xea8ee8;});}return null;};}function removeEntity(_0x396e18,_0xf3baee){return function(_0x50b440){if(_0x50b440){return _0x50b440[_0xf57c('0x23')]()[_0xf57c('0x22')](function(){var _0x551cf0=_0x50b440['get']({'plain':!![]});var _0x3c4923='CustomReports';return db[_0xf57c('0x24')][_0xf57c('0x23')]({'where':{'type':_0x3c4923,'resourceId':_0x551cf0['id']}})[_0xf57c('0x22')](function(){return _0x50b440;});})['then'](function(){_0x396e18[_0xf57c('0x18')](0xcc)[_0xf57c('0x25')]();});}};}function handleEntityNotFound(_0x5e3a89,_0x387d7c){return function(_0x2ac666){if(!_0x2ac666){_0x5e3a89[_0xf57c('0x26')](0x194);}return _0x2ac666;};}function handleError(_0x42d730,_0x3b14f9){_0x3b14f9=_0x3b14f9||0x1f4;return function(_0x404fbc){logger[_0xf57c('0x27')](_0x404fbc[_0xf57c('0x28')]);if(_0x404fbc[_0xf57c('0x29')]){delete _0x404fbc['name'];}_0x42d730[_0xf57c('0x18')](_0x3b14f9)[_0xf57c('0x2a')](_0x404fbc);};}exports['index']=function(_0x2e69e9,_0x81f27b){var _0xd710be={},_0x43a086={},_0x33ee51={'count':0x0,'rows':[]};var _0x3bf095=_[_0xf57c('0x2b')](db[_0xf57c('0x2c')][_0xf57c('0x2d')],function(_0x3d79a8){return{'name':_0x3d79a8['fieldName'],'type':_0x3d79a8[_0xf57c('0x2e')][_0xf57c('0x2f')]};});_0x43a086[_0xf57c('0x30')]=_['map'](_0x3bf095,'name');_0x43a086['query']=_[_0xf57c('0x31')](_0x2e69e9[_0xf57c('0x32')]);_0x43a086[_0xf57c('0x33')]=_[_0xf57c('0x34')](_0x43a086['model'],_0x43a086[_0xf57c('0x32')]);_0xd710be[_0xf57c('0x35')]=_[_0xf57c('0x34')](_0x43a086['model'],qs[_0xf57c('0x36')](_0x2e69e9[_0xf57c('0x32')][_0xf57c('0x36')]));_0xd710be[_0xf57c('0x35')]=_0xd710be[_0xf57c('0x35')][_0xf57c('0x37')]?_0xd710be['attributes']:_0x43a086[_0xf57c('0x30')];if(!_0x2e69e9[_0xf57c('0x32')]['hasOwnProperty']('nolimit')){_0xd710be[_0xf57c('0x1c')]=qs['limit'](_0x2e69e9[_0xf57c('0x32')]['limit']);_0xd710be[_0xf57c('0x1b')]=qs[_0xf57c('0x1b')](_0x2e69e9[_0xf57c('0x32')][_0xf57c('0x1b')]);}_0xd710be['order']=qs[_0xf57c('0x38')](_0x2e69e9['query'][_0xf57c('0x38')]);_0xd710be[_0xf57c('0x39')]=qs[_0xf57c('0x33')](_[_0xf57c('0x3a')](_0x2e69e9[_0xf57c('0x32')],_0x43a086[_0xf57c('0x33')]),_0x3bf095);if(_0x2e69e9['query']['filter']){_0xd710be[_0xf57c('0x39')]=_[_0xf57c('0x3b')](_0xd710be[_0xf57c('0x39')],{'$or':_['map'](_0x3bf095,function(_0x408e47){if(_0x408e47['type']!==_0xf57c('0x3c')){var _0x3306a0={};_0x3306a0[_0x408e47[_0xf57c('0x29')]]={'$like':'%'+_0x2e69e9['query'][_0xf57c('0x3d')]+'%'};return _0x3306a0;}})});}_0xd710be=_['merge']({},_0xd710be,_0x2e69e9[_0xf57c('0x3e')]);var _0x4e68d5={'where':_0xd710be[_0xf57c('0x39')]};return db[_0xf57c('0x2c')][_0xf57c('0x1a')](_0x4e68d5)[_0xf57c('0x22')](function(_0x2d4029){_0x33ee51['count']=_0x2d4029;if(_0x2e69e9[_0xf57c('0x32')][_0xf57c('0x3f')]){_0xd710be[_0xf57c('0x40')]=[{'all':!![]}];}return db[_0xf57c('0x2c')][_0xf57c('0x41')](_0xd710be);})[_0xf57c('0x22')](function(_0x22fad7){_0x33ee51[_0xf57c('0x42')]=_0x22fad7;return _0x33ee51;})[_0xf57c('0x22')](respondWithFilteredResult(_0x81f27b,_0xd710be))['catch'](handleError(_0x81f27b,null));};exports[_0xf57c('0x43')]=function(_0x15d782,_0x3a4fad){var _0x4e48e4={'raw':![],'where':{'id':_0x15d782[_0xf57c('0x44')]['id']}},_0x3955d5={};_0x3955d5[_0xf57c('0x30')]=_[_0xf57c('0x31')](db[_0xf57c('0x2c')][_0xf57c('0x2d')]);_0x3955d5[_0xf57c('0x32')]=_[_0xf57c('0x31')](_0x15d782[_0xf57c('0x32')]);_0x3955d5['filters']=_[_0xf57c('0x34')](_0x3955d5[_0xf57c('0x30')],_0x3955d5[_0xf57c('0x32')]);_0x4e48e4[_0xf57c('0x35')]=_['intersection'](_0x3955d5['model'],qs[_0xf57c('0x36')](_0x15d782[_0xf57c('0x32')][_0xf57c('0x36')]));_0x4e48e4[_0xf57c('0x35')]=_0x4e48e4[_0xf57c('0x35')][_0xf57c('0x37')]?_0x4e48e4['attributes']:_0x3955d5['model'];if(_0x15d782[_0xf57c('0x32')]['includeAll']){_0x4e48e4['include']=[{'all':!![]}];}_0x4e48e4=_[_0xf57c('0x3b')]({},_0x4e48e4,_0x15d782[_0xf57c('0x3e')]);return db[_0xf57c('0x2c')][_0xf57c('0x45')](_0x4e48e4)['then'](handleEntityNotFound(_0x3a4fad,null))[_0xf57c('0x22')](respondWithResult(_0x3a4fad,null))[_0xf57c('0x46')](handleError(_0x3a4fad,null));};exports[_0xf57c('0x47')]=function(_0x5ebcdc,_0x4fb83e){return db[_0xf57c('0x2c')][_0xf57c('0x47')](_0x5ebcdc[_0xf57c('0x48')],{})[_0xf57c('0x22')](function(_0x3baf7a){var _0x266c62=_0x5ebcdc['user']['get']({'plain':!![]});if(!_0x266c62)throw new Error(_0xf57c('0x49'));if(_0x266c62[_0xf57c('0x4a')]===_0xf57c('0x4b')){var _0x308d74=_0x3baf7a[_0xf57c('0x4c')]({'plain':!![]});var _0x51fff4=_0xf57c('0x4d');return db['UserProfileSection'][_0xf57c('0x45')]({'where':{'name':_0x51fff4,'userProfileId':_0x266c62[_0xf57c('0x4e')]},'raw':!![]})[_0xf57c('0x22')](function(_0x298f9f){if(_0x298f9f&&_0x298f9f[_0xf57c('0x4f')]===0x0){return db[_0xf57c('0x24')]['create']({'name':_0x308d74[_0xf57c('0x29')],'resourceId':_0x308d74['id'],'type':'CustomReports','sectionId':_0x298f9f['id']},{})[_0xf57c('0x22')](function(){return _0x3baf7a;});}else{return _0x3baf7a;}})[_0xf57c('0x46')](function(_0x4e52a6){logger[_0xf57c('0x27')](_0xf57c('0x50'),_0x4e52a6);throw _0x4e52a6;});}return _0x3baf7a;})[_0xf57c('0x22')](respondWithResult(_0x4fb83e,0xc9))[_0xf57c('0x46')](handleError(_0x4fb83e,null));};exports[_0xf57c('0x21')]=function(_0x4f47dc,_0x425d95){if(_0x4f47dc['body']['id']){delete _0x4f47dc['body']['id'];}return db[_0xf57c('0x2c')][_0xf57c('0x45')]({'where':{'id':_0x4f47dc[_0xf57c('0x44')]['id']}})['then'](handleEntityNotFound(_0x425d95,null))[_0xf57c('0x22')](saveUpdates(_0x4f47dc[_0xf57c('0x48')],null))[_0xf57c('0x22')](respondWithResult(_0x425d95,null))[_0xf57c('0x46')](handleError(_0x425d95,null));};exports['destroy']=function(_0x5e894d,_0xcef78d){return db['AnalyticCustomReport'][_0xf57c('0x45')]({'where':{'id':_0x5e894d[_0xf57c('0x44')]['id']}})[_0xf57c('0x22')](handleEntityNotFound(_0xcef78d,null))['then'](removeEntity(_0xcef78d,null))[_0xf57c('0x46')](handleError(_0xcef78d,null));};exports[_0xf57c('0x51')]=function(_0x10b680,_0x13e25d){var _0x364c18=0xa;var _0x255a2a=[_0xf57c('0x52'),_0xf57c('0x53'),_0xf57c('0x54'),_0xf57c('0x55')];var _0x10d469={'SUM':_0xf57c('0x56'),'COUNT':_0xf57c('0x57'),'COUNT DISTINCT':_0xf57c('0x58'),'MAX':_0xf57c('0x59'),'MIN':_0xf57c('0x5a'),'AVG':_0xf57c('0x5b'),'GROUP_CONCAT':_0xf57c('0x5c'),'GROUP_CONCAT ASC':_0xf57c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x512a24={'SEC_TO_TIME':_0xf57c('0x5e'),'DATE':'DATE(%s)','HOUR':_0xf57c('0x5f'),'ROUND':_0xf57c('0x60'),'UNIX_TIMESTAMP':_0xf57c('0x61')};var _0x349c70=function(_0x517980){return!_[_0xf57c('0x62')](['IS\x20NULL',_0xf57c('0x63'),_0xf57c('0x64'),_0xf57c('0x65')],_0x517980);};var _0x1a9c1a=function(_0x43ed66){if(!_0x43ed66||!_0x43ed66[_0xf57c('0x66')][_0xf57c('0x37')]){return'';}for(var _0x49ba6e='(',_0x3eb91c=0x0;_0x3eb91c<_0x43ed66[_0xf57c('0x66')][_0xf57c('0x37')];_0x3eb91c+=0x1){_0x3eb91c>0x0&&(_0x49ba6e+='\x20'+_0x43ed66[_0xf57c('0x67')]+'\x20');_0x49ba6e+=_0x43ed66['rules'][_0x3eb91c]['group']?_0x1a9c1a(_0x43ed66[_0xf57c('0x66')][_0x3eb91c][_0xf57c('0x68')]):_0x43ed66[_0xf57c('0x66')][_0x3eb91c][_0xf57c('0x69')]+'\x20'+_0x43ed66[_0xf57c('0x66')][_0x3eb91c][_0xf57c('0x6a')]+(_0x349c70(_0x43ed66[_0xf57c('0x66')][_0x3eb91c][_0xf57c('0x6a')])?'\x20'+_0x43ed66[_0xf57c('0x66')][_0x3eb91c][_0xf57c('0x6b')]:'');}return _0x49ba6e+')';};var _0x68d2fa={'where':{'id':_0x10b680[_0xf57c('0x44')]['id']}},_0x3de481,_0x1cc6a6,_0x1be8d1,_0xa1644a,_0x1d0a3d;_0x68d2fa=_[_0xf57c('0x3b')]({},_0x68d2fa,_0x10b680[_0xf57c('0x3e')]);return db[_0xf57c('0x2c')][_0xf57c('0x45')](_0x68d2fa)[_0xf57c('0x22')](function(_0x410b7f){if(_0x410b7f){_0x3de481=_0x410b7f;return _0x410b7f[_0xf57c('0x6c')]();}return null;})[_0xf57c('0x22')](function(_0x32b79d){if(_0x32b79d){if(!_0x32b79d[_0xf57c('0x37')]){throw new db['Sequelize'][(_0xf57c('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1cc6a6=_0x32b79d;return db[_0xf57c('0x6e')][_0xf57c('0x41')]({'raw':!![]});}return null;})[_0xf57c('0x22')](function(_0x3184a0){if(_0x3184a0){_0x1be8d1=_['keyBy'](_0x3184a0,'id');var _0x4f8683;var _0xf11d8c=squel[_0xf57c('0x6f')]();_0xf11d8c['from'](_0x3de481[_0xf57c('0x70')]);for(var _0x5f2fde=0x0;_0x5f2fde<_0x1cc6a6[_0xf57c('0x37')];_0x5f2fde+=0x1){_0x4f8683=_0x1cc6a6[_0x5f2fde]['MetricId']?_0x1be8d1[_0x1cc6a6[_0x5f2fde]['MetricId']][_0xf57c('0x71')]:_0x1cc6a6[_0x5f2fde][_0xf57c('0x69')];_0x4f8683=_0x1cc6a6[_0x5f2fde][_0xf57c('0x72')]?_[_0xf57c('0x73')](_0x10d469[_0x1cc6a6[_0x5f2fde][_0xf57c('0x72')]],'%s',_0x4f8683):_0x4f8683;_0x4f8683=_0x1cc6a6[_0x5f2fde]['format']?_['replace'](_0x512a24[_0x1cc6a6[_0x5f2fde][_0xf57c('0x74')]],'%s',_0x4f8683):_0x4f8683;if(_0x1cc6a6[_0x5f2fde]['groupBy']){_0xf11d8c[_0xf57c('0x68')](_0x4f8683);}_0x1cc6a6[_0x5f2fde]['orderBy']&&_0xf11d8c[_0xf57c('0x75')](_0x4f8683,_0x1cc6a6[_0x5f2fde][_0xf57c('0x76')]===_0xf57c('0x77')?![]:!![]);_0xf11d8c['field'](_0x4f8683,_0x1cc6a6[_0x5f2fde][_0xf57c('0x78')]||_0x4f8683);}if(_0x3de481[_0xf57c('0x79')]){_0x3de481['joins']=JSON[_0xf57c('0x7a')](_0x3de481[_0xf57c('0x79')]);for(var _0x5af08d=0x0;_0x5af08d<_0x3de481[_0xf57c('0x79')][_0xf57c('0x37')];_0x5af08d+=0x1){if(_0x3de481[_0xf57c('0x79')][_0x5af08d]['type']&&_[_0xf57c('0x62')](_0x255a2a,_0x3de481[_0xf57c('0x79')][_0x5af08d][_0xf57c('0x2e')])&&_0x3de481[_0xf57c('0x79')][_0x5af08d]['parentKey']&&_0x3de481[_0xf57c('0x79')][_0x5af08d]['foreignTable']&&_0x3de481[_0xf57c('0x79')][_0x5af08d][_0xf57c('0x7b')]){_0xf11d8c[_0x3de481['joins'][_0x5af08d][_0xf57c('0x2e')]](_0x3de481[_0xf57c('0x79')][_0x5af08d][_0xf57c('0x7c')],null,util[_0xf57c('0x74')](_0xf57c('0x7d'),_0x3de481[_0xf57c('0x70')],_0x3de481[_0xf57c('0x79')][_0x5af08d][_0xf57c('0x7e')],_0x3de481[_0xf57c('0x79')][_0x5af08d]['foreignTable'],_0x3de481[_0xf57c('0x79')][_0x5af08d][_0xf57c('0x7b')]));}}}if(_0x3de481['conditions']){_0x3de481[_0xf57c('0x7f')]=JSON['parse'](_0x3de481[_0xf57c('0x7f')]);_0xf11d8c['where'](_0x1a9c1a(_0x3de481['conditions'][_0xf57c('0x68')]));}_0x1d0a3d=_0xf11d8c[_0xf57c('0x80')]();_0xf11d8c['limit'](_0x364c18);_0xf11d8c[_0xf57c('0x1b')](0x0);logger[_0xf57c('0x81')]('Limited\x20Query:',_0xf11d8c['toString']());return db[_0xf57c('0x82')][_0xf57c('0x32')](_0xf11d8c[_0xf57c('0x83')](),{'type':db[_0xf57c('0x82')][_0xf57c('0x84')][_0xf57c('0x85')]});}})['then'](respondWithResult(_0x13e25d,null))[_0xf57c('0x46')](handleError(_0x13e25d,null));};function runReport(_0x2753e7,_0x5bd700,_0x359083){var _0x17639f=_0x5bd700[_0xf57c('0x29')];var _0x3344a2=0xa;var _0xd387ac=[_0xf57c('0x52'),_0xf57c('0x53'),_0xf57c('0x54'),'cross_join'];var _0x4fca09={'SUM':_0xf57c('0x56'),'COUNT':_0xf57c('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf57c('0x5a'),'AVG':_0xf57c('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf57c('0x5d'),'GROUP_CONCAT DESC':_0xf57c('0x86')};var _0x307c60={'SEC_TO_TIME':_0xf57c('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xf57c('0x60'),'UNIX_TIMESTAMP':_0xf57c('0x61')};var _0x2b90bc=function(_0xe1f9c1){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xf57c('0x64'),_0xf57c('0x65')],_0xe1f9c1);};var _0x3695f7=function(_0x58bb9b){if(!_0x58bb9b||!_0x58bb9b['rules']['length']){return'';}for(var _0x39fb70='(',_0x25e3a8=0x0;_0x25e3a8<_0x58bb9b['rules']['length'];_0x25e3a8+=0x1){_0x25e3a8>0x0&&(_0x39fb70+='\x20'+_0x58bb9b[_0xf57c('0x67')]+'\x20');_0x39fb70+=_0x58bb9b['rules'][_0x25e3a8][_0xf57c('0x68')]?_0x3695f7(_0x58bb9b[_0xf57c('0x66')][_0x25e3a8]['group']):_0x58bb9b['rules'][_0x25e3a8][_0xf57c('0x69')]+'\x20'+_0x58bb9b[_0xf57c('0x66')][_0x25e3a8][_0xf57c('0x6a')]+(_0x2b90bc(_0x58bb9b[_0xf57c('0x66')][_0x25e3a8][_0xf57c('0x6a')])?'\x20'+_0x58bb9b[_0xf57c('0x66')][_0x25e3a8][_0xf57c('0x6b')]:'');}return _0x39fb70+')';};var _0x2aa4b8={'where':{'id':_0x2753e7['id']}},_0x3118b9,_0x36938f,_0x33a52d,_0x4c00a7,_0x10d97e;_0x2aa4b8=_['merge']({},_0x2aa4b8,_0x359083);return db['AnalyticCustomReport'][_0xf57c('0x45')](_0x2aa4b8)[_0xf57c('0x22')](function(_0x1e97e2){if(_0x1e97e2){_0x3118b9=_0x1e97e2;return _0x1e97e2[_0xf57c('0x6c')]();}return null;})[_0xf57c('0x22')](function(_0x405f77){if(_0x405f77){if(!_0x405f77[_0xf57c('0x37')]){throw new db[(_0xf57c('0x87'))]['ValidationErrorItem'](_0xf57c('0x88'),0x193);}_0x36938f=_0x405f77;return db[_0xf57c('0x6e')][_0xf57c('0x41')]({'raw':!![]});}return null;})[_0xf57c('0x22')](function(_0x4b2dd1){if(_0x4b2dd1){_0x33a52d=_[_0xf57c('0x89')](_0x4b2dd1,'id');var _0x51d97c;var _0x454d8e=squel[_0xf57c('0x6f')]();_0x454d8e[_0xf57c('0x8a')](_0x3118b9['table']);for(var _0x3796d7=0x0;_0x3796d7<_0x36938f['length'];_0x3796d7+=0x1){_0x51d97c=_0x36938f[_0x3796d7]['MetricId']?_0x33a52d[_0x36938f[_0x3796d7][_0xf57c('0x8b')]][_0xf57c('0x71')]:_0x36938f[_0x3796d7][_0xf57c('0x69')];_0x51d97c=_0x36938f[_0x3796d7][_0xf57c('0x72')]?_[_0xf57c('0x73')](_0x4fca09[_0x36938f[_0x3796d7][_0xf57c('0x72')]],'%s',_0x51d97c):_0x51d97c;_0x51d97c=_0x36938f[_0x3796d7][_0xf57c('0x74')]?_['replace'](_0x307c60[_0x36938f[_0x3796d7][_0xf57c('0x74')]],'%s',_0x51d97c):_0x51d97c;if(_0x36938f[_0x3796d7][_0xf57c('0x8c')]){_0x454d8e[_0xf57c('0x68')](_0x51d97c);}_0x36938f[_0x3796d7]['orderBy']&&_0x454d8e['order'](_0x51d97c,_0x36938f[_0x3796d7][_0xf57c('0x76')]===_0xf57c('0x77')?![]:!![]);_0x454d8e[_0xf57c('0x69')](_0x51d97c,_0x36938f[_0x3796d7][_0xf57c('0x78')]||_0x51d97c);}if(_0x3118b9[_0xf57c('0x79')]){_0x3118b9[_0xf57c('0x79')]=JSON[_0xf57c('0x7a')](_0x3118b9[_0xf57c('0x79')]);for(var _0x3df22c=0x0;_0x3df22c<_0x3118b9[_0xf57c('0x79')][_0xf57c('0x37')];_0x3df22c+=0x1){if(_0x3118b9[_0xf57c('0x79')][_0x3df22c]['type']&&_[_0xf57c('0x62')](_0xd387ac,_0x3118b9['joins'][_0x3df22c]['type'])&&_0x3118b9[_0xf57c('0x79')][_0x3df22c][_0xf57c('0x7e')]&&_0x3118b9['joins'][_0x3df22c]['foreignTable']&&_0x3118b9[_0xf57c('0x79')][_0x3df22c][_0xf57c('0x7b')]){_0x454d8e[_0x3118b9[_0xf57c('0x79')][_0x3df22c][_0xf57c('0x2e')]](_0x3118b9['joins'][_0x3df22c][_0xf57c('0x7c')],null,util[_0xf57c('0x74')](_0xf57c('0x7d'),_0x3118b9[_0xf57c('0x70')],_0x3118b9[_0xf57c('0x79')][_0x3df22c][_0xf57c('0x7e')],_0x3118b9[_0xf57c('0x79')][_0x3df22c][_0xf57c('0x7c')],_0x3118b9[_0xf57c('0x79')][_0x3df22c][_0xf57c('0x7b')]));}}}if(_0x3118b9[_0xf57c('0x7f')]){_0x3118b9['conditions']=JSON[_0xf57c('0x7a')](_0x3118b9[_0xf57c('0x7f')]);_0x454d8e[_0xf57c('0x39')](_0x3695f7(_0x3118b9[_0xf57c('0x7f')][_0xf57c('0x68')]));}_0x10d97e=_0x454d8e[_0xf57c('0x80')]();_0x454d8e['limit'](_0x3344a2);_0x454d8e[_0xf57c('0x1b')](0x0);logger[_0xf57c('0x81')](_0xf57c('0x8d'),_0x454d8e[_0xf57c('0x83')]());return db[_0xf57c('0x82')][_0xf57c('0x32')](_0x454d8e[_0xf57c('0x83')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})['then'](function(_0x2bd977){if(!_0x2bd977['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xf57c('0x8e'),0xcc);}if(_0x5bd700[_0xf57c('0x8f')]==='web'){return null;}var _0x10a4ab=_['merge'](_0x5bd700,{'name':_0x5bd700[_0xf57c('0x90')]||_0x5bd700[_0xf57c('0x29')]||_0x3118b9[_0xf57c('0x29')],'basename':_0x17639f,'savename':util[_0xf57c('0x74')](_0xf57c('0x91'),_0x5bd700[_0xf57c('0x29')]||_0x3118b9[_0xf57c('0x29')],require(_0xf57c('0x92'))['generate'](0x4),_0x5bd700['output']||_0xf57c('0x93')),'reportId':_0x3118b9['id'],'reportType':_0xf57c('0x94')});return db[_0xf57c('0x95')][_0xf57c('0x47')](_0x10a4ab,{'raw':!![]});})[_0xf57c('0x22')](function(_0xace482){if(_0x3118b9['table']===_0xf57c('0x96')){_0x10d97e[_0xf57c('0x39')](_0x3118b9['table']+_0xf57c('0x97'),_0x5bd700[_0xf57c('0x98')],_0x5bd700[_0xf57c('0x99')]);}else{_0x10d97e[_0xf57c('0x39')](_0x3118b9[_0xf57c('0x70')]+_0xf57c('0x9a'),_0x5bd700[_0xf57c('0x98')],_0x5bd700[_0xf57c('0x99')]);}if(_0xace482){logger['info']('Run\x20Query:',_0x10d97e[_0xf57c('0x83')]());require(_0xf57c('0x9b'))[_0xf57c('0x9c')](path['join'](__dirname,_0xf57c('0x9d'),_0xace482[_0xf57c('0x8f')]),[_0xace482['id'],_0x10d97e[_0xf57c('0x83')](),path[_0xf57c('0x52')](__dirname,_0xf57c('0x9e'),_0xace482['savename']),_0x17639f]);return _0xace482;}else{var _0x442962=squel[_0xf57c('0x6f')]();_0x442962['from']('('+_0x10d97e['toString']()+')',_0xf57c('0x9f'));_0x442962[_0xf57c('0x69')](_0xf57c('0xa0'),_0xf57c('0x1a'));_0x10d97e[_0xf57c('0x1c')](_0x5bd700[_0xf57c('0x1c')]||_0x3344a2);_0x10d97e[_0xf57c('0x1b')](_0x5bd700['offset']||0x0);return dbH[_0xf57c('0x82')]['query'](_0x442962[_0xf57c('0x83')](),{'type':dbH[_0xf57c('0x82')]['QueryTypes'][_0xf57c('0x85')]})[_0xf57c('0x22')](function(_0x5b4660){if(!_0x5b4660[_0xf57c('0x37')]){_0x4c00a7=0x0;}else{_0x4c00a7=_0x5b4660[0x0][_0xf57c('0x1a')]||0x0;}return dbH[_0xf57c('0x82')][_0xf57c('0x32')](_0x10d97e['toString'](),{'type':dbH['sequelize'][_0xf57c('0x84')][_0xf57c('0x85')]});})[_0xf57c('0x22')](function(_0x17935b){return{'rows':_0x17935b||[],'count':_0x4c00a7};});}});}exports[_0xf57c('0xa1')]=function(_0xc4dbfa,_0x5c3b3d){return runReport(_0xc4dbfa[_0xf57c('0x44')],_0xc4dbfa[_0xf57c('0x32')],_0xc4dbfa[_0xf57c('0x3e')])['then'](respondWithResult(_0x5c3b3d,null))[_0xf57c('0x46')](handleError(_0x5c3b3d,null));};exports[_0xf57c('0xa2')]=runReport;exports['query']=function(_0x2797e2,_0x3aceb8){var _0x93dabd=0xa;var _0x3f78bf=[_0xf57c('0x52'),_0xf57c('0x53'),_0xf57c('0x54'),_0xf57c('0x55')];var _0x51049a={'SUM':_0xf57c('0x56'),'COUNT':_0xf57c('0x57'),'COUNT DISTINCT':_0xf57c('0x58'),'MAX':_0xf57c('0x59'),'MIN':_0xf57c('0x5a'),'AVG':_0xf57c('0x5b'),'GROUP_CONCAT':_0xf57c('0x5c'),'GROUP_CONCAT ASC':_0xf57c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x736898={'SEC_TO_TIME':_0xf57c('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf57c('0x61')};var _0x475088=function(_0x57a8da){return!_[_0xf57c('0x62')]([_0xf57c('0xa3'),_0xf57c('0x63'),_0xf57c('0x64'),_0xf57c('0x65')],_0x57a8da);};var _0x5e15c=function(_0x4f5033){if(!_0x4f5033||!_0x4f5033['rules'][_0xf57c('0x37')]){return'';}for(var _0x24ddf8='(',_0xe0dce4=0x0;_0xe0dce4<_0x4f5033[_0xf57c('0x66')]['length'];_0xe0dce4+=0x1){_0xe0dce4>0x0&&(_0x24ddf8+='\x20'+_0x4f5033[_0xf57c('0x67')]+'\x20');_0x24ddf8+=_0x4f5033[_0xf57c('0x66')][_0xe0dce4][_0xf57c('0x68')]?_0x5e15c(_0x4f5033[_0xf57c('0x66')][_0xe0dce4][_0xf57c('0x68')]):_0x4f5033[_0xf57c('0x66')][_0xe0dce4][_0xf57c('0x69')]+'\x20'+_0x4f5033[_0xf57c('0x66')][_0xe0dce4][_0xf57c('0x6a')]+(_0x475088(_0x4f5033[_0xf57c('0x66')][_0xe0dce4][_0xf57c('0x6a')])?'\x20'+_0x4f5033[_0xf57c('0x66')][_0xe0dce4][_0xf57c('0x6b')]:'');}return _0x24ddf8+')';};var _0x15c294={'where':{'id':_0x2797e2['params']['id']}},_0x4e88a5,_0x2ab3e7,_0x1d5010,_0x5692e1,_0x2c270c;_0x15c294=_[_0xf57c('0x3b')]({},_0x15c294,_0x2797e2[_0xf57c('0x3e')]);return db['AnalyticCustomReport'][_0xf57c('0x45')](_0x15c294)[_0xf57c('0x22')](function(_0x31f557){if(_0x31f557){_0x4e88a5=_0x31f557;return _0x31f557[_0xf57c('0x6c')]();}return null;})[_0xf57c('0x22')](function(_0x110028){if(_0x110028){if(!_0x110028[_0xf57c('0x37')]){throw new db['Sequelize'][(_0xf57c('0x6d'))](_0xf57c('0x88'),0x193);}_0x2ab3e7=_0x110028;return db[_0xf57c('0x6e')][_0xf57c('0x41')]({'raw':!![]});}return null;})[_0xf57c('0x22')](function(_0x4916e4){if(_0x4916e4){_0x1d5010=_[_0xf57c('0x89')](_0x4916e4,'id');var _0xd252df;var _0x100644=squel[_0xf57c('0x6f')]();_0x100644[_0xf57c('0x8a')](_0x4e88a5['table']);for(var _0x3bae74=0x0;_0x3bae74<_0x2ab3e7['length'];_0x3bae74+=0x1){_0xd252df=_0x2ab3e7[_0x3bae74][_0xf57c('0x8b')]?_0x1d5010[_0x2ab3e7[_0x3bae74][_0xf57c('0x8b')]][_0xf57c('0x71')]:_0x2ab3e7[_0x3bae74]['field'];_0xd252df=_0x2ab3e7[_0x3bae74][_0xf57c('0x72')]?_['replace'](_0x51049a[_0x2ab3e7[_0x3bae74][_0xf57c('0x72')]],'%s',_0xd252df):_0xd252df;_0xd252df=_0x2ab3e7[_0x3bae74][_0xf57c('0x74')]?_[_0xf57c('0x73')](_0x736898[_0x2ab3e7[_0x3bae74][_0xf57c('0x74')]],'%s',_0xd252df):_0xd252df;if(_0x2ab3e7[_0x3bae74][_0xf57c('0x8c')]){_0x100644[_0xf57c('0x68')](_0xd252df);}_0x2ab3e7[_0x3bae74][_0xf57c('0x76')]&&_0x100644['order'](_0xd252df,_0x2ab3e7[_0x3bae74][_0xf57c('0x76')]===_0xf57c('0x77')?![]:!![]);_0x100644[_0xf57c('0x69')](_0xd252df,_0x2ab3e7[_0x3bae74][_0xf57c('0x78')]||_0xd252df);}if(_0x4e88a5[_0xf57c('0x79')]){_0x4e88a5['joins']=JSON[_0xf57c('0x7a')](_0x4e88a5[_0xf57c('0x79')]);for(var _0x46289e=0x0;_0x46289e<_0x4e88a5[_0xf57c('0x79')][_0xf57c('0x37')];_0x46289e+=0x1){if(_0x4e88a5[_0xf57c('0x79')][_0x46289e][_0xf57c('0x2e')]&&_[_0xf57c('0x62')](_0x3f78bf,_0x4e88a5[_0xf57c('0x79')][_0x46289e][_0xf57c('0x2e')])&&_0x4e88a5[_0xf57c('0x79')][_0x46289e]['parentKey']&&_0x4e88a5[_0xf57c('0x79')][_0x46289e][_0xf57c('0x7c')]&&_0x4e88a5['joins'][_0x46289e][_0xf57c('0x7b')]){_0x100644[_0x4e88a5[_0xf57c('0x79')][_0x46289e][_0xf57c('0x2e')]](_0x4e88a5[_0xf57c('0x79')][_0x46289e]['foreignTable'],null,util[_0xf57c('0x74')](_0xf57c('0x7d'),_0x4e88a5[_0xf57c('0x70')],_0x4e88a5['joins'][_0x46289e][_0xf57c('0x7e')],_0x4e88a5['joins'][_0x46289e][_0xf57c('0x7c')],_0x4e88a5['joins'][_0x46289e][_0xf57c('0x7b')]));}}}if(_0x4e88a5[_0xf57c('0x7f')]){_0x4e88a5['conditions']=JSON[_0xf57c('0x7a')](_0x4e88a5['conditions']);_0x100644[_0xf57c('0x39')](_0x5e15c(_0x4e88a5[_0xf57c('0x7f')][_0xf57c('0x68')]));}_0x2c270c=_0x100644['clone']();_0x100644[_0xf57c('0x1c')](_0x93dabd);_0x100644['offset'](0x0);logger[_0xf57c('0x81')]('Limited\x20Query:',_0x100644[_0xf57c('0x83')]());return db[_0xf57c('0x82')][_0xf57c('0x32')](_0x100644['toString'](),{'type':db[_0xf57c('0x82')][_0xf57c('0x84')][_0xf57c('0x85')]});}})[_0xf57c('0x22')](function(){return{'sql':_0x2c270c['toString']()};})['then'](respondWithResult(_0x3aceb8,null))['catch'](handleError(_0x3aceb8,null));}; \ No newline at end of file +var _0x3cfb=['filters','model','attributes','intersection','fields','length','nolimit','order','sort','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','IS\x20NULL','debug','Limited\x20Query:','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','AVG(%s)','DESC','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','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','dbH','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','AnalyticCustomReport','type','key','map','query','keys'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x272757,_0x4a5890){_0x272757=_0x272757-0x0;var _0x27d9d9=_0x3cfb[_0x272757];return _0x27d9d9;};'use strict';var pdf=require(_0xb3cf('0x0'));var emlformat=require(_0xb3cf('0x1'));var rimraf=require(_0xb3cf('0x2'));var zipdir=require(_0xb3cf('0x3'));var jsonpatch=require(_0xb3cf('0x4'));var rp=require(_0xb3cf('0x5'));var moment=require(_0xb3cf('0x6'));var BPromise=require(_0xb3cf('0x7'));var Mustache=require('mustache');var util=require(_0xb3cf('0x8'));var path=require(_0xb3cf('0x9'));var sox=require(_0xb3cf('0xa'));var csv=require('to-csv');var ejs=require(_0xb3cf('0xb'));var fs=require('fs');var _=require(_0xb3cf('0xc'));var squel=require(_0xb3cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xb3cf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3cf('0xf'));var Papa=require(_0xb3cf('0x10'));var Redis=require(_0xb3cf('0x11'));var authService=require(_0xb3cf('0x12'));var qs=require(_0xb3cf('0x13'));var as=require(_0xb3cf('0x14'));var hardwareService=require(_0xb3cf('0x15'));var logger=require(_0xb3cf('0x16'))(_0xb3cf('0x17'));var utils=require(_0xb3cf('0x18'));var config=require(_0xb3cf('0x19'));var db=require(_0xb3cf('0x1a'))['db'];var dbH=require(_0xb3cf('0x1a'))[_0xb3cf('0x1b')];function respondWithStatusCode(_0x16bb17,_0x530325){_0x530325=_0x530325||0xcc;return function(_0x495b2a){if(_0x495b2a){return _0x16bb17[_0xb3cf('0x1c')](_0x530325);}return _0x16bb17[_0xb3cf('0x1d')](_0x530325)['end']();};}function respondWithResult(_0x21ce6c,_0x510bae){_0x510bae=_0x510bae||0xc8;return function(_0x5c7a5c){if(_0x5c7a5c){return _0x21ce6c[_0xb3cf('0x1d')](_0x510bae)[_0xb3cf('0x1e')](_0x5c7a5c);}};}function respondWithFilteredResult(_0x2eff5c,_0x56f703){return function(_0x17e8cd){if(_0x17e8cd){var _0x87f87=_0x17e8cd[_0xb3cf('0x1f')],_0x3abe89=_0x56f703[_0xb3cf('0x20')],_0x442fd6=_0x56f703[_0xb3cf('0x20')]+_0x56f703[_0xb3cf('0x21')],_0x2afac9;if(_0x442fd6>=_0x87f87){_0x442fd6=_0x87f87;_0x2afac9=0xc8;}else{_0x2afac9=0xce;}_0x2eff5c[_0xb3cf('0x1d')](_0x2afac9);return _0x2eff5c['set'](_0xb3cf('0x22'),_0x3abe89+'-'+_0x442fd6+'/'+_0x87f87)[_0xb3cf('0x1e')](_0x17e8cd);}return null;};}function patchUpdates(_0x35fb62){return function(_0x416910){try{jsonpatch['apply'](_0x416910,_0x35fb62,!![]);}catch(_0x25d2f0){return BPromise[_0xb3cf('0x23')](_0x25d2f0);}return _0x416910[_0xb3cf('0x24')]();};}function saveUpdates(_0x1dfbc3,_0x283249){return function(_0x2ee4a0){if(_0x2ee4a0){return _0x2ee4a0[_0xb3cf('0x25')](_0x1dfbc3)[_0xb3cf('0x26')](function(_0x33ed8f){return _0x33ed8f;});}return null;};}function removeEntity(_0x1bfe02,_0x4c96fd){return function(_0x227360){if(_0x227360){return _0x227360[_0xb3cf('0x27')]()[_0xb3cf('0x26')](function(){var _0x203ce3=_0x227360[_0xb3cf('0x28')]({'plain':!![]});var _0x402d3e=_0xb3cf('0x29');return db[_0xb3cf('0x2a')][_0xb3cf('0x27')]({'where':{'type':_0x402d3e,'resourceId':_0x203ce3['id']}})[_0xb3cf('0x26')](function(){return _0x227360;});})['then'](function(){_0x1bfe02[_0xb3cf('0x1d')](0xcc)[_0xb3cf('0x2b')]();});}};}function handleEntityNotFound(_0x1662e5,_0x4fd689){return function(_0x4cae37){if(!_0x4cae37){_0x1662e5[_0xb3cf('0x1c')](0x194);}return _0x4cae37;};}function handleError(_0x173177,_0x5dfe51){_0x5dfe51=_0x5dfe51||0x1f4;return function(_0x5ce23b){logger[_0xb3cf('0x2c')](_0x5ce23b[_0xb3cf('0x2d')]);if(_0x5ce23b['name']){delete _0x5ce23b[_0xb3cf('0x2e')];}_0x173177[_0xb3cf('0x1d')](_0x5dfe51)[_0xb3cf('0x2f')](_0x5ce23b);};}exports[_0xb3cf('0x30')]=function(_0x1b1460,_0x440fb6){var _0x1203a4={},_0x11efb3={},_0x501402={'count':0x0,'rows':[]};var _0x2fc46b=_['map'](db[_0xb3cf('0x31')]['rawAttributes'],function(_0x4dd278){return{'name':_0x4dd278['fieldName'],'type':_0x4dd278[_0xb3cf('0x32')][_0xb3cf('0x33')]};});_0x11efb3['model']=_[_0xb3cf('0x34')](_0x2fc46b,_0xb3cf('0x2e'));_0x11efb3[_0xb3cf('0x35')]=_[_0xb3cf('0x36')](_0x1b1460[_0xb3cf('0x35')]);_0x11efb3[_0xb3cf('0x37')]=_['intersection'](_0x11efb3[_0xb3cf('0x38')],_0x11efb3['query']);_0x1203a4[_0xb3cf('0x39')]=_[_0xb3cf('0x3a')](_0x11efb3[_0xb3cf('0x38')],qs[_0xb3cf('0x3b')](_0x1b1460[_0xb3cf('0x35')][_0xb3cf('0x3b')]));_0x1203a4['attributes']=_0x1203a4['attributes'][_0xb3cf('0x3c')]?_0x1203a4['attributes']:_0x11efb3['model'];if(!_0x1b1460[_0xb3cf('0x35')]['hasOwnProperty'](_0xb3cf('0x3d'))){_0x1203a4[_0xb3cf('0x21')]=qs[_0xb3cf('0x21')](_0x1b1460[_0xb3cf('0x35')][_0xb3cf('0x21')]);_0x1203a4[_0xb3cf('0x20')]=qs['offset'](_0x1b1460[_0xb3cf('0x35')][_0xb3cf('0x20')]);}_0x1203a4[_0xb3cf('0x3e')]=qs[_0xb3cf('0x3f')](_0x1b1460['query'][_0xb3cf('0x3f')]);_0x1203a4['where']=qs[_0xb3cf('0x37')](_['pick'](_0x1b1460[_0xb3cf('0x35')],_0x11efb3[_0xb3cf('0x37')]),_0x2fc46b);if(_0x1b1460[_0xb3cf('0x35')]['filter']){_0x1203a4['where']=_[_0xb3cf('0x40')](_0x1203a4[_0xb3cf('0x41')],{'$or':_['map'](_0x2fc46b,function(_0x4e01e4){if(_0x4e01e4['type']!==_0xb3cf('0x42')){var _0x1b0b51={};_0x1b0b51[_0x4e01e4['name']]={'$like':'%'+_0x1b1460['query']['filter']+'%'};return _0x1b0b51;}})});}_0x1203a4=_[_0xb3cf('0x40')]({},_0x1203a4,_0x1b1460[_0xb3cf('0x43')]);var _0x13953b={'where':_0x1203a4[_0xb3cf('0x41')]};return db['AnalyticCustomReport']['count'](_0x13953b)[_0xb3cf('0x26')](function(_0x395628){_0x501402[_0xb3cf('0x1f')]=_0x395628;if(_0x1b1460[_0xb3cf('0x35')]['includeAll']){_0x1203a4[_0xb3cf('0x44')]=[{'all':!![]}];}return db[_0xb3cf('0x31')][_0xb3cf('0x45')](_0x1203a4);})[_0xb3cf('0x26')](function(_0x56c5b5){_0x501402[_0xb3cf('0x46')]=_0x56c5b5;return _0x501402;})[_0xb3cf('0x26')](respondWithFilteredResult(_0x440fb6,_0x1203a4))[_0xb3cf('0x47')](handleError(_0x440fb6,null));};exports['show']=function(_0x2486d1,_0x4c795b){var _0x4fa75a={'raw':![],'where':{'id':_0x2486d1[_0xb3cf('0x48')]['id']}},_0x2af50b={};_0x2af50b['model']=_['keys'](db[_0xb3cf('0x31')][_0xb3cf('0x49')]);_0x2af50b[_0xb3cf('0x35')]=_['keys'](_0x2486d1[_0xb3cf('0x35')]);_0x2af50b[_0xb3cf('0x37')]=_[_0xb3cf('0x3a')](_0x2af50b[_0xb3cf('0x38')],_0x2af50b[_0xb3cf('0x35')]);_0x4fa75a[_0xb3cf('0x39')]=_[_0xb3cf('0x3a')](_0x2af50b[_0xb3cf('0x38')],qs['fields'](_0x2486d1[_0xb3cf('0x35')][_0xb3cf('0x3b')]));_0x4fa75a[_0xb3cf('0x39')]=_0x4fa75a[_0xb3cf('0x39')][_0xb3cf('0x3c')]?_0x4fa75a[_0xb3cf('0x39')]:_0x2af50b['model'];if(_0x2486d1[_0xb3cf('0x35')][_0xb3cf('0x4a')]){_0x4fa75a[_0xb3cf('0x44')]=[{'all':!![]}];}_0x4fa75a=_[_0xb3cf('0x40')]({},_0x4fa75a,_0x2486d1[_0xb3cf('0x43')]);return db[_0xb3cf('0x31')][_0xb3cf('0x4b')](_0x4fa75a)[_0xb3cf('0x26')](handleEntityNotFound(_0x4c795b,null))[_0xb3cf('0x26')](respondWithResult(_0x4c795b,null))[_0xb3cf('0x47')](handleError(_0x4c795b,null));};exports[_0xb3cf('0x4c')]=function(_0x45e6bb,_0x5d4146){return db[_0xb3cf('0x31')]['create'](_0x45e6bb[_0xb3cf('0x4d')],{})['then'](function(_0x2ef02b){var _0x58398e=_0x45e6bb[_0xb3cf('0x4e')]['get']({'plain':!![]});if(!_0x58398e)throw new Error(_0xb3cf('0x4f'));if(_0x58398e[_0xb3cf('0x50')]===_0xb3cf('0x4e')){var _0xe8872b=_0x2ef02b['get']({'plain':!![]});var _0x4d6e81=_0xb3cf('0x51');return db[_0xb3cf('0x52')][_0xb3cf('0x4b')]({'where':{'name':_0x4d6e81,'userProfileId':_0x58398e[_0xb3cf('0x53')]},'raw':!![]})[_0xb3cf('0x26')](function(_0x40104e){if(_0x40104e&&_0x40104e['autoAssociation']===0x0){return db['UserProfileResource'][_0xb3cf('0x4c')]({'name':_0xe8872b[_0xb3cf('0x2e')],'resourceId':_0xe8872b['id'],'type':_0xb3cf('0x29'),'sectionId':_0x40104e['id']},{})[_0xb3cf('0x26')](function(){return _0x2ef02b;});}else{return _0x2ef02b;}})[_0xb3cf('0x47')](function(_0x788ad9){logger[_0xb3cf('0x2c')](_0xb3cf('0x54'),_0x788ad9);throw _0x788ad9;});}return _0x2ef02b;})[_0xb3cf('0x26')](respondWithResult(_0x5d4146,0xc9))[_0xb3cf('0x47')](handleError(_0x5d4146,null));};exports['update']=function(_0x33e16e,_0xbc98ad){if(_0x33e16e[_0xb3cf('0x4d')]['id']){delete _0x33e16e['body']['id'];}return db[_0xb3cf('0x31')]['find']({'where':{'id':_0x33e16e['params']['id']}})[_0xb3cf('0x26')](handleEntityNotFound(_0xbc98ad,null))['then'](saveUpdates(_0x33e16e[_0xb3cf('0x4d')],null))['then'](respondWithResult(_0xbc98ad,null))['catch'](handleError(_0xbc98ad,null));};exports['destroy']=function(_0x5e0973,_0x283799){return db['AnalyticCustomReport'][_0xb3cf('0x4b')]({'where':{'id':_0x5e0973[_0xb3cf('0x48')]['id']}})[_0xb3cf('0x26')](handleEntityNotFound(_0x283799,null))[_0xb3cf('0x26')](removeEntity(_0x283799,null))[_0xb3cf('0x47')](handleError(_0x283799,null));};exports['preview']=function(_0xd23894,_0x196923){var _0x566af2=0xa;var _0x238190=[_0xb3cf('0x55'),_0xb3cf('0x56'),_0xb3cf('0x57'),_0xb3cf('0x58')];var _0x41183a={'SUM':_0xb3cf('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb3cf('0x5a'),'MAX':_0xb3cf('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xb3cf('0x5c'),'GROUP_CONCAT ASC':_0xb3cf('0x5d'),'GROUP_CONCAT DESC':_0xb3cf('0x5e')};var _0x2aeda={'SEC_TO_TIME':_0xb3cf('0x5f'),'DATE':_0xb3cf('0x60'),'HOUR':_0xb3cf('0x61'),'ROUND':_0xb3cf('0x62'),'UNIX_TIMESTAMP':_0xb3cf('0x63')};var _0x4bf651=function(_0x42b570){return!_[_0xb3cf('0x64')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb3cf('0x65'),_0xb3cf('0x66')],_0x42b570);};var _0x59f38e=function(_0x45b15f){if(!_0x45b15f||!_0x45b15f[_0xb3cf('0x67')][_0xb3cf('0x3c')]){return'';}for(var _0x5a678a='(',_0x4acfae=0x0;_0x4acfae<_0x45b15f[_0xb3cf('0x67')][_0xb3cf('0x3c')];_0x4acfae+=0x1){_0x4acfae>0x0&&(_0x5a678a+='\x20'+_0x45b15f[_0xb3cf('0x68')]+'\x20');_0x5a678a+=_0x45b15f[_0xb3cf('0x67')][_0x4acfae][_0xb3cf('0x69')]?_0x59f38e(_0x45b15f[_0xb3cf('0x67')][_0x4acfae][_0xb3cf('0x69')]):_0x45b15f[_0xb3cf('0x67')][_0x4acfae][_0xb3cf('0x6a')]+'\x20'+_0x45b15f[_0xb3cf('0x67')][_0x4acfae][_0xb3cf('0x6b')]+(_0x4bf651(_0x45b15f['rules'][_0x4acfae][_0xb3cf('0x6b')])?'\x20'+_0x45b15f[_0xb3cf('0x67')][_0x4acfae][_0xb3cf('0x6c')]:'');}return _0x5a678a+')';};var _0x10844a={'where':{'id':_0xd23894[_0xb3cf('0x48')]['id']}},_0xc15e93,_0x4f313f,_0x3a447e,_0x3b85ba,_0x4c2ffe;_0x10844a=_['merge']({},_0x10844a,_0xd23894['options']);return db[_0xb3cf('0x31')]['find'](_0x10844a)[_0xb3cf('0x26')](function(_0x23b0c5){if(_0x23b0c5){_0xc15e93=_0x23b0c5;return _0x23b0c5[_0xb3cf('0x6d')]();}return null;})[_0xb3cf('0x26')](function(_0x4dc30e){if(_0x4dc30e){if(!_0x4dc30e['length']){throw new db[(_0xb3cf('0x6e'))][(_0xb3cf('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4f313f=_0x4dc30e;return db[_0xb3cf('0x70')]['findAll']({'raw':!![]});}return null;})[_0xb3cf('0x26')](function(_0x327c85){if(_0x327c85){_0x3a447e=_[_0xb3cf('0x71')](_0x327c85,'id');var _0x4d489a;var _0x132150=squel[_0xb3cf('0x72')]();_0x132150[_0xb3cf('0x73')](_0xc15e93['table']);for(var _0x500887=0x0;_0x500887<_0x4f313f[_0xb3cf('0x3c')];_0x500887+=0x1){_0x4d489a=_0x4f313f[_0x500887]['MetricId']?_0x3a447e[_0x4f313f[_0x500887][_0xb3cf('0x74')]][_0xb3cf('0x75')]:_0x4f313f[_0x500887][_0xb3cf('0x6a')];_0x4d489a=_0x4f313f[_0x500887]['function']?_['replace'](_0x41183a[_0x4f313f[_0x500887][_0xb3cf('0x76')]],'%s',_0x4d489a):_0x4d489a;_0x4d489a=_0x4f313f[_0x500887]['format']?_[_0xb3cf('0x77')](_0x2aeda[_0x4f313f[_0x500887][_0xb3cf('0x78')]],'%s',_0x4d489a):_0x4d489a;if(_0x4f313f[_0x500887][_0xb3cf('0x79')]){_0x132150[_0xb3cf('0x69')](_0x4d489a);}_0x4f313f[_0x500887]['orderBy']&&_0x132150['order'](_0x4d489a,_0x4f313f[_0x500887][_0xb3cf('0x7a')]==='DESC'?![]:!![]);_0x132150[_0xb3cf('0x6a')](_0x4d489a,_0x4f313f[_0x500887][_0xb3cf('0x7b')]||_0x4d489a);}if(_0xc15e93[_0xb3cf('0x7c')]){_0xc15e93[_0xb3cf('0x7c')]=JSON['parse'](_0xc15e93['joins']);for(var _0x4f1fa2=0x0;_0x4f1fa2<_0xc15e93[_0xb3cf('0x7c')][_0xb3cf('0x3c')];_0x4f1fa2+=0x1){if(_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x32')]&&_['includes'](_0x238190,_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x32')])&&_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x7d')]&&_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x7e')]&&_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x7f')]){_0x132150[_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x32')]](_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x7e')],null,util['format'](_0xb3cf('0x80'),_0xc15e93[_0xb3cf('0x81')],_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x7d')],_0xc15e93[_0xb3cf('0x7c')][_0x4f1fa2][_0xb3cf('0x7e')],_0xc15e93['joins'][_0x4f1fa2][_0xb3cf('0x7f')]));}}}if(_0xc15e93[_0xb3cf('0x82')]){_0xc15e93['conditions']=JSON[_0xb3cf('0x83')](_0xc15e93[_0xb3cf('0x82')]);_0x132150[_0xb3cf('0x41')](_0x59f38e(_0xc15e93[_0xb3cf('0x82')][_0xb3cf('0x69')]));}_0x4c2ffe=_0x132150[_0xb3cf('0x84')]();_0x132150[_0xb3cf('0x21')](_0x566af2);_0x132150[_0xb3cf('0x20')](0x0);logger['debug']('Limited\x20Query:',_0x132150['toString']());return db[_0xb3cf('0x85')]['query'](_0x132150[_0xb3cf('0x86')](),{'type':db[_0xb3cf('0x85')][_0xb3cf('0x87')][_0xb3cf('0x88')]});}})['then'](respondWithResult(_0x196923,null))[_0xb3cf('0x47')](handleError(_0x196923,null));};function runReport(_0xf5d8fc,_0x130c03,_0x565605){var _0x536fa2=_0x130c03[_0xb3cf('0x2e')];var _0x2a0660=0xa;var _0x5a5af2=[_0xb3cf('0x55'),'left_join','right_join','cross_join'];var _0x929cc6={'SUM':_0xb3cf('0x59'),'COUNT':_0xb3cf('0x89'),'COUNT DISTINCT':_0xb3cf('0x5a'),'MAX':_0xb3cf('0x5b'),'MIN':_0xb3cf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb3cf('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb3cf('0x5e')};var _0x230c79={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb3cf('0x60'),'HOUR':_0xb3cf('0x61'),'ROUND':_0xb3cf('0x62'),'UNIX_TIMESTAMP':_0xb3cf('0x63')};var _0x4cbbe3=function(_0x103df4){return!_[_0xb3cf('0x64')]([_0xb3cf('0x8b'),'IS\x20NOT\x20NULL',_0xb3cf('0x65'),_0xb3cf('0x66')],_0x103df4);};var _0x31ac46=function(_0x496f19){if(!_0x496f19||!_0x496f19['rules'][_0xb3cf('0x3c')]){return'';}for(var _0x50e864='(',_0x3168cf=0x0;_0x3168cf<_0x496f19[_0xb3cf('0x67')][_0xb3cf('0x3c')];_0x3168cf+=0x1){_0x3168cf>0x0&&(_0x50e864+='\x20'+_0x496f19[_0xb3cf('0x68')]+'\x20');_0x50e864+=_0x496f19[_0xb3cf('0x67')][_0x3168cf]['group']?_0x31ac46(_0x496f19[_0xb3cf('0x67')][_0x3168cf]['group']):_0x496f19['rules'][_0x3168cf][_0xb3cf('0x6a')]+'\x20'+_0x496f19[_0xb3cf('0x67')][_0x3168cf][_0xb3cf('0x6b')]+(_0x4cbbe3(_0x496f19[_0xb3cf('0x67')][_0x3168cf][_0xb3cf('0x6b')])?'\x20'+_0x496f19['rules'][_0x3168cf][_0xb3cf('0x6c')]:'');}return _0x50e864+')';};var _0x13763f={'where':{'id':_0xf5d8fc['id']}},_0x27bc10,_0x31939c,_0x3d8a50,_0x2db9ef,_0x4c8ac9;_0x13763f=_[_0xb3cf('0x40')]({},_0x13763f,_0x565605);return db[_0xb3cf('0x31')][_0xb3cf('0x4b')](_0x13763f)[_0xb3cf('0x26')](function(_0x46227f){if(_0x46227f){_0x27bc10=_0x46227f;return _0x46227f[_0xb3cf('0x6d')]();}return null;})[_0xb3cf('0x26')](function(_0x3bd1f0){if(_0x3bd1f0){if(!_0x3bd1f0[_0xb3cf('0x3c')]){throw new db['Sequelize'][(_0xb3cf('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x31939c=_0x3bd1f0;return db[_0xb3cf('0x70')][_0xb3cf('0x45')]({'raw':!![]});}return null;})[_0xb3cf('0x26')](function(_0x518e33){if(_0x518e33){_0x3d8a50=_[_0xb3cf('0x71')](_0x518e33,'id');var _0x266d6e;var _0x182081=squel[_0xb3cf('0x72')]();_0x182081['from'](_0x27bc10[_0xb3cf('0x81')]);for(var _0x2bc2a3=0x0;_0x2bc2a3<_0x31939c['length'];_0x2bc2a3+=0x1){_0x266d6e=_0x31939c[_0x2bc2a3][_0xb3cf('0x74')]?_0x3d8a50[_0x31939c[_0x2bc2a3][_0xb3cf('0x74')]][_0xb3cf('0x75')]:_0x31939c[_0x2bc2a3][_0xb3cf('0x6a')];_0x266d6e=_0x31939c[_0x2bc2a3]['function']?_[_0xb3cf('0x77')](_0x929cc6[_0x31939c[_0x2bc2a3][_0xb3cf('0x76')]],'%s',_0x266d6e):_0x266d6e;_0x266d6e=_0x31939c[_0x2bc2a3][_0xb3cf('0x78')]?_[_0xb3cf('0x77')](_0x230c79[_0x31939c[_0x2bc2a3]['format']],'%s',_0x266d6e):_0x266d6e;if(_0x31939c[_0x2bc2a3]['groupBy']){_0x182081[_0xb3cf('0x69')](_0x266d6e);}_0x31939c[_0x2bc2a3][_0xb3cf('0x7a')]&&_0x182081['order'](_0x266d6e,_0x31939c[_0x2bc2a3][_0xb3cf('0x7a')]==='DESC'?![]:!![]);_0x182081['field'](_0x266d6e,_0x31939c[_0x2bc2a3][_0xb3cf('0x7b')]||_0x266d6e);}if(_0x27bc10[_0xb3cf('0x7c')]){_0x27bc10[_0xb3cf('0x7c')]=JSON[_0xb3cf('0x83')](_0x27bc10['joins']);for(var _0x2034a5=0x0;_0x2034a5<_0x27bc10[_0xb3cf('0x7c')][_0xb3cf('0x3c')];_0x2034a5+=0x1){if(_0x27bc10['joins'][_0x2034a5]['type']&&_[_0xb3cf('0x64')](_0x5a5af2,_0x27bc10[_0xb3cf('0x7c')][_0x2034a5]['type'])&&_0x27bc10[_0xb3cf('0x7c')][_0x2034a5][_0xb3cf('0x7d')]&&_0x27bc10[_0xb3cf('0x7c')][_0x2034a5]['foreignTable']&&_0x27bc10['joins'][_0x2034a5][_0xb3cf('0x7f')]){_0x182081[_0x27bc10[_0xb3cf('0x7c')][_0x2034a5]['type']](_0x27bc10[_0xb3cf('0x7c')][_0x2034a5][_0xb3cf('0x7e')],null,util[_0xb3cf('0x78')](_0xb3cf('0x80'),_0x27bc10[_0xb3cf('0x81')],_0x27bc10[_0xb3cf('0x7c')][_0x2034a5][_0xb3cf('0x7d')],_0x27bc10[_0xb3cf('0x7c')][_0x2034a5][_0xb3cf('0x7e')],_0x27bc10['joins'][_0x2034a5]['foreignKey']));}}}if(_0x27bc10['conditions']){_0x27bc10['conditions']=JSON[_0xb3cf('0x83')](_0x27bc10['conditions']);_0x182081['where'](_0x31ac46(_0x27bc10[_0xb3cf('0x82')][_0xb3cf('0x69')]));}_0x4c8ac9=_0x182081[_0xb3cf('0x84')]();_0x182081[_0xb3cf('0x21')](_0x2a0660);_0x182081[_0xb3cf('0x20')](0x0);logger[_0xb3cf('0x8c')](_0xb3cf('0x8d'),_0x182081[_0xb3cf('0x86')]());return db['sequelize'][_0xb3cf('0x35')](_0x182081['toString'](),{'type':db[_0xb3cf('0x85')][_0xb3cf('0x87')]['SELECT']});}})['then'](function(_0x27842d){if(!_0x27842d['length']){throw new db[(_0xb3cf('0x6e'))][(_0xb3cf('0x6f'))](_0xb3cf('0x8e'),0xcc);}if(_0x130c03[_0xb3cf('0x8f')]==='web'){return null;}var _0x5ce3fd=_[_0xb3cf('0x40')](_0x130c03,{'name':_0x130c03[_0xb3cf('0x90')]||_0x130c03[_0xb3cf('0x2e')]||_0x27bc10[_0xb3cf('0x2e')],'basename':_0x536fa2,'savename':util[_0xb3cf('0x78')](_0xb3cf('0x91'),_0x130c03[_0xb3cf('0x2e')]||_0x27bc10[_0xb3cf('0x2e')],require(_0xb3cf('0x92'))[_0xb3cf('0x93')](0x4),_0x130c03[_0xb3cf('0x8f')]||_0xb3cf('0x94')),'reportId':_0x27bc10['id'],'reportType':_0xb3cf('0x95')});return db['AnalyticExtractedReport'][_0xb3cf('0x4c')](_0x5ce3fd,{'raw':!![]});})[_0xb3cf('0x26')](function(_0x13ebb4){if(_0x27bc10[_0xb3cf('0x81')]===_0xb3cf('0x96')){_0x4c8ac9[_0xb3cf('0x41')](_0x27bc10[_0xb3cf('0x81')]+_0xb3cf('0x97'),_0x130c03['startDate'],_0x130c03[_0xb3cf('0x98')]);}else{_0x4c8ac9[_0xb3cf('0x41')](_0x27bc10['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x130c03['startDate'],_0x130c03[_0xb3cf('0x98')]);}if(_0x13ebb4){logger[_0xb3cf('0x99')](_0xb3cf('0x9a'),_0x4c8ac9['toString']());require(_0xb3cf('0x9b'))[_0xb3cf('0x9c')](path[_0xb3cf('0x55')](__dirname,_0xb3cf('0x9d'),_0x13ebb4[_0xb3cf('0x8f')]),[_0x13ebb4['id'],_0x4c8ac9[_0xb3cf('0x86')](),path[_0xb3cf('0x55')](__dirname,_0xb3cf('0x9e'),_0x13ebb4[_0xb3cf('0x9f')]),_0x536fa2]);return _0x13ebb4;}else{var _0x1e501b=squel[_0xb3cf('0x72')]();_0x1e501b[_0xb3cf('0x73')]('('+_0x4c8ac9[_0xb3cf('0x86')]()+')',_0xb3cf('0xa0'));_0x1e501b['field'](_0xb3cf('0xa1'),_0xb3cf('0x1f'));_0x4c8ac9[_0xb3cf('0x21')](_0x130c03[_0xb3cf('0x21')]||_0x2a0660);_0x4c8ac9[_0xb3cf('0x20')](_0x130c03['offset']||0x0);return dbH[_0xb3cf('0x85')][_0xb3cf('0x35')](_0x1e501b[_0xb3cf('0x86')](),{'type':dbH[_0xb3cf('0x85')][_0xb3cf('0x87')]['SELECT']})[_0xb3cf('0x26')](function(_0x43727b){if(!_0x43727b[_0xb3cf('0x3c')]){_0x2db9ef=0x0;}else{_0x2db9ef=_0x43727b[0x0][_0xb3cf('0x1f')]||0x0;}return dbH['sequelize']['query'](_0x4c8ac9[_0xb3cf('0x86')](),{'type':dbH[_0xb3cf('0x85')]['QueryTypes'][_0xb3cf('0x88')]});})[_0xb3cf('0x26')](function(_0x435a09){return{'rows':_0x435a09||[],'count':_0x2db9ef};});}});}exports['run']=function(_0x14d769,_0x29a8de){return runReport(_0x14d769[_0xb3cf('0x48')],_0x14d769['query'],_0x14d769[_0xb3cf('0x43')])[_0xb3cf('0x26')](respondWithResult(_0x29a8de,null))[_0xb3cf('0x47')](handleError(_0x29a8de,null));};exports[_0xb3cf('0xa2')]=runReport;exports[_0xb3cf('0x35')]=function(_0x2d528f,_0x89d6e2){var _0x2fef29=0xa;var _0x92a7ab=[_0xb3cf('0x55'),_0xb3cf('0x56'),_0xb3cf('0x57'),_0xb3cf('0x58')];var _0x453073={'SUM':_0xb3cf('0x59'),'COUNT':_0xb3cf('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb3cf('0x5b'),'MIN':_0xb3cf('0x8a'),'AVG':_0xb3cf('0xa3'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb3cf('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5a4bc6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb3cf('0x60'),'HOUR':_0xb3cf('0x61'),'ROUND':_0xb3cf('0x62'),'UNIX_TIMESTAMP':_0xb3cf('0x63')};var _0x5e1670=function(_0x1900ec){return!_[_0xb3cf('0x64')]([_0xb3cf('0x8b'),'IS\x20NOT\x20NULL',_0xb3cf('0x65'),_0xb3cf('0x66')],_0x1900ec);};var _0x5ef7d6=function(_0x144fd3){if(!_0x144fd3||!_0x144fd3[_0xb3cf('0x67')][_0xb3cf('0x3c')]){return'';}for(var _0x34353d='(',_0x2d452c=0x0;_0x2d452c<_0x144fd3[_0xb3cf('0x67')][_0xb3cf('0x3c')];_0x2d452c+=0x1){_0x2d452c>0x0&&(_0x34353d+='\x20'+_0x144fd3['operator']+'\x20');_0x34353d+=_0x144fd3['rules'][_0x2d452c][_0xb3cf('0x69')]?_0x5ef7d6(_0x144fd3['rules'][_0x2d452c][_0xb3cf('0x69')]):_0x144fd3[_0xb3cf('0x67')][_0x2d452c]['field']+'\x20'+_0x144fd3[_0xb3cf('0x67')][_0x2d452c]['condition']+(_0x5e1670(_0x144fd3[_0xb3cf('0x67')][_0x2d452c][_0xb3cf('0x6b')])?'\x20'+_0x144fd3['rules'][_0x2d452c][_0xb3cf('0x6c')]:'');}return _0x34353d+')';};var _0xadfdc2={'where':{'id':_0x2d528f[_0xb3cf('0x48')]['id']}},_0x37e11b,_0x2a2093,_0x28e295,_0x1be85c,_0x184f6b;_0xadfdc2=_[_0xb3cf('0x40')]({},_0xadfdc2,_0x2d528f['options']);return db['AnalyticCustomReport'][_0xb3cf('0x4b')](_0xadfdc2)[_0xb3cf('0x26')](function(_0x4a4158){if(_0x4a4158){_0x37e11b=_0x4a4158;return _0x4a4158[_0xb3cf('0x6d')]();}return null;})[_0xb3cf('0x26')](function(_0x5f1721){if(_0x5f1721){if(!_0x5f1721[_0xb3cf('0x3c')]){throw new db[(_0xb3cf('0x6e'))][(_0xb3cf('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2a2093=_0x5f1721;return db[_0xb3cf('0x70')][_0xb3cf('0x45')]({'raw':!![]});}return null;})['then'](function(_0x51bd97){if(_0x51bd97){_0x28e295=_[_0xb3cf('0x71')](_0x51bd97,'id');var _0x3a3d2e;var _0x28355e=squel[_0xb3cf('0x72')]();_0x28355e[_0xb3cf('0x73')](_0x37e11b[_0xb3cf('0x81')]);for(var _0x5bd899=0x0;_0x5bd899<_0x2a2093[_0xb3cf('0x3c')];_0x5bd899+=0x1){_0x3a3d2e=_0x2a2093[_0x5bd899][_0xb3cf('0x74')]?_0x28e295[_0x2a2093[_0x5bd899][_0xb3cf('0x74')]][_0xb3cf('0x75')]:_0x2a2093[_0x5bd899]['field'];_0x3a3d2e=_0x2a2093[_0x5bd899][_0xb3cf('0x76')]?_[_0xb3cf('0x77')](_0x453073[_0x2a2093[_0x5bd899]['function']],'%s',_0x3a3d2e):_0x3a3d2e;_0x3a3d2e=_0x2a2093[_0x5bd899][_0xb3cf('0x78')]?_[_0xb3cf('0x77')](_0x5a4bc6[_0x2a2093[_0x5bd899][_0xb3cf('0x78')]],'%s',_0x3a3d2e):_0x3a3d2e;if(_0x2a2093[_0x5bd899][_0xb3cf('0x79')]){_0x28355e['group'](_0x3a3d2e);}_0x2a2093[_0x5bd899][_0xb3cf('0x7a')]&&_0x28355e[_0xb3cf('0x3e')](_0x3a3d2e,_0x2a2093[_0x5bd899][_0xb3cf('0x7a')]===_0xb3cf('0xa4')?![]:!![]);_0x28355e[_0xb3cf('0x6a')](_0x3a3d2e,_0x2a2093[_0x5bd899][_0xb3cf('0x7b')]||_0x3a3d2e);}if(_0x37e11b[_0xb3cf('0x7c')]){_0x37e11b['joins']=JSON[_0xb3cf('0x83')](_0x37e11b[_0xb3cf('0x7c')]);for(var _0x5fb826=0x0;_0x5fb826<_0x37e11b[_0xb3cf('0x7c')][_0xb3cf('0x3c')];_0x5fb826+=0x1){if(_0x37e11b['joins'][_0x5fb826][_0xb3cf('0x32')]&&_[_0xb3cf('0x64')](_0x92a7ab,_0x37e11b[_0xb3cf('0x7c')][_0x5fb826][_0xb3cf('0x32')])&&_0x37e11b[_0xb3cf('0x7c')][_0x5fb826][_0xb3cf('0x7d')]&&_0x37e11b[_0xb3cf('0x7c')][_0x5fb826][_0xb3cf('0x7e')]&&_0x37e11b['joins'][_0x5fb826][_0xb3cf('0x7f')]){_0x28355e[_0x37e11b[_0xb3cf('0x7c')][_0x5fb826][_0xb3cf('0x32')]](_0x37e11b[_0xb3cf('0x7c')][_0x5fb826][_0xb3cf('0x7e')],null,util[_0xb3cf('0x78')]('%s.%s\x20=\x20%s.%s',_0x37e11b[_0xb3cf('0x81')],_0x37e11b[_0xb3cf('0x7c')][_0x5fb826][_0xb3cf('0x7d')],_0x37e11b['joins'][_0x5fb826]['foreignTable'],_0x37e11b[_0xb3cf('0x7c')][_0x5fb826][_0xb3cf('0x7f')]));}}}if(_0x37e11b[_0xb3cf('0x82')]){_0x37e11b['conditions']=JSON[_0xb3cf('0x83')](_0x37e11b[_0xb3cf('0x82')]);_0x28355e[_0xb3cf('0x41')](_0x5ef7d6(_0x37e11b[_0xb3cf('0x82')]['group']));}_0x184f6b=_0x28355e['clone']();_0x28355e[_0xb3cf('0x21')](_0x2fef29);_0x28355e['offset'](0x0);logger[_0xb3cf('0x8c')](_0xb3cf('0x8d'),_0x28355e[_0xb3cf('0x86')]());return db[_0xb3cf('0x85')][_0xb3cf('0x35')](_0x28355e[_0xb3cf('0x86')](),{'type':db[_0xb3cf('0x85')][_0xb3cf('0x87')][_0xb3cf('0x88')]});}})['then'](function(){return{'sql':_0x184f6b['toString']()};})[_0xb3cf('0x26')](respondWithResult(_0x89d6e2,null))['catch'](handleError(_0x89d6e2,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2721218..5f5d97d 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 _0x3783=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api'];(function(_0x4b4d8b,_0x2102fc){var _0xf6be90=function(_0x463e06){while(--_0x463e06){_0x4b4d8b['push'](_0x4b4d8b['shift']());}};_0xf6be90(++_0x2102fc);}(_0x3783,0x1dd));var _0x3378=function(_0x1c87b5,_0x31141a){_0x1c87b5=_0x1c87b5-0x0;var _0x3ba34b=_0x3783[_0x1c87b5];return _0x3ba34b;};'use strict';var _=require('lodash');var util=require(_0x3378('0x0'));var logger=require(_0x3378('0x1'))(_0x3378('0x2'));var moment=require(_0x3378('0x3'));var BPromise=require(_0x3378('0x4'));var rp=require(_0x3378('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3378('0x6'));var config=require(_0x3378('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x3378('0x8')]=function(_0x23958d,_0x82f9fd){return _0x23958d[_0x3378('0x9')](_0x3378('0xa'),attributes,{'tableName':_0x3378('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae93=['AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x49c3f8,_0x1b8109){var _0x4295c0=function(_0x158e2b){while(--_0x158e2b){_0x49c3f8['push'](_0x49c3f8['shift']());}};_0x4295c0(++_0x1b8109);}(_0xae93,0x188));var _0x3ae9=function(_0x4120ba,_0x2292eb){_0x4120ba=_0x4120ba-0x0;var _0x4da878=_0xae93[_0x4120ba];return _0x4da878;};'use strict';var _=require(_0x3ae9('0x0'));var util=require(_0x3ae9('0x1'));var logger=require(_0x3ae9('0x2'))(_0x3ae9('0x3'));var moment=require(_0x3ae9('0x4'));var BPromise=require(_0x3ae9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3ae9('0x6'));var config=require(_0x3ae9('0x7'));var attributes=require(_0x3ae9('0x8'));module[_0x3ae9('0x9')]=function(_0x14b7e2,_0x33a57d){return _0x14b7e2[_0x3ae9('0xa')](_0x3ae9('0xb'),attributes,{'tableName':_0x3ae9('0xc'),'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 ab11991..ffda69f 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 _0x1909=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x3ff1ec,_0x5229ed){var _0x4eedef=function(_0x1420cc){while(--_0x1420cc){_0x3ff1ec['push'](_0x3ff1ec['shift']());}};_0x4eedef(++_0x5229ed);}(_0x1909,0xf5));var _0x9190=function(_0x5221f5,_0x1a281e){_0x5221f5=_0x5221f5-0x0;var _0x2baa2f=_0x1909[_0x5221f5];return _0x2baa2f;};'use strict';var _=require(_0x9190('0x0'));var util=require(_0x9190('0x1'));var moment=require(_0x9190('0x2'));var BPromise=require(_0x9190('0x3'));var rs=require(_0x9190('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9190('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9190('0x6'));var config=require(_0x9190('0x7'));var jayson=require(_0x9190('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ecced,_0x200e9b,_0x2b6cb0){return new BPromise(function(_0x474837,_0x3645b1){return client[_0x9190('0x9')](_0x1ecced,_0x2b6cb0)['then'](function(_0x44e1d3){logger[_0x9190('0xa')](_0x9190('0xb'),_0x200e9b,_0x9190('0xc'));logger[_0x9190('0xd')](_0x9190('0xe'),_0x200e9b,_0x9190('0xc'),JSON[_0x9190('0xf')](_0x44e1d3));if(_0x44e1d3[_0x9190('0x10')]){if(_0x44e1d3[_0x9190('0x10')][_0x9190('0x11')]===0x1f4){logger[_0x9190('0x10')](_0x9190('0xb'),_0x200e9b,_0x44e1d3['error'][_0x9190('0x12')]);return _0x3645b1(_0x44e1d3['error'][_0x9190('0x12')]);}logger[_0x9190('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x200e9b,_0x44e1d3[_0x9190('0x10')][_0x9190('0x12')]);return _0x474837(_0x44e1d3[_0x9190('0x10')][_0x9190('0x12')]);}else{logger[_0x9190('0xa')](_0x9190('0xb'),_0x200e9b,_0x9190('0xc'));_0x474837(_0x44e1d3['result'][_0x9190('0x12')]);}})[_0x9190('0x13')](function(_0x111dae){logger[_0x9190('0x10')](_0x9190('0xb'),_0x200e9b,_0x111dae);_0x3645b1(_0x111dae);});});} \ No newline at end of file +var _0x688f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x688f,0x181));var _0xf688=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x688f[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xf688('0x0'));var util=require(_0xf688('0x1'));var moment=require('moment');var BPromise=require(_0xf688('0x2'));var rs=require(_0xf688('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf688('0x4'));var logger=require(_0xf688('0x5'))(_0xf688('0x6'));var config=require(_0xf688('0x7'));var jayson=require(_0xf688('0x8'));var client=jayson[_0xf688('0x9')][_0xf688('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b9ff1,_0x253d57,_0x23468a){return new BPromise(function(_0xf03a23,_0x347026){return client[_0xf688('0xb')](_0x4b9ff1,_0x23468a)[_0xf688('0xc')](function(_0x484ec9){logger[_0xf688('0xd')](_0xf688('0xe'),_0x253d57,_0xf688('0xf'));logger[_0xf688('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x253d57,'request\x20sent',JSON[_0xf688('0x11')](_0x484ec9));if(_0x484ec9[_0xf688('0x12')]){if(_0x484ec9[_0xf688('0x12')][_0xf688('0x13')]===0x1f4){logger[_0xf688('0x12')](_0xf688('0xe'),_0x253d57,_0x484ec9[_0xf688('0x12')]['message']);return _0x347026(_0x484ec9[_0xf688('0x12')]['message']);}logger[_0xf688('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x253d57,_0x484ec9[_0xf688('0x12')][_0xf688('0x14')]);return _0xf03a23(_0x484ec9[_0xf688('0x12')]['message']);}else{logger[_0xf688('0xd')](_0xf688('0xe'),_0x253d57,_0xf688('0xf'));_0xf03a23(_0x484ec9[_0xf688('0x15')][_0xf688('0x14')]);}})[_0xf688('0x16')](function(_0x2516bd){logger[_0xf688('0x12')](_0xf688('0xe'),_0x253d57,_0x2516bd);_0x347026(_0x2516bd);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2843672..8ef6788 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 _0x8e18=['../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','run','query','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2a034e,_0x5910b4){var _0xecd31f=function(_0xa75337){while(--_0xa75337){_0x2a034e['push'](_0x2a034e['shift']());}};_0xecd31f(++_0x5910b4);}(_0x8e18,0x1dc));var _0x88e1=function(_0x4e25da,_0x260c98){_0x4e25da=_0x4e25da-0x0;var _0x3cb838=_0x8e18[_0x4e25da];return _0x3cb838;};'use strict';var multer=require(_0x88e1('0x0'));var util=require(_0x88e1('0x1'));var path=require(_0x88e1('0x2'));var timeout=require(_0x88e1('0x3'));var express=require(_0x88e1('0x4'));var router=express[_0x88e1('0x5')]();var auth=require(_0x88e1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x88e1('0x7'));var controller=require(_0x88e1('0x8'));router['get']('/',auth[_0x88e1('0x9')](),controller[_0x88e1('0xa')]);router[_0x88e1('0xb')](_0x88e1('0xc'),auth[_0x88e1('0x9')](),controller[_0x88e1('0xd')]);router[_0x88e1('0xb')](_0x88e1('0xe'),auth[_0x88e1('0x9')](),controller['preview']);router[_0x88e1('0xb')]('/:id/run',auth[_0x88e1('0x9')](),controller[_0x88e1('0xf')]);router[_0x88e1('0xb')]('/:id/query',auth[_0x88e1('0x9')](),controller[_0x88e1('0x10')]);router['post']('/',auth[_0x88e1('0x9')](),controller['create']);router[_0x88e1('0x11')](_0x88e1('0xc'),auth[_0x88e1('0x9')](),controller[_0x88e1('0x12')]);router[_0x88e1('0x13')](_0x88e1('0xc'),auth[_0x88e1('0x9')](),controller[_0x88e1('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbf3e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','exports','multer','util','path'];(function(_0x3f9f0f,_0x531b30){var _0x2eb31d=function(_0x43feb1){while(--_0x43feb1){_0x3f9f0f['push'](_0x3f9f0f['shift']());}};_0x2eb31d(++_0x531b30);}(_0xbf3e,0x1bf));var _0xebf3=function(_0x1bddad,_0x4fcb8b){_0x1bddad=_0x1bddad-0x0;var _0xbaf22c=_0xbf3e[_0x1bddad];return _0xbaf22c;};'use strict';var multer=require(_0xebf3('0x0'));var util=require(_0xebf3('0x1'));var path=require(_0xebf3('0x2'));var timeout=require(_0xebf3('0x3'));var express=require(_0xebf3('0x4'));var router=express[_0xebf3('0x5')]();var auth=require(_0xebf3('0x6'));var interaction=require(_0xebf3('0x7'));var config=require('../../config/environment');var controller=require(_0xebf3('0x8'));router[_0xebf3('0x9')]('/',auth[_0xebf3('0xa')](),controller[_0xebf3('0xb')]);router[_0xebf3('0x9')](_0xebf3('0xc'),auth[_0xebf3('0xa')](),controller[_0xebf3('0xd')]);router[_0xebf3('0x9')](_0xebf3('0xe'),auth[_0xebf3('0xa')](),controller[_0xebf3('0xf')]);router[_0xebf3('0x9')](_0xebf3('0x10'),auth['isAuthenticated'](),controller[_0xebf3('0x11')]);router['get'](_0xebf3('0x12'),auth[_0xebf3('0xa')](),controller[_0xebf3('0x13')]);router[_0xebf3('0x14')]('/',auth['isAuthenticated'](),controller[_0xebf3('0x15')]);router[_0xebf3('0x16')](_0xebf3('0xc'),auth[_0xebf3('0xa')](),controller[_0xebf3('0x17')]);router['delete'](_0xebf3('0xc'),auth[_0xebf3('0xa')](),controller['destroy']);module[_0xebf3('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 508f058..38e1d8c 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 _0xe7e8=['sequelize','exports','STRING','TEXT'];(function(_0x9bccbd,_0x457a3f){var _0x112bc3=function(_0x40ffbe){while(--_0x40ffbe){_0x9bccbd['push'](_0x9bccbd['shift']());}};_0x112bc3(++_0x457a3f);}(_0xe7e8,0x114));var _0x8e7e=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xe7e8[_0x39106e];return _0x892aec;};'use strict';var Sequelize=require(_0x8e7e('0x0'));module[_0x8e7e('0x1')]={'name':{'type':Sequelize[_0x8e7e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8e7e('0x2')]},'parent':{'type':Sequelize[_0x8e7e('0x2')]},'table':{'type':Sequelize[_0x8e7e('0x2')]},'conditions':{'type':Sequelize[_0x8e7e('0x3')]},'joins':{'type':Sequelize[_0x8e7e('0x3')]}}; \ No newline at end of file +var _0x89ff=['TEXT','exports','STRING'];(function(_0x26489a,_0x10290d){var _0x2c789c=function(_0xd0d405){while(--_0xd0d405){_0x26489a['push'](_0x26489a['shift']());}};_0x2c789c(++_0x10290d);}(_0x89ff,0xd9));var _0xf89f=function(_0x3d0d71,_0x3c4811){_0x3d0d71=_0x3d0d71-0x0;var _0xc3c53f=_0x89ff[_0x3d0d71];return _0xc3c53f;};'use strict';var Sequelize=require('sequelize');module[_0xf89f('0x0')]={'name':{'type':Sequelize[_0xf89f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf89f('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xf89f('0x1')]},'conditions':{'type':Sequelize[_0xf89f('0x2')]},'joins':{'type':Sequelize[_0xf89f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5e96cec..237a492 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 _0xe532=['name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','DefaultReports','error','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','AnalyticMetric','keyBy','select','MetricId','metric','function','format','replace','orderBy','order','DESC','alias','joins','parse','parentKey','%s.%s\x20=\x20%s.%s','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','AVG(%s)','GROUP_CONCAT(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','from','groupBy','table','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','fork','../../components/export/','countTable','COUNT(*)','runReport','COUNT(%s)','debug','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','then','destroy','get','UserProfileResource','stack','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key'];(function(_0x4d4812,_0x5c4e9c){var _0x472210=function(_0x309b02){while(--_0x309b02){_0x4d4812['push'](_0x4d4812['shift']());}};_0x472210(++_0x5c4e9c);}(_0xe532,0x6e));var _0x2e53=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xe532[_0x54edc9];return _0x2ae7a9;};'use strict';var pdf=require(_0x2e53('0x0'));var emlformat=require(_0x2e53('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2e53('0x2'));var jsonpatch=require(_0x2e53('0x3'));var rp=require(_0x2e53('0x4'));var moment=require(_0x2e53('0x5'));var BPromise=require(_0x2e53('0x6'));var Mustache=require('mustache');var util=require(_0x2e53('0x7'));var path=require('path');var sox=require(_0x2e53('0x8'));var csv=require(_0x2e53('0x9'));var ejs=require(_0x2e53('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2e53('0xb'));var crypto=require('crypto');var jsforce=require(_0x2e53('0xc'));var deskjs=require(_0x2e53('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2e53('0xe'));var Papa=require(_0x2e53('0xf'));var Redis=require(_0x2e53('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e53('0x11'));var hardwareService=require(_0x2e53('0x12'));var logger=require(_0x2e53('0x13'))(_0x2e53('0x14'));var utils=require(_0x2e53('0x15'));var config=require(_0x2e53('0x16'));var db=require(_0x2e53('0x17'))['db'];var dbH=require(_0x2e53('0x17'))[_0x2e53('0x18')];function respondWithStatusCode(_0x1b2689,_0x279ac7){_0x279ac7=_0x279ac7||0xcc;return function(_0x27acfe){if(_0x27acfe){return _0x1b2689[_0x2e53('0x19')](_0x279ac7);}return _0x1b2689['status'](_0x279ac7)[_0x2e53('0x1a')]();};}function respondWithResult(_0xf0ae81,_0x28516f){_0x28516f=_0x28516f||0xc8;return function(_0x302ddc){if(_0x302ddc){return _0xf0ae81[_0x2e53('0x1b')](_0x28516f)[_0x2e53('0x1c')](_0x302ddc);}};}function respondWithFilteredResult(_0x24ec11,_0x1140ae){return function(_0x104b6c){if(_0x104b6c){var _0x1d13a3=_0x104b6c[_0x2e53('0x1d')],_0x3702a7=_0x1140ae[_0x2e53('0x1e')],_0x548800=_0x1140ae[_0x2e53('0x1e')]+_0x1140ae[_0x2e53('0x1f')],_0x16bf65;if(_0x548800>=_0x1d13a3){_0x548800=_0x1d13a3;_0x16bf65=0xc8;}else{_0x16bf65=0xce;}_0x24ec11[_0x2e53('0x1b')](_0x16bf65);return _0x24ec11[_0x2e53('0x20')]('Content-Range',_0x3702a7+'-'+_0x548800+'/'+_0x1d13a3)[_0x2e53('0x1c')](_0x104b6c);}return null;};}function patchUpdates(_0x2b382c){return function(_0x1e4c80){try{jsonpatch[_0x2e53('0x21')](_0x1e4c80,_0x2b382c,!![]);}catch(_0xdd3a40){return BPromise[_0x2e53('0x22')](_0xdd3a40);}return _0x1e4c80['save']();};}function saveUpdates(_0x4123e5,_0x32ac95){return function(_0x4958bf){if(_0x4958bf){return _0x4958bf[_0x2e53('0x23')](_0x4123e5)[_0x2e53('0x24')](function(_0x49b5c6){return _0x49b5c6;});}return null;};}function removeEntity(_0x18bbc6,_0x287cc4){return function(_0x4a4dcd){if(_0x4a4dcd){return _0x4a4dcd[_0x2e53('0x25')]()['then'](function(){var _0x279bcc=_0x4a4dcd[_0x2e53('0x26')]({'plain':!![]});var _0x3bbffe='DefaultReports';return db[_0x2e53('0x27')][_0x2e53('0x25')]({'where':{'type':_0x3bbffe,'resourceId':_0x279bcc['id']}})[_0x2e53('0x24')](function(){return _0x4a4dcd;});})[_0x2e53('0x24')](function(){_0x18bbc6[_0x2e53('0x1b')](0xcc)[_0x2e53('0x1a')]();});}};}function handleEntityNotFound(_0x1e8084,_0x315483){return function(_0x311c86){if(!_0x311c86){_0x1e8084[_0x2e53('0x19')](0x194);}return _0x311c86;};}function handleError(_0x4e39a8,_0x3ac808){_0x3ac808=_0x3ac808||0x1f4;return function(_0x47e372){logger['error'](_0x47e372[_0x2e53('0x28')]);if(_0x47e372['name']){delete _0x47e372['name'];}_0x4e39a8[_0x2e53('0x1b')](_0x3ac808)['send'](_0x47e372);};}exports[_0x2e53('0x29')]=function(_0x3b882a,_0x47dad6){var _0x39f1f1={},_0x404335={},_0x5623ba={'count':0x0,'rows':[]};var _0x37f2fb=_[_0x2e53('0x2a')](db[_0x2e53('0x2b')][_0x2e53('0x2c')],function(_0x2ff8c9){return{'name':_0x2ff8c9[_0x2e53('0x2d')],'type':_0x2ff8c9[_0x2e53('0x2e')][_0x2e53('0x2f')]};});_0x404335['model']=_['map'](_0x37f2fb,_0x2e53('0x30'));_0x404335[_0x2e53('0x31')]=_[_0x2e53('0x32')](_0x3b882a[_0x2e53('0x31')]);_0x404335[_0x2e53('0x33')]=_[_0x2e53('0x34')](_0x404335[_0x2e53('0x35')],_0x404335['query']);_0x39f1f1[_0x2e53('0x36')]=_[_0x2e53('0x34')](_0x404335[_0x2e53('0x35')],qs[_0x2e53('0x37')](_0x3b882a[_0x2e53('0x31')][_0x2e53('0x37')]));_0x39f1f1[_0x2e53('0x36')]=_0x39f1f1['attributes'][_0x2e53('0x38')]?_0x39f1f1[_0x2e53('0x36')]:_0x404335['model'];if(!_0x3b882a[_0x2e53('0x31')][_0x2e53('0x39')]('nolimit')){_0x39f1f1[_0x2e53('0x1f')]=qs['limit'](_0x3b882a[_0x2e53('0x31')][_0x2e53('0x1f')]);_0x39f1f1[_0x2e53('0x1e')]=qs[_0x2e53('0x1e')](_0x3b882a['query'][_0x2e53('0x1e')]);}_0x39f1f1['order']=qs[_0x2e53('0x3a')](_0x3b882a['query']['sort']);_0x39f1f1[_0x2e53('0x3b')]=qs['filters'](_['pick'](_0x3b882a[_0x2e53('0x31')],_0x404335[_0x2e53('0x33')]),_0x37f2fb);if(_0x3b882a['query'][_0x2e53('0x3c')]){_0x39f1f1[_0x2e53('0x3b')]=_[_0x2e53('0x3d')](_0x39f1f1[_0x2e53('0x3b')],{'$or':_['map'](_0x37f2fb,function(_0x78c5e4){if(_0x78c5e4[_0x2e53('0x2e')]!==_0x2e53('0x3e')){var _0x524b97={};_0x524b97[_0x78c5e4[_0x2e53('0x30')]]={'$like':'%'+_0x3b882a[_0x2e53('0x31')][_0x2e53('0x3c')]+'%'};return _0x524b97;}})});}_0x39f1f1=_['merge']({},_0x39f1f1,_0x3b882a[_0x2e53('0x3f')]);var _0xa43024={'where':_0x39f1f1[_0x2e53('0x3b')]};return db[_0x2e53('0x2b')]['count'](_0xa43024)[_0x2e53('0x24')](function(_0x2ac822){_0x5623ba[_0x2e53('0x1d')]=_0x2ac822;if(_0x3b882a[_0x2e53('0x31')][_0x2e53('0x40')]){_0x39f1f1['include']=[{'all':!![]}];}return db[_0x2e53('0x2b')][_0x2e53('0x41')](_0x39f1f1);})[_0x2e53('0x24')](function(_0x5d8bbe){_0x5623ba[_0x2e53('0x42')]=_0x5d8bbe;return _0x5623ba;})[_0x2e53('0x24')](respondWithFilteredResult(_0x47dad6,_0x39f1f1))[_0x2e53('0x43')](handleError(_0x47dad6,null));};exports['show']=function(_0x3f7443,_0x3fcba9){var _0x2267d4={'raw':!![],'where':{'id':_0x3f7443[_0x2e53('0x44')]['id']}},_0x306b93={};_0x306b93['model']=_[_0x2e53('0x32')](db['AnalyticDefaultReport'][_0x2e53('0x2c')]);_0x306b93[_0x2e53('0x31')]=_['keys'](_0x3f7443[_0x2e53('0x31')]);_0x306b93[_0x2e53('0x33')]=_['intersection'](_0x306b93[_0x2e53('0x35')],_0x306b93['query']);_0x2267d4['attributes']=_[_0x2e53('0x34')](_0x306b93['model'],qs[_0x2e53('0x37')](_0x3f7443[_0x2e53('0x31')][_0x2e53('0x37')]));_0x2267d4[_0x2e53('0x36')]=_0x2267d4[_0x2e53('0x36')][_0x2e53('0x38')]?_0x2267d4['attributes']:_0x306b93[_0x2e53('0x35')];if(_0x3f7443[_0x2e53('0x31')]['includeAll']){_0x2267d4['include']=[{'all':!![]}];}_0x2267d4=_['merge']({},_0x2267d4,_0x3f7443[_0x2e53('0x3f')]);return db[_0x2e53('0x2b')][_0x2e53('0x45')](_0x2267d4)[_0x2e53('0x24')](handleEntityNotFound(_0x3fcba9,null))[_0x2e53('0x24')](respondWithResult(_0x3fcba9,null))[_0x2e53('0x43')](handleError(_0x3fcba9,null));};exports[_0x2e53('0x46')]=function(_0x12c2db,_0x302f7b){return db['AnalyticDefaultReport'][_0x2e53('0x46')](_0x12c2db['body'],{})['then'](function(_0x27f3ad){var _0x2a7c71=_0x12c2db[_0x2e53('0x47')][_0x2e53('0x26')]({'plain':!![]});if(!_0x2a7c71)throw new Error(_0x2e53('0x48'));if(_0x2a7c71[_0x2e53('0x49')]===_0x2e53('0x47')){var _0x5b6bb4=_0x27f3ad[_0x2e53('0x26')]({'plain':!![]});var _0x41668c='Reports';return db['UserProfileSection'][_0x2e53('0x45')]({'where':{'name':_0x41668c,'userProfileId':_0x2a7c71[_0x2e53('0x4a')]},'raw':!![]})[_0x2e53('0x24')](function(_0x525b87){if(_0x525b87&&_0x525b87['autoAssociation']===0x0){return db[_0x2e53('0x27')][_0x2e53('0x46')]({'name':_0x5b6bb4[_0x2e53('0x30')],'resourceId':_0x5b6bb4['id'],'type':_0x2e53('0x4b'),'sectionId':_0x525b87['id']},{})[_0x2e53('0x24')](function(){return _0x27f3ad;});}else{return _0x27f3ad;}})[_0x2e53('0x43')](function(_0x569f14){logger[_0x2e53('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x569f14);throw _0x569f14;});}return _0x27f3ad;})['then'](respondWithResult(_0x302f7b,0xc9))['catch'](handleError(_0x302f7b,null));};exports[_0x2e53('0x23')]=function(_0x39938a,_0x40542b){if(_0x39938a[_0x2e53('0x4d')]['id']){delete _0x39938a[_0x2e53('0x4d')]['id'];}return db[_0x2e53('0x2b')][_0x2e53('0x45')]({'where':{'id':_0x39938a[_0x2e53('0x44')]['id']}})['then'](handleEntityNotFound(_0x40542b,null))['then'](saveUpdates(_0x39938a[_0x2e53('0x4d')],null))[_0x2e53('0x24')](respondWithResult(_0x40542b,null))[_0x2e53('0x43')](handleError(_0x40542b,null));};exports['destroy']=function(_0x535ada,_0x46e2eb){return db[_0x2e53('0x2b')][_0x2e53('0x45')]({'where':{'id':_0x535ada[_0x2e53('0x44')]['id']}})['then'](handleEntityNotFound(_0x46e2eb,null))[_0x2e53('0x24')](removeEntity(_0x46e2eb,null))['catch'](handleError(_0x46e2eb,null));};exports['preview']=function(_0x3daa02,_0x4fda77){var _0x4ad043=0xa;var _0x38a88f=[_0x2e53('0x4e'),_0x2e53('0x4f'),_0x2e53('0x50'),_0x2e53('0x51')];var _0x3fa006={'SUM':_0x2e53('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2e53('0x53'),'MAX':_0x2e53('0x54'),'MIN':_0x2e53('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2e53('0x56'),'GROUP_CONCAT DESC':_0x2e53('0x57')};var _0x545334={'SEC_TO_TIME':_0x2e53('0x58'),'DATE':_0x2e53('0x59'),'HOUR':_0x2e53('0x5a'),'ROUND':_0x2e53('0x5b'),'UNIX_TIMESTAMP':_0x2e53('0x5c')};var _0x5f121b=function(_0xb35e96){return!_[_0x2e53('0x5d')]([_0x2e53('0x5e'),'IS\x20NOT\x20NULL',_0x2e53('0x5f'),'IS\x20NOT\x20EMPTY'],_0xb35e96);};var _0x1a24ce=function(_0xcc674d){if(!_0xcc674d||!_0xcc674d[_0x2e53('0x60')]['length']){return'';}for(var _0x3b0712='(',_0x586f17=0x0;_0x586f17<_0xcc674d[_0x2e53('0x60')]['length'];_0x586f17+=0x1){_0x586f17>0x0&&(_0x3b0712+='\x20'+_0xcc674d[_0x2e53('0x61')]+'\x20');_0x3b0712+=_0xcc674d[_0x2e53('0x60')][_0x586f17][_0x2e53('0x62')]?_0x1a24ce(_0xcc674d[_0x2e53('0x60')][_0x586f17][_0x2e53('0x62')]):_0xcc674d[_0x2e53('0x60')][_0x586f17][_0x2e53('0x63')]+'\x20'+_0xcc674d[_0x2e53('0x60')][_0x586f17]['condition']+(_0x5f121b(_0xcc674d[_0x2e53('0x60')][_0x586f17][_0x2e53('0x64')])?'\x20'+_0xcc674d[_0x2e53('0x60')][_0x586f17][_0x2e53('0x65')]:'');}return _0x3b0712+')';};var _0x5382d4={'where':{'id':_0x3daa02[_0x2e53('0x44')]['id']}},_0x500525,_0x11efd5,_0x539165,_0x472802,_0x44600e;_0x5382d4=_[_0x2e53('0x3d')]({},_0x5382d4,_0x3daa02[_0x2e53('0x3f')]);return db[_0x2e53('0x2b')]['find'](_0x5382d4)[_0x2e53('0x24')](function(_0x1e4a15){if(_0x1e4a15){_0x500525=_0x1e4a15;return _0x1e4a15['getFields']();}return null;})[_0x2e53('0x24')](function(_0x21c1ea){if(_0x21c1ea){if(!_0x21c1ea['length']){throw new db['Sequelize'][(_0x2e53('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x11efd5=_0x21c1ea;return db[_0x2e53('0x67')][_0x2e53('0x41')]({'raw':!![]});}return null;})['then'](function(_0x4d7d65){if(_0x4d7d65){_0x539165=_[_0x2e53('0x68')](_0x4d7d65,'id');var _0x14b597;var _0x4bbdd2=squel[_0x2e53('0x69')]();_0x4bbdd2['from'](_0x500525['table']);for(var _0x30e8c1=0x0;_0x30e8c1<_0x11efd5['length'];_0x30e8c1+=0x1){_0x14b597=_0x11efd5[_0x30e8c1][_0x2e53('0x6a')]?_0x539165[_0x11efd5[_0x30e8c1][_0x2e53('0x6a')]][_0x2e53('0x6b')]:_0x11efd5[_0x30e8c1]['field'];_0x14b597=_0x11efd5[_0x30e8c1]['function']?_['replace'](_0x3fa006[_0x11efd5[_0x30e8c1][_0x2e53('0x6c')]],'%s',_0x14b597):_0x14b597;_0x14b597=_0x11efd5[_0x30e8c1][_0x2e53('0x6d')]?_[_0x2e53('0x6e')](_0x545334[_0x11efd5[_0x30e8c1][_0x2e53('0x6d')]],'%s',_0x14b597):_0x14b597;if(_0x11efd5[_0x30e8c1]['groupBy']){_0x4bbdd2['group'](_0x14b597);}_0x11efd5[_0x30e8c1][_0x2e53('0x6f')]&&_0x4bbdd2[_0x2e53('0x70')](_0x14b597,_0x11efd5[_0x30e8c1][_0x2e53('0x6f')]===_0x2e53('0x71')?![]:!![]);_0x4bbdd2[_0x2e53('0x63')](_0x14b597,_0x11efd5[_0x30e8c1][_0x2e53('0x72')]||_0x14b597);}if(_0x500525[_0x2e53('0x73')]){_0x500525[_0x2e53('0x73')]=JSON[_0x2e53('0x74')](_0x500525[_0x2e53('0x73')]);for(var _0x55e443=0x0;_0x55e443<_0x500525[_0x2e53('0x73')][_0x2e53('0x38')];_0x55e443+=0x1){if(_0x500525[_0x2e53('0x73')][_0x55e443]['type']&&_[_0x2e53('0x5d')](_0x38a88f,_0x500525[_0x2e53('0x73')][_0x55e443][_0x2e53('0x2e')])&&_0x500525[_0x2e53('0x73')][_0x55e443][_0x2e53('0x75')]&&_0x500525[_0x2e53('0x73')][_0x55e443]['foreignTable']&&_0x500525[_0x2e53('0x73')][_0x55e443]['foreignKey']){_0x4bbdd2[_0x500525[_0x2e53('0x73')][_0x55e443]['type']](_0x500525[_0x2e53('0x73')][_0x55e443]['foreignTable'],null,util[_0x2e53('0x6d')](_0x2e53('0x76'),_0x500525['table'],_0x500525['joins'][_0x55e443][_0x2e53('0x75')],_0x500525[_0x2e53('0x73')][_0x55e443][_0x2e53('0x77')],_0x500525[_0x2e53('0x73')][_0x55e443][_0x2e53('0x78')]));}}}if(_0x500525[_0x2e53('0x79')]){_0x500525[_0x2e53('0x79')]=JSON[_0x2e53('0x74')](_0x500525[_0x2e53('0x79')]);_0x4bbdd2[_0x2e53('0x3b')](_0x1a24ce(_0x500525[_0x2e53('0x79')][_0x2e53('0x62')]));}_0x44600e=_0x4bbdd2[_0x2e53('0x7a')]();_0x4bbdd2['limit'](_0x4ad043);_0x4bbdd2['offset'](0x0);logger['debug'](_0x2e53('0x7b'),_0x4bbdd2[_0x2e53('0x7c')]());return db[_0x2e53('0x7d')][_0x2e53('0x31')](_0x4bbdd2['toString'](),{'type':db['sequelize'][_0x2e53('0x7e')][_0x2e53('0x7f')]});}})[_0x2e53('0x24')](respondWithResult(_0x4fda77,null))['catch'](handleError(_0x4fda77,null));};function runReport(_0x2d3d9c,_0x336e94,_0x3d4481){var _0x1f6aa1=_0x336e94['name'];var _0x4b2790=0xa;var _0x3cd2f1=[_0x2e53('0x4e'),'left_join',_0x2e53('0x50'),_0x2e53('0x51')];var _0x4ddb1b={'SUM':_0x2e53('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2e53('0x53'),'MAX':_0x2e53('0x54'),'MIN':_0x2e53('0x55'),'AVG':_0x2e53('0x80'),'GROUP_CONCAT':_0x2e53('0x81'),'GROUP_CONCAT ASC':_0x2e53('0x56'),'GROUP_CONCAT DESC':_0x2e53('0x57')};var _0x1a8f0b={'SEC_TO_TIME':_0x2e53('0x58'),'DATE':_0x2e53('0x59'),'HOUR':_0x2e53('0x5a'),'ROUND':_0x2e53('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1b6578=function(_0x49876a){return!_['includes']([_0x2e53('0x5e'),_0x2e53('0x82'),_0x2e53('0x5f'),_0x2e53('0x83')],_0x49876a);};var _0x4cf834=function(_0x15ee4b){if(!_0x15ee4b||!_0x15ee4b[_0x2e53('0x60')][_0x2e53('0x38')]){return'';}for(var _0x190690='(',_0x1232a2=0x0;_0x1232a2<_0x15ee4b[_0x2e53('0x60')][_0x2e53('0x38')];_0x1232a2+=0x1){_0x1232a2>0x0&&(_0x190690+='\x20'+_0x15ee4b[_0x2e53('0x61')]+'\x20');_0x190690+=_0x15ee4b['rules'][_0x1232a2][_0x2e53('0x62')]?_0x4cf834(_0x15ee4b[_0x2e53('0x60')][_0x1232a2][_0x2e53('0x62')]):_0x15ee4b['rules'][_0x1232a2][_0x2e53('0x63')]+'\x20'+_0x15ee4b[_0x2e53('0x60')][_0x1232a2][_0x2e53('0x64')]+(_0x1b6578(_0x15ee4b[_0x2e53('0x60')][_0x1232a2][_0x2e53('0x64')])?'\x20'+_0x15ee4b[_0x2e53('0x60')][_0x1232a2][_0x2e53('0x65')]:'');}return _0x190690+')';};var _0x474c3f={'where':{'id':_0x2d3d9c['id']}},_0x2b4e86,_0x183d94,_0x171965,_0x35f676,_0x58d5f5;_0x474c3f=_[_0x2e53('0x3d')]({},_0x474c3f,_0x3d4481);return db[_0x2e53('0x2b')][_0x2e53('0x45')](_0x474c3f)[_0x2e53('0x24')](function(_0x2c4b44){if(_0x2c4b44){_0x2b4e86=_0x2c4b44;return _0x2c4b44[_0x2e53('0x84')]();}return null;})[_0x2e53('0x24')](function(_0x5c92a6){if(_0x5c92a6){if(!_0x5c92a6[_0x2e53('0x38')]){throw new db[(_0x2e53('0x85'))][(_0x2e53('0x66'))](_0x2e53('0x86'),0x193);}_0x183d94=_0x5c92a6;return db[_0x2e53('0x67')][_0x2e53('0x41')]({'raw':!![]});}return null;})[_0x2e53('0x24')](function(_0x548823){if(_0x548823){_0x171965=_['keyBy'](_0x548823,'id');var _0xaa7ea4;var _0x5f00f8=squel[_0x2e53('0x69')]();_0x5f00f8[_0x2e53('0x87')](_0x2b4e86['table']);for(var _0xba2ff1=0x0;_0xba2ff1<_0x183d94[_0x2e53('0x38')];_0xba2ff1+=0x1){_0xaa7ea4=_0x183d94[_0xba2ff1][_0x2e53('0x6a')]?_0x171965[_0x183d94[_0xba2ff1][_0x2e53('0x6a')]][_0x2e53('0x6b')]:_0x183d94[_0xba2ff1][_0x2e53('0x63')];_0xaa7ea4=_0x183d94[_0xba2ff1]['function']?_[_0x2e53('0x6e')](_0x4ddb1b[_0x183d94[_0xba2ff1]['function']],'%s',_0xaa7ea4):_0xaa7ea4;_0xaa7ea4=_0x183d94[_0xba2ff1]['format']?_[_0x2e53('0x6e')](_0x1a8f0b[_0x183d94[_0xba2ff1]['format']],'%s',_0xaa7ea4):_0xaa7ea4;if(_0x183d94[_0xba2ff1][_0x2e53('0x88')]){_0x5f00f8[_0x2e53('0x62')](_0xaa7ea4);}_0x183d94[_0xba2ff1][_0x2e53('0x6f')]&&_0x5f00f8[_0x2e53('0x70')](_0xaa7ea4,_0x183d94[_0xba2ff1][_0x2e53('0x6f')]===_0x2e53('0x71')?![]:!![]);_0x5f00f8[_0x2e53('0x63')](_0xaa7ea4,_0x183d94[_0xba2ff1][_0x2e53('0x72')]||_0xaa7ea4);}if(_0x2b4e86[_0x2e53('0x73')]){_0x2b4e86['joins']=JSON[_0x2e53('0x74')](_0x2b4e86['joins']);for(var _0x49bf90=0x0;_0x49bf90<_0x2b4e86[_0x2e53('0x73')]['length'];_0x49bf90+=0x1){if(_0x2b4e86[_0x2e53('0x73')][_0x49bf90]['type']&&_[_0x2e53('0x5d')](_0x3cd2f1,_0x2b4e86[_0x2e53('0x73')][_0x49bf90][_0x2e53('0x2e')])&&_0x2b4e86[_0x2e53('0x73')][_0x49bf90]['parentKey']&&_0x2b4e86[_0x2e53('0x73')][_0x49bf90]['foreignTable']&&_0x2b4e86[_0x2e53('0x73')][_0x49bf90][_0x2e53('0x78')]){_0x5f00f8[_0x2b4e86[_0x2e53('0x73')][_0x49bf90][_0x2e53('0x2e')]](_0x2b4e86['joins'][_0x49bf90]['foreignTable'],null,util[_0x2e53('0x6d')]('%s.%s\x20=\x20%s.%s',_0x2b4e86[_0x2e53('0x89')],_0x2b4e86[_0x2e53('0x73')][_0x49bf90]['parentKey'],_0x2b4e86[_0x2e53('0x73')][_0x49bf90]['foreignTable'],_0x2b4e86[_0x2e53('0x73')][_0x49bf90][_0x2e53('0x78')]));}}}if(_0x2b4e86['conditions']){_0x2b4e86[_0x2e53('0x79')]=JSON[_0x2e53('0x74')](_0x2b4e86[_0x2e53('0x79')]);_0x5f00f8[_0x2e53('0x3b')](_0x4cf834(_0x2b4e86[_0x2e53('0x79')][_0x2e53('0x62')]));}_0x58d5f5=_0x5f00f8['clone']();_0x5f00f8[_0x2e53('0x1f')](_0x4b2790);_0x5f00f8[_0x2e53('0x1e')](0x0);logger['debug'](_0x2e53('0x7b'),_0x5f00f8['toString']());return db[_0x2e53('0x7d')][_0x2e53('0x31')](_0x5f00f8[_0x2e53('0x7c')](),{'type':db['sequelize'][_0x2e53('0x7e')][_0x2e53('0x7f')]});}})[_0x2e53('0x24')](function(_0x327b81){if(!_0x327b81['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x2e53('0x8a'),0xcc);}if(_0x336e94[_0x2e53('0x8b')]===_0x2e53('0x8c')){return null;}var _0x13c726=_['merge'](_0x336e94,{'name':_0x336e94[_0x2e53('0x8d')]||_0x336e94[_0x2e53('0x30')]||_0x2b4e86['name'],'basename':_0x1f6aa1,'savename':util[_0x2e53('0x6d')](_0x2e53('0x8e'),_0x336e94[_0x2e53('0x30')]||_0x2b4e86['name'],require('randomstring')[_0x2e53('0x8f')](0x4),_0x336e94[_0x2e53('0x8b')]||'csv'),'reportId':_0x2b4e86['id'],'reportType':'default'});return db[_0x2e53('0x90')][_0x2e53('0x46')](_0x13c726,{'raw':!![]});})[_0x2e53('0x24')](function(_0x674b42){if(_0x2b4e86[_0x2e53('0x89')]===_0x2e53('0x91')){_0x58d5f5[_0x2e53('0x3b')](_0x2b4e86[_0x2e53('0x89')]+_0x2e53('0x92'),_0x336e94['startDate'],_0x336e94[_0x2e53('0x93')]);}else{_0x58d5f5[_0x2e53('0x3b')](_0x2b4e86[_0x2e53('0x89')]+_0x2e53('0x94'),_0x336e94[_0x2e53('0x95')],_0x336e94[_0x2e53('0x93')]);}if(_0x674b42){logger[_0x2e53('0x96')]('Run\x20Query:',_0x58d5f5['toString']());require('child_process')[_0x2e53('0x97')](path[_0x2e53('0x4e')](__dirname,_0x2e53('0x98'),_0x674b42[_0x2e53('0x8b')]),[_0x674b42['id'],_0x58d5f5[_0x2e53('0x7c')](),path[_0x2e53('0x4e')](__dirname,'../../files/reports',_0x674b42['savename']),_0x1f6aa1]);return _0x674b42;}else{var _0x3aa8b0=squel['select']();_0x3aa8b0[_0x2e53('0x87')]('('+_0x58d5f5[_0x2e53('0x7c')]()+')',_0x2e53('0x99'));_0x3aa8b0[_0x2e53('0x63')](_0x2e53('0x9a'),_0x2e53('0x1d'));_0x58d5f5[_0x2e53('0x1f')](_0x336e94[_0x2e53('0x1f')]||_0x4b2790);_0x58d5f5[_0x2e53('0x1e')](_0x336e94[_0x2e53('0x1e')]||0x0);return dbH[_0x2e53('0x7d')][_0x2e53('0x31')](_0x3aa8b0[_0x2e53('0x7c')](),{'type':dbH[_0x2e53('0x7d')][_0x2e53('0x7e')]['SELECT']})['then'](function(_0x5bd250){if(!_0x5bd250[_0x2e53('0x38')]){_0x35f676=0x0;}else{_0x35f676=_0x5bd250[0x0][_0x2e53('0x1d')]||0x0;}return dbH[_0x2e53('0x7d')]['query'](_0x58d5f5[_0x2e53('0x7c')](),{'type':dbH[_0x2e53('0x7d')][_0x2e53('0x7e')][_0x2e53('0x7f')]});})[_0x2e53('0x24')](function(_0x255974){return{'rows':_0x255974||[],'count':_0x35f676};});}});}exports['run']=function(_0x301eac,_0x2bcb50){return runReport(_0x301eac[_0x2e53('0x44')],_0x301eac[_0x2e53('0x31')],_0x301eac[_0x2e53('0x3f')])[_0x2e53('0x24')](respondWithResult(_0x2bcb50,null))[_0x2e53('0x43')](handleError(_0x2bcb50,null));};exports[_0x2e53('0x9b')]=runReport;exports['query']=function(_0x2466db,_0x2cbac9){var _0xc5e69c=0xa;var _0x192380=[_0x2e53('0x4e'),_0x2e53('0x4f'),_0x2e53('0x50'),'cross_join'];var _0x2ebd9c={'SUM':_0x2e53('0x52'),'COUNT':_0x2e53('0x9c'),'COUNT DISTINCT':_0x2e53('0x53'),'MAX':_0x2e53('0x54'),'MIN':'MIN(%s)','AVG':_0x2e53('0x80'),'GROUP_CONCAT':_0x2e53('0x81'),'GROUP_CONCAT ASC':_0x2e53('0x56'),'GROUP_CONCAT DESC':_0x2e53('0x57')};var _0x5304d1={'SEC_TO_TIME':_0x2e53('0x58'),'DATE':_0x2e53('0x59'),'HOUR':_0x2e53('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2e53('0x5c')};var _0x3883ce=function(_0x5d8267){return!_['includes']([_0x2e53('0x5e'),'IS\x20NOT\x20NULL',_0x2e53('0x5f'),'IS\x20NOT\x20EMPTY'],_0x5d8267);};var _0x12da96=function(_0x48b909){if(!_0x48b909||!_0x48b909['rules']['length']){return'';}for(var _0x978c94='(',_0x572ae8=0x0;_0x572ae8<_0x48b909[_0x2e53('0x60')]['length'];_0x572ae8+=0x1){_0x572ae8>0x0&&(_0x978c94+='\x20'+_0x48b909[_0x2e53('0x61')]+'\x20');_0x978c94+=_0x48b909[_0x2e53('0x60')][_0x572ae8][_0x2e53('0x62')]?_0x12da96(_0x48b909[_0x2e53('0x60')][_0x572ae8][_0x2e53('0x62')]):_0x48b909[_0x2e53('0x60')][_0x572ae8][_0x2e53('0x63')]+'\x20'+_0x48b909['rules'][_0x572ae8][_0x2e53('0x64')]+(_0x3883ce(_0x48b909[_0x2e53('0x60')][_0x572ae8]['condition'])?'\x20'+_0x48b909[_0x2e53('0x60')][_0x572ae8][_0x2e53('0x65')]:'');}return _0x978c94+')';};var _0x51a454={'where':{'id':_0x2466db[_0x2e53('0x44')]['id']}},_0x456161,_0x5071cf,_0x214c5a,_0x5156f8,_0x317281;_0x51a454=_[_0x2e53('0x3d')]({},_0x51a454,_0x2466db[_0x2e53('0x3f')]);return db[_0x2e53('0x2b')][_0x2e53('0x45')](_0x51a454)[_0x2e53('0x24')](function(_0x1ff939){if(_0x1ff939){_0x456161=_0x1ff939;return _0x1ff939[_0x2e53('0x84')]();}return null;})[_0x2e53('0x24')](function(_0x29ee62){if(_0x29ee62){if(!_0x29ee62[_0x2e53('0x38')]){throw new db['Sequelize'][(_0x2e53('0x66'))](_0x2e53('0x86'),0x193);}_0x5071cf=_0x29ee62;return db['AnalyticMetric'][_0x2e53('0x41')]({'raw':!![]});}return null;})[_0x2e53('0x24')](function(_0x368307){if(_0x368307){_0x214c5a=_['keyBy'](_0x368307,'id');var _0x112fce;var _0x22d945=squel[_0x2e53('0x69')]();_0x22d945['from'](_0x456161['table']);for(var _0x385271=0x0;_0x385271<_0x5071cf[_0x2e53('0x38')];_0x385271+=0x1){_0x112fce=_0x5071cf[_0x385271]['MetricId']?_0x214c5a[_0x5071cf[_0x385271][_0x2e53('0x6a')]]['metric']:_0x5071cf[_0x385271][_0x2e53('0x63')];_0x112fce=_0x5071cf[_0x385271]['function']?_[_0x2e53('0x6e')](_0x2ebd9c[_0x5071cf[_0x385271][_0x2e53('0x6c')]],'%s',_0x112fce):_0x112fce;_0x112fce=_0x5071cf[_0x385271][_0x2e53('0x6d')]?_[_0x2e53('0x6e')](_0x5304d1[_0x5071cf[_0x385271]['format']],'%s',_0x112fce):_0x112fce;if(_0x5071cf[_0x385271][_0x2e53('0x88')]){_0x22d945[_0x2e53('0x62')](_0x112fce);}_0x5071cf[_0x385271][_0x2e53('0x6f')]&&_0x22d945[_0x2e53('0x70')](_0x112fce,_0x5071cf[_0x385271]['orderBy']==='DESC'?![]:!![]);_0x22d945[_0x2e53('0x63')](_0x112fce,_0x5071cf[_0x385271][_0x2e53('0x72')]||_0x112fce);}if(_0x456161[_0x2e53('0x73')]){_0x456161[_0x2e53('0x73')]=JSON[_0x2e53('0x74')](_0x456161[_0x2e53('0x73')]);for(var _0xf5e67a=0x0;_0xf5e67a<_0x456161[_0x2e53('0x73')][_0x2e53('0x38')];_0xf5e67a+=0x1){if(_0x456161[_0x2e53('0x73')][_0xf5e67a][_0x2e53('0x2e')]&&_[_0x2e53('0x5d')](_0x192380,_0x456161['joins'][_0xf5e67a]['type'])&&_0x456161[_0x2e53('0x73')][_0xf5e67a][_0x2e53('0x75')]&&_0x456161[_0x2e53('0x73')][_0xf5e67a][_0x2e53('0x77')]&&_0x456161[_0x2e53('0x73')][_0xf5e67a][_0x2e53('0x78')]){_0x22d945[_0x456161['joins'][_0xf5e67a][_0x2e53('0x2e')]](_0x456161[_0x2e53('0x73')][_0xf5e67a][_0x2e53('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x456161[_0x2e53('0x89')],_0x456161[_0x2e53('0x73')][_0xf5e67a]['parentKey'],_0x456161[_0x2e53('0x73')][_0xf5e67a][_0x2e53('0x77')],_0x456161[_0x2e53('0x73')][_0xf5e67a]['foreignKey']));}}}if(_0x456161[_0x2e53('0x79')]){_0x456161[_0x2e53('0x79')]=JSON[_0x2e53('0x74')](_0x456161[_0x2e53('0x79')]);_0x22d945[_0x2e53('0x3b')](_0x12da96(_0x456161[_0x2e53('0x79')][_0x2e53('0x62')]));}_0x317281=_0x22d945[_0x2e53('0x7a')]();_0x22d945[_0x2e53('0x1f')](_0xc5e69c);_0x22d945['offset'](0x0);logger[_0x2e53('0x9d')](_0x2e53('0x7b'),_0x22d945['toString']());return db['sequelize']['query'](_0x22d945['toString'](),{'type':db[_0x2e53('0x7d')][_0x2e53('0x7e')][_0x2e53('0x7f')]});}})[_0x2e53('0x24')](function(){return{'sql':_0x317281[_0x2e53('0x7c')]()};})[_0x2e53('0x24')](respondWithResult(_0x2cbac9,null))[_0x2e53('0x43')](handleError(_0x2cbac9,null));}; \ No newline at end of file +var _0xf45c=['bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','create','body','user','role','Reports','UserProfileSection','userProfileId','find','join','right_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','field','function','groupBy','orderBy','DESC','alias','joins','parse','type','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','condition','Please\x20insert\x20at\x20least\x20one\x20field','MetricId','metric','replace','clone','sequelize','QueryTypes','output','web','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','select','COUNT(*)','runReport','html-pdf','rimraf','fast-json-patch','request-promise'];(function(_0x6e7446,_0x120a01){var _0x167b36=function(_0x909f1a){while(--_0x909f1a){_0x6e7446['push'](_0x6e7446['shift']());}};_0x167b36(++_0x120a01);}(_0xf45c,0x1e5));var _0xcf45=function(_0x5bf1ef,_0x3965fc){_0x5bf1ef=_0x5bf1ef-0x0;var _0x14bf87=_0xf45c[_0x5bf1ef];return _0x14bf87;};'use strict';var pdf=require(_0xcf45('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcf45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf45('0x2'));var rp=require(_0xcf45('0x3'));var moment=require('moment');var BPromise=require(_0xcf45('0x4'));var Mustache=require(_0xcf45('0x5'));var util=require(_0xcf45('0x6'));var path=require(_0xcf45('0x7'));var sox=require(_0xcf45('0x8'));var csv=require('to-csv');var ejs=require(_0xcf45('0x9'));var fs=require('fs');var _=require(_0xcf45('0xa'));var squel=require(_0xcf45('0xb'));var crypto=require(_0xcf45('0xc'));var jsforce=require(_0xcf45('0xd'));var deskjs=require(_0xcf45('0xe'));var toCsv=require(_0xcf45('0xf'));var querystring=require(_0xcf45('0x10'));var Papa=require('papaparse');var Redis=require(_0xcf45('0x11'));var authService=require(_0xcf45('0x12'));var qs=require(_0xcf45('0x13'));var as=require(_0xcf45('0x14'));var hardwareService=require(_0xcf45('0x15'));var logger=require(_0xcf45('0x16'))(_0xcf45('0x17'));var utils=require('../../config/utils');var config=require(_0xcf45('0x18'));var db=require(_0xcf45('0x19'))['db'];var dbH=require(_0xcf45('0x19'))[_0xcf45('0x1a')];function respondWithStatusCode(_0x2277ad,_0x56883c){_0x56883c=_0x56883c||0xcc;return function(_0x5097e5){if(_0x5097e5){return _0x2277ad[_0xcf45('0x1b')](_0x56883c);}return _0x2277ad['status'](_0x56883c)[_0xcf45('0x1c')]();};}function respondWithResult(_0x4e028e,_0x366efb){_0x366efb=_0x366efb||0xc8;return function(_0x557438){if(_0x557438){return _0x4e028e[_0xcf45('0x1d')](_0x366efb)['json'](_0x557438);}};}function respondWithFilteredResult(_0x29d462,_0x42de54){return function(_0x1437c4){if(_0x1437c4){var _0x3c76df=_0x1437c4[_0xcf45('0x1e')],_0x5fe3ed=_0x42de54[_0xcf45('0x1f')],_0x592755=_0x42de54[_0xcf45('0x1f')]+_0x42de54[_0xcf45('0x20')],_0x2b6d49;if(_0x592755>=_0x3c76df){_0x592755=_0x3c76df;_0x2b6d49=0xc8;}else{_0x2b6d49=0xce;}_0x29d462[_0xcf45('0x1d')](_0x2b6d49);return _0x29d462['set'](_0xcf45('0x21'),_0x5fe3ed+'-'+_0x592755+'/'+_0x3c76df)['json'](_0x1437c4);}return null;};}function patchUpdates(_0x5a15ed){return function(_0x415002){try{jsonpatch[_0xcf45('0x22')](_0x415002,_0x5a15ed,!![]);}catch(_0x487eb6){return BPromise[_0xcf45('0x23')](_0x487eb6);}return _0x415002[_0xcf45('0x24')]();};}function saveUpdates(_0x3cf951,_0x1f6046){return function(_0x2e26fd){if(_0x2e26fd){return _0x2e26fd[_0xcf45('0x25')](_0x3cf951)[_0xcf45('0x26')](function(_0x39ad3a){return _0x39ad3a;});}return null;};}function removeEntity(_0x70d184,_0x3e0ba0){return function(_0x17ec20){if(_0x17ec20){return _0x17ec20['destroy']()[_0xcf45('0x26')](function(){var _0x1e5bfc=_0x17ec20[_0xcf45('0x27')]({'plain':!![]});var _0x5b2a27=_0xcf45('0x28');return db[_0xcf45('0x29')][_0xcf45('0x2a')]({'where':{'type':_0x5b2a27,'resourceId':_0x1e5bfc['id']}})[_0xcf45('0x26')](function(){return _0x17ec20;});})[_0xcf45('0x26')](function(){_0x70d184['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x596ccc,_0x31dcf6){return function(_0x264466){if(!_0x264466){_0x596ccc[_0xcf45('0x1b')](0x194);}return _0x264466;};}function handleError(_0x39c084,_0xbc3377){_0xbc3377=_0xbc3377||0x1f4;return function(_0x5dcde5){logger[_0xcf45('0x2b')](_0x5dcde5['stack']);if(_0x5dcde5[_0xcf45('0x2c')]){delete _0x5dcde5['name'];}_0x39c084['status'](_0xbc3377)[_0xcf45('0x2d')](_0x5dcde5);};}exports[_0xcf45('0x2e')]=function(_0x466a9a,_0x5b1d92){var _0x292a4d={},_0x50ce9c={},_0x5b4253={'count':0x0,'rows':[]};var _0xd372ac=_[_0xcf45('0x2f')](db[_0xcf45('0x30')][_0xcf45('0x31')],function(_0x310f02){return{'name':_0x310f02[_0xcf45('0x32')],'type':_0x310f02['type'][_0xcf45('0x33')]};});_0x50ce9c['model']=_[_0xcf45('0x2f')](_0xd372ac,_0xcf45('0x2c'));_0x50ce9c[_0xcf45('0x34')]=_[_0xcf45('0x35')](_0x466a9a['query']);_0x50ce9c[_0xcf45('0x36')]=_['intersection'](_0x50ce9c[_0xcf45('0x37')],_0x50ce9c[_0xcf45('0x34')]);_0x292a4d['attributes']=_[_0xcf45('0x38')](_0x50ce9c[_0xcf45('0x37')],qs[_0xcf45('0x39')](_0x466a9a[_0xcf45('0x34')][_0xcf45('0x39')]));_0x292a4d[_0xcf45('0x3a')]=_0x292a4d[_0xcf45('0x3a')][_0xcf45('0x3b')]?_0x292a4d[_0xcf45('0x3a')]:_0x50ce9c['model'];if(!_0x466a9a['query'][_0xcf45('0x3c')](_0xcf45('0x3d'))){_0x292a4d[_0xcf45('0x20')]=qs['limit'](_0x466a9a[_0xcf45('0x34')]['limit']);_0x292a4d[_0xcf45('0x1f')]=qs[_0xcf45('0x1f')](_0x466a9a[_0xcf45('0x34')][_0xcf45('0x1f')]);}_0x292a4d[_0xcf45('0x3e')]=qs['sort'](_0x466a9a['query'][_0xcf45('0x3f')]);_0x292a4d['where']=qs[_0xcf45('0x36')](_[_0xcf45('0x40')](_0x466a9a[_0xcf45('0x34')],_0x50ce9c['filters']),_0xd372ac);if(_0x466a9a[_0xcf45('0x34')][_0xcf45('0x41')]){_0x292a4d[_0xcf45('0x42')]=_[_0xcf45('0x43')](_0x292a4d[_0xcf45('0x42')],{'$or':_['map'](_0xd372ac,function(_0x8304d9){if(_0x8304d9['type']!=='VIRTUAL'){var _0x352abe={};_0x352abe[_0x8304d9[_0xcf45('0x2c')]]={'$like':'%'+_0x466a9a[_0xcf45('0x34')]['filter']+'%'};return _0x352abe;}})});}_0x292a4d=_[_0xcf45('0x43')]({},_0x292a4d,_0x466a9a[_0xcf45('0x44')]);var _0x3618a5={'where':_0x292a4d[_0xcf45('0x42')]};return db[_0xcf45('0x30')][_0xcf45('0x1e')](_0x3618a5)[_0xcf45('0x26')](function(_0xe34e1c){_0x5b4253[_0xcf45('0x1e')]=_0xe34e1c;if(_0x466a9a[_0xcf45('0x34')][_0xcf45('0x45')]){_0x292a4d[_0xcf45('0x46')]=[{'all':!![]}];}return db[_0xcf45('0x30')][_0xcf45('0x47')](_0x292a4d);})[_0xcf45('0x26')](function(_0x4f946c){_0x5b4253['rows']=_0x4f946c;return _0x5b4253;})[_0xcf45('0x26')](respondWithFilteredResult(_0x5b1d92,_0x292a4d))[_0xcf45('0x48')](handleError(_0x5b1d92,null));};exports[_0xcf45('0x49')]=function(_0x254755,_0x1f2b74){var _0x506aa9={'raw':!![],'where':{'id':_0x254755[_0xcf45('0x4a')]['id']}},_0x58d453={};_0x58d453[_0xcf45('0x37')]=_['keys'](db[_0xcf45('0x30')]['rawAttributes']);_0x58d453[_0xcf45('0x34')]=_['keys'](_0x254755[_0xcf45('0x34')]);_0x58d453[_0xcf45('0x36')]=_['intersection'](_0x58d453['model'],_0x58d453[_0xcf45('0x34')]);_0x506aa9[_0xcf45('0x3a')]=_[_0xcf45('0x38')](_0x58d453[_0xcf45('0x37')],qs[_0xcf45('0x39')](_0x254755[_0xcf45('0x34')]['fields']));_0x506aa9['attributes']=_0x506aa9[_0xcf45('0x3a')][_0xcf45('0x3b')]?_0x506aa9[_0xcf45('0x3a')]:_0x58d453[_0xcf45('0x37')];if(_0x254755['query'][_0xcf45('0x45')]){_0x506aa9[_0xcf45('0x46')]=[{'all':!![]}];}_0x506aa9=_[_0xcf45('0x43')]({},_0x506aa9,_0x254755['options']);return db['AnalyticDefaultReport']['find'](_0x506aa9)[_0xcf45('0x26')](handleEntityNotFound(_0x1f2b74,null))[_0xcf45('0x26')](respondWithResult(_0x1f2b74,null))[_0xcf45('0x48')](handleError(_0x1f2b74,null));};exports[_0xcf45('0x4b')]=function(_0x357df7,_0x5faa6){return db[_0xcf45('0x30')][_0xcf45('0x4b')](_0x357df7[_0xcf45('0x4c')],{})[_0xcf45('0x26')](function(_0x440f5a){var _0x1efab6=_0x357df7[_0xcf45('0x4d')][_0xcf45('0x27')]({'plain':!![]});if(!_0x1efab6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1efab6[_0xcf45('0x4e')]==='user'){var _0x2c6e91=_0x440f5a[_0xcf45('0x27')]({'plain':!![]});var _0x1fb841=_0xcf45('0x4f');return db[_0xcf45('0x50')]['find']({'where':{'name':_0x1fb841,'userProfileId':_0x1efab6[_0xcf45('0x51')]},'raw':!![]})['then'](function(_0x19a45d){if(_0x19a45d&&_0x19a45d['autoAssociation']===0x0){return db[_0xcf45('0x29')]['create']({'name':_0x2c6e91[_0xcf45('0x2c')],'resourceId':_0x2c6e91['id'],'type':_0xcf45('0x28'),'sectionId':_0x19a45d['id']},{})[_0xcf45('0x26')](function(){return _0x440f5a;});}else{return _0x440f5a;}})['catch'](function(_0x226dc9){logger[_0xcf45('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x226dc9);throw _0x226dc9;});}return _0x440f5a;})[_0xcf45('0x26')](respondWithResult(_0x5faa6,0xc9))[_0xcf45('0x48')](handleError(_0x5faa6,null));};exports['update']=function(_0x399626,_0xc90de7){if(_0x399626[_0xcf45('0x4c')]['id']){delete _0x399626[_0xcf45('0x4c')]['id'];}return db[_0xcf45('0x30')]['find']({'where':{'id':_0x399626['params']['id']}})[_0xcf45('0x26')](handleEntityNotFound(_0xc90de7,null))['then'](saveUpdates(_0x399626[_0xcf45('0x4c')],null))[_0xcf45('0x26')](respondWithResult(_0xc90de7,null))[_0xcf45('0x48')](handleError(_0xc90de7,null));};exports[_0xcf45('0x2a')]=function(_0xb235de,_0x2b0bd0){return db['AnalyticDefaultReport'][_0xcf45('0x52')]({'where':{'id':_0xb235de[_0xcf45('0x4a')]['id']}})[_0xcf45('0x26')](handleEntityNotFound(_0x2b0bd0,null))['then'](removeEntity(_0x2b0bd0,null))['catch'](handleError(_0x2b0bd0,null));};exports['preview']=function(_0x505e8f,_0x343330){var _0x49a08b=0xa;var _0x2cbefc=[_0xcf45('0x53'),'left_join',_0xcf45('0x54'),'cross_join'];var _0x21dddf={'SUM':'SUM(%s)','COUNT':_0xcf45('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcf45('0x56'),'MIN':_0xcf45('0x57'),'AVG':_0xcf45('0x58'),'GROUP_CONCAT':_0xcf45('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x209398={'SEC_TO_TIME':_0xcf45('0x5a'),'DATE':'DATE(%s)','HOUR':_0xcf45('0x5b'),'ROUND':_0xcf45('0x5c'),'UNIX_TIMESTAMP':_0xcf45('0x5d')};var _0x58ceb3=function(_0x56ba08){return!_[_0xcf45('0x5e')]([_0xcf45('0x5f'),_0xcf45('0x60'),_0xcf45('0x61'),_0xcf45('0x62')],_0x56ba08);};var _0xada5be=function(_0x21e3ec){if(!_0x21e3ec||!_0x21e3ec[_0xcf45('0x63')][_0xcf45('0x3b')]){return'';}for(var _0x14b335='(',_0x54335c=0x0;_0x54335c<_0x21e3ec[_0xcf45('0x63')][_0xcf45('0x3b')];_0x54335c+=0x1){_0x54335c>0x0&&(_0x14b335+='\x20'+_0x21e3ec[_0xcf45('0x64')]+'\x20');_0x14b335+=_0x21e3ec[_0xcf45('0x63')][_0x54335c][_0xcf45('0x65')]?_0xada5be(_0x21e3ec[_0xcf45('0x63')][_0x54335c][_0xcf45('0x65')]):_0x21e3ec[_0xcf45('0x63')][_0x54335c]['field']+'\x20'+_0x21e3ec[_0xcf45('0x63')][_0x54335c]['condition']+(_0x58ceb3(_0x21e3ec[_0xcf45('0x63')][_0x54335c]['condition'])?'\x20'+_0x21e3ec[_0xcf45('0x63')][_0x54335c][_0xcf45('0x66')]:'');}return _0x14b335+')';};var _0x47231e={'where':{'id':_0x505e8f['params']['id']}},_0x1930dc,_0x2239a2,_0x175d96,_0x3859f7,_0x3729e1;_0x47231e=_[_0xcf45('0x43')]({},_0x47231e,_0x505e8f[_0xcf45('0x44')]);return db[_0xcf45('0x30')][_0xcf45('0x52')](_0x47231e)['then'](function(_0x364405){if(_0x364405){_0x1930dc=_0x364405;return _0x364405[_0xcf45('0x67')]();}return null;})[_0xcf45('0x26')](function(_0x36ffcc){if(_0x36ffcc){if(!_0x36ffcc[_0xcf45('0x3b')]){throw new db[(_0xcf45('0x68'))][(_0xcf45('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2239a2=_0x36ffcc;return db[_0xcf45('0x6a')][_0xcf45('0x47')]({'raw':!![]});}return null;})[_0xcf45('0x26')](function(_0x46d2c8){if(_0x46d2c8){_0x175d96=_[_0xcf45('0x6b')](_0x46d2c8,'id');var _0x3a49c0;var _0x28d2c1=squel['select']();_0x28d2c1[_0xcf45('0x6c')](_0x1930dc['table']);for(var _0x2304f9=0x0;_0x2304f9<_0x2239a2[_0xcf45('0x3b')];_0x2304f9+=0x1){_0x3a49c0=_0x2239a2[_0x2304f9]['MetricId']?_0x175d96[_0x2239a2[_0x2304f9]['MetricId']]['metric']:_0x2239a2[_0x2304f9][_0xcf45('0x6d')];_0x3a49c0=_0x2239a2[_0x2304f9][_0xcf45('0x6e')]?_['replace'](_0x21dddf[_0x2239a2[_0x2304f9][_0xcf45('0x6e')]],'%s',_0x3a49c0):_0x3a49c0;_0x3a49c0=_0x2239a2[_0x2304f9]['format']?_['replace'](_0x209398[_0x2239a2[_0x2304f9]['format']],'%s',_0x3a49c0):_0x3a49c0;if(_0x2239a2[_0x2304f9][_0xcf45('0x6f')]){_0x28d2c1[_0xcf45('0x65')](_0x3a49c0);}_0x2239a2[_0x2304f9][_0xcf45('0x70')]&&_0x28d2c1[_0xcf45('0x3e')](_0x3a49c0,_0x2239a2[_0x2304f9][_0xcf45('0x70')]===_0xcf45('0x71')?![]:!![]);_0x28d2c1['field'](_0x3a49c0,_0x2239a2[_0x2304f9][_0xcf45('0x72')]||_0x3a49c0);}if(_0x1930dc[_0xcf45('0x73')]){_0x1930dc[_0xcf45('0x73')]=JSON[_0xcf45('0x74')](_0x1930dc[_0xcf45('0x73')]);for(var _0x384cb7=0x0;_0x384cb7<_0x1930dc[_0xcf45('0x73')][_0xcf45('0x3b')];_0x384cb7+=0x1){if(_0x1930dc[_0xcf45('0x73')][_0x384cb7][_0xcf45('0x75')]&&_[_0xcf45('0x5e')](_0x2cbefc,_0x1930dc[_0xcf45('0x73')][_0x384cb7]['type'])&&_0x1930dc['joins'][_0x384cb7][_0xcf45('0x76')]&&_0x1930dc[_0xcf45('0x73')][_0x384cb7][_0xcf45('0x77')]&&_0x1930dc['joins'][_0x384cb7][_0xcf45('0x78')]){_0x28d2c1[_0x1930dc[_0xcf45('0x73')][_0x384cb7][_0xcf45('0x75')]](_0x1930dc[_0xcf45('0x73')][_0x384cb7][_0xcf45('0x77')],null,util[_0xcf45('0x79')](_0xcf45('0x7a'),_0x1930dc[_0xcf45('0x7b')],_0x1930dc[_0xcf45('0x73')][_0x384cb7][_0xcf45('0x76')],_0x1930dc[_0xcf45('0x73')][_0x384cb7]['foreignTable'],_0x1930dc[_0xcf45('0x73')][_0x384cb7]['foreignKey']));}}}if(_0x1930dc['conditions']){_0x1930dc['conditions']=JSON[_0xcf45('0x74')](_0x1930dc[_0xcf45('0x7c')]);_0x28d2c1['where'](_0xada5be(_0x1930dc['conditions']['group']));}_0x3729e1=_0x28d2c1['clone']();_0x28d2c1[_0xcf45('0x20')](_0x49a08b);_0x28d2c1['offset'](0x0);logger[_0xcf45('0x7d')](_0xcf45('0x7e'),_0x28d2c1[_0xcf45('0x7f')]());return db['sequelize'][_0xcf45('0x34')](_0x28d2c1[_0xcf45('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0xcf45('0x80')]});}})[_0xcf45('0x26')](respondWithResult(_0x343330,null))[_0xcf45('0x48')](handleError(_0x343330,null));};function runReport(_0x1dbb6e,_0x26849b,_0x3cacd8){var _0x2aea45=_0x26849b[_0xcf45('0x2c')];var _0x2cc5b3=0xa;var _0x52b161=['join','left_join',_0xcf45('0x54'),_0xcf45('0x81')];var _0x30f8ec={'SUM':_0xcf45('0x82'),'COUNT':_0xcf45('0x55'),'COUNT DISTINCT':_0xcf45('0x83'),'MAX':_0xcf45('0x56'),'MIN':_0xcf45('0x57'),'AVG':_0xcf45('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xcf45('0x84'),'GROUP_CONCAT DESC':_0xcf45('0x85')};var _0x3572e0={'SEC_TO_TIME':_0xcf45('0x5a'),'DATE':_0xcf45('0x86'),'HOUR':_0xcf45('0x5b'),'ROUND':_0xcf45('0x5c'),'UNIX_TIMESTAMP':_0xcf45('0x5d')};var _0x45a5ea=function(_0x40b2cf){return!_[_0xcf45('0x5e')]([_0xcf45('0x5f'),_0xcf45('0x60'),_0xcf45('0x61'),_0xcf45('0x62')],_0x40b2cf);};var _0x55f891=function(_0xf88d7a){if(!_0xf88d7a||!_0xf88d7a['rules']['length']){return'';}for(var _0x312150='(',_0x4dd3bb=0x0;_0x4dd3bb<_0xf88d7a[_0xcf45('0x63')][_0xcf45('0x3b')];_0x4dd3bb+=0x1){_0x4dd3bb>0x0&&(_0x312150+='\x20'+_0xf88d7a[_0xcf45('0x64')]+'\x20');_0x312150+=_0xf88d7a[_0xcf45('0x63')][_0x4dd3bb]['group']?_0x55f891(_0xf88d7a['rules'][_0x4dd3bb][_0xcf45('0x65')]):_0xf88d7a[_0xcf45('0x63')][_0x4dd3bb][_0xcf45('0x6d')]+'\x20'+_0xf88d7a[_0xcf45('0x63')][_0x4dd3bb][_0xcf45('0x87')]+(_0x45a5ea(_0xf88d7a[_0xcf45('0x63')][_0x4dd3bb][_0xcf45('0x87')])?'\x20'+_0xf88d7a[_0xcf45('0x63')][_0x4dd3bb][_0xcf45('0x66')]:'');}return _0x312150+')';};var _0x9026d8={'where':{'id':_0x1dbb6e['id']}},_0x12430e,_0x2e41e8,_0xe84928,_0x2fd28f,_0x1d446b;_0x9026d8=_[_0xcf45('0x43')]({},_0x9026d8,_0x3cacd8);return db['AnalyticDefaultReport'][_0xcf45('0x52')](_0x9026d8)[_0xcf45('0x26')](function(_0x4d46c4){if(_0x4d46c4){_0x12430e=_0x4d46c4;return _0x4d46c4[_0xcf45('0x67')]();}return null;})['then'](function(_0x5d5a3e){if(_0x5d5a3e){if(!_0x5d5a3e['length']){throw new db['Sequelize'][(_0xcf45('0x69'))](_0xcf45('0x88'),0x193);}_0x2e41e8=_0x5d5a3e;return db[_0xcf45('0x6a')]['findAll']({'raw':!![]});}return null;})[_0xcf45('0x26')](function(_0x388072){if(_0x388072){_0xe84928=_[_0xcf45('0x6b')](_0x388072,'id');var _0x17d8b5;var _0x28eadb=squel['select']();_0x28eadb[_0xcf45('0x6c')](_0x12430e[_0xcf45('0x7b')]);for(var _0x5ee921=0x0;_0x5ee921<_0x2e41e8['length'];_0x5ee921+=0x1){_0x17d8b5=_0x2e41e8[_0x5ee921][_0xcf45('0x89')]?_0xe84928[_0x2e41e8[_0x5ee921][_0xcf45('0x89')]][_0xcf45('0x8a')]:_0x2e41e8[_0x5ee921][_0xcf45('0x6d')];_0x17d8b5=_0x2e41e8[_0x5ee921][_0xcf45('0x6e')]?_[_0xcf45('0x8b')](_0x30f8ec[_0x2e41e8[_0x5ee921][_0xcf45('0x6e')]],'%s',_0x17d8b5):_0x17d8b5;_0x17d8b5=_0x2e41e8[_0x5ee921][_0xcf45('0x79')]?_[_0xcf45('0x8b')](_0x3572e0[_0x2e41e8[_0x5ee921]['format']],'%s',_0x17d8b5):_0x17d8b5;if(_0x2e41e8[_0x5ee921]['groupBy']){_0x28eadb['group'](_0x17d8b5);}_0x2e41e8[_0x5ee921]['orderBy']&&_0x28eadb[_0xcf45('0x3e')](_0x17d8b5,_0x2e41e8[_0x5ee921][_0xcf45('0x70')]===_0xcf45('0x71')?![]:!![]);_0x28eadb[_0xcf45('0x6d')](_0x17d8b5,_0x2e41e8[_0x5ee921][_0xcf45('0x72')]||_0x17d8b5);}if(_0x12430e[_0xcf45('0x73')]){_0x12430e[_0xcf45('0x73')]=JSON[_0xcf45('0x74')](_0x12430e[_0xcf45('0x73')]);for(var _0x2c25e7=0x0;_0x2c25e7<_0x12430e['joins'][_0xcf45('0x3b')];_0x2c25e7+=0x1){if(_0x12430e[_0xcf45('0x73')][_0x2c25e7]['type']&&_[_0xcf45('0x5e')](_0x52b161,_0x12430e['joins'][_0x2c25e7][_0xcf45('0x75')])&&_0x12430e[_0xcf45('0x73')][_0x2c25e7]['parentKey']&&_0x12430e['joins'][_0x2c25e7][_0xcf45('0x77')]&&_0x12430e[_0xcf45('0x73')][_0x2c25e7][_0xcf45('0x78')]){_0x28eadb[_0x12430e[_0xcf45('0x73')][_0x2c25e7][_0xcf45('0x75')]](_0x12430e[_0xcf45('0x73')][_0x2c25e7]['foreignTable'],null,util[_0xcf45('0x79')](_0xcf45('0x7a'),_0x12430e[_0xcf45('0x7b')],_0x12430e['joins'][_0x2c25e7][_0xcf45('0x76')],_0x12430e[_0xcf45('0x73')][_0x2c25e7][_0xcf45('0x77')],_0x12430e[_0xcf45('0x73')][_0x2c25e7][_0xcf45('0x78')]));}}}if(_0x12430e[_0xcf45('0x7c')]){_0x12430e[_0xcf45('0x7c')]=JSON['parse'](_0x12430e[_0xcf45('0x7c')]);_0x28eadb[_0xcf45('0x42')](_0x55f891(_0x12430e[_0xcf45('0x7c')][_0xcf45('0x65')]));}_0x1d446b=_0x28eadb[_0xcf45('0x8c')]();_0x28eadb[_0xcf45('0x20')](_0x2cc5b3);_0x28eadb['offset'](0x0);logger[_0xcf45('0x7d')](_0xcf45('0x7e'),_0x28eadb[_0xcf45('0x7f')]());return db[_0xcf45('0x8d')]['query'](_0x28eadb[_0xcf45('0x7f')](),{'type':db[_0xcf45('0x8d')][_0xcf45('0x8e')][_0xcf45('0x80')]});}})[_0xcf45('0x26')](function(_0x2ace95){if(!_0x2ace95[_0xcf45('0x3b')]){throw new db[(_0xcf45('0x68'))][(_0xcf45('0x69'))]('No\x20available\x20data',0xcc);}if(_0x26849b[_0xcf45('0x8f')]===_0xcf45('0x90')){return null;}var _0x48214a=_[_0xcf45('0x43')](_0x26849b,{'name':_0x26849b['fullPath']||_0x26849b[_0xcf45('0x2c')]||_0x12430e[_0xcf45('0x2c')],'basename':_0x2aea45,'savename':util[_0xcf45('0x79')](_0xcf45('0x91'),_0x26849b[_0xcf45('0x2c')]||_0x12430e['name'],require(_0xcf45('0x92'))['generate'](0x4),_0x26849b[_0xcf45('0x8f')]||_0xcf45('0x93')),'reportId':_0x12430e['id'],'reportType':_0xcf45('0x94')});return db[_0xcf45('0x95')]['create'](_0x48214a,{'raw':!![]});})[_0xcf45('0x26')](function(_0x38550e){if(_0x12430e['table']===_0xcf45('0x96')){_0x1d446b[_0xcf45('0x42')](_0x12430e['table']+_0xcf45('0x97'),_0x26849b[_0xcf45('0x98')],_0x26849b[_0xcf45('0x99')]);}else{_0x1d446b[_0xcf45('0x42')](_0x12430e[_0xcf45('0x7b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x26849b[_0xcf45('0x98')],_0x26849b[_0xcf45('0x99')]);}if(_0x38550e){logger[_0xcf45('0x9a')]('Run\x20Query:',_0x1d446b[_0xcf45('0x7f')]());require(_0xcf45('0x9b'))[_0xcf45('0x9c')](path[_0xcf45('0x53')](__dirname,_0xcf45('0x9d'),_0x38550e[_0xcf45('0x8f')]),[_0x38550e['id'],_0x1d446b[_0xcf45('0x7f')](),path[_0xcf45('0x53')](__dirname,_0xcf45('0x9e'),_0x38550e[_0xcf45('0x9f')]),_0x2aea45]);return _0x38550e;}else{var _0x9f3fb0=squel[_0xcf45('0xa0')]();_0x9f3fb0['from']('('+_0x1d446b[_0xcf45('0x7f')]()+')','countTable');_0x9f3fb0[_0xcf45('0x6d')](_0xcf45('0xa1'),_0xcf45('0x1e'));_0x1d446b['limit'](_0x26849b[_0xcf45('0x20')]||_0x2cc5b3);_0x1d446b['offset'](_0x26849b['offset']||0x0);return dbH[_0xcf45('0x8d')][_0xcf45('0x34')](_0x9f3fb0[_0xcf45('0x7f')](),{'type':dbH[_0xcf45('0x8d')][_0xcf45('0x8e')]['SELECT']})['then'](function(_0x58dd3e){if(!_0x58dd3e[_0xcf45('0x3b')]){_0x2fd28f=0x0;}else{_0x2fd28f=_0x58dd3e[0x0][_0xcf45('0x1e')]||0x0;}return dbH[_0xcf45('0x8d')][_0xcf45('0x34')](_0x1d446b[_0xcf45('0x7f')](),{'type':dbH['sequelize'][_0xcf45('0x8e')]['SELECT']});})['then'](function(_0x2d71e8){return{'rows':_0x2d71e8||[],'count':_0x2fd28f};});}});}exports['run']=function(_0x117a89,_0x5dea2a){return runReport(_0x117a89['params'],_0x117a89[_0xcf45('0x34')],_0x117a89[_0xcf45('0x44')])['then'](respondWithResult(_0x5dea2a,null))[_0xcf45('0x48')](handleError(_0x5dea2a,null));};exports[_0xcf45('0xa2')]=runReport;exports[_0xcf45('0x34')]=function(_0x5c8eaf,_0x526224){var _0x1ad882=0xa;var _0x446eed=['join','left_join',_0xcf45('0x54'),_0xcf45('0x81')];var _0x8bc3bc={'SUM':_0xcf45('0x82'),'COUNT':_0xcf45('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcf45('0x56'),'MIN':_0xcf45('0x57'),'AVG':_0xcf45('0x58'),'GROUP_CONCAT':_0xcf45('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcf45('0x85')};var _0x451b5c={'SEC_TO_TIME':_0xcf45('0x5a'),'DATE':_0xcf45('0x86'),'HOUR':'HOUR(%s)','ROUND':_0xcf45('0x5c'),'UNIX_TIMESTAMP':_0xcf45('0x5d')};var _0x2cde28=function(_0x2d6c7){return!_[_0xcf45('0x5e')](['IS\x20NULL',_0xcf45('0x60'),_0xcf45('0x61'),_0xcf45('0x62')],_0x2d6c7);};var _0x2e2c1e=function(_0x14c75e){if(!_0x14c75e||!_0x14c75e[_0xcf45('0x63')][_0xcf45('0x3b')]){return'';}for(var _0x5b2c3f='(',_0xe35a93=0x0;_0xe35a93<_0x14c75e[_0xcf45('0x63')]['length'];_0xe35a93+=0x1){_0xe35a93>0x0&&(_0x5b2c3f+='\x20'+_0x14c75e['operator']+'\x20');_0x5b2c3f+=_0x14c75e[_0xcf45('0x63')][_0xe35a93]['group']?_0x2e2c1e(_0x14c75e[_0xcf45('0x63')][_0xe35a93][_0xcf45('0x65')]):_0x14c75e['rules'][_0xe35a93][_0xcf45('0x6d')]+'\x20'+_0x14c75e['rules'][_0xe35a93]['condition']+(_0x2cde28(_0x14c75e[_0xcf45('0x63')][_0xe35a93]['condition'])?'\x20'+_0x14c75e[_0xcf45('0x63')][_0xe35a93]['value']:'');}return _0x5b2c3f+')';};var _0x5ba2a1={'where':{'id':_0x5c8eaf[_0xcf45('0x4a')]['id']}},_0x4839ad,_0xd2fdf0,_0x33cc72,_0x236c24,_0x582223;_0x5ba2a1=_[_0xcf45('0x43')]({},_0x5ba2a1,_0x5c8eaf['options']);return db[_0xcf45('0x30')][_0xcf45('0x52')](_0x5ba2a1)[_0xcf45('0x26')](function(_0x307abc){if(_0x307abc){_0x4839ad=_0x307abc;return _0x307abc['getFields']();}return null;})[_0xcf45('0x26')](function(_0x1f3e8b){if(_0x1f3e8b){if(!_0x1f3e8b['length']){throw new db[(_0xcf45('0x68'))]['ValidationErrorItem'](_0xcf45('0x88'),0x193);}_0xd2fdf0=_0x1f3e8b;return db[_0xcf45('0x6a')][_0xcf45('0x47')]({'raw':!![]});}return null;})['then'](function(_0x71f709){if(_0x71f709){_0x33cc72=_[_0xcf45('0x6b')](_0x71f709,'id');var _0x350f9c;var _0x139b31=squel[_0xcf45('0xa0')]();_0x139b31[_0xcf45('0x6c')](_0x4839ad[_0xcf45('0x7b')]);for(var _0x661ca3=0x0;_0x661ca3<_0xd2fdf0['length'];_0x661ca3+=0x1){_0x350f9c=_0xd2fdf0[_0x661ca3][_0xcf45('0x89')]?_0x33cc72[_0xd2fdf0[_0x661ca3][_0xcf45('0x89')]][_0xcf45('0x8a')]:_0xd2fdf0[_0x661ca3][_0xcf45('0x6d')];_0x350f9c=_0xd2fdf0[_0x661ca3]['function']?_[_0xcf45('0x8b')](_0x8bc3bc[_0xd2fdf0[_0x661ca3][_0xcf45('0x6e')]],'%s',_0x350f9c):_0x350f9c;_0x350f9c=_0xd2fdf0[_0x661ca3][_0xcf45('0x79')]?_[_0xcf45('0x8b')](_0x451b5c[_0xd2fdf0[_0x661ca3][_0xcf45('0x79')]],'%s',_0x350f9c):_0x350f9c;if(_0xd2fdf0[_0x661ca3][_0xcf45('0x6f')]){_0x139b31[_0xcf45('0x65')](_0x350f9c);}_0xd2fdf0[_0x661ca3]['orderBy']&&_0x139b31[_0xcf45('0x3e')](_0x350f9c,_0xd2fdf0[_0x661ca3][_0xcf45('0x70')]===_0xcf45('0x71')?![]:!![]);_0x139b31[_0xcf45('0x6d')](_0x350f9c,_0xd2fdf0[_0x661ca3][_0xcf45('0x72')]||_0x350f9c);}if(_0x4839ad[_0xcf45('0x73')]){_0x4839ad[_0xcf45('0x73')]=JSON[_0xcf45('0x74')](_0x4839ad['joins']);for(var _0x10371a=0x0;_0x10371a<_0x4839ad[_0xcf45('0x73')][_0xcf45('0x3b')];_0x10371a+=0x1){if(_0x4839ad[_0xcf45('0x73')][_0x10371a][_0xcf45('0x75')]&&_['includes'](_0x446eed,_0x4839ad[_0xcf45('0x73')][_0x10371a]['type'])&&_0x4839ad[_0xcf45('0x73')][_0x10371a][_0xcf45('0x76')]&&_0x4839ad[_0xcf45('0x73')][_0x10371a]['foreignTable']&&_0x4839ad['joins'][_0x10371a]['foreignKey']){_0x139b31[_0x4839ad[_0xcf45('0x73')][_0x10371a][_0xcf45('0x75')]](_0x4839ad[_0xcf45('0x73')][_0x10371a][_0xcf45('0x77')],null,util[_0xcf45('0x79')](_0xcf45('0x7a'),_0x4839ad[_0xcf45('0x7b')],_0x4839ad['joins'][_0x10371a][_0xcf45('0x76')],_0x4839ad[_0xcf45('0x73')][_0x10371a]['foreignTable'],_0x4839ad[_0xcf45('0x73')][_0x10371a]['foreignKey']));}}}if(_0x4839ad[_0xcf45('0x7c')]){_0x4839ad['conditions']=JSON[_0xcf45('0x74')](_0x4839ad[_0xcf45('0x7c')]);_0x139b31[_0xcf45('0x42')](_0x2e2c1e(_0x4839ad[_0xcf45('0x7c')][_0xcf45('0x65')]));}_0x582223=_0x139b31[_0xcf45('0x8c')]();_0x139b31[_0xcf45('0x20')](_0x1ad882);_0x139b31[_0xcf45('0x1f')](0x0);logger[_0xcf45('0x7d')](_0xcf45('0x7e'),_0x139b31[_0xcf45('0x7f')]());return db[_0xcf45('0x8d')]['query'](_0x139b31[_0xcf45('0x7f')](),{'type':db['sequelize'][_0xcf45('0x8e')][_0xcf45('0x80')]});}})[_0xcf45('0x26')](function(){return{'sql':_0x582223['toString']()};})['then'](respondWithResult(_0x526224,null))[_0xcf45('0x48')](handleError(_0x526224,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5de844f..57ffc6f 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 _0x53ec=['bluebird','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment'];(function(_0xe70138,_0x37b44c){var _0x50e64a=function(_0x576cf1){while(--_0x576cf1){_0xe70138['push'](_0xe70138['shift']());}};_0x50e64a(++_0x37b44c);}(_0x53ec,0x192));var _0xc53e=function(_0x126e31,_0x54eae6){_0x126e31=_0x126e31-0x0;var _0x3567c8=_0x53ec[_0x126e31];return _0x3567c8;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x12304f,_0x3c24c4){var _0x18f866=function(_0x4ff5e7){while(--_0x4ff5e7){_0x12304f['push'](_0x12304f['shift']());}};_0x18f866(++_0x3c24c4);}(_0x5fab,0x177));var _0xb5fa=function(_0x110c54,_0xa3cfcb){_0x110c54=_0x110c54-0x0;var _0x58a348=_0x5fab[_0x110c54];return _0x58a348;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 3d7203a..c99e8f3 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 _0x65d2=['request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x19f213,_0x17ef53){var _0x32ee2c=function(_0x4dac94){while(--_0x4dac94){_0x19f213['push'](_0x19f213['shift']());}};_0x32ee2c(++_0x17ef53);}(_0x65d2,0xb8));var _0x265d=function(_0x53fadd,_0x4fc74d){_0x53fadd=_0x53fadd-0x0;var _0x53af63=_0x65d2[_0x53fadd];return _0x53af63;};'use strict';var _=require(_0x265d('0x0'));var util=require(_0x265d('0x1'));var moment=require('moment');var BPromise=require(_0x265d('0x2'));var rs=require(_0x265d('0x3'));var fs=require('fs');var Redis=require(_0x265d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x265d('0x5'));var logger=require(_0x265d('0x6'))(_0x265d('0x7'));var config=require('../../config/environment');var jayson=require(_0x265d('0x8'));var client=jayson[_0x265d('0x9')][_0x265d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1020fa,_0x96e943,_0x5ca577){return new BPromise(function(_0x36bf91,_0x18133e){return client[_0x265d('0xb')](_0x1020fa,_0x5ca577)[_0x265d('0xc')](function(_0x422a08){logger['info'](_0x265d('0xd'),_0x96e943,_0x265d('0xe'));logger['debug'](_0x265d('0xf'),_0x96e943,_0x265d('0xe'),JSON[_0x265d('0x10')](_0x422a08));if(_0x422a08[_0x265d('0x11')]){if(_0x422a08[_0x265d('0x11')]['code']===0x1f4){logger[_0x265d('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x96e943,_0x422a08['error'][_0x265d('0x12')]);return _0x18133e(_0x422a08[_0x265d('0x11')][_0x265d('0x12')]);}logger[_0x265d('0x11')](_0x265d('0xd'),_0x96e943,_0x422a08['error'][_0x265d('0x12')]);return _0x36bf91(_0x422a08[_0x265d('0x11')][_0x265d('0x12')]);}else{logger[_0x265d('0x13')](_0x265d('0xd'),_0x96e943,_0x265d('0xe'));_0x36bf91(_0x422a08[_0x265d('0x14')][_0x265d('0x12')]);}})[_0x265d('0x15')](function(_0x1cac5a){logger[_0x265d('0x11')](_0x265d('0xd'),_0x96e943,_0x1cac5a);_0x18133e(_0x1cac5a);});});} \ No newline at end of file +var _0x25c2=['info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3a2649,_0x2291f0){var _0x38ae1e=function(_0x3a0fa8){while(--_0x3a0fa8){_0x3a2649['push'](_0x3a2649['shift']());}};_0x38ae1e(++_0x2291f0);}(_0x25c2,0xdd));var _0x225c=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x25c2[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0x225c('0x0'));var util=require('util');var moment=require(_0x225c('0x1'));var BPromise=require(_0x225c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x225c('0x3'));var db=require(_0x225c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x225c('0x5'))(_0x225c('0x6'));var config=require('../../config/environment');var jayson=require(_0x225c('0x7'));var client=jayson[_0x225c('0x8')][_0x225c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36c1aa,_0x158fdb,_0x299150){return new BPromise(function(_0x4dcdb3,_0x5d200b){return client['request'](_0x36c1aa,_0x299150)['then'](function(_0x21b2f8){logger[_0x225c('0xa')](_0x225c('0xb'),_0x158fdb,'request\x20sent');logger[_0x225c('0xc')](_0x225c('0xd'),_0x158fdb,_0x225c('0xe'),JSON[_0x225c('0xf')](_0x21b2f8));if(_0x21b2f8['error']){if(_0x21b2f8[_0x225c('0x10')][_0x225c('0x11')]===0x1f4){logger['error'](_0x225c('0xb'),_0x158fdb,_0x21b2f8[_0x225c('0x10')][_0x225c('0x12')]);return _0x5d200b(_0x21b2f8['error'][_0x225c('0x12')]);}logger[_0x225c('0x10')](_0x225c('0xb'),_0x158fdb,_0x21b2f8[_0x225c('0x10')][_0x225c('0x12')]);return _0x4dcdb3(_0x21b2f8[_0x225c('0x10')][_0x225c('0x12')]);}else{logger[_0x225c('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x158fdb,'request\x20sent');_0x4dcdb3(_0x21b2f8[_0x225c('0x13')][_0x225c('0x12')]);}})[_0x225c('0x14')](function(_0x1c2c55){logger['error'](_0x225c('0xb'),_0x158fdb,_0x1c2c55);_0x5d200b(_0x1c2c55);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ce633cd..57fa42a 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 _0xef6c=['query','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x3625e3,_0x94c4ec){var _0xd0974=function(_0x5a64fa){while(--_0x5a64fa){_0x3625e3['push'](_0x3625e3['shift']());}};_0xd0974(++_0x94c4ec);}(_0xef6c,0x13f));var _0xcef6=function(_0x45c262,_0x2e3ce5){_0x45c262=_0x45c262-0x0;var _0x4f2ba6=_0xef6c[_0x45c262];return _0x4f2ba6;};'use strict';var multer=require(_0xcef6('0x0'));var util=require(_0xcef6('0x1'));var path=require(_0xcef6('0x2'));var timeout=require(_0xcef6('0x3'));var express=require(_0xcef6('0x4'));var router=express[_0xcef6('0x5')]();var auth=require(_0xcef6('0x6'));var interaction=require(_0xcef6('0x7'));var config=require(_0xcef6('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0xcef6('0x9')]('/',auth[_0xcef6('0xa')](),controller[_0xcef6('0xb')]);router[_0xcef6('0x9')]('/:id',auth[_0xcef6('0xa')](),controller['show']);router['get'](_0xcef6('0xc'),auth[_0xcef6('0xa')](),controller[_0xcef6('0xd')]);router[_0xcef6('0x9')](_0xcef6('0xe'),auth[_0xcef6('0xa')](),controller[_0xcef6('0xf')]);router[_0xcef6('0x9')](_0xcef6('0x10'),auth['isAuthenticated'](),controller[_0xcef6('0x11')]);router['post']('/',auth[_0xcef6('0xa')](),controller[_0xcef6('0x12')]);router[_0xcef6('0x13')](_0xcef6('0x14'),auth['isAuthenticated'](),controller[_0xcef6('0x15')]);router['delete'](_0xcef6('0x14'),auth[_0xcef6('0xa')](),controller[_0xcef6('0x16')]);module[_0xcef6('0x17')]=router; \ No newline at end of file +var _0xd573=['run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run'];(function(_0x3306d8,_0x11d42a){var _0x39e559=function(_0x1443dd){while(--_0x1443dd){_0x3306d8['push'](_0x3306d8['shift']());}};_0x39e559(++_0x11d42a);}(_0xd573,0x135));var _0x3d57=function(_0x408bd1,_0x1f48b0){_0x408bd1=_0x408bd1-0x0;var _0x120fcd=_0xd573[_0x408bd1];return _0x120fcd;};'use strict';var multer=require(_0x3d57('0x0'));var util=require(_0x3d57('0x1'));var path=require(_0x3d57('0x2'));var timeout=require(_0x3d57('0x3'));var express=require(_0x3d57('0x4'));var router=express['Router']();var auth=require(_0x3d57('0x5'));var interaction=require(_0x3d57('0x6'));var config=require(_0x3d57('0x7'));var controller=require(_0x3d57('0x8'));router[_0x3d57('0x9')]('/',auth[_0x3d57('0xa')](),controller[_0x3d57('0xb')]);router['get'](_0x3d57('0xc'),auth[_0x3d57('0xa')](),controller[_0x3d57('0xd')]);router['get'](_0x3d57('0xe'),auth[_0x3d57('0xa')](),controller['preview']);router['get'](_0x3d57('0xf'),auth[_0x3d57('0xa')](),controller[_0x3d57('0x10')]);router[_0x3d57('0x9')](_0x3d57('0x11'),auth[_0x3d57('0xa')](),controller[_0x3d57('0x12')]);router['post']('/',auth[_0x3d57('0xa')](),controller[_0x3d57('0x13')]);router[_0x3d57('0x14')](_0x3d57('0xc'),auth['isAuthenticated'](),controller[_0x3d57('0x15')]);router[_0x3d57('0x16')](_0x3d57('0xc'),auth[_0x3d57('0xa')](),controller[_0x3d57('0x17')]);module[_0x3d57('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f7c2aa1..71f6a52 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 _0xaec6=['pdf','csv','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x106aba,_0x3c7ce0){var _0x5a51e5=function(_0x302f4e){while(--_0x302f4e){_0x106aba['push'](_0x106aba['shift']());}};_0x5a51e5(++_0x3c7ce0);}(_0xaec6,0x10f));var _0x6aec=function(_0x1d23da,_0x1988d1){_0x1d23da=_0x1d23da-0x0;var _0x1cfd91=_0xaec6[_0x1d23da];return _0x1cfd91;};'use strict';var Sequelize=require(_0x6aec('0x0'));var moment=require(_0x6aec('0x1'));module[_0x6aec('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x6aec('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x6aec('0x4')]('csv',_0x6aec('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x6aec('0x6')},'savename':{'type':Sequelize[_0x6aec('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6aec('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x6aec('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x6aec('0x4')](_0x6aec('0x8'),_0x6aec('0x9')),'allowNull':![],'defaultValue':_0x6aec('0x8')},'reportId':{'type':Sequelize[_0x6aec('0xa')](0xb)[_0x6aec('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1f18=['STRING','ENUM','csv','pdf','xlsx','Loading','manual','UNSIGNED','sequelize','moment','exports'];(function(_0x4b0b3b,_0x734d16){var _0x322aaa=function(_0x147903){while(--_0x147903){_0x4b0b3b['push'](_0x4b0b3b['shift']());}};_0x322aaa(++_0x734d16);}(_0x1f18,0xef));var _0x81f1=function(_0x314061,_0x11ebe6){_0x314061=_0x314061-0x0;var _0x47ed38=_0x1f18[_0x314061];return _0x47ed38;};'use strict';var Sequelize=require(_0x81f1('0x0'));var moment=require(_0x81f1('0x1'));module[_0x81f1('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x81f1('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x81f1('0x4')](_0x81f1('0x5'),_0x81f1('0x6'),_0x81f1('0x7')),'allowNull':![],'defaultValue':_0x81f1('0x5')},'savename':{'type':Sequelize[_0x81f1('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x81f1('0x8')},'type':{'type':Sequelize[_0x81f1('0x4')](_0x81f1('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x81f1('0xa')]},'reportType':{'type':Sequelize[_0x81f1('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8a15c83..257967d 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 _0x217f=['limit','apply','save','update','then','destroy','get','ExtractedReports','error','stack','name','send','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','show','params','include','find','catch','create','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','join','root','server/files/reports','ValidationError','exists','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x480e8c,_0x32cea7){var _0x212868=function(_0x3260fb){while(--_0x3260fb){_0x480e8c['push'](_0x480e8c['shift']());}};_0x212868(++_0x32cea7);}(_0x217f,0xf6));var _0xf217=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x217f[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf217('0x0'));var rimraf=require(_0xf217('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf217('0x2'));var rp=require(_0xf217('0x3'));var moment=require(_0xf217('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf217('0x5'));var util=require(_0xf217('0x6'));var path=require(_0xf217('0x7'));var sox=require(_0xf217('0x8'));var csv=require(_0xf217('0x9'));var ejs=require(_0xf217('0xa'));var fs=require('fs');var _=require(_0xf217('0xb'));var squel=require(_0xf217('0xc'));var crypto=require(_0xf217('0xd'));var jsforce=require(_0xf217('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf217('0x9'));var querystring=require(_0xf217('0xf'));var Papa=require('papaparse');var Redis=require(_0xf217('0x10'));var authService=require(_0xf217('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf217('0x12'));var hardwareService=require(_0xf217('0x13'));var logger=require(_0xf217('0x14'))(_0xf217('0x15'));var utils=require('../../config/utils');var config=require(_0xf217('0x16'));var db=require(_0xf217('0x17'))['db'];function respondWithStatusCode(_0x3dcdb4,_0x46c976){_0x46c976=_0x46c976||0xcc;return function(_0x109d0a){if(_0x109d0a){return _0x3dcdb4[_0xf217('0x18')](_0x46c976);}return _0x3dcdb4[_0xf217('0x19')](_0x46c976)[_0xf217('0x1a')]();};}function respondWithResult(_0x483172,_0xd5d8f3){_0xd5d8f3=_0xd5d8f3||0xc8;return function(_0x3b6f3b){if(_0x3b6f3b){return _0x483172[_0xf217('0x19')](_0xd5d8f3)[_0xf217('0x1b')](_0x3b6f3b);}};}function respondWithFilteredResult(_0x547f10,_0x1ae408){return function(_0x462c6c){if(_0x462c6c){var _0x30a12e=_0x462c6c[_0xf217('0x1c')],_0x933805=_0x1ae408[_0xf217('0x1d')],_0x47ab0e=_0x1ae408[_0xf217('0x1d')]+_0x1ae408[_0xf217('0x1e')],_0x408474;if(_0x47ab0e>=_0x30a12e){_0x47ab0e=_0x30a12e;_0x408474=0xc8;}else{_0x408474=0xce;}_0x547f10['status'](_0x408474);return _0x547f10['set']('Content-Range',_0x933805+'-'+_0x47ab0e+'/'+_0x30a12e)[_0xf217('0x1b')](_0x462c6c);}return null;};}function patchUpdates(_0x3c9441){return function(_0x1b35be){try{jsonpatch[_0xf217('0x1f')](_0x1b35be,_0x3c9441,!![]);}catch(_0x3c12dc){return BPromise['reject'](_0x3c12dc);}return _0x1b35be[_0xf217('0x20')]();};}function saveUpdates(_0x39fe62,_0x15e305){return function(_0x549655){if(_0x549655){return _0x549655[_0xf217('0x21')](_0x39fe62)[_0xf217('0x22')](function(_0x4c2c6d){return _0x4c2c6d;});}return null;};}function removeEntity(_0x37b76c,_0x34462b){return function(_0x4f103e){if(_0x4f103e){return _0x4f103e[_0xf217('0x23')]()[_0xf217('0x22')](function(){var _0x3d5b68=_0x4f103e[_0xf217('0x24')]({'plain':!![]});var _0x108e0d=_0xf217('0x25');return db['UserProfileResource'][_0xf217('0x23')]({'where':{'type':_0x108e0d,'resourceId':_0x3d5b68['id']}})[_0xf217('0x22')](function(){return _0x4f103e;});})[_0xf217('0x22')](function(){_0x37b76c[_0xf217('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3554b2,_0x38da43){return function(_0x666c38){if(!_0x666c38){_0x3554b2[_0xf217('0x18')](0x194);}return _0x666c38;};}function handleError(_0xc914ac,_0x1c82f4){_0x1c82f4=_0x1c82f4||0x1f4;return function(_0x37cb50){logger[_0xf217('0x26')](_0x37cb50[_0xf217('0x27')]);if(_0x37cb50[_0xf217('0x28')]){delete _0x37cb50['name'];}_0xc914ac['status'](_0x1c82f4)[_0xf217('0x29')](_0x37cb50);};}exports['index']=function(_0x4aa8ab,_0x5ab922){var _0x4a80a0={},_0x2a6687={},_0x560f56={'count':0x0,'rows':[]};var _0x297239=_[_0xf217('0x2a')](db[_0xf217('0x2b')]['rawAttributes'],function(_0x9707d5){return{'name':_0x9707d5[_0xf217('0x2c')],'type':_0x9707d5[_0xf217('0x2d')][_0xf217('0x2e')]};});_0x2a6687[_0xf217('0x2f')]=_[_0xf217('0x2a')](_0x297239,_0xf217('0x28'));_0x2a6687[_0xf217('0x30')]=_[_0xf217('0x31')](_0x4aa8ab[_0xf217('0x30')]);_0x2a6687['filters']=_[_0xf217('0x32')](_0x2a6687[_0xf217('0x2f')],_0x2a6687['query']);_0x4a80a0[_0xf217('0x33')]=_[_0xf217('0x32')](_0x2a6687['model'],qs['fields'](_0x4aa8ab[_0xf217('0x30')][_0xf217('0x34')]));_0x4a80a0[_0xf217('0x33')]=_0x4a80a0['attributes'][_0xf217('0x35')]?_0x4a80a0[_0xf217('0x33')]:_0x2a6687['model'];if(!_0x4aa8ab[_0xf217('0x30')][_0xf217('0x36')]('nolimit')){_0x4a80a0[_0xf217('0x1e')]=qs['limit'](_0x4aa8ab[_0xf217('0x30')][_0xf217('0x1e')]);_0x4a80a0['offset']=qs[_0xf217('0x1d')](_0x4aa8ab[_0xf217('0x30')][_0xf217('0x1d')]);}_0x4a80a0[_0xf217('0x37')]=qs[_0xf217('0x38')](_0x4aa8ab[_0xf217('0x30')][_0xf217('0x38')]);_0x4a80a0['where']=qs[_0xf217('0x39')](_[_0xf217('0x3a')](_0x4aa8ab[_0xf217('0x30')],_0x2a6687[_0xf217('0x39')]),_0x297239);if(_0x4aa8ab['query']['filter']){_0x4a80a0['where']=_['merge'](_0x4a80a0[_0xf217('0x3b')],{'$or':_[_0xf217('0x2a')](_0x297239,function(_0x125d94){if(_0x125d94[_0xf217('0x2d')]!==_0xf217('0x3c')){var _0x50e6fe={};_0x50e6fe[_0x125d94['name']]={'$like':'%'+_0x4aa8ab[_0xf217('0x30')][_0xf217('0x3d')]+'%'};return _0x50e6fe;}})});}_0x4a80a0=_[_0xf217('0x3e')]({},_0x4a80a0,_0x4aa8ab[_0xf217('0x3f')]);var _0x42abdf={'where':_0x4a80a0[_0xf217('0x3b')]};return db[_0xf217('0x2b')][_0xf217('0x1c')](_0x42abdf)[_0xf217('0x22')](function(_0x37e2a1){_0x560f56['count']=_0x37e2a1;if(_0x4aa8ab[_0xf217('0x30')][_0xf217('0x40')]){_0x4a80a0['include']=[{'all':!![]}];}return db[_0xf217('0x2b')][_0xf217('0x41')](_0x4a80a0);})[_0xf217('0x22')](function(_0x3400f3){_0x560f56['rows']=_0x3400f3;return _0x560f56;})['then'](respondWithFilteredResult(_0x5ab922,_0x4a80a0))['catch'](handleError(_0x5ab922,null));};exports[_0xf217('0x42')]=function(_0x387ed8,_0x17bbc1){var _0x1e4ff6={'raw':!![],'where':{'id':_0x387ed8[_0xf217('0x43')]['id']}},_0x29a6ee={};_0x29a6ee['model']=_[_0xf217('0x31')](db[_0xf217('0x2b')]['rawAttributes']);_0x29a6ee[_0xf217('0x30')]=_['keys'](_0x387ed8[_0xf217('0x30')]);_0x29a6ee[_0xf217('0x39')]=_['intersection'](_0x29a6ee[_0xf217('0x2f')],_0x29a6ee[_0xf217('0x30')]);_0x1e4ff6[_0xf217('0x33')]=_[_0xf217('0x32')](_0x29a6ee[_0xf217('0x2f')],qs[_0xf217('0x34')](_0x387ed8[_0xf217('0x30')][_0xf217('0x34')]));_0x1e4ff6[_0xf217('0x33')]=_0x1e4ff6[_0xf217('0x33')][_0xf217('0x35')]?_0x1e4ff6[_0xf217('0x33')]:_0x29a6ee[_0xf217('0x2f')];if(_0x387ed8[_0xf217('0x30')]['includeAll']){_0x1e4ff6[_0xf217('0x44')]=[{'all':!![]}];}_0x1e4ff6=_[_0xf217('0x3e')]({},_0x1e4ff6,_0x387ed8[_0xf217('0x3f')]);return db[_0xf217('0x2b')][_0xf217('0x45')](_0x1e4ff6)[_0xf217('0x22')](handleEntityNotFound(_0x17bbc1,null))[_0xf217('0x22')](respondWithResult(_0x17bbc1,null))[_0xf217('0x46')](handleError(_0x17bbc1,null));};exports[_0xf217('0x47')]=function(_0x5664b4,_0x548a6c){return db[_0xf217('0x2b')][_0xf217('0x47')](_0x5664b4['body'],{})['then'](function(_0x292e54){var _0x50a7e9=_0x5664b4['user'][_0xf217('0x24')]({'plain':!![]});if(!_0x50a7e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50a7e9[_0xf217('0x48')]===_0xf217('0x49')){var _0x3e1c05=_0x292e54[_0xf217('0x24')]({'plain':!![]});var _0x24566f='ExtractedReports';return db[_0xf217('0x4a')][_0xf217('0x45')]({'where':{'name':_0x24566f,'userProfileId':_0x50a7e9[_0xf217('0x4b')]},'raw':!![]})['then'](function(_0x5569c2){if(_0x5569c2&&_0x5569c2[_0xf217('0x4c')]===0x0){return db[_0xf217('0x4d')][_0xf217('0x47')]({'name':_0x3e1c05[_0xf217('0x28')],'resourceId':_0x3e1c05['id'],'type':_0x5569c2[_0xf217('0x28')],'sectionId':_0x5569c2['id']},{})[_0xf217('0x22')](function(){return _0x292e54;});}else{return _0x292e54;}})[_0xf217('0x46')](function(_0x1036d8){logger[_0xf217('0x26')](_0xf217('0x4e'),_0x1036d8);throw _0x1036d8;});}return _0x292e54;})[_0xf217('0x22')](respondWithResult(_0x548a6c,0xc9))[_0xf217('0x46')](handleError(_0x548a6c,null));};exports[_0xf217('0x21')]=function(_0x398a1a,_0x33415f){if(_0x398a1a[_0xf217('0x4f')]['id']){delete _0x398a1a[_0xf217('0x4f')]['id'];}return db['AnalyticExtractedReport'][_0xf217('0x45')]({'where':{'id':_0x398a1a[_0xf217('0x43')]['id']}})[_0xf217('0x22')](handleEntityNotFound(_0x33415f,null))['then'](saveUpdates(_0x398a1a[_0xf217('0x4f')],null))[_0xf217('0x22')](respondWithResult(_0x33415f,null))[_0xf217('0x46')](handleError(_0x33415f,null));};exports[_0xf217('0x23')]=function(_0x268d72,_0x17b5d0){return db[_0xf217('0x2b')]['find']({'where':{'id':_0x268d72['params']['id']}})['then'](handleEntityNotFound(_0x17b5d0,null))[_0xf217('0x22')](removeEntity(_0x17b5d0,null))[_0xf217('0x46')](handleError(_0x17b5d0,null));};exports[_0xf217('0x50')]=function(_0x42685c,_0x491f2f,_0x331f4b){return db[_0xf217('0x2b')][_0xf217('0x45')]({'where':{'id':_0x42685c['params']['id']},'attributes':['name',_0xf217('0x51'),_0xf217('0x52'),_0xf217('0x53')],'raw':!![]})[_0xf217('0x22')](handleEntityNotFound(_0x491f2f,null))['then'](function(_0x48310c){if(_0x48310c){if(!fs['existsSync'](path[_0xf217('0x54')](config[_0xf217('0x55')],_0xf217('0x56'),_0x48310c[_0xf217('0x52')]))){throw new db['Sequelize'][(_0xf217('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x42685c[_0xf217('0x30')][_0xf217('0x58')]){return _0x491f2f[_0xf217('0x18')](0xc8);}return _0x491f2f[_0xf217('0x50')](path[_0xf217('0x54')](config[_0xf217('0x55')],_0xf217('0x56'),_0x48310c[_0xf217('0x52')]),util[_0xf217('0x59')](_0xf217('0x5a'),_0x48310c['basename']||_0x48310c[_0xf217('0x28')],_0x48310c[_0xf217('0x53')][_0xf217('0x5b')]()));}})[_0xf217('0x46')](handleError(_0x491f2f,null));}; \ No newline at end of file +var _0x39b6=['findAll','catch','keys','fields','includeAll','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','find','userProfileId','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','UserProfileResource','sendStatus','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge'];(function(_0x221e3f,_0x2dd056){var _0x3c3a75=function(_0x3e4fc4){while(--_0x3e4fc4){_0x221e3f['push'](_0x221e3f['shift']());}};_0x3c3a75(++_0x2dd056);}(_0x39b6,0x11b));var _0x639b=function(_0x16c35c,_0x5ac411){_0x16c35c=_0x16c35c-0x0;var _0x562eff=_0x39b6[_0x16c35c];return _0x562eff;};'use strict';var pdf=require(_0x639b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x639b('0x1'));var zipdir=require(_0x639b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x639b('0x3'));var moment=require(_0x639b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x639b('0x5'));var util=require(_0x639b('0x6'));var path=require(_0x639b('0x7'));var sox=require(_0x639b('0x8'));var csv=require(_0x639b('0x9'));var ejs=require(_0x639b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x639b('0xb'));var crypto=require(_0x639b('0xc'));var jsforce=require(_0x639b('0xd'));var deskjs=require(_0x639b('0xe'));var toCsv=require(_0x639b('0x9'));var querystring=require('querystring');var Papa=require(_0x639b('0xf'));var Redis=require('ioredis');var authService=require(_0x639b('0x10'));var qs=require(_0x639b('0x11'));var as=require(_0x639b('0x12'));var hardwareService=require(_0x639b('0x13'));var logger=require('../../config/logger')(_0x639b('0x14'));var utils=require(_0x639b('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c88a9,_0x40b9ba){_0x40b9ba=_0x40b9ba||0xcc;return function(_0x396600){if(_0x396600){return _0x2c88a9['sendStatus'](_0x40b9ba);}return _0x2c88a9[_0x639b('0x16')](_0x40b9ba)['end']();};}function respondWithResult(_0x2a4227,_0x26b0db){_0x26b0db=_0x26b0db||0xc8;return function(_0x4e1efb){if(_0x4e1efb){return _0x2a4227[_0x639b('0x16')](_0x26b0db)['json'](_0x4e1efb);}};}function respondWithFilteredResult(_0x585adf,_0x4ba256){return function(_0x5dc730){if(_0x5dc730){var _0x4ce9e7=_0x5dc730[_0x639b('0x17')],_0x2ad87c=_0x4ba256[_0x639b('0x18')],_0x367830=_0x4ba256[_0x639b('0x18')]+_0x4ba256[_0x639b('0x19')],_0x1126b3;if(_0x367830>=_0x4ce9e7){_0x367830=_0x4ce9e7;_0x1126b3=0xc8;}else{_0x1126b3=0xce;}_0x585adf[_0x639b('0x16')](_0x1126b3);return _0x585adf[_0x639b('0x1a')](_0x639b('0x1b'),_0x2ad87c+'-'+_0x367830+'/'+_0x4ce9e7)[_0x639b('0x1c')](_0x5dc730);}return null;};}function patchUpdates(_0x352ff1){return function(_0x37b310){try{jsonpatch[_0x639b('0x1d')](_0x37b310,_0x352ff1,!![]);}catch(_0x5590d2){return BPromise['reject'](_0x5590d2);}return _0x37b310[_0x639b('0x1e')]();};}function saveUpdates(_0x274d65,_0x165381){return function(_0x10db1f){if(_0x10db1f){return _0x10db1f[_0x639b('0x1f')](_0x274d65)['then'](function(_0x327680){return _0x327680;});}return null;};}function removeEntity(_0x857a73,_0x3debf4){return function(_0x2e9550){if(_0x2e9550){return _0x2e9550[_0x639b('0x20')]()[_0x639b('0x21')](function(){var _0x58bbb6=_0x2e9550['get']({'plain':!![]});var _0x5b9da2='ExtractedReports';return db[_0x639b('0x22')][_0x639b('0x20')]({'where':{'type':_0x5b9da2,'resourceId':_0x58bbb6['id']}})[_0x639b('0x21')](function(){return _0x2e9550;});})['then'](function(){_0x857a73[_0x639b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe9c08a,_0x3e5adc){return function(_0xb77302){if(!_0xb77302){_0xe9c08a[_0x639b('0x23')](0x194);}return _0xb77302;};}function handleError(_0x5be154,_0x2eb46f){_0x2eb46f=_0x2eb46f||0x1f4;return function(_0x4acde1){logger[_0x639b('0x24')](_0x4acde1[_0x639b('0x25')]);if(_0x4acde1[_0x639b('0x26')]){delete _0x4acde1['name'];}_0x5be154[_0x639b('0x16')](_0x2eb46f)['send'](_0x4acde1);};}exports[_0x639b('0x27')]=function(_0x263f04,_0x9b3a40){var _0x2f38ba={},_0x4e9a59={},_0x32b0fd={'count':0x0,'rows':[]};var _0x35b338=_[_0x639b('0x28')](db[_0x639b('0x29')][_0x639b('0x2a')],function(_0x5aefca){return{'name':_0x5aefca[_0x639b('0x2b')],'type':_0x5aefca[_0x639b('0x2c')]['key']};});_0x4e9a59['model']=_[_0x639b('0x28')](_0x35b338,'name');_0x4e9a59['query']=_['keys'](_0x263f04[_0x639b('0x2d')]);_0x4e9a59[_0x639b('0x2e')]=_[_0x639b('0x2f')](_0x4e9a59[_0x639b('0x30')],_0x4e9a59[_0x639b('0x2d')]);_0x2f38ba[_0x639b('0x31')]=_[_0x639b('0x2f')](_0x4e9a59[_0x639b('0x30')],qs['fields'](_0x263f04[_0x639b('0x2d')]['fields']));_0x2f38ba['attributes']=_0x2f38ba[_0x639b('0x31')][_0x639b('0x32')]?_0x2f38ba['attributes']:_0x4e9a59[_0x639b('0x30')];if(!_0x263f04[_0x639b('0x2d')][_0x639b('0x33')]('nolimit')){_0x2f38ba[_0x639b('0x19')]=qs[_0x639b('0x19')](_0x263f04[_0x639b('0x2d')][_0x639b('0x19')]);_0x2f38ba[_0x639b('0x18')]=qs[_0x639b('0x18')](_0x263f04[_0x639b('0x2d')][_0x639b('0x18')]);}_0x2f38ba['order']=qs[_0x639b('0x34')](_0x263f04[_0x639b('0x2d')][_0x639b('0x34')]);_0x2f38ba[_0x639b('0x35')]=qs['filters'](_['pick'](_0x263f04[_0x639b('0x2d')],_0x4e9a59['filters']),_0x35b338);if(_0x263f04[_0x639b('0x2d')][_0x639b('0x36')]){_0x2f38ba[_0x639b('0x35')]=_['merge'](_0x2f38ba['where'],{'$or':_[_0x639b('0x28')](_0x35b338,function(_0x3fadad){if(_0x3fadad['type']!==_0x639b('0x37')){var _0x5e7108={};_0x5e7108[_0x3fadad[_0x639b('0x26')]]={'$like':'%'+_0x263f04['query'][_0x639b('0x36')]+'%'};return _0x5e7108;}})});}_0x2f38ba=_[_0x639b('0x38')]({},_0x2f38ba,_0x263f04['options']);var _0x841922={'where':_0x2f38ba[_0x639b('0x35')]};return db['AnalyticExtractedReport']['count'](_0x841922)[_0x639b('0x21')](function(_0x419b34){_0x32b0fd[_0x639b('0x17')]=_0x419b34;if(_0x263f04[_0x639b('0x2d')]['includeAll']){_0x2f38ba['include']=[{'all':!![]}];}return db[_0x639b('0x29')][_0x639b('0x39')](_0x2f38ba);})[_0x639b('0x21')](function(_0x5b5f17){_0x32b0fd['rows']=_0x5b5f17;return _0x32b0fd;})[_0x639b('0x21')](respondWithFilteredResult(_0x9b3a40,_0x2f38ba))[_0x639b('0x3a')](handleError(_0x9b3a40,null));};exports['show']=function(_0x3b4a93,_0x4737f5){var _0x50a62b={'raw':!![],'where':{'id':_0x3b4a93['params']['id']}},_0x1bd171={};_0x1bd171[_0x639b('0x30')]=_[_0x639b('0x3b')](db[_0x639b('0x29')][_0x639b('0x2a')]);_0x1bd171['query']=_[_0x639b('0x3b')](_0x3b4a93[_0x639b('0x2d')]);_0x1bd171['filters']=_[_0x639b('0x2f')](_0x1bd171[_0x639b('0x30')],_0x1bd171[_0x639b('0x2d')]);_0x50a62b[_0x639b('0x31')]=_[_0x639b('0x2f')](_0x1bd171[_0x639b('0x30')],qs[_0x639b('0x3c')](_0x3b4a93['query'][_0x639b('0x3c')]));_0x50a62b[_0x639b('0x31')]=_0x50a62b['attributes'][_0x639b('0x32')]?_0x50a62b[_0x639b('0x31')]:_0x1bd171[_0x639b('0x30')];if(_0x3b4a93['query'][_0x639b('0x3d')]){_0x50a62b['include']=[{'all':!![]}];}_0x50a62b=_[_0x639b('0x38')]({},_0x50a62b,_0x3b4a93[_0x639b('0x3e')]);return db[_0x639b('0x29')]['find'](_0x50a62b)[_0x639b('0x21')](handleEntityNotFound(_0x4737f5,null))[_0x639b('0x21')](respondWithResult(_0x4737f5,null))[_0x639b('0x3a')](handleError(_0x4737f5,null));};exports[_0x639b('0x3f')]=function(_0x5d3024,_0x55b90a){return db[_0x639b('0x29')]['create'](_0x5d3024[_0x639b('0x40')],{})[_0x639b('0x21')](function(_0x4c6adf){var _0x55460f=_0x5d3024['user'][_0x639b('0x41')]({'plain':!![]});if(!_0x55460f)throw new Error(_0x639b('0x42'));if(_0x55460f[_0x639b('0x43')]===_0x639b('0x44')){var _0xb5d3c8=_0x4c6adf[_0x639b('0x41')]({'plain':!![]});var _0x40d77c=_0x639b('0x45');return db['UserProfileSection'][_0x639b('0x46')]({'where':{'name':_0x40d77c,'userProfileId':_0x55460f[_0x639b('0x47')]},'raw':!![]})[_0x639b('0x21')](function(_0x1c7884){if(_0x1c7884&&_0x1c7884['autoAssociation']===0x0){return db['UserProfileResource'][_0x639b('0x3f')]({'name':_0xb5d3c8['name'],'resourceId':_0xb5d3c8['id'],'type':_0x1c7884['name'],'sectionId':_0x1c7884['id']},{})[_0x639b('0x21')](function(){return _0x4c6adf;});}else{return _0x4c6adf;}})[_0x639b('0x3a')](function(_0x14a675){logger[_0x639b('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14a675);throw _0x14a675;});}return _0x4c6adf;})[_0x639b('0x21')](respondWithResult(_0x55b90a,0xc9))['catch'](handleError(_0x55b90a,null));};exports['update']=function(_0x5710c5,_0x24e75b){if(_0x5710c5[_0x639b('0x40')]['id']){delete _0x5710c5[_0x639b('0x40')]['id'];}return db[_0x639b('0x29')][_0x639b('0x46')]({'where':{'id':_0x5710c5[_0x639b('0x48')]['id']}})[_0x639b('0x21')](handleEntityNotFound(_0x24e75b,null))[_0x639b('0x21')](saveUpdates(_0x5710c5[_0x639b('0x40')],null))[_0x639b('0x21')](respondWithResult(_0x24e75b,null))[_0x639b('0x3a')](handleError(_0x24e75b,null));};exports[_0x639b('0x20')]=function(_0x310643,_0x2f442c){return db['AnalyticExtractedReport'][_0x639b('0x46')]({'where':{'id':_0x310643[_0x639b('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f442c,null))[_0x639b('0x21')](removeEntity(_0x2f442c,null))['catch'](handleError(_0x2f442c,null));};exports[_0x639b('0x49')]=function(_0x414ffb,_0x1bf260,_0x7eeaad){return db['AnalyticExtractedReport'][_0x639b('0x46')]({'where':{'id':_0x414ffb['params']['id']},'attributes':[_0x639b('0x26'),_0x639b('0x4a'),_0x639b('0x4b'),_0x639b('0x4c')],'raw':!![]})[_0x639b('0x21')](handleEntityNotFound(_0x1bf260,null))['then'](function(_0x20db08){if(_0x20db08){if(!fs[_0x639b('0x4d')](path[_0x639b('0x4e')](config[_0x639b('0x4f')],_0x639b('0x50'),_0x20db08[_0x639b('0x4b')]))){throw new db[(_0x639b('0x51'))][(_0x639b('0x52'))](_0x639b('0x53'));}if(_0x414ffb[_0x639b('0x2d')][_0x639b('0x54')]){return _0x1bf260[_0x639b('0x23')](0xc8);}return _0x1bf260[_0x639b('0x49')](path[_0x639b('0x4e')](config[_0x639b('0x4f')],_0x639b('0x50'),_0x20db08[_0x639b('0x4b')]),util['format']('%s.%s',_0x20db08[_0x639b('0x4a')]||_0x20db08[_0x639b('0x26')],_0x20db08[_0x639b('0x4c')]['toLowerCase']()));}})['catch'](handleError(_0x1bf260,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0083bb7..ed982b3 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 _0x6bcf=['api','moment','bluebird','request-promise','path','exports','define','analytics_extracted_reports','lodash','util','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6bcf,0x19f));var _0xf6bc=function(_0x196656,_0x2f51a5){_0x196656=_0x196656-0x0;var _0x4fe400=_0x6bcf[_0x196656];return _0x4fe400;};'use strict';var _=require(_0xf6bc('0x0'));var util=require(_0xf6bc('0x1'));var logger=require(_0xf6bc('0x2'))(_0xf6bc('0x3'));var moment=require(_0xf6bc('0x4'));var BPromise=require(_0xf6bc('0x5'));var rp=require(_0xf6bc('0x6'));var fs=require('fs');var path=require(_0xf6bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0xf6bc('0x8')]=function(_0x3d517d,_0x4190f5){return _0x3d517d[_0xf6bc('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xf6bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd0=['rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bd0,0x1ce));var _0x04bd=function(_0x18b269,_0x4b9725){_0x18b269=_0x18b269-0x0;var _0x20807b=_0x4bd0[_0x18b269];return _0x20807b;};'use strict';var _=require(_0x04bd('0x0'));var util=require(_0x04bd('0x1'));var logger=require(_0x04bd('0x2'))('api');var moment=require(_0x04bd('0x3'));var BPromise=require(_0x04bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04bd('0x5'));var rimraf=require(_0x04bd('0x6'));var config=require(_0x04bd('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x04bd('0x8')]=function(_0x20fb07,_0x3a3915){return _0x20fb07[_0x04bd('0x9')](_0x04bd('0xa'),attributes,{'tableName':_0x04bd('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 2483bb3..e41b478 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 _0x8e07=['info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x15cf17,_0x1849f8){var _0x3072ef=function(_0x37d121){while(--_0x37d121){_0x15cf17['push'](_0x15cf17['shift']());}};_0x3072ef(++_0x1849f8);}(_0x8e07,0xef));var _0x78e0=function(_0x423893,_0x2b14f3){_0x423893=_0x423893-0x0;var _0x50285c=_0x8e07[_0x423893];return _0x50285c;};'use strict';var _=require(_0x78e0('0x0'));var util=require(_0x78e0('0x1'));var moment=require(_0x78e0('0x2'));var BPromise=require(_0x78e0('0x3'));var rs=require(_0x78e0('0x4'));var fs=require('fs');var Redis=require(_0x78e0('0x5'));var db=require(_0x78e0('0x6'))['db'];var utils=require(_0x78e0('0x7'));var logger=require('../../config/logger')(_0x78e0('0x8'));var config=require(_0x78e0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x78e0('0xa')][_0x78e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xce7af6,_0x2a044d,_0x3c9b06){return new BPromise(function(_0x2a63aa,_0x145258){return client[_0x78e0('0xc')](_0xce7af6,_0x3c9b06)[_0x78e0('0xd')](function(_0x184b0e){logger[_0x78e0('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2a044d,_0x78e0('0xf'));logger['debug'](_0x78e0('0x10'),_0x2a044d,'request\x20sent',JSON[_0x78e0('0x11')](_0x184b0e));if(_0x184b0e[_0x78e0('0x12')]){if(_0x184b0e[_0x78e0('0x12')]['code']===0x1f4){logger[_0x78e0('0x12')](_0x78e0('0x13'),_0x2a044d,_0x184b0e['error'][_0x78e0('0x14')]);return _0x145258(_0x184b0e[_0x78e0('0x12')][_0x78e0('0x14')]);}logger[_0x78e0('0x12')](_0x78e0('0x13'),_0x2a044d,_0x184b0e[_0x78e0('0x12')][_0x78e0('0x14')]);return _0x2a63aa(_0x184b0e['error'][_0x78e0('0x14')]);}else{logger[_0x78e0('0xe')](_0x78e0('0x13'),_0x2a044d,'request\x20sent');_0x2a63aa(_0x184b0e[_0x78e0('0x15')]['message']);}})[_0x78e0('0x16')](function(_0xfc9017){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x2a044d,_0xfc9017);_0x145258(_0xfc9017);});});} \ No newline at end of file +var _0x8a65=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','lodash','moment','bluebird'];(function(_0x3167a8,_0x4d5006){var _0x20073f=function(_0x5b7216){while(--_0x5b7216){_0x3167a8['push'](_0x3167a8['shift']());}};_0x20073f(++_0x4d5006);}(_0x8a65,0x177));var _0x58a6=function(_0x1e0a4f,_0x570b15){_0x1e0a4f=_0x1e0a4f-0x0;var _0x271b9e=_0x8a65[_0x1e0a4f];return _0x271b9e;};'use strict';var _=require(_0x58a6('0x0'));var util=require('util');var moment=require(_0x58a6('0x1'));var BPromise=require(_0x58a6('0x2'));var rs=require(_0x58a6('0x3'));var fs=require('fs');var Redis=require(_0x58a6('0x4'));var db=require(_0x58a6('0x5'))['db'];var utils=require(_0x58a6('0x6'));var logger=require(_0x58a6('0x7'))(_0x58a6('0x8'));var config=require(_0x58a6('0x9'));var jayson=require(_0x58a6('0xa'));var client=jayson['client'][_0x58a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6cee03,_0x33a8d0,_0x54571b){return new BPromise(function(_0x33cbea,_0x50ee21){return client[_0x58a6('0xc')](_0x6cee03,_0x54571b)['then'](function(_0x377e2c){logger[_0x58a6('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x33a8d0,'request\x20sent');logger[_0x58a6('0xe')](_0x58a6('0xf'),_0x33a8d0,_0x58a6('0x10'),JSON['stringify'](_0x377e2c));if(_0x377e2c['error']){if(_0x377e2c[_0x58a6('0x11')][_0x58a6('0x12')]===0x1f4){logger[_0x58a6('0x11')](_0x58a6('0x13'),_0x33a8d0,_0x377e2c[_0x58a6('0x11')][_0x58a6('0x14')]);return _0x50ee21(_0x377e2c['error'][_0x58a6('0x14')]);}logger[_0x58a6('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x33a8d0,_0x377e2c['error'][_0x58a6('0x14')]);return _0x33cbea(_0x377e2c[_0x58a6('0x11')][_0x58a6('0x14')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x33a8d0,_0x58a6('0x10'));_0x33cbea(_0x377e2c['result']['message']);}})['catch'](function(_0x56b8b2){logger[_0x58a6('0x11')](_0x58a6('0x13'),_0x33a8d0,_0x56b8b2);_0x50ee21(_0x56b8b2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a391e11..44ae1b2 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 _0x6a98=['show','/:id/download','download','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0xd0434a,_0x1a0b5a){var _0x464715=function(_0x286728){while(--_0x286728){_0xd0434a['push'](_0xd0434a['shift']());}};_0x464715(++_0x1a0b5a);}(_0x6a98,0xc7));var _0x86a9=function(_0x417774,_0x1b95e6){_0x417774=_0x417774-0x0;var _0x10015d=_0x6a98[_0x417774];return _0x10015d;};'use strict';var multer=require('multer');var util=require(_0x86a9('0x0'));var path=require('path');var timeout=require(_0x86a9('0x1'));var express=require(_0x86a9('0x2'));var router=express[_0x86a9('0x3')]();var auth=require(_0x86a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x86a9('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0x86a9('0x6')]('/',auth[_0x86a9('0x7')](),controller[_0x86a9('0x8')]);router['get'](_0x86a9('0x9'),auth['isAuthenticated'](),controller[_0x86a9('0xa')]);router[_0x86a9('0x6')](_0x86a9('0xb'),auth[_0x86a9('0x7')](),controller[_0x86a9('0xc')]);router['post']('/',auth[_0x86a9('0x7')](),controller[_0x86a9('0xd')]);router[_0x86a9('0xe')](_0x86a9('0x9'),auth[_0x86a9('0x7')](),controller[_0x86a9('0xf')]);router[_0x86a9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x86a9('0x11')]);module[_0x86a9('0x12')]=router; \ No newline at end of file +var _0xd086=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','get','/:id','isAuthenticated','show','/:id/download','download','post','create','update','delete','exports','util','path','connect-timeout','express'];(function(_0x20576a,_0x1c2180){var _0x3dd472=function(_0x25b741){while(--_0x25b741){_0x20576a['push'](_0x20576a['shift']());}};_0x3dd472(++_0x1c2180);}(_0xd086,0x1df));var _0x6d08=function(_0x18c658,_0xa4d032){_0x18c658=_0x18c658-0x0;var _0x239fdc=_0xd086[_0x18c658];return _0x239fdc;};'use strict';var multer=require('multer');var util=require(_0x6d08('0x0'));var path=require(_0x6d08('0x1'));var timeout=require(_0x6d08('0x2'));var express=require(_0x6d08('0x3'));var router=express[_0x6d08('0x4')]();var auth=require(_0x6d08('0x5'));var interaction=require(_0x6d08('0x6'));var config=require(_0x6d08('0x7'));var controller=require(_0x6d08('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d08('0x9')]);router[_0x6d08('0xa')](_0x6d08('0xb'),auth[_0x6d08('0xc')](),controller[_0x6d08('0xd')]);router[_0x6d08('0xa')](_0x6d08('0xe'),auth['isAuthenticated'](),controller[_0x6d08('0xf')]);router[_0x6d08('0x10')]('/',auth[_0x6d08('0xc')](),controller[_0x6d08('0x11')]);router['put'](_0x6d08('0xb'),auth[_0x6d08('0xc')](),controller[_0x6d08('0x12')]);router[_0x6d08('0x13')](_0x6d08('0xb'),auth[_0x6d08('0xc')](),controller['destroy']);module[_0x6d08('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 816d507..adec10d 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x1230e3,_0x159dac){var _0x31f894=function(_0x14dbb0){while(--_0x14dbb0){_0x1230e3['push'](_0x1230e3['shift']());}};_0x31f894(++_0x159dac);}(_0x7a54,0x106));var _0x47a5=function(_0x5804b6,_0x334191){_0x5804b6=_0x5804b6-0x0;var _0xf91002=_0x7a54[_0x5804b6];return _0xf91002;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING'];(function(_0x7830e0,_0x965d9e){var _0xc2c3c1=function(_0x10e17a){while(--_0x10e17a){_0x7830e0['push'](_0x7830e0['shift']());}};_0xc2c3c1(++_0x965d9e);}(_0xe14b,0x93));var _0xbe14=function(_0x140041,_0xbb2717){_0x140041=_0x140041-0x0;var _0x518373=_0xe14b[_0x140041];return _0x518373;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index f24bff8..95d611b 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 _0xaeef=['includeAll','find','create','bulkCreate','body','destroy','params','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','offset','set','apply','reject','save','update','then','sendStatus','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticFieldReport','count','include','findAll','rows','catch','attributes'];(function(_0x329ad4,_0x467cd1){var _0xea8fa1=function(_0x1395b3){while(--_0x1395b3){_0x329ad4['push'](_0x329ad4['shift']());}};_0xea8fa1(++_0x467cd1);}(_0xaeef,0x14a));var _0xfaee=function(_0x4e7692,_0x150153){_0x4e7692=_0x4e7692-0x0;var _0x2f3011=_0xaeef[_0x4e7692];return _0x2f3011;};'use strict';var pdf=require(_0xfaee('0x0'));var emlformat=require(_0xfaee('0x1'));var rimraf=require(_0xfaee('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfaee('0x3'));var rp=require(_0xfaee('0x4'));var moment=require(_0xfaee('0x5'));var BPromise=require(_0xfaee('0x6'));var Mustache=require(_0xfaee('0x7'));var util=require('util');var path=require(_0xfaee('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfaee('0x9'));var fs=require('fs');var _=require(_0xfaee('0xa'));var squel=require('squel');var crypto=require(_0xfaee('0xb'));var jsforce=require(_0xfaee('0xc'));var deskjs=require(_0xfaee('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfaee('0xe'));var Redis=require(_0xfaee('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfaee('0x10'));var as=require(_0xfaee('0x11'));var hardwareService=require(_0xfaee('0x12'));var logger=require(_0xfaee('0x13'))(_0xfaee('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfaee('0x15'))['db'];function respondWithStatusCode(_0x2c2576,_0x1809c4){_0x1809c4=_0x1809c4||0xcc;return function(_0x5f0719){if(_0x5f0719){return _0x2c2576['sendStatus'](_0x1809c4);}return _0x2c2576[_0xfaee('0x16')](_0x1809c4)[_0xfaee('0x17')]();};}function respondWithResult(_0x298db5,_0x278a53){_0x278a53=_0x278a53||0xc8;return function(_0x2415fd){if(_0x2415fd){return _0x298db5[_0xfaee('0x16')](_0x278a53)[_0xfaee('0x18')](_0x2415fd);}};}function respondWithFilteredResult(_0x19da9f,_0x5f0280){return function(_0x2a1907){if(_0x2a1907){var _0x334867=_0x2a1907['count'],_0x154bb2=_0x5f0280[_0xfaee('0x19')],_0x47e383=_0x5f0280[_0xfaee('0x19')]+_0x5f0280['limit'],_0x2d24ae;if(_0x47e383>=_0x334867){_0x47e383=_0x334867;_0x2d24ae=0xc8;}else{_0x2d24ae=0xce;}_0x19da9f[_0xfaee('0x16')](_0x2d24ae);return _0x19da9f[_0xfaee('0x1a')]('Content-Range',_0x154bb2+'-'+_0x47e383+'/'+_0x334867)[_0xfaee('0x18')](_0x2a1907);}return null;};}function patchUpdates(_0x4a8c35){return function(_0x4ed47c){try{jsonpatch[_0xfaee('0x1b')](_0x4ed47c,_0x4a8c35,!![]);}catch(_0x5a5299){return BPromise[_0xfaee('0x1c')](_0x5a5299);}return _0x4ed47c[_0xfaee('0x1d')]();};}function saveUpdates(_0x8388ef,_0x31827f){return function(_0x596e36){if(_0x596e36){return _0x596e36[_0xfaee('0x1e')](_0x8388ef)[_0xfaee('0x1f')](function(_0x19048f){return _0x19048f;});}return null;};}function removeEntity(_0x11f602,_0x25f679){return function(_0x3d5219){if(_0x3d5219){return _0x3d5219['destroy']()[_0xfaee('0x1f')](function(){_0x11f602[_0xfaee('0x16')](0xcc)[_0xfaee('0x17')]();});}};}function handleEntityNotFound(_0x2aea24,_0x3191e7){return function(_0x2011c4){if(!_0x2011c4){_0x2aea24[_0xfaee('0x20')](0x194);}return _0x2011c4;};}function handleError(_0x392a12,_0x24ef61){_0x24ef61=_0x24ef61||0x1f4;return function(_0x115363){logger['error'](_0x115363[_0xfaee('0x21')]);if(_0x115363['name']){delete _0x115363[_0xfaee('0x22')];}_0x392a12['status'](_0x24ef61)[_0xfaee('0x23')](_0x115363);};}exports['index']=function(_0x31c5f4,_0x214186){var _0x51cd7c={},_0x1a4d34={},_0x11587b={'count':0x0,'rows':[]};var _0x36d71e=_['map'](db['AnalyticFieldReport'][_0xfaee('0x24')],function(_0x266f5e){return{'name':_0x266f5e[_0xfaee('0x25')],'type':_0x266f5e[_0xfaee('0x26')]['key']};});_0x1a4d34[_0xfaee('0x27')]=_[_0xfaee('0x28')](_0x36d71e,_0xfaee('0x22'));_0x1a4d34[_0xfaee('0x29')]=_[_0xfaee('0x2a')](_0x31c5f4[_0xfaee('0x29')]);_0x1a4d34[_0xfaee('0x2b')]=_[_0xfaee('0x2c')](_0x1a4d34['model'],_0x1a4d34[_0xfaee('0x29')]);_0x51cd7c['attributes']=_[_0xfaee('0x2c')](_0x1a4d34[_0xfaee('0x27')],qs[_0xfaee('0x2d')](_0x31c5f4[_0xfaee('0x29')][_0xfaee('0x2d')]));_0x51cd7c['attributes']=_0x51cd7c['attributes'][_0xfaee('0x2e')]?_0x51cd7c['attributes']:_0x1a4d34[_0xfaee('0x27')];if(!_0x31c5f4[_0xfaee('0x29')][_0xfaee('0x2f')](_0xfaee('0x30'))){_0x51cd7c[_0xfaee('0x31')]=qs['limit'](_0x31c5f4['query']['limit']);_0x51cd7c[_0xfaee('0x19')]=qs[_0xfaee('0x19')](_0x31c5f4[_0xfaee('0x29')][_0xfaee('0x19')]);}_0x51cd7c[_0xfaee('0x32')]=qs[_0xfaee('0x33')](_0x31c5f4[_0xfaee('0x29')][_0xfaee('0x33')]);_0x51cd7c['where']=qs[_0xfaee('0x2b')](_[_0xfaee('0x34')](_0x31c5f4['query'],_0x1a4d34[_0xfaee('0x2b')]),_0x36d71e);if(_0x31c5f4[_0xfaee('0x29')][_0xfaee('0x35')]){_0x51cd7c[_0xfaee('0x36')]=_[_0xfaee('0x37')](_0x51cd7c[_0xfaee('0x36')],{'$or':_[_0xfaee('0x28')](_0x36d71e,function(_0x15e23a){if(_0x15e23a['type']!==_0xfaee('0x38')){var _0x1632f0={};_0x1632f0[_0x15e23a[_0xfaee('0x22')]]={'$like':'%'+_0x31c5f4[_0xfaee('0x29')]['filter']+'%'};return _0x1632f0;}})});}_0x51cd7c=_[_0xfaee('0x37')]({},_0x51cd7c,_0x31c5f4[_0xfaee('0x39')]);var _0x488fe4={'where':_0x51cd7c[_0xfaee('0x36')]};return db[_0xfaee('0x3a')][_0xfaee('0x3b')](_0x488fe4)['then'](function(_0x55e04f){_0x11587b['count']=_0x55e04f;if(_0x31c5f4[_0xfaee('0x29')]['includeAll']){_0x51cd7c[_0xfaee('0x3c')]=[{'all':!![]}];}return db[_0xfaee('0x3a')][_0xfaee('0x3d')](_0x51cd7c);})['then'](function(_0x4b1962){_0x11587b[_0xfaee('0x3e')]=_0x4b1962;return _0x11587b;})['then'](respondWithFilteredResult(_0x214186,_0x51cd7c))[_0xfaee('0x3f')](handleError(_0x214186,null));};exports['show']=function(_0x3983dd,_0x3db405){var _0x2dfbc6={'raw':![],'where':{'id':_0x3983dd['params']['id']}},_0x19a8df={};_0x19a8df[_0xfaee('0x27')]=_[_0xfaee('0x2a')](db['AnalyticFieldReport'][_0xfaee('0x24')]);_0x19a8df['query']=_[_0xfaee('0x2a')](_0x3983dd['query']);_0x19a8df[_0xfaee('0x2b')]=_[_0xfaee('0x2c')](_0x19a8df[_0xfaee('0x27')],_0x19a8df[_0xfaee('0x29')]);_0x2dfbc6['attributes']=_[_0xfaee('0x2c')](_0x19a8df[_0xfaee('0x27')],qs[_0xfaee('0x2d')](_0x3983dd['query']['fields']));_0x2dfbc6[_0xfaee('0x40')]=_0x2dfbc6[_0xfaee('0x40')][_0xfaee('0x2e')]?_0x2dfbc6[_0xfaee('0x40')]:_0x19a8df[_0xfaee('0x27')];if(_0x3983dd['query'][_0xfaee('0x41')]){_0x2dfbc6['include']=[{'all':!![]}];}_0x2dfbc6=_[_0xfaee('0x37')]({},_0x2dfbc6,_0x3983dd['options']);return db[_0xfaee('0x3a')][_0xfaee('0x42')](_0x2dfbc6)['then'](handleEntityNotFound(_0x3db405,null))[_0xfaee('0x1f')](respondWithResult(_0x3db405,null))[_0xfaee('0x3f')](handleError(_0x3db405,null));};exports[_0xfaee('0x43')]=function(_0x14b390,_0x5d701){return db[_0xfaee('0x3a')][_0xfaee('0x43')](_0x14b390['body'],{})[_0xfaee('0x1f')](respondWithResult(_0x5d701,0xc9))['catch'](handleError(_0x5d701,null));};exports[_0xfaee('0x44')]=function(_0x5a1d79,_0x4a59f6){return db[_0xfaee('0x3a')]['bulkCreate'](_0x5a1d79[_0xfaee('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4a59f6,0xc9))[_0xfaee('0x3f')](handleError(_0x4a59f6,null));};exports['update']=function(_0xd898b0,_0x3e4b35){if(_0xd898b0['body']['id']){delete _0xd898b0['body']['id'];}return db['AnalyticFieldReport'][_0xfaee('0x42')]({'where':{'id':_0xd898b0['params']['id']}})[_0xfaee('0x1f')](handleEntityNotFound(_0x3e4b35,null))[_0xfaee('0x1f')](saveUpdates(_0xd898b0['body'],null))[_0xfaee('0x1f')](respondWithResult(_0x3e4b35,null))[_0xfaee('0x3f')](handleError(_0x3e4b35,null));};exports[_0xfaee('0x46')]=function(_0x3b9a03,_0x53dda8){return db[_0xfaee('0x3a')][_0xfaee('0x42')]({'where':{'id':_0x3b9a03[_0xfaee('0x47')]['id']}})[_0xfaee('0x1f')](handleEntityNotFound(_0x53dda8,null))[_0xfaee('0x1f')](removeEntity(_0x53dda8,null))[_0xfaee('0x3f')](handleError(_0x53dda8,null));};exports[_0xfaee('0x48')]=function(_0x2349d0,_0x30e21f){return db[_0xfaee('0x3a')][_0xfaee('0x46')]({'where':{'id':_0x2349d0['query'][_0xfaee('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xfaee('0x1f')](respondWithResult(_0x30e21f,0xcc))[_0xfaee('0x3f')](handleError(_0x30e21f,null));};exports[_0xfaee('0x4a')]=function(_0x7da05c,_0x1c9e2c,_0x25aa76){return db['AnalyticCustomReport'][_0xfaee('0x4b')]({'where':{'id':_0x7da05c[_0xfaee('0x47')]['id']}})[_0xfaee('0x1f')](handleEntityNotFound(_0x1c9e2c,null))[_0xfaee('0x1f')](function(_0x142d30){if(_0x142d30){return db[_0xfaee('0x4c')][_0xfaee('0x4d')](function(_0x5f4793){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x7da05c[_0xfaee('0x47')]['id']},'transaction':_0x5f4793})[_0xfaee('0x1f')](function(_0xb04dee){var _0x5b9c5f=_[_0xfaee('0x28')](_0x7da05c[_0xfaee('0x45')],function(_0x5a85f5){delete _0x5a85f5['id'];_0x5a85f5[_0xfaee('0x4e')]=_0x7da05c['params']['id'];return _0x5a85f5;});return db['AnalyticFieldReport'][_0xfaee('0x44')](_0x5b9c5f,{'transaction':_0x5f4793});});})[_0xfaee('0x1f')](function(){return db[_0xfaee('0x3a')][_0xfaee('0x3d')]({'where':{'CustomReportId':_0x7da05c[_0xfaee('0x47')]['id']}});});}})[_0xfaee('0x1f')](respondWithResult(_0x1c9e2c,null))[_0xfaee('0x3f')](handleError(_0x1c9e2c,null));}; \ No newline at end of file +var _0x5c48=['filters','intersection','attributes','fields','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','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','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x5c48,0xc3));var _0x85c4=function(_0x1657a9,_0x48c9fb){_0x1657a9=_0x1657a9-0x0;var _0x4b8859=_0x5c48[_0x1657a9];return _0x4b8859;};'use strict';var pdf=require(_0x85c4('0x0'));var emlformat=require(_0x85c4('0x1'));var rimraf=require(_0x85c4('0x2'));var zipdir=require(_0x85c4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85c4('0x4'));var moment=require(_0x85c4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x85c4('0x6'));var path=require(_0x85c4('0x7'));var sox=require(_0x85c4('0x8'));var csv=require(_0x85c4('0x9'));var ejs=require(_0x85c4('0xa'));var fs=require('fs');var _=require(_0x85c4('0xb'));var squel=require(_0x85c4('0xc'));var crypto=require(_0x85c4('0xd'));var jsforce=require(_0x85c4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85c4('0x9'));var querystring=require(_0x85c4('0xf'));var Papa=require(_0x85c4('0x10'));var Redis=require(_0x85c4('0x11'));var authService=require(_0x85c4('0x12'));var qs=require(_0x85c4('0x13'));var as=require(_0x85c4('0x14'));var hardwareService=require(_0x85c4('0x15'));var logger=require(_0x85c4('0x16'))(_0x85c4('0x17'));var utils=require(_0x85c4('0x18'));var config=require(_0x85c4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f4d78,_0x41b7af){_0x41b7af=_0x41b7af||0xcc;return function(_0x5d56ec){if(_0x5d56ec){return _0x5f4d78[_0x85c4('0x1a')](_0x41b7af);}return _0x5f4d78['status'](_0x41b7af)['end']();};}function respondWithResult(_0x52a290,_0x45115b){_0x45115b=_0x45115b||0xc8;return function(_0x2c8ad){if(_0x2c8ad){return _0x52a290['status'](_0x45115b)[_0x85c4('0x1b')](_0x2c8ad);}};}function respondWithFilteredResult(_0x202409,_0x3e2769){return function(_0x3b2c52){if(_0x3b2c52){var _0x44d8fc=_0x3b2c52[_0x85c4('0x1c')],_0x515667=_0x3e2769['offset'],_0x37d724=_0x3e2769[_0x85c4('0x1d')]+_0x3e2769[_0x85c4('0x1e')],_0x2bd30f;if(_0x37d724>=_0x44d8fc){_0x37d724=_0x44d8fc;_0x2bd30f=0xc8;}else{_0x2bd30f=0xce;}_0x202409[_0x85c4('0x1f')](_0x2bd30f);return _0x202409[_0x85c4('0x20')](_0x85c4('0x21'),_0x515667+'-'+_0x37d724+'/'+_0x44d8fc)['json'](_0x3b2c52);}return null;};}function patchUpdates(_0x32cfe5){return function(_0x476abd){try{jsonpatch[_0x85c4('0x22')](_0x476abd,_0x32cfe5,!![]);}catch(_0x1c5ffc){return BPromise[_0x85c4('0x23')](_0x1c5ffc);}return _0x476abd[_0x85c4('0x24')]();};}function saveUpdates(_0x38cbed,_0x390fcb){return function(_0x15aff2){if(_0x15aff2){return _0x15aff2[_0x85c4('0x25')](_0x38cbed)[_0x85c4('0x26')](function(_0x2b9054){return _0x2b9054;});}return null;};}function removeEntity(_0x309616,_0x334a83){return function(_0x1f3646){if(_0x1f3646){return _0x1f3646[_0x85c4('0x27')]()[_0x85c4('0x26')](function(){_0x309616[_0x85c4('0x1f')](0xcc)[_0x85c4('0x28')]();});}};}function handleEntityNotFound(_0x40ba02,_0x346023){return function(_0x1da617){if(!_0x1da617){_0x40ba02[_0x85c4('0x1a')](0x194);}return _0x1da617;};}function handleError(_0x5948ed,_0x5e1dad){_0x5e1dad=_0x5e1dad||0x1f4;return function(_0x24bb30){logger[_0x85c4('0x29')](_0x24bb30[_0x85c4('0x2a')]);if(_0x24bb30[_0x85c4('0x2b')]){delete _0x24bb30['name'];}_0x5948ed[_0x85c4('0x1f')](_0x5e1dad)[_0x85c4('0x2c')](_0x24bb30);};}exports['index']=function(_0x76a5bb,_0x25029d){var _0x2649b9={},_0x4eb443={},_0x365482={'count':0x0,'rows':[]};var _0x3162f9=_[_0x85c4('0x2d')](db[_0x85c4('0x2e')][_0x85c4('0x2f')],function(_0x4c8386){return{'name':_0x4c8386[_0x85c4('0x30')],'type':_0x4c8386[_0x85c4('0x31')][_0x85c4('0x32')]};});_0x4eb443[_0x85c4('0x33')]=_[_0x85c4('0x2d')](_0x3162f9,'name');_0x4eb443['query']=_[_0x85c4('0x34')](_0x76a5bb[_0x85c4('0x35')]);_0x4eb443[_0x85c4('0x36')]=_[_0x85c4('0x37')](_0x4eb443[_0x85c4('0x33')],_0x4eb443[_0x85c4('0x35')]);_0x2649b9[_0x85c4('0x38')]=_[_0x85c4('0x37')](_0x4eb443[_0x85c4('0x33')],qs[_0x85c4('0x39')](_0x76a5bb[_0x85c4('0x35')][_0x85c4('0x39')]));_0x2649b9['attributes']=_0x2649b9['attributes']['length']?_0x2649b9[_0x85c4('0x38')]:_0x4eb443[_0x85c4('0x33')];if(!_0x76a5bb[_0x85c4('0x35')]['hasOwnProperty'](_0x85c4('0x3a'))){_0x2649b9[_0x85c4('0x1e')]=qs[_0x85c4('0x1e')](_0x76a5bb[_0x85c4('0x35')][_0x85c4('0x1e')]);_0x2649b9[_0x85c4('0x1d')]=qs['offset'](_0x76a5bb[_0x85c4('0x35')][_0x85c4('0x1d')]);}_0x2649b9[_0x85c4('0x3b')]=qs['sort'](_0x76a5bb[_0x85c4('0x35')][_0x85c4('0x3c')]);_0x2649b9['where']=qs[_0x85c4('0x36')](_['pick'](_0x76a5bb['query'],_0x4eb443[_0x85c4('0x36')]),_0x3162f9);if(_0x76a5bb[_0x85c4('0x35')][_0x85c4('0x3d')]){_0x2649b9[_0x85c4('0x3e')]=_['merge'](_0x2649b9['where'],{'$or':_['map'](_0x3162f9,function(_0x1410a6){if(_0x1410a6[_0x85c4('0x31')]!==_0x85c4('0x3f')){var _0x160e4={};_0x160e4[_0x1410a6[_0x85c4('0x2b')]]={'$like':'%'+_0x76a5bb[_0x85c4('0x35')][_0x85c4('0x3d')]+'%'};return _0x160e4;}})});}_0x2649b9=_[_0x85c4('0x40')]({},_0x2649b9,_0x76a5bb[_0x85c4('0x41')]);var _0xc9eb26={'where':_0x2649b9['where']};return db[_0x85c4('0x2e')][_0x85c4('0x1c')](_0xc9eb26)[_0x85c4('0x26')](function(_0x1e214f){_0x365482[_0x85c4('0x1c')]=_0x1e214f;if(_0x76a5bb[_0x85c4('0x35')][_0x85c4('0x42')]){_0x2649b9[_0x85c4('0x43')]=[{'all':!![]}];}return db[_0x85c4('0x2e')][_0x85c4('0x44')](_0x2649b9);})[_0x85c4('0x26')](function(_0x22a915){_0x365482[_0x85c4('0x45')]=_0x22a915;return _0x365482;})['then'](respondWithFilteredResult(_0x25029d,_0x2649b9))[_0x85c4('0x46')](handleError(_0x25029d,null));};exports[_0x85c4('0x47')]=function(_0x2c76aa,_0x5eedf3){var _0xdd17bd={'raw':![],'where':{'id':_0x2c76aa[_0x85c4('0x48')]['id']}},_0x3d364f={};_0x3d364f[_0x85c4('0x33')]=_[_0x85c4('0x34')](db['AnalyticFieldReport'][_0x85c4('0x2f')]);_0x3d364f[_0x85c4('0x35')]=_[_0x85c4('0x34')](_0x2c76aa['query']);_0x3d364f[_0x85c4('0x36')]=_['intersection'](_0x3d364f[_0x85c4('0x33')],_0x3d364f[_0x85c4('0x35')]);_0xdd17bd['attributes']=_['intersection'](_0x3d364f['model'],qs['fields'](_0x2c76aa[_0x85c4('0x35')][_0x85c4('0x39')]));_0xdd17bd[_0x85c4('0x38')]=_0xdd17bd[_0x85c4('0x38')]['length']?_0xdd17bd[_0x85c4('0x38')]:_0x3d364f[_0x85c4('0x33')];if(_0x2c76aa[_0x85c4('0x35')]['includeAll']){_0xdd17bd[_0x85c4('0x43')]=[{'all':!![]}];}_0xdd17bd=_[_0x85c4('0x40')]({},_0xdd17bd,_0x2c76aa[_0x85c4('0x41')]);return db[_0x85c4('0x2e')][_0x85c4('0x49')](_0xdd17bd)[_0x85c4('0x26')](handleEntityNotFound(_0x5eedf3,null))[_0x85c4('0x26')](respondWithResult(_0x5eedf3,null))[_0x85c4('0x46')](handleError(_0x5eedf3,null));};exports[_0x85c4('0x4a')]=function(_0xcebd1,_0x3fcec8){return db[_0x85c4('0x2e')][_0x85c4('0x4a')](_0xcebd1[_0x85c4('0x4b')],{})['then'](respondWithResult(_0x3fcec8,0xc9))[_0x85c4('0x46')](handleError(_0x3fcec8,null));};exports[_0x85c4('0x4c')]=function(_0x242381,_0x77f0c2){return db['AnalyticFieldReport'][_0x85c4('0x4c')](_0x242381[_0x85c4('0x4b')],{'raw':![],'individualHooks':!![]})[_0x85c4('0x26')](respondWithResult(_0x77f0c2,0xc9))[_0x85c4('0x46')](handleError(_0x77f0c2,null));};exports[_0x85c4('0x25')]=function(_0x2bfaea,_0x541ab5){if(_0x2bfaea[_0x85c4('0x4b')]['id']){delete _0x2bfaea['body']['id'];}return db['AnalyticFieldReport'][_0x85c4('0x49')]({'where':{'id':_0x2bfaea[_0x85c4('0x48')]['id']}})[_0x85c4('0x26')](handleEntityNotFound(_0x541ab5,null))['then'](saveUpdates(_0x2bfaea[_0x85c4('0x4b')],null))[_0x85c4('0x26')](respondWithResult(_0x541ab5,null))[_0x85c4('0x46')](handleError(_0x541ab5,null));};exports['destroy']=function(_0x593768,_0x423102){return db[_0x85c4('0x2e')]['find']({'where':{'id':_0x593768[_0x85c4('0x48')]['id']}})[_0x85c4('0x26')](handleEntityNotFound(_0x423102,null))[_0x85c4('0x26')](removeEntity(_0x423102,null))[_0x85c4('0x46')](handleError(_0x423102,null));};exports[_0x85c4('0x4d')]=function(_0x444db4,_0x105838){return db[_0x85c4('0x2e')][_0x85c4('0x27')]({'where':{'id':_0x444db4[_0x85c4('0x35')][_0x85c4('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x85c4('0x26')](respondWithResult(_0x105838,0xcc))[_0x85c4('0x46')](handleError(_0x105838,null));};exports[_0x85c4('0x4f')]=function(_0x3be6a8,_0x5e9cee,_0xb802da){return db[_0x85c4('0x50')]['findOne']({'where':{'id':_0x3be6a8[_0x85c4('0x48')]['id']}})[_0x85c4('0x26')](handleEntityNotFound(_0x5e9cee,null))[_0x85c4('0x26')](function(_0x59ded8){if(_0x59ded8){return db[_0x85c4('0x51')][_0x85c4('0x52')](function(_0x263fab){return db['AnalyticFieldReport'][_0x85c4('0x27')]({'where':{'CustomReportId':_0x3be6a8[_0x85c4('0x48')]['id']},'transaction':_0x263fab})[_0x85c4('0x26')](function(_0x56a1f9){var _0xfa8399=_[_0x85c4('0x2d')](_0x3be6a8['body'],function(_0x28a9e2){delete _0x28a9e2['id'];_0x28a9e2['CustomReportId']=_0x3be6a8[_0x85c4('0x48')]['id'];return _0x28a9e2;});return db[_0x85c4('0x2e')][_0x85c4('0x4c')](_0xfa8399,{'transaction':_0x263fab});});})[_0x85c4('0x26')](function(){return db[_0x85c4('0x2e')][_0x85c4('0x44')]({'where':{'CustomReportId':_0x3be6a8['params']['id']}});});}})[_0x85c4('0x26')](respondWithResult(_0x5e9cee,null))[_0x85c4('0x46')](handleError(_0x5e9cee,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 623d129..0405983 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 _0x52bf=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x52bf,0x7c));var _0xf52b=function(_0x2a4123,_0x363ba8){_0x2a4123=_0x2a4123-0x0;var _0x5b00df=_0x52bf[_0x2a4123];return _0x5b00df;};'use strict';var _=require(_0xf52b('0x0'));var util=require(_0xf52b('0x1'));var logger=require(_0xf52b('0x2'))('api');var moment=require(_0xf52b('0x3'));var BPromise=require('bluebird');var rp=require(_0xf52b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf52b('0x5'));var config=require(_0xf52b('0x6'));var attributes=require(_0xf52b('0x7'));module[_0xf52b('0x8')]=function(_0x1660fb,_0x50eec2){return _0x1660fb[_0xf52b('0x9')](_0xf52b('0xa'),attributes,{'tableName':_0xf52b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30be=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30be,0x6b));var _0xe30b=function(_0x232eb7,_0x199b07){_0x232eb7=_0x232eb7-0x0;var _0xd7fb8=_0x30be[_0x232eb7];return _0xd7fb8;};'use strict';var _=require(_0xe30b('0x0'));var util=require(_0xe30b('0x1'));var logger=require(_0xe30b('0x2'))(_0xe30b('0x3'));var moment=require(_0xe30b('0x4'));var BPromise=require('bluebird');var rp=require(_0xe30b('0x5'));var fs=require('fs');var path=require(_0xe30b('0x6'));var rimraf=require(_0xe30b('0x7'));var config=require(_0xe30b('0x8'));var attributes=require(_0xe30b('0x9'));module[_0xe30b('0xa')]=function(_0x255807,_0x201657){return _0x255807[_0xe30b('0xb')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 19ac006..8c436da 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 _0x8a27=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5f5b0c,_0x21e7e1){var _0x26f660=function(_0x25e75c){while(--_0x25e75c){_0x5f5b0c['push'](_0x5f5b0c['shift']());}};_0x26f660(++_0x21e7e1);}(_0x8a27,0xc6));var _0x78a2=function(_0x4293f2,_0x46f36c){_0x4293f2=_0x4293f2-0x0;var _0x3c1dcc=_0x8a27[_0x4293f2];return _0x3c1dcc;};'use strict';var _=require(_0x78a2('0x0'));var util=require(_0x78a2('0x1'));var moment=require(_0x78a2('0x2'));var BPromise=require(_0x78a2('0x3'));var rs=require(_0x78a2('0x4'));var fs=require('fs');var Redis=require(_0x78a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x78a2('0x6'))(_0x78a2('0x7'));var config=require(_0x78a2('0x8'));var jayson=require(_0x78a2('0x9'));var client=jayson[_0x78a2('0xa')][_0x78a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fedbf,_0x1e9901,_0x37e128){return new BPromise(function(_0x26b20f,_0x17992d){return client[_0x78a2('0xc')](_0x3fedbf,_0x37e128)[_0x78a2('0xd')](function(_0x474753){logger[_0x78a2('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1e9901,_0x78a2('0xf'));logger[_0x78a2('0x10')](_0x78a2('0x11'),_0x1e9901,_0x78a2('0xf'),JSON[_0x78a2('0x12')](_0x474753));if(_0x474753[_0x78a2('0x13')]){if(_0x474753[_0x78a2('0x13')][_0x78a2('0x14')]===0x1f4){logger[_0x78a2('0x13')](_0x78a2('0x15'),_0x1e9901,_0x474753[_0x78a2('0x13')][_0x78a2('0x16')]);return _0x17992d(_0x474753[_0x78a2('0x13')]['message']);}logger[_0x78a2('0x13')](_0x78a2('0x15'),_0x1e9901,_0x474753['error']['message']);return _0x26b20f(_0x474753[_0x78a2('0x13')][_0x78a2('0x16')]);}else{logger[_0x78a2('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1e9901,_0x78a2('0xf'));_0x26b20f(_0x474753[_0x78a2('0x17')][_0x78a2('0x16')]);}})[_0x78a2('0x18')](function(_0x1a0361){logger[_0x78a2('0x13')](_0x78a2('0x15'),_0x1e9901,_0x1a0361);_0x17992d(_0x1a0361);});});} \ No newline at end of file +var _0x5c0f=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54b680,_0x254038){var _0x49488d=function(_0x2a38f4){while(--_0x2a38f4){_0x54b680['push'](_0x54b680['shift']());}};_0x49488d(++_0x254038);}(_0x5c0f,0x1d2));var _0xf5c0=function(_0x43b276,_0x228f27){_0x43b276=_0x43b276-0x0;var _0x1e0f92=_0x5c0f[_0x43b276];return _0x1e0f92;};'use strict';var _=require('lodash');var util=require(_0xf5c0('0x0'));var moment=require(_0xf5c0('0x1'));var BPromise=require(_0xf5c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5c0('0x3'))['db'];var utils=require(_0xf5c0('0x4'));var logger=require(_0xf5c0('0x5'))(_0xf5c0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5c0('0x7')][_0xf5c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x108ee5,_0xcf2607,_0x7151c2){return new BPromise(function(_0x2f9d20,_0x253d3a){return client[_0xf5c0('0x9')](_0x108ee5,_0x7151c2)['then'](function(_0x2b1b9f){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xcf2607,_0xf5c0('0xa'));logger[_0xf5c0('0xb')](_0xf5c0('0xc'),_0xcf2607,_0xf5c0('0xa'),JSON[_0xf5c0('0xd')](_0x2b1b9f));if(_0x2b1b9f[_0xf5c0('0xe')]){if(_0x2b1b9f[_0xf5c0('0xe')][_0xf5c0('0xf')]===0x1f4){logger[_0xf5c0('0xe')](_0xf5c0('0x10'),_0xcf2607,_0x2b1b9f[_0xf5c0('0xe')][_0xf5c0('0x11')]);return _0x253d3a(_0x2b1b9f[_0xf5c0('0xe')][_0xf5c0('0x11')]);}logger[_0xf5c0('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0xcf2607,_0x2b1b9f[_0xf5c0('0xe')][_0xf5c0('0x11')]);return _0x2f9d20(_0x2b1b9f[_0xf5c0('0xe')][_0xf5c0('0x11')]);}else{logger['info'](_0xf5c0('0x10'),_0xcf2607,_0xf5c0('0xa'));_0x2f9d20(_0x2b1b9f[_0xf5c0('0x12')][_0xf5c0('0x11')]);}})[_0xf5c0('0x13')](function(_0x52219c){logger[_0xf5c0('0xe')](_0xf5c0('0x10'),_0xcf2607,_0x52219c);_0x253d3a(_0x52219c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index cc2d354..5bdb769 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x2f3947,_0xd4b6f){var _0x424d39=function(_0x238daf){while(--_0x238daf){_0x2f3947['push'](_0x2f3947['shift']());}};_0x424d39(++_0xd4b6f);}(_0x7217,0x19e));var _0x7721=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7217[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 9fc7d24..a75bf5c 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 _0x8829=['TEXT','sequelize','STRING','name'];(function(_0x42ffc1,_0x208827){var _0x329963=function(_0x254c8a){while(--_0x254c8a){_0x42ffc1['push'](_0x42ffc1['shift']());}};_0x329963(++_0x208827);}(_0x8829,0x195));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9882('0x0'));module['exports']={'name':{'type':Sequelize[_0x9882('0x1')],'allowNull':![],'unique':_0x9882('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x9882('0x3')]},'description':{'type':Sequelize[_0x9882('0x1')]}}; \ No newline at end of file +var _0x7072=['exports','STRING','name','TEXT'];(function(_0xccd9b7,_0x2ea6bd){var _0x26301d=function(_0x5892db){while(--_0x5892db){_0xccd9b7['push'](_0xccd9b7['shift']());}};_0x26301d(++_0x2ea6bd);}(_0x7072,0x138));var _0x2707=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x7072[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'name':{'type':Sequelize[_0x2707('0x1')],'allowNull':![],'unique':_0x2707('0x2')},'table':{'type':Sequelize[_0x2707('0x1')]},'metric':{'type':Sequelize[_0x2707('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 1fa5038..1d012a8 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 _0x4227=['status','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','Metrics','UserProfileResource','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','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','sendStatus','end'];(function(_0x1f429c,_0x2ca5c8){var _0x3dca6f=function(_0x2dbcac){while(--_0x2dbcac){_0x1f429c['push'](_0x1f429c['shift']());}};_0x3dca6f(++_0x2ca5c8);}(_0x4227,0x89));var _0x7422=function(_0x5df488,_0x22e66e){_0x5df488=_0x5df488-0x0;var _0x2792b2=_0x4227[_0x5df488];return _0x2792b2;};'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'];function respondWithStatusCode(_0x348a19,_0x575c47){_0x575c47=_0x575c47||0xcc;return function(_0xb06dc6){if(_0xb06dc6){return _0x348a19[_0x7422('0x17')](_0x575c47);}return _0x348a19['status'](_0x575c47)[_0x7422('0x18')]();};}function respondWithResult(_0x12a5cd,_0x555082){_0x555082=_0x555082||0xc8;return function(_0x4d3f91){if(_0x4d3f91){return _0x12a5cd[_0x7422('0x19')](_0x555082)['json'](_0x4d3f91);}};}function respondWithFilteredResult(_0x105e1b,_0x788829){return function(_0x487c93){if(_0x487c93){var _0x149c50=_0x487c93[_0x7422('0x1a')],_0x39c31c=_0x788829[_0x7422('0x1b')],_0x31c3ec=_0x788829['offset']+_0x788829[_0x7422('0x1c')],_0x1d1ac3;if(_0x31c3ec>=_0x149c50){_0x31c3ec=_0x149c50;_0x1d1ac3=0xc8;}else{_0x1d1ac3=0xce;}_0x105e1b[_0x7422('0x19')](_0x1d1ac3);return _0x105e1b[_0x7422('0x1d')](_0x7422('0x1e'),_0x39c31c+'-'+_0x31c3ec+'/'+_0x149c50)['json'](_0x487c93);}return null;};}function patchUpdates(_0x1f9e09){return function(_0x578ac8){try{jsonpatch[_0x7422('0x1f')](_0x578ac8,_0x1f9e09,!![]);}catch(_0x38873e){return BPromise[_0x7422('0x20')](_0x38873e);}return _0x578ac8['save']();};}function saveUpdates(_0x24db36,_0xacaad1){return function(_0x368e96){if(_0x368e96){return _0x368e96[_0x7422('0x21')](_0x24db36)['then'](function(_0x58e617){return _0x58e617;});}return null;};}function removeEntity(_0x2fedd2,_0x380ef7){return function(_0x20c1e3){if(_0x20c1e3){return _0x20c1e3[_0x7422('0x22')]()[_0x7422('0x23')](function(){var _0x35e2b0=_0x20c1e3[_0x7422('0x24')]({'plain':!![]});var _0x596b89=_0x7422('0x25');return db[_0x7422('0x26')]['destroy']({'where':{'type':_0x596b89,'resourceId':_0x35e2b0['id']}})[_0x7422('0x23')](function(){return _0x20c1e3;});})[_0x7422('0x23')](function(){_0x2fedd2[_0x7422('0x19')](0xcc)[_0x7422('0x18')]();});}};}function handleEntityNotFound(_0x5436a4,_0x3f579a){return function(_0x2eed9f){if(!_0x2eed9f){_0x5436a4[_0x7422('0x17')](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);};}exports[_0x7422('0x2b')]=function(_0x9b0144,_0x702aef){var _0x59bc52={},_0x1cd623={},_0x41d4a1={'count':0x0,'rows':[]};var _0x5be605=_['map'](db[_0x7422('0x2c')][_0x7422('0x2d')],function(_0x5e08f7){return{'name':_0x5e08f7[_0x7422('0x2e')],'type':_0x5e08f7[_0x7422('0x2f')][_0x7422('0x30')]};});_0x1cd623[_0x7422('0x31')]=_[_0x7422('0x32')](_0x5be605,_0x7422('0x29'));_0x1cd623[_0x7422('0x33')]=_[_0x7422('0x34')](_0x9b0144[_0x7422('0x33')]);_0x1cd623[_0x7422('0x35')]=_[_0x7422('0x36')](_0x1cd623['model'],_0x1cd623[_0x7422('0x33')]);_0x59bc52[_0x7422('0x37')]=_[_0x7422('0x36')](_0x1cd623[_0x7422('0x31')],qs['fields'](_0x9b0144[_0x7422('0x33')][_0x7422('0x38')]));_0x59bc52[_0x7422('0x37')]=_0x59bc52['attributes']['length']?_0x59bc52[_0x7422('0x37')]:_0x1cd623['model'];if(!_0x9b0144[_0x7422('0x33')]['hasOwnProperty'](_0x7422('0x39'))){_0x59bc52['limit']=qs[_0x7422('0x1c')](_0x9b0144['query']['limit']);_0x59bc52[_0x7422('0x1b')]=qs['offset'](_0x9b0144[_0x7422('0x33')][_0x7422('0x1b')]);}_0x59bc52[_0x7422('0x3a')]=qs[_0x7422('0x3b')](_0x9b0144[_0x7422('0x33')][_0x7422('0x3b')]);_0x59bc52[_0x7422('0x3c')]=qs['filters'](_[_0x7422('0x3d')](_0x9b0144[_0x7422('0x33')],_0x1cd623[_0x7422('0x35')]),_0x5be605);if(_0x9b0144[_0x7422('0x33')][_0x7422('0x3e')]){_0x59bc52['where']=_[_0x7422('0x3f')](_0x59bc52[_0x7422('0x3c')],{'$or':_['map'](_0x5be605,function(_0x20b4df){if(_0x20b4df['type']!==_0x7422('0x40')){var _0x5cf733={};_0x5cf733[_0x20b4df['name']]={'$like':'%'+_0x9b0144[_0x7422('0x33')][_0x7422('0x3e')]+'%'};return _0x5cf733;}})});}_0x59bc52=_[_0x7422('0x3f')]({},_0x59bc52,_0x9b0144['options']);var _0x4ecce={'where':_0x59bc52[_0x7422('0x3c')]};return db['AnalyticMetric'][_0x7422('0x1a')](_0x4ecce)['then'](function(_0x37f696){_0x41d4a1[_0x7422('0x1a')]=_0x37f696;if(_0x9b0144[_0x7422('0x33')][_0x7422('0x41')]){_0x59bc52[_0x7422('0x42')]=[{'all':!![]}];}return db[_0x7422('0x2c')][_0x7422('0x43')](_0x59bc52);})['then'](function(_0x28a143){_0x41d4a1[_0x7422('0x44')]=_0x28a143;return _0x41d4a1;})['then'](respondWithFilteredResult(_0x702aef,_0x59bc52))[_0x7422('0x45')](handleError(_0x702aef,null));};exports[_0x7422('0x46')]=function(_0x5719df,_0xca1546){var _0x4e2cd4={'raw':!![],'where':{'id':_0x5719df['params']['id']}},_0x303c62={};_0x303c62[_0x7422('0x31')]=_[_0x7422('0x34')](db[_0x7422('0x2c')][_0x7422('0x2d')]);_0x303c62[_0x7422('0x33')]=_[_0x7422('0x34')](_0x5719df[_0x7422('0x33')]);_0x303c62[_0x7422('0x35')]=_[_0x7422('0x36')](_0x303c62[_0x7422('0x31')],_0x303c62['query']);_0x4e2cd4[_0x7422('0x37')]=_['intersection'](_0x303c62['model'],qs[_0x7422('0x38')](_0x5719df[_0x7422('0x33')]['fields']));_0x4e2cd4[_0x7422('0x37')]=_0x4e2cd4[_0x7422('0x37')][_0x7422('0x47')]?_0x4e2cd4[_0x7422('0x37')]:_0x303c62[_0x7422('0x31')];if(_0x5719df[_0x7422('0x33')][_0x7422('0x41')]){_0x4e2cd4['include']=[{'all':!![]}];}_0x4e2cd4=_[_0x7422('0x3f')]({},_0x4e2cd4,_0x5719df[_0x7422('0x48')]);return db[_0x7422('0x2c')][_0x7422('0x49')](_0x4e2cd4)['then'](handleEntityNotFound(_0xca1546,null))[_0x7422('0x23')](respondWithResult(_0xca1546,null))[_0x7422('0x45')](handleError(_0xca1546,null));};exports[_0x7422('0x4a')]=function(_0x4db98d,_0x3fa77a){return db[_0x7422('0x2c')]['create'](_0x4db98d['body'],{})['then'](function(_0x48b843){var _0xbbc9ab=_0x4db98d['user'][_0x7422('0x24')]({'plain':!![]});if(!_0xbbc9ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbbc9ab[_0x7422('0x4b')]===_0x7422('0x4c')){var _0x2986ec=_0x48b843[_0x7422('0x24')]({'plain':!![]});var _0x557bcc='Metrics';return db[_0x7422('0x4d')][_0x7422('0x49')]({'where':{'name':_0x557bcc,'userProfileId':_0xbbc9ab['userProfileId']},'raw':!![]})[_0x7422('0x23')](function(_0x2fbe91){if(_0x2fbe91&&_0x2fbe91['autoAssociation']===0x0){return db[_0x7422('0x26')][_0x7422('0x4a')]({'name':_0x2986ec[_0x7422('0x29')],'resourceId':_0x2986ec['id'],'type':_0x2fbe91[_0x7422('0x29')],'sectionId':_0x2fbe91['id']},{})[_0x7422('0x23')](function(){return _0x48b843;});}else{return _0x48b843;}})[_0x7422('0x45')](function(_0x2da25a){logger[_0x7422('0x27')](_0x7422('0x4e'),_0x2da25a);throw _0x2da25a;});}return _0x48b843;})[_0x7422('0x23')](respondWithResult(_0x3fa77a,0xc9))['catch'](handleError(_0x3fa77a,null));};exports[_0x7422('0x21')]=function(_0x38a957,_0x253e3d){if(_0x38a957['body']['id']){delete _0x38a957[_0x7422('0x4f')]['id'];}return db[_0x7422('0x2c')][_0x7422('0x49')]({'where':{'id':_0x38a957[_0x7422('0x50')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x253e3d,null))[_0x7422('0x23')](saveUpdates(_0x38a957['body'],null))[_0x7422('0x23')](respondWithResult(_0x253e3d,null))[_0x7422('0x45')](handleError(_0x253e3d,null));};exports[_0x7422('0x22')]=function(_0x38af44,_0x309daf){return db[_0x7422('0x2c')][_0x7422('0x49')]({'where':{'id':_0x38af44['params']['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x309daf,null))['then'](removeEntity(_0x309daf,null))['catch'](handleError(_0x309daf,null));}; \ No newline at end of file +var _0xe511=['UserProfileResource','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticMetric','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','destroy','then','get','Metrics'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0xe511,0x16f));var _0x1e51=function(_0x2a07c9,_0x185c10){_0x2a07c9=_0x2a07c9-0x0;var _0x4e5723=_0xe511[_0x2a07c9];return _0x4e5723;};'use strict';var pdf=require(_0x1e51('0x0'));var emlformat=require(_0x1e51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e51('0x3'));var moment=require(_0x1e51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e51('0x5'));var util=require(_0x1e51('0x6'));var path=require(_0x1e51('0x7'));var sox=require(_0x1e51('0x8'));var csv=require('to-csv');var ejs=require(_0x1e51('0x9'));var fs=require('fs');var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var db=require(_0x1e51('0x16'))['db'];function respondWithStatusCode(_0x34ad70,_0x3c5330){_0x3c5330=_0x3c5330||0xcc;return function(_0x5544eb){if(_0x5544eb){return _0x34ad70[_0x1e51('0x17')](_0x3c5330);}return _0x34ad70[_0x1e51('0x18')](_0x3c5330)[_0x1e51('0x19')]();};}function respondWithResult(_0xcf297f,_0x21bcbd){_0x21bcbd=_0x21bcbd||0xc8;return function(_0x32945d){if(_0x32945d){return _0xcf297f[_0x1e51('0x18')](_0x21bcbd)[_0x1e51('0x1a')](_0x32945d);}};}function respondWithFilteredResult(_0x1cc62a,_0xd76fba){return function(_0x5a5c07){if(_0x5a5c07){var _0x3b01b7=_0x5a5c07[_0x1e51('0x1b')],_0x24db4f=_0xd76fba['offset'],_0x4526b4=_0xd76fba['offset']+_0xd76fba[_0x1e51('0x1c')],_0x5857e2;if(_0x4526b4>=_0x3b01b7){_0x4526b4=_0x3b01b7;_0x5857e2=0xc8;}else{_0x5857e2=0xce;}_0x1cc62a[_0x1e51('0x18')](_0x5857e2);return _0x1cc62a[_0x1e51('0x1d')](_0x1e51('0x1e'),_0x24db4f+'-'+_0x4526b4+'/'+_0x3b01b7)[_0x1e51('0x1a')](_0x5a5c07);}return null;};}function patchUpdates(_0x3e4234){return function(_0x4ef18a){try{jsonpatch[_0x1e51('0x1f')](_0x4ef18a,_0x3e4234,!![]);}catch(_0x4a9272){return BPromise[_0x1e51('0x20')](_0x4a9272);}return _0x4ef18a[_0x1e51('0x21')]();};}function saveUpdates(_0x309a87,_0x183a95){return function(_0x506f40){if(_0x506f40){return _0x506f40['update'](_0x309a87)['then'](function(_0x548c32){return _0x548c32;});}return null;};}function removeEntity(_0x1aec4f,_0x4f1f56){return function(_0x3f7340){if(_0x3f7340){return _0x3f7340[_0x1e51('0x22')]()[_0x1e51('0x23')](function(){var _0x13240f=_0x3f7340[_0x1e51('0x24')]({'plain':!![]});var _0xf9298=_0x1e51('0x25');return db[_0x1e51('0x26')]['destroy']({'where':{'type':_0xf9298,'resourceId':_0x13240f['id']}})['then'](function(){return _0x3f7340;});})[_0x1e51('0x23')](function(){_0x1aec4f[_0x1e51('0x18')](0xcc)[_0x1e51('0x19')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x27')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x18')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x28')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['AnalyticMetric']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x29')],'type':_0x20eb9b[_0x1e51('0x2a')][_0x1e51('0x2b')]};});_0x10ee23[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x6862d1,_0x1e51('0x2e'));_0x10ee23[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x1eb79f[_0x1e51('0x2f')]);_0x10ee23[_0x1e51('0x31')]=_['intersection'](_0x10ee23[_0x1e51('0x2c')],_0x10ee23[_0x1e51('0x2f')]);_0x3e6ef2[_0x1e51('0x32')]=_[_0x1e51('0x33')](_0x10ee23[_0x1e51('0x2c')],qs['fields'](_0x1eb79f[_0x1e51('0x2f')]['fields']));_0x3e6ef2[_0x1e51('0x32')]=_0x3e6ef2[_0x1e51('0x32')][_0x1e51('0x34')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2c')];if(!_0x1eb79f['query'][_0x1e51('0x35')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x1c')](_0x1eb79f[_0x1e51('0x2f')][_0x1e51('0x1c')]);_0x3e6ef2['offset']=qs[_0x1e51('0x36')](_0x1eb79f['query'][_0x1e51('0x36')]);}_0x3e6ef2[_0x1e51('0x37')]=qs['sort'](_0x1eb79f[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x3e6ef2[_0x1e51('0x39')]=qs[_0x1e51('0x31')](_[_0x1e51('0x3a')](_0x1eb79f[_0x1e51('0x2f')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x3b')]){_0x3e6ef2['where']=_[_0x1e51('0x3c')](_0x3e6ef2[_0x1e51('0x39')],{'$or':_[_0x1e51('0x2d')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x2a')]!==_0x1e51('0x3d')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2e')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3c')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3e')][_0x1e51('0x1b')](_0x29a689)[_0x1e51('0x23')](function(_0x471386){_0x71c7af[_0x1e51('0x1b')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2f')][_0x1e51('0x3f')]){_0x3e6ef2[_0x1e51('0x40')]=[{'all':!![]}];}return db[_0x1e51('0x3e')][_0x1e51('0x41')](_0x3e6ef2);})[_0x1e51('0x23')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x23')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x42')](handleError(_0x56722f,null));};exports[_0x1e51('0x43')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':!![],'where':{'id':_0x4650e4[_0x1e51('0x44')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x30')](db[_0x1e51('0x3e')][_0x1e51('0x45')]);_0x25592c[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4650e4[_0x1e51('0x2f')]);_0x25592c[_0x1e51('0x31')]=_['intersection'](_0x25592c[_0x1e51('0x2c')],_0x25592c[_0x1e51('0x2f')]);_0x1a9e0d['attributes']=_[_0x1e51('0x33')](_0x25592c[_0x1e51('0x2c')],qs[_0x1e51('0x46')](_0x4650e4['query'][_0x1e51('0x46')]));_0x1a9e0d[_0x1e51('0x32')]=_0x1a9e0d[_0x1e51('0x32')][_0x1e51('0x34')]?_0x1a9e0d[_0x1e51('0x32')]:_0x25592c[_0x1e51('0x2c')];if(_0x4650e4[_0x1e51('0x2f')][_0x1e51('0x3f')]){_0x1a9e0d[_0x1e51('0x40')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x47')]);return db[_0x1e51('0x3e')]['find'](_0x1a9e0d)[_0x1e51('0x23')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x23')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x42')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3e')]['create'](_0x44468a[_0x1e51('0x48')],{})['then'](function(_0x581f7a){var _0x54688b=_0x44468a[_0x1e51('0x49')][_0x1e51('0x24')]({'plain':!![]});if(!_0x54688b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54688b['role']===_0x1e51('0x49')){var _0x7ffc42=_0x581f7a[_0x1e51('0x24')]({'plain':!![]});var _0x233a5a=_0x1e51('0x25');return db[_0x1e51('0x4a')]['find']({'where':{'name':_0x233a5a,'userProfileId':_0x54688b[_0x1e51('0x4b')]},'raw':!![]})['then'](function(_0xf6bd35){if(_0xf6bd35&&_0xf6bd35[_0x1e51('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x7ffc42['name'],'resourceId':_0x7ffc42['id'],'type':_0xf6bd35[_0x1e51('0x2e')],'sectionId':_0xf6bd35['id']},{})[_0x1e51('0x23')](function(){return _0x581f7a;});}else{return _0x581f7a;}})[_0x1e51('0x42')](function(_0x4cdfe3){logger[_0x1e51('0x4d')](_0x1e51('0x4e'),_0x4cdfe3);throw _0x4cdfe3;});}return _0x581f7a;})[_0x1e51('0x23')](respondWithResult(_0x4634de,0xc9))[_0x1e51('0x42')](handleError(_0x4634de,null));};exports[_0x1e51('0x4f')]=function(_0x12584c,_0x32fe1f){if(_0x12584c[_0x1e51('0x48')]['id']){delete _0x12584c['body']['id'];}return db[_0x1e51('0x3e')][_0x1e51('0x50')]({'where':{'id':_0x12584c[_0x1e51('0x44')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x32fe1f,null))[_0x1e51('0x23')](saveUpdates(_0x12584c[_0x1e51('0x48')],null))['then'](respondWithResult(_0x32fe1f,null))[_0x1e51('0x42')](handleError(_0x32fe1f,null));};exports['destroy']=function(_0x56a276,_0x4807b9){return db[_0x1e51('0x3e')][_0x1e51('0x50')]({'where':{'id':_0x56a276[_0x1e51('0x44')]['id']}})['then'](handleEntityNotFound(_0x4807b9,null))[_0x1e51('0x23')](removeEntity(_0x4807b9,null))[_0x1e51('0x42')](handleError(_0x4807b9,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d67ffa8..abf10fd 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 _0xdedd=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x1ac264,_0x99e7b8){var _0x220b78=function(_0x4b5809){while(--_0x4b5809){_0x1ac264['push'](_0x1ac264['shift']());}};_0x220b78(++_0x99e7b8);}(_0xdedd,0x16b));var _0xdded=function(_0x40a474,_0x42fa78){_0x40a474=_0x40a474-0x0;var _0x42ccbb=_0xdedd[_0x40a474];return _0x42ccbb;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var logger=require(_0xdded('0x2'))(_0xdded('0x3'));var moment=require(_0xdded('0x4'));var BPromise=require(_0xdded('0x5'));var rp=require(_0xdded('0x6'));var fs=require('fs');var path=require(_0xdded('0x7'));var rimraf=require(_0xdded('0x8'));var config=require(_0xdded('0x9'));var attributes=require('./analyticMetric.attributes');module[_0xdded('0xa')]=function(_0x411295,_0x4b7919){return _0x411295[_0xdded('0xb')](_0xdded('0xc'),attributes,{'tableName':_0xdded('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa338=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','lodash','../../config/logger','moment'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xa338,0x6b));var _0x8a33=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0xa338[_0x408d22];return _0x58effd;};'use strict';var _=require(_0x8a33('0x0'));var util=require('util');var logger=require(_0x8a33('0x1'))('api');var moment=require(_0x8a33('0x2'));var BPromise=require(_0x8a33('0x3'));var rp=require(_0x8a33('0x4'));var fs=require('fs');var path=require(_0x8a33('0x5'));var rimraf=require(_0x8a33('0x6'));var config=require(_0x8a33('0x7'));var attributes=require(_0x8a33('0x8'));module[_0x8a33('0x9')]=function(_0x26d35c,_0x4ee99f){return _0x26d35c['define'](_0x8a33('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 8cfa169..978a550 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 _0xb0b1=['code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb0b1,0xb0));var _0x1b0b=function(_0x362b63,_0x29d562){_0x362b63=_0x362b63-0x0;var _0x3d8ed1=_0xb0b1[_0x362b63];return _0x3d8ed1;};'use strict';var _=require(_0x1b0b('0x0'));var util=require(_0x1b0b('0x1'));var moment=require('moment');var BPromise=require(_0x1b0b('0x2'));var rs=require(_0x1b0b('0x3'));var fs=require('fs');var Redis=require(_0x1b0b('0x4'));var db=require(_0x1b0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1b0b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b0b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa26cb5,_0x25a375,_0x1049ba){return new BPromise(function(_0x4f3f55,_0x321de1){return client[_0x1b0b('0x8')](_0xa26cb5,_0x1049ba)[_0x1b0b('0x9')](function(_0x49ea09){logger['info'](_0x1b0b('0xa'),_0x25a375,_0x1b0b('0xb'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x25a375,_0x1b0b('0xb'),JSON[_0x1b0b('0xc')](_0x49ea09));if(_0x49ea09[_0x1b0b('0xd')]){if(_0x49ea09['error'][_0x1b0b('0xe')]===0x1f4){logger[_0x1b0b('0xd')](_0x1b0b('0xa'),_0x25a375,_0x49ea09[_0x1b0b('0xd')][_0x1b0b('0xf')]);return _0x321de1(_0x49ea09[_0x1b0b('0xd')][_0x1b0b('0xf')]);}logger[_0x1b0b('0xd')](_0x1b0b('0xa'),_0x25a375,_0x49ea09['error'][_0x1b0b('0xf')]);return _0x4f3f55(_0x49ea09[_0x1b0b('0xd')][_0x1b0b('0xf')]);}else{logger[_0x1b0b('0x10')](_0x1b0b('0xa'),_0x25a375,_0x1b0b('0xb'));_0x4f3f55(_0x49ea09[_0x1b0b('0x11')]['message']);}})[_0x1b0b('0x12')](function(_0x5c1fa4){logger['error'](_0x1b0b('0xa'),_0x25a375,_0x5c1fa4);_0x321de1(_0x5c1fa4);});});} \ No newline at end of file +var _0xeb80=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b5cbb,_0x49b507){var _0x2e5080=function(_0x241491){while(--_0x241491){_0x4b5cbb['push'](_0x4b5cbb['shift']());}};_0x2e5080(++_0x49b507);}(_0xeb80,0x126));var _0x0eb8=function(_0x5c853a,_0x5d5b93){_0x5c853a=_0x5c853a-0x0;var _0x2ddd5b=_0xeb80[_0x5c853a];return _0x2ddd5b;};'use strict';var _=require(_0x0eb8('0x0'));var util=require(_0x0eb8('0x1'));var moment=require(_0x0eb8('0x2'));var BPromise=require(_0x0eb8('0x3'));var rs=require(_0x0eb8('0x4'));var fs=require('fs');var Redis=require(_0x0eb8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0eb8('0x6'));var logger=require(_0x0eb8('0x7'))(_0x0eb8('0x8'));var config=require(_0x0eb8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0eb8('0xa')][_0x0eb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b7e79,_0x21f792,_0x169cb5){return new BPromise(function(_0x202f76,_0x2579aa){return client[_0x0eb8('0xc')](_0x1b7e79,_0x169cb5)[_0x0eb8('0xd')](function(_0x513db0){logger['info'](_0x0eb8('0xe'),_0x21f792,_0x0eb8('0xf'));logger[_0x0eb8('0x10')](_0x0eb8('0x11'),_0x21f792,'request\x20sent',JSON[_0x0eb8('0x12')](_0x513db0));if(_0x513db0[_0x0eb8('0x13')]){if(_0x513db0[_0x0eb8('0x13')][_0x0eb8('0x14')]===0x1f4){logger[_0x0eb8('0x13')](_0x0eb8('0xe'),_0x21f792,_0x513db0[_0x0eb8('0x13')][_0x0eb8('0x15')]);return _0x2579aa(_0x513db0[_0x0eb8('0x13')][_0x0eb8('0x15')]);}logger[_0x0eb8('0x13')](_0x0eb8('0xe'),_0x21f792,_0x513db0[_0x0eb8('0x13')][_0x0eb8('0x15')]);return _0x202f76(_0x513db0['error'][_0x0eb8('0x15')]);}else{logger[_0x0eb8('0x16')]('AnalyticMetric,\x20%s,\x20%s',_0x21f792,'request\x20sent');_0x202f76(_0x513db0[_0x0eb8('0x17')][_0x0eb8('0x15')]);}})[_0x0eb8('0x18')](function(_0x38c196){logger[_0x0eb8('0x13')](_0x0eb8('0xe'),_0x21f792,_0x38c196);_0x2579aa(_0x38c196);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 6e7ed9c..3b0796d 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x4576b7,_0x50057b){var _0x3a81e0=function(_0x5e2814){while(--_0x5e2814){_0x4576b7['push'](_0x4576b7['shift']());}};_0x3a81e0(++_0x50057b);}(_0x524e,0x15e));var _0xe524=function(_0x39c44f,_0x86436e){_0x39c44f=_0x39c44f-0x0;var _0x3171d0=_0x524e[_0x39c44f];return _0x3171d0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x5de411,_0x11e44b){var _0xf88454=function(_0x16ca91){while(--_0x16ca91){_0x5de411['push'](_0x5de411['shift']());}};_0xf88454(++_0x11e44b);}(_0x187d,0x93));var _0xd187=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x187d[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index b90d6d7..077d0c3 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 _0x3db5=['exports','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3db5,0x169));var _0x53db=function(_0x238830,_0x545f75){_0x238830=_0x238830-0x0;var _0x5917f0=_0x3db5[_0x238830];return _0x5917f0;};'use strict';var Sequelize=require(_0x53db('0x0'));module[_0x53db('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xdc92=['sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc92,0x1f0));var _0x2dc9=function(_0x9db5d3,_0x4eea5e){_0x9db5d3=_0x9db5d3-0x0;var _0x477a81=_0xdc92[_0x9db5d3];return _0x477a81;};'use strict';var Sequelize=require(_0x2dc9('0x0'));module[_0x2dc9('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 520f94b..cf15e82 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 _0x9853=['where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','AnalyticTreeReport','findAll','then','rows','show','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','destroy','error','stack','name','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x2e52f2,_0x2e6a44){var _0x31a07c=function(_0x2afb8e){while(--_0x2afb8e){_0x2e52f2['push'](_0x2e52f2['shift']());}};_0x31a07c(++_0x2e6a44);}(_0x9853,0x1bd));var _0x3985=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x9853[_0x34bf97];return _0x292719;};'use strict';var pdf=require(_0x3985('0x0'));var emlformat=require(_0x3985('0x1'));var rimraf=require(_0x3985('0x2'));var zipdir=require(_0x3985('0x3'));var jsonpatch=require(_0x3985('0x4'));var rp=require(_0x3985('0x5'));var moment=require('moment');var BPromise=require(_0x3985('0x6'));var Mustache=require(_0x3985('0x7'));var util=require(_0x3985('0x8'));var path=require(_0x3985('0x9'));var sox=require(_0x3985('0xa'));var csv=require(_0x3985('0xb'));var ejs=require(_0x3985('0xc'));var fs=require('fs');var _=require(_0x3985('0xd'));var squel=require(_0x3985('0xe'));var crypto=require(_0x3985('0xf'));var jsforce=require(_0x3985('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3985('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3985('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3985('0x13'));var logger=require('../../config/logger')(_0x3985('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa830b2,_0x27c06b){_0x27c06b=_0x27c06b||0xcc;return function(_0x1639a7){if(_0x1639a7){return _0xa830b2[_0x3985('0x15')](_0x27c06b);}return _0xa830b2[_0x3985('0x16')](_0x27c06b)[_0x3985('0x17')]();};}function respondWithResult(_0x249242,_0x34d594){_0x34d594=_0x34d594||0xc8;return function(_0x526b9e){if(_0x526b9e){return _0x249242[_0x3985('0x16')](_0x34d594)[_0x3985('0x18')](_0x526b9e);}};}function respondWithFilteredResult(_0xfce98e,_0x579b2b){return function(_0x737a9d){if(_0x737a9d){var _0x30584c=_0x737a9d[_0x3985('0x19')],_0x5bae98=_0x579b2b[_0x3985('0x1a')],_0x2a7e0a=_0x579b2b[_0x3985('0x1a')]+_0x579b2b['limit'],_0x1941b1;if(_0x2a7e0a>=_0x30584c){_0x2a7e0a=_0x30584c;_0x1941b1=0xc8;}else{_0x1941b1=0xce;}_0xfce98e[_0x3985('0x16')](_0x1941b1);return _0xfce98e[_0x3985('0x1b')](_0x3985('0x1c'),_0x5bae98+'-'+_0x2a7e0a+'/'+_0x30584c)[_0x3985('0x18')](_0x737a9d);}return null;};}function patchUpdates(_0x365c65){return function(_0x57a482){try{jsonpatch[_0x3985('0x1d')](_0x57a482,_0x365c65,!![]);}catch(_0x251ef0){return BPromise['reject'](_0x251ef0);}return _0x57a482['save']();};}function saveUpdates(_0x4fa1ac,_0x310fed){return function(_0x3c88c0){if(_0x3c88c0){return _0x3c88c0[_0x3985('0x1e')](_0x4fa1ac)['then'](function(_0x162d7d){return _0x162d7d;});}return null;};}function removeEntity(_0xc6bb46,_0x1e5f12){return function(_0x549458){if(_0x549458){return _0x549458[_0x3985('0x1f')]()['then'](function(){_0xc6bb46[_0x3985('0x16')](0xcc)[_0x3985('0x17')]();});}};}function handleEntityNotFound(_0xe99f38,_0x4b9bab){return function(_0x2ec546){if(!_0x2ec546){_0xe99f38[_0x3985('0x15')](0x194);}return _0x2ec546;};}function handleError(_0x4baf95,_0x2d8a64){_0x2d8a64=_0x2d8a64||0x1f4;return function(_0x5f3055){logger[_0x3985('0x20')](_0x5f3055[_0x3985('0x21')]);if(_0x5f3055[_0x3985('0x22')]){delete _0x5f3055[_0x3985('0x22')];}_0x4baf95[_0x3985('0x16')](_0x2d8a64)['send'](_0x5f3055);};}exports['index']=function(_0x20b48c,_0xa41964){var _0x58e3e6={},_0xbb5a4a={},_0x3f6671={'count':0x0,'rows':[]};var _0x6a197=_['map'](db['AnalyticTreeReport'][_0x3985('0x23')],function(_0x511fd3){return{'name':_0x511fd3[_0x3985('0x24')],'type':_0x511fd3['type'][_0x3985('0x25')]};});_0xbb5a4a[_0x3985('0x26')]=_[_0x3985('0x27')](_0x6a197,_0x3985('0x22'));_0xbb5a4a[_0x3985('0x28')]=_[_0x3985('0x29')](_0x20b48c[_0x3985('0x28')]);_0xbb5a4a[_0x3985('0x2a')]=_['intersection'](_0xbb5a4a[_0x3985('0x26')],_0xbb5a4a[_0x3985('0x28')]);_0x58e3e6[_0x3985('0x2b')]=_[_0x3985('0x2c')](_0xbb5a4a[_0x3985('0x26')],qs[_0x3985('0x2d')](_0x20b48c[_0x3985('0x28')][_0x3985('0x2d')]));_0x58e3e6['attributes']=_0x58e3e6[_0x3985('0x2b')][_0x3985('0x2e')]?_0x58e3e6[_0x3985('0x2b')]:_0xbb5a4a['model'];if(!_0x20b48c[_0x3985('0x28')][_0x3985('0x2f')](_0x3985('0x30'))){_0x58e3e6[_0x3985('0x31')]=qs[_0x3985('0x31')](_0x20b48c[_0x3985('0x28')][_0x3985('0x31')]);_0x58e3e6[_0x3985('0x1a')]=qs['offset'](_0x20b48c[_0x3985('0x28')][_0x3985('0x1a')]);}_0x58e3e6[_0x3985('0x32')]=qs['sort'](_0x20b48c[_0x3985('0x28')][_0x3985('0x33')]);_0x58e3e6[_0x3985('0x34')]=qs[_0x3985('0x2a')](_[_0x3985('0x35')](_0x20b48c[_0x3985('0x28')],_0xbb5a4a[_0x3985('0x2a')]),_0x6a197);if(_0x20b48c[_0x3985('0x28')][_0x3985('0x36')]){_0x58e3e6[_0x3985('0x34')]=_['merge'](_0x58e3e6[_0x3985('0x34')],{'$or':_[_0x3985('0x27')](_0x6a197,function(_0x217b1f){if(_0x217b1f[_0x3985('0x37')]!==_0x3985('0x38')){var _0x378df6={};_0x378df6[_0x217b1f['name']]={'$like':'%'+_0x20b48c[_0x3985('0x28')][_0x3985('0x36')]+'%'};return _0x378df6;}})});}_0x58e3e6=_[_0x3985('0x39')]({},_0x58e3e6,_0x20b48c[_0x3985('0x3a')]);var _0x2e2789={'where':_0x58e3e6[_0x3985('0x34')]};return db['AnalyticTreeReport'][_0x3985('0x19')](_0x2e2789)['then'](function(_0x6b58ce){_0x3f6671[_0x3985('0x19')]=_0x6b58ce;if(_0x20b48c['query'][_0x3985('0x3b')]){_0x58e3e6[_0x3985('0x3c')]=[{'all':!![]}];}return db[_0x3985('0x3d')][_0x3985('0x3e')](_0x58e3e6);})[_0x3985('0x3f')](function(_0x223b62){_0x3f6671[_0x3985('0x40')]=_0x223b62;return _0x3f6671;})['then'](respondWithFilteredResult(_0xa41964,_0x58e3e6))['catch'](handleError(_0xa41964,null));};exports[_0x3985('0x41')]=function(_0x344ef9,_0x40b0a1){var _0x47f20d={'raw':!![],'where':{'id':_0x344ef9['params']['id']}},_0x71ec40={};_0x71ec40[_0x3985('0x26')]=_['keys'](db[_0x3985('0x3d')]['rawAttributes']);_0x71ec40[_0x3985('0x28')]=_['keys'](_0x344ef9[_0x3985('0x28')]);_0x71ec40[_0x3985('0x2a')]=_['intersection'](_0x71ec40[_0x3985('0x26')],_0x71ec40['query']);_0x47f20d[_0x3985('0x2b')]=_[_0x3985('0x2c')](_0x71ec40[_0x3985('0x26')],qs[_0x3985('0x2d')](_0x344ef9['query']['fields']));_0x47f20d[_0x3985('0x2b')]=_0x47f20d[_0x3985('0x2b')][_0x3985('0x2e')]?_0x47f20d[_0x3985('0x2b')]:_0x71ec40[_0x3985('0x26')];if(_0x344ef9[_0x3985('0x28')][_0x3985('0x3b')]){_0x47f20d[_0x3985('0x3c')]=[{'all':!![]}];}_0x47f20d=_[_0x3985('0x39')]({},_0x47f20d,_0x344ef9[_0x3985('0x3a')]);return db[_0x3985('0x3d')][_0x3985('0x42')](_0x47f20d)[_0x3985('0x3f')](handleEntityNotFound(_0x40b0a1,null))['then'](respondWithResult(_0x40b0a1,null))[_0x3985('0x43')](handleError(_0x40b0a1,null));};exports[_0x3985('0x44')]=function(_0x32cd6f,_0x1de2af){return db[_0x3985('0x3d')][_0x3985('0x44')](_0x32cd6f[_0x3985('0x45')],{})['then'](respondWithResult(_0x1de2af,0xc9))[_0x3985('0x43')](handleError(_0x1de2af,null));};exports['update']=function(_0x3295f3,_0x2a8a40){if(_0x3295f3[_0x3985('0x45')]['id']){delete _0x3295f3[_0x3985('0x45')]['id'];}return db[_0x3985('0x3d')][_0x3985('0x42')]({'where':{'id':_0x3295f3['params']['id']}})[_0x3985('0x3f')](handleEntityNotFound(_0x2a8a40,null))[_0x3985('0x3f')](saveUpdates(_0x3295f3[_0x3985('0x45')],null))[_0x3985('0x3f')](respondWithResult(_0x2a8a40,null))[_0x3985('0x43')](handleError(_0x2a8a40,null));};exports[_0x3985('0x1f')]=function(_0xc9b989,_0x3aed6b){return db['AnalyticTreeReport'][_0x3985('0x42')]({'where':{'id':_0xc9b989[_0x3985('0x46')]['id']}})[_0x3985('0x3f')](handleEntityNotFound(_0x3aed6b,null))[_0x3985('0x3f')](removeEntity(_0x3aed6b,null))[_0x3985('0x43')](handleError(_0x3aed6b,null));}; \ No newline at end of file +var _0x32b5=['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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','Content-Range','apply','reject','save','update','then','end','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','filters','filter','merge','VIRTUAL','AnalyticTreeReport','count','includeAll','include','findAll','rows','show','params','options','find','create','catch','body','destroy'];(function(_0x273b54,_0x41c1ef){var _0x95905c=function(_0x3d3343){while(--_0x3d3343){_0x273b54['push'](_0x273b54['shift']());}};_0x95905c(++_0x41c1ef);}(_0x32b5,0x130));var _0x532b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x32b5[_0x110c3d];return _0x226d67;};'use strict';var pdf=require(_0x532b('0x0'));var emlformat=require(_0x532b('0x1'));var rimraf=require(_0x532b('0x2'));var zipdir=require(_0x532b('0x3'));var jsonpatch=require(_0x532b('0x4'));var rp=require(_0x532b('0x5'));var moment=require('moment');var BPromise=require(_0x532b('0x6'));var Mustache=require(_0x532b('0x7'));var util=require(_0x532b('0x8'));var path=require(_0x532b('0x9'));var sox=require(_0x532b('0xa'));var csv=require(_0x532b('0xb'));var ejs=require(_0x532b('0xc'));var fs=require('fs');var _=require(_0x532b('0xd'));var squel=require(_0x532b('0xe'));var crypto=require(_0x532b('0xf'));var jsforce=require(_0x532b('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x532b('0x11'));var Papa=require('papaparse');var Redis=require(_0x532b('0x12'));var authService=require(_0x532b('0x13'));var qs=require(_0x532b('0x14'));var as=require(_0x532b('0x15'));var hardwareService=require(_0x532b('0x16'));var logger=require(_0x532b('0x17'))(_0x532b('0x18'));var utils=require(_0x532b('0x19'));var config=require(_0x532b('0x1a'));var db=require(_0x532b('0x1b'))['db'];function respondWithStatusCode(_0x6a7545,_0x5489d8){_0x5489d8=_0x5489d8||0xcc;return function(_0x167706){if(_0x167706){return _0x6a7545[_0x532b('0x1c')](_0x5489d8);}return _0x6a7545[_0x532b('0x1d')](_0x5489d8)['end']();};}function respondWithResult(_0x1356ef,_0x4b7b4a){_0x4b7b4a=_0x4b7b4a||0xc8;return function(_0x16188e){if(_0x16188e){return _0x1356ef[_0x532b('0x1d')](_0x4b7b4a)[_0x532b('0x1e')](_0x16188e);}};}function respondWithFilteredResult(_0x20b254,_0x3cb477){return function(_0x4c68ca){if(_0x4c68ca){var _0xa2e195=_0x4c68ca['count'],_0x285a23=_0x3cb477['offset'],_0x42f776=_0x3cb477['offset']+_0x3cb477[_0x532b('0x1f')],_0x305dd6;if(_0x42f776>=_0xa2e195){_0x42f776=_0xa2e195;_0x305dd6=0xc8;}else{_0x305dd6=0xce;}_0x20b254[_0x532b('0x1d')](_0x305dd6);return _0x20b254['set'](_0x532b('0x20'),_0x285a23+'-'+_0x42f776+'/'+_0xa2e195)['json'](_0x4c68ca);}return null;};}function patchUpdates(_0x324068){return function(_0x275277){try{jsonpatch[_0x532b('0x21')](_0x275277,_0x324068,!![]);}catch(_0x3e8707){return BPromise[_0x532b('0x22')](_0x3e8707);}return _0x275277[_0x532b('0x23')]();};}function saveUpdates(_0x3aa9d4,_0x2c37c2){return function(_0x48a864){if(_0x48a864){return _0x48a864[_0x532b('0x24')](_0x3aa9d4)['then'](function(_0x209d17){return _0x209d17;});}return null;};}function removeEntity(_0xa873c5,_0x3f290c){return function(_0x3f49b1){if(_0x3f49b1){return _0x3f49b1['destroy']()[_0x532b('0x25')](function(){_0xa873c5[_0x532b('0x1d')](0xcc)[_0x532b('0x26')]();});}};}function handleEntityNotFound(_0x5edcf2,_0x4722b6){return function(_0x8957a){if(!_0x8957a){_0x5edcf2[_0x532b('0x1c')](0x194);}return _0x8957a;};}function handleError(_0x5882be,_0x25380c){_0x25380c=_0x25380c||0x1f4;return function(_0x154188){logger['error'](_0x154188['stack']);if(_0x154188[_0x532b('0x27')]){delete _0x154188[_0x532b('0x27')];}_0x5882be[_0x532b('0x1d')](_0x25380c)[_0x532b('0x28')](_0x154188);};}exports['index']=function(_0x1d2446,_0x54c8c0){var _0x4b4cd3={},_0x3f8bc6={},_0x2d8193={'count':0x0,'rows':[]};var _0x184d80=_[_0x532b('0x29')](db['AnalyticTreeReport'][_0x532b('0x2a')],function(_0x3cbffd){return{'name':_0x3cbffd[_0x532b('0x2b')],'type':_0x3cbffd[_0x532b('0x2c')][_0x532b('0x2d')]};});_0x3f8bc6[_0x532b('0x2e')]=_[_0x532b('0x29')](_0x184d80,_0x532b('0x27'));_0x3f8bc6['query']=_[_0x532b('0x2f')](_0x1d2446[_0x532b('0x30')]);_0x3f8bc6['filters']=_[_0x532b('0x31')](_0x3f8bc6[_0x532b('0x2e')],_0x3f8bc6[_0x532b('0x30')]);_0x4b4cd3['attributes']=_[_0x532b('0x31')](_0x3f8bc6[_0x532b('0x2e')],qs[_0x532b('0x32')](_0x1d2446[_0x532b('0x30')][_0x532b('0x32')]));_0x4b4cd3[_0x532b('0x33')]=_0x4b4cd3[_0x532b('0x33')][_0x532b('0x34')]?_0x4b4cd3[_0x532b('0x33')]:_0x3f8bc6['model'];if(!_0x1d2446[_0x532b('0x30')][_0x532b('0x35')]('nolimit')){_0x4b4cd3['limit']=qs['limit'](_0x1d2446['query'][_0x532b('0x1f')]);_0x4b4cd3[_0x532b('0x36')]=qs[_0x532b('0x36')](_0x1d2446[_0x532b('0x30')][_0x532b('0x36')]);}_0x4b4cd3[_0x532b('0x37')]=qs['sort'](_0x1d2446[_0x532b('0x30')][_0x532b('0x38')]);_0x4b4cd3[_0x532b('0x39')]=qs[_0x532b('0x3a')](_['pick'](_0x1d2446['query'],_0x3f8bc6[_0x532b('0x3a')]),_0x184d80);if(_0x1d2446[_0x532b('0x30')][_0x532b('0x3b')]){_0x4b4cd3[_0x532b('0x39')]=_[_0x532b('0x3c')](_0x4b4cd3['where'],{'$or':_[_0x532b('0x29')](_0x184d80,function(_0xb8c3d){if(_0xb8c3d['type']!==_0x532b('0x3d')){var _0x1049eb={};_0x1049eb[_0xb8c3d['name']]={'$like':'%'+_0x1d2446['query'][_0x532b('0x3b')]+'%'};return _0x1049eb;}})});}_0x4b4cd3=_['merge']({},_0x4b4cd3,_0x1d2446['options']);var _0x2c5d53={'where':_0x4b4cd3[_0x532b('0x39')]};return db[_0x532b('0x3e')][_0x532b('0x3f')](_0x2c5d53)[_0x532b('0x25')](function(_0x39b053){_0x2d8193[_0x532b('0x3f')]=_0x39b053;if(_0x1d2446[_0x532b('0x30')][_0x532b('0x40')]){_0x4b4cd3[_0x532b('0x41')]=[{'all':!![]}];}return db[_0x532b('0x3e')][_0x532b('0x42')](_0x4b4cd3);})[_0x532b('0x25')](function(_0x476a65){_0x2d8193[_0x532b('0x43')]=_0x476a65;return _0x2d8193;})[_0x532b('0x25')](respondWithFilteredResult(_0x54c8c0,_0x4b4cd3))['catch'](handleError(_0x54c8c0,null));};exports[_0x532b('0x44')]=function(_0x278ce2,_0x3ffbc6){var _0xd2c4a9={'raw':!![],'where':{'id':_0x278ce2[_0x532b('0x45')]['id']}},_0x5255c7={};_0x5255c7['model']=_[_0x532b('0x2f')](db[_0x532b('0x3e')][_0x532b('0x2a')]);_0x5255c7[_0x532b('0x30')]=_[_0x532b('0x2f')](_0x278ce2[_0x532b('0x30')]);_0x5255c7[_0x532b('0x3a')]=_[_0x532b('0x31')](_0x5255c7[_0x532b('0x2e')],_0x5255c7[_0x532b('0x30')]);_0xd2c4a9['attributes']=_[_0x532b('0x31')](_0x5255c7['model'],qs['fields'](_0x278ce2['query']['fields']));_0xd2c4a9['attributes']=_0xd2c4a9[_0x532b('0x33')][_0x532b('0x34')]?_0xd2c4a9['attributes']:_0x5255c7[_0x532b('0x2e')];if(_0x278ce2[_0x532b('0x30')][_0x532b('0x40')]){_0xd2c4a9[_0x532b('0x41')]=[{'all':!![]}];}_0xd2c4a9=_[_0x532b('0x3c')]({},_0xd2c4a9,_0x278ce2[_0x532b('0x46')]);return db[_0x532b('0x3e')][_0x532b('0x47')](_0xd2c4a9)[_0x532b('0x25')](handleEntityNotFound(_0x3ffbc6,null))[_0x532b('0x25')](respondWithResult(_0x3ffbc6,null))['catch'](handleError(_0x3ffbc6,null));};exports[_0x532b('0x48')]=function(_0x4dd254,_0x4cb9c2){return db['AnalyticTreeReport'][_0x532b('0x48')](_0x4dd254['body'],{})[_0x532b('0x25')](respondWithResult(_0x4cb9c2,0xc9))[_0x532b('0x49')](handleError(_0x4cb9c2,null));};exports[_0x532b('0x24')]=function(_0xa95b7a,_0x228b35){if(_0xa95b7a[_0x532b('0x4a')]['id']){delete _0xa95b7a[_0x532b('0x4a')]['id'];}return db[_0x532b('0x3e')][_0x532b('0x47')]({'where':{'id':_0xa95b7a[_0x532b('0x45')]['id']}})[_0x532b('0x25')](handleEntityNotFound(_0x228b35,null))[_0x532b('0x25')](saveUpdates(_0xa95b7a[_0x532b('0x4a')],null))[_0x532b('0x25')](respondWithResult(_0x228b35,null))[_0x532b('0x49')](handleError(_0x228b35,null));};exports[_0x532b('0x4b')]=function(_0x248998,_0x26159c){return db['AnalyticTreeReport']['find']({'where':{'id':_0x248998['params']['id']}})[_0x532b('0x25')](handleEntityNotFound(_0x26159c,null))[_0x532b('0x25')](removeEntity(_0x26159c,null))[_0x532b('0x49')](handleError(_0x26159c,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8553ee4..e53b4b8 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 _0xe6cf=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x305df3,_0xc7e3b3){var _0x56a898=function(_0x3a2d78){while(--_0x3a2d78){_0x305df3['push'](_0x305df3['shift']());}};_0x56a898(++_0xc7e3b3);}(_0xe6cf,0x98));var _0xfe6c=function(_0x4af0a7,_0x49afdd){_0x4af0a7=_0x4af0a7-0x0;var _0x2d7cc9=_0xe6cf[_0x4af0a7];return _0x2d7cc9;};'use strict';var _=require(_0xfe6c('0x0'));var util=require(_0xfe6c('0x1'));var logger=require(_0xfe6c('0x2'))(_0xfe6c('0x3'));var moment=require(_0xfe6c('0x4'));var BPromise=require(_0xfe6c('0x5'));var rp=require(_0xfe6c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe6c('0x7'));var config=require(_0xfe6c('0x8'));var attributes=require(_0xfe6c('0x9'));module[_0xfe6c('0xa')]=function(_0x292891,_0x1ef7e2){return _0x292891[_0xfe6c('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0xfe6c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc756=['lodash','api','moment','bluebird','request-promise','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x3c7d67,_0x146fb5){var _0x190570=function(_0x4bb172){while(--_0x4bb172){_0x3c7d67['push'](_0x3c7d67['shift']());}};_0x190570(++_0x146fb5);}(_0xc756,0x1cc));var _0x6c75=function(_0x2be021,_0x4db39e){_0x2be021=_0x2be021-0x0;var _0x18763e=_0xc756[_0x2be021];return _0x18763e;};'use strict';var _=require(_0x6c75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6c75('0x1'));var moment=require(_0x6c75('0x2'));var BPromise=require(_0x6c75('0x3'));var rp=require(_0x6c75('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c75('0x5'));module[_0x6c75('0x6')]=function(_0x51c885,_0x5c44de){return _0x51c885[_0x6c75('0x7')](_0x6c75('0x8'),attributes,{'tableName':_0x6c75('0x9'),'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 e0abaf8..ed5e921 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 _0xc29c=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x40395f,_0x1555a7){var _0x1384a7=function(_0x3c0345){while(--_0x3c0345){_0x40395f['push'](_0x40395f['shift']());}};_0x1384a7(++_0x1555a7);}(_0xc29c,0x129));var _0xcc29=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xc29c[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require(_0xcc29('0x0'));var util=require(_0xcc29('0x1'));var moment=require(_0xcc29('0x2'));var BPromise=require(_0xcc29('0x3'));var rs=require(_0xcc29('0x4'));var fs=require('fs');var Redis=require(_0xcc29('0x5'));var db=require(_0xcc29('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc29('0x7'));var config=require(_0xcc29('0x8'));var jayson=require(_0xcc29('0x9'));var client=jayson[_0xcc29('0xa')][_0xcc29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cd118,_0x5352a3,_0x5a21c5){return new BPromise(function(_0x4a9a0d,_0xa7231b){return client[_0xcc29('0xc')](_0x2cd118,_0x5a21c5)[_0xcc29('0xd')](function(_0x43ea24){logger[_0xcc29('0xe')](_0xcc29('0xf'),_0x5352a3,_0xcc29('0x10'));logger[_0xcc29('0x11')](_0xcc29('0x12'),_0x5352a3,_0xcc29('0x10'),JSON[_0xcc29('0x13')](_0x43ea24));if(_0x43ea24[_0xcc29('0x14')]){if(_0x43ea24['error'][_0xcc29('0x15')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x5352a3,_0x43ea24[_0xcc29('0x14')][_0xcc29('0x16')]);return _0xa7231b(_0x43ea24[_0xcc29('0x14')][_0xcc29('0x16')]);}logger[_0xcc29('0x14')](_0xcc29('0xf'),_0x5352a3,_0x43ea24[_0xcc29('0x14')]['message']);return _0x4a9a0d(_0x43ea24[_0xcc29('0x14')]['message']);}else{logger[_0xcc29('0xe')](_0xcc29('0xf'),_0x5352a3,_0xcc29('0x10'));_0x4a9a0d(_0x43ea24[_0xcc29('0x17')][_0xcc29('0x16')]);}})[_0xcc29('0x18')](function(_0x28efb8){logger[_0xcc29('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x5352a3,_0x28efb8);_0xa7231b(_0x28efb8);});});} \ No newline at end of file +var _0xfa63=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','AnalyticTreeReport,\x20%s,\x20%s','message','util','moment','randomstring','ioredis'];(function(_0x43cc12,_0x4c9039){var _0x54c308=function(_0x53aeef){while(--_0x53aeef){_0x43cc12['push'](_0x43cc12['shift']());}};_0x54c308(++_0x4c9039);}(_0xfa63,0x1e9));var _0x3fa6=function(_0x1acc60,_0x356178){_0x1acc60=_0x1acc60-0x0;var _0x429ffc=_0xfa63[_0x1acc60];return _0x429ffc;};'use strict';var _=require('lodash');var util=require(_0x3fa6('0x0'));var moment=require(_0x3fa6('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fa6('0x2'));var fs=require('fs');var Redis=require(_0x3fa6('0x3'));var db=require(_0x3fa6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fa6('0x5'))(_0x3fa6('0x6'));var config=require('../../config/environment');var jayson=require(_0x3fa6('0x7'));var client=jayson[_0x3fa6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c1f0f,_0x446e04,_0x29b4ad){return new BPromise(function(_0x20d04e,_0x3b50ff){return client['request'](_0x3c1f0f,_0x29b4ad)[_0x3fa6('0x9')](function(_0x1bac19){logger[_0x3fa6('0xa')]('AnalyticTreeReport,\x20%s,\x20%s',_0x446e04,_0x3fa6('0xb'));logger[_0x3fa6('0xc')](_0x3fa6('0xd'),_0x446e04,'request\x20sent',JSON['stringify'](_0x1bac19));if(_0x1bac19['error']){if(_0x1bac19[_0x3fa6('0xe')]['code']===0x1f4){logger['error'](_0x3fa6('0xf'),_0x446e04,_0x1bac19[_0x3fa6('0xe')]['message']);return _0x3b50ff(_0x1bac19[_0x3fa6('0xe')][_0x3fa6('0x10')]);}logger[_0x3fa6('0xe')](_0x3fa6('0xf'),_0x446e04,_0x1bac19['error'][_0x3fa6('0x10')]);return _0x20d04e(_0x1bac19[_0x3fa6('0xe')][_0x3fa6('0x10')]);}else{logger[_0x3fa6('0xa')]('AnalyticTreeReport,\x20%s,\x20%s',_0x446e04,'request\x20sent');_0x20d04e(_0x1bac19['result'][_0x3fa6('0x10')]);}})['catch'](function(_0x104075){logger[_0x3fa6('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x446e04,_0x104075);_0x3b50ff(_0x104075);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 00720e0..9c7563d 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 _0x166e=['get','index','/:id','post','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d6d1b,_0xbcbacc){var _0x117160=function(_0x3a8b81){while(--_0x3a8b81){_0x5d6d1b['push'](_0x5d6d1b['shift']());}};_0x117160(++_0xbcbacc);}(_0x166e,0xd0));var _0xe166=function(_0x389d91,_0x3113d2){_0x389d91=_0x389d91-0x0;var _0x5e2e89=_0x166e[_0x389d91];return _0x5e2e89;};'use strict';var multer=require(_0xe166('0x0'));var util=require(_0xe166('0x1'));var path=require(_0xe166('0x2'));var timeout=require('connect-timeout');var express=require(_0xe166('0x3'));var router=express[_0xe166('0x4')]();var auth=require(_0xe166('0x5'));var interaction=require(_0xe166('0x6'));var config=require(_0xe166('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xe166('0x8')]('/',auth['isAuthenticated'](),controller[_0xe166('0x9')]);router[_0xe166('0x8')](_0xe166('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xe166('0xb')]('/',auth[_0xe166('0xc')](),controller[_0xe166('0xd')]);router['put'](_0xe166('0xa'),auth[_0xe166('0xc')](),controller[_0xe166('0xe')]);router[_0xe166('0xf')](_0xe166('0xa'),auth[_0xe166('0xc')](),controller[_0xe166('0x10')]);module[_0xe166('0x11')]=router; \ No newline at end of file +var _0xbcc2=['/:id','isAuthenticated','show','post','create','put','update','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x13f78a,_0x6b002f){var _0x48f494=function(_0x100b86){while(--_0x100b86){_0x13f78a['push'](_0x13f78a['shift']());}};_0x48f494(++_0x6b002f);}(_0xbcc2,0xd8));var _0x2bcc=function(_0x5c611c,_0x56a7f9){_0x5c611c=_0x5c611c-0x0;var _0x480866=_0xbcc2[_0x5c611c];return _0x480866;};'use strict';var multer=require(_0x2bcc('0x0'));var util=require('util');var path=require(_0x2bcc('0x1'));var timeout=require(_0x2bcc('0x2'));var express=require('express');var router=express[_0x2bcc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2bcc('0x4'));var config=require(_0x2bcc('0x5'));var controller=require(_0x2bcc('0x6'));router[_0x2bcc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2bcc('0x7')](_0x2bcc('0x8'),auth[_0x2bcc('0x9')](),controller[_0x2bcc('0xa')]);router[_0x2bcc('0xb')]('/',auth[_0x2bcc('0x9')](),controller[_0x2bcc('0xc')]);router[_0x2bcc('0xd')](_0x2bcc('0x8'),auth['isAuthenticated'](),controller[_0x2bcc('0xe')]);router['delete']('/:id',auth[_0x2bcc('0x9')](),controller['destroy']);module[_0x2bcc('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 7f42619..1d489cd 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 _0xafbb=['STRING','sequelize','exports'];(function(_0x127984,_0x545b6f){var _0x22afa6=function(_0x3b0253){while(--_0x3b0253){_0x127984['push'](_0x127984['shift']());}};_0x22afa6(++_0x545b6f);}(_0xafbb,0x121));var _0xbafb=function(_0x24b652,_0x58d64c){_0x24b652=_0x24b652-0x0;var _0x2e3760=_0xafbb[_0x24b652];return _0x2e3760;};'use strict';var Sequelize=require(_0xbafb('0x0'));module[_0xbafb('0x1')]={'name':{'type':Sequelize[_0xbafb('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbafb('0x2')]}}; \ No newline at end of file +var _0x0564=['STRING','sequelize'];(function(_0x4c70a1,_0x38d5a0){var _0x58091d=function(_0x14e002){while(--_0x14e002){_0x4c70a1['push'](_0x4c70a1['shift']());}};_0x58091d(++_0x38d5a0);}(_0x0564,0xaf));var _0x4056=function(_0x56816e,_0x313a1a){_0x56816e=_0x56816e-0x0;var _0x89b642=_0x0564[_0x56816e];return _0x89b642;};'use strict';var Sequelize=require(_0x4056('0x0'));module['exports']={'name':{'type':Sequelize[_0x4056('0x1')]},'basename':{'type':Sequelize[_0x4056('0x1')]},'type':{'type':Sequelize[_0x4056('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 4991aea..793741a 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 _0x275d=['query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','count','then','findAll','rows','catch','params','rawAttributes','include','find','clone','includeAll','omit','createdAt','updatedAt','create','body','file','filename','download','findOne','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','set','reject','save','update','destroy','error','stack','name','send','index','map','Attachment','fieldName','type'];(function(_0x34e0cf,_0x3e2dde){var _0x2b70d=function(_0x4c6d88){while(--_0x4c6d88){_0x34e0cf['push'](_0x34e0cf['shift']());}};_0x2b70d(++_0x3e2dde);}(_0x275d,0x167));var _0xd275=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x275d[_0x43a5c7];return _0x3b12a2;};'use strict';var pdf=require(_0xd275('0x0'));var emlformat=require(_0xd275('0x1'));var rimraf=require(_0xd275('0x2'));var zipdir=require(_0xd275('0x3'));var jsonpatch=require(_0xd275('0x4'));var rp=require('request-promise');var moment=require(_0xd275('0x5'));var BPromise=require(_0xd275('0x6'));var Mustache=require(_0xd275('0x7'));var util=require(_0xd275('0x8'));var path=require(_0xd275('0x9'));var sox=require(_0xd275('0xa'));var csv=require(_0xd275('0xb'));var ejs=require(_0xd275('0xc'));var fs=require('fs');var _=require(_0xd275('0xd'));var squel=require('squel');var crypto=require(_0xd275('0xe'));var jsforce=require(_0xd275('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd275('0xb'));var querystring=require('querystring');var Papa=require(_0xd275('0x10'));var Redis=require(_0xd275('0x11'));var authService=require(_0xd275('0x12'));var qs=require(_0xd275('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd275('0x14'));var utils=require('../../config/utils');var config=require(_0xd275('0x15'));var db=require(_0xd275('0x16'))['db'];function respondWithStatusCode(_0x52bc3f,_0x25f4a5){_0x25f4a5=_0x25f4a5||0xcc;return function(_0x4e73e6){if(_0x4e73e6){return _0x52bc3f[_0xd275('0x17')](_0x25f4a5);}return _0x52bc3f['status'](_0x25f4a5)[_0xd275('0x18')]();};}function respondWithResult(_0x6f3097,_0x2b3ac0){_0x2b3ac0=_0x2b3ac0||0xc8;return function(_0x3421d8){if(_0x3421d8){return _0x6f3097[_0xd275('0x19')](_0x2b3ac0)['json'](_0x3421d8);}};}function respondWithFilteredResult(_0x4d73ef,_0x5b86f5){return function(_0x27b3a7){if(_0x27b3a7){var _0x4f6eb7=_0x27b3a7['count'],_0x45ee94=_0x5b86f5[_0xd275('0x1a')],_0x28a9a3=_0x5b86f5[_0xd275('0x1a')]+_0x5b86f5['limit'],_0x10a73b;if(_0x28a9a3>=_0x4f6eb7){_0x28a9a3=_0x4f6eb7;_0x10a73b=0xc8;}else{_0x10a73b=0xce;}_0x4d73ef[_0xd275('0x19')](_0x10a73b);return _0x4d73ef[_0xd275('0x1b')]('Content-Range',_0x45ee94+'-'+_0x28a9a3+'/'+_0x4f6eb7)['json'](_0x27b3a7);}return null;};}function patchUpdates(_0x43efb5){return function(_0xb0f34c){try{jsonpatch['apply'](_0xb0f34c,_0x43efb5,!![]);}catch(_0x33ef2f){return BPromise[_0xd275('0x1c')](_0x33ef2f);}return _0xb0f34c[_0xd275('0x1d')]();};}function saveUpdates(_0x161ae6,_0x1c5d24){return function(_0x2873a8){if(_0x2873a8){return _0x2873a8[_0xd275('0x1e')](_0x161ae6)['then'](function(_0xeb46ed){return _0xeb46ed;});}return null;};}function removeEntity(_0x6c8221,_0x328322){return function(_0x19413f){if(_0x19413f){return _0x19413f[_0xd275('0x1f')]()['then'](function(){_0x6c8221[_0xd275('0x19')](0xcc)[_0xd275('0x18')]();});}};}function handleEntityNotFound(_0x4e6931,_0x2de9ef){return function(_0x22c2d5){if(!_0x22c2d5){_0x4e6931['sendStatus'](0x194);}return _0x22c2d5;};}function handleError(_0x3d903b,_0x58985b){_0x58985b=_0x58985b||0x1f4;return function(_0x5dd2ff){logger[_0xd275('0x20')](_0x5dd2ff[_0xd275('0x21')]);if(_0x5dd2ff[_0xd275('0x22')]){delete _0x5dd2ff['name'];}_0x3d903b[_0xd275('0x19')](_0x58985b)[_0xd275('0x23')](_0x5dd2ff);};}exports[_0xd275('0x24')]=function(_0x3a327b,_0x5a551e){var _0x58444f={},_0x4d3d59={},_0x57019b={'count':0x0,'rows':[]};var _0x28d646=_[_0xd275('0x25')](db[_0xd275('0x26')]['rawAttributes'],function(_0x12ada9){return{'name':_0x12ada9[_0xd275('0x27')],'type':_0x12ada9[_0xd275('0x28')]['key']};});_0x4d3d59['model']=_[_0xd275('0x25')](_0x28d646,_0xd275('0x22'));_0x4d3d59[_0xd275('0x29')]=_[_0xd275('0x2a')](_0x3a327b['query']);_0x4d3d59[_0xd275('0x2b')]=_[_0xd275('0x2c')](_0x4d3d59['model'],_0x4d3d59[_0xd275('0x29')]);_0x58444f[_0xd275('0x2d')]=_[_0xd275('0x2c')](_0x4d3d59[_0xd275('0x2e')],qs[_0xd275('0x2f')](_0x3a327b[_0xd275('0x29')][_0xd275('0x2f')]));_0x58444f[_0xd275('0x2d')]=_0x58444f[_0xd275('0x2d')][_0xd275('0x30')]?_0x58444f['attributes']:_0x4d3d59[_0xd275('0x2e')];if(!_0x3a327b[_0xd275('0x29')][_0xd275('0x31')](_0xd275('0x32'))){_0x58444f[_0xd275('0x33')]=qs['limit'](_0x3a327b['query'][_0xd275('0x33')]);_0x58444f[_0xd275('0x1a')]=qs[_0xd275('0x1a')](_0x3a327b[_0xd275('0x29')]['offset']);}_0x58444f['order']=qs[_0xd275('0x34')](_0x3a327b['query'][_0xd275('0x34')]);_0x58444f[_0xd275('0x35')]=qs[_0xd275('0x2b')](_[_0xd275('0x36')](_0x3a327b['query'],_0x4d3d59[_0xd275('0x2b')]),_0x28d646);if(_0x3a327b[_0xd275('0x29')][_0xd275('0x37')]){_0x58444f[_0xd275('0x35')]=_[_0xd275('0x38')](_0x58444f['where'],{'$or':_[_0xd275('0x25')](_0x28d646,function(_0x34ebee){if(_0x34ebee[_0xd275('0x28')]!=='VIRTUAL'){var _0x4c9de8={};_0x4c9de8[_0x34ebee['name']]={'$like':'%'+_0x3a327b['query'][_0xd275('0x37')]+'%'};return _0x4c9de8;}})});}_0x58444f=_[_0xd275('0x38')]({},_0x58444f,_0x3a327b[_0xd275('0x39')]);var _0x39d3af={'where':_0x58444f[_0xd275('0x35')]};return db[_0xd275('0x26')][_0xd275('0x3a')](_0x39d3af)[_0xd275('0x3b')](function(_0x263df0){_0x57019b[_0xd275('0x3a')]=_0x263df0;if(_0x3a327b[_0xd275('0x29')]['includeAll']){_0x58444f['include']=[{'all':!![]}];}return db[_0xd275('0x26')][_0xd275('0x3c')](_0x58444f);})['then'](function(_0x58584f){_0x57019b[_0xd275('0x3d')]=_0x58584f;return _0x57019b;})['then'](respondWithFilteredResult(_0x5a551e,_0x58444f))[_0xd275('0x3e')](handleError(_0x5a551e,null));};exports['show']=function(_0x44ba9f,_0x1fe54e){var _0x3c71eb={'raw':!![],'where':{'id':_0x44ba9f[_0xd275('0x3f')]['id']}},_0x515264={};_0x515264[_0xd275('0x2e')]=_[_0xd275('0x2a')](db[_0xd275('0x26')][_0xd275('0x40')]);_0x515264[_0xd275('0x29')]=_['keys'](_0x44ba9f[_0xd275('0x29')]);_0x515264[_0xd275('0x2b')]=_[_0xd275('0x2c')](_0x515264['model'],_0x515264['query']);_0x3c71eb[_0xd275('0x2d')]=_['intersection'](_0x515264[_0xd275('0x2e')],qs[_0xd275('0x2f')](_0x44ba9f['query'][_0xd275('0x2f')]));_0x3c71eb[_0xd275('0x2d')]=_0x3c71eb[_0xd275('0x2d')][_0xd275('0x30')]?_0x3c71eb[_0xd275('0x2d')]:_0x515264[_0xd275('0x2e')];if(_0x44ba9f[_0xd275('0x29')]['includeAll']){_0x3c71eb[_0xd275('0x41')]=[{'all':!![]}];}_0x3c71eb=_[_0xd275('0x38')]({},_0x3c71eb,_0x44ba9f['options']);return db[_0xd275('0x26')][_0xd275('0x42')](_0x3c71eb)['then'](handleEntityNotFound(_0x1fe54e,null))[_0xd275('0x3b')](respondWithResult(_0x1fe54e,null))['catch'](handleError(_0x1fe54e,null));};exports[_0xd275('0x43')]=function(_0x467fe4,_0x511069){var _0x5da52e={'where':{'id':_0x467fe4[_0xd275('0x3f')]['id']}},_0x172edb={};_0x172edb['model']=_[_0xd275('0x2a')](db[_0xd275('0x26')][_0xd275('0x40')]);_0x5da52e[_0xd275('0x2d')]=_[_0xd275('0x2c')](_0x172edb[_0xd275('0x2e')],qs[_0xd275('0x2f')](_0x467fe4[_0xd275('0x29')][_0xd275('0x2f')]));_0x5da52e['attributes']=_0x5da52e[_0xd275('0x2d')][_0xd275('0x30')]?_0x5da52e[_0xd275('0x2d')]:_0x172edb[_0xd275('0x2e')];if(_0x467fe4[_0xd275('0x29')][_0xd275('0x44')]){_0x5da52e[_0xd275('0x41')]=[{'all':!![]}];}_0x5da52e=_[_0xd275('0x38')]({},_0x5da52e,_0x467fe4[_0xd275('0x39')]);return db[_0xd275('0x26')]['find'](_0x5da52e)[_0xd275('0x3b')](handleEntityNotFound(_0x511069,null))['then'](function(_0x55cc7c){if(_0x55cc7c){var _0x375222=_0x55cc7c['get']({'plain':!![]});_0x375222=qs[_0xd275('0x45')](_0x375222,['id',_0xd275('0x46'),_0xd275('0x47')]);_0x467fe4['body']=_[_0xd275('0x45')](_0x467fe4['body'],['id',_0xd275('0x46'),'updatedAt']);return db[_0xd275('0x26')][_0xd275('0x48')](_[_0xd275('0x38')](_0x375222,_0x467fe4['body']),{'include':_0x467fe4['query'][_0xd275('0x44')]?[{'all':!![]}]:undefined});}})[_0xd275('0x3b')](respondWithResult(_0x511069,0xc9))[_0xd275('0x3e')](handleError(_0x511069,null));};exports[_0xd275('0x1e')]=function(_0x3b5fc2,_0x5867f1){if(_0x3b5fc2[_0xd275('0x49')]['id']){delete _0x3b5fc2[_0xd275('0x49')]['id'];}return db[_0xd275('0x26')]['find']({'where':{'id':_0x3b5fc2[_0xd275('0x3f')]['id']}})[_0xd275('0x3b')](handleEntityNotFound(_0x5867f1,null))['then'](saveUpdates(_0x3b5fc2['body'],null))[_0xd275('0x3b')](respondWithResult(_0x5867f1,null))[_0xd275('0x3e')](handleError(_0x5867f1,null));};exports[_0xd275('0x1f')]=function(_0x33bcf5,_0x725fdb){return db['Attachment']['find']({'where':{'id':_0x33bcf5[_0xd275('0x3f')]['id']}})[_0xd275('0x3b')](handleEntityNotFound(_0x725fdb,null))[_0xd275('0x3b')](removeEntity(_0x725fdb,null))[_0xd275('0x3e')](handleError(_0x725fdb,null));};exports[_0xd275('0x48')]=function(_0x268278,_0x5e4725,_0x122e35){_0x268278[_0xd275('0x49')][_0xd275('0x22')]=_0x268278[_0xd275('0x4a')]['originalname'];_0x268278[_0xd275('0x49')]['basename']=_0x268278[_0xd275('0x4a')][_0xd275('0x4b')];_0x268278['body'][_0xd275('0x28')]=_0x268278[_0xd275('0x4a')]['mimetype'];return db['Attachment'][_0xd275('0x48')](_0x268278[_0xd275('0x49')])[_0xd275('0x3b')](respondWithResult(_0x5e4725,0xc9))[_0xd275('0x3e')](handleError(_0x5e4725,null));};exports[_0xd275('0x4c')]=function(_0x23ad3e,_0x552044,_0x191686){return db[_0xd275('0x26')][_0xd275('0x4d')]({'where':{'id':_0x23ad3e[_0xd275('0x3f')]['id']},'raw':!![]})[_0xd275('0x3b')](handleEntityNotFound(_0x552044,null))[_0xd275('0x3b')](function(_0x5eb4f7){if(_0x5eb4f7){return _0x552044['download'](path[_0xd275('0x4e')](config['root'],_0xd275('0x4f'),_0x5eb4f7['basename']));}})[_0xd275('0x3e')](handleError(_0x552044,null));}; \ No newline at end of file +var _0xa179=['keys','catch','clone','find','get','omit','createdAt','updatedAt','body','create','update','file','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','Attachment','show','params'];(function(_0x202e6c,_0x56a6c9){var _0x160ed2=function(_0x36701f){while(--_0x36701f){_0x202e6c['push'](_0x202e6c['shift']());}};_0x160ed2(++_0x56a6c9);}(_0xa179,0x65));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9a17('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9a17('0x1'));var zipdir=require(_0x9a17('0x2'));var jsonpatch=require(_0x9a17('0x3'));var rp=require(_0x9a17('0x4'));var moment=require('moment');var BPromise=require(_0x9a17('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9a17('0x6'));var csv=require('to-csv');var ejs=require(_0x9a17('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a17('0x8'));var querystring=require('querystring');var Papa=require(_0x9a17('0x9'));var Redis=require(_0x9a17('0xa'));var authService=require(_0x9a17('0xb'));var qs=require(_0x9a17('0xc'));var as=require(_0x9a17('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a17('0xe'))('api');var utils=require(_0x9a17('0xf'));var config=require(_0x9a17('0x10'));var db=require(_0x9a17('0x11'))['db'];function respondWithStatusCode(_0x49a255,_0x3a8595){_0x3a8595=_0x3a8595||0xcc;return function(_0x24be21){if(_0x24be21){return _0x49a255[_0x9a17('0x12')](_0x3a8595);}return _0x49a255[_0x9a17('0x13')](_0x3a8595)[_0x9a17('0x14')]();};}function respondWithResult(_0x4d32a5,_0x110cd3){_0x110cd3=_0x110cd3||0xc8;return function(_0x16ff44){if(_0x16ff44){return _0x4d32a5[_0x9a17('0x13')](_0x110cd3)['json'](_0x16ff44);}};}function respondWithFilteredResult(_0x31c146,_0x1bb5ed){return function(_0xcfcc09){if(_0xcfcc09){var _0x2e1e33=_0xcfcc09[_0x9a17('0x15')],_0x23629b=_0x1bb5ed[_0x9a17('0x16')],_0xd35341=_0x1bb5ed[_0x9a17('0x16')]+_0x1bb5ed[_0x9a17('0x17')],_0x52e413;if(_0xd35341>=_0x2e1e33){_0xd35341=_0x2e1e33;_0x52e413=0xc8;}else{_0x52e413=0xce;}_0x31c146[_0x9a17('0x13')](_0x52e413);return _0x31c146[_0x9a17('0x18')]('Content-Range',_0x23629b+'-'+_0xd35341+'/'+_0x2e1e33)[_0x9a17('0x19')](_0xcfcc09);}return null;};}function patchUpdates(_0x48125e){return function(_0x1b1298){try{jsonpatch[_0x9a17('0x1a')](_0x1b1298,_0x48125e,!![]);}catch(_0x2591db){return BPromise[_0x9a17('0x1b')](_0x2591db);}return _0x1b1298[_0x9a17('0x1c')]();};}function saveUpdates(_0x2f5d46,_0x2d719c){return function(_0x5602c0){if(_0x5602c0){return _0x5602c0['update'](_0x2f5d46)['then'](function(_0x2e6fe5){return _0x2e6fe5;});}return null;};}function removeEntity(_0x5befe5,_0x1b4e44){return function(_0x5b03b7){if(_0x5b03b7){return _0x5b03b7[_0x9a17('0x1d')]()['then'](function(){_0x5befe5[_0x9a17('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37cbd0,_0x229f3e){return function(_0x4268d9){if(!_0x4268d9){_0x37cbd0[_0x9a17('0x12')](0x194);}return _0x4268d9;};}function handleError(_0xfd64a9,_0x568b4b){_0x568b4b=_0x568b4b||0x1f4;return function(_0x30c1fc){logger[_0x9a17('0x1e')](_0x30c1fc[_0x9a17('0x1f')]);if(_0x30c1fc[_0x9a17('0x20')]){delete _0x30c1fc[_0x9a17('0x20')];}_0xfd64a9[_0x9a17('0x13')](_0x568b4b)['send'](_0x30c1fc);};}exports[_0x9a17('0x21')]=function(_0x21e086,_0x5671a9){var _0x166302={},_0x1a2d2b={},_0x3051b5={'count':0x0,'rows':[]};var _0x681e0e=_[_0x9a17('0x22')](db['Attachment'][_0x9a17('0x23')],function(_0xc7799f){return{'name':_0xc7799f[_0x9a17('0x24')],'type':_0xc7799f[_0x9a17('0x25')][_0x9a17('0x26')]};});_0x1a2d2b['model']=_[_0x9a17('0x22')](_0x681e0e,_0x9a17('0x20'));_0x1a2d2b['query']=_['keys'](_0x21e086[_0x9a17('0x27')]);_0x1a2d2b[_0x9a17('0x28')]=_[_0x9a17('0x29')](_0x1a2d2b[_0x9a17('0x2a')],_0x1a2d2b['query']);_0x166302[_0x9a17('0x2b')]=_['intersection'](_0x1a2d2b[_0x9a17('0x2a')],qs['fields'](_0x21e086[_0x9a17('0x27')][_0x9a17('0x2c')]));_0x166302[_0x9a17('0x2b')]=_0x166302['attributes'][_0x9a17('0x2d')]?_0x166302[_0x9a17('0x2b')]:_0x1a2d2b[_0x9a17('0x2a')];if(!_0x21e086['query'][_0x9a17('0x2e')](_0x9a17('0x2f'))){_0x166302[_0x9a17('0x17')]=qs[_0x9a17('0x17')](_0x21e086['query'][_0x9a17('0x17')]);_0x166302[_0x9a17('0x16')]=qs['offset'](_0x21e086[_0x9a17('0x27')][_0x9a17('0x16')]);}_0x166302['order']=qs[_0x9a17('0x30')](_0x21e086['query']['sort']);_0x166302[_0x9a17('0x31')]=qs[_0x9a17('0x28')](_[_0x9a17('0x32')](_0x21e086[_0x9a17('0x27')],_0x1a2d2b[_0x9a17('0x28')]),_0x681e0e);if(_0x21e086['query'][_0x9a17('0x33')]){_0x166302[_0x9a17('0x31')]=_[_0x9a17('0x34')](_0x166302[_0x9a17('0x31')],{'$or':_[_0x9a17('0x22')](_0x681e0e,function(_0xbf3409){if(_0xbf3409['type']!==_0x9a17('0x35')){var _0x42c6e7={};_0x42c6e7[_0xbf3409[_0x9a17('0x20')]]={'$like':'%'+_0x21e086['query'][_0x9a17('0x33')]+'%'};return _0x42c6e7;}})});}_0x166302=_[_0x9a17('0x34')]({},_0x166302,_0x21e086[_0x9a17('0x36')]);var _0x254741={'where':_0x166302[_0x9a17('0x31')]};return db['Attachment'][_0x9a17('0x15')](_0x254741)[_0x9a17('0x37')](function(_0x8199c8){_0x3051b5['count']=_0x8199c8;if(_0x21e086['query'][_0x9a17('0x38')]){_0x166302[_0x9a17('0x39')]=[{'all':!![]}];}return db[_0x9a17('0x3a')]['findAll'](_0x166302);})[_0x9a17('0x37')](function(_0x30e369){_0x3051b5['rows']=_0x30e369;return _0x3051b5;})['then'](respondWithFilteredResult(_0x5671a9,_0x166302))['catch'](handleError(_0x5671a9,null));};exports[_0x9a17('0x3b')]=function(_0x34917c,_0x1a99bc){var _0x4f269e={'raw':!![],'where':{'id':_0x34917c[_0x9a17('0x3c')]['id']}},_0x2ba44c={};_0x2ba44c[_0x9a17('0x2a')]=_[_0x9a17('0x3d')](db['Attachment']['rawAttributes']);_0x2ba44c[_0x9a17('0x27')]=_[_0x9a17('0x3d')](_0x34917c[_0x9a17('0x27')]);_0x2ba44c[_0x9a17('0x28')]=_[_0x9a17('0x29')](_0x2ba44c[_0x9a17('0x2a')],_0x2ba44c[_0x9a17('0x27')]);_0x4f269e[_0x9a17('0x2b')]=_[_0x9a17('0x29')](_0x2ba44c[_0x9a17('0x2a')],qs['fields'](_0x34917c[_0x9a17('0x27')]['fields']));_0x4f269e[_0x9a17('0x2b')]=_0x4f269e['attributes'][_0x9a17('0x2d')]?_0x4f269e[_0x9a17('0x2b')]:_0x2ba44c['model'];if(_0x34917c[_0x9a17('0x27')]['includeAll']){_0x4f269e['include']=[{'all':!![]}];}_0x4f269e=_[_0x9a17('0x34')]({},_0x4f269e,_0x34917c[_0x9a17('0x36')]);return db[_0x9a17('0x3a')]['find'](_0x4f269e)[_0x9a17('0x37')](handleEntityNotFound(_0x1a99bc,null))[_0x9a17('0x37')](respondWithResult(_0x1a99bc,null))[_0x9a17('0x3e')](handleError(_0x1a99bc,null));};exports[_0x9a17('0x3f')]=function(_0x2f18bc,_0x4ff7cb){var _0x265709={'where':{'id':_0x2f18bc[_0x9a17('0x3c')]['id']}},_0x8b378c={};_0x8b378c[_0x9a17('0x2a')]=_['keys'](db[_0x9a17('0x3a')][_0x9a17('0x23')]);_0x265709['attributes']=_['intersection'](_0x8b378c[_0x9a17('0x2a')],qs['fields'](_0x2f18bc[_0x9a17('0x27')]['fields']));_0x265709[_0x9a17('0x2b')]=_0x265709[_0x9a17('0x2b')]['length']?_0x265709['attributes']:_0x8b378c[_0x9a17('0x2a')];if(_0x2f18bc[_0x9a17('0x27')][_0x9a17('0x38')]){_0x265709[_0x9a17('0x39')]=[{'all':!![]}];}_0x265709=_[_0x9a17('0x34')]({},_0x265709,_0x2f18bc[_0x9a17('0x36')]);return db[_0x9a17('0x3a')][_0x9a17('0x40')](_0x265709)[_0x9a17('0x37')](handleEntityNotFound(_0x4ff7cb,null))['then'](function(_0x245ee6){if(_0x245ee6){var _0x4f8e5f=_0x245ee6[_0x9a17('0x41')]({'plain':!![]});_0x4f8e5f=qs[_0x9a17('0x42')](_0x4f8e5f,['id',_0x9a17('0x43'),_0x9a17('0x44')]);_0x2f18bc[_0x9a17('0x45')]=_[_0x9a17('0x42')](_0x2f18bc[_0x9a17('0x45')],['id',_0x9a17('0x43'),_0x9a17('0x44')]);return db[_0x9a17('0x3a')][_0x9a17('0x46')](_[_0x9a17('0x34')](_0x4f8e5f,_0x2f18bc[_0x9a17('0x45')]),{'include':_0x2f18bc[_0x9a17('0x27')][_0x9a17('0x38')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4ff7cb,0xc9))[_0x9a17('0x3e')](handleError(_0x4ff7cb,null));};exports[_0x9a17('0x47')]=function(_0x5c740a,_0x4fe55e){if(_0x5c740a[_0x9a17('0x45')]['id']){delete _0x5c740a[_0x9a17('0x45')]['id'];}return db[_0x9a17('0x3a')]['find']({'where':{'id':_0x5c740a[_0x9a17('0x3c')]['id']}})[_0x9a17('0x37')](handleEntityNotFound(_0x4fe55e,null))[_0x9a17('0x37')](saveUpdates(_0x5c740a[_0x9a17('0x45')],null))[_0x9a17('0x37')](respondWithResult(_0x4fe55e,null))['catch'](handleError(_0x4fe55e,null));};exports[_0x9a17('0x1d')]=function(_0x51b7d3,_0x3c4e2f){return db[_0x9a17('0x3a')][_0x9a17('0x40')]({'where':{'id':_0x51b7d3[_0x9a17('0x3c')]['id']}})[_0x9a17('0x37')](handleEntityNotFound(_0x3c4e2f,null))[_0x9a17('0x37')](removeEntity(_0x3c4e2f,null))[_0x9a17('0x3e')](handleError(_0x3c4e2f,null));};exports[_0x9a17('0x46')]=function(_0x19ece1,_0xd4ed5b,_0x5d3df7){_0x19ece1[_0x9a17('0x45')][_0x9a17('0x20')]=_0x19ece1[_0x9a17('0x48')]['originalname'];_0x19ece1['body'][_0x9a17('0x49')]=_0x19ece1['file'][_0x9a17('0x4a')];_0x19ece1[_0x9a17('0x45')][_0x9a17('0x25')]=_0x19ece1[_0x9a17('0x48')][_0x9a17('0x4b')];return db['Attachment'][_0x9a17('0x46')](_0x19ece1['body'])['then'](respondWithResult(_0xd4ed5b,0xc9))[_0x9a17('0x3e')](handleError(_0xd4ed5b,null));};exports[_0x9a17('0x4c')]=function(_0x200c64,_0x1b1e74,_0x490d08){return db[_0x9a17('0x3a')][_0x9a17('0x4d')]({'where':{'id':_0x200c64[_0x9a17('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1b1e74,null))[_0x9a17('0x37')](function(_0xb0b1fe){if(_0xb0b1fe){return _0x1b1e74[_0x9a17('0x4c')](path[_0x9a17('0x4e')](config[_0x9a17('0x4f')],_0x9a17('0x50'),_0xb0b1fe[_0x9a17('0x49')]));}})['catch'](handleError(_0x1b1e74,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4edaf5f..65c25e8 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 _0x6f0d=['./attachment.attributes','define','Attachment','attachments','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1616da,_0x4ba8e6){_0x1616da=_0x1616da-0x0;var _0x378fae=_0x6f0d[_0x1616da];return _0x378fae;};'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 +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x9a19,0x114));var _0x99a1=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x9a19[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index bb8cb83..58240fd 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 _0x9926=['debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','Attachment','create','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x454f02,_0x32ce79){var _0x3369f7=function(_0x4c455c){while(--_0x4c455c){_0x454f02['push'](_0x454f02['shift']());}};_0x3369f7(++_0x32ce79);}(_0x9926,0x109));var _0x6992=function(_0x298519,_0x201352){_0x298519=_0x298519-0x0;var _0x17521a=_0x9926[_0x298519];return _0x17521a;};'use strict';var _=require(_0x6992('0x0'));var util=require(_0x6992('0x1'));var moment=require(_0x6992('0x2'));var BPromise=require('bluebird');var rs=require(_0x6992('0x3'));var fs=require('fs');var Redis=require(_0x6992('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6992('0x5'))(_0x6992('0x6'));var config=require(_0x6992('0x7'));var jayson=require(_0x6992('0x8'));var client=jayson[_0x6992('0x9')][_0x6992('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17880f,_0x2d3db5,_0x2b1c63){return new BPromise(function(_0x5e1ac9,_0x4dec7a){return client['request'](_0x17880f,_0x2b1c63)[_0x6992('0xb')](function(_0x1cf322){logger[_0x6992('0xc')](_0x6992('0xd'),_0x2d3db5,_0x6992('0xe'));logger[_0x6992('0xf')](_0x6992('0x10'),_0x2d3db5,_0x6992('0xe'),JSON[_0x6992('0x11')](_0x1cf322));if(_0x1cf322[_0x6992('0x12')]){if(_0x1cf322['error'][_0x6992('0x13')]===0x1f4){logger[_0x6992('0x12')](_0x6992('0xd'),_0x2d3db5,_0x1cf322['error'][_0x6992('0x14')]);return _0x4dec7a(_0x1cf322['error']['message']);}logger[_0x6992('0x12')](_0x6992('0xd'),_0x2d3db5,_0x1cf322[_0x6992('0x12')]['message']);return _0x5e1ac9(_0x1cf322['error'][_0x6992('0x14')]);}else{logger[_0x6992('0xc')]('Attachment,\x20%s,\x20%s',_0x2d3db5,'request\x20sent');_0x5e1ac9(_0x1cf322[_0x6992('0x15')]['message']);}})['catch'](function(_0x432b0b){logger['error'](_0x6992('0xd'),_0x2d3db5,_0x432b0b);_0x4dec7a(_0x432b0b);});});}exports[_0x6992('0x16')]=function(_0x47b687){var _0x4e3f53=this;return new Promise(function(_0x2f75fc,_0x22fd25){return db[_0x6992('0x17')][_0x6992('0x18')](_0x47b687['body'],{'raw':_0x47b687['options']?_0x47b687[_0x6992('0x19')][_0x6992('0x1a')]===undefined?!![]:![]:!![]})[_0x6992('0xb')](function(_0x12ce9f){logger[_0x6992('0xc')](_0x6992('0x16'),_0x47b687);logger[_0x6992('0xf')](_0x6992('0x16'),_0x47b687,JSON[_0x6992('0x11')](_0x12ce9f));_0x2f75fc(_0x12ce9f);})[_0x6992('0x1b')](function(_0x32eb28){logger['error']('CreateAttachment',_0x32eb28[_0x6992('0x14')],_0x47b687);_0x22fd25(_0x4e3f53[_0x6992('0x12')](0x1f4,_0x32eb28[_0x6992('0x14')]));});});}; \ No newline at end of file +var _0x9579=['bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateAttachment','body','options','moment'];(function(_0x407dc2,_0xec385c){var _0x14c9e3=function(_0x1ce5e3){while(--_0x1ce5e3){_0x407dc2['push'](_0x407dc2['shift']());}};_0x14c9e3(++_0xec385c);}(_0x9579,0x110));var _0x9957=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x9579[_0x421e36];return _0x20b3e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9957('0x0'));var BPromise=require(_0x9957('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9957('0x2'));var logger=require(_0x9957('0x3'))('rpc');var config=require(_0x9957('0x4'));var jayson=require(_0x9957('0x5'));var client=jayson['client'][_0x9957('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4ff89b,_0x43e30f,_0x3ce64a){return new BPromise(function(_0xdba79,_0x4f12bb){return client['request'](_0x4ff89b,_0x3ce64a)[_0x9957('0x7')](function(_0x23047c){logger[_0x9957('0x8')](_0x9957('0x9'),_0x43e30f,'request\x20sent');logger[_0x9957('0xa')](_0x9957('0xb'),_0x43e30f,_0x9957('0xc'),JSON[_0x9957('0xd')](_0x23047c));if(_0x23047c['error']){if(_0x23047c[_0x9957('0xe')][_0x9957('0xf')]===0x1f4){logger[_0x9957('0xe')](_0x9957('0x9'),_0x43e30f,_0x23047c['error'][_0x9957('0x10')]);return _0x4f12bb(_0x23047c['error']['message']);}logger[_0x9957('0xe')](_0x9957('0x9'),_0x43e30f,_0x23047c['error'][_0x9957('0x10')]);return _0xdba79(_0x23047c[_0x9957('0xe')][_0x9957('0x10')]);}else{logger[_0x9957('0x8')](_0x9957('0x9'),_0x43e30f,_0x9957('0xc'));_0xdba79(_0x23047c['result'][_0x9957('0x10')]);}})[_0x9957('0x11')](function(_0xbc97dc){logger[_0x9957('0xe')](_0x9957('0x9'),_0x43e30f,_0xbc97dc);_0x4f12bb(_0xbc97dc);});});}exports[_0x9957('0x12')]=function(_0x2de3a1){var _0x24a88c=this;return new Promise(function(_0x41681f,_0x320626){return db['Attachment']['create'](_0x2de3a1[_0x9957('0x13')],{'raw':_0x2de3a1[_0x9957('0x14')]?_0x2de3a1['options']['raw']===undefined?!![]:![]:!![]})[_0x9957('0x7')](function(_0x497b94){logger[_0x9957('0x8')](_0x9957('0x12'),_0x2de3a1);logger[_0x9957('0xa')]('CreateAttachment',_0x2de3a1,JSON[_0x9957('0xd')](_0x497b94));_0x41681f(_0x497b94);})[_0x9957('0x11')](function(_0x5bd879){logger['error'](_0x9957('0x12'),_0x5bd879[_0x9957('0x10')],_0x2de3a1);_0x320626(_0x24a88c[_0x9957('0xe')](0x1f4,_0x5bd879[_0x9957('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index e2f6a30..3a02f6f 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 _0xcb1a=['destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./attachment.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','/:id/clone','clone','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','create','put'];(function(_0x22192d,_0x3dd65c){var _0x3fe214=function(_0x588278){while(--_0x588278){_0x22192d['push'](_0x22192d['shift']());}};_0x3fe214(++_0x3dd65c);}(_0xcb1a,0xb6));var _0xacb1=function(_0x423f40,_0x113c99){_0x423f40=_0x423f40-0x0;var _0x3c2443=_0xcb1a[_0x423f40];return _0x3c2443;};'use strict';var multer=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var path=require(_0xacb1('0x2'));var timeout=require(_0xacb1('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xacb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xacb1('0x5'));var controller=require(_0xacb1('0x6'));router['get']('/',auth[_0xacb1('0x7')](),controller[_0xacb1('0x8')]);router[_0xacb1('0x9')](_0xacb1('0xa'),auth[_0xacb1('0x7')](),controller[_0xacb1('0xb')]);router['get'](_0xacb1('0xc'),auth[_0xacb1('0x7')](),controller[_0xacb1('0xd')]);router[_0xacb1('0xe')](_0xacb1('0xf'),auth[_0xacb1('0x7')](),controller[_0xacb1('0x10')]);var upload=multer({'storage':multer[_0xacb1('0x11')]({'destination':function(_0x1d97a2,_0x13955b,_0x3eb9c1){_0x3eb9c1(null,path['join'](config[_0xacb1('0x12')],_0xacb1('0x13')));},'filename':function(_0x47bbe7,_0x5b868c,_0x436df5){_0x436df5(null,util[_0xacb1('0x14')](_0xacb1('0x15'),Date[_0xacb1('0x16')](),_0x5b868c[_0xacb1('0x17')][_0xacb1('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0xacb1('0x19')]('file'),controller[_0xacb1('0x1a')]);router[_0xacb1('0x1b')](_0xacb1('0xa'),auth[_0xacb1('0x7')](),controller['update']);router['delete'](_0xacb1('0xa'),auth[_0xacb1('0x7')](),controller[_0xacb1('0x1c')]);module[_0xacb1('0x1d')]=router; \ No newline at end of file +var _0xb749=['isAuthenticated','index','/:id','show','/:id/download','download','/:id/clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','post','single','file','create','put','delete','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xb749,0xac));var _0x9b74=function(_0xfc84ed,_0x32ee8a){_0xfc84ed=_0xfc84ed-0x0;var _0xb5fba1=_0xb749[_0xfc84ed];return _0xb5fba1;};'use strict';var multer=require(_0x9b74('0x0'));var util=require('util');var path=require(_0x9b74('0x1'));var timeout=require(_0x9b74('0x2'));var express=require('express');var router=express[_0x9b74('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b74('0x4'));var config=require(_0x9b74('0x5'));var controller=require(_0x9b74('0x6'));router[_0x9b74('0x7')]('/',auth[_0x9b74('0x8')](),controller[_0x9b74('0x9')]);router['get'](_0x9b74('0xa'),auth['isAuthenticated'](),controller[_0x9b74('0xb')]);router[_0x9b74('0x7')](_0x9b74('0xc'),auth[_0x9b74('0x8')](),controller[_0x9b74('0xd')]);router['post'](_0x9b74('0xe'),auth[_0x9b74('0x8')](),controller['clone']);var upload=multer({'storage':multer[_0x9b74('0xf')]({'destination':function(_0xfc8a79,_0x2d72a9,_0x5dd91a){_0x5dd91a(null,path[_0x9b74('0x10')](config[_0x9b74('0x11')],_0x9b74('0x12')));},'filename':function(_0x319fd1,_0x55491e,_0x4ef4c0){_0x4ef4c0(null,util[_0x9b74('0x13')](_0x9b74('0x14'),Date[_0x9b74('0x15')](),_0x55491e[_0x9b74('0x16')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9b74('0x17')]('/',upload[_0x9b74('0x18')](_0x9b74('0x19')),controller[_0x9b74('0x1a')]);router[_0x9b74('0x1b')](_0x9b74('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x9b74('0x1c')](_0x9b74('0xa'),auth[_0x9b74('0x8')](),controller[_0x9b74('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 30e562c..21eb112 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 _0xcd28=['clientSecret','secret','callbackURL','Setting','findOne','blockDuration','then','User','map','emails','value','admin','user','agent','disabled','add','minutes','clearBlockUser','getLicense','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','catch','lodash','passport','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate','email','callback','google','/login','use','clientID'];(function(_0x4a1257,_0x1f3ba7){var _0x52e6bc=function(_0x258fbb){while(--_0x258fbb){_0x4a1257['push'](_0x4a1257['shift']());}};_0x52e6bc(++_0x1f3ba7);}(_0xcd28,0x118));var _0x8cd2=function(_0x1f00ad,_0x1bcdb0){_0x1f00ad=_0x1f00ad-0x0;var _0x448b36=_0xcd28[_0x1f00ad];return _0x448b36;};'use strict';var _=require(_0x8cd2('0x0'));var passport=require(_0x8cd2('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x8cd2('0x2')];var moment=require(_0x8cd2('0x3'));var db=require(_0x8cd2('0x4'))['db'];var config=require(_0x8cd2('0x5'));var signToken=require(_0x8cd2('0x6'))[_0x8cd2('0x7')];var utils=require('../../config/utils');exports[_0x8cd2('0x8')]=passport[_0x8cd2('0x9')]('google',{'failureRedirect':'/login','scope':['profile',_0x8cd2('0xa')],'session':![]});exports[_0x8cd2('0xb')]=passport[_0x8cd2('0x9')](_0x8cd2('0xc'),{'failureRedirect':_0x8cd2('0xd'),'session':![]});passport[_0x8cd2('0xe')](new GoogleStrategy({'clientID':config[_0x8cd2('0xc')]?config[_0x8cd2('0xc')][_0x8cd2('0xf')]:'id','clientSecret':config[_0x8cd2('0xc')]?config['google'][_0x8cd2('0x10')]:_0x8cd2('0x11'),'callbackURL':config['google']?config[_0x8cd2('0xc')][_0x8cd2('0x12')]:''},function(_0xa23c14,_0x2f5c2b,_0x3d2b13,_0x47cf4d){var _0x229643,_0x209a8c;return db[_0x8cd2('0x13')][_0x8cd2('0x14')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8cd2('0x15')],'raw':!![]})[_0x8cd2('0x16')](function(_0x2fe1fe){_0x229643=_0x2fe1fe;return db[_0x8cd2('0x17')]['find']({'where':{'email':_[_0x8cd2('0x18')](_0x3d2b13[_0x8cd2('0x19')],_0x8cd2('0x1a')),'role':{'$or':[_0x8cd2('0x1b'),_0x8cd2('0x1c'),_0x8cd2('0x1d')]}}});})[_0x8cd2('0x16')](function(_0x5eac62){_0x209a8c=_0x5eac62;if(_0x209a8c){if(_0x209a8c[_0x8cd2('0x1e')]){return _0x47cf4d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x229643['blockDuration']>0x0){if(_0x209a8c['blocked']){if(moment(_0x209a8c['blockedAt'])[_0x8cd2('0x1f')](_0x229643[_0x8cd2('0x15')],_0x8cd2('0x20'))>moment()){return _0x47cf4d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x8cd2('0x21')](_0x209a8c,0x0,![],null)['then'](function(){return utils[_0x8cd2('0x22')](_0x209a8c);})[_0x8cd2('0x16')](function(){return _0x47cf4d(null,_0x209a8c);});}}else{return utils['getLicense'](_0x209a8c)[_0x8cd2('0x16')](function(){return _0x47cf4d(null,_0x209a8c);});}}else{return utils[_0x8cd2('0x22')](_0x209a8c)[_0x8cd2('0x16')](function(){return _0x47cf4d(null,_0x209a8c);});}}return _0x47cf4d(_0x8cd2('0x23'));})[_0x8cd2('0x24')](function(_0x1696ee){_0x47cf4d(_0x1696ee);});})); \ No newline at end of file +var _0x3f4b=['add','clearBlockUser','getLicense','catch','passport','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','google','profile','email','/login','use','clientID','clientSecret','Setting','blockDuration','then','User','find','map','emails','value','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0x3f4b,0x144));var _0xb3f4=function(_0x1733da,_0xf5318e){_0x1733da=_0x1733da-0x0;var _0x359598=_0x3f4b[_0x1733da];return _0x359598;};'use strict';var _=require('lodash');var passport=require(_0xb3f4('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0xb3f4('0x1')];var moment=require(_0xb3f4('0x2'));var db=require(_0xb3f4('0x3'))['db'];var config=require(_0xb3f4('0x4'));var signToken=require(_0xb3f4('0x5'))[_0xb3f4('0x6')];var utils=require(_0xb3f4('0x7'));exports['login']=passport[_0xb3f4('0x8')](_0xb3f4('0x9'),{'failureRedirect':'/login','scope':[_0xb3f4('0xa'),_0xb3f4('0xb')],'session':![]});exports['callback']=passport[_0xb3f4('0x8')](_0xb3f4('0x9'),{'failureRedirect':_0xb3f4('0xc'),'session':![]});passport[_0xb3f4('0xd')](new GoogleStrategy({'clientID':config[_0xb3f4('0x9')]?config[_0xb3f4('0x9')][_0xb3f4('0xe')]:'id','clientSecret':config[_0xb3f4('0x9')]?config[_0xb3f4('0x9')][_0xb3f4('0xf')]:'secret','callbackURL':config[_0xb3f4('0x9')]?config[_0xb3f4('0x9')]['callbackURL']:''},function(_0x24309a,_0x46b9db,_0x5ed97d,_0x231b1b){var _0x2a0bfa,_0x5d978e;return db[_0xb3f4('0x10')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xb3f4('0x11')],'raw':!![]})[_0xb3f4('0x12')](function(_0x3a148e){_0x2a0bfa=_0x3a148e;return db[_0xb3f4('0x13')][_0xb3f4('0x14')]({'where':{'email':_[_0xb3f4('0x15')](_0x5ed97d[_0xb3f4('0x16')],_0xb3f4('0x17')),'role':{'$or':[_0xb3f4('0x18'),'user',_0xb3f4('0x19')]}}});})[_0xb3f4('0x12')](function(_0x3a0380){_0x5d978e=_0x3a0380;if(_0x5d978e){if(_0x5d978e[_0xb3f4('0x1a')]){return _0x231b1b(_0xb3f4('0x1b'));}else if(_0x2a0bfa[_0xb3f4('0x11')]>0x0){if(_0x5d978e['blocked']){if(moment(_0x5d978e['blockedAt'])[_0xb3f4('0x1c')](_0x2a0bfa[_0xb3f4('0x11')],'minutes')>moment()){return _0x231b1b(_0xb3f4('0x1b'));}else{return utils[_0xb3f4('0x1d')](_0x5d978e,0x0,![],null)[_0xb3f4('0x12')](function(){return utils[_0xb3f4('0x1e')](_0x5d978e);})[_0xb3f4('0x12')](function(){return _0x231b1b(null,_0x5d978e);});}}else{return utils['getLicense'](_0x5d978e)[_0xb3f4('0x12')](function(){return _0x231b1b(null,_0x5d978e);});}}else{return utils['getLicense'](_0x5d978e)[_0xb3f4('0x12')](function(){return _0x231b1b(null,_0x5d978e);});}}return _0x231b1b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xb3f4('0x1f')](function(_0x481d93){_0x231b1b(_0x481d93);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 62fb4a6..79e6ab0 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 _0x1738=['isMiddleware','login','setTokenCookie','exports','express','passport','../user/user.controller.js','../../components/auth/service','get','/callback','callback'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1738,0x1bc));var _0x8173=function(_0x3b0796,_0x3d5382){_0x3b0796=_0x3b0796-0x0;var _0x1bf181=_0x1738[_0x3b0796];return _0x1bf181;};'use strict';var express=require(_0x8173('0x0'));var passport=require(_0x8173('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x8173('0x2'));var authService=require(_0x8173('0x3'));router[_0x8173('0x4')]('/',controller['login']);router['get'](_0x8173('0x5'),controller[_0x8173('0x6')],authService[_0x8173('0x7')],userController[_0x8173('0x8')],authService[_0x8173('0x9')]);module[_0x8173('0xa')]=router; \ No newline at end of file +var _0xe356=['get','/callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','login'];(function(_0x363f05,_0x4b6f15){var _0x2f86d3=function(_0x49acc8){while(--_0x49acc8){_0x363f05['push'](_0x363f05['shift']());}};_0x2f86d3(++_0x4b6f15);}(_0xe356,0x1ee));var _0x6e35=function(_0x5903ae,_0x173a6d){_0x5903ae=_0x5903ae-0x0;var _0x4e6dc0=_0xe356[_0x5903ae];return _0x4e6dc0;};'use strict';var express=require(_0x6e35('0x0'));var passport=require(_0x6e35('0x1'));var router=express[_0x6e35('0x2')]();var controller=require(_0x6e35('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x6e35('0x4'));router['get']('/',controller[_0x6e35('0x5')]);router[_0x6e35('0x6')](_0x6e35('0x7'),controller['callback'],authService[_0x6e35('0x8')],userController[_0x6e35('0x5')],authService['setTokenCookie']);module[_0x6e35('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2896cd3..08f6092 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 _0xe080=['use','util','passport','passport-local','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','service','host','secure','authentication','pass','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','generate','body','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','password','Password\x20reset!'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe080,0x141));var _0x0e08=function(_0x54a5fe,_0x351736){_0x54a5fe=_0x54a5fe-0x0;var _0x5a536c=_0xe080[_0x54a5fe];return _0x5a536c;};'use strict';var util=require(_0x0e08('0x0'));var passport=require(_0x0e08('0x1'));var LocalStrategy=require(_0x0e08('0x2'))['Strategy'];var jayson=require(_0x0e08('0x3'));var _=require(_0x0e08('0x4'));var rs=require(_0x0e08('0x5'));var moment=require('moment');var db=require(_0x0e08('0x6'))['db'];var authService=require(_0x0e08('0x7'));var utils=require(_0x0e08('0x8'));var client=jayson[_0x0e08('0x9')][_0x0e08('0xa')]({'port':0x232b});function localAuthenticate(_0x3d506b,_0x30648d,_0x4d4d7d,_0x304315){var _0x52d762,_0x2e965b;return db[_0x0e08('0xb')][_0x0e08('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0e08('0xd')],'raw':!![]})[_0x0e08('0xe')](function(_0x3b06b9){_0x52d762=_0x3b06b9;return _0x3d506b[_0x0e08('0xc')]({'attributes':['id','name','password',_0x0e08('0xf'),_0x0e08('0x10'),_0x0e08('0x11'),_0x0e08('0x12'),_0x0e08('0x13'),_0x0e08('0x14')],'where':{'name':_0x30648d,'role':{'$or':['admin',_0x0e08('0x15'),_0x0e08('0x16')]}}});})[_0x0e08('0xe')](function(_0x46109d){if(!_0x46109d||_0x46109d&&_0x46109d[_0x0e08('0x17')]!==_0x30648d){throw new Error(_0x0e08('0x18'));}else{_0x2e965b=_0x46109d;return _0x2e965b;}})[_0x0e08('0xe')](function(){_0x2e965b[_0x0e08('0x19')](_0x4d4d7d,function(_0xe7bb27,_0x186508){var _0x363697=_0x2e965b[_0x0e08('0x14')]+0x1;if(_0xe7bb27){return _0x304315(_0xe7bb27);}else if(!_0x186508){if(_0x2e965b[_0x0e08('0x11')]){return _0x304315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x52d762[_0x0e08('0x1a')]>0x0){if(_0x2e965b[_0x0e08('0x12')]){if(_0x52d762[_0x0e08('0xd')]>0x0){if(moment(_0x2e965b[_0x0e08('0x13')])[_0x0e08('0x1b')](_0x52d762['blockDuration'],'minutes')>moment()){return _0x304315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x2e965b,_0x363697,![],null)[_0x0e08('0xe')](function(){return _0x304315(null,![],{'message':_0x0e08('0x18')});});}}else{return _0x304315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x363697>=_0x52d762['allowedLoginAttempts']){return utils['clearBlockUser'](_0x2e965b,0x0,!![],moment())[_0x0e08('0xe')](function(){return _0x304315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x2e965b,_0x363697,![],null)[_0x0e08('0xe')](function(){return _0x304315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x304315(null,![],{'message':_0x0e08('0x18')});}}else{if(_0x2e965b[_0x0e08('0x11')]){return _0x304315(null,![],{'message':_0x0e08('0x18')});}else if(_0x52d762[_0x0e08('0x1a')]>0x0){if(_0x2e965b[_0x0e08('0x12')]){if(_0x52d762['blockDuration']>0x0){if(moment(_0x2e965b['blockedAt'])['add'](_0x52d762[_0x0e08('0xd')],_0x0e08('0x1c'))>moment()){return _0x304315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0e08('0x1d')](_0x2e965b,0x0,![],null)[_0x0e08('0xe')](function(){return utils[_0x0e08('0x1e')](_0x2e965b);})[_0x0e08('0xe')](function(){return _0x304315(null,_0x2e965b);});}}else{return _0x304315(null,![],{'message':_0x0e08('0x18')});}}else{return utils[_0x0e08('0x1d')](_0x2e965b,0x0,![],null)[_0x0e08('0xe')](function(){return utils[_0x0e08('0x1e')](_0x2e965b);})[_0x0e08('0xe')](function(){return _0x304315(null,_0x2e965b);})[_0x0e08('0x1f')](function(_0x382130){return _0x304315(null,![],_0x382130);});}}else{if(_0x2e965b[_0x0e08('0x12')]){return _0x304315(null,![],{'message':_0x0e08('0x18')});}else{return utils[_0x0e08('0x1e')](_0x2e965b)['then'](function(){return _0x304315(null,_0x2e965b);});}}}});})[_0x0e08('0x1f')](function(_0x3c105b){return _0x304315(null,![],_0x3c105b);});}function sendServiceMail(_0x36895f){return db['MailAccount'][_0x0e08('0x20')]({'where':{'service':!![]},'attributes':['id',_0x0e08('0x17'),_0x0e08('0x21')],'include':[{'model':db[_0x0e08('0x22')],'as':_0x0e08('0x23')}]})['then'](function(_0x75bc89){if(!_0x75bc89){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x30bf4e={'tls':{'rejectUnauthorized':![]}};if(_0x75bc89[_0x0e08('0x23')][_0x0e08('0x24')]){_0x30bf4e[_0x0e08('0x24')]=_0x75bc89['Smtp'][_0x0e08('0x24')];}else{_0x30bf4e[_0x0e08('0x25')]=_0x75bc89[_0x0e08('0x23')][_0x0e08('0x25')];_0x30bf4e['port']=_0x75bc89[_0x0e08('0x23')]['port'];_0x30bf4e[_0x0e08('0x26')]=_0x75bc89['Smtp'][_0x0e08('0x26')];}if(_0x75bc89['Smtp'][_0x0e08('0x27')]){_0x30bf4e['auth']={'user':_0x75bc89[_0x0e08('0x23')][_0x0e08('0x15')],'pass':_0x75bc89[_0x0e08('0x23')][_0x0e08('0x28')]};}var _0x3b3809={'account':_0x30bf4e,'message':_['merge']({'from':util[_0x0e08('0x29')](_0x0e08('0x2a'),_0x75bc89[_0x0e08('0x17')],_0x75bc89[_0x0e08('0x21')]||_0x75bc89['Smtp'][_0x0e08('0x15')])},_0x36895f)};return client[_0x0e08('0x2b')]('SendMail',_0x3b3809);})[_0x0e08('0xe')](function(_0x15fd9f){if(_0x15fd9f[_0x0e08('0x2c')]){throw new Error(util['format'](_0x0e08('0x2d'),_0x15fd9f[_0x0e08('0x2c')][_0x0e08('0x2e')]||JSON[_0x0e08('0x2f')](_0x15fd9f[_0x0e08('0x2c')])));}return!![];});}function handleError(_0x3604fa,_0x59e747,_0x478a92){return _0x3604fa[_0x0e08('0x30')](_0x59e747||0x1f4)[_0x0e08('0x31')]({'message':_0x478a92?_0x478a92['message']||_0x478a92:''});}function checkPasswordPattern(_0x547e47,_0x4c3759,_0x3a5a0d){if(_0x3a5a0d){var _0x32b57f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32b57f[_0x0e08('0x32')](_0x4c3759)){return _0x547e47;}else{throw new Error(_0x0e08('0x33'));}}else{return _0x547e47;}}exports[_0x0e08('0x34')]=function(_0x4bca8c,_0x530735,_0x50cf0c){passport[_0x0e08('0x19')](_0x0e08('0x35'),function(_0x43a2f2,_0x562421,_0x24be5e){var _0x55ad27=_0x43a2f2||_0x24be5e;if(_0x55ad27){return handleError(_0x530735,0x191,_0x55ad27);}if(!_0x562421){return handleError(_0x530735,0x194,{'message':_0x0e08('0x36')});}else{var _0x5a93b3={'payload':{'id':_0x562421['id'],'role':_0x562421[_0x0e08('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x0e08('0x37')](_0x5a93b3)['then'](function(_0x287d8c){_0x530735[_0x0e08('0x38')]({'id':_0x562421['id'],'token':_0x287d8c,'statusCall':'','isAlreadyLogged':_0x562421[_0x0e08('0x39')]});});}})(_0x4bca8c,_0x530735,_0x50cf0c);};exports[_0x0e08('0x3a')]=function(_0x187f66,_0x1537db,_0xd32d85){if(!_0x187f66['body'][_0x0e08('0x21')]){return handleError(_0x1537db,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x6f1d5e=rs[_0x0e08('0x3b')]();_0x187f66[_0x0e08('0x3c')][_0x0e08('0x21')]=_0x187f66[_0x0e08('0x3c')][_0x0e08('0x21')]['trim']()[_0x0e08('0x3d')]();var _0xd58a0d;return db[_0x0e08('0xb')][_0x0e08('0xc')]({'where':{'id':0x1},'attributes':[_0x0e08('0x1a'),_0x0e08('0xd')],'raw':!![]})[_0x0e08('0xe')](function(_0x130bfb){_0xd58a0d=_0x130bfb;return db[_0x0e08('0x3e')][_0x0e08('0x20')]({'where':{'email':_0x187f66[_0x0e08('0x3c')]['email']}});})[_0x0e08('0xe')](function(_0x28edc7){if(!_0x28edc7){throw new Error(_0x0e08('0x3f'));}if(_0x28edc7[_0x0e08('0x11')]){throw new Error(_0x0e08('0x40'));}if(_0x28edc7[_0x0e08('0x12')]){if(moment(_0x28edc7[_0x0e08('0x13')])['add'](_0xd58a0d[_0x0e08('0xd')],_0x0e08('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x28edc7['blocked']=![];_0x28edc7['blockedAt']=null;}}_0x28edc7['resetPasswordToken']=_0x6f1d5e;_0x28edc7[_0x0e08('0x41')]=Date[_0x0e08('0x42')]()+0x36ee80;return _0x28edc7[_0x0e08('0x43')]();})['then'](function(){return sendServiceMail({'to':_0x187f66[_0x0e08('0x3c')][_0x0e08('0x21')],'subject':_0x0e08('0x44'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x0e08('0x45')+_0x0e08('0x46')+_0x187f66[_0x0e08('0x47')][_0x0e08('0x25')]+_0x0e08('0x48')+_0x6f1d5e+'\x0a\x0a'+_0x0e08('0x49')});})[_0x0e08('0xe')](function(){_0x1537db[_0x0e08('0x30')](0xc8)[_0x0e08('0x31')]({'message':_0x0e08('0x4a')});})['catch'](function(_0x35c4f2){return handleError(_0x1537db,0x1f4,_0x35c4f2);});};exports['reset']=function(_0x1704ed,_0x5f260c,_0x2418db){var _0x12e6d8;return db[_0x0e08('0x3e')][_0x0e08('0x20')]({'where':{'resetPasswordToken':_0x1704ed['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x0e08('0x42')]()}}})[_0x0e08('0xe')](function(_0x38dcd7){_0x12e6d8=_0x38dcd7;if(!_0x12e6d8){throw new Error(_0x0e08('0x4b'));}return db[_0x0e08('0xb')][_0x0e08('0xc')]({'attributes':['id',_0x0e08('0x4c')]});})[_0x0e08('0xe')](function(_0x58ce17){return checkPasswordPattern(_0x58ce17,_0x1704ed[_0x0e08('0x3c')]['password'],_0x58ce17['securePassword']);})['then'](function(){_0x12e6d8[_0x0e08('0x4d')]=_0x1704ed[_0x0e08('0x3c')][_0x0e08('0x4d')];_0x12e6d8['resetPasswordToken']=null;_0x12e6d8['resetPasswordExpires']=null;return _0x12e6d8[_0x0e08('0x43')]();})[_0x0e08('0xe')](function(){_0x5f260c[_0x0e08('0x30')](0xc8)['send']({'message':_0x0e08('0x4e')});})[_0x0e08('0x1f')](function(_0x3e3df8){return handleError(_0x5f260c,0x1f4,_0x3e3df8);});};passport[_0x0e08('0x4f')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0xc82a68,_0xe0bdda,_0x268b9c){return localAuthenticate(db[_0x0e08('0x3e')],_0xc82a68,_0xe0bdda,_0x268b9c);})); \ No newline at end of file +var _0xbb4b=['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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','params','token','securePassword','password','send','Password\x20reset!','use','util','passport','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','name','role','disabled','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','loginAttempts','allowedLoginAttempts','blocked','blockDuration','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','User','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now'];(function(_0x4a67ae,_0x51ac3d){var _0x53b8ad=function(_0x1fff59){while(--_0x1fff59){_0x4a67ae['push'](_0x4a67ae['shift']());}};_0x53b8ad(++_0x51ac3d);}(_0xbb4b,0x1b4));var _0xbbb4=function(_0x7b0cf2,_0x5dddd3){_0x7b0cf2=_0x7b0cf2-0x0;var _0x35285d=_0xbb4b[_0x7b0cf2];return _0x35285d;};'use strict';var util=require(_0xbbb4('0x0'));var passport=require(_0xbbb4('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xbbb4('0x2'));var _=require(_0xbbb4('0x3'));var rs=require(_0xbbb4('0x4'));var moment=require('moment');var db=require(_0xbbb4('0x5'))['db'];var authService=require(_0xbbb4('0x6'));var utils=require(_0xbbb4('0x7'));var client=jayson[_0xbbb4('0x8')][_0xbbb4('0x9')]({'port':0x232b});function localAuthenticate(_0x4f6952,_0x52c7ae,_0x12fcbd,_0x70fd0f){var _0x8034aa,_0x384d7d;return db[_0xbbb4('0xa')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x13a6f8){_0x8034aa=_0x13a6f8;return _0x4f6952[_0xbbb4('0xb')]({'attributes':['id',_0xbbb4('0xc'),'password','salt',_0xbbb4('0xd'),_0xbbb4('0xe'),'blocked',_0xbbb4('0xf'),'loginAttempts'],'where':{'name':_0x52c7ae,'role':{'$or':[_0xbbb4('0x10'),_0xbbb4('0x11'),_0xbbb4('0x12')]}}});})['then'](function(_0x4d9df1){if(!_0x4d9df1||_0x4d9df1&&_0x4d9df1[_0xbbb4('0xc')]!==_0x52c7ae){throw new Error(_0xbbb4('0x13'));}else{_0x384d7d=_0x4d9df1;return _0x384d7d;}})[_0xbbb4('0x14')](function(){_0x384d7d['authenticate'](_0x12fcbd,function(_0x4588ab,_0x4948a6){var _0x22c46a=_0x384d7d[_0xbbb4('0x15')]+0x1;if(_0x4588ab){return _0x70fd0f(_0x4588ab);}else if(!_0x4948a6){if(_0x384d7d['disabled']){return _0x70fd0f(null,![],{'message':_0xbbb4('0x13')});}else if(_0x8034aa[_0xbbb4('0x16')]>0x0){if(_0x384d7d[_0xbbb4('0x17')]){if(_0x8034aa[_0xbbb4('0x18')]>0x0){if(moment(_0x384d7d['blockedAt'])[_0xbbb4('0x19')](_0x8034aa[_0xbbb4('0x18')],'minutes')>moment()){return _0x70fd0f(null,![],{'message':_0xbbb4('0x13')});}else{return utils['clearBlockUser'](_0x384d7d,_0x22c46a,![],null)[_0xbbb4('0x14')](function(){return _0x70fd0f(null,![],{'message':_0xbbb4('0x13')});});}}else{return _0x70fd0f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x22c46a>=_0x8034aa[_0xbbb4('0x16')]){return utils[_0xbbb4('0x1a')](_0x384d7d,0x0,!![],moment())[_0xbbb4('0x14')](function(){return _0x70fd0f(null,![],{'message':_0xbbb4('0x13')});});}else{return utils[_0xbbb4('0x1a')](_0x384d7d,_0x22c46a,![],null)[_0xbbb4('0x14')](function(){return _0x70fd0f(null,![],{'message':_0xbbb4('0x13')});});}}}else{return _0x70fd0f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x384d7d[_0xbbb4('0xe')]){return _0x70fd0f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x8034aa[_0xbbb4('0x16')]>0x0){if(_0x384d7d[_0xbbb4('0x17')]){if(_0x8034aa['blockDuration']>0x0){if(moment(_0x384d7d[_0xbbb4('0xf')])[_0xbbb4('0x19')](_0x8034aa[_0xbbb4('0x18')],_0xbbb4('0x1b'))>moment()){return _0x70fd0f(null,![],{'message':_0xbbb4('0x13')});}else{return utils['clearBlockUser'](_0x384d7d,0x0,![],null)[_0xbbb4('0x14')](function(){return utils[_0xbbb4('0x1c')](_0x384d7d);})[_0xbbb4('0x14')](function(){return _0x70fd0f(null,_0x384d7d);});}}else{return _0x70fd0f(null,![],{'message':_0xbbb4('0x13')});}}else{return utils[_0xbbb4('0x1a')](_0x384d7d,0x0,![],null)[_0xbbb4('0x14')](function(){return utils[_0xbbb4('0x1c')](_0x384d7d);})[_0xbbb4('0x14')](function(){return _0x70fd0f(null,_0x384d7d);})[_0xbbb4('0x1d')](function(_0xc8f157){return _0x70fd0f(null,![],_0xc8f157);});}}else{if(_0x384d7d[_0xbbb4('0x17')]){return _0x70fd0f(null,![],{'message':_0xbbb4('0x13')});}else{return utils[_0xbbb4('0x1c')](_0x384d7d)[_0xbbb4('0x14')](function(){return _0x70fd0f(null,_0x384d7d);});}}}});})[_0xbbb4('0x1d')](function(_0x49bc48){return _0x70fd0f(null,![],_0x49bc48);});}function sendServiceMail(_0x5e1960){return db[_0xbbb4('0x1e')][_0xbbb4('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xbbb4('0xc'),_0xbbb4('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xbbb4('0x21')}]})['then'](function(_0x273692){if(!_0x273692){throw new Error(_0xbbb4('0x22'));}var _0x48705f={'tls':{'rejectUnauthorized':![]}};if(_0x273692['Smtp'][_0xbbb4('0x23')]){_0x48705f[_0xbbb4('0x23')]=_0x273692[_0xbbb4('0x21')][_0xbbb4('0x23')];}else{_0x48705f[_0xbbb4('0x24')]=_0x273692['Smtp'][_0xbbb4('0x24')];_0x48705f[_0xbbb4('0x25')]=_0x273692[_0xbbb4('0x21')][_0xbbb4('0x25')];_0x48705f[_0xbbb4('0x26')]=_0x273692[_0xbbb4('0x21')][_0xbbb4('0x26')];}if(_0x273692[_0xbbb4('0x21')]['authentication']){_0x48705f[_0xbbb4('0x27')]={'user':_0x273692[_0xbbb4('0x21')][_0xbbb4('0x11')],'pass':_0x273692[_0xbbb4('0x21')][_0xbbb4('0x28')]};}var _0x3e77e8={'account':_0x48705f,'message':_[_0xbbb4('0x29')]({'from':util[_0xbbb4('0x2a')](_0xbbb4('0x2b'),_0x273692[_0xbbb4('0xc')],_0x273692['email']||_0x273692[_0xbbb4('0x21')]['user'])},_0x5e1960)};return client[_0xbbb4('0x2c')](_0xbbb4('0x2d'),_0x3e77e8);})[_0xbbb4('0x14')](function(_0x57f12f){if(_0x57f12f[_0xbbb4('0x2e')]){throw new Error(util[_0xbbb4('0x2a')](_0xbbb4('0x2f'),_0x57f12f[_0xbbb4('0x2e')][_0xbbb4('0x30')]||JSON[_0xbbb4('0x31')](_0x57f12f[_0xbbb4('0x2e')])));}return!![];});}function handleError(_0xb35c3d,_0x269848,_0x1572c0){return _0xb35c3d['status'](_0x269848||0x1f4)['send']({'message':_0x1572c0?_0x1572c0['message']||_0x1572c0:''});}function checkPasswordPattern(_0x42874b,_0x212f9b,_0x532d49){if(_0x532d49){var _0xb45d22=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xb45d22[_0xbbb4('0x32')](_0x212f9b)){return _0x42874b;}else{throw new Error(_0xbbb4('0x33'));}}else{return _0x42874b;}}exports[_0xbbb4('0x34')]=function(_0x34dc9e,_0x42da0e,_0x1da012){passport[_0xbbb4('0x35')](_0xbbb4('0x36'),function(_0x608658,_0x666c55,_0x1991a3){var _0x1241e0=_0x608658||_0x1991a3;if(_0x1241e0){return handleError(_0x42da0e,0x191,_0x1241e0);}if(!_0x666c55){return handleError(_0x42da0e,0x194,{'message':_0xbbb4('0x37')});}else{var _0x403e6f={'payload':{'id':_0x666c55['id'],'role':_0x666c55['role']},'options':{'expiresIn':0x15180}};return authService[_0xbbb4('0x38')](_0x403e6f)[_0xbbb4('0x14')](function(_0x7a0b16){_0x42da0e[_0xbbb4('0x39')]({'id':_0x666c55['id'],'token':_0x7a0b16,'statusCall':'','isAlreadyLogged':_0x666c55[_0xbbb4('0x3a')]});});}})(_0x34dc9e,_0x42da0e,_0x1da012);};exports[_0xbbb4('0x3b')]=function(_0x482699,_0x42f51e,_0x2ed13b){if(!_0x482699[_0xbbb4('0x3c')][_0xbbb4('0x20')]){return handleError(_0x42f51e,0x1f4,{'message':_0xbbb4('0x3d')});}var _0x308530=rs['generate']();_0x482699[_0xbbb4('0x3c')][_0xbbb4('0x20')]=_0x482699[_0xbbb4('0x3c')]['email'][_0xbbb4('0x3e')]()['toLowerCase']();var _0x8b68d2;return db[_0xbbb4('0xa')][_0xbbb4('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xbbb4('0x14')](function(_0x99f461){_0x8b68d2=_0x99f461;return db[_0xbbb4('0x3f')]['find']({'where':{'email':_0x482699[_0xbbb4('0x3c')]['email']}});})[_0xbbb4('0x14')](function(_0x46ad85){if(!_0x46ad85){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x46ad85[_0xbbb4('0xe')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x46ad85[_0xbbb4('0x17')]){if(moment(_0x46ad85['blockedAt'])[_0xbbb4('0x19')](_0x8b68d2[_0xbbb4('0x18')],'minutes')>moment()){throw new Error(_0xbbb4('0x40'));}else{_0x46ad85[_0xbbb4('0x17')]=![];_0x46ad85[_0xbbb4('0xf')]=null;}}_0x46ad85[_0xbbb4('0x41')]=_0x308530;_0x46ad85[_0xbbb4('0x42')]=Date[_0xbbb4('0x43')]()+0x36ee80;return _0x46ad85[_0xbbb4('0x44')]();})['then'](function(){return sendServiceMail({'to':_0x482699[_0xbbb4('0x3c')]['email'],'subject':_0xbbb4('0x45'),'text':_0xbbb4('0x46')+_0xbbb4('0x47')+_0xbbb4('0x48')+_0x482699['headers'][_0xbbb4('0x24')]+_0xbbb4('0x49')+_0x308530+'\x0a\x0a'+_0xbbb4('0x4a')});})[_0xbbb4('0x14')](function(){_0x42f51e[_0xbbb4('0x4b')](0xc8)['send']({'message':_0xbbb4('0x4c')});})[_0xbbb4('0x1d')](function(_0x3c9624){return handleError(_0x42f51e,0x1f4,_0x3c9624);});};exports['reset']=function(_0x440440,_0x359ec4,_0x78f61e){var _0x30785a;return db[_0xbbb4('0x3f')][_0xbbb4('0x1f')]({'where':{'resetPasswordToken':_0x440440[_0xbbb4('0x4d')][_0xbbb4('0x4e')],'resetPasswordExpires':{'$gt':Date[_0xbbb4('0x43')]()}}})[_0xbbb4('0x14')](function(_0x3d4e4f){_0x30785a=_0x3d4e4f;if(!_0x30785a){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xbbb4('0xa')]['findOne']({'attributes':['id',_0xbbb4('0x4f')]});})[_0xbbb4('0x14')](function(_0x309ce2){return checkPasswordPattern(_0x309ce2,_0x440440[_0xbbb4('0x3c')][_0xbbb4('0x50')],_0x309ce2[_0xbbb4('0x4f')]);})[_0xbbb4('0x14')](function(){_0x30785a[_0xbbb4('0x50')]=_0x440440[_0xbbb4('0x3c')][_0xbbb4('0x50')];_0x30785a[_0xbbb4('0x41')]=null;_0x30785a[_0xbbb4('0x42')]=null;return _0x30785a[_0xbbb4('0x44')]();})['then'](function(){_0x359ec4[_0xbbb4('0x4b')](0xc8)[_0xbbb4('0x51')]({'message':_0xbbb4('0x52')});})[_0xbbb4('0x1d')](function(_0x3dfc43){return handleError(_0x359ec4,0x1f4,_0x3dfc43);});};passport[_0xbbb4('0x53')](new LocalStrategy({'usernameField':_0xbbb4('0xc'),'passwordField':'password'},function(_0x4065ef,_0x52cab7,_0x13088d){return localAuthenticate(db[_0xbbb4('0x3f')],_0x4065ef,_0x52cab7,_0x13088d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 9640a49..42ed77f 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 _0xdf5f=['forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','login','post','/forgot'];(function(_0x3f0ae4,_0x4161a3){var _0x4bc2b3=function(_0x2d2148){while(--_0x2d2148){_0x3f0ae4['push'](_0x3f0ae4['shift']());}};_0x4bc2b3(++_0x4161a3);}(_0xdf5f,0x126));var _0xfdf5=function(_0x15d9d9,_0x5dbe2a){_0x15d9d9=_0x15d9d9-0x0;var _0x2164d6=_0xdf5f[_0x15d9d9];return _0x2164d6;};'use strict';var express=require(_0xfdf5('0x0'));var router=express[_0xfdf5('0x1')]();var controller=require(_0xfdf5('0x2'));router['post']('/',controller[_0xfdf5('0x3')]);router[_0xfdf5('0x4')](_0xfdf5('0x5'),controller[_0xfdf5('0x6')]);router[_0xfdf5('0x4')](_0xfdf5('0x7'),controller[_0xfdf5('0x8')]);module[_0xfdf5('0x9')]=router; \ No newline at end of file +var _0x16cd=['/forgot','forgot','/reset/:token','reset','exports','Router','./authLocal.controller','post','login'];(function(_0x4e9240,_0x570b72){var _0x4759ad=function(_0x3cabe1){while(--_0x3cabe1){_0x4e9240['push'](_0x4e9240['shift']());}};_0x4759ad(++_0x570b72);}(_0x16cd,0x101));var _0xd16c=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x16cd[_0x1cd47d];return _0x29d52f;};'use strict';var express=require('express');var router=express[_0xd16c('0x0')]();var controller=require(_0xd16c('0x1'));router[_0xd16c('0x2')]('/',controller[_0xd16c('0x3')]);router[_0xd16c('0x2')](_0xd16c('0x4'),controller[_0xd16c('0x5')]);router['post'](_0xd16c('0x6'),controller[_0xd16c('0x7')]);module[_0xd16c('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 8bdb6bf..85cb245 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 _0x24ec=['STRING','BOOLEAN','sequelize'];(function(_0x40d8dc,_0x52c17d){var _0x75d403=function(_0xf4e2eb){while(--_0xf4e2eb){_0x40d8dc['push'](_0x40d8dc['shift']());}};_0x75d403(++_0x52c17d);}(_0x24ec,0x164));var _0xc24e=function(_0x499001,_0x3f27ae){_0x499001=_0x499001-0x0;var _0x320c65=_0x24ec[_0x499001];return _0x320c65;};'use strict';var Sequelize=require(_0xc24e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc24e('0x1')]},'status':{'type':Sequelize[_0xc24e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xf3d8=['STRING','exports'];(function(_0x5e8479,_0x40ec45){var _0x59150a=function(_0x2555ad){while(--_0x2555ad){_0x5e8479['push'](_0x5e8479['shift']());}};_0x59150a(++_0x40ec45);}(_0xf3d8,0x93));var _0x8f3d=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0xf3d8[_0x33c9f8];return _0x2d7004;};'use strict';var Sequelize=require('sequelize');module[_0x8f3d('0x0')]={'name':{'type':Sequelize[_0x8f3d('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x8f3d('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index c1c774d..750ef13 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 _0x3e2e=['querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','fieldName','key','model','map','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Automation','includeAll','include','findAll','show','params','rawAttributes','find','catch','body','Condition','addConditions','ids','getConditions','addActions','Action','findOne','getActions','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0xc7fcd2,_0x1649e7){var _0x808c26=function(_0x529d67){while(--_0x529d67){_0xc7fcd2['push'](_0xc7fcd2['shift']());}};_0x808c26(++_0x1649e7);}(_0x3e2e,0xe1));var _0xe3e2=function(_0x2b12df,_0x17156f){_0x2b12df=_0x2b12df-0x0;var _0x4d5936=_0x3e2e[_0x2b12df];return _0x4d5936;};'use strict';var pdf=require(_0xe3e2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe3e2('0x1'));var rp=require(_0xe3e2('0x2'));var moment=require(_0xe3e2('0x3'));var BPromise=require(_0xe3e2('0x4'));var Mustache=require(_0xe3e2('0x5'));var util=require(_0xe3e2('0x6'));var path=require(_0xe3e2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe3e2('0x8'));var fs=require('fs');var _=require(_0xe3e2('0x9'));var squel=require(_0xe3e2('0xa'));var crypto=require(_0xe3e2('0xb'));var jsforce=require(_0xe3e2('0xc'));var deskjs=require(_0xe3e2('0xd'));var toCsv=require(_0xe3e2('0xe'));var querystring=require(_0xe3e2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe3e2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3e2('0x11'));var logger=require(_0xe3e2('0x12'))('api');var utils=require(_0xe3e2('0x13'));var config=require(_0xe3e2('0x14'));var db=require(_0xe3e2('0x15'))['db'];function respondWithStatusCode(_0x93adb8,_0x4d7ce4){_0x4d7ce4=_0x4d7ce4||0xcc;return function(_0x1b7e90){if(_0x1b7e90){return _0x93adb8[_0xe3e2('0x16')](_0x4d7ce4);}return _0x93adb8[_0xe3e2('0x17')](_0x4d7ce4)[_0xe3e2('0x18')]();};}function respondWithResult(_0x18b84c,_0x54299d){_0x54299d=_0x54299d||0xc8;return function(_0x39173a){if(_0x39173a){return _0x18b84c[_0xe3e2('0x17')](_0x54299d)[_0xe3e2('0x19')](_0x39173a);}};}function respondWithFilteredResult(_0x23be4d,_0x50d873){return function(_0x1fdb5b){if(_0x1fdb5b){var _0x2b4391=_0x1fdb5b[_0xe3e2('0x1a')],_0x1abd12=_0x50d873['offset'],_0x4cbec1=_0x50d873['offset']+_0x50d873[_0xe3e2('0x1b')],_0x3a4ba6;if(_0x4cbec1>=_0x2b4391){_0x4cbec1=_0x2b4391;_0x3a4ba6=0xc8;}else{_0x3a4ba6=0xce;}_0x23be4d[_0xe3e2('0x17')](_0x3a4ba6);return _0x23be4d[_0xe3e2('0x1c')](_0xe3e2('0x1d'),_0x1abd12+'-'+_0x4cbec1+'/'+_0x2b4391)[_0xe3e2('0x19')](_0x1fdb5b);}return null;};}function patchUpdates(_0xb258b6){return function(_0x3f7b27){try{jsonpatch['apply'](_0x3f7b27,_0xb258b6,!![]);}catch(_0x360bdf){return BPromise[_0xe3e2('0x1e')](_0x360bdf);}return _0x3f7b27[_0xe3e2('0x1f')]();};}function saveUpdates(_0x244b00,_0x1a63aa){return function(_0x1bf394){if(_0x1bf394){return _0x1bf394[_0xe3e2('0x20')](_0x244b00)[_0xe3e2('0x21')](function(_0x5efec4){return _0x5efec4;});}return null;};}function removeEntity(_0x54d4fb,_0x15d2ff){return function(_0x2d3a6c){if(_0x2d3a6c){return _0x2d3a6c[_0xe3e2('0x22')]()['then'](function(){_0x54d4fb[_0xe3e2('0x17')](0xcc)[_0xe3e2('0x18')]();});}};}function handleEntityNotFound(_0xf04f1f,_0x1bef15){return function(_0x35dd08){if(!_0x35dd08){_0xf04f1f[_0xe3e2('0x16')](0x194);}return _0x35dd08;};}function handleError(_0x5acd82,_0x3b31b6){_0x3b31b6=_0x3b31b6||0x1f4;return function(_0x2881d4){logger[_0xe3e2('0x23')](_0x2881d4[_0xe3e2('0x24')]);if(_0x2881d4[_0xe3e2('0x25')]){delete _0x2881d4['name'];}_0x5acd82['status'](_0x3b31b6)['send'](_0x2881d4);};}exports[_0xe3e2('0x26')]=function(_0x213b57,_0x359a05){var _0x41a38f={},_0x395f52={},_0x131806={'count':0x0,'rows':[]};var _0x231c55=_['map'](db['Automation']['rawAttributes'],function(_0x1d5bc7){return{'name':_0x1d5bc7[_0xe3e2('0x27')],'type':_0x1d5bc7['type'][_0xe3e2('0x28')]};});_0x395f52[_0xe3e2('0x29')]=_[_0xe3e2('0x2a')](_0x231c55,_0xe3e2('0x25'));_0x395f52['query']=_[_0xe3e2('0x2b')](_0x213b57['query']);_0x395f52[_0xe3e2('0x2c')]=_['intersection'](_0x395f52[_0xe3e2('0x29')],_0x395f52[_0xe3e2('0x2d')]);_0x41a38f['attributes']=_[_0xe3e2('0x2e')](_0x395f52['model'],qs[_0xe3e2('0x2f')](_0x213b57[_0xe3e2('0x2d')][_0xe3e2('0x2f')]));_0x41a38f['attributes']=_0x41a38f[_0xe3e2('0x30')][_0xe3e2('0x31')]?_0x41a38f['attributes']:_0x395f52['model'];if(!_0x213b57[_0xe3e2('0x2d')][_0xe3e2('0x32')](_0xe3e2('0x33'))){_0x41a38f['limit']=qs[_0xe3e2('0x1b')](_0x213b57[_0xe3e2('0x2d')][_0xe3e2('0x1b')]);_0x41a38f[_0xe3e2('0x34')]=qs[_0xe3e2('0x34')](_0x213b57['query']['offset']);}_0x41a38f[_0xe3e2('0x35')]=qs[_0xe3e2('0x36')](_0x213b57[_0xe3e2('0x2d')][_0xe3e2('0x36')]);_0x41a38f[_0xe3e2('0x37')]=qs[_0xe3e2('0x2c')](_[_0xe3e2('0x38')](_0x213b57[_0xe3e2('0x2d')],_0x395f52['filters']),_0x231c55);if(_0x213b57[_0xe3e2('0x2d')]['filter']){_0x41a38f[_0xe3e2('0x37')]=_[_0xe3e2('0x39')](_0x41a38f['where'],{'$or':_[_0xe3e2('0x2a')](_0x231c55,function(_0x5ef2f1){if(_0x5ef2f1[_0xe3e2('0x3a')]!==_0xe3e2('0x3b')){var _0x4be09a={};_0x4be09a[_0x5ef2f1[_0xe3e2('0x25')]]={'$like':'%'+_0x213b57[_0xe3e2('0x2d')][_0xe3e2('0x3c')]+'%'};return _0x4be09a;}})});}_0x41a38f=_[_0xe3e2('0x39')]({},_0x41a38f,_0x213b57[_0xe3e2('0x3d')]);var _0x5b5cd8={'where':_0x41a38f[_0xe3e2('0x37')]};return db[_0xe3e2('0x3e')][_0xe3e2('0x1a')](_0x5b5cd8)[_0xe3e2('0x21')](function(_0x108583){_0x131806[_0xe3e2('0x1a')]=_0x108583;if(_0x213b57[_0xe3e2('0x2d')][_0xe3e2('0x3f')]){_0x41a38f[_0xe3e2('0x40')]=[{'all':!![]}];}return db[_0xe3e2('0x3e')][_0xe3e2('0x41')](_0x41a38f);})[_0xe3e2('0x21')](function(_0xc2c1d3){_0x131806['rows']=_0xc2c1d3;return _0x131806;})[_0xe3e2('0x21')](respondWithFilteredResult(_0x359a05,_0x41a38f))['catch'](handleError(_0x359a05,null));};exports[_0xe3e2('0x42')]=function(_0x1a48f5,_0x4740a7){var _0xc35f90={'raw':![],'where':{'id':_0x1a48f5[_0xe3e2('0x43')]['id']}},_0x3d8fab={};_0x3d8fab[_0xe3e2('0x29')]=_[_0xe3e2('0x2b')](db[_0xe3e2('0x3e')][_0xe3e2('0x44')]);_0x3d8fab[_0xe3e2('0x2d')]=_[_0xe3e2('0x2b')](_0x1a48f5[_0xe3e2('0x2d')]);_0x3d8fab[_0xe3e2('0x2c')]=_[_0xe3e2('0x2e')](_0x3d8fab[_0xe3e2('0x29')],_0x3d8fab['query']);_0xc35f90[_0xe3e2('0x30')]=_[_0xe3e2('0x2e')](_0x3d8fab['model'],qs['fields'](_0x1a48f5[_0xe3e2('0x2d')]['fields']));_0xc35f90[_0xe3e2('0x30')]=_0xc35f90['attributes'][_0xe3e2('0x31')]?_0xc35f90['attributes']:_0x3d8fab['model'];if(_0x1a48f5[_0xe3e2('0x2d')][_0xe3e2('0x3f')]){_0xc35f90[_0xe3e2('0x40')]=[{'all':!![]}];}_0xc35f90=_[_0xe3e2('0x39')]({},_0xc35f90,_0x1a48f5[_0xe3e2('0x3d')]);return db['Automation'][_0xe3e2('0x45')](_0xc35f90)[_0xe3e2('0x21')](handleEntityNotFound(_0x4740a7,null))[_0xe3e2('0x21')](respondWithResult(_0x4740a7,null))[_0xe3e2('0x46')](handleError(_0x4740a7,null));};exports['create']=function(_0x8472ea,_0x105a71){return db[_0xe3e2('0x3e')]['create'](_0x8472ea['body'],{})[_0xe3e2('0x21')](respondWithResult(_0x105a71,0xc9))[_0xe3e2('0x46')](handleError(_0x105a71,null));};exports[_0xe3e2('0x20')]=function(_0x56acd3,_0x51d0b3){if(_0x56acd3['body']['id']){delete _0x56acd3[_0xe3e2('0x47')]['id'];}return db['Automation'][_0xe3e2('0x45')]({'where':{'id':_0x56acd3[_0xe3e2('0x43')]['id']}})['then'](handleEntityNotFound(_0x51d0b3,null))['then'](saveUpdates(_0x56acd3[_0xe3e2('0x47')],null))[_0xe3e2('0x21')](respondWithResult(_0x51d0b3,null))[_0xe3e2('0x46')](handleError(_0x51d0b3,null));};exports[_0xe3e2('0x22')]=function(_0x58a8f6,_0x44b92a){return db['Automation'][_0xe3e2('0x45')]({'where':{'id':_0x58a8f6[_0xe3e2('0x43')]['id']}})['then'](handleEntityNotFound(_0x44b92a,null))[_0xe3e2('0x21')](removeEntity(_0x44b92a,null))[_0xe3e2('0x46')](handleError(_0x44b92a,null));};exports['addConditions']=function(_0x46a9ba,_0x2aeb80,_0x35ba63){return db[_0xe3e2('0x48')]['find']({'where':{'id':_0x46a9ba[_0xe3e2('0x43')]['id']}})[_0xe3e2('0x21')](handleEntityNotFound(_0x2aeb80,null))[_0xe3e2('0x21')](function(_0x37949e){if(_0x37949e){return _0x37949e[_0xe3e2('0x49')](_0x46a9ba['body'][_0xe3e2('0x4a')],_['omit'](_0x46a9ba[_0xe3e2('0x47')],[_0xe3e2('0x4a'),'id'])||{});}})[_0xe3e2('0x21')](respondWithResult(_0x2aeb80,null))[_0xe3e2('0x46')](handleError(_0x2aeb80,null));};exports['getConditions']=function(_0x303505,_0x5c8d6b,_0x4c917e){var _0x42e5af={};var _0x28093c={};var _0x318a61;var _0x3f079a;return db['Automation']['findOne']({'where':{'id':_0x303505[_0xe3e2('0x43')]['id']}})[_0xe3e2('0x21')](handleEntityNotFound(_0x5c8d6b,null))[_0xe3e2('0x21')](function(_0x8b3640){if(_0x8b3640){_0x318a61=_0x8b3640;_0x28093c[_0xe3e2('0x29')]=_[_0xe3e2('0x2b')](db['Condition']['rawAttributes']);_0x28093c['query']=_[_0xe3e2('0x2b')](_0x303505['query']);_0x28093c['filters']=_[_0xe3e2('0x2e')](_0x28093c[_0xe3e2('0x29')],_0x28093c['query']);_0x42e5af['attributes']=_[_0xe3e2('0x2e')](_0x28093c['model'],qs['fields'](_0x303505[_0xe3e2('0x2d')][_0xe3e2('0x2f')]));_0x42e5af[_0xe3e2('0x30')]=_0x42e5af[_0xe3e2('0x30')][_0xe3e2('0x31')]?_0x42e5af['attributes']:_0x28093c[_0xe3e2('0x29')];_0x42e5af[_0xe3e2('0x35')]=qs[_0xe3e2('0x36')](_0x303505['query'][_0xe3e2('0x36')]);_0x42e5af[_0xe3e2('0x37')]=qs[_0xe3e2('0x2c')](_[_0xe3e2('0x38')](_0x303505[_0xe3e2('0x2d')],_0x28093c[_0xe3e2('0x2c')]));if(_0x303505['query'][_0xe3e2('0x3c')]){_0x42e5af[_0xe3e2('0x37')]=_[_0xe3e2('0x39')](_0x42e5af['where'],{'$or':_['map'](_0x42e5af[_0xe3e2('0x30')],function(_0x31eacb){var _0x2e4b7b={};_0x2e4b7b[_0x31eacb]={'$like':'%'+_0x303505[_0xe3e2('0x2d')][_0xe3e2('0x3c')]+'%'};return _0x2e4b7b;})});}_0x42e5af=_['merge']({},_0x42e5af,_0x303505[_0xe3e2('0x3d')]);return _0x318a61[_0xe3e2('0x4b')](_0x42e5af);}})[_0xe3e2('0x21')](function(_0x27c5d0){if(_0x27c5d0){_0x3f079a=_0x27c5d0[_0xe3e2('0x31')];if(!_0x303505[_0xe3e2('0x2d')][_0xe3e2('0x32')](_0xe3e2('0x33'))){_0x42e5af['limit']=qs[_0xe3e2('0x1b')](_0x303505['query'][_0xe3e2('0x1b')]);_0x42e5af[_0xe3e2('0x34')]=qs[_0xe3e2('0x34')](_0x303505[_0xe3e2('0x2d')]['offset']);}return _0x318a61[_0xe3e2('0x4b')](_0x42e5af);}})['then'](function(_0x4cd502){if(_0x4cd502){return _0x4cd502?{'count':_0x3f079a,'rows':_0x4cd502}:null;}})[_0xe3e2('0x21')](respondWithResult(_0x5c8d6b,null))[_0xe3e2('0x46')](handleError(_0x5c8d6b,null));};exports[_0xe3e2('0x4c')]=function(_0x40d94a,_0x2dac25,_0x326d9b){return db[_0xe3e2('0x4d')][_0xe3e2('0x45')]({'where':{'id':_0x40d94a['params']['id']}})['then'](handleEntityNotFound(_0x2dac25,null))['then'](function(_0x12fc23){if(_0x12fc23){return _0x12fc23[_0xe3e2('0x4c')](_0x40d94a[_0xe3e2('0x47')][_0xe3e2('0x4a')],_['omit'](_0x40d94a[_0xe3e2('0x47')],[_0xe3e2('0x4a'),'id'])||{});}})[_0xe3e2('0x21')](respondWithResult(_0x2dac25,null))[_0xe3e2('0x46')](handleError(_0x2dac25,null));};exports['getActions']=function(_0x1e698f,_0x53bbdd,_0x4fcee0){var _0xe9418c={};var _0x1b6b63={};var _0x46a7f4;var _0x23145;return db['Automation'][_0xe3e2('0x4e')]({'where':{'id':_0x1e698f['params']['id']}})[_0xe3e2('0x21')](handleEntityNotFound(_0x53bbdd,null))[_0xe3e2('0x21')](function(_0x2abf0e){if(_0x2abf0e){_0x46a7f4=_0x2abf0e;_0x1b6b63['model']=_[_0xe3e2('0x2b')](db[_0xe3e2('0x4d')][_0xe3e2('0x44')]);_0x1b6b63[_0xe3e2('0x2d')]=_[_0xe3e2('0x2b')](_0x1e698f[_0xe3e2('0x2d')]);_0x1b6b63[_0xe3e2('0x2c')]=_[_0xe3e2('0x2e')](_0x1b6b63['model'],_0x1b6b63[_0xe3e2('0x2d')]);_0xe9418c[_0xe3e2('0x30')]=_['intersection'](_0x1b6b63[_0xe3e2('0x29')],qs['fields'](_0x1e698f[_0xe3e2('0x2d')][_0xe3e2('0x2f')]));_0xe9418c[_0xe3e2('0x30')]=_0xe9418c['attributes']['length']?_0xe9418c[_0xe3e2('0x30')]:_0x1b6b63[_0xe3e2('0x29')];_0xe9418c[_0xe3e2('0x35')]=qs[_0xe3e2('0x36')](_0x1e698f[_0xe3e2('0x2d')][_0xe3e2('0x36')]);_0xe9418c['where']=qs[_0xe3e2('0x2c')](_['pick'](_0x1e698f['query'],_0x1b6b63[_0xe3e2('0x2c')]));if(_0x1e698f[_0xe3e2('0x2d')]['filter']){_0xe9418c[_0xe3e2('0x37')]=_[_0xe3e2('0x39')](_0xe9418c[_0xe3e2('0x37')],{'$or':_[_0xe3e2('0x2a')](_0xe9418c['attributes'],function(_0x170db5){var _0x12f562={};_0x12f562[_0x170db5]={'$like':'%'+_0x1e698f[_0xe3e2('0x2d')][_0xe3e2('0x3c')]+'%'};return _0x12f562;})});}_0xe9418c=_[_0xe3e2('0x39')]({},_0xe9418c,_0x1e698f[_0xe3e2('0x3d')]);return _0x46a7f4[_0xe3e2('0x4f')](_0xe9418c);}})[_0xe3e2('0x21')](function(_0x418432){if(_0x418432){_0x23145=_0x418432[_0xe3e2('0x31')];if(!_0x1e698f[_0xe3e2('0x2d')][_0xe3e2('0x32')](_0xe3e2('0x33'))){_0xe9418c[_0xe3e2('0x1b')]=qs[_0xe3e2('0x1b')](_0x1e698f[_0xe3e2('0x2d')]['limit']);_0xe9418c[_0xe3e2('0x34')]=qs[_0xe3e2('0x34')](_0x1e698f[_0xe3e2('0x2d')][_0xe3e2('0x34')]);}return _0x46a7f4[_0xe3e2('0x4f')](_0xe9418c);}})['then'](function(_0xe21de2){if(_0xe21de2){return _0xe21de2?{'count':_0x23145,'rows':_0xe21de2}:null;}})['then'](respondWithResult(_0x53bbdd,null))['catch'](handleError(_0x53bbdd,null));}; \ No newline at end of file +var _0xff0f=['limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','Automation','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','findAll','rows','show','params','model','catch','body','update','find','addConditions','Condition','ids','sort','getConditions','Action','addActions','getActions','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x5bbd88,_0xc3e30e){var _0xfce126=function(_0x76919c){while(--_0x76919c){_0x5bbd88['push'](_0x5bbd88['shift']());}};_0xfce126(++_0xc3e30e);}(_0xff0f,0x86));var _0xfff0=function(_0x39c336,_0x288130){_0x39c336=_0x39c336-0x0;var _0x450ddf=_0xff0f[_0x39c336];return _0x450ddf;};'use strict';var pdf=require(_0xfff0('0x0'));var emlformat=require(_0xfff0('0x1'));var rimraf=require(_0xfff0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfff0('0x3'));var rp=require(_0xfff0('0x4'));var moment=require(_0xfff0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfff0('0x6'));var path=require(_0xfff0('0x7'));var sox=require(_0xfff0('0x8'));var csv=require(_0xfff0('0x9'));var ejs=require(_0xfff0('0xa'));var fs=require('fs');var _=require(_0xfff0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfff0('0xc'));var deskjs=require(_0xfff0('0xd'));var toCsv=require(_0xfff0('0x9'));var querystring=require(_0xfff0('0xe'));var Papa=require(_0xfff0('0xf'));var Redis=require(_0xfff0('0x10'));var authService=require(_0xfff0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfff0('0x12'));var hardwareService=require(_0xfff0('0x13'));var logger=require(_0xfff0('0x14'))('api');var utils=require(_0xfff0('0x15'));var config=require(_0xfff0('0x16'));var db=require(_0xfff0('0x17'))['db'];function respondWithStatusCode(_0x1e693a,_0x312e00){_0x312e00=_0x312e00||0xcc;return function(_0x540a76){if(_0x540a76){return _0x1e693a[_0xfff0('0x18')](_0x312e00);}return _0x1e693a[_0xfff0('0x19')](_0x312e00)[_0xfff0('0x1a')]();};}function respondWithResult(_0x506618,_0x431332){_0x431332=_0x431332||0xc8;return function(_0x118d2c){if(_0x118d2c){return _0x506618['status'](_0x431332)[_0xfff0('0x1b')](_0x118d2c);}};}function respondWithFilteredResult(_0x2b0612,_0xaca040){return function(_0x49ed39){if(_0x49ed39){var _0x213390=_0x49ed39[_0xfff0('0x1c')],_0x4c693e=_0xaca040[_0xfff0('0x1d')],_0x35751c=_0xaca040[_0xfff0('0x1d')]+_0xaca040[_0xfff0('0x1e')],_0x26eb59;if(_0x35751c>=_0x213390){_0x35751c=_0x213390;_0x26eb59=0xc8;}else{_0x26eb59=0xce;}_0x2b0612[_0xfff0('0x19')](_0x26eb59);return _0x2b0612[_0xfff0('0x1f')](_0xfff0('0x20'),_0x4c693e+'-'+_0x35751c+'/'+_0x213390)['json'](_0x49ed39);}return null;};}function patchUpdates(_0x108390){return function(_0x2a9193){try{jsonpatch[_0xfff0('0x21')](_0x2a9193,_0x108390,!![]);}catch(_0x1d1eb5){return BPromise[_0xfff0('0x22')](_0x1d1eb5);}return _0x2a9193[_0xfff0('0x23')]();};}function saveUpdates(_0x59c999,_0x423f80){return function(_0x633956){if(_0x633956){return _0x633956['update'](_0x59c999)[_0xfff0('0x24')](function(_0x2b334c){return _0x2b334c;});}return null;};}function removeEntity(_0x4bea35,_0x1341b1){return function(_0x55039d){if(_0x55039d){return _0x55039d[_0xfff0('0x25')]()['then'](function(){_0x4bea35[_0xfff0('0x19')](0xcc)[_0xfff0('0x1a')]();});}};}function handleEntityNotFound(_0x490034,_0x3978c7){return function(_0x45a1b6){if(!_0x45a1b6){_0x490034[_0xfff0('0x18')](0x194);}return _0x45a1b6;};}function handleError(_0x2ba507,_0xd48f2d){_0xd48f2d=_0xd48f2d||0x1f4;return function(_0x399bd2){logger[_0xfff0('0x26')](_0x399bd2[_0xfff0('0x27')]);if(_0x399bd2[_0xfff0('0x28')]){delete _0x399bd2[_0xfff0('0x28')];}_0x2ba507[_0xfff0('0x19')](_0xd48f2d)[_0xfff0('0x29')](_0x399bd2);};}exports['index']=function(_0x98fd1c,_0x3dce43){var _0x3a06f2={},_0x394898={},_0x7102b2={'count':0x0,'rows':[]};var _0xb144f4=_[_0xfff0('0x2a')](db[_0xfff0('0x2b')][_0xfff0('0x2c')],function(_0x210a4e){return{'name':_0x210a4e[_0xfff0('0x2d')],'type':_0x210a4e[_0xfff0('0x2e')][_0xfff0('0x2f')]};});_0x394898['model']=_[_0xfff0('0x2a')](_0xb144f4,_0xfff0('0x28'));_0x394898[_0xfff0('0x30')]=_[_0xfff0('0x31')](_0x98fd1c[_0xfff0('0x30')]);_0x394898[_0xfff0('0x32')]=_[_0xfff0('0x33')](_0x394898['model'],_0x394898['query']);_0x3a06f2[_0xfff0('0x34')]=_[_0xfff0('0x33')](_0x394898['model'],qs[_0xfff0('0x35')](_0x98fd1c[_0xfff0('0x30')][_0xfff0('0x35')]));_0x3a06f2[_0xfff0('0x34')]=_0x3a06f2['attributes'][_0xfff0('0x36')]?_0x3a06f2[_0xfff0('0x34')]:_0x394898['model'];if(!_0x98fd1c[_0xfff0('0x30')][_0xfff0('0x37')](_0xfff0('0x38'))){_0x3a06f2['limit']=qs[_0xfff0('0x1e')](_0x98fd1c[_0xfff0('0x30')][_0xfff0('0x1e')]);_0x3a06f2[_0xfff0('0x1d')]=qs['offset'](_0x98fd1c[_0xfff0('0x30')][_0xfff0('0x1d')]);}_0x3a06f2[_0xfff0('0x39')]=qs['sort'](_0x98fd1c[_0xfff0('0x30')]['sort']);_0x3a06f2[_0xfff0('0x3a')]=qs[_0xfff0('0x32')](_[_0xfff0('0x3b')](_0x98fd1c[_0xfff0('0x30')],_0x394898[_0xfff0('0x32')]),_0xb144f4);if(_0x98fd1c[_0xfff0('0x30')][_0xfff0('0x3c')]){_0x3a06f2['where']=_[_0xfff0('0x3d')](_0x3a06f2[_0xfff0('0x3a')],{'$or':_['map'](_0xb144f4,function(_0x3a0a83){if(_0x3a0a83[_0xfff0('0x2e')]!=='VIRTUAL'){var _0x3b86d={};_0x3b86d[_0x3a0a83[_0xfff0('0x28')]]={'$like':'%'+_0x98fd1c[_0xfff0('0x30')][_0xfff0('0x3c')]+'%'};return _0x3b86d;}})});}_0x3a06f2=_[_0xfff0('0x3d')]({},_0x3a06f2,_0x98fd1c[_0xfff0('0x3e')]);var _0x16426f={'where':_0x3a06f2[_0xfff0('0x3a')]};return db[_0xfff0('0x2b')][_0xfff0('0x1c')](_0x16426f)[_0xfff0('0x24')](function(_0x2612b9){_0x7102b2['count']=_0x2612b9;if(_0x98fd1c[_0xfff0('0x30')]['includeAll']){_0x3a06f2[_0xfff0('0x3f')]=[{'all':!![]}];}return db['Automation'][_0xfff0('0x40')](_0x3a06f2);})[_0xfff0('0x24')](function(_0x76006d){_0x7102b2[_0xfff0('0x41')]=_0x76006d;return _0x7102b2;})[_0xfff0('0x24')](respondWithFilteredResult(_0x3dce43,_0x3a06f2))['catch'](handleError(_0x3dce43,null));};exports[_0xfff0('0x42')]=function(_0x1e6d59,_0x4c707c){var _0x2e228f={'raw':![],'where':{'id':_0x1e6d59[_0xfff0('0x43')]['id']}},_0x3444ca={};_0x3444ca[_0xfff0('0x44')]=_[_0xfff0('0x31')](db['Automation']['rawAttributes']);_0x3444ca[_0xfff0('0x30')]=_[_0xfff0('0x31')](_0x1e6d59[_0xfff0('0x30')]);_0x3444ca[_0xfff0('0x32')]=_[_0xfff0('0x33')](_0x3444ca[_0xfff0('0x44')],_0x3444ca['query']);_0x2e228f[_0xfff0('0x34')]=_['intersection'](_0x3444ca[_0xfff0('0x44')],qs[_0xfff0('0x35')](_0x1e6d59[_0xfff0('0x30')][_0xfff0('0x35')]));_0x2e228f[_0xfff0('0x34')]=_0x2e228f[_0xfff0('0x34')]['length']?_0x2e228f['attributes']:_0x3444ca[_0xfff0('0x44')];if(_0x1e6d59['query']['includeAll']){_0x2e228f[_0xfff0('0x3f')]=[{'all':!![]}];}_0x2e228f=_[_0xfff0('0x3d')]({},_0x2e228f,_0x1e6d59[_0xfff0('0x3e')]);return db[_0xfff0('0x2b')]['find'](_0x2e228f)[_0xfff0('0x24')](handleEntityNotFound(_0x4c707c,null))[_0xfff0('0x24')](respondWithResult(_0x4c707c,null))[_0xfff0('0x45')](handleError(_0x4c707c,null));};exports['create']=function(_0x43bc60,_0x5aa2cf){return db[_0xfff0('0x2b')]['create'](_0x43bc60[_0xfff0('0x46')],{})[_0xfff0('0x24')](respondWithResult(_0x5aa2cf,0xc9))['catch'](handleError(_0x5aa2cf,null));};exports[_0xfff0('0x47')]=function(_0x40d36f,_0x37c83e){if(_0x40d36f[_0xfff0('0x46')]['id']){delete _0x40d36f[_0xfff0('0x46')]['id'];}return db[_0xfff0('0x2b')][_0xfff0('0x48')]({'where':{'id':_0x40d36f['params']['id']}})[_0xfff0('0x24')](handleEntityNotFound(_0x37c83e,null))[_0xfff0('0x24')](saveUpdates(_0x40d36f[_0xfff0('0x46')],null))[_0xfff0('0x24')](respondWithResult(_0x37c83e,null))[_0xfff0('0x45')](handleError(_0x37c83e,null));};exports[_0xfff0('0x25')]=function(_0x530259,_0x30d0a7){return db[_0xfff0('0x2b')]['find']({'where':{'id':_0x530259[_0xfff0('0x43')]['id']}})[_0xfff0('0x24')](handleEntityNotFound(_0x30d0a7,null))['then'](removeEntity(_0x30d0a7,null))[_0xfff0('0x45')](handleError(_0x30d0a7,null));};exports[_0xfff0('0x49')]=function(_0x1478a6,_0x4a5073,_0x1c197b){return db[_0xfff0('0x4a')][_0xfff0('0x48')]({'where':{'id':_0x1478a6[_0xfff0('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a5073,null))[_0xfff0('0x24')](function(_0x78948b){if(_0x78948b){return _0x78948b[_0xfff0('0x49')](_0x1478a6[_0xfff0('0x46')][_0xfff0('0x4b')],_['omit'](_0x1478a6['body'],[_0xfff0('0x4b'),'id'])||{});}})[_0xfff0('0x24')](respondWithResult(_0x4a5073,null))['catch'](handleError(_0x4a5073,null));};exports['getConditions']=function(_0x5d9643,_0x18c333,_0x4bea86){var _0x150a4e={};var _0x3abe71={};var _0x40e5e1;var _0x4468dc;return db[_0xfff0('0x2b')]['findOne']({'where':{'id':_0x5d9643[_0xfff0('0x43')]['id']}})[_0xfff0('0x24')](handleEntityNotFound(_0x18c333,null))[_0xfff0('0x24')](function(_0x20f18e){if(_0x20f18e){_0x40e5e1=_0x20f18e;_0x3abe71[_0xfff0('0x44')]=_[_0xfff0('0x31')](db[_0xfff0('0x4a')][_0xfff0('0x2c')]);_0x3abe71[_0xfff0('0x30')]=_[_0xfff0('0x31')](_0x5d9643['query']);_0x3abe71[_0xfff0('0x32')]=_['intersection'](_0x3abe71['model'],_0x3abe71[_0xfff0('0x30')]);_0x150a4e['attributes']=_['intersection'](_0x3abe71['model'],qs[_0xfff0('0x35')](_0x5d9643[_0xfff0('0x30')][_0xfff0('0x35')]));_0x150a4e[_0xfff0('0x34')]=_0x150a4e[_0xfff0('0x34')][_0xfff0('0x36')]?_0x150a4e[_0xfff0('0x34')]:_0x3abe71[_0xfff0('0x44')];_0x150a4e[_0xfff0('0x39')]=qs[_0xfff0('0x4c')](_0x5d9643[_0xfff0('0x30')][_0xfff0('0x4c')]);_0x150a4e[_0xfff0('0x3a')]=qs[_0xfff0('0x32')](_[_0xfff0('0x3b')](_0x5d9643['query'],_0x3abe71['filters']));if(_0x5d9643[_0xfff0('0x30')][_0xfff0('0x3c')]){_0x150a4e[_0xfff0('0x3a')]=_[_0xfff0('0x3d')](_0x150a4e['where'],{'$or':_[_0xfff0('0x2a')](_0x150a4e[_0xfff0('0x34')],function(_0x57bb37){var _0x32e785={};_0x32e785[_0x57bb37]={'$like':'%'+_0x5d9643[_0xfff0('0x30')][_0xfff0('0x3c')]+'%'};return _0x32e785;})});}_0x150a4e=_['merge']({},_0x150a4e,_0x5d9643[_0xfff0('0x3e')]);return _0x40e5e1['getConditions'](_0x150a4e);}})[_0xfff0('0x24')](function(_0x363692){if(_0x363692){_0x4468dc=_0x363692[_0xfff0('0x36')];if(!_0x5d9643['query']['hasOwnProperty'](_0xfff0('0x38'))){_0x150a4e[_0xfff0('0x1e')]=qs[_0xfff0('0x1e')](_0x5d9643['query'][_0xfff0('0x1e')]);_0x150a4e['offset']=qs[_0xfff0('0x1d')](_0x5d9643[_0xfff0('0x30')][_0xfff0('0x1d')]);}return _0x40e5e1[_0xfff0('0x4d')](_0x150a4e);}})[_0xfff0('0x24')](function(_0x2abe66){if(_0x2abe66){return _0x2abe66?{'count':_0x4468dc,'rows':_0x2abe66}:null;}})[_0xfff0('0x24')](respondWithResult(_0x18c333,null))[_0xfff0('0x45')](handleError(_0x18c333,null));};exports['addActions']=function(_0x59a566,_0x3efff9,_0x4a9dc9){return db[_0xfff0('0x4e')][_0xfff0('0x48')]({'where':{'id':_0x59a566['params']['id']}})[_0xfff0('0x24')](handleEntityNotFound(_0x3efff9,null))[_0xfff0('0x24')](function(_0x2b82a5){if(_0x2b82a5){return _0x2b82a5[_0xfff0('0x4f')](_0x59a566[_0xfff0('0x46')][_0xfff0('0x4b')],_['omit'](_0x59a566[_0xfff0('0x46')],['ids','id'])||{});}})[_0xfff0('0x24')](respondWithResult(_0x3efff9,null))[_0xfff0('0x45')](handleError(_0x3efff9,null));};exports[_0xfff0('0x50')]=function(_0x3ebd6c,_0x43f6c8,_0x538c3a){var _0x5b70e1={};var _0x5f3014={};var _0x4aad04;var _0x183ebd;return db[_0xfff0('0x2b')][_0xfff0('0x51')]({'where':{'id':_0x3ebd6c[_0xfff0('0x43')]['id']}})[_0xfff0('0x24')](handleEntityNotFound(_0x43f6c8,null))['then'](function(_0x52ed6c){if(_0x52ed6c){_0x4aad04=_0x52ed6c;_0x5f3014[_0xfff0('0x44')]=_['keys'](db['Action'][_0xfff0('0x2c')]);_0x5f3014[_0xfff0('0x30')]=_['keys'](_0x3ebd6c['query']);_0x5f3014['filters']=_['intersection'](_0x5f3014['model'],_0x5f3014[_0xfff0('0x30')]);_0x5b70e1['attributes']=_[_0xfff0('0x33')](_0x5f3014[_0xfff0('0x44')],qs[_0xfff0('0x35')](_0x3ebd6c[_0xfff0('0x30')][_0xfff0('0x35')]));_0x5b70e1['attributes']=_0x5b70e1[_0xfff0('0x34')][_0xfff0('0x36')]?_0x5b70e1[_0xfff0('0x34')]:_0x5f3014[_0xfff0('0x44')];_0x5b70e1[_0xfff0('0x39')]=qs['sort'](_0x3ebd6c['query']['sort']);_0x5b70e1[_0xfff0('0x3a')]=qs[_0xfff0('0x32')](_['pick'](_0x3ebd6c[_0xfff0('0x30')],_0x5f3014['filters']));if(_0x3ebd6c[_0xfff0('0x30')][_0xfff0('0x3c')]){_0x5b70e1[_0xfff0('0x3a')]=_['merge'](_0x5b70e1['where'],{'$or':_[_0xfff0('0x2a')](_0x5b70e1['attributes'],function(_0x3856b6){var _0x1c3734={};_0x1c3734[_0x3856b6]={'$like':'%'+_0x3ebd6c[_0xfff0('0x30')][_0xfff0('0x3c')]+'%'};return _0x1c3734;})});}_0x5b70e1=_[_0xfff0('0x3d')]({},_0x5b70e1,_0x3ebd6c[_0xfff0('0x3e')]);return _0x4aad04['getActions'](_0x5b70e1);}})[_0xfff0('0x24')](function(_0x1ff0fa){if(_0x1ff0fa){_0x183ebd=_0x1ff0fa[_0xfff0('0x36')];if(!_0x3ebd6c[_0xfff0('0x30')][_0xfff0('0x37')]('nolimit')){_0x5b70e1[_0xfff0('0x1e')]=qs['limit'](_0x3ebd6c['query']['limit']);_0x5b70e1['offset']=qs[_0xfff0('0x1d')](_0x3ebd6c[_0xfff0('0x30')]['offset']);}return _0x4aad04[_0xfff0('0x50')](_0x5b70e1);}})['then'](function(_0xcb0046){if(_0xcb0046){return _0xcb0046?{'count':_0x183ebd,'rows':_0xcb0046}:null;}})['then'](respondWithResult(_0x43f6c8,null))[_0xfff0('0x45')](handleError(_0x43f6c8,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index dc31d71..cb33b63 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 _0x4c4e=['moment','request-promise','path','rimraf','./automation.attributes','define','Automation','tools_automations','lodash','../../config/logger','api'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4c4e,0x152));var _0xe4c4=function(_0x5da346,_0x5d7736){_0x5da346=_0x5da346-0x0;var _0x56bc09=_0x4c4e[_0x5da346];return _0x56bc09;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var logger=require(_0xe4c4('0x1'))(_0xe4c4('0x2'));var moment=require(_0xe4c4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4c4('0x4'));var fs=require('fs');var path=require(_0xe4c4('0x5'));var rimraf=require(_0xe4c4('0x6'));var config=require('../../config/environment');var attributes=require(_0xe4c4('0x7'));module['exports']=function(_0x177732,_0x1a12a6){return _0x177732[_0xe4c4('0x8')](_0xe4c4('0x9'),attributes,{'tableName':_0xe4c4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Automation','tools_automations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6aa7,0x178));var _0x76aa=function(_0x3c40e0,_0x308c01){_0x3c40e0=_0x3c40e0-0x0;var _0xd9449b=_0x6aa7[_0x3c40e0];return _0xd9449b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 8310963..ecf0368 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 _0xb50c=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x42b3aa,_0x223f53){var _0x319157=function(_0x4e5c40){while(--_0x4e5c40){_0x42b3aa['push'](_0x42b3aa['shift']());}};_0x319157(++_0x223f53);}(_0xb50c,0x1e7));var _0xcb50=function(_0x1983ec,_0x2aa4a2){_0x1983ec=_0x1983ec-0x0;var _0x46d9dc=_0xb50c[_0x1983ec];return _0x46d9dc;};'use strict';var _=require(_0xcb50('0x0'));var util=require(_0xcb50('0x1'));var moment=require('moment');var BPromise=require(_0xcb50('0x2'));var rs=require(_0xcb50('0x3'));var fs=require('fs');var Redis=require(_0xcb50('0x4'));var db=require(_0xcb50('0x5'))['db'];var utils=require(_0xcb50('0x6'));var logger=require('../../config/logger')(_0xcb50('0x7'));var config=require(_0xcb50('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcb50('0x9')][_0xcb50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x575c73,_0x34b3b7,_0x19c8b4){return new BPromise(function(_0x2adcad,_0x1dc8c8){return client[_0xcb50('0xb')](_0x575c73,_0x19c8b4)['then'](function(_0x68b094){logger['info'](_0xcb50('0xc'),_0x34b3b7,_0xcb50('0xd'));logger[_0xcb50('0xe')](_0xcb50('0xf'),_0x34b3b7,_0xcb50('0xd'),JSON[_0xcb50('0x10')](_0x68b094));if(_0x68b094[_0xcb50('0x11')]){if(_0x68b094[_0xcb50('0x11')][_0xcb50('0x12')]===0x1f4){logger[_0xcb50('0x11')](_0xcb50('0xc'),_0x34b3b7,_0x68b094[_0xcb50('0x11')][_0xcb50('0x13')]);return _0x1dc8c8(_0x68b094['error'][_0xcb50('0x13')]);}logger[_0xcb50('0x11')](_0xcb50('0xc'),_0x34b3b7,_0x68b094[_0xcb50('0x11')][_0xcb50('0x13')]);return _0x2adcad(_0x68b094[_0xcb50('0x11')][_0xcb50('0x13')]);}else{logger['info'](_0xcb50('0xc'),_0x34b3b7,'request\x20sent');_0x2adcad(_0x68b094[_0xcb50('0x14')][_0xcb50('0x13')]);}})[_0xcb50('0x15')](function(_0x9891f7){logger[_0xcb50('0x11')](_0xcb50('0xc'),_0x34b3b7,_0x9891f7);_0x1dc8c8(_0x9891f7);});});} \ No newline at end of file +var _0x3162=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x328fe8,_0x3959b4){var _0x28eab1=function(_0x5b2053){while(--_0x5b2053){_0x328fe8['push'](_0x328fe8['shift']());}};_0x28eab1(++_0x3959b4);}(_0x3162,0x18e));var _0x2316=function(_0x41e3e5,_0x441240){_0x41e3e5=_0x41e3e5-0x0;var _0x4b5b5c=_0x3162[_0x41e3e5];return _0x4b5b5c;};'use strict';var _=require(_0x2316('0x0'));var util=require(_0x2316('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2316('0x2'));var fs=require('fs');var Redis=require(_0x2316('0x3'));var db=require(_0x2316('0x4'))['db'];var utils=require(_0x2316('0x5'));var logger=require(_0x2316('0x6'))(_0x2316('0x7'));var config=require('../../config/environment');var jayson=require(_0x2316('0x8'));var client=jayson[_0x2316('0x9')][_0x2316('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44407a,_0x5e6384,_0x27677e){return new BPromise(function(_0x3a80a5,_0x22ff68){return client[_0x2316('0xb')](_0x44407a,_0x27677e)['then'](function(_0x557b30){logger[_0x2316('0xc')](_0x2316('0xd'),_0x5e6384,'request\x20sent');logger[_0x2316('0xe')](_0x2316('0xf'),_0x5e6384,_0x2316('0x10'),JSON[_0x2316('0x11')](_0x557b30));if(_0x557b30[_0x2316('0x12')]){if(_0x557b30['error']['code']===0x1f4){logger[_0x2316('0x12')](_0x2316('0xd'),_0x5e6384,_0x557b30[_0x2316('0x12')][_0x2316('0x13')]);return _0x22ff68(_0x557b30[_0x2316('0x12')]['message']);}logger[_0x2316('0x12')](_0x2316('0xd'),_0x5e6384,_0x557b30['error']['message']);return _0x3a80a5(_0x557b30[_0x2316('0x12')][_0x2316('0x13')]);}else{logger[_0x2316('0xc')](_0x2316('0xd'),_0x5e6384,_0x2316('0x10'));_0x3a80a5(_0x557b30[_0x2316('0x14')]['message']);}})[_0x2316('0x15')](function(_0x234e4f){logger[_0x2316('0x12')]('Automation,\x20%s,\x20%s',_0x5e6384,_0x234e4f);_0x22ff68(_0x234e4f);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index aa99ce2..affa529 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 _0x1f8e=['getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/conditions'];(function(_0x1debff,_0xa65acd){var _0x401f8c=function(_0x2dbbec){while(--_0x2dbbec){_0x1debff['push'](_0x1debff['shift']());}};_0x401f8c(++_0xa65acd);}(_0x1f8e,0xa4));var _0xe1f8=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1f8e[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xe1f8('0x0'));var util=require(_0xe1f8('0x1'));var path=require(_0xe1f8('0x2'));var timeout=require(_0xe1f8('0x3'));var express=require(_0xe1f8('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe1f8('0x5'));var config=require(_0xe1f8('0x6'));var controller=require('./automation.controller');router[_0xe1f8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe1f8('0x7')](_0xe1f8('0x8'),auth[_0xe1f8('0x9')](),controller[_0xe1f8('0xa')]);router['get'](_0xe1f8('0xb'),auth[_0xe1f8('0x9')](),controller[_0xe1f8('0xc')]);router['get'](_0xe1f8('0xd'),auth[_0xe1f8('0x9')](),controller[_0xe1f8('0xe')]);router[_0xe1f8('0xf')]('/',auth[_0xe1f8('0x9')](),controller['create']);router[_0xe1f8('0xf')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xe1f8('0x10')]);router[_0xe1f8('0xf')](_0xe1f8('0xd'),auth[_0xe1f8('0x9')](),controller[_0xe1f8('0x11')]);router[_0xe1f8('0x12')](_0xe1f8('0x8'),auth['isAuthenticated'](),controller[_0xe1f8('0x13')]);router[_0xe1f8('0x14')]('/:id',auth[_0xe1f8('0x9')](),controller['destroy']);module[_0xe1f8('0x15')]=router; \ No newline at end of file +var _0x3080=['/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2151d7,_0x2f0103){var _0x28c45b=function(_0x280eaa){while(--_0x280eaa){_0x2151d7['push'](_0x2151d7['shift']());}};_0x28c45b(++_0x2f0103);}(_0x3080,0x1e6));var _0x0308=function(_0x10b615,_0x20b8e4){_0x10b615=_0x10b615-0x0;var _0xd9c301=_0x3080[_0x10b615];return _0xd9c301;};'use strict';var multer=require(_0x0308('0x0'));var util=require(_0x0308('0x1'));var path=require(_0x0308('0x2'));var timeout=require(_0x0308('0x3'));var express=require('express');var router=express[_0x0308('0x4')]();var auth=require(_0x0308('0x5'));var interaction=require(_0x0308('0x6'));var config=require(_0x0308('0x7'));var controller=require(_0x0308('0x8'));router[_0x0308('0x9')]('/',auth['isAuthenticated'](),controller[_0x0308('0xa')]);router['get'](_0x0308('0xb'),auth[_0x0308('0xc')](),controller[_0x0308('0xd')]);router['get'](_0x0308('0xe'),auth[_0x0308('0xc')](),controller[_0x0308('0xf')]);router[_0x0308('0x9')](_0x0308('0x10'),auth[_0x0308('0xc')](),controller['getActions']);router[_0x0308('0x11')]('/',auth['isAuthenticated'](),controller[_0x0308('0x12')]);router[_0x0308('0x11')](_0x0308('0xe'),auth[_0x0308('0xc')](),controller[_0x0308('0x13')]);router[_0x0308('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0x0308('0x14')]);router[_0x0308('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x0308('0x16')]);router['delete'](_0x0308('0xb'),auth[_0x0308('0xc')](),controller[_0x0308('0x17')]);module[_0x0308('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e02e342..51ea50c 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 _0xf394=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','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','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1dc93f,_0x2df6d2){var _0x5a8b02=function(_0x1002cd){while(--_0x1002cd){_0x1dc93f['push'](_0x1dc93f['shift']());}};_0x5a8b02(++_0x2df6d2);}(_0xf394,0x99));var _0x4f39=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf394[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x4f39('0x0'));module[_0x4f39('0x1')]={'name':{'type':Sequelize[_0x4f39('0x2')],'unique':_0x4f39('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4f39('0x4')](_0x4f39('0x5')),'allowNull':![],'defaultValue':_0x4f39('0x5')},'description':{'type':Sequelize[_0x4f39('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4f39('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x4f39('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4f39('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4f39('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x4f39('0x9')](0x3)[_0x4f39('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x4f39('0x9')](0x3)[_0x4f39('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f39('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f39('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x4f39('0x9')](0x3)[_0x4f39('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f39('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4f39('0x9')](0x5)[_0x4f39('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f39('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4f39('0x9')](0x3)[_0x4f39('0x7')],'defaultValue':0x3,'comment':_0x4f39('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f39('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f39('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4f39('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4f39('0xf')},'dialTimezone':{'type':Sequelize[_0x4f39('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4f39('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x4f39('0x4')]('always',_0x4f39('0x10'),_0x4f39('0x11')),'defaultValue':_0x4f39('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4f39('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x4f39('0x9')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x4f39('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4f39('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4f39('0x9')](0x9)[_0x4f39('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4f39('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4f39('0x9')](0x9)[_0x4f39('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4f39('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4f39('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4f39('0x9')](0x9)[_0x4f39('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4f39('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4f39('0x9')](0x9)[_0x4f39('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4f39('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4f39('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4f39('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4f39('0x9')](0x9)[_0x4f39('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4f39('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4f39('0x4')](_0x4f39('0x1c'),'ASC'),'defaultValue':_0x4f39('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4f39('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x4f39('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4f39('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4f39('0x9')](0x3)[_0x4f39('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f39('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4f39('0x9')](0x5)[_0x4f39('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f39('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x4f39('0x9')](0x3)[_0x4f39('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f39('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f39('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f39('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4f39('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f39('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x4f39('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f39('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f39('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f39('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](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 _0xda89=['UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.'];(function(_0x1e3158,_0x2c9751){var _0x4bd943=function(_0x315087){while(--_0x315087){_0x1e3158['push'](_0x1e3158['shift']());}};_0x4bd943(++_0x2c9751);}(_0xda89,0x10a));var _0x9da8=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xda89[_0x172747];return _0x509692;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9da8('0x0')],'unique':_0x9da8('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x9da8('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x9da8('0x0')]},'active':{'type':Sequelize[_0x9da8('0x3')],'defaultValue':0x0,'comment':_0x9da8('0x4')},'limitCalls':{'type':Sequelize[_0x9da8('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9da8('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9da8('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9da8('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9da8('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9da8('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9da8('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9da8('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9da8('0x5')](0x5)[_0x9da8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9da8('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9da8('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9da8('0x5')](0x5)[_0x9da8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9da8('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9da8('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x9da8('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x9da8('0xf')](_0x9da8('0x10'),_0x9da8('0x11'),_0x9da8('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9da8('0x3')],'defaultValue':0x0,'comment':_0x9da8('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x9da8('0x5')](0x9)[_0x9da8('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9da8('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x9da8('0x5')](0x9)[_0x9da8('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9da8('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9da8('0x5')](0x9)[_0x9da8('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9da8('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9da8('0x5')](0x9)[_0x9da8('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9da8('0x5')](0x9)[_0x9da8('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9da8('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9da8('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9da8('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9da8('0x5')](0x9)[_0x9da8('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9da8('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9da8('0x5')](0x5)[_0x9da8('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9da8('0x5')](0x9)[_0x9da8('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9da8('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9da8('0xf')](_0x9da8('0x1b'),'ASC'),'defaultValue':_0x9da8('0x1b')},'dialPrefix':{'type':Sequelize[_0x9da8('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9da8('0x1c')},'dialCutDigit':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9da8('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9da8('0x5')](0x5)[_0x9da8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9da8('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9da8('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x9da8('0x5')](0x5)[_0x9da8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9da8('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9da8('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9da8('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9da8('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9da8('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9da8('0x5')](0x5)[_0x9da8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9da8('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9da8('0x5')](0x3)[_0x9da8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9da8('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9da8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9da8('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 84d8465..c172434 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 _0xd2ec=['include','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','merge','updatedAt','body','createdAt','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','findAll','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','omit','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','ContactId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','ListId','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','update','then','destroy','get','error','stack','send','index','Campaign','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','name','options','count','includeAll'];(function(_0x40501e,_0x4b1465){var _0xb6f2a8=function(_0x175044){while(--_0x175044){_0x40501e['push'](_0x40501e['shift']());}};_0xb6f2a8(++_0x4b1465);}(_0xd2ec,0x150));var _0xcd2e=function(_0x373db9,_0x5819cd){_0x373db9=_0x373db9-0x0;var _0x3b423f=_0xd2ec[_0x373db9];return _0x3b423f;};'use strict';var pdf=require(_0xcd2e('0x0'));var emlformat=require(_0xcd2e('0x1'));var rimraf=require(_0xcd2e('0x2'));var zipdir=require(_0xcd2e('0x3'));var jsonpatch=require(_0xcd2e('0x4'));var rp=require(_0xcd2e('0x5'));var moment=require(_0xcd2e('0x6'));var BPromise=require(_0xcd2e('0x7'));var Mustache=require(_0xcd2e('0x8'));var util=require(_0xcd2e('0x9'));var path=require(_0xcd2e('0xa'));var sox=require(_0xcd2e('0xb'));var csv=require(_0xcd2e('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd2e('0xd'));var squel=require(_0xcd2e('0xe'));var crypto=require('crypto');var jsforce=require(_0xcd2e('0xf'));var deskjs=require(_0xcd2e('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcd2e('0x11'));var Redis=require(_0xcd2e('0x12'));var authService=require(_0xcd2e('0x13'));var qs=require(_0xcd2e('0x14'));var as=require(_0xcd2e('0x15'));var hardwareService=require(_0xcd2e('0x16'));var logger=require('../../config/logger')(_0xcd2e('0x17'));var utils=require(_0xcd2e('0x18'));var config=require(_0xcd2e('0x19'));var db=require(_0xcd2e('0x1a'))['db'];function respondWithStatusCode(_0x283ddd,_0x2dd6f9){_0x2dd6f9=_0x2dd6f9||0xcc;return function(_0x1baa40){if(_0x1baa40){return _0x283ddd[_0xcd2e('0x1b')](_0x2dd6f9);}return _0x283ddd['status'](_0x2dd6f9)[_0xcd2e('0x1c')]();};}function respondWithResult(_0x100dd2,_0x4ddabe){_0x4ddabe=_0x4ddabe||0xc8;return function(_0x349977){if(_0x349977){return _0x100dd2[_0xcd2e('0x1d')](_0x4ddabe)[_0xcd2e('0x1e')](_0x349977);}};}function respondWithFilteredResult(_0x1fac6,_0x34f06f){return function(_0x41e220){if(_0x41e220){var _0x500f94=_0x41e220['count'],_0x43a0fd=_0x34f06f['offset'],_0x9ca35f=_0x34f06f[_0xcd2e('0x1f')]+_0x34f06f[_0xcd2e('0x20')],_0x1a9a42;if(_0x9ca35f>=_0x500f94){_0x9ca35f=_0x500f94;_0x1a9a42=0xc8;}else{_0x1a9a42=0xce;}_0x1fac6[_0xcd2e('0x1d')](_0x1a9a42);return _0x1fac6[_0xcd2e('0x21')]('Content-Range',_0x43a0fd+'-'+_0x9ca35f+'/'+_0x500f94)['json'](_0x41e220);}return null;};}function patchUpdates(_0x26d623){return function(_0x4f4a41){try{jsonpatch['apply'](_0x4f4a41,_0x26d623,!![]);}catch(_0x1fb1c9){return BPromise['reject'](_0x1fb1c9);}return _0x4f4a41['save']();};}function saveUpdates(_0x3b38dc,_0x223339){return function(_0xaaca44){if(_0xaaca44){return _0xaaca44[_0xcd2e('0x22')](_0x3b38dc)[_0xcd2e('0x23')](function(_0xe4a607){return _0xe4a607;});}return null;};}function removeEntity(_0xebacf3,_0x3bccf5){return function(_0x438496){if(_0x438496){return _0x438496[_0xcd2e('0x24')]()[_0xcd2e('0x23')](function(){var _0x23ad69=_0x438496[_0xcd2e('0x25')]({'plain':!![]});var _0x3ab12f='IvrCampaigns';return db['UserProfileResource'][_0xcd2e('0x24')]({'where':{'type':_0x3ab12f,'resourceId':_0x23ad69['id']}})[_0xcd2e('0x23')](function(){return _0x438496;});})[_0xcd2e('0x23')](function(){_0xebacf3[_0xcd2e('0x1d')](0xcc)[_0xcd2e('0x1c')]();});}};}function handleEntityNotFound(_0x412c00,_0x46adfc){return function(_0x3340e1){if(!_0x3340e1){_0x412c00['sendStatus'](0x194);}return _0x3340e1;};}function handleError(_0x5eaeab,_0x1ec3d9){_0x1ec3d9=_0x1ec3d9||0x1f4;return function(_0x2aff7d){logger[_0xcd2e('0x26')](_0x2aff7d[_0xcd2e('0x27')]);if(_0x2aff7d['name']){delete _0x2aff7d['name'];}_0x5eaeab[_0xcd2e('0x1d')](_0x1ec3d9)[_0xcd2e('0x28')](_0x2aff7d);};}exports[_0xcd2e('0x29')]=function(_0x575d93,_0x182888){var _0xc983c={},_0x557ff9={},_0x2d97b2={'count':0x0,'rows':[]};var _0x53b41d=_['map'](db[_0xcd2e('0x2a')]['rawAttributes'],function(_0x5a8827){return{'name':_0x5a8827[_0xcd2e('0x2b')],'type':_0x5a8827[_0xcd2e('0x2c')][_0xcd2e('0x2d')]};});_0x557ff9[_0xcd2e('0x2e')]=_[_0xcd2e('0x2f')](_0x53b41d,'name');_0x557ff9['query']=_[_0xcd2e('0x30')](_0x575d93[_0xcd2e('0x31')]);_0x557ff9['filters']=_[_0xcd2e('0x32')](_0x557ff9[_0xcd2e('0x2e')],_0x557ff9[_0xcd2e('0x31')]);_0xc983c[_0xcd2e('0x33')]=_['intersection'](_0x557ff9[_0xcd2e('0x2e')],qs[_0xcd2e('0x34')](_0x575d93[_0xcd2e('0x31')]['fields']));_0xc983c[_0xcd2e('0x33')]=_0xc983c[_0xcd2e('0x33')][_0xcd2e('0x35')]?_0xc983c[_0xcd2e('0x33')]:_0x557ff9[_0xcd2e('0x2e')];if(!_0x575d93[_0xcd2e('0x31')]['hasOwnProperty'](_0xcd2e('0x36'))){_0xc983c[_0xcd2e('0x20')]=qs[_0xcd2e('0x20')](_0x575d93[_0xcd2e('0x31')]['limit']);_0xc983c[_0xcd2e('0x1f')]=qs['offset'](_0x575d93['query']['offset']);}_0xc983c[_0xcd2e('0x37')]=qs[_0xcd2e('0x38')](_0x575d93[_0xcd2e('0x31')][_0xcd2e('0x38')]);_0xc983c[_0xcd2e('0x39')]=qs[_0xcd2e('0x3a')](_[_0xcd2e('0x3b')](_0x575d93['query'],_0x557ff9[_0xcd2e('0x3a')]),_0x53b41d);if(_0x575d93[_0xcd2e('0x31')][_0xcd2e('0x3c')]){_0xc983c['where']=_['merge'](_0xc983c[_0xcd2e('0x39')],{'$or':_[_0xcd2e('0x2f')](_0x53b41d,function(_0x53ef00){if(_0x53ef00[_0xcd2e('0x2c')]!==_0xcd2e('0x3d')){var _0x1ea5dd={};_0x1ea5dd[_0x53ef00[_0xcd2e('0x3e')]]={'$like':'%'+_0x575d93['query']['filter']+'%'};return _0x1ea5dd;}})});}_0xc983c=_['merge']({},_0xc983c,_0x575d93[_0xcd2e('0x3f')]);var _0x2a0be8={'where':_0xc983c[_0xcd2e('0x39')]};return db[_0xcd2e('0x2a')]['count'](_0x2a0be8)['then'](function(_0x184f47){_0x2d97b2[_0xcd2e('0x40')]=_0x184f47;if(_0x575d93[_0xcd2e('0x31')][_0xcd2e('0x41')]){_0xc983c[_0xcd2e('0x42')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0xc983c);})[_0xcd2e('0x23')](function(_0x41d1d0){_0x2d97b2[_0xcd2e('0x43')]=_0x41d1d0;return _0x2d97b2;})[_0xcd2e('0x23')](respondWithFilteredResult(_0x182888,_0xc983c))[_0xcd2e('0x44')](handleError(_0x182888,null));};exports[_0xcd2e('0x45')]=function(_0x417bdc,_0x1b387a){var _0x4350f1={'raw':![],'where':{'id':_0x417bdc[_0xcd2e('0x46')]['id']}},_0x406f54={};_0x406f54[_0xcd2e('0x2e')]=_[_0xcd2e('0x30')](db[_0xcd2e('0x2a')][_0xcd2e('0x47')]);_0x406f54[_0xcd2e('0x31')]=_['keys'](_0x417bdc[_0xcd2e('0x31')]);_0x406f54[_0xcd2e('0x3a')]=_[_0xcd2e('0x32')](_0x406f54[_0xcd2e('0x2e')],_0x406f54['query']);_0x4350f1['attributes']=_[_0xcd2e('0x32')](_0x406f54[_0xcd2e('0x2e')],qs[_0xcd2e('0x34')](_0x417bdc[_0xcd2e('0x31')][_0xcd2e('0x34')]));_0x4350f1[_0xcd2e('0x33')]=_0x4350f1[_0xcd2e('0x33')][_0xcd2e('0x35')]?_0x4350f1[_0xcd2e('0x33')]:_0x406f54[_0xcd2e('0x2e')];if(_0x417bdc[_0xcd2e('0x31')][_0xcd2e('0x41')]){_0x4350f1[_0xcd2e('0x42')]=[{'all':!![]}];}_0x4350f1=_['merge']({},_0x4350f1,_0x417bdc[_0xcd2e('0x3f')]);return db[_0xcd2e('0x2a')][_0xcd2e('0x48')](_0x4350f1)[_0xcd2e('0x23')](handleEntityNotFound(_0x1b387a,null))[_0xcd2e('0x23')](respondWithResult(_0x1b387a,null))[_0xcd2e('0x44')](handleError(_0x1b387a,null));};exports[_0xcd2e('0x49')]=function(_0x5a0296,_0x4e7b24){return db['Campaign']['create'](_0x5a0296['body'],{})['then'](function(_0x427c7f){var _0x433eaa=_0x5a0296[_0xcd2e('0x4a')][_0xcd2e('0x25')]({'plain':!![]});if(!_0x433eaa)throw new Error(_0xcd2e('0x4b'));if(_0x433eaa[_0xcd2e('0x4c')]===_0xcd2e('0x4a')){var _0x3cded4=_0x427c7f[_0xcd2e('0x25')]({'plain':!![]});var _0x4464bd=_0xcd2e('0x4d');return db[_0xcd2e('0x4e')][_0xcd2e('0x48')]({'where':{'name':_0x4464bd,'userProfileId':_0x433eaa[_0xcd2e('0x4f')]},'raw':!![]})[_0xcd2e('0x23')](function(_0x174ddd){if(_0x174ddd&&_0x174ddd[_0xcd2e('0x50')]===0x0){return db[_0xcd2e('0x51')][_0xcd2e('0x49')]({'name':_0x3cded4[_0xcd2e('0x3e')],'resourceId':_0x3cded4['id'],'type':_0x174ddd[_0xcd2e('0x3e')],'sectionId':_0x174ddd['id']},{})[_0xcd2e('0x23')](function(){return _0x427c7f;});}else{return _0x427c7f;}})[_0xcd2e('0x44')](function(_0x346904){logger['error'](_0xcd2e('0x52'),_0x346904);throw _0x346904;});}return _0x427c7f;})[_0xcd2e('0x23')](respondWithResult(_0x4e7b24,0xc9))['catch'](handleError(_0x4e7b24,null));};exports['clone']=function(_0x506cd5,_0x1c4071){var _0x1cfe60={'where':{'id':_0x506cd5[_0xcd2e('0x46')]['id']}},_0x1cf3bf={};_0x1cf3bf[_0xcd2e('0x2e')]=_['keys'](db[_0xcd2e('0x2a')]['rawAttributes']);_0x1cfe60[_0xcd2e('0x33')]=_[_0xcd2e('0x32')](_0x1cf3bf[_0xcd2e('0x2e')],qs[_0xcd2e('0x34')](_0x506cd5[_0xcd2e('0x31')][_0xcd2e('0x34')]));_0x1cfe60[_0xcd2e('0x33')]=_0x1cfe60['attributes'][_0xcd2e('0x35')]?_0x1cfe60['attributes']:_0x1cf3bf[_0xcd2e('0x2e')];if(_0x506cd5[_0xcd2e('0x31')]['includeAll']){_0x1cfe60[_0xcd2e('0x42')]=[{'all':!![]}];}_0x1cfe60=_[_0xcd2e('0x53')]({},_0x1cfe60,_0x506cd5[_0xcd2e('0x3f')]);return db[_0xcd2e('0x2a')][_0xcd2e('0x48')](_0x1cfe60)['then'](handleEntityNotFound(_0x1c4071,null))[_0xcd2e('0x23')](function(_0x5fd837){if(_0x5fd837){var _0x16b3f1=_0x5fd837[_0xcd2e('0x25')]({'plain':!![]});_0x16b3f1=qs['omit'](_0x16b3f1,['id','createdAt',_0xcd2e('0x54')]);_0x506cd5[_0xcd2e('0x55')]=_['omit'](_0x506cd5['body'],['id',_0xcd2e('0x56'),_0xcd2e('0x54')]);return db[_0xcd2e('0x2a')][_0xcd2e('0x49')](_[_0xcd2e('0x53')](_0x16b3f1,_0x506cd5[_0xcd2e('0x55')]),{'include':_0x506cd5[_0xcd2e('0x31')][_0xcd2e('0x41')]?[{'all':!![]}]:undefined})[_0xcd2e('0x23')](function(_0x2e0f71){var _0x41f92c=_0x506cd5['user'][_0xcd2e('0x25')]({'plain':!![]});if(!_0x41f92c)throw new Error(_0xcd2e('0x4b'));if(_0x41f92c[_0xcd2e('0x4c')]===_0xcd2e('0x4a')){var _0x5d6750=_0x2e0f71[_0xcd2e('0x25')]({'plain':!![]});var _0x1ef2fe='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x1ef2fe,'userProfileId':_0x41f92c[_0xcd2e('0x4f')]},'raw':!![]})['then'](function(_0x31d38a){if(_0x31d38a&&_0x31d38a[_0xcd2e('0x50')]===0x0){return db[_0xcd2e('0x51')]['create']({'name':_0x5d6750[_0xcd2e('0x3e')],'resourceId':_0x5d6750['id'],'type':_0x31d38a['name'],'sectionId':_0x31d38a['id']},{})[_0xcd2e('0x23')](function(){return _0x2e0f71;});}else{return _0x2e0f71;}})['catch'](function(_0x4d9dcd){logger['error'](_0xcd2e('0x52'),_0x4d9dcd);throw _0x4d9dcd;});}return _0x2e0f71;});}})[_0xcd2e('0x23')](respondWithResult(_0x1c4071,0xc9))[_0xcd2e('0x44')](handleError(_0x1c4071,null));};exports[_0xcd2e('0x22')]=function(_0x58179a,_0x21e948){if(_0x58179a[_0xcd2e('0x55')]['id']){delete _0x58179a[_0xcd2e('0x55')]['id'];}return db['Campaign'][_0xcd2e('0x48')]({'where':{'id':_0x58179a[_0xcd2e('0x46')]['id']}})[_0xcd2e('0x23')](handleEntityNotFound(_0x21e948,null))['then'](saveUpdates(_0x58179a[_0xcd2e('0x55')],null))[_0xcd2e('0x23')](respondWithResult(_0x21e948,null))['catch'](handleError(_0x21e948,null));};exports[_0xcd2e('0x24')]=function(_0x15bd91,_0x4c4536){return db['Campaign']['find']({'where':{'id':_0x15bd91['params']['id']}})['then'](handleEntityNotFound(_0x4c4536,null))[_0xcd2e('0x23')](removeEntity(_0x4c4536,null))[_0xcd2e('0x44')](handleError(_0x4c4536,null));};exports[_0xcd2e('0x57')]=function(_0x6cf8c4,_0x1049c2,_0x3bb8ec){var _0x141090={'raw':!![],'where':{}};var _0x5a148e={};var _0x18b5dc={'count':0x0,'rows':[]};return db['Campaign'][_0xcd2e('0x58')]({'where':{'id':_0x6cf8c4[_0xcd2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1049c2,null))[_0xcd2e('0x23')](function(_0x3d14aa){if(_0x3d14aa){_0x5a148e[_0xcd2e('0x2e')]=_['keys'](db[_0xcd2e('0x59')][_0xcd2e('0x47')]);_0x5a148e[_0xcd2e('0x31')]=_[_0xcd2e('0x30')](_0x6cf8c4['query']);_0x5a148e[_0xcd2e('0x3a')]=_[_0xcd2e('0x32')](_0x5a148e['model'],_0x5a148e['query']);_0x141090[_0xcd2e('0x33')]=_[_0xcd2e('0x32')](_0x5a148e[_0xcd2e('0x2e')],qs['fields'](_0x6cf8c4[_0xcd2e('0x31')][_0xcd2e('0x34')]));_0x141090[_0xcd2e('0x33')]=_0x141090['attributes'][_0xcd2e('0x35')]?_0x141090[_0xcd2e('0x33')]:_0x5a148e[_0xcd2e('0x2e')];if(!_0x6cf8c4[_0xcd2e('0x31')][_0xcd2e('0x5a')]('nolimit')){_0x141090[_0xcd2e('0x20')]=qs[_0xcd2e('0x20')](_0x6cf8c4[_0xcd2e('0x31')][_0xcd2e('0x20')]);_0x141090[_0xcd2e('0x1f')]=qs[_0xcd2e('0x1f')](_0x6cf8c4[_0xcd2e('0x31')][_0xcd2e('0x1f')]);}_0x141090['order']=qs['sort'](_0x6cf8c4['query'][_0xcd2e('0x38')]);_0x141090[_0xcd2e('0x39')]=qs[_0xcd2e('0x3a')](_['pick'](_0x6cf8c4['query'],_0x5a148e[_0xcd2e('0x3a')]));_0x141090[_0xcd2e('0x39')][_0xcd2e('0x5b')]=_0x3d14aa['id'];if(_0x6cf8c4[_0xcd2e('0x31')][_0xcd2e('0x3c')]){_0x141090['where']=_[_0xcd2e('0x53')](_0x141090[_0xcd2e('0x39')],{'$or':_['map'](_0x141090['attributes'],function(_0x45a635){var _0x45f40e={};_0x45f40e[_0x45a635]={'$like':'%'+_0x6cf8c4[_0xcd2e('0x31')][_0xcd2e('0x3c')]+'%'};return _0x45f40e;})});}_0x141090=_[_0xcd2e('0x53')]({},_0x141090,_0x6cf8c4[_0xcd2e('0x3f')]);return db[_0xcd2e('0x59')][_0xcd2e('0x40')]({'where':_0x141090[_0xcd2e('0x39')]})[_0xcd2e('0x23')](function(_0x157ce0){_0x18b5dc[_0xcd2e('0x40')]=_0x157ce0;if(_0x6cf8c4['query']['includeAll']){_0x141090[_0xcd2e('0x42')]=[{'all':!![]}];}return db[_0xcd2e('0x59')][_0xcd2e('0x5c')](_0x141090);})[_0xcd2e('0x23')](function(_0x339cac){_0x18b5dc[_0xcd2e('0x43')]=_0x339cac;return _0x18b5dc;});}})[_0xcd2e('0x23')](respondWithFilteredResult(_0x1049c2,_0x141090))[_0xcd2e('0x44')](handleError(_0x1049c2,null));};exports['getHopperHistories']=function(_0x3cbe3c,_0x311167,_0x24d5f6){var _0x4e8ad6={'raw':!![],'where':{}};var _0x479dc0={};var _0x1da290={'count':0x0,'rows':[]};return db['Campaign'][_0xcd2e('0x58')]({'where':{'id':_0x3cbe3c[_0xcd2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x311167,null))[_0xcd2e('0x23')](function(_0x471318){if(_0x471318){_0x479dc0['model']=_[_0xcd2e('0x30')](db[_0xcd2e('0x5d')][_0xcd2e('0x47')]);_0x479dc0[_0xcd2e('0x31')]=_[_0xcd2e('0x30')](_0x3cbe3c[_0xcd2e('0x31')]);_0x479dc0[_0xcd2e('0x3a')]=_[_0xcd2e('0x32')](_0x479dc0[_0xcd2e('0x2e')],_0x479dc0['query']);_0x4e8ad6[_0xcd2e('0x33')]=_[_0xcd2e('0x32')](_0x479dc0[_0xcd2e('0x2e')],qs[_0xcd2e('0x34')](_0x3cbe3c[_0xcd2e('0x31')]['fields']));_0x4e8ad6[_0xcd2e('0x33')]=_0x4e8ad6[_0xcd2e('0x33')][_0xcd2e('0x35')]?_0x4e8ad6[_0xcd2e('0x33')]:_0x479dc0['model'];if(!_0x3cbe3c['query']['hasOwnProperty'](_0xcd2e('0x36'))){_0x4e8ad6[_0xcd2e('0x20')]=qs[_0xcd2e('0x20')](_0x3cbe3c['query'][_0xcd2e('0x20')]);_0x4e8ad6[_0xcd2e('0x1f')]=qs[_0xcd2e('0x1f')](_0x3cbe3c[_0xcd2e('0x31')]['offset']);}_0x4e8ad6[_0xcd2e('0x37')]=qs[_0xcd2e('0x38')](_0x3cbe3c[_0xcd2e('0x31')][_0xcd2e('0x38')]);_0x4e8ad6[_0xcd2e('0x39')]=qs['filters'](_[_0xcd2e('0x3b')](_0x3cbe3c[_0xcd2e('0x31')],_0x479dc0[_0xcd2e('0x3a')]));_0x4e8ad6[_0xcd2e('0x39')][_0xcd2e('0x5b')]=_0x471318['id'];if(_0x3cbe3c[_0xcd2e('0x31')][_0xcd2e('0x3c')]){_0x4e8ad6[_0xcd2e('0x39')]=_['merge'](_0x4e8ad6[_0xcd2e('0x39')],{'$or':_['map'](_0x4e8ad6[_0xcd2e('0x33')],function(_0x2c8132){var _0x36897a={};_0x36897a[_0x2c8132]={'$like':'%'+_0x3cbe3c[_0xcd2e('0x31')][_0xcd2e('0x3c')]+'%'};return _0x36897a;})});}_0x4e8ad6=_[_0xcd2e('0x53')]({},_0x4e8ad6,_0x3cbe3c['options']);return db[_0xcd2e('0x5d')]['count']({'where':_0x4e8ad6[_0xcd2e('0x39')]})['then'](function(_0x776e50){_0x1da290[_0xcd2e('0x40')]=_0x776e50;if(_0x3cbe3c[_0xcd2e('0x31')][_0xcd2e('0x41')]){_0x4e8ad6[_0xcd2e('0x42')]=[{'all':!![]}];}return db[_0xcd2e('0x5d')][_0xcd2e('0x5c')](_0x4e8ad6);})[_0xcd2e('0x23')](function(_0x24ecf7){_0x1da290['rows']=_0x24ecf7;return _0x1da290;});}})[_0xcd2e('0x23')](respondWithFilteredResult(_0x311167,_0x4e8ad6))[_0xcd2e('0x44')](handleError(_0x311167,null));};exports['getHopperFinals']=function(_0x3233b8,_0x5cdbc1,_0x3bbb67){var _0x1afda5={'raw':!![],'where':{}};var _0x315bf2={};var _0x3729d9={'count':0x0,'rows':[]};return db[_0xcd2e('0x2a')][_0xcd2e('0x58')]({'where':{'id':_0x3233b8[_0xcd2e('0x46')]['id']}})[_0xcd2e('0x23')](handleEntityNotFound(_0x5cdbc1,null))[_0xcd2e('0x23')](function(_0x493f48){if(_0x493f48){_0x315bf2[_0xcd2e('0x2e')]=_[_0xcd2e('0x30')](db[_0xcd2e('0x5e')]['rawAttributes']);_0x315bf2[_0xcd2e('0x31')]=_['keys'](_0x3233b8[_0xcd2e('0x31')]);_0x315bf2[_0xcd2e('0x3a')]=_[_0xcd2e('0x32')](_0x315bf2[_0xcd2e('0x2e')],_0x315bf2[_0xcd2e('0x31')]);_0x1afda5[_0xcd2e('0x33')]=_[_0xcd2e('0x32')](_0x315bf2[_0xcd2e('0x2e')],qs['fields'](_0x3233b8[_0xcd2e('0x31')][_0xcd2e('0x34')]));_0x1afda5[_0xcd2e('0x33')]=_0x1afda5[_0xcd2e('0x33')][_0xcd2e('0x35')]?_0x1afda5['attributes']:_0x315bf2['model'];if(!_0x3233b8[_0xcd2e('0x31')]['hasOwnProperty'](_0xcd2e('0x36'))){_0x1afda5[_0xcd2e('0x20')]=qs[_0xcd2e('0x20')](_0x3233b8['query'][_0xcd2e('0x20')]);_0x1afda5[_0xcd2e('0x1f')]=qs[_0xcd2e('0x1f')](_0x3233b8['query'][_0xcd2e('0x1f')]);}_0x1afda5[_0xcd2e('0x37')]=qs['sort'](_0x3233b8[_0xcd2e('0x31')][_0xcd2e('0x38')]);_0x1afda5[_0xcd2e('0x39')]=qs[_0xcd2e('0x3a')](_[_0xcd2e('0x3b')](_0x3233b8[_0xcd2e('0x31')],_0x315bf2['filters']));_0x1afda5[_0xcd2e('0x39')]['CampaignId']=_0x493f48['id'];if(_0x3233b8[_0xcd2e('0x31')]['filter']){_0x1afda5['where']=_['merge'](_0x1afda5[_0xcd2e('0x39')],{'$or':_[_0xcd2e('0x2f')](_0x1afda5[_0xcd2e('0x33')],function(_0x248e60){var _0x6362c={};_0x6362c[_0x248e60]={'$like':'%'+_0x3233b8['query'][_0xcd2e('0x3c')]+'%'};return _0x6362c;})});}_0x1afda5=_[_0xcd2e('0x53')]({},_0x1afda5,_0x3233b8['options']);return db[_0xcd2e('0x5e')][_0xcd2e('0x40')]({'where':_0x1afda5['where']})[_0xcd2e('0x23')](function(_0x414f24){_0x3729d9[_0xcd2e('0x40')]=_0x414f24;if(_0x3233b8[_0xcd2e('0x31')]['includeAll']){_0x1afda5[_0xcd2e('0x42')]=[{'all':!![]}];}return db[_0xcd2e('0x5e')][_0xcd2e('0x5c')](_0x1afda5);})['then'](function(_0xb24146){_0x3729d9[_0xcd2e('0x43')]=_0xb24146;return _0x3729d9;});}})[_0xcd2e('0x23')](respondWithFilteredResult(_0x5cdbc1,_0x1afda5))[_0xcd2e('0x44')](handleError(_0x5cdbc1,null));};exports[_0xcd2e('0x5f')]=function(_0x104334,_0x598692,_0x4a892a){var _0x226765={'raw':!![],'where':{}};var _0x2267d0={};var _0x237053={'count':0x0,'rows':[]};return db[_0xcd2e('0x2a')]['findOne']({'where':{'id':_0x104334[_0xcd2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x598692,null))[_0xcd2e('0x23')](function(_0x51b476){if(_0x51b476){_0x2267d0[_0xcd2e('0x2e')]=_[_0xcd2e('0x30')](db['CmHopperBlack'][_0xcd2e('0x47')]);_0x2267d0['query']=_[_0xcd2e('0x30')](_0x104334[_0xcd2e('0x31')]);_0x2267d0['filters']=_['intersection'](_0x2267d0[_0xcd2e('0x2e')],_0x2267d0['query']);_0x226765['attributes']=_['intersection'](_0x2267d0[_0xcd2e('0x2e')],qs[_0xcd2e('0x34')](_0x104334[_0xcd2e('0x31')]['fields']));_0x226765[_0xcd2e('0x33')]=_0x226765[_0xcd2e('0x33')][_0xcd2e('0x35')]?_0x226765[_0xcd2e('0x33')]:_0x2267d0['model'];if(!_0x104334[_0xcd2e('0x31')][_0xcd2e('0x5a')]('nolimit')){_0x226765[_0xcd2e('0x20')]=qs[_0xcd2e('0x20')](_0x104334['query'][_0xcd2e('0x20')]);_0x226765[_0xcd2e('0x1f')]=qs[_0xcd2e('0x1f')](_0x104334[_0xcd2e('0x31')][_0xcd2e('0x1f')]);}_0x226765[_0xcd2e('0x37')]=qs['sort'](_0x104334[_0xcd2e('0x31')][_0xcd2e('0x38')]);_0x226765[_0xcd2e('0x39')]=qs[_0xcd2e('0x3a')](_[_0xcd2e('0x3b')](_0x104334['query'],_0x2267d0[_0xcd2e('0x3a')]));_0x226765[_0xcd2e('0x39')][_0xcd2e('0x5b')]=_0x51b476['id'];if(_0x104334['query'][_0xcd2e('0x3c')]){_0x226765[_0xcd2e('0x39')]=_[_0xcd2e('0x53')](_0x226765[_0xcd2e('0x39')],{'$or':_['map'](_0x226765[_0xcd2e('0x33')],function(_0x16de64){var _0x126b4a={};_0x126b4a[_0x16de64]={'$like':'%'+_0x104334[_0xcd2e('0x31')]['filter']+'%'};return _0x126b4a;})});}_0x226765=_['merge']({},_0x226765,_0x104334[_0xcd2e('0x3f')]);return db[_0xcd2e('0x60')][_0xcd2e('0x40')]({'where':_0x226765[_0xcd2e('0x39')]})[_0xcd2e('0x23')](function(_0x3e852c){_0x237053[_0xcd2e('0x40')]=_0x3e852c;if(_0x104334[_0xcd2e('0x31')]['includeAll']){_0x226765['include']=[{'all':!![]}];}return db[_0xcd2e('0x60')]['findAll'](_0x226765);})[_0xcd2e('0x23')](function(_0x1ff7d5){_0x237053[_0xcd2e('0x43')]=_0x1ff7d5;return _0x237053;});}})[_0xcd2e('0x23')](respondWithFilteredResult(_0x598692,_0x226765))[_0xcd2e('0x44')](handleError(_0x598692,null));};exports[_0xcd2e('0x61')]=function(_0xd71bd8,_0x11463,_0x103258){var _0x56bd08={};var _0x1657e0={};var _0x16471e;var _0x4a4b50;return db[_0xcd2e('0x2a')][_0xcd2e('0x58')]({'where':{'id':_0xd71bd8[_0xcd2e('0x46')]['id']}})[_0xcd2e('0x23')](handleEntityNotFound(_0x11463,null))[_0xcd2e('0x23')](function(_0x5304fb){if(_0x5304fb){_0x16471e=_0x5304fb;_0x1657e0['model']=_[_0xcd2e('0x30')](db[_0xcd2e('0x62')][_0xcd2e('0x47')]);_0x1657e0['query']=_[_0xcd2e('0x30')](_0xd71bd8['query']);_0x1657e0[_0xcd2e('0x3a')]=_[_0xcd2e('0x32')](_0x1657e0['model'],_0x1657e0[_0xcd2e('0x31')]);_0x56bd08[_0xcd2e('0x33')]=_[_0xcd2e('0x32')](_0x1657e0[_0xcd2e('0x2e')],qs[_0xcd2e('0x34')](_0xd71bd8['query'][_0xcd2e('0x34')]));_0x56bd08[_0xcd2e('0x33')]=_0x56bd08[_0xcd2e('0x33')][_0xcd2e('0x35')]?_0x56bd08['attributes']:_0x1657e0[_0xcd2e('0x2e')];_0x56bd08['order']=qs[_0xcd2e('0x38')](_0xd71bd8[_0xcd2e('0x31')][_0xcd2e('0x38')]);_0x56bd08[_0xcd2e('0x39')]=qs[_0xcd2e('0x3a')](_[_0xcd2e('0x3b')](_0xd71bd8['query'],_0x1657e0[_0xcd2e('0x3a')]));if(_0xd71bd8[_0xcd2e('0x31')][_0xcd2e('0x3c')]){_0x56bd08[_0xcd2e('0x39')]=_[_0xcd2e('0x53')](_0x56bd08[_0xcd2e('0x39')],{'$or':_[_0xcd2e('0x2f')](_0x56bd08[_0xcd2e('0x33')],function(_0x10af74){var _0x59e127={};_0x59e127[_0x10af74]={'$like':'%'+_0xd71bd8[_0xcd2e('0x31')][_0xcd2e('0x3c')]+'%'};return _0x59e127;})});}_0x56bd08=_[_0xcd2e('0x53')]({},_0x56bd08,_0xd71bd8['options']);return _0x16471e[_0xcd2e('0x61')](_0x56bd08);}})[_0xcd2e('0x23')](function(_0x18ca93){if(_0x18ca93){_0x4a4b50=_0x18ca93['length'];if(!_0xd71bd8[_0xcd2e('0x31')]['hasOwnProperty'](_0xcd2e('0x36'))){_0x56bd08[_0xcd2e('0x20')]=qs[_0xcd2e('0x20')](_0xd71bd8[_0xcd2e('0x31')]['limit']);_0x56bd08['offset']=qs[_0xcd2e('0x1f')](_0xd71bd8[_0xcd2e('0x31')][_0xcd2e('0x1f')]);}return _0x16471e[_0xcd2e('0x61')](_0x56bd08);}})[_0xcd2e('0x23')](function(_0x4d541b){if(_0x4d541b){return _0x4d541b?{'count':_0x4a4b50,'rows':_0x4d541b}:null;}})[_0xcd2e('0x23')](respondWithResult(_0x11463,null))['catch'](handleError(_0x11463,null));};exports[_0xcd2e('0x63')]=function(_0x59f74d,_0x28d13b,_0x5f4aa3){var _0x33e532,_0x4b6afa;return db[_0xcd2e('0x2a')][_0xcd2e('0x48')]({'where':{'id':_0x59f74d[_0xcd2e('0x46')]['id']}})[_0xcd2e('0x23')](handleEntityNotFound(_0x28d13b,null))[_0xcd2e('0x23')](function(_0x5d9cfc){if(_0x5d9cfc){_0x4b6afa=_0x5d9cfc;return _0x5d9cfc['addLists'](_0x59f74d['body'][_0xcd2e('0x64')],_[_0xcd2e('0x65')](_0x59f74d[_0xcd2e('0x55')],[_0xcd2e('0x64'),'id'])||{});}return null;})[_0xcd2e('0x66')](function(_0x274ca6){var _0x56a78a;_0x33e532=_0x274ca6||[];var _0x1c2dd6=[];if(_0x274ca6){for(var _0x555426=0x0;_0x555426<_0x274ca6[_0xcd2e('0x35')];_0x555426+=0x1){var _0x40e788=_0x274ca6[_0x555426][_0xcd2e('0x25')]({'plain':!![]});_0x4b6afa[_0xcd2e('0x67')]=_0x59f74d[_0xcd2e('0x55')][_0xcd2e('0x67')]?_0x59f74d[_0xcd2e('0x55')][_0xcd2e('0x67')]:_0x4b6afa['dialCheckDuplicateType'];switch(_0x4b6afa['dialCheckDuplicateType']){case'always':_0x56a78a=squel[_0xcd2e('0x68')]()[_0xcd2e('0x69')](_0xcd2e('0x6a'))['fromQuery']([_0xcd2e('0x6b'),'scheduledAt',_0xcd2e('0x6c'),'ListId',_0xcd2e('0x5b'),_0xcd2e('0x56'),_0xcd2e('0x54')],squel[_0xcd2e('0x6d')]()[_0xcd2e('0x6e')](_0xcd2e('0x6b'),_0xcd2e('0x6b'))[_0xcd2e('0x6e')](_0xcd2e('0x6f'),_0xcd2e('0x70'))[_0xcd2e('0x6e')]('id',_0xcd2e('0x6c'))[_0xcd2e('0x6e')](_0x40e788[_0xcd2e('0x71')][_0xcd2e('0x72')](),'ListId')[_0xcd2e('0x6e')](_0x59f74d[_0xcd2e('0x46')]['id']['toString'](),'CampaignId')[_0xcd2e('0x6e')](_0xcd2e('0x6f'),'createdAt')[_0xcd2e('0x6e')](_0xcd2e('0x6f'),_0xcd2e('0x54'))[_0xcd2e('0x73')](_0xcd2e('0x74'))[_0xcd2e('0x39')](_0xcd2e('0x75'))[_0xcd2e('0x39')](_0xcd2e('0x76'),_0x40e788[_0xcd2e('0x71')][_0xcd2e('0x72')]())[_0xcd2e('0x39')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xcd2e('0x77'),squel['select']()[_0xcd2e('0x6e')](_0xcd2e('0x78'))[_0xcd2e('0x73')]('cm_hopper_final')[_0xcd2e('0x39')](_0xcd2e('0x79'),_0x59f74d[_0xcd2e('0x46')]['id'][_0xcd2e('0x72')]()))[_0xcd2e('0x39')](_0xcd2e('0x77'),squel[_0xcd2e('0x6d')]()[_0xcd2e('0x6e')](_0xcd2e('0x7a'))[_0xcd2e('0x73')](_0xcd2e('0x6a'))[_0xcd2e('0x39')]('CampaignId\x20=\x20?',_0x59f74d[_0xcd2e('0x46')]['id'][_0xcd2e('0x72')]())))[_0xcd2e('0x72')]();break;case _0xcd2e('0x7b'):_0x56a78a=squel['insert']()[_0xcd2e('0x69')](_0xcd2e('0x6a'))[_0xcd2e('0x7c')](['phone',_0xcd2e('0x70'),'ContactId',_0xcd2e('0x7d'),_0xcd2e('0x5b'),'createdAt',_0xcd2e('0x54')],squel[_0xcd2e('0x6d')]()[_0xcd2e('0x6e')](_0xcd2e('0x6b'),_0xcd2e('0x6b'))['field'](_0xcd2e('0x6f'),_0xcd2e('0x70'))[_0xcd2e('0x6e')]('id',_0xcd2e('0x6c'))[_0xcd2e('0x6e')](_0x40e788['CmListId']['toString'](),_0xcd2e('0x7d'))[_0xcd2e('0x6e')](_0x59f74d['params']['id']['toString'](),_0xcd2e('0x5b'))['field'](_0xcd2e('0x6f'),'createdAt')[_0xcd2e('0x6e')](_0xcd2e('0x6f'),'updatedAt')[_0xcd2e('0x73')](_0xcd2e('0x74'))[_0xcd2e('0x39')](_0xcd2e('0x75'))[_0xcd2e('0x39')](_0xcd2e('0x76'),_0x40e788[_0xcd2e('0x71')][_0xcd2e('0x72')]())[_0xcd2e('0x39')](_0xcd2e('0x7e'))[_0xcd2e('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xcd2e('0x6d')]()[_0xcd2e('0x6e')](_0xcd2e('0x7a'))[_0xcd2e('0x73')]('cm_hopper')[_0xcd2e('0x39')](_0xcd2e('0x79'),_0x59f74d['params']['id'][_0xcd2e('0x72')]())))['toString']();break;default:_0x56a78a=squel[_0xcd2e('0x68')]()['into'](_0xcd2e('0x6a'))[_0xcd2e('0x7c')](['phone','scheduledAt','ContactId','ListId',_0xcd2e('0x5b'),_0xcd2e('0x56'),_0xcd2e('0x54')],squel['select']()[_0xcd2e('0x6e')](_0xcd2e('0x6b'),_0xcd2e('0x6b'))[_0xcd2e('0x6e')](_0xcd2e('0x6f'),_0xcd2e('0x70'))['field']('id',_0xcd2e('0x6c'))[_0xcd2e('0x6e')](_0x40e788[_0xcd2e('0x71')][_0xcd2e('0x72')](),_0xcd2e('0x7d'))[_0xcd2e('0x6e')](_0x59f74d[_0xcd2e('0x46')]['id'][_0xcd2e('0x72')](),_0xcd2e('0x5b'))[_0xcd2e('0x6e')]('NOW()',_0xcd2e('0x56'))[_0xcd2e('0x6e')](_0xcd2e('0x6f'),'updatedAt')[_0xcd2e('0x73')]('cm_contacts')[_0xcd2e('0x39')](_0xcd2e('0x75'))[_0xcd2e('0x39')](_0xcd2e('0x76'),_0x40e788[_0xcd2e('0x71')][_0xcd2e('0x72')]())[_0xcd2e('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xcd2e('0x72')]();}_0x1c2dd6[_0xcd2e('0x7f')](db[_0xcd2e('0x80')][_0xcd2e('0x31')](_0x56a78a));}return BPromise[_0xcd2e('0x81')](_0x1c2dd6);}})[_0xcd2e('0x23')](function(){return _0x33e532;})['then'](respondWithResult(_0x28d13b,null))[_0xcd2e('0x44')](handleError(_0x28d13b,null));};exports[_0xcd2e('0x82')]=function(_0x49b18f,_0x989e02,_0x2a6bff){return db[_0xcd2e('0x2a')][_0xcd2e('0x48')]({'where':{'id':_0x49b18f[_0xcd2e('0x46')]['id']}})[_0xcd2e('0x23')](handleEntityNotFound(_0x989e02,null))['then'](function(_0x3dd1c0){if(_0x3dd1c0){return _0x3dd1c0[_0xcd2e('0x82')](_0x49b18f[_0xcd2e('0x31')]['ids']);}})[_0xcd2e('0x23')](function(_0x3975bf){if(_0x3975bf){return db[_0xcd2e('0x59')][_0xcd2e('0x24')]({'where':{'ListId':_0x49b18f[_0xcd2e('0x31')][_0xcd2e('0x64')],'CampaignId':_0x49b18f[_0xcd2e('0x46')]['id']}})[_0xcd2e('0x23')](function(){return _0x3975bf;});}})[_0xcd2e('0x23')](respondWithStatusCode(_0x989e02,null))[_0xcd2e('0x44')](handleError(_0x989e02,null));};exports[_0xcd2e('0x83')]=function(_0x376d9d,_0xba397d,_0x5c020c){var _0x402aaa={'raw':!![],'where':{}};var _0x5adba2={};var _0x506103={'count':0x0,'rows':[]};return db[_0xcd2e('0x2a')][_0xcd2e('0x58')]({'where':{'id':_0x376d9d['params']['id']}})[_0xcd2e('0x23')](handleEntityNotFound(_0xba397d,null))[_0xcd2e('0x23')](function(_0x4d25c6){if(_0x4d25c6){_0x5adba2[_0xcd2e('0x2e')]=_[_0xcd2e('0x30')](db[_0xcd2e('0x62')][_0xcd2e('0x47')]);_0x5adba2[_0xcd2e('0x31')]=_[_0xcd2e('0x30')](_0x376d9d[_0xcd2e('0x31')]);_0x5adba2[_0xcd2e('0x3a')]=_[_0xcd2e('0x32')](_0x5adba2[_0xcd2e('0x2e')],_0x5adba2['query']);_0x402aaa[_0xcd2e('0x33')]=_[_0xcd2e('0x32')](_0x5adba2[_0xcd2e('0x2e')],qs[_0xcd2e('0x34')](_0x376d9d[_0xcd2e('0x31')][_0xcd2e('0x34')]));_0x402aaa[_0xcd2e('0x33')]=_0x402aaa[_0xcd2e('0x33')][_0xcd2e('0x35')]?_0x402aaa[_0xcd2e('0x33')]:_0x5adba2[_0xcd2e('0x2e')];if(!_0x376d9d['query'][_0xcd2e('0x5a')](_0xcd2e('0x36'))){_0x402aaa['limit']=qs['limit'](_0x376d9d['query'][_0xcd2e('0x20')]);_0x402aaa[_0xcd2e('0x1f')]=qs[_0xcd2e('0x1f')](_0x376d9d[_0xcd2e('0x31')][_0xcd2e('0x1f')]);}_0x402aaa[_0xcd2e('0x37')]=qs[_0xcd2e('0x38')](_0x376d9d['query'][_0xcd2e('0x38')]);_0x402aaa[_0xcd2e('0x39')]=qs['filters'](_[_0xcd2e('0x3b')](_0x376d9d[_0xcd2e('0x31')],_0x5adba2[_0xcd2e('0x3a')]));_0x402aaa['where'][_0xcd2e('0x5b')]=_0x4d25c6['id'];if(_0x376d9d[_0xcd2e('0x31')]['filter']){_0x402aaa[_0xcd2e('0x39')]=_[_0xcd2e('0x53')](_0x402aaa[_0xcd2e('0x39')],{'$or':_['map'](_0x402aaa[_0xcd2e('0x33')],function(_0x15b618){var _0x13dea1={};_0x13dea1[_0x15b618]={'$like':'%'+_0x376d9d[_0xcd2e('0x31')][_0xcd2e('0x3c')]+'%'};return _0x13dea1;})});}_0x402aaa=_['merge']({},_0x402aaa,_0x376d9d[_0xcd2e('0x3f')]);return db[_0xcd2e('0x62')][_0xcd2e('0x40')]({'where':_0x402aaa['where']})[_0xcd2e('0x23')](function(_0x4be74d){_0x506103['count']=_0x4be74d;if(_0x376d9d[_0xcd2e('0x31')][_0xcd2e('0x41')]){_0x402aaa[_0xcd2e('0x42')]=[{'all':!![]}];}return db['CmList'][_0xcd2e('0x5c')](_0x402aaa);})[_0xcd2e('0x23')](function(_0x57c4b0){_0x506103[_0xcd2e('0x43')]=_0x57c4b0;return _0x506103;});}})[_0xcd2e('0x23')](respondWithFilteredResult(_0xba397d,_0x402aaa))[_0xcd2e('0x44')](handleError(_0xba397d,null));};exports[_0xcd2e('0x84')]=function(_0x59e704,_0x3a2929,_0x49d0f7){var _0x3aa8a0,_0x3bf87d;return db['Campaign'][_0xcd2e('0x48')]({'where':{'id':_0x59e704[_0xcd2e('0x46')]['id']}})[_0xcd2e('0x23')](handleEntityNotFound(_0x3a2929,null))[_0xcd2e('0x23')](function(_0x32b68e){if(_0x32b68e){_0x3bf87d=_0x32b68e;return _0x32b68e[_0xcd2e('0x84')](_0x59e704[_0xcd2e('0x55')][_0xcd2e('0x64')],_[_0xcd2e('0x65')](_0x59e704[_0xcd2e('0x55')],[_0xcd2e('0x64'),'id'])||{});}return null;})[_0xcd2e('0x66')](function(_0x1482ca){var _0x28aa01;_0x3aa8a0=_0x1482ca||[];var _0x359c62=[];if(_0x1482ca){for(var _0x491939=0x0;_0x491939<_0x1482ca[_0xcd2e('0x35')];_0x491939+=0x1){var _0x2918b4=_0x1482ca[_0x491939][_0xcd2e('0x25')]({'plain':!![]});_0x28aa01=squel[_0xcd2e('0x68')]()['into'](_0xcd2e('0x85'))['fromQuery'](['phone',_0xcd2e('0x6c'),'ListId',_0xcd2e('0x5b'),_0xcd2e('0x56'),_0xcd2e('0x54')],squel['select']()['field'](_0xcd2e('0x6b'),_0xcd2e('0x6b'))['field']('id',_0xcd2e('0x6c'))[_0xcd2e('0x6e')](_0x2918b4[_0xcd2e('0x71')][_0xcd2e('0x72')](),_0xcd2e('0x7d'))['field'](_0x59e704[_0xcd2e('0x46')]['id']['toString'](),'CampaignId')[_0xcd2e('0x6e')](_0xcd2e('0x6f'),_0xcd2e('0x56'))[_0xcd2e('0x6e')]('NOW()',_0xcd2e('0x54'))[_0xcd2e('0x73')](_0xcd2e('0x74'))[_0xcd2e('0x39')](_0xcd2e('0x75'))[_0xcd2e('0x39')](_0xcd2e('0x76'),_0x2918b4['CmListId']['toString']())[_0xcd2e('0x39')](_0xcd2e('0x7e')))['toString']();_0x359c62[_0xcd2e('0x7f')](db[_0xcd2e('0x80')][_0xcd2e('0x31')](_0x28aa01));}return BPromise['all'](_0x359c62);}})['then'](function(){return _0x3aa8a0;})[_0xcd2e('0x23')](respondWithResult(_0x3a2929,null))[_0xcd2e('0x44')](handleError(_0x3a2929,null));};exports['removeBlackLists']=function(_0x158cfa,_0x164c01,_0x176182){return db[_0xcd2e('0x2a')][_0xcd2e('0x48')]({'where':{'id':_0x158cfa[_0xcd2e('0x46')]['id']}})[_0xcd2e('0x23')](handleEntityNotFound(_0x164c01,null))[_0xcd2e('0x23')](function(_0x59eb26){if(_0x59eb26){return _0x59eb26['removeBlackLists'](_0x158cfa[_0xcd2e('0x31')][_0xcd2e('0x64')]);}})['then'](function(_0xd6de12){if(_0xd6de12){return db[_0xcd2e('0x60')][_0xcd2e('0x24')]({'where':{'ListId':_0x158cfa[_0xcd2e('0x31')][_0xcd2e('0x64')],'CampaignId':_0x158cfa['params']['id']}})[_0xcd2e('0x23')](function(){return _0xd6de12;});}})[_0xcd2e('0x23')](respondWithStatusCode(_0x164c01,null))[_0xcd2e('0x44')](handleError(_0x164c01,null));}; \ No newline at end of file +var _0xa45d=['create','clone','omit','createdAt','updatedAt','UserProfileSection','update','getHoppers','findOne','CmHopper','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','fields','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation'];(function(_0x1cd4d5,_0x40bd09){var _0x348028=function(_0x10ffb3){while(--_0x10ffb3){_0x1cd4d5['push'](_0x1cd4d5['shift']());}};_0x348028(++_0x40bd09);}(_0xa45d,0x1c7));var _0xda45=function(_0xa6e64c,_0x1e78f5){_0xa6e64c=_0xa6e64c-0x0;var _0x5c2de0=_0xa45d[_0xa6e64c];return _0x5c2de0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xda45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda45('0x1'));var jsonpatch=require(_0xda45('0x2'));var rp=require(_0xda45('0x3'));var moment=require(_0xda45('0x4'));var BPromise=require(_0xda45('0x5'));var Mustache=require(_0xda45('0x6'));var util=require(_0xda45('0x7'));var path=require(_0xda45('0x8'));var sox=require(_0xda45('0x9'));var csv=require(_0xda45('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda45('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xda45('0xa'));var querystring=require(_0xda45('0xd'));var Papa=require(_0xda45('0xe'));var Redis=require(_0xda45('0xf'));var authService=require(_0xda45('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xda45('0x11'));var hardwareService=require(_0xda45('0x12'));var logger=require(_0xda45('0x13'))(_0xda45('0x14'));var utils=require('../../config/utils');var config=require(_0xda45('0x15'));var db=require(_0xda45('0x16'))['db'];function respondWithStatusCode(_0xd2e50,_0x58ffd9){_0x58ffd9=_0x58ffd9||0xcc;return function(_0x1d63bd){if(_0x1d63bd){return _0xd2e50[_0xda45('0x17')](_0x58ffd9);}return _0xd2e50['status'](_0x58ffd9)[_0xda45('0x18')]();};}function respondWithResult(_0x106593,_0x13985b){_0x13985b=_0x13985b||0xc8;return function(_0x4f244e){if(_0x4f244e){return _0x106593[_0xda45('0x19')](_0x13985b)['json'](_0x4f244e);}};}function respondWithFilteredResult(_0x3d072d,_0x3f5216){return function(_0x54ffac){if(_0x54ffac){var _0x366956=_0x54ffac[_0xda45('0x1a')],_0x4127ce=_0x3f5216['offset'],_0x1f30c0=_0x3f5216[_0xda45('0x1b')]+_0x3f5216[_0xda45('0x1c')],_0x4b39c1;if(_0x1f30c0>=_0x366956){_0x1f30c0=_0x366956;_0x4b39c1=0xc8;}else{_0x4b39c1=0xce;}_0x3d072d[_0xda45('0x19')](_0x4b39c1);return _0x3d072d[_0xda45('0x1d')](_0xda45('0x1e'),_0x4127ce+'-'+_0x1f30c0+'/'+_0x366956)[_0xda45('0x1f')](_0x54ffac);}return null;};}function patchUpdates(_0x202c04){return function(_0x529d16){try{jsonpatch[_0xda45('0x20')](_0x529d16,_0x202c04,!![]);}catch(_0x302683){return BPromise[_0xda45('0x21')](_0x302683);}return _0x529d16[_0xda45('0x22')]();};}function saveUpdates(_0x5534a3,_0x3bd00c){return function(_0x518215){if(_0x518215){return _0x518215['update'](_0x5534a3)[_0xda45('0x23')](function(_0x4db00b){return _0x4db00b;});}return null;};}function removeEntity(_0x192c12,_0x39191b){return function(_0x3cb15d){if(_0x3cb15d){return _0x3cb15d[_0xda45('0x24')]()[_0xda45('0x23')](function(){var _0x316e19=_0x3cb15d[_0xda45('0x25')]({'plain':!![]});var _0x2282bd=_0xda45('0x26');return db[_0xda45('0x27')][_0xda45('0x24')]({'where':{'type':_0x2282bd,'resourceId':_0x316e19['id']}})[_0xda45('0x23')](function(){return _0x3cb15d;});})[_0xda45('0x23')](function(){_0x192c12[_0xda45('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36a8c8,_0x1b51f9){return function(_0x4fc59){if(!_0x4fc59){_0x36a8c8['sendStatus'](0x194);}return _0x4fc59;};}function handleError(_0x5ee486,_0x5bb6a9){_0x5bb6a9=_0x5bb6a9||0x1f4;return function(_0x58c7f2){logger[_0xda45('0x28')](_0x58c7f2[_0xda45('0x29')]);if(_0x58c7f2[_0xda45('0x2a')]){delete _0x58c7f2[_0xda45('0x2a')];}_0x5ee486[_0xda45('0x19')](_0x5bb6a9)['send'](_0x58c7f2);};}exports[_0xda45('0x2b')]=function(_0x5bb837,_0x1d1b57){var _0x52e548={},_0x43d8ba={},_0x4c0bef={'count':0x0,'rows':[]};var _0x3ced5a=_[_0xda45('0x2c')](db[_0xda45('0x2d')][_0xda45('0x2e')],function(_0x1d9c12){return{'name':_0x1d9c12[_0xda45('0x2f')],'type':_0x1d9c12[_0xda45('0x30')][_0xda45('0x31')]};});_0x43d8ba[_0xda45('0x32')]=_['map'](_0x3ced5a,_0xda45('0x2a'));_0x43d8ba[_0xda45('0x33')]=_[_0xda45('0x34')](_0x5bb837[_0xda45('0x33')]);_0x43d8ba['filters']=_['intersection'](_0x43d8ba[_0xda45('0x32')],_0x43d8ba[_0xda45('0x33')]);_0x52e548[_0xda45('0x35')]=_['intersection'](_0x43d8ba[_0xda45('0x32')],qs['fields'](_0x5bb837[_0xda45('0x33')]['fields']));_0x52e548[_0xda45('0x35')]=_0x52e548['attributes'][_0xda45('0x36')]?_0x52e548[_0xda45('0x35')]:_0x43d8ba[_0xda45('0x32')];if(!_0x5bb837['query'][_0xda45('0x37')](_0xda45('0x38'))){_0x52e548[_0xda45('0x1c')]=qs[_0xda45('0x1c')](_0x5bb837[_0xda45('0x33')][_0xda45('0x1c')]);_0x52e548[_0xda45('0x1b')]=qs[_0xda45('0x1b')](_0x5bb837['query'][_0xda45('0x1b')]);}_0x52e548[_0xda45('0x39')]=qs[_0xda45('0x3a')](_0x5bb837['query'][_0xda45('0x3a')]);_0x52e548[_0xda45('0x3b')]=qs[_0xda45('0x3c')](_[_0xda45('0x3d')](_0x5bb837['query'],_0x43d8ba[_0xda45('0x3c')]),_0x3ced5a);if(_0x5bb837[_0xda45('0x33')][_0xda45('0x3e')]){_0x52e548[_0xda45('0x3b')]=_[_0xda45('0x3f')](_0x52e548['where'],{'$or':_['map'](_0x3ced5a,function(_0x19531c){if(_0x19531c[_0xda45('0x30')]!=='VIRTUAL'){var _0x2d6452={};_0x2d6452[_0x19531c['name']]={'$like':'%'+_0x5bb837[_0xda45('0x33')][_0xda45('0x3e')]+'%'};return _0x2d6452;}})});}_0x52e548=_['merge']({},_0x52e548,_0x5bb837[_0xda45('0x40')]);var _0x2f083b={'where':_0x52e548[_0xda45('0x3b')]};return db[_0xda45('0x2d')][_0xda45('0x1a')](_0x2f083b)[_0xda45('0x23')](function(_0x509db9){_0x4c0bef[_0xda45('0x1a')]=_0x509db9;if(_0x5bb837[_0xda45('0x33')][_0xda45('0x41')]){_0x52e548[_0xda45('0x42')]=[{'all':!![]}];}return db[_0xda45('0x2d')][_0xda45('0x43')](_0x52e548);})[_0xda45('0x23')](function(_0x6074b2){_0x4c0bef[_0xda45('0x44')]=_0x6074b2;return _0x4c0bef;})[_0xda45('0x23')](respondWithFilteredResult(_0x1d1b57,_0x52e548))[_0xda45('0x45')](handleError(_0x1d1b57,null));};exports[_0xda45('0x46')]=function(_0x35ec7e,_0x40b8eb){var _0x57e75d={'raw':![],'where':{'id':_0x35ec7e[_0xda45('0x47')]['id']}},_0x60e4b1={};_0x60e4b1['model']=_[_0xda45('0x34')](db[_0xda45('0x2d')][_0xda45('0x2e')]);_0x60e4b1['query']=_['keys'](_0x35ec7e[_0xda45('0x33')]);_0x60e4b1[_0xda45('0x3c')]=_[_0xda45('0x48')](_0x60e4b1[_0xda45('0x32')],_0x60e4b1[_0xda45('0x33')]);_0x57e75d[_0xda45('0x35')]=_[_0xda45('0x48')](_0x60e4b1['model'],qs[_0xda45('0x49')](_0x35ec7e[_0xda45('0x33')][_0xda45('0x49')]));_0x57e75d[_0xda45('0x35')]=_0x57e75d[_0xda45('0x35')][_0xda45('0x36')]?_0x57e75d['attributes']:_0x60e4b1[_0xda45('0x32')];if(_0x35ec7e[_0xda45('0x33')][_0xda45('0x41')]){_0x57e75d[_0xda45('0x42')]=[{'all':!![]}];}_0x57e75d=_['merge']({},_0x57e75d,_0x35ec7e[_0xda45('0x40')]);return db[_0xda45('0x2d')]['find'](_0x57e75d)[_0xda45('0x23')](handleEntityNotFound(_0x40b8eb,null))[_0xda45('0x23')](respondWithResult(_0x40b8eb,null))['catch'](handleError(_0x40b8eb,null));};exports['create']=function(_0x507351,_0x13ffa0){return db[_0xda45('0x2d')]['create'](_0x507351[_0xda45('0x4a')],{})[_0xda45('0x23')](function(_0x350ecc){var _0x5c1185=_0x507351[_0xda45('0x4b')]['get']({'plain':!![]});if(!_0x5c1185)throw new Error(_0xda45('0x4c'));if(_0x5c1185[_0xda45('0x4d')]===_0xda45('0x4b')){var _0x514b2c=_0x350ecc[_0xda45('0x25')]({'plain':!![]});var _0x63f898=_0xda45('0x26');return db['UserProfileSection'][_0xda45('0x4e')]({'where':{'name':_0x63f898,'userProfileId':_0x5c1185[_0xda45('0x4f')]},'raw':!![]})[_0xda45('0x23')](function(_0x107474){if(_0x107474&&_0x107474[_0xda45('0x50')]===0x0){return db[_0xda45('0x27')][_0xda45('0x51')]({'name':_0x514b2c[_0xda45('0x2a')],'resourceId':_0x514b2c['id'],'type':_0x107474['name'],'sectionId':_0x107474['id']},{})[_0xda45('0x23')](function(){return _0x350ecc;});}else{return _0x350ecc;}})[_0xda45('0x45')](function(_0xca6f2b){logger[_0xda45('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xca6f2b);throw _0xca6f2b;});}return _0x350ecc;})[_0xda45('0x23')](respondWithResult(_0x13ffa0,0xc9))[_0xda45('0x45')](handleError(_0x13ffa0,null));};exports[_0xda45('0x52')]=function(_0x3d9d87,_0x1cca12){var _0x2cb4b4={'where':{'id':_0x3d9d87[_0xda45('0x47')]['id']}},_0xcdf9e4={};_0xcdf9e4[_0xda45('0x32')]=_['keys'](db[_0xda45('0x2d')]['rawAttributes']);_0x2cb4b4[_0xda45('0x35')]=_['intersection'](_0xcdf9e4[_0xda45('0x32')],qs['fields'](_0x3d9d87[_0xda45('0x33')][_0xda45('0x49')]));_0x2cb4b4[_0xda45('0x35')]=_0x2cb4b4['attributes']['length']?_0x2cb4b4[_0xda45('0x35')]:_0xcdf9e4[_0xda45('0x32')];if(_0x3d9d87[_0xda45('0x33')]['includeAll']){_0x2cb4b4[_0xda45('0x42')]=[{'all':!![]}];}_0x2cb4b4=_['merge']({},_0x2cb4b4,_0x3d9d87[_0xda45('0x40')]);return db[_0xda45('0x2d')][_0xda45('0x4e')](_0x2cb4b4)[_0xda45('0x23')](handleEntityNotFound(_0x1cca12,null))[_0xda45('0x23')](function(_0x178ce7){if(_0x178ce7){var _0x560699=_0x178ce7['get']({'plain':!![]});_0x560699=qs[_0xda45('0x53')](_0x560699,['id',_0xda45('0x54'),_0xda45('0x55')]);_0x3d9d87[_0xda45('0x4a')]=_[_0xda45('0x53')](_0x3d9d87['body'],['id','createdAt',_0xda45('0x55')]);return db['Campaign']['create'](_['merge'](_0x560699,_0x3d9d87['body']),{'include':_0x3d9d87['query'][_0xda45('0x41')]?[{'all':!![]}]:undefined})[_0xda45('0x23')](function(_0x24e55c){var _0x26a994=_0x3d9d87[_0xda45('0x4b')][_0xda45('0x25')]({'plain':!![]});if(!_0x26a994)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26a994[_0xda45('0x4d')]===_0xda45('0x4b')){var _0x99141a=_0x24e55c['get']({'plain':!![]});var _0x10aaf7=_0xda45('0x26');return db[_0xda45('0x56')]['find']({'where':{'name':_0x10aaf7,'userProfileId':_0x26a994[_0xda45('0x4f')]},'raw':!![]})['then'](function(_0x261054){if(_0x261054&&_0x261054[_0xda45('0x50')]===0x0){return db[_0xda45('0x27')][_0xda45('0x51')]({'name':_0x99141a['name'],'resourceId':_0x99141a['id'],'type':_0x261054[_0xda45('0x2a')],'sectionId':_0x261054['id']},{})[_0xda45('0x23')](function(){return _0x24e55c;});}else{return _0x24e55c;}})[_0xda45('0x45')](function(_0x56948b){logger[_0xda45('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56948b);throw _0x56948b;});}return _0x24e55c;});}})[_0xda45('0x23')](respondWithResult(_0x1cca12,0xc9))[_0xda45('0x45')](handleError(_0x1cca12,null));};exports[_0xda45('0x57')]=function(_0x20c6c2,_0x650990){if(_0x20c6c2[_0xda45('0x4a')]['id']){delete _0x20c6c2['body']['id'];}return db[_0xda45('0x2d')]['find']({'where':{'id':_0x20c6c2[_0xda45('0x47')]['id']}})['then'](handleEntityNotFound(_0x650990,null))['then'](saveUpdates(_0x20c6c2[_0xda45('0x4a')],null))[_0xda45('0x23')](respondWithResult(_0x650990,null))[_0xda45('0x45')](handleError(_0x650990,null));};exports[_0xda45('0x24')]=function(_0x55da3a,_0x3cf19f){return db['Campaign'][_0xda45('0x4e')]({'where':{'id':_0x55da3a['params']['id']}})[_0xda45('0x23')](handleEntityNotFound(_0x3cf19f,null))['then'](removeEntity(_0x3cf19f,null))[_0xda45('0x45')](handleError(_0x3cf19f,null));};exports[_0xda45('0x58')]=function(_0x3b7513,_0x4f6344,_0x433550){var _0x5999fe={'raw':!![],'where':{}};var _0x12add4={};var _0x1e8b78={'count':0x0,'rows':[]};return db[_0xda45('0x2d')][_0xda45('0x59')]({'where':{'id':_0x3b7513[_0xda45('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f6344,null))[_0xda45('0x23')](function(_0x348681){if(_0x348681){_0x12add4[_0xda45('0x32')]=_[_0xda45('0x34')](db[_0xda45('0x5a')]['rawAttributes']);_0x12add4[_0xda45('0x33')]=_[_0xda45('0x34')](_0x3b7513[_0xda45('0x33')]);_0x12add4['filters']=_[_0xda45('0x48')](_0x12add4[_0xda45('0x32')],_0x12add4[_0xda45('0x33')]);_0x5999fe[_0xda45('0x35')]=_[_0xda45('0x48')](_0x12add4['model'],qs[_0xda45('0x49')](_0x3b7513['query'][_0xda45('0x49')]));_0x5999fe[_0xda45('0x35')]=_0x5999fe[_0xda45('0x35')][_0xda45('0x36')]?_0x5999fe[_0xda45('0x35')]:_0x12add4[_0xda45('0x32')];if(!_0x3b7513[_0xda45('0x33')]['hasOwnProperty']('nolimit')){_0x5999fe[_0xda45('0x1c')]=qs[_0xda45('0x1c')](_0x3b7513[_0xda45('0x33')]['limit']);_0x5999fe['offset']=qs[_0xda45('0x1b')](_0x3b7513[_0xda45('0x33')][_0xda45('0x1b')]);}_0x5999fe['order']=qs[_0xda45('0x3a')](_0x3b7513[_0xda45('0x33')][_0xda45('0x3a')]);_0x5999fe[_0xda45('0x3b')]=qs[_0xda45('0x3c')](_['pick'](_0x3b7513[_0xda45('0x33')],_0x12add4[_0xda45('0x3c')]));_0x5999fe[_0xda45('0x3b')][_0xda45('0x5b')]=_0x348681['id'];if(_0x3b7513[_0xda45('0x33')][_0xda45('0x3e')]){_0x5999fe[_0xda45('0x3b')]=_[_0xda45('0x3f')](_0x5999fe[_0xda45('0x3b')],{'$or':_[_0xda45('0x2c')](_0x5999fe[_0xda45('0x35')],function(_0x324cfe){var _0xc245d9={};_0xc245d9[_0x324cfe]={'$like':'%'+_0x3b7513[_0xda45('0x33')][_0xda45('0x3e')]+'%'};return _0xc245d9;})});}_0x5999fe=_[_0xda45('0x3f')]({},_0x5999fe,_0x3b7513['options']);return db['CmHopper'][_0xda45('0x1a')]({'where':_0x5999fe[_0xda45('0x3b')]})[_0xda45('0x23')](function(_0x1350e0){_0x1e8b78[_0xda45('0x1a')]=_0x1350e0;if(_0x3b7513[_0xda45('0x33')][_0xda45('0x41')]){_0x5999fe[_0xda45('0x42')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x5999fe);})[_0xda45('0x23')](function(_0x117102){_0x1e8b78[_0xda45('0x44')]=_0x117102;return _0x1e8b78;});}})[_0xda45('0x23')](respondWithFilteredResult(_0x4f6344,_0x5999fe))['catch'](handleError(_0x4f6344,null));};exports['getHopperHistories']=function(_0x2a4198,_0x1ab1db,_0x5c4be2){var _0x9dab51={'raw':!![],'where':{}};var _0x450dc2={};var _0x27f722={'count':0x0,'rows':[]};return db[_0xda45('0x2d')][_0xda45('0x59')]({'where':{'id':_0x2a4198[_0xda45('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ab1db,null))[_0xda45('0x23')](function(_0x22159b){if(_0x22159b){_0x450dc2[_0xda45('0x32')]=_[_0xda45('0x34')](db[_0xda45('0x5c')][_0xda45('0x2e')]);_0x450dc2[_0xda45('0x33')]=_[_0xda45('0x34')](_0x2a4198[_0xda45('0x33')]);_0x450dc2[_0xda45('0x3c')]=_['intersection'](_0x450dc2[_0xda45('0x32')],_0x450dc2['query']);_0x9dab51[_0xda45('0x35')]=_[_0xda45('0x48')](_0x450dc2[_0xda45('0x32')],qs[_0xda45('0x49')](_0x2a4198['query'][_0xda45('0x49')]));_0x9dab51['attributes']=_0x9dab51[_0xda45('0x35')][_0xda45('0x36')]?_0x9dab51[_0xda45('0x35')]:_0x450dc2[_0xda45('0x32')];if(!_0x2a4198[_0xda45('0x33')][_0xda45('0x37')](_0xda45('0x38'))){_0x9dab51['limit']=qs[_0xda45('0x1c')](_0x2a4198[_0xda45('0x33')][_0xda45('0x1c')]);_0x9dab51[_0xda45('0x1b')]=qs[_0xda45('0x1b')](_0x2a4198[_0xda45('0x33')][_0xda45('0x1b')]);}_0x9dab51['order']=qs['sort'](_0x2a4198[_0xda45('0x33')][_0xda45('0x3a')]);_0x9dab51['where']=qs['filters'](_[_0xda45('0x3d')](_0x2a4198[_0xda45('0x33')],_0x450dc2[_0xda45('0x3c')]));_0x9dab51[_0xda45('0x3b')][_0xda45('0x5b')]=_0x22159b['id'];if(_0x2a4198[_0xda45('0x33')]['filter']){_0x9dab51[_0xda45('0x3b')]=_['merge'](_0x9dab51['where'],{'$or':_[_0xda45('0x2c')](_0x9dab51[_0xda45('0x35')],function(_0xfac03){var _0x57d999={};_0x57d999[_0xfac03]={'$like':'%'+_0x2a4198[_0xda45('0x33')][_0xda45('0x3e')]+'%'};return _0x57d999;})});}_0x9dab51=_[_0xda45('0x3f')]({},_0x9dab51,_0x2a4198['options']);return db[_0xda45('0x5c')][_0xda45('0x1a')]({'where':_0x9dab51[_0xda45('0x3b')]})[_0xda45('0x23')](function(_0x982c2c){_0x27f722[_0xda45('0x1a')]=_0x982c2c;if(_0x2a4198['query'][_0xda45('0x41')]){_0x9dab51[_0xda45('0x42')]=[{'all':!![]}];}return db[_0xda45('0x5c')]['findAll'](_0x9dab51);})['then'](function(_0x33ed77){_0x27f722[_0xda45('0x44')]=_0x33ed77;return _0x27f722;});}})['then'](respondWithFilteredResult(_0x1ab1db,_0x9dab51))[_0xda45('0x45')](handleError(_0x1ab1db,null));};exports[_0xda45('0x5d')]=function(_0xd7e308,_0x108288,_0x3352a8){var _0x2394db={'raw':!![],'where':{}};var _0xd11dce={};var _0x4f4bb2={'count':0x0,'rows':[]};return db[_0xda45('0x2d')][_0xda45('0x59')]({'where':{'id':_0xd7e308[_0xda45('0x47')]['id']}})['then'](handleEntityNotFound(_0x108288,null))[_0xda45('0x23')](function(_0x280293){if(_0x280293){_0xd11dce[_0xda45('0x32')]=_['keys'](db[_0xda45('0x5e')]['rawAttributes']);_0xd11dce['query']=_['keys'](_0xd7e308[_0xda45('0x33')]);_0xd11dce[_0xda45('0x3c')]=_[_0xda45('0x48')](_0xd11dce['model'],_0xd11dce['query']);_0x2394db[_0xda45('0x35')]=_['intersection'](_0xd11dce[_0xda45('0x32')],qs[_0xda45('0x49')](_0xd7e308[_0xda45('0x33')][_0xda45('0x49')]));_0x2394db[_0xda45('0x35')]=_0x2394db['attributes'][_0xda45('0x36')]?_0x2394db[_0xda45('0x35')]:_0xd11dce[_0xda45('0x32')];if(!_0xd7e308[_0xda45('0x33')]['hasOwnProperty'](_0xda45('0x38'))){_0x2394db[_0xda45('0x1c')]=qs[_0xda45('0x1c')](_0xd7e308[_0xda45('0x33')][_0xda45('0x1c')]);_0x2394db[_0xda45('0x1b')]=qs[_0xda45('0x1b')](_0xd7e308['query'][_0xda45('0x1b')]);}_0x2394db[_0xda45('0x39')]=qs[_0xda45('0x3a')](_0xd7e308['query'][_0xda45('0x3a')]);_0x2394db[_0xda45('0x3b')]=qs[_0xda45('0x3c')](_[_0xda45('0x3d')](_0xd7e308['query'],_0xd11dce[_0xda45('0x3c')]));_0x2394db['where'][_0xda45('0x5b')]=_0x280293['id'];if(_0xd7e308[_0xda45('0x33')][_0xda45('0x3e')]){_0x2394db[_0xda45('0x3b')]=_[_0xda45('0x3f')](_0x2394db[_0xda45('0x3b')],{'$or':_[_0xda45('0x2c')](_0x2394db[_0xda45('0x35')],function(_0x52b37f){var _0x1197dd={};_0x1197dd[_0x52b37f]={'$like':'%'+_0xd7e308[_0xda45('0x33')]['filter']+'%'};return _0x1197dd;})});}_0x2394db=_[_0xda45('0x3f')]({},_0x2394db,_0xd7e308[_0xda45('0x40')]);return db[_0xda45('0x5e')]['count']({'where':_0x2394db[_0xda45('0x3b')]})['then'](function(_0x2fa304){_0x4f4bb2[_0xda45('0x1a')]=_0x2fa304;if(_0xd7e308[_0xda45('0x33')][_0xda45('0x41')]){_0x2394db[_0xda45('0x42')]=[{'all':!![]}];}return db[_0xda45('0x5e')][_0xda45('0x43')](_0x2394db);})[_0xda45('0x23')](function(_0x490796){_0x4f4bb2[_0xda45('0x44')]=_0x490796;return _0x4f4bb2;});}})['then'](respondWithFilteredResult(_0x108288,_0x2394db))[_0xda45('0x45')](handleError(_0x108288,null));};exports['getHopperBlacks']=function(_0xed626b,_0x8d9eb9,_0x25d0e1){var _0x5ef40d={'raw':!![],'where':{}};var _0x1b3d1e={};var _0x2d16b6={'count':0x0,'rows':[]};return db[_0xda45('0x2d')]['findOne']({'where':{'id':_0xed626b[_0xda45('0x47')]['id']}})[_0xda45('0x23')](handleEntityNotFound(_0x8d9eb9,null))[_0xda45('0x23')](function(_0x22cd7a){if(_0x22cd7a){_0x1b3d1e[_0xda45('0x32')]=_[_0xda45('0x34')](db[_0xda45('0x5f')][_0xda45('0x2e')]);_0x1b3d1e[_0xda45('0x33')]=_[_0xda45('0x34')](_0xed626b[_0xda45('0x33')]);_0x1b3d1e['filters']=_[_0xda45('0x48')](_0x1b3d1e[_0xda45('0x32')],_0x1b3d1e[_0xda45('0x33')]);_0x5ef40d[_0xda45('0x35')]=_[_0xda45('0x48')](_0x1b3d1e[_0xda45('0x32')],qs[_0xda45('0x49')](_0xed626b[_0xda45('0x33')][_0xda45('0x49')]));_0x5ef40d[_0xda45('0x35')]=_0x5ef40d[_0xda45('0x35')][_0xda45('0x36')]?_0x5ef40d[_0xda45('0x35')]:_0x1b3d1e[_0xda45('0x32')];if(!_0xed626b['query'][_0xda45('0x37')](_0xda45('0x38'))){_0x5ef40d[_0xda45('0x1c')]=qs[_0xda45('0x1c')](_0xed626b[_0xda45('0x33')]['limit']);_0x5ef40d[_0xda45('0x1b')]=qs[_0xda45('0x1b')](_0xed626b[_0xda45('0x33')]['offset']);}_0x5ef40d[_0xda45('0x39')]=qs[_0xda45('0x3a')](_0xed626b[_0xda45('0x33')]['sort']);_0x5ef40d['where']=qs[_0xda45('0x3c')](_['pick'](_0xed626b['query'],_0x1b3d1e['filters']));_0x5ef40d[_0xda45('0x3b')][_0xda45('0x5b')]=_0x22cd7a['id'];if(_0xed626b['query'][_0xda45('0x3e')]){_0x5ef40d[_0xda45('0x3b')]=_[_0xda45('0x3f')](_0x5ef40d['where'],{'$or':_['map'](_0x5ef40d['attributes'],function(_0x3df5e5){var _0x56d90e={};_0x56d90e[_0x3df5e5]={'$like':'%'+_0xed626b[_0xda45('0x33')][_0xda45('0x3e')]+'%'};return _0x56d90e;})});}_0x5ef40d=_[_0xda45('0x3f')]({},_0x5ef40d,_0xed626b['options']);return db['CmHopperBlack'][_0xda45('0x1a')]({'where':_0x5ef40d[_0xda45('0x3b')]})[_0xda45('0x23')](function(_0x5a2b7f){_0x2d16b6[_0xda45('0x1a')]=_0x5a2b7f;if(_0xed626b[_0xda45('0x33')][_0xda45('0x41')]){_0x5ef40d[_0xda45('0x42')]=[{'all':!![]}];}return db[_0xda45('0x5f')][_0xda45('0x43')](_0x5ef40d);})[_0xda45('0x23')](function(_0x268f3e){_0x2d16b6[_0xda45('0x44')]=_0x268f3e;return _0x2d16b6;});}})[_0xda45('0x23')](respondWithFilteredResult(_0x8d9eb9,_0x5ef40d))[_0xda45('0x45')](handleError(_0x8d9eb9,null));};exports[_0xda45('0x60')]=function(_0x309e90,_0x5bf1e3,_0x21f5ed){var _0x5032b1={};var _0xe177e={};var _0x5a6477;var _0x2db696;return db[_0xda45('0x2d')]['findOne']({'where':{'id':_0x309e90[_0xda45('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bf1e3,null))[_0xda45('0x23')](function(_0x530143){if(_0x530143){_0x5a6477=_0x530143;_0xe177e[_0xda45('0x32')]=_[_0xda45('0x34')](db[_0xda45('0x61')][_0xda45('0x2e')]);_0xe177e['query']=_[_0xda45('0x34')](_0x309e90[_0xda45('0x33')]);_0xe177e[_0xda45('0x3c')]=_[_0xda45('0x48')](_0xe177e['model'],_0xe177e['query']);_0x5032b1[_0xda45('0x35')]=_['intersection'](_0xe177e[_0xda45('0x32')],qs[_0xda45('0x49')](_0x309e90[_0xda45('0x33')][_0xda45('0x49')]));_0x5032b1['attributes']=_0x5032b1['attributes'][_0xda45('0x36')]?_0x5032b1[_0xda45('0x35')]:_0xe177e['model'];_0x5032b1[_0xda45('0x39')]=qs[_0xda45('0x3a')](_0x309e90[_0xda45('0x33')][_0xda45('0x3a')]);_0x5032b1[_0xda45('0x3b')]=qs[_0xda45('0x3c')](_[_0xda45('0x3d')](_0x309e90[_0xda45('0x33')],_0xe177e[_0xda45('0x3c')]));if(_0x309e90['query'][_0xda45('0x3e')]){_0x5032b1['where']=_[_0xda45('0x3f')](_0x5032b1[_0xda45('0x3b')],{'$or':_[_0xda45('0x2c')](_0x5032b1[_0xda45('0x35')],function(_0x253e2e){var _0xa80d6c={};_0xa80d6c[_0x253e2e]={'$like':'%'+_0x309e90[_0xda45('0x33')][_0xda45('0x3e')]+'%'};return _0xa80d6c;})});}_0x5032b1=_[_0xda45('0x3f')]({},_0x5032b1,_0x309e90[_0xda45('0x40')]);return _0x5a6477['getLists'](_0x5032b1);}})[_0xda45('0x23')](function(_0x5c1748){if(_0x5c1748){_0x2db696=_0x5c1748[_0xda45('0x36')];if(!_0x309e90['query'][_0xda45('0x37')](_0xda45('0x38'))){_0x5032b1['limit']=qs[_0xda45('0x1c')](_0x309e90[_0xda45('0x33')][_0xda45('0x1c')]);_0x5032b1['offset']=qs['offset'](_0x309e90[_0xda45('0x33')]['offset']);}return _0x5a6477[_0xda45('0x60')](_0x5032b1);}})['then'](function(_0x1680f3){if(_0x1680f3){return _0x1680f3?{'count':_0x2db696,'rows':_0x1680f3}:null;}})[_0xda45('0x23')](respondWithResult(_0x5bf1e3,null))['catch'](handleError(_0x5bf1e3,null));};exports[_0xda45('0x62')]=function(_0x58949d,_0x28a9fa,_0x39f92b){var _0x52841d,_0xf5b61d;return db[_0xda45('0x2d')][_0xda45('0x4e')]({'where':{'id':_0x58949d[_0xda45('0x47')]['id']}})[_0xda45('0x23')](handleEntityNotFound(_0x28a9fa,null))['then'](function(_0x5ad547){if(_0x5ad547){_0xf5b61d=_0x5ad547;return _0x5ad547[_0xda45('0x62')](_0x58949d[_0xda45('0x4a')][_0xda45('0x63')],_['omit'](_0x58949d[_0xda45('0x4a')],[_0xda45('0x63'),'id'])||{});}return null;})[_0xda45('0x64')](function(_0x3fbc59){var _0x2dbedb;_0x52841d=_0x3fbc59||[];var _0x206747=[];if(_0x3fbc59){for(var _0x52ccca=0x0;_0x52ccca<_0x3fbc59['length'];_0x52ccca+=0x1){var _0x2443b6=_0x3fbc59[_0x52ccca][_0xda45('0x25')]({'plain':!![]});_0xf5b61d[_0xda45('0x65')]=_0x58949d[_0xda45('0x4a')]['dialCheckDuplicateType']?_0x58949d['body'][_0xda45('0x65')]:_0xf5b61d['dialCheckDuplicateType'];switch(_0xf5b61d[_0xda45('0x65')]){case _0xda45('0x66'):_0x2dbedb=squel['insert']()[_0xda45('0x67')]('cm_hopper')[_0xda45('0x68')](['phone',_0xda45('0x69'),_0xda45('0x6a'),_0xda45('0x6b'),'CampaignId','createdAt','updatedAt'],squel[_0xda45('0x6c')]()[_0xda45('0x6d')]('phone',_0xda45('0x6e'))[_0xda45('0x6d')](_0xda45('0x6f'),'scheduledAt')[_0xda45('0x6d')]('id',_0xda45('0x6a'))[_0xda45('0x6d')](_0x2443b6['CmListId']['toString'](),_0xda45('0x6b'))[_0xda45('0x6d')](_0x58949d[_0xda45('0x47')]['id'][_0xda45('0x70')](),_0xda45('0x5b'))['field']('NOW()',_0xda45('0x54'))['field'](_0xda45('0x6f'),_0xda45('0x55'))[_0xda45('0x71')](_0xda45('0x72'))[_0xda45('0x3b')](_0xda45('0x73'))[_0xda45('0x3b')](_0xda45('0x74'),_0x2443b6[_0xda45('0x75')]['toString']())[_0xda45('0x3b')](_0xda45('0x76'))[_0xda45('0x3b')](_0xda45('0x77'),squel[_0xda45('0x6c')]()[_0xda45('0x6d')](_0xda45('0x78'))[_0xda45('0x71')]('cm_hopper_final')[_0xda45('0x3b')](_0xda45('0x79'),_0x58949d['params']['id'][_0xda45('0x70')]()))[_0xda45('0x3b')](_0xda45('0x77'),squel[_0xda45('0x6c')]()[_0xda45('0x6d')](_0xda45('0x7a'))['from'](_0xda45('0x7b'))[_0xda45('0x3b')](_0xda45('0x79'),_0x58949d[_0xda45('0x47')]['id']['toString']())))[_0xda45('0x70')]();break;case _0xda45('0x7c'):_0x2dbedb=squel['insert']()['into']('cm_hopper')[_0xda45('0x68')]([_0xda45('0x6e'),_0xda45('0x69'),_0xda45('0x6a'),'ListId','CampaignId',_0xda45('0x54'),_0xda45('0x55')],squel[_0xda45('0x6c')]()[_0xda45('0x6d')](_0xda45('0x6e'),'phone')[_0xda45('0x6d')](_0xda45('0x6f'),_0xda45('0x69'))['field']('id','ContactId')[_0xda45('0x6d')](_0x2443b6[_0xda45('0x75')][_0xda45('0x70')](),_0xda45('0x6b'))[_0xda45('0x6d')](_0x58949d[_0xda45('0x47')]['id'][_0xda45('0x70')](),'CampaignId')[_0xda45('0x6d')](_0xda45('0x6f'),'createdAt')[_0xda45('0x6d')](_0xda45('0x6f'),_0xda45('0x55'))['from'](_0xda45('0x72'))['where'](_0xda45('0x73'))[_0xda45('0x3b')]('ListId\x20=\x20?',_0x2443b6['CmListId'][_0xda45('0x70')]())[_0xda45('0x3b')](_0xda45('0x76'))[_0xda45('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xda45('0x6d')](_0xda45('0x7a'))['from'](_0xda45('0x7b'))[_0xda45('0x3b')](_0xda45('0x79'),_0x58949d['params']['id'][_0xda45('0x70')]())))[_0xda45('0x70')]();break;default:_0x2dbedb=squel[_0xda45('0x7d')]()[_0xda45('0x67')](_0xda45('0x7b'))[_0xda45('0x68')]([_0xda45('0x6e'),'scheduledAt',_0xda45('0x6a'),_0xda45('0x6b'),_0xda45('0x5b'),'createdAt',_0xda45('0x55')],squel[_0xda45('0x6c')]()['field'](_0xda45('0x6e'),_0xda45('0x6e'))[_0xda45('0x6d')]('NOW()',_0xda45('0x69'))[_0xda45('0x6d')]('id',_0xda45('0x6a'))[_0xda45('0x6d')](_0x2443b6['CmListId'][_0xda45('0x70')](),_0xda45('0x6b'))[_0xda45('0x6d')](_0x58949d[_0xda45('0x47')]['id'][_0xda45('0x70')](),'CampaignId')[_0xda45('0x6d')]('NOW()','createdAt')[_0xda45('0x6d')]('NOW()',_0xda45('0x55'))[_0xda45('0x71')]('cm_contacts')[_0xda45('0x3b')](_0xda45('0x73'))[_0xda45('0x3b')](_0xda45('0x74'),_0x2443b6['CmListId'][_0xda45('0x70')]())[_0xda45('0x3b')](_0xda45('0x76')))[_0xda45('0x70')]();}_0x206747[_0xda45('0x7e')](db['sequelize'][_0xda45('0x33')](_0x2dbedb));}return BPromise[_0xda45('0x7f')](_0x206747);}})[_0xda45('0x23')](function(){return _0x52841d;})[_0xda45('0x23')](respondWithResult(_0x28a9fa,null))[_0xda45('0x45')](handleError(_0x28a9fa,null));};exports[_0xda45('0x80')]=function(_0x24b70a,_0xd709c1,_0x22e03d){return db[_0xda45('0x2d')]['find']({'where':{'id':_0x24b70a[_0xda45('0x47')]['id']}})[_0xda45('0x23')](handleEntityNotFound(_0xd709c1,null))[_0xda45('0x23')](function(_0x5c6384){if(_0x5c6384){return _0x5c6384[_0xda45('0x80')](_0x24b70a[_0xda45('0x33')][_0xda45('0x63')]);}})['then'](function(_0x2f5f48){if(_0x2f5f48){return db[_0xda45('0x5a')][_0xda45('0x24')]({'where':{'ListId':_0x24b70a['query'][_0xda45('0x63')],'CampaignId':_0x24b70a[_0xda45('0x47')]['id']}})['then'](function(){return _0x2f5f48;});}})[_0xda45('0x23')](respondWithStatusCode(_0xd709c1,null))['catch'](handleError(_0xd709c1,null));};exports[_0xda45('0x81')]=function(_0x59fbfb,_0x2faebb,_0x43d63d){var _0x52fe62={'raw':!![],'where':{}};var _0x3e4c67={};var _0x496ba3={'count':0x0,'rows':[]};return db[_0xda45('0x2d')][_0xda45('0x59')]({'where':{'id':_0x59fbfb['params']['id']}})[_0xda45('0x23')](handleEntityNotFound(_0x2faebb,null))[_0xda45('0x23')](function(_0x4c4f8c){if(_0x4c4f8c){_0x3e4c67[_0xda45('0x32')]=_[_0xda45('0x34')](db['CmList'][_0xda45('0x2e')]);_0x3e4c67[_0xda45('0x33')]=_[_0xda45('0x34')](_0x59fbfb[_0xda45('0x33')]);_0x3e4c67['filters']=_[_0xda45('0x48')](_0x3e4c67[_0xda45('0x32')],_0x3e4c67[_0xda45('0x33')]);_0x52fe62[_0xda45('0x35')]=_[_0xda45('0x48')](_0x3e4c67[_0xda45('0x32')],qs['fields'](_0x59fbfb[_0xda45('0x33')][_0xda45('0x49')]));_0x52fe62[_0xda45('0x35')]=_0x52fe62[_0xda45('0x35')][_0xda45('0x36')]?_0x52fe62[_0xda45('0x35')]:_0x3e4c67['model'];if(!_0x59fbfb[_0xda45('0x33')]['hasOwnProperty'](_0xda45('0x38'))){_0x52fe62[_0xda45('0x1c')]=qs[_0xda45('0x1c')](_0x59fbfb[_0xda45('0x33')]['limit']);_0x52fe62[_0xda45('0x1b')]=qs[_0xda45('0x1b')](_0x59fbfb[_0xda45('0x33')][_0xda45('0x1b')]);}_0x52fe62[_0xda45('0x39')]=qs[_0xda45('0x3a')](_0x59fbfb[_0xda45('0x33')][_0xda45('0x3a')]);_0x52fe62[_0xda45('0x3b')]=qs[_0xda45('0x3c')](_[_0xda45('0x3d')](_0x59fbfb[_0xda45('0x33')],_0x3e4c67[_0xda45('0x3c')]));_0x52fe62[_0xda45('0x3b')][_0xda45('0x5b')]=_0x4c4f8c['id'];if(_0x59fbfb[_0xda45('0x33')][_0xda45('0x3e')]){_0x52fe62[_0xda45('0x3b')]=_[_0xda45('0x3f')](_0x52fe62['where'],{'$or':_[_0xda45('0x2c')](_0x52fe62['attributes'],function(_0x523917){var _0x1f33fc={};_0x1f33fc[_0x523917]={'$like':'%'+_0x59fbfb[_0xda45('0x33')][_0xda45('0x3e')]+'%'};return _0x1f33fc;})});}_0x52fe62=_[_0xda45('0x3f')]({},_0x52fe62,_0x59fbfb['options']);return db[_0xda45('0x61')]['count']({'where':_0x52fe62[_0xda45('0x3b')]})[_0xda45('0x23')](function(_0x597cc5){_0x496ba3[_0xda45('0x1a')]=_0x597cc5;if(_0x59fbfb[_0xda45('0x33')][_0xda45('0x41')]){_0x52fe62[_0xda45('0x42')]=[{'all':!![]}];}return db[_0xda45('0x61')][_0xda45('0x43')](_0x52fe62);})[_0xda45('0x23')](function(_0x107c05){_0x496ba3[_0xda45('0x44')]=_0x107c05;return _0x496ba3;});}})['then'](respondWithFilteredResult(_0x2faebb,_0x52fe62))[_0xda45('0x45')](handleError(_0x2faebb,null));};exports[_0xda45('0x82')]=function(_0x52d924,_0x343404,_0x545416){var _0x11a93b,_0x342dd7;return db[_0xda45('0x2d')]['find']({'where':{'id':_0x52d924['params']['id']}})[_0xda45('0x23')](handleEntityNotFound(_0x343404,null))[_0xda45('0x23')](function(_0x31d5d6){if(_0x31d5d6){_0x342dd7=_0x31d5d6;return _0x31d5d6[_0xda45('0x82')](_0x52d924[_0xda45('0x4a')][_0xda45('0x63')],_[_0xda45('0x53')](_0x52d924[_0xda45('0x4a')],[_0xda45('0x63'),'id'])||{});}return null;})['spread'](function(_0x1cd4a6){var _0x197f4b;_0x11a93b=_0x1cd4a6||[];var _0x56c194=[];if(_0x1cd4a6){for(var _0x125fcd=0x0;_0x125fcd<_0x1cd4a6['length'];_0x125fcd+=0x1){var _0xbfa888=_0x1cd4a6[_0x125fcd][_0xda45('0x25')]({'plain':!![]});_0x197f4b=squel[_0xda45('0x7d')]()[_0xda45('0x67')](_0xda45('0x83'))['fromQuery']([_0xda45('0x6e'),_0xda45('0x6a'),_0xda45('0x6b'),_0xda45('0x5b'),_0xda45('0x54'),'updatedAt'],squel['select']()[_0xda45('0x6d')](_0xda45('0x6e'),_0xda45('0x6e'))[_0xda45('0x6d')]('id','ContactId')[_0xda45('0x6d')](_0xbfa888['CmListId'][_0xda45('0x70')](),'ListId')[_0xda45('0x6d')](_0x52d924[_0xda45('0x47')]['id']['toString'](),_0xda45('0x5b'))[_0xda45('0x6d')](_0xda45('0x6f'),_0xda45('0x54'))['field']('NOW()',_0xda45('0x55'))['from']('cm_contacts')[_0xda45('0x3b')](_0xda45('0x73'))[_0xda45('0x3b')](_0xda45('0x74'),_0xbfa888[_0xda45('0x75')]['toString']())['where'](_0xda45('0x76')))[_0xda45('0x70')]();_0x56c194[_0xda45('0x7e')](db[_0xda45('0x84')][_0xda45('0x33')](_0x197f4b));}return BPromise[_0xda45('0x7f')](_0x56c194);}})[_0xda45('0x23')](function(){return _0x11a93b;})[_0xda45('0x23')](respondWithResult(_0x343404,null))[_0xda45('0x45')](handleError(_0x343404,null));};exports[_0xda45('0x85')]=function(_0xfc67d9,_0x2039c7,_0x438eb7){return db[_0xda45('0x2d')]['find']({'where':{'id':_0xfc67d9[_0xda45('0x47')]['id']}})[_0xda45('0x23')](handleEntityNotFound(_0x2039c7,null))[_0xda45('0x23')](function(_0x56a138){if(_0x56a138){return _0x56a138['removeBlackLists'](_0xfc67d9[_0xda45('0x33')][_0xda45('0x63')]);}})['then'](function(_0x3b35c6){if(_0x3b35c6){return db[_0xda45('0x5f')][_0xda45('0x24')]({'where':{'ListId':_0xfc67d9[_0xda45('0x33')][_0xda45('0x63')],'CampaignId':_0xfc67d9['params']['id']}})[_0xda45('0x23')](function(){return _0x3b35c6;});}})['then'](respondWithStatusCode(_0x2039c7,null))[_0xda45('0x45')](handleError(_0x2039c7,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index a89990f..12b3d36 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x9148ba,_0x2cb1b5){var _0x355e3b=function(_0x134846){while(--_0x134846){_0x9148ba['push'](_0x9148ba['shift']());}};_0x355e3b(++_0x2cb1b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x784e31,_0x51f0f1){_0x784e31=_0x784e31-0x0;var _0x221db5=_0xb10b[_0x784e31];return _0x221db5;};'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')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0xb10b,0x12a));var _0xbb10=function(_0x29fa3d,_0x45d24f){_0x29fa3d=_0x29fa3d-0x0;var _0x5d4bbf=_0xb10b[_0x29fa3d];return _0x5d4bbf;};'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')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ad67f1a..f70a9f7 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x33761b,_0x502ffb){var _0x209ecc=function(_0x4066bf){while(--_0x4066bf){_0x33761b['push'](_0x33761b['shift']());}};_0x209ecc(++_0x502ffb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x175757,_0xf83378){var _0x25b780=function(_0x57b71e){while(--_0x57b71e){_0x175757['push'](_0x175757['shift']());}};_0x25b780(++_0xf83378);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 180d5dd..1eb86b9 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 _0x0c46=['getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addLists','addBlackLists','put','update','destroy','delete','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers'];(function(_0x21f28f,_0x3be6b8){var _0x180f21=function(_0x4be8ac){while(--_0x4be8ac){_0x21f28f['push'](_0x21f28f['shift']());}};_0x180f21(++_0x3be6b8);}(_0x0c46,0xe6));var _0x60c4=function(_0x596184,_0x5bdd8c){_0x596184=_0x596184-0x0;var _0x51c0d3=_0x0c46[_0x596184];return _0x51c0d3;};'use strict';var multer=require(_0x60c4('0x0'));var util=require('util');var path=require(_0x60c4('0x1'));var timeout=require(_0x60c4('0x2'));var express=require(_0x60c4('0x3'));var router=express[_0x60c4('0x4')]();var auth=require(_0x60c4('0x5'));var interaction=require(_0x60c4('0x6'));var config=require(_0x60c4('0x7'));var controller=require(_0x60c4('0x8'));router[_0x60c4('0x9')]('/',auth['isAuthenticated'](),controller[_0x60c4('0xa')]);router[_0x60c4('0x9')](_0x60c4('0xb'),auth[_0x60c4('0xc')](),controller[_0x60c4('0xd')]);router[_0x60c4('0x9')](_0x60c4('0xe'),auth[_0x60c4('0xc')](),controller[_0x60c4('0xf')]);router[_0x60c4('0x9')](_0x60c4('0x10'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x60c4('0x9')](_0x60c4('0x11'),auth[_0x60c4('0xc')](),controller[_0x60c4('0x12')]);router[_0x60c4('0x9')](_0x60c4('0x13'),auth['isAuthenticated'](),controller[_0x60c4('0x14')]);router[_0x60c4('0x9')](_0x60c4('0x15'),auth[_0x60c4('0xc')](),controller[_0x60c4('0x16')]);router[_0x60c4('0x9')](_0x60c4('0x17'),auth[_0x60c4('0xc')](),controller['getBlackLists']);router['post']('/',auth[_0x60c4('0xc')](),controller['create']);router[_0x60c4('0x18')](_0x60c4('0x19'),auth[_0x60c4('0xc')](),controller[_0x60c4('0x1a')]);router[_0x60c4('0x18')](_0x60c4('0x15'),auth[_0x60c4('0xc')](),controller[_0x60c4('0x1b')]);router[_0x60c4('0x18')](_0x60c4('0x17'),auth[_0x60c4('0xc')](),controller[_0x60c4('0x1c')]);router[_0x60c4('0x1d')]('/:id',auth[_0x60c4('0xc')](),controller[_0x60c4('0x1e')]);router['delete']('/:id',auth[_0x60c4('0xc')](),controller[_0x60c4('0x1f')]);router[_0x60c4('0x20')](_0x60c4('0x15'),auth['isAuthenticated'](),controller['removeLists']);router[_0x60c4('0x20')](_0x60c4('0x17'),auth['isAuthenticated'](),controller[_0x60c4('0x21')]);module[_0x60c4('0x22')]=router; \ No newline at end of file +var _0x60cf=['/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x60cf,0x186));var _0xf60c=function(_0x4bbf87,_0x3490e0){_0x4bbf87=_0x4bbf87-0x0;var _0x59bfce=_0x60cf[_0x4bbf87];return _0x59bfce;};'use strict';var multer=require(_0xf60c('0x0'));var util=require(_0xf60c('0x1'));var path=require(_0xf60c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf60c('0x3')]();var auth=require(_0xf60c('0x4'));var interaction=require(_0xf60c('0x5'));var config=require(_0xf60c('0x6'));var controller=require(_0xf60c('0x7'));router[_0xf60c('0x8')]('/',auth[_0xf60c('0x9')](),controller[_0xf60c('0xa')]);router[_0xf60c('0x8')](_0xf60c('0xb'),auth[_0xf60c('0x9')](),controller['show']);router[_0xf60c('0x8')](_0xf60c('0xc'),auth[_0xf60c('0x9')](),controller[_0xf60c('0xd')]);router[_0xf60c('0x8')](_0xf60c('0xe'),auth['isAuthenticated'](),controller[_0xf60c('0xf')]);router[_0xf60c('0x8')](_0xf60c('0x10'),auth[_0xf60c('0x9')](),controller[_0xf60c('0x11')]);router[_0xf60c('0x8')](_0xf60c('0x12'),auth[_0xf60c('0x9')](),controller['getHopperBlacks']);router['get'](_0xf60c('0x13'),auth[_0xf60c('0x9')](),controller['getLists']);router[_0xf60c('0x8')](_0xf60c('0x14'),auth['isAuthenticated'](),controller[_0xf60c('0x15')]);router[_0xf60c('0x16')]('/',auth[_0xf60c('0x9')](),controller[_0xf60c('0x17')]);router['post'](_0xf60c('0x18'),auth[_0xf60c('0x9')](),controller['clone']);router[_0xf60c('0x16')](_0xf60c('0x13'),auth[_0xf60c('0x9')](),controller[_0xf60c('0x19')]);router[_0xf60c('0x16')](_0xf60c('0x14'),auth[_0xf60c('0x9')](),controller[_0xf60c('0x1a')]);router[_0xf60c('0x1b')](_0xf60c('0xb'),auth[_0xf60c('0x9')](),controller[_0xf60c('0x1c')]);router['delete']('/:id',auth[_0xf60c('0x9')](),controller[_0xf60c('0x1d')]);router[_0xf60c('0x1e')]('/:id/lists',auth['isAuthenticated'](),controller[_0xf60c('0x1f')]);router[_0xf60c('0x1e')](_0xf60c('0x14'),auth[_0xf60c('0x9')](),controller[_0xf60c('0x20')]);module[_0xf60c('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index cc05ff0..7181a88 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 _0x0fc5=['sequelize','exports','TEXT','VIRTUAL','getDataValue'];(function(_0x316772,_0x20e198){var _0x2531e9=function(_0x11f43c){while(--_0x11f43c){_0x316772['push'](_0x316772['shift']());}};_0x2531e9(++_0x20e198);}(_0x0fc5,0x177));var _0x50fc=function(_0xf328c6,_0xbf73d9){_0xf328c6=_0xf328c6-0x0;var _0x49ad4e=_0x0fc5[_0xf328c6];return _0x49ad4e;};'use strict';var Sequelize=require(_0x50fc('0x0'));module[_0x50fc('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x50fc('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x50fc('0x3')],'get':function(){return this[_0x50fc('0x4')]('key');}}}; \ No newline at end of file +var _0xee64=['STRING','VIRTUAL','getDataValue','key'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xee64,0x110));var _0x4ee6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xee64[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x4ee6('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x4ee6('0x0')]},'name':{'type':Sequelize[_0x4ee6('0x1')],'get':function(){return this[_0x4ee6('0x2')](_0x4ee6('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ae72602..8f16883 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 _0x0dab=['show','params','keys','catch','body','find','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','name','send','index','map','CannedAnswer','rawAttributes','type','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x3d414b,_0x509133){var _0x5778ba=function(_0x52dd82){while(--_0x52dd82){_0x3d414b['push'](_0x3d414b['shift']());}};_0x5778ba(++_0x509133);}(_0x0dab,0x1cc));var _0xb0da=function(_0x112849,_0x33bdbc){_0x112849=_0x112849-0x0;var _0x2fa456=_0x0dab[_0x112849];return _0x2fa456;};'use strict';var pdf=require(_0xb0da('0x0'));var emlformat=require(_0xb0da('0x1'));var rimraf=require(_0xb0da('0x2'));var zipdir=require(_0xb0da('0x3'));var jsonpatch=require(_0xb0da('0x4'));var rp=require(_0xb0da('0x5'));var moment=require('moment');var BPromise=require(_0xb0da('0x6'));var Mustache=require(_0xb0da('0x7'));var util=require(_0xb0da('0x8'));var path=require(_0xb0da('0x9'));var sox=require('sox');var csv=require(_0xb0da('0xa'));var ejs=require(_0xb0da('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb0da('0xc'));var crypto=require(_0xb0da('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb0da('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb0da('0xf'));var Papa=require(_0xb0da('0x10'));var Redis=require(_0xb0da('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb0da('0x12'));var as=require(_0xb0da('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0da('0x14'))(_0xb0da('0x15'));var utils=require(_0xb0da('0x16'));var config=require('../../config/environment');var db=require(_0xb0da('0x17'))['db'];function respondWithStatusCode(_0x24020d,_0x480d57){_0x480d57=_0x480d57||0xcc;return function(_0x4364d0){if(_0x4364d0){return _0x24020d[_0xb0da('0x18')](_0x480d57);}return _0x24020d[_0xb0da('0x19')](_0x480d57)[_0xb0da('0x1a')]();};}function respondWithResult(_0xc8efc,_0x1524bc){_0x1524bc=_0x1524bc||0xc8;return function(_0x420888){if(_0x420888){return _0xc8efc[_0xb0da('0x19')](_0x1524bc)[_0xb0da('0x1b')](_0x420888);}};}function respondWithFilteredResult(_0x466264,_0x1380ac){return function(_0x4d0c54){if(_0x4d0c54){var _0x20c7bd=_0x4d0c54[_0xb0da('0x1c')],_0x2ab4c3=_0x1380ac[_0xb0da('0x1d')],_0x2348b6=_0x1380ac[_0xb0da('0x1d')]+_0x1380ac[_0xb0da('0x1e')],_0x49ebdb;if(_0x2348b6>=_0x20c7bd){_0x2348b6=_0x20c7bd;_0x49ebdb=0xc8;}else{_0x49ebdb=0xce;}_0x466264[_0xb0da('0x19')](_0x49ebdb);return _0x466264[_0xb0da('0x1f')](_0xb0da('0x20'),_0x2ab4c3+'-'+_0x2348b6+'/'+_0x20c7bd)[_0xb0da('0x1b')](_0x4d0c54);}return null;};}function patchUpdates(_0x13cb8c){return function(_0x383686){try{jsonpatch['apply'](_0x383686,_0x13cb8c,!![]);}catch(_0x522203){return BPromise[_0xb0da('0x21')](_0x522203);}return _0x383686[_0xb0da('0x22')]();};}function saveUpdates(_0x2f9397,_0x568885){return function(_0x1e9aa4){if(_0x1e9aa4){return _0x1e9aa4[_0xb0da('0x23')](_0x2f9397)[_0xb0da('0x24')](function(_0x57b825){return _0x57b825;});}return null;};}function removeEntity(_0x52953a,_0x47a0a1){return function(_0x55a478){if(_0x55a478){return _0x55a478[_0xb0da('0x25')]()[_0xb0da('0x24')](function(){var _0x53df82=_0x55a478[_0xb0da('0x26')]({'plain':!![]});var _0x1d3594=_0xb0da('0x27');return db[_0xb0da('0x28')][_0xb0da('0x25')]({'where':{'type':_0x1d3594,'resourceId':_0x53df82['id']}})[_0xb0da('0x24')](function(){return _0x55a478;});})['then'](function(){_0x52953a[_0xb0da('0x19')](0xcc)[_0xb0da('0x1a')]();});}};}function handleEntityNotFound(_0x22219a,_0x1de979){return function(_0x4286cc){if(!_0x4286cc){_0x22219a['sendStatus'](0x194);}return _0x4286cc;};}function handleError(_0x2e3979,_0x3b5c8c){_0x3b5c8c=_0x3b5c8c||0x1f4;return function(_0x4ab868){logger['error'](_0x4ab868['stack']);if(_0x4ab868['name']){delete _0x4ab868[_0xb0da('0x29')];}_0x2e3979[_0xb0da('0x19')](_0x3b5c8c)[_0xb0da('0x2a')](_0x4ab868);};}exports[_0xb0da('0x2b')]=function(_0x4ab1d3,_0x14f679){var _0x4bc43e={},_0x1da42b={},_0x549f99={'count':0x0,'rows':[]};var _0x5a5257=_[_0xb0da('0x2c')](db[_0xb0da('0x2d')][_0xb0da('0x2e')],function(_0x3f00c0){return{'name':_0x3f00c0['fieldName'],'type':_0x3f00c0[_0xb0da('0x2f')]['key']};});_0x1da42b['model']=_[_0xb0da('0x2c')](_0x5a5257,'name');_0x1da42b[_0xb0da('0x30')]=_['keys'](_0x4ab1d3[_0xb0da('0x30')]);_0x1da42b['filters']=_[_0xb0da('0x31')](_0x1da42b[_0xb0da('0x32')],_0x1da42b[_0xb0da('0x30')]);_0x4bc43e['attributes']=_[_0xb0da('0x31')](_0x1da42b[_0xb0da('0x32')],qs['fields'](_0x4ab1d3['query'][_0xb0da('0x33')]));_0x4bc43e['attributes']=_0x4bc43e[_0xb0da('0x34')][_0xb0da('0x35')]?_0x4bc43e['attributes']:_0x1da42b[_0xb0da('0x32')];if(!_0x4ab1d3[_0xb0da('0x30')][_0xb0da('0x36')](_0xb0da('0x37'))){_0x4bc43e[_0xb0da('0x1e')]=qs['limit'](_0x4ab1d3[_0xb0da('0x30')]['limit']);_0x4bc43e[_0xb0da('0x1d')]=qs[_0xb0da('0x1d')](_0x4ab1d3[_0xb0da('0x30')][_0xb0da('0x1d')]);}_0x4bc43e[_0xb0da('0x38')]=qs[_0xb0da('0x39')](_0x4ab1d3[_0xb0da('0x30')][_0xb0da('0x39')]);_0x4bc43e[_0xb0da('0x3a')]=qs[_0xb0da('0x3b')](_[_0xb0da('0x3c')](_0x4ab1d3['query'],_0x1da42b[_0xb0da('0x3b')]),_0x5a5257);if(_0x4ab1d3[_0xb0da('0x30')]['filter']){_0x4bc43e[_0xb0da('0x3a')]=_[_0xb0da('0x3d')](_0x4bc43e['where'],{'$or':_[_0xb0da('0x2c')](_0x5a5257,function(_0x2e14c8){if(_0x2e14c8['type']!==_0xb0da('0x3e')){var _0x5aa820={};_0x5aa820[_0x2e14c8[_0xb0da('0x29')]]={'$like':'%'+_0x4ab1d3[_0xb0da('0x30')][_0xb0da('0x3f')]+'%'};return _0x5aa820;}})});}_0x4bc43e=_[_0xb0da('0x3d')]({},_0x4bc43e,_0x4ab1d3[_0xb0da('0x40')]);var _0x283198={'where':_0x4bc43e[_0xb0da('0x3a')]};return db[_0xb0da('0x2d')][_0xb0da('0x1c')](_0x283198)['then'](function(_0x55dcea){_0x549f99[_0xb0da('0x1c')]=_0x55dcea;if(_0x4ab1d3['query'][_0xb0da('0x41')]){_0x4bc43e[_0xb0da('0x42')]=[{'all':!![]}];}return db[_0xb0da('0x2d')]['findAll'](_0x4bc43e);})[_0xb0da('0x24')](function(_0x3df14e){_0x549f99[_0xb0da('0x43')]=_0x3df14e;return _0x549f99;})['then'](respondWithFilteredResult(_0x14f679,_0x4bc43e))['catch'](handleError(_0x14f679,null));};exports[_0xb0da('0x44')]=function(_0x1f427e,_0x52cfd0){var _0x468f27={'raw':!![],'where':{'id':_0x1f427e[_0xb0da('0x45')]['id']}},_0x347bc9={};_0x347bc9['model']=_[_0xb0da('0x46')](db['CannedAnswer']['rawAttributes']);_0x347bc9[_0xb0da('0x30')]=_[_0xb0da('0x46')](_0x1f427e[_0xb0da('0x30')]);_0x347bc9[_0xb0da('0x3b')]=_['intersection'](_0x347bc9[_0xb0da('0x32')],_0x347bc9[_0xb0da('0x30')]);_0x468f27[_0xb0da('0x34')]=_[_0xb0da('0x31')](_0x347bc9['model'],qs[_0xb0da('0x33')](_0x1f427e[_0xb0da('0x30')][_0xb0da('0x33')]));_0x468f27[_0xb0da('0x34')]=_0x468f27[_0xb0da('0x34')][_0xb0da('0x35')]?_0x468f27[_0xb0da('0x34')]:_0x347bc9[_0xb0da('0x32')];if(_0x1f427e['query'][_0xb0da('0x41')]){_0x468f27[_0xb0da('0x42')]=[{'all':!![]}];}_0x468f27=_[_0xb0da('0x3d')]({},_0x468f27,_0x1f427e['options']);return db['CannedAnswer']['find'](_0x468f27)['then'](handleEntityNotFound(_0x52cfd0,null))['then'](respondWithResult(_0x52cfd0,null))[_0xb0da('0x47')](handleError(_0x52cfd0,null));};exports[_0xb0da('0x23')]=function(_0x535f27,_0x4efd37){if(_0x535f27[_0xb0da('0x48')]['id']){delete _0x535f27[_0xb0da('0x48')]['id'];}return db[_0xb0da('0x2d')][_0xb0da('0x49')]({'where':{'id':_0x535f27[_0xb0da('0x45')]['id']}})[_0xb0da('0x24')](handleEntityNotFound(_0x4efd37,null))[_0xb0da('0x24')](saveUpdates(_0x535f27['body'],null))[_0xb0da('0x24')](respondWithResult(_0x4efd37,null))[_0xb0da('0x47')](handleError(_0x4efd37,null));};exports['destroy']=function(_0x2ee8c7,_0x4d74c1){return db[_0xb0da('0x2d')][_0xb0da('0x49')]({'where':{'id':_0x2ee8c7[_0xb0da('0x45')]['id']}})[_0xb0da('0x24')](handleEntityNotFound(_0x4d74c1,null))[_0xb0da('0x24')](removeEntity(_0x4d74c1,null))['catch'](handleError(_0x4d74c1,null));};exports[_0xb0da('0x4a')]=function(_0xd8a64d,_0xb6ff8e){var _0x3950d5={'key':_0xd8a64d['body'][_0xb0da('0x4b')]};if(_0xd8a64d[_0xb0da('0x48')][_0xb0da('0x4c')]){_0x3950d5[_0xb0da('0x4c')]=_0xd8a64d[_0xb0da('0x48')]['MailAccountId'];}else if(_0xd8a64d[_0xb0da('0x48')][_0xb0da('0x4d')]){_0x3950d5[_0xb0da('0x4d')]=_0xd8a64d[_0xb0da('0x48')][_0xb0da('0x4d')];}else if(_0xd8a64d[_0xb0da('0x48')]['OpenchannelAccountId']){_0x3950d5[_0xb0da('0x4e')]=_0xd8a64d[_0xb0da('0x48')][_0xb0da('0x4e')];}else if(_0xd8a64d[_0xb0da('0x48')]['ChatWebsiteId']){_0x3950d5[_0xb0da('0x4f')]=_0xd8a64d['body'][_0xb0da('0x4f')];}return db[_0xb0da('0x2d')][_0xb0da('0x49')]({'where':_0x3950d5})[_0xb0da('0x24')](function(_0x1b49cb){if(_0x1b49cb){throw new db['Sequelize'][(_0xb0da('0x50'))](_0xb0da('0x51'));}return db[_0xb0da('0x2d')][_0xb0da('0x4a')](_0xd8a64d['body']);})[_0xb0da('0x24')](function(_0x1b5115){var _0x45ba18=_0xd8a64d[_0xb0da('0x52')][_0xb0da('0x26')]({'plain':!![]});if(!_0x45ba18)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45ba18[_0xb0da('0x53')]===_0xb0da('0x52')){var _0x2f5bd1=_0x1b5115[_0xb0da('0x26')]({'plain':!![]});return db[_0xb0da('0x54')][_0xb0da('0x49')]({'where':{'name':_0xb0da('0x27'),'userProfileId':_0x45ba18[_0xb0da('0x55')]},'raw':!![]})[_0xb0da('0x24')](function(_0x3fd5df){if(_0x3fd5df&&_0x3fd5df[_0xb0da('0x56')]===0x0){return db[_0xb0da('0x28')][_0xb0da('0x4a')]({'name':_0x2f5bd1[_0xb0da('0x29')],'resourceId':_0x2f5bd1['id'],'type':_0x3fd5df[_0xb0da('0x29')],'sectionId':_0x3fd5df['id']},{})['then'](function(){return _0x1b5115;});}else{return _0x1b5115;}})['catch'](function(_0xcbd195){logger['error'](_0xb0da('0x57'),_0xcbd195);throw _0xcbd195;});}return _0x1b5115;})[_0xb0da('0x24')](respondWithResult(_0xb6ff8e,0xc9))['catch'](handleError(_0xb6ff8e,null));}; \ No newline at end of file +var _0xc0b9=['status','Content-Range','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','json','offset','limit'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc0b9,0x199));var _0x9c0b=function(_0xa7dbc2,_0x22d81f){_0xa7dbc2=_0xa7dbc2-0x0;var _0x2e746f=_0xc0b9[_0xa7dbc2];return _0x2e746f;};'use strict';var pdf=require(_0x9c0b('0x0'));var emlformat=require(_0x9c0b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9c0b('0x2'));var jsonpatch=require(_0x9c0b('0x3'));var rp=require(_0x9c0b('0x4'));var moment=require('moment');var BPromise=require(_0x9c0b('0x5'));var Mustache=require(_0x9c0b('0x6'));var util=require(_0x9c0b('0x7'));var path=require(_0x9c0b('0x8'));var sox=require('sox');var csv=require(_0x9c0b('0x9'));var ejs=require(_0x9c0b('0xa'));var fs=require('fs');var _=require(_0x9c0b('0xb'));var squel=require(_0x9c0b('0xc'));var crypto=require(_0x9c0b('0xd'));var jsforce=require(_0x9c0b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9c0b('0x9'));var querystring=require(_0x9c0b('0xf'));var Papa=require(_0x9c0b('0x10'));var Redis=require(_0x9c0b('0x11'));var authService=require(_0x9c0b('0x12'));var qs=require(_0x9c0b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9c0b('0x14'));var config=require('../../config/environment');var db=require(_0x9c0b('0x15'))['db'];function respondWithStatusCode(_0x1a2c48,_0x14f849){_0x14f849=_0x14f849||0xcc;return function(_0xa291b6){if(_0xa291b6){return _0x1a2c48[_0x9c0b('0x16')](_0x14f849);}return _0x1a2c48['status'](_0x14f849)['end']();};}function respondWithResult(_0x2e6cfd,_0x156696){_0x156696=_0x156696||0xc8;return function(_0xf1468e){if(_0xf1468e){return _0x2e6cfd['status'](_0x156696)[_0x9c0b('0x17')](_0xf1468e);}};}function respondWithFilteredResult(_0x51ec63,_0x32af56){return function(_0x4fceea){if(_0x4fceea){var _0x355c87=_0x4fceea['count'],_0x2fdb19=_0x32af56[_0x9c0b('0x18')],_0x2f10a9=_0x32af56[_0x9c0b('0x18')]+_0x32af56[_0x9c0b('0x19')],_0x5d7ae6;if(_0x2f10a9>=_0x355c87){_0x2f10a9=_0x355c87;_0x5d7ae6=0xc8;}else{_0x5d7ae6=0xce;}_0x51ec63[_0x9c0b('0x1a')](_0x5d7ae6);return _0x51ec63['set'](_0x9c0b('0x1b'),_0x2fdb19+'-'+_0x2f10a9+'/'+_0x355c87)[_0x9c0b('0x17')](_0x4fceea);}return null;};}function patchUpdates(_0x10e5be){return function(_0x257319){try{jsonpatch['apply'](_0x257319,_0x10e5be,!![]);}catch(_0x2ed542){return BPromise[_0x9c0b('0x1c')](_0x2ed542);}return _0x257319['save']();};}function saveUpdates(_0x14689f,_0x268154){return function(_0x456469){if(_0x456469){return _0x456469[_0x9c0b('0x1d')](_0x14689f)[_0x9c0b('0x1e')](function(_0x2cb82f){return _0x2cb82f;});}return null;};}function removeEntity(_0x47c44e,_0x5be76a){return function(_0x395156){if(_0x395156){return _0x395156[_0x9c0b('0x1f')]()[_0x9c0b('0x1e')](function(){var _0xfd0b0a=_0x395156[_0x9c0b('0x20')]({'plain':!![]});var _0x5ee4fb=_0x9c0b('0x21');return db[_0x9c0b('0x22')]['destroy']({'where':{'type':_0x5ee4fb,'resourceId':_0xfd0b0a['id']}})[_0x9c0b('0x1e')](function(){return _0x395156;});})[_0x9c0b('0x1e')](function(){_0x47c44e[_0x9c0b('0x1a')](0xcc)[_0x9c0b('0x23')]();});}};}function handleEntityNotFound(_0x5003b3,_0x19f715){return function(_0x5a5564){if(!_0x5a5564){_0x5003b3['sendStatus'](0x194);}return _0x5a5564;};}function handleError(_0x5825d2,_0x4a8972){_0x4a8972=_0x4a8972||0x1f4;return function(_0x3879fc){logger[_0x9c0b('0x24')](_0x3879fc['stack']);if(_0x3879fc[_0x9c0b('0x25')]){delete _0x3879fc[_0x9c0b('0x25')];}_0x5825d2[_0x9c0b('0x1a')](_0x4a8972)[_0x9c0b('0x26')](_0x3879fc);};}exports[_0x9c0b('0x27')]=function(_0x3dc99a,_0x3db812){var _0x1f7b8f={},_0x6a6bb={},_0x4d352c={'count':0x0,'rows':[]};var _0x4b52d9=_['map'](db[_0x9c0b('0x28')][_0x9c0b('0x29')],function(_0xe6096f){return{'name':_0xe6096f[_0x9c0b('0x2a')],'type':_0xe6096f[_0x9c0b('0x2b')][_0x9c0b('0x2c')]};});_0x6a6bb[_0x9c0b('0x2d')]=_[_0x9c0b('0x2e')](_0x4b52d9,'name');_0x6a6bb[_0x9c0b('0x2f')]=_['keys'](_0x3dc99a[_0x9c0b('0x2f')]);_0x6a6bb['filters']=_['intersection'](_0x6a6bb['model'],_0x6a6bb[_0x9c0b('0x2f')]);_0x1f7b8f[_0x9c0b('0x30')]=_[_0x9c0b('0x31')](_0x6a6bb[_0x9c0b('0x2d')],qs[_0x9c0b('0x32')](_0x3dc99a['query'][_0x9c0b('0x32')]));_0x1f7b8f[_0x9c0b('0x30')]=_0x1f7b8f[_0x9c0b('0x30')]['length']?_0x1f7b8f[_0x9c0b('0x30')]:_0x6a6bb['model'];if(!_0x3dc99a[_0x9c0b('0x2f')][_0x9c0b('0x33')](_0x9c0b('0x34'))){_0x1f7b8f[_0x9c0b('0x19')]=qs[_0x9c0b('0x19')](_0x3dc99a[_0x9c0b('0x2f')][_0x9c0b('0x19')]);_0x1f7b8f['offset']=qs[_0x9c0b('0x18')](_0x3dc99a['query']['offset']);}_0x1f7b8f[_0x9c0b('0x35')]=qs[_0x9c0b('0x36')](_0x3dc99a[_0x9c0b('0x2f')][_0x9c0b('0x36')]);_0x1f7b8f[_0x9c0b('0x37')]=qs[_0x9c0b('0x38')](_[_0x9c0b('0x39')](_0x3dc99a[_0x9c0b('0x2f')],_0x6a6bb[_0x9c0b('0x38')]),_0x4b52d9);if(_0x3dc99a[_0x9c0b('0x2f')][_0x9c0b('0x3a')]){_0x1f7b8f[_0x9c0b('0x37')]=_[_0x9c0b('0x3b')](_0x1f7b8f[_0x9c0b('0x37')],{'$or':_['map'](_0x4b52d9,function(_0x4ce5cc){if(_0x4ce5cc[_0x9c0b('0x2b')]!=='VIRTUAL'){var _0xa89e26={};_0xa89e26[_0x4ce5cc[_0x9c0b('0x25')]]={'$like':'%'+_0x3dc99a[_0x9c0b('0x2f')][_0x9c0b('0x3a')]+'%'};return _0xa89e26;}})});}_0x1f7b8f=_[_0x9c0b('0x3b')]({},_0x1f7b8f,_0x3dc99a[_0x9c0b('0x3c')]);var _0x2ab781={'where':_0x1f7b8f['where']};return db[_0x9c0b('0x28')]['count'](_0x2ab781)['then'](function(_0x5ba409){_0x4d352c[_0x9c0b('0x3d')]=_0x5ba409;if(_0x3dc99a[_0x9c0b('0x2f')][_0x9c0b('0x3e')]){_0x1f7b8f[_0x9c0b('0x3f')]=[{'all':!![]}];}return db[_0x9c0b('0x28')][_0x9c0b('0x40')](_0x1f7b8f);})['then'](function(_0x2d9053){_0x4d352c[_0x9c0b('0x41')]=_0x2d9053;return _0x4d352c;})[_0x9c0b('0x1e')](respondWithFilteredResult(_0x3db812,_0x1f7b8f))[_0x9c0b('0x42')](handleError(_0x3db812,null));};exports[_0x9c0b('0x43')]=function(_0x12281d,_0x3e8264){var _0x161ec9={'raw':!![],'where':{'id':_0x12281d[_0x9c0b('0x44')]['id']}},_0x9b189b={};_0x9b189b['model']=_['keys'](db[_0x9c0b('0x28')][_0x9c0b('0x29')]);_0x9b189b[_0x9c0b('0x2f')]=_[_0x9c0b('0x45')](_0x12281d['query']);_0x9b189b[_0x9c0b('0x38')]=_[_0x9c0b('0x31')](_0x9b189b[_0x9c0b('0x2d')],_0x9b189b[_0x9c0b('0x2f')]);_0x161ec9[_0x9c0b('0x30')]=_[_0x9c0b('0x31')](_0x9b189b['model'],qs[_0x9c0b('0x32')](_0x12281d[_0x9c0b('0x2f')][_0x9c0b('0x32')]));_0x161ec9[_0x9c0b('0x30')]=_0x161ec9[_0x9c0b('0x30')][_0x9c0b('0x46')]?_0x161ec9[_0x9c0b('0x30')]:_0x9b189b['model'];if(_0x12281d['query']['includeAll']){_0x161ec9[_0x9c0b('0x3f')]=[{'all':!![]}];}_0x161ec9=_[_0x9c0b('0x3b')]({},_0x161ec9,_0x12281d['options']);return db[_0x9c0b('0x28')][_0x9c0b('0x47')](_0x161ec9)[_0x9c0b('0x1e')](handleEntityNotFound(_0x3e8264,null))[_0x9c0b('0x1e')](respondWithResult(_0x3e8264,null))[_0x9c0b('0x42')](handleError(_0x3e8264,null));};exports['update']=function(_0x50ce49,_0xc6dcbf){if(_0x50ce49[_0x9c0b('0x48')]['id']){delete _0x50ce49[_0x9c0b('0x48')]['id'];}return db[_0x9c0b('0x28')][_0x9c0b('0x47')]({'where':{'id':_0x50ce49[_0x9c0b('0x44')]['id']}})[_0x9c0b('0x1e')](handleEntityNotFound(_0xc6dcbf,null))[_0x9c0b('0x1e')](saveUpdates(_0x50ce49['body'],null))['then'](respondWithResult(_0xc6dcbf,null))[_0x9c0b('0x42')](handleError(_0xc6dcbf,null));};exports[_0x9c0b('0x1f')]=function(_0x125a9b,_0x40b748){return db[_0x9c0b('0x28')]['find']({'where':{'id':_0x125a9b[_0x9c0b('0x44')]['id']}})[_0x9c0b('0x1e')](handleEntityNotFound(_0x40b748,null))[_0x9c0b('0x1e')](removeEntity(_0x40b748,null))[_0x9c0b('0x42')](handleError(_0x40b748,null));};exports[_0x9c0b('0x49')]=function(_0x16bbae,_0x3bf7ea){var _0x546360={'key':_0x16bbae[_0x9c0b('0x48')][_0x9c0b('0x2c')]};if(_0x16bbae[_0x9c0b('0x48')][_0x9c0b('0x4a')]){_0x546360[_0x9c0b('0x4a')]=_0x16bbae[_0x9c0b('0x48')][_0x9c0b('0x4a')];}else if(_0x16bbae[_0x9c0b('0x48')][_0x9c0b('0x4b')]){_0x546360[_0x9c0b('0x4b')]=_0x16bbae[_0x9c0b('0x48')][_0x9c0b('0x4b')];}else if(_0x16bbae[_0x9c0b('0x48')][_0x9c0b('0x4c')]){_0x546360['OpenchannelAccountId']=_0x16bbae[_0x9c0b('0x48')][_0x9c0b('0x4c')];}else if(_0x16bbae[_0x9c0b('0x48')][_0x9c0b('0x4d')]){_0x546360[_0x9c0b('0x4d')]=_0x16bbae[_0x9c0b('0x48')]['ChatWebsiteId'];}return db[_0x9c0b('0x28')]['find']({'where':_0x546360})[_0x9c0b('0x1e')](function(_0x4d78ad){if(_0x4d78ad){throw new db['Sequelize'][(_0x9c0b('0x4e'))](_0x9c0b('0x4f'));}return db[_0x9c0b('0x28')][_0x9c0b('0x49')](_0x16bbae[_0x9c0b('0x48')]);})[_0x9c0b('0x1e')](function(_0x546f77){var _0x20e0be=_0x16bbae[_0x9c0b('0x50')][_0x9c0b('0x20')]({'plain':!![]});if(!_0x20e0be)throw new Error(_0x9c0b('0x51'));if(_0x20e0be[_0x9c0b('0x52')]===_0x9c0b('0x50')){var _0x5870e0=_0x546f77[_0x9c0b('0x20')]({'plain':!![]});return db[_0x9c0b('0x53')][_0x9c0b('0x47')]({'where':{'name':_0x9c0b('0x21'),'userProfileId':_0x20e0be[_0x9c0b('0x54')]},'raw':!![]})[_0x9c0b('0x1e')](function(_0x4536d8){if(_0x4536d8&&_0x4536d8[_0x9c0b('0x55')]===0x0){return db['UserProfileResource'][_0x9c0b('0x49')]({'name':_0x5870e0['name'],'resourceId':_0x5870e0['id'],'type':_0x4536d8['name'],'sectionId':_0x4536d8['id']},{})[_0x9c0b('0x1e')](function(){return _0x546f77;});}else{return _0x546f77;}})['catch'](function(_0x44e9f7){logger['error'](_0x9c0b('0x56'),_0x44e9f7);throw _0x44e9f7;});}return _0x546f77;})[_0x9c0b('0x1e')](respondWithResult(_0x3bf7ea,0xc9))[_0x9c0b('0x42')](handleError(_0x3bf7ea,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 96cf59f..4a71471 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 _0xe548=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','./cannedAnswer.attributes','define','CannedAnswer'];(function(_0x12a000,_0x46add8){var _0x1a30fc=function(_0x18641a){while(--_0x18641a){_0x12a000['push'](_0x12a000['shift']());}};_0x1a30fc(++_0x46add8);}(_0xe548,0x184));var _0x8e54=function(_0x5182f9,_0x4acf0c){_0x5182f9=_0x5182f9-0x0;var _0x4c9fad=_0xe548[_0x5182f9];return _0x4c9fad;};'use strict';var _=require(_0x8e54('0x0'));var util=require(_0x8e54('0x1'));var logger=require(_0x8e54('0x2'))(_0x8e54('0x3'));var moment=require(_0x8e54('0x4'));var BPromise=require('bluebird');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(_0x8e54('0x5'));module['exports']=function(_0x288be8,_0x47a58d){return _0x288be8[_0x8e54('0x6')](_0x8e54('0x7'),attributes,{'tableName':_0x8e54('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e54('0x9'),'collate':_0x8e54('0xa')});}; \ No newline at end of file +var _0x8ad5=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8ad5,0xf1));var _0x58ad=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8ad5[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x58ad('0x0'));var util=require(_0x58ad('0x1'));var logger=require(_0x58ad('0x2'))(_0x58ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58ad('0x4'));var fs=require('fs');var path=require(_0x58ad('0x5'));var rimraf=require(_0x58ad('0x6'));var config=require(_0x58ad('0x7'));var attributes=require(_0x58ad('0x8'));module[_0x58ad('0x9')]=function(_0x51d560,_0x5888f7){return _0x51d560[_0x58ad('0xa')](_0x58ad('0xb'),attributes,{'tableName':_0x58ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x58ad('0xd'),'collate':_0x58ad('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7e693ba..17333cd 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 _0xf17a=['info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xf17a,0xe5));var _0xaf17=function(_0x1f59b1,_0x1711ec){_0x1f59b1=_0x1f59b1-0x0;var _0x571da6=_0xf17a[_0x1f59b1];return _0x571da6;};'use strict';var _=require(_0xaf17('0x0'));var util=require('util');var moment=require(_0xaf17('0x1'));var BPromise=require(_0xaf17('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf17('0x3'));var db=require(_0xaf17('0x4'))['db'];var utils=require(_0xaf17('0x5'));var logger=require(_0xaf17('0x6'))(_0xaf17('0x7'));var config=require(_0xaf17('0x8'));var jayson=require(_0xaf17('0x9'));var client=jayson['client'][_0xaf17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4653ab,_0x5cd94b,_0x188ae2){return new BPromise(function(_0x450f78,_0x3f1d78){return client[_0xaf17('0xb')](_0x4653ab,_0x188ae2)[_0xaf17('0xc')](function(_0x8e2df6){logger[_0xaf17('0xd')](_0xaf17('0xe'),_0x5cd94b,_0xaf17('0xf'));logger[_0xaf17('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x5cd94b,_0xaf17('0xf'),JSON[_0xaf17('0x11')](_0x8e2df6));if(_0x8e2df6[_0xaf17('0x12')]){if(_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x13')]===0x1f4){logger[_0xaf17('0x12')](_0xaf17('0xe'),_0x5cd94b,_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x14')]);return _0x3f1d78(_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x14')]);}logger[_0xaf17('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x5cd94b,_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x14')]);return _0x450f78(_0x8e2df6[_0xaf17('0x12')][_0xaf17('0x14')]);}else{logger[_0xaf17('0xd')](_0xaf17('0xe'),_0x5cd94b,_0xaf17('0xf'));_0x450f78(_0x8e2df6['result'][_0xaf17('0x14')]);}})[_0xaf17('0x15')](function(_0x3a1eb3){logger[_0xaf17('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x5cd94b,_0x3a1eb3);_0x3f1d78(_0x3a1eb3);});});} \ No newline at end of file +var _0x0c26=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','randomstring'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0c26,0x107));var _0x60c2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0c26[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x60c2('0x0'));var util=require(_0x60c2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60c2('0x2'));var fs=require('fs');var Redis=require(_0x60c2('0x3'));var db=require(_0x60c2('0x4'))['db'];var utils=require(_0x60c2('0x5'));var logger=require(_0x60c2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x60c2('0x7'));var client=jayson[_0x60c2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25a5ef,_0x54f344,_0x22acbf){return new BPromise(function(_0x135d72,_0x5f252c){return client[_0x60c2('0x9')](_0x25a5ef,_0x22acbf)['then'](function(_0xd7d417){logger['info'](_0x60c2('0xa'),_0x54f344,_0x60c2('0xb'));logger[_0x60c2('0xc')](_0x60c2('0xd'),_0x54f344,'request\x20sent',JSON[_0x60c2('0xe')](_0xd7d417));if(_0xd7d417[_0x60c2('0xf')]){if(_0xd7d417['error']['code']===0x1f4){logger['error'](_0x60c2('0xa'),_0x54f344,_0xd7d417[_0x60c2('0xf')][_0x60c2('0x10')]);return _0x5f252c(_0xd7d417['error'][_0x60c2('0x10')]);}logger[_0x60c2('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x54f344,_0xd7d417['error'][_0x60c2('0x10')]);return _0x135d72(_0xd7d417['error'][_0x60c2('0x10')]);}else{logger[_0x60c2('0x11')](_0x60c2('0xa'),_0x54f344,'request\x20sent');_0x135d72(_0xd7d417['result'][_0x60c2('0x10')]);}})[_0x60c2('0x12')](function(_0x32d1ad){logger[_0x60c2('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x54f344,_0x32d1ad);_0x5f252c(_0x32d1ad);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 9d23726..dc763ad 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 _0x6e08=['exports','multer','path','express','Router','./cannedAnswer.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy'];(function(_0x5df276,_0x213082){var _0x50b0ae=function(_0x30e1f4){while(--_0x30e1f4){_0x5df276['push'](_0x5df276['shift']());}};_0x50b0ae(++_0x213082);}(_0x6e08,0x15a));var _0x86e0=function(_0x52a592,_0x2926b4){_0x52a592=_0x52a592-0x0;var _0x511e55=_0x6e08[_0x52a592];return _0x511e55;};'use strict';var multer=require(_0x86e0('0x0'));var util=require('util');var path=require(_0x86e0('0x1'));var timeout=require('connect-timeout');var express=require(_0x86e0('0x2'));var router=express[_0x86e0('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x86e0('0x4'));router[_0x86e0('0x5')]('/',auth[_0x86e0('0x6')](),controller['index']);router[_0x86e0('0x5')]('/:id',auth[_0x86e0('0x6')](),controller[_0x86e0('0x7')]);router['post']('/',auth[_0x86e0('0x6')](),controller[_0x86e0('0x8')]);router[_0x86e0('0x9')](_0x86e0('0xa'),auth[_0x86e0('0x6')](),controller[_0x86e0('0xb')]);router[_0x86e0('0xc')](_0x86e0('0xa'),auth[_0x86e0('0x6')](),controller[_0x86e0('0xd')]);module[_0x86e0('0xe')]=router; \ No newline at end of file +var _0x5480=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','post','create'];(function(_0xeaf30e,_0x1ed4f8){var _0x3db7fd=function(_0x195ccb){while(--_0x195ccb){_0xeaf30e['push'](_0xeaf30e['shift']());}};_0x3db7fd(++_0x1ed4f8);}(_0x5480,0x15b));var _0x0548=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0x5480[_0x49e584];return _0x58b1be;};'use strict';var multer=require(_0x0548('0x0'));var util=require(_0x0548('0x1'));var path=require(_0x0548('0x2'));var timeout=require(_0x0548('0x3'));var express=require(_0x0548('0x4'));var router=express[_0x0548('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0548('0x6'));var controller=require(_0x0548('0x7'));router[_0x0548('0x8')]('/',auth[_0x0548('0x9')](),controller[_0x0548('0xa')]);router[_0x0548('0x8')]('/:id',auth[_0x0548('0x9')](),controller['show']);router[_0x0548('0xb')]('/',auth[_0x0548('0x9')](),controller[_0x0548('0xc')]);router[_0x0548('0xd')](_0x0548('0xe'),auth[_0x0548('0x9')](),controller[_0x0548('0xf')]);router['delete'](_0x0548('0xe'),auth[_0x0548('0x9')](),controller[_0x0548('0x10')]);module[_0x0548('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e5f29e7..ecacc91 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 _0x9079=['INTEGER','DATE','STRING'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9079,0xca));var _0x9907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9079[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x9907('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x9907('0x1')]},'src':{'type':Sequelize[_0x9907('0x1')]},'dst':{'type':Sequelize[_0x9907('0x1')]},'dcontext':{'type':Sequelize[_0x9907('0x1')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x9907('0x1')]},'lastdata':{'type':Sequelize[_0x9907('0x1')]},'duration':{'type':Sequelize[_0x9907('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9907('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9907('0x1')]},'amaflags':{'type':Sequelize[_0x9907('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9907('0x1')]},'linkedid':{'type':Sequelize[_0x9907('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9907('0x1')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf4df=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x2f0e85,_0x2172f9){var _0x44b4c7=function(_0x5e8e5b){while(--_0x5e8e5b){_0x2f0e85['push'](_0x2f0e85['shift']());}};_0x44b4c7(++_0x2172f9);}(_0xf4df,0x16f));var _0xff4d=function(_0x52359b,_0x2d9f79){_0x52359b=_0x52359b-0x0;var _0x530b10=_0xf4df[_0x52359b];return _0x530b10;};'use strict';var Sequelize=require(_0xff4d('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xff4d('0x1')],'allowNull':![],'defaultValue':_0xff4d('0x2')},'clid':{'type':Sequelize[_0xff4d('0x3')]},'src':{'type':Sequelize[_0xff4d('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xff4d('0x3')]},'channel':{'type':Sequelize[_0xff4d('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xff4d('0x3')]},'lastdata':{'type':Sequelize[_0xff4d('0x3')]},'duration':{'type':Sequelize[_0xff4d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xff4d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xff4d('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xff4d('0x3')]},'userfield':{'type':Sequelize[_0xff4d('0x3')]},'uniqueid':{'type':Sequelize[_0xff4d('0x3')]},'linkedid':{'type':Sequelize[_0xff4d('0x3')]},'sequence':{'type':Sequelize[_0xff4d('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xff4d('0x3')]},'tag':{'type':Sequelize[_0xff4d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 939c20e..7c07d06 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 _0x4f43=['rows','catch','params','keys','include','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filters','merge','map','VIRTUAL','options','Cdr','count','includeAll','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f43,0xeb));var _0x34f4=function(_0x4510a3,_0x167f27){_0x4510a3=_0x4510a3-0x0;var _0x17bcf4=_0x4f43[_0x4510a3];return _0x17bcf4;};'use strict';var pdf=require(_0x34f4('0x0'));var emlformat=require(_0x34f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x34f4('0x2'));var jsonpatch=require(_0x34f4('0x3'));var rp=require(_0x34f4('0x4'));var moment=require(_0x34f4('0x5'));var BPromise=require(_0x34f4('0x6'));var Mustache=require(_0x34f4('0x7'));var util=require(_0x34f4('0x8'));var path=require(_0x34f4('0x9'));var sox=require(_0x34f4('0xa'));var csv=require(_0x34f4('0xb'));var ejs=require(_0x34f4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x34f4('0xd'));var crypto=require('crypto');var jsforce=require(_0x34f4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x34f4('0xb'));var querystring=require(_0x34f4('0xf'));var Papa=require(_0x34f4('0x10'));var Redis=require('ioredis');var authService=require(_0x34f4('0x11'));var qs=require(_0x34f4('0x12'));var as=require(_0x34f4('0x13'));var hardwareService=require(_0x34f4('0x14'));var logger=require(_0x34f4('0x15'))(_0x34f4('0x16'));var utils=require('../../config/utils');var config=require(_0x34f4('0x17'));var db=require(_0x34f4('0x18'))['db'];function respondWithStatusCode(_0x27e4ec,_0x8b1a75){_0x8b1a75=_0x8b1a75||0xcc;return function(_0x349f17){if(_0x349f17){return _0x27e4ec[_0x34f4('0x19')](_0x8b1a75);}return _0x27e4ec['status'](_0x8b1a75)[_0x34f4('0x1a')]();};}function respondWithResult(_0x2fed86,_0x3f9df8){_0x3f9df8=_0x3f9df8||0xc8;return function(_0x1b65a7){if(_0x1b65a7){return _0x2fed86[_0x34f4('0x1b')](_0x3f9df8)[_0x34f4('0x1c')](_0x1b65a7);}};}function respondWithFilteredResult(_0x48b8c8,_0x491234){return function(_0x2d2fc2){if(_0x2d2fc2){var _0x4f565b=_0x2d2fc2['count'],_0x48236a=_0x491234['offset'],_0x4011f8=_0x491234['offset']+_0x491234[_0x34f4('0x1d')],_0x125794;if(_0x4011f8>=_0x4f565b){_0x4011f8=_0x4f565b;_0x125794=0xc8;}else{_0x125794=0xce;}_0x48b8c8[_0x34f4('0x1b')](_0x125794);return _0x48b8c8[_0x34f4('0x1e')](_0x34f4('0x1f'),_0x48236a+'-'+_0x4011f8+'/'+_0x4f565b)[_0x34f4('0x1c')](_0x2d2fc2);}return null;};}function patchUpdates(_0x2cf6ae){return function(_0x1afd72){try{jsonpatch[_0x34f4('0x20')](_0x1afd72,_0x2cf6ae,!![]);}catch(_0x43ab1e){return BPromise['reject'](_0x43ab1e);}return _0x1afd72[_0x34f4('0x21')]();};}function saveUpdates(_0x2aacc0,_0x3ae483){return function(_0x40e97d){if(_0x40e97d){return _0x40e97d[_0x34f4('0x22')](_0x2aacc0)[_0x34f4('0x23')](function(_0x3fa297){return _0x3fa297;});}return null;};}function removeEntity(_0x1670c2,_0x1121b2){return function(_0x11f09a){if(_0x11f09a){return _0x11f09a['destroy']()[_0x34f4('0x23')](function(){_0x1670c2[_0x34f4('0x1b')](0xcc)[_0x34f4('0x1a')]();});}};}function handleEntityNotFound(_0x2ab404,_0x25551d){return function(_0x15497d){if(!_0x15497d){_0x2ab404[_0x34f4('0x19')](0x194);}return _0x15497d;};}function handleError(_0x533890,_0x1391cd){_0x1391cd=_0x1391cd||0x1f4;return function(_0x2f7000){logger[_0x34f4('0x24')](_0x2f7000[_0x34f4('0x25')]);if(_0x2f7000[_0x34f4('0x26')]){delete _0x2f7000[_0x34f4('0x26')];}_0x533890[_0x34f4('0x1b')](_0x1391cd)[_0x34f4('0x27')](_0x2f7000);};}exports[_0x34f4('0x28')]=function(_0x2dc44b,_0x333046){var _0x5650fb={},_0x47e3d4={},_0x2a9f3b={'count':0x0,'rows':[]};var _0xaefa1f=_['map'](db['Cdr'][_0x34f4('0x29')],function(_0x43ffe1){return{'name':_0x43ffe1[_0x34f4('0x2a')],'type':_0x43ffe1[_0x34f4('0x2b')]['key']};});_0x47e3d4['model']=_['map'](_0xaefa1f,_0x34f4('0x26'));_0x47e3d4['query']=_['keys'](_0x2dc44b['query']);_0x47e3d4['filters']=_['intersection'](_0x47e3d4[_0x34f4('0x2c')],_0x47e3d4[_0x34f4('0x2d')]);_0x5650fb['attributes']=_[_0x34f4('0x2e')](_0x47e3d4[_0x34f4('0x2c')],qs[_0x34f4('0x2f')](_0x2dc44b[_0x34f4('0x2d')][_0x34f4('0x2f')]));_0x5650fb[_0x34f4('0x30')]=_0x5650fb[_0x34f4('0x30')][_0x34f4('0x31')]?_0x5650fb[_0x34f4('0x30')]:_0x47e3d4[_0x34f4('0x2c')];if(!_0x2dc44b['query'][_0x34f4('0x32')](_0x34f4('0x33'))){_0x5650fb[_0x34f4('0x1d')]=qs[_0x34f4('0x1d')](_0x2dc44b[_0x34f4('0x2d')][_0x34f4('0x1d')]);_0x5650fb[_0x34f4('0x34')]=qs['offset'](_0x2dc44b[_0x34f4('0x2d')][_0x34f4('0x34')]);}_0x5650fb['order']=qs[_0x34f4('0x35')](_0x2dc44b[_0x34f4('0x2d')][_0x34f4('0x35')]);_0x5650fb[_0x34f4('0x36')]=qs['filters'](_[_0x34f4('0x37')](_0x2dc44b['query'],_0x47e3d4[_0x34f4('0x38')]),_0xaefa1f);if(_0x2dc44b['query']['filter']){_0x5650fb[_0x34f4('0x36')]=_[_0x34f4('0x39')](_0x5650fb[_0x34f4('0x36')],{'$or':_[_0x34f4('0x3a')](_0xaefa1f,function(_0x24c291){if(_0x24c291[_0x34f4('0x2b')]!==_0x34f4('0x3b')){var _0x5f246d={};_0x5f246d[_0x24c291[_0x34f4('0x26')]]={'$like':'%'+_0x2dc44b[_0x34f4('0x2d')]['filter']+'%'};return _0x5f246d;}})});}_0x5650fb=_[_0x34f4('0x39')]({},_0x5650fb,_0x2dc44b[_0x34f4('0x3c')]);var _0x269941={'where':_0x5650fb[_0x34f4('0x36')]};return db[_0x34f4('0x3d')][_0x34f4('0x3e')](_0x269941)['then'](function(_0x4d53b4){_0x2a9f3b[_0x34f4('0x3e')]=_0x4d53b4;if(_0x2dc44b[_0x34f4('0x2d')][_0x34f4('0x3f')]){_0x5650fb['include']=[{'all':!![]}];}return db[_0x34f4('0x3d')][_0x34f4('0x40')](_0x5650fb);})['then'](function(_0xf6197){_0x2a9f3b[_0x34f4('0x41')]=_0xf6197;return _0x2a9f3b;})[_0x34f4('0x23')](respondWithFilteredResult(_0x333046,_0x5650fb))[_0x34f4('0x42')](handleError(_0x333046,null));};exports['show']=function(_0x104aef,_0x301027){var _0x12d8d2={'raw':!![],'where':{'id':_0x104aef[_0x34f4('0x43')]['id']}},_0x4c8115={};_0x4c8115[_0x34f4('0x2c')]=_[_0x34f4('0x44')](db['Cdr'][_0x34f4('0x29')]);_0x4c8115[_0x34f4('0x2d')]=_[_0x34f4('0x44')](_0x104aef['query']);_0x4c8115[_0x34f4('0x38')]=_[_0x34f4('0x2e')](_0x4c8115['model'],_0x4c8115[_0x34f4('0x2d')]);_0x12d8d2[_0x34f4('0x30')]=_[_0x34f4('0x2e')](_0x4c8115[_0x34f4('0x2c')],qs[_0x34f4('0x2f')](_0x104aef['query'][_0x34f4('0x2f')]));_0x12d8d2[_0x34f4('0x30')]=_0x12d8d2[_0x34f4('0x30')][_0x34f4('0x31')]?_0x12d8d2['attributes']:_0x4c8115[_0x34f4('0x2c')];if(_0x104aef[_0x34f4('0x2d')][_0x34f4('0x3f')]){_0x12d8d2[_0x34f4('0x45')]=[{'all':!![]}];}_0x12d8d2=_[_0x34f4('0x39')]({},_0x12d8d2,_0x104aef['options']);return db[_0x34f4('0x3d')][_0x34f4('0x46')](_0x12d8d2)[_0x34f4('0x23')](handleEntityNotFound(_0x301027,null))[_0x34f4('0x23')](respondWithResult(_0x301027,null))[_0x34f4('0x42')](handleError(_0x301027,null));};exports['create']=function(_0xc312b7,_0x10613e){return db[_0x34f4('0x3d')][_0x34f4('0x47')](_0xc312b7['body'],{})['then'](respondWithResult(_0x10613e,0xc9))[_0x34f4('0x42')](handleError(_0x10613e,null));};exports[_0x34f4('0x22')]=function(_0xe70565,_0x3d0dfd){if(_0xe70565[_0x34f4('0x48')]['id']){delete _0xe70565[_0x34f4('0x48')]['id'];}return db[_0x34f4('0x3d')][_0x34f4('0x46')]({'where':{'id':_0xe70565[_0x34f4('0x43')]['id']}})[_0x34f4('0x23')](handleEntityNotFound(_0x3d0dfd,null))[_0x34f4('0x23')](saveUpdates(_0xe70565[_0x34f4('0x48')],null))['then'](respondWithResult(_0x3d0dfd,null))[_0x34f4('0x42')](handleError(_0x3d0dfd,null));};exports[_0x34f4('0x49')]=function(_0x37d98f,_0x53612a){return db[_0x34f4('0x3d')]['find']({'where':{'id':_0x37d98f[_0x34f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x53612a,null))['then'](removeEntity(_0x53612a,null))[_0x34f4('0x42')](handleError(_0x53612a,null));};exports[_0x34f4('0x4a')]=function(_0xa5e856,_0x29000f){return db[_0x34f4('0x3d')][_0x34f4('0x4a')]()['then'](respondWithResult(_0x29000f,null))[_0x34f4('0x42')](handleError(_0x29000f,null));}; \ No newline at end of file +var _0xa6f6=['then','destroy','error','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','type','VIRTUAL','options','where','Cdr','includeAll','include','rows','catch','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','update'];(function(_0x25f199,_0x14b142){var _0x4c3a93=function(_0x22f957){while(--_0x22f957){_0x25f199['push'](_0x25f199['shift']());}};_0x4c3a93(++_0x14b142);}(_0xa6f6,0x73));var _0x6a6f=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xa6f6[_0xb24a3e];return _0x4038d7;};'use strict';var pdf=require(_0x6a6f('0x0'));var emlformat=require(_0x6a6f('0x1'));var rimraf=require(_0x6a6f('0x2'));var zipdir=require(_0x6a6f('0x3'));var jsonpatch=require(_0x6a6f('0x4'));var rp=require(_0x6a6f('0x5'));var moment=require(_0x6a6f('0x6'));var BPromise=require(_0x6a6f('0x7'));var Mustache=require(_0x6a6f('0x8'));var util=require(_0x6a6f('0x9'));var path=require(_0x6a6f('0xa'));var sox=require(_0x6a6f('0xb'));var csv=require(_0x6a6f('0xc'));var ejs=require(_0x6a6f('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a6f('0xe'));var crypto=require(_0x6a6f('0xf'));var jsforce=require(_0x6a6f('0x10'));var deskjs=require(_0x6a6f('0x11'));var toCsv=require(_0x6a6f('0xc'));var querystring=require('querystring');var Papa=require(_0x6a6f('0x12'));var Redis=require(_0x6a6f('0x13'));var authService=require(_0x6a6f('0x14'));var qs=require(_0x6a6f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a6f('0x16'));var logger=require(_0x6a6f('0x17'))(_0x6a6f('0x18'));var utils=require(_0x6a6f('0x19'));var config=require(_0x6a6f('0x1a'));var db=require(_0x6a6f('0x1b'))['db'];function respondWithStatusCode(_0x2ba17a,_0x3b9f85){_0x3b9f85=_0x3b9f85||0xcc;return function(_0x32bb79){if(_0x32bb79){return _0x2ba17a[_0x6a6f('0x1c')](_0x3b9f85);}return _0x2ba17a[_0x6a6f('0x1d')](_0x3b9f85)[_0x6a6f('0x1e')]();};}function respondWithResult(_0x841436,_0x7695f0){_0x7695f0=_0x7695f0||0xc8;return function(_0x2199e8){if(_0x2199e8){return _0x841436[_0x6a6f('0x1d')](_0x7695f0)[_0x6a6f('0x1f')](_0x2199e8);}};}function respondWithFilteredResult(_0x4fb338,_0x549f42){return function(_0x9a47aa){if(_0x9a47aa){var _0x221649=_0x9a47aa[_0x6a6f('0x20')],_0x1aa27b=_0x549f42[_0x6a6f('0x21')],_0x184570=_0x549f42[_0x6a6f('0x21')]+_0x549f42['limit'],_0xfb4f8a;if(_0x184570>=_0x221649){_0x184570=_0x221649;_0xfb4f8a=0xc8;}else{_0xfb4f8a=0xce;}_0x4fb338['status'](_0xfb4f8a);return _0x4fb338['set']('Content-Range',_0x1aa27b+'-'+_0x184570+'/'+_0x221649)[_0x6a6f('0x1f')](_0x9a47aa);}return null;};}function patchUpdates(_0x15db24){return function(_0x3c295f){try{jsonpatch[_0x6a6f('0x22')](_0x3c295f,_0x15db24,!![]);}catch(_0x2cdcc0){return BPromise[_0x6a6f('0x23')](_0x2cdcc0);}return _0x3c295f['save']();};}function saveUpdates(_0x2e7191,_0x3cc7f4){return function(_0x51f62c){if(_0x51f62c){return _0x51f62c[_0x6a6f('0x24')](_0x2e7191)[_0x6a6f('0x25')](function(_0x65915a){return _0x65915a;});}return null;};}function removeEntity(_0x20ec22,_0x21819d){return function(_0x2dac58){if(_0x2dac58){return _0x2dac58[_0x6a6f('0x26')]()[_0x6a6f('0x25')](function(){_0x20ec22[_0x6a6f('0x1d')](0xcc)[_0x6a6f('0x1e')]();});}};}function handleEntityNotFound(_0x214a25,_0x52ba6b){return function(_0x351c49){if(!_0x351c49){_0x214a25['sendStatus'](0x194);}return _0x351c49;};}function handleError(_0x52cd67,_0x16af39){_0x16af39=_0x16af39||0x1f4;return function(_0x40984d){logger[_0x6a6f('0x27')](_0x40984d['stack']);if(_0x40984d[_0x6a6f('0x28')]){delete _0x40984d['name'];}_0x52cd67[_0x6a6f('0x1d')](_0x16af39)[_0x6a6f('0x29')](_0x40984d);};}exports['index']=function(_0x86275b,_0x2855ae){var _0x4fe70d={},_0x45ff99={},_0xefed07={'count':0x0,'rows':[]};var _0x5943c1=_[_0x6a6f('0x2a')](db['Cdr'][_0x6a6f('0x2b')],function(_0x565ada){return{'name':_0x565ada[_0x6a6f('0x2c')],'type':_0x565ada['type'][_0x6a6f('0x2d')]};});_0x45ff99['model']=_[_0x6a6f('0x2a')](_0x5943c1,_0x6a6f('0x28'));_0x45ff99[_0x6a6f('0x2e')]=_[_0x6a6f('0x2f')](_0x86275b[_0x6a6f('0x2e')]);_0x45ff99[_0x6a6f('0x30')]=_[_0x6a6f('0x31')](_0x45ff99[_0x6a6f('0x32')],_0x45ff99['query']);_0x4fe70d[_0x6a6f('0x33')]=_['intersection'](_0x45ff99['model'],qs[_0x6a6f('0x34')](_0x86275b['query'][_0x6a6f('0x34')]));_0x4fe70d[_0x6a6f('0x33')]=_0x4fe70d[_0x6a6f('0x33')]['length']?_0x4fe70d[_0x6a6f('0x33')]:_0x45ff99[_0x6a6f('0x32')];if(!_0x86275b[_0x6a6f('0x2e')][_0x6a6f('0x35')](_0x6a6f('0x36'))){_0x4fe70d[_0x6a6f('0x37')]=qs[_0x6a6f('0x37')](_0x86275b[_0x6a6f('0x2e')]['limit']);_0x4fe70d[_0x6a6f('0x21')]=qs[_0x6a6f('0x21')](_0x86275b[_0x6a6f('0x2e')][_0x6a6f('0x21')]);}_0x4fe70d[_0x6a6f('0x38')]=qs[_0x6a6f('0x39')](_0x86275b[_0x6a6f('0x2e')][_0x6a6f('0x39')]);_0x4fe70d['where']=qs[_0x6a6f('0x30')](_[_0x6a6f('0x3a')](_0x86275b[_0x6a6f('0x2e')],_0x45ff99[_0x6a6f('0x30')]),_0x5943c1);if(_0x86275b[_0x6a6f('0x2e')][_0x6a6f('0x3b')]){_0x4fe70d['where']=_[_0x6a6f('0x3c')](_0x4fe70d['where'],{'$or':_[_0x6a6f('0x2a')](_0x5943c1,function(_0x1409fd){if(_0x1409fd[_0x6a6f('0x3d')]!==_0x6a6f('0x3e')){var _0xb3f967={};_0xb3f967[_0x1409fd[_0x6a6f('0x28')]]={'$like':'%'+_0x86275b['query'][_0x6a6f('0x3b')]+'%'};return _0xb3f967;}})});}_0x4fe70d=_[_0x6a6f('0x3c')]({},_0x4fe70d,_0x86275b[_0x6a6f('0x3f')]);var _0x4af1ef={'where':_0x4fe70d[_0x6a6f('0x40')]};return db[_0x6a6f('0x41')][_0x6a6f('0x20')](_0x4af1ef)[_0x6a6f('0x25')](function(_0x26f1d4){_0xefed07[_0x6a6f('0x20')]=_0x26f1d4;if(_0x86275b[_0x6a6f('0x2e')][_0x6a6f('0x42')]){_0x4fe70d[_0x6a6f('0x43')]=[{'all':!![]}];}return db[_0x6a6f('0x41')]['findAll'](_0x4fe70d);})['then'](function(_0x170dec){_0xefed07[_0x6a6f('0x44')]=_0x170dec;return _0xefed07;})[_0x6a6f('0x25')](respondWithFilteredResult(_0x2855ae,_0x4fe70d))[_0x6a6f('0x45')](handleError(_0x2855ae,null));};exports['show']=function(_0x4b0e81,_0x5b584c){var _0x4a5fb1={'raw':!![],'where':{'id':_0x4b0e81[_0x6a6f('0x46')]['id']}},_0x185d5a={};_0x185d5a['model']=_[_0x6a6f('0x2f')](db[_0x6a6f('0x41')][_0x6a6f('0x2b')]);_0x185d5a['query']=_[_0x6a6f('0x2f')](_0x4b0e81[_0x6a6f('0x2e')]);_0x185d5a[_0x6a6f('0x30')]=_[_0x6a6f('0x31')](_0x185d5a[_0x6a6f('0x32')],_0x185d5a[_0x6a6f('0x2e')]);_0x4a5fb1[_0x6a6f('0x33')]=_['intersection'](_0x185d5a[_0x6a6f('0x32')],qs[_0x6a6f('0x34')](_0x4b0e81[_0x6a6f('0x2e')]['fields']));_0x4a5fb1[_0x6a6f('0x33')]=_0x4a5fb1[_0x6a6f('0x33')][_0x6a6f('0x47')]?_0x4a5fb1[_0x6a6f('0x33')]:_0x185d5a['model'];if(_0x4b0e81[_0x6a6f('0x2e')][_0x6a6f('0x42')]){_0x4a5fb1['include']=[{'all':!![]}];}_0x4a5fb1=_['merge']({},_0x4a5fb1,_0x4b0e81[_0x6a6f('0x3f')]);return db[_0x6a6f('0x41')][_0x6a6f('0x48')](_0x4a5fb1)[_0x6a6f('0x25')](handleEntityNotFound(_0x5b584c,null))['then'](respondWithResult(_0x5b584c,null))[_0x6a6f('0x45')](handleError(_0x5b584c,null));};exports[_0x6a6f('0x49')]=function(_0x2112bf,_0x3a67bd){return db[_0x6a6f('0x41')][_0x6a6f('0x49')](_0x2112bf[_0x6a6f('0x4a')],{})[_0x6a6f('0x25')](respondWithResult(_0x3a67bd,0xc9))[_0x6a6f('0x45')](handleError(_0x3a67bd,null));};exports['update']=function(_0x13c1c7,_0x1b06a7){if(_0x13c1c7['body']['id']){delete _0x13c1c7[_0x6a6f('0x4a')]['id'];}return db[_0x6a6f('0x41')][_0x6a6f('0x48')]({'where':{'id':_0x13c1c7[_0x6a6f('0x46')]['id']}})[_0x6a6f('0x25')](handleEntityNotFound(_0x1b06a7,null))[_0x6a6f('0x25')](saveUpdates(_0x13c1c7['body'],null))['then'](respondWithResult(_0x1b06a7,null))[_0x6a6f('0x45')](handleError(_0x1b06a7,null));};exports[_0x6a6f('0x26')]=function(_0x4613a8,_0x22a3a1){return db[_0x6a6f('0x41')][_0x6a6f('0x48')]({'where':{'id':_0x4613a8[_0x6a6f('0x46')]['id']}})[_0x6a6f('0x25')](handleEntityNotFound(_0x22a3a1,null))[_0x6a6f('0x25')](removeEntity(_0x22a3a1,null))['catch'](handleError(_0x22a3a1,null));};exports['describe']=function(_0x215f19,_0x2265bd){return db[_0x6a6f('0x41')][_0x6a6f('0x4b')]()[_0x6a6f('0x25')](respondWithResult(_0x2265bd,null))[_0x6a6f('0x45')](handleError(_0x2265bd,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8ccea31..d1b5141 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 _0xae57=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','cdr','calldate','dst','uniqueid','lodash'];(function(_0x59af24,_0x201f0e){var _0x5d79d4=function(_0x4cc3a4){while(--_0x4cc3a4){_0x59af24['push'](_0x59af24['shift']());}};_0x5d79d4(++_0x201f0e);}(_0xae57,0xef));var _0x7ae5=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xae57[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x7ae5('0x0'));var util=require(_0x7ae5('0x1'));var logger=require(_0x7ae5('0x2'))(_0x7ae5('0x3'));var moment=require(_0x7ae5('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ae5('0x5'));var fs=require('fs');var path=require(_0x7ae5('0x6'));var rimraf=require(_0x7ae5('0x7'));var config=require(_0x7ae5('0x8'));var attributes=require(_0x7ae5('0x9'));module[_0x7ae5('0xa')]=function(_0x1ccf6e,_0x5c798c){return _0x1ccf6e[_0x7ae5('0xb')]('Cdr',attributes,{'tableName':_0x7ae5('0xc'),'paranoid':![],'indexes':[{'name':'accountcode','fields':['accountcode']},{'name':_0x7ae5('0xd'),'fields':[_0x7ae5('0xd')]},{'name':'disposition','fields':['disposition']},{'name':_0x7ae5('0xe'),'fields':['dst']},{'name':'src','fields':['src']},{'name':_0x7ae5('0xf'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0x9c80=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x32c3c8,_0x371a69){var _0xa61d0a=function(_0x426bf9){while(--_0x426bf9){_0x32c3c8['push'](_0x32c3c8['shift']());}};_0xa61d0a(++_0x371a69);}(_0x9c80,0x107));var _0x09c8=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x9c80[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var util=require(_0x09c8('0x0'));var logger=require('../../config/logger')(_0x09c8('0x1'));var moment=require(_0x09c8('0x2'));var BPromise=require('bluebird');var rp=require(_0x09c8('0x3'));var fs=require('fs');var path=require(_0x09c8('0x4'));var rimraf=require(_0x09c8('0x5'));var config=require(_0x09c8('0x6'));var attributes=require(_0x09c8('0x7'));module[_0x09c8('0x8')]=function(_0x491abf,_0x10ff44){return _0x491abf['define']('Cdr',attributes,{'tableName':_0x09c8('0x9'),'paranoid':![],'indexes':[{'name':_0x09c8('0xa'),'fields':[_0x09c8('0xa')]},{'name':_0x09c8('0xb'),'fields':[_0x09c8('0xb')]},{'name':'disposition','fields':[_0x09c8('0xc')]},{'name':_0x09c8('0xd'),'fields':[_0x09c8('0xd')]},{'name':_0x09c8('0xe'),'fields':[_0x09c8('0xe')]},{'name':_0x09c8('0xf'),'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 1a1e5a4..7c44c33 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 _0x4cf8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result'];(function(_0xbd3a4c,_0x2dec21){var _0x61b7e9=function(_0x5d6d88){while(--_0x5d6d88){_0xbd3a4c['push'](_0xbd3a4c['shift']());}};_0x61b7e9(++_0x2dec21);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0x4cf8[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('Cdr,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});} \ No newline at end of file +var _0x871e=['Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x436bbf,_0x4847af){var _0x15c31a=function(_0x52091b){while(--_0x52091b){_0x436bbf['push'](_0x436bbf['shift']());}};_0x15c31a(++_0x4847af);}(_0x871e,0x182));var _0xe871=function(_0xf7339b,_0x44dcaa){_0xf7339b=_0xf7339b-0x0;var _0x118c96=_0x871e[_0xf7339b];return _0x118c96;};'use strict';var _=require('lodash');var util=require(_0xe871('0x0'));var moment=require(_0xe871('0x1'));var BPromise=require(_0xe871('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe871('0x3'));var db=require(_0xe871('0x4'))['db'];var utils=require(_0xe871('0x5'));var logger=require(_0xe871('0x6'))(_0xe871('0x7'));var config=require(_0xe871('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe871('0x9')][_0xe871('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x362972,_0x3f1ba4,_0x1491e8){return new BPromise(function(_0x1e947c,_0xe40bfd){return client[_0xe871('0xb')](_0x362972,_0x1491e8)[_0xe871('0xc')](function(_0x5e7f9a){logger[_0xe871('0xd')](_0xe871('0xe'),_0x3f1ba4,_0xe871('0xf'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x3f1ba4,_0xe871('0xf'),JSON[_0xe871('0x10')](_0x5e7f9a));if(_0x5e7f9a[_0xe871('0x11')]){if(_0x5e7f9a[_0xe871('0x11')]['code']===0x1f4){logger['error'](_0xe871('0xe'),_0x3f1ba4,_0x5e7f9a[_0xe871('0x11')][_0xe871('0x12')]);return _0xe40bfd(_0x5e7f9a['error'][_0xe871('0x12')]);}logger[_0xe871('0x11')](_0xe871('0xe'),_0x3f1ba4,_0x5e7f9a[_0xe871('0x11')][_0xe871('0x12')]);return _0x1e947c(_0x5e7f9a[_0xe871('0x11')]['message']);}else{logger[_0xe871('0xd')](_0xe871('0xe'),_0x3f1ba4,_0xe871('0xf'));_0x1e947c(_0x5e7f9a[_0xe871('0x13')]['message']);}})['catch'](function(_0x118b4a){logger[_0xe871('0x11')](_0xe871('0xe'),_0x3f1ba4,_0x118b4a);_0xe40bfd(_0x118b4a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9ebae14..408f833 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 _0x3372=['../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1e9c72,_0xf91187){var _0x330346=function(_0x4fd6e1){while(--_0x4fd6e1){_0x1e9c72['push'](_0x1e9c72['shift']());}};_0x330346(++_0xf91187);}(_0x3372,0xc2));var _0x2337=function(_0x4a2dea,_0x1a5b9f){_0x4a2dea=_0x4a2dea-0x0;var _0x30c4f8=_0x3372[_0x4a2dea];return _0x30c4f8;};'use strict';var multer=require(_0x2337('0x0'));var util=require(_0x2337('0x1'));var path=require(_0x2337('0x2'));var timeout=require(_0x2337('0x3'));var express=require(_0x2337('0x4'));var router=express[_0x2337('0x5')]();var auth=require(_0x2337('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cdr.controller');router[_0x2337('0x7')]('/',auth[_0x2337('0x8')](),controller[_0x2337('0x9')]);router['get'](_0x2337('0xa'),auth['isAuthenticated'](),controller[_0x2337('0xb')]);router['get'](_0x2337('0xc'),auth['isAuthenticated'](),controller[_0x2337('0xd')]);router[_0x2337('0xe')]('/',auth[_0x2337('0x8')](),controller[_0x2337('0xf')]);router[_0x2337('0x10')](_0x2337('0xc'),auth[_0x2337('0x8')](),controller[_0x2337('0x11')]);router[_0x2337('0x12')]('/:id',auth[_0x2337('0x8')](),controller[_0x2337('0x13')]);module['exports']=router; \ No newline at end of file +var _0x73db=['isAuthenticated','index','/describe','describe','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cdr.controller','get'];(function(_0x3dbbe3,_0x3192bc){var _0x8d02fd=function(_0x52681c){while(--_0x52681c){_0x3dbbe3['push'](_0x3dbbe3['shift']());}};_0x8d02fd(++_0x3192bc);}(_0x73db,0x11c));var _0xb73d=function(_0x46f937,_0x2184c1){_0x46f937=_0x46f937-0x0;var _0x407d9b=_0x73db[_0x46f937];return _0x407d9b;};'use strict';var multer=require(_0xb73d('0x0'));var util=require(_0xb73d('0x1'));var path=require(_0xb73d('0x2'));var timeout=require(_0xb73d('0x3'));var express=require(_0xb73d('0x4'));var router=express[_0xb73d('0x5')]();var auth=require(_0xb73d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb73d('0x7'));var controller=require(_0xb73d('0x8'));router[_0xb73d('0x9')]('/',auth[_0xb73d('0xa')](),controller[_0xb73d('0xb')]);router['get'](_0xb73d('0xc'),auth[_0xb73d('0xa')](),controller[_0xb73d('0xd')]);router[_0xb73d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb73d('0xe')]);router[_0xb73d('0xf')]('/',auth[_0xb73d('0xa')](),controller[_0xb73d('0x10')]);router[_0xb73d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb73d('0x12')]);router['delete']('/:id',auth[_0xb73d('0xa')](),controller[_0xb73d('0x13')]);module[_0xb73d('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index d14fcfb..321a09c 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 _0x5971=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x16300f,_0x78a8ba){var _0x5e1920=function(_0x14f1e0){while(--_0x14f1e0){_0x16300f['push'](_0x16300f['shift']());}};_0x5e1920(++_0x78a8ba);}(_0x5971,0x150));var _0x1597=function(_0x35688a,_0x16b85a){_0x35688a=_0x35688a-0x0;var _0x2d5457=_0x5971[_0x35688a];return _0x2d5457;};'use strict';var Sequelize=require(_0x1597('0x0'));module[_0x1597('0x1')]={'priority':{'type':Sequelize[_0x1597('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1597('0x3')],'allowNull':![],'defaultValue':_0x1597('0x4')},'appdata':{'type':Sequelize[_0x1597('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1597('0x6')}}; \ No newline at end of file +var _0x4cfb=['exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x1b84d4,_0x25e453){var _0x5120f7=function(_0x24c6a5){while(--_0x24c6a5){_0x1b84d4['push'](_0x1b84d4['shift']());}};_0x5120f7(++_0x25e453);}(_0x4cfb,0xcd));var _0xb4cf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4cfb[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0xb4cf('0x0')]={'priority':{'type':Sequelize[_0xb4cf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb4cf('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb4cf('0x3')]()},'description':{'type':Sequelize[_0xb4cf('0x2')]},'interval':{'type':Sequelize[_0xb4cf('0x2')],'defaultValue':_0xb4cf('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 88b63b1..dc0c7e8 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 _0x3f0d=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','show','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','model','includeAll','include','merge','options','find','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3f0d,0x1e2));var _0xd3f0=function(_0x2c2a68,_0x4f1225){_0x2c2a68=_0x2c2a68-0x0;var _0x5bd223=_0x3f0d[_0x2c2a68];return _0x5bd223;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3f0('0x0'));var rimraf=require(_0xd3f0('0x1'));var zipdir=require(_0xd3f0('0x2'));var jsonpatch=require(_0xd3f0('0x3'));var rp=require(_0xd3f0('0x4'));var moment=require(_0xd3f0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd3f0('0x6'));var util=require(_0xd3f0('0x7'));var path=require(_0xd3f0('0x8'));var sox=require(_0xd3f0('0x9'));var csv=require(_0xd3f0('0xa'));var ejs=require(_0xd3f0('0xb'));var fs=require('fs');var _=require(_0xd3f0('0xc'));var squel=require(_0xd3f0('0xd'));var crypto=require(_0xd3f0('0xe'));var jsforce=require(_0xd3f0('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd3f0('0x10'));var Papa=require('papaparse');var Redis=require(_0xd3f0('0x11'));var authService=require(_0xd3f0('0x12'));var qs=require(_0xd3f0('0x13'));var as=require(_0xd3f0('0x14'));var hardwareService=require(_0xd3f0('0x15'));var logger=require('../../config/logger')(_0xd3f0('0x16'));var utils=require('../../config/utils');var config=require(_0xd3f0('0x17'));var db=require(_0xd3f0('0x18'))['db'];function respondWithStatusCode(_0x40b0ca,_0x5c4a22){_0x5c4a22=_0x5c4a22||0xcc;return function(_0x5422d7){if(_0x5422d7){return _0x40b0ca[_0xd3f0('0x19')](_0x5c4a22);}return _0x40b0ca[_0xd3f0('0x1a')](_0x5c4a22)['end']();};}function respondWithResult(_0x2174c1,_0x1300bc){_0x1300bc=_0x1300bc||0xc8;return function(_0xb001e2){if(_0xb001e2){return _0x2174c1[_0xd3f0('0x1a')](_0x1300bc)[_0xd3f0('0x1b')](_0xb001e2);}};}function respondWithFilteredResult(_0x31c1c8,_0x3d4f17){return function(_0x1f5a3d){if(_0x1f5a3d){var _0x12f62f=_0x1f5a3d[_0xd3f0('0x1c')],_0x4e03d1=_0x3d4f17[_0xd3f0('0x1d')],_0x55dc2f=_0x3d4f17[_0xd3f0('0x1d')]+_0x3d4f17[_0xd3f0('0x1e')],_0x110759;if(_0x55dc2f>=_0x12f62f){_0x55dc2f=_0x12f62f;_0x110759=0xc8;}else{_0x110759=0xce;}_0x31c1c8[_0xd3f0('0x1a')](_0x110759);return _0x31c1c8[_0xd3f0('0x1f')](_0xd3f0('0x20'),_0x4e03d1+'-'+_0x55dc2f+'/'+_0x12f62f)[_0xd3f0('0x1b')](_0x1f5a3d);}return null;};}function patchUpdates(_0x554e55){return function(_0xfc045){try{jsonpatch['apply'](_0xfc045,_0x554e55,!![]);}catch(_0x4dd3c0){return BPromise[_0xd3f0('0x21')](_0x4dd3c0);}return _0xfc045[_0xd3f0('0x22')]();};}function saveUpdates(_0x26cd5f,_0x238655){return function(_0x17b91b){if(_0x17b91b){return _0x17b91b[_0xd3f0('0x23')](_0x26cd5f)[_0xd3f0('0x24')](function(_0x2c7467){return _0x2c7467;});}return null;};}function removeEntity(_0x2b2fba,_0x26f065){return function(_0x30c6f5){if(_0x30c6f5){return _0x30c6f5[_0xd3f0('0x25')]()[_0xd3f0('0x24')](function(){_0x2b2fba[_0xd3f0('0x1a')](0xcc)[_0xd3f0('0x26')]();});}};}function handleEntityNotFound(_0xb2ac7f,_0x64e5f2){return function(_0x526629){if(!_0x526629){_0xb2ac7f[_0xd3f0('0x19')](0x194);}return _0x526629;};}function handleError(_0x424821,_0x39d88a){_0x39d88a=_0x39d88a||0x1f4;return function(_0x22c7c2){logger[_0xd3f0('0x27')](_0x22c7c2['stack']);if(_0x22c7c2[_0xd3f0('0x28')]){delete _0x22c7c2['name'];}_0x424821[_0xd3f0('0x1a')](_0x39d88a)[_0xd3f0('0x29')](_0x22c7c2);};}exports[_0xd3f0('0x2a')]=function(_0x4fea98,_0x3c5ed5){var _0x9e6357={'raw':!![],'where':{'id':_0x4fea98['params']['id']}},_0x8206ea={};_0x8206ea['model']=_[_0xd3f0('0x2b')](db[_0xd3f0('0x2c')][_0xd3f0('0x2d')]);_0x8206ea[_0xd3f0('0x2e')]=_[_0xd3f0('0x2b')](_0x4fea98[_0xd3f0('0x2e')]);_0x8206ea[_0xd3f0('0x2f')]=_[_0xd3f0('0x30')](_0x8206ea['model'],_0x8206ea[_0xd3f0('0x2e')]);_0x9e6357['attributes']=_[_0xd3f0('0x30')](_0x8206ea['model'],qs[_0xd3f0('0x31')](_0x4fea98[_0xd3f0('0x2e')][_0xd3f0('0x31')]));_0x9e6357[_0xd3f0('0x32')]=_0x9e6357[_0xd3f0('0x32')][_0xd3f0('0x33')]?_0x9e6357['attributes']:_0x8206ea[_0xd3f0('0x34')];if(_0x4fea98[_0xd3f0('0x2e')][_0xd3f0('0x35')]){_0x9e6357[_0xd3f0('0x36')]=[{'all':!![]}];}_0x9e6357=_[_0xd3f0('0x37')]({},_0x9e6357,_0x4fea98[_0xd3f0('0x38')]);return db[_0xd3f0('0x2c')][_0xd3f0('0x39')](_0x9e6357)[_0xd3f0('0x24')](handleEntityNotFound(_0x3c5ed5,null))['then'](respondWithResult(_0x3c5ed5,null))[_0xd3f0('0x3a')](handleError(_0x3c5ed5,null));};exports[_0xd3f0('0x23')]=function(_0x124fe8,_0xab3c74){if(_0x124fe8[_0xd3f0('0x3b')]['id']){delete _0x124fe8[_0xd3f0('0x3b')]['id'];}return db[_0xd3f0('0x2c')][_0xd3f0('0x39')]({'where':{'id':_0x124fe8[_0xd3f0('0x3c')]['id']}})[_0xd3f0('0x24')](handleEntityNotFound(_0xab3c74,null))['then'](saveUpdates(_0x124fe8[_0xd3f0('0x3b')],null))[_0xd3f0('0x24')](respondWithResult(_0xab3c74,null))[_0xd3f0('0x3a')](handleError(_0xab3c74,null));};exports['destroy']=function(_0x792c59,_0x16e830){return db['ChatApplication']['find']({'where':{'id':_0x792c59['params']['id']}})[_0xd3f0('0x24')](handleEntityNotFound(_0x16e830,null))[_0xd3f0('0x24')](removeEntity(_0x16e830,null))[_0xd3f0('0x3a')](handleError(_0x16e830,null));}; \ No newline at end of file +var _0xd1eb=['set','Content-Range','reject','save','destroy','then','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','include','merge','options','find','catch','update','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x194f65,_0x1a1d57){var _0x50144b=function(_0x326c9a){while(--_0x326c9a){_0x194f65['push'](_0x194f65['shift']());}};_0x50144b(++_0x1a1d57);}(_0xd1eb,0x110));var _0xbd1e=function(_0x2be3b8,_0x2a620f){_0x2be3b8=_0x2be3b8-0x0;var _0x2134ff=_0xd1eb[_0x2be3b8];return _0x2134ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd1e('0x0'));var rimraf=require(_0xbd1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd1e('0x2'));var rp=require(_0xbd1e('0x3'));var moment=require(_0xbd1e('0x4'));var BPromise=require(_0xbd1e('0x5'));var Mustache=require(_0xbd1e('0x6'));var util=require(_0xbd1e('0x7'));var path=require(_0xbd1e('0x8'));var sox=require(_0xbd1e('0x9'));var csv=require(_0xbd1e('0xa'));var ejs=require(_0xbd1e('0xb'));var fs=require('fs');var _=require(_0xbd1e('0xc'));var squel=require(_0xbd1e('0xd'));var crypto=require('crypto');var jsforce=require(_0xbd1e('0xe'));var deskjs=require(_0xbd1e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd1e('0x10'));var Redis=require(_0xbd1e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbd1e('0x12'));var as=require(_0xbd1e('0x13'));var hardwareService=require(_0xbd1e('0x14'));var logger=require(_0xbd1e('0x15'))(_0xbd1e('0x16'));var utils=require(_0xbd1e('0x17'));var config=require(_0xbd1e('0x18'));var db=require(_0xbd1e('0x19'))['db'];function respondWithStatusCode(_0x170ff9,_0x589c82){_0x589c82=_0x589c82||0xcc;return function(_0x4897e6){if(_0x4897e6){return _0x170ff9[_0xbd1e('0x1a')](_0x589c82);}return _0x170ff9[_0xbd1e('0x1b')](_0x589c82)[_0xbd1e('0x1c')]();};}function respondWithResult(_0x4328a3,_0x41e57e){_0x41e57e=_0x41e57e||0xc8;return function(_0x2e4189){if(_0x2e4189){return _0x4328a3['status'](_0x41e57e)[_0xbd1e('0x1d')](_0x2e4189);}};}function respondWithFilteredResult(_0x5e982b,_0x3549bb){return function(_0x4e545a){if(_0x4e545a){var _0x18077f=_0x4e545a[_0xbd1e('0x1e')],_0x97b211=_0x3549bb['offset'],_0x32782b=_0x3549bb[_0xbd1e('0x1f')]+_0x3549bb[_0xbd1e('0x20')],_0x225dc5;if(_0x32782b>=_0x18077f){_0x32782b=_0x18077f;_0x225dc5=0xc8;}else{_0x225dc5=0xce;}_0x5e982b[_0xbd1e('0x1b')](_0x225dc5);return _0x5e982b[_0xbd1e('0x21')](_0xbd1e('0x22'),_0x97b211+'-'+_0x32782b+'/'+_0x18077f)[_0xbd1e('0x1d')](_0x4e545a);}return null;};}function patchUpdates(_0x34af9b){return function(_0xbf241a){try{jsonpatch['apply'](_0xbf241a,_0x34af9b,!![]);}catch(_0x8f5d0a){return BPromise[_0xbd1e('0x23')](_0x8f5d0a);}return _0xbf241a[_0xbd1e('0x24')]();};}function saveUpdates(_0x1f453a,_0x2f2338){return function(_0x215c5c){if(_0x215c5c){return _0x215c5c['update'](_0x1f453a)['then'](function(_0x1f06f0){return _0x1f06f0;});}return null;};}function removeEntity(_0x50e1fd,_0x2eb428){return function(_0x5a3080){if(_0x5a3080){return _0x5a3080[_0xbd1e('0x25')]()[_0xbd1e('0x26')](function(){_0x50e1fd[_0xbd1e('0x1b')](0xcc)[_0xbd1e('0x1c')]();});}};}function handleEntityNotFound(_0x5cb9e4,_0x94b2cc){return function(_0x4dafb2){if(!_0x4dafb2){_0x5cb9e4['sendStatus'](0x194);}return _0x4dafb2;};}function handleError(_0x4cff13,_0x589df0){_0x589df0=_0x589df0||0x1f4;return function(_0x54446a){logger['error'](_0x54446a[_0xbd1e('0x27')]);if(_0x54446a[_0xbd1e('0x28')]){delete _0x54446a[_0xbd1e('0x28')];}_0x4cff13[_0xbd1e('0x1b')](_0x589df0)[_0xbd1e('0x29')](_0x54446a);};}exports[_0xbd1e('0x2a')]=function(_0x5dffb2,_0x5214ff){var _0xb088b9={'raw':!![],'where':{'id':_0x5dffb2['params']['id']}},_0x10333a={};_0x10333a[_0xbd1e('0x2b')]=_[_0xbd1e('0x2c')](db[_0xbd1e('0x2d')][_0xbd1e('0x2e')]);_0x10333a['query']=_[_0xbd1e('0x2c')](_0x5dffb2[_0xbd1e('0x2f')]);_0x10333a[_0xbd1e('0x30')]=_['intersection'](_0x10333a[_0xbd1e('0x2b')],_0x10333a[_0xbd1e('0x2f')]);_0xb088b9[_0xbd1e('0x31')]=_[_0xbd1e('0x32')](_0x10333a[_0xbd1e('0x2b')],qs[_0xbd1e('0x33')](_0x5dffb2[_0xbd1e('0x2f')][_0xbd1e('0x33')]));_0xb088b9['attributes']=_0xb088b9[_0xbd1e('0x31')][_0xbd1e('0x34')]?_0xb088b9[_0xbd1e('0x31')]:_0x10333a[_0xbd1e('0x2b')];if(_0x5dffb2[_0xbd1e('0x2f')]['includeAll']){_0xb088b9[_0xbd1e('0x35')]=[{'all':!![]}];}_0xb088b9=_[_0xbd1e('0x36')]({},_0xb088b9,_0x5dffb2[_0xbd1e('0x37')]);return db[_0xbd1e('0x2d')][_0xbd1e('0x38')](_0xb088b9)[_0xbd1e('0x26')](handleEntityNotFound(_0x5214ff,null))['then'](respondWithResult(_0x5214ff,null))[_0xbd1e('0x39')](handleError(_0x5214ff,null));};exports[_0xbd1e('0x3a')]=function(_0xec8974,_0x271145){if(_0xec8974[_0xbd1e('0x3b')]['id']){delete _0xec8974[_0xbd1e('0x3b')]['id'];}return db[_0xbd1e('0x2d')][_0xbd1e('0x38')]({'where':{'id':_0xec8974[_0xbd1e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x271145,null))[_0xbd1e('0x26')](saveUpdates(_0xec8974[_0xbd1e('0x3b')],null))['then'](respondWithResult(_0x271145,null))['catch'](handleError(_0x271145,null));};exports['destroy']=function(_0x16e649,_0x4b7032){return db['ChatApplication']['find']({'where':{'id':_0x16e649['params']['id']}})[_0xbd1e('0x26')](handleEntityNotFound(_0x4b7032,null))[_0xbd1e('0x26')](removeEntity(_0x4b7032,null))[_0xbd1e('0x39')](handleError(_0x4b7032,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 14e85c6..2f24e9c 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 _0x1e77=['rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x4a59ce,_0x3535fa){var _0x53fffb=function(_0x4f7cfd){while(--_0x4f7cfd){_0x4a59ce['push'](_0x4a59ce['shift']());}};_0x53fffb(++_0x3535fa);}(_0x1e77,0x126));var _0x71e7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1e77[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x71e7('0x0'));var util=require(_0x71e7('0x1'));var logger=require(_0x71e7('0x2'))(_0x71e7('0x3'));var moment=require('moment');var BPromise=require(_0x71e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x71e7('0x5'));var config=require(_0x71e7('0x6'));var attributes=require(_0x71e7('0x7'));module[_0x71e7('0x8')]=function(_0x35b0b3,_0x54c372){return _0x35b0b3['define'](_0x71e7('0x9'),attributes,{'tableName':_0x71e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x71e7('0xb'),'collate':_0x71e7('0xc')});}; \ No newline at end of file +var _0x093e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x093e,0x1bf));var _0xe093=function(_0xc72d26,_0x40dd69){_0xc72d26=_0xc72d26-0x0;var _0x4cc1d0=_0x093e[_0xc72d26];return _0x4cc1d0;};'use strict';var _=require(_0xe093('0x0'));var util=require(_0xe093('0x1'));var logger=require(_0xe093('0x2'))('api');var moment=require(_0xe093('0x3'));var BPromise=require(_0xe093('0x4'));var rp=require(_0xe093('0x5'));var fs=require('fs');var path=require(_0xe093('0x6'));var rimraf=require(_0xe093('0x7'));var config=require('../../config/environment');var attributes=require(_0xe093('0x8'));module[_0xe093('0x9')]=function(_0x5a7cd4,_0x43d9f1){return _0x5a7cd4[_0xe093('0xa')](_0xe093('0xb'),attributes,{'tableName':_0xe093('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe093('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index ee602ba..1b87666 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 _0xc0b8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0b8,0x153));var _0x8c0b=function(_0x5448e4,_0x43293d){_0x5448e4=_0x5448e4-0x0;var _0x5030d4=_0xc0b8[_0x5448e4];return _0x5030d4;};'use strict';var _=require(_0x8c0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8c0b('0x1'));var rs=require(_0x8c0b('0x2'));var fs=require('fs');var Redis=require(_0x8c0b('0x3'));var db=require(_0x8c0b('0x4'))['db'];var utils=require(_0x8c0b('0x5'));var logger=require(_0x8c0b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8c0b('0x7'));var client=jayson[_0x8c0b('0x8')][_0x8c0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15dc1f,_0x318781,_0x385c97){return new BPromise(function(_0x3623d2,_0x384f8d){return client['request'](_0x15dc1f,_0x385c97)['then'](function(_0x278fb4){logger[_0x8c0b('0xa')](_0x8c0b('0xb'),_0x318781,_0x8c0b('0xc'));logger[_0x8c0b('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x318781,_0x8c0b('0xc'),JSON[_0x8c0b('0xe')](_0x278fb4));if(_0x278fb4['error']){if(_0x278fb4['error'][_0x8c0b('0xf')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x318781,_0x278fb4[_0x8c0b('0x10')]['message']);return _0x384f8d(_0x278fb4[_0x8c0b('0x10')][_0x8c0b('0x11')]);}logger[_0x8c0b('0x10')](_0x8c0b('0xb'),_0x318781,_0x278fb4[_0x8c0b('0x10')][_0x8c0b('0x11')]);return _0x3623d2(_0x278fb4[_0x8c0b('0x10')][_0x8c0b('0x11')]);}else{logger[_0x8c0b('0xa')](_0x8c0b('0xb'),_0x318781,_0x8c0b('0xc'));_0x3623d2(_0x278fb4['result'][_0x8c0b('0x11')]);}})[_0x8c0b('0x12')](function(_0x1ad686){logger[_0x8c0b('0x10')](_0x8c0b('0xb'),_0x318781,_0x1ad686);_0x384f8d(_0x1ad686);});});} \ No newline at end of file +var _0x29e2=['request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4d9e46,_0x4a9455){var _0xcd91fc=function(_0x59a448){while(--_0x59a448){_0x4d9e46['push'](_0x4d9e46['shift']());}};_0xcd91fc(++_0x4a9455);}(_0x29e2,0xf4));var _0x229e=function(_0x29a7e0,_0x35095f){_0x29a7e0=_0x29a7e0-0x0;var _0x4b9980=_0x29e2[_0x29a7e0];return _0x4b9980;};'use strict';var _=require('lodash');var util=require(_0x229e('0x0'));var moment=require('moment');var BPromise=require(_0x229e('0x1'));var rs=require(_0x229e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x229e('0x3'))(_0x229e('0x4'));var config=require(_0x229e('0x5'));var jayson=require(_0x229e('0x6'));var client=jayson[_0x229e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdb9e86,_0x5a43d8,_0x5b735f){return new BPromise(function(_0x423e03,_0x463840){return client[_0x229e('0x8')](_0xdb9e86,_0x5b735f)[_0x229e('0x9')](function(_0x189e37){logger[_0x229e('0xa')](_0x229e('0xb'),_0x5a43d8,_0x229e('0xc'));logger['debug'](_0x229e('0xd'),_0x5a43d8,'request\x20sent',JSON['stringify'](_0x189e37));if(_0x189e37[_0x229e('0xe')]){if(_0x189e37[_0x229e('0xe')][_0x229e('0xf')]===0x1f4){logger[_0x229e('0xe')]('ChatApplication,\x20%s,\x20%s',_0x5a43d8,_0x189e37[_0x229e('0xe')][_0x229e('0x10')]);return _0x463840(_0x189e37[_0x229e('0xe')]['message']);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x5a43d8,_0x189e37['error'][_0x229e('0x10')]);return _0x423e03(_0x189e37[_0x229e('0xe')]['message']);}else{logger[_0x229e('0xa')]('ChatApplication,\x20%s,\x20%s',_0x5a43d8,'request\x20sent');_0x423e03(_0x189e37[_0x229e('0x11')][_0x229e('0x10')]);}})['catch'](function(_0x1312e7){logger[_0x229e('0xe')](_0x229e('0xb'),_0x5a43d8,_0x1312e7);_0x463840(_0x1312e7);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5ee051e..2dea209 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 _0xf728=['delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x4879bf,_0x36f75e){var _0x17ca5d=function(_0x50c7df){while(--_0x50c7df){_0x4879bf['push'](_0x4879bf['shift']());}};_0x17ca5d(++_0x36f75e);}(_0xf728,0x102));var _0x8f72=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xf728[_0x411add];return _0x238242;};'use strict';var multer=require(_0x8f72('0x0'));var util=require(_0x8f72('0x1'));var path=require('path');var timeout=require(_0x8f72('0x2'));var express=require(_0x8f72('0x3'));var router=express[_0x8f72('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f72('0x5'));var config=require(_0x8f72('0x6'));var controller=require(_0x8f72('0x7'));router[_0x8f72('0x8')](_0x8f72('0x9'),auth[_0x8f72('0xa')](),controller[_0x8f72('0xb')]);router[_0x8f72('0xc')](_0x8f72('0x9'),auth[_0x8f72('0xa')](),controller[_0x8f72('0xd')]);router[_0x8f72('0xe')](_0x8f72('0x9'),auth[_0x8f72('0xa')](),controller['destroy']);module[_0x8f72('0xf')]=router; \ No newline at end of file +var _0x2a33=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','put','isAuthenticated','update','delete','destroy','multer','path'];(function(_0x449bdf,_0x24caba){var _0x429647=function(_0x1450c7){while(--_0x1450c7){_0x449bdf['push'](_0x449bdf['shift']());}};_0x429647(++_0x24caba);}(_0x2a33,0x132));var _0x32a3=function(_0x4d0312,_0xb5433e){_0x4d0312=_0x4d0312-0x0;var _0x311591=_0x2a33[_0x4d0312];return _0x311591;};'use strict';var multer=require(_0x32a3('0x0'));var util=require('util');var path=require(_0x32a3('0x1'));var timeout=require(_0x32a3('0x2'));var express=require('express');var router=express[_0x32a3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x32a3('0x4'));var config=require(_0x32a3('0x5'));var controller=require(_0x32a3('0x6'));router[_0x32a3('0x7')](_0x32a3('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x32a3('0x9')](_0x32a3('0x8'),auth[_0x32a3('0xa')](),controller[_0x32a3('0xb')]);router[_0x32a3('0xc')](_0x32a3('0x8'),auth[_0x32a3('0xa')](),controller[_0x32a3('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index c8605ac..81ea381 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 _0xf11d=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xf11d,0x1df));var _0xdf11=function(_0x3cd77a,_0x3a71b4){_0x3cd77a=_0x3cd77a-0x0;var _0x39c977=_0xf11d[_0x3cd77a];return _0x39c977;};'use strict';var Sequelize=require(_0xdf11('0x0'));module[_0xdf11('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdf11('0x2')]},'write':{'type':Sequelize[_0xdf11('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x804f=['sequelize','STRING','BOOLEAN'];(function(_0x12e17f,_0xa7df1c){var _0x476cb6=function(_0x5d8d37){while(--_0x5d8d37){_0x12e17f['push'](_0x12e17f['shift']());}};_0x476cb6(++_0xa7df1c);}(_0x804f,0xd2));var _0xf804=function(_0x2ae705,_0x5aa965){_0x2ae705=_0x2ae705-0x0;var _0x3dd8d4=_0x804f[_0x2ae705];return _0x3dd8d4;};'use strict';var Sequelize=require(_0xf804('0x0'));module['exports']={'name':{'type':Sequelize[_0xf804('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf804('0x1')]},'write':{'type':Sequelize[_0xf804('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 2bb8bc7..68b7f3a 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 _0x776f=['request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','set','Content-Range','apply','update','destroy','name','index','map','ChatGroup','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','catch','show','params','keys','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','rawAttributes','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x3340d9,_0x8f9903){var _0x3ed879=function(_0x14c068){while(--_0x14c068){_0x3340d9['push'](_0x3340d9['shift']());}};_0x3ed879(++_0x8f9903);}(_0x776f,0x188));var _0xf776=function(_0x3adafa,_0x1ff5ea){_0x3adafa=_0x3adafa-0x0;var _0x229947=_0x776f[_0x3adafa];return _0x229947;};'use strict';var pdf=require(_0xf776('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf776('0x1'));var zipdir=require(_0xf776('0x2'));var jsonpatch=require(_0xf776('0x3'));var rp=require(_0xf776('0x4'));var moment=require('moment');var BPromise=require(_0xf776('0x5'));var Mustache=require(_0xf776('0x6'));var util=require('util');var path=require(_0xf776('0x7'));var sox=require(_0xf776('0x8'));var csv=require(_0xf776('0x9'));var ejs=require(_0xf776('0xa'));var fs=require('fs');var _=require(_0xf776('0xb'));var squel=require(_0xf776('0xc'));var crypto=require(_0xf776('0xd'));var jsforce=require(_0xf776('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf776('0x9'));var querystring=require(_0xf776('0xf'));var Papa=require('papaparse');var Redis=require(_0xf776('0x10'));var authService=require(_0xf776('0x11'));var qs=require(_0xf776('0x12'));var as=require(_0xf776('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf776('0x14'));var config=require(_0xf776('0x15'));var db=require(_0xf776('0x16'))['db'];config[_0xf776('0x17')]=_['defaults'](config['redis'],{'host':_0xf776('0x18'),'port':0x18eb});var socket=require(_0xf776('0x19'))(new Redis(config[_0xf776('0x17')]));require(_0xf776('0x1a'))[_0xf776('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf776('0x1c')][_0xf776('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3f6af0,_0xc48e43,_0x15484a){if(_0x15484a){var _0x698fa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x698fa6['test'](_0xc48e43)){return _0x3f6af0;}else{throw new db[(_0xf776('0x1e'))][(_0xf776('0x1f'))](_0xf776('0x20'));}}else{return _0x3f6af0;}}function respondWithRpcPromise(_0x2e267f,_0x4dfdc0,_0x35261c,_0x4388f7){return new BPromise(function(_0x1e19d5,_0x18165b){var _0x440511=_0x4388f7||client;return _0x440511['request'](_0x2e267f,_0x35261c)[_0xf776('0x21')](function(_0x14af34){logger[_0xf776('0x22')](_0xf776('0x23'),_0x4dfdc0,_0xf776('0x24'));logger['debug'](_0xf776('0x25'),_0x4dfdc0,_0xf776('0x24'),JSON[_0xf776('0x26')](_0x14af34));if(_0x14af34[_0xf776('0x27')]){if(_0x14af34[_0xf776('0x27')][_0xf776('0x28')]===0x1f4){logger['error'](_0xf776('0x23'),_0x4dfdc0,_0x14af34[_0xf776('0x27')]['message']);return _0x18165b(_0x14af34[_0xf776('0x27')][_0xf776('0x29')]);}logger[_0xf776('0x27')]('ChatGroup,\x20%s,\x20%s',_0x4dfdc0,_0x14af34['error']['message']);return _0x1e19d5(_0x14af34['error'][_0xf776('0x29')]);}else{logger[_0xf776('0x22')](_0xf776('0x23'),_0x4dfdc0,'request\x20sent');_0x1e19d5(_0x14af34[_0xf776('0x2a')]['message']);}})['catch'](function(_0x1099ca){logger[_0xf776('0x27')]('ChatGroup,\x20%s,\x20%s',_0x4dfdc0,_0x1099ca);_0x18165b(_0x1099ca);});});}function respondWithStatusCode(_0x3c620b,_0xd00a9f){_0xd00a9f=_0xd00a9f||0xcc;return function(_0x3fc979){if(_0x3fc979){return _0x3c620b[_0xf776('0x2b')](_0xd00a9f);}return _0x3c620b[_0xf776('0x2c')](_0xd00a9f)[_0xf776('0x2d')]();};}function respondWithResult(_0x291e9f,_0x241b24){_0x241b24=_0x241b24||0xc8;return function(_0x21f2b6){if(_0x21f2b6){return _0x291e9f[_0xf776('0x2c')](_0x241b24)[_0xf776('0x2e')](_0x21f2b6);}};}function respondWithFilteredResult(_0x10ebf7,_0x4d2baa){return function(_0x13d429){if(_0x13d429){var _0x4878af=_0x13d429['count'],_0x239800=_0x4d2baa[_0xf776('0x2f')],_0x1d16a1=_0x4d2baa[_0xf776('0x2f')]+_0x4d2baa['limit'],_0x43ff9f;if(_0x1d16a1>=_0x4878af){_0x1d16a1=_0x4878af;_0x43ff9f=0xc8;}else{_0x43ff9f=0xce;}_0x10ebf7[_0xf776('0x2c')](_0x43ff9f);return _0x10ebf7[_0xf776('0x30')](_0xf776('0x31'),_0x239800+'-'+_0x1d16a1+'/'+_0x4878af)[_0xf776('0x2e')](_0x13d429);}return null;};}function patchUpdates(_0x3247cc){return function(_0x175c55){try{jsonpatch[_0xf776('0x32')](_0x175c55,_0x3247cc,!![]);}catch(_0x1745c6){return BPromise['reject'](_0x1745c6);}return _0x175c55['save']();};}function saveUpdates(_0x3d301f,_0x553d47){return function(_0x4d7b3c){if(_0x4d7b3c){return _0x4d7b3c[_0xf776('0x33')](_0x3d301f)['then'](function(_0x4858cd){return _0x4858cd;});}return null;};}function removeEntity(_0xf34f8b,_0xe5cf83){return function(_0x4f3a78){if(_0x4f3a78){return _0x4f3a78[_0xf776('0x34')]()['then'](function(){_0xf34f8b['status'](0xcc)[_0xf776('0x2d')]();});}};}function handleEntityNotFound(_0x19bd8d,_0x589e20){return function(_0x4c8623){if(!_0x4c8623){_0x19bd8d['sendStatus'](0x194);}return _0x4c8623;};}function handleError(_0x27e9a7,_0x5cc079){_0x5cc079=_0x5cc079||0x1f4;return function(_0x1ec27a){logger[_0xf776('0x27')](_0x1ec27a['stack']);if(_0x1ec27a['name']){delete _0x1ec27a[_0xf776('0x35')];}_0x27e9a7['status'](_0x5cc079)['send'](_0x1ec27a);};}exports[_0xf776('0x36')]=function(_0x472b9a,_0x3296c5){var _0x4d0b11={},_0x48a112={},_0x277cf0={'count':0x0,'rows':[]};var _0x53abb1=_[_0xf776('0x37')](db[_0xf776('0x38')]['rawAttributes'],function(_0x14d861){return{'name':_0x14d861[_0xf776('0x39')],'type':_0x14d861[_0xf776('0x3a')][_0xf776('0x3b')]};});_0x48a112[_0xf776('0x3c')]=_[_0xf776('0x37')](_0x53abb1,_0xf776('0x35'));_0x48a112[_0xf776('0x3d')]=_['keys'](_0x472b9a[_0xf776('0x3d')]);_0x48a112['filters']=_[_0xf776('0x3e')](_0x48a112[_0xf776('0x3c')],_0x48a112['query']);_0x4d0b11['attributes']=_[_0xf776('0x3e')](_0x48a112['model'],qs[_0xf776('0x3f')](_0x472b9a[_0xf776('0x3d')]['fields']));_0x4d0b11[_0xf776('0x40')]=_0x4d0b11[_0xf776('0x40')][_0xf776('0x41')]?_0x4d0b11['attributes']:_0x48a112[_0xf776('0x3c')];if(!_0x472b9a['query']['hasOwnProperty'](_0xf776('0x42'))){_0x4d0b11[_0xf776('0x43')]=qs[_0xf776('0x43')](_0x472b9a[_0xf776('0x3d')][_0xf776('0x43')]);_0x4d0b11[_0xf776('0x2f')]=qs[_0xf776('0x2f')](_0x472b9a['query']['offset']);}_0x4d0b11[_0xf776('0x44')]=qs[_0xf776('0x45')](_0x472b9a[_0xf776('0x3d')][_0xf776('0x45')]);_0x4d0b11[_0xf776('0x46')]=qs[_0xf776('0x47')](_[_0xf776('0x48')](_0x472b9a[_0xf776('0x3d')],_0x48a112['filters']),_0x53abb1);if(_0x472b9a['query'][_0xf776('0x49')]){_0x4d0b11[_0xf776('0x46')]=_[_0xf776('0x4a')](_0x4d0b11[_0xf776('0x46')],{'$or':_[_0xf776('0x37')](_0x53abb1,function(_0x352247){if(_0x352247[_0xf776('0x3a')]!==_0xf776('0x4b')){var _0x829f7f={};_0x829f7f[_0x352247[_0xf776('0x35')]]={'$like':'%'+_0x472b9a[_0xf776('0x3d')][_0xf776('0x49')]+'%'};return _0x829f7f;}})});}_0x4d0b11=_['merge']({},_0x4d0b11,_0x472b9a['options']);var _0x1e651f={'where':_0x4d0b11[_0xf776('0x46')]};return db[_0xf776('0x38')]['count'](_0x1e651f)['then'](function(_0x2d3bbb){_0x277cf0[_0xf776('0x4c')]=_0x2d3bbb;if(_0x472b9a[_0xf776('0x3d')][_0xf776('0x4d')]){_0x4d0b11[_0xf776('0x4e')]=[{'all':!![]}];}return db[_0xf776('0x38')]['findAll'](_0x4d0b11);})[_0xf776('0x21')](function(_0x244776){_0x277cf0['rows']=_0x244776;return _0x277cf0;})['then'](respondWithFilteredResult(_0x3296c5,_0x4d0b11))[_0xf776('0x4f')](handleError(_0x3296c5,null));};exports[_0xf776('0x50')]=function(_0xb35870,_0x2493ae){var _0x487717={'raw':!![],'where':{'id':_0xb35870[_0xf776('0x51')]['id']}},_0x54dfef={};_0x54dfef[_0xf776('0x3c')]=_[_0xf776('0x52')](db[_0xf776('0x38')]['rawAttributes']);_0x54dfef['query']=_['keys'](_0xb35870[_0xf776('0x3d')]);_0x54dfef[_0xf776('0x47')]=_[_0xf776('0x3e')](_0x54dfef[_0xf776('0x3c')],_0x54dfef[_0xf776('0x3d')]);_0x487717['attributes']=_[_0xf776('0x3e')](_0x54dfef['model'],qs[_0xf776('0x3f')](_0xb35870[_0xf776('0x3d')][_0xf776('0x3f')]));_0x487717[_0xf776('0x40')]=_0x487717['attributes'][_0xf776('0x41')]?_0x487717[_0xf776('0x40')]:_0x54dfef[_0xf776('0x3c')];if(_0xb35870['query'][_0xf776('0x4d')]){_0x487717[_0xf776('0x4e')]=[{'all':!![]}];}_0x487717=_['merge']({},_0x487717,_0xb35870[_0xf776('0x53')]);return db[_0xf776('0x38')][_0xf776('0x54')](_0x487717)['then'](handleEntityNotFound(_0x2493ae,null))[_0xf776('0x21')](respondWithResult(_0x2493ae,null))[_0xf776('0x4f')](handleError(_0x2493ae,null));};exports[_0xf776('0x55')]=function(_0x167670,_0x53dfa3){return db[_0xf776('0x38')][_0xf776('0x55')](_0x167670['body'],{})[_0xf776('0x21')](respondWithResult(_0x53dfa3,0xc9))['catch'](handleError(_0x53dfa3,null));};exports[_0xf776('0x33')]=function(_0x37e7c1,_0x156121){if(_0x37e7c1['body']['id']){delete _0x37e7c1[_0xf776('0x56')]['id'];}return db[_0xf776('0x38')][_0xf776('0x54')]({'where':{'id':_0x37e7c1[_0xf776('0x51')]['id']}})['then'](handleEntityNotFound(_0x156121,null))[_0xf776('0x21')](saveUpdates(_0x37e7c1[_0xf776('0x56')],null))[_0xf776('0x21')](respondWithResult(_0x156121,null))['catch'](handleError(_0x156121,null));};exports[_0xf776('0x34')]=function(_0x45389c,_0x5d6c92){return db[_0xf776('0x38')][_0xf776('0x54')]({'where':{'id':_0x45389c[_0xf776('0x51')]['id']}})[_0xf776('0x21')](handleEntityNotFound(_0x5d6c92,null))[_0xf776('0x21')](removeEntity(_0x5d6c92,null))[_0xf776('0x4f')](handleError(_0x5d6c92,null));};exports[_0xf776('0x57')]=function(_0x17827d,_0x3f891f){return db[_0xf776('0x38')][_0xf776('0x57')]()[_0xf776('0x21')](respondWithResult(_0x3f891f,null))['catch'](handleError(_0x3f891f,null));};exports[_0xf776('0x58')]=function(_0x272f09,_0x154004,_0x23454e){return db[_0xf776('0x59')][_0xf776('0x4c')]({'where':{'ChatGroupId':_0x272f09[_0xf776('0x51')]['id'],'ToId':_0x272f09[_0xf776('0x5a')]['id'],'read':![]}})[_0xf776('0x21')](function(_0x55f395){return{'id':_[_0xf776('0x5b')](_0x272f09[_0xf776('0x51')]['id']),'count':_0x55f395};})[_0xf776('0x21')](respondWithResult(_0x154004,null))[_0xf776('0x4f')](handleError(_0x154004,null));};exports[_0xf776('0x5c')]=function(_0x1a5c0a,_0x303aa4,_0x3a8982){return db['ChatGroup'][_0xf776('0x54')]({'where':{'id':_0x1a5c0a['params']['id']}})[_0xf776('0x21')](handleEntityNotFound(_0x303aa4,null))[_0xf776('0x21')](function(_0x292f89){if(_0x292f89){return _0x292f89[_0xf776('0x5c')](_0x1a5c0a[_0xf776('0x56')][_0xf776('0x5d')],_[_0xf776('0x5e')](_0x1a5c0a[_0xf776('0x56')],[_0xf776('0x5d'),'id'])||{});}})[_0xf776('0x21')](respondWithResult(_0x303aa4,null))[_0xf776('0x4f')](handleError(_0x303aa4,null));};exports[_0xf776('0x5f')]=function(_0xfea019,_0x1c0225,_0x4229d6){var _0x33864b={};var _0x43488f={};var _0xa5ddc3;var _0x4b582f;return db[_0xf776('0x38')][_0xf776('0x60')]({'where':{'id':_0xfea019[_0xf776('0x51')]['id']}})[_0xf776('0x21')](handleEntityNotFound(_0x1c0225,null))[_0xf776('0x21')](function(_0x545e73){if(_0x545e73){_0xa5ddc3=_0x545e73;_0x43488f[_0xf776('0x3c')]=_[_0xf776('0x52')](db['User'][_0xf776('0x61')]);_0x43488f[_0xf776('0x3d')]=_['keys'](_0xfea019[_0xf776('0x3d')]);_0x43488f[_0xf776('0x47')]=_['intersection'](_0x43488f[_0xf776('0x3c')],_0x43488f[_0xf776('0x3d')]);_0x33864b['attributes']=_[_0xf776('0x3e')](_0x43488f[_0xf776('0x3c')],qs['fields'](_0xfea019[_0xf776('0x3d')][_0xf776('0x3f')]));_0x33864b[_0xf776('0x40')]=_0x33864b[_0xf776('0x40')][_0xf776('0x41')]?_0x33864b[_0xf776('0x40')]:_0x43488f['model'];_0x33864b[_0xf776('0x44')]=qs['sort'](_0xfea019[_0xf776('0x3d')][_0xf776('0x45')]);_0x33864b[_0xf776('0x46')]=qs[_0xf776('0x47')](_['pick'](_0xfea019['query'],_0x43488f[_0xf776('0x47')]));if(_0xfea019[_0xf776('0x3d')][_0xf776('0x49')]){_0x33864b[_0xf776('0x46')]=_[_0xf776('0x4a')](_0x33864b[_0xf776('0x46')],{'$or':_['map'](_0x33864b[_0xf776('0x40')],function(_0x11084e){var _0xea51={};_0xea51[_0x11084e]={'$like':'%'+_0xfea019[_0xf776('0x3d')][_0xf776('0x49')]+'%'};return _0xea51;})});}_0x33864b=_[_0xf776('0x4a')]({},_0x33864b,_0xfea019['options']);return _0xa5ddc3[_0xf776('0x5f')](_0x33864b);}})[_0xf776('0x21')](function(_0x549068){if(_0x549068){_0x4b582f=_0x549068[_0xf776('0x41')];if(!_0xfea019[_0xf776('0x3d')][_0xf776('0x62')](_0xf776('0x42'))){_0x33864b[_0xf776('0x43')]=qs['limit'](_0xfea019['query'][_0xf776('0x43')]);_0x33864b['offset']=qs[_0xf776('0x2f')](_0xfea019[_0xf776('0x3d')][_0xf776('0x2f')]);}return _0xa5ddc3[_0xf776('0x5f')](_0x33864b);}})[_0xf776('0x21')](function(_0x53f62b){if(_0x53f62b){return _0x53f62b?{'count':_0x4b582f,'rows':_0x53f62b}:null;}})[_0xf776('0x21')](respondWithResult(_0x1c0225,null))[_0xf776('0x4f')](handleError(_0x1c0225,null));};exports[_0xf776('0x63')]=function(_0x49698b,_0x4fc024,_0x2282c2){return db[_0xf776('0x38')]['find']({'where':{'id':_0x49698b[_0xf776('0x51')]['id']}})[_0xf776('0x21')](handleEntityNotFound(_0x4fc024,null))[_0xf776('0x21')](function(_0x32a78a){if(_0x32a78a){return _0x32a78a[_0xf776('0x63')](_0x49698b[_0xf776('0x3d')][_0xf776('0x5d')]);}})['then'](respondWithStatusCode(_0x4fc024,null))[_0xf776('0x4f')](handleError(_0x4fc024,null));};exports[_0xf776('0x64')]=function(_0xeac29,_0x451e47,_0x399a43){if(_0xeac29['body']['id']){delete _0xeac29[_0xf776('0x56')]['id'];}return db[_0xf776('0x38')]['find']({'where':{'id':_0xeac29['params']['id']}})['then'](handleEntityNotFound(_0x451e47,null))[_0xf776('0x21')](function(_0x5da6a3){if(_0x5da6a3){_0xeac29[_0xf776('0x56')][_0xf776('0x65')]=_0x5da6a3['id'];return db[_0xf776('0x59')][_0xf776('0x55')](_0xeac29[_0xf776('0x56')]);}})[_0xf776('0x21')](respondWithResult(_0x451e47,null))['catch'](handleError(_0x451e47,null));};exports[_0xf776('0x66')]=function(_0xe2c646,_0x581c70,_0x4501c1){var _0x5e69e8={};var _0x2bbde8={};var _0x3ee22c;var _0x4741fa;return db[_0xf776('0x38')][_0xf776('0x60')]({'where':{'id':_0xe2c646[_0xf776('0x51')]['id']}})[_0xf776('0x21')](handleEntityNotFound(_0x581c70,null))[_0xf776('0x21')](function(_0x22b813){if(_0x22b813){_0x3ee22c=_0x22b813;_0x2bbde8[_0xf776('0x3c')]=_['keys'](db['ChatInternalMessage'][_0xf776('0x61')]);_0x2bbde8[_0xf776('0x3d')]=_['keys'](_0xe2c646[_0xf776('0x3d')]);_0x2bbde8[_0xf776('0x47')]=_['intersection'](_0x2bbde8[_0xf776('0x3c')],_0x2bbde8[_0xf776('0x3d')]);_0x5e69e8[_0xf776('0x40')]=_['intersection'](_0x2bbde8[_0xf776('0x3c')],qs[_0xf776('0x3f')](_0xe2c646[_0xf776('0x3d')]['fields']));_0x5e69e8[_0xf776('0x40')]=_0x5e69e8['attributes'][_0xf776('0x41')]?_0x5e69e8['attributes']:_0x2bbde8[_0xf776('0x3c')];_0x5e69e8[_0xf776('0x44')]=qs[_0xf776('0x45')](_0xe2c646['query']['sort']);_0x5e69e8[_0xf776('0x46')]=qs[_0xf776('0x47')](_[_0xf776('0x48')](_0xe2c646['query'],_0x2bbde8['filters']));if(_0xe2c646['query'][_0xf776('0x49')]){_0x5e69e8[_0xf776('0x46')]=_[_0xf776('0x4a')](_0x5e69e8[_0xf776('0x46')],{'$or':_['map'](_0x5e69e8[_0xf776('0x40')],function(_0x47e1e7){var _0x140462={};_0x140462[_0x47e1e7]={'$like':'%'+_0xe2c646['query'][_0xf776('0x49')]+'%'};return _0x140462;})});}if(_0xe2c646[_0xf776('0x3d')][_0xf776('0x67')]){var _0x51ac93=_0xe2c646[_0xf776('0x3d')][_0xf776('0x67')][_0xf776('0x68')](',');var _0x4e0cb8={};_0x4e0cb8[_0x51ac93[0x0]]={'$gte':moment(_0x51ac93[0x1])[_0xf776('0x69')](_0xf776('0x6a'))};_0x5e69e8[_0xf776('0x46')]=_[_0xf776('0x4a')](_0x5e69e8['where'],_0x4e0cb8);}_0x5e69e8=_[_0xf776('0x4a')]({},_0x5e69e8,_0xe2c646[_0xf776('0x53')]);return _0x3ee22c[_0xf776('0x66')](_0x5e69e8);}})['then'](function(_0x5765cf){if(_0x5765cf){_0x4741fa=_0x5765cf[_0xf776('0x41')];if(!_0xe2c646[_0xf776('0x3d')][_0xf776('0x62')](_0xf776('0x42'))){_0x5e69e8[_0xf776('0x43')]=qs[_0xf776('0x43')](_0xe2c646['query'][_0xf776('0x43')]);_0x5e69e8['offset']=qs[_0xf776('0x2f')](_0xe2c646[_0xf776('0x3d')]['offset']);}return _0x3ee22c[_0xf776('0x66')](_0x5e69e8);}})[_0xf776('0x21')](function(_0x149deb){if(_0x149deb){return _0x149deb?{'count':_0x4741fa,'rows':_0x149deb}:null;}})['then'](respondWithResult(_0x581c70,null))['catch'](handleError(_0x581c70,null));}; \ No newline at end of file +var _0xf1a5=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','ChatGroup','includeAll','include','findAll','rows','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','User','intersection','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','options','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','fields'];(function(_0x28dd1a,_0x48ecb3){var _0x18d911=function(_0x22c789){while(--_0x22c789){_0x28dd1a['push'](_0x28dd1a['shift']());}};_0x18d911(++_0x48ecb3);}(_0xf1a5,0x1db));var _0x5f1a=function(_0x234a2b,_0x45bad9){_0x234a2b=_0x234a2b-0x0;var _0x9a1bd1=_0xf1a5[_0x234a2b];return _0x9a1bd1;};'use strict';var pdf=require(_0x5f1a('0x0'));var emlformat=require(_0x5f1a('0x1'));var rimraf=require(_0x5f1a('0x2'));var zipdir=require(_0x5f1a('0x3'));var jsonpatch=require(_0x5f1a('0x4'));var rp=require(_0x5f1a('0x5'));var moment=require(_0x5f1a('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5f1a('0x7'));var sox=require(_0x5f1a('0x8'));var csv=require(_0x5f1a('0x9'));var ejs=require(_0x5f1a('0xa'));var fs=require('fs');var _=require(_0x5f1a('0xb'));var squel=require(_0x5f1a('0xc'));var crypto=require('crypto');var jsforce=require(_0x5f1a('0xd'));var deskjs=require(_0x5f1a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5f1a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f1a('0x10'));var as=require(_0x5f1a('0x11'));var hardwareService=require(_0x5f1a('0x12'));var logger=require(_0x5f1a('0x13'))(_0x5f1a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5f1a('0x15'))['db'];config[_0x5f1a('0x16')]=_[_0x5f1a('0x17')](config[_0x5f1a('0x16')],{'host':_0x5f1a('0x18'),'port':0x18eb});var socket=require(_0x5f1a('0x19'))(new Redis(config['redis']));require(_0x5f1a('0x1a'))['register'](socket);var jayson=require(_0x5f1a('0x1b'));var client=jayson[_0x5f1a('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0xb7712f,_0x324fc5,_0x5aa536){if(_0x5aa536){var _0x2ab713=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ab713[_0x5f1a('0x1d')](_0x324fc5)){return _0xb7712f;}else{throw new db[(_0x5f1a('0x1e'))][(_0x5f1a('0x1f'))](_0x5f1a('0x20'));}}else{return _0xb7712f;}}function respondWithRpcPromise(_0x4498b6,_0x2ec2ca,_0x1e17ec,_0x142259){return new BPromise(function(_0x20ab5c,_0x530acb){var _0x72266f=_0x142259||client;return _0x72266f[_0x5f1a('0x21')](_0x4498b6,_0x1e17ec)[_0x5f1a('0x22')](function(_0xd2324c){logger['info'](_0x5f1a('0x23'),_0x2ec2ca,'request\x20sent');logger[_0x5f1a('0x24')](_0x5f1a('0x25'),_0x2ec2ca,_0x5f1a('0x26'),JSON['stringify'](_0xd2324c));if(_0xd2324c['error']){if(_0xd2324c[_0x5f1a('0x27')]['code']===0x1f4){logger[_0x5f1a('0x27')](_0x5f1a('0x23'),_0x2ec2ca,_0xd2324c[_0x5f1a('0x27')]['message']);return _0x530acb(_0xd2324c['error']['message']);}logger[_0x5f1a('0x27')](_0x5f1a('0x23'),_0x2ec2ca,_0xd2324c[_0x5f1a('0x27')][_0x5f1a('0x28')]);return _0x20ab5c(_0xd2324c['error'][_0x5f1a('0x28')]);}else{logger[_0x5f1a('0x29')]('ChatGroup,\x20%s,\x20%s',_0x2ec2ca,_0x5f1a('0x26'));_0x20ab5c(_0xd2324c[_0x5f1a('0x2a')]['message']);}})[_0x5f1a('0x2b')](function(_0x4de007){logger[_0x5f1a('0x27')](_0x5f1a('0x23'),_0x2ec2ca,_0x4de007);_0x530acb(_0x4de007);});});}function respondWithStatusCode(_0x3d8e32,_0x56bdbe){_0x56bdbe=_0x56bdbe||0xcc;return function(_0x4eaf1e){if(_0x4eaf1e){return _0x3d8e32['sendStatus'](_0x56bdbe);}return _0x3d8e32[_0x5f1a('0x2c')](_0x56bdbe)[_0x5f1a('0x2d')]();};}function respondWithResult(_0x1674ed,_0x2161e9){_0x2161e9=_0x2161e9||0xc8;return function(_0x512330){if(_0x512330){return _0x1674ed[_0x5f1a('0x2c')](_0x2161e9)[_0x5f1a('0x2e')](_0x512330);}};}function respondWithFilteredResult(_0x427263,_0x34acac){return function(_0x53750b){if(_0x53750b){var _0x381e18=_0x53750b[_0x5f1a('0x2f')],_0x45e704=_0x34acac[_0x5f1a('0x30')],_0x1b45a9=_0x34acac['offset']+_0x34acac[_0x5f1a('0x31')],_0x2b7b30;if(_0x1b45a9>=_0x381e18){_0x1b45a9=_0x381e18;_0x2b7b30=0xc8;}else{_0x2b7b30=0xce;}_0x427263[_0x5f1a('0x2c')](_0x2b7b30);return _0x427263[_0x5f1a('0x32')](_0x5f1a('0x33'),_0x45e704+'-'+_0x1b45a9+'/'+_0x381e18)[_0x5f1a('0x2e')](_0x53750b);}return null;};}function patchUpdates(_0x161631){return function(_0x4e5ce8){try{jsonpatch['apply'](_0x4e5ce8,_0x161631,!![]);}catch(_0x4820f9){return BPromise[_0x5f1a('0x34')](_0x4820f9);}return _0x4e5ce8[_0x5f1a('0x35')]();};}function saveUpdates(_0x2fb878,_0x49f7bc){return function(_0x147fcc){if(_0x147fcc){return _0x147fcc[_0x5f1a('0x36')](_0x2fb878)[_0x5f1a('0x22')](function(_0xb3c52a){return _0xb3c52a;});}return null;};}function removeEntity(_0x2b76dc,_0x4ba609){return function(_0x5711bd){if(_0x5711bd){return _0x5711bd[_0x5f1a('0x37')]()[_0x5f1a('0x22')](function(){_0x2b76dc[_0x5f1a('0x2c')](0xcc)[_0x5f1a('0x2d')]();});}};}function handleEntityNotFound(_0x341139,_0x2c0019){return function(_0x54cfb4){if(!_0x54cfb4){_0x341139[_0x5f1a('0x38')](0x194);}return _0x54cfb4;};}function handleError(_0x583a9b,_0x320a8a){_0x320a8a=_0x320a8a||0x1f4;return function(_0x5c4b6e){logger[_0x5f1a('0x27')](_0x5c4b6e[_0x5f1a('0x39')]);if(_0x5c4b6e[_0x5f1a('0x3a')]){delete _0x5c4b6e[_0x5f1a('0x3a')];}_0x583a9b[_0x5f1a('0x2c')](_0x320a8a)[_0x5f1a('0x3b')](_0x5c4b6e);};}exports[_0x5f1a('0x3c')]=function(_0x2e3a82,_0x29e815){var _0xeace9c={},_0x3101fd={},_0x204da9={'count':0x0,'rows':[]};var _0x259fa7=_[_0x5f1a('0x3d')](db['ChatGroup'][_0x5f1a('0x3e')],function(_0x20b57f){return{'name':_0x20b57f[_0x5f1a('0x3f')],'type':_0x20b57f[_0x5f1a('0x40')][_0x5f1a('0x41')]};});_0x3101fd[_0x5f1a('0x42')]=_[_0x5f1a('0x3d')](_0x259fa7,_0x5f1a('0x3a'));_0x3101fd['query']=_[_0x5f1a('0x43')](_0x2e3a82[_0x5f1a('0x44')]);_0x3101fd['filters']=_['intersection'](_0x3101fd['model'],_0x3101fd[_0x5f1a('0x44')]);_0xeace9c['attributes']=_['intersection'](_0x3101fd['model'],qs['fields'](_0x2e3a82[_0x5f1a('0x44')][_0x5f1a('0x45')]));_0xeace9c[_0x5f1a('0x46')]=_0xeace9c[_0x5f1a('0x46')][_0x5f1a('0x47')]?_0xeace9c[_0x5f1a('0x46')]:_0x3101fd[_0x5f1a('0x42')];if(!_0x2e3a82[_0x5f1a('0x44')][_0x5f1a('0x48')]('nolimit')){_0xeace9c[_0x5f1a('0x31')]=qs[_0x5f1a('0x31')](_0x2e3a82[_0x5f1a('0x44')]['limit']);_0xeace9c['offset']=qs[_0x5f1a('0x30')](_0x2e3a82[_0x5f1a('0x44')]['offset']);}_0xeace9c[_0x5f1a('0x49')]=qs[_0x5f1a('0x4a')](_0x2e3a82['query'][_0x5f1a('0x4a')]);_0xeace9c[_0x5f1a('0x4b')]=qs[_0x5f1a('0x4c')](_[_0x5f1a('0x4d')](_0x2e3a82[_0x5f1a('0x44')],_0x3101fd[_0x5f1a('0x4c')]),_0x259fa7);if(_0x2e3a82['query'][_0x5f1a('0x4e')]){_0xeace9c[_0x5f1a('0x4b')]=_['merge'](_0xeace9c[_0x5f1a('0x4b')],{'$or':_[_0x5f1a('0x3d')](_0x259fa7,function(_0x1dc138){if(_0x1dc138[_0x5f1a('0x40')]!==_0x5f1a('0x4f')){var _0x3ef538={};_0x3ef538[_0x1dc138['name']]={'$like':'%'+_0x2e3a82[_0x5f1a('0x44')][_0x5f1a('0x4e')]+'%'};return _0x3ef538;}})});}_0xeace9c=_[_0x5f1a('0x50')]({},_0xeace9c,_0x2e3a82['options']);var _0x36c972={'where':_0xeace9c['where']};return db[_0x5f1a('0x51')][_0x5f1a('0x2f')](_0x36c972)[_0x5f1a('0x22')](function(_0x507f39){_0x204da9[_0x5f1a('0x2f')]=_0x507f39;if(_0x2e3a82[_0x5f1a('0x44')][_0x5f1a('0x52')]){_0xeace9c[_0x5f1a('0x53')]=[{'all':!![]}];}return db[_0x5f1a('0x51')][_0x5f1a('0x54')](_0xeace9c);})['then'](function(_0x58bcba){_0x204da9[_0x5f1a('0x55')]=_0x58bcba;return _0x204da9;})[_0x5f1a('0x22')](respondWithFilteredResult(_0x29e815,_0xeace9c))[_0x5f1a('0x2b')](handleError(_0x29e815,null));};exports[_0x5f1a('0x56')]=function(_0x3da108,_0x5f4e5a){var _0x32f971={'raw':!![],'where':{'id':_0x3da108[_0x5f1a('0x57')]['id']}},_0x2a5064={};_0x2a5064['model']=_[_0x5f1a('0x43')](db[_0x5f1a('0x51')][_0x5f1a('0x3e')]);_0x2a5064[_0x5f1a('0x44')]=_[_0x5f1a('0x43')](_0x3da108[_0x5f1a('0x44')]);_0x2a5064[_0x5f1a('0x4c')]=_['intersection'](_0x2a5064['model'],_0x2a5064['query']);_0x32f971[_0x5f1a('0x46')]=_['intersection'](_0x2a5064[_0x5f1a('0x42')],qs[_0x5f1a('0x45')](_0x3da108[_0x5f1a('0x44')][_0x5f1a('0x45')]));_0x32f971[_0x5f1a('0x46')]=_0x32f971['attributes'][_0x5f1a('0x47')]?_0x32f971['attributes']:_0x2a5064[_0x5f1a('0x42')];if(_0x3da108[_0x5f1a('0x44')][_0x5f1a('0x52')]){_0x32f971['include']=[{'all':!![]}];}_0x32f971=_[_0x5f1a('0x50')]({},_0x32f971,_0x3da108['options']);return db['ChatGroup'][_0x5f1a('0x58')](_0x32f971)[_0x5f1a('0x22')](handleEntityNotFound(_0x5f4e5a,null))['then'](respondWithResult(_0x5f4e5a,null))[_0x5f1a('0x2b')](handleError(_0x5f4e5a,null));};exports[_0x5f1a('0x59')]=function(_0x4b993c,_0x532daf){return db[_0x5f1a('0x51')][_0x5f1a('0x59')](_0x4b993c[_0x5f1a('0x5a')],{})[_0x5f1a('0x22')](respondWithResult(_0x532daf,0xc9))[_0x5f1a('0x2b')](handleError(_0x532daf,null));};exports[_0x5f1a('0x36')]=function(_0x318b98,_0x26a2d5){if(_0x318b98['body']['id']){delete _0x318b98[_0x5f1a('0x5a')]['id'];}return db[_0x5f1a('0x51')]['find']({'where':{'id':_0x318b98[_0x5f1a('0x57')]['id']}})[_0x5f1a('0x22')](handleEntityNotFound(_0x26a2d5,null))['then'](saveUpdates(_0x318b98[_0x5f1a('0x5a')],null))[_0x5f1a('0x22')](respondWithResult(_0x26a2d5,null))['catch'](handleError(_0x26a2d5,null));};exports['destroy']=function(_0x24f918,_0x2767c8){return db[_0x5f1a('0x51')][_0x5f1a('0x58')]({'where':{'id':_0x24f918[_0x5f1a('0x57')]['id']}})[_0x5f1a('0x22')](handleEntityNotFound(_0x2767c8,null))[_0x5f1a('0x22')](removeEntity(_0x2767c8,null))['catch'](handleError(_0x2767c8,null));};exports[_0x5f1a('0x5b')]=function(_0x3dfa32,_0x33c319){return db[_0x5f1a('0x51')][_0x5f1a('0x5b')]()[_0x5f1a('0x22')](respondWithResult(_0x33c319,null))[_0x5f1a('0x2b')](handleError(_0x33c319,null));};exports[_0x5f1a('0x5c')]=function(_0x53718c,_0x548fab,_0x4c0f73){return db[_0x5f1a('0x5d')][_0x5f1a('0x2f')]({'where':{'ChatGroupId':_0x53718c['params']['id'],'ToId':_0x53718c[_0x5f1a('0x5e')]['id'],'read':![]}})[_0x5f1a('0x22')](function(_0x1a36dc){return{'id':_[_0x5f1a('0x5f')](_0x53718c[_0x5f1a('0x57')]['id']),'count':_0x1a36dc};})[_0x5f1a('0x22')](respondWithResult(_0x548fab,null))[_0x5f1a('0x2b')](handleError(_0x548fab,null));};exports[_0x5f1a('0x60')]=function(_0x2f04a2,_0x31a2e9,_0x53d314){return db[_0x5f1a('0x51')][_0x5f1a('0x58')]({'where':{'id':_0x2f04a2[_0x5f1a('0x57')]['id']}})[_0x5f1a('0x22')](handleEntityNotFound(_0x31a2e9,null))[_0x5f1a('0x22')](function(_0x38a049){if(_0x38a049){return _0x38a049[_0x5f1a('0x60')](_0x2f04a2[_0x5f1a('0x5a')][_0x5f1a('0x61')],_[_0x5f1a('0x62')](_0x2f04a2[_0x5f1a('0x5a')],[_0x5f1a('0x61'),'id'])||{});}})['then'](respondWithResult(_0x31a2e9,null))[_0x5f1a('0x2b')](handleError(_0x31a2e9,null));};exports[_0x5f1a('0x63')]=function(_0x4100a7,_0x3ae556,_0x1057a6){var _0x5892de={};var _0x56e4d7={};var _0x3daa18;var _0x2f49c8;return db[_0x5f1a('0x51')]['findOne']({'where':{'id':_0x4100a7[_0x5f1a('0x57')]['id']}})[_0x5f1a('0x22')](handleEntityNotFound(_0x3ae556,null))[_0x5f1a('0x22')](function(_0x37c66f){if(_0x37c66f){_0x3daa18=_0x37c66f;_0x56e4d7[_0x5f1a('0x42')]=_['keys'](db[_0x5f1a('0x64')][_0x5f1a('0x3e')]);_0x56e4d7[_0x5f1a('0x44')]=_[_0x5f1a('0x43')](_0x4100a7[_0x5f1a('0x44')]);_0x56e4d7['filters']=_[_0x5f1a('0x65')](_0x56e4d7[_0x5f1a('0x42')],_0x56e4d7[_0x5f1a('0x44')]);_0x5892de[_0x5f1a('0x46')]=_['intersection'](_0x56e4d7['model'],qs[_0x5f1a('0x45')](_0x4100a7[_0x5f1a('0x44')][_0x5f1a('0x45')]));_0x5892de[_0x5f1a('0x46')]=_0x5892de[_0x5f1a('0x46')][_0x5f1a('0x47')]?_0x5892de[_0x5f1a('0x46')]:_0x56e4d7[_0x5f1a('0x42')];_0x5892de['order']=qs[_0x5f1a('0x4a')](_0x4100a7[_0x5f1a('0x44')][_0x5f1a('0x4a')]);_0x5892de[_0x5f1a('0x4b')]=qs[_0x5f1a('0x4c')](_[_0x5f1a('0x4d')](_0x4100a7[_0x5f1a('0x44')],_0x56e4d7[_0x5f1a('0x4c')]));if(_0x4100a7[_0x5f1a('0x44')]['filter']){_0x5892de[_0x5f1a('0x4b')]=_[_0x5f1a('0x50')](_0x5892de['where'],{'$or':_[_0x5f1a('0x3d')](_0x5892de[_0x5f1a('0x46')],function(_0x254951){var _0x76a8d4={};_0x76a8d4[_0x254951]={'$like':'%'+_0x4100a7[_0x5f1a('0x44')][_0x5f1a('0x4e')]+'%'};return _0x76a8d4;})});}_0x5892de=_['merge']({},_0x5892de,_0x4100a7['options']);return _0x3daa18['getMembers'](_0x5892de);}})[_0x5f1a('0x22')](function(_0xd80583){if(_0xd80583){_0x2f49c8=_0xd80583[_0x5f1a('0x47')];if(!_0x4100a7[_0x5f1a('0x44')][_0x5f1a('0x48')]('nolimit')){_0x5892de['limit']=qs[_0x5f1a('0x31')](_0x4100a7[_0x5f1a('0x44')][_0x5f1a('0x31')]);_0x5892de[_0x5f1a('0x30')]=qs[_0x5f1a('0x30')](_0x4100a7[_0x5f1a('0x44')][_0x5f1a('0x30')]);}return _0x3daa18[_0x5f1a('0x63')](_0x5892de);}})[_0x5f1a('0x22')](function(_0xbf7fe0){if(_0xbf7fe0){return _0xbf7fe0?{'count':_0x2f49c8,'rows':_0xbf7fe0}:null;}})[_0x5f1a('0x22')](respondWithResult(_0x3ae556,null))['catch'](handleError(_0x3ae556,null));};exports['removeMembers']=function(_0x37280d,_0x501c17,_0x340cc1){return db['ChatGroup']['find']({'where':{'id':_0x37280d[_0x5f1a('0x57')]['id']}})[_0x5f1a('0x22')](handleEntityNotFound(_0x501c17,null))[_0x5f1a('0x22')](function(_0x4d4956){if(_0x4d4956){return _0x4d4956[_0x5f1a('0x66')](_0x37280d['query']['ids']);}})[_0x5f1a('0x22')](respondWithStatusCode(_0x501c17,null))[_0x5f1a('0x2b')](handleError(_0x501c17,null));};exports[_0x5f1a('0x67')]=function(_0x4e9bb5,_0x54551e,_0x3139aa){if(_0x4e9bb5[_0x5f1a('0x5a')]['id']){delete _0x4e9bb5[_0x5f1a('0x5a')]['id'];}return db[_0x5f1a('0x51')][_0x5f1a('0x58')]({'where':{'id':_0x4e9bb5[_0x5f1a('0x57')]['id']}})[_0x5f1a('0x22')](handleEntityNotFound(_0x54551e,null))[_0x5f1a('0x22')](function(_0xab1f10){if(_0xab1f10){_0x4e9bb5[_0x5f1a('0x5a')][_0x5f1a('0x68')]=_0xab1f10['id'];return db[_0x5f1a('0x5d')]['create'](_0x4e9bb5[_0x5f1a('0x5a')]);}})['then'](respondWithResult(_0x54551e,null))[_0x5f1a('0x2b')](handleError(_0x54551e,null));};exports[_0x5f1a('0x69')]=function(_0x48463a,_0x4bb867,_0x25d73a){var _0x310f25={};var _0x172a4d={};var _0x3a8314;var _0x20c845;return db['ChatGroup']['findOne']({'where':{'id':_0x48463a[_0x5f1a('0x57')]['id']}})[_0x5f1a('0x22')](handleEntityNotFound(_0x4bb867,null))[_0x5f1a('0x22')](function(_0xc1a814){if(_0xc1a814){_0x3a8314=_0xc1a814;_0x172a4d[_0x5f1a('0x42')]=_[_0x5f1a('0x43')](db[_0x5f1a('0x5d')][_0x5f1a('0x3e')]);_0x172a4d['query']=_[_0x5f1a('0x43')](_0x48463a[_0x5f1a('0x44')]);_0x172a4d['filters']=_[_0x5f1a('0x65')](_0x172a4d[_0x5f1a('0x42')],_0x172a4d['query']);_0x310f25[_0x5f1a('0x46')]=_[_0x5f1a('0x65')](_0x172a4d[_0x5f1a('0x42')],qs[_0x5f1a('0x45')](_0x48463a[_0x5f1a('0x44')][_0x5f1a('0x45')]));_0x310f25['attributes']=_0x310f25[_0x5f1a('0x46')][_0x5f1a('0x47')]?_0x310f25[_0x5f1a('0x46')]:_0x172a4d[_0x5f1a('0x42')];_0x310f25[_0x5f1a('0x49')]=qs[_0x5f1a('0x4a')](_0x48463a[_0x5f1a('0x44')][_0x5f1a('0x4a')]);_0x310f25['where']=qs['filters'](_[_0x5f1a('0x4d')](_0x48463a[_0x5f1a('0x44')],_0x172a4d['filters']));if(_0x48463a[_0x5f1a('0x44')][_0x5f1a('0x4e')]){_0x310f25[_0x5f1a('0x4b')]=_['merge'](_0x310f25['where'],{'$or':_['map'](_0x310f25[_0x5f1a('0x46')],function(_0x421c9f){var _0x128a71={};_0x128a71[_0x421c9f]={'$like':'%'+_0x48463a[_0x5f1a('0x44')]['filter']+'%'};return _0x128a71;})});}if(_0x48463a[_0x5f1a('0x44')][_0x5f1a('0x6a')]){var _0x84a730=_0x48463a['query'][_0x5f1a('0x6a')][_0x5f1a('0x6b')](',');var _0x461027={};_0x461027[_0x84a730[0x0]]={'$gte':moment(_0x84a730[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x310f25[_0x5f1a('0x4b')]=_['merge'](_0x310f25[_0x5f1a('0x4b')],_0x461027);}_0x310f25=_['merge']({},_0x310f25,_0x48463a[_0x5f1a('0x6c')]);return _0x3a8314[_0x5f1a('0x69')](_0x310f25);}})[_0x5f1a('0x22')](function(_0x4bd7f7){if(_0x4bd7f7){_0x20c845=_0x4bd7f7[_0x5f1a('0x47')];if(!_0x48463a[_0x5f1a('0x44')][_0x5f1a('0x48')]('nolimit')){_0x310f25[_0x5f1a('0x31')]=qs[_0x5f1a('0x31')](_0x48463a[_0x5f1a('0x44')]['limit']);_0x310f25[_0x5f1a('0x30')]=qs[_0x5f1a('0x30')](_0x48463a[_0x5f1a('0x44')][_0x5f1a('0x30')]);}return _0x3a8314[_0x5f1a('0x69')](_0x310f25);}})[_0x5f1a('0x22')](function(_0x1acdde){if(_0x1acdde){return _0x1acdde?{'count':_0x20c845,'rows':_0x1acdde}:null;}})[_0x5f1a('0x22')](respondWithResult(_0x4bb867,null))[_0x5f1a('0x2b')](handleError(_0x4bb867,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b864578..96ec096 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0xc106ce,_0x2c20cc){var _0x55260c=function(_0x12e6ba){while(--_0x12e6ba){_0xc106ce['push'](_0xc106ce['shift']());}};_0x55260c(++_0x2c20cc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xadb5,0xad));var _0x5adb=function(_0x59f80b,_0x315915){_0x59f80b=_0x59f80b-0x0;var _0x3bf03f=_0xadb5[_0x59f80b];return _0x3bf03f;};'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 85f5999..1c56823 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 _0x0af5=['rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1ce595,_0x2b0b06){var _0x513da0=function(_0x1b2d95){while(--_0x1b2d95){_0x1ce595['push'](_0x1ce595['shift']());}};_0x513da0(++_0x2b0b06);}(_0x0af5,0x158));var _0x50af=function(_0x7b3e53,_0x1f8c67){_0x7b3e53=_0x7b3e53-0x0;var _0x3967aa=_0x0af5[_0x7b3e53];return _0x3967aa;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var logger=require(_0x50af('0x1'))(_0x50af('0x2'));var moment=require(_0x50af('0x3'));var BPromise=require(_0x50af('0x4'));var rp=require(_0x50af('0x5'));var fs=require('fs');var path=require(_0x50af('0x6'));var rimraf=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var attributes=require(_0x50af('0x9'));module[_0x50af('0xa')]=function(_0xe37b1,_0x5e94f8){return _0xe37b1['define'](_0x50af('0xb'),attributes,{'tableName':_0x50af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6596=['path','rimraf','exports','define','ChatGroup','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4a2017,_0x531514){var _0x526dbe=function(_0x4c0517){while(--_0x4c0517){_0x4a2017['push'](_0x4a2017['shift']());}};_0x526dbe(++_0x531514);}(_0x6596,0x1d3));var _0x6659=function(_0x417dbf,_0x2029d3){_0x417dbf=_0x417dbf-0x0;var _0x18f559=_0x6596[_0x417dbf];return _0x18f559;};'use strict';var _=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var logger=require('../../config/logger')(_0x6659('0x2'));var moment=require(_0x6659('0x3'));var BPromise=require(_0x6659('0x4'));var rp=require(_0x6659('0x5'));var fs=require('fs');var path=require(_0x6659('0x6'));var rimraf=require(_0x6659('0x7'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x6659('0x8')]=function(_0x3091f1,_0xd6bf59){return _0x3091f1[_0x6659('0x9')](_0x6659('0xa'),attributes,{'tableName':'chat_groups','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 04db6ef..e636822 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 _0xc1a7=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./chatGroup.socket','then','info','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','request\x20sent','catch','lodash','moment','bluebird'];(function(_0x130022,_0x3eed95){var _0xd4ff43=function(_0x1a1296){while(--_0x1a1296){_0x130022['push'](_0x130022['shift']());}};_0xd4ff43(++_0x3eed95);}(_0xc1a7,0xe3));var _0x7c1a=function(_0x4adeb9,_0x251666){_0x4adeb9=_0x4adeb9-0x0;var _0x2bba5a=_0xc1a7[_0x4adeb9];return _0x2bba5a;};'use strict';var _=require(_0x7c1a('0x0'));var util=require('util');var moment=require(_0x7c1a('0x1'));var BPromise=require(_0x7c1a('0x2'));var rs=require(_0x7c1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c1a('0x4'));var logger=require(_0x7c1a('0x5'))(_0x7c1a('0x6'));var config=require('../../config/environment');var jayson=require(_0x7c1a('0x7'));var client=jayson['client'][_0x7c1a('0x8')]({'port':0x232a});config['redis']=_[_0x7c1a('0x9')](config[_0x7c1a('0xa')],{'host':_0x7c1a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c1a('0xa')]));require(_0x7c1a('0xc'))['register'](socket);function respondWithRpcPromise(_0x34ae2f,_0x568414,_0x340567){return new BPromise(function(_0x65c9cd,_0x5a4e32){return client['request'](_0x34ae2f,_0x340567)[_0x7c1a('0xd')](function(_0x3f86ee){logger[_0x7c1a('0xe')]('ChatGroup,\x20%s,\x20%s',_0x568414,'request\x20sent');logger['debug'](_0x7c1a('0xf'),_0x568414,'request\x20sent',JSON[_0x7c1a('0x10')](_0x3f86ee));if(_0x3f86ee[_0x7c1a('0x11')]){if(_0x3f86ee[_0x7c1a('0x11')][_0x7c1a('0x12')]===0x1f4){logger[_0x7c1a('0x11')](_0x7c1a('0x13'),_0x568414,_0x3f86ee[_0x7c1a('0x11')][_0x7c1a('0x14')]);return _0x5a4e32(_0x3f86ee['error'][_0x7c1a('0x14')]);}logger['error'](_0x7c1a('0x13'),_0x568414,_0x3f86ee[_0x7c1a('0x11')][_0x7c1a('0x14')]);return _0x65c9cd(_0x3f86ee['error']['message']);}else{logger[_0x7c1a('0xe')](_0x7c1a('0x13'),_0x568414,_0x7c1a('0x15'));_0x65c9cd(_0x3f86ee['result'][_0x7c1a('0x14')]);}})[_0x7c1a('0x16')](function(_0x24542c){logger[_0x7c1a('0x11')](_0x7c1a('0x13'),_0x568414,_0x24542c);_0x5a4e32(_0x24542c);});});} \ No newline at end of file +var _0xf9d0=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf9d0,0xce));var _0x0f9d=function(_0x1d7101,_0x216e0d){_0x1d7101=_0x1d7101-0x0;var _0x26ec3=_0xf9d0[_0x1d7101];return _0x26ec3;};'use strict';var _=require('lodash');var util=require(_0x0f9d('0x0'));var moment=require(_0x0f9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f9d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f9d('0x3'))['db'];var utils=require(_0x0f9d('0x4'));var logger=require(_0x0f9d('0x5'))('rpc');var config=require(_0x0f9d('0x6'));var jayson=require(_0x0f9d('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0f9d('0x8')]=_[_0x0f9d('0x9')](config['redis'],{'host':_0x0f9d('0xa'),'port':0x18eb});var socket=require(_0x0f9d('0xb'))(new Redis(config['redis']));require(_0x0f9d('0xc'))['register'](socket);function respondWithRpcPromise(_0x195d8e,_0x229160,_0x203cf3){return new BPromise(function(_0x4f5c5c,_0x3c68fd){return client[_0x0f9d('0xd')](_0x195d8e,_0x203cf3)[_0x0f9d('0xe')](function(_0x5def97){logger[_0x0f9d('0xf')](_0x0f9d('0x10'),_0x229160,'request\x20sent');logger[_0x0f9d('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x229160,_0x0f9d('0x12'),JSON[_0x0f9d('0x13')](_0x5def97));if(_0x5def97[_0x0f9d('0x14')]){if(_0x5def97[_0x0f9d('0x14')]['code']===0x1f4){logger[_0x0f9d('0x14')]('ChatGroup,\x20%s,\x20%s',_0x229160,_0x5def97[_0x0f9d('0x14')][_0x0f9d('0x15')]);return _0x3c68fd(_0x5def97[_0x0f9d('0x14')][_0x0f9d('0x15')]);}logger[_0x0f9d('0x14')]('ChatGroup,\x20%s,\x20%s',_0x229160,_0x5def97[_0x0f9d('0x14')][_0x0f9d('0x15')]);return _0x4f5c5c(_0x5def97[_0x0f9d('0x14')]['message']);}else{logger['info'](_0x0f9d('0x10'),_0x229160,_0x0f9d('0x12'));_0x4f5c5c(_0x5def97[_0x0f9d('0x16')][_0x0f9d('0x15')]);}})['catch'](function(_0x198cbd){logger['error'](_0x0f9d('0x10'),_0x229160,_0x198cbd);_0x3c68fd(_0x198cbd);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index f963eb6..5753fd1 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 _0x1343=['save','remove','update','register','length'];(function(_0x5611a9,_0x460b05){var _0x483cd1=function(_0x526f95){while(--_0x526f95){_0x5611a9['push'](_0x5611a9['shift']());}};_0x483cd1(++_0x460b05);}(_0x1343,0x64));var _0x3134=function(_0x8ec947,_0x444fa2){_0x8ec947=_0x8ec947-0x0;var _0x115d2b=_0x1343[_0x8ec947];return _0x115d2b;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x3134('0x0'),_0x3134('0x1'),_0x3134('0x2')];function createListener(_0x3a9bec,_0xaba923){return function(_0x51439e){_0xaba923['emit'](_0x3a9bec,_0x51439e);};}function removeListener(_0x2b1bf7,_0x40dd5a){return function(){ChatGroupEvents['removeListener'](_0x2b1bf7,_0x40dd5a);};}exports[_0x3134('0x3')]=function(_0x54b779){for(var _0x19e0c7=0x0,_0x58bbb1=events[_0x3134('0x4')];_0x19e0c7<_0x58bbb1;_0x19e0c7++){var _0x5873a2=events[_0x19e0c7];var _0x1ece88=createListener('chatGroup:'+_0x5873a2,_0x54b779);ChatGroupEvents['on'](_0x5873a2,_0x1ece88);}}; \ No newline at end of file +var _0x146c=['update','removeListener','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x146c,0x74));var _0xc146=function(_0x151c46,_0x26658a){_0x151c46=_0x151c46-0x0;var _0x323f1a=_0x146c[_0x151c46];return _0x323f1a;};'use strict';var ChatGroupEvents=require(_0xc146('0x0'));var events=[_0xc146('0x1'),_0xc146('0x2'),_0xc146('0x3')];function createListener(_0x216d5c,_0x509bc5){return function(_0x7cc448){_0x509bc5['emit'](_0x216d5c,_0x7cc448);};}function removeListener(_0xdb739d,_0x9dff0){return function(){ChatGroupEvents[_0xc146('0x4')](_0xdb739d,_0x9dff0);};}exports['register']=function(_0x31b2f1){for(var _0x5e73c6=0x0,_0x5eb9bc=events[_0xc146('0x5')];_0x5e73c6<_0x5eb9bc;_0x5e73c6++){var _0x4a7f78=events[_0x5e73c6];var _0x305ec6=createListener(_0xc146('0x6')+_0x4a7f78,_0x31b2f1);ChatGroupEvents['on'](_0x4a7f78,_0x305ec6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3b386d3..3648f7d 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 _0x716d=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','show','get','/:id/unread','getMembers','create','post','/:id/members','addMessage','put','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x716d,0xe5));var _0xd716=function(_0x23a5c6,_0x312363){_0x23a5c6=_0x23a5c6-0x0;var _0x3cb8c1=_0x716d[_0x23a5c6];return _0x3cb8c1;};'use strict';var multer=require(_0xd716('0x0'));var util=require(_0xd716('0x1'));var path=require(_0xd716('0x2'));var timeout=require(_0xd716('0x3'));var express=require(_0xd716('0x4'));var router=express[_0xd716('0x5')]();var auth=require(_0xd716('0x6'));var interaction=require(_0xd716('0x7'));var config=require(_0xd716('0x8'));var controller=require('./chatGroup.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xd716('0x9')](),controller[_0xd716('0xa')]);router['get']('/:id',auth[_0xd716('0x9')](),controller[_0xd716('0xb')]);router[_0xd716('0xc')](_0xd716('0xd'),auth[_0xd716('0x9')](),controller['getUnread']);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xd716('0xe')]);router[_0xd716('0xc')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth[_0xd716('0x9')](),controller[_0xd716('0xf')]);router[_0xd716('0x10')](_0xd716('0x11'),auth[_0xd716('0x9')](),controller['addMembers']);router[_0xd716('0x10')]('/:id/messages',auth[_0xd716('0x9')](),controller[_0xd716('0x12')]);router[_0xd716('0x13')]('/:id',auth[_0xd716('0x9')](),controller[_0xd716('0x14')]);router[_0xd716('0x15')](_0xd716('0x16'),auth['isAuthenticated'](),controller[_0xd716('0x17')]);router['delete'](_0xd716('0x11'),auth[_0xd716('0x9')](),controller['removeMembers']);module[_0xd716('0x18')]=router; \ No newline at end of file +var _0x4068=['removeMembers','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','delete','destroy'];(function(_0x59db90,_0x2a7e72){var _0x42e49f=function(_0x3a5d0e){while(--_0x3a5d0e){_0x59db90['push'](_0x59db90['shift']());}};_0x42e49f(++_0x2a7e72);}(_0x4068,0xe2));var _0x8406=function(_0x38306e,_0x32a157){_0x38306e=_0x38306e-0x0;var _0x58fddf=_0x4068[_0x38306e];return _0x58fddf;};'use strict';var multer=require(_0x8406('0x0'));var util=require(_0x8406('0x1'));var path=require(_0x8406('0x2'));var timeout=require('connect-timeout');var express=require(_0x8406('0x3'));var router=express[_0x8406('0x4')]();var auth=require(_0x8406('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8406('0x6'));var controller=require(_0x8406('0x7'));router[_0x8406('0x8')]('/',auth[_0x8406('0x9')](),controller[_0x8406('0xa')]);router[_0x8406('0x8')](_0x8406('0xb'),auth[_0x8406('0x9')](),controller['describe']);router[_0x8406('0x8')](_0x8406('0xc'),auth[_0x8406('0x9')](),controller[_0x8406('0xd')]);router[_0x8406('0x8')](_0x8406('0xe'),auth[_0x8406('0x9')](),controller[_0x8406('0xf')]);router[_0x8406('0x8')](_0x8406('0x10'),auth['isAuthenticated'](),controller[_0x8406('0x11')]);router[_0x8406('0x8')](_0x8406('0x12'),auth[_0x8406('0x9')](),controller[_0x8406('0x13')]);router[_0x8406('0x14')]('/',auth[_0x8406('0x9')](),controller[_0x8406('0x15')]);router[_0x8406('0x14')](_0x8406('0x10'),auth['isAuthenticated'](),controller[_0x8406('0x16')]);router[_0x8406('0x14')](_0x8406('0x12'),auth[_0x8406('0x9')](),controller['addMessage']);router[_0x8406('0x17')](_0x8406('0xc'),auth[_0x8406('0x9')](),controller['update']);router[_0x8406('0x18')](_0x8406('0xc'),auth[_0x8406('0x9')](),controller[_0x8406('0x19')]);router['delete'](_0x8406('0x10'),auth['isAuthenticated'](),controller[_0x8406('0x1a')]);module[_0x8406('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7391553..785fa77 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 _0x9731=['STRING','DATE','TEXT','long','ENUM','sequelize','BOOLEAN','INTEGER','star'];(function(_0x305593,_0x1a92c0){var _0x2760b7=function(_0xa3a2de){while(--_0xa3a2de){_0x305593['push'](_0x305593['shift']());}};_0x2760b7(++_0x1a92c0);}(_0x9731,0xb9));var _0x1973=function(_0x5709d6,_0x85f1d4){_0x5709d6=_0x5709d6-0x0;var _0x5024a8=_0x9731[_0x5709d6];return _0x5024a8;};'use strict';var Sequelize=require(_0x1973('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1973('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1973('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1973('0x3'),'thumb'),'defaultValue':_0x1973('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x1973('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1973('0x5')]},'disposition':{'type':Sequelize[_0x1973('0x4')]},'note':{'type':Sequelize[_0x1973('0x4')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1973('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x1973('0x4')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1973('0x4')]},'deviceType':{'type':Sequelize[_0x1973('0x4')]},'referer':{'type':Sequelize[_0x1973('0x6')]},'customerIp':{'type':Sequelize[_0x1973('0x4')]},'formData':{'type':Sequelize[_0x1973('0x6')](_0x1973('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1973('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x1973('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1973('0x4')]},'customerPort':{'type':Sequelize[_0x1973('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x1973('0x6')]}}; \ No newline at end of file +var _0x277d=['INTEGER','star','TEXT','STRING','DATE','long','ENUM','exports','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x277d,0x166));var _0xd277=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x277d[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xd277('0x0')]={'closed':{'type':Sequelize[_0xd277('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd277('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xd277('0x3'),'thumb'),'defaultValue':_0xd277('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xd277('0x4')]},'mailTranscript':{'type':Sequelize[_0xd277('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd277('0x6')]},'disposition':{'type':Sequelize[_0xd277('0x5')]},'note':{'type':Sequelize[_0xd277('0x5')]},'browserName':{'type':Sequelize[_0xd277('0x5')]},'browserVersion':{'type':Sequelize[_0xd277('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xd277('0x5')]},'deviceVendor':{'type':Sequelize[_0xd277('0x5')]},'deviceType':{'type':Sequelize[_0xd277('0x5')]},'referer':{'type':Sequelize[_0xd277('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xd277('0x4')](_0xd277('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xd277('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xd277('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd277('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xd277('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f45da4f..a827358 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 _0x5fab=['Smtp','service','host','port','secure','authentication','auth','pass','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','sort','pick','ChatInteractionId','includeAll','findAll','getMyMessages','addTags','spread','chatInteractionTags:save','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','save','update','stack','name','map','fullname','split','TagIds','catch','index','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','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','buildExpression','text','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','tag','forEach','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','order','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','push','all','rows','show','include','options','ChatInteraction','create','params','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount'];(function(_0xefabe6,_0x257db7){var _0x24e2ef=function(_0x5190b1){while(--_0x5190b1){_0xefabe6['push'](_0xefabe6['shift']());}};_0x24e2ef(++_0x257db7);}(_0x5fab,0x177));var _0xb5fa=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x5fab[_0x9307ea];return _0x295554;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var db=require(_0xb5fa('0x18'))['db'];config[_0xb5fa('0x19')]=_['defaults'](config[_0xb5fa('0x19')],{'host':_0xb5fa('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0x19')]));require('./chatInteraction.socket')[_0xb5fa('0x1b')](socket);var jayson=require(_0xb5fa('0x1c'));var client=jayson[_0xb5fa('0x1d')][_0xb5fa('0x1e')]({'port':0x232b});var client9004=jayson[_0xb5fa('0x1d')]['http']({'port':0x232c});function checkPasswordPattern(_0x567f31,_0x38e964,_0x587043){if(_0x587043){var _0x31f252=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31f252[_0xb5fa('0x1f')](_0x38e964)){return _0x567f31;}else{throw new db['Sequelize']['ValidationError'](_0xb5fa('0x20'));}}else{return _0x567f31;}}function respondWithRpcPromise(_0x1f7f05,_0x32e9e5,_0x46eef0,_0x324ba5){return new BPromise(function(_0x13e82b,_0x3b0f69){var _0x21f4f4=_0x324ba5||client;return _0x21f4f4[_0xb5fa('0x21')](_0x1f7f05,_0x46eef0)[_0xb5fa('0x22')](function(_0x3c8d53){logger[_0xb5fa('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x32e9e5,_0xb5fa('0x24'));logger['debug'](_0xb5fa('0x25'),_0x32e9e5,'request\x20sent',JSON[_0xb5fa('0x26')](_0x3c8d53));if(_0x3c8d53[_0xb5fa('0x27')]){if(_0x3c8d53['error'][_0xb5fa('0x28')]===0x1f4){logger[_0xb5fa('0x27')](_0xb5fa('0x29'),_0x32e9e5,_0x3c8d53['error'][_0xb5fa('0x2a')]);return _0x3b0f69(_0x3c8d53[_0xb5fa('0x27')][_0xb5fa('0x2a')]);}logger['error'](_0xb5fa('0x29'),_0x32e9e5,_0x3c8d53['error'][_0xb5fa('0x2a')]);return _0x13e82b(_0x3c8d53[_0xb5fa('0x27')][_0xb5fa('0x2a')]);}else{logger[_0xb5fa('0x23')](_0xb5fa('0x29'),_0x32e9e5,_0xb5fa('0x24'));_0x13e82b(_0x3c8d53[_0xb5fa('0x2b')][_0xb5fa('0x2a')]);}})['catch'](function(_0x4ec294){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x32e9e5,_0x4ec294);_0x3b0f69(_0x4ec294);});});}function respondWithStatusCode(_0x28a350,_0x460b54){_0x460b54=_0x460b54||0xcc;return function(_0x12c0d4){if(_0x12c0d4){return _0x28a350[_0xb5fa('0x2c')](_0x460b54);}return _0x28a350[_0xb5fa('0x2d')](_0x460b54)[_0xb5fa('0x2e')]();};}function respondWithResult(_0x358549,_0x353314){_0x353314=_0x353314||0xc8;return function(_0x409af9){if(_0x409af9){return _0x358549[_0xb5fa('0x2d')](_0x353314)[_0xb5fa('0x2f')](_0x409af9);}};}function respondWithFilteredResult(_0x259d21,_0xab5427){return function(_0x1f4380){if(_0x1f4380){var _0xed02e=_0x1f4380[_0xb5fa('0x30')],_0x116773=_0xab5427[_0xb5fa('0x31')],_0x5a0152=_0xab5427[_0xb5fa('0x31')]+_0xab5427[_0xb5fa('0x32')],_0x3fd1fb;if(_0x5a0152>=_0xed02e){_0x5a0152=_0xed02e;_0x3fd1fb=0xc8;}else{_0x3fd1fb=0xce;}_0x259d21[_0xb5fa('0x2d')](_0x3fd1fb);return _0x259d21[_0xb5fa('0x33')]('Content-Range',_0x116773+'-'+_0x5a0152+'/'+_0xed02e)[_0xb5fa('0x2f')](_0x1f4380);}return null;};}function patchUpdates(_0x4d056c){return function(_0x5c7fdd){try{jsonpatch['apply'](_0x5c7fdd,_0x4d056c,!![]);}catch(_0x1e6ba0){return BPromise['reject'](_0x1e6ba0);}return _0x5c7fdd[_0xb5fa('0x34')]();};}function saveUpdates(_0x5876f1,_0x5518b1){return function(_0x1847bc){if(_0x1847bc){return _0x1847bc[_0xb5fa('0x35')](_0x5876f1)['then'](function(_0x59f41d){return _0x59f41d;});}return null;};}function removeEntity(_0x3d73c2,_0x9cf63d){return function(_0x252421){if(_0x252421){return _0x252421['destroy']()[_0xb5fa('0x22')](function(){_0x3d73c2[_0xb5fa('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18398f,_0x2056de){return function(_0x204d6b){if(!_0x204d6b){_0x18398f['sendStatus'](0x194);}return _0x204d6b;};}function handleError(_0x4652cd,_0x2c950e){_0x2c950e=_0x2c950e||0x1f4;return function(_0x24ef11){logger['error'](_0x24ef11[_0xb5fa('0x36')]);if(_0x24ef11[_0xb5fa('0x37')]){delete _0x24ef11[_0xb5fa('0x37')];}_0x4652cd[_0xb5fa('0x2d')](_0x2c950e)['send'](_0x24ef11);};}function getInteractionUsers(_0x4bba91,_0x4901ad){return new BPromise(function(_0x49e786,_0x5989e1){try{if(_0x4901ad[_0x4bba91['id']]){_0x4bba91['Users']=_[_0xb5fa('0x38')](_0x4901ad[_0x4bba91['id']],function(_0x4c0a4d){return{'id':_0x4c0a4d['id'],'fullname':_0x4c0a4d[_0xb5fa('0x39')]};});}}catch(_0x3ae696){_0x5989e1(_0x3ae696);}_0x49e786(_0x4bba91);});}function getInteractionTags(_0x36db1a,_0x30b288){return new BPromise(function(_0x40c1c0,_0x269d21){try{if(_0x36db1a['TagIds']){_0x36db1a['Tags']=[];_0x36db1a['TagIds'][_0xb5fa('0x3a')](',')['forEach'](function(_0x73d425){_0x36db1a['Tags']['push'](_0x30b288[_0x73d425]);});}delete _0x36db1a[_0xb5fa('0x3b')];}catch(_0x42d331){_0x269d21(_0x42d331);}_0x40c1c0(_0x36db1a);});}function updateChatInteraction(_0x2e056e,_0x36c345,_0x5bc93f){return new BPromise(function(_0x26ef1b,_0x337c53){return getInteractionUsers(_0x2e056e,_0x5bc93f)[_0xb5fa('0x22')](function(_0x19e370){return getInteractionTags(_0x19e370,_0x36c345);})[_0xb5fa('0x22')](function(_0x5acc08){_0x26ef1b(_0x5acc08);})[_0xb5fa('0x3c')](function(_0x4bc9df){_0x337c53(_0x4bc9df);});});}exports[_0xb5fa('0x3d')]=function(_0x39aac3,_0x2c7c5f){var _0x2ef359={},_0x1c706b={},_0x3954b2={'count':0x0,'rows':[]};var _0x3414b2=_[_0xb5fa('0x38')](db['ChatInteraction'][_0xb5fa('0x3e')],function(_0xc03e44){return{'name':_0xc03e44['fieldName'],'type':_0xc03e44[_0xb5fa('0x3f')]['key']};});_0x1c706b[_0xb5fa('0x40')]=_[_0xb5fa('0x38')](_0x3414b2,'name');_0x1c706b['query']=_[_0xb5fa('0x41')](_0x39aac3[_0xb5fa('0x42')]);_0x1c706b[_0xb5fa('0x43')]=_[_0xb5fa('0x44')](_0x1c706b[_0xb5fa('0x40')],_0x1c706b[_0xb5fa('0x42')]);_0x2ef359[_0xb5fa('0x45')]=_[_0xb5fa('0x44')](_0x1c706b['model'],qs[_0xb5fa('0x46')](_0x39aac3[_0xb5fa('0x42')]['fields']));_0x2ef359[_0xb5fa('0x45')]=_0x2ef359[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x2ef359[_0xb5fa('0x45')]:_0x1c706b[_0xb5fa('0x40')];if(!_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x48')](_0xb5fa('0x49'))){_0x2ef359[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x32')]);_0x2ef359[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x31')]);}_0x2ef359['order']=qs['sort'](_0x39aac3[_0xb5fa('0x42')]['sort']);_0x2ef359[_0xb5fa('0x4a')]=qs[_0xb5fa('0x43')](_['pick'](_0x39aac3[_0xb5fa('0x42')],_0x1c706b[_0xb5fa('0x43')]),_0x3414b2);var _0x18b37c=[];var _0x3159e9=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4c')]('id')['field'](_0xb5fa('0x37'))['field'](_0xb5fa('0x4d'))[_0xb5fa('0x4e')](_0xb5fa('0x4f'));var _0x51f96a=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4c')]('u.id')['field'](_0xb5fa('0x50'))[_0xb5fa('0x4c')](_0xb5fa('0x51'))[_0xb5fa('0x4e')](_0xb5fa('0x52'),'ui')[_0xb5fa('0x53')](_0xb5fa('0x54'),'u',_0xb5fa('0x55'));var _0x1c1f1b=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4e')](_0xb5fa('0x56'),'i')[_0xb5fa('0x53')](_0xb5fa('0x57'),'c',_0xb5fa('0x58'))[_0xb5fa('0x53')](_0xb5fa('0x54'),'o',_0xb5fa('0x59'))['left_join'](_0xb5fa('0x5a'),'a',_0xb5fa('0x5b'))[_0xb5fa('0x53')](_0xb5fa('0x5c'),'me',_0xb5fa('0x5d'))[_0xb5fa('0x53')](_0xb5fa('0x5e'),'it',_0xb5fa('0x5f'))[_0xb5fa('0x53')](_0xb5fa('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x5750d0=squel[_0xb5fa('0x60')]();var _0x264732=[];var _0x1e78cb=squel['expr']();var _0x441c41;if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x61')]){_0x441c41=as[_0xb5fa('0x62')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x61')]);var _0x2e7286=_0x441c41['sqlOperator'];for(var _0x7bcd09=0x0;_0x7bcd09<_0x441c41[_0xb5fa('0x63')]['length'];_0x7bcd09++){var _0x31e602=_0x441c41[_0xb5fa('0x63')][_0x7bcd09];var _0x540295='i';var _0xd94224=_[_0xb5fa('0x64')](_0x3414b2,[_0xb5fa('0x37'),_0x31e602[_0xb5fa('0x4c')]]);if(!_0xd94224){switch(_0x31e602[_0xb5fa('0x4c')]){case _0xb5fa('0x65'):if(_0x31e602[_0xb5fa('0x66')]==0x1){_0x1c1f1b[_0xb5fa('0x67')]('`'+_0x31e602[_0xb5fa('0x4c')]+_0xb5fa('0x68'));}else{_0x1c1f1b[_0xb5fa('0x67')]('`'+_0x31e602[_0xb5fa('0x4c')]+_0xb5fa('0x69'));}break;case _0xb5fa('0x6a'):if(_0x31e602[_0xb5fa('0x6b')]===_0xb5fa('0x6c')){if(_0x31e602[_0xb5fa('0x66')][_0xb5fa('0x3a')]('\x20')[_0xb5fa('0x47')]>0x1){_0x5750d0[_0x2e7286](_0xb5fa('0x6d'),qs[_0xb5fa('0x6e')](_0x31e602[_0xb5fa('0x66')]),null);}else{var _0x488563='%'+_0x31e602[_0xb5fa('0x66')]+'%';_0x5750d0[_0x2e7286](_0xb5fa('0x6f'),_0x488563,_0x488563,_0x488563);}}else{_0xd94224=_[_0xb5fa('0x64')](_0x3414b2,['name',_0xb5fa('0x70')]);_0x31e602[_0xb5fa('0x4c')]='ContactId';_0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224[_0xb5fa('0x3f')],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value']['start'],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}break;case _0xb5fa('0x73'):var _0x57d8b7=_0x31e602[_0xb5fa('0x66')][_0xb5fa('0x3a')](',')[_0xb5fa('0x38')](function(_0x12b0a2){return Number(_0x12b0a2);});_0x57d8b7['forEach'](function(_0x55000b){_0x1e78cb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x55000b+',%');});_0x264732=_[_0xb5fa('0x74')](_0x264732,_0x57d8b7);break;case _0xb5fa('0x75'):if(_0x31e602[_0xb5fa('0x6b')]==='$substring'){_0x5750d0[_0x2e7286](_0xb5fa('0x76'),'%'+_0x31e602[_0xb5fa('0x66')]+'%',null);}else{_0xd94224=_[_0xb5fa('0x64')](_0x3414b2,[_0xb5fa('0x37'),_0xb5fa('0x77')]);_0x31e602[_0xb5fa('0x4c')]=_0xb5fa('0x77');_0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224[_0xb5fa('0x3f')],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}break;case _0xb5fa('0x79'):_0x3e90c7=as['buildExpression']('me',null,_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value'][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);break;}}else{var _0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224['type'],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value'][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}}}else{var _0x394386=_(_0x39aac3['query'])['keys']()['map'](function(_0x78a34c){return _[_0xb5fa('0x7a')](_0x3414b2,[_0xb5fa('0x37'),_0x78a34c])?_0x78a34c:undefined;})[_0xb5fa('0x7b')]()[_0xb5fa('0x66')]();if(!_[_0xb5fa('0x7c')](_0x394386)){_0x394386['forEach'](function(_0x9bf200){if(_0x9bf200==='ChatWebsiteId'){_0x1c1f1b['where'](_0xb5fa('0x7d'),[]['concat'](_0x39aac3['query'][_0x9bf200]));}else if(_0x9bf200==='createdAt'){var _0x193e63=JSON['parse'](_0x39aac3[_0xb5fa('0x42')][_0x9bf200])[_0xb5fa('0x7e')];var _0x1f05f7=JSON['parse'](_0x39aac3['query'][_0x9bf200])[_0xb5fa('0x7f')];_0x1c1f1b[_0xb5fa('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x193e63,_0x1f05f7);}else{if(_0x39aac3[_0xb5fa('0x42')][_0x9bf200]===_0xb5fa('0x80')){_0x1c1f1b[_0xb5fa('0x4a')]('i.'+_0x9bf200+_0xb5fa('0x81'));}else{_0x1c1f1b['where']('i.'+_0x9bf200+_0xb5fa('0x82'),_0x39aac3[_0xb5fa('0x42')][_0x9bf200]);}}});}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x83')]){if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x83')]==0x1){_0x1c1f1b[_0xb5fa('0x67')]('`unreadMessages`\x20=\x200');}else{_0x1c1f1b[_0xb5fa('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]){_0x264732=_['isArray'](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')])?_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]:new Array(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]);_0x264732[_0xb5fa('0x85')](function(_0x1bac54){_0x1e78cb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bac54+',%');});}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x86')]){var _0x2c5357=_0x39aac3[_0xb5fa('0x42')]['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xb5fa('0x87')](_0x2c5357)){_0x5750d0['or'](_0xb5fa('0x88'),_0x2c5357+'%');}else{_0x5750d0['or'](_0xb5fa('0x89'),qs[_0xb5fa('0x6e')](_0x2c5357))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2c5357+'%');}}}_0x1c1f1b['where'](_0x5750d0);_0x1c1f1b[_0xb5fa('0x8a')]('i.id');var _0x32eebd={'type':db[_0xb5fa('0x8b')][_0xb5fa('0x8c')][_0xb5fa('0x8d')],'raw':!![]};var _0x577aef=_0x1c1f1b[_0xb5fa('0x8e')]();_0x577aef['field'](_0xb5fa('0x8f'));_0x577aef[_0xb5fa('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x2ef359[_0xb5fa('0x90')]){_0x2ef359[_0xb5fa('0x90')][_0xb5fa('0x85')](function(_0x1bcca7){_0x1c1f1b[_0xb5fa('0x90')]('i.'+_0x1bcca7[0x0],_0x1bcca7[0x1]===_0xb5fa('0x91')?![]:!![]);});}if(!_[_0xb5fa('0x7c')](_0x264732)){_0x1c1f1b[_0xb5fa('0x67')](_0x1e78cb);_0x577aef[_0xb5fa('0x4a')](_0xb5fa('0x92'),_0x264732);}BPromise[_0xb5fa('0x93')]()[_0xb5fa('0x22')](function(){if(!_0x441c41){if(_0x39aac3[_0xb5fa('0x42')]['ChatWebsiteId']||_0x39aac3['query'][_0xb5fa('0x94')])return;_0x577aef['where'](_0xb5fa('0x95'));_0x1c1f1b[_0xb5fa('0x4a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x39aac3[_0xb5fa('0x96')][_0xb5fa('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x45afeb){if(_[_0xb5fa('0x7c')](_0x45afeb)){_0x577aef['where'](_0xb5fa('0x98'));_0x1c1f1b[_0xb5fa('0x4a')](_0xb5fa('0x98'));}else{_0x577aef['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xb5fa('0x38')](_0x45afeb,'id'));_0x1c1f1b[_0xb5fa('0x4a')](_0xb5fa('0x7d'),_[_0xb5fa('0x38')](_0x45afeb,'id'));}});})[_0xb5fa('0x22')](function(){db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x577aef[_0xb5fa('0x9a')](),_0x32eebd)[_0xb5fa('0x22')](function(_0x1a4465){_0x3954b2['count']=_0x1a4465['length'];if(_0x3954b2[_0xb5fa('0x30')]===0x0)return[];return db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x3159e9[_0xb5fa('0x9a')](),_0x32eebd)['then'](function(_0x2c93c7){_0x18b37c=_[_0xb5fa('0x9b')](_0x2c93c7,'id');_0x32eebd=_[_0xb5fa('0x9c')](_0x32eebd,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x46')]){_0x2ef359[_0xb5fa('0x45')][_0xb5fa('0x85')](function(_0x5ba2e7){_0x1c1f1b[_0xb5fa('0x4c')]('i.'+_0x5ba2e7);});}else{_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0x9d'),_0xb5fa('0x65'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0x9e'),_0xb5fa('0x9f'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa0'),_0xb5fa('0xa1'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa2'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa3'),_0xb5fa('0xa4'));_0x1c1f1b['field'](_0xb5fa('0xa5'),_0xb5fa('0xa6'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa7'),_0xb5fa('0xa8'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa9'),_0xb5fa('0xaa'));_0x1c1f1b['field']('c.mobile',_0xb5fa('0xab'));_0x1c1f1b['field']('c.fax',_0xb5fa('0xac'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xad'),'Owner.fullname');_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xae'),_0xb5fa('0xaf'));_0x1c1f1b['field'](_0xb5fa('0xb0'),_0xb5fa('0x3b'));}if(_0x2ef359['limit'])_0x1c1f1b[_0xb5fa('0x32')](_0x2ef359[_0xb5fa('0x32')]);if(_0x2ef359[_0xb5fa('0x31')])_0x1c1f1b[_0xb5fa('0x31')](_0x2ef359[_0xb5fa('0x31')]);return db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x1c1f1b['toString'](),_0x32eebd);})[_0xb5fa('0x22')](function(_0xafde6d){_0x51f96a[_0xb5fa('0x4a')](_0xb5fa('0xb1'),_['map'](_0xafde6d,'id'));return db['sequelize'][_0xb5fa('0x42')](_0x51f96a[_0xb5fa('0x9a')](),_0x32eebd)[_0xb5fa('0x22')](function(_0x1a889a){var _0x4eb5a0=_['groupBy'](_0x1a889a,'ChatInteractionId');var _0x537a51=[];_0xafde6d[_0xb5fa('0x85')](function(_0x46a651){_0x537a51[_0xb5fa('0xb2')](updateChatInteraction(_0x46a651,_0x18b37c,_0x4eb5a0));});return BPromise[_0xb5fa('0xb3')](_0x537a51);});});})[_0xb5fa('0x22')](function(_0x1a19ec){_0x3954b2[_0xb5fa('0xb4')]=_0x1a19ec;return _0x3954b2;})[_0xb5fa('0x22')](respondWithFilteredResult(_0x2c7c5f,_0x2ef359));})[_0xb5fa('0x3c')](handleError(_0x2c7c5f,null));};exports[_0xb5fa('0xb5')]=function(_0x4581ed,_0x5ce5d7){var _0x427d61={'raw':![],'where':{'id':_0x4581ed['params']['id']}},_0x2a6f66={};_0x2a6f66[_0xb5fa('0x40')]=_[_0xb5fa('0x41')](db['ChatInteraction'][_0xb5fa('0x3e')]);_0x2a6f66[_0xb5fa('0x42')]=_[_0xb5fa('0x41')](_0x4581ed[_0xb5fa('0x42')]);_0x2a6f66[_0xb5fa('0x43')]=_[_0xb5fa('0x44')](_0x2a6f66[_0xb5fa('0x40')],_0x2a6f66[_0xb5fa('0x42')]);_0x427d61[_0xb5fa('0x45')]=_['intersection'](_0x2a6f66[_0xb5fa('0x40')],qs[_0xb5fa('0x46')](_0x4581ed[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x427d61[_0xb5fa('0x45')]=_0x427d61[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x427d61[_0xb5fa('0x45')]:_0x2a6f66['model'];if(_0x4581ed[_0xb5fa('0x42')]['includeAll']){_0x427d61[_0xb5fa('0xb6')]=[{'all':!![]}];}_0x427d61=_[_0xb5fa('0x9c')]({},_0x427d61,_0x4581ed[_0xb5fa('0xb7')]);return db[_0xb5fa('0xb8')][_0xb5fa('0x64')](_0x427d61)[_0xb5fa('0x22')](handleEntityNotFound(_0x5ce5d7,null))[_0xb5fa('0x22')](respondWithResult(_0x5ce5d7,null))[_0xb5fa('0x3c')](handleError(_0x5ce5d7,null));};exports[_0xb5fa('0xb9')]=function(_0x4bb9b4,_0x49b530){return db[_0xb5fa('0xb8')][_0xb5fa('0xb9')](_0x4bb9b4[_0xb5fa('0x79')],{})[_0xb5fa('0x22')](respondWithResult(_0x49b530,0xc9))['catch'](handleError(_0x49b530,null));};exports[_0xb5fa('0x35')]=function(_0x5d1897,_0x392359){if(_0x5d1897[_0xb5fa('0x79')]['id']){delete _0x5d1897['body']['id'];}return db[_0xb5fa('0xb8')]['find']({'where':{'id':_0x5d1897[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x392359,null))[_0xb5fa('0x22')](saveUpdates(_0x5d1897[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](respondWithResult(_0x392359,null))[_0xb5fa('0x3c')](handleError(_0x392359,null));};exports[_0xb5fa('0xbb')]=function(_0x1cdb82,_0x3833cc){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x1cdb82[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x3833cc,null))['then'](removeEntity(_0x3833cc,null))[_0xb5fa('0x3c')](handleError(_0x3833cc,null));};exports[_0xb5fa('0xbc')]=function(_0x384c8e,_0x497931){return db[_0xb5fa('0xb8')][_0xb5fa('0xbc')]()[_0xb5fa('0x22')](respondWithResult(_0x497931,null))[_0xb5fa('0x3c')](handleError(_0x497931,null));};exports[_0xb5fa('0xbd')]=function(_0xa68be5,_0x22ce9f){var _0x3c5115=_0xa68be5['params']['id'];var _0x245ee1;var _0x5c1e1f;var _0x3ba723;return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x3c5115}})[_0xb5fa('0x22')](function(_0x2be44e){_0x245ee1=_0x2be44e;return db[_0xb5fa('0xbf')][_0xb5fa('0xbe')]({'where':{'id':_0x2be44e[_0xb5fa('0xc0')]},'attributes':['id',_0xb5fa('0xc1'),_0xb5fa('0xc2')],'raw':!![]});})[_0xb5fa('0x22')](function(_0x46f1d3){if(_0x46f1d3&&_0x46f1d3[_0xb5fa('0xc1')]&&_0x46f1d3[_0xb5fa('0xc2')]){_0x5c1e1f=_0x46f1d3;var _0x46af2f={'rejectUnauthorized':![],'method':_0xb5fa('0xc3'),'uri':_0xb5fa('0xc4'),'headers':{'X-APIKEY':_0x46f1d3['vidaooApiKey']},'body':{'name':_0xb5fa('0xc5')+_0x3c5115},'redirect':_0xb5fa('0xc6'),'json':!![]};return rp(_0x46af2f);}else{throw new db['Sequelize'][(_0xb5fa('0xc7'))](_0xb5fa('0xc8'));}})['then'](function(_0x4fefa0){_0x3ba723=_0x4fefa0;if(_0x3ba723['id']){var _0x486f43={'body':_0x3ba723[_0xb5fa('0xc9')],'ChatWebsiteId':_0x5c1e1f['id'],'ChatInteractionId':_0x245ee1['id'],'direction':_0xb5fa('0xca'),'UserId':_0xa68be5[_0xb5fa('0x96')]['id']};return db[_0xb5fa('0xcb')][_0xb5fa('0xb9')](_0x486f43,{});}else{throw new db[(_0xb5fa('0x8b'))][(_0xb5fa('0xc7'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x245ee1['updateAttributes']({'vidaooSessionId':_0x3ba723['id']});})[_0xb5fa('0x22')](respondWithResult(_0x22ce9f,null))['catch'](handleError(_0x22ce9f,null));};exports['customUpdate']=function(_0x2c7076,_0x5ab2ba){if(_0x2c7076[_0xb5fa('0x79')]['id']){delete _0x2c7076[_0xb5fa('0x79')]['id'];}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x2c7076[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x5ab2ba,null))[_0xb5fa('0x22')](saveUpdates(_0x2c7076[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](respondWithResult(_0x5ab2ba,null))[_0xb5fa('0x3c')](handleError(_0x5ab2ba,null));};exports[_0xb5fa('0xcc')]=function(_0x488818,_0x15b228,_0x42fd84){if(_0x488818[_0xb5fa('0x79')]['id']){delete _0x488818[_0xb5fa('0x79')]['id'];}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x488818['params']['id']}})[_0xb5fa('0x22')](function(_0x390043){if(!_0x390043){logger[_0xb5fa('0x27')](_0xb5fa('0xcd'),_0xb5fa('0xcc'),0x194,_0xb5fa('0xce'));_0x15b228[_0xb5fa('0x2c')](0x194);}else{if(_0x390043[_0xb5fa('0x77')]){throw new db[(_0xb5fa('0x8b'))][(_0xb5fa('0xc7'))](_0xb5fa('0xcf'));}}return _0x390043;})[_0xb5fa('0x22')](function(_0x1d307c){if(_0x1d307c){return _0x1d307c[_0xb5fa('0x35')]({'closed':_0x488818[_0xb5fa('0x79')][_0xb5fa('0xd0')],'disposition':_0x488818[_0xb5fa('0x79')][_0xb5fa('0xd1')]})[_0xb5fa('0x22')](function(_0x2b1c3f){return _0x2b1c3f;});}})[_0xb5fa('0x22')](function(_0x40d8e0){return respondWithRpcPromise('AbandonInteraction','abandon',_0x488818[_0xb5fa('0x79')],client9004);})[_0xb5fa('0x22')](respondWithResult(_0x15b228,null))[_0xb5fa('0x3c')](handleError(_0x15b228,null));};exports[_0xb5fa('0xd2')]=function(_0x160e9a,_0x813966,_0x549579){_0x160e9a['body']['name']=_0x160e9a[_0xb5fa('0xd3')][_0xb5fa('0xd4')];_0x160e9a['body'][_0xb5fa('0xd5')]=_0x160e9a[_0xb5fa('0xd3')]['filename'];_0x160e9a[_0xb5fa('0x79')][_0xb5fa('0x3f')]=_0x160e9a[_0xb5fa('0xd3')][_0xb5fa('0xd6')];return db[_0xb5fa('0xd7')][_0xb5fa('0xb9')](_0x160e9a[_0xb5fa('0x79')])[_0xb5fa('0x22')](respondWithResult(_0x813966,0xc9))['catch'](handleError(_0x813966,null));};exports[_0xb5fa('0xd8')]=function(_0x564c7c,_0xfb95c,_0x5bfb10){return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x564c7c['params']['id']},'raw':!![]})[_0xb5fa('0x22')](handleEntityNotFound(_0xfb95c,null))[_0xb5fa('0x22')](function(_0x3a7f29){if(_0x3a7f29){if(_0x3a7f29[_0xb5fa('0xd0')]){return _0xfb95c['status'](0x193)[_0xb5fa('0x2f')]({'status':0x193,'message':_0xb5fa('0xd9')});}return db[_0xb5fa('0xd7')][_0xb5fa('0xbe')]({'where':{'id':_0x564c7c[_0xb5fa('0x42')][_0xb5fa('0xda')]},'raw':!![]})[_0xb5fa('0x22')](handleEntityNotFound(_0xfb95c,null));}})['then'](function(_0x87f3){if(_0x87f3){return _0xfb95c['download'](path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0xdd'),_0x87f3[_0xb5fa('0xd5')]));}})[_0xb5fa('0x3c')](handleError(_0xfb95c,null));};exports[_0xb5fa('0xde')]=function(_0x34a13e,_0x591df9){var _0x496a26=null;var _0x331ff8=null;var _0x3d9563=null;var _0x419034=null;if(_0x34a13e[_0xb5fa('0x79')]['id']){delete _0x34a13e[_0xb5fa('0x79')]['id'];}if(_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')]){_0x419034=path[_0xb5fa('0xdb')](config['root'],_0xb5fa('0xe0'),util[_0xb5fa('0xe1')](_0xb5fa('0xe2'),Date[_0xb5fa('0xe3')]()));_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xe4')]=_0x419034;}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x34a13e[_0xb5fa('0xba')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xb5fa('0xe5'),'include':[{'model':db['User'],'as':_0xb5fa('0x75')}]}]})[_0xb5fa('0x22')](handleEntityNotFound(_0x591df9,null))[_0xb5fa('0x22')](saveUpdates(_0x34a13e[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](function(_0x3327bd){if(_0x3327bd){_0x496a26=_0x3327bd;return db['ChatWebsite'][_0xb5fa('0x64')]({'where':{'id':_0x496a26[_0xb5fa('0xc0')]}});}})[_0xb5fa('0x22')](function(_0x327f35){if(_0x327f35){_0x3d9563=_0x327f35;return db[_0xb5fa('0xe6')][_0xb5fa('0x64')]({'where':{'id':_0x496a26[_0xb5fa('0x70')]}});}})['then'](function(_0x5d0e21){if(_0x5d0e21){_0x331ff8=_0x5d0e21;if(_0x419034){var _0x405677=null;for(var _0x3a8dad=0x1;_0x3a8dad<_0x496a26[_0xb5fa('0xe5')][_0xb5fa('0x47')];++_0x3a8dad){_0x405677=_0x496a26[_0xb5fa('0xe5')][_0x3a8dad];var _0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563[_0xb5fa('0xe8')],_0x405677['UserId']):_0xb5fa('0xe9');var _0x2dec50=_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xea')]||util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0xb5fa('0xeb'),_0x405677[_0xb5fa('0x70')]);switch(_0x3d9563[_0xb5fa('0xec')]){case _0xb5fa('0xed'):_0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563[_0xb5fa('0xe8')],_0x405677['UserId']):'System';break;case _0xb5fa('0xee'):_0x38f750=_0x405677[_0xb5fa('0x77')]?_0x405677['User'][_0xb5fa('0xef')]||_0x405677[_0xb5fa('0x75')][_0xb5fa('0x39')]:'System';break;case _0xb5fa('0xf0'):_0x38f750=_0x405677[_0xb5fa('0x77')]?_0x405677[_0xb5fa('0x75')][_0xb5fa('0x39')]:_0xb5fa('0xe9');break;default:_0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563['agentAlias'],_0x405677[_0xb5fa('0x77')]):_0xb5fa('0xe9');}var _0x4da81b=util[_0xb5fa('0xe1')](_0xb5fa('0xf1'),moment(_0x405677['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0xf2')),_0x405677[_0xb5fa('0xf3')]==='in'?_0x2dec50:_0x38f750,_0x405677[_0xb5fa('0x79')]);if(!_0x405677[_0xb5fa('0xf4')]){fs[_0xb5fa('0xf5')](_0x419034,_0x4da81b);}}return db[_0xb5fa('0xf6')][_0xb5fa('0xbe')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb5fa('0xf7'),'raw':!![]}]});}}})[_0xb5fa('0x22')](function(_0x2d49e4){if(_0x2d49e4&&_0x2d49e4[_0xb5fa('0xf7')]&&_0x34a13e[_0xb5fa('0x79')]){var _0x486620={'tls':{'rejectUnauthorized':![]}};if(_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xf8')]){_0x486620[_0xb5fa('0xf8')]=_0x2d49e4['Smtp'][_0xb5fa('0xf8')];}else{_0x486620[_0xb5fa('0xf9')]=_0x2d49e4[_0xb5fa('0xf7')]['host'];_0x486620[_0xb5fa('0xfa')]=_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfa')];_0x486620[_0xb5fa('0xfb')]=_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfb')];}if(_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfc')]){_0x486620[_0xb5fa('0xfd')]={'user':_0x2d49e4['Smtp'][_0xb5fa('0x96')],'pass':_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfe')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x486620,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2d49e4['name'],_0x2d49e4[_0xb5fa('0xff')]||_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0x96')]),'to':_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')],'subject':_0xb5fa('0x100'),'text':util[_0xb5fa('0xe1')](_0xb5fa('0x101'),_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')]),'attachments':[{'path':_0x419034}]}})['then'](function(){return _0x496a26;})['catch'](function(_0x41c680){console[_0xb5fa('0x27')](_0x41c680);});}else{return _0x496a26;}})[_0xb5fa('0x22')](respondWithStatusCode(_0x591df9,0xc8))['catch'](handleError(_0x591df9,null));};exports['addMessage']=function(_0x3d0a9d,_0x33f6f5,_0x326014){return db[_0xb5fa('0xcb')][_0xb5fa('0x64')]({'where':{'id':_0x3d0a9d[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x33f6f5,null))[_0xb5fa('0x22')](function(_0x286862){if(_0x286862){return _0x286862['addMessage'](_0x3d0a9d[_0xb5fa('0x79')][_0xb5fa('0x102')],_[_0xb5fa('0x103')](_0x3d0a9d[_0xb5fa('0x79')],[_0xb5fa('0x102'),'id'])||{});}})[_0xb5fa('0x22')](respondWithResult(_0x33f6f5,null))[_0xb5fa('0x3c')](handleError(_0x33f6f5,null));};exports[_0xb5fa('0x104')]=function(_0x52481f,_0x187456,_0x1845f3){var _0x55da0a={'raw':![],'where':{}};var _0x510ce8={};var _0x2a87ec={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb5fa('0xbe')]({'where':{'id':_0x52481f[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x187456,null))[_0xb5fa('0x22')](function(_0xa7da23){if(_0xa7da23){_0x510ce8[_0xb5fa('0x40')]=_[_0xb5fa('0x41')](db[_0xb5fa('0xcb')]['rawAttributes']);_0x510ce8[_0xb5fa('0x42')]=_[_0xb5fa('0x41')](_0x52481f[_0xb5fa('0x42')]);_0x510ce8[_0xb5fa('0x43')]=_['intersection'](_0x510ce8[_0xb5fa('0x40')],_0x510ce8[_0xb5fa('0x42')]);_0x55da0a['attributes']=_[_0xb5fa('0x44')](_0x510ce8[_0xb5fa('0x40')],qs['fields'](_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x55da0a['attributes']=_0x55da0a[_0xb5fa('0x45')]['length']?_0x55da0a['attributes']:_0x510ce8[_0xb5fa('0x40')];if(!_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x48')](_0xb5fa('0x49'))){_0x55da0a[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x52481f[_0xb5fa('0x42')]['limit']);_0x55da0a[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x52481f['query']['offset']);}_0x55da0a[_0xb5fa('0x90')]=qs[_0xb5fa('0x105')](_0x52481f[_0xb5fa('0x42')]['sort']);_0x55da0a[_0xb5fa('0x4a')]=qs['filters'](_[_0xb5fa('0x106')](_0x52481f['query'],_0x510ce8[_0xb5fa('0x43')]));_0x55da0a[_0xb5fa('0x4a')][_0xb5fa('0x107')]=_0xa7da23['id'];if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x86')]){_0x55da0a[_0xb5fa('0x4a')]=_[_0xb5fa('0x9c')](_0x55da0a['where'],{'$or':_[_0xb5fa('0x38')](_0x55da0a[_0xb5fa('0x45')],function(_0x55a03d){var _0x39d8f3={};_0x39d8f3[_0x55a03d]={'$like':'%'+_0x52481f['query'][_0xb5fa('0x86')]+'%'};return _0x39d8f3;})});}if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x7e')]){var _0x165b0a=_0x52481f['query'][_0xb5fa('0x7e')]['split'](',');var _0xc6b700={};_0xc6b700[_0x165b0a[0x0]]={'$gte':moment(_0x165b0a[0x1])[_0xb5fa('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55da0a[_0xb5fa('0x4a')]=_[_0xb5fa('0x9c')](_0x55da0a[_0xb5fa('0x4a')],_0xc6b700);}_0x55da0a=_[_0xb5fa('0x9c')]({},_0x55da0a,_0x52481f[_0xb5fa('0xb7')]);return db['ChatMessage'][_0xb5fa('0x30')]({'where':_0x55da0a['where']})[_0xb5fa('0x22')](function(_0x1789d1){_0x2a87ec['count']=_0x1789d1;if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x108')]){_0x55da0a['include']=[{'all':!![]}];}return db['ChatMessage'][_0xb5fa('0x109')](_0x55da0a);})[_0xb5fa('0x22')](function(_0x2ef70d){_0x2a87ec[_0xb5fa('0xb4')]=_0x2ef70d;return _0x2a87ec;});}})[_0xb5fa('0x22')](respondWithFilteredResult(_0x187456,_0x55da0a))[_0xb5fa('0x3c')](handleError(_0x187456,null));};exports[_0xb5fa('0x10a')]=function(_0x1f0cec,_0x5dbfd7,_0x2eff56){var _0x4d65e2={'where':{}},_0x51f050={},_0x4a2254={'count':0x0,'rows':[]};return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x1f0cec['params']['id']}})['then'](handleEntityNotFound(_0x5dbfd7,null))['then'](function(_0x5ae447){if(_0x5ae447){_0x51f050[_0xb5fa('0x40')]=_['keys'](db[_0xb5fa('0xcb')][_0xb5fa('0x3e')]);_0x51f050[_0xb5fa('0x42')]=_['keys'](_0x1f0cec[_0xb5fa('0x42')]);_0x51f050[_0xb5fa('0x43')]=_['intersection'](_0x51f050[_0xb5fa('0x40')],_0x51f050[_0xb5fa('0x42')]);_0x4d65e2['attributes']=_['intersection'](_0x51f050['model'],qs[_0xb5fa('0x46')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x4d65e2['attributes']=_0x4d65e2[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x4d65e2[_0xb5fa('0x45')]:_0x51f050[_0xb5fa('0x40')];if(!_0x1f0cec[_0xb5fa('0x42')]['hasOwnProperty'](_0xb5fa('0x49'))){_0x4d65e2['limit']=qs[_0xb5fa('0x32')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x32')]);_0x4d65e2[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x31')]);}_0x4d65e2[_0xb5fa('0x90')]=qs[_0xb5fa('0x105')](_0x1f0cec['query']['sort']);_0x4d65e2[_0xb5fa('0x4a')]=qs[_0xb5fa('0x43')](_['pick'](_0x1f0cec[_0xb5fa('0x42')],_0x51f050[_0xb5fa('0x43')]));_0x4d65e2['where'][_0xb5fa('0x107')]=_0x5ae447['id'];if(_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x86')]){_0x4d65e2['where']=_[_0xb5fa('0x9c')](_0x4d65e2[_0xb5fa('0x4a')],{'$or':_[_0xb5fa('0x38')](_0x4d65e2[_0xb5fa('0x45')],function(_0x268913){var _0x53e713={};_0x53e713[_0x268913]={'$like':'%'+_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x86')]+'%'};return _0x53e713;})});}_0x4d65e2[_0xb5fa('0x4a')][_0xb5fa('0xf4')]=![];if(_0x1f0cec[_0xb5fa('0x42')]['id']){_0x4d65e2['where']['id']={'$gt':_0x1f0cec['query']['id']};}_0x4d65e2=_[_0xb5fa('0x9c')]({},_0x4d65e2,_0x1f0cec[_0xb5fa('0xb7')]);return db[_0xb5fa('0xcb')][_0xb5fa('0x30')]({'where':_0x4d65e2[_0xb5fa('0x4a')]})['then'](function(_0x5adaa2){_0x4a2254['count']=_0x5adaa2;_0x4d65e2[_0xb5fa('0xb6')]=[];if(_0x1f0cec[_0xb5fa('0x42')]['includeAgent']){_0x4d65e2[_0xb5fa('0xb6')][_0xb5fa('0xb2')]({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x75'),'attributes':['id',_0xb5fa('0x39'),'alias']});}if(_0x1f0cec[_0xb5fa('0x42')]['includeAll']){_0x4d65e2[_0xb5fa('0xb6')]=[{'all':!![]}];}return db[_0xb5fa('0xcb')][_0xb5fa('0x109')](_0x4d65e2);})[_0xb5fa('0x22')](function(_0x1db92b){_0x4a2254[_0xb5fa('0xb4')]=_0x1db92b;return _0x4a2254;});}})[_0xb5fa('0x22')](respondWithFilteredResult(_0x5dbfd7,_0x4d65e2))[_0xb5fa('0x3c')](handleError(_0x5dbfd7,null));};exports[_0xb5fa('0x10b')]=function(_0x497465,_0x268f7e,_0x7a3bd4){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x497465['params']['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x268f7e,null))[_0xb5fa('0x22')](function(_0x48ca4b){if(_0x48ca4b){return _0x48ca4b['setTags'](_0x497465[_0xb5fa('0x79')][_0xb5fa('0x102')],_['omit'](_0x497465['body'],[_0xb5fa('0x102'),'id'])||{})[_0xb5fa('0x10c')](function(){return db[_0xb5fa('0x73')][_0xb5fa('0x109')]({'attributes':['id',_0xb5fa('0x37'),'color'],'where':{'id':_0x497465['body'][_0xb5fa('0x102')]}});})['then'](function(_0x2593ba){socket['emit'](_0xb5fa('0x10d'),{'id':Number(_0x497465[_0xb5fa('0xba')]['id']),'tags':_0x2593ba||[]});return{'id':Number(_0x497465['params']['id']),'tags':_0x2593ba||[]};});}})['then'](respondWithResult(_0x268f7e,null))[_0xb5fa('0x3c')](handleError(_0x268f7e,null));};exports['removeTags']=function(_0x2429ef,_0x315488,_0x49f3a0){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x2429ef[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x315488,null))[_0xb5fa('0x22')](function(_0x1c77f7){if(_0x1c77f7){return _0x1c77f7['removeTags'](_0x2429ef[_0xb5fa('0x42')][_0xb5fa('0x102')]);}})[_0xb5fa('0x22')](respondWithStatusCode(_0x315488,null))[_0xb5fa('0x3c')](handleError(_0x315488,null));};exports[_0xb5fa('0x10e')]=function(_0x117bd1,_0x41f06c){var _0x1f164f=moment()[_0xb5fa('0x10f')]()[_0xb5fa('0x9a')]();var _0x2dd8fe=path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0x110'),_0xb5fa('0x111'),_0xb5fa('0x112'));var _0x449807=path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0x110'),_0xb5fa('0x111'),_0xb5fa('0x113'));var _0x3e1d20=path[_0xb5fa('0xdb')](_0x2dd8fe,_0x1f164f);var _0x58907b=util[_0xb5fa('0xe1')](_0xb5fa('0x114'),_0x117bd1[_0xb5fa('0xba')]['id'],_0x1f164f);var _0x74e62a=path[_0xb5fa('0xdb')](_0x2dd8fe,_0x58907b);var _0x31646a=[];_0x31646a['push']({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x75'),'attributes':['id',_0xb5fa('0x39')],'raw':!![]});_0x31646a[_0xb5fa('0xb2')]({'model':db[_0xb5fa('0xe6')],'as':_0xb5fa('0x6a'),'attributes':['id',_0xb5fa('0x115'),_0xb5fa('0x116')],'raw':!![]});if(_0x117bd1[_0xb5fa('0x42')][_0xb5fa('0x113')]){_0x31646a[_0xb5fa('0xb2')]({'model':db['Attachment'],'as':_0xb5fa('0xd7'),'raw':!![]});}var _0x1f90aa=[{'model':db[_0xb5fa('0xcb')],'as':_0xb5fa('0xe5'),'attributes':['id','body',_0xb5fa('0x117'),'direction',_0xb5fa('0xf4'),'read'],'include':_0x31646a}];_0x1f90aa['push']({'model':db[_0xb5fa('0xbf')],'as':_0xb5fa('0x118'),'attributes':['id',_0xb5fa('0x37')]});_0x1f90aa[_0xb5fa('0xb2')]({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x119'),'attributes':['id',_0xb5fa('0x39')]});return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x117bd1[_0xb5fa('0xba')]['id']},'include':_0x1f90aa})['then'](handleEntityNotFound(_0x41f06c,null))[_0xb5fa('0x22')](function(_0x492dfe){if(_0x492dfe){var _0x37132c=_0x492dfe[_0xb5fa('0x11a')]({'plain':!![]});fs[_0xb5fa('0x11b')](_0x3e1d20);var _0x324e9c={'format':'A4','border':_0xb5fa('0x11c'),'header':{'height':_0xb5fa('0x11d'),'contents':{'first':_0xb5fa('0x11e')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xb5fa('0x11f'),util[_0xb5fa('0xe1')](_0xb5fa('0x120'),_0xb5fa('0x121'),_0x37132c['id']),moment()[_0xb5fa('0xe1')](_0xb5fa('0x122'))['toString']())}}};var _0x42195b={'channel':_0xb5fa('0x121'),'account':_0x37132c[_0xb5fa('0x118')][_0xb5fa('0x37')],'agent':_0x37132c['Owner']?_0x37132c[_0xb5fa('0x119')][_0xb5fa('0x39')]:_0xb5fa('0x123'),'createdAt':moment(_0x37132c['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')](),'closedAt':_0x37132c['closed']?moment(_0x37132c[_0xb5fa('0x125')])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')]():'','disposition':_0x37132c[_0xb5fa('0xd1')],'chatInfo':{'browser':_0x37132c[_0xb5fa('0x126')],'os':_0x37132c[_0xb5fa('0x127')],'referer':_0x37132c[_0xb5fa('0x128')],'customerIp':_0x37132c['customerIp'],'customerPort':_0x37132c[_0xb5fa('0x129')]?_0x37132c[_0xb5fa('0x129')]:_0xb5fa('0x123')},'messages':_(_0x37132c[_0xb5fa('0xe5')])[_0xb5fa('0x12a')]()[_0xb5fa('0x86')]({'secret':![]})['map'](function(_0x11f9e8){if(_0x11f9e8[_0xb5fa('0xd7')]){var _0x4ba538=path[_0xb5fa('0xdb')](_0x449807,_0x11f9e8[_0xb5fa('0xd7')][_0xb5fa('0xd5')]);if(fs[_0xb5fa('0x12b')](_0x4ba538)){fs[_0xb5fa('0x12c')](_0x4ba538)[_0xb5fa('0x12d')](fs[_0xb5fa('0x12e')](path[_0xb5fa('0xdb')](_0x3e1d20,_0x11f9e8['Attachment']['basename'])));}}return{'date':moment(_0x11f9e8['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')](),'sender':_0x11f9e8[_0xb5fa('0xf3')]==='out'?_0x11f9e8[_0xb5fa('0x75')]?_0x11f9e8[_0xb5fa('0x75')]['fullname']:_0xb5fa('0xe9'):_0x11f9e8[_0xb5fa('0x6a')][_0xb5fa('0x115')]+(_0x11f9e8['Contact']['lastName']?'\x20'+_0x11f9e8['Contact'][_0xb5fa('0x116')]:''),'body':_0x11f9e8[_0xb5fa('0xd7')]?_0x11f9e8[_0xb5fa('0xd7')]['basename']:_0x11f9e8[_0xb5fa('0x79')],'direction':_0x11f9e8['direction']===_0xb5fa('0xca')?'A':'C','secret':_0x11f9e8[_0xb5fa('0xf4')],'read':_0x11f9e8['read'],'attachment':_0x11f9e8[_0xb5fa('0xd7')]};})[_0xb5fa('0x66')]()};return ejs[_0xb5fa('0x12f')](path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],'server',_0xb5fa('0x130'),_0xb5fa('0x131')),{'interaction':_0x42195b})[_0xb5fa('0x22')](function(_0x1f3c01){return new BPromise(function(_0xb5561b,_0xbd3013){pdf[_0xb5fa('0xb9')](_0x1f3c01,_0x324e9c)[_0xb5fa('0x132')](path[_0xb5fa('0xdb')](_0x3e1d20,'transcript-'+_0x37132c['id']+'-'+_0x1f164f+_0xb5fa('0x133')),function(_0x25a3a1,_0x21df98){if(_0x25a3a1)return _0xbd3013(_0x25a3a1);_0xb5561b(_0x21df98);});});})[_0xb5fa('0x22')](function(){return new BPromise(function(_0x46e0b3,_0xebcda7){zipdir(_0x3e1d20,{'saveTo':_0x74e62a},function(_0x5e6be6,_0x5daeba){if(_0x5e6be6)return _0xebcda7(_0x5e6be6);return _0x46e0b3(_0x5daeba);});})[_0xb5fa('0x22')](function(){return new BPromise(function(_0x593cc7,_0x51c15b){rimraf(_0x3e1d20,function(_0x5a8104){if(_0x5a8104)_0x51c15b(_0x5a8104);return _0x593cc7();});});})[_0xb5fa('0x22')](function(){return _0x41f06c[_0xb5fa('0x10e')](_0x74e62a,_0x58907b,function(_0x2ac2c1){if(_0x2ac2c1){console[_0xb5fa('0x134')](_0xb5fa('0x135'),_0x2ac2c1);}else{fs[_0xb5fa('0x136')](_0x74e62a);}});});});}else{return _0x41f06c[_0xb5fa('0x2c')](0xc8);}})[_0xb5fa('0x3c')](handleError(_0x41f06c,null));}; \ No newline at end of file +var _0x1967=['service','host','port','secure','authentication','auth','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','omit','ids','getMessages','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','secret','includeAgent','include','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','Contact','firstName','Account','Owner','get','mkdirSync','40px','30px','YYYY-MM-DD','Chat','N.A.','closedAt','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','sendStatus','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','./chatInteraction.socket','register','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','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s','message','info','catch','status','json','count','offset','limit','set','Content-Range','save','then','end','stack','name','send','Users','fullname','TagIds','split','forEach','push','ChatInteraction','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','keys','map','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','includeAll','create','body','update','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','Error\x20in\x20Vidaoo\x20configuration','out','user','ChatMessage','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','basename','close','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','format','Visitor','website_alias','alias','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp'];(function(_0x2b9120,_0x4cba82){var _0x459db0=function(_0x5753b5){while(--_0x5753b5){_0x2b9120['push'](_0x2b9120['shift']());}};_0x459db0(++_0x4cba82);}(_0x1967,0x173));var _0x7196=function(_0x431b8e,_0x5025ed){_0x431b8e=_0x431b8e-0x0;var _0x4a5cea=_0x1967[_0x431b8e];return _0x4a5cea;};'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);var jayson=require(_0x7196('0x20'));var client=jayson[_0x7196('0x21')]['http']({'port':0x232b});var client9004=jayson[_0x7196('0x21')]['http']({'port':0x232c});function checkPasswordPattern(_0xe32933,_0x2590a6,_0xf7e97){if(_0xf7e97){var _0x3ed1ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ed1ad[_0x7196('0x22')](_0x2590a6)){return _0xe32933;}else{throw new db[(_0x7196('0x23'))][(_0x7196('0x24'))](_0x7196('0x25'));}}else{return _0xe32933;}}function respondWithRpcPromise(_0x3e4e69,_0x32fe2b,_0x385f2d,_0x5b716a){return new BPromise(function(_0x4c4f91,_0x448f13){var _0x26b447=_0x5b716a||client;return _0x26b447[_0x7196('0x26')](_0x3e4e69,_0x385f2d)['then'](function(_0x39b944){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x32fe2b,_0x7196('0x27'));logger[_0x7196('0x28')](_0x7196('0x29'),_0x32fe2b,'request\x20sent',JSON['stringify'](_0x39b944));if(_0x39b944[_0x7196('0x2a')]){if(_0x39b944[_0x7196('0x2a')]['code']===0x1f4){logger[_0x7196('0x2a')](_0x7196('0x2b'),_0x32fe2b,_0x39b944[_0x7196('0x2a')][_0x7196('0x2c')]);return _0x448f13(_0x39b944[_0x7196('0x2a')]['message']);}logger[_0x7196('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x32fe2b,_0x39b944[_0x7196('0x2a')][_0x7196('0x2c')]);return _0x4c4f91(_0x39b944[_0x7196('0x2a')][_0x7196('0x2c')]);}else{logger[_0x7196('0x2d')](_0x7196('0x2b'),_0x32fe2b,'request\x20sent');_0x4c4f91(_0x39b944['result'][_0x7196('0x2c')]);}})[_0x7196('0x2e')](function(_0x184c09){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x32fe2b,_0x184c09);_0x448f13(_0x184c09);});});}function respondWithStatusCode(_0x41cfd2,_0x162cfc){_0x162cfc=_0x162cfc||0xcc;return function(_0x675e64){if(_0x675e64){return _0x41cfd2['sendStatus'](_0x162cfc);}return _0x41cfd2[_0x7196('0x2f')](_0x162cfc)['end']();};}function respondWithResult(_0x4fd339,_0x59d79d){_0x59d79d=_0x59d79d||0xc8;return function(_0x30151f){if(_0x30151f){return _0x4fd339[_0x7196('0x2f')](_0x59d79d)[_0x7196('0x30')](_0x30151f);}};}function respondWithFilteredResult(_0x4f02b1,_0x35116f){return function(_0x45d567){if(_0x45d567){var _0x2f9583=_0x45d567[_0x7196('0x31')],_0xf999e9=_0x35116f[_0x7196('0x32')],_0x50c386=_0x35116f[_0x7196('0x32')]+_0x35116f[_0x7196('0x33')],_0x39710d;if(_0x50c386>=_0x2f9583){_0x50c386=_0x2f9583;_0x39710d=0xc8;}else{_0x39710d=0xce;}_0x4f02b1[_0x7196('0x2f')](_0x39710d);return _0x4f02b1[_0x7196('0x34')](_0x7196('0x35'),_0xf999e9+'-'+_0x50c386+'/'+_0x2f9583)[_0x7196('0x30')](_0x45d567);}return null;};}function patchUpdates(_0xf33b59){return function(_0x1ff4b4){try{jsonpatch['apply'](_0x1ff4b4,_0xf33b59,!![]);}catch(_0xdf8aa){return BPromise['reject'](_0xdf8aa);}return _0x1ff4b4[_0x7196('0x36')]();};}function saveUpdates(_0x4c3365,_0x372ddc){return function(_0x25fa11){if(_0x25fa11){return _0x25fa11['update'](_0x4c3365)[_0x7196('0x37')](function(_0x2bcadd){return _0x2bcadd;});}return null;};}function removeEntity(_0x4531d7,_0x3a56b4){return function(_0x7547cf){if(_0x7547cf){return _0x7547cf['destroy']()[_0x7196('0x37')](function(){_0x4531d7[_0x7196('0x2f')](0xcc)[_0x7196('0x38')]();});}};}function handleEntityNotFound(_0xf2b652,_0x3e8f98){return function(_0x123cad){if(!_0x123cad){_0xf2b652['sendStatus'](0x194);}return _0x123cad;};}function handleError(_0x23d7aa,_0xe04e44){_0xe04e44=_0xe04e44||0x1f4;return function(_0x191df2){logger['error'](_0x191df2[_0x7196('0x39')]);if(_0x191df2[_0x7196('0x3a')]){delete _0x191df2[_0x7196('0x3a')];}_0x23d7aa[_0x7196('0x2f')](_0xe04e44)[_0x7196('0x3b')](_0x191df2);};}function getInteractionUsers(_0x31fca7,_0x938e49){return new BPromise(function(_0x1ab720,_0x92cfb1){try{if(_0x938e49[_0x31fca7['id']]){_0x31fca7[_0x7196('0x3c')]=_['map'](_0x938e49[_0x31fca7['id']],function(_0x257754){return{'id':_0x257754['id'],'fullname':_0x257754[_0x7196('0x3d')]};});}}catch(_0x4c411b){_0x92cfb1(_0x4c411b);}_0x1ab720(_0x31fca7);});}function getInteractionTags(_0x186efe,_0x54767f){return new BPromise(function(_0x5bd701,_0x301c42){try{if(_0x186efe[_0x7196('0x3e')]){_0x186efe['Tags']=[];_0x186efe['TagIds'][_0x7196('0x3f')](',')[_0x7196('0x40')](function(_0xed32cd){_0x186efe['Tags'][_0x7196('0x41')](_0x54767f[_0xed32cd]);});}delete _0x186efe[_0x7196('0x3e')];}catch(_0x29ba1c){_0x301c42(_0x29ba1c);}_0x5bd701(_0x186efe);});}function updateChatInteraction(_0x29c58d,_0x16da09,_0x428d76){return new BPromise(function(_0xc94d24,_0x440077){return getInteractionUsers(_0x29c58d,_0x428d76)['then'](function(_0x89c8ea){return getInteractionTags(_0x89c8ea,_0x16da09);})[_0x7196('0x37')](function(_0x4f8b4a){_0xc94d24(_0x4f8b4a);})[_0x7196('0x2e')](function(_0x43d4c0){_0x440077(_0x43d4c0);});});}exports['index']=function(_0x471915,_0x471bb2){var _0x3b78c8={},_0x5749e2={},_0x455fea={'count':0x0,'rows':[]};var _0x4713d3=_['map'](db[_0x7196('0x42')][_0x7196('0x43')],function(_0x4f0c6c){return{'name':_0x4f0c6c[_0x7196('0x44')],'type':_0x4f0c6c['type']['key']};});_0x5749e2['model']=_['map'](_0x4713d3,'name');_0x5749e2[_0x7196('0x45')]=_['keys'](_0x471915[_0x7196('0x45')]);_0x5749e2[_0x7196('0x46')]=_[_0x7196('0x47')](_0x5749e2[_0x7196('0x48')],_0x5749e2['query']);_0x3b78c8[_0x7196('0x49')]=_['intersection'](_0x5749e2[_0x7196('0x48')],qs[_0x7196('0x4a')](_0x471915[_0x7196('0x45')]['fields']));_0x3b78c8[_0x7196('0x49')]=_0x3b78c8[_0x7196('0x49')][_0x7196('0x4b')]?_0x3b78c8['attributes']:_0x5749e2['model'];if(!_0x471915[_0x7196('0x45')]['hasOwnProperty'](_0x7196('0x4c'))){_0x3b78c8['limit']=qs['limit'](_0x471915[_0x7196('0x45')]['limit']);_0x3b78c8['offset']=qs['offset'](_0x471915[_0x7196('0x45')]['offset']);}_0x3b78c8['order']=qs[_0x7196('0x4d')](_0x471915[_0x7196('0x45')][_0x7196('0x4d')]);_0x3b78c8[_0x7196('0x4e')]=qs['filters'](_[_0x7196('0x4f')](_0x471915['query'],_0x5749e2[_0x7196('0x46')]),_0x4713d3);var _0x143c58=[];var _0x513855=squel[_0x7196('0x50')]()[_0x7196('0x51')]('id')[_0x7196('0x51')]('name')[_0x7196('0x51')]('color')[_0x7196('0x52')](_0x7196('0x53'));var _0x179815=squel[_0x7196('0x50')]()[_0x7196('0x51')](_0x7196('0x54'))[_0x7196('0x51')](_0x7196('0x55'))['field']('ui.ChatInteractionId')[_0x7196('0x52')](_0x7196('0x56'),'ui')[_0x7196('0x57')](_0x7196('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x76b189=squel[_0x7196('0x50')]()[_0x7196('0x52')](_0x7196('0x59'),'i')[_0x7196('0x57')](_0x7196('0x5a'),'c',_0x7196('0x5b'))[_0x7196('0x57')](_0x7196('0x58'),'o',_0x7196('0x5c'))[_0x7196('0x57')]('chat_websites','a',_0x7196('0x5d'))[_0x7196('0x57')](_0x7196('0x5e'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x7196('0x57')]('chat_interaction_has_tags','it',_0x7196('0x5f'))[_0x7196('0x57')](_0x7196('0x53'),'t',_0x7196('0x60'));var _0x469bac=squel['expr']();var _0x3ece9f=[];var _0x5b77fc=squel['expr']();var _0x5b9824;if(_0x471915[_0x7196('0x45')][_0x7196('0x61')]){_0x5b9824=as[_0x7196('0x62')](_0x471915[_0x7196('0x45')][_0x7196('0x61')]);var _0x41fa94=_0x5b9824[_0x7196('0x63')];for(var _0x560ddb=0x0;_0x560ddb<_0x5b9824[_0x7196('0x64')][_0x7196('0x4b')];_0x560ddb++){var _0x2d14f4=_0x5b9824[_0x7196('0x64')][_0x560ddb];var _0x196f12='i';var _0x5ef1eb=_['find'](_0x4713d3,[_0x7196('0x3a'),_0x2d14f4[_0x7196('0x51')]]);if(!_0x5ef1eb){switch(_0x2d14f4[_0x7196('0x51')]){case _0x7196('0x65'):if(_0x2d14f4[_0x7196('0x66')]==0x1){_0x76b189[_0x7196('0x67')]('`'+_0x2d14f4[_0x7196('0x51')]+_0x7196('0x68'));}else{_0x76b189[_0x7196('0x67')]('`'+_0x2d14f4[_0x7196('0x51')]+_0x7196('0x69'));}break;case'Contact':if(_0x2d14f4[_0x7196('0x6a')]===_0x7196('0x6b')){if(_0x2d14f4[_0x7196('0x66')][_0x7196('0x3f')]('\x20')['length']>0x1){_0x469bac[_0x41fa94](_0x7196('0x6c'),qs[_0x7196('0x6d')](_0x2d14f4[_0x7196('0x66')]),null);}else{var _0x38d0a0='%'+_0x2d14f4[_0x7196('0x66')]+'%';_0x469bac[_0x41fa94](_0x7196('0x6e'),_0x38d0a0,_0x38d0a0,_0x38d0a0);}}else{_0x5ef1eb=_[_0x7196('0x6f')](_0x4713d3,['name',_0x7196('0x70')]);_0x2d14f4[_0x7196('0x51')]=_0x7196('0x70');_0x74fa58=as[_0x7196('0x71')](_0x196f12,_0x5ef1eb['type'],_0x2d14f4);_0x469bac[_0x41fa94](_0x74fa58[_0x7196('0x72')],_0x74fa58[_0x7196('0x66')][_0x7196('0x73')],_0x74fa58[_0x7196('0x66')][_0x7196('0x38')]);}break;case _0x7196('0x74'):var _0x57065=_0x2d14f4['value']['split'](',')['map'](function(_0x72f6f1){return Number(_0x72f6f1);});_0x57065['forEach'](function(_0xd94bd1){_0x5b77fc['or'](_0x7196('0x75'),'%,'+_0xd94bd1+',%');});_0x3ece9f=_[_0x7196('0x76')](_0x3ece9f,_0x57065);break;case _0x7196('0x77'):if(_0x2d14f4[_0x7196('0x6a')]===_0x7196('0x6b')){_0x469bac[_0x41fa94](_0x7196('0x78'),'%'+_0x2d14f4[_0x7196('0x66')]+'%',null);}else{_0x5ef1eb=_[_0x7196('0x6f')](_0x4713d3,['name','UserId']);_0x2d14f4[_0x7196('0x51')]=_0x7196('0x79');_0x74fa58=as[_0x7196('0x71')](_0x196f12,_0x5ef1eb[_0x7196('0x7a')],_0x2d14f4);_0x469bac[_0x41fa94](_0x74fa58[_0x7196('0x72')],_0x74fa58[_0x7196('0x66')][_0x7196('0x73')],_0x74fa58[_0x7196('0x66')]['end']);}break;case'body':_0x74fa58=as[_0x7196('0x71')]('me',null,_0x2d14f4);_0x469bac[_0x41fa94](_0x74fa58['text'],_0x74fa58[_0x7196('0x66')]['start'],_0x74fa58[_0x7196('0x66')][_0x7196('0x38')]);break;}}else{var _0x74fa58=as[_0x7196('0x71')](_0x196f12,_0x5ef1eb['type'],_0x2d14f4);_0x469bac[_0x41fa94](_0x74fa58['text'],_0x74fa58[_0x7196('0x66')]['start'],_0x74fa58[_0x7196('0x66')][_0x7196('0x38')]);}}}else{var _0x4526e8=_(_0x471915[_0x7196('0x45')])[_0x7196('0x7b')]()[_0x7196('0x7c')](function(_0x4bb3e1){return _[_0x7196('0x7d')](_0x4713d3,[_0x7196('0x3a'),_0x4bb3e1])?_0x4bb3e1:undefined;})[_0x7196('0x7e')]()[_0x7196('0x66')]();if(!_[_0x7196('0x7f')](_0x4526e8)){_0x4526e8[_0x7196('0x40')](function(_0x187ad4){if(_0x187ad4===_0x7196('0x80')){_0x76b189[_0x7196('0x4e')](_0x7196('0x81'),[][_0x7196('0x82')](_0x471915[_0x7196('0x45')][_0x187ad4]));}else if(_0x187ad4==='createdAt'){var _0x431415=JSON[_0x7196('0x83')](_0x471915['query'][_0x187ad4])['$gte'];var _0x2a98c6=JSON[_0x7196('0x83')](_0x471915[_0x7196('0x45')][_0x187ad4])['$lte'];_0x76b189[_0x7196('0x4e')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x431415,_0x2a98c6);}else{if(_0x471915[_0x7196('0x45')][_0x187ad4]===_0x7196('0x84')){_0x76b189['where']('i.'+_0x187ad4+_0x7196('0x85'));}else{_0x76b189['where']('i.'+_0x187ad4+'\x20=\x20?',_0x471915[_0x7196('0x45')][_0x187ad4]);}}});}if(_0x471915[_0x7196('0x45')][_0x7196('0x86')]){if(_0x471915['query'][_0x7196('0x86')]==0x1){_0x76b189['having'](_0x7196('0x87'));}else{_0x76b189[_0x7196('0x67')](_0x7196('0x88'));}}if(_0x471915[_0x7196('0x45')][_0x7196('0x89')]){_0x3ece9f=_['isArray'](_0x471915[_0x7196('0x45')][_0x7196('0x89')])?_0x471915[_0x7196('0x45')][_0x7196('0x89')]:new Array(_0x471915[_0x7196('0x45')][_0x7196('0x89')]);_0x3ece9f[_0x7196('0x40')](function(_0x34633a){_0x5b77fc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x34633a+',%');});}if(_0x471915[_0x7196('0x45')][_0x7196('0x8a')]){var _0x28a29d=_0x471915[_0x7196('0x45')]['filter'][_0x7196('0x8b')]('\x5c','\x5c\x5c')[_0x7196('0x8b')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x7196('0x8c')](_0x28a29d)){_0x469bac['or']('i.id\x20LIKE\x20?',_0x28a29d+'%');}else{_0x469bac['or'](_0x7196('0x8d'),qs['getFullTextValue'](_0x28a29d))['or'](_0x7196('0x8e'),_0x28a29d+'%');}}}_0x76b189[_0x7196('0x4e')](_0x469bac);_0x76b189['group'](_0x7196('0x8f'));var _0x2b52c0={'type':db[_0x7196('0x23')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1c5a41=_0x76b189['clone']();_0x1c5a41['field'](_0x7196('0x8f'));_0x1c5a41[_0x7196('0x51')](_0x7196('0x90'),'unreadMessages');if(_0x3b78c8[_0x7196('0x91')]){_0x3b78c8[_0x7196('0x91')][_0x7196('0x40')](function(_0x175dd8){_0x76b189[_0x7196('0x91')]('i.'+_0x175dd8[0x0],_0x175dd8[0x1]===_0x7196('0x92')?![]:!![]);});}if(!_[_0x7196('0x7f')](_0x3ece9f)){_0x76b189[_0x7196('0x67')](_0x5b77fc);_0x1c5a41[_0x7196('0x4e')](_0x7196('0x93'),_0x3ece9f);}BPromise[_0x7196('0x94')]()['then'](function(){if(!_0x5b9824){if(_0x471915['query'][_0x7196('0x80')]||_0x471915['query']['journey'])return;_0x1c5a41[_0x7196('0x4e')](_0x7196('0x95'));_0x76b189[_0x7196('0x4e')](_0x7196('0x95'));return;}return _0x471915['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x7196('0x37')](function(_0x12394d){if(_[_0x7196('0x7f')](_0x12394d)){_0x1c5a41[_0x7196('0x4e')]('i.ChatWebsiteId\x20IS\x20NULL');_0x76b189[_0x7196('0x4e')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1c5a41['where'](_0x7196('0x81'),_[_0x7196('0x7c')](_0x12394d,'id'));_0x76b189[_0x7196('0x4e')]('i.ChatWebsiteId\x20IN\x20?',_[_0x7196('0x7c')](_0x12394d,'id'));}});})[_0x7196('0x37')](function(){db[_0x7196('0x96')][_0x7196('0x45')](_0x1c5a41[_0x7196('0x97')](),_0x2b52c0)[_0x7196('0x37')](function(_0x214ec2){_0x455fea[_0x7196('0x31')]=_0x214ec2['length'];if(_0x455fea[_0x7196('0x31')]===0x0)return[];return db[_0x7196('0x96')][_0x7196('0x45')](_0x513855[_0x7196('0x97')](),_0x2b52c0)[_0x7196('0x37')](function(_0x4faf7b){_0x143c58=_[_0x7196('0x98')](_0x4faf7b,'id');_0x2b52c0=_[_0x7196('0x99')](_0x2b52c0,{'model':db[_0x7196('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x471915['query'][_0x7196('0x4a')]){_0x3b78c8['attributes']['forEach'](function(_0x1dcf93){_0x76b189[_0x7196('0x51')]('i.'+_0x1dcf93);});}else{_0x76b189['field'](_0x7196('0x90'),_0x7196('0x65'));_0x76b189['field'](_0x7196('0x9a'),_0x7196('0x9b'));_0x76b189[_0x7196('0x51')](_0x7196('0x9c'),_0x7196('0x9d'));_0x76b189[_0x7196('0x51')]('i.*');_0x76b189[_0x7196('0x51')](_0x7196('0x9e'),_0x7196('0x9f'));_0x76b189['field']('c.lastName','Contact.lastName');_0x76b189[_0x7196('0x51')](_0x7196('0xa0'),_0x7196('0xa1'));_0x76b189['field'](_0x7196('0xa2'),'Contact.phone');_0x76b189[_0x7196('0x51')]('c.mobile',_0x7196('0xa3'));_0x76b189[_0x7196('0x51')](_0x7196('0xa4'),_0x7196('0xa5'));_0x76b189[_0x7196('0x51')](_0x7196('0xa6'),_0x7196('0xa7'));_0x76b189['field'](_0x7196('0xa8'),'Owner.internal');_0x76b189['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3b78c8['limit'])_0x76b189[_0x7196('0x33')](_0x3b78c8[_0x7196('0x33')]);if(_0x3b78c8[_0x7196('0x32')])_0x76b189['offset'](_0x3b78c8[_0x7196('0x32')]);return db['sequelize']['query'](_0x76b189['toString'](),_0x2b52c0);})[_0x7196('0x37')](function(_0x55e56b){_0x179815[_0x7196('0x4e')](_0x7196('0xa9'),_[_0x7196('0x7c')](_0x55e56b,'id'));return db[_0x7196('0x96')][_0x7196('0x45')](_0x179815[_0x7196('0x97')](),_0x2b52c0)[_0x7196('0x37')](function(_0x36ce4f){var _0x49d494=_[_0x7196('0xaa')](_0x36ce4f,_0x7196('0xab'));var _0x144e54=[];_0x55e56b['forEach'](function(_0x3a241a){_0x144e54[_0x7196('0x41')](updateChatInteraction(_0x3a241a,_0x143c58,_0x49d494));});return BPromise[_0x7196('0xac')](_0x144e54);});});})['then'](function(_0x6c7aa9){_0x455fea[_0x7196('0xad')]=_0x6c7aa9;return _0x455fea;})[_0x7196('0x37')](respondWithFilteredResult(_0x471bb2,_0x3b78c8));})['catch'](handleError(_0x471bb2,null));};exports[_0x7196('0xae')]=function(_0x3eb6db,_0x4d4f1b){var _0xfb40ad={'raw':![],'where':{'id':_0x3eb6db[_0x7196('0xaf')]['id']}},_0x5db5f1={};_0x5db5f1[_0x7196('0x48')]=_['keys'](db[_0x7196('0x42')]['rawAttributes']);_0x5db5f1[_0x7196('0x45')]=_[_0x7196('0x7b')](_0x3eb6db[_0x7196('0x45')]);_0x5db5f1['filters']=_[_0x7196('0x47')](_0x5db5f1[_0x7196('0x48')],_0x5db5f1[_0x7196('0x45')]);_0xfb40ad[_0x7196('0x49')]=_['intersection'](_0x5db5f1[_0x7196('0x48')],qs[_0x7196('0x4a')](_0x3eb6db[_0x7196('0x45')]['fields']));_0xfb40ad['attributes']=_0xfb40ad[_0x7196('0x49')][_0x7196('0x4b')]?_0xfb40ad[_0x7196('0x49')]:_0x5db5f1[_0x7196('0x48')];if(_0x3eb6db['query'][_0x7196('0xb0')]){_0xfb40ad['include']=[{'all':!![]}];}_0xfb40ad=_[_0x7196('0x99')]({},_0xfb40ad,_0x3eb6db['options']);return db[_0x7196('0x42')][_0x7196('0x6f')](_0xfb40ad)[_0x7196('0x37')](handleEntityNotFound(_0x4d4f1b,null))[_0x7196('0x37')](respondWithResult(_0x4d4f1b,null))[_0x7196('0x2e')](handleError(_0x4d4f1b,null));};exports[_0x7196('0xb1')]=function(_0x342fb1,_0x4c9c35){return db[_0x7196('0x42')][_0x7196('0xb1')](_0x342fb1[_0x7196('0xb2')],{})[_0x7196('0x37')](respondWithResult(_0x4c9c35,0xc9))[_0x7196('0x2e')](handleError(_0x4c9c35,null));};exports[_0x7196('0xb3')]=function(_0x186731,_0x90c063){if(_0x186731['body']['id']){delete _0x186731[_0x7196('0xb2')]['id'];}return db[_0x7196('0x42')]['find']({'where':{'id':_0x186731[_0x7196('0xaf')]['id']}})[_0x7196('0x37')](handleEntityNotFound(_0x90c063,null))['then'](saveUpdates(_0x186731[_0x7196('0xb2')],null))[_0x7196('0x37')](respondWithResult(_0x90c063,null))[_0x7196('0x2e')](handleError(_0x90c063,null));};exports[_0x7196('0xb4')]=function(_0x5ba767,_0x505aab){return db[_0x7196('0x42')]['find']({'where':{'id':_0x5ba767[_0x7196('0xaf')]['id']}})[_0x7196('0x37')](handleEntityNotFound(_0x505aab,null))[_0x7196('0x37')](removeEntity(_0x505aab,null))[_0x7196('0x2e')](handleError(_0x505aab,null));};exports[_0x7196('0xb5')]=function(_0x4efae3,_0x392e74){return db[_0x7196('0x42')][_0x7196('0xb5')]()[_0x7196('0x37')](respondWithResult(_0x392e74,null))[_0x7196('0x2e')](handleError(_0x392e74,null));};exports[_0x7196('0xb6')]=function(_0x446a99,_0x149144){var _0x11fb5b=_0x446a99['params']['id'];var _0x58fb86;var _0x51da79;var _0x144613;return db[_0x7196('0x42')][_0x7196('0xb7')]({'where':{'id':_0x11fb5b}})[_0x7196('0x37')](function(_0x52de6e){_0x58fb86=_0x52de6e;return db[_0x7196('0xb8')][_0x7196('0xb7')]({'where':{'id':_0x52de6e[_0x7196('0x80')]},'attributes':['id','vidaooApiKey','vidaooEscalation'],'raw':!![]});})['then'](function(_0x5ee12a){if(_0x5ee12a&&_0x5ee12a[_0x7196('0xb9')]&&_0x5ee12a[_0x7196('0xba')]){_0x51da79=_0x5ee12a;var _0x2884a6={'rejectUnauthorized':![],'method':_0x7196('0xbb'),'uri':_0x7196('0xbc'),'headers':{'X-APIKEY':_0x5ee12a[_0x7196('0xb9')]},'body':{'name':'MotionCWB:'+_0x11fb5b},'redirect':_0x7196('0xbd'),'json':!![]};return rp(_0x2884a6);}else{throw new db['Sequelize']['ValidationError'](_0x7196('0xbe'));}})['then'](function(_0x5f1525){_0x144613=_0x5f1525;if(_0x144613['id']){var _0x44fb9c={'body':_0x144613['join_url'],'ChatWebsiteId':_0x51da79['id'],'ChatInteractionId':_0x58fb86['id'],'direction':_0x7196('0xbf'),'UserId':_0x446a99[_0x7196('0xc0')]['id']};return db[_0x7196('0xc1')][_0x7196('0xb1')](_0x44fb9c,{});}else{throw new db[(_0x7196('0x23'))][(_0x7196('0x24'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x7196('0x37')](function(){return _0x58fb86[_0x7196('0xc2')]({'vidaooSessionId':_0x144613['id']});})[_0x7196('0x37')](respondWithResult(_0x149144,null))['catch'](handleError(_0x149144,null));};exports[_0x7196('0xc3')]=function(_0x17904c,_0x192f6f){if(_0x17904c['body']['id']){delete _0x17904c['body']['id'];}return db[_0x7196('0x42')][_0x7196('0x6f')]({'where':{'id':_0x17904c[_0x7196('0xaf')]['id']}})[_0x7196('0x37')](handleEntityNotFound(_0x192f6f,null))[_0x7196('0x37')](saveUpdates(_0x17904c[_0x7196('0xb2')],null))[_0x7196('0x37')](respondWithResult(_0x192f6f,null))[_0x7196('0x2e')](handleError(_0x192f6f,null));};exports[_0x7196('0xc4')]=function(_0xbd94ef,_0x5d2a56,_0x2fb552){if(_0xbd94ef[_0x7196('0xb2')]['id']){delete _0xbd94ef['body']['id'];}return db[_0x7196('0x42')][_0x7196('0x6f')]({'where':{'id':_0xbd94ef['params']['id']}})[_0x7196('0x37')](function(_0x386259){if(!_0x386259){logger[_0x7196('0x2a')](_0x7196('0xc5'),_0x7196('0xc4'),0x194,_0x7196('0xc6'));_0x5d2a56['sendStatus'](0x194);}else{if(_0x386259['UserId']){throw new db[(_0x7196('0x23'))]['ValidationError'](_0x7196('0xc7'));}}return _0x386259;})[_0x7196('0x37')](function(_0x30db09){if(_0x30db09){return _0x30db09['update']({'closed':_0xbd94ef[_0x7196('0xb2')][_0x7196('0xc8')],'disposition':_0xbd94ef[_0x7196('0xb2')][_0x7196('0xc9')]})[_0x7196('0x37')](function(_0x1e2105){return _0x1e2105;});}})[_0x7196('0x37')](function(_0x31f1d9){return respondWithRpcPromise(_0x7196('0xca'),'abandon',_0xbd94ef[_0x7196('0xb2')],client9004);})[_0x7196('0x37')](respondWithResult(_0x5d2a56,null))[_0x7196('0x2e')](handleError(_0x5d2a56,null));};exports[_0x7196('0xcb')]=function(_0x1bccbd,_0xc7a9d8,_0x5e01cd){_0x1bccbd[_0x7196('0xb2')]['name']=_0x1bccbd[_0x7196('0xcc')][_0x7196('0xcd')];_0x1bccbd[_0x7196('0xb2')]['basename']=_0x1bccbd['file'][_0x7196('0xce')];_0x1bccbd[_0x7196('0xb2')][_0x7196('0x7a')]=_0x1bccbd[_0x7196('0xcc')][_0x7196('0xcf')];return db[_0x7196('0xd0')][_0x7196('0xb1')](_0x1bccbd[_0x7196('0xb2')])['then'](respondWithResult(_0xc7a9d8,0xc9))[_0x7196('0x2e')](handleError(_0xc7a9d8,null));};exports[_0x7196('0xd1')]=function(_0x4ad81d,_0x135c51,_0x1fa845){return db[_0x7196('0x42')]['findOne']({'where':{'id':_0x4ad81d[_0x7196('0xaf')]['id']},'raw':!![]})[_0x7196('0x37')](handleEntityNotFound(_0x135c51,null))[_0x7196('0x37')](function(_0x3c6052){if(_0x3c6052){if(_0x3c6052[_0x7196('0xc8')]){return _0x135c51['status'](0x193)['json']({'status':0x193,'message':_0x7196('0xd2')});}return db[_0x7196('0xd0')][_0x7196('0xb7')]({'where':{'id':_0x4ad81d[_0x7196('0x45')][_0x7196('0xd3')]},'raw':!![]})[_0x7196('0x37')](handleEntityNotFound(_0x135c51,null));}})['then'](function(_0x7f5ce2){if(_0x7f5ce2){return _0x135c51[_0x7196('0xd4')](path[_0x7196('0xd5')](config[_0x7196('0xd6')],'server/files/attachments/',_0x7f5ce2[_0x7196('0xd7')]));}})[_0x7196('0x2e')](handleError(_0x135c51,null));};exports[_0x7196('0xd8')]=function(_0x3bad8a,_0x62d17f){var _0x269f75=null;var _0x36fa90=null;var _0x429670=null;var _0x329955=null;if(_0x3bad8a[_0x7196('0xb2')]['id']){delete _0x3bad8a[_0x7196('0xb2')]['id'];}if(_0x3bad8a[_0x7196('0xb2')]['mailTranscript']){_0x329955=path[_0x7196('0xd5')](config['root'],_0x7196('0xd9'),util['format'](_0x7196('0xda'),Date['now']()));_0x3bad8a[_0x7196('0xb2')][_0x7196('0xdb')]=_0x329955;}return db[_0x7196('0x42')][_0x7196('0x6f')]({'where':{'id':_0x3bad8a['params']['id']},'include':[{'model':db[_0x7196('0xc1')],'as':_0x7196('0xdc'),'include':[{'model':db[_0x7196('0x77')],'as':'User'}]}]})[_0x7196('0x37')](handleEntityNotFound(_0x62d17f,null))[_0x7196('0x37')](saveUpdates(_0x3bad8a[_0x7196('0xb2')],null))['then'](function(_0x6cbe9a){if(_0x6cbe9a){_0x269f75=_0x6cbe9a;return db[_0x7196('0xb8')][_0x7196('0x6f')]({'where':{'id':_0x269f75['ChatWebsiteId']}});}})[_0x7196('0x37')](function(_0x26af5b){if(_0x26af5b){_0x429670=_0x26af5b;return db[_0x7196('0xdd')]['find']({'where':{'id':_0x269f75['ContactId']}});}})['then'](function(_0x542f8e){if(_0x542f8e){_0x36fa90=_0x542f8e;if(_0x329955){var _0x2a0e91=null;for(var _0x2b359d=0x1;_0x2b359d<_0x269f75['Messages'][_0x7196('0x4b')];++_0x2b359d){_0x2a0e91=_0x269f75[_0x7196('0xdc')][_0x2b359d];var _0x18e274=_0x2a0e91['UserId']?util['format'](_0x7196('0xde'),_0x429670[_0x7196('0xdf')],_0x2a0e91[_0x7196('0x79')]):_0x7196('0xe0');var _0x29ec00=_0x3bad8a['body'][_0x7196('0xe1')]||util[_0x7196('0xe2')](_0x7196('0xde'),_0x7196('0xe3'),_0x2a0e91['ContactId']);switch(_0x429670['agentIdentifier']){case _0x7196('0xe4'):_0x18e274=_0x2a0e91[_0x7196('0x79')]?util[_0x7196('0xe2')](_0x7196('0xde'),_0x429670[_0x7196('0xdf')],_0x2a0e91[_0x7196('0x79')]):'System';break;case'agent_alias':_0x18e274=_0x2a0e91[_0x7196('0x79')]?_0x2a0e91[_0x7196('0x77')][_0x7196('0xe5')]||_0x2a0e91['User']['fullname']:_0x7196('0xe0');break;case'agent_fullname':_0x18e274=_0x2a0e91[_0x7196('0x79')]?_0x2a0e91[_0x7196('0x77')][_0x7196('0x3d')]:_0x7196('0xe0');break;default:_0x18e274=_0x2a0e91[_0x7196('0x79')]?util[_0x7196('0xe2')](_0x7196('0xde'),_0x429670[_0x7196('0xdf')],_0x2a0e91[_0x7196('0x79')]):_0x7196('0xe0');}var _0x501e31=util[_0x7196('0xe2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2a0e91[_0x7196('0xe6')])[_0x7196('0xe2')](_0x7196('0xe7')),_0x2a0e91[_0x7196('0xe8')]==='in'?_0x29ec00:_0x18e274,_0x2a0e91['body']);if(!_0x2a0e91['secret']){fs[_0x7196('0xe9')](_0x329955,_0x501e31);}}return db[_0x7196('0xea')][_0x7196('0xb7')]({'where':{'service':!![]},'include':[{'model':db[_0x7196('0xeb')],'as':'Smtp','raw':!![]}]});}}})['then'](function(_0x29bb00){if(_0x29bb00&&_0x29bb00[_0x7196('0xec')]&&_0x3bad8a['body']){var _0xc46c8c={'tls':{'rejectUnauthorized':![]}};if(_0x29bb00[_0x7196('0xec')]['service']){_0xc46c8c[_0x7196('0xed')]=_0x29bb00[_0x7196('0xec')][_0x7196('0xed')];}else{_0xc46c8c[_0x7196('0xee')]=_0x29bb00[_0x7196('0xec')][_0x7196('0xee')];_0xc46c8c[_0x7196('0xef')]=_0x29bb00['Smtp'][_0x7196('0xef')];_0xc46c8c[_0x7196('0xf0')]=_0x29bb00['Smtp']['secure'];}if(_0x29bb00[_0x7196('0xec')][_0x7196('0xf1')]){_0xc46c8c[_0x7196('0xf2')]={'user':_0x29bb00[_0x7196('0xec')][_0x7196('0xc0')],'pass':_0x29bb00[_0x7196('0xec')][_0x7196('0xf3')]};}return respondWithRpcPromise(_0x7196('0xf4'),_0x7196('0xf5'),{'account':_0xc46c8c,'message':{'from':util[_0x7196('0xe2')](_0x7196('0xf6'),_0x29bb00[_0x7196('0x3a')],_0x29bb00[_0x7196('0xf7')]||_0x29bb00[_0x7196('0xec')][_0x7196('0xc0')]),'to':_0x3bad8a['body'][_0x7196('0xf8')],'subject':_0x7196('0xf9'),'text':util['format'](_0x7196('0xfa'),_0x3bad8a[_0x7196('0xb2')][_0x7196('0xf8')]),'attachments':[{'path':_0x329955}]}})[_0x7196('0x37')](function(){return _0x269f75;})[_0x7196('0x2e')](function(_0x66cc24){console[_0x7196('0x2a')](_0x66cc24);});}else{return _0x269f75;}})[_0x7196('0x37')](respondWithStatusCode(_0x62d17f,0xc8))[_0x7196('0x2e')](handleError(_0x62d17f,null));};exports['addMessage']=function(_0xc815f5,_0x32f50c,_0x247aa4){return db['ChatMessage'][_0x7196('0x6f')]({'where':{'id':_0xc815f5[_0x7196('0xaf')]['id']}})[_0x7196('0x37')](handleEntityNotFound(_0x32f50c,null))[_0x7196('0x37')](function(_0x2ee28f){if(_0x2ee28f){return _0x2ee28f['addMessage'](_0xc815f5[_0x7196('0xb2')]['ids'],_[_0x7196('0xfb')](_0xc815f5['body'],[_0x7196('0xfc'),'id'])||{});}})[_0x7196('0x37')](respondWithResult(_0x32f50c,null))[_0x7196('0x2e')](handleError(_0x32f50c,null));};exports[_0x7196('0xfd')]=function(_0xde3a61,_0x1dc24d,_0x21b769){var _0x33589a={'raw':![],'where':{}};var _0x5d50c2={};var _0x3d290c={'count':0x0,'rows':[]};return db[_0x7196('0x42')][_0x7196('0xb7')]({'where':{'id':_0xde3a61['params']['id']}})['then'](handleEntityNotFound(_0x1dc24d,null))['then'](function(_0x5d95d5){if(_0x5d95d5){_0x5d50c2[_0x7196('0x48')]=_['keys'](db[_0x7196('0xc1')][_0x7196('0x43')]);_0x5d50c2[_0x7196('0x45')]=_[_0x7196('0x7b')](_0xde3a61[_0x7196('0x45')]);_0x5d50c2[_0x7196('0x46')]=_[_0x7196('0x47')](_0x5d50c2[_0x7196('0x48')],_0x5d50c2[_0x7196('0x45')]);_0x33589a[_0x7196('0x49')]=_['intersection'](_0x5d50c2[_0x7196('0x48')],qs[_0x7196('0x4a')](_0xde3a61['query'][_0x7196('0x4a')]));_0x33589a['attributes']=_0x33589a[_0x7196('0x49')][_0x7196('0x4b')]?_0x33589a[_0x7196('0x49')]:_0x5d50c2['model'];if(!_0xde3a61['query'][_0x7196('0xfe')](_0x7196('0x4c'))){_0x33589a['limit']=qs[_0x7196('0x33')](_0xde3a61[_0x7196('0x45')]['limit']);_0x33589a[_0x7196('0x32')]=qs[_0x7196('0x32')](_0xde3a61['query']['offset']);}_0x33589a['order']=qs[_0x7196('0x4d')](_0xde3a61[_0x7196('0x45')][_0x7196('0x4d')]);_0x33589a['where']=qs[_0x7196('0x46')](_[_0x7196('0x4f')](_0xde3a61[_0x7196('0x45')],_0x5d50c2[_0x7196('0x46')]));_0x33589a[_0x7196('0x4e')][_0x7196('0xab')]=_0x5d95d5['id'];if(_0xde3a61[_0x7196('0x45')][_0x7196('0x8a')]){_0x33589a[_0x7196('0x4e')]=_[_0x7196('0x99')](_0x33589a[_0x7196('0x4e')],{'$or':_[_0x7196('0x7c')](_0x33589a[_0x7196('0x49')],function(_0x2ef552){var _0x50e0bf={};_0x50e0bf[_0x2ef552]={'$like':'%'+_0xde3a61[_0x7196('0x45')]['filter']+'%'};return _0x50e0bf;})});}if(_0xde3a61[_0x7196('0x45')][_0x7196('0xff')]){var _0x4f86b4=_0xde3a61[_0x7196('0x45')]['$gte'][_0x7196('0x3f')](',');var _0x5a67de={};_0x5a67de[_0x4f86b4[0x0]]={'$gte':moment(_0x4f86b4[0x1])['format'](_0x7196('0x100'))};_0x33589a['where']=_['merge'](_0x33589a['where'],_0x5a67de);}_0x33589a=_['merge']({},_0x33589a,_0xde3a61[_0x7196('0x101')]);return db[_0x7196('0xc1')][_0x7196('0x31')]({'where':_0x33589a[_0x7196('0x4e')]})[_0x7196('0x37')](function(_0x4cd274){_0x3d290c[_0x7196('0x31')]=_0x4cd274;if(_0xde3a61['query'][_0x7196('0xb0')]){_0x33589a['include']=[{'all':!![]}];}return db[_0x7196('0xc1')][_0x7196('0x102')](_0x33589a);})['then'](function(_0xa6ca64){_0x3d290c['rows']=_0xa6ca64;return _0x3d290c;});}})[_0x7196('0x37')](respondWithFilteredResult(_0x1dc24d,_0x33589a))['catch'](handleError(_0x1dc24d,null));};exports[_0x7196('0x103')]=function(_0x3118bb,_0x4d91b9,_0x4a37d4){var _0x5c556e={'where':{}},_0xe1728b={},_0x4f6086={'count':0x0,'rows':[]};return db[_0x7196('0x42')][_0x7196('0xb7')]({'where':{'id':_0x3118bb[_0x7196('0xaf')]['id']}})[_0x7196('0x37')](handleEntityNotFound(_0x4d91b9,null))[_0x7196('0x37')](function(_0x1d264b){if(_0x1d264b){_0xe1728b[_0x7196('0x48')]=_['keys'](db['ChatMessage'][_0x7196('0x43')]);_0xe1728b['query']=_[_0x7196('0x7b')](_0x3118bb[_0x7196('0x45')]);_0xe1728b[_0x7196('0x46')]=_[_0x7196('0x47')](_0xe1728b['model'],_0xe1728b[_0x7196('0x45')]);_0x5c556e[_0x7196('0x49')]=_[_0x7196('0x47')](_0xe1728b[_0x7196('0x48')],qs[_0x7196('0x4a')](_0x3118bb[_0x7196('0x45')][_0x7196('0x4a')]));_0x5c556e['attributes']=_0x5c556e[_0x7196('0x49')][_0x7196('0x4b')]?_0x5c556e[_0x7196('0x49')]:_0xe1728b[_0x7196('0x48')];if(!_0x3118bb[_0x7196('0x45')][_0x7196('0xfe')]('nolimit')){_0x5c556e[_0x7196('0x33')]=qs[_0x7196('0x33')](_0x3118bb[_0x7196('0x45')][_0x7196('0x33')]);_0x5c556e[_0x7196('0x32')]=qs[_0x7196('0x32')](_0x3118bb[_0x7196('0x45')][_0x7196('0x32')]);}_0x5c556e[_0x7196('0x91')]=qs[_0x7196('0x4d')](_0x3118bb['query'][_0x7196('0x4d')]);_0x5c556e[_0x7196('0x4e')]=qs[_0x7196('0x46')](_[_0x7196('0x4f')](_0x3118bb[_0x7196('0x45')],_0xe1728b[_0x7196('0x46')]));_0x5c556e[_0x7196('0x4e')][_0x7196('0xab')]=_0x1d264b['id'];if(_0x3118bb['query']['filter']){_0x5c556e[_0x7196('0x4e')]=_[_0x7196('0x99')](_0x5c556e['where'],{'$or':_[_0x7196('0x7c')](_0x5c556e[_0x7196('0x49')],function(_0x401636){var _0xdb3933={};_0xdb3933[_0x401636]={'$like':'%'+_0x3118bb[_0x7196('0x45')][_0x7196('0x8a')]+'%'};return _0xdb3933;})});}_0x5c556e[_0x7196('0x4e')][_0x7196('0x104')]=![];if(_0x3118bb[_0x7196('0x45')]['id']){_0x5c556e[_0x7196('0x4e')]['id']={'$gt':_0x3118bb['query']['id']};}_0x5c556e=_[_0x7196('0x99')]({},_0x5c556e,_0x3118bb['options']);return db[_0x7196('0xc1')]['count']({'where':_0x5c556e[_0x7196('0x4e')]})[_0x7196('0x37')](function(_0x1df729){_0x4f6086[_0x7196('0x31')]=_0x1df729;_0x5c556e['include']=[];if(_0x3118bb[_0x7196('0x45')][_0x7196('0x105')]){_0x5c556e[_0x7196('0x106')]['push']({'model':db['User'],'as':_0x7196('0x77'),'attributes':['id','fullname',_0x7196('0xe5')]});}if(_0x3118bb['query']['includeAll']){_0x5c556e[_0x7196('0x106')]=[{'all':!![]}];}return db[_0x7196('0xc1')][_0x7196('0x102')](_0x5c556e);})[_0x7196('0x37')](function(_0x2911bb){_0x4f6086[_0x7196('0xad')]=_0x2911bb;return _0x4f6086;});}})[_0x7196('0x37')](respondWithFilteredResult(_0x4d91b9,_0x5c556e))[_0x7196('0x2e')](handleError(_0x4d91b9,null));};exports['addTags']=function(_0x2cfd7f,_0x3bda03,_0x716313){return db[_0x7196('0x42')][_0x7196('0x6f')]({'where':{'id':_0x2cfd7f['params']['id']}})['then'](handleEntityNotFound(_0x3bda03,null))[_0x7196('0x37')](function(_0x18fc9c){if(_0x18fc9c){return _0x18fc9c[_0x7196('0x107')](_0x2cfd7f['body']['ids'],_[_0x7196('0xfb')](_0x2cfd7f[_0x7196('0xb2')],[_0x7196('0xfc'),'id'])||{})[_0x7196('0x108')](function(){return db[_0x7196('0x74')][_0x7196('0x102')]({'attributes':['id','name','color'],'where':{'id':_0x2cfd7f[_0x7196('0xb2')][_0x7196('0xfc')]}});})[_0x7196('0x37')](function(_0x4dcd0c){socket[_0x7196('0x109')](_0x7196('0x10a'),{'id':Number(_0x2cfd7f[_0x7196('0xaf')]['id']),'tags':_0x4dcd0c||[]});return{'id':Number(_0x2cfd7f['params']['id']),'tags':_0x4dcd0c||[]};});}})[_0x7196('0x37')](respondWithResult(_0x3bda03,null))[_0x7196('0x2e')](handleError(_0x3bda03,null));};exports[_0x7196('0x10b')]=function(_0x514cde,_0x32c76a,_0x1e2dec){return db['ChatInteraction'][_0x7196('0x6f')]({'where':{'id':_0x514cde[_0x7196('0xaf')]['id']}})[_0x7196('0x37')](handleEntityNotFound(_0x32c76a,null))[_0x7196('0x37')](function(_0x5d67ed){if(_0x5d67ed){return _0x5d67ed['removeTags'](_0x514cde[_0x7196('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x32c76a,null))[_0x7196('0x2e')](handleError(_0x32c76a,null));};exports['download']=function(_0x3cea3e,_0x33f4d5){var _0x100361=moment()[_0x7196('0x10c')]()[_0x7196('0x97')]();var _0x1b3d7e=path[_0x7196('0xd5')](config[_0x7196('0xd6')],_0x7196('0x10d'),_0x7196('0x10e'),'tmp');var _0x39d323=path['join'](config[_0x7196('0xd6')],_0x7196('0x10d'),'files',_0x7196('0x10f'));var _0x19505a=path[_0x7196('0xd5')](_0x1b3d7e,_0x100361);var _0x5d9b9b=util[_0x7196('0xe2')](_0x7196('0x110'),_0x3cea3e[_0x7196('0xaf')]['id'],_0x100361);var _0x1ff320=path[_0x7196('0xd5')](_0x1b3d7e,_0x5d9b9b);var _0x3f96d7=[];_0x3f96d7[_0x7196('0x41')]({'model':db['User'],'as':'User','attributes':['id',_0x7196('0x3d')],'raw':!![]});_0x3f96d7[_0x7196('0x41')]({'model':db[_0x7196('0xdd')],'as':_0x7196('0x111'),'attributes':['id',_0x7196('0x112'),'lastName'],'raw':!![]});if(_0x3cea3e[_0x7196('0x45')]['attachments']){_0x3f96d7['push']({'model':db['Attachment'],'as':_0x7196('0xd0'),'raw':!![]});}var _0x4e18f2=[{'model':db[_0x7196('0xc1')],'as':_0x7196('0xdc'),'attributes':['id',_0x7196('0xb2'),_0x7196('0xe6'),'direction','secret','read'],'include':_0x3f96d7}];_0x4e18f2[_0x7196('0x41')]({'model':db[_0x7196('0xb8')],'as':_0x7196('0x113'),'attributes':['id',_0x7196('0x3a')]});_0x4e18f2[_0x7196('0x41')]({'model':db[_0x7196('0x77')],'as':_0x7196('0x114'),'attributes':['id',_0x7196('0x3d')]});return db[_0x7196('0x42')][_0x7196('0x6f')]({'where':{'id':_0x3cea3e[_0x7196('0xaf')]['id']},'include':_0x4e18f2})[_0x7196('0x37')](handleEntityNotFound(_0x33f4d5,null))[_0x7196('0x37')](function(_0x44f774){if(_0x44f774){var _0x1fb96c=_0x44f774[_0x7196('0x115')]({'plain':!![]});fs[_0x7196('0x116')](_0x19505a);var _0x1d4126={'format':'A4','border':'10px','header':{'height':_0x7196('0x117'),'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':_0x7196('0x118'),'contents':{'default':util[_0x7196('0xe2')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x7196('0xe2')]('%s\x20#%d','Chat',_0x1fb96c['id']),moment()[_0x7196('0xe2')](_0x7196('0x119'))[_0x7196('0x97')]())}}};var _0x245211={'channel':_0x7196('0x11a'),'account':_0x1fb96c['Account'][_0x7196('0x3a')],'agent':_0x1fb96c['Owner']?_0x1fb96c['Owner'][_0x7196('0x3d')]:_0x7196('0x11b'),'createdAt':moment(_0x1fb96c[_0x7196('0xe6')])['format'](_0x7196('0x100'))[_0x7196('0x97')](),'closedAt':_0x1fb96c[_0x7196('0xc8')]?moment(_0x1fb96c[_0x7196('0x11c')])[_0x7196('0xe2')](_0x7196('0x100'))[_0x7196('0x97')]():'','disposition':_0x1fb96c[_0x7196('0xc9')],'chatInfo':{'browser':_0x1fb96c['browserName'],'os':_0x1fb96c[_0x7196('0x11d')],'referer':_0x1fb96c['referer'],'customerIp':_0x1fb96c[_0x7196('0x11e')],'customerPort':_0x1fb96c[_0x7196('0x11f')]?_0x1fb96c[_0x7196('0x11f')]:_0x7196('0x11b')},'messages':_(_0x1fb96c[_0x7196('0xdc')])[_0x7196('0x120')]()[_0x7196('0x8a')]({'secret':![]})[_0x7196('0x7c')](function(_0x51f5e9){if(_0x51f5e9[_0x7196('0xd0')]){var _0x1e8251=path[_0x7196('0xd5')](_0x39d323,_0x51f5e9[_0x7196('0xd0')][_0x7196('0xd7')]);if(fs[_0x7196('0x121')](_0x1e8251)){fs[_0x7196('0x122')](_0x1e8251)[_0x7196('0x123')](fs[_0x7196('0x124')](path[_0x7196('0xd5')](_0x19505a,_0x51f5e9[_0x7196('0xd0')][_0x7196('0xd7')])));}}return{'date':moment(_0x51f5e9[_0x7196('0xe6')])['format'](_0x7196('0x100'))[_0x7196('0x97')](),'sender':_0x51f5e9['direction']==='out'?_0x51f5e9[_0x7196('0x77')]?_0x51f5e9[_0x7196('0x77')][_0x7196('0x3d')]:_0x7196('0xe0'):_0x51f5e9['Contact']['firstName']+(_0x51f5e9[_0x7196('0x111')][_0x7196('0x125')]?'\x20'+_0x51f5e9[_0x7196('0x111')]['lastName']:''),'body':_0x51f5e9['Attachment']?_0x51f5e9[_0x7196('0xd0')][_0x7196('0xd7')]:_0x51f5e9['body'],'direction':_0x51f5e9[_0x7196('0xe8')]===_0x7196('0xbf')?'A':'C','secret':_0x51f5e9['secret'],'read':_0x51f5e9['read'],'attachment':_0x51f5e9['Attachment']};})[_0x7196('0x66')]()};return ejs[_0x7196('0x126')](path['join'](config[_0x7196('0xd6')],_0x7196('0x10d'),_0x7196('0x127'),_0x7196('0x128')),{'interaction':_0x245211})['then'](function(_0x2fc6f9){return new BPromise(function(_0x3c03f4,_0x2f8b1e){pdf['create'](_0x2fc6f9,_0x1d4126)[_0x7196('0x129')](path[_0x7196('0xd5')](_0x19505a,_0x7196('0x12a')+_0x1fb96c['id']+'-'+_0x100361+_0x7196('0x12b')),function(_0x3ac15f,_0x3a7edd){if(_0x3ac15f)return _0x2f8b1e(_0x3ac15f);_0x3c03f4(_0x3a7edd);});});})['then'](function(){return new BPromise(function(_0x5b9062,_0x4b00d5){zipdir(_0x19505a,{'saveTo':_0x1ff320},function(_0x493da5,_0x5b4f7e){if(_0x493da5)return _0x4b00d5(_0x493da5);return _0x5b9062(_0x5b4f7e);});})[_0x7196('0x37')](function(){return new BPromise(function(_0x729ed0,_0x45bf3e){rimraf(_0x19505a,function(_0x50ebe3){if(_0x50ebe3)_0x45bf3e(_0x50ebe3);return _0x729ed0();});});})[_0x7196('0x37')](function(){return _0x33f4d5[_0x7196('0xd4')](_0x1ff320,_0x5d9b9b,function(_0x1244f2){if(_0x1244f2){console[_0x7196('0x12c')](_0x7196('0x12d'),_0x1244f2);}else{fs[_0x7196('0x12e')](_0x1ff320);}});});});}else{return _0x33f4d5[_0x7196('0x12f')](0xc8);}})['catch'](handleError(_0x33f4d5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 3e1b7ae..c6f0499 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 _0xfacb=['setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','remove'];(function(_0x4f3515,_0x303a64){var _0x218f3f=function(_0x39bcdf){while(--_0x39bcdf){_0x4f3515['push'](_0x4f3515['shift']());}};_0x218f3f(++_0x303a64);}(_0xfacb,0x8b));var _0xbfac=function(_0x1b5362,_0x5721c6){_0x1b5362=_0x1b5362-0x0;var _0x17371=_0xfacb[_0x1b5362];return _0x17371;};'use strict';var EventEmitter=require(_0xbfac('0x0'));var ChatInteraction=require(_0xbfac('0x1'))['db'][_0xbfac('0x2')];var ChatMessage=require(_0xbfac('0x1'))['db'][_0xbfac('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbfac('0x4')};function emitEvent(_0x5b3d66){return function(_0x5d4087,_0x506ec0,_0xf96c7a){_0x5d4087['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x361379){_0x5d4087[_0xbfac('0x5')](_0xbfac('0x6'),_0x361379[_0xbfac('0x7')](function(_0x533ecf){return{'id':_0x533ecf['id']};}));return ChatMessage[_0xbfac('0x8')]({'where':{'ChatInteractionId':_0x5d4087['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbfac('0x9')](function(_0x1a6399){_0x5d4087['setDataValue'](_0xbfac('0xa'),_0x1a6399[_0xbfac('0xb')]);ChatInteractionEvents[_0xbfac('0xc')](_0x5b3d66+':'+_0x5d4087['id'],_0x5d4087);ChatInteractionEvents['emit'](_0x5b3d66,_0x5d4087);_0xf96c7a(null);})['catch'](_0xf96c7a(null));};}for(var e in events){if(events[_0xbfac('0xd')](e)){var event=events[e];ChatInteraction[_0xbfac('0xe')](e,emitEvent(event));}}module[_0xbfac('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x0fcf=['hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch'];(function(_0x17559c,_0x485682){var _0x23ab66=function(_0x2d0ca4){while(--_0x2d0ca4){_0x17559c['push'](_0x17559c['shift']());}};_0x23ab66(++_0x485682);}(_0x0fcf,0x145));var _0xf0fc=function(_0x1152ba,_0x96cb9f){_0x1152ba=_0x1152ba-0x0;var _0xcf7499=_0x0fcf[_0x1152ba];return _0xcf7499;};'use strict';var EventEmitter=require(_0xf0fc('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xf0fc('0x1')];var ChatMessage=require(_0xf0fc('0x2'))['db'][_0xf0fc('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf0fc('0x4')](0x0);var events={'afterCreate':_0xf0fc('0x5'),'afterUpdate':_0xf0fc('0x6'),'afterDestroy':_0xf0fc('0x7')};function emitEvent(_0x3fa023){return function(_0x46a65d,_0x1eb32e,_0x24ec4c){_0x46a65d['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x114879){_0x46a65d['setDataValue'](_0xf0fc('0x8'),_0x114879[_0xf0fc('0x9')](function(_0x4116f1){return{'id':_0x4116f1['id']};}));return ChatMessage[_0xf0fc('0xa')]({'where':{'ChatInteractionId':_0x46a65d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf0fc('0xb')](function(_0x513080){_0x46a65d[_0xf0fc('0xc')](_0xf0fc('0xd'),_0x513080[_0xf0fc('0xe')]);ChatInteractionEvents[_0xf0fc('0xf')](_0x3fa023+':'+_0x46a65d['id'],_0x46a65d);ChatInteractionEvents[_0xf0fc('0xf')](_0x3fa023,_0x46a65d);_0x24ec4c(null);})[_0xf0fc('0x10')](_0x24ec4c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xf0fc('0x11')](e,emitEvent(event));}}module[_0xf0fc('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ee8c967..fae6a93 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 _0x53d2=['api','moment','bluebird','request-promise','path','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','utf8mb4','lodash','../../config/logger'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x53d2,0x8e));var _0x253d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x253d('0x0'));var util=require('util');var logger=require(_0x253d('0x1'))(_0x253d('0x2'));var moment=require(_0x253d('0x3'));var BPromise=require(_0x253d('0x4'));var rp=require(_0x253d('0x5'));var fs=require('fs');var path=require(_0x253d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x253d('0x7'));module[_0x253d('0x8')]=function(_0x329961,_0x4bf365){return _0x329961[_0x253d('0x9')]('ChatInteraction',attributes,{'tableName':_0x253d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43b218,_0x2d01fe,_0x5868aa){if(_0x43b218[_0x253d('0xb')](_0x253d('0xc'))){_0x43b218[_0x253d('0xd')]=moment()[_0x253d('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5868aa(null,_0x43b218);}},'charset':_0x253d('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe5d5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','chat_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util'];(function(_0x1640c1,_0x1004b3){var _0x1595e2=function(_0x4f8858){while(--_0x4f8858){_0x1640c1['push'](_0x1640c1['shift']());}};_0x1595e2(++_0x1004b3);}(_0xe5d5,0xdf));var _0x5e5d=function(_0x32e3a9,_0x403b74){_0x32e3a9=_0x32e3a9-0x0;var _0x2bfcae=_0xe5d5[_0x32e3a9];return _0x2bfcae;};'use strict';var _=require(_0x5e5d('0x0'));var util=require(_0x5e5d('0x1'));var logger=require(_0x5e5d('0x2'))(_0x5e5d('0x3'));var moment=require(_0x5e5d('0x4'));var BPromise=require(_0x5e5d('0x5'));var rp=require(_0x5e5d('0x6'));var fs=require('fs');var path=require(_0x5e5d('0x7'));var rimraf=require(_0x5e5d('0x8'));var config=require(_0x5e5d('0x9'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x30a2f2,_0x442473){return _0x30a2f2['define']('ChatInteraction',attributes,{'tableName':_0x5e5d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23fe54,_0x4e2ac5,_0xe73aeb){if(_0x23fe54[_0x5e5d('0xb')]('closed')){_0x23fe54[_0x5e5d('0xc')]=moment()['format'](_0x5e5d('0xd'));}_0xe73aeb(null,_0x23fe54);}},'charset':_0x5e5d('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4eb31e7..d1bb8e5 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 _0x09cf=['omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','update','body','options','raw','limit','then','UpdateChatInteraction','catch','ChatInteraction','find','where','ids'];(function(_0x4f5226,_0x518f6c){var _0x42fdd5=function(_0x565397){while(--_0x565397){_0x4f5226['push'](_0x4f5226['shift']());}};_0x42fdd5(++_0x518f6c);}(_0x09cf,0x84));var _0xf09c=function(_0x50224f,_0x40a53e){_0x50224f=_0x50224f-0x0;var _0x22f354=_0x09cf[_0x50224f];return _0x22f354;};'use strict';var _=require('lodash');var util=require(_0xf09c('0x0'));var moment=require(_0xf09c('0x1'));var BPromise=require(_0xf09c('0x2'));var rs=require(_0xf09c('0x3'));var fs=require('fs');var Redis=require(_0xf09c('0x4'));var db=require(_0xf09c('0x5'))['db'];var utils=require(_0xf09c('0x6'));var logger=require(_0xf09c('0x7'))(_0xf09c('0x8'));var config=require(_0xf09c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf09c('0xa')]({'port':0x232a});config[_0xf09c('0xb')]=_[_0xf09c('0xc')](config[_0xf09c('0xb')],{'host':_0xf09c('0xd'),'port':0x18eb});var socket=require(_0xf09c('0xe'))(new Redis(config[_0xf09c('0xb')]));require(_0xf09c('0xf'))[_0xf09c('0x10')](socket);function respondWithRpcPromise(_0x543098,_0x2d03dc,_0x420898){return new BPromise(function(_0x540d22,_0x58579f){return client[_0xf09c('0x11')](_0x543098,_0x420898)['then'](function(_0x4d7c4a){logger[_0xf09c('0x12')](_0xf09c('0x13'),_0x2d03dc,'request\x20sent');logger[_0xf09c('0x14')](_0xf09c('0x15'),_0x2d03dc,_0xf09c('0x16'),JSON[_0xf09c('0x17')](_0x4d7c4a));if(_0x4d7c4a[_0xf09c('0x18')]){if(_0x4d7c4a[_0xf09c('0x18')][_0xf09c('0x19')]===0x1f4){logger['error'](_0xf09c('0x13'),_0x2d03dc,_0x4d7c4a['error'][_0xf09c('0x1a')]);return _0x58579f(_0x4d7c4a[_0xf09c('0x18')]['message']);}logger[_0xf09c('0x18')](_0xf09c('0x13'),_0x2d03dc,_0x4d7c4a[_0xf09c('0x18')][_0xf09c('0x1a')]);return _0x540d22(_0x4d7c4a[_0xf09c('0x18')][_0xf09c('0x1a')]);}else{logger[_0xf09c('0x12')](_0xf09c('0x13'),_0x2d03dc,_0xf09c('0x16'));_0x540d22(_0x4d7c4a[_0xf09c('0x1b')]['message']);}})['catch'](function(_0x3166d2){logger[_0xf09c('0x18')](_0xf09c('0x13'),_0x2d03dc,_0x3166d2);_0x58579f(_0x3166d2);});});}exports['UpdateChatInteraction']=function(_0x55789a){var _0x29f2ef=this;return new Promise(function(_0x5557a7,_0x107c50){return db['ChatInteraction'][_0xf09c('0x1c')](_0x55789a[_0xf09c('0x1d')],{'raw':_0x55789a[_0xf09c('0x1e')]?_0x55789a['options'][_0xf09c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55789a[_0xf09c('0x1e')]?_0x55789a[_0xf09c('0x1e')]['where']||null:null,'attributes':_0x55789a[_0xf09c('0x1e')]?_0x55789a[_0xf09c('0x1e')]['attributes']||null:null,'limit':_0x55789a[_0xf09c('0x1e')]?_0x55789a[_0xf09c('0x1e')][_0xf09c('0x20')]||null:null})[_0xf09c('0x21')](function(_0x239e64){logger[_0xf09c('0x12')](_0xf09c('0x22'),_0x55789a);logger[_0xf09c('0x14')]('UpdateChatInteraction',_0x55789a,JSON['stringify'](_0x239e64));_0x5557a7(_0x239e64);})[_0xf09c('0x23')](function(_0x4d72bb){logger[_0xf09c('0x18')](_0xf09c('0x22'),_0x4d72bb[_0xf09c('0x1a')],_0x55789a);_0x107c50(_0x29f2ef['error'](0x1f4,_0x4d72bb[_0xf09c('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x4f61a0){return new Promise(function(_0x4105f2,_0x222343){return db[_0xf09c('0x24')][_0xf09c('0x25')]({'where':_0x4f61a0[_0xf09c('0x1e')]?_0x4f61a0[_0xf09c('0x1e')][_0xf09c('0x26')]||null:null})[_0xf09c('0x21')](function(_0x68ef00){if(_0x68ef00){return _0x68ef00['addTags'](_0x4f61a0[_0xf09c('0x1d')][_0xf09c('0x27')],_[_0xf09c('0x28')](_0x4f61a0[_0xf09c('0x1d')],['ids','id'])||{});}})[_0xf09c('0x29')](function(_0x90c4e4){logger[_0xf09c('0x12')](_0xf09c('0x2a'),_0x4f61a0);logger[_0xf09c('0x14')](_0xf09c('0x2a'),_0x4f61a0,JSON['stringify'](_0x90c4e4));_0x4105f2(_0x90c4e4);})['catch'](function(_0x483445){logger['error']('AddTags',_0x483445['message'],_0x4f61a0);_0x222343(_this[_0xf09c('0x18')](0x1f4,_0x483445[_0xf09c('0x1a')]));});});}; \ No newline at end of file +var _0xfd4c=['where','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','UpdateChatInteraction','update','body','options','raw','attributes','AddTagsToChatInteraction','find'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xfd4c,0x1b4));var _0xcfd4=function(_0x1fe435,_0x1bd504){_0x1fe435=_0x1fe435-0x0;var _0x2f9e68=_0xfd4c[_0x1fe435];return _0x2f9e68;};'use strict';var _=require('lodash');var util=require(_0xcfd4('0x0'));var moment=require(_0xcfd4('0x1'));var BPromise=require(_0xcfd4('0x2'));var rs=require(_0xcfd4('0x3'));var fs=require('fs');var Redis=require(_0xcfd4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfd4('0x5'));var logger=require(_0xcfd4('0x6'))('rpc');var config=require(_0xcfd4('0x7'));var jayson=require(_0xcfd4('0x8'));var client=jayson[_0xcfd4('0x9')][_0xcfd4('0xa')]({'port':0x232a});config[_0xcfd4('0xb')]=_['defaults'](config[_0xcfd4('0xb')],{'host':_0xcfd4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcfd4('0xd'))[_0xcfd4('0xe')](socket);function respondWithRpcPromise(_0x386980,_0x4483a8,_0x2415cd){return new BPromise(function(_0x35f7ca,_0x519aee){return client['request'](_0x386980,_0x2415cd)[_0xcfd4('0xf')](function(_0x52626d){logger['info'](_0xcfd4('0x10'),_0x4483a8,'request\x20sent');logger[_0xcfd4('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4483a8,'request\x20sent',JSON[_0xcfd4('0x12')](_0x52626d));if(_0x52626d[_0xcfd4('0x13')]){if(_0x52626d['error'][_0xcfd4('0x14')]===0x1f4){logger[_0xcfd4('0x13')](_0xcfd4('0x10'),_0x4483a8,_0x52626d['error'][_0xcfd4('0x15')]);return _0x519aee(_0x52626d[_0xcfd4('0x13')][_0xcfd4('0x15')]);}logger['error'](_0xcfd4('0x10'),_0x4483a8,_0x52626d[_0xcfd4('0x13')][_0xcfd4('0x15')]);return _0x35f7ca(_0x52626d['error'][_0xcfd4('0x15')]);}else{logger[_0xcfd4('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4483a8,'request\x20sent');_0x35f7ca(_0x52626d['result'][_0xcfd4('0x15')]);}})[_0xcfd4('0x17')](function(_0x5b9193){logger[_0xcfd4('0x13')](_0xcfd4('0x10'),_0x4483a8,_0x5b9193);_0x519aee(_0x5b9193);});});}exports[_0xcfd4('0x18')]=function(_0x5b369d){var _0x18d9fa=this;return new Promise(function(_0x158037,_0x4f8d11){return db['ChatInteraction'][_0xcfd4('0x19')](_0x5b369d[_0xcfd4('0x1a')],{'raw':_0x5b369d['options']?_0x5b369d[_0xcfd4('0x1b')][_0xcfd4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b369d[_0xcfd4('0x1b')]?_0x5b369d['options']['where']||null:null,'attributes':_0x5b369d[_0xcfd4('0x1b')]?_0x5b369d[_0xcfd4('0x1b')][_0xcfd4('0x1d')]||null:null,'limit':_0x5b369d[_0xcfd4('0x1b')]?_0x5b369d[_0xcfd4('0x1b')]['limit']||null:null})[_0xcfd4('0xf')](function(_0x5ed2f6){logger[_0xcfd4('0x16')](_0xcfd4('0x18'),_0x5b369d);logger[_0xcfd4('0x11')](_0xcfd4('0x18'),_0x5b369d,JSON['stringify'](_0x5ed2f6));_0x158037(_0x5ed2f6);})[_0xcfd4('0x17')](function(_0x122f9f){logger[_0xcfd4('0x13')]('UpdateChatInteraction',_0x122f9f[_0xcfd4('0x15')],_0x5b369d);_0x4f8d11(_0x18d9fa[_0xcfd4('0x13')](0x1f4,_0x122f9f[_0xcfd4('0x15')]));});});};exports[_0xcfd4('0x1e')]=function(_0x815cbf){return new Promise(function(_0x51833a,_0x212883){return db['ChatInteraction'][_0xcfd4('0x1f')]({'where':_0x815cbf[_0xcfd4('0x1b')]?_0x815cbf[_0xcfd4('0x1b')][_0xcfd4('0x20')]||null:null})[_0xcfd4('0xf')](function(_0x1510a7){if(_0x1510a7){return _0x1510a7['addTags'](_0x815cbf['body'][_0xcfd4('0x21')],_['omit'](_0x815cbf[_0xcfd4('0x1a')],[_0xcfd4('0x21'),'id'])||{});}})[_0xcfd4('0x22')](function(_0x455da7){logger['info'](_0xcfd4('0x23'),_0x815cbf);logger[_0xcfd4('0x11')]('AddTags',_0x815cbf,JSON['stringify'](_0x455da7));_0x51833a(_0x455da7);})[_0xcfd4('0x17')](function(_0xb15842){logger[_0xcfd4('0x13')](_0xcfd4('0x23'),_0xb15842[_0xcfd4('0x15')],_0x815cbf);_0x212883(_this[_0xcfd4('0x13')](0x1f4,_0xb15842[_0xcfd4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 91286e7..ad7182f 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 _0x65c4=['remove','update','emit','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x5e11d4,_0x402354){var _0x22fa12=function(_0x253693){while(--_0x253693){_0x5e11d4['push'](_0x5e11d4['shift']());}};_0x22fa12(++_0x402354);}(_0x65c4,0x1e1));var _0x465c=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x65c4[_0x26f1b2];return _0x1624a4;};'use strict';var ChatInteractionEvents=require(_0x465c('0x0'));var events=[_0x465c('0x1'),_0x465c('0x2'),_0x465c('0x3')];function createListener(_0x45d81f,_0x5a3066){return function(_0x3a9832){_0x5a3066[_0x465c('0x4')](_0x45d81f,_0x3a9832);};}function removeListener(_0x201ebd,_0x76db3b){return function(){ChatInteractionEvents['removeListener'](_0x201ebd,_0x76db3b);};}exports['register']=function(_0x37a7b5){for(var _0x1cd321=0x0,_0x41bad2=events[_0x465c('0x5')];_0x1cd321<_0x41bad2;_0x1cd321++){var _0x3d7735=events[_0x1cd321];var _0x372957=createListener(_0x465c('0x6')+_0x3d7735,_0x37a7b5);ChatInteractionEvents['on'](_0x3d7735,_0x372957);}}; \ No newline at end of file +var _0x86d1=['chatInteraction:','./chatInteraction.events','save','remove','update','removeListener','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x86d1,0x158));var _0x186d=function(_0x55a8b5,_0x18a413){_0x55a8b5=_0x55a8b5-0x0;var _0x1ddc06=_0x86d1[_0x55a8b5];return _0x1ddc06;};'use strict';var ChatInteractionEvents=require(_0x186d('0x0'));var events=[_0x186d('0x1'),_0x186d('0x2'),_0x186d('0x3')];function createListener(_0x42994f,_0x538255){return function(_0x28df20){_0x538255['emit'](_0x42994f,_0x28df20);};}function removeListener(_0x3286ab,_0x405c4c){return function(){ChatInteractionEvents[_0x186d('0x4')](_0x3286ab,_0x405c4c);};}exports['register']=function(_0x484b1a){for(var _0x1978b0=0x0,_0xac4741=events[_0x186d('0x5')];_0x1978b0<_0xac4741;_0x1978b0++){var _0x13abe8=events[_0x1978b0];var _0x4e4ae8=createListener(_0x186d('0x6')+_0x13abe8,_0x484b1a);ChatInteractionEvents['on'](_0x13abe8,_0x4e4ae8);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index fc0da94..7e2100d 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 _0xcce8=['index','get','/describe','describe','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','createVidaooSession','join','root','server/files/attachments/','format','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','close','delete','/:id','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated'];(function(_0x4df1f5,_0x28ee98){var _0x5bf661=function(_0x103962){while(--_0x103962){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x5bf661(++_0x28ee98);}(_0xcce8,0x1a5));var _0x8cce=function(_0x5e3ba8,_0x330069){_0x5e3ba8=_0x5e3ba8-0x0;var _0x442f6c=_0xcce8[_0x5e3ba8];return _0x442f6c;};'use strict';var multer=require(_0x8cce('0x0'));var util=require(_0x8cce('0x1'));var path=require(_0x8cce('0x2'));var timeout=require(_0x8cce('0x3'));var express=require(_0x8cce('0x4'));var router=express[_0x8cce('0x5')]();var auth=require(_0x8cce('0x6'));var interaction=require(_0x8cce('0x7'));var config=require(_0x8cce('0x8'));var controller=require(_0x8cce('0x9'));router['get']('/',auth[_0x8cce('0xa')](),controller[_0x8cce('0xb')]);router[_0x8cce('0xc')](_0x8cce('0xd'),auth[_0x8cce('0xa')](),controller[_0x8cce('0xe')]);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0x8cce('0xf')]);router['get']('/:id/attachment_download',auth[_0x8cce('0x10')](),controller[_0x8cce('0x11')]);router['get'](_0x8cce('0x12'),auth[_0x8cce('0xa')](),controller[_0x8cce('0x13')]);router['get'](_0x8cce('0x14'),auth[_0x8cce('0x10')](),controller[_0x8cce('0x15')]);router[_0x8cce('0xc')]('/:id/download',auth[_0x8cce('0xa')](),controller[_0x8cce('0x16')]);router[_0x8cce('0x17')]('/',auth[_0x8cce('0xa')](),controller['create']);router[_0x8cce('0x17')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x8cce('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4548a1,_0x3e13e5,_0x13fa21){_0x13fa21(null,path[_0x8cce('0x19')](config[_0x8cce('0x1a')],_0x8cce('0x1b')));},'filename':function(_0xdf18b0,_0x44fd50,_0x30eb60){_0x30eb60(null,util[_0x8cce('0x1c')]('%s-%s',Date[_0x8cce('0x1d')](),_0x44fd50[_0x8cce('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8cce('0x17')](_0x8cce('0x1f'),upload[_0x8cce('0x20')](_0x8cce('0x21')),controller[_0x8cce('0x22')]);router['post'](_0x8cce('0x12'),auth[_0x8cce('0x10')](),controller[_0x8cce('0x23')]);router[_0x8cce('0x17')]('/:id/tags',auth[_0x8cce('0xa')](),interaction['tracked'](_0x8cce('0x24'),_0x8cce('0x25')),controller[_0x8cce('0x26')]);router[_0x8cce('0x27')]('/:id',auth[_0x8cce('0xa')](),interaction[_0x8cce('0x28')](_0x8cce('0x24'),_0x8cce('0x29')),controller[_0x8cce('0x2a')]);router['put'](_0x8cce('0x2b'),controller[_0x8cce('0x2c')]);router[_0x8cce('0x27')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x8cce('0x2d')]);router['put']('/:id/close',controller[_0x8cce('0x2e')]);router[_0x8cce('0x2f')](_0x8cce('0x30'),auth[_0x8cce('0xa')](),interaction[_0x8cce('0x28')](_0x8cce('0x24'),_0x8cce('0x31')),controller[_0x8cce('0x32')]);router[_0x8cce('0x2f')](_0x8cce('0x33'),auth['isAuthenticated'](),controller[_0x8cce('0x34')]);module[_0x8cce('0x35')]=router; \ No newline at end of file +var _0x608a=['join','format','%s-%s','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','/:id','chatinteraction:destroy','delete','removeTags','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','create','post','/:id/vidaoo','diskStorage'];(function(_0xbc26a7,_0x4a735b){var _0x33bd35=function(_0x30cbcd){while(--_0x30cbcd){_0xbc26a7['push'](_0xbc26a7['shift']());}};_0x33bd35(++_0x4a735b);}(_0x608a,0xff));var _0xa608=function(_0x1e5bda,_0x3eb1a6){_0x1e5bda=_0x1e5bda-0x0;var _0x3dc564=_0x608a[_0x1e5bda];return _0x3dc564;};'use strict';var multer=require('multer');var util=require(_0xa608('0x0'));var path=require(_0xa608('0x1'));var timeout=require('connect-timeout');var express=require(_0xa608('0x2'));var router=express[_0xa608('0x3')]();var auth=require(_0xa608('0x4'));var interaction=require(_0xa608('0x5'));var config=require('../../config/environment');var controller=require(_0xa608('0x6'));router[_0xa608('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa608('0x7')]('/describe',auth[_0xa608('0x8')](),controller[_0xa608('0x9')]);router[_0xa608('0x7')]('/:id',auth[_0xa608('0xa')](),controller['show']);router[_0xa608('0x7')](_0xa608('0xb'),auth['isChatInteractionAuthorized'](),controller[_0xa608('0xc')]);router[_0xa608('0x7')](_0xa608('0xd'),auth[_0xa608('0x8')](),controller['getMessages']);router[_0xa608('0x7')](_0xa608('0xe'),auth[_0xa608('0xa')](),controller[_0xa608('0xf')]);router[_0xa608('0x7')]('/:id/download',auth[_0xa608('0x8')](),controller[_0xa608('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa608('0x11')]);router[_0xa608('0x12')](_0xa608('0x13'),auth[_0xa608('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xa608('0x14')]({'destination':function(_0x4564f5,_0x49d154,_0xf4fcf6){_0xf4fcf6(null,path[_0xa608('0x15')](config['root'],'server/files/attachments/'));},'filename':function(_0x577f36,_0x19cc45,_0x473003){_0x473003(null,util[_0xa608('0x16')](_0xa608('0x17'),Date['now'](),_0x19cc45['originalname'][_0xa608('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xa608('0x19'),upload[_0xa608('0x1a')](_0xa608('0x1b')),controller[_0xa608('0x1c')]);router[_0xa608('0x12')](_0xa608('0xd'),auth[_0xa608('0xa')](),controller[_0xa608('0x1d')]);router[_0xa608('0x12')](_0xa608('0x1e'),auth[_0xa608('0x8')](),interaction[_0xa608('0x1f')](_0xa608('0x20'),_0xa608('0x21')),controller['addTags']);router[_0xa608('0x22')]('/:id',auth[_0xa608('0x8')](),interaction[_0xa608('0x1f')](_0xa608('0x20'),_0xa608('0x23')),controller[_0xa608('0x24')]);router[_0xa608('0x22')](_0xa608('0x25'),controller[_0xa608('0x26')]);router[_0xa608('0x22')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0xa608('0x27')]);router[_0xa608('0x22')](_0xa608('0x28'),controller[_0xa608('0x29')]);router['delete'](_0xa608('0x2a'),auth[_0xa608('0x8')](),interaction[_0xa608('0x1f')](_0xa608('0x20'),_0xa608('0x2b')),controller['destroy']);router[_0xa608('0x2c')](_0xa608('0x1e'),auth['isAuthenticated'](),controller[_0xa608('0x2d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 56a74c2..ccbed0d 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3f9cdf,_0x18c564){var _0x4ebf0e=function(_0x485d93){while(--_0x485d93){_0x3f9cdf['push'](_0x3f9cdf['shift']());}};_0x4ebf0e(++_0x18c564);}(_0x5f2f,0x73));var _0xf5f2=function(_0xb52880,_0x528b7c){_0xb52880=_0xb52880-0x0;var _0x3a9123=_0x5f2f[_0xb52880];return _0x3a9123;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x569863,_0x23b4ff){var _0x2e4708=function(_0x938072){while(--_0x938072){_0x569863['push'](_0x569863['shift']());}};_0x2e4708(++_0x23b4ff);}(_0x5f2f,0x73));var _0xf5f2=function(_0x16a201,_0x432c20){_0x16a201=_0x16a201-0x0;var _0x15baac=_0x5f2f[_0x16a201];return _0x15baac;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 0b15eb1..703b6a8 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 _0xde5d=['include','findAll','rows','catch','params','rawAttributes','options','find','create','body','destroy','describe','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','internal','online','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','type','get','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','FromId','-createdAt','all','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','fieldName','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xde5d,0x16c));var _0xdde5=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xde5d[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0xdde5('0x0'));var emlformat=require(_0xdde5('0x1'));var rimraf=require(_0xdde5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdde5('0x3'));var rp=require(_0xdde5('0x4'));var moment=require(_0xdde5('0x5'));var BPromise=require(_0xdde5('0x6'));var Mustache=require(_0xdde5('0x7'));var util=require(_0xdde5('0x8'));var path=require(_0xdde5('0x9'));var sox=require('sox');var csv=require(_0xdde5('0xa'));var ejs=require(_0xdde5('0xb'));var fs=require('fs');var _=require(_0xdde5('0xc'));var squel=require('squel');var crypto=require(_0xdde5('0xd'));var jsforce=require(_0xdde5('0xe'));var deskjs=require(_0xdde5('0xf'));var toCsv=require(_0xdde5('0xa'));var querystring=require(_0xdde5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdde5('0x11'));var qs=require(_0xdde5('0x12'));var as=require(_0xdde5('0x13'));var hardwareService=require(_0xdde5('0x14'));var logger=require('../../config/logger')(_0xdde5('0x15'));var utils=require(_0xdde5('0x16'));var config=require(_0xdde5('0x17'));var db=require(_0xdde5('0x18'))['db'];config[_0xdde5('0x19')]=_[_0xdde5('0x1a')](config[_0xdde5('0x19')],{'host':_0xdde5('0x1b'),'port':0x18eb});var socket=require(_0xdde5('0x1c'))(new Redis(config[_0xdde5('0x19')]));require(_0xdde5('0x1d'))[_0xdde5('0x1e')](socket);function respondWithStatusCode(_0x220246,_0x3f9c21){_0x3f9c21=_0x3f9c21||0xcc;return function(_0x42d4d5){if(_0x42d4d5){return _0x220246['sendStatus'](_0x3f9c21);}return _0x220246['status'](_0x3f9c21)[_0xdde5('0x1f')]();};}function respondWithResult(_0x53eb86,_0x695044){_0x695044=_0x695044||0xc8;return function(_0x1c3192){if(_0x1c3192){return _0x53eb86[_0xdde5('0x20')](_0x695044)[_0xdde5('0x21')](_0x1c3192);}};}function respondWithFilteredResult(_0x31b9eb,_0x25a19d){return function(_0x953823){if(_0x953823){var _0x31fb0f=_0x953823[_0xdde5('0x22')],_0x578322=_0x25a19d[_0xdde5('0x23')],_0x16e9fb=_0x25a19d[_0xdde5('0x23')]+_0x25a19d[_0xdde5('0x24')],_0x289f45;if(_0x16e9fb>=_0x31fb0f){_0x16e9fb=_0x31fb0f;_0x289f45=0xc8;}else{_0x289f45=0xce;}_0x31b9eb[_0xdde5('0x20')](_0x289f45);return _0x31b9eb['set'](_0xdde5('0x25'),_0x578322+'-'+_0x16e9fb+'/'+_0x31fb0f)[_0xdde5('0x21')](_0x953823);}return null;};}function patchUpdates(_0x32f10d){return function(_0x5d9909){try{jsonpatch[_0xdde5('0x26')](_0x5d9909,_0x32f10d,!![]);}catch(_0x44940f){return BPromise[_0xdde5('0x27')](_0x44940f);}return _0x5d9909['save']();};}function saveUpdates(_0x13b680,_0x119ea9){return function(_0x3d6e8a){if(_0x3d6e8a){return _0x3d6e8a[_0xdde5('0x28')](_0x13b680)[_0xdde5('0x29')](function(_0x969a51){return _0x969a51;});}return null;};}function removeEntity(_0x3954a1,_0x834e2f){return function(_0x42ff89){if(_0x42ff89){return _0x42ff89['destroy']()['then'](function(){_0x3954a1[_0xdde5('0x20')](0xcc)[_0xdde5('0x1f')]();});}};}function handleEntityNotFound(_0x555f10,_0x24d704){return function(_0x2447bd){if(!_0x2447bd){_0x555f10[_0xdde5('0x2a')](0x194);}return _0x2447bd;};}function handleError(_0x188b08,_0x395c49){_0x395c49=_0x395c49||0x1f4;return function(_0x5815f4){logger[_0xdde5('0x2b')](_0x5815f4[_0xdde5('0x2c')]);if(_0x5815f4['name']){delete _0x5815f4[_0xdde5('0x2d')];}_0x188b08[_0xdde5('0x20')](_0x395c49)[_0xdde5('0x2e')](_0x5815f4);};}exports[_0xdde5('0x2f')]=function(_0x2eacd0,_0x83f884){var _0x506420={},_0x310159={},_0x56fb7b={'count':0x0,'rows':[]};var _0x4785b3=_[_0xdde5('0x30')](db[_0xdde5('0x31')]['rawAttributes'],function(_0x1e4cb1){return{'name':_0x1e4cb1[_0xdde5('0x32')],'type':_0x1e4cb1['type']['key']};});_0x310159['model']=_[_0xdde5('0x30')](_0x4785b3,_0xdde5('0x2d'));_0x310159[_0xdde5('0x33')]=_[_0xdde5('0x34')](_0x2eacd0[_0xdde5('0x33')]);_0x310159[_0xdde5('0x35')]=_['intersection'](_0x310159[_0xdde5('0x36')],_0x310159[_0xdde5('0x33')]);_0x506420['attributes']=_[_0xdde5('0x37')](_0x310159[_0xdde5('0x36')],qs[_0xdde5('0x38')](_0x2eacd0[_0xdde5('0x33')][_0xdde5('0x38')]));_0x506420[_0xdde5('0x39')]=_0x506420[_0xdde5('0x39')][_0xdde5('0x3a')]?_0x506420[_0xdde5('0x39')]:_0x310159[_0xdde5('0x36')];if(!_0x2eacd0[_0xdde5('0x33')][_0xdde5('0x3b')](_0xdde5('0x3c'))){_0x506420[_0xdde5('0x24')]=qs[_0xdde5('0x24')](_0x2eacd0[_0xdde5('0x33')][_0xdde5('0x24')]);_0x506420[_0xdde5('0x23')]=qs[_0xdde5('0x23')](_0x2eacd0[_0xdde5('0x33')][_0xdde5('0x23')]);}_0x506420['order']=qs[_0xdde5('0x3d')](_0x2eacd0[_0xdde5('0x33')][_0xdde5('0x3d')]);_0x506420['where']=qs[_0xdde5('0x35')](_[_0xdde5('0x3e')](_0x2eacd0[_0xdde5('0x33')],_0x310159[_0xdde5('0x35')]),_0x4785b3);if(_0x2eacd0[_0xdde5('0x33')][_0xdde5('0x3f')]){_0x506420[_0xdde5('0x40')]=_[_0xdde5('0x41')](_0x506420['where'],{'$or':_[_0xdde5('0x30')](_0x4785b3,function(_0x3159f8){if(_0x3159f8['type']!==_0xdde5('0x42')){var _0x21dc9c={};_0x21dc9c[_0x3159f8['name']]={'$like':'%'+_0x2eacd0[_0xdde5('0x33')][_0xdde5('0x3f')]+'%'};return _0x21dc9c;}})});}_0x506420=_[_0xdde5('0x41')]({},_0x506420,_0x2eacd0['options']);var _0x42aba2={'where':_0x506420['where']};return db[_0xdde5('0x31')][_0xdde5('0x22')](_0x42aba2)[_0xdde5('0x29')](function(_0x1f6cbe){_0x56fb7b[_0xdde5('0x22')]=_0x1f6cbe;if(_0x2eacd0[_0xdde5('0x33')][_0xdde5('0x43')]){_0x506420[_0xdde5('0x44')]=[{'all':!![]}];}return db[_0xdde5('0x31')][_0xdde5('0x45')](_0x506420);})[_0xdde5('0x29')](function(_0x751d04){_0x56fb7b[_0xdde5('0x46')]=_0x751d04;return _0x56fb7b;})[_0xdde5('0x29')](respondWithFilteredResult(_0x83f884,_0x506420))[_0xdde5('0x47')](handleError(_0x83f884,null));};exports['show']=function(_0x3fc4c7,_0x4267ab){var _0x59a2db={'raw':!![],'where':{'id':_0x3fc4c7[_0xdde5('0x48')]['id']}},_0xfe376={};_0xfe376[_0xdde5('0x36')]=_[_0xdde5('0x34')](db[_0xdde5('0x31')][_0xdde5('0x49')]);_0xfe376[_0xdde5('0x33')]=_[_0xdde5('0x34')](_0x3fc4c7[_0xdde5('0x33')]);_0xfe376[_0xdde5('0x35')]=_[_0xdde5('0x37')](_0xfe376[_0xdde5('0x36')],_0xfe376['query']);_0x59a2db[_0xdde5('0x39')]=_[_0xdde5('0x37')](_0xfe376[_0xdde5('0x36')],qs[_0xdde5('0x38')](_0x3fc4c7['query'][_0xdde5('0x38')]));_0x59a2db[_0xdde5('0x39')]=_0x59a2db[_0xdde5('0x39')][_0xdde5('0x3a')]?_0x59a2db[_0xdde5('0x39')]:_0xfe376[_0xdde5('0x36')];if(_0x3fc4c7[_0xdde5('0x33')][_0xdde5('0x43')]){_0x59a2db[_0xdde5('0x44')]=[{'all':!![]}];}_0x59a2db=_[_0xdde5('0x41')]({},_0x59a2db,_0x3fc4c7[_0xdde5('0x4a')]);return db['ChatInternalMessage'][_0xdde5('0x4b')](_0x59a2db)['then'](handleEntityNotFound(_0x4267ab,null))[_0xdde5('0x29')](respondWithResult(_0x4267ab,null))[_0xdde5('0x47')](handleError(_0x4267ab,null));};exports[_0xdde5('0x4c')]=function(_0x2915ae,_0x5a0ee1){return db[_0xdde5('0x31')][_0xdde5('0x4c')](_0x2915ae[_0xdde5('0x4d')],{})[_0xdde5('0x29')](respondWithResult(_0x5a0ee1,0xc9))['catch'](handleError(_0x5a0ee1,null));};exports['update']=function(_0x42b8ea,_0x5a39b4){if(_0x42b8ea[_0xdde5('0x4d')]['id']){delete _0x42b8ea[_0xdde5('0x4d')]['id'];}return db['ChatInternalMessage'][_0xdde5('0x4b')]({'where':{'id':_0x42b8ea[_0xdde5('0x48')]['id']}})[_0xdde5('0x29')](handleEntityNotFound(_0x5a39b4,null))[_0xdde5('0x29')](saveUpdates(_0x42b8ea[_0xdde5('0x4d')],null))[_0xdde5('0x29')](respondWithResult(_0x5a39b4,null))[_0xdde5('0x47')](handleError(_0x5a39b4,null));};exports[_0xdde5('0x4e')]=function(_0x190d9c,_0x32192a){return db['ChatInternalMessage'][_0xdde5('0x4b')]({'where':{'id':_0x190d9c[_0xdde5('0x48')]['id']}})[_0xdde5('0x29')](handleEntityNotFound(_0x32192a,null))[_0xdde5('0x29')](removeEntity(_0x32192a,null))[_0xdde5('0x47')](handleError(_0x32192a,null));};exports[_0xdde5('0x4f')]=function(_0x11439e,_0x3ff205){return db[_0xdde5('0x31')][_0xdde5('0x4f')]()[_0xdde5('0x29')](respondWithResult(_0x3ff205,null))[_0xdde5('0x47')](handleError(_0x3ff205,null));};function wrapUser(_0x3e782c){return function(_0x45f761){var _0x422bb9=_0x3e782c['get']({'plain':!![]});_0x422bb9['messages']=[];if(_0x45f761){_0x422bb9[_0xdde5('0x50')]=_0x45f761[_0xdde5('0x51')];_0x422bb9['lastMessage']=_0x45f761;}else{_0x422bb9['lastMessageAt']=moment(0x0)[_0xdde5('0x52')](_0xdde5('0x53'));_0x422bb9[_0xdde5('0x54')]={};}return _0x422bb9;};}exports[_0xdde5('0x55')]=function(_0x408838,_0x4ae51a,_0x3e1b35){var _0x161043=[];return db['User'][_0xdde5('0x45')]({'where':{'role':[_0xdde5('0x56'),_0xdde5('0x57'),_0xdde5('0x58')]},'attributes':['id',_0xdde5('0x59'),_0xdde5('0x2d'),_0xdde5('0x5a'),'userpic',_0xdde5('0x5b'),_0xdde5('0x5c'),'lastLoginAt',_0xdde5('0x5d'),_0xdde5('0x5e')],'order':qs[_0xdde5('0x3d')]('-online'),'include':[{'model':db[_0xdde5('0x5f')],'as':_0xdde5('0x60'),'attributes':['id','name',_0xdde5('0x61')],'through':{'attributes':[]}}]})[_0xdde5('0x29')](function(_0x230c41){if(_0x230c41){var _0x9b0620=_0x408838['user'][_0xdde5('0x62')]({'plain':!![]});if(!_0x9b0620)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9b0620[_0xdde5('0x5a')]===_0xdde5('0x58')){return db['UserProfileSection'][_0xdde5('0x4b')]({'where':{'name':'Agents','userProfileId':_0x9b0620['userProfileId']},'raw':!![]})['then'](function(_0x510806){if(_0x510806){if(_0x510806[_0xdde5('0x63')]===0x0){return db[_0xdde5('0x64')][_0xdde5('0x45')]({'where':{'sectionId':_0x510806['id']},'raw':!![]})[_0xdde5('0x29')](function(_0x1fa485){var _0x2e35f5=[];if(_[_0xdde5('0x65')](_0x1fa485)){_0x2e35f5=_[_0xdde5('0x3f')](_0x230c41,function(_0x1ba94d){if(_0x1ba94d['role']!==_0xdde5('0x56')){return _0x1ba94d;}});return _0x2e35f5;}else{for(var _0x2a9368=0x0;_0x2a9368<_0x230c41[_0xdde5('0x3a')];_0x2a9368++){var _0x1feb22=_0x230c41[_0x2a9368];if(_0x1feb22['role']===_0xdde5('0x56')){var _0x281f8e=_[_0xdde5('0x4b')](_0x1fa485,function(_0x2c6fd2){return _0x2c6fd2[_0xdde5('0x66')]===_0x1feb22['id'];});if(_0x281f8e)_0x2e35f5[_0xdde5('0x67')](_0x1feb22);}else{_0x2e35f5[_0xdde5('0x67')](_0x1feb22);}}return _0x2e35f5;}});}else{return _0x230c41;}}else{var _0x26e525=_['filter'](_0x230c41,function(_0x69f553){if(_0x69f553[_0xdde5('0x5a')]!==_0xdde5('0x56')){return _0x69f553;}});return _0x26e525;}});}else{return _0x230c41;}}})[_0xdde5('0x29')](function(_0x3b9d4c){var _0x3da073=[];if(_0x3b9d4c){_0x161043=_0x3b9d4c;for(var _0x1a19e5=0x0;_0x1a19e5<_0x3b9d4c[_0xdde5('0x3a')];_0x1a19e5+=0x1){_0x161043[_0x1a19e5][_0xdde5('0x68')]=[];_0x3da073[_0xdde5('0x67')](db[_0xdde5('0x31')][_0xdde5('0x4b')]({'where':{'FromId':[_0x408838[_0xdde5('0x58')]['id'],_0x3b9d4c[_0x1a19e5]['id']],'ToId':[_0x408838[_0xdde5('0x58')]['id'],_0x3b9d4c[_0x1a19e5]['id']],'ChatGroupId':null},'attributes':['id',_0xdde5('0x51'),_0xdde5('0x69'),'ToId','read','body'],'order':qs[_0xdde5('0x3d')](_0xdde5('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xdde5('0x29')](wrapUser(_0x3b9d4c[_0x1a19e5])));}return BPromise[_0xdde5('0x6b')](_0x3da073);}return[];})[_0xdde5('0x29')](function(_0x1c6b3d){return{'rows':_0x1c6b3d,'count':_0x1c6b3d[_0xdde5('0x3a')]};})[_0xdde5('0x29')](respondWithResult(_0x4ae51a,null))[_0xdde5('0x47')](handleError(_0x4ae51a,null));}; \ No newline at end of file +var _0xa827=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','limit','json','save','update','then','destroy','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','keys','find','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x443468,_0x5c8c24){var _0xb723f=function(_0x405bd9){while(--_0x405bd9){_0x443468['push'](_0x443468['shift']());}};_0xb723f(++_0x5c8c24);}(_0xa827,0xc6));var _0x7a82=function(_0x5f5df5,_0x52587e){_0x5f5df5=_0x5f5df5-0x0;var _0x17acaa=_0xa827[_0x5f5df5];return _0x17acaa;};'use strict';var pdf=require(_0x7a82('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7a82('0x1'));var zipdir=require(_0x7a82('0x2'));var jsonpatch=require(_0x7a82('0x3'));var rp=require(_0x7a82('0x4'));var moment=require('moment');var BPromise=require(_0x7a82('0x5'));var Mustache=require(_0x7a82('0x6'));var util=require(_0x7a82('0x7'));var path=require(_0x7a82('0x8'));var sox=require(_0x7a82('0x9'));var csv=require('to-csv');var ejs=require(_0x7a82('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7a82('0xb'));var crypto=require(_0x7a82('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a82('0xd'));var querystring=require(_0x7a82('0xe'));var Papa=require('papaparse');var Redis=require(_0x7a82('0xf'));var authService=require(_0x7a82('0x10'));var qs=require(_0x7a82('0x11'));var as=require(_0x7a82('0x12'));var hardwareService=require(_0x7a82('0x13'));var logger=require(_0x7a82('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7a82('0x15'))['db'];config[_0x7a82('0x16')]=_[_0x7a82('0x17')](config[_0x7a82('0x16')],{'host':_0x7a82('0x18'),'port':0x18eb});var socket=require(_0x7a82('0x19'))(new Redis(config[_0x7a82('0x16')]));require(_0x7a82('0x1a'))[_0x7a82('0x1b')](socket);function respondWithStatusCode(_0xf8e823,_0xecad0a){_0xecad0a=_0xecad0a||0xcc;return function(_0x3ef512){if(_0x3ef512){return _0xf8e823[_0x7a82('0x1c')](_0xecad0a);}return _0xf8e823[_0x7a82('0x1d')](_0xecad0a)[_0x7a82('0x1e')]();};}function respondWithResult(_0xf37e68,_0xedd610){_0xedd610=_0xedd610||0xc8;return function(_0x80e760){if(_0x80e760){return _0xf37e68[_0x7a82('0x1d')](_0xedd610)['json'](_0x80e760);}};}function respondWithFilteredResult(_0x11c891,_0x58eeeb){return function(_0x516fad){if(_0x516fad){var _0x185117=_0x516fad['count'],_0x292935=_0x58eeeb[_0x7a82('0x1f')],_0x4a379b=_0x58eeeb[_0x7a82('0x1f')]+_0x58eeeb[_0x7a82('0x20')],_0x4e26fd;if(_0x4a379b>=_0x185117){_0x4a379b=_0x185117;_0x4e26fd=0xc8;}else{_0x4e26fd=0xce;}_0x11c891['status'](_0x4e26fd);return _0x11c891['set']('Content-Range',_0x292935+'-'+_0x4a379b+'/'+_0x185117)[_0x7a82('0x21')](_0x516fad);}return null;};}function patchUpdates(_0x20dff2){return function(_0x177cff){try{jsonpatch['apply'](_0x177cff,_0x20dff2,!![]);}catch(_0x3bb7e9){return BPromise['reject'](_0x3bb7e9);}return _0x177cff[_0x7a82('0x22')]();};}function saveUpdates(_0x11c4ec,_0x2cdfec){return function(_0x378a6d){if(_0x378a6d){return _0x378a6d[_0x7a82('0x23')](_0x11c4ec)[_0x7a82('0x24')](function(_0x2f4cd5){return _0x2f4cd5;});}return null;};}function removeEntity(_0x152e35,_0x3550dd){return function(_0x3f4bb7){if(_0x3f4bb7){return _0x3f4bb7[_0x7a82('0x25')]()['then'](function(){_0x152e35[_0x7a82('0x1d')](0xcc)[_0x7a82('0x1e')]();});}};}function handleEntityNotFound(_0x3a1bad,_0x4121da){return function(_0x2a8431){if(!_0x2a8431){_0x3a1bad['sendStatus'](0x194);}return _0x2a8431;};}function handleError(_0xf9a718,_0x56b77c){_0x56b77c=_0x56b77c||0x1f4;return function(_0x505c6c){logger['error'](_0x505c6c['stack']);if(_0x505c6c[_0x7a82('0x26')]){delete _0x505c6c['name'];}_0xf9a718[_0x7a82('0x1d')](_0x56b77c)[_0x7a82('0x27')](_0x505c6c);};}exports[_0x7a82('0x28')]=function(_0x243bad,_0xea5965){var _0x1f5768={},_0x58b549={},_0x19ad80={'count':0x0,'rows':[]};var _0x27c980=_[_0x7a82('0x29')](db[_0x7a82('0x2a')][_0x7a82('0x2b')],function(_0x329990){return{'name':_0x329990[_0x7a82('0x2c')],'type':_0x329990[_0x7a82('0x2d')][_0x7a82('0x2e')]};});_0x58b549[_0x7a82('0x2f')]=_['map'](_0x27c980,_0x7a82('0x26'));_0x58b549[_0x7a82('0x30')]=_['keys'](_0x243bad[_0x7a82('0x30')]);_0x58b549['filters']=_[_0x7a82('0x31')](_0x58b549[_0x7a82('0x2f')],_0x58b549['query']);_0x1f5768[_0x7a82('0x32')]=_[_0x7a82('0x31')](_0x58b549[_0x7a82('0x2f')],qs[_0x7a82('0x33')](_0x243bad[_0x7a82('0x30')][_0x7a82('0x33')]));_0x1f5768[_0x7a82('0x32')]=_0x1f5768[_0x7a82('0x32')][_0x7a82('0x34')]?_0x1f5768['attributes']:_0x58b549['model'];if(!_0x243bad[_0x7a82('0x30')][_0x7a82('0x35')](_0x7a82('0x36'))){_0x1f5768[_0x7a82('0x20')]=qs[_0x7a82('0x20')](_0x243bad[_0x7a82('0x30')][_0x7a82('0x20')]);_0x1f5768[_0x7a82('0x1f')]=qs['offset'](_0x243bad[_0x7a82('0x30')][_0x7a82('0x1f')]);}_0x1f5768[_0x7a82('0x37')]=qs[_0x7a82('0x38')](_0x243bad[_0x7a82('0x30')][_0x7a82('0x38')]);_0x1f5768[_0x7a82('0x39')]=qs[_0x7a82('0x3a')](_[_0x7a82('0x3b')](_0x243bad['query'],_0x58b549[_0x7a82('0x3a')]),_0x27c980);if(_0x243bad[_0x7a82('0x30')][_0x7a82('0x3c')]){_0x1f5768[_0x7a82('0x39')]=_[_0x7a82('0x3d')](_0x1f5768['where'],{'$or':_[_0x7a82('0x29')](_0x27c980,function(_0x30ced7){if(_0x30ced7[_0x7a82('0x2d')]!=='VIRTUAL'){var _0x55b3c7={};_0x55b3c7[_0x30ced7['name']]={'$like':'%'+_0x243bad[_0x7a82('0x30')][_0x7a82('0x3c')]+'%'};return _0x55b3c7;}})});}_0x1f5768=_['merge']({},_0x1f5768,_0x243bad[_0x7a82('0x3e')]);var _0x1a3fef={'where':_0x1f5768['where']};return db['ChatInternalMessage'][_0x7a82('0x3f')](_0x1a3fef)['then'](function(_0x4a0781){_0x19ad80[_0x7a82('0x3f')]=_0x4a0781;if(_0x243bad[_0x7a82('0x30')][_0x7a82('0x40')]){_0x1f5768[_0x7a82('0x41')]=[{'all':!![]}];}return db[_0x7a82('0x2a')][_0x7a82('0x42')](_0x1f5768);})[_0x7a82('0x24')](function(_0x5de60b){_0x19ad80['rows']=_0x5de60b;return _0x19ad80;})[_0x7a82('0x24')](respondWithFilteredResult(_0xea5965,_0x1f5768))[_0x7a82('0x43')](handleError(_0xea5965,null));};exports[_0x7a82('0x44')]=function(_0x29c6fa,_0x50e2c9){var _0x33a25c={'raw':!![],'where':{'id':_0x29c6fa[_0x7a82('0x45')]['id']}},_0x1a92f9={};_0x1a92f9[_0x7a82('0x2f')]=_[_0x7a82('0x46')](db[_0x7a82('0x2a')][_0x7a82('0x2b')]);_0x1a92f9[_0x7a82('0x30')]=_[_0x7a82('0x46')](_0x29c6fa[_0x7a82('0x30')]);_0x1a92f9[_0x7a82('0x3a')]=_[_0x7a82('0x31')](_0x1a92f9[_0x7a82('0x2f')],_0x1a92f9['query']);_0x33a25c['attributes']=_[_0x7a82('0x31')](_0x1a92f9[_0x7a82('0x2f')],qs[_0x7a82('0x33')](_0x29c6fa[_0x7a82('0x30')][_0x7a82('0x33')]));_0x33a25c[_0x7a82('0x32')]=_0x33a25c[_0x7a82('0x32')][_0x7a82('0x34')]?_0x33a25c['attributes']:_0x1a92f9[_0x7a82('0x2f')];if(_0x29c6fa['query'][_0x7a82('0x40')]){_0x33a25c[_0x7a82('0x41')]=[{'all':!![]}];}_0x33a25c=_[_0x7a82('0x3d')]({},_0x33a25c,_0x29c6fa[_0x7a82('0x3e')]);return db[_0x7a82('0x2a')][_0x7a82('0x47')](_0x33a25c)[_0x7a82('0x24')](handleEntityNotFound(_0x50e2c9,null))[_0x7a82('0x24')](respondWithResult(_0x50e2c9,null))[_0x7a82('0x43')](handleError(_0x50e2c9,null));};exports['create']=function(_0x814a94,_0x31db5c){return db[_0x7a82('0x2a')]['create'](_0x814a94[_0x7a82('0x48')],{})[_0x7a82('0x24')](respondWithResult(_0x31db5c,0xc9))['catch'](handleError(_0x31db5c,null));};exports[_0x7a82('0x23')]=function(_0x33ace1,_0x4ec749){if(_0x33ace1['body']['id']){delete _0x33ace1['body']['id'];}return db['ChatInternalMessage'][_0x7a82('0x47')]({'where':{'id':_0x33ace1['params']['id']}})[_0x7a82('0x24')](handleEntityNotFound(_0x4ec749,null))[_0x7a82('0x24')](saveUpdates(_0x33ace1[_0x7a82('0x48')],null))[_0x7a82('0x24')](respondWithResult(_0x4ec749,null))[_0x7a82('0x43')](handleError(_0x4ec749,null));};exports[_0x7a82('0x25')]=function(_0x6b3557,_0x4c9f44){return db['ChatInternalMessage'][_0x7a82('0x47')]({'where':{'id':_0x6b3557[_0x7a82('0x45')]['id']}})[_0x7a82('0x24')](handleEntityNotFound(_0x4c9f44,null))[_0x7a82('0x24')](removeEntity(_0x4c9f44,null))[_0x7a82('0x43')](handleError(_0x4c9f44,null));};exports[_0x7a82('0x49')]=function(_0x51af68,_0x4e7e14){return db[_0x7a82('0x2a')][_0x7a82('0x49')]()['then'](respondWithResult(_0x4e7e14,null))[_0x7a82('0x43')](handleError(_0x4e7e14,null));};function wrapUser(_0x2c6fcd){return function(_0x5c3e04){var _0x3a20a6=_0x2c6fcd['get']({'plain':!![]});_0x3a20a6[_0x7a82('0x4a')]=[];if(_0x5c3e04){_0x3a20a6[_0x7a82('0x4b')]=_0x5c3e04[_0x7a82('0x4c')];_0x3a20a6[_0x7a82('0x4d')]=_0x5c3e04;}else{_0x3a20a6['lastMessageAt']=moment(0x0)[_0x7a82('0x4e')](_0x7a82('0x4f'));_0x3a20a6[_0x7a82('0x4d')]={};}return _0x3a20a6;};}exports[_0x7a82('0x50')]=function(_0x1adde0,_0x1bff9a,_0x55e7ed){var _0x1ec196=[];return db[_0x7a82('0x51')][_0x7a82('0x42')]({'where':{'role':[_0x7a82('0x52'),_0x7a82('0x53'),_0x7a82('0x54')]},'attributes':['id',_0x7a82('0x55'),'name',_0x7a82('0x56'),_0x7a82('0x57'),_0x7a82('0x58'),_0x7a82('0x59'),'lastLoginAt',_0x7a82('0x5a'),_0x7a82('0x5b')],'order':qs[_0x7a82('0x38')](_0x7a82('0x5c')),'include':[{'model':db[_0x7a82('0x5d')],'as':'VoiceQueues','attributes':['id','name',_0x7a82('0x2d')],'through':{'attributes':[]}}]})[_0x7a82('0x24')](function(_0x3fe615){if(_0x3fe615){var _0x29f0a4=_0x1adde0['user'][_0x7a82('0x5e')]({'plain':!![]});if(!_0x29f0a4)throw new Error(_0x7a82('0x5f'));if(_0x29f0a4['role']===_0x7a82('0x54')){return db[_0x7a82('0x60')]['find']({'where':{'name':_0x7a82('0x61'),'userProfileId':_0x29f0a4[_0x7a82('0x62')]},'raw':!![]})[_0x7a82('0x24')](function(_0x8d47db){if(_0x8d47db){if(_0x8d47db[_0x7a82('0x63')]===0x0){return db['UserProfileResource'][_0x7a82('0x42')]({'where':{'sectionId':_0x8d47db['id']},'raw':!![]})[_0x7a82('0x24')](function(_0x5314db){var _0x156153=[];if(_[_0x7a82('0x64')](_0x5314db)){_0x156153=_[_0x7a82('0x3c')](_0x3fe615,function(_0x481a61){if(_0x481a61[_0x7a82('0x56')]!==_0x7a82('0x52')){return _0x481a61;}});return _0x156153;}else{for(var _0x1df34c=0x0;_0x1df34c<_0x3fe615[_0x7a82('0x34')];_0x1df34c++){var _0x39d147=_0x3fe615[_0x1df34c];if(_0x39d147[_0x7a82('0x56')]===_0x7a82('0x52')){var _0x3d57fc=_[_0x7a82('0x47')](_0x5314db,function(_0x56b905){return _0x56b905[_0x7a82('0x65')]===_0x39d147['id'];});if(_0x3d57fc)_0x156153[_0x7a82('0x66')](_0x39d147);}else{_0x156153[_0x7a82('0x66')](_0x39d147);}}return _0x156153;}});}else{return _0x3fe615;}}else{var _0x290308=_[_0x7a82('0x3c')](_0x3fe615,function(_0x281ba0){if(_0x281ba0[_0x7a82('0x56')]!=='agent'){return _0x281ba0;}});return _0x290308;}});}else{return _0x3fe615;}}})[_0x7a82('0x24')](function(_0x5161d8){var _0x25b7be=[];if(_0x5161d8){_0x1ec196=_0x5161d8;for(var _0x50df09=0x0;_0x50df09<_0x5161d8[_0x7a82('0x34')];_0x50df09+=0x1){_0x1ec196[_0x50df09][_0x7a82('0x4a')]=[];_0x25b7be[_0x7a82('0x66')](db[_0x7a82('0x2a')][_0x7a82('0x47')]({'where':{'FromId':[_0x1adde0['user']['id'],_0x5161d8[_0x50df09]['id']],'ToId':[_0x1adde0[_0x7a82('0x54')]['id'],_0x5161d8[_0x50df09]['id']],'ChatGroupId':null},'attributes':['id',_0x7a82('0x4c'),_0x7a82('0x67'),_0x7a82('0x68'),_0x7a82('0x69'),_0x7a82('0x48')],'order':qs[_0x7a82('0x38')](_0x7a82('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7a82('0x24')](wrapUser(_0x5161d8[_0x50df09])));}return BPromise[_0x7a82('0x6b')](_0x25b7be);}return[];})[_0x7a82('0x24')](function(_0x1e2a62){return{'rows':_0x1e2a62,'count':_0x1e2a62[_0x7a82('0x34')]};})['then'](respondWithResult(_0x1bff9a,null))['catch'](handleError(_0x1bff9a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0e30a9b..ee23bd6 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 _0x34ab=['ChatInternalMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x61543e,_0x11ec29){var _0x50d91b=function(_0x345dfb){while(--_0x345dfb){_0x61543e['push'](_0x61543e['shift']());}};_0x50d91b(++_0x11ec29);}(_0x34ab,0xf1));var _0xb34a=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x34ab[_0x15876a];return _0xbd900f;};'use strict';var EventEmitter=require(_0xb34a('0x0'));var ChatInternalMessage=require(_0xb34a('0x1'))['db'][_0xb34a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb34a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb34a('0x4')};function emitEvent(_0x54ca38){return function(_0x32ef74,_0x34ac6c,_0x46ba33){ChatInternalMessageEvents['emit'](_0x54ca38+':'+_0x32ef74['id'],_0x32ef74);ChatInternalMessageEvents[_0xb34a('0x5')](_0x54ca38,_0x32ef74);_0x46ba33(null);};}for(var e in events){if(events[_0xb34a('0x6')](e)){var event=events[e];ChatInternalMessage[_0xb34a('0x7')](e,emitEvent(event));}}module[_0xb34a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x6fc4=['hasOwnProperty','hook','exports','events','../../mysqldb','save','emit'];(function(_0x3d2580,_0x5bcf59){var _0x1bed34=function(_0x4838e5){while(--_0x4838e5){_0x3d2580['push'](_0x3d2580['shift']());}};_0x1bed34(++_0x5bcf59);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x1278b6,_0x24252e){_0x1278b6=_0x1278b6-0x0;var _0x2cff42=_0x6fc4[_0x1278b6];return _0x2cff42;};'use strict';var EventEmitter=require(_0x46fc('0x0'));var ChatInternalMessage=require(_0x46fc('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x46fc('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e3ca5){return function(_0x34e479,_0x27d5dd,_0x13b05b){ChatInternalMessageEvents[_0x46fc('0x3')](_0x4e3ca5+':'+_0x34e479['id'],_0x34e479);ChatInternalMessageEvents[_0x46fc('0x3')](_0x4e3ca5,_0x34e479);_0x13b05b(null);};}for(var e in events){if(events[_0x46fc('0x4')](e)){var event=events[e];ChatInternalMessage[_0x46fc('0x5')](e,emitEvent(event));}}module[_0x46fc('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c9a9ab6..88ea4be 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 _0xea2e=['../../config/environment','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4a32e4,_0x18dffe){var _0x23e5b9=function(_0x44d47c){while(--_0x44d47c){_0x4a32e4['push'](_0x4a32e4['shift']());}};_0x23e5b9(++_0x18dffe);}(_0xea2e,0x13a));var _0xeea2=function(_0x2ee004,_0x302542){_0x2ee004=_0x2ee004-0x0;var _0x28b89f=_0xea2e[_0x2ee004];return _0x28b89f;};'use strict';var _=require(_0xeea2('0x0'));var util=require(_0xeea2('0x1'));var logger=require(_0xeea2('0x2'))(_0xeea2('0x3'));var moment=require(_0xeea2('0x4'));var BPromise=require('bluebird');var rp=require(_0xeea2('0x5'));var fs=require('fs');var path=require(_0xeea2('0x6'));var rimraf=require(_0xeea2('0x7'));var config=require(_0xeea2('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0xeea2('0x9')]=function(_0x347314,_0x27e89d){return _0x347314[_0xeea2('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xeea2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeea2('0xc'),'collate':_0xeea2('0xd')});}; \ No newline at end of file +var _0xb4db=['moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb4db,0x130));var _0xbb4d=function(_0x52a664,_0x2716ad){_0x52a664=_0x52a664-0x0;var _0x18e9fb=_0xb4db[_0x52a664];return _0x18e9fb;};'use strict';var _=require(_0xbb4d('0x0'));var util=require(_0xbb4d('0x1'));var logger=require(_0xbb4d('0x2'))(_0xbb4d('0x3'));var moment=require(_0xbb4d('0x4'));var BPromise=require(_0xbb4d('0x5'));var rp=require(_0xbb4d('0x6'));var fs=require('fs');var path=require(_0xbb4d('0x7'));var rimraf=require('rimraf');var config=require(_0xbb4d('0x8'));var attributes=require(_0xbb4d('0x9'));module[_0xbb4d('0xa')]=function(_0x32271c,_0x31e99b){return _0x32271c['define']('ChatInternalMessage',attributes,{'tableName':_0xbb4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb4d('0xc'),'collate':_0xbb4d('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index fe111e1..3fc37a9 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 _0x8503=['request','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x2999da,_0x362bc9){var _0x266257=function(_0x145ef6){while(--_0x145ef6){_0x2999da['push'](_0x2999da['shift']());}};_0x266257(++_0x362bc9);}(_0x8503,0x185));var _0x3850=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8503[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x3850('0x0'));var util=require(_0x3850('0x1'));var moment=require(_0x3850('0x2'));var BPromise=require(_0x3850('0x3'));var rs=require(_0x3850('0x4'));var fs=require('fs');var Redis=require(_0x3850('0x5'));var db=require(_0x3850('0x6'))['db'];var utils=require(_0x3850('0x7'));var logger=require(_0x3850('0x8'))(_0x3850('0x9'));var config=require('../../config/environment');var jayson=require(_0x3850('0xa'));var client=jayson[_0x3850('0xb')][_0x3850('0xc')]({'port':0x232a});config[_0x3850('0xd')]=_['defaults'](config[_0x3850('0xd')],{'host':_0x3850('0xe'),'port':0x18eb});var socket=require(_0x3850('0xf'))(new Redis(config[_0x3850('0xd')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3abd0a,_0x5f5dc2,_0x1415e6){return new BPromise(function(_0x5b808a,_0x5128f5){return client[_0x3850('0x10')](_0x3abd0a,_0x1415e6)['then'](function(_0x29aea3){logger[_0x3850('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f5dc2,'request\x20sent');logger[_0x3850('0x12')](_0x3850('0x13'),_0x5f5dc2,_0x3850('0x14'),JSON[_0x3850('0x15')](_0x29aea3));if(_0x29aea3[_0x3850('0x16')]){if(_0x29aea3[_0x3850('0x16')]['code']===0x1f4){logger[_0x3850('0x16')](_0x3850('0x17'),_0x5f5dc2,_0x29aea3[_0x3850('0x16')][_0x3850('0x18')]);return _0x5128f5(_0x29aea3[_0x3850('0x16')][_0x3850('0x18')]);}logger[_0x3850('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f5dc2,_0x29aea3[_0x3850('0x16')][_0x3850('0x18')]);return _0x5b808a(_0x29aea3[_0x3850('0x16')]['message']);}else{logger[_0x3850('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f5dc2,'request\x20sent');_0x5b808a(_0x29aea3[_0x3850('0x19')][_0x3850('0x18')]);}})[_0x3850('0x1a')](function(_0x53d246){logger[_0x3850('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f5dc2,_0x53d246);_0x5128f5(_0x53d246);});});} \ No newline at end of file +var _0x9fc1=['redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xc6436,_0x45a5eb){var _0x473f3c=function(_0x57f325){while(--_0x57f325){_0xc6436['push'](_0xc6436['shift']());}};_0x473f3c(++_0x45a5eb);}(_0x9fc1,0x199));var _0x19fc=function(_0x50304a,_0x32b93a){_0x50304a=_0x50304a-0x0;var _0x4e2c52=_0x9fc1[_0x50304a];return _0x4e2c52;};'use strict';var _=require(_0x19fc('0x0'));var util=require(_0x19fc('0x1'));var moment=require(_0x19fc('0x2'));var BPromise=require(_0x19fc('0x3'));var rs=require(_0x19fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19fc('0x6'))(_0x19fc('0x7'));var config=require(_0x19fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x19fc('0x9')][_0x19fc('0xa')]({'port':0x232a});config[_0x19fc('0xb')]=_['defaults'](config[_0x19fc('0xb')],{'host':_0x19fc('0xc'),'port':0x18eb});var socket=require(_0x19fc('0xd'))(new Redis(config[_0x19fc('0xb')]));require(_0x19fc('0xe'))[_0x19fc('0xf')](socket);function respondWithRpcPromise(_0x1d8880,_0x20bcad,_0x1e599e){return new BPromise(function(_0x49df66,_0x1d7bd7){return client[_0x19fc('0x10')](_0x1d8880,_0x1e599e)[_0x19fc('0x11')](function(_0x1940fa){logger[_0x19fc('0x12')](_0x19fc('0x13'),_0x20bcad,_0x19fc('0x14'));logger[_0x19fc('0x15')](_0x19fc('0x16'),_0x20bcad,'request\x20sent',JSON[_0x19fc('0x17')](_0x1940fa));if(_0x1940fa['error']){if(_0x1940fa[_0x19fc('0x18')][_0x19fc('0x19')]===0x1f4){logger['error'](_0x19fc('0x13'),_0x20bcad,_0x1940fa['error']['message']);return _0x1d7bd7(_0x1940fa[_0x19fc('0x18')][_0x19fc('0x1a')]);}logger[_0x19fc('0x18')](_0x19fc('0x13'),_0x20bcad,_0x1940fa[_0x19fc('0x18')][_0x19fc('0x1a')]);return _0x49df66(_0x1940fa['error'][_0x19fc('0x1a')]);}else{logger['info'](_0x19fc('0x13'),_0x20bcad,_0x19fc('0x14'));_0x49df66(_0x1940fa['result'][_0x19fc('0x1a')]);}})[_0x19fc('0x1b')](function(_0x224a5b){logger['error'](_0x19fc('0x13'),_0x20bcad,_0x224a5b);_0x1d7bd7(_0x224a5b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f65b708..fae7b11 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 _0xc2cc=['update','emit','register','chatInternalMessage:','save','remove'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc2cc,0x70));var _0xcc2c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc2cc[_0x2c91e9];return _0x13f0ff;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xcc2c('0x0'),_0xcc2c('0x1'),_0xcc2c('0x2')];function createListener(_0x5aad8f,_0x2a1a4a){return function(_0x52a81b){_0x2a1a4a[_0xcc2c('0x3')](_0x5aad8f,_0x52a81b);};}function removeListener(_0x47c883,_0x1dc5ec){return function(){ChatInternalMessageEvents['removeListener'](_0x47c883,_0x1dc5ec);};}exports[_0xcc2c('0x4')]=function(_0x539095){for(var _0x5855cc=0x0,_0x475a85=events['length'];_0x5855cc<_0x475a85;_0x5855cc++){var _0x144b90=events[_0x5855cc];var _0x5a276f=createListener(_0xcc2c('0x5')+_0x144b90,_0x539095);ChatInternalMessageEvents['on'](_0x144b90,_0x5a276f);}}; \ No newline at end of file +var _0xc818=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xc818,0x1e3));var _0x8c81=function(_0x5a455a,_0x3562a2){_0x5a455a=_0x5a455a-0x0;var _0x4b9c20=_0xc818[_0x5a455a];return _0x4b9c20;};'use strict';var ChatInternalMessageEvents=require(_0x8c81('0x0'));var events=[_0x8c81('0x1'),_0x8c81('0x2'),_0x8c81('0x3')];function createListener(_0x5e6597,_0x461c5f){return function(_0x7a8137){_0x461c5f[_0x8c81('0x4')](_0x5e6597,_0x7a8137);};}function removeListener(_0x7e329f,_0x1a61ab){return function(){ChatInternalMessageEvents[_0x8c81('0x5')](_0x7e329f,_0x1a61ab);};}exports[_0x8c81('0x6')]=function(_0x4a6e65){for(var _0x2c5966=0x0,_0x3d663e=events[_0x8c81('0x7')];_0x2c5966<_0x3d663e;_0x2c5966++){var _0x43d142=events[_0x2c5966];var _0x501240=createListener(_0x8c81('0x8')+_0x43d142,_0x4a6e65);ChatInternalMessageEvents['on'](_0x43d142,_0x501240);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a1a962b..2ae7fdf 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 _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(_0x919539,_0x106795){var _0x51665f=function(_0x12bf9b){while(--_0x12bf9b){_0x919539['push'](_0x919539['shift']());}};_0x51665f(++_0x106795);}(_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 +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(_0x1b25f8,_0xc8cf2f){var _0x271234=function(_0x4a66a7){while(--_0x4a66a7){_0x1b25f8['push'](_0x1b25f8['shift']());}};_0x271234(++_0xc8cf2f);}(_0x70e0,0x17b));var _0x070e=function(_0x2cfc46,_0x2629f1){_0x2cfc46=_0x2cfc46-0x0;var _0x446d8f=_0x70e0[_0x2cfc46];return _0x446d8f;};'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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7c5d38f..3aea280 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 _0x45b6=['sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x4c174e,_0x3023f3){var _0x5aa409=function(_0x9bcbd3){while(--_0x9bcbd3){_0x4c174e['push'](_0x4c174e['shift']());}};_0x5aa409(++_0x3023f3);}(_0x45b6,0xba));var _0x645b=function(_0x155897,_0x524552){_0x155897=_0x155897-0x0;var _0x783dcc=_0x45b6[_0x155897];return _0x783dcc;};'use strict';var Sequelize=require(_0x645b('0x0'));module[_0x645b('0x1')]={'body':{'type':Sequelize['TEXT'](_0x645b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x645b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x645b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x645b('0x4')]('in',_0x645b('0x5')),'defaultValue':_0x645b('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x80ee=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x80ee,0x158));var _0xe80e=function(_0x56b034,_0xb96f9b){_0x56b034=_0x56b034-0x0;var _0x25f338=_0x80ee[_0x56b034];return _0x25f338;};'use strict';var Sequelize=require(_0xe80e('0x0'));module[_0xe80e('0x1')]={'body':{'type':Sequelize[_0xe80e('0x2')](_0xe80e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe80e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe80e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe80e('0x5')]('in',_0xe80e('0x6')),'defaultValue':_0xe80e('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe80e('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index cb96fb2..4d85b15 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 _0x7f77=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','name','map','ChatMessage','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','create','body','destroy','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','manual','interface','SIP/%s','channel','event','EventManager','parse','formData','chat-interactions','agent','null','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1c400d,_0x8ab0e9){var _0x2ba799=function(_0x26fd8e){while(--_0x26fd8e){_0x1c400d['push'](_0x1c400d['shift']());}};_0x2ba799(++_0x8ab0e9);}(_0x7f77,0xe6));var _0x77f7=function(_0x519cfd,_0x1443da){_0x519cfd=_0x519cfd-0x0;var _0x4eea80=_0x7f77[_0x519cfd];return _0x4eea80;};'use strict';var pdf=require(_0x77f7('0x0'));var emlformat=require(_0x77f7('0x1'));var rimraf=require(_0x77f7('0x2'));var zipdir=require(_0x77f7('0x3'));var jsonpatch=require(_0x77f7('0x4'));var rp=require('request-promise');var moment=require(_0x77f7('0x5'));var BPromise=require(_0x77f7('0x6'));var Mustache=require(_0x77f7('0x7'));var util=require(_0x77f7('0x8'));var path=require(_0x77f7('0x9'));var sox=require(_0x77f7('0xa'));var csv=require(_0x77f7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77f7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x77f7('0xd'));var deskjs=require(_0x77f7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x77f7('0xf'));var Papa=require(_0x77f7('0x10'));var Redis=require(_0x77f7('0x11'));var authService=require(_0x77f7('0x12'));var qs=require(_0x77f7('0x13'));var as=require(_0x77f7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77f7('0x15'))(_0x77f7('0x16'));var utils=require(_0x77f7('0x17'));var config=require(_0x77f7('0x18'));var db=require(_0x77f7('0x19'))['db'];config[_0x77f7('0x1a')]=_['defaults'](config[_0x77f7('0x1a')],{'host':_0x77f7('0x1b'),'port':0x18eb});var socket=require(_0x77f7('0x1c'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x77f7('0x1d')](socket);var jayson=require(_0x77f7('0x1e'));var client=jayson[_0x77f7('0x1f')][_0x77f7('0x20')]({'port':0x232c});var client9002=jayson[_0x77f7('0x1f')][_0x77f7('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1e73a0,_0x5b7e76,_0x5c47e2){if(_0x5c47e2){var _0x31428d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31428d[_0x77f7('0x21')](_0x5b7e76)){return _0x1e73a0;}else{throw new db['Sequelize'][(_0x77f7('0x22'))](_0x77f7('0x23'));}}else{return _0x1e73a0;}}function respondWithRpcPromise(_0x2d3270,_0x32abba,_0xe74245,_0x4a0ea9){return new BPromise(function(_0x3390e2,_0x13eed1){var _0x11ef40=_0x4a0ea9||client;return _0x11ef40[_0x77f7('0x24')](_0x2d3270,_0xe74245)[_0x77f7('0x25')](function(_0x485fba){logger['info'](_0x77f7('0x26'),_0x32abba,_0x77f7('0x27'));logger[_0x77f7('0x28')](_0x77f7('0x29'),_0x32abba,'request\x20sent',JSON[_0x77f7('0x2a')](_0x485fba));if(_0x485fba['error']){if(_0x485fba[_0x77f7('0x2b')][_0x77f7('0x2c')]===0x1f4){logger[_0x77f7('0x2b')](_0x77f7('0x26'),_0x32abba,_0x485fba[_0x77f7('0x2b')][_0x77f7('0x2d')]);return _0x13eed1(_0x485fba['error'][_0x77f7('0x2d')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x32abba,_0x485fba[_0x77f7('0x2b')]['message']);return _0x3390e2(_0x485fba['error'][_0x77f7('0x2d')]);}else{logger[_0x77f7('0x2e')](_0x77f7('0x26'),_0x32abba,_0x77f7('0x27'));_0x3390e2(_0x485fba[_0x77f7('0x2f')][_0x77f7('0x2d')]);}})[_0x77f7('0x30')](function(_0x15ba93){logger[_0x77f7('0x2b')](_0x77f7('0x26'),_0x32abba,_0x15ba93);_0x13eed1(_0x15ba93);});});}function respondWithStatusCode(_0x45221f,_0x3b061f){_0x3b061f=_0x3b061f||0xcc;return function(_0x4f32d3){if(_0x4f32d3){return _0x45221f[_0x77f7('0x31')](_0x3b061f);}return _0x45221f[_0x77f7('0x32')](_0x3b061f)[_0x77f7('0x33')]();};}function respondWithResult(_0x33f905,_0x8dcb95){_0x8dcb95=_0x8dcb95||0xc8;return function(_0x57f45b){if(_0x57f45b){return _0x33f905[_0x77f7('0x32')](_0x8dcb95)[_0x77f7('0x34')](_0x57f45b);}};}function respondWithFilteredResult(_0x53d1cd,_0x49e3a4){return function(_0x51c4e4){if(_0x51c4e4){var _0x4ece57=_0x51c4e4[_0x77f7('0x35')],_0x254c10=_0x49e3a4[_0x77f7('0x36')],_0x437866=_0x49e3a4[_0x77f7('0x36')]+_0x49e3a4['limit'],_0x49cf48;if(_0x437866>=_0x4ece57){_0x437866=_0x4ece57;_0x49cf48=0xc8;}else{_0x49cf48=0xce;}_0x53d1cd[_0x77f7('0x32')](_0x49cf48);return _0x53d1cd[_0x77f7('0x37')](_0x77f7('0x38'),_0x254c10+'-'+_0x437866+'/'+_0x4ece57)['json'](_0x51c4e4);}return null;};}function patchUpdates(_0x3eb40a){return function(_0x28e42a){try{jsonpatch['apply'](_0x28e42a,_0x3eb40a,!![]);}catch(_0xe17b43){return BPromise[_0x77f7('0x39')](_0xe17b43);}return _0x28e42a['save']();};}function saveUpdates(_0x239fc3,_0x9b030b){return function(_0x276e81){if(_0x276e81){return _0x276e81[_0x77f7('0x3a')](_0x239fc3)[_0x77f7('0x25')](function(_0x4a96a7){return _0x4a96a7;});}return null;};}function removeEntity(_0x55cd5b,_0xe353c0){return function(_0x5b243c){if(_0x5b243c){return _0x5b243c['destroy']()[_0x77f7('0x25')](function(){_0x55cd5b[_0x77f7('0x32')](0xcc)[_0x77f7('0x33')]();});}};}function handleEntityNotFound(_0x4322f1,_0xf931ae){return function(_0xe60506){if(!_0xe60506){_0x4322f1['sendStatus'](0x194);}return _0xe60506;};}function handleError(_0x2e05f4,_0x2da037){_0x2da037=_0x2da037||0x1f4;return function(_0x3a3308){logger['error'](_0x3a3308['stack']);if(_0x3a3308[_0x77f7('0x3b')]){delete _0x3a3308[_0x77f7('0x3b')];}_0x2e05f4[_0x77f7('0x32')](_0x2da037)['send'](_0x3a3308);};}exports['index']=function(_0x57371f,_0x396bdd){var _0x10af07={},_0x1b31c2={},_0x8aa2c={'count':0x0,'rows':[]};var _0x100fb0=_[_0x77f7('0x3c')](db[_0x77f7('0x3d')]['rawAttributes'],function(_0x3ecf2b){return{'name':_0x3ecf2b['fieldName'],'type':_0x3ecf2b[_0x77f7('0x3e')][_0x77f7('0x3f')]};});_0x1b31c2[_0x77f7('0x40')]=_['map'](_0x100fb0,_0x77f7('0x3b'));_0x1b31c2[_0x77f7('0x41')]=_[_0x77f7('0x42')](_0x57371f[_0x77f7('0x41')]);_0x1b31c2[_0x77f7('0x43')]=_[_0x77f7('0x44')](_0x1b31c2['model'],_0x1b31c2['query']);_0x10af07['attributes']=_[_0x77f7('0x44')](_0x1b31c2['model'],qs['fields'](_0x57371f[_0x77f7('0x41')]['fields']));_0x10af07[_0x77f7('0x45')]=_0x10af07['attributes'][_0x77f7('0x46')]?_0x10af07[_0x77f7('0x45')]:_0x1b31c2[_0x77f7('0x40')];if(!_0x57371f[_0x77f7('0x41')][_0x77f7('0x47')](_0x77f7('0x48'))){_0x10af07[_0x77f7('0x49')]=qs[_0x77f7('0x49')](_0x57371f[_0x77f7('0x41')][_0x77f7('0x49')]);_0x10af07[_0x77f7('0x36')]=qs[_0x77f7('0x36')](_0x57371f[_0x77f7('0x41')][_0x77f7('0x36')]);}_0x10af07[_0x77f7('0x4a')]=qs[_0x77f7('0x4b')](_0x57371f[_0x77f7('0x41')][_0x77f7('0x4b')]);_0x10af07[_0x77f7('0x4c')]=qs[_0x77f7('0x43')](_['pick'](_0x57371f[_0x77f7('0x41')],_0x1b31c2[_0x77f7('0x43')]),_0x100fb0);if(_0x57371f[_0x77f7('0x41')][_0x77f7('0x4d')]){_0x10af07[_0x77f7('0x4c')]=_[_0x77f7('0x4e')](_0x10af07['where'],{'$or':_['map'](_0x100fb0,function(_0x35b08a){if(_0x35b08a[_0x77f7('0x3e')]!=='VIRTUAL'){var _0x23ecf7={};_0x23ecf7[_0x35b08a[_0x77f7('0x3b')]]={'$like':'%'+_0x57371f[_0x77f7('0x41')][_0x77f7('0x4d')]+'%'};return _0x23ecf7;}})});}_0x10af07=_[_0x77f7('0x4e')]({},_0x10af07,_0x57371f[_0x77f7('0x4f')]);var _0x542f22={'where':_0x10af07['where']};return db[_0x77f7('0x3d')][_0x77f7('0x35')](_0x542f22)[_0x77f7('0x25')](function(_0x83ebc4){_0x8aa2c[_0x77f7('0x35')]=_0x83ebc4;if(_0x57371f['query'][_0x77f7('0x50')]){_0x10af07[_0x77f7('0x51')]=[{'all':!![]}];}return db['ChatMessage'][_0x77f7('0x52')](_0x10af07);})[_0x77f7('0x25')](function(_0x200671){_0x8aa2c[_0x77f7('0x53')]=_0x200671;return _0x8aa2c;})['then'](respondWithFilteredResult(_0x396bdd,_0x10af07))[_0x77f7('0x30')](handleError(_0x396bdd,null));};exports[_0x77f7('0x54')]=function(_0x5add51,_0x745b27){var _0x4f2e1a={'raw':!![],'where':{'id':_0x5add51[_0x77f7('0x55')]['id']}},_0x403ad5={};_0x403ad5[_0x77f7('0x40')]=_['keys'](db[_0x77f7('0x3d')][_0x77f7('0x56')]);_0x403ad5[_0x77f7('0x41')]=_[_0x77f7('0x42')](_0x5add51[_0x77f7('0x41')]);_0x403ad5[_0x77f7('0x43')]=_[_0x77f7('0x44')](_0x403ad5['model'],_0x403ad5[_0x77f7('0x41')]);_0x4f2e1a[_0x77f7('0x45')]=_[_0x77f7('0x44')](_0x403ad5[_0x77f7('0x40')],qs[_0x77f7('0x57')](_0x5add51[_0x77f7('0x41')][_0x77f7('0x57')]));_0x4f2e1a['attributes']=_0x4f2e1a[_0x77f7('0x45')]['length']?_0x4f2e1a[_0x77f7('0x45')]:_0x403ad5[_0x77f7('0x40')];if(_0x5add51[_0x77f7('0x41')][_0x77f7('0x50')]){_0x4f2e1a[_0x77f7('0x51')]=[{'all':!![]}];}_0x4f2e1a=_[_0x77f7('0x4e')]({},_0x4f2e1a,_0x5add51[_0x77f7('0x4f')]);return db[_0x77f7('0x3d')][_0x77f7('0x58')](_0x4f2e1a)[_0x77f7('0x25')](handleEntityNotFound(_0x745b27,null))[_0x77f7('0x25')](respondWithResult(_0x745b27,null))[_0x77f7('0x30')](handleError(_0x745b27,null));};exports[_0x77f7('0x59')]=function(_0x473b5e,_0x22c4dc){return db[_0x77f7('0x3d')][_0x77f7('0x59')](_0x473b5e[_0x77f7('0x5a')],{})['then'](respondWithResult(_0x22c4dc,0xc9))[_0x77f7('0x30')](handleError(_0x22c4dc,null));};exports[_0x77f7('0x3a')]=function(_0x4cce1a,_0x569c4b){if(_0x4cce1a['body']['id']){delete _0x4cce1a[_0x77f7('0x5a')]['id'];}return db[_0x77f7('0x3d')][_0x77f7('0x58')]({'where':{'id':_0x4cce1a['params']['id']}})[_0x77f7('0x25')](handleEntityNotFound(_0x569c4b,null))[_0x77f7('0x25')](saveUpdates(_0x4cce1a[_0x77f7('0x5a')],null))[_0x77f7('0x25')](respondWithResult(_0x569c4b,null))[_0x77f7('0x30')](handleError(_0x569c4b,null));};exports[_0x77f7('0x5b')]=function(_0x473ad2,_0x400fd6){return db['ChatMessage']['find']({'where':{'id':_0x473ad2[_0x77f7('0x55')]['id']}})[_0x77f7('0x25')](handleEntityNotFound(_0x400fd6,null))['then'](removeEntity(_0x400fd6,null))[_0x77f7('0x30')](handleError(_0x400fd6,null));};exports[_0x77f7('0x5c')]=function(_0x49cba2,_0x11f6df){return db[_0x77f7('0x3d')][_0x77f7('0x5c')]()[_0x77f7('0x25')](respondWithResult(_0x11f6df,null))[_0x77f7('0x30')](handleError(_0x11f6df,null));};var interaction_log=require(_0x77f7('0x15'))('chat-interactions');exports[_0x77f7('0x5d')]=function(_0x2df2b5,_0x2ddbe6,_0x27b468){var _0x257658={'channel':_0x77f7('0x5e')};if(_0x2df2b5[_0x77f7('0x5a')]['id']){delete _0x2df2b5[_0x77f7('0x5a')]['id'];}_0x2df2b5[_0x77f7('0x5a')][_0x77f7('0x5f')]=!![];_0x2df2b5[_0x77f7('0x5a')][_0x77f7('0x60')]=moment()[_0x77f7('0x61')](_0x77f7('0x62'));_0x2df2b5[_0x77f7('0x5a')][_0x77f7('0x63')]=_0x2df2b5['body'][_0x77f7('0x63')]||_0x2df2b5[_0x77f7('0x64')]['id'];return db[_0x77f7('0x3d')][_0x77f7('0x58')]({'where':{'id':_0x2df2b5[_0x77f7('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x77f7('0x65')],'as':_0x77f7('0x66')}]})[_0x77f7('0x25')](handleEntityNotFound(_0x2ddbe6,null))[_0x77f7('0x25')](saveUpdates(_0x2df2b5['body'],null))[_0x77f7('0x25')](function(_0x3c88e6){if(_0x3c88e6){_0x257658[_0x77f7('0x2d')]=_0x3c88e6[_0x77f7('0x67')]({'plain':!![]});return db[_0x77f7('0x68')][_0x77f7('0x58')]({'where':{'id':_0x3c88e6[_0x77f7('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x2ddbe6,null))['then'](function(_0x1b9e0d){if(_0x1b9e0d){return _0x1b9e0d['update']({'UserId':_0x2df2b5[_0x77f7('0x5a')][_0x77f7('0x63')],'read1stAt':_[_0x77f7('0x6a')](_0x1b9e0d[_0x77f7('0x6b')])?moment()[_0x77f7('0x61')](_0x77f7('0x62')):undefined});}return null;})[_0x77f7('0x25')](function(_0x377299){if(_0x377299){_0x257658['interaction']=_0x377299[_0x77f7('0x67')]({'plain':!![]});interaction_log[_0x77f7('0x2e')](_0x77f7('0x6c'),_0x2df2b5[_0x77f7('0x64')]['id'],_0x2df2b5[_0x77f7('0x64')][_0x77f7('0x3b')],_0x2df2b5['user'][_0x77f7('0x6d')],_0x257658[_0x77f7('0x6e')]['id'],_0x2df2b5[_0x77f7('0x5a')]?JSON[_0x77f7('0x2a')](_0x2df2b5[_0x77f7('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x257658);}return null;})[_0x77f7('0x25')](function(_0x30eb1e){if(_0x30eb1e){if(_0x2df2b5['body'][_0x77f7('0x6f')]){_0x257658[_0x77f7('0x2d')][_0x77f7('0x70')]=util[_0x77f7('0x61')](_0x77f7('0x71'),_0x2df2b5['user'][_0x77f7('0x3b')]);_0x257658[_0x77f7('0x2d')]['channel']=_0x257658[_0x77f7('0x72')];_0x257658[_0x77f7('0x2d')][_0x77f7('0x73')]=_0x77f7('0x5d');return respondWithRpcPromise('EventManager',_0x77f7('0x74'),{'event':'acceptmessage','message':_['merge'](_0x257658[_0x77f7('0x2d')],JSON[_0x77f7('0x75')](_0x257658[_0x77f7('0x6e')][_0x77f7('0x76')]))},client9002)[_0x77f7('0x25')](function(){return _0x257658;});}return _0x257658;}return null;})[_0x77f7('0x25')](respondWithResult(_0x2ddbe6,null))[_0x77f7('0x30')](handleError(_0x2ddbe6,null));};var interaction_log=require(_0x77f7('0x15'))(_0x77f7('0x77'));exports[_0x77f7('0x39')]=function(_0x55884c,_0x316c4c,_0x4640f9){var _0x3c508f={'agent':{},'channel':_0x77f7('0x5e')};if(_0x55884c[_0x77f7('0x5a')]['id']){delete _0x55884c[_0x77f7('0x5a')]['id'];}_0x55884c[_0x77f7('0x5a')][_0x77f7('0x63')]=_0x55884c[_0x77f7('0x5a')]['UserId']||_0x55884c[_0x77f7('0x64')]['id'];_0x3c508f[_0x77f7('0x78')]['id']=_0x55884c[_0x77f7('0x5a')]['UserId'];return db[_0x77f7('0x3d')][_0x77f7('0x58')]({'where':{'id':_0x55884c[_0x77f7('0x55')]['id'],'UserId':null}})[_0x77f7('0x25')](handleEntityNotFound(_0x316c4c,null))['then'](function(_0x3db78e){if(_0x3db78e){_0x3c508f[_0x77f7('0x2d')]=_0x3db78e['get']({'plain':!![]});return db[_0x77f7('0x68')]['find']({'where':{'id':_0x3db78e[_0x77f7('0x69')]}});}return null;})[_0x77f7('0x25')](handleEntityNotFound(_0x316c4c,null))['then'](function(_0x5907ba){if(_0x5907ba){_0x3c508f[_0x77f7('0x6e')]=_0x5907ba[_0x77f7('0x67')]({'plain':!![]});interaction_log[_0x77f7('0x2e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x55884c['user']['id'],_0x55884c[_0x77f7('0x64')][_0x77f7('0x3b')],_0x55884c['user'][_0x77f7('0x6d')],_0x3c508f[_0x77f7('0x6e')]['id'],_0x55884c['body']?JSON[_0x77f7('0x2a')](_0x55884c[_0x77f7('0x5a')]):_0x77f7('0x79'));return respondWithRpcPromise(_0x77f7('0x7a'),_0x77f7('0x7b'),_0x3c508f);}return null;})['then'](function(_0x5a0f90){if(_0x5a0f90){_0x5a0f90[_0x77f7('0x2d')]['interface']=util[_0x77f7('0x61')](_0x77f7('0x71'),_0x55884c['user'][_0x77f7('0x3b')]);_0x5a0f90[_0x77f7('0x2d')][_0x77f7('0x72')]=_0x3c508f[_0x77f7('0x72')];_0x5a0f90['message'][_0x77f7('0x73')]='reject';respondWithRpcPromise(_0x77f7('0x74'),'EventManager',{'event':_0x77f7('0x7c'),'message':_0x5a0f90[_0x77f7('0x2d')]},client9002);return _0x3c508f;}return null;})['then'](respondWithResult(_0x316c4c,null))[_0x77f7('0x30')](handleError(_0x316c4c,null));}; \ No newline at end of file +var _0xb375=['interface','rejectmessage','html-pdf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatMessage.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','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','options','ChatMessage','includeAll','include','rows','show','keys','find','create','body','params','destroy','describe','accept','chat','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage'];(function(_0x41fc7f,_0x123a6d){var _0x5cabfe=function(_0x507955){while(--_0x507955){_0x41fc7f['push'](_0x41fc7f['shift']());}};_0x5cabfe(++_0x123a6d);}(_0xb375,0xea));var _0x5b37=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb375[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x5b37('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5b37('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b37('0x2'));var BPromise=require(_0x5b37('0x3'));var Mustache=require('mustache');var util=require(_0x5b37('0x4'));var path=require('path');var sox=require(_0x5b37('0x5'));var csv=require(_0x5b37('0x6'));var ejs=require(_0x5b37('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5b37('0x8'));var crypto=require(_0x5b37('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5b37('0x6'));var querystring=require(_0x5b37('0xa'));var Papa=require('papaparse');var Redis=require(_0x5b37('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x5b37('0xc'));var as=require(_0x5b37('0xd'));var hardwareService=require(_0x5b37('0xe'));var logger=require(_0x5b37('0xf'))(_0x5b37('0x10'));var utils=require(_0x5b37('0x11'));var config=require(_0x5b37('0x12'));var db=require(_0x5b37('0x13'))['db'];config[_0x5b37('0x14')]=_[_0x5b37('0x15')](config['redis'],{'host':_0x5b37('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b37('0x14')]));require(_0x5b37('0x17'))[_0x5b37('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b37('0x19')][_0x5b37('0x1a')]({'port':0x232c});var client9002=jayson[_0x5b37('0x19')][_0x5b37('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x21a219,_0xa688cc,_0x33edef){if(_0x33edef){var _0x191142=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x191142[_0x5b37('0x1b')](_0xa688cc)){return _0x21a219;}else{throw new db[(_0x5b37('0x1c'))][(_0x5b37('0x1d'))](_0x5b37('0x1e'));}}else{return _0x21a219;}}function respondWithRpcPromise(_0x573b36,_0xeaf3a8,_0x22d45e,_0x4c2e18){return new BPromise(function(_0x3ef22e,_0x5336b7){var _0x25bba5=_0x4c2e18||client;return _0x25bba5[_0x5b37('0x1f')](_0x573b36,_0x22d45e)['then'](function(_0x315dd6){logger[_0x5b37('0x20')](_0x5b37('0x21'),_0xeaf3a8,_0x5b37('0x22'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0xeaf3a8,_0x5b37('0x22'),JSON[_0x5b37('0x23')](_0x315dd6));if(_0x315dd6[_0x5b37('0x24')]){if(_0x315dd6[_0x5b37('0x24')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0xeaf3a8,_0x315dd6['error']['message']);return _0x5336b7(_0x315dd6[_0x5b37('0x24')][_0x5b37('0x25')]);}logger[_0x5b37('0x24')]('ChatMessage,\x20%s,\x20%s',_0xeaf3a8,_0x315dd6[_0x5b37('0x24')][_0x5b37('0x25')]);return _0x3ef22e(_0x315dd6[_0x5b37('0x24')]['message']);}else{logger[_0x5b37('0x20')](_0x5b37('0x21'),_0xeaf3a8,_0x5b37('0x22'));_0x3ef22e(_0x315dd6['result'][_0x5b37('0x25')]);}})[_0x5b37('0x26')](function(_0x48b15d){logger[_0x5b37('0x24')](_0x5b37('0x21'),_0xeaf3a8,_0x48b15d);_0x5336b7(_0x48b15d);});});}function respondWithStatusCode(_0xaf6fe3,_0x4dfd2c){_0x4dfd2c=_0x4dfd2c||0xcc;return function(_0x372b6d){if(_0x372b6d){return _0xaf6fe3[_0x5b37('0x27')](_0x4dfd2c);}return _0xaf6fe3[_0x5b37('0x28')](_0x4dfd2c)[_0x5b37('0x29')]();};}function respondWithResult(_0x3c132e,_0xcda969){_0xcda969=_0xcda969||0xc8;return function(_0x4dca65){if(_0x4dca65){return _0x3c132e[_0x5b37('0x28')](_0xcda969)[_0x5b37('0x2a')](_0x4dca65);}};}function respondWithFilteredResult(_0xcdc418,_0xc63f60){return function(_0x19f513){if(_0x19f513){var _0x15c0e6=_0x19f513[_0x5b37('0x2b')],_0x3ac93a=_0xc63f60[_0x5b37('0x2c')],_0x2e8e6c=_0xc63f60['offset']+_0xc63f60[_0x5b37('0x2d')],_0x2ded7c;if(_0x2e8e6c>=_0x15c0e6){_0x2e8e6c=_0x15c0e6;_0x2ded7c=0xc8;}else{_0x2ded7c=0xce;}_0xcdc418[_0x5b37('0x28')](_0x2ded7c);return _0xcdc418[_0x5b37('0x2e')](_0x5b37('0x2f'),_0x3ac93a+'-'+_0x2e8e6c+'/'+_0x15c0e6)[_0x5b37('0x2a')](_0x19f513);}return null;};}function patchUpdates(_0x1d5195){return function(_0x56365d){try{jsonpatch[_0x5b37('0x30')](_0x56365d,_0x1d5195,!![]);}catch(_0x39760d){return BPromise[_0x5b37('0x31')](_0x39760d);}return _0x56365d[_0x5b37('0x32')]();};}function saveUpdates(_0x250035,_0x3d5051){return function(_0x41824a){if(_0x41824a){return _0x41824a[_0x5b37('0x33')](_0x250035)[_0x5b37('0x34')](function(_0x2494f3){return _0x2494f3;});}return null;};}function removeEntity(_0xee589,_0x1f1398){return function(_0x3479f6){if(_0x3479f6){return _0x3479f6['destroy']()[_0x5b37('0x34')](function(){_0xee589[_0x5b37('0x28')](0xcc)[_0x5b37('0x29')]();});}};}function handleEntityNotFound(_0x1f9b7e,_0x415e0d){return function(_0x6c3e23){if(!_0x6c3e23){_0x1f9b7e[_0x5b37('0x27')](0x194);}return _0x6c3e23;};}function handleError(_0x432346,_0x1fa3a1){_0x1fa3a1=_0x1fa3a1||0x1f4;return function(_0x1e79d2){logger[_0x5b37('0x24')](_0x1e79d2[_0x5b37('0x35')]);if(_0x1e79d2['name']){delete _0x1e79d2[_0x5b37('0x36')];}_0x432346[_0x5b37('0x28')](_0x1fa3a1)[_0x5b37('0x37')](_0x1e79d2);};}exports['index']=function(_0x36b76a,_0x256afb){var _0x109666={},_0x574115={},_0x59cfa5={'count':0x0,'rows':[]};var _0x4c7586=_[_0x5b37('0x38')](db['ChatMessage'][_0x5b37('0x39')],function(_0x399d93){return{'name':_0x399d93[_0x5b37('0x3a')],'type':_0x399d93['type'][_0x5b37('0x3b')]};});_0x574115[_0x5b37('0x3c')]=_[_0x5b37('0x38')](_0x4c7586,_0x5b37('0x36'));_0x574115[_0x5b37('0x3d')]=_['keys'](_0x36b76a[_0x5b37('0x3d')]);_0x574115[_0x5b37('0x3e')]=_[_0x5b37('0x3f')](_0x574115[_0x5b37('0x3c')],_0x574115[_0x5b37('0x3d')]);_0x109666[_0x5b37('0x40')]=_['intersection'](_0x574115[_0x5b37('0x3c')],qs[_0x5b37('0x41')](_0x36b76a[_0x5b37('0x3d')][_0x5b37('0x41')]));_0x109666[_0x5b37('0x40')]=_0x109666[_0x5b37('0x40')][_0x5b37('0x42')]?_0x109666[_0x5b37('0x40')]:_0x574115[_0x5b37('0x3c')];if(!_0x36b76a['query'][_0x5b37('0x43')](_0x5b37('0x44'))){_0x109666[_0x5b37('0x2d')]=qs[_0x5b37('0x2d')](_0x36b76a[_0x5b37('0x3d')][_0x5b37('0x2d')]);_0x109666[_0x5b37('0x2c')]=qs[_0x5b37('0x2c')](_0x36b76a[_0x5b37('0x3d')][_0x5b37('0x2c')]);}_0x109666[_0x5b37('0x45')]=qs[_0x5b37('0x46')](_0x36b76a[_0x5b37('0x3d')][_0x5b37('0x46')]);_0x109666['where']=qs[_0x5b37('0x3e')](_['pick'](_0x36b76a[_0x5b37('0x3d')],_0x574115['filters']),_0x4c7586);if(_0x36b76a[_0x5b37('0x3d')][_0x5b37('0x47')]){_0x109666['where']=_[_0x5b37('0x48')](_0x109666[_0x5b37('0x49')],{'$or':_['map'](_0x4c7586,function(_0x1193e1){if(_0x1193e1[_0x5b37('0x4a')]!=='VIRTUAL'){var _0x2d5af0={};_0x2d5af0[_0x1193e1['name']]={'$like':'%'+_0x36b76a[_0x5b37('0x3d')][_0x5b37('0x47')]+'%'};return _0x2d5af0;}})});}_0x109666=_[_0x5b37('0x48')]({},_0x109666,_0x36b76a[_0x5b37('0x4b')]);var _0x283727={'where':_0x109666['where']};return db[_0x5b37('0x4c')][_0x5b37('0x2b')](_0x283727)['then'](function(_0x1a3a69){_0x59cfa5[_0x5b37('0x2b')]=_0x1a3a69;if(_0x36b76a[_0x5b37('0x3d')][_0x5b37('0x4d')]){_0x109666[_0x5b37('0x4e')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x109666);})[_0x5b37('0x34')](function(_0x6517d5){_0x59cfa5[_0x5b37('0x4f')]=_0x6517d5;return _0x59cfa5;})['then'](respondWithFilteredResult(_0x256afb,_0x109666))[_0x5b37('0x26')](handleError(_0x256afb,null));};exports[_0x5b37('0x50')]=function(_0x1c04e2,_0x53d3d2){var _0x5203a8={'raw':!![],'where':{'id':_0x1c04e2['params']['id']}},_0xf28114={};_0xf28114[_0x5b37('0x3c')]=_[_0x5b37('0x51')](db['ChatMessage']['rawAttributes']);_0xf28114[_0x5b37('0x3d')]=_[_0x5b37('0x51')](_0x1c04e2['query']);_0xf28114['filters']=_[_0x5b37('0x3f')](_0xf28114['model'],_0xf28114[_0x5b37('0x3d')]);_0x5203a8['attributes']=_[_0x5b37('0x3f')](_0xf28114[_0x5b37('0x3c')],qs['fields'](_0x1c04e2['query'][_0x5b37('0x41')]));_0x5203a8[_0x5b37('0x40')]=_0x5203a8[_0x5b37('0x40')]['length']?_0x5203a8['attributes']:_0xf28114[_0x5b37('0x3c')];if(_0x1c04e2[_0x5b37('0x3d')]['includeAll']){_0x5203a8[_0x5b37('0x4e')]=[{'all':!![]}];}_0x5203a8=_[_0x5b37('0x48')]({},_0x5203a8,_0x1c04e2[_0x5b37('0x4b')]);return db[_0x5b37('0x4c')][_0x5b37('0x52')](_0x5203a8)['then'](handleEntityNotFound(_0x53d3d2,null))[_0x5b37('0x34')](respondWithResult(_0x53d3d2,null))[_0x5b37('0x26')](handleError(_0x53d3d2,null));};exports[_0x5b37('0x53')]=function(_0x49114c,_0x4a93e1){return db['ChatMessage'][_0x5b37('0x53')](_0x49114c['body'],{})[_0x5b37('0x34')](respondWithResult(_0x4a93e1,0xc9))[_0x5b37('0x26')](handleError(_0x4a93e1,null));};exports[_0x5b37('0x33')]=function(_0x2bb540,_0x25da6f){if(_0x2bb540[_0x5b37('0x54')]['id']){delete _0x2bb540['body']['id'];}return db[_0x5b37('0x4c')][_0x5b37('0x52')]({'where':{'id':_0x2bb540[_0x5b37('0x55')]['id']}})[_0x5b37('0x34')](handleEntityNotFound(_0x25da6f,null))[_0x5b37('0x34')](saveUpdates(_0x2bb540['body'],null))[_0x5b37('0x34')](respondWithResult(_0x25da6f,null))[_0x5b37('0x26')](handleError(_0x25da6f,null));};exports[_0x5b37('0x56')]=function(_0x3a150c,_0x2ce6b8){return db['ChatMessage']['find']({'where':{'id':_0x3a150c['params']['id']}})['then'](handleEntityNotFound(_0x2ce6b8,null))[_0x5b37('0x34')](removeEntity(_0x2ce6b8,null))[_0x5b37('0x26')](handleError(_0x2ce6b8,null));};exports[_0x5b37('0x57')]=function(_0x406005,_0x314dd0){return db[_0x5b37('0x4c')]['describe']()[_0x5b37('0x34')](respondWithResult(_0x314dd0,null))[_0x5b37('0x26')](handleError(_0x314dd0,null));};var interaction_log=require(_0x5b37('0xf'))('chat-interactions');exports[_0x5b37('0x58')]=function(_0x5a9f12,_0x40bab6,_0x5c6101){var _0x5e9ccf={'channel':_0x5b37('0x59')};if(_0x5a9f12[_0x5b37('0x54')]['id']){delete _0x5a9f12['body']['id'];}_0x5a9f12['body']['read']=!![];_0x5a9f12[_0x5b37('0x54')]['readAt']=moment()[_0x5b37('0x5a')](_0x5b37('0x5b'));_0x5a9f12['body']['UserId']=_0x5a9f12[_0x5b37('0x54')][_0x5b37('0x5c')]||_0x5a9f12[_0x5b37('0x5d')]['id'];return db['ChatMessage'][_0x5b37('0x52')]({'where':{'id':_0x5a9f12[_0x5b37('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x40bab6,null))[_0x5b37('0x34')](saveUpdates(_0x5a9f12[_0x5b37('0x54')],null))[_0x5b37('0x34')](function(_0x5a5d07){if(_0x5a5d07){_0x5e9ccf[_0x5b37('0x25')]=_0x5a5d07[_0x5b37('0x5e')]({'plain':!![]});return db[_0x5b37('0x5f')]['find']({'where':{'id':_0x5a5d07[_0x5b37('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x40bab6,null))[_0x5b37('0x34')](function(_0xa6ff51){if(_0xa6ff51){return _0xa6ff51[_0x5b37('0x33')]({'UserId':_0x5a9f12[_0x5b37('0x54')][_0x5b37('0x5c')],'read1stAt':_['isNil'](_0xa6ff51[_0x5b37('0x61')])?moment()[_0x5b37('0x5a')](_0x5b37('0x5b')):undefined});}return null;})[_0x5b37('0x34')](function(_0x256b5d){if(_0x256b5d){_0x5e9ccf[_0x5b37('0x62')]=_0x256b5d[_0x5b37('0x5e')]({'plain':!![]});interaction_log[_0x5b37('0x20')](_0x5b37('0x63'),_0x5a9f12['user']['id'],_0x5a9f12[_0x5b37('0x5d')][_0x5b37('0x36')],_0x5a9f12[_0x5b37('0x5d')]['role'],_0x5e9ccf['interaction']['id'],_0x5a9f12[_0x5b37('0x54')]?JSON[_0x5b37('0x23')](_0x5a9f12[_0x5b37('0x54')]):_0x5b37('0x64'));return respondWithRpcPromise(_0x5b37('0x65'),_0x5b37('0x66'),_0x5e9ccf);}return null;})['then'](function(_0x227cf5){if(_0x227cf5){if(_0x5a9f12[_0x5b37('0x54')][_0x5b37('0x67')]){_0x5e9ccf['message']['interface']=util['format'](_0x5b37('0x68'),_0x5a9f12[_0x5b37('0x5d')][_0x5b37('0x36')]);_0x5e9ccf[_0x5b37('0x25')][_0x5b37('0x69')]=_0x5e9ccf['channel'];_0x5e9ccf[_0x5b37('0x25')]['event']='accept';return respondWithRpcPromise('EventManager',_0x5b37('0x6a'),{'event':_0x5b37('0x6b'),'message':_['merge'](_0x5e9ccf['message'],JSON['parse'](_0x5e9ccf[_0x5b37('0x62')][_0x5b37('0x6c')]))},client9002)[_0x5b37('0x34')](function(){return _0x5e9ccf;});}return _0x5e9ccf;}return null;})[_0x5b37('0x34')](respondWithResult(_0x40bab6,null))[_0x5b37('0x26')](handleError(_0x40bab6,null));};var interaction_log=require('../../config/logger')(_0x5b37('0x6d'));exports[_0x5b37('0x31')]=function(_0x27c6ea,_0x24be9d,_0x5e2a19){var _0x32b32a={'agent':{},'channel':_0x5b37('0x59')};if(_0x27c6ea[_0x5b37('0x54')]['id']){delete _0x27c6ea['body']['id'];}_0x27c6ea[_0x5b37('0x54')][_0x5b37('0x5c')]=_0x27c6ea[_0x5b37('0x54')][_0x5b37('0x5c')]||_0x27c6ea[_0x5b37('0x5d')]['id'];_0x32b32a['agent']['id']=_0x27c6ea['body'][_0x5b37('0x5c')];return db[_0x5b37('0x4c')][_0x5b37('0x52')]({'where':{'id':_0x27c6ea['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24be9d,null))[_0x5b37('0x34')](function(_0x5010eb){if(_0x5010eb){_0x32b32a['message']=_0x5010eb[_0x5b37('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x5b37('0x52')]({'where':{'id':_0x5010eb['ChatInteractionId']}});}return null;})[_0x5b37('0x34')](handleEntityNotFound(_0x24be9d,null))[_0x5b37('0x34')](function(_0x236a99){if(_0x236a99){_0x32b32a[_0x5b37('0x62')]=_0x236a99['get']({'plain':!![]});interaction_log[_0x5b37('0x20')](_0x5b37('0x6e'),_0x27c6ea['user']['id'],_0x27c6ea[_0x5b37('0x5d')][_0x5b37('0x36')],_0x27c6ea[_0x5b37('0x5d')][_0x5b37('0x6f')],_0x32b32a['interaction']['id'],_0x27c6ea[_0x5b37('0x54')]?JSON[_0x5b37('0x23')](_0x27c6ea[_0x5b37('0x54')]):_0x5b37('0x64'));return respondWithRpcPromise(_0x5b37('0x70'),_0x5b37('0x71'),_0x32b32a);}return null;})[_0x5b37('0x34')](function(_0x457373){if(_0x457373){_0x457373[_0x5b37('0x25')][_0x5b37('0x72')]=util[_0x5b37('0x5a')](_0x5b37('0x68'),_0x27c6ea[_0x5b37('0x5d')][_0x5b37('0x36')]);_0x457373[_0x5b37('0x25')]['channel']=_0x32b32a[_0x5b37('0x69')];_0x457373[_0x5b37('0x25')]['event']=_0x5b37('0x31');respondWithRpcPromise(_0x5b37('0x6a'),_0x5b37('0x6a'),{'event':_0x5b37('0x73'),'message':_0x457373[_0x5b37('0x25')]},client9002);return _0x32b32a;}return null;})[_0x5b37('0x34')](respondWithResult(_0x24be9d,null))[_0x5b37('0x26')](handleError(_0x24be9d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 4b668fd..2a4be8b 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 _0x734b=['update','remove','emit','exports','ChatMessage','setMaxListeners','save'];(function(_0x47a385,_0x5d8781){var _0x31abb9=function(_0x210f7a){while(--_0x210f7a){_0x47a385['push'](_0x47a385['shift']());}};_0x31abb9(++_0x5d8781);}(_0x734b,0xcf));var _0xb734=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x734b[_0x346737];return _0x1ade2e;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xb734('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb734('0x1')](0x0);var events={'afterCreate':_0xb734('0x2'),'afterUpdate':_0xb734('0x3'),'afterDestroy':_0xb734('0x4')};function emitEvent(_0x529627){return function(_0x1b556f,_0x24b64e,_0x2fb018){ChatMessageEvents[_0xb734('0x5')](_0x529627+':'+_0x1b556f['id'],_0x1b556f);ChatMessageEvents[_0xb734('0x5')](_0x529627,_0x1b556f);_0x2fb018(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xb734('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0xaef6=['../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','events'];(function(_0x1d9603,_0x3c35d2){var _0x5f2edd=function(_0x290ddc){while(--_0x290ddc){_0x1d9603['push'](_0x1d9603['shift']());}};_0x5f2edd(++_0x3c35d2);}(_0xaef6,0x19f));var _0x6aef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaef6[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x6aef('0x0'));var ChatMessage=require(_0x6aef('0x1'))['db'][_0x6aef('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6aef('0x3')](0x0);var events={'afterCreate':_0x6aef('0x4'),'afterUpdate':_0x6aef('0x5'),'afterDestroy':_0x6aef('0x6')};function emitEvent(_0x58690e){return function(_0xdef075,_0x2ff6fd,_0x1b23b1){ChatMessageEvents[_0x6aef('0x7')](_0x58690e+':'+_0xdef075['id'],_0xdef075);ChatMessageEvents[_0x6aef('0x7')](_0x58690e,_0xdef075);_0x1b23b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a1e526f..5133f6e 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 _0x3804=['secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','body','models','toLowerCase','direction'];(function(_0x356bc8,_0x2abc59){var _0x2917b9=function(_0x18d77c){while(--_0x18d77c){_0x356bc8['push'](_0x356bc8['shift']());}};_0x2917b9(++_0x2abc59);}(_0x3804,0x124));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4380('0x0'));var util=require(_0x4380('0x1'));var logger=require(_0x4380('0x2'))('api');var moment=require(_0x4380('0x3'));var BPromise=require(_0x4380('0x4'));var rp=require(_0x4380('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4380('0x6'));var config=require(_0x4380('0x7'));var attributes=require('./chatMessage.attributes');module[_0x4380('0x8')]=function(_0x3f2bb5,_0x13247b){return _0x3f2bb5[_0x4380('0x9')](_0x4380('0xa'),attributes,{'tableName':_0x4380('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x4380('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f2342,_0x48ed59,_0x38fa95){var _0x41f4f6=_0x3f2bb5[_0x4380('0xd')];var _0x1e7234=_0x4f2342['get']({'plain':!![]});if(_0x1e7234['direction'][_0x4380('0xe')]()==='in'||_0x1e7234[_0x4380('0xf')][_0x4380('0xe')]()==='out'&&!_0x1e7234[_0x4380('0x10')]&&!_[_0x4380('0x11')](_0x1e7234[_0x4380('0x12')])){_0x41f4f6[_0x4380('0x13')]['findOne']({'where':{'id':_0x1e7234[_0x4380('0x14')]}})[_0x4380('0x15')](function(_0x478bd8){if(_0x478bd8){_0x478bd8[_0x4380('0x16')]({'lastMsgAt':_0x1e7234[_0x4380('0x17')],'lastMsgDirection':_0x1e7234['direction'][_0x4380('0xe')]()});}})[_0x4380('0x18')](function(_0x386bf4){console[_0x4380('0x19')](_0x386bf4);});}_0x38fa95();}},'charset':_0x4380('0x1a'),'collate':_0x4380('0x1b')});}; \ No newline at end of file +var _0xd93a=['then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','findOne'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd93a,0x131));var _0xad93=function(_0x7e80c2,_0x5229b0){_0x7e80c2=_0x7e80c2-0x0;var _0x43e592=_0xd93a[_0x7e80c2];return _0x43e592;};'use strict';var _=require(_0xad93('0x0'));var util=require(_0xad93('0x1'));var logger=require(_0xad93('0x2'))(_0xad93('0x3'));var moment=require('moment');var BPromise=require(_0xad93('0x4'));var rp=require(_0xad93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad93('0x6'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0xad93('0x7')]=function(_0xb9a73c,_0x4290e2){return _0xb9a73c['define'](_0xad93('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xad93('0x9'),'fields':[_0xad93('0xa')],'type':_0xad93('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa7d5e9,_0x218ca8,_0x157c67){var _0x3891a8=_0xb9a73c[_0xad93('0xc')];var _0x1865dd=_0xa7d5e9[_0xad93('0xd')]({'plain':!![]});if(_0x1865dd['direction']['toLowerCase']()==='in'||_0x1865dd[_0xad93('0xe')][_0xad93('0xf')]()===_0xad93('0x10')&&!_0x1865dd['secret']&&!_[_0xad93('0x11')](_0x1865dd[_0xad93('0x12')])){_0x3891a8['ChatInteraction'][_0xad93('0x13')]({'where':{'id':_0x1865dd['ChatInteractionId']}})[_0xad93('0x14')](function(_0x478d9e){if(_0x478d9e){_0x478d9e[_0xad93('0x15')]({'lastMsgAt':_0x1865dd['createdAt'],'lastMsgDirection':_0x1865dd[_0xad93('0xe')][_0xad93('0xf')]()});}})[_0xad93('0x16')](function(_0x4d3f57){console['error'](_0x4d3f57);});}_0x157c67();}},'charset':_0xad93('0x17'),'collate':_0xad93('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 0611004..1ebb098 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 _0xe668=['ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5edb26,_0x43cab0){var _0x224140=function(_0x30e6f6){while(--_0x30e6f6){_0x5edb26['push'](_0x5edb26['shift']());}};_0x224140(++_0x43cab0);}(_0xe668,0x135));var _0x8e66=function(_0x13a0d6,_0x9a1972){_0x13a0d6=_0x13a0d6-0x0;var _0x241df1=_0xe668[_0x13a0d6];return _0x241df1;};'use strict';var _=require(_0x8e66('0x0'));var util=require(_0x8e66('0x1'));var moment=require('moment');var BPromise=require(_0x8e66('0x2'));var rs=require(_0x8e66('0x3'));var fs=require('fs');var Redis=require(_0x8e66('0x4'));var db=require(_0x8e66('0x5'))['db'];var utils=require(_0x8e66('0x6'));var logger=require(_0x8e66('0x7'))(_0x8e66('0x8'));var config=require(_0x8e66('0x9'));var jayson=require(_0x8e66('0xa'));var client=jayson['client'][_0x8e66('0xb')]({'port':0x232a});config[_0x8e66('0xc')]=_[_0x8e66('0xd')](config[_0x8e66('0xc')],{'host':_0x8e66('0xe'),'port':0x18eb});var socket=require(_0x8e66('0xf'))(new Redis(config[_0x8e66('0xc')]));require(_0x8e66('0x10'))[_0x8e66('0x11')](socket);function respondWithRpcPromise(_0x4b39e0,_0x4d973c,_0x201938){return new BPromise(function(_0x7b2f9a,_0x6769dc){return client[_0x8e66('0x12')](_0x4b39e0,_0x201938)[_0x8e66('0x13')](function(_0x48cb42){logger[_0x8e66('0x14')](_0x8e66('0x15'),_0x4d973c,_0x8e66('0x16'));logger[_0x8e66('0x17')](_0x8e66('0x18'),_0x4d973c,_0x8e66('0x16'),JSON[_0x8e66('0x19')](_0x48cb42));if(_0x48cb42[_0x8e66('0x1a')]){if(_0x48cb42[_0x8e66('0x1a')][_0x8e66('0x1b')]===0x1f4){logger[_0x8e66('0x1a')](_0x8e66('0x15'),_0x4d973c,_0x48cb42['error'][_0x8e66('0x1c')]);return _0x6769dc(_0x48cb42[_0x8e66('0x1a')][_0x8e66('0x1c')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x4d973c,_0x48cb42[_0x8e66('0x1a')][_0x8e66('0x1c')]);return _0x7b2f9a(_0x48cb42[_0x8e66('0x1a')][_0x8e66('0x1c')]);}else{logger[_0x8e66('0x14')]('ChatMessage,\x20%s,\x20%s',_0x4d973c,'request\x20sent');_0x7b2f9a(_0x48cb42[_0x8e66('0x1d')]['message']);}})[_0x8e66('0x1e')](function(_0x200048){logger[_0x8e66('0x1a')](_0x8e66('0x15'),_0x4d973c,_0x200048);_0x6769dc(_0x200048);});});}exports[_0x8e66('0x1f')]=function(_0x55c3b4){var _0x5b4d19=this;return new Promise(function(_0x516da8,_0x33681d){return db[_0x8e66('0x20')][_0x8e66('0x21')](_0x55c3b4[_0x8e66('0x22')],{'raw':_0x55c3b4[_0x8e66('0x23')]?_0x55c3b4[_0x8e66('0x23')][_0x8e66('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x25846e){logger['info'](_0x8e66('0x1f'),_0x55c3b4);logger[_0x8e66('0x17')](_0x8e66('0x1f'),_0x55c3b4,JSON[_0x8e66('0x19')](_0x25846e));_0x516da8(_0x25846e);})['catch'](function(_0xd2f087){logger[_0x8e66('0x1a')](_0x8e66('0x1f'),_0xd2f087[_0x8e66('0x1c')],_0x55c3b4);_0x33681d(_0x5b4d19[_0x8e66('0x1a')](0x1f4,_0xd2f087[_0x8e66('0x1c')]));});});}; \ No newline at end of file +var _0x0227=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','ChatMessage','body','options','raw','CreateChatMessage','debug','util'];(function(_0x29e32b,_0x101662){var _0x1b7c92=function(_0x2b73b7){while(--_0x2b73b7){_0x29e32b['push'](_0x29e32b['shift']());}};_0x1b7c92(++_0x101662);}(_0x0227,0x18b));var _0x7022=function(_0x2c4424,_0x2a0f63){_0x2c4424=_0x2c4424-0x0;var _0x351054=_0x0227[_0x2c4424];return _0x351054;};'use strict';var _=require('lodash');var util=require(_0x7022('0x0'));var moment=require(_0x7022('0x1'));var BPromise=require(_0x7022('0x2'));var rs=require(_0x7022('0x3'));var fs=require('fs');var Redis=require(_0x7022('0x4'));var db=require(_0x7022('0x5'))['db'];var utils=require(_0x7022('0x6'));var logger=require(_0x7022('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7022('0x8'));var client=jayson[_0x7022('0x9')][_0x7022('0xa')]({'port':0x232a});config[_0x7022('0xb')]=_[_0x7022('0xc')](config[_0x7022('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7022('0xb')]));require(_0x7022('0xd'))[_0x7022('0xe')](socket);function respondWithRpcPromise(_0x2ff0b0,_0x3c7cb1,_0x4109){return new BPromise(function(_0x5aac0d,_0x17cdfd){return client[_0x7022('0xf')](_0x2ff0b0,_0x4109)[_0x7022('0x10')](function(_0x28692e){logger['info'](_0x7022('0x11'),_0x3c7cb1,_0x7022('0x12'));logger['debug'](_0x7022('0x13'),_0x3c7cb1,_0x7022('0x12'),JSON[_0x7022('0x14')](_0x28692e));if(_0x28692e['error']){if(_0x28692e['error'][_0x7022('0x15')]===0x1f4){logger[_0x7022('0x16')](_0x7022('0x11'),_0x3c7cb1,_0x28692e[_0x7022('0x16')][_0x7022('0x17')]);return _0x17cdfd(_0x28692e[_0x7022('0x16')]['message']);}logger['error'](_0x7022('0x11'),_0x3c7cb1,_0x28692e[_0x7022('0x16')][_0x7022('0x17')]);return _0x5aac0d(_0x28692e[_0x7022('0x16')][_0x7022('0x17')]);}else{logger[_0x7022('0x18')](_0x7022('0x11'),_0x3c7cb1,_0x7022('0x12'));_0x5aac0d(_0x28692e[_0x7022('0x19')][_0x7022('0x17')]);}})[_0x7022('0x1a')](function(_0x53b030){logger[_0x7022('0x16')](_0x7022('0x11'),_0x3c7cb1,_0x53b030);_0x17cdfd(_0x53b030);});});}exports['CreateChatMessage']=function(_0x411f76){var _0x49f9a8=this;return new Promise(function(_0x3b655b,_0x139b25){return db[_0x7022('0x1b')]['create'](_0x411f76[_0x7022('0x1c')],{'raw':_0x411f76[_0x7022('0x1d')]?_0x411f76[_0x7022('0x1d')][_0x7022('0x1e')]===undefined?!![]:![]:!![]})[_0x7022('0x10')](function(_0x1bbc94){logger[_0x7022('0x18')](_0x7022('0x1f'),_0x411f76);logger[_0x7022('0x20')](_0x7022('0x1f'),_0x411f76,JSON[_0x7022('0x14')](_0x1bbc94));_0x3b655b(_0x1bbc94);})[_0x7022('0x1a')](function(_0x41e057){logger['error'](_0x7022('0x1f'),_0x41e057[_0x7022('0x17')],_0x411f76);_0x139b25(_0x49f9a8['error'](0x1f4,_0x41e057[_0x7022('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 56b57a7..c950d9e 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 _0x524e=['remove','update','emit','removeListener','register','length','chatMessage:'];(function(_0x191a26,_0x2bce74){var _0x3a17df=function(_0x228be5){while(--_0x228be5){_0x191a26['push'](_0x191a26['shift']());}};_0x3a17df(++_0x2bce74);}(_0x524e,0x15e));var _0xe524=function(_0x2f3ce8,_0x239b23){_0x2f3ce8=_0x2f3ce8-0x0;var _0x118844=_0x524e[_0x2f3ce8];return _0x118844;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0xe524('0x0'),_0xe524('0x1')];function createListener(_0xc5f6b5,_0x29e619){return function(_0x699159){_0x29e619[_0xe524('0x2')](_0xc5f6b5,_0x699159);};}function removeListener(_0xabd694,_0x32c90b){return function(){ChatMessageEvents[_0xe524('0x3')](_0xabd694,_0x32c90b);};}exports[_0xe524('0x4')]=function(_0x4f75d6){for(var _0xaaeaa9=0x0,_0x41e1a3=events[_0xe524('0x5')];_0xaaeaa9<_0x41e1a3;_0xaaeaa9++){var _0x533c14=events[_0xaaeaa9];var _0x384935=createListener(_0xe524('0x6')+_0x533c14,_0x4f75d6);ChatMessageEvents['on'](_0x533c14,_0x384935);}}; \ No newline at end of file +var _0x33af=['emit','removeListener','register','length','chatMessage:','save','update'];(function(_0x598d4c,_0x4f74d4){var _0x34d7f1=function(_0x26cfd3){while(--_0x26cfd3){_0x598d4c['push'](_0x598d4c['shift']());}};_0x34d7f1(++_0x4f74d4);}(_0x33af,0xec));var _0xf33a=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x33af[_0x42c118];return _0x112ebd;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){ChatMessageEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);ChatMessageEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index bafb2e0..5f4e521 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 _0x2e5a=['update','/:id/reject','reject','delete','multer','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x53c552,_0x129587){var _0x599000=function(_0x519b95){while(--_0x519b95){_0x53c552['push'](_0x53c552['shift']());}};_0x599000(++_0x129587);}(_0x2e5a,0x125));var _0xa2e5=function(_0x19cb51,_0x3f2fb9){_0x19cb51=_0x19cb51-0x0;var _0x3f62f8=_0x2e5a[_0x19cb51];return _0x3f62f8;};'use strict';var multer=require(_0xa2e5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa2e5('0x1')]();var auth=require(_0xa2e5('0x2'));var interaction=require(_0xa2e5('0x3'));var config=require('../../config/environment');var controller=require(_0xa2e5('0x4'));router[_0xa2e5('0x5')]('/',auth[_0xa2e5('0x6')](),controller[_0xa2e5('0x7')]);router[_0xa2e5('0x5')]('/describe',auth[_0xa2e5('0x6')](),controller[_0xa2e5('0x8')]);router['get'](_0xa2e5('0x9'),auth[_0xa2e5('0x6')](),controller[_0xa2e5('0xa')]);router[_0xa2e5('0xb')]('/',auth['isAuthenticated'](),interaction['tracked']('chat','chatmessage:create'),controller['create']);router[_0xa2e5('0xc')](_0xa2e5('0x9'),controller[_0xa2e5('0xd')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xa2e5('0xc')](_0xa2e5('0xe'),auth[_0xa2e5('0x6')](),controller[_0xa2e5('0xf')]);router[_0xa2e5('0x10')](_0xa2e5('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7724=['express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout'];(function(_0x4818e1,_0x3f434d){var _0x4cad09=function(_0x4105fa){while(--_0x4105fa){_0x4818e1['push'](_0x4818e1['shift']());}};_0x4cad09(++_0x3f434d);}(_0x7724,0xe6));var _0x4772=function(_0x5a47ac,_0x128140){_0x5a47ac=_0x5a47ac-0x0;var _0x99111f=_0x7724[_0x5a47ac];return _0x99111f;};'use strict';var multer=require(_0x4772('0x0'));var util=require(_0x4772('0x1'));var path=require(_0x4772('0x2'));var timeout=require(_0x4772('0x3'));var express=require(_0x4772('0x4'));var router=express[_0x4772('0x5')]();var auth=require(_0x4772('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4772('0x7'));var controller=require(_0x4772('0x8'));router[_0x4772('0x9')]('/',auth[_0x4772('0xa')](),controller[_0x4772('0xb')]);router[_0x4772('0x9')](_0x4772('0xc'),auth[_0x4772('0xa')](),controller[_0x4772('0xd')]);router['get'](_0x4772('0xe'),auth[_0x4772('0xa')](),controller[_0x4772('0xf')]);router[_0x4772('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('chat',_0x4772('0x11')),controller['create']);router[_0x4772('0x12')](_0x4772('0xe'),controller[_0x4772('0x13')]);router[_0x4772('0x12')](_0x4772('0x14'),auth[_0x4772('0xa')](),controller[_0x4772('0x15')]);router['put'](_0x4772('0x16'),auth['isAuthenticated'](),controller[_0x4772('0x17')]);router[_0x4772('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4772('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9aeba1d..f6026a6 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 _0x8acf=['sequelize','exports','TEXT','medium'];(function(_0x3e8f4d,_0x2973ed){var _0x590a2e=function(_0x5ebea8){while(--_0x5ebea8){_0x3e8f4d['push'](_0x3e8f4d['shift']());}};_0x590a2e(++_0x2973ed);}(_0x8acf,0x1ec));var _0xf8ac=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x8acf[_0x1ff2ec];return _0x405683;};'use strict';var Sequelize=require(_0xf8ac('0x0'));module[_0xf8ac('0x1')]={'body':{'type':Sequelize[_0xf8ac('0x2')](_0xf8ac('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x929c=['TEXT','medium','sequelize','exports'];(function(_0xb87f83,_0x30d965){var _0x3dd56f=function(_0x2ae28c){while(--_0x2ae28c){_0xb87f83['push'](_0xb87f83['shift']());}};_0x3dd56f(++_0x30d965);}(_0x929c,0x16e));var _0xc929=function(_0x550a13,_0x5abdc9){_0x550a13=_0x550a13-0x0;var _0x17340e=_0x929c[_0x550a13];return _0x17340e;};'use strict';var Sequelize=require(_0xc929('0x0'));module[_0xc929('0x1')]={'body':{'type':Sequelize[_0xc929('0x2')](_0xc929('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 7e6a089..7843919 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 _0x2eb2=['apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','set','Content-Range','json'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x2eb2[_0x1035c1];return _0x308d67;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x22eb('0x0'));var rimraf=require(_0x22eb('0x1'));var zipdir=require(_0x22eb('0x2'));var jsonpatch=require(_0x22eb('0x3'));var rp=require(_0x22eb('0x4'));var moment=require(_0x22eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x22eb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x22eb('0x7'));var csv=require(_0x22eb('0x8'));var ejs=require(_0x22eb('0x9'));var fs=require('fs');var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x8'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5068ea,_0x1f286c){_0x1f286c=_0x1f286c||0xcc;return function(_0x189f05){if(_0x189f05){return _0x5068ea[_0x22eb('0x16')](_0x1f286c);}return _0x5068ea[_0x22eb('0x17')](_0x1f286c)[_0x22eb('0x18')]();};}function respondWithResult(_0x49e37e,_0x350ade){_0x350ade=_0x350ade||0xc8;return function(_0x53f14e){if(_0x53f14e){return _0x49e37e[_0x22eb('0x17')](_0x350ade)['json'](_0x53f14e);}};}function respondWithFilteredResult(_0x40c8cb,_0x84c668){return function(_0x53abbf){if(_0x53abbf){var _0x48b63c=_0x53abbf['count'],_0x4bc29a=_0x84c668[_0x22eb('0x19')],_0x2ed8a7=_0x84c668['offset']+_0x84c668['limit'],_0x5245fe;if(_0x2ed8a7>=_0x48b63c){_0x2ed8a7=_0x48b63c;_0x5245fe=0xc8;}else{_0x5245fe=0xce;}_0x40c8cb[_0x22eb('0x17')](_0x5245fe);return _0x40c8cb[_0x22eb('0x1a')](_0x22eb('0x1b'),_0x4bc29a+'-'+_0x2ed8a7+'/'+_0x48b63c)[_0x22eb('0x1c')](_0x53abbf);}return null;};}function patchUpdates(_0x3b0940){return function(_0x4bc0a2){try{jsonpatch[_0x22eb('0x1d')](_0x4bc0a2,_0x3b0940,!![]);}catch(_0x12bbd1){return BPromise[_0x22eb('0x1e')](_0x12bbd1);}return _0x4bc0a2[_0x22eb('0x1f')]();};}function saveUpdates(_0x36be50,_0x517313){return function(_0x2eb115){if(_0x2eb115){return _0x2eb115[_0x22eb('0x20')](_0x36be50)[_0x22eb('0x21')](function(_0x49ce2a){return _0x49ce2a;});}return null;};}function removeEntity(_0x490b34,_0x4335b7){return function(_0x267d97){if(_0x267d97){return _0x267d97[_0x22eb('0x22')]()[_0x22eb('0x21')](function(){_0x490b34[_0x22eb('0x17')](0xcc)[_0x22eb('0x18')]();});}};}function handleEntityNotFound(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(!_0x2e8f7c){_0x43dacb[_0x22eb('0x16')](0x194);}return _0x2e8f7c;};}function handleError(_0x3ffa9e,_0x3031b3){_0x3031b3=_0x3031b3||0x1f4;return function(_0x420d4f){logger['error'](_0x420d4f[_0x22eb('0x23')]);if(_0x420d4f[_0x22eb('0x24')]){delete _0x420d4f[_0x22eb('0x24')];}_0x3ffa9e['status'](_0x3031b3)[_0x22eb('0x25')](_0x420d4f);};}exports[_0x22eb('0x26')]=function(_0x4b409a,_0x32a4b6){var _0x222ef3={},_0x1e3015={},_0x2924f6={'count':0x0,'rows':[]};var _0x2da5c6=_['map'](db['ChatOfflineMessage'][_0x22eb('0x27')],function(_0x25e5bc){return{'name':_0x25e5bc[_0x22eb('0x28')],'type':_0x25e5bc[_0x22eb('0x29')][_0x22eb('0x2a')]};});_0x1e3015[_0x22eb('0x2b')]=_[_0x22eb('0x2c')](_0x2da5c6,_0x22eb('0x24'));_0x1e3015[_0x22eb('0x2d')]=_[_0x22eb('0x2e')](_0x4b409a[_0x22eb('0x2d')]);_0x1e3015[_0x22eb('0x2f')]=_['intersection'](_0x1e3015[_0x22eb('0x2b')],_0x1e3015['query']);_0x222ef3[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x1e3015[_0x22eb('0x2b')],qs[_0x22eb('0x32')](_0x4b409a[_0x22eb('0x2d')][_0x22eb('0x32')]));_0x222ef3[_0x22eb('0x30')]=_0x222ef3[_0x22eb('0x30')][_0x22eb('0x33')]?_0x222ef3[_0x22eb('0x30')]:_0x1e3015['model'];if(!_0x4b409a['query'][_0x22eb('0x34')]('nolimit')){_0x222ef3['limit']=qs[_0x22eb('0x35')](_0x4b409a[_0x22eb('0x2d')][_0x22eb('0x35')]);_0x222ef3[_0x22eb('0x19')]=qs[_0x22eb('0x19')](_0x4b409a[_0x22eb('0x2d')][_0x22eb('0x19')]);}_0x222ef3[_0x22eb('0x36')]=qs[_0x22eb('0x37')](_0x4b409a[_0x22eb('0x2d')]['sort']);_0x222ef3[_0x22eb('0x38')]=qs['filters'](_['pick'](_0x4b409a[_0x22eb('0x2d')],_0x1e3015[_0x22eb('0x2f')]),_0x2da5c6);if(_0x4b409a['query'][_0x22eb('0x39')]){_0x222ef3[_0x22eb('0x38')]=_[_0x22eb('0x3a')](_0x222ef3[_0x22eb('0x38')],{'$or':_[_0x22eb('0x2c')](_0x2da5c6,function(_0x574555){if(_0x574555[_0x22eb('0x29')]!==_0x22eb('0x3b')){var _0x5b8f98={};_0x5b8f98[_0x574555[_0x22eb('0x24')]]={'$like':'%'+_0x4b409a[_0x22eb('0x2d')][_0x22eb('0x39')]+'%'};return _0x5b8f98;}})});}_0x222ef3=_[_0x22eb('0x3a')]({},_0x222ef3,_0x4b409a[_0x22eb('0x3c')]);var _0x5382eb={'where':_0x222ef3['where']};return db[_0x22eb('0x3d')][_0x22eb('0x3e')](_0x5382eb)['then'](function(_0x595d76){_0x2924f6[_0x22eb('0x3e')]=_0x595d76;if(_0x4b409a[_0x22eb('0x2d')]['includeAll']){_0x222ef3[_0x22eb('0x3f')]=[{'all':!![]}];}return db[_0x22eb('0x3d')][_0x22eb('0x40')](_0x222ef3);})[_0x22eb('0x21')](function(_0x17a817){_0x2924f6[_0x22eb('0x41')]=_0x17a817;return _0x2924f6;})['then'](respondWithFilteredResult(_0x32a4b6,_0x222ef3))[_0x22eb('0x42')](handleError(_0x32a4b6,null));};exports[_0x22eb('0x43')]=function(_0x515b6d,_0x24ad2a){var _0x44d39f={'raw':!![],'where':{'id':_0x515b6d[_0x22eb('0x44')]['id']}},_0x204092={};_0x204092[_0x22eb('0x2b')]=_[_0x22eb('0x2e')](db[_0x22eb('0x3d')][_0x22eb('0x27')]);_0x204092[_0x22eb('0x2d')]=_[_0x22eb('0x2e')](_0x515b6d[_0x22eb('0x2d')]);_0x204092[_0x22eb('0x2f')]=_[_0x22eb('0x31')](_0x204092[_0x22eb('0x2b')],_0x204092[_0x22eb('0x2d')]);_0x44d39f[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x204092[_0x22eb('0x2b')],qs['fields'](_0x515b6d[_0x22eb('0x2d')][_0x22eb('0x32')]));_0x44d39f['attributes']=_0x44d39f[_0x22eb('0x30')][_0x22eb('0x33')]?_0x44d39f['attributes']:_0x204092['model'];if(_0x515b6d['query'][_0x22eb('0x45')]){_0x44d39f[_0x22eb('0x3f')]=[{'all':!![]}];}_0x44d39f=_['merge']({},_0x44d39f,_0x515b6d['options']);return db[_0x22eb('0x3d')][_0x22eb('0x46')](_0x44d39f)[_0x22eb('0x21')](handleEntityNotFound(_0x24ad2a,null))[_0x22eb('0x21')](respondWithResult(_0x24ad2a,null))[_0x22eb('0x42')](handleError(_0x24ad2a,null));};exports[_0x22eb('0x47')]=function(_0x80efb0,_0x147ca0){return db['ChatOfflineMessage']['create'](_0x80efb0[_0x22eb('0x48')],{})['then'](respondWithResult(_0x147ca0,0xc9))[_0x22eb('0x42')](handleError(_0x147ca0,null));};exports['update']=function(_0x8a2b2c,_0x5c41c0){if(_0x8a2b2c['body']['id']){delete _0x8a2b2c['body']['id'];}return db['ChatOfflineMessage'][_0x22eb('0x46')]({'where':{'id':_0x8a2b2c['params']['id']}})[_0x22eb('0x21')](handleEntityNotFound(_0x5c41c0,null))[_0x22eb('0x21')](saveUpdates(_0x8a2b2c['body'],null))[_0x22eb('0x21')](respondWithResult(_0x5c41c0,null))['catch'](handleError(_0x5c41c0,null));};exports[_0x22eb('0x22')]=function(_0x9c490b,_0x1df219){return db[_0x22eb('0x3d')][_0x22eb('0x46')]({'where':{'id':_0x9c490b[_0x22eb('0x44')]['id']}})[_0x22eb('0x21')](handleEntityNotFound(_0x1df219,null))[_0x22eb('0x21')](removeEntity(_0x1df219,null))[_0x22eb('0x42')](handleError(_0x1df219,null));};exports['describe']=function(_0x4055dc,_0x3ae464){return db['ChatOfflineMessage'][_0x22eb('0x49')]()[_0x22eb('0x21')](respondWithResult(_0x3ae464,null))[_0x22eb('0x42')](handleError(_0x3ae464,null));}; \ No newline at end of file +var _0x8ca9=['find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','keys'];(function(_0x10b491,_0xdbc8b){var _0x1c597b=function(_0x256920){while(--_0x256920){_0x10b491['push'](_0x10b491['shift']());}};_0x1c597b(++_0xdbc8b);}(_0x8ca9,0x9c));var _0x98ca=function(_0x1d1dd7,_0x46915f){_0x1d1dd7=_0x1d1dd7-0x0;var _0x5b7207=_0x8ca9[_0x1d1dd7];return _0x5b7207;};'use strict';var pdf=require(_0x98ca('0x0'));var emlformat=require(_0x98ca('0x1'));var rimraf=require(_0x98ca('0x2'));var zipdir=require(_0x98ca('0x3'));var jsonpatch=require(_0x98ca('0x4'));var rp=require(_0x98ca('0x5'));var moment=require(_0x98ca('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98ca('0x7'));var path=require('path');var sox=require(_0x98ca('0x8'));var csv=require('to-csv');var ejs=require(_0x98ca('0x9'));var fs=require('fs');var _=require(_0x98ca('0xa'));var squel=require(_0x98ca('0xb'));var crypto=require(_0x98ca('0xc'));var jsforce=require(_0x98ca('0xd'));var deskjs=require(_0x98ca('0xe'));var toCsv=require(_0x98ca('0xf'));var querystring=require(_0x98ca('0x10'));var Papa=require(_0x98ca('0x11'));var Redis=require(_0x98ca('0x12'));var authService=require(_0x98ca('0x13'));var qs=require(_0x98ca('0x14'));var as=require(_0x98ca('0x15'));var hardwareService=require(_0x98ca('0x16'));var logger=require(_0x98ca('0x17'))(_0x98ca('0x18'));var utils=require(_0x98ca('0x19'));var config=require(_0x98ca('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16221a,_0x44b65b){_0x44b65b=_0x44b65b||0xcc;return function(_0xba3887){if(_0xba3887){return _0x16221a[_0x98ca('0x1b')](_0x44b65b);}return _0x16221a['status'](_0x44b65b)[_0x98ca('0x1c')]();};}function respondWithResult(_0x6345be,_0x9a230e){_0x9a230e=_0x9a230e||0xc8;return function(_0xa2bab4){if(_0xa2bab4){return _0x6345be[_0x98ca('0x1d')](_0x9a230e)[_0x98ca('0x1e')](_0xa2bab4);}};}function respondWithFilteredResult(_0x58d07a,_0x4940ca){return function(_0x330713){if(_0x330713){var _0x29df1b=_0x330713[_0x98ca('0x1f')],_0x29f46b=_0x4940ca[_0x98ca('0x20')],_0x398171=_0x4940ca[_0x98ca('0x20')]+_0x4940ca[_0x98ca('0x21')],_0x52e9c8;if(_0x398171>=_0x29df1b){_0x398171=_0x29df1b;_0x52e9c8=0xc8;}else{_0x52e9c8=0xce;}_0x58d07a[_0x98ca('0x1d')](_0x52e9c8);return _0x58d07a[_0x98ca('0x22')](_0x98ca('0x23'),_0x29f46b+'-'+_0x398171+'/'+_0x29df1b)[_0x98ca('0x1e')](_0x330713);}return null;};}function patchUpdates(_0xddec43){return function(_0x110f9f){try{jsonpatch[_0x98ca('0x24')](_0x110f9f,_0xddec43,!![]);}catch(_0x4806a3){return BPromise[_0x98ca('0x25')](_0x4806a3);}return _0x110f9f['save']();};}function saveUpdates(_0x47a3f1,_0x2fe568){return function(_0x50f8b4){if(_0x50f8b4){return _0x50f8b4['update'](_0x47a3f1)[_0x98ca('0x26')](function(_0x170688){return _0x170688;});}return null;};}function removeEntity(_0x130544,_0x519927){return function(_0x2f7742){if(_0x2f7742){return _0x2f7742[_0x98ca('0x27')]()['then'](function(){_0x130544[_0x98ca('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fd0bd,_0x323cdb){return function(_0x430d16){if(!_0x430d16){_0x3fd0bd[_0x98ca('0x1b')](0x194);}return _0x430d16;};}function handleError(_0x8d669d,_0xe5091e){_0xe5091e=_0xe5091e||0x1f4;return function(_0x2a59e3){logger['error'](_0x2a59e3[_0x98ca('0x28')]);if(_0x2a59e3['name']){delete _0x2a59e3[_0x98ca('0x29')];}_0x8d669d[_0x98ca('0x1d')](_0xe5091e)['send'](_0x2a59e3);};}exports[_0x98ca('0x2a')]=function(_0x47d89f,_0x214649){var _0x4f48db={},_0x5bf77d={},_0x14bfb4={'count':0x0,'rows':[]};var _0x540f45=_[_0x98ca('0x2b')](db[_0x98ca('0x2c')][_0x98ca('0x2d')],function(_0x21a12a){return{'name':_0x21a12a[_0x98ca('0x2e')],'type':_0x21a12a[_0x98ca('0x2f')][_0x98ca('0x30')]};});_0x5bf77d[_0x98ca('0x31')]=_[_0x98ca('0x2b')](_0x540f45,'name');_0x5bf77d[_0x98ca('0x32')]=_['keys'](_0x47d89f[_0x98ca('0x32')]);_0x5bf77d[_0x98ca('0x33')]=_['intersection'](_0x5bf77d['model'],_0x5bf77d[_0x98ca('0x32')]);_0x4f48db['attributes']=_[_0x98ca('0x34')](_0x5bf77d['model'],qs[_0x98ca('0x35')](_0x47d89f['query'][_0x98ca('0x35')]));_0x4f48db[_0x98ca('0x36')]=_0x4f48db['attributes'][_0x98ca('0x37')]?_0x4f48db[_0x98ca('0x36')]:_0x5bf77d['model'];if(!_0x47d89f[_0x98ca('0x32')][_0x98ca('0x38')]('nolimit')){_0x4f48db[_0x98ca('0x21')]=qs[_0x98ca('0x21')](_0x47d89f[_0x98ca('0x32')][_0x98ca('0x21')]);_0x4f48db[_0x98ca('0x20')]=qs['offset'](_0x47d89f[_0x98ca('0x32')][_0x98ca('0x20')]);}_0x4f48db['order']=qs[_0x98ca('0x39')](_0x47d89f[_0x98ca('0x32')][_0x98ca('0x39')]);_0x4f48db['where']=qs[_0x98ca('0x33')](_[_0x98ca('0x3a')](_0x47d89f[_0x98ca('0x32')],_0x5bf77d['filters']),_0x540f45);if(_0x47d89f[_0x98ca('0x32')][_0x98ca('0x3b')]){_0x4f48db[_0x98ca('0x3c')]=_['merge'](_0x4f48db['where'],{'$or':_[_0x98ca('0x2b')](_0x540f45,function(_0xe77d02){if(_0xe77d02[_0x98ca('0x2f')]!=='VIRTUAL'){var _0x16f7b1={};_0x16f7b1[_0xe77d02[_0x98ca('0x29')]]={'$like':'%'+_0x47d89f[_0x98ca('0x32')]['filter']+'%'};return _0x16f7b1;}})});}_0x4f48db=_[_0x98ca('0x3d')]({},_0x4f48db,_0x47d89f[_0x98ca('0x3e')]);var _0x1059df={'where':_0x4f48db[_0x98ca('0x3c')]};return db[_0x98ca('0x2c')]['count'](_0x1059df)['then'](function(_0x4b811b){_0x14bfb4[_0x98ca('0x1f')]=_0x4b811b;if(_0x47d89f[_0x98ca('0x32')][_0x98ca('0x3f')]){_0x4f48db[_0x98ca('0x40')]=[{'all':!![]}];}return db[_0x98ca('0x2c')][_0x98ca('0x41')](_0x4f48db);})[_0x98ca('0x26')](function(_0x570afe){_0x14bfb4['rows']=_0x570afe;return _0x14bfb4;})[_0x98ca('0x26')](respondWithFilteredResult(_0x214649,_0x4f48db))[_0x98ca('0x42')](handleError(_0x214649,null));};exports[_0x98ca('0x43')]=function(_0x382989,_0x17fdc7){var _0x535fdc={'raw':!![],'where':{'id':_0x382989['params']['id']}},_0x55161f={};_0x55161f[_0x98ca('0x31')]=_[_0x98ca('0x44')](db[_0x98ca('0x2c')][_0x98ca('0x2d')]);_0x55161f['query']=_['keys'](_0x382989[_0x98ca('0x32')]);_0x55161f[_0x98ca('0x33')]=_[_0x98ca('0x34')](_0x55161f[_0x98ca('0x31')],_0x55161f[_0x98ca('0x32')]);_0x535fdc[_0x98ca('0x36')]=_[_0x98ca('0x34')](_0x55161f[_0x98ca('0x31')],qs[_0x98ca('0x35')](_0x382989[_0x98ca('0x32')][_0x98ca('0x35')]));_0x535fdc['attributes']=_0x535fdc[_0x98ca('0x36')][_0x98ca('0x37')]?_0x535fdc[_0x98ca('0x36')]:_0x55161f[_0x98ca('0x31')];if(_0x382989[_0x98ca('0x32')][_0x98ca('0x3f')]){_0x535fdc[_0x98ca('0x40')]=[{'all':!![]}];}_0x535fdc=_[_0x98ca('0x3d')]({},_0x535fdc,_0x382989[_0x98ca('0x3e')]);return db['ChatOfflineMessage'][_0x98ca('0x45')](_0x535fdc)[_0x98ca('0x26')](handleEntityNotFound(_0x17fdc7,null))['then'](respondWithResult(_0x17fdc7,null))[_0x98ca('0x42')](handleError(_0x17fdc7,null));};exports['create']=function(_0x3946b3,_0x39f4fd){return db[_0x98ca('0x2c')][_0x98ca('0x46')](_0x3946b3[_0x98ca('0x47')],{})[_0x98ca('0x26')](respondWithResult(_0x39f4fd,0xc9))[_0x98ca('0x42')](handleError(_0x39f4fd,null));};exports[_0x98ca('0x48')]=function(_0x2c7d53,_0x42a53d){if(_0x2c7d53[_0x98ca('0x47')]['id']){delete _0x2c7d53[_0x98ca('0x47')]['id'];}return db['ChatOfflineMessage'][_0x98ca('0x45')]({'where':{'id':_0x2c7d53[_0x98ca('0x49')]['id']}})[_0x98ca('0x26')](handleEntityNotFound(_0x42a53d,null))[_0x98ca('0x26')](saveUpdates(_0x2c7d53['body'],null))[_0x98ca('0x26')](respondWithResult(_0x42a53d,null))[_0x98ca('0x42')](handleError(_0x42a53d,null));};exports[_0x98ca('0x27')]=function(_0x3de7a4,_0x2141ef){return db[_0x98ca('0x2c')][_0x98ca('0x45')]({'where':{'id':_0x3de7a4['params']['id']}})['then'](handleEntityNotFound(_0x2141ef,null))['then'](removeEntity(_0x2141ef,null))[_0x98ca('0x42')](handleError(_0x2141ef,null));};exports[_0x98ca('0x4a')]=function(_0x3fc063,_0x2fdcb4){return db['ChatOfflineMessage']['describe']()[_0x98ca('0x26')](respondWithResult(_0x2fdcb4,null))[_0x98ca('0x42')](handleError(_0x2fdcb4,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 9957eec..4d8fec0 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 _0xfeed=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x49e8aa,_0x5e433e){var _0x4ac592=function(_0x3ff4fe){while(--_0x3ff4fe){_0x49e8aa['push'](_0x49e8aa['shift']());}};_0x4ac592(++_0x5e433e);}(_0xfeed,0x88));var _0xdfee=function(_0x3536f5,_0x2f5fbd){_0x3536f5=_0x3536f5-0x0;var _0x51e4b6=_0xfeed[_0x3536f5];return _0x51e4b6;};'use strict';var _=require(_0xdfee('0x0'));var util=require('util');var logger=require(_0xdfee('0x1'))(_0xdfee('0x2'));var moment=require(_0xdfee('0x3'));var BPromise=require(_0xdfee('0x4'));var rp=require(_0xdfee('0x5'));var fs=require('fs');var path=require(_0xdfee('0x6'));var rimraf=require('rimraf');var config=require(_0xdfee('0x7'));var attributes=require(_0xdfee('0x8'));module[_0xdfee('0x9')]=function(_0x57469b,_0x502ed3){return _0x57469b[_0xdfee('0xa')](_0xdfee('0xb'),attributes,{'tableName':_0xdfee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdfee('0xd'),'collate':_0xdfee('0xe')});}; \ No newline at end of file +var _0x4a08=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x4a08,0x19f));var _0x84a0=function(_0x34488f,_0x2c0c47){_0x34488f=_0x34488f-0x0;var _0x4c0130=_0x4a08[_0x34488f];return _0x4c0130;};'use strict';var _=require(_0x84a0('0x0'));var util=require(_0x84a0('0x1'));var logger=require(_0x84a0('0x2'))(_0x84a0('0x3'));var moment=require(_0x84a0('0x4'));var BPromise=require(_0x84a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84a0('0x6'));var rimraf=require(_0x84a0('0x7'));var config=require(_0x84a0('0x8'));var attributes=require(_0x84a0('0x9'));module[_0x84a0('0xa')]=function(_0x1fe4cc,_0x265556){return _0x1fe4cc[_0x84a0('0xb')](_0x84a0('0xc'),attributes,{'tableName':_0x84a0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x84a0('0xe'),'collate':_0x84a0('0xf')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index fe8ff46..f54ce9c 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 _0x8230=['ChatOfflineMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','code','error','message'];(function(_0x201edc,_0xc3d513){var _0x34efee=function(_0x22f107){while(--_0x22f107){_0x201edc['push'](_0x201edc['shift']());}};_0x34efee(++_0xc3d513);}(_0x8230,0x192));var _0x0823=function(_0x4515ad,_0xefafc3){_0x4515ad=_0x4515ad-0x0;var _0x43478a=_0x8230[_0x4515ad];return _0x43478a;};'use strict';var _=require(_0x0823('0x0'));var util=require(_0x0823('0x1'));var moment=require(_0x0823('0x2'));var BPromise=require(_0x0823('0x3'));var rs=require(_0x0823('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0823('0x5'));var config=require(_0x0823('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0823('0x7')][_0x0823('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2990b4,_0x505596,_0x28f3bf){return new BPromise(function(_0x1bb4aa,_0x3c7058){return client[_0x0823('0x9')](_0x2990b4,_0x28f3bf)['then'](function(_0x1f5140){logger[_0x0823('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x505596,_0x0823('0xb'));logger[_0x0823('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x505596,_0x0823('0xb'),JSON['stringify'](_0x1f5140));if(_0x1f5140['error']){if(_0x1f5140['error'][_0x0823('0xd')]===0x1f4){logger[_0x0823('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x505596,_0x1f5140['error'][_0x0823('0xf')]);return _0x3c7058(_0x1f5140[_0x0823('0xe')][_0x0823('0xf')]);}logger[_0x0823('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x505596,_0x1f5140[_0x0823('0xe')][_0x0823('0xf')]);return _0x1bb4aa(_0x1f5140[_0x0823('0xe')][_0x0823('0xf')]);}else{logger[_0x0823('0xa')](_0x0823('0x10'),_0x505596,_0x0823('0xb'));_0x1bb4aa(_0x1f5140[_0x0823('0x11')]['message']);}})[_0x0823('0x12')](function(_0x2743ea){logger[_0x0823('0xe')](_0x0823('0x10'),_0x505596,_0x2743ea);_0x3c7058(_0x2743ea);});});} \ No newline at end of file +var _0x98e9=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','ChatOfflineMessage,\x20%s,\x20%s','info','lodash','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','request'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x98e9,0x78));var _0x998e=function(_0x488ba6,_0x2d234b){_0x488ba6=_0x488ba6-0x0;var _0x3b9c76=_0x98e9[_0x488ba6];return _0x3b9c76;};'use strict';var _=require(_0x998e('0x0'));var util=require(_0x998e('0x1'));var moment=require(_0x998e('0x2'));var BPromise=require(_0x998e('0x3'));var rs=require(_0x998e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x998e('0x5'));var jayson=require(_0x998e('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ec2bd,_0x24e072,_0x138bf1){return new BPromise(function(_0x6fc821,_0x1d5fe4){return client[_0x998e('0x7')](_0x5ec2bd,_0x138bf1)['then'](function(_0x855dc4){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x24e072,_0x998e('0x8'));logger[_0x998e('0x9')](_0x998e('0xa'),_0x24e072,_0x998e('0x8'),JSON['stringify'](_0x855dc4));if(_0x855dc4[_0x998e('0xb')]){if(_0x855dc4['error'][_0x998e('0xc')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x24e072,_0x855dc4['error']['message']);return _0x1d5fe4(_0x855dc4[_0x998e('0xb')][_0x998e('0xd')]);}logger[_0x998e('0xb')](_0x998e('0xe'),_0x24e072,_0x855dc4[_0x998e('0xb')][_0x998e('0xd')]);return _0x6fc821(_0x855dc4[_0x998e('0xb')][_0x998e('0xd')]);}else{logger[_0x998e('0xf')](_0x998e('0xe'),_0x24e072,_0x998e('0x8'));_0x6fc821(_0x855dc4['result'][_0x998e('0xd')]);}})['catch'](function(_0x50a88b){logger[_0x998e('0xb')](_0x998e('0xe'),_0x24e072,_0x50a88b);_0x1d5fe4(_0x50a88b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ddcccb8..80725b4 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 _0xc716=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','create'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0xc716,0x196));var _0x6c71=function(_0x1165d8,_0x3d0e05){_0x1165d8=_0x1165d8-0x0;var _0x31676c=_0xc716[_0x1165d8];return _0x31676c;};'use strict';var multer=require(_0x6c71('0x0'));var util=require(_0x6c71('0x1'));var path=require(_0x6c71('0x2'));var timeout=require(_0x6c71('0x3'));var express=require(_0x6c71('0x4'));var router=express['Router']();var auth=require(_0x6c71('0x5'));var interaction=require(_0x6c71('0x6'));var config=require(_0x6c71('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x6c71('0x8')]('/',auth[_0x6c71('0x9')](),controller['index']);router[_0x6c71('0x8')](_0x6c71('0xa'),auth[_0x6c71('0x9')](),controller['describe']);router[_0x6c71('0x8')](_0x6c71('0xb'),auth[_0x6c71('0x9')](),controller[_0x6c71('0xc')]);router['post']('/',auth[_0x6c71('0x9')](),controller[_0x6c71('0xd')]);router['put']('/:id',auth[_0x6c71('0x9')](),controller['update']);router['delete']('/:id',auth[_0x6c71('0x9')](),controller['destroy']);module[_0x6c71('0xe')]=router; \ No newline at end of file +var _0xfc9b=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0xe8f8e0,_0xdabc0b){var _0x30507c=function(_0x38f7b3){while(--_0x38f7b3){_0xe8f8e0['push'](_0xe8f8e0['shift']());}};_0x30507c(++_0xdabc0b);}(_0xfc9b,0x199));var _0xbfc9=function(_0x107d63,_0x1a4a18){_0x107d63=_0x107d63-0x0;var _0x160d06=_0xfc9b[_0x107d63];return _0x160d06;};'use strict';var multer=require('multer');var util=require(_0xbfc9('0x0'));var path=require(_0xbfc9('0x1'));var timeout=require('connect-timeout');var express=require(_0xbfc9('0x2'));var router=express[_0xbfc9('0x3')]();var auth=require(_0xbfc9('0x4'));var interaction=require(_0xbfc9('0x5'));var config=require(_0xbfc9('0x6'));var controller=require(_0xbfc9('0x7'));router[_0xbfc9('0x8')]('/',auth[_0xbfc9('0x9')](),controller['index']);router[_0xbfc9('0x8')](_0xbfc9('0xa'),auth[_0xbfc9('0x9')](),controller[_0xbfc9('0xb')]);router[_0xbfc9('0x8')](_0xbfc9('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbfc9('0xd')](_0xbfc9('0xc'),auth['isAuthenticated'](),controller[_0xbfc9('0xe')]);router[_0xbfc9('0xf')](_0xbfc9('0xc'),auth[_0xbfc9('0x9')](),controller[_0xbfc9('0x10')]);module[_0xbfc9('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3ecbbd7..0f7c6cb 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 _0x5bd3=['mouseOver','STRING','INTEGER','sequelize','ENUM'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x5bd3,0x19d));var _0x35bd=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x5bd3[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0x35bd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x35bd('0x1')](_0x35bd('0x2'),'timeout'),'defaultValue':_0x35bd('0x2')},'selector':{'type':Sequelize[_0x35bd('0x3')]},'timeout':{'type':Sequelize[_0x35bd('0x4')]}}; \ No newline at end of file +var _0xea8f=['mouseOver','timeout','exports','STRING','ENUM'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xea8f,0x147));var _0xfea8=function(_0x48d834,_0x5732b1){_0x48d834=_0x48d834-0x0;var _0x5f4e4e=_0xea8f[_0x48d834];return _0x5f4e4e;};'use strict';var Sequelize=require('sequelize');module[_0xfea8('0x0')]={'name':{'type':Sequelize[_0xfea8('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfea8('0x2')](_0xfea8('0x3'),_0xfea8('0x4')),'defaultValue':_0xfea8('0x3')},'selector':{'type':Sequelize[_0xfea8('0x1')]},'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 eb9ffc8..962da14 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 _0xe706=['../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','ChatProactiveAction','body','destroy','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x513bc9,_0x547849){var _0xe2a04=function(_0x288f41){while(--_0x288f41){_0x513bc9['push'](_0x513bc9['shift']());}};_0xe2a04(++_0x547849);}(_0xe706,0xa3));var _0x6e70=function(_0x407654,_0x275ae3){_0x407654=_0x407654-0x0;var _0x521dbd=_0xe706[_0x407654];return _0x521dbd;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={'raw':!![],'where':{'id':_0x4a67ac[_0x6e70('0x2c')]['id']}},_0x3af17f={};_0x3af17f[_0x6e70('0x2d')]=_[_0x6e70('0x2e')](db['ChatProactiveAction'][_0x6e70('0x2f')]);_0x3af17f[_0x6e70('0x30')]=_[_0x6e70('0x2e')](_0x4a67ac[_0x6e70('0x30')]);_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x3af17f[_0x6e70('0x2d')],_0x3af17f[_0x6e70('0x30')]);_0x2c4d37[_0x6e70('0x33')]=_[_0x6e70('0x32')](_0x3af17f['model'],qs[_0x6e70('0x34')](_0x4a67ac['query'][_0x6e70('0x34')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x33')][_0x6e70('0x35')]?_0x2c4d37[_0x6e70('0x33')]:_0x3af17f['model'];if(_0x4a67ac[_0x6e70('0x30')][_0x6e70('0x36')]){_0x2c4d37['include']=[{'all':!![]}];}_0x2c4d37=_[_0x6e70('0x37')]({},_0x2c4d37,_0x4a67ac[_0x6e70('0x38')]);return db['ChatProactiveAction'][_0x6e70('0x39')](_0x2c4d37)[_0x6e70('0x27')](handleEntityNotFound(_0x54a5fe,null))[_0x6e70('0x27')](respondWithResult(_0x54a5fe,null))[_0x6e70('0x3a')](handleError(_0x54a5fe,null));};exports[_0x6e70('0x3b')]=function(_0x1e3e76,_0x44b19d){return db[_0x6e70('0x3c')][_0x6e70('0x3b')](_0x1e3e76[_0x6e70('0x3d')],{})['then'](respondWithResult(_0x44b19d,0xc9))[_0x6e70('0x3a')](handleError(_0x44b19d,null));};exports['update']=function(_0x23cd1a,_0x3222a2){if(_0x23cd1a[_0x6e70('0x3d')]['id']){delete _0x23cd1a[_0x6e70('0x3d')]['id'];}return db[_0x6e70('0x3c')][_0x6e70('0x39')]({'where':{'id':_0x23cd1a[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x3222a2,null))[_0x6e70('0x27')](saveUpdates(_0x23cd1a[_0x6e70('0x3d')],null))[_0x6e70('0x27')](respondWithResult(_0x3222a2,null))[_0x6e70('0x3a')](handleError(_0x3222a2,null));};exports[_0x6e70('0x3e')]=function(_0x501b53,_0x5446a2){return db['ChatProactiveAction'][_0x6e70('0x39')]({'where':{'id':_0x501b53[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x5446a2,null))[_0x6e70('0x27')](removeEntity(_0x5446a2,null))[_0x6e70('0x3a')](handleError(_0x5446a2,null));}; \ No newline at end of file +var _0x9c44=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x6cc7e1,_0x2a18e6){var _0x3961a6=function(_0x4cbb34){while(--_0x4cbb34){_0x6cc7e1['push'](_0x6cc7e1['shift']());}};_0x3961a6(++_0x2a18e6);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 730f4f3..b4cf803 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 _0x564f=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x564f,0x1f4));var _0xf564=function(_0x8133ca,_0x3b2efc){_0x8133ca=_0x8133ca-0x0;var _0x225e17=_0x564f[_0x8133ca];return _0x225e17;};'use strict';var _=require('lodash');var util=require(_0xf564('0x0'));var logger=require(_0xf564('0x1'))('api');var moment=require(_0xf564('0x2'));var BPromise=require(_0xf564('0x3'));var rp=require(_0xf564('0x4'));var fs=require('fs');var path=require(_0xf564('0x5'));var rimraf=require('rimraf');var config=require(_0xf564('0x6'));var attributes=require(_0xf564('0x7'));module[_0xf564('0x8')]=function(_0xc5bcd3,_0x2fe607){return _0xc5bcd3[_0xf564('0x9')](_0xf564('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06b3=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x40d04f,_0x1a94bb){var _0x1b728c=function(_0x163fe0){while(--_0x163fe0){_0x40d04f['push'](_0x40d04f['shift']());}};_0x1b728c(++_0x1a94bb);}(_0x06b3,0x1b3));var _0x306b=function(_0x500774,_0x329ba1){_0x500774=_0x500774-0x0;var _0x15c7b7=_0x06b3[_0x500774];return _0x15c7b7;};'use strict';var _=require(_0x306b('0x0'));var util=require(_0x306b('0x1'));var logger=require(_0x306b('0x2'))(_0x306b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x306b('0x4'));var fs=require('fs');var path=require(_0x306b('0x5'));var rimraf=require('rimraf');var config=require(_0x306b('0x6'));var attributes=require(_0x306b('0x7'));module[_0x306b('0x8')]=function(_0x14b028,_0x1c6135){return _0x14b028[_0x306b('0x9')](_0x306b('0xa'),attributes,{'tableName':_0x306b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index c52cc2e..03f75a3 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 _0x0674=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x13549a,_0x1ae1aa){var _0x49b032=function(_0x2a6390){while(--_0x2a6390){_0x13549a['push'](_0x13549a['shift']());}};_0x49b032(++_0x1ae1aa);}(_0x0674,0x142));var _0x4067=function(_0x450991,_0x4770de){_0x450991=_0x450991-0x0;var _0x616e9=_0x0674[_0x450991];return _0x616e9;};'use strict';var _=require('lodash');var util=require(_0x4067('0x0'));var moment=require(_0x4067('0x1'));var BPromise=require(_0x4067('0x2'));var rs=require(_0x4067('0x3'));var fs=require('fs');var Redis=require(_0x4067('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4067('0x5'))(_0x4067('0x6'));var config=require('../../config/environment');var jayson=require(_0x4067('0x7'));var client=jayson[_0x4067('0x8')][_0x4067('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f222d,_0x5ea930,_0x59367e){return new BPromise(function(_0x31b109,_0x485c00){return client[_0x4067('0xa')](_0x1f222d,_0x59367e)[_0x4067('0xb')](function(_0x4512e5){logger[_0x4067('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ea930,_0x4067('0xd'));logger['debug'](_0x4067('0xe'),_0x5ea930,_0x4067('0xd'),JSON[_0x4067('0xf')](_0x4512e5));if(_0x4512e5[_0x4067('0x10')]){if(_0x4512e5['error']['code']===0x1f4){logger[_0x4067('0x10')](_0x4067('0x11'),_0x5ea930,_0x4512e5[_0x4067('0x10')]['message']);return _0x485c00(_0x4512e5['error'][_0x4067('0x12')]);}logger[_0x4067('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ea930,_0x4512e5['error'][_0x4067('0x12')]);return _0x31b109(_0x4512e5[_0x4067('0x10')][_0x4067('0x12')]);}else{logger[_0x4067('0xc')](_0x4067('0x11'),_0x5ea930,_0x4067('0xd'));_0x31b109(_0x4512e5[_0x4067('0x13')][_0x4067('0x12')]);}})[_0x4067('0x14')](function(_0x49b95e){logger[_0x4067('0x10')](_0x4067('0x11'),_0x5ea930,_0x49b95e);_0x485c00(_0x49b95e);});});} \ No newline at end of file +var _0xe140=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xe140,0xa8));var _0x0e14=function(_0x4d1711,_0x129f6d){_0x4d1711=_0x4d1711-0x0;var _0x2509e9=_0xe140[_0x4d1711];return _0x2509e9;};'use strict';var _=require(_0x0e14('0x0'));var util=require(_0x0e14('0x1'));var moment=require(_0x0e14('0x2'));var BPromise=require(_0x0e14('0x3'));var rs=require(_0x0e14('0x4'));var fs=require('fs');var Redis=require(_0x0e14('0x5'));var db=require(_0x0e14('0x6'))['db'];var utils=require(_0x0e14('0x7'));var logger=require(_0x0e14('0x8'))('rpc');var config=require(_0x0e14('0x9'));var jayson=require(_0x0e14('0xa'));var client=jayson[_0x0e14('0xb')][_0x0e14('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cb751,_0x15325b,_0x2174a7){return new BPromise(function(_0x1d3dd1,_0x173dc8){return client['request'](_0x5cb751,_0x2174a7)[_0x0e14('0xd')](function(_0x50f9ae){logger[_0x0e14('0xe')](_0x0e14('0xf'),_0x15325b,_0x0e14('0x10'));logger[_0x0e14('0x11')](_0x0e14('0x12'),_0x15325b,_0x0e14('0x10'),JSON['stringify'](_0x50f9ae));if(_0x50f9ae['error']){if(_0x50f9ae[_0x0e14('0x13')][_0x0e14('0x14')]===0x1f4){logger[_0x0e14('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x15325b,_0x50f9ae[_0x0e14('0x13')][_0x0e14('0x15')]);return _0x173dc8(_0x50f9ae[_0x0e14('0x13')][_0x0e14('0x15')]);}logger['error'](_0x0e14('0xf'),_0x15325b,_0x50f9ae[_0x0e14('0x13')]['message']);return _0x1d3dd1(_0x50f9ae[_0x0e14('0x13')][_0x0e14('0x15')]);}else{logger['info'](_0x0e14('0xf'),_0x15325b,'request\x20sent');_0x1d3dd1(_0x50f9ae[_0x0e14('0x16')][_0x0e14('0x15')]);}})['catch'](function(_0x53e00a){logger['error'](_0x0e14('0xf'),_0x15325b,_0x53e00a);_0x173dc8(_0x53e00a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a2589e5..068e7e7 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 _0x7f2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','update','delete','exports','util','path','express','Router'];(function(_0x589bf2,_0x34d5f5){var _0x2a7446=function(_0x5d2bcb){while(--_0x5d2bcb){_0x589bf2['push'](_0x589bf2['shift']());}};_0x2a7446(++_0x34d5f5);}(_0x7f2f,0x11c));var _0xf7f2=function(_0x50fb34,_0x56b847){_0x50fb34=_0x50fb34-0x0;var _0x478797=_0x7f2f[_0x50fb34];return _0x478797;};'use strict';var multer=require('multer');var util=require(_0xf7f2('0x0'));var path=require(_0xf7f2('0x1'));var timeout=require('connect-timeout');var express=require(_0xf7f2('0x2'));var router=express[_0xf7f2('0x3')]();var auth=require(_0xf7f2('0x4'));var interaction=require(_0xf7f2('0x5'));var config=require(_0xf7f2('0x6'));var controller=require('./chatProactiveAction.controller');router[_0xf7f2('0x7')]('/:id',auth[_0xf7f2('0x8')](),controller[_0xf7f2('0x9')]);router['post']('/',auth[_0xf7f2('0x8')](),controller[_0xf7f2('0xa')]);router[_0xf7f2('0xb')](_0xf7f2('0xc'),auth[_0xf7f2('0x8')](),controller[_0xf7f2('0xd')]);router[_0xf7f2('0xe')]('/:id',auth[_0xf7f2('0x8')](),controller['destroy']);module[_0xf7f2('0xf')]=router; \ No newline at end of file +var _0x1e19=['./chatProactiveAction.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1b098d,_0x4cd2b9){var _0x18b68c=function(_0x2e79b1){while(--_0x2e79b1){_0x1b098d['push'](_0x1b098d['shift']());}};_0x18b68c(++_0x4cd2b9);}(_0x1e19,0x1c9));var _0x91e1=function(_0x152c7b,_0xec72d9){_0x152c7b=_0x152c7b-0x0;var _0x572d41=_0x1e19[_0x152c7b];return _0x572d41;};'use strict';var multer=require(_0x91e1('0x0'));var util=require(_0x91e1('0x1'));var path=require(_0x91e1('0x2'));var timeout=require(_0x91e1('0x3'));var express=require(_0x91e1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x91e1('0x5'));router[_0x91e1('0x6')](_0x91e1('0x7'),auth[_0x91e1('0x8')](),controller[_0x91e1('0x9')]);router['post']('/',auth[_0x91e1('0x8')](),controller['create']);router[_0x91e1('0xa')](_0x91e1('0x7'),auth[_0x91e1('0x8')](),controller[_0x91e1('0xb')]);router[_0x91e1('0xc')]('/:id',auth[_0x91e1('0x8')](),controller[_0x91e1('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4049f29..d0828a4 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 _0xee00=['STRING','ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xee00,0x100));var _0x0ee0=function(_0x408f2,_0x187b55){_0x408f2=_0x408f2-0x0;var _0x53aada=_0xee00[_0x408f2];return _0x53aada;};'use strict';var Sequelize=require(_0x0ee0('0x0'));module[_0x0ee0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0ee0('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0ee0('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0ee0('0x4')](_0x0ee0('0x5'),'beepall',_0x0ee0('0x6'))}}; \ No newline at end of file +var _0x6a50=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x6a50,0x100));var _0x06a5=function(_0x3b45d7,_0xbc2848){_0x3b45d7=_0x3b45d7-0x0;var _0x4690e8=_0x6a50[_0x3b45d7];return _0x4690e8;};'use strict';var Sequelize=require('sequelize');module[_0x06a5('0x0')]={'name':{'type':Sequelize[_0x06a5('0x1')],'unique':_0x06a5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x06a5('0x1')]},'timeout':{'type':Sequelize[_0x06a5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x06a5('0x4')](_0x06a5('0x5'),_0x06a5('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index efae893..a8affb4 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 _0xd81d=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.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','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','where','pick','merge','VIRTUAL','filter','options','includeAll','include','show','params','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','nolimit','order','sort','ChatQueueId','findAll','User','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','ids','select','field','tq.TeamId','team_has_chat_queues'];(function(_0x16ab39,_0x11e478){var _0x1c43d7=function(_0x3177ca){while(--_0x3177ca){_0x16ab39['push'](_0x16ab39['shift']());}};_0x1c43d7(++_0x11e478);}(_0xd81d,0x151));var _0xdd81=function(_0x2de45d,_0x4a9f14){_0x2de45d=_0x2de45d-0x0;var _0xf8bb43=_0xd81d[_0x2de45d];return _0xf8bb43;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdd81('0x0'));var rimraf=require(_0xdd81('0x1'));var zipdir=require(_0xdd81('0x2'));var jsonpatch=require(_0xdd81('0x3'));var rp=require('request-promise');var moment=require(_0xdd81('0x4'));var BPromise=require(_0xdd81('0x5'));var Mustache=require(_0xdd81('0x6'));var util=require(_0xdd81('0x7'));var path=require(_0xdd81('0x8'));var sox=require(_0xdd81('0x9'));var csv=require(_0xdd81('0xa'));var ejs=require(_0xdd81('0xb'));var fs=require('fs');var _=require(_0xdd81('0xc'));var squel=require(_0xdd81('0xd'));var crypto=require(_0xdd81('0xe'));var jsforce=require(_0xdd81('0xf'));var deskjs=require(_0xdd81('0x10'));var toCsv=require(_0xdd81('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd81('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdd81('0x12'));var as=require(_0xdd81('0x13'));var hardwareService=require(_0xdd81('0x14'));var logger=require(_0xdd81('0x15'))(_0xdd81('0x16'));var utils=require(_0xdd81('0x17'));var config=require(_0xdd81('0x18'));var db=require(_0xdd81('0x19'))['db'];config[_0xdd81('0x1a')]=_['defaults'](config[_0xdd81('0x1a')],{'host':_0xdd81('0x1b'),'port':0x18eb});var socket=require(_0xdd81('0x1c'))(new Redis(config[_0xdd81('0x1a')]));require(_0xdd81('0x1d'))[_0xdd81('0x1e')](socket);var jayson=require(_0xdd81('0x1f'));var client=jayson[_0xdd81('0x20')][_0xdd81('0x21')]({'port':0x232a});function checkPasswordPattern(_0x491bd8,_0x7c8617,_0x55b159){if(_0x55b159){var _0x1e4e16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4e16['test'](_0x7c8617)){return _0x491bd8;}else{throw new db[(_0xdd81('0x22'))][(_0xdd81('0x23'))](_0xdd81('0x24'));}}else{return _0x491bd8;}}function respondWithRpcPromise(_0x5f2f8c,_0x145604,_0x3c68d6,_0x263f9b){return new BPromise(function(_0x46a810,_0x35dbe7){var _0x2fa8e0=_0x263f9b||client;return _0x2fa8e0[_0xdd81('0x25')](_0x5f2f8c,_0x3c68d6)['then'](function(_0x216c55){logger[_0xdd81('0x26')](_0xdd81('0x27'),_0x145604,_0xdd81('0x28'));logger[_0xdd81('0x29')](_0xdd81('0x2a'),_0x145604,_0xdd81('0x28'),JSON[_0xdd81('0x2b')](_0x216c55));if(_0x216c55[_0xdd81('0x2c')]){if(_0x216c55[_0xdd81('0x2c')][_0xdd81('0x2d')]===0x1f4){logger[_0xdd81('0x2c')]('ChatQueue,\x20%s,\x20%s',_0x145604,_0x216c55[_0xdd81('0x2c')][_0xdd81('0x2e')]);return _0x35dbe7(_0x216c55[_0xdd81('0x2c')]['message']);}logger[_0xdd81('0x2c')](_0xdd81('0x27'),_0x145604,_0x216c55['error']['message']);return _0x46a810(_0x216c55[_0xdd81('0x2c')][_0xdd81('0x2e')]);}else{logger['info'](_0xdd81('0x27'),_0x145604,_0xdd81('0x28'));_0x46a810(_0x216c55['result']['message']);}})[_0xdd81('0x2f')](function(_0x178f83){logger[_0xdd81('0x2c')](_0xdd81('0x27'),_0x145604,_0x178f83);_0x35dbe7(_0x178f83);});});}function respondWithStatusCode(_0x3fa93b,_0x3f16ba){_0x3f16ba=_0x3f16ba||0xcc;return function(_0x298ed7){if(_0x298ed7){return _0x3fa93b[_0xdd81('0x30')](_0x3f16ba);}return _0x3fa93b[_0xdd81('0x31')](_0x3f16ba)['end']();};}function respondWithResult(_0x5c9dd4,_0x304677){_0x304677=_0x304677||0xc8;return function(_0x4407b2){if(_0x4407b2){return _0x5c9dd4[_0xdd81('0x31')](_0x304677)[_0xdd81('0x32')](_0x4407b2);}};}function respondWithFilteredResult(_0x139ba8,_0xca297a){return function(_0x3c915d){if(_0x3c915d){var _0x23d5ba=_0x3c915d[_0xdd81('0x33')],_0xd7b390=_0xca297a[_0xdd81('0x34')],_0x3518eb=_0xca297a['offset']+_0xca297a[_0xdd81('0x35')],_0x2c337a;if(_0x3518eb>=_0x23d5ba){_0x3518eb=_0x23d5ba;_0x2c337a=0xc8;}else{_0x2c337a=0xce;}_0x139ba8[_0xdd81('0x31')](_0x2c337a);return _0x139ba8[_0xdd81('0x36')]('Content-Range',_0xd7b390+'-'+_0x3518eb+'/'+_0x23d5ba)[_0xdd81('0x32')](_0x3c915d);}return null;};}function patchUpdates(_0x13e348){return function(_0x58380e){try{jsonpatch['apply'](_0x58380e,_0x13e348,!![]);}catch(_0x46c6e7){return BPromise[_0xdd81('0x37')](_0x46c6e7);}return _0x58380e[_0xdd81('0x38')]();};}function saveUpdates(_0x5ec334,_0x224106){return function(_0x4f42b2){if(_0x4f42b2){return _0x4f42b2[_0xdd81('0x39')](_0x5ec334)[_0xdd81('0x3a')](function(_0x3b3ab7){return _0x3b3ab7;});}return null;};}function removeEntity(_0xdea947,_0x52c8ba){return function(_0x13c082){if(_0x13c082){return _0x13c082[_0xdd81('0x3b')]()[_0xdd81('0x3a')](function(){var _0x1c985f=_0x13c082[_0xdd81('0x3c')]({'plain':!![]});var _0x262b72='ChatQueues';return db[_0xdd81('0x3d')]['destroy']({'where':{'type':_0x262b72,'resourceId':_0x1c985f['id']}})[_0xdd81('0x3a')](function(){return _0x13c082;});})[_0xdd81('0x3a')](function(){_0xdea947[_0xdd81('0x31')](0xcc)[_0xdd81('0x3e')]();});}};}function handleEntityNotFound(_0x2648e4,_0x239087){return function(_0x59fddd){if(!_0x59fddd){_0x2648e4[_0xdd81('0x30')](0x194);}return _0x59fddd;};}function handleError(_0x455d3c,_0x46de06){_0x46de06=_0x46de06||0x1f4;return function(_0x4371fe){logger[_0xdd81('0x2c')](_0x4371fe[_0xdd81('0x3f')]);if(_0x4371fe[_0xdd81('0x40')]){delete _0x4371fe[_0xdd81('0x40')];}_0x455d3c[_0xdd81('0x31')](_0x46de06)['send'](_0x4371fe);};}exports[_0xdd81('0x41')]=function(_0x4c247c,_0x56b93c){var _0x16b28a={},_0x22af7f={},_0x50cd1b={'count':0x0,'rows':[]};var _0x55f2ee=_[_0xdd81('0x42')](db[_0xdd81('0x43')][_0xdd81('0x44')],function(_0x2b6ef1){return{'name':_0x2b6ef1[_0xdd81('0x45')],'type':_0x2b6ef1[_0xdd81('0x46')][_0xdd81('0x47')]};});_0x22af7f[_0xdd81('0x48')]=_['map'](_0x55f2ee,'name');_0x22af7f['query']=_[_0xdd81('0x49')](_0x4c247c['query']);_0x22af7f['filters']=_[_0xdd81('0x4a')](_0x22af7f[_0xdd81('0x48')],_0x22af7f['query']);_0x16b28a[_0xdd81('0x4b')]=_[_0xdd81('0x4a')](_0x22af7f['model'],qs[_0xdd81('0x4c')](_0x4c247c[_0xdd81('0x4d')][_0xdd81('0x4c')]));_0x16b28a['attributes']=_0x16b28a[_0xdd81('0x4b')][_0xdd81('0x4e')]?_0x16b28a[_0xdd81('0x4b')]:_0x22af7f[_0xdd81('0x48')];if(!_0x4c247c['query'][_0xdd81('0x4f')]('nolimit')){_0x16b28a[_0xdd81('0x35')]=qs['limit'](_0x4c247c[_0xdd81('0x4d')][_0xdd81('0x35')]);_0x16b28a[_0xdd81('0x34')]=qs[_0xdd81('0x34')](_0x4c247c[_0xdd81('0x4d')][_0xdd81('0x34')]);}_0x16b28a['order']=qs['sort'](_0x4c247c['query']['sort']);_0x16b28a[_0xdd81('0x50')]=qs['filters'](_[_0xdd81('0x51')](_0x4c247c[_0xdd81('0x4d')],_0x22af7f['filters']),_0x55f2ee);if(_0x4c247c[_0xdd81('0x4d')]['filter']){_0x16b28a[_0xdd81('0x50')]=_[_0xdd81('0x52')](_0x16b28a[_0xdd81('0x50')],{'$or':_[_0xdd81('0x42')](_0x55f2ee,function(_0x3b9a12){if(_0x3b9a12[_0xdd81('0x46')]!==_0xdd81('0x53')){var _0x51a235={};_0x51a235[_0x3b9a12[_0xdd81('0x40')]]={'$like':'%'+_0x4c247c['query'][_0xdd81('0x54')]+'%'};return _0x51a235;}})});}_0x16b28a=_['merge']({},_0x16b28a,_0x4c247c[_0xdd81('0x55')]);var _0x65d10c={'where':_0x16b28a[_0xdd81('0x50')]};return db[_0xdd81('0x43')]['count'](_0x65d10c)['then'](function(_0x483eba){_0x50cd1b[_0xdd81('0x33')]=_0x483eba;if(_0x4c247c['query'][_0xdd81('0x56')]){_0x16b28a[_0xdd81('0x57')]=[{'all':!![]}];}return db[_0xdd81('0x43')]['findAll'](_0x16b28a);})['then'](function(_0xdfa357){_0x50cd1b['rows']=_0xdfa357;return _0x50cd1b;})[_0xdd81('0x3a')](respondWithFilteredResult(_0x56b93c,_0x16b28a))['catch'](handleError(_0x56b93c,null));};exports[_0xdd81('0x58')]=function(_0x3a6724,_0x518721){var _0x78fafa={'raw':!![],'where':{'id':_0x3a6724[_0xdd81('0x59')]['id']}},_0xbfe637={};_0xbfe637[_0xdd81('0x48')]=_[_0xdd81('0x49')](db[_0xdd81('0x43')][_0xdd81('0x44')]);_0xbfe637[_0xdd81('0x4d')]=_['keys'](_0x3a6724['query']);_0xbfe637[_0xdd81('0x5a')]=_[_0xdd81('0x4a')](_0xbfe637[_0xdd81('0x48')],_0xbfe637[_0xdd81('0x4d')]);_0x78fafa[_0xdd81('0x4b')]=_[_0xdd81('0x4a')](_0xbfe637[_0xdd81('0x48')],qs[_0xdd81('0x4c')](_0x3a6724[_0xdd81('0x4d')]['fields']));_0x78fafa[_0xdd81('0x4b')]=_0x78fafa[_0xdd81('0x4b')][_0xdd81('0x4e')]?_0x78fafa[_0xdd81('0x4b')]:_0xbfe637[_0xdd81('0x48')];if(_0x3a6724[_0xdd81('0x4d')]['includeAll']){_0x78fafa[_0xdd81('0x57')]=[{'all':!![]}];}_0x78fafa=_[_0xdd81('0x52')]({},_0x78fafa,_0x3a6724['options']);return db['ChatQueue'][_0xdd81('0x5b')](_0x78fafa)[_0xdd81('0x3a')](handleEntityNotFound(_0x518721,null))[_0xdd81('0x3a')](respondWithResult(_0x518721,null))[_0xdd81('0x2f')](handleError(_0x518721,null));};exports['create']=function(_0xa705be,_0x3528e7){return db[_0xdd81('0x43')][_0xdd81('0x5c')](_0xa705be[_0xdd81('0x5d')],{})[_0xdd81('0x3a')](function(_0x2373ee){var _0x19fca0=_0xa705be[_0xdd81('0x5e')][_0xdd81('0x3c')]({'plain':!![]});if(!_0x19fca0)throw new Error(_0xdd81('0x5f'));if(_0x19fca0[_0xdd81('0x60')]==='user'){var _0x406e23=_0x2373ee[_0xdd81('0x3c')]({'plain':!![]});var _0x5c9027='ChatQueues';return db[_0xdd81('0x61')][_0xdd81('0x5b')]({'where':{'name':_0x5c9027,'userProfileId':_0x19fca0['userProfileId']},'raw':!![]})['then'](function(_0x720b7d){if(_0x720b7d&&_0x720b7d[_0xdd81('0x62')]===0x0){return db[_0xdd81('0x3d')][_0xdd81('0x5c')]({'name':_0x406e23[_0xdd81('0x40')],'resourceId':_0x406e23['id'],'type':_0x720b7d[_0xdd81('0x40')],'sectionId':_0x720b7d['id']},{})[_0xdd81('0x3a')](function(){return _0x2373ee;});}else{return _0x2373ee;}})[_0xdd81('0x2f')](function(_0x3c2bed){logger[_0xdd81('0x2c')](_0xdd81('0x63'),_0x3c2bed);throw _0x3c2bed;});}return _0x2373ee;})['then'](respondWithResult(_0x3528e7,0xc9))[_0xdd81('0x2f')](handleError(_0x3528e7,null));};exports[_0xdd81('0x39')]=function(_0x3a1555,_0x356699){if(_0x3a1555[_0xdd81('0x5d')]['id']){delete _0x3a1555['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x3a1555['params']['id']}})['then'](handleEntityNotFound(_0x356699,null))[_0xdd81('0x3a')](saveUpdates(_0x3a1555[_0xdd81('0x5d')],null))[_0xdd81('0x3a')](respondWithResult(_0x356699,null))[_0xdd81('0x2f')](handleError(_0x356699,null));};exports[_0xdd81('0x3b')]=function(_0x480381,_0x266c33){return db[_0xdd81('0x43')][_0xdd81('0x5b')]({'where':{'id':_0x480381[_0xdd81('0x59')]['id']}})[_0xdd81('0x3a')](handleEntityNotFound(_0x266c33,null))[_0xdd81('0x3a')](removeEntity(_0x266c33,null))[_0xdd81('0x2f')](handleError(_0x266c33,null));};exports[_0xdd81('0x64')]=function(_0x35f177,_0x53c53d){return db['ChatQueue']['describe']()[_0xdd81('0x3a')](respondWithResult(_0x53c53d,null))[_0xdd81('0x2f')](handleError(_0x53c53d,null));};exports[_0xdd81('0x65')]=function(_0x5581e3,_0x3d2788,_0x5771e5){var _0x1be750={'raw':!![],'where':{}},_0x39360a={},_0x3d869f;return db['ChatQueue'][_0xdd81('0x66')]({'where':{'id':_0x5581e3[_0xdd81('0x59')]['id']}})[_0xdd81('0x3a')](handleEntityNotFound(_0x3d2788,null))[_0xdd81('0x3a')](function(_0x568acd){if(_0x568acd){_0x3d869f=_0x568acd[_0xdd81('0x3c')]({'plain':!![]});_0x39360a[_0xdd81('0x48')]=_[_0xdd81('0x49')](db[_0xdd81('0x67')][_0xdd81('0x44')]);_0x39360a[_0xdd81('0x4d')]=_[_0xdd81('0x49')](_0x5581e3[_0xdd81('0x4d')]);_0x39360a[_0xdd81('0x5a')]=_[_0xdd81('0x4a')](_0x39360a[_0xdd81('0x48')],_0x39360a[_0xdd81('0x4d')]);_0x1be750[_0xdd81('0x4b')]=_[_0xdd81('0x4a')](_0x39360a[_0xdd81('0x48')],qs['fields'](_0x5581e3[_0xdd81('0x4d')][_0xdd81('0x4c')]));_0x1be750[_0xdd81('0x4b')]=_0x1be750[_0xdd81('0x4b')][_0xdd81('0x4e')]?_0x1be750[_0xdd81('0x4b')]:_0x39360a[_0xdd81('0x48')];if(!_0x5581e3[_0xdd81('0x4d')][_0xdd81('0x4f')](_0xdd81('0x68'))){_0x1be750[_0xdd81('0x35')]=qs[_0xdd81('0x35')](_0x5581e3[_0xdd81('0x4d')][_0xdd81('0x35')]);_0x1be750[_0xdd81('0x34')]=qs[_0xdd81('0x34')](_0x5581e3['query']['offset']);}_0x1be750[_0xdd81('0x69')]=qs['sort'](_0x5581e3['query'][_0xdd81('0x6a')]);_0x1be750[_0xdd81('0x50')]=qs['filters'](_[_0xdd81('0x51')](_0x5581e3[_0xdd81('0x4d')],_0x39360a[_0xdd81('0x5a')]));_0x1be750['where'][_0xdd81('0x6b')]=_0x568acd['id'];if(_0x5581e3[_0xdd81('0x4d')][_0xdd81('0x54')]){_0x1be750['where']=_[_0xdd81('0x52')](_0x1be750['where'],{'$or':_[_0xdd81('0x42')](_0x1be750[_0xdd81('0x4b')],function(_0x386bae){var _0x1435ca={};_0x1435ca[_0x386bae]={'$like':'%'+_0x5581e3[_0xdd81('0x4d')][_0xdd81('0x54')]+'%'};return _0x1435ca;})});}_0x1be750=_['merge']({},_0x1be750,_0x5581e3[_0xdd81('0x55')]);return db['UserChatQueue'][_0xdd81('0x6c')](_0x1be750);}})[_0xdd81('0x3a')](function(_0xb74214){if(_0xb74214){return db[_0xdd81('0x6d')]['findAndCountAll']({'where':{'id':_['map'](_0xb74214,'UserId'),'role':_0xdd81('0x6e')},'attributes':['id',_0xdd81('0x40'),_0xdd81('0x6f'),_0xdd81('0x70'),_0xdd81('0x71')]});}})[_0xdd81('0x3a')](function(_0x4c90d5){if(_0x4c90d5){return{'count':_0x4c90d5[_0xdd81('0x33')],'rows':_[_0xdd81('0x42')](_0x4c90d5['rows'],function(_0x280252){return{'membername':_0x280252[_0xdd81('0x40')],'UserId':_0x280252['id'],'queue_name':_0x3d869f[_0xdd81('0x40')],'ChatQueueId':_0x3d869f['id'],'interface':util[_0xdd81('0x72')](_0xdd81('0x73'),_0xdd81('0x74'),_0x280252[_0xdd81('0x40')]),'penalty':0x0,'paused':_0x280252['chatPause'],'createdAt':_0x280252[_0xdd81('0x71')],'updatedAt':_0x280252[_0xdd81('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdd81('0x3a')](respondWithFilteredResult(_0x3d2788,_0x1be750))['catch'](handleError(_0x3d2788,null));};exports[_0xdd81('0x75')]=function(_0x4c5a94,_0x2db4dd,_0x4f5054){var _0x46f968={};var _0x186207={};var _0x3965bd;var _0x390258;return db[_0xdd81('0x43')]['findOne']({'where':{'id':_0x4c5a94[_0xdd81('0x59')]['id']}})['then'](handleEntityNotFound(_0x2db4dd,null))['then'](function(_0x40ceb2){if(_0x40ceb2){_0x3965bd=_0x40ceb2;_0x186207['model']=_['keys'](db[_0xdd81('0x76')][_0xdd81('0x44')]);_0x186207['query']=_[_0xdd81('0x49')](_0x4c5a94['query']);_0x186207[_0xdd81('0x5a')]=_[_0xdd81('0x4a')](_0x186207['model'],_0x186207[_0xdd81('0x4d')]);_0x46f968[_0xdd81('0x4b')]=_['intersection'](_0x186207['model'],qs[_0xdd81('0x4c')](_0x4c5a94['query'][_0xdd81('0x4c')]));_0x46f968['attributes']=_0x46f968[_0xdd81('0x4b')][_0xdd81('0x4e')]?_0x46f968[_0xdd81('0x4b')]:_0x186207[_0xdd81('0x48')];_0x46f968['order']=qs[_0xdd81('0x6a')](_0x4c5a94['query'][_0xdd81('0x6a')]);_0x46f968[_0xdd81('0x50')]=qs[_0xdd81('0x5a')](_[_0xdd81('0x51')](_0x4c5a94[_0xdd81('0x4d')],_0x186207[_0xdd81('0x5a')]));if(_0x4c5a94['query']['filter']){_0x46f968[_0xdd81('0x50')]=_['merge'](_0x46f968[_0xdd81('0x50')],{'$or':_['map'](_0x46f968['attributes'],function(_0x92e756){var _0xe237ed={};_0xe237ed[_0x92e756]={'$like':'%'+_0x4c5a94[_0xdd81('0x4d')]['filter']+'%'};return _0xe237ed;})});}_0x46f968=_[_0xdd81('0x52')]({},_0x46f968,_0x4c5a94[_0xdd81('0x55')]);return _0x3965bd[_0xdd81('0x75')](_0x46f968);}})[_0xdd81('0x3a')](function(_0x488777){if(_0x488777){_0x390258=_0x488777[_0xdd81('0x4e')];if(!_0x4c5a94[_0xdd81('0x4d')][_0xdd81('0x4f')](_0xdd81('0x68'))){_0x46f968[_0xdd81('0x35')]=qs[_0xdd81('0x35')](_0x4c5a94['query'][_0xdd81('0x35')]);_0x46f968[_0xdd81('0x34')]=qs[_0xdd81('0x34')](_0x4c5a94[_0xdd81('0x4d')]['offset']);}return _0x3965bd[_0xdd81('0x75')](_0x46f968);}})[_0xdd81('0x3a')](function(_0x9a7758){if(_0x9a7758){return _0x9a7758?{'count':_0x390258,'rows':_0x9a7758}:null;}})['then'](respondWithResult(_0x2db4dd,null))[_0xdd81('0x2f')](handleError(_0x2db4dd,null));};exports['addTeams']=function(_0x14c967,_0x3a3f13,_0xb18052){var _0x3b4676=_0x14c967[_0xdd81('0x5d')]['ids'];return db['Team']['findAll']({'where':{'id':_0x3b4676},'attributes':['id'],'include':[{'model':db[_0xdd81('0x6d')],'as':_0xdd81('0x77'),'attributes':['id',_0xdd81('0x40'),_0xdd81('0x78'),_0xdd81('0x79'),_0xdd81('0x7a')],'raw':!![]}]})[_0xdd81('0x3a')](function(_0x3f688e){if(_0x3f688e){var _0x35b360=_[_0xdd81('0x7b')](_0x3f688e,function(_0x1acf60){var _0x4407ee=_0x1acf60[_0xdd81('0x3c')]({'plain':!![]});return _0x4407ee['Agents'];});return db[_0xdd81('0x43')][_0xdd81('0x5b')]({'where':{'id':_0x14c967[_0xdd81('0x59')]['id']}})[_0xdd81('0x3a')](function(_0x5506d0){return db[_0xdd81('0x7c')][_0xdd81('0x7d')](function(_0x5c2301){return _0x5506d0[_0xdd81('0x7e')](_0x3b4676,{'transaction':_0x5c2301})[_0xdd81('0x3a')](function(){return BPromise[_0xdd81('0x7f')](_0x35b360,function(_0xf95c8){return db[_0xdd81('0x67')][_0xdd81('0x80')]({'where':{'UserId':_0xf95c8['id'],'ChatQueueId':_0x14c967['params']['id']},'transaction':_0x5c2301});});})[_0xdd81('0x3a')](function(){_0x35b360[_0xdd81('0x81')](function(_0x1c3d4f){socket[_0xdd81('0x82')](_0xdd81('0x83'),{'UserId':_0x1c3d4f['id'],'ChatQueueId':_0x5506d0['id']});});});});});}})[_0xdd81('0x3a')](respondWithStatusCode(_0x3a3f13,null))[_0xdd81('0x2f')](handleError(_0x3a3f13,null));};exports['removeTeams']=function(_0x98aba5,_0x300e3a,_0x53fc98){return db['Team'][_0xdd81('0x6c')]({'where':{'id':_0x98aba5[_0xdd81('0x4d')][_0xdd81('0x84')]},'attributes':['id'],'include':[{'model':db[_0xdd81('0x6d')],'as':_0xdd81('0x77'),'attributes':['id'],'raw':!![]}]})[_0xdd81('0x3a')](handleEntityNotFound(_0x300e3a,null))['then'](function(_0x4ff352){var _0x1908e3=_[_0xdd81('0x42')](_0x4ff352,'id');var _0x3be9bd=[];var _0x32de72=[];var _0x300897=squel[_0xdd81('0x85')]();_0x300897[_0xdd81('0x86')](_0xdd81('0x87'))['from'](_0xdd81('0x88'),'tq')[_0xdd81('0x89')](_0xdd81('0x8a'),'ut',_0xdd81('0x8b'))[_0xdd81('0x50')]('ChatQueueId\x20=\x20?',_0x98aba5['params']['id']);for(var _0x3d316c=0x0;_0x3d316c<_0x4ff352['length'];_0x3d316c+=0x1){let _0xbcc59f=_0x4ff352[_0x3d316c];for(var _0x3ee23e=0x0;_0x3ee23e<_0xbcc59f[_0xdd81('0x77')]['length'];_0x3ee23e+=0x1){let _0x5bc2ab=_0xbcc59f[_0xdd81('0x77')][_0x3ee23e];var _0x54aa83=_0x300897['clone']();_0x54aa83[_0xdd81('0x50')](_0xdd81('0x8c'),_0x5bc2ab['id']);_0x32de72[_0xdd81('0x8d')](db[_0xdd81('0x7c')]['query'](_0x54aa83[_0xdd81('0x8e')](),{'type':db[_0xdd81('0x7c')][_0xdd81('0x8f')]['SELECT']})[_0xdd81('0x3a')](function(_0x290c43){if(_0x290c43[_0xdd81('0x4e')]===0x1){return _0x5bc2ab['id'];}else{var _0x22d79=_[_0xdd81('0x90')](_[_0xdd81('0x42')](_0x290c43,_0xdd81('0x91')),function(_0x46de5e){return _['includes'](_0x1908e3,_0x46de5e);});if(_0x22d79){return _0x5bc2ab['id'];}}}));}}return BPromise[_0xdd81('0x92')](_0x32de72)[_0xdd81('0x3a')](function(_0x3ed235){_0x3be9bd=_(_0x3be9bd)[_0xdd81('0x93')](_0x3ed235)[_0xdd81('0x94')]()[_0xdd81('0x95')]();return db[_0xdd81('0x43')]['find']({'where':{'id':_0x98aba5[_0xdd81('0x59')]['id']}})[_0xdd81('0x3a')](function(_0x1774e2){return db[_0xdd81('0x7c')]['transaction'](function(_0x4aa6a5){return _0x1774e2['removeTeams'](_0x98aba5[_0xdd81('0x4d')]['ids'],{'transaction':_0x4aa6a5})[_0xdd81('0x3a')](function(){if(!_[_0xdd81('0x96')](_0x3be9bd)){return _0x1774e2[_0xdd81('0x97')](_0x3be9bd,{'transaction':_0x4aa6a5});}})['then'](function(){_0x3be9bd[_0xdd81('0x81')](function(_0x14ca3c){socket[_0xdd81('0x82')](_0xdd81('0x98'),{'UserId':_0x14ca3c,'ChatQueueId':_0x1774e2['id']});});});});});});})[_0xdd81('0x3a')](respondWithStatusCode(_0x300e3a,null))[_0xdd81('0x2f')](handleError(_0x300e3a,null));};exports[_0xdd81('0x99')]=function(_0x1551b3,_0x1a75aa,_0x1489a4){return db['ChatQueue']['find']({'where':{'id':_0x1551b3[_0xdd81('0x59')]['id']}})['then'](handleEntityNotFound(_0x1a75aa,null))[_0xdd81('0x3a')](function(_0x4249dd){if(_0x4249dd){return _0x4249dd[_0xdd81('0x99')](_0x1551b3[_0xdd81('0x5d')][_0xdd81('0x84')],_[_0xdd81('0x9a')](_0x1551b3['body'],[_0xdd81('0x84'),'id'])||{})[_0xdd81('0x9b')](function(_0x5d4c79){for(var _0x335393=0x0;_0x335393<_0x1551b3['body'][_0xdd81('0x84')][_0xdd81('0x4e')];_0x335393+=0x1){socket[_0xdd81('0x82')](_0xdd81('0x83'),{'UserId':_0x1551b3[_0xdd81('0x5d')]['ids'][_0x335393],'ChatQueueId':_0x1551b3[_0xdd81('0x59')]['id']});}return _0x5d4c79;});}})[_0xdd81('0x3a')](respondWithResult(_0x1a75aa,null))[_0xdd81('0x2f')](handleError(_0x1a75aa,null));};exports[_0xdd81('0x97')]=function(_0x363f78,_0x2f80da,_0x5bbbe3){return db[_0xdd81('0x43')][_0xdd81('0x5b')]({'where':{'id':_0x363f78[_0xdd81('0x59')]['id']}})[_0xdd81('0x3a')](handleEntityNotFound(_0x2f80da,null))[_0xdd81('0x3a')](function(_0x58a55e){if(_0x58a55e){return _0x58a55e[_0xdd81('0x97')](_0x363f78['query'][_0xdd81('0x84')])[_0xdd81('0x3a')](function(){if(_[_0xdd81('0x9c')](_0x363f78[_0xdd81('0x4d')]['ids'])){for(var _0x462fc6=0x0;_0x462fc6<_0x363f78[_0xdd81('0x4d')][_0xdd81('0x84')][_0xdd81('0x4e')];_0x462fc6+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x363f78[_0xdd81('0x4d')][_0xdd81('0x84')][_0x462fc6]),'ChatQueueId':Number(_0x363f78[_0xdd81('0x59')]['id'])});}}else{socket[_0xdd81('0x82')](_0xdd81('0x98'),{'UserId':Number(_0x363f78[_0xdd81('0x4d')][_0xdd81('0x84')]),'ChatQueueId':Number(_0x363f78[_0xdd81('0x59')]['id'])});}});}})[_0xdd81('0x3a')](respondWithStatusCode(_0x2f80da,null))['catch'](handleError(_0x2f80da,null));};exports[_0xdd81('0x9d')]=function(_0x422c11,_0x148004,_0x5d5652){var _0x44e024={};var _0x146419={};var _0x168b38;var _0x694d74;return db[_0xdd81('0x43')][_0xdd81('0x66')]({'where':{'id':_0x422c11[_0xdd81('0x59')]['id']}})[_0xdd81('0x3a')](handleEntityNotFound(_0x148004,null))[_0xdd81('0x3a')](function(_0x45ccc1){if(_0x45ccc1){_0x168b38=_0x45ccc1;_0x146419['model']=_[_0xdd81('0x49')](db[_0xdd81('0x6d')][_0xdd81('0x44')]);_0x146419['query']=_[_0xdd81('0x49')](_0x422c11[_0xdd81('0x4d')]);_0x146419[_0xdd81('0x5a')]=_[_0xdd81('0x4a')](_0x146419[_0xdd81('0x48')],_0x146419['query']);_0x44e024[_0xdd81('0x4b')]=_[_0xdd81('0x4a')](_0x146419['model'],qs[_0xdd81('0x4c')](_0x422c11[_0xdd81('0x4d')]['fields']));_0x44e024[_0xdd81('0x4b')]=_0x44e024['attributes'][_0xdd81('0x4e')]?_0x44e024[_0xdd81('0x4b')]:_0x146419[_0xdd81('0x48')];_0x44e024[_0xdd81('0x69')]=qs['sort'](_0x422c11[_0xdd81('0x4d')][_0xdd81('0x6a')]);_0x44e024[_0xdd81('0x50')]=qs[_0xdd81('0x5a')](_[_0xdd81('0x51')](_0x422c11[_0xdd81('0x4d')],_0x146419[_0xdd81('0x5a')]));if(_0x422c11['query'][_0xdd81('0x54')]){_0x44e024[_0xdd81('0x50')]=_['merge'](_0x44e024[_0xdd81('0x50')],{'$or':_[_0xdd81('0x42')](_0x44e024[_0xdd81('0x4b')],function(_0x1912b7){var _0x418542={};_0x418542[_0x1912b7]={'$like':'%'+_0x422c11[_0xdd81('0x4d')][_0xdd81('0x54')]+'%'};return _0x418542;})});}_0x44e024=_['merge']({},_0x44e024,_0x422c11[_0xdd81('0x55')]);return _0x168b38['getAgents'](_0x44e024);}})[_0xdd81('0x3a')](function(_0x4d9686){if(_0x4d9686){_0x694d74=_0x4d9686[_0xdd81('0x4e')];if(!_0x422c11['query'][_0xdd81('0x4f')](_0xdd81('0x68'))){_0x44e024[_0xdd81('0x35')]=qs[_0xdd81('0x35')](_0x422c11[_0xdd81('0x4d')][_0xdd81('0x35')]);_0x44e024[_0xdd81('0x34')]=qs[_0xdd81('0x34')](_0x422c11[_0xdd81('0x4d')]['offset']);}return _0x168b38[_0xdd81('0x9d')](_0x44e024);}})[_0xdd81('0x3a')](function(_0x479899){if(_0x479899){return _0x479899?{'count':_0x694d74,'rows':_0x479899}:null;}})[_0xdd81('0x3a')](respondWithResult(_0x148004,null))[_0xdd81('0x2f')](handleError(_0x148004,null));}; \ No newline at end of file +var _0xdae2=['query','keys','filters','intersection','model','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','ChatQueue','includeAll','findAll','rows','catch','show','params','attributes','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','body','find','describe','getMembers','UserChatQueue','hasOwnProperty','options','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','emit','userChatQueue:save','Team','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','getAgents','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','test','ValidationError','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x2c8618,_0x48f5e3){var _0x45c898=function(_0x42e789){while(--_0x42e789){_0x2c8618['push'](_0x2c8618['shift']());}};_0x45c898(++_0x48f5e3);}(_0xdae2,0xf1));var _0x2dae=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xdae2[_0x3070dc];return _0x431489;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2dae('0x0'));var zipdir=require(_0x2dae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2dae('0x2'));var util=require(_0x2dae('0x3'));var path=require(_0x2dae('0x4'));var sox=require(_0x2dae('0x5'));var csv=require(_0x2dae('0x6'));var ejs=require(_0x2dae('0x7'));var fs=require('fs');var _=require(_0x2dae('0x8'));var squel=require(_0x2dae('0x9'));var crypto=require('crypto');var jsforce=require(_0x2dae('0xa'));var deskjs=require(_0x2dae('0xb'));var toCsv=require(_0x2dae('0x6'));var querystring=require(_0x2dae('0xc'));var Papa=require(_0x2dae('0xd'));var Redis=require('ioredis');var authService=require(_0x2dae('0xe'));var qs=require(_0x2dae('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dae('0x10'))(_0x2dae('0x11'));var utils=require(_0x2dae('0x12'));var config=require(_0x2dae('0x13'));var db=require('../../mysqldb')['db'];config[_0x2dae('0x14')]=_[_0x2dae('0x15')](config[_0x2dae('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x2dae('0x16'))(new Redis(config[_0x2dae('0x14')]));require(_0x2dae('0x17'))['register'](socket);var jayson=require(_0x2dae('0x18'));var client=jayson[_0x2dae('0x19')][_0x2dae('0x1a')]({'port':0x232a});function checkPasswordPattern(_0xafee8c,_0x652fc5,_0x301aa3){if(_0x301aa3){var _0x3e9ca2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e9ca2[_0x2dae('0x1b')](_0x652fc5)){return _0xafee8c;}else{throw new db['Sequelize'][(_0x2dae('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 _0xafee8c;}}function respondWithRpcPromise(_0x4cfa78,_0x46eb07,_0x24b6f5,_0x4e07c2){return new BPromise(function(_0x8293d4,_0x36d146){var _0x377430=_0x4e07c2||client;return _0x377430[_0x2dae('0x1d')](_0x4cfa78,_0x24b6f5)[_0x2dae('0x1e')](function(_0x237408){logger[_0x2dae('0x1f')](_0x2dae('0x20'),_0x46eb07,_0x2dae('0x21'));logger[_0x2dae('0x22')](_0x2dae('0x23'),_0x46eb07,_0x2dae('0x21'),JSON[_0x2dae('0x24')](_0x237408));if(_0x237408[_0x2dae('0x25')]){if(_0x237408['error'][_0x2dae('0x26')]===0x1f4){logger[_0x2dae('0x25')](_0x2dae('0x20'),_0x46eb07,_0x237408[_0x2dae('0x25')]['message']);return _0x36d146(_0x237408['error'][_0x2dae('0x27')]);}logger[_0x2dae('0x25')]('ChatQueue,\x20%s,\x20%s',_0x46eb07,_0x237408[_0x2dae('0x25')][_0x2dae('0x27')]);return _0x8293d4(_0x237408[_0x2dae('0x25')][_0x2dae('0x27')]);}else{logger[_0x2dae('0x1f')](_0x2dae('0x20'),_0x46eb07,_0x2dae('0x21'));_0x8293d4(_0x237408['result'][_0x2dae('0x27')]);}})['catch'](function(_0x2836fc){logger[_0x2dae('0x25')](_0x2dae('0x20'),_0x46eb07,_0x2836fc);_0x36d146(_0x2836fc);});});}function respondWithStatusCode(_0xc21ff6,_0x61006b){_0x61006b=_0x61006b||0xcc;return function(_0x148d7c){if(_0x148d7c){return _0xc21ff6['sendStatus'](_0x61006b);}return _0xc21ff6[_0x2dae('0x28')](_0x61006b)[_0x2dae('0x29')]();};}function respondWithResult(_0x4c70ad,_0x2755d8){_0x2755d8=_0x2755d8||0xc8;return function(_0x4c11df){if(_0x4c11df){return _0x4c70ad[_0x2dae('0x28')](_0x2755d8)[_0x2dae('0x2a')](_0x4c11df);}};}function respondWithFilteredResult(_0x481e36,_0x4e22ea){return function(_0x2ca3c9){if(_0x2ca3c9){var _0xaa4078=_0x2ca3c9[_0x2dae('0x2b')],_0x18c6c4=_0x4e22ea[_0x2dae('0x2c')],_0xecaaad=_0x4e22ea['offset']+_0x4e22ea['limit'],_0x43df79;if(_0xecaaad>=_0xaa4078){_0xecaaad=_0xaa4078;_0x43df79=0xc8;}else{_0x43df79=0xce;}_0x481e36[_0x2dae('0x28')](_0x43df79);return _0x481e36[_0x2dae('0x2d')](_0x2dae('0x2e'),_0x18c6c4+'-'+_0xecaaad+'/'+_0xaa4078)[_0x2dae('0x2a')](_0x2ca3c9);}return null;};}function patchUpdates(_0x500295){return function(_0xa41889){try{jsonpatch[_0x2dae('0x2f')](_0xa41889,_0x500295,!![]);}catch(_0x516153){return BPromise['reject'](_0x516153);}return _0xa41889[_0x2dae('0x30')]();};}function saveUpdates(_0x11570c,_0x28c541){return function(_0x4d281f){if(_0x4d281f){return _0x4d281f[_0x2dae('0x31')](_0x11570c)[_0x2dae('0x1e')](function(_0xd7c903){return _0xd7c903;});}return null;};}function removeEntity(_0x22ac2b,_0x4923e2){return function(_0x3a725e){if(_0x3a725e){return _0x3a725e[_0x2dae('0x32')]()['then'](function(){var _0x25fda9=_0x3a725e[_0x2dae('0x33')]({'plain':!![]});var _0xd62c9b=_0x2dae('0x34');return db[_0x2dae('0x35')][_0x2dae('0x32')]({'where':{'type':_0xd62c9b,'resourceId':_0x25fda9['id']}})[_0x2dae('0x1e')](function(){return _0x3a725e;});})['then'](function(){_0x22ac2b[_0x2dae('0x28')](0xcc)[_0x2dae('0x29')]();});}};}function handleEntityNotFound(_0x30f275,_0x4f9441){return function(_0x39f5a9){if(!_0x39f5a9){_0x30f275[_0x2dae('0x36')](0x194);}return _0x39f5a9;};}function handleError(_0x33c575,_0x8cdfc7){_0x8cdfc7=_0x8cdfc7||0x1f4;return function(_0x4e4fc5){logger[_0x2dae('0x25')](_0x4e4fc5[_0x2dae('0x37')]);if(_0x4e4fc5[_0x2dae('0x38')]){delete _0x4e4fc5[_0x2dae('0x38')];}_0x33c575[_0x2dae('0x28')](_0x8cdfc7)[_0x2dae('0x39')](_0x4e4fc5);};}exports[_0x2dae('0x3a')]=function(_0x551f7a,_0x371645){var _0xdb2f56={},_0x41d2ef={},_0x10ca2e={'count':0x0,'rows':[]};var _0x500873=_[_0x2dae('0x3b')](db['ChatQueue'][_0x2dae('0x3c')],function(_0x133d4f){return{'name':_0x133d4f[_0x2dae('0x3d')],'type':_0x133d4f['type'][_0x2dae('0x3e')]};});_0x41d2ef['model']=_['map'](_0x500873,_0x2dae('0x38'));_0x41d2ef[_0x2dae('0x3f')]=_[_0x2dae('0x40')](_0x551f7a[_0x2dae('0x3f')]);_0x41d2ef[_0x2dae('0x41')]=_[_0x2dae('0x42')](_0x41d2ef['model'],_0x41d2ef[_0x2dae('0x3f')]);_0xdb2f56['attributes']=_[_0x2dae('0x42')](_0x41d2ef[_0x2dae('0x43')],qs['fields'](_0x551f7a[_0x2dae('0x3f')][_0x2dae('0x44')]));_0xdb2f56['attributes']=_0xdb2f56['attributes'][_0x2dae('0x45')]?_0xdb2f56['attributes']:_0x41d2ef[_0x2dae('0x43')];if(!_0x551f7a[_0x2dae('0x3f')]['hasOwnProperty'](_0x2dae('0x46'))){_0xdb2f56[_0x2dae('0x47')]=qs[_0x2dae('0x47')](_0x551f7a['query'][_0x2dae('0x47')]);_0xdb2f56[_0x2dae('0x2c')]=qs['offset'](_0x551f7a['query']['offset']);}_0xdb2f56[_0x2dae('0x48')]=qs[_0x2dae('0x49')](_0x551f7a['query'][_0x2dae('0x49')]);_0xdb2f56['where']=qs[_0x2dae('0x41')](_[_0x2dae('0x4a')](_0x551f7a[_0x2dae('0x3f')],_0x41d2ef[_0x2dae('0x41')]),_0x500873);if(_0x551f7a[_0x2dae('0x3f')][_0x2dae('0x4b')]){_0xdb2f56[_0x2dae('0x4c')]=_[_0x2dae('0x4d')](_0xdb2f56[_0x2dae('0x4c')],{'$or':_[_0x2dae('0x3b')](_0x500873,function(_0x555702){if(_0x555702['type']!==_0x2dae('0x4e')){var _0x43cb05={};_0x43cb05[_0x555702[_0x2dae('0x38')]]={'$like':'%'+_0x551f7a['query'][_0x2dae('0x4b')]+'%'};return _0x43cb05;}})});}_0xdb2f56=_['merge']({},_0xdb2f56,_0x551f7a['options']);var _0x51aca5={'where':_0xdb2f56[_0x2dae('0x4c')]};return db[_0x2dae('0x4f')]['count'](_0x51aca5)['then'](function(_0x42c422){_0x10ca2e[_0x2dae('0x2b')]=_0x42c422;if(_0x551f7a[_0x2dae('0x3f')][_0x2dae('0x50')]){_0xdb2f56['include']=[{'all':!![]}];}return db[_0x2dae('0x4f')][_0x2dae('0x51')](_0xdb2f56);})[_0x2dae('0x1e')](function(_0x14d13d){_0x10ca2e[_0x2dae('0x52')]=_0x14d13d;return _0x10ca2e;})[_0x2dae('0x1e')](respondWithFilteredResult(_0x371645,_0xdb2f56))[_0x2dae('0x53')](handleError(_0x371645,null));};exports[_0x2dae('0x54')]=function(_0xc861ab,_0x5a1041){var _0x5f5db0={'raw':!![],'where':{'id':_0xc861ab[_0x2dae('0x55')]['id']}},_0x3d27fb={};_0x3d27fb['model']=_['keys'](db[_0x2dae('0x4f')]['rawAttributes']);_0x3d27fb[_0x2dae('0x3f')]=_['keys'](_0xc861ab[_0x2dae('0x3f')]);_0x3d27fb['filters']=_[_0x2dae('0x42')](_0x3d27fb['model'],_0x3d27fb['query']);_0x5f5db0[_0x2dae('0x56')]=_['intersection'](_0x3d27fb[_0x2dae('0x43')],qs[_0x2dae('0x44')](_0xc861ab[_0x2dae('0x3f')][_0x2dae('0x44')]));_0x5f5db0['attributes']=_0x5f5db0[_0x2dae('0x56')][_0x2dae('0x45')]?_0x5f5db0[_0x2dae('0x56')]:_0x3d27fb[_0x2dae('0x43')];if(_0xc861ab[_0x2dae('0x3f')][_0x2dae('0x50')]){_0x5f5db0[_0x2dae('0x57')]=[{'all':!![]}];}_0x5f5db0=_['merge']({},_0x5f5db0,_0xc861ab['options']);return db[_0x2dae('0x4f')]['find'](_0x5f5db0)['then'](handleEntityNotFound(_0x5a1041,null))['then'](respondWithResult(_0x5a1041,null))[_0x2dae('0x53')](handleError(_0x5a1041,null));};exports[_0x2dae('0x58')]=function(_0x256b97,_0x5bc88d){return db[_0x2dae('0x4f')][_0x2dae('0x58')](_0x256b97['body'],{})[_0x2dae('0x1e')](function(_0x5be74a){var _0x56afb6=_0x256b97['user'][_0x2dae('0x33')]({'plain':!![]});if(!_0x56afb6)throw new Error(_0x2dae('0x59'));if(_0x56afb6[_0x2dae('0x5a')]===_0x2dae('0x5b')){var _0xfb07d=_0x5be74a[_0x2dae('0x33')]({'plain':!![]});var _0x4ac66d=_0x2dae('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x4ac66d,'userProfileId':_0x56afb6['userProfileId']},'raw':!![]})[_0x2dae('0x1e')](function(_0xe13add){if(_0xe13add&&_0xe13add[_0x2dae('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0xfb07d[_0x2dae('0x38')],'resourceId':_0xfb07d['id'],'type':_0xe13add[_0x2dae('0x38')],'sectionId':_0xe13add['id']},{})[_0x2dae('0x1e')](function(){return _0x5be74a;});}else{return _0x5be74a;}})[_0x2dae('0x53')](function(_0x3ec0e7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ec0e7);throw _0x3ec0e7;});}return _0x5be74a;})[_0x2dae('0x1e')](respondWithResult(_0x5bc88d,0xc9))[_0x2dae('0x53')](handleError(_0x5bc88d,null));};exports[_0x2dae('0x31')]=function(_0x37b84c,_0x46281e){if(_0x37b84c[_0x2dae('0x5d')]['id']){delete _0x37b84c[_0x2dae('0x5d')]['id'];}return db[_0x2dae('0x4f')][_0x2dae('0x5e')]({'where':{'id':_0x37b84c[_0x2dae('0x55')]['id']}})['then'](handleEntityNotFound(_0x46281e,null))[_0x2dae('0x1e')](saveUpdates(_0x37b84c[_0x2dae('0x5d')],null))['then'](respondWithResult(_0x46281e,null))['catch'](handleError(_0x46281e,null));};exports[_0x2dae('0x32')]=function(_0x5df8f1,_0x4b46fa){return db['ChatQueue'][_0x2dae('0x5e')]({'where':{'id':_0x5df8f1[_0x2dae('0x55')]['id']}})[_0x2dae('0x1e')](handleEntityNotFound(_0x4b46fa,null))[_0x2dae('0x1e')](removeEntity(_0x4b46fa,null))[_0x2dae('0x53')](handleError(_0x4b46fa,null));};exports[_0x2dae('0x5f')]=function(_0x542590,_0xe2e54d){return db[_0x2dae('0x4f')][_0x2dae('0x5f')]()[_0x2dae('0x1e')](respondWithResult(_0xe2e54d,null))[_0x2dae('0x53')](handleError(_0xe2e54d,null));};exports[_0x2dae('0x60')]=function(_0x5a7401,_0x210d31,_0x53f704){var _0x592b5d={'raw':!![],'where':{}},_0x4a33b={},_0x500a17;return db[_0x2dae('0x4f')]['findOne']({'where':{'id':_0x5a7401[_0x2dae('0x55')]['id']}})[_0x2dae('0x1e')](handleEntityNotFound(_0x210d31,null))[_0x2dae('0x1e')](function(_0x2268d7){if(_0x2268d7){_0x500a17=_0x2268d7[_0x2dae('0x33')]({'plain':!![]});_0x4a33b[_0x2dae('0x43')]=_[_0x2dae('0x40')](db[_0x2dae('0x61')]['rawAttributes']);_0x4a33b[_0x2dae('0x3f')]=_[_0x2dae('0x40')](_0x5a7401['query']);_0x4a33b[_0x2dae('0x41')]=_[_0x2dae('0x42')](_0x4a33b[_0x2dae('0x43')],_0x4a33b[_0x2dae('0x3f')]);_0x592b5d[_0x2dae('0x56')]=_[_0x2dae('0x42')](_0x4a33b[_0x2dae('0x43')],qs['fields'](_0x5a7401[_0x2dae('0x3f')][_0x2dae('0x44')]));_0x592b5d[_0x2dae('0x56')]=_0x592b5d[_0x2dae('0x56')][_0x2dae('0x45')]?_0x592b5d['attributes']:_0x4a33b[_0x2dae('0x43')];if(!_0x5a7401[_0x2dae('0x3f')][_0x2dae('0x62')]('nolimit')){_0x592b5d[_0x2dae('0x47')]=qs[_0x2dae('0x47')](_0x5a7401['query'][_0x2dae('0x47')]);_0x592b5d[_0x2dae('0x2c')]=qs[_0x2dae('0x2c')](_0x5a7401[_0x2dae('0x3f')][_0x2dae('0x2c')]);}_0x592b5d[_0x2dae('0x48')]=qs[_0x2dae('0x49')](_0x5a7401[_0x2dae('0x3f')][_0x2dae('0x49')]);_0x592b5d[_0x2dae('0x4c')]=qs['filters'](_[_0x2dae('0x4a')](_0x5a7401[_0x2dae('0x3f')],_0x4a33b[_0x2dae('0x41')]));_0x592b5d[_0x2dae('0x4c')]['ChatQueueId']=_0x2268d7['id'];if(_0x5a7401[_0x2dae('0x3f')][_0x2dae('0x4b')]){_0x592b5d['where']=_[_0x2dae('0x4d')](_0x592b5d[_0x2dae('0x4c')],{'$or':_[_0x2dae('0x3b')](_0x592b5d['attributes'],function(_0x4cae34){var _0x59bac7={};_0x59bac7[_0x4cae34]={'$like':'%'+_0x5a7401[_0x2dae('0x3f')][_0x2dae('0x4b')]+'%'};return _0x59bac7;})});}_0x592b5d=_['merge']({},_0x592b5d,_0x5a7401[_0x2dae('0x63')]);return db['UserChatQueue'][_0x2dae('0x51')](_0x592b5d);}})[_0x2dae('0x1e')](function(_0x221cd2){if(_0x221cd2){return db[_0x2dae('0x64')][_0x2dae('0x65')]({'where':{'id':_[_0x2dae('0x3b')](_0x221cd2,_0x2dae('0x66')),'role':_0x2dae('0x67')},'attributes':['id',_0x2dae('0x38'),_0x2dae('0x68'),_0x2dae('0x69'),_0x2dae('0x6a')]});}})[_0x2dae('0x1e')](function(_0x4f59b3){if(_0x4f59b3){return{'count':_0x4f59b3[_0x2dae('0x2b')],'rows':_[_0x2dae('0x3b')](_0x4f59b3['rows'],function(_0x10657f){return{'membername':_0x10657f[_0x2dae('0x38')],'UserId':_0x10657f['id'],'queue_name':_0x500a17[_0x2dae('0x38')],'ChatQueueId':_0x500a17['id'],'interface':util[_0x2dae('0x6b')](_0x2dae('0x6c'),_0x2dae('0x6d'),_0x10657f['name']),'penalty':0x0,'paused':_0x10657f[_0x2dae('0x68')],'createdAt':_0x10657f[_0x2dae('0x6a')],'updatedAt':_0x10657f[_0x2dae('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x210d31,_0x592b5d))[_0x2dae('0x53')](handleError(_0x210d31,null));};exports[_0x2dae('0x6e')]=function(_0x3eb0a5,_0x3f85bb,_0x3bd55f){var _0x4b074d={};var _0x53bf66={};var _0x4258d8;var _0x45d8d2;return db[_0x2dae('0x4f')][_0x2dae('0x6f')]({'where':{'id':_0x3eb0a5[_0x2dae('0x55')]['id']}})[_0x2dae('0x1e')](handleEntityNotFound(_0x3f85bb,null))[_0x2dae('0x1e')](function(_0x2b5f58){if(_0x2b5f58){_0x4258d8=_0x2b5f58;_0x53bf66['model']=_[_0x2dae('0x40')](db['Team']['rawAttributes']);_0x53bf66[_0x2dae('0x3f')]=_['keys'](_0x3eb0a5[_0x2dae('0x3f')]);_0x53bf66[_0x2dae('0x41')]=_[_0x2dae('0x42')](_0x53bf66['model'],_0x53bf66['query']);_0x4b074d['attributes']=_[_0x2dae('0x42')](_0x53bf66[_0x2dae('0x43')],qs[_0x2dae('0x44')](_0x3eb0a5[_0x2dae('0x3f')][_0x2dae('0x44')]));_0x4b074d[_0x2dae('0x56')]=_0x4b074d[_0x2dae('0x56')][_0x2dae('0x45')]?_0x4b074d['attributes']:_0x53bf66[_0x2dae('0x43')];_0x4b074d['order']=qs[_0x2dae('0x49')](_0x3eb0a5[_0x2dae('0x3f')][_0x2dae('0x49')]);_0x4b074d[_0x2dae('0x4c')]=qs[_0x2dae('0x41')](_[_0x2dae('0x4a')](_0x3eb0a5[_0x2dae('0x3f')],_0x53bf66['filters']));if(_0x3eb0a5[_0x2dae('0x3f')][_0x2dae('0x4b')]){_0x4b074d[_0x2dae('0x4c')]=_[_0x2dae('0x4d')](_0x4b074d[_0x2dae('0x4c')],{'$or':_[_0x2dae('0x3b')](_0x4b074d[_0x2dae('0x56')],function(_0x36367d){var _0x319bfa={};_0x319bfa[_0x36367d]={'$like':'%'+_0x3eb0a5[_0x2dae('0x3f')]['filter']+'%'};return _0x319bfa;})});}_0x4b074d=_['merge']({},_0x4b074d,_0x3eb0a5[_0x2dae('0x63')]);return _0x4258d8[_0x2dae('0x6e')](_0x4b074d);}})[_0x2dae('0x1e')](function(_0x413c5e){if(_0x413c5e){_0x45d8d2=_0x413c5e[_0x2dae('0x45')];if(!_0x3eb0a5[_0x2dae('0x3f')]['hasOwnProperty'](_0x2dae('0x46'))){_0x4b074d[_0x2dae('0x47')]=qs[_0x2dae('0x47')](_0x3eb0a5[_0x2dae('0x3f')][_0x2dae('0x47')]);_0x4b074d['offset']=qs[_0x2dae('0x2c')](_0x3eb0a5[_0x2dae('0x3f')][_0x2dae('0x2c')]);}return _0x4258d8[_0x2dae('0x6e')](_0x4b074d);}})['then'](function(_0x54d51b){if(_0x54d51b){return _0x54d51b?{'count':_0x45d8d2,'rows':_0x54d51b}:null;}})[_0x2dae('0x1e')](respondWithResult(_0x3f85bb,null))[_0x2dae('0x53')](handleError(_0x3f85bb,null));};exports[_0x2dae('0x70')]=function(_0x5fcd75,_0x5a6c92,_0x2c2a64){var _0x170d92=_0x5fcd75[_0x2dae('0x5d')][_0x2dae('0x71')];return db['Team'][_0x2dae('0x51')]({'where':{'id':_0x170d92},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2dae('0x72'),'attributes':['id',_0x2dae('0x38'),_0x2dae('0x73'),_0x2dae('0x74'),'interface'],'raw':!![]}]})['then'](function(_0x16ff1a){if(_0x16ff1a){var _0x2e9297=_[_0x2dae('0x75')](_0x16ff1a,function(_0x4ebae2){var _0x36cd1f=_0x4ebae2[_0x2dae('0x33')]({'plain':!![]});return _0x36cd1f[_0x2dae('0x72')];});return db[_0x2dae('0x4f')][_0x2dae('0x5e')]({'where':{'id':_0x5fcd75['params']['id']}})[_0x2dae('0x1e')](function(_0x4cedfb){return db[_0x2dae('0x76')][_0x2dae('0x77')](function(_0x57675b){return _0x4cedfb[_0x2dae('0x70')](_0x170d92,{'transaction':_0x57675b})[_0x2dae('0x1e')](function(){return BPromise[_0x2dae('0x78')](_0x2e9297,function(_0x34a388){return db[_0x2dae('0x61')]['findOrCreate']({'where':{'UserId':_0x34a388['id'],'ChatQueueId':_0x5fcd75[_0x2dae('0x55')]['id']},'transaction':_0x57675b});});})[_0x2dae('0x1e')](function(){_0x2e9297['forEach'](function(_0x35376e){socket[_0x2dae('0x79')](_0x2dae('0x7a'),{'UserId':_0x35376e['id'],'ChatQueueId':_0x4cedfb['id']});});});});});}})[_0x2dae('0x1e')](respondWithStatusCode(_0x5a6c92,null))['catch'](handleError(_0x5a6c92,null));};exports['removeTeams']=function(_0x29a657,_0x572c00,_0x166422){return db[_0x2dae('0x7b')][_0x2dae('0x51')]({'where':{'id':_0x29a657['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2dae('0x64')],'as':_0x2dae('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x572c00,null))[_0x2dae('0x1e')](function(_0x46820c){var _0x2b7cd0=_[_0x2dae('0x3b')](_0x46820c,'id');var _0x5a275b=[];var _0x1c33ae=[];var _0x2f2221=squel[_0x2dae('0x7c')]();_0x2f2221[_0x2dae('0x7d')](_0x2dae('0x7e'))['from'](_0x2dae('0x7f'),'tq')[_0x2dae('0x80')](_0x2dae('0x81'),'ut',_0x2dae('0x82'))[_0x2dae('0x4c')](_0x2dae('0x83'),_0x29a657[_0x2dae('0x55')]['id']);for(var _0x43c5bf=0x0;_0x43c5bf<_0x46820c['length'];_0x43c5bf+=0x1){let _0x2b9a7f=_0x46820c[_0x43c5bf];for(var _0x4e77bb=0x0;_0x4e77bb<_0x2b9a7f[_0x2dae('0x72')][_0x2dae('0x45')];_0x4e77bb+=0x1){let _0x475fc6=_0x2b9a7f[_0x2dae('0x72')][_0x4e77bb];var _0x27af72=_0x2f2221[_0x2dae('0x84')]();_0x27af72['where'](_0x2dae('0x85'),_0x475fc6['id']);_0x1c33ae[_0x2dae('0x86')](db['sequelize'][_0x2dae('0x3f')](_0x27af72[_0x2dae('0x87')](),{'type':db[_0x2dae('0x76')][_0x2dae('0x88')]['SELECT']})['then'](function(_0x183d8e){if(_0x183d8e[_0x2dae('0x45')]===0x1){return _0x475fc6['id'];}else{var _0x512eed=_[_0x2dae('0x89')](_['map'](_0x183d8e,_0x2dae('0x8a')),function(_0x34c02c){return _[_0x2dae('0x8b')](_0x2b7cd0,_0x34c02c);});if(_0x512eed){return _0x475fc6['id'];}}}));}}return BPromise['all'](_0x1c33ae)[_0x2dae('0x1e')](function(_0x1734ef){_0x5a275b=_(_0x5a275b)[_0x2dae('0x8c')](_0x1734ef)[_0x2dae('0x8d')]()[_0x2dae('0x8e')]();return db[_0x2dae('0x4f')][_0x2dae('0x5e')]({'where':{'id':_0x29a657[_0x2dae('0x55')]['id']}})[_0x2dae('0x1e')](function(_0x1fc8ee){return db[_0x2dae('0x76')]['transaction'](function(_0x4e4424){return _0x1fc8ee[_0x2dae('0x8f')](_0x29a657[_0x2dae('0x3f')][_0x2dae('0x71')],{'transaction':_0x4e4424})[_0x2dae('0x1e')](function(){if(!_[_0x2dae('0x90')](_0x5a275b)){return _0x1fc8ee[_0x2dae('0x91')](_0x5a275b,{'transaction':_0x4e4424});}})[_0x2dae('0x1e')](function(){_0x5a275b[_0x2dae('0x92')](function(_0x15157b){socket[_0x2dae('0x79')](_0x2dae('0x93'),{'UserId':_0x15157b,'ChatQueueId':_0x1fc8ee['id']});});});});});});})[_0x2dae('0x1e')](respondWithStatusCode(_0x572c00,null))[_0x2dae('0x53')](handleError(_0x572c00,null));};exports['addAgents']=function(_0x2d389e,_0x23401a,_0x5a3a68){return db[_0x2dae('0x4f')][_0x2dae('0x5e')]({'where':{'id':_0x2d389e[_0x2dae('0x55')]['id']}})[_0x2dae('0x1e')](handleEntityNotFound(_0x23401a,null))[_0x2dae('0x1e')](function(_0x3a5be8){if(_0x3a5be8){return _0x3a5be8[_0x2dae('0x94')](_0x2d389e[_0x2dae('0x5d')][_0x2dae('0x71')],_[_0x2dae('0x95')](_0x2d389e['body'],[_0x2dae('0x71'),'id'])||{})[_0x2dae('0x96')](function(_0x450de4){for(var _0x52c2eb=0x0;_0x52c2eb<_0x2d389e['body']['ids']['length'];_0x52c2eb+=0x1){socket['emit'](_0x2dae('0x7a'),{'UserId':_0x2d389e[_0x2dae('0x5d')][_0x2dae('0x71')][_0x52c2eb],'ChatQueueId':_0x2d389e[_0x2dae('0x55')]['id']});}return _0x450de4;});}})[_0x2dae('0x1e')](respondWithResult(_0x23401a,null))[_0x2dae('0x53')](handleError(_0x23401a,null));};exports[_0x2dae('0x91')]=function(_0x5c286d,_0x3ebe38,_0x5c95f1){return db[_0x2dae('0x4f')][_0x2dae('0x5e')]({'where':{'id':_0x5c286d[_0x2dae('0x55')]['id']}})[_0x2dae('0x1e')](handleEntityNotFound(_0x3ebe38,null))[_0x2dae('0x1e')](function(_0x1ab5dd){if(_0x1ab5dd){return _0x1ab5dd[_0x2dae('0x91')](_0x5c286d['query'][_0x2dae('0x71')])[_0x2dae('0x1e')](function(){if(_['isArray'](_0x5c286d[_0x2dae('0x3f')][_0x2dae('0x71')])){for(var _0x27c63b=0x0;_0x27c63b<_0x5c286d[_0x2dae('0x3f')]['ids'][_0x2dae('0x45')];_0x27c63b+=0x1){socket['emit'](_0x2dae('0x93'),{'UserId':Number(_0x5c286d[_0x2dae('0x3f')][_0x2dae('0x71')][_0x27c63b]),'ChatQueueId':Number(_0x5c286d[_0x2dae('0x55')]['id'])});}}else{socket[_0x2dae('0x79')]('userChatQueue:remove',{'UserId':Number(_0x5c286d[_0x2dae('0x3f')][_0x2dae('0x71')]),'ChatQueueId':Number(_0x5c286d[_0x2dae('0x55')]['id'])});}});}})[_0x2dae('0x1e')](respondWithStatusCode(_0x3ebe38,null))[_0x2dae('0x53')](handleError(_0x3ebe38,null));};exports['getAgents']=function(_0x4304d0,_0x1c70ce,_0x55d44e){var _0x3bb4e8={};var _0x4d232f={};var _0x7510a7;var _0x5ad544;return db[_0x2dae('0x4f')][_0x2dae('0x6f')]({'where':{'id':_0x4304d0[_0x2dae('0x55')]['id']}})[_0x2dae('0x1e')](handleEntityNotFound(_0x1c70ce,null))[_0x2dae('0x1e')](function(_0xa75650){if(_0xa75650){_0x7510a7=_0xa75650;_0x4d232f[_0x2dae('0x43')]=_[_0x2dae('0x40')](db['User'][_0x2dae('0x3c')]);_0x4d232f['query']=_['keys'](_0x4304d0[_0x2dae('0x3f')]);_0x4d232f[_0x2dae('0x41')]=_[_0x2dae('0x42')](_0x4d232f['model'],_0x4d232f['query']);_0x3bb4e8[_0x2dae('0x56')]=_[_0x2dae('0x42')](_0x4d232f[_0x2dae('0x43')],qs[_0x2dae('0x44')](_0x4304d0[_0x2dae('0x3f')]['fields']));_0x3bb4e8[_0x2dae('0x56')]=_0x3bb4e8['attributes'][_0x2dae('0x45')]?_0x3bb4e8[_0x2dae('0x56')]:_0x4d232f[_0x2dae('0x43')];_0x3bb4e8[_0x2dae('0x48')]=qs['sort'](_0x4304d0['query'][_0x2dae('0x49')]);_0x3bb4e8[_0x2dae('0x4c')]=qs[_0x2dae('0x41')](_[_0x2dae('0x4a')](_0x4304d0[_0x2dae('0x3f')],_0x4d232f[_0x2dae('0x41')]));if(_0x4304d0['query'][_0x2dae('0x4b')]){_0x3bb4e8[_0x2dae('0x4c')]=_[_0x2dae('0x4d')](_0x3bb4e8[_0x2dae('0x4c')],{'$or':_['map'](_0x3bb4e8[_0x2dae('0x56')],function(_0xc7f493){var _0x339e31={};_0x339e31[_0xc7f493]={'$like':'%'+_0x4304d0[_0x2dae('0x3f')][_0x2dae('0x4b')]+'%'};return _0x339e31;})});}_0x3bb4e8=_['merge']({},_0x3bb4e8,_0x4304d0['options']);return _0x7510a7[_0x2dae('0x97')](_0x3bb4e8);}})[_0x2dae('0x1e')](function(_0x262f9a){if(_0x262f9a){_0x5ad544=_0x262f9a['length'];if(!_0x4304d0[_0x2dae('0x3f')]['hasOwnProperty'](_0x2dae('0x46'))){_0x3bb4e8['limit']=qs[_0x2dae('0x47')](_0x4304d0[_0x2dae('0x3f')][_0x2dae('0x47')]);_0x3bb4e8['offset']=qs['offset'](_0x4304d0['query'][_0x2dae('0x2c')]);}return _0x7510a7[_0x2dae('0x97')](_0x3bb4e8);}})['then'](function(_0x3f94cc){if(_0x3f94cc){return _0x3f94cc?{'count':_0x5ad544,'rows':_0x3f94cc}:null;}})[_0x2dae('0x1e')](respondWithResult(_0x1c70ce,null))[_0x2dae('0x53')](handleError(_0x1c70ce,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 43b2f5a..f271237 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0xaaccf6,_0x37888a){var _0x3c4f3e=function(_0x2fc120){while(--_0x2fc120){_0xaaccf6['push'](_0xaaccf6['shift']());}};_0x3c4f3e(++_0x37888a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x441db3,_0x10f359){_0x441db3=_0x441db3-0x0;var _0x16c05d=_0x0b0e[_0x441db3];return _0x16c05d;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x3cc7db,_0x36b9a5){var _0x3a9d0d=function(_0xbe0ce6){while(--_0xbe0ce6){_0x3cc7db['push'](_0x3cc7db['shift']());}};_0x3a9d0d(++_0x36b9a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index e78bc97..638ee6d 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 _0x81d1=['bluebird','path','rimraf','../../config/environment','exports','ChatQueue','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81d1,0x1a6));var _0x181d=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x81d1[_0x4c2623];return _0x2be431;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x181d('0x0'));var moment=require(_0x181d('0x1'));var BPromise=require(_0x181d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x181d('0x3'));var rimraf=require(_0x181d('0x4'));var config=require(_0x181d('0x5'));var attributes=require('./chatQueue.attributes');module[_0x181d('0x6')]=function(_0x5e8db2,_0x50e8db){return _0x5e8db2['define'](_0x181d('0x7'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab76=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x56db3d,_0xdab33f){var _0x3e9925=function(_0x4ca045){while(--_0x4ca045){_0x56db3d['push'](_0x56db3d['shift']());}};_0x3e9925(++_0xdab33f);}(_0xab76,0x14b));var _0x6ab7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6ab7('0x0'));var util=require(_0x6ab7('0x1'));var logger=require(_0x6ab7('0x2'))(_0x6ab7('0x3'));var moment=require(_0x6ab7('0x4'));var BPromise=require('bluebird');var rp=require(_0x6ab7('0x5'));var fs=require('fs');var path=require(_0x6ab7('0x6'));var rimraf=require(_0x6ab7('0x7'));var config=require(_0x6ab7('0x8'));var attributes=require(_0x6ab7('0x9'));module[_0x6ab7('0xa')]=function(_0xc31a50,_0x245eb7){return _0xc31a50[_0x6ab7('0xb')](_0x6ab7('0xc'),attributes,{'tableName':_0x6ab7('0xd'),'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 ca802ac..a6286df 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 _0x1cf6=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','attributes','limit','map','include','stringify','find','where','model','ShowChatQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then'];(function(_0xc77c92,_0x8a9f1){var _0x51319b=function(_0x45b041){while(--_0x45b041){_0xc77c92['push'](_0xc77c92['shift']());}};_0x51319b(++_0x8a9f1);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x569dec,_0x4c8679){_0x569dec=_0x569dec-0x0;var _0x269d99=_0x1cf6[_0x569dec];return _0x269d99;};'use strict';var _=require('lodash');var util=require(_0x61cf('0x0'));var moment=require(_0x61cf('0x1'));var BPromise=require(_0x61cf('0x2'));var rs=require(_0x61cf('0x3'));var fs=require('fs');var Redis=require(_0x61cf('0x4'));var db=require(_0x61cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x61cf('0x6'))(_0x61cf('0x7'));var config=require(_0x61cf('0x8'));var jayson=require(_0x61cf('0x9'));var client=jayson[_0x61cf('0xa')][_0x61cf('0xb')]({'port':0x232a});config[_0x61cf('0xc')]=_[_0x61cf('0xd')](config[_0x61cf('0xc')],{'host':_0x61cf('0xe'),'port':0x18eb});var socket=require(_0x61cf('0xf'))(new Redis(config[_0x61cf('0xc')]));require(_0x61cf('0x10'))[_0x61cf('0x11')](socket);function respondWithRpcPromise(_0x1aab6b,_0x43681d,_0x4b6ea4){return new BPromise(function(_0x24b82f,_0x4f6914){return client[_0x61cf('0x12')](_0x1aab6b,_0x4b6ea4)[_0x61cf('0x13')](function(_0x4b849d){logger[_0x61cf('0x14')](_0x61cf('0x15'),_0x43681d,_0x61cf('0x16'));logger[_0x61cf('0x17')](_0x61cf('0x18'),_0x43681d,'request\x20sent',JSON['stringify'](_0x4b849d));if(_0x4b849d[_0x61cf('0x19')]){if(_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1a')]===0x1f4){logger[_0x61cf('0x19')](_0x61cf('0x15'),_0x43681d,_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1b')]);return _0x4f6914(_0x4b849d['error'][_0x61cf('0x1b')]);}logger[_0x61cf('0x19')](_0x61cf('0x15'),_0x43681d,_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1b')]);return _0x24b82f(_0x4b849d['error'][_0x61cf('0x1b')]);}else{logger[_0x61cf('0x14')](_0x61cf('0x15'),_0x43681d,_0x61cf('0x16'));_0x24b82f(_0x4b849d[_0x61cf('0x1c')][_0x61cf('0x1b')]);}})[_0x61cf('0x1d')](function(_0x5e203c){logger['error'](_0x61cf('0x15'),_0x43681d,_0x5e203c);_0x4f6914(_0x5e203c);});});}exports[_0x61cf('0x1e')]=function(_0x52cabf){var _0x15f8c1=this;return new Promise(function(_0x5bb38d,_0x508617){return db[_0x61cf('0x1f')][_0x61cf('0x20')]({'raw':_0x52cabf['options']?_0x52cabf['options'][_0x61cf('0x21')]===undefined?!![]:![]:!![],'where':_0x52cabf['options']?_0x52cabf[_0x61cf('0x22')]['where']||null:null,'attributes':_0x52cabf['options']?_0x52cabf[_0x61cf('0x22')][_0x61cf('0x23')]||null:null,'limit':_0x52cabf[_0x61cf('0x22')]?_0x52cabf[_0x61cf('0x22')][_0x61cf('0x24')]||null:null,'include':_0x52cabf[_0x61cf('0x22')]?_0x52cabf['options']['include']?_[_0x61cf('0x25')](_0x52cabf[_0x61cf('0x22')][_0x61cf('0x26')],function(_0x349e50){return{'model':db[_0x349e50['model']],'as':_0x349e50['as'],'attributes':_0x349e50[_0x61cf('0x23')],'include':_0x349e50[_0x61cf('0x26')]?_[_0x61cf('0x25')](_0x349e50[_0x61cf('0x26')],function(_0x533aa1){return{'model':db[_0x533aa1['model']],'as':_0x533aa1['as'],'attributes':_0x533aa1[_0x61cf('0x23')],'include':_0x533aa1[_0x61cf('0x26')]?_[_0x61cf('0x25')](_0x533aa1[_0x61cf('0x26')],function(_0x5368ba){return{'model':db[_0x5368ba['model']],'as':_0x5368ba['as'],'attributes':_0x5368ba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e3e3d){logger[_0x61cf('0x14')](_0x61cf('0x1e'),_0x52cabf);logger[_0x61cf('0x17')]('GetChatQueue',_0x52cabf,JSON[_0x61cf('0x27')](_0x3e3e3d));_0x5bb38d(_0x3e3e3d);})[_0x61cf('0x1d')](function(_0x133e9f){logger['error'](_0x61cf('0x1e'),_0x133e9f[_0x61cf('0x1b')],_0x52cabf);_0x508617(_0x15f8c1[_0x61cf('0x19')](0x1f4,_0x133e9f[_0x61cf('0x1b')]));});});};exports['ShowChatQueue']=function(_0x1e29d7){var _0x2e0077=this;return new Promise(function(_0x2f4464,_0x3428de){return db[_0x61cf('0x1f')][_0x61cf('0x28')]({'raw':_0x1e29d7[_0x61cf('0x22')]?_0x1e29d7[_0x61cf('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x1e29d7[_0x61cf('0x22')]?_0x1e29d7[_0x61cf('0x22')][_0x61cf('0x29')]||null:null,'attributes':_0x1e29d7[_0x61cf('0x22')]?_0x1e29d7[_0x61cf('0x22')][_0x61cf('0x23')]||null:null,'include':_0x1e29d7['options']?_0x1e29d7[_0x61cf('0x22')][_0x61cf('0x26')]?_['map'](_0x1e29d7[_0x61cf('0x22')]['include'],function(_0x4a3467){return{'model':db[_0x4a3467['model']],'as':_0x4a3467['as'],'attributes':_0x4a3467[_0x61cf('0x23')],'include':_0x4a3467[_0x61cf('0x26')]?_[_0x61cf('0x25')](_0x4a3467['include'],function(_0x4437ea){return{'model':db[_0x4437ea[_0x61cf('0x2a')]],'as':_0x4437ea['as'],'attributes':_0x4437ea['attributes'],'include':_0x4437ea[_0x61cf('0x26')]?_[_0x61cf('0x25')](_0x4437ea[_0x61cf('0x26')],function(_0x318c76){return{'model':db[_0x318c76[_0x61cf('0x2a')]],'as':_0x318c76['as'],'attributes':_0x318c76[_0x61cf('0x23')]};}):[]};}):[]};}):[]:[]})[_0x61cf('0x13')](function(_0x162e35){logger['info']('ShowChatQueue',_0x1e29d7);logger['debug']('ShowChatQueue',_0x1e29d7,JSON[_0x61cf('0x27')](_0x162e35));_0x2f4464(_0x162e35);})[_0x61cf('0x1d')](function(_0x49331a){logger[_0x61cf('0x19')](_0x61cf('0x2b'),_0x49331a[_0x61cf('0x1b')],_0x1e29d7);_0x3428de(_0x2e0077[_0x61cf('0x19')](0x1f4,_0x49331a[_0x61cf('0x1b')]));});});}; \ No newline at end of file +var _0x2fc9=['register','request','then','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowChatQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0x5253cc,_0x4a6bda){var _0xbb5fc3=function(_0x5c141c){while(--_0x5c141c){_0x5253cc['push'](_0x5253cc['shift']());}};_0xbb5fc3(++_0x4a6bda);}(_0x2fc9,0xc2));var _0x92fc=function(_0x5ed54b,_0x3a2827){_0x5ed54b=_0x5ed54b-0x0;var _0x4b58c7=_0x2fc9[_0x5ed54b];return _0x4b58c7;};'use strict';var _=require('lodash');var util=require(_0x92fc('0x0'));var moment=require(_0x92fc('0x1'));var BPromise=require(_0x92fc('0x2'));var rs=require(_0x92fc('0x3'));var fs=require('fs');var Redis=require(_0x92fc('0x4'));var db=require(_0x92fc('0x5'))['db'];var utils=require(_0x92fc('0x6'));var logger=require(_0x92fc('0x7'))(_0x92fc('0x8'));var config=require(_0x92fc('0x9'));var jayson=require(_0x92fc('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x92fc('0xb')](config[_0x92fc('0xc')],{'host':_0x92fc('0xd'),'port':0x18eb});var socket=require(_0x92fc('0xe'))(new Redis(config[_0x92fc('0xc')]));require(_0x92fc('0xf'))[_0x92fc('0x10')](socket);function respondWithRpcPromise(_0x59fa42,_0x4d8759,_0x34a751){return new BPromise(function(_0x32b1d9,_0x5ce1ed){return client[_0x92fc('0x11')](_0x59fa42,_0x34a751)[_0x92fc('0x12')](function(_0x36094a){logger['info']('ChatQueue,\x20%s,\x20%s',_0x4d8759,_0x92fc('0x13'));logger[_0x92fc('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4d8759,_0x92fc('0x13'),JSON[_0x92fc('0x15')](_0x36094a));if(_0x36094a[_0x92fc('0x16')]){if(_0x36094a[_0x92fc('0x16')][_0x92fc('0x17')]===0x1f4){logger['error'](_0x92fc('0x18'),_0x4d8759,_0x36094a[_0x92fc('0x16')][_0x92fc('0x19')]);return _0x5ce1ed(_0x36094a[_0x92fc('0x16')]['message']);}logger['error'](_0x92fc('0x18'),_0x4d8759,_0x36094a[_0x92fc('0x16')]['message']);return _0x32b1d9(_0x36094a[_0x92fc('0x16')][_0x92fc('0x19')]);}else{logger[_0x92fc('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x4d8759,_0x92fc('0x13'));_0x32b1d9(_0x36094a[_0x92fc('0x1b')][_0x92fc('0x19')]);}})[_0x92fc('0x1c')](function(_0x22d671){logger[_0x92fc('0x16')](_0x92fc('0x18'),_0x4d8759,_0x22d671);_0x5ce1ed(_0x22d671);});});}exports[_0x92fc('0x1d')]=function(_0x498adf){var _0x13802a=this;return new Promise(function(_0x4eaeff,_0x1e3bb1){return db[_0x92fc('0x1e')][_0x92fc('0x1f')]({'raw':_0x498adf[_0x92fc('0x20')]?_0x498adf[_0x92fc('0x20')][_0x92fc('0x21')]===undefined?!![]:![]:!![],'where':_0x498adf[_0x92fc('0x20')]?_0x498adf['options'][_0x92fc('0x22')]||null:null,'attributes':_0x498adf[_0x92fc('0x20')]?_0x498adf[_0x92fc('0x20')]['attributes']||null:null,'limit':_0x498adf[_0x92fc('0x20')]?_0x498adf[_0x92fc('0x20')][_0x92fc('0x23')]||null:null,'include':_0x498adf['options']?_0x498adf[_0x92fc('0x20')][_0x92fc('0x24')]?_[_0x92fc('0x25')](_0x498adf[_0x92fc('0x20')][_0x92fc('0x24')],function(_0x366bd4){return{'model':db[_0x366bd4[_0x92fc('0x26')]],'as':_0x366bd4['as'],'attributes':_0x366bd4[_0x92fc('0x27')],'include':_0x366bd4[_0x92fc('0x24')]?_[_0x92fc('0x25')](_0x366bd4[_0x92fc('0x24')],function(_0x1c0269){return{'model':db[_0x1c0269[_0x92fc('0x26')]],'as':_0x1c0269['as'],'attributes':_0x1c0269['attributes'],'include':_0x1c0269[_0x92fc('0x24')]?_[_0x92fc('0x25')](_0x1c0269[_0x92fc('0x24')],function(_0x391c71){return{'model':db[_0x391c71[_0x92fc('0x26')]],'as':_0x391c71['as'],'attributes':_0x391c71[_0x92fc('0x27')]};}):[]};}):[]};}):[]:[]})[_0x92fc('0x12')](function(_0x4ef34d){logger[_0x92fc('0x1a')](_0x92fc('0x1d'),_0x498adf);logger[_0x92fc('0x14')]('GetChatQueue',_0x498adf,JSON[_0x92fc('0x15')](_0x4ef34d));_0x4eaeff(_0x4ef34d);})[_0x92fc('0x1c')](function(_0x416dfe){logger[_0x92fc('0x16')](_0x92fc('0x1d'),_0x416dfe['message'],_0x498adf);_0x1e3bb1(_0x13802a[_0x92fc('0x16')](0x1f4,_0x416dfe[_0x92fc('0x19')]));});});};exports[_0x92fc('0x28')]=function(_0x58410f){var _0xb207e=this;return new Promise(function(_0x1840df,_0x31d5f9){return db[_0x92fc('0x1e')][_0x92fc('0x29')]({'raw':_0x58410f['options']?_0x58410f[_0x92fc('0x20')][_0x92fc('0x21')]===undefined?!![]:![]:!![],'where':_0x58410f[_0x92fc('0x20')]?_0x58410f[_0x92fc('0x20')]['where']||null:null,'attributes':_0x58410f[_0x92fc('0x20')]?_0x58410f['options']['attributes']||null:null,'include':_0x58410f[_0x92fc('0x20')]?_0x58410f[_0x92fc('0x20')][_0x92fc('0x24')]?_[_0x92fc('0x25')](_0x58410f[_0x92fc('0x20')]['include'],function(_0x471545){return{'model':db[_0x471545[_0x92fc('0x26')]],'as':_0x471545['as'],'attributes':_0x471545[_0x92fc('0x27')],'include':_0x471545[_0x92fc('0x24')]?_['map'](_0x471545[_0x92fc('0x24')],function(_0x1f62c6){return{'model':db[_0x1f62c6[_0x92fc('0x26')]],'as':_0x1f62c6['as'],'attributes':_0x1f62c6[_0x92fc('0x27')],'include':_0x1f62c6[_0x92fc('0x24')]?_[_0x92fc('0x25')](_0x1f62c6[_0x92fc('0x24')],function(_0x540e85){return{'model':db[_0x540e85['model']],'as':_0x540e85['as'],'attributes':_0x540e85['attributes']};}):[]};}):[]};}):[]:[]})[_0x92fc('0x12')](function(_0x6e2b42){logger[_0x92fc('0x1a')]('ShowChatQueue',_0x58410f);logger[_0x92fc('0x14')](_0x92fc('0x28'),_0x58410f,JSON[_0x92fc('0x15')](_0x6e2b42));_0x1840df(_0x6e2b42);})[_0x92fc('0x1c')](function(_0x543242){logger[_0x92fc('0x16')](_0x92fc('0x28'),_0x543242['message'],_0x58410f);_0x31d5f9(_0xb207e['error'](0x1f4,_0x543242['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 216e0ce..52eca11 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 _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x52d303,_0x26f460){var _0x42d1c6=function(_0x23d305){while(--_0x23d305){_0x52d303['push'](_0x52d303['shift']());}};_0x42d1c6(++_0x26f460);}(_0xb10b,0x12a));var _0xbb10=function(_0xaf8280,_0x5c1176){_0xaf8280=_0xaf8280-0x0;var _0x1b92a5=_0xb10b[_0xaf8280];return _0x1b92a5;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x32eb8b,_0x5ac0b5){var _0x5bc68b=function(_0x259158){while(--_0x259158){_0x32eb8b['push'](_0x32eb8b['shift']());}};_0x5bc68b(++_0x5ac0b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x18bf9a,_0x18b92c){_0x18bf9a=_0x18bf9a-0x0;var _0x18b7b8=_0x5f2f[_0x18bf9a];return _0x18b7b8;};'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 1ac4be5..8386bca 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 _0x42ea=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/:id','show'];(function(_0x2c0054,_0x5d5436){var _0x2b5da6=function(_0x3c6553){while(--_0x3c6553){_0x2c0054['push'](_0x2c0054['shift']());}};_0x2b5da6(++_0x5d5436);}(_0x42ea,0x1a0));var _0xa42e=function(_0x4d3ef4,_0x51a000){_0x4d3ef4=_0x4d3ef4-0x0;var _0x59f3eb=_0x42ea[_0x4d3ef4];return _0x59f3eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa42e('0x0'));var timeout=require(_0xa42e('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa42e('0x2'));var config=require(_0xa42e('0x3'));var controller=require(_0xa42e('0x4'));router[_0xa42e('0x5')]('/',auth[_0xa42e('0x6')](),controller['index']);router[_0xa42e('0x5')]('/describe',auth[_0xa42e('0x6')](),controller['describe']);router[_0xa42e('0x5')](_0xa42e('0x7'),auth[_0xa42e('0x6')](),controller[_0xa42e('0x8')]);router[_0xa42e('0x5')](_0xa42e('0x9'),auth[_0xa42e('0x6')](),controller[_0xa42e('0xa')]);router['get'](_0xa42e('0xb'),auth[_0xa42e('0x6')](),controller[_0xa42e('0xc')]);router[_0xa42e('0x5')](_0xa42e('0xd'),auth[_0xa42e('0x6')](),controller['getAgents']);router['post']('/',auth[_0xa42e('0x6')](),controller[_0xa42e('0xe')]);router[_0xa42e('0xf')](_0xa42e('0xb'),auth['isAuthenticated'](),controller[_0xa42e('0x10')]);router['post'](_0xa42e('0xd'),auth[_0xa42e('0x6')](),controller[_0xa42e('0x11')]);router[_0xa42e('0x12')](_0xa42e('0x7'),auth[_0xa42e('0x6')](),controller[_0xa42e('0x13')]);router[_0xa42e('0x14')](_0xa42e('0x7'),auth[_0xa42e('0x6')](),controller[_0xa42e('0x15')]);router['delete'](_0xa42e('0xb'),auth[_0xa42e('0x6')](),controller[_0xa42e('0x16')]);router[_0xa42e('0x14')](_0xa42e('0xd'),auth[_0xa42e('0x6')](),controller[_0xa42e('0x17')]);module[_0xa42e('0x18')]=router; \ No newline at end of file +var _0xa2dd=['getMembers','getTeams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0xa2dd,0xd9));var _0xda2d=function(_0x34992e,_0x363391){_0x34992e=_0x34992e-0x0;var _0xb35d1d=_0xa2dd[_0x34992e];return _0xb35d1d;};'use strict';var multer=require(_0xda2d('0x0'));var util=require(_0xda2d('0x1'));var path=require('path');var timeout=require(_0xda2d('0x2'));var express=require(_0xda2d('0x3'));var router=express[_0xda2d('0x4')]();var auth=require(_0xda2d('0x5'));var interaction=require(_0xda2d('0x6'));var config=require('../../config/environment');var controller=require(_0xda2d('0x7'));router[_0xda2d('0x8')]('/',auth[_0xda2d('0x9')](),controller['index']);router[_0xda2d('0x8')](_0xda2d('0xa'),auth[_0xda2d('0x9')](),controller[_0xda2d('0xb')]);router['get'](_0xda2d('0xc'),auth[_0xda2d('0x9')](),controller[_0xda2d('0xd')]);router['get'](_0xda2d('0xe'),auth[_0xda2d('0x9')](),controller[_0xda2d('0xf')]);router[_0xda2d('0x8')]('/:id/teams',auth[_0xda2d('0x9')](),controller[_0xda2d('0x10')]);router[_0xda2d('0x8')](_0xda2d('0x11'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xda2d('0x9')](),controller['create']);router[_0xda2d('0x12')]('/:id/teams',auth[_0xda2d('0x9')](),controller[_0xda2d('0x13')]);router[_0xda2d('0x12')](_0xda2d('0x11'),auth['isAuthenticated'](),controller[_0xda2d('0x14')]);router[_0xda2d('0x15')](_0xda2d('0xc'),auth[_0xda2d('0x9')](),controller[_0xda2d('0x16')]);router[_0xda2d('0x17')](_0xda2d('0xc'),auth[_0xda2d('0x9')](),controller[_0xda2d('0x18')]);router[_0xda2d('0x17')](_0xda2d('0x19'),auth['isAuthenticated'](),controller[_0xda2d('0x1a')]);router[_0xda2d('0x17')]('/:id/users',auth[_0xda2d('0x9')](),controller[_0xda2d('0x1b')]);module[_0xda2d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 7070958..403dc07 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 _0xabd1=['DATE','STRING'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xabd1,0x1a1));var _0x1abd=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xabd1[_0x4e6ae6];return _0x23c108;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x1abd('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x1abd('0x0')]},'joinAt':{'type':Sequelize[_0x1abd('0x1')]},'leaveAt':{'type':Sequelize[_0x1abd('0x1')]},'acceptAt':{'type':Sequelize[_0x1abd('0x1')]},'exitAt':{'type':Sequelize[_0x1abd('0x1')]},'reason':{'type':Sequelize[_0x1abd('0x0')]}}; \ No newline at end of file +var _0xe0fe=['STRING','DATE','sequelize','exports'];(function(_0x1cb557,_0x2915a2){var _0x208628=function(_0x230386){while(--_0x230386){_0x1cb557['push'](_0x1cb557['shift']());}};_0x208628(++_0x2915a2);}(_0xe0fe,0x11e));var _0xee0f=function(_0x5c544c,_0x556ad7){_0x5c544c=_0x5c544c-0x0;var _0x1ceebd=_0xe0fe[_0x5c544c];return _0x1ceebd;};'use strict';var moment=require('moment');var Sequelize=require(_0xee0f('0x0'));module[_0xee0f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xee0f('0x2')]},'joinAt':{'type':Sequelize[_0xee0f('0x3')]},'leaveAt':{'type':Sequelize[_0xee0f('0x3')]},'acceptAt':{'type':Sequelize[_0xee0f('0x3')]},'exitAt':{'type':Sequelize[_0xee0f('0x3')]},'reason':{'type':Sequelize[_0xee0f('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 47d9dc8..2924fcd 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 _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(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb7e7[_0xefd519];return _0x4bb882;};'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 +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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'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 b89671f..d08ba86 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 _0x3ebf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatQueueReport','report_chat_queue','uniqueid','../../config/logger'];(function(_0x66d209,_0x56452e){var _0x549f5c=function(_0x4d48ee){while(--_0x4d48ee){_0x66d209['push'](_0x66d209['shift']());}};_0x549f5c(++_0x56452e);}(_0x3ebf,0x11f));var _0xf3eb=function(_0x1801e3,_0x4089dc){_0x1801e3=_0x1801e3-0x0;var _0x2ad3ab=_0x3ebf[_0x1801e3];return _0x2ad3ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf3eb('0x0'))(_0xf3eb('0x1'));var moment=require(_0xf3eb('0x2'));var BPromise=require(_0xf3eb('0x3'));var rp=require(_0xf3eb('0x4'));var fs=require('fs');var path=require(_0xf3eb('0x5'));var rimraf=require(_0xf3eb('0x6'));var config=require(_0xf3eb('0x7'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x53e96c,_0x157e32){return _0x53e96c[_0xf3eb('0x8')](_0xf3eb('0x9'),attributes,{'tableName':_0xf3eb('0xa'),'paranoid':![],'indexes':[{'name':_0xf3eb('0xb'),'fields':[_0xf3eb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x633f=['exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes'];(function(_0x21a9a3,_0xa033e5){var _0x14910a=function(_0x4e2f05){while(--_0x4e2f05){_0x21a9a3['push'](_0x21a9a3['shift']());}};_0x14910a(++_0xa033e5);}(_0x633f,0x113));var _0xf633=function(_0x45a244,_0x12f982){_0x45a244=_0x45a244-0x0;var _0x57edbc=_0x633f[_0x45a244];return _0x57edbc;};'use strict';var _=require(_0xf633('0x0'));var util=require(_0xf633('0x1'));var logger=require('../../config/logger')(_0xf633('0x2'));var moment=require(_0xf633('0x3'));var BPromise=require(_0xf633('0x4'));var rp=require(_0xf633('0x5'));var fs=require('fs');var path=require(_0xf633('0x6'));var rimraf=require(_0xf633('0x7'));var config=require(_0xf633('0x8'));var attributes=require(_0xf633('0x9'));module[_0xf633('0xa')]=function(_0x547966,_0x2dc7ca){return _0x547966[_0xf633('0xb')](_0xf633('0xc'),attributes,{'tableName':_0xf633('0xd'),'paranoid':![],'indexes':[{'name':_0xf633('0xe'),'fields':[_0xf633('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 574cdab..ccf58b8 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 _0xd571=['CreateChatQueueReport','create','options','raw','stringify','UpdateChatQueueReport','ChatQueueReport','update','body','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','catch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd571,0x13e));var _0x1d57=function(_0x5e9b72,_0x3ebc6f){_0x5e9b72=_0x5e9b72-0x0;var _0x4ae261=_0xd571[_0x5e9b72];return _0x4ae261;};'use strict';var _=require(_0x1d57('0x0'));var util=require(_0x1d57('0x1'));var moment=require('moment');var BPromise=require(_0x1d57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d57('0x3'));var db=require(_0x1d57('0x4'))['db'];var utils=require(_0x1d57('0x5'));var logger=require(_0x1d57('0x6'))('rpc');var config=require(_0x1d57('0x7'));var jayson=require(_0x1d57('0x8'));var client=jayson[_0x1d57('0x9')][_0x1d57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3194d1,_0x46211a,_0x2bdaab){return new BPromise(function(_0x28481e,_0x57bf29){return client[_0x1d57('0xb')](_0x3194d1,_0x2bdaab)[_0x1d57('0xc')](function(_0x545b81){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x46211a,_0x1d57('0xd'));logger[_0x1d57('0xe')](_0x1d57('0xf'),_0x46211a,'request\x20sent',JSON['stringify'](_0x545b81));if(_0x545b81[_0x1d57('0x10')]){if(_0x545b81[_0x1d57('0x10')][_0x1d57('0x11')]===0x1f4){logger['error'](_0x1d57('0x12'),_0x46211a,_0x545b81[_0x1d57('0x10')][_0x1d57('0x13')]);return _0x57bf29(_0x545b81[_0x1d57('0x10')]['message']);}logger[_0x1d57('0x10')](_0x1d57('0x12'),_0x46211a,_0x545b81[_0x1d57('0x10')][_0x1d57('0x13')]);return _0x28481e(_0x545b81[_0x1d57('0x10')]['message']);}else{logger[_0x1d57('0x14')](_0x1d57('0x12'),_0x46211a,_0x1d57('0xd'));_0x28481e(_0x545b81['result'][_0x1d57('0x13')]);}})[_0x1d57('0x15')](function(_0x2ca662){logger[_0x1d57('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x46211a,_0x2ca662);_0x57bf29(_0x2ca662);});});}exports[_0x1d57('0x16')]=function(_0x41d046){var _0x4d4a64=this;return new Promise(function(_0xc54b31,_0x547290){return db['ChatQueueReport'][_0x1d57('0x17')](_0x41d046['body'],{'raw':_0x41d046[_0x1d57('0x18')]?_0x41d046[_0x1d57('0x18')][_0x1d57('0x19')]===undefined?!![]:![]:!![]})[_0x1d57('0xc')](function(_0x431f91){logger[_0x1d57('0x14')](_0x1d57('0x16'),_0x41d046);logger[_0x1d57('0xe')](_0x1d57('0x16'),_0x41d046,JSON[_0x1d57('0x1a')](_0x431f91));_0xc54b31(_0x431f91);})[_0x1d57('0x15')](function(_0x159d1f){logger['error']('CreateChatQueueReport',_0x159d1f[_0x1d57('0x13')],_0x41d046);_0x547290(_0x4d4a64[_0x1d57('0x10')](0x1f4,_0x159d1f[_0x1d57('0x13')]));});});};exports[_0x1d57('0x1b')]=function(_0xbae0d7){var _0x1ab1fe=this;return new Promise(function(_0x1f7b20,_0x5b6fdb){return db[_0x1d57('0x1c')][_0x1d57('0x1d')](_0xbae0d7[_0x1d57('0x1e')],{'raw':_0xbae0d7[_0x1d57('0x18')]?_0xbae0d7[_0x1d57('0x18')][_0x1d57('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbae0d7['options']?_0xbae0d7[_0x1d57('0x18')][_0x1d57('0x1f')]||null:null,'attributes':_0xbae0d7['options']?_0xbae0d7[_0x1d57('0x18')][_0x1d57('0x20')]||null:null,'limit':_0xbae0d7[_0x1d57('0x18')]?_0xbae0d7[_0x1d57('0x18')][_0x1d57('0x21')]||null:null})[_0x1d57('0xc')](function(_0x6c9b7f){logger[_0x1d57('0x14')](_0x1d57('0x1b'),_0xbae0d7);logger[_0x1d57('0xe')](_0x1d57('0x1b'),_0xbae0d7,JSON[_0x1d57('0x1a')](_0x6c9b7f));_0x1f7b20(_0x6c9b7f);})[_0x1d57('0x15')](function(_0x28adb3){logger['error'](_0x1d57('0x1b'),_0x28adb3[_0x1d57('0x13')],_0xbae0d7);_0x5b6fdb(_0x1ab1fe['error'](0x1f4,_0x28adb3['message']));});});}; \ No newline at end of file +var _0x47a1=['code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','update','where','attributes','limit','debug','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x47a1,0x95));var _0x147a=function(_0x547a92,_0x13d240){_0x547a92=_0x547a92-0x0;var _0x263d46=_0x47a1[_0x547a92];return _0x263d46;};'use strict';var _=require(_0x147a('0x0'));var util=require('util');var moment=require(_0x147a('0x1'));var BPromise=require('bluebird');var rs=require(_0x147a('0x2'));var fs=require('fs');var Redis=require(_0x147a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x147a('0x4'));var logger=require(_0x147a('0x5'))(_0x147a('0x6'));var config=require('../../config/environment');var jayson=require(_0x147a('0x7'));var client=jayson['client'][_0x147a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x295173,_0xeb550f,_0x14ace6){return new BPromise(function(_0x4e5936,_0x5e3db2){return client[_0x147a('0x9')](_0x295173,_0x14ace6)['then'](function(_0x575003){logger[_0x147a('0xa')](_0x147a('0xb'),_0xeb550f,_0x147a('0xc'));logger['debug'](_0x147a('0xd'),_0xeb550f,'request\x20sent',JSON[_0x147a('0xe')](_0x575003));if(_0x575003['error']){if(_0x575003[_0x147a('0xf')][_0x147a('0x10')]===0x1f4){logger[_0x147a('0xf')](_0x147a('0xb'),_0xeb550f,_0x575003['error']['message']);return _0x5e3db2(_0x575003[_0x147a('0xf')]['message']);}logger[_0x147a('0xf')](_0x147a('0xb'),_0xeb550f,_0x575003['error']['message']);return _0x4e5936(_0x575003[_0x147a('0xf')][_0x147a('0x11')]);}else{logger[_0x147a('0xa')](_0x147a('0xb'),_0xeb550f,_0x147a('0xc'));_0x4e5936(_0x575003[_0x147a('0x12')][_0x147a('0x11')]);}})[_0x147a('0x13')](function(_0x52aa76){logger[_0x147a('0xf')](_0x147a('0xb'),_0xeb550f,_0x52aa76);_0x5e3db2(_0x52aa76);});});}exports[_0x147a('0x14')]=function(_0x4c0969){var _0x22fb53=this;return new Promise(function(_0x3925d0,_0x3ca5dd){return db[_0x147a('0x15')][_0x147a('0x16')](_0x4c0969[_0x147a('0x17')],{'raw':_0x4c0969[_0x147a('0x18')]?_0x4c0969[_0x147a('0x18')][_0x147a('0x19')]===undefined?!![]:![]:!![]})[_0x147a('0x1a')](function(_0x3596c8){logger[_0x147a('0xa')]('CreateChatQueueReport',_0x4c0969);logger['debug'](_0x147a('0x14'),_0x4c0969,JSON[_0x147a('0xe')](_0x3596c8));_0x3925d0(_0x3596c8);})[_0x147a('0x13')](function(_0x511cbd){logger[_0x147a('0xf')]('CreateChatQueueReport',_0x511cbd[_0x147a('0x11')],_0x4c0969);_0x3ca5dd(_0x22fb53[_0x147a('0xf')](0x1f4,_0x511cbd[_0x147a('0x11')]));});});};exports[_0x147a('0x1b')]=function(_0x4828bd){var _0x3887a2=this;return new Promise(function(_0x28d573,_0x445cb6){return db[_0x147a('0x15')][_0x147a('0x1c')](_0x4828bd[_0x147a('0x17')],{'raw':_0x4828bd[_0x147a('0x18')]?_0x4828bd[_0x147a('0x18')][_0x147a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4828bd['options']?_0x4828bd[_0x147a('0x18')][_0x147a('0x1d')]||null:null,'attributes':_0x4828bd['options']?_0x4828bd[_0x147a('0x18')][_0x147a('0x1e')]||null:null,'limit':_0x4828bd[_0x147a('0x18')]?_0x4828bd[_0x147a('0x18')][_0x147a('0x1f')]||null:null})[_0x147a('0x1a')](function(_0x586381){logger['info']('UpdateChatQueueReport',_0x4828bd);logger[_0x147a('0x20')](_0x147a('0x1b'),_0x4828bd,JSON[_0x147a('0xe')](_0x586381));_0x28d573(_0x586381);})[_0x147a('0x13')](function(_0x366d91){logger['error'](_0x147a('0x1b'),_0x366d91['message'],_0x4828bd);_0x445cb6(_0x3887a2[_0x147a('0xf')](0x1f4,_0x366d91[_0x147a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 9ea2a18..26f1ecd 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 _0x2acc=['create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2acc,0x1be));var _0xc2ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2acc[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc2ac('0x0'));var util=require('util');var path=require(_0xc2ac('0x1'));var timeout=require(_0xc2ac('0x2'));var express=require(_0xc2ac('0x3'));var router=express[_0xc2ac('0x4')]();var auth=require(_0xc2ac('0x5'));var interaction=require(_0xc2ac('0x6'));var config=require(_0xc2ac('0x7'));var controller=require('./chatQueueReport.controller');router[_0xc2ac('0x8')]('/',auth[_0xc2ac('0x9')](),controller[_0xc2ac('0xa')]);router['get'](_0xc2ac('0xb'),auth[_0xc2ac('0x9')](),controller[_0xc2ac('0xc')]);router[_0xc2ac('0x8')](_0xc2ac('0xd'),auth['isAuthenticated'](),controller[_0xc2ac('0xe')]);router[_0xc2ac('0xf')]('/',auth[_0xc2ac('0x9')](),controller[_0xc2ac('0x10')]);router[_0xc2ac('0x11')]('/:id',auth[_0xc2ac('0x9')](),controller[_0xc2ac('0x12')]);router[_0xc2ac('0x13')](_0xc2ac('0xd'),auth[_0xc2ac('0x9')](),controller['destroy']);module[_0xc2ac('0x14')]=router; \ No newline at end of file +var _0x8136=['get','index','/describe','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller'];(function(_0x36a88f,_0x43e5ce){var _0x2008c2=function(_0xd75f89){while(--_0xd75f89){_0x36a88f['push'](_0x36a88f['shift']());}};_0x2008c2(++_0x43e5ce);}(_0x8136,0xf6));var _0x6813=function(_0x2dd1dd,_0x281863){_0x2dd1dd=_0x2dd1dd-0x0;var _0x3e2c13=_0x8136[_0x2dd1dd];return _0x3e2c13;};'use strict';var multer=require('multer');var util=require(_0x6813('0x0'));var path=require('path');var timeout=require(_0x6813('0x1'));var express=require('express');var router=express[_0x6813('0x2')]();var auth=require(_0x6813('0x3'));var interaction=require(_0x6813('0x4'));var config=require('../../config/environment');var controller=require(_0x6813('0x5'));router[_0x6813('0x6')]('/',auth['isAuthenticated'](),controller[_0x6813('0x7')]);router[_0x6813('0x6')](_0x6813('0x8'),auth[_0x6813('0x9')](),controller[_0x6813('0xa')]);router['get'](_0x6813('0xb'),auth[_0x6813('0x9')](),controller[_0x6813('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6813('0xd')]);router['put']('/:id',auth[_0x6813('0x9')](),controller[_0x6813('0xe')]);router[_0x6813('0xf')]('/:id',auth[_0x6813('0x9')](),controller[_0x6813('0x10')]);module[_0x6813('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e4fd485..2ef49bb 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 _0x4a42=['sequelize','exports','STRING','account','agent','queue','DATE','NOW','moment'];(function(_0x35f8c3,_0x201dd8){var _0x2b9314=function(_0x313c10){while(--_0x313c10){_0x35f8c3['push'](_0x35f8c3['shift']());}};_0x2b9314(++_0x201dd8);}(_0x4a42,0x155));var _0x24a4=function(_0x1df84e,_0x289c46){_0x1df84e=_0x1df84e-0x0;var _0x17edfb=_0x4a42[_0x1df84e];return _0x17edfb;};'use strict';var moment=require(_0x24a4('0x0'));var Sequelize=require(_0x24a4('0x1'));module[_0x24a4('0x2')]={'uniqueid':{'type':Sequelize[_0x24a4('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x24a4('0x4'),_0x24a4('0x5'),'queue'),'allowNull':![],'defaultValue':_0x24a4('0x6')},'transferredAt':{'type':Sequelize[_0x24a4('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x24a4('0x8')]}}; \ No newline at end of file +var _0x3e96=['STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x1acd1d,_0x3c8c1a){var _0x59f5a7=function(_0x431aec){while(--_0x431aec){_0x1acd1d['push'](_0x1acd1d['shift']());}};_0x59f5a7(++_0x3c8c1a);}(_0x3e96,0x1af));var _0x63e9=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0x3e96[_0x30182f];return _0x5207db;};'use strict';var moment=require(_0x63e9('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x63e9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x63e9('0x2')](_0x63e9('0x3'),_0x63e9('0x4'),_0x63e9('0x5')),'allowNull':![],'defaultValue':_0x63e9('0x5')},'transferredAt':{'type':Sequelize[_0x63e9('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x63e9('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8a3de43..9122559 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 _0x0587=['map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','create','body','catch','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','ChatTransferReport','fieldName','type','key','model'];(function(_0x4cd721,_0x4dde6d){var _0x32392f=function(_0x4f328d){while(--_0x4f328d){_0x4cd721['push'](_0x4cd721['shift']());}};_0x32392f(++_0x4dde6d);}(_0x0587,0x108));var _0x7058=function(_0x1fb88a,_0x279c0e){_0x1fb88a=_0x1fb88a-0x0;var _0x3e1696=_0x0587[_0x1fb88a];return _0x3e1696;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7058('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7058('0x1'));var jsonpatch=require(_0x7058('0x2'));var rp=require(_0x7058('0x3'));var moment=require(_0x7058('0x4'));var BPromise=require(_0x7058('0x5'));var Mustache=require(_0x7058('0x6'));var util=require(_0x7058('0x7'));var path=require(_0x7058('0x8'));var sox=require(_0x7058('0x9'));var csv=require('to-csv');var ejs=require(_0x7058('0xa'));var fs=require('fs');var _=require(_0x7058('0xb'));var squel=require('squel');var crypto=require(_0x7058('0xc'));var jsforce=require(_0x7058('0xd'));var deskjs=require(_0x7058('0xe'));var toCsv=require(_0x7058('0xf'));var querystring=require(_0x7058('0x10'));var Papa=require(_0x7058('0x11'));var Redis=require(_0x7058('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7058('0x13'));var as=require(_0x7058('0x14'));var hardwareService=require(_0x7058('0x15'));var logger=require('../../config/logger')(_0x7058('0x16'));var utils=require(_0x7058('0x17'));var config=require(_0x7058('0x18'));var db=require(_0x7058('0x19'))['db'];function respondWithStatusCode(_0x1aa488,_0xea6815){_0xea6815=_0xea6815||0xcc;return function(_0x42fd9e){if(_0x42fd9e){return _0x1aa488[_0x7058('0x1a')](_0xea6815);}return _0x1aa488[_0x7058('0x1b')](_0xea6815)[_0x7058('0x1c')]();};}function respondWithResult(_0x21f053,_0x3ea7b2){_0x3ea7b2=_0x3ea7b2||0xc8;return function(_0x415645){if(_0x415645){return _0x21f053['status'](_0x3ea7b2)[_0x7058('0x1d')](_0x415645);}};}function respondWithFilteredResult(_0x58d2e1,_0x48d3de){return function(_0x2c36a1){if(_0x2c36a1){var _0x354c59=_0x2c36a1[_0x7058('0x1e')],_0x1c3880=_0x48d3de['offset'],_0x19b23a=_0x48d3de[_0x7058('0x1f')]+_0x48d3de[_0x7058('0x20')],_0x2bb522;if(_0x19b23a>=_0x354c59){_0x19b23a=_0x354c59;_0x2bb522=0xc8;}else{_0x2bb522=0xce;}_0x58d2e1['status'](_0x2bb522);return _0x58d2e1['set'](_0x7058('0x21'),_0x1c3880+'-'+_0x19b23a+'/'+_0x354c59)[_0x7058('0x1d')](_0x2c36a1);}return null;};}function patchUpdates(_0x21e8e7){return function(_0x2c94f5){try{jsonpatch[_0x7058('0x22')](_0x2c94f5,_0x21e8e7,!![]);}catch(_0x825862){return BPromise[_0x7058('0x23')](_0x825862);}return _0x2c94f5[_0x7058('0x24')]();};}function saveUpdates(_0x5d3048,_0x4e15ce){return function(_0xd9bf10){if(_0xd9bf10){return _0xd9bf10[_0x7058('0x25')](_0x5d3048)[_0x7058('0x26')](function(_0x272a80){return _0x272a80;});}return null;};}function removeEntity(_0x1a5379,_0x1d9d69){return function(_0x44c6e0){if(_0x44c6e0){return _0x44c6e0['destroy']()[_0x7058('0x26')](function(){_0x1a5379['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c554,_0x249580){return function(_0x4cb4ae){if(!_0x4cb4ae){_0x51c554[_0x7058('0x1a')](0x194);}return _0x4cb4ae;};}function handleError(_0x66d22e,_0x1b7ab4){_0x1b7ab4=_0x1b7ab4||0x1f4;return function(_0x556e53){logger['error'](_0x556e53[_0x7058('0x27')]);if(_0x556e53['name']){delete _0x556e53[_0x7058('0x28')];}_0x66d22e[_0x7058('0x1b')](_0x1b7ab4)[_0x7058('0x29')](_0x556e53);};}exports[_0x7058('0x2a')]=function(_0x7a3bbb,_0xcaaa49){var _0xc464ae={},_0x1a1468={},_0x55e722={'count':0x0,'rows':[]};var _0x171e00=_['map'](db[_0x7058('0x2b')]['rawAttributes'],function(_0x4f6999){return{'name':_0x4f6999[_0x7058('0x2c')],'type':_0x4f6999[_0x7058('0x2d')][_0x7058('0x2e')]};});_0x1a1468[_0x7058('0x2f')]=_[_0x7058('0x30')](_0x171e00,_0x7058('0x28'));_0x1a1468[_0x7058('0x31')]=_[_0x7058('0x32')](_0x7a3bbb[_0x7058('0x31')]);_0x1a1468[_0x7058('0x33')]=_[_0x7058('0x34')](_0x1a1468[_0x7058('0x2f')],_0x1a1468['query']);_0xc464ae['attributes']=_[_0x7058('0x34')](_0x1a1468['model'],qs['fields'](_0x7a3bbb[_0x7058('0x31')][_0x7058('0x35')]));_0xc464ae['attributes']=_0xc464ae['attributes']['length']?_0xc464ae[_0x7058('0x36')]:_0x1a1468[_0x7058('0x2f')];if(!_0x7a3bbb[_0x7058('0x31')]['hasOwnProperty'](_0x7058('0x37'))){_0xc464ae[_0x7058('0x20')]=qs[_0x7058('0x20')](_0x7a3bbb['query'][_0x7058('0x20')]);_0xc464ae[_0x7058('0x1f')]=qs[_0x7058('0x1f')](_0x7a3bbb[_0x7058('0x31')][_0x7058('0x1f')]);}_0xc464ae[_0x7058('0x38')]=qs['sort'](_0x7a3bbb[_0x7058('0x31')][_0x7058('0x39')]);_0xc464ae[_0x7058('0x3a')]=qs[_0x7058('0x33')](_[_0x7058('0x3b')](_0x7a3bbb[_0x7058('0x31')],_0x1a1468['filters']),_0x171e00);if(_0x7a3bbb[_0x7058('0x31')][_0x7058('0x3c')]){_0xc464ae[_0x7058('0x3a')]=_[_0x7058('0x3d')](_0xc464ae[_0x7058('0x3a')],{'$or':_['map'](_0x171e00,function(_0x539c0a){if(_0x539c0a[_0x7058('0x2d')]!==_0x7058('0x3e')){var _0x420fdf={};_0x420fdf[_0x539c0a[_0x7058('0x28')]]={'$like':'%'+_0x7a3bbb['query'][_0x7058('0x3c')]+'%'};return _0x420fdf;}})});}_0xc464ae=_['merge']({},_0xc464ae,_0x7a3bbb[_0x7058('0x3f')]);var _0x686b1f={'where':_0xc464ae[_0x7058('0x3a')]};return db[_0x7058('0x2b')][_0x7058('0x1e')](_0x686b1f)[_0x7058('0x26')](function(_0x45f4e5){_0x55e722[_0x7058('0x1e')]=_0x45f4e5;if(_0x7a3bbb[_0x7058('0x31')]['includeAll']){_0xc464ae[_0x7058('0x40')]=[{'all':!![]}];}return db[_0x7058('0x2b')][_0x7058('0x41')](_0xc464ae);})[_0x7058('0x26')](function(_0x3b9a7c){_0x55e722[_0x7058('0x42')]=_0x3b9a7c;return _0x55e722;})[_0x7058('0x26')](respondWithFilteredResult(_0xcaaa49,_0xc464ae))['catch'](handleError(_0xcaaa49,null));};exports[_0x7058('0x43')]=function(_0x3e8287,_0x2a6f71){var _0x45e81f={'raw':!![],'where':{'id':_0x3e8287[_0x7058('0x44')]['id']}},_0x9aed2f={};_0x9aed2f[_0x7058('0x2f')]=_[_0x7058('0x32')](db[_0x7058('0x2b')][_0x7058('0x45')]);_0x9aed2f[_0x7058('0x31')]=_[_0x7058('0x32')](_0x3e8287[_0x7058('0x31')]);_0x9aed2f[_0x7058('0x33')]=_[_0x7058('0x34')](_0x9aed2f['model'],_0x9aed2f['query']);_0x45e81f[_0x7058('0x36')]=_[_0x7058('0x34')](_0x9aed2f[_0x7058('0x2f')],qs[_0x7058('0x35')](_0x3e8287[_0x7058('0x31')][_0x7058('0x35')]));_0x45e81f[_0x7058('0x36')]=_0x45e81f['attributes'][_0x7058('0x46')]?_0x45e81f[_0x7058('0x36')]:_0x9aed2f[_0x7058('0x2f')];if(_0x3e8287['query'][_0x7058('0x47')]){_0x45e81f['include']=[{'all':!![]}];}_0x45e81f=_[_0x7058('0x3d')]({},_0x45e81f,_0x3e8287[_0x7058('0x3f')]);return db[_0x7058('0x2b')][_0x7058('0x48')](_0x45e81f)[_0x7058('0x26')](handleEntityNotFound(_0x2a6f71,null))['then'](respondWithResult(_0x2a6f71,null))['catch'](handleError(_0x2a6f71,null));};exports[_0x7058('0x49')]=function(_0x9f74af,_0x11b1ed){return db[_0x7058('0x2b')][_0x7058('0x49')](_0x9f74af[_0x7058('0x4a')],{})[_0x7058('0x26')](respondWithResult(_0x11b1ed,0xc9))[_0x7058('0x4b')](handleError(_0x11b1ed,null));};exports[_0x7058('0x25')]=function(_0x556133,_0x253218){if(_0x556133[_0x7058('0x4a')]['id']){delete _0x556133['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x556133[_0x7058('0x44')]['id']}})['then'](handleEntityNotFound(_0x253218,null))[_0x7058('0x26')](saveUpdates(_0x556133[_0x7058('0x4a')],null))[_0x7058('0x26')](respondWithResult(_0x253218,null))[_0x7058('0x4b')](handleError(_0x253218,null));};exports[_0x7058('0x4c')]=function(_0x2466f5,_0x4311e5){return db[_0x7058('0x2b')][_0x7058('0x48')]({'where':{'id':_0x2466f5['params']['id']}})[_0x7058('0x26')](handleEntityNotFound(_0x4311e5,null))[_0x7058('0x26')](removeEntity(_0x4311e5,null))[_0x7058('0x4b')](handleError(_0x4311e5,null));};exports['describe']=function(_0x52e98c,_0x2b30ba){return db[_0x7058('0x2b')][_0x7058('0x4d')]()['then'](respondWithResult(_0x2b30ba,null))[_0x7058('0x4b')](handleError(_0x2b30ba,null));}; \ No newline at end of file +var _0x5fef=['sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','attributes','fields','length','nolimit','sort','where','filters','merge','VIRTUAL','filter','count','includeAll','include','rows','catch','show','params','keys','intersection','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb'];(function(_0x28ce24,_0x2ff60e){var _0x10ea69=function(_0x1b4d90){while(--_0x1b4d90){_0x28ce24['push'](_0x28ce24['shift']());}};_0x10ea69(++_0x2ff60e);}(_0x5fef,0x19f));var _0xf5fe=function(_0x165a17,_0xbe780f){_0x165a17=_0x165a17-0x0;var _0x4f9f1c=_0x5fef[_0x165a17];return _0x4f9f1c;};'use strict';var pdf=require(_0xf5fe('0x0'));var emlformat=require(_0xf5fe('0x1'));var rimraf=require(_0xf5fe('0x2'));var zipdir=require(_0xf5fe('0x3'));var jsonpatch=require(_0xf5fe('0x4'));var rp=require('request-promise');var moment=require(_0xf5fe('0x5'));var BPromise=require(_0xf5fe('0x6'));var Mustache=require(_0xf5fe('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5fe('0x8'));var csv=require(_0xf5fe('0x9'));var ejs=require(_0xf5fe('0xa'));var fs=require('fs');var _=require(_0xf5fe('0xb'));var squel=require('squel');var crypto=require(_0xf5fe('0xc'));var jsforce=require(_0xf5fe('0xd'));var deskjs=require(_0xf5fe('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf5fe('0xf'));var Papa=require(_0xf5fe('0x10'));var Redis=require(_0xf5fe('0x11'));var authService=require(_0xf5fe('0x12'));var qs=require(_0xf5fe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5fe('0x14'));var utils=require('../../config/utils');var config=require(_0xf5fe('0x15'));var db=require(_0xf5fe('0x16'))['db'];function respondWithStatusCode(_0x2cb036,_0x206e62){_0x206e62=_0x206e62||0xcc;return function(_0xb9ecab){if(_0xb9ecab){return _0x2cb036[_0xf5fe('0x17')](_0x206e62);}return _0x2cb036[_0xf5fe('0x18')](_0x206e62)[_0xf5fe('0x19')]();};}function respondWithResult(_0x1ea593,_0xd49eea){_0xd49eea=_0xd49eea||0xc8;return function(_0x560cd9){if(_0x560cd9){return _0x1ea593[_0xf5fe('0x18')](_0xd49eea)['json'](_0x560cd9);}};}function respondWithFilteredResult(_0x7b3fc8,_0x9749fd){return function(_0x4d3e5b){if(_0x4d3e5b){var _0x2d5ad1=_0x4d3e5b['count'],_0x21f732=_0x9749fd[_0xf5fe('0x1a')],_0x5d4d33=_0x9749fd[_0xf5fe('0x1a')]+_0x9749fd[_0xf5fe('0x1b')],_0x3543ab;if(_0x5d4d33>=_0x2d5ad1){_0x5d4d33=_0x2d5ad1;_0x3543ab=0xc8;}else{_0x3543ab=0xce;}_0x7b3fc8[_0xf5fe('0x18')](_0x3543ab);return _0x7b3fc8[_0xf5fe('0x1c')](_0xf5fe('0x1d'),_0x21f732+'-'+_0x5d4d33+'/'+_0x2d5ad1)['json'](_0x4d3e5b);}return null;};}function patchUpdates(_0x8e68a6){return function(_0x22576f){try{jsonpatch[_0xf5fe('0x1e')](_0x22576f,_0x8e68a6,!![]);}catch(_0x62db8f){return BPromise[_0xf5fe('0x1f')](_0x62db8f);}return _0x22576f[_0xf5fe('0x20')]();};}function saveUpdates(_0x32159c,_0x1dd5ef){return function(_0x3f4340){if(_0x3f4340){return _0x3f4340[_0xf5fe('0x21')](_0x32159c)[_0xf5fe('0x22')](function(_0xd779ff){return _0xd779ff;});}return null;};}function removeEntity(_0x255c6a,_0x3976cb){return function(_0x20b1eb){if(_0x20b1eb){return _0x20b1eb[_0xf5fe('0x23')]()[_0xf5fe('0x22')](function(){_0x255c6a[_0xf5fe('0x18')](0xcc)[_0xf5fe('0x19')]();});}};}function handleEntityNotFound(_0x46d3ba,_0x407b1e){return function(_0x16a6b9){if(!_0x16a6b9){_0x46d3ba['sendStatus'](0x194);}return _0x16a6b9;};}function handleError(_0x34f296,_0x54f4a3){_0x54f4a3=_0x54f4a3||0x1f4;return function(_0x26e620){logger[_0xf5fe('0x24')](_0x26e620[_0xf5fe('0x25')]);if(_0x26e620[_0xf5fe('0x26')]){delete _0x26e620[_0xf5fe('0x26')];}_0x34f296[_0xf5fe('0x18')](_0x54f4a3)[_0xf5fe('0x27')](_0x26e620);};}exports[_0xf5fe('0x28')]=function(_0x3bce2c,_0x259c4b){var _0x36372d={},_0x273c73={},_0x2cd7d7={'count':0x0,'rows':[]};var _0x1d9c9c=_['map'](db[_0xf5fe('0x29')][_0xf5fe('0x2a')],function(_0x1cade2){return{'name':_0x1cade2[_0xf5fe('0x2b')],'type':_0x1cade2[_0xf5fe('0x2c')][_0xf5fe('0x2d')]};});_0x273c73[_0xf5fe('0x2e')]=_[_0xf5fe('0x2f')](_0x1d9c9c,'name');_0x273c73[_0xf5fe('0x30')]=_['keys'](_0x3bce2c[_0xf5fe('0x30')]);_0x273c73['filters']=_['intersection'](_0x273c73['model'],_0x273c73[_0xf5fe('0x30')]);_0x36372d[_0xf5fe('0x31')]=_['intersection'](_0x273c73[_0xf5fe('0x2e')],qs[_0xf5fe('0x32')](_0x3bce2c['query'][_0xf5fe('0x32')]));_0x36372d['attributes']=_0x36372d[_0xf5fe('0x31')][_0xf5fe('0x33')]?_0x36372d['attributes']:_0x273c73['model'];if(!_0x3bce2c['query']['hasOwnProperty'](_0xf5fe('0x34'))){_0x36372d[_0xf5fe('0x1b')]=qs['limit'](_0x3bce2c[_0xf5fe('0x30')][_0xf5fe('0x1b')]);_0x36372d[_0xf5fe('0x1a')]=qs['offset'](_0x3bce2c['query'][_0xf5fe('0x1a')]);}_0x36372d['order']=qs[_0xf5fe('0x35')](_0x3bce2c[_0xf5fe('0x30')]['sort']);_0x36372d[_0xf5fe('0x36')]=qs['filters'](_['pick'](_0x3bce2c[_0xf5fe('0x30')],_0x273c73[_0xf5fe('0x37')]),_0x1d9c9c);if(_0x3bce2c[_0xf5fe('0x30')]['filter']){_0x36372d[_0xf5fe('0x36')]=_[_0xf5fe('0x38')](_0x36372d['where'],{'$or':_[_0xf5fe('0x2f')](_0x1d9c9c,function(_0x211bf4){if(_0x211bf4['type']!==_0xf5fe('0x39')){var _0x3af95a={};_0x3af95a[_0x211bf4['name']]={'$like':'%'+_0x3bce2c[_0xf5fe('0x30')][_0xf5fe('0x3a')]+'%'};return _0x3af95a;}})});}_0x36372d=_[_0xf5fe('0x38')]({},_0x36372d,_0x3bce2c['options']);var _0x36f569={'where':_0x36372d[_0xf5fe('0x36')]};return db[_0xf5fe('0x29')][_0xf5fe('0x3b')](_0x36f569)[_0xf5fe('0x22')](function(_0x1b38fb){_0x2cd7d7[_0xf5fe('0x3b')]=_0x1b38fb;if(_0x3bce2c['query'][_0xf5fe('0x3c')]){_0x36372d[_0xf5fe('0x3d')]=[{'all':!![]}];}return db[_0xf5fe('0x29')]['findAll'](_0x36372d);})['then'](function(_0x27a96b){_0x2cd7d7[_0xf5fe('0x3e')]=_0x27a96b;return _0x2cd7d7;})[_0xf5fe('0x22')](respondWithFilteredResult(_0x259c4b,_0x36372d))[_0xf5fe('0x3f')](handleError(_0x259c4b,null));};exports[_0xf5fe('0x40')]=function(_0x406b94,_0x5baad7){var _0x317c99={'raw':!![],'where':{'id':_0x406b94[_0xf5fe('0x41')]['id']}},_0x3fa2fa={};_0x3fa2fa['model']=_[_0xf5fe('0x42')](db[_0xf5fe('0x29')]['rawAttributes']);_0x3fa2fa[_0xf5fe('0x30')]=_['keys'](_0x406b94[_0xf5fe('0x30')]);_0x3fa2fa['filters']=_['intersection'](_0x3fa2fa['model'],_0x3fa2fa[_0xf5fe('0x30')]);_0x317c99[_0xf5fe('0x31')]=_[_0xf5fe('0x43')](_0x3fa2fa['model'],qs[_0xf5fe('0x32')](_0x406b94[_0xf5fe('0x30')]['fields']));_0x317c99['attributes']=_0x317c99[_0xf5fe('0x31')][_0xf5fe('0x33')]?_0x317c99[_0xf5fe('0x31')]:_0x3fa2fa[_0xf5fe('0x2e')];if(_0x406b94[_0xf5fe('0x30')][_0xf5fe('0x3c')]){_0x317c99[_0xf5fe('0x3d')]=[{'all':!![]}];}_0x317c99=_[_0xf5fe('0x38')]({},_0x317c99,_0x406b94[_0xf5fe('0x44')]);return db[_0xf5fe('0x29')][_0xf5fe('0x45')](_0x317c99)[_0xf5fe('0x22')](handleEntityNotFound(_0x5baad7,null))['then'](respondWithResult(_0x5baad7,null))[_0xf5fe('0x3f')](handleError(_0x5baad7,null));};exports[_0xf5fe('0x46')]=function(_0x3bb159,_0x470b9a){return db[_0xf5fe('0x29')][_0xf5fe('0x46')](_0x3bb159[_0xf5fe('0x47')],{})[_0xf5fe('0x22')](respondWithResult(_0x470b9a,0xc9))[_0xf5fe('0x3f')](handleError(_0x470b9a,null));};exports['update']=function(_0x2ded3a,_0x4dc420){if(_0x2ded3a[_0xf5fe('0x47')]['id']){delete _0x2ded3a[_0xf5fe('0x47')]['id'];}return db[_0xf5fe('0x29')][_0xf5fe('0x45')]({'where':{'id':_0x2ded3a[_0xf5fe('0x41')]['id']}})[_0xf5fe('0x22')](handleEntityNotFound(_0x4dc420,null))['then'](saveUpdates(_0x2ded3a[_0xf5fe('0x47')],null))[_0xf5fe('0x22')](respondWithResult(_0x4dc420,null))[_0xf5fe('0x3f')](handleError(_0x4dc420,null));};exports[_0xf5fe('0x23')]=function(_0x254c4f,_0x4510ea){return db[_0xf5fe('0x29')][_0xf5fe('0x45')]({'where':{'id':_0x254c4f[_0xf5fe('0x41')]['id']}})[_0xf5fe('0x22')](handleEntityNotFound(_0x4510ea,null))[_0xf5fe('0x22')](removeEntity(_0x4510ea,null))[_0xf5fe('0x3f')](handleError(_0x4510ea,null));};exports[_0xf5fe('0x48')]=function(_0x29455e,_0x144010){return db[_0xf5fe('0x29')][_0xf5fe('0x48')]()[_0xf5fe('0x22')](respondWithResult(_0x144010,null))[_0xf5fe('0x3f')](handleError(_0x144010,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3be9947..e822f78 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 _0x3e74=['../../config/logger','api','moment','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x3e74,0x175));var _0x43e7=function(_0x5c9bdb,_0x1c6ead){_0x5c9bdb=_0x5c9bdb-0x0;var _0xee5190=_0x3e74[_0x5c9bdb];return _0xee5190;};'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('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x5ca644,_0x3d2165){var _0x5c87a2=function(_0x3dc7d9){while(--_0x3dc7d9){_0x5ca644['push'](_0x5ca644['shift']());}};_0x5c87a2(++_0x3d2165);}(_0x00bb,0x1d8));var _0xb00b=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x00bb[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[{'name':_0xb00b('0xb'),'fields':[_0xb00b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c85ec14..5b7031e 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 _0x021b=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3f1ecb,_0x2b7eac){var _0x26e129=function(_0x4cbcea){while(--_0x4cbcea){_0x3f1ecb['push'](_0x3f1ecb['shift']());}};_0x26e129(++_0x2b7eac);}(_0x021b,0x95));var _0xb021=function(_0x411b14,_0x3f9e36){_0x411b14=_0x411b14-0x0;var _0x402736=_0x021b[_0x411b14];return _0x402736;};'use strict';var _=require(_0xb021('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb021('0x1'));var db=require(_0xb021('0x2'))['db'];var utils=require(_0xb021('0x3'));var logger=require(_0xb021('0x4'))(_0xb021('0x5'));var config=require(_0xb021('0x6'));var jayson=require(_0xb021('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33756f,_0x209c96,_0x4998ee){return new BPromise(function(_0x2aa1f3,_0x24e027){return client['request'](_0x33756f,_0x4998ee)[_0xb021('0x8')](function(_0x5edaa1){logger['info'](_0xb021('0x9'),_0x209c96,_0xb021('0xa'));logger[_0xb021('0xb')](_0xb021('0xc'),_0x209c96,_0xb021('0xa'),JSON[_0xb021('0xd')](_0x5edaa1));if(_0x5edaa1[_0xb021('0xe')]){if(_0x5edaa1[_0xb021('0xe')][_0xb021('0xf')]===0x1f4){logger[_0xb021('0xe')](_0xb021('0x9'),_0x209c96,_0x5edaa1['error'][_0xb021('0x10')]);return _0x24e027(_0x5edaa1[_0xb021('0xe')]['message']);}logger[_0xb021('0xe')](_0xb021('0x9'),_0x209c96,_0x5edaa1[_0xb021('0xe')]['message']);return _0x2aa1f3(_0x5edaa1[_0xb021('0xe')][_0xb021('0x10')]);}else{logger[_0xb021('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x209c96,_0xb021('0xa'));_0x2aa1f3(_0x5edaa1[_0xb021('0x12')]['message']);}})[_0xb021('0x13')](function(_0x5436fd){logger[_0xb021('0xe')](_0xb021('0x9'),_0x209c96,_0x5436fd);_0x24e027(_0x5436fd);});});} \ No newline at end of file +var _0x983b=['http','request','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x5cd395,_0x507285){var _0x141227=function(_0x5893fe){while(--_0x5893fe){_0x5cd395['push'](_0x5cd395['shift']());}};_0x141227(++_0x507285);}(_0x983b,0x1af));var _0xb983=function(_0x1aac73,_0x5b9b95){_0x1aac73=_0x1aac73-0x0;var _0xce1c58=_0x983b[_0x1aac73];return _0xce1c58;};'use strict';var _=require(_0xb983('0x0'));var util=require(_0xb983('0x1'));var moment=require(_0xb983('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb983('0x3'));var db=require(_0xb983('0x4'))['db'];var utils=require(_0xb983('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb983('0x6'));var jayson=require(_0xb983('0x7'));var client=jayson[_0xb983('0x8')][_0xb983('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58778e,_0xc4c66,_0x564fa5){return new BPromise(function(_0x17b9ed,_0x535138){return client[_0xb983('0xa')](_0x58778e,_0x564fa5)['then'](function(_0x1fa52d){logger[_0xb983('0xb')](_0xb983('0xc'),_0xc4c66,'request\x20sent');logger[_0xb983('0xd')](_0xb983('0xe'),_0xc4c66,_0xb983('0xf'),JSON['stringify'](_0x1fa52d));if(_0x1fa52d['error']){if(_0x1fa52d[_0xb983('0x10')][_0xb983('0x11')]===0x1f4){logger[_0xb983('0x10')](_0xb983('0xc'),_0xc4c66,_0x1fa52d[_0xb983('0x10')]['message']);return _0x535138(_0x1fa52d[_0xb983('0x10')][_0xb983('0x12')]);}logger[_0xb983('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0xc4c66,_0x1fa52d[_0xb983('0x10')][_0xb983('0x12')]);return _0x17b9ed(_0x1fa52d['error'][_0xb983('0x12')]);}else{logger[_0xb983('0xb')](_0xb983('0xc'),_0xc4c66,_0xb983('0xf'));_0x17b9ed(_0x1fa52d[_0xb983('0x13')]['message']);}})['catch'](function(_0x5f349a){logger[_0xb983('0x10')](_0xb983('0xc'),_0xc4c66,_0x5f349a);_0x535138(_0x5f349a);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index aa1f228..d0a4075 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x2e4d63,_0x308721){var _0x3bea2e=function(_0x115bbb){while(--_0x115bbb){_0x2e4d63['push'](_0x2e4d63['shift']());}};_0x3bea2e(++_0x308721);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0x0b0e[_0x1a809b];return _0x5d90e6;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xd49e15,_0x5e34ac){var _0x306b6a=function(_0x38ce9c){while(--_0x38ce9c){_0xd49e15['push'](_0xd49e15['shift']());}};_0x306b6a(++_0x5e34ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x509d9e,_0x2d1197){_0x509d9e=_0x509d9e-0x0;var _0x56b488=_0xb10b[_0x509d9e];return _0x56b488;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index edc299f..a1f7039 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 _0xdedc=['Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','star','thumb','stringify','input','name','text','getDataValue','parse','onlineForm','setDataValue','textarea','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','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','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!'];(function(_0x3908fe,_0x13ef68){var _0x150e97=function(_0x131e8e){while(--_0x131e8e){_0x3908fe['push'](_0x3908fe['shift']());}};_0x150e97(++_0x13ef68);}(_0xdedc,0xb8));var _0xcded=function(_0x5e5999,_0x9757b3){_0x5e5999=_0x5e5999-0x0;var _0x1298a1=_0xdedc[_0x5e5999];return _0x1298a1;};'use strict';var Sequelize=require(_0xcded('0x0'));var rs=require(_0xcded('0x1'));module[_0xcded('0x2')]={'name':{'type':Sequelize[_0xcded('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xcded('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xcded('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xcded('0x4')},'mapKeyOffline':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x4')},'key':{'type':Sequelize[_0xcded('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xcded('0x5')},'customerAlias':{'type':Sequelize[_0xcded('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcded('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xcded('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xcded('0x3')]},'animation':{'type':Sequelize[_0xcded('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xcded('0x8')]('rounded',_0xcded('0x9')),'defaultValue':_0xcded('0xa')},'header_online':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0xb')},'start_chat_button':{'type':Sequelize[_0xcded('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0xc')},'header_offline':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xcded('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xcded('0x10')]},'closingQuestion':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcded('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcded('0x13')},'noteTitle':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcded('0x15')},'closingMessage':{'type':Sequelize[_0xcded('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xcded('0xc')},'skipMessageButton':{'type':Sequelize[_0xcded('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x16')},'ratingType':{'type':Sequelize[_0xcded('0x8')](_0xcded('0x17'),_0xcded('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xcded('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xcded('0x10')],'defaultValue':function(){return JSON[_0xcded('0x19')]({'items':[{'type':_0xcded('0x1a'),'variable':null,'config':{'placeholder':_0xcded('0x1b'),'type':_0xcded('0x1c'),'required':!![]},'props':{'title':_0xcded('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xcded('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xcded('0x4'),'type':_0xcded('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xcded('0x1d')]('onlineForm')?JSON[_0xcded('0x1e')](this['getDataValue'](_0xcded('0x1f'))):{};},'set':function(_0xd5ed29){return this[_0xcded('0x20')](_0xcded('0x1f'),JSON['stringify'](_0xd5ed29));}},'offlineForm':{'type':Sequelize[_0xcded('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xcded('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xcded('0x4'),'type':'email'},'variable':null},{'type':_0xcded('0x21'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xcded('0x1d')](_0xcded('0x22'))?JSON[_0xcded('0x1e')](this[_0xcded('0x1d')](_0xcded('0x22'))):{};},'set':function(_0x2f5e02){return this['setDataValue'](_0xcded('0x22'),JSON['stringify'](_0x2f5e02));}},'token':{'type':Sequelize[_0xcded('0x3')],'defaultValue':function(){return rs[_0xcded('0x23')]();}},'autoclose':{'type':Sequelize[_0xcded('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xcded('0x3')]},'waitingTitle':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x24')},'waitingMessage':{'type':Sequelize[_0xcded('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x25')},'offlineMessageBody':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xcded('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xcded('0x27')},'skipUnmanaged':{'type':Sequelize[_0xcded('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xcded('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xcded('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcded('0x28');}},'notificationSound':{'type':Sequelize[_0xcded('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xcded('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x2a')},'verticalAlignment':{'type':Sequelize[_0xcded('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x2b')},'defaultTitle':{'type':Sequelize[_0xcded('0x3')]},'customerAvatar':{'type':Sequelize[_0xcded('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xcded('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xcded('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcded('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcded('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xcded('0x3')],'defaultValue':_0xcded('0x2c')},'systemAvatar':{'type':Sequelize[_0xcded('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xcded('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![],'comment':_0xcded('0x2e'),'set':function(_0x220cdf){if(!_0x220cdf)this[_0xcded('0x20')](_0xcded('0x2f'),null);this[_0xcded('0x20')](_0xcded('0x30'),_0x220cdf);}},'vidaooEscalation':{'type':Sequelize[_0xcded('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0x5455=['bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','input','name','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias'];(function(_0x29d4b5,_0x1913e2){var _0x3fbb01=function(_0x8b0a41){while(--_0x8b0a41){_0x29d4b5['push'](_0x29d4b5['shift']());}};_0x3fbb01(++_0x1913e2);}(_0x5455,0x197));var _0x5545=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5455[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5545('0x0'));module[_0x5545('0x1')]={'name':{'type':Sequelize[_0x5545('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x5545('0x2')],'allowNull':![],'unique':_0x5545('0x3')},'description':{'type':Sequelize[_0x5545('0x2')]},'mapKey':{'type':Sequelize[_0x5545('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x5545('0x4')},'key':{'type':Sequelize[_0x5545('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x5545('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5545('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5545('0x2')],'allowNull':![],'defaultValue':_0x5545('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5545('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5545('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5545('0x2')]},'animation':{'type':Sequelize[_0x5545('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5545('0x9')](_0x5545('0xa'),_0x5545('0xb')),'defaultValue':_0x5545('0xa')},'header_online':{'type':Sequelize[_0x5545('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x5545('0xc')},'offline_chat_button':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0xd')},'header_offline':{'type':Sequelize[_0x5545('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x5545('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5545('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x5545('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x5545('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5545('0xf')]},'closingQuestion':{'type':Sequelize[_0x5545('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x11')},'noteTitle':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x12')},'placeholderMessage':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x13')},'closingMessage':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x14')},'closingMessageButton':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x5545('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x16')},'ratingType':{'type':Sequelize[_0x5545('0x9')]('star',_0x5545('0x17')),'defaultValue':_0x5545('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x5545('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5545('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5545('0x19'),'variable':null,'config':{'placeholder':_0x5545('0x1a'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5545('0x19'),'props':{'title':_0x5545('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x5545('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5545('0x1b')](_0x5545('0x1c'))?JSON[_0x5545('0x1d')](this[_0x5545('0x1b')](_0x5545('0x1c'))):{};},'set':function(_0xc420f5){return this[_0x5545('0x1e')]('onlineForm',JSON['stringify'](_0xc420f5));}},'offlineForm':{'type':Sequelize[_0x5545('0xf')],'defaultValue':function(){return JSON[_0x5545('0x1f')]({'items':[{'type':_0x5545('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5545('0x4'),'type':'email'},'variable':null},{'type':_0x5545('0x20'),'config':{'placeholder':_0x5545('0x21')},'props':{'title':_0x5545('0x21'),'helpText':_0x5545('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x5545('0x23'))?JSON[_0x5545('0x1d')](this[_0x5545('0x1b')](_0x5545('0x23'))):{};},'set':function(_0x4113d6){return this['setDataValue'](_0x5545('0x23'),JSON[_0x5545('0x1f')](_0x4113d6));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5545('0x24')]();}},'autoclose':{'type':Sequelize[_0x5545('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5545('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5545('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5545('0x2')]},'forwardOffline':{'type':Sequelize[_0x5545('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5545('0x2')]},'waitingTitle':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5545('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x5545('0x27')},'offlineMessageBody':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x5545('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5545('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x15')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x5545('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5545('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5545('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5545('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5545('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5545('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x2b')},'verticalAlignment':{'type':Sequelize[_0x5545('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5545('0x2c')},'defaultTitle':{'type':Sequelize[_0x5545('0x2')]},'customerAvatar':{'type':Sequelize[_0x5545('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5545('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5545('0x2')],'allowNull':![],'defaultValue':_0x5545('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5545('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5545('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5545('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5545('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5545('0x2')],'defaultValue':_0x5545('0x2e')},'systemAvatar':{'type':Sequelize[_0x5545('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5545('0x7')],'comment':_0x5545('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x5545('0x8')],'defaultValue':![],'comment':_0x5545('0x30'),'set':function(_0x3932f5){if(!_0x3932f5)this[_0x5545('0x1e')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5545('0x31'),_0x3932f5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5545('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 aab211e..bcc1773 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 _0x48a8=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','priority','Contacts','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','browser','%s\x20%s','version','unknown','device','format','%s\x20%s\x20%s','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','color','textColor','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','items','fromKey','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.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~!@#$%^&-_=+[{]}.','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','intersection','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x234bcf,_0x2d7b6d){var _0x1ec1c3=function(_0x1c2f58){while(--_0x1c2f58){_0x234bcf['push'](_0x234bcf['shift']());}};_0x1ec1c3(++_0x2d7b6d);}(_0x48a8,0x1dd));var _0x848a=function(_0x32261c,_0xd5e672){_0x32261c=_0x32261c-0x0;var _0x2863c0=_0x48a8[_0x32261c];return _0x2863c0;};'use strict';var pdf=require(_0x848a('0x0'));var emlformat=require(_0x848a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x848a('0x2'));var jsonpatch=require(_0x848a('0x3'));var rp=require(_0x848a('0x4'));var moment=require(_0x848a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x848a('0x6'));var path=require(_0x848a('0x7'));var sox=require(_0x848a('0x8'));var csv=require(_0x848a('0x9'));var ejs=require(_0x848a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x848a('0xb'));var crypto=require(_0x848a('0xc'));var jsforce=require(_0x848a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x848a('0x9'));var querystring=require('querystring');var Papa=require(_0x848a('0xe'));var Redis=require(_0x848a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x848a('0x10'));var as=require(_0x848a('0x11'));var hardwareService=require(_0x848a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x848a('0x13'));var db=require(_0x848a('0x14'))['db'];config[_0x848a('0x15')]=_[_0x848a('0x16')](config[_0x848a('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x848a('0x17'))(new Redis(config[_0x848a('0x15')]));require(_0x848a('0x18'))[_0x848a('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x848a('0x1a')][_0x848a('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x848a('0x1b')]({'port':0x232a});var client9003=jayson['client'][_0x848a('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x2cbf4c,_0x534666,_0x44fc6e){if(_0x44fc6e){var _0x322794=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x322794[_0x848a('0x1c')](_0x534666)){return _0x2cbf4c;}else{throw new db[(_0x848a('0x1d'))][(_0x848a('0x1e'))](_0x848a('0x1f'));}}else{return _0x2cbf4c;}}function respondWithRpcPromise(_0x3e5d69,_0x35ba83,_0x1b8790,_0x2b931f){return new BPromise(function(_0x2e310d,_0x2be9de){var _0x287ef9=_0x2b931f||client;return _0x287ef9['request'](_0x3e5d69,_0x1b8790)[_0x848a('0x20')](function(_0x1d0d41){logger[_0x848a('0x21')](_0x848a('0x22'),_0x35ba83,_0x848a('0x23'));logger[_0x848a('0x24')](_0x848a('0x25'),_0x35ba83,_0x848a('0x23'),JSON[_0x848a('0x26')](_0x1d0d41));if(_0x1d0d41['error']){if(_0x1d0d41['error'][_0x848a('0x27')]===0x1f4){logger[_0x848a('0x28')](_0x848a('0x22'),_0x35ba83,_0x1d0d41[_0x848a('0x28')][_0x848a('0x29')]);return _0x2be9de(_0x1d0d41[_0x848a('0x28')]['message']);}logger[_0x848a('0x28')](_0x848a('0x22'),_0x35ba83,_0x1d0d41[_0x848a('0x28')][_0x848a('0x29')]);return _0x2e310d(_0x1d0d41[_0x848a('0x28')][_0x848a('0x29')]);}else{logger[_0x848a('0x21')](_0x848a('0x22'),_0x35ba83,_0x848a('0x23'));_0x2e310d(_0x1d0d41[_0x848a('0x2a')]['message']);}})[_0x848a('0x2b')](function(_0xa9ebd7){logger[_0x848a('0x28')](_0x848a('0x22'),_0x35ba83,_0xa9ebd7);_0x2be9de(_0xa9ebd7);});});}function respondWithStatusCode(_0x2e0351,_0x27a080){_0x27a080=_0x27a080||0xcc;return function(_0x298fa4){if(_0x298fa4){return _0x2e0351[_0x848a('0x2c')](_0x27a080);}return _0x2e0351[_0x848a('0x2d')](_0x27a080)[_0x848a('0x2e')]();};}function respondWithResult(_0x30223e,_0x2da927){_0x2da927=_0x2da927||0xc8;return function(_0xcabcd6){if(_0xcabcd6){return _0x30223e[_0x848a('0x2d')](_0x2da927)['json'](_0xcabcd6);}};}function respondWithFilteredResult(_0x471f86,_0x5ef8e3){return function(_0x1a4a2e){if(_0x1a4a2e){var _0x5125a7=_0x1a4a2e[_0x848a('0x2f')],_0x5ada44=_0x5ef8e3[_0x848a('0x30')],_0x1d8063=_0x5ef8e3['offset']+_0x5ef8e3[_0x848a('0x31')],_0xc926a0;if(_0x1d8063>=_0x5125a7){_0x1d8063=_0x5125a7;_0xc926a0=0xc8;}else{_0xc926a0=0xce;}_0x471f86['status'](_0xc926a0);return _0x471f86[_0x848a('0x32')](_0x848a('0x33'),_0x5ada44+'-'+_0x1d8063+'/'+_0x5125a7)[_0x848a('0x34')](_0x1a4a2e);}return null;};}function patchUpdates(_0x4d7570){return function(_0x46bc61){try{jsonpatch[_0x848a('0x35')](_0x46bc61,_0x4d7570,!![]);}catch(_0x14b5af){return BPromise['reject'](_0x14b5af);}return _0x46bc61[_0x848a('0x36')]();};}function saveUpdates(_0x1dc7eb,_0x2a0e1b){return function(_0x527c18){if(_0x527c18){return _0x527c18[_0x848a('0x37')](_0x1dc7eb)[_0x848a('0x20')](function(_0x29fa5a){return _0x29fa5a;});}return null;};}function removeEntity(_0x55c914,_0x4108ff){return function(_0x36d749){if(_0x36d749){return _0x36d749[_0x848a('0x38')]()['then'](function(){var _0x3df681=_0x36d749[_0x848a('0x39')]({'plain':!![]});var _0x2621db=_0x848a('0x3a');return db[_0x848a('0x3b')][_0x848a('0x38')]({'where':{'type':_0x2621db,'resourceId':_0x3df681['id']}})['then'](function(){return _0x36d749;});})['then'](function(){_0x55c914[_0x848a('0x2d')](0xcc)[_0x848a('0x2e')]();});}};}function handleEntityNotFound(_0x169587,_0x51cc15){return function(_0x42d47d){if(!_0x42d47d){_0x169587[_0x848a('0x2c')](0x194);}return _0x42d47d;};}function handleError(_0x468bf2,_0x51b5ab){_0x51b5ab=_0x51b5ab||0x1f4;return function(_0x4f940a){logger[_0x848a('0x28')](_0x4f940a[_0x848a('0x3c')]);if(_0x4f940a[_0x848a('0x3d')]){delete _0x4f940a[_0x848a('0x3d')];}_0x468bf2[_0x848a('0x2d')](_0x51b5ab)[_0x848a('0x3e')](_0x4f940a);};}exports[_0x848a('0x3f')]=function(_0x13a8b4,_0x5a8870){var _0x184a14={'include':[{'model':db[_0x848a('0x40')],'as':_0x848a('0x41')}]},_0x21780f={},_0x1094ab={'count':0x0,'rows':[]};var _0x1fa993=_[_0x848a('0x42')](db[_0x848a('0x43')][_0x848a('0x44')],function(_0x28d3b8){return{'name':_0x28d3b8[_0x848a('0x45')],'type':_0x28d3b8[_0x848a('0x46')][_0x848a('0x47')]};});_0x21780f[_0x848a('0x48')]=_['map'](_0x1fa993,_0x848a('0x3d'));_0x21780f[_0x848a('0x49')]=_[_0x848a('0x4a')](_0x13a8b4['query']);_0x21780f[_0x848a('0x4b')]=_['intersection'](_0x21780f[_0x848a('0x48')],_0x21780f[_0x848a('0x49')]);_0x184a14[_0x848a('0x4c')]=_['intersection'](_0x21780f[_0x848a('0x48')],qs[_0x848a('0x4d')](_0x13a8b4['query']['fields']));_0x184a14[_0x848a('0x4c')]=_0x184a14['attributes']['length']?_0x184a14[_0x848a('0x4c')]:_0x21780f[_0x848a('0x48')];if(!_0x13a8b4[_0x848a('0x49')][_0x848a('0x4e')](_0x848a('0x4f'))){_0x184a14[_0x848a('0x31')]=qs[_0x848a('0x31')](_0x13a8b4[_0x848a('0x49')][_0x848a('0x31')]);_0x184a14['offset']=qs[_0x848a('0x30')](_0x13a8b4[_0x848a('0x49')]['offset']);}_0x184a14[_0x848a('0x50')]=qs[_0x848a('0x51')](_0x13a8b4[_0x848a('0x49')][_0x848a('0x51')]);_0x184a14[_0x848a('0x52')]=qs[_0x848a('0x4b')](_[_0x848a('0x53')](_0x13a8b4[_0x848a('0x49')],_0x21780f[_0x848a('0x4b')]),_0x1fa993);if(_0x13a8b4[_0x848a('0x49')][_0x848a('0x54')]){_0x184a14['where']=_[_0x848a('0x55')](_0x184a14[_0x848a('0x52')],{'$or':_[_0x848a('0x42')](_0x1fa993,function(_0x1bfdf4){if(_0x1bfdf4[_0x848a('0x46')]!==_0x848a('0x56')){var _0x43447a={};_0x43447a[_0x1bfdf4['name']]={'$like':'%'+_0x13a8b4[_0x848a('0x49')][_0x848a('0x54')]+'%'};return _0x43447a;}})});}_0x184a14=_['merge']({},_0x184a14,_0x13a8b4['options']);var _0x32171a={'where':_0x184a14[_0x848a('0x52')]};return db[_0x848a('0x43')][_0x848a('0x2f')](_0x32171a)['then'](function(_0x1609ae){_0x1094ab[_0x848a('0x2f')]=_0x1609ae;if(_0x13a8b4[_0x848a('0x49')][_0x848a('0x57')]){_0x184a14[_0x848a('0x58')]=[{'all':!![]}];}return db[_0x848a('0x43')][_0x848a('0x59')](_0x184a14);})[_0x848a('0x20')](function(_0x2d7404){_0x1094ab[_0x848a('0x5a')]=_0x2d7404;return _0x1094ab;})[_0x848a('0x20')](respondWithFilteredResult(_0x5a8870,_0x184a14))[_0x848a('0x2b')](handleError(_0x5a8870,null));};exports['show']=function(_0x3fa8d1,_0x21f67c){var _0x257ecd={'raw':![],'where':{'id':_0x3fa8d1[_0x848a('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x848a('0x41')}]},_0x59a330={};_0x59a330[_0x848a('0x48')]=_[_0x848a('0x4a')](db['ChatWebsite'][_0x848a('0x44')]);_0x59a330['query']=_[_0x848a('0x4a')](_0x3fa8d1[_0x848a('0x49')]);_0x59a330['filters']=_['intersection'](_0x59a330['model'],_0x59a330[_0x848a('0x49')]);_0x257ecd[_0x848a('0x4c')]=_[_0x848a('0x5c')](_0x59a330[_0x848a('0x48')],qs['fields'](_0x3fa8d1[_0x848a('0x49')][_0x848a('0x4d')]));_0x257ecd[_0x848a('0x4c')]=_0x257ecd[_0x848a('0x4c')][_0x848a('0x5d')]?_0x257ecd['attributes']:_0x59a330['model'];if(_0x3fa8d1[_0x848a('0x49')][_0x848a('0x57')]){_0x257ecd[_0x848a('0x58')]=[{'all':!![]}];}_0x257ecd=_['merge']({},_0x257ecd,_0x3fa8d1[_0x848a('0x5e')]);return db[_0x848a('0x43')][_0x848a('0x5f')](_0x257ecd)[_0x848a('0x20')](handleEntityNotFound(_0x21f67c,null))[_0x848a('0x20')](respondWithResult(_0x21f67c,null))[_0x848a('0x2b')](handleError(_0x21f67c,null));};exports[_0x848a('0x60')]=function(_0x563c38,_0x28bf70){return db['ChatWebsite'][_0x848a('0x60')](_0x563c38[_0x848a('0x61')],{})[_0x848a('0x20')](function(_0x3bce61){var _0x5cd9af=_0x563c38[_0x848a('0x62')][_0x848a('0x39')]({'plain':!![]});if(!_0x5cd9af)throw new Error(_0x848a('0x63'));if(_0x5cd9af[_0x848a('0x64')]==='user'){var _0x430f81=_0x3bce61[_0x848a('0x39')]({'plain':!![]});var _0x438692='ChatWebsites';return db[_0x848a('0x65')][_0x848a('0x5f')]({'where':{'name':_0x438692,'userProfileId':_0x5cd9af[_0x848a('0x66')]},'raw':!![]})['then'](function(_0x1c6ad6){if(_0x1c6ad6&&_0x1c6ad6[_0x848a('0x67')]===0x0){return db[_0x848a('0x3b')][_0x848a('0x60')]({'name':_0x430f81['name'],'resourceId':_0x430f81['id'],'type':_0x1c6ad6[_0x848a('0x3d')],'sectionId':_0x1c6ad6['id']},{})[_0x848a('0x20')](function(){return _0x3bce61;});}else{return _0x3bce61;}})[_0x848a('0x2b')](function(_0x3389ec){logger['error'](_0x848a('0x68'),_0x3389ec);throw _0x3389ec;});}return _0x3bce61;})[_0x848a('0x20')](respondWithResult(_0x28bf70,0xc9))[_0x848a('0x2b')](handleError(_0x28bf70,null));};exports[_0x848a('0x37')]=function(_0x1280f1,_0x814745){if(_0x1280f1[_0x848a('0x61')]['id']){delete _0x1280f1[_0x848a('0x61')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1280f1['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x814745,null))[_0x848a('0x20')](saveUpdates(_0x1280f1['body'],null))[_0x848a('0x20')](respondWithResult(_0x814745,null))[_0x848a('0x2b')](handleError(_0x814745,null));};exports[_0x848a('0x38')]=function(_0x5a98e5,_0x46b4e6){return db[_0x848a('0x43')][_0x848a('0x5f')]({'where':{'id':_0x5a98e5[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x46b4e6,null))['then'](removeEntity(_0x46b4e6,null))[_0x848a('0x2b')](handleError(_0x46b4e6,null));};exports['describe']=function(_0x17c9b9,_0x125de5){return db[_0x848a('0x43')][_0x848a('0x69')]()[_0x848a('0x20')](respondWithResult(_0x125de5,null))[_0x848a('0x2b')](handleError(_0x125de5,null));};exports[_0x848a('0x6a')]=function(_0x202d7d,_0xf2eec3,_0x32728a){if(_0x202d7d['body']['id']){delete _0x202d7d['body']['id'];}return db[_0x848a('0x43')][_0x848a('0x5f')]({'where':{'id':_0x202d7d[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0xf2eec3,null))[_0x848a('0x20')](function(_0x2616e7){if(_0x2616e7){_0x202d7d['body']['ChatWebsiteId']=_0x2616e7['id'];return db[_0x848a('0x6b')][_0x848a('0x60')](_0x202d7d[_0x848a('0x61')]);}})[_0x848a('0x20')](respondWithResult(_0xf2eec3,null))[_0x848a('0x2b')](handleError(_0xf2eec3,null));};exports[_0x848a('0x6c')]=function(_0x2cb0bd,_0x4c9dc6,_0x3c45eb){var _0x4a329a={'raw':![],'where':{}};var _0x169627={};var _0x2d8999={'count':0x0,'rows':[]};return db[_0x848a('0x43')][_0x848a('0x6d')]({'where':{'id':_0x2cb0bd['params']['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x4c9dc6,null))['then'](function(_0x444c43){if(_0x444c43){_0x169627[_0x848a('0x48')]=_[_0x848a('0x4a')](db[_0x848a('0x6b')][_0x848a('0x44')]);_0x169627[_0x848a('0x49')]=_[_0x848a('0x4a')](_0x2cb0bd['query']);_0x169627[_0x848a('0x4b')]=_[_0x848a('0x5c')](_0x169627[_0x848a('0x48')],_0x169627[_0x848a('0x49')]);_0x4a329a['attributes']=_[_0x848a('0x5c')](_0x169627['model'],qs[_0x848a('0x4d')](_0x2cb0bd['query'][_0x848a('0x4d')]));_0x4a329a['attributes']=_0x4a329a[_0x848a('0x4c')][_0x848a('0x5d')]?_0x4a329a['attributes']:_0x169627[_0x848a('0x48')];if(!_0x2cb0bd[_0x848a('0x49')][_0x848a('0x4e')](_0x848a('0x4f'))){_0x4a329a[_0x848a('0x31')]=qs['limit'](_0x2cb0bd[_0x848a('0x49')]['limit']);_0x4a329a[_0x848a('0x30')]=qs[_0x848a('0x30')](_0x2cb0bd[_0x848a('0x49')]['offset']);}_0x4a329a[_0x848a('0x50')]=qs[_0x848a('0x51')](_0x2cb0bd['query'][_0x848a('0x51')]);_0x4a329a[_0x848a('0x52')]=qs[_0x848a('0x4b')](_['pick'](_0x2cb0bd[_0x848a('0x49')],_0x169627['filters']));_0x4a329a[_0x848a('0x52')]['ChatWebsiteId']=_0x444c43['id'];if(_0x2cb0bd[_0x848a('0x49')][_0x848a('0x54')]){_0x4a329a[_0x848a('0x52')]=_['merge'](_0x4a329a[_0x848a('0x52')],{'$or':_[_0x848a('0x42')](_0x4a329a[_0x848a('0x4c')],function(_0x113bae){var _0x2fbe67={};_0x2fbe67[_0x113bae]={'$like':'%'+_0x2cb0bd[_0x848a('0x49')]['filter']+'%'};return _0x2fbe67;})});}_0x4a329a=_[_0x848a('0x55')]({},_0x4a329a,_0x2cb0bd[_0x848a('0x5e')]);return db[_0x848a('0x6b')][_0x848a('0x2f')]({'where':_0x4a329a[_0x848a('0x52')]})[_0x848a('0x20')](function(_0x86ace9){_0x2d8999[_0x848a('0x2f')]=_0x86ace9;if(_0x2cb0bd[_0x848a('0x49')][_0x848a('0x57')]){_0x4a329a[_0x848a('0x58')]=[{'all':!![]}];}return db[_0x848a('0x6b')]['findAll'](_0x4a329a);})[_0x848a('0x20')](function(_0x5a9407){_0x2d8999[_0x848a('0x5a')]=_0x5a9407;return _0x2d8999;});}})['then'](respondWithFilteredResult(_0x4c9dc6,_0x4a329a))[_0x848a('0x2b')](handleError(_0x4c9dc6,null));};exports['removeDispositions']=function(_0x5d26e7,_0x4f8382,_0x401cf5){return db[_0x848a('0x43')]['find']({'where':{'id':_0x5d26e7[_0x848a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4f8382,null))[_0x848a('0x20')](function(_0x450dd8){if(_0x450dd8){return _0x450dd8[_0x848a('0x6e')](_0x5d26e7['query'][_0x848a('0x6f')]);}})[_0x848a('0x20')](respondWithStatusCode(_0x4f8382,null))[_0x848a('0x2b')](handleError(_0x4f8382,null));};exports[_0x848a('0x70')]=function(_0x413966,_0x53028d,_0x297b73){if(_0x413966[_0x848a('0x61')]['id']){delete _0x413966[_0x848a('0x61')]['id'];}return db[_0x848a('0x43')][_0x848a('0x5f')]({'where':{'id':_0x413966[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x53028d,null))['then'](function(_0x1fbebd){if(_0x1fbebd){_0x413966['body'][_0x848a('0x71')]=_0x1fbebd['id'];return db[_0x848a('0x72')][_0x848a('0x60')](_0x413966[_0x848a('0x61')]);}})[_0x848a('0x20')](respondWithResult(_0x53028d,null))[_0x848a('0x2b')](handleError(_0x53028d,null));};exports[_0x848a('0x73')]=function(_0x42d8a3,_0x304dd5,_0x472af5){var _0x379c76={'raw':![],'where':{}};var _0x4d6fb2={};var _0x55f5ee={'count':0x0,'rows':[]};return db[_0x848a('0x43')]['findOne']({'where':{'id':_0x42d8a3['params']['id']}})['then'](handleEntityNotFound(_0x304dd5,null))[_0x848a('0x20')](function(_0x4d3d4b){if(_0x4d3d4b){_0x4d6fb2['model']=_[_0x848a('0x4a')](db[_0x848a('0x72')]['rawAttributes']);_0x4d6fb2['query']=_[_0x848a('0x4a')](_0x42d8a3[_0x848a('0x49')]);_0x4d6fb2['filters']=_[_0x848a('0x5c')](_0x4d6fb2[_0x848a('0x48')],_0x4d6fb2[_0x848a('0x49')]);_0x379c76[_0x848a('0x4c')]=_[_0x848a('0x5c')](_0x4d6fb2[_0x848a('0x48')],qs[_0x848a('0x4d')](_0x42d8a3['query'][_0x848a('0x4d')]));_0x379c76[_0x848a('0x4c')]=_0x379c76[_0x848a('0x4c')]['length']?_0x379c76['attributes']:_0x4d6fb2['model'];if(!_0x42d8a3[_0x848a('0x49')]['hasOwnProperty'](_0x848a('0x4f'))){_0x379c76[_0x848a('0x31')]=qs[_0x848a('0x31')](_0x42d8a3[_0x848a('0x49')][_0x848a('0x31')]);_0x379c76['offset']=qs['offset'](_0x42d8a3[_0x848a('0x49')][_0x848a('0x30')]);}_0x379c76['order']=qs['sort'](_0x42d8a3['query']['sort']);_0x379c76[_0x848a('0x52')]=qs[_0x848a('0x4b')](_[_0x848a('0x53')](_0x42d8a3[_0x848a('0x49')],_0x4d6fb2[_0x848a('0x4b')]));_0x379c76[_0x848a('0x52')][_0x848a('0x71')]=_0x4d3d4b['id'];if(_0x42d8a3[_0x848a('0x49')][_0x848a('0x54')]){_0x379c76[_0x848a('0x52')]=_[_0x848a('0x55')](_0x379c76[_0x848a('0x52')],{'$or':_[_0x848a('0x42')](_0x379c76['attributes'],function(_0x1c5bd1){var _0xc9cc12={};_0xc9cc12[_0x1c5bd1]={'$like':'%'+_0x42d8a3[_0x848a('0x49')][_0x848a('0x54')]+'%'};return _0xc9cc12;})});}_0x379c76=_[_0x848a('0x55')]({},_0x379c76,_0x42d8a3[_0x848a('0x5e')]);return db[_0x848a('0x72')][_0x848a('0x2f')]({'where':_0x379c76[_0x848a('0x52')]})[_0x848a('0x20')](function(_0x26a339){_0x55f5ee[_0x848a('0x2f')]=_0x26a339;if(_0x42d8a3[_0x848a('0x49')]['includeAll']){_0x379c76[_0x848a('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x848a('0x59')](_0x379c76);})[_0x848a('0x20')](function(_0x372e82){_0x55f5ee[_0x848a('0x5a')]=_0x372e82;return _0x55f5ee;});}})[_0x848a('0x20')](respondWithFilteredResult(_0x304dd5,_0x379c76))['catch'](handleError(_0x304dd5,null));};exports[_0x848a('0x74')]=function(_0x5d3ba2,_0x55bdb9,_0x5ec45d){return db[_0x848a('0x43')]['find']({'where':{'id':_0x5d3ba2[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x55bdb9,null))[_0x848a('0x20')](function(_0x449378){if(_0x449378){return _0x449378['removeAnswers'](_0x5d3ba2[_0x848a('0x49')]['ids']);}})[_0x848a('0x20')](respondWithStatusCode(_0x55bdb9,null))['catch'](handleError(_0x55bdb9,null));};exports[_0x848a('0x75')]=function(_0x1143fb,_0x3dc3b3,_0x3323cd){_0x1143fb['body'][_0x848a('0x76')]=_0x1143fb[_0x848a('0x77')][_0x848a('0x78')];return db[_0x848a('0x43')]['find']({'where':{'id':_0x1143fb[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x3dc3b3,null))['then'](saveUpdates(_0x1143fb[_0x848a('0x61')],null))[_0x848a('0x20')](respondWithResult(_0x3dc3b3,null))[_0x848a('0x2b')](handleError(_0x3dc3b3,null));};exports['addAvatar']=function(_0x2b1156,_0x24d93e,_0x4d0d73){_0x2b1156[_0x848a('0x61')][_0x848a('0x79')]=_0x2b1156['file'][_0x848a('0x78')];return db[_0x848a('0x43')][_0x848a('0x5f')]({'where':{'id':_0x2b1156[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x24d93e,null))[_0x848a('0x20')](saveUpdates(_0x2b1156[_0x848a('0x61')],null))[_0x848a('0x20')](respondWithResult(_0x24d93e,null))[_0x848a('0x2b')](handleError(_0x24d93e,null));};exports[_0x848a('0x7a')]=function(_0x35146f,_0x617834,_0x49520c){_0x35146f[_0x848a('0x61')][_0x848a('0x7b')]=_0x35146f[_0x848a('0x77')][_0x848a('0x78')];return db[_0x848a('0x43')][_0x848a('0x5f')]({'where':{'id':_0x35146f[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x617834,null))[_0x848a('0x20')](saveUpdates(_0x35146f[_0x848a('0x61')],null))[_0x848a('0x20')](respondWithResult(_0x617834,null))['catch'](handleError(_0x617834,null));};exports[_0x848a('0x7c')]=function(_0x409c16,_0x12b703,_0x44632e){_0x409c16['body'][_0x848a('0x7d')]=_0x409c16[_0x848a('0x77')][_0x848a('0x78')];return db[_0x848a('0x43')]['find']({'where':{'id':_0x409c16[_0x848a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x12b703,null))['then'](saveUpdates(_0x409c16[_0x848a('0x61')],null))[_0x848a('0x20')](respondWithResult(_0x12b703,null))[_0x848a('0x2b')](handleError(_0x12b703,null));};exports[_0x848a('0x7e')]=function(_0x19d869,_0x9fed4e,_0x4081d2){var _0xc46199=path[_0x848a('0x7f')](config['root'],_0x848a('0x80'));var _0x3bc391={'where':{'id':_0x19d869[_0x848a('0x5b')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x700a65=![];return require(_0x848a('0x81'))['getLicense']()['then'](function(_0x58c486){if(_0x58c486){_0x700a65=_0x58c486[_0x848a('0x82')];}})[_0x848a('0x20')](function(){return db[_0x848a('0x43')][_0x848a('0x5f')](_0x3bc391);})['then'](handleEntityNotFound(_0x9fed4e,null))[_0x848a('0x20')](function(_0x3a02af){if(_0x3a02af){if(!_[_0x848a('0x83')](_0x3a02af[_0x848a('0x76')])){if(fs['existsSync'](path['join'](config[_0x848a('0x84')],'server/files/images/logos/',_0x3a02af['sitepic']))&&_0x700a65){_0xc46199=path['join'](config[_0x848a('0x84')],_0x848a('0x85'),_0x3a02af[_0x848a('0x76')]);}}return _0x9fed4e[_0x848a('0x86')](_0xc46199);}})[_0x848a('0x2b')](handleError(_0x9fed4e,null));};exports[_0x848a('0x87')]=function(_0x16a48b,_0x300961,_0x52e735){var _0xe0beac=path['join'](config['root'],_0x848a('0x88'));var _0x33b51b={'where':{'id':_0x16a48b[_0x848a('0x5b')]['id']},'attributes':['id',_0x848a('0x79')],'raw':!![]};return db[_0x848a('0x43')][_0x848a('0x5f')](_0x33b51b)[_0x848a('0x20')](handleEntityNotFound(_0x300961,null))[_0x848a('0x20')](function(_0xacc7da){if(_0xacc7da){if(!_[_0x848a('0x83')](_0xacc7da['agentAvatar'])){if(fs[_0x848a('0x89')](path['join'](config['root'],_0x848a('0x8a'),_0xacc7da[_0x848a('0x79')]))){_0xe0beac=path[_0x848a('0x7f')](config[_0x848a('0x84')],_0x848a('0x8a'),_0xacc7da['agentAvatar']);}}return _0x300961[_0x848a('0x86')](_0xe0beac);}})[_0x848a('0x2b')](handleError(_0x300961,null));};exports['getCustomerAvatar']=function(_0x282867,_0x581c68,_0x31fff2){var _0x1e166d=path['join'](config[_0x848a('0x84')],'server/files/images/avatars/customer_avatar.png');var _0x14f4e5={'where':{'id':_0x282867['params']['id']},'attributes':['id',_0x848a('0x7b'),'showCustomerAvatar'],'raw':!![]};return db[_0x848a('0x43')][_0x848a('0x5f')](_0x14f4e5)[_0x848a('0x20')](handleEntityNotFound(_0x581c68,null))[_0x848a('0x20')](function(_0x236a81){if(_0x236a81){if(!_[_0x848a('0x83')](_0x236a81[_0x848a('0x7b')])){if(fs[_0x848a('0x89')](path[_0x848a('0x7f')](config[_0x848a('0x84')],_0x848a('0x8a'),_0x236a81[_0x848a('0x7b')]))&&_0x236a81[_0x848a('0x8b')]){_0x1e166d=path[_0x848a('0x7f')](config['root'],_0x848a('0x8a'),_0x236a81[_0x848a('0x7b')]);}}return _0x581c68[_0x848a('0x86')](_0x1e166d);}})[_0x848a('0x2b')](handleError(_0x581c68,null));};exports[_0x848a('0x8c')]=function(_0x27b352,_0x3404dd,_0x52f0ee){var _0x5e6550=path[_0x848a('0x7f')](config[_0x848a('0x84')],_0x848a('0x8d'));var _0x182146={'where':{'id':_0x27b352['params']['id']},'attributes':['id',_0x848a('0x7d')],'raw':!![]};return db[_0x848a('0x43')][_0x848a('0x5f')](_0x182146)['then'](handleEntityNotFound(_0x3404dd,null))[_0x848a('0x20')](function(_0x4e06bf){if(_0x4e06bf){if(!_[_0x848a('0x83')](_0x4e06bf[_0x848a('0x7d')])){if(fs[_0x848a('0x89')](path[_0x848a('0x7f')](config[_0x848a('0x84')],_0x848a('0x8a'),_0x4e06bf[_0x848a('0x7d')]))){_0x5e6550=path[_0x848a('0x7f')](config[_0x848a('0x84')],_0x848a('0x8a'),_0x4e06bf['systemAvatar']);}}return _0x3404dd[_0x848a('0x86')](_0x5e6550);}})[_0x848a('0x2b')](handleError(_0x3404dd,null));};exports[_0x848a('0x8e')]=function(_0x391f87,_0x2aa04b,_0x4c1297){var _0x523e6b=require(_0x848a('0x8f'));var _0x4a3388=new _0x523e6b();var _0xd3dccb=_0x4a3388[_0x848a('0x90')](_0x391f87['headers']['user-agent'])[_0x848a('0x91')]();var _0x1c9498={'body':_0x391f87[_0x848a('0x61')],'channel':_0x848a('0x92')};var _0x4310e5=[];var _0x2fc062=[];var _0x458ce4={};var _0x5ed50f=![];return db[_0x848a('0x93')][_0x848a('0x69')]()[_0x848a('0x20')](function(_0x221bcb){if(!_0x221bcb){throw new db[(_0x848a('0x1d'))][(_0x848a('0x1e'))](_0x848a('0x94'));}_0x4310e5=_[_0x848a('0x95')](_[_0x848a('0x4a')](_0x221bcb),[_0x848a('0x96'),'updatedAt']);_0x2fc062=_[_0x848a('0x95')](_[_0x848a('0x4a')](_0x221bcb),[_0x848a('0x96'),_0x848a('0x97'),_0x848a('0x98'),_0x848a('0x99')]);if(_0x391f87[_0x848a('0x61')]['id']){delete _0x391f87[_0x848a('0x61')]['id'];}if(_[_0x848a('0x83')](_0x391f87[_0x848a('0x61')][_0x848a('0x9a')])){throw new db['Sequelize'][(_0x848a('0x1e'))](_0x848a('0x9b'));}if(_[_0x848a('0x83')](_0x391f87[_0x848a('0x61')][_0x848a('0x61')])||_0x391f87[_0x848a('0x61')]['body']===''){throw new db[(_0x848a('0x1d'))][(_0x848a('0x1e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x848a('0x83')](_0x391f87['body'][_0x848a('0x9c')])){throw new db[(_0x848a('0x1d'))][(_0x848a('0x1e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2fc062);}if(!_['includes'](_0x2fc062,_0x391f87[_0x848a('0x61')][_0x848a('0x9c')])){throw new db[(_0x848a('0x1d'))][(_0x848a('0x1e'))](_0x848a('0x9d')+_0x2fc062);}_0x458ce4[_0x391f87[_0x848a('0x61')][_0x848a('0x9c')]]=_0x391f87[_0x848a('0x61')][_0x848a('0x9a')];})[_0x848a('0x20')](function(){return db[_0x848a('0x43')][_0x848a('0x5f')]({'where':{'id':_0x391f87['params']['id']},'include':[{'model':db[_0x848a('0x9e')],'as':'List','include':[{'model':db[_0x848a('0x93')],'as':'Contacts','where':_0x458ce4,'limit':0x1,'order':[[_0x848a('0x97'),_0x848a('0x9f')]]}]},{'model':db[_0x848a('0xa0')],'as':_0x848a('0xa1')}]});})[_0x848a('0x20')](handleEntityNotFound(_0x2aa04b,null))[_0x848a('0x20')](function(_0x17144e){if(_0x17144e&&_0x17144e[_0x848a('0xa2')]){_0x1c9498[_0x848a('0xa3')]=_0x17144e;_0x1c9498[_0x848a('0xa4')]=_0x17144e[_0x848a('0xa1')];_0x1c9498[_0x848a('0xa5')]=_0x17144e[_0x848a('0xa2')];_0x1c9498[_0x848a('0xa4')]=_[_0x848a('0xa6')](_0x1c9498[_0x848a('0xa4')],[_0x848a('0xa7')],['asc']);if(_0x1c9498[_0x848a('0xa3')]['Applications']){delete _0x1c9498[_0x848a('0xa3')]['Applications'];}if(_0x1c9498['account']['List']&&_0x1c9498[_0x848a('0xa3')]['List']['Contacts'][_0x848a('0x5d')]){return _0x1c9498[_0x848a('0xa3')]['List'][_0x848a('0xa8')][0x0];}var _0x4d5e0a=_[_0x848a('0x16')](_0x391f87[_0x848a('0x61')],{'firstName':_0x391f87[_0x848a('0x61')][_0x848a('0x9a')],'ListId':_0x17144e[_0x848a('0x99')]});_0x4d5e0a[_0x391f87['body'][_0x848a('0x9c')]]=_0x391f87[_0x848a('0x61')]['from'];return db[_0x848a('0x93')][_0x848a('0x60')](_0x4d5e0a,{'fields':_0x4310e5,'raw':!![]});}})[_0x848a('0x20')](handleEntityNotFound(_0x2aa04b,null))[_0x848a('0x20')](function(_0x838936){_0x1c9498[_0x848a('0xa9')]=_0x838936;var _0x18422a=_0x391f87[_0x848a('0x61')][_0x848a('0xaa')];if(_0x391f87[_0x848a('0xab')][_0x848a('0xac')]){_0x18422a=_0x391f87[_0x848a('0xab')]['cf-connecting-ip'];}else if(_0x391f87[_0x848a('0xab')][_0x848a('0xad')]){_0x18422a=_[_0x848a('0xae')](_0x391f87[_0x848a('0xab')][_0x848a('0xad')][_0x848a('0xaf')](','));}if(_0x838936){var _0x2adbb2={'ContactId':_0x838936['id'],'ChatWebsiteId':_0x391f87[_0x848a('0x5b')]['id'],'from':(_0x838936[_0x848a('0xb0')]||'')+'\x20'+(_0x838936['lastName']||''),'customerIp':_0x18422a,'customerPort':_0x391f87[_0x848a('0xab')][_0x848a('0xb1')]?_0x391f87[_0x848a('0xab')]['x-real-port']:null,'referer':_0x391f87[_0x848a('0x61')]['referer'],'browserName':_0xd3dccb[_0x848a('0xb2')][_0x848a('0x3d')]&&_0xd3dccb[_0x848a('0xb2')]['version']?util['format'](_0x848a('0xb3'),_0xd3dccb[_0x848a('0xb2')][_0x848a('0x3d')],_0xd3dccb[_0x848a('0xb2')][_0x848a('0xb4')]):_0x848a('0xb5'),'browserVersion':_0xd3dccb['browser'][_0x848a('0xb4')]||_0x848a('0xb5'),'osName':util['format'](_0x848a('0xb3'),_0xd3dccb['os'][_0x848a('0x3d')],_0xd3dccb['os'][_0x848a('0xb4')]),'osVersion':_0xd3dccb['os']['version'],'deviceModel':_0xd3dccb[_0x848a('0xb6')]['model']&&_0xd3dccb[_0x848a('0xb6')]['vendor']?util[_0x848a('0xb7')](_0x848a('0xb8'),_0xd3dccb[_0x848a('0xb6')][_0x848a('0x48')],_0xd3dccb[_0x848a('0xb6')][_0x848a('0xb9')],_0xd3dccb[_0x848a('0xb6')][_0x848a('0x46')]):null,'deviceVendor':_0xd3dccb['device'][_0x848a('0xb9')],'deviceType':_0xd3dccb['device']['type'],'formData':JSON[_0x848a('0x26')](_0x391f87[_0x848a('0x61')])};var _0x4e4573={'ChatWebsiteId':_0x391f87['params']['id'],'closed':![]};if(_0x391f87[_0x848a('0x61')][_0x848a('0xba')]){_0x4e4573['threadId']=_0x391f87[_0x848a('0x61')][_0x848a('0xba')];return db['ChatInteraction'][_0x848a('0x5f')]({'where':_0x4e4573})['then'](function(_0x1a6b92){if(_0x1a6b92){return[_0x1a6b92,![]];}_0x2adbb2[_0x848a('0xba')]=_0x391f87[_0x848a('0x61')]['threadId'];_0x2adbb2[_0x848a('0xbb')]=_0x391f87['body'][_0x848a('0xbb')];return db[_0x848a('0xbc')]['create'](_0x2adbb2)[_0x848a('0x20')](function(_0x105b5b){return[_0x105b5b,!![]];});});}_0x4e4573[_0x848a('0xbd')]=_0x838936['id'];if(_0x391f87[_0x848a('0x61')]['interaction']&&_0x391f87['body'][_0x848a('0xbe')]['id']){_0x4e4573['id']=_0x391f87[_0x848a('0x61')]['interaction']['id'];return db[_0x848a('0xbc')][_0x848a('0x5f')]({'where':_0x4e4573})[_0x848a('0x20')](function(_0x1e12b7){if(_0x1e12b7){return[_0x1e12b7,![]];}return db['ChatInteraction']['create'](_0x2adbb2)[_0x848a('0x20')](function(_0x951b23){return[_0x951b23,!![]];});});}return db['ChatInteraction'][_0x848a('0x60')](_0x2adbb2)[_0x848a('0x20')](function(_0x35b740){return[_0x35b740,!![]];});}})[_0x848a('0xbf')](function(_0x2ed0b3,_0x8cc133){if(_0x2ed0b3){_0x5ed50f=_0x8cc133;if(!_0x8cc133){var _0x265bf6={'from':(_0x1c9498[_0x848a('0xa9')]['firstName']||'')+'\x20'+(_0x1c9498[_0x848a('0xa9')][_0x848a('0xc0')]||'')};if(_0x391f87['body'][_0x848a('0xba')]&&_0x391f87[_0x848a('0x61')][_0x848a('0xc1')]&&_0x391f87[_0x848a('0x61')][_0x848a('0xba')]!=_0x391f87[_0x848a('0x61')][_0x848a('0xc1')]){_0x265bf6[_0x848a('0xba')]=_0x391f87[_0x848a('0x61')][_0x848a('0xc1')];}return _0x2ed0b3[_0x848a('0x37')](_0x265bf6);}else{return _0x2ed0b3;}}})[_0x848a('0x20')](function(_0x269e29){_0x1c9498['interaction']=_0x269e29[_0x848a('0x39')]({'plain':!![]});_0x1c9498[_0x848a('0xbe')][_0x848a('0xc2')]=_0x5ed50f;if(_0x1c9498[_0x848a('0xbe')][_0x848a('0xc2')]){if(_0x1c9498['account'][_0x848a('0xc3')]){_0x1c9498['applications'][_0x848a('0xc4')]({'id':0x0,'priority':_0x1c9498['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x848a('0xc5')]['create']({'body':_0x391f87['body'][_0x848a('0x61')],'ChatWebsiteId':_0x391f87[_0x848a('0x5b')]['id'],'ChatInteractionId':_0x269e29['id'],'direction':'in','ContactId':_0x1c9498[_0x848a('0xa9')]['id'],'AttachmentId':_0x391f87[_0x848a('0x61')]['AttachmentId']});})[_0x848a('0x20')](function(_0xf98d49){_0x1c9498[_0x848a('0x29')]=_0xf98d49;if(_0x1c9498[_0x848a('0xbe')][_0x848a('0xc6')]){return db[_0x848a('0xc7')][_0x848a('0x5f')]({'attributes':['id','name'],'where':{'id':_0x1c9498['interaction']['UserId']}})[_0x848a('0x20')](function(_0x4c7a76){if(_0x4c7a76){_0x1c9498[_0x848a('0xa4')][_0x848a('0xc8')]({'id':0x0,'priority':0x0,'app':_0x848a('0xc9'),'appdata':_0x4c7a76['name']+','+(_0x1c9498[_0x848a('0xa3')][_0x848a('0xca')]||0xa),'interval':'*,*,*,*'});_0x1c9498['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x848a('0xcb'),_0x1c9498);});}return respondWithRpcPromise(_0x848a('0xcc'),_0x848a('0xcb'),_0x1c9498);})['then'](function(_0x50fe09){respondWithRpcPromise(_0x848a('0xcd'),_0x848a('0xcd'),{'event':'notify','message':_0x50fe09},client9002);return _0x50fe09;})[_0x848a('0x20')](respondWithResult(_0x2aa04b,null))[_0x848a('0x2b')](handleError(_0x2aa04b,null));};exports[_0x848a('0xce')]=function(_0x19afcf,_0x10f5f0,_0x4e23f9){var _0x599228,_0x45079b,_0x5ee6c8;var _0x316b1f=[];var _0x2b5192=[];var _0x332939={};return db['CmContact'][_0x848a('0x69')]()[_0x848a('0x20')](function(_0x4783b2){if(!_0x4783b2){throw new db[(_0x848a('0x1d'))]['ValidationError'](_0x848a('0x94'));}_0x2b5192=_[_0x848a('0x95')](_[_0x848a('0x4a')](_0x4783b2),[_0x848a('0x96'),_0x848a('0x97')]);_0x316b1f=_[_0x848a('0x95')](_['keys'](_0x4783b2),[_0x848a('0x96'),_0x848a('0x97'),'CompanyId',_0x848a('0x99')]);if(_0x19afcf['body']['id']){delete _0x19afcf[_0x848a('0x61')]['id'];}if(_[_0x848a('0x83')](_0x19afcf[_0x848a('0x61')][_0x848a('0x9a')])){throw _0x10f5f0[_0x848a('0x2d')](0x1f4)[_0x848a('0x3e')](new db[(_0x848a('0x1d'))][(_0x848a('0x1e'))](_0x848a('0x9b')));}if(_['isNil'](_0x19afcf['body'][_0x848a('0x61')])||_0x19afcf[_0x848a('0x61')][_0x848a('0x61')]===''){throw _0x10f5f0[_0x848a('0x2d')](0x1f4)[_0x848a('0x3e')](new db['Sequelize']['ValidationError'](_0x848a('0xcf')));}if(_[_0x848a('0x83')](_0x19afcf['body'][_0x848a('0xd0')])){throw _0x10f5f0[_0x848a('0x2d')](0x1f4)[_0x848a('0x3e')](new db['Sequelize'][(_0x848a('0x1e'))](_0x848a('0xd1')+_0x316b1f));}if(!_[_0x848a('0xd2')](_0x316b1f,_0x19afcf['body'][_0x848a('0xd0')])){throw _0x10f5f0[_0x848a('0x2d')](0x1f4)[_0x848a('0x3e')](new db[(_0x848a('0x1d'))][(_0x848a('0x1e'))](_0x848a('0xd3')+_0x316b1f));}_0x332939[_0x19afcf[_0x848a('0x61')][_0x848a('0xd0')]]=_0x19afcf['body'][_0x848a('0x9a')];})['then'](function(){return db['ChatWebsite'][_0x848a('0x5f')]({'where':{'id':_0x19afcf[_0x848a('0x5b')]['id']},'include':[{'model':db[_0x848a('0x9e')],'as':_0x848a('0xa2')}]});})['then'](handleEntityNotFound(_0x10f5f0,null))[_0x848a('0x20')](function(_0x53a6a4){if(_0x53a6a4&&_0x53a6a4['List']){_0x45079b=_0x53a6a4;var _0x5c03d6=_[_0x848a('0x16')](_0x19afcf[_0x848a('0x61')],{'firstName':_0x19afcf[_0x848a('0x61')][_0x848a('0x9a')],'phone':_0x19afcf[_0x848a('0x61')][_0x848a('0x9a')],'ListId':_0x53a6a4['ListId']});_0x5c03d6[_0x19afcf[_0x848a('0x61')][_0x848a('0xd0')]]=_0x19afcf['body']['from'];return db[_0x848a('0x93')][_0x848a('0xd4')]({'where':_0x332939,'defaults':_0x5c03d6});}})[_0x848a('0xbf')](function(_0x316e78){if(_0x316e78){_0x5ee6c8=_0x316e78;var _0x93600=fs[_0x848a('0xd5')](path['join'](config[_0x848a('0x84')],'server/files/templates/chatOfflineMessage.ejs'),_0x848a('0xd6'));var _0x4a163f=ejs['render'](_0x93600,{'body':_[_0x848a('0xd7')](_0x19afcf[_0x848a('0x61')][_0x848a('0x61')]),'bodyTitle':_0x45079b[_0x848a('0xd8')]});return db[_0x848a('0xd9')][_0x848a('0x60')]({'body':_0x4a163f,'ContactId':_0x316e78['id'],'ChatWebsiteId':_0x45079b['id']});}})[_0x848a('0x20')](function(_0x17e1c5){if(_0x17e1c5){_0x599228=_0x17e1c5;return db[_0x848a('0xda')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x848a('0xdb'),'raw':!![]}]});}})[_0x848a('0x20')](function(_0x485842){if(_0x485842&&_0x485842[_0x848a('0xdb')]&&_0x45079b[_0x848a('0xdc')]){var _0x3454d3={'tls':{'rejectUnauthorized':![]}};if(_0x485842[_0x848a('0xdb')][_0x848a('0xdd')]){_0x3454d3[_0x848a('0xdd')]=_0x485842[_0x848a('0xdb')][_0x848a('0xdd')];}else{_0x3454d3[_0x848a('0xde')]=_0x485842[_0x848a('0xdb')]['host'];_0x3454d3[_0x848a('0xdf')]=_0x485842[_0x848a('0xdb')][_0x848a('0xdf')];_0x3454d3[_0x848a('0xe0')]=_0x485842[_0x848a('0xdb')]['secure'];}if(_0x485842[_0x848a('0xdb')][_0x848a('0xe1')]){_0x3454d3[_0x848a('0xe2')]={'user':_0x485842[_0x848a('0xdb')][_0x848a('0x62')],'pass':_0x485842[_0x848a('0xdb')][_0x848a('0xe3')]};}return respondWithRpcPromise(_0x848a('0xe4'),_0x848a('0xe5'),{'account':_0x3454d3,'message':{'from':util[_0x848a('0xb7')](_0x848a('0xe6'),_0x485842[_0x848a('0x3d')],_0x485842['email']||_0x485842['Smtp']['user']),'to':_0x45079b[_0x848a('0xdc')],'subject':_0x45079b[_0x848a('0xe7')],'text':_0x599228[_0x848a('0x61')]}},client9003)['then'](function(){return _0x599228;})[_0x848a('0x2b')](function(_0x382ef7){console[_0x848a('0x28')](_0x382ef7);});}})[_0x848a('0x20')](function(){if(_0x599228){return _0x599228;}})[_0x848a('0x20')](respondWithResult(_0x10f5f0,null))[_0x848a('0x2b')](handleError(_0x10f5f0,null));};exports[_0x848a('0xe8')]=function(_0x2f4348,_0xea72dd,_0x227216){return db[_0x848a('0xbc')][_0x848a('0x5f')]({'where':{'id':_0x2f4348['params']['id']}})[_0x848a('0x20')](handleEntityNotFound(_0xea72dd,null))[_0x848a('0x20')](function(_0x469f4d){if(_0x469f4d){return _0x469f4d[_0x848a('0xe8')](_0x2f4348[_0x848a('0x61')][_0x848a('0x6f')],_['omit'](_0x2f4348[_0x848a('0x61')],[_0x848a('0x6f'),'id'])||{});}})[_0x848a('0x20')](respondWithResult(_0xea72dd,null))[_0x848a('0x2b')](handleError(_0xea72dd,null));};exports[_0x848a('0xe9')]=function(_0x450ea7,_0x2d1aa0,_0x28e8ef){var _0x481b8d={'raw':![],'where':{}};var _0x56f1c4={};var _0x581ca1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x848a('0x6d')]({'where':{'id':_0x450ea7[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x2d1aa0,null))[_0x848a('0x20')](function(_0x5db005){if(_0x5db005){_0x56f1c4['model']=_[_0x848a('0x4a')](db[_0x848a('0xbc')][_0x848a('0x44')]);_0x56f1c4[_0x848a('0x49')]=_[_0x848a('0x4a')](_0x450ea7[_0x848a('0x49')]);_0x56f1c4[_0x848a('0x4b')]=_['intersection'](_0x56f1c4[_0x848a('0x48')],_0x56f1c4[_0x848a('0x49')]);_0x481b8d['attributes']=_['intersection'](_0x56f1c4['model'],qs[_0x848a('0x4d')](_0x450ea7[_0x848a('0x49')][_0x848a('0x4d')]));_0x481b8d[_0x848a('0x4c')]=_0x481b8d['attributes'][_0x848a('0x5d')]?_0x481b8d[_0x848a('0x4c')]:_0x56f1c4[_0x848a('0x48')];if(!_0x450ea7[_0x848a('0x49')][_0x848a('0x4e')](_0x848a('0x4f'))){_0x481b8d[_0x848a('0x31')]=qs[_0x848a('0x31')](_0x450ea7[_0x848a('0x49')][_0x848a('0x31')]);_0x481b8d[_0x848a('0x30')]=qs[_0x848a('0x30')](_0x450ea7['query'][_0x848a('0x30')]);}_0x481b8d[_0x848a('0x50')]=qs[_0x848a('0x51')](_0x450ea7['query']['sort']);_0x481b8d[_0x848a('0x52')]=qs['filters'](_[_0x848a('0x53')](_0x450ea7[_0x848a('0x49')],_0x56f1c4['filters']));_0x481b8d[_0x848a('0x52')]['ChatWebsiteId']=_0x5db005['id'];if(_0x450ea7[_0x848a('0x49')][_0x848a('0x54')]){_0x481b8d[_0x848a('0x52')]=_[_0x848a('0x55')](_0x481b8d[_0x848a('0x52')],{'$or':_[_0x848a('0x42')](_0x481b8d[_0x848a('0x4c')],function(_0x1ba450){var _0xa04a04={};_0xa04a04[_0x1ba450]={'$like':'%'+_0x450ea7[_0x848a('0x49')][_0x848a('0x54')]+'%'};return _0xa04a04;})});}_0x481b8d=_[_0x848a('0x55')]({},_0x481b8d,_0x450ea7[_0x848a('0x5e')]);return db['ChatInteraction'][_0x848a('0x2f')]({'where':_0x481b8d[_0x848a('0x52')]})[_0x848a('0x20')](function(_0x406757){_0x581ca1[_0x848a('0x2f')]=_0x406757;if(_0x450ea7[_0x848a('0x49')][_0x848a('0x57')]){_0x481b8d[_0x848a('0x58')]=[{'model':db[_0x848a('0x93')],'as':_0x848a('0xea'),'required':![]},{'model':db[_0x848a('0xc7')],'as':_0x848a('0xeb'),'attributes':[_0x848a('0x3d'),_0x848a('0xec'),_0x848a('0xed')],'required':![]},{'model':db[_0x848a('0xee')],'as':_0x848a('0xef'),'attributes':['id',_0x848a('0x3d'),'color'],'where':_0x450ea7[_0x848a('0x49')]['tag']?{'id':_0x450ea7['query'][_0x848a('0xf0')]}:undefined,'required':_0x450ea7[_0x848a('0x49')][_0x848a('0xf0')]?!![]:![]}];}return db[_0x848a('0xbc')][_0x848a('0x59')](_0x481b8d);})[_0x848a('0x20')](function(_0x780b34){_0x581ca1[_0x848a('0x5a')]=_0x780b34;return _0x581ca1;});}})[_0x848a('0x20')](respondWithFilteredResult(_0x2d1aa0,_0x481b8d))['catch'](handleError(_0x2d1aa0,null));};function iftimePromise(_0x7253a5,_0x1ac8b4){return respondWithRpcPromise(_0x848a('0xf1'),_0x848a('0xf2'),{'command':_0x1ac8b4[_0x848a('0xf3')]?util['format'](_0x848a('0xf4'),_0x7253a5['interval'],_0x1ac8b4['timezone']):util[_0x848a('0xb7')](_0x848a('0xf5'),_0x7253a5[_0x848a('0xf6')])},client9002)[_0x848a('0x20')](function(_0x434d4d){var _0x5f0d82=_0x434d4d&&_0x434d4d[_0x848a('0xf7')](_0x848a('0xf8'))>=0x0?!![]:![];logger[_0x848a('0x21')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1ac8b4['id'],_0x7253a5['id'],_0x7253a5['interval'],_0x5f0d82?'ONLINE':_0x848a('0xf9'),_0x1ac8b4['timezone']?_0x1ac8b4[_0x848a('0xf3')]:_0x848a('0xfa'));return _0x5f0d82;})[_0x848a('0x2b')](function(_0x1423aa){logger[_0x848a('0x28')](_0x848a('0xfb'),_0x1ac8b4['id'],_0x7253a5['id'],_0x7253a5[_0x848a('0xf6')],util[_0x848a('0xfc')](_0x1423aa,{'showHidden':![],'depth':null}),_0x1ac8b4['timezone']?_0x1ac8b4[_0x848a('0xf3')]:_0x848a('0xfa'));return![];});}exports['getSnippet']=function(_0x589cc3,_0x1335c5,_0x437fe0){var _0x523a6d=0x0;var _0x3aaf69=0x0;var _0x539f80=![];var _0x2a3852;var _0x23654d;return db['ChatWebsite']['find']({'where':{'id':_0x589cc3['params']['id']},'include':[{'model':db['Interval'],'as':_0x848a('0xfd'),'include':[{'model':db[_0x848a('0xfd')],'as':_0x848a('0xfe'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1335c5,null))['then'](function(_0x4b2cbb){if(_0x4b2cbb){_0x2a3852=_0x4b2cbb;return _0x4b2cbb[_0x848a('0xff')]({'raw':!![]});}})[_0x848a('0x20')](function(_0x8413e4){if(_0x2a3852){if(_0x8413e4){_0x23654d=_0x8413e4;}}return require('../../config/license/util')[_0x848a('0x100')]();})[_0x848a('0x20')](function(_0x715259){if(_0x715259){_0x3aaf69=_0x715259[_0x848a('0x101')];_0x539f80=_0x715259[_0x848a('0x82')];}})[_0x848a('0x20')](function(){return db[_0x848a('0xbc')][_0x848a('0x2f')]({'where':{'closed':![]}});})[_0x848a('0x20')](function(_0x6e90c8){_0x523a6d=_0x6e90c8;if(_0x3aaf69&&_0x6e90c8>_0x3aaf69){return db[_0x848a('0x102')][_0x848a('0x6d')]({'where':{'id':0x1}})['then'](function(_0xfcaf72){if(_0xfcaf72){_0xfcaf72[_0x848a('0x103')](_0x848a('0x104'));}});}})[_0x848a('0x20')](function(){if(_0x2a3852[_0x848a('0xfd')]&&_0x2a3852[_0x848a('0xfd')][_0x848a('0xfe')]){var _0x2a1536=[];for(var _0x4529ae=0x0;_0x4529ae<_0x2a3852['Interval'][_0x848a('0xfe')][_0x848a('0x5d')];_0x4529ae++){var _0x4fe58e=_0x2a3852[_0x848a('0xfd')]['Intervals'][_0x4529ae]['get']({'plain':!![]});_0x2a1536[_0x848a('0xc4')](iftimePromise(_0x4fe58e,_0x2a3852));}return BPromise['all'](_0x2a1536)[_0x848a('0x20')](function(_0x3d17ec){return _[_0x848a('0x105')](_0x3d17ec);});}else{return!![];}})['then'](function(_0x3b3b7d){var _0x38f0a3=fs['readFileSync'](path[_0x848a('0x7f')](config[_0x848a('0x84')],_0x848a('0x106')),_0x848a('0xd6'));var _0x484587={'remote':_0x2a3852['remote'],'query':querystring[_0x848a('0x26')](_[_0x848a('0x55')](_0x2a3852[_0x848a('0x39')]({'plain':!![]}),{'customerIp':_0x589cc3[_0x848a('0xab')][_0x848a('0xad')]||_0x589cc3[_0x848a('0xab')][_0x848a('0x107')]||_0x589cc3[_0x848a('0x108')][_0x848a('0x109')]||_0x589cc3['ip'],'referer':_0x589cc3['headers']['referer'],'openedInteractions':_0x523a6d,'maxInteractions':_0x3aaf69,'virtual':_0x539f80[_0x848a('0x101')],'online':_0x3b3b7d,'custom':_0x539f80}))[_0x848a('0x10a')](/'/g,'\x5c\x27')};_0x1335c5[_0x848a('0x3e')](ejs[_0x848a('0x10b')](Mustache[_0x848a('0x10b')](_0x38f0a3,_0x484587),{'proactiveActions':_0x23654d,'alignment':_0x2a3852[_0x848a('0x10c')],'verticalAlignment':_0x2a3852[_0x848a('0x10d')],'div_color':_0x2a3852[_0x848a('0x10e')],'text_color':_0x2a3852[_0x848a('0x10f')]}));})['catch'](handleError(_0x1335c5,null));};exports['addApplications']=function(_0x353c05,_0x587a9b,_0x337d7d){return db['ChatWebsite']['findOne']({'where':{'id':_0x353c05[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x587a9b,null))['then'](function(_0xe8779c){if(_0xe8779c){return db['sequelize']['transaction'](function(_0x1b2629){return db[_0x848a('0xa0')][_0x848a('0x38')]({'where':{'ChatWebsiteId':_0x353c05[_0x848a('0x5b')]['id']},'transaction':_0x1b2629})[_0x848a('0x20')](function(_0x399c47){var _0x27e432=_[_0x848a('0x42')](_0x353c05['body'],function(_0x1561c0){_0x1561c0['ChatWebsiteId']=_0x353c05[_0x848a('0x5b')]['id'];return _0x1561c0;});return db[_0x848a('0xa0')][_0x848a('0x110')](_0x27e432,{'transaction':_0x1b2629});});})[_0x848a('0x20')](function(){return db['ChatApplication'][_0x848a('0x111')]({'where':{'ChatWebsiteId':_0x353c05[_0x848a('0x5b')]['id']},'order':'priority'});});}})[_0x848a('0x20')](respondWithResult(_0x587a9b,null))['catch'](handleError(_0x587a9b,null));};exports[_0x848a('0x112')]=function(_0x25e158,_0x5cf094,_0xd31585){var _0x31e018={};var _0x4cfd5b={};var _0x2bf065;var _0x16ccce;return db[_0x848a('0x43')][_0x848a('0x6d')]({'where':{'id':_0x25e158['params']['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x5cf094,null))['then'](function(_0x5cf356){if(_0x5cf356){_0x2bf065=_0x5cf356;_0x4cfd5b[_0x848a('0x48')]=_[_0x848a('0x4a')](db[_0x848a('0xa0')][_0x848a('0x44')]);_0x4cfd5b[_0x848a('0x49')]=_['keys'](_0x25e158[_0x848a('0x49')]);_0x4cfd5b[_0x848a('0x4b')]=_[_0x848a('0x5c')](_0x4cfd5b['model'],_0x4cfd5b[_0x848a('0x49')]);_0x31e018[_0x848a('0x4c')]=_[_0x848a('0x5c')](_0x4cfd5b[_0x848a('0x48')],qs[_0x848a('0x4d')](_0x25e158[_0x848a('0x49')]['fields']));_0x31e018[_0x848a('0x4c')]=_0x31e018[_0x848a('0x4c')][_0x848a('0x5d')]?_0x31e018[_0x848a('0x4c')]:_0x4cfd5b[_0x848a('0x48')];_0x31e018[_0x848a('0x50')]=qs['sort'](_0x25e158[_0x848a('0x49')][_0x848a('0x51')]);_0x31e018[_0x848a('0x52')]=qs[_0x848a('0x4b')](_[_0x848a('0x53')](_0x25e158[_0x848a('0x49')],_0x4cfd5b[_0x848a('0x4b')]));if(_0x25e158['query'][_0x848a('0x54')]){_0x31e018[_0x848a('0x52')]=_[_0x848a('0x55')](_0x31e018[_0x848a('0x52')],{'$or':_[_0x848a('0x42')](_0x31e018['attributes'],function(_0x73367e){var _0x57b94d={};_0x57b94d[_0x73367e]={'$like':'%'+_0x25e158[_0x848a('0x49')]['filter']+'%'};return _0x57b94d;})});}_0x31e018=_[_0x848a('0x55')]({},_0x31e018,_0x25e158[_0x848a('0x5e')]);return _0x2bf065[_0x848a('0x112')](_0x31e018);}})[_0x848a('0x20')](function(_0x37a495){if(_0x37a495){_0x16ccce=_0x37a495[_0x848a('0x5d')];if(!_0x25e158[_0x848a('0x49')][_0x848a('0x4e')](_0x848a('0x4f'))){_0x31e018['limit']=qs['limit'](_0x25e158['query'][_0x848a('0x31')]);_0x31e018['offset']=qs['offset'](_0x25e158[_0x848a('0x49')][_0x848a('0x30')]);}return _0x2bf065[_0x848a('0x112')](_0x31e018);}})['then'](function(_0x1321f6){if(_0x1321f6){return _0x1321f6?{'count':_0x16ccce,'rows':_0x1321f6}:null;}})[_0x848a('0x20')](respondWithResult(_0x5cf094,null))[_0x848a('0x2b')](handleError(_0x5cf094,null));};exports[_0x848a('0x113')]=function(_0x1c89a7,_0x3b2b2d,_0x4aec47){return db[_0x848a('0x114')]['find']({'where':{'id':_0x1c89a7[_0x848a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b2b2d,null))[_0x848a('0x20')](function(_0x55049e){if(_0x55049e){return _0x55049e['addProactiveActions'](_0x1c89a7['body'][_0x848a('0x6f')],_['omit'](_0x1c89a7[_0x848a('0x61')],[_0x848a('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x3b2b2d,null))[_0x848a('0x2b')](handleError(_0x3b2b2d,null));};exports[_0x848a('0xff')]=function(_0x2cc667,_0x591d58,_0xad8a88){var _0x3245a5={};var _0x48921f={};var _0x3b3e82;var _0x31ccf4;return db[_0x848a('0x43')][_0x848a('0x6d')]({'where':{'id':_0x2cc667['params']['id']}})['then'](handleEntityNotFound(_0x591d58,null))[_0x848a('0x20')](function(_0x10256a){if(_0x10256a){_0x3b3e82=_0x10256a;_0x48921f['model']=_[_0x848a('0x4a')](db[_0x848a('0x115')][_0x848a('0x44')]);_0x48921f['query']=_[_0x848a('0x4a')](_0x2cc667['query']);_0x48921f['filters']=_['intersection'](_0x48921f['model'],_0x48921f[_0x848a('0x49')]);_0x3245a5[_0x848a('0x4c')]=_[_0x848a('0x5c')](_0x48921f['model'],qs[_0x848a('0x4d')](_0x2cc667[_0x848a('0x49')][_0x848a('0x4d')]));_0x3245a5[_0x848a('0x4c')]=_0x3245a5[_0x848a('0x4c')]['length']?_0x3245a5[_0x848a('0x4c')]:_0x48921f[_0x848a('0x48')];_0x3245a5[_0x848a('0x50')]=qs[_0x848a('0x51')](_0x2cc667['query'][_0x848a('0x51')]);_0x3245a5['where']=qs[_0x848a('0x4b')](_[_0x848a('0x53')](_0x2cc667['query'],_0x48921f[_0x848a('0x4b')]));if(_0x2cc667[_0x848a('0x49')]['filter']){_0x3245a5[_0x848a('0x52')]=_[_0x848a('0x55')](_0x3245a5[_0x848a('0x52')],{'$or':_[_0x848a('0x42')](_0x3245a5['attributes'],function(_0x38a9d2){var _0x1ad16c={};_0x1ad16c[_0x38a9d2]={'$like':'%'+_0x2cc667['query'][_0x848a('0x54')]+'%'};return _0x1ad16c;})});}_0x3245a5=_[_0x848a('0x55')]({},_0x3245a5,_0x2cc667[_0x848a('0x5e')]);return _0x3b3e82['getProactiveActions'](_0x3245a5);}})[_0x848a('0x20')](function(_0x134c75){if(_0x134c75){_0x31ccf4=_0x134c75['length'];if(!_0x2cc667[_0x848a('0x49')]['hasOwnProperty'](_0x848a('0x4f'))){_0x3245a5[_0x848a('0x31')]=qs['limit'](_0x2cc667['query'][_0x848a('0x31')]);_0x3245a5['offset']=qs['offset'](_0x2cc667['query'][_0x848a('0x30')]);}return _0x3b3e82[_0x848a('0xff')](_0x3245a5);}})[_0x848a('0x20')](function(_0x221ede){if(_0x221ede){return _0x221ede?{'count':_0x31ccf4,'rows':_0x221ede}:null;}})['then'](respondWithResult(_0x591d58,null))[_0x848a('0x2b')](handleError(_0x591d58,null));};exports[_0x848a('0x116')]=function(_0x570b2c,_0x2b669c,_0x2c2333){var _0x1c8f23=_0x570b2c[_0x848a('0x49')]['online']===_0x848a('0x117')?'offlineForm':'onlineForm';return db[_0x848a('0x43')][_0x848a('0x5f')]({'attributes':['id',_0x1c8f23],'where':{'id':_0x570b2c[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x2b669c,null))[_0x848a('0x20')](function(_0x5bbf6b){if(_0x5bbf6b){var _0x4e2e68=_0x5bbf6b[_0x1c8f23];var _0x11f8ce=_0x4e2e68&&_0x4e2e68[_0x848a('0x118')]?_0x4e2e68[_0x848a('0x118')]:[];_0x2b669c['send']({'fromKey':_[_0x848a('0x83')](_0x4e2e68[_0x848a('0x119')])?undefined:_0x4e2e68['fromKey'],'count':_0x11f8ce['length'],'rows':_0x11f8ce});}})[_0x848a('0x2b')](handleError(_0x2b669c,null));};exports['getOfflineMessages']=function(_0x8fe181,_0x3d585,_0x50273e){var _0x10162a={'raw':![],'where':{}};var _0xa4c276={};var _0xd15803={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x8fe181[_0x848a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3d585,null))['then'](function(_0x57219f){if(_0x57219f){_0xa4c276[_0x848a('0x48')]=_[_0x848a('0x4a')](db['ChatOfflineMessage']['rawAttributes']);_0xa4c276[_0x848a('0x49')]=_['keys'](_0x8fe181[_0x848a('0x49')]);_0xa4c276[_0x848a('0x4b')]=_['intersection'](_0xa4c276[_0x848a('0x48')],_0xa4c276[_0x848a('0x49')]);_0x10162a[_0x848a('0x4c')]=_[_0x848a('0x5c')](_0xa4c276[_0x848a('0x48')],qs[_0x848a('0x4d')](_0x8fe181[_0x848a('0x49')][_0x848a('0x4d')]));_0x10162a['attributes']=_0x10162a[_0x848a('0x4c')][_0x848a('0x5d')]?_0x10162a[_0x848a('0x4c')]:_0xa4c276[_0x848a('0x48')];if(!_0x8fe181[_0x848a('0x49')]['hasOwnProperty']('nolimit')){_0x10162a[_0x848a('0x31')]=qs[_0x848a('0x31')](_0x8fe181[_0x848a('0x49')][_0x848a('0x31')]);_0x10162a[_0x848a('0x30')]=qs['offset'](_0x8fe181[_0x848a('0x49')][_0x848a('0x30')]);}_0x10162a[_0x848a('0x50')]=qs[_0x848a('0x51')](_0x8fe181[_0x848a('0x49')][_0x848a('0x51')]);_0x10162a[_0x848a('0x52')]=qs[_0x848a('0x4b')](_[_0x848a('0x53')](_0x8fe181[_0x848a('0x49')],_0xa4c276[_0x848a('0x4b')]));_0x10162a[_0x848a('0x52')]['ChatWebsiteId']=_0x57219f['id'];if(_0x8fe181[_0x848a('0x49')]['filter']){_0x10162a[_0x848a('0x52')]=_['merge'](_0x10162a['where'],{'$or':_[_0x848a('0x42')](_0x10162a[_0x848a('0x4c')],function(_0x2692f1){var _0xb18e12={};_0xb18e12[_0x2692f1]={'$like':'%'+_0x8fe181[_0x848a('0x49')][_0x848a('0x54')]+'%'};return _0xb18e12;})});}_0x10162a=_[_0x848a('0x55')]({},_0x10162a,_0x8fe181[_0x848a('0x5e')]);return db[_0x848a('0xd9')][_0x848a('0x2f')]({'where':_0x10162a[_0x848a('0x52')]})[_0x848a('0x20')](function(_0x10dfbc){_0xd15803['count']=_0x10dfbc;if(_0x8fe181[_0x848a('0x49')]['includeAll']){_0x10162a[_0x848a('0x58')]=[{'all':!![]}];}else{_0x10162a[_0x848a('0x58')]=[{'model':db['CmContact'],'as':_0x848a('0xea'),'required':![]}];}return db['ChatOfflineMessage'][_0x848a('0x59')](_0x10162a);})[_0x848a('0x20')](function(_0x9641a0){_0xd15803['rows']=_0x9641a0;return _0xd15803;});}})[_0x848a('0x20')](respondWithFilteredResult(_0x3d585,_0x10162a))[_0x848a('0x2b')](handleError(_0x3d585,null));};exports[_0x848a('0x11a')]=function(_0x530717,_0x40757b,_0x5e4136){return db[_0x848a('0x43')][_0x848a('0x5f')]({'where':{'id':_0x530717[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x40757b,null))[_0x848a('0x20')](function(_0x18a5f1){if(_0x18a5f1){return _0x18a5f1['addAgents'](_0x530717[_0x848a('0x61')][_0x848a('0x6f')],_[_0x848a('0x11b')](_0x530717['body'],['ids','id'])||{})[_0x848a('0xbf')](function(_0x4abef6){for(var _0x417163=0x0;_0x417163<_0x530717['body'][_0x848a('0x6f')][_0x848a('0x5d')];_0x417163+=0x1){socket[_0x848a('0x11c')](_0x848a('0x11d'),{'UserId':_0x530717['body'][_0x848a('0x6f')][_0x417163],'ChatWebsiteId':_0x530717['params']['id']});}return _0x4abef6;});}})[_0x848a('0x20')](respondWithResult(_0x40757b,null))[_0x848a('0x2b')](handleError(_0x40757b,null));};exports[_0x848a('0x11e')]=function(_0x3ba10d,_0xee3515,_0x5a0904){return db[_0x848a('0x43')]['find']({'where':{'id':_0x3ba10d[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0xee3515,null))[_0x848a('0x20')](function(_0x419859){if(_0x419859){return _0x419859[_0x848a('0x11e')](_0x3ba10d[_0x848a('0x49')]['ids'])[_0x848a('0x20')](function(){if(_[_0x848a('0x11f')](_0x3ba10d[_0x848a('0x49')][_0x848a('0x6f')])){for(var _0x143a5d=0x0;_0x143a5d<_0x3ba10d[_0x848a('0x49')][_0x848a('0x6f')][_0x848a('0x5d')];_0x143a5d+=0x1){socket[_0x848a('0x11c')]('userChatWebsite:remove',{'UserId':Number(_0x3ba10d[_0x848a('0x49')][_0x848a('0x6f')][_0x143a5d]),'ChatWebsiteId':Number(_0x3ba10d[_0x848a('0x5b')]['id'])});}}else{socket[_0x848a('0x11c')](_0x848a('0x120'),{'UserId':Number(_0x3ba10d[_0x848a('0x49')][_0x848a('0x6f')]),'ChatWebsiteId':Number(_0x3ba10d['params']['id'])});}});}})['then'](respondWithStatusCode(_0xee3515,null))['catch'](handleError(_0xee3515,null));};exports[_0x848a('0x121')]=function(_0x20b803,_0x69ef1d,_0x2047e0){var _0x512d4c={};var _0x225279={};var _0x24eb4e;var _0x18a0ad;return db['ChatWebsite'][_0x848a('0x6d')]({'where':{'id':_0x20b803[_0x848a('0x5b')]['id']}})[_0x848a('0x20')](handleEntityNotFound(_0x69ef1d,null))[_0x848a('0x20')](function(_0x4c64f1){if(_0x4c64f1){_0x24eb4e=_0x4c64f1;_0x225279[_0x848a('0x48')]=_[_0x848a('0x4a')](db[_0x848a('0xc7')][_0x848a('0x44')]);_0x225279[_0x848a('0x49')]=_[_0x848a('0x4a')](_0x20b803[_0x848a('0x49')]);_0x225279[_0x848a('0x4b')]=_[_0x848a('0x5c')](_0x225279[_0x848a('0x48')],_0x225279[_0x848a('0x49')]);_0x512d4c[_0x848a('0x4c')]=_[_0x848a('0x5c')](_0x225279[_0x848a('0x48')],qs[_0x848a('0x4d')](_0x20b803[_0x848a('0x49')][_0x848a('0x4d')]));_0x512d4c[_0x848a('0x4c')]=_0x512d4c[_0x848a('0x4c')][_0x848a('0x5d')]?_0x512d4c[_0x848a('0x4c')]:_0x225279['model'];_0x512d4c[_0x848a('0x50')]=qs[_0x848a('0x51')](_0x20b803[_0x848a('0x49')][_0x848a('0x51')]);_0x512d4c[_0x848a('0x52')]=qs[_0x848a('0x4b')](_[_0x848a('0x53')](_0x20b803[_0x848a('0x49')],_0x225279[_0x848a('0x4b')]));if(_0x20b803[_0x848a('0x49')][_0x848a('0x54')]){_0x512d4c[_0x848a('0x52')]=_[_0x848a('0x55')](_0x512d4c[_0x848a('0x52')],{'$or':_[_0x848a('0x42')](_0x512d4c[_0x848a('0x4c')],function(_0x1354d1){var _0x2cfa56={};_0x2cfa56[_0x1354d1]={'$like':'%'+_0x20b803[_0x848a('0x49')]['filter']+'%'};return _0x2cfa56;})});}_0x512d4c=_[_0x848a('0x55')]({},_0x512d4c,_0x20b803[_0x848a('0x5e')]);return _0x24eb4e[_0x848a('0x121')](_0x512d4c);}})[_0x848a('0x20')](function(_0x44ff91){if(_0x44ff91){_0x18a0ad=_0x44ff91['length'];if(!_0x20b803[_0x848a('0x49')][_0x848a('0x4e')]('nolimit')){_0x512d4c[_0x848a('0x31')]=qs[_0x848a('0x31')](_0x20b803[_0x848a('0x49')]['limit']);_0x512d4c['offset']=qs[_0x848a('0x30')](_0x20b803['query'][_0x848a('0x30')]);}return _0x24eb4e['getAgents'](_0x512d4c);}})[_0x848a('0x20')](function(_0x3c48a2){if(_0x3c48a2){return _0x3c48a2?{'count':_0x18a0ad,'rows':_0x3c48a2}:null;}})['then'](respondWithResult(_0x69ef1d,null))[_0x848a('0x2b')](handleError(_0x69ef1d,null));}; \ No newline at end of file +var _0x9477=['mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','service','host','port','secure','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','indexOf','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','push','some','server/files/chat/iframe.js','utf8','x-real-ip','remoteAddress','alignment','verticalAlignment','textColor','addApplications','transaction','findAndCountAll','getApplications','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','rimraf','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','mandatoryDispositionPause','length','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','CannedAnswer','create','getAnswers','removeAnswers','ids','sitepic','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','server/files/images/avatars/system_avatar.png','notify','headers','user-agent','getResult','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','ChatApplication','List','account','applications','Applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x9477,0x16f));var _0x7947=function(_0x1bbe35,_0x5e271b){_0x1bbe35=_0x1bbe35-0x0;var _0x4e11d7=_0x9477[_0x1bbe35];return _0x4e11d7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7947('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7947('0x1'));var moment=require(_0x7947('0x2'));var BPromise=require(_0x7947('0x3'));var Mustache=require(_0x7947('0x4'));var util=require(_0x7947('0x5'));var path=require(_0x7947('0x6'));var sox=require(_0x7947('0x7'));var csv=require(_0x7947('0x8'));var ejs=require(_0x7947('0x9'));var fs=require('fs');var _=require(_0x7947('0xa'));var squel=require(_0x7947('0xb'));var crypto=require(_0x7947('0xc'));var jsforce=require(_0x7947('0xd'));var deskjs=require(_0x7947('0xe'));var toCsv=require(_0x7947('0x8'));var querystring=require(_0x7947('0xf'));var Papa=require('papaparse');var Redis=require(_0x7947('0x10'));var authService=require(_0x7947('0x11'));var qs=require(_0x7947('0x12'));var as=require(_0x7947('0x13'));var hardwareService=require(_0x7947('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7947('0x15'));var config=require(_0x7947('0x16'));var db=require(_0x7947('0x17'))['db'];config['redis']=_[_0x7947('0x18')](config[_0x7947('0x19')],{'host':_0x7947('0x1a'),'port':0x18eb});var socket=require(_0x7947('0x1b'))(new Redis(config[_0x7947('0x19')]));require(_0x7947('0x1c'))[_0x7947('0x1d')](socket);var jayson=require(_0x7947('0x1e'));var client=jayson[_0x7947('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x7947('0x1f')][_0x7947('0x20')]({'port':0x232a});var client9003=jayson[_0x7947('0x1f')][_0x7947('0x20')]({'port':0x232b});function checkPasswordPattern(_0x83f236,_0x360594,_0x3679b1){if(_0x3679b1){var _0x539fe4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x539fe4[_0x7947('0x21')](_0x360594)){return _0x83f236;}else{throw new db[(_0x7947('0x22'))][(_0x7947('0x23'))](_0x7947('0x24'));}}else{return _0x83f236;}}function respondWithRpcPromise(_0x1088a9,_0x5cb119,_0x57d88a,_0x263ec7){return new BPromise(function(_0x1226f9,_0x1219af){var _0x1fe444=_0x263ec7||client;return _0x1fe444[_0x7947('0x25')](_0x1088a9,_0x57d88a)[_0x7947('0x26')](function(_0x28f1b7){logger[_0x7947('0x27')](_0x7947('0x28'),_0x5cb119,_0x7947('0x29'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5cb119,_0x7947('0x29'),JSON[_0x7947('0x2a')](_0x28f1b7));if(_0x28f1b7['error']){if(_0x28f1b7[_0x7947('0x2b')]['code']===0x1f4){logger[_0x7947('0x2b')](_0x7947('0x28'),_0x5cb119,_0x28f1b7['error'][_0x7947('0x2c')]);return _0x1219af(_0x28f1b7[_0x7947('0x2b')][_0x7947('0x2c')]);}logger[_0x7947('0x2b')](_0x7947('0x28'),_0x5cb119,_0x28f1b7[_0x7947('0x2b')][_0x7947('0x2c')]);return _0x1226f9(_0x28f1b7[_0x7947('0x2b')]['message']);}else{logger['info'](_0x7947('0x28'),_0x5cb119,_0x7947('0x29'));_0x1226f9(_0x28f1b7[_0x7947('0x2d')]['message']);}})['catch'](function(_0x5a47e4){logger['error'](_0x7947('0x28'),_0x5cb119,_0x5a47e4);_0x1219af(_0x5a47e4);});});}function respondWithStatusCode(_0x25bced,_0xbbb8f0){_0xbbb8f0=_0xbbb8f0||0xcc;return function(_0x598bd9){if(_0x598bd9){return _0x25bced[_0x7947('0x2e')](_0xbbb8f0);}return _0x25bced[_0x7947('0x2f')](_0xbbb8f0)[_0x7947('0x30')]();};}function respondWithResult(_0x3a0d41,_0x211d21){_0x211d21=_0x211d21||0xc8;return function(_0x2e350d){if(_0x2e350d){return _0x3a0d41['status'](_0x211d21)[_0x7947('0x31')](_0x2e350d);}};}function respondWithFilteredResult(_0x15bc51,_0x172512){return function(_0xaa6c6a){if(_0xaa6c6a){var _0x201e15=_0xaa6c6a[_0x7947('0x32')],_0x2be2dd=_0x172512[_0x7947('0x33')],_0x4ee9eb=_0x172512[_0x7947('0x33')]+_0x172512[_0x7947('0x34')],_0x57a0c0;if(_0x4ee9eb>=_0x201e15){_0x4ee9eb=_0x201e15;_0x57a0c0=0xc8;}else{_0x57a0c0=0xce;}_0x15bc51['status'](_0x57a0c0);return _0x15bc51[_0x7947('0x35')]('Content-Range',_0x2be2dd+'-'+_0x4ee9eb+'/'+_0x201e15)[_0x7947('0x31')](_0xaa6c6a);}return null;};}function patchUpdates(_0x3d663c){return function(_0x82d363){try{jsonpatch[_0x7947('0x36')](_0x82d363,_0x3d663c,!![]);}catch(_0x3b4f0a){return BPromise['reject'](_0x3b4f0a);}return _0x82d363[_0x7947('0x37')]();};}function saveUpdates(_0x47c979,_0x4ea4d0){return function(_0x4c787c){if(_0x4c787c){return _0x4c787c[_0x7947('0x38')](_0x47c979)['then'](function(_0x3de322){return _0x3de322;});}return null;};}function removeEntity(_0x12e130,_0x587ae7){return function(_0x19e447){if(_0x19e447){return _0x19e447['destroy']()[_0x7947('0x26')](function(){var _0x5bbddc=_0x19e447[_0x7947('0x39')]({'plain':!![]});var _0x27c1f0=_0x7947('0x3a');return db[_0x7947('0x3b')][_0x7947('0x3c')]({'where':{'type':_0x27c1f0,'resourceId':_0x5bbddc['id']}})['then'](function(){return _0x19e447;});})[_0x7947('0x26')](function(){_0x12e130['status'](0xcc)[_0x7947('0x30')]();});}};}function handleEntityNotFound(_0x5afc65,_0xfd1fa0){return function(_0x245559){if(!_0x245559){_0x5afc65[_0x7947('0x2e')](0x194);}return _0x245559;};}function handleError(_0x135d82,_0x244cf0){_0x244cf0=_0x244cf0||0x1f4;return function(_0x440872){logger[_0x7947('0x2b')](_0x440872[_0x7947('0x3d')]);if(_0x440872['name']){delete _0x440872[_0x7947('0x3e')];}_0x135d82[_0x7947('0x2f')](_0x244cf0)[_0x7947('0x3f')](_0x440872);};}exports[_0x7947('0x40')]=function(_0x4e1b80,_0xfde982){var _0xc418ba={'include':[{'model':db[_0x7947('0x41')],'as':'mandatoryDispositionPause'}]},_0x226fc9={},_0x429cff={'count':0x0,'rows':[]};var _0x59c9f1=_[_0x7947('0x42')](db[_0x7947('0x43')][_0x7947('0x44')],function(_0x14fe76){return{'name':_0x14fe76[_0x7947('0x45')],'type':_0x14fe76[_0x7947('0x46')][_0x7947('0x47')]};});_0x226fc9[_0x7947('0x48')]=_[_0x7947('0x42')](_0x59c9f1,_0x7947('0x3e'));_0x226fc9[_0x7947('0x49')]=_[_0x7947('0x4a')](_0x4e1b80[_0x7947('0x49')]);_0x226fc9[_0x7947('0x4b')]=_[_0x7947('0x4c')](_0x226fc9[_0x7947('0x48')],_0x226fc9[_0x7947('0x49')]);_0xc418ba[_0x7947('0x4d')]=_[_0x7947('0x4c')](_0x226fc9[_0x7947('0x48')],qs['fields'](_0x4e1b80[_0x7947('0x49')][_0x7947('0x4e')]));_0xc418ba['attributes']=_0xc418ba[_0x7947('0x4d')]['length']?_0xc418ba[_0x7947('0x4d')]:_0x226fc9['model'];if(!_0x4e1b80['query']['hasOwnProperty'](_0x7947('0x4f'))){_0xc418ba[_0x7947('0x34')]=qs['limit'](_0x4e1b80[_0x7947('0x49')][_0x7947('0x34')]);_0xc418ba[_0x7947('0x33')]=qs[_0x7947('0x33')](_0x4e1b80['query'][_0x7947('0x33')]);}_0xc418ba[_0x7947('0x50')]=qs[_0x7947('0x51')](_0x4e1b80[_0x7947('0x49')][_0x7947('0x51')]);_0xc418ba['where']=qs['filters'](_[_0x7947('0x52')](_0x4e1b80['query'],_0x226fc9[_0x7947('0x4b')]),_0x59c9f1);if(_0x4e1b80[_0x7947('0x49')]['filter']){_0xc418ba[_0x7947('0x53')]=_[_0x7947('0x54')](_0xc418ba['where'],{'$or':_[_0x7947('0x42')](_0x59c9f1,function(_0x5c6d2d){if(_0x5c6d2d[_0x7947('0x46')]!==_0x7947('0x55')){var _0x4df42e={};_0x4df42e[_0x5c6d2d['name']]={'$like':'%'+_0x4e1b80[_0x7947('0x49')][_0x7947('0x56')]+'%'};return _0x4df42e;}})});}_0xc418ba=_[_0x7947('0x54')]({},_0xc418ba,_0x4e1b80[_0x7947('0x57')]);var _0x3d827b={'where':_0xc418ba[_0x7947('0x53')]};return db[_0x7947('0x43')][_0x7947('0x32')](_0x3d827b)['then'](function(_0x371311){_0x429cff[_0x7947('0x32')]=_0x371311;if(_0x4e1b80[_0x7947('0x49')][_0x7947('0x58')]){_0xc418ba[_0x7947('0x59')]=[{'all':!![]}];}return db[_0x7947('0x43')][_0x7947('0x5a')](_0xc418ba);})[_0x7947('0x26')](function(_0xc7a638){_0x429cff[_0x7947('0x5b')]=_0xc7a638;return _0x429cff;})[_0x7947('0x26')](respondWithFilteredResult(_0xfde982,_0xc418ba))[_0x7947('0x5c')](handleError(_0xfde982,null));};exports[_0x7947('0x5d')]=function(_0x3d856a,_0x19c4e8){var _0x2a1df9={'raw':![],'where':{'id':_0x3d856a['params']['id']},'include':[{'model':db['Pause'],'as':_0x7947('0x5e')}]},_0x24db4a={};_0x24db4a[_0x7947('0x48')]=_['keys'](db['ChatWebsite'][_0x7947('0x44')]);_0x24db4a[_0x7947('0x49')]=_['keys'](_0x3d856a[_0x7947('0x49')]);_0x24db4a[_0x7947('0x4b')]=_[_0x7947('0x4c')](_0x24db4a['model'],_0x24db4a[_0x7947('0x49')]);_0x2a1df9[_0x7947('0x4d')]=_[_0x7947('0x4c')](_0x24db4a['model'],qs[_0x7947('0x4e')](_0x3d856a[_0x7947('0x49')][_0x7947('0x4e')]));_0x2a1df9['attributes']=_0x2a1df9[_0x7947('0x4d')][_0x7947('0x5f')]?_0x2a1df9['attributes']:_0x24db4a[_0x7947('0x48')];if(_0x3d856a['query'][_0x7947('0x58')]){_0x2a1df9[_0x7947('0x59')]=[{'all':!![]}];}_0x2a1df9=_['merge']({},_0x2a1df9,_0x3d856a[_0x7947('0x57')]);return db['ChatWebsite'][_0x7947('0x60')](_0x2a1df9)[_0x7947('0x26')](handleEntityNotFound(_0x19c4e8,null))['then'](respondWithResult(_0x19c4e8,null))[_0x7947('0x5c')](handleError(_0x19c4e8,null));};exports['create']=function(_0x1fd79d,_0x1bafef){return db[_0x7947('0x43')]['create'](_0x1fd79d[_0x7947('0x61')],{})[_0x7947('0x26')](function(_0x215dd5){var _0x3477e4=_0x1fd79d['user'][_0x7947('0x39')]({'plain':!![]});if(!_0x3477e4)throw new Error(_0x7947('0x62'));if(_0x3477e4[_0x7947('0x63')]==='user'){var _0x29eae6=_0x215dd5[_0x7947('0x39')]({'plain':!![]});var _0x23e2f6='ChatWebsites';return db[_0x7947('0x64')]['find']({'where':{'name':_0x23e2f6,'userProfileId':_0x3477e4[_0x7947('0x65')]},'raw':!![]})[_0x7947('0x26')](function(_0x5a19c7){if(_0x5a19c7&&_0x5a19c7[_0x7947('0x66')]===0x0){return db[_0x7947('0x3b')]['create']({'name':_0x29eae6[_0x7947('0x3e')],'resourceId':_0x29eae6['id'],'type':_0x5a19c7[_0x7947('0x3e')],'sectionId':_0x5a19c7['id']},{})[_0x7947('0x26')](function(){return _0x215dd5;});}else{return _0x215dd5;}})['catch'](function(_0x1dcd0c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dcd0c);throw _0x1dcd0c;});}return _0x215dd5;})[_0x7947('0x26')](respondWithResult(_0x1bafef,0xc9))[_0x7947('0x5c')](handleError(_0x1bafef,null));};exports[_0x7947('0x38')]=function(_0x514a11,_0xbe3644){if(_0x514a11[_0x7947('0x61')]['id']){delete _0x514a11['body']['id'];}return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0x514a11[_0x7947('0x67')]['id']},'include':[{'model':db[_0x7947('0x41')],'as':'mandatoryDispositionPause'}]})[_0x7947('0x26')](handleEntityNotFound(_0xbe3644,null))[_0x7947('0x26')](saveUpdates(_0x514a11[_0x7947('0x61')],null))[_0x7947('0x26')](respondWithResult(_0xbe3644,null))[_0x7947('0x5c')](handleError(_0xbe3644,null));};exports[_0x7947('0x3c')]=function(_0x3ea117,_0x3085b9){return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0x3ea117[_0x7947('0x67')]['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x3085b9,null))['then'](removeEntity(_0x3085b9,null))[_0x7947('0x5c')](handleError(_0x3085b9,null));};exports['describe']=function(_0x5f20f3,_0x2d3a17){return db['ChatWebsite'][_0x7947('0x68')]()['then'](respondWithResult(_0x2d3a17,null))[_0x7947('0x5c')](handleError(_0x2d3a17,null));};exports['addDisposition']=function(_0x1dd6cd,_0x1a7f4a,_0x4ac864){if(_0x1dd6cd[_0x7947('0x61')]['id']){delete _0x1dd6cd[_0x7947('0x61')]['id'];}return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0x1dd6cd[_0x7947('0x67')]['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x1a7f4a,null))[_0x7947('0x26')](function(_0x1229d3){if(_0x1229d3){_0x1dd6cd[_0x7947('0x61')][_0x7947('0x69')]=_0x1229d3['id'];return db[_0x7947('0x6a')]['create'](_0x1dd6cd[_0x7947('0x61')]);}})[_0x7947('0x26')](respondWithResult(_0x1a7f4a,null))[_0x7947('0x5c')](handleError(_0x1a7f4a,null));};exports[_0x7947('0x6b')]=function(_0x11d6d6,_0xc8c4ed,_0x2bd717){var _0x562a83={'raw':![],'where':{}};var _0x373e18={};var _0x2c6a5b={'count':0x0,'rows':[]};return db[_0x7947('0x43')][_0x7947('0x6c')]({'where':{'id':_0x11d6d6[_0x7947('0x67')]['id']}})[_0x7947('0x26')](handleEntityNotFound(_0xc8c4ed,null))['then'](function(_0x1a6b0b){if(_0x1a6b0b){_0x373e18[_0x7947('0x48')]=_[_0x7947('0x4a')](db[_0x7947('0x6a')][_0x7947('0x44')]);_0x373e18[_0x7947('0x49')]=_[_0x7947('0x4a')](_0x11d6d6[_0x7947('0x49')]);_0x373e18[_0x7947('0x4b')]=_[_0x7947('0x4c')](_0x373e18['model'],_0x373e18['query']);_0x562a83['attributes']=_['intersection'](_0x373e18[_0x7947('0x48')],qs[_0x7947('0x4e')](_0x11d6d6['query']['fields']));_0x562a83[_0x7947('0x4d')]=_0x562a83[_0x7947('0x4d')][_0x7947('0x5f')]?_0x562a83[_0x7947('0x4d')]:_0x373e18[_0x7947('0x48')];if(!_0x11d6d6['query'][_0x7947('0x6d')](_0x7947('0x4f'))){_0x562a83[_0x7947('0x34')]=qs[_0x7947('0x34')](_0x11d6d6['query'][_0x7947('0x34')]);_0x562a83[_0x7947('0x33')]=qs[_0x7947('0x33')](_0x11d6d6['query'][_0x7947('0x33')]);}_0x562a83[_0x7947('0x50')]=qs[_0x7947('0x51')](_0x11d6d6[_0x7947('0x49')][_0x7947('0x51')]);_0x562a83[_0x7947('0x53')]=qs[_0x7947('0x4b')](_[_0x7947('0x52')](_0x11d6d6[_0x7947('0x49')],_0x373e18[_0x7947('0x4b')]));_0x562a83[_0x7947('0x53')][_0x7947('0x69')]=_0x1a6b0b['id'];if(_0x11d6d6[_0x7947('0x49')][_0x7947('0x56')]){_0x562a83[_0x7947('0x53')]=_['merge'](_0x562a83[_0x7947('0x53')],{'$or':_[_0x7947('0x42')](_0x562a83[_0x7947('0x4d')],function(_0x2f9370){var _0x4f1b15={};_0x4f1b15[_0x2f9370]={'$like':'%'+_0x11d6d6[_0x7947('0x49')][_0x7947('0x56')]+'%'};return _0x4f1b15;})});}_0x562a83=_[_0x7947('0x54')]({},_0x562a83,_0x11d6d6['options']);return db[_0x7947('0x6a')][_0x7947('0x32')]({'where':_0x562a83[_0x7947('0x53')]})['then'](function(_0x5247fe){_0x2c6a5b['count']=_0x5247fe;if(_0x11d6d6[_0x7947('0x49')][_0x7947('0x58')]){_0x562a83['include']=[{'all':!![]}];}return db['Disposition'][_0x7947('0x5a')](_0x562a83);})[_0x7947('0x26')](function(_0x5c3f38){_0x2c6a5b[_0x7947('0x5b')]=_0x5c3f38;return _0x2c6a5b;});}})[_0x7947('0x26')](respondWithFilteredResult(_0xc8c4ed,_0x562a83))[_0x7947('0x5c')](handleError(_0xc8c4ed,null));};exports[_0x7947('0x6e')]=function(_0x50cde6,_0x10ee7b,_0x31cbe7){return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0x50cde6[_0x7947('0x67')]['id']}})['then'](handleEntityNotFound(_0x10ee7b,null))[_0x7947('0x26')](function(_0x50357d){if(_0x50357d){return _0x50357d['removeDispositions'](_0x50cde6[_0x7947('0x49')]['ids']);}})[_0x7947('0x26')](respondWithStatusCode(_0x10ee7b,null))['catch'](handleError(_0x10ee7b,null));};exports['addAnswer']=function(_0x26fd5e,_0x24ec18,_0x39d370){if(_0x26fd5e[_0x7947('0x61')]['id']){delete _0x26fd5e[_0x7947('0x61')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x26fd5e['params']['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x24ec18,null))[_0x7947('0x26')](function(_0x5ea15d){if(_0x5ea15d){_0x26fd5e[_0x7947('0x61')]['ChatWebsiteId']=_0x5ea15d['id'];return db[_0x7947('0x6f')][_0x7947('0x70')](_0x26fd5e[_0x7947('0x61')]);}})['then'](respondWithResult(_0x24ec18,null))[_0x7947('0x5c')](handleError(_0x24ec18,null));};exports[_0x7947('0x71')]=function(_0x5bdcd5,_0x461e86,_0x35b572){var _0x2a62e0={'raw':![],'where':{}};var _0x10990b={};var _0x316fe3={'count':0x0,'rows':[]};return db[_0x7947('0x43')][_0x7947('0x6c')]({'where':{'id':_0x5bdcd5[_0x7947('0x67')]['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x461e86,null))[_0x7947('0x26')](function(_0x5c9c72){if(_0x5c9c72){_0x10990b[_0x7947('0x48')]=_[_0x7947('0x4a')](db['CannedAnswer'][_0x7947('0x44')]);_0x10990b[_0x7947('0x49')]=_[_0x7947('0x4a')](_0x5bdcd5[_0x7947('0x49')]);_0x10990b['filters']=_[_0x7947('0x4c')](_0x10990b[_0x7947('0x48')],_0x10990b[_0x7947('0x49')]);_0x2a62e0['attributes']=_[_0x7947('0x4c')](_0x10990b['model'],qs['fields'](_0x5bdcd5['query'][_0x7947('0x4e')]));_0x2a62e0[_0x7947('0x4d')]=_0x2a62e0[_0x7947('0x4d')][_0x7947('0x5f')]?_0x2a62e0[_0x7947('0x4d')]:_0x10990b[_0x7947('0x48')];if(!_0x5bdcd5[_0x7947('0x49')]['hasOwnProperty'](_0x7947('0x4f'))){_0x2a62e0[_0x7947('0x34')]=qs[_0x7947('0x34')](_0x5bdcd5['query'][_0x7947('0x34')]);_0x2a62e0['offset']=qs[_0x7947('0x33')](_0x5bdcd5[_0x7947('0x49')][_0x7947('0x33')]);}_0x2a62e0[_0x7947('0x50')]=qs[_0x7947('0x51')](_0x5bdcd5[_0x7947('0x49')]['sort']);_0x2a62e0[_0x7947('0x53')]=qs['filters'](_[_0x7947('0x52')](_0x5bdcd5['query'],_0x10990b[_0x7947('0x4b')]));_0x2a62e0[_0x7947('0x53')][_0x7947('0x69')]=_0x5c9c72['id'];if(_0x5bdcd5[_0x7947('0x49')][_0x7947('0x56')]){_0x2a62e0[_0x7947('0x53')]=_[_0x7947('0x54')](_0x2a62e0[_0x7947('0x53')],{'$or':_[_0x7947('0x42')](_0x2a62e0['attributes'],function(_0x5f1fb1){var _0x778c4c={};_0x778c4c[_0x5f1fb1]={'$like':'%'+_0x5bdcd5[_0x7947('0x49')][_0x7947('0x56')]+'%'};return _0x778c4c;})});}_0x2a62e0=_[_0x7947('0x54')]({},_0x2a62e0,_0x5bdcd5['options']);return db[_0x7947('0x6f')][_0x7947('0x32')]({'where':_0x2a62e0[_0x7947('0x53')]})[_0x7947('0x26')](function(_0x483374){_0x316fe3[_0x7947('0x32')]=_0x483374;if(_0x5bdcd5[_0x7947('0x49')][_0x7947('0x58')]){_0x2a62e0['include']=[{'all':!![]}];}return db[_0x7947('0x6f')][_0x7947('0x5a')](_0x2a62e0);})[_0x7947('0x26')](function(_0x325f01){_0x316fe3[_0x7947('0x5b')]=_0x325f01;return _0x316fe3;});}})['then'](respondWithFilteredResult(_0x461e86,_0x2a62e0))[_0x7947('0x5c')](handleError(_0x461e86,null));};exports[_0x7947('0x72')]=function(_0x5ae70d,_0x84799,_0x5f5920){return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0x5ae70d[_0x7947('0x67')]['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x84799,null))[_0x7947('0x26')](function(_0x5ff10c){if(_0x5ff10c){return _0x5ff10c[_0x7947('0x72')](_0x5ae70d[_0x7947('0x49')][_0x7947('0x73')]);}})[_0x7947('0x26')](respondWithStatusCode(_0x84799,null))[_0x7947('0x5c')](handleError(_0x84799,null));};exports['addLogo']=function(_0xbf73,_0x9d0e87,_0x4ac1c9){_0xbf73[_0x7947('0x61')][_0x7947('0x74')]=_0xbf73['file']['filename'];return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0xbf73['params']['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x9d0e87,null))[_0x7947('0x26')](saveUpdates(_0xbf73[_0x7947('0x61')],null))[_0x7947('0x26')](respondWithResult(_0x9d0e87,null))[_0x7947('0x5c')](handleError(_0x9d0e87,null));};exports[_0x7947('0x75')]=function(_0x41e693,_0x471979,_0x50a32a){_0x41e693['body'][_0x7947('0x76')]=_0x41e693[_0x7947('0x77')]['filename'];return db[_0x7947('0x43')]['find']({'where':{'id':_0x41e693[_0x7947('0x67')]['id']}})['then'](handleEntityNotFound(_0x471979,null))[_0x7947('0x26')](saveUpdates(_0x41e693[_0x7947('0x61')],null))[_0x7947('0x26')](respondWithResult(_0x471979,null))[_0x7947('0x5c')](handleError(_0x471979,null));};exports[_0x7947('0x78')]=function(_0x37a79b,_0x45bd6e,_0x5033b0){_0x37a79b[_0x7947('0x61')][_0x7947('0x79')]=_0x37a79b[_0x7947('0x77')][_0x7947('0x7a')];return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0x37a79b[_0x7947('0x67')]['id']}})['then'](handleEntityNotFound(_0x45bd6e,null))[_0x7947('0x26')](saveUpdates(_0x37a79b[_0x7947('0x61')],null))['then'](respondWithResult(_0x45bd6e,null))[_0x7947('0x5c')](handleError(_0x45bd6e,null));};exports[_0x7947('0x7b')]=function(_0x176ff4,_0xdb0e6f,_0x53a4cb){_0x176ff4[_0x7947('0x61')][_0x7947('0x7c')]=_0x176ff4[_0x7947('0x77')][_0x7947('0x7a')];return db['ChatWebsite'][_0x7947('0x60')]({'where':{'id':_0x176ff4['params']['id']}})[_0x7947('0x26')](handleEntityNotFound(_0xdb0e6f,null))[_0x7947('0x26')](saveUpdates(_0x176ff4[_0x7947('0x61')],null))['then'](respondWithResult(_0xdb0e6f,null))[_0x7947('0x5c')](handleError(_0xdb0e6f,null));};exports[_0x7947('0x7d')]=function(_0xc9a98e,_0x3e4895,_0xdf508c){var _0x507f80=path[_0x7947('0x7e')](config[_0x7947('0x7f')],'server/files/images/logos/default_logo.svg');var _0x3341d9={'where':{'id':_0xc9a98e['params']['id']},'attributes':['id',_0x7947('0x74')],'raw':!![]};var _0x370d5d=![];return require(_0x7947('0x80'))[_0x7947('0x81')]()['then'](function(_0x5737b7){if(_0x5737b7){_0x370d5d=_0x5737b7[_0x7947('0x82')];}})[_0x7947('0x26')](function(){return db[_0x7947('0x43')][_0x7947('0x60')](_0x3341d9);})[_0x7947('0x26')](handleEntityNotFound(_0x3e4895,null))[_0x7947('0x26')](function(_0x33f098){if(_0x33f098){if(!_[_0x7947('0x83')](_0x33f098[_0x7947('0x74')])){if(fs[_0x7947('0x84')](path[_0x7947('0x7e')](config[_0x7947('0x7f')],_0x7947('0x85'),_0x33f098['sitepic']))&&_0x370d5d){_0x507f80=path['join'](config[_0x7947('0x7f')],_0x7947('0x85'),_0x33f098[_0x7947('0x74')]);}}return _0x3e4895['download'](_0x507f80);}})['catch'](handleError(_0x3e4895,null));};exports[_0x7947('0x86')]=function(_0x1ef57e,_0x1ebe34,_0x4f92c1){var _0x1c00dc=path['join'](config['root'],_0x7947('0x87'));var _0x15363d={'where':{'id':_0x1ef57e[_0x7947('0x67')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x7947('0x43')][_0x7947('0x60')](_0x15363d)[_0x7947('0x26')](handleEntityNotFound(_0x1ebe34,null))['then'](function(_0x39b9f9){if(_0x39b9f9){if(!_['isNil'](_0x39b9f9[_0x7947('0x76')])){if(fs[_0x7947('0x84')](path[_0x7947('0x7e')](config[_0x7947('0x7f')],_0x7947('0x88'),_0x39b9f9[_0x7947('0x76')]))){_0x1c00dc=path[_0x7947('0x7e')](config[_0x7947('0x7f')],_0x7947('0x88'),_0x39b9f9['agentAvatar']);}}return _0x1ebe34['download'](_0x1c00dc);}})[_0x7947('0x5c')](handleError(_0x1ebe34,null));};exports['getCustomerAvatar']=function(_0x4a7515,_0x5a884f,_0xf2fa64){var _0xffdb70=path[_0x7947('0x7e')](config['root'],_0x7947('0x89'));var _0x1c7d89={'where':{'id':_0x4a7515[_0x7947('0x67')]['id']},'attributes':['id',_0x7947('0x79'),_0x7947('0x8a')],'raw':!![]};return db[_0x7947('0x43')][_0x7947('0x60')](_0x1c7d89)['then'](handleEntityNotFound(_0x5a884f,null))['then'](function(_0x53f824){if(_0x53f824){if(!_[_0x7947('0x83')](_0x53f824[_0x7947('0x79')])){if(fs[_0x7947('0x84')](path[_0x7947('0x7e')](config['root'],_0x7947('0x88'),_0x53f824['customerAvatar']))&&_0x53f824[_0x7947('0x8a')]){_0xffdb70=path[_0x7947('0x7e')](config['root'],_0x7947('0x88'),_0x53f824['customerAvatar']);}}return _0x5a884f[_0x7947('0x8b')](_0xffdb70);}})[_0x7947('0x5c')](handleError(_0x5a884f,null));};exports['getSystemAvatar']=function(_0xfbe116,_0x32838b,_0xdbab6e){var _0x29ccd1=path[_0x7947('0x7e')](config[_0x7947('0x7f')],_0x7947('0x8c'));var _0x451411={'where':{'id':_0xfbe116[_0x7947('0x67')]['id']},'attributes':['id',_0x7947('0x7c')],'raw':!![]};return db[_0x7947('0x43')][_0x7947('0x60')](_0x451411)[_0x7947('0x26')](handleEntityNotFound(_0x32838b,null))[_0x7947('0x26')](function(_0x4cc758){if(_0x4cc758){if(!_['isNil'](_0x4cc758['systemAvatar'])){if(fs[_0x7947('0x84')](path['join'](config['root'],_0x7947('0x88'),_0x4cc758[_0x7947('0x7c')]))){_0x29ccd1=path['join'](config['root'],_0x7947('0x88'),_0x4cc758[_0x7947('0x7c')]);}}return _0x32838b[_0x7947('0x8b')](_0x29ccd1);}})[_0x7947('0x5c')](handleError(_0x32838b,null));};exports[_0x7947('0x8d')]=function(_0x16f6ff,_0x460726,_0x1c0347){var _0xa2dcd4=require('user-agent-parser');var _0x49e6e7=new _0xa2dcd4();var _0x174718=_0x49e6e7['setUA'](_0x16f6ff[_0x7947('0x8e')][_0x7947('0x8f')])[_0x7947('0x90')]();var _0x9c24b5={'body':_0x16f6ff[_0x7947('0x61')],'channel':'chat'};var _0x3191e6=[];var _0x4314a9=[];var _0x36f583={};var _0x6a3249=![];return db[_0x7947('0x91')][_0x7947('0x68')]()[_0x7947('0x26')](function(_0x3b0fcc){if(!_0x3b0fcc){throw new db[(_0x7947('0x22'))][(_0x7947('0x23'))](_0x7947('0x92'));}_0x3191e6=_[_0x7947('0x93')](_[_0x7947('0x4a')](_0x3b0fcc),['createdAt',_0x7947('0x94')]);_0x4314a9=_[_0x7947('0x93')](_[_0x7947('0x4a')](_0x3b0fcc),[_0x7947('0x95'),_0x7947('0x94'),_0x7947('0x96'),_0x7947('0x97')]);if(_0x16f6ff[_0x7947('0x61')]['id']){delete _0x16f6ff[_0x7947('0x61')]['id'];}if(_[_0x7947('0x83')](_0x16f6ff['body'][_0x7947('0x98')])){throw new db[(_0x7947('0x22'))]['ValidationError'](_0x7947('0x99'));}if(_['isNil'](_0x16f6ff[_0x7947('0x61')]['body'])||_0x16f6ff[_0x7947('0x61')][_0x7947('0x61')]===''){throw new db[(_0x7947('0x22'))]['ValidationError'](_0x7947('0x9a'));}if(_['isNil'](_0x16f6ff['body']['mapKey'])){throw new db[(_0x7947('0x22'))][(_0x7947('0x23'))](_0x7947('0x9b')+_0x4314a9);}if(!_[_0x7947('0x9c')](_0x4314a9,_0x16f6ff[_0x7947('0x61')]['mapKey'])){throw new db[(_0x7947('0x22'))]['ValidationError'](_0x7947('0x9d')+_0x4314a9);}_0x36f583[_0x16f6ff[_0x7947('0x61')][_0x7947('0x9e')]]=_0x16f6ff['body'][_0x7947('0x98')];})[_0x7947('0x26')](function(){return db[_0x7947('0x43')]['find']({'where':{'id':_0x16f6ff[_0x7947('0x67')]['id']},'include':[{'model':db[_0x7947('0x9f')],'as':'List','include':[{'model':db['CmContact'],'as':_0x7947('0xa0'),'where':_0x36f583,'limit':0x1,'order':[[_0x7947('0x94'),_0x7947('0xa1')]]}]},{'model':db[_0x7947('0xa2')],'as':'Applications'}]});})[_0x7947('0x26')](handleEntityNotFound(_0x460726,null))['then'](function(_0xb4d7bb){if(_0xb4d7bb&&_0xb4d7bb[_0x7947('0xa3')]){_0x9c24b5[_0x7947('0xa4')]=_0xb4d7bb;_0x9c24b5[_0x7947('0xa5')]=_0xb4d7bb[_0x7947('0xa6')];_0x9c24b5[_0x7947('0xa7')]=_0xb4d7bb[_0x7947('0xa3')];_0x9c24b5['applications']=_[_0x7947('0xa8')](_0x9c24b5[_0x7947('0xa5')],[_0x7947('0xa9')],[_0x7947('0xaa')]);if(_0x9c24b5[_0x7947('0xa4')]['Applications']){delete _0x9c24b5[_0x7947('0xa4')]['Applications'];}if(_0x9c24b5['account'][_0x7947('0xa3')]&&_0x9c24b5[_0x7947('0xa4')][_0x7947('0xa3')][_0x7947('0xa0')][_0x7947('0x5f')]){return _0x9c24b5['account'][_0x7947('0xa3')][_0x7947('0xa0')][0x0];}var _0x44b906=_[_0x7947('0x18')](_0x16f6ff[_0x7947('0x61')],{'firstName':_0x16f6ff[_0x7947('0x61')][_0x7947('0x98')],'ListId':_0xb4d7bb[_0x7947('0x97')]});_0x44b906[_0x16f6ff[_0x7947('0x61')][_0x7947('0x9e')]]=_0x16f6ff[_0x7947('0x61')][_0x7947('0x98')];return db[_0x7947('0x91')][_0x7947('0x70')](_0x44b906,{'fields':_0x3191e6,'raw':!![]});}})[_0x7947('0x26')](handleEntityNotFound(_0x460726,null))[_0x7947('0x26')](function(_0x2c12e1){_0x9c24b5[_0x7947('0xab')]=_0x2c12e1;var _0x1bcccf=_0x16f6ff['body'][_0x7947('0xac')];if(_0x16f6ff[_0x7947('0x8e')]['cf-connecting-ip']){_0x1bcccf=_0x16f6ff[_0x7947('0x8e')][_0x7947('0xad')];}else if(_0x16f6ff[_0x7947('0x8e')][_0x7947('0xae')]){_0x1bcccf=_[_0x7947('0xaf')](_0x16f6ff[_0x7947('0x8e')]['x-forwarded-for'][_0x7947('0xb0')](','));}if(_0x2c12e1){var _0xbae7de={'ContactId':_0x2c12e1['id'],'ChatWebsiteId':_0x16f6ff[_0x7947('0x67')]['id'],'from':(_0x2c12e1[_0x7947('0xb1')]||'')+'\x20'+(_0x2c12e1[_0x7947('0xb2')]||''),'customerIp':_0x1bcccf,'customerPort':_0x16f6ff['headers'][_0x7947('0xb3')]?_0x16f6ff[_0x7947('0x8e')][_0x7947('0xb3')]:null,'referer':_0x16f6ff[_0x7947('0x61')][_0x7947('0xb4')],'browserName':_0x174718[_0x7947('0xb5')][_0x7947('0x3e')]&&_0x174718[_0x7947('0xb5')][_0x7947('0xb6')]?util[_0x7947('0xb7')](_0x7947('0xb8'),_0x174718[_0x7947('0xb5')][_0x7947('0x3e')],_0x174718[_0x7947('0xb5')][_0x7947('0xb6')]):'unknown','browserVersion':_0x174718[_0x7947('0xb5')][_0x7947('0xb6')]||_0x7947('0xb9'),'osName':util[_0x7947('0xb7')](_0x7947('0xb8'),_0x174718['os'][_0x7947('0x3e')],_0x174718['os'][_0x7947('0xb6')]),'osVersion':_0x174718['os']['version'],'deviceModel':_0x174718[_0x7947('0xba')]['model']&&_0x174718[_0x7947('0xba')][_0x7947('0xbb')]?util[_0x7947('0xb7')](_0x7947('0xbc'),_0x174718['device'][_0x7947('0x48')],_0x174718[_0x7947('0xba')][_0x7947('0xbb')],_0x174718['device'][_0x7947('0x46')]):null,'deviceVendor':_0x174718['device'][_0x7947('0xbb')],'deviceType':_0x174718['device'][_0x7947('0x46')],'formData':JSON['stringify'](_0x16f6ff[_0x7947('0x61')])};var _0x229423={'ChatWebsiteId':_0x16f6ff['params']['id'],'closed':![]};if(_0x16f6ff[_0x7947('0x61')][_0x7947('0xbd')]){_0x229423[_0x7947('0xbd')]=_0x16f6ff['body']['threadId'];return db[_0x7947('0xbe')]['find']({'where':_0x229423})[_0x7947('0x26')](function(_0x2a5cc2){if(_0x2a5cc2){return[_0x2a5cc2,![]];}_0xbae7de[_0x7947('0xbd')]=_0x16f6ff[_0x7947('0x61')][_0x7947('0xbd')];_0xbae7de[_0x7947('0xbf')]=_0x16f6ff['body'][_0x7947('0xbf')];return db[_0x7947('0xbe')][_0x7947('0x70')](_0xbae7de)['then'](function(_0x43d70e){return[_0x43d70e,!![]];});});}_0x229423['ContactId']=_0x2c12e1['id'];if(_0x16f6ff[_0x7947('0x61')][_0x7947('0xc0')]&&_0x16f6ff['body'][_0x7947('0xc0')]['id']){_0x229423['id']=_0x16f6ff[_0x7947('0x61')]['interaction']['id'];return db['ChatInteraction'][_0x7947('0x60')]({'where':_0x229423})[_0x7947('0x26')](function(_0x369e5f){if(_0x369e5f){return[_0x369e5f,![]];}return db[_0x7947('0xbe')][_0x7947('0x70')](_0xbae7de)['then'](function(_0x4d0a5f){return[_0x4d0a5f,!![]];});});}return db[_0x7947('0xbe')][_0x7947('0x70')](_0xbae7de)[_0x7947('0x26')](function(_0x12d13c){return[_0x12d13c,!![]];});}})[_0x7947('0xc1')](function(_0x416ab7,_0x19e8ce){if(_0x416ab7){_0x6a3249=_0x19e8ce;if(!_0x19e8ce){var _0x2c057d={'from':(_0x9c24b5[_0x7947('0xab')][_0x7947('0xb1')]||'')+'\x20'+(_0x9c24b5[_0x7947('0xab')]['lastName']||'')};if(_0x16f6ff[_0x7947('0x61')][_0x7947('0xbd')]&&_0x16f6ff[_0x7947('0x61')][_0x7947('0xc2')]&&_0x16f6ff['body'][_0x7947('0xbd')]!=_0x16f6ff[_0x7947('0x61')][_0x7947('0xc2')]){_0x2c057d[_0x7947('0xbd')]=_0x16f6ff[_0x7947('0x61')]['messageId'];}return _0x416ab7[_0x7947('0x38')](_0x2c057d);}else{return _0x416ab7;}}})[_0x7947('0x26')](function(_0x177e6e){_0x9c24b5[_0x7947('0xc0')]=_0x177e6e['get']({'plain':!![]});_0x9c24b5[_0x7947('0xc0')][_0x7947('0xc3')]=_0x6a3249;if(_0x9c24b5['interaction'][_0x7947('0xc3')]){if(_0x9c24b5['account'][_0x7947('0xc4')]){_0x9c24b5[_0x7947('0xa5')]['push']({'id':0x0,'priority':_0x9c24b5['applications'][_0x7947('0x5f')]+0x1,'app':'close','appdata':_0x7947('0xc5'),'interval':_0x7947('0xc6')});}}return db[_0x7947('0xc7')][_0x7947('0x70')]({'body':_0x16f6ff[_0x7947('0x61')][_0x7947('0x61')],'ChatWebsiteId':_0x16f6ff[_0x7947('0x67')]['id'],'ChatInteractionId':_0x177e6e['id'],'direction':'in','ContactId':_0x9c24b5[_0x7947('0xab')]['id'],'AttachmentId':_0x16f6ff[_0x7947('0x61')][_0x7947('0xc8')]});})[_0x7947('0x26')](function(_0x71b4ff){_0x9c24b5[_0x7947('0x2c')]=_0x71b4ff;if(_0x9c24b5[_0x7947('0xc0')][_0x7947('0xc9')]){return db[_0x7947('0xca')]['find']({'attributes':['id',_0x7947('0x3e')],'where':{'id':_0x9c24b5['interaction'][_0x7947('0xc9')]}})[_0x7947('0x26')](function(_0x468491){if(_0x468491){_0x9c24b5['applications'][_0x7947('0xcb')]({'id':0x0,'priority':0x0,'app':_0x7947('0xcc'),'appdata':_0x468491[_0x7947('0x3e')]+','+(_0x9c24b5['account'][_0x7947('0xcd')]||0xa),'interval':_0x7947('0xc6')});_0x9c24b5[_0x7947('0xce')]=!![];}return respondWithRpcPromise(_0x7947('0xcf'),_0x7947('0xd0'),_0x9c24b5);});}return respondWithRpcPromise('Start',_0x7947('0xd0'),_0x9c24b5);})['then'](function(_0x2f8405){respondWithRpcPromise(_0x7947('0xd1'),_0x7947('0xd1'),{'event':_0x7947('0x8d'),'message':_0x2f8405},client9002);return _0x2f8405;})[_0x7947('0x26')](respondWithResult(_0x460726,null))[_0x7947('0x5c')](handleError(_0x460726,null));};exports[_0x7947('0xd2')]=function(_0x309123,_0xc65ee0,_0x1ad1cb){var _0x464e08,_0x397ca9,_0x12c582;var _0xcc951a=[];var _0x15e7aa=[];var _0x4a75dc={};return db[_0x7947('0x91')][_0x7947('0x68')]()[_0x7947('0x26')](function(_0x43cf3e){if(!_0x43cf3e){throw new db[(_0x7947('0x22'))][(_0x7947('0x23'))](_0x7947('0x92'));}_0x15e7aa=_[_0x7947('0x93')](_['keys'](_0x43cf3e),[_0x7947('0x95'),'updatedAt']);_0xcc951a=_[_0x7947('0x93')](_[_0x7947('0x4a')](_0x43cf3e),[_0x7947('0x95'),_0x7947('0x94'),_0x7947('0x96'),'ListId']);if(_0x309123[_0x7947('0x61')]['id']){delete _0x309123[_0x7947('0x61')]['id'];}if(_[_0x7947('0x83')](_0x309123['body'][_0x7947('0x98')])){throw _0xc65ee0[_0x7947('0x2f')](0x1f4)['send'](new db[(_0x7947('0x22'))][(_0x7947('0x23'))](_0x7947('0x99')));}if(_[_0x7947('0x83')](_0x309123[_0x7947('0x61')][_0x7947('0x61')])||_0x309123[_0x7947('0x61')][_0x7947('0x61')]===''){throw _0xc65ee0[_0x7947('0x2f')](0x1f4)[_0x7947('0x3f')](new db['Sequelize'][(_0x7947('0x23'))](_0x7947('0x9a')));}if(_['isNil'](_0x309123['body'][_0x7947('0xd3')])){throw _0xc65ee0[_0x7947('0x2f')](0x1f4)['send'](new db[(_0x7947('0x22'))][(_0x7947('0x23'))](_0x7947('0xd4')+_0xcc951a));}if(!_[_0x7947('0x9c')](_0xcc951a,_0x309123[_0x7947('0x61')][_0x7947('0xd3')])){throw _0xc65ee0[_0x7947('0x2f')](0x1f4)[_0x7947('0x3f')](new db[(_0x7947('0x22'))][(_0x7947('0x23'))](_0x7947('0xd5')+_0xcc951a));}_0x4a75dc[_0x309123[_0x7947('0x61')][_0x7947('0xd3')]]=_0x309123[_0x7947('0x61')]['from'];})[_0x7947('0x26')](function(){return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0x309123[_0x7947('0x67')]['id']},'include':[{'model':db['CmList'],'as':'List'}]});})['then'](handleEntityNotFound(_0xc65ee0,null))[_0x7947('0x26')](function(_0x200421){if(_0x200421&&_0x200421['List']){_0x397ca9=_0x200421;var _0x4d72ff=_[_0x7947('0x18')](_0x309123[_0x7947('0x61')],{'firstName':_0x309123['body']['from'],'phone':_0x309123['body'][_0x7947('0x98')],'ListId':_0x200421[_0x7947('0x97')]});_0x4d72ff[_0x309123[_0x7947('0x61')]['mapKeyOffline']]=_0x309123['body'][_0x7947('0x98')];return db['CmContact'][_0x7947('0xd6')]({'where':_0x4a75dc,'defaults':_0x4d72ff});}})['spread'](function(_0x34788c){if(_0x34788c){_0x12c582=_0x34788c;var _0x19e1f6=fs[_0x7947('0xd7')](path[_0x7947('0x7e')](config[_0x7947('0x7f')],_0x7947('0xd8')),'utf8');var _0x134978=ejs[_0x7947('0xd9')](_0x19e1f6,{'body':_[_0x7947('0xda')](_0x309123[_0x7947('0x61')][_0x7947('0x61')]),'bodyTitle':_0x397ca9[_0x7947('0xdb')]});return db[_0x7947('0xdc')][_0x7947('0x70')]({'body':_0x134978,'ContactId':_0x34788c['id'],'ChatWebsiteId':_0x397ca9['id']});}})[_0x7947('0x26')](function(_0x4a6c18){if(_0x4a6c18){_0x464e08=_0x4a6c18;return db[_0x7947('0xdd')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x419c65){if(_0x419c65&&_0x419c65[_0x7947('0xde')]&&_0x397ca9['forwardOfflineAddress']){var _0xd616e0={'tls':{'rejectUnauthorized':![]}};if(_0x419c65[_0x7947('0xde')][_0x7947('0xdf')]){_0xd616e0['service']=_0x419c65[_0x7947('0xde')][_0x7947('0xdf')];}else{_0xd616e0[_0x7947('0xe0')]=_0x419c65[_0x7947('0xde')][_0x7947('0xe0')];_0xd616e0['port']=_0x419c65[_0x7947('0xde')][_0x7947('0xe1')];_0xd616e0[_0x7947('0xe2')]=_0x419c65['Smtp'][_0x7947('0xe2')];}if(_0x419c65[_0x7947('0xde')]['authentication']){_0xd616e0[_0x7947('0xe3')]={'user':_0x419c65[_0x7947('0xde')][_0x7947('0xe4')],'pass':_0x419c65[_0x7947('0xde')][_0x7947('0xe5')]};}return respondWithRpcPromise(_0x7947('0xe6'),_0x7947('0xe7'),{'account':_0xd616e0,'message':{'from':util[_0x7947('0xb7')](_0x7947('0xe8'),_0x419c65[_0x7947('0x3e')],_0x419c65[_0x7947('0xe9')]||_0x419c65['Smtp']['user']),'to':_0x397ca9[_0x7947('0xea')],'subject':_0x397ca9['offlineMessageSubject'],'text':_0x464e08[_0x7947('0x61')]}},client9003)['then'](function(){return _0x464e08;})[_0x7947('0x5c')](function(_0x513a74){console[_0x7947('0x2b')](_0x513a74);});}})[_0x7947('0x26')](function(){if(_0x464e08){return _0x464e08;}})['then'](respondWithResult(_0xc65ee0,null))[_0x7947('0x5c')](handleError(_0xc65ee0,null));};exports[_0x7947('0xeb')]=function(_0x367301,_0x1d7dec,_0x23dc35){return db['ChatInteraction'][_0x7947('0x60')]({'where':{'id':_0x367301['params']['id']}})['then'](handleEntityNotFound(_0x1d7dec,null))[_0x7947('0x26')](function(_0x47f9ee){if(_0x47f9ee){return _0x47f9ee[_0x7947('0xeb')](_0x367301[_0x7947('0x61')][_0x7947('0x73')],_[_0x7947('0xec')](_0x367301[_0x7947('0x61')],[_0x7947('0x73'),'id'])||{});}})[_0x7947('0x26')](respondWithResult(_0x1d7dec,null))['catch'](handleError(_0x1d7dec,null));};exports[_0x7947('0xed')]=function(_0xb2a347,_0x142cbd,_0x4fabd5){var _0x1d0e0e={'raw':![],'where':{}};var _0x54bfd7={};var _0x568952={'count':0x0,'rows':[]};return db[_0x7947('0x43')]['findOne']({'where':{'id':_0xb2a347[_0x7947('0x67')]['id']}})['then'](handleEntityNotFound(_0x142cbd,null))['then'](function(_0x1277c3){if(_0x1277c3){_0x54bfd7[_0x7947('0x48')]=_[_0x7947('0x4a')](db['ChatInteraction'][_0x7947('0x44')]);_0x54bfd7[_0x7947('0x49')]=_[_0x7947('0x4a')](_0xb2a347[_0x7947('0x49')]);_0x54bfd7[_0x7947('0x4b')]=_['intersection'](_0x54bfd7[_0x7947('0x48')],_0x54bfd7[_0x7947('0x49')]);_0x1d0e0e[_0x7947('0x4d')]=_[_0x7947('0x4c')](_0x54bfd7['model'],qs[_0x7947('0x4e')](_0xb2a347['query'][_0x7947('0x4e')]));_0x1d0e0e[_0x7947('0x4d')]=_0x1d0e0e[_0x7947('0x4d')][_0x7947('0x5f')]?_0x1d0e0e['attributes']:_0x54bfd7['model'];if(!_0xb2a347[_0x7947('0x49')][_0x7947('0x6d')](_0x7947('0x4f'))){_0x1d0e0e[_0x7947('0x34')]=qs[_0x7947('0x34')](_0xb2a347['query']['limit']);_0x1d0e0e[_0x7947('0x33')]=qs[_0x7947('0x33')](_0xb2a347[_0x7947('0x49')][_0x7947('0x33')]);}_0x1d0e0e[_0x7947('0x50')]=qs['sort'](_0xb2a347[_0x7947('0x49')][_0x7947('0x51')]);_0x1d0e0e['where']=qs[_0x7947('0x4b')](_[_0x7947('0x52')](_0xb2a347[_0x7947('0x49')],_0x54bfd7['filters']));_0x1d0e0e[_0x7947('0x53')][_0x7947('0x69')]=_0x1277c3['id'];if(_0xb2a347['query']['filter']){_0x1d0e0e['where']=_[_0x7947('0x54')](_0x1d0e0e[_0x7947('0x53')],{'$or':_[_0x7947('0x42')](_0x1d0e0e['attributes'],function(_0x4f1d29){var _0xecbdb3={};_0xecbdb3[_0x4f1d29]={'$like':'%'+_0xb2a347[_0x7947('0x49')][_0x7947('0x56')]+'%'};return _0xecbdb3;})});}_0x1d0e0e=_[_0x7947('0x54')]({},_0x1d0e0e,_0xb2a347['options']);return db[_0x7947('0xbe')][_0x7947('0x32')]({'where':_0x1d0e0e[_0x7947('0x53')]})[_0x7947('0x26')](function(_0x5f615b){_0x568952[_0x7947('0x32')]=_0x5f615b;if(_0xb2a347[_0x7947('0x49')]['includeAll']){_0x1d0e0e[_0x7947('0x59')]=[{'model':db[_0x7947('0x91')],'as':_0x7947('0xee'),'required':![]},{'model':db[_0x7947('0xca')],'as':_0x7947('0xef'),'attributes':[_0x7947('0x3e'),_0x7947('0xf0'),'internal'],'required':![]},{'model':db[_0x7947('0xf1')],'as':_0x7947('0xf2'),'attributes':['id',_0x7947('0x3e'),_0x7947('0xf3')],'where':_0xb2a347['query'][_0x7947('0xf4')]?{'id':_0xb2a347[_0x7947('0x49')][_0x7947('0xf4')]}:undefined,'required':_0xb2a347[_0x7947('0x49')]['tag']?!![]:![]}];}return db[_0x7947('0xbe')][_0x7947('0x5a')](_0x1d0e0e);})['then'](function(_0x5e1e74){_0x568952[_0x7947('0x5b')]=_0x5e1e74;return _0x568952;});}})[_0x7947('0x26')](respondWithFilteredResult(_0x142cbd,_0x1d0e0e))[_0x7947('0x5c')](handleError(_0x142cbd,null));};function iftimePromise(_0x17e291,_0x1b9962){return respondWithRpcPromise('Command',_0x7947('0xf5'),{'command':_0x1b9962[_0x7947('0xf6')]?util[_0x7947('0xb7')]('iftime\x20%s,%s',_0x17e291[_0x7947('0xf7')],_0x1b9962[_0x7947('0xf6')]):util[_0x7947('0xb7')](_0x7947('0xf8'),_0x17e291['interval'])},client9002)['then'](function(_0x53b2f6){var _0x58da61=_0x53b2f6&&_0x53b2f6[_0x7947('0xf9')]('true')>=0x0?!![]:![];logger[_0x7947('0x27')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1b9962['id'],_0x17e291['id'],_0x17e291[_0x7947('0xf7')],_0x58da61?_0x7947('0xfa'):_0x7947('0xfb'),_0x1b9962[_0x7947('0xf6')]?_0x1b9962['timezone']:_0x7947('0xfc'));return _0x58da61;})[_0x7947('0x5c')](function(_0x4ae787){logger[_0x7947('0x2b')](_0x7947('0xfd'),_0x1b9962['id'],_0x17e291['id'],_0x17e291[_0x7947('0xf7')],util[_0x7947('0xfe')](_0x4ae787,{'showHidden':![],'depth':null}),_0x1b9962[_0x7947('0xf6')]?_0x1b9962[_0x7947('0xf6')]:_0x7947('0xfc'));return![];});}exports['getSnippet']=function(_0x20c39b,_0x3d0bf6,_0x1d116b){var _0x3c977b=0x0;var _0x56e5e9=0x0;var _0x2d0d12=![];var _0x4cd1a2;var _0x18c43b;return db[_0x7947('0x43')][_0x7947('0x60')]({'where':{'id':_0x20c39b['params']['id']},'include':[{'model':db[_0x7947('0xff')],'as':_0x7947('0xff'),'include':[{'model':db[_0x7947('0xff')],'as':_0x7947('0x100'),'attributes':['id',_0x7947('0xf7')],'raw':!![]}]}]})[_0x7947('0x26')](handleEntityNotFound(_0x3d0bf6,null))[_0x7947('0x26')](function(_0x4a886b){if(_0x4a886b){_0x4cd1a2=_0x4a886b;return _0x4a886b[_0x7947('0x101')]({'raw':!![]});}})[_0x7947('0x26')](function(_0x41f247){if(_0x4cd1a2){if(_0x41f247){_0x18c43b=_0x41f247;}}return require(_0x7947('0x80'))[_0x7947('0x81')]();})[_0x7947('0x26')](function(_0x7d5c7f){if(_0x7d5c7f){_0x56e5e9=_0x7d5c7f['virtual'];_0x2d0d12=_0x7d5c7f[_0x7947('0x82')];}})[_0x7947('0x26')](function(){return db[_0x7947('0xbe')][_0x7947('0x32')]({'where':{'closed':![]}});})[_0x7947('0x26')](function(_0x1d89df){_0x3c977b=_0x1d89df;if(_0x56e5e9&&_0x1d89df>_0x56e5e9){return db[_0x7947('0x102')][_0x7947('0x6c')]({'where':{'id':0x1}})[_0x7947('0x26')](function(_0x54fe45){if(_0x54fe45){_0x54fe45[_0x7947('0x103')](_0x7947('0x104'));}});}})[_0x7947('0x26')](function(){if(_0x4cd1a2['Interval']&&_0x4cd1a2[_0x7947('0xff')]['Intervals']){var _0x3e077d=[];for(var _0x5c8b24=0x0;_0x5c8b24<_0x4cd1a2[_0x7947('0xff')][_0x7947('0x100')][_0x7947('0x5f')];_0x5c8b24++){var _0x36b5a4=_0x4cd1a2['Interval'][_0x7947('0x100')][_0x5c8b24]['get']({'plain':!![]});_0x3e077d[_0x7947('0x105')](iftimePromise(_0x36b5a4,_0x4cd1a2));}return BPromise['all'](_0x3e077d)['then'](function(_0x43a660){return _[_0x7947('0x106')](_0x43a660);});}else{return!![];}})['then'](function(_0x29fe54){var _0x2664e3=fs[_0x7947('0xd7')](path[_0x7947('0x7e')](config[_0x7947('0x7f')],_0x7947('0x107')),_0x7947('0x108'));var _0x4d3d37={'remote':_0x4cd1a2['remote'],'query':querystring[_0x7947('0x2a')](_[_0x7947('0x54')](_0x4cd1a2['get']({'plain':!![]}),{'customerIp':_0x20c39b[_0x7947('0x8e')][_0x7947('0xae')]||_0x20c39b[_0x7947('0x8e')][_0x7947('0x109')]||_0x20c39b['connection'][_0x7947('0x10a')]||_0x20c39b['ip'],'referer':_0x20c39b[_0x7947('0x8e')][_0x7947('0xb4')],'openedInteractions':_0x3c977b,'maxInteractions':_0x56e5e9,'virtual':_0x2d0d12['virtual'],'online':_0x29fe54,'custom':_0x2d0d12}))['replace'](/'/g,'\x5c\x27')};_0x3d0bf6['send'](ejs[_0x7947('0xd9')](Mustache[_0x7947('0xd9')](_0x2664e3,_0x4d3d37),{'proactiveActions':_0x18c43b,'alignment':_0x4cd1a2[_0x7947('0x10b')],'verticalAlignment':_0x4cd1a2[_0x7947('0x10c')],'div_color':_0x4cd1a2[_0x7947('0xf3')],'text_color':_0x4cd1a2[_0x7947('0x10d')]}));})[_0x7947('0x5c')](handleError(_0x3d0bf6,null));};exports[_0x7947('0x10e')]=function(_0x346e17,_0x366b7a,_0x580869){return db[_0x7947('0x43')][_0x7947('0x6c')]({'where':{'id':_0x346e17[_0x7947('0x67')]['id']}})['then'](handleEntityNotFound(_0x366b7a,null))[_0x7947('0x26')](function(_0xd91d6f){if(_0xd91d6f){return db['sequelize'][_0x7947('0x10f')](function(_0x39f850){return db[_0x7947('0xa2')][_0x7947('0x3c')]({'where':{'ChatWebsiteId':_0x346e17[_0x7947('0x67')]['id']},'transaction':_0x39f850})['then'](function(_0x45e5ea){var _0x4ea07c=_[_0x7947('0x42')](_0x346e17[_0x7947('0x61')],function(_0x461d34){_0x461d34['ChatWebsiteId']=_0x346e17[_0x7947('0x67')]['id'];return _0x461d34;});return db[_0x7947('0xa2')]['bulkCreate'](_0x4ea07c,{'transaction':_0x39f850});});})[_0x7947('0x26')](function(){return db[_0x7947('0xa2')][_0x7947('0x110')]({'where':{'ChatWebsiteId':_0x346e17[_0x7947('0x67')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x366b7a,null))[_0x7947('0x5c')](handleError(_0x366b7a,null));};exports['getApplications']=function(_0x5fbf4a,_0x260b3f,_0x135709){var _0x19b914={};var _0x5c499a={};var _0x34a0b3;var _0x1193d8;return db['ChatWebsite']['findOne']({'where':{'id':_0x5fbf4a[_0x7947('0x67')]['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x260b3f,null))['then'](function(_0x2d4a1a){if(_0x2d4a1a){_0x34a0b3=_0x2d4a1a;_0x5c499a['model']=_[_0x7947('0x4a')](db[_0x7947('0xa2')][_0x7947('0x44')]);_0x5c499a['query']=_[_0x7947('0x4a')](_0x5fbf4a[_0x7947('0x49')]);_0x5c499a['filters']=_[_0x7947('0x4c')](_0x5c499a[_0x7947('0x48')],_0x5c499a[_0x7947('0x49')]);_0x19b914[_0x7947('0x4d')]=_[_0x7947('0x4c')](_0x5c499a[_0x7947('0x48')],qs[_0x7947('0x4e')](_0x5fbf4a[_0x7947('0x49')][_0x7947('0x4e')]));_0x19b914[_0x7947('0x4d')]=_0x19b914[_0x7947('0x4d')][_0x7947('0x5f')]?_0x19b914[_0x7947('0x4d')]:_0x5c499a[_0x7947('0x48')];_0x19b914['order']=qs[_0x7947('0x51')](_0x5fbf4a[_0x7947('0x49')][_0x7947('0x51')]);_0x19b914[_0x7947('0x53')]=qs[_0x7947('0x4b')](_[_0x7947('0x52')](_0x5fbf4a[_0x7947('0x49')],_0x5c499a[_0x7947('0x4b')]));if(_0x5fbf4a['query']['filter']){_0x19b914['where']=_[_0x7947('0x54')](_0x19b914['where'],{'$or':_['map'](_0x19b914[_0x7947('0x4d')],function(_0x5d18da){var _0x2e7851={};_0x2e7851[_0x5d18da]={'$like':'%'+_0x5fbf4a['query'][_0x7947('0x56')]+'%'};return _0x2e7851;})});}_0x19b914=_['merge']({},_0x19b914,_0x5fbf4a[_0x7947('0x57')]);return _0x34a0b3[_0x7947('0x111')](_0x19b914);}})[_0x7947('0x26')](function(_0x318c59){if(_0x318c59){_0x1193d8=_0x318c59['length'];if(!_0x5fbf4a[_0x7947('0x49')][_0x7947('0x6d')](_0x7947('0x4f'))){_0x19b914[_0x7947('0x34')]=qs[_0x7947('0x34')](_0x5fbf4a[_0x7947('0x49')]['limit']);_0x19b914['offset']=qs['offset'](_0x5fbf4a['query'][_0x7947('0x33')]);}return _0x34a0b3['getApplications'](_0x19b914);}})[_0x7947('0x26')](function(_0x51dd90){if(_0x51dd90){return _0x51dd90?{'count':_0x1193d8,'rows':_0x51dd90}:null;}})[_0x7947('0x26')](respondWithResult(_0x260b3f,null))['catch'](handleError(_0x260b3f,null));};exports['addProactiveActions']=function(_0x97f220,_0x3f303,_0xb5eb23){return db[_0x7947('0x112')]['find']({'where':{'id':_0x97f220['params']['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x3f303,null))[_0x7947('0x26')](function(_0x114bac){if(_0x114bac){return _0x114bac['addProactiveActions'](_0x97f220[_0x7947('0x61')]['ids'],_[_0x7947('0xec')](_0x97f220['body'],['ids','id'])||{});}})[_0x7947('0x26')](respondWithResult(_0x3f303,null))[_0x7947('0x5c')](handleError(_0x3f303,null));};exports['getProactiveActions']=function(_0x18dca4,_0x4a1303,_0x423e32){var _0x4d0ab6={};var _0x33c945={};var _0x280ff9;var _0xe1bb2b;return db[_0x7947('0x43')]['findOne']({'where':{'id':_0x18dca4['params']['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x4a1303,null))[_0x7947('0x26')](function(_0x387baf){if(_0x387baf){_0x280ff9=_0x387baf;_0x33c945[_0x7947('0x48')]=_['keys'](db[_0x7947('0x113')][_0x7947('0x44')]);_0x33c945[_0x7947('0x49')]=_[_0x7947('0x4a')](_0x18dca4[_0x7947('0x49')]);_0x33c945['filters']=_[_0x7947('0x4c')](_0x33c945['model'],_0x33c945[_0x7947('0x49')]);_0x4d0ab6[_0x7947('0x4d')]=_[_0x7947('0x4c')](_0x33c945['model'],qs['fields'](_0x18dca4[_0x7947('0x49')][_0x7947('0x4e')]));_0x4d0ab6['attributes']=_0x4d0ab6[_0x7947('0x4d')][_0x7947('0x5f')]?_0x4d0ab6[_0x7947('0x4d')]:_0x33c945[_0x7947('0x48')];_0x4d0ab6['order']=qs[_0x7947('0x51')](_0x18dca4['query'][_0x7947('0x51')]);_0x4d0ab6[_0x7947('0x53')]=qs['filters'](_[_0x7947('0x52')](_0x18dca4[_0x7947('0x49')],_0x33c945[_0x7947('0x4b')]));if(_0x18dca4[_0x7947('0x49')][_0x7947('0x56')]){_0x4d0ab6[_0x7947('0x53')]=_[_0x7947('0x54')](_0x4d0ab6[_0x7947('0x53')],{'$or':_[_0x7947('0x42')](_0x4d0ab6['attributes'],function(_0x377684){var _0xb9cd7e={};_0xb9cd7e[_0x377684]={'$like':'%'+_0x18dca4[_0x7947('0x49')][_0x7947('0x56')]+'%'};return _0xb9cd7e;})});}_0x4d0ab6=_[_0x7947('0x54')]({},_0x4d0ab6,_0x18dca4[_0x7947('0x57')]);return _0x280ff9[_0x7947('0x101')](_0x4d0ab6);}})[_0x7947('0x26')](function(_0x522272){if(_0x522272){_0xe1bb2b=_0x522272[_0x7947('0x5f')];if(!_0x18dca4[_0x7947('0x49')][_0x7947('0x6d')](_0x7947('0x4f'))){_0x4d0ab6[_0x7947('0x34')]=qs['limit'](_0x18dca4[_0x7947('0x49')][_0x7947('0x34')]);_0x4d0ab6[_0x7947('0x33')]=qs[_0x7947('0x33')](_0x18dca4[_0x7947('0x49')]['offset']);}return _0x280ff9[_0x7947('0x101')](_0x4d0ab6);}})[_0x7947('0x26')](function(_0x13d395){if(_0x13d395){return _0x13d395?{'count':_0xe1bb2b,'rows':_0x13d395}:null;}})[_0x7947('0x26')](respondWithResult(_0x4a1303,null))['catch'](handleError(_0x4a1303,null));};exports[_0x7947('0x114')]=function(_0x39cff5,_0x1679c4,_0x529b74){var _0x21d94b=_0x39cff5[_0x7947('0x49')][_0x7947('0x115')]===_0x7947('0x116')?_0x7947('0x117'):'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0x21d94b],'where':{'id':_0x39cff5['params']['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x1679c4,null))[_0x7947('0x26')](function(_0x158b78){if(_0x158b78){var _0x198595=_0x158b78[_0x21d94b];var _0x5cbac4=_0x198595&&_0x198595[_0x7947('0x118')]?_0x198595[_0x7947('0x118')]:[];_0x1679c4[_0x7947('0x3f')]({'fromKey':_[_0x7947('0x83')](_0x198595[_0x7947('0x119')])?undefined:_0x198595[_0x7947('0x119')],'count':_0x5cbac4[_0x7947('0x5f')],'rows':_0x5cbac4});}})[_0x7947('0x5c')](handleError(_0x1679c4,null));};exports['getOfflineMessages']=function(_0x81a97d,_0x3b8cf9,_0x28bd58){var _0x2f7f25={'raw':![],'where':{}};var _0x47fd2a={};var _0x10eed9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7947('0x6c')]({'where':{'id':_0x81a97d['params']['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x3b8cf9,null))[_0x7947('0x26')](function(_0x3f293a){if(_0x3f293a){_0x47fd2a['model']=_['keys'](db[_0x7947('0xdc')][_0x7947('0x44')]);_0x47fd2a[_0x7947('0x49')]=_['keys'](_0x81a97d[_0x7947('0x49')]);_0x47fd2a[_0x7947('0x4b')]=_[_0x7947('0x4c')](_0x47fd2a[_0x7947('0x48')],_0x47fd2a[_0x7947('0x49')]);_0x2f7f25[_0x7947('0x4d')]=_[_0x7947('0x4c')](_0x47fd2a[_0x7947('0x48')],qs['fields'](_0x81a97d['query']['fields']));_0x2f7f25[_0x7947('0x4d')]=_0x2f7f25[_0x7947('0x4d')][_0x7947('0x5f')]?_0x2f7f25[_0x7947('0x4d')]:_0x47fd2a[_0x7947('0x48')];if(!_0x81a97d[_0x7947('0x49')]['hasOwnProperty']('nolimit')){_0x2f7f25[_0x7947('0x34')]=qs[_0x7947('0x34')](_0x81a97d[_0x7947('0x49')]['limit']);_0x2f7f25['offset']=qs[_0x7947('0x33')](_0x81a97d[_0x7947('0x49')]['offset']);}_0x2f7f25[_0x7947('0x50')]=qs[_0x7947('0x51')](_0x81a97d['query']['sort']);_0x2f7f25['where']=qs[_0x7947('0x4b')](_[_0x7947('0x52')](_0x81a97d[_0x7947('0x49')],_0x47fd2a[_0x7947('0x4b')]));_0x2f7f25[_0x7947('0x53')][_0x7947('0x69')]=_0x3f293a['id'];if(_0x81a97d[_0x7947('0x49')][_0x7947('0x56')]){_0x2f7f25[_0x7947('0x53')]=_[_0x7947('0x54')](_0x2f7f25['where'],{'$or':_['map'](_0x2f7f25[_0x7947('0x4d')],function(_0x574753){var _0x45d6f6={};_0x45d6f6[_0x574753]={'$like':'%'+_0x81a97d[_0x7947('0x49')][_0x7947('0x56')]+'%'};return _0x45d6f6;})});}_0x2f7f25=_['merge']({},_0x2f7f25,_0x81a97d[_0x7947('0x57')]);return db[_0x7947('0xdc')][_0x7947('0x32')]({'where':_0x2f7f25['where']})[_0x7947('0x26')](function(_0x486a42){_0x10eed9[_0x7947('0x32')]=_0x486a42;if(_0x81a97d[_0x7947('0x49')][_0x7947('0x58')]){_0x2f7f25[_0x7947('0x59')]=[{'all':!![]}];}else{_0x2f7f25['include']=[{'model':db[_0x7947('0x91')],'as':'Contact','required':![]}];}return db[_0x7947('0xdc')]['findAll'](_0x2f7f25);})[_0x7947('0x26')](function(_0x5bb160){_0x10eed9[_0x7947('0x5b')]=_0x5bb160;return _0x10eed9;});}})[_0x7947('0x26')](respondWithFilteredResult(_0x3b8cf9,_0x2f7f25))[_0x7947('0x5c')](handleError(_0x3b8cf9,null));};exports['addAgents']=function(_0x57e924,_0x298a36,_0x5b3580){return db['ChatWebsite'][_0x7947('0x60')]({'where':{'id':_0x57e924[_0x7947('0x67')]['id']}})['then'](handleEntityNotFound(_0x298a36,null))[_0x7947('0x26')](function(_0xd2f8a6){if(_0xd2f8a6){return _0xd2f8a6[_0x7947('0x11a')](_0x57e924[_0x7947('0x61')][_0x7947('0x73')],_[_0x7947('0xec')](_0x57e924[_0x7947('0x61')],[_0x7947('0x73'),'id'])||{})[_0x7947('0xc1')](function(_0x44cdd7){for(var _0x5bc360=0x0;_0x5bc360<_0x57e924[_0x7947('0x61')][_0x7947('0x73')][_0x7947('0x5f')];_0x5bc360+=0x1){socket[_0x7947('0x11b')](_0x7947('0x11c'),{'UserId':_0x57e924[_0x7947('0x61')][_0x7947('0x73')][_0x5bc360],'ChatWebsiteId':_0x57e924[_0x7947('0x67')]['id']});}return _0x44cdd7;});}})[_0x7947('0x26')](respondWithResult(_0x298a36,null))[_0x7947('0x5c')](handleError(_0x298a36,null));};exports['removeAgents']=function(_0x38042e,_0x378480,_0x45bcc1){return db['ChatWebsite'][_0x7947('0x60')]({'where':{'id':_0x38042e[_0x7947('0x67')]['id']}})['then'](handleEntityNotFound(_0x378480,null))[_0x7947('0x26')](function(_0x43d29c){if(_0x43d29c){return _0x43d29c[_0x7947('0x11d')](_0x38042e[_0x7947('0x49')]['ids'])[_0x7947('0x26')](function(){if(_[_0x7947('0x11e')](_0x38042e[_0x7947('0x49')]['ids'])){for(var _0x3c6ae4=0x0;_0x3c6ae4<_0x38042e['query']['ids']['length'];_0x3c6ae4+=0x1){socket['emit'](_0x7947('0x11f'),{'UserId':Number(_0x38042e[_0x7947('0x49')][_0x7947('0x73')][_0x3c6ae4]),'ChatWebsiteId':Number(_0x38042e[_0x7947('0x67')]['id'])});}}else{socket['emit'](_0x7947('0x11f'),{'UserId':Number(_0x38042e[_0x7947('0x49')][_0x7947('0x73')]),'ChatWebsiteId':Number(_0x38042e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x378480,null))[_0x7947('0x5c')](handleError(_0x378480,null));};exports[_0x7947('0x120')]=function(_0x163524,_0x2ab6fd,_0x43bbea){var _0x20aed8={};var _0x92657={};var _0x418fa1;var _0x59e93f;return db[_0x7947('0x43')][_0x7947('0x6c')]({'where':{'id':_0x163524[_0x7947('0x67')]['id']}})[_0x7947('0x26')](handleEntityNotFound(_0x2ab6fd,null))['then'](function(_0x29b793){if(_0x29b793){_0x418fa1=_0x29b793;_0x92657[_0x7947('0x48')]=_[_0x7947('0x4a')](db[_0x7947('0xca')][_0x7947('0x44')]);_0x92657['query']=_['keys'](_0x163524[_0x7947('0x49')]);_0x92657[_0x7947('0x4b')]=_[_0x7947('0x4c')](_0x92657['model'],_0x92657[_0x7947('0x49')]);_0x20aed8[_0x7947('0x4d')]=_[_0x7947('0x4c')](_0x92657[_0x7947('0x48')],qs[_0x7947('0x4e')](_0x163524[_0x7947('0x49')][_0x7947('0x4e')]));_0x20aed8[_0x7947('0x4d')]=_0x20aed8[_0x7947('0x4d')][_0x7947('0x5f')]?_0x20aed8[_0x7947('0x4d')]:_0x92657['model'];_0x20aed8['order']=qs[_0x7947('0x51')](_0x163524[_0x7947('0x49')][_0x7947('0x51')]);_0x20aed8[_0x7947('0x53')]=qs['filters'](_['pick'](_0x163524[_0x7947('0x49')],_0x92657['filters']));if(_0x163524[_0x7947('0x49')][_0x7947('0x56')]){_0x20aed8[_0x7947('0x53')]=_['merge'](_0x20aed8[_0x7947('0x53')],{'$or':_[_0x7947('0x42')](_0x20aed8[_0x7947('0x4d')],function(_0x203807){var _0x1b6aad={};_0x1b6aad[_0x203807]={'$like':'%'+_0x163524[_0x7947('0x49')][_0x7947('0x56')]+'%'};return _0x1b6aad;})});}_0x20aed8=_[_0x7947('0x54')]({},_0x20aed8,_0x163524[_0x7947('0x57')]);return _0x418fa1[_0x7947('0x120')](_0x20aed8);}})[_0x7947('0x26')](function(_0x319e16){if(_0x319e16){_0x59e93f=_0x319e16[_0x7947('0x5f')];if(!_0x163524[_0x7947('0x49')][_0x7947('0x6d')](_0x7947('0x4f'))){_0x20aed8[_0x7947('0x34')]=qs[_0x7947('0x34')](_0x163524[_0x7947('0x49')][_0x7947('0x34')]);_0x20aed8[_0x7947('0x33')]=qs[_0x7947('0x33')](_0x163524[_0x7947('0x49')][_0x7947('0x33')]);}return _0x418fa1[_0x7947('0x120')](_0x20aed8);}})[_0x7947('0x26')](function(_0x212339){if(_0x212339){return _0x212339?{'count':_0x59e93f,'rows':_0x212339}:null;}})['then'](respondWithResult(_0x2ab6fd,null))[_0x7947('0x5c')](handleError(_0x2ab6fd,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d56ebcd..c8f7de1 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 _0x4eea=['ChatWebsite','save','update','emit','../../mysqldb'];(function(_0x1aa7ab,_0x2276af){var _0x459a59=function(_0x20548d){while(--_0x20548d){_0x1aa7ab['push'](_0x1aa7ab['shift']());}};_0x459a59(++_0x2276af);}(_0x4eea,0x149));var _0xa4ee=function(_0x5ad8bd,_0x5de6de){_0x5ad8bd=_0x5ad8bd-0x0;var _0x17e28c=_0x4eea[_0x5ad8bd];return _0x17e28c;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xa4ee('0x0'))['db'][_0xa4ee('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa4ee('0x2'),'afterUpdate':_0xa4ee('0x3'),'afterDestroy':'remove'};function emitEvent(_0x42695c){return function(_0x3ed6eb,_0x4c435d,_0x2088c8){ChatWebsiteEvents[_0xa4ee('0x4')](_0x42695c+':'+_0x3ed6eb['id'],_0x3ed6eb);ChatWebsiteEvents[_0xa4ee('0x4')](_0x42695c,_0x3ed6eb);_0x2088c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x3645=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x3645,0x154));var _0x5364=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x3645[_0x225f50];return _0x19d003;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x5364('0x0'))['db'][_0x5364('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5364('0x2')](0x0);var events={'afterCreate':_0x5364('0x3'),'afterUpdate':_0x5364('0x4'),'afterDestroy':_0x5364('0x5')};function emitEvent(_0x3c0f77){return function(_0x5a63bf,_0x334a16,_0xea3e95){ChatWebsiteEvents[_0x5364('0x6')](_0x3c0f77+':'+_0x5a63bf['id'],_0x5a63bf);ChatWebsiteEvents[_0x5364('0x6')](_0x3c0f77,_0x5a63bf);_0xea3e95(null);};}for(var e in events){if(events[_0x5364('0x7')](e)){var event=events[e];ChatWebsite[_0x5364('0x8')](e,emitEvent(event));}}module[_0x5364('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 4906073..9779009 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 _0x0fec=['path','rimraf','./chatWebsite.attributes','lodash','util','../../config/logger','bluebird'];(function(_0x4ddb13,_0x36ecaf){var _0x44ae6b=function(_0x35efe7){while(--_0x35efe7){_0x4ddb13['push'](_0x4ddb13['shift']());}};_0x44ae6b(++_0x36ecaf);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x39657e,_0x39363b){_0x39657e=_0x39657e-0x0;var _0x44aa33=_0x0fec[_0x39657e];return _0x44aa33;};'use strict';var _=require(_0xc0fe('0x0'));var util=require(_0xc0fe('0x1'));var logger=require(_0xc0fe('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc0fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0fe('0x4'));var rimraf=require(_0xc0fe('0x5'));var config=require('../../config/environment');var attributes=require(_0xc0fe('0x6'));module['exports']=function(_0x3fce36,_0x1073f0){return _0x3fce36['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf83=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites'];(function(_0x4beedb,_0x514fd9){var _0x22adb5=function(_0x3d80d2){while(--_0x3d80d2){_0x4beedb['push'](_0x4beedb['shift']());}};_0x22adb5(++_0x514fd9);}(_0xbf83,0x11e));var _0x3bf8=function(_0x21ce51,_0x5a9d75){_0x21ce51=_0x21ce51-0x0;var _0x36d533=_0xbf83[_0x21ce51];return _0x36d533;};'use strict';var _=require(_0x3bf8('0x0'));var util=require('util');var logger=require(_0x3bf8('0x1'))(_0x3bf8('0x2'));var moment=require(_0x3bf8('0x3'));var BPromise=require(_0x3bf8('0x4'));var rp=require(_0x3bf8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3bf8('0x6'));var attributes=require(_0x3bf8('0x7'));module[_0x3bf8('0x8')]=function(_0x251445,_0x5be89b){return _0x251445['define'](_0x3bf8('0x9'),attributes,{'tableName':_0x3bf8('0xa'),'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 a50479d..1007513 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 _0x4888=['../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5a99e8,_0x5784cc){var _0x241ebf=function(_0x136055){while(--_0x136055){_0x5a99e8['push'](_0x5a99e8['shift']());}};_0x241ebf(++_0x5784cc);}(_0x4888,0x198));var _0x8488=function(_0x2beeb9,_0x415c85){_0x2beeb9=_0x2beeb9-0x0;var _0x3f7f25=_0x4888[_0x2beeb9];return _0x3f7f25;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});config[_0x8488('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0xc')]));require(_0x8488('0xd'))['register'](socket);function respondWithRpcPromise(_0x19c994,_0x1334fe,_0x98223){return new BPromise(function(_0x19a2ee,_0x515ea8){return client[_0x8488('0xe')](_0x19c994,_0x98223)[_0x8488('0xf')](function(_0x468896){logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,'request\x20sent');logger[_0x8488('0x12')](_0x8488('0x13'),_0x1334fe,'request\x20sent',JSON['stringify'](_0x468896));if(_0x468896[_0x8488('0x14')]){if(_0x468896['error'][_0x8488('0x15')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1334fe,_0x468896[_0x8488('0x14')][_0x8488('0x16')]);return _0x515ea8(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x468896[_0x8488('0x14')]['message']);return _0x19a2ee(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}else{logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,_0x8488('0x17'));_0x19a2ee(_0x468896[_0x8488('0x18')][_0x8488('0x16')]);}})[_0x8488('0x19')](function(_0x514c31){logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x514c31);_0x515ea8(_0x514c31);});});} \ No newline at end of file +var _0x7096=['ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','then','info'];(function(_0x2def61,_0x7e9ab){var _0xd7fee3=function(_0x366c4b){while(--_0x366c4b){_0x2def61['push'](_0x2def61['shift']());}};_0xd7fee3(++_0x7e9ab);}(_0x7096,0x10c));var _0x6709=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7096[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});config[_0x6709('0xb')]=_[_0x6709('0xc')](config[_0x6709('0xb')],{'host':_0x6709('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6709('0xe'))[_0x6709('0xf')](socket);function respondWithRpcPromise(_0xbcb47,_0x1aa476,_0x12eea2){return new BPromise(function(_0x426ea1,_0x5de1fa){return client['request'](_0xbcb47,_0x12eea2)[_0x6709('0x10')](function(_0x262261){logger[_0x6709('0x11')](_0x6709('0x12'),_0x1aa476,_0x6709('0x13'));logger[_0x6709('0x14')](_0x6709('0x15'),_0x1aa476,_0x6709('0x13'),JSON['stringify'](_0x262261));if(_0x262261[_0x6709('0x16')]){if(_0x262261[_0x6709('0x16')][_0x6709('0x17')]===0x1f4){logger[_0x6709('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1aa476,_0x262261[_0x6709('0x16')]['message']);return _0x5de1fa(_0x262261[_0x6709('0x16')]['message']);}logger[_0x6709('0x16')](_0x6709('0x12'),_0x1aa476,_0x262261[_0x6709('0x16')][_0x6709('0x18')]);return _0x426ea1(_0x262261['error']['message']);}else{logger['info'](_0x6709('0x12'),_0x1aa476,_0x6709('0x13'));_0x426ea1(_0x262261['result'][_0x6709('0x18')]);}})[_0x6709('0x19')](function(_0xf1a70d){logger['error'](_0x6709('0x12'),_0x1aa476,_0xf1a70d);_0x5de1fa(_0xf1a70d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index daab735..23d8286 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(_0x3d0293,_0x3d3c80){var _0x5aa8d3=function(_0x1e1a9a){while(--_0x1e1a9a){_0x3d0293['push'](_0x3d0293['shift']());}};_0x5aa8d3(++_0x3d3c80);}(_0x5f2f,0x73));var _0xf5f2=function(_0x301b7a,_0x55fdd0){_0x301b7a=_0x301b7a-0x0;var _0x1e2fab=_0x5f2f[_0x301b7a];return _0x1e2fab;};'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(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x137e96,_0x301502){_0x137e96=_0x137e96-0x0;var _0x47d8f2=_0x5f2f[_0x137e96];return _0x47d8f2;};'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 ac4f647..dddfb53 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 _0x7a65=['%s-%s','now','originalname','single','file','diskStorage','join','addAvatar','server/files/images/avatars/','addSystemAvatar','notify','offline','/:id/interactions','addInteraction','addApplications','put','update','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/users','getAgents','create','post','addDisposition','addAnswer','root','server/files/images/logos/','format'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x7a65,0x146));var _0x57a6=function(_0x10d1e5,_0x5831e3){_0x10d1e5=_0x10d1e5-0x0;var _0x173534=_0x7a65[_0x10d1e5];return _0x173534;};'use strict';var multer=require(_0x57a6('0x0'));var util=require(_0x57a6('0x1'));var path=require(_0x57a6('0x2'));var timeout=require(_0x57a6('0x3'));var express=require('express');var router=express[_0x57a6('0x4')]();var auth=require(_0x57a6('0x5'));var interaction=require(_0x57a6('0x6'));var config=require('../../config/environment');var controller=require(_0x57a6('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x57a6('0x8')](_0x57a6('0x9'),auth[_0x57a6('0xa')](),controller['describe']);router['get'](_0x57a6('0xb'),auth[_0x57a6('0xa')](),controller[_0x57a6('0xc')]);router[_0x57a6('0x8')](_0x57a6('0xd'),auth[_0x57a6('0xa')](),controller[_0x57a6('0xe')]);router[_0x57a6('0x8')](_0x57a6('0xf'),auth[_0x57a6('0xa')](),controller[_0x57a6('0x10')]);router[_0x57a6('0x8')](_0x57a6('0x11'),controller[_0x57a6('0x12')]);router[_0x57a6('0x8')](_0x57a6('0x13'),controller[_0x57a6('0x14')]);router[_0x57a6('0x8')](_0x57a6('0x15'),controller[_0x57a6('0x16')]);router['get'](_0x57a6('0x17'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x57a6('0xa')](),controller['getInteractions']);router['get'](_0x57a6('0x18'),controller[_0x57a6('0x19')]);router['get'](_0x57a6('0x1a'),auth[_0x57a6('0xa')](),controller[_0x57a6('0x1b')]);router['get'](_0x57a6('0x1c'),auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0x57a6('0x1d'),controller[_0x57a6('0x1e')]);router['get']('/:id/offline_messages',auth[_0x57a6('0xa')](),controller['getOfflineMessages']);router[_0x57a6('0x8')](_0x57a6('0x1f'),auth[_0x57a6('0xa')](),controller[_0x57a6('0x20')]);router['post']('/',auth['isAuthenticated'](),controller[_0x57a6('0x21')]);router[_0x57a6('0x22')](_0x57a6('0xd'),auth[_0x57a6('0xa')](),controller[_0x57a6('0x23')]);router[_0x57a6('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x57a6('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3721a6,_0x2e17c2,_0x263933){_0x263933(null,path['join'](config[_0x57a6('0x25')],_0x57a6('0x26')));},'filename':function(_0x4e34c0,_0xfd135b,_0x59d106){_0x59d106(null,util[_0x57a6('0x27')](_0x57a6('0x28'),Date[_0x57a6('0x29')](),_0xfd135b[_0x57a6('0x2a')]));}})});router['post'](_0x57a6('0x11'),upload[_0x57a6('0x2b')](_0x57a6('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0x57a6('0x2d')]({'destination':function(_0x206d2d,_0xf17f58,_0x52ecde){_0x52ecde(null,path[_0x57a6('0x2e')](config[_0x57a6('0x25')],'server/files/images/avatars/'));},'filename':function(_0x3725a6,_0x38277e,_0x20134e){_0x20134e(null,util[_0x57a6('0x27')]('%s-%s',Date[_0x57a6('0x29')](),_0x38277e[_0x57a6('0x2a')]));}})});router['post'](_0x57a6('0x13'),upload[_0x57a6('0x2b')](_0x57a6('0x2c')),controller[_0x57a6('0x2f')]);var upload=multer({'storage':multer[_0x57a6('0x2d')]({'destination':function(_0x694770,_0x1e4def,_0x55043b){_0x55043b(null,path[_0x57a6('0x2e')](config[_0x57a6('0x25')],_0x57a6('0x30')));},'filename':function(_0x5965db,_0x1cc8cc,_0x1505cc){_0x1505cc(null,util[_0x57a6('0x27')](_0x57a6('0x28'),Date['now'](),_0x1cc8cc[_0x57a6('0x2a')]));}})});router[_0x57a6('0x22')](_0x57a6('0x15'),upload[_0x57a6('0x2b')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x57a6('0x2d')]({'destination':function(_0x680186,_0x143456,_0x28844f){_0x28844f(null,path[_0x57a6('0x2e')](config[_0x57a6('0x25')],_0x57a6('0x30')));},'filename':function(_0x5f0245,_0x123a76,_0x40c7be){_0x40c7be(null,util[_0x57a6('0x27')](_0x57a6('0x28'),Date[_0x57a6('0x29')](),_0x123a76[_0x57a6('0x2a')]));}})});router[_0x57a6('0x22')](_0x57a6('0x17'),upload[_0x57a6('0x2b')](_0x57a6('0x2c')),controller[_0x57a6('0x31')]);router[_0x57a6('0x22')]('/:id/notify',controller[_0x57a6('0x32')]);router[_0x57a6('0x22')]('/:id/offline',controller[_0x57a6('0x33')]);router['post'](_0x57a6('0x34'),auth[_0x57a6('0xa')](),controller[_0x57a6('0x35')]);router[_0x57a6('0x22')]('/:id/applications',auth[_0x57a6('0xa')](),controller[_0x57a6('0x36')]);router[_0x57a6('0x22')](_0x57a6('0x1c'),auth[_0x57a6('0xa')](),controller['addProactiveActions']);router[_0x57a6('0x22')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x57a6('0x37')](_0x57a6('0xb'),auth[_0x57a6('0xa')](),controller[_0x57a6('0x38')]);router[_0x57a6('0x39')](_0x57a6('0xb'),auth[_0x57a6('0xa')](),controller[_0x57a6('0x3a')]);router[_0x57a6('0x39')](_0x57a6('0xd'),auth[_0x57a6('0xa')](),controller['removeDispositions']);router[_0x57a6('0x39')](_0x57a6('0xf'),auth[_0x57a6('0xa')](),controller[_0x57a6('0x3b')]);router['delete'](_0x57a6('0x1f'),auth[_0x57a6('0xa')](),controller['removeAgents']);module[_0x57a6('0x3c')]=router; \ No newline at end of file +var _0xab00=['getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','/:id/logo','single','addLogo','server/files/images/avatars/','now','originalname','/:id/avatar','addAvatar','file','/:id/system_avatar','addSystemAvatar','notify','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions'];(function(_0x5620c7,_0x53ad6c){var _0x342f27=function(_0x243de1){while(--_0x243de1){_0x5620c7['push'](_0x5620c7['shift']());}};_0x342f27(++_0x53ad6c);}(_0xab00,0xef));var _0x0ab0=function(_0x2857a8,_0x316959){_0x2857a8=_0x2857a8-0x0;var _0x3dc73d=_0xab00[_0x2857a8];return _0x3dc73d;};'use strict';var multer=require(_0x0ab0('0x0'));var util=require('util');var path=require(_0x0ab0('0x1'));var timeout=require(_0x0ab0('0x2'));var express=require(_0x0ab0('0x3'));var router=express['Router']();var auth=require(_0x0ab0('0x4'));var interaction=require(_0x0ab0('0x5'));var config=require(_0x0ab0('0x6'));var controller=require('./chatWebsite.controller');router[_0x0ab0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0ab0('0x7')](_0x0ab0('0x8'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0xa')]);router['get'](_0x0ab0('0xb'),auth['isAuthenticated'](),controller[_0x0ab0('0xc')]);router[_0x0ab0('0x7')]('/:id/dispositions',auth[_0x0ab0('0x9')](),controller[_0x0ab0('0xd')]);router[_0x0ab0('0x7')](_0x0ab0('0xe'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0xf')]);router['get']('/:id/logo',controller['getLogo']);router['get']('/:id/avatar',controller[_0x0ab0('0x10')]);router[_0x0ab0('0x7')](_0x0ab0('0x11'),controller[_0x0ab0('0x12')]);router['get']('/:id/system_avatar',controller[_0x0ab0('0x13')]);router[_0x0ab0('0x7')](_0x0ab0('0x14'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x15')]);router[_0x0ab0('0x7')](_0x0ab0('0x16'),controller[_0x0ab0('0x17')]);router[_0x0ab0('0x7')](_0x0ab0('0x18'),auth['isAuthenticated'](),controller[_0x0ab0('0x19')]);router[_0x0ab0('0x7')](_0x0ab0('0x1a'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x1b')]);router[_0x0ab0('0x7')](_0x0ab0('0x1c'),controller[_0x0ab0('0x1d')]);router[_0x0ab0('0x7')](_0x0ab0('0x1e'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x1f')]);router[_0x0ab0('0x7')](_0x0ab0('0x20'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0ab0('0x21')]('/',auth[_0x0ab0('0x9')](),controller['create']);router[_0x0ab0('0x21')](_0x0ab0('0x22'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x23')]);router['post'](_0x0ab0('0xe'),auth['isAuthenticated'](),controller[_0x0ab0('0x24')]);var upload=multer({'storage':multer[_0x0ab0('0x25')]({'destination':function(_0x297fbe,_0xfab7e2,_0x51b97b){_0x51b97b(null,path[_0x0ab0('0x26')](config[_0x0ab0('0x27')],_0x0ab0('0x28')));},'filename':function(_0x12e5d8,_0x183d66,_0x1e92f4){_0x1e92f4(null,util[_0x0ab0('0x29')](_0x0ab0('0x2a'),Date['now'](),_0x183d66['originalname']));}})});router['post'](_0x0ab0('0x2b'),upload[_0x0ab0('0x2c')]('file'),controller[_0x0ab0('0x2d')]);var upload=multer({'storage':multer[_0x0ab0('0x25')]({'destination':function(_0x287190,_0x346146,_0x2a50d8){_0x2a50d8(null,path[_0x0ab0('0x26')](config[_0x0ab0('0x27')],_0x0ab0('0x2e')));},'filename':function(_0x254e3d,_0x4255f5,_0x4c3609){_0x4c3609(null,util['format']('%s-%s',Date[_0x0ab0('0x2f')](),_0x4255f5[_0x0ab0('0x30')]));}})});router['post'](_0x0ab0('0x31'),upload['single']('file'),controller[_0x0ab0('0x32')]);var upload=multer({'storage':multer[_0x0ab0('0x25')]({'destination':function(_0x2c43f2,_0x454c81,_0x59a998){_0x59a998(null,path[_0x0ab0('0x26')](config[_0x0ab0('0x27')],_0x0ab0('0x2e')));},'filename':function(_0x2afb7c,_0x119e87,_0x59152a){_0x59152a(null,util[_0x0ab0('0x29')](_0x0ab0('0x2a'),Date[_0x0ab0('0x2f')](),_0x119e87[_0x0ab0('0x30')]));}})});router['post']('/:id/customer_avatar',upload[_0x0ab0('0x2c')](_0x0ab0('0x33')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25b0ee,_0x5eac33,_0x4cce73){_0x4cce73(null,path[_0x0ab0('0x26')](config[_0x0ab0('0x27')],_0x0ab0('0x2e')));},'filename':function(_0x13cb77,_0x5991bc,_0xceaacb){_0xceaacb(null,util['format'](_0x0ab0('0x2a'),Date[_0x0ab0('0x2f')](),_0x5991bc[_0x0ab0('0x30')]));}})});router[_0x0ab0('0x21')](_0x0ab0('0x34'),upload[_0x0ab0('0x2c')](_0x0ab0('0x33')),controller[_0x0ab0('0x35')]);router['post']('/:id/notify',controller[_0x0ab0('0x36')]);router[_0x0ab0('0x21')](_0x0ab0('0x37'),controller['offline']);router[_0x0ab0('0x21')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x0ab0('0x38')]);router[_0x0ab0('0x21')](_0x0ab0('0x18'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x39')]);router[_0x0ab0('0x21')](_0x0ab0('0x1a'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x3a')]);router[_0x0ab0('0x21')](_0x0ab0('0x20'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x3b')]);router['put'](_0x0ab0('0xb'),auth[_0x0ab0('0x9')](),controller['update']);router['delete'](_0x0ab0('0xb'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x3c')]);router[_0x0ab0('0x3d')]('/:id/dispositions',auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x3e')]);router['delete'](_0x0ab0('0xe'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x3f')]);router['delete'](_0x0ab0('0x20'),auth[_0x0ab0('0x9')](),controller[_0x0ab0('0x40')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 22f5f06..daa87fe 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 _0xaa48=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x19262e,_0x1e03ef){var _0x486285=function(_0x4b6409){while(--_0x4b6409){_0x19262e['push'](_0x19262e['shift']());}};_0x486285(++_0x1e03ef);}(_0xaa48,0x15a));var _0x8aa4=function(_0x179625,_0x927c7){_0x179625=_0x179625-0x0;var _0x1db239=_0xaa48[_0x179625];return _0x1db239;};'use strict';var Sequelize=require(_0x8aa4('0x0'));module[_0x8aa4('0x1')]={'name':{'type':Sequelize[_0x8aa4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8aa4('0x3')](_0x8aa4('0x4'),_0x8aa4('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8aa4('0x2')]},'data2':{'type':Sequelize[_0x8aa4('0x2')]}}; \ No newline at end of file +var _0x6363=['STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x2702cf,_0x2ec174){var _0x12e1e2=function(_0x5368f0){while(--_0x5368f0){_0x2702cf['push'](_0x2702cf['shift']());}};_0x12e1e2(++_0x2ec174);}(_0x6363,0x13a));var _0x3636=function(_0x2c4832,_0x51e47){_0x2c4832=_0x2c4832-0x0;var _0x45defc=_0x6363[_0x2c4832];return _0x45defc;};'use strict';var Sequelize=require(_0x3636('0x0'));module['exports']={'name':{'type':Sequelize[_0x3636('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x3'),_0x3636('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3636('0x1')]},'data2':{'type':Sequelize[_0x3636('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index f5f59f2..00aaa28 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 _0x059f=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','rawAttributes','type','key','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','options','CloudProvider','includeAll','include','rows','catch','show','params','merge','find','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x5c1726,_0x27281a){var _0x20f183=function(_0x4ce740){while(--_0x4ce740){_0x5c1726['push'](_0x5c1726['shift']());}};_0x20f183(++_0x27281a);}(_0x059f,0x10f));var _0xf059=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x059f[_0x5a7e3c];return _0x59252b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf059('0x0'));var rimraf=require(_0xf059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf059('0x2'));var moment=require(_0xf059('0x3'));var BPromise=require(_0xf059('0x4'));var Mustache=require(_0xf059('0x5'));var util=require(_0xf059('0x6'));var path=require(_0xf059('0x7'));var sox=require(_0xf059('0x8'));var csv=require(_0xf059('0x9'));var ejs=require(_0xf059('0xa'));var fs=require('fs');var _=require(_0xf059('0xb'));var squel=require(_0xf059('0xc'));var crypto=require(_0xf059('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf059('0xe'));var toCsv=require(_0xf059('0x9'));var querystring=require(_0xf059('0xf'));var Papa=require(_0xf059('0x10'));var Redis=require(_0xf059('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf059('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf059('0x13'));var logger=require(_0xf059('0x14'))('api');var utils=require(_0xf059('0x15'));var config=require(_0xf059('0x16'));var db=require(_0xf059('0x17'))['db'];function respondWithStatusCode(_0x3ad9c7,_0x55284f){_0x55284f=_0x55284f||0xcc;return function(_0xc0e97f){if(_0xc0e97f){return _0x3ad9c7[_0xf059('0x18')](_0x55284f);}return _0x3ad9c7[_0xf059('0x19')](_0x55284f)[_0xf059('0x1a')]();};}function respondWithResult(_0x30e88c,_0x13a289){_0x13a289=_0x13a289||0xc8;return function(_0x55a3c4){if(_0x55a3c4){return _0x30e88c[_0xf059('0x19')](_0x13a289)[_0xf059('0x1b')](_0x55a3c4);}};}function respondWithFilteredResult(_0x199c68,_0x356ca9){return function(_0x19777f){if(_0x19777f){var _0x2c3368=_0x19777f[_0xf059('0x1c')],_0x1b2ef3=_0x356ca9[_0xf059('0x1d')],_0x4a2ece=_0x356ca9[_0xf059('0x1d')]+_0x356ca9[_0xf059('0x1e')],_0x295462;if(_0x4a2ece>=_0x2c3368){_0x4a2ece=_0x2c3368;_0x295462=0xc8;}else{_0x295462=0xce;}_0x199c68[_0xf059('0x19')](_0x295462);return _0x199c68[_0xf059('0x1f')]('Content-Range',_0x1b2ef3+'-'+_0x4a2ece+'/'+_0x2c3368)[_0xf059('0x1b')](_0x19777f);}return null;};}function patchUpdates(_0x5d1dbd){return function(_0x233da0){try{jsonpatch[_0xf059('0x20')](_0x233da0,_0x5d1dbd,!![]);}catch(_0x12d69c){return BPromise[_0xf059('0x21')](_0x12d69c);}return _0x233da0[_0xf059('0x22')]();};}function saveUpdates(_0x2b37b2,_0xedf98c){return function(_0x14ae24){if(_0x14ae24){return _0x14ae24[_0xf059('0x23')](_0x2b37b2)['then'](function(_0x24d020){return _0x24d020;});}return null;};}function removeEntity(_0x5a55ca,_0x38e131){return function(_0x52735a){if(_0x52735a){return _0x52735a[_0xf059('0x24')]()[_0xf059('0x25')](function(){_0x5a55ca[_0xf059('0x19')](0xcc)[_0xf059('0x1a')]();});}};}function handleEntityNotFound(_0x155c20,_0x43e55c){return function(_0x50717e){if(!_0x50717e){_0x155c20[_0xf059('0x18')](0x194);}return _0x50717e;};}function handleError(_0x5a883c,_0x54b615){_0x54b615=_0x54b615||0x1f4;return function(_0x12e052){logger[_0xf059('0x26')](_0x12e052[_0xf059('0x27')]);if(_0x12e052['name']){delete _0x12e052[_0xf059('0x28')];}_0x5a883c[_0xf059('0x19')](_0x54b615)[_0xf059('0x29')](_0x12e052);};}exports['index']=function(_0x51b775,_0x4b53fc){var _0x5740c7={},_0xe8055b={},_0x1746e2={'count':0x0,'rows':[]};var _0xbe4b06=_['map'](db['CloudProvider'][_0xf059('0x2a')],function(_0x579628){return{'name':_0x579628['fieldName'],'type':_0x579628[_0xf059('0x2b')][_0xf059('0x2c')]};});_0xe8055b['model']=_['map'](_0xbe4b06,_0xf059('0x28'));_0xe8055b['query']=_[_0xf059('0x2d')](_0x51b775['query']);_0xe8055b[_0xf059('0x2e')]=_[_0xf059('0x2f')](_0xe8055b['model'],_0xe8055b[_0xf059('0x30')]);_0x5740c7[_0xf059('0x31')]=_[_0xf059('0x2f')](_0xe8055b[_0xf059('0x32')],qs[_0xf059('0x33')](_0x51b775['query'][_0xf059('0x33')]));_0x5740c7[_0xf059('0x31')]=_0x5740c7[_0xf059('0x31')][_0xf059('0x34')]?_0x5740c7[_0xf059('0x31')]:_0xe8055b[_0xf059('0x32')];if(!_0x51b775['query'][_0xf059('0x35')](_0xf059('0x36'))){_0x5740c7['limit']=qs['limit'](_0x51b775['query']['limit']);_0x5740c7[_0xf059('0x1d')]=qs[_0xf059('0x1d')](_0x51b775['query'][_0xf059('0x1d')]);}_0x5740c7[_0xf059('0x37')]=qs[_0xf059('0x38')](_0x51b775[_0xf059('0x30')][_0xf059('0x38')]);_0x5740c7[_0xf059('0x39')]=qs[_0xf059('0x2e')](_['pick'](_0x51b775['query'],_0xe8055b[_0xf059('0x2e')]),_0xbe4b06);if(_0x51b775['query'][_0xf059('0x3a')]){_0x5740c7['where']=_['merge'](_0x5740c7['where'],{'$or':_[_0xf059('0x3b')](_0xbe4b06,function(_0x2f706b){if(_0x2f706b['type']!==_0xf059('0x3c')){var _0x52dac7={};_0x52dac7[_0x2f706b[_0xf059('0x28')]]={'$like':'%'+_0x51b775[_0xf059('0x30')]['filter']+'%'};return _0x52dac7;}})});}_0x5740c7=_['merge']({},_0x5740c7,_0x51b775[_0xf059('0x3d')]);var _0x5c7e0f={'where':_0x5740c7[_0xf059('0x39')]};return db[_0xf059('0x3e')][_0xf059('0x1c')](_0x5c7e0f)[_0xf059('0x25')](function(_0x8abcc6){_0x1746e2[_0xf059('0x1c')]=_0x8abcc6;if(_0x51b775['query'][_0xf059('0x3f')]){_0x5740c7[_0xf059('0x40')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x5740c7);})[_0xf059('0x25')](function(_0x452921){_0x1746e2[_0xf059('0x41')]=_0x452921;return _0x1746e2;})[_0xf059('0x25')](respondWithFilteredResult(_0x4b53fc,_0x5740c7))[_0xf059('0x42')](handleError(_0x4b53fc,null));};exports[_0xf059('0x43')]=function(_0xabbc6f,_0x34e425){var _0x330383={'raw':!![],'where':{'id':_0xabbc6f[_0xf059('0x44')]['id']}},_0x1c50b4={};_0x1c50b4[_0xf059('0x32')]=_[_0xf059('0x2d')](db['CloudProvider'][_0xf059('0x2a')]);_0x1c50b4['query']=_[_0xf059('0x2d')](_0xabbc6f[_0xf059('0x30')]);_0x1c50b4['filters']=_['intersection'](_0x1c50b4[_0xf059('0x32')],_0x1c50b4[_0xf059('0x30')]);_0x330383['attributes']=_['intersection'](_0x1c50b4[_0xf059('0x32')],qs['fields'](_0xabbc6f[_0xf059('0x30')]['fields']));_0x330383[_0xf059('0x31')]=_0x330383[_0xf059('0x31')][_0xf059('0x34')]?_0x330383[_0xf059('0x31')]:_0x1c50b4[_0xf059('0x32')];if(_0xabbc6f[_0xf059('0x30')][_0xf059('0x3f')]){_0x330383['include']=[{'all':!![]}];}_0x330383=_[_0xf059('0x45')]({},_0x330383,_0xabbc6f[_0xf059('0x3d')]);return db[_0xf059('0x3e')][_0xf059('0x46')](_0x330383)[_0xf059('0x25')](handleEntityNotFound(_0x34e425,null))[_0xf059('0x25')](respondWithResult(_0x34e425,null))['catch'](handleError(_0x34e425,null));};exports['create']=function(_0x311c71,_0x4a0f18){return db[_0xf059('0x3e')]['create'](_0x311c71[_0xf059('0x47')],{})['then'](respondWithResult(_0x4a0f18,0xc9))[_0xf059('0x42')](handleError(_0x4a0f18,null));};exports[_0xf059('0x23')]=function(_0x29d482,_0x3d80a7){if(_0x29d482[_0xf059('0x47')]['id']){delete _0x29d482[_0xf059('0x47')]['id'];}return db[_0xf059('0x3e')]['find']({'where':{'id':_0x29d482[_0xf059('0x44')]['id']}})[_0xf059('0x25')](handleEntityNotFound(_0x3d80a7,null))[_0xf059('0x25')](saveUpdates(_0x29d482[_0xf059('0x47')],null))['then'](respondWithResult(_0x3d80a7,null))['catch'](handleError(_0x3d80a7,null));};exports['destroy']=function(_0x5bd606,_0x16da8d){return db[_0xf059('0x3e')][_0xf059('0x46')]({'where':{'id':_0x5bd606[_0xf059('0x44')]['id']}})[_0xf059('0x25')](handleEntityNotFound(_0x16da8d,null))[_0xf059('0x25')](removeEntity(_0x16da8d,null))[_0xf059('0x42')](handleError(_0x16da8d,null));}; \ No newline at end of file +var _0xf50a=['rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','rows','catch','show','length','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','Content-Range','json','apply','update','then','destroy','end','sendStatus','error','stack','name','send','map','CloudProvider'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf50a,0xf9));var _0xaf50=function(_0x4c3296,_0x262566){_0x4c3296=_0x4c3296-0x0;var _0x5260de=_0xf50a[_0x4c3296];return _0x5260de;};'use strict';var pdf=require(_0xaf50('0x0'));var emlformat=require(_0xaf50('0x1'));var rimraf=require(_0xaf50('0x2'));var zipdir=require(_0xaf50('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf50('0x4'));var moment=require(_0xaf50('0x5'));var BPromise=require(_0xaf50('0x6'));var Mustache=require(_0xaf50('0x7'));var util=require(_0xaf50('0x8'));var path=require('path');var sox=require(_0xaf50('0x9'));var csv=require(_0xaf50('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaf50('0xb'));var squel=require(_0xaf50('0xc'));var crypto=require('crypto');var jsforce=require(_0xaf50('0xd'));var deskjs=require(_0xaf50('0xe'));var toCsv=require(_0xaf50('0xa'));var querystring=require('querystring');var Papa=require(_0xaf50('0xf'));var Redis=require('ioredis');var authService=require(_0xaf50('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf50('0x11'));var logger=require(_0xaf50('0x12'))(_0xaf50('0x13'));var utils=require(_0xaf50('0x14'));var config=require(_0xaf50('0x15'));var db=require(_0xaf50('0x16'))['db'];function respondWithStatusCode(_0x320f48,_0x828af){_0x828af=_0x828af||0xcc;return function(_0x462a8b){if(_0x462a8b){return _0x320f48['sendStatus'](_0x828af);}return _0x320f48[_0xaf50('0x17')](_0x828af)['end']();};}function respondWithResult(_0x5d55f9,_0x379f01){_0x379f01=_0x379f01||0xc8;return function(_0xfbad0f){if(_0xfbad0f){return _0x5d55f9[_0xaf50('0x17')](_0x379f01)['json'](_0xfbad0f);}};}function respondWithFilteredResult(_0x15459e,_0xba2125){return function(_0x4e443b){if(_0x4e443b){var _0x300c42=_0x4e443b['count'],_0x1d76dd=_0xba2125['offset'],_0x47d7a2=_0xba2125[_0xaf50('0x18')]+_0xba2125['limit'],_0x4063a1;if(_0x47d7a2>=_0x300c42){_0x47d7a2=_0x300c42;_0x4063a1=0xc8;}else{_0x4063a1=0xce;}_0x15459e[_0xaf50('0x17')](_0x4063a1);return _0x15459e['set'](_0xaf50('0x19'),_0x1d76dd+'-'+_0x47d7a2+'/'+_0x300c42)[_0xaf50('0x1a')](_0x4e443b);}return null;};}function patchUpdates(_0x13f9c4){return function(_0x195c8b){try{jsonpatch[_0xaf50('0x1b')](_0x195c8b,_0x13f9c4,!![]);}catch(_0x52b0f0){return BPromise['reject'](_0x52b0f0);}return _0x195c8b['save']();};}function saveUpdates(_0x499e57,_0x28b82d){return function(_0x272786){if(_0x272786){return _0x272786[_0xaf50('0x1c')](_0x499e57)[_0xaf50('0x1d')](function(_0x1bed5d){return _0x1bed5d;});}return null;};}function removeEntity(_0x22dacb,_0x4693d0){return function(_0x5ae106){if(_0x5ae106){return _0x5ae106[_0xaf50('0x1e')]()['then'](function(){_0x22dacb[_0xaf50('0x17')](0xcc)[_0xaf50('0x1f')]();});}};}function handleEntityNotFound(_0x55991c,_0x2f1099){return function(_0x3a83ff){if(!_0x3a83ff){_0x55991c[_0xaf50('0x20')](0x194);}return _0x3a83ff;};}function handleError(_0x5d1146,_0x235ba3){_0x235ba3=_0x235ba3||0x1f4;return function(_0x28261d){logger[_0xaf50('0x21')](_0x28261d[_0xaf50('0x22')]);if(_0x28261d['name']){delete _0x28261d[_0xaf50('0x23')];}_0x5d1146['status'](_0x235ba3)[_0xaf50('0x24')](_0x28261d);};}exports['index']=function(_0x43fb74,_0x3c00d9){var _0x5149ae={},_0x43ca2f={},_0x588dbb={'count':0x0,'rows':[]};var _0x3d5817=_[_0xaf50('0x25')](db[_0xaf50('0x26')][_0xaf50('0x27')],function(_0x3d0760){return{'name':_0x3d0760[_0xaf50('0x28')],'type':_0x3d0760[_0xaf50('0x29')][_0xaf50('0x2a')]};});_0x43ca2f['model']=_[_0xaf50('0x25')](_0x3d5817,'name');_0x43ca2f[_0xaf50('0x2b')]=_[_0xaf50('0x2c')](_0x43fb74[_0xaf50('0x2b')]);_0x43ca2f[_0xaf50('0x2d')]=_['intersection'](_0x43ca2f[_0xaf50('0x2e')],_0x43ca2f[_0xaf50('0x2b')]);_0x5149ae[_0xaf50('0x2f')]=_[_0xaf50('0x30')](_0x43ca2f['model'],qs[_0xaf50('0x31')](_0x43fb74[_0xaf50('0x2b')][_0xaf50('0x31')]));_0x5149ae[_0xaf50('0x2f')]=_0x5149ae[_0xaf50('0x2f')]['length']?_0x5149ae[_0xaf50('0x2f')]:_0x43ca2f[_0xaf50('0x2e')];if(!_0x43fb74[_0xaf50('0x2b')][_0xaf50('0x32')](_0xaf50('0x33'))){_0x5149ae['limit']=qs[_0xaf50('0x34')](_0x43fb74[_0xaf50('0x2b')][_0xaf50('0x34')]);_0x5149ae[_0xaf50('0x18')]=qs[_0xaf50('0x18')](_0x43fb74[_0xaf50('0x2b')][_0xaf50('0x18')]);}_0x5149ae[_0xaf50('0x35')]=qs['sort'](_0x43fb74[_0xaf50('0x2b')][_0xaf50('0x36')]);_0x5149ae[_0xaf50('0x37')]=qs[_0xaf50('0x2d')](_[_0xaf50('0x38')](_0x43fb74[_0xaf50('0x2b')],_0x43ca2f[_0xaf50('0x2d')]),_0x3d5817);if(_0x43fb74[_0xaf50('0x2b')]['filter']){_0x5149ae['where']=_[_0xaf50('0x39')](_0x5149ae[_0xaf50('0x37')],{'$or':_[_0xaf50('0x25')](_0x3d5817,function(_0x4e7284){if(_0x4e7284[_0xaf50('0x29')]!==_0xaf50('0x3a')){var _0x2f1dd1={};_0x2f1dd1[_0x4e7284['name']]={'$like':'%'+_0x43fb74['query'][_0xaf50('0x3b')]+'%'};return _0x2f1dd1;}})});}_0x5149ae=_[_0xaf50('0x39')]({},_0x5149ae,_0x43fb74[_0xaf50('0x3c')]);var _0xfef06b={'where':_0x5149ae[_0xaf50('0x37')]};return db['CloudProvider'][_0xaf50('0x3d')](_0xfef06b)[_0xaf50('0x1d')](function(_0x1e9426){_0x588dbb['count']=_0x1e9426;if(_0x43fb74[_0xaf50('0x2b')]['includeAll']){_0x5149ae['include']=[{'all':!![]}];}return db['CloudProvider'][_0xaf50('0x3e')](_0x5149ae);})[_0xaf50('0x1d')](function(_0x51e77c){_0x588dbb[_0xaf50('0x3f')]=_0x51e77c;return _0x588dbb;})[_0xaf50('0x1d')](respondWithFilteredResult(_0x3c00d9,_0x5149ae))[_0xaf50('0x40')](handleError(_0x3c00d9,null));};exports[_0xaf50('0x41')]=function(_0xc0fa1f,_0x6ce00c){var _0x16d519={'raw':!![],'where':{'id':_0xc0fa1f['params']['id']}},_0x1d6fb4={};_0x1d6fb4[_0xaf50('0x2e')]=_['keys'](db[_0xaf50('0x26')][_0xaf50('0x27')]);_0x1d6fb4['query']=_[_0xaf50('0x2c')](_0xc0fa1f['query']);_0x1d6fb4[_0xaf50('0x2d')]=_['intersection'](_0x1d6fb4[_0xaf50('0x2e')],_0x1d6fb4['query']);_0x16d519[_0xaf50('0x2f')]=_[_0xaf50('0x30')](_0x1d6fb4[_0xaf50('0x2e')],qs[_0xaf50('0x31')](_0xc0fa1f[_0xaf50('0x2b')][_0xaf50('0x31')]));_0x16d519[_0xaf50('0x2f')]=_0x16d519[_0xaf50('0x2f')][_0xaf50('0x42')]?_0x16d519[_0xaf50('0x2f')]:_0x1d6fb4[_0xaf50('0x2e')];if(_0xc0fa1f['query'][_0xaf50('0x43')]){_0x16d519['include']=[{'all':!![]}];}_0x16d519=_[_0xaf50('0x39')]({},_0x16d519,_0xc0fa1f['options']);return db['CloudProvider'][_0xaf50('0x44')](_0x16d519)[_0xaf50('0x1d')](handleEntityNotFound(_0x6ce00c,null))[_0xaf50('0x1d')](respondWithResult(_0x6ce00c,null))['catch'](handleError(_0x6ce00c,null));};exports[_0xaf50('0x45')]=function(_0x1743c6,_0x246e45){return db[_0xaf50('0x26')][_0xaf50('0x45')](_0x1743c6[_0xaf50('0x46')],{})[_0xaf50('0x1d')](respondWithResult(_0x246e45,0xc9))[_0xaf50('0x40')](handleError(_0x246e45,null));};exports[_0xaf50('0x1c')]=function(_0x470fc2,_0x61e411){if(_0x470fc2[_0xaf50('0x46')]['id']){delete _0x470fc2[_0xaf50('0x46')]['id'];}return db[_0xaf50('0x26')][_0xaf50('0x44')]({'where':{'id':_0x470fc2[_0xaf50('0x47')]['id']}})['then'](handleEntityNotFound(_0x61e411,null))['then'](saveUpdates(_0x470fc2['body'],null))[_0xaf50('0x1d')](respondWithResult(_0x61e411,null))[_0xaf50('0x40')](handleError(_0x61e411,null));};exports['destroy']=function(_0x1c3a68,_0x107588){return db[_0xaf50('0x26')][_0xaf50('0x44')]({'where':{'id':_0x1c3a68[_0xaf50('0x47')]['id']}})[_0xaf50('0x1d')](handleEntityNotFound(_0x107588,null))[_0xaf50('0x1d')](removeEntity(_0x107588,null))[_0xaf50('0x40')](handleError(_0x107588,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d6b3c38..a2aaca1 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 _0x485a=['define','CloudProvider','lodash','util','moment','bluebird','path','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x154bec,_0x1a35ef){var _0x509a71=function(_0xc970bf){while(--_0xc970bf){_0x154bec['push'](_0x154bec['shift']());}};_0x509a71(++_0x1a35ef);}(_0x485a,0x142));var _0xa485=function(_0x3d1257,_0x182816){_0x3d1257=_0x3d1257-0x0;var _0x2dd9bb=_0x485a[_0x3d1257];return _0x2dd9bb;};'use strict';var _=require(_0xa485('0x0'));var util=require(_0xa485('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa485('0x2'));var BPromise=require(_0xa485('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa485('0x4'));var rimraf=require('rimraf');var config=require(_0xa485('0x5'));var attributes=require(_0xa485('0x6'));module[_0xa485('0x7')]=function(_0x3f9937,_0x1a163f){return _0x3f9937[_0xa485('0x8')](_0xa485('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b0a=['api','moment','bluebird','request-promise','../../config/environment','exports','define','CloudProvider','../../config/logger'];(function(_0x48c02e,_0x210faf){var _0x1ebf1a=function(_0x269639){while(--_0x269639){_0x48c02e['push'](_0x48c02e['shift']());}};_0x1ebf1a(++_0x210faf);}(_0x1b0a,0x194));var _0xa1b0=function(_0xdde39c,_0x329888){_0xdde39c=_0xdde39c-0x0;var _0x122ea7=_0x1b0a[_0xdde39c];return _0x122ea7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa1b0('0x0'))(_0xa1b0('0x1'));var moment=require(_0xa1b0('0x2'));var BPromise=require(_0xa1b0('0x3'));var rp=require(_0xa1b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa1b0('0x5'));var attributes=require('./cloudProvider.attributes');module[_0xa1b0('0x6')]=function(_0x17616b,_0x5a2cf2){return _0x17616b[_0xa1b0('0x7')](_0xa1b0('0x8'),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 3a29d31..16c133b 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 _0x3fa4=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x74d873,_0x2b005f){var _0x36af3d=function(_0x1a1c04){while(--_0x1a1c04){_0x74d873['push'](_0x74d873['shift']());}};_0x36af3d(++_0x2b005f);}(_0x3fa4,0x1b7));var _0x43fa=function(_0x1fbf43,_0x4af2cd){_0x1fbf43=_0x1fbf43-0x0;var _0x399e21=_0x3fa4[_0x1fbf43];return _0x399e21;};'use strict';var _=require('lodash');var util=require(_0x43fa('0x0'));var moment=require(_0x43fa('0x1'));var BPromise=require('bluebird');var rs=require(_0x43fa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43fa('0x3'))['db'];var utils=require(_0x43fa('0x4'));var logger=require(_0x43fa('0x5'))(_0x43fa('0x6'));var config=require(_0x43fa('0x7'));var jayson=require(_0x43fa('0x8'));var client=jayson[_0x43fa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f47c,_0x507fcd,_0x58c26e){return new BPromise(function(_0x8ed522,_0x289d58){return client[_0x43fa('0xa')](_0x5f47c,_0x58c26e)[_0x43fa('0xb')](function(_0x2da6f7){logger[_0x43fa('0xc')](_0x43fa('0xd'),_0x507fcd,_0x43fa('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x507fcd,_0x43fa('0xe'),JSON[_0x43fa('0xf')](_0x2da6f7));if(_0x2da6f7[_0x43fa('0x10')]){if(_0x2da6f7[_0x43fa('0x10')][_0x43fa('0x11')]===0x1f4){logger[_0x43fa('0x10')]('CloudProvider,\x20%s,\x20%s',_0x507fcd,_0x2da6f7[_0x43fa('0x10')][_0x43fa('0x12')]);return _0x289d58(_0x2da6f7[_0x43fa('0x10')][_0x43fa('0x12')]);}logger[_0x43fa('0x10')]('CloudProvider,\x20%s,\x20%s',_0x507fcd,_0x2da6f7[_0x43fa('0x10')][_0x43fa('0x12')]);return _0x8ed522(_0x2da6f7['error'][_0x43fa('0x12')]);}else{logger[_0x43fa('0xc')]('CloudProvider,\x20%s,\x20%s',_0x507fcd,_0x43fa('0xe'));_0x8ed522(_0x2da6f7[_0x43fa('0x13')][_0x43fa('0x12')]);}})[_0x43fa('0x14')](function(_0x4c6ff8){logger[_0x43fa('0x10')]('CloudProvider,\x20%s,\x20%s',_0x507fcd,_0x4c6ff8);_0x289d58(_0x4c6ff8);});});} \ No newline at end of file +var _0x369b=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x369b,0x1a5));var _0xb369=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x369b[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xb369('0x0'));var util=require(_0xb369('0x1'));var moment=require(_0xb369('0x2'));var BPromise=require(_0xb369('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb369('0x4'));var db=require(_0xb369('0x5'))['db'];var utils=require(_0xb369('0x6'));var logger=require('../../config/logger')(_0xb369('0x7'));var config=require(_0xb369('0x8'));var jayson=require(_0xb369('0x9'));var client=jayson[_0xb369('0xa')][_0xb369('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b0c88,_0x41d296,_0x3299df){return new BPromise(function(_0x430084,_0x43b114){return client[_0xb369('0xc')](_0x4b0c88,_0x3299df)[_0xb369('0xd')](function(_0x4694ca){logger[_0xb369('0xe')](_0xb369('0xf'),_0x41d296,_0xb369('0x10'));logger['debug'](_0xb369('0x11'),_0x41d296,'request\x20sent',JSON[_0xb369('0x12')](_0x4694ca));if(_0x4694ca[_0xb369('0x13')]){if(_0x4694ca[_0xb369('0x13')][_0xb369('0x14')]===0x1f4){logger[_0xb369('0x13')](_0xb369('0xf'),_0x41d296,_0x4694ca[_0xb369('0x13')][_0xb369('0x15')]);return _0x43b114(_0x4694ca['error']['message']);}logger[_0xb369('0x13')](_0xb369('0xf'),_0x41d296,_0x4694ca[_0xb369('0x13')][_0xb369('0x15')]);return _0x430084(_0x4694ca[_0xb369('0x13')]['message']);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x41d296,_0xb369('0x10'));_0x430084(_0x4694ca[_0xb369('0x16')][_0xb369('0x15')]);}})[_0xb369('0x17')](function(_0xd1623e){logger['error'](_0xb369('0xf'),_0x41d296,_0xd1623e);_0x43b114(_0xd1623e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5505e4e..df6c140 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 _0x05db=['Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0xb92c7c,_0x2ab6f0){var _0xa8c251=function(_0x5762cb){while(--_0x5762cb){_0xb92c7c['push'](_0xb92c7c['shift']());}};_0xa8c251(++_0x2ab6f0);}(_0x05db,0xdd));var _0xb05d=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0x05db[_0x1af0e5];return _0x3c444a;};'use strict';var multer=require('multer');var util=require(_0xb05d('0x0'));var path=require(_0xb05d('0x1'));var timeout=require(_0xb05d('0x2'));var express=require('express');var router=express[_0xb05d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb05d('0x4'));var controller=require('./cloudProvider.controller');router[_0xb05d('0x5')]('/',auth[_0xb05d('0x6')](),controller[_0xb05d('0x7')]);router['get'](_0xb05d('0x8'),auth[_0xb05d('0x6')](),controller[_0xb05d('0x9')]);router[_0xb05d('0xa')]('/',auth[_0xb05d('0x6')](),controller[_0xb05d('0xb')]);router[_0xb05d('0xc')](_0xb05d('0x8'),auth[_0xb05d('0x6')](),controller['update']);router[_0xb05d('0xd')](_0xb05d('0x8'),auth[_0xb05d('0x6')](),controller[_0xb05d('0xe')]);module[_0xb05d('0xf')]=router; \ No newline at end of file +var _0x7622=['create','put','update','exports','multer','path','express','Router','./cloudProvider.controller','index','get','/:id','isAuthenticated','show'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7622,0xba));var _0x2762=function(_0xf0c56a,_0x5a0beb){_0xf0c56a=_0xf0c56a-0x0;var _0x23b4ac=_0x7622[_0xf0c56a];return _0x23b4ac;};'use strict';var multer=require(_0x2762('0x0'));var util=require('util');var path=require(_0x2762('0x1'));var timeout=require('connect-timeout');var express=require(_0x2762('0x2'));var router=express[_0x2762('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2762('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x2762('0x5')]);router[_0x2762('0x6')](_0x2762('0x7'),auth[_0x2762('0x8')](),controller[_0x2762('0x9')]);router['post']('/',auth[_0x2762('0x8')](),controller[_0x2762('0xa')]);router[_0x2762('0xb')]('/:id',auth[_0x2762('0x8')](),controller[_0x2762('0xc')]);router['delete'](_0x2762('0x7'),auth[_0x2762('0x8')](),controller['destroy']);module[_0x2762('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 352d9dd..ea9f932 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 _0xa70d=['STRING'];(function(_0x3a64da,_0x386dc7){var _0x42d0a0=function(_0x35c515){while(--_0x35c515){_0x3a64da['push'](_0x3a64da['shift']());}};_0x42d0a0(++_0x386dc7);}(_0xa70d,0x131));var _0xda70=function(_0x4979fa,_0x261dad){_0x4979fa=_0x4979fa-0x0;var _0x164ed9=_0xa70d[_0x4979fa];return _0x164ed9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xda70('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xda70('0x0')]},'website':{'type':Sequelize[_0xda70('0x0')]},'phone':{'type':Sequelize[_0xda70('0x0')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xda70('0x0')]},'city':{'type':Sequelize[_0xda70('0x0')]},'country':{'type':Sequelize[_0xda70('0x0')]},'email':{'type':Sequelize[_0xda70('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xda70('0x0')]},'sStreet':{'type':Sequelize[_0xda70('0x0')]},'sPostalCode':{'type':Sequelize[_0xda70('0x0')]},'sCity':{'type':Sequelize[_0xda70('0x0')]},'sCountry':{'type':Sequelize[_0xda70('0x0')]},'description':{'type':Sequelize[_0xda70('0x0')]}}; \ No newline at end of file +var _0x0fb4=['sequelize','exports','STRING'];(function(_0x55e724,_0x8f22f1){var _0x1b317c=function(_0x21d4dd){while(--_0x21d4dd){_0x55e724['push'](_0x55e724['shift']());}};_0x1b317c(++_0x8f22f1);}(_0x0fb4,0x114));var _0x40fb=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0x0fb4[_0x44ca6e];return _0x2edab2;};'use strict';var Sequelize=require(_0x40fb('0x0'));module[_0x40fb('0x1')]={'name':{'type':Sequelize[_0x40fb('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x40fb('0x2')]},'companyId':{'type':Sequelize[_0x40fb('0x2')]},'website':{'type':Sequelize[_0x40fb('0x2')]},'phone':{'type':Sequelize[_0x40fb('0x2')]},'fax':{'type':Sequelize[_0x40fb('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x40fb('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x40fb('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x40fb('0x2')]},'sStreet':{'type':Sequelize[_0x40fb('0x2')]},'sPostalCode':{'type':Sequelize[_0x40fb('0x2')]},'sCity':{'type':Sequelize[_0x40fb('0x2')]},'sCountry':{'type':Sequelize[_0x40fb('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 96d090b..8b2d2d7 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 _0x8183=['rows','catch','show','params','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','findOne','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','reject','save','update','destroy','then','get','UserProfileResource','stack','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll'];(function(_0x4e6932,_0x4ea5af){var _0x513beb=function(_0x31da6a){while(--_0x31da6a){_0x4e6932['push'](_0x4e6932['shift']());}};_0x513beb(++_0x4ea5af);}(_0x8183,0x167));var _0x3818=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x8183[_0xbc4560];return _0x298cfb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3818('0x0'));var zipdir=require(_0x3818('0x1'));var jsonpatch=require(_0x3818('0x2'));var rp=require(_0x3818('0x3'));var moment=require(_0x3818('0x4'));var BPromise=require(_0x3818('0x5'));var Mustache=require(_0x3818('0x6'));var util=require(_0x3818('0x7'));var path=require('path');var sox=require(_0x3818('0x8'));var csv=require(_0x3818('0x9'));var ejs=require(_0x3818('0xa'));var fs=require('fs');var _=require(_0x3818('0xb'));var squel=require(_0x3818('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3818('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3818('0xe'));var Papa=require(_0x3818('0xf'));var Redis=require(_0x3818('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3818('0x11'));var as=require(_0x3818('0x12'));var hardwareService=require(_0x3818('0x13'));var logger=require(_0x3818('0x14'))('api');var utils=require(_0x3818('0x15'));var config=require(_0x3818('0x16'));var db=require(_0x3818('0x17'))['db'];function respondWithStatusCode(_0x229d4a,_0x4b6712){_0x4b6712=_0x4b6712||0xcc;return function(_0x41804a){if(_0x41804a){return _0x229d4a['sendStatus'](_0x4b6712);}return _0x229d4a[_0x3818('0x18')](_0x4b6712)[_0x3818('0x19')]();};}function respondWithResult(_0x33eaee,_0x52f657){_0x52f657=_0x52f657||0xc8;return function(_0x592502){if(_0x592502){return _0x33eaee[_0x3818('0x18')](_0x52f657)['json'](_0x592502);}};}function respondWithFilteredResult(_0x2a0860,_0x59253e){return function(_0xe93bce){if(_0xe93bce){var _0x489ae0=_0xe93bce[_0x3818('0x1a')],_0x1ee2c0=_0x59253e[_0x3818('0x1b')],_0x3a33f6=_0x59253e[_0x3818('0x1b')]+_0x59253e[_0x3818('0x1c')],_0x2f9a93;if(_0x3a33f6>=_0x489ae0){_0x3a33f6=_0x489ae0;_0x2f9a93=0xc8;}else{_0x2f9a93=0xce;}_0x2a0860[_0x3818('0x18')](_0x2f9a93);return _0x2a0860[_0x3818('0x1d')]('Content-Range',_0x1ee2c0+'-'+_0x3a33f6+'/'+_0x489ae0)['json'](_0xe93bce);}return null;};}function patchUpdates(_0x336dfa){return function(_0x23edda){try{jsonpatch['apply'](_0x23edda,_0x336dfa,!![]);}catch(_0x5b9ba6){return BPromise[_0x3818('0x1e')](_0x5b9ba6);}return _0x23edda[_0x3818('0x1f')]();};}function saveUpdates(_0x427f0e,_0x5d8e0b){return function(_0x1f7514){if(_0x1f7514){return _0x1f7514[_0x3818('0x20')](_0x427f0e)['then'](function(_0x471a5f){return _0x471a5f;});}return null;};}function removeEntity(_0x53926c,_0x40d451){return function(_0x359580){if(_0x359580){return _0x359580[_0x3818('0x21')]()[_0x3818('0x22')](function(){var _0x429f1a=_0x359580[_0x3818('0x23')]({'plain':!![]});var _0x10dfbb='Companies';return db[_0x3818('0x24')][_0x3818('0x21')]({'where':{'type':_0x10dfbb,'resourceId':_0x429f1a['id']}})[_0x3818('0x22')](function(){return _0x359580;});})[_0x3818('0x22')](function(){_0x53926c['status'](0xcc)[_0x3818('0x19')]();});}};}function handleEntityNotFound(_0x1cc225,_0x1f314c){return function(_0x48cf70){if(!_0x48cf70){_0x1cc225['sendStatus'](0x194);}return _0x48cf70;};}function handleError(_0x517db3,_0x4f1f21){_0x4f1f21=_0x4f1f21||0x1f4;return function(_0x323dec){logger['error'](_0x323dec[_0x3818('0x25')]);if(_0x323dec['name']){delete _0x323dec['name'];}_0x517db3[_0x3818('0x18')](_0x4f1f21)[_0x3818('0x26')](_0x323dec);};}exports[_0x3818('0x27')]=function(_0x5834f7,_0x58d428){var _0x43438b={},_0x3fcf50={},_0x18e413={'count':0x0,'rows':[]};return db[_0x3818('0x28')][_0x3818('0x29')]()['then'](function(_0x41442e){_0x3fcf50[_0x3818('0x2a')]=_[_0x3818('0x2b')](_0x41442e);_0x3fcf50['query']=_[_0x3818('0x2b')](_0x5834f7[_0x3818('0x2c')]);_0x3fcf50[_0x3818('0x2d')]=_['intersection'](_0x3fcf50[_0x3818('0x2a')],_0x3fcf50[_0x3818('0x2c')]);_0x43438b[_0x3818('0x2e')]=_[_0x3818('0x2f')](_0x3fcf50[_0x3818('0x2a')],qs[_0x3818('0x30')](_0x5834f7[_0x3818('0x2c')][_0x3818('0x30')]));_0x43438b[_0x3818('0x2e')]=_0x43438b[_0x3818('0x2e')][_0x3818('0x31')]?_0x43438b[_0x3818('0x2e')]:_0x3fcf50['model'];if(!_0x5834f7[_0x3818('0x2c')][_0x3818('0x32')](_0x3818('0x33'))){_0x43438b[_0x3818('0x1c')]=qs[_0x3818('0x1c')](_0x5834f7[_0x3818('0x2c')][_0x3818('0x1c')]);_0x43438b['offset']=qs['offset'](_0x5834f7[_0x3818('0x2c')][_0x3818('0x1b')]);}_0x43438b[_0x3818('0x34')]=qs['sort'](_0x5834f7[_0x3818('0x2c')][_0x3818('0x35')]);_0x43438b[_0x3818('0x36')]=qs[_0x3818('0x2d')](_[_0x3818('0x37')](_0x5834f7[_0x3818('0x2c')],_0x3fcf50['filters']),_0x41442e);if(_0x5834f7[_0x3818('0x2c')][_0x3818('0x38')]){_0x43438b[_0x3818('0x36')]=_[_0x3818('0x39')](_0x43438b[_0x3818('0x36')],{'$or':_['map'](_0x43438b[_0x3818('0x2e')],function(_0x257a06){var _0x10a069={};_0x10a069[_0x257a06]={'$like':'%'+_0x5834f7[_0x3818('0x2c')][_0x3818('0x38')]+'%'};return _0x10a069;})});}_0x43438b=_['merge']({},_0x43438b,_0x5834f7[_0x3818('0x3a')]);var _0x3fb8fc={'where':_0x43438b['where']};return db[_0x3818('0x28')][_0x3818('0x1a')](_0x3fb8fc)['then'](function(_0x3e5c0d){_0x18e413[_0x3818('0x1a')]=_0x3e5c0d;if(_0x5834f7[_0x3818('0x2c')]['includeAll']){_0x43438b[_0x3818('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0x3818('0x3c')](_0x43438b);})[_0x3818('0x22')](function(_0x50f1d1){_0x18e413[_0x3818('0x3d')]=_0x50f1d1;return _0x18e413;})[_0x3818('0x22')](respondWithFilteredResult(_0x58d428,_0x43438b))[_0x3818('0x3e')](handleError(_0x58d428,null));})[_0x3818('0x3e')](handleError(_0x58d428,null));};exports[_0x3818('0x3f')]=function(_0xb803eb,_0x50be4c){var _0x37f835={'raw':![],'where':{'id':_0xb803eb[_0x3818('0x40')]['id']}},_0x27a25b={};_0x27a25b[_0x3818('0x2a')]=_[_0x3818('0x2b')](db[_0x3818('0x28')][_0x3818('0x41')]);_0x27a25b[_0x3818('0x2c')]=_[_0x3818('0x2b')](_0xb803eb['query']);_0x27a25b['filters']=_[_0x3818('0x2f')](_0x27a25b[_0x3818('0x2a')],_0x27a25b[_0x3818('0x2c')]);_0x37f835[_0x3818('0x2e')]=_['intersection'](_0x27a25b[_0x3818('0x2a')],qs['fields'](_0xb803eb[_0x3818('0x2c')][_0x3818('0x30')]));_0x37f835[_0x3818('0x2e')]=_0x37f835[_0x3818('0x2e')][_0x3818('0x31')]?_0x37f835[_0x3818('0x2e')]:_0x27a25b['model'];if(_0xb803eb[_0x3818('0x2c')]['includeAll']){_0x37f835[_0x3818('0x3b')]=[{'all':!![]}];}_0x37f835=_[_0x3818('0x39')]({},_0x37f835,_0xb803eb[_0x3818('0x3a')]);return db[_0x3818('0x28')][_0x3818('0x42')](_0x37f835)['then'](handleEntityNotFound(_0x50be4c,null))[_0x3818('0x22')](respondWithResult(_0x50be4c,null))['catch'](handleError(_0x50be4c,null));};exports['create']=function(_0x285f77,_0x579443){return db[_0x3818('0x28')]['create'](_0x285f77['body'],{})[_0x3818('0x22')](function(_0x29358d){var _0x27599a=_0x285f77[_0x3818('0x43')][_0x3818('0x23')]({'plain':!![]});if(!_0x27599a)throw new Error(_0x3818('0x44'));if(_0x27599a[_0x3818('0x45')]===_0x3818('0x43')){var _0x4e8468=_0x29358d[_0x3818('0x23')]({'plain':!![]});var _0x51a984=_0x3818('0x46');return db[_0x3818('0x47')]['find']({'where':{'name':_0x51a984,'userProfileId':_0x27599a[_0x3818('0x48')]},'raw':!![]})[_0x3818('0x22')](function(_0xe40c4){if(_0xe40c4&&_0xe40c4[_0x3818('0x49')]===0x0){return db[_0x3818('0x24')]['create']({'name':_0x4e8468[_0x3818('0x4a')],'resourceId':_0x4e8468['id'],'type':_0xe40c4[_0x3818('0x4a')],'sectionId':_0xe40c4['id']},{})[_0x3818('0x22')](function(){return _0x29358d;});}else{return _0x29358d;}})[_0x3818('0x3e')](function(_0x19a793){logger[_0x3818('0x4b')](_0x3818('0x4c'),_0x19a793);throw _0x19a793;});}return _0x29358d;})[_0x3818('0x22')](respondWithResult(_0x579443,0xc9))[_0x3818('0x3e')](handleError(_0x579443,null));};exports[_0x3818('0x20')]=function(_0x15df85,_0xdf255f){if(_0x15df85[_0x3818('0x4d')]['id']){delete _0x15df85[_0x3818('0x4d')]['id'];}return db['CmCompany'][_0x3818('0x42')]({'where':{'id':_0x15df85[_0x3818('0x40')]['id']}})[_0x3818('0x22')](handleEntityNotFound(_0xdf255f,null))[_0x3818('0x22')](saveUpdates(_0x15df85[_0x3818('0x4d')],null))['then'](respondWithResult(_0xdf255f,null))['catch'](handleError(_0xdf255f,null));};exports[_0x3818('0x21')]=function(_0x39d7ce,_0x518e12){return db[_0x3818('0x28')][_0x3818('0x42')]({'where':{'id':_0x39d7ce[_0x3818('0x40')]['id']}})[_0x3818('0x22')](handleEntityNotFound(_0x518e12,null))[_0x3818('0x22')](removeEntity(_0x518e12,null))[_0x3818('0x3e')](handleError(_0x518e12,null));};exports[_0x3818('0x29')]=function(_0x11c8e4,_0x2b5cc9){return db[_0x3818('0x28')][_0x3818('0x29')]()[_0x3818('0x22')](respondWithResult(_0x2b5cc9,null))[_0x3818('0x3e')](handleError(_0x2b5cc9,null));};exports[_0x3818('0x4e')]=function(_0xf9a637,_0x22ed53,_0x2366df){return db[_0x3818('0x4f')][_0x3818('0x42')]({'where':{'id':_0xf9a637[_0x3818('0x40')]['id']}})[_0x3818('0x22')](handleEntityNotFound(_0x22ed53,null))[_0x3818('0x22')](function(_0x4f2be3){if(_0x4f2be3){return _0x4f2be3['addContacts'](_0xf9a637['body'][_0x3818('0x50')],_[_0x3818('0x51')](_0xf9a637['body'],[_0x3818('0x50'),'id'])||{});}})[_0x3818('0x22')](respondWithResult(_0x22ed53,null))['catch'](handleError(_0x22ed53,null));};exports['getContacts']=function(_0x13040f,_0x4bdf5c,_0x5a2186){var _0x563ea5={};var _0x57f443={};var _0x2238f2;var _0x49c01a;return db[_0x3818('0x28')][_0x3818('0x52')]({'where':{'id':_0x13040f['params']['id']}})[_0x3818('0x22')](handleEntityNotFound(_0x4bdf5c,null))[_0x3818('0x22')](function(_0x20c634){if(_0x20c634){_0x2238f2=_0x20c634;_0x57f443[_0x3818('0x2a')]=_[_0x3818('0x2b')](db[_0x3818('0x4f')][_0x3818('0x41')]);_0x57f443[_0x3818('0x2c')]=_[_0x3818('0x2b')](_0x13040f[_0x3818('0x2c')]);_0x57f443[_0x3818('0x2d')]=_[_0x3818('0x2f')](_0x57f443[_0x3818('0x2a')],_0x57f443[_0x3818('0x2c')]);_0x563ea5['attributes']=_['intersection'](_0x57f443[_0x3818('0x2a')],qs[_0x3818('0x30')](_0x13040f[_0x3818('0x2c')][_0x3818('0x30')]));_0x563ea5[_0x3818('0x2e')]=_0x563ea5[_0x3818('0x2e')][_0x3818('0x31')]?_0x563ea5[_0x3818('0x2e')]:_0x57f443['model'];_0x563ea5[_0x3818('0x34')]=qs[_0x3818('0x35')](_0x13040f[_0x3818('0x2c')][_0x3818('0x35')]);_0x563ea5['where']=qs['filters'](_[_0x3818('0x37')](_0x13040f['query'],_0x57f443[_0x3818('0x2d')]));if(_0x13040f[_0x3818('0x2c')][_0x3818('0x38')]){_0x563ea5['where']=_[_0x3818('0x39')](_0x563ea5[_0x3818('0x36')],{'$or':_['map'](_0x563ea5[_0x3818('0x2e')],function(_0x127023){var _0x48577f={};_0x48577f[_0x127023]={'$like':'%'+_0x13040f[_0x3818('0x2c')][_0x3818('0x38')]+'%'};return _0x48577f;})});}_0x563ea5=_[_0x3818('0x39')]({},_0x563ea5,_0x13040f[_0x3818('0x3a')]);return _0x2238f2[_0x3818('0x53')](_0x563ea5);}})['then'](function(_0x2c7709){if(_0x2c7709){_0x49c01a=_0x2c7709[_0x3818('0x31')];if(!_0x13040f[_0x3818('0x2c')][_0x3818('0x32')]('nolimit')){_0x563ea5[_0x3818('0x1c')]=qs[_0x3818('0x1c')](_0x13040f[_0x3818('0x2c')][_0x3818('0x1c')]);_0x563ea5['offset']=qs[_0x3818('0x1b')](_0x13040f[_0x3818('0x2c')][_0x3818('0x1b')]);}return _0x2238f2[_0x3818('0x53')](_0x563ea5);}})[_0x3818('0x22')](function(_0x26263a){if(_0x26263a){return _0x26263a?{'count':_0x49c01a,'rows':_0x26263a}:null;}})[_0x3818('0x22')](respondWithResult(_0x4bdf5c,null))['catch'](handleError(_0x4bdf5c,null));}; \ No newline at end of file +var _0x5cf8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','sendStatus','error','name','send','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','options','findAll','rows','catch','show','params','CmCompany','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','omit','ids','getContacts','CmContact','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service'];(function(_0x673734,_0x3bd38c){var _0x22bf02=function(_0x1a7585){while(--_0x1a7585){_0x673734['push'](_0x673734['shift']());}};_0x22bf02(++_0x3bd38c);}(_0x5cf8,0x143));var _0x85cf=function(_0x36625f,_0x727bd6){_0x36625f=_0x36625f-0x0;var _0x135981=_0x5cf8[_0x36625f];return _0x135981;};'use strict';var pdf=require(_0x85cf('0x0'));var emlformat=require(_0x85cf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x85cf('0x2'));var jsonpatch=require(_0x85cf('0x3'));var rp=require(_0x85cf('0x4'));var moment=require(_0x85cf('0x5'));var BPromise=require(_0x85cf('0x6'));var Mustache=require(_0x85cf('0x7'));var util=require(_0x85cf('0x8'));var path=require('path');var sox=require(_0x85cf('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x85cf('0xa'));var squel=require('squel');var crypto=require(_0x85cf('0xb'));var jsforce=require(_0x85cf('0xc'));var deskjs=require(_0x85cf('0xd'));var toCsv=require(_0x85cf('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x85cf('0xf'));var authService=require(_0x85cf('0x10'));var qs=require(_0x85cf('0x11'));var as=require(_0x85cf('0x12'));var hardwareService=require(_0x85cf('0x13'));var logger=require(_0x85cf('0x14'))(_0x85cf('0x15'));var utils=require(_0x85cf('0x16'));var config=require(_0x85cf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c24ba,_0x294091){_0x294091=_0x294091||0xcc;return function(_0x1b7f4f){if(_0x1b7f4f){return _0x4c24ba['sendStatus'](_0x294091);}return _0x4c24ba[_0x85cf('0x18')](_0x294091)['end']();};}function respondWithResult(_0x16bbb1,_0x1fe83a){_0x1fe83a=_0x1fe83a||0xc8;return function(_0x5a243e){if(_0x5a243e){return _0x16bbb1['status'](_0x1fe83a)[_0x85cf('0x19')](_0x5a243e);}};}function respondWithFilteredResult(_0x20ac6f,_0x1cb612){return function(_0x212b77){if(_0x212b77){var _0x5d16ad=_0x212b77[_0x85cf('0x1a')],_0x22051=_0x1cb612[_0x85cf('0x1b')],_0x27dd71=_0x1cb612[_0x85cf('0x1b')]+_0x1cb612['limit'],_0x96bb86;if(_0x27dd71>=_0x5d16ad){_0x27dd71=_0x5d16ad;_0x96bb86=0xc8;}else{_0x96bb86=0xce;}_0x20ac6f['status'](_0x96bb86);return _0x20ac6f[_0x85cf('0x1c')](_0x85cf('0x1d'),_0x22051+'-'+_0x27dd71+'/'+_0x5d16ad)['json'](_0x212b77);}return null;};}function patchUpdates(_0xced2a2){return function(_0x53c96a){try{jsonpatch[_0x85cf('0x1e')](_0x53c96a,_0xced2a2,!![]);}catch(_0x61d230){return BPromise[_0x85cf('0x1f')](_0x61d230);}return _0x53c96a[_0x85cf('0x20')]();};}function saveUpdates(_0xb6e70e,_0x1b5299){return function(_0x3b74df){if(_0x3b74df){return _0x3b74df[_0x85cf('0x21')](_0xb6e70e)[_0x85cf('0x22')](function(_0x2f6527){return _0x2f6527;});}return null;};}function removeEntity(_0x52349f,_0x1156cb){return function(_0x3f63a3){if(_0x3f63a3){return _0x3f63a3[_0x85cf('0x23')]()[_0x85cf('0x22')](function(){var _0xf4aa29=_0x3f63a3['get']({'plain':!![]});var _0x1c1121='Companies';return db[_0x85cf('0x24')][_0x85cf('0x23')]({'where':{'type':_0x1c1121,'resourceId':_0xf4aa29['id']}})['then'](function(){return _0x3f63a3;});})['then'](function(){_0x52349f[_0x85cf('0x18')](0xcc)[_0x85cf('0x25')]();});}};}function handleEntityNotFound(_0x485f15,_0x543624){return function(_0xfa4768){if(!_0xfa4768){_0x485f15[_0x85cf('0x26')](0x194);}return _0xfa4768;};}function handleError(_0x2f67cc,_0x34cb4b){_0x34cb4b=_0x34cb4b||0x1f4;return function(_0x583231){logger[_0x85cf('0x27')](_0x583231['stack']);if(_0x583231[_0x85cf('0x28')]){delete _0x583231[_0x85cf('0x28')];}_0x2f67cc[_0x85cf('0x18')](_0x34cb4b)[_0x85cf('0x29')](_0x583231);};}exports['index']=function(_0x30733b,_0x3d5695){var _0x386fb5={},_0x11e113={},_0x4f6bed={'count':0x0,'rows':[]};return db['CmCompany'][_0x85cf('0x2a')]()['then'](function(_0x48d920){_0x11e113[_0x85cf('0x2b')]=_[_0x85cf('0x2c')](_0x48d920);_0x11e113[_0x85cf('0x2d')]=_['keys'](_0x30733b[_0x85cf('0x2d')]);_0x11e113[_0x85cf('0x2e')]=_[_0x85cf('0x2f')](_0x11e113[_0x85cf('0x2b')],_0x11e113[_0x85cf('0x2d')]);_0x386fb5[_0x85cf('0x30')]=_['intersection'](_0x11e113[_0x85cf('0x2b')],qs['fields'](_0x30733b[_0x85cf('0x2d')][_0x85cf('0x31')]));_0x386fb5[_0x85cf('0x30')]=_0x386fb5['attributes'][_0x85cf('0x32')]?_0x386fb5[_0x85cf('0x30')]:_0x11e113['model'];if(!_0x30733b[_0x85cf('0x2d')][_0x85cf('0x33')](_0x85cf('0x34'))){_0x386fb5[_0x85cf('0x35')]=qs[_0x85cf('0x35')](_0x30733b['query']['limit']);_0x386fb5['offset']=qs['offset'](_0x30733b[_0x85cf('0x2d')]['offset']);}_0x386fb5[_0x85cf('0x36')]=qs['sort'](_0x30733b[_0x85cf('0x2d')][_0x85cf('0x37')]);_0x386fb5['where']=qs[_0x85cf('0x2e')](_[_0x85cf('0x38')](_0x30733b[_0x85cf('0x2d')],_0x11e113['filters']),_0x48d920);if(_0x30733b[_0x85cf('0x2d')][_0x85cf('0x39')]){_0x386fb5[_0x85cf('0x3a')]=_[_0x85cf('0x3b')](_0x386fb5[_0x85cf('0x3a')],{'$or':_[_0x85cf('0x3c')](_0x386fb5[_0x85cf('0x30')],function(_0x3a1995){var _0x327e69={};_0x327e69[_0x3a1995]={'$like':'%'+_0x30733b['query'][_0x85cf('0x39')]+'%'};return _0x327e69;})});}_0x386fb5=_[_0x85cf('0x3b')]({},_0x386fb5,_0x30733b[_0x85cf('0x3d')]);var _0x1d0f1e={'where':_0x386fb5['where']};return db['CmCompany'][_0x85cf('0x1a')](_0x1d0f1e)[_0x85cf('0x22')](function(_0x249f9f){_0x4f6bed[_0x85cf('0x1a')]=_0x249f9f;if(_0x30733b[_0x85cf('0x2d')]['includeAll']){_0x386fb5['include']=[{'all':!![]}];}return db['CmCompany'][_0x85cf('0x3e')](_0x386fb5);})[_0x85cf('0x22')](function(_0x4842c7){_0x4f6bed[_0x85cf('0x3f')]=_0x4842c7;return _0x4f6bed;})['then'](respondWithFilteredResult(_0x3d5695,_0x386fb5))[_0x85cf('0x40')](handleError(_0x3d5695,null));})['catch'](handleError(_0x3d5695,null));};exports[_0x85cf('0x41')]=function(_0x1e64fa,_0x18e542){var _0x2768ef={'raw':![],'where':{'id':_0x1e64fa[_0x85cf('0x42')]['id']}},_0x1df328={};_0x1df328[_0x85cf('0x2b')]=_[_0x85cf('0x2c')](db[_0x85cf('0x43')][_0x85cf('0x44')]);_0x1df328[_0x85cf('0x2d')]=_[_0x85cf('0x2c')](_0x1e64fa[_0x85cf('0x2d')]);_0x1df328[_0x85cf('0x2e')]=_[_0x85cf('0x2f')](_0x1df328[_0x85cf('0x2b')],_0x1df328[_0x85cf('0x2d')]);_0x2768ef[_0x85cf('0x30')]=_[_0x85cf('0x2f')](_0x1df328[_0x85cf('0x2b')],qs['fields'](_0x1e64fa['query'][_0x85cf('0x31')]));_0x2768ef[_0x85cf('0x30')]=_0x2768ef[_0x85cf('0x30')][_0x85cf('0x32')]?_0x2768ef[_0x85cf('0x30')]:_0x1df328[_0x85cf('0x2b')];if(_0x1e64fa[_0x85cf('0x2d')][_0x85cf('0x45')]){_0x2768ef['include']=[{'all':!![]}];}_0x2768ef=_[_0x85cf('0x3b')]({},_0x2768ef,_0x1e64fa['options']);return db[_0x85cf('0x43')][_0x85cf('0x46')](_0x2768ef)['then'](handleEntityNotFound(_0x18e542,null))['then'](respondWithResult(_0x18e542,null))['catch'](handleError(_0x18e542,null));};exports[_0x85cf('0x47')]=function(_0x12ccf4,_0x4d0b51){return db['CmCompany'][_0x85cf('0x47')](_0x12ccf4[_0x85cf('0x48')],{})[_0x85cf('0x22')](function(_0x54f9b6){var _0x1e5074=_0x12ccf4[_0x85cf('0x49')][_0x85cf('0x4a')]({'plain':!![]});if(!_0x1e5074)throw new Error(_0x85cf('0x4b'));if(_0x1e5074[_0x85cf('0x4c')]===_0x85cf('0x49')){var _0x318c00=_0x54f9b6[_0x85cf('0x4a')]({'plain':!![]});var _0x5e1dc0='Companies';return db[_0x85cf('0x4d')][_0x85cf('0x46')]({'where':{'name':_0x5e1dc0,'userProfileId':_0x1e5074[_0x85cf('0x4e')]},'raw':!![]})[_0x85cf('0x22')](function(_0x1f5b7c){if(_0x1f5b7c&&_0x1f5b7c['autoAssociation']===0x0){return db[_0x85cf('0x24')]['create']({'name':_0x318c00[_0x85cf('0x28')],'resourceId':_0x318c00['id'],'type':_0x1f5b7c[_0x85cf('0x28')],'sectionId':_0x1f5b7c['id']},{})[_0x85cf('0x22')](function(){return _0x54f9b6;});}else{return _0x54f9b6;}})['catch'](function(_0x4227f2){logger[_0x85cf('0x27')](_0x85cf('0x4f'),_0x4227f2);throw _0x4227f2;});}return _0x54f9b6;})[_0x85cf('0x22')](respondWithResult(_0x4d0b51,0xc9))[_0x85cf('0x40')](handleError(_0x4d0b51,null));};exports[_0x85cf('0x21')]=function(_0x5abbbd,_0x290d82){if(_0x5abbbd['body']['id']){delete _0x5abbbd[_0x85cf('0x48')]['id'];}return db['CmCompany'][_0x85cf('0x46')]({'where':{'id':_0x5abbbd[_0x85cf('0x42')]['id']}})[_0x85cf('0x22')](handleEntityNotFound(_0x290d82,null))[_0x85cf('0x22')](saveUpdates(_0x5abbbd[_0x85cf('0x48')],null))[_0x85cf('0x22')](respondWithResult(_0x290d82,null))[_0x85cf('0x40')](handleError(_0x290d82,null));};exports[_0x85cf('0x23')]=function(_0xb62991,_0x288d34){return db[_0x85cf('0x43')]['find']({'where':{'id':_0xb62991[_0x85cf('0x42')]['id']}})[_0x85cf('0x22')](handleEntityNotFound(_0x288d34,null))[_0x85cf('0x22')](removeEntity(_0x288d34,null))[_0x85cf('0x40')](handleError(_0x288d34,null));};exports[_0x85cf('0x2a')]=function(_0x416f41,_0x41bc6f){return db[_0x85cf('0x43')]['describe']()[_0x85cf('0x22')](respondWithResult(_0x41bc6f,null))[_0x85cf('0x40')](handleError(_0x41bc6f,null));};exports[_0x85cf('0x50')]=function(_0x57b579,_0x14af12,_0x2eadba){return db['CmContact']['find']({'where':{'id':_0x57b579[_0x85cf('0x42')]['id']}})['then'](handleEntityNotFound(_0x14af12,null))['then'](function(_0x6d65be){if(_0x6d65be){return _0x6d65be[_0x85cf('0x50')](_0x57b579[_0x85cf('0x48')]['ids'],_[_0x85cf('0x51')](_0x57b579['body'],[_0x85cf('0x52'),'id'])||{});}})[_0x85cf('0x22')](respondWithResult(_0x14af12,null))['catch'](handleError(_0x14af12,null));};exports[_0x85cf('0x53')]=function(_0x5d3220,_0x22fe1a,_0x36b26){var _0x4dfa38={};var _0x428744={};var _0x5cf4dd;var _0x444514;return db[_0x85cf('0x43')]['findOne']({'where':{'id':_0x5d3220['params']['id']}})[_0x85cf('0x22')](handleEntityNotFound(_0x22fe1a,null))[_0x85cf('0x22')](function(_0x2e478d){if(_0x2e478d){_0x5cf4dd=_0x2e478d;_0x428744[_0x85cf('0x2b')]=_[_0x85cf('0x2c')](db[_0x85cf('0x54')]['rawAttributes']);_0x428744[_0x85cf('0x2d')]=_[_0x85cf('0x2c')](_0x5d3220[_0x85cf('0x2d')]);_0x428744[_0x85cf('0x2e')]=_[_0x85cf('0x2f')](_0x428744[_0x85cf('0x2b')],_0x428744[_0x85cf('0x2d')]);_0x4dfa38[_0x85cf('0x30')]=_['intersection'](_0x428744[_0x85cf('0x2b')],qs['fields'](_0x5d3220['query'][_0x85cf('0x31')]));_0x4dfa38[_0x85cf('0x30')]=_0x4dfa38[_0x85cf('0x30')]['length']?_0x4dfa38[_0x85cf('0x30')]:_0x428744[_0x85cf('0x2b')];_0x4dfa38[_0x85cf('0x36')]=qs[_0x85cf('0x37')](_0x5d3220['query'][_0x85cf('0x37')]);_0x4dfa38[_0x85cf('0x3a')]=qs[_0x85cf('0x2e')](_['pick'](_0x5d3220[_0x85cf('0x2d')],_0x428744[_0x85cf('0x2e')]));if(_0x5d3220['query'][_0x85cf('0x39')]){_0x4dfa38[_0x85cf('0x3a')]=_[_0x85cf('0x3b')](_0x4dfa38['where'],{'$or':_[_0x85cf('0x3c')](_0x4dfa38[_0x85cf('0x30')],function(_0x38aa9d){var _0x3a8ddb={};_0x3a8ddb[_0x38aa9d]={'$like':'%'+_0x5d3220[_0x85cf('0x2d')][_0x85cf('0x39')]+'%'};return _0x3a8ddb;})});}_0x4dfa38=_['merge']({},_0x4dfa38,_0x5d3220['options']);return _0x5cf4dd['getContacts'](_0x4dfa38);}})[_0x85cf('0x22')](function(_0x3746e7){if(_0x3746e7){_0x444514=_0x3746e7[_0x85cf('0x32')];if(!_0x5d3220[_0x85cf('0x2d')][_0x85cf('0x33')](_0x85cf('0x34'))){_0x4dfa38[_0x85cf('0x35')]=qs[_0x85cf('0x35')](_0x5d3220[_0x85cf('0x2d')][_0x85cf('0x35')]);_0x4dfa38[_0x85cf('0x1b')]=qs[_0x85cf('0x1b')](_0x5d3220[_0x85cf('0x2d')][_0x85cf('0x1b')]);}return _0x5cf4dd[_0x85cf('0x53')](_0x4dfa38);}})['then'](function(_0x1ebd32){if(_0x1ebd32){return _0x1ebd32?{'count':_0x444514,'rows':_0x1ebd32}:null;}})[_0x85cf('0x22')](respondWithResult(_0x22fe1a,null))[_0x85cf('0x40')](handleError(_0x22fe1a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index e9a4fe7..7653f2d 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 _0x077c=['define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmCompany.attributes','exports'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x077c,0x1ca));var _0xc077=function(_0x17f0b2,_0xe74073){_0x17f0b2=_0x17f0b2-0x0;var _0x374dd4=_0x077c[_0x17f0b2];return _0x374dd4;};'use strict';var _=require(_0xc077('0x0'));var util=require(_0xc077('0x1'));var logger=require(_0xc077('0x2'))(_0xc077('0x3'));var moment=require(_0xc077('0x4'));var BPromise=require(_0xc077('0x5'));var rp=require(_0xc077('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc077('0x7'));var config=require('../../config/environment');var attributes=require(_0xc077('0x8'));module[_0xc077('0x9')]=function(_0x481f02,_0x376a9a){return _0x481f02[_0xc077('0xa')](_0xc077('0xb'),attributes,{'tableName':_0xc077('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab0=['rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3cdbc7,_0x2a7cb3){var _0x422d20=function(_0x11ac87){while(--_0x11ac87){_0x3cdbc7['push'](_0x3cdbc7['shift']());}};_0x422d20(++_0x2a7cb3);}(_0x1ab0,0x19c));var _0x01ab=function(_0x48de79,_0xbb13df){_0x48de79=_0x48de79-0x0;var _0x18a8eb=_0x1ab0[_0x48de79];return _0x18a8eb;};'use strict';var _=require(_0x01ab('0x0'));var util=require(_0x01ab('0x1'));var logger=require(_0x01ab('0x2'))(_0x01ab('0x3'));var moment=require(_0x01ab('0x4'));var BPromise=require(_0x01ab('0x5'));var rp=require(_0x01ab('0x6'));var fs=require('fs');var path=require(_0x01ab('0x7'));var rimraf=require(_0x01ab('0x8'));var config=require('../../config/environment');var attributes=require(_0x01ab('0x9'));module[_0x01ab('0xa')]=function(_0x300c44,_0x4352ff){return _0x300c44[_0x01ab('0xb')](_0x01ab('0xc'),attributes,{'tableName':_0x01ab('0xd'),'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 7dad27f..61e282c 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 _0x3bcf=['request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x3bcf,0x15b));var _0xf3bc=function(_0x33491c,_0x30ddbf){_0x33491c=_0x33491c-0x0;var _0x431bba=_0x3bcf[_0x33491c];return _0x431bba;};'use strict';var _=require(_0xf3bc('0x0'));var util=require(_0xf3bc('0x1'));var moment=require(_0xf3bc('0x2'));var BPromise=require(_0xf3bc('0x3'));var rs=require(_0xf3bc('0x4'));var fs=require('fs');var Redis=require(_0xf3bc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3bc('0x6'));var logger=require(_0xf3bc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf3bc('0x8'));var client=jayson[_0xf3bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x137fe3,_0x31508b,_0x4d4608){return new BPromise(function(_0x28b497,_0x50614c){return client[_0xf3bc('0xa')](_0x137fe3,_0x4d4608)['then'](function(_0x97fe5e){logger[_0xf3bc('0xb')](_0xf3bc('0xc'),_0x31508b,_0xf3bc('0xd'));logger[_0xf3bc('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x31508b,'request\x20sent',JSON[_0xf3bc('0xf')](_0x97fe5e));if(_0x97fe5e[_0xf3bc('0x10')]){if(_0x97fe5e['error'][_0xf3bc('0x11')]===0x1f4){logger[_0xf3bc('0x10')](_0xf3bc('0xc'),_0x31508b,_0x97fe5e[_0xf3bc('0x10')][_0xf3bc('0x12')]);return _0x50614c(_0x97fe5e[_0xf3bc('0x10')]['message']);}logger['error'](_0xf3bc('0xc'),_0x31508b,_0x97fe5e[_0xf3bc('0x10')][_0xf3bc('0x12')]);return _0x28b497(_0x97fe5e[_0xf3bc('0x10')][_0xf3bc('0x12')]);}else{logger[_0xf3bc('0xb')](_0xf3bc('0xc'),_0x31508b,_0xf3bc('0xd'));_0x28b497(_0x97fe5e[_0xf3bc('0x13')][_0xf3bc('0x12')]);}})[_0xf3bc('0x14')](function(_0x315c72){logger[_0xf3bc('0x10')]('CmCompany,\x20%s,\x20%s',_0x31508b,_0x315c72);_0x50614c(_0x315c72);});});} \ No newline at end of file +var _0xf56b=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5eb868,_0x3edfb0){var _0x278458=function(_0x266273){while(--_0x266273){_0x5eb868['push'](_0x5eb868['shift']());}};_0x278458(++_0x3edfb0);}(_0xf56b,0x172));var _0xbf56=function(_0x3b1b75,_0x12059c){_0x3b1b75=_0x3b1b75-0x0;var _0x564861=_0xf56b[_0x3b1b75];return _0x564861;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf56('0x0'));var BPromise=require('bluebird');var rs=require(_0xbf56('0x1'));var fs=require('fs');var Redis=require(_0xbf56('0x2'));var db=require(_0xbf56('0x3'))['db'];var utils=require(_0xbf56('0x4'));var logger=require(_0xbf56('0x5'))('rpc');var config=require(_0xbf56('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbf56('0x7')][_0xbf56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15d434,_0x44f77c,_0x429d10){return new BPromise(function(_0x40d07c,_0x31114d){return client[_0xbf56('0x9')](_0x15d434,_0x429d10)[_0xbf56('0xa')](function(_0x4e9021){logger['info'](_0xbf56('0xb'),_0x44f77c,_0xbf56('0xc'));logger[_0xbf56('0xd')](_0xbf56('0xe'),_0x44f77c,_0xbf56('0xc'),JSON[_0xbf56('0xf')](_0x4e9021));if(_0x4e9021['error']){if(_0x4e9021[_0xbf56('0x10')][_0xbf56('0x11')]===0x1f4){logger[_0xbf56('0x10')](_0xbf56('0xb'),_0x44f77c,_0x4e9021['error'][_0xbf56('0x12')]);return _0x31114d(_0x4e9021['error'][_0xbf56('0x12')]);}logger[_0xbf56('0x10')](_0xbf56('0xb'),_0x44f77c,_0x4e9021['error'][_0xbf56('0x12')]);return _0x40d07c(_0x4e9021[_0xbf56('0x10')]['message']);}else{logger[_0xbf56('0x13')]('CmCompany,\x20%s,\x20%s',_0x44f77c,_0xbf56('0xc'));_0x40d07c(_0x4e9021[_0xbf56('0x14')][_0xbf56('0x12')]);}})[_0xbf56('0x15')](function(_0x3cd9ee){logger['error']('CmCompany,\x20%s,\x20%s',_0x44f77c,_0x3cd9ee);_0x31114d(_0x3cd9ee);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 086c8ee..0f310a9 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 _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','addContacts','put','update','destroy','exports','path','connect-timeout'];(function(_0x30cac6,_0x306e82){var _0x42102a=function(_0x247c25){while(--_0x247c25){_0x30cac6['push'](_0x30cac6['shift']());}};_0x42102a(++_0x306e82);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xe')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file +var _0x55ca=['multer','util','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x55ca,0x126));var _0xa55c=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0x55ca[_0x1b8d87];return _0x182b74;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/contacts',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xd')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router[_0xa55c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);module[_0xa55c('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 948bcf4..a76f7f1 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 _0xec12=['INTEGER','UNSIGNED','NOW','lodash','exports','STRING','TEXT'];(function(_0x2c88ff,_0x49e561){var _0x1bfb1d=function(_0x5b48db){while(--_0x5b48db){_0x2c88ff['push'](_0x2c88ff['shift']());}};_0x1bfb1d(++_0x49e561);}(_0xec12,0xff));var _0x2ec1=function(_0x599d23,_0x26c88a){_0x599d23=_0x599d23-0x0;var _0x3f2af1=_0xec12[_0x599d23];return _0x3f2af1;};'use strict';var _=require(_0x2ec1('0x0'));var Sequelize=require('sequelize');module[_0x2ec1('0x1')]={'firstName':{'type':Sequelize[_0x2ec1('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x2ec1('0x2')]},'postalCode':{'type':Sequelize[_0x2ec1('0x2')]},'city':{'type':Sequelize[_0x2ec1('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2ec1('0x3')]},'phone':{'type':Sequelize[_0x2ec1('0x2')]},'mobile':{'type':Sequelize[_0x2ec1('0x2')]},'fax':{'type':Sequelize[_0x2ec1('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x2ec1('0x2')]},'facebook':{'type':Sequelize[_0x2ec1('0x2')]},'fb_data':{'type':Sequelize[_0x2ec1('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x2ec1('0x2')]},'teams':{'type':Sequelize[_0x2ec1('0x2')]},'viber':{'type':Sequelize[_0x2ec1('0x2')]},'line':{'type':Sequelize[_0x2ec1('0x2')]},'wechat':{'type':Sequelize[_0x2ec1('0x2')]},'telegram':{'type':Sequelize[_0x2ec1('0x2')]},'UserId':{'type':Sequelize[_0x2ec1('0x4')]},'priority':{'type':Sequelize[_0x2ec1('0x4')](0x2)[_0x2ec1('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x2ec1('0x6')]},'dialTimezone':{'type':Sequelize[_0x2ec1('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xcaa4=['NOW','INTEGER','sequelize','STRING','TEXT','DATE'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xcaa4,0x1e8));var _0x4caa=function(_0x5e4623,_0x374bf9){_0x5e4623=_0x5e4623-0x0;var _0x4a1f99=_0xcaa4[_0x5e4623];return _0x4a1f99;};'use strict';var _=require('lodash');var Sequelize=require(_0x4caa('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x4caa('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x4caa('0x1')]},'street':{'type':Sequelize[_0x4caa('0x1')]},'postalCode':{'type':Sequelize[_0x4caa('0x1')]},'city':{'type':Sequelize[_0x4caa('0x1')]},'country':{'type':Sequelize[_0x4caa('0x1')]},'dateOfBirth':{'type':Sequelize[_0x4caa('0x1')]},'description':{'type':Sequelize[_0x4caa('0x2')]},'phone':{'type':Sequelize[_0x4caa('0x1')]},'mobile':{'type':Sequelize[_0x4caa('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x4caa('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x4caa('0x1')]},'teams':{'type':Sequelize[_0x4caa('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x4caa('0x1')]},'wechat':{'type':Sequelize[_0x4caa('0x1')]},'telegram':{'type':Sequelize[_0x4caa('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4caa('0x3')],'defaultValue':Sequelize[_0x4caa('0x4')]},'dialTimezone':{'type':Sequelize[_0x4caa('0x1')]},'utcOffset':{'type':Sequelize[_0x4caa('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a77a083..1b732eb 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 _0x2bb1=['getTags','rawAttributes','options','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','upload','createReadStream','file','parse','meta','import','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','pid','exit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','CmContact','describe','keys','startsWith','cf_','push','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','color','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','value','dateOfBirth','buildExpression','text','filter','isNil','Contact','isEmpty','where','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','\x27\x27\x27\x27','split','length','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','some','user','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','find','params','tags','displayName','CmCustomField','findAll','alias','custom','values','columnName','merge','body','from','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','VoiceCallReport','ChatQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','create','each','duplicates','$or','ListId','findOrCreate','spread','Tag','format','cf_%d','$and','omit','table','setFields','id\x20=\x20?','toParam','phone'];(function(_0x3f319c,_0x565a2a){var _0x78a8eb=function(_0x210d41){while(--_0x210d41){_0x3f319c['push'](_0x3f319c['shift']());}};_0x78a8eb(++_0x565a2a);}(_0x2bb1,0x11a));var _0x12bb=function(_0x4a6f27,_0x2e6f67){_0x4a6f27=_0x4a6f27-0x0;var _0x15ee16=_0x2bb1[_0x4a6f27];return _0x15ee16;};'use strict';var pdf=require(_0x12bb('0x0'));var emlformat=require(_0x12bb('0x1'));var rimraf=require(_0x12bb('0x2'));var zipdir=require(_0x12bb('0x3'));var jsonpatch=require(_0x12bb('0x4'));var rp=require(_0x12bb('0x5'));var moment=require(_0x12bb('0x6'));var BPromise=require(_0x12bb('0x7'));var Mustache=require(_0x12bb('0x8'));var util=require(_0x12bb('0x9'));var path=require(_0x12bb('0xa'));var sox=require(_0x12bb('0xb'));var csv=require(_0x12bb('0xc'));var ejs=require(_0x12bb('0xd'));var fs=require('fs');var _=require(_0x12bb('0xe'));var squel=require(_0x12bb('0xf'));var crypto=require(_0x12bb('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x12bb('0x11'));var toCsv=require('to-csv');var querystring=require(_0x12bb('0x12'));var Papa=require(_0x12bb('0x13'));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(_0x12bb('0x14'));var logger=require(_0x12bb('0x15'))(_0x12bb('0x16'));var utils=require(_0x12bb('0x17'));var config=require('../../config/environment');var db=require(_0x12bb('0x18'))['db'];config[_0x12bb('0x19')]=_['defaults'](config[_0x12bb('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12bb('0x19')]));require('./cmContact.socket')['register'](socket);function respondWithStatusCode(_0x7f6ebb,_0x47f788){_0x47f788=_0x47f788||0xcc;return function(_0x5b1e45){if(_0x5b1e45){return _0x7f6ebb['sendStatus'](_0x47f788);}return _0x7f6ebb[_0x12bb('0x1a')](_0x47f788)[_0x12bb('0x1b')]();};}function respondWithResult(_0xfbaba1,_0x11c1e0){_0x11c1e0=_0x11c1e0||0xc8;return function(_0x420886){if(_0x420886){return _0xfbaba1[_0x12bb('0x1a')](_0x11c1e0)[_0x12bb('0x1c')](_0x420886);}};}function respondWithFilteredResult(_0x449d64,_0x45bda8){return function(_0x59c284){if(_0x59c284){var _0x5d8bee=_0x59c284[_0x12bb('0x1d')],_0x3e41c0=_0x45bda8[_0x12bb('0x1e')],_0x1e60ce=_0x45bda8[_0x12bb('0x1e')]+_0x45bda8[_0x12bb('0x1f')],_0x156079;if(_0x1e60ce>=_0x5d8bee){_0x1e60ce=_0x5d8bee;_0x156079=0xc8;}else{_0x156079=0xce;}_0x449d64['status'](_0x156079);return _0x449d64[_0x12bb('0x20')](_0x12bb('0x21'),_0x3e41c0+'-'+_0x1e60ce+'/'+_0x5d8bee)[_0x12bb('0x1c')](_0x59c284);}return null;};}function patchUpdates(_0x3a06e4){return function(_0x5f7dc){try{jsonpatch[_0x12bb('0x22')](_0x5f7dc,_0x3a06e4,!![]);}catch(_0x21bb3e){return BPromise['reject'](_0x21bb3e);}return _0x5f7dc[_0x12bb('0x23')]();};}function saveUpdates(_0x5d2f5f,_0x1c3588){return function(_0x2ec276){if(_0x2ec276){return _0x2ec276[_0x12bb('0x24')](_0x5d2f5f)[_0x12bb('0x25')](function(_0x50ffc9){return _0x50ffc9;});}return null;};}function removeEntity(_0x52c1c6,_0x5dd9e2){return function(_0x152fed){if(_0x152fed){return _0x152fed[_0x12bb('0x26')]()[_0x12bb('0x25')](function(){_0x52c1c6[_0x12bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x586614,_0x37e4d3){return function(_0x5df17e){if(!_0x5df17e){_0x586614[_0x12bb('0x27')](0x194);}return _0x5df17e;};}function handleError(_0x52b5dc,_0x183f25){_0x183f25=_0x183f25||0x1f4;return function(_0xd42558){logger[_0x12bb('0x28')](_0xd42558[_0x12bb('0x29')]);if(_0xd42558[_0x12bb('0x2a')]){delete _0xd42558[_0x12bb('0x2a')];}_0x52b5dc[_0x12bb('0x1a')](_0x183f25)[_0x12bb('0x2b')](_0xd42558);};}exports[_0x12bb('0x2c')]=function(_0x2aac8d,_0x5f15ed){var _0x36dfaa={},_0x2a5025={},_0x337950={'count':0x0,'rows':[]};return db[_0x12bb('0x2d')][_0x12bb('0x2e')]()[_0x12bb('0x25')](function(_0x4b5f4){var _0x584021=[];for(var _0x163b9c=0x0;_0x163b9c0x1){_0x3fd95e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x12bb('0x67')](_0x3be15f),null);}else{if(qs[_0x12bb('0x68')](_0x3be15f)){_0x3fd95e['or']('c.id\x20LIKE\x20?',_0x3be15f+'%');_0x3fd95e['or'](_0x12bb('0x69'),_0x3be15f+'%');_0x3fd95e['or'](_0x12bb('0x6a'),_0x3be15f+'%');_0x3fd95e['or']('c.fax\x20LIKE\x20?',_0x3be15f+'%');}else if(qs[_0x12bb('0x6b')](_0x3be15f)){_0x3fd95e['or'](_0x12bb('0x6c'),_0x3be15f+'%');}else{_0x3fd95e['or'](_0x12bb('0x6d'),'%'+_0x3be15f+'%');_0x3fd95e['or'](_0x12bb('0x6e'),'%'+_0x3be15f+'%');_0x3fd95e['or']('c.email\x20LIKE\x20?','%'+_0x3be15f+'%');}}}}_0x843af2[_0x12bb('0x5e')](_0x3fd95e);_0x843af2[_0x12bb('0x6f')](_0x12bb('0x70'));var _0x398d78={'type':db[_0x12bb('0x71')][_0x12bb('0x72')][_0x12bb('0x73')],'raw':!![]};var _0x48b012=_0x843af2[_0x12bb('0x74')]()[_0x12bb('0x44')](_0x12bb('0x70'));if(_0x36dfaa['order']){_0x36dfaa[_0x12bb('0x40')][_0x12bb('0x52')](function(_0x3d7116){_0x843af2[_0x12bb('0x40')]('c.'+_0x3d7116[0x0],_0x3d7116[0x1]===_0x12bb('0x75')?![]:!![]);});}if(!_[_0x12bb('0x5d')](_0xf42e)){_0x843af2[_0x12bb('0x76')](_0x5dfeaa);_0x48b012[_0x12bb('0x5e')](_0x12bb('0x77'),_0xf42e);}BPromise['resolve']()['then'](function(){if(_0x56dd0e&&!_[_0x12bb('0x78')](_0x56dd0e[_0x12bb('0x50')],[_0x12bb('0x44'),_0x12bb('0x55')])){return _0x2aac8d[_0x12bb('0x79')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x29f1c2){if(_[_0x12bb('0x5d')](_0x29f1c2)){_0x48b012[_0x12bb('0x5e')](_0x12bb('0x7a'));_0x843af2[_0x12bb('0x5e')]('c.ListId\x20IS\x20NULL');}else{_0x48b012[_0x12bb('0x5e')](_0x12bb('0x7b'),_[_0x12bb('0x51')](_0x29f1c2,'id'));_0x843af2['where'](_0x12bb('0x7b'),_[_0x12bb('0x51')](_0x29f1c2,'id'));}});}else{return;}})['then'](function(){db[_0x12bb('0x7c')]['query'](_0x48b012[_0x12bb('0x7d')](),_0x398d78)[_0x12bb('0x25')](function(_0x1b5328){_0x337950[_0x12bb('0x1d')]=_0x1b5328[_0x12bb('0x66')];if(_0x337950['count']===0x0)return[];return db[_0x12bb('0x7c')]['query'](_0x4ee76e[_0x12bb('0x7d')](),_0x398d78);})[_0x12bb('0x25')](function(_0x376334){_0xe7b119=_[_0x12bb('0x7e')](_0x376334,'id');_0x398d78=_['merge'](_0x398d78,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2aac8d['query'][_0x12bb('0x3d')]){_0x36dfaa[_0x12bb('0x3c')][_0x12bb('0x52')](function(_0x5b1fcb){_0x843af2['field']('c.'+_0x5b1fcb);});}else{_0x843af2['field'](_0x12bb('0x70'));_0x843af2[_0x12bb('0x44')](_0x12bb('0x7f'));_0x843af2[_0x12bb('0x44')](_0x12bb('0x80'));_0x843af2[_0x12bb('0x44')](_0x12bb('0x81'));_0x843af2['field'](_0x12bb('0x82'));_0x843af2[_0x12bb('0x44')](_0x12bb('0x83'));_0x843af2[_0x12bb('0x44')](_0x12bb('0x84'));_0x843af2[_0x12bb('0x44')](_0x12bb('0x85'));_0x843af2['field']('c.deletedAt');_0x843af2[_0x12bb('0x44')](_0x12bb('0x86'),_0x12bb('0x87'));}if(_0x36dfaa[_0x12bb('0x1f')])_0x843af2[_0x12bb('0x1f')](_0x36dfaa[_0x12bb('0x1f')]);if(_0x36dfaa['offset'])_0x843af2['offset'](_0x36dfaa[_0x12bb('0x1e')]);return db[_0x12bb('0x7c')][_0x12bb('0x39')](_0x843af2[_0x12bb('0x7d')](),_0x398d78);})['then'](function(_0x263ea9){_0x263ea9[_0x12bb('0x52')](function(_0xe2ce77){if(_0xe2ce77[_0x12bb('0x87')]){_0xe2ce77[_0x12bb('0x88')]=[];_0xe2ce77[_0x12bb('0x87')]['split'](',')['forEach'](function(_0x4b560c){_0xe2ce77['Tags'][_0x12bb('0x32')](_0xe7b119[_0x4b560c]);});}delete _0xe2ce77[_0x12bb('0x87')];});_0x337950[_0x12bb('0x89')]=_0x263ea9;return _0x337950;})['then'](respondWithFilteredResult(_0x5f15ed,_0x36dfaa));});})[_0x12bb('0x8a')](handleError(_0x5f15ed,null));};exports[_0x12bb('0x26')]=function(_0x12b28f,_0x2ab281){return db['CmContact'][_0x12bb('0x8b')]({'where':{'id':_0x12b28f[_0x12bb('0x8c')]['id']}})[_0x12bb('0x25')](handleEntityNotFound(_0x2ab281,null))[_0x12bb('0x25')](removeEntity(_0x2ab281,null))[_0x12bb('0x8a')](handleError(_0x2ab281,null));};exports[_0x12bb('0x2e')]=function(_0x2c68b8,_0x3ef54f){return db[_0x12bb('0x2d')]['describe']()[_0x12bb('0x25')](function(_0x38349b){delete _0x38349b[_0x12bb('0x8d')];for(var _0x479d=0x0;_0x479d=_0x157b11){_0x1b4494=_0x157b11;_0x480328=0xc8;}else{_0x480328=0xce;}_0x42c85f[_0x2b7e('0x1f')](_0x480328);return _0x42c85f[_0x2b7e('0x21')](_0x2b7e('0x22'),_0x18092d+'-'+_0x1b4494+'/'+_0x157b11)['json'](_0x1afef2);}return null;};}function patchUpdates(_0x22c4c5){return function(_0x1761ea){try{jsonpatch[_0x2b7e('0x23')](_0x1761ea,_0x22c4c5,!![]);}catch(_0xca85f8){return BPromise[_0x2b7e('0x24')](_0xca85f8);}return _0x1761ea[_0x2b7e('0x25')]();};}function saveUpdates(_0x282d63,_0x1bcaf4){return function(_0x1c3b63){if(_0x1c3b63){return _0x1c3b63[_0x2b7e('0x26')](_0x282d63)[_0x2b7e('0x27')](function(_0xee74bd){return _0xee74bd;});}return null;};}function removeEntity(_0x5ab957,_0x55df34){return function(_0x376f17){if(_0x376f17){return _0x376f17[_0x2b7e('0x28')]()['then'](function(){_0x5ab957['status'](0xcc)[_0x2b7e('0x29')]();});}};}function handleEntityNotFound(_0x501231,_0x3db4a6){return function(_0x2ca3f7){if(!_0x2ca3f7){_0x501231[_0x2b7e('0x2a')](0x194);}return _0x2ca3f7;};}function handleError(_0x3251b5,_0x19b3a5){_0x19b3a5=_0x19b3a5||0x1f4;return function(_0x36aa3f){logger[_0x2b7e('0x2b')](_0x36aa3f[_0x2b7e('0x2c')]);if(_0x36aa3f[_0x2b7e('0x2d')]){delete _0x36aa3f[_0x2b7e('0x2d')];}_0x3251b5['status'](_0x19b3a5)[_0x2b7e('0x2e')](_0x36aa3f);};}exports[_0x2b7e('0x2f')]=function(_0x3c7ec5,_0x1868c6){var _0x31277f={},_0x2908f5={},_0xbfbd2d={'count':0x0,'rows':[]};return db[_0x2b7e('0x30')][_0x2b7e('0x31')]()[_0x2b7e('0x27')](function(_0x4aea1b){var _0x13c445=[];for(var _0x3fb27b=0x0;_0x3fb27b0x1){_0x146ec7['or'](_0x2b7e('0x74'),qs[_0x2b7e('0x75')](_0x39f6c3),null);}else{if(qs[_0x2b7e('0x76')](_0x39f6c3)){_0x146ec7['or'](_0x2b7e('0x77'),_0x39f6c3+'%');_0x146ec7['or']('c.phone\x20LIKE\x20?',_0x39f6c3+'%');_0x146ec7['or'](_0x2b7e('0x78'),_0x39f6c3+'%');_0x146ec7['or'](_0x2b7e('0x79'),_0x39f6c3+'%');}else if(qs[_0x2b7e('0x7a')](_0x39f6c3)){_0x146ec7['or'](_0x2b7e('0x7b'),_0x39f6c3+'%');}else{_0x146ec7['or'](_0x2b7e('0x7c'),'%'+_0x39f6c3+'%');_0x146ec7['or']('c.lastName\x20LIKE\x20?','%'+_0x39f6c3+'%');_0x146ec7['or'](_0x2b7e('0x7b'),'%'+_0x39f6c3+'%');}}}}_0x4a7d0f[_0x2b7e('0x52')](_0x146ec7);_0x4a7d0f['group']('c.id');var _0x1dee3a={'type':db[_0x2b7e('0x7d')][_0x2b7e('0x7e')][_0x2b7e('0x7f')],'raw':!![]};var _0x528851=_0x4a7d0f['clone']()[_0x2b7e('0x5a')](_0x2b7e('0x80'));if(_0x31277f[_0x2b7e('0x44')]){_0x31277f[_0x2b7e('0x44')]['forEach'](function(_0x3ec619){_0x4a7d0f[_0x2b7e('0x44')]('c.'+_0x3ec619[0x0],_0x3ec619[0x1]===_0x2b7e('0x81')?![]:!![]);});}if(!_['isEmpty'](_0x5e4968)){_0x4a7d0f['having'](_0x462f7c);_0x528851['where'](_0x2b7e('0x82'),_0x5e4968);}BPromise['resolve']()[_0x2b7e('0x27')](function(){if(_0x347f44&&!_[_0x2b7e('0x83')](_0x347f44[_0x2b7e('0x58')],[_0x2b7e('0x5a'),_0x2b7e('0x5f')])){return _0x3c7ec5[_0x2b7e('0x84')]['getLists']({'attributes':['id'],'raw':!![]})[_0x2b7e('0x27')](function(_0x600c27){if(_[_0x2b7e('0x6a')](_0x600c27)){_0x528851[_0x2b7e('0x52')](_0x2b7e('0x85'));_0x4a7d0f[_0x2b7e('0x52')](_0x2b7e('0x85'));}else{_0x528851[_0x2b7e('0x52')](_0x2b7e('0x6c'),_[_0x2b7e('0x5c')](_0x600c27,'id'));_0x4a7d0f[_0x2b7e('0x52')](_0x2b7e('0x6c'),_[_0x2b7e('0x5c')](_0x600c27,'id'));}});}else{return;}})[_0x2b7e('0x27')](function(){db['sequelize'][_0x2b7e('0x3b')](_0x528851[_0x2b7e('0x86')](),_0x1dee3a)[_0x2b7e('0x27')](function(_0x1ffd2f){_0xbfbd2d[_0x2b7e('0x87')]=_0x1ffd2f[_0x2b7e('0x33')];if(_0xbfbd2d[_0x2b7e('0x87')]===0x0)return[];return db[_0x2b7e('0x88')][_0x2b7e('0x3b')](_0xcad0c2[_0x2b7e('0x86')](),_0x1dee3a);})[_0x2b7e('0x27')](function(_0x1051d3){_0x13912b=_[_0x2b7e('0x89')](_0x1051d3,'id');_0x1dee3a=_['merge'](_0x1dee3a,{'model':db[_0x2b7e('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c7ec5[_0x2b7e('0x3b')][_0x2b7e('0x3e')]){_0x31277f[_0x2b7e('0x3f')][_0x2b7e('0x5d')](function(_0x21e804){_0x4a7d0f['field']('c.'+_0x21e804);});}else{_0x4a7d0f['field'](_0x2b7e('0x80'));_0x4a7d0f[_0x2b7e('0x5a')](_0x2b7e('0x8a'));_0x4a7d0f[_0x2b7e('0x5a')]('c.lastName');_0x4a7d0f[_0x2b7e('0x5a')]('c.phone');_0x4a7d0f[_0x2b7e('0x5a')]('c.mobile');_0x4a7d0f[_0x2b7e('0x5a')](_0x2b7e('0x8b'));_0x4a7d0f[_0x2b7e('0x5a')]('c.email');_0x4a7d0f[_0x2b7e('0x5a')](_0x2b7e('0x8c'));_0x4a7d0f[_0x2b7e('0x5a')]('c.deletedAt');_0x4a7d0f[_0x2b7e('0x5a')](_0x2b7e('0x8d'),_0x2b7e('0x8e'));}if(_0x31277f[_0x2b7e('0x42')])_0x4a7d0f['limit'](_0x31277f[_0x2b7e('0x42')]);if(_0x31277f[_0x2b7e('0x43')])_0x4a7d0f[_0x2b7e('0x43')](_0x31277f['offset']);return db[_0x2b7e('0x88')][_0x2b7e('0x3b')](_0x4a7d0f['toString'](),_0x1dee3a);})[_0x2b7e('0x27')](function(_0x1e0e7d){_0x1e0e7d[_0x2b7e('0x5d')](function(_0x14e61c){if(_0x14e61c[_0x2b7e('0x8e')]){_0x14e61c[_0x2b7e('0x8f')]=[];_0x14e61c[_0x2b7e('0x8e')][_0x2b7e('0x5b')](',')[_0x2b7e('0x5d')](function(_0x54b467){_0x14e61c['Tags'][_0x2b7e('0x36')](_0x13912b[_0x54b467]);});}delete _0x14e61c[_0x2b7e('0x8e')];});_0xbfbd2d[_0x2b7e('0x90')]=_0x1e0e7d;return _0xbfbd2d;})[_0x2b7e('0x27')](respondWithFilteredResult(_0x1868c6,_0x31277f));});})[_0x2b7e('0x91')](handleError(_0x1868c6,null));};exports[_0x2b7e('0x28')]=function(_0x539c69,_0x521c5f){return db[_0x2b7e('0x30')][_0x2b7e('0x59')]({'where':{'id':_0x539c69[_0x2b7e('0x92')]['id']}})[_0x2b7e('0x27')](handleEntityNotFound(_0x521c5f,null))['then'](removeEntity(_0x521c5f,null))['catch'](handleError(_0x521c5f,null));};exports[_0x2b7e('0x31')]=function(_0x224739,_0x5689fd){return db[_0x2b7e('0x30')][_0x2b7e('0x31')]()[_0x2b7e('0x27')](function(_0x2ea0d3){delete _0x2ea0d3[_0x2b7e('0x93')];for(var _0x250fce=0x0;_0x250fce{}\s\\|]/g,'-');_0x5b246b(null,util[_0x68ef('0x22')](_0x68ef('0x23'),path[_0x68ef('0x24')](_0x183f5f['originalname'],path['extname'](_0x183f5f['originalname'])),Date[_0x68ef('0x25')](),path[_0x68ef('0x26')](_0x183f5f[_0x68ef('0x21')])));}})});router[_0x68ef('0x1b')](_0x68ef('0x27'),upload[_0x68ef('0x28')](_0x68ef('0x29')),controller[_0x68ef('0x2a')]);var upload=multer({'storage':multer[_0x68ef('0x2b')]({'destination':function(_0x13280b,_0x5e4dbe,_0x178460){_0x178460(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x1a7ce1,_0x268f32,_0x123041){_0x268f32[_0x68ef('0x21')]=_0x268f32['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x123041(null,util[_0x68ef('0x22')](_0x68ef('0x23'),path[_0x68ef('0x24')](_0x268f32[_0x68ef('0x21')],path[_0x68ef('0x26')](_0x268f32[_0x68ef('0x21')])),Date[_0x68ef('0x25')](),path[_0x68ef('0x26')](_0x268f32['originalname'])));}})});router[_0x68ef('0x1b')](_0x68ef('0x2c'),upload[_0x68ef('0x28')]('file'),controller[_0x68ef('0x2d')]);router['post'](_0x68ef('0x2e'),auth[_0x68ef('0xa')](),controller['import']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller['update']);router[_0x68ef('0x2f')](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x30')]);module['exports']=router; \ No newline at end of file +var _0x425d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/merge','merge','post','/create_many','bulkCreate','setTags','diskStorage','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','file','uploadCsv','join','/upload','single','upload','/upload/:id','import','put'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x425d,0x1e0));var _0xd425=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x425d[_0x9d14e3];return _0x19bf32;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./cmContact.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x8')](_0xd425('0x10'),auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);router[_0xd425('0x8')](_0xd425('0x12'),auth[_0xd425('0x9')](),controller[_0xd425('0x13')]);router[_0xd425('0x8')](_0xd425('0x14'),auth[_0xd425('0x9')](),controller[_0xd425('0x15')]);router['get'](_0xd425('0x16'),auth[_0xd425('0x9')](),controller[_0xd425('0x17')]);router['post'](_0xd425('0x18'),auth[_0xd425('0x9')](),controller[_0xd425('0x19')]);router[_0xd425('0x1a')]('/',auth[_0xd425('0x9')](),controller['create']);router[_0xd425('0x1a')](_0xd425('0x1b'),auth[_0xd425('0x9')](),controller[_0xd425('0x1c')]);router['post'](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0x1d')]);var upload=multer({'storage':multer[_0xd425('0x1e')]({'destination':function(_0x4e88fa,_0x58a0c1,_0x5debc3){_0x5debc3(null,path['join'](config[_0xd425('0x1f')],_0xd425('0x20')));},'filename':function(_0x3c98db,_0x5e797a,_0x355af0){_0x5e797a[_0xd425('0x21')]=_0x5e797a['originalname'][_0xd425('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x355af0(null,util[_0xd425('0x23')](_0xd425('0x24'),path[_0xd425('0x25')](_0x5e797a[_0xd425('0x21')],path[_0xd425('0x26')](_0x5e797a[_0xd425('0x21')])),Date[_0xd425('0x27')](),path[_0xd425('0x26')](_0x5e797a[_0xd425('0x21')])));}})});router[_0xd425('0x1a')](_0xd425('0x28'),upload['single'](_0xd425('0x29')),controller[_0xd425('0x2a')]);var upload=multer({'storage':multer[_0xd425('0x1e')]({'destination':function(_0x1908a5,_0x2afcdb,_0x400dd7){_0x400dd7(null,path[_0xd425('0x2b')](config['root'],_0xd425('0x20')));},'filename':function(_0x177de2,_0x1d8861,_0x57c950){_0x1d8861[_0xd425('0x21')]=_0x1d8861[_0xd425('0x21')][_0xd425('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57c950(null,util[_0xd425('0x23')](_0xd425('0x24'),path[_0xd425('0x25')](_0x1d8861[_0xd425('0x21')],path[_0xd425('0x26')](_0x1d8861[_0xd425('0x21')])),Date[_0xd425('0x27')](),path['extname'](_0x1d8861[_0xd425('0x21')])));}})});router[_0xd425('0x1a')](_0xd425('0x2c'),upload[_0xd425('0x2d')](_0xd425('0x29')),controller[_0xd425('0x2e')]);router[_0xd425('0x1a')](_0xd425('0x2f'),auth[_0xd425('0x9')](),controller[_0xd425('0x30')]);router[_0xd425('0x31')]('/:id',auth[_0xd425('0x9')](),controller[_0xd425('0x32')]);router[_0xd425('0x33')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller['destroy']);module[_0xd425('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index dd9e977..7933a41 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 _0xba0d=['STRING','PHONE','sequelize','INTEGER'];(function(_0x345c17,_0x2e146e){var _0x1205e0=function(_0x23a29a){while(--_0x23a29a){_0x345c17['push'](_0x345c17['shift']());}};_0x1205e0(++_0x2e146e);}(_0xba0d,0x8e));var _0xdba0=function(_0x4cdd51,_0x5f242c){_0x4cdd51=_0x4cdd51-0x0;var _0x284def=_0xba0d[_0x4cdd51];return _0x284def;};'use strict';var Sequelize=require(_0xdba0('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xdba0('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xdba0('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xdba0('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xdba0('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0xf105=['sequelize','exports','INTEGER','STRING'];(function(_0x398450,_0x4a206c){var _0xeea830=function(_0x100330){while(--_0x100330){_0x398450['push'](_0x398450['shift']());}};_0xeea830(++_0x4a206c);}(_0xf105,0x1b0));var _0x5f10=function(_0x5e91c7,_0x2e6b79){_0x5e91c7=_0x5e91c7-0x0;var _0x52c081=_0xf105[_0x5e91c7];return _0x52c081;};'use strict';var Sequelize=require(_0x5f10('0x0'));module[_0x5f10('0x1')]={'CmContactId':{'type':Sequelize[_0x5f10('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x5f10('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x5f10('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x5f10('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x5f10('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 7de1cda..446d2f0 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 _0x86e2=['stack','name','send','index','map','CmContactHasItem','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','count','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','get','CmContactHasItems','UserProfileResource','then'];(function(_0xa3b5b3,_0x1f8839){var _0x309afe=function(_0x5d1113){while(--_0x5d1113){_0xa3b5b3['push'](_0xa3b5b3['shift']());}};_0x309afe(++_0x1f8839);}(_0x86e2,0x1b6));var _0x286e=function(_0x13ec97,_0x469afc){_0x13ec97=_0x13ec97-0x0;var _0x236231=_0x86e2[_0x13ec97];return _0x236231;};'use strict';var pdf=require(_0x286e('0x0'));var emlformat=require(_0x286e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x286e('0x2'));var jsonpatch=require(_0x286e('0x3'));var rp=require(_0x286e('0x4'));var moment=require(_0x286e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x286e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x286e('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x286e('0x8'));var crypto=require(_0x286e('0x9'));var jsforce=require(_0x286e('0xa'));var deskjs=require(_0x286e('0xb'));var toCsv=require(_0x286e('0xc'));var querystring=require(_0x286e('0xd'));var Papa=require(_0x286e('0xe'));var Redis=require('ioredis');var authService=require(_0x286e('0xf'));var qs=require(_0x286e('0x10'));var as=require(_0x286e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x286e('0x12'));var utils=require('../../config/utils');var config=require(_0x286e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26ee76,_0x49d03d){_0x49d03d=_0x49d03d||0xcc;return function(_0xf2fcc){if(_0xf2fcc){return _0x26ee76[_0x286e('0x14')](_0x49d03d);}return _0x26ee76['status'](_0x49d03d)[_0x286e('0x15')]();};}function respondWithResult(_0x388bdc,_0x58c6f4){_0x58c6f4=_0x58c6f4||0xc8;return function(_0x44a9e6){if(_0x44a9e6){return _0x388bdc[_0x286e('0x16')](_0x58c6f4)[_0x286e('0x17')](_0x44a9e6);}};}function respondWithFilteredResult(_0x520f72,_0x135a80){return function(_0x216b89){if(_0x216b89){var _0x1ef433=_0x216b89['count'],_0x10e5b7=_0x135a80[_0x286e('0x18')],_0x3ab30c=_0x135a80[_0x286e('0x18')]+_0x135a80['limit'],_0x2d24b4;if(_0x3ab30c>=_0x1ef433){_0x3ab30c=_0x1ef433;_0x2d24b4=0xc8;}else{_0x2d24b4=0xce;}_0x520f72[_0x286e('0x16')](_0x2d24b4);return _0x520f72[_0x286e('0x19')](_0x286e('0x1a'),_0x10e5b7+'-'+_0x3ab30c+'/'+_0x1ef433)[_0x286e('0x17')](_0x216b89);}return null;};}function patchUpdates(_0x566c68){return function(_0x289559){try{jsonpatch[_0x286e('0x1b')](_0x289559,_0x566c68,!![]);}catch(_0xf30130){return BPromise[_0x286e('0x1c')](_0xf30130);}return _0x289559[_0x286e('0x1d')]();};}function saveUpdates(_0x5e9f73,_0x42e206){return function(_0x24d59a){if(_0x24d59a){return _0x24d59a[_0x286e('0x1e')](_0x5e9f73)['then'](function(_0x4b27d5){return _0x4b27d5;});}return null;};}function removeEntity(_0x4ca1e7,_0x55f768){return function(_0x7e4e29){if(_0x7e4e29){return _0x7e4e29[_0x286e('0x1f')]()['then'](function(){var _0x3cdd14=_0x7e4e29[_0x286e('0x20')]({'plain':!![]});var _0x5628b9=_0x286e('0x21');return db[_0x286e('0x22')][_0x286e('0x1f')]({'where':{'type':_0x5628b9,'resourceId':_0x3cdd14['id']}})[_0x286e('0x23')](function(){return _0x7e4e29;});})[_0x286e('0x23')](function(){_0x4ca1e7[_0x286e('0x16')](0xcc)[_0x286e('0x15')]();});}};}function handleEntityNotFound(_0x111cc5,_0x5a3562){return function(_0x1daa54){if(!_0x1daa54){_0x111cc5[_0x286e('0x14')](0x194);}return _0x1daa54;};}function handleError(_0x5adc72,_0x4921c0){_0x4921c0=_0x4921c0||0x1f4;return function(_0x3e54e3){logger['error'](_0x3e54e3[_0x286e('0x24')]);if(_0x3e54e3['name']){delete _0x3e54e3[_0x286e('0x25')];}_0x5adc72[_0x286e('0x16')](_0x4921c0)[_0x286e('0x26')](_0x3e54e3);};}exports[_0x286e('0x27')]=function(_0x3a8fe0,_0x3446cc){var _0x2ec883={},_0x415e8c={},_0x1364f3={'count':0x0,'rows':[]};var _0x3776c7=_[_0x286e('0x28')](db[_0x286e('0x29')]['rawAttributes'],function(_0x31bbf2){return{'name':_0x31bbf2['fieldName'],'type':_0x31bbf2[_0x286e('0x2a')][_0x286e('0x2b')]};});_0x415e8c[_0x286e('0x2c')]=_['map'](_0x3776c7,_0x286e('0x25'));_0x415e8c[_0x286e('0x2d')]=_['keys'](_0x3a8fe0[_0x286e('0x2d')]);_0x415e8c[_0x286e('0x2e')]=_[_0x286e('0x2f')](_0x415e8c[_0x286e('0x2c')],_0x415e8c[_0x286e('0x2d')]);_0x2ec883[_0x286e('0x30')]=_[_0x286e('0x2f')](_0x415e8c[_0x286e('0x2c')],qs['fields'](_0x3a8fe0[_0x286e('0x2d')][_0x286e('0x31')]));_0x2ec883[_0x286e('0x30')]=_0x2ec883['attributes'][_0x286e('0x32')]?_0x2ec883[_0x286e('0x30')]:_0x415e8c[_0x286e('0x2c')];if(!_0x3a8fe0[_0x286e('0x2d')]['hasOwnProperty'](_0x286e('0x33'))){_0x2ec883[_0x286e('0x34')]=qs[_0x286e('0x34')](_0x3a8fe0['query']['limit']);_0x2ec883[_0x286e('0x18')]=qs[_0x286e('0x18')](_0x3a8fe0[_0x286e('0x2d')]['offset']);}_0x2ec883[_0x286e('0x35')]=qs[_0x286e('0x36')](_0x3a8fe0[_0x286e('0x2d')][_0x286e('0x36')]);_0x2ec883[_0x286e('0x37')]=qs[_0x286e('0x2e')](_[_0x286e('0x38')](_0x3a8fe0[_0x286e('0x2d')],_0x415e8c[_0x286e('0x2e')]),_0x3776c7);if(_0x3a8fe0[_0x286e('0x2d')][_0x286e('0x39')]){_0x2ec883[_0x286e('0x37')]=_['merge'](_0x2ec883[_0x286e('0x37')],{'$or':_['map'](_0x3776c7,function(_0x36c115){if(_0x36c115['type']!==_0x286e('0x3a')){var _0x37664f={};_0x37664f[_0x36c115[_0x286e('0x25')]]={'$like':'%'+_0x3a8fe0[_0x286e('0x2d')][_0x286e('0x39')]+'%'};return _0x37664f;}})});}_0x2ec883=_['merge']({},_0x2ec883,_0x3a8fe0[_0x286e('0x3b')]);var _0x7d8bba={'where':_0x2ec883[_0x286e('0x37')]};return db[_0x286e('0x29')][_0x286e('0x3c')](_0x7d8bba)[_0x286e('0x23')](function(_0x410806){_0x1364f3['count']=_0x410806;if(_0x3a8fe0[_0x286e('0x2d')]['includeAll']){_0x2ec883[_0x286e('0x3d')]=[{'all':!![]}];}return db[_0x286e('0x29')][_0x286e('0x3e')](_0x2ec883);})[_0x286e('0x23')](function(_0x3c5bce){_0x1364f3['rows']=_0x3c5bce;return _0x1364f3;})[_0x286e('0x23')](respondWithFilteredResult(_0x3446cc,_0x2ec883))[_0x286e('0x3f')](handleError(_0x3446cc,null));};exports[_0x286e('0x40')]=function(_0x2f6f50,_0x12586b){var _0x546290={'raw':!![],'where':{'id':_0x2f6f50[_0x286e('0x41')]['id']}},_0xc47817={};_0xc47817[_0x286e('0x2c')]=_[_0x286e('0x42')](db[_0x286e('0x29')][_0x286e('0x43')]);_0xc47817[_0x286e('0x2d')]=_['keys'](_0x2f6f50[_0x286e('0x2d')]);_0xc47817[_0x286e('0x2e')]=_[_0x286e('0x2f')](_0xc47817[_0x286e('0x2c')],_0xc47817[_0x286e('0x2d')]);_0x546290[_0x286e('0x30')]=_['intersection'](_0xc47817['model'],qs[_0x286e('0x31')](_0x2f6f50[_0x286e('0x2d')]['fields']));_0x546290[_0x286e('0x30')]=_0x546290['attributes'][_0x286e('0x32')]?_0x546290['attributes']:_0xc47817['model'];if(_0x2f6f50[_0x286e('0x2d')][_0x286e('0x44')]){_0x546290['include']=[{'all':!![]}];}_0x546290=_['merge']({},_0x546290,_0x2f6f50[_0x286e('0x3b')]);return db[_0x286e('0x29')][_0x286e('0x45')](_0x546290)['then'](handleEntityNotFound(_0x12586b,null))['then'](respondWithResult(_0x12586b,null))['catch'](handleError(_0x12586b,null));};exports[_0x286e('0x46')]=function(_0x224bfa,_0x1a5cb5){return db[_0x286e('0x29')][_0x286e('0x46')](_0x224bfa[_0x286e('0x47')],{})['then'](function(_0x1b08fb){var _0x1dff8d=_0x224bfa[_0x286e('0x48')][_0x286e('0x20')]({'plain':!![]});if(!_0x1dff8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1dff8d[_0x286e('0x49')]===_0x286e('0x48')){var _0x17b45f=_0x1b08fb[_0x286e('0x20')]({'plain':!![]});var _0x4b2d09=_0x286e('0x21');return db[_0x286e('0x4a')][_0x286e('0x45')]({'where':{'name':_0x4b2d09,'userProfileId':_0x1dff8d[_0x286e('0x4b')]},'raw':!![]})[_0x286e('0x23')](function(_0x3a6d50){if(_0x3a6d50&&_0x3a6d50[_0x286e('0x4c')]===0x0){return db[_0x286e('0x22')]['create']({'name':_0x17b45f[_0x286e('0x25')],'resourceId':_0x17b45f['id'],'type':_0x3a6d50[_0x286e('0x25')],'sectionId':_0x3a6d50['id']},{})[_0x286e('0x23')](function(){return _0x1b08fb;});}else{return _0x1b08fb;}})[_0x286e('0x3f')](function(_0x13f4e6){logger[_0x286e('0x4d')](_0x286e('0x4e'),_0x13f4e6);throw _0x13f4e6;});}return _0x1b08fb;})[_0x286e('0x23')](respondWithResult(_0x1a5cb5,0xc9))[_0x286e('0x3f')](handleError(_0x1a5cb5,null));};exports[_0x286e('0x1e')]=function(_0x5da1c4,_0x3012b5){if(_0x5da1c4['body']['id']){delete _0x5da1c4[_0x286e('0x47')]['id'];}return db[_0x286e('0x29')]['find']({'where':{'id':_0x5da1c4[_0x286e('0x41')]['id']}})[_0x286e('0x23')](handleEntityNotFound(_0x3012b5,null))[_0x286e('0x23')](saveUpdates(_0x5da1c4['body'],null))[_0x286e('0x23')](respondWithResult(_0x3012b5,null))[_0x286e('0x3f')](handleError(_0x3012b5,null));};exports[_0x286e('0x1f')]=function(_0x6c9f29,_0x3e35f6){return db[_0x286e('0x29')][_0x286e('0x45')]({'where':{'id':_0x6c9f29[_0x286e('0x41')]['id']}})['then'](handleEntityNotFound(_0x3e35f6,null))[_0x286e('0x23')](removeEntity(_0x3e35f6,null))[_0x286e('0x3f')](handleError(_0x3e35f6,null));}; \ No newline at end of file +var _0xdb82=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','update','destroy','then','CmContactHasItems','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key'];(function(_0x499b02,_0x4cc638){var _0x2980f3=function(_0xb328e2){while(--_0xb328e2){_0x499b02['push'](_0x499b02['shift']());}};_0x2980f3(++_0x4cc638);}(_0xdb82,0x1dc));var _0x2db8=function(_0xaf1901,_0x4f5d21){_0xaf1901=_0xaf1901-0x0;var _0x38c5ce=_0xdb82[_0xaf1901];return _0x38c5ce;};'use strict';var pdf=require(_0x2db8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2db8('0x1'));var zipdir=require(_0x2db8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2db8('0x3'));var BPromise=require(_0x2db8('0x4'));var Mustache=require(_0x2db8('0x5'));var util=require(_0x2db8('0x6'));var path=require(_0x2db8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2db8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2db8('0x9'));var deskjs=require(_0x2db8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2db8('0xb'));var authService=require(_0x2db8('0xc'));var qs=require(_0x2db8('0xd'));var as=require(_0x2db8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2db8('0xf'))(_0x2db8('0x10'));var utils=require(_0x2db8('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc86f0d,_0x21befb){_0x21befb=_0x21befb||0xcc;return function(_0x150870){if(_0x150870){return _0xc86f0d[_0x2db8('0x12')](_0x21befb);}return _0xc86f0d['status'](_0x21befb)[_0x2db8('0x13')]();};}function respondWithResult(_0x2a34e6,_0x1476ba){_0x1476ba=_0x1476ba||0xc8;return function(_0x3285a2){if(_0x3285a2){return _0x2a34e6['status'](_0x1476ba)[_0x2db8('0x14')](_0x3285a2);}};}function respondWithFilteredResult(_0x581bc0,_0x2fa4fe){return function(_0x42001e){if(_0x42001e){var _0x3d1f5f=_0x42001e[_0x2db8('0x15')],_0x212797=_0x2fa4fe[_0x2db8('0x16')],_0x55cf73=_0x2fa4fe[_0x2db8('0x16')]+_0x2fa4fe[_0x2db8('0x17')],_0x157607;if(_0x55cf73>=_0x3d1f5f){_0x55cf73=_0x3d1f5f;_0x157607=0xc8;}else{_0x157607=0xce;}_0x581bc0[_0x2db8('0x18')](_0x157607);return _0x581bc0[_0x2db8('0x19')](_0x2db8('0x1a'),_0x212797+'-'+_0x55cf73+'/'+_0x3d1f5f)[_0x2db8('0x14')](_0x42001e);}return null;};}function patchUpdates(_0x4a6be6){return function(_0x37c414){try{jsonpatch['apply'](_0x37c414,_0x4a6be6,!![]);}catch(_0x4df301){return BPromise[_0x2db8('0x1b')](_0x4df301);}return _0x37c414['save']();};}function saveUpdates(_0x333a8c,_0x5764f8){return function(_0x304d6b){if(_0x304d6b){return _0x304d6b[_0x2db8('0x1c')](_0x333a8c)['then'](function(_0xc67de7){return _0xc67de7;});}return null;};}function removeEntity(_0x2d6a12,_0x140585){return function(_0x6183f3){if(_0x6183f3){return _0x6183f3[_0x2db8('0x1d')]()[_0x2db8('0x1e')](function(){var _0x524692=_0x6183f3['get']({'plain':!![]});var _0x3ab9c0=_0x2db8('0x1f');return db['UserProfileResource'][_0x2db8('0x1d')]({'where':{'type':_0x3ab9c0,'resourceId':_0x524692['id']}})[_0x2db8('0x1e')](function(){return _0x6183f3;});})[_0x2db8('0x1e')](function(){_0x2d6a12[_0x2db8('0x18')](0xcc)[_0x2db8('0x13')]();});}};}function handleEntityNotFound(_0x2f71db,_0x1d1fda){return function(_0x1ca262){if(!_0x1ca262){_0x2f71db[_0x2db8('0x12')](0x194);}return _0x1ca262;};}function handleError(_0x25bfe4,_0x58bff1){_0x58bff1=_0x58bff1||0x1f4;return function(_0x130ab){logger[_0x2db8('0x20')](_0x130ab[_0x2db8('0x21')]);if(_0x130ab[_0x2db8('0x22')]){delete _0x130ab[_0x2db8('0x22')];}_0x25bfe4[_0x2db8('0x18')](_0x58bff1)[_0x2db8('0x23')](_0x130ab);};}exports[_0x2db8('0x24')]=function(_0x3569ae,_0x3de877){var _0x48c740={},_0x37049d={},_0x31335f={'count':0x0,'rows':[]};var _0x598f49=_[_0x2db8('0x25')](db[_0x2db8('0x26')][_0x2db8('0x27')],function(_0xc344e2){return{'name':_0xc344e2['fieldName'],'type':_0xc344e2[_0x2db8('0x28')][_0x2db8('0x29')]};});_0x37049d[_0x2db8('0x2a')]=_[_0x2db8('0x25')](_0x598f49,_0x2db8('0x22'));_0x37049d[_0x2db8('0x2b')]=_[_0x2db8('0x2c')](_0x3569ae[_0x2db8('0x2b')]);_0x37049d[_0x2db8('0x2d')]=_[_0x2db8('0x2e')](_0x37049d['model'],_0x37049d['query']);_0x48c740[_0x2db8('0x2f')]=_[_0x2db8('0x2e')](_0x37049d[_0x2db8('0x2a')],qs[_0x2db8('0x30')](_0x3569ae[_0x2db8('0x2b')][_0x2db8('0x30')]));_0x48c740['attributes']=_0x48c740['attributes'][_0x2db8('0x31')]?_0x48c740[_0x2db8('0x2f')]:_0x37049d[_0x2db8('0x2a')];if(!_0x3569ae[_0x2db8('0x2b')][_0x2db8('0x32')]('nolimit')){_0x48c740[_0x2db8('0x17')]=qs[_0x2db8('0x17')](_0x3569ae[_0x2db8('0x2b')][_0x2db8('0x17')]);_0x48c740['offset']=qs[_0x2db8('0x16')](_0x3569ae[_0x2db8('0x2b')]['offset']);}_0x48c740['order']=qs[_0x2db8('0x33')](_0x3569ae[_0x2db8('0x2b')]['sort']);_0x48c740[_0x2db8('0x34')]=qs[_0x2db8('0x2d')](_[_0x2db8('0x35')](_0x3569ae[_0x2db8('0x2b')],_0x37049d[_0x2db8('0x2d')]),_0x598f49);if(_0x3569ae[_0x2db8('0x2b')][_0x2db8('0x36')]){_0x48c740[_0x2db8('0x34')]=_[_0x2db8('0x37')](_0x48c740['where'],{'$or':_[_0x2db8('0x25')](_0x598f49,function(_0x34112c){if(_0x34112c[_0x2db8('0x28')]!==_0x2db8('0x38')){var _0x5d08ec={};_0x5d08ec[_0x34112c[_0x2db8('0x22')]]={'$like':'%'+_0x3569ae[_0x2db8('0x2b')]['filter']+'%'};return _0x5d08ec;}})});}_0x48c740=_[_0x2db8('0x37')]({},_0x48c740,_0x3569ae['options']);var _0x36e2e8={'where':_0x48c740[_0x2db8('0x34')]};return db[_0x2db8('0x26')]['count'](_0x36e2e8)['then'](function(_0x3505bc){_0x31335f[_0x2db8('0x15')]=_0x3505bc;if(_0x3569ae[_0x2db8('0x2b')][_0x2db8('0x39')]){_0x48c740[_0x2db8('0x3a')]=[{'all':!![]}];}return db[_0x2db8('0x26')][_0x2db8('0x3b')](_0x48c740);})[_0x2db8('0x1e')](function(_0x244a51){_0x31335f['rows']=_0x244a51;return _0x31335f;})['then'](respondWithFilteredResult(_0x3de877,_0x48c740))[_0x2db8('0x3c')](handleError(_0x3de877,null));};exports[_0x2db8('0x3d')]=function(_0x5e5196,_0x1e5c35){var _0x33d518={'raw':!![],'where':{'id':_0x5e5196[_0x2db8('0x3e')]['id']}},_0x37bb41={};_0x37bb41[_0x2db8('0x2a')]=_[_0x2db8('0x2c')](db['CmContactHasItem'][_0x2db8('0x27')]);_0x37bb41[_0x2db8('0x2b')]=_[_0x2db8('0x2c')](_0x5e5196[_0x2db8('0x2b')]);_0x37bb41[_0x2db8('0x2d')]=_[_0x2db8('0x2e')](_0x37bb41[_0x2db8('0x2a')],_0x37bb41[_0x2db8('0x2b')]);_0x33d518[_0x2db8('0x2f')]=_[_0x2db8('0x2e')](_0x37bb41['model'],qs[_0x2db8('0x30')](_0x5e5196['query'][_0x2db8('0x30')]));_0x33d518['attributes']=_0x33d518[_0x2db8('0x2f')][_0x2db8('0x31')]?_0x33d518[_0x2db8('0x2f')]:_0x37bb41['model'];if(_0x5e5196['query'][_0x2db8('0x39')]){_0x33d518[_0x2db8('0x3a')]=[{'all':!![]}];}_0x33d518=_[_0x2db8('0x37')]({},_0x33d518,_0x5e5196[_0x2db8('0x3f')]);return db[_0x2db8('0x26')][_0x2db8('0x40')](_0x33d518)[_0x2db8('0x1e')](handleEntityNotFound(_0x1e5c35,null))[_0x2db8('0x1e')](respondWithResult(_0x1e5c35,null))['catch'](handleError(_0x1e5c35,null));};exports[_0x2db8('0x41')]=function(_0x3e20ed,_0x2915ff){return db[_0x2db8('0x26')][_0x2db8('0x41')](_0x3e20ed[_0x2db8('0x42')],{})[_0x2db8('0x1e')](function(_0x16a521){var _0x4d40e4=_0x3e20ed[_0x2db8('0x43')][_0x2db8('0x44')]({'plain':!![]});if(!_0x4d40e4)throw new Error(_0x2db8('0x45'));if(_0x4d40e4[_0x2db8('0x46')]===_0x2db8('0x43')){var _0x47a33b=_0x16a521[_0x2db8('0x44')]({'plain':!![]});var _0x3a1643=_0x2db8('0x1f');return db[_0x2db8('0x47')][_0x2db8('0x40')]({'where':{'name':_0x3a1643,'userProfileId':_0x4d40e4['userProfileId']},'raw':!![]})[_0x2db8('0x1e')](function(_0x4f1824){if(_0x4f1824&&_0x4f1824[_0x2db8('0x48')]===0x0){return db[_0x2db8('0x49')]['create']({'name':_0x47a33b[_0x2db8('0x22')],'resourceId':_0x47a33b['id'],'type':_0x4f1824['name'],'sectionId':_0x4f1824['id']},{})[_0x2db8('0x1e')](function(){return _0x16a521;});}else{return _0x16a521;}})[_0x2db8('0x3c')](function(_0x27d172){logger[_0x2db8('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27d172);throw _0x27d172;});}return _0x16a521;})[_0x2db8('0x1e')](respondWithResult(_0x2915ff,0xc9))[_0x2db8('0x3c')](handleError(_0x2915ff,null));};exports[_0x2db8('0x1c')]=function(_0x5343d8,_0x1c5255){if(_0x5343d8[_0x2db8('0x42')]['id']){delete _0x5343d8[_0x2db8('0x42')]['id'];}return db[_0x2db8('0x26')][_0x2db8('0x40')]({'where':{'id':_0x5343d8[_0x2db8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1c5255,null))[_0x2db8('0x1e')](saveUpdates(_0x5343d8[_0x2db8('0x42')],null))['then'](respondWithResult(_0x1c5255,null))['catch'](handleError(_0x1c5255,null));};exports['destroy']=function(_0x321212,_0x3f264f){return db[_0x2db8('0x26')]['find']({'where':{'id':_0x321212[_0x2db8('0x3e')]['id']}})[_0x2db8('0x1e')](handleEntityNotFound(_0x3f264f,null))[_0x2db8('0x1e')](removeEntity(_0x3f264f,null))[_0x2db8('0x3c')](handleError(_0x3f264f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index df22455..9951e35 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 _0x81c6=['CmContactHasItem','util','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define'];(function(_0x17df77,_0xbece4){var _0x356a9a=function(_0x592b35){while(--_0x592b35){_0x17df77['push'](_0x17df77['shift']());}};_0x356a9a(++_0xbece4);}(_0x81c6,0x1d5));var _0x681c=function(_0x1d6a12,_0x49b3d3){_0x1d6a12=_0x1d6a12-0x0;var _0x3a79ca=_0x81c6[_0x1d6a12];return _0x3a79ca;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x78ef4d,_0x1768aa){_0x78ef4d=_0x78ef4d-0x0;var _0x3817c4=_0xb4c7[_0x78ef4d];return _0x3817c4;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('CmContactHasItem',attributes,{'tableName':_0x7b4c('0xb'),'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 0aa30f2..9951b53 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 _0xe20e=['CmContactHasItem,\x20%s,\x20%s','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x10ab94,_0x5384b7){var _0x279f26=function(_0x4a0d8a){while(--_0x4a0d8a){_0x10ab94['push'](_0x10ab94['shift']());}};_0x279f26(++_0x5384b7);}(_0xe20e,0x195));var _0xee20=function(_0x3d8995,_0x5f4f4b){_0x3d8995=_0x3d8995-0x0;var _0x5dd8ed=_0xe20e[_0x3d8995];return _0x5dd8ed;};'use strict';var _=require(_0xee20('0x0'));var util=require(_0xee20('0x1'));var moment=require('moment');var BPromise=require(_0xee20('0x2'));var rs=require(_0xee20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee20('0x4'));var logger=require('../../config/logger')(_0xee20('0x5'));var config=require(_0xee20('0x6'));var jayson=require(_0xee20('0x7'));var client=jayson[_0xee20('0x8')][_0xee20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd8d1e,_0x3ba270,_0x15f380){return new BPromise(function(_0x34f82d,_0x120622){return client[_0xee20('0xa')](_0xd8d1e,_0x15f380)[_0xee20('0xb')](function(_0x50ed9b){logger[_0xee20('0xc')](_0xee20('0xd'),_0x3ba270,'request\x20sent');logger['debug'](_0xee20('0xe'),_0x3ba270,_0xee20('0xf'),JSON[_0xee20('0x10')](_0x50ed9b));if(_0x50ed9b[_0xee20('0x11')]){if(_0x50ed9b['error'][_0xee20('0x12')]===0x1f4){logger[_0xee20('0x11')](_0xee20('0xd'),_0x3ba270,_0x50ed9b[_0xee20('0x11')][_0xee20('0x13')]);return _0x120622(_0x50ed9b[_0xee20('0x11')][_0xee20('0x13')]);}logger['error'](_0xee20('0xd'),_0x3ba270,_0x50ed9b['error'][_0xee20('0x13')]);return _0x34f82d(_0x50ed9b[_0xee20('0x11')][_0xee20('0x13')]);}else{logger['info'](_0xee20('0xd'),_0x3ba270,_0xee20('0xf'));_0x34f82d(_0x50ed9b[_0xee20('0x14')][_0xee20('0x13')]);}})[_0xee20('0x15')](function(_0x5bc2a0){logger[_0xee20('0x11')](_0xee20('0xd'),_0x3ba270,_0x5bc2a0);_0x120622(_0x5bc2a0);});});} \ No newline at end of file +var _0xe8a1=['rpc','../../config/environment','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x10b7e4,_0x584183){var _0x54e873=function(_0x32a0b6){while(--_0x32a0b6){_0x10b7e4['push'](_0x10b7e4['shift']());}};_0x54e873(++_0x584183);}(_0xe8a1,0x1f2));var _0x1e8a=function(_0x932345,_0x2c91a1){_0x932345=_0x932345-0x0;var _0x5e43ec=_0xe8a1[_0x932345];return _0x5e43ec;};'use strict';var _=require(_0x1e8a('0x0'));var util=require('util');var moment=require(_0x1e8a('0x1'));var BPromise=require(_0x1e8a('0x2'));var rs=require(_0x1e8a('0x3'));var fs=require('fs');var Redis=require(_0x1e8a('0x4'));var db=require(_0x1e8a('0x5'))['db'];var utils=require(_0x1e8a('0x6'));var logger=require(_0x1e8a('0x7'))(_0x1e8a('0x8'));var config=require(_0x1e8a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1e8a('0xa')][_0x1e8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53a19a,_0x135366,_0x3988b6){return new BPromise(function(_0x34831f,_0x5f90fe){return client['request'](_0x53a19a,_0x3988b6)[_0x1e8a('0xc')](function(_0x6858c0){logger[_0x1e8a('0xd')](_0x1e8a('0xe'),_0x135366,'request\x20sent');logger[_0x1e8a('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x135366,'request\x20sent',JSON[_0x1e8a('0x10')](_0x6858c0));if(_0x6858c0[_0x1e8a('0x11')]){if(_0x6858c0[_0x1e8a('0x11')][_0x1e8a('0x12')]===0x1f4){logger[_0x1e8a('0x11')](_0x1e8a('0xe'),_0x135366,_0x6858c0['error']['message']);return _0x5f90fe(_0x6858c0[_0x1e8a('0x11')][_0x1e8a('0x13')]);}logger[_0x1e8a('0x11')](_0x1e8a('0xe'),_0x135366,_0x6858c0[_0x1e8a('0x11')][_0x1e8a('0x13')]);return _0x34831f(_0x6858c0['error'][_0x1e8a('0x13')]);}else{logger[_0x1e8a('0xd')](_0x1e8a('0xe'),_0x135366,_0x1e8a('0x14'));_0x34831f(_0x6858c0[_0x1e8a('0x15')][_0x1e8a('0x13')]);}})[_0x1e8a('0x16')](function(_0x1d8ac3){logger[_0x1e8a('0x11')](_0x1e8a('0xe'),_0x135366,_0x1d8ac3);_0x5f90fe(_0x1d8ac3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4badbb6..ff8704f 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 _0xc32b=['create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','post'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0xc32b,0x9e));var _0xbc32=function(_0x2eaa53,_0x4028fd){_0x2eaa53=_0x2eaa53-0x0;var _0x15f59f=_0xc32b[_0x2eaa53];return _0x15f59f;};'use strict';var multer=require(_0xbc32('0x0'));var util=require('util');var path=require(_0xbc32('0x1'));var timeout=require(_0xbc32('0x2'));var express=require(_0xbc32('0x3'));var router=express[_0xbc32('0x4')]();var auth=require(_0xbc32('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc32('0x6'));router[_0xbc32('0x7')]('/',auth[_0xbc32('0x8')](),controller['index']);router[_0xbc32('0x7')](_0xbc32('0x9'),auth['isAuthenticated'](),controller[_0xbc32('0xa')]);router[_0xbc32('0xb')]('/',auth[_0xbc32('0x8')](),controller[_0xbc32('0xc')]);router['put'](_0xbc32('0x9'),auth['isAuthenticated'](),controller[_0xbc32('0xd')]);router[_0xbc32('0xe')](_0xbc32('0x9'),auth[_0xbc32('0x8')](),controller[_0xbc32('0xf')]);module[_0xbc32('0x10')]=router; \ No newline at end of file +var _0x67a7=['isAuthenticated','index','show','post','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0x54026d,_0x215e17){var _0x2226de=function(_0x32935){while(--_0x32935){_0x54026d['push'](_0x54026d['shift']());}};_0x2226de(++_0x215e17);}(_0x67a7,0x14d));var _0x767a=function(_0x619e53,_0x3cdbd2){_0x619e53=_0x619e53-0x0;var _0x24c385=_0x67a7[_0x619e53];return _0x24c385;};'use strict';var multer=require('multer');var util=require(_0x767a('0x0'));var path=require(_0x767a('0x1'));var timeout=require(_0x767a('0x2'));var express=require(_0x767a('0x3'));var router=express[_0x767a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x767a('0x5'));var config=require(_0x767a('0x6'));var controller=require(_0x767a('0x7'));router[_0x767a('0x8')]('/',auth[_0x767a('0x9')](),controller[_0x767a('0xa')]);router[_0x767a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x767a('0xb')]);router[_0x767a('0xc')]('/',auth[_0x767a('0x9')](),controller['create']);router[_0x767a('0xd')](_0x767a('0xe'),auth[_0x767a('0x9')](),controller[_0x767a('0xf')]);router[_0x767a('0x10')](_0x767a('0xe'),auth[_0x767a('0x9')](),controller[_0x767a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index e80ebbe..1be7134 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 _0xd497=['INTEGER','STRING'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xd497,0x170));var _0x7d49=function(_0xc289f8,_0x83bbb6){_0xc289f8=_0xc289f8-0x0;var _0x43e75c=_0xd497[_0xc289f8];return _0x43e75c;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x7d49('0x0')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x7d49('0x1')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xbf73=['INTEGER','STRING','sequelize','exports'];(function(_0x25c2ad,_0xd5ca5){var _0x555eec=function(_0x46c77f){while(--_0x46c77f){_0x25c2ad['push'](_0x25c2ad['shift']());}};_0x555eec(++_0xd5ca5);}(_0xbf73,0x186));var _0x3bf7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbf73[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x3bf7('0x0'));module[_0x3bf7('0x1')]={'CmContactId':{'type':Sequelize[_0x3bf7('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x3bf7('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index cbe5138..69e3e73 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 _0x8af7=['keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','options','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','CmContactHasPhones','UserProfileResource','error','name','send','index','map','CmContactHasPhone','type','key','model'];(function(_0x531607,_0x73fa88){var _0x1b1fbb=function(_0x4af491){while(--_0x4af491){_0x531607['push'](_0x531607['shift']());}};_0x1b1fbb(++_0x73fa88);}(_0x8af7,0x15f));var _0x78af=function(_0x275374,_0x566db6){_0x275374=_0x275374-0x0;var _0x423cfb=_0x8af7[_0x275374];return _0x423cfb;};'use strict';var pdf=require(_0x78af('0x0'));var emlformat=require(_0x78af('0x1'));var rimraf=require(_0x78af('0x2'));var zipdir=require(_0x78af('0x3'));var jsonpatch=require(_0x78af('0x4'));var rp=require(_0x78af('0x5'));var moment=require(_0x78af('0x6'));var BPromise=require(_0x78af('0x7'));var Mustache=require('mustache');var util=require(_0x78af('0x8'));var path=require(_0x78af('0x9'));var sox=require(_0x78af('0xa'));var csv=require(_0x78af('0xb'));var ejs=require(_0x78af('0xc'));var fs=require('fs');var _=require(_0x78af('0xd'));var squel=require('squel');var crypto=require(_0x78af('0xe'));var jsforce=require(_0x78af('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x78af('0xb'));var querystring=require(_0x78af('0x10'));var Papa=require('papaparse');var Redis=require(_0x78af('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x78af('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78af('0x13'));var logger=require(_0x78af('0x14'))(_0x78af('0x15'));var utils=require(_0x78af('0x16'));var config=require(_0x78af('0x17'));var db=require(_0x78af('0x18'))['db'];function respondWithStatusCode(_0xcf5192,_0x36bec6){_0x36bec6=_0x36bec6||0xcc;return function(_0x2918b4){if(_0x2918b4){return _0xcf5192[_0x78af('0x19')](_0x36bec6);}return _0xcf5192['status'](_0x36bec6)[_0x78af('0x1a')]();};}function respondWithResult(_0x2c87e6,_0x4db26a){_0x4db26a=_0x4db26a||0xc8;return function(_0x26e4f9){if(_0x26e4f9){return _0x2c87e6[_0x78af('0x1b')](_0x4db26a)['json'](_0x26e4f9);}};}function respondWithFilteredResult(_0x2619ef,_0x1e90b9){return function(_0x222edd){if(_0x222edd){var _0x4d93b4=_0x222edd[_0x78af('0x1c')],_0x21ee42=_0x1e90b9[_0x78af('0x1d')],_0x37d4bf=_0x1e90b9['offset']+_0x1e90b9[_0x78af('0x1e')],_0x4b31e5;if(_0x37d4bf>=_0x4d93b4){_0x37d4bf=_0x4d93b4;_0x4b31e5=0xc8;}else{_0x4b31e5=0xce;}_0x2619ef[_0x78af('0x1b')](_0x4b31e5);return _0x2619ef['set'](_0x78af('0x1f'),_0x21ee42+'-'+_0x37d4bf+'/'+_0x4d93b4)['json'](_0x222edd);}return null;};}function patchUpdates(_0x2163c7){return function(_0x40ab77){try{jsonpatch[_0x78af('0x20')](_0x40ab77,_0x2163c7,!![]);}catch(_0x2f3665){return BPromise[_0x78af('0x21')](_0x2f3665);}return _0x40ab77[_0x78af('0x22')]();};}function saveUpdates(_0x5b721d,_0x5a3437){return function(_0x2a3e9c){if(_0x2a3e9c){return _0x2a3e9c[_0x78af('0x23')](_0x5b721d)['then'](function(_0xbbc491){return _0xbbc491;});}return null;};}function removeEntity(_0x430c64,_0x521464){return function(_0x1ab898){if(_0x1ab898){return _0x1ab898[_0x78af('0x24')]()[_0x78af('0x25')](function(){var _0x451973=_0x1ab898['get']({'plain':!![]});var _0x4faf6e=_0x78af('0x26');return db[_0x78af('0x27')][_0x78af('0x24')]({'where':{'type':_0x4faf6e,'resourceId':_0x451973['id']}})['then'](function(){return _0x1ab898;});})[_0x78af('0x25')](function(){_0x430c64['status'](0xcc)[_0x78af('0x1a')]();});}};}function handleEntityNotFound(_0x5ce702,_0x56605f){return function(_0x10eadf){if(!_0x10eadf){_0x5ce702[_0x78af('0x19')](0x194);}return _0x10eadf;};}function handleError(_0x4e8d93,_0x1c2324){_0x1c2324=_0x1c2324||0x1f4;return function(_0x410921){logger[_0x78af('0x28')](_0x410921['stack']);if(_0x410921['name']){delete _0x410921[_0x78af('0x29')];}_0x4e8d93[_0x78af('0x1b')](_0x1c2324)[_0x78af('0x2a')](_0x410921);};}exports[_0x78af('0x2b')]=function(_0x287f83,_0x10f0cb){var _0x460574={},_0x1d6657={},_0xe35ee2={'count':0x0,'rows':[]};var _0x56962c=_[_0x78af('0x2c')](db[_0x78af('0x2d')]['rawAttributes'],function(_0xc11ce3){return{'name':_0xc11ce3['fieldName'],'type':_0xc11ce3[_0x78af('0x2e')][_0x78af('0x2f')]};});_0x1d6657[_0x78af('0x30')]=_[_0x78af('0x2c')](_0x56962c,_0x78af('0x29'));_0x1d6657['query']=_[_0x78af('0x31')](_0x287f83[_0x78af('0x32')]);_0x1d6657[_0x78af('0x33')]=_[_0x78af('0x34')](_0x1d6657['model'],_0x1d6657[_0x78af('0x32')]);_0x460574['attributes']=_[_0x78af('0x34')](_0x1d6657[_0x78af('0x30')],qs['fields'](_0x287f83['query'][_0x78af('0x35')]));_0x460574[_0x78af('0x36')]=_0x460574[_0x78af('0x36')][_0x78af('0x37')]?_0x460574['attributes']:_0x1d6657['model'];if(!_0x287f83[_0x78af('0x32')]['hasOwnProperty'](_0x78af('0x38'))){_0x460574['limit']=qs[_0x78af('0x1e')](_0x287f83[_0x78af('0x32')][_0x78af('0x1e')]);_0x460574[_0x78af('0x1d')]=qs[_0x78af('0x1d')](_0x287f83['query'][_0x78af('0x1d')]);}_0x460574[_0x78af('0x39')]=qs[_0x78af('0x3a')](_0x287f83[_0x78af('0x32')][_0x78af('0x3a')]);_0x460574[_0x78af('0x3b')]=qs[_0x78af('0x33')](_['pick'](_0x287f83[_0x78af('0x32')],_0x1d6657[_0x78af('0x33')]),_0x56962c);if(_0x287f83['query'][_0x78af('0x3c')]){_0x460574[_0x78af('0x3b')]=_[_0x78af('0x3d')](_0x460574[_0x78af('0x3b')],{'$or':_['map'](_0x56962c,function(_0x4303cb){if(_0x4303cb[_0x78af('0x2e')]!==_0x78af('0x3e')){var _0x5eec8a={};_0x5eec8a[_0x4303cb[_0x78af('0x29')]]={'$like':'%'+_0x287f83['query'][_0x78af('0x3c')]+'%'};return _0x5eec8a;}})});}_0x460574=_['merge']({},_0x460574,_0x287f83['options']);var _0x36c27={'where':_0x460574['where']};return db[_0x78af('0x2d')][_0x78af('0x1c')](_0x36c27)['then'](function(_0x1e2fa5){_0xe35ee2[_0x78af('0x1c')]=_0x1e2fa5;if(_0x287f83['query'][_0x78af('0x3f')]){_0x460574['include']=[{'all':!![]}];}return db['CmContactHasPhone'][_0x78af('0x40')](_0x460574);})[_0x78af('0x25')](function(_0x2b26de){_0xe35ee2['rows']=_0x2b26de;return _0xe35ee2;})[_0x78af('0x25')](respondWithFilteredResult(_0x10f0cb,_0x460574))[_0x78af('0x41')](handleError(_0x10f0cb,null));};exports[_0x78af('0x42')]=function(_0xe97801,_0x291105){var _0xe16e6d={'raw':!![],'where':{'id':_0xe97801[_0x78af('0x43')]['id']}},_0x2da473={};_0x2da473[_0x78af('0x30')]=_['keys'](db['CmContactHasPhone'][_0x78af('0x44')]);_0x2da473[_0x78af('0x32')]=_[_0x78af('0x31')](_0xe97801['query']);_0x2da473[_0x78af('0x33')]=_[_0x78af('0x34')](_0x2da473[_0x78af('0x30')],_0x2da473['query']);_0xe16e6d['attributes']=_[_0x78af('0x34')](_0x2da473[_0x78af('0x30')],qs[_0x78af('0x35')](_0xe97801[_0x78af('0x32')][_0x78af('0x35')]));_0xe16e6d[_0x78af('0x36')]=_0xe16e6d[_0x78af('0x36')][_0x78af('0x37')]?_0xe16e6d[_0x78af('0x36')]:_0x2da473['model'];if(_0xe97801[_0x78af('0x32')][_0x78af('0x3f')]){_0xe16e6d['include']=[{'all':!![]}];}_0xe16e6d=_[_0x78af('0x3d')]({},_0xe16e6d,_0xe97801[_0x78af('0x45')]);return db[_0x78af('0x2d')][_0x78af('0x46')](_0xe16e6d)[_0x78af('0x25')](handleEntityNotFound(_0x291105,null))[_0x78af('0x25')](respondWithResult(_0x291105,null))['catch'](handleError(_0x291105,null));};exports[_0x78af('0x47')]=function(_0x16c16a,_0x1256e9){return db[_0x78af('0x2d')][_0x78af('0x47')](_0x16c16a['body'],{})['then'](function(_0x228600){var _0x1b89af=_0x16c16a[_0x78af('0x48')][_0x78af('0x49')]({'plain':!![]});if(!_0x1b89af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b89af[_0x78af('0x4a')]===_0x78af('0x48')){var _0x3c84d2=_0x228600[_0x78af('0x49')]({'plain':!![]});var _0x11d95c='CmContactHasPhones';return db[_0x78af('0x4b')][_0x78af('0x46')]({'where':{'name':_0x11d95c,'userProfileId':_0x1b89af[_0x78af('0x4c')]},'raw':!![]})[_0x78af('0x25')](function(_0x45a3ea){if(_0x45a3ea&&_0x45a3ea[_0x78af('0x4d')]===0x0){return db['UserProfileResource'][_0x78af('0x47')]({'name':_0x3c84d2[_0x78af('0x29')],'resourceId':_0x3c84d2['id'],'type':_0x45a3ea[_0x78af('0x29')],'sectionId':_0x45a3ea['id']},{})[_0x78af('0x25')](function(){return _0x228600;});}else{return _0x228600;}})[_0x78af('0x41')](function(_0x258164){logger[_0x78af('0x28')](_0x78af('0x4e'),_0x258164);throw _0x258164;});}return _0x228600;})['then'](respondWithResult(_0x1256e9,0xc9))[_0x78af('0x41')](handleError(_0x1256e9,null));};exports[_0x78af('0x23')]=function(_0x1b852c,_0x320914){if(_0x1b852c['body']['id']){delete _0x1b852c[_0x78af('0x4f')]['id'];}return db[_0x78af('0x2d')][_0x78af('0x46')]({'where':{'id':_0x1b852c['params']['id']}})[_0x78af('0x25')](handleEntityNotFound(_0x320914,null))['then'](saveUpdates(_0x1b852c[_0x78af('0x4f')],null))[_0x78af('0x25')](respondWithResult(_0x320914,null))[_0x78af('0x41')](handleError(_0x320914,null));};exports[_0x78af('0x24')]=function(_0x2c05d9,_0xa8a8ae){return db[_0x78af('0x2d')]['find']({'where':{'id':_0x2c05d9['params']['id']}})[_0x78af('0x25')](handleEntityNotFound(_0xa8a8ae,null))[_0x78af('0x25')](removeEntity(_0xa8a8ae,null))[_0x78af('0x41')](handleError(_0xa8a8ae,null));}; \ No newline at end of file +var _0x4b01=['attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','CmContactHasPhone','includeAll','findAll','catch','fields','include','find','create','user','role','CmContactHasPhones','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','html-pdf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x33c01e,_0x2d2908){var _0x278b47=function(_0xa2e238){while(--_0xa2e238){_0x33c01e['push'](_0x33c01e['shift']());}};_0x278b47(++_0x2d2908);}(_0x4b01,0x6b));var _0x14b0=function(_0x3a35e7,_0x31f899){_0x3a35e7=_0x3a35e7-0x0;var _0x34f4b2=_0x4b01[_0x3a35e7];return _0x34f4b2;};'use strict';var pdf=require(_0x14b0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x14b0('0x1'));var rp=require('request-promise');var moment=require(_0x14b0('0x2'));var BPromise=require(_0x14b0('0x3'));var Mustache=require(_0x14b0('0x4'));var util=require(_0x14b0('0x5'));var path=require(_0x14b0('0x6'));var sox=require(_0x14b0('0x7'));var csv=require(_0x14b0('0x8'));var ejs=require(_0x14b0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x14b0('0xa'));var crypto=require(_0x14b0('0xb'));var jsforce=require(_0x14b0('0xc'));var deskjs=require(_0x14b0('0xd'));var toCsv=require(_0x14b0('0x8'));var querystring=require(_0x14b0('0xe'));var Papa=require(_0x14b0('0xf'));var Redis=require(_0x14b0('0x10'));var authService=require(_0x14b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x14b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x14b0('0x13'))(_0x14b0('0x14'));var utils=require(_0x14b0('0x15'));var config=require(_0x14b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132ba4,_0x4aef09){_0x4aef09=_0x4aef09||0xcc;return function(_0x1d3cd5){if(_0x1d3cd5){return _0x132ba4[_0x14b0('0x17')](_0x4aef09);}return _0x132ba4[_0x14b0('0x18')](_0x4aef09)[_0x14b0('0x19')]();};}function respondWithResult(_0x4a0b95,_0xc27c08){_0xc27c08=_0xc27c08||0xc8;return function(_0x26f7fc){if(_0x26f7fc){return _0x4a0b95[_0x14b0('0x18')](_0xc27c08)[_0x14b0('0x1a')](_0x26f7fc);}};}function respondWithFilteredResult(_0x177668,_0x4d6612){return function(_0x10d0ec){if(_0x10d0ec){var _0x42399b=_0x10d0ec[_0x14b0('0x1b')],_0x2e17be=_0x4d6612[_0x14b0('0x1c')],_0x5f444f=_0x4d6612[_0x14b0('0x1c')]+_0x4d6612[_0x14b0('0x1d')],_0x24ad28;if(_0x5f444f>=_0x42399b){_0x5f444f=_0x42399b;_0x24ad28=0xc8;}else{_0x24ad28=0xce;}_0x177668[_0x14b0('0x18')](_0x24ad28);return _0x177668[_0x14b0('0x1e')](_0x14b0('0x1f'),_0x2e17be+'-'+_0x5f444f+'/'+_0x42399b)[_0x14b0('0x1a')](_0x10d0ec);}return null;};}function patchUpdates(_0x2d189d){return function(_0x38eda7){try{jsonpatch[_0x14b0('0x20')](_0x38eda7,_0x2d189d,!![]);}catch(_0x5b3561){return BPromise['reject'](_0x5b3561);}return _0x38eda7[_0x14b0('0x21')]();};}function saveUpdates(_0x37fe52,_0x68f682){return function(_0x303559){if(_0x303559){return _0x303559[_0x14b0('0x22')](_0x37fe52)[_0x14b0('0x23')](function(_0x5690ba){return _0x5690ba;});}return null;};}function removeEntity(_0x20cbca,_0x1b0e80){return function(_0x22f4d2){if(_0x22f4d2){return _0x22f4d2['destroy']()['then'](function(){var _0x4d47d0=_0x22f4d2[_0x14b0('0x24')]({'plain':!![]});var _0x4945e2='CmContactHasPhones';return db[_0x14b0('0x25')]['destroy']({'where':{'type':_0x4945e2,'resourceId':_0x4d47d0['id']}})[_0x14b0('0x23')](function(){return _0x22f4d2;});})[_0x14b0('0x23')](function(){_0x20cbca[_0x14b0('0x18')](0xcc)[_0x14b0('0x19')]();});}};}function handleEntityNotFound(_0x106274,_0x4f528a){return function(_0x5e7b94){if(!_0x5e7b94){_0x106274[_0x14b0('0x17')](0x194);}return _0x5e7b94;};}function handleError(_0x2df426,_0x3db9e8){_0x3db9e8=_0x3db9e8||0x1f4;return function(_0x29f4a1){logger[_0x14b0('0x26')](_0x29f4a1[_0x14b0('0x27')]);if(_0x29f4a1[_0x14b0('0x28')]){delete _0x29f4a1[_0x14b0('0x28')];}_0x2df426[_0x14b0('0x18')](_0x3db9e8)[_0x14b0('0x29')](_0x29f4a1);};}exports['index']=function(_0x1cded6,_0x851319){var _0x1b4f32={},_0x5af490={},_0x401d7a={'count':0x0,'rows':[]};var _0x28383a=_['map'](db['CmContactHasPhone'][_0x14b0('0x2a')],function(_0x51fd4d){return{'name':_0x51fd4d[_0x14b0('0x2b')],'type':_0x51fd4d[_0x14b0('0x2c')][_0x14b0('0x2d')]};});_0x5af490[_0x14b0('0x2e')]=_['map'](_0x28383a,'name');_0x5af490[_0x14b0('0x2f')]=_[_0x14b0('0x30')](_0x1cded6['query']);_0x5af490[_0x14b0('0x31')]=_[_0x14b0('0x32')](_0x5af490['model'],_0x5af490[_0x14b0('0x2f')]);_0x1b4f32[_0x14b0('0x33')]=_[_0x14b0('0x32')](_0x5af490['model'],qs['fields'](_0x1cded6['query']['fields']));_0x1b4f32[_0x14b0('0x33')]=_0x1b4f32[_0x14b0('0x33')][_0x14b0('0x34')]?_0x1b4f32[_0x14b0('0x33')]:_0x5af490[_0x14b0('0x2e')];if(!_0x1cded6[_0x14b0('0x2f')][_0x14b0('0x35')](_0x14b0('0x36'))){_0x1b4f32['limit']=qs['limit'](_0x1cded6[_0x14b0('0x2f')][_0x14b0('0x1d')]);_0x1b4f32[_0x14b0('0x1c')]=qs['offset'](_0x1cded6[_0x14b0('0x2f')][_0x14b0('0x1c')]);}_0x1b4f32['order']=qs[_0x14b0('0x37')](_0x1cded6[_0x14b0('0x2f')][_0x14b0('0x37')]);_0x1b4f32['where']=qs['filters'](_[_0x14b0('0x38')](_0x1cded6[_0x14b0('0x2f')],_0x5af490[_0x14b0('0x31')]),_0x28383a);if(_0x1cded6[_0x14b0('0x2f')][_0x14b0('0x39')]){_0x1b4f32[_0x14b0('0x3a')]=_[_0x14b0('0x3b')](_0x1b4f32[_0x14b0('0x3a')],{'$or':_[_0x14b0('0x3c')](_0x28383a,function(_0x2bb417){if(_0x2bb417[_0x14b0('0x2c')]!=='VIRTUAL'){var _0x154153={};_0x154153[_0x2bb417['name']]={'$like':'%'+_0x1cded6[_0x14b0('0x2f')][_0x14b0('0x39')]+'%'};return _0x154153;}})});}_0x1b4f32=_[_0x14b0('0x3b')]({},_0x1b4f32,_0x1cded6[_0x14b0('0x3d')]);var _0x4d1786={'where':_0x1b4f32['where']};return db[_0x14b0('0x3e')][_0x14b0('0x1b')](_0x4d1786)[_0x14b0('0x23')](function(_0x10b778){_0x401d7a[_0x14b0('0x1b')]=_0x10b778;if(_0x1cded6[_0x14b0('0x2f')][_0x14b0('0x3f')]){_0x1b4f32['include']=[{'all':!![]}];}return db[_0x14b0('0x3e')][_0x14b0('0x40')](_0x1b4f32);})[_0x14b0('0x23')](function(_0x5410c8){_0x401d7a['rows']=_0x5410c8;return _0x401d7a;})[_0x14b0('0x23')](respondWithFilteredResult(_0x851319,_0x1b4f32))[_0x14b0('0x41')](handleError(_0x851319,null));};exports['show']=function(_0x3f71f0,_0x4c4d5b){var _0xc0890={'raw':!![],'where':{'id':_0x3f71f0['params']['id']}},_0x114ec2={};_0x114ec2[_0x14b0('0x2e')]=_[_0x14b0('0x30')](db[_0x14b0('0x3e')]['rawAttributes']);_0x114ec2[_0x14b0('0x2f')]=_[_0x14b0('0x30')](_0x3f71f0[_0x14b0('0x2f')]);_0x114ec2[_0x14b0('0x31')]=_[_0x14b0('0x32')](_0x114ec2['model'],_0x114ec2[_0x14b0('0x2f')]);_0xc0890[_0x14b0('0x33')]=_[_0x14b0('0x32')](_0x114ec2['model'],qs[_0x14b0('0x42')](_0x3f71f0[_0x14b0('0x2f')][_0x14b0('0x42')]));_0xc0890[_0x14b0('0x33')]=_0xc0890[_0x14b0('0x33')][_0x14b0('0x34')]?_0xc0890[_0x14b0('0x33')]:_0x114ec2['model'];if(_0x3f71f0['query'][_0x14b0('0x3f')]){_0xc0890[_0x14b0('0x43')]=[{'all':!![]}];}_0xc0890=_['merge']({},_0xc0890,_0x3f71f0[_0x14b0('0x3d')]);return db['CmContactHasPhone'][_0x14b0('0x44')](_0xc0890)['then'](handleEntityNotFound(_0x4c4d5b,null))['then'](respondWithResult(_0x4c4d5b,null))[_0x14b0('0x41')](handleError(_0x4c4d5b,null));};exports[_0x14b0('0x45')]=function(_0x17b75e,_0x4663a2){return db[_0x14b0('0x3e')][_0x14b0('0x45')](_0x17b75e['body'],{})[_0x14b0('0x23')](function(_0x263df4){var _0x3f5d5a=_0x17b75e[_0x14b0('0x46')][_0x14b0('0x24')]({'plain':!![]});if(!_0x3f5d5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f5d5a[_0x14b0('0x47')]===_0x14b0('0x46')){var _0xcfe440=_0x263df4[_0x14b0('0x24')]({'plain':!![]});var _0x1b73aa=_0x14b0('0x48');return db['UserProfileSection'][_0x14b0('0x44')]({'where':{'name':_0x1b73aa,'userProfileId':_0x3f5d5a[_0x14b0('0x49')]},'raw':!![]})[_0x14b0('0x23')](function(_0x34bfb4){if(_0x34bfb4&&_0x34bfb4[_0x14b0('0x4a')]===0x0){return db['UserProfileResource'][_0x14b0('0x45')]({'name':_0xcfe440[_0x14b0('0x28')],'resourceId':_0xcfe440['id'],'type':_0x34bfb4[_0x14b0('0x28')],'sectionId':_0x34bfb4['id']},{})[_0x14b0('0x23')](function(){return _0x263df4;});}else{return _0x263df4;}})[_0x14b0('0x41')](function(_0x555db1){logger[_0x14b0('0x26')](_0x14b0('0x4b'),_0x555db1);throw _0x555db1;});}return _0x263df4;})[_0x14b0('0x23')](respondWithResult(_0x4663a2,0xc9))['catch'](handleError(_0x4663a2,null));};exports['update']=function(_0x19b0e4,_0xed227e){if(_0x19b0e4[_0x14b0('0x4c')]['id']){delete _0x19b0e4[_0x14b0('0x4c')]['id'];}return db[_0x14b0('0x3e')][_0x14b0('0x44')]({'where':{'id':_0x19b0e4[_0x14b0('0x4d')]['id']}})[_0x14b0('0x23')](handleEntityNotFound(_0xed227e,null))['then'](saveUpdates(_0x19b0e4[_0x14b0('0x4c')],null))[_0x14b0('0x23')](respondWithResult(_0xed227e,null))[_0x14b0('0x41')](handleError(_0xed227e,null));};exports[_0x14b0('0x4e')]=function(_0x1604d7,_0xcf12b){return db[_0x14b0('0x3e')][_0x14b0('0x44')]({'where':{'id':_0x1604d7[_0x14b0('0x4d')]['id']}})[_0x14b0('0x23')](handleEntityNotFound(_0xcf12b,null))[_0x14b0('0x23')](removeEntity(_0xcf12b,null))['catch'](handleError(_0xcf12b,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index f7fb2be..da192c5 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 _0x6c6f=['request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','CmContactHasPhone','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x310a0b,_0x26a611){_0x310a0b=_0x310a0b-0x0;var _0x2b1e2f=_0x6c6f[_0x310a0b];return _0x2b1e2f;};'use strict';var _=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var logger=require(_0xf6c6('0x2'))(_0xf6c6('0x3'));var moment=require(_0xf6c6('0x4'));var BPromise=require(_0xf6c6('0x5'));var rp=require(_0xf6c6('0x6'));var fs=require('fs');var path=require(_0xf6c6('0x7'));var rimraf=require(_0xf6c6('0x8'));var config=require(_0xf6c6('0x9'));var attributes=require(_0xf6c6('0xa'));module['exports']=function(_0x3b4e7b,_0x4f8e34){return _0x3b4e7b['define'](_0xf6c6('0xb'),attributes,{'tableName':'cm_contact_has_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf986=['request-promise','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1f865a,_0xf1cdb6){var _0x42c455=function(_0x32f853){while(--_0x32f853){_0x1f865a['push'](_0x1f865a['shift']());}};_0x42c455(++_0xf1cdb6);}(_0xf986,0x163));var _0x6f98=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf986[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x6f98('0x0'));var util=require(_0x6f98('0x1'));var logger=require(_0x6f98('0x2'))('api');var moment=require(_0x6f98('0x3'));var BPromise=require(_0x6f98('0x4'));var rp=require(_0x6f98('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContactHasPhone.attributes');module['exports']=function(_0x256c18,_0x3a4934){return _0x256c18['define'](_0x6f98('0x6'),attributes,{'tableName':_0x6f98('0x7'),'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 d6a0b11..a6ee0a4 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 _0x1db2=['jayson/promise','client','http','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0x1db2,0x6b));var _0x21db=function(_0x703ac9,_0x422cea){_0x703ac9=_0x703ac9-0x0;var _0x3b2f9d=_0x1db2[_0x703ac9];return _0x3b2f9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x21db('0x0'));var rs=require(_0x21db('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21db('0x2'))['db'];var utils=require(_0x21db('0x3'));var logger=require(_0x21db('0x4'))(_0x21db('0x5'));var config=require(_0x21db('0x6'));var jayson=require(_0x21db('0x7'));var client=jayson[_0x21db('0x8')][_0x21db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4419f5,_0x181844,_0xb81d82){return new BPromise(function(_0x38a739,_0x1e0f9c){return client['request'](_0x4419f5,_0xb81d82)['then'](function(_0x4656b8){logger[_0x21db('0xa')](_0x21db('0xb'),_0x181844,_0x21db('0xc'));logger['debug']('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x181844,'request\x20sent',JSON[_0x21db('0xd')](_0x4656b8));if(_0x4656b8[_0x21db('0xe')]){if(_0x4656b8[_0x21db('0xe')][_0x21db('0xf')]===0x1f4){logger[_0x21db('0xe')](_0x21db('0xb'),_0x181844,_0x4656b8['error'][_0x21db('0x10')]);return _0x1e0f9c(_0x4656b8['error'][_0x21db('0x10')]);}logger[_0x21db('0xe')](_0x21db('0xb'),_0x181844,_0x4656b8[_0x21db('0xe')]['message']);return _0x38a739(_0x4656b8['error']['message']);}else{logger[_0x21db('0xa')](_0x21db('0xb'),_0x181844,_0x21db('0xc'));_0x38a739(_0x4656b8[_0x21db('0x11')][_0x21db('0x10')]);}})[_0x21db('0x12')](function(_0x39a692){logger['error'](_0x21db('0xb'),_0x181844,_0x39a692);_0x1e0f9c(_0x39a692);});});} \ No newline at end of file +var _0xbb65=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmContactHasPhone,\x20%s,\x20%s','debug','stringify','error','code','message','catch'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xbb65,0x118));var _0x5bb6=function(_0x1afd83,_0x284d4d){_0x1afd83=_0x1afd83-0x0;var _0x4a744f=_0xbb65[_0x1afd83];return _0x4a744f;};'use strict';var _=require(_0x5bb6('0x0'));var util=require('util');var moment=require(_0x5bb6('0x1'));var BPromise=require(_0x5bb6('0x2'));var rs=require(_0x5bb6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bb6('0x4'))['db'];var utils=require(_0x5bb6('0x5'));var logger=require(_0x5bb6('0x6'))(_0x5bb6('0x7'));var config=require(_0x5bb6('0x8'));var jayson=require(_0x5bb6('0x9'));var client=jayson[_0x5bb6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x352fdf,_0x184b12,_0xc83357){return new BPromise(function(_0x306fb1,_0x30a2e1){return client['request'](_0x352fdf,_0xc83357)[_0x5bb6('0xb')](function(_0x4f6dd6){logger[_0x5bb6('0xc')](_0x5bb6('0xd'),_0x184b12,'request\x20sent');logger[_0x5bb6('0xe')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x184b12,'request\x20sent',JSON[_0x5bb6('0xf')](_0x4f6dd6));if(_0x4f6dd6['error']){if(_0x4f6dd6[_0x5bb6('0x10')][_0x5bb6('0x11')]===0x1f4){logger[_0x5bb6('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x184b12,_0x4f6dd6['error']['message']);return _0x30a2e1(_0x4f6dd6['error']['message']);}logger[_0x5bb6('0x10')](_0x5bb6('0xd'),_0x184b12,_0x4f6dd6[_0x5bb6('0x10')][_0x5bb6('0x12')]);return _0x306fb1(_0x4f6dd6['error'][_0x5bb6('0x12')]);}else{logger['info'](_0x5bb6('0xd'),_0x184b12,'request\x20sent');_0x306fb1(_0x4f6dd6['result'][_0x5bb6('0x12')]);}})[_0x5bb6('0x13')](function(_0x309064){logger[_0x5bb6('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x184b12,_0x309064);_0x30a2e1(_0x309064);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 7d16750..1bee662 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 _0x3832=['delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','/:id','isAuthenticated','show','put'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3832,0x99));var _0x2383=function(_0x2f6d9b,_0x57b9fc){_0x2f6d9b=_0x2f6d9b-0x0;var _0x51c35d=_0x3832[_0x2f6d9b];return _0x51c35d;};'use strict';var multer=require('multer');var util=require(_0x2383('0x0'));var path=require('path');var timeout=require(_0x2383('0x1'));var express=require(_0x2383('0x2'));var router=express[_0x2383('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2383('0x4'));var config=require(_0x2383('0x5'));var controller=require(_0x2383('0x6'));router[_0x2383('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2383('0x8'),auth[_0x2383('0x9')](),controller[_0x2383('0xa')]);router['post']('/',auth[_0x2383('0x9')](),controller['create']);router[_0x2383('0xb')]('/:id',auth[_0x2383('0x9')](),controller['update']);router[_0x2383('0xc')](_0x2383('0x8'),auth[_0x2383('0x9')](),controller[_0x2383('0xd')]);module[_0x2383('0xe')]=router; \ No newline at end of file +var _0x19ac=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id','create','delete','exports','multer','util','path'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x19ac,0x96));var _0xc19a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x19ac[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0xc19a('0x0'));var util=require(_0xc19a('0x1'));var path=require(_0xc19a('0x2'));var timeout=require(_0xc19a('0x3'));var express=require(_0xc19a('0x4'));var router=express[_0xc19a('0x5')]();var auth=require(_0xc19a('0x6'));var interaction=require(_0xc19a('0x7'));var config=require(_0xc19a('0x8'));var controller=require(_0xc19a('0x9'));router[_0xc19a('0xa')]('/',auth[_0xc19a('0xb')](),controller[_0xc19a('0xc')]);router[_0xc19a('0xa')](_0xc19a('0xd'),auth[_0xc19a('0xb')](),controller['show']);router['post']('/',auth[_0xc19a('0xb')](),controller[_0xc19a('0xe')]);router['put'](_0xc19a('0xd'),auth[_0xc19a('0xb')](),controller['update']);router[_0xc19a('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc19a('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a4a6b70..b3ca4f8 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 _0x749c=['type','select','parse','values','isArray','BOOLEAN','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0x749c,0x116));var _0xc749=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x749c[_0x9307ea];return _0x295554;};'use strict';var Sequelize=require(_0xc749('0x0'));var _=require(_0xc749('0x1'));module['exports']={'name':{'type':Sequelize[_0xc749('0x2')],'get':function(_0x4a6675){return this[_0xc749('0x3')](_0xc749('0x4'));}},'alias':{'type':Sequelize[_0xc749('0x5')],'allowNull':![],'set':function(_0x509542){this[_0xc749('0x6')]('alias',_0x509542?_0x509542:this[_0xc749('0x3')](_0xc749('0x7')));}},'type':{'type':Sequelize[_0xc749('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xc749('0x8')](_0xc749('0x9')),'get':function(){if(this[_0xc749('0x3')](_0xc749('0xa'))===_0xc749('0xb')){return JSON[_0xc749('0xc')](this[_0xc749('0x3')](_0xc749('0xd')));}else{return this['getDataValue'](_0xc749('0xd'));}},'set':function(_0x2c02f8){if(Array[_0xc749('0xe')](_0x2c02f8)){this['setDataValue'](_0xc749('0xd'),JSON['stringify'](_0x2c02f8));}else{this[_0xc749('0x6')]('values',_0x2c02f8);}}},'required':{'type':Sequelize[_0xc749('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x4aa4=['select','parse','values','isArray','stringify','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long','type'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x4aa4,0x106));var _0x44aa=function(_0x4b03ba,_0xdcfd8a){_0x4b03ba=_0x4b03ba-0x0;var _0x431c6b=_0x4aa4[_0x4b03ba];return _0x431c6b;};'use strict';var Sequelize=require(_0x44aa('0x0'));var _=require('lodash');module[_0x44aa('0x1')]={'name':{'type':Sequelize[_0x44aa('0x2')],'get':function(_0x7c49d1){return this[_0x44aa('0x3')](_0x44aa('0x4'));}},'alias':{'type':Sequelize[_0x44aa('0x5')],'allowNull':![],'set':function(_0x391b40){this[_0x44aa('0x6')](_0x44aa('0x4'),_0x391b40?_0x391b40:this[_0x44aa('0x3')](_0x44aa('0x7')));}},'type':{'type':Sequelize[_0x44aa('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x44aa('0x8')),'get':function(){if(this[_0x44aa('0x3')](_0x44aa('0x9'))===_0x44aa('0xa')){return JSON[_0x44aa('0xb')](this[_0x44aa('0x3')](_0x44aa('0xc')));}else{return this['getDataValue']('values');}},'set':function(_0xcec5bb){if(Array[_0x44aa('0xd')](_0xcec5bb)){this[_0x44aa('0x6')](_0x44aa('0xc'),JSON[_0x44aa('0xe')](_0xcec5bb));}else{this['setDataValue'](_0x44aa('0xc'),_0xcec5bb);}}},'required':{'type':Sequelize[_0x44aa('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index b8b59a2..c6188db 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 _0x4ab2=['keys','filters','model','attributes','intersection','query','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','include','findAll','rows','catch','show','params','includeAll','body','find','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','update','then','end','error','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','map'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x4ab2,0xde));var _0x24ab=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x4ab2[_0x2c7618];return _0x5ce3f0;};'use strict';var pdf=require(_0x24ab('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x24ab('0x1'));var jsonpatch=require(_0x24ab('0x2'));var rp=require(_0x24ab('0x3'));var moment=require(_0x24ab('0x4'));var BPromise=require(_0x24ab('0x5'));var Mustache=require(_0x24ab('0x6'));var util=require(_0x24ab('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x24ab('0x8'));var ejs=require(_0x24ab('0x9'));var fs=require('fs');var _=require(_0x24ab('0xa'));var squel=require('squel');var crypto=require(_0x24ab('0xb'));var jsforce=require(_0x24ab('0xc'));var deskjs=require(_0x24ab('0xd'));var toCsv=require(_0x24ab('0x8'));var querystring=require(_0x24ab('0xe'));var Papa=require(_0x24ab('0xf'));var Redis=require(_0x24ab('0x10'));var authService=require(_0x24ab('0x11'));var qs=require(_0x24ab('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24ab('0x13'));var logger=require(_0x24ab('0x14'))('api');var utils=require(_0x24ab('0x15'));var config=require(_0x24ab('0x16'));var db=require(_0x24ab('0x17'))['db'];function respondWithStatusCode(_0xb64f05,_0x30af2f){_0x30af2f=_0x30af2f||0xcc;return function(_0x2f9a07){if(_0x2f9a07){return _0xb64f05[_0x24ab('0x18')](_0x30af2f);}return _0xb64f05[_0x24ab('0x19')](_0x30af2f)['end']();};}function respondWithResult(_0x2b0572,_0x130af0){_0x130af0=_0x130af0||0xc8;return function(_0x211b54){if(_0x211b54){return _0x2b0572[_0x24ab('0x19')](_0x130af0)['json'](_0x211b54);}};}function respondWithFilteredResult(_0x59ff81,_0x4bd5a6){return function(_0x4d36dd){if(_0x4d36dd){var _0x4ab7d9=_0x4d36dd['count'],_0x220a74=_0x4bd5a6[_0x24ab('0x1a')],_0x49c6de=_0x4bd5a6[_0x24ab('0x1a')]+_0x4bd5a6[_0x24ab('0x1b')],_0x4d3741;if(_0x49c6de>=_0x4ab7d9){_0x49c6de=_0x4ab7d9;_0x4d3741=0xc8;}else{_0x4d3741=0xce;}_0x59ff81[_0x24ab('0x19')](_0x4d3741);return _0x59ff81[_0x24ab('0x1c')](_0x24ab('0x1d'),_0x220a74+'-'+_0x49c6de+'/'+_0x4ab7d9)[_0x24ab('0x1e')](_0x4d36dd);}return null;};}function patchUpdates(_0x4d8664){return function(_0x30d49c){try{jsonpatch[_0x24ab('0x1f')](_0x30d49c,_0x4d8664,!![]);}catch(_0x28db53){return BPromise[_0x24ab('0x20')](_0x28db53);}return _0x30d49c['save']();};}function saveUpdates(_0x1dcb41,_0x3749f4){return function(_0xacdaa4){if(_0xacdaa4){return _0xacdaa4[_0x24ab('0x21')](_0x1dcb41)[_0x24ab('0x22')](function(_0x29ef7e){return _0x29ef7e;});}return null;};}function removeEntity(_0x271983,_0x118781){return function(_0x38b763){if(_0x38b763){return _0x38b763['destroy']()[_0x24ab('0x22')](function(){_0x271983[_0x24ab('0x19')](0xcc)[_0x24ab('0x23')]();});}};}function handleEntityNotFound(_0x5ab70c,_0x432807){return function(_0x598be0){if(!_0x598be0){_0x5ab70c[_0x24ab('0x18')](0x194);}return _0x598be0;};}function handleError(_0x520f9f,_0x271db5){_0x271db5=_0x271db5||0x1f4;return function(_0x515421){logger[_0x24ab('0x24')](_0x515421[_0x24ab('0x25')]);if(_0x515421['name']){delete _0x515421[_0x24ab('0x26')];}_0x520f9f[_0x24ab('0x19')](_0x271db5)[_0x24ab('0x27')](_0x515421);};}exports[_0x24ab('0x28')]=function(_0x168855,_0x22a21d){var _0x364926={},_0x284cc6={},_0x4e5804={'count':0x0,'rows':[]};var _0xbfa6a0=_['map'](db[_0x24ab('0x29')][_0x24ab('0x2a')],function(_0x1ffbb1){return{'name':_0x1ffbb1[_0x24ab('0x2b')],'type':_0x1ffbb1[_0x24ab('0x2c')][_0x24ab('0x2d')]};});_0x284cc6['model']=_[_0x24ab('0x2e')](_[_0x24ab('0x2f')](_0xbfa6a0,_0x24ab('0x26')),[_0x24ab('0x26')]);_0x284cc6['query']=_[_0x24ab('0x30')](_0x168855['query']);_0x284cc6[_0x24ab('0x31')]=_['intersection'](_0x284cc6[_0x24ab('0x32')],_0x284cc6['query']);_0x364926[_0x24ab('0x33')]=_[_0x24ab('0x34')](_0x284cc6[_0x24ab('0x32')],qs['fields'](_0x168855[_0x24ab('0x35')][_0x24ab('0x36')]));_0x364926[_0x24ab('0x33')]=_0x364926['attributes'][_0x24ab('0x37')]?_0x364926[_0x24ab('0x33')]:_0x284cc6[_0x24ab('0x32')];if(!_0x168855[_0x24ab('0x35')][_0x24ab('0x38')](_0x24ab('0x39'))){_0x364926[_0x24ab('0x1b')]=qs[_0x24ab('0x1b')](_0x168855['query'][_0x24ab('0x1b')]);_0x364926[_0x24ab('0x1a')]=qs[_0x24ab('0x1a')](_0x168855['query'][_0x24ab('0x1a')]);}_0x364926[_0x24ab('0x3a')]=qs[_0x24ab('0x3b')](_0x168855[_0x24ab('0x35')][_0x24ab('0x3b')]);_0x364926[_0x24ab('0x3c')]=qs[_0x24ab('0x31')](_['pick'](_0x168855['query'],_0x284cc6[_0x24ab('0x31')]),_0xbfa6a0);if(_0x168855[_0x24ab('0x35')][_0x24ab('0x3d')]){_0x364926[_0x24ab('0x3c')]=_[_0x24ab('0x3e')](_0x364926[_0x24ab('0x3c')],{'$or':_[_0x24ab('0x2f')](_0xbfa6a0,function(_0xfe8b26){if(_0xfe8b26[_0x24ab('0x2c')]!=='VIRTUAL'){var _0x32721e={};_0x32721e[_0xfe8b26[_0x24ab('0x26')]]={'$like':'%'+_0x168855['query'][_0x24ab('0x3d')]+'%'};return _0x32721e;}})});}_0x364926=_[_0x24ab('0x3e')]({},_0x364926,_0x168855[_0x24ab('0x3f')]);var _0x1693a9={'where':_0x364926['where']};return db[_0x24ab('0x29')][_0x24ab('0x40')](_0x1693a9)[_0x24ab('0x22')](function(_0x3f37ca){_0x4e5804[_0x24ab('0x40')]=_0x3f37ca;if(_0x168855['query']['includeAll']){_0x364926[_0x24ab('0x41')]=[{'all':!![]}];}return db[_0x24ab('0x29')][_0x24ab('0x42')](_0x364926);})['then'](function(_0x1fadf7){_0x4e5804[_0x24ab('0x43')]=_0x1fadf7;return _0x4e5804;})[_0x24ab('0x22')](respondWithFilteredResult(_0x22a21d,_0x364926))[_0x24ab('0x44')](handleError(_0x22a21d,null));};exports[_0x24ab('0x45')]=function(_0x3d169f,_0x3b7c86){var _0x4c8e42={'raw':!![],'where':{'id':_0x3d169f[_0x24ab('0x46')]['id']}},_0x335d1e={};_0x335d1e[_0x24ab('0x32')]=_[_0x24ab('0x30')](db[_0x24ab('0x29')][_0x24ab('0x2a')]);_0x335d1e[_0x24ab('0x35')]=_[_0x24ab('0x30')](_0x3d169f['query']);_0x335d1e[_0x24ab('0x31')]=_[_0x24ab('0x34')](_0x335d1e[_0x24ab('0x32')],_0x335d1e[_0x24ab('0x35')]);_0x4c8e42['attributes']=_['intersection'](_0x335d1e[_0x24ab('0x32')],qs[_0x24ab('0x36')](_0x3d169f['query'][_0x24ab('0x36')]));_0x4c8e42[_0x24ab('0x33')]=_0x4c8e42[_0x24ab('0x33')]['length']?_0x4c8e42['attributes']:_0x335d1e['model'];if(_0x3d169f['query'][_0x24ab('0x47')]){_0x4c8e42['include']=[{'all':!![]}];}_0x4c8e42=_[_0x24ab('0x3e')]({},_0x4c8e42,_0x3d169f[_0x24ab('0x3f')]);return db[_0x24ab('0x29')]['find'](_0x4c8e42)[_0x24ab('0x22')](handleEntityNotFound(_0x3b7c86,null))[_0x24ab('0x22')](respondWithResult(_0x3b7c86,null))[_0x24ab('0x44')](handleError(_0x3b7c86,null));};exports[_0x24ab('0x21')]=function(_0x354eab,_0x3bf44e){if(_0x354eab[_0x24ab('0x48')]['id']){delete _0x354eab[_0x24ab('0x48')]['id'];}return db['CmCustomField'][_0x24ab('0x49')]({'where':{'id':_0x354eab[_0x24ab('0x46')]['id']}})[_0x24ab('0x22')](handleEntityNotFound(_0x3bf44e,null))[_0x24ab('0x22')](saveUpdates(_0x354eab['body'],null))[_0x24ab('0x22')](respondWithResult(_0x3bf44e,null))[_0x24ab('0x44')](handleError(_0x3bf44e,null));};exports['destroy']=function(_0x24797c,_0xb9ad82){return db[_0x24ab('0x29')][_0x24ab('0x49')]({'where':{'id':_0x24797c[_0x24ab('0x46')]['id']}})[_0x24ab('0x22')](handleEntityNotFound(_0xb9ad82,null))[_0x24ab('0x22')](removeEntity(_0xb9ad82,null))[_0x24ab('0x44')](handleError(_0xb9ad82,null));};exports[_0x24ab('0x4a')]=function(_0x571006,_0x8992c6){var _0x3b1a8d;return db['sequelize'][_0x24ab('0x4b')](function(_0x4426ac){return db[_0x24ab('0x29')][_0x24ab('0x4a')](_0x571006['body'],{'transaction':_0x4426ac})[_0x24ab('0x22')](function(_0x137d3b){_0x3b1a8d=_0x137d3b;var _0x461b05={'type':db[_0x24ab('0x4c')][_0x24ab('0x4d')],'transaction':_0x4426ac};switch(_0x571006[_0x24ab('0x48')]['type']){case _0x24ab('0x4e'):_0x461b05[_0x24ab('0x2c')]=db['Sequelize']['TEXT'];break;case _0x24ab('0x4f'):_0x461b05['type']=db[_0x24ab('0x4c')][_0x24ab('0x50')];break;case _0x24ab('0x51'):_0x461b05['type']=db['Sequelize'][_0x24ab('0x52')];_0x461b05[_0x24ab('0x53')]=![];break;default:}return db[_0x24ab('0x54')][_0x24ab('0x55')][_0x24ab('0x56')](_0x24ab('0x57'),util[_0x24ab('0x58')](_0x24ab('0x59'),_0x3b1a8d['id']),_0x461b05);})[_0x24ab('0x22')](function(){return _0x3b1a8d;});})[_0x24ab('0x22')](respondWithResult(_0x8992c6,0xc9))[_0x24ab('0x44')](handleError(_0x8992c6,null));}; \ No newline at end of file +var _0x56f1=['send','index','map','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','CmCustomField','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','text','Sequelize','TEXT','number','INTEGER','switch','defaultValue','addColumn','cm_contacts','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','destroy','stack','name'];(function(_0x5252b8,_0x56e845){var _0x14bb8e=function(_0x33eaa1){while(--_0x33eaa1){_0x5252b8['push'](_0x5252b8['shift']());}};_0x14bb8e(++_0x56e845);}(_0x56f1,0x1bb));var _0x156f=function(_0x4b2cb5,_0x4c07aa){_0x4b2cb5=_0x4b2cb5-0x0;var _0x4a8c62=_0x56f1[_0x4b2cb5];return _0x4a8c62;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x156f('0x0'));var zipdir=require(_0x156f('0x1'));var jsonpatch=require(_0x156f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x156f('0x3'));var Mustache=require(_0x156f('0x4'));var util=require(_0x156f('0x5'));var path=require('path');var sox=require(_0x156f('0x6'));var csv=require('to-csv');var ejs=require(_0x156f('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x156f('0x8'));var crypto=require('crypto');var jsforce=require(_0x156f('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x156f('0xa'));var querystring=require('querystring');var Papa=require(_0x156f('0xb'));var Redis=require('ioredis');var authService=require(_0x156f('0xc'));var qs=require(_0x156f('0xd'));var as=require(_0x156f('0xe'));var hardwareService=require(_0x156f('0xf'));var logger=require(_0x156f('0x10'))(_0x156f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d250d,_0x48b1d6){_0x48b1d6=_0x48b1d6||0xcc;return function(_0x302044){if(_0x302044){return _0x3d250d[_0x156f('0x12')](_0x48b1d6);}return _0x3d250d[_0x156f('0x13')](_0x48b1d6)[_0x156f('0x14')]();};}function respondWithResult(_0x525267,_0x1d3b47){_0x1d3b47=_0x1d3b47||0xc8;return function(_0x4faa13){if(_0x4faa13){return _0x525267[_0x156f('0x13')](_0x1d3b47)[_0x156f('0x15')](_0x4faa13);}};}function respondWithFilteredResult(_0x4cc406,_0xfe34f6){return function(_0x1a3ab8){if(_0x1a3ab8){var _0x4649a2=_0x1a3ab8['count'],_0x2c6047=_0xfe34f6[_0x156f('0x16')],_0x1c4d5a=_0xfe34f6[_0x156f('0x16')]+_0xfe34f6[_0x156f('0x17')],_0x4dec76;if(_0x1c4d5a>=_0x4649a2){_0x1c4d5a=_0x4649a2;_0x4dec76=0xc8;}else{_0x4dec76=0xce;}_0x4cc406[_0x156f('0x13')](_0x4dec76);return _0x4cc406[_0x156f('0x18')](_0x156f('0x19'),_0x2c6047+'-'+_0x1c4d5a+'/'+_0x4649a2)[_0x156f('0x15')](_0x1a3ab8);}return null;};}function patchUpdates(_0x372433){return function(_0x7299bd){try{jsonpatch[_0x156f('0x1a')](_0x7299bd,_0x372433,!![]);}catch(_0x3fea07){return BPromise['reject'](_0x3fea07);}return _0x7299bd['save']();};}function saveUpdates(_0x58684f,_0x232703){return function(_0x189f27){if(_0x189f27){return _0x189f27['update'](_0x58684f)[_0x156f('0x1b')](function(_0x5b073e){return _0x5b073e;});}return null;};}function removeEntity(_0x1db46e,_0x3108b2){return function(_0xc17b55){if(_0xc17b55){return _0xc17b55[_0x156f('0x1c')]()[_0x156f('0x1b')](function(){_0x1db46e[_0x156f('0x13')](0xcc)[_0x156f('0x14')]();});}};}function handleEntityNotFound(_0x103270,_0x5127bb){return function(_0x29a1c9){if(!_0x29a1c9){_0x103270[_0x156f('0x12')](0x194);}return _0x29a1c9;};}function handleError(_0x334769,_0x13a260){_0x13a260=_0x13a260||0x1f4;return function(_0x35c86d){logger['error'](_0x35c86d[_0x156f('0x1d')]);if(_0x35c86d[_0x156f('0x1e')]){delete _0x35c86d['name'];}_0x334769[_0x156f('0x13')](_0x13a260)[_0x156f('0x1f')](_0x35c86d);};}exports[_0x156f('0x20')]=function(_0x3d6752,_0x3ca1a6){var _0x108365={},_0x5e6fed={},_0x2516f4={'count':0x0,'rows':[]};var _0x5c5100=_[_0x156f('0x21')](db['CmCustomField']['rawAttributes'],function(_0x115361){return{'name':_0x115361['fieldName'],'type':_0x115361[_0x156f('0x22')][_0x156f('0x23')]};});_0x5e6fed[_0x156f('0x24')]=_[_0x156f('0x25')](_['map'](_0x5c5100,_0x156f('0x1e')),[_0x156f('0x1e')]);_0x5e6fed[_0x156f('0x26')]=_[_0x156f('0x27')](_0x3d6752[_0x156f('0x26')]);_0x5e6fed[_0x156f('0x28')]=_[_0x156f('0x29')](_0x5e6fed[_0x156f('0x24')],_0x5e6fed[_0x156f('0x26')]);_0x108365['attributes']=_[_0x156f('0x29')](_0x5e6fed[_0x156f('0x24')],qs[_0x156f('0x2a')](_0x3d6752['query'][_0x156f('0x2a')]));_0x108365[_0x156f('0x2b')]=_0x108365[_0x156f('0x2b')][_0x156f('0x2c')]?_0x108365[_0x156f('0x2b')]:_0x5e6fed[_0x156f('0x24')];if(!_0x3d6752['query'][_0x156f('0x2d')](_0x156f('0x2e'))){_0x108365[_0x156f('0x17')]=qs[_0x156f('0x17')](_0x3d6752[_0x156f('0x26')][_0x156f('0x17')]);_0x108365['offset']=qs[_0x156f('0x16')](_0x3d6752[_0x156f('0x26')][_0x156f('0x16')]);}_0x108365[_0x156f('0x2f')]=qs[_0x156f('0x30')](_0x3d6752[_0x156f('0x26')]['sort']);_0x108365[_0x156f('0x31')]=qs[_0x156f('0x28')](_[_0x156f('0x32')](_0x3d6752[_0x156f('0x26')],_0x5e6fed['filters']),_0x5c5100);if(_0x3d6752[_0x156f('0x26')][_0x156f('0x33')]){_0x108365[_0x156f('0x31')]=_[_0x156f('0x34')](_0x108365['where'],{'$or':_['map'](_0x5c5100,function(_0x17beb0){if(_0x17beb0[_0x156f('0x22')]!==_0x156f('0x35')){var _0x5d414e={};_0x5d414e[_0x17beb0[_0x156f('0x1e')]]={'$like':'%'+_0x3d6752[_0x156f('0x26')]['filter']+'%'};return _0x5d414e;}})});}_0x108365=_[_0x156f('0x34')]({},_0x108365,_0x3d6752[_0x156f('0x36')]);var _0x3e665f={'where':_0x108365[_0x156f('0x31')]};return db['CmCustomField'][_0x156f('0x37')](_0x3e665f)['then'](function(_0x45aa30){_0x2516f4[_0x156f('0x37')]=_0x45aa30;if(_0x3d6752[_0x156f('0x26')][_0x156f('0x38')]){_0x108365[_0x156f('0x39')]=[{'all':!![]}];}return db[_0x156f('0x3a')][_0x156f('0x3b')](_0x108365);})['then'](function(_0x3fde77){_0x2516f4[_0x156f('0x3c')]=_0x3fde77;return _0x2516f4;})[_0x156f('0x1b')](respondWithFilteredResult(_0x3ca1a6,_0x108365))[_0x156f('0x3d')](handleError(_0x3ca1a6,null));};exports[_0x156f('0x3e')]=function(_0x43a989,_0x1e0b5b){var _0x40ec69={'raw':!![],'where':{'id':_0x43a989[_0x156f('0x3f')]['id']}},_0x193437={};_0x193437[_0x156f('0x24')]=_[_0x156f('0x27')](db[_0x156f('0x3a')]['rawAttributes']);_0x193437[_0x156f('0x26')]=_['keys'](_0x43a989['query']);_0x193437[_0x156f('0x28')]=_[_0x156f('0x29')](_0x193437['model'],_0x193437['query']);_0x40ec69[_0x156f('0x2b')]=_['intersection'](_0x193437[_0x156f('0x24')],qs[_0x156f('0x2a')](_0x43a989[_0x156f('0x26')][_0x156f('0x2a')]));_0x40ec69['attributes']=_0x40ec69[_0x156f('0x2b')][_0x156f('0x2c')]?_0x40ec69[_0x156f('0x2b')]:_0x193437[_0x156f('0x24')];if(_0x43a989['query']['includeAll']){_0x40ec69[_0x156f('0x39')]=[{'all':!![]}];}_0x40ec69=_[_0x156f('0x34')]({},_0x40ec69,_0x43a989['options']);return db[_0x156f('0x3a')][_0x156f('0x40')](_0x40ec69)['then'](handleEntityNotFound(_0x1e0b5b,null))[_0x156f('0x1b')](respondWithResult(_0x1e0b5b,null))[_0x156f('0x3d')](handleError(_0x1e0b5b,null));};exports[_0x156f('0x41')]=function(_0x3b8f9d,_0x24595e){if(_0x3b8f9d[_0x156f('0x42')]['id']){delete _0x3b8f9d[_0x156f('0x42')]['id'];}return db[_0x156f('0x3a')][_0x156f('0x40')]({'where':{'id':_0x3b8f9d['params']['id']}})[_0x156f('0x1b')](handleEntityNotFound(_0x24595e,null))['then'](saveUpdates(_0x3b8f9d[_0x156f('0x42')],null))[_0x156f('0x1b')](respondWithResult(_0x24595e,null))[_0x156f('0x3d')](handleError(_0x24595e,null));};exports['destroy']=function(_0x157e18,_0x343e80){return db[_0x156f('0x3a')][_0x156f('0x40')]({'where':{'id':_0x157e18[_0x156f('0x3f')]['id']}})[_0x156f('0x1b')](handleEntityNotFound(_0x343e80,null))[_0x156f('0x1b')](removeEntity(_0x343e80,null))[_0x156f('0x3d')](handleError(_0x343e80,null));};exports[_0x156f('0x43')]=function(_0x903849,_0x5af292){var _0x58c3a0;return db[_0x156f('0x44')][_0x156f('0x45')](function(_0x1b4df2){return db[_0x156f('0x3a')][_0x156f('0x43')](_0x903849['body'],{'transaction':_0x1b4df2})[_0x156f('0x1b')](function(_0x2095ac){_0x58c3a0=_0x2095ac;var _0x276500={'type':db['Sequelize']['TEXT'],'transaction':_0x1b4df2};switch(_0x903849[_0x156f('0x42')]['type']){case _0x156f('0x46'):_0x276500['type']=db[_0x156f('0x47')][_0x156f('0x48')];break;case _0x156f('0x49'):_0x276500['type']=db[_0x156f('0x47')][_0x156f('0x4a')];break;case _0x156f('0x4b'):_0x276500['type']=db['Sequelize']['BOOLEAN'];_0x276500[_0x156f('0x4c')]=![];break;default:}return db[_0x156f('0x44')]['queryInterface'][_0x156f('0x4d')](_0x156f('0x4e'),util['format']('cf_%d',_0x58c3a0['id']),_0x276500);})[_0x156f('0x1b')](function(){return _0x58c3a0;});})[_0x156f('0x1b')](respondWithResult(_0x5af292,0xc9))[_0x156f('0x3d')](handleError(_0x5af292,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 0b4e460..12fa8ed 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 _0x0c71=['api','moment','bluebird','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','util'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x0c71,0xfb));var _0x10c7=function(_0x20bb1d,_0x4daeec){_0x20bb1d=_0x20bb1d-0x0;var _0x3a5523=_0x0c71[_0x20bb1d];return _0x3a5523;};'use strict';var _=require('lodash');var util=require(_0x10c7('0x0'));var logger=require('../../config/logger')(_0x10c7('0x1'));var moment=require(_0x10c7('0x2'));var BPromise=require(_0x10c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x10c7('0x4'));var config=require('../../config/environment');var attributes=require(_0x10c7('0x5'));module[_0x10c7('0x6')]=function(_0x21da60,_0x4480c2){return _0x21da60[_0x10c7('0x7')](_0x10c7('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96f9=['moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x96f9,0x64));var _0x996f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x96f9[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x996f('0x0'));var util=require(_0x996f('0x1'));var logger=require(_0x996f('0x2'))(_0x996f('0x3'));var moment=require(_0x996f('0x4'));var BPromise=require(_0x996f('0x5'));var rp=require(_0x996f('0x6'));var fs=require('fs');var path=require(_0x996f('0x7'));var rimraf=require(_0x996f('0x8'));var config=require('../../config/environment');var attributes=require(_0x996f('0x9'));module[_0x996f('0xa')]=function(_0x4846b8,_0x1e1b9d){return _0x4846b8[_0x996f('0xb')](_0x996f('0xc'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 9c71998..4456196 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 _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x30ca7e,_0x578e00){var _0x3fef3f=function(_0x1abbe2){while(--_0x1abbe2){_0x30ca7e['push'](_0x30ca7e['shift']());}};_0x3fef3f(++_0x578e00);}(_0x84ab,0x12f));var _0xb84a=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x84ab[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('CmCustomField,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file +var _0xb469=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1f1f9e,_0x1ef7fc){var _0x1e2a98=function(_0x31b0c6){while(--_0x31b0c6){_0x1f1f9e['push'](_0x1f1f9e['shift']());}};_0x1e2a98(++_0x1ef7fc);}(_0xb469,0x13b));var _0x9b46=function(_0x3f0cc8,_0xde10c0){_0x3f0cc8=_0x3f0cc8-0x0;var _0x4f7cf4=_0xb469[_0x3f0cc8];return _0x4f7cf4;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6c69813..6040e9a 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 _0x7367=['isAuthenticated','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7367,0x83));var _0x7736=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7367[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x7736('0x0'));var util=require(_0x7736('0x1'));var path=require(_0x7736('0x2'));var timeout=require(_0x7736('0x3'));var express=require(_0x7736('0x4'));var router=express[_0x7736('0x5')]();var auth=require(_0x7736('0x6'));var interaction=require(_0x7736('0x7'));var config=require(_0x7736('0x8'));var controller=require(_0x7736('0x9'));router[_0x7736('0xa')]('/',auth['isAuthenticated'](),controller[_0x7736('0xb')]);router[_0x7736('0xa')](_0x7736('0xc'),auth[_0x7736('0xd')](),controller['show']);router['post']('/',auth[_0x7736('0xd')](),controller[_0x7736('0xe')]);router[_0x7736('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7736('0x10')]);router['delete'](_0x7736('0xc'),auth[_0x7736('0xd')](),controller[_0x7736('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc35f=['show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id'];(function(_0x211311,_0x5e08e9){var _0x12d89b=function(_0x19390f){while(--_0x19390f){_0x211311['push'](_0x211311['shift']());}};_0x12d89b(++_0x5e08e9);}(_0xc35f,0x16f));var _0xfc35=function(_0xed45fc,_0x472179){_0xed45fc=_0xed45fc-0x0;var _0x30c449=_0xc35f[_0xed45fc];return _0x30c449;};'use strict';var multer=require(_0xfc35('0x0'));var util=require(_0xfc35('0x1'));var path=require(_0xfc35('0x2'));var timeout=require(_0xfc35('0x3'));var express=require(_0xfc35('0x4'));var router=express[_0xfc35('0x5')]();var auth=require(_0xfc35('0x6'));var interaction=require(_0xfc35('0x7'));var config=require(_0xfc35('0x8'));var controller=require(_0xfc35('0x9'));router[_0xfc35('0xa')]('/',auth[_0xfc35('0xb')](),controller['index']);router[_0xfc35('0xa')](_0xfc35('0xc'),auth[_0xfc35('0xb')](),controller[_0xfc35('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfc35('0xe')]);router['put'](_0xfc35('0xc'),auth[_0xfc35('0xb')](),controller[_0xfc35('0xf')]);router[_0xfc35('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfc35('0x11')]);module[_0xfc35('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5a0c969..3f934c2 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 _0x6d38=['exports','STRING','format','INTEGER','DATE','UNSIGNED','contactListQueue','sequelize'];(function(_0x199e03,_0x5ce50a){var _0x5b42cf=function(_0xaaa499){while(--_0xaaa499){_0x199e03['push'](_0x199e03['shift']());}};_0x5b42cf(++_0x5ce50a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6d38[_0x4c12ec];return _0x3ae42c;};'use strict';var moment=require('moment');var Sequelize=require(_0x86d3('0x0'));module[_0x86d3('0x1')]={'phone':{'type':Sequelize[_0x86d3('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x86d3('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x86d3('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x86d3('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x86d3('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x86d3('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x86d3('0x5')]},'priority':{'type':Sequelize[_0x86d3('0x4')](0x2)[_0x86d3('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x86d3('0x7')},'ListId':{'type':Sequelize[_0x86d3('0x4')],'unique':_0x86d3('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x86d3('0x7')},'CampaignId':{'type':Sequelize[_0x86d3('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x86d3('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x86d3('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x86d3('0x2')]}}; \ No newline at end of file +var _0x3f8a=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x44d744,_0x46cc36){var _0x3365c6=function(_0x147be8){while(--_0x147be8){_0x44d744['push'](_0x44d744['shift']());}};_0x3365c6(++_0x46cc36);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1ca4fc,_0x292296){_0x1ca4fc=_0x1ca4fc-0x0;var _0x159709=_0x3f8a[_0x1ca4fc];return _0x159709;};'use strict';var moment=require(_0xa3f8('0x0'));var Sequelize=require(_0xa3f8('0x1'));module[_0xa3f8('0x2')]={'phone':{'type':Sequelize[_0xa3f8('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa3f8('0x4')],'defaultValue':moment()[_0xa3f8('0x5')](_0xa3f8('0x6'))},'countbusyretry':{'type':Sequelize[_0xa3f8('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa3f8('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa3f8('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa3f8('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa3f8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa3f8('0x4')]},'priority':{'type':Sequelize[_0xa3f8('0x7')](0x2)[_0xa3f8('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa3f8('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa3f8('0x7')],'unique':_0xa3f8('0xa')},'ListId':{'type':Sequelize[_0xa3f8('0x7')],'unique':_0xa3f8('0xa')},'UserId':{'type':Sequelize[_0xa3f8('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa3f8('0xa')},'CampaignId':{'type':Sequelize[_0xa3f8('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xa3f8('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa3f8('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa3f8('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa3f8('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index d16c1a9..4c525ea 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 _0xcf45=['phone','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','outbound','dialOrderByScheduledAt','sequelize','prev','isEmpty','priority','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','List','getOpenContacts','getVoiceQueues','preview','entity\x20not\x20found','getTimezones','push','utcOffset','timezones','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','map','fieldName','type','key','model','query','keys','filters','concat','$gt','$gte','$lt','$ne','$eq','$between','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$any','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','CmHopper','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','describe','find','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','UserId','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum'];(function(_0x3bd497,_0x37d7a8){var _0x32f967=function(_0x1b84ba){while(--_0x1b84ba){_0x3bd497['push'](_0x3bd497['shift']());}};_0x32f967(++_0x37d7a8);}(_0xcf45,0xbe));var _0x5cf4=function(_0x26ae9e,_0x38b4ee){_0x26ae9e=_0x26ae9e-0x0;var _0x20c5e7=_0xcf45[_0x26ae9e];return _0x20c5e7;};'use strict';var pdf=require(_0x5cf4('0x0'));var emlformat=require(_0x5cf4('0x1'));var rimraf=require(_0x5cf4('0x2'));var zipdir=require(_0x5cf4('0x3'));var jsonpatch=require(_0x5cf4('0x4'));var rp=require(_0x5cf4('0x5'));var moment=require(_0x5cf4('0x6'));var BPromise=require(_0x5cf4('0x7'));var Mustache=require(_0x5cf4('0x8'));var util=require(_0x5cf4('0x9'));var path=require(_0x5cf4('0xa'));var sox=require(_0x5cf4('0xb'));var csv=require(_0x5cf4('0xc'));var ejs=require(_0x5cf4('0xd'));var fs=require('fs');var _=require(_0x5cf4('0xe'));var squel=require('squel');var crypto=require(_0x5cf4('0xf'));var jsforce=require(_0x5cf4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5cf4('0xc'));var querystring=require(_0x5cf4('0x11'));var Papa=require('papaparse');var Redis=require(_0x5cf4('0x12'));var shared=require(_0x5cf4('0x13'));var authService=require(_0x5cf4('0x14'));var qs=require(_0x5cf4('0x15'));var as=require(_0x5cf4('0x16'));var hardwareService=require(_0x5cf4('0x17'));var logger=require(_0x5cf4('0x18'))(_0x5cf4('0x19'));var utils=require(_0x5cf4('0x1a'));var config=require(_0x5cf4('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54d248,_0x52e88f){_0x52e88f=_0x52e88f||0xcc;return function(_0x1ae029){if(_0x1ae029){return _0x54d248[_0x5cf4('0x1b')](_0x52e88f);}return _0x54d248[_0x5cf4('0x1c')](_0x52e88f)[_0x5cf4('0x1d')]();};}function respondWithResult(_0x1f87b0,_0x31aa26){_0x31aa26=_0x31aa26||0xc8;return function(_0x447f57){if(_0x447f57){return _0x1f87b0[_0x5cf4('0x1c')](_0x31aa26)['json'](_0x447f57);}};}function respondWithFilteredResult(_0x23aa5b,_0x55f8ff){return function(_0x38b43a){if(_0x38b43a){var _0x3f505f=_0x38b43a[_0x5cf4('0x1e')],_0x2597ad=_0x55f8ff[_0x5cf4('0x1f')],_0x1d161e=_0x55f8ff[_0x5cf4('0x1f')]+_0x55f8ff[_0x5cf4('0x20')],_0x3d3bff;if(_0x1d161e>=_0x3f505f){_0x1d161e=_0x3f505f;_0x3d3bff=0xc8;}else{_0x3d3bff=0xce;}_0x23aa5b[_0x5cf4('0x1c')](_0x3d3bff);return _0x23aa5b[_0x5cf4('0x21')](_0x5cf4('0x22'),_0x2597ad+'-'+_0x1d161e+'/'+_0x3f505f)[_0x5cf4('0x23')](_0x38b43a);}return null;};}function patchUpdates(_0x3f53f9){return function(_0x3f5afa){try{jsonpatch[_0x5cf4('0x24')](_0x3f5afa,_0x3f53f9,!![]);}catch(_0x2b60f8){return BPromise[_0x5cf4('0x25')](_0x2b60f8);}return _0x3f5afa['save']();};}function saveUpdates(_0x2f84a1,_0x30c954){return function(_0x5c924e){if(_0x5c924e){return _0x5c924e[_0x5cf4('0x26')](_0x2f84a1)[_0x5cf4('0x27')](function(_0x4a1ef3){return _0x4a1ef3;});}return null;};}function removeEntity(_0x137568,_0x303174){return function(_0x2c0549){if(_0x2c0549){return _0x2c0549[_0x5cf4('0x28')]()[_0x5cf4('0x27')](function(){_0x137568['status'](0xcc)[_0x5cf4('0x1d')]();});}};}function handleEntityNotFound(_0x54eedd,_0x5c43f5){return function(_0x3ec1a5){if(!_0x3ec1a5){_0x54eedd[_0x5cf4('0x1b')](0x194);}return _0x3ec1a5;};}function handleError(_0x27459e,_0x55d209){_0x55d209=_0x55d209||0x1f4;return function(_0x29176e){logger[_0x5cf4('0x29')](_0x29176e['stack']);if(_0x29176e['name']){delete _0x29176e[_0x5cf4('0x2a')];}_0x27459e[_0x5cf4('0x1c')](_0x55d209)[_0x5cf4('0x2b')](_0x29176e);};}exports['index']=function(_0x1372df,_0x2eb1e2){var _0x270ef8={},_0x564afb={},_0x55505a={'count':0x0,'rows':[]};var _0x36041e=_[_0x5cf4('0x2c')](db['CmHopper']['rawAttributes'],function(_0x26cc8d){return{'name':_0x26cc8d[_0x5cf4('0x2d')],'type':_0x26cc8d[_0x5cf4('0x2e')][_0x5cf4('0x2f')]};});_0x564afb[_0x5cf4('0x30')]=_[_0x5cf4('0x2c')](_0x36041e,_0x5cf4('0x2a'));_0x564afb[_0x5cf4('0x31')]=_[_0x5cf4('0x32')](_0x1372df[_0x5cf4('0x31')]);_0x564afb[_0x5cf4('0x33')]=_['intersection'](_0x564afb[_0x5cf4('0x30')],_0x564afb[_0x5cf4('0x31')]);_0x564afb[_0x5cf4('0x33')]=_[_0x5cf4('0x34')](_0x564afb[_0x5cf4('0x33')],['$and','$or',_0x5cf4('0x35'),_0x5cf4('0x36'),_0x5cf4('0x37'),'$lte',_0x5cf4('0x38'),_0x5cf4('0x39'),'$not',_0x5cf4('0x3a'),'$notBetween',_0x5cf4('0x3b'),_0x5cf4('0x3c'),_0x5cf4('0x3d'),_0x5cf4('0x3e'),'$iLike',_0x5cf4('0x3f'),_0x5cf4('0x3d'),_0x5cf4('0x40'),_0x5cf4('0x41'),'$contained',_0x5cf4('0x42')]);_0x270ef8['attributes']=_[_0x5cf4('0x43')](_0x564afb[_0x5cf4('0x30')],qs[_0x5cf4('0x44')](_0x1372df[_0x5cf4('0x31')]['fields']));_0x270ef8['attributes']=_0x270ef8[_0x5cf4('0x45')][_0x5cf4('0x46')]?_0x270ef8[_0x5cf4('0x45')]:_0x564afb[_0x5cf4('0x30')];if(!_0x1372df[_0x5cf4('0x31')][_0x5cf4('0x47')]('nolimit')){_0x270ef8[_0x5cf4('0x20')]=qs['limit'](_0x1372df[_0x5cf4('0x31')][_0x5cf4('0x20')]);_0x270ef8['offset']=qs[_0x5cf4('0x1f')](_0x1372df['query'][_0x5cf4('0x1f')]);}_0x270ef8[_0x5cf4('0x48')]=qs['sort'](_0x1372df[_0x5cf4('0x31')][_0x5cf4('0x49')]);_0x270ef8[_0x5cf4('0x4a')]=qs[_0x5cf4('0x33')](_['pick'](_0x1372df['query'],_0x564afb[_0x5cf4('0x33')]),_0x36041e);if(_0x1372df['query']['filter']){_0x270ef8[_0x5cf4('0x4a')]=_[_0x5cf4('0x4b')](_0x270ef8[_0x5cf4('0x4a')],{'$or':_[_0x5cf4('0x2c')](_0x36041e,function(_0xc60b09){if(_0xc60b09[_0x5cf4('0x2e')]!==_0x5cf4('0x4c')){var _0x22e691={};_0x22e691[_0xc60b09['name']]={'$like':'%'+_0x1372df['query']['filter']+'%'};return _0x22e691;}})});}_0x270ef8=_['merge']({},_0x270ef8,_0x1372df[_0x5cf4('0x4d')]);var _0x2b0d48={'where':_0x270ef8['where']};return db[_0x5cf4('0x4e')][_0x5cf4('0x1e')](_0x2b0d48)[_0x5cf4('0x27')](function(_0x1d3877){_0x55505a[_0x5cf4('0x1e')]=_0x1d3877;if(_0x1372df[_0x5cf4('0x31')]['includeAll']){_0x270ef8[_0x5cf4('0x4f')]=[{'all':!![]}];}return db['CmHopper'][_0x5cf4('0x50')](_0x270ef8);})[_0x5cf4('0x27')](function(_0x3f14e1){_0x55505a[_0x5cf4('0x51')]=_0x3f14e1;return _0x55505a;})[_0x5cf4('0x27')](respondWithFilteredResult(_0x2eb1e2,_0x270ef8))[_0x5cf4('0x52')](handleError(_0x2eb1e2,null));};exports[_0x5cf4('0x53')]=function(_0x4125e8,_0x2099a1){var _0x50be84={'raw':!![],'where':{'id':_0x4125e8[_0x5cf4('0x54')]['id']}},_0x21bb37={};_0x21bb37[_0x5cf4('0x30')]=_['keys'](db[_0x5cf4('0x4e')][_0x5cf4('0x55')]);_0x21bb37[_0x5cf4('0x31')]=_[_0x5cf4('0x32')](_0x4125e8[_0x5cf4('0x31')]);_0x21bb37[_0x5cf4('0x33')]=_[_0x5cf4('0x43')](_0x21bb37['model'],_0x21bb37[_0x5cf4('0x31')]);_0x50be84['attributes']=_[_0x5cf4('0x43')](_0x21bb37['model'],qs['fields'](_0x4125e8[_0x5cf4('0x31')][_0x5cf4('0x44')]));_0x50be84[_0x5cf4('0x45')]=_0x50be84[_0x5cf4('0x45')]['length']?_0x50be84[_0x5cf4('0x45')]:_0x21bb37[_0x5cf4('0x30')];if(_0x4125e8[_0x5cf4('0x31')][_0x5cf4('0x56')]){_0x50be84[_0x5cf4('0x4f')]=[{'all':!![]}];}_0x50be84=_[_0x5cf4('0x4b')]({},_0x50be84,_0x4125e8[_0x5cf4('0x4d')]);return db[_0x5cf4('0x4e')]['find'](_0x50be84)[_0x5cf4('0x27')](handleEntityNotFound(_0x2099a1,null))['then'](respondWithResult(_0x2099a1,null))[_0x5cf4('0x52')](handleError(_0x2099a1,null));};exports[_0x5cf4('0x57')]=function(_0x95c0d8,_0xd7bbb2){return db[_0x5cf4('0x4e')][_0x5cf4('0x57')](_0x95c0d8[_0x5cf4('0x58')],{})[_0x5cf4('0x27')](respondWithResult(_0xd7bbb2,0xc9))[_0x5cf4('0x52')](handleError(_0xd7bbb2,null));};exports['update']=function(_0x5c09af,_0x36f4f9){if(_0x5c09af[_0x5cf4('0x58')]['id']){delete _0x5c09af['body']['id'];}return db[_0x5cf4('0x4e')]['find']({'where':{'id':_0x5c09af[_0x5cf4('0x54')]['id']}})['then'](handleEntityNotFound(_0x36f4f9,null))[_0x5cf4('0x27')](saveUpdates(_0x5c09af[_0x5cf4('0x58')],null))[_0x5cf4('0x27')](respondWithResult(_0x36f4f9,null))['catch'](handleError(_0x36f4f9,null));};exports[_0x5cf4('0x59')]=function(_0x59e9b1,_0x46ef50){return db[_0x5cf4('0x4e')]['describe']()['then'](respondWithResult(_0x46ef50,null))[_0x5cf4('0x52')](handleError(_0x46ef50,null));};exports[_0x5cf4('0x28')]=function(_0x1fdad9,_0x98f5c6){var _0x3b3977;return db['CmHopper'][_0x5cf4('0x5a')]({'where':{'id':_0x1fdad9[_0x5cf4('0x54')]['id']}})[_0x5cf4('0x27')](handleEntityNotFound(_0x98f5c6,null))[_0x5cf4('0x27')](function(_0x8426ed){if(_0x8426ed){return _0x8426ed[_0x5cf4('0x28')]()[_0x5cf4('0x27')](function(_0x5cf15f){return _0x5cf15f;});}})['then'](function(_0x4a04fb){_0x3b3977=_0x4a04fb;if(_0x4a04fb){if(_0x4a04fb[_0x5cf4('0x5b')]||_0x4a04fb['CampaignId']){return db[_0x4a04fb['VoiceQueueId']?_0x5cf4('0x5c'):_0x5cf4('0x5d')][_0x5cf4('0x5a')]({'where':{'id':_0x4a04fb[_0x5cf4('0x5b')]?_0x4a04fb['VoiceQueueId']:_0x4a04fb[_0x5cf4('0x5e')]},'attributes':['id',_0x5cf4('0x2a')],'raw':!![]});}}})[_0x5cf4('0x27')](function(_0x375499){var _0x1af126={};if(_0x375499){_['merge'](_0x1af126,_[_0x5cf4('0x5f')](_0x3b3977[_0x5cf4('0x60')],[_0x5cf4('0x61'),_0x5cf4('0x62'),'id']));_0x1af126[_0x5cf4('0x63')]=0x15;_0x1af126[_0x5cf4('0x64')]='deleted';_0x1af126[_0x5cf4('0x65')]=_0x375499[_0x5cf4('0x2a')];_0x1af126[_0x5cf4('0x66')]=_0x1fdad9['user']['name'];_0x1af126[_0x5cf4('0x67')]=_0x1fdad9[_0x5cf4('0x68')]['id'];_0x1af126[_0x5cf4('0x69')]=!![];_0x1af126[_0x5cf4('0x6a')]=moment()[_0x5cf4('0x6b')](_0x5cf4('0x6c'));_0x1af126[_0x5cf4('0x6d')]=_0x3b3977[_0x5cf4('0x6e')];_0x1af126[_0x5cf4('0x6f')]=_0x3b3977['VoiceQueueId']?_0x5cf4('0x70'):_0x5cf4('0x71');return db['CmContact'][_0x5cf4('0x5a')]({'where':{'id':_0x1af126['ContactId']},'attributes':[_0x5cf4('0x72'),_0x5cf4('0x73')]})[_0x5cf4('0x27')](function(_0x3f2833){if(!_[_0x5cf4('0x74')](_0x98f5c6)&&!_[_0x5cf4('0x74')](_0x3f2833[_0x5cf4('0x72')])){_0x1af126[_0x5cf4('0x75')]=_0x3f2833['firstName'];if(!_[_0x5cf4('0x74')](_0x3f2833[_0x5cf4('0x73')])){_0x1af126[_0x5cf4('0x75')]+='\x20'+_0x3f2833[_0x5cf4('0x73')];}}})[_0x5cf4('0x76')](function(){return db[_0x5cf4('0x77')]['create'](_0x1af126);});}})['then'](function(){return _0x98f5c6[_0x5cf4('0x1c')](0xcc)[_0x5cf4('0x1d')]();})['catch'](handleError(_0x98f5c6,null));};exports[_0x5cf4('0x78')]=function(_0x1517f5,_0x419c6a,_0x45d3a2){var _0x5172c9=[];return db[_0x5cf4('0x79')][_0x5cf4('0x59')]()[_0x5cf4('0x27')](function(_0x38dc6f){_0x5172c9=_[_0x5cf4('0x32')](_0x38dc6f);return _0x1517f5['user']['getVoiceQueues']({'where':{'type':_0x5cf4('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x5cf4('0x7b')],'raw':!![]});})[_0x5cf4('0x27')](function(_0x30c23d){if(_0x30c23d&&_0x30c23d['length']){return db[_0x5cf4('0x7c')]['transaction'](function(_0x1e5ee1){var _0x4c1b94={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5cf4('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x5cf4('0x2c')](_0x30c23d,'id')},'$or':[{'UserId':null},{'UserId':_0x1517f5[_0x5cf4('0x68')]['id']}]};var _0x16abbe=[];if(_0x1517f5[_0x5cf4('0x58')]['direction']&&_0x1517f5[_0x5cf4('0x58')]['direction']===_0x5cf4('0x7d')){if(!_[_0x5cf4('0x7e')](_0x1517f5[_0x5cf4('0x58')]['hopperIds'])){_0x4c1b94['id']={'$in':_0x1517f5[_0x5cf4('0x58')]['hopperIds']};}_0x16abbe=[[_0x5cf4('0x7f'),_0x5cf4('0x80')],[_0x5cf4('0x81'),_0x30c23d[0x0][_0x5cf4('0x7b')]===_0x5cf4('0x80')?'DESC':'ASC'],db[_0x5cf4('0x7c')][_0x5cf4('0x82')](_0x5cf4('0x83')),['id',_0x5cf4('0x84')]];}else{if(!_['isEmpty'](_0x1517f5[_0x5cf4('0x58')]['hopperIds'])){_0x4c1b94['id']={'$notIn':_0x1517f5[_0x5cf4('0x58')][_0x5cf4('0x85')]};}_0x16abbe=[[_0x5cf4('0x7f'),_0x5cf4('0x84')],[_0x5cf4('0x81'),_0x30c23d[0x0][_0x5cf4('0x7b')]],db[_0x5cf4('0x7c')]['literal'](_0x5cf4('0x86')),['id',_0x5cf4('0x80')]];}return db[_0x5cf4('0x4e')][_0x5cf4('0x87')]({'attributes':['id',_0x5cf4('0x88')],'where':_0x4c1b94,'order':_0x16abbe,'transaction':_0x1e5ee1,'lock':_0x1e5ee1[_0x5cf4('0x89')][_0x5cf4('0x8a')],'include':[{'model':db['CmContact'],'as':_0x5cf4('0x8b'),'attributes':_0x5172c9,'include':[{'model':db[_0x5cf4('0x8c')],'as':'Company','attributes':['id',_0x5cf4('0x2a')]}]},{'model':db['CmList'],'as':_0x5cf4('0x8d'),'attributes':['id',_0x5cf4('0x2a')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x5cf4('0x2a'),'dialActive']}]})['then'](function(_0x51bb4f){if(_0x51bb4f){return _0x51bb4f[_0x5cf4('0x26')]({'UserId':_0x1517f5[_0x5cf4('0x68')]['id']},{'transaction':_0x1e5ee1});}});});}})[_0x5cf4('0x27')](handleEntityNotFound(_0x419c6a,null))[_0x5cf4('0x27')](respondWithResult(_0x419c6a,null))['catch'](handleError(_0x419c6a,null));};exports[_0x5cf4('0x8e')]=function(_0x449feb,_0x7da67c,_0x25bfde){return _0x449feb[_0x5cf4('0x68')][_0x5cf4('0x8f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5cf4('0x90')},'attributes':['id'],'raw':!![]})[_0x5cf4('0x27')](function(_0x97ff06){if(_0x97ff06&&_0x97ff06[_0x5cf4('0x46')]){return db[_0x5cf4('0x4e')][_0x5cf4('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x5cf4('0x6c'))},'VoiceQueueId':{'$in':_[_0x5cf4('0x2c')](_0x97ff06,'id')},'$or':[{'UserId':null},{'UserId':_0x449feb[_0x5cf4('0x68')]['id']}]}});}return 0x0;})['then'](function(_0x32a95c){if(!_['isNil'](_0x32a95c)&&_['isNumber'](_0x32a95c)){return _0x7da67c[_0x5cf4('0x1c')](0xc8)['json']({'contacts':_0x32a95c});}else{logger[_0x5cf4('0x29')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x5cf4('0x8e'),0x194,_0x5cf4('0x91'));_0x7da67c[_0x5cf4('0x1b')](0x194);}})[_0x5cf4('0x52')](handleError(_0x7da67c,null));};exports[_0x5cf4('0x92')]=function(_0x291538,_0x26e086,_0x10c36f){var _0x2b3e53=shared['timezones'];var _0x4a86e1=[];_[_0x5cf4('0x2c')](_0x2b3e53,function(_0x25b282){_0x4a86e1[_0x5cf4('0x93')]({'id':_0x25b282['name'],'name':_0x25b282['name'],'utcOffset':_0x25b282[_0x5cf4('0x94')]});});return _0x26e086[_0x5cf4('0x1c')](0xc8)[_0x5cf4('0x23')]({'tz':_0x4a86e1});};exports['getTimezone']=function(_0x55f47c,_0x35f950,_0x171ff6){var _0x48ffdc=shared[_0x5cf4('0x95')];var _0x4f7c4d={};if(!_[_0x5cf4('0x74')](_0x48ffdc[_0x55f47c['body']['id']]))_0x4f7c4d=_0x48ffdc[_0x55f47c[_0x5cf4('0x58')]['id']];return _0x35f950[_0x5cf4('0x1c')](0xc8)[_0x5cf4('0x23')](_0x4f7c4d);}; \ No newline at end of file +var _0x9c4a=['timezones','utcOffset','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','key','model','keys','query','filters','intersection','$and','$or','$gt','$gte','$lte','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','campaign','membername','user','UserId','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','getPreview','outbound','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','hopperIds','priority','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','UPDATE','Contact','CmCompany','Company','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones'];(function(_0x1fe6fb,_0x3991ec){var _0x4dbe77=function(_0x3b306a){while(--_0x3b306a){_0x1fe6fb['push'](_0x1fe6fb['shift']());}};_0x4dbe77(++_0x3991ec);}(_0x9c4a,0x120));var _0xa9c4=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x9c4a[_0x36c6eb];return _0x30675b;};'use strict';var pdf=require(_0xa9c4('0x0'));var emlformat=require(_0xa9c4('0x1'));var rimraf=require(_0xa9c4('0x2'));var zipdir=require(_0xa9c4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9c4('0x4'));var moment=require(_0xa9c4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa9c4('0x6'));var path=require(_0xa9c4('0x7'));var sox=require('sox');var csv=require(_0xa9c4('0x8'));var ejs=require(_0xa9c4('0x9'));var fs=require('fs');var _=require(_0xa9c4('0xa'));var squel=require(_0xa9c4('0xb'));var crypto=require(_0xa9c4('0xc'));var jsforce=require(_0xa9c4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa9c4('0x8'));var querystring=require(_0xa9c4('0xe'));var Papa=require(_0xa9c4('0xf'));var Redis=require(_0xa9c4('0x10'));var shared=require('../../config/environment');var authService=require(_0xa9c4('0x11'));var qs=require(_0xa9c4('0x12'));var as=require(_0xa9c4('0x13'));var hardwareService=require(_0xa9c4('0x14'));var logger=require('../../config/logger')(_0xa9c4('0x15'));var utils=require(_0xa9c4('0x16'));var config=require(_0xa9c4('0x17'));var db=require(_0xa9c4('0x18'))['db'];function respondWithStatusCode(_0x6f86c3,_0x5a5926){_0x5a5926=_0x5a5926||0xcc;return function(_0x93982a){if(_0x93982a){return _0x6f86c3['sendStatus'](_0x5a5926);}return _0x6f86c3['status'](_0x5a5926)[_0xa9c4('0x19')]();};}function respondWithResult(_0x42fdcc,_0x46d39c){_0x46d39c=_0x46d39c||0xc8;return function(_0x45ba29){if(_0x45ba29){return _0x42fdcc[_0xa9c4('0x1a')](_0x46d39c)[_0xa9c4('0x1b')](_0x45ba29);}};}function respondWithFilteredResult(_0x36659d,_0x363168){return function(_0x2cc61b){if(_0x2cc61b){var _0x4074e9=_0x2cc61b[_0xa9c4('0x1c')],_0x204da6=_0x363168['offset'],_0x349e71=_0x363168[_0xa9c4('0x1d')]+_0x363168[_0xa9c4('0x1e')],_0x215e80;if(_0x349e71>=_0x4074e9){_0x349e71=_0x4074e9;_0x215e80=0xc8;}else{_0x215e80=0xce;}_0x36659d[_0xa9c4('0x1a')](_0x215e80);return _0x36659d[_0xa9c4('0x1f')](_0xa9c4('0x20'),_0x204da6+'-'+_0x349e71+'/'+_0x4074e9)[_0xa9c4('0x1b')](_0x2cc61b);}return null;};}function patchUpdates(_0x2306b8){return function(_0x3610a1){try{jsonpatch[_0xa9c4('0x21')](_0x3610a1,_0x2306b8,!![]);}catch(_0x2c6390){return BPromise['reject'](_0x2c6390);}return _0x3610a1[_0xa9c4('0x22')]();};}function saveUpdates(_0x184615,_0x19f2d0){return function(_0x290972){if(_0x290972){return _0x290972[_0xa9c4('0x23')](_0x184615)['then'](function(_0x3dfb89){return _0x3dfb89;});}return null;};}function removeEntity(_0x48ff87,_0x19006d){return function(_0x328b2d){if(_0x328b2d){return _0x328b2d[_0xa9c4('0x24')]()[_0xa9c4('0x25')](function(){_0x48ff87['status'](0xcc)[_0xa9c4('0x19')]();});}};}function handleEntityNotFound(_0x579c26,_0x1b6546){return function(_0x27d785){if(!_0x27d785){_0x579c26[_0xa9c4('0x26')](0x194);}return _0x27d785;};}function handleError(_0xab098f,_0x5eee99){_0x5eee99=_0x5eee99||0x1f4;return function(_0x28b95f){logger[_0xa9c4('0x27')](_0x28b95f[_0xa9c4('0x28')]);if(_0x28b95f[_0xa9c4('0x29')]){delete _0x28b95f['name'];}_0xab098f[_0xa9c4('0x1a')](_0x5eee99)['send'](_0x28b95f);};}exports['index']=function(_0x505298,_0x3e01a4){var _0x315aed={},_0x81b4cd={},_0x46f4e5={'count':0x0,'rows':[]};var _0x2d9fa7=_[_0xa9c4('0x2a')](db[_0xa9c4('0x2b')][_0xa9c4('0x2c')],function(_0x49e708){return{'name':_0x49e708[_0xa9c4('0x2d')],'type':_0x49e708['type'][_0xa9c4('0x2e')]};});_0x81b4cd[_0xa9c4('0x2f')]=_['map'](_0x2d9fa7,_0xa9c4('0x29'));_0x81b4cd['query']=_[_0xa9c4('0x30')](_0x505298[_0xa9c4('0x31')]);_0x81b4cd[_0xa9c4('0x32')]=_[_0xa9c4('0x33')](_0x81b4cd[_0xa9c4('0x2f')],_0x81b4cd[_0xa9c4('0x31')]);_0x81b4cd['filters']=_['concat'](_0x81b4cd['filters'],[_0xa9c4('0x34'),_0xa9c4('0x35'),_0xa9c4('0x36'),_0xa9c4('0x37'),'$lt',_0xa9c4('0x38'),'$ne',_0xa9c4('0x39'),'$not','$between',_0xa9c4('0x3a'),_0xa9c4('0x3b'),_0xa9c4('0x3c'),_0xa9c4('0x3d'),_0xa9c4('0x3e'),_0xa9c4('0x3f'),_0xa9c4('0x40'),_0xa9c4('0x3d'),'$overlap',_0xa9c4('0x41'),_0xa9c4('0x42'),'$any']);_0x315aed['attributes']=_[_0xa9c4('0x33')](_0x81b4cd['model'],qs['fields'](_0x505298[_0xa9c4('0x31')][_0xa9c4('0x43')]));_0x315aed[_0xa9c4('0x44')]=_0x315aed[_0xa9c4('0x44')][_0xa9c4('0x45')]?_0x315aed[_0xa9c4('0x44')]:_0x81b4cd['model'];if(!_0x505298[_0xa9c4('0x31')][_0xa9c4('0x46')](_0xa9c4('0x47'))){_0x315aed[_0xa9c4('0x1e')]=qs[_0xa9c4('0x1e')](_0x505298['query'][_0xa9c4('0x1e')]);_0x315aed[_0xa9c4('0x1d')]=qs['offset'](_0x505298[_0xa9c4('0x31')][_0xa9c4('0x1d')]);}_0x315aed['order']=qs[_0xa9c4('0x48')](_0x505298['query'][_0xa9c4('0x48')]);_0x315aed[_0xa9c4('0x49')]=qs[_0xa9c4('0x32')](_[_0xa9c4('0x4a')](_0x505298[_0xa9c4('0x31')],_0x81b4cd[_0xa9c4('0x32')]),_0x2d9fa7);if(_0x505298['query']['filter']){_0x315aed[_0xa9c4('0x49')]=_[_0xa9c4('0x4b')](_0x315aed[_0xa9c4('0x49')],{'$or':_['map'](_0x2d9fa7,function(_0x47c80d){if(_0x47c80d[_0xa9c4('0x4c')]!==_0xa9c4('0x4d')){var _0x3ec2ea={};_0x3ec2ea[_0x47c80d['name']]={'$like':'%'+_0x505298[_0xa9c4('0x31')][_0xa9c4('0x4e')]+'%'};return _0x3ec2ea;}})});}_0x315aed=_['merge']({},_0x315aed,_0x505298[_0xa9c4('0x4f')]);var _0x199356={'where':_0x315aed[_0xa9c4('0x49')]};return db['CmHopper'][_0xa9c4('0x1c')](_0x199356)[_0xa9c4('0x25')](function(_0x4ebd56){_0x46f4e5[_0xa9c4('0x1c')]=_0x4ebd56;if(_0x505298[_0xa9c4('0x31')][_0xa9c4('0x50')]){_0x315aed['include']=[{'all':!![]}];}return db[_0xa9c4('0x2b')][_0xa9c4('0x51')](_0x315aed);})['then'](function(_0x582ff1){_0x46f4e5[_0xa9c4('0x52')]=_0x582ff1;return _0x46f4e5;})[_0xa9c4('0x25')](respondWithFilteredResult(_0x3e01a4,_0x315aed))[_0xa9c4('0x53')](handleError(_0x3e01a4,null));};exports[_0xa9c4('0x54')]=function(_0x58cb0e,_0x596567){var _0x27b9b8={'raw':!![],'where':{'id':_0x58cb0e[_0xa9c4('0x55')]['id']}},_0x1a1f99={};_0x1a1f99['model']=_['keys'](db['CmHopper']['rawAttributes']);_0x1a1f99[_0xa9c4('0x31')]=_[_0xa9c4('0x30')](_0x58cb0e['query']);_0x1a1f99[_0xa9c4('0x32')]=_[_0xa9c4('0x33')](_0x1a1f99[_0xa9c4('0x2f')],_0x1a1f99['query']);_0x27b9b8['attributes']=_['intersection'](_0x1a1f99[_0xa9c4('0x2f')],qs['fields'](_0x58cb0e[_0xa9c4('0x31')][_0xa9c4('0x43')]));_0x27b9b8[_0xa9c4('0x44')]=_0x27b9b8[_0xa9c4('0x44')][_0xa9c4('0x45')]?_0x27b9b8['attributes']:_0x1a1f99[_0xa9c4('0x2f')];if(_0x58cb0e[_0xa9c4('0x31')][_0xa9c4('0x50')]){_0x27b9b8['include']=[{'all':!![]}];}_0x27b9b8=_['merge']({},_0x27b9b8,_0x58cb0e[_0xa9c4('0x4f')]);return db[_0xa9c4('0x2b')][_0xa9c4('0x56')](_0x27b9b8)[_0xa9c4('0x25')](handleEntityNotFound(_0x596567,null))[_0xa9c4('0x25')](respondWithResult(_0x596567,null))[_0xa9c4('0x53')](handleError(_0x596567,null));};exports[_0xa9c4('0x57')]=function(_0x7b3ad,_0x592e65){return db[_0xa9c4('0x2b')][_0xa9c4('0x57')](_0x7b3ad[_0xa9c4('0x58')],{})[_0xa9c4('0x25')](respondWithResult(_0x592e65,0xc9))[_0xa9c4('0x53')](handleError(_0x592e65,null));};exports[_0xa9c4('0x23')]=function(_0x1c327d,_0x25645f){if(_0x1c327d[_0xa9c4('0x58')]['id']){delete _0x1c327d[_0xa9c4('0x58')]['id'];}return db[_0xa9c4('0x2b')]['find']({'where':{'id':_0x1c327d[_0xa9c4('0x55')]['id']}})[_0xa9c4('0x25')](handleEntityNotFound(_0x25645f,null))[_0xa9c4('0x25')](saveUpdates(_0x1c327d[_0xa9c4('0x58')],null))[_0xa9c4('0x25')](respondWithResult(_0x25645f,null))[_0xa9c4('0x53')](handleError(_0x25645f,null));};exports[_0xa9c4('0x59')]=function(_0x286e15,_0x13e081){return db[_0xa9c4('0x2b')][_0xa9c4('0x59')]()[_0xa9c4('0x25')](respondWithResult(_0x13e081,null))[_0xa9c4('0x53')](handleError(_0x13e081,null));};exports[_0xa9c4('0x24')]=function(_0x45f2b4,_0x207264){var _0x41db80;return db[_0xa9c4('0x2b')]['find']({'where':{'id':_0x45f2b4[_0xa9c4('0x55')]['id']}})[_0xa9c4('0x25')](handleEntityNotFound(_0x207264,null))[_0xa9c4('0x25')](function(_0x328563){if(_0x328563){return _0x328563[_0xa9c4('0x24')]()[_0xa9c4('0x25')](function(_0x44f8c3){return _0x44f8c3;});}})['then'](function(_0x838470){_0x41db80=_0x838470;if(_0x838470){if(_0x838470['VoiceQueueId']||_0x838470[_0xa9c4('0x5a')]){return db[_0x838470[_0xa9c4('0x5b')]?_0xa9c4('0x5c'):_0xa9c4('0x5d')][_0xa9c4('0x56')]({'where':{'id':_0x838470[_0xa9c4('0x5b')]?_0x838470[_0xa9c4('0x5b')]:_0x838470['CampaignId']},'attributes':['id',_0xa9c4('0x29')],'raw':!![]});}}})[_0xa9c4('0x25')](function(_0x1e23a0){var _0x427271={};if(_0x1e23a0){_[_0xa9c4('0x4b')](_0x427271,_['omit'](_0x41db80['dataValues'],['createdAt','updatedAt','id']));_0x427271['state']=0x15;_0x427271['statedesc']='deleted';_0x427271[_0xa9c4('0x5e')]=_0x1e23a0[_0xa9c4('0x29')];_0x427271[_0xa9c4('0x5f')]=_0x45f2b4[_0xa9c4('0x60')][_0xa9c4('0x29')];_0x427271[_0xa9c4('0x61')]=_0x45f2b4[_0xa9c4('0x60')]['id'];_0x427271[_0xa9c4('0x62')]=!![];_0x427271[_0xa9c4('0x63')]=moment()['format'](_0xa9c4('0x64'));_0x427271[_0xa9c4('0x65')]=_0x41db80[_0xa9c4('0x66')];_0x427271[_0xa9c4('0x67')]=_0x41db80[_0xa9c4('0x5b')]?_0xa9c4('0x68'):_0xa9c4('0x69');return db[_0xa9c4('0x6a')]['find']({'where':{'id':_0x427271['ContactId']},'attributes':[_0xa9c4('0x6b'),_0xa9c4('0x6c')]})[_0xa9c4('0x25')](function(_0x3ca5bd){if(!_[_0xa9c4('0x6d')](_0x207264)&&!_['isNil'](_0x3ca5bd[_0xa9c4('0x6b')])){_0x427271[_0xa9c4('0x6e')]=_0x3ca5bd[_0xa9c4('0x6b')];if(!_[_0xa9c4('0x6d')](_0x3ca5bd[_0xa9c4('0x6c')])){_0x427271['calleridname']+='\x20'+_0x3ca5bd[_0xa9c4('0x6c')];}}})[_0xa9c4('0x6f')](function(){return db['CmHopperFinal']['create'](_0x427271);});}})[_0xa9c4('0x25')](function(){return _0x207264[_0xa9c4('0x1a')](0xcc)[_0xa9c4('0x19')]();})[_0xa9c4('0x53')](handleError(_0x207264,null));};exports[_0xa9c4('0x70')]=function(_0x4cd244,_0x4ed901,_0x3c2de6){var _0x257e79=[];return db[_0xa9c4('0x6a')][_0xa9c4('0x59')]()[_0xa9c4('0x25')](function(_0x9aecd8){_0x257e79=_[_0xa9c4('0x30')](_0x9aecd8);return _0x4cd244[_0xa9c4('0x60')]['getVoiceQueues']({'where':{'type':_0xa9c4('0x71'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa9c4('0x72')],'raw':!![]});})[_0xa9c4('0x25')](function(_0x1eb409){if(_0x1eb409&&_0x1eb409['length']){return db[_0xa9c4('0x73')][_0xa9c4('0x74')](function(_0x40790f){var _0x5c0ac0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9c4('0x75')](_0xa9c4('0x64'))},'VoiceQueueId':{'$in':_['map'](_0x1eb409,'id')},'$or':[{'UserId':null},{'UserId':_0x4cd244['user']['id']}]};var _0x31023a=[];if(_0x4cd244[_0xa9c4('0x58')][_0xa9c4('0x76')]&&_0x4cd244['body'][_0xa9c4('0x76')]===_0xa9c4('0x77')){if(!_['isEmpty'](_0x4cd244[_0xa9c4('0x58')][_0xa9c4('0x78')])){_0x5c0ac0['id']={'$in':_0x4cd244[_0xa9c4('0x58')]['hopperIds']};}_0x31023a=[[_0xa9c4('0x79'),_0xa9c4('0x7a')],[_0xa9c4('0x7b'),_0x1eb409[0x0]['dialOrderByScheduledAt']===_0xa9c4('0x7a')?'DESC':'ASC'],db[_0xa9c4('0x73')][_0xa9c4('0x7c')](_0xa9c4('0x7d')),['id',_0xa9c4('0x7e')]];}else{if(!_[_0xa9c4('0x7f')](_0x4cd244[_0xa9c4('0x58')][_0xa9c4('0x78')])){_0x5c0ac0['id']={'$notIn':_0x4cd244[_0xa9c4('0x58')][_0xa9c4('0x78')]};}_0x31023a=[[_0xa9c4('0x79'),'DESC'],[_0xa9c4('0x7b'),_0x1eb409[0x0][_0xa9c4('0x72')]],db['sequelize'][_0xa9c4('0x7c')](_0xa9c4('0x80')),['id',_0xa9c4('0x7a')]];}return db[_0xa9c4('0x2b')][_0xa9c4('0x81')]({'attributes':['id','scheduledat'],'where':_0x5c0ac0,'order':_0x31023a,'transaction':_0x40790f,'lock':_0x40790f['LOCK'][_0xa9c4('0x82')],'include':[{'model':db['CmContact'],'as':_0xa9c4('0x83'),'attributes':_0x257e79,'include':[{'model':db[_0xa9c4('0x84')],'as':_0xa9c4('0x85'),'attributes':['id',_0xa9c4('0x29')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa9c4('0x29')]},{'model':db[_0xa9c4('0x5c')],'as':_0xa9c4('0x86'),'attributes':['id',_0xa9c4('0x29'),_0xa9c4('0x87')]}]})[_0xa9c4('0x25')](function(_0x470ec3){if(_0x470ec3){return _0x470ec3['update']({'UserId':_0x4cd244[_0xa9c4('0x60')]['id']},{'transaction':_0x40790f});}});});}})[_0xa9c4('0x25')](handleEntityNotFound(_0x4ed901,null))[_0xa9c4('0x25')](respondWithResult(_0x4ed901,null))[_0xa9c4('0x53')](handleError(_0x4ed901,null));};exports[_0xa9c4('0x88')]=function(_0x23edd9,_0x516b11,_0x672a3e){return _0x23edd9['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xa9c4('0x25')](function(_0x445770){if(_0x445770&&_0x445770[_0xa9c4('0x45')]){return db[_0xa9c4('0x2b')][_0xa9c4('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9c4('0x75')](_0xa9c4('0x64'))},'VoiceQueueId':{'$in':_[_0xa9c4('0x2a')](_0x445770,'id')},'$or':[{'UserId':null},{'UserId':_0x23edd9[_0xa9c4('0x60')]['id']}]}});}return 0x0;})['then'](function(_0x3e6e09){if(!_[_0xa9c4('0x6d')](_0x3e6e09)&&_[_0xa9c4('0x89')](_0x3e6e09)){return _0x516b11[_0xa9c4('0x1a')](0xc8)[_0xa9c4('0x1b')]({'contacts':_0x3e6e09});}else{logger['error'](_0xa9c4('0x8a'),_0xa9c4('0x88'),0x194,_0xa9c4('0x8b'));_0x516b11[_0xa9c4('0x26')](0x194);}})['catch'](handleError(_0x516b11,null));};exports[_0xa9c4('0x8c')]=function(_0x11299d,_0x5d373d,_0x48d300){var _0x45905c=shared[_0xa9c4('0x8d')];var _0x192e10=[];_[_0xa9c4('0x2a')](_0x45905c,function(_0x49d57c){_0x192e10['push']({'id':_0x49d57c[_0xa9c4('0x29')],'name':_0x49d57c[_0xa9c4('0x29')],'utcOffset':_0x49d57c[_0xa9c4('0x8e')]});});return _0x5d373d['status'](0xc8)['json']({'tz':_0x192e10});};exports['getTimezone']=function(_0x4ee662,_0x5494ba,_0x1a1b15){var _0x5c1bcf=shared[_0xa9c4('0x8d')];var _0x11747d={};if(!_['isNil'](_0x5c1bcf[_0x4ee662[_0xa9c4('0x58')]['id']]))_0x11747d=_0x5c1bcf[_0x4ee662[_0xa9c4('0x58')]['id']];return _0x5494ba['status'](0xc8)['json'](_0x11747d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4d78e72..3277790 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 _0x18c8=['cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x1ed54c,_0xe6599b){var _0x3ca3c1=function(_0x2943e5){while(--_0x2943e5){_0x1ed54c['push'](_0x1ed54c['shift']());}};_0x3ca3c1(++_0xe6599b);}(_0x18c8,0x162));var _0x818c=function(_0x9580e2,_0x56ae7b){_0x9580e2=_0x9580e2-0x0;var _0x445d46=_0x18c8[_0x9580e2];return _0x445d46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x818c('0x0'))(_0x818c('0x1'));var moment=require(_0x818c('0x2'));var BPromise=require(_0x818c('0x3'));var rp=require(_0x818c('0x4'));var fs=require('fs');var path=require(_0x818c('0x5'));var rimraf=require('rimraf');var config=require(_0x818c('0x6'));var attributes=require(_0x818c('0x7'));module[_0x818c('0x8')]=function(_0x499b87,_0x5b5793){return _0x499b87[_0x818c('0x9')]('CmHopper',attributes,{'tableName':_0x818c('0xa'),'paranoid':![],'indexes':[{'name':_0x818c('0xb'),'fields':[_0x818c('0xb')]},{'name':_0x818c('0xc'),'fields':['phone']},{'name':_0x818c('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7bd=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','priority','lodash','util','../../config/logger','api'];(function(_0x1d6f75,_0x22ff41){var _0x1db40f=function(_0x140b82){while(--_0x140b82){_0x1d6f75['push'](_0x1d6f75['shift']());}};_0x1db40f(++_0x22ff41);}(_0xa7bd,0xdd));var _0xda7b=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0xa7bd[_0x2bc1fe];return _0x1a47a5;};'use strict';var _=require(_0xda7b('0x0'));var util=require(_0xda7b('0x1'));var logger=require(_0xda7b('0x2'))(_0xda7b('0x3'));var moment=require(_0xda7b('0x4'));var BPromise=require(_0xda7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda7b('0x6'));var rimraf=require('rimraf');var config=require(_0xda7b('0x7'));var attributes=require(_0xda7b('0x8'));module[_0xda7b('0x9')]=function(_0x128564,_0x454703){return _0x128564[_0xda7b('0xa')](_0xda7b('0xb'),attributes,{'tableName':_0xda7b('0xc'),'paranoid':![],'indexes':[{'name':_0xda7b('0xd'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0xda7b('0xe'),'fields':[_0xda7b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 7a87454..5aacdfe 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 _0x5099=['stringify','error','message','info','result','catch','GetCmHopper','options','raw','where','include','map','model','attributes','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','update','limit','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','order','UPDATE','Contact','User','Agent','name','length','UserId','push','MoveContactManagedDialer','destroy','CountReScheduled','findAll','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','GetCmHopperPreview','describe','keys','lodash','util','randomstring','../../config/utils','rpc','jayson/promise','client','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5099,0x70));var _0x9509=function(_0x2ea621,_0x1f0804){_0x2ea621=_0x2ea621-0x0;var _0x466c6c=_0x5099[_0x2ea621];return _0x466c6c;};'use strict';var _=require(_0x9509('0x0'));var util=require(_0x9509('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9509('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9509('0x3'));var logger=require('../../config/logger')(_0x9509('0x4'));var config=require('../../config/environment');var jayson=require(_0x9509('0x5'));var client=jayson[_0x9509('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e5f83,_0x25d24d,_0x2092ba){return new BPromise(function(_0x1f7862,_0x4da28e){return client['request'](_0x2e5f83,_0x2092ba)[_0x9509('0x7')](function(_0x3962f9){logger['info'](_0x9509('0x8'),_0x25d24d,_0x9509('0x9'));logger[_0x9509('0xa')](_0x9509('0xb'),_0x25d24d,_0x9509('0x9'),JSON[_0x9509('0xc')](_0x3962f9));if(_0x3962f9[_0x9509('0xd')]){if(_0x3962f9['error']['code']===0x1f4){logger[_0x9509('0xd')](_0x9509('0x8'),_0x25d24d,_0x3962f9[_0x9509('0xd')]['message']);return _0x4da28e(_0x3962f9[_0x9509('0xd')][_0x9509('0xe')]);}logger['error'](_0x9509('0x8'),_0x25d24d,_0x3962f9[_0x9509('0xd')][_0x9509('0xe')]);return _0x1f7862(_0x3962f9['error'][_0x9509('0xe')]);}else{logger[_0x9509('0xf')](_0x9509('0x8'),_0x25d24d,_0x9509('0x9'));_0x1f7862(_0x3962f9[_0x9509('0x10')][_0x9509('0xe')]);}})[_0x9509('0x11')](function(_0x484c3c){logger['error'](_0x9509('0x8'),_0x25d24d,_0x484c3c);_0x4da28e(_0x484c3c);});});}exports[_0x9509('0x12')]=function(_0x4133c5){var _0x4e2cde=this;return new Promise(function(_0x440288,_0x3e7630){return db['CmHopper']['findAll']({'raw':_0x4133c5[_0x9509('0x13')]?_0x4133c5[_0x9509('0x13')][_0x9509('0x14')]===undefined?!![]:![]:!![],'where':_0x4133c5[_0x9509('0x13')]?_0x4133c5[_0x9509('0x13')][_0x9509('0x15')]||null:null,'attributes':_0x4133c5['options']?_0x4133c5['options']['attributes']||null:null,'limit':_0x4133c5['options']?_0x4133c5[_0x9509('0x13')]['limit']||null:null,'include':_0x4133c5[_0x9509('0x13')]?_0x4133c5[_0x9509('0x13')][_0x9509('0x16')]?_[_0x9509('0x17')](_0x4133c5[_0x9509('0x13')][_0x9509('0x16')],function(_0xa27675){return{'model':db[_0xa27675[_0x9509('0x18')]],'as':_0xa27675['as'],'attributes':_0xa27675[_0x9509('0x19')],'include':_0xa27675[_0x9509('0x16')]?_[_0x9509('0x17')](_0xa27675[_0x9509('0x16')],function(_0x3c390f){return{'model':db[_0x3c390f[_0x9509('0x18')]],'as':_0x3c390f['as'],'attributes':_0x3c390f[_0x9509('0x19')],'include':_0x3c390f[_0x9509('0x16')]?_[_0x9509('0x17')](_0x3c390f[_0x9509('0x16')],function(_0x1ac32b){return{'model':db[_0x1ac32b[_0x9509('0x18')]],'as':_0x1ac32b['as'],'attributes':_0x1ac32b[_0x9509('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9509('0x7')](function(_0x4b542a){logger[_0x9509('0xf')]('GetCmHopper',_0x4133c5);logger[_0x9509('0xa')](_0x9509('0x12'),_0x4133c5,JSON[_0x9509('0xc')](_0x4b542a));_0x440288(_0x4b542a);})['catch'](function(_0x1963fb){logger['error'](_0x9509('0x12'),_0x1963fb['message'],_0x4133c5);_0x3e7630(_0x4e2cde[_0x9509('0xd')](0x1f4,_0x1963fb[_0x9509('0xe')]));});});};exports[_0x9509('0x1a')]=function(_0x5f4f28){var _0x457c7e=this;return new Promise(function(_0xe9e472,_0x385ed2){return db[_0x9509('0x1b')][_0x9509('0x1c')]({'raw':_0x5f4f28[_0x9509('0x13')]?_0x5f4f28[_0x9509('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x5f4f28[_0x9509('0x13')]?_0x5f4f28[_0x9509('0x13')][_0x9509('0x15')]||null:null,'attributes':_0x5f4f28['options']?_0x5f4f28[_0x9509('0x13')]['attributes']||null:null,'include':_0x5f4f28[_0x9509('0x13')]?_0x5f4f28[_0x9509('0x13')][_0x9509('0x16')]?_[_0x9509('0x17')](_0x5f4f28[_0x9509('0x13')][_0x9509('0x16')],function(_0x460762){return{'model':db[_0x460762[_0x9509('0x18')]],'as':_0x460762['as'],'attributes':_0x460762['attributes'],'include':_0x460762[_0x9509('0x16')]?_[_0x9509('0x17')](_0x460762[_0x9509('0x16')],function(_0x56c010){return{'model':db[_0x56c010['model']],'as':_0x56c010['as'],'attributes':_0x56c010[_0x9509('0x19')],'include':_0x56c010[_0x9509('0x16')]?_['map'](_0x56c010[_0x9509('0x16')],function(_0x892919){return{'model':db[_0x892919[_0x9509('0x18')]],'as':_0x892919['as'],'attributes':_0x892919['attributes']};}):[]};}):[]};}):[]:[]})[_0x9509('0x7')](function(_0x4df343){logger[_0x9509('0xf')]('ShowCmHopper',_0x5f4f28);logger['debug'](_0x9509('0x1a'),_0x5f4f28,JSON['stringify'](_0x4df343));_0xe9e472(_0x4df343);})[_0x9509('0x11')](function(_0x5f40cb){logger[_0x9509('0xd')](_0x9509('0x1a'),_0x5f40cb[_0x9509('0xe')],_0x5f4f28);_0x385ed2(_0x457c7e[_0x9509('0xd')](0x1f4,_0x5f40cb[_0x9509('0xe')]));});});};exports[_0x9509('0x1d')]=function(_0x3e38c5){var _0x4526f8=this;return new Promise(function(_0x410fe4,_0x17bbad){return db[_0x9509('0x1b')][_0x9509('0x1e')](_0x3e38c5[_0x9509('0x1f')],{'raw':_0x3e38c5[_0x9509('0x13')]?_0x3e38c5[_0x9509('0x13')][_0x9509('0x14')]===undefined?!![]:![]:!![]})[_0x9509('0x7')](function(_0x4ebb5b){logger[_0x9509('0xf')]('CreateCmHopper',_0x3e38c5);logger[_0x9509('0xa')](_0x9509('0x1d'),_0x3e38c5,JSON['stringify'](_0x4ebb5b));_0x410fe4(_0x4ebb5b);})[_0x9509('0x11')](function(_0x557682){logger['error'](_0x9509('0x1d'),_0x557682[_0x9509('0xe')],_0x3e38c5);_0x17bbad(_0x4526f8['error'](0x1f4,_0x557682[_0x9509('0xe')]));});});};exports['UpdateCmHopper']=function(_0x302cc7){var _0x5bd722=this;return new Promise(function(_0x35c843,_0x19e4b6){return db[_0x9509('0x1b')][_0x9509('0x20')](_0x302cc7[_0x9509('0x1f')],{'raw':_0x302cc7[_0x9509('0x13')]?_0x302cc7[_0x9509('0x13')][_0x9509('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x302cc7[_0x9509('0x13')]?_0x302cc7[_0x9509('0x13')][_0x9509('0x15')]||null:null,'attributes':_0x302cc7[_0x9509('0x13')]?_0x302cc7[_0x9509('0x13')][_0x9509('0x19')]||null:null,'limit':_0x302cc7['options']?_0x302cc7[_0x9509('0x13')][_0x9509('0x21')]||null:null})[_0x9509('0x7')](function(_0x5b4b7f){logger[_0x9509('0xf')]('UpdateCmHopper',_0x302cc7);logger[_0x9509('0xa')](_0x9509('0x22'),_0x302cc7,JSON['stringify'](_0x5b4b7f));_0x35c843(_0x5b4b7f);})[_0x9509('0x11')](function(_0x2ad9bc){logger[_0x9509('0xd')](_0x9509('0x22'),_0x2ad9bc['message'],_0x302cc7);_0x19e4b6(_0x5bd722[_0x9509('0xd')](0x1f4,_0x2ad9bc['message']));});});};exports[_0x9509('0x23')]=function(_0xff21a2){var _0x32631a=this;return new Promise(function(_0x4e326b,_0xac9217){return db[_0x9509('0x1b')]['destroy']({'where':_0xff21a2[_0x9509('0x13')]?_0xff21a2['options'][_0x9509('0x15')]||null:null})[_0x9509('0x7')](function(_0x36d55a){logger['info'](_0x9509('0x23'),_0xff21a2);logger[_0x9509('0xa')](_0x9509('0x23'),_0xff21a2,JSON[_0x9509('0xc')](_0x36d55a));_0x4e326b(_0x36d55a);})[_0x9509('0x11')](function(_0x4cd1cc){logger[_0x9509('0xd')]('DestroyCmHopper',_0x4cd1cc['message'],_0xff21a2);_0xac9217(_0x32631a['error'](0x1f4,_0x4cd1cc['message']));});});};exports[_0x9509('0x24')]=function(_0x142861){var _0x2151c7=this;return new Promise(function(_0x5c2bc6,_0x21c84a){return db[_0x9509('0x25')]['describe']()[_0x9509('0x7')](function(_0x164862){return db[_0x9509('0x26')][_0x9509('0x27')](function(_0x53346f){return db[_0x9509('0x1b')]['findAll']({'where':_0x142861['options']?_0x142861[_0x9509('0x13')][_0x9509('0x15')]||null:null,'attributes':_0x142861[_0x9509('0x13')]?_0x142861[_0x9509('0x13')][_0x9509('0x19')]||null:null,'limit':_0x142861[_0x9509('0x13')]?_0x142861[_0x9509('0x13')][_0x9509('0x21')]||null:null,'order':_0x142861[_0x9509('0x13')]?_0x142861[_0x9509('0x13')][_0x9509('0x28')]||null:null,'transaction':_0x53346f,'lock':_0x53346f['LOCK'][_0x9509('0x29')],'include':[{'model':db[_0x9509('0x25')],'as':_0x9509('0x2a'),'attributes':_['keys'](_0x164862)},{'model':db[_0x9509('0x2b')],'as':_0x9509('0x2c'),'attributes':['id',_0x9509('0x2d'),'voicePause']}]})[_0x9509('0x7')](function(_0x288ec1){var _0x1fdd27=[];var _0x3f60bb=[];for(var _0x2127b0=0x0;_0x2127b0<_0x288ec1[_0x9509('0x2e')];_0x2127b0+=0x1){if(!_0x3f60bb['includes'](_0x288ec1[_0x2127b0][_0x9509('0x2f')])){_0x3f60bb[_0x9509('0x30')](_0x288ec1[_0x2127b0][_0x9509('0x2f')]);_0x1fdd27[_0x9509('0x30')](_0x288ec1[_0x2127b0][_0x9509('0x20')](_0x142861['body'],{'transaction':_0x53346f}));}}return BPromise['all'](_0x1fdd27);});})['then'](function(_0x109be2){logger[_0x9509('0xf')](_0x9509('0x24'),_0x142861);logger[_0x9509('0xa')](_0x9509('0x24'),_0x142861,JSON[_0x9509('0xc')](_0x109be2));_0x5c2bc6(_0x109be2);})[_0x9509('0x11')](function(_0x4c89f4){logger['error']('GetContactDialer',_0x4c89f4[_0x9509('0xe')],_0x142861);_0x21c84a(_0x2151c7[_0x9509('0xd')](0x1f4,_0x4c89f4['message']));});});});};exports[_0x9509('0x31')]=function(_0x242819){var _0xe20ce2=this;return new Promise(function(_0x45fa29,_0x2cbfb5){return db[_0x9509('0x26')][_0x9509('0x27')](function(_0x248014){return db['CmHopperFinal']['create'](_0x242819[_0x9509('0x1f')],{'raw':_0x242819['options']?_0x242819[_0x9509('0x13')][_0x9509('0x14')]===undefined?!![]:![]:!![],'transaction':_0x248014})['then'](function(){return db['CmHopper'][_0x9509('0x32')]({'where':_0x242819[_0x9509('0x13')]?_0x242819['options'][_0x9509('0x15')]||null:null,'transaction':_0x248014});});})[_0x9509('0x7')](function(_0x5867a7){logger[_0x9509('0xf')](_0x9509('0x31'),_0x242819);logger[_0x9509('0xa')](_0x9509('0x31'),_0x242819,JSON['stringify'](_0x5867a7));_0x45fa29(_0x5867a7);})[_0x9509('0x11')](function(_0x42857f){logger[_0x9509('0xd')](_0x9509('0x31'),_0x42857f[_0x9509('0xe')],_0x242819);_0x2cbfb5(_0xe20ce2[_0x9509('0xd')](0x1f4,_0x42857f[_0x9509('0xe')]));});});};exports[_0x9509('0x33')]=function(_0x5490bd){var _0x363b63=this;return new Promise(function(_0x244ec6,_0xa31177){return db[_0x9509('0x1b')][_0x9509('0x34')]({'raw':_0x5490bd[_0x9509('0x13')]?_0x5490bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5490bd[_0x9509('0x13')]?_0x5490bd['options'][_0x9509('0x15')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9509('0x26')][_0x9509('0x35')](_0x9509('0x36')+util[_0x9509('0x37')](_0x9509('0x38'),moment()[_0x9509('0x37')](_0x9509('0x39')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x9509('0x7')](function(_0x385123){logger['info'](_0x9509('0x33'),_0x5490bd);logger[_0x9509('0xa')](_0x9509('0x33'),_0x5490bd,JSON[_0x9509('0xc')](_0x385123));_0x244ec6(_0x385123);})['catch'](function(_0x2dcc99){logger[_0x9509('0xd')](_0x9509('0x33'),_0x2dcc99[_0x9509('0xe')],_0x5490bd);_0xa31177(_0x363b63[_0x9509('0xd')](0x1f4,_0x2dcc99[_0x9509('0xe')]));});});};exports[_0x9509('0x3a')]=function(_0x19f540){var _0x203346=this;return new Promise(function(_0x3ac840,_0x32236e){return db[_0x9509('0x25')]['describe']()[_0x9509('0x7')](function(_0x502db7){return db[_0x9509('0x26')]['transaction'](function(_0x4492e9){return db[_0x9509('0x1b')][_0x9509('0x34')]({'where':_0x19f540['options']?_0x19f540[_0x9509('0x13')][_0x9509('0x15')]||null:null,'attributes':_0x19f540[_0x9509('0x13')]?_0x19f540[_0x9509('0x13')]['attributes']||null:null,'limit':0x1,'order':_0x19f540[_0x9509('0x13')]?_0x19f540['options'][_0x9509('0x28')]||null:null,'group':db[_0x9509('0x1b')][_0x9509('0x2f')],'transaction':_0x4492e9,'lock':_0x4492e9['LOCK'][_0x9509('0x29')],'include':_0x19f540[_0x9509('0x13')]?_0x19f540[_0x9509('0x13')][_0x9509('0x16')]?_[_0x9509('0x17')](_0x19f540['options'][_0x9509('0x16')],function(_0x1a39ee){return{'model':db[_0x1a39ee[_0x9509('0x18')]],'as':_0x1a39ee['as'],'attributes':_0x1a39ee[_0x9509('0x19')],'include':_0x1a39ee[_0x9509('0x16')]?_[_0x9509('0x17')](_0x1a39ee[_0x9509('0x16')],function(_0x6f982d){return{'model':db[_0x6f982d['model']],'as':_0x6f982d['as'],'attributes':_0x6f982d[_0x9509('0x19')],'include':_0x6f982d[_0x9509('0x16')]?_['map'](_0x6f982d[_0x9509('0x16')],function(_0x294377){return{'model':db[_0x294377[_0x9509('0x18')]],'as':_0x294377['as'],'attributes':_0x294377[_0x9509('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9509('0x7')](function(_0x33140a){var _0x4273f5=[];for(var _0x39377b=0x0;_0x39377b<_0x33140a[_0x9509('0x2e')];_0x39377b+=0x1){_0x4273f5[_0x9509('0x30')](_0x33140a[_0x39377b][_0x9509('0x20')](_0x19f540[_0x9509('0x1f')],{'transaction':_0x4492e9}));}return BPromise['all'](_0x4273f5);});})[_0x9509('0x7')](function(_0x331f68){logger[_0x9509('0xf')](_0x9509('0x3a'),_0x19f540);logger[_0x9509('0xa')](_0x9509('0x3a'),_0x19f540,JSON[_0x9509('0xc')](_0x331f68));_0x3ac840(_0x331f68);})['catch'](function(_0x4544dc){logger[_0x9509('0xd')](_0x9509('0x3a'),_0x4544dc[_0x9509('0xe')],_0x19f540);_0x32236e(_0x203346['error'](0x1f4,_0x4544dc[_0x9509('0xe')]));});});});};exports[_0x9509('0x3b')]=function(_0x211c5c){var _0x4c9d62=this;return new Promise(function(_0x56402f,_0x42d84f){db[_0x9509('0x25')][_0x9509('0x3c')]()[_0x9509('0x7')](function(_0x2b349d){return db[_0x9509('0x1b')][_0x9509('0x34')]({'raw':_0x211c5c[_0x9509('0x13')]?_0x211c5c[_0x9509('0x13')][_0x9509('0x14')]===undefined?!![]:![]:!![],'where':_0x211c5c[_0x9509('0x13')]?_0x211c5c['options'][_0x9509('0x15')]||null:null,'attributes':_0x211c5c[_0x9509('0x13')]?_0x211c5c[_0x9509('0x13')][_0x9509('0x19')]||null:null,'limit':_0x211c5c[_0x9509('0x13')]?_0x211c5c['options'][_0x9509('0x21')]||null:null,'include':_0x211c5c[_0x9509('0x13')]?_0x211c5c['options'][_0x9509('0x16')]?_[_0x9509('0x17')](_0x211c5c['options'][_0x9509('0x16')],function(_0xee9820){return{'model':db[_0xee9820['model']],'as':_0xee9820['as'],'attributes':_0xee9820['as']===_0x9509('0x2a')?_[_0x9509('0x3d')](_0x2b349d):_0xee9820[_0x9509('0x19')],'include':_0xee9820[_0x9509('0x16')]?_['map'](_0xee9820[_0x9509('0x16')],function(_0x48fca8){return{'model':db[_0x48fca8[_0x9509('0x18')]],'as':_0x48fca8['as'],'attributes':_0x48fca8[_0x9509('0x19')],'include':_0x48fca8[_0x9509('0x16')]?_[_0x9509('0x17')](_0x48fca8['include'],function(_0x596c4b){return{'model':db[_0x596c4b[_0x9509('0x18')]],'as':_0x596c4b['as'],'attributes':_0x596c4b[_0x9509('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d5280){logger[_0x9509('0xf')](_0x9509('0x12'),_0x211c5c);logger[_0x9509('0xa')](_0x9509('0x12'),_0x211c5c,JSON[_0x9509('0xc')](_0x2d5280));_0x56402f(_0x2d5280);})['catch'](function(_0x1a9fc5){logger[_0x9509('0xd')](_0x9509('0x12'),_0x1a9fc5[_0x9509('0xe')],_0x211c5c);_0x42d84f(_0x4c9d62[_0x9509('0xd')](0x1f4,_0x1a9fc5[_0x9509('0xe')]));});});});}; \ No newline at end of file +var _0x0c60=['push','UserId','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','format','\x20,\x201,\x20null','contactsRescheduled','LOCK','length','GetContactRecallMe','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','attributes','limit','map','include','model','catch','ShowCmHopper','find','raw','where','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','UPDATE','User','name','voicePause','includes'];(function(_0x5865b6,_0x3caea1){var _0x4b8ba8=function(_0x8b9aa3){while(--_0x8b9aa3){_0x5865b6['push'](_0x5865b6['shift']());}};_0x4b8ba8(++_0x3caea1);}(_0x0c60,0x11a));var _0x00c6=function(_0x76c5d6,_0x2ebbf8){_0x76c5d6=_0x76c5d6-0x0;var _0x5cc18c=_0x0c60[_0x76c5d6];return _0x5cc18c;};'use strict';var _=require(_0x00c6('0x0'));var util=require('util');var moment=require(_0x00c6('0x1'));var BPromise=require('bluebird');var rs=require(_0x00c6('0x2'));var fs=require('fs');var Redis=require(_0x00c6('0x3'));var db=require(_0x00c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x00c6('0x5'));var config=require(_0x00c6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x00c6('0x7')][_0x00c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15485d,_0x326800,_0x24a7af){return new BPromise(function(_0x10e338,_0x54f853){return client[_0x00c6('0x9')](_0x15485d,_0x24a7af)[_0x00c6('0xa')](function(_0x45e332){logger[_0x00c6('0xb')](_0x00c6('0xc'),_0x326800,_0x00c6('0xd'));logger[_0x00c6('0xe')](_0x00c6('0xf'),_0x326800,_0x00c6('0xd'),JSON[_0x00c6('0x10')](_0x45e332));if(_0x45e332[_0x00c6('0x11')]){if(_0x45e332[_0x00c6('0x11')][_0x00c6('0x12')]===0x1f4){logger[_0x00c6('0x11')](_0x00c6('0xc'),_0x326800,_0x45e332[_0x00c6('0x11')][_0x00c6('0x13')]);return _0x54f853(_0x45e332['error'][_0x00c6('0x13')]);}logger[_0x00c6('0x11')](_0x00c6('0xc'),_0x326800,_0x45e332[_0x00c6('0x11')][_0x00c6('0x13')]);return _0x10e338(_0x45e332[_0x00c6('0x11')]['message']);}else{logger[_0x00c6('0xb')](_0x00c6('0xc'),_0x326800,_0x00c6('0xd'));_0x10e338(_0x45e332[_0x00c6('0x14')][_0x00c6('0x13')]);}})['catch'](function(_0x7d2cca){logger[_0x00c6('0x11')](_0x00c6('0xc'),_0x326800,_0x7d2cca);_0x54f853(_0x7d2cca);});});}exports[_0x00c6('0x15')]=function(_0x2bd577){var _0x59702b=this;return new Promise(function(_0x3c9ce9,_0x43c97c){return db[_0x00c6('0x16')][_0x00c6('0x17')]({'raw':_0x2bd577['options']?_0x2bd577[_0x00c6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2bd577[_0x00c6('0x18')]?_0x2bd577[_0x00c6('0x18')]['where']||null:null,'attributes':_0x2bd577[_0x00c6('0x18')]?_0x2bd577[_0x00c6('0x18')][_0x00c6('0x19')]||null:null,'limit':_0x2bd577[_0x00c6('0x18')]?_0x2bd577[_0x00c6('0x18')][_0x00c6('0x1a')]||null:null,'include':_0x2bd577[_0x00c6('0x18')]?_0x2bd577[_0x00c6('0x18')]['include']?_[_0x00c6('0x1b')](_0x2bd577[_0x00c6('0x18')][_0x00c6('0x1c')],function(_0x13c931){return{'model':db[_0x13c931[_0x00c6('0x1d')]],'as':_0x13c931['as'],'attributes':_0x13c931['attributes'],'include':_0x13c931[_0x00c6('0x1c')]?_[_0x00c6('0x1b')](_0x13c931[_0x00c6('0x1c')],function(_0x914187){return{'model':db[_0x914187['model']],'as':_0x914187['as'],'attributes':_0x914187['attributes'],'include':_0x914187['include']?_[_0x00c6('0x1b')](_0x914187[_0x00c6('0x1c')],function(_0x351b23){return{'model':db[_0x351b23[_0x00c6('0x1d')]],'as':_0x351b23['as'],'attributes':_0x351b23[_0x00c6('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56a6cb){logger[_0x00c6('0xb')](_0x00c6('0x15'),_0x2bd577);logger[_0x00c6('0xe')]('GetCmHopper',_0x2bd577,JSON[_0x00c6('0x10')](_0x56a6cb));_0x3c9ce9(_0x56a6cb);})[_0x00c6('0x1e')](function(_0x5ccbd9){logger[_0x00c6('0x11')]('GetCmHopper',_0x5ccbd9['message'],_0x2bd577);_0x43c97c(_0x59702b[_0x00c6('0x11')](0x1f4,_0x5ccbd9['message']));});});};exports[_0x00c6('0x1f')]=function(_0x10c97e){var _0x2db31c=this;return new Promise(function(_0x527a7e,_0x2229d3){return db[_0x00c6('0x16')][_0x00c6('0x20')]({'raw':_0x10c97e[_0x00c6('0x18')]?_0x10c97e['options'][_0x00c6('0x21')]===undefined?!![]:![]:!![],'where':_0x10c97e[_0x00c6('0x18')]?_0x10c97e[_0x00c6('0x18')][_0x00c6('0x22')]||null:null,'attributes':_0x10c97e[_0x00c6('0x18')]?_0x10c97e[_0x00c6('0x18')]['attributes']||null:null,'include':_0x10c97e['options']?_0x10c97e[_0x00c6('0x18')][_0x00c6('0x1c')]?_[_0x00c6('0x1b')](_0x10c97e[_0x00c6('0x18')][_0x00c6('0x1c')],function(_0x5cd4b2){return{'model':db[_0x5cd4b2['model']],'as':_0x5cd4b2['as'],'attributes':_0x5cd4b2[_0x00c6('0x19')],'include':_0x5cd4b2[_0x00c6('0x1c')]?_[_0x00c6('0x1b')](_0x5cd4b2[_0x00c6('0x1c')],function(_0x2d01cb){return{'model':db[_0x2d01cb[_0x00c6('0x1d')]],'as':_0x2d01cb['as'],'attributes':_0x2d01cb['attributes'],'include':_0x2d01cb[_0x00c6('0x1c')]?_['map'](_0x2d01cb[_0x00c6('0x1c')],function(_0x20442b){return{'model':db[_0x20442b[_0x00c6('0x1d')]],'as':_0x20442b['as'],'attributes':_0x20442b[_0x00c6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x00c6('0xa')](function(_0x645007){logger['info'](_0x00c6('0x1f'),_0x10c97e);logger[_0x00c6('0xe')](_0x00c6('0x1f'),_0x10c97e,JSON['stringify'](_0x645007));_0x527a7e(_0x645007);})[_0x00c6('0x1e')](function(_0x13ffbd){logger[_0x00c6('0x11')](_0x00c6('0x1f'),_0x13ffbd['message'],_0x10c97e);_0x2229d3(_0x2db31c[_0x00c6('0x11')](0x1f4,_0x13ffbd[_0x00c6('0x13')]));});});};exports[_0x00c6('0x23')]=function(_0x42ec1b){var _0x4f0a1b=this;return new Promise(function(_0x22be54,_0x31f8fd){return db['CmHopper'][_0x00c6('0x24')](_0x42ec1b[_0x00c6('0x25')],{'raw':_0x42ec1b[_0x00c6('0x18')]?_0x42ec1b[_0x00c6('0x18')][_0x00c6('0x21')]===undefined?!![]:![]:!![]})[_0x00c6('0xa')](function(_0x4c115e){logger[_0x00c6('0xb')](_0x00c6('0x23'),_0x42ec1b);logger['debug'](_0x00c6('0x23'),_0x42ec1b,JSON[_0x00c6('0x10')](_0x4c115e));_0x22be54(_0x4c115e);})[_0x00c6('0x1e')](function(_0x4eefad){logger[_0x00c6('0x11')](_0x00c6('0x23'),_0x4eefad['message'],_0x42ec1b);_0x31f8fd(_0x4f0a1b[_0x00c6('0x11')](0x1f4,_0x4eefad[_0x00c6('0x13')]));});});};exports[_0x00c6('0x26')]=function(_0x3060f3){var _0x53fdd9=this;return new Promise(function(_0x2cb4ed,_0x8c202f){return db[_0x00c6('0x16')][_0x00c6('0x27')](_0x3060f3[_0x00c6('0x25')],{'raw':_0x3060f3[_0x00c6('0x18')]?_0x3060f3[_0x00c6('0x18')][_0x00c6('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3060f3[_0x00c6('0x18')]?_0x3060f3[_0x00c6('0x18')][_0x00c6('0x22')]||null:null,'attributes':_0x3060f3[_0x00c6('0x18')]?_0x3060f3[_0x00c6('0x18')][_0x00c6('0x19')]||null:null,'limit':_0x3060f3[_0x00c6('0x18')]?_0x3060f3['options'][_0x00c6('0x1a')]||null:null})[_0x00c6('0xa')](function(_0x50bf5a){logger[_0x00c6('0xb')](_0x00c6('0x26'),_0x3060f3);logger[_0x00c6('0xe')]('UpdateCmHopper',_0x3060f3,JSON['stringify'](_0x50bf5a));_0x2cb4ed(_0x50bf5a);})['catch'](function(_0x41a2a5){logger[_0x00c6('0x11')](_0x00c6('0x26'),_0x41a2a5[_0x00c6('0x13')],_0x3060f3);_0x8c202f(_0x53fdd9['error'](0x1f4,_0x41a2a5['message']));});});};exports[_0x00c6('0x28')]=function(_0x4e98f8){var _0x2859d4=this;return new Promise(function(_0x17cf27,_0x4eb823){return db[_0x00c6('0x16')][_0x00c6('0x29')]({'where':_0x4e98f8[_0x00c6('0x18')]?_0x4e98f8['options'][_0x00c6('0x22')]||null:null})[_0x00c6('0xa')](function(_0x20ae0b){logger[_0x00c6('0xb')](_0x00c6('0x28'),_0x4e98f8);logger['debug'](_0x00c6('0x28'),_0x4e98f8,JSON[_0x00c6('0x10')](_0x20ae0b));_0x17cf27(_0x20ae0b);})[_0x00c6('0x1e')](function(_0x55854b){logger[_0x00c6('0x11')](_0x00c6('0x28'),_0x55854b['message'],_0x4e98f8);_0x4eb823(_0x2859d4[_0x00c6('0x11')](0x1f4,_0x55854b[_0x00c6('0x13')]));});});};exports[_0x00c6('0x2a')]=function(_0x5257a9){var _0xbc8f81=this;return new Promise(function(_0x25a163,_0x5c7ae0){return db[_0x00c6('0x2b')][_0x00c6('0x2c')]()['then'](function(_0x31c73b){return db[_0x00c6('0x2d')][_0x00c6('0x2e')](function(_0x39c6f7){return db[_0x00c6('0x16')][_0x00c6('0x17')]({'where':_0x5257a9[_0x00c6('0x18')]?_0x5257a9[_0x00c6('0x18')][_0x00c6('0x22')]||null:null,'attributes':_0x5257a9['options']?_0x5257a9[_0x00c6('0x18')][_0x00c6('0x19')]||null:null,'limit':_0x5257a9[_0x00c6('0x18')]?_0x5257a9[_0x00c6('0x18')]['limit']||null:null,'order':_0x5257a9[_0x00c6('0x18')]?_0x5257a9['options'][_0x00c6('0x2f')]||null:null,'transaction':_0x39c6f7,'lock':_0x39c6f7['LOCK'][_0x00c6('0x30')],'include':[{'model':db[_0x00c6('0x2b')],'as':'Contact','attributes':_['keys'](_0x31c73b)},{'model':db[_0x00c6('0x31')],'as':'Agent','attributes':['id',_0x00c6('0x32'),_0x00c6('0x33')]}]})[_0x00c6('0xa')](function(_0x25a014){var _0x1b5e73=[];var _0x881533=[];for(var _0x440b9a=0x0;_0x440b9a<_0x25a014['length'];_0x440b9a+=0x1){if(!_0x881533[_0x00c6('0x34')](_0x25a014[_0x440b9a]['UserId'])){_0x881533[_0x00c6('0x35')](_0x25a014[_0x440b9a][_0x00c6('0x36')]);_0x1b5e73['push'](_0x25a014[_0x440b9a][_0x00c6('0x27')](_0x5257a9['body'],{'transaction':_0x39c6f7}));}}return BPromise[_0x00c6('0x37')](_0x1b5e73);});})[_0x00c6('0xa')](function(_0x39609f){logger[_0x00c6('0xb')](_0x00c6('0x2a'),_0x5257a9);logger[_0x00c6('0xe')](_0x00c6('0x2a'),_0x5257a9,JSON[_0x00c6('0x10')](_0x39609f));_0x25a163(_0x39609f);})[_0x00c6('0x1e')](function(_0x4911c4){logger['error']('GetContactDialer',_0x4911c4[_0x00c6('0x13')],_0x5257a9);_0x5c7ae0(_0xbc8f81[_0x00c6('0x11')](0x1f4,_0x4911c4[_0x00c6('0x13')]));});});});};exports[_0x00c6('0x38')]=function(_0x409980){var _0x2612ce=this;return new Promise(function(_0x2706b7,_0xce1ed9){return db[_0x00c6('0x2d')][_0x00c6('0x2e')](function(_0x6d3f98){return db[_0x00c6('0x39')][_0x00c6('0x24')](_0x409980[_0x00c6('0x25')],{'raw':_0x409980[_0x00c6('0x18')]?_0x409980[_0x00c6('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x6d3f98})[_0x00c6('0xa')](function(){return db['CmHopper'][_0x00c6('0x29')]({'where':_0x409980[_0x00c6('0x18')]?_0x409980['options'][_0x00c6('0x22')]||null:null,'transaction':_0x6d3f98});});})[_0x00c6('0xa')](function(_0x4f5e50){logger['info'](_0x00c6('0x38'),_0x409980);logger[_0x00c6('0xe')](_0x00c6('0x38'),_0x409980,JSON[_0x00c6('0x10')](_0x4f5e50));_0x2706b7(_0x4f5e50);})[_0x00c6('0x1e')](function(_0x1e5ea2){logger[_0x00c6('0x11')](_0x00c6('0x38'),_0x1e5ea2['message'],_0x409980);_0xce1ed9(_0x2612ce[_0x00c6('0x11')](0x1f4,_0x1e5ea2[_0x00c6('0x13')]));});});};exports[_0x00c6('0x3a')]=function(_0x29a429){var _0x4a34cc=this;return new Promise(function(_0xa8e7ae,_0x38b740){return db[_0x00c6('0x16')][_0x00c6('0x17')]({'raw':_0x29a429['options']?_0x29a429[_0x00c6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x29a429[_0x00c6('0x18')]?_0x29a429[_0x00c6('0x18')][_0x00c6('0x22')]||null:null,'attributes':[[db[_0x00c6('0x2d')]['fn'](_0x00c6('0x3b'),db[_0x00c6('0x2d')]['fn']('IF',db[_0x00c6('0x2d')][_0x00c6('0x3c')]('`scheduledat`\x20>=\x20'+util[_0x00c6('0x3d')]('\x22%s\x22',moment()[_0x00c6('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x00c6('0x3e')))),_0x00c6('0x3f')]]})[_0x00c6('0xa')](function(_0x51589c){logger[_0x00c6('0xb')](_0x00c6('0x3a'),_0x29a429);logger[_0x00c6('0xe')](_0x00c6('0x3a'),_0x29a429,JSON[_0x00c6('0x10')](_0x51589c));_0xa8e7ae(_0x51589c);})[_0x00c6('0x1e')](function(_0x464ef0){logger[_0x00c6('0x11')]('CountReScheduled',_0x464ef0['message'],_0x29a429);_0x38b740(_0x4a34cc['error'](0x1f4,_0x464ef0[_0x00c6('0x13')]));});});};exports['GetContactRecallMe']=function(_0x49e6b5){var _0x30bcb1=this;return new Promise(function(_0x471200,_0x311d1f){return db[_0x00c6('0x2b')][_0x00c6('0x2c')]()[_0x00c6('0xa')](function(_0x5ae287){return db[_0x00c6('0x2d')][_0x00c6('0x2e')](function(_0x58ee4e){return db[_0x00c6('0x16')][_0x00c6('0x17')]({'where':_0x49e6b5[_0x00c6('0x18')]?_0x49e6b5['options'][_0x00c6('0x22')]||null:null,'attributes':_0x49e6b5['options']?_0x49e6b5[_0x00c6('0x18')][_0x00c6('0x19')]||null:null,'limit':0x1,'order':_0x49e6b5[_0x00c6('0x18')]?_0x49e6b5[_0x00c6('0x18')]['order']||null:null,'group':db[_0x00c6('0x16')][_0x00c6('0x36')],'transaction':_0x58ee4e,'lock':_0x58ee4e[_0x00c6('0x40')]['UPDATE'],'include':_0x49e6b5['options']?_0x49e6b5[_0x00c6('0x18')]['include']?_[_0x00c6('0x1b')](_0x49e6b5[_0x00c6('0x18')][_0x00c6('0x1c')],function(_0x207510){return{'model':db[_0x207510['model']],'as':_0x207510['as'],'attributes':_0x207510[_0x00c6('0x19')],'include':_0x207510[_0x00c6('0x1c')]?_[_0x00c6('0x1b')](_0x207510[_0x00c6('0x1c')],function(_0x163843){return{'model':db[_0x163843[_0x00c6('0x1d')]],'as':_0x163843['as'],'attributes':_0x163843[_0x00c6('0x19')],'include':_0x163843['include']?_['map'](_0x163843[_0x00c6('0x1c')],function(_0x104499){return{'model':db[_0x104499[_0x00c6('0x1d')]],'as':_0x104499['as'],'attributes':_0x104499[_0x00c6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x00c6('0xa')](function(_0x5812be){var _0x1c7b57=[];for(var _0x39e500=0x0;_0x39e500<_0x5812be[_0x00c6('0x41')];_0x39e500+=0x1){_0x1c7b57['push'](_0x5812be[_0x39e500][_0x00c6('0x27')](_0x49e6b5[_0x00c6('0x25')],{'transaction':_0x58ee4e}));}return BPromise[_0x00c6('0x37')](_0x1c7b57);});})[_0x00c6('0xa')](function(_0x3f74a5){logger[_0x00c6('0xb')](_0x00c6('0x42'),_0x49e6b5);logger[_0x00c6('0xe')](_0x00c6('0x42'),_0x49e6b5,JSON[_0x00c6('0x10')](_0x3f74a5));_0x471200(_0x3f74a5);})[_0x00c6('0x1e')](function(_0x1bbdf1){logger['error'](_0x00c6('0x42'),_0x1bbdf1[_0x00c6('0x13')],_0x49e6b5);_0x311d1f(_0x30bcb1[_0x00c6('0x11')](0x1f4,_0x1bbdf1['message']));});});});};exports['GetCmHopperPreview']=function(_0x103580){var _0x3f1151=this;return new Promise(function(_0x4f517f,_0x5af613){db[_0x00c6('0x2b')][_0x00c6('0x2c')]()[_0x00c6('0xa')](function(_0x4c3215){return db[_0x00c6('0x16')][_0x00c6('0x17')]({'raw':_0x103580[_0x00c6('0x18')]?_0x103580[_0x00c6('0x18')][_0x00c6('0x21')]===undefined?!![]:![]:!![],'where':_0x103580['options']?_0x103580['options']['where']||null:null,'attributes':_0x103580['options']?_0x103580[_0x00c6('0x18')][_0x00c6('0x19')]||null:null,'limit':_0x103580[_0x00c6('0x18')]?_0x103580[_0x00c6('0x18')][_0x00c6('0x1a')]||null:null,'include':_0x103580[_0x00c6('0x18')]?_0x103580[_0x00c6('0x18')][_0x00c6('0x1c')]?_[_0x00c6('0x1b')](_0x103580[_0x00c6('0x18')][_0x00c6('0x1c')],function(_0x1c4152){return{'model':db[_0x1c4152[_0x00c6('0x1d')]],'as':_0x1c4152['as'],'attributes':_0x1c4152['as']==='Contact'?_['keys'](_0x4c3215):_0x1c4152[_0x00c6('0x19')],'include':_0x1c4152[_0x00c6('0x1c')]?_[_0x00c6('0x1b')](_0x1c4152[_0x00c6('0x1c')],function(_0x2af840){return{'model':db[_0x2af840[_0x00c6('0x1d')]],'as':_0x2af840['as'],'attributes':_0x2af840[_0x00c6('0x19')],'include':_0x2af840['include']?_[_0x00c6('0x1b')](_0x2af840['include'],function(_0x212164){return{'model':db[_0x212164[_0x00c6('0x1d')]],'as':_0x212164['as'],'attributes':_0x212164[_0x00c6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x00c6('0xa')](function(_0xe8156d){logger[_0x00c6('0xb')]('GetCmHopper',_0x103580);logger['debug'](_0x00c6('0x15'),_0x103580,JSON['stringify'](_0xe8156d));_0x4f517f(_0xe8156d);})['catch'](function(_0x2ae755){logger['error'](_0x00c6('0x15'),_0x2ae755[_0x00c6('0x13')],_0x103580);_0x5af613(_0x3f1151[_0x00c6('0x11')](0x1f4,_0x2ae755[_0x00c6('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 23c432e..e070d48 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 _0xb138=['../../components/auth/service','../../config/environment','./cmHopper.controller','get','index','isAuthenticated','describe','getOpenContacts','getTimezones','/:id','post','create','/preview','/timezone','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x46af7d,_0x1086cf){var _0x3e2d36=function(_0x1c4b3f){while(--_0x1c4b3f){_0x46af7d['push'](_0x46af7d['shift']());}};_0x3e2d36(++_0x1086cf);}(_0xb138,0x1dd));var _0x8b13=function(_0x362df6,_0xb1b625){_0x362df6=_0x362df6-0x0;var _0x4d26a5=_0xb138[_0x362df6];return _0x4d26a5;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var auth=require(_0x8b13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b13('0x7'));var controller=require(_0x8b13('0x8'));router[_0x8b13('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b13('0xa')]);router[_0x8b13('0x9')]('/describe',auth[_0x8b13('0xb')](),controller[_0x8b13('0xc')]);router[_0x8b13('0x9')]('/opencontacts',auth[_0x8b13('0xb')](),controller[_0x8b13('0xd')]);router['get']('/timezones',auth[_0x8b13('0xb')](),controller[_0x8b13('0xe')]);router[_0x8b13('0x9')](_0x8b13('0xf'),auth[_0x8b13('0xb')](),controller['show']);router[_0x8b13('0x10')]('/',auth[_0x8b13('0xb')](),controller[_0x8b13('0x11')]);router[_0x8b13('0x10')](_0x8b13('0x12'),auth[_0x8b13('0xb')](),controller['getPreview']);router['post'](_0x8b13('0x13'),auth[_0x8b13('0xb')](),controller['getTimezone']);router['put']('/:id',auth[_0x8b13('0xb')](),controller[_0x8b13('0x14')]);router[_0x8b13('0x15')](_0x8b13('0xf'),auth[_0x8b13('0xb')](),controller['destroy']);module[_0x8b13('0x16')]=router; \ No newline at end of file +var _0x207c=['/timezone','getTimezone','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','/describe','isAuthenticated','/opencontacts','/timezones','getTimezones','/:id','post','/preview','getPreview'];(function(_0x1c4abb,_0x44a6a9){var _0x491f5f=function(_0x39efc5){while(--_0x39efc5){_0x1c4abb['push'](_0x1c4abb['shift']());}};_0x491f5f(++_0x44a6a9);}(_0x207c,0x1e8));var _0xc207=function(_0x332ddf,_0x1ed1b5){_0x332ddf=_0x332ddf-0x0;var _0x4798a9=_0x207c[_0x332ddf];return _0x4798a9;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['describe']);router[_0xc207('0x8')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller['getOpenContacts']);router[_0xc207('0x8')](_0xc207('0xc'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0x8')](_0xc207('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc207('0xa')](),controller['create']);router[_0xc207('0xf')](_0xc207('0x10'),auth['isAuthenticated'](),controller[_0xc207('0x11')]);router[_0xc207('0xf')](_0xc207('0x12'),auth[_0xc207('0xa')](),controller[_0xc207('0x13')]);router['put'](_0xc207('0xe'),auth[_0xc207('0xa')](),controller[_0xc207('0x14')]);router[_0xc207('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc207('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 7a3efb8..9ff511b 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 _0x4728=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4728,0x1da));var _0x8472=function(_0x13a700,_0x88c174){_0x13a700=_0x13a700-0x0;var _0x3f0dc7=_0x4728[_0x13a700];return _0x3f0dc7;};'use strict';var moment=require(_0x8472('0x0'));var Sequelize=require(_0x8472('0x1'));module[_0x8472('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x8472('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8472('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8472('0x5')],'defaultValue':moment()[_0x8472('0x6')](_0x8472('0x7'))},'countbusyretry':{'type':Sequelize[_0x8472('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8472('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8472('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8472('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8472('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8472('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb9f9=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x51b8d7,_0x38c9ed){var _0x27f193=function(_0xe03f73){while(--_0xe03f73){_0x51b8d7['push'](_0x51b8d7['shift']());}};_0x27f193(++_0x38c9ed);}(_0xb9f9,0xe2));var _0x9b9f=function(_0x26b5a9,_0x2c1f6f){_0x26b5a9=_0x26b5a9-0x0;var _0x5dc833=_0xb9f9[_0x26b5a9];return _0x5dc833;};'use strict';var moment=require(_0x9b9f('0x0'));var Sequelize=require(_0x9b9f('0x1'));module[_0x9b9f('0x2')]={'CmHopperId':{'type':Sequelize[_0x9b9f('0x3')]},'phone':{'type':Sequelize[_0x9b9f('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9b9f('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9b9f('0x5')],'defaultValue':moment()[_0x9b9f('0x6')](_0x9b9f('0x7'))},'countbusyretry':{'type':Sequelize[_0x9b9f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9b9f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9b9f('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9b9f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9b9f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9b9f('0x3')],'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 d2f7c95..ddb0814 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 _0x5fae=['apply','save','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','sendStatus','stack','send','index','map','type','key','name','query','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','keys','rawAttributes','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5fae,0x133));var _0xe5fa=function(_0x23fcca,_0x119570){_0x23fcca=_0x23fcca-0x0;var _0x3f12a5=_0x5fae[_0x23fcca];return _0x3f12a5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe5fa('0x0'));var rimraf=require(_0xe5fa('0x1'));var zipdir=require(_0xe5fa('0x2'));var jsonpatch=require(_0xe5fa('0x3'));var rp=require('request-promise');var moment=require(_0xe5fa('0x4'));var BPromise=require(_0xe5fa('0x5'));var Mustache=require(_0xe5fa('0x6'));var util=require(_0xe5fa('0x7'));var path=require(_0xe5fa('0x8'));var sox=require(_0xe5fa('0x9'));var csv=require(_0xe5fa('0xa'));var ejs=require(_0xe5fa('0xb'));var fs=require('fs');var _=require(_0xe5fa('0xc'));var squel=require(_0xe5fa('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe5fa('0xe'));var toCsv=require(_0xe5fa('0xa'));var querystring=require(_0xe5fa('0xf'));var Papa=require(_0xe5fa('0x10'));var Redis=require(_0xe5fa('0x11'));var authService=require(_0xe5fa('0x12'));var qs=require(_0xe5fa('0x13'));var as=require(_0xe5fa('0x14'));var hardwareService=require(_0xe5fa('0x15'));var logger=require(_0xe5fa('0x16'))('api');var utils=require(_0xe5fa('0x17'));var config=require(_0xe5fa('0x18'));var db=require(_0xe5fa('0x19'))['db'];function respondWithStatusCode(_0x4af37b,_0xe5a82){_0xe5a82=_0xe5a82||0xcc;return function(_0x352995){if(_0x352995){return _0x4af37b['sendStatus'](_0xe5a82);}return _0x4af37b[_0xe5fa('0x1a')](_0xe5a82)[_0xe5fa('0x1b')]();};}function respondWithResult(_0x2728b6,_0x418659){_0x418659=_0x418659||0xc8;return function(_0x2a705b){if(_0x2a705b){return _0x2728b6[_0xe5fa('0x1a')](_0x418659)[_0xe5fa('0x1c')](_0x2a705b);}};}function respondWithFilteredResult(_0x4f5a96,_0x279ba6){return function(_0x1a209a){if(_0x1a209a){var _0x13df45=_0x1a209a[_0xe5fa('0x1d')],_0xc5b086=_0x279ba6['offset'],_0x55acde=_0x279ba6['offset']+_0x279ba6[_0xe5fa('0x1e')],_0x172ce5;if(_0x55acde>=_0x13df45){_0x55acde=_0x13df45;_0x172ce5=0xc8;}else{_0x172ce5=0xce;}_0x4f5a96[_0xe5fa('0x1a')](_0x172ce5);return _0x4f5a96[_0xe5fa('0x1f')](_0xe5fa('0x20'),_0xc5b086+'-'+_0x55acde+'/'+_0x13df45)['json'](_0x1a209a);}return null;};}function patchUpdates(_0x217cc4){return function(_0x5f2cb7){try{jsonpatch[_0xe5fa('0x21')](_0x5f2cb7,_0x217cc4,!![]);}catch(_0x970d9f){return BPromise['reject'](_0x970d9f);}return _0x5f2cb7[_0xe5fa('0x22')]();};}function saveUpdates(_0x34f544,_0x807365){return function(_0x5de921){if(_0x5de921){return _0x5de921['update'](_0x34f544)[_0xe5fa('0x23')](function(_0x3137fa){return _0x3137fa;});}return null;};}function removeEntity(_0x103f07,_0x11de5f){return function(_0xa37d29){if(_0xa37d29){return _0xa37d29['destroy']()[_0xe5fa('0x23')](function(){var _0x2958ef=_0xa37d29[_0xe5fa('0x24')]({'plain':!![]});var _0x3fc21d=_0xe5fa('0x25');return db[_0xe5fa('0x26')][_0xe5fa('0x27')]({'where':{'type':_0x3fc21d,'resourceId':_0x2958ef['id']}})[_0xe5fa('0x23')](function(){return _0xa37d29;});})[_0xe5fa('0x23')](function(){_0x103f07[_0xe5fa('0x1a')](0xcc)[_0xe5fa('0x1b')]();});}};}function handleEntityNotFound(_0x253e13,_0x2f48a7){return function(_0x13bf3b){if(!_0x13bf3b){_0x253e13[_0xe5fa('0x28')](0x194);}return _0x13bf3b;};}function handleError(_0x43add2,_0x1d3504){_0x1d3504=_0x1d3504||0x1f4;return function(_0xd6eb22){logger['error'](_0xd6eb22[_0xe5fa('0x29')]);if(_0xd6eb22['name']){delete _0xd6eb22['name'];}_0x43add2[_0xe5fa('0x1a')](_0x1d3504)[_0xe5fa('0x2a')](_0xd6eb22);};}exports[_0xe5fa('0x2b')]=function(_0x260652,_0x2db659){var _0x7fcf29={},_0x1bb41={},_0x45ce42={'count':0x0,'rows':[]};var _0x41f6f5=_[_0xe5fa('0x2c')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x89061e){return{'name':_0x89061e['fieldName'],'type':_0x89061e[_0xe5fa('0x2d')][_0xe5fa('0x2e')]};});_0x1bb41['model']=_[_0xe5fa('0x2c')](_0x41f6f5,_0xe5fa('0x2f'));_0x1bb41[_0xe5fa('0x30')]=_['keys'](_0x260652[_0xe5fa('0x30')]);_0x1bb41['filters']=_[_0xe5fa('0x31')](_0x1bb41[_0xe5fa('0x32')],_0x1bb41[_0xe5fa('0x30')]);_0x7fcf29[_0xe5fa('0x33')]=_[_0xe5fa('0x31')](_0x1bb41[_0xe5fa('0x32')],qs[_0xe5fa('0x34')](_0x260652['query'][_0xe5fa('0x34')]));_0x7fcf29[_0xe5fa('0x33')]=_0x7fcf29[_0xe5fa('0x33')][_0xe5fa('0x35')]?_0x7fcf29[_0xe5fa('0x33')]:_0x1bb41[_0xe5fa('0x32')];if(!_0x260652[_0xe5fa('0x30')]['hasOwnProperty'](_0xe5fa('0x36'))){_0x7fcf29[_0xe5fa('0x1e')]=qs[_0xe5fa('0x1e')](_0x260652['query'][_0xe5fa('0x1e')]);_0x7fcf29[_0xe5fa('0x37')]=qs[_0xe5fa('0x37')](_0x260652[_0xe5fa('0x30')][_0xe5fa('0x37')]);}_0x7fcf29[_0xe5fa('0x38')]=qs[_0xe5fa('0x39')](_0x260652['query']['sort']);_0x7fcf29[_0xe5fa('0x3a')]=qs['filters'](_[_0xe5fa('0x3b')](_0x260652[_0xe5fa('0x30')],_0x1bb41['filters']),_0x41f6f5);if(_0x260652[_0xe5fa('0x30')]['filter']){_0x7fcf29[_0xe5fa('0x3a')]=_[_0xe5fa('0x3c')](_0x7fcf29[_0xe5fa('0x3a')],{'$or':_[_0xe5fa('0x2c')](_0x41f6f5,function(_0x5d77fb){if(_0x5d77fb[_0xe5fa('0x2d')]!==_0xe5fa('0x3d')){var _0x5f70a6={};_0x5f70a6[_0x5d77fb[_0xe5fa('0x2f')]]={'$like':'%'+_0x260652[_0xe5fa('0x30')][_0xe5fa('0x3e')]+'%'};return _0x5f70a6;}})});}_0x7fcf29=_[_0xe5fa('0x3c')]({},_0x7fcf29,_0x260652[_0xe5fa('0x3f')]);var _0x37d5bb={'where':_0x7fcf29[_0xe5fa('0x3a')]};return db[_0xe5fa('0x40')]['count'](_0x37d5bb)[_0xe5fa('0x23')](function(_0x3cac43){_0x45ce42[_0xe5fa('0x1d')]=_0x3cac43;if(_0x260652['query'][_0xe5fa('0x41')]){_0x7fcf29[_0xe5fa('0x42')]=[{'all':!![]}];}return db[_0xe5fa('0x40')][_0xe5fa('0x43')](_0x7fcf29);})[_0xe5fa('0x23')](function(_0x1d6dc7){_0x45ce42[_0xe5fa('0x44')]=_0x1d6dc7;return _0x45ce42;})[_0xe5fa('0x23')](respondWithFilteredResult(_0x2db659,_0x7fcf29))[_0xe5fa('0x45')](handleError(_0x2db659,null));};exports['show']=function(_0x198a00,_0x23e71a){var _0x1199f6={'raw':!![],'where':{'id':_0x198a00['params']['id']}},_0xaa6e31={};_0xaa6e31['model']=_[_0xe5fa('0x46')](db[_0xe5fa('0x40')][_0xe5fa('0x47')]);_0xaa6e31[_0xe5fa('0x30')]=_['keys'](_0x198a00[_0xe5fa('0x30')]);_0xaa6e31[_0xe5fa('0x48')]=_['intersection'](_0xaa6e31[_0xe5fa('0x32')],_0xaa6e31[_0xe5fa('0x30')]);_0x1199f6[_0xe5fa('0x33')]=_[_0xe5fa('0x31')](_0xaa6e31[_0xe5fa('0x32')],qs['fields'](_0x198a00['query'][_0xe5fa('0x34')]));_0x1199f6[_0xe5fa('0x33')]=_0x1199f6['attributes'][_0xe5fa('0x35')]?_0x1199f6[_0xe5fa('0x33')]:_0xaa6e31[_0xe5fa('0x32')];if(_0x198a00['query']['includeAll']){_0x1199f6[_0xe5fa('0x42')]=[{'all':!![]}];}_0x1199f6=_['merge']({},_0x1199f6,_0x198a00['options']);return db['CmHopperAdditionalPhone'][_0xe5fa('0x49')](_0x1199f6)[_0xe5fa('0x23')](handleEntityNotFound(_0x23e71a,null))[_0xe5fa('0x23')](respondWithResult(_0x23e71a,null))[_0xe5fa('0x45')](handleError(_0x23e71a,null));};exports[_0xe5fa('0x4a')]=function(_0x3ac640,_0x648197){return db['CmHopperAdditionalPhone'][_0xe5fa('0x4a')](_0x3ac640[_0xe5fa('0x4b')],{})[_0xe5fa('0x23')](function(_0x199e6b){var _0x57ee9b=_0x3ac640[_0xe5fa('0x4c')]['get']({'plain':!![]});if(!_0x57ee9b)throw new Error(_0xe5fa('0x4d'));if(_0x57ee9b['role']===_0xe5fa('0x4c')){var _0x25bc4b=_0x199e6b['get']({'plain':!![]});var _0x640b94=_0xe5fa('0x25');return db[_0xe5fa('0x4e')][_0xe5fa('0x49')]({'where':{'name':_0x640b94,'userProfileId':_0x57ee9b[_0xe5fa('0x4f')]},'raw':!![]})[_0xe5fa('0x23')](function(_0x27847e){if(_0x27847e&&_0x27847e[_0xe5fa('0x50')]===0x0){return db[_0xe5fa('0x26')]['create']({'name':_0x25bc4b[_0xe5fa('0x2f')],'resourceId':_0x25bc4b['id'],'type':_0x27847e[_0xe5fa('0x2f')],'sectionId':_0x27847e['id']},{})[_0xe5fa('0x23')](function(){return _0x199e6b;});}else{return _0x199e6b;}})['catch'](function(_0x4f7567){logger[_0xe5fa('0x51')](_0xe5fa('0x52'),_0x4f7567);throw _0x4f7567;});}return _0x199e6b;})[_0xe5fa('0x23')](respondWithResult(_0x648197,0xc9))['catch'](handleError(_0x648197,null));};exports[_0xe5fa('0x53')]=function(_0x520001,_0x39ce63){if(_0x520001[_0xe5fa('0x4b')]['id']){delete _0x520001[_0xe5fa('0x4b')]['id'];}return db[_0xe5fa('0x40')][_0xe5fa('0x49')]({'where':{'id':_0x520001['params']['id']}})[_0xe5fa('0x23')](handleEntityNotFound(_0x39ce63,null))['then'](saveUpdates(_0x520001[_0xe5fa('0x4b')],null))[_0xe5fa('0x23')](respondWithResult(_0x39ce63,null))[_0xe5fa('0x45')](handleError(_0x39ce63,null));};exports[_0xe5fa('0x27')]=function(_0x24b554,_0x537a30){return db[_0xe5fa('0x40')][_0xe5fa('0x49')]({'where':{'id':_0x24b554[_0xe5fa('0x54')]['id']}})[_0xe5fa('0x23')](handleEntityNotFound(_0x537a30,null))[_0xe5fa('0x23')](removeEntity(_0x537a30,null))[_0xe5fa('0x45')](handleError(_0x537a30,null));}; \ No newline at end of file +var _0x13bc=['query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','apply','update','then','destroy','CmHopperAdditionalPhones','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x13bc,0xc6));var _0xc13b=function(_0x63637,_0x3a20b3){_0x63637=_0x63637-0x0;var _0x3e1fa3=_0x13bc[_0x63637];return _0x3e1fa3;};'use strict';var pdf=require(_0xc13b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc13b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc13b('0x2'));var rp=require(_0xc13b('0x3'));var moment=require(_0xc13b('0x4'));var BPromise=require(_0xc13b('0x5'));var Mustache=require(_0xc13b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc13b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc13b('0x8'));var crypto=require('crypto');var jsforce=require(_0xc13b('0x9'));var deskjs=require(_0xc13b('0xa'));var toCsv=require(_0xc13b('0xb'));var querystring=require(_0xc13b('0xc'));var Papa=require(_0xc13b('0xd'));var Redis=require(_0xc13b('0xe'));var authService=require(_0xc13b('0xf'));var qs=require(_0xc13b('0x10'));var as=require(_0xc13b('0x11'));var hardwareService=require(_0xc13b('0x12'));var logger=require(_0xc13b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc13b('0x14'));var db=require(_0xc13b('0x15'))['db'];function respondWithStatusCode(_0x29ddbd,_0x2a71b0){_0x2a71b0=_0x2a71b0||0xcc;return function(_0x912a2c){if(_0x912a2c){return _0x29ddbd[_0xc13b('0x16')](_0x2a71b0);}return _0x29ddbd['status'](_0x2a71b0)['end']();};}function respondWithResult(_0x423bb1,_0xdc42a7){_0xdc42a7=_0xdc42a7||0xc8;return function(_0x2db9af){if(_0x2db9af){return _0x423bb1[_0xc13b('0x17')](_0xdc42a7)[_0xc13b('0x18')](_0x2db9af);}};}function respondWithFilteredResult(_0x1f17c9,_0x2dcd4b){return function(_0x8aeb82){if(_0x8aeb82){var _0x30d625=_0x8aeb82['count'],_0x30b14a=_0x2dcd4b[_0xc13b('0x19')],_0xbd7647=_0x2dcd4b[_0xc13b('0x19')]+_0x2dcd4b['limit'],_0x4b4f43;if(_0xbd7647>=_0x30d625){_0xbd7647=_0x30d625;_0x4b4f43=0xc8;}else{_0x4b4f43=0xce;}_0x1f17c9[_0xc13b('0x17')](_0x4b4f43);return _0x1f17c9[_0xc13b('0x1a')]('Content-Range',_0x30b14a+'-'+_0xbd7647+'/'+_0x30d625)['json'](_0x8aeb82);}return null;};}function patchUpdates(_0x55b1aa){return function(_0x2d2eb4){try{jsonpatch[_0xc13b('0x1b')](_0x2d2eb4,_0x55b1aa,!![]);}catch(_0x443e86){return BPromise['reject'](_0x443e86);}return _0x2d2eb4['save']();};}function saveUpdates(_0x2b8976,_0x4ee951){return function(_0x1070a6){if(_0x1070a6){return _0x1070a6[_0xc13b('0x1c')](_0x2b8976)[_0xc13b('0x1d')](function(_0x3ab53e){return _0x3ab53e;});}return null;};}function removeEntity(_0xdf7fd5,_0x334d7a){return function(_0x5a1e33){if(_0x5a1e33){return _0x5a1e33[_0xc13b('0x1e')]()[_0xc13b('0x1d')](function(){var _0xf30a9d=_0x5a1e33['get']({'plain':!![]});var _0x35513e=_0xc13b('0x1f');return db['UserProfileResource'][_0xc13b('0x1e')]({'where':{'type':_0x35513e,'resourceId':_0xf30a9d['id']}})['then'](function(){return _0x5a1e33;});})[_0xc13b('0x1d')](function(){_0xdf7fd5[_0xc13b('0x17')](0xcc)[_0xc13b('0x20')]();});}};}function handleEntityNotFound(_0x520b42,_0x1006ad){return function(_0x2e4b01){if(!_0x2e4b01){_0x520b42['sendStatus'](0x194);}return _0x2e4b01;};}function handleError(_0x18c902,_0x16d71a){_0x16d71a=_0x16d71a||0x1f4;return function(_0x951943){logger[_0xc13b('0x21')](_0x951943[_0xc13b('0x22')]);if(_0x951943[_0xc13b('0x23')]){delete _0x951943['name'];}_0x18c902[_0xc13b('0x17')](_0x16d71a)[_0xc13b('0x24')](_0x951943);};}exports[_0xc13b('0x25')]=function(_0xc3d21f,_0x4b5236){var _0x49f27f={},_0x592750={},_0x328166={'count':0x0,'rows':[]};var _0x310aed=_[_0xc13b('0x26')](db[_0xc13b('0x27')][_0xc13b('0x28')],function(_0x261b20){return{'name':_0x261b20[_0xc13b('0x29')],'type':_0x261b20[_0xc13b('0x2a')][_0xc13b('0x2b')]};});_0x592750[_0xc13b('0x2c')]=_[_0xc13b('0x26')](_0x310aed,'name');_0x592750[_0xc13b('0x2d')]=_['keys'](_0xc3d21f[_0xc13b('0x2d')]);_0x592750[_0xc13b('0x2e')]=_[_0xc13b('0x2f')](_0x592750[_0xc13b('0x2c')],_0x592750[_0xc13b('0x2d')]);_0x49f27f[_0xc13b('0x30')]=_[_0xc13b('0x2f')](_0x592750[_0xc13b('0x2c')],qs[_0xc13b('0x31')](_0xc3d21f[_0xc13b('0x2d')][_0xc13b('0x31')]));_0x49f27f[_0xc13b('0x30')]=_0x49f27f[_0xc13b('0x30')][_0xc13b('0x32')]?_0x49f27f[_0xc13b('0x30')]:_0x592750[_0xc13b('0x2c')];if(!_0xc3d21f['query'][_0xc13b('0x33')]('nolimit')){_0x49f27f[_0xc13b('0x34')]=qs['limit'](_0xc3d21f[_0xc13b('0x2d')][_0xc13b('0x34')]);_0x49f27f[_0xc13b('0x19')]=qs[_0xc13b('0x19')](_0xc3d21f[_0xc13b('0x2d')][_0xc13b('0x19')]);}_0x49f27f[_0xc13b('0x35')]=qs[_0xc13b('0x36')](_0xc3d21f[_0xc13b('0x2d')][_0xc13b('0x36')]);_0x49f27f['where']=qs[_0xc13b('0x2e')](_[_0xc13b('0x37')](_0xc3d21f[_0xc13b('0x2d')],_0x592750[_0xc13b('0x2e')]),_0x310aed);if(_0xc3d21f['query'][_0xc13b('0x38')]){_0x49f27f[_0xc13b('0x39')]=_['merge'](_0x49f27f[_0xc13b('0x39')],{'$or':_[_0xc13b('0x26')](_0x310aed,function(_0x4e78dc){if(_0x4e78dc['type']!==_0xc13b('0x3a')){var _0x359c28={};_0x359c28[_0x4e78dc['name']]={'$like':'%'+_0xc3d21f['query'][_0xc13b('0x38')]+'%'};return _0x359c28;}})});}_0x49f27f=_[_0xc13b('0x3b')]({},_0x49f27f,_0xc3d21f[_0xc13b('0x3c')]);var _0x214c51={'where':_0x49f27f[_0xc13b('0x39')]};return db[_0xc13b('0x27')][_0xc13b('0x3d')](_0x214c51)[_0xc13b('0x1d')](function(_0x11fc8c){_0x328166[_0xc13b('0x3d')]=_0x11fc8c;if(_0xc3d21f['query']['includeAll']){_0x49f27f['include']=[{'all':!![]}];}return db[_0xc13b('0x27')][_0xc13b('0x3e')](_0x49f27f);})['then'](function(_0x1273c7){_0x328166[_0xc13b('0x3f')]=_0x1273c7;return _0x328166;})['then'](respondWithFilteredResult(_0x4b5236,_0x49f27f))[_0xc13b('0x40')](handleError(_0x4b5236,null));};exports[_0xc13b('0x41')]=function(_0x63f289,_0x19b19b){var _0x4f412f={'raw':!![],'where':{'id':_0x63f289[_0xc13b('0x42')]['id']}},_0x1c8b0f={};_0x1c8b0f['model']=_[_0xc13b('0x43')](db[_0xc13b('0x27')]['rawAttributes']);_0x1c8b0f[_0xc13b('0x2d')]=_['keys'](_0x63f289[_0xc13b('0x2d')]);_0x1c8b0f[_0xc13b('0x2e')]=_[_0xc13b('0x2f')](_0x1c8b0f[_0xc13b('0x2c')],_0x1c8b0f[_0xc13b('0x2d')]);_0x4f412f[_0xc13b('0x30')]=_[_0xc13b('0x2f')](_0x1c8b0f[_0xc13b('0x2c')],qs['fields'](_0x63f289['query'][_0xc13b('0x31')]));_0x4f412f[_0xc13b('0x30')]=_0x4f412f['attributes'][_0xc13b('0x32')]?_0x4f412f[_0xc13b('0x30')]:_0x1c8b0f[_0xc13b('0x2c')];if(_0x63f289[_0xc13b('0x2d')][_0xc13b('0x44')]){_0x4f412f[_0xc13b('0x45')]=[{'all':!![]}];}_0x4f412f=_[_0xc13b('0x3b')]({},_0x4f412f,_0x63f289[_0xc13b('0x3c')]);return db[_0xc13b('0x27')][_0xc13b('0x46')](_0x4f412f)[_0xc13b('0x1d')](handleEntityNotFound(_0x19b19b,null))[_0xc13b('0x1d')](respondWithResult(_0x19b19b,null))[_0xc13b('0x40')](handleError(_0x19b19b,null));};exports[_0xc13b('0x47')]=function(_0x5c94dd,_0x54a0c5){return db['CmHopperAdditionalPhone'][_0xc13b('0x47')](_0x5c94dd[_0xc13b('0x48')],{})[_0xc13b('0x1d')](function(_0x32df98){var _0x32b2a5=_0x5c94dd[_0xc13b('0x49')]['get']({'plain':!![]});if(!_0x32b2a5)throw new Error(_0xc13b('0x4a'));if(_0x32b2a5[_0xc13b('0x4b')]===_0xc13b('0x49')){var _0x19e815=_0x32df98[_0xc13b('0x4c')]({'plain':!![]});var _0x54f667=_0xc13b('0x1f');return db[_0xc13b('0x4d')][_0xc13b('0x46')]({'where':{'name':_0x54f667,'userProfileId':_0x32b2a5[_0xc13b('0x4e')]},'raw':!![]})[_0xc13b('0x1d')](function(_0x2486be){if(_0x2486be&&_0x2486be['autoAssociation']===0x0){return db[_0xc13b('0x4f')][_0xc13b('0x47')]({'name':_0x19e815[_0xc13b('0x23')],'resourceId':_0x19e815['id'],'type':_0x2486be[_0xc13b('0x23')],'sectionId':_0x2486be['id']},{})[_0xc13b('0x1d')](function(){return _0x32df98;});}else{return _0x32df98;}})[_0xc13b('0x40')](function(_0x13fedf){logger['error'](_0xc13b('0x50'),_0x13fedf);throw _0x13fedf;});}return _0x32df98;})['then'](respondWithResult(_0x54a0c5,0xc9))[_0xc13b('0x40')](handleError(_0x54a0c5,null));};exports[_0xc13b('0x1c')]=function(_0x557a3d,_0x3c0dd6){if(_0x557a3d[_0xc13b('0x48')]['id']){delete _0x557a3d[_0xc13b('0x48')]['id'];}return db[_0xc13b('0x27')]['find']({'where':{'id':_0x557a3d['params']['id']}})[_0xc13b('0x1d')](handleEntityNotFound(_0x3c0dd6,null))[_0xc13b('0x1d')](saveUpdates(_0x557a3d[_0xc13b('0x48')],null))['then'](respondWithResult(_0x3c0dd6,null))['catch'](handleError(_0x3c0dd6,null));};exports[_0xc13b('0x1e')]=function(_0x55398e,_0x54fef4){return db[_0xc13b('0x27')][_0xc13b('0x46')]({'where':{'id':_0x55398e[_0xc13b('0x42')]['id']}})[_0xc13b('0x1d')](handleEntityNotFound(_0x54fef4,null))[_0xc13b('0x1d')](removeEntity(_0x54fef4,null))['catch'](handleError(_0x54fef4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f981474..8dd634f 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 _0xda14=['exports','define','CmHopperAdditionalPhone','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x308a1d,_0x3d379d){var _0x5eb875=function(_0x464dbe){while(--_0x464dbe){_0x308a1d['push'](_0x308a1d['shift']());}};_0x5eb875(++_0x3d379d);}(_0xda14,0x175));var _0x4da1=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xda14[_0x53abe5];return _0xc1c37e;};'use strict';var _=require(_0x4da1('0x0'));var util=require('util');var logger=require(_0x4da1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4da1('0x2'));var rp=require(_0x4da1('0x3'));var fs=require('fs');var path=require(_0x4da1('0x4'));var rimraf=require('rimraf');var config=require(_0x4da1('0x5'));var attributes=require(_0x4da1('0x6'));module[_0x4da1('0x7')]=function(_0x206d52,_0x3af329){return _0x206d52[_0x4da1('0x8')](_0x4da1('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a17=['path','rimraf','exports','CmHopperAdditionalPhone','util','../../config/logger','api','moment','bluebird'];(function(_0x4d1974,_0x49182b){var _0x135df5=function(_0x28f1ec){while(--_0x28f1ec){_0x4d1974['push'](_0x4d1974['shift']());}};_0x135df5(++_0x49182b);}(_0x2a17,0x1cf));var _0x72a1=function(_0xf362b8,_0x3e756b){_0xf362b8=_0xf362b8-0x0;var _0x13da7e=_0x2a17[_0xf362b8];return _0x13da7e;};'use strict';var _=require('lodash');var util=require(_0x72a1('0x0'));var logger=require(_0x72a1('0x1'))(_0x72a1('0x2'));var moment=require(_0x72a1('0x3'));var BPromise=require(_0x72a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72a1('0x5'));var rimraf=require(_0x72a1('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x72a1('0x7')]=function(_0x419cd7,_0x5eb12b){return _0x419cd7['define'](_0x72a1('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index fc82018..7571814 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 _0x86e9=['body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','SwapAdditionalPhones','ContactId','ListId','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','countmachineretry','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper'];(function(_0x2064e7,_0x2ad936){var _0x10fe89=function(_0x3174d8){while(--_0x3174d8){_0x2064e7['push'](_0x2064e7['shift']());}};_0x10fe89(++_0x2ad936);}(_0x86e9,0x1ba));var _0x986e=function(_0x593467,_0x14e615){_0x593467=_0x593467-0x0;var _0x67a71b=_0x86e9[_0x593467];return _0x67a71b;};'use strict';var _=require(_0x986e('0x0'));var util=require(_0x986e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x986e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x986e('0x3'))['db'];var utils=require(_0x986e('0x4'));var logger=require(_0x986e('0x5'))('rpc');var config=require(_0x986e('0x6'));var jayson=require(_0x986e('0x7'));var client=jayson[_0x986e('0x8')][_0x986e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a8f1,_0x5309aa,_0x3e92c9){return new BPromise(function(_0x3334d1,_0x25ddca){return client['request'](_0x29a8f1,_0x3e92c9)[_0x986e('0xa')](function(_0x51a490){logger[_0x986e('0xb')](_0x986e('0xc'),_0x5309aa,_0x986e('0xd'));logger[_0x986e('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x5309aa,'request\x20sent',JSON[_0x986e('0xf')](_0x51a490));if(_0x51a490[_0x986e('0x10')]){if(_0x51a490[_0x986e('0x10')][_0x986e('0x11')]===0x1f4){logger[_0x986e('0x10')](_0x986e('0xc'),_0x5309aa,_0x51a490['error'][_0x986e('0x12')]);return _0x25ddca(_0x51a490['error']['message']);}logger[_0x986e('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5309aa,_0x51a490[_0x986e('0x10')][_0x986e('0x12')]);return _0x3334d1(_0x51a490[_0x986e('0x10')][_0x986e('0x12')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5309aa,_0x986e('0xd'));_0x3334d1(_0x51a490['result'][_0x986e('0x12')]);}})[_0x986e('0x13')](function(_0x4a3e15){logger[_0x986e('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5309aa,_0x4a3e15);_0x25ddca(_0x4a3e15);});});}exports[_0x986e('0x14')]=function(_0x102cb3){var _0x4bb835=this;return new Promise(function(_0x3c2482,_0x2c64bd){return db[_0x986e('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x102cb3[_0x986e('0x16')]['ContactId'],'ListId':_0x102cb3[_0x986e('0x16')]['ListId'],'VoiceQueueId':_0x102cb3['body'][_0x986e('0x17')]===undefined?null:_0x102cb3[_0x986e('0x16')]['VoiceQueueId'],'CampaignId':_0x102cb3['body']['CampaignId']===undefined?null:_0x102cb3['body'][_0x986e('0x18')]}})['then'](function(_0x9286ab){if(_0x9286ab!=null){return db[_0x986e('0x19')][_0x986e('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x9286ab['id'],'OrderBy':{'$gt':_0x9286ab[_0x986e('0x1b')]}},'order':[[_0x986e('0x1b'),_0x986e('0x1c')]]})[_0x986e('0xa')](function(_0x2ba64d){var _0x52ffef=0x0;if(_0x2ba64d){if(_0x2ba64d[_0x986e('0x1d')]+_0x2ba64d[_0x986e('0x1e')]+_0x2ba64d['countnoanswerretry']+_0x2ba64d[_0x986e('0x1f')]+_0x2ba64d[_0x986e('0x20')]+_0x2ba64d[_0x986e('0x21')]+_0x2ba64d['countmachineretry']+_0x2ba64d[_0x986e('0x22')]<_0x102cb3[_0x986e('0x23')][_0x986e('0x24')])_0x52ffef=0x1;_0x3c2482({'additional':_0x52ffef});}else{return db[_0x986e('0x19')][_0x986e('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x9286ab['id']},'order':[[_0x986e('0x1b'),_0x986e('0x1c')]]})[_0x986e('0xa')](function(_0x144324){var _0xdc81c2=0x0;if(_0x144324){if(_0x144324['countbusyretry']+_0x144324['countcongestionretry']+_0x144324[_0x986e('0x25')]+_0x144324['countnosuchnumberretry']+_0x144324['countdropretry']+_0x144324[_0x986e('0x21')]+_0x144324['countmachineretry']+_0x144324[_0x986e('0x22')]<_0x102cb3[_0x986e('0x23')]['dialGlobalMaxRetry'])_0xdc81c2=0x1;_0x3c2482({'additional':_0xdc81c2});}else{_0x3c2482({'additional':0x0});}})[_0x986e('0x13')](function(_0x11d798){logger[_0x986e('0x10')](_0x986e('0x14'),_0x11d798[_0x986e('0x12')],_0x102cb3);_0x2c64bd(_0x4bb835[_0x986e('0x10')](0x1f4,_0x11d798[_0x986e('0x12')]));});}})[_0x986e('0x13')](function(_0x575e4f){logger[_0x986e('0x10')](_0x986e('0x14'),_0x575e4f[_0x986e('0x12')],_0x102cb3);_0x2c64bd(_0x4bb835[_0x986e('0x10')](0x1f4,_0x575e4f[_0x986e('0x12')]));});}else _0x3c2482({'additional':0x0});});});};exports[_0x986e('0x26')]=function(_0x1164c6){var _0x2b8312=this;return new Promise(function(_0x59494a,_0x1002c9){return db[_0x986e('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x1164c6[_0x986e('0x16')][_0x986e('0x27')],'ListId':_0x1164c6[_0x986e('0x16')][_0x986e('0x28')],'VoiceQueueId':_0x1164c6[_0x986e('0x16')]['VoiceQueueId']===undefined?null:_0x1164c6[_0x986e('0x16')][_0x986e('0x17')],'CampaignId':_0x1164c6[_0x986e('0x16')][_0x986e('0x18')]===undefined?null:_0x1164c6[_0x986e('0x16')][_0x986e('0x18')]}})[_0x986e('0xa')](function(_0x1db782){if(_0x1db782!=null){return db[_0x986e('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1db782['id'],'OrderBy':{'$gt':_0x1db782['OrderBy']}},'order':[[_0x986e('0x1b'),_0x986e('0x1c')]]})[_0x986e('0xa')](function(_0x329579){if(_0x329579)return activateAdditionalPhone(_0x1db782,_0x1164c6[_0x986e('0x16')],_0x329579,_0x1164c6[_0x986e('0x29')],_0x1164c6[_0x986e('0x2a')])[_0x986e('0xa')](function(_0x36ac94){_0x59494a(_0x36ac94);});else{return db[_0x986e('0x19')][_0x986e('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x1db782['id']},'order':[[_0x986e('0x1b'),_0x986e('0x1c')]]})['then'](function(_0x1fe59f){if(_0x1fe59f)return activateAdditionalPhone(_0x1db782,_0x1164c6[_0x986e('0x16')],_0x1fe59f,_0x1164c6[_0x986e('0x29')],_0x1164c6['waitTime'])[_0x986e('0xa')](function(_0x5b4fe9){_0x59494a(_0x5b4fe9);});else{_0x59494a({'id':_0x1db782['id'],'phone':''});}})[_0x986e('0x13')](function(_0x58b12a){logger[_0x986e('0x10')](_0x986e('0x14'),_0x58b12a[_0x986e('0x12')],_0x1164c6);_0x1002c9(_0x2b8312[_0x986e('0x10')](0x1f4,_0x58b12a[_0x986e('0x12')]));});}})['catch'](function(_0x497033){logger['error'](_0x986e('0x14'),_0x497033[_0x986e('0x12')],_0x1164c6);_0x1002c9(_0x2b8312[_0x986e('0x10')](0x1f4,_0x497033['message']));});}else _0x59494a(0x1);});});};function activateAdditionalPhone(_0x1379ef,_0x29dadb,_0x44a7d5,_0x2d30c0,_0x1736d9){return new Promise(function(_0xd6153d,_0x36c5b8){logger['info'](_0x986e('0x14'),_0x44a7d5);var _0x16145a;if(moment()>moment(_0x44a7d5[_0x986e('0x2b')])){_0x16145a=moment()[_0x986e('0x2c')](_0x1736d9||0x3,_0x986e('0x2d'));}else{if(_0x44a7d5[_0x986e('0x1b')]==0x0){_0x16145a=moment(_0x44a7d5['scheduledat']);}else{_0x16145a=moment()[_0x986e('0x2c')](_0x1736d9||0x3,_0x986e('0x2d'));}}var _0x3a5938={'phone':_0x1379ef[_0x986e('0x2e')],'active':0x0,'OrderBy':_[_0x986e('0x2f')](_0x1379ef[_0x986e('0x1b')])?0x0:_0x1379ef[_0x986e('0x1b')],'scheduledat':moment()[_0x986e('0x2c')](_0x2d30c0||0x1,_0x986e('0x2d')),'countbusyretry':_0x29dadb['countbusyretry'],'countcongestionretry':_0x29dadb[_0x986e('0x1e')],'countnoanswerretry':_0x29dadb[_0x986e('0x25')],'countnosuchnumberretry':_0x29dadb[_0x986e('0x1f')],'countdropretry':_0x29dadb[_0x986e('0x20')],'countabandonedretry':_0x29dadb[_0x986e('0x21')],'countmachineretry':_0x29dadb['countmachineretry'],'countagentrejectretry':_0x29dadb['countagentrejectretry'],'createdAt':_0x29dadb[_0x986e('0x30')],'updatedAt':_0x29dadb[_0x986e('0x31')]};var _0x56aba3={'CmHopperId':_0x1379ef['id'],'phone':_0x44a7d5[_0x986e('0x2e')],'active':0x0,'OrderBy':_[_0x986e('0x2f')](_0x44a7d5[_0x986e('0x1b')])?0x0:_0x44a7d5[_0x986e('0x1b')],'scheduledat':_0x16145a,'countbusyretry':_0x44a7d5[_0x986e('0x1d')],'countcongestionretry':_0x44a7d5[_0x986e('0x1e')],'countnoanswerretry':_0x44a7d5[_0x986e('0x25')],'countnosuchnumberretry':_0x29dadb[_0x986e('0x1f')],'countdropretry':_0x29dadb[_0x986e('0x20')],'countabandonedretry':_0x29dadb['countabandonedretry'],'countmachineretry':_0x29dadb[_0x986e('0x32')],'countagentrejectretry':_0x29dadb['countagentrejectretry'],'createdAt':_0x44a7d5[_0x986e('0x30')],'updatedAt':_0x44a7d5['updatedAt']};logger['info'](_0x986e('0x33'),_0x3a5938);logger['info'](_0x986e('0x34'),_0x56aba3);return db[_0x986e('0x35')][_0x986e('0x36')](function(_0x5b5f8e){return db[_0x986e('0x19')][_0x986e('0x37')](_0x3a5938,{'where':{'id':_0x44a7d5['id']}},{'transaction':_0x5b5f8e})['then'](function(){return db[_0x986e('0x15')][_0x986e('0x37')](_0x56aba3,{'where':{'id':_0x1379ef['id']}},{'transaction':_0x5b5f8e});});})[_0x986e('0xa')](function(_0x5d6bec){_0xd6153d({'id':_0x1379ef['id'],'phone':_0x44a7d5[_0x986e('0x2e')]});})['catch'](function(_0x324352){logger['error'](_0x986e('0x14'),_0x324352['message'],req);_0x36c5b8(_this[_0x986e('0x10')](0x1f4,_0x324352[_0x986e('0x12')]));});});}exports[_0x986e('0x38')]=function(_0x3df19c){var _0x555d15=this;return new Promise(function(_0x24d123,_0x3539fa){return db[_0x986e('0x15')][_0x986e('0x37')](_0x3df19c[_0x986e('0x16')][_0x986e('0x39')],{'where':{'id':_0x3df19c[_0x986e('0x16')]['id']}})[_0x986e('0xa')](function(_0x47d8bb){_0x24d123(_0x47d8bb);})['catch'](function(_0x523317){logger[_0x986e('0x10')](_0x986e('0x38'),_0x523317[_0x986e('0x12')],_0x3df19c);_0x3539fa(_0x555d15[_0x986e('0x10')](0x1f4,_0x523317['message']));});});}; \ No newline at end of file +var _0xe27a=['IncrementPreviewCounters','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countabandonedretry','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','minutes','add','phone','createdAt','updatedAt','isNil','hopperToAdd','additionalToHop','sequelize','transaction','update'];(function(_0x291589,_0x394acd){var _0x304d5d=function(_0x12e247){while(--_0x12e247){_0x291589['push'](_0x291589['shift']());}};_0x304d5d(++_0x394acd);}(_0xe27a,0x6f));var _0xae27=function(_0x41aeac,_0x5312d4){_0x41aeac=_0x41aeac-0x0;var _0x1b9133=_0xe27a[_0x41aeac];return _0x1b9133;};'use strict';var _=require(_0xae27('0x0'));var util=require(_0xae27('0x1'));var moment=require(_0xae27('0x2'));var BPromise=require(_0xae27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae27('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae27('0x5'));var logger=require(_0xae27('0x6'))(_0xae27('0x7'));var config=require(_0xae27('0x8'));var jayson=require(_0xae27('0x9'));var client=jayson['client'][_0xae27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50f7a2,_0x1c57d5,_0x1105c6){return new BPromise(function(_0x201a18,_0x513dae){return client['request'](_0x50f7a2,_0x1105c6)[_0xae27('0xb')](function(_0x44dfc5){logger[_0xae27('0xc')](_0xae27('0xd'),_0x1c57d5,_0xae27('0xe'));logger['debug'](_0xae27('0xf'),_0x1c57d5,_0xae27('0xe'),JSON['stringify'](_0x44dfc5));if(_0x44dfc5['error']){if(_0x44dfc5['error']['code']===0x1f4){logger['error'](_0xae27('0xd'),_0x1c57d5,_0x44dfc5[_0xae27('0x10')][_0xae27('0x11')]);return _0x513dae(_0x44dfc5[_0xae27('0x10')][_0xae27('0x11')]);}logger['error'](_0xae27('0xd'),_0x1c57d5,_0x44dfc5[_0xae27('0x10')][_0xae27('0x11')]);return _0x201a18(_0x44dfc5[_0xae27('0x10')][_0xae27('0x11')]);}else{logger['info'](_0xae27('0xd'),_0x1c57d5,_0xae27('0xe'));_0x201a18(_0x44dfc5['result']['message']);}})[_0xae27('0x12')](function(_0xa654f8){logger[_0xae27('0x10')](_0xae27('0xd'),_0x1c57d5,_0xa654f8);_0x513dae(_0xa654f8);});});}exports[_0xae27('0x13')]=function(_0x528bf7){var _0x3bd6ae=this;return new Promise(function(_0x249074,_0x2810e4){return db[_0xae27('0x14')][_0xae27('0x15')]({'raw':!![],'where':{'ContactId':_0x528bf7['body'][_0xae27('0x16')],'ListId':_0x528bf7[_0xae27('0x17')][_0xae27('0x18')],'VoiceQueueId':_0x528bf7[_0xae27('0x17')]['VoiceQueueId']===undefined?null:_0x528bf7['body']['VoiceQueueId'],'CampaignId':_0x528bf7[_0xae27('0x17')][_0xae27('0x19')]===undefined?null:_0x528bf7[_0xae27('0x17')][_0xae27('0x19')]}})[_0xae27('0xb')](function(_0x588777){if(_0x588777!=null){return db[_0xae27('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x588777['id'],'OrderBy':{'$gt':_0x588777[_0xae27('0x1b')]}},'order':[[_0xae27('0x1b'),_0xae27('0x1c')]]})[_0xae27('0xb')](function(_0x10c90b){var _0x350f3f=0x0;if(_0x10c90b){if(_0x10c90b[_0xae27('0x1d')]+_0x10c90b[_0xae27('0x1e')]+_0x10c90b[_0xae27('0x1f')]+_0x10c90b[_0xae27('0x20')]+_0x10c90b[_0xae27('0x21')]+_0x10c90b['countabandonedretry']+_0x10c90b[_0xae27('0x22')]+_0x10c90b[_0xae27('0x23')]<_0x528bf7[_0xae27('0x24')][_0xae27('0x25')])_0x350f3f=0x1;_0x249074({'additional':_0x350f3f});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x588777['id']},'order':[[_0xae27('0x1b'),'ASC']]})['then'](function(_0x8bd292){var _0x5dc62f=0x0;if(_0x8bd292){if(_0x8bd292[_0xae27('0x1d')]+_0x8bd292[_0xae27('0x1e')]+_0x8bd292[_0xae27('0x1f')]+_0x8bd292[_0xae27('0x20')]+_0x8bd292['countdropretry']+_0x8bd292[_0xae27('0x26')]+_0x8bd292[_0xae27('0x22')]+_0x8bd292[_0xae27('0x23')]<_0x528bf7[_0xae27('0x24')][_0xae27('0x25')])_0x5dc62f=0x1;_0x249074({'additional':_0x5dc62f});}else{_0x249074({'additional':0x0});}})[_0xae27('0x12')](function(_0x161882){logger[_0xae27('0x10')](_0xae27('0x13'),_0x161882[_0xae27('0x11')],_0x528bf7);_0x2810e4(_0x3bd6ae[_0xae27('0x10')](0x1f4,_0x161882[_0xae27('0x11')]));});}})['catch'](function(_0x15c1dd){logger[_0xae27('0x10')](_0xae27('0x13'),_0x15c1dd[_0xae27('0x11')],_0x528bf7);_0x2810e4(_0x3bd6ae[_0xae27('0x10')](0x1f4,_0x15c1dd[_0xae27('0x11')]));});}else _0x249074({'additional':0x0});});});};exports[_0xae27('0x27')]=function(_0x707b7a){var _0x5b6086=this;return new Promise(function(_0x2c7ff6,_0x20eba9){return db['CmHopper'][_0xae27('0x15')]({'raw':!![],'where':{'ContactId':_0x707b7a[_0xae27('0x17')][_0xae27('0x16')],'ListId':_0x707b7a[_0xae27('0x17')][_0xae27('0x18')],'VoiceQueueId':_0x707b7a[_0xae27('0x17')][_0xae27('0x28')]===undefined?null:_0x707b7a[_0xae27('0x17')][_0xae27('0x28')],'CampaignId':_0x707b7a['body'][_0xae27('0x19')]===undefined?null:_0x707b7a[_0xae27('0x17')][_0xae27('0x19')]}})[_0xae27('0xb')](function(_0x238d88){if(_0x238d88!=null){return db[_0xae27('0x1a')][_0xae27('0x15')]({'raw':!![],'where':{'CmHopperId':_0x238d88['id'],'OrderBy':{'$gt':_0x238d88[_0xae27('0x1b')]}},'order':[[_0xae27('0x1b'),'ASC']]})['then'](function(_0x22d015){if(_0x22d015)return activateAdditionalPhone(_0x238d88,_0x707b7a[_0xae27('0x17')],_0x22d015,_0x707b7a[_0xae27('0x29')],_0x707b7a[_0xae27('0x2a')])[_0xae27('0xb')](function(_0x1edc3f){_0x2c7ff6(_0x1edc3f);});else{return db[_0xae27('0x1a')][_0xae27('0x15')]({'raw':!![],'where':{'CmHopperId':_0x238d88['id']},'order':[[_0xae27('0x1b'),'ASC']]})[_0xae27('0xb')](function(_0x3c5ca2){if(_0x3c5ca2)return activateAdditionalPhone(_0x238d88,_0x707b7a['body'],_0x3c5ca2,_0x707b7a[_0xae27('0x29')],_0x707b7a[_0xae27('0x2a')])[_0xae27('0xb')](function(_0x490495){_0x2c7ff6(_0x490495);});else{_0x2c7ff6({'id':_0x238d88['id'],'phone':''});}})['catch'](function(_0x54d63c){logger[_0xae27('0x10')](_0xae27('0x13'),_0x54d63c[_0xae27('0x11')],_0x707b7a);_0x20eba9(_0x5b6086['error'](0x1f4,_0x54d63c['message']));});}})[_0xae27('0x12')](function(_0x49a061){logger[_0xae27('0x10')](_0xae27('0x13'),_0x49a061[_0xae27('0x11')],_0x707b7a);_0x20eba9(_0x5b6086[_0xae27('0x10')](0x1f4,_0x49a061['message']));});}else _0x2c7ff6(0x1);});});};function activateAdditionalPhone(_0x1d9859,_0x1e5c48,_0x1c4696,_0x502836,_0x1f4d63){return new Promise(function(_0x3677a1,_0x261bc2){logger[_0xae27('0xc')](_0xae27('0x13'),_0x1c4696);var _0xb5375;if(moment()>moment(_0x1c4696['scheduledat'])){_0xb5375=moment()['add'](_0x1f4d63||0x3,_0xae27('0x2b'));}else{if(_0x1c4696[_0xae27('0x1b')]==0x0){_0xb5375=moment(_0x1c4696['scheduledat']);}else{_0xb5375=moment()[_0xae27('0x2c')](_0x1f4d63||0x3,'minutes');}}var _0x2dffc0={'phone':_0x1d9859[_0xae27('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x1d9859[_0xae27('0x1b')])?0x0:_0x1d9859[_0xae27('0x1b')],'scheduledat':moment()[_0xae27('0x2c')](_0x502836||0x1,_0xae27('0x2b')),'countbusyretry':_0x1e5c48['countbusyretry'],'countcongestionretry':_0x1e5c48[_0xae27('0x1e')],'countnoanswerretry':_0x1e5c48[_0xae27('0x1f')],'countnosuchnumberretry':_0x1e5c48[_0xae27('0x20')],'countdropretry':_0x1e5c48[_0xae27('0x21')],'countabandonedretry':_0x1e5c48['countabandonedretry'],'countmachineretry':_0x1e5c48[_0xae27('0x22')],'countagentrejectretry':_0x1e5c48['countagentrejectretry'],'createdAt':_0x1e5c48[_0xae27('0x2e')],'updatedAt':_0x1e5c48[_0xae27('0x2f')]};var _0x4f2105={'CmHopperId':_0x1d9859['id'],'phone':_0x1c4696[_0xae27('0x2d')],'active':0x0,'OrderBy':_[_0xae27('0x30')](_0x1c4696[_0xae27('0x1b')])?0x0:_0x1c4696[_0xae27('0x1b')],'scheduledat':_0xb5375,'countbusyretry':_0x1c4696['countbusyretry'],'countcongestionretry':_0x1c4696[_0xae27('0x1e')],'countnoanswerretry':_0x1c4696[_0xae27('0x1f')],'countnosuchnumberretry':_0x1e5c48[_0xae27('0x20')],'countdropretry':_0x1e5c48[_0xae27('0x21')],'countabandonedretry':_0x1e5c48['countabandonedretry'],'countmachineretry':_0x1e5c48[_0xae27('0x22')],'countagentrejectretry':_0x1e5c48[_0xae27('0x23')],'createdAt':_0x1c4696[_0xae27('0x2e')],'updatedAt':_0x1c4696['updatedAt']};logger[_0xae27('0xc')](_0xae27('0x31'),_0x2dffc0);logger['info'](_0xae27('0x32'),_0x4f2105);return db[_0xae27('0x33')][_0xae27('0x34')](function(_0x13afa1){return db[_0xae27('0x1a')][_0xae27('0x35')](_0x2dffc0,{'where':{'id':_0x1c4696['id']}},{'transaction':_0x13afa1})[_0xae27('0xb')](function(){return db['CmHopper'][_0xae27('0x35')](_0x4f2105,{'where':{'id':_0x1d9859['id']}},{'transaction':_0x13afa1});});})[_0xae27('0xb')](function(_0x2088ca){_0x3677a1({'id':_0x1d9859['id'],'phone':_0x1c4696[_0xae27('0x2d')]});})[_0xae27('0x12')](function(_0x5497b3){logger[_0xae27('0x10')](_0xae27('0x13'),_0x5497b3['message'],req);_0x261bc2(_this['error'](0x1f4,_0x5497b3[_0xae27('0x11')]));});});}exports[_0xae27('0x36')]=function(_0x122046){var _0x2043a9=this;return new Promise(function(_0x22e7b1,_0x28dc28){return db[_0xae27('0x14')][_0xae27('0x35')](_0x122046[_0xae27('0x17')]['field'],{'where':{'id':_0x122046[_0xae27('0x17')]['id']}})['then'](function(_0x554dc2){_0x22e7b1(_0x554dc2);})['catch'](function(_0x3ce0ea){logger['error'](_0xae27('0x36'),_0x3ce0ea[_0xae27('0x11')],_0x122046);_0x28dc28(_0x2043a9['error'](0x1f4,_0x3ce0ea[_0xae27('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4f4d131..ee277b9 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 _0xdb78=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','post','create','put','update'];(function(_0x1cf471,_0x5a5f4e){var _0x1adfe4=function(_0x2300bf){while(--_0x2300bf){_0x1cf471['push'](_0x1cf471['shift']());}};_0x1adfe4(++_0x5a5f4e);}(_0xdb78,0x87));var _0x8db7=function(_0x174eb7,_0x356847){_0x174eb7=_0x174eb7-0x0;var _0x21c489=_0xdb78[_0x174eb7];return _0x21c489;};'use strict';var multer=require(_0x8db7('0x0'));var util=require(_0x8db7('0x1'));var path=require(_0x8db7('0x2'));var timeout=require(_0x8db7('0x3'));var express=require(_0x8db7('0x4'));var router=express[_0x8db7('0x5')]();var auth=require(_0x8db7('0x6'));var interaction=require(_0x8db7('0x7'));var config=require(_0x8db7('0x8'));var controller=require(_0x8db7('0x9'));router[_0x8db7('0xa')]('/',auth[_0x8db7('0xb')](),controller['index']);router[_0x8db7('0xa')](_0x8db7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8db7('0xd')]('/',auth[_0x8db7('0xb')](),controller[_0x8db7('0xe')]);router[_0x8db7('0xf')](_0x8db7('0xc'),auth[_0x8db7('0xb')](),controller[_0x8db7('0x10')]);router[_0x8db7('0x11')](_0x8db7('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8db7('0x12')]=router; \ No newline at end of file +var _0x025e=['/:id','post','create','put','update','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x025e,0x116));var _0xe025=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x025e[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0xe025('0x0'));var util=require('util');var path=require(_0xe025('0x1'));var timeout=require(_0xe025('0x2'));var express=require('express');var router=express[_0xe025('0x3')]();var auth=require(_0xe025('0x4'));var interaction=require(_0xe025('0x5'));var config=require(_0xe025('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xe025('0x7')]('/',auth[_0xe025('0x8')](),controller[_0xe025('0x9')]);router[_0xe025('0x7')](_0xe025('0xa'),auth[_0xe025('0x8')](),controller['show']);router[_0xe025('0xb')]('/',auth[_0xe025('0x8')](),controller[_0xe025('0xc')]);router[_0xe025('0xd')](_0xe025('0xa'),auth[_0xe025('0x8')](),controller[_0xe025('0xe')]);router['delete']('/:id',auth[_0xe025('0x8')](),controller[_0xe025('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d56f1f3..373dfb5 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 _0x8cbb=['exports','INTEGER','contactListQueue'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x8cbb,0x12c));var _0xb8cb=function(_0x1d7ef5,_0x38cb8a){_0x1d7ef5=_0x1d7ef5-0x0;var _0xd108dd=_0x8cbb[_0x1d7ef5];return _0xd108dd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb8cb('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb8cb('0x1')],'unique':_0xb8cb('0x2')},'ListId':{'type':Sequelize[_0xb8cb('0x1')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xb8cb('0x1')],'unique':_0xb8cb('0x2')}}; \ No newline at end of file +var _0xbf74=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x5262e8,_0x458199){var _0x4426b5=function(_0x32d969){while(--_0x32d969){_0x5262e8['push'](_0x5262e8['shift']());}};_0x4426b5(++_0x458199);}(_0xbf74,0x10f));var _0x4bf7=function(_0x15740a,_0x511855){_0x15740a=_0x15740a-0x0;var _0x1938d6=_0xbf74[_0x15740a];return _0x1938d6;};'use strict';var moment=require(_0x4bf7('0x0'));var Sequelize=require(_0x4bf7('0x1'));module[_0x4bf7('0x2')]={'phone':{'type':Sequelize[_0x4bf7('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4bf7('0x4')],'unique':_0x4bf7('0x5')},'ListId':{'type':Sequelize[_0x4bf7('0x4')],'unique':_0x4bf7('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8c957b7..925e9db 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(_0x20cff5,_0xae5c9a){var _0x58365c=function(_0x4feb9d){while(--_0x4feb9d){_0x20cff5['push'](_0x20cff5['shift']());}};_0x58365c(++_0xae5c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x3d5f2e,_0x338d17){var _0xd65dfc=function(_0xd87221){while(--_0xd87221){_0x3d5f2e['push'](_0x3d5f2e['shift']());}};_0xd65dfc(++_0x338d17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 12d1157..afd5b54 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird'];(function(_0x78d3d2,_0x6ecf4f){var _0x1110cd=function(_0x3dd33f){while(--_0x3dd33f){_0x78d3d2['push'](_0x78d3d2['shift']());}};_0x1110cd(++_0x6ecf4f);}(_0xe706,0xa3));var _0x6e70=function(_0x255093,_0x4fe4fa){_0x255093=_0x255093-0x0;var _0x440166=_0xe706[_0x255093];return _0x440166;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./cmHopperBlack.attributes','exports','define','cm_hopper_black','../../config/logger','api','moment','bluebird','path'];(function(_0x8739fe,_0x41cd63){var _0x506854=function(_0x293eb7){while(--_0x293eb7){_0x8739fe['push'](_0x8739fe['shift']());}};_0x506854(++_0x41cd63);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xcb91[_0x45313f];return _0x402910;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('CmHopperBlack',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 4d72c68..1b1f771 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 _0xd1e9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','GetCmHopperBlack','catch','update','body','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xd1e9,0x175));var _0x9d1e=function(_0x23b890,_0x5c3b81){_0x23b890=_0x23b890-0x0;var _0x3394b5=_0xd1e9[_0x23b890];return _0x3394b5;};'use strict';var _=require(_0x9d1e('0x0'));var util=require(_0x9d1e('0x1'));var moment=require('moment');var BPromise=require(_0x9d1e('0x2'));var rs=require(_0x9d1e('0x3'));var fs=require('fs');var Redis=require(_0x9d1e('0x4'));var db=require(_0x9d1e('0x5'))['db'];var utils=require(_0x9d1e('0x6'));var logger=require(_0x9d1e('0x7'))(_0x9d1e('0x8'));var config=require(_0x9d1e('0x9'));var jayson=require(_0x9d1e('0xa'));var client=jayson[_0x9d1e('0xb')][_0x9d1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x391f87,_0x2667cd,_0x1f5b33){return new BPromise(function(_0x20e187,_0x5981ad){return client[_0x9d1e('0xd')](_0x391f87,_0x1f5b33)[_0x9d1e('0xe')](function(_0x198720){logger[_0x9d1e('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x2667cd,_0x9d1e('0x10'));logger[_0x9d1e('0x11')](_0x9d1e('0x12'),_0x2667cd,_0x9d1e('0x10'),JSON[_0x9d1e('0x13')](_0x198720));if(_0x198720[_0x9d1e('0x14')]){if(_0x198720[_0x9d1e('0x14')][_0x9d1e('0x15')]===0x1f4){logger[_0x9d1e('0x14')](_0x9d1e('0x16'),_0x2667cd,_0x198720['error'][_0x9d1e('0x17')]);return _0x5981ad(_0x198720[_0x9d1e('0x14')][_0x9d1e('0x17')]);}logger[_0x9d1e('0x14')](_0x9d1e('0x16'),_0x2667cd,_0x198720[_0x9d1e('0x14')][_0x9d1e('0x17')]);return _0x20e187(_0x198720[_0x9d1e('0x14')][_0x9d1e('0x17')]);}else{logger['info'](_0x9d1e('0x16'),_0x2667cd,_0x9d1e('0x10'));_0x20e187(_0x198720[_0x9d1e('0x18')]['message']);}})['catch'](function(_0x1203dd){logger[_0x9d1e('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x2667cd,_0x1203dd);_0x5981ad(_0x1203dd);});});}exports['GetCmHopperBlack']=function(_0x3973a6){var _0x19de3b=this;return new Promise(function(_0x7624bc,_0x421109){return db[_0x9d1e('0x19')][_0x9d1e('0x1a')]({'raw':_0x3973a6[_0x9d1e('0x1b')]?_0x3973a6['options'][_0x9d1e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3973a6[_0x9d1e('0x1b')]?_0x3973a6[_0x9d1e('0x1b')][_0x9d1e('0x1d')]||null:null,'attributes':_0x3973a6[_0x9d1e('0x1b')]?_0x3973a6['options'][_0x9d1e('0x1e')]||null:null,'limit':_0x3973a6[_0x9d1e('0x1b')]?_0x3973a6[_0x9d1e('0x1b')]['limit']||null:null,'include':_0x3973a6[_0x9d1e('0x1b')]?_0x3973a6[_0x9d1e('0x1b')][_0x9d1e('0x1f')]?_[_0x9d1e('0x20')](_0x3973a6[_0x9d1e('0x1b')][_0x9d1e('0x1f')],function(_0x1a9767){return{'model':db[_0x1a9767['model']],'as':_0x1a9767['as'],'attributes':_0x1a9767[_0x9d1e('0x1e')],'include':_0x1a9767[_0x9d1e('0x1f')]?_[_0x9d1e('0x20')](_0x1a9767[_0x9d1e('0x1f')],function(_0x3277cd){return{'model':db[_0x3277cd[_0x9d1e('0x21')]],'as':_0x3277cd['as'],'attributes':_0x3277cd[_0x9d1e('0x1e')],'include':_0x3277cd[_0x9d1e('0x1f')]?_['map'](_0x3277cd[_0x9d1e('0x1f')],function(_0x3a5bbb){return{'model':db[_0x3a5bbb[_0x9d1e('0x21')]],'as':_0x3a5bbb['as'],'attributes':_0x3a5bbb[_0x9d1e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b2dfb){logger[_0x9d1e('0xf')](_0x9d1e('0x22'),_0x3973a6);logger[_0x9d1e('0x11')](_0x9d1e('0x22'),_0x3973a6,JSON[_0x9d1e('0x13')](_0x3b2dfb));_0x7624bc(_0x3b2dfb);})[_0x9d1e('0x23')](function(_0x2df629){logger['error'](_0x9d1e('0x22'),_0x2df629[_0x9d1e('0x17')],_0x3973a6);_0x421109(_0x19de3b[_0x9d1e('0x14')](0x1f4,_0x2df629[_0x9d1e('0x17')]));});});};exports['UpdateCmHopperBlack']=function(_0xd29572){var _0x14837e=this;return new Promise(function(_0x2804ed,_0x239fee){return db[_0x9d1e('0x19')][_0x9d1e('0x24')](_0xd29572[_0x9d1e('0x25')],{'raw':_0xd29572[_0x9d1e('0x1b')]?_0xd29572[_0x9d1e('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd29572['options']?_0xd29572[_0x9d1e('0x1b')][_0x9d1e('0x1d')]||null:null,'attributes':_0xd29572[_0x9d1e('0x1b')]?_0xd29572[_0x9d1e('0x1b')][_0x9d1e('0x1e')]||null:null,'limit':_0xd29572[_0x9d1e('0x1b')]?_0xd29572[_0x9d1e('0x1b')][_0x9d1e('0x26')]||null:null})[_0x9d1e('0xe')](function(_0x2ee461){logger[_0x9d1e('0xf')](_0x9d1e('0x27'),_0xd29572);logger[_0x9d1e('0x11')]('UpdateCmHopperBlack',_0xd29572,JSON[_0x9d1e('0x13')](_0x2ee461));_0x2804ed(_0x2ee461);})['catch'](function(_0x577a4b){logger['error']('UpdateCmHopperBlack',_0x577a4b['message'],_0xd29572);_0x239fee(_0x14837e['error'](0x1f4,_0x577a4b[_0x9d1e('0x17')]));});});};exports[_0x9d1e('0x28')]=function(_0x8b2e02){var _0x1ac088=this;return new Promise(function(_0xc6a559,_0x329352){return db['CmHopperBlack'][_0x9d1e('0x29')]({'where':_0x8b2e02[_0x9d1e('0x1b')]?_0x8b2e02[_0x9d1e('0x1b')]['where']||null:null})[_0x9d1e('0xe')](function(_0x2950eb){logger[_0x9d1e('0xf')](_0x9d1e('0x28'),_0x8b2e02);logger[_0x9d1e('0x11')](_0x9d1e('0x28'),_0x8b2e02,JSON[_0x9d1e('0x13')](_0x2950eb));_0xc6a559(_0x2950eb);})[_0x9d1e('0x23')](function(_0x57c672){logger[_0x9d1e('0x14')](_0x9d1e('0x28'),_0x57c672[_0x9d1e('0x17')],_0x8b2e02);_0x329352(_0x1ac088['error'](0x1f4,_0x57c672[_0x9d1e('0x17')]));});});}; \ No newline at end of file +var _0x8b58=['GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','raw','DestroyCmHopperBlack','destroy','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch'];(function(_0x4260f3,_0x4988d6){var _0x31b726=function(_0x5a5513){while(--_0x5a5513){_0x4260f3['push'](_0x4260f3['shift']());}};_0x31b726(++_0x4988d6);}(_0x8b58,0x7e));var _0x88b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x88b5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x88b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88b5('0x2'));var db=require(_0x88b5('0x3'))['db'];var utils=require(_0x88b5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x88b5('0x5'));var jayson=require(_0x88b5('0x6'));var client=jayson[_0x88b5('0x7')][_0x88b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4aab64,_0x242ee9,_0x358a9c){return new BPromise(function(_0x3b83ea,_0x19fa30){return client[_0x88b5('0x9')](_0x4aab64,_0x358a9c)[_0x88b5('0xa')](function(_0x56ed1c){logger[_0x88b5('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x242ee9,'request\x20sent');logger[_0x88b5('0xc')](_0x88b5('0xd'),_0x242ee9,_0x88b5('0xe'),JSON[_0x88b5('0xf')](_0x56ed1c));if(_0x56ed1c[_0x88b5('0x10')]){if(_0x56ed1c[_0x88b5('0x10')][_0x88b5('0x11')]===0x1f4){logger[_0x88b5('0x10')](_0x88b5('0x12'),_0x242ee9,_0x56ed1c['error'][_0x88b5('0x13')]);return _0x19fa30(_0x56ed1c['error'][_0x88b5('0x13')]);}logger[_0x88b5('0x10')](_0x88b5('0x12'),_0x242ee9,_0x56ed1c[_0x88b5('0x10')][_0x88b5('0x13')]);return _0x3b83ea(_0x56ed1c[_0x88b5('0x10')][_0x88b5('0x13')]);}else{logger[_0x88b5('0xb')](_0x88b5('0x12'),_0x242ee9,_0x88b5('0xe'));_0x3b83ea(_0x56ed1c[_0x88b5('0x14')][_0x88b5('0x13')]);}})[_0x88b5('0x15')](function(_0xb77102){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x242ee9,_0xb77102);_0x19fa30(_0xb77102);});});}exports[_0x88b5('0x16')]=function(_0x6e1ef5){var _0x51ea81=this;return new Promise(function(_0x6f171e,_0x5287a0){return db[_0x88b5('0x17')][_0x88b5('0x18')]({'raw':_0x6e1ef5['options']?_0x6e1ef5['options']['raw']===undefined?!![]:![]:!![],'where':_0x6e1ef5[_0x88b5('0x19')]?_0x6e1ef5['options'][_0x88b5('0x1a')]||null:null,'attributes':_0x6e1ef5[_0x88b5('0x19')]?_0x6e1ef5[_0x88b5('0x19')][_0x88b5('0x1b')]||null:null,'limit':_0x6e1ef5[_0x88b5('0x19')]?_0x6e1ef5[_0x88b5('0x19')][_0x88b5('0x1c')]||null:null,'include':_0x6e1ef5[_0x88b5('0x19')]?_0x6e1ef5[_0x88b5('0x19')][_0x88b5('0x1d')]?_[_0x88b5('0x1e')](_0x6e1ef5[_0x88b5('0x19')][_0x88b5('0x1d')],function(_0x324e00){return{'model':db[_0x324e00[_0x88b5('0x1f')]],'as':_0x324e00['as'],'attributes':_0x324e00['attributes'],'include':_0x324e00[_0x88b5('0x1d')]?_[_0x88b5('0x1e')](_0x324e00[_0x88b5('0x1d')],function(_0x5afb6a){return{'model':db[_0x5afb6a[_0x88b5('0x1f')]],'as':_0x5afb6a['as'],'attributes':_0x5afb6a['attributes'],'include':_0x5afb6a[_0x88b5('0x1d')]?_[_0x88b5('0x1e')](_0x5afb6a[_0x88b5('0x1d')],function(_0x31b3b9){return{'model':db[_0x31b3b9['model']],'as':_0x31b3b9['as'],'attributes':_0x31b3b9[_0x88b5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x88b5('0xa')](function(_0x485f16){logger['info'](_0x88b5('0x16'),_0x6e1ef5);logger[_0x88b5('0xc')](_0x88b5('0x16'),_0x6e1ef5,JSON[_0x88b5('0xf')](_0x485f16));_0x6f171e(_0x485f16);})[_0x88b5('0x15')](function(_0x5f413e){logger[_0x88b5('0x10')](_0x88b5('0x16'),_0x5f413e[_0x88b5('0x13')],_0x6e1ef5);_0x5287a0(_0x51ea81[_0x88b5('0x10')](0x1f4,_0x5f413e[_0x88b5('0x13')]));});});};exports[_0x88b5('0x20')]=function(_0x4c00cd){var _0x1dc0f1=this;return new Promise(function(_0xa43896,_0x556819){return db['CmHopperBlack']['update'](_0x4c00cd[_0x88b5('0x21')],{'raw':_0x4c00cd[_0x88b5('0x19')]?_0x4c00cd[_0x88b5('0x19')][_0x88b5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c00cd['options']?_0x4c00cd['options'][_0x88b5('0x1a')]||null:null,'attributes':_0x4c00cd[_0x88b5('0x19')]?_0x4c00cd[_0x88b5('0x19')]['attributes']||null:null,'limit':_0x4c00cd[_0x88b5('0x19')]?_0x4c00cd[_0x88b5('0x19')][_0x88b5('0x1c')]||null:null})[_0x88b5('0xa')](function(_0x4a86e7){logger[_0x88b5('0xb')](_0x88b5('0x20'),_0x4c00cd);logger[_0x88b5('0xc')](_0x88b5('0x20'),_0x4c00cd,JSON[_0x88b5('0xf')](_0x4a86e7));_0xa43896(_0x4a86e7);})[_0x88b5('0x15')](function(_0x1c4868){logger[_0x88b5('0x10')](_0x88b5('0x20'),_0x1c4868[_0x88b5('0x13')],_0x4c00cd);_0x556819(_0x1dc0f1[_0x88b5('0x10')](0x1f4,_0x1c4868[_0x88b5('0x13')]));});});};exports[_0x88b5('0x23')]=function(_0x48b9fa){var _0x5bc18f=this;return new Promise(function(_0x3ee071,_0x150a66){return db[_0x88b5('0x17')][_0x88b5('0x24')]({'where':_0x48b9fa[_0x88b5('0x19')]?_0x48b9fa[_0x88b5('0x19')][_0x88b5('0x1a')]||null:null})[_0x88b5('0xa')](function(_0x38bde8){logger[_0x88b5('0xb')](_0x88b5('0x23'),_0x48b9fa);logger['debug']('DestroyCmHopperBlack',_0x48b9fa,JSON[_0x88b5('0xf')](_0x38bde8));_0x3ee071(_0x38bde8);})['catch'](function(_0x9cb200){logger[_0x88b5('0x10')](_0x88b5('0x23'),_0x9cb200['message'],_0x48b9fa);_0x150a66(_0x5bc18f[_0x88b5('0x10')](0x1f4,_0x9cb200[_0x88b5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 2d89598..481fbf5 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 _0xa41a=['../../config/environment','./cmHopperBlack.controller','get','index','describe','isAuthenticated','show','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x21f256,_0x53cafe){var _0xb2d4d7=function(_0x15670e){while(--_0x15670e){_0x21f256['push'](_0x21f256['shift']());}};_0xb2d4d7(++_0x53cafe);}(_0xa41a,0x6b));var _0xaa41=function(_0x172407,_0x252fd0){_0x172407=_0x172407-0x0;var _0x4402a7=_0xa41a[_0x172407];return _0x4402a7;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0xe')](_0xaa41('0xf'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x10')]);router[_0xaa41('0x11')](_0xaa41('0xf'),auth[_0xaa41('0xc')](),controller['destroy']);module[_0xaa41('0x12')]=router; \ No newline at end of file +var _0xb903=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id','exports','multer','util','path'];(function(_0x538631,_0x2258ed){var _0x49913e=function(_0x571bd8){while(--_0x571bd8){_0x538631['push'](_0x538631['shift']());}};_0x49913e(++_0x2258ed);}(_0xb903,0x185));var _0x3b90=function(_0x2a625c,_0x500e38){_0x2a625c=_0x2a625c-0x0;var _0x13ea16=_0xb903[_0x2a625c];return _0x13ea16;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var auth=require(_0x3b90('0x5'));var interaction=require(_0x3b90('0x6'));var config=require(_0x3b90('0x7'));var controller=require(_0x3b90('0x8'));router[_0x3b90('0x9')]('/',auth[_0x3b90('0xa')](),controller['index']);router[_0x3b90('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router[_0x3b90('0x9')](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['destroy']);module[_0x3b90('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 447587d..c15ae30 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 _0x25bc=['endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','exports','INTEGER','DATE','STRING','getDataValue'];(function(_0x436017,_0x47c412){var _0x50ed01=function(_0x1dd020){while(--_0x1dd020){_0x436017['push'](_0x436017['shift']());}};_0x50ed01(++_0x47c412);}(_0x25bc,0x10b));var _0xc25b=function(_0x510c8d,_0x147909){_0x510c8d=_0x510c8d-0x0;var _0x17f08b=_0x25bc[_0x510c8d];return _0x17f08b;};'use strict';var Sequelize=require(_0xc25b('0x0'));var moment=require('moment');module[_0xc25b('0x1')]={'state':{'type':Sequelize[_0xc25b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xc25b('0x3')]},'countbusyretry':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc25b('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xc25b('0x4')]},'originatecalleridname':{'type':Sequelize[_0xc25b('0x4')]},'calleridnum':{'type':Sequelize[_0xc25b('0x4')]},'calleridname':{'type':Sequelize[_0xc25b('0x4')]},'starttime':{'type':Sequelize[_0xc25b('0x3')]},'responsetime':{'type':Sequelize[_0xc25b('0x3')]},'answertime':{'type':Sequelize[_0xc25b('0x3')]},'droptime':{'type':Sequelize[_0xc25b('0x3')]},'endtime':{'type':Sequelize[_0xc25b('0x3')]},'ringtime':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc25b('0x4')]},'campaign':{'type':Sequelize[_0xc25b('0x4')]},'campaigntype':{'type':Sequelize[_0xc25b('0x4')]},'membername':{'type':Sequelize[_0xc25b('0x4')]},'reason':{'type':Sequelize[_0xc25b('0x4')]},'disposition':{'type':Sequelize[_0xc25b('0x4')]},'dispositionat':{'type':Sequelize[_0xc25b('0x3')],'set':function(_0x169d77){var _0x3b711c=this[_0xc25b('0x5')](_0xc25b('0x6'));if(_0x3b711c&&_0x169d77){this[_0xc25b('0x7')](_0xc25b('0x8'),moment(_0x169d77)[_0xc25b('0x9')](moment(_0x3b711c),_0xc25b('0xa')));}return this['setDataValue'](_0xc25b('0xb'),_0x169d77);}},'amd':{'type':Sequelize[_0xc25b('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xc25b('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xc25b('0x3')]},'callback':{'type':Sequelize[_0xc25b('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc25b('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xc25b('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc25b('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xc25b('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc25b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfcd5=['DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x44f192,_0x557c5a){var _0x33fcb8=function(_0xf9ae58){while(--_0xf9ae58){_0x44f192['push'](_0x44f192['shift']());}};_0x33fcb8(++_0x557c5a);}(_0xfcd5,0xb7));var _0x5fcd=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xfcd5[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0x5fcd('0x0'));var moment=require(_0x5fcd('0x1'));module['exports']={'state':{'type':Sequelize[_0x5fcd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5fcd('0x3')]},'scheduledat':{'type':Sequelize[_0x5fcd('0x4')]},'countbusyretry':{'type':Sequelize[_0x5fcd('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5fcd('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5fcd('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5fcd('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5fcd('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5fcd('0x3')]},'calleridnum':{'type':Sequelize[_0x5fcd('0x3')]},'calleridname':{'type':Sequelize[_0x5fcd('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5fcd('0x4')]},'droptime':{'type':Sequelize[_0x5fcd('0x4')]},'endtime':{'type':Sequelize[_0x5fcd('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5fcd('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5fcd('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5fcd('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5fcd('0x3')]},'campaign':{'type':Sequelize[_0x5fcd('0x3')]},'campaigntype':{'type':Sequelize[_0x5fcd('0x3')]},'membername':{'type':Sequelize[_0x5fcd('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x5fcd('0x3')]},'dispositionat':{'type':Sequelize[_0x5fcd('0x4')],'set':function(_0x2f7fad){var _0x3076a5=this[_0x5fcd('0x5')]('endtime');if(_0x3076a5&&_0x2f7fad){this[_0x5fcd('0x6')](_0x5fcd('0x7'),moment(_0x2f7fad)[_0x5fcd('0x8')](moment(_0x3076a5),_0x5fcd('0x9')));}return this[_0x5fcd('0x6')]('dispositionat',_0x2f7fad);}},'amd':{'type':Sequelize[_0x5fcd('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5fcd('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5fcd('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5fcd('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5fcd('0x4')]},'callback':{'type':Sequelize[_0x5fcd('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5fcd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5fcd('0x4')]},'deleted':{'type':Sequelize[_0x5fcd('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5fcd('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x5fcd('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x5fcd('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5fcd('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 036225c..88b3dae 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 _0xbedb=['noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','moveContactsIvrCampaignHopperFinal','Campaign','into','ContactId','CampaignId','CampaignId\x20=\x20?','group','checkContactHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','CmHopperFinal','rawAttributes','fieldName','key','map','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','limit','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xbbed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbbed('0x1'));var zipdir=require(_0xbbed('0x2'));var jsonpatch=require(_0xbbed('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbbed('0x4'));var Mustache=require(_0xbbed('0x5'));var util=require(_0xbbed('0x6'));var path=require(_0xbbed('0x7'));var sox=require(_0xbbed('0x8'));var csv=require(_0xbbed('0x9'));var ejs=require(_0xbbed('0xa'));var fs=require('fs');var _=require(_0xbbed('0xb'));var squel=require(_0xbbed('0xc'));var crypto=require(_0xbbed('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbed('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbbed('0xf'));var Redis=require(_0xbbed('0x10'));var authService=require(_0xbbed('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbed('0x12'));var logger=require(_0xbbed('0x13'))(_0xbbed('0x14'));var utils=require(_0xbbed('0x15'));var config=require(_0xbbed('0x16'));var db=require(_0xbbed('0x17'))['db'];function respondWithStatusCode(_0x5308c4,_0x4324b5){_0x4324b5=_0x4324b5||0xcc;return function(_0x4ed197){if(_0x4ed197){return _0x5308c4[_0xbbed('0x18')](_0x4324b5);}return _0x5308c4[_0xbbed('0x19')](_0x4324b5)[_0xbbed('0x1a')]();};}function respondWithResult(_0x5c5716,_0xebc428){_0xebc428=_0xebc428||0xc8;return function(_0x194cea){if(_0x194cea){return _0x5c5716[_0xbbed('0x19')](_0xebc428)[_0xbbed('0x1b')](_0x194cea);}};}function respondWithFilteredResult(_0x79be61,_0x286048){return function(_0x5eb641){if(_0x5eb641){var _0x359469=_0x5eb641[_0xbbed('0x1c')],_0x5dfb44=_0x286048[_0xbbed('0x1d')],_0x1b58bc=_0x286048[_0xbbed('0x1d')]+_0x286048['limit'],_0x117e1e;if(_0x1b58bc>=_0x359469){_0x1b58bc=_0x359469;_0x117e1e=0xc8;}else{_0x117e1e=0xce;}_0x79be61[_0xbbed('0x19')](_0x117e1e);return _0x79be61[_0xbbed('0x1e')](_0xbbed('0x1f'),_0x5dfb44+'-'+_0x1b58bc+'/'+_0x359469)[_0xbbed('0x1b')](_0x5eb641);}return null;};}function patchUpdates(_0x178bfd){return function(_0x218812){try{jsonpatch[_0xbbed('0x20')](_0x218812,_0x178bfd,!![]);}catch(_0x431be1){return BPromise[_0xbbed('0x21')](_0x431be1);}return _0x218812[_0xbbed('0x22')]();};}function saveUpdates(_0x1f928a,_0xf166a4){return function(_0x8031d3){if(_0x8031d3){return _0x8031d3['update'](_0x1f928a)[_0xbbed('0x23')](function(_0x2c3b43){return _0x2c3b43;});}return null;};}function removeEntity(_0x477031,_0x493773){return function(_0x40ce77){if(_0x40ce77){return _0x40ce77[_0xbbed('0x24')]()[_0xbbed('0x23')](function(){_0x477031[_0xbbed('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13c422,_0x479c81){return function(_0x163893){if(!_0x163893){_0x13c422[_0xbbed('0x18')](0x194);}return _0x163893;};}function handleError(_0x5e8070,_0x34f5e5){_0x34f5e5=_0x34f5e5||0x1f4;return function(_0x30776b){logger[_0xbbed('0x25')](_0x30776b[_0xbbed('0x26')]);if(_0x30776b[_0xbbed('0x27')]){delete _0x30776b[_0xbbed('0x27')];}_0x5e8070['status'](_0x34f5e5)[_0xbbed('0x28')](_0x30776b);};}exports['index']=function(_0x1486da,_0x5b1d74){var _0xc8cdb1={},_0x457b58={},_0x37db7b={'count':0x0,'rows':[]};var _0x25391d=_['map'](db[_0xbbed('0x29')][_0xbbed('0x2a')],function(_0x381cb8){return{'name':_0x381cb8[_0xbbed('0x2b')],'type':_0x381cb8['type'][_0xbbed('0x2c')]};});_0x457b58['model']=_[_0xbbed('0x2d')](_0x25391d,_0xbbed('0x27'));_0x457b58['query']=_[_0xbbed('0x2e')](_0x1486da[_0xbbed('0x2f')]);_0x457b58['filters']=_['intersection'](_0x457b58['model'],_0x457b58['query']);_0xc8cdb1['attributes']=_[_0xbbed('0x30')](_0x457b58[_0xbbed('0x31')],qs['fields'](_0x1486da['query'][_0xbbed('0x32')]));_0xc8cdb1[_0xbbed('0x33')]=_0xc8cdb1['attributes'][_0xbbed('0x34')]?_0xc8cdb1['attributes']:_0x457b58[_0xbbed('0x31')];if(!_0x1486da[_0xbbed('0x2f')][_0xbbed('0x35')]('nolimit')){_0xc8cdb1[_0xbbed('0x36')]=qs[_0xbbed('0x36')](_0x1486da[_0xbbed('0x2f')][_0xbbed('0x36')]);_0xc8cdb1[_0xbbed('0x1d')]=qs[_0xbbed('0x1d')](_0x1486da['query'][_0xbbed('0x1d')]);}_0xc8cdb1['order']=qs['sort'](_0x1486da[_0xbbed('0x2f')]['sort']);_0xc8cdb1[_0xbbed('0x37')]=qs[_0xbbed('0x38')](_[_0xbbed('0x39')](_0x1486da[_0xbbed('0x2f')],_0x457b58['filters']),_0x25391d);if(_0x1486da[_0xbbed('0x2f')][_0xbbed('0x3a')]){_0xc8cdb1['where']=_['merge'](_0xc8cdb1['where'],{'$or':_[_0xbbed('0x2d')](_0x25391d,function(_0x13fc6d){if(_0x13fc6d[_0xbbed('0x3b')]!==_0xbbed('0x3c')){var _0x176d21={};_0x176d21[_0x13fc6d[_0xbbed('0x27')]]={'$like':'%'+_0x1486da[_0xbbed('0x2f')]['filter']+'%'};return _0x176d21;}})});}_0xc8cdb1=_[_0xbbed('0x3d')]({},_0xc8cdb1,_0x1486da[_0xbbed('0x3e')]);var _0x70acf2={'where':_0xc8cdb1[_0xbbed('0x37')]};return db[_0xbbed('0x29')]['count'](_0x70acf2)[_0xbbed('0x23')](function(_0x26c029){_0x37db7b['count']=_0x26c029;if(_0x1486da[_0xbbed('0x2f')][_0xbbed('0x3f')]){_0xc8cdb1[_0xbbed('0x40')]=[{'all':!![]}];}return db[_0xbbed('0x29')][_0xbbed('0x41')](_0xc8cdb1);})[_0xbbed('0x23')](function(_0x4c4564){_0x37db7b['rows']=_0x4c4564;return _0x37db7b;})[_0xbbed('0x23')](respondWithFilteredResult(_0x5b1d74,_0xc8cdb1))['catch'](handleError(_0x5b1d74,null));};exports[_0xbbed('0x42')]=function(_0x552ef9,_0x35234e){var _0x2d9b79={'raw':!![],'where':{'id':_0x552ef9[_0xbbed('0x43')]['id']}},_0x3b6964={};_0x3b6964[_0xbbed('0x31')]=_[_0xbbed('0x2e')](db['CmHopperFinal'][_0xbbed('0x2a')]);_0x3b6964['query']=_[_0xbbed('0x2e')](_0x552ef9[_0xbbed('0x2f')]);_0x3b6964[_0xbbed('0x38')]=_['intersection'](_0x3b6964[_0xbbed('0x31')],_0x3b6964['query']);_0x2d9b79['attributes']=_[_0xbbed('0x30')](_0x3b6964['model'],qs['fields'](_0x552ef9[_0xbbed('0x2f')][_0xbbed('0x32')]));_0x2d9b79[_0xbbed('0x33')]=_0x2d9b79['attributes'][_0xbbed('0x34')]?_0x2d9b79[_0xbbed('0x33')]:_0x3b6964['model'];if(_0x552ef9[_0xbbed('0x2f')][_0xbbed('0x3f')]){_0x2d9b79[_0xbbed('0x40')]=[{'all':!![]}];}_0x2d9b79=_[_0xbbed('0x3d')]({},_0x2d9b79,_0x552ef9[_0xbbed('0x3e')]);return db[_0xbbed('0x29')][_0xbbed('0x44')](_0x2d9b79)['then'](handleEntityNotFound(_0x35234e,null))[_0xbbed('0x23')](respondWithResult(_0x35234e,null))[_0xbbed('0x45')](handleError(_0x35234e,null));};exports[_0xbbed('0x46')]=function(_0x432dfb,_0x3b9754){return db[_0xbbed('0x29')]['describe']()[_0xbbed('0x23')](respondWithResult(_0x3b9754,null))['catch'](handleError(_0x3b9754,null));};exports['update']=function(_0x3d5eeb,_0x42a655){if(_0x3d5eeb['body'][_0xbbed('0x47')]){delete _0x3d5eeb[_0xbbed('0x48')][_0xbbed('0x47')];}return db['CmHopperFinal'][_0xbbed('0x44')]({'where':{'uniqueid':_0x3d5eeb[_0xbbed('0x43')]['id']}})['then'](handleEntityNotFound(_0x42a655,null))[_0xbbed('0x23')](saveUpdates(_0x3d5eeb[_0xbbed('0x48')],null))[_0xbbed('0x23')](respondWithResult(_0x42a655,null))[_0xbbed('0x45')](handleError(_0x42a655,null));};exports[_0xbbed('0x49')]=function(_0x310e86,_0x22a64f,_0x2d5061){return db[_0xbbed('0x29')][_0xbbed('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x310e86[_0xbbed('0x43')]['id']},'attributes':[[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')](_0xbbed('0x4d')))),_0xbbed('0x4e')],[db[_0xbbed('0x4a')]['fn']('COUNT',db[_0xbbed('0x4a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xbbed('0x4f')],[db['sequelize']['fn'](_0xbbed('0x4b'),db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')](_0xbbed('0x50')))),'busyContacts'],[db[_0xbbed('0x4a')]['fn']('COUNT',db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0xbbed('0x4b'),db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')](_0xbbed('0x51')))),_0xbbed('0x52')],[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xbbed('0x53')],[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db['sequelize']['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0xbbed('0x54')]]})[_0xbbed('0x23')](handleEntityNotFound(_0x22a64f,null))['then'](respondWithResult(_0x22a64f,null))[_0xbbed('0x45')](handleError(_0x22a64f,null));};exports[_0xbbed('0x55')]=function(_0x3880ed,_0xa42912,_0x4fb2db){return db[_0xbbed('0x29')][_0xbbed('0x41')]({'raw':![],'where':{'CampaignId':_0x3880ed[_0xbbed('0x43')]['id']},'attributes':[[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xbbed('0x4d')))),_0xbbed('0x4e')],[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')](_0xbbed('0x56')))),_0xbbed('0x4f')],[db['sequelize']['fn'](_0xbbed('0x4b'),db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0xbbed('0x57')],[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')](_0xbbed('0x58')))),'congestionContacts'],[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xbbed('0x4c')](_0xbbed('0x51')))),_0xbbed('0x52')],[db[_0xbbed('0x4a')]['fn'](_0xbbed('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xbbed('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xbbed('0x53')],[db['sequelize']['fn'](_0xbbed('0x4b'),db['sequelize']['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')](_0xbbed('0x59')))),_0xbbed('0x5a')],[db[_0xbbed('0x4a')]['fn']('COUNT',db[_0xbbed('0x4a')]['fn']('IF',db[_0xbbed('0x4a')][_0xbbed('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0xbbed('0x54')]]})[_0xbbed('0x23')](handleEntityNotFound(_0xa42912,null))[_0xbbed('0x23')](respondWithResult(_0xa42912,null))[_0xbbed('0x45')](handleError(_0xa42912,null));};exports[_0xbbed('0x5b')]=function(_0x570bd1,_0x1021d3,_0x21476a){return db[_0xbbed('0x5c')]['find']({'where':{'id':_0x570bd1[_0xbbed('0x43')]['id']}})[_0xbbed('0x23')](handleEntityNotFound(_0x1021d3,null))['then'](function(_0x572d9e){var _0x51c2e6;if(_0x572d9e){_0x51c2e6=squel[_0xbbed('0x5d')]()['into'](_0xbbed('0x5e'))[_0xbbed('0x5f')]([_0xbbed('0x60'),_0xbbed('0x61'),'ContactId',_0xbbed('0x62'),'VoiceQueueId',_0xbbed('0x63'),_0xbbed('0x64')],squel[_0xbbed('0x65')]()['field'](_0xbbed('0x66'),_0xbbed('0x60'))[_0xbbed('0x67')](_0xbbed('0x68'),'scheduledAt')[_0xbbed('0x67')](_0xbbed('0x69'),'ContactId')[_0xbbed('0x67')](_0xbbed('0x6a'),_0xbbed('0x62'))[_0xbbed('0x67')](_0xbbed('0x6b'),_0xbbed('0x6c'))[_0xbbed('0x67')](_0xbbed('0x68'),_0xbbed('0x63'))['field'](_0xbbed('0x68'),'updatedAt')[_0xbbed('0x6d')]('cm_hopper_final')[_0xbbed('0x37')](_0xbbed('0x6e'),_0x570bd1[_0xbbed('0x43')]['id']['toString']())[_0xbbed('0x37')](_0xbbed('0x6f'),_0x570bd1[_0xbbed('0x48')][_0xbbed('0x70')][_0xbbed('0x71')]())['where'](_0xbbed('0x72'))['where'](_0xbbed('0x73'),squel[_0xbbed('0x65')]()[_0xbbed('0x67')]('phone')['from'](_0xbbed('0x5e'))[_0xbbed('0x37')](_0xbbed('0x6e'),_0x570bd1[_0xbbed('0x43')]['id'][_0xbbed('0x71')]()))[_0xbbed('0x37')](_0xbbed('0x73'),squel[_0xbbed('0x65')]()[_0xbbed('0x67')](_0xbbed('0x74'))[_0xbbed('0x6d')](_0xbbed('0x75'))['where'](_0xbbed('0x6e'),_0x570bd1['params']['id'][_0xbbed('0x71')]())[_0xbbed('0x37')]('state\x20=\x204'))['group']('ContactId'))[_0xbbed('0x71')]();return db[_0xbbed('0x4a')][_0xbbed('0x2f')](_0x51c2e6);}return[];})[_0xbbed('0x23')](respondWithResult(_0x1021d3,null))[_0xbbed('0x45')](handleError(_0x1021d3,null));};exports[_0xbbed('0x76')]=function(_0x1e5e48,_0x46b0be,_0x1084bd){return db[_0xbbed('0x77')][_0xbbed('0x44')]({'where':{'id':_0x1e5e48['params']['id']}})[_0xbbed('0x23')](handleEntityNotFound(_0x46b0be,null))[_0xbbed('0x23')](function(_0x1ce3c1){var _0x388e30;if(_0x1ce3c1){_0x388e30=squel[_0xbbed('0x5d')]()[_0xbbed('0x78')](_0xbbed('0x5e'))[_0xbbed('0x5f')]([_0xbbed('0x60'),_0xbbed('0x61'),_0xbbed('0x79'),_0xbbed('0x62'),_0xbbed('0x7a'),_0xbbed('0x63'),_0xbbed('0x64')],squel[_0xbbed('0x65')]()[_0xbbed('0x67')](_0xbbed('0x66'),_0xbbed('0x60'))[_0xbbed('0x67')](_0xbbed('0x68'),_0xbbed('0x61'))[_0xbbed('0x67')]('ANY_VALUE(ContactId)',_0xbbed('0x79'))[_0xbbed('0x67')]('ANY_VALUE(ListId)',_0xbbed('0x62'))['field']('ANY_VALUE(CampaignId)',_0xbbed('0x7a'))[_0xbbed('0x67')](_0xbbed('0x68'),_0xbbed('0x63'))[_0xbbed('0x67')]('NOW()',_0xbbed('0x64'))[_0xbbed('0x6d')](_0xbbed('0x75'))[_0xbbed('0x37')]('CampaignId\x20=\x20?',_0x1e5e48['params']['id'][_0xbbed('0x71')]())[_0xbbed('0x37')]('state\x20=\x20?',_0x1e5e48[_0xbbed('0x48')][_0xbbed('0x70')][_0xbbed('0x71')]())[_0xbbed('0x37')](_0xbbed('0x72'))[_0xbbed('0x37')](_0xbbed('0x73'),squel['select']()[_0xbbed('0x67')](_0xbbed('0x60'))[_0xbbed('0x6d')](_0xbbed('0x5e'))[_0xbbed('0x37')](_0xbbed('0x7b'),_0x1e5e48[_0xbbed('0x43')]['id'][_0xbbed('0x71')]()))['where'](_0xbbed('0x73'),squel[_0xbbed('0x65')]()[_0xbbed('0x67')](_0xbbed('0x74'))[_0xbbed('0x6d')](_0xbbed('0x75'))['where'](_0xbbed('0x7b'),_0x1e5e48['params']['id'][_0xbbed('0x71')]())['where']('state\x20=\x204'))[_0xbbed('0x7c')](_0xbbed('0x79')))['toString']();return db[_0xbbed('0x4a')][_0xbbed('0x2f')](_0x388e30);}return[];})['then'](respondWithResult(_0x46b0be,null))[_0xbbed('0x45')](handleError(_0x46b0be,null));};exports[_0xbbed('0x7d')]=function(_0x2650f1,_0xc0d7a3,_0x35fe7e){return db['CmHopper'][_0xbbed('0x7e')]({'where':{'VoiceQueueId':_0x2650f1['body'][_0xbbed('0x6c')],'CampaignId':_0x2650f1[_0xbbed('0x48')][_0xbbed('0x7a')],'ContactId':_0x2650f1[_0xbbed('0x48')]['ContactId']}})[_0xbbed('0x23')](handleEntityNotFound(_0xc0d7a3,null))[_0xbbed('0x23')](function(_0x12f534){if(_0x12f534){return _0x12f534;}return null;})[_0xbbed('0x23')](respondWithResult(_0xc0d7a3,null))[_0xbbed('0x45')](handleError(_0xc0d7a3,null));}; \ No newline at end of file +var _0x5204=['error','stack','name','send','index','CmHopperFinal','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','catch','show','params','rawAttributes','keys','includeAll','include','find','describe','update','body','uniqueid','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noSuchContacts','`state`\x20=\x2019,\x201,\x20null','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy'];(function(_0x551f8e,_0x5c3783){var _0x3e0ecd=function(_0x5cf677){while(--_0x5cf677){_0x551f8e['push'](_0x551f8e['shift']());}};_0x3e0ecd(++_0x5c3783);}(_0x5204,0xdf));var _0x4520=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x5204[_0x2bc3f4];return _0x14ac53;};'use strict';var pdf=require(_0x4520('0x0'));var emlformat=require(_0x4520('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4520('0x2'));var jsonpatch=require(_0x4520('0x3'));var rp=require(_0x4520('0x4'));var moment=require(_0x4520('0x5'));var BPromise=require(_0x4520('0x6'));var Mustache=require('mustache');var util=require(_0x4520('0x7'));var path=require('path');var sox=require(_0x4520('0x8'));var csv=require(_0x4520('0x9'));var ejs=require(_0x4520('0xa'));var fs=require('fs');var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x9'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var db=require(_0x4520('0x19'))['db'];function respondWithStatusCode(_0x394072,_0x3c7a5d){_0x3c7a5d=_0x3c7a5d||0xcc;return function(_0x508ea6){if(_0x508ea6){return _0x394072[_0x4520('0x1a')](_0x3c7a5d);}return _0x394072[_0x4520('0x1b')](_0x3c7a5d)[_0x4520('0x1c')]();};}function respondWithResult(_0x4677d7,_0x426836){_0x426836=_0x426836||0xc8;return function(_0x34d383){if(_0x34d383){return _0x4677d7[_0x4520('0x1b')](_0x426836)['json'](_0x34d383);}};}function respondWithFilteredResult(_0x3e53e5,_0x20de6b){return function(_0x1ab841){if(_0x1ab841){var _0x15a31f=_0x1ab841[_0x4520('0x1d')],_0x32d8aa=_0x20de6b[_0x4520('0x1e')],_0x51d85f=_0x20de6b[_0x4520('0x1e')]+_0x20de6b[_0x4520('0x1f')],_0x2c1805;if(_0x51d85f>=_0x15a31f){_0x51d85f=_0x15a31f;_0x2c1805=0xc8;}else{_0x2c1805=0xce;}_0x3e53e5[_0x4520('0x1b')](_0x2c1805);return _0x3e53e5[_0x4520('0x20')](_0x4520('0x21'),_0x32d8aa+'-'+_0x51d85f+'/'+_0x15a31f)[_0x4520('0x22')](_0x1ab841);}return null;};}function patchUpdates(_0x11eaea){return function(_0x398dd2){try{jsonpatch[_0x4520('0x23')](_0x398dd2,_0x11eaea,!![]);}catch(_0x4ac41d){return BPromise[_0x4520('0x24')](_0x4ac41d);}return _0x398dd2['save']();};}function saveUpdates(_0x5ceff6,_0x4c46c5){return function(_0x2b9456){if(_0x2b9456){return _0x2b9456['update'](_0x5ceff6)[_0x4520('0x25')](function(_0x270dc2){return _0x270dc2;});}return null;};}function removeEntity(_0x428d36,_0x534b15){return function(_0x3199a9){if(_0x3199a9){return _0x3199a9[_0x4520('0x26')]()[_0x4520('0x25')](function(){_0x428d36['status'](0xcc)[_0x4520('0x1c')]();});}};}function handleEntityNotFound(_0x847d15,_0x24eacd){return function(_0x3a4680){if(!_0x3a4680){_0x847d15[_0x4520('0x1a')](0x194);}return _0x3a4680;};}function handleError(_0x552da1,_0x3774bd){_0x3774bd=_0x3774bd||0x1f4;return function(_0x15987c){logger[_0x4520('0x27')](_0x15987c[_0x4520('0x28')]);if(_0x15987c['name']){delete _0x15987c[_0x4520('0x29')];}_0x552da1[_0x4520('0x1b')](_0x3774bd)[_0x4520('0x2a')](_0x15987c);};}exports[_0x4520('0x2b')]=function(_0xad9f8,_0x2c95ea){var _0x2d6902={},_0x195c58={},_0x180c44={'count':0x0,'rows':[]};var _0x926ca0=_['map'](db[_0x4520('0x2c')]['rawAttributes'],function(_0x7ce8d2){return{'name':_0x7ce8d2[_0x4520('0x2d')],'type':_0x7ce8d2[_0x4520('0x2e')][_0x4520('0x2f')]};});_0x195c58[_0x4520('0x30')]=_[_0x4520('0x31')](_0x926ca0,'name');_0x195c58[_0x4520('0x32')]=_['keys'](_0xad9f8[_0x4520('0x32')]);_0x195c58['filters']=_[_0x4520('0x33')](_0x195c58['model'],_0x195c58[_0x4520('0x32')]);_0x2d6902['attributes']=_['intersection'](_0x195c58[_0x4520('0x30')],qs[_0x4520('0x34')](_0xad9f8[_0x4520('0x32')]['fields']));_0x2d6902[_0x4520('0x35')]=_0x2d6902[_0x4520('0x35')][_0x4520('0x36')]?_0x2d6902[_0x4520('0x35')]:_0x195c58['model'];if(!_0xad9f8['query'][_0x4520('0x37')](_0x4520('0x38'))){_0x2d6902['limit']=qs[_0x4520('0x1f')](_0xad9f8[_0x4520('0x32')][_0x4520('0x1f')]);_0x2d6902[_0x4520('0x1e')]=qs[_0x4520('0x1e')](_0xad9f8[_0x4520('0x32')]['offset']);}_0x2d6902[_0x4520('0x39')]=qs[_0x4520('0x3a')](_0xad9f8['query'][_0x4520('0x3a')]);_0x2d6902['where']=qs[_0x4520('0x3b')](_[_0x4520('0x3c')](_0xad9f8['query'],_0x195c58['filters']),_0x926ca0);if(_0xad9f8['query'][_0x4520('0x3d')]){_0x2d6902[_0x4520('0x3e')]=_[_0x4520('0x3f')](_0x2d6902[_0x4520('0x3e')],{'$or':_[_0x4520('0x31')](_0x926ca0,function(_0x1ca2b4){if(_0x1ca2b4[_0x4520('0x2e')]!=='VIRTUAL'){var _0x47085e={};_0x47085e[_0x1ca2b4[_0x4520('0x29')]]={'$like':'%'+_0xad9f8[_0x4520('0x32')]['filter']+'%'};return _0x47085e;}})});}_0x2d6902=_[_0x4520('0x3f')]({},_0x2d6902,_0xad9f8[_0x4520('0x40')]);var _0x5c6f84={'where':_0x2d6902['where']};return db[_0x4520('0x2c')][_0x4520('0x1d')](_0x5c6f84)[_0x4520('0x25')](function(_0x11164a){_0x180c44[_0x4520('0x1d')]=_0x11164a;if(_0xad9f8['query']['includeAll']){_0x2d6902['include']=[{'all':!![]}];}return db[_0x4520('0x2c')]['findAll'](_0x2d6902);})[_0x4520('0x25')](function(_0x54da7a){_0x180c44['rows']=_0x54da7a;return _0x180c44;})[_0x4520('0x25')](respondWithFilteredResult(_0x2c95ea,_0x2d6902))[_0x4520('0x41')](handleError(_0x2c95ea,null));};exports[_0x4520('0x42')]=function(_0x214026,_0x21e21c){var _0x59d646={'raw':!![],'where':{'id':_0x214026[_0x4520('0x43')]['id']}},_0x1675e6={};_0x1675e6['model']=_['keys'](db[_0x4520('0x2c')][_0x4520('0x44')]);_0x1675e6['query']=_[_0x4520('0x45')](_0x214026[_0x4520('0x32')]);_0x1675e6[_0x4520('0x3b')]=_[_0x4520('0x33')](_0x1675e6['model'],_0x1675e6[_0x4520('0x32')]);_0x59d646[_0x4520('0x35')]=_[_0x4520('0x33')](_0x1675e6[_0x4520('0x30')],qs[_0x4520('0x34')](_0x214026[_0x4520('0x32')][_0x4520('0x34')]));_0x59d646[_0x4520('0x35')]=_0x59d646[_0x4520('0x35')][_0x4520('0x36')]?_0x59d646[_0x4520('0x35')]:_0x1675e6[_0x4520('0x30')];if(_0x214026[_0x4520('0x32')][_0x4520('0x46')]){_0x59d646[_0x4520('0x47')]=[{'all':!![]}];}_0x59d646=_[_0x4520('0x3f')]({},_0x59d646,_0x214026[_0x4520('0x40')]);return db['CmHopperFinal'][_0x4520('0x48')](_0x59d646)[_0x4520('0x25')](handleEntityNotFound(_0x21e21c,null))['then'](respondWithResult(_0x21e21c,null))['catch'](handleError(_0x21e21c,null));};exports['describe']=function(_0x4dce4f,_0x22e62d){return db['CmHopperFinal'][_0x4520('0x49')]()[_0x4520('0x25')](respondWithResult(_0x22e62d,null))[_0x4520('0x41')](handleError(_0x22e62d,null));};exports[_0x4520('0x4a')]=function(_0x177c4e,_0x5e3eef){if(_0x177c4e[_0x4520('0x4b')][_0x4520('0x4c')]){delete _0x177c4e[_0x4520('0x4b')][_0x4520('0x4c')];}return db[_0x4520('0x2c')][_0x4520('0x48')]({'where':{'uniqueid':_0x177c4e[_0x4520('0x43')]['id']}})[_0x4520('0x25')](handleEntityNotFound(_0x5e3eef,null))[_0x4520('0x25')](saveUpdates(_0x177c4e[_0x4520('0x4b')],null))[_0x4520('0x25')](respondWithResult(_0x5e3eef,null))[_0x4520('0x41')](handleError(_0x5e3eef,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x53987b,_0x2f14c1,_0x29e14c){return db[_0x4520('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x53987b[_0x4520('0x43')]['id']},'attributes':[[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db['sequelize']['fn']('IF',db[_0x4520('0x4d')][_0x4520('0x4f')](_0x4520('0x50')))),'noSuchContacts'],[db['sequelize']['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db[_0x4520('0x4d')][_0x4520('0x4f')](_0x4520('0x51')))),_0x4520('0x52')],[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db['sequelize']['fn']('IF',db[_0x4520('0x4d')][_0x4520('0x4f')](_0x4520('0x53')))),_0x4520('0x54')],[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db[_0x4520('0x4d')][_0x4520('0x4f')](_0x4520('0x55')))),_0x4520('0x56')],[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db[_0x4520('0x4d')][_0x4520('0x4f')](_0x4520('0x57')))),'dropContacts'],[db['sequelize']['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db[_0x4520('0x4d')][_0x4520('0x4f')](_0x4520('0x58')))),_0x4520('0x59')],[db['sequelize']['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db['sequelize'][_0x4520('0x4f')](_0x4520('0x5a')))),_0x4520('0x5b')],[db[_0x4520('0x4d')]['fn']('COUNT',db[_0x4520('0x4d')]['fn']('IF',db[_0x4520('0x4d')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x4520('0x5c')]]})[_0x4520('0x25')](handleEntityNotFound(_0x2f14c1,null))[_0x4520('0x25')](respondWithResult(_0x2f14c1,null))[_0x4520('0x41')](handleError(_0x2f14c1,null));};exports[_0x4520('0x5d')]=function(_0xf5d990,_0x4e15f1,_0x402ea0){return db[_0x4520('0x2c')][_0x4520('0x5e')]({'raw':![],'where':{'CampaignId':_0xf5d990[_0x4520('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db['sequelize'][_0x4520('0x4f')]('`state`\x20=\x200,\x201,\x20null'))),_0x4520('0x5f')],[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db['sequelize'][_0x4520('0x4f')](_0x4520('0x51')))),_0x4520('0x52')],[db[_0x4520('0x4d')]['fn']('COUNT',db[_0x4520('0x4d')]['fn']('IF',db[_0x4520('0x4d')][_0x4520('0x4f')](_0x4520('0x53')))),_0x4520('0x54')],[db[_0x4520('0x4d')]['fn']('COUNT',db[_0x4520('0x4d')]['fn']('IF',db['sequelize'][_0x4520('0x4f')](_0x4520('0x55')))),_0x4520('0x56')],[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x4520('0x57')))),'dropContacts'],[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db[_0x4520('0x4d')][_0x4520('0x4f')](_0x4520('0x58')))),_0x4520('0x59')],[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db['sequelize']['fn']('IF',db[_0x4520('0x4d')]['literal'](_0x4520('0x5a')))),_0x4520('0x5b')],[db[_0x4520('0x4d')]['fn'](_0x4520('0x4e'),db[_0x4520('0x4d')]['fn']('IF',db['sequelize'][_0x4520('0x4f')](_0x4520('0x60')))),_0x4520('0x5c')]]})[_0x4520('0x25')](handleEntityNotFound(_0x4e15f1,null))['then'](respondWithResult(_0x4e15f1,null))['catch'](handleError(_0x4e15f1,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2bf316,_0x14bd13,_0x390835){return db['VoiceQueue'][_0x4520('0x48')]({'where':{'id':_0x2bf316[_0x4520('0x43')]['id']}})[_0x4520('0x25')](handleEntityNotFound(_0x14bd13,null))[_0x4520('0x25')](function(_0x163ff6){var _0x578618;if(_0x163ff6){_0x578618=squel[_0x4520('0x61')]()[_0x4520('0x62')](_0x4520('0x63'))['fromQuery']([_0x4520('0x64'),_0x4520('0x65'),_0x4520('0x66'),_0x4520('0x67'),_0x4520('0x68'),_0x4520('0x69'),_0x4520('0x6a')],squel[_0x4520('0x6b')]()['field']('ANY_VALUE(calleridnum)',_0x4520('0x64'))[_0x4520('0x6c')]('NOW()',_0x4520('0x65'))['field'](_0x4520('0x6d'),_0x4520('0x66'))['field'](_0x4520('0x6e'),_0x4520('0x67'))['field'](_0x4520('0x6f'),_0x4520('0x68'))['field'](_0x4520('0x70'),_0x4520('0x69'))[_0x4520('0x6c')]('NOW()',_0x4520('0x6a'))[_0x4520('0x71')](_0x4520('0x72'))[_0x4520('0x3e')](_0x4520('0x73'),_0x2bf316[_0x4520('0x43')]['id'][_0x4520('0x74')]())[_0x4520('0x3e')](_0x4520('0x75'),_0x2bf316[_0x4520('0x4b')][_0x4520('0x76')][_0x4520('0x74')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x4520('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4520('0x6b')]()[_0x4520('0x6c')](_0x4520('0x64'))[_0x4520('0x71')](_0x4520('0x63'))['where']('VoiceQueueId\x20=\x20?',_0x2bf316[_0x4520('0x43')]['id'][_0x4520('0x74')]()))[_0x4520('0x3e')](_0x4520('0x77'),squel[_0x4520('0x6b')]()[_0x4520('0x6c')]('calleridnum')[_0x4520('0x71')](_0x4520('0x72'))['where'](_0x4520('0x73'),_0x2bf316['params']['id']['toString']())['where'](_0x4520('0x78')))[_0x4520('0x79')](_0x4520('0x66')))[_0x4520('0x74')]();return db[_0x4520('0x4d')]['query'](_0x578618);}return[];})[_0x4520('0x25')](respondWithResult(_0x14bd13,null))[_0x4520('0x41')](handleError(_0x14bd13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x4b28ad,_0x1fdd7a,_0x1757fc){return db[_0x4520('0x7a')]['find']({'where':{'id':_0x4b28ad[_0x4520('0x43')]['id']}})[_0x4520('0x25')](handleEntityNotFound(_0x1fdd7a,null))[_0x4520('0x25')](function(_0x4866b5){var _0x80496a;if(_0x4866b5){_0x80496a=squel[_0x4520('0x61')]()['into'](_0x4520('0x63'))['fromQuery']([_0x4520('0x64'),_0x4520('0x65'),_0x4520('0x66'),_0x4520('0x67'),_0x4520('0x7b'),_0x4520('0x69'),_0x4520('0x6a')],squel['select']()[_0x4520('0x6c')]('ANY_VALUE(calleridnum)',_0x4520('0x64'))[_0x4520('0x6c')]('NOW()',_0x4520('0x65'))[_0x4520('0x6c')](_0x4520('0x6d'),_0x4520('0x66'))[_0x4520('0x6c')](_0x4520('0x6e'),_0x4520('0x67'))[_0x4520('0x6c')](_0x4520('0x7c'),_0x4520('0x7b'))[_0x4520('0x6c')]('NOW()','createdAt')['field']('NOW()','updatedAt')[_0x4520('0x71')](_0x4520('0x72'))[_0x4520('0x3e')](_0x4520('0x7d'),_0x4b28ad['params']['id'][_0x4520('0x74')]())['where'](_0x4520('0x75'),_0x4b28ad['body'][_0x4520('0x76')]['toString']())[_0x4520('0x3e')](_0x4520('0x7e'))[_0x4520('0x3e')](_0x4520('0x77'),squel['select']()[_0x4520('0x6c')]('phone')[_0x4520('0x71')](_0x4520('0x63'))[_0x4520('0x3e')](_0x4520('0x7d'),_0x4b28ad[_0x4520('0x43')]['id']['toString']()))[_0x4520('0x3e')](_0x4520('0x77'),squel['select']()[_0x4520('0x6c')](_0x4520('0x7f'))['from'](_0x4520('0x72'))['where']('CampaignId\x20=\x20?',_0x4b28ad[_0x4520('0x43')]['id'][_0x4520('0x74')]())['where'](_0x4520('0x78')))['group'](_0x4520('0x66')))[_0x4520('0x74')]();return db[_0x4520('0x4d')][_0x4520('0x32')](_0x80496a);}return[];})[_0x4520('0x25')](respondWithResult(_0x1fdd7a,null))[_0x4520('0x41')](handleError(_0x1fdd7a,null));};exports[_0x4520('0x80')]=function(_0x42d618,_0x126b39,_0x3d1121){return db[_0x4520('0x81')][_0x4520('0x82')]({'where':{'VoiceQueueId':_0x42d618[_0x4520('0x4b')][_0x4520('0x68')],'CampaignId':_0x42d618['body'][_0x4520('0x7b')],'ContactId':_0x42d618[_0x4520('0x4b')]['ContactId']}})[_0x4520('0x25')](handleEntityNotFound(_0x126b39,null))[_0x4520('0x25')](function(_0x5875b5){if(_0x5875b5){return _0x5875b5;}return null;})[_0x4520('0x25')](respondWithResult(_0x126b39,null))[_0x4520('0x41')](handleError(_0x126b39,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index f9ff7a7..a40cf90 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 _0x652b=['../../config/environment','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x20db7a,_0x34b3f9){var _0x4e1547=function(_0x4b8524){while(--_0x4b8524){_0x20db7a['push'](_0x20db7a['shift']());}};_0x4e1547(++_0x34b3f9);}(_0x652b,0x68));var _0xb652=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x652b[_0x4664db];return _0x5615b4;};'use strict';var _=require(_0xb652('0x0'));var util=require(_0xb652('0x1'));var logger=require(_0xb652('0x2'))('api');var moment=require(_0xb652('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb652('0x4'));var rimraf=require(_0xb652('0x5'));var config=require(_0xb652('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x43f467,_0x491ce7){return _0x43f467['define'](_0xb652('0x7'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xb652('0x8'),'fields':[_0xb652('0x8')]},{'name':_0xb652('0x9'),'fields':[_0xb652('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e94=['api','bluebird','path','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x30aa3d,_0x4a8951){var _0x44dc5a=function(_0x565e17){while(--_0x565e17){_0x30aa3d['push'](_0x30aa3d['shift']());}};_0x44dc5a(++_0x4a8951);}(_0x8e94,0xf8));var _0x48e9=function(_0xdfc87d,_0x28e1a5){_0xdfc87d=_0xdfc87d-0x0;var _0x4e2a5e=_0x8e94[_0xdfc87d];return _0x4e2a5e;};'use strict';var _=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var logger=require('../../config/logger')(_0x48e9('0x2'));var moment=require('moment');var BPromise=require(_0x48e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48e9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x48e9('0x5')]=function(_0x20d724,_0x5d6996){return _0x20d724[_0x48e9('0x6')]('CmHopperFinal',attributes,{'tableName':_0x48e9('0x7'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x48e9('0x8')]},{'name':_0x48e9('0x9'),'fields':[_0x48e9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8b48df2..bc6acf3 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 _0x392b=['request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','CreateCmHopperFinal','CmHopperFinal','create','options','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x392b,0x162));var _0xb392=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x392b[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xb392('0x0'));var util=require(_0xb392('0x1'));var moment=require('moment');var BPromise=require(_0xb392('0x2'));var rs=require(_0xb392('0x3'));var fs=require('fs');var Redis=require(_0xb392('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb392('0x5'));var logger=require('../../config/logger')(_0xb392('0x6'));var config=require(_0xb392('0x7'));var jayson=require(_0xb392('0x8'));var client=jayson['client'][_0xb392('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4217,_0x5d9125,_0x3e30e5){return new BPromise(function(_0x567bbf,_0x34daaf){return client[_0xb392('0xa')](_0x5d4217,_0x3e30e5)[_0xb392('0xb')](function(_0xc5930c){logger[_0xb392('0xc')](_0xb392('0xd'),_0x5d9125,'request\x20sent');logger[_0xb392('0xe')](_0xb392('0xf'),_0x5d9125,'request\x20sent',JSON['stringify'](_0xc5930c));if(_0xc5930c[_0xb392('0x10')]){if(_0xc5930c[_0xb392('0x10')][_0xb392('0x11')]===0x1f4){logger['error'](_0xb392('0xd'),_0x5d9125,_0xc5930c[_0xb392('0x10')][_0xb392('0x12')]);return _0x34daaf(_0xc5930c['error'][_0xb392('0x12')]);}logger[_0xb392('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x5d9125,_0xc5930c[_0xb392('0x10')][_0xb392('0x12')]);return _0x567bbf(_0xc5930c['error'][_0xb392('0x12')]);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x5d9125,_0xb392('0x13'));_0x567bbf(_0xc5930c[_0xb392('0x14')][_0xb392('0x12')]);}})['catch'](function(_0x31d5c5){logger[_0xb392('0x10')](_0xb392('0xd'),_0x5d9125,_0x31d5c5);_0x34daaf(_0x31d5c5);});});}exports[_0xb392('0x15')]=function(_0xb93b20){var _0x26bfe1=this;return new Promise(function(_0x3e3b2c,_0x38c80a){return db[_0xb392('0x16')][_0xb392('0x17')](_0xb93b20['body'],{'raw':_0xb93b20[_0xb392('0x18')]?_0xb93b20[_0xb392('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xb392('0xb')](function(_0x16dcfc){logger[_0xb392('0xc')](_0xb392('0x15'),_0xb93b20);logger[_0xb392('0xe')](_0xb392('0x15'),_0xb93b20,JSON['stringify'](_0x16dcfc));_0x3e3b2c(_0x16dcfc);})[_0xb392('0x19')](function(_0x12817e){logger['error'](_0xb392('0x15'),_0x12817e['message'],_0xb93b20);_0x38c80a(_0x26bfe1[_0xb392('0x10')](0x1f4,_0x12817e['message']));});});}; \ No newline at end of file +var _0x9eec=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CmHopperFinal','create','raw','CreateCmHopperFinal','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4085d8,_0x52b689){var _0x10a618=function(_0x4b7fce){while(--_0x4b7fce){_0x4085d8['push'](_0x4085d8['shift']());}};_0x10a618(++_0x52b689);}(_0x9eec,0x84));var _0xc9ee=function(_0x29f8c4,_0x43ddd6){_0x29f8c4=_0x29f8c4-0x0;var _0x234e9f=_0x9eec[_0x29f8c4];return _0x234e9f;};'use strict';var _=require(_0xc9ee('0x0'));var util=require(_0xc9ee('0x1'));var moment=require(_0xc9ee('0x2'));var BPromise=require(_0xc9ee('0x3'));var rs=require(_0xc9ee('0x4'));var fs=require('fs');var Redis=require(_0xc9ee('0x5'));var db=require(_0xc9ee('0x6'))['db'];var utils=require(_0xc9ee('0x7'));var logger=require(_0xc9ee('0x8'))(_0xc9ee('0x9'));var config=require(_0xc9ee('0xa'));var jayson=require(_0xc9ee('0xb'));var client=jayson[_0xc9ee('0xc')][_0xc9ee('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5cb884,_0x11c4a1,_0x2777f8){return new BPromise(function(_0x24220c,_0x5816ff){return client[_0xc9ee('0xe')](_0x5cb884,_0x2777f8)[_0xc9ee('0xf')](function(_0x4f75c1){logger[_0xc9ee('0x10')](_0xc9ee('0x11'),_0x11c4a1,_0xc9ee('0x12'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x11c4a1,'request\x20sent',JSON['stringify'](_0x4f75c1));if(_0x4f75c1[_0xc9ee('0x13')]){if(_0x4f75c1[_0xc9ee('0x13')][_0xc9ee('0x14')]===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x11c4a1,_0x4f75c1[_0xc9ee('0x13')][_0xc9ee('0x15')]);return _0x5816ff(_0x4f75c1[_0xc9ee('0x13')][_0xc9ee('0x15')]);}logger[_0xc9ee('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x11c4a1,_0x4f75c1[_0xc9ee('0x13')][_0xc9ee('0x15')]);return _0x24220c(_0x4f75c1['error']['message']);}else{logger[_0xc9ee('0x10')](_0xc9ee('0x11'),_0x11c4a1,_0xc9ee('0x12'));_0x24220c(_0x4f75c1['result']['message']);}})[_0xc9ee('0x16')](function(_0x1d07dd){logger[_0xc9ee('0x13')](_0xc9ee('0x11'),_0x11c4a1,_0x1d07dd);_0x5816ff(_0x1d07dd);});});}exports['CreateCmHopperFinal']=function(_0x108a01){var _0xa40ad1=this;return new Promise(function(_0x2497d8,_0x4a6728){return db[_0xc9ee('0x17')][_0xc9ee('0x18')](_0x108a01['body'],{'raw':_0x108a01['options']?_0x108a01['options'][_0xc9ee('0x19')]===undefined?!![]:![]:!![]})[_0xc9ee('0xf')](function(_0x4b5fd7){logger[_0xc9ee('0x10')](_0xc9ee('0x1a'),_0x108a01);logger[_0xc9ee('0x1b')](_0xc9ee('0x1a'),_0x108a01,JSON['stringify'](_0x4b5fd7));_0x2497d8(_0x4b5fd7);})[_0xc9ee('0x16')](function(_0x50a084){logger[_0xc9ee('0x13')](_0xc9ee('0x1a'),_0x50a084[_0xc9ee('0x15')],_0x108a01);_0x4a6728(_0xa40ad1[_0xc9ee('0x13')](0x1f4,_0x50a084[_0xc9ee('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 9c9371e..e7f3807 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 _0xfb60=['get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperFinal.controller'];(function(_0x3cdecc,_0x399ffa){var _0x397032=function(_0x1b1f70){while(--_0x1b1f70){_0x3cdecc['push'](_0x3cdecc['shift']());}};_0x397032(++_0x399ffa);}(_0xfb60,0x116));var _0x0fb6=function(_0x52d155,_0x20d557){_0x52d155=_0x52d155-0x0;var _0x175453=_0xfb60[_0x52d155];return _0x175453;};'use strict';var multer=require(_0x0fb6('0x0'));var util=require(_0x0fb6('0x1'));var path=require(_0x0fb6('0x2'));var timeout=require(_0x0fb6('0x3'));var express=require(_0x0fb6('0x4'));var router=express[_0x0fb6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fb6('0x6'));var config=require('../../config/environment');var controller=require(_0x0fb6('0x7'));router[_0x0fb6('0x8')]('/',auth[_0x0fb6('0x9')](),controller[_0x0fb6('0xa')]);router['get']('/describe',auth[_0x0fb6('0x9')](),controller[_0x0fb6('0xb')]);router[_0x0fb6('0x8')](_0x0fb6('0xc'),auth['isAuthenticated'](),controller[_0x0fb6('0xd')]);router['get'](_0x0fb6('0xe'),auth[_0x0fb6('0x9')](),controller[_0x0fb6('0xf')]);router[_0x0fb6('0x8')](_0x0fb6('0x10'),auth[_0x0fb6('0x9')](),controller[_0x0fb6('0x11')]);router[_0x0fb6('0x12')](_0x0fb6('0x13'),auth[_0x0fb6('0x9')](),controller[_0x0fb6('0x14')]);router[_0x0fb6('0x12')](_0x0fb6('0x15'),auth[_0x0fb6('0x9')](),controller[_0x0fb6('0x16')]);router[_0x0fb6('0x12')]('/checkContactHopper',auth[_0x0fb6('0x9')](),controller['checkContactHopper']);router[_0x0fb6('0x17')](_0x0fb6('0xc'),auth[_0x0fb6('0x9')](),controller[_0x0fb6('0x18')]);module[_0x0fb6('0x19')]=router; \ No newline at end of file +var _0xca74=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id'];(function(_0x4eb24f,_0x9d1734){var _0x2f5de3=function(_0x464b24){while(--_0x464b24){_0x4eb24f['push'](_0x4eb24f['shift']());}};_0x2f5de3(++_0x9d1734);}(_0xca74,0x9f));var _0x4ca7=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0xca74[_0x1db831];return _0x39ba56;};'use strict';var multer=require('multer');var util=require(_0x4ca7('0x0'));var path=require(_0x4ca7('0x1'));var timeout=require(_0x4ca7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4ca7('0x3'));var interaction=require(_0x4ca7('0x4'));var config=require(_0x4ca7('0x5'));var controller=require(_0x4ca7('0x6'));router[_0x4ca7('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4ca7('0x7')](_0x4ca7('0x8'),auth[_0x4ca7('0x9')](),controller['describe']);router['get'](_0x4ca7('0xa'),auth['isAuthenticated'](),controller[_0x4ca7('0xb')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x4ca7('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x4ca7('0x7')](_0x4ca7('0xc'),auth[_0x4ca7('0x9')](),controller[_0x4ca7('0xd')]);router['post']('/voice/queue/moveContacts/:id',auth[_0x4ca7('0x9')](),controller[_0x4ca7('0xe')]);router[_0x4ca7('0xf')](_0x4ca7('0x10'),auth[_0x4ca7('0x9')](),controller[_0x4ca7('0x11')]);router['post'](_0x4ca7('0x12'),auth[_0x4ca7('0x9')](),controller['checkContactHopper']);router[_0x4ca7('0x13')](_0x4ca7('0xa'),auth['isAuthenticated'](),controller[_0x4ca7('0x14')]);module[_0x4ca7('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 009fbc9..a7ffe3f 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 _0x52a2=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0xc2a007,_0x10abae){var _0x4f24d8=function(_0x4f8cba){while(--_0x4f8cba){_0xc2a007['push'](_0xc2a007['shift']());}};_0x4f24d8(++_0x10abae);}(_0x52a2,0x88));var _0x252a=function(_0x53d709,_0x1906f6){_0x53d709=_0x53d709-0x0;var _0xc1f741=_0x52a2[_0x53d709];return _0xc1f741;};'use strict';var Sequelize=require(_0x252a('0x0'));module[_0x252a('0x1')]={'state':{'type':Sequelize[_0x252a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x252a('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x252a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x252a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x252a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x252a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x252a('0x3')]},'originatecalleridname':{'type':Sequelize[_0x252a('0x3')]},'calleridnum':{'type':Sequelize[_0x252a('0x3')]},'calleridname':{'type':Sequelize[_0x252a('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x252a('0x4')]},'droptime':{'type':Sequelize[_0x252a('0x4')]},'endtime':{'type':Sequelize[_0x252a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x252a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x252a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x252a('0x3')]},'campaign':{'type':Sequelize[_0x252a('0x3')]},'campaigntype':{'type':Sequelize[_0x252a('0x3')]},'membername':{'type':Sequelize[_0x252a('0x3')]},'reason':{'type':Sequelize[_0x252a('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x252a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x252a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x252a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x252a('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x252a('0x4')]},'edited':{'type':Sequelize[_0x252a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x252a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x252a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x252a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x252a('0x3')]}}; \ No newline at end of file +var _0xb160=['BOOLEAN','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x10bc07,_0x277d97){var _0x3b65ee=function(_0x51b62f){while(--_0x51b62f){_0x10bc07['push'](_0x10bc07['shift']());}};_0x3b65ee(++_0x277d97);}(_0xb160,0xf1));var _0x0b16=function(_0x50e053,_0x3b3464){_0x50e053=_0x50e053-0x0;var _0x27a68f=_0xb160[_0x50e053];return _0x27a68f;};'use strict';var Sequelize=require(_0x0b16('0x0'));module[_0x0b16('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0b16('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0b16('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x0b16('0x2')]},'calleridnum':{'type':Sequelize[_0x0b16('0x2')]},'calleridname':{'type':Sequelize[_0x0b16('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0b16('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0b16('0x4')]},'endtime':{'type':Sequelize[_0x0b16('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0b16('0x2')]},'campaign':{'type':Sequelize[_0x0b16('0x2')]},'campaigntype':{'type':Sequelize[_0x0b16('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x0b16('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0b16('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0b16('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0b16('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x0b16('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0b16('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0b16('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c2a9c31..00861ef 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 _0x795a=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','type','key','model','name','query','attributes','intersection','fields','length','nolimit','limit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x519d31,_0x442b7b){var _0x4bf6d1=function(_0x43c4bc){while(--_0x43c4bc){_0x519d31['push'](_0x519d31['shift']());}};_0x4bf6d1(++_0x442b7b);}(_0x795a,0x8d));var _0xa795=function(_0x550c3f,_0x528a5d){_0x550c3f=_0x550c3f-0x0;var _0x3fe7c1=_0x795a[_0x550c3f];return _0x3fe7c1;};'use strict';var pdf=require(_0xa795('0x0'));var emlformat=require(_0xa795('0x1'));var rimraf=require(_0xa795('0x2'));var zipdir=require(_0xa795('0x3'));var jsonpatch=require(_0xa795('0x4'));var rp=require(_0xa795('0x5'));var moment=require(_0xa795('0x6'));var BPromise=require(_0xa795('0x7'));var Mustache=require(_0xa795('0x8'));var util=require(_0xa795('0x9'));var path=require('path');var sox=require(_0xa795('0xa'));var csv=require(_0xa795('0xb'));var ejs=require(_0xa795('0xc'));var fs=require('fs');var _=require(_0xa795('0xd'));var squel=require(_0xa795('0xe'));var crypto=require(_0xa795('0xf'));var jsforce=require(_0xa795('0x10'));var deskjs=require(_0xa795('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa795('0x12'));var Papa=require(_0xa795('0x13'));var Redis=require(_0xa795('0x14'));var authService=require(_0xa795('0x15'));var qs=require(_0xa795('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa795('0x17'));var logger=require('../../config/logger')(_0xa795('0x18'));var utils=require(_0xa795('0x19'));var config=require('../../config/environment');var db=require(_0xa795('0x1a'))['db'];function respondWithStatusCode(_0x34324b,_0x217695){_0x217695=_0x217695||0xcc;return function(_0x53dff0){if(_0x53dff0){return _0x34324b[_0xa795('0x1b')](_0x217695);}return _0x34324b[_0xa795('0x1c')](_0x217695)['end']();};}function respondWithResult(_0x1d4666,_0x4e8aa0){_0x4e8aa0=_0x4e8aa0||0xc8;return function(_0x283f8f){if(_0x283f8f){return _0x1d4666[_0xa795('0x1c')](_0x4e8aa0)[_0xa795('0x1d')](_0x283f8f);}};}function respondWithFilteredResult(_0x30e220,_0x14f092){return function(_0x57ad24){if(_0x57ad24){var _0x10ae62=_0x57ad24[_0xa795('0x1e')],_0x328f6e=_0x14f092['offset'],_0x5a6344=_0x14f092['offset']+_0x14f092['limit'],_0x52c093;if(_0x5a6344>=_0x10ae62){_0x5a6344=_0x10ae62;_0x52c093=0xc8;}else{_0x52c093=0xce;}_0x30e220[_0xa795('0x1c')](_0x52c093);return _0x30e220[_0xa795('0x1f')](_0xa795('0x20'),_0x328f6e+'-'+_0x5a6344+'/'+_0x10ae62)['json'](_0x57ad24);}return null;};}function patchUpdates(_0xa43d6c){return function(_0x1021f5){try{jsonpatch[_0xa795('0x21')](_0x1021f5,_0xa43d6c,!![]);}catch(_0x509c4e){return BPromise[_0xa795('0x22')](_0x509c4e);}return _0x1021f5[_0xa795('0x23')]();};}function saveUpdates(_0x342259,_0x2a2f5c){return function(_0x41e1ba){if(_0x41e1ba){return _0x41e1ba[_0xa795('0x24')](_0x342259)[_0xa795('0x25')](function(_0x1f07ca){return _0x1f07ca;});}return null;};}function removeEntity(_0x1065d2,_0x5ad587){return function(_0x65d4d0){if(_0x65d4d0){return _0x65d4d0['destroy']()[_0xa795('0x25')](function(){_0x1065d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e7d9,_0xcda60b){return function(_0x1cf68c){if(!_0x1cf68c){_0x48e7d9[_0xa795('0x1b')](0x194);}return _0x1cf68c;};}function handleError(_0x3c9684,_0x2b514b){_0x2b514b=_0x2b514b||0x1f4;return function(_0x3bb273){logger['error'](_0x3bb273[_0xa795('0x26')]);if(_0x3bb273['name']){delete _0x3bb273['name'];}_0x3c9684['status'](_0x2b514b)[_0xa795('0x27')](_0x3bb273);};}exports[_0xa795('0x28')]=function(_0x2e2f5f,_0x2525cf){var _0x37abf5={},_0x2491b5={},_0x2c3250={'count':0x0,'rows':[]};var _0x28ba8a=_[_0xa795('0x29')](db['CmHopperHistory']['rawAttributes'],function(_0x1899f3){return{'name':_0x1899f3['fieldName'],'type':_0x1899f3[_0xa795('0x2a')][_0xa795('0x2b')]};});_0x2491b5[_0xa795('0x2c')]=_['map'](_0x28ba8a,_0xa795('0x2d'));_0x2491b5[_0xa795('0x2e')]=_['keys'](_0x2e2f5f['query']);_0x2491b5['filters']=_['intersection'](_0x2491b5[_0xa795('0x2c')],_0x2491b5[_0xa795('0x2e')]);_0x37abf5[_0xa795('0x2f')]=_[_0xa795('0x30')](_0x2491b5[_0xa795('0x2c')],qs['fields'](_0x2e2f5f['query'][_0xa795('0x31')]));_0x37abf5['attributes']=_0x37abf5[_0xa795('0x2f')][_0xa795('0x32')]?_0x37abf5[_0xa795('0x2f')]:_0x2491b5['model'];if(!_0x2e2f5f[_0xa795('0x2e')]['hasOwnProperty'](_0xa795('0x33'))){_0x37abf5[_0xa795('0x34')]=qs['limit'](_0x2e2f5f[_0xa795('0x2e')][_0xa795('0x34')]);_0x37abf5[_0xa795('0x35')]=qs[_0xa795('0x35')](_0x2e2f5f['query']['offset']);}_0x37abf5['order']=qs[_0xa795('0x36')](_0x2e2f5f[_0xa795('0x2e')]['sort']);_0x37abf5[_0xa795('0x37')]=qs[_0xa795('0x38')](_[_0xa795('0x39')](_0x2e2f5f['query'],_0x2491b5[_0xa795('0x38')]),_0x28ba8a);if(_0x2e2f5f[_0xa795('0x2e')][_0xa795('0x3a')]){_0x37abf5[_0xa795('0x37')]=_[_0xa795('0x3b')](_0x37abf5['where'],{'$or':_[_0xa795('0x29')](_0x28ba8a,function(_0x2b8805){if(_0x2b8805['type']!==_0xa795('0x3c')){var _0x2053b3={};_0x2053b3[_0x2b8805['name']]={'$like':'%'+_0x2e2f5f[_0xa795('0x2e')][_0xa795('0x3a')]+'%'};return _0x2053b3;}})});}_0x37abf5=_['merge']({},_0x37abf5,_0x2e2f5f[_0xa795('0x3d')]);var _0x30baa2={'where':_0x37abf5[_0xa795('0x37')]};return db[_0xa795('0x3e')][_0xa795('0x1e')](_0x30baa2)[_0xa795('0x25')](function(_0x5bee3d){_0x2c3250[_0xa795('0x1e')]=_0x5bee3d;if(_0x2e2f5f[_0xa795('0x2e')][_0xa795('0x3f')]){_0x37abf5[_0xa795('0x40')]=[{'all':!![]}];}return db[_0xa795('0x3e')][_0xa795('0x41')](_0x37abf5);})[_0xa795('0x25')](function(_0x9bc625){_0x2c3250['rows']=_0x9bc625;return _0x2c3250;})[_0xa795('0x25')](respondWithFilteredResult(_0x2525cf,_0x37abf5))[_0xa795('0x42')](handleError(_0x2525cf,null));};exports['show']=function(_0x1e62f6,_0x44d105){var _0x5f5e03={'raw':!![],'where':{'id':_0x1e62f6[_0xa795('0x43')]['id']}},_0x3e8053={};_0x3e8053['model']=_[_0xa795('0x44')](db['CmHopperHistory'][_0xa795('0x45')]);_0x3e8053[_0xa795('0x2e')]=_[_0xa795('0x44')](_0x1e62f6[_0xa795('0x2e')]);_0x3e8053['filters']=_['intersection'](_0x3e8053[_0xa795('0x2c')],_0x3e8053[_0xa795('0x2e')]);_0x5f5e03[_0xa795('0x2f')]=_[_0xa795('0x30')](_0x3e8053['model'],qs['fields'](_0x1e62f6[_0xa795('0x2e')][_0xa795('0x31')]));_0x5f5e03['attributes']=_0x5f5e03['attributes']['length']?_0x5f5e03[_0xa795('0x2f')]:_0x3e8053[_0xa795('0x2c')];if(_0x1e62f6[_0xa795('0x2e')][_0xa795('0x3f')]){_0x5f5e03[_0xa795('0x40')]=[{'all':!![]}];}_0x5f5e03=_[_0xa795('0x3b')]({},_0x5f5e03,_0x1e62f6['options']);return db[_0xa795('0x3e')][_0xa795('0x46')](_0x5f5e03)[_0xa795('0x25')](handleEntityNotFound(_0x44d105,null))['then'](respondWithResult(_0x44d105,null))[_0xa795('0x42')](handleError(_0x44d105,null));};exports[_0xa795('0x47')]=function(_0x1cd3ec,_0x598daa){return db[_0xa795('0x3e')][_0xa795('0x47')](_0x1cd3ec[_0xa795('0x48')],{})[_0xa795('0x25')](respondWithResult(_0x598daa,0xc9))[_0xa795('0x42')](handleError(_0x598daa,null));};exports[_0xa795('0x49')]=function(_0x1bc0cf,_0x20a88c){return db[_0xa795('0x3e')][_0xa795('0x49')]()[_0xa795('0x25')](respondWithResult(_0x20a88c,null))[_0xa795('0x42')](handleError(_0x20a88c,null));};exports['update']=function(_0x5c1bd8,_0x313671){if(_0x5c1bd8[_0xa795('0x48')][_0xa795('0x4a')]){delete _0x5c1bd8[_0xa795('0x48')][_0xa795('0x4a')];}return db[_0xa795('0x3e')][_0xa795('0x46')]({'where':{'uniqueid':_0x5c1bd8['params']['id']}})[_0xa795('0x25')](handleEntityNotFound(_0x313671,null))[_0xa795('0x25')](saveUpdates(_0x5c1bd8['body'],null))['then'](respondWithResult(_0x313671,null))[_0xa795('0x42')](handleError(_0x313671,null));}; \ No newline at end of file +var _0xf2b1=['fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','length','include','find','body','describe','uniqueid','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','status','Content-Range','json','reject','then','destroy','error','name','index','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x786e23,_0x425e18){var _0x4c347b=function(_0x2125cf){while(--_0x2125cf){_0x786e23['push'](_0x786e23['shift']());}};_0x4c347b(++_0x425e18);}(_0xf2b1,0x17a));var _0x1f2b=function(_0x2920dd,_0x19d049){_0x2920dd=_0x2920dd-0x0;var _0x5d4e52=_0xf2b1[_0x2920dd];return _0x5d4e52;};'use strict';var pdf=require(_0x1f2b('0x0'));var emlformat=require(_0x1f2b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f2b('0x2'));var rp=require(_0x1f2b('0x3'));var moment=require(_0x1f2b('0x4'));var BPromise=require(_0x1f2b('0x5'));var Mustache=require(_0x1f2b('0x6'));var util=require(_0x1f2b('0x7'));var path=require('path');var sox=require(_0x1f2b('0x8'));var csv=require(_0x1f2b('0x9'));var ejs=require(_0x1f2b('0xa'));var fs=require('fs');var _=require(_0x1f2b('0xb'));var squel=require(_0x1f2b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1f2b('0xd'));var toCsv=require(_0x1f2b('0x9'));var querystring=require(_0x1f2b('0xe'));var Papa=require(_0x1f2b('0xf'));var Redis=require(_0x1f2b('0x10'));var authService=require(_0x1f2b('0x11'));var qs=require(_0x1f2b('0x12'));var as=require(_0x1f2b('0x13'));var hardwareService=require(_0x1f2b('0x14'));var logger=require(_0x1f2b('0x15'))(_0x1f2b('0x16'));var utils=require(_0x1f2b('0x17'));var config=require(_0x1f2b('0x18'));var db=require(_0x1f2b('0x19'))['db'];function respondWithStatusCode(_0x13ff32,_0x5ef855){_0x5ef855=_0x5ef855||0xcc;return function(_0x2b686e){if(_0x2b686e){return _0x13ff32[_0x1f2b('0x1a')](_0x5ef855);}return _0x13ff32['status'](_0x5ef855)[_0x1f2b('0x1b')]();};}function respondWithResult(_0x1c9b5f,_0x28fed6){_0x28fed6=_0x28fed6||0xc8;return function(_0x665269){if(_0x665269){return _0x1c9b5f['status'](_0x28fed6)['json'](_0x665269);}};}function respondWithFilteredResult(_0x5186a9,_0x511167){return function(_0x190653){if(_0x190653){var _0x217b9d=_0x190653[_0x1f2b('0x1c')],_0x2d8e46=_0x511167['offset'],_0x134393=_0x511167['offset']+_0x511167['limit'],_0x21306c;if(_0x134393>=_0x217b9d){_0x134393=_0x217b9d;_0x21306c=0xc8;}else{_0x21306c=0xce;}_0x5186a9[_0x1f2b('0x1d')](_0x21306c);return _0x5186a9['set'](_0x1f2b('0x1e'),_0x2d8e46+'-'+_0x134393+'/'+_0x217b9d)[_0x1f2b('0x1f')](_0x190653);}return null;};}function patchUpdates(_0xf657a6){return function(_0x2652eb){try{jsonpatch['apply'](_0x2652eb,_0xf657a6,!![]);}catch(_0x3e2b1c){return BPromise[_0x1f2b('0x20')](_0x3e2b1c);}return _0x2652eb['save']();};}function saveUpdates(_0x340dc2,_0x4fdfaa){return function(_0x24e775){if(_0x24e775){return _0x24e775['update'](_0x340dc2)[_0x1f2b('0x21')](function(_0x48fa2f){return _0x48fa2f;});}return null;};}function removeEntity(_0x47b874,_0x2ce879){return function(_0x4d3a07){if(_0x4d3a07){return _0x4d3a07[_0x1f2b('0x22')]()[_0x1f2b('0x21')](function(){_0x47b874['status'](0xcc)[_0x1f2b('0x1b')]();});}};}function handleEntityNotFound(_0x2c5418,_0x58414f){return function(_0x1d0938){if(!_0x1d0938){_0x2c5418['sendStatus'](0x194);}return _0x1d0938;};}function handleError(_0x37ebb5,_0x1edfdf){_0x1edfdf=_0x1edfdf||0x1f4;return function(_0x3581db){logger[_0x1f2b('0x23')](_0x3581db['stack']);if(_0x3581db[_0x1f2b('0x24')]){delete _0x3581db[_0x1f2b('0x24')];}_0x37ebb5[_0x1f2b('0x1d')](_0x1edfdf)['send'](_0x3581db);};}exports[_0x1f2b('0x25')]=function(_0x1d69fb,_0x2c08ee){var _0x157e06={},_0x2f09b5={},_0x567037={'count':0x0,'rows':[]};var _0x60caa6=_['map'](db[_0x1f2b('0x26')][_0x1f2b('0x27')],function(_0x3c0784){return{'name':_0x3c0784[_0x1f2b('0x28')],'type':_0x3c0784[_0x1f2b('0x29')]['key']};});_0x2f09b5[_0x1f2b('0x2a')]=_['map'](_0x60caa6,_0x1f2b('0x24'));_0x2f09b5[_0x1f2b('0x2b')]=_[_0x1f2b('0x2c')](_0x1d69fb[_0x1f2b('0x2b')]);_0x2f09b5[_0x1f2b('0x2d')]=_[_0x1f2b('0x2e')](_0x2f09b5['model'],_0x2f09b5['query']);_0x157e06[_0x1f2b('0x2f')]=_[_0x1f2b('0x2e')](_0x2f09b5[_0x1f2b('0x2a')],qs['fields'](_0x1d69fb[_0x1f2b('0x2b')][_0x1f2b('0x30')]));_0x157e06[_0x1f2b('0x2f')]=_0x157e06[_0x1f2b('0x2f')]['length']?_0x157e06[_0x1f2b('0x2f')]:_0x2f09b5[_0x1f2b('0x2a')];if(!_0x1d69fb[_0x1f2b('0x2b')][_0x1f2b('0x31')](_0x1f2b('0x32'))){_0x157e06[_0x1f2b('0x33')]=qs['limit'](_0x1d69fb[_0x1f2b('0x2b')]['limit']);_0x157e06[_0x1f2b('0x34')]=qs[_0x1f2b('0x34')](_0x1d69fb[_0x1f2b('0x2b')][_0x1f2b('0x34')]);}_0x157e06[_0x1f2b('0x35')]=qs['sort'](_0x1d69fb[_0x1f2b('0x2b')][_0x1f2b('0x36')]);_0x157e06[_0x1f2b('0x37')]=qs[_0x1f2b('0x2d')](_[_0x1f2b('0x38')](_0x1d69fb['query'],_0x2f09b5['filters']),_0x60caa6);if(_0x1d69fb[_0x1f2b('0x2b')][_0x1f2b('0x39')]){_0x157e06['where']=_['merge'](_0x157e06[_0x1f2b('0x37')],{'$or':_['map'](_0x60caa6,function(_0x9255fd){if(_0x9255fd[_0x1f2b('0x29')]!==_0x1f2b('0x3a')){var _0x58c335={};_0x58c335[_0x9255fd['name']]={'$like':'%'+_0x1d69fb[_0x1f2b('0x2b')][_0x1f2b('0x39')]+'%'};return _0x58c335;}})});}_0x157e06=_[_0x1f2b('0x3b')]({},_0x157e06,_0x1d69fb[_0x1f2b('0x3c')]);var _0x1966c9={'where':_0x157e06[_0x1f2b('0x37')]};return db[_0x1f2b('0x26')][_0x1f2b('0x1c')](_0x1966c9)['then'](function(_0x911977){_0x567037['count']=_0x911977;if(_0x1d69fb[_0x1f2b('0x2b')][_0x1f2b('0x3d')]){_0x157e06['include']=[{'all':!![]}];}return db[_0x1f2b('0x26')][_0x1f2b('0x3e')](_0x157e06);})[_0x1f2b('0x21')](function(_0x4a35e4){_0x567037[_0x1f2b('0x3f')]=_0x4a35e4;return _0x567037;})['then'](respondWithFilteredResult(_0x2c08ee,_0x157e06))[_0x1f2b('0x40')](handleError(_0x2c08ee,null));};exports['show']=function(_0x34b271,_0x1380bc){var _0x414b71={'raw':!![],'where':{'id':_0x34b271['params']['id']}},_0x583def={};_0x583def[_0x1f2b('0x2a')]=_['keys'](db[_0x1f2b('0x26')][_0x1f2b('0x27')]);_0x583def[_0x1f2b('0x2b')]=_[_0x1f2b('0x2c')](_0x34b271[_0x1f2b('0x2b')]);_0x583def[_0x1f2b('0x2d')]=_['intersection'](_0x583def['model'],_0x583def[_0x1f2b('0x2b')]);_0x414b71[_0x1f2b('0x2f')]=_[_0x1f2b('0x2e')](_0x583def[_0x1f2b('0x2a')],qs[_0x1f2b('0x30')](_0x34b271[_0x1f2b('0x2b')][_0x1f2b('0x30')]));_0x414b71['attributes']=_0x414b71['attributes'][_0x1f2b('0x41')]?_0x414b71[_0x1f2b('0x2f')]:_0x583def[_0x1f2b('0x2a')];if(_0x34b271[_0x1f2b('0x2b')]['includeAll']){_0x414b71[_0x1f2b('0x42')]=[{'all':!![]}];}_0x414b71=_['merge']({},_0x414b71,_0x34b271[_0x1f2b('0x3c')]);return db[_0x1f2b('0x26')][_0x1f2b('0x43')](_0x414b71)[_0x1f2b('0x21')](handleEntityNotFound(_0x1380bc,null))[_0x1f2b('0x21')](respondWithResult(_0x1380bc,null))[_0x1f2b('0x40')](handleError(_0x1380bc,null));};exports['create']=function(_0x58a105,_0x184f25){return db[_0x1f2b('0x26')]['create'](_0x58a105[_0x1f2b('0x44')],{})[_0x1f2b('0x21')](respondWithResult(_0x184f25,0xc9))['catch'](handleError(_0x184f25,null));};exports[_0x1f2b('0x45')]=function(_0x44eed2,_0x1311c7){return db[_0x1f2b('0x26')][_0x1f2b('0x45')]()['then'](respondWithResult(_0x1311c7,null))['catch'](handleError(_0x1311c7,null));};exports['update']=function(_0x5af8df,_0x5bfab7){if(_0x5af8df[_0x1f2b('0x44')][_0x1f2b('0x46')]){delete _0x5af8df['body'][_0x1f2b('0x46')];}return db['CmHopperHistory'][_0x1f2b('0x43')]({'where':{'uniqueid':_0x5af8df['params']['id']}})[_0x1f2b('0x21')](handleEntityNotFound(_0x5bfab7,null))[_0x1f2b('0x21')](saveUpdates(_0x5af8df[_0x1f2b('0x44')],null))[_0x1f2b('0x21')](respondWithResult(_0x5bfab7,null))[_0x1f2b('0x40')](handleError(_0x5bfab7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 956a014..3e04b9b 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 _0x9d8f=['request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1949fc,_0x36f1b0){var _0x4420bb=function(_0x52c54f){while(--_0x52c54f){_0x1949fc['push'](_0x1949fc['shift']());}};_0x4420bb(++_0x36f1b0);}(_0x9d8f,0xa0));var _0xf9d8=function(_0x154511,_0xd61d44){_0x154511=_0x154511-0x0;var _0x47beed=_0x9d8f[_0x154511];return _0x47beed;};'use strict';var _=require(_0xf9d8('0x0'));var util=require('util');var logger=require(_0xf9d8('0x1'))(_0xf9d8('0x2'));var moment=require(_0xf9d8('0x3'));var BPromise=require(_0xf9d8('0x4'));var rp=require(_0xf9d8('0x5'));var fs=require('fs');var path=require(_0xf9d8('0x6'));var rimraf=require(_0xf9d8('0x7'));var config=require(_0xf9d8('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xf9d8('0x9')]=function(_0x1845f1,_0x3f6181){return _0x1845f1[_0xf9d8('0xa')](_0xf9d8('0xb'),attributes,{'tableName':_0xf9d8('0xc'),'paranoid':![],'indexes':[{'name':_0xf9d8('0xd'),'fields':[_0xf9d8('0xd')]},{'name':_0xf9d8('0xe'),'fields':[_0xf9d8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6817=['endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6817,0x11f));var _0x7681=function(_0x2b9cf2,_0x19cb39){_0x2b9cf2=_0x2b9cf2-0x0;var _0x40dcea=_0x6817[_0x2b9cf2];return _0x40dcea;};'use strict';var _=require(_0x7681('0x0'));var util=require(_0x7681('0x1'));var logger=require(_0x7681('0x2'))(_0x7681('0x3'));var moment=require('moment');var BPromise=require(_0x7681('0x4'));var rp=require(_0x7681('0x5'));var fs=require('fs');var path=require(_0x7681('0x6'));var rimraf=require(_0x7681('0x7'));var config=require(_0x7681('0x8'));var attributes=require(_0x7681('0x9'));module[_0x7681('0xa')]=function(_0x4a83e5,_0x4f9341){return _0x4a83e5[_0x7681('0xb')]('CmHopperHistory',attributes,{'tableName':_0x7681('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x7681('0xd')]},{'name':_0x7681('0xe'),'fields':[_0x7681('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8e68423..30150fb 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 _0x4fc2=['request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s'];(function(_0x23dd59,_0xbfaa87){var _0x4ba733=function(_0x116c99){while(--_0x116c99){_0x23dd59['push'](_0x23dd59['shift']());}};_0x4ba733(++_0xbfaa87);}(_0x4fc2,0x111));var _0x24fc=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0x4fc2[_0x110d59];return _0x2fce64;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['CreateCmHopperHistory']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['CmHopperHistory'][_0x24fc('0x17')](_0x23873c[_0x24fc('0x18')],{'raw':_0x23873c[_0x24fc('0x19')]?_0x23873c['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![]})[_0x24fc('0xc')](function(_0xbf1d6b){logger[_0x24fc('0xd')]('CreateCmHopperHistory',_0x23873c);logger[_0x24fc('0x10')]('CreateCmHopperHistory',_0x23873c,JSON[_0x24fc('0x12')](_0xbf1d6b));_0x6cfa0a(_0xbf1d6b);})['catch'](function(_0x3ed464){logger[_0x24fc('0x13')](_0x24fc('0x1b'),_0x3ed464['message'],_0x23873c);_0x8ac114(_0x1cb3d0[_0x24fc('0x13')](0x1f4,_0x3ed464['message']));});});};exports[_0x24fc('0x1c')]=function(_0x2bb93a){var _0x36a9b4=this;return new Promise(function(_0x34b5b2,_0x3296fc){return db[_0x24fc('0x1d')][_0x24fc('0x1e')]({'raw':_0x2bb93a[_0x24fc('0x19')]?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bb93a['options']?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x1f')]||null:null,'attributes':[[db[_0x24fc('0x20')]['fn']('COUNT',db[_0x24fc('0x20')][_0x24fc('0x21')]('id')),_0x24fc('0x22')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x25')))),_0x24fc('0x26')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x24fc('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')]['literal'](_0x24fc('0x28')))),_0x24fc('0x29')],[db['sequelize']['fn'](_0x24fc('0x2a'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize']['literal'](_0x24fc('0x2b')))),'predictiveIntervalAvgHoldtime'],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x2a'),db['sequelize']['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x2c')))),_0x24fc('0x2d')]]})[_0x24fc('0xc')](function(_0x1e205d){logger[_0x24fc('0xd')](_0x24fc('0x1c'),_0x2bb93a);logger[_0x24fc('0x10')]('AvgHandleTime',_0x2bb93a,JSON[_0x24fc('0x12')](_0x1e205d));_0x34b5b2(_0x1e205d);})[_0x24fc('0x16')](function(_0x2fbe30){logger[_0x24fc('0x13')](_0x24fc('0x1c'),_0x2fbe30['message'],_0x2bb93a);_0x3296fc(_0x36a9b4['error'](0x1f4,_0x2fbe30[_0x24fc('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x22ef18){var _0x38798d=this;return new Promise(function(_0x10399f,_0x41b408){return db['CmHopperHistory'][_0x24fc('0x1e')]({'raw':_0x22ef18['options']?_0x22ef18[_0x24fc('0x19')][_0x24fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x22ef18[_0x24fc('0x19')]?_0x22ef18[_0x24fc('0x19')][_0x24fc('0x1f')]||null:null,'attributes':[['campaign',_0x24fc('0x2e')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x24fc('0x20')]['fn']('COUNT',db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x30')))),_0x24fc('0x31')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x25')))),_0x24fc('0x32')],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x33')))),_0x24fc('0x34')],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')](_0x24fc('0x35')))),_0x24fc('0x36')],[db[_0x24fc('0x20')]['fn']('COUNT',db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x37')))),_0x24fc('0x38')],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x24fc('0x39')],[db[_0x24fc('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x24fc('0x20')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x24fc('0x3a')],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')]['literal'](_0x24fc('0x3b')))),_0x24fc('0x3c')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x24fc('0x3e')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')][_0x24fc('0x24')](_0x24fc('0x3f')))),_0x24fc('0x40')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db[_0x24fc('0x20')]['literal'](_0x24fc('0x41')))),_0x24fc('0x3e')],[db[_0x24fc('0x20')]['fn'](_0x24fc('0x23'),db[_0x24fc('0x20')]['fn']('IF',db['sequelize'][_0x24fc('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x24fc('0x42')]],'group':[_0x24fc('0x43')]})[_0x24fc('0xc')](function(_0x41ddfb){logger[_0x24fc('0xd')](_0x24fc('0x44'),_0x22ef18);logger['debug'](_0x24fc('0x44'),_0x22ef18,JSON[_0x24fc('0x12')](_0x41ddfb));_0x10399f(_0x41ddfb);})[_0x24fc('0x16')](function(_0x31a2ef){logger[_0x24fc('0x13')](_0x24fc('0x44'),_0x31a2ef['message'],_0x22ef18);_0x41b408(_0x38798d[_0x24fc('0x13')](0x1f4,_0x31a2ef[_0x24fc('0x15')]));});});};exports[_0x24fc('0x45')]=function(_0x1b69ad){var _0x3e739d=this;return new Promise(function(_0x385968,_0x1ffd5b){return db['CmHopperHistory'][_0x24fc('0x1e')]({'raw':_0x1b69ad[_0x24fc('0x19')]?_0x1b69ad['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b69ad[_0x24fc('0x19')]?_0x1b69ad[_0x24fc('0x19')][_0x24fc('0x1f')]||null:null,'attributes':[[_0x24fc('0x43'),_0x24fc('0x2e')],[db['sequelize']['fn'](_0x24fc('0x23'),db['sequelize'][_0x24fc('0x21')]('id')),_0x24fc('0x46')],[db['sequelize']['fn'](_0x24fc('0x23'),db['sequelize']['fn']('IF',db[_0x24fc('0x20')]['literal'](_0x24fc('0x25')))),_0x24fc('0x47')]],'group':['campaign']})[_0x24fc('0xc')](function(_0x5d6539){logger[_0x24fc('0xd')](_0x24fc('0x45'),_0x1b69ad);logger['debug'](_0x24fc('0x45'),_0x1b69ad,JSON[_0x24fc('0x12')](_0x5d6539));_0x385968(_0x5d6539);})[_0x24fc('0x16')](function(_0x47179d){logger[_0x24fc('0x13')]('GetCampaignHopperHistory',_0x47179d[_0x24fc('0x15')],_0x1b69ad);_0x1ffd5b(_0x3e739d[_0x24fc('0x13')](0x1f4,_0x47179d[_0x24fc('0x15')]));});});}; \ No newline at end of file +var _0x3423=['`state`\x20=\x204,\x201,\x20null','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','`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','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','name','ivrTotalCallsDays','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','debug','catch','AvgHandleTime','where','col','predictiveIntervalTotalCalls','sequelize','literal'];(function(_0x3dac2c,_0x2ad312){var _0x23f73a=function(_0x4fbb2a){while(--_0x4fbb2a){_0x3dac2c['push'](_0x3dac2c['shift']());}};_0x23f73a(++_0x2ad312);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c40c,_0x420d4b,_0x76422d){return new BPromise(function(_0xce08ab,_0x305d13){return client[_0x3342('0xc')](_0x29c40c,_0x76422d)[_0x3342('0xd')](function(_0x4ae4f3){logger['info'](_0x3342('0xe'),_0x420d4b,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x420d4b,'request\x20sent',JSON[_0x3342('0xf')](_0x4ae4f3));if(_0x4ae4f3[_0x3342('0x10')]){if(_0x4ae4f3['error'][_0x3342('0x11')]===0x1f4){logger['error'](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')]['message']);return _0x305d13(_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);}logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);return _0xce08ab(_0x4ae4f3[_0x3342('0x10')]['message']);}else{logger[_0x3342('0x13')](_0x3342('0xe'),_0x420d4b,'request\x20sent');_0xce08ab(_0x4ae4f3[_0x3342('0x14')][_0x3342('0x12')]);}})['catch'](function(_0x554f9c){logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x554f9c);_0x305d13(_0x554f9c);});});}exports[_0x3342('0x15')]=function(_0x2075cb){var _0x12947a=this;return new Promise(function(_0x156c24,_0x45a3ca){return db[_0x3342('0x16')][_0x3342('0x17')](_0x2075cb['body'],{'raw':_0x2075cb[_0x3342('0x18')]?_0x2075cb[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3cb86f){logger[_0x3342('0x13')]('CreateCmHopperHistory',_0x2075cb);logger[_0x3342('0x1a')](_0x3342('0x15'),_0x2075cb,JSON['stringify'](_0x3cb86f));_0x156c24(_0x3cb86f);})[_0x3342('0x1b')](function(_0x5a0658){logger[_0x3342('0x10')](_0x3342('0x15'),_0x5a0658[_0x3342('0x12')],_0x2075cb);_0x45a3ca(_0x12947a[_0x3342('0x10')](0x1f4,_0x5a0658[_0x3342('0x12')]));});});};exports[_0x3342('0x1c')]=function(_0x26eb87){var _0x2d8622=this;return new Promise(function(_0x5d4f14,_0x30ffc9){return db['CmHopperHistory']['findAll']({'raw':_0x26eb87[_0x3342('0x18')]?_0x26eb87['options']['raw']===undefined?!![]:![]:!![],'where':_0x26eb87[_0x3342('0x18')]?_0x26eb87['options'][_0x3342('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x3342('0x1e')]('id')),_0x3342('0x1f')],[db[_0x3342('0x20')]['fn']('COUNT',db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x24')))),_0x3342('0x25')],[db['sequelize']['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3342('0x26')],[db[_0x3342('0x20')]['fn'](_0x3342('0x27'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x28')))),_0x3342('0x29')],[db[_0x3342('0x20')]['fn'](_0x3342('0x27'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x2a')))),_0x3342('0x2b')]]})[_0x3342('0xd')](function(_0x30dcea){logger['info']('AvgHandleTime',_0x26eb87);logger[_0x3342('0x1a')]('AvgHandleTime',_0x26eb87,JSON[_0x3342('0xf')](_0x30dcea));_0x5d4f14(_0x30dcea);})[_0x3342('0x1b')](function(_0x1a74d3){logger[_0x3342('0x10')](_0x3342('0x1c'),_0x1a74d3[_0x3342('0x12')],_0x26eb87);_0x30ffc9(_0x2d8622[_0x3342('0x10')](0x1f4,_0x1a74d3['message']));});});};exports[_0x3342('0x2c')]=function(_0x2db4ac){var _0x23dbe8=this;return new Promise(function(_0x155493,_0x32f644){return db['CmHopperHistory'][_0x3342('0x2d')]({'raw':_0x2db4ac['options']?_0x2db4ac[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x2db4ac[_0x3342('0x18')]?_0x2db4ac[_0x3342('0x18')]['where']||null:null,'attributes':[[_0x3342('0x2e'),'name'],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x2f')))),_0x3342('0x30')],[db['sequelize']['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x31')))),'outboundNoAnswerCallsDay'],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3342('0x22')))),_0x3342('0x32')],[db['sequelize']['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x33')))),_0x3342('0x34')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x35')))),_0x3342('0x36')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x37')))),_0x3342('0x38')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3342('0x39')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x3a')))),'outboundUnknownCallsDay'],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')]['literal'](_0x3342('0x3b')))),_0x3342('0x3c')],[db['sequelize']['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x3d')))),_0x3342('0x3e')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x3342('0x3f')],[db['sequelize']['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3342('0x40')))),_0x3342('0x41')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x3342('0x3f')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x42')))),_0x3342('0x43')]],'group':[_0x3342('0x2e')]})['then'](function(_0x2699d2){logger[_0x3342('0x13')](_0x3342('0x2c'),_0x2db4ac);logger[_0x3342('0x1a')](_0x3342('0x2c'),_0x2db4ac,JSON[_0x3342('0xf')](_0x2699d2));_0x155493(_0x2699d2);})[_0x3342('0x1b')](function(_0x47cf76){logger[_0x3342('0x10')]('GetVoiceQueueHopperHistory',_0x47cf76[_0x3342('0x12')],_0x2db4ac);_0x32f644(_0x23dbe8['error'](0x1f4,_0x47cf76[_0x3342('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x49e3c6){var _0x5bff74=this;return new Promise(function(_0x47b9b2,_0x204e35){return db[_0x3342('0x16')][_0x3342('0x2d')]({'raw':_0x49e3c6[_0x3342('0x18')]?_0x49e3c6[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x49e3c6[_0x3342('0x18')]?_0x49e3c6[_0x3342('0x18')][_0x3342('0x1d')]||null:null,'attributes':[[_0x3342('0x2e'),_0x3342('0x44')],[db['sequelize']['fn']('COUNT',db[_0x3342('0x20')]['col']('id')),_0x3342('0x45')],[db['sequelize']['fn']('COUNT',db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x3342('0x2e')]})[_0x3342('0xd')](function(_0x5e9161){logger[_0x3342('0x13')](_0x3342('0x46'),_0x49e3c6);logger[_0x3342('0x1a')]('GetCampaignHopperHistory',_0x49e3c6,JSON[_0x3342('0xf')](_0x5e9161));_0x47b9b2(_0x5e9161);})[_0x3342('0x1b')](function(_0x3dd926){logger[_0x3342('0x10')](_0x3342('0x46'),_0x3dd926[_0x3342('0x12')],_0x49e3c6);_0x204e35(_0x5bff74[_0x3342('0x10')](0x1f4,_0x3dd926['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2f52cab..1cb5a6c 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 _0xe7bc=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','/:id','show','post','update','multer'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe7bc,0x19f));var _0xce7b=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xe7bc[_0x20a558];return _0x53d3f7;};'use strict';var multer=require(_0xce7b('0x0'));var util=require(_0xce7b('0x1'));var path=require(_0xce7b('0x2'));var timeout=require('connect-timeout');var express=require(_0xce7b('0x3'));var router=express[_0xce7b('0x4')]();var auth=require(_0xce7b('0x5'));var interaction=require(_0xce7b('0x6'));var config=require(_0xce7b('0x7'));var controller=require(_0xce7b('0x8'));router[_0xce7b('0x9')]('/',auth[_0xce7b('0xa')](),controller['index']);router[_0xce7b('0x9')](_0xce7b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xce7b('0x9')](_0xce7b('0xc'),auth[_0xce7b('0xa')](),controller[_0xce7b('0xd')]);router[_0xce7b('0xe')]('/',auth[_0xce7b('0xa')](),controller['create']);router['put'](_0xce7b('0xc'),auth[_0xce7b('0xa')](),controller[_0xce7b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x758f=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','util','path','express','Router','../../components/auth/service'];(function(_0x4d1be0,_0x135738){var _0x47d662=function(_0xdd044e){while(--_0xdd044e){_0x4d1be0['push'](_0x4d1be0['shift']());}};_0x47d662(++_0x135738);}(_0x758f,0x187));var _0xf758=function(_0x34ef08,_0x3490fc){_0x34ef08=_0x34ef08-0x0;var _0x161a4f=_0x758f[_0x34ef08];return _0x161a4f;};'use strict';var multer=require('multer');var util=require(_0xf758('0x0'));var path=require(_0xf758('0x1'));var timeout=require('connect-timeout');var express=require(_0xf758('0x2'));var router=express[_0xf758('0x3')]();var auth=require(_0xf758('0x4'));var interaction=require(_0xf758('0x5'));var config=require(_0xf758('0x6'));var controller=require('./cmHopperHistory.controller');router[_0xf758('0x7')]('/',auth['isAuthenticated'](),controller[_0xf758('0x8')]);router[_0xf758('0x7')](_0xf758('0x9'),auth[_0xf758('0xa')](),controller[_0xf758('0xb')]);router['get']('/:id',auth[_0xf758('0xa')](),controller[_0xf758('0xc')]);router[_0xf758('0xd')]('/',auth[_0xf758('0xa')](),controller[_0xf758('0xe')]);router[_0xf758('0xf')](_0xf758('0x10'),auth[_0xf758('0xa')](),controller[_0xf758('0x11')]);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 88e696c..2704776 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 _0xbe80=['STRING','name','sequelize','exports'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xbe80,0x1b6));var _0x0be8=function(_0x22aa96,_0x2ae351){_0x22aa96=_0x22aa96-0x0;var _0x578b59=_0xbe80[_0x22aa96];return _0x578b59;};'use strict';var Sequelize=require(_0x0be8('0x0'));module[_0x0be8('0x1')]={'name':{'type':Sequelize[_0x0be8('0x2')],'unique':_0x0be8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0be8('0x2')]},'dialPrefix':{'type':Sequelize[_0x0be8('0x2')]}}; \ No newline at end of file +var _0xa6b2=['sequelize','STRING','name'];(function(_0x21972b,_0x366de9){var _0x43d5c5=function(_0x1cc8c9){while(--_0x1cc8c9){_0x21972b['push'](_0x21972b['shift']());}};_0x43d5c5(++_0x366de9);}(_0xa6b2,0xd8));var _0x2a6b=function(_0x48086f,_0x49a91f){_0x48086f=_0x48086f-0x0;var _0x39fc12=_0xa6b2[_0x48086f];return _0x39fc12;};'use strict';var Sequelize=require(_0x2a6b('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a6b('0x1')],'unique':_0x2a6b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2a6b('0x1')]},'dialPrefix':{'type':Sequelize[_0x2a6b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index cb5b0d9..4a0446c 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 _0xe5a4=['setHeader','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','Lists','UserProfileResource','error','stack','name','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','CmContact','isArray','tags','join','push','each','success','errors','message','CmCustomField','CustomFields','concat','format','cf_%d','order','raw','getContacts','getContactsCsv','isEmpty','now','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xe5a4,0xa4));var _0x4e5a=function(_0x107d61,_0x1765a4){_0x107d61=_0x107d61-0x0;var _0x3c9ec2=_0xe5a4[_0x107d61];return _0x3c9ec2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e5a('0x0'));var rimraf=require(_0x4e5a('0x1'));var zipdir=require(_0x4e5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e5a('0x3'));var moment=require('moment');var BPromise=require(_0x4e5a('0x4'));var Mustache=require(_0x4e5a('0x5'));var util=require(_0x4e5a('0x6'));var path=require(_0x4e5a('0x7'));var sox=require(_0x4e5a('0x8'));var csv=require('to-csv');var ejs=require(_0x4e5a('0x9'));var fs=require('fs');var _=require(_0x4e5a('0xa'));var squel=require(_0x4e5a('0xb'));var crypto=require(_0x4e5a('0xc'));var jsforce=require(_0x4e5a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e5a('0xe'));var Papa=require(_0x4e5a('0xf'));var Redis=require('ioredis');var authService=require(_0x4e5a('0x10'));var qs=require(_0x4e5a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e5a('0x12'));var logger=require(_0x4e5a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4e5a('0x14'));var db=require(_0x4e5a('0x15'))['db'];config[_0x4e5a('0x16')]=_[_0x4e5a('0x17')](config[_0x4e5a('0x16')],{'host':_0x4e5a('0x18'),'port':0x18eb});var socket=require(_0x4e5a('0x19'))(new Redis(config[_0x4e5a('0x16')]));require(_0x4e5a('0x1a'))[_0x4e5a('0x1b')](socket);function respondWithStatusCode(_0x552295,_0x2b73ef){_0x2b73ef=_0x2b73ef||0xcc;return function(_0x8cb957){if(_0x8cb957){return _0x552295[_0x4e5a('0x1c')](_0x2b73ef);}return _0x552295[_0x4e5a('0x1d')](_0x2b73ef)[_0x4e5a('0x1e')]();};}function respondWithResult(_0x25d08e,_0x2055a0){_0x2055a0=_0x2055a0||0xc8;return function(_0x5384e8){if(_0x5384e8){return _0x25d08e[_0x4e5a('0x1d')](_0x2055a0)[_0x4e5a('0x1f')](_0x5384e8);}};}function respondWithFilteredResult(_0x8b8fca,_0x4f4bf5){return function(_0x488cdf){if(_0x488cdf){var _0x590ba6=_0x488cdf[_0x4e5a('0x20')],_0x271213=_0x4f4bf5[_0x4e5a('0x21')],_0x30216c=_0x4f4bf5[_0x4e5a('0x21')]+_0x4f4bf5[_0x4e5a('0x22')],_0x331de3;if(_0x30216c>=_0x590ba6){_0x30216c=_0x590ba6;_0x331de3=0xc8;}else{_0x331de3=0xce;}_0x8b8fca[_0x4e5a('0x1d')](_0x331de3);return _0x8b8fca[_0x4e5a('0x23')](_0x4e5a('0x24'),_0x271213+'-'+_0x30216c+'/'+_0x590ba6)[_0x4e5a('0x1f')](_0x488cdf);}return null;};}function patchUpdates(_0x2f01c6){return function(_0x315b94){try{jsonpatch[_0x4e5a('0x25')](_0x315b94,_0x2f01c6,!![]);}catch(_0x159469){return BPromise[_0x4e5a('0x26')](_0x159469);}return _0x315b94['save']();};}function saveUpdates(_0x49ed5f,_0x4306dd){return function(_0x3969c6){if(_0x3969c6){return _0x3969c6['update'](_0x49ed5f)[_0x4e5a('0x27')](function(_0x12c40a){return _0x12c40a;});}return null;};}function removeEntity(_0x33ef8c,_0x26dbb4){return function(_0xe2e005){if(_0xe2e005){return _0xe2e005[_0x4e5a('0x28')]()[_0x4e5a('0x27')](function(){var _0x13b8f7=_0xe2e005[_0x4e5a('0x29')]({'plain':!![]});var _0x5b7073=_0x4e5a('0x2a');return db[_0x4e5a('0x2b')]['destroy']({'where':{'type':_0x5b7073,'resourceId':_0x13b8f7['id']}})['then'](function(){return _0xe2e005;});})[_0x4e5a('0x27')](function(){_0x33ef8c[_0x4e5a('0x1d')](0xcc)[_0x4e5a('0x1e')]();});}};}function handleEntityNotFound(_0x4a224a,_0x128b43){return function(_0x298127){if(!_0x298127){_0x4a224a[_0x4e5a('0x1c')](0x194);}return _0x298127;};}function handleError(_0x48c6e2,_0x5ca91d){_0x5ca91d=_0x5ca91d||0x1f4;return function(_0x28a678){logger[_0x4e5a('0x2c')](_0x28a678[_0x4e5a('0x2d')]);if(_0x28a678[_0x4e5a('0x2e')]){delete _0x28a678['name'];}_0x48c6e2['status'](_0x5ca91d)['send'](_0x28a678);};}exports['index']=function(_0x41e02d,_0x3e5d79){var _0x4588cd={},_0x464e9d={},_0x4e7eac={'count':0x0,'rows':[]};var _0x3a1139=_[_0x4e5a('0x2f')](db[_0x4e5a('0x30')][_0x4e5a('0x31')],function(_0x4dc18b){return{'name':_0x4dc18b[_0x4e5a('0x32')],'type':_0x4dc18b[_0x4e5a('0x33')]['key']};});_0x464e9d[_0x4e5a('0x34')]=_[_0x4e5a('0x2f')](_0x3a1139,_0x4e5a('0x2e'));_0x464e9d[_0x4e5a('0x35')]=_[_0x4e5a('0x36')](_0x41e02d[_0x4e5a('0x35')]);_0x464e9d[_0x4e5a('0x37')]=_[_0x4e5a('0x38')](_0x464e9d['model'],_0x464e9d[_0x4e5a('0x35')]);_0x4588cd['attributes']=_[_0x4e5a('0x38')](_0x464e9d[_0x4e5a('0x34')],qs['fields'](_0x41e02d[_0x4e5a('0x35')]['fields']));_0x4588cd['attributes']=_0x4588cd[_0x4e5a('0x39')][_0x4e5a('0x3a')]?_0x4588cd[_0x4e5a('0x39')]:_0x464e9d[_0x4e5a('0x34')];if(!_0x41e02d[_0x4e5a('0x35')][_0x4e5a('0x3b')](_0x4e5a('0x3c'))){_0x4588cd[_0x4e5a('0x22')]=qs[_0x4e5a('0x22')](_0x41e02d[_0x4e5a('0x35')]['limit']);_0x4588cd[_0x4e5a('0x21')]=qs[_0x4e5a('0x21')](_0x41e02d['query'][_0x4e5a('0x21')]);}_0x4588cd['order']=qs[_0x4e5a('0x3d')](_0x41e02d[_0x4e5a('0x35')][_0x4e5a('0x3d')]);_0x4588cd[_0x4e5a('0x3e')]=qs['filters'](_[_0x4e5a('0x3f')](_0x41e02d[_0x4e5a('0x35')],_0x464e9d['filters']),_0x3a1139);if(_0x41e02d['query'][_0x4e5a('0x40')]){_0x4588cd['where']=_[_0x4e5a('0x41')](_0x4588cd['where'],{'$or':_['map'](_0x3a1139,function(_0x17990b){if(_0x17990b['type']!==_0x4e5a('0x42')){var _0x4104ae={};_0x4104ae[_0x17990b[_0x4e5a('0x2e')]]={'$like':'%'+_0x41e02d[_0x4e5a('0x35')][_0x4e5a('0x40')]+'%'};return _0x4104ae;}})});}_0x4588cd=_[_0x4e5a('0x41')]({},_0x4588cd,_0x41e02d[_0x4e5a('0x43')]);var _0xf578a4={'where':_0x4588cd[_0x4e5a('0x3e')]};return db[_0x4e5a('0x30')][_0x4e5a('0x20')](_0xf578a4)['then'](function(_0x2a6ad5){_0x4e7eac[_0x4e5a('0x20')]=_0x2a6ad5;if(_0x41e02d['query'][_0x4e5a('0x44')]){_0x4588cd[_0x4e5a('0x45')]=[{'all':!![]}];}return db[_0x4e5a('0x30')][_0x4e5a('0x46')](_0x4588cd);})[_0x4e5a('0x27')](function(_0x4882e4){_0x4e7eac[_0x4e5a('0x47')]=_0x4882e4;return _0x4e7eac;})[_0x4e5a('0x27')](respondWithFilteredResult(_0x3e5d79,_0x4588cd))[_0x4e5a('0x48')](handleError(_0x3e5d79,null));};exports[_0x4e5a('0x49')]=function(_0x226462,_0x284079){var _0x4e0ce8={'raw':![],'where':{'id':_0x226462[_0x4e5a('0x4a')]['id']}},_0x100684={};_0x100684[_0x4e5a('0x34')]=_[_0x4e5a('0x36')](db[_0x4e5a('0x30')][_0x4e5a('0x31')]);_0x100684['query']=_['keys'](_0x226462[_0x4e5a('0x35')]);_0x100684[_0x4e5a('0x37')]=_['intersection'](_0x100684['model'],_0x100684[_0x4e5a('0x35')]);_0x4e0ce8[_0x4e5a('0x39')]=_[_0x4e5a('0x38')](_0x100684[_0x4e5a('0x34')],qs[_0x4e5a('0x4b')](_0x226462[_0x4e5a('0x35')]['fields']));_0x4e0ce8[_0x4e5a('0x39')]=_0x4e0ce8[_0x4e5a('0x39')][_0x4e5a('0x3a')]?_0x4e0ce8[_0x4e5a('0x39')]:_0x100684[_0x4e5a('0x34')];if(_0x226462[_0x4e5a('0x35')]['includeAll']){_0x4e0ce8[_0x4e5a('0x45')]=[{'all':!![]}];}_0x4e0ce8=_[_0x4e5a('0x41')]({},_0x4e0ce8,_0x226462[_0x4e5a('0x43')]);return db[_0x4e5a('0x30')][_0x4e5a('0x4c')](_0x4e0ce8)[_0x4e5a('0x27')](handleEntityNotFound(_0x284079,null))[_0x4e5a('0x27')](respondWithResult(_0x284079,null))[_0x4e5a('0x48')](handleError(_0x284079,null));};exports[_0x4e5a('0x4d')]=function(_0x10476d,_0x5d1dbc){return db[_0x4e5a('0x30')][_0x4e5a('0x4d')](_0x10476d[_0x4e5a('0x4e')],{})['then'](function(_0x5c9da0){var _0x558c2f=_0x10476d[_0x4e5a('0x4f')]['get']({'plain':!![]});if(!_0x558c2f)throw new Error(_0x4e5a('0x50'));if(_0x558c2f[_0x4e5a('0x51')]==='user'){var _0x843fb2=_0x5c9da0['get']({'plain':!![]});var _0x451740=_0x4e5a('0x2a');return db[_0x4e5a('0x52')]['find']({'where':{'name':_0x451740,'userProfileId':_0x558c2f['userProfileId']},'raw':!![]})[_0x4e5a('0x27')](function(_0x48a2d8){if(_0x48a2d8&&_0x48a2d8[_0x4e5a('0x53')]===0x0){return db['UserProfileResource'][_0x4e5a('0x4d')]({'name':_0x843fb2[_0x4e5a('0x2e')],'resourceId':_0x843fb2['id'],'type':_0x48a2d8[_0x4e5a('0x2e')],'sectionId':_0x48a2d8['id']},{})[_0x4e5a('0x27')](function(){return _0x5c9da0;});}else{return _0x5c9da0;}})[_0x4e5a('0x48')](function(_0x278dcb){logger[_0x4e5a('0x2c')](_0x4e5a('0x54'),_0x278dcb);throw _0x278dcb;});}return _0x5c9da0;})[_0x4e5a('0x27')](respondWithResult(_0x5d1dbc,0xc9))['catch'](handleError(_0x5d1dbc,null));};exports[_0x4e5a('0x55')]=function(_0x3b513c,_0x4d8e81){if(_0x3b513c[_0x4e5a('0x4e')]['id']){delete _0x3b513c['body']['id'];}return db[_0x4e5a('0x30')][_0x4e5a('0x4c')]({'where':{'id':_0x3b513c[_0x4e5a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d8e81,null))[_0x4e5a('0x27')](saveUpdates(_0x3b513c['body'],null))[_0x4e5a('0x27')](respondWithResult(_0x4d8e81,null))['catch'](handleError(_0x4d8e81,null));};exports[_0x4e5a('0x28')]=function(_0x373975,_0x1f3f04){return db[_0x4e5a('0x30')][_0x4e5a('0x4c')]({'where':{'id':_0x373975[_0x4e5a('0x4a')]['id']}})[_0x4e5a('0x27')](handleEntityNotFound(_0x1f3f04,null))[_0x4e5a('0x27')](removeEntity(_0x1f3f04,null))[_0x4e5a('0x48')](handleError(_0x1f3f04,null));};exports[_0x4e5a('0x56')]=function(_0xf3749,_0x341573){return db[_0x4e5a('0x30')][_0x4e5a('0x56')]()['then'](respondWithResult(_0x341573,null))['catch'](handleError(_0x341573,null));};exports[_0x4e5a('0x57')]=function(_0x3abc94,_0x44b68d,_0xdd249b){if(_0x3abc94[_0x4e5a('0x4e')]['id']){delete _0x3abc94[_0x4e5a('0x4e')]['id'];}return db['CmList']['find']({'where':{'id':_0x3abc94[_0x4e5a('0x4a')]['id']}})[_0x4e5a('0x27')](handleEntityNotFound(_0x44b68d,null))[_0x4e5a('0x27')](function(_0x4cfd22){if(_0x4cfd22){_0x3abc94[_0x4e5a('0x4e')][_0x4e5a('0x58')]=_0x4cfd22['id'];return db['Disposition'][_0x4e5a('0x4d')](_0x3abc94['body']);}})[_0x4e5a('0x27')](respondWithResult(_0x44b68d,null))[_0x4e5a('0x48')](handleError(_0x44b68d,null));};exports[_0x4e5a('0x59')]=function(_0xb9c255,_0x5162e7,_0x15c024){var _0x4db5c2={'raw':![],'where':{}};var _0x9c729b={};var _0x526fee={'count':0x0,'rows':[]};return db[_0x4e5a('0x30')][_0x4e5a('0x5a')]({'where':{'id':_0xb9c255[_0x4e5a('0x4a')]['id']}})[_0x4e5a('0x27')](handleEntityNotFound(_0x5162e7,null))[_0x4e5a('0x27')](function(_0x466b9c){if(_0x466b9c){_0x9c729b[_0x4e5a('0x34')]=_['keys'](db[_0x4e5a('0x5b')][_0x4e5a('0x31')]);_0x9c729b[_0x4e5a('0x35')]=_[_0x4e5a('0x36')](_0xb9c255['query']);_0x9c729b[_0x4e5a('0x37')]=_['intersection'](_0x9c729b['model'],_0x9c729b[_0x4e5a('0x35')]);_0x4db5c2[_0x4e5a('0x39')]=_[_0x4e5a('0x38')](_0x9c729b[_0x4e5a('0x34')],qs[_0x4e5a('0x4b')](_0xb9c255['query'][_0x4e5a('0x4b')]));_0x4db5c2[_0x4e5a('0x39')]=_0x4db5c2['attributes']['length']?_0x4db5c2[_0x4e5a('0x39')]:_0x9c729b[_0x4e5a('0x34')];if(!_0xb9c255[_0x4e5a('0x35')][_0x4e5a('0x3b')](_0x4e5a('0x3c'))){_0x4db5c2[_0x4e5a('0x22')]=qs[_0x4e5a('0x22')](_0xb9c255['query']['limit']);_0x4db5c2[_0x4e5a('0x21')]=qs['offset'](_0xb9c255['query'][_0x4e5a('0x21')]);}_0x4db5c2['order']=qs['sort'](_0xb9c255['query']['sort']);_0x4db5c2['where']=qs['filters'](_[_0x4e5a('0x3f')](_0xb9c255[_0x4e5a('0x35')],_0x9c729b[_0x4e5a('0x37')]));_0x4db5c2[_0x4e5a('0x3e')][_0x4e5a('0x58')]=_0x466b9c['id'];if(_0xb9c255['query'][_0x4e5a('0x40')]){_0x4db5c2['where']=_[_0x4e5a('0x41')](_0x4db5c2['where'],{'$or':_[_0x4e5a('0x2f')](_0x4db5c2[_0x4e5a('0x39')],function(_0x5e34b7){var _0x44dc28={};_0x44dc28[_0x5e34b7]={'$like':'%'+_0xb9c255[_0x4e5a('0x35')][_0x4e5a('0x40')]+'%'};return _0x44dc28;})});}_0x4db5c2=_['merge']({},_0x4db5c2,_0xb9c255['options']);return db[_0x4e5a('0x5b')]['count']({'where':_0x4db5c2[_0x4e5a('0x3e')]})[_0x4e5a('0x27')](function(_0x363fb7){_0x526fee[_0x4e5a('0x20')]=_0x363fb7;if(_0xb9c255[_0x4e5a('0x35')]['includeAll']){_0x4db5c2[_0x4e5a('0x45')]=[{'all':!![]}];}return db[_0x4e5a('0x5b')][_0x4e5a('0x46')](_0x4db5c2);})[_0x4e5a('0x27')](function(_0x768d16){_0x526fee[_0x4e5a('0x47')]=_0x768d16;return _0x526fee;});}})[_0x4e5a('0x27')](respondWithFilteredResult(_0x5162e7,_0x4db5c2))['catch'](handleError(_0x5162e7,null));};exports[_0x4e5a('0x5c')]=function(_0x281011,_0x102a49,_0x276cce){return db['CmList'][_0x4e5a('0x4c')]({'where':{'id':_0x281011['params']['id']}})['then'](handleEntityNotFound(_0x102a49,null))[_0x4e5a('0x27')](function(_0x486fdd){if(_0x486fdd){return _0x486fdd[_0x4e5a('0x5c')](_0x281011['query'][_0x4e5a('0x5d')]);}})[_0x4e5a('0x27')](respondWithStatusCode(_0x102a49,null))['catch'](handleError(_0x102a49,null));};exports['addContacts']=function(_0x4a8419,_0x5c3e14,_0x5197d0){return db[_0x4e5a('0x30')]['find']({'where':{'id':_0x4a8419[_0x4e5a('0x4a')]['id']}})[_0x4e5a('0x27')](handleEntityNotFound(_0x5c3e14,null))['then'](function(_0x41600b){if(_0x41600b){var _0x5b9a50=[];var _0x421a89={'success':[],'errors':[]};return db[_0x4e5a('0x5e')][_0x4e5a('0x56')]()[_0x4e5a('0x27')](function(_0x5af203){if(_0x4a8419[_0x4e5a('0x4e')]['tags']&&_[_0x4e5a('0x5f')](_0x4a8419[_0x4e5a('0x4e')][_0x4e5a('0x60')])){if(_0x4a8419[_0x4e5a('0x4e')][_0x4e5a('0x60')][_0x4e5a('0x3a')]){_0x4a8419['body'][_0x4e5a('0x60')]=_0x4a8419['body'][_0x4e5a('0x60')][_0x4e5a('0x61')](';')+';';}else{_0x4a8419['body'][_0x4e5a('0x60')]=null;}}else{_0x4a8419['body'][_0x4e5a('0x60')]=null;}if(_0x4a8419[_0x4e5a('0x4e')]&&_[_0x4e5a('0x5f')](_0x4a8419[_0x4e5a('0x4e')])){for(var _0x279621=0x0;_0x279621<_0x4a8419[_0x4e5a('0x4e')][_0x4e5a('0x3a')];_0x279621+=0x1){_0x4a8419[_0x4e5a('0x4e')][_0x279621]['ListId']=_0x4a8419[_0x4e5a('0x4a')]['id'];_0x5b9a50[_0x4e5a('0x62')](_0x4a8419['body'][_0x279621]);}return BPromise[_0x4e5a('0x63')](_0x5b9a50,function(_0x4cd325){return db[_0x4e5a('0x5e')][_0x4e5a('0x4d')](_['omit'](_0x4cd325,[_0x4e5a('0x5d'),'id'])||{},{'fields':_[_0x4e5a('0x36')](_0x5af203),'raw':!![]})[_0x4e5a('0x27')](function(_0x21b40d){_0x421a89[_0x4e5a('0x64')][_0x4e5a('0x62')](_0x21b40d['dataValues']);})[_0x4e5a('0x48')](function(_0x38ca8b){_0x421a89[_0x4e5a('0x65')][_0x4e5a('0x62')]({'data':_0x4cd325,'error':_0x38ca8b[_0x4e5a('0x66')]});});})[_0x4e5a('0x27')](function(_0x283db6){return _0x421a89;})[_0x4e5a('0x48')](function(_0x562fd7){return _0x562fd7;});}else{_0x5c3e14['status'](0x190)[_0x4e5a('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x4e5a('0x27')](respondWithResult(_0x5c3e14,null))[_0x4e5a('0x48')](handleError(_0x5c3e14,null));};exports['getContacts']=function(_0xe5866d,_0x459713,_0x287db1){var _0x3ccd41;return db[_0x4e5a('0x30')][_0x4e5a('0x4c')]({'where':{'id':_0xe5866d['params']['id']},'include':[{'model':db[_0x4e5a('0x67')],'as':_0x4e5a('0x68')}]})[_0x4e5a('0x27')](handleEntityNotFound(_0x459713,null))[_0x4e5a('0x27')](function(_0x43ec71){if(_0x43ec71){_0x3ccd41=_0x43ec71;return db[_0x4e5a('0x5e')][_0x4e5a('0x31')];}})[_0x4e5a('0x27')](function(_0x295fa4){if(_0x295fa4){var _0x16f142={};var _0x1e3f29={};_0x1e3f29['model']=_[_0x4e5a('0x69')](_[_0x4e5a('0x36')](_0x295fa4),_[_0x4e5a('0x2f')](_0x3ccd41[_0x4e5a('0x68')],function(_0x2df440){return util[_0x4e5a('0x6a')](_0x4e5a('0x6b'),_0x2df440['id']);}));_0x1e3f29[_0x4e5a('0x35')]=_[_0x4e5a('0x36')](_0xe5866d['query']);_0x1e3f29['filters']=_[_0x4e5a('0x38')](_0x1e3f29['model'],_0x1e3f29[_0x4e5a('0x35')]);_0x16f142[_0x4e5a('0x39')]=_[_0x4e5a('0x38')](_0x1e3f29['model'],qs[_0x4e5a('0x4b')](_0xe5866d[_0x4e5a('0x35')]['fields']));_0x16f142[_0x4e5a('0x39')]=_0x16f142[_0x4e5a('0x39')][_0x4e5a('0x3a')]?_0x16f142[_0x4e5a('0x39')]:_0x1e3f29['model'];if(!_0xe5866d[_0x4e5a('0x35')][_0x4e5a('0x3b')]('nolimit')){_0x16f142[_0x4e5a('0x22')]=qs[_0x4e5a('0x22')](_0xe5866d[_0x4e5a('0x35')][_0x4e5a('0x22')]);_0x16f142['offset']=qs[_0x4e5a('0x21')](_0xe5866d[_0x4e5a('0x35')]['offset']);}_0x16f142[_0x4e5a('0x6c')]=qs['sort'](_0xe5866d[_0x4e5a('0x35')]['sort']);_0x16f142[_0x4e5a('0x3e')]=qs[_0x4e5a('0x37')](_[_0x4e5a('0x3f')](_0xe5866d[_0x4e5a('0x35')],_0x1e3f29[_0x4e5a('0x37')]));_0x16f142[_0x4e5a('0x6d')]=!![];if(_0xe5866d[_0x4e5a('0x35')][_0x4e5a('0x40')]){_0x16f142[_0x4e5a('0x3e')]=_[_0x4e5a('0x41')](_0x16f142[_0x4e5a('0x3e')],{'$or':_[_0x4e5a('0x2f')](_0x16f142[_0x4e5a('0x39')],function(_0x1dece6){var _0x2683c2={};_0x2683c2[_0x1dece6]={'$like':'%'+_0xe5866d[_0x4e5a('0x35')][_0x4e5a('0x40')]+'%'};return _0x2683c2;})});}_0x16f142=_['merge']({},_0x16f142,_0xe5866d[_0x4e5a('0x43')]);return _0x3ccd41[_0x4e5a('0x6e')](_0x16f142);}})[_0x4e5a('0x27')](respondWithResult(_0x459713,null))[_0x4e5a('0x48')](handleError(_0x459713,null));};exports[_0x4e5a('0x6f')]=function(_0x17fd4e,_0x444e27,_0x4ca410){var _0x339179;return db[_0x4e5a('0x30')][_0x4e5a('0x4c')]({'where':{'id':_0x17fd4e[_0x4e5a('0x4a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x4e5a('0x68')}]})[_0x4e5a('0x27')](handleEntityNotFound(_0x444e27,null))[_0x4e5a('0x27')](function(_0x503cb4){if(_0x503cb4){_0x339179=_0x503cb4;return db[_0x4e5a('0x5e')]['rawAttributes'];}})['then'](function(_0x5f3ff0){if(_0x5f3ff0){var _0x2e9589={};var _0x3611f7={};_0x3611f7[_0x4e5a('0x34')]=_[_0x4e5a('0x69')](_['keys'](_0x5f3ff0),_['map'](_0x339179[_0x4e5a('0x68')],function(_0x4a6cfa){return util['format'](_0x4e5a('0x6b'),_0x4a6cfa['id']);}));_0x3611f7[_0x4e5a('0x35')]=_[_0x4e5a('0x36')](_0x17fd4e[_0x4e5a('0x35')]);_0x3611f7['filters']=_['intersection'](_0x3611f7['model'],_0x3611f7[_0x4e5a('0x35')]);_0x2e9589[_0x4e5a('0x39')]=_[_0x4e5a('0x38')](_0x3611f7[_0x4e5a('0x34')],qs[_0x4e5a('0x4b')](_0x17fd4e[_0x4e5a('0x35')]['fields']));_0x2e9589[_0x4e5a('0x39')]=_0x2e9589['attributes'][_0x4e5a('0x3a')]?_0x2e9589[_0x4e5a('0x39')]:_0x3611f7[_0x4e5a('0x34')];if(!_0x17fd4e[_0x4e5a('0x35')]['hasOwnProperty'](_0x4e5a('0x3c'))){_0x2e9589['limit']=qs[_0x4e5a('0x22')](_0x17fd4e[_0x4e5a('0x35')][_0x4e5a('0x22')]);_0x2e9589['offset']=qs[_0x4e5a('0x21')](_0x17fd4e[_0x4e5a('0x35')][_0x4e5a('0x21')]);}_0x2e9589[_0x4e5a('0x6c')]=qs[_0x4e5a('0x3d')](_0x17fd4e[_0x4e5a('0x35')][_0x4e5a('0x3d')]);_0x2e9589[_0x4e5a('0x3e')]=qs[_0x4e5a('0x37')](_[_0x4e5a('0x3f')](_0x17fd4e[_0x4e5a('0x35')],_0x3611f7[_0x4e5a('0x37')]));_0x2e9589['raw']=!![];if(_0x17fd4e[_0x4e5a('0x35')][_0x4e5a('0x40')]){_0x2e9589['where']=_['merge'](_0x2e9589['where'],{'$or':_[_0x4e5a('0x2f')](_0x2e9589['attributes'],function(_0x21e2ec){var _0x4eb888={};_0x4eb888[_0x21e2ec]={'$like':'%'+_0x17fd4e[_0x4e5a('0x35')][_0x4e5a('0x40')]+'%'};return _0x4eb888;})});}_0x2e9589=_[_0x4e5a('0x41')]({},_0x2e9589,_0x17fd4e['options']);return _0x339179[_0x4e5a('0x6e')](_0x2e9589);}})['then'](function(_0xe6affe){if(!_[_0x4e5a('0x70')](_0xe6affe)){var _0x3b2e75=toCsv(_0xe6affe);var _0x2c5999=Date[_0x4e5a('0x71')]();fs['writeFileSync'](util['format'](_0x4e5a('0x72'),_0x339179['id'],_0x2c5999),_0x3b2e75);_0x444e27['setHeader'](_0x4e5a('0x73'),_0x4e5a('0x74')+util[_0x4e5a('0x6a')](_0x4e5a('0x75'),_0x339179['id'],_0x2c5999));_0x444e27[_0x4e5a('0x76')]('Content-type',_0x4e5a('0x77'));return _0x444e27[_0x4e5a('0x78')](util[_0x4e5a('0x6a')](_0x4e5a('0x72'),_0x339179['id'],_0x2c5999));}else{return _0x444e27[_0x4e5a('0x1c')](0xcc);}})[_0x4e5a('0x48')](handleError(_0x444e27,null));};exports[_0x4e5a('0x79')]=function(_0x534357,_0x3fedd3,_0x3b7bb6){var _0x13ae05;delete _0x534357[_0x4e5a('0x4e')]['id'];return db[_0x4e5a('0x30')][_0x4e5a('0x5a')]({'where':{'id':_0x534357['params']['id']}})['then'](handleEntityNotFound(_0x3fedd3,null))[_0x4e5a('0x27')](function(_0x151a5d){if(_0x151a5d){return db[_0x4e5a('0x7a')][_0x4e5a('0x7b')](function(_0x1bc2ef){return db[_0x4e5a('0x67')][_0x4e5a('0x4d')](_0x534357[_0x4e5a('0x4e')],{'transaction':_0x1bc2ef})[_0x4e5a('0x27')](function(_0x374328){_0x13ae05=_0x374328;return _0x151a5d[_0x4e5a('0x7c')](_0x374328,{'transaction':_0x1bc2ef});})[_0x4e5a('0x27')](function(){var _0x642dbd={'type':db[_0x4e5a('0x7d')][_0x4e5a('0x7e')],'transaction':_0x1bc2ef};switch(_0x534357[_0x4e5a('0x4e')][_0x4e5a('0x33')]){case'text':_0x642dbd[_0x4e5a('0x33')]=db['Sequelize'][_0x4e5a('0x7e')];break;case'number':_0x642dbd[_0x4e5a('0x33')]=db[_0x4e5a('0x7d')][_0x4e5a('0x7f')];break;case _0x4e5a('0x80'):_0x642dbd['type']=db['Sequelize'][_0x4e5a('0x81')];_0x642dbd['defaultValue']=![];break;default:}return db[_0x4e5a('0x7a')]['queryInterface'][_0x4e5a('0x82')]('cm_contacts',util[_0x4e5a('0x6a')](_0x4e5a('0x83'),_0x13ae05['id']),_0x642dbd);})[_0x4e5a('0x27')](function(){return _0x13ae05;});});}})['then'](respondWithResult(_0x3fedd3,null))[_0x4e5a('0x48')](handleError(_0x3fedd3,null));};exports[_0x4e5a('0x84')]=function(_0x1abc58,_0x2d8507,_0x5e86e8){var _0x156d85={};var _0x3c32f4={};var _0x5a8340;var _0x5569e6;return db['CmList']['findOne']({'where':{'id':_0x1abc58['params']['id']}})[_0x4e5a('0x27')](handleEntityNotFound(_0x2d8507,null))['then'](function(_0x3cb595){if(_0x3cb595){_0x5a8340=_0x3cb595;_0x3c32f4['model']=_[_0x4e5a('0x36')](db[_0x4e5a('0x67')]['rawAttributes']);_0x3c32f4[_0x4e5a('0x35')]=_[_0x4e5a('0x36')](_0x1abc58[_0x4e5a('0x35')]);_0x3c32f4[_0x4e5a('0x37')]=_[_0x4e5a('0x38')](_0x3c32f4['model'],_0x3c32f4[_0x4e5a('0x35')]);_0x156d85[_0x4e5a('0x39')]=_[_0x4e5a('0x38')](_0x3c32f4[_0x4e5a('0x34')],qs[_0x4e5a('0x4b')](_0x1abc58[_0x4e5a('0x35')][_0x4e5a('0x4b')]));_0x156d85[_0x4e5a('0x39')]=_0x156d85[_0x4e5a('0x39')]['length']?_0x156d85[_0x4e5a('0x39')]:_0x3c32f4[_0x4e5a('0x34')];_0x156d85[_0x4e5a('0x6c')]=qs[_0x4e5a('0x3d')](_0x1abc58[_0x4e5a('0x35')][_0x4e5a('0x3d')]);_0x156d85[_0x4e5a('0x3e')]=qs[_0x4e5a('0x37')](_[_0x4e5a('0x3f')](_0x1abc58[_0x4e5a('0x35')],_0x3c32f4[_0x4e5a('0x37')]));_0x156d85[_0x4e5a('0x3e')]=_[_0x4e5a('0x41')](_0x156d85[_0x4e5a('0x3e')],{'$or':[{'ListId':_0x3cb595['id']},{'ListId':null}]});if(_0x1abc58[_0x4e5a('0x35')][_0x4e5a('0x40')]){_0x156d85[_0x4e5a('0x3e')]=_[_0x4e5a('0x41')](_0x156d85[_0x4e5a('0x3e')],{'$or':_[_0x4e5a('0x2f')](_0x156d85[_0x4e5a('0x39')],function(_0x2e0340){var _0x1106e4={};_0x1106e4[_0x2e0340]={'$like':'%'+_0x1abc58['query']['filter']+'%'};return _0x1106e4;})});}_0x156d85=_[_0x4e5a('0x41')]({},_0x156d85,_0x1abc58['options']);return db[_0x4e5a('0x67')][_0x4e5a('0x85')](_0x156d85);}})[_0x4e5a('0x27')](respondWithResult(_0x2d8507,null))[_0x4e5a('0x48')](handleError(_0x2d8507,null));};exports[_0x4e5a('0x86')]=function(_0x14a0ac,_0x365ed0,_0x39b922){return db[_0x4e5a('0x30')][_0x4e5a('0x4c')]({'where':{'id':_0x14a0ac[_0x4e5a('0x4a')]['id']}})[_0x4e5a('0x27')](handleEntityNotFound(_0x365ed0,null))['then'](function(_0x517193){if(_0x517193){return _0x517193[_0x4e5a('0x86')](_0x14a0ac['body'][_0x4e5a('0x5d')],_[_0x4e5a('0x87')](_0x14a0ac['body'],[_0x4e5a('0x5d'),'id'])||{})[_0x4e5a('0x88')](function(_0x45b4d6){for(var _0x5073ec=0x0;_0x5073ec<_0x14a0ac[_0x4e5a('0x4e')][_0x4e5a('0x5d')][_0x4e5a('0x3a')];_0x5073ec+=0x1){socket[_0x4e5a('0x89')]('userCmList:save',{'UserId':_0x14a0ac[_0x4e5a('0x4e')][_0x4e5a('0x5d')][_0x5073ec],'CmListId':_0x14a0ac[_0x4e5a('0x4a')]['id']});}return _0x45b4d6;});}})['then'](respondWithResult(_0x365ed0,null))[_0x4e5a('0x48')](handleError(_0x365ed0,null));};exports[_0x4e5a('0x8a')]=function(_0x43ef8b,_0x5f45a1,_0x4c997b){return db[_0x4e5a('0x30')][_0x4e5a('0x4c')]({'where':{'id':_0x43ef8b[_0x4e5a('0x4a')]['id']}})[_0x4e5a('0x27')](handleEntityNotFound(_0x5f45a1,null))[_0x4e5a('0x27')](function(_0xae4e71){if(_0xae4e71){return _0xae4e71['removeAgents'](_0x43ef8b[_0x4e5a('0x35')][_0x4e5a('0x5d')])[_0x4e5a('0x27')](function(){if(_[_0x4e5a('0x5f')](_0x43ef8b[_0x4e5a('0x35')][_0x4e5a('0x5d')])){for(var _0x13475b=0x0;_0x13475b<_0x43ef8b[_0x4e5a('0x35')]['ids'][_0x4e5a('0x3a')];_0x13475b+=0x1){socket[_0x4e5a('0x89')](_0x4e5a('0x8b'),{'UserId':Number(_0x43ef8b[_0x4e5a('0x35')][_0x4e5a('0x5d')][_0x13475b]),'CmListId':Number(_0x43ef8b[_0x4e5a('0x4a')]['id'])});}}else{socket['emit'](_0x4e5a('0x8b'),{'UserId':Number(_0x43ef8b[_0x4e5a('0x35')]['ids']),'CmListId':Number(_0x43ef8b[_0x4e5a('0x4a')]['id'])});}});}})[_0x4e5a('0x27')](respondWithStatusCode(_0x5f45a1,null))['catch'](handleError(_0x5f45a1,null));};exports[_0x4e5a('0x8c')]=function(_0x43ea7a,_0x4ea40b,_0x1d81ea){var _0x4f6e63={};var _0x399ccc={};var _0x35e700;var _0x534b0f;return db[_0x4e5a('0x30')]['findOne']({'where':{'id':_0x43ea7a[_0x4e5a('0x4a')]['id']}})[_0x4e5a('0x27')](handleEntityNotFound(_0x4ea40b,null))[_0x4e5a('0x27')](function(_0x38726d){if(_0x38726d){_0x35e700=_0x38726d;_0x399ccc['model']=_['keys'](db['User'][_0x4e5a('0x31')]);_0x399ccc['query']=_['keys'](_0x43ea7a['query']);_0x399ccc[_0x4e5a('0x37')]=_[_0x4e5a('0x38')](_0x399ccc['model'],_0x399ccc['query']);_0x4f6e63[_0x4e5a('0x39')]=_['intersection'](_0x399ccc[_0x4e5a('0x34')],qs['fields'](_0x43ea7a[_0x4e5a('0x35')][_0x4e5a('0x4b')]));_0x4f6e63[_0x4e5a('0x39')]=_0x4f6e63['attributes']['length']?_0x4f6e63['attributes']:_0x399ccc[_0x4e5a('0x34')];_0x4f6e63['order']=qs[_0x4e5a('0x3d')](_0x43ea7a[_0x4e5a('0x35')][_0x4e5a('0x3d')]);_0x4f6e63[_0x4e5a('0x3e')]=qs[_0x4e5a('0x37')](_['pick'](_0x43ea7a[_0x4e5a('0x35')],_0x399ccc[_0x4e5a('0x37')]));if(_0x43ea7a[_0x4e5a('0x35')]['filter']){_0x4f6e63[_0x4e5a('0x3e')]=_[_0x4e5a('0x41')](_0x4f6e63[_0x4e5a('0x3e')],{'$or':_[_0x4e5a('0x2f')](_0x4f6e63[_0x4e5a('0x39')],function(_0x6e4c0b){var _0x5e0f89={};_0x5e0f89[_0x6e4c0b]={'$like':'%'+_0x43ea7a[_0x4e5a('0x35')][_0x4e5a('0x40')]+'%'};return _0x5e0f89;})});}_0x4f6e63=_[_0x4e5a('0x41')]({},_0x4f6e63,_0x43ea7a[_0x4e5a('0x43')]);return _0x35e700['getAgents'](_0x4f6e63);}})[_0x4e5a('0x27')](function(_0x312b22){if(_0x312b22){_0x534b0f=_0x312b22[_0x4e5a('0x3a')];if(!_0x43ea7a[_0x4e5a('0x35')]['hasOwnProperty']('nolimit')){_0x4f6e63['limit']=qs[_0x4e5a('0x22')](_0x43ea7a[_0x4e5a('0x35')][_0x4e5a('0x22')]);_0x4f6e63['offset']=qs[_0x4e5a('0x21')](_0x43ea7a[_0x4e5a('0x35')][_0x4e5a('0x21')]);}return _0x35e700[_0x4e5a('0x8c')](_0x4f6e63);}})[_0x4e5a('0x27')](function(_0x44807f){if(_0x44807f){return _0x44807f?{'count':_0x534b0f,'rows':_0x44807f}:null;}})[_0x4e5a('0x27')](respondWithResult(_0x4ea40b,null))[_0x4e5a('0x48')](handleError(_0x4ea40b,null));}; \ No newline at end of file +var _0xa6d2=['spread','emit','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','status','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','ListId','Disposition','findOne','filter','removeDispositions','ids','addContacts','CmContact','tags','join','push','omit','success','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','raw','isEmpty','now','writeFileSync','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents'];(function(_0x4c8700,_0x25e672){var _0x16dcaa=function(_0x18c324){while(--_0x18c324){_0x4c8700['push'](_0x4c8700['shift']());}};_0x16dcaa(++_0x25e672);}(_0xa6d2,0x1b2));var _0x2a6d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa6d2[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2a6d('0x0'));var rimraf=require(_0x2a6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a6d('0x2'));var rp=require('request-promise');var moment=require(_0x2a6d('0x3'));var BPromise=require(_0x2a6d('0x4'));var Mustache=require(_0x2a6d('0x5'));var util=require(_0x2a6d('0x6'));var path=require(_0x2a6d('0x7'));var sox=require(_0x2a6d('0x8'));var csv=require('to-csv');var ejs=require(_0x2a6d('0x9'));var fs=require('fs');var _=require(_0x2a6d('0xa'));var squel=require(_0x2a6d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2a6d('0xc'));var toCsv=require(_0x2a6d('0xd'));var querystring=require('querystring');var Papa=require(_0x2a6d('0xe'));var Redis=require(_0x2a6d('0xf'));var authService=require(_0x2a6d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a6d('0x11'));var logger=require('../../config/logger')(_0x2a6d('0x12'));var utils=require(_0x2a6d('0x13'));var config=require(_0x2a6d('0x14'));var db=require(_0x2a6d('0x15'))['db'];config[_0x2a6d('0x16')]=_['defaults'](config[_0x2a6d('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a6d('0x17'))(new Redis(config[_0x2a6d('0x16')]));require(_0x2a6d('0x18'))[_0x2a6d('0x19')](socket);function respondWithStatusCode(_0x24029c,_0x4c2c4f){_0x4c2c4f=_0x4c2c4f||0xcc;return function(_0x417728){if(_0x417728){return _0x24029c[_0x2a6d('0x1a')](_0x4c2c4f);}return _0x24029c['status'](_0x4c2c4f)[_0x2a6d('0x1b')]();};}function respondWithResult(_0x19bcff,_0x249d48){_0x249d48=_0x249d48||0xc8;return function(_0x4275e3){if(_0x4275e3){return _0x19bcff['status'](_0x249d48)['json'](_0x4275e3);}};}function respondWithFilteredResult(_0x4803f4,_0x2c6cd8){return function(_0x100658){if(_0x100658){var _0x3f6b6e=_0x100658[_0x2a6d('0x1c')],_0x5c9f7b=_0x2c6cd8['offset'],_0x467a47=_0x2c6cd8[_0x2a6d('0x1d')]+_0x2c6cd8[_0x2a6d('0x1e')],_0x5d5ef0;if(_0x467a47>=_0x3f6b6e){_0x467a47=_0x3f6b6e;_0x5d5ef0=0xc8;}else{_0x5d5ef0=0xce;}_0x4803f4['status'](_0x5d5ef0);return _0x4803f4[_0x2a6d('0x1f')](_0x2a6d('0x20'),_0x5c9f7b+'-'+_0x467a47+'/'+_0x3f6b6e)['json'](_0x100658);}return null;};}function patchUpdates(_0x4da976){return function(_0x1b1389){try{jsonpatch[_0x2a6d('0x21')](_0x1b1389,_0x4da976,!![]);}catch(_0x3851f5){return BPromise[_0x2a6d('0x22')](_0x3851f5);}return _0x1b1389[_0x2a6d('0x23')]();};}function saveUpdates(_0x2ef7da,_0x5d65da){return function(_0x1a3d95){if(_0x1a3d95){return _0x1a3d95[_0x2a6d('0x24')](_0x2ef7da)[_0x2a6d('0x25')](function(_0x195b95){return _0x195b95;});}return null;};}function removeEntity(_0x4f6fc5,_0x1d7ea4){return function(_0x533c76){if(_0x533c76){return _0x533c76[_0x2a6d('0x26')]()[_0x2a6d('0x25')](function(){var _0x456c36=_0x533c76['get']({'plain':!![]});var _0x3896ce='Lists';return db[_0x2a6d('0x27')][_0x2a6d('0x26')]({'where':{'type':_0x3896ce,'resourceId':_0x456c36['id']}})[_0x2a6d('0x25')](function(){return _0x533c76;});})[_0x2a6d('0x25')](function(){_0x4f6fc5[_0x2a6d('0x28')](0xcc)[_0x2a6d('0x1b')]();});}};}function handleEntityNotFound(_0x5b4cce,_0x10bb77){return function(_0x4093c8){if(!_0x4093c8){_0x5b4cce['sendStatus'](0x194);}return _0x4093c8;};}function handleError(_0x4520ea,_0x98fdd5){_0x98fdd5=_0x98fdd5||0x1f4;return function(_0x2ba712){logger[_0x2a6d('0x29')](_0x2ba712[_0x2a6d('0x2a')]);if(_0x2ba712[_0x2a6d('0x2b')]){delete _0x2ba712[_0x2a6d('0x2b')];}_0x4520ea[_0x2a6d('0x28')](_0x98fdd5)[_0x2a6d('0x2c')](_0x2ba712);};}exports[_0x2a6d('0x2d')]=function(_0x25a2fd,_0x4201d1){var _0x540512={},_0x54673d={},_0x357543={'count':0x0,'rows':[]};var _0x15467c=_[_0x2a6d('0x2e')](db[_0x2a6d('0x2f')][_0x2a6d('0x30')],function(_0x133a1e){return{'name':_0x133a1e[_0x2a6d('0x31')],'type':_0x133a1e[_0x2a6d('0x32')][_0x2a6d('0x33')]};});_0x54673d['model']=_[_0x2a6d('0x2e')](_0x15467c,_0x2a6d('0x2b'));_0x54673d[_0x2a6d('0x34')]=_['keys'](_0x25a2fd[_0x2a6d('0x34')]);_0x54673d['filters']=_['intersection'](_0x54673d[_0x2a6d('0x35')],_0x54673d[_0x2a6d('0x34')]);_0x540512['attributes']=_[_0x2a6d('0x36')](_0x54673d['model'],qs[_0x2a6d('0x37')](_0x25a2fd[_0x2a6d('0x34')][_0x2a6d('0x37')]));_0x540512[_0x2a6d('0x38')]=_0x540512[_0x2a6d('0x38')][_0x2a6d('0x39')]?_0x540512[_0x2a6d('0x38')]:_0x54673d['model'];if(!_0x25a2fd[_0x2a6d('0x34')][_0x2a6d('0x3a')](_0x2a6d('0x3b'))){_0x540512[_0x2a6d('0x1e')]=qs[_0x2a6d('0x1e')](_0x25a2fd[_0x2a6d('0x34')]['limit']);_0x540512[_0x2a6d('0x1d')]=qs[_0x2a6d('0x1d')](_0x25a2fd['query'][_0x2a6d('0x1d')]);}_0x540512[_0x2a6d('0x3c')]=qs['sort'](_0x25a2fd[_0x2a6d('0x34')][_0x2a6d('0x3d')]);_0x540512[_0x2a6d('0x3e')]=qs[_0x2a6d('0x3f')](_[_0x2a6d('0x40')](_0x25a2fd[_0x2a6d('0x34')],_0x54673d['filters']),_0x15467c);if(_0x25a2fd[_0x2a6d('0x34')]['filter']){_0x540512[_0x2a6d('0x3e')]=_['merge'](_0x540512[_0x2a6d('0x3e')],{'$or':_[_0x2a6d('0x2e')](_0x15467c,function(_0x85e46b){if(_0x85e46b[_0x2a6d('0x32')]!==_0x2a6d('0x41')){var _0x3ce412={};_0x3ce412[_0x85e46b[_0x2a6d('0x2b')]]={'$like':'%'+_0x25a2fd[_0x2a6d('0x34')]['filter']+'%'};return _0x3ce412;}})});}_0x540512=_[_0x2a6d('0x42')]({},_0x540512,_0x25a2fd[_0x2a6d('0x43')]);var _0x340e97={'where':_0x540512['where']};return db[_0x2a6d('0x2f')]['count'](_0x340e97)[_0x2a6d('0x25')](function(_0x17428e){_0x357543[_0x2a6d('0x1c')]=_0x17428e;if(_0x25a2fd['query'][_0x2a6d('0x44')]){_0x540512[_0x2a6d('0x45')]=[{'all':!![]}];}return db['CmList'][_0x2a6d('0x46')](_0x540512);})[_0x2a6d('0x25')](function(_0x1d65ad){_0x357543[_0x2a6d('0x47')]=_0x1d65ad;return _0x357543;})[_0x2a6d('0x25')](respondWithFilteredResult(_0x4201d1,_0x540512))[_0x2a6d('0x48')](handleError(_0x4201d1,null));};exports[_0x2a6d('0x49')]=function(_0x178b02,_0x273a9c){var _0x4f5542={'raw':![],'where':{'id':_0x178b02['params']['id']}},_0xb67652={};_0xb67652['model']=_[_0x2a6d('0x4a')](db[_0x2a6d('0x2f')]['rawAttributes']);_0xb67652[_0x2a6d('0x34')]=_[_0x2a6d('0x4a')](_0x178b02['query']);_0xb67652['filters']=_[_0x2a6d('0x36')](_0xb67652['model'],_0xb67652['query']);_0x4f5542[_0x2a6d('0x38')]=_[_0x2a6d('0x36')](_0xb67652[_0x2a6d('0x35')],qs[_0x2a6d('0x37')](_0x178b02[_0x2a6d('0x34')][_0x2a6d('0x37')]));_0x4f5542[_0x2a6d('0x38')]=_0x4f5542[_0x2a6d('0x38')][_0x2a6d('0x39')]?_0x4f5542[_0x2a6d('0x38')]:_0xb67652[_0x2a6d('0x35')];if(_0x178b02[_0x2a6d('0x34')][_0x2a6d('0x44')]){_0x4f5542[_0x2a6d('0x45')]=[{'all':!![]}];}_0x4f5542=_[_0x2a6d('0x42')]({},_0x4f5542,_0x178b02[_0x2a6d('0x43')]);return db[_0x2a6d('0x2f')]['find'](_0x4f5542)[_0x2a6d('0x25')](handleEntityNotFound(_0x273a9c,null))['then'](respondWithResult(_0x273a9c,null))['catch'](handleError(_0x273a9c,null));};exports['create']=function(_0x218eff,_0x2a09e0){return db[_0x2a6d('0x2f')][_0x2a6d('0x4b')](_0x218eff['body'],{})[_0x2a6d('0x25')](function(_0x451196){var _0x2298db=_0x218eff[_0x2a6d('0x4c')][_0x2a6d('0x4d')]({'plain':!![]});if(!_0x2298db)throw new Error(_0x2a6d('0x4e'));if(_0x2298db[_0x2a6d('0x4f')]===_0x2a6d('0x4c')){var _0x2c7ba3=_0x451196[_0x2a6d('0x4d')]({'plain':!![]});var _0x3d95d0=_0x2a6d('0x50');return db[_0x2a6d('0x51')][_0x2a6d('0x52')]({'where':{'name':_0x3d95d0,'userProfileId':_0x2298db[_0x2a6d('0x53')]},'raw':!![]})['then'](function(_0x47f0bd){if(_0x47f0bd&&_0x47f0bd[_0x2a6d('0x54')]===0x0){return db[_0x2a6d('0x27')][_0x2a6d('0x4b')]({'name':_0x2c7ba3[_0x2a6d('0x2b')],'resourceId':_0x2c7ba3['id'],'type':_0x47f0bd['name'],'sectionId':_0x47f0bd['id']},{})[_0x2a6d('0x25')](function(){return _0x451196;});}else{return _0x451196;}})[_0x2a6d('0x48')](function(_0x1d3ec6){logger[_0x2a6d('0x29')](_0x2a6d('0x55'),_0x1d3ec6);throw _0x1d3ec6;});}return _0x451196;})['then'](respondWithResult(_0x2a09e0,0xc9))[_0x2a6d('0x48')](handleError(_0x2a09e0,null));};exports[_0x2a6d('0x24')]=function(_0x245480,_0x1c8b96){if(_0x245480[_0x2a6d('0x56')]['id']){delete _0x245480[_0x2a6d('0x56')]['id'];}return db[_0x2a6d('0x2f')][_0x2a6d('0x52')]({'where':{'id':_0x245480[_0x2a6d('0x57')]['id']}})[_0x2a6d('0x25')](handleEntityNotFound(_0x1c8b96,null))[_0x2a6d('0x25')](saveUpdates(_0x245480[_0x2a6d('0x56')],null))[_0x2a6d('0x25')](respondWithResult(_0x1c8b96,null))[_0x2a6d('0x48')](handleError(_0x1c8b96,null));};exports['destroy']=function(_0xb9de2b,_0x18e73c){return db[_0x2a6d('0x2f')][_0x2a6d('0x52')]({'where':{'id':_0xb9de2b[_0x2a6d('0x57')]['id']}})[_0x2a6d('0x25')](handleEntityNotFound(_0x18e73c,null))['then'](removeEntity(_0x18e73c,null))[_0x2a6d('0x48')](handleError(_0x18e73c,null));};exports['describe']=function(_0x15c0cf,_0x122c5a){return db[_0x2a6d('0x2f')][_0x2a6d('0x58')]()[_0x2a6d('0x25')](respondWithResult(_0x122c5a,null))[_0x2a6d('0x48')](handleError(_0x122c5a,null));};exports['addDisposition']=function(_0x2e4dc4,_0x691a7b,_0x41fc42){if(_0x2e4dc4[_0x2a6d('0x56')]['id']){delete _0x2e4dc4['body']['id'];}return db['CmList'][_0x2a6d('0x52')]({'where':{'id':_0x2e4dc4[_0x2a6d('0x57')]['id']}})[_0x2a6d('0x25')](handleEntityNotFound(_0x691a7b,null))[_0x2a6d('0x25')](function(_0x379c9b){if(_0x379c9b){_0x2e4dc4[_0x2a6d('0x56')][_0x2a6d('0x59')]=_0x379c9b['id'];return db[_0x2a6d('0x5a')]['create'](_0x2e4dc4[_0x2a6d('0x56')]);}})[_0x2a6d('0x25')](respondWithResult(_0x691a7b,null))[_0x2a6d('0x48')](handleError(_0x691a7b,null));};exports['getDispositions']=function(_0x4d6d3f,_0x453361,_0x33d086){var _0x2d9828={'raw':![],'where':{}};var _0xe39b2d={};var _0x471d27={'count':0x0,'rows':[]};return db[_0x2a6d('0x2f')][_0x2a6d('0x5b')]({'where':{'id':_0x4d6d3f[_0x2a6d('0x57')]['id']}})['then'](handleEntityNotFound(_0x453361,null))[_0x2a6d('0x25')](function(_0x217400){if(_0x217400){_0xe39b2d[_0x2a6d('0x35')]=_['keys'](db[_0x2a6d('0x5a')][_0x2a6d('0x30')]);_0xe39b2d[_0x2a6d('0x34')]=_['keys'](_0x4d6d3f[_0x2a6d('0x34')]);_0xe39b2d[_0x2a6d('0x3f')]=_['intersection'](_0xe39b2d[_0x2a6d('0x35')],_0xe39b2d[_0x2a6d('0x34')]);_0x2d9828[_0x2a6d('0x38')]=_[_0x2a6d('0x36')](_0xe39b2d[_0x2a6d('0x35')],qs[_0x2a6d('0x37')](_0x4d6d3f[_0x2a6d('0x34')]['fields']));_0x2d9828[_0x2a6d('0x38')]=_0x2d9828[_0x2a6d('0x38')]['length']?_0x2d9828['attributes']:_0xe39b2d[_0x2a6d('0x35')];if(!_0x4d6d3f[_0x2a6d('0x34')][_0x2a6d('0x3a')](_0x2a6d('0x3b'))){_0x2d9828[_0x2a6d('0x1e')]=qs[_0x2a6d('0x1e')](_0x4d6d3f['query'][_0x2a6d('0x1e')]);_0x2d9828['offset']=qs[_0x2a6d('0x1d')](_0x4d6d3f[_0x2a6d('0x34')][_0x2a6d('0x1d')]);}_0x2d9828[_0x2a6d('0x3c')]=qs['sort'](_0x4d6d3f[_0x2a6d('0x34')]['sort']);_0x2d9828[_0x2a6d('0x3e')]=qs[_0x2a6d('0x3f')](_[_0x2a6d('0x40')](_0x4d6d3f[_0x2a6d('0x34')],_0xe39b2d[_0x2a6d('0x3f')]));_0x2d9828[_0x2a6d('0x3e')]['ListId']=_0x217400['id'];if(_0x4d6d3f['query'][_0x2a6d('0x5c')]){_0x2d9828[_0x2a6d('0x3e')]=_[_0x2a6d('0x42')](_0x2d9828[_0x2a6d('0x3e')],{'$or':_[_0x2a6d('0x2e')](_0x2d9828[_0x2a6d('0x38')],function(_0x1aaff4){var _0x475cdb={};_0x475cdb[_0x1aaff4]={'$like':'%'+_0x4d6d3f[_0x2a6d('0x34')][_0x2a6d('0x5c')]+'%'};return _0x475cdb;})});}_0x2d9828=_[_0x2a6d('0x42')]({},_0x2d9828,_0x4d6d3f[_0x2a6d('0x43')]);return db[_0x2a6d('0x5a')][_0x2a6d('0x1c')]({'where':_0x2d9828[_0x2a6d('0x3e')]})[_0x2a6d('0x25')](function(_0x424240){_0x471d27[_0x2a6d('0x1c')]=_0x424240;if(_0x4d6d3f[_0x2a6d('0x34')][_0x2a6d('0x44')]){_0x2d9828[_0x2a6d('0x45')]=[{'all':!![]}];}return db[_0x2a6d('0x5a')]['findAll'](_0x2d9828);})[_0x2a6d('0x25')](function(_0x1434e5){_0x471d27[_0x2a6d('0x47')]=_0x1434e5;return _0x471d27;});}})[_0x2a6d('0x25')](respondWithFilteredResult(_0x453361,_0x2d9828))['catch'](handleError(_0x453361,null));};exports[_0x2a6d('0x5d')]=function(_0x4c82e1,_0x5872a0,_0x4ccbb7){return db[_0x2a6d('0x2f')][_0x2a6d('0x52')]({'where':{'id':_0x4c82e1[_0x2a6d('0x57')]['id']}})[_0x2a6d('0x25')](handleEntityNotFound(_0x5872a0,null))[_0x2a6d('0x25')](function(_0x2f00fa){if(_0x2f00fa){return _0x2f00fa[_0x2a6d('0x5d')](_0x4c82e1['query'][_0x2a6d('0x5e')]);}})[_0x2a6d('0x25')](respondWithStatusCode(_0x5872a0,null))[_0x2a6d('0x48')](handleError(_0x5872a0,null));};exports[_0x2a6d('0x5f')]=function(_0x423c78,_0x2ca71a,_0x3031dc){return db['CmList'][_0x2a6d('0x52')]({'where':{'id':_0x423c78['params']['id']}})[_0x2a6d('0x25')](handleEntityNotFound(_0x2ca71a,null))['then'](function(_0x5c04b3){if(_0x5c04b3){var _0x3bb9e4=[];var _0x49c4fd={'success':[],'errors':[]};return db[_0x2a6d('0x60')][_0x2a6d('0x58')]()[_0x2a6d('0x25')](function(_0x419a46){if(_0x423c78[_0x2a6d('0x56')][_0x2a6d('0x61')]&&_['isArray'](_0x423c78['body'][_0x2a6d('0x61')])){if(_0x423c78[_0x2a6d('0x56')][_0x2a6d('0x61')]['length']){_0x423c78['body']['tags']=_0x423c78[_0x2a6d('0x56')]['tags'][_0x2a6d('0x62')](';')+';';}else{_0x423c78['body'][_0x2a6d('0x61')]=null;}}else{_0x423c78['body'][_0x2a6d('0x61')]=null;}if(_0x423c78[_0x2a6d('0x56')]&&_['isArray'](_0x423c78[_0x2a6d('0x56')])){for(var _0x4c993f=0x0;_0x4c993f<_0x423c78[_0x2a6d('0x56')]['length'];_0x4c993f+=0x1){_0x423c78[_0x2a6d('0x56')][_0x4c993f][_0x2a6d('0x59')]=_0x423c78[_0x2a6d('0x57')]['id'];_0x3bb9e4[_0x2a6d('0x63')](_0x423c78[_0x2a6d('0x56')][_0x4c993f]);}return BPromise['each'](_0x3bb9e4,function(_0x5e61db){return db[_0x2a6d('0x60')]['create'](_[_0x2a6d('0x64')](_0x5e61db,[_0x2a6d('0x5e'),'id'])||{},{'fields':_[_0x2a6d('0x4a')](_0x419a46),'raw':!![]})[_0x2a6d('0x25')](function(_0x10cd37){_0x49c4fd[_0x2a6d('0x65')]['push'](_0x10cd37[_0x2a6d('0x66')]);})[_0x2a6d('0x48')](function(_0x39a40a){_0x49c4fd[_0x2a6d('0x67')][_0x2a6d('0x63')]({'data':_0x5e61db,'error':_0x39a40a[_0x2a6d('0x68')]});});})[_0x2a6d('0x25')](function(_0x1ec05d){return _0x49c4fd;})[_0x2a6d('0x48')](function(_0x42a4fb){return _0x42a4fb;});}else{_0x2ca71a[_0x2a6d('0x28')](0x190)[_0x2a6d('0x69')]({'message':_0x2a6d('0x6a')});}});}})[_0x2a6d('0x25')](respondWithResult(_0x2ca71a,null))['catch'](handleError(_0x2ca71a,null));};exports[_0x2a6d('0x6b')]=function(_0x5cb354,_0x3a6839,_0x2b3dee){var _0x113aa5;return db[_0x2a6d('0x2f')]['find']({'where':{'id':_0x5cb354[_0x2a6d('0x57')]['id']},'include':[{'model':db[_0x2a6d('0x6c')],'as':_0x2a6d('0x6d')}]})[_0x2a6d('0x25')](handleEntityNotFound(_0x3a6839,null))[_0x2a6d('0x25')](function(_0x3933d9){if(_0x3933d9){_0x113aa5=_0x3933d9;return db[_0x2a6d('0x60')]['rawAttributes'];}})[_0x2a6d('0x25')](function(_0x563538){if(_0x563538){var _0x334b5b={};var _0x29da96={};_0x29da96['model']=_[_0x2a6d('0x6e')](_[_0x2a6d('0x4a')](_0x563538),_[_0x2a6d('0x2e')](_0x113aa5['CustomFields'],function(_0x581390){return util[_0x2a6d('0x6f')](_0x2a6d('0x70'),_0x581390['id']);}));_0x29da96[_0x2a6d('0x34')]=_[_0x2a6d('0x4a')](_0x5cb354[_0x2a6d('0x34')]);_0x29da96[_0x2a6d('0x3f')]=_[_0x2a6d('0x36')](_0x29da96[_0x2a6d('0x35')],_0x29da96[_0x2a6d('0x34')]);_0x334b5b['attributes']=_[_0x2a6d('0x36')](_0x29da96['model'],qs[_0x2a6d('0x37')](_0x5cb354[_0x2a6d('0x34')]['fields']));_0x334b5b[_0x2a6d('0x38')]=_0x334b5b['attributes']['length']?_0x334b5b[_0x2a6d('0x38')]:_0x29da96[_0x2a6d('0x35')];if(!_0x5cb354[_0x2a6d('0x34')]['hasOwnProperty']('nolimit')){_0x334b5b['limit']=qs[_0x2a6d('0x1e')](_0x5cb354[_0x2a6d('0x34')]['limit']);_0x334b5b[_0x2a6d('0x1d')]=qs[_0x2a6d('0x1d')](_0x5cb354[_0x2a6d('0x34')][_0x2a6d('0x1d')]);}_0x334b5b[_0x2a6d('0x3c')]=qs[_0x2a6d('0x3d')](_0x5cb354[_0x2a6d('0x34')]['sort']);_0x334b5b[_0x2a6d('0x3e')]=qs[_0x2a6d('0x3f')](_[_0x2a6d('0x40')](_0x5cb354[_0x2a6d('0x34')],_0x29da96[_0x2a6d('0x3f')]));_0x334b5b['raw']=!![];if(_0x5cb354[_0x2a6d('0x34')][_0x2a6d('0x5c')]){_0x334b5b['where']=_[_0x2a6d('0x42')](_0x334b5b['where'],{'$or':_[_0x2a6d('0x2e')](_0x334b5b[_0x2a6d('0x38')],function(_0x204212){var _0x369a5e={};_0x369a5e[_0x204212]={'$like':'%'+_0x5cb354[_0x2a6d('0x34')][_0x2a6d('0x5c')]+'%'};return _0x369a5e;})});}_0x334b5b=_[_0x2a6d('0x42')]({},_0x334b5b,_0x5cb354[_0x2a6d('0x43')]);return _0x113aa5[_0x2a6d('0x6b')](_0x334b5b);}})[_0x2a6d('0x25')](respondWithResult(_0x3a6839,null))[_0x2a6d('0x48')](handleError(_0x3a6839,null));};exports[_0x2a6d('0x71')]=function(_0x196c54,_0x5593b9,_0x32f014){var _0x228504;return db['CmList'][_0x2a6d('0x52')]({'where':{'id':_0x196c54[_0x2a6d('0x57')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x5593b9,null))[_0x2a6d('0x25')](function(_0x2f86d5){if(_0x2f86d5){_0x228504=_0x2f86d5;return db[_0x2a6d('0x60')]['rawAttributes'];}})[_0x2a6d('0x25')](function(_0x403164){if(_0x403164){var _0x5f284e={};var _0x2a2ad4={};_0x2a2ad4[_0x2a6d('0x35')]=_[_0x2a6d('0x6e')](_[_0x2a6d('0x4a')](_0x403164),_[_0x2a6d('0x2e')](_0x228504[_0x2a6d('0x6d')],function(_0x7a4fca){return util[_0x2a6d('0x6f')]('cf_%d',_0x7a4fca['id']);}));_0x2a2ad4[_0x2a6d('0x34')]=_['keys'](_0x196c54[_0x2a6d('0x34')]);_0x2a2ad4['filters']=_[_0x2a6d('0x36')](_0x2a2ad4[_0x2a6d('0x35')],_0x2a2ad4[_0x2a6d('0x34')]);_0x5f284e[_0x2a6d('0x38')]=_['intersection'](_0x2a2ad4[_0x2a6d('0x35')],qs['fields'](_0x196c54['query'][_0x2a6d('0x37')]));_0x5f284e[_0x2a6d('0x38')]=_0x5f284e[_0x2a6d('0x38')][_0x2a6d('0x39')]?_0x5f284e['attributes']:_0x2a2ad4[_0x2a6d('0x35')];if(!_0x196c54['query'][_0x2a6d('0x3a')](_0x2a6d('0x3b'))){_0x5f284e[_0x2a6d('0x1e')]=qs[_0x2a6d('0x1e')](_0x196c54['query'][_0x2a6d('0x1e')]);_0x5f284e[_0x2a6d('0x1d')]=qs['offset'](_0x196c54['query']['offset']);}_0x5f284e[_0x2a6d('0x3c')]=qs[_0x2a6d('0x3d')](_0x196c54[_0x2a6d('0x34')][_0x2a6d('0x3d')]);_0x5f284e[_0x2a6d('0x3e')]=qs['filters'](_['pick'](_0x196c54['query'],_0x2a2ad4[_0x2a6d('0x3f')]));_0x5f284e[_0x2a6d('0x72')]=!![];if(_0x196c54[_0x2a6d('0x34')][_0x2a6d('0x5c')]){_0x5f284e[_0x2a6d('0x3e')]=_[_0x2a6d('0x42')](_0x5f284e['where'],{'$or':_[_0x2a6d('0x2e')](_0x5f284e[_0x2a6d('0x38')],function(_0x10a338){var _0x3f5e52={};_0x3f5e52[_0x10a338]={'$like':'%'+_0x196c54['query'][_0x2a6d('0x5c')]+'%'};return _0x3f5e52;})});}_0x5f284e=_['merge']({},_0x5f284e,_0x196c54[_0x2a6d('0x43')]);return _0x228504['getContacts'](_0x5f284e);}})[_0x2a6d('0x25')](function(_0x2563a8){if(!_[_0x2a6d('0x73')](_0x2563a8)){var _0x2cf80a=toCsv(_0x2563a8);var _0x1e289f=Date[_0x2a6d('0x74')]();fs[_0x2a6d('0x75')](util[_0x2a6d('0x6f')]('/tmp/list_%d_%s.csv',_0x228504['id'],_0x1e289f),_0x2cf80a);_0x5593b9['setHeader']('Content-disposition',_0x2a6d('0x76')+util[_0x2a6d('0x6f')](_0x2a6d('0x77'),_0x228504['id'],_0x1e289f));_0x5593b9[_0x2a6d('0x78')](_0x2a6d('0x79'),'text/csv');return _0x5593b9[_0x2a6d('0x7a')](util['format']('/tmp/list_%d_%s.csv',_0x228504['id'],_0x1e289f));}else{return _0x5593b9[_0x2a6d('0x1a')](0xcc);}})[_0x2a6d('0x48')](handleError(_0x5593b9,null));};exports[_0x2a6d('0x7b')]=function(_0xc29222,_0x1c3410,_0x1a124f){var _0x361110;delete _0xc29222['body']['id'];return db[_0x2a6d('0x2f')][_0x2a6d('0x5b')]({'where':{'id':_0xc29222[_0x2a6d('0x57')]['id']}})['then'](handleEntityNotFound(_0x1c3410,null))[_0x2a6d('0x25')](function(_0x4caf00){if(_0x4caf00){return db[_0x2a6d('0x7c')][_0x2a6d('0x7d')](function(_0x329e97){return db[_0x2a6d('0x6c')][_0x2a6d('0x4b')](_0xc29222[_0x2a6d('0x56')],{'transaction':_0x329e97})['then'](function(_0x20745c){_0x361110=_0x20745c;return _0x4caf00[_0x2a6d('0x7e')](_0x20745c,{'transaction':_0x329e97});})[_0x2a6d('0x25')](function(){var _0x47d9b2={'type':db[_0x2a6d('0x7f')][_0x2a6d('0x80')],'transaction':_0x329e97};switch(_0xc29222['body'][_0x2a6d('0x32')]){case _0x2a6d('0x81'):_0x47d9b2[_0x2a6d('0x32')]=db['Sequelize']['TEXT'];break;case'number':_0x47d9b2[_0x2a6d('0x32')]=db[_0x2a6d('0x7f')]['INTEGER'];break;case _0x2a6d('0x82'):_0x47d9b2['type']=db[_0x2a6d('0x7f')][_0x2a6d('0x83')];_0x47d9b2[_0x2a6d('0x84')]=![];break;default:}return db[_0x2a6d('0x7c')][_0x2a6d('0x85')]['addColumn']('cm_contacts',util['format'](_0x2a6d('0x86'),_0x361110['id']),_0x47d9b2);})[_0x2a6d('0x25')](function(){return _0x361110;});});}})[_0x2a6d('0x25')](respondWithResult(_0x1c3410,null))[_0x2a6d('0x48')](handleError(_0x1c3410,null));};exports[_0x2a6d('0x87')]=function(_0x2d9801,_0x4654cd,_0x5e4fb5){var _0x227def={};var _0x41dde6={};var _0xb14071;var _0x51b275;return db[_0x2a6d('0x2f')]['findOne']({'where':{'id':_0x2d9801[_0x2a6d('0x57')]['id']}})[_0x2a6d('0x25')](handleEntityNotFound(_0x4654cd,null))[_0x2a6d('0x25')](function(_0x4c2809){if(_0x4c2809){_0xb14071=_0x4c2809;_0x41dde6['model']=_[_0x2a6d('0x4a')](db['CmCustomField'][_0x2a6d('0x30')]);_0x41dde6[_0x2a6d('0x34')]=_[_0x2a6d('0x4a')](_0x2d9801[_0x2a6d('0x34')]);_0x41dde6[_0x2a6d('0x3f')]=_['intersection'](_0x41dde6[_0x2a6d('0x35')],_0x41dde6[_0x2a6d('0x34')]);_0x227def[_0x2a6d('0x38')]=_[_0x2a6d('0x36')](_0x41dde6['model'],qs[_0x2a6d('0x37')](_0x2d9801[_0x2a6d('0x34')]['fields']));_0x227def[_0x2a6d('0x38')]=_0x227def[_0x2a6d('0x38')][_0x2a6d('0x39')]?_0x227def[_0x2a6d('0x38')]:_0x41dde6[_0x2a6d('0x35')];_0x227def['order']=qs['sort'](_0x2d9801['query']['sort']);_0x227def[_0x2a6d('0x3e')]=qs[_0x2a6d('0x3f')](_['pick'](_0x2d9801[_0x2a6d('0x34')],_0x41dde6[_0x2a6d('0x3f')]));_0x227def[_0x2a6d('0x3e')]=_[_0x2a6d('0x42')](_0x227def[_0x2a6d('0x3e')],{'$or':[{'ListId':_0x4c2809['id']},{'ListId':null}]});if(_0x2d9801['query']['filter']){_0x227def[_0x2a6d('0x3e')]=_[_0x2a6d('0x42')](_0x227def['where'],{'$or':_['map'](_0x227def[_0x2a6d('0x38')],function(_0x210257){var _0x1150e7={};_0x1150e7[_0x210257]={'$like':'%'+_0x2d9801['query']['filter']+'%'};return _0x1150e7;})});}_0x227def=_[_0x2a6d('0x42')]({},_0x227def,_0x2d9801[_0x2a6d('0x43')]);return db[_0x2a6d('0x6c')][_0x2a6d('0x88')](_0x227def);}})[_0x2a6d('0x25')](respondWithResult(_0x4654cd,null))[_0x2a6d('0x48')](handleError(_0x4654cd,null));};exports[_0x2a6d('0x89')]=function(_0x167b59,_0x152352,_0x5829f2){return db['CmList'][_0x2a6d('0x52')]({'where':{'id':_0x167b59[_0x2a6d('0x57')]['id']}})['then'](handleEntityNotFound(_0x152352,null))[_0x2a6d('0x25')](function(_0x4c07f2){if(_0x4c07f2){return _0x4c07f2[_0x2a6d('0x89')](_0x167b59[_0x2a6d('0x56')][_0x2a6d('0x5e')],_[_0x2a6d('0x64')](_0x167b59[_0x2a6d('0x56')],[_0x2a6d('0x5e'),'id'])||{})[_0x2a6d('0x8a')](function(_0x22ae24){for(var _0x547e1f=0x0;_0x547e1f<_0x167b59[_0x2a6d('0x56')][_0x2a6d('0x5e')]['length'];_0x547e1f+=0x1){socket[_0x2a6d('0x8b')]('userCmList:save',{'UserId':_0x167b59[_0x2a6d('0x56')][_0x2a6d('0x5e')][_0x547e1f],'CmListId':_0x167b59['params']['id']});}return _0x22ae24;});}})[_0x2a6d('0x25')](respondWithResult(_0x152352,null))[_0x2a6d('0x48')](handleError(_0x152352,null));};exports['removeAgents']=function(_0x3a1b97,_0x411685,_0x44b424){return db[_0x2a6d('0x2f')][_0x2a6d('0x52')]({'where':{'id':_0x3a1b97[_0x2a6d('0x57')]['id']}})[_0x2a6d('0x25')](handleEntityNotFound(_0x411685,null))[_0x2a6d('0x25')](function(_0x181912){if(_0x181912){return _0x181912['removeAgents'](_0x3a1b97[_0x2a6d('0x34')][_0x2a6d('0x5e')])[_0x2a6d('0x25')](function(){if(_['isArray'](_0x3a1b97[_0x2a6d('0x34')][_0x2a6d('0x5e')])){for(var _0x4b1c12=0x0;_0x4b1c12<_0x3a1b97[_0x2a6d('0x34')][_0x2a6d('0x5e')]['length'];_0x4b1c12+=0x1){socket['emit'](_0x2a6d('0x8c'),{'UserId':Number(_0x3a1b97['query'][_0x2a6d('0x5e')][_0x4b1c12]),'CmListId':Number(_0x3a1b97[_0x2a6d('0x57')]['id'])});}}else{socket[_0x2a6d('0x8b')]('userCmList:remove',{'UserId':Number(_0x3a1b97['query'][_0x2a6d('0x5e')]),'CmListId':Number(_0x3a1b97[_0x2a6d('0x57')]['id'])});}});}})[_0x2a6d('0x25')](respondWithStatusCode(_0x411685,null))['catch'](handleError(_0x411685,null));};exports[_0x2a6d('0x8d')]=function(_0x277f34,_0x3f926c,_0x5539c4){var _0x154110={};var _0x20efe4={};var _0xfdf54e;var _0x5bbcd2;return db[_0x2a6d('0x2f')][_0x2a6d('0x5b')]({'where':{'id':_0x277f34[_0x2a6d('0x57')]['id']}})[_0x2a6d('0x25')](handleEntityNotFound(_0x3f926c,null))[_0x2a6d('0x25')](function(_0xce2d82){if(_0xce2d82){_0xfdf54e=_0xce2d82;_0x20efe4[_0x2a6d('0x35')]=_['keys'](db[_0x2a6d('0x8e')][_0x2a6d('0x30')]);_0x20efe4['query']=_[_0x2a6d('0x4a')](_0x277f34[_0x2a6d('0x34')]);_0x20efe4[_0x2a6d('0x3f')]=_[_0x2a6d('0x36')](_0x20efe4[_0x2a6d('0x35')],_0x20efe4['query']);_0x154110[_0x2a6d('0x38')]=_[_0x2a6d('0x36')](_0x20efe4['model'],qs[_0x2a6d('0x37')](_0x277f34[_0x2a6d('0x34')][_0x2a6d('0x37')]));_0x154110[_0x2a6d('0x38')]=_0x154110[_0x2a6d('0x38')][_0x2a6d('0x39')]?_0x154110[_0x2a6d('0x38')]:_0x20efe4[_0x2a6d('0x35')];_0x154110[_0x2a6d('0x3c')]=qs[_0x2a6d('0x3d')](_0x277f34[_0x2a6d('0x34')]['sort']);_0x154110['where']=qs[_0x2a6d('0x3f')](_['pick'](_0x277f34['query'],_0x20efe4['filters']));if(_0x277f34[_0x2a6d('0x34')]['filter']){_0x154110[_0x2a6d('0x3e')]=_[_0x2a6d('0x42')](_0x154110[_0x2a6d('0x3e')],{'$or':_[_0x2a6d('0x2e')](_0x154110[_0x2a6d('0x38')],function(_0x47fdb6){var _0xfb002e={};_0xfb002e[_0x47fdb6]={'$like':'%'+_0x277f34[_0x2a6d('0x34')]['filter']+'%'};return _0xfb002e;})});}_0x154110=_[_0x2a6d('0x42')]({},_0x154110,_0x277f34[_0x2a6d('0x43')]);return _0xfdf54e[_0x2a6d('0x8d')](_0x154110);}})[_0x2a6d('0x25')](function(_0x4093ff){if(_0x4093ff){_0x5bbcd2=_0x4093ff[_0x2a6d('0x39')];if(!_0x277f34[_0x2a6d('0x34')][_0x2a6d('0x3a')](_0x2a6d('0x3b'))){_0x154110[_0x2a6d('0x1e')]=qs['limit'](_0x277f34[_0x2a6d('0x34')][_0x2a6d('0x1e')]);_0x154110['offset']=qs['offset'](_0x277f34['query'][_0x2a6d('0x1d')]);}return _0xfdf54e[_0x2a6d('0x8d')](_0x154110);}})['then'](function(_0x43fe11){if(_0x43fe11){return _0x43fe11?{'count':_0x5bbcd2,'rows':_0x43fe11}:null;}})[_0x2a6d('0x25')](respondWithResult(_0x3f926c,null))[_0x2a6d('0x48')](handleError(_0x3f926c,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 557a019..59d3112 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 _0x575c=['CmList','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x575c,0x142));var _0xc575=function(_0x19cc62,_0x517c0b){_0x19cc62=_0x19cc62-0x0;var _0x1f86a6=_0x575c[_0x19cc62];return _0x1f86a6;};'use strict';var EventEmitter=require(_0xc575('0x0'));var CmList=require(_0xc575('0x1'))['db'][_0xc575('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc575('0x3'),'afterUpdate':_0xc575('0x4'),'afterDestroy':_0xc575('0x5')};function emitEvent(_0x3d1dc){return function(_0x39280d,_0x55a4e2,_0x2bbc46){CmListEvents[_0xc575('0x6')](_0x3d1dc+':'+_0x39280d['id'],_0x39280d);CmListEvents['emit'](_0x3d1dc,_0x39280d);_0x2bbc46(null);};}for(var e in events){if(events[_0xc575('0x7')](e)){var event=events[e];CmList[_0xc575('0x8')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x5fe5=['remove','emit','hook','events','CmList','setMaxListeners','update'];(function(_0xee207e,_0x298c1e){var _0x51ad4a=function(_0x58ff71){while(--_0x58ff71){_0xee207e['push'](_0xee207e['shift']());}};_0x51ad4a(++_0x298c1e);}(_0x5fe5,0x7a));var _0x55fe=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x5fe5[_0x18afca];return _0x11603f;};'use strict';var EventEmitter=require(_0x55fe('0x0'));var CmList=require('../../mysqldb')['db'][_0x55fe('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x55fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x55fe('0x3'),'afterDestroy':_0x55fe('0x4')};function emitEvent(_0x40f478){return function(_0x37be29,_0x58e44c,_0x2972f9){CmListEvents[_0x55fe('0x5')](_0x40f478+':'+_0x37be29['id'],_0x37be29);CmListEvents[_0x55fe('0x5')](_0x40f478,_0x37be29);_0x2972f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x55fe('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5e38a21..5062448 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 _0x0c00=['rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2e1e3e,_0x6e7b3f){var _0x423694=function(_0x1d4d65){while(--_0x1d4d65){_0x2e1e3e['push'](_0x2e1e3e['shift']());}};_0x423694(++_0x6e7b3f);}(_0x0c00,0xa1));var _0x00c0=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0c00[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x00c0('0x0'));var util=require(_0x00c0('0x1'));var logger=require(_0x00c0('0x2'))(_0x00c0('0x3'));var moment=require(_0x00c0('0x4'));var BPromise=require(_0x00c0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00c0('0x6'));var rimraf=require(_0x00c0('0x7'));var config=require(_0x00c0('0x8'));var attributes=require(_0x00c0('0x9'));module['exports']=function(_0x464dfa,_0x2caf3b){return _0x464dfa[_0x00c0('0xa')](_0x00c0('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96cc=['api','rimraf','./cmList.attributes','exports','define','CmList','lodash','../../config/logger'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x96cc,0x146));var _0xc96c=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x96cc[_0x40dd56];return _0x4f850f;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var logger=require(_0xc96c('0x1'))(_0xc96c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc96c('0x3'));var config=require('../../config/environment');var attributes=require(_0xc96c('0x4'));module[_0xc96c('0x5')]=function(_0x2e2f07,_0x3ad9d2){return _0x2e2f07[_0xc96c('0x6')](_0xc96c('0x7'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 25f36e8..9a273a0 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 _0xbdb8=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','register','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x4aea1c,_0x5669f1){var _0xe407d7=function(_0x1c6307){while(--_0x1c6307){_0x4aea1c['push'](_0x4aea1c['shift']());}};_0xe407d7(++_0x5669f1);}(_0xbdb8,0x13b));var _0x8bdb=function(_0x401a4d,_0x4bb835){_0x401a4d=_0x401a4d-0x0;var _0x1faaff=_0xbdb8[_0x401a4d];return _0x1faaff;};'use strict';var _=require(_0x8bdb('0x0'));var util=require(_0x8bdb('0x1'));var moment=require(_0x8bdb('0x2'));var BPromise=require(_0x8bdb('0x3'));var rs=require(_0x8bdb('0x4'));var fs=require('fs');var Redis=require(_0x8bdb('0x5'));var db=require(_0x8bdb('0x6'))['db'];var utils=require(_0x8bdb('0x7'));var logger=require(_0x8bdb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8bdb('0x9'));var client=jayson[_0x8bdb('0xa')][_0x8bdb('0xb')]({'port':0x232a});config[_0x8bdb('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8bdb('0xd'))(new Redis(config[_0x8bdb('0xc')]));require('./cmList.socket')[_0x8bdb('0xe')](socket);function respondWithRpcPromise(_0x153f10,_0x45629b,_0x30f927){return new BPromise(function(_0x749b3b,_0x413bc8){return client['request'](_0x153f10,_0x30f927)['then'](function(_0x4131ea){logger[_0x8bdb('0xf')](_0x8bdb('0x10'),_0x45629b,'request\x20sent');logger['debug'](_0x8bdb('0x11'),_0x45629b,_0x8bdb('0x12'),JSON['stringify'](_0x4131ea));if(_0x4131ea[_0x8bdb('0x13')]){if(_0x4131ea[_0x8bdb('0x13')]['code']===0x1f4){logger[_0x8bdb('0x13')](_0x8bdb('0x10'),_0x45629b,_0x4131ea['error'][_0x8bdb('0x14')]);return _0x413bc8(_0x4131ea[_0x8bdb('0x13')]['message']);}logger[_0x8bdb('0x13')](_0x8bdb('0x10'),_0x45629b,_0x4131ea[_0x8bdb('0x13')][_0x8bdb('0x14')]);return _0x749b3b(_0x4131ea[_0x8bdb('0x13')][_0x8bdb('0x14')]);}else{logger[_0x8bdb('0xf')](_0x8bdb('0x10'),_0x45629b,_0x8bdb('0x12'));_0x749b3b(_0x4131ea['result']['message']);}})['catch'](function(_0x231c2d){logger[_0x8bdb('0x13')](_0x8bdb('0x10'),_0x45629b,_0x231c2d);_0x413bc8(_0x231c2d);});});} \ No newline at end of file +var _0x5363=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','CmList,\x20%s,\x20%s','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x5363,0xea));var _0x3536=function(_0x583d41,_0x4ba6fc){_0x583d41=_0x583d41-0x0;var _0x13037c=_0x5363[_0x583d41];return _0x13037c;};'use strict';var _=require(_0x3536('0x0'));var util=require('util');var moment=require(_0x3536('0x1'));var BPromise=require(_0x3536('0x2'));var rs=require(_0x3536('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3536('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3536('0x5'));var config=require('../../config/environment');var jayson=require(_0x3536('0x6'));var client=jayson[_0x3536('0x7')]['http']({'port':0x232a});config[_0x3536('0x8')]=_[_0x3536('0x9')](config[_0x3536('0x8')],{'host':_0x3536('0xa'),'port':0x18eb});var socket=require(_0x3536('0xb'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x2bf527,_0x52d642,_0x5dd6ca){return new BPromise(function(_0x1c74bb,_0x3523d7){return client[_0x3536('0xc')](_0x2bf527,_0x5dd6ca)[_0x3536('0xd')](function(_0x2a20b3){logger['info'](_0x3536('0xe'),_0x52d642,'request\x20sent');logger[_0x3536('0xf')]('CmList,\x20%s,\x20%s,\x20%s',_0x52d642,'request\x20sent',JSON['stringify'](_0x2a20b3));if(_0x2a20b3['error']){if(_0x2a20b3[_0x3536('0x10')]['code']===0x1f4){logger[_0x3536('0x10')](_0x3536('0xe'),_0x52d642,_0x2a20b3[_0x3536('0x10')][_0x3536('0x11')]);return _0x3523d7(_0x2a20b3[_0x3536('0x10')][_0x3536('0x11')]);}logger[_0x3536('0x10')](_0x3536('0xe'),_0x52d642,_0x2a20b3['error'][_0x3536('0x11')]);return _0x1c74bb(_0x2a20b3[_0x3536('0x10')][_0x3536('0x11')]);}else{logger['info'](_0x3536('0xe'),_0x52d642,'request\x20sent');_0x1c74bb(_0x2a20b3[_0x3536('0x12')][_0x3536('0x11')]);}})[_0x3536('0x13')](function(_0x466d3d){logger['error'](_0x3536('0xe'),_0x52d642,_0x466d3d);_0x3523d7(_0x466d3d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2985b2d..7d4992d 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 _0x7163=['removeListener','length','cmList:','./cmList.events','update','emit'];(function(_0x9e4397,_0x1673bc){var _0x3e5f0c=function(_0x2e1f5){while(--_0x2e1f5){_0x9e4397['push'](_0x9e4397['shift']());}};_0x3e5f0c(++_0x1673bc);}(_0x7163,0x1ef));var _0x3716=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x7163[_0x6dfbaa];return _0xfbe02;};'use strict';var CmListEvents=require(_0x3716('0x0'));var events=['save','remove',_0x3716('0x1')];function createListener(_0x396758,_0x138388){return function(_0x58e0ce){_0x138388[_0x3716('0x2')](_0x396758,_0x58e0ce);};}function removeListener(_0x3da057,_0x1ec9df){return function(){CmListEvents[_0x3716('0x3')](_0x3da057,_0x1ec9df);};}exports['register']=function(_0x5c81bb){for(var _0x3112a7=0x0,_0x4549b2=events[_0x3716('0x4')];_0x3112a7<_0x4549b2;_0x3112a7++){var _0x14bfe0=events[_0x3112a7];var _0x3c84bf=createListener(_0x3716('0x5')+_0x14bfe0,_0x5c81bb);CmListEvents['on'](_0x14bfe0,_0x3c84bf);}}; \ No newline at end of file +var _0x2123=['./cmList.events','save','remove','update','emit','removeListener','register','length'];(function(_0x19c04e,_0x1fdfb9){var _0x5bdf27=function(_0x750e36){while(--_0x750e36){_0x19c04e['push'](_0x19c04e['shift']());}};_0x5bdf27(++_0x1fdfb9);}(_0x2123,0x190));var _0x3212=function(_0x28a289,_0x2638ed){_0x28a289=_0x28a289-0x0;var _0x1fe6a9=_0x2123[_0x28a289];return _0x1fe6a9;};'use strict';var CmListEvents=require(_0x3212('0x0'));var events=[_0x3212('0x1'),_0x3212('0x2'),_0x3212('0x3')];function createListener(_0x7158b8,_0x2ff863){return function(_0x8c047){_0x2ff863[_0x3212('0x4')](_0x7158b8,_0x8c047);};}function removeListener(_0x304f80,_0x6ca653){return function(){CmListEvents[_0x3212('0x5')](_0x304f80,_0x6ca653);};}exports[_0x3212('0x6')]=function(_0x5d9d36){for(var _0x3859e4=0x0,_0x2b1302=events[_0x3212('0x7')];_0x3859e4<_0x2b1302;_0x3859e4++){var _0x4b35e9=events[_0x3859e4];var _0x3e17a3=createListener('cmList:'+_0x4b35e9,_0x5d9d36);CmListEvents['on'](_0x4b35e9,_0x3e17a3);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c20e758..0c1c6f0 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 _0x8d46=['index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d46,0x1d2));var _0x68d4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8d46[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x68d4('0x0'));var util=require(_0x68d4('0x1'));var path=require(_0x68d4('0x2'));var timeout=require(_0x68d4('0x3'));var express=require(_0x68d4('0x4'));var router=express['Router']();var auth=require(_0x68d4('0x5'));var interaction=require(_0x68d4('0x6'));var config=require(_0x68d4('0x7'));var controller=require(_0x68d4('0x8'));router[_0x68d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x68d4('0xa')]);router['get'](_0x68d4('0xb'),auth[_0x68d4('0xc')](),controller[_0x68d4('0xd')]);router['get'](_0x68d4('0xe'),auth[_0x68d4('0xc')](),controller[_0x68d4('0xf')]);router[_0x68d4('0x9')](_0x68d4('0x10'),auth[_0x68d4('0xc')](),controller[_0x68d4('0x11')]);router['get'](_0x68d4('0x12'),auth[_0x68d4('0xc')](),controller['getContacts']);router[_0x68d4('0x9')]('/:id/contacts/csv',auth[_0x68d4('0xc')](),controller['getContactsCsv']);router[_0x68d4('0x9')]('/:id/fields',auth[_0x68d4('0xc')](),controller[_0x68d4('0x13')]);router[_0x68d4('0x9')](_0x68d4('0x14'),auth['isAuthenticated'](),controller[_0x68d4('0x15')]);router[_0x68d4('0x16')]('/',auth[_0x68d4('0xc')](),controller[_0x68d4('0x17')]);router[_0x68d4('0x16')](_0x68d4('0x10'),auth['isAuthenticated'](),controller[_0x68d4('0x18')]);router[_0x68d4('0x16')](_0x68d4('0x12'),auth['isAuthenticated'](),controller[_0x68d4('0x19')]);router[_0x68d4('0x16')](_0x68d4('0x1a'),auth['isAuthenticated'](),controller[_0x68d4('0x1b')]);router[_0x68d4('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x68d4('0x1c')]);router[_0x68d4('0x1d')](_0x68d4('0xe'),auth[_0x68d4('0xc')](),controller[_0x68d4('0x1e')]);router[_0x68d4('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x68d4('0x20')]);router['delete'](_0x68d4('0x10'),auth[_0x68d4('0xc')](),controller['removeDispositions']);router[_0x68d4('0x1f')](_0x68d4('0x14'),auth[_0x68d4('0xc')](),controller[_0x68d4('0x21')]);module['exports']=router; \ No newline at end of file +var _0xc90d=['destroy','removeDispositions','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xc90d,0x134));var _0xdc90=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0xc90d[_0x401ccd];return _0x5a57ad;};'use strict';var multer=require(_0xdc90('0x0'));var util=require(_0xdc90('0x1'));var path=require(_0xdc90('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc90('0x3'));var router=express[_0xdc90('0x4')]();var auth=require(_0xdc90('0x5'));var interaction=require(_0xdc90('0x6'));var config=require(_0xdc90('0x7'));var controller=require(_0xdc90('0x8'));router[_0xdc90('0x9')]('/',auth[_0xdc90('0xa')](),controller[_0xdc90('0xb')]);router[_0xdc90('0x9')](_0xdc90('0xc'),auth[_0xdc90('0xa')](),controller[_0xdc90('0xd')]);router[_0xdc90('0x9')](_0xdc90('0xe'),auth[_0xdc90('0xa')](),controller[_0xdc90('0xf')]);router[_0xdc90('0x9')](_0xdc90('0x10'),auth[_0xdc90('0xa')](),controller[_0xdc90('0x11')]);router[_0xdc90('0x9')](_0xdc90('0x12'),auth['isAuthenticated'](),controller['getContacts']);router[_0xdc90('0x9')](_0xdc90('0x13'),auth[_0xdc90('0xa')](),controller[_0xdc90('0x14')]);router['get']('/:id/fields',auth[_0xdc90('0xa')](),controller['getCustomFields']);router[_0xdc90('0x9')](_0xdc90('0x15'),auth[_0xdc90('0xa')](),controller[_0xdc90('0x16')]);router[_0xdc90('0x17')]('/',auth[_0xdc90('0xa')](),controller[_0xdc90('0x18')]);router['post'](_0xdc90('0x10'),auth[_0xdc90('0xa')](),controller[_0xdc90('0x19')]);router[_0xdc90('0x17')](_0xdc90('0x12'),auth['isAuthenticated'](),controller[_0xdc90('0x1a')]);router[_0xdc90('0x17')]('/:id/fields',auth[_0xdc90('0xa')](),controller[_0xdc90('0x1b')]);router[_0xdc90('0x17')](_0xdc90('0x15'),auth[_0xdc90('0xa')](),controller[_0xdc90('0x1c')]);router[_0xdc90('0x1d')](_0xdc90('0xe'),auth[_0xdc90('0xa')](),controller[_0xdc90('0x1e')]);router[_0xdc90('0x1f')](_0xdc90('0xe'),auth[_0xdc90('0xa')](),controller[_0xdc90('0x20')]);router['delete'](_0xdc90('0x10'),auth['isAuthenticated'](),controller[_0xdc90('0x21')]);router[_0xdc90('0x1f')](_0xdc90('0x15'),auth[_0xdc90('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e7c09f3..d4835a0 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0xe214df,_0x2dfbe0){var _0x46150a=function(_0x396d17){while(--_0x396d17){_0xe214df['push'](_0xe214df['shift']());}};_0x46150a(++_0x2dfbe0);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x59170c,_0xaf2219){var _0x1703fb=function(_0x4c74e5){while(--_0x4c74e5){_0x59170c['push'](_0x59170c['shift']());}};_0x1703fb(++_0xaf2219);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 3b09b2e..44e6c9c 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 _0x2b4f=['name','body','Condition','find','params','then','destroy','eml-format','zip-dir','fast-json-patch','request-promise','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','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','end','error'];(function(_0xb9c140,_0x4a0595){var _0x256992=function(_0x1e5c9a){while(--_0x1e5c9a){_0xb9c140['push'](_0xb9c140['shift']());}};_0x256992(++_0x4a0595);}(_0x2b4f,0x142));var _0xf2b4=function(_0x31be08,_0x570bfd){_0x31be08=_0x31be08-0x0;var _0x22fe6a=_0x2b4f[_0x31be08];return _0x22fe6a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2b4('0x1'));var jsonpatch=require(_0xf2b4('0x2'));var rp=require(_0xf2b4('0x3'));var moment=require(_0xf2b4('0x4'));var BPromise=require(_0xf2b4('0x5'));var Mustache=require('mustache');var util=require(_0xf2b4('0x6'));var path=require(_0xf2b4('0x7'));var sox=require(_0xf2b4('0x8'));var csv=require(_0xf2b4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2b4('0xa'));var squel=require('squel');var crypto=require(_0xf2b4('0xb'));var jsforce=require(_0xf2b4('0xc'));var deskjs=require(_0xf2b4('0xd'));var toCsv=require(_0xf2b4('0x9'));var querystring=require(_0xf2b4('0xe'));var Papa=require(_0xf2b4('0xf'));var Redis=require(_0xf2b4('0x10'));var authService=require(_0xf2b4('0x11'));var qs=require(_0xf2b4('0x12'));var as=require(_0xf2b4('0x13'));var hardwareService=require(_0xf2b4('0x14'));var logger=require(_0xf2b4('0x15'))(_0xf2b4('0x16'));var utils=require(_0xf2b4('0x17'));var config=require(_0xf2b4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe13e23,_0x39f318){_0x39f318=_0x39f318||0xcc;return function(_0x25942b){if(_0x25942b){return _0xe13e23[_0xf2b4('0x19')](_0x39f318);}return _0xe13e23['status'](_0x39f318)['end']();};}function respondWithResult(_0x470116,_0x5172c0){_0x5172c0=_0x5172c0||0xc8;return function(_0x435022){if(_0x435022){return _0x470116[_0xf2b4('0x1a')](_0x5172c0)[_0xf2b4('0x1b')](_0x435022);}};}function respondWithFilteredResult(_0x51f980,_0x4fcecf){return function(_0x39fcea){if(_0x39fcea){var _0x235ad7=_0x39fcea[_0xf2b4('0x1c')],_0x3daaf6=_0x4fcecf['offset'],_0x323f7b=_0x4fcecf[_0xf2b4('0x1d')]+_0x4fcecf[_0xf2b4('0x1e')],_0x562ab8;if(_0x323f7b>=_0x235ad7){_0x323f7b=_0x235ad7;_0x562ab8=0xc8;}else{_0x562ab8=0xce;}_0x51f980[_0xf2b4('0x1a')](_0x562ab8);return _0x51f980[_0xf2b4('0x1f')](_0xf2b4('0x20'),_0x3daaf6+'-'+_0x323f7b+'/'+_0x235ad7)[_0xf2b4('0x1b')](_0x39fcea);}return null;};}function patchUpdates(_0x20f96c){return function(_0x5b63b9){try{jsonpatch['apply'](_0x5b63b9,_0x20f96c,!![]);}catch(_0x32fe54){return BPromise[_0xf2b4('0x21')](_0x32fe54);}return _0x5b63b9[_0xf2b4('0x22')]();};}function saveUpdates(_0x4642bc,_0x38afe7){return function(_0x305fa0){if(_0x305fa0){return _0x305fa0[_0xf2b4('0x23')](_0x4642bc)['then'](function(_0x10c270){return _0x10c270;});}return null;};}function removeEntity(_0x12f1c0,_0x2b3897){return function(_0x5fc66e){if(_0x5fc66e){return _0x5fc66e['destroy']()['then'](function(){_0x12f1c0[_0xf2b4('0x1a')](0xcc)[_0xf2b4('0x24')]();});}};}function handleEntityNotFound(_0x18d28b,_0x290658){return function(_0x7daac1){if(!_0x7daac1){_0x18d28b[_0xf2b4('0x19')](0x194);}return _0x7daac1;};}function handleError(_0x390c94,_0x4346c1){_0x4346c1=_0x4346c1||0x1f4;return function(_0x2ee93b){logger[_0xf2b4('0x25')](_0x2ee93b['stack']);if(_0x2ee93b['name']){delete _0x2ee93b[_0xf2b4('0x26')];}_0x390c94[_0xf2b4('0x1a')](_0x4346c1)['send'](_0x2ee93b);};}exports[_0xf2b4('0x23')]=function(_0x107f23,_0x3007eb){if(_0x107f23[_0xf2b4('0x27')]['id']){delete _0x107f23[_0xf2b4('0x27')]['id'];}return db[_0xf2b4('0x28')][_0xf2b4('0x29')]({'where':{'id':_0x107f23[_0xf2b4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3007eb,null))[_0xf2b4('0x2b')](saveUpdates(_0x107f23[_0xf2b4('0x27')],null))[_0xf2b4('0x2b')](respondWithResult(_0x3007eb,null))['catch'](handleError(_0x3007eb,null));};exports[_0xf2b4('0x2c')]=function(_0x518b87,_0x449d39){return db[_0xf2b4('0x28')][_0xf2b4('0x29')]({'where':{'id':_0x518b87['params']['id']}})['then'](handleEntityNotFound(_0x449d39,null))[_0xf2b4('0x2b')](removeEntity(_0x449d39,null))['catch'](handleError(_0x449d39,null));}; \ No newline at end of file +var _0xcbda=['name','send','body','Condition','params','catch','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack'];(function(_0x5ada82,_0x47fa19){var _0x595c90=function(_0x265a3b){while(--_0x265a3b){_0x5ada82['push'](_0x5ada82['shift']());}};_0x595c90(++_0x47fa19);}(_0xcbda,0x10e));var _0xacbd=function(_0x29b729,_0x30f838){_0x29b729=_0x29b729-0x0;var _0x3d2aad=_0xcbda[_0x29b729];return _0x3d2aad;};'use strict';var pdf=require(_0xacbd('0x0'));var emlformat=require(_0xacbd('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xacbd('0x2'));var rp=require(_0xacbd('0x3'));var moment=require('moment');var BPromise=require(_0xacbd('0x4'));var Mustache=require(_0xacbd('0x5'));var util=require(_0xacbd('0x6'));var path=require('path');var sox=require(_0xacbd('0x7'));var csv=require(_0xacbd('0x8'));var ejs=require(_0xacbd('0x9'));var fs=require('fs');var _=require(_0xacbd('0xa'));var squel=require(_0xacbd('0xb'));var crypto=require(_0xacbd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xacbd('0x8'));var querystring=require(_0xacbd('0xd'));var Papa=require(_0xacbd('0xe'));var Redis=require(_0xacbd('0xf'));var authService=require(_0xacbd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xacbd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacbd('0x12'))(_0xacbd('0x13'));var utils=require('../../config/utils');var config=require(_0xacbd('0x14'));var db=require(_0xacbd('0x15'))['db'];function respondWithStatusCode(_0x289c29,_0x49b52b){_0x49b52b=_0x49b52b||0xcc;return function(_0xe8db24){if(_0xe8db24){return _0x289c29[_0xacbd('0x16')](_0x49b52b);}return _0x289c29[_0xacbd('0x17')](_0x49b52b)[_0xacbd('0x18')]();};}function respondWithResult(_0x2c5947,_0x5dee25){_0x5dee25=_0x5dee25||0xc8;return function(_0x5888e0){if(_0x5888e0){return _0x2c5947['status'](_0x5dee25)[_0xacbd('0x19')](_0x5888e0);}};}function respondWithFilteredResult(_0x1a66b5,_0x4a5d58){return function(_0x4fae07){if(_0x4fae07){var _0x23fcbc=_0x4fae07[_0xacbd('0x1a')],_0x25a7b6=_0x4a5d58[_0xacbd('0x1b')],_0x30c2f9=_0x4a5d58[_0xacbd('0x1b')]+_0x4a5d58[_0xacbd('0x1c')],_0x39e409;if(_0x30c2f9>=_0x23fcbc){_0x30c2f9=_0x23fcbc;_0x39e409=0xc8;}else{_0x39e409=0xce;}_0x1a66b5[_0xacbd('0x17')](_0x39e409);return _0x1a66b5[_0xacbd('0x1d')](_0xacbd('0x1e'),_0x25a7b6+'-'+_0x30c2f9+'/'+_0x23fcbc)['json'](_0x4fae07);}return null;};}function patchUpdates(_0x499700){return function(_0x1ad404){try{jsonpatch[_0xacbd('0x1f')](_0x1ad404,_0x499700,!![]);}catch(_0x3cd542){return BPromise[_0xacbd('0x20')](_0x3cd542);}return _0x1ad404[_0xacbd('0x21')]();};}function saveUpdates(_0x51da53,_0x4d4fab){return function(_0x32e117){if(_0x32e117){return _0x32e117[_0xacbd('0x22')](_0x51da53)['then'](function(_0x41eefc){return _0x41eefc;});}return null;};}function removeEntity(_0x303172,_0x257437){return function(_0x285a0e){if(_0x285a0e){return _0x285a0e[_0xacbd('0x23')]()[_0xacbd('0x24')](function(){_0x303172[_0xacbd('0x17')](0xcc)[_0xacbd('0x18')]();});}};}function handleEntityNotFound(_0x587a6a,_0x3afff8){return function(_0x3624a4){if(!_0x3624a4){_0x587a6a['sendStatus'](0x194);}return _0x3624a4;};}function handleError(_0xd268ec,_0x49ae6d){_0x49ae6d=_0x49ae6d||0x1f4;return function(_0x220969){logger['error'](_0x220969[_0xacbd('0x25')]);if(_0x220969[_0xacbd('0x26')]){delete _0x220969['name'];}_0xd268ec[_0xacbd('0x17')](_0x49ae6d)[_0xacbd('0x27')](_0x220969);};}exports[_0xacbd('0x22')]=function(_0x2a071a,_0x3847f5){if(_0x2a071a[_0xacbd('0x28')]['id']){delete _0x2a071a[_0xacbd('0x28')]['id'];}return db[_0xacbd('0x29')]['find']({'where':{'id':_0x2a071a[_0xacbd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3847f5,null))[_0xacbd('0x24')](saveUpdates(_0x2a071a[_0xacbd('0x28')],null))[_0xacbd('0x24')](respondWithResult(_0x3847f5,null))[_0xacbd('0x2b')](handleError(_0x3847f5,null));};exports['destroy']=function(_0x170b5c,_0x5445ab){return db[_0xacbd('0x29')]['find']({'where':{'id':_0x170b5c[_0xacbd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5445ab,null))[_0xacbd('0x24')](removeEntity(_0x5445ab,null))[_0xacbd('0x2b')](handleError(_0x5445ab,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index c301acc..d54e480 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 _0x7452=['../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e7577,_0xee78c1){var _0x364cf3=function(_0x1143b3){while(--_0x1143b3){_0x2e7577['push'](_0x2e7577['shift']());}};_0x364cf3(++_0xee78c1);}(_0x7452,0xa0));var _0x2745=function(_0x39f794,_0x212dc5){_0x39f794=_0x39f794-0x0;var _0x180134=_0x7452[_0x39f794];return _0x180134;};'use strict';var _=require('lodash');var util=require(_0x2745('0x0'));var logger=require(_0x2745('0x1'))(_0x2745('0x2'));var moment=require(_0x2745('0x3'));var BPromise=require(_0x2745('0x4'));var rp=require(_0x2745('0x5'));var fs=require('fs');var path=require(_0x2745('0x6'));var rimraf=require(_0x2745('0x7'));var config=require(_0x2745('0x8'));var attributes=require(_0x2745('0x9'));module[_0x2745('0xa')]=function(_0x19cd44,_0x1fd110){return _0x19cd44[_0x2745('0xb')](_0x2745('0xc'),attributes,{'tableName':_0x2745('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac79=['tools_conditions','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./condition.attributes','define'];(function(_0x728761,_0x4132a6){var _0xe26006=function(_0x388cae){while(--_0x388cae){_0x728761['push'](_0x728761['shift']());}};_0xe26006(++_0x4132a6);}(_0xac79,0xc9));var _0x9ac7=function(_0x42bd65,_0x52326b){_0x42bd65=_0x42bd65-0x0;var _0x279c12=_0xac79[_0x42bd65];return _0x279c12;};'use strict';var _=require(_0x9ac7('0x0'));var util=require('util');var logger=require(_0x9ac7('0x1'))(_0x9ac7('0x2'));var moment=require(_0x9ac7('0x3'));var BPromise=require(_0x9ac7('0x4'));var rp=require(_0x9ac7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ac7('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ac7('0x7'));module['exports']=function(_0x2e164d,_0x276749){return _0x2e164d[_0x9ac7('0x8')]('Condition',attributes,{'tableName':_0x9ac7('0x9'),'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 c7a85c9..3716f50 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 _0xd1f0=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x219d39,_0x335889){var _0x7a67a8=function(_0x3fd411){while(--_0x3fd411){_0x219d39['push'](_0x219d39['shift']());}};_0x7a67a8(++_0x335889);}(_0xd1f0,0x168));var _0x0d1f=function(_0x22b98c,_0x3cc5dc){_0x22b98c=_0x22b98c-0x0;var _0x5e846e=_0xd1f0[_0x22b98c];return _0x5e846e;};'use strict';var _=require('lodash');var util=require(_0x0d1f('0x0'));var moment=require('moment');var BPromise=require(_0x0d1f('0x1'));var rs=require(_0x0d1f('0x2'));var fs=require('fs');var Redis=require(_0x0d1f('0x3'));var db=require(_0x0d1f('0x4'))['db'];var utils=require(_0x0d1f('0x5'));var logger=require(_0x0d1f('0x6'))(_0x0d1f('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d1f('0x8'));var client=jayson[_0x0d1f('0x9')][_0x0d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a3f50,_0x9c9452,_0x15dfb5){return new BPromise(function(_0xdb403e,_0x172f0c){return client[_0x0d1f('0xb')](_0x1a3f50,_0x15dfb5)['then'](function(_0x10d242){logger[_0x0d1f('0xc')](_0x0d1f('0xd'),_0x9c9452,_0x0d1f('0xe'));logger[_0x0d1f('0xf')](_0x0d1f('0x10'),_0x9c9452,_0x0d1f('0xe'),JSON['stringify'](_0x10d242));if(_0x10d242['error']){if(_0x10d242['error']['code']===0x1f4){logger[_0x0d1f('0x11')](_0x0d1f('0xd'),_0x9c9452,_0x10d242[_0x0d1f('0x11')][_0x0d1f('0x12')]);return _0x172f0c(_0x10d242[_0x0d1f('0x11')][_0x0d1f('0x12')]);}logger['error'](_0x0d1f('0xd'),_0x9c9452,_0x10d242[_0x0d1f('0x11')]['message']);return _0xdb403e(_0x10d242[_0x0d1f('0x11')]['message']);}else{logger['info'](_0x0d1f('0xd'),_0x9c9452,_0x0d1f('0xe'));_0xdb403e(_0x10d242[_0x0d1f('0x13')][_0x0d1f('0x12')]);}})[_0x0d1f('0x14')](function(_0x19df78){logger[_0x0d1f('0x11')]('Condition,\x20%s,\x20%s',_0x9c9452,_0x19df78);_0x172f0c(_0x19df78);});});} \ No newline at end of file +var _0xa51b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa51b,0xb1));var _0xba51=function(_0x3c5cc7,_0x447374){_0x3c5cc7=_0x3c5cc7-0x0;var _0x2aef2a=_0xa51b[_0x3c5cc7];return _0x2aef2a;};'use strict';var _=require(_0xba51('0x0'));var util=require(_0xba51('0x1'));var moment=require('moment');var BPromise=require(_0xba51('0x2'));var rs=require(_0xba51('0x3'));var fs=require('fs');var Redis=require(_0xba51('0x4'));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(_0x57b6a3,_0x1b4812,_0x199a67){return new BPromise(function(_0x18078b,_0x4284c3){return client['request'](_0x57b6a3,_0x199a67)['then'](function(_0x2e5119){logger[_0xba51('0xd')](_0xba51('0xe'),_0x1b4812,'request\x20sent');logger[_0xba51('0xf')](_0xba51('0x10'),_0x1b4812,_0xba51('0x11'),JSON[_0xba51('0x12')](_0x2e5119));if(_0x2e5119[_0xba51('0x13')]){if(_0x2e5119[_0xba51('0x13')]['code']===0x1f4){logger[_0xba51('0x13')](_0xba51('0xe'),_0x1b4812,_0x2e5119[_0xba51('0x13')]['message']);return _0x4284c3(_0x2e5119['error'][_0xba51('0x14')]);}logger[_0xba51('0x13')](_0xba51('0xe'),_0x1b4812,_0x2e5119['error']['message']);return _0x18078b(_0x2e5119[_0xba51('0x13')][_0xba51('0x14')]);}else{logger[_0xba51('0xd')]('Condition,\x20%s,\x20%s',_0x1b4812,_0xba51('0x11'));_0x18078b(_0x2e5119[_0xba51('0x15')]['message']);}})[_0xba51('0x16')](function(_0x1d6971){logger[_0xba51('0x13')](_0xba51('0xe'),_0x1b4812,_0x1d6971);_0x4284c3(_0x1d6971);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index dd2b70e..71fa9bd 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 _0xb064=['isAuthenticated','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','put','update'];(function(_0x1da778,_0x39d34c){var _0x87ed15=function(_0xbb966f){while(--_0xbb966f){_0x1da778['push'](_0x1da778['shift']());}};_0x87ed15(++_0x39d34c);}(_0xb064,0x18e));var _0x4b06=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb064[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x4b06('0x0'));var util=require(_0x4b06('0x1'));var path=require('path');var timeout=require(_0x4b06('0x2'));var express=require(_0x4b06('0x3'));var router=express[_0x4b06('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4b06('0x5'));var config=require(_0x4b06('0x6'));var controller=require('./condition.controller');router[_0x4b06('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4b06('0x8')]);router['delete']('/:id',auth[_0x4b06('0x9')](),controller[_0x4b06('0xa')]);module['exports']=router; \ No newline at end of file +var _0x6546=['/:id','isAuthenticated','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','put'];(function(_0x1919ba,_0x1d9c12){var _0x30c9ca=function(_0x2c3c52){while(--_0x2c3c52){_0x1919ba['push'](_0x1919ba['shift']());}};_0x30c9ca(++_0x1d9c12);}(_0x6546,0x1e6));var _0x6654=function(_0x1fc75d,_0x41cb7d){_0x1fc75d=_0x1fc75d-0x0;var _0x10a48d=_0x6546[_0x1fc75d];return _0x10a48d;};'use strict';var multer=require(_0x6654('0x0'));var util=require('util');var path=require(_0x6654('0x1'));var timeout=require(_0x6654('0x2'));var express=require(_0x6654('0x3'));var router=express[_0x6654('0x4')]();var auth=require(_0x6654('0x5'));var interaction=require(_0x6654('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x6654('0x7')](_0x6654('0x8'),auth[_0x6654('0x9')](),controller['update']);router[_0x6654('0xa')]('/:id',auth[_0x6654('0x9')](),controller[_0x6654('0xb')]);module[_0x6654('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 7505a25..ad45d66 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 _0x503a=['STRING','sequelize','exports','name'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x503a,0x19d));var _0xa503=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0x503a[_0x402c8f];return _0x11e809;};'use strict';var Sequelize=require(_0xa503('0x0'));module[_0xa503('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa503('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa503('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x34f8=['STRING','name','INTEGER','sequelize','exports'];(function(_0xbb24d7,_0x702a5d){var _0x2d38b0=function(_0x19a998){while(--_0x19a998){_0xbb24d7['push'](_0xbb24d7['shift']());}};_0x2d38b0(++_0x702a5d);}(_0x34f8,0x80));var _0x834f=function(_0x4dd1d9,_0x37c23d){_0x4dd1d9=_0x4dd1d9-0x0;var _0x20e38b=_0x34f8[_0x4dd1d9];return _0x20e38b;};'use strict';var Sequelize=require(_0x834f('0x0'));module[_0x834f('0x1')]={'name':{'type':Sequelize[_0x834f('0x2')],'allowNull':![],'unique':_0x834f('0x3')},'OrderBy':{'type':Sequelize[_0x834f('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0724417..5f244e7 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 _0x9957=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','get','ContactItemTypes','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','ContactItemType','count','include','catch','show','params','keys','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','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'];(function(_0x424529,_0xbf18bd){var _0x1bb074=function(_0x250350){while(--_0x250350){_0x424529['push'](_0x424529['shift']());}};_0x1bb074(++_0xbf18bd);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];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(){var _0x32a09a=_0x460924[_0x7995('0x26')]({'plain':!![]});var _0x204507=_0x7995('0x27');return db[_0x7995('0x28')][_0x7995('0x25')]({'where':{'type':_0x204507,'resourceId':_0x32a09a['id']}})[_0x7995('0x24')](function(){return _0x460924;});})[_0x7995('0x24')](function(){_0x350fd9['status'](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1a')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x29')]);if(_0x47625f[_0x7995('0x2a')]){delete _0x47625f[_0x7995('0x2a')];}_0x2a307e[_0x7995('0x1b')](_0x56691a)[_0x7995('0x2b')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['ContactItemType'][_0x7995('0x2c')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2d')],'type':_0xe6b0b3[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x3250e0[_0x7995('0x30')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x31')]=_['keys'](_0x9b2a15[_0x7995('0x31')]);_0x3250e0[_0x7995('0x32')]=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],_0x3250e0[_0x7995('0x31')]);_0x456a28['attributes']=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x34')]=_0x456a28[_0x7995('0x34')]['length']?_0x456a28[_0x7995('0x34')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x31')][_0x7995('0x35')](_0x7995('0x36'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x31')]['limit']);_0x456a28['offset']=qs[_0x7995('0x1e')](_0x9b2a15[_0x7995('0x31')]['offset']);}_0x456a28[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x9b2a15[_0x7995('0x31')][_0x7995('0x38')]);_0x456a28[_0x7995('0x39')]=qs['filters'](_[_0x7995('0x3a')](_0x9b2a15[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]),_0x574574);if(_0x9b2a15[_0x7995('0x31')]['filter']){_0x456a28[_0x7995('0x39')]=_[_0x7995('0x3b')](_0x456a28[_0x7995('0x39')],{'$or':_[_0x7995('0x3c')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2e')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2a')]]={'$like':'%'+_0x9b2a15[_0x7995('0x31')][_0x7995('0x3d')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3b')]({},_0x456a28,_0x9b2a15[_0x7995('0x3e')]);var _0x14d638={'where':_0x456a28[_0x7995('0x39')]};return db[_0x7995('0x3f')][_0x7995('0x40')](_0x14d638)[_0x7995('0x24')](function(_0x270d52){_0x4253e5[_0x7995('0x40')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x3f')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x42')](handleError(_0x514445,null));};exports[_0x7995('0x43')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':!![],'where':{'id':_0x35c8ff[_0x7995('0x44')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x3f')][_0x7995('0x2c')]);_0x5e85b9[_0x7995('0x31')]=_[_0x7995('0x45')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x33')](_0x5e85b9[_0x7995('0x30')],_0x5e85b9[_0x7995('0x31')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x30')],qs['fields'](_0x35c8ff[_0x7995('0x31')]['fields']));_0x46ac4f[_0x7995('0x34')]=_0x46ac4f['attributes'][_0x7995('0x46')]?_0x46ac4f[_0x7995('0x34')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x31')][_0x7995('0x47')]){_0x46ac4f[_0x7995('0x41')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3b')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x3f')][_0x7995('0x48')](_0x46ac4f)[_0x7995('0x24')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x42')](handleError(_0x576b96,null));};exports[_0x7995('0x49')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x3f')]['create'](_0x511567[_0x7995('0x4a')],{})[_0x7995('0x24')](function(_0x5921b9){var _0x3d1dbb=_0x511567['user'][_0x7995('0x26')]({'plain':!![]});if(!_0x3d1dbb)throw new Error(_0x7995('0x4b'));if(_0x3d1dbb[_0x7995('0x4c')]===_0x7995('0x4d')){var _0xddf537=_0x5921b9[_0x7995('0x26')]({'plain':!![]});var _0x1579b9='ContactItemTypes';return db[_0x7995('0x4e')][_0x7995('0x48')]({'where':{'name':_0x1579b9,'userProfileId':_0x3d1dbb[_0x7995('0x4f')]},'raw':!![]})['then'](function(_0x19da63){if(_0x19da63&&_0x19da63[_0x7995('0x50')]===0x0){return db[_0x7995('0x28')]['create']({'name':_0xddf537['name'],'resourceId':_0xddf537['id'],'type':_0x19da63['name'],'sectionId':_0x19da63['id']},{})[_0x7995('0x24')](function(){return _0x5921b9;});}else{return _0x5921b9;}})[_0x7995('0x42')](function(_0x4cf5db){logger[_0x7995('0x51')](_0x7995('0x52'),_0x4cf5db);throw _0x4cf5db;});}return _0x5921b9;})[_0x7995('0x24')](respondWithResult(_0x3d8ae3,0xc9))[_0x7995('0x42')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x53')]=function(_0x528c8e,_0x29ee32){if(_0x528c8e['body']['id']){delete _0x528c8e[_0x7995('0x4a')]['id'];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':{'id':_0x528c8e['params']['id']}})['then'](handleEntityNotFound(_0x29ee32,null))['then'](saveUpdates(_0x528c8e['body'],null))[_0x7995('0x24')](respondWithResult(_0x29ee32,null))[_0x7995('0x42')](handleError(_0x29ee32,null));};exports[_0x7995('0x25')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':{'id':_0x150261[_0x7995('0x44')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1d957e,null))[_0x7995('0x24')](removeEntity(_0x1d957e,null))[_0x7995('0x42')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x4b84=['fast-json-patch','bluebird','mustache','util','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','set','Content-Range','reject','save','update','then','get','ContactItemTypes','destroy','status','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','error','html-pdf','eml-format'];(function(_0x378d80,_0x30c95a){var _0x52b0ba=function(_0x3864a2){while(--_0x3864a2){_0x378d80['push'](_0x378d80['shift']());}};_0x52b0ba(++_0x30c95a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0x4b84[_0x52b24f];return _0x46ea6b;};'use strict';var pdf=require(_0x44b8('0x0'));var emlformat=require(_0x44b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44b8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44b8('0x3'));var Mustache=require(_0x44b8('0x4'));var util=require(_0x44b8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44b8('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147529,_0x4301a6){_0x4301a6=_0x4301a6||0xcc;return function(_0x4bcc43){if(_0x4bcc43){return _0x147529[_0x44b8('0x13')](_0x4301a6);}return _0x147529['status'](_0x4301a6)[_0x44b8('0x14')]();};}function respondWithResult(_0x18d642,_0x4df670){_0x4df670=_0x4df670||0xc8;return function(_0x63e8f6){if(_0x63e8f6){return _0x18d642['status'](_0x4df670)['json'](_0x63e8f6);}};}function respondWithFilteredResult(_0x2a3e4c,_0x2af0ad){return function(_0x1722da){if(_0x1722da){var _0x41ab46=_0x1722da[_0x44b8('0x15')],_0x5e52f2=_0x2af0ad['offset'],_0x495c74=_0x2af0ad[_0x44b8('0x16')]+_0x2af0ad[_0x44b8('0x17')],_0x5d6349;if(_0x495c74>=_0x41ab46){_0x495c74=_0x41ab46;_0x5d6349=0xc8;}else{_0x5d6349=0xce;}_0x2a3e4c['status'](_0x5d6349);return _0x2a3e4c[_0x44b8('0x18')](_0x44b8('0x19'),_0x5e52f2+'-'+_0x495c74+'/'+_0x41ab46)['json'](_0x1722da);}return null;};}function patchUpdates(_0x89bc30){return function(_0x3f4688){try{jsonpatch['apply'](_0x3f4688,_0x89bc30,!![]);}catch(_0xcce202){return BPromise[_0x44b8('0x1a')](_0xcce202);}return _0x3f4688[_0x44b8('0x1b')]();};}function saveUpdates(_0x235bdc,_0x102ef9){return function(_0x369c09){if(_0x369c09){return _0x369c09[_0x44b8('0x1c')](_0x235bdc)[_0x44b8('0x1d')](function(_0x429461){return _0x429461;});}return null;};}function removeEntity(_0x1e0f2d,_0x1d642b){return function(_0x14996c){if(_0x14996c){return _0x14996c['destroy']()[_0x44b8('0x1d')](function(){var _0x3a8aa4=_0x14996c[_0x44b8('0x1e')]({'plain':!![]});var _0x1418db=_0x44b8('0x1f');return db['UserProfileResource'][_0x44b8('0x20')]({'where':{'type':_0x1418db,'resourceId':_0x3a8aa4['id']}})['then'](function(){return _0x14996c;});})[_0x44b8('0x1d')](function(){_0x1e0f2d[_0x44b8('0x21')](0xcc)[_0x44b8('0x14')]();});}};}function handleEntityNotFound(_0x47689e,_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x47689e[_0x44b8('0x13')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x22')]);if(_0x350482[_0x44b8('0x23')]){delete _0x350482[_0x44b8('0x23')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x24')](_0x350482);};}exports[_0x44b8('0x25')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={},_0xfb0028={},_0x5a544c={'count':0x0,'rows':[]};var _0x559f0b=_['map'](db[_0x44b8('0x26')][_0x44b8('0x27')],function(_0x44ce5a){return{'name':_0x44ce5a[_0x44b8('0x28')],'type':_0x44ce5a[_0x44b8('0x29')][_0x44b8('0x2a')]};});_0xfb0028[_0x44b8('0x2b')]=_[_0x44b8('0x2c')](_0x559f0b,_0x44b8('0x23'));_0xfb0028[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x53d9c7[_0x44b8('0x2d')]);_0xfb0028[_0x44b8('0x2f')]=_['intersection'](_0xfb0028[_0x44b8('0x2b')],_0xfb0028['query']);_0x4a182d[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0xfb0028[_0x44b8('0x2b')],qs[_0x44b8('0x32')](_0x53d9c7[_0x44b8('0x2d')]['fields']));_0x4a182d[_0x44b8('0x30')]=_0x4a182d[_0x44b8('0x30')][_0x44b8('0x33')]?_0x4a182d[_0x44b8('0x30')]:_0xfb0028[_0x44b8('0x2b')];if(!_0x53d9c7['query'][_0x44b8('0x34')](_0x44b8('0x35'))){_0x4a182d[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x4a182d[_0x44b8('0x16')]=qs[_0x44b8('0x16')](_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x16')]);}_0x4a182d[_0x44b8('0x36')]=qs[_0x44b8('0x37')](_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x37')]);_0x4a182d[_0x44b8('0x38')]=qs[_0x44b8('0x2f')](_[_0x44b8('0x39')](_0x53d9c7[_0x44b8('0x2d')],_0xfb0028[_0x44b8('0x2f')]),_0x559f0b);if(_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x4a182d[_0x44b8('0x38')]=_['merge'](_0x4a182d[_0x44b8('0x38')],{'$or':_[_0x44b8('0x2c')](_0x559f0b,function(_0x4fcfa0){if(_0x4fcfa0[_0x44b8('0x29')]!==_0x44b8('0x3b')){var _0x6658be={};_0x6658be[_0x4fcfa0[_0x44b8('0x23')]]={'$like':'%'+_0x53d9c7['query'][_0x44b8('0x3a')]+'%'};return _0x6658be;}})});}_0x4a182d=_[_0x44b8('0x3c')]({},_0x4a182d,_0x53d9c7[_0x44b8('0x3d')]);var _0x1ee3cc={'where':_0x4a182d[_0x44b8('0x38')]};return db[_0x44b8('0x26')][_0x44b8('0x15')](_0x1ee3cc)[_0x44b8('0x1d')](function(_0x209039){_0x5a544c[_0x44b8('0x15')]=_0x209039;if(_0x53d9c7[_0x44b8('0x2d')][_0x44b8('0x3e')]){_0x4a182d[_0x44b8('0x3f')]=[{'all':!![]}];}return db[_0x44b8('0x26')][_0x44b8('0x40')](_0x4a182d);})[_0x44b8('0x1d')](function(_0x57d8c4){_0x5a544c[_0x44b8('0x41')]=_0x57d8c4;return _0x5a544c;})[_0x44b8('0x1d')](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x42')](handleError(_0x2e0174,null));};exports['show']=function(_0xd424f8,_0x1054c5){var _0x229cc9={'raw':!![],'where':{'id':_0xd424f8[_0x44b8('0x43')]['id']}},_0x585a16={};_0x585a16[_0x44b8('0x2b')]=_[_0x44b8('0x2e')](db[_0x44b8('0x26')][_0x44b8('0x27')]);_0x585a16['query']=_['keys'](_0xd424f8[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x2f')]=_[_0x44b8('0x31')](_0x585a16[_0x44b8('0x2b')],_0x585a16[_0x44b8('0x2d')]);_0x229cc9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x585a16[_0x44b8('0x2b')],qs[_0x44b8('0x32')](_0xd424f8[_0x44b8('0x2d')][_0x44b8('0x32')]));_0x229cc9[_0x44b8('0x30')]=_0x229cc9[_0x44b8('0x30')][_0x44b8('0x33')]?_0x229cc9[_0x44b8('0x30')]:_0x585a16[_0x44b8('0x2b')];if(_0xd424f8[_0x44b8('0x2d')][_0x44b8('0x3e')]){_0x229cc9[_0x44b8('0x3f')]=[{'all':!![]}];}_0x229cc9=_['merge']({},_0x229cc9,_0xd424f8['options']);return db[_0x44b8('0x26')][_0x44b8('0x44')](_0x229cc9)[_0x44b8('0x1d')](handleEntityNotFound(_0x1054c5,null))[_0x44b8('0x1d')](respondWithResult(_0x1054c5,null))[_0x44b8('0x42')](handleError(_0x1054c5,null));};exports[_0x44b8('0x45')]=function(_0x411ed6,_0x4fe73f){return db[_0x44b8('0x26')]['create'](_0x411ed6[_0x44b8('0x46')],{})[_0x44b8('0x1d')](function(_0x1dbc28){var _0x9207bf=_0x411ed6[_0x44b8('0x47')][_0x44b8('0x1e')]({'plain':!![]});if(!_0x9207bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9207bf[_0x44b8('0x48')]===_0x44b8('0x47')){var _0x10602c=_0x1dbc28[_0x44b8('0x1e')]({'plain':!![]});var _0x4ccc77=_0x44b8('0x1f');return db[_0x44b8('0x49')][_0x44b8('0x44')]({'where':{'name':_0x4ccc77,'userProfileId':_0x9207bf[_0x44b8('0x4a')]},'raw':!![]})[_0x44b8('0x1d')](function(_0x470ebb){if(_0x470ebb&&_0x470ebb['autoAssociation']===0x0){return db[_0x44b8('0x4b')][_0x44b8('0x45')]({'name':_0x10602c[_0x44b8('0x23')],'resourceId':_0x10602c['id'],'type':_0x470ebb[_0x44b8('0x23')],'sectionId':_0x470ebb['id']},{})[_0x44b8('0x1d')](function(){return _0x1dbc28;});}else{return _0x1dbc28;}})['catch'](function(_0x493840){logger[_0x44b8('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x493840);throw _0x493840;});}return _0x1dbc28;})[_0x44b8('0x1d')](respondWithResult(_0x4fe73f,0xc9))['catch'](handleError(_0x4fe73f,null));};exports[_0x44b8('0x1c')]=function(_0x434d6a,_0x1a29f6){if(_0x434d6a[_0x44b8('0x46')]['id']){delete _0x434d6a[_0x44b8('0x46')]['id'];}return db[_0x44b8('0x26')][_0x44b8('0x44')]({'where':{'id':_0x434d6a['params']['id']}})[_0x44b8('0x1d')](handleEntityNotFound(_0x1a29f6,null))[_0x44b8('0x1d')](saveUpdates(_0x434d6a[_0x44b8('0x46')],null))['then'](respondWithResult(_0x1a29f6,null))[_0x44b8('0x42')](handleError(_0x1a29f6,null));};exports[_0x44b8('0x20')]=function(_0x45f9a0,_0x2b256b){return db['ContactItemType'][_0x44b8('0x44')]({'where':{'id':_0x45f9a0[_0x44b8('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b256b,null))[_0x44b8('0x1d')](removeEntity(_0x2b256b,null))[_0x44b8('0x42')](handleError(_0x2b256b,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index ca14f82..b78af87 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 _0xd7c3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x2bfbf0,_0x1a22ac){_0x2bfbf0=_0x2bfbf0-0x0;var _0x25a8a2=_0xd7c3[_0x2bfbf0];return _0x25a8a2;};'use strict';var _=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var logger=require(_0x3d7c('0x2'))(_0x3d7c('0x3'));var moment=require(_0x3d7c('0x4'));var BPromise=require(_0x3d7c('0x5'));var rp=require(_0x3d7c('0x6'));var fs=require('fs');var path=require(_0x3d7c('0x7'));var rimraf=require(_0x3d7c('0x8'));var config=require('../../config/environment');var attributes=require(_0x3d7c('0x9'));module['exports']=function(_0x52b31c,_0x504e04){return _0x52b31c[_0x3d7c('0xa')](_0x3d7c('0xb'),attributes,{'tableName':_0x3d7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5e0=['rimraf','../../config/environment','exports','define','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4f6f79,_0x39299b){var _0x2a7f9a=function(_0x3e2547){while(--_0x3e2547){_0x4f6f79['push'](_0x4f6f79['shift']());}};_0x2a7f9a(++_0x39299b);}(_0xe5e0,0x123));var _0x0e5e=function(_0x545a6d,_0x4bab36){_0x545a6d=_0x545a6d-0x0;var _0x1aa192=_0xe5e0[_0x545a6d];return _0x1aa192;};'use strict';var _=require(_0x0e5e('0x0'));var util=require(_0x0e5e('0x1'));var logger=require(_0x0e5e('0x2'))(_0x0e5e('0x3'));var moment=require(_0x0e5e('0x4'));var BPromise=require(_0x0e5e('0x5'));var rp=require(_0x0e5e('0x6'));var fs=require('fs');var path=require(_0x0e5e('0x7'));var rimraf=require(_0x0e5e('0x8'));var config=require(_0x0e5e('0x9'));var attributes=require('./contactItemType.attributes');module[_0x0e5e('0xa')]=function(_0x39c487,_0x5cc97b){return _0x39c487[_0x0e5e('0xb')]('ContactItemType',attributes,{'tableName':_0x0e5e('0xc'),'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 d3e154f..b506154 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 _0x2333=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x2333,0x11a));var _0x3233=function(_0x22a499,_0x34b48b){_0x22a499=_0x22a499-0x0;var _0x2c8e08=_0x2333[_0x22a499];return _0x2c8e08;};'use strict';var _=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3233('0x2'));var fs=require('fs');var Redis=require(_0x3233('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3233('0x4'));var logger=require(_0x3233('0x5'))(_0x3233('0x6'));var config=require(_0x3233('0x7'));var jayson=require(_0x3233('0x8'));var client=jayson[_0x3233('0x9')][_0x3233('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33a56d,_0x1e93e8,_0x1842a1){return new BPromise(function(_0x1837b6,_0x2ee6df){return client[_0x3233('0xb')](_0x33a56d,_0x1842a1)[_0x3233('0xc')](function(_0x7ff4bd){logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));logger[_0x3233('0x10')](_0x3233('0x11'),_0x1e93e8,_0x3233('0xf'),JSON['stringify'](_0x7ff4bd));if(_0x7ff4bd[_0x3233('0x12')]){if(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x13')]===0x1f4){logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x2ee6df(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);}logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x1837b6(_0x7ff4bd['error']['message']);}else{logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));_0x1837b6(_0x7ff4bd['result'][_0x3233('0x14')]);}})[_0x3233('0x15')](function(_0x127227){logger['error'](_0x3233('0xe'),_0x1e93e8,_0x127227);_0x2ee6df(_0x127227);});});} \ No newline at end of file +var _0x41bb=['ContactItemType,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x73a7e8,_0x114f8b){var _0x170204=function(_0x3c35d0){while(--_0x3c35d0){_0x73a7e8['push'](_0x73a7e8['shift']());}};_0x170204(++_0x114f8b);}(_0x41bb,0xc5));var _0xb41b=function(_0xcffa56,_0x24050e){_0xcffa56=_0xcffa56-0x0;var _0x279b03=_0x41bb[_0xcffa56];return _0x279b03;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 5eb915d..656cf8d 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 _0xee9f=['put','delete','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x540001,_0x12d305){var _0xc2a7e2=function(_0x57d42c){while(--_0x57d42c){_0x540001['push'](_0x540001['shift']());}};_0xc2a7e2(++_0x12d305);}(_0xee9f,0x1bd));var _0xfee9=function(_0x1bd048,_0x5a4857){_0x1bd048=_0x1bd048-0x0;var _0x5eac6a=_0xee9f[_0x1bd048];return _0x5eac6a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfee9('0x0'));var timeout=require(_0xfee9('0x1'));var express=require('express');var router=express[_0xfee9('0x2')]();var auth=require(_0xfee9('0x3'));var interaction=require(_0xfee9('0x4'));var config=require(_0xfee9('0x5'));var controller=require(_0xfee9('0x6'));router[_0xfee9('0x7')]('/',auth[_0xfee9('0x8')](),controller[_0xfee9('0x9')]);router[_0xfee9('0x7')](_0xfee9('0xa'),auth['isAuthenticated'](),controller[_0xfee9('0xb')]);router[_0xfee9('0xc')]('/',auth[_0xfee9('0x8')](),controller[_0xfee9('0xd')]);router[_0xfee9('0xe')](_0xfee9('0xa'),auth[_0xfee9('0x8')](),controller['update']);router[_0xfee9('0xf')](_0xfee9('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xfee9('0x10')]=router; \ No newline at end of file +var _0xc0f4=['get','show','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./contactItemType.controller','isAuthenticated'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xc0f4,0xe5));var _0x4c0f=function(_0x3e2c08,_0x49ed2d){_0x3e2c08=_0x3e2c08-0x0;var _0x26d60e=_0xc0f4[_0x3e2c08];return _0x26d60e;};'use strict';var multer=require(_0x4c0f('0x0'));var util=require(_0x4c0f('0x1'));var path=require(_0x4c0f('0x2'));var timeout=require(_0x4c0f('0x3'));var express=require(_0x4c0f('0x4'));var router=express[_0x4c0f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4c0f('0x6'));var config=require('../../config/environment');var controller=require(_0x4c0f('0x7'));router['get']('/',auth[_0x4c0f('0x8')](),controller['index']);router[_0x4c0f('0x9')]('/:id',auth[_0x4c0f('0x8')](),controller[_0x4c0f('0xa')]);router[_0x4c0f('0xb')]('/',auth[_0x4c0f('0x8')](),controller[_0x4c0f('0xc')]);router['put'](_0x4c0f('0xd'),auth[_0x4c0f('0x8')](),controller[_0x4c0f('0xe')]);router['delete'](_0x4c0f('0xd'),auth['isAuthenticated'](),controller[_0x4c0f('0xf')]);module[_0x4c0f('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c547493..cccaa65 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 _0x975a=['STRING','name','sequelize','exports'];(function(_0x5d66dd,_0x1d7ab2){var _0x38be7b=function(_0x10cccc){while(--_0x10cccc){_0x5d66dd['push'](_0x5d66dd['shift']());}};_0x38be7b(++_0x1d7ab2);}(_0x975a,0x142));var _0xa975=function(_0x5a0847,_0xd72ff2){_0x5a0847=_0x5a0847-0x0;var _0x3d460e=_0x975a[_0x5a0847];return _0x3d460e;};'use strict';var Sequelize=require(_0xa975('0x0'));module[_0xa975('0x1')]={'name':{'type':Sequelize[_0xa975('0x2')],'allowNull':![],'unique':_0xa975('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2494=['name','sequelize','STRING'];(function(_0x1a58fa,_0x4a947d){var _0x1f35ac=function(_0x46c001){while(--_0x46c001){_0x1a58fa['push'](_0x1a58fa['shift']());}};_0x1f35ac(++_0x4a947d);}(_0x2494,0x82));var _0x4249=function(_0x17823c,_0x165b9a){_0x17823c=_0x17823c-0x0;var _0x5105af=_0x2494[_0x17823c];return _0x5105af;};'use strict';var Sequelize=require(_0x4249('0x0'));module['exports']={'name':{'type':Sequelize[_0x4249('0x1')],'allowNull':![],'unique':_0x4249('0x2')},'description':{'type':Sequelize[_0x4249('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 41ce5b3..48c9a17 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 _0xf7de=['https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','hasOwnProperty','html-pdf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','end','sendStatus','error','map','Dashboard','rawAttributes','fieldName','type','key','name','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xf7de,0x110));var _0xef7d=function(_0x12f35d,_0x4da28d){_0x12f35d=_0x12f35d-0x0;var _0x274483=_0xf7de[_0x12f35d];return _0x274483;};'use strict';var pdf=require(_0xef7d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xef7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef7d('0x2'));var rp=require(_0xef7d('0x3'));var moment=require(_0xef7d('0x4'));var BPromise=require(_0xef7d('0x5'));var Mustache=require(_0xef7d('0x6'));var util=require(_0xef7d('0x7'));var path=require(_0xef7d('0x8'));var sox=require(_0xef7d('0x9'));var csv=require(_0xef7d('0xa'));var ejs=require(_0xef7d('0xb'));var fs=require('fs');var _=require(_0xef7d('0xc'));var squel=require(_0xef7d('0xd'));var crypto=require('crypto');var jsforce=require(_0xef7d('0xe'));var deskjs=require(_0xef7d('0xf'));var toCsv=require(_0xef7d('0xa'));var querystring=require(_0xef7d('0x10'));var Papa=require(_0xef7d('0x11'));var Redis=require(_0xef7d('0x12'));var authService=require(_0xef7d('0x13'));var qs=require(_0xef7d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef7d('0x15'));var logger=require(_0xef7d('0x16'))(_0xef7d('0x17'));var utils=require(_0xef7d('0x18'));var config=require('../../config/environment');var db=require(_0xef7d('0x19'))['db'];config[_0xef7d('0x1a')]=_['defaults'](config[_0xef7d('0x1a')],{'host':_0xef7d('0x1b'),'port':0x18eb});var socket=require(_0xef7d('0x1c'))(new Redis(config[_0xef7d('0x1a')]));require(_0xef7d('0x1d'))[_0xef7d('0x1e')](socket);function respondWithStatusCode(_0x3638c2,_0x48f7b6){_0x48f7b6=_0x48f7b6||0xcc;return function(_0x517630){if(_0x517630){return _0x3638c2['sendStatus'](_0x48f7b6);}return _0x3638c2['status'](_0x48f7b6)['end']();};}function respondWithResult(_0x47bb84,_0x36f9f7){_0x36f9f7=_0x36f9f7||0xc8;return function(_0x512c8a){if(_0x512c8a){return _0x47bb84['status'](_0x36f9f7)[_0xef7d('0x1f')](_0x512c8a);}};}function respondWithFilteredResult(_0x33a66e,_0x5e27ed){return function(_0x1c58b0){if(_0x1c58b0){var _0x43ee72=_0x1c58b0[_0xef7d('0x20')],_0xbb154c=_0x5e27ed['offset'],_0x218f1b=_0x5e27ed[_0xef7d('0x21')]+_0x5e27ed[_0xef7d('0x22')],_0x6cc36b;if(_0x218f1b>=_0x43ee72){_0x218f1b=_0x43ee72;_0x6cc36b=0xc8;}else{_0x6cc36b=0xce;}_0x33a66e[_0xef7d('0x23')](_0x6cc36b);return _0x33a66e[_0xef7d('0x24')](_0xef7d('0x25'),_0xbb154c+'-'+_0x218f1b+'/'+_0x43ee72)[_0xef7d('0x1f')](_0x1c58b0);}return null;};}function patchUpdates(_0x4a18b1){return function(_0x1a212f){try{jsonpatch[_0xef7d('0x26')](_0x1a212f,_0x4a18b1,!![]);}catch(_0x12f2d2){return BPromise[_0xef7d('0x27')](_0x12f2d2);}return _0x1a212f[_0xef7d('0x28')]();};}function saveUpdates(_0x498d53,_0x3d90ae){return function(_0x36e724){if(_0x36e724){return _0x36e724[_0xef7d('0x29')](_0x498d53)[_0xef7d('0x2a')](function(_0x195647){return _0x195647;});}return null;};}function removeEntity(_0x237b08,_0x28f322){return function(_0x25d41c){if(_0x25d41c){return _0x25d41c['destroy']()['then'](function(){var _0x3ba32c=_0x25d41c[_0xef7d('0x2b')]({'plain':!![]});var _0x5bf7f1=_0xef7d('0x2c');return db[_0xef7d('0x2d')][_0xef7d('0x2e')]({'where':{'type':_0x5bf7f1,'resourceId':_0x3ba32c['id']}})[_0xef7d('0x2a')](function(){return _0x25d41c;});})[_0xef7d('0x2a')](function(){_0x237b08['status'](0xcc)[_0xef7d('0x2f')]();});}};}function handleEntityNotFound(_0xfea56,_0x4d9c18){return function(_0x71f137){if(!_0x71f137){_0xfea56[_0xef7d('0x30')](0x194);}return _0x71f137;};}function handleError(_0x50f55c,_0x19573b){_0x19573b=_0x19573b||0x1f4;return function(_0xf1ddf9){logger[_0xef7d('0x31')](_0xf1ddf9['stack']);if(_0xf1ddf9['name']){delete _0xf1ddf9['name'];}_0x50f55c[_0xef7d('0x23')](_0x19573b)['send'](_0xf1ddf9);};}exports['index']=function(_0x1ab1ab,_0x52ced6){var _0xb177b4={},_0x4bead0={},_0x9a4773={'count':0x0,'rows':[]};var _0x6b2af1=_[_0xef7d('0x32')](db[_0xef7d('0x33')][_0xef7d('0x34')],function(_0x3c1366){return{'name':_0x3c1366[_0xef7d('0x35')],'type':_0x3c1366[_0xef7d('0x36')][_0xef7d('0x37')]};});_0x4bead0['model']=_[_0xef7d('0x32')](_0x6b2af1,_0xef7d('0x38'));_0x4bead0[_0xef7d('0x39')]=_['keys'](_0x1ab1ab[_0xef7d('0x39')]);_0x4bead0[_0xef7d('0x3a')]=_['intersection'](_0x4bead0[_0xef7d('0x3b')],_0x4bead0[_0xef7d('0x39')]);_0xb177b4[_0xef7d('0x3c')]=_[_0xef7d('0x3d')](_0x4bead0[_0xef7d('0x3b')],qs[_0xef7d('0x3e')](_0x1ab1ab[_0xef7d('0x39')]['fields']));_0xb177b4['attributes']=_0xb177b4[_0xef7d('0x3c')][_0xef7d('0x3f')]?_0xb177b4[_0xef7d('0x3c')]:_0x4bead0[_0xef7d('0x3b')];if(!_0x1ab1ab[_0xef7d('0x39')]['hasOwnProperty'](_0xef7d('0x40'))){_0xb177b4[_0xef7d('0x22')]=qs[_0xef7d('0x22')](_0x1ab1ab[_0xef7d('0x39')][_0xef7d('0x22')]);_0xb177b4['offset']=qs[_0xef7d('0x21')](_0x1ab1ab['query'][_0xef7d('0x21')]);}_0xb177b4[_0xef7d('0x41')]=qs['sort'](_0x1ab1ab[_0xef7d('0x39')][_0xef7d('0x42')]);_0xb177b4['where']=qs['filters'](_[_0xef7d('0x43')](_0x1ab1ab[_0xef7d('0x39')],_0x4bead0['filters']),_0x6b2af1);if(_0x1ab1ab[_0xef7d('0x39')][_0xef7d('0x44')]){_0xb177b4[_0xef7d('0x45')]=_[_0xef7d('0x46')](_0xb177b4['where'],{'$or':_[_0xef7d('0x32')](_0x6b2af1,function(_0x4cb3e4){if(_0x4cb3e4['type']!==_0xef7d('0x47')){var _0x1c2440={};_0x1c2440[_0x4cb3e4[_0xef7d('0x38')]]={'$like':'%'+_0x1ab1ab[_0xef7d('0x39')][_0xef7d('0x44')]+'%'};return _0x1c2440;}})});}_0xb177b4=_['merge']({},_0xb177b4,_0x1ab1ab[_0xef7d('0x48')]);var _0x1fe7ec={'where':_0xb177b4[_0xef7d('0x45')]};return db['Dashboard']['count'](_0x1fe7ec)[_0xef7d('0x2a')](function(_0x371ce6){_0x9a4773['count']=_0x371ce6;if(_0x1ab1ab[_0xef7d('0x39')][_0xef7d('0x49')]){_0xb177b4[_0xef7d('0x4a')]=[{'all':!![]}];}return db[_0xef7d('0x33')][_0xef7d('0x4b')](_0xb177b4);})[_0xef7d('0x2a')](function(_0x45a6e9){_0x9a4773['rows']=_0x45a6e9;return _0x9a4773;})[_0xef7d('0x2a')](respondWithFilteredResult(_0x52ced6,_0xb177b4))[_0xef7d('0x4c')](handleError(_0x52ced6,null));};exports['show']=function(_0x19bee6,_0x28fee){var _0x2e951b={'raw':![],'where':{'id':_0x19bee6[_0xef7d('0x4d')]['id']}},_0x301378={};_0x301378[_0xef7d('0x3b')]=_['keys'](db['Dashboard'][_0xef7d('0x34')]);_0x301378[_0xef7d('0x39')]=_['keys'](_0x19bee6[_0xef7d('0x39')]);_0x301378[_0xef7d('0x3a')]=_[_0xef7d('0x3d')](_0x301378[_0xef7d('0x3b')],_0x301378[_0xef7d('0x39')]);_0x2e951b[_0xef7d('0x3c')]=_[_0xef7d('0x3d')](_0x301378[_0xef7d('0x3b')],qs[_0xef7d('0x3e')](_0x19bee6[_0xef7d('0x39')][_0xef7d('0x3e')]));_0x2e951b[_0xef7d('0x3c')]=_0x2e951b['attributes']['length']?_0x2e951b[_0xef7d('0x3c')]:_0x301378[_0xef7d('0x3b')];if(_0x19bee6[_0xef7d('0x39')][_0xef7d('0x49')]){_0x2e951b[_0xef7d('0x4a')]=[{'all':!![]}];}_0x2e951b=_['merge']({},_0x2e951b,_0x19bee6[_0xef7d('0x48')]);return db[_0xef7d('0x33')][_0xef7d('0x4e')](_0x2e951b)['then'](handleEntityNotFound(_0x28fee,null))[_0xef7d('0x2a')](respondWithResult(_0x28fee,null))['catch'](handleError(_0x28fee,null));};exports[_0xef7d('0x4f')]=function(_0x43c84a,_0x558478){return db[_0xef7d('0x33')][_0xef7d('0x4f')](_0x43c84a[_0xef7d('0x50')],{})['then'](function(_0x4630a5){var _0x1c6e37=_0x43c84a[_0xef7d('0x51')][_0xef7d('0x2b')]({'plain':!![]});if(!_0x1c6e37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6e37[_0xef7d('0x52')]===_0xef7d('0x51')){var _0x141777=_0x4630a5['get']({'plain':!![]});var _0x29831c='CustomDashboards';return db[_0xef7d('0x53')]['find']({'where':{'name':_0x29831c,'userProfileId':_0x1c6e37[_0xef7d('0x54')]},'raw':!![]})[_0xef7d('0x2a')](function(_0x5c51af){if(_0x5c51af&&_0x5c51af[_0xef7d('0x55')]===0x0){return db['UserProfileResource'][_0xef7d('0x4f')]({'name':_0x141777['name'],'resourceId':_0x141777['id'],'type':_0x5c51af[_0xef7d('0x38')],'sectionId':_0x5c51af['id']},{})[_0xef7d('0x2a')](function(){return _0x4630a5;});}else{return _0x4630a5;}})[_0xef7d('0x4c')](function(_0x52b1f9){logger[_0xef7d('0x31')](_0xef7d('0x56'),_0x52b1f9);throw _0x52b1f9;});}return _0x4630a5;})[_0xef7d('0x2a')](respondWithResult(_0x558478,0xc9))[_0xef7d('0x4c')](handleError(_0x558478,null));};exports[_0xef7d('0x57')]=function(_0x4ef6a9,_0x7fa59b){var _0x2be915={'where':{'id':_0x4ef6a9[_0xef7d('0x4d')]['id']}},_0x2b6350={};_0x2b6350[_0xef7d('0x3b')]=_[_0xef7d('0x58')](db['Dashboard'][_0xef7d('0x34')]);_0x2be915['attributes']=_[_0xef7d('0x3d')](_0x2b6350['model'],qs[_0xef7d('0x3e')](_0x4ef6a9[_0xef7d('0x39')]['fields']));_0x2be915['attributes']=_0x2be915[_0xef7d('0x3c')][_0xef7d('0x3f')]?_0x2be915['attributes']:_0x2b6350[_0xef7d('0x3b')];if(_0x4ef6a9[_0xef7d('0x39')][_0xef7d('0x49')]){_0x2be915[_0xef7d('0x4a')]=[{'all':!![]}];}_0x2be915=_[_0xef7d('0x46')]({},_0x2be915,_0x4ef6a9['options']);return db[_0xef7d('0x33')]['find'](_0x2be915)['then'](handleEntityNotFound(_0x7fa59b,null))[_0xef7d('0x2a')](function(_0x4ccf8c){if(_0x4ccf8c){var _0x3303fb=_0x4ccf8c['get']({'plain':!![]});_0x3303fb=qs[_0xef7d('0x59')](_0x3303fb,['id','createdAt',_0xef7d('0x5a')]);_0x4ef6a9[_0xef7d('0x50')]=_[_0xef7d('0x59')](_0x4ef6a9[_0xef7d('0x50')],['id',_0xef7d('0x5b'),'updatedAt']);return db[_0xef7d('0x33')][_0xef7d('0x4f')](_['merge'](_0x3303fb,_0x4ef6a9[_0xef7d('0x50')]),{'include':_0x4ef6a9[_0xef7d('0x39')][_0xef7d('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x1dbcf0){var _0xf59c0=_0x4ef6a9['user'][_0xef7d('0x2b')]({'plain':!![]});if(!_0xf59c0)throw new Error(_0xef7d('0x5c'));if(_0xf59c0[_0xef7d('0x52')]==='user'){var _0x328ce7=_0x1dbcf0['get']({'plain':!![]});var _0xa20481=_0xef7d('0x2c');return db[_0xef7d('0x53')][_0xef7d('0x4e')]({'where':{'name':_0xa20481,'userProfileId':_0xf59c0[_0xef7d('0x54')]},'raw':!![]})[_0xef7d('0x2a')](function(_0x4d4c5b){if(_0x4d4c5b&&_0x4d4c5b['autoAssociation']===0x0){return db[_0xef7d('0x2d')][_0xef7d('0x4f')]({'name':_0x328ce7[_0xef7d('0x38')],'resourceId':_0x328ce7['id'],'type':_0x4d4c5b[_0xef7d('0x38')],'sectionId':_0x4d4c5b['id']},{})['then'](function(){return _0x1dbcf0;});}else{return _0x1dbcf0;}})['catch'](function(_0x55e584){logger[_0xef7d('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55e584);throw _0x55e584;});}return _0x1dbcf0;});}})[_0xef7d('0x2a')](respondWithResult(_0x7fa59b,0xc9))[_0xef7d('0x4c')](handleError(_0x7fa59b,null));};exports[_0xef7d('0x29')]=function(_0x238b00,_0xdf5566){if(_0x238b00[_0xef7d('0x50')]['id']){delete _0x238b00[_0xef7d('0x50')]['id'];}return db[_0xef7d('0x33')][_0xef7d('0x4e')]({'where':{'id':_0x238b00['params']['id']}})[_0xef7d('0x2a')](handleEntityNotFound(_0xdf5566,null))[_0xef7d('0x2a')](saveUpdates(_0x238b00[_0xef7d('0x50')],null))[_0xef7d('0x2a')](respondWithResult(_0xdf5566,null))[_0xef7d('0x4c')](handleError(_0xdf5566,null));};exports[_0xef7d('0x2e')]=function(_0x2ad017,_0x3e335a){return db[_0xef7d('0x33')]['find']({'where':{'id':_0x2ad017[_0xef7d('0x4d')]['id']}})[_0xef7d('0x2a')](handleEntityNotFound(_0x3e335a,null))[_0xef7d('0x2a')](removeEntity(_0x3e335a,null))[_0xef7d('0x4c')](handleError(_0x3e335a,null));};function widgetAttributes(_0x5b0d80){try{switch(_0x5b0d80[_0xef7d('0x36')]){case _0xef7d('0x5d'):return[{'name':_0xef7d('0x5e'),'value':_0x5b0d80['attrUrl']||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x0]?_0x5b0d80[_0xef7d('0x5f')][0x0][_0xef7d('0x60')]:undefined)||_0xef7d('0x61')}];case _0xef7d('0x62'):return[{'name':_0xef7d('0x63'),'value':_0x5b0d80[_0xef7d('0x63')]||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x0]?_0x5b0d80[_0xef7d('0x5f')][0x0]['value']:undefined)||''}];case _0xef7d('0x64'):return[{'name':'attrHourFormat','value':_0x5b0d80['attrHourFormat']||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x0]?_0x5b0d80[_0xef7d('0x5f')][0x0]['value']:undefined)||_0xef7d('0x65')},{'name':_0xef7d('0x66'),'value':_0x5b0d80[_0xef7d('0x66')]||(_0x5b0d80['attrs']&&_0x5b0d80[_0xef7d('0x5f')][0x1]?_0x5b0d80[_0xef7d('0x5f')][0x1][_0xef7d('0x60')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5b0d80['attrFontSize']||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x2]?_0x5b0d80[_0xef7d('0x5f')][0x2][_0xef7d('0x60')]:undefined)||0xc}];case _0xef7d('0x67'):return[{'name':'attrMetric','value':_0x5b0d80[_0xef7d('0x68')]||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80['attrs'][0x0]?_0x5b0d80['attrs'][0x0][_0xef7d('0x60')]:undefined)||_0xef7d('0x69')},{'name':'attrVoiceQueues','value':_0x5b0d80[_0xef7d('0x6a')]||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x1]?_0x5b0d80[_0xef7d('0x5f')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x5b0d80[_0xef7d('0x6b')]||(_0x5b0d80['attrs']&&_0x5b0d80[_0xef7d('0x5f')][0x2]?_0x5b0d80[_0xef7d('0x5f')][0x2]['value']:undefined)||0x14}];case _0xef7d('0x6c'):case _0xef7d('0x6d'):return[{'name':_0xef7d('0x6e'),'value':_0x5b0d80[_0xef7d('0x6e')]||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80['attrs'][0x0]?_0x5b0d80['attrs'][0x0][_0xef7d('0x60')]:undefined)||_0xef7d('0x69')},{'name':'attrSerie2','value':_0x5b0d80[_0xef7d('0x6f')]||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x1]?_0x5b0d80[_0xef7d('0x5f')][0x1][_0xef7d('0x60')]:undefined)||null},{'name':_0xef7d('0x70'),'value':_0x5b0d80['attrSerie3']||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x2]?_0x5b0d80[_0xef7d('0x5f')][0x2][_0xef7d('0x60')]:undefined)||null},{'name':_0xef7d('0x6a'),'value':_0x5b0d80[_0xef7d('0x6a')]||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x3]?_0x5b0d80['attrs'][0x3]['value']:undefined)||[]}];case _0xef7d('0x71'):return[{'name':'attrReport','type':_0x5b0d80['reportType']||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80['attrs'][0x0]?_0x5b0d80[_0xef7d('0x5f')][0x0][_0xef7d('0x36')]:undefined)||null,'value':_0x5b0d80[_0xef7d('0x72')]||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x0]?_0x5b0d80[_0xef7d('0x5f')][0x0][_0xef7d('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x5b0d80[_0xef7d('0x73')]||(_0x5b0d80[_0xef7d('0x5f')]&&_0x5b0d80[_0xef7d('0x5f')][0x1]?_0x5b0d80[_0xef7d('0x5f')][0x1][_0xef7d('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x4edfc4){logger[_0xef7d('0x31')](_0xef7d('0x74'),JSON[_0xef7d('0x75')](_0x4edfc4));return[];}}exports[_0xef7d('0x76')]=function(_0x28f92a,_0x37eeb0,_0x4ac8fe){if(_0x28f92a['body']['id']){delete _0x28f92a['body']['id'];}return db[_0xef7d('0x33')][_0xef7d('0x4e')]({'where':{'id':_0x28f92a[_0xef7d('0x4d')]['id']}})[_0xef7d('0x2a')](handleEntityNotFound(_0x37eeb0,null))[_0xef7d('0x2a')](function(_0x366f7d){if(_0x366f7d){_0x28f92a[_0xef7d('0x50')][_0xef7d('0x77')]=_0x366f7d['id'];_0x28f92a[_0xef7d('0x50')][_0xef7d('0x5f')]=widgetAttributes(_0x28f92a[_0xef7d('0x50')]);return db[_0xef7d('0x78')]['create'](_0x28f92a['body']);}})['then'](respondWithResult(_0x37eeb0,null))[_0xef7d('0x4c')](handleError(_0x37eeb0,null));};exports['getItems']=function(_0x3db14f,_0x323f14,_0x3f91e6){var _0x511280={};var _0x52c1d5={};var _0x5646d1;var _0x1e4659;return db['Dashboard']['findOne']({'where':{'id':_0x3db14f[_0xef7d('0x4d')]['id']}})[_0xef7d('0x2a')](handleEntityNotFound(_0x323f14,null))[_0xef7d('0x2a')](function(_0x561b29){if(_0x561b29){_0x5646d1=_0x561b29;_0x52c1d5[_0xef7d('0x3b')]=_['keys'](db[_0xef7d('0x78')][_0xef7d('0x34')]);_0x52c1d5['query']=_['keys'](_0x3db14f['query']);_0x52c1d5[_0xef7d('0x3a')]=_[_0xef7d('0x3d')](_0x52c1d5['model'],_0x52c1d5[_0xef7d('0x39')]);_0x511280[_0xef7d('0x3c')]=_['intersection'](_0x52c1d5[_0xef7d('0x3b')],qs[_0xef7d('0x3e')](_0x3db14f['query'][_0xef7d('0x3e')]));_0x511280[_0xef7d('0x3c')]=_0x511280['attributes'][_0xef7d('0x3f')]?_0x511280[_0xef7d('0x3c')]:_0x52c1d5[_0xef7d('0x3b')];_0x511280[_0xef7d('0x41')]=qs[_0xef7d('0x42')](_0x3db14f['query'][_0xef7d('0x42')]);_0x511280[_0xef7d('0x45')]=qs['filters'](_['pick'](_0x3db14f[_0xef7d('0x39')],_0x52c1d5[_0xef7d('0x3a')]));if(_0x3db14f[_0xef7d('0x39')][_0xef7d('0x44')]){_0x511280['where']=_['merge'](_0x511280['where'],{'$or':_[_0xef7d('0x32')](_0x511280[_0xef7d('0x3c')],function(_0x5a6ef5){var _0x278063={};_0x278063[_0x5a6ef5]={'$like':'%'+_0x3db14f[_0xef7d('0x39')][_0xef7d('0x44')]+'%'};return _0x278063;})});}_0x511280=_[_0xef7d('0x46')]({},_0x511280,_0x3db14f['options']);return _0x5646d1[_0xef7d('0x79')](_0x511280);}})[_0xef7d('0x2a')](function(_0x568cd2){if(_0x568cd2){_0x1e4659=_0x568cd2['length'];if(!_0x3db14f[_0xef7d('0x39')][_0xef7d('0x7a')](_0xef7d('0x40'))){_0x511280[_0xef7d('0x22')]=qs['limit'](_0x3db14f[_0xef7d('0x39')][_0xef7d('0x22')]);_0x511280[_0xef7d('0x21')]=qs['offset'](_0x3db14f[_0xef7d('0x39')][_0xef7d('0x21')]);}return _0x5646d1[_0xef7d('0x79')](_0x511280);}})[_0xef7d('0x2a')](function(_0x4be968){if(_0x4be968){return _0x4be968?{'count':_0x1e4659,'rows':_0x4be968}:null;}})[_0xef7d('0x2a')](respondWithResult(_0x323f14,null))[_0xef7d('0x4c')](handleError(_0x323f14,null));}; \ No newline at end of file +var _0x6a2e=['where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','type','iframe','attrUrl','attrs','value','https://','custom','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6a2e,0xb0));var _0xe6a2=function(_0x4a53dd,_0x48b733){_0x4a53dd=_0x4a53dd-0x0;var _0xa1579a=_0x6a2e[_0x4a53dd];return _0xa1579a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe6a2('0x0'));var zipdir=require(_0xe6a2('0x1'));var jsonpatch=require(_0xe6a2('0x2'));var rp=require(_0xe6a2('0x3'));var moment=require(_0xe6a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe6a2('0x5'));var util=require(_0xe6a2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe6a2('0x7'));var ejs=require(_0xe6a2('0x8'));var fs=require('fs');var _=require(_0xe6a2('0x9'));var squel=require(_0xe6a2('0xa'));var crypto=require(_0xe6a2('0xb'));var jsforce=require(_0xe6a2('0xc'));var deskjs=require(_0xe6a2('0xd'));var toCsv=require(_0xe6a2('0x7'));var querystring=require(_0xe6a2('0xe'));var Papa=require(_0xe6a2('0xf'));var Redis=require(_0xe6a2('0x10'));var authService=require(_0xe6a2('0x11'));var qs=require(_0xe6a2('0x12'));var as=require(_0xe6a2('0x13'));var hardwareService=require(_0xe6a2('0x14'));var logger=require(_0xe6a2('0x15'))(_0xe6a2('0x16'));var utils=require(_0xe6a2('0x17'));var config=require('../../config/environment');var db=require(_0xe6a2('0x18'))['db'];config['redis']=_['defaults'](config[_0xe6a2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe6a2('0x1a'))(new Redis(config['redis']));require(_0xe6a2('0x1b'))[_0xe6a2('0x1c')](socket);function respondWithStatusCode(_0x99297f,_0x34cc6b){_0x34cc6b=_0x34cc6b||0xcc;return function(_0x125aea){if(_0x125aea){return _0x99297f[_0xe6a2('0x1d')](_0x34cc6b);}return _0x99297f['status'](_0x34cc6b)[_0xe6a2('0x1e')]();};}function respondWithResult(_0x7ec2f6,_0x1993a1){_0x1993a1=_0x1993a1||0xc8;return function(_0x3a07c2){if(_0x3a07c2){return _0x7ec2f6[_0xe6a2('0x1f')](_0x1993a1)[_0xe6a2('0x20')](_0x3a07c2);}};}function respondWithFilteredResult(_0x127195,_0x3e3c3d){return function(_0x505965){if(_0x505965){var _0x54ad21=_0x505965[_0xe6a2('0x21')],_0x50afd0=_0x3e3c3d[_0xe6a2('0x22')],_0x663590=_0x3e3c3d[_0xe6a2('0x22')]+_0x3e3c3d[_0xe6a2('0x23')],_0x981ced;if(_0x663590>=_0x54ad21){_0x663590=_0x54ad21;_0x981ced=0xc8;}else{_0x981ced=0xce;}_0x127195[_0xe6a2('0x1f')](_0x981ced);return _0x127195['set'](_0xe6a2('0x24'),_0x50afd0+'-'+_0x663590+'/'+_0x54ad21)[_0xe6a2('0x20')](_0x505965);}return null;};}function patchUpdates(_0x78146e){return function(_0x17e14f){try{jsonpatch[_0xe6a2('0x25')](_0x17e14f,_0x78146e,!![]);}catch(_0x4e1bbf){return BPromise[_0xe6a2('0x26')](_0x4e1bbf);}return _0x17e14f[_0xe6a2('0x27')]();};}function saveUpdates(_0x235a26,_0x53b6b6){return function(_0x2e44d9){if(_0x2e44d9){return _0x2e44d9[_0xe6a2('0x28')](_0x235a26)[_0xe6a2('0x29')](function(_0x4d8421){return _0x4d8421;});}return null;};}function removeEntity(_0x31c982,_0x4f58d0){return function(_0x26647f){if(_0x26647f){return _0x26647f[_0xe6a2('0x2a')]()[_0xe6a2('0x29')](function(){var _0x15a201=_0x26647f[_0xe6a2('0x2b')]({'plain':!![]});var _0x15f8a5=_0xe6a2('0x2c');return db[_0xe6a2('0x2d')][_0xe6a2('0x2a')]({'where':{'type':_0x15f8a5,'resourceId':_0x15a201['id']}})['then'](function(){return _0x26647f;});})['then'](function(){_0x31c982['status'](0xcc)[_0xe6a2('0x1e')]();});}};}function handleEntityNotFound(_0x4414a8,_0xfe3166){return function(_0x3bcd11){if(!_0x3bcd11){_0x4414a8['sendStatus'](0x194);}return _0x3bcd11;};}function handleError(_0x37f7a9,_0x254693){_0x254693=_0x254693||0x1f4;return function(_0x29aed6){logger[_0xe6a2('0x2e')](_0x29aed6[_0xe6a2('0x2f')]);if(_0x29aed6[_0xe6a2('0x30')]){delete _0x29aed6[_0xe6a2('0x30')];}_0x37f7a9[_0xe6a2('0x1f')](_0x254693)['send'](_0x29aed6);};}exports[_0xe6a2('0x31')]=function(_0x561437,_0x40e3d6){var _0x564cc9={},_0x14b2f3={},_0x350567={'count':0x0,'rows':[]};var _0x1f5e6d=_[_0xe6a2('0x32')](db[_0xe6a2('0x33')]['rawAttributes'],function(_0x6ba053){return{'name':_0x6ba053['fieldName'],'type':_0x6ba053['type'][_0xe6a2('0x34')]};});_0x14b2f3[_0xe6a2('0x35')]=_[_0xe6a2('0x32')](_0x1f5e6d,_0xe6a2('0x30'));_0x14b2f3['query']=_[_0xe6a2('0x36')](_0x561437['query']);_0x14b2f3[_0xe6a2('0x37')]=_[_0xe6a2('0x38')](_0x14b2f3[_0xe6a2('0x35')],_0x14b2f3[_0xe6a2('0x39')]);_0x564cc9[_0xe6a2('0x3a')]=_[_0xe6a2('0x38')](_0x14b2f3[_0xe6a2('0x35')],qs[_0xe6a2('0x3b')](_0x561437[_0xe6a2('0x39')][_0xe6a2('0x3b')]));_0x564cc9[_0xe6a2('0x3a')]=_0x564cc9[_0xe6a2('0x3a')][_0xe6a2('0x3c')]?_0x564cc9[_0xe6a2('0x3a')]:_0x14b2f3['model'];if(!_0x561437[_0xe6a2('0x39')][_0xe6a2('0x3d')](_0xe6a2('0x3e'))){_0x564cc9['limit']=qs['limit'](_0x561437[_0xe6a2('0x39')][_0xe6a2('0x23')]);_0x564cc9[_0xe6a2('0x22')]=qs['offset'](_0x561437[_0xe6a2('0x39')]['offset']);}_0x564cc9['order']=qs[_0xe6a2('0x3f')](_0x561437[_0xe6a2('0x39')][_0xe6a2('0x3f')]);_0x564cc9[_0xe6a2('0x40')]=qs[_0xe6a2('0x37')](_[_0xe6a2('0x41')](_0x561437['query'],_0x14b2f3[_0xe6a2('0x37')]),_0x1f5e6d);if(_0x561437[_0xe6a2('0x39')][_0xe6a2('0x42')]){_0x564cc9[_0xe6a2('0x40')]=_['merge'](_0x564cc9[_0xe6a2('0x40')],{'$or':_[_0xe6a2('0x32')](_0x1f5e6d,function(_0xaf91fb){if(_0xaf91fb['type']!==_0xe6a2('0x43')){var _0x41cd81={};_0x41cd81[_0xaf91fb[_0xe6a2('0x30')]]={'$like':'%'+_0x561437[_0xe6a2('0x39')][_0xe6a2('0x42')]+'%'};return _0x41cd81;}})});}_0x564cc9=_[_0xe6a2('0x44')]({},_0x564cc9,_0x561437[_0xe6a2('0x45')]);var _0xf22244={'where':_0x564cc9[_0xe6a2('0x40')]};return db[_0xe6a2('0x33')][_0xe6a2('0x21')](_0xf22244)['then'](function(_0x4c3f0a){_0x350567[_0xe6a2('0x21')]=_0x4c3f0a;if(_0x561437['query'][_0xe6a2('0x46')]){_0x564cc9['include']=[{'all':!![]}];}return db['Dashboard'][_0xe6a2('0x47')](_0x564cc9);})['then'](function(_0x3c4349){_0x350567[_0xe6a2('0x48')]=_0x3c4349;return _0x350567;})['then'](respondWithFilteredResult(_0x40e3d6,_0x564cc9))[_0xe6a2('0x49')](handleError(_0x40e3d6,null));};exports[_0xe6a2('0x4a')]=function(_0x184bc1,_0x250b50){var _0x224a38={'raw':![],'where':{'id':_0x184bc1['params']['id']}},_0x31dfc2={};_0x31dfc2[_0xe6a2('0x35')]=_[_0xe6a2('0x36')](db[_0xe6a2('0x33')][_0xe6a2('0x4b')]);_0x31dfc2[_0xe6a2('0x39')]=_[_0xe6a2('0x36')](_0x184bc1[_0xe6a2('0x39')]);_0x31dfc2[_0xe6a2('0x37')]=_[_0xe6a2('0x38')](_0x31dfc2['model'],_0x31dfc2[_0xe6a2('0x39')]);_0x224a38[_0xe6a2('0x3a')]=_[_0xe6a2('0x38')](_0x31dfc2[_0xe6a2('0x35')],qs[_0xe6a2('0x3b')](_0x184bc1[_0xe6a2('0x39')][_0xe6a2('0x3b')]));_0x224a38[_0xe6a2('0x3a')]=_0x224a38['attributes'][_0xe6a2('0x3c')]?_0x224a38[_0xe6a2('0x3a')]:_0x31dfc2[_0xe6a2('0x35')];if(_0x184bc1[_0xe6a2('0x39')]['includeAll']){_0x224a38['include']=[{'all':!![]}];}_0x224a38=_[_0xe6a2('0x44')]({},_0x224a38,_0x184bc1['options']);return db[_0xe6a2('0x33')][_0xe6a2('0x4c')](_0x224a38)[_0xe6a2('0x29')](handleEntityNotFound(_0x250b50,null))[_0xe6a2('0x29')](respondWithResult(_0x250b50,null))[_0xe6a2('0x49')](handleError(_0x250b50,null));};exports['create']=function(_0x70d9c3,_0x5535a7){return db[_0xe6a2('0x33')][_0xe6a2('0x4d')](_0x70d9c3[_0xe6a2('0x4e')],{})[_0xe6a2('0x29')](function(_0x993472){var _0x38f4cd=_0x70d9c3[_0xe6a2('0x4f')]['get']({'plain':!![]});if(!_0x38f4cd)throw new Error(_0xe6a2('0x50'));if(_0x38f4cd['role']==='user'){var _0x49b5c6=_0x993472['get']({'plain':!![]});var _0x4e6b44='CustomDashboards';return db[_0xe6a2('0x51')][_0xe6a2('0x4c')]({'where':{'name':_0x4e6b44,'userProfileId':_0x38f4cd[_0xe6a2('0x52')]},'raw':!![]})[_0xe6a2('0x29')](function(_0x7d5462){if(_0x7d5462&&_0x7d5462[_0xe6a2('0x53')]===0x0){return db[_0xe6a2('0x2d')][_0xe6a2('0x4d')]({'name':_0x49b5c6[_0xe6a2('0x30')],'resourceId':_0x49b5c6['id'],'type':_0x7d5462['name'],'sectionId':_0x7d5462['id']},{})['then'](function(){return _0x993472;});}else{return _0x993472;}})[_0xe6a2('0x49')](function(_0x13a3f1){logger['error'](_0xe6a2('0x54'),_0x13a3f1);throw _0x13a3f1;});}return _0x993472;})[_0xe6a2('0x29')](respondWithResult(_0x5535a7,0xc9))['catch'](handleError(_0x5535a7,null));};exports[_0xe6a2('0x55')]=function(_0x1014f2,_0x1f4416){var _0x5ed3ab={'where':{'id':_0x1014f2[_0xe6a2('0x56')]['id']}},_0x1ad591={};_0x1ad591[_0xe6a2('0x35')]=_[_0xe6a2('0x36')](db['Dashboard']['rawAttributes']);_0x5ed3ab[_0xe6a2('0x3a')]=_['intersection'](_0x1ad591[_0xe6a2('0x35')],qs[_0xe6a2('0x3b')](_0x1014f2[_0xe6a2('0x39')][_0xe6a2('0x3b')]));_0x5ed3ab[_0xe6a2('0x3a')]=_0x5ed3ab['attributes'][_0xe6a2('0x3c')]?_0x5ed3ab['attributes']:_0x1ad591[_0xe6a2('0x35')];if(_0x1014f2[_0xe6a2('0x39')][_0xe6a2('0x46')]){_0x5ed3ab['include']=[{'all':!![]}];}_0x5ed3ab=_[_0xe6a2('0x44')]({},_0x5ed3ab,_0x1014f2[_0xe6a2('0x45')]);return db['Dashboard'][_0xe6a2('0x4c')](_0x5ed3ab)[_0xe6a2('0x29')](handleEntityNotFound(_0x1f4416,null))[_0xe6a2('0x29')](function(_0x4a8b69){if(_0x4a8b69){var _0x32ae11=_0x4a8b69[_0xe6a2('0x2b')]({'plain':!![]});_0x32ae11=qs[_0xe6a2('0x57')](_0x32ae11,['id','createdAt',_0xe6a2('0x58')]);_0x1014f2[_0xe6a2('0x4e')]=_[_0xe6a2('0x57')](_0x1014f2[_0xe6a2('0x4e')],['id',_0xe6a2('0x59'),'updatedAt']);return db['Dashboard'][_0xe6a2('0x4d')](_['merge'](_0x32ae11,_0x1014f2[_0xe6a2('0x4e')]),{'include':_0x1014f2['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4651a7){var _0x2239e6=_0x1014f2['user'][_0xe6a2('0x2b')]({'plain':!![]});if(!_0x2239e6)throw new Error(_0xe6a2('0x50'));if(_0x2239e6['role']==='user'){var _0x553c60=_0x4651a7[_0xe6a2('0x2b')]({'plain':!![]});var _0x50c664=_0xe6a2('0x2c');return db[_0xe6a2('0x51')][_0xe6a2('0x4c')]({'where':{'name':_0x50c664,'userProfileId':_0x2239e6[_0xe6a2('0x52')]},'raw':!![]})[_0xe6a2('0x29')](function(_0x12fb77){if(_0x12fb77&&_0x12fb77[_0xe6a2('0x53')]===0x0){return db['UserProfileResource'][_0xe6a2('0x4d')]({'name':_0x553c60[_0xe6a2('0x30')],'resourceId':_0x553c60['id'],'type':_0x12fb77[_0xe6a2('0x30')],'sectionId':_0x12fb77['id']},{})['then'](function(){return _0x4651a7;});}else{return _0x4651a7;}})[_0xe6a2('0x49')](function(_0x4977df){logger['error'](_0xe6a2('0x54'),_0x4977df);throw _0x4977df;});}return _0x4651a7;});}})[_0xe6a2('0x29')](respondWithResult(_0x1f4416,0xc9))[_0xe6a2('0x49')](handleError(_0x1f4416,null));};exports[_0xe6a2('0x28')]=function(_0x347f1e,_0x3d15b8){if(_0x347f1e[_0xe6a2('0x4e')]['id']){delete _0x347f1e[_0xe6a2('0x4e')]['id'];}return db['Dashboard'][_0xe6a2('0x4c')]({'where':{'id':_0x347f1e[_0xe6a2('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d15b8,null))[_0xe6a2('0x29')](saveUpdates(_0x347f1e[_0xe6a2('0x4e')],null))[_0xe6a2('0x29')](respondWithResult(_0x3d15b8,null))[_0xe6a2('0x49')](handleError(_0x3d15b8,null));};exports['destroy']=function(_0x5f164c,_0x211fb2){return db[_0xe6a2('0x33')][_0xe6a2('0x4c')]({'where':{'id':_0x5f164c['params']['id']}})['then'](handleEntityNotFound(_0x211fb2,null))[_0xe6a2('0x29')](removeEntity(_0x211fb2,null))[_0xe6a2('0x49')](handleError(_0x211fb2,null));};function widgetAttributes(_0x7c5491){try{switch(_0x7c5491[_0xe6a2('0x5a')]){case _0xe6a2('0x5b'):return[{'name':'attrUrl','value':_0x7c5491[_0xe6a2('0x5c')]||(_0x7c5491['attrs']&&_0x7c5491['attrs'][0x0]?_0x7c5491[_0xe6a2('0x5d')][0x0][_0xe6a2('0x5e')]:undefined)||_0xe6a2('0x5f')}];case _0xe6a2('0x60'):return[{'name':'attrPath','value':_0x7c5491['attrPath']||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491[_0xe6a2('0x5d')][0x0]?_0x7c5491['attrs'][0x0][_0xe6a2('0x5e')]:undefined)||''}];case'clock':return[{'name':_0xe6a2('0x61'),'value':_0x7c5491['attrHourFormat']||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491[_0xe6a2('0x5d')][0x0]?_0x7c5491[_0xe6a2('0x5d')][0x0][_0xe6a2('0x5e')]:undefined)||_0xe6a2('0x62')},{'name':_0xe6a2('0x63'),'value':_0x7c5491['attrTimezone']||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491[_0xe6a2('0x5d')][0x1]?_0x7c5491[_0xe6a2('0x5d')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x7c5491[_0xe6a2('0x64')]||(_0x7c5491['attrs']&&_0x7c5491['attrs'][0x2]?_0x7c5491[_0xe6a2('0x5d')][0x2][_0xe6a2('0x5e')]:undefined)||0xc}];case _0xe6a2('0x65'):return[{'name':_0xe6a2('0x66'),'value':_0x7c5491[_0xe6a2('0x66')]||(_0x7c5491['attrs']&&_0x7c5491[_0xe6a2('0x5d')][0x0]?_0x7c5491[_0xe6a2('0x5d')][0x0][_0xe6a2('0x5e')]:undefined)||_0xe6a2('0x67')},{'name':_0xe6a2('0x68'),'value':_0x7c5491[_0xe6a2('0x68')]||(_0x7c5491['attrs']&&_0x7c5491[_0xe6a2('0x5d')][0x1]?_0x7c5491[_0xe6a2('0x5d')][0x1]['value']:undefined)||[]},{'name':_0xe6a2('0x64'),'value':_0x7c5491[_0xe6a2('0x64')]||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491['attrs'][0x2]?_0x7c5491[_0xe6a2('0x5d')][0x2][_0xe6a2('0x5e')]:undefined)||0x14}];case'multibar-chart':case _0xe6a2('0x69'):return[{'name':_0xe6a2('0x6a'),'value':_0x7c5491[_0xe6a2('0x6a')]||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491[_0xe6a2('0x5d')][0x0]?_0x7c5491[_0xe6a2('0x5d')][0x0][_0xe6a2('0x5e')]:undefined)||_0xe6a2('0x67')},{'name':_0xe6a2('0x6b'),'value':_0x7c5491[_0xe6a2('0x6b')]||(_0x7c5491['attrs']&&_0x7c5491[_0xe6a2('0x5d')][0x1]?_0x7c5491['attrs'][0x1][_0xe6a2('0x5e')]:undefined)||null},{'name':_0xe6a2('0x6c'),'value':_0x7c5491[_0xe6a2('0x6c')]||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491[_0xe6a2('0x5d')][0x2]?_0x7c5491[_0xe6a2('0x5d')][0x2][_0xe6a2('0x5e')]:undefined)||null},{'name':_0xe6a2('0x68'),'value':_0x7c5491[_0xe6a2('0x68')]||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491['attrs'][0x3]?_0x7c5491[_0xe6a2('0x5d')][0x3]['value']:undefined)||[]}];case _0xe6a2('0x6d'):return[{'name':_0xe6a2('0x6e'),'type':_0x7c5491[_0xe6a2('0x6f')]||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491['attrs'][0x0]?_0x7c5491[_0xe6a2('0x5d')][0x0][_0xe6a2('0x5a')]:undefined)||null,'value':_0x7c5491[_0xe6a2('0x6e')]||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491[_0xe6a2('0x5d')][0x0]?_0x7c5491[_0xe6a2('0x5d')][0x0][_0xe6a2('0x5e')]:undefined)||null},{'name':_0xe6a2('0x70'),'value':_0x7c5491[_0xe6a2('0x70')]||(_0x7c5491[_0xe6a2('0x5d')]&&_0x7c5491[_0xe6a2('0x5d')][0x1]?_0x7c5491['attrs'][0x1][_0xe6a2('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x3bfdd9){logger[_0xe6a2('0x2e')](_0xe6a2('0x71'),JSON[_0xe6a2('0x72')](_0x3bfdd9));return[];}}exports[_0xe6a2('0x73')]=function(_0x57aa69,_0x563099,_0x26e23c){if(_0x57aa69[_0xe6a2('0x4e')]['id']){delete _0x57aa69[_0xe6a2('0x4e')]['id'];}return db[_0xe6a2('0x33')]['find']({'where':{'id':_0x57aa69[_0xe6a2('0x56')]['id']}})[_0xe6a2('0x29')](handleEntityNotFound(_0x563099,null))[_0xe6a2('0x29')](function(_0x42836e){if(_0x42836e){_0x57aa69[_0xe6a2('0x4e')][_0xe6a2('0x74')]=_0x42836e['id'];_0x57aa69[_0xe6a2('0x4e')][_0xe6a2('0x5d')]=widgetAttributes(_0x57aa69[_0xe6a2('0x4e')]);return db[_0xe6a2('0x75')][_0xe6a2('0x4d')](_0x57aa69[_0xe6a2('0x4e')]);}})[_0xe6a2('0x29')](respondWithResult(_0x563099,null))[_0xe6a2('0x49')](handleError(_0x563099,null));};exports[_0xe6a2('0x76')]=function(_0x1189dc,_0x5911c9,_0x1300e1){var _0x52f6f5={};var _0x25b48c={};var _0x331e79;var _0x35c52b;return db[_0xe6a2('0x33')]['findOne']({'where':{'id':_0x1189dc[_0xe6a2('0x56')]['id']}})[_0xe6a2('0x29')](handleEntityNotFound(_0x5911c9,null))[_0xe6a2('0x29')](function(_0x4b9ab4){if(_0x4b9ab4){_0x331e79=_0x4b9ab4;_0x25b48c[_0xe6a2('0x35')]=_[_0xe6a2('0x36')](db['DashboardItem']['rawAttributes']);_0x25b48c[_0xe6a2('0x39')]=_[_0xe6a2('0x36')](_0x1189dc[_0xe6a2('0x39')]);_0x25b48c[_0xe6a2('0x37')]=_[_0xe6a2('0x38')](_0x25b48c[_0xe6a2('0x35')],_0x25b48c[_0xe6a2('0x39')]);_0x52f6f5[_0xe6a2('0x3a')]=_[_0xe6a2('0x38')](_0x25b48c[_0xe6a2('0x35')],qs[_0xe6a2('0x3b')](_0x1189dc['query'][_0xe6a2('0x3b')]));_0x52f6f5[_0xe6a2('0x3a')]=_0x52f6f5[_0xe6a2('0x3a')][_0xe6a2('0x3c')]?_0x52f6f5['attributes']:_0x25b48c[_0xe6a2('0x35')];_0x52f6f5[_0xe6a2('0x77')]=qs[_0xe6a2('0x3f')](_0x1189dc[_0xe6a2('0x39')][_0xe6a2('0x3f')]);_0x52f6f5[_0xe6a2('0x40')]=qs[_0xe6a2('0x37')](_[_0xe6a2('0x41')](_0x1189dc['query'],_0x25b48c['filters']));if(_0x1189dc[_0xe6a2('0x39')][_0xe6a2('0x42')]){_0x52f6f5[_0xe6a2('0x40')]=_[_0xe6a2('0x44')](_0x52f6f5['where'],{'$or':_[_0xe6a2('0x32')](_0x52f6f5['attributes'],function(_0x6c22b7){var _0x1d696a={};_0x1d696a[_0x6c22b7]={'$like':'%'+_0x1189dc[_0xe6a2('0x39')][_0xe6a2('0x42')]+'%'};return _0x1d696a;})});}_0x52f6f5=_[_0xe6a2('0x44')]({},_0x52f6f5,_0x1189dc['options']);return _0x331e79[_0xe6a2('0x76')](_0x52f6f5);}})['then'](function(_0x1b34c2){if(_0x1b34c2){_0x35c52b=_0x1b34c2['length'];if(!_0x1189dc[_0xe6a2('0x39')]['hasOwnProperty'](_0xe6a2('0x3e'))){_0x52f6f5['limit']=qs[_0xe6a2('0x23')](_0x1189dc['query']['limit']);_0x52f6f5[_0xe6a2('0x22')]=qs['offset'](_0x1189dc[_0xe6a2('0x39')]['offset']);}return _0x331e79[_0xe6a2('0x76')](_0x52f6f5);}})['then'](function(_0x138185){if(_0x138185){return _0x138185?{'count':_0x35c52b,'rows':_0x138185}:null;}})[_0xe6a2('0x29')](respondWithResult(_0x5911c9,null))['catch'](handleError(_0x5911c9,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 59e423a..a325ab3 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 _0x53b8=['remove','emit','Dashboard','setMaxListeners','save','update'];(function(_0x3fab28,_0x51063f){var _0x111b0b=function(_0x126482){while(--_0x126482){_0x3fab28['push'](_0x3fab28['shift']());}};_0x111b0b(++_0x51063f);}(_0x53b8,0x15e));var _0x853b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53b8[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x853b('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x853b('0x1')](0x0);var events={'afterCreate':_0x853b('0x2'),'afterUpdate':_0x853b('0x3'),'afterDestroy':_0x853b('0x4')};function emitEvent(_0x4c2e35){return function(_0x1dfbce,_0x2a9615,_0x4634a4){DashboardEvents[_0x853b('0x5')](_0x4c2e35+':'+_0x1dfbce['id'],_0x1dfbce);DashboardEvents[_0x853b('0x5')](_0x4c2e35,_0x1dfbce);_0x4634a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x42fc=['save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x57e80a,_0xac3f2a){var _0x181027=function(_0x27487f){while(--_0x27487f){_0x57e80a['push'](_0x57e80a['shift']());}};_0x181027(++_0xac3f2a);}(_0x42fc,0x1a7));var _0xc42f=function(_0x12bdfc,_0xf55e66){_0x12bdfc=_0x12bdfc-0x0;var _0x24f758=_0x42fc[_0x12bdfc];return _0x24f758;};'use strict';var EventEmitter=require(_0xc42f('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc42f('0x1'),'afterUpdate':_0xc42f('0x2'),'afterDestroy':_0xc42f('0x3')};function emitEvent(_0x493072){return function(_0x4304b8,_0x48916d,_0x12c95f){DashboardEvents[_0xc42f('0x4')](_0x493072+':'+_0x4304b8['id'],_0x4304b8);DashboardEvents[_0xc42f('0x4')](_0x493072,_0x4304b8);_0x12c95f(null);};}for(var e in events){if(events[_0xc42f('0x5')](e)){var event=events[e];Dashboard[_0xc42f('0x6')](e,emitEvent(event));}}module[_0xc42f('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index d28d1f9..0808050 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 _0x02a1=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x02a1,0x17b));var _0x102a=function(_0x27e59f,_0x51075c){_0x27e59f=_0x27e59f-0x0;var _0x4bbe43=_0x02a1[_0x27e59f];return _0x4bbe43;};'use strict';var _=require(_0x102a('0x0'));var util=require(_0x102a('0x1'));var logger=require(_0x102a('0x2'))(_0x102a('0x3'));var moment=require(_0x102a('0x4'));var BPromise=require(_0x102a('0x5'));var rp=require(_0x102a('0x6'));var fs=require('fs');var path=require(_0x102a('0x7'));var rimraf=require(_0x102a('0x8'));var config=require(_0x102a('0x9'));var attributes=require(_0x102a('0xa'));module['exports']=function(_0x1cb6fb,_0x50c372){return _0x1cb6fb[_0x102a('0xb')](_0x102a('0xc'),attributes,{'tableName':_0x102a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c0d=['dashboards','lodash','util','../../config/logger','api','moment','path','rimraf','./dashboard.attributes','exports','Dashboard'];(function(_0x24c5bf,_0x3bf899){var _0x3c584b=function(_0x350332){while(--_0x350332){_0x24c5bf['push'](_0x24c5bf['shift']());}};_0x3c584b(++_0x3bf899);}(_0x8c0d,0x177));var _0xd8c0=function(_0x32abc3,_0x58db21){_0x32abc3=_0x32abc3-0x0;var _0xe05314=_0x8c0d[_0x32abc3];return _0xe05314;};'use strict';var _=require(_0xd8c0('0x0'));var util=require(_0xd8c0('0x1'));var logger=require(_0xd8c0('0x2'))(_0xd8c0('0x3'));var moment=require(_0xd8c0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8c0('0x5'));var rimraf=require(_0xd8c0('0x6'));var config=require('../../config/environment');var attributes=require(_0xd8c0('0x7'));module[_0xd8c0('0x8')]=function(_0x229cb9,_0x4f4b26){return _0x229cb9['define'](_0xd8c0('0x9'),attributes,{'tableName':_0xd8c0('0xa'),'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 6289741..20c5377 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 _0xe279=['redis','defaults','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xb7584,_0x13d4f2){var _0x3c3cc1=function(_0x17f26a){while(--_0x17f26a){_0xb7584['push'](_0xb7584['shift']());}};_0x3c3cc1(++_0x13d4f2);}(_0xe279,0xa5));var _0x9e27=function(_0x35b4c6,_0x5e57a2){_0x35b4c6=_0x35b4c6-0x0;var _0xa45f4c=_0xe279[_0x35b4c6];return _0xa45f4c;};'use strict';var _=require(_0x9e27('0x0'));var util=require(_0x9e27('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9e27('0x2'));var fs=require('fs');var Redis=require(_0x9e27('0x3'));var db=require(_0x9e27('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e27('0x5'))(_0x9e27('0x6'));var config=require('../../config/environment');var jayson=require(_0x9e27('0x7'));var client=jayson[_0x9e27('0x8')][_0x9e27('0x9')]({'port':0x232a});config[_0x9e27('0xa')]=_[_0x9e27('0xb')](config[_0x9e27('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e27('0xc'))[_0x9e27('0xd')](socket);function respondWithRpcPromise(_0x536a0b,_0x4e1696,_0x18bbbe){return new BPromise(function(_0x2e39a5,_0x44103b){return client[_0x9e27('0xe')](_0x536a0b,_0x18bbbe)[_0x9e27('0xf')](function(_0x18ad12){logger['info'](_0x9e27('0x10'),_0x4e1696,_0x9e27('0x11'));logger['debug'](_0x9e27('0x12'),_0x4e1696,'request\x20sent',JSON['stringify'](_0x18ad12));if(_0x18ad12[_0x9e27('0x13')]){if(_0x18ad12['error'][_0x9e27('0x14')]===0x1f4){logger[_0x9e27('0x13')](_0x9e27('0x10'),_0x4e1696,_0x18ad12[_0x9e27('0x13')][_0x9e27('0x15')]);return _0x44103b(_0x18ad12[_0x9e27('0x13')][_0x9e27('0x15')]);}logger[_0x9e27('0x13')](_0x9e27('0x10'),_0x4e1696,_0x18ad12[_0x9e27('0x13')]['message']);return _0x2e39a5(_0x18ad12['error'][_0x9e27('0x15')]);}else{logger[_0x9e27('0x16')](_0x9e27('0x10'),_0x4e1696,_0x9e27('0x11'));_0x2e39a5(_0x18ad12[_0x9e27('0x17')][_0x9e27('0x15')]);}})[_0x9e27('0x18')](function(_0x473087){logger[_0x9e27('0x13')](_0x9e27('0x10'),_0x4e1696,_0x473087);_0x44103b(_0x473087);});});} \ No newline at end of file +var _0x70ae=['socket.io-emitter','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x1ffde6,_0xe3b27a){var _0x47954d=function(_0x3c0d23){while(--_0x3c0d23){_0x1ffde6['push'](_0x1ffde6['shift']());}};_0x47954d(++_0xe3b27a);}(_0x70ae,0x153));var _0xe70a=function(_0x2b4629,_0x2cfe26){_0x2b4629=_0x2b4629-0x0;var _0x1d8fa9=_0x70ae[_0x2b4629];return _0x1d8fa9;};'use strict';var _=require('lodash');var util=require(_0xe70a('0x0'));var moment=require(_0xe70a('0x1'));var BPromise=require(_0xe70a('0x2'));var rs=require(_0xe70a('0x3'));var fs=require('fs');var Redis=require(_0xe70a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe70a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe70a('0x6'));var jayson=require(_0xe70a('0x7'));var client=jayson['client'][_0xe70a('0x8')]({'port':0x232a});config[_0xe70a('0x9')]=_['defaults'](config[_0xe70a('0x9')],{'host':_0xe70a('0xa'),'port':0x18eb});var socket=require(_0xe70a('0xb'))(new Redis(config[_0xe70a('0x9')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x512fc1,_0x46fb5b,_0xb5fe63){return new BPromise(function(_0x15300a,_0x5d8a66){return client[_0xe70a('0xc')](_0x512fc1,_0xb5fe63)[_0xe70a('0xd')](function(_0x5db24c){logger['info'](_0xe70a('0xe'),_0x46fb5b,_0xe70a('0xf'));logger[_0xe70a('0x10')](_0xe70a('0x11'),_0x46fb5b,'request\x20sent',JSON[_0xe70a('0x12')](_0x5db24c));if(_0x5db24c['error']){if(_0x5db24c[_0xe70a('0x13')][_0xe70a('0x14')]===0x1f4){logger[_0xe70a('0x13')]('Dashboard,\x20%s,\x20%s',_0x46fb5b,_0x5db24c[_0xe70a('0x13')][_0xe70a('0x15')]);return _0x5d8a66(_0x5db24c[_0xe70a('0x13')]['message']);}logger['error'](_0xe70a('0xe'),_0x46fb5b,_0x5db24c[_0xe70a('0x13')][_0xe70a('0x15')]);return _0x15300a(_0x5db24c['error'][_0xe70a('0x15')]);}else{logger[_0xe70a('0x16')](_0xe70a('0xe'),_0x46fb5b,_0xe70a('0xf'));_0x15300a(_0x5db24c[_0xe70a('0x17')][_0xe70a('0x15')]);}})[_0xe70a('0x18')](function(_0x37fbe5){logger[_0xe70a('0x13')]('Dashboard,\x20%s,\x20%s',_0x46fb5b,_0x37fbe5);_0x5d8a66(_0x37fbe5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6b937f1..067fd95 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 _0xa1f7=['save','emit','register','length','dashboard:','./dashboard.events'];(function(_0x170682,_0x1fe7b7){var _0x2d9f0e=function(_0x1912d7){while(--_0x1912d7){_0x170682['push'](_0x170682['shift']());}};_0x2d9f0e(++_0x1fe7b7);}(_0xa1f7,0x167));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0x7a1f('0x0'));var events=[_0x7a1f('0x1'),'remove','update'];function createListener(_0x5c0d4,_0x5eadb0){return function(_0x55f90f){_0x5eadb0[_0x7a1f('0x2')](_0x5c0d4,_0x55f90f);};}function removeListener(_0xcc9ef1,_0x12bd31){return function(){DashboardEvents['removeListener'](_0xcc9ef1,_0x12bd31);};}exports[_0x7a1f('0x3')]=function(_0x45f2c7){for(var _0xba4f2a=0x0,_0x336a55=events[_0x7a1f('0x4')];_0xba4f2a<_0x336a55;_0xba4f2a++){var _0x1ea37f=events[_0xba4f2a];var _0x339b78=createListener(_0x7a1f('0x5')+_0x1ea37f,_0x45f2c7);DashboardEvents['on'](_0x1ea37f,_0x339b78);}}; \ No newline at end of file +var _0x86e5=['remove','update','emit','register','length','dashboard:','./dashboard.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x86e5,0x110));var _0x586e=function(_0x5dbbc2,_0x1eb331){_0x5dbbc2=_0x5dbbc2-0x0;var _0x347c95=_0x86e5[_0x5dbbc2];return _0x347c95;};'use strict';var DashboardEvents=require(_0x586e('0x0'));var events=['save',_0x586e('0x1'),_0x586e('0x2')];function createListener(_0x1c49bd,_0x3bbe23){return function(_0x43a2fb){_0x3bbe23[_0x586e('0x3')](_0x1c49bd,_0x43a2fb);};}function removeListener(_0x3778a3,_0x296b57){return function(){DashboardEvents['removeListener'](_0x3778a3,_0x296b57);};}exports[_0x586e('0x4')]=function(_0x5979e1){for(var _0xbd4749=0x0,_0x222ed9=events[_0x586e('0x5')];_0xbd4749<_0x222ed9;_0xbd4749++){var _0x3d99ac=events[_0xbd4749];var _0x559d68=createListener(_0x586e('0x6')+_0x3d99ac,_0x5979e1);DashboardEvents['on'](_0x3d99ac,_0x559d68);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 9d786ad..6e8e975 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0xe706,0xa3));var _0x6e70=function(_0x32ca7a,_0x4a069d){_0x32ca7a=_0x32ca7a-0x0;var _0xab41b9=_0xe706[_0x32ca7a];return _0xab41b9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x4b49c9,_0x290d55){var _0xab2d67=function(_0x3a8e9c){while(--_0x3a8e9c){_0x4b49c9['push'](_0x4b49c9['shift']());}};_0xab2d67(++_0x290d55);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6daf22f..a75710f 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 _0x951e=['attrs','stringify','setDataValue','INTEGER','STRING','#ffffff','sequelize','squel','lodash','exports','TEXT','parse','getDataValue'];(function(_0x3592cb,_0xdd7720){var _0x43091a=function(_0x24a8f5){while(--_0x24a8f5){_0x3592cb['push'](_0x3592cb['shift']());}};_0x43091a(++_0xdd7720);}(_0x951e,0x1da));var _0xe951=function(_0x10b117,_0x3d95c6){_0x10b117=_0x10b117-0x0;var _0x518d39=_0x951e[_0x10b117];return _0x518d39;};'use strict';var Sequelize=require(_0xe951('0x0'));var squel=require(_0xe951('0x1'));var _=require(_0xe951('0x2'));module[_0xe951('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe951('0x4')]('long'),'get':function(){try{return JSON[_0xe951('0x5')](this[_0xe951('0x6')](_0xe951('0x7')));}catch(_0x580974){return[];}},'set':function(_0x11b9ae){try{this['setDataValue'](_0xe951('0x7'),JSON[_0xe951('0x8')](_0x11b9ae));}catch(_0xf935a9){this[_0xe951('0x9')](_0xe951('0x7'),JSON[_0xe951('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xe951('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe951('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe951('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xe951('0xb')],'allowNull':![],'defaultValue':_0xe951('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe951('0xb')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc012=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','STRING','TEXT','long'];(function(_0x59da69,_0x4b0c79){var _0x55c515=function(_0x47d83a){while(--_0x47d83a){_0x59da69['push'](_0x59da69['shift']());}};_0x55c515(++_0x4b0c79);}(_0xc012,0x1e7));var _0x2c01=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xc012[_0x269ee8];return _0x4d98bd;};'use strict';var Sequelize=require(_0x2c01('0x0'));var squel=require(_0x2c01('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x2c01('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x2c01('0x3')](_0x2c01('0x4')),'get':function(){try{return JSON[_0x2c01('0x5')](this[_0x2c01('0x6')](_0x2c01('0x7')));}catch(_0x425f18){return[];}},'set':function(_0x172aea){try{this[_0x2c01('0x8')]('attrs',JSON[_0x2c01('0x9')](_0x172aea));}catch(_0x38fcf1){this[_0x2c01('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2c01('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2c01('0xa')]},'col':{'type':Sequelize[_0x2c01('0xa')]},'background':{'type':Sequelize[_0x2c01('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2c01('0x2')],'allowNull':![],'defaultValue':_0x2c01('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2c01('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 95a6b83..a71ac59 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 _0x86c6=['counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','catch','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','localhost','redis','./dashboardItem.socket','register','end','status','json','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','type','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize'];(function(_0x20ccbe,_0x13d4ed){var _0xcdebb8=function(_0x350220){while(--_0x350220){_0x20ccbe['push'](_0x20ccbe['shift']());}};_0xcdebb8(++_0x13d4ed);}(_0x86c6,0xc0));var _0x686c=function(_0x559bdc,_0x15b780){_0x559bdc=_0x559bdc-0x0;var _0x26325e=_0x86c6[_0x559bdc];return _0x26325e;};'use strict';var pdf=require(_0x686c('0x0'));var emlformat=require(_0x686c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x686c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x686c('0x3'));var moment=require(_0x686c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x686c('0x5'));var util=require(_0x686c('0x6'));var path=require(_0x686c('0x7'));var sox=require('sox');var csv=require(_0x686c('0x8'));var ejs=require(_0x686c('0x9'));var fs=require('fs');var _=require(_0x686c('0xa'));var squel=require(_0x686c('0xb'));var crypto=require(_0x686c('0xc'));var jsforce=require(_0x686c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x686c('0x8'));var querystring=require(_0x686c('0xe'));var Papa=require('papaparse');var Redis=require(_0x686c('0xf'));var authService=require(_0x686c('0x10'));var qs=require(_0x686c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x686c('0x12'));var logger=require('../../config/logger')(_0x686c('0x13'));var utils=require(_0x686c('0x14'));var config=require(_0x686c('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x686c('0x16')](config['redis'],{'host':_0x686c('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x686c('0x18')]));require(_0x686c('0x19'))[_0x686c('0x1a')](socket);function respondWithStatusCode(_0x5174c3,_0x17ccb6){_0x17ccb6=_0x17ccb6||0xcc;return function(_0x34e144){if(_0x34e144){return _0x5174c3['sendStatus'](_0x17ccb6);}return _0x5174c3['status'](_0x17ccb6)[_0x686c('0x1b')]();};}function respondWithResult(_0x3ac426,_0x219128){_0x219128=_0x219128||0xc8;return function(_0x4a6556){if(_0x4a6556){return _0x3ac426[_0x686c('0x1c')](_0x219128)[_0x686c('0x1d')](_0x4a6556);}};}function respondWithFilteredResult(_0x2b1507,_0x4f9be0){return function(_0x9da33d){if(_0x9da33d){var _0x518c9f=_0x9da33d['count'],_0x11dbc7=_0x4f9be0[_0x686c('0x1e')],_0x27c3b9=_0x4f9be0[_0x686c('0x1e')]+_0x4f9be0[_0x686c('0x1f')],_0x48ce2e;if(_0x27c3b9>=_0x518c9f){_0x27c3b9=_0x518c9f;_0x48ce2e=0xc8;}else{_0x48ce2e=0xce;}_0x2b1507[_0x686c('0x1c')](_0x48ce2e);return _0x2b1507[_0x686c('0x20')]('Content-Range',_0x11dbc7+'-'+_0x27c3b9+'/'+_0x518c9f)['json'](_0x9da33d);}return null;};}function patchUpdates(_0x297925){return function(_0x281416){try{jsonpatch[_0x686c('0x21')](_0x281416,_0x297925,!![]);}catch(_0x1f0f7f){return BPromise[_0x686c('0x22')](_0x1f0f7f);}return _0x281416[_0x686c('0x23')]();};}function saveUpdates(_0x44236f,_0x1225c8){return function(_0x3b90da){if(_0x3b90da){return _0x3b90da['update'](_0x44236f)[_0x686c('0x24')](function(_0x52efa4){return _0x52efa4;});}return null;};}function removeEntity(_0x87f676,_0x61bfcb){return function(_0xf9f394){if(_0xf9f394){return _0xf9f394[_0x686c('0x25')]()['then'](function(){_0x87f676[_0x686c('0x1c')](0xcc)[_0x686c('0x1b')]();});}};}function handleEntityNotFound(_0x5a96f1,_0x393ee2){return function(_0x7b7f13){if(!_0x7b7f13){_0x5a96f1[_0x686c('0x26')](0x194);}return _0x7b7f13;};}function handleError(_0x5e5578,_0x1ecc85){_0x1ecc85=_0x1ecc85||0x1f4;return function(_0x2ee787){logger[_0x686c('0x27')](_0x2ee787[_0x686c('0x28')]);if(_0x2ee787[_0x686c('0x29')]){delete _0x2ee787[_0x686c('0x29')];}_0x5e5578['status'](_0x1ecc85)[_0x686c('0x2a')](_0x2ee787);};}exports[_0x686c('0x2b')]=function(_0xe8cd4f,_0x3c4b1b){var _0x500e2d={'raw':![],'where':{'id':_0xe8cd4f[_0x686c('0x2c')]['id']}},_0x3d5e9a={};_0x3d5e9a[_0x686c('0x2d')]=_[_0x686c('0x2e')](db[_0x686c('0x2f')][_0x686c('0x30')]);_0x3d5e9a[_0x686c('0x31')]=_['keys'](_0xe8cd4f[_0x686c('0x31')]);_0x3d5e9a[_0x686c('0x32')]=_[_0x686c('0x33')](_0x3d5e9a[_0x686c('0x2d')],_0x3d5e9a['query']);_0x500e2d[_0x686c('0x34')]=_[_0x686c('0x33')](_0x3d5e9a['model'],qs[_0x686c('0x35')](_0xe8cd4f[_0x686c('0x31')][_0x686c('0x35')]));_0x500e2d['attributes']=_0x500e2d[_0x686c('0x34')][_0x686c('0x36')]?_0x500e2d[_0x686c('0x34')]:_0x3d5e9a['model'];if(_0xe8cd4f['query'][_0x686c('0x37')]){_0x500e2d[_0x686c('0x38')]=[{'all':!![]}];}_0x500e2d=_[_0x686c('0x39')]({},_0x500e2d,_0xe8cd4f[_0x686c('0x3a')]);return db[_0x686c('0x2f')]['find'](_0x500e2d)[_0x686c('0x24')](handleEntityNotFound(_0x3c4b1b,null))['then'](respondWithResult(_0x3c4b1b,null))['catch'](handleError(_0x3c4b1b,null));};exports[_0x686c('0x25')]=function(_0x5b6440,_0x4d9c6e){return db[_0x686c('0x2f')][_0x686c('0x3b')]({'where':{'id':_0x5b6440[_0x686c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4d9c6e,null))['then'](removeEntity(_0x4d9c6e,null))['catch'](handleError(_0x4d9c6e,null));};function widgetAttributes(_0xf0b7b2){try{switch(_0xf0b7b2[_0x686c('0x3c')]){case'iframe':return[{'name':_0x686c('0x3d'),'value':_0xf0b7b2[_0x686c('0x3d')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2[_0x686c('0x3e')][0x0]?_0xf0b7b2[_0x686c('0x3e')][0x0][_0x686c('0x3f')]:undefined)||_0x686c('0x40')}];case'custom':return[{'name':'attrPath','value':_0xf0b7b2[_0x686c('0x41')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2['attrs'][0x0]?_0xf0b7b2[_0x686c('0x3e')][0x0][_0x686c('0x3f')]:undefined)||''}];case _0x686c('0x42'):return[{'name':_0x686c('0x43'),'value':_0xf0b7b2[_0x686c('0x43')]||(_0xf0b7b2['attrs']&&_0xf0b7b2['attrs'][0x0]?_0xf0b7b2[_0x686c('0x3e')][0x0][_0x686c('0x3f')]:undefined)||_0x686c('0x44')},{'name':_0x686c('0x45'),'value':_0xf0b7b2[_0x686c('0x45')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2['attrs'][0x1]?_0xf0b7b2[_0x686c('0x3e')][0x1][_0x686c('0x3f')]:undefined)||_0x686c('0x46')},{'name':_0x686c('0x47'),'value':_0xf0b7b2[_0x686c('0x47')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2[_0x686c('0x3e')][0x2]?_0xf0b7b2[_0x686c('0x3e')][0x2]['value']:undefined)||0xc}];case _0x686c('0x48'):return[{'name':_0x686c('0x49'),'value':_0xf0b7b2[_0x686c('0x49')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2[_0x686c('0x3e')][0x0]?_0xf0b7b2['attrs'][0x0][_0x686c('0x3f')]:undefined)||_0x686c('0x4a')},{'name':_0x686c('0x4b'),'value':_0xf0b7b2[_0x686c('0x4b')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2['attrs'][0x1]?_0xf0b7b2['attrs'][0x1][_0x686c('0x3f')]:undefined)||[]},{'name':_0x686c('0x47'),'value':_0xf0b7b2[_0x686c('0x47')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2[_0x686c('0x3e')][0x2]?_0xf0b7b2[_0x686c('0x3e')][0x2][_0x686c('0x3f')]:undefined)||0x14}];case _0x686c('0x4c'):case'pie-chart':return[{'name':'attrSerie1','value':_0xf0b7b2[_0x686c('0x4d')]||(_0xf0b7b2['attrs']&&_0xf0b7b2[_0x686c('0x3e')][0x0]?_0xf0b7b2[_0x686c('0x3e')][0x0][_0x686c('0x3f')]:undefined)||_0x686c('0x4a')},{'name':_0x686c('0x4e'),'value':_0xf0b7b2['attrSerie2']||(_0xf0b7b2['attrs']&&_0xf0b7b2[_0x686c('0x3e')][0x1]?_0xf0b7b2[_0x686c('0x3e')][0x1][_0x686c('0x3f')]:undefined)||null},{'name':_0x686c('0x4f'),'value':_0xf0b7b2[_0x686c('0x4f')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2['attrs'][0x2]?_0xf0b7b2[_0x686c('0x3e')][0x2][_0x686c('0x3f')]:undefined)||null},{'name':_0x686c('0x4b'),'value':_0xf0b7b2[_0x686c('0x4b')]||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2[_0x686c('0x3e')][0x3]?_0xf0b7b2[_0x686c('0x3e')][0x3][_0x686c('0x3f')]:undefined)||[]}];case _0x686c('0x50'):return[{'name':'attrReport','type':_0xf0b7b2['reportType']||(_0xf0b7b2['attrs']&&_0xf0b7b2[_0x686c('0x3e')][0x0]?_0xf0b7b2[_0x686c('0x3e')][0x0]['type']:undefined)||null,'value':_0xf0b7b2[_0x686c('0x51')]||(_0xf0b7b2['attrs']&&_0xf0b7b2[_0x686c('0x3e')][0x0]?_0xf0b7b2[_0x686c('0x3e')][0x0]['value']:undefined)||null},{'name':_0x686c('0x52'),'value':_0xf0b7b2['attrRefresh']||(_0xf0b7b2[_0x686c('0x3e')]&&_0xf0b7b2[_0x686c('0x3e')][0x1]?_0xf0b7b2[_0x686c('0x3e')][0x1][_0x686c('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x3f6d24){logger[_0x686c('0x27')](_0x686c('0x53'),JSON['stringify'](_0x3f6d24));return[];}}exports[_0x686c('0x54')]=function(_0x56db5c,_0x5e938f){if(_0x56db5c[_0x686c('0x55')]){_0x56db5c[_0x686c('0x55')][_0x686c('0x3e')]=widgetAttributes(_0x56db5c['body']);}return db['DashboardItem'][_0x686c('0x54')](_0x56db5c['body'],{})['then'](respondWithResult(_0x5e938f,0xc9))['catch'](handleError(_0x5e938f,null));};exports[_0x686c('0x56')]=function(_0x2e384e,_0xd1fc82){if(_0x2e384e[_0x686c('0x55')]['id']){delete _0x2e384e[_0x686c('0x55')]['id'];}_0x2e384e[_0x686c('0x55')][_0x686c('0x3e')]=widgetAttributes(_0x2e384e[_0x686c('0x55')]);return db[_0x686c('0x2f')][_0x686c('0x3b')]({'where':{'id':_0x2e384e[_0x686c('0x2c')]['id']}})[_0x686c('0x24')](handleEntityNotFound(_0xd1fc82,null))[_0x686c('0x24')](saveUpdates(_0x2e384e[_0x686c('0x55')],null))[_0x686c('0x24')](respondWithResult(_0xd1fc82,null))[_0x686c('0x57')](handleError(_0xd1fc82,null));}; \ No newline at end of file +var _0x85f5=['register','sendStatus','json','limit','status','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','includeAll','include','merge','options','catch','find','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','error','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x136e17,_0x4cc300){var _0x5099c9=function(_0xbbbb80){while(--_0xbbbb80){_0x136e17['push'](_0x136e17['shift']());}};_0x5099c9(++_0x4cc300);}(_0x85f5,0x1d8));var _0x585f=function(_0x1ee358,_0x42fdfb){_0x1ee358=_0x1ee358-0x0;var _0x4d01b9=_0x85f5[_0x1ee358];return _0x4d01b9;};'use strict';var pdf=require(_0x585f('0x0'));var emlformat=require(_0x585f('0x1'));var rimraf=require(_0x585f('0x2'));var zipdir=require(_0x585f('0x3'));var jsonpatch=require(_0x585f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x585f('0x5'));var Mustache=require(_0x585f('0x6'));var util=require(_0x585f('0x7'));var path=require(_0x585f('0x8'));var sox=require(_0x585f('0x9'));var csv=require(_0x585f('0xa'));var ejs=require(_0x585f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x585f('0xc'));var jsforce=require(_0x585f('0xd'));var deskjs=require(_0x585f('0xe'));var toCsv=require(_0x585f('0xa'));var querystring=require(_0x585f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x585f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x585f('0x11'));var logger=require(_0x585f('0x12'))('api');var utils=require(_0x585f('0x13'));var config=require('../../config/environment');var db=require(_0x585f('0x14'))['db'];config[_0x585f('0x15')]=_[_0x585f('0x16')](config['redis'],{'host':_0x585f('0x17'),'port':0x18eb});var socket=require(_0x585f('0x18'))(new Redis(config['redis']));require(_0x585f('0x19'))[_0x585f('0x1a')](socket);function respondWithStatusCode(_0x2a616f,_0x1a17be){_0x1a17be=_0x1a17be||0xcc;return function(_0x2ae8df){if(_0x2ae8df){return _0x2a616f[_0x585f('0x1b')](_0x1a17be);}return _0x2a616f['status'](_0x1a17be)['end']();};}function respondWithResult(_0x51f78e,_0x1c045c){_0x1c045c=_0x1c045c||0xc8;return function(_0x4d0e43){if(_0x4d0e43){return _0x51f78e['status'](_0x1c045c)[_0x585f('0x1c')](_0x4d0e43);}};}function respondWithFilteredResult(_0x541dd2,_0x100db3){return function(_0x4a7414){if(_0x4a7414){var _0x816df4=_0x4a7414['count'],_0x4106ad=_0x100db3['offset'],_0x4680d3=_0x100db3['offset']+_0x100db3[_0x585f('0x1d')],_0x2935c3;if(_0x4680d3>=_0x816df4){_0x4680d3=_0x816df4;_0x2935c3=0xc8;}else{_0x2935c3=0xce;}_0x541dd2[_0x585f('0x1e')](_0x2935c3);return _0x541dd2[_0x585f('0x1f')](_0x585f('0x20'),_0x4106ad+'-'+_0x4680d3+'/'+_0x816df4)[_0x585f('0x1c')](_0x4a7414);}return null;};}function patchUpdates(_0x5108cc){return function(_0x52243b){try{jsonpatch[_0x585f('0x21')](_0x52243b,_0x5108cc,!![]);}catch(_0x21337e){return BPromise[_0x585f('0x22')](_0x21337e);}return _0x52243b[_0x585f('0x23')]();};}function saveUpdates(_0x5d25b2,_0x2c6fd4){return function(_0x4ad0e3){if(_0x4ad0e3){return _0x4ad0e3['update'](_0x5d25b2)[_0x585f('0x24')](function(_0x3a09c7){return _0x3a09c7;});}return null;};}function removeEntity(_0xec5603,_0x358e20){return function(_0x1b9214){if(_0x1b9214){return _0x1b9214[_0x585f('0x25')]()[_0x585f('0x24')](function(){_0xec5603[_0x585f('0x1e')](0xcc)[_0x585f('0x26')]();});}};}function handleEntityNotFound(_0x52fa3c,_0x55f140){return function(_0x1f3005){if(!_0x1f3005){_0x52fa3c[_0x585f('0x1b')](0x194);}return _0x1f3005;};}function handleError(_0x55ef8b,_0x4b0405){_0x4b0405=_0x4b0405||0x1f4;return function(_0xf7c2be){logger['error'](_0xf7c2be[_0x585f('0x27')]);if(_0xf7c2be['name']){delete _0xf7c2be[_0x585f('0x28')];}_0x55ef8b['status'](_0x4b0405)['send'](_0xf7c2be);};}exports['show']=function(_0x2e32b2,_0x160302){var _0x23e629={'raw':![],'where':{'id':_0x2e32b2[_0x585f('0x29')]['id']}},_0x5f1427={};_0x5f1427[_0x585f('0x2a')]=_[_0x585f('0x2b')](db[_0x585f('0x2c')][_0x585f('0x2d')]);_0x5f1427['query']=_[_0x585f('0x2b')](_0x2e32b2[_0x585f('0x2e')]);_0x5f1427['filters']=_[_0x585f('0x2f')](_0x5f1427[_0x585f('0x2a')],_0x5f1427[_0x585f('0x2e')]);_0x23e629[_0x585f('0x30')]=_[_0x585f('0x2f')](_0x5f1427[_0x585f('0x2a')],qs[_0x585f('0x31')](_0x2e32b2[_0x585f('0x2e')]['fields']));_0x23e629[_0x585f('0x30')]=_0x23e629[_0x585f('0x30')]['length']?_0x23e629[_0x585f('0x30')]:_0x5f1427['model'];if(_0x2e32b2['query'][_0x585f('0x32')]){_0x23e629[_0x585f('0x33')]=[{'all':!![]}];}_0x23e629=_[_0x585f('0x34')]({},_0x23e629,_0x2e32b2[_0x585f('0x35')]);return db[_0x585f('0x2c')]['find'](_0x23e629)['then'](handleEntityNotFound(_0x160302,null))[_0x585f('0x24')](respondWithResult(_0x160302,null))[_0x585f('0x36')](handleError(_0x160302,null));};exports[_0x585f('0x25')]=function(_0x1324b6,_0x1da81f){return db[_0x585f('0x2c')][_0x585f('0x37')]({'where':{'id':_0x1324b6[_0x585f('0x29')]['id']}})[_0x585f('0x24')](handleEntityNotFound(_0x1da81f,null))[_0x585f('0x24')](removeEntity(_0x1da81f,null))['catch'](handleError(_0x1da81f,null));};function widgetAttributes(_0x3331c9){try{switch(_0x3331c9[_0x585f('0x38')]){case'iframe':return[{'name':_0x585f('0x39'),'value':_0x3331c9[_0x585f('0x39')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9[_0x585f('0x3a')][0x0]?_0x3331c9[_0x585f('0x3a')][0x0][_0x585f('0x3b')]:undefined)||_0x585f('0x3c')}];case _0x585f('0x3d'):return[{'name':'attrPath','value':_0x3331c9[_0x585f('0x3e')]||(_0x3331c9['attrs']&&_0x3331c9[_0x585f('0x3a')][0x0]?_0x3331c9['attrs'][0x0]['value']:undefined)||''}];case _0x585f('0x3f'):return[{'name':_0x585f('0x40'),'value':_0x3331c9['attrHourFormat']||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9[_0x585f('0x3a')][0x0]?_0x3331c9[_0x585f('0x3a')][0x0][_0x585f('0x3b')]:undefined)||_0x585f('0x41')},{'name':_0x585f('0x42'),'value':_0x3331c9[_0x585f('0x42')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9['attrs'][0x1]?_0x3331c9['attrs'][0x1][_0x585f('0x3b')]:undefined)||'0.00'},{'name':_0x585f('0x43'),'value':_0x3331c9[_0x585f('0x43')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9[_0x585f('0x3a')][0x2]?_0x3331c9['attrs'][0x2][_0x585f('0x3b')]:undefined)||0xc}];case'counter':return[{'name':_0x585f('0x44'),'value':_0x3331c9[_0x585f('0x44')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9[_0x585f('0x3a')][0x0]?_0x3331c9['attrs'][0x0]['value']:undefined)||_0x585f('0x45')},{'name':_0x585f('0x46'),'value':_0x3331c9[_0x585f('0x46')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9[_0x585f('0x3a')][0x1]?_0x3331c9[_0x585f('0x3a')][0x1]['value']:undefined)||[]},{'name':_0x585f('0x43'),'value':_0x3331c9['attrFontSize']||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9[_0x585f('0x3a')][0x2]?_0x3331c9['attrs'][0x2]['value']:undefined)||0x14}];case _0x585f('0x47'):case _0x585f('0x48'):return[{'name':_0x585f('0x49'),'value':_0x3331c9[_0x585f('0x49')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9['attrs'][0x0]?_0x3331c9[_0x585f('0x3a')][0x0][_0x585f('0x3b')]:undefined)||_0x585f('0x45')},{'name':_0x585f('0x4a'),'value':_0x3331c9[_0x585f('0x4a')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9[_0x585f('0x3a')][0x1]?_0x3331c9[_0x585f('0x3a')][0x1][_0x585f('0x3b')]:undefined)||null},{'name':_0x585f('0x4b'),'value':_0x3331c9[_0x585f('0x4b')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9['attrs'][0x2]?_0x3331c9['attrs'][0x2][_0x585f('0x3b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3331c9['attrVoiceQueues']||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9['attrs'][0x3]?_0x3331c9[_0x585f('0x3a')][0x3][_0x585f('0x3b')]:undefined)||[]}];case _0x585f('0x4c'):return[{'name':_0x585f('0x4d'),'type':_0x3331c9[_0x585f('0x4e')]||(_0x3331c9['attrs']&&_0x3331c9[_0x585f('0x3a')][0x0]?_0x3331c9[_0x585f('0x3a')][0x0][_0x585f('0x38')]:undefined)||null,'value':_0x3331c9[_0x585f('0x4d')]||(_0x3331c9[_0x585f('0x3a')]&&_0x3331c9[_0x585f('0x3a')][0x0]?_0x3331c9[_0x585f('0x3a')][0x0][_0x585f('0x3b')]:undefined)||null},{'name':'attrRefresh','value':_0x3331c9['attrRefresh']||(_0x3331c9['attrs']&&_0x3331c9[_0x585f('0x3a')][0x1]?_0x3331c9[_0x585f('0x3a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x47ddd3){logger[_0x585f('0x4f')]('widgetAttributes:\x20%s',JSON['stringify'](_0x47ddd3));return[];}}exports[_0x585f('0x50')]=function(_0x1970c1,_0x187321){if(_0x1970c1[_0x585f('0x51')]){_0x1970c1[_0x585f('0x51')][_0x585f('0x3a')]=widgetAttributes(_0x1970c1[_0x585f('0x51')]);}return db['DashboardItem'][_0x585f('0x50')](_0x1970c1[_0x585f('0x51')],{})[_0x585f('0x24')](respondWithResult(_0x187321,0xc9))[_0x585f('0x36')](handleError(_0x187321,null));};exports[_0x585f('0x52')]=function(_0x10ce0e,_0x4978d2){if(_0x10ce0e[_0x585f('0x51')]['id']){delete _0x10ce0e[_0x585f('0x51')]['id'];}_0x10ce0e['body'][_0x585f('0x3a')]=widgetAttributes(_0x10ce0e[_0x585f('0x51')]);return db[_0x585f('0x2c')]['find']({'where':{'id':_0x10ce0e[_0x585f('0x29')]['id']}})[_0x585f('0x24')](handleEntityNotFound(_0x4978d2,null))['then'](saveUpdates(_0x10ce0e[_0x585f('0x51')],null))[_0x585f('0x24')](respondWithResult(_0x4978d2,null))[_0x585f('0x36')](handleError(_0x4978d2,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 23c35c7..1d6666f 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 _0x3d8f=['../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3df21d,_0xa44265){var _0x37ab8a=function(_0x156e3d){while(--_0x156e3d){_0x3df21d['push'](_0x3df21d['shift']());}};_0x37ab8a(++_0xa44265);}(_0x3d8f,0x18c));var _0xf3d8=function(_0x3aa29b,_0x496671){_0x3aa29b=_0x3aa29b-0x0;var _0x596d9b=_0x3d8f[_0x3aa29b];return _0x596d9b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xf3d8('0x0'))['db'][_0xf3d8('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf3d8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf3d8('0x3'),'afterDestroy':_0xf3d8('0x4')};function emitEvent(_0x532ecf){return function(_0x32eee9,_0x3ec9eb,_0x1d58b1){DashboardItemEvents[_0xf3d8('0x5')](_0x532ecf+':'+_0x32eee9['id'],_0x32eee9);DashboardItemEvents[_0xf3d8('0x5')](_0x532ecf,_0x32eee9);_0x1d58b1(null);};}for(var e in events){if(events[_0xf3d8('0x6')](e)){var event=events[e];DashboardItem[_0xf3d8('0x7')](e,emitEvent(event));}}module[_0xf3d8('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x627a=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x319a36,_0xdaeb6b){var _0x432291=function(_0x46feee){while(--_0x46feee){_0x319a36['push'](_0x319a36['shift']());}};_0x432291(++_0xdaeb6b);}(_0x627a,0xae));var _0xa627=function(_0x508eef,_0x3c4e06){_0x508eef=_0x508eef-0x0;var _0x357186=_0x627a[_0x508eef];return _0x357186;};'use strict';var EventEmitter=require(_0xa627('0x0'));var DashboardItem=require(_0xa627('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa627('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa627('0x3'),'afterDestroy':_0xa627('0x4')};function emitEvent(_0x3cfc79){return function(_0x2670d3,_0x31be33,_0x4f093f){DashboardItemEvents[_0xa627('0x5')](_0x3cfc79+':'+_0x2670d3['id'],_0x2670d3);DashboardItemEvents['emit'](_0x3cfc79,_0x2670d3);_0x4f093f(null);};}for(var e in events){if(events[_0xa627('0x6')](e)){var event=events[e];DashboardItem[_0xa627('0x7')](e,emitEvent(event));}}module[_0xa627('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index faaa59a..d7759f3 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 _0x6eef=['moment','request-promise','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger'];(function(_0x4a4ba0,_0x463721){var _0x45de2d=function(_0x25acb0){while(--_0x25acb0){_0x4a4ba0['push'](_0x4a4ba0['shift']());}};_0x45de2d(++_0x463721);}(_0x6eef,0x166));var _0xf6ee=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x6eef[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0xf6ee('0x0'));var util=require('util');var logger=require(_0xf6ee('0x1'))('api');var moment=require(_0xf6ee('0x2'));var BPromise=require('bluebird');var rp=require(_0xf6ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf6ee('0x4'));var attributes=require('./dashboardItem.attributes');module[_0xf6ee('0x5')]=function(_0x4e785c,_0x3583a2){return _0x4e785c[_0xf6ee('0x6')](_0xf6ee('0x7'),attributes,{'tableName':_0xf6ee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2522=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4d927c,_0x275046){var _0x3867ca=function(_0x1af028){while(--_0x1af028){_0x4d927c['push'](_0x4d927c['shift']());}};_0x3867ca(++_0x275046);}(_0x2522,0x1f3));var _0x2252=function(_0x3b88c,_0x77a611){_0x3b88c=_0x3b88c-0x0;var _0x168171=_0x2522[_0x3b88c];return _0x168171;};'use strict';var _=require(_0x2252('0x0'));var util=require(_0x2252('0x1'));var logger=require(_0x2252('0x2'))('api');var moment=require(_0x2252('0x3'));var BPromise=require(_0x2252('0x4'));var rp=require(_0x2252('0x5'));var fs=require('fs');var path=require(_0x2252('0x6'));var rimraf=require(_0x2252('0x7'));var config=require(_0x2252('0x8'));var attributes=require(_0x2252('0x9'));module[_0x2252('0xa')]=function(_0x5f587f,_0x2ae66c){return _0x5f587f[_0x2252('0xb')](_0x2252('0xc'),attributes,{'tableName':_0x2252('0xd'),'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 5899456..d9680d0 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 _0x6cb7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','randomstring'];(function(_0xc9308,_0x31040b){var _0x35cc46=function(_0x593833){while(--_0x593833){_0xc9308['push'](_0xc9308['shift']());}};_0x35cc46(++_0x31040b);}(_0x6cb7,0x1a8));var _0x76cb=function(_0x4b203f,_0xc7e9ea){_0x4b203f=_0x4b203f-0x0;var _0x45e72a=_0x6cb7[_0x4b203f];return _0x45e72a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x76cb('0x0'));var fs=require('fs');var Redis=require(_0x76cb('0x1'));var db=require(_0x76cb('0x2'))['db'];var utils=require(_0x76cb('0x3'));var logger=require(_0x76cb('0x4'))(_0x76cb('0x5'));var config=require(_0x76cb('0x6'));var jayson=require(_0x76cb('0x7'));var client=jayson[_0x76cb('0x8')][_0x76cb('0x9')]({'port':0x232a});config[_0x76cb('0xa')]=_[_0x76cb('0xb')](config[_0x76cb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x76cb('0xc'))(new Redis(config[_0x76cb('0xa')]));require(_0x76cb('0xd'))[_0x76cb('0xe')](socket);function respondWithRpcPromise(_0x388a8,_0x1205b0,_0x2cabe8){return new BPromise(function(_0x24173a,_0x3d18d4){return client[_0x76cb('0xf')](_0x388a8,_0x2cabe8)[_0x76cb('0x10')](function(_0x35cb79){logger['info'](_0x76cb('0x11'),_0x1205b0,'request\x20sent');logger['debug'](_0x76cb('0x12'),_0x1205b0,_0x76cb('0x13'),JSON[_0x76cb('0x14')](_0x35cb79));if(_0x35cb79['error']){if(_0x35cb79['error']['code']===0x1f4){logger['error'](_0x76cb('0x11'),_0x1205b0,_0x35cb79[_0x76cb('0x15')]['message']);return _0x3d18d4(_0x35cb79['error'][_0x76cb('0x16')]);}logger['error'](_0x76cb('0x11'),_0x1205b0,_0x35cb79[_0x76cb('0x15')]['message']);return _0x24173a(_0x35cb79[_0x76cb('0x15')][_0x76cb('0x16')]);}else{logger[_0x76cb('0x17')](_0x76cb('0x11'),_0x1205b0,_0x76cb('0x13'));_0x24173a(_0x35cb79['result'][_0x76cb('0x16')]);}})[_0x76cb('0x18')](function(_0x592ca8){logger[_0x76cb('0x15')]('DashboardItem,\x20%s,\x20%s',_0x1205b0,_0x592ca8);_0x3d18d4(_0x592ca8);});});} \ No newline at end of file +var _0xcf06=['result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','request\x20sent'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xcf06,0x1bc));var _0x6cf0=function(_0x3ba342,_0x5fe483){_0x3ba342=_0x3ba342-0x0;var _0x2190c7=_0xcf06[_0x3ba342];return _0x2190c7;};'use strict';var _=require('lodash');var util=require(_0x6cf0('0x0'));var moment=require('moment');var BPromise=require(_0x6cf0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cf0('0x2'))['db'];var utils=require(_0x6cf0('0x3'));var logger=require(_0x6cf0('0x4'))(_0x6cf0('0x5'));var config=require(_0x6cf0('0x6'));var jayson=require(_0x6cf0('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x6cf0('0x8')]=_[_0x6cf0('0x9')](config[_0x6cf0('0x8')],{'host':_0x6cf0('0xa'),'port':0x18eb});var socket=require(_0x6cf0('0xb'))(new Redis(config[_0x6cf0('0x8')]));require(_0x6cf0('0xc'))[_0x6cf0('0xd')](socket);function respondWithRpcPromise(_0x4739e4,_0x518f6f,_0x2ed55e){return new BPromise(function(_0x4d7130,_0x59d188){return client[_0x6cf0('0xe')](_0x4739e4,_0x2ed55e)[_0x6cf0('0xf')](function(_0x338e02){logger[_0x6cf0('0x10')]('DashboardItem,\x20%s,\x20%s',_0x518f6f,'request\x20sent');logger[_0x6cf0('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x518f6f,'request\x20sent',JSON[_0x6cf0('0x12')](_0x338e02));if(_0x338e02[_0x6cf0('0x13')]){if(_0x338e02[_0x6cf0('0x13')][_0x6cf0('0x14')]===0x1f4){logger[_0x6cf0('0x13')](_0x6cf0('0x15'),_0x518f6f,_0x338e02['error']['message']);return _0x59d188(_0x338e02[_0x6cf0('0x13')][_0x6cf0('0x16')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x518f6f,_0x338e02[_0x6cf0('0x13')][_0x6cf0('0x16')]);return _0x4d7130(_0x338e02[_0x6cf0('0x13')][_0x6cf0('0x16')]);}else{logger[_0x6cf0('0x10')]('DashboardItem,\x20%s,\x20%s',_0x518f6f,_0x6cf0('0x17'));_0x4d7130(_0x338e02[_0x6cf0('0x18')][_0x6cf0('0x16')]);}})[_0x6cf0('0x19')](function(_0x4b06b8){logger[_0x6cf0('0x13')](_0x6cf0('0x15'),_0x518f6f,_0x4b06b8);_0x59d188(_0x4b06b8);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 7e68f86..2ecbd3a 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 _0xe027=['length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register'];(function(_0x525798,_0x1b3007){var _0x5b66d7=function(_0x4e491b){while(--_0x4e491b){_0x525798['push'](_0x525798['shift']());}};_0x5b66d7(++_0x1b3007);}(_0xe027,0xe2));var _0x7e02=function(_0x1680b6,_0xf06d09){_0x1680b6=_0x1680b6-0x0;var _0x5043c3=_0xe027[_0x1680b6];return _0x5043c3;};'use strict';var DashboardItemEvents=require(_0x7e02('0x0'));var events=['save',_0x7e02('0x1'),_0x7e02('0x2')];function createListener(_0x17b184,_0x75e5db){return function(_0x334983){_0x75e5db[_0x7e02('0x3')](_0x17b184,_0x334983);};}function removeListener(_0x52b335,_0x209ac0){return function(){DashboardItemEvents[_0x7e02('0x4')](_0x52b335,_0x209ac0);};}exports[_0x7e02('0x5')]=function(_0x5bfd71){for(var _0x497c19=0x0,_0x507ddd=events[_0x7e02('0x6')];_0x497c19<_0x507ddd;_0x497c19++){var _0x1abfe3=events[_0x497c19];var _0x351853=createListener(_0x7e02('0x7')+_0x1abfe3,_0x5bfd71);DashboardItemEvents['on'](_0x1abfe3,_0x351853);}}; \ No newline at end of file +var _0x29ce=['save','remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events'];(function(_0x3cf1b1,_0x445a0a){var _0x347602=function(_0x19c0a1){while(--_0x19c0a1){_0x3cf1b1['push'](_0x3cf1b1['shift']());}};_0x347602(++_0x445a0a);}(_0x29ce,0xc7));var _0xe29c=function(_0xdfefa9,_0x72f3f9){_0xdfefa9=_0xdfefa9-0x0;var _0x2f1740=_0x29ce[_0xdfefa9];return _0x2f1740;};'use strict';var DashboardItemEvents=require(_0xe29c('0x0'));var events=[_0xe29c('0x1'),_0xe29c('0x2'),_0xe29c('0x3')];function createListener(_0x598a13,_0x1d4eca){return function(_0x3876f0){_0x1d4eca[_0xe29c('0x4')](_0x598a13,_0x3876f0);};}function removeListener(_0x1d36f7,_0x5e2631){return function(){DashboardItemEvents[_0xe29c('0x5')](_0x1d36f7,_0x5e2631);};}exports['register']=function(_0x195b31){for(var _0x4edbba=0x0,_0x292f8c=events[_0xe29c('0x6')];_0x4edbba<_0x292f8c;_0x4edbba++){var _0x2c36c4=events[_0x4edbba];var _0x3bb7cc=createListener(_0xe29c('0x7')+_0x2c36c4,_0x195b31);DashboardItemEvents['on'](_0x2c36c4,_0x3bb7cc);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 46248af..18ca90a 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 _0xe14b=['post','create','update','delete','multer','util','express','Router','../../components/interaction/service','get','/:id','isAuthenticated','show'];(function(_0x287dcc,_0x21841a){var _0x4ca8ea=function(_0x2d1461){while(--_0x2d1461){_0x287dcc['push'](_0x287dcc['shift']());}};_0x4ca8ea(++_0x21841a);}(_0xe14b,0x93));var _0xbe14=function(_0x17a232,_0x1569c9){_0x17a232=_0x17a232-0x0;var _0xc333f6=_0xe14b[_0x17a232];return _0xc333f6;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xbe14('0x5')](_0xbe14('0x6'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x9')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbe14('0xb')]);router[_0xbe14('0xc')](_0xbe14('0x6'),auth[_0xbe14('0x7')](),controller['destroy']);module['exports']=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(_0x1ad0b4,_0x3638f4){var _0x42f563=function(_0x5a886e){while(--_0x5a886e){_0x1ad0b4['push'](_0x1ad0b4['shift']());}};_0x42f563(++_0x3638f4);}(_0x31f0,0xb7));var _0x031f=function(_0x277f40,_0x31e69e){_0x277f40=_0x277f40-0x0;var _0x4d465e=_0x31f0[_0x277f40];return _0x4d465e;};'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 e95df2f..7117d60 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 _0xa4d5=['STRING','sequelize','exports'];(function(_0x303d93,_0x2ee399){var _0x36d8a7=function(_0x41bdf7){while(--_0x41bdf7){_0x303d93['push'](_0x303d93['shift']());}};_0x36d8a7(++_0x2ee399);}(_0xa4d5,0x1ab));var _0x5a4d=function(_0x5de967,_0x515918){_0x5de967=_0x5de967-0x0;var _0x5b07a3=_0xa4d5[_0x5de967];return _0x5b07a3;};'use strict';var Sequelize=require(_0x5a4d('0x0'));module[_0x5a4d('0x1')]={'name':{'type':Sequelize[_0x5a4d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4c28=['exports','STRING','sequelize'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x4c28,0xad));var _0x84c2=function(_0x4f6395,_0x38d77a){_0x4f6395=_0x4f6395-0x0;var _0x13dc86=_0x4c28[_0x4f6395];return _0x13dc86;};'use strict';var Sequelize=require(_0x84c2('0x0'));module[_0x84c2('0x1')]={'name':{'type':Sequelize[_0x84c2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e6286e3..33e688f 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 _0xe841=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','fields','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Dispositions','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','params','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','status','end','json','count','offset','Content-Range','apply','save','update','then','destroy','get','sendStatus','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length'];(function(_0x5c776d,_0x5e90cc){var _0x199643=function(_0x2918ca){while(--_0x2918ca){_0x5c776d['push'](_0x5c776d['shift']());}};_0x199643(++_0x5e90cc);}(_0xe841,0x175));var _0x1e84=function(_0x405d79,_0x4c3401){_0x405d79=_0x405d79-0x0;var _0x3d7546=_0xe841[_0x405d79];return _0x3d7546;};'use strict';var pdf=require(_0x1e84('0x0'));var emlformat=require(_0x1e84('0x1'));var rimraf=require(_0x1e84('0x2'));var zipdir=require(_0x1e84('0x3'));var jsonpatch=require(_0x1e84('0x4'));var rp=require(_0x1e84('0x5'));var moment=require(_0x1e84('0x6'));var BPromise=require(_0x1e84('0x7'));var Mustache=require(_0x1e84('0x8'));var util=require(_0x1e84('0x9'));var path=require(_0x1e84('0xa'));var sox=require(_0x1e84('0xb'));var csv=require(_0x1e84('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1e84('0xd'));var squel=require(_0x1e84('0xe'));var crypto=require(_0x1e84('0xf'));var jsforce=require(_0x1e84('0x10'));var deskjs=require(_0x1e84('0x11'));var toCsv=require(_0x1e84('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1e84('0x12'));var authService=require(_0x1e84('0x13'));var qs=require(_0x1e84('0x14'));var as=require(_0x1e84('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e84('0x16'))(_0x1e84('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28b1b9,_0x7404ae){_0x7404ae=_0x7404ae||0xcc;return function(_0x5e2195){if(_0x5e2195){return _0x28b1b9['sendStatus'](_0x7404ae);}return _0x28b1b9[_0x1e84('0x18')](_0x7404ae)[_0x1e84('0x19')]();};}function respondWithResult(_0x4572c6,_0x77f083){_0x77f083=_0x77f083||0xc8;return function(_0x5c9043){if(_0x5c9043){return _0x4572c6[_0x1e84('0x18')](_0x77f083)[_0x1e84('0x1a')](_0x5c9043);}};}function respondWithFilteredResult(_0x20c265,_0x3babda){return function(_0x52ba73){if(_0x52ba73){var _0x3e2276=_0x52ba73[_0x1e84('0x1b')],_0x44ee9d=_0x3babda[_0x1e84('0x1c')],_0x14ba49=_0x3babda[_0x1e84('0x1c')]+_0x3babda['limit'],_0x159624;if(_0x14ba49>=_0x3e2276){_0x14ba49=_0x3e2276;_0x159624=0xc8;}else{_0x159624=0xce;}_0x20c265['status'](_0x159624);return _0x20c265['set'](_0x1e84('0x1d'),_0x44ee9d+'-'+_0x14ba49+'/'+_0x3e2276)[_0x1e84('0x1a')](_0x52ba73);}return null;};}function patchUpdates(_0x20e877){return function(_0x232356){try{jsonpatch[_0x1e84('0x1e')](_0x232356,_0x20e877,!![]);}catch(_0x2296c9){return BPromise['reject'](_0x2296c9);}return _0x232356[_0x1e84('0x1f')]();};}function saveUpdates(_0x644529,_0x221777){return function(_0x3fc3b9){if(_0x3fc3b9){return _0x3fc3b9[_0x1e84('0x20')](_0x644529)[_0x1e84('0x21')](function(_0x44d668){return _0x44d668;});}return null;};}function removeEntity(_0x162f49,_0x553393){return function(_0x25fec7){if(_0x25fec7){return _0x25fec7[_0x1e84('0x22')]()['then'](function(){var _0x48e082=_0x25fec7[_0x1e84('0x23')]({'plain':!![]});var _0xd14e16='Dispositions';return db['UserProfileResource'][_0x1e84('0x22')]({'where':{'type':_0xd14e16,'resourceId':_0x48e082['id']}})[_0x1e84('0x21')](function(){return _0x25fec7;});})[_0x1e84('0x21')](function(){_0x162f49[_0x1e84('0x18')](0xcc)[_0x1e84('0x19')]();});}};}function handleEntityNotFound(_0x3b0358,_0x52ec69){return function(_0x2dd1b5){if(!_0x2dd1b5){_0x3b0358[_0x1e84('0x24')](0x194);}return _0x2dd1b5;};}function handleError(_0x73026f,_0x5f5bce){_0x5f5bce=_0x5f5bce||0x1f4;return function(_0x42e5ea){logger['error'](_0x42e5ea[_0x1e84('0x25')]);if(_0x42e5ea[_0x1e84('0x26')]){delete _0x42e5ea[_0x1e84('0x26')];}_0x73026f[_0x1e84('0x18')](_0x5f5bce)[_0x1e84('0x27')](_0x42e5ea);};}exports[_0x1e84('0x28')]=function(_0x313bf1,_0x398e2c){var _0x5d3b50={},_0x307984={},_0x30fc8f={'count':0x0,'rows':[]};var _0x195feb=_[_0x1e84('0x29')](db[_0x1e84('0x2a')][_0x1e84('0x2b')],function(_0x1b60a0){return{'name':_0x1b60a0[_0x1e84('0x2c')],'type':_0x1b60a0['type'][_0x1e84('0x2d')]};});_0x307984['model']=_[_0x1e84('0x29')](_0x195feb,_0x1e84('0x26'));_0x307984[_0x1e84('0x2e')]=_['keys'](_0x313bf1[_0x1e84('0x2e')]);_0x307984[_0x1e84('0x2f')]=_[_0x1e84('0x30')](_0x307984[_0x1e84('0x31')],_0x307984[_0x1e84('0x2e')]);_0x5d3b50[_0x1e84('0x32')]=_[_0x1e84('0x30')](_0x307984[_0x1e84('0x31')],qs['fields'](_0x313bf1[_0x1e84('0x2e')]['fields']));_0x5d3b50[_0x1e84('0x32')]=_0x5d3b50[_0x1e84('0x32')][_0x1e84('0x33')]?_0x5d3b50[_0x1e84('0x32')]:_0x307984[_0x1e84('0x31')];if(!_0x313bf1[_0x1e84('0x2e')][_0x1e84('0x34')](_0x1e84('0x35'))){_0x5d3b50[_0x1e84('0x36')]=qs['limit'](_0x313bf1[_0x1e84('0x2e')][_0x1e84('0x36')]);_0x5d3b50[_0x1e84('0x1c')]=qs[_0x1e84('0x1c')](_0x313bf1[_0x1e84('0x2e')]['offset']);}_0x5d3b50[_0x1e84('0x37')]=qs[_0x1e84('0x38')](_0x313bf1[_0x1e84('0x2e')][_0x1e84('0x38')]);_0x5d3b50[_0x1e84('0x39')]=qs[_0x1e84('0x2f')](_[_0x1e84('0x3a')](_0x313bf1[_0x1e84('0x2e')],_0x307984[_0x1e84('0x2f')]),_0x195feb);if(_0x313bf1['query'][_0x1e84('0x3b')]){_0x5d3b50[_0x1e84('0x39')]=_[_0x1e84('0x3c')](_0x5d3b50[_0x1e84('0x39')],{'$or':_[_0x1e84('0x29')](_0x195feb,function(_0x5b5c02){if(_0x5b5c02[_0x1e84('0x3d')]!==_0x1e84('0x3e')){var _0x533721={};_0x533721[_0x5b5c02[_0x1e84('0x26')]]={'$like':'%'+_0x313bf1[_0x1e84('0x2e')]['filter']+'%'};return _0x533721;}})});}_0x5d3b50=_[_0x1e84('0x3c')]({},_0x5d3b50,_0x313bf1[_0x1e84('0x3f')]);var _0x1b3b68={'where':_0x5d3b50[_0x1e84('0x39')]};return db[_0x1e84('0x2a')][_0x1e84('0x1b')](_0x1b3b68)['then'](function(_0x11b026){_0x30fc8f[_0x1e84('0x1b')]=_0x11b026;if(_0x313bf1['query'][_0x1e84('0x40')]){_0x5d3b50['include']=[{'all':!![]}];}return db[_0x1e84('0x2a')][_0x1e84('0x41')](_0x5d3b50);})[_0x1e84('0x21')](function(_0x23bdeb){_0x30fc8f[_0x1e84('0x42')]=_0x23bdeb;return _0x30fc8f;})[_0x1e84('0x21')](respondWithFilteredResult(_0x398e2c,_0x5d3b50))[_0x1e84('0x43')](handleError(_0x398e2c,null));};exports[_0x1e84('0x44')]=function(_0x5876ba,_0x20fd90){var _0x37df5b={'raw':!![],'where':{'id':_0x5876ba['params']['id']}},_0x2c8180={};_0x2c8180[_0x1e84('0x31')]=_['keys'](db[_0x1e84('0x2a')][_0x1e84('0x2b')]);_0x2c8180['query']=_[_0x1e84('0x45')](_0x5876ba['query']);_0x2c8180['filters']=_[_0x1e84('0x30')](_0x2c8180[_0x1e84('0x31')],_0x2c8180['query']);_0x37df5b[_0x1e84('0x32')]=_[_0x1e84('0x30')](_0x2c8180[_0x1e84('0x31')],qs[_0x1e84('0x46')](_0x5876ba[_0x1e84('0x2e')][_0x1e84('0x46')]));_0x37df5b[_0x1e84('0x32')]=_0x37df5b[_0x1e84('0x32')][_0x1e84('0x33')]?_0x37df5b[_0x1e84('0x32')]:_0x2c8180['model'];if(_0x5876ba[_0x1e84('0x2e')]['includeAll']){_0x37df5b[_0x1e84('0x47')]=[{'all':!![]}];}_0x37df5b=_[_0x1e84('0x3c')]({},_0x37df5b,_0x5876ba['options']);return db[_0x1e84('0x2a')]['find'](_0x37df5b)[_0x1e84('0x21')](handleEntityNotFound(_0x20fd90,null))['then'](respondWithResult(_0x20fd90,null))[_0x1e84('0x43')](handleError(_0x20fd90,null));};exports['create']=function(_0x33dc70,_0x5706a0){return db['Disposition'][_0x1e84('0x48')](_0x33dc70[_0x1e84('0x49')],{})[_0x1e84('0x21')](function(_0x16d0ff){var _0x5c81f9=_0x33dc70['user'][_0x1e84('0x23')]({'plain':!![]});if(!_0x5c81f9)throw new Error(_0x1e84('0x4a'));if(_0x5c81f9[_0x1e84('0x4b')]===_0x1e84('0x4c')){var _0x663773=_0x16d0ff['get']({'plain':!![]});var _0x3630d8=_0x1e84('0x4d');return db[_0x1e84('0x4e')][_0x1e84('0x4f')]({'where':{'name':_0x3630d8,'userProfileId':_0x5c81f9[_0x1e84('0x50')]},'raw':!![]})[_0x1e84('0x21')](function(_0x25a51d){if(_0x25a51d&&_0x25a51d[_0x1e84('0x51')]===0x0){return db[_0x1e84('0x52')]['create']({'name':_0x663773[_0x1e84('0x26')],'resourceId':_0x663773['id'],'type':_0x25a51d[_0x1e84('0x26')],'sectionId':_0x25a51d['id']},{})[_0x1e84('0x21')](function(){return _0x16d0ff;});}else{return _0x16d0ff;}})[_0x1e84('0x43')](function(_0xd5f079){logger[_0x1e84('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd5f079);throw _0xd5f079;});}return _0x16d0ff;})[_0x1e84('0x21')](respondWithResult(_0x5706a0,0xc9))[_0x1e84('0x43')](handleError(_0x5706a0,null));};exports['update']=function(_0x546793,_0x29bb13){if(_0x546793[_0x1e84('0x49')]['id']){delete _0x546793['body']['id'];}return db[_0x1e84('0x2a')][_0x1e84('0x4f')]({'where':{'id':_0x546793[_0x1e84('0x54')]['id']}})['then'](handleEntityNotFound(_0x29bb13,null))[_0x1e84('0x21')](saveUpdates(_0x546793[_0x1e84('0x49')],null))[_0x1e84('0x21')](respondWithResult(_0x29bb13,null))[_0x1e84('0x43')](handleError(_0x29bb13,null));};exports['destroy']=function(_0x3e6e8c,_0x2cc720){return db[_0x1e84('0x2a')][_0x1e84('0x4f')]({'where':{'id':_0x3e6e8c[_0x1e84('0x54')]['id']}})[_0x1e84('0x21')](handleEntityNotFound(_0x2cc720,null))['then'](removeEntity(_0x2cc720,null))[_0x1e84('0x43')](handleError(_0x2cc720,null));}; \ No newline at end of file +var _0xc74e=['error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','Disposition','includeAll','include','rows','params','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','end'];(function(_0x154277,_0x509577){var _0x26da82=function(_0x2596a4){while(--_0x2596a4){_0x154277['push'](_0x154277['shift']());}};_0x26da82(++_0x509577);}(_0xc74e,0x116));var _0xec74=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc74e[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0xec74('0x0'));var emlformat=require(_0xec74('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xec74('0x2'));var jsonpatch=require(_0xec74('0x3'));var rp=require(_0xec74('0x4'));var moment=require('moment');var BPromise=require(_0xec74('0x5'));var Mustache=require('mustache');var util=require(_0xec74('0x6'));var path=require(_0xec74('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xec74('0x8'));var squel=require(_0xec74('0x9'));var crypto=require('crypto');var jsforce=require(_0xec74('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xec74('0xb'));var Redis=require(_0xec74('0xc'));var authService=require(_0xec74('0xd'));var qs=require(_0xec74('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec74('0xf'))(_0xec74('0x10'));var utils=require(_0xec74('0x11'));var config=require(_0xec74('0x12'));var db=require(_0xec74('0x13'))['db'];function respondWithStatusCode(_0x5e79eb,_0x2b5390){_0x2b5390=_0x2b5390||0xcc;return function(_0x3581c3){if(_0x3581c3){return _0x5e79eb[_0xec74('0x14')](_0x2b5390);}return _0x5e79eb['status'](_0x2b5390)['end']();};}function respondWithResult(_0x265e54,_0x3124e7){_0x3124e7=_0x3124e7||0xc8;return function(_0x1d9d58){if(_0x1d9d58){return _0x265e54[_0xec74('0x15')](_0x3124e7)[_0xec74('0x16')](_0x1d9d58);}};}function respondWithFilteredResult(_0x1705da,_0xceee3d){return function(_0x22b80a){if(_0x22b80a){var _0x47da9e=_0x22b80a[_0xec74('0x17')],_0xdbe246=_0xceee3d[_0xec74('0x18')],_0x4c77e8=_0xceee3d[_0xec74('0x18')]+_0xceee3d[_0xec74('0x19')],_0x5074da;if(_0x4c77e8>=_0x47da9e){_0x4c77e8=_0x47da9e;_0x5074da=0xc8;}else{_0x5074da=0xce;}_0x1705da[_0xec74('0x15')](_0x5074da);return _0x1705da[_0xec74('0x1a')](_0xec74('0x1b'),_0xdbe246+'-'+_0x4c77e8+'/'+_0x47da9e)[_0xec74('0x16')](_0x22b80a);}return null;};}function patchUpdates(_0x5022ec){return function(_0x4b41cb){try{jsonpatch[_0xec74('0x1c')](_0x4b41cb,_0x5022ec,!![]);}catch(_0x4395d3){return BPromise[_0xec74('0x1d')](_0x4395d3);}return _0x4b41cb[_0xec74('0x1e')]();};}function saveUpdates(_0x4ca564,_0x25b91c){return function(_0x56b0ab){if(_0x56b0ab){return _0x56b0ab[_0xec74('0x1f')](_0x4ca564)[_0xec74('0x20')](function(_0x39636b){return _0x39636b;});}return null;};}function removeEntity(_0xaba33f,_0x5061e7){return function(_0x2980a4){if(_0x2980a4){return _0x2980a4['destroy']()[_0xec74('0x20')](function(){var _0x2ac727=_0x2980a4[_0xec74('0x21')]({'plain':!![]});var _0x105e83=_0xec74('0x22');return db[_0xec74('0x23')][_0xec74('0x24')]({'where':{'type':_0x105e83,'resourceId':_0x2ac727['id']}})['then'](function(){return _0x2980a4;});})['then'](function(){_0xaba33f[_0xec74('0x15')](0xcc)[_0xec74('0x25')]();});}};}function handleEntityNotFound(_0x274790,_0x177b6d){return function(_0x59c71e){if(!_0x59c71e){_0x274790[_0xec74('0x14')](0x194);}return _0x59c71e;};}function handleError(_0x29b388,_0x1b9210){_0x1b9210=_0x1b9210||0x1f4;return function(_0xfcd074){logger[_0xec74('0x26')](_0xfcd074[_0xec74('0x27')]);if(_0xfcd074['name']){delete _0xfcd074[_0xec74('0x28')];}_0x29b388[_0xec74('0x15')](_0x1b9210)[_0xec74('0x29')](_0xfcd074);};}exports[_0xec74('0x2a')]=function(_0x20a8b9,_0x1cf5c3){var _0x5a34c3={},_0x1aebd4={},_0xa89032={'count':0x0,'rows':[]};var _0x277263=_['map'](db['Disposition'][_0xec74('0x2b')],function(_0x40c92d){return{'name':_0x40c92d[_0xec74('0x2c')],'type':_0x40c92d[_0xec74('0x2d')][_0xec74('0x2e')]};});_0x1aebd4['model']=_[_0xec74('0x2f')](_0x277263,_0xec74('0x28'));_0x1aebd4[_0xec74('0x30')]=_['keys'](_0x20a8b9[_0xec74('0x30')]);_0x1aebd4[_0xec74('0x31')]=_[_0xec74('0x32')](_0x1aebd4[_0xec74('0x33')],_0x1aebd4[_0xec74('0x30')]);_0x5a34c3['attributes']=_[_0xec74('0x32')](_0x1aebd4[_0xec74('0x33')],qs[_0xec74('0x34')](_0x20a8b9[_0xec74('0x30')][_0xec74('0x34')]));_0x5a34c3[_0xec74('0x35')]=_0x5a34c3['attributes'][_0xec74('0x36')]?_0x5a34c3[_0xec74('0x35')]:_0x1aebd4[_0xec74('0x33')];if(!_0x20a8b9['query'][_0xec74('0x37')](_0xec74('0x38'))){_0x5a34c3[_0xec74('0x19')]=qs[_0xec74('0x19')](_0x20a8b9[_0xec74('0x30')][_0xec74('0x19')]);_0x5a34c3[_0xec74('0x18')]=qs[_0xec74('0x18')](_0x20a8b9['query'][_0xec74('0x18')]);}_0x5a34c3['order']=qs[_0xec74('0x39')](_0x20a8b9[_0xec74('0x30')][_0xec74('0x39')]);_0x5a34c3[_0xec74('0x3a')]=qs[_0xec74('0x31')](_[_0xec74('0x3b')](_0x20a8b9['query'],_0x1aebd4[_0xec74('0x31')]),_0x277263);if(_0x20a8b9[_0xec74('0x30')][_0xec74('0x3c')]){_0x5a34c3[_0xec74('0x3a')]=_[_0xec74('0x3d')](_0x5a34c3['where'],{'$or':_['map'](_0x277263,function(_0x3bf387){if(_0x3bf387[_0xec74('0x2d')]!==_0xec74('0x3e')){var _0x3c14f2={};_0x3c14f2[_0x3bf387[_0xec74('0x28')]]={'$like':'%'+_0x20a8b9[_0xec74('0x30')][_0xec74('0x3c')]+'%'};return _0x3c14f2;}})});}_0x5a34c3=_['merge']({},_0x5a34c3,_0x20a8b9['options']);var _0x5344d8={'where':_0x5a34c3['where']};return db[_0xec74('0x3f')]['count'](_0x5344d8)[_0xec74('0x20')](function(_0x4c7e02){_0xa89032[_0xec74('0x17')]=_0x4c7e02;if(_0x20a8b9[_0xec74('0x30')][_0xec74('0x40')]){_0x5a34c3[_0xec74('0x41')]=[{'all':!![]}];}return db[_0xec74('0x3f')]['findAll'](_0x5a34c3);})['then'](function(_0x3e3806){_0xa89032[_0xec74('0x42')]=_0x3e3806;return _0xa89032;})[_0xec74('0x20')](respondWithFilteredResult(_0x1cf5c3,_0x5a34c3))['catch'](handleError(_0x1cf5c3,null));};exports['show']=function(_0x38bbbc,_0x4b0c46){var _0x235c3c={'raw':!![],'where':{'id':_0x38bbbc[_0xec74('0x43')]['id']}},_0x4c9f23={};_0x4c9f23[_0xec74('0x33')]=_[_0xec74('0x44')](db[_0xec74('0x3f')][_0xec74('0x2b')]);_0x4c9f23[_0xec74('0x30')]=_[_0xec74('0x44')](_0x38bbbc[_0xec74('0x30')]);_0x4c9f23[_0xec74('0x31')]=_['intersection'](_0x4c9f23['model'],_0x4c9f23[_0xec74('0x30')]);_0x235c3c[_0xec74('0x35')]=_['intersection'](_0x4c9f23['model'],qs['fields'](_0x38bbbc['query'][_0xec74('0x34')]));_0x235c3c['attributes']=_0x235c3c[_0xec74('0x35')][_0xec74('0x36')]?_0x235c3c[_0xec74('0x35')]:_0x4c9f23[_0xec74('0x33')];if(_0x38bbbc[_0xec74('0x30')][_0xec74('0x40')]){_0x235c3c[_0xec74('0x41')]=[{'all':!![]}];}_0x235c3c=_[_0xec74('0x3d')]({},_0x235c3c,_0x38bbbc[_0xec74('0x45')]);return db[_0xec74('0x3f')][_0xec74('0x46')](_0x235c3c)['then'](handleEntityNotFound(_0x4b0c46,null))[_0xec74('0x20')](respondWithResult(_0x4b0c46,null))[_0xec74('0x47')](handleError(_0x4b0c46,null));};exports[_0xec74('0x48')]=function(_0x154d6f,_0x48b012){return db[_0xec74('0x3f')][_0xec74('0x48')](_0x154d6f[_0xec74('0x49')],{})['then'](function(_0xd075e){var _0x1915ed=_0x154d6f[_0xec74('0x4a')]['get']({'plain':!![]});if(!_0x1915ed)throw new Error(_0xec74('0x4b'));if(_0x1915ed[_0xec74('0x4c')]===_0xec74('0x4a')){var _0x4958d4=_0xd075e[_0xec74('0x21')]({'plain':!![]});var _0x49c4a4=_0xec74('0x22');return db[_0xec74('0x4d')]['find']({'where':{'name':_0x49c4a4,'userProfileId':_0x1915ed['userProfileId']},'raw':!![]})[_0xec74('0x20')](function(_0x393f52){if(_0x393f52&&_0x393f52['autoAssociation']===0x0){return db[_0xec74('0x23')][_0xec74('0x48')]({'name':_0x4958d4[_0xec74('0x28')],'resourceId':_0x4958d4['id'],'type':_0x393f52[_0xec74('0x28')],'sectionId':_0x393f52['id']},{})[_0xec74('0x20')](function(){return _0xd075e;});}else{return _0xd075e;}})['catch'](function(_0x3f16c7){logger[_0xec74('0x26')](_0xec74('0x4e'),_0x3f16c7);throw _0x3f16c7;});}return _0xd075e;})[_0xec74('0x20')](respondWithResult(_0x48b012,0xc9))[_0xec74('0x47')](handleError(_0x48b012,null));};exports[_0xec74('0x1f')]=function(_0x448a98,_0x3efbfb){if(_0x448a98[_0xec74('0x49')]['id']){delete _0x448a98[_0xec74('0x49')]['id'];}return db[_0xec74('0x3f')][_0xec74('0x46')]({'where':{'id':_0x448a98[_0xec74('0x43')]['id']}})[_0xec74('0x20')](handleEntityNotFound(_0x3efbfb,null))[_0xec74('0x20')](saveUpdates(_0x448a98['body'],null))[_0xec74('0x20')](respondWithResult(_0x3efbfb,null))[_0xec74('0x47')](handleError(_0x3efbfb,null));};exports[_0xec74('0x24')]=function(_0x453da6,_0x2f0fae){return db['Disposition'][_0xec74('0x46')]({'where':{'id':_0x453da6[_0xec74('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f0fae,null))[_0xec74('0x20')](removeEntity(_0x2f0fae,null))[_0xec74('0x47')](handleError(_0x2f0fae,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b986928..ea42eb7 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 _0x8065=['name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name_chat'];(function(_0x1e54ab,_0x429310){var _0x1fd7e9=function(_0x557ac2){while(--_0x557ac2){_0x1e54ab['push'](_0x1e54ab['shift']());}};_0x1fd7e9(++_0x429310);}(_0x8065,0x9f));var _0x5806=function(_0x1b51d1,_0x473806){_0x1b51d1=_0x1b51d1-0x0;var _0x100c21=_0x8065[_0x1b51d1];return _0x100c21;};'use strict';var _=require(_0x5806('0x0'));var util=require(_0x5806('0x1'));var logger=require(_0x5806('0x2'))(_0x5806('0x3'));var moment=require(_0x5806('0x4'));var BPromise=require(_0x5806('0x5'));var rp=require(_0x5806('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5806('0x7'));var config=require(_0x5806('0x8'));var attributes=require(_0x5806('0x9'));module[_0x5806('0xa')]=function(_0x27ee9c,_0x3f59d4){return _0x27ee9c[_0x5806('0xb')](_0x5806('0xc'),attributes,{'tableName':_0x5806('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5806('0xe'),'fields':['name','ListId']},{'unique':!![],'name':_0x5806('0xf'),'fields':[_0x5806('0x10'),_0x5806('0x11')]},{'unique':!![],'name':_0x5806('0x12'),'fields':[_0x5806('0x10'),_0x5806('0x13')]},{'unique':!![],'name':_0x5806('0x14'),'fields':[_0x5806('0x10'),_0x5806('0x15')]},{'unique':!![],'name':_0x5806('0x16'),'fields':[_0x5806('0x10'),'FaxAccountId']},{'unique':!![],'name':_0x5806('0x17'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x5806('0x10'),_0x5806('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe0b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_dispositions','name_voice','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger'];(function(_0x2af953,_0x38d762){var _0xec0374=function(_0x48d561){while(--_0x48d561){_0x2af953['push'](_0x2af953['shift']());}};_0xec0374(++_0x38d762);}(_0xfe0b,0x11b));var _0xbfe0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfe0b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xbfe0('0x0'));var util=require(_0xbfe0('0x1'));var logger=require(_0xbfe0('0x2'))(_0xbfe0('0x3'));var moment=require(_0xbfe0('0x4'));var BPromise=require(_0xbfe0('0x5'));var rp=require(_0xbfe0('0x6'));var fs=require('fs');var path=require(_0xbfe0('0x7'));var rimraf=require(_0xbfe0('0x8'));var config=require(_0xbfe0('0x9'));var attributes=require('./disposition.attributes');module[_0xbfe0('0xa')]=function(_0x5f1e30,_0x3a2d63){return _0x5f1e30[_0xbfe0('0xb')]('Disposition',attributes,{'tableName':_0xbfe0('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbfe0('0xd'),'fields':['name','ListId']},{'unique':!![],'name':_0xbfe0('0xe'),'fields':[_0xbfe0('0xf'),_0xbfe0('0x10')]},{'unique':!![],'name':_0xbfe0('0x11'),'fields':[_0xbfe0('0xf'),_0xbfe0('0x12')]},{'unique':!![],'name':_0xbfe0('0x13'),'fields':[_0xbfe0('0xf'),_0xbfe0('0x14')]},{'unique':!![],'name':_0xbfe0('0x15'),'fields':[_0xbfe0('0xf'),_0xbfe0('0x16')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xbfe0('0x17')]},{'unique':!![],'name':_0xbfe0('0x18'),'fields':['name',_0xbfe0('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 3c87942..dca6f84 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 _0xadc2=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','Disposition,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0xadc2,0x100));var _0x2adc=function(_0x2e75c8,_0x43557b){_0x2e75c8=_0x2e75c8-0x0;var _0x4ebdd0=_0xadc2[_0x2e75c8];return _0x4ebdd0;};'use strict';var _=require(_0x2adc('0x0'));var util=require('util');var moment=require(_0x2adc('0x1'));var BPromise=require(_0x2adc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2adc('0x3'));var db=require(_0x2adc('0x4'))['db'];var utils=require(_0x2adc('0x5'));var logger=require(_0x2adc('0x6'))(_0x2adc('0x7'));var config=require(_0x2adc('0x8'));var jayson=require(_0x2adc('0x9'));var client=jayson[_0x2adc('0xa')][_0x2adc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3caf9c,_0x2a4576,_0x1ab490){return new BPromise(function(_0x41452e,_0x50bcd0){return client['request'](_0x3caf9c,_0x1ab490)[_0x2adc('0xc')](function(_0x5e14fd){logger[_0x2adc('0xd')]('Disposition,\x20%s,\x20%s',_0x2a4576,_0x2adc('0xe'));logger[_0x2adc('0xf')]('Disposition,\x20%s,\x20%s,\x20%s',_0x2a4576,_0x2adc('0xe'),JSON[_0x2adc('0x10')](_0x5e14fd));if(_0x5e14fd[_0x2adc('0x11')]){if(_0x5e14fd['error'][_0x2adc('0x12')]===0x1f4){logger[_0x2adc('0x11')](_0x2adc('0x13'),_0x2a4576,_0x5e14fd['error'][_0x2adc('0x14')]);return _0x50bcd0(_0x5e14fd[_0x2adc('0x11')][_0x2adc('0x14')]);}logger['error'](_0x2adc('0x13'),_0x2a4576,_0x5e14fd[_0x2adc('0x11')]['message']);return _0x41452e(_0x5e14fd[_0x2adc('0x11')]['message']);}else{logger[_0x2adc('0xd')](_0x2adc('0x13'),_0x2a4576,_0x2adc('0xe'));_0x41452e(_0x5e14fd[_0x2adc('0x15')][_0x2adc('0x14')]);}})['catch'](function(_0x4c644){logger[_0x2adc('0x11')](_0x2adc('0x13'),_0x2a4576,_0x4c644);_0x50bcd0(_0x4c644);});});} \ No newline at end of file +var _0xb16a=['request','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39beaa,_0x1a7d06){var _0x582f97=function(_0x1b6874){while(--_0x1b6874){_0x39beaa['push'](_0x39beaa['shift']());}};_0x582f97(++_0x1a7d06);}(_0xb16a,0x111));var _0xab16=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb16a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xab16('0x0'));var util=require(_0xab16('0x1'));var moment=require(_0xab16('0x2'));var BPromise=require('bluebird');var rs=require(_0xab16('0x3'));var fs=require('fs');var Redis=require(_0xab16('0x4'));var db=require(_0xab16('0x5'))['db'];var utils=require(_0xab16('0x6'));var logger=require(_0xab16('0x7'))(_0xab16('0x8'));var config=require(_0xab16('0x9'));var jayson=require(_0xab16('0xa'));var client=jayson[_0xab16('0xb')][_0xab16('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x491405,_0x2ad82b,_0x1972de){return new BPromise(function(_0x14ed5d,_0x4cb938){return client[_0xab16('0xd')](_0x491405,_0x1972de)['then'](function(_0x3e12ae){logger['info'](_0xab16('0xe'),_0x2ad82b,_0xab16('0xf'));logger['debug'](_0xab16('0x10'),_0x2ad82b,'request\x20sent',JSON[_0xab16('0x11')](_0x3e12ae));if(_0x3e12ae[_0xab16('0x12')]){if(_0x3e12ae[_0xab16('0x12')][_0xab16('0x13')]===0x1f4){logger[_0xab16('0x12')](_0xab16('0xe'),_0x2ad82b,_0x3e12ae['error'][_0xab16('0x14')]);return _0x4cb938(_0x3e12ae[_0xab16('0x12')][_0xab16('0x14')]);}logger[_0xab16('0x12')]('Disposition,\x20%s,\x20%s',_0x2ad82b,_0x3e12ae[_0xab16('0x12')]['message']);return _0x14ed5d(_0x3e12ae[_0xab16('0x12')][_0xab16('0x14')]);}else{logger[_0xab16('0x15')]('Disposition,\x20%s,\x20%s',_0x2ad82b,_0xab16('0xf'));_0x14ed5d(_0x3e12ae['result'][_0xab16('0x14')]);}})['catch'](function(_0x308d6d){logger[_0xab16('0x12')]('Disposition,\x20%s,\x20%s',_0x2ad82b,_0x308d6d);_0x4cb938(_0x308d6d);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 7a1df78..2cc669a 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 _0xf2e3=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated'];(function(_0x3d3b96,_0x36fa92){var _0x4e2c01=function(_0x1353d1){while(--_0x1353d1){_0x3d3b96['push'](_0x3d3b96['shift']());}};_0x4e2c01(++_0x36fa92);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xf2e3[_0x368fb9];return _0x4892fb;};'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('0xe')]('/',auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xf')]);router[_0x3f2e('0x10')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x11')]);router[_0x3f2e('0x12')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x13')]);module[_0x3f2e('0x14')]=router; \ No newline at end of file +var _0xdf94=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e7cd5,_0x386aac){var _0x100bcf=function(_0x192c94){while(--_0x192c94){_0x5e7cd5['push'](_0x5e7cd5['shift']());}};_0x100bcf(++_0x386aac);}(_0xdf94,0xad));var _0x4df9=function(_0x568a86,_0x568758){_0x568a86=_0x568a86-0x0;var _0x5567db=_0xdf94[_0x568a86];return _0x5567db;};'use strict';var multer=require('multer');var util=require(_0x4df9('0x0'));var path=require(_0x4df9('0x1'));var timeout=require(_0x4df9('0x2'));var express=require(_0x4df9('0x3'));var router=express[_0x4df9('0x4')]();var auth=require(_0x4df9('0x5'));var interaction=require(_0x4df9('0x6'));var config=require(_0x4df9('0x7'));var controller=require(_0x4df9('0x8'));router[_0x4df9('0x9')]('/',auth[_0x4df9('0xa')](),controller[_0x4df9('0xb')]);router[_0x4df9('0x9')](_0x4df9('0xc'),auth[_0x4df9('0xa')](),controller[_0x4df9('0xd')]);router[_0x4df9('0xe')]('/',auth[_0x4df9('0xa')](),controller['create']);router[_0x4df9('0xf')](_0x4df9('0xc'),auth[_0x4df9('0xa')](),controller[_0x4df9('0x10')]);router[_0x4df9('0x11')](_0x4df9('0xc'),auth[_0x4df9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 4df49c1..03b493c 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 _0xba64=['localstationid','2400','7200','9600','12000','14400','4800','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba64,0x19d));var _0x4ba6=function(_0x4e8291,_0x4ed906){_0x4e8291=_0x4e8291-0x0;var _0x325532=_0xba64[_0x4e8291];return _0x325532;};'use strict';var Sequelize=require(_0x4ba6('0x0'));module[_0x4ba6('0x1')]={'name':{'type':Sequelize[_0x4ba6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4ba6('0x2')]},'ecm':{'type':Sequelize[_0x4ba6('0x3')](_0x4ba6('0x4'),'no'),'defaultValue':_0x4ba6('0x4')},'headerinfo':{'type':Sequelize[_0x4ba6('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x4ba6('0x2')],'unique':_0x4ba6('0x5')},'minrate':{'type':Sequelize[_0x4ba6('0x3')](_0x4ba6('0x6'),'4800',_0x4ba6('0x7'),_0x4ba6('0x8'),_0x4ba6('0x9'),_0x4ba6('0xa')),'defaultValue':_0x4ba6('0xb')},'maxrate':{'type':Sequelize[_0x4ba6('0x3')](_0x4ba6('0x6'),_0x4ba6('0xb'),_0x4ba6('0x7'),_0x4ba6('0x8'),_0x4ba6('0x9'),_0x4ba6('0xa')),'defaultValue':_0x4ba6('0xa')},'modem':{'type':Sequelize[_0x4ba6('0x2')],'defaultValue':_0x4ba6('0xc')},'gateway':{'type':Sequelize[_0x4ba6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4ba6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4ba6('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4ba6('0x3')](_0x4ba6('0xe'),_0x4ba6('0xf'),'DADHI',_0x4ba6('0x10')),'defaultValue':_0x4ba6('0xe')},'key':{'type':Sequelize[_0x4ba6('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4ba6('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4ba6('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4ba6('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4ba6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4ba6('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4ba6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4ba6('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4ba6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ba6('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x4ba6('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1fdfe0){if(!_0x1fdfe0)this[_0x4ba6('0x14')]('mandatoryDispositionPauseId',null);this[_0x4ba6('0x14')](_0x4ba6('0x15'),_0x1fdfe0);}}}; \ No newline at end of file +var _0x0805=['9600','14400','4800','2400','12000','v17,v27,v29','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','xCALLY\x20Motion\x20Fax','localstationid','7200'];(function(_0x3811d4,_0x2abdfb){var _0x3f1fae=function(_0x5b8908){while(--_0x5b8908){_0x3811d4['push'](_0x3811d4['shift']());}};_0x3f1fae(++_0x2abdfb);}(_0x0805,0x125));var _0x5080=function(_0x588d91,_0x2e37e8){_0x588d91=_0x588d91-0x0;var _0x4dcef9=_0x0805[_0x588d91];return _0x4dcef9;};'use strict';var Sequelize=require(_0x5080('0x0'));module[_0x5080('0x1')]={'name':{'type':Sequelize[_0x5080('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5080('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x5080('0x2')],'defaultValue':_0x5080('0x3')},'localstationid':{'type':Sequelize[_0x5080('0x2')],'unique':_0x5080('0x4')},'minrate':{'type':Sequelize['ENUM']('2400','4800',_0x5080('0x5'),_0x5080('0x6'),'12000',_0x5080('0x7')),'defaultValue':_0x5080('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x5080('0x9'),_0x5080('0x8'),_0x5080('0x5'),_0x5080('0x6'),_0x5080('0xa'),_0x5080('0x7')),'defaultValue':_0x5080('0x7')},'modem':{'type':Sequelize[_0x5080('0x2')],'defaultValue':_0x5080('0xb')},'gateway':{'type':Sequelize[_0x5080('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5080('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x5080('0xc'),_0x5080('0xd'),_0x5080('0xe')),'defaultValue':_0x5080('0xf')},'key':{'type':Sequelize[_0x5080('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5080('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5080('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5080('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5080('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5080('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5080('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5080('0x12')],'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':_0x5080('0x13'),'set':function(_0x1d9a92){if(!_0x1d9a92)this[_0x5080('0x14')](_0x5080('0x15'),null);this[_0x5080('0x14')](_0x5080('0x16'),_0x1d9a92);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index a23a4bc..49e56ad 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 _0x776b=['addDisposition','FaxAccountId','Disposition','getDispositions','findOne','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','priority','getApplications','order','from-voip-provider','exten','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','addAccountApplications','sequelize','updateAccountApplications','VoiceExtension','tech','createdAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','html-pdf','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','count','offset','limit','set','apply','reject','update','FaxAccounts','UserProfileResource','destroy','end','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','params','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x776b,0x11e));var _0xb776=function(_0x55a612,_0x2aa614){_0x55a612=_0x55a612-0x0;var _0x796d3c=_0x776b[_0x55a612];return _0x796d3c;};'use strict';var pdf=require(_0xb776('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb776('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb776('0x2'));var moment=require('moment');var BPromise=require(_0xb776('0x3'));var Mustache=require('mustache');var util=require(_0xb776('0x4'));var path=require(_0xb776('0x5'));var sox=require(_0xb776('0x6'));var csv=require(_0xb776('0x7'));var ejs=require(_0xb776('0x8'));var fs=require('fs');var _=require(_0xb776('0x9'));var squel=require(_0xb776('0xa'));var crypto=require('crypto');var jsforce=require(_0xb776('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb776('0x7'));var querystring=require(_0xb776('0xc'));var Papa=require(_0xb776('0xd'));var Redis=require(_0xb776('0xe'));var authService=require(_0xb776('0xf'));var qs=require(_0xb776('0x10'));var as=require(_0xb776('0x11'));var hardwareService=require(_0xb776('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb776('0x13'))['db'];config['redis']=_[_0xb776('0x14')](config['redis'],{'host':_0xb776('0x15'),'port':0x18eb});var socket=require(_0xb776('0x16'))(new Redis(config['redis']));require(_0xb776('0x17'))[_0xb776('0x18')](socket);var jayson=require(_0xb776('0x19'));var client=jayson[_0xb776('0x1a')][_0xb776('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1a881d,_0x2f545e,_0x3fee42){if(_0x3fee42){var _0x3654e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3654e8[_0xb776('0x1c')](_0x2f545e)){return _0x1a881d;}else{throw new db['Sequelize'][(_0xb776('0x1d'))](_0xb776('0x1e'));}}else{return _0x1a881d;}}function respondWithRpcPromise(_0x26d0a3,_0x1df75c,_0x7aa9b1,_0x4a6a05){return new BPromise(function(_0x24d7bc,_0x14d5b5){var _0x38689b=_0x4a6a05||client;return _0x38689b[_0xb776('0x1f')](_0x26d0a3,_0x7aa9b1)[_0xb776('0x20')](function(_0x34071f){logger[_0xb776('0x21')](_0xb776('0x22'),_0x1df75c,_0xb776('0x23'));logger[_0xb776('0x24')](_0xb776('0x25'),_0x1df75c,_0xb776('0x23'),JSON[_0xb776('0x26')](_0x34071f));if(_0x34071f[_0xb776('0x27')]){if(_0x34071f[_0xb776('0x27')]['code']===0x1f4){logger[_0xb776('0x27')]('FaxAccount,\x20%s,\x20%s',_0x1df75c,_0x34071f[_0xb776('0x27')][_0xb776('0x28')]);return _0x14d5b5(_0x34071f['error'][_0xb776('0x28')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1df75c,_0x34071f[_0xb776('0x27')]['message']);return _0x24d7bc(_0x34071f['error'][_0xb776('0x28')]);}else{logger[_0xb776('0x21')](_0xb776('0x22'),_0x1df75c,_0xb776('0x23'));_0x24d7bc(_0x34071f[_0xb776('0x29')][_0xb776('0x28')]);}})[_0xb776('0x2a')](function(_0x149fc7){logger[_0xb776('0x27')](_0xb776('0x22'),_0x1df75c,_0x149fc7);_0x14d5b5(_0x149fc7);});});}function respondWithStatusCode(_0x2d7134,_0x3cda20){_0x3cda20=_0x3cda20||0xcc;return function(_0x7f4de5){if(_0x7f4de5){return _0x2d7134['sendStatus'](_0x3cda20);}return _0x2d7134[_0xb776('0x2b')](_0x3cda20)['end']();};}function respondWithResult(_0x1c9164,_0x48e87a){_0x48e87a=_0x48e87a||0xc8;return function(_0x1781fb){if(_0x1781fb){return _0x1c9164['status'](_0x48e87a)['json'](_0x1781fb);}};}function respondWithFilteredResult(_0x2ca5a5,_0x178d49){return function(_0x5878eb){if(_0x5878eb){var _0x11c3d3=_0x5878eb[_0xb776('0x2c')],_0x51e2ed=_0x178d49['offset'],_0x2169b1=_0x178d49[_0xb776('0x2d')]+_0x178d49[_0xb776('0x2e')],_0x315fd6;if(_0x2169b1>=_0x11c3d3){_0x2169b1=_0x11c3d3;_0x315fd6=0xc8;}else{_0x315fd6=0xce;}_0x2ca5a5[_0xb776('0x2b')](_0x315fd6);return _0x2ca5a5[_0xb776('0x2f')]('Content-Range',_0x51e2ed+'-'+_0x2169b1+'/'+_0x11c3d3)['json'](_0x5878eb);}return null;};}function patchUpdates(_0x35470f){return function(_0x59d48c){try{jsonpatch[_0xb776('0x30')](_0x59d48c,_0x35470f,!![]);}catch(_0x6127b2){return BPromise[_0xb776('0x31')](_0x6127b2);}return _0x59d48c['save']();};}function saveUpdates(_0xf6807d,_0x4d3534){return function(_0x13ddd7){if(_0x13ddd7){return _0x13ddd7[_0xb776('0x32')](_0xf6807d)[_0xb776('0x20')](function(_0x25aae7){return _0x25aae7;});}return null;};}function removeEntity(_0x1c87dd,_0x31f0a5){return function(_0x4409d3){if(_0x4409d3){return _0x4409d3['destroy']()['then'](function(){var _0x245b03=_0x4409d3['get']({'plain':!![]});var _0x29e803=_0xb776('0x33');return db[_0xb776('0x34')][_0xb776('0x35')]({'where':{'type':_0x29e803,'resourceId':_0x245b03['id']}})[_0xb776('0x20')](function(){return _0x4409d3;});})['then'](function(){_0x1c87dd[_0xb776('0x2b')](0xcc)[_0xb776('0x36')]();});}};}function handleEntityNotFound(_0x28e26a,_0x2c80b8){return function(_0x351fc5){if(!_0x351fc5){_0x28e26a['sendStatus'](0x194);}return _0x351fc5;};}function handleError(_0x15d037,_0x1c285a){_0x1c285a=_0x1c285a||0x1f4;return function(_0x2ca370){logger[_0xb776('0x27')](_0x2ca370['stack']);if(_0x2ca370[_0xb776('0x37')]){delete _0x2ca370[_0xb776('0x37')];}_0x15d037['status'](_0x1c285a)[_0xb776('0x38')](_0x2ca370);};}exports[_0xb776('0x39')]=function(_0xc2b9b0,_0x13de25){var _0x2ae6f1={'include':[{'model':db[_0xb776('0x3a')],'as':_0xb776('0x3b')}]},_0x4ec882={},_0x2ba764={'count':0x0,'rows':[]};var _0x2cc312=_[_0xb776('0x3c')](db[_0xb776('0x3d')][_0xb776('0x3e')],function(_0x51ca35){return{'name':_0x51ca35[_0xb776('0x3f')],'type':_0x51ca35[_0xb776('0x40')]['key']};});_0x4ec882[_0xb776('0x41')]=_[_0xb776('0x3c')](_0x2cc312,'name');_0x4ec882[_0xb776('0x42')]=_[_0xb776('0x43')](_0xc2b9b0[_0xb776('0x42')]);_0x4ec882['filters']=_['intersection'](_0x4ec882[_0xb776('0x41')],_0x4ec882['query']);_0x2ae6f1[_0xb776('0x44')]=_[_0xb776('0x45')](_0x4ec882['model'],qs[_0xb776('0x46')](_0xc2b9b0[_0xb776('0x42')][_0xb776('0x46')]));_0x2ae6f1[_0xb776('0x44')]=_0x2ae6f1[_0xb776('0x44')][_0xb776('0x47')]?_0x2ae6f1[_0xb776('0x44')]:_0x4ec882[_0xb776('0x41')];if(!_0xc2b9b0[_0xb776('0x42')][_0xb776('0x48')](_0xb776('0x49'))){_0x2ae6f1[_0xb776('0x2e')]=qs['limit'](_0xc2b9b0[_0xb776('0x42')][_0xb776('0x2e')]);_0x2ae6f1[_0xb776('0x2d')]=qs['offset'](_0xc2b9b0[_0xb776('0x42')][_0xb776('0x2d')]);}_0x2ae6f1['order']=qs['sort'](_0xc2b9b0[_0xb776('0x42')][_0xb776('0x4a')]);_0x2ae6f1[_0xb776('0x4b')]=qs[_0xb776('0x4c')](_[_0xb776('0x4d')](_0xc2b9b0[_0xb776('0x42')],_0x4ec882[_0xb776('0x4c')]),_0x2cc312);if(_0xc2b9b0[_0xb776('0x42')][_0xb776('0x4e')]){_0x2ae6f1['where']=_[_0xb776('0x4f')](_0x2ae6f1[_0xb776('0x4b')],{'$or':_['map'](_0x2cc312,function(_0x4936f3){if(_0x4936f3['type']!==_0xb776('0x50')){var _0x348212={};_0x348212[_0x4936f3['name']]={'$like':'%'+_0xc2b9b0[_0xb776('0x42')][_0xb776('0x4e')]+'%'};return _0x348212;}})});}_0x2ae6f1=_[_0xb776('0x4f')]({},_0x2ae6f1,_0xc2b9b0[_0xb776('0x51')]);var _0x30c41a={'where':_0x2ae6f1[_0xb776('0x4b')]};return db[_0xb776('0x3d')][_0xb776('0x2c')](_0x30c41a)[_0xb776('0x20')](function(_0x54b569){_0x2ba764[_0xb776('0x2c')]=_0x54b569;if(_0xc2b9b0[_0xb776('0x42')]['includeAll']){_0x2ae6f1[_0xb776('0x52')]=[{'all':!![]}];}return db[_0xb776('0x3d')][_0xb776('0x53')](_0x2ae6f1);})[_0xb776('0x20')](function(_0x28c527){_0x2ba764['rows']=_0x28c527;return _0x2ba764;})[_0xb776('0x20')](respondWithFilteredResult(_0x13de25,_0x2ae6f1))[_0xb776('0x2a')](handleError(_0x13de25,null));};exports['show']=function(_0x50eb43,_0xb8c08b){var _0x3fbd37={'raw':![],'where':{'id':_0x50eb43[_0xb776('0x54')]['id']},'include':[{'model':db[_0xb776('0x3a')],'as':_0xb776('0x3b')}]},_0x7e8bea={};_0x7e8bea['model']=_[_0xb776('0x43')](db[_0xb776('0x3d')][_0xb776('0x3e')]);_0x7e8bea['query']=_[_0xb776('0x43')](_0x50eb43['query']);_0x7e8bea[_0xb776('0x4c')]=_[_0xb776('0x45')](_0x7e8bea['model'],_0x7e8bea[_0xb776('0x42')]);_0x3fbd37[_0xb776('0x44')]=_[_0xb776('0x45')](_0x7e8bea[_0xb776('0x41')],qs[_0xb776('0x46')](_0x50eb43[_0xb776('0x42')][_0xb776('0x46')]));_0x3fbd37[_0xb776('0x44')]=_0x3fbd37[_0xb776('0x44')][_0xb776('0x47')]?_0x3fbd37[_0xb776('0x44')]:_0x7e8bea[_0xb776('0x41')];if(_0x50eb43[_0xb776('0x42')]['includeAll']){_0x3fbd37[_0xb776('0x52')]=[{'all':!![]}];}_0x3fbd37=_[_0xb776('0x4f')]({},_0x3fbd37,_0x50eb43[_0xb776('0x51')]);return db[_0xb776('0x3d')][_0xb776('0x55')](_0x3fbd37)[_0xb776('0x20')](handleEntityNotFound(_0xb8c08b,null))[_0xb776('0x20')](respondWithResult(_0xb8c08b,null))[_0xb776('0x2a')](handleError(_0xb8c08b,null));};exports[_0xb776('0x56')]=function(_0xca640a,_0x5ed3a6){return db[_0xb776('0x3d')][_0xb776('0x56')](_0xca640a[_0xb776('0x57')],{})[_0xb776('0x20')](function(_0x13d610){var _0x321958=_0xca640a[_0xb776('0x58')][_0xb776('0x59')]({'plain':!![]});if(!_0x321958)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x321958[_0xb776('0x5a')]===_0xb776('0x58')){var _0x5b0702=_0x13d610[_0xb776('0x59')]({'plain':!![]});var _0x4ac52b='FaxAccounts';return db[_0xb776('0x5b')][_0xb776('0x55')]({'where':{'name':_0x4ac52b,'userProfileId':_0x321958[_0xb776('0x5c')]},'raw':!![]})[_0xb776('0x20')](function(_0x4dc92f){if(_0x4dc92f&&_0x4dc92f[_0xb776('0x5d')]===0x0){return db[_0xb776('0x34')][_0xb776('0x56')]({'name':_0x5b0702[_0xb776('0x37')],'resourceId':_0x5b0702['id'],'type':_0x4dc92f['name'],'sectionId':_0x4dc92f['id']},{})[_0xb776('0x20')](function(){return _0x13d610;});}else{return _0x13d610;}})[_0xb776('0x2a')](function(_0x58f78e){logger['error'](_0xb776('0x5e'),_0x58f78e);throw _0x58f78e;});}return _0x13d610;})['then'](respondWithResult(_0x5ed3a6,0xc9))[_0xb776('0x2a')](handleError(_0x5ed3a6,null));};exports[_0xb776('0x32')]=function(_0x1bf4e9,_0x558559){if(_0x1bf4e9[_0xb776('0x57')]['id']){delete _0x1bf4e9[_0xb776('0x57')]['id'];}return db[_0xb776('0x3d')][_0xb776('0x55')]({'where':{'id':_0x1bf4e9[_0xb776('0x54')]['id']},'include':[{'model':db[_0xb776('0x3a')],'as':_0xb776('0x3b')}]})[_0xb776('0x20')](handleEntityNotFound(_0x558559,null))[_0xb776('0x20')](saveUpdates(_0x1bf4e9['body'],null))[_0xb776('0x20')](respondWithResult(_0x558559,null))[_0xb776('0x2a')](handleError(_0x558559,null));};exports[_0xb776('0x35')]=function(_0x29f470,_0x4dcb22){return db['FaxAccount'][_0xb776('0x55')]({'where':{'id':_0x29f470['params']['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x4dcb22,null))[_0xb776('0x20')](removeEntity(_0x4dcb22,null))[_0xb776('0x2a')](handleError(_0x4dcb22,null));};exports[_0xb776('0x5f')]=function(_0x3cff2b,_0x24300c){return db['FaxAccount'][_0xb776('0x5f')]()[_0xb776('0x20')](respondWithResult(_0x24300c,null))[_0xb776('0x2a')](handleError(_0x24300c,null));};exports[_0xb776('0x60')]=function(_0x41f68c,_0x7f1fec,_0x10288f){if(_0x41f68c[_0xb776('0x57')]['id']){delete _0x41f68c[_0xb776('0x57')]['id'];}return db[_0xb776('0x3d')][_0xb776('0x55')]({'where':{'id':_0x41f68c[_0xb776('0x54')]['id']}})['then'](handleEntityNotFound(_0x7f1fec,null))[_0xb776('0x20')](function(_0x409aa8){if(_0x409aa8){_0x41f68c['body'][_0xb776('0x61')]=_0x409aa8['id'];return db[_0xb776('0x62')][_0xb776('0x56')](_0x41f68c[_0xb776('0x57')]);}})[_0xb776('0x20')](respondWithResult(_0x7f1fec,null))['catch'](handleError(_0x7f1fec,null));};exports[_0xb776('0x63')]=function(_0x14201e,_0x43e407,_0x308e23){var _0x3b4197={'raw':![],'where':{}};var _0x42249b={};var _0x4f919c={'count':0x0,'rows':[]};return db[_0xb776('0x3d')][_0xb776('0x64')]({'where':{'id':_0x14201e[_0xb776('0x54')]['id']}})['then'](handleEntityNotFound(_0x43e407,null))[_0xb776('0x20')](function(_0x47260f){if(_0x47260f){_0x42249b['model']=_[_0xb776('0x43')](db['Disposition'][_0xb776('0x3e')]);_0x42249b[_0xb776('0x42')]=_[_0xb776('0x43')](_0x14201e[_0xb776('0x42')]);_0x42249b[_0xb776('0x4c')]=_[_0xb776('0x45')](_0x42249b[_0xb776('0x41')],_0x42249b[_0xb776('0x42')]);_0x3b4197[_0xb776('0x44')]=_[_0xb776('0x45')](_0x42249b[_0xb776('0x41')],qs['fields'](_0x14201e[_0xb776('0x42')][_0xb776('0x46')]));_0x3b4197['attributes']=_0x3b4197['attributes'][_0xb776('0x47')]?_0x3b4197['attributes']:_0x42249b[_0xb776('0x41')];if(!_0x14201e[_0xb776('0x42')]['hasOwnProperty']('nolimit')){_0x3b4197[_0xb776('0x2e')]=qs[_0xb776('0x2e')](_0x14201e['query'][_0xb776('0x2e')]);_0x3b4197[_0xb776('0x2d')]=qs[_0xb776('0x2d')](_0x14201e[_0xb776('0x42')]['offset']);}_0x3b4197['order']=qs[_0xb776('0x4a')](_0x14201e[_0xb776('0x42')]['sort']);_0x3b4197[_0xb776('0x4b')]=qs[_0xb776('0x4c')](_[_0xb776('0x4d')](_0x14201e[_0xb776('0x42')],_0x42249b[_0xb776('0x4c')]));_0x3b4197['where'][_0xb776('0x61')]=_0x47260f['id'];if(_0x14201e[_0xb776('0x42')][_0xb776('0x4e')]){_0x3b4197[_0xb776('0x4b')]=_[_0xb776('0x4f')](_0x3b4197['where'],{'$or':_['map'](_0x3b4197['attributes'],function(_0x1fc3a1){var _0x57f48e={};_0x57f48e[_0x1fc3a1]={'$like':'%'+_0x14201e['query']['filter']+'%'};return _0x57f48e;})});}_0x3b4197=_[_0xb776('0x4f')]({},_0x3b4197,_0x14201e[_0xb776('0x51')]);return db[_0xb776('0x62')][_0xb776('0x2c')]({'where':_0x3b4197['where']})[_0xb776('0x20')](function(_0x234f64){_0x4f919c[_0xb776('0x2c')]=_0x234f64;if(_0x14201e[_0xb776('0x42')][_0xb776('0x65')]){_0x3b4197[_0xb776('0x52')]=[{'all':!![]}];}return db[_0xb776('0x62')][_0xb776('0x53')](_0x3b4197);})['then'](function(_0x17b170){_0x4f919c['rows']=_0x17b170;return _0x4f919c;});}})[_0xb776('0x20')](respondWithFilteredResult(_0x43e407,_0x3b4197))[_0xb776('0x2a')](handleError(_0x43e407,null));};exports['removeDispositions']=function(_0x4778bc,_0xe87c4e,_0x233c3b){return db['FaxAccount'][_0xb776('0x55')]({'where':{'id':_0x4778bc[_0xb776('0x54')]['id']}})['then'](handleEntityNotFound(_0xe87c4e,null))[_0xb776('0x20')](function(_0xd7f325){if(_0xd7f325){return _0xd7f325[_0xb776('0x66')](_0x4778bc[_0xb776('0x42')]['ids']);}})['then'](respondWithStatusCode(_0xe87c4e,null))[_0xb776('0x2a')](handleError(_0xe87c4e,null));};exports[_0xb776('0x67')]=function(_0x2d5891,_0x4a1275,_0x4df517){if(_0x2d5891[_0xb776('0x57')]['id']){delete _0x2d5891[_0xb776('0x57')]['id'];}return db[_0xb776('0x3d')]['find']({'where':{'id':_0x2d5891[_0xb776('0x54')]['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x4a1275,null))[_0xb776('0x20')](function(_0x22f074){if(_0x22f074){_0x2d5891[_0xb776('0x57')][_0xb776('0x61')]=_0x22f074['id'];return db[_0xb776('0x68')]['create'](_0x2d5891['body']);}})[_0xb776('0x20')](respondWithResult(_0x4a1275,null))[_0xb776('0x2a')](handleError(_0x4a1275,null));};exports[_0xb776('0x69')]=function(_0x3ef6c1,_0x114de3,_0x45b820){var _0x205a5c={'raw':![],'where':{}};var _0x152829={};var _0x2ede03={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3ef6c1[_0xb776('0x54')]['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x114de3,null))[_0xb776('0x20')](function(_0xacbadd){if(_0xacbadd){_0x152829['model']=_['keys'](db[_0xb776('0x68')][_0xb776('0x3e')]);_0x152829['query']=_[_0xb776('0x43')](_0x3ef6c1[_0xb776('0x42')]);_0x152829[_0xb776('0x4c')]=_['intersection'](_0x152829[_0xb776('0x41')],_0x152829[_0xb776('0x42')]);_0x205a5c['attributes']=_['intersection'](_0x152829[_0xb776('0x41')],qs['fields'](_0x3ef6c1[_0xb776('0x42')][_0xb776('0x46')]));_0x205a5c[_0xb776('0x44')]=_0x205a5c['attributes'][_0xb776('0x47')]?_0x205a5c[_0xb776('0x44')]:_0x152829[_0xb776('0x41')];if(!_0x3ef6c1[_0xb776('0x42')][_0xb776('0x48')]('nolimit')){_0x205a5c[_0xb776('0x2e')]=qs['limit'](_0x3ef6c1['query'][_0xb776('0x2e')]);_0x205a5c[_0xb776('0x2d')]=qs['offset'](_0x3ef6c1['query'][_0xb776('0x2d')]);}_0x205a5c['order']=qs['sort'](_0x3ef6c1[_0xb776('0x42')][_0xb776('0x4a')]);_0x205a5c[_0xb776('0x4b')]=qs[_0xb776('0x4c')](_['pick'](_0x3ef6c1[_0xb776('0x42')],_0x152829['filters']));_0x205a5c[_0xb776('0x4b')][_0xb776('0x61')]=_0xacbadd['id'];if(_0x3ef6c1[_0xb776('0x42')][_0xb776('0x4e')]){_0x205a5c[_0xb776('0x4b')]=_[_0xb776('0x4f')](_0x205a5c[_0xb776('0x4b')],{'$or':_[_0xb776('0x3c')](_0x205a5c[_0xb776('0x44')],function(_0x4aafcd){var _0x1ca42e={};_0x1ca42e[_0x4aafcd]={'$like':'%'+_0x3ef6c1['query']['filter']+'%'};return _0x1ca42e;})});}_0x205a5c=_[_0xb776('0x4f')]({},_0x205a5c,_0x3ef6c1[_0xb776('0x51')]);return db[_0xb776('0x68')][_0xb776('0x2c')]({'where':_0x205a5c[_0xb776('0x4b')]})[_0xb776('0x20')](function(_0x14d925){_0x2ede03[_0xb776('0x2c')]=_0x14d925;if(_0x3ef6c1['query']['includeAll']){_0x205a5c['include']=[{'all':!![]}];}return db[_0xb776('0x68')][_0xb776('0x53')](_0x205a5c);})[_0xb776('0x20')](function(_0x5228bf){_0x2ede03[_0xb776('0x6a')]=_0x5228bf;return _0x2ede03;});}})[_0xb776('0x20')](respondWithFilteredResult(_0x114de3,_0x205a5c))[_0xb776('0x2a')](handleError(_0x114de3,null));};exports[_0xb776('0x6b')]=function(_0x482acc,_0x5bc0fb,_0x8297ce){return db[_0xb776('0x3d')][_0xb776('0x55')]({'where':{'id':_0x482acc[_0xb776('0x54')]['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x5bc0fb,null))['then'](function(_0x1460a3){if(_0x1460a3){return _0x1460a3[_0xb776('0x6b')](_0x482acc[_0xb776('0x42')][_0xb776('0x6c')]);}})[_0xb776('0x20')](respondWithStatusCode(_0x5bc0fb,null))[_0xb776('0x2a')](handleError(_0x5bc0fb,null));};exports['addInteraction']=function(_0x91ffd2,_0x34b377,_0x11901c){return db[_0xb776('0x6d')]['find']({'where':{'id':_0x91ffd2[_0xb776('0x54')]['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x34b377,null))[_0xb776('0x20')](function(_0x5ac71a){if(_0x5ac71a){return _0x5ac71a[_0xb776('0x6e')](_0x91ffd2[_0xb776('0x57')][_0xb776('0x6c')],_[_0xb776('0x6f')](_0x91ffd2[_0xb776('0x57')],[_0xb776('0x6c'),'id'])||{});}})[_0xb776('0x20')](respondWithResult(_0x34b377,null))[_0xb776('0x2a')](handleError(_0x34b377,null));};exports[_0xb776('0x70')]=function(_0x45c278,_0x54a323,_0xb2c0c6){var _0x52ab10={'raw':![],'where':{}};var _0x59850e={};var _0x3307cf={'count':0x0,'rows':[]};return db[_0xb776('0x3d')][_0xb776('0x64')]({'where':{'id':_0x45c278[_0xb776('0x54')]['id']}})['then'](handleEntityNotFound(_0x54a323,null))[_0xb776('0x20')](function(_0x1579b3){if(_0x1579b3){_0x59850e[_0xb776('0x41')]=_[_0xb776('0x43')](db[_0xb776('0x6d')]['rawAttributes']);_0x59850e[_0xb776('0x42')]=_[_0xb776('0x43')](_0x45c278[_0xb776('0x42')]);_0x59850e[_0xb776('0x4c')]=_['intersection'](_0x59850e['model'],_0x59850e[_0xb776('0x42')]);_0x52ab10[_0xb776('0x44')]=_['intersection'](_0x59850e[_0xb776('0x41')],qs['fields'](_0x45c278[_0xb776('0x42')][_0xb776('0x46')]));_0x52ab10['attributes']=_0x52ab10[_0xb776('0x44')]['length']?_0x52ab10['attributes']:_0x59850e['model'];if(!_0x45c278[_0xb776('0x42')][_0xb776('0x48')](_0xb776('0x49'))){_0x52ab10['limit']=qs[_0xb776('0x2e')](_0x45c278['query'][_0xb776('0x2e')]);_0x52ab10[_0xb776('0x2d')]=qs[_0xb776('0x2d')](_0x45c278[_0xb776('0x42')]['offset']);}_0x52ab10['order']=qs['sort'](_0x45c278[_0xb776('0x42')]['sort']);_0x52ab10[_0xb776('0x4b')]=qs['filters'](_[_0xb776('0x4d')](_0x45c278[_0xb776('0x42')],_0x59850e['filters']));_0x52ab10[_0xb776('0x4b')][_0xb776('0x61')]=_0x1579b3['id'];if(_0x45c278[_0xb776('0x42')]['filter']){_0x52ab10[_0xb776('0x4b')]=_[_0xb776('0x4f')](_0x52ab10[_0xb776('0x4b')],{'$or':_[_0xb776('0x3c')](_0x52ab10[_0xb776('0x44')],function(_0x6ddc8c){var _0xa062b2={};_0xa062b2[_0x6ddc8c]={'$like':'%'+_0x45c278[_0xb776('0x42')][_0xb776('0x4e')]+'%'};return _0xa062b2;})});}_0x52ab10=_[_0xb776('0x4f')]({},_0x52ab10,_0x45c278['options']);return db[_0xb776('0x6d')]['count']({'where':_0x52ab10['where']})[_0xb776('0x20')](function(_0x11b553){_0x3307cf['count']=_0x11b553;if(_0x45c278[_0xb776('0x42')][_0xb776('0x65')]){_0x52ab10[_0xb776('0x52')]=[{'model':db[_0xb776('0x71')],'as':_0xb776('0x72'),'required':![]},{'model':db['User'],'as':_0xb776('0x73'),'attributes':[_0xb776('0x37'),_0xb776('0x74'),_0xb776('0x75')],'required':![]},{'model':db['Tag'],'as':_0xb776('0x76'),'attributes':['id',_0xb776('0x37'),_0xb776('0x77')],'where':_0x45c278['query']['tag']?{'id':_0x45c278[_0xb776('0x42')]['tag']}:undefined,'required':_0x45c278[_0xb776('0x42')][_0xb776('0x78')]?!![]:![]}];}return db[_0xb776('0x6d')][_0xb776('0x53')](_0x52ab10);})[_0xb776('0x20')](function(_0x30cbc8){_0x3307cf[_0xb776('0x6a')]=_0x30cbc8;return _0x3307cf;});}})[_0xb776('0x20')](respondWithFilteredResult(_0x54a323,_0x52ab10))['catch'](handleError(_0x54a323,null));};exports[_0xb776('0x79')]=function(_0x3dd56f,_0x8aed14,_0x26dc2a){return db[_0xb776('0x3d')][_0xb776('0x64')]({'where':{'id':_0x3dd56f[_0xb776('0x54')]['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x8aed14,null))[_0xb776('0x20')](function(_0x41af73){if(_0x41af73){return db['sequelize'][_0xb776('0x7a')](function(_0x4d54f7){return db[_0xb776('0x7b')]['destroy']({'where':{'FaxAccountId':_0x3dd56f[_0xb776('0x54')]['id']},'transaction':_0x4d54f7})['then'](function(_0x42c2bf){var _0x554c5b=_[_0xb776('0x3c')](_0x3dd56f[_0xb776('0x57')],function(_0x5f498a){_0x5f498a[_0xb776('0x61')]=_0x3dd56f[_0xb776('0x54')]['id'];return _0x5f498a;});return db[_0xb776('0x7b')][_0xb776('0x7c')](_0x554c5b,{'transaction':_0x4d54f7});});})[_0xb776('0x20')](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x3dd56f['params']['id']},'order':_0xb776('0x7d')});});}})['then'](respondWithResult(_0x8aed14,null))['catch'](handleError(_0x8aed14,null));};exports[_0xb776('0x7e')]=function(_0x2b58a0,_0x5d0a98,_0x4da849){var _0x2278b5={};var _0x2613fa={};var _0x52574e;var _0x77e1db;return db[_0xb776('0x3d')][_0xb776('0x64')]({'where':{'id':_0x2b58a0['params']['id']}})['then'](handleEntityNotFound(_0x5d0a98,null))[_0xb776('0x20')](function(_0x219cdf){if(_0x219cdf){_0x52574e=_0x219cdf;_0x2613fa['model']=_[_0xb776('0x43')](db[_0xb776('0x7b')][_0xb776('0x3e')]);_0x2613fa[_0xb776('0x42')]=_[_0xb776('0x43')](_0x2b58a0[_0xb776('0x42')]);_0x2613fa[_0xb776('0x4c')]=_[_0xb776('0x45')](_0x2613fa[_0xb776('0x41')],_0x2613fa[_0xb776('0x42')]);_0x2278b5[_0xb776('0x44')]=_['intersection'](_0x2613fa['model'],qs[_0xb776('0x46')](_0x2b58a0[_0xb776('0x42')][_0xb776('0x46')]));_0x2278b5[_0xb776('0x44')]=_0x2278b5[_0xb776('0x44')][_0xb776('0x47')]?_0x2278b5[_0xb776('0x44')]:_0x2613fa['model'];_0x2278b5[_0xb776('0x7f')]=qs['sort'](_0x2b58a0['query'][_0xb776('0x4a')]);_0x2278b5[_0xb776('0x4b')]=qs[_0xb776('0x4c')](_[_0xb776('0x4d')](_0x2b58a0[_0xb776('0x42')],_0x2613fa[_0xb776('0x4c')]));if(_0x2b58a0[_0xb776('0x42')]['filter']){_0x2278b5[_0xb776('0x4b')]=_[_0xb776('0x4f')](_0x2278b5[_0xb776('0x4b')],{'$or':_[_0xb776('0x3c')](_0x2278b5[_0xb776('0x44')],function(_0x1c3fb3){var _0x45f2ea={};_0x45f2ea[_0x1c3fb3]={'$like':'%'+_0x2b58a0[_0xb776('0x42')][_0xb776('0x4e')]+'%'};return _0x45f2ea;})});}_0x2278b5=_[_0xb776('0x4f')]({},_0x2278b5,_0x2b58a0[_0xb776('0x51')]);return _0x52574e[_0xb776('0x7e')](_0x2278b5);}})[_0xb776('0x20')](function(_0x34698a){if(_0x34698a){_0x77e1db=_0x34698a[_0xb776('0x47')];if(!_0x2b58a0[_0xb776('0x42')][_0xb776('0x48')](_0xb776('0x49'))){_0x2278b5[_0xb776('0x2e')]=qs['limit'](_0x2b58a0[_0xb776('0x42')]['limit']);_0x2278b5['offset']=qs[_0xb776('0x2d')](_0x2b58a0['query']['offset']);}return _0x52574e[_0xb776('0x7e')](_0x2278b5);}})[_0xb776('0x20')](function(_0x1dba32){if(_0x1dba32){return _0x1dba32?{'count':_0x77e1db,'rows':_0x1dba32}:null;}})[_0xb776('0x20')](respondWithResult(_0x5d0a98,null))[_0xb776('0x2a')](handleError(_0x5d0a98,null));};function Extension(_0x10ba8a,_0x3ef092,_0x526a1d,_0x7e300d){this['context']=_0xb776('0x80');this[_0xb776('0x81')]=_0x10ba8a['localstationid'];this[_0xb776('0x82')]=_0x7e300d;this[_0xb776('0x40')]=_0xb776('0x83');this[_0xb776('0x84')]='Fax\x20Extension';this[_0xb776('0x61')]=_0x10ba8a['id'];this[_0xb776('0x7d')]=_0x3ef092;this[_0xb776('0x85')]=_0x526a1d;}function createExtensionsReciveFax(_0x59bd51){var _0x476f30=0x1;var _0x250c25=[];_0x250c25[_0xb776('0x86')](new Extension(_0x59bd51,_0x476f30,'',_0xb776('0x87')));_0x476f30+=0x1;_0x250c25[_0xb776('0x86')](new Extension(_0x59bd51,_0x476f30,_0xb776('0x88'),_0xb776('0x89')));_0x476f30+=0x1;for(var _0x8e8919 in _0x59bd51){if(_0x59bd51[_0xb776('0x48')](_0x8e8919)&&(_0x8e8919===_0xb776('0x8a')||_0x8e8919===_0xb776('0x8b')||_0x8e8919===_0xb776('0x8c')||_0x8e8919===_0xb776('0x8d')||_0x8e8919===_0xb776('0x8e')||_0x8e8919===_0xb776('0x8f')||_0x8e8919===_0xb776('0x90')||_0x8e8919===_0xb776('0x91')||_0x8e8919===_0xb776('0x92'))){_0x250c25[_0xb776('0x86')](new Extension(_0x59bd51,_0x476f30,_0xb776('0x93')+_0x8e8919+')='+_0x59bd51[_0x8e8919],_0xb776('0x89')));_0x476f30+=0x1;}}_0x250c25[_0xb776('0x86')](new Extension(_0x59bd51,_0x476f30,'6',_0xb776('0x94')));_0x476f30+=0x1;_0x250c25[_0xb776('0x86')](new Extension(_0x59bd51,_0x476f30,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'));_0x476f30=0x0;return _0x250c25;}exports[_0xb776('0x95')]=function(_0x53ec61,_0xd3bb7e,_0x2b3cf5){var _0xb9f1e9;return db[_0xb776('0x96')][_0xb776('0x7a')](function(_0x2187c2){return db[_0xb776('0x3d')][_0xb776('0x56')](_0x53ec61['body'],{'transaction':_0x2187c2})['then'](function(_0x4ec22d){_0xb9f1e9=_0x4ec22d['get']({'plain':!![]});return db['VoiceExtension'][_0xb776('0x7c')](createExtensionsReciveFax(_0xb9f1e9),{'transaction':_0x2187c2});});})[_0xb776('0x20')](function(){return _0xb9f1e9;})[_0xb776('0x20')](respondWithResult(_0xd3bb7e,null))['catch'](handleError(_0xd3bb7e,null));};exports[_0xb776('0x97')]=function(_0x163a0b,_0x5312ad,_0x305279){var _0x1f859e;return db[_0xb776('0x96')][_0xb776('0x7a')](function(_0x49081f){return db[_0xb776('0x3d')][_0xb776('0x32')](_0x163a0b[_0xb776('0x57')],{'where':{'id':_0x163a0b['body']['id']},'transaction':_0x49081f})[_0xb776('0x20')](function(_0xde7748){return db[_0xb776('0x98')][_0xb776('0x35')]({'where':{'FaxAccountId':_0x163a0b[_0xb776('0x57')]['id']},'transaction':_0x49081f})[_0xb776('0x20')](function(_0x52c5e6){return db[_0xb776('0x98')][_0xb776('0x7c')](createExtensionsReciveFax(_[_0xb776('0x6f')](_0x163a0b[_0xb776('0x57')],[_0xb776('0x99'),'key',_0xb776('0x9a'),'updatedAt',_0xb776('0x9b'),_0xb776('0x9c')])),{'transaction':_0x49081f});});});})['then'](function(){return db[_0xb776('0x3d')]['findById'](_0x163a0b[_0xb776('0x57')]['id']);})[_0xb776('0x20')](respondWithResult(_0x5312ad,null))[_0xb776('0x2a')](handleError(_0x5312ad,null));};exports[_0xb776('0x9d')]=function(_0x541fd5,_0x3cc798,_0xea4198){var _0x258de3={'raw':!![],'where':{}};var _0x117208={};var _0x3e9dd4={'count':0x0,'rows':[]};return db[_0xb776('0x3d')]['findOne']({'where':{'id':_0x541fd5[_0xb776('0x54')]['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x3cc798,null))[_0xb776('0x20')](function(_0x344f85){if(_0x344f85){_0x117208['model']=_[_0xb776('0x43')](db[_0xb776('0x9e')][_0xb776('0x3e')]);_0x117208[_0xb776('0x42')]=_[_0xb776('0x43')](_0x541fd5[_0xb776('0x42')]);_0x117208['filters']=_[_0xb776('0x45')](_0x117208[_0xb776('0x41')],_0x117208[_0xb776('0x42')]);_0x258de3[_0xb776('0x44')]=_[_0xb776('0x45')](_0x117208['model'],qs[_0xb776('0x46')](_0x541fd5[_0xb776('0x42')]['fields']));_0x258de3['attributes']=_0x258de3[_0xb776('0x44')][_0xb776('0x47')]?_0x258de3[_0xb776('0x44')]:_0x117208[_0xb776('0x41')];if(!_0x541fd5[_0xb776('0x42')][_0xb776('0x48')](_0xb776('0x49'))){_0x258de3['limit']=qs['limit'](_0x541fd5['query']['limit']);_0x258de3[_0xb776('0x2d')]=qs['offset'](_0x541fd5[_0xb776('0x42')][_0xb776('0x2d')]);}_0x258de3[_0xb776('0x7f')]=qs['sort'](_0x541fd5['query']['sort']);_0x258de3[_0xb776('0x4b')]=qs[_0xb776('0x4c')](_[_0xb776('0x4d')](_0x541fd5['query'],_0x117208[_0xb776('0x4c')]));_0x258de3[_0xb776('0x4b')][_0xb776('0x61')]=_0x344f85['id'];if(_0x541fd5[_0xb776('0x42')][_0xb776('0x4e')]){_0x258de3['where']=_[_0xb776('0x4f')](_0x258de3[_0xb776('0x4b')],{'$or':_['map'](_0x258de3[_0xb776('0x44')],function(_0x5d3b6d){var _0x13fc4f={};_0x13fc4f[_0x5d3b6d]={'$like':'%'+_0x541fd5[_0xb776('0x42')]['filter']+'%'};return _0x13fc4f;})});}if(_0x541fd5[_0xb776('0x42')][_0xb776('0x9f')]){var _0x597e00=_0x541fd5[_0xb776('0x42')][_0xb776('0x9f')][_0xb776('0xa0')](',');var _0x410529={};_0x410529[_0x597e00[0x0]]={'$gte':moment(_0x597e00[0x1])[_0xb776('0xa1')](_0xb776('0xa2'))};_0x258de3[_0xb776('0x4b')]=_['merge'](_0x258de3['where'],_0x410529);}_0x258de3=_[_0xb776('0x4f')]({},_0x258de3,_0x541fd5[_0xb776('0x51')]);return db['FaxMessage'][_0xb776('0x2c')]({'where':_0x258de3[_0xb776('0x4b')]})[_0xb776('0x20')](function(_0x41f5c0){_0x3e9dd4['count']=_0x41f5c0;if(_0x541fd5[_0xb776('0x42')][_0xb776('0x65')]){_0x258de3['include']=[{'all':!![]}];}return db[_0xb776('0x9e')][_0xb776('0x53')](_0x258de3);})[_0xb776('0x20')](function(_0x5bc14e){_0x3e9dd4[_0xb776('0x6a')]=_0x5bc14e;return _0x3e9dd4;});}})[_0xb776('0x20')](respondWithFilteredResult(_0x3cc798,_0x258de3))[_0xb776('0x2a')](handleError(_0x3cc798,null));};exports[_0xb776('0x38')]=function(_0x1bd3d,_0x4591c5,_0xca8d5a){var _0x50d6f0,_0x9641d9={},_0x5a713c;if(_0x1bd3d[_0xb776('0x57')]['to']){_0x5a713c=_0x1bd3d['body']['to'][0x0];}return db['FaxAccount'][_0xb776('0x55')]({'where':{'id':_0x1bd3d[_0xb776('0x54')]['id']},'include':[{'model':db[_0xb776('0xa3')],'as':_0xb776('0xa4'),'include':[{'model':db[_0xb776('0x71')],'as':_0xb776('0xa5'),'where':{'fax':_0x5a713c},'limit':0x1,'order':[[_0xb776('0xa6'),_0xb776('0xa7')]]}]}]})[_0xb776('0x20')](handleEntityNotFound(_0x4591c5,null))[_0xb776('0x20')](function(_0x429462){_0x50d6f0=_0x429462;if(_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')]&&_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')][_0xb776('0x47')]){for(var _0x2dc446=0x0;_0x2dc446<_0x1bd3d['body']['attachments'][_0xb776('0x47')];_0x2dc446+=0x1){_0x1bd3d[_0xb776('0x57')]['attachments'][_0x2dc446]={'filename':_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')][_0x2dc446]['name'],'id':_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')][_0x2dc446]['id'],'path':path['join'](config[_0xb776('0xa9')],'server/files/attachments',_0x1bd3d[_0xb776('0x57')]['attachments'][_0x2dc446]['basename'])};}}return respondWithRpcPromise(_0xb776('0xaa'),'CheckAfterSend',{'FaxAccountId':_[_0xb776('0xab')](_0x1bd3d[_0xb776('0x54')]['id'])?undefined:_0x1bd3d[_0xb776('0x54')]['id'],'path':_['isNil'](_0x1bd3d['body'][_0xb776('0xa8')][0x0][_0xb776('0x5')])?undefined:_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')][0x0][_0xb776('0x5')],'fax':_[_0xb776('0xab')](_0x1bd3d[_0xb776('0x57')]['to'][0x0])?undefined:_0x1bd3d[_0xb776('0x57')]['to'][0x0]},client9002);})['then'](function(){if(_0x50d6f0){if(_[_0xb776('0xab')](_0x1bd3d[_0xb776('0x57')][_0xb776('0xac')])){_0x1bd3d['body'][_0xb776('0xac')]=util[_0xb776('0xa1')]('\x22%s\x22\x20<%s>',_0x50d6f0[_0xb776('0x37')],_0x50d6f0[_0xb776('0xad')]);}if(_0x50d6f0['List']){if(_0x50d6f0['List'][_0xb776('0xa5')][_0xb776('0x47')]){return _0x50d6f0['List'][_0xb776('0xa5')][0x0];}else{return db[_0xb776('0x71')]['create'](_[_0xb776('0x14')](_0x1bd3d[_0xb776('0x57')],{'firstName':_0x1bd3d[_0xb776('0x57')]['to'][0x0],'phone':_0x1bd3d['body']['to'][0x0],'fax':_0x1bd3d[_0xb776('0x57')]['to'][0x0],'ListId':_0x50d6f0[_0xb776('0x9c')]}));}}else{throw new Error(_0xb776('0xae'));}}else{throw new Error(_0xb776('0xaf'));}})['then'](function(_0x394b0a){if(_0x394b0a){return db[_0xb776('0x6d')][_0xb776('0x55')]({'where':{'ContactId':_0x394b0a['id'],'closed':![],'FaxAccountId':_0x50d6f0['id']}})[_0xb776('0x20')](function(_0x2e92d4){if(_0x2e92d4){return[_0x2e92d4,![]];}return db['FaxInteraction']['create']({'UserId':_0x1bd3d[_0xb776('0x58')]['id'],'ContactId':_0x394b0a['id'],'FaxAccountId':_0x50d6f0['id'],'fax':_0x1bd3d[_0xb776('0x57')]['to'][0x0],'firstMsgDirection':_0xb776('0xb0'),'Messages':[_[_0xb776('0x4f')](_0x1bd3d[_0xb776('0x57')],{'read':![],'body':_0x1bd3d[_0xb776('0x57')]['attachments'][0x0][_0xb776('0xb1')],'FaxAccountId':_0x50d6f0['id'],'UserId':_0x1bd3d[_0xb776('0x58')]['id'],'ContactId':_0x394b0a['id'],'AttachmentId':_0x1bd3d['body'][_0xb776('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0xb776('0x9e')],'as':_0xb776('0xb2')}]})[_0xb776('0x20')](function(_0x4d5bf2){return[_0x4d5bf2,!![]];});});}else{throw new Error(_0xb776('0xb3'));}})[_0xb776('0xb4')](function(_0x45af51,_0x3d5250){if(_0x3d5250){return _0x45af51;}return db[_0xb776('0x9e')][_0xb776('0x56')]({'direction':_0xb776('0xb0'),'read':![],'body':_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')][0x0][_0xb776('0xb1')],'FaxAccountId':_0x50d6f0['id'],'FaxInteractionId':_0x45af51['id'],'UserId':_0x1bd3d[_0xb776('0x58')]['id'],'ContactId':_0x45af51['ContactId'],'AttachmentId':_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')][0x0]['id']})[_0xb776('0x20')](function(_0x42797f){_0x45af51[_0xb776('0xb5')]['Messages']=[];_0x45af51[_0xb776('0xb5')]['Messages'][_0xb776('0x86')](_0x42797f[_0xb776('0xb5')]);return _0x45af51;});})[_0xb776('0x20')](function(_0x3b66be){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xb776('0xab')](_0x1bd3d[_0xb776('0x54')]['id'])?undefined:_0x1bd3d[_0xb776('0x54')]['id'],'path':_[_0xb776('0xab')](_0x1bd3d['body'][_0xb776('0xa8')][0x0]['path'])?undefined:_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')][0x0][_0xb776('0x5')],'fax':_[_0xb776('0xab')](_0x1bd3d[_0xb776('0x57')]['to'][0x0])?undefined:_0x1bd3d[_0xb776('0x57')]['to'][0x0],'AttachmentId':_0x1bd3d[_0xb776('0x57')][_0xb776('0xa8')][0x0]['id']},client9002)[_0xb776('0x20')](function(_0x37aa1f){logger['info'](_0xb776('0xb6'),_0x37aa1f);})[_0xb776('0x2a')](function(_0x2c08fe){logger['info'](_0xb776('0xb6'),_0x2c08fe);});return _0x3b66be;})[_0xb776('0x20')](respondWithResult(_0x4591c5,null))['catch'](handleError(_0x4591c5,null));};exports[_0xb776('0xb7')]=function(_0x21e893,_0x3c31b0,_0x2e3da8){return db[_0xb776('0x3d')]['find']({'where':{'id':_0x21e893[_0xb776('0x54')]['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x3c31b0,null))[_0xb776('0x20')](function(_0x5c5f98){if(_0x5c5f98){return _0x5c5f98[_0xb776('0xb7')](_0x21e893[_0xb776('0x57')]['ids'],_[_0xb776('0x6f')](_0x21e893[_0xb776('0x57')],[_0xb776('0x6c'),'id'])||{})[_0xb776('0xb4')](function(_0x584790){for(var _0x4501d4=0x0;_0x4501d4<_0x21e893['body'][_0xb776('0x6c')]['length'];_0x4501d4+=0x1){socket[_0xb776('0xb8')](_0xb776('0xb9'),{'UserId':_0x21e893[_0xb776('0x57')][_0xb776('0x6c')][_0x4501d4],'FaxAccountId':_0x21e893[_0xb776('0x54')]['id']});}return _0x584790;});}})[_0xb776('0x20')](respondWithResult(_0x3c31b0,null))[_0xb776('0x2a')](handleError(_0x3c31b0,null));};exports[_0xb776('0xba')]=function(_0xb4c90,_0x1c4bfc,_0x29dcf6){return db[_0xb776('0x3d')][_0xb776('0x55')]({'where':{'id':_0xb4c90[_0xb776('0x54')]['id']}})[_0xb776('0x20')](handleEntityNotFound(_0x1c4bfc,null))[_0xb776('0x20')](function(_0x4acb0e){if(_0x4acb0e){return _0x4acb0e[_0xb776('0xba')](_0xb4c90[_0xb776('0x42')]['ids'])['then'](function(){if(_[_0xb776('0xbb')](_0xb4c90['query'][_0xb776('0x6c')])){for(var _0x2d578=0x0;_0x2d578<_0xb4c90[_0xb776('0x42')][_0xb776('0x6c')][_0xb776('0x47')];_0x2d578+=0x1){socket['emit'](_0xb776('0xbc'),{'UserId':Number(_0xb4c90[_0xb776('0x42')]['ids'][_0x2d578]),'FaxAccountId':Number(_0xb4c90['params']['id'])});}}else{socket[_0xb776('0xb8')](_0xb776('0xbc'),{'UserId':Number(_0xb4c90[_0xb776('0x42')][_0xb776('0x6c')]),'FaxAccountId':Number(_0xb4c90[_0xb776('0x54')]['id'])});}});}})[_0xb776('0x20')](respondWithStatusCode(_0x1c4bfc,null))[_0xb776('0x2a')](handleError(_0x1c4bfc,null));};exports[_0xb776('0xbd')]=function(_0x4e026c,_0x8837fa,_0x3f4e8c){var _0x5db0f4={};var _0xcae0b1={};var _0x55498b;var _0x38fc3;return db[_0xb776('0x3d')][_0xb776('0x64')]({'where':{'id':_0x4e026c[_0xb776('0x54')]['id']}})['then'](handleEntityNotFound(_0x8837fa,null))['then'](function(_0x31a90d){if(_0x31a90d){_0x55498b=_0x31a90d;_0xcae0b1['model']=_['keys'](db[_0xb776('0xbe')]['rawAttributes']);_0xcae0b1[_0xb776('0x42')]=_['keys'](_0x4e026c['query']);_0xcae0b1[_0xb776('0x4c')]=_[_0xb776('0x45')](_0xcae0b1[_0xb776('0x41')],_0xcae0b1[_0xb776('0x42')]);_0x5db0f4['attributes']=_[_0xb776('0x45')](_0xcae0b1[_0xb776('0x41')],qs[_0xb776('0x46')](_0x4e026c[_0xb776('0x42')][_0xb776('0x46')]));_0x5db0f4['attributes']=_0x5db0f4[_0xb776('0x44')][_0xb776('0x47')]?_0x5db0f4[_0xb776('0x44')]:_0xcae0b1['model'];_0x5db0f4[_0xb776('0x7f')]=qs[_0xb776('0x4a')](_0x4e026c[_0xb776('0x42')][_0xb776('0x4a')]);_0x5db0f4[_0xb776('0x4b')]=qs['filters'](_[_0xb776('0x4d')](_0x4e026c[_0xb776('0x42')],_0xcae0b1['filters']));if(_0x4e026c[_0xb776('0x42')]['filter']){_0x5db0f4[_0xb776('0x4b')]=_['merge'](_0x5db0f4['where'],{'$or':_['map'](_0x5db0f4[_0xb776('0x44')],function(_0x576e86){var _0xbbe9c={};_0xbbe9c[_0x576e86]={'$like':'%'+_0x4e026c[_0xb776('0x42')]['filter']+'%'};return _0xbbe9c;})});}_0x5db0f4=_['merge']({},_0x5db0f4,_0x4e026c['options']);return _0x55498b[_0xb776('0xbd')](_0x5db0f4);}})[_0xb776('0x20')](function(_0x20c1ae){if(_0x20c1ae){_0x38fc3=_0x20c1ae[_0xb776('0x47')];if(!_0x4e026c[_0xb776('0x42')][_0xb776('0x48')](_0xb776('0x49'))){_0x5db0f4[_0xb776('0x2e')]=qs[_0xb776('0x2e')](_0x4e026c[_0xb776('0x42')][_0xb776('0x2e')]);_0x5db0f4['offset']=qs['offset'](_0x4e026c['query'][_0xb776('0x2d')]);}return _0x55498b[_0xb776('0xbd')](_0x5db0f4);}})[_0xb776('0x20')](function(_0x76570c){if(_0x76570c){return _0x76570c?{'count':_0x38fc3,'rows':_0x76570c}:null;}})['then'](respondWithResult(_0x8837fa,null))[_0xb776('0x2a')](handleError(_0x8837fa,null));}; \ No newline at end of file +var _0x65fd=['addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','getAgents','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','json','apply','reject','save','update','get','FaxAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','rows','params','keys','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','destroy','addDisposition','getDispositions','findOne','Disposition','order','FaxAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','ids','getInteractions','Contact','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','localstationid','app','system','description','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x65fd,0xe8));var _0xd65f=function(_0x58885f,_0x98e475){_0x58885f=_0x58885f-0x0;var _0x15b184=_0x65fd[_0x58885f];return _0x15b184;};'use strict';var pdf=require(_0xd65f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd65f('0x1'));var rp=require(_0xd65f('0x2'));var moment=require(_0xd65f('0x3'));var BPromise=require(_0xd65f('0x4'));var Mustache=require(_0xd65f('0x5'));var util=require(_0xd65f('0x6'));var path=require(_0xd65f('0x7'));var sox=require(_0xd65f('0x8'));var csv=require(_0xd65f('0x9'));var ejs=require(_0xd65f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd65f('0xb'));var crypto=require(_0xd65f('0xc'));var jsforce=require(_0xd65f('0xd'));var deskjs=require(_0xd65f('0xe'));var toCsv=require(_0xd65f('0x9'));var querystring=require(_0xd65f('0xf'));var Papa=require(_0xd65f('0x10'));var Redis=require(_0xd65f('0x11'));var authService=require(_0xd65f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd65f('0x13'));var hardwareService=require(_0xd65f('0x14'));var logger=require('../../config/logger')(_0xd65f('0x15'));var utils=require('../../config/utils');var config=require(_0xd65f('0x16'));var db=require(_0xd65f('0x17'))['db'];config[_0xd65f('0x18')]=_[_0xd65f('0x19')](config[_0xd65f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd65f('0x1a'))(new Redis(config[_0xd65f('0x18')]));require(_0xd65f('0x1b'))[_0xd65f('0x1c')](socket);var jayson=require(_0xd65f('0x1d'));var client=jayson[_0xd65f('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xd65f('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x1ecab1,_0x196b6e,_0x459926){if(_0x459926){var _0x541912=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x541912['test'](_0x196b6e)){return _0x1ecab1;}else{throw new db[(_0xd65f('0x1f'))]['ValidationError'](_0xd65f('0x20'));}}else{return _0x1ecab1;}}function respondWithRpcPromise(_0x55cfe0,_0xf4eec4,_0x3c0a71,_0x537411){return new BPromise(function(_0x4518e7,_0x2e1463){var _0x2657c5=_0x537411||client;return _0x2657c5[_0xd65f('0x21')](_0x55cfe0,_0x3c0a71)[_0xd65f('0x22')](function(_0x11cd87){logger[_0xd65f('0x23')](_0xd65f('0x24'),_0xf4eec4,_0xd65f('0x25'));logger[_0xd65f('0x26')](_0xd65f('0x27'),_0xf4eec4,_0xd65f('0x25'),JSON[_0xd65f('0x28')](_0x11cd87));if(_0x11cd87[_0xd65f('0x29')]){if(_0x11cd87['error'][_0xd65f('0x2a')]===0x1f4){logger[_0xd65f('0x29')](_0xd65f('0x24'),_0xf4eec4,_0x11cd87[_0xd65f('0x29')][_0xd65f('0x2b')]);return _0x2e1463(_0x11cd87[_0xd65f('0x29')]['message']);}logger[_0xd65f('0x29')](_0xd65f('0x24'),_0xf4eec4,_0x11cd87[_0xd65f('0x29')][_0xd65f('0x2b')]);return _0x4518e7(_0x11cd87['error'][_0xd65f('0x2b')]);}else{logger['info'](_0xd65f('0x24'),_0xf4eec4,_0xd65f('0x25'));_0x4518e7(_0x11cd87[_0xd65f('0x2c')][_0xd65f('0x2b')]);}})[_0xd65f('0x2d')](function(_0x529df3){logger['error'](_0xd65f('0x24'),_0xf4eec4,_0x529df3);_0x2e1463(_0x529df3);});});}function respondWithStatusCode(_0x4a82b1,_0x3fcc13){_0x3fcc13=_0x3fcc13||0xcc;return function(_0x18caab){if(_0x18caab){return _0x4a82b1[_0xd65f('0x2e')](_0x3fcc13);}return _0x4a82b1['status'](_0x3fcc13)[_0xd65f('0x2f')]();};}function respondWithResult(_0x360cb2,_0x2c02db){_0x2c02db=_0x2c02db||0xc8;return function(_0xfd82c1){if(_0xfd82c1){return _0x360cb2[_0xd65f('0x30')](_0x2c02db)['json'](_0xfd82c1);}};}function respondWithFilteredResult(_0x33c008,_0x8d92f8){return function(_0x4297a8){if(_0x4297a8){var _0x3bfab6=_0x4297a8[_0xd65f('0x31')],_0x322854=_0x8d92f8[_0xd65f('0x32')],_0x22b1b3=_0x8d92f8['offset']+_0x8d92f8[_0xd65f('0x33')],_0x1f093c;if(_0x22b1b3>=_0x3bfab6){_0x22b1b3=_0x3bfab6;_0x1f093c=0xc8;}else{_0x1f093c=0xce;}_0x33c008[_0xd65f('0x30')](_0x1f093c);return _0x33c008['set']('Content-Range',_0x322854+'-'+_0x22b1b3+'/'+_0x3bfab6)[_0xd65f('0x34')](_0x4297a8);}return null;};}function patchUpdates(_0x2dfc65){return function(_0x5dc3a3){try{jsonpatch[_0xd65f('0x35')](_0x5dc3a3,_0x2dfc65,!![]);}catch(_0x39e43a){return BPromise[_0xd65f('0x36')](_0x39e43a);}return _0x5dc3a3[_0xd65f('0x37')]();};}function saveUpdates(_0x59d9ea,_0x235d18){return function(_0x1a918b){if(_0x1a918b){return _0x1a918b[_0xd65f('0x38')](_0x59d9ea)[_0xd65f('0x22')](function(_0x13c871){return _0x13c871;});}return null;};}function removeEntity(_0x59f865,_0x56eaa9){return function(_0x38c30e){if(_0x38c30e){return _0x38c30e['destroy']()[_0xd65f('0x22')](function(){var _0xeeac2f=_0x38c30e[_0xd65f('0x39')]({'plain':!![]});var _0x26aa88=_0xd65f('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x26aa88,'resourceId':_0xeeac2f['id']}})[_0xd65f('0x22')](function(){return _0x38c30e;});})[_0xd65f('0x22')](function(){_0x59f865[_0xd65f('0x30')](0xcc)[_0xd65f('0x2f')]();});}};}function handleEntityNotFound(_0x1359a9,_0x46932e){return function(_0x3cc1b0){if(!_0x3cc1b0){_0x1359a9[_0xd65f('0x2e')](0x194);}return _0x3cc1b0;};}function handleError(_0x34995e,_0x5604a1){_0x5604a1=_0x5604a1||0x1f4;return function(_0xa60897){logger[_0xd65f('0x29')](_0xa60897[_0xd65f('0x3b')]);if(_0xa60897[_0xd65f('0x3c')]){delete _0xa60897[_0xd65f('0x3c')];}_0x34995e[_0xd65f('0x30')](_0x5604a1)[_0xd65f('0x3d')](_0xa60897);};}exports[_0xd65f('0x3e')]=function(_0x2dba86,_0x4ea9fe){var _0x5b14d3={'include':[{'model':db[_0xd65f('0x3f')],'as':_0xd65f('0x40')}]},_0x28c3ab={},_0x14e00d={'count':0x0,'rows':[]};var _0x2fb755=_[_0xd65f('0x41')](db[_0xd65f('0x42')][_0xd65f('0x43')],function(_0x5cb04b){return{'name':_0x5cb04b[_0xd65f('0x44')],'type':_0x5cb04b['type'][_0xd65f('0x45')]};});_0x28c3ab['model']=_[_0xd65f('0x41')](_0x2fb755,'name');_0x28c3ab[_0xd65f('0x46')]=_['keys'](_0x2dba86[_0xd65f('0x46')]);_0x28c3ab[_0xd65f('0x47')]=_['intersection'](_0x28c3ab[_0xd65f('0x48')],_0x28c3ab[_0xd65f('0x46')]);_0x5b14d3[_0xd65f('0x49')]=_[_0xd65f('0x4a')](_0x28c3ab[_0xd65f('0x48')],qs[_0xd65f('0x4b')](_0x2dba86[_0xd65f('0x46')]['fields']));_0x5b14d3[_0xd65f('0x49')]=_0x5b14d3[_0xd65f('0x49')][_0xd65f('0x4c')]?_0x5b14d3[_0xd65f('0x49')]:_0x28c3ab[_0xd65f('0x48')];if(!_0x2dba86[_0xd65f('0x46')][_0xd65f('0x4d')](_0xd65f('0x4e'))){_0x5b14d3['limit']=qs['limit'](_0x2dba86[_0xd65f('0x46')]['limit']);_0x5b14d3[_0xd65f('0x32')]=qs[_0xd65f('0x32')](_0x2dba86[_0xd65f('0x46')][_0xd65f('0x32')]);}_0x5b14d3['order']=qs['sort'](_0x2dba86['query'][_0xd65f('0x4f')]);_0x5b14d3[_0xd65f('0x50')]=qs['filters'](_[_0xd65f('0x51')](_0x2dba86[_0xd65f('0x46')],_0x28c3ab[_0xd65f('0x47')]),_0x2fb755);if(_0x2dba86[_0xd65f('0x46')][_0xd65f('0x52')]){_0x5b14d3[_0xd65f('0x50')]=_[_0xd65f('0x53')](_0x5b14d3[_0xd65f('0x50')],{'$or':_[_0xd65f('0x41')](_0x2fb755,function(_0x397372){if(_0x397372[_0xd65f('0x54')]!=='VIRTUAL'){var _0x215775={};_0x215775[_0x397372[_0xd65f('0x3c')]]={'$like':'%'+_0x2dba86['query'][_0xd65f('0x52')]+'%'};return _0x215775;}})});}_0x5b14d3=_['merge']({},_0x5b14d3,_0x2dba86['options']);var _0x424a38={'where':_0x5b14d3['where']};return db[_0xd65f('0x42')][_0xd65f('0x31')](_0x424a38)['then'](function(_0x2aa226){_0x14e00d[_0xd65f('0x31')]=_0x2aa226;if(_0x2dba86[_0xd65f('0x46')][_0xd65f('0x55')]){_0x5b14d3[_0xd65f('0x56')]=[{'all':!![]}];}return db[_0xd65f('0x42')]['findAll'](_0x5b14d3);})[_0xd65f('0x22')](function(_0x20f5c2){_0x14e00d[_0xd65f('0x57')]=_0x20f5c2;return _0x14e00d;})[_0xd65f('0x22')](respondWithFilteredResult(_0x4ea9fe,_0x5b14d3))['catch'](handleError(_0x4ea9fe,null));};exports['show']=function(_0x4c4fe7,_0x3cbb26){var _0x20f705={'raw':![],'where':{'id':_0x4c4fe7[_0xd65f('0x58')]['id']},'include':[{'model':db[_0xd65f('0x3f')],'as':_0xd65f('0x40')}]},_0x1d730b={};_0x1d730b[_0xd65f('0x48')]=_[_0xd65f('0x59')](db['FaxAccount'][_0xd65f('0x43')]);_0x1d730b[_0xd65f('0x46')]=_[_0xd65f('0x59')](_0x4c4fe7[_0xd65f('0x46')]);_0x1d730b[_0xd65f('0x47')]=_['intersection'](_0x1d730b[_0xd65f('0x48')],_0x1d730b[_0xd65f('0x46')]);_0x20f705[_0xd65f('0x49')]=_[_0xd65f('0x4a')](_0x1d730b[_0xd65f('0x48')],qs[_0xd65f('0x4b')](_0x4c4fe7[_0xd65f('0x46')][_0xd65f('0x4b')]));_0x20f705[_0xd65f('0x49')]=_0x20f705[_0xd65f('0x49')][_0xd65f('0x4c')]?_0x20f705['attributes']:_0x1d730b[_0xd65f('0x48')];if(_0x4c4fe7[_0xd65f('0x46')][_0xd65f('0x55')]){_0x20f705['include']=[{'all':!![]}];}_0x20f705=_[_0xd65f('0x53')]({},_0x20f705,_0x4c4fe7[_0xd65f('0x5a')]);return db[_0xd65f('0x42')]['find'](_0x20f705)[_0xd65f('0x22')](handleEntityNotFound(_0x3cbb26,null))['then'](respondWithResult(_0x3cbb26,null))[_0xd65f('0x2d')](handleError(_0x3cbb26,null));};exports[_0xd65f('0x5b')]=function(_0x29fef3,_0x1b8e97){return db[_0xd65f('0x42')][_0xd65f('0x5b')](_0x29fef3[_0xd65f('0x5c')],{})[_0xd65f('0x22')](function(_0x60fe09){var _0x1215ce=_0x29fef3['user'][_0xd65f('0x39')]({'plain':!![]});if(!_0x1215ce)throw new Error(_0xd65f('0x5d'));if(_0x1215ce['role']===_0xd65f('0x5e')){var _0x39cbbc=_0x60fe09['get']({'plain':!![]});var _0x2248f=_0xd65f('0x3a');return db[_0xd65f('0x5f')][_0xd65f('0x60')]({'where':{'name':_0x2248f,'userProfileId':_0x1215ce[_0xd65f('0x61')]},'raw':!![]})[_0xd65f('0x22')](function(_0xf446e5){if(_0xf446e5&&_0xf446e5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x39cbbc['name'],'resourceId':_0x39cbbc['id'],'type':_0xf446e5[_0xd65f('0x3c')],'sectionId':_0xf446e5['id']},{})[_0xd65f('0x22')](function(){return _0x60fe09;});}else{return _0x60fe09;}})[_0xd65f('0x2d')](function(_0x1b4ce6){logger[_0xd65f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b4ce6);throw _0x1b4ce6;});}return _0x60fe09;})[_0xd65f('0x22')](respondWithResult(_0x1b8e97,0xc9))[_0xd65f('0x2d')](handleError(_0x1b8e97,null));};exports[_0xd65f('0x38')]=function(_0xc94648,_0x2344eb){if(_0xc94648[_0xd65f('0x5c')]['id']){delete _0xc94648['body']['id'];}return db['FaxAccount'][_0xd65f('0x60')]({'where':{'id':_0xc94648[_0xd65f('0x58')]['id']},'include':[{'model':db[_0xd65f('0x3f')],'as':_0xd65f('0x40')}]})['then'](handleEntityNotFound(_0x2344eb,null))[_0xd65f('0x22')](saveUpdates(_0xc94648[_0xd65f('0x5c')],null))[_0xd65f('0x22')](respondWithResult(_0x2344eb,null))[_0xd65f('0x2d')](handleError(_0x2344eb,null));};exports[_0xd65f('0x62')]=function(_0x5add78,_0x1be167){return db[_0xd65f('0x42')][_0xd65f('0x60')]({'where':{'id':_0x5add78[_0xd65f('0x58')]['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x1be167,null))[_0xd65f('0x22')](removeEntity(_0x1be167,null))[_0xd65f('0x2d')](handleError(_0x1be167,null));};exports['describe']=function(_0x8e26c8,_0x3637af){return db[_0xd65f('0x42')]['describe']()['then'](respondWithResult(_0x3637af,null))[_0xd65f('0x2d')](handleError(_0x3637af,null));};exports[_0xd65f('0x63')]=function(_0x250f6b,_0x9a3311,_0xd5e42e){if(_0x250f6b[_0xd65f('0x5c')]['id']){delete _0x250f6b[_0xd65f('0x5c')]['id'];}return db[_0xd65f('0x42')]['find']({'where':{'id':_0x250f6b[_0xd65f('0x58')]['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x9a3311,null))[_0xd65f('0x22')](function(_0x161c76){if(_0x161c76){_0x250f6b['body']['FaxAccountId']=_0x161c76['id'];return db['Disposition'][_0xd65f('0x5b')](_0x250f6b['body']);}})[_0xd65f('0x22')](respondWithResult(_0x9a3311,null))[_0xd65f('0x2d')](handleError(_0x9a3311,null));};exports[_0xd65f('0x64')]=function(_0x4180f6,_0x451f22,_0x26c6a2){var _0x14e184={'raw':![],'where':{}};var _0x1d101b={};var _0x2e16e4={'count':0x0,'rows':[]};return db[_0xd65f('0x42')][_0xd65f('0x65')]({'where':{'id':_0x4180f6[_0xd65f('0x58')]['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x451f22,null))[_0xd65f('0x22')](function(_0x34bab7){if(_0x34bab7){_0x1d101b['model']=_[_0xd65f('0x59')](db[_0xd65f('0x66')][_0xd65f('0x43')]);_0x1d101b[_0xd65f('0x46')]=_[_0xd65f('0x59')](_0x4180f6[_0xd65f('0x46')]);_0x1d101b['filters']=_[_0xd65f('0x4a')](_0x1d101b[_0xd65f('0x48')],_0x1d101b[_0xd65f('0x46')]);_0x14e184[_0xd65f('0x49')]=_[_0xd65f('0x4a')](_0x1d101b[_0xd65f('0x48')],qs[_0xd65f('0x4b')](_0x4180f6[_0xd65f('0x46')][_0xd65f('0x4b')]));_0x14e184['attributes']=_0x14e184[_0xd65f('0x49')][_0xd65f('0x4c')]?_0x14e184[_0xd65f('0x49')]:_0x1d101b[_0xd65f('0x48')];if(!_0x4180f6[_0xd65f('0x46')]['hasOwnProperty']('nolimit')){_0x14e184[_0xd65f('0x33')]=qs[_0xd65f('0x33')](_0x4180f6[_0xd65f('0x46')]['limit']);_0x14e184[_0xd65f('0x32')]=qs['offset'](_0x4180f6[_0xd65f('0x46')][_0xd65f('0x32')]);}_0x14e184[_0xd65f('0x67')]=qs[_0xd65f('0x4f')](_0x4180f6[_0xd65f('0x46')][_0xd65f('0x4f')]);_0x14e184[_0xd65f('0x50')]=qs[_0xd65f('0x47')](_[_0xd65f('0x51')](_0x4180f6[_0xd65f('0x46')],_0x1d101b['filters']));_0x14e184[_0xd65f('0x50')][_0xd65f('0x68')]=_0x34bab7['id'];if(_0x4180f6['query']['filter']){_0x14e184[_0xd65f('0x50')]=_[_0xd65f('0x53')](_0x14e184[_0xd65f('0x50')],{'$or':_[_0xd65f('0x41')](_0x14e184[_0xd65f('0x49')],function(_0x141770){var _0x8db597={};_0x8db597[_0x141770]={'$like':'%'+_0x4180f6['query'][_0xd65f('0x52')]+'%'};return _0x8db597;})});}_0x14e184=_[_0xd65f('0x53')]({},_0x14e184,_0x4180f6[_0xd65f('0x5a')]);return db[_0xd65f('0x66')]['count']({'where':_0x14e184['where']})[_0xd65f('0x22')](function(_0x19e3ca){_0x2e16e4['count']=_0x19e3ca;if(_0x4180f6[_0xd65f('0x46')]['includeAll']){_0x14e184[_0xd65f('0x56')]=[{'all':!![]}];}return db[_0xd65f('0x66')][_0xd65f('0x69')](_0x14e184);})['then'](function(_0x2ce493){_0x2e16e4['rows']=_0x2ce493;return _0x2e16e4;});}})[_0xd65f('0x22')](respondWithFilteredResult(_0x451f22,_0x14e184))['catch'](handleError(_0x451f22,null));};exports[_0xd65f('0x6a')]=function(_0x5d88cc,_0x2e968e,_0xf9bd31){return db[_0xd65f('0x42')][_0xd65f('0x60')]({'where':{'id':_0x5d88cc[_0xd65f('0x58')]['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x2e968e,null))[_0xd65f('0x22')](function(_0x131641){if(_0x131641){return _0x131641[_0xd65f('0x6a')](_0x5d88cc[_0xd65f('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x2e968e,null))[_0xd65f('0x2d')](handleError(_0x2e968e,null));};exports[_0xd65f('0x6b')]=function(_0x4ad84e,_0x351a58,_0x85141f){if(_0x4ad84e[_0xd65f('0x5c')]['id']){delete _0x4ad84e['body']['id'];}return db[_0xd65f('0x42')][_0xd65f('0x60')]({'where':{'id':_0x4ad84e['params']['id']}})['then'](handleEntityNotFound(_0x351a58,null))[_0xd65f('0x22')](function(_0x5b18fc){if(_0x5b18fc){_0x4ad84e[_0xd65f('0x5c')]['FaxAccountId']=_0x5b18fc['id'];return db[_0xd65f('0x6c')]['create'](_0x4ad84e['body']);}})[_0xd65f('0x22')](respondWithResult(_0x351a58,null))[_0xd65f('0x2d')](handleError(_0x351a58,null));};exports[_0xd65f('0x6d')]=function(_0x312090,_0x5a63d9,_0x325480){var _0x2834f5={'raw':![],'where':{}};var _0x2f7d20={};var _0x44a6fb={'count':0x0,'rows':[]};return db[_0xd65f('0x42')][_0xd65f('0x65')]({'where':{'id':_0x312090[_0xd65f('0x58')]['id']}})['then'](handleEntityNotFound(_0x5a63d9,null))[_0xd65f('0x22')](function(_0x43c45c){if(_0x43c45c){_0x2f7d20[_0xd65f('0x48')]=_[_0xd65f('0x59')](db[_0xd65f('0x6c')]['rawAttributes']);_0x2f7d20[_0xd65f('0x46')]=_['keys'](_0x312090['query']);_0x2f7d20[_0xd65f('0x47')]=_[_0xd65f('0x4a')](_0x2f7d20['model'],_0x2f7d20['query']);_0x2834f5['attributes']=_[_0xd65f('0x4a')](_0x2f7d20['model'],qs[_0xd65f('0x4b')](_0x312090[_0xd65f('0x46')][_0xd65f('0x4b')]));_0x2834f5[_0xd65f('0x49')]=_0x2834f5[_0xd65f('0x49')]['length']?_0x2834f5['attributes']:_0x2f7d20[_0xd65f('0x48')];if(!_0x312090[_0xd65f('0x46')][_0xd65f('0x4d')](_0xd65f('0x4e'))){_0x2834f5[_0xd65f('0x33')]=qs[_0xd65f('0x33')](_0x312090[_0xd65f('0x46')][_0xd65f('0x33')]);_0x2834f5[_0xd65f('0x32')]=qs['offset'](_0x312090[_0xd65f('0x46')][_0xd65f('0x32')]);}_0x2834f5[_0xd65f('0x67')]=qs[_0xd65f('0x4f')](_0x312090['query']['sort']);_0x2834f5['where']=qs[_0xd65f('0x47')](_['pick'](_0x312090[_0xd65f('0x46')],_0x2f7d20[_0xd65f('0x47')]));_0x2834f5['where']['FaxAccountId']=_0x43c45c['id'];if(_0x312090[_0xd65f('0x46')][_0xd65f('0x52')]){_0x2834f5['where']=_[_0xd65f('0x53')](_0x2834f5['where'],{'$or':_[_0xd65f('0x41')](_0x2834f5[_0xd65f('0x49')],function(_0x16cdce){var _0x4ed031={};_0x4ed031[_0x16cdce]={'$like':'%'+_0x312090[_0xd65f('0x46')]['filter']+'%'};return _0x4ed031;})});}_0x2834f5=_['merge']({},_0x2834f5,_0x312090[_0xd65f('0x5a')]);return db[_0xd65f('0x6c')][_0xd65f('0x31')]({'where':_0x2834f5[_0xd65f('0x50')]})[_0xd65f('0x22')](function(_0x4b8b87){_0x44a6fb[_0xd65f('0x31')]=_0x4b8b87;if(_0x312090[_0xd65f('0x46')][_0xd65f('0x55')]){_0x2834f5['include']=[{'all':!![]}];}return db[_0xd65f('0x6c')][_0xd65f('0x69')](_0x2834f5);})['then'](function(_0xc67dc0){_0x44a6fb[_0xd65f('0x57')]=_0xc67dc0;return _0x44a6fb;});}})['then'](respondWithFilteredResult(_0x5a63d9,_0x2834f5))[_0xd65f('0x2d')](handleError(_0x5a63d9,null));};exports[_0xd65f('0x6e')]=function(_0x140e2b,_0xbc92d1,_0xd6e058){return db[_0xd65f('0x42')][_0xd65f('0x60')]({'where':{'id':_0x140e2b[_0xd65f('0x58')]['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0xbc92d1,null))['then'](function(_0x392b45){if(_0x392b45){return _0x392b45['removeAnswers'](_0x140e2b[_0xd65f('0x46')]['ids']);}})[_0xd65f('0x22')](respondWithStatusCode(_0xbc92d1,null))[_0xd65f('0x2d')](handleError(_0xbc92d1,null));};exports['addInteraction']=function(_0xcaef8d,_0x3588f0,_0x406ac9){return db[_0xd65f('0x6f')][_0xd65f('0x60')]({'where':{'id':_0xcaef8d['params']['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x3588f0,null))['then'](function(_0x39e54c){if(_0x39e54c){return _0x39e54c[_0xd65f('0x70')](_0xcaef8d[_0xd65f('0x5c')]['ids'],_[_0xd65f('0x71')](_0xcaef8d[_0xd65f('0x5c')],[_0xd65f('0x72'),'id'])||{});}})[_0xd65f('0x22')](respondWithResult(_0x3588f0,null))[_0xd65f('0x2d')](handleError(_0x3588f0,null));};exports[_0xd65f('0x73')]=function(_0x49a931,_0x112b76,_0x3c23c6){var _0x22c138={'raw':![],'where':{}};var _0x1ee91a={};var _0x58c471={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd65f('0x65')]({'where':{'id':_0x49a931[_0xd65f('0x58')]['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x112b76,null))[_0xd65f('0x22')](function(_0x3139c8){if(_0x3139c8){_0x1ee91a['model']=_['keys'](db['FaxInteraction'][_0xd65f('0x43')]);_0x1ee91a[_0xd65f('0x46')]=_[_0xd65f('0x59')](_0x49a931[_0xd65f('0x46')]);_0x1ee91a[_0xd65f('0x47')]=_[_0xd65f('0x4a')](_0x1ee91a[_0xd65f('0x48')],_0x1ee91a[_0xd65f('0x46')]);_0x22c138[_0xd65f('0x49')]=_[_0xd65f('0x4a')](_0x1ee91a[_0xd65f('0x48')],qs['fields'](_0x49a931[_0xd65f('0x46')][_0xd65f('0x4b')]));_0x22c138['attributes']=_0x22c138[_0xd65f('0x49')][_0xd65f('0x4c')]?_0x22c138[_0xd65f('0x49')]:_0x1ee91a[_0xd65f('0x48')];if(!_0x49a931[_0xd65f('0x46')]['hasOwnProperty'](_0xd65f('0x4e'))){_0x22c138[_0xd65f('0x33')]=qs[_0xd65f('0x33')](_0x49a931[_0xd65f('0x46')]['limit']);_0x22c138[_0xd65f('0x32')]=qs[_0xd65f('0x32')](_0x49a931[_0xd65f('0x46')][_0xd65f('0x32')]);}_0x22c138[_0xd65f('0x67')]=qs[_0xd65f('0x4f')](_0x49a931[_0xd65f('0x46')][_0xd65f('0x4f')]);_0x22c138[_0xd65f('0x50')]=qs[_0xd65f('0x47')](_[_0xd65f('0x51')](_0x49a931[_0xd65f('0x46')],_0x1ee91a[_0xd65f('0x47')]));_0x22c138['where'][_0xd65f('0x68')]=_0x3139c8['id'];if(_0x49a931['query'][_0xd65f('0x52')]){_0x22c138[_0xd65f('0x50')]=_[_0xd65f('0x53')](_0x22c138['where'],{'$or':_[_0xd65f('0x41')](_0x22c138['attributes'],function(_0x7ce070){var _0x1c2991={};_0x1c2991[_0x7ce070]={'$like':'%'+_0x49a931['query']['filter']+'%'};return _0x1c2991;})});}_0x22c138=_['merge']({},_0x22c138,_0x49a931[_0xd65f('0x5a')]);return db[_0xd65f('0x6f')][_0xd65f('0x31')]({'where':_0x22c138['where']})[_0xd65f('0x22')](function(_0x1e7db9){_0x58c471['count']=_0x1e7db9;if(_0x49a931[_0xd65f('0x46')][_0xd65f('0x55')]){_0x22c138[_0xd65f('0x56')]=[{'model':db['CmContact'],'as':_0xd65f('0x74'),'required':![]},{'model':db[_0xd65f('0x75')],'as':_0xd65f('0x76'),'attributes':[_0xd65f('0x3c'),_0xd65f('0x77'),'internal'],'required':![]},{'model':db[_0xd65f('0x78')],'as':_0xd65f('0x79'),'attributes':['id',_0xd65f('0x3c'),'color'],'where':_0x49a931['query'][_0xd65f('0x7a')]?{'id':_0x49a931[_0xd65f('0x46')][_0xd65f('0x7a')]}:undefined,'required':_0x49a931['query'][_0xd65f('0x7a')]?!![]:![]}];}return db[_0xd65f('0x6f')][_0xd65f('0x69')](_0x22c138);})['then'](function(_0x53fa3d){_0x58c471[_0xd65f('0x57')]=_0x53fa3d;return _0x58c471;});}})[_0xd65f('0x22')](respondWithFilteredResult(_0x112b76,_0x22c138))[_0xd65f('0x2d')](handleError(_0x112b76,null));};exports[_0xd65f('0x7b')]=function(_0x5d9d10,_0x39d747,_0x5628af){return db['FaxAccount'][_0xd65f('0x65')]({'where':{'id':_0x5d9d10['params']['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x39d747,null))[_0xd65f('0x22')](function(_0x497105){if(_0x497105){return db[_0xd65f('0x7c')][_0xd65f('0x7d')](function(_0x34a087){return db[_0xd65f('0x7e')][_0xd65f('0x62')]({'where':{'FaxAccountId':_0x5d9d10[_0xd65f('0x58')]['id']},'transaction':_0x34a087})['then'](function(_0x1bf6c6){var _0x5b74aa=_[_0xd65f('0x41')](_0x5d9d10[_0xd65f('0x5c')],function(_0x321d8c){_0x321d8c['FaxAccountId']=_0x5d9d10[_0xd65f('0x58')]['id'];return _0x321d8c;});return db[_0xd65f('0x7e')][_0xd65f('0x7f')](_0x5b74aa,{'transaction':_0x34a087});});})[_0xd65f('0x22')](function(){return db[_0xd65f('0x7e')][_0xd65f('0x80')]({'where':{'FaxAccountId':_0x5d9d10['params']['id']},'order':_0xd65f('0x81')});});}})[_0xd65f('0x22')](respondWithResult(_0x39d747,null))[_0xd65f('0x2d')](handleError(_0x39d747,null));};exports[_0xd65f('0x82')]=function(_0x3adba3,_0xf9be38,_0x3b734f){var _0x3fb8c4={};var _0x258e27={};var _0x57aa0f;var _0x3e27fd;return db['FaxAccount'][_0xd65f('0x65')]({'where':{'id':_0x3adba3[_0xd65f('0x58')]['id']}})['then'](handleEntityNotFound(_0xf9be38,null))[_0xd65f('0x22')](function(_0x350fe1){if(_0x350fe1){_0x57aa0f=_0x350fe1;_0x258e27[_0xd65f('0x48')]=_[_0xd65f('0x59')](db['FaxApplication'][_0xd65f('0x43')]);_0x258e27[_0xd65f('0x46')]=_['keys'](_0x3adba3['query']);_0x258e27[_0xd65f('0x47')]=_[_0xd65f('0x4a')](_0x258e27[_0xd65f('0x48')],_0x258e27[_0xd65f('0x46')]);_0x3fb8c4[_0xd65f('0x49')]=_[_0xd65f('0x4a')](_0x258e27[_0xd65f('0x48')],qs[_0xd65f('0x4b')](_0x3adba3['query'][_0xd65f('0x4b')]));_0x3fb8c4[_0xd65f('0x49')]=_0x3fb8c4[_0xd65f('0x49')][_0xd65f('0x4c')]?_0x3fb8c4[_0xd65f('0x49')]:_0x258e27[_0xd65f('0x48')];_0x3fb8c4['order']=qs['sort'](_0x3adba3[_0xd65f('0x46')][_0xd65f('0x4f')]);_0x3fb8c4['where']=qs[_0xd65f('0x47')](_['pick'](_0x3adba3[_0xd65f('0x46')],_0x258e27[_0xd65f('0x47')]));if(_0x3adba3['query'][_0xd65f('0x52')]){_0x3fb8c4[_0xd65f('0x50')]=_[_0xd65f('0x53')](_0x3fb8c4[_0xd65f('0x50')],{'$or':_[_0xd65f('0x41')](_0x3fb8c4[_0xd65f('0x49')],function(_0x4588ad){var _0x245bf7={};_0x245bf7[_0x4588ad]={'$like':'%'+_0x3adba3[_0xd65f('0x46')][_0xd65f('0x52')]+'%'};return _0x245bf7;})});}_0x3fb8c4=_['merge']({},_0x3fb8c4,_0x3adba3[_0xd65f('0x5a')]);return _0x57aa0f[_0xd65f('0x82')](_0x3fb8c4);}})[_0xd65f('0x22')](function(_0x5bc234){if(_0x5bc234){_0x3e27fd=_0x5bc234['length'];if(!_0x3adba3['query'][_0xd65f('0x4d')]('nolimit')){_0x3fb8c4['limit']=qs['limit'](_0x3adba3[_0xd65f('0x46')]['limit']);_0x3fb8c4[_0xd65f('0x32')]=qs[_0xd65f('0x32')](_0x3adba3[_0xd65f('0x46')][_0xd65f('0x32')]);}return _0x57aa0f[_0xd65f('0x82')](_0x3fb8c4);}})[_0xd65f('0x22')](function(_0x338cda){if(_0x338cda){return _0x338cda?{'count':_0x3e27fd,'rows':_0x338cda}:null;}})[_0xd65f('0x22')](respondWithResult(_0xf9be38,null))['catch'](handleError(_0xf9be38,null));};function Extension(_0xbf8f47,_0x2593d4,_0x3f6165,_0x26809e){this[_0xd65f('0x83')]=_0xd65f('0x84');this['exten']=_0xbf8f47[_0xd65f('0x85')];this[_0xd65f('0x86')]=_0x26809e;this['type']=_0xd65f('0x87');this[_0xd65f('0x88')]='Fax\x20Extension';this[_0xd65f('0x68')]=_0xbf8f47['id'];this[_0xd65f('0x81')]=_0x2593d4;this[_0xd65f('0x89')]=_0x3f6165;}function createExtensionsReciveFax(_0x5abfff){var _0x1087a2=0x1;var _0x5cf1a5=[];_0x5cf1a5[_0xd65f('0x8a')](new Extension(_0x5abfff,_0x1087a2,'','Answer'));_0x1087a2+=0x1;_0x5cf1a5['push'](new Extension(_0x5abfff,_0x1087a2,_0xd65f('0x8b'),_0xd65f('0x8c')));_0x1087a2+=0x1;for(var _0x335739 in _0x5abfff){if(_0x5abfff[_0xd65f('0x4d')](_0x335739)&&(_0x335739===_0xd65f('0x8d')||_0x335739===_0xd65f('0x85')||_0x335739===_0xd65f('0x8e')||_0x335739===_0xd65f('0x8f')||_0x335739===_0xd65f('0x90')||_0x335739==='maxrate'||_0x335739===_0xd65f('0x91')||_0x335739===_0xd65f('0x92')||_0x335739===_0xd65f('0x93'))){_0x5cf1a5['push'](new Extension(_0x5abfff,_0x1087a2,_0xd65f('0x94')+_0x335739+')='+_0x5abfff[_0x335739],_0xd65f('0x8c')));_0x1087a2+=0x1;}}_0x5cf1a5['push'](new Extension(_0x5abfff,_0x1087a2,'6',_0xd65f('0x95')));_0x1087a2+=0x1;_0x5cf1a5['push'](new Extension(_0x5abfff,_0x1087a2,_0xd65f('0x96'),_0xd65f('0x97')));_0x1087a2=0x0;return _0x5cf1a5;}exports[_0xd65f('0x98')]=function(_0x5e369e,_0x62bcfe,_0x5ea983){var _0x451899;return db['sequelize']['transaction'](function(_0x522844){return db['FaxAccount'][_0xd65f('0x5b')](_0x5e369e['body'],{'transaction':_0x522844})[_0xd65f('0x22')](function(_0x541919){_0x451899=_0x541919[_0xd65f('0x39')]({'plain':!![]});return db[_0xd65f('0x99')][_0xd65f('0x7f')](createExtensionsReciveFax(_0x451899),{'transaction':_0x522844});});})['then'](function(){return _0x451899;})[_0xd65f('0x22')](respondWithResult(_0x62bcfe,null))['catch'](handleError(_0x62bcfe,null));};exports[_0xd65f('0x9a')]=function(_0x18a491,_0x23561d,_0x41693f){var _0xcdbff1;return db[_0xd65f('0x7c')][_0xd65f('0x7d')](function(_0x740efd){return db['FaxAccount'][_0xd65f('0x38')](_0x18a491[_0xd65f('0x5c')],{'where':{'id':_0x18a491[_0xd65f('0x5c')]['id']},'transaction':_0x740efd})[_0xd65f('0x22')](function(_0x1dc182){return db['VoiceExtension'][_0xd65f('0x62')]({'where':{'FaxAccountId':_0x18a491['body']['id']},'transaction':_0x740efd})[_0xd65f('0x22')](function(_0x4b18c6){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0xd65f('0x71')](_0x18a491[_0xd65f('0x5c')],[_0xd65f('0x9b'),_0xd65f('0x45'),_0xd65f('0x9c'),_0xd65f('0x9d'),'TrunkId',_0xd65f('0x9e')])),{'transaction':_0x740efd});});});})[_0xd65f('0x22')](function(){return db[_0xd65f('0x42')][_0xd65f('0x9f')](_0x18a491[_0xd65f('0x5c')]['id']);})[_0xd65f('0x22')](respondWithResult(_0x23561d,null))[_0xd65f('0x2d')](handleError(_0x23561d,null));};exports[_0xd65f('0xa0')]=function(_0x3cda26,_0x16d933,_0x5979cc){var _0xad0818={'raw':!![],'where':{}};var _0x4f91f1={};var _0x3b5884={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd65f('0x65')]({'where':{'id':_0x3cda26['params']['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x16d933,null))[_0xd65f('0x22')](function(_0x121910){if(_0x121910){_0x4f91f1[_0xd65f('0x48')]=_['keys'](db[_0xd65f('0xa1')]['rawAttributes']);_0x4f91f1['query']=_[_0xd65f('0x59')](_0x3cda26['query']);_0x4f91f1[_0xd65f('0x47')]=_['intersection'](_0x4f91f1[_0xd65f('0x48')],_0x4f91f1[_0xd65f('0x46')]);_0xad0818[_0xd65f('0x49')]=_[_0xd65f('0x4a')](_0x4f91f1[_0xd65f('0x48')],qs[_0xd65f('0x4b')](_0x3cda26[_0xd65f('0x46')][_0xd65f('0x4b')]));_0xad0818[_0xd65f('0x49')]=_0xad0818['attributes'][_0xd65f('0x4c')]?_0xad0818[_0xd65f('0x49')]:_0x4f91f1[_0xd65f('0x48')];if(!_0x3cda26['query'][_0xd65f('0x4d')]('nolimit')){_0xad0818[_0xd65f('0x33')]=qs[_0xd65f('0x33')](_0x3cda26[_0xd65f('0x46')][_0xd65f('0x33')]);_0xad0818[_0xd65f('0x32')]=qs['offset'](_0x3cda26[_0xd65f('0x46')][_0xd65f('0x32')]);}_0xad0818[_0xd65f('0x67')]=qs[_0xd65f('0x4f')](_0x3cda26[_0xd65f('0x46')][_0xd65f('0x4f')]);_0xad0818['where']=qs['filters'](_[_0xd65f('0x51')](_0x3cda26[_0xd65f('0x46')],_0x4f91f1['filters']));_0xad0818['where']['FaxAccountId']=_0x121910['id'];if(_0x3cda26['query'][_0xd65f('0x52')]){_0xad0818['where']=_['merge'](_0xad0818[_0xd65f('0x50')],{'$or':_[_0xd65f('0x41')](_0xad0818[_0xd65f('0x49')],function(_0x225a23){var _0x16a412={};_0x16a412[_0x225a23]={'$like':'%'+_0x3cda26['query'][_0xd65f('0x52')]+'%'};return _0x16a412;})});}if(_0x3cda26[_0xd65f('0x46')][_0xd65f('0xa2')]){var _0x2972b3=_0x3cda26[_0xd65f('0x46')][_0xd65f('0xa2')]['split'](',');var _0x31dd79={};_0x31dd79[_0x2972b3[0x0]]={'$gte':moment(_0x2972b3[0x1])[_0xd65f('0xa3')](_0xd65f('0xa4'))};_0xad0818[_0xd65f('0x50')]=_[_0xd65f('0x53')](_0xad0818['where'],_0x31dd79);}_0xad0818=_[_0xd65f('0x53')]({},_0xad0818,_0x3cda26[_0xd65f('0x5a')]);return db['FaxMessage'][_0xd65f('0x31')]({'where':_0xad0818[_0xd65f('0x50')]})[_0xd65f('0x22')](function(_0x492cce){_0x3b5884['count']=_0x492cce;if(_0x3cda26['query'][_0xd65f('0x55')]){_0xad0818[_0xd65f('0x56')]=[{'all':!![]}];}return db['FaxMessage'][_0xd65f('0x69')](_0xad0818);})['then'](function(_0x5975d3){_0x3b5884[_0xd65f('0x57')]=_0x5975d3;return _0x3b5884;});}})[_0xd65f('0x22')](respondWithFilteredResult(_0x16d933,_0xad0818))[_0xd65f('0x2d')](handleError(_0x16d933,null));};exports['send']=function(_0x215e9f,_0x4f9ba5,_0x40935f){var _0x6447bb,_0x5164e7={},_0x1203dc;if(_0x215e9f['body']['to']){_0x1203dc=_0x215e9f[_0xd65f('0x5c')]['to'][0x0];}return db['FaxAccount'][_0xd65f('0x60')]({'where':{'id':_0x215e9f[_0xd65f('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xd65f('0xa5'),'include':[{'model':db[_0xd65f('0xa6')],'as':_0xd65f('0xa7'),'where':{'fax':_0x1203dc},'limit':0x1,'order':[[_0xd65f('0x9d'),_0xd65f('0xa8')]]}]}]})[_0xd65f('0x22')](handleEntityNotFound(_0x4f9ba5,null))[_0xd65f('0x22')](function(_0x37498f){_0x6447bb=_0x37498f;if(_0x215e9f[_0xd65f('0x5c')]['attachments']&&_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][_0xd65f('0x4c')]){for(var _0x228eb4=0x0;_0x228eb4<_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][_0xd65f('0x4c')];_0x228eb4+=0x1){_0x215e9f[_0xd65f('0x5c')]['attachments'][_0x228eb4]={'filename':_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][_0x228eb4][_0xd65f('0x3c')],'id':_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][_0x228eb4]['id'],'path':path['join'](config['root'],_0xd65f('0xaa'),_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][_0x228eb4][_0xd65f('0xab')])};}}return respondWithRpcPromise(_0xd65f('0xac'),_0xd65f('0xac'),{'FaxAccountId':_[_0xd65f('0xad')](_0x215e9f[_0xd65f('0x58')]['id'])?undefined:_0x215e9f[_0xd65f('0x58')]['id'],'path':_['isNil'](_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][0x0]['path'])?undefined:_0x215e9f[_0xd65f('0x5c')]['attachments'][0x0][_0xd65f('0x7')],'fax':_[_0xd65f('0xad')](_0x215e9f[_0xd65f('0x5c')]['to'][0x0])?undefined:_0x215e9f[_0xd65f('0x5c')]['to'][0x0]},client9002);})[_0xd65f('0x22')](function(){if(_0x6447bb){if(_[_0xd65f('0xad')](_0x215e9f['body'][_0xd65f('0xae')])){_0x215e9f[_0xd65f('0x5c')]['from']=util[_0xd65f('0xa3')](_0xd65f('0xaf'),_0x6447bb['name'],_0x6447bb['fax']);}if(_0x6447bb[_0xd65f('0xa5')]){if(_0x6447bb[_0xd65f('0xa5')][_0xd65f('0xa7')][_0xd65f('0x4c')]){return _0x6447bb['List']['Contacts'][0x0];}else{return db[_0xd65f('0xa6')]['create'](_[_0xd65f('0x19')](_0x215e9f[_0xd65f('0x5c')],{'firstName':_0x215e9f[_0xd65f('0x5c')]['to'][0x0],'phone':_0x215e9f['body']['to'][0x0],'fax':_0x215e9f[_0xd65f('0x5c')]['to'][0x0],'ListId':_0x6447bb[_0xd65f('0x9e')]}));}}else{throw new Error(_0xd65f('0xb0'));}}else{throw new Error(_0xd65f('0xb1'));}})[_0xd65f('0x22')](function(_0x12429a){if(_0x12429a){return db[_0xd65f('0x6f')][_0xd65f('0x60')]({'where':{'ContactId':_0x12429a['id'],'closed':![],'FaxAccountId':_0x6447bb['id']}})[_0xd65f('0x22')](function(_0x318e4b){if(_0x318e4b){return[_0x318e4b,![]];}return db[_0xd65f('0x6f')][_0xd65f('0x5b')]({'UserId':_0x215e9f[_0xd65f('0x5e')]['id'],'ContactId':_0x12429a['id'],'FaxAccountId':_0x6447bb['id'],'fax':_0x215e9f[_0xd65f('0x5c')]['to'][0x0],'firstMsgDirection':_0xd65f('0xb2'),'Messages':[_[_0xd65f('0x53')](_0x215e9f[_0xd65f('0x5c')],{'read':![],'body':_0x215e9f['body']['attachments'][0x0][_0xd65f('0xb3')],'FaxAccountId':_0x6447bb['id'],'UserId':_0x215e9f[_0xd65f('0x5e')]['id'],'ContactId':_0x12429a['id'],'AttachmentId':_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xd65f('0xa1')],'as':_0xd65f('0xb4')}]})[_0xd65f('0x22')](function(_0x126b93){return[_0x126b93,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd65f('0xb5')](function(_0x516275,_0x4e82dc){if(_0x4e82dc){return _0x516275;}return db[_0xd65f('0xa1')][_0xd65f('0x5b')]({'direction':_0xd65f('0xb2'),'read':![],'body':_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][0x0]['filename'],'FaxAccountId':_0x6447bb['id'],'FaxInteractionId':_0x516275['id'],'UserId':_0x215e9f[_0xd65f('0x5e')]['id'],'ContactId':_0x516275[_0xd65f('0xb6')],'AttachmentId':_0x215e9f['body'][_0xd65f('0xa9')][0x0]['id']})[_0xd65f('0x22')](function(_0x1ecc78){_0x516275['dataValues'][_0xd65f('0xb4')]=[];_0x516275['dataValues'][_0xd65f('0xb4')][_0xd65f('0x8a')](_0x1ecc78[_0xd65f('0xb7')]);return _0x516275;});})['then'](function(_0x3f14e0){respondWithRpcPromise(_0xd65f('0xb8'),'SendFax',{'FaxAccountId':_[_0xd65f('0xad')](_0x215e9f[_0xd65f('0x58')]['id'])?undefined:_0x215e9f[_0xd65f('0x58')]['id'],'path':_[_0xd65f('0xad')](_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][0x0]['path'])?undefined:_0x215e9f[_0xd65f('0x5c')][_0xd65f('0xa9')][0x0]['path'],'fax':_[_0xd65f('0xad')](_0x215e9f[_0xd65f('0x5c')]['to'][0x0])?undefined:_0x215e9f['body']['to'][0x0],'AttachmentId':_0x215e9f[_0xd65f('0x5c')]['attachments'][0x0]['id']},client9002)['then'](function(_0x3c42e7){logger[_0xd65f('0x23')](_0xd65f('0xb9'),_0x3c42e7);})[_0xd65f('0x2d')](function(_0x103ca7){logger[_0xd65f('0x23')](_0xd65f('0xb9'),_0x103ca7);});return _0x3f14e0;})['then'](respondWithResult(_0x4f9ba5,null))[_0xd65f('0x2d')](handleError(_0x4f9ba5,null));};exports[_0xd65f('0xba')]=function(_0x17bced,_0x261e85,_0x567876){return db[_0xd65f('0x42')][_0xd65f('0x60')]({'where':{'id':_0x17bced[_0xd65f('0x58')]['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x261e85,null))['then'](function(_0x14d631){if(_0x14d631){return _0x14d631[_0xd65f('0xba')](_0x17bced[_0xd65f('0x5c')][_0xd65f('0x72')],_['omit'](_0x17bced['body'],[_0xd65f('0x72'),'id'])||{})[_0xd65f('0xb5')](function(_0x393e86){for(var _0x3829aa=0x0;_0x3829aa<_0x17bced['body'][_0xd65f('0x72')]['length'];_0x3829aa+=0x1){socket['emit'](_0xd65f('0xbb'),{'UserId':_0x17bced[_0xd65f('0x5c')]['ids'][_0x3829aa],'FaxAccountId':_0x17bced['params']['id']});}return _0x393e86;});}})[_0xd65f('0x22')](respondWithResult(_0x261e85,null))['catch'](handleError(_0x261e85,null));};exports[_0xd65f('0xbc')]=function(_0x2334d2,_0x4a9076,_0x330ebb){return db[_0xd65f('0x42')]['find']({'where':{'id':_0x2334d2[_0xd65f('0x58')]['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x4a9076,null))[_0xd65f('0x22')](function(_0x328a9f){if(_0x328a9f){return _0x328a9f[_0xd65f('0xbc')](_0x2334d2[_0xd65f('0x46')][_0xd65f('0x72')])[_0xd65f('0x22')](function(){if(_[_0xd65f('0xbd')](_0x2334d2['query']['ids'])){for(var _0x37a04e=0x0;_0x37a04e<_0x2334d2[_0xd65f('0x46')][_0xd65f('0x72')][_0xd65f('0x4c')];_0x37a04e+=0x1){socket[_0xd65f('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x2334d2[_0xd65f('0x46')][_0xd65f('0x72')][_0x37a04e]),'FaxAccountId':Number(_0x2334d2[_0xd65f('0x58')]['id'])});}}else{socket[_0xd65f('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x2334d2['query'][_0xd65f('0x72')]),'FaxAccountId':Number(_0x2334d2[_0xd65f('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a9076,null))[_0xd65f('0x2d')](handleError(_0x4a9076,null));};exports[_0xd65f('0xbf')]=function(_0x237b17,_0x16f137,_0x5f571e){var _0x17648a={};var _0x1d3e35={};var _0x5d1531;var _0x3a356b;return db['FaxAccount'][_0xd65f('0x65')]({'where':{'id':_0x237b17['params']['id']}})[_0xd65f('0x22')](handleEntityNotFound(_0x16f137,null))[_0xd65f('0x22')](function(_0x19aef0){if(_0x19aef0){_0x5d1531=_0x19aef0;_0x1d3e35[_0xd65f('0x48')]=_['keys'](db['User']['rawAttributes']);_0x1d3e35[_0xd65f('0x46')]=_['keys'](_0x237b17['query']);_0x1d3e35['filters']=_[_0xd65f('0x4a')](_0x1d3e35[_0xd65f('0x48')],_0x1d3e35['query']);_0x17648a[_0xd65f('0x49')]=_['intersection'](_0x1d3e35['model'],qs[_0xd65f('0x4b')](_0x237b17[_0xd65f('0x46')][_0xd65f('0x4b')]));_0x17648a[_0xd65f('0x49')]=_0x17648a[_0xd65f('0x49')][_0xd65f('0x4c')]?_0x17648a[_0xd65f('0x49')]:_0x1d3e35[_0xd65f('0x48')];_0x17648a[_0xd65f('0x67')]=qs[_0xd65f('0x4f')](_0x237b17[_0xd65f('0x46')][_0xd65f('0x4f')]);_0x17648a[_0xd65f('0x50')]=qs[_0xd65f('0x47')](_[_0xd65f('0x51')](_0x237b17[_0xd65f('0x46')],_0x1d3e35[_0xd65f('0x47')]));if(_0x237b17['query'][_0xd65f('0x52')]){_0x17648a[_0xd65f('0x50')]=_[_0xd65f('0x53')](_0x17648a[_0xd65f('0x50')],{'$or':_['map'](_0x17648a[_0xd65f('0x49')],function(_0x198adb){var _0x3ed561={};_0x3ed561[_0x198adb]={'$like':'%'+_0x237b17[_0xd65f('0x46')]['filter']+'%'};return _0x3ed561;})});}_0x17648a=_[_0xd65f('0x53')]({},_0x17648a,_0x237b17[_0xd65f('0x5a')]);return _0x5d1531['getAgents'](_0x17648a);}})['then'](function(_0x367afd){if(_0x367afd){_0x3a356b=_0x367afd[_0xd65f('0x4c')];if(!_0x237b17[_0xd65f('0x46')][_0xd65f('0x4d')]('nolimit')){_0x17648a['limit']=qs[_0xd65f('0x33')](_0x237b17['query'][_0xd65f('0x33')]);_0x17648a['offset']=qs['offset'](_0x237b17['query'][_0xd65f('0x32')]);}return _0x5d1531['getAgents'](_0x17648a);}})[_0xd65f('0x22')](function(_0x5ce7f1){if(_0x5ce7f1){return _0x5ce7f1?{'count':_0x3a356b,'rows':_0x5ce7f1}:null;}})[_0xd65f('0x22')](respondWithResult(_0x16f137,null))[_0xd65f('0x2d')](handleError(_0x16f137,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ee630b4..83c60c3 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 _0x5f4b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5f4b,0x1b3));var _0xb5f4=function(_0x435a2e,_0x2239a3){_0x435a2e=_0x435a2e-0x0;var _0x3d163f=_0x5f4b[_0x435a2e];return _0x3d163f;};'use strict';var EventEmitter=require(_0xb5f4('0x0'));var FaxAccount=require(_0xb5f4('0x1'))['db'][_0xb5f4('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb5f4('0x3')](0x0);var events={'afterCreate':_0xb5f4('0x4'),'afterUpdate':_0xb5f4('0x5'),'afterDestroy':_0xb5f4('0x6')};function emitEvent(_0x4ab8a0){return function(_0x2f9b26,_0x182725,_0x1da6b3){FaxAccountEvents[_0xb5f4('0x7')](_0x4ab8a0+':'+_0x2f9b26['id'],_0x2f9b26);FaxAccountEvents[_0xb5f4('0x7')](_0x4ab8a0,_0x2f9b26);_0x1da6b3(null);};}for(var e in events){if(events[_0xb5f4('0x8')](e)){var event=events[e];FaxAccount[_0xb5f4('0x9')](e,emitEvent(event));}}module[_0xb5f4('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0x3a15=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x378857,_0x1e1343){var _0xbdb505=function(_0x2bdb26){while(--_0x2bdb26){_0x378857['push'](_0x378857['shift']());}};_0xbdb505(++_0x1e1343);}(_0x3a15,0x113));var _0x53a1=function(_0x5c6acd,_0x475638){_0x5c6acd=_0x5c6acd-0x0;var _0x20bb67=_0x3a15[_0x5c6acd];return _0x20bb67;};'use strict';var EventEmitter=require(_0x53a1('0x0'));var FaxAccount=require(_0x53a1('0x1'))['db'][_0x53a1('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x53a1('0x3')](0x0);var events={'afterCreate':_0x53a1('0x4'),'afterUpdate':_0x53a1('0x5'),'afterDestroy':_0x53a1('0x6')};function emitEvent(_0x27600b){return function(_0x34f1f7,_0x371e9c,_0x5e8ed4){FaxAccountEvents['emit'](_0x27600b+':'+_0x34f1f7['id'],_0x34f1f7);FaxAccountEvents[_0x53a1('0x7')](_0x27600b,_0x34f1f7);_0x5e8ed4(null);};}for(var e in events){if(events[_0x53a1('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x53a1('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 04e3f55..1d4a116 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 _0x3984=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x3984,0x1a0));var _0x4398=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x3984[_0x5e3701];return _0x345dcf;};'use strict';var _=require(_0x4398('0x0'));var util=require(_0x4398('0x1'));var logger=require(_0x4398('0x2'))(_0x4398('0x3'));var moment=require(_0x4398('0x4'));var BPromise=require(_0x4398('0x5'));var rp=require(_0x4398('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4398('0x7'));var config=require(_0x4398('0x8'));var attributes=require(_0x4398('0x9'));module[_0x4398('0xa')]=function(_0x4d1a20,_0x28ec2d){return _0x4d1a20[_0x4398('0xb')](_0x4398('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ca=['util','../../config/logger','api','moment','bluebird','../../config/environment','./faxAccount.attributes','fax_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4ca,0x198));var _0xaf4c=function(_0xa2582b,_0x229036){_0xa2582b=_0xa2582b-0x0;var _0x1c00e9=_0xf4ca[_0xa2582b];return _0x1c00e9;};'use strict';var _=require('lodash');var util=require(_0xaf4c('0x0'));var logger=require(_0xaf4c('0x1'))(_0xaf4c('0x2'));var moment=require(_0xaf4c('0x3'));var BPromise=require(_0xaf4c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaf4c('0x5'));var attributes=require(_0xaf4c('0x6'));module['exports']=function(_0x486f7c,_0x356b07){return _0x486f7c['define']('FaxAccount',attributes,{'tableName':_0xaf4c('0x7'),'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 c3a8f20..c1abef6 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 _0x5ac7=['find','CmList','List','Contacts','get','account','Applications','list','applications','orderBy','priority','asc','length','ListId','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','request\x20sent','debug','stringify','code','FaxAccount,\x20%s,\x20%s','error','message','result','catch','GetFaxAccount','FaxAccount','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','body','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x167681,_0x5a5049){var _0x1fadf3=function(_0x2ca03a){while(--_0x2ca03a){_0x167681['push'](_0x167681['shift']());}};_0x1fadf3(++_0x5a5049);}(_0x5ac7,0x191));var _0x75ac=function(_0x23175d,_0x403d6e){_0x23175d=_0x23175d-0x0;var _0x147649=_0x5ac7[_0x23175d];return _0x147649;};'use strict';var _=require(_0x75ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x75ac('0x1'));var rs=require(_0x75ac('0x2'));var fs=require('fs');var Redis=require(_0x75ac('0x3'));var db=require(_0x75ac('0x4'))['db'];var utils=require(_0x75ac('0x5'));var logger=require(_0x75ac('0x6'))(_0x75ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x75ac('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x75ac('0x9')]=_[_0x75ac('0xa')](config[_0x75ac('0x9')],{'host':_0x75ac('0xb'),'port':0x18eb});var socket=require(_0x75ac('0xc'))(new Redis(config[_0x75ac('0x9')]));require(_0x75ac('0xd'))['register'](socket);function respondWithRpcPromise(_0x31dadf,_0x4ef647,_0x1f96f8){return new BPromise(function(_0x535b2f,_0x1ce4fc){return client[_0x75ac('0xe')](_0x31dadf,_0x1f96f8)[_0x75ac('0xf')](function(_0x3c2691){logger[_0x75ac('0x10')]('FaxAccount,\x20%s,\x20%s',_0x4ef647,_0x75ac('0x11'));logger[_0x75ac('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4ef647,'request\x20sent',JSON[_0x75ac('0x13')](_0x3c2691));if(_0x3c2691['error']){if(_0x3c2691['error'][_0x75ac('0x14')]===0x1f4){logger['error'](_0x75ac('0x15'),_0x4ef647,_0x3c2691['error']['message']);return _0x1ce4fc(_0x3c2691[_0x75ac('0x16')][_0x75ac('0x17')]);}logger[_0x75ac('0x16')]('FaxAccount,\x20%s,\x20%s',_0x4ef647,_0x3c2691[_0x75ac('0x16')][_0x75ac('0x17')]);return _0x535b2f(_0x3c2691[_0x75ac('0x16')]['message']);}else{logger[_0x75ac('0x10')](_0x75ac('0x15'),_0x4ef647,'request\x20sent');_0x535b2f(_0x3c2691[_0x75ac('0x18')]['message']);}})[_0x75ac('0x19')](function(_0x25c761){logger[_0x75ac('0x16')](_0x75ac('0x15'),_0x4ef647,_0x25c761);_0x1ce4fc(_0x25c761);});});}exports[_0x75ac('0x1a')]=function(_0x1f0e7b){var _0x49c8b5=this;return new Promise(function(_0x369542,_0x2e9ec7){return db[_0x75ac('0x1b')]['findAll']({'raw':_0x1f0e7b[_0x75ac('0x1c')]?_0x1f0e7b[_0x75ac('0x1c')][_0x75ac('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f0e7b['options']?_0x1f0e7b[_0x75ac('0x1c')]['where']||null:null,'attributes':_0x1f0e7b['options']?_0x1f0e7b[_0x75ac('0x1c')][_0x75ac('0x1e')]||null:null,'limit':_0x1f0e7b[_0x75ac('0x1c')]?_0x1f0e7b['options'][_0x75ac('0x1f')]||null:null,'include':_0x1f0e7b[_0x75ac('0x1c')]?_0x1f0e7b[_0x75ac('0x1c')][_0x75ac('0x20')]?_['map'](_0x1f0e7b[_0x75ac('0x1c')][_0x75ac('0x20')],function(_0x49bdb6){return{'model':db[_0x49bdb6['model']],'as':_0x49bdb6['as'],'attributes':_0x49bdb6[_0x75ac('0x1e')],'include':_0x49bdb6[_0x75ac('0x20')]?_[_0x75ac('0x21')](_0x49bdb6[_0x75ac('0x20')],function(_0x5baa48){return{'model':db[_0x5baa48[_0x75ac('0x22')]],'as':_0x5baa48['as'],'attributes':_0x5baa48['attributes'],'include':_0x5baa48[_0x75ac('0x20')]?_[_0x75ac('0x21')](_0x5baa48[_0x75ac('0x20')],function(_0x142030){return{'model':db[_0x142030[_0x75ac('0x22')]],'as':_0x142030['as'],'attributes':_0x142030['attributes']};}):[]};}):[]};}):[]:[]})[_0x75ac('0xf')](function(_0x177fb2){logger[_0x75ac('0x10')](_0x75ac('0x1a'),_0x1f0e7b);logger[_0x75ac('0x12')]('GetFaxAccount',_0x1f0e7b,JSON[_0x75ac('0x13')](_0x177fb2));_0x369542(_0x177fb2);})[_0x75ac('0x19')](function(_0xdf6661){logger[_0x75ac('0x16')](_0x75ac('0x1a'),_0xdf6661[_0x75ac('0x17')],_0x1f0e7b);_0x2e9ec7(_0x49c8b5[_0x75ac('0x16')](0x1f4,_0xdf6661[_0x75ac('0x17')]));});});};exports[_0x75ac('0x23')]=function(_0x352094,_0x3bc71a,_0x260ca9){var _0x1b873f=this;return new Promise(function(_0xae4b7,_0x15b714){var _0x2bdb5a={'body':_0x352094['body'],'channel':'fax'};var _0x1d90b5=[];var _0x874753=[];var _0x19f7fb={};return db[_0x75ac('0x24')][_0x75ac('0x25')]()[_0x75ac('0xf')](function(_0x2fd64a){if(!_0x2fd64a){throw new db[(_0x75ac('0x26'))][(_0x75ac('0x27'))](_0x75ac('0x28'));}_0x1d90b5=_[_0x75ac('0x29')](_[_0x75ac('0x2a')](_0x2fd64a),['createdAt',_0x75ac('0x2b')]);_0x874753=_[_0x75ac('0x29')](_['keys'](_0x2fd64a),[_0x75ac('0x2c'),_0x75ac('0x2b'),_0x75ac('0x2d'),'ListId']);if(_0x352094[_0x75ac('0x2e')]['id']){delete _0x352094[_0x75ac('0x2e')]['id'];}if(_[_0x75ac('0x2f')](_0x352094[_0x75ac('0x2e')][_0x75ac('0x30')])){throw new db['Sequelize'][(_0x75ac('0x27'))](_0x75ac('0x31'));}if(_[_0x75ac('0x2f')](_0x352094['body']['body'])||_0x352094[_0x75ac('0x2e')][_0x75ac('0x2e')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x75ac('0x2f')](_0x352094[_0x75ac('0x2e')][_0x75ac('0x32')])){throw new db[(_0x75ac('0x26'))][(_0x75ac('0x27'))](_0x75ac('0x33')+_0x874753);}if(!_[_0x75ac('0x34')](_0x874753,_0x352094[_0x75ac('0x2e')][_0x75ac('0x32')])){throw new db[(_0x75ac('0x26'))][(_0x75ac('0x27'))](_0x75ac('0x35')+_0x874753);}_0x19f7fb[_0x352094['body'][_0x75ac('0x32')]]=_0x352094[_0x75ac('0x2e')][_0x75ac('0x30')];})[_0x75ac('0xf')](function(){return db[_0x75ac('0x1b')][_0x75ac('0x36')]({'where':{'id':_0x352094['account']['id']},'include':[{'model':db[_0x75ac('0x37')],'as':_0x75ac('0x38'),'include':[{'model':db[_0x75ac('0x24')],'as':_0x75ac('0x39'),'where':_0x19f7fb,'limit':0x1,'order':[[_0x75ac('0x2b'),'DESC']]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})['then'](function(_0x5e7cf2){if(_0x5e7cf2&&_0x5e7cf2['List']){var _0x3aff6a=_0x5e7cf2[_0x75ac('0x3a')]({'plain':!![]});_0x2bdb5a[_0x75ac('0x3b')]=_0x3aff6a;_0x2bdb5a['applications']=_0x3aff6a[_0x75ac('0x3c')];_0x2bdb5a[_0x75ac('0x3d')]=_0x3aff6a[_0x75ac('0x38')];_0x2bdb5a[_0x75ac('0x3e')]=_[_0x75ac('0x3f')](_0x2bdb5a[_0x75ac('0x3e')],[_0x75ac('0x40')],[_0x75ac('0x41')]);if(_0x2bdb5a[_0x75ac('0x3b')][_0x75ac('0x3c')]){delete _0x2bdb5a[_0x75ac('0x3b')]['Applications'];}if(_0x2bdb5a[_0x75ac('0x3b')][_0x75ac('0x38')]&&_0x2bdb5a['account'][_0x75ac('0x38')][_0x75ac('0x39')][_0x75ac('0x42')]){return _0x2bdb5a[_0x75ac('0x3b')][_0x75ac('0x38')][_0x75ac('0x39')][0x0];}var _0x329bda=_[_0x75ac('0xa')](_0x352094[_0x75ac('0x2e')],{'firstName':_0x352094[_0x75ac('0x2e')][_0x75ac('0x30')],'ListId':_0x3aff6a[_0x75ac('0x43')]});_0x329bda[_0x352094[_0x75ac('0x2e')]['mapKey']]=_0x352094[_0x75ac('0x2e')][_0x75ac('0x30')];return db[_0x75ac('0x24')][_0x75ac('0x44')](_0x329bda,{'fields':_0x1d90b5,'raw':!![]});}})[_0x75ac('0xf')](function(_0x5a5597){_0x2bdb5a[_0x75ac('0x45')]=_0x5a5597;if(_0x5a5597){var _0x11719e={'ContactId':_0x5a5597['id'],'FaxAccountId':_0x352094[_0x75ac('0x3b')]['id'],'fax':_0x5a5597[_0x75ac('0x46')]};return db[_0x75ac('0x47')][_0x75ac('0x36')]({'where':{'ContactId':_0x5a5597['id'],'closed':![],'FaxAccountId':_0x352094[_0x75ac('0x3b')]['id']}})[_0x75ac('0xf')](function(_0x119d35){if(_0x119d35){return[_0x119d35,![]];}return db[_0x75ac('0x47')][_0x75ac('0x44')](_0x11719e)['then'](function(_0x4294ae){return[_0x4294ae,!![]];});});}else{throw new Error(_0x75ac('0x48'));}})[_0x75ac('0x49')](function(_0x3dd88c,_0x1f1b49){var _0x31a35d=_0x3dd88c['get']({'plain':!![]});if(_0x1f1b49){if(_0x2bdb5a[_0x75ac('0x3b')][_0x75ac('0x4a')]){_0x2bdb5a[_0x75ac('0x3e')][_0x75ac('0x4b')]({'id':0x0,'priority':_0x2bdb5a['applications'][_0x75ac('0x42')]+0x1,'app':_0x75ac('0x4c'),'appdata':_0x75ac('0x4d'),'interval':_0x75ac('0x4e')});}_0x31a35d[_0x75ac('0x4f')]=!![];}else{_0x31a35d[_0x75ac('0x4f')]=![];}_0x2bdb5a[_0x75ac('0x50')]=_0x31a35d;return db[_0x75ac('0x51')][_0x75ac('0x44')]({'body':_0x352094[_0x75ac('0x2e')][_0x75ac('0x2e')],'FaxAccountId':_0x352094[_0x75ac('0x3b')]['id'],'FaxInteractionId':_0x3dd88c['id'],'direction':'in','ContactId':_0x3dd88c[_0x75ac('0x52')],'AttachmentId':_0x352094[_0x75ac('0x2e')][_0x75ac('0x53')]});})[_0x75ac('0xf')](function(_0x302400){_0x2bdb5a[_0x75ac('0x17')]=_0x302400;if(_0x2bdb5a[_0x75ac('0x50')]['UserId']){return db[_0x75ac('0x54')][_0x75ac('0x36')]({'attributes':['id',_0x75ac('0x55')],'where':{'id':_0x2bdb5a[_0x75ac('0x50')]['UserId']}})[_0x75ac('0xf')](function(_0x664bfb){if(_0x664bfb){_0x2bdb5a['applications'][_0x75ac('0x56')]({'id':0x0,'priority':0x0,'app':_0x75ac('0x57'),'appdata':_0x664bfb['name']+','+(_0x2bdb5a[_0x75ac('0x3b')][_0x75ac('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x75ac('0x59'),_0x75ac('0x5a'),_0x2bdb5a);});}return respondWithRpcPromise(_0x75ac('0x59'),_0x75ac('0x5a'),_0x2bdb5a);})['then'](function(_0x6cc309){_0xae4b7(_0x6cc309);})[_0x75ac('0x19')](function(_0x526e54){_0x15b714(_0x1b873f['error'](0x1f4,_0x526e54[_0x75ac('0x17')]));});});}; \ No newline at end of file +var _0xf278=['Contact\x20not\x20found','spread','push','close','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','map','include','model','then','GetFaxAccount','debug','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','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','find','account','List','CmContact','DESC','FaxApplication','Applications','get','applications','priority','asc','length','Contacts','contact','FaxInteraction','create'];(function(_0x212807,_0x16c5cb){var _0x1a6b19=function(_0x2146ca){while(--_0x2146ca){_0x212807['push'](_0x212807['shift']());}};_0x1a6b19(++_0x16c5cb);}(_0xf278,0xc8));var _0x8f27=function(_0x2d398b,_0x5e98f8){_0x2d398b=_0x2d398b-0x0;var _0x5d8b9d=_0xf278[_0x2d398b];return _0x5d8b9d;};'use strict';var _=require(_0x8f27('0x0'));var util=require(_0x8f27('0x1'));var moment=require(_0x8f27('0x2'));var BPromise=require(_0x8f27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f27('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f27('0x5'));var logger=require(_0x8f27('0x6'))(_0x8f27('0x7'));var config=require(_0x8f27('0x8'));var jayson=require(_0x8f27('0x9'));var client=jayson['client'][_0x8f27('0xa')]({'port':0x232c});config[_0x8f27('0xb')]=_[_0x8f27('0xc')](config['redis'],{'host':_0x8f27('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8f27('0xe'))[_0x8f27('0xf')](socket);function respondWithRpcPromise(_0x22b449,_0x1b5862,_0x14d0f7){return new BPromise(function(_0x43a06f,_0x1a7f9e){return client['request'](_0x22b449,_0x14d0f7)['then'](function(_0x147147){logger[_0x8f27('0x10')](_0x8f27('0x11'),_0x1b5862,_0x8f27('0x12'));logger['debug'](_0x8f27('0x13'),_0x1b5862,_0x8f27('0x12'),JSON[_0x8f27('0x14')](_0x147147));if(_0x147147[_0x8f27('0x15')]){if(_0x147147[_0x8f27('0x15')][_0x8f27('0x16')]===0x1f4){logger[_0x8f27('0x15')](_0x8f27('0x11'),_0x1b5862,_0x147147[_0x8f27('0x15')][_0x8f27('0x17')]);return _0x1a7f9e(_0x147147['error'][_0x8f27('0x17')]);}logger['error'](_0x8f27('0x11'),_0x1b5862,_0x147147['error'][_0x8f27('0x17')]);return _0x43a06f(_0x147147[_0x8f27('0x15')]['message']);}else{logger['info'](_0x8f27('0x11'),_0x1b5862,_0x8f27('0x12'));_0x43a06f(_0x147147[_0x8f27('0x18')][_0x8f27('0x17')]);}})[_0x8f27('0x19')](function(_0x1cc3ef){logger[_0x8f27('0x15')](_0x8f27('0x11'),_0x1b5862,_0x1cc3ef);_0x1a7f9e(_0x1cc3ef);});});}exports['GetFaxAccount']=function(_0x58d025){var _0x23274b=this;return new Promise(function(_0x1b026a,_0x109419){return db[_0x8f27('0x1a')][_0x8f27('0x1b')]({'raw':_0x58d025[_0x8f27('0x1c')]?_0x58d025[_0x8f27('0x1c')][_0x8f27('0x1d')]===undefined?!![]:![]:!![],'where':_0x58d025[_0x8f27('0x1c')]?_0x58d025[_0x8f27('0x1c')][_0x8f27('0x1e')]||null:null,'attributes':_0x58d025[_0x8f27('0x1c')]?_0x58d025[_0x8f27('0x1c')][_0x8f27('0x1f')]||null:null,'limit':_0x58d025[_0x8f27('0x1c')]?_0x58d025[_0x8f27('0x1c')]['limit']||null:null,'include':_0x58d025[_0x8f27('0x1c')]?_0x58d025[_0x8f27('0x1c')]['include']?_[_0x8f27('0x20')](_0x58d025[_0x8f27('0x1c')][_0x8f27('0x21')],function(_0x58cd54){return{'model':db[_0x58cd54[_0x8f27('0x22')]],'as':_0x58cd54['as'],'attributes':_0x58cd54['attributes'],'include':_0x58cd54[_0x8f27('0x21')]?_[_0x8f27('0x20')](_0x58cd54[_0x8f27('0x21')],function(_0x40f075){return{'model':db[_0x40f075[_0x8f27('0x22')]],'as':_0x40f075['as'],'attributes':_0x40f075[_0x8f27('0x1f')],'include':_0x40f075[_0x8f27('0x21')]?_['map'](_0x40f075[_0x8f27('0x21')],function(_0x1cb005){return{'model':db[_0x1cb005[_0x8f27('0x22')]],'as':_0x1cb005['as'],'attributes':_0x1cb005['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f27('0x23')](function(_0x36f7cc){logger['info'](_0x8f27('0x24'),_0x58d025);logger[_0x8f27('0x25')](_0x8f27('0x24'),_0x58d025,JSON[_0x8f27('0x14')](_0x36f7cc));_0x1b026a(_0x36f7cc);})[_0x8f27('0x19')](function(_0x5ae266){logger[_0x8f27('0x15')](_0x8f27('0x24'),_0x5ae266[_0x8f27('0x17')],_0x58d025);_0x109419(_0x23274b[_0x8f27('0x15')](0x1f4,_0x5ae266[_0x8f27('0x17')]));});});};exports[_0x8f27('0x26')]=function(_0x2081d5,_0x3b32c3,_0x3d1e8b){var _0x2c3a5a=this;return new Promise(function(_0x172ee7,_0x5c30b5){var _0x14dc22={'body':_0x2081d5[_0x8f27('0x27')],'channel':_0x8f27('0x28')};var _0x33d184=[];var _0x14fd60=[];var _0x34f2d3={};return db['CmContact'][_0x8f27('0x29')]()[_0x8f27('0x23')](function(_0x3e4426){if(!_0x3e4426){throw new db[(_0x8f27('0x2a'))][(_0x8f27('0x2b'))]('no\x20available\x20attributes');}_0x33d184=_[_0x8f27('0x2c')](_[_0x8f27('0x2d')](_0x3e4426),[_0x8f27('0x2e'),_0x8f27('0x2f')]);_0x14fd60=_[_0x8f27('0x2c')](_[_0x8f27('0x2d')](_0x3e4426),[_0x8f27('0x2e'),_0x8f27('0x2f'),_0x8f27('0x30'),_0x8f27('0x31')]);if(_0x2081d5[_0x8f27('0x27')]['id']){delete _0x2081d5[_0x8f27('0x27')]['id'];}if(_[_0x8f27('0x32')](_0x2081d5['body'][_0x8f27('0x33')])){throw new db[(_0x8f27('0x2a'))][(_0x8f27('0x2b'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2081d5[_0x8f27('0x27')]['body'])||_0x2081d5[_0x8f27('0x27')][_0x8f27('0x27')]===''){throw new db[(_0x8f27('0x2a'))]['ValidationError'](_0x8f27('0x34'));}if(_[_0x8f27('0x32')](_0x2081d5['body']['mapKey'])){throw new db[(_0x8f27('0x2a'))][(_0x8f27('0x2b'))](_0x8f27('0x35')+_0x14fd60);}if(!_[_0x8f27('0x36')](_0x14fd60,_0x2081d5[_0x8f27('0x27')][_0x8f27('0x37')])){throw new db[(_0x8f27('0x2a'))][(_0x8f27('0x2b'))](_0x8f27('0x38')+_0x14fd60);}_0x34f2d3[_0x2081d5[_0x8f27('0x27')][_0x8f27('0x37')]]=_0x2081d5[_0x8f27('0x27')][_0x8f27('0x33')];})[_0x8f27('0x23')](function(){return db[_0x8f27('0x1a')][_0x8f27('0x39')]({'where':{'id':_0x2081d5[_0x8f27('0x3a')]['id']},'include':[{'model':db['CmList'],'as':_0x8f27('0x3b'),'include':[{'model':db[_0x8f27('0x3c')],'as':'Contacts','where':_0x34f2d3,'limit':0x1,'order':[[_0x8f27('0x2f'),_0x8f27('0x3d')]]}]},{'model':db[_0x8f27('0x3e')],'as':_0x8f27('0x3f')}]});})[_0x8f27('0x23')](function(_0x321f9c){if(_0x321f9c&&_0x321f9c['List']){var _0x1e2965=_0x321f9c[_0x8f27('0x40')]({'plain':!![]});_0x14dc22['account']=_0x1e2965;_0x14dc22['applications']=_0x1e2965[_0x8f27('0x3f')];_0x14dc22['list']=_0x1e2965[_0x8f27('0x3b')];_0x14dc22[_0x8f27('0x41')]=_['orderBy'](_0x14dc22[_0x8f27('0x41')],[_0x8f27('0x42')],[_0x8f27('0x43')]);if(_0x14dc22['account']['Applications']){delete _0x14dc22[_0x8f27('0x3a')][_0x8f27('0x3f')];}if(_0x14dc22[_0x8f27('0x3a')][_0x8f27('0x3b')]&&_0x14dc22['account'][_0x8f27('0x3b')]['Contacts'][_0x8f27('0x44')]){return _0x14dc22['account']['List'][_0x8f27('0x45')][0x0];}var _0x12a75a=_[_0x8f27('0xc')](_0x2081d5['body'],{'firstName':_0x2081d5[_0x8f27('0x27')]['from'],'ListId':_0x1e2965[_0x8f27('0x31')]});_0x12a75a[_0x2081d5['body'][_0x8f27('0x37')]]=_0x2081d5[_0x8f27('0x27')][_0x8f27('0x33')];return db[_0x8f27('0x3c')]['create'](_0x12a75a,{'fields':_0x33d184,'raw':!![]});}})[_0x8f27('0x23')](function(_0x418afe){_0x14dc22[_0x8f27('0x46')]=_0x418afe;if(_0x418afe){var _0x6c35da={'ContactId':_0x418afe['id'],'FaxAccountId':_0x2081d5['account']['id'],'fax':_0x418afe[_0x8f27('0x28')]};return db[_0x8f27('0x47')]['find']({'where':{'ContactId':_0x418afe['id'],'closed':![],'FaxAccountId':_0x2081d5[_0x8f27('0x3a')]['id']}})[_0x8f27('0x23')](function(_0x2fec04){if(_0x2fec04){return[_0x2fec04,![]];}return db[_0x8f27('0x47')][_0x8f27('0x48')](_0x6c35da)[_0x8f27('0x23')](function(_0xb6ffd7){return[_0xb6ffd7,!![]];});});}else{throw new Error(_0x8f27('0x49'));}})[_0x8f27('0x4a')](function(_0x4d40de,_0x27e75a){var _0x3d0337=_0x4d40de['get']({'plain':!![]});if(_0x27e75a){if(_0x14dc22['account']['autoclose']){_0x14dc22[_0x8f27('0x41')][_0x8f27('0x4b')]({'id':0x0,'priority':_0x14dc22[_0x8f27('0x41')][_0x8f27('0x44')]+0x1,'app':_0x8f27('0x4c'),'appdata':'unmanaged','interval':_0x8f27('0x4d')});}_0x3d0337[_0x8f27('0x4e')]=!![];}else{_0x3d0337['created']=![];}_0x14dc22['interaction']=_0x3d0337;return db[_0x8f27('0x4f')][_0x8f27('0x48')]({'body':_0x2081d5[_0x8f27('0x27')]['body'],'FaxAccountId':_0x2081d5['account']['id'],'FaxInteractionId':_0x4d40de['id'],'direction':'in','ContactId':_0x4d40de[_0x8f27('0x50')],'AttachmentId':_0x2081d5['body'][_0x8f27('0x51')]});})['then'](function(_0x33b273){_0x14dc22[_0x8f27('0x17')]=_0x33b273;if(_0x14dc22[_0x8f27('0x52')][_0x8f27('0x53')]){return db[_0x8f27('0x54')][_0x8f27('0x39')]({'attributes':['id',_0x8f27('0x55')],'where':{'id':_0x14dc22['interaction'][_0x8f27('0x53')]}})[_0x8f27('0x23')](function(_0x5e5092){if(_0x5e5092){_0x14dc22[_0x8f27('0x41')][_0x8f27('0x56')]({'id':0x0,'priority':0x0,'app':_0x8f27('0x57'),'appdata':_0x5e5092[_0x8f27('0x55')]+','+(_0x14dc22[_0x8f27('0x3a')][_0x8f27('0x58')]||0xa),'interval':_0x8f27('0x4d')});}return respondWithRpcPromise(_0x8f27('0x59'),_0x8f27('0x5a'),_0x14dc22);});}return respondWithRpcPromise('Start',_0x8f27('0x5a'),_0x14dc22);})[_0x8f27('0x23')](function(_0x312d5d){_0x172ee7(_0x312d5d);})['catch'](function(_0x19ddfc){_0x5c30b5(_0x2c3a5a[_0x8f27('0x15')](0x1f4,_0x19ddfc[_0x8f27('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7030712..7e002f8 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 _0x47c5=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x47c5,0x165));var _0x547c=function(_0x4f8f68,_0x533f9b){_0x4f8f68=_0x4f8f68-0x0;var _0x41237d=_0x47c5[_0x4f8f68];return _0x41237d;};'use strict';var FaxAccountEvents=require(_0x547c('0x0'));var events=[_0x547c('0x1'),_0x547c('0x2'),_0x547c('0x3')];function createListener(_0x5fe74c,_0x3260c8){return function(_0x500b86){_0x3260c8[_0x547c('0x4')](_0x5fe74c,_0x500b86);};}function removeListener(_0x16f4db,_0x5b48c9){return function(){FaxAccountEvents[_0x547c('0x5')](_0x16f4db,_0x5b48c9);};}exports[_0x547c('0x6')]=function(_0x51ab7f){for(var _0x2e5b57=0x0,_0x439f25=events[_0x547c('0x7')];_0x2e5b57<_0x439f25;_0x2e5b57++){var _0x10a334=events[_0x2e5b57];var _0x12fb7d=createListener(_0x547c('0x8')+_0x10a334,_0x51ab7f);FaxAccountEvents['on'](_0x10a334,_0x12fb7d);}}; \ No newline at end of file +var _0xda2d=['remove','update','removeListener','register','length','faxAccount:','save'];(function(_0x24d799,_0x2367f2){var _0x2c409c=function(_0x5d85fd){while(--_0x5d85fd){_0x24d799['push'](_0x24d799['shift']());}};_0x2c409c(++_0x2367f2);}(_0xda2d,0x102));var _0xdda2=function(_0x284795,_0x148f39){_0x284795=_0x284795-0x0;var _0x3addb1=_0xda2d[_0x284795];return _0x3addb1;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2')];function createListener(_0x1f1fcc,_0x329c5e){return function(_0x58973d){_0x329c5e['emit'](_0x1f1fcc,_0x58973d);};}function removeListener(_0x5a5f9f,_0x357e97){return function(){FaxAccountEvents[_0xdda2('0x3')](_0x5a5f9f,_0x357e97);};}exports[_0xdda2('0x4')]=function(_0x39f6c9){for(var _0xc256bc=0x0,_0xf38e58=events[_0xdda2('0x5')];_0xc256bc<_0xf38e58;_0xc256bc++){var _0x436676=events[_0xc256bc];var _0x2e2523=createListener(_0xdda2('0x6')+_0x436676,_0x39f6c9);FaxAccountEvents['on'](_0x436676,_0x2e2523);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b80f0f8..b3741cb 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 _0xafb9=['/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','getAgents','post','create','addDisposition','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','send','/:id/users','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','util','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/dispositions'];(function(_0x13bc55,_0x5a0990){var _0x5cdaef=function(_0x68d1bc){while(--_0x68d1bc){_0x13bc55['push'](_0x13bc55['shift']());}};_0x5cdaef(++_0x5a0990);}(_0xafb9,0x128));var _0x9afb=function(_0x4f2b76,_0x5c5922){_0x4f2b76=_0x4f2b76-0x0;var _0x5601f1=_0xafb9[_0x4f2b76];return _0x5601f1;};'use strict';var multer=require('multer');var util=require(_0x9afb('0x0'));var path=require('path');var timeout=require(_0x9afb('0x1'));var express=require(_0x9afb('0x2'));var router=express[_0x9afb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9afb('0x4'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x9afb('0x5')]('/',auth[_0x9afb('0x6')](),controller['index']);router[_0x9afb('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9afb('0x5')](_0x9afb('0x7'),auth[_0x9afb('0x6')](),controller[_0x9afb('0x8')]);router[_0x9afb('0x5')](_0x9afb('0x9'),auth[_0x9afb('0x6')](),controller['getDispositions']);router[_0x9afb('0x5')](_0x9afb('0xa'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x9afb('0x5')](_0x9afb('0xb'),auth['isAuthenticated'](),controller[_0x9afb('0xc')]);router[_0x9afb('0x5')](_0x9afb('0xd'),auth[_0x9afb('0x6')](),controller['getApplications']);router[_0x9afb('0x5')](_0x9afb('0xe'),auth[_0x9afb('0x6')](),controller[_0x9afb('0xf')]);router[_0x9afb('0x5')]('/:id/users',auth[_0x9afb('0x6')](),controller[_0x9afb('0x10')]);router[_0x9afb('0x11')]('/',auth[_0x9afb('0x6')](),controller[_0x9afb('0x12')]);router['post'](_0x9afb('0x9'),auth[_0x9afb('0x6')](),controller[_0x9afb('0x13')]);router[_0x9afb('0x11')](_0x9afb('0xa'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x9afb('0xb'),auth[_0x9afb('0x6')](),controller[_0x9afb('0x14')]);router[_0x9afb('0x11')](_0x9afb('0xd'),auth[_0x9afb('0x6')](),controller[_0x9afb('0x15')]);router['post'](_0x9afb('0x16'),auth['isAuthenticated'](),controller[_0x9afb('0x17')]);router['post'](_0x9afb('0x18'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x9afb('0x19')]);router[_0x9afb('0x11')](_0x9afb('0x1a'),auth[_0x9afb('0x6')](),controller[_0x9afb('0x1b')]);router[_0x9afb('0x1c')](_0x9afb('0x7'),auth['isAuthenticated'](),controller[_0x9afb('0x1d')]);router['delete'](_0x9afb('0x7'),auth[_0x9afb('0x6')](),controller[_0x9afb('0x1e')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9afb('0x1f')](_0x9afb('0xa'),auth[_0x9afb('0x6')](),controller[_0x9afb('0x20')]);router[_0x9afb('0x1f')](_0x9afb('0x1a'),auth['isAuthenticated'](),controller[_0x9afb('0x21')]);module['exports']=router; \ No newline at end of file +var _0x31ec=['/:id','update','delete','removeDispositions','removeAnswers','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getMessages','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','/:id/users','addAgents'];(function(_0x56e911,_0x4e0aa2){var _0x455636=function(_0x2a7ef7){while(--_0x2a7ef7){_0x56e911['push'](_0x56e911['shift']());}};_0x455636(++_0x4e0aa2);}(_0x31ec,0x1a8));var _0xc31e=function(_0x3d3992,_0x510557){_0x3d3992=_0x3d3992-0x0;var _0x4b1d71=_0x31ec[_0x3d3992];return _0x4b1d71;};'use strict';var multer=require(_0xc31e('0x0'));var util=require(_0xc31e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc31e('0x2'));var router=express['Router']();var auth=require(_0xc31e('0x3'));var interaction=require(_0xc31e('0x4'));var config=require(_0xc31e('0x5'));var controller=require(_0xc31e('0x6'));router[_0xc31e('0x7')]('/',auth[_0xc31e('0x8')](),controller['index']);router[_0xc31e('0x7')](_0xc31e('0x9'),auth[_0xc31e('0x8')](),controller[_0xc31e('0xa')]);router['get']('/:id',auth[_0xc31e('0x8')](),controller[_0xc31e('0xb')]);router['get'](_0xc31e('0xc'),auth[_0xc31e('0x8')](),controller['getDispositions']);router[_0xc31e('0x7')](_0xc31e('0xd'),auth[_0xc31e('0x8')](),controller[_0xc31e('0xe')]);router['get'](_0xc31e('0xf'),auth[_0xc31e('0x8')](),controller['getInteractions']);router[_0xc31e('0x7')](_0xc31e('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0xc31e('0x7')]('/:id/messages',auth[_0xc31e('0x8')](),controller[_0xc31e('0x11')]);router[_0xc31e('0x7')]('/:id/users',auth[_0xc31e('0x8')](),controller[_0xc31e('0x12')]);router[_0xc31e('0x13')]('/',auth[_0xc31e('0x8')](),controller[_0xc31e('0x14')]);router[_0xc31e('0x13')](_0xc31e('0xc'),auth[_0xc31e('0x8')](),controller[_0xc31e('0x15')]);router['post'](_0xc31e('0xd'),auth[_0xc31e('0x8')](),controller[_0xc31e('0x16')]);router[_0xc31e('0x13')](_0xc31e('0xf'),auth[_0xc31e('0x8')](),controller[_0xc31e('0x17')]);router[_0xc31e('0x13')](_0xc31e('0x10'),auth['isAuthenticated'](),controller[_0xc31e('0x18')]);router[_0xc31e('0x13')](_0xc31e('0x19'),auth[_0xc31e('0x8')](),controller[_0xc31e('0x1a')]);router[_0xc31e('0x13')](_0xc31e('0x1b'),auth[_0xc31e('0x8')](),controller['updateAccountApplications']);router['post'](_0xc31e('0x1c'),auth[_0xc31e('0x8')](),controller[_0xc31e('0x1d')]);router[_0xc31e('0x13')](_0xc31e('0x1e'),auth[_0xc31e('0x8')](),controller[_0xc31e('0x1f')]);router['put'](_0xc31e('0x20'),auth[_0xc31e('0x8')](),controller[_0xc31e('0x21')]);router[_0xc31e('0x22')](_0xc31e('0x20'),auth[_0xc31e('0x8')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xc31e('0x8')](),controller[_0xc31e('0x23')]);router['delete'](_0xc31e('0xd'),auth[_0xc31e('0x8')](),controller[_0xc31e('0x24')]);router['delete'](_0xc31e('0x1e'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc31e('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6841b4b..9fe15da 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 _0x1537=['TEXT','sequelize','exports','STRING','noop'];(function(_0x541695,_0x708cb7){var _0xc48f9a=function(_0x3f81f6){while(--_0x3f81f6){_0x541695['push'](_0x541695['shift']());}};_0xc48f9a(++_0x708cb7);}(_0x1537,0x132));var _0x7153=function(_0x24728b,_0xa0d8d5){_0x24728b=_0x24728b-0x0;var _0x4232be=_0x1537[_0x24728b];return _0x4232be;};'use strict';var Sequelize=require(_0x7153('0x0'));module[_0x7153('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7153('0x2')],'allowNull':![],'defaultValue':_0x7153('0x3')},'appdata':{'type':Sequelize[_0x7153('0x4')]()},'description':{'type':Sequelize[_0x7153('0x2')]},'interval':{'type':Sequelize[_0x7153('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7c16=['noop','*,*,*,*','exports','STRING'];(function(_0x2c692e,_0x45c5f0){var _0x36ba57=function(_0x3f8106){while(--_0x3f8106){_0x2c692e['push'](_0x2c692e['shift']());}};_0x36ba57(++_0x45c5f0);}(_0x7c16,0x1c6));var _0x67c1=function(_0x384a65,_0x4a54b1){_0x384a65=_0x384a65-0x0;var _0x158090=_0x7c16[_0x384a65];return _0x158090;};'use strict';var Sequelize=require('sequelize');module[_0x67c1('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x67c1('0x1')],'allowNull':![],'defaultValue':_0x67c1('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x67c1('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x67c1('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 823676d..7bb99bf 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 _0x53ec=['stack','name','index','FaxApplication','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','show','rawAttributes','options','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x26e427,_0xf77698){var _0x53c8df=function(_0x2cc542){while(--_0x2cc542){_0x26e427['push'](_0x26e427['shift']());}};_0x53c8df(++_0xf77698);}(_0x53ec,0x192));var _0xc53e=function(_0x3f2621,_0x569366){_0x3f2621=_0x3f2621-0x0;var _0x43018c=_0x53ec[_0x3f2621];return _0x43018c;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc53e('0x15'))['db'];function respondWithStatusCode(_0x9ffbcb,_0x863fa){_0x863fa=_0x863fa||0xcc;return function(_0x4203aa){if(_0x4203aa){return _0x9ffbcb['sendStatus'](_0x863fa);}return _0x9ffbcb['status'](_0x863fa)[_0xc53e('0x16')]();};}function respondWithResult(_0x19a772,_0x7cd798){_0x7cd798=_0x7cd798||0xc8;return function(_0x3d2e17){if(_0x3d2e17){return _0x19a772[_0xc53e('0x17')](_0x7cd798)[_0xc53e('0x18')](_0x3d2e17);}};}function respondWithFilteredResult(_0x3dc2fa,_0x19c0d1){return function(_0x455e4d){if(_0x455e4d){var _0x2ad6eb=_0x455e4d[_0xc53e('0x19')],_0x5b0a88=_0x19c0d1[_0xc53e('0x1a')],_0x8a522e=_0x19c0d1[_0xc53e('0x1a')]+_0x19c0d1[_0xc53e('0x1b')],_0x191567;if(_0x8a522e>=_0x2ad6eb){_0x8a522e=_0x2ad6eb;_0x191567=0xc8;}else{_0x191567=0xce;}_0x3dc2fa[_0xc53e('0x17')](_0x191567);return _0x3dc2fa[_0xc53e('0x1c')](_0xc53e('0x1d'),_0x5b0a88+'-'+_0x8a522e+'/'+_0x2ad6eb)['json'](_0x455e4d);}return null;};}function patchUpdates(_0x546fab){return function(_0x35b7b2){try{jsonpatch[_0xc53e('0x1e')](_0x35b7b2,_0x546fab,!![]);}catch(_0x421641){return BPromise[_0xc53e('0x1f')](_0x421641);}return _0x35b7b2[_0xc53e('0x20')]();};}function saveUpdates(_0x2cfe2b,_0x15a015){return function(_0x25702b){if(_0x25702b){return _0x25702b[_0xc53e('0x21')](_0x2cfe2b)[_0xc53e('0x22')](function(_0x17d825){return _0x17d825;});}return null;};}function removeEntity(_0x44fd93,_0x426467){return function(_0x4fb695){if(_0x4fb695){return _0x4fb695['destroy']()['then'](function(){_0x44fd93[_0xc53e('0x17')](0xcc)[_0xc53e('0x16')]();});}};}function handleEntityNotFound(_0x7591c1,_0x4015c8){return function(_0x180811){if(!_0x180811){_0x7591c1['sendStatus'](0x194);}return _0x180811;};}function handleError(_0x5e5377,_0xe06e42){_0xe06e42=_0xe06e42||0x1f4;return function(_0x496167){logger[_0xc53e('0x23')](_0x496167[_0xc53e('0x24')]);if(_0x496167[_0xc53e('0x25')]){delete _0x496167[_0xc53e('0x25')];}_0x5e5377[_0xc53e('0x17')](_0xe06e42)['send'](_0x496167);};}exports[_0xc53e('0x26')]=function(_0x4b9f6a,_0x4d9a68){var _0x5c65d3={},_0x3c5056={},_0x57a1f5={'count':0x0,'rows':[]};var _0x28240a=_['map'](db[_0xc53e('0x27')]['rawAttributes'],function(_0x5ce216){return{'name':_0x5ce216[_0xc53e('0x28')],'type':_0x5ce216[_0xc53e('0x29')][_0xc53e('0x2a')]};});_0x3c5056[_0xc53e('0x2b')]=_[_0xc53e('0x2c')](_0x28240a,_0xc53e('0x25'));_0x3c5056[_0xc53e('0x2d')]=_[_0xc53e('0x2e')](_0x4b9f6a['query']);_0x3c5056[_0xc53e('0x2f')]=_[_0xc53e('0x30')](_0x3c5056[_0xc53e('0x2b')],_0x3c5056['query']);_0x5c65d3[_0xc53e('0x31')]=_['intersection'](_0x3c5056[_0xc53e('0x2b')],qs[_0xc53e('0x32')](_0x4b9f6a['query']['fields']));_0x5c65d3[_0xc53e('0x31')]=_0x5c65d3[_0xc53e('0x31')][_0xc53e('0x33')]?_0x5c65d3[_0xc53e('0x31')]:_0x3c5056[_0xc53e('0x2b')];if(!_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5c65d3['limit']=qs[_0xc53e('0x1b')](_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x1b')]);_0x5c65d3[_0xc53e('0x1a')]=qs[_0xc53e('0x1a')](_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x1a')]);}_0x5c65d3[_0xc53e('0x36')]=qs[_0xc53e('0x37')](_0x4b9f6a['query'][_0xc53e('0x37')]);_0x5c65d3['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x38')](_0x4b9f6a['query'],_0x3c5056[_0xc53e('0x2f')]),_0x28240a);if(_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x39')]){_0x5c65d3['where']=_[_0xc53e('0x3a')](_0x5c65d3[_0xc53e('0x3b')],{'$or':_[_0xc53e('0x2c')](_0x28240a,function(_0x78eb5e){if(_0x78eb5e[_0xc53e('0x29')]!==_0xc53e('0x3c')){var _0x312c1b={};_0x312c1b[_0x78eb5e['name']]={'$like':'%'+_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x39')]+'%'};return _0x312c1b;}})});}_0x5c65d3=_[_0xc53e('0x3a')]({},_0x5c65d3,_0x4b9f6a['options']);var _0x70b6c3={'where':_0x5c65d3['where']};return db[_0xc53e('0x27')][_0xc53e('0x19')](_0x70b6c3)[_0xc53e('0x22')](function(_0xad1232){_0x57a1f5[_0xc53e('0x19')]=_0xad1232;if(_0x4b9f6a['query'][_0xc53e('0x3d')]){_0x5c65d3[_0xc53e('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5c65d3);})['then'](function(_0x52cf0a){_0x57a1f5[_0xc53e('0x3f')]=_0x52cf0a;return _0x57a1f5;})[_0xc53e('0x22')](respondWithFilteredResult(_0x4d9a68,_0x5c65d3))['catch'](handleError(_0x4d9a68,null));};exports[_0xc53e('0x40')]=function(_0x574983,_0x55d07d){var _0x53447e={'raw':!![],'where':{'id':_0x574983['params']['id']}},_0x255794={};_0x255794['model']=_[_0xc53e('0x2e')](db['FaxApplication'][_0xc53e('0x41')]);_0x255794[_0xc53e('0x2d')]=_['keys'](_0x574983[_0xc53e('0x2d')]);_0x255794[_0xc53e('0x2f')]=_['intersection'](_0x255794[_0xc53e('0x2b')],_0x255794['query']);_0x53447e['attributes']=_['intersection'](_0x255794['model'],qs[_0xc53e('0x32')](_0x574983[_0xc53e('0x2d')][_0xc53e('0x32')]));_0x53447e['attributes']=_0x53447e[_0xc53e('0x31')][_0xc53e('0x33')]?_0x53447e['attributes']:_0x255794['model'];if(_0x574983[_0xc53e('0x2d')][_0xc53e('0x3d')]){_0x53447e[_0xc53e('0x3e')]=[{'all':!![]}];}_0x53447e=_['merge']({},_0x53447e,_0x574983[_0xc53e('0x42')]);return db[_0xc53e('0x27')][_0xc53e('0x43')](_0x53447e)[_0xc53e('0x22')](handleEntityNotFound(_0x55d07d,null))[_0xc53e('0x22')](respondWithResult(_0x55d07d,null))[_0xc53e('0x44')](handleError(_0x55d07d,null));};exports[_0xc53e('0x45')]=function(_0x49b2e8,_0xed757e){return db[_0xc53e('0x27')][_0xc53e('0x45')](_0x49b2e8['body'],{})[_0xc53e('0x22')](respondWithResult(_0xed757e,0xc9))[_0xc53e('0x44')](handleError(_0xed757e,null));};exports[_0xc53e('0x21')]=function(_0x15e744,_0xa7d256){if(_0x15e744[_0xc53e('0x46')]['id']){delete _0x15e744['body']['id'];}return db[_0xc53e('0x27')][_0xc53e('0x43')]({'where':{'id':_0x15e744[_0xc53e('0x47')]['id']}})['then'](handleEntityNotFound(_0xa7d256,null))[_0xc53e('0x22')](saveUpdates(_0x15e744[_0xc53e('0x46')],null))[_0xc53e('0x22')](respondWithResult(_0xa7d256,null))[_0xc53e('0x44')](handleError(_0xa7d256,null));};exports[_0xc53e('0x48')]=function(_0x1ac62e,_0x1a5a8f){return db[_0xc53e('0x27')][_0xc53e('0x43')]({'where':{'id':_0x1ac62e[_0xc53e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a5a8f,null))[_0xc53e('0x22')](removeEntity(_0x1a5a8f,null))[_0xc53e('0x44')](handleError(_0x1a5a8f,null));}; \ No newline at end of file +var _0x7fbe=['map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','FaxApplication','includeAll','findAll','rows','show','params','include','options','catch','create','body','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','save','update','then','error','name','send','index'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0x7fbe[_0x51ed62];return _0x34aee3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var db=require(_0xe7fb('0x19'))['db'];function respondWithStatusCode(_0x2fe8ab,_0x2437d4){_0x2437d4=_0x2437d4||0xcc;return function(_0x188e1d){if(_0x188e1d){return _0x2fe8ab[_0xe7fb('0x1a')](_0x2437d4);}return _0x2fe8ab[_0xe7fb('0x1b')](_0x2437d4)[_0xe7fb('0x1c')]();};}function respondWithResult(_0x598729,_0x278b75){_0x278b75=_0x278b75||0xc8;return function(_0x2225e5){if(_0x2225e5){return _0x598729['status'](_0x278b75)[_0xe7fb('0x1d')](_0x2225e5);}};}function respondWithFilteredResult(_0x37eb9f,_0x482f7d){return function(_0xa76acf){if(_0xa76acf){var _0x559129=_0xa76acf[_0xe7fb('0x1e')],_0x12fff6=_0x482f7d['offset'],_0x18d23c=_0x482f7d[_0xe7fb('0x1f')]+_0x482f7d['limit'],_0x12603d;if(_0x18d23c>=_0x559129){_0x18d23c=_0x559129;_0x12603d=0xc8;}else{_0x12603d=0xce;}_0x37eb9f[_0xe7fb('0x1b')](_0x12603d);return _0x37eb9f['set'](_0xe7fb('0x20'),_0x12fff6+'-'+_0x18d23c+'/'+_0x559129)[_0xe7fb('0x1d')](_0xa76acf);}return null;};}function patchUpdates(_0x3f96a7){return function(_0x182269){try{jsonpatch['apply'](_0x182269,_0x3f96a7,!![]);}catch(_0x44466e){return BPromise['reject'](_0x44466e);}return _0x182269[_0xe7fb('0x21')]();};}function saveUpdates(_0x51f01f,_0x15f7a4){return function(_0x4ea664){if(_0x4ea664){return _0x4ea664[_0xe7fb('0x22')](_0x51f01f)[_0xe7fb('0x23')](function(_0x4a9994){return _0x4a9994;});}return null;};}function removeEntity(_0x143eb6,_0x4742bd){return function(_0x3ae8f1){if(_0x3ae8f1){return _0x3ae8f1['destroy']()[_0xe7fb('0x23')](function(){_0x143eb6[_0xe7fb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(!_0x35e4db){_0x5bea27['sendStatus'](0x194);}return _0x35e4db;};}function handleError(_0x49b219,_0x4026b1){_0x4026b1=_0x4026b1||0x1f4;return function(_0x32e8b2){logger[_0xe7fb('0x24')](_0x32e8b2['stack']);if(_0x32e8b2[_0xe7fb('0x25')]){delete _0x32e8b2[_0xe7fb('0x25')];}_0x49b219[_0xe7fb('0x1b')](_0x4026b1)[_0xe7fb('0x26')](_0x32e8b2);};}exports[_0xe7fb('0x27')]=function(_0x16237a,_0x380130){var _0x59e015={},_0x5df9f2={},_0x1086e6={'count':0x0,'rows':[]};var _0x3bdee9=_[_0xe7fb('0x28')](db['FaxApplication'][_0xe7fb('0x29')],function(_0x251807){return{'name':_0x251807[_0xe7fb('0x2a')],'type':_0x251807[_0xe7fb('0x2b')][_0xe7fb('0x2c')]};});_0x5df9f2[_0xe7fb('0x2d')]=_[_0xe7fb('0x28')](_0x3bdee9,_0xe7fb('0x25'));_0x5df9f2['query']=_[_0xe7fb('0x2e')](_0x16237a[_0xe7fb('0x2f')]);_0x5df9f2[_0xe7fb('0x30')]=_['intersection'](_0x5df9f2['model'],_0x5df9f2[_0xe7fb('0x2f')]);_0x59e015['attributes']=_[_0xe7fb('0x31')](_0x5df9f2[_0xe7fb('0x2d')],qs[_0xe7fb('0x32')](_0x16237a[_0xe7fb('0x2f')]['fields']));_0x59e015[_0xe7fb('0x33')]=_0x59e015[_0xe7fb('0x33')][_0xe7fb('0x34')]?_0x59e015[_0xe7fb('0x33')]:_0x5df9f2[_0xe7fb('0x2d')];if(!_0x16237a['query'][_0xe7fb('0x35')](_0xe7fb('0x36'))){_0x59e015[_0xe7fb('0x37')]=qs[_0xe7fb('0x37')](_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x37')]);_0x59e015[_0xe7fb('0x1f')]=qs[_0xe7fb('0x1f')](_0x16237a[_0xe7fb('0x2f')]['offset']);}_0x59e015[_0xe7fb('0x38')]=qs[_0xe7fb('0x39')](_0x16237a[_0xe7fb('0x2f')]['sort']);_0x59e015[_0xe7fb('0x3a')]=qs[_0xe7fb('0x30')](_[_0xe7fb('0x3b')](_0x16237a[_0xe7fb('0x2f')],_0x5df9f2[_0xe7fb('0x30')]),_0x3bdee9);if(_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x3c')]){_0x59e015[_0xe7fb('0x3a')]=_[_0xe7fb('0x3d')](_0x59e015[_0xe7fb('0x3a')],{'$or':_[_0xe7fb('0x28')](_0x3bdee9,function(_0x3c4f4b){if(_0x3c4f4b[_0xe7fb('0x2b')]!==_0xe7fb('0x3e')){var _0xeb7c29={};_0xeb7c29[_0x3c4f4b[_0xe7fb('0x25')]]={'$like':'%'+_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x3c')]+'%'};return _0xeb7c29;}})});}_0x59e015=_[_0xe7fb('0x3d')]({},_0x59e015,_0x16237a['options']);var _0x261ec5={'where':_0x59e015[_0xe7fb('0x3a')]};return db[_0xe7fb('0x3f')][_0xe7fb('0x1e')](_0x261ec5)['then'](function(_0x3426a9){_0x1086e6[_0xe7fb('0x1e')]=_0x3426a9;if(_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x40')]){_0x59e015['include']=[{'all':!![]}];}return db[_0xe7fb('0x3f')][_0xe7fb('0x41')](_0x59e015);})[_0xe7fb('0x23')](function(_0x62a8a1){_0x1086e6[_0xe7fb('0x42')]=_0x62a8a1;return _0x1086e6;})[_0xe7fb('0x23')](respondWithFilteredResult(_0x380130,_0x59e015))['catch'](handleError(_0x380130,null));};exports[_0xe7fb('0x43')]=function(_0x35139f,_0x3a96cd){var _0x4b263d={'raw':!![],'where':{'id':_0x35139f[_0xe7fb('0x44')]['id']}},_0x36a341={};_0x36a341['model']=_['keys'](db['FaxApplication']['rawAttributes']);_0x36a341['query']=_[_0xe7fb('0x2e')](_0x35139f[_0xe7fb('0x2f')]);_0x36a341[_0xe7fb('0x30')]=_['intersection'](_0x36a341[_0xe7fb('0x2d')],_0x36a341['query']);_0x4b263d[_0xe7fb('0x33')]=_[_0xe7fb('0x31')](_0x36a341['model'],qs[_0xe7fb('0x32')](_0x35139f[_0xe7fb('0x2f')][_0xe7fb('0x32')]));_0x4b263d[_0xe7fb('0x33')]=_0x4b263d['attributes'][_0xe7fb('0x34')]?_0x4b263d[_0xe7fb('0x33')]:_0x36a341[_0xe7fb('0x2d')];if(_0x35139f['query'][_0xe7fb('0x40')]){_0x4b263d[_0xe7fb('0x45')]=[{'all':!![]}];}_0x4b263d=_[_0xe7fb('0x3d')]({},_0x4b263d,_0x35139f[_0xe7fb('0x46')]);return db[_0xe7fb('0x3f')]['find'](_0x4b263d)[_0xe7fb('0x23')](handleEntityNotFound(_0x3a96cd,null))['then'](respondWithResult(_0x3a96cd,null))[_0xe7fb('0x47')](handleError(_0x3a96cd,null));};exports[_0xe7fb('0x48')]=function(_0x3520e3,_0x1ecbfd){return db[_0xe7fb('0x3f')]['create'](_0x3520e3[_0xe7fb('0x49')],{})['then'](respondWithResult(_0x1ecbfd,0xc9))['catch'](handleError(_0x1ecbfd,null));};exports[_0xe7fb('0x22')]=function(_0x3d740f,_0x16327f){if(_0x3d740f['body']['id']){delete _0x3d740f[_0xe7fb('0x49')]['id'];}return db[_0xe7fb('0x3f')]['find']({'where':{'id':_0x3d740f['params']['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x16327f,null))[_0xe7fb('0x23')](saveUpdates(_0x3d740f[_0xe7fb('0x49')],null))[_0xe7fb('0x23')](respondWithResult(_0x16327f,null))[_0xe7fb('0x47')](handleError(_0x16327f,null));};exports[_0xe7fb('0x4a')]=function(_0x18a590,_0x347177){return db['FaxApplication'][_0xe7fb('0x4b')]({'where':{'id':_0x18a590['params']['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x347177,null))[_0xe7fb('0x23')](removeEntity(_0x347177,null))['catch'](handleError(_0x347177,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b55bc5c..2e4202f 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 _0xe86c=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xe86c,0xe2));var _0xce86=function(_0xcc8f12,_0x42ad91){_0xcc8f12=_0xcc8f12-0x0;var _0x16d1d8=_0xe86c[_0xcc8f12];return _0x16d1d8;};'use strict';var _=require(_0xce86('0x0'));var util=require(_0xce86('0x1'));var logger=require(_0xce86('0x2'))(_0xce86('0x3'));var moment=require(_0xce86('0x4'));var BPromise=require(_0xce86('0x5'));var rp=require(_0xce86('0x6'));var fs=require('fs');var path=require(_0xce86('0x7'));var rimraf=require(_0xce86('0x8'));var config=require(_0xce86('0x9'));var attributes=require('./faxApplication.attributes');module[_0xce86('0xa')]=function(_0x378781,_0x849b23){return _0x378781[_0xce86('0xb')](_0xce86('0xc'),attributes,{'tableName':_0xce86('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xce86('0xe'),'collate':_0xce86('0xf')});}; \ No newline at end of file +var _0x8094=['rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4e9978,_0x1a1c06){var _0xb4b14f=function(_0x2b482c){while(--_0x2b482c){_0x4e9978['push'](_0x4e9978['shift']());}};_0xb4b14f(++_0x1a1c06);}(_0x8094,0x1bb));var _0x4809=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0x8094[_0x304b67];return _0x493afb;};'use strict';var _=require(_0x4809('0x0'));var util=require(_0x4809('0x1'));var logger=require(_0x4809('0x2'))('api');var moment=require(_0x4809('0x3'));var BPromise=require(_0x4809('0x4'));var rp=require(_0x4809('0x5'));var fs=require('fs');var path=require(_0x4809('0x6'));var rimraf=require(_0x4809('0x7'));var config=require(_0x4809('0x8'));var attributes=require(_0x4809('0x9'));module[_0x4809('0xa')]=function(_0x1cfec1,_0x3b29df){return _0x1cfec1[_0x4809('0xb')](_0x4809('0xc'),attributes,{'tableName':_0x4809('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4809('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 6eed122..66dc80f 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 _0xd0a0=['FaxApplication','update','body','options','attributes','limit','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateFaxApplication'];(function(_0x215c0a,_0x343f7c){var _0x2f11b5=function(_0x278b33){while(--_0x278b33){_0x215c0a['push'](_0x215c0a['shift']());}};_0x2f11b5(++_0x343f7c);}(_0xd0a0,0x19b));var _0x0d0a=function(_0x2084e0,_0x4e90d7){_0x2084e0=_0x2084e0-0x0;var _0x252391=_0xd0a0[_0x2084e0];return _0x252391;};'use strict';var _=require(_0x0d0a('0x0'));var util=require(_0x0d0a('0x1'));var moment=require(_0x0d0a('0x2'));var BPromise=require(_0x0d0a('0x3'));var rs=require(_0x0d0a('0x4'));var fs=require('fs');var Redis=require(_0x0d0a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d0a('0x6'));var logger=require('../../config/logger')(_0x0d0a('0x7'));var config=require(_0x0d0a('0x8'));var jayson=require(_0x0d0a('0x9'));var client=jayson[_0x0d0a('0xa')][_0x0d0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdca027,_0x1df537,_0x47a2b7){return new BPromise(function(_0x442b77,_0x61e29e){return client[_0x0d0a('0xc')](_0xdca027,_0x47a2b7)[_0x0d0a('0xd')](function(_0xea53b2){logger[_0x0d0a('0xe')](_0x0d0a('0xf'),_0x1df537,'request\x20sent');logger['debug'](_0x0d0a('0x10'),_0x1df537,_0x0d0a('0x11'),JSON[_0x0d0a('0x12')](_0xea53b2));if(_0xea53b2[_0x0d0a('0x13')]){if(_0xea53b2[_0x0d0a('0x13')][_0x0d0a('0x14')]===0x1f4){logger['error'](_0x0d0a('0xf'),_0x1df537,_0xea53b2[_0x0d0a('0x13')]['message']);return _0x61e29e(_0xea53b2[_0x0d0a('0x13')][_0x0d0a('0x15')]);}logger[_0x0d0a('0x13')](_0x0d0a('0xf'),_0x1df537,_0xea53b2[_0x0d0a('0x13')][_0x0d0a('0x15')]);return _0x442b77(_0xea53b2[_0x0d0a('0x13')][_0x0d0a('0x15')]);}else{logger[_0x0d0a('0xe')](_0x0d0a('0xf'),_0x1df537,_0x0d0a('0x11'));_0x442b77(_0xea53b2['result'][_0x0d0a('0x15')]);}})['catch'](function(_0xcb1504){logger[_0x0d0a('0x13')]('FaxApplication,\x20%s,\x20%s',_0x1df537,_0xcb1504);_0x61e29e(_0xcb1504);});});}exports[_0x0d0a('0x16')]=function(_0x44ddf6){var _0x544dca=this;return new Promise(function(_0x14de3e,_0x3f9adf){return db[_0x0d0a('0x17')][_0x0d0a('0x18')](_0x44ddf6[_0x0d0a('0x19')],{'raw':_0x44ddf6[_0x0d0a('0x1a')]?_0x44ddf6[_0x0d0a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ddf6[_0x0d0a('0x1a')]?_0x44ddf6['options']['where']||null:null,'attributes':_0x44ddf6[_0x0d0a('0x1a')]?_0x44ddf6[_0x0d0a('0x1a')][_0x0d0a('0x1b')]||null:null,'limit':_0x44ddf6[_0x0d0a('0x1a')]?_0x44ddf6[_0x0d0a('0x1a')][_0x0d0a('0x1c')]||null:null})[_0x0d0a('0xd')](function(_0x188a44){logger[_0x0d0a('0xe')](_0x0d0a('0x16'),_0x44ddf6);logger[_0x0d0a('0x1d')](_0x0d0a('0x16'),_0x44ddf6,JSON[_0x0d0a('0x12')](_0x188a44));_0x14de3e(_0x188a44);})[_0x0d0a('0x1e')](function(_0x25ccb7){logger[_0x0d0a('0x13')]('UpdateFaxApplication',_0x25ccb7[_0x0d0a('0x15')],_0x44ddf6);_0x3f9adf(_0x544dca[_0x0d0a('0x13')](0x1f4,_0x25ccb7[_0x0d0a('0x15')]));});});}; \ No newline at end of file +var _0x2421=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment'];(function(_0x120799,_0x1eeb07){var _0x53494d=function(_0x38673f){while(--_0x38673f){_0x120799['push'](_0x120799['shift']());}};_0x53494d(++_0x1eeb07);}(_0x2421,0x17d));var _0x1242=function(_0x4981d8,_0x4796f8){_0x4981d8=_0x4981d8-0x0;var _0x4e2060=_0x2421[_0x4981d8];return _0x4e2060;};'use strict';var _=require(_0x1242('0x0'));var util=require(_0x1242('0x1'));var moment=require(_0x1242('0x2'));var BPromise=require(_0x1242('0x3'));var rs=require(_0x1242('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1242('0x5'))['db'];var utils=require(_0x1242('0x6'));var logger=require(_0x1242('0x7'))(_0x1242('0x8'));var config=require(_0x1242('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e5fc8,_0x1ac60f,_0x15fee9){return new BPromise(function(_0x2087e9,_0xba53eb){return client[_0x1242('0xa')](_0x2e5fc8,_0x15fee9)[_0x1242('0xb')](function(_0x442bbd){logger[_0x1242('0xc')](_0x1242('0xd'),_0x1ac60f,_0x1242('0xe'));logger[_0x1242('0xf')](_0x1242('0x10'),_0x1ac60f,'request\x20sent',JSON[_0x1242('0x11')](_0x442bbd));if(_0x442bbd[_0x1242('0x12')]){if(_0x442bbd[_0x1242('0x12')][_0x1242('0x13')]===0x1f4){logger[_0x1242('0x12')]('FaxApplication,\x20%s,\x20%s',_0x1ac60f,_0x442bbd[_0x1242('0x12')]['message']);return _0xba53eb(_0x442bbd[_0x1242('0x12')][_0x1242('0x14')]);}logger[_0x1242('0x12')](_0x1242('0xd'),_0x1ac60f,_0x442bbd['error'][_0x1242('0x14')]);return _0x2087e9(_0x442bbd[_0x1242('0x12')]['message']);}else{logger[_0x1242('0xc')](_0x1242('0xd'),_0x1ac60f,_0x1242('0xe'));_0x2087e9(_0x442bbd[_0x1242('0x15')]['message']);}})[_0x1242('0x16')](function(_0xce20e4){logger[_0x1242('0x12')](_0x1242('0xd'),_0x1ac60f,_0xce20e4);_0xba53eb(_0xce20e4);});});}exports[_0x1242('0x17')]=function(_0x5e6eef){var _0x33b663=this;return new Promise(function(_0x366783,_0x5ed5bd){return db[_0x1242('0x18')][_0x1242('0x19')](_0x5e6eef[_0x1242('0x1a')],{'raw':_0x5e6eef[_0x1242('0x1b')]?_0x5e6eef[_0x1242('0x1b')][_0x1242('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6eef[_0x1242('0x1b')]?_0x5e6eef['options'][_0x1242('0x1d')]||null:null,'attributes':_0x5e6eef['options']?_0x5e6eef[_0x1242('0x1b')][_0x1242('0x1e')]||null:null,'limit':_0x5e6eef[_0x1242('0x1b')]?_0x5e6eef[_0x1242('0x1b')][_0x1242('0x1f')]||null:null})[_0x1242('0xb')](function(_0xe76a1e){logger['info'](_0x1242('0x17'),_0x5e6eef);logger['debug'](_0x1242('0x17'),_0x5e6eef,JSON['stringify'](_0xe76a1e));_0x366783(_0xe76a1e);})[_0x1242('0x16')](function(_0x246d0d){logger[_0x1242('0x12')](_0x1242('0x17'),_0x246d0d['message'],_0x5e6eef);_0x5ed5bd(_0x33b663['error'](0x1f4,_0x246d0d[_0x1242('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ecae9d0..df88a25 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 _0xae24=['destroy','multer','path','express','Router','../../config/environment','get','isAuthenticated','index','/:id','delete'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xae24,0x182));var _0x4ae2=function(_0x168380,_0x1b8963){_0x168380=_0x168380-0x0;var _0x4ab373=_0xae24[_0x168380];return _0x4ab373;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ae2('0x4'));var controller=require('./faxApplication.controller');router[_0x4ae2('0x5')]('/',auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x7')]);router[_0x4ae2('0x5')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller['show']);router['post']('/',auth[_0x4ae2('0x6')](),controller['create']);router['put'](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller['update']);router[_0x4ae2('0x9')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0xa')]);module['exports']=router; \ No newline at end of file +var _0x7da7=['util','path','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7da7,0x10d));var _0x77da=function(_0x296923,_0x4adaed){_0x296923=_0x296923-0x0;var _0x29af70=_0x7da7[_0x296923];return _0x29af70;};'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')]('/',auth[_0x77da('0x7')](),controller[_0x77da('0xc')]);router[_0x77da('0xd')]('/:id',auth[_0x77da('0x7')](),controller[_0x77da('0xe')]);router[_0x77da('0xf')]('/:id',auth[_0x77da('0x7')](),controller[_0x77da('0x10')]);module[_0x77da('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1078b69..9e446b0 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 _0xfb48=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x54a6b1,_0x3399e9){var _0x453d7b=function(_0x5aa3bf){while(--_0x5aa3bf){_0x54a6b1['push'](_0x54a6b1['shift']());}};_0x453d7b(++_0x3399e9);}(_0xfb48,0x6f));var _0x8fb4=function(_0x265254,_0x39eafb){_0x265254=_0x265254-0x0;var _0x54b532=_0xfb48[_0x265254];return _0x54b532;};'use strict';var Sequelize=require(_0x8fb4('0x0'));module[_0x8fb4('0x1')]={'closed':{'type':Sequelize[_0x8fb4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8fb4('0x3')]},'disposition':{'type':Sequelize[_0x8fb4('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8fb4('0x3')]},'fax':{'type':Sequelize[_0x8fb4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8fb4('0x5')]('in',_0x8fb4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8fb4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8fb4('0x5')]('in',_0x8fb4('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x1bee=['STRING','DATE','ENUM','out','BOOLEAN'];(function(_0x466f2e,_0x5e2a7f){var _0x22dfbb=function(_0x308bbf){while(--_0x308bbf){_0x466f2e['push'](_0x466f2e['shift']());}};_0x22dfbb(++_0x5e2a7f);}(_0x1bee,0x1bc));var _0xe1be=function(_0xe31502,_0x24688d){_0xe31502=_0xe31502-0x0;var _0x171c63=_0x1bee[_0xe31502];return _0x171c63;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xe1be('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe1be('0x1')]},'note':{'type':Sequelize[_0xe1be('0x1')]},'read1stAt':{'type':Sequelize[_0xe1be('0x2')]},'fax':{'type':Sequelize[_0xe1be('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xe1be('0x3')]('in',_0xe1be('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe1be('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe1be('0x3')]('in',_0xe1be('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 5fccd13..0fb3a02 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 _0xbcff=['union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','start','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','i.*','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','params','include','merge','create','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','$gte','format','includeAll','findAll','addTags','setTags','spread','faxInteractionTags:save','removeTags','download','server','files','tmp','attachments','join','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','index','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','u.id\x20=\x20ui.UserId','select','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','value','having','`\x20>\x200','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbcff,0x12e));var _0xfbcf=function(_0x599a42,_0x19cc82){_0x599a42=_0x599a42-0x0;var _0x4ea4ae=_0xbcff[_0x599a42];return _0x4ea4ae;};'use strict';var pdf=require(_0xfbcf('0x0'));var emlformat=require(_0xfbcf('0x1'));var rimraf=require(_0xfbcf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbcf('0x3'));var rp=require(_0xfbcf('0x4'));var moment=require(_0xfbcf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbcf('0x6'));var util=require(_0xfbcf('0x7'));var path=require(_0xfbcf('0x8'));var sox=require('sox');var csv=require(_0xfbcf('0x9'));var ejs=require(_0xfbcf('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfbcf('0xb'));var crypto=require(_0xfbcf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfbcf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfbcf('0xe'));var Papa=require(_0xfbcf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfbcf('0x10'));var as=require(_0xfbcf('0x11'));var hardwareService=require(_0xfbcf('0x12'));var logger=require(_0xfbcf('0x13'))('api');var utils=require(_0xfbcf('0x14'));var config=require(_0xfbcf('0x15'));var db=require(_0xfbcf('0x16'))['db'];config[_0xfbcf('0x17')]=_[_0xfbcf('0x18')](config[_0xfbcf('0x17')],{'host':_0xfbcf('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbcf('0x17')]));require('./faxInteraction.socket')[_0xfbcf('0x1a')](socket);function respondWithStatusCode(_0x24e3aa,_0x29a27f){_0x29a27f=_0x29a27f||0xcc;return function(_0x3c0ff7){if(_0x3c0ff7){return _0x24e3aa[_0xfbcf('0x1b')](_0x29a27f);}return _0x24e3aa[_0xfbcf('0x1c')](_0x29a27f)[_0xfbcf('0x1d')]();};}function respondWithResult(_0x402fa4,_0x27f2f1){_0x27f2f1=_0x27f2f1||0xc8;return function(_0x52c51a){if(_0x52c51a){return _0x402fa4[_0xfbcf('0x1c')](_0x27f2f1)[_0xfbcf('0x1e')](_0x52c51a);}};}function respondWithFilteredResult(_0xbc4709,_0x24013b){return function(_0x35edfc){if(_0x35edfc){var _0x2994db=_0x35edfc[_0xfbcf('0x1f')],_0xe4b7f3=_0x24013b[_0xfbcf('0x20')],_0x3b029c=_0x24013b['offset']+_0x24013b[_0xfbcf('0x21')],_0x239138;if(_0x3b029c>=_0x2994db){_0x3b029c=_0x2994db;_0x239138=0xc8;}else{_0x239138=0xce;}_0xbc4709[_0xfbcf('0x1c')](_0x239138);return _0xbc4709['set'](_0xfbcf('0x22'),_0xe4b7f3+'-'+_0x3b029c+'/'+_0x2994db)[_0xfbcf('0x1e')](_0x35edfc);}return null;};}function patchUpdates(_0x4b3586){return function(_0x3c93d8){try{jsonpatch[_0xfbcf('0x23')](_0x3c93d8,_0x4b3586,!![]);}catch(_0x37d164){return BPromise[_0xfbcf('0x24')](_0x37d164);}return _0x3c93d8['save']();};}function saveUpdates(_0x1faf5d,_0x141f67){return function(_0x489a25){if(_0x489a25){return _0x489a25[_0xfbcf('0x25')](_0x1faf5d)[_0xfbcf('0x26')](function(_0x5cc845){return _0x5cc845;});}return null;};}function removeEntity(_0x409ac5,_0x1f4a15){return function(_0x3437f4){if(_0x3437f4){return _0x3437f4[_0xfbcf('0x27')]()[_0xfbcf('0x26')](function(){_0x409ac5['status'](0xcc)[_0xfbcf('0x1d')]();});}};}function handleEntityNotFound(_0x9219bf,_0x1f94de){return function(_0x55b409){if(!_0x55b409){_0x9219bf['sendStatus'](0x194);}return _0x55b409;};}function handleError(_0x2625e7,_0x23358b){_0x23358b=_0x23358b||0x1f4;return function(_0x580b95){logger[_0xfbcf('0x28')](_0x580b95[_0xfbcf('0x29')]);if(_0x580b95['name']){delete _0x580b95[_0xfbcf('0x2a')];}_0x2625e7[_0xfbcf('0x1c')](_0x23358b)[_0xfbcf('0x2b')](_0x580b95);};}function getInteractionUsers(_0x4db905,_0x577c03){return new BPromise(function(_0x176e67,_0x3de6e0){try{if(_0x577c03[_0x4db905['id']]){_0x4db905[_0xfbcf('0x2c')]=_[_0xfbcf('0x2d')](_0x577c03[_0x4db905['id']],function(_0x411707){return{'id':_0x411707['id'],'fullname':_0x411707[_0xfbcf('0x2e')]};});}}catch(_0xac9282){_0x3de6e0(_0xac9282);}_0x176e67(_0x4db905);});}function getInteractionTags(_0x5815c0,_0xe119bd){return new BPromise(function(_0x24fefa,_0x57b176){try{if(_0x5815c0[_0xfbcf('0x2f')]){_0x5815c0[_0xfbcf('0x30')]=[];_0x5815c0[_0xfbcf('0x2f')][_0xfbcf('0x31')](',')['forEach'](function(_0x30beaa){_0x5815c0[_0xfbcf('0x30')]['push'](_0xe119bd[_0x30beaa]);});}delete _0x5815c0[_0xfbcf('0x2f')];}catch(_0x3e72a0){_0x57b176(_0x3e72a0);}_0x24fefa(_0x5815c0);});}function updateFaxInteraction(_0x2c3d61,_0x2e67bd,_0x368251){return new BPromise(function(_0x3bb88f,_0x26668a){return getInteractionUsers(_0x2c3d61,_0x368251)[_0xfbcf('0x26')](function(_0x41f983){return getInteractionTags(_0x41f983,_0x2e67bd);})['then'](function(_0x278c17){_0x3bb88f(_0x278c17);})['catch'](function(_0x148464){_0x26668a(_0x148464);});});}exports[_0xfbcf('0x32')]=function(_0x3648d8,_0xbee3ef){var _0x4fba4a={},_0x353650={},_0x4f8ba3={'count':0x0,'rows':[]};var _0x21819e=_[_0xfbcf('0x2d')](db[_0xfbcf('0x33')][_0xfbcf('0x34')],function(_0x1b2e03){return{'name':_0x1b2e03[_0xfbcf('0x35')],'type':_0x1b2e03[_0xfbcf('0x36')][_0xfbcf('0x37')]};});_0x353650[_0xfbcf('0x38')]=_[_0xfbcf('0x2d')](_0x21819e,_0xfbcf('0x2a'));_0x353650['query']=_[_0xfbcf('0x39')](_0x3648d8[_0xfbcf('0x3a')]);_0x353650[_0xfbcf('0x3b')]=_[_0xfbcf('0x3c')](_0x353650['model'],_0x353650[_0xfbcf('0x3a')]);_0x4fba4a[_0xfbcf('0x3d')]=_['intersection'](_0x353650[_0xfbcf('0x38')],qs['fields'](_0x3648d8['query'][_0xfbcf('0x3e')]));_0x4fba4a[_0xfbcf('0x3d')]=_0x4fba4a['attributes'][_0xfbcf('0x3f')]?_0x4fba4a['attributes']:_0x353650[_0xfbcf('0x38')];if(!_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x40')](_0xfbcf('0x41'))){_0x4fba4a[_0xfbcf('0x21')]=qs[_0xfbcf('0x21')](_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x21')]);_0x4fba4a['offset']=qs[_0xfbcf('0x20')](_0x3648d8['query'][_0xfbcf('0x20')]);}_0x4fba4a[_0xfbcf('0x42')]=qs['sort'](_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x43')]);_0x4fba4a[_0xfbcf('0x44')]=qs['filters'](_[_0xfbcf('0x45')](_0x3648d8[_0xfbcf('0x3a')],_0x353650['filters']),_0x21819e);var _0x4a7c29=[];var _0x5b947e=squel['select']()[_0xfbcf('0x46')]('id')[_0xfbcf('0x46')]('name')[_0xfbcf('0x46')](_0xfbcf('0x47'))[_0xfbcf('0x48')](_0xfbcf('0x49'));var _0x4d09bc=squel['select']()[_0xfbcf('0x46')](_0xfbcf('0x4a'))[_0xfbcf('0x46')](_0xfbcf('0x4b'))[_0xfbcf('0x46')](_0xfbcf('0x4c'))['from']('user_has_fax_interactions','ui')[_0xfbcf('0x4d')]('users','u',_0xfbcf('0x4e'));var _0x1fee6c=squel[_0xfbcf('0x4f')]()[_0xfbcf('0x48')](_0xfbcf('0x50'),'i')['left_join'](_0xfbcf('0x51'),'c',_0xfbcf('0x52'))[_0xfbcf('0x4d')](_0xfbcf('0x53'),'o','o.id\x20=\x20i.UserId')[_0xfbcf('0x4d')]('fax_accounts','a',_0xfbcf('0x54'))[_0xfbcf('0x4d')]('fax_messages','me',_0xfbcf('0x55'))[_0xfbcf('0x4d')](_0xfbcf('0x56'),'it',_0xfbcf('0x57'))['left_join'](_0xfbcf('0x49'),'t',_0xfbcf('0x58'));var _0x4725bc=squel[_0xfbcf('0x59')]();var _0x5f1c00=[];var _0x167e68=squel[_0xfbcf('0x59')]();var _0x22892c;if(_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x5a')]){_0x22892c=as[_0xfbcf('0x5b')](_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x5a')]);var _0x5edc17=_0x22892c['sqlOperator'];for(var _0x12927c=0x0;_0x12927c<_0x22892c[_0xfbcf('0x5c')][_0xfbcf('0x3f')];_0x12927c++){var _0x4f9f1e=_0x22892c['conditions'][_0x12927c];var _0x26186e='i';var _0x5ac6ab=_['find'](_0x21819e,[_0xfbcf('0x2a'),_0x4f9f1e[_0xfbcf('0x46')]]);if(!_0x5ac6ab){switch(_0x4f9f1e['field']){case'unreadMessages':if(_0x4f9f1e[_0xfbcf('0x5d')]==0x1){_0x1fee6c[_0xfbcf('0x5e')]('`'+_0x4f9f1e[_0xfbcf('0x46')]+'`\x20=\x200');}else{_0x1fee6c[_0xfbcf('0x5e')]('`'+_0x4f9f1e[_0xfbcf('0x46')]+_0xfbcf('0x5f'));}break;case'Contact':if(_0x4f9f1e[_0xfbcf('0x60')]===_0xfbcf('0x61')){if(_0x4f9f1e[_0xfbcf('0x5d')][_0xfbcf('0x31')]('\x20')['length']>0x1){_0x4725bc[_0x5edc17]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4f9f1e[_0xfbcf('0x5d')]),null);}else{var _0x532fc5='%'+_0x4f9f1e[_0xfbcf('0x5d')]+'%';_0x4725bc[_0x5edc17](_0xfbcf('0x62'),_0x532fc5,_0x532fc5,_0x532fc5);}}else{_0x5ac6ab=_[_0xfbcf('0x63')](_0x21819e,['name',_0xfbcf('0x64')]);_0x4f9f1e[_0xfbcf('0x46')]=_0xfbcf('0x64');_0x3d3138=as[_0xfbcf('0x65')](_0x26186e,_0x5ac6ab[_0xfbcf('0x36')],_0x4f9f1e);_0x4725bc[_0x5edc17](_0x3d3138[_0xfbcf('0x66')],_0x3d3138[_0xfbcf('0x5d')]['start'],_0x3d3138[_0xfbcf('0x5d')]['end']);}break;case _0xfbcf('0x67'):var _0x240678=_0x4f9f1e['value'][_0xfbcf('0x31')](',')['map'](function(_0x2309eb){return Number(_0x2309eb);});_0x240678[_0xfbcf('0x68')](function(_0xaa26e9){_0x167e68['or'](_0xfbcf('0x69'),'%,'+_0xaa26e9+',%');});_0x5f1c00=_[_0xfbcf('0x6a')](_0x5f1c00,_0x240678);break;case _0xfbcf('0x6b'):if(_0x4f9f1e[_0xfbcf('0x60')]===_0xfbcf('0x61')){_0x4725bc[_0x5edc17](_0xfbcf('0x6c'),'%'+_0x4f9f1e['value']+'%',null);}else{_0x5ac6ab=_['find'](_0x21819e,['name','UserId']);_0x4f9f1e[_0xfbcf('0x46')]=_0xfbcf('0x6d');_0x3d3138=as[_0xfbcf('0x65')](_0x26186e,_0x5ac6ab[_0xfbcf('0x36')],_0x4f9f1e);_0x4725bc[_0x5edc17](_0x3d3138[_0xfbcf('0x66')],_0x3d3138['value']['start'],_0x3d3138[_0xfbcf('0x5d')]['end']);}break;case _0xfbcf('0x6e'):_0x3d3138=as[_0xfbcf('0x65')]('me',null,_0x4f9f1e);_0x4725bc[_0x5edc17](_0x3d3138['text'],_0x3d3138[_0xfbcf('0x5d')]['start'],_0x3d3138['value'][_0xfbcf('0x1d')]);break;}}else{var _0x3d3138=as[_0xfbcf('0x65')](_0x26186e,_0x5ac6ab[_0xfbcf('0x36')],_0x4f9f1e);_0x4725bc[_0x5edc17](_0x3d3138[_0xfbcf('0x66')],_0x3d3138['value'][_0xfbcf('0x6f')],_0x3d3138['value']['end']);}}}else{var _0x1f555f=_(_0x3648d8[_0xfbcf('0x3a')])[_0xfbcf('0x39')]()[_0xfbcf('0x2d')](function(_0x222d08){return _['some'](_0x21819e,[_0xfbcf('0x2a'),_0x222d08])?_0x222d08:undefined;})[_0xfbcf('0x70')]()[_0xfbcf('0x5d')]();if(!_[_0xfbcf('0x71')](_0x1f555f)){_0x1f555f[_0xfbcf('0x68')](function(_0x1ea274){if(_0x1ea274===_0xfbcf('0x72')){_0x1fee6c[_0xfbcf('0x44')](_0xfbcf('0x73'),[][_0xfbcf('0x74')](_0x3648d8[_0xfbcf('0x3a')][_0x1ea274]));}else if(_0x1ea274===_0xfbcf('0x75')){var _0xd42830=JSON[_0xfbcf('0x76')](_0x3648d8['query'][_0x1ea274])['$gte'];var _0x470a65=JSON[_0xfbcf('0x76')](_0x3648d8[_0xfbcf('0x3a')][_0x1ea274])[_0xfbcf('0x77')];_0x1fee6c[_0xfbcf('0x44')](_0xfbcf('0x78'),_0xd42830,_0x470a65);}else{if(_0x3648d8['query'][_0x1ea274]===_0xfbcf('0x79')){_0x1fee6c[_0xfbcf('0x44')]('i.'+_0x1ea274+_0xfbcf('0x7a'));}else{_0x1fee6c[_0xfbcf('0x44')]('i.'+_0x1ea274+'\x20=\x20?',_0x3648d8[_0xfbcf('0x3a')][_0x1ea274]);}}});}if(_0x3648d8['query'][_0xfbcf('0x7b')]){if(_0x3648d8[_0xfbcf('0x3a')]['read']==0x1){_0x1fee6c[_0xfbcf('0x5e')](_0xfbcf('0x7c'));}else{_0x1fee6c[_0xfbcf('0x5e')](_0xfbcf('0x7d'));}}if(_0x3648d8['query'][_0xfbcf('0x7e')]){_0x5f1c00=_['isArray'](_0x3648d8[_0xfbcf('0x3a')]['tag'])?_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x7e')]:new Array(_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x7e')]);_0x5f1c00[_0xfbcf('0x68')](function(_0x114593){_0x167e68['or'](_0xfbcf('0x69'),'%,'+_0x114593+',%');});}if(_0x3648d8['query'][_0xfbcf('0x7f')]){var _0xbc81c4=_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x7f')][_0xfbcf('0x80')]('\x5c','\x5c\x5c')[_0xfbcf('0x80')]('\x27\x27',_0xfbcf('0x81'));if(qs['isNumeric'](_0xbc81c4)){_0x4725bc['or'](_0xfbcf('0x82'),_0xbc81c4+'%')['or'](_0xfbcf('0x83'),_0xbc81c4+'%');}_0x4725bc['or'](_0xfbcf('0x84'),_0xbc81c4+'%');}}_0x1fee6c[_0xfbcf('0x44')](_0x4725bc);_0x1fee6c['group'](_0xfbcf('0x85'));var _0x493382={'type':db[_0xfbcf('0x86')][_0xfbcf('0x87')][_0xfbcf('0x88')],'raw':!![]};var _0x37406e=_0x1fee6c[_0xfbcf('0x89')]();_0x37406e[_0xfbcf('0x46')](_0xfbcf('0x85'));_0x37406e[_0xfbcf('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xfbcf('0x8a'));if(_0x4fba4a[_0xfbcf('0x42')]){_0x4fba4a[_0xfbcf('0x42')][_0xfbcf('0x68')](function(_0x3e1e5b){_0x1fee6c[_0xfbcf('0x42')]('i.'+_0x3e1e5b[0x0],_0x3e1e5b[0x1]===_0xfbcf('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x5f1c00)){_0x1fee6c[_0xfbcf('0x5e')](_0x167e68);_0x37406e[_0xfbcf('0x44')]('t.id\x20IN\x20?',_0x5f1c00);}BPromise[_0xfbcf('0x8c')]()[_0xfbcf('0x26')](function(){if(!_0x22892c){if(_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x72')]||_0x3648d8[_0xfbcf('0x3a')]['journey'])return;_0x37406e[_0xfbcf('0x44')](_0xfbcf('0x8d'));_0x1fee6c[_0xfbcf('0x44')](_0xfbcf('0x8d'));return;}return _0x3648d8[_0xfbcf('0x8e')][_0xfbcf('0x8f')]({'attributes':['id'],'raw':!![]})[_0xfbcf('0x26')](function(_0x3bf2a9){if(_[_0xfbcf('0x71')](_0x3bf2a9)){_0x37406e['where'](_0xfbcf('0x90'));_0x1fee6c[_0xfbcf('0x44')](_0xfbcf('0x90'));}else{_0x37406e['where']('i.FaxAccountId\x20IN\x20?',_[_0xfbcf('0x2d')](_0x3bf2a9,'id'));_0x1fee6c[_0xfbcf('0x44')](_0xfbcf('0x73'),_[_0xfbcf('0x2d')](_0x3bf2a9,'id'));}});})[_0xfbcf('0x26')](function(){db[_0xfbcf('0x91')]['query'](_0x37406e[_0xfbcf('0x92')](),_0x493382)['then'](function(_0x27f562){_0x4f8ba3[_0xfbcf('0x1f')]=_0x27f562[_0xfbcf('0x3f')];if(_0x4f8ba3[_0xfbcf('0x1f')]===0x0)return[];return db[_0xfbcf('0x91')][_0xfbcf('0x3a')](_0x5b947e[_0xfbcf('0x92')](),_0x493382)['then'](function(_0x544749){_0x4a7c29=_[_0xfbcf('0x93')](_0x544749,'id');_0x493382=_['merge'](_0x493382,{'model':db[_0xfbcf('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3648d8[_0xfbcf('0x3a')][_0xfbcf('0x3e')]){_0x4fba4a[_0xfbcf('0x3d')][_0xfbcf('0x68')](function(_0x33c2fd){_0x1fee6c[_0xfbcf('0x46')]('i.'+_0x33c2fd);});}else{_0x1fee6c[_0xfbcf('0x46')](_0xfbcf('0x94'),_0xfbcf('0x8a'));_0x1fee6c[_0xfbcf('0x46')]('a.key',_0xfbcf('0x95'));_0x1fee6c['field']('a.mandatoryDisposition',_0xfbcf('0x96'));_0x1fee6c[_0xfbcf('0x46')](_0xfbcf('0x97'));_0x1fee6c[_0xfbcf('0x46')]('c.firstName','Contact.firstName');_0x1fee6c[_0xfbcf('0x46')]('c.lastName',_0xfbcf('0x98'));_0x1fee6c[_0xfbcf('0x46')](_0xfbcf('0x99'),_0xfbcf('0x9a'));_0x1fee6c['field'](_0xfbcf('0x9b'),'Contact.phone');_0x1fee6c[_0xfbcf('0x46')](_0xfbcf('0x9c'),'Contact.mobile');_0x1fee6c[_0xfbcf('0x46')](_0xfbcf('0x9d'),'Contact.fax');_0x1fee6c[_0xfbcf('0x46')]('o.fullname','Owner.fullname');_0x1fee6c[_0xfbcf('0x46')](_0xfbcf('0x9e'),_0xfbcf('0x9f'));_0x1fee6c[_0xfbcf('0x46')](_0xfbcf('0xa0'),'TagIds');}if(_0x4fba4a[_0xfbcf('0x21')])_0x1fee6c[_0xfbcf('0x21')](_0x4fba4a['limit']);if(_0x4fba4a[_0xfbcf('0x20')])_0x1fee6c[_0xfbcf('0x20')](_0x4fba4a['offset']);return db[_0xfbcf('0x91')]['query'](_0x1fee6c[_0xfbcf('0x92')](),_0x493382);})[_0xfbcf('0x26')](function(_0x57ab0c){_0x4d09bc[_0xfbcf('0x44')](_0xfbcf('0xa1'),_['map'](_0x57ab0c,'id'));return db[_0xfbcf('0x91')][_0xfbcf('0x3a')](_0x4d09bc[_0xfbcf('0x92')](),_0x493382)[_0xfbcf('0x26')](function(_0x1de795){var _0x3ec0db=_[_0xfbcf('0xa2')](_0x1de795,_0xfbcf('0xa3'));var _0x2f9a56=[];_0x57ab0c[_0xfbcf('0x68')](function(_0x3081f4){_0x2f9a56['push'](updateFaxInteraction(_0x3081f4,_0x4a7c29,_0x3ec0db));});return BPromise[_0xfbcf('0xa4')](_0x2f9a56);});});})['then'](function(_0x4f1196){_0x4f8ba3[_0xfbcf('0xa5')]=_0x4f1196;return _0x4f8ba3;})[_0xfbcf('0x26')](respondWithFilteredResult(_0xbee3ef,_0x4fba4a));})[_0xfbcf('0xa6')](handleError(_0xbee3ef,null));};exports['show']=function(_0x360fa2,_0x3bccaf){var _0x493c06={'raw':![],'where':{'id':_0x360fa2[_0xfbcf('0xa7')]['id']}},_0x4d3734={};_0x4d3734['model']=_[_0xfbcf('0x39')](db[_0xfbcf('0x33')]['rawAttributes']);_0x4d3734['query']=_[_0xfbcf('0x39')](_0x360fa2[_0xfbcf('0x3a')]);_0x4d3734[_0xfbcf('0x3b')]=_['intersection'](_0x4d3734['model'],_0x4d3734['query']);_0x493c06[_0xfbcf('0x3d')]=_[_0xfbcf('0x3c')](_0x4d3734['model'],qs[_0xfbcf('0x3e')](_0x360fa2[_0xfbcf('0x3a')][_0xfbcf('0x3e')]));_0x493c06[_0xfbcf('0x3d')]=_0x493c06[_0xfbcf('0x3d')]['length']?_0x493c06[_0xfbcf('0x3d')]:_0x4d3734[_0xfbcf('0x38')];if(_0x360fa2[_0xfbcf('0x3a')]['includeAll']){_0x493c06[_0xfbcf('0xa8')]=[{'all':!![]}];}_0x493c06=_[_0xfbcf('0xa9')]({},_0x493c06,_0x360fa2['options']);return db['FaxInteraction'][_0xfbcf('0x63')](_0x493c06)[_0xfbcf('0x26')](handleEntityNotFound(_0x3bccaf,null))[_0xfbcf('0x26')](respondWithResult(_0x3bccaf,null))['catch'](handleError(_0x3bccaf,null));};exports[_0xfbcf('0xaa')]=function(_0x5d4b59,_0x2ed271){return db[_0xfbcf('0x33')]['create'](_0x5d4b59[_0xfbcf('0x6e')],{})[_0xfbcf('0x26')](respondWithResult(_0x2ed271,0xc9))[_0xfbcf('0xa6')](handleError(_0x2ed271,null));};exports[_0xfbcf('0x25')]=function(_0x22b880,_0x4e87b0){if(_0x22b880[_0xfbcf('0x6e')]['id']){delete _0x22b880[_0xfbcf('0x6e')]['id'];}return db[_0xfbcf('0x33')][_0xfbcf('0x63')]({'where':{'id':_0x22b880['params']['id']}})[_0xfbcf('0x26')](handleEntityNotFound(_0x4e87b0,null))['then'](saveUpdates(_0x22b880[_0xfbcf('0x6e')],null))[_0xfbcf('0x26')](respondWithResult(_0x4e87b0,null))[_0xfbcf('0xa6')](handleError(_0x4e87b0,null));};exports[_0xfbcf('0x27')]=function(_0xb39c21,_0x4de6e8){return db[_0xfbcf('0x33')]['find']({'where':{'id':_0xb39c21[_0xfbcf('0xa7')]['id']}})[_0xfbcf('0x26')](handleEntityNotFound(_0x4de6e8,null))[_0xfbcf('0x26')](removeEntity(_0x4de6e8,null))['catch'](handleError(_0x4de6e8,null));};exports[_0xfbcf('0xab')]=function(_0x460599,_0x742461){return db['FaxInteraction'][_0xfbcf('0xab')]()[_0xfbcf('0x26')](respondWithResult(_0x742461,null))[_0xfbcf('0xa6')](handleError(_0x742461,null));};exports[_0xfbcf('0xac')]=function(_0x11ce77,_0xfafac8,_0x1c847d){return db[_0xfbcf('0xad')][_0xfbcf('0x63')]({'where':{'id':_0x11ce77[_0xfbcf('0xa7')]['id']}})[_0xfbcf('0x26')](handleEntityNotFound(_0xfafac8,null))[_0xfbcf('0x26')](function(_0x6b98de){if(_0x6b98de){return _0x6b98de[_0xfbcf('0xac')](_0x11ce77['body']['ids'],_[_0xfbcf('0xae')](_0x11ce77[_0xfbcf('0x6e')],[_0xfbcf('0xaf'),'id'])||{});}})['then'](respondWithResult(_0xfafac8,null))[_0xfbcf('0xa6')](handleError(_0xfafac8,null));};exports[_0xfbcf('0xb0')]=function(_0x1b4c0d,_0x5c5b67,_0x151af9){var _0x1763cd={'raw':![],'where':{}};var _0xa41764={};var _0x3a0307={'count':0x0,'rows':[]};return db[_0xfbcf('0x33')][_0xfbcf('0xb1')]({'where':{'id':_0x1b4c0d[_0xfbcf('0xa7')]['id']}})[_0xfbcf('0x26')](handleEntityNotFound(_0x5c5b67,null))[_0xfbcf('0x26')](function(_0x323b01){if(_0x323b01){_0xa41764[_0xfbcf('0x38')]=_[_0xfbcf('0x39')](db[_0xfbcf('0xad')][_0xfbcf('0x34')]);_0xa41764[_0xfbcf('0x3a')]=_[_0xfbcf('0x39')](_0x1b4c0d['query']);_0xa41764[_0xfbcf('0x3b')]=_[_0xfbcf('0x3c')](_0xa41764[_0xfbcf('0x38')],_0xa41764[_0xfbcf('0x3a')]);_0x1763cd[_0xfbcf('0x3d')]=_[_0xfbcf('0x3c')](_0xa41764[_0xfbcf('0x38')],qs[_0xfbcf('0x3e')](_0x1b4c0d[_0xfbcf('0x3a')]['fields']));_0x1763cd[_0xfbcf('0x3d')]=_0x1763cd[_0xfbcf('0x3d')][_0xfbcf('0x3f')]?_0x1763cd['attributes']:_0xa41764[_0xfbcf('0x38')];if(!_0x1b4c0d[_0xfbcf('0x3a')]['hasOwnProperty'](_0xfbcf('0x41'))){_0x1763cd[_0xfbcf('0x21')]=qs[_0xfbcf('0x21')](_0x1b4c0d[_0xfbcf('0x3a')][_0xfbcf('0x21')]);_0x1763cd[_0xfbcf('0x20')]=qs[_0xfbcf('0x20')](_0x1b4c0d[_0xfbcf('0x3a')]['offset']);}_0x1763cd[_0xfbcf('0x42')]=qs[_0xfbcf('0x43')](_0x1b4c0d[_0xfbcf('0x3a')]['sort']);_0x1763cd[_0xfbcf('0x44')]=qs['filters'](_[_0xfbcf('0x45')](_0x1b4c0d['query'],_0xa41764[_0xfbcf('0x3b')]));_0x1763cd[_0xfbcf('0x44')][_0xfbcf('0xa3')]=_0x323b01['id'];if(_0x1b4c0d['query'][_0xfbcf('0x7f')]){_0x1763cd[_0xfbcf('0x44')]=_[_0xfbcf('0xa9')](_0x1763cd[_0xfbcf('0x44')],{'$or':_[_0xfbcf('0x2d')](_0x1763cd['attributes'],function(_0x7450c1){var _0x571e45={};_0x571e45[_0x7450c1]={'$like':'%'+_0x1b4c0d['query'][_0xfbcf('0x7f')]+'%'};return _0x571e45;})});}if(_0x1b4c0d[_0xfbcf('0x3a')][_0xfbcf('0xb2')]){var _0x186a57=_0x1b4c0d[_0xfbcf('0x3a')][_0xfbcf('0xb2')][_0xfbcf('0x31')](',');var _0x110783={};_0x110783[_0x186a57[0x0]]={'$gte':moment(_0x186a57[0x1])[_0xfbcf('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1763cd['where']=_[_0xfbcf('0xa9')](_0x1763cd[_0xfbcf('0x44')],_0x110783);}_0x1763cd=_['merge']({},_0x1763cd,_0x1b4c0d['options']);return db[_0xfbcf('0xad')][_0xfbcf('0x1f')]({'where':_0x1763cd[_0xfbcf('0x44')]})[_0xfbcf('0x26')](function(_0x1661d7){_0x3a0307[_0xfbcf('0x1f')]=_0x1661d7;if(_0x1b4c0d[_0xfbcf('0x3a')][_0xfbcf('0xb4')]){_0x1763cd[_0xfbcf('0xa8')]=[{'all':!![]}];}return db['FaxMessage'][_0xfbcf('0xb5')](_0x1763cd);})[_0xfbcf('0x26')](function(_0x5d6812){_0x3a0307[_0xfbcf('0xa5')]=_0x5d6812;return _0x3a0307;});}})[_0xfbcf('0x26')](respondWithFilteredResult(_0x5c5b67,_0x1763cd))[_0xfbcf('0xa6')](handleError(_0x5c5b67,null));};exports[_0xfbcf('0xb6')]=function(_0x1c8682,_0x6634b3,_0x375938){return db['FaxInteraction'][_0xfbcf('0x63')]({'where':{'id':_0x1c8682[_0xfbcf('0xa7')]['id']}})[_0xfbcf('0x26')](handleEntityNotFound(_0x6634b3,null))[_0xfbcf('0x26')](function(_0x46886d){if(_0x46886d){return _0x46886d[_0xfbcf('0xb7')](_0x1c8682[_0xfbcf('0x6e')][_0xfbcf('0xaf')],_['omit'](_0x1c8682[_0xfbcf('0x6e')],[_0xfbcf('0xaf'),'id'])||{})[_0xfbcf('0xb8')](function(){return db[_0xfbcf('0x67')][_0xfbcf('0xb5')]({'attributes':['id',_0xfbcf('0x2a'),'color'],'where':{'id':_0x1c8682['body'][_0xfbcf('0xaf')]}});})[_0xfbcf('0x26')](function(_0x529440){socket['emit'](_0xfbcf('0xb9'),{'id':Number(_0x1c8682[_0xfbcf('0xa7')]['id']),'tags':_0x529440||[]});return{'id':Number(_0x1c8682[_0xfbcf('0xa7')]['id']),'tags':_0x529440||[]};});}})[_0xfbcf('0x26')](respondWithResult(_0x6634b3,null))[_0xfbcf('0xa6')](handleError(_0x6634b3,null));};exports['removeTags']=function(_0x4e0abb,_0x30d724,_0x54f5c4){return db[_0xfbcf('0x33')][_0xfbcf('0x63')]({'where':{'id':_0x4e0abb[_0xfbcf('0xa7')]['id']}})['then'](handleEntityNotFound(_0x30d724,null))[_0xfbcf('0x26')](function(_0xe75300){if(_0xe75300){return _0xe75300[_0xfbcf('0xba')](_0x4e0abb[_0xfbcf('0x3a')]['ids']);}})[_0xfbcf('0x26')](respondWithStatusCode(_0x30d724,null))['catch'](handleError(_0x30d724,null));};exports[_0xfbcf('0xbb')]=function(_0x390d3a,_0x410a33){var _0x3f85d3=moment()['unix']()[_0xfbcf('0x92')]();var _0x2e9a13=path['join'](config['root'],_0xfbcf('0xbc'),_0xfbcf('0xbd'),_0xfbcf('0xbe'));var _0x560f83=path['join'](config['root'],'server',_0xfbcf('0xbd'),_0xfbcf('0xbf'));var _0x49ea1e=path[_0xfbcf('0xc0')](_0x2e9a13,_0x3f85d3);var _0x4fad35=util[_0xfbcf('0xb3')]('transcript-%d-%s.zip',_0x390d3a[_0xfbcf('0xa7')]['id'],_0x3f85d3);var _0x329632=path[_0xfbcf('0xc0')](_0x2e9a13,_0x4fad35);var _0x1b46d5=[];_0x1b46d5[_0xfbcf('0xc1')]({'model':db[_0xfbcf('0xc2')],'as':_0xfbcf('0xc2'),'raw':!![]});var _0x38292c=[{'model':db[_0xfbcf('0xad')],'as':'Messages','attributes':['id',_0xfbcf('0x6e'),_0xfbcf('0x75')],'include':_0x1b46d5}];return db[_0xfbcf('0x33')]['find']({'where':{'id':_0x390d3a[_0xfbcf('0xa7')]['id']},'include':_0x38292c})['then'](handleEntityNotFound(_0x410a33,null))[_0xfbcf('0x26')](function(_0x33b4e8){if(_0x33b4e8&&_0x33b4e8[_0xfbcf('0xc3')]){var _0x5becec=_0x33b4e8[_0xfbcf('0xc4')]({'plain':!![]});fs[_0xfbcf('0xc5')](_0x49ea1e);for(var _0x4f4654=0x0;_0x4f4654<_0x5becec['Messages'][_0xfbcf('0x3f')];_0x4f4654++){var _0x547616=_0x5becec[_0xfbcf('0xc3')][_0x4f4654][_0xfbcf('0xc2')];if(_0x547616){var _0x218e3a=path[_0xfbcf('0xc0')](_0x560f83,_0x547616[_0xfbcf('0xc6')]);if(fs[_0xfbcf('0xc7')](_0x218e3a)){fs[_0xfbcf('0xc8')](_0x218e3a)['pipe'](fs[_0xfbcf('0xc9')](path[_0xfbcf('0xc0')](_0x49ea1e,_0x547616['basename'])));}}}return BPromise[_0xfbcf('0x8c')]()[_0xfbcf('0x26')](function(){return new BPromise(function(_0x2004ca,_0x4a9e4b){zipdir(_0x49ea1e,{'saveTo':_0x329632},function(_0x36d567,_0xd25996){if(_0x36d567)return _0x4a9e4b(_0x36d567);return _0x2004ca(_0xd25996);});})['then'](function(){return new BPromise(function(_0x4bf0a6,_0x40310e){rimraf(_0x49ea1e,function(_0x15fc7b){if(_0x15fc7b)_0x40310e(_0x15fc7b);return _0x4bf0a6();});});})[_0xfbcf('0x26')](function(){return _0x410a33[_0xfbcf('0xbb')](_0x329632,_0x4fad35,function(_0x70dc2c){if(_0x70dc2c){console[_0xfbcf('0xca')]('err',_0x70dc2c);}else{fs[_0xfbcf('0xcb')](_0x329632);}});});});}else{return _0x410a33['sendStatus'](0xc8);}})[_0xfbcf('0xa6')](handleError(_0x410a33,null));}; \ No newline at end of file +var _0x2e21=['register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','select','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','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','buildExpression','body','type','text','some','FaxAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','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?','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.lastName','c.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','create','update','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','nolimit','FaxInteractionId','merge','options','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','root','files','tmp','server','attachments','Attachment','Messages','get','createReadStream','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x3cb942,_0x8e2d6c){var _0x25e1fb=function(_0x3b28cf){while(--_0x3b28cf){_0x3cb942['push'](_0x3cb942['shift']());}};_0x25e1fb(++_0x8e2d6c);}(_0x2e21,0xba));var _0x12e2=function(_0x480c01,_0x54ae31){_0x480c01=_0x480c01-0x0;var _0x4efdf5=_0x2e21[_0x480c01];return _0x4efdf5;};'use strict';var pdf=require(_0x12e2('0x0'));var emlformat=require(_0x12e2('0x1'));var rimraf=require(_0x12e2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12e2('0x3'));var rp=require('request-promise');var moment=require(_0x12e2('0x4'));var BPromise=require(_0x12e2('0x5'));var Mustache=require(_0x12e2('0x6'));var util=require(_0x12e2('0x7'));var path=require(_0x12e2('0x8'));var sox=require(_0x12e2('0x9'));var csv=require(_0x12e2('0xa'));var ejs=require(_0x12e2('0xb'));var fs=require('fs');var _=require(_0x12e2('0xc'));var squel=require(_0x12e2('0xd'));var crypto=require(_0x12e2('0xe'));var jsforce=require(_0x12e2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x12e2('0xa'));var querystring=require('querystring');var Papa=require(_0x12e2('0x10'));var Redis=require('ioredis');var authService=require(_0x12e2('0x11'));var qs=require(_0x12e2('0x12'));var as=require(_0x12e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12e2('0x14'))(_0x12e2('0x15'));var utils=require('../../config/utils');var config=require(_0x12e2('0x16'));var db=require('../../mysqldb')['db'];config[_0x12e2('0x17')]=_['defaults'](config[_0x12e2('0x17')],{'host':_0x12e2('0x18'),'port':0x18eb});var socket=require(_0x12e2('0x19'))(new Redis(config[_0x12e2('0x17')]));require(_0x12e2('0x1a'))[_0x12e2('0x1b')](socket);function respondWithStatusCode(_0x1cfa64,_0x3b936e){_0x3b936e=_0x3b936e||0xcc;return function(_0x18d47e){if(_0x18d47e){return _0x1cfa64['sendStatus'](_0x3b936e);}return _0x1cfa64[_0x12e2('0x1c')](_0x3b936e)[_0x12e2('0x1d')]();};}function respondWithResult(_0x44b3e0,_0x285ff7){_0x285ff7=_0x285ff7||0xc8;return function(_0x2d882a){if(_0x2d882a){return _0x44b3e0[_0x12e2('0x1c')](_0x285ff7)[_0x12e2('0x1e')](_0x2d882a);}};}function respondWithFilteredResult(_0x168d26,_0x1d3da5){return function(_0x2ffb31){if(_0x2ffb31){var _0x210f5c=_0x2ffb31[_0x12e2('0x1f')],_0x430bc9=_0x1d3da5[_0x12e2('0x20')],_0x298e64=_0x1d3da5[_0x12e2('0x20')]+_0x1d3da5[_0x12e2('0x21')],_0x174b28;if(_0x298e64>=_0x210f5c){_0x298e64=_0x210f5c;_0x174b28=0xc8;}else{_0x174b28=0xce;}_0x168d26[_0x12e2('0x1c')](_0x174b28);return _0x168d26[_0x12e2('0x22')](_0x12e2('0x23'),_0x430bc9+'-'+_0x298e64+'/'+_0x210f5c)[_0x12e2('0x1e')](_0x2ffb31);}return null;};}function patchUpdates(_0x475cab){return function(_0x4e5bc7){try{jsonpatch[_0x12e2('0x24')](_0x4e5bc7,_0x475cab,!![]);}catch(_0x45179e){return BPromise[_0x12e2('0x25')](_0x45179e);}return _0x4e5bc7[_0x12e2('0x26')]();};}function saveUpdates(_0x47be59,_0x400d23){return function(_0x10c374){if(_0x10c374){return _0x10c374['update'](_0x47be59)[_0x12e2('0x27')](function(_0x5dac82){return _0x5dac82;});}return null;};}function removeEntity(_0xe5868a,_0x33fed2){return function(_0x5e6d9a){if(_0x5e6d9a){return _0x5e6d9a[_0x12e2('0x28')]()[_0x12e2('0x27')](function(){_0xe5868a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x719371,_0x461e2b){return function(_0x52f475){if(!_0x52f475){_0x719371[_0x12e2('0x29')](0x194);}return _0x52f475;};}function handleError(_0x18639b,_0x441c84){_0x441c84=_0x441c84||0x1f4;return function(_0xf36e7a){logger[_0x12e2('0x2a')](_0xf36e7a[_0x12e2('0x2b')]);if(_0xf36e7a[_0x12e2('0x2c')]){delete _0xf36e7a[_0x12e2('0x2c')];}_0x18639b['status'](_0x441c84)[_0x12e2('0x2d')](_0xf36e7a);};}function getInteractionUsers(_0x2a32a6,_0xdeff70){return new BPromise(function(_0x2f2a21,_0xb62e62){try{if(_0xdeff70[_0x2a32a6['id']]){_0x2a32a6[_0x12e2('0x2e')]=_['map'](_0xdeff70[_0x2a32a6['id']],function(_0x133729){return{'id':_0x133729['id'],'fullname':_0x133729[_0x12e2('0x2f')]};});}}catch(_0x1bf373){_0xb62e62(_0x1bf373);}_0x2f2a21(_0x2a32a6);});}function getInteractionTags(_0x488fd9,_0x9e26a1){return new BPromise(function(_0xdcf157,_0x4c9609){try{if(_0x488fd9[_0x12e2('0x30')]){_0x488fd9[_0x12e2('0x31')]=[];_0x488fd9[_0x12e2('0x30')][_0x12e2('0x32')](',')[_0x12e2('0x33')](function(_0x5bea7b){_0x488fd9[_0x12e2('0x31')][_0x12e2('0x34')](_0x9e26a1[_0x5bea7b]);});}delete _0x488fd9[_0x12e2('0x30')];}catch(_0x513d80){_0x4c9609(_0x513d80);}_0xdcf157(_0x488fd9);});}function updateFaxInteraction(_0x15ef9f,_0x27fb07,_0x10c23c){return new BPromise(function(_0x489883,_0x2cc277){return getInteractionUsers(_0x15ef9f,_0x10c23c)[_0x12e2('0x27')](function(_0x21eb92){return getInteractionTags(_0x21eb92,_0x27fb07);})[_0x12e2('0x27')](function(_0x304f79){_0x489883(_0x304f79);})[_0x12e2('0x35')](function(_0x101e84){_0x2cc277(_0x101e84);});});}exports[_0x12e2('0x36')]=function(_0x468fa4,_0x382ddf){var _0x4aa699={},_0x5d00bf={},_0x5e2246={'count':0x0,'rows':[]};var _0x3e23e6=_[_0x12e2('0x37')](db[_0x12e2('0x38')][_0x12e2('0x39')],function(_0x3acd82){return{'name':_0x3acd82[_0x12e2('0x3a')],'type':_0x3acd82['type'][_0x12e2('0x3b')]};});_0x5d00bf[_0x12e2('0x3c')]=_[_0x12e2('0x37')](_0x3e23e6,_0x12e2('0x2c'));_0x5d00bf['query']=_[_0x12e2('0x3d')](_0x468fa4[_0x12e2('0x3e')]);_0x5d00bf[_0x12e2('0x3f')]=_[_0x12e2('0x40')](_0x5d00bf['model'],_0x5d00bf[_0x12e2('0x3e')]);_0x4aa699[_0x12e2('0x41')]=_['intersection'](_0x5d00bf[_0x12e2('0x3c')],qs['fields'](_0x468fa4['query'][_0x12e2('0x42')]));_0x4aa699[_0x12e2('0x41')]=_0x4aa699[_0x12e2('0x41')][_0x12e2('0x43')]?_0x4aa699[_0x12e2('0x41')]:_0x5d00bf['model'];if(!_0x468fa4['query'][_0x12e2('0x44')]('nolimit')){_0x4aa699[_0x12e2('0x21')]=qs[_0x12e2('0x21')](_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x21')]);_0x4aa699['offset']=qs[_0x12e2('0x20')](_0x468fa4[_0x12e2('0x3e')]['offset']);}_0x4aa699[_0x12e2('0x45')]=qs[_0x12e2('0x46')](_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x46')]);_0x4aa699[_0x12e2('0x47')]=qs[_0x12e2('0x3f')](_[_0x12e2('0x48')](_0x468fa4[_0x12e2('0x3e')],_0x5d00bf['filters']),_0x3e23e6);var _0x32f02e=[];var _0x149052=squel['select']()[_0x12e2('0x49')]('id')['field'](_0x12e2('0x2c'))[_0x12e2('0x49')](_0x12e2('0x4a'))['from']('tools_tags');var _0x25d117=squel[_0x12e2('0x4b')]()[_0x12e2('0x49')](_0x12e2('0x4c'))[_0x12e2('0x49')](_0x12e2('0x4d'))[_0x12e2('0x49')](_0x12e2('0x4e'))[_0x12e2('0x4f')](_0x12e2('0x50'),'ui')[_0x12e2('0x51')](_0x12e2('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x203045=squel[_0x12e2('0x4b')]()[_0x12e2('0x4f')](_0x12e2('0x53'),'i')['left_join'](_0x12e2('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x12e2('0x51')]('users','o',_0x12e2('0x55'))[_0x12e2('0x51')](_0x12e2('0x56'),'a',_0x12e2('0x57'))[_0x12e2('0x51')]('fax_messages','me',_0x12e2('0x58'))[_0x12e2('0x51')](_0x12e2('0x59'),'it',_0x12e2('0x5a'))[_0x12e2('0x51')](_0x12e2('0x5b'),'t',_0x12e2('0x5c'));var _0x4ec3b6=squel[_0x12e2('0x5d')]();var _0x40e727=[];var _0x2cd9f3=squel[_0x12e2('0x5d')]();var _0x48b16c;if(_0x468fa4['query'][_0x12e2('0x5e')]){_0x48b16c=as[_0x12e2('0x5f')](_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x5e')]);var _0x50bf03=_0x48b16c[_0x12e2('0x60')];for(var _0x4502da=0x0;_0x4502da<_0x48b16c[_0x12e2('0x61')]['length'];_0x4502da++){var _0x5081ca=_0x48b16c[_0x12e2('0x61')][_0x4502da];var _0x5be300='i';var _0x5afad2=_[_0x12e2('0x62')](_0x3e23e6,['name',_0x5081ca['field']]);if(!_0x5afad2){switch(_0x5081ca[_0x12e2('0x49')]){case _0x12e2('0x63'):if(_0x5081ca['value']==0x1){_0x203045[_0x12e2('0x64')]('`'+_0x5081ca['field']+_0x12e2('0x65'));}else{_0x203045[_0x12e2('0x64')]('`'+_0x5081ca[_0x12e2('0x49')]+_0x12e2('0x66'));}break;case'Contact':if(_0x5081ca[_0x12e2('0x67')]==='$substring'){if(_0x5081ca[_0x12e2('0x68')][_0x12e2('0x32')]('\x20')[_0x12e2('0x43')]>0x1){_0x4ec3b6[_0x50bf03](_0x12e2('0x69'),qs[_0x12e2('0x6a')](_0x5081ca['value']),null);}else{var _0x218a00='%'+_0x5081ca['value']+'%';_0x4ec3b6[_0x50bf03]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x218a00,_0x218a00,_0x218a00);}}else{_0x5afad2=_['find'](_0x3e23e6,[_0x12e2('0x2c'),'ContactId']);_0x5081ca[_0x12e2('0x49')]=_0x12e2('0x6b');_0x51c8dc=as['buildExpression'](_0x5be300,_0x5afad2['type'],_0x5081ca);_0x4ec3b6[_0x50bf03](_0x51c8dc['text'],_0x51c8dc['value'][_0x12e2('0x6c')],_0x51c8dc['value'][_0x12e2('0x1d')]);}break;case _0x12e2('0x6d'):var _0x4e5b0a=_0x5081ca[_0x12e2('0x68')]['split'](',')[_0x12e2('0x37')](function(_0x43c20c){return Number(_0x43c20c);});_0x4e5b0a[_0x12e2('0x33')](function(_0x526d9e){_0x2cd9f3['or'](_0x12e2('0x6e'),'%,'+_0x526d9e+',%');});_0x40e727=_[_0x12e2('0x6f')](_0x40e727,_0x4e5b0a);break;case _0x12e2('0x70'):if(_0x5081ca[_0x12e2('0x67')]===_0x12e2('0x71')){_0x4ec3b6[_0x50bf03](_0x12e2('0x72'),'%'+_0x5081ca[_0x12e2('0x68')]+'%',null);}else{_0x5afad2=_[_0x12e2('0x62')](_0x3e23e6,[_0x12e2('0x2c'),'UserId']);_0x5081ca[_0x12e2('0x49')]=_0x12e2('0x73');_0x51c8dc=as[_0x12e2('0x74')](_0x5be300,_0x5afad2['type'],_0x5081ca);_0x4ec3b6[_0x50bf03](_0x51c8dc['text'],_0x51c8dc[_0x12e2('0x68')][_0x12e2('0x6c')],_0x51c8dc[_0x12e2('0x68')][_0x12e2('0x1d')]);}break;case _0x12e2('0x75'):_0x51c8dc=as[_0x12e2('0x74')]('me',null,_0x5081ca);_0x4ec3b6[_0x50bf03](_0x51c8dc['text'],_0x51c8dc[_0x12e2('0x68')][_0x12e2('0x6c')],_0x51c8dc[_0x12e2('0x68')][_0x12e2('0x1d')]);break;}}else{var _0x51c8dc=as['buildExpression'](_0x5be300,_0x5afad2[_0x12e2('0x76')],_0x5081ca);_0x4ec3b6[_0x50bf03](_0x51c8dc[_0x12e2('0x77')],_0x51c8dc[_0x12e2('0x68')][_0x12e2('0x6c')],_0x51c8dc[_0x12e2('0x68')][_0x12e2('0x1d')]);}}}else{var _0x4e6cfa=_(_0x468fa4['query'])['keys']()['map'](function(_0x23900b){return _[_0x12e2('0x78')](_0x3e23e6,['name',_0x23900b])?_0x23900b:undefined;})['compact']()[_0x12e2('0x68')]();if(!_['isEmpty'](_0x4e6cfa)){_0x4e6cfa['forEach'](function(_0x183e3b){if(_0x183e3b===_0x12e2('0x79')){_0x203045[_0x12e2('0x47')]('i.FaxAccountId\x20IN\x20?',[][_0x12e2('0x7a')](_0x468fa4[_0x12e2('0x3e')][_0x183e3b]));}else if(_0x183e3b===_0x12e2('0x7b')){var _0x55546b=JSON[_0x12e2('0x7c')](_0x468fa4[_0x12e2('0x3e')][_0x183e3b])[_0x12e2('0x7d')];var _0x3246cd=JSON[_0x12e2('0x7c')](_0x468fa4[_0x12e2('0x3e')][_0x183e3b])['$lte'];_0x203045['where'](_0x12e2('0x7e'),_0x55546b,_0x3246cd);}else{if(_0x468fa4[_0x12e2('0x3e')][_0x183e3b]===_0x12e2('0x7f')){_0x203045[_0x12e2('0x47')]('i.'+_0x183e3b+'\x20IS\x20NULL');}else{_0x203045['where']('i.'+_0x183e3b+_0x12e2('0x80'),_0x468fa4[_0x12e2('0x3e')][_0x183e3b]);}}});}if(_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x81')]){if(_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x81')]==0x1){_0x203045['having'](_0x12e2('0x82'));}else{_0x203045[_0x12e2('0x64')](_0x12e2('0x83'));}}if(_0x468fa4['query'][_0x12e2('0x84')]){_0x40e727=_[_0x12e2('0x85')](_0x468fa4[_0x12e2('0x3e')]['tag'])?_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x84')]:new Array(_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x84')]);_0x40e727[_0x12e2('0x33')](function(_0x1c590c){_0x2cd9f3['or'](_0x12e2('0x6e'),'%,'+_0x1c590c+',%');});}if(_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x86')]){var _0x29cbc0=_0x468fa4['query'][_0x12e2('0x86')][_0x12e2('0x87')]('\x5c','\x5c\x5c')[_0x12e2('0x87')]('\x27\x27',_0x12e2('0x88'));if(qs[_0x12e2('0x89')](_0x29cbc0)){_0x4ec3b6['or'](_0x12e2('0x8a'),_0x29cbc0+'%')['or'](_0x12e2('0x8b'),_0x29cbc0+'%');}_0x4ec3b6['or'](_0x12e2('0x8c'),_0x29cbc0+'%');}}_0x203045[_0x12e2('0x47')](_0x4ec3b6);_0x203045['group']('i.id');var _0x5d4293={'type':db[_0x12e2('0x8d')][_0x12e2('0x8e')][_0x12e2('0x8f')],'raw':!![]};var _0x384c6a=_0x203045['clone']();_0x384c6a[_0x12e2('0x49')](_0x12e2('0x90'));_0x384c6a[_0x12e2('0x49')](_0x12e2('0x91'),_0x12e2('0x63'));if(_0x4aa699[_0x12e2('0x45')]){_0x4aa699[_0x12e2('0x45')][_0x12e2('0x33')](function(_0x5c27ba){_0x203045[_0x12e2('0x45')]('i.'+_0x5c27ba[0x0],_0x5c27ba[0x1]===_0x12e2('0x92')?![]:!![]);});}if(!_[_0x12e2('0x93')](_0x40e727)){_0x203045[_0x12e2('0x64')](_0x2cd9f3);_0x384c6a[_0x12e2('0x47')](_0x12e2('0x94'),_0x40e727);}BPromise[_0x12e2('0x95')]()[_0x12e2('0x27')](function(){if(!_0x48b16c){if(_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x79')]||_0x468fa4[_0x12e2('0x3e')]['journey'])return;_0x384c6a[_0x12e2('0x47')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x203045[_0x12e2('0x47')](_0x12e2('0x96'));return;}return _0x468fa4[_0x12e2('0x97')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x12e2('0x27')](function(_0x4d0047){if(_[_0x12e2('0x93')](_0x4d0047)){_0x384c6a[_0x12e2('0x47')](_0x12e2('0x98'));_0x203045['where'](_0x12e2('0x98'));}else{_0x384c6a['where'](_0x12e2('0x99'),_['map'](_0x4d0047,'id'));_0x203045[_0x12e2('0x47')](_0x12e2('0x99'),_[_0x12e2('0x37')](_0x4d0047,'id'));}});})[_0x12e2('0x27')](function(){db[_0x12e2('0x9a')]['query'](_0x384c6a['toString'](),_0x5d4293)[_0x12e2('0x27')](function(_0x4301c8){_0x5e2246[_0x12e2('0x1f')]=_0x4301c8['length'];if(_0x5e2246[_0x12e2('0x1f')]===0x0)return[];return db['sequelize'][_0x12e2('0x3e')](_0x149052['toString'](),_0x5d4293)[_0x12e2('0x27')](function(_0x140de4){_0x32f02e=_['keyBy'](_0x140de4,'id');_0x5d4293=_['merge'](_0x5d4293,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x468fa4[_0x12e2('0x3e')][_0x12e2('0x42')]){_0x4aa699[_0x12e2('0x41')][_0x12e2('0x33')](function(_0x147001){_0x203045[_0x12e2('0x49')]('i.'+_0x147001);});}else{_0x203045['field'](_0x12e2('0x91'),'unreadMessages');_0x203045[_0x12e2('0x49')](_0x12e2('0x9b'),'Account.key');_0x203045[_0x12e2('0x49')](_0x12e2('0x9c'),_0x12e2('0x9d'));_0x203045['field'](_0x12e2('0x9e'));_0x203045[_0x12e2('0x49')]('c.firstName','Contact.firstName');_0x203045[_0x12e2('0x49')]('c.lastName',_0x12e2('0x9f'));_0x203045[_0x12e2('0x49')](_0x12e2('0xa0'),'Contact.email');_0x203045[_0x12e2('0x49')](_0x12e2('0xa1'),'Contact.phone');_0x203045['field'](_0x12e2('0xa2'),'Contact.mobile');_0x203045[_0x12e2('0x49')]('c.fax',_0x12e2('0xa3'));_0x203045[_0x12e2('0x49')](_0x12e2('0xa4'),_0x12e2('0xa5'));_0x203045[_0x12e2('0x49')](_0x12e2('0xa6'),_0x12e2('0xa7'));_0x203045[_0x12e2('0x49')](_0x12e2('0xa8'),_0x12e2('0x30'));}if(_0x4aa699[_0x12e2('0x21')])_0x203045[_0x12e2('0x21')](_0x4aa699['limit']);if(_0x4aa699[_0x12e2('0x20')])_0x203045['offset'](_0x4aa699[_0x12e2('0x20')]);return db[_0x12e2('0x9a')][_0x12e2('0x3e')](_0x203045[_0x12e2('0xa9')](),_0x5d4293);})[_0x12e2('0x27')](function(_0x142f0b){_0x25d117[_0x12e2('0x47')](_0x12e2('0xaa'),_['map'](_0x142f0b,'id'));return db[_0x12e2('0x9a')][_0x12e2('0x3e')](_0x25d117[_0x12e2('0xa9')](),_0x5d4293)[_0x12e2('0x27')](function(_0x197437){var _0x14ce7f=_[_0x12e2('0xab')](_0x197437,'FaxInteractionId');var _0x26617c=[];_0x142f0b[_0x12e2('0x33')](function(_0x17d3aa){_0x26617c[_0x12e2('0x34')](updateFaxInteraction(_0x17d3aa,_0x32f02e,_0x14ce7f));});return BPromise[_0x12e2('0xac')](_0x26617c);});});})[_0x12e2('0x27')](function(_0x112c76){_0x5e2246[_0x12e2('0xad')]=_0x112c76;return _0x5e2246;})['then'](respondWithFilteredResult(_0x382ddf,_0x4aa699));})['catch'](handleError(_0x382ddf,null));};exports[_0x12e2('0xae')]=function(_0x4c06ab,_0x400476){var _0x1d5650={'raw':![],'where':{'id':_0x4c06ab[_0x12e2('0xaf')]['id']}},_0x323b76={};_0x323b76[_0x12e2('0x3c')]=_[_0x12e2('0x3d')](db[_0x12e2('0x38')][_0x12e2('0x39')]);_0x323b76[_0x12e2('0x3e')]=_[_0x12e2('0x3d')](_0x4c06ab[_0x12e2('0x3e')]);_0x323b76[_0x12e2('0x3f')]=_[_0x12e2('0x40')](_0x323b76[_0x12e2('0x3c')],_0x323b76[_0x12e2('0x3e')]);_0x1d5650[_0x12e2('0x41')]=_['intersection'](_0x323b76[_0x12e2('0x3c')],qs[_0x12e2('0x42')](_0x4c06ab[_0x12e2('0x3e')][_0x12e2('0x42')]));_0x1d5650[_0x12e2('0x41')]=_0x1d5650['attributes'][_0x12e2('0x43')]?_0x1d5650[_0x12e2('0x41')]:_0x323b76[_0x12e2('0x3c')];if(_0x4c06ab['query'][_0x12e2('0xb0')]){_0x1d5650[_0x12e2('0xb1')]=[{'all':!![]}];}_0x1d5650=_['merge']({},_0x1d5650,_0x4c06ab['options']);return db[_0x12e2('0x38')][_0x12e2('0x62')](_0x1d5650)[_0x12e2('0x27')](handleEntityNotFound(_0x400476,null))[_0x12e2('0x27')](respondWithResult(_0x400476,null))[_0x12e2('0x35')](handleError(_0x400476,null));};exports[_0x12e2('0xb2')]=function(_0x322e6b,_0x402075){return db['FaxInteraction']['create'](_0x322e6b[_0x12e2('0x75')],{})['then'](respondWithResult(_0x402075,0xc9))['catch'](handleError(_0x402075,null));};exports[_0x12e2('0xb3')]=function(_0x2ab72e,_0x4295df){if(_0x2ab72e['body']['id']){delete _0x2ab72e[_0x12e2('0x75')]['id'];}return db[_0x12e2('0x38')][_0x12e2('0x62')]({'where':{'id':_0x2ab72e['params']['id']}})[_0x12e2('0x27')](handleEntityNotFound(_0x4295df,null))[_0x12e2('0x27')](saveUpdates(_0x2ab72e[_0x12e2('0x75')],null))[_0x12e2('0x27')](respondWithResult(_0x4295df,null))[_0x12e2('0x35')](handleError(_0x4295df,null));};exports[_0x12e2('0x28')]=function(_0x3e9fc0,_0x16576a){return db[_0x12e2('0x38')]['find']({'where':{'id':_0x3e9fc0[_0x12e2('0xaf')]['id']}})[_0x12e2('0x27')](handleEntityNotFound(_0x16576a,null))[_0x12e2('0x27')](removeEntity(_0x16576a,null))[_0x12e2('0x35')](handleError(_0x16576a,null));};exports[_0x12e2('0xb4')]=function(_0x1cf10a,_0x204ae3){return db['FaxInteraction'][_0x12e2('0xb4')]()[_0x12e2('0x27')](respondWithResult(_0x204ae3,null))[_0x12e2('0x35')](handleError(_0x204ae3,null));};exports[_0x12e2('0xb5')]=function(_0xf47db3,_0x42f9a2,_0x2480ae){return db[_0x12e2('0xb6')]['find']({'where':{'id':_0xf47db3[_0x12e2('0xaf')]['id']}})[_0x12e2('0x27')](handleEntityNotFound(_0x42f9a2,null))[_0x12e2('0x27')](function(_0xf481a5){if(_0xf481a5){return _0xf481a5['addMessage'](_0xf47db3[_0x12e2('0x75')]['ids'],_[_0x12e2('0xb7')](_0xf47db3[_0x12e2('0x75')],[_0x12e2('0xb8'),'id'])||{});}})[_0x12e2('0x27')](respondWithResult(_0x42f9a2,null))[_0x12e2('0x35')](handleError(_0x42f9a2,null));};exports[_0x12e2('0xb9')]=function(_0x3d2b1c,_0x333a87,_0x596ef5){var _0x4d40c2={'raw':![],'where':{}};var _0x91c798={};var _0x452796={'count':0x0,'rows':[]};return db[_0x12e2('0x38')][_0x12e2('0xba')]({'where':{'id':_0x3d2b1c[_0x12e2('0xaf')]['id']}})[_0x12e2('0x27')](handleEntityNotFound(_0x333a87,null))[_0x12e2('0x27')](function(_0x56819f){if(_0x56819f){_0x91c798[_0x12e2('0x3c')]=_[_0x12e2('0x3d')](db['FaxMessage']['rawAttributes']);_0x91c798[_0x12e2('0x3e')]=_['keys'](_0x3d2b1c[_0x12e2('0x3e')]);_0x91c798[_0x12e2('0x3f')]=_[_0x12e2('0x40')](_0x91c798[_0x12e2('0x3c')],_0x91c798[_0x12e2('0x3e')]);_0x4d40c2['attributes']=_[_0x12e2('0x40')](_0x91c798[_0x12e2('0x3c')],qs[_0x12e2('0x42')](_0x3d2b1c[_0x12e2('0x3e')][_0x12e2('0x42')]));_0x4d40c2[_0x12e2('0x41')]=_0x4d40c2[_0x12e2('0x41')]['length']?_0x4d40c2['attributes']:_0x91c798[_0x12e2('0x3c')];if(!_0x3d2b1c[_0x12e2('0x3e')][_0x12e2('0x44')](_0x12e2('0xbb'))){_0x4d40c2[_0x12e2('0x21')]=qs['limit'](_0x3d2b1c[_0x12e2('0x3e')][_0x12e2('0x21')]);_0x4d40c2[_0x12e2('0x20')]=qs['offset'](_0x3d2b1c[_0x12e2('0x3e')][_0x12e2('0x20')]);}_0x4d40c2[_0x12e2('0x45')]=qs['sort'](_0x3d2b1c['query'][_0x12e2('0x46')]);_0x4d40c2[_0x12e2('0x47')]=qs[_0x12e2('0x3f')](_[_0x12e2('0x48')](_0x3d2b1c[_0x12e2('0x3e')],_0x91c798[_0x12e2('0x3f')]));_0x4d40c2[_0x12e2('0x47')][_0x12e2('0xbc')]=_0x56819f['id'];if(_0x3d2b1c[_0x12e2('0x3e')][_0x12e2('0x86')]){_0x4d40c2[_0x12e2('0x47')]=_[_0x12e2('0xbd')](_0x4d40c2[_0x12e2('0x47')],{'$or':_[_0x12e2('0x37')](_0x4d40c2[_0x12e2('0x41')],function(_0x1704b1){var _0xb6124e={};_0xb6124e[_0x1704b1]={'$like':'%'+_0x3d2b1c['query'][_0x12e2('0x86')]+'%'};return _0xb6124e;})});}if(_0x3d2b1c['query']['$gte']){var _0x1e5ae7=_0x3d2b1c[_0x12e2('0x3e')][_0x12e2('0x7d')][_0x12e2('0x32')](',');var _0x11dd78={};_0x11dd78[_0x1e5ae7[0x0]]={'$gte':moment(_0x1e5ae7[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4d40c2['where']=_[_0x12e2('0xbd')](_0x4d40c2['where'],_0x11dd78);}_0x4d40c2=_[_0x12e2('0xbd')]({},_0x4d40c2,_0x3d2b1c[_0x12e2('0xbe')]);return db['FaxMessage'][_0x12e2('0x1f')]({'where':_0x4d40c2[_0x12e2('0x47')]})[_0x12e2('0x27')](function(_0x235588){_0x452796['count']=_0x235588;if(_0x3d2b1c['query'][_0x12e2('0xb0')]){_0x4d40c2[_0x12e2('0xb1')]=[{'all':!![]}];}return db[_0x12e2('0xb6')][_0x12e2('0xbf')](_0x4d40c2);})[_0x12e2('0x27')](function(_0x1f93bd){_0x452796[_0x12e2('0xad')]=_0x1f93bd;return _0x452796;});}})[_0x12e2('0x27')](respondWithFilteredResult(_0x333a87,_0x4d40c2))[_0x12e2('0x35')](handleError(_0x333a87,null));};exports[_0x12e2('0xc0')]=function(_0x2eff49,_0x4145e1,_0x30ba70){return db[_0x12e2('0x38')][_0x12e2('0x62')]({'where':{'id':_0x2eff49[_0x12e2('0xaf')]['id']}})[_0x12e2('0x27')](handleEntityNotFound(_0x4145e1,null))[_0x12e2('0x27')](function(_0x547722){if(_0x547722){return _0x547722[_0x12e2('0xc1')](_0x2eff49[_0x12e2('0x75')]['ids'],_[_0x12e2('0xb7')](_0x2eff49[_0x12e2('0x75')],[_0x12e2('0xb8'),'id'])||{})[_0x12e2('0xc2')](function(){return db[_0x12e2('0x6d')][_0x12e2('0xbf')]({'attributes':['id',_0x12e2('0x2c'),_0x12e2('0x4a')],'where':{'id':_0x2eff49[_0x12e2('0x75')]['ids']}});})[_0x12e2('0x27')](function(_0x2bf228){socket[_0x12e2('0xc3')]('faxInteractionTags:save',{'id':Number(_0x2eff49['params']['id']),'tags':_0x2bf228||[]});return{'id':Number(_0x2eff49['params']['id']),'tags':_0x2bf228||[]};});}})['then'](respondWithResult(_0x4145e1,null))[_0x12e2('0x35')](handleError(_0x4145e1,null));};exports[_0x12e2('0xc4')]=function(_0x3e84d8,_0x3c0b1f,_0x41b804){return db[_0x12e2('0x38')][_0x12e2('0x62')]({'where':{'id':_0x3e84d8[_0x12e2('0xaf')]['id']}})[_0x12e2('0x27')](handleEntityNotFound(_0x3c0b1f,null))[_0x12e2('0x27')](function(_0x404c9f){if(_0x404c9f){return _0x404c9f['removeTags'](_0x3e84d8['query'][_0x12e2('0xb8')]);}})['then'](respondWithStatusCode(_0x3c0b1f,null))[_0x12e2('0x35')](handleError(_0x3c0b1f,null));};exports[_0x12e2('0xc5')]=function(_0x2bc8e6,_0x84acf4){var _0x553d52=moment()[_0x12e2('0xc6')]()[_0x12e2('0xa9')]();var _0x1c13eb=path[_0x12e2('0xc7')](config[_0x12e2('0xc8')],'server',_0x12e2('0xc9'),_0x12e2('0xca'));var _0x34bf6e=path[_0x12e2('0xc7')](config['root'],_0x12e2('0xcb'),_0x12e2('0xc9'),_0x12e2('0xcc'));var _0x1b9157=path[_0x12e2('0xc7')](_0x1c13eb,_0x553d52);var _0x326bd8=util['format']('transcript-%d-%s.zip',_0x2bc8e6['params']['id'],_0x553d52);var _0x512564=path[_0x12e2('0xc7')](_0x1c13eb,_0x326bd8);var _0x512620=[];_0x512620[_0x12e2('0x34')]({'model':db[_0x12e2('0xcd')],'as':'Attachment','raw':!![]});var _0x461d62=[{'model':db[_0x12e2('0xb6')],'as':_0x12e2('0xce'),'attributes':['id',_0x12e2('0x75'),_0x12e2('0x7b')],'include':_0x512620}];return db['FaxInteraction'][_0x12e2('0x62')]({'where':{'id':_0x2bc8e6['params']['id']},'include':_0x461d62})[_0x12e2('0x27')](handleEntityNotFound(_0x84acf4,null))[_0x12e2('0x27')](function(_0x41a255){if(_0x41a255&&_0x41a255[_0x12e2('0xce')]){var _0x91553=_0x41a255[_0x12e2('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x1b9157);for(var _0x3947e5=0x0;_0x3947e5<_0x91553['Messages'][_0x12e2('0x43')];_0x3947e5++){var _0x44a2d5=_0x91553['Messages'][_0x3947e5][_0x12e2('0xcd')];if(_0x44a2d5){var _0x109e6b=path[_0x12e2('0xc7')](_0x34bf6e,_0x44a2d5['basename']);if(fs['existsSync'](_0x109e6b)){fs[_0x12e2('0xd0')](_0x109e6b)['pipe'](fs[_0x12e2('0xd1')](path[_0x12e2('0xc7')](_0x1b9157,_0x44a2d5['basename'])));}}}return BPromise[_0x12e2('0x95')]()[_0x12e2('0x27')](function(){return new BPromise(function(_0x4883ee,_0xa5c2e7){zipdir(_0x1b9157,{'saveTo':_0x512564},function(_0x336815,_0x72b34c){if(_0x336815)return _0xa5c2e7(_0x336815);return _0x4883ee(_0x72b34c);});})[_0x12e2('0x27')](function(){return new BPromise(function(_0x2df902,_0x489dbf){rimraf(_0x1b9157,function(_0x419141){if(_0x419141)_0x489dbf(_0x419141);return _0x2df902();});});})[_0x12e2('0x27')](function(){return _0x84acf4[_0x12e2('0xc5')](_0x512564,_0x326bd8,function(_0x2bccf6){if(_0x2bccf6){console[_0x12e2('0xd2')](_0x12e2('0xd3'),_0x2bccf6);}else{fs[_0x12e2('0xd4')](_0x512564);}});});});}else{return _0x84acf4[_0x12e2('0x29')](0xc8);}})['catch'](handleError(_0x84acf4,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9eb41ca..0748749 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(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'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(_0x5a8678,_0x2b834d){var _0x117447=function(_0x4b938f){while(--_0x4b938f){_0x5a8678['push'](_0x5a8678['shift']());}};_0x117447(++_0x2b834d);}(_0x814b,0x1a2));var _0xb814=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0x814b[_0x19997d];return _0x49be7f;};'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 1052706..eedb2f7 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(_0x417f06,_0x1abdf6){var _0x30f125=function(_0x39a3b8){while(--_0x39a3b8){_0x417f06['push'](_0x417f06['shift']());}};_0x30f125(++_0x1abdf6);}(_0x91a7,0xe7));var _0x791a=function(_0xd16b03,_0x1c2e95){_0xd16b03=_0xd16b03-0x0;var _0x4422b1=_0x91a7[_0xd16b03];return _0x4422b1;};'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 _0xd2ea=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2d4c3b,_0x504b57){var _0x4200f7=function(_0x3d299f){while(--_0x3d299f){_0x2d4c3b['push'](_0x2d4c3b['shift']());}};_0x4200f7(++_0x504b57);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1e3e1e,_0x45192a){_0x1e3e1e=_0x1e3e1e-0x0;var _0x5369ee=_0xd2ea[_0x1e3e1e];return _0x5369ee;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5710ac,_0x1e0e9e,_0x19bb0d){if(_0x5710ac['changed'](_0xad2e('0xe'))){_0x5710ac['closedAt']=moment()[_0xad2e('0xf')](_0xad2e('0x10'));}_0x19bb0d(null,_0x5710ac);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2c40462..1444781 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 _0xdd16=['error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','attributes','AddTagsToFaxInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5ad791,_0x333863){var _0x5b57e8=function(_0x5ec114){while(--_0x5ec114){_0x5ad791['push'](_0x5ad791['shift']());}};_0x5b57e8(++_0x333863);}(_0xdd16,0x68));var _0x6dd1=function(_0x1478b1,_0x44d243){_0x1478b1=_0x1478b1-0x0;var _0x2eefaf=_0xdd16[_0x1478b1];return _0x2eefaf;};'use strict';var _=require(_0x6dd1('0x0'));var util=require(_0x6dd1('0x1'));var moment=require(_0x6dd1('0x2'));var BPromise=require('bluebird');var rs=require(_0x6dd1('0x3'));var fs=require('fs');var Redis=require(_0x6dd1('0x4'));var db=require(_0x6dd1('0x5'))['db'];var utils=require(_0x6dd1('0x6'));var logger=require(_0x6dd1('0x7'))(_0x6dd1('0x8'));var config=require('../../config/environment');var jayson=require(_0x6dd1('0x9'));var client=jayson[_0x6dd1('0xa')][_0x6dd1('0xb')]({'port':0x232a});config[_0x6dd1('0xc')]=_[_0x6dd1('0xd')](config[_0x6dd1('0xc')],{'host':_0x6dd1('0xe'),'port':0x18eb});var socket=require(_0x6dd1('0xf'))(new Redis(config['redis']));require(_0x6dd1('0x10'))[_0x6dd1('0x11')](socket);function respondWithRpcPromise(_0x40e4ac,_0x1ecf3b,_0x2d92af){return new BPromise(function(_0x458b4b,_0x5b7e7c){return client[_0x6dd1('0x12')](_0x40e4ac,_0x2d92af)[_0x6dd1('0x13')](function(_0x391b96){logger[_0x6dd1('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x1ecf3b,_0x6dd1('0x15'));logger[_0x6dd1('0x16')](_0x6dd1('0x17'),_0x1ecf3b,_0x6dd1('0x15'),JSON[_0x6dd1('0x18')](_0x391b96));if(_0x391b96[_0x6dd1('0x19')]){if(_0x391b96['error'][_0x6dd1('0x1a')]===0x1f4){logger[_0x6dd1('0x19')](_0x6dd1('0x1b'),_0x1ecf3b,_0x391b96[_0x6dd1('0x19')][_0x6dd1('0x1c')]);return _0x5b7e7c(_0x391b96[_0x6dd1('0x19')][_0x6dd1('0x1c')]);}logger['error'](_0x6dd1('0x1b'),_0x1ecf3b,_0x391b96['error'][_0x6dd1('0x1c')]);return _0x458b4b(_0x391b96[_0x6dd1('0x19')][_0x6dd1('0x1c')]);}else{logger[_0x6dd1('0x14')](_0x6dd1('0x1b'),_0x1ecf3b,'request\x20sent');_0x458b4b(_0x391b96[_0x6dd1('0x1d')]['message']);}})[_0x6dd1('0x1e')](function(_0x23ae13){logger[_0x6dd1('0x19')](_0x6dd1('0x1b'),_0x1ecf3b,_0x23ae13);_0x5b7e7c(_0x23ae13);});});}exports[_0x6dd1('0x1f')]=function(_0x597792){var _0x1fd145=this;return new Promise(function(_0x972e4a,_0x4fe075){return db[_0x6dd1('0x20')]['update'](_0x597792[_0x6dd1('0x21')],{'raw':_0x597792[_0x6dd1('0x22')]?_0x597792[_0x6dd1('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597792[_0x6dd1('0x22')]?_0x597792[_0x6dd1('0x22')]['where']||null:null,'attributes':_0x597792['options']?_0x597792['options'][_0x6dd1('0x23')]||null:null,'limit':_0x597792[_0x6dd1('0x22')]?_0x597792[_0x6dd1('0x22')]['limit']||null:null})[_0x6dd1('0x13')](function(_0x12494c){logger['info']('UpdateFaxInteraction',_0x597792);logger['debug'](_0x6dd1('0x1f'),_0x597792,JSON[_0x6dd1('0x18')](_0x12494c));_0x972e4a(_0x12494c);})[_0x6dd1('0x1e')](function(_0x508b07){logger[_0x6dd1('0x19')](_0x6dd1('0x1f'),_0x508b07[_0x6dd1('0x1c')],_0x597792);_0x4fe075(_0x1fd145[_0x6dd1('0x19')](0x1f4,_0x508b07['message']));});});};exports[_0x6dd1('0x24')]=function(_0x29e10f){return new Promise(function(_0x310173,_0x4a161f){return db[_0x6dd1('0x20')][_0x6dd1('0x25')]({'where':_0x29e10f[_0x6dd1('0x22')]?_0x29e10f[_0x6dd1('0x22')][_0x6dd1('0x26')]||null:null})['then'](function(_0x351acc){if(_0x351acc){return _0x351acc[_0x6dd1('0x27')](_0x29e10f[_0x6dd1('0x21')][_0x6dd1('0x28')],_['omit'](_0x29e10f[_0x6dd1('0x21')],[_0x6dd1('0x28'),'id'])||{});}})[_0x6dd1('0x29')](function(_0x31aa50){logger['info'](_0x6dd1('0x2a'),_0x29e10f);logger['debug'](_0x6dd1('0x2a'),_0x29e10f,JSON[_0x6dd1('0x18')](_0x31aa50));_0x310173(_0x31aa50);})[_0x6dd1('0x1e')](function(_0x1fa99e){logger['error'](_0x6dd1('0x2a'),_0x1fa99e[_0x6dd1('0x1c')],_0x29e10f);_0x4a161f(_this[_0x6dd1('0x19')](0x1f4,_0x1fa99e[_0x6dd1('0x1c')]));});});}; \ No newline at end of file +var _0xdf1d=['message','info','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','ids','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x314e35,_0x568de3){var _0x449332=function(_0x30d84b){while(--_0x30d84b){_0x314e35['push'](_0x314e35['shift']());}};_0x449332(++_0x568de3);}(_0xdf1d,0x179));var _0xddf1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdf1d[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xddf1('0x0'));var BPromise=require(_0xddf1('0x1'));var rs=require(_0xddf1('0x2'));var fs=require('fs');var Redis=require(_0xddf1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xddf1('0x4'));var logger=require(_0xddf1('0x5'))('rpc');var config=require(_0xddf1('0x6'));var jayson=require(_0xddf1('0x7'));var client=jayson[_0xddf1('0x8')][_0xddf1('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xddf1('0xa')],{'host':_0xddf1('0xb'),'port':0x18eb});var socket=require(_0xddf1('0xc'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xddf1('0xd')](socket);function respondWithRpcPromise(_0x2b3198,_0x4a3940,_0x1a76b0){return new BPromise(function(_0x104462,_0x6b963d){return client[_0xddf1('0xe')](_0x2b3198,_0x1a76b0)[_0xddf1('0xf')](function(_0x5c631e){logger['info'](_0xddf1('0x10'),_0x4a3940,_0xddf1('0x11'));logger[_0xddf1('0x12')](_0xddf1('0x13'),_0x4a3940,'request\x20sent',JSON[_0xddf1('0x14')](_0x5c631e));if(_0x5c631e[_0xddf1('0x15')]){if(_0x5c631e['error'][_0xddf1('0x16')]===0x1f4){logger[_0xddf1('0x15')](_0xddf1('0x10'),_0x4a3940,_0x5c631e[_0xddf1('0x15')][_0xddf1('0x17')]);return _0x6b963d(_0x5c631e[_0xddf1('0x15')][_0xddf1('0x17')]);}logger[_0xddf1('0x15')](_0xddf1('0x10'),_0x4a3940,_0x5c631e[_0xddf1('0x15')][_0xddf1('0x17')]);return _0x104462(_0x5c631e[_0xddf1('0x15')][_0xddf1('0x17')]);}else{logger[_0xddf1('0x18')](_0xddf1('0x10'),_0x4a3940,_0xddf1('0x11'));_0x104462(_0x5c631e['result'][_0xddf1('0x17')]);}})[_0xddf1('0x19')](function(_0x5dbc64){logger[_0xddf1('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x4a3940,_0x5dbc64);_0x6b963d(_0x5dbc64);});});}exports[_0xddf1('0x1a')]=function(_0xa7b021){var _0x3b3210=this;return new Promise(function(_0x44270d,_0x5849c8){return db['FaxInteraction'][_0xddf1('0x1b')](_0xa7b021[_0xddf1('0x1c')],{'raw':_0xa7b021[_0xddf1('0x1d')]?_0xa7b021[_0xddf1('0x1d')][_0xddf1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7b021['options']?_0xa7b021[_0xddf1('0x1d')][_0xddf1('0x1f')]||null:null,'attributes':_0xa7b021[_0xddf1('0x1d')]?_0xa7b021[_0xddf1('0x1d')][_0xddf1('0x20')]||null:null,'limit':_0xa7b021[_0xddf1('0x1d')]?_0xa7b021['options']['limit']||null:null})['then'](function(_0x4ea4ff){logger['info'](_0xddf1('0x1a'),_0xa7b021);logger[_0xddf1('0x12')](_0xddf1('0x1a'),_0xa7b021,JSON[_0xddf1('0x14')](_0x4ea4ff));_0x44270d(_0x4ea4ff);})[_0xddf1('0x19')](function(_0x248a64){logger[_0xddf1('0x15')]('UpdateFaxInteraction',_0x248a64[_0xddf1('0x17')],_0xa7b021);_0x5849c8(_0x3b3210[_0xddf1('0x15')](0x1f4,_0x248a64['message']));});});};exports[_0xddf1('0x21')]=function(_0x52764c){return new Promise(function(_0x7c50f5,_0x241898){return db[_0xddf1('0x22')][_0xddf1('0x23')]({'where':_0x52764c['options']?_0x52764c[_0xddf1('0x1d')][_0xddf1('0x1f')]||null:null})[_0xddf1('0xf')](function(_0x19eb66){if(_0x19eb66){return _0x19eb66[_0xddf1('0x24')](_0x52764c[_0xddf1('0x1c')]['ids'],_[_0xddf1('0x25')](_0x52764c[_0xddf1('0x1c')],[_0xddf1('0x26'),'id'])||{});}})['spread'](function(_0x2f7ebc){logger[_0xddf1('0x18')](_0xddf1('0x27'),_0x52764c);logger[_0xddf1('0x12')](_0xddf1('0x27'),_0x52764c,JSON['stringify'](_0x2f7ebc));_0x7c50f5(_0x2f7ebc);})['catch'](function(_0x2e096c){logger[_0xddf1('0x15')]('AddTags',_0x2e096c[_0xddf1('0x17')],_0x52764c);_0x241898(_this[_0xddf1('0x15')](0x1f4,_0x2e096c[_0xddf1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index fc867a0..61eda9a 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 _0x1dcc=['faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x279be4,_0x4d3e28){var _0x4052a8=function(_0x4e2660){while(--_0x4e2660){_0x279be4['push'](_0x279be4['shift']());}};_0x4052a8(++_0x4d3e28);}(_0x1dcc,0x79));var _0xc1dc=function(_0x58e2ef,_0x192eec){_0x58e2ef=_0x58e2ef-0x0;var _0x5eda8f=_0x1dcc[_0x58e2ef];return _0x5eda8f;};'use strict';var FaxInteractionEvents=require(_0xc1dc('0x0'));var events=['save',_0xc1dc('0x1'),_0xc1dc('0x2')];function createListener(_0x5a3758,_0x46aaa2){return function(_0x752a7a){_0x46aaa2[_0xc1dc('0x3')](_0x5a3758,_0x752a7a);};}function removeListener(_0xd6702,_0x59f7a5){return function(){FaxInteractionEvents[_0xc1dc('0x4')](_0xd6702,_0x59f7a5);};}exports[_0xc1dc('0x5')]=function(_0x524010){for(var _0x9e0540=0x0,_0x2a6b9c=events[_0xc1dc('0x6')];_0x9e0540<_0x2a6b9c;_0x9e0540++){var _0x412c54=events[_0x9e0540];var _0x3ad04d=createListener(_0xc1dc('0x7')+_0x412c54,_0x524010);FaxInteractionEvents['on'](_0x412c54,_0x3ad04d);}}; \ No newline at end of file +var _0x7a91=['save','remove','update','emit','removeListener','length','./faxInteraction.events'];(function(_0x5c9b55,_0x5befc4){var _0x113969=function(_0x5a404d){while(--_0x5a404d){_0x5c9b55['push'](_0x5c9b55['shift']());}};_0x113969(++_0x5befc4);}(_0x7a91,0x12c));var _0x17a9=function(_0xa63ea3,_0x4367ff){_0xa63ea3=_0xa63ea3-0x0;var _0x2aa5ff=_0x7a91[_0xa63ea3];return _0x2aa5ff;};'use strict';var FaxInteractionEvents=require(_0x17a9('0x0'));var events=[_0x17a9('0x1'),_0x17a9('0x2'),_0x17a9('0x3')];function createListener(_0x149469,_0x3bebd2){return function(_0x4c1fc4){_0x3bebd2[_0x17a9('0x4')](_0x149469,_0x4c1fc4);};}function removeListener(_0x28ead3,_0x2d82c8){return function(){FaxInteractionEvents[_0x17a9('0x5')](_0x28ead3,_0x2d82c8);};}exports['register']=function(_0x50674b){for(var _0x15e630=0x0,_0x2ff547=events[_0x17a9('0x6')];_0x15e630<_0x2ff547;_0x15e630++){var _0x21935b=events[_0x15e630];var _0xabaca=createListener('faxInteraction:'+_0x21935b,_0x50674b);FaxInteractionEvents['on'](_0x21935b,_0xabaca);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9cdf057..b76f4b4 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 _0xb522=['/:id/messages','download','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0xefd0ea,_0x2b5a38){var _0x310aa4=function(_0xb4bdad){while(--_0xb4bdad){_0xefd0ea['push'](_0xefd0ea['shift']());}};_0x310aa4(++_0x2b5a38);}(_0xb522,0x188));var _0x2b52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb522[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2b52('0x0'));var util=require(_0x2b52('0x1'));var path=require(_0x2b52('0x2'));var timeout=require(_0x2b52('0x3'));var express=require('express');var router=express[_0x2b52('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b52('0x5'));var config=require('../../config/environment');var controller=require(_0x2b52('0x6'));router['get']('/',auth[_0x2b52('0x7')](),controller[_0x2b52('0x8')]);router[_0x2b52('0x9')](_0x2b52('0xa'),auth[_0x2b52('0x7')](),controller['describe']);router[_0x2b52('0x9')](_0x2b52('0xb'),auth[_0x2b52('0x7')](),controller[_0x2b52('0xc')]);router[_0x2b52('0x9')](_0x2b52('0xd'),auth[_0x2b52('0x7')](),controller['getMessages']);router[_0x2b52('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x2b52('0xe')]);router[_0x2b52('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2b52('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0x2b52('0xf')](_0x2b52('0x10'),auth['isAuthenticated'](),interaction[_0x2b52('0x11')](_0x2b52('0x12'),_0x2b52('0x13')),controller[_0x2b52('0x14')]);router['put'](_0x2b52('0xb'),auth[_0x2b52('0x7')](),interaction['tracked']('fax',_0x2b52('0x15')),controller[_0x2b52('0x16')]);router[_0x2b52('0x17')]('/:id',auth[_0x2b52('0x7')](),interaction[_0x2b52('0x11')](_0x2b52('0x12'),'faxinteraction:destroy'),controller[_0x2b52('0x18')]);router[_0x2b52('0x17')](_0x2b52('0x10'),auth[_0x2b52('0x7')](),controller[_0x2b52('0x19')]);module[_0x2b52('0x1a')]=router; \ No newline at end of file +var _0x3cec=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','/:id/tags','tracked','fax','faxinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get'];(function(_0x5bc4e2,_0x427ff9){var _0x4c93f9=function(_0x1e8546){while(--_0x1e8546){_0x5bc4e2['push'](_0x5bc4e2['shift']());}};_0x4c93f9(++_0x427ff9);}(_0x3cec,0xb0));var _0xc3ce=function(_0x30ef62,_0x372cdd){_0x30ef62=_0x30ef62-0x0;var _0x32b26d=_0x3cec[_0x30ef62];return _0x32b26d;};'use strict';var multer=require(_0xc3ce('0x0'));var util=require(_0xc3ce('0x1'));var path=require(_0xc3ce('0x2'));var timeout=require(_0xc3ce('0x3'));var express=require(_0xc3ce('0x4'));var router=express[_0xc3ce('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc3ce('0x6'));var config=require(_0xc3ce('0x7'));var controller=require(_0xc3ce('0x8'));router[_0xc3ce('0x9')]('/',auth[_0xc3ce('0xa')](),controller[_0xc3ce('0xb')]);router[_0xc3ce('0x9')](_0xc3ce('0xc'),auth[_0xc3ce('0xa')](),controller[_0xc3ce('0xd')]);router[_0xc3ce('0x9')](_0xc3ce('0xe'),auth[_0xc3ce('0xa')](),controller[_0xc3ce('0xf')]);router['get'](_0xc3ce('0x10'),auth['isAuthenticated'](),controller[_0xc3ce('0x11')]);router[_0xc3ce('0x9')](_0xc3ce('0x12'),auth[_0xc3ce('0xa')](),controller[_0xc3ce('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc3ce('0x14')]);router['post'](_0xc3ce('0x10'),auth[_0xc3ce('0xa')](),controller[_0xc3ce('0x15')]);router['post'](_0xc3ce('0x16'),auth[_0xc3ce('0xa')](),interaction[_0xc3ce('0x17')](_0xc3ce('0x18'),'faxinteraction:addtags'),controller['addTags']);router['put'](_0xc3ce('0xe'),auth[_0xc3ce('0xa')](),interaction['tracked'](_0xc3ce('0x18'),_0xc3ce('0x19')),controller[_0xc3ce('0x1a')]);router[_0xc3ce('0x1b')](_0xc3ce('0xe'),auth[_0xc3ce('0xa')](),interaction[_0xc3ce('0x17')]('fax','faxinteraction:destroy'),controller[_0xc3ce('0x1c')]);router[_0xc3ce('0x1b')](_0xc3ce('0x16'),auth[_0xc3ce('0xa')](),controller[_0xc3ce('0x1d')]);module[_0xc3ce('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8402120..521e504 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 _0x301c=['DATE','sequelize','TEXT','medium','out'];(function(_0x48386e,_0x7a882d){var _0x4bd316=function(_0x37003e){while(--_0x37003e){_0x48386e['push'](_0x48386e['shift']());}};_0x4bd316(++_0x7a882d);}(_0x301c,0x15f));var _0xc301=function(_0x2afaf3,_0x4ebf7a){_0x2afaf3=_0x2afaf3-0x0;var _0xf45003=_0x301c[_0x2afaf3];return _0xf45003;};'use strict';var Sequelize=require(_0xc301('0x0'));module['exports']={'body':{'type':Sequelize[_0xc301('0x1')](_0xc301('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc301('0x3')),'defaultValue':_0xc301('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xc301('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc301('0x4')]}}; \ No newline at end of file +var _0x07fb=['ENUM','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x07fb,0x159));var _0xb07f=function(_0x174833,_0x4f5b0a){_0x174833=_0x174833-0x0;var _0x2b2f9c=_0x07fb[_0x174833];return _0x2b2f9c;};'use strict';var Sequelize=require(_0xb07f('0x0'));module[_0xb07f('0x1')]={'body':{'type':Sequelize[_0xb07f('0x2')](_0xb07f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb07f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb07f('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xb07f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xb07f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6fc878f..4b23162 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 _0x9e9a=['get','FaxInteraction','FaxInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','stringify','null','AcceptMessage','acceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','agent','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','interface','rejectmessage','create','ContactId','isNil','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','attachments','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','count','offset','set','apply','reject','save','update','destroy','status','stack','name','index','map','FaxMessage','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','UserId','user','CmContact'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9e9a,0xac));var _0xa9e9=function(_0x5869f5,_0x176fd5){_0x5869f5=_0x5869f5-0x0;var _0x6beba1=_0x9e9a[_0x5869f5];return _0x6beba1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa9e9('0x0'));var rimraf=require(_0xa9e9('0x1'));var zipdir=require(_0xa9e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9e9('0x3'));var moment=require(_0xa9e9('0x4'));var BPromise=require(_0xa9e9('0x5'));var Mustache=require('mustache');var util=require(_0xa9e9('0x6'));var path=require('path');var sox=require(_0xa9e9('0x7'));var csv=require('to-csv');var ejs=require(_0xa9e9('0x8'));var fs=require('fs');var _=require(_0xa9e9('0x9'));var squel=require(_0xa9e9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa9e9('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa9e9('0xc'));var Papa=require('papaparse');var Redis=require(_0xa9e9('0xd'));var authService=require(_0xa9e9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa9e9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9e9('0x10'));var utils=require(_0xa9e9('0x11'));var config=require(_0xa9e9('0x12'));var db=require(_0xa9e9('0x13'))['db'];config['redis']=_[_0xa9e9('0x14')](config[_0xa9e9('0x15')],{'host':_0xa9e9('0x16'),'port':0x18eb});var socket=require(_0xa9e9('0x17'))(new Redis(config[_0xa9e9('0x15')]));require(_0xa9e9('0x18'))[_0xa9e9('0x19')](socket);var jayson=require(_0xa9e9('0x1a'));var client=jayson[_0xa9e9('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0xa9e9('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4d1a04,_0x3336d9,_0x1cc08d){if(_0x1cc08d){var _0x1f49c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f49c6[_0xa9e9('0x1d')](_0x3336d9)){return _0x4d1a04;}else{throw new db[(_0xa9e9('0x1e'))][(_0xa9e9('0x1f'))](_0xa9e9('0x20'));}}else{return _0x4d1a04;}}function respondWithRpcPromise(_0x479b76,_0x4f15bb,_0x38819f,_0x51ea4c){return new BPromise(function(_0x37e58d,_0x2b92d2){var _0x1ee088=_0x51ea4c||client;return _0x1ee088[_0xa9e9('0x21')](_0x479b76,_0x38819f)[_0xa9e9('0x22')](function(_0x440fd3){logger[_0xa9e9('0x23')]('FaxMessage,\x20%s,\x20%s',_0x4f15bb,_0xa9e9('0x24'));logger[_0xa9e9('0x25')](_0xa9e9('0x26'),_0x4f15bb,'request\x20sent',JSON['stringify'](_0x440fd3));if(_0x440fd3['error']){if(_0x440fd3[_0xa9e9('0x27')][_0xa9e9('0x28')]===0x1f4){logger[_0xa9e9('0x27')](_0xa9e9('0x29'),_0x4f15bb,_0x440fd3[_0xa9e9('0x27')][_0xa9e9('0x2a')]);return _0x2b92d2(_0x440fd3[_0xa9e9('0x27')][_0xa9e9('0x2a')]);}logger[_0xa9e9('0x27')](_0xa9e9('0x29'),_0x4f15bb,_0x440fd3[_0xa9e9('0x27')][_0xa9e9('0x2a')]);return _0x37e58d(_0x440fd3[_0xa9e9('0x27')][_0xa9e9('0x2a')]);}else{logger[_0xa9e9('0x23')](_0xa9e9('0x29'),_0x4f15bb,_0xa9e9('0x24'));_0x37e58d(_0x440fd3[_0xa9e9('0x2b')][_0xa9e9('0x2a')]);}})[_0xa9e9('0x2c')](function(_0x49ee5c){logger['error'](_0xa9e9('0x29'),_0x4f15bb,_0x49ee5c);_0x2b92d2(_0x49ee5c);});});}function respondWithStatusCode(_0x4e886d,_0x2a188d){_0x2a188d=_0x2a188d||0xcc;return function(_0x3f9bbf){if(_0x3f9bbf){return _0x4e886d[_0xa9e9('0x2d')](_0x2a188d);}return _0x4e886d['status'](_0x2a188d)[_0xa9e9('0x2e')]();};}function respondWithResult(_0x32cb5f,_0x22c972){_0x22c972=_0x22c972||0xc8;return function(_0x4bd09d){if(_0x4bd09d){return _0x32cb5f['status'](_0x22c972)[_0xa9e9('0x2f')](_0x4bd09d);}};}function respondWithFilteredResult(_0x458fc3,_0x1ac3b0){return function(_0x5c25da){if(_0x5c25da){var _0x280a95=_0x5c25da[_0xa9e9('0x30')],_0x546b56=_0x1ac3b0['offset'],_0x341ea3=_0x1ac3b0[_0xa9e9('0x31')]+_0x1ac3b0['limit'],_0x2f13b5;if(_0x341ea3>=_0x280a95){_0x341ea3=_0x280a95;_0x2f13b5=0xc8;}else{_0x2f13b5=0xce;}_0x458fc3['status'](_0x2f13b5);return _0x458fc3[_0xa9e9('0x32')]('Content-Range',_0x546b56+'-'+_0x341ea3+'/'+_0x280a95)[_0xa9e9('0x2f')](_0x5c25da);}return null;};}function patchUpdates(_0x4d3946){return function(_0x5fcbd1){try{jsonpatch[_0xa9e9('0x33')](_0x5fcbd1,_0x4d3946,!![]);}catch(_0x216002){return BPromise[_0xa9e9('0x34')](_0x216002);}return _0x5fcbd1[_0xa9e9('0x35')]();};}function saveUpdates(_0x19f631,_0x4b1c7b){return function(_0x3c290d){if(_0x3c290d){return _0x3c290d[_0xa9e9('0x36')](_0x19f631)[_0xa9e9('0x22')](function(_0xc79539){return _0xc79539;});}return null;};}function removeEntity(_0x2df2f4,_0x26a29f){return function(_0x14da1d){if(_0x14da1d){return _0x14da1d[_0xa9e9('0x37')]()['then'](function(){_0x2df2f4[_0xa9e9('0x38')](0xcc)[_0xa9e9('0x2e')]();});}};}function handleEntityNotFound(_0xf89263,_0xdd1424){return function(_0x7c22a6){if(!_0x7c22a6){_0xf89263[_0xa9e9('0x2d')](0x194);}return _0x7c22a6;};}function handleError(_0x2af669,_0x3d4a91){_0x3d4a91=_0x3d4a91||0x1f4;return function(_0x5d625d){logger[_0xa9e9('0x27')](_0x5d625d[_0xa9e9('0x39')]);if(_0x5d625d['name']){delete _0x5d625d[_0xa9e9('0x3a')];}_0x2af669[_0xa9e9('0x38')](_0x3d4a91)['send'](_0x5d625d);};}exports[_0xa9e9('0x3b')]=function(_0x15beaa,_0x4af460){var _0x3d2f3d={},_0x57a6bb={},_0x4c1398={'count':0x0,'rows':[]};var _0x22f638=_[_0xa9e9('0x3c')](db[_0xa9e9('0x3d')]['rawAttributes'],function(_0x47b238){return{'name':_0x47b238[_0xa9e9('0x3e')],'type':_0x47b238[_0xa9e9('0x3f')][_0xa9e9('0x40')]};});_0x57a6bb[_0xa9e9('0x41')]=_[_0xa9e9('0x3c')](_0x22f638,_0xa9e9('0x3a'));_0x57a6bb['query']=_[_0xa9e9('0x42')](_0x15beaa[_0xa9e9('0x43')]);_0x57a6bb['filters']=_[_0xa9e9('0x44')](_0x57a6bb[_0xa9e9('0x41')],_0x57a6bb[_0xa9e9('0x43')]);_0x3d2f3d[_0xa9e9('0x45')]=_[_0xa9e9('0x44')](_0x57a6bb[_0xa9e9('0x41')],qs['fields'](_0x15beaa[_0xa9e9('0x43')][_0xa9e9('0x46')]));_0x3d2f3d[_0xa9e9('0x45')]=_0x3d2f3d['attributes'][_0xa9e9('0x47')]?_0x3d2f3d[_0xa9e9('0x45')]:_0x57a6bb['model'];if(!_0x15beaa['query'][_0xa9e9('0x48')](_0xa9e9('0x49'))){_0x3d2f3d[_0xa9e9('0x4a')]=qs[_0xa9e9('0x4a')](_0x15beaa['query'][_0xa9e9('0x4a')]);_0x3d2f3d[_0xa9e9('0x31')]=qs[_0xa9e9('0x31')](_0x15beaa[_0xa9e9('0x43')]['offset']);}_0x3d2f3d['order']=qs[_0xa9e9('0x4b')](_0x15beaa[_0xa9e9('0x43')]['sort']);_0x3d2f3d['where']=qs[_0xa9e9('0x4c')](_[_0xa9e9('0x4d')](_0x15beaa[_0xa9e9('0x43')],_0x57a6bb[_0xa9e9('0x4c')]),_0x22f638);if(_0x15beaa['query'][_0xa9e9('0x4e')]){_0x3d2f3d[_0xa9e9('0x4f')]=_[_0xa9e9('0x50')](_0x3d2f3d['where'],{'$or':_[_0xa9e9('0x3c')](_0x22f638,function(_0xfd3c27){if(_0xfd3c27['type']!==_0xa9e9('0x51')){var _0x117d23={};_0x117d23[_0xfd3c27[_0xa9e9('0x3a')]]={'$like':'%'+_0x15beaa['query'][_0xa9e9('0x4e')]+'%'};return _0x117d23;}})});}_0x3d2f3d=_[_0xa9e9('0x50')]({},_0x3d2f3d,_0x15beaa[_0xa9e9('0x52')]);var _0x3fdf30={'where':_0x3d2f3d[_0xa9e9('0x4f')]};return db[_0xa9e9('0x3d')][_0xa9e9('0x30')](_0x3fdf30)[_0xa9e9('0x22')](function(_0x2f2251){_0x4c1398[_0xa9e9('0x30')]=_0x2f2251;if(_0x15beaa[_0xa9e9('0x43')][_0xa9e9('0x53')]){_0x3d2f3d[_0xa9e9('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0xa9e9('0x55')](_0x3d2f3d);})[_0xa9e9('0x22')](function(_0x37f880){_0x4c1398['rows']=_0x37f880;return _0x4c1398;})[_0xa9e9('0x22')](respondWithFilteredResult(_0x4af460,_0x3d2f3d))[_0xa9e9('0x2c')](handleError(_0x4af460,null));};exports[_0xa9e9('0x56')]=function(_0x14c59e,_0x53bf2c){var _0x1846b2={'raw':!![],'where':{'id':_0x14c59e[_0xa9e9('0x57')]['id']}},_0x5dc1df={};_0x5dc1df[_0xa9e9('0x41')]=_['keys'](db[_0xa9e9('0x3d')][_0xa9e9('0x58')]);_0x5dc1df['query']=_[_0xa9e9('0x42')](_0x14c59e[_0xa9e9('0x43')]);_0x5dc1df[_0xa9e9('0x4c')]=_[_0xa9e9('0x44')](_0x5dc1df['model'],_0x5dc1df[_0xa9e9('0x43')]);_0x1846b2[_0xa9e9('0x45')]=_['intersection'](_0x5dc1df[_0xa9e9('0x41')],qs['fields'](_0x14c59e['query'][_0xa9e9('0x46')]));_0x1846b2['attributes']=_0x1846b2[_0xa9e9('0x45')]['length']?_0x1846b2[_0xa9e9('0x45')]:_0x5dc1df[_0xa9e9('0x41')];if(_0x14c59e[_0xa9e9('0x43')][_0xa9e9('0x53')]){_0x1846b2['include']=[{'all':!![]}];}_0x1846b2=_[_0xa9e9('0x50')]({},_0x1846b2,_0x14c59e[_0xa9e9('0x52')]);return db[_0xa9e9('0x3d')][_0xa9e9('0x59')](_0x1846b2)['then'](handleEntityNotFound(_0x53bf2c,null))[_0xa9e9('0x22')](respondWithResult(_0x53bf2c,null))[_0xa9e9('0x2c')](handleError(_0x53bf2c,null));};exports['update']=function(_0x11632f,_0x428787){if(_0x11632f[_0xa9e9('0x5a')]['id']){delete _0x11632f['body']['id'];}return db[_0xa9e9('0x3d')][_0xa9e9('0x59')]({'where':{'id':_0x11632f[_0xa9e9('0x57')]['id']}})[_0xa9e9('0x22')](handleEntityNotFound(_0x428787,null))[_0xa9e9('0x22')](saveUpdates(_0x11632f[_0xa9e9('0x5a')],null))[_0xa9e9('0x22')](respondWithResult(_0x428787,null))[_0xa9e9('0x2c')](handleError(_0x428787,null));};exports[_0xa9e9('0x37')]=function(_0x1ace8a,_0x15edd1){return db[_0xa9e9('0x3d')][_0xa9e9('0x59')]({'where':{'id':_0x1ace8a[_0xa9e9('0x57')]['id']}})['then'](handleEntityNotFound(_0x15edd1,null))[_0xa9e9('0x22')](removeEntity(_0x15edd1,null))[_0xa9e9('0x2c')](handleError(_0x15edd1,null));};exports[_0xa9e9('0x5b')]=function(_0x138ca0,_0x1bb2d0){return db[_0xa9e9('0x3d')]['describe']()[_0xa9e9('0x22')](respondWithResult(_0x1bb2d0,null))[_0xa9e9('0x2c')](handleError(_0x1bb2d0,null));};var interaction_log=require(_0xa9e9('0x5c'))(_0xa9e9('0x5d'));exports[_0xa9e9('0x5e')]=function(_0x18241d,_0x13a3e3,_0x11f1d1){var _0x3065a2={'channel':_0xa9e9('0x5f')};if(_0x18241d[_0xa9e9('0x5a')]['id']){delete _0x18241d[_0xa9e9('0x5a')]['id'];}_0x18241d[_0xa9e9('0x5a')][_0xa9e9('0x60')]=!![];_0x18241d[_0xa9e9('0x5a')][_0xa9e9('0x61')]=moment()[_0xa9e9('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x18241d[_0xa9e9('0x5a')]['UserId']=_0x18241d[_0xa9e9('0x5a')][_0xa9e9('0x63')]||_0x18241d[_0xa9e9('0x64')]['id'];return db[_0xa9e9('0x3d')][_0xa9e9('0x59')]({'where':{'id':_0x18241d['params']['id'],'UserId':null},'include':[{'model':db[_0xa9e9('0x65')],'as':'Contact'}]})[_0xa9e9('0x22')](handleEntityNotFound(_0x13a3e3,null))[_0xa9e9('0x22')](saveUpdates(_0x18241d[_0xa9e9('0x5a')],null))[_0xa9e9('0x22')](function(_0x5bd4e6){if(_0x5bd4e6){_0x3065a2['message']=_0x5bd4e6[_0xa9e9('0x66')]({'plain':!![]});return db[_0xa9e9('0x67')][_0xa9e9('0x59')]({'where':{'id':_0x5bd4e6[_0xa9e9('0x68')]}});}return null;})[_0xa9e9('0x22')](handleEntityNotFound(_0x13a3e3,null))[_0xa9e9('0x22')](function(_0x545971){if(_0x545971){return _0x545971[_0xa9e9('0x36')]({'UserId':_0x18241d[_0xa9e9('0x5a')][_0xa9e9('0x63')],'read1stAt':_['isNil'](_0x545971[_0xa9e9('0x69')])?moment()[_0xa9e9('0x62')](_0xa9e9('0x6a')):undefined});}return null;})['then'](function(_0xfefc21){if(_0xfefc21){_0x3065a2['interaction']=_0xfefc21[_0xa9e9('0x66')]({'plain':!![]});interaction_log[_0xa9e9('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18241d['user']['id'],_0x18241d['user'][_0xa9e9('0x3a')],_0x18241d[_0xa9e9('0x64')]['role'],_0x3065a2['interaction']['id'],_0x18241d[_0xa9e9('0x5a')]?JSON[_0xa9e9('0x6b')](_0x18241d[_0xa9e9('0x5a')]):_0xa9e9('0x6c'));return respondWithRpcPromise(_0xa9e9('0x6d'),_0xa9e9('0x6e'),_0x3065a2);}return null;})['then'](function(_0x1c6fa3){if(_0x1c6fa3){if(_0x18241d[_0xa9e9('0x5a')]['manual']){_0x3065a2[_0xa9e9('0x2a')]['interface']=util[_0xa9e9('0x62')](_0xa9e9('0x6f'),_0x18241d[_0xa9e9('0x64')]['name']);_0x3065a2[_0xa9e9('0x2a')][_0xa9e9('0x70')]=_0x3065a2[_0xa9e9('0x70')];_0x3065a2[_0xa9e9('0x2a')][_0xa9e9('0x71')]=_0xa9e9('0x5e');return respondWithRpcPromise(_0xa9e9('0x72'),_0xa9e9('0x72'),{'event':_0xa9e9('0x73'),'message':_0x3065a2[_0xa9e9('0x2a')]},client9002)[_0xa9e9('0x22')](function(){return _0x3065a2;});}return _0x3065a2;}return null;})[_0xa9e9('0x22')](respondWithResult(_0x13a3e3,null))[_0xa9e9('0x2c')](handleError(_0x13a3e3,null));};var interaction_log=require(_0xa9e9('0x5c'))(_0xa9e9('0x5d'));exports[_0xa9e9('0x34')]=function(_0xe3b7a3,_0x699318,_0x4a8857){var _0x225a65={'agent':{},'channel':_0xa9e9('0x5f')};if(_0xe3b7a3['body']['id']){delete _0xe3b7a3[_0xa9e9('0x5a')]['id'];}_0xe3b7a3[_0xa9e9('0x5a')][_0xa9e9('0x63')]=_0xe3b7a3['body'][_0xa9e9('0x63')]||_0xe3b7a3['user']['id'];_0x225a65[_0xa9e9('0x74')]['id']=_0xe3b7a3[_0xa9e9('0x5a')][_0xa9e9('0x63')];return db[_0xa9e9('0x3d')][_0xa9e9('0x59')]({'where':{'id':_0xe3b7a3[_0xa9e9('0x57')]['id'],'UserId':null}})[_0xa9e9('0x22')](handleEntityNotFound(_0x699318,null))[_0xa9e9('0x22')](function(_0x3c1ace){if(_0x3c1ace){_0x225a65[_0xa9e9('0x2a')]=_0x3c1ace['get']({'plain':!![]});return db['FaxInteraction'][_0xa9e9('0x59')]({'where':{'id':_0x3c1ace[_0xa9e9('0x68')]}});}return null;})[_0xa9e9('0x22')](handleEntityNotFound(_0x699318,null))['then'](function(_0x2b5212){if(_0x2b5212){_0x225a65[_0xa9e9('0x75')]=_0x2b5212[_0xa9e9('0x66')]({'plain':!![]});interaction_log[_0xa9e9('0x23')](_0xa9e9('0x76'),_0xe3b7a3[_0xa9e9('0x64')]['id'],_0xe3b7a3[_0xa9e9('0x64')][_0xa9e9('0x3a')],_0xe3b7a3[_0xa9e9('0x64')][_0xa9e9('0x77')],_0x225a65[_0xa9e9('0x75')]['id'],_0xe3b7a3[_0xa9e9('0x5a')]?JSON['stringify'](_0xe3b7a3[_0xa9e9('0x5a')]):_0xa9e9('0x6c'));return respondWithRpcPromise('RejectMessage',_0xa9e9('0x78'),_0x225a65);}return null;})[_0xa9e9('0x22')](function(_0x273159){if(_0x273159){_0x273159[_0xa9e9('0x2a')][_0xa9e9('0x79')]=util['format'](_0xa9e9('0x6f'),_0xe3b7a3['user'][_0xa9e9('0x3a')]);_0x273159[_0xa9e9('0x2a')]['channel']=_0x225a65[_0xa9e9('0x70')];_0x273159[_0xa9e9('0x2a')][_0xa9e9('0x71')]=_0xa9e9('0x34');respondWithRpcPromise('EventManager',_0xa9e9('0x72'),{'event':_0xa9e9('0x7a'),'message':_0x273159['message']},client9002);return _0x225a65;}return null;})[_0xa9e9('0x22')](respondWithResult(_0x699318,null))['catch'](handleError(_0x699318,null));};exports[_0xa9e9('0x7b')]=function(_0x493518,_0x30b84b){var _0x25f76a;return db[_0xa9e9('0x3d')][_0xa9e9('0x7b')](_0x493518[_0xa9e9('0x5a')],{})['then'](function(_0xef7364){_0x25f76a=_0xef7364;return db[_0xa9e9('0x65')]['findOne']({'where':{'id':_0x25f76a[_0xa9e9('0x7c')]}});})[_0xa9e9('0x22')](function(_0x16f190){if(_[_0xa9e9('0x7d')](_0x16f190)){return;}else{_0x25f76a[_0xa9e9('0x5f')]=_0x16f190[_0xa9e9('0x5f')];return db[_0xa9e9('0x7e')][_0xa9e9('0x7f')]({'where':{'id':_0x25f76a[_0xa9e9('0x80')]}});}})[_0xa9e9('0x22')](function(_0x2bac03){return respondWithRpcPromise(_0xa9e9('0x81'),_0xa9e9('0x81'),{'FaxAccountId':_[_0xa9e9('0x7d')](_0x493518['body'])?undefined:_0x493518[_0xa9e9('0x5a')][_0xa9e9('0x82')],'path':_['isNil'](_0x2bac03)?undefined:util[_0xa9e9('0x62')]('/var/opt/motion2/server/files/attachments/%s',_0x2bac03[_0xa9e9('0x83')]),'fax':_[_0xa9e9('0x7d')](_0x25f76a[_0xa9e9('0x5f')])?undefined:_0x25f76a['fax'],'AttachmentId':_0x25f76a[_0xa9e9('0x80')]},client9002);})[_0xa9e9('0x22')](respondWithResult(_0x30b84b,0xc9))[_0xa9e9('0x2c')](handleError(_0x30b84b,null));};exports[_0xa9e9('0x84')]=function(_0x5d925f,_0x1ad17c){var _0x40cabd=path[_0xa9e9('0x85')](config[_0xa9e9('0x86')],_0xa9e9('0x87'),'files',_0xa9e9('0x88'));return db[_0xa9e9('0x3d')][_0xa9e9('0x59')]({'where':{'id':_0x5d925f[_0xa9e9('0x57')]['id']},'include':[{'model':db[_0xa9e9('0x7e')],'as':'Attachment'}]})[_0xa9e9('0x22')](handleEntityNotFound(_0x1ad17c,null))[_0xa9e9('0x22')](function(_0xdc0ce7){if(_0xdc0ce7){return _0x1ad17c[_0xa9e9('0x84')](path[_0xa9e9('0x85')](_0x40cabd,_0xdc0ce7[_0xa9e9('0x7e')][_0xa9e9('0x83')]));}})[_0xa9e9('0x2c')](handleError(_0x1ad17c,null));}; \ No newline at end of file +var _0xd2a2=['find','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contact','get','FaxInteraction','FaxInteractionId','UserId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','format','event','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','server','files','join','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd2a2,0x134));var _0x2d2a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd2a2[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2d2a('0x0'));var rimraf=require(_0x2d2a('0x1'));var zipdir=require(_0x2d2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d2a('0x3'));var moment=require(_0x2d2a('0x4'));var BPromise=require(_0x2d2a('0x5'));var Mustache=require('mustache');var util=require(_0x2d2a('0x6'));var path=require(_0x2d2a('0x7'));var sox=require('sox');var csv=require(_0x2d2a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d2a('0x9'));var squel=require(_0x2d2a('0xa'));var crypto=require('crypto');var jsforce=require(_0x2d2a('0xb'));var deskjs=require(_0x2d2a('0xc'));var toCsv=require(_0x2d2a('0x8'));var querystring=require(_0x2d2a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d2a('0xe'));var hardwareService=require(_0x2d2a('0xf'));var logger=require('../../config/logger')(_0x2d2a('0x10'));var utils=require(_0x2d2a('0x11'));var config=require('../../config/environment');var db=require(_0x2d2a('0x12'))['db'];config[_0x2d2a('0x13')]=_[_0x2d2a('0x14')](config[_0x2d2a('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d2a('0x15'))(new Redis(config['redis']));require(_0x2d2a('0x16'))['register'](socket);var jayson=require(_0x2d2a('0x17'));var client=jayson[_0x2d2a('0x18')][_0x2d2a('0x19')]({'port':0x232c});var client9002=jayson[_0x2d2a('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x9386de,_0x5eeeeb,_0x4ed5e7){if(_0x4ed5e7){var _0x4348fa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4348fa[_0x2d2a('0x1a')](_0x5eeeeb)){return _0x9386de;}else{throw new db[(_0x2d2a('0x1b'))][(_0x2d2a('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 _0x9386de;}}function respondWithRpcPromise(_0x2faf17,_0x1778af,_0x2411b5,_0x3f1cc7){return new BPromise(function(_0x3bf8f4,_0x4adb31){var _0x567d3f=_0x3f1cc7||client;return _0x567d3f[_0x2d2a('0x1d')](_0x2faf17,_0x2411b5)[_0x2d2a('0x1e')](function(_0x3697e1){logger[_0x2d2a('0x1f')](_0x2d2a('0x20'),_0x1778af,_0x2d2a('0x21'));logger['debug'](_0x2d2a('0x22'),_0x1778af,_0x2d2a('0x21'),JSON['stringify'](_0x3697e1));if(_0x3697e1[_0x2d2a('0x23')]){if(_0x3697e1[_0x2d2a('0x23')]['code']===0x1f4){logger[_0x2d2a('0x23')]('FaxMessage,\x20%s,\x20%s',_0x1778af,_0x3697e1['error']['message']);return _0x4adb31(_0x3697e1['error'][_0x2d2a('0x24')]);}logger['error'](_0x2d2a('0x20'),_0x1778af,_0x3697e1[_0x2d2a('0x23')][_0x2d2a('0x24')]);return _0x3bf8f4(_0x3697e1[_0x2d2a('0x23')][_0x2d2a('0x24')]);}else{logger['info'](_0x2d2a('0x20'),_0x1778af,_0x2d2a('0x21'));_0x3bf8f4(_0x3697e1['result'][_0x2d2a('0x24')]);}})[_0x2d2a('0x25')](function(_0x399b6e){logger[_0x2d2a('0x23')](_0x2d2a('0x20'),_0x1778af,_0x399b6e);_0x4adb31(_0x399b6e);});});}function respondWithStatusCode(_0x34a266,_0x3d8659){_0x3d8659=_0x3d8659||0xcc;return function(_0x5dd35b){if(_0x5dd35b){return _0x34a266['sendStatus'](_0x3d8659);}return _0x34a266[_0x2d2a('0x26')](_0x3d8659)[_0x2d2a('0x27')]();};}function respondWithResult(_0x5e7557,_0x4ac366){_0x4ac366=_0x4ac366||0xc8;return function(_0x5cfb51){if(_0x5cfb51){return _0x5e7557[_0x2d2a('0x26')](_0x4ac366)[_0x2d2a('0x28')](_0x5cfb51);}};}function respondWithFilteredResult(_0x2b6444,_0x7f8584){return function(_0x90333){if(_0x90333){var _0x12d9ba=_0x90333[_0x2d2a('0x29')],_0x511538=_0x7f8584['offset'],_0x32c234=_0x7f8584[_0x2d2a('0x2a')]+_0x7f8584[_0x2d2a('0x2b')],_0x3af3b0;if(_0x32c234>=_0x12d9ba){_0x32c234=_0x12d9ba;_0x3af3b0=0xc8;}else{_0x3af3b0=0xce;}_0x2b6444[_0x2d2a('0x26')](_0x3af3b0);return _0x2b6444[_0x2d2a('0x2c')](_0x2d2a('0x2d'),_0x511538+'-'+_0x32c234+'/'+_0x12d9ba)['json'](_0x90333);}return null;};}function patchUpdates(_0x514fec){return function(_0x4917d3){try{jsonpatch['apply'](_0x4917d3,_0x514fec,!![]);}catch(_0x27d994){return BPromise[_0x2d2a('0x2e')](_0x27d994);}return _0x4917d3[_0x2d2a('0x2f')]();};}function saveUpdates(_0x292e5e,_0x25313f){return function(_0x49eca2){if(_0x49eca2){return _0x49eca2[_0x2d2a('0x30')](_0x292e5e)[_0x2d2a('0x1e')](function(_0xf91b34){return _0xf91b34;});}return null;};}function removeEntity(_0x177eb3,_0x1be10f){return function(_0x346cb6){if(_0x346cb6){return _0x346cb6[_0x2d2a('0x31')]()['then'](function(){_0x177eb3[_0x2d2a('0x26')](0xcc)[_0x2d2a('0x27')]();});}};}function handleEntityNotFound(_0x3fde07,_0x42be5b){return function(_0x597aeb){if(!_0x597aeb){_0x3fde07[_0x2d2a('0x32')](0x194);}return _0x597aeb;};}function handleError(_0x24cbce,_0x576db5){_0x576db5=_0x576db5||0x1f4;return function(_0x297a95){logger['error'](_0x297a95[_0x2d2a('0x33')]);if(_0x297a95[_0x2d2a('0x34')]){delete _0x297a95['name'];}_0x24cbce[_0x2d2a('0x26')](_0x576db5)[_0x2d2a('0x35')](_0x297a95);};}exports[_0x2d2a('0x36')]=function(_0x4e079c,_0x5d13a3){var _0x565fc2={},_0x500e77={},_0x3ab0d0={'count':0x0,'rows':[]};var _0x3ce42e=_[_0x2d2a('0x37')](db[_0x2d2a('0x38')][_0x2d2a('0x39')],function(_0xefbc2f){return{'name':_0xefbc2f[_0x2d2a('0x3a')],'type':_0xefbc2f[_0x2d2a('0x3b')][_0x2d2a('0x3c')]};});_0x500e77[_0x2d2a('0x3d')]=_['map'](_0x3ce42e,_0x2d2a('0x34'));_0x500e77[_0x2d2a('0x3e')]=_[_0x2d2a('0x3f')](_0x4e079c[_0x2d2a('0x3e')]);_0x500e77[_0x2d2a('0x40')]=_[_0x2d2a('0x41')](_0x500e77[_0x2d2a('0x3d')],_0x500e77['query']);_0x565fc2[_0x2d2a('0x42')]=_['intersection'](_0x500e77['model'],qs['fields'](_0x4e079c[_0x2d2a('0x3e')][_0x2d2a('0x43')]));_0x565fc2['attributes']=_0x565fc2[_0x2d2a('0x42')]['length']?_0x565fc2[_0x2d2a('0x42')]:_0x500e77['model'];if(!_0x4e079c['query'][_0x2d2a('0x44')](_0x2d2a('0x45'))){_0x565fc2['limit']=qs[_0x2d2a('0x2b')](_0x4e079c[_0x2d2a('0x3e')][_0x2d2a('0x2b')]);_0x565fc2[_0x2d2a('0x2a')]=qs['offset'](_0x4e079c[_0x2d2a('0x3e')][_0x2d2a('0x2a')]);}_0x565fc2['order']=qs[_0x2d2a('0x46')](_0x4e079c[_0x2d2a('0x3e')][_0x2d2a('0x46')]);_0x565fc2[_0x2d2a('0x47')]=qs[_0x2d2a('0x40')](_[_0x2d2a('0x48')](_0x4e079c['query'],_0x500e77[_0x2d2a('0x40')]),_0x3ce42e);if(_0x4e079c[_0x2d2a('0x3e')]['filter']){_0x565fc2[_0x2d2a('0x47')]=_[_0x2d2a('0x49')](_0x565fc2['where'],{'$or':_[_0x2d2a('0x37')](_0x3ce42e,function(_0x217e47){if(_0x217e47[_0x2d2a('0x3b')]!=='VIRTUAL'){var _0x19f199={};_0x19f199[_0x217e47['name']]={'$like':'%'+_0x4e079c[_0x2d2a('0x3e')][_0x2d2a('0x4a')]+'%'};return _0x19f199;}})});}_0x565fc2=_['merge']({},_0x565fc2,_0x4e079c[_0x2d2a('0x4b')]);var _0x1104ea={'where':_0x565fc2[_0x2d2a('0x47')]};return db[_0x2d2a('0x38')][_0x2d2a('0x29')](_0x1104ea)[_0x2d2a('0x1e')](function(_0x16cfb6){_0x3ab0d0['count']=_0x16cfb6;if(_0x4e079c[_0x2d2a('0x3e')][_0x2d2a('0x4c')]){_0x565fc2[_0x2d2a('0x4d')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x565fc2);})[_0x2d2a('0x1e')](function(_0x2eaace){_0x3ab0d0[_0x2d2a('0x4e')]=_0x2eaace;return _0x3ab0d0;})[_0x2d2a('0x1e')](respondWithFilteredResult(_0x5d13a3,_0x565fc2))[_0x2d2a('0x25')](handleError(_0x5d13a3,null));};exports[_0x2d2a('0x4f')]=function(_0x1de7ef,_0x49ff7f){var _0x3f6f5d={'raw':!![],'where':{'id':_0x1de7ef[_0x2d2a('0x50')]['id']}},_0x31e74c={};_0x31e74c[_0x2d2a('0x3d')]=_['keys'](db[_0x2d2a('0x38')][_0x2d2a('0x39')]);_0x31e74c[_0x2d2a('0x3e')]=_[_0x2d2a('0x3f')](_0x1de7ef[_0x2d2a('0x3e')]);_0x31e74c[_0x2d2a('0x40')]=_[_0x2d2a('0x41')](_0x31e74c[_0x2d2a('0x3d')],_0x31e74c['query']);_0x3f6f5d[_0x2d2a('0x42')]=_[_0x2d2a('0x41')](_0x31e74c['model'],qs[_0x2d2a('0x43')](_0x1de7ef['query'][_0x2d2a('0x43')]));_0x3f6f5d[_0x2d2a('0x42')]=_0x3f6f5d[_0x2d2a('0x42')][_0x2d2a('0x51')]?_0x3f6f5d[_0x2d2a('0x42')]:_0x31e74c[_0x2d2a('0x3d')];if(_0x1de7ef[_0x2d2a('0x3e')][_0x2d2a('0x4c')]){_0x3f6f5d[_0x2d2a('0x4d')]=[{'all':!![]}];}_0x3f6f5d=_['merge']({},_0x3f6f5d,_0x1de7ef[_0x2d2a('0x4b')]);return db[_0x2d2a('0x38')][_0x2d2a('0x52')](_0x3f6f5d)[_0x2d2a('0x1e')](handleEntityNotFound(_0x49ff7f,null))[_0x2d2a('0x1e')](respondWithResult(_0x49ff7f,null))[_0x2d2a('0x25')](handleError(_0x49ff7f,null));};exports[_0x2d2a('0x30')]=function(_0x3158e2,_0x3a8845){if(_0x3158e2[_0x2d2a('0x53')]['id']){delete _0x3158e2[_0x2d2a('0x53')]['id'];}return db[_0x2d2a('0x38')][_0x2d2a('0x52')]({'where':{'id':_0x3158e2['params']['id']}})[_0x2d2a('0x1e')](handleEntityNotFound(_0x3a8845,null))['then'](saveUpdates(_0x3158e2[_0x2d2a('0x53')],null))[_0x2d2a('0x1e')](respondWithResult(_0x3a8845,null))[_0x2d2a('0x25')](handleError(_0x3a8845,null));};exports[_0x2d2a('0x31')]=function(_0x246787,_0x27a545){return db['FaxMessage'][_0x2d2a('0x52')]({'where':{'id':_0x246787[_0x2d2a('0x50')]['id']}})[_0x2d2a('0x1e')](handleEntityNotFound(_0x27a545,null))[_0x2d2a('0x1e')](removeEntity(_0x27a545,null))[_0x2d2a('0x25')](handleError(_0x27a545,null));};exports['describe']=function(_0x674d5b,_0xb22d80){return db[_0x2d2a('0x38')][_0x2d2a('0x54')]()[_0x2d2a('0x1e')](respondWithResult(_0xb22d80,null))['catch'](handleError(_0xb22d80,null));};var interaction_log=require(_0x2d2a('0x55'))(_0x2d2a('0x56'));exports[_0x2d2a('0x57')]=function(_0x5ec2f0,_0x5be01c,_0x48f53d){var _0x531a5a={'channel':_0x2d2a('0x58')};if(_0x5ec2f0[_0x2d2a('0x53')]['id']){delete _0x5ec2f0[_0x2d2a('0x53')]['id'];}_0x5ec2f0['body'][_0x2d2a('0x59')]=!![];_0x5ec2f0['body'][_0x2d2a('0x5a')]=moment()['format'](_0x2d2a('0x5b'));_0x5ec2f0[_0x2d2a('0x53')]['UserId']=_0x5ec2f0['body']['UserId']||_0x5ec2f0['user']['id'];return db[_0x2d2a('0x38')][_0x2d2a('0x52')]({'where':{'id':_0x5ec2f0['params']['id'],'UserId':null},'include':[{'model':db[_0x2d2a('0x5c')],'as':_0x2d2a('0x5d')}]})[_0x2d2a('0x1e')](handleEntityNotFound(_0x5be01c,null))[_0x2d2a('0x1e')](saveUpdates(_0x5ec2f0[_0x2d2a('0x53')],null))['then'](function(_0x8e0370){if(_0x8e0370){_0x531a5a['message']=_0x8e0370[_0x2d2a('0x5e')]({'plain':!![]});return db[_0x2d2a('0x5f')][_0x2d2a('0x52')]({'where':{'id':_0x8e0370[_0x2d2a('0x60')]}});}return null;})[_0x2d2a('0x1e')](handleEntityNotFound(_0x5be01c,null))[_0x2d2a('0x1e')](function(_0x563c03){if(_0x563c03){return _0x563c03['update']({'UserId':_0x5ec2f0['body'][_0x2d2a('0x61')],'read1stAt':_[_0x2d2a('0x62')](_0x563c03['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2d2a('0x1e')](function(_0x51514d){if(_0x51514d){_0x531a5a[_0x2d2a('0x63')]=_0x51514d[_0x2d2a('0x5e')]({'plain':!![]});interaction_log['info'](_0x2d2a('0x64'),_0x5ec2f0[_0x2d2a('0x65')]['id'],_0x5ec2f0[_0x2d2a('0x65')][_0x2d2a('0x34')],_0x5ec2f0[_0x2d2a('0x65')][_0x2d2a('0x66')],_0x531a5a[_0x2d2a('0x63')]['id'],_0x5ec2f0[_0x2d2a('0x53')]?JSON[_0x2d2a('0x67')](_0x5ec2f0[_0x2d2a('0x53')]):'null');return respondWithRpcPromise(_0x2d2a('0x68'),_0x2d2a('0x69'),_0x531a5a);}return null;})[_0x2d2a('0x1e')](function(_0x3ad8c7){if(_0x3ad8c7){if(_0x5ec2f0[_0x2d2a('0x53')][_0x2d2a('0x6a')]){_0x531a5a['message'][_0x2d2a('0x6b')]=util['format'](_0x2d2a('0x6c'),_0x5ec2f0[_0x2d2a('0x65')][_0x2d2a('0x34')]);_0x531a5a[_0x2d2a('0x24')]['channel']=_0x531a5a[_0x2d2a('0x6d')];_0x531a5a['message']['event']=_0x2d2a('0x57');return respondWithRpcPromise(_0x2d2a('0x6e'),_0x2d2a('0x6e'),{'event':'acceptmessage','message':_0x531a5a['message']},client9002)[_0x2d2a('0x1e')](function(){return _0x531a5a;});}return _0x531a5a;}return null;})[_0x2d2a('0x1e')](respondWithResult(_0x5be01c,null))['catch'](handleError(_0x5be01c,null));};var interaction_log=require('../../config/logger')(_0x2d2a('0x56'));exports[_0x2d2a('0x2e')]=function(_0x1aebc9,_0x30b9e5,_0x313699){var _0x4aa4d0={'agent':{},'channel':_0x2d2a('0x58')};if(_0x1aebc9[_0x2d2a('0x53')]['id']){delete _0x1aebc9[_0x2d2a('0x53')]['id'];}_0x1aebc9[_0x2d2a('0x53')][_0x2d2a('0x61')]=_0x1aebc9[_0x2d2a('0x53')]['UserId']||_0x1aebc9['user']['id'];_0x4aa4d0[_0x2d2a('0x6f')]['id']=_0x1aebc9['body'][_0x2d2a('0x61')];return db['FaxMessage'][_0x2d2a('0x52')]({'where':{'id':_0x1aebc9['params']['id'],'UserId':null}})[_0x2d2a('0x1e')](handleEntityNotFound(_0x30b9e5,null))[_0x2d2a('0x1e')](function(_0x79e01f){if(_0x79e01f){_0x4aa4d0[_0x2d2a('0x24')]=_0x79e01f[_0x2d2a('0x5e')]({'plain':!![]});return db[_0x2d2a('0x5f')]['find']({'where':{'id':_0x79e01f['FaxInteractionId']}});}return null;})[_0x2d2a('0x1e')](handleEntityNotFound(_0x30b9e5,null))[_0x2d2a('0x1e')](function(_0x3cfdd2){if(_0x3cfdd2){_0x4aa4d0['interaction']=_0x3cfdd2[_0x2d2a('0x5e')]({'plain':!![]});interaction_log[_0x2d2a('0x1f')](_0x2d2a('0x70'),_0x1aebc9[_0x2d2a('0x65')]['id'],_0x1aebc9['user'][_0x2d2a('0x34')],_0x1aebc9[_0x2d2a('0x65')]['role'],_0x4aa4d0[_0x2d2a('0x63')]['id'],_0x1aebc9['body']?JSON['stringify'](_0x1aebc9['body']):_0x2d2a('0x71'));return respondWithRpcPromise(_0x2d2a('0x72'),'rejectMessage',_0x4aa4d0);}return null;})[_0x2d2a('0x1e')](function(_0x280b82){if(_0x280b82){_0x280b82[_0x2d2a('0x24')][_0x2d2a('0x6b')]=util[_0x2d2a('0x73')](_0x2d2a('0x6c'),_0x1aebc9[_0x2d2a('0x65')][_0x2d2a('0x34')]);_0x280b82[_0x2d2a('0x24')][_0x2d2a('0x6d')]=_0x4aa4d0['channel'];_0x280b82['message'][_0x2d2a('0x74')]=_0x2d2a('0x2e');respondWithRpcPromise(_0x2d2a('0x6e'),_0x2d2a('0x6e'),{'event':_0x2d2a('0x75'),'message':_0x280b82[_0x2d2a('0x24')]},client9002);return _0x4aa4d0;}return null;})[_0x2d2a('0x1e')](respondWithResult(_0x30b9e5,null))[_0x2d2a('0x25')](handleError(_0x30b9e5,null));};exports[_0x2d2a('0x76')]=function(_0x4e56d3,_0x54cc74){var _0x6de660;return db[_0x2d2a('0x38')][_0x2d2a('0x76')](_0x4e56d3[_0x2d2a('0x53')],{})['then'](function(_0x3cf16f){_0x6de660=_0x3cf16f;return db[_0x2d2a('0x5c')][_0x2d2a('0x77')]({'where':{'id':_0x6de660[_0x2d2a('0x78')]}});})[_0x2d2a('0x1e')](function(_0x42f9a9){if(_[_0x2d2a('0x62')](_0x42f9a9)){return;}else{_0x6de660[_0x2d2a('0x58')]=_0x42f9a9[_0x2d2a('0x58')];return db[_0x2d2a('0x79')]['findOne']({'where':{'id':_0x6de660[_0x2d2a('0x7a')]}});}})['then'](function(_0x14697c){return respondWithRpcPromise(_0x2d2a('0x7b'),_0x2d2a('0x7b'),{'FaxAccountId':_[_0x2d2a('0x62')](_0x4e56d3[_0x2d2a('0x53')])?undefined:_0x4e56d3['body']['FaxAccountId'],'path':_[_0x2d2a('0x62')](_0x14697c)?undefined:util[_0x2d2a('0x73')](_0x2d2a('0x7c'),_0x14697c[_0x2d2a('0x7d')]),'fax':_[_0x2d2a('0x62')](_0x6de660[_0x2d2a('0x58')])?undefined:_0x6de660[_0x2d2a('0x58')],'AttachmentId':_0x6de660[_0x2d2a('0x7a')]},client9002);})[_0x2d2a('0x1e')](respondWithResult(_0x54cc74,0xc9))['catch'](handleError(_0x54cc74,null));};exports[_0x2d2a('0x7e')]=function(_0x2709f7,_0x2c9674){var _0x11eb1e=path['join'](config['root'],_0x2d2a('0x7f'),_0x2d2a('0x80'),'attachments');return db[_0x2d2a('0x38')]['find']({'where':{'id':_0x2709f7[_0x2d2a('0x50')]['id']},'include':[{'model':db[_0x2d2a('0x79')],'as':_0x2d2a('0x79')}]})[_0x2d2a('0x1e')](handleEntityNotFound(_0x2c9674,null))['then'](function(_0x34b33a){if(_0x34b33a){return _0x2c9674['download'](path[_0x2d2a('0x81')](_0x11eb1e,_0x34b33a[_0x2d2a('0x79')][_0x2d2a('0x7d')]));}})[_0x2d2a('0x25')](handleError(_0x2c9674,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d7eaf9f..7b5ce1d 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x30ba61,_0x48b905){var _0x7300ad=function(_0x3b4f73){while(--_0x3b4f73){_0x30ba61['push'](_0x30ba61['shift']());}};_0x7300ad(++_0x48b905);}(_0x7217,0x19e));var _0x7721=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7217[_0x173d7e];return _0x2220d6;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 6eb1c3d..363b1cd 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 _0x5be7=['api','moment','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','get','direction','toLowerCase','out','UserId','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x510ac4,_0x36455b){var _0x196b0f=function(_0x34521c){while(--_0x34521c){_0x510ac4['push'](_0x510ac4['shift']());}};_0x196b0f(++_0x36455b);}(_0x5be7,0x1de));var _0x75be=function(_0x5d2f9b,_0xfdd92d){_0x5d2f9b=_0x5d2f9b-0x0;var _0x552d20=_0x5be7[_0x5d2f9b];return _0x552d20;};'use strict';var _=require(_0x75be('0x0'));var util=require(_0x75be('0x1'));var logger=require('../../config/logger')(_0x75be('0x2'));var moment=require(_0x75be('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x75be('0x4'));var rimraf=require(_0x75be('0x5'));var config=require(_0x75be('0x6'));var attributes=require(_0x75be('0x7'));module[_0x75be('0x8')]=function(_0x38db25,_0x4d549a){return _0x38db25[_0x75be('0x9')]('FaxMessage',attributes,{'tableName':_0x75be('0xa'),'paranoid':![],'indexes':[{'name':_0x75be('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d4a53,_0x290d80,_0x9c2365){var _0x367d15=_0x38db25['models'];var _0x44d23f=_0x5d4a53[_0x75be('0xc')]({'plain':!![]});if(_0x44d23f[_0x75be('0xd')][_0x75be('0xe')]()==='in'||_0x44d23f['direction'][_0x75be('0xe')]()===_0x75be('0xf')&&!_0x44d23f['secret']&&!_['isNil'](_0x44d23f[_0x75be('0x10')])){_0x367d15['FaxInteraction'][_0x75be('0x11')]({'where':{'id':_0x44d23f['FaxInteractionId']}})[_0x75be('0x12')](function(_0x245958){if(_0x245958){_0x245958[_0x75be('0x13')]({'lastMsgAt':_0x44d23f[_0x75be('0x14')],'lastMsgDirection':_0x44d23f[_0x75be('0xd')]['toLowerCase']()});}})['catch'](function(_0x29d259){console[_0x75be('0x15')](_0x29d259);});}_0x9c2365();}},'charset':_0x75be('0x16'),'collate':_0x75be('0x17')});}; \ No newline at end of file +var _0xd356=['toLowerCase','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','body','FULLTEXT','get','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0xd356,0x1a8));var _0x6d35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd356[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6d35('0x0'));var util=require('util');var logger=require(_0x6d35('0x1'))(_0x6d35('0x2'));var moment=require(_0x6d35('0x3'));var BPromise=require(_0x6d35('0x4'));var rp=require(_0x6d35('0x5'));var fs=require('fs');var path=require(_0x6d35('0x6'));var rimraf=require(_0x6d35('0x7'));var config=require(_0x6d35('0x8'));var attributes=require(_0x6d35('0x9'));module['exports']=function(_0xd24bd5,_0x42f951){return _0xd24bd5[_0x6d35('0xa')]('FaxMessage',attributes,{'tableName':_0x6d35('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x6d35('0xc')],'type':_0x6d35('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f5a32,_0x358b09,_0x2f74b5){var _0x41f83c=_0xd24bd5['models'];var _0x678c8d=_0x4f5a32[_0x6d35('0xe')]({'plain':!![]});if(_0x678c8d[_0x6d35('0xf')]['toLowerCase']()==='in'||_0x678c8d['direction']['toLowerCase']()===_0x6d35('0x10')&&!_0x678c8d[_0x6d35('0x11')]&&!_[_0x6d35('0x12')](_0x678c8d[_0x6d35('0x13')])){_0x41f83c[_0x6d35('0x14')][_0x6d35('0x15')]({'where':{'id':_0x678c8d[_0x6d35('0x16')]}})[_0x6d35('0x17')](function(_0x32bbd2){if(_0x32bbd2){_0x32bbd2[_0x6d35('0x18')]({'lastMsgAt':_0x678c8d[_0x6d35('0x19')],'lastMsgDirection':_0x678c8d['direction'][_0x6d35('0x1a')]()});}})[_0x6d35('0x1b')](function(_0x564167){console[_0x6d35('0x1c')](_0x564167);});}_0x2f74b5();}},'charset':'utf8mb4','collate':_0x6d35('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index baeaafe..8f86e1a 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 _0xc577=['FaxMessage','create','body','then','stringify','UpdateFaxMessage','options','raw','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateFaxMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc577,0x172));var _0x7c57=function(_0x1b68ff,_0x5e68a2){_0x1b68ff=_0x1b68ff-0x0;var _0x4b3b07=_0xc577[_0x1b68ff];return _0x4b3b07;};'use strict';var _=require(_0x7c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c57('0x1'));var rs=require(_0x7c57('0x2'));var fs=require('fs');var Redis=require(_0x7c57('0x3'));var db=require(_0x7c57('0x4'))['db'];var utils=require(_0x7c57('0x5'));var logger=require(_0x7c57('0x6'))(_0x7c57('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c57('0x8'));var client=jayson[_0x7c57('0x9')][_0x7c57('0xa')]({'port':0x232a});config[_0x7c57('0xb')]=_[_0x7c57('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c57('0xb')]));require('./faxMessage.socket')[_0x7c57('0xd')](socket);function respondWithRpcPromise(_0x2e63cc,_0x11dd41,_0x3665f9){return new BPromise(function(_0x4f8f51,_0x1e4a96){return client[_0x7c57('0xe')](_0x2e63cc,_0x3665f9)['then'](function(_0x20aae1){logger[_0x7c57('0xf')](_0x7c57('0x10'),_0x11dd41,_0x7c57('0x11'));logger[_0x7c57('0x12')](_0x7c57('0x13'),_0x11dd41,_0x7c57('0x11'),JSON['stringify'](_0x20aae1));if(_0x20aae1['error']){if(_0x20aae1['error'][_0x7c57('0x14')]===0x1f4){logger[_0x7c57('0x15')](_0x7c57('0x10'),_0x11dd41,_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);return _0x1e4a96(_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);}logger[_0x7c57('0x15')]('FaxMessage,\x20%s,\x20%s',_0x11dd41,_0x20aae1['error'][_0x7c57('0x16')]);return _0x4f8f51(_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);}else{logger[_0x7c57('0xf')](_0x7c57('0x10'),_0x11dd41,'request\x20sent');_0x4f8f51(_0x20aae1[_0x7c57('0x17')][_0x7c57('0x16')]);}})[_0x7c57('0x18')](function(_0x87617b){logger[_0x7c57('0x15')](_0x7c57('0x10'),_0x11dd41,_0x87617b);_0x1e4a96(_0x87617b);});});}exports[_0x7c57('0x19')]=function(_0x3a6dce){var _0x2ace9d=this;return new Promise(function(_0x5488b7,_0x45221e){return db[_0x7c57('0x1a')][_0x7c57('0x1b')](_0x3a6dce[_0x7c57('0x1c')],{'raw':_0x3a6dce['options']?_0x3a6dce['options']['raw']===undefined?!![]:![]:!![]})[_0x7c57('0x1d')](function(_0x368bb6){logger['info'](_0x7c57('0x19'),_0x3a6dce);logger[_0x7c57('0x12')](_0x7c57('0x19'),_0x3a6dce,JSON[_0x7c57('0x1e')](_0x368bb6));_0x5488b7(_0x368bb6);})[_0x7c57('0x18')](function(_0x1f8776){logger[_0x7c57('0x15')]('CreateFaxMessage',_0x1f8776[_0x7c57('0x16')],_0x3a6dce);_0x45221e(_0x2ace9d[_0x7c57('0x15')](0x1f4,_0x1f8776[_0x7c57('0x16')]));});});};exports[_0x7c57('0x1f')]=function(_0x119e5f){var _0x984924=this;return new Promise(function(_0x41125b,_0x1219f2){return db[_0x7c57('0x1a')]['update'](_0x119e5f['body'],{'raw':_0x119e5f[_0x7c57('0x20')]?_0x119e5f[_0x7c57('0x20')][_0x7c57('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x119e5f['options']?_0x119e5f[_0x7c57('0x20')]['where']||null:null,'attributes':_0x119e5f['options']?_0x119e5f['options'][_0x7c57('0x22')]||null:null,'limit':_0x119e5f[_0x7c57('0x20')]?_0x119e5f['options'][_0x7c57('0x23')]||null:null})[_0x7c57('0x1d')](function(_0x1ce1fd){logger['info'](_0x7c57('0x1f'),_0x119e5f);logger[_0x7c57('0x12')](_0x7c57('0x1f'),_0x119e5f,JSON['stringify'](_0x1ce1fd));_0x41125b(_0x1ce1fd);})[_0x7c57('0x18')](function(_0x3abf85){logger[_0x7c57('0x15')](_0x7c57('0x1f'),_0x3abf85[_0x7c57('0x16')],_0x119e5f);_0x1219f2(_0x984924[_0x7c57('0x15')](0x1f4,_0x3abf85[_0x7c57('0x16')]));});});}; \ No newline at end of file +var _0x53a6=['where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update'];(function(_0x4552be,_0x16e1c1){var _0x47505e=function(_0x152f1a){while(--_0x152f1a){_0x4552be['push'](_0x4552be['shift']());}};_0x47505e(++_0x16e1c1);}(_0x53a6,0x18f));var _0x653a=function(_0x564ebb,_0x439c1c){_0x564ebb=_0x564ebb-0x0;var _0x5c310f=_0x53a6[_0x564ebb];return _0x5c310f;};'use strict';var _=require(_0x653a('0x0'));var util=require('util');var moment=require(_0x653a('0x1'));var BPromise=require('bluebird');var rs=require(_0x653a('0x2'));var fs=require('fs');var Redis=require(_0x653a('0x3'));var db=require(_0x653a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x653a('0x5'))(_0x653a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x653a('0x7')][_0x653a('0x8')]({'port':0x232a});config[_0x653a('0x9')]=_[_0x653a('0xa')](config[_0x653a('0x9')],{'host':_0x653a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x653a('0x9')]));require(_0x653a('0xc'))[_0x653a('0xd')](socket);function respondWithRpcPromise(_0xe2a1c4,_0x33834c,_0x2c14d5){return new BPromise(function(_0x2e270e,_0x30f534){return client[_0x653a('0xe')](_0xe2a1c4,_0x2c14d5)[_0x653a('0xf')](function(_0x3ab79a){logger[_0x653a('0x10')](_0x653a('0x11'),_0x33834c,_0x653a('0x12'));logger[_0x653a('0x13')](_0x653a('0x14'),_0x33834c,_0x653a('0x12'),JSON[_0x653a('0x15')](_0x3ab79a));if(_0x3ab79a[_0x653a('0x16')]){if(_0x3ab79a[_0x653a('0x16')][_0x653a('0x17')]===0x1f4){logger[_0x653a('0x16')]('FaxMessage,\x20%s,\x20%s',_0x33834c,_0x3ab79a[_0x653a('0x16')][_0x653a('0x18')]);return _0x30f534(_0x3ab79a[_0x653a('0x16')]['message']);}logger[_0x653a('0x16')]('FaxMessage,\x20%s,\x20%s',_0x33834c,_0x3ab79a[_0x653a('0x16')][_0x653a('0x18')]);return _0x2e270e(_0x3ab79a['error'][_0x653a('0x18')]);}else{logger[_0x653a('0x10')](_0x653a('0x11'),_0x33834c,_0x653a('0x12'));_0x2e270e(_0x3ab79a['result'][_0x653a('0x18')]);}})[_0x653a('0x19')](function(_0x48a0af){logger['error'](_0x653a('0x11'),_0x33834c,_0x48a0af);_0x30f534(_0x48a0af);});});}exports[_0x653a('0x1a')]=function(_0x220f36){var _0x2b1f1d=this;return new Promise(function(_0x37c63d,_0x2c12e2){return db[_0x653a('0x1b')]['create'](_0x220f36[_0x653a('0x1c')],{'raw':_0x220f36['options']?_0x220f36[_0x653a('0x1d')][_0x653a('0x1e')]===undefined?!![]:![]:!![]})[_0x653a('0xf')](function(_0x3949e0){logger[_0x653a('0x10')](_0x653a('0x1a'),_0x220f36);logger[_0x653a('0x13')](_0x653a('0x1a'),_0x220f36,JSON[_0x653a('0x15')](_0x3949e0));_0x37c63d(_0x3949e0);})[_0x653a('0x19')](function(_0x7d5997){logger[_0x653a('0x16')](_0x653a('0x1a'),_0x7d5997['message'],_0x220f36);_0x2c12e2(_0x2b1f1d[_0x653a('0x16')](0x1f4,_0x7d5997[_0x653a('0x18')]));});});};exports[_0x653a('0x1f')]=function(_0x546351){var _0x12ba9f=this;return new Promise(function(_0x25ac2a,_0x1fb035){return db['FaxMessage'][_0x653a('0x20')](_0x546351[_0x653a('0x1c')],{'raw':_0x546351[_0x653a('0x1d')]?_0x546351[_0x653a('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x546351[_0x653a('0x1d')]?_0x546351[_0x653a('0x1d')][_0x653a('0x21')]||null:null,'attributes':_0x546351[_0x653a('0x1d')]?_0x546351[_0x653a('0x1d')][_0x653a('0x22')]||null:null,'limit':_0x546351[_0x653a('0x1d')]?_0x546351['options'][_0x653a('0x23')]||null:null})[_0x653a('0xf')](function(_0xd5803f){logger['info']('UpdateFaxMessage',_0x546351);logger[_0x653a('0x13')](_0x653a('0x1f'),_0x546351,JSON[_0x653a('0x15')](_0xd5803f));_0x25ac2a(_0xd5803f);})[_0x653a('0x19')](function(_0x3554c0){logger[_0x653a('0x16')](_0x653a('0x1f'),_0x3554c0['message'],_0x546351);_0x1fb035(_0x12ba9f[_0x653a('0x16')](0x1f4,_0x3554c0[_0x653a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7fa6c58..b093546 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x11ba46,_0x1d6752){var _0x1c8c6f=function(_0x4cf96f){while(--_0x4cf96f){_0x11ba46['push'](_0x11ba46['shift']());}};_0x1c8c6f(++_0x1d6752);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 1c7a670..c5b0a4f 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 _0x84c7=['../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','post','tracked','faxmessage:create','put','/:id/accept','accept','reject','delete','exports','express','../../components/auth/service','../../components/interaction/service'];(function(_0x282e21,_0x535834){var _0x56655b=function(_0x2ad7f9){while(--_0x2ad7f9){_0x282e21['push'](_0x282e21['shift']());}};_0x56655b(++_0x535834);}(_0x84c7,0x6b));var _0x784c=function(_0x123d31,_0x2693e8){_0x123d31=_0x123d31-0x0;var _0x36d1d6=_0x84c7[_0x123d31];return _0x36d1d6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x784c('0x0'));var router=express['Router']();var auth=require(_0x784c('0x1'));var interaction=require(_0x784c('0x2'));var config=require(_0x784c('0x3'));var controller=require(_0x784c('0x4'));router['get']('/',auth[_0x784c('0x5')](),controller[_0x784c('0x6')]);router[_0x784c('0x7')](_0x784c('0x8'),auth[_0x784c('0x5')](),controller[_0x784c('0x9')]);router[_0x784c('0x7')](_0x784c('0xa'),auth[_0x784c('0x5')](),controller[_0x784c('0xb')]);router['get'](_0x784c('0xc'),auth[_0x784c('0x5')](),controller['download']);router[_0x784c('0xd')]('/',auth[_0x784c('0x5')](),interaction[_0x784c('0xe')]('fax',_0x784c('0xf')),controller['create']);router[_0x784c('0x10')](_0x784c('0xa'),auth[_0x784c('0x5')](),controller['update']);router[_0x784c('0x10')](_0x784c('0x11'),auth[_0x784c('0x5')](),controller[_0x784c('0x12')]);router[_0x784c('0x10')]('/:id/reject',auth[_0x784c('0x5')](),controller[_0x784c('0x13')]);router[_0x784c('0x14')](_0x784c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x784c('0x15')]=router; \ No newline at end of file +var _0x3c29=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','isAuthenticated','describe','show','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','/:id'];(function(_0xcd4585,_0x14cf77){var _0x4e09ab=function(_0x5da966){while(--_0x5da966){_0xcd4585['push'](_0xcd4585['shift']());}};_0x4e09ab(++_0x14cf77);}(_0x3c29,0x16d));var _0x93c2=function(_0x29476b,_0x309fe2){_0x29476b=_0x29476b-0x0;var _0x2f2237=_0x3c29[_0x29476b];return _0x2f2237;};'use strict';var multer=require(_0x93c2('0x0'));var util=require(_0x93c2('0x1'));var path=require(_0x93c2('0x2'));var timeout=require('connect-timeout');var express=require(_0x93c2('0x3'));var router=express[_0x93c2('0x4')]();var auth=require(_0x93c2('0x5'));var interaction=require(_0x93c2('0x6'));var config=require(_0x93c2('0x7'));var controller=require(_0x93c2('0x8'));router[_0x93c2('0x9')]('/',auth['isAuthenticated'](),controller[_0x93c2('0xa')]);router[_0x93c2('0x9')]('/describe',auth[_0x93c2('0xb')](),controller[_0x93c2('0xc')]);router[_0x93c2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x93c2('0xd')]);router['get']('/:id/download',auth[_0x93c2('0xb')](),controller[_0x93c2('0xe')]);router[_0x93c2('0xf')]('/',auth['isAuthenticated'](),interaction[_0x93c2('0x10')](_0x93c2('0x11'),_0x93c2('0x12')),controller[_0x93c2('0x13')]);router[_0x93c2('0x14')]('/:id',auth[_0x93c2('0xb')](),controller[_0x93c2('0x15')]);router[_0x93c2('0x14')]('/:id/accept',auth[_0x93c2('0xb')](),controller['accept']);router[_0x93c2('0x14')](_0x93c2('0x16'),auth[_0x93c2('0xb')](),controller[_0x93c2('0x17')]);router['delete'](_0x93c2('0x18'),auth[_0x93c2('0xb')](),controller['destroy']);module[_0x93c2('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 37df2ce..94e86b0 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 _0x0373=['ENUM','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x0373,0x1c2));var _0x3037=function(_0x5d747e,_0x18ee9b){_0x5d747e=_0x5d747e-0x0;var _0x3f2eab=_0x0373[_0x5d747e];return _0x3f2eab;};'use strict';var Sequelize=require(_0x3037('0x0'));module[_0x3037('0x1')]={'name':{'type':Sequelize[_0x3037('0x2')],'unique':_0x3037('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3037('0x2')]},'timeout':{'type':Sequelize[_0x3037('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3037('0x5')]('rrmemory','beepall',_0x3037('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3037('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2194=['roundrobin','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5f2c87,_0x460c86){var _0x4bbb21=function(_0x482512){while(--_0x482512){_0x5f2c87['push'](_0x5f2c87['shift']());}};_0x4bbb21(++_0x460c86);}(_0x2194,0x8d));var _0x4219=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x2194[_0xfcbcb8];return _0x1b1f97;};'use strict';var Sequelize=require('sequelize');module[_0x4219('0x0')]={'name':{'type':Sequelize[_0x4219('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4219('0x1')]},'timeout':{'type':Sequelize[_0x4219('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4219('0x3')](_0x4219('0x4'),_0x4219('0x5'),_0x4219('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 80213fe..4a1c4e8 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 _0x5a3c=['UserProfileResource','error','stack','name','send','map','FaxQueue','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','role','FaxQueues','update','destroy','describe','getMembers','findOne','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','Team','getTeams','hasOwnProperty','ids','User','online','voicePause','interface','Agents','sequelize','transaction','each','UserFaxQueue','findOrCreate','userFaxQueue:save','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','get'];(function(_0x1e2de9,_0x4b77bf){var _0x44a970=function(_0x5613f8){while(--_0x5613f8){_0x1e2de9['push'](_0x1e2de9['shift']());}};_0x44a970(++_0x4b77bf);}(_0x5a3c,0x176));var _0xc5a3=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x5a3c[_0x166d93];return _0xba708;};'use strict';var pdf=require(_0xc5a3('0x0'));var emlformat=require(_0xc5a3('0x1'));var rimraf=require(_0xc5a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5a3('0x3'));var rp=require(_0xc5a3('0x4'));var moment=require('moment');var BPromise=require(_0xc5a3('0x5'));var Mustache=require(_0xc5a3('0x6'));var util=require(_0xc5a3('0x7'));var path=require(_0xc5a3('0x8'));var sox=require(_0xc5a3('0x9'));var csv=require(_0xc5a3('0xa'));var ejs=require(_0xc5a3('0xb'));var fs=require('fs');var _=require(_0xc5a3('0xc'));var squel=require(_0xc5a3('0xd'));var crypto=require(_0xc5a3('0xe'));var jsforce=require(_0xc5a3('0xf'));var deskjs=require(_0xc5a3('0x10'));var toCsv=require(_0xc5a3('0xa'));var querystring=require(_0xc5a3('0x11'));var Papa=require('papaparse');var Redis=require(_0xc5a3('0x12'));var authService=require(_0xc5a3('0x13'));var qs=require(_0xc5a3('0x14'));var as=require(_0xc5a3('0x15'));var hardwareService=require(_0xc5a3('0x16'));var logger=require(_0xc5a3('0x17'))(_0xc5a3('0x18'));var utils=require(_0xc5a3('0x19'));var config=require(_0xc5a3('0x1a'));var db=require('../../mysqldb')['db'];config[_0xc5a3('0x1b')]=_[_0xc5a3('0x1c')](config[_0xc5a3('0x1b')],{'host':_0xc5a3('0x1d'),'port':0x18eb});var socket=require(_0xc5a3('0x1e'))(new Redis(config[_0xc5a3('0x1b')]));require(_0xc5a3('0x1f'))[_0xc5a3('0x20')](socket);function respondWithStatusCode(_0x230386,_0x384e15){_0x384e15=_0x384e15||0xcc;return function(_0x202f48){if(_0x202f48){return _0x230386[_0xc5a3('0x21')](_0x384e15);}return _0x230386[_0xc5a3('0x22')](_0x384e15)[_0xc5a3('0x23')]();};}function respondWithResult(_0x191825,_0x2a2aa7){_0x2a2aa7=_0x2a2aa7||0xc8;return function(_0x1e0468){if(_0x1e0468){return _0x191825['status'](_0x2a2aa7)[_0xc5a3('0x24')](_0x1e0468);}};}function respondWithFilteredResult(_0x18e3ed,_0x4fa2ae){return function(_0x169989){if(_0x169989){var _0xb36233=_0x169989[_0xc5a3('0x25')],_0x3bfcf3=_0x4fa2ae[_0xc5a3('0x26')],_0x1f4641=_0x4fa2ae[_0xc5a3('0x26')]+_0x4fa2ae[_0xc5a3('0x27')],_0x228c2c;if(_0x1f4641>=_0xb36233){_0x1f4641=_0xb36233;_0x228c2c=0xc8;}else{_0x228c2c=0xce;}_0x18e3ed[_0xc5a3('0x22')](_0x228c2c);return _0x18e3ed[_0xc5a3('0x28')]('Content-Range',_0x3bfcf3+'-'+_0x1f4641+'/'+_0xb36233)[_0xc5a3('0x24')](_0x169989);}return null;};}function patchUpdates(_0x4c2099){return function(_0x117941){try{jsonpatch[_0xc5a3('0x29')](_0x117941,_0x4c2099,!![]);}catch(_0x40762e){return BPromise[_0xc5a3('0x2a')](_0x40762e);}return _0x117941[_0xc5a3('0x2b')]();};}function saveUpdates(_0x59f0c4,_0x22fa4c){return function(_0x5152f6){if(_0x5152f6){return _0x5152f6['update'](_0x59f0c4)[_0xc5a3('0x2c')](function(_0x4aaca2){return _0x4aaca2;});}return null;};}function removeEntity(_0x142c9f,_0x48328b){return function(_0x5a34c5){if(_0x5a34c5){return _0x5a34c5['destroy']()[_0xc5a3('0x2c')](function(){var _0xf20b79=_0x5a34c5[_0xc5a3('0x2d')]({'plain':!![]});var _0x56fd74='FaxQueues';return db[_0xc5a3('0x2e')]['destroy']({'where':{'type':_0x56fd74,'resourceId':_0xf20b79['id']}})[_0xc5a3('0x2c')](function(){return _0x5a34c5;});})[_0xc5a3('0x2c')](function(){_0x142c9f[_0xc5a3('0x22')](0xcc)[_0xc5a3('0x23')]();});}};}function handleEntityNotFound(_0x197ccd,_0x5df86e){return function(_0x2a0ef5){if(!_0x2a0ef5){_0x197ccd['sendStatus'](0x194);}return _0x2a0ef5;};}function handleError(_0x4f5a5a,_0x40e15a){_0x40e15a=_0x40e15a||0x1f4;return function(_0x3a5592){logger[_0xc5a3('0x2f')](_0x3a5592[_0xc5a3('0x30')]);if(_0x3a5592[_0xc5a3('0x31')]){delete _0x3a5592[_0xc5a3('0x31')];}_0x4f5a5a[_0xc5a3('0x22')](_0x40e15a)[_0xc5a3('0x32')](_0x3a5592);};}exports['index']=function(_0x4c7276,_0x4bec73){var _0x4a180f={},_0x5010ad={},_0x22a4bc={'count':0x0,'rows':[]};var _0x1a8170=_[_0xc5a3('0x33')](db[_0xc5a3('0x34')]['rawAttributes'],function(_0x38d403){return{'name':_0x38d403['fieldName'],'type':_0x38d403[_0xc5a3('0x35')]['key']};});_0x5010ad[_0xc5a3('0x36')]=_['map'](_0x1a8170,_0xc5a3('0x31'));_0x5010ad[_0xc5a3('0x37')]=_[_0xc5a3('0x38')](_0x4c7276[_0xc5a3('0x37')]);_0x5010ad[_0xc5a3('0x39')]=_['intersection'](_0x5010ad[_0xc5a3('0x36')],_0x5010ad[_0xc5a3('0x37')]);_0x4a180f[_0xc5a3('0x3a')]=_[_0xc5a3('0x3b')](_0x5010ad[_0xc5a3('0x36')],qs['fields'](_0x4c7276[_0xc5a3('0x37')][_0xc5a3('0x3c')]));_0x4a180f[_0xc5a3('0x3a')]=_0x4a180f['attributes'][_0xc5a3('0x3d')]?_0x4a180f[_0xc5a3('0x3a')]:_0x5010ad['model'];if(!_0x4c7276['query']['hasOwnProperty'](_0xc5a3('0x3e'))){_0x4a180f[_0xc5a3('0x27')]=qs[_0xc5a3('0x27')](_0x4c7276['query'][_0xc5a3('0x27')]);_0x4a180f['offset']=qs[_0xc5a3('0x26')](_0x4c7276[_0xc5a3('0x37')][_0xc5a3('0x26')]);}_0x4a180f[_0xc5a3('0x3f')]=qs[_0xc5a3('0x40')](_0x4c7276['query'][_0xc5a3('0x40')]);_0x4a180f[_0xc5a3('0x41')]=qs['filters'](_[_0xc5a3('0x42')](_0x4c7276['query'],_0x5010ad[_0xc5a3('0x39')]),_0x1a8170);if(_0x4c7276[_0xc5a3('0x37')][_0xc5a3('0x43')]){_0x4a180f[_0xc5a3('0x41')]=_[_0xc5a3('0x44')](_0x4a180f[_0xc5a3('0x41')],{'$or':_[_0xc5a3('0x33')](_0x1a8170,function(_0x3e9373){if(_0x3e9373[_0xc5a3('0x35')]!=='VIRTUAL'){var _0x1ee58b={};_0x1ee58b[_0x3e9373[_0xc5a3('0x31')]]={'$like':'%'+_0x4c7276[_0xc5a3('0x37')]['filter']+'%'};return _0x1ee58b;}})});}_0x4a180f=_[_0xc5a3('0x44')]({},_0x4a180f,_0x4c7276[_0xc5a3('0x45')]);var _0xd82b70={'where':_0x4a180f['where']};return db[_0xc5a3('0x34')][_0xc5a3('0x25')](_0xd82b70)[_0xc5a3('0x2c')](function(_0x152624){_0x22a4bc['count']=_0x152624;if(_0x4c7276[_0xc5a3('0x37')][_0xc5a3('0x46')]){_0x4a180f[_0xc5a3('0x47')]=[{'all':!![]}];}return db[_0xc5a3('0x34')]['findAll'](_0x4a180f);})[_0xc5a3('0x2c')](function(_0x4ebc48){_0x22a4bc[_0xc5a3('0x48')]=_0x4ebc48;return _0x22a4bc;})[_0xc5a3('0x2c')](respondWithFilteredResult(_0x4bec73,_0x4a180f))[_0xc5a3('0x49')](handleError(_0x4bec73,null));};exports[_0xc5a3('0x4a')]=function(_0x12b2ec,_0x2af91f){var _0x5ee8ff={'raw':!![],'where':{'id':_0x12b2ec[_0xc5a3('0x4b')]['id']}},_0x29014c={};_0x29014c[_0xc5a3('0x36')]=_['keys'](db[_0xc5a3('0x34')][_0xc5a3('0x4c')]);_0x29014c['query']=_['keys'](_0x12b2ec['query']);_0x29014c[_0xc5a3('0x39')]=_[_0xc5a3('0x3b')](_0x29014c['model'],_0x29014c['query']);_0x5ee8ff['attributes']=_[_0xc5a3('0x3b')](_0x29014c['model'],qs[_0xc5a3('0x3c')](_0x12b2ec[_0xc5a3('0x37')][_0xc5a3('0x3c')]));_0x5ee8ff[_0xc5a3('0x3a')]=_0x5ee8ff['attributes'][_0xc5a3('0x3d')]?_0x5ee8ff[_0xc5a3('0x3a')]:_0x29014c['model'];if(_0x12b2ec[_0xc5a3('0x37')][_0xc5a3('0x46')]){_0x5ee8ff[_0xc5a3('0x47')]=[{'all':!![]}];}_0x5ee8ff=_['merge']({},_0x5ee8ff,_0x12b2ec[_0xc5a3('0x45')]);return db[_0xc5a3('0x34')][_0xc5a3('0x4d')](_0x5ee8ff)[_0xc5a3('0x2c')](handleEntityNotFound(_0x2af91f,null))[_0xc5a3('0x2c')](respondWithResult(_0x2af91f,null))['catch'](handleError(_0x2af91f,null));};exports[_0xc5a3('0x4e')]=function(_0x36856b,_0x44ea2c){return db[_0xc5a3('0x34')][_0xc5a3('0x4e')](_0x36856b[_0xc5a3('0x4f')],{})[_0xc5a3('0x2c')](function(_0x3f4ed2){var _0x392c19=_0x36856b[_0xc5a3('0x50')][_0xc5a3('0x2d')]({'plain':!![]});if(!_0x392c19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x392c19[_0xc5a3('0x51')]==='user'){var _0x57ddda=_0x3f4ed2[_0xc5a3('0x2d')]({'plain':!![]});var _0x3aaa87=_0xc5a3('0x52');return db['UserProfileSection'][_0xc5a3('0x4d')]({'where':{'name':_0x3aaa87,'userProfileId':_0x392c19['userProfileId']},'raw':!![]})[_0xc5a3('0x2c')](function(_0x2b8d39){if(_0x2b8d39&&_0x2b8d39['autoAssociation']===0x0){return db[_0xc5a3('0x2e')][_0xc5a3('0x4e')]({'name':_0x57ddda[_0xc5a3('0x31')],'resourceId':_0x57ddda['id'],'type':_0x2b8d39[_0xc5a3('0x31')],'sectionId':_0x2b8d39['id']},{})[_0xc5a3('0x2c')](function(){return _0x3f4ed2;});}else{return _0x3f4ed2;}})[_0xc5a3('0x49')](function(_0x13735b){logger[_0xc5a3('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13735b);throw _0x13735b;});}return _0x3f4ed2;})[_0xc5a3('0x2c')](respondWithResult(_0x44ea2c,0xc9))['catch'](handleError(_0x44ea2c,null));};exports[_0xc5a3('0x53')]=function(_0x57f5f,_0x3f00c0){if(_0x57f5f[_0xc5a3('0x4f')]['id']){delete _0x57f5f[_0xc5a3('0x4f')]['id'];}return db[_0xc5a3('0x34')][_0xc5a3('0x4d')]({'where':{'id':_0x57f5f[_0xc5a3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f00c0,null))[_0xc5a3('0x2c')](saveUpdates(_0x57f5f[_0xc5a3('0x4f')],null))['then'](respondWithResult(_0x3f00c0,null))[_0xc5a3('0x49')](handleError(_0x3f00c0,null));};exports[_0xc5a3('0x54')]=function(_0x478d7c,_0x2a761e){return db[_0xc5a3('0x34')][_0xc5a3('0x4d')]({'where':{'id':_0x478d7c['params']['id']}})[_0xc5a3('0x2c')](handleEntityNotFound(_0x2a761e,null))[_0xc5a3('0x2c')](removeEntity(_0x2a761e,null))[_0xc5a3('0x49')](handleError(_0x2a761e,null));};exports[_0xc5a3('0x55')]=function(_0x406671,_0x476be5){return db['FaxQueue'][_0xc5a3('0x55')]()[_0xc5a3('0x2c')](respondWithResult(_0x476be5,null))[_0xc5a3('0x49')](handleError(_0x476be5,null));};exports[_0xc5a3('0x56')]=function(_0x1143a0,_0x916c5f,_0x52dba1){var _0x400646={'raw':!![],'where':{}},_0x397422={},_0x26adce;return db[_0xc5a3('0x34')][_0xc5a3('0x57')]({'where':{'id':_0x1143a0['params']['id']}})['then'](handleEntityNotFound(_0x916c5f,null))['then'](function(_0x4b95dd){if(_0x4b95dd){_0x26adce=_0x4b95dd[_0xc5a3('0x2d')]({'plain':!![]});_0x397422[_0xc5a3('0x36')]=_['keys'](db['UserFaxQueue'][_0xc5a3('0x4c')]);_0x397422[_0xc5a3('0x37')]=_[_0xc5a3('0x38')](_0x1143a0[_0xc5a3('0x37')]);_0x397422[_0xc5a3('0x39')]=_['intersection'](_0x397422[_0xc5a3('0x36')],_0x397422[_0xc5a3('0x37')]);_0x400646['attributes']=_[_0xc5a3('0x3b')](_0x397422[_0xc5a3('0x36')],qs[_0xc5a3('0x3c')](_0x1143a0['query'][_0xc5a3('0x3c')]));_0x400646[_0xc5a3('0x3a')]=_0x400646[_0xc5a3('0x3a')]['length']?_0x400646[_0xc5a3('0x3a')]:_0x397422['model'];if(!_0x1143a0['query']['hasOwnProperty'](_0xc5a3('0x3e'))){_0x400646[_0xc5a3('0x27')]=qs['limit'](_0x1143a0[_0xc5a3('0x37')]['limit']);_0x400646[_0xc5a3('0x26')]=qs[_0xc5a3('0x26')](_0x1143a0[_0xc5a3('0x37')]['offset']);}_0x400646[_0xc5a3('0x3f')]=qs[_0xc5a3('0x40')](_0x1143a0[_0xc5a3('0x37')]['sort']);_0x400646['where']=qs['filters'](_[_0xc5a3('0x42')](_0x1143a0[_0xc5a3('0x37')],_0x397422[_0xc5a3('0x39')]));_0x400646[_0xc5a3('0x41')]['FaxQueueId']=_0x4b95dd['id'];if(_0x1143a0[_0xc5a3('0x37')][_0xc5a3('0x43')]){_0x400646['where']=_[_0xc5a3('0x44')](_0x400646[_0xc5a3('0x41')],{'$or':_[_0xc5a3('0x33')](_0x400646[_0xc5a3('0x3a')],function(_0x165ef8){var _0x5323b0={};_0x5323b0[_0x165ef8]={'$like':'%'+_0x1143a0['query'][_0xc5a3('0x43')]+'%'};return _0x5323b0;})});}_0x400646=_[_0xc5a3('0x44')]({},_0x400646,_0x1143a0['options']);return db['UserFaxQueue'][_0xc5a3('0x58')](_0x400646);}})[_0xc5a3('0x2c')](function(_0x3e8716){if(_0x3e8716){return db['User'][_0xc5a3('0x59')]({'where':{'id':_[_0xc5a3('0x33')](_0x3e8716,_0xc5a3('0x5a')),'role':_0xc5a3('0x5b')},'attributes':['id',_0xc5a3('0x31'),_0xc5a3('0x5c'),_0xc5a3('0x5d'),_0xc5a3('0x5e')]});}})[_0xc5a3('0x2c')](function(_0xedc6fd){if(_0xedc6fd){return{'count':_0xedc6fd[_0xc5a3('0x25')],'rows':_[_0xc5a3('0x33')](_0xedc6fd[_0xc5a3('0x48')],function(_0x5a8a5e){return{'membername':_0x5a8a5e[_0xc5a3('0x31')],'UserId':_0x5a8a5e['id'],'queue_name':_0x26adce[_0xc5a3('0x31')],'FaxQueueId':_0x26adce['id'],'interface':util[_0xc5a3('0x5f')]('%s/%s',_0xc5a3('0x60'),_0x5a8a5e[_0xc5a3('0x31')]),'penalty':0x0,'paused':_0x5a8a5e[_0xc5a3('0x5c')],'createdAt':_0x5a8a5e[_0xc5a3('0x5e')],'updatedAt':_0x5a8a5e[_0xc5a3('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc5a3('0x2c')](respondWithFilteredResult(_0x916c5f,_0x400646))[_0xc5a3('0x49')](handleError(_0x916c5f,null));};exports['getTeams']=function(_0x4c8ec1,_0x1c7bb3,_0x3e6860){var _0x102f00={};var _0x32e66b={};var _0x135612;var _0x44f1d9;return db[_0xc5a3('0x34')]['findOne']({'where':{'id':_0x4c8ec1[_0xc5a3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c7bb3,null))['then'](function(_0x32b34f){if(_0x32b34f){_0x135612=_0x32b34f;_0x32e66b[_0xc5a3('0x36')]=_[_0xc5a3('0x38')](db[_0xc5a3('0x61')][_0xc5a3('0x4c')]);_0x32e66b[_0xc5a3('0x37')]=_[_0xc5a3('0x38')](_0x4c8ec1[_0xc5a3('0x37')]);_0x32e66b[_0xc5a3('0x39')]=_[_0xc5a3('0x3b')](_0x32e66b[_0xc5a3('0x36')],_0x32e66b[_0xc5a3('0x37')]);_0x102f00['attributes']=_[_0xc5a3('0x3b')](_0x32e66b[_0xc5a3('0x36')],qs[_0xc5a3('0x3c')](_0x4c8ec1['query'][_0xc5a3('0x3c')]));_0x102f00['attributes']=_0x102f00[_0xc5a3('0x3a')][_0xc5a3('0x3d')]?_0x102f00[_0xc5a3('0x3a')]:_0x32e66b[_0xc5a3('0x36')];_0x102f00[_0xc5a3('0x3f')]=qs['sort'](_0x4c8ec1[_0xc5a3('0x37')][_0xc5a3('0x40')]);_0x102f00[_0xc5a3('0x41')]=qs[_0xc5a3('0x39')](_[_0xc5a3('0x42')](_0x4c8ec1['query'],_0x32e66b[_0xc5a3('0x39')]));if(_0x4c8ec1[_0xc5a3('0x37')][_0xc5a3('0x43')]){_0x102f00[_0xc5a3('0x41')]=_['merge'](_0x102f00[_0xc5a3('0x41')],{'$or':_[_0xc5a3('0x33')](_0x102f00[_0xc5a3('0x3a')],function(_0x4f35a9){var _0x3b3ed6={};_0x3b3ed6[_0x4f35a9]={'$like':'%'+_0x4c8ec1[_0xc5a3('0x37')]['filter']+'%'};return _0x3b3ed6;})});}_0x102f00=_[_0xc5a3('0x44')]({},_0x102f00,_0x4c8ec1[_0xc5a3('0x45')]);return _0x135612[_0xc5a3('0x62')](_0x102f00);}})[_0xc5a3('0x2c')](function(_0x4685fa){if(_0x4685fa){_0x44f1d9=_0x4685fa['length'];if(!_0x4c8ec1['query'][_0xc5a3('0x63')](_0xc5a3('0x3e'))){_0x102f00['limit']=qs[_0xc5a3('0x27')](_0x4c8ec1[_0xc5a3('0x37')]['limit']);_0x102f00['offset']=qs[_0xc5a3('0x26')](_0x4c8ec1[_0xc5a3('0x37')]['offset']);}return _0x135612[_0xc5a3('0x62')](_0x102f00);}})[_0xc5a3('0x2c')](function(_0x3de01c){if(_0x3de01c){return _0x3de01c?{'count':_0x44f1d9,'rows':_0x3de01c}:null;}})[_0xc5a3('0x2c')](respondWithResult(_0x1c7bb3,null))[_0xc5a3('0x49')](handleError(_0x1c7bb3,null));};exports['addTeams']=function(_0x198035,_0x55e950,_0x358700){var _0x820f25=_0x198035[_0xc5a3('0x4f')][_0xc5a3('0x64')];return db[_0xc5a3('0x61')]['findAll']({'where':{'id':_0x820f25},'attributes':['id'],'include':[{'model':db[_0xc5a3('0x65')],'as':'Agents','attributes':['id',_0xc5a3('0x31'),_0xc5a3('0x66'),_0xc5a3('0x67'),_0xc5a3('0x68')],'raw':!![]}]})[_0xc5a3('0x2c')](function(_0x24132a){if(_0x24132a){var _0xa50741=_['flatMap'](_0x24132a,function(_0x1b52db){var _0x33ebd4=_0x1b52db[_0xc5a3('0x2d')]({'plain':!![]});return _0x33ebd4[_0xc5a3('0x69')];});return db['FaxQueue'][_0xc5a3('0x4d')]({'where':{'id':_0x198035[_0xc5a3('0x4b')]['id']}})['then'](function(_0x2a96a9){return db[_0xc5a3('0x6a')][_0xc5a3('0x6b')](function(_0x53c2da){return _0x2a96a9['addTeams'](_0x820f25,{'transaction':_0x53c2da})[_0xc5a3('0x2c')](function(){return BPromise[_0xc5a3('0x6c')](_0xa50741,function(_0x4eaa85){return db[_0xc5a3('0x6d')][_0xc5a3('0x6e')]({'where':{'UserId':_0x4eaa85['id'],'FaxQueueId':_0x198035[_0xc5a3('0x4b')]['id']},'transaction':_0x53c2da});});})[_0xc5a3('0x2c')](function(){_0xa50741['forEach'](function(_0x315529){socket['emit'](_0xc5a3('0x6f'),{'UserId':_0x315529['id'],'FaxQueueId':_0x2a96a9['id']});});});});});}})['then'](respondWithStatusCode(_0x55e950,null))[_0xc5a3('0x49')](handleError(_0x55e950,null));};exports['removeTeams']=function(_0x2711da,_0x144079,_0x3a5f03){return db['Team'][_0xc5a3('0x58')]({'where':{'id':_0x2711da[_0xc5a3('0x37')][_0xc5a3('0x64')]},'attributes':['id'],'include':[{'model':db[_0xc5a3('0x65')],'as':_0xc5a3('0x69'),'attributes':['id'],'raw':!![]}]})[_0xc5a3('0x2c')](handleEntityNotFound(_0x144079,null))[_0xc5a3('0x2c')](function(_0x274535){var _0x4bac20=_[_0xc5a3('0x33')](_0x274535,'id');var _0x598ccb=[];var _0xeaa37b=[];var _0x58bfa3=squel[_0xc5a3('0x70')]();_0x58bfa3[_0xc5a3('0x71')](_0xc5a3('0x72'))['from']('team_has_fax_queues','tq')[_0xc5a3('0x73')](_0xc5a3('0x74'),'ut',_0xc5a3('0x75'))['where'](_0xc5a3('0x76'),_0x2711da[_0xc5a3('0x4b')]['id']);for(var _0x3e533c=0x0;_0x3e533c<_0x274535[_0xc5a3('0x3d')];_0x3e533c+=0x1){let _0x31d532=_0x274535[_0x3e533c];for(var _0x58fe15=0x0;_0x58fe15<_0x31d532[_0xc5a3('0x69')][_0xc5a3('0x3d')];_0x58fe15+=0x1){let _0x1fb58b=_0x31d532[_0xc5a3('0x69')][_0x58fe15];var _0x2e21f7=_0x58bfa3[_0xc5a3('0x77')]();_0x2e21f7[_0xc5a3('0x41')](_0xc5a3('0x78'),_0x1fb58b['id']);_0xeaa37b[_0xc5a3('0x79')](db[_0xc5a3('0x6a')]['query'](_0x2e21f7[_0xc5a3('0x7a')](),{'type':db[_0xc5a3('0x6a')]['QueryTypes'][_0xc5a3('0x7b')]})[_0xc5a3('0x2c')](function(_0xd47b5b){if(_0xd47b5b[_0xc5a3('0x3d')]===0x1){return _0x1fb58b['id'];}else{var _0x2a6c10=_[_0xc5a3('0x7c')](_[_0xc5a3('0x33')](_0xd47b5b,'TeamId'),function(_0x49b513){return _[_0xc5a3('0x7d')](_0x4bac20,_0x49b513);});if(_0x2a6c10){return _0x1fb58b['id'];}}}));}}return BPromise[_0xc5a3('0x7e')](_0xeaa37b)['then'](function(_0x21d69c){_0x598ccb=_(_0x598ccb)[_0xc5a3('0x7f')](_0x21d69c)[_0xc5a3('0x80')]()[_0xc5a3('0x81')]();return db[_0xc5a3('0x34')][_0xc5a3('0x4d')]({'where':{'id':_0x2711da['params']['id']}})[_0xc5a3('0x2c')](function(_0x41fd9a){return db[_0xc5a3('0x6a')][_0xc5a3('0x6b')](function(_0x178078){return _0x41fd9a[_0xc5a3('0x82')](_0x2711da['query']['ids'],{'transaction':_0x178078})['then'](function(){if(!_[_0xc5a3('0x83')](_0x598ccb)){return _0x41fd9a['removeAgents'](_0x598ccb,{'transaction':_0x178078});}})['then'](function(){_0x598ccb['forEach'](function(_0x47a754){socket[_0xc5a3('0x84')](_0xc5a3('0x85'),{'UserId':_0x47a754,'FaxQueueId':_0x41fd9a['id']});});});});});});})[_0xc5a3('0x2c')](respondWithStatusCode(_0x144079,null))[_0xc5a3('0x49')](handleError(_0x144079,null));};exports['addAgents']=function(_0x5da22a,_0x153910,_0xd47fba){return db['FaxQueue'][_0xc5a3('0x4d')]({'where':{'id':_0x5da22a[_0xc5a3('0x4b')]['id']}})[_0xc5a3('0x2c')](handleEntityNotFound(_0x153910,null))[_0xc5a3('0x2c')](function(_0x588e5c){if(_0x588e5c){return _0x588e5c[_0xc5a3('0x86')](_0x5da22a[_0xc5a3('0x4f')][_0xc5a3('0x64')],_[_0xc5a3('0x87')](_0x5da22a['body'],[_0xc5a3('0x64'),'id'])||{})[_0xc5a3('0x88')](function(_0x45af80){for(var _0x281a84=0x0;_0x281a84<_0x5da22a[_0xc5a3('0x4f')][_0xc5a3('0x64')]['length'];_0x281a84+=0x1){socket['emit'](_0xc5a3('0x6f'),{'UserId':_0x5da22a[_0xc5a3('0x4f')][_0xc5a3('0x64')][_0x281a84],'FaxQueueId':_0x5da22a[_0xc5a3('0x4b')]['id']});}return _0x45af80;});}})[_0xc5a3('0x2c')](respondWithResult(_0x153910,null))[_0xc5a3('0x49')](handleError(_0x153910,null));};exports[_0xc5a3('0x89')]=function(_0x5c5640,_0x49b70e,_0x19edcb){return db[_0xc5a3('0x34')][_0xc5a3('0x4d')]({'where':{'id':_0x5c5640[_0xc5a3('0x4b')]['id']}})[_0xc5a3('0x2c')](handleEntityNotFound(_0x49b70e,null))[_0xc5a3('0x2c')](function(_0x4b3820){if(_0x4b3820){return _0x4b3820[_0xc5a3('0x89')](_0x5c5640['query'][_0xc5a3('0x64')])['then'](function(){if(_[_0xc5a3('0x8a')](_0x5c5640['query'][_0xc5a3('0x64')])){for(var _0x2b9540=0x0;_0x2b9540<_0x5c5640[_0xc5a3('0x37')][_0xc5a3('0x64')][_0xc5a3('0x3d')];_0x2b9540+=0x1){socket[_0xc5a3('0x84')](_0xc5a3('0x85'),{'UserId':Number(_0x5c5640[_0xc5a3('0x37')][_0xc5a3('0x64')][_0x2b9540]),'FaxQueueId':Number(_0x5c5640[_0xc5a3('0x4b')]['id'])});}}else{socket[_0xc5a3('0x84')](_0xc5a3('0x85'),{'UserId':Number(_0x5c5640[_0xc5a3('0x37')][_0xc5a3('0x64')]),'FaxQueueId':Number(_0x5c5640[_0xc5a3('0x4b')]['id'])});}});}})[_0xc5a3('0x2c')](respondWithStatusCode(_0x49b70e,null))['catch'](handleError(_0x49b70e,null));};exports[_0xc5a3('0x8b')]=function(_0x17d36f,_0x444a6a,_0x10b1aa){var _0x3fe1f6={};var _0x3bb57b={};var _0x28fc0f;var _0x2d0af8;return db[_0xc5a3('0x34')][_0xc5a3('0x57')]({'where':{'id':_0x17d36f[_0xc5a3('0x4b')]['id']}})[_0xc5a3('0x2c')](handleEntityNotFound(_0x444a6a,null))[_0xc5a3('0x2c')](function(_0x5a35b9){if(_0x5a35b9){_0x28fc0f=_0x5a35b9;_0x3bb57b['model']=_['keys'](db['User'][_0xc5a3('0x4c')]);_0x3bb57b[_0xc5a3('0x37')]=_['keys'](_0x17d36f[_0xc5a3('0x37')]);_0x3bb57b[_0xc5a3('0x39')]=_['intersection'](_0x3bb57b[_0xc5a3('0x36')],_0x3bb57b['query']);_0x3fe1f6[_0xc5a3('0x3a')]=_[_0xc5a3('0x3b')](_0x3bb57b[_0xc5a3('0x36')],qs[_0xc5a3('0x3c')](_0x17d36f[_0xc5a3('0x37')]['fields']));_0x3fe1f6[_0xc5a3('0x3a')]=_0x3fe1f6[_0xc5a3('0x3a')][_0xc5a3('0x3d')]?_0x3fe1f6['attributes']:_0x3bb57b[_0xc5a3('0x36')];_0x3fe1f6[_0xc5a3('0x3f')]=qs[_0xc5a3('0x40')](_0x17d36f[_0xc5a3('0x37')][_0xc5a3('0x40')]);_0x3fe1f6[_0xc5a3('0x41')]=qs[_0xc5a3('0x39')](_[_0xc5a3('0x42')](_0x17d36f[_0xc5a3('0x37')],_0x3bb57b[_0xc5a3('0x39')]));if(_0x17d36f[_0xc5a3('0x37')][_0xc5a3('0x43')]){_0x3fe1f6['where']=_[_0xc5a3('0x44')](_0x3fe1f6['where'],{'$or':_[_0xc5a3('0x33')](_0x3fe1f6[_0xc5a3('0x3a')],function(_0x53bc29){var _0x3d7038={};_0x3d7038[_0x53bc29]={'$like':'%'+_0x17d36f['query'][_0xc5a3('0x43')]+'%'};return _0x3d7038;})});}_0x3fe1f6=_['merge']({},_0x3fe1f6,_0x17d36f['options']);return _0x28fc0f['getAgents'](_0x3fe1f6);}})[_0xc5a3('0x2c')](function(_0x3d281b){if(_0x3d281b){_0x2d0af8=_0x3d281b[_0xc5a3('0x3d')];if(!_0x17d36f[_0xc5a3('0x37')]['hasOwnProperty'](_0xc5a3('0x3e'))){_0x3fe1f6['limit']=qs[_0xc5a3('0x27')](_0x17d36f['query']['limit']);_0x3fe1f6[_0xc5a3('0x26')]=qs['offset'](_0x17d36f[_0xc5a3('0x37')][_0xc5a3('0x26')]);}return _0x28fc0f[_0xc5a3('0x8b')](_0x3fe1f6);}})[_0xc5a3('0x2c')](function(_0x381a0d){if(_0x381a0d){return _0x381a0d?{'count':_0x2d0af8,'rows':_0x381a0d}:null;}})[_0xc5a3('0x2c')](respondWithResult(_0x444a6a,null))[_0xc5a3('0x49')](handleError(_0x444a6a,null));}; \ No newline at end of file +var _0x4d5a=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','FaxQueueId','UserFaxQueue','findAll','User','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','count','includeAll','include','rows','catch','show','keys'];(function(_0x4bc5a1,_0x276471){var _0x498659=function(_0x2e8c81){while(--_0x2e8c81){_0x4bc5a1['push'](_0x4bc5a1['shift']());}};_0x498659(++_0x276471);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4d5a[_0x13e741];return _0x3f8bb3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa4d5('0x0'));var rimraf=require(_0xa4d5('0x1'));var zipdir=require(_0xa4d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4d5('0x3'));var moment=require(_0xa4d5('0x4'));var BPromise=require(_0xa4d5('0x5'));var Mustache=require(_0xa4d5('0x6'));var util=require('util');var path=require(_0xa4d5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa4d5('0x8'));var fs=require('fs');var _=require(_0xa4d5('0x9'));var squel=require(_0xa4d5('0xa'));var crypto=require(_0xa4d5('0xb'));var jsforce=require(_0xa4d5('0xc'));var deskjs=require(_0xa4d5('0xd'));var toCsv=require(_0xa4d5('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa4d5('0xf'));var authService=require(_0xa4d5('0x10'));var qs=require(_0xa4d5('0x11'));var as=require(_0xa4d5('0x12'));var hardwareService=require(_0xa4d5('0x13'));var logger=require(_0xa4d5('0x14'))(_0xa4d5('0x15'));var utils=require(_0xa4d5('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa4d5('0x17')]=_[_0xa4d5('0x18')](config[_0xa4d5('0x17')],{'host':_0xa4d5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa4d5('0x1a'))[_0xa4d5('0x1b')](socket);function respondWithStatusCode(_0x9d459a,_0x16faa3){_0x16faa3=_0x16faa3||0xcc;return function(_0x22a9ae){if(_0x22a9ae){return _0x9d459a[_0xa4d5('0x1c')](_0x16faa3);}return _0x9d459a['status'](_0x16faa3)['end']();};}function respondWithResult(_0xec3425,_0x138112){_0x138112=_0x138112||0xc8;return function(_0x527ef2){if(_0x527ef2){return _0xec3425[_0xa4d5('0x1d')](_0x138112)[_0xa4d5('0x1e')](_0x527ef2);}};}function respondWithFilteredResult(_0x67acdc,_0x40eefe){return function(_0x37d983){if(_0x37d983){var _0x3d4c69=_0x37d983['count'],_0x508595=_0x40eefe[_0xa4d5('0x1f')],_0x405789=_0x40eefe['offset']+_0x40eefe[_0xa4d5('0x20')],_0x5b4086;if(_0x405789>=_0x3d4c69){_0x405789=_0x3d4c69;_0x5b4086=0xc8;}else{_0x5b4086=0xce;}_0x67acdc[_0xa4d5('0x1d')](_0x5b4086);return _0x67acdc[_0xa4d5('0x21')](_0xa4d5('0x22'),_0x508595+'-'+_0x405789+'/'+_0x3d4c69)[_0xa4d5('0x1e')](_0x37d983);}return null;};}function patchUpdates(_0x1642da){return function(_0x51efd0){try{jsonpatch[_0xa4d5('0x23')](_0x51efd0,_0x1642da,!![]);}catch(_0x42074c){return BPromise[_0xa4d5('0x24')](_0x42074c);}return _0x51efd0['save']();};}function saveUpdates(_0x5bbc83,_0x4bff89){return function(_0x1b450f){if(_0x1b450f){return _0x1b450f[_0xa4d5('0x25')](_0x5bbc83)['then'](function(_0x53fdfe){return _0x53fdfe;});}return null;};}function removeEntity(_0x6af851,_0x1aea16){return function(_0x913551){if(_0x913551){return _0x913551[_0xa4d5('0x26')]()[_0xa4d5('0x27')](function(){var _0x259c30=_0x913551[_0xa4d5('0x28')]({'plain':!![]});var _0x4c91df='FaxQueues';return db['UserProfileResource'][_0xa4d5('0x26')]({'where':{'type':_0x4c91df,'resourceId':_0x259c30['id']}})[_0xa4d5('0x27')](function(){return _0x913551;});})[_0xa4d5('0x27')](function(){_0x6af851[_0xa4d5('0x1d')](0xcc)[_0xa4d5('0x29')]();});}};}function handleEntityNotFound(_0x14dbe8,_0x471e5f){return function(_0x6e161b){if(!_0x6e161b){_0x14dbe8[_0xa4d5('0x1c')](0x194);}return _0x6e161b;};}function handleError(_0x16a6e9,_0x169382){_0x169382=_0x169382||0x1f4;return function(_0x2909fb){logger[_0xa4d5('0x2a')](_0x2909fb[_0xa4d5('0x2b')]);if(_0x2909fb[_0xa4d5('0x2c')]){delete _0x2909fb[_0xa4d5('0x2c')];}_0x16a6e9['status'](_0x169382)[_0xa4d5('0x2d')](_0x2909fb);};}exports[_0xa4d5('0x2e')]=function(_0x4bf431,_0x471d03){var _0x185ccc={},_0x409231={},_0x2d2d66={'count':0x0,'rows':[]};var _0x11712d=_[_0xa4d5('0x2f')](db[_0xa4d5('0x30')][_0xa4d5('0x31')],function(_0x3d2118){return{'name':_0x3d2118[_0xa4d5('0x32')],'type':_0x3d2118['type']['key']};});_0x409231[_0xa4d5('0x33')]=_[_0xa4d5('0x2f')](_0x11712d,_0xa4d5('0x2c'));_0x409231[_0xa4d5('0x34')]=_['keys'](_0x4bf431[_0xa4d5('0x34')]);_0x409231['filters']=_[_0xa4d5('0x35')](_0x409231[_0xa4d5('0x33')],_0x409231[_0xa4d5('0x34')]);_0x185ccc[_0xa4d5('0x36')]=_[_0xa4d5('0x35')](_0x409231[_0xa4d5('0x33')],qs[_0xa4d5('0x37')](_0x4bf431[_0xa4d5('0x34')][_0xa4d5('0x37')]));_0x185ccc[_0xa4d5('0x36')]=_0x185ccc['attributes'][_0xa4d5('0x38')]?_0x185ccc[_0xa4d5('0x36')]:_0x409231[_0xa4d5('0x33')];if(!_0x4bf431['query']['hasOwnProperty'](_0xa4d5('0x39'))){_0x185ccc[_0xa4d5('0x20')]=qs['limit'](_0x4bf431[_0xa4d5('0x34')][_0xa4d5('0x20')]);_0x185ccc[_0xa4d5('0x1f')]=qs['offset'](_0x4bf431[_0xa4d5('0x34')]['offset']);}_0x185ccc[_0xa4d5('0x3a')]=qs['sort'](_0x4bf431[_0xa4d5('0x34')][_0xa4d5('0x3b')]);_0x185ccc[_0xa4d5('0x3c')]=qs[_0xa4d5('0x3d')](_[_0xa4d5('0x3e')](_0x4bf431[_0xa4d5('0x34')],_0x409231[_0xa4d5('0x3d')]),_0x11712d);if(_0x4bf431[_0xa4d5('0x34')]['filter']){_0x185ccc[_0xa4d5('0x3c')]=_[_0xa4d5('0x3f')](_0x185ccc[_0xa4d5('0x3c')],{'$or':_[_0xa4d5('0x2f')](_0x11712d,function(_0xcb857c){if(_0xcb857c['type']!=='VIRTUAL'){var _0x48b0da={};_0x48b0da[_0xcb857c[_0xa4d5('0x2c')]]={'$like':'%'+_0x4bf431[_0xa4d5('0x34')][_0xa4d5('0x40')]+'%'};return _0x48b0da;}})});}_0x185ccc=_[_0xa4d5('0x3f')]({},_0x185ccc,_0x4bf431[_0xa4d5('0x41')]);var _0xb0d47e={'where':_0x185ccc['where']};return db['FaxQueue']['count'](_0xb0d47e)[_0xa4d5('0x27')](function(_0x1caa58){_0x2d2d66[_0xa4d5('0x42')]=_0x1caa58;if(_0x4bf431[_0xa4d5('0x34')][_0xa4d5('0x43')]){_0x185ccc[_0xa4d5('0x44')]=[{'all':!![]}];}return db[_0xa4d5('0x30')]['findAll'](_0x185ccc);})['then'](function(_0xf0da7c){_0x2d2d66[_0xa4d5('0x45')]=_0xf0da7c;return _0x2d2d66;})[_0xa4d5('0x27')](respondWithFilteredResult(_0x471d03,_0x185ccc))[_0xa4d5('0x46')](handleError(_0x471d03,null));};exports[_0xa4d5('0x47')]=function(_0x1ee846,_0x2d279a){var _0x3853f6={'raw':!![],'where':{'id':_0x1ee846['params']['id']}},_0x291fe2={};_0x291fe2[_0xa4d5('0x33')]=_[_0xa4d5('0x48')](db[_0xa4d5('0x30')][_0xa4d5('0x31')]);_0x291fe2['query']=_[_0xa4d5('0x48')](_0x1ee846[_0xa4d5('0x34')]);_0x291fe2[_0xa4d5('0x3d')]=_[_0xa4d5('0x35')](_0x291fe2[_0xa4d5('0x33')],_0x291fe2[_0xa4d5('0x34')]);_0x3853f6[_0xa4d5('0x36')]=_[_0xa4d5('0x35')](_0x291fe2[_0xa4d5('0x33')],qs[_0xa4d5('0x37')](_0x1ee846[_0xa4d5('0x34')][_0xa4d5('0x37')]));_0x3853f6[_0xa4d5('0x36')]=_0x3853f6[_0xa4d5('0x36')]['length']?_0x3853f6['attributes']:_0x291fe2[_0xa4d5('0x33')];if(_0x1ee846[_0xa4d5('0x34')][_0xa4d5('0x43')]){_0x3853f6[_0xa4d5('0x44')]=[{'all':!![]}];}_0x3853f6=_[_0xa4d5('0x3f')]({},_0x3853f6,_0x1ee846[_0xa4d5('0x41')]);return db['FaxQueue'][_0xa4d5('0x49')](_0x3853f6)['then'](handleEntityNotFound(_0x2d279a,null))['then'](respondWithResult(_0x2d279a,null))['catch'](handleError(_0x2d279a,null));};exports[_0xa4d5('0x4a')]=function(_0x4c7aef,_0x4061b7){return db['FaxQueue']['create'](_0x4c7aef[_0xa4d5('0x4b')],{})[_0xa4d5('0x27')](function(_0x1edd36){var _0x5226b5=_0x4c7aef[_0xa4d5('0x4c')][_0xa4d5('0x28')]({'plain':!![]});if(!_0x5226b5)throw new Error(_0xa4d5('0x4d'));if(_0x5226b5['role']===_0xa4d5('0x4c')){var _0xef98cb=_0x1edd36['get']({'plain':!![]});var _0x331632=_0xa4d5('0x4e');return db[_0xa4d5('0x4f')][_0xa4d5('0x49')]({'where':{'name':_0x331632,'userProfileId':_0x5226b5[_0xa4d5('0x50')]},'raw':!![]})[_0xa4d5('0x27')](function(_0xde09f6){if(_0xde09f6&&_0xde09f6[_0xa4d5('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0xef98cb[_0xa4d5('0x2c')],'resourceId':_0xef98cb['id'],'type':_0xde09f6[_0xa4d5('0x2c')],'sectionId':_0xde09f6['id']},{})[_0xa4d5('0x27')](function(){return _0x1edd36;});}else{return _0x1edd36;}})['catch'](function(_0x461f32){logger[_0xa4d5('0x2a')](_0xa4d5('0x52'),_0x461f32);throw _0x461f32;});}return _0x1edd36;})[_0xa4d5('0x27')](respondWithResult(_0x4061b7,0xc9))['catch'](handleError(_0x4061b7,null));};exports['update']=function(_0x21b119,_0x2ba84e){if(_0x21b119[_0xa4d5('0x4b')]['id']){delete _0x21b119[_0xa4d5('0x4b')]['id'];}return db[_0xa4d5('0x30')][_0xa4d5('0x49')]({'where':{'id':_0x21b119[_0xa4d5('0x53')]['id']}})['then'](handleEntityNotFound(_0x2ba84e,null))[_0xa4d5('0x27')](saveUpdates(_0x21b119[_0xa4d5('0x4b')],null))[_0xa4d5('0x27')](respondWithResult(_0x2ba84e,null))['catch'](handleError(_0x2ba84e,null));};exports[_0xa4d5('0x26')]=function(_0x49a9bb,_0x16e797){return db['FaxQueue'][_0xa4d5('0x49')]({'where':{'id':_0x49a9bb['params']['id']}})[_0xa4d5('0x27')](handleEntityNotFound(_0x16e797,null))[_0xa4d5('0x27')](removeEntity(_0x16e797,null))[_0xa4d5('0x46')](handleError(_0x16e797,null));};exports[_0xa4d5('0x54')]=function(_0x2076cf,_0x4f5a4d){return db[_0xa4d5('0x30')]['describe']()[_0xa4d5('0x27')](respondWithResult(_0x4f5a4d,null))[_0xa4d5('0x46')](handleError(_0x4f5a4d,null));};exports[_0xa4d5('0x55')]=function(_0x4c27e1,_0x4513f6,_0x324588){var _0x433934={'raw':!![],'where':{}},_0x45d4a6={},_0x1dfa53;return db[_0xa4d5('0x30')][_0xa4d5('0x56')]({'where':{'id':_0x4c27e1[_0xa4d5('0x53')]['id']}})['then'](handleEntityNotFound(_0x4513f6,null))[_0xa4d5('0x27')](function(_0x23ca50){if(_0x23ca50){_0x1dfa53=_0x23ca50['get']({'plain':!![]});_0x45d4a6['model']=_['keys'](db['UserFaxQueue'][_0xa4d5('0x31')]);_0x45d4a6[_0xa4d5('0x34')]=_[_0xa4d5('0x48')](_0x4c27e1['query']);_0x45d4a6[_0xa4d5('0x3d')]=_[_0xa4d5('0x35')](_0x45d4a6[_0xa4d5('0x33')],_0x45d4a6[_0xa4d5('0x34')]);_0x433934[_0xa4d5('0x36')]=_['intersection'](_0x45d4a6['model'],qs[_0xa4d5('0x37')](_0x4c27e1[_0xa4d5('0x34')][_0xa4d5('0x37')]));_0x433934['attributes']=_0x433934[_0xa4d5('0x36')][_0xa4d5('0x38')]?_0x433934[_0xa4d5('0x36')]:_0x45d4a6[_0xa4d5('0x33')];if(!_0x4c27e1[_0xa4d5('0x34')][_0xa4d5('0x57')]('nolimit')){_0x433934[_0xa4d5('0x20')]=qs['limit'](_0x4c27e1[_0xa4d5('0x34')][_0xa4d5('0x20')]);_0x433934[_0xa4d5('0x1f')]=qs['offset'](_0x4c27e1[_0xa4d5('0x34')][_0xa4d5('0x1f')]);}_0x433934[_0xa4d5('0x3a')]=qs[_0xa4d5('0x3b')](_0x4c27e1['query'][_0xa4d5('0x3b')]);_0x433934[_0xa4d5('0x3c')]=qs['filters'](_[_0xa4d5('0x3e')](_0x4c27e1[_0xa4d5('0x34')],_0x45d4a6[_0xa4d5('0x3d')]));_0x433934[_0xa4d5('0x3c')][_0xa4d5('0x58')]=_0x23ca50['id'];if(_0x4c27e1['query'][_0xa4d5('0x40')]){_0x433934[_0xa4d5('0x3c')]=_[_0xa4d5('0x3f')](_0x433934['where'],{'$or':_[_0xa4d5('0x2f')](_0x433934['attributes'],function(_0x9f9558){var _0x4983da={};_0x4983da[_0x9f9558]={'$like':'%'+_0x4c27e1[_0xa4d5('0x34')]['filter']+'%'};return _0x4983da;})});}_0x433934=_[_0xa4d5('0x3f')]({},_0x433934,_0x4c27e1[_0xa4d5('0x41')]);return db[_0xa4d5('0x59')][_0xa4d5('0x5a')](_0x433934);}})[_0xa4d5('0x27')](function(_0x517471){if(_0x517471){return db[_0xa4d5('0x5b')]['findAndCountAll']({'where':{'id':_[_0xa4d5('0x2f')](_0x517471,'UserId'),'role':_0xa4d5('0x5c')},'attributes':['id',_0xa4d5('0x2c'),_0xa4d5('0x5d'),_0xa4d5('0x5e'),_0xa4d5('0x5f')]});}})[_0xa4d5('0x27')](function(_0x369036){if(_0x369036){return{'count':_0x369036[_0xa4d5('0x42')],'rows':_[_0xa4d5('0x2f')](_0x369036['rows'],function(_0x548b16){return{'membername':_0x548b16['name'],'UserId':_0x548b16['id'],'queue_name':_0x1dfa53[_0xa4d5('0x2c')],'FaxQueueId':_0x1dfa53['id'],'interface':util[_0xa4d5('0x60')]('%s/%s',_0xa4d5('0x61'),_0x548b16[_0xa4d5('0x2c')]),'penalty':0x0,'paused':_0x548b16[_0xa4d5('0x5d')],'createdAt':_0x548b16[_0xa4d5('0x5f')],'updatedAt':_0x548b16[_0xa4d5('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa4d5('0x27')](respondWithFilteredResult(_0x4513f6,_0x433934))[_0xa4d5('0x46')](handleError(_0x4513f6,null));};exports[_0xa4d5('0x62')]=function(_0x307af9,_0x4455b4,_0x17bc37){var _0x28af3b={};var _0x167488={};var _0x96bf7f;var _0x35b480;return db[_0xa4d5('0x30')]['findOne']({'where':{'id':_0x307af9[_0xa4d5('0x53')]['id']}})[_0xa4d5('0x27')](handleEntityNotFound(_0x4455b4,null))[_0xa4d5('0x27')](function(_0x11d09d){if(_0x11d09d){_0x96bf7f=_0x11d09d;_0x167488[_0xa4d5('0x33')]=_['keys'](db[_0xa4d5('0x63')][_0xa4d5('0x31')]);_0x167488['query']=_['keys'](_0x307af9[_0xa4d5('0x34')]);_0x167488[_0xa4d5('0x3d')]=_['intersection'](_0x167488[_0xa4d5('0x33')],_0x167488[_0xa4d5('0x34')]);_0x28af3b[_0xa4d5('0x36')]=_[_0xa4d5('0x35')](_0x167488[_0xa4d5('0x33')],qs[_0xa4d5('0x37')](_0x307af9[_0xa4d5('0x34')][_0xa4d5('0x37')]));_0x28af3b[_0xa4d5('0x36')]=_0x28af3b[_0xa4d5('0x36')]['length']?_0x28af3b[_0xa4d5('0x36')]:_0x167488[_0xa4d5('0x33')];_0x28af3b[_0xa4d5('0x3a')]=qs[_0xa4d5('0x3b')](_0x307af9['query']['sort']);_0x28af3b[_0xa4d5('0x3c')]=qs[_0xa4d5('0x3d')](_[_0xa4d5('0x3e')](_0x307af9[_0xa4d5('0x34')],_0x167488[_0xa4d5('0x3d')]));if(_0x307af9[_0xa4d5('0x34')][_0xa4d5('0x40')]){_0x28af3b[_0xa4d5('0x3c')]=_[_0xa4d5('0x3f')](_0x28af3b[_0xa4d5('0x3c')],{'$or':_[_0xa4d5('0x2f')](_0x28af3b['attributes'],function(_0x287582){var _0x385397={};_0x385397[_0x287582]={'$like':'%'+_0x307af9['query'][_0xa4d5('0x40')]+'%'};return _0x385397;})});}_0x28af3b=_['merge']({},_0x28af3b,_0x307af9[_0xa4d5('0x41')]);return _0x96bf7f['getTeams'](_0x28af3b);}})[_0xa4d5('0x27')](function(_0x579ee7){if(_0x579ee7){_0x35b480=_0x579ee7[_0xa4d5('0x38')];if(!_0x307af9[_0xa4d5('0x34')][_0xa4d5('0x57')](_0xa4d5('0x39'))){_0x28af3b[_0xa4d5('0x20')]=qs[_0xa4d5('0x20')](_0x307af9['query'][_0xa4d5('0x20')]);_0x28af3b['offset']=qs[_0xa4d5('0x1f')](_0x307af9[_0xa4d5('0x34')][_0xa4d5('0x1f')]);}return _0x96bf7f[_0xa4d5('0x62')](_0x28af3b);}})[_0xa4d5('0x27')](function(_0x58f74f){if(_0x58f74f){return _0x58f74f?{'count':_0x35b480,'rows':_0x58f74f}:null;}})[_0xa4d5('0x27')](respondWithResult(_0x4455b4,null))[_0xa4d5('0x46')](handleError(_0x4455b4,null));};exports[_0xa4d5('0x64')]=function(_0x131a3d,_0x56e7a6,_0x4632ad){var _0x18b0cb=_0x131a3d['body'][_0xa4d5('0x65')];return db['Team']['findAll']({'where':{'id':_0x18b0cb},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa4d5('0x66'),'attributes':['id',_0xa4d5('0x2c'),'online',_0xa4d5('0x67'),_0xa4d5('0x68')],'raw':!![]}]})[_0xa4d5('0x27')](function(_0x27484d){if(_0x27484d){var _0x410d0e=_[_0xa4d5('0x69')](_0x27484d,function(_0x525303){var _0x39c37c=_0x525303[_0xa4d5('0x28')]({'plain':!![]});return _0x39c37c[_0xa4d5('0x66')];});return db[_0xa4d5('0x30')][_0xa4d5('0x49')]({'where':{'id':_0x131a3d[_0xa4d5('0x53')]['id']}})['then'](function(_0x4b4449){return db['sequelize'][_0xa4d5('0x6a')](function(_0x3522c5){return _0x4b4449[_0xa4d5('0x64')](_0x18b0cb,{'transaction':_0x3522c5})[_0xa4d5('0x27')](function(){return BPromise['each'](_0x410d0e,function(_0x59a5dd){return db[_0xa4d5('0x59')][_0xa4d5('0x6b')]({'where':{'UserId':_0x59a5dd['id'],'FaxQueueId':_0x131a3d['params']['id']},'transaction':_0x3522c5});});})[_0xa4d5('0x27')](function(){_0x410d0e[_0xa4d5('0x6c')](function(_0x526a4f){socket[_0xa4d5('0x6d')](_0xa4d5('0x6e'),{'UserId':_0x526a4f['id'],'FaxQueueId':_0x4b4449['id']});});});});});}})[_0xa4d5('0x27')](respondWithStatusCode(_0x56e7a6,null))['catch'](handleError(_0x56e7a6,null));};exports[_0xa4d5('0x6f')]=function(_0x42dd7a,_0x27eb36,_0x5e39c5){return db[_0xa4d5('0x63')]['findAll']({'where':{'id':_0x42dd7a[_0xa4d5('0x34')][_0xa4d5('0x65')]},'attributes':['id'],'include':[{'model':db[_0xa4d5('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa4d5('0x27')](handleEntityNotFound(_0x27eb36,null))['then'](function(_0x158308){var _0x10ce50=_[_0xa4d5('0x2f')](_0x158308,'id');var _0x529b5e=[];var _0x93e595=[];var _0x13cfe4=squel[_0xa4d5('0x70')]();_0x13cfe4[_0xa4d5('0x71')](_0xa4d5('0x72'))[_0xa4d5('0x73')](_0xa4d5('0x74'),'tq')[_0xa4d5('0x75')](_0xa4d5('0x76'),'ut',_0xa4d5('0x77'))[_0xa4d5('0x3c')](_0xa4d5('0x78'),_0x42dd7a[_0xa4d5('0x53')]['id']);for(var _0x5225a4=0x0;_0x5225a4<_0x158308[_0xa4d5('0x38')];_0x5225a4+=0x1){let _0x346890=_0x158308[_0x5225a4];for(var _0x51a5b0=0x0;_0x51a5b0<_0x346890[_0xa4d5('0x66')]['length'];_0x51a5b0+=0x1){let _0x5438c1=_0x346890[_0xa4d5('0x66')][_0x51a5b0];var _0x319e7d=_0x13cfe4[_0xa4d5('0x79')]();_0x319e7d[_0xa4d5('0x3c')](_0xa4d5('0x7a'),_0x5438c1['id']);_0x93e595['push'](db[_0xa4d5('0x7b')][_0xa4d5('0x34')](_0x319e7d[_0xa4d5('0x7c')](),{'type':db[_0xa4d5('0x7b')][_0xa4d5('0x7d')][_0xa4d5('0x7e')]})[_0xa4d5('0x27')](function(_0x7819ac){if(_0x7819ac[_0xa4d5('0x38')]===0x1){return _0x5438c1['id'];}else{var _0x60f2df=_[_0xa4d5('0x7f')](_[_0xa4d5('0x2f')](_0x7819ac,_0xa4d5('0x80')),function(_0x137155){return _[_0xa4d5('0x81')](_0x10ce50,_0x137155);});if(_0x60f2df){return _0x5438c1['id'];}}}));}}return BPromise[_0xa4d5('0x82')](_0x93e595)[_0xa4d5('0x27')](function(_0x134c9d){_0x529b5e=_(_0x529b5e)['union'](_0x134c9d)[_0xa4d5('0x83')]()[_0xa4d5('0x84')]();return db[_0xa4d5('0x30')][_0xa4d5('0x49')]({'where':{'id':_0x42dd7a[_0xa4d5('0x53')]['id']}})[_0xa4d5('0x27')](function(_0x21bb1d){return db[_0xa4d5('0x7b')][_0xa4d5('0x6a')](function(_0x134ec8){return _0x21bb1d[_0xa4d5('0x6f')](_0x42dd7a[_0xa4d5('0x34')][_0xa4d5('0x65')],{'transaction':_0x134ec8})[_0xa4d5('0x27')](function(){if(!_[_0xa4d5('0x85')](_0x529b5e)){return _0x21bb1d[_0xa4d5('0x86')](_0x529b5e,{'transaction':_0x134ec8});}})['then'](function(){_0x529b5e[_0xa4d5('0x6c')](function(_0x2621b1){socket[_0xa4d5('0x6d')](_0xa4d5('0x87'),{'UserId':_0x2621b1,'FaxQueueId':_0x21bb1d['id']});});});});});});})['then'](respondWithStatusCode(_0x27eb36,null))[_0xa4d5('0x46')](handleError(_0x27eb36,null));};exports[_0xa4d5('0x88')]=function(_0x3f985a,_0x29a8bc,_0x48a102){return db[_0xa4d5('0x30')][_0xa4d5('0x49')]({'where':{'id':_0x3f985a[_0xa4d5('0x53')]['id']}})[_0xa4d5('0x27')](handleEntityNotFound(_0x29a8bc,null))[_0xa4d5('0x27')](function(_0x1268e8){if(_0x1268e8){return _0x1268e8[_0xa4d5('0x88')](_0x3f985a[_0xa4d5('0x4b')][_0xa4d5('0x65')],_[_0xa4d5('0x89')](_0x3f985a[_0xa4d5('0x4b')],[_0xa4d5('0x65'),'id'])||{})[_0xa4d5('0x8a')](function(_0x29837c){for(var _0x51b9fd=0x0;_0x51b9fd<_0x3f985a[_0xa4d5('0x4b')]['ids'][_0xa4d5('0x38')];_0x51b9fd+=0x1){socket['emit'](_0xa4d5('0x6e'),{'UserId':_0x3f985a[_0xa4d5('0x4b')][_0xa4d5('0x65')][_0x51b9fd],'FaxQueueId':_0x3f985a['params']['id']});}return _0x29837c;});}})['then'](respondWithResult(_0x29a8bc,null))['catch'](handleError(_0x29a8bc,null));};exports[_0xa4d5('0x86')]=function(_0x58a95c,_0x3326d9,_0x2b6bcb){return db['FaxQueue'][_0xa4d5('0x49')]({'where':{'id':_0x58a95c[_0xa4d5('0x53')]['id']}})[_0xa4d5('0x27')](handleEntityNotFound(_0x3326d9,null))[_0xa4d5('0x27')](function(_0x5beace){if(_0x5beace){return _0x5beace[_0xa4d5('0x86')](_0x58a95c[_0xa4d5('0x34')][_0xa4d5('0x65')])['then'](function(){if(_[_0xa4d5('0x8b')](_0x58a95c[_0xa4d5('0x34')][_0xa4d5('0x65')])){for(var _0x2e5664=0x0;_0x2e5664<_0x58a95c[_0xa4d5('0x34')][_0xa4d5('0x65')][_0xa4d5('0x38')];_0x2e5664+=0x1){socket[_0xa4d5('0x6d')](_0xa4d5('0x87'),{'UserId':Number(_0x58a95c[_0xa4d5('0x34')][_0xa4d5('0x65')][_0x2e5664]),'FaxQueueId':Number(_0x58a95c[_0xa4d5('0x53')]['id'])});}}else{socket[_0xa4d5('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x58a95c[_0xa4d5('0x34')][_0xa4d5('0x65')]),'FaxQueueId':Number(_0x58a95c[_0xa4d5('0x53')]['id'])});}});}})[_0xa4d5('0x27')](respondWithStatusCode(_0x3326d9,null))['catch'](handleError(_0x3326d9,null));};exports['getAgents']=function(_0x138c85,_0x569182,_0x264bb0){var _0x4d3997={};var _0x26ec26={};var _0x1be2e2;var _0x5b2e9d;return db[_0xa4d5('0x30')][_0xa4d5('0x56')]({'where':{'id':_0x138c85[_0xa4d5('0x53')]['id']}})['then'](handleEntityNotFound(_0x569182,null))['then'](function(_0x497110){if(_0x497110){_0x1be2e2=_0x497110;_0x26ec26[_0xa4d5('0x33')]=_[_0xa4d5('0x48')](db[_0xa4d5('0x5b')]['rawAttributes']);_0x26ec26[_0xa4d5('0x34')]=_[_0xa4d5('0x48')](_0x138c85[_0xa4d5('0x34')]);_0x26ec26[_0xa4d5('0x3d')]=_[_0xa4d5('0x35')](_0x26ec26[_0xa4d5('0x33')],_0x26ec26['query']);_0x4d3997[_0xa4d5('0x36')]=_[_0xa4d5('0x35')](_0x26ec26[_0xa4d5('0x33')],qs[_0xa4d5('0x37')](_0x138c85['query'][_0xa4d5('0x37')]));_0x4d3997[_0xa4d5('0x36')]=_0x4d3997[_0xa4d5('0x36')][_0xa4d5('0x38')]?_0x4d3997[_0xa4d5('0x36')]:_0x26ec26[_0xa4d5('0x33')];_0x4d3997[_0xa4d5('0x3a')]=qs[_0xa4d5('0x3b')](_0x138c85['query']['sort']);_0x4d3997['where']=qs[_0xa4d5('0x3d')](_[_0xa4d5('0x3e')](_0x138c85['query'],_0x26ec26[_0xa4d5('0x3d')]));if(_0x138c85['query'][_0xa4d5('0x40')]){_0x4d3997[_0xa4d5('0x3c')]=_['merge'](_0x4d3997[_0xa4d5('0x3c')],{'$or':_[_0xa4d5('0x2f')](_0x4d3997['attributes'],function(_0x8a5b1e){var _0x441db3={};_0x441db3[_0x8a5b1e]={'$like':'%'+_0x138c85[_0xa4d5('0x34')]['filter']+'%'};return _0x441db3;})});}_0x4d3997=_[_0xa4d5('0x3f')]({},_0x4d3997,_0x138c85[_0xa4d5('0x41')]);return _0x1be2e2[_0xa4d5('0x8c')](_0x4d3997);}})['then'](function(_0x7e34e4){if(_0x7e34e4){_0x5b2e9d=_0x7e34e4['length'];if(!_0x138c85[_0xa4d5('0x34')][_0xa4d5('0x57')](_0xa4d5('0x39'))){_0x4d3997[_0xa4d5('0x20')]=qs[_0xa4d5('0x20')](_0x138c85[_0xa4d5('0x34')][_0xa4d5('0x20')]);_0x4d3997['offset']=qs[_0xa4d5('0x1f')](_0x138c85[_0xa4d5('0x34')][_0xa4d5('0x1f')]);}return _0x1be2e2[_0xa4d5('0x8c')](_0x4d3997);}})[_0xa4d5('0x27')](function(_0x55f281){if(_0x55f281){return _0x55f281?{'count':_0x5b2e9d,'rows':_0x55f281}:null;}})['then'](respondWithResult(_0x569182,null))[_0xa4d5('0x46')](handleError(_0x569182,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 4c63e85..eaef405 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 _0x7f3b=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0xecd02d,_0x104272){var _0x187a9f=function(_0x45087d){while(--_0x45087d){_0xecd02d['push'](_0xecd02d['shift']());}};_0x187a9f(++_0x104272);}(_0x7f3b,0x12f));var _0xb7f3=function(_0x22841a,_0x1ff4e0){_0x22841a=_0x22841a-0x0;var _0x327f9e=_0x7f3b[_0x22841a];return _0x327f9e;};'use strict';var EventEmitter=require(_0xb7f3('0x0'));var FaxQueue=require(_0xb7f3('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb7f3('0x2')](0x0);var events={'afterCreate':_0xb7f3('0x3'),'afterUpdate':_0xb7f3('0x4'),'afterDestroy':_0xb7f3('0x5')};function emitEvent(_0x2b2bdc){return function(_0x2e77c3,_0x4dd764,_0x3e9a4d){FaxQueueEvents['emit'](_0x2b2bdc+':'+_0x2e77c3['id'],_0x2e77c3);FaxQueueEvents['emit'](_0x2b2bdc,_0x2e77c3);_0x3e9a4d(null);};}for(var e in events){if(events[_0xb7f3('0x6')](e)){var event=events[e];FaxQueue[_0xb7f3('0x7')](e,emitEvent(event));}}module[_0xb7f3('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x554b=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','FaxQueue'];(function(_0x2bb298,_0x4bdefb){var _0x1ef1af=function(_0x590665){while(--_0x590665){_0x2bb298['push'](_0x2bb298['shift']());}};_0x1ef1af(++_0x4bdefb);}(_0x554b,0x68));var _0xb554=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x554b[_0x2e04ef];return _0x5722b0;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0xb554('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb554('0x1')](0x0);var events={'afterCreate':_0xb554('0x2'),'afterUpdate':'update','afterDestroy':_0xb554('0x3')};function emitEvent(_0xd6f211){return function(_0x1f704f,_0x1aa676,_0x25d3cd){FaxQueueEvents[_0xb554('0x4')](_0xd6f211+':'+_0x1f704f['id'],_0x1f704f);FaxQueueEvents[_0xb554('0x4')](_0xd6f211,_0x1f704f);_0x25d3cd(null);};}for(var e in events){if(events[_0xb554('0x5')](e)){var event=events[e];FaxQueue[_0xb554('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c805a84..b13fe2a 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 _0x4f33=['FaxQueue','util','api','moment','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define'];(function(_0x50f3b6,_0x56a9b5){var _0x59a9cc=function(_0x5cfef6){while(--_0x5cfef6){_0x50f3b6['push'](_0x50f3b6['shift']());}};_0x59a9cc(++_0x56a9b5);}(_0x4f33,0x1d7));var _0x34f3=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x4f33[_0x254076];return _0x21a93e;};'use strict';var _=require('lodash');var util=require(_0x34f3('0x0'));var logger=require('../../config/logger')(_0x34f3('0x1'));var moment=require(_0x34f3('0x2'));var BPromise=require('bluebird');var rp=require(_0x34f3('0x3'));var fs=require('fs');var path=require(_0x34f3('0x4'));var rimraf=require('rimraf');var config=require(_0x34f3('0x5'));var attributes=require(_0x34f3('0x6'));module[_0x34f3('0x7')]=function(_0x1f8d5f,_0x447973){return _0x1f8d5f[_0x34f3('0x8')](_0x34f3('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa917=['path','rimraf','../../config/environment','define','FaxQueue','fax_queues','lodash','util','api','moment','request-promise'];(function(_0x294696,_0x437854){var _0x5ede2d=function(_0x130158){while(--_0x130158){_0x294696['push'](_0x294696['shift']());}};_0x5ede2d(++_0x437854);}(_0xa917,0x74));var _0x7a91=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa917[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7a91('0x0'));var util=require(_0x7a91('0x1'));var logger=require('../../config/logger')(_0x7a91('0x2'));var moment=require(_0x7a91('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a91('0x4'));var fs=require('fs');var path=require(_0x7a91('0x5'));var rimraf=require(_0x7a91('0x6'));var config=require(_0x7a91('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0xf6b296,_0x45e6a2){return _0xf6b296[_0x7a91('0x8')](_0x7a91('0x9'),attributes,{'tableName':_0x7a91('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 9ad55d0..f5bc11d 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 _0x458e=['find','raw','ShowFaxQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','include','map','model','debug'];(function(_0x4cb193,_0x5d1a35){var _0x17d2eb=function(_0x343d15){while(--_0x343d15){_0x4cb193['push'](_0x4cb193['shift']());}};_0x17d2eb(++_0x5d1a35);}(_0x458e,0xbc));var _0xe458=function(_0x2f97ce,_0x3f1125){_0x2f97ce=_0x2f97ce-0x0;var _0x5e5883=_0x458e[_0x2f97ce];return _0x5e5883;};'use strict';var _=require(_0xe458('0x0'));var util=require(_0xe458('0x1'));var moment=require('moment');var BPromise=require(_0xe458('0x2'));var rs=require(_0xe458('0x3'));var fs=require('fs');var Redis=require(_0xe458('0x4'));var db=require(_0xe458('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe458('0x6'));var config=require(_0xe458('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe458('0x8')][_0xe458('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe458('0xa'))(new Redis(config['redis']));require(_0xe458('0xb'))[_0xe458('0xc')](socket);function respondWithRpcPromise(_0x4fd833,_0x3cb35a,_0x403498){return new BPromise(function(_0x2e67e5,_0x286729){return client['request'](_0x4fd833,_0x403498)[_0xe458('0xd')](function(_0x9b1586){logger[_0xe458('0xe')](_0xe458('0xf'),_0x3cb35a,'request\x20sent');logger['debug'](_0xe458('0x10'),_0x3cb35a,_0xe458('0x11'),JSON[_0xe458('0x12')](_0x9b1586));if(_0x9b1586[_0xe458('0x13')]){if(_0x9b1586['error'][_0xe458('0x14')]===0x1f4){logger[_0xe458('0x13')](_0xe458('0xf'),_0x3cb35a,_0x9b1586[_0xe458('0x13')]['message']);return _0x286729(_0x9b1586['error']['message']);}logger[_0xe458('0x13')](_0xe458('0xf'),_0x3cb35a,_0x9b1586[_0xe458('0x13')][_0xe458('0x15')]);return _0x2e67e5(_0x9b1586[_0xe458('0x13')][_0xe458('0x15')]);}else{logger['info'](_0xe458('0xf'),_0x3cb35a,'request\x20sent');_0x2e67e5(_0x9b1586[_0xe458('0x16')][_0xe458('0x15')]);}})[_0xe458('0x17')](function(_0x28b13b){logger[_0xe458('0x13')](_0xe458('0xf'),_0x3cb35a,_0x28b13b);_0x286729(_0x28b13b);});});}exports[_0xe458('0x18')]=function(_0x23551e){var _0x509e19=this;return new Promise(function(_0x5b9d80,_0x198015){return db[_0xe458('0x19')][_0xe458('0x1a')]({'raw':_0x23551e[_0xe458('0x1b')]?_0x23551e['options']['raw']===undefined?!![]:![]:!![],'where':_0x23551e[_0xe458('0x1b')]?_0x23551e['options'][_0xe458('0x1c')]||null:null,'attributes':_0x23551e['options']?_0x23551e[_0xe458('0x1b')][_0xe458('0x1d')]||null:null,'limit':_0x23551e['options']?_0x23551e['options']['limit']||null:null,'include':_0x23551e['options']?_0x23551e['options'][_0xe458('0x1e')]?_[_0xe458('0x1f')](_0x23551e[_0xe458('0x1b')][_0xe458('0x1e')],function(_0x5ec706){return{'model':db[_0x5ec706[_0xe458('0x20')]],'as':_0x5ec706['as'],'attributes':_0x5ec706['attributes'],'include':_0x5ec706[_0xe458('0x1e')]?_[_0xe458('0x1f')](_0x5ec706[_0xe458('0x1e')],function(_0x33941a){return{'model':db[_0x33941a[_0xe458('0x20')]],'as':_0x33941a['as'],'attributes':_0x33941a[_0xe458('0x1d')],'include':_0x33941a[_0xe458('0x1e')]?_[_0xe458('0x1f')](_0x33941a['include'],function(_0x581a05){return{'model':db[_0x581a05['model']],'as':_0x581a05['as'],'attributes':_0x581a05[_0xe458('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28caee){logger[_0xe458('0xe')](_0xe458('0x18'),_0x23551e);logger[_0xe458('0x21')]('GetFaxQueue',_0x23551e,JSON['stringify'](_0x28caee));_0x5b9d80(_0x28caee);})[_0xe458('0x17')](function(_0x505ba7){logger[_0xe458('0x13')]('GetFaxQueue',_0x505ba7[_0xe458('0x15')],_0x23551e);_0x198015(_0x509e19['error'](0x1f4,_0x505ba7[_0xe458('0x15')]));});});};exports['ShowFaxQueue']=function(_0x298fe9){var _0x1c1f4f=this;return new Promise(function(_0x50bedb,_0x44fc70){return db['FaxQueue'][_0xe458('0x22')]({'raw':_0x298fe9['options']?_0x298fe9[_0xe458('0x1b')][_0xe458('0x23')]===undefined?!![]:![]:!![],'where':_0x298fe9[_0xe458('0x1b')]?_0x298fe9[_0xe458('0x1b')][_0xe458('0x1c')]||null:null,'attributes':_0x298fe9[_0xe458('0x1b')]?_0x298fe9['options'][_0xe458('0x1d')]||null:null,'include':_0x298fe9[_0xe458('0x1b')]?_0x298fe9[_0xe458('0x1b')][_0xe458('0x1e')]?_[_0xe458('0x1f')](_0x298fe9[_0xe458('0x1b')][_0xe458('0x1e')],function(_0x9868cc){return{'model':db[_0x9868cc[_0xe458('0x20')]],'as':_0x9868cc['as'],'attributes':_0x9868cc[_0xe458('0x1d')],'include':_0x9868cc[_0xe458('0x1e')]?_['map'](_0x9868cc['include'],function(_0x285b44){return{'model':db[_0x285b44[_0xe458('0x20')]],'as':_0x285b44['as'],'attributes':_0x285b44[_0xe458('0x1d')],'include':_0x285b44[_0xe458('0x1e')]?_[_0xe458('0x1f')](_0x285b44['include'],function(_0x4df6d5){return{'model':db[_0x4df6d5[_0xe458('0x20')]],'as':_0x4df6d5['as'],'attributes':_0x4df6d5[_0xe458('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe458('0xd')](function(_0x56e09e){logger[_0xe458('0xe')](_0xe458('0x24'),_0x298fe9);logger['debug'](_0xe458('0x24'),_0x298fe9,JSON['stringify'](_0x56e09e));_0x50bedb(_0x56e09e);})[_0xe458('0x17')](function(_0x451ccd){logger[_0xe458('0x13')]('ShowFaxQueue',_0x451ccd[_0xe458('0x15')],_0x298fe9);_0x44fc70(_0x1c1f4f[_0xe458('0x13')](0x1f4,_0x451ccd[_0xe458('0x15')]));});});}; \ No newline at end of file +var _0x35d1=['debug','stringify','error','code','message','GetFaxQueue','FaxQueue','options','raw','where','limit','include','map','model','attributes','catch','then','ShowFaxQueue','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x320088,_0x4f929d){var _0x2bf3f3=function(_0x57369f){while(--_0x57369f){_0x320088['push'](_0x320088['shift']());}};_0x2bf3f3(++_0x4f929d);}(_0x35d1,0x168));var _0x135d=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x35d1[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x135d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x135d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x135d('0x2'));var db=require(_0x135d('0x3'))['db'];var utils=require(_0x135d('0x4'));var logger=require(_0x135d('0x5'))(_0x135d('0x6'));var config=require(_0x135d('0x7'));var jayson=require(_0x135d('0x8'));var client=jayson[_0x135d('0x9')][_0x135d('0xa')]({'port':0x232a});config[_0x135d('0xb')]=_[_0x135d('0xc')](config[_0x135d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x135d('0xd'))(new Redis(config[_0x135d('0xb')]));require(_0x135d('0xe'))[_0x135d('0xf')](socket);function respondWithRpcPromise(_0x10b58d,_0x3eebc4,_0x192662){return new BPromise(function(_0x408edb,_0x3fcd39){return client[_0x135d('0x10')](_0x10b58d,_0x192662)['then'](function(_0x722f16){logger[_0x135d('0x11')](_0x135d('0x12'),_0x3eebc4,_0x135d('0x13'));logger[_0x135d('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3eebc4,_0x135d('0x13'),JSON[_0x135d('0x15')](_0x722f16));if(_0x722f16['error']){if(_0x722f16[_0x135d('0x16')][_0x135d('0x17')]===0x1f4){logger[_0x135d('0x16')](_0x135d('0x12'),_0x3eebc4,_0x722f16[_0x135d('0x16')][_0x135d('0x18')]);return _0x3fcd39(_0x722f16['error']['message']);}logger[_0x135d('0x16')](_0x135d('0x12'),_0x3eebc4,_0x722f16[_0x135d('0x16')][_0x135d('0x18')]);return _0x408edb(_0x722f16[_0x135d('0x16')][_0x135d('0x18')]);}else{logger[_0x135d('0x11')](_0x135d('0x12'),_0x3eebc4,_0x135d('0x13'));_0x408edb(_0x722f16['result'][_0x135d('0x18')]);}})['catch'](function(_0x1a04b5){logger['error'](_0x135d('0x12'),_0x3eebc4,_0x1a04b5);_0x3fcd39(_0x1a04b5);});});}exports[_0x135d('0x19')]=function(_0x471d78){var _0x50fb7f=this;return new Promise(function(_0x246004,_0x426da9){return db[_0x135d('0x1a')]['findAll']({'raw':_0x471d78[_0x135d('0x1b')]?_0x471d78['options'][_0x135d('0x1c')]===undefined?!![]:![]:!![],'where':_0x471d78[_0x135d('0x1b')]?_0x471d78[_0x135d('0x1b')][_0x135d('0x1d')]||null:null,'attributes':_0x471d78[_0x135d('0x1b')]?_0x471d78[_0x135d('0x1b')]['attributes']||null:null,'limit':_0x471d78[_0x135d('0x1b')]?_0x471d78['options'][_0x135d('0x1e')]||null:null,'include':_0x471d78[_0x135d('0x1b')]?_0x471d78[_0x135d('0x1b')][_0x135d('0x1f')]?_[_0x135d('0x20')](_0x471d78[_0x135d('0x1b')]['include'],function(_0x32681d){return{'model':db[_0x32681d[_0x135d('0x21')]],'as':_0x32681d['as'],'attributes':_0x32681d[_0x135d('0x22')],'include':_0x32681d[_0x135d('0x1f')]?_['map'](_0x32681d['include'],function(_0x85f3d0){return{'model':db[_0x85f3d0['model']],'as':_0x85f3d0['as'],'attributes':_0x85f3d0[_0x135d('0x22')],'include':_0x85f3d0[_0x135d('0x1f')]?_[_0x135d('0x20')](_0x85f3d0['include'],function(_0x36f426){return{'model':db[_0x36f426[_0x135d('0x21')]],'as':_0x36f426['as'],'attributes':_0x36f426[_0x135d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfa330c){logger[_0x135d('0x11')](_0x135d('0x19'),_0x471d78);logger[_0x135d('0x14')](_0x135d('0x19'),_0x471d78,JSON[_0x135d('0x15')](_0xfa330c));_0x246004(_0xfa330c);})[_0x135d('0x23')](function(_0x2cd206){logger[_0x135d('0x16')](_0x135d('0x19'),_0x2cd206[_0x135d('0x18')],_0x471d78);_0x426da9(_0x50fb7f[_0x135d('0x16')](0x1f4,_0x2cd206[_0x135d('0x18')]));});});};exports['ShowFaxQueue']=function(_0x33415a){var _0x2c6b94=this;return new Promise(function(_0x14d87b,_0x382813){return db[_0x135d('0x1a')]['find']({'raw':_0x33415a[_0x135d('0x1b')]?_0x33415a['options'][_0x135d('0x1c')]===undefined?!![]:![]:!![],'where':_0x33415a[_0x135d('0x1b')]?_0x33415a['options'][_0x135d('0x1d')]||null:null,'attributes':_0x33415a[_0x135d('0x1b')]?_0x33415a['options'][_0x135d('0x22')]||null:null,'include':_0x33415a[_0x135d('0x1b')]?_0x33415a[_0x135d('0x1b')]['include']?_[_0x135d('0x20')](_0x33415a[_0x135d('0x1b')]['include'],function(_0xb58147){return{'model':db[_0xb58147[_0x135d('0x21')]],'as':_0xb58147['as'],'attributes':_0xb58147[_0x135d('0x22')],'include':_0xb58147['include']?_[_0x135d('0x20')](_0xb58147[_0x135d('0x1f')],function(_0x131883){return{'model':db[_0x131883[_0x135d('0x21')]],'as':_0x131883['as'],'attributes':_0x131883[_0x135d('0x22')],'include':_0x131883[_0x135d('0x1f')]?_['map'](_0x131883['include'],function(_0x552234){return{'model':db[_0x552234[_0x135d('0x21')]],'as':_0x552234['as'],'attributes':_0x552234[_0x135d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x135d('0x24')](function(_0x392650){logger['info'](_0x135d('0x25'),_0x33415a);logger[_0x135d('0x14')]('ShowFaxQueue',_0x33415a,JSON['stringify'](_0x392650));_0x14d87b(_0x392650);})[_0x135d('0x23')](function(_0x4a0f30){logger[_0x135d('0x16')]('ShowFaxQueue',_0x4a0f30[_0x135d('0x18')],_0x33415a);_0x382813(_0x2c6b94[_0x135d('0x16')](0x1f4,_0x4a0f30[_0x135d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5e0c2df..7d22119 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 _0x562d=['register','length','faxQueue:','./faxQueue.events','save','update','emit','removeListener'];(function(_0x2e8dc5,_0x2c1e4e){var _0x3eb68b=function(_0x34be4c){while(--_0x34be4c){_0x2e8dc5['push'](_0x2e8dc5['shift']());}};_0x3eb68b(++_0x2c1e4e);}(_0x562d,0x18b));var _0xd562=function(_0x9c827c,_0x37a04a){_0x9c827c=_0x9c827c-0x0;var _0x270532=_0x562d[_0x9c827c];return _0x270532;};'use strict';var FaxQueueEvents=require(_0xd562('0x0'));var events=[_0xd562('0x1'),'remove',_0xd562('0x2')];function createListener(_0x5ae241,_0x4f1848){return function(_0x4db71f){_0x4f1848[_0xd562('0x3')](_0x5ae241,_0x4db71f);};}function removeListener(_0x3648af,_0x479230){return function(){FaxQueueEvents[_0xd562('0x4')](_0x3648af,_0x479230);};}exports[_0xd562('0x5')]=function(_0x3e0ea9){for(var _0x34892c=0x0,_0x14b77b=events[_0xd562('0x6')];_0x34892c<_0x14b77b;_0x34892c++){var _0x5aef6b=events[_0x34892c];var _0x2ff267=createListener(_0xd562('0x7')+_0x5aef6b,_0x3e0ea9);FaxQueueEvents['on'](_0x5aef6b,_0x2ff267);}}; \ No newline at end of file +var _0x2347=['save','remove','update','emit','register','length','./faxQueue.events'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x2347,0x133));var _0x7234=function(_0x3bc55f,_0x39f176){_0x3bc55f=_0x3bc55f-0x0;var _0x1b45a1=_0x2347[_0x3bc55f];return _0x1b45a1;};'use strict';var FaxQueueEvents=require(_0x7234('0x0'));var events=[_0x7234('0x1'),_0x7234('0x2'),_0x7234('0x3')];function createListener(_0x3d5c58,_0x170ec3){return function(_0x228f04){_0x170ec3[_0x7234('0x4')](_0x3d5c58,_0x228f04);};}function removeListener(_0x14a913,_0x4148f8){return function(){FaxQueueEvents['removeListener'](_0x14a913,_0x4148f8);};}exports[_0x7234('0x5')]=function(_0x1a4d8c){for(var _0x17a1de=0x0,_0x26afd2=events[_0x7234('0x6')];_0x17a1de<_0x26afd2;_0x17a1de++){var _0xe5eb7a=events[_0x17a1de];var _0xaa294d=createListener('faxQueue:'+_0xe5eb7a,_0x1a4d8c);FaxQueueEvents['on'](_0xe5eb7a,_0xaa294d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e9fa385..e5a0217 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 _0x5f2f=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/members','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','/:id/teams'];(function(_0x390381,_0x2772ea){var _0x405c3a=function(_0x3b6326){while(--_0x3b6326){_0x390381['push'](_0x390381['shift']());}};_0x405c3a(++_0x2772ea);}(_0x5f2f,0x73));var _0xf5f2=function(_0x552041,_0xc34ee7){_0x552041=_0x552041-0x0;var _0x198a1a=_0x5f2f[_0x552041];return _0x198a1a;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getMembers']);router[_0xf5f2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x8')]('/:id/users',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x10')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x10')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['addAgents']);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x16')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x16')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x16')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1a')]);module[_0xf5f2('0x1b')]=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xb10b,0x12a));var _0xbb10=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0xb10b[_0xcf4569];return _0x7fef;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 03ed409..888cfdd 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 _0x8f00=['STRING','DATE','sequelize','exports'];(function(_0x5764f9,_0x376127){var _0x1ff2f2=function(_0x3dc5c6){while(--_0x3dc5c6){_0x5764f9['push'](_0x5764f9['shift']());}};_0x1ff2f2(++_0x376127);}(_0x8f00,0x1be));var _0x08f0=function(_0x4ccf92,_0x28c4da){_0x4ccf92=_0x4ccf92-0x0;var _0x10477d=_0x8f00[_0x4ccf92];return _0x10477d;};'use strict';var moment=require('moment');var Sequelize=require(_0x08f0('0x0'));module[_0x08f0('0x1')]={'uniqueid':{'type':Sequelize[_0x08f0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x08f0('0x3')]},'leaveAt':{'type':Sequelize[_0x08f0('0x3')]},'acceptAt':{'type':Sequelize[_0x08f0('0x3')]},'exitAt':{'type':Sequelize[_0x08f0('0x3')]},'reason':{'type':Sequelize[_0x08f0('0x2')]}}; \ No newline at end of file +var _0x2935=['exports','STRING','DATE'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2935,0x1d1));var _0x5293=function(_0x593cc6,_0x592022){_0x593cc6=_0x593cc6-0x0;var _0x26038a=_0x2935[_0x593cc6];return _0x26038a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5293('0x0')]={'uniqueid':{'type':Sequelize[_0x5293('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5293('0x1')]},'joinAt':{'type':Sequelize[_0x5293('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5293('0x2')]},'reason':{'type':Sequelize[_0x5293('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 17077f6..7759003 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 _0xd66c=['save','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range'];(function(_0xc5b52a,_0x538df2){var _0x140cbb=function(_0x165826){while(--_0x165826){_0xc5b52a['push'](_0xc5b52a['shift']());}};_0x140cbb(++_0x538df2);}(_0xd66c,0x109));var _0xcd66=function(_0x4b2a56,_0x1df79b){_0x4b2a56=_0x4b2a56-0x0;var _0x4c0c2d=_0xd66c[_0x4b2a56];return _0x4c0c2d;};'use strict';var pdf=require(_0xcd66('0x0'));var emlformat=require(_0xcd66('0x1'));var rimraf=require(_0xcd66('0x2'));var zipdir=require(_0xcd66('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd66('0x4'));var moment=require(_0xcd66('0x5'));var BPromise=require(_0xcd66('0x6'));var Mustache=require(_0xcd66('0x7'));var util=require('util');var path=require(_0xcd66('0x8'));var sox=require('sox');var csv=require(_0xcd66('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd66('0xa'));var squel=require(_0xcd66('0xb'));var crypto=require(_0xcd66('0xc'));var jsforce=require(_0xcd66('0xd'));var deskjs=require(_0xcd66('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcd66('0xf'));var Papa=require(_0xcd66('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd66('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd66('0x12'))(_0xcd66('0x13'));var utils=require(_0xcd66('0x14'));var config=require(_0xcd66('0x15'));var db=require(_0xcd66('0x16'))['db'];function respondWithStatusCode(_0x44ee50,_0x1bc786){_0x1bc786=_0x1bc786||0xcc;return function(_0x5778ca){if(_0x5778ca){return _0x44ee50[_0xcd66('0x17')](_0x1bc786);}return _0x44ee50['status'](_0x1bc786)[_0xcd66('0x18')]();};}function respondWithResult(_0x5c73fa,_0x1af9b9){_0x1af9b9=_0x1af9b9||0xc8;return function(_0x2ba91c){if(_0x2ba91c){return _0x5c73fa['status'](_0x1af9b9)[_0xcd66('0x19')](_0x2ba91c);}};}function respondWithFilteredResult(_0x11a5fa,_0x3bcda3){return function(_0x477973){if(_0x477973){var _0x50d397=_0x477973[_0xcd66('0x1a')],_0x45e6d6=_0x3bcda3[_0xcd66('0x1b')],_0x5d9f09=_0x3bcda3['offset']+_0x3bcda3['limit'],_0x7e2ee0;if(_0x5d9f09>=_0x50d397){_0x5d9f09=_0x50d397;_0x7e2ee0=0xc8;}else{_0x7e2ee0=0xce;}_0x11a5fa[_0xcd66('0x1c')](_0x7e2ee0);return _0x11a5fa[_0xcd66('0x1d')](_0xcd66('0x1e'),_0x45e6d6+'-'+_0x5d9f09+'/'+_0x50d397)[_0xcd66('0x19')](_0x477973);}return null;};}function patchUpdates(_0xdf81fa){return function(_0x53bbb0){try{jsonpatch['apply'](_0x53bbb0,_0xdf81fa,!![]);}catch(_0xacebf5){return BPromise['reject'](_0xacebf5);}return _0x53bbb0[_0xcd66('0x1f')]();};}function saveUpdates(_0x4e2704,_0x2564d9){return function(_0x28092c){if(_0x28092c){return _0x28092c['update'](_0x4e2704)['then'](function(_0x20173c){return _0x20173c;});}return null;};}function removeEntity(_0x566bfb,_0x4c08cf){return function(_0x7449e2){if(_0x7449e2){return _0x7449e2['destroy']()['then'](function(){_0x566bfb[_0xcd66('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x582375,_0x2a2a1f){return function(_0x3a9a0f){if(!_0x3a9a0f){_0x582375[_0xcd66('0x17')](0x194);}return _0x3a9a0f;};}function handleError(_0x30a288,_0x5ba6d9){_0x5ba6d9=_0x5ba6d9||0x1f4;return function(_0x2e2065){logger[_0xcd66('0x20')](_0x2e2065[_0xcd66('0x21')]);if(_0x2e2065[_0xcd66('0x22')]){delete _0x2e2065[_0xcd66('0x22')];}_0x30a288[_0xcd66('0x1c')](_0x5ba6d9)[_0xcd66('0x23')](_0x2e2065);};}exports[_0xcd66('0x24')]=function(_0x28802,_0x43455a){var _0xb68f6b={},_0x28b789={},_0x4e3508={'count':0x0,'rows':[]};var _0x11b816=_[_0xcd66('0x25')](db[_0xcd66('0x26')][_0xcd66('0x27')],function(_0x26ca7d){return{'name':_0x26ca7d[_0xcd66('0x28')],'type':_0x26ca7d[_0xcd66('0x29')]['key']};});_0x28b789[_0xcd66('0x2a')]=_[_0xcd66('0x25')](_0x11b816,_0xcd66('0x22'));_0x28b789[_0xcd66('0x2b')]=_['keys'](_0x28802['query']);_0x28b789[_0xcd66('0x2c')]=_['intersection'](_0x28b789[_0xcd66('0x2a')],_0x28b789['query']);_0xb68f6b[_0xcd66('0x2d')]=_[_0xcd66('0x2e')](_0x28b789[_0xcd66('0x2a')],qs['fields'](_0x28802[_0xcd66('0x2b')]['fields']));_0xb68f6b[_0xcd66('0x2d')]=_0xb68f6b['attributes'][_0xcd66('0x2f')]?_0xb68f6b[_0xcd66('0x2d')]:_0x28b789[_0xcd66('0x2a')];if(!_0x28802[_0xcd66('0x2b')][_0xcd66('0x30')](_0xcd66('0x31'))){_0xb68f6b['limit']=qs[_0xcd66('0x32')](_0x28802['query'][_0xcd66('0x32')]);_0xb68f6b[_0xcd66('0x1b')]=qs['offset'](_0x28802[_0xcd66('0x2b')][_0xcd66('0x1b')]);}_0xb68f6b[_0xcd66('0x33')]=qs[_0xcd66('0x34')](_0x28802['query'][_0xcd66('0x34')]);_0xb68f6b[_0xcd66('0x35')]=qs[_0xcd66('0x2c')](_[_0xcd66('0x36')](_0x28802['query'],_0x28b789[_0xcd66('0x2c')]),_0x11b816);if(_0x28802[_0xcd66('0x2b')][_0xcd66('0x37')]){_0xb68f6b[_0xcd66('0x35')]=_[_0xcd66('0x38')](_0xb68f6b[_0xcd66('0x35')],{'$or':_['map'](_0x11b816,function(_0xe37430){if(_0xe37430[_0xcd66('0x29')]!==_0xcd66('0x39')){var _0x164da4={};_0x164da4[_0xe37430[_0xcd66('0x22')]]={'$like':'%'+_0x28802[_0xcd66('0x2b')][_0xcd66('0x37')]+'%'};return _0x164da4;}})});}_0xb68f6b=_[_0xcd66('0x38')]({},_0xb68f6b,_0x28802[_0xcd66('0x3a')]);var _0x28fe7b={'where':_0xb68f6b[_0xcd66('0x35')]};return db[_0xcd66('0x26')][_0xcd66('0x1a')](_0x28fe7b)[_0xcd66('0x3b')](function(_0x5e82df){_0x4e3508[_0xcd66('0x1a')]=_0x5e82df;if(_0x28802[_0xcd66('0x2b')][_0xcd66('0x3c')]){_0xb68f6b[_0xcd66('0x3d')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xcd66('0x3e')](_0xb68f6b);})['then'](function(_0x6ba678){_0x4e3508[_0xcd66('0x3f')]=_0x6ba678;return _0x4e3508;})[_0xcd66('0x3b')](respondWithFilteredResult(_0x43455a,_0xb68f6b))[_0xcd66('0x40')](handleError(_0x43455a,null));};exports[_0xcd66('0x41')]=function(_0x17b758,_0x4fc44c){var _0x3a1319={'raw':!![],'where':{'id':_0x17b758[_0xcd66('0x42')]['id']}},_0x13441f={};_0x13441f[_0xcd66('0x2a')]=_['keys'](db[_0xcd66('0x26')][_0xcd66('0x27')]);_0x13441f[_0xcd66('0x2b')]=_[_0xcd66('0x43')](_0x17b758[_0xcd66('0x2b')]);_0x13441f[_0xcd66('0x2c')]=_[_0xcd66('0x2e')](_0x13441f[_0xcd66('0x2a')],_0x13441f[_0xcd66('0x2b')]);_0x3a1319[_0xcd66('0x2d')]=_[_0xcd66('0x2e')](_0x13441f['model'],qs[_0xcd66('0x44')](_0x17b758[_0xcd66('0x2b')][_0xcd66('0x44')]));_0x3a1319[_0xcd66('0x2d')]=_0x3a1319['attributes'][_0xcd66('0x2f')]?_0x3a1319[_0xcd66('0x2d')]:_0x13441f[_0xcd66('0x2a')];if(_0x17b758[_0xcd66('0x2b')][_0xcd66('0x3c')]){_0x3a1319['include']=[{'all':!![]}];}_0x3a1319=_['merge']({},_0x3a1319,_0x17b758['options']);return db['FaxQueueReport'][_0xcd66('0x45')](_0x3a1319)['then'](handleEntityNotFound(_0x4fc44c,null))['then'](respondWithResult(_0x4fc44c,null))[_0xcd66('0x40')](handleError(_0x4fc44c,null));};exports[_0xcd66('0x46')]=function(_0x451baf,_0x3005cd){return db[_0xcd66('0x26')][_0xcd66('0x46')](_0x451baf[_0xcd66('0x47')],{})[_0xcd66('0x3b')](respondWithResult(_0x3005cd,0xc9))[_0xcd66('0x40')](handleError(_0x3005cd,null));};exports[_0xcd66('0x48')]=function(_0x303bbb,_0x460fde){if(_0x303bbb[_0xcd66('0x47')]['id']){delete _0x303bbb[_0xcd66('0x47')]['id'];}return db[_0xcd66('0x26')][_0xcd66('0x45')]({'where':{'id':_0x303bbb['params']['id']}})['then'](handleEntityNotFound(_0x460fde,null))[_0xcd66('0x3b')](saveUpdates(_0x303bbb[_0xcd66('0x47')],null))['then'](respondWithResult(_0x460fde,null))[_0xcd66('0x40')](handleError(_0x460fde,null));};exports['destroy']=function(_0x4c5da0,_0x41bf7b){return db[_0xcd66('0x26')][_0xcd66('0x45')]({'where':{'id':_0x4c5da0[_0xcd66('0x42')]['id']}})[_0xcd66('0x3b')](handleEntityNotFound(_0x41bf7b,null))[_0xcd66('0x3b')](removeEntity(_0x41bf7b,null))[_0xcd66('0x40')](handleError(_0x41bf7b,null));};exports[_0xcd66('0x49')]=function(_0x32b9d9,_0x412e15){return db[_0xcd66('0x26')][_0xcd66('0x49')]()['then'](respondWithResult(_0x412e15,null))['catch'](handleError(_0x412e15,null));}; \ No newline at end of file +var _0x771c=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','FaxQueueReport','count','includeAll','include','rows','catch','show','params','find','create','body','eml-format'];(function(_0x4b291d,_0x44740f){var _0x572c36=function(_0x35e1cc){while(--_0x35e1cc){_0x4b291d['push'](_0x4b291d['shift']());}};_0x572c36(++_0x44740f);}(_0x771c,0x176));var _0xc771=function(_0x46dd5a,_0x14c890){_0x46dd5a=_0x46dd5a-0x0;var _0x562da4=_0x771c[_0x46dd5a];return _0x562da4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc771('0x0'));var rimraf=require(_0xc771('0x1'));var zipdir=require(_0xc771('0x2'));var jsonpatch=require(_0xc771('0x3'));var rp=require(_0xc771('0x4'));var moment=require('moment');var BPromise=require(_0xc771('0x5'));var Mustache=require(_0xc771('0x6'));var util=require('util');var path=require(_0xc771('0x7'));var sox=require(_0xc771('0x8'));var csv=require(_0xc771('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc771('0xa'));var squel=require(_0xc771('0xb'));var crypto=require(_0xc771('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc771('0xd'));var toCsv=require(_0xc771('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc771('0xe'));var authService=require(_0xc771('0xf'));var qs=require(_0xc771('0x10'));var as=require(_0xc771('0x11'));var hardwareService=require(_0xc771('0x12'));var logger=require(_0xc771('0x13'))(_0xc771('0x14'));var utils=require(_0xc771('0x15'));var config=require('../../config/environment');var db=require(_0xc771('0x16'))['db'];function respondWithStatusCode(_0x2a17d1,_0x13a563){_0x13a563=_0x13a563||0xcc;return function(_0x816736){if(_0x816736){return _0x2a17d1[_0xc771('0x17')](_0x13a563);}return _0x2a17d1[_0xc771('0x18')](_0x13a563)['end']();};}function respondWithResult(_0x33afe3,_0x2daf98){_0x2daf98=_0x2daf98||0xc8;return function(_0x55da7d){if(_0x55da7d){return _0x33afe3['status'](_0x2daf98)[_0xc771('0x19')](_0x55da7d);}};}function respondWithFilteredResult(_0x3af8cc,_0x5b3430){return function(_0xef6abe){if(_0xef6abe){var _0x4ead9e=_0xef6abe['count'],_0xdc3925=_0x5b3430[_0xc771('0x1a')],_0xae881b=_0x5b3430[_0xc771('0x1a')]+_0x5b3430[_0xc771('0x1b')],_0x1e956f;if(_0xae881b>=_0x4ead9e){_0xae881b=_0x4ead9e;_0x1e956f=0xc8;}else{_0x1e956f=0xce;}_0x3af8cc[_0xc771('0x18')](_0x1e956f);return _0x3af8cc[_0xc771('0x1c')](_0xc771('0x1d'),_0xdc3925+'-'+_0xae881b+'/'+_0x4ead9e)[_0xc771('0x19')](_0xef6abe);}return null;};}function patchUpdates(_0x45128b){return function(_0x143cda){try{jsonpatch[_0xc771('0x1e')](_0x143cda,_0x45128b,!![]);}catch(_0x5cb899){return BPromise[_0xc771('0x1f')](_0x5cb899);}return _0x143cda['save']();};}function saveUpdates(_0x4f5223,_0x27041d){return function(_0x3f2502){if(_0x3f2502){return _0x3f2502[_0xc771('0x20')](_0x4f5223)[_0xc771('0x21')](function(_0x2311ed){return _0x2311ed;});}return null;};}function removeEntity(_0x56a691,_0x45ffdc){return function(_0x21f6d0){if(_0x21f6d0){return _0x21f6d0[_0xc771('0x22')]()[_0xc771('0x21')](function(){_0x56a691[_0xc771('0x18')](0xcc)[_0xc771('0x23')]();});}};}function handleEntityNotFound(_0x18623d,_0x26ddaa){return function(_0x5d2258){if(!_0x5d2258){_0x18623d[_0xc771('0x17')](0x194);}return _0x5d2258;};}function handleError(_0x1e0e08,_0x4fccac){_0x4fccac=_0x4fccac||0x1f4;return function(_0x5c4477){logger[_0xc771('0x24')](_0x5c4477[_0xc771('0x25')]);if(_0x5c4477[_0xc771('0x26')]){delete _0x5c4477[_0xc771('0x26')];}_0x1e0e08[_0xc771('0x18')](_0x4fccac)[_0xc771('0x27')](_0x5c4477);};}exports[_0xc771('0x28')]=function(_0x5b346c,_0x70cdc5){var _0x16edf8={},_0x31f88b={},_0x45a370={'count':0x0,'rows':[]};var _0x36d470=_[_0xc771('0x29')](db['FaxQueueReport'][_0xc771('0x2a')],function(_0x25d48b){return{'name':_0x25d48b[_0xc771('0x2b')],'type':_0x25d48b[_0xc771('0x2c')][_0xc771('0x2d')]};});_0x31f88b[_0xc771('0x2e')]=_[_0xc771('0x29')](_0x36d470,_0xc771('0x26'));_0x31f88b[_0xc771('0x2f')]=_[_0xc771('0x30')](_0x5b346c[_0xc771('0x2f')]);_0x31f88b[_0xc771('0x31')]=_[_0xc771('0x32')](_0x31f88b[_0xc771('0x2e')],_0x31f88b[_0xc771('0x2f')]);_0x16edf8[_0xc771('0x33')]=_[_0xc771('0x32')](_0x31f88b[_0xc771('0x2e')],qs[_0xc771('0x34')](_0x5b346c[_0xc771('0x2f')][_0xc771('0x34')]));_0x16edf8['attributes']=_0x16edf8[_0xc771('0x33')][_0xc771('0x35')]?_0x16edf8[_0xc771('0x33')]:_0x31f88b[_0xc771('0x2e')];if(!_0x5b346c[_0xc771('0x2f')][_0xc771('0x36')](_0xc771('0x37'))){_0x16edf8[_0xc771('0x1b')]=qs[_0xc771('0x1b')](_0x5b346c[_0xc771('0x2f')][_0xc771('0x1b')]);_0x16edf8['offset']=qs['offset'](_0x5b346c[_0xc771('0x2f')][_0xc771('0x1a')]);}_0x16edf8[_0xc771('0x38')]=qs[_0xc771('0x39')](_0x5b346c[_0xc771('0x2f')]['sort']);_0x16edf8[_0xc771('0x3a')]=qs[_0xc771('0x31')](_[_0xc771('0x3b')](_0x5b346c[_0xc771('0x2f')],_0x31f88b[_0xc771('0x31')]),_0x36d470);if(_0x5b346c[_0xc771('0x2f')]['filter']){_0x16edf8[_0xc771('0x3a')]=_[_0xc771('0x3c')](_0x16edf8[_0xc771('0x3a')],{'$or':_[_0xc771('0x29')](_0x36d470,function(_0x3d44f6){if(_0x3d44f6[_0xc771('0x2c')]!==_0xc771('0x3d')){var _0x50b355={};_0x50b355[_0x3d44f6[_0xc771('0x26')]]={'$like':'%'+_0x5b346c['query'][_0xc771('0x3e')]+'%'};return _0x50b355;}})});}_0x16edf8=_['merge']({},_0x16edf8,_0x5b346c[_0xc771('0x3f')]);var _0x40774d={'where':_0x16edf8[_0xc771('0x3a')]};return db[_0xc771('0x40')]['count'](_0x40774d)[_0xc771('0x21')](function(_0x4d3e51){_0x45a370[_0xc771('0x41')]=_0x4d3e51;if(_0x5b346c['query'][_0xc771('0x42')]){_0x16edf8[_0xc771('0x43')]=[{'all':!![]}];}return db[_0xc771('0x40')]['findAll'](_0x16edf8);})['then'](function(_0xcac643){_0x45a370[_0xc771('0x44')]=_0xcac643;return _0x45a370;})['then'](respondWithFilteredResult(_0x70cdc5,_0x16edf8))[_0xc771('0x45')](handleError(_0x70cdc5,null));};exports[_0xc771('0x46')]=function(_0x12b9c5,_0x41ed7f){var _0x23ffac={'raw':!![],'where':{'id':_0x12b9c5[_0xc771('0x47')]['id']}},_0x3114d1={};_0x3114d1[_0xc771('0x2e')]=_['keys'](db['FaxQueueReport'][_0xc771('0x2a')]);_0x3114d1[_0xc771('0x2f')]=_[_0xc771('0x30')](_0x12b9c5[_0xc771('0x2f')]);_0x3114d1['filters']=_['intersection'](_0x3114d1[_0xc771('0x2e')],_0x3114d1[_0xc771('0x2f')]);_0x23ffac['attributes']=_[_0xc771('0x32')](_0x3114d1[_0xc771('0x2e')],qs[_0xc771('0x34')](_0x12b9c5[_0xc771('0x2f')][_0xc771('0x34')]));_0x23ffac[_0xc771('0x33')]=_0x23ffac[_0xc771('0x33')][_0xc771('0x35')]?_0x23ffac[_0xc771('0x33')]:_0x3114d1[_0xc771('0x2e')];if(_0x12b9c5[_0xc771('0x2f')][_0xc771('0x42')]){_0x23ffac[_0xc771('0x43')]=[{'all':!![]}];}_0x23ffac=_['merge']({},_0x23ffac,_0x12b9c5[_0xc771('0x3f')]);return db[_0xc771('0x40')][_0xc771('0x48')](_0x23ffac)[_0xc771('0x21')](handleEntityNotFound(_0x41ed7f,null))[_0xc771('0x21')](respondWithResult(_0x41ed7f,null))[_0xc771('0x45')](handleError(_0x41ed7f,null));};exports['create']=function(_0x2a9c9b,_0x871840){return db[_0xc771('0x40')][_0xc771('0x49')](_0x2a9c9b[_0xc771('0x4a')],{})[_0xc771('0x21')](respondWithResult(_0x871840,0xc9))[_0xc771('0x45')](handleError(_0x871840,null));};exports[_0xc771('0x20')]=function(_0x3a45cd,_0x1ff72c){if(_0x3a45cd[_0xc771('0x4a')]['id']){delete _0x3a45cd['body']['id'];}return db[_0xc771('0x40')]['find']({'where':{'id':_0x3a45cd[_0xc771('0x47')]['id']}})[_0xc771('0x21')](handleEntityNotFound(_0x1ff72c,null))['then'](saveUpdates(_0x3a45cd[_0xc771('0x4a')],null))[_0xc771('0x21')](respondWithResult(_0x1ff72c,null))[_0xc771('0x45')](handleError(_0x1ff72c,null));};exports[_0xc771('0x22')]=function(_0x4d56ad,_0x476ba0){return db[_0xc771('0x40')][_0xc771('0x48')]({'where':{'id':_0x4d56ad[_0xc771('0x47')]['id']}})[_0xc771('0x21')](handleEntityNotFound(_0x476ba0,null))['then'](removeEntity(_0x476ba0,null))['catch'](handleError(_0x476ba0,null));};exports['describe']=function(_0x4da3cd,_0x2d9842){return db[_0xc771('0x40')]['describe']()[_0xc771('0x21')](respondWithResult(_0x2d9842,null))[_0xc771('0x45')](handleError(_0x2d9842,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 680f1ab..ed69745 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 _0xd3c8=['FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xd3c8,0x161));var _0x8d3c=function(_0x1e36a2,_0x98ef27){_0x1e36a2=_0x1e36a2-0x0;var _0x5345ea=_0xd3c8[_0x1e36a2];return _0x5345ea;};'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('./faxQueueReport.attributes');module[_0x8d3c('0x9')]=function(_0x2642d1,_0x103825){return _0x2642d1[_0x8d3c('0xa')](_0x8d3c('0xb'),attributes,{'tableName':_0x8d3c('0xc'),'paranoid':![],'indexes':[{'name':_0x8d3c('0xd'),'fields':[_0x8d3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf11=['exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes'];(function(_0x42f270,_0x452dec){var _0x57bc5b=function(_0x258159){while(--_0x258159){_0x42f270['push'](_0x42f270['shift']());}};_0x57bc5b(++_0x452dec);}(_0xaf11,0x12f));var _0x1af1=function(_0xe0c6b9,_0x21ffb8){_0xe0c6b9=_0xe0c6b9-0x0;var _0x3de6a5=_0xaf11[_0xe0c6b9];return _0x3de6a5;};'use strict';var _=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var logger=require(_0x1af1('0x2'))(_0x1af1('0x3'));var moment=require('moment');var BPromise=require(_0x1af1('0x4'));var rp=require(_0x1af1('0x5'));var fs=require('fs');var path=require(_0x1af1('0x6'));var rimraf=require('rimraf');var config=require(_0x1af1('0x7'));var attributes=require(_0x1af1('0x8'));module[_0x1af1('0x9')]=function(_0x4d3153,_0x36f1a0){return _0x4d3153['define'](_0x1af1('0xa'),attributes,{'tableName':_0x1af1('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1af1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 313b336..9ce109a 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 _0xa780=['client','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','where','limit','then','UpdateFaxQueueReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x140eef,_0x26d53b){var _0x133662=function(_0x228d2b){while(--_0x228d2b){_0x140eef['push'](_0x140eef['shift']());}};_0x133662(++_0x26d53b);}(_0xa780,0x1c4));var _0x0a78=function(_0x38f3db,_0x5a70eb){_0x38f3db=_0x38f3db-0x0;var _0x138033=_0xa780[_0x38f3db];return _0x138033;};'use strict';var _=require('lodash');var util=require(_0x0a78('0x0'));var moment=require(_0x0a78('0x1'));var BPromise=require(_0x0a78('0x2'));var rs=require(_0x0a78('0x3'));var fs=require('fs');var Redis=require(_0x0a78('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a78('0x5'));var logger=require(_0x0a78('0x6'))(_0x0a78('0x7'));var config=require(_0x0a78('0x8'));var jayson=require(_0x0a78('0x9'));var client=jayson[_0x0a78('0xa')][_0x0a78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0abd,_0x42ccbc,_0x57b1e0){return new BPromise(function(_0x5057a0,_0x13d325){return client[_0x0a78('0xc')](_0x1f0abd,_0x57b1e0)['then'](function(_0x2ab256){logger['info'](_0x0a78('0xd'),_0x42ccbc,_0x0a78('0xe'));logger[_0x0a78('0xf')](_0x0a78('0x10'),_0x42ccbc,_0x0a78('0xe'),JSON[_0x0a78('0x11')](_0x2ab256));if(_0x2ab256[_0x0a78('0x12')]){if(_0x2ab256[_0x0a78('0x12')]['code']===0x1f4){logger[_0x0a78('0x12')](_0x0a78('0xd'),_0x42ccbc,_0x2ab256['error'][_0x0a78('0x13')]);return _0x13d325(_0x2ab256[_0x0a78('0x12')][_0x0a78('0x13')]);}logger[_0x0a78('0x12')](_0x0a78('0xd'),_0x42ccbc,_0x2ab256[_0x0a78('0x12')][_0x0a78('0x13')]);return _0x5057a0(_0x2ab256[_0x0a78('0x12')][_0x0a78('0x13')]);}else{logger[_0x0a78('0x14')](_0x0a78('0xd'),_0x42ccbc,_0x0a78('0xe'));_0x5057a0(_0x2ab256[_0x0a78('0x15')][_0x0a78('0x13')]);}})[_0x0a78('0x16')](function(_0x2f0f83){logger[_0x0a78('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x42ccbc,_0x2f0f83);_0x13d325(_0x2f0f83);});});}exports[_0x0a78('0x17')]=function(_0x578d8){var _0x3cd8d1=this;return new Promise(function(_0x3f59f9,_0x23b35d){return db[_0x0a78('0x18')][_0x0a78('0x19')](_0x578d8[_0x0a78('0x1a')],{'raw':_0x578d8[_0x0a78('0x1b')]?_0x578d8[_0x0a78('0x1b')][_0x0a78('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1aa4fa){logger[_0x0a78('0x14')](_0x0a78('0x17'),_0x578d8);logger[_0x0a78('0xf')](_0x0a78('0x17'),_0x578d8,JSON[_0x0a78('0x11')](_0x1aa4fa));_0x3f59f9(_0x1aa4fa);})['catch'](function(_0x2d0949){logger[_0x0a78('0x12')]('CreateFaxQueueReport',_0x2d0949[_0x0a78('0x13')],_0x578d8);_0x23b35d(_0x3cd8d1[_0x0a78('0x12')](0x1f4,_0x2d0949[_0x0a78('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x528118){var _0x2ecdb3=this;return new Promise(function(_0x5778ba,_0x4ae5a3){return db[_0x0a78('0x18')]['update'](_0x528118[_0x0a78('0x1a')],{'raw':_0x528118[_0x0a78('0x1b')]?_0x528118[_0x0a78('0x1b')][_0x0a78('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x528118['options']?_0x528118[_0x0a78('0x1b')][_0x0a78('0x1d')]||null:null,'attributes':_0x528118[_0x0a78('0x1b')]?_0x528118[_0x0a78('0x1b')]['attributes']||null:null,'limit':_0x528118[_0x0a78('0x1b')]?_0x528118[_0x0a78('0x1b')][_0x0a78('0x1e')]||null:null})[_0x0a78('0x1f')](function(_0x874416){logger['info'](_0x0a78('0x20'),_0x528118);logger[_0x0a78('0xf')]('UpdateFaxQueueReport',_0x528118,JSON['stringify'](_0x874416));_0x5778ba(_0x874416);})[_0x0a78('0x16')](function(_0xd65516){logger[_0x0a78('0x12')](_0x0a78('0x20'),_0xd65516[_0x0a78('0x13')],_0x528118);_0x4ae5a3(_0x2ecdb3['error'](0x1f4,_0xd65516[_0x0a78('0x13')]));});});}; \ No newline at end of file +var _0xe782=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','where','limit','lodash','util','moment','randomstring','ioredis'];(function(_0x3ae38f,_0x261d36){var _0x4f69f5=function(_0x1aa35b){while(--_0x1aa35b){_0x3ae38f['push'](_0x3ae38f['shift']());}};_0x4f69f5(++_0x261d36);}(_0xe782,0x73));var _0x2e78=function(_0x3dae8a,_0x914e35){_0x3dae8a=_0x3dae8a-0x0;var _0x234a2c=_0xe782[_0x3dae8a];return _0x234a2c;};'use strict';var _=require(_0x2e78('0x0'));var util=require(_0x2e78('0x1'));var moment=require(_0x2e78('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e78('0x3'));var fs=require('fs');var Redis=require(_0x2e78('0x4'));var db=require(_0x2e78('0x5'))['db'];var utils=require(_0x2e78('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2e78('0x7'));var jayson=require(_0x2e78('0x8'));var client=jayson['client'][_0x2e78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c1e91,_0x3d6fab,_0x49d1e7){return new BPromise(function(_0x35f0fb,_0x307d4d){return client['request'](_0x2c1e91,_0x49d1e7)[_0x2e78('0xa')](function(_0x16ae20){logger[_0x2e78('0xb')](_0x2e78('0xc'),_0x3d6fab,_0x2e78('0xd'));logger[_0x2e78('0xe')](_0x2e78('0xf'),_0x3d6fab,_0x2e78('0xd'),JSON[_0x2e78('0x10')](_0x16ae20));if(_0x16ae20[_0x2e78('0x11')]){if(_0x16ae20['error']['code']===0x1f4){logger[_0x2e78('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x3d6fab,_0x16ae20[_0x2e78('0x11')][_0x2e78('0x12')]);return _0x307d4d(_0x16ae20[_0x2e78('0x11')]['message']);}logger['error'](_0x2e78('0xc'),_0x3d6fab,_0x16ae20[_0x2e78('0x11')][_0x2e78('0x12')]);return _0x35f0fb(_0x16ae20[_0x2e78('0x11')][_0x2e78('0x12')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x3d6fab,_0x2e78('0xd'));_0x35f0fb(_0x16ae20[_0x2e78('0x13')]['message']);}})[_0x2e78('0x14')](function(_0x514ec8){logger[_0x2e78('0x11')](_0x2e78('0xc'),_0x3d6fab,_0x514ec8);_0x307d4d(_0x514ec8);});});}exports['CreateFaxQueueReport']=function(_0x4b381b){var _0x55744c=this;return new Promise(function(_0x15bff2,_0x4e8ab5){return db['FaxQueueReport'][_0x2e78('0x15')](_0x4b381b[_0x2e78('0x16')],{'raw':_0x4b381b[_0x2e78('0x17')]?_0x4b381b[_0x2e78('0x17')][_0x2e78('0x18')]===undefined?!![]:![]:!![]})[_0x2e78('0xa')](function(_0x479169){logger[_0x2e78('0xb')](_0x2e78('0x19'),_0x4b381b);logger['debug'](_0x2e78('0x19'),_0x4b381b,JSON[_0x2e78('0x10')](_0x479169));_0x15bff2(_0x479169);})['catch'](function(_0x333cc8){logger[_0x2e78('0x11')]('CreateFaxQueueReport',_0x333cc8[_0x2e78('0x12')],_0x4b381b);_0x4e8ab5(_0x55744c[_0x2e78('0x11')](0x1f4,_0x333cc8[_0x2e78('0x12')]));});});};exports[_0x2e78('0x1a')]=function(_0x41c030){var _0x40c522=this;return new Promise(function(_0x135f92,_0x521309){return db[_0x2e78('0x1b')]['update'](_0x41c030[_0x2e78('0x16')],{'raw':_0x41c030[_0x2e78('0x17')]?_0x41c030[_0x2e78('0x17')][_0x2e78('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41c030[_0x2e78('0x17')]?_0x41c030[_0x2e78('0x17')][_0x2e78('0x1c')]||null:null,'attributes':_0x41c030['options']?_0x41c030[_0x2e78('0x17')]['attributes']||null:null,'limit':_0x41c030[_0x2e78('0x17')]?_0x41c030[_0x2e78('0x17')][_0x2e78('0x1d')]||null:null})[_0x2e78('0xa')](function(_0x4f619f){logger['info'](_0x2e78('0x1a'),_0x41c030);logger[_0x2e78('0xe')]('UpdateFaxQueueReport',_0x41c030,JSON['stringify'](_0x4f619f));_0x135f92(_0x4f619f);})[_0x2e78('0x14')](function(_0x59f597){logger[_0x2e78('0x11')](_0x2e78('0x1a'),_0x59f597[_0x2e78('0x12')],_0x41c030);_0x521309(_0x40c522[_0x2e78('0x11')](0x1f4,_0x59f597['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 41bf8ae..d3c4f26 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 _0x32b5=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x55fe61,_0x24dd82){var _0x10198c=function(_0x542837){while(--_0x542837){_0x55fe61['push'](_0x55fe61['shift']());}};_0x10198c(++_0x24dd82);}(_0x32b5,0xe8));var _0x532b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x32b5[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x532b('0x0'));var path=require(_0x532b('0x1'));var timeout=require(_0x532b('0x2'));var express=require(_0x532b('0x3'));var router=express[_0x532b('0x4')]();var auth=require(_0x532b('0x5'));var interaction=require(_0x532b('0x6'));var config=require(_0x532b('0x7'));var controller=require(_0x532b('0x8'));router[_0x532b('0x9')]('/',auth[_0x532b('0xa')](),controller['index']);router[_0x532b('0x9')](_0x532b('0xb'),auth[_0x532b('0xa')](),controller[_0x532b('0xc')]);router['get'](_0x532b('0xd'),auth[_0x532b('0xa')](),controller[_0x532b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x532b('0xf')]);router[_0x532b('0x10')]('/:id',auth[_0x532b('0xa')](),controller[_0x532b('0x11')]);router[_0x532b('0x12')](_0x532b('0xd'),auth[_0x532b('0xa')](),controller[_0x532b('0x13')]);module[_0x532b('0x14')]=router; \ No newline at end of file +var _0x9f9b=['describe','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./faxQueueReport.controller','get','index','/describe'];(function(_0x3a995c,_0x184a12){var _0x37f93d=function(_0x1b51eb){while(--_0x1b51eb){_0x3a995c['push'](_0x3a995c['shift']());}};_0x37f93d(++_0x184a12);}(_0x9f9b,0x96));var _0xb9f9=function(_0x51afe9,_0x2f04f1){_0x51afe9=_0x51afe9-0x0;var _0x1b4276=_0x9f9b[_0x51afe9];return _0x1b4276;};'use strict';var multer=require(_0xb9f9('0x0'));var util=require(_0xb9f9('0x1'));var path=require(_0xb9f9('0x2'));var timeout=require(_0xb9f9('0x3'));var express=require('express');var router=express[_0xb9f9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9f9('0x5'));var config=require('../../config/environment');var controller=require(_0xb9f9('0x6'));router[_0xb9f9('0x7')]('/',auth['isAuthenticated'](),controller[_0xb9f9('0x8')]);router[_0xb9f9('0x7')](_0xb9f9('0x9'),auth['isAuthenticated'](),controller[_0xb9f9('0xa')]);router[_0xb9f9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb9f9('0xb')]);router[_0xb9f9('0xc')]('/',auth[_0xb9f9('0xd')](),controller['create']);router[_0xb9f9('0xe')](_0xb9f9('0xf'),auth[_0xb9f9('0xd')](),controller[_0xb9f9('0x10')]);router[_0xb9f9('0x11')]('/:id',auth[_0xb9f9('0xd')](),controller[_0xb9f9('0x12')]);module[_0xb9f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c7ed710..b08e278 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 _0x143b=['agent','queue','DATE','NOW','moment','exports','STRING','ENUM','account'];(function(_0x2c0ed3,_0x5bbbac){var _0x2425ec=function(_0x11928c){while(--_0x11928c){_0x2c0ed3['push'](_0x2c0ed3['shift']());}};_0x2425ec(++_0x5bbbac);}(_0x143b,0x1b4));var _0xb143=function(_0x4c66ed,_0x3eb25d){_0x4c66ed=_0x4c66ed-0x0;var _0x8f6765=_0x143b[_0x4c66ed];return _0x8f6765;};'use strict';var moment=require(_0xb143('0x0'));var Sequelize=require('sequelize');module[_0xb143('0x1')]={'uniqueid':{'type':Sequelize[_0xb143('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb143('0x3')](_0xb143('0x4'),_0xb143('0x5'),_0xb143('0x6')),'allowNull':![],'defaultValue':_0xb143('0x6')},'transferredAt':{'type':Sequelize[_0xb143('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xb143('0x8')]}}; \ No newline at end of file +var _0xce9f=['moment','sequelize','exports','STRING','account','queue','DATE','NOW'];(function(_0xf43ac5,_0x355cde){var _0x164cc8=function(_0x29c83d){while(--_0x29c83d){_0xf43ac5['push'](_0xf43ac5['shift']());}};_0x164cc8(++_0x355cde);}(_0xce9f,0xe8));var _0xfce9=function(_0x370cf0,_0x51bb6f){_0x370cf0=_0x370cf0-0x0;var _0x25c9b8=_0xce9f[_0x370cf0];return _0x25c9b8;};'use strict';var moment=require(_0xfce9('0x0'));var Sequelize=require(_0xfce9('0x1'));module[_0xfce9('0x2')]={'uniqueid':{'type':Sequelize[_0xfce9('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfce9('0x4'),'agent',_0xfce9('0x5')),'allowNull':![],'defaultValue':_0xfce9('0x5')},'transferredAt':{'type':Sequelize[_0xfce9('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xfce9('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 550a699..d7fd56b 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 _0xdb28=['Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','set'];(function(_0x3fba30,_0x48af3b){var _0xb9b567=function(_0x4d80a3){while(--_0x4d80a3){_0x3fba30['push'](_0x3fba30['shift']());}};_0xb9b567(++_0x48af3b);}(_0xdb28,0x106));var _0x8db2=function(_0x575e16,_0x638d55){_0x575e16=_0x575e16-0x0;var _0x5a9f38=_0xdb28[_0x575e16];return _0x5a9f38;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];function respondWithStatusCode(_0x1349f6,_0x204f49){_0x204f49=_0x204f49||0xcc;return function(_0x37d017){if(_0x37d017){return _0x1349f6['sendStatus'](_0x204f49);}return _0x1349f6['status'](_0x204f49)[_0x8db2('0x18')]();};}function respondWithResult(_0x15e87c,_0x350d61){_0x350d61=_0x350d61||0xc8;return function(_0x1d6a15){if(_0x1d6a15){return _0x15e87c[_0x8db2('0x19')](_0x350d61)[_0x8db2('0x1a')](_0x1d6a15);}};}function respondWithFilteredResult(_0x2f177a,_0x3c96a7){return function(_0x131252){if(_0x131252){var _0x16c8c2=_0x131252['count'],_0x5489a9=_0x3c96a7[_0x8db2('0x1b')],_0x13b0f5=_0x3c96a7[_0x8db2('0x1b')]+_0x3c96a7[_0x8db2('0x1c')],_0x24da1b;if(_0x13b0f5>=_0x16c8c2){_0x13b0f5=_0x16c8c2;_0x24da1b=0xc8;}else{_0x24da1b=0xce;}_0x2f177a[_0x8db2('0x19')](_0x24da1b);return _0x2f177a[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x5489a9+'-'+_0x13b0f5+'/'+_0x16c8c2)['json'](_0x131252);}return null;};}function patchUpdates(_0x5df464){return function(_0x77789){try{jsonpatch[_0x8db2('0x1f')](_0x77789,_0x5df464,!![]);}catch(_0x1310d3){return BPromise[_0x8db2('0x20')](_0x1310d3);}return _0x77789['save']();};}function saveUpdates(_0x431d60,_0x36a9ff){return function(_0x260940){if(_0x260940){return _0x260940[_0x8db2('0x21')](_0x431d60)[_0x8db2('0x22')](function(_0x597260){return _0x597260;});}return null;};}function removeEntity(_0x124467,_0x3e30e6){return function(_0x18f69c){if(_0x18f69c){return _0x18f69c[_0x8db2('0x23')]()[_0x8db2('0x22')](function(){_0x124467[_0x8db2('0x19')](0xcc)[_0x8db2('0x18')]();});}};}function handleEntityNotFound(_0x5c6614,_0x256202){return function(_0x4f6516){if(!_0x4f6516){_0x5c6614['sendStatus'](0x194);}return _0x4f6516;};}function handleError(_0x52a9ca,_0x4d923c){_0x4d923c=_0x4d923c||0x1f4;return function(_0xec8cd2){logger[_0x8db2('0x24')](_0xec8cd2[_0x8db2('0x25')]);if(_0xec8cd2[_0x8db2('0x26')]){delete _0xec8cd2[_0x8db2('0x26')];}_0x52a9ca[_0x8db2('0x19')](_0x4d923c)['send'](_0xec8cd2);};}exports[_0x8db2('0x27')]=function(_0x372311,_0x430dd5){var _0x8b7cec={},_0x483aee={},_0x2e0691={'count':0x0,'rows':[]};var _0x11f398=_[_0x8db2('0x28')](db[_0x8db2('0x29')][_0x8db2('0x2a')],function(_0x21bae5){return{'name':_0x21bae5[_0x8db2('0x2b')],'type':_0x21bae5[_0x8db2('0x2c')][_0x8db2('0x2d')]};});_0x483aee['model']=_[_0x8db2('0x28')](_0x11f398,'name');_0x483aee['query']=_[_0x8db2('0x2e')](_0x372311[_0x8db2('0x2f')]);_0x483aee[_0x8db2('0x30')]=_['intersection'](_0x483aee[_0x8db2('0x31')],_0x483aee['query']);_0x8b7cec[_0x8db2('0x32')]=_[_0x8db2('0x33')](_0x483aee[_0x8db2('0x31')],qs['fields'](_0x372311['query'][_0x8db2('0x34')]));_0x8b7cec[_0x8db2('0x32')]=_0x8b7cec['attributes']['length']?_0x8b7cec[_0x8db2('0x32')]:_0x483aee[_0x8db2('0x31')];if(!_0x372311[_0x8db2('0x2f')][_0x8db2('0x35')](_0x8db2('0x36'))){_0x8b7cec[_0x8db2('0x1c')]=qs[_0x8db2('0x1c')](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1c')]);_0x8b7cec[_0x8db2('0x1b')]=qs['offset'](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1b')]);}_0x8b7cec['order']=qs[_0x8db2('0x37')](_0x372311[_0x8db2('0x2f')]['sort']);_0x8b7cec['where']=qs[_0x8db2('0x30')](_['pick'](_0x372311[_0x8db2('0x2f')],_0x483aee[_0x8db2('0x30')]),_0x11f398);if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]){_0x8b7cec['where']=_[_0x8db2('0x39')](_0x8b7cec['where'],{'$or':_[_0x8db2('0x28')](_0x11f398,function(_0xd550ae){if(_0xd550ae[_0x8db2('0x2c')]!==_0x8db2('0x3a')){var _0x50e88a={};_0x50e88a[_0xd550ae['name']]={'$like':'%'+_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]+'%'};return _0x50e88a;}})});}_0x8b7cec=_['merge']({},_0x8b7cec,_0x372311[_0x8db2('0x3b')]);var _0x24bcfe={'where':_0x8b7cec[_0x8db2('0x3c')]};return db['FaxTransferReport'][_0x8db2('0x3d')](_0x24bcfe)[_0x8db2('0x22')](function(_0x953349){_0x2e0691[_0x8db2('0x3d')]=_0x953349;if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x3e')]){_0x8b7cec[_0x8db2('0x3f')]=[{'all':!![]}];}return db[_0x8db2('0x29')][_0x8db2('0x40')](_0x8b7cec);})[_0x8db2('0x22')](function(_0x21cf7c){_0x2e0691[_0x8db2('0x41')]=_0x21cf7c;return _0x2e0691;})[_0x8db2('0x22')](respondWithFilteredResult(_0x430dd5,_0x8b7cec))['catch'](handleError(_0x430dd5,null));};exports[_0x8db2('0x42')]=function(_0x2b2472,_0x5e0382){var _0x49a7ae={'raw':!![],'where':{'id':_0x2b2472['params']['id']}},_0x249c73={};_0x249c73[_0x8db2('0x31')]=_[_0x8db2('0x2e')](db[_0x8db2('0x29')][_0x8db2('0x2a')]);_0x249c73[_0x8db2('0x2f')]=_[_0x8db2('0x2e')](_0x2b2472[_0x8db2('0x2f')]);_0x249c73['filters']=_[_0x8db2('0x33')](_0x249c73[_0x8db2('0x31')],_0x249c73[_0x8db2('0x2f')]);_0x49a7ae[_0x8db2('0x32')]=_['intersection'](_0x249c73[_0x8db2('0x31')],qs[_0x8db2('0x34')](_0x2b2472[_0x8db2('0x2f')][_0x8db2('0x34')]));_0x49a7ae['attributes']=_0x49a7ae[_0x8db2('0x32')]['length']?_0x49a7ae[_0x8db2('0x32')]:_0x249c73[_0x8db2('0x31')];if(_0x2b2472[_0x8db2('0x2f')]['includeAll']){_0x49a7ae['include']=[{'all':!![]}];}_0x49a7ae=_[_0x8db2('0x39')]({},_0x49a7ae,_0x2b2472['options']);return db[_0x8db2('0x29')][_0x8db2('0x43')](_0x49a7ae)[_0x8db2('0x22')](handleEntityNotFound(_0x5e0382,null))[_0x8db2('0x22')](respondWithResult(_0x5e0382,null))[_0x8db2('0x44')](handleError(_0x5e0382,null));};exports[_0x8db2('0x45')]=function(_0x4355e2,_0xab6bdd){return db[_0x8db2('0x29')][_0x8db2('0x45')](_0x4355e2[_0x8db2('0x46')],{})[_0x8db2('0x22')](respondWithResult(_0xab6bdd,0xc9))['catch'](handleError(_0xab6bdd,null));};exports[_0x8db2('0x21')]=function(_0x2ada52,_0xdbba64){if(_0x2ada52[_0x8db2('0x46')]['id']){delete _0x2ada52['body']['id'];}return db['FaxTransferReport'][_0x8db2('0x43')]({'where':{'id':_0x2ada52[_0x8db2('0x47')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0xdbba64,null))['then'](saveUpdates(_0x2ada52['body'],null))['then'](respondWithResult(_0xdbba64,null))[_0x8db2('0x44')](handleError(_0xdbba64,null));};exports[_0x8db2('0x23')]=function(_0x55c7dd,_0x383fa1){return db[_0x8db2('0x29')][_0x8db2('0x43')]({'where':{'id':_0x55c7dd[_0x8db2('0x47')]['id']}})['then'](handleEntityNotFound(_0x383fa1,null))['then'](removeEntity(_0x383fa1,null))[_0x8db2('0x44')](handleError(_0x383fa1,null));};exports[_0x8db2('0x48')]=function(_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x29')][_0x8db2('0x48')]()[_0x8db2('0x22')](respondWithResult(_0x2f0bd0,null))[_0x8db2('0x44')](handleError(_0x2f0bd0,null));}; \ No newline at end of file +var _0xadb5=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','FaxTransferReport','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','stack','name','send','index'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xadb5,0xad));var _0x5adb=function(_0x3ef8f5,_0x509faf){_0x3ef8f5=_0x3ef8f5-0x0;var _0x2b1e50=_0xadb5[_0x3ef8f5];return _0x2b1e50;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];function respondWithStatusCode(_0x56012f,_0x2a0b70){_0x2a0b70=_0x2a0b70||0xcc;return function(_0x5433bf){if(_0x5433bf){return _0x56012f[_0x5adb('0x18')](_0x2a0b70);}return _0x56012f[_0x5adb('0x19')](_0x2a0b70)[_0x5adb('0x1a')]();};}function respondWithResult(_0x5c929a,_0x2a545b){_0x2a545b=_0x2a545b||0xc8;return function(_0x34af2c){if(_0x34af2c){return _0x5c929a[_0x5adb('0x19')](_0x2a545b)['json'](_0x34af2c);}};}function respondWithFilteredResult(_0x2312de,_0x518823){return function(_0x367d82){if(_0x367d82){var _0x42a482=_0x367d82[_0x5adb('0x1b')],_0x30614e=_0x518823[_0x5adb('0x1c')],_0x304784=_0x518823[_0x5adb('0x1c')]+_0x518823[_0x5adb('0x1d')],_0x1c0f97;if(_0x304784>=_0x42a482){_0x304784=_0x42a482;_0x1c0f97=0xc8;}else{_0x1c0f97=0xce;}_0x2312de['status'](_0x1c0f97);return _0x2312de[_0x5adb('0x1e')]('Content-Range',_0x30614e+'-'+_0x304784+'/'+_0x42a482)[_0x5adb('0x1f')](_0x367d82);}return null;};}function patchUpdates(_0x558f76){return function(_0x3ef465){try{jsonpatch['apply'](_0x3ef465,_0x558f76,!![]);}catch(_0x5e218c){return BPromise[_0x5adb('0x20')](_0x5e218c);}return _0x3ef465[_0x5adb('0x21')]();};}function saveUpdates(_0x438671,_0x1fd4a7){return function(_0x99bc6c){if(_0x99bc6c){return _0x99bc6c['update'](_0x438671)[_0x5adb('0x22')](function(_0x5c296e){return _0x5c296e;});}return null;};}function removeEntity(_0x4e9f16,_0x3754cc){return function(_0x379b33){if(_0x379b33){return _0x379b33[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0x4e9f16[_0x5adb('0x19')](0xcc)[_0x5adb('0x1a')]();});}};}function handleEntityNotFound(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(!_0x4b1957){_0xfd9bb9[_0x5adb('0x18')](0x194);}return _0x4b1957;};}function handleError(_0x3220cd,_0x3839fb){_0x3839fb=_0x3839fb||0x1f4;return function(_0xeb556c){logger['error'](_0xeb556c[_0x5adb('0x24')]);if(_0xeb556c[_0x5adb('0x25')]){delete _0xeb556c['name'];}_0x3220cd[_0x5adb('0x19')](_0x3839fb)[_0x5adb('0x26')](_0xeb556c);};}exports[_0x5adb('0x27')]=function(_0x55b40a,_0x13ad1d){var _0xbe21b1={},_0x3a4fca={},_0x2c64a3={'count':0x0,'rows':[]};var _0x36459b=_[_0x5adb('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x5d457e){return{'name':_0x5d457e[_0x5adb('0x29')],'type':_0x5d457e[_0x5adb('0x2a')][_0x5adb('0x2b')]};});_0x3a4fca[_0x5adb('0x2c')]=_[_0x5adb('0x28')](_0x36459b,'name');_0x3a4fca[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x55b40a[_0x5adb('0x2d')]);_0x3a4fca[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],_0x3a4fca[_0x5adb('0x2d')]);_0xbe21b1[_0x5adb('0x31')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],qs['fields'](_0x55b40a[_0x5adb('0x2d')]['fields']));_0xbe21b1[_0x5adb('0x31')]=_0xbe21b1[_0x5adb('0x31')]['length']?_0xbe21b1[_0x5adb('0x31')]:_0x3a4fca[_0x5adb('0x2c')];if(!_0x55b40a[_0x5adb('0x2d')]['hasOwnProperty'](_0x5adb('0x32'))){_0xbe21b1[_0x5adb('0x1d')]=qs['limit'](_0x55b40a['query'][_0x5adb('0x1d')]);_0xbe21b1['offset']=qs[_0x5adb('0x1c')](_0x55b40a[_0x5adb('0x2d')][_0x5adb('0x1c')]);}_0xbe21b1[_0x5adb('0x33')]=qs[_0x5adb('0x34')](_0x55b40a['query'][_0x5adb('0x34')]);_0xbe21b1[_0x5adb('0x35')]=qs[_0x5adb('0x2f')](_['pick'](_0x55b40a['query'],_0x3a4fca[_0x5adb('0x2f')]),_0x36459b);if(_0x55b40a[_0x5adb('0x2d')]['filter']){_0xbe21b1[_0x5adb('0x35')]=_['merge'](_0xbe21b1[_0x5adb('0x35')],{'$or':_['map'](_0x36459b,function(_0x11cb37){if(_0x11cb37['type']!==_0x5adb('0x36')){var _0x23a1db={};_0x23a1db[_0x11cb37['name']]={'$like':'%'+_0x55b40a[_0x5adb('0x2d')]['filter']+'%'};return _0x23a1db;}})});}_0xbe21b1=_[_0x5adb('0x37')]({},_0xbe21b1,_0x55b40a[_0x5adb('0x38')]);var _0xd5660c={'where':_0xbe21b1['where']};return db[_0x5adb('0x39')][_0x5adb('0x1b')](_0xd5660c)[_0x5adb('0x22')](function(_0x132803){_0x2c64a3[_0x5adb('0x1b')]=_0x132803;if(_0x55b40a['query']['includeAll']){_0xbe21b1['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x5adb('0x3a')](_0xbe21b1);})[_0x5adb('0x22')](function(_0x3a104a){_0x2c64a3[_0x5adb('0x3b')]=_0x3a104a;return _0x2c64a3;})[_0x5adb('0x22')](respondWithFilteredResult(_0x13ad1d,_0xbe21b1))[_0x5adb('0x3c')](handleError(_0x13ad1d,null));};exports[_0x5adb('0x3d')]=function(_0x3bf282,_0x478a70){var _0x53f2c6={'raw':!![],'where':{'id':_0x3bf282['params']['id']}},_0x27dbb7={};_0x27dbb7[_0x5adb('0x2c')]=_[_0x5adb('0x2e')](db[_0x5adb('0x39')][_0x5adb('0x3e')]);_0x27dbb7[_0x5adb('0x2d')]=_['keys'](_0x3bf282[_0x5adb('0x2d')]);_0x27dbb7[_0x5adb('0x2f')]=_['intersection'](_0x27dbb7[_0x5adb('0x2c')],_0x27dbb7[_0x5adb('0x2d')]);_0x53f2c6['attributes']=_[_0x5adb('0x30')](_0x27dbb7[_0x5adb('0x2c')],qs[_0x5adb('0x3f')](_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x3f')]));_0x53f2c6[_0x5adb('0x31')]=_0x53f2c6[_0x5adb('0x31')]['length']?_0x53f2c6['attributes']:_0x27dbb7[_0x5adb('0x2c')];if(_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x40')]){_0x53f2c6[_0x5adb('0x41')]=[{'all':!![]}];}_0x53f2c6=_['merge']({},_0x53f2c6,_0x3bf282['options']);return db[_0x5adb('0x39')][_0x5adb('0x42')](_0x53f2c6)[_0x5adb('0x22')](handleEntityNotFound(_0x478a70,null))[_0x5adb('0x22')](respondWithResult(_0x478a70,null))[_0x5adb('0x3c')](handleError(_0x478a70,null));};exports['create']=function(_0x182cbc,_0x437f52){return db['FaxTransferReport'][_0x5adb('0x43')](_0x182cbc[_0x5adb('0x44')],{})[_0x5adb('0x22')](respondWithResult(_0x437f52,0xc9))[_0x5adb('0x3c')](handleError(_0x437f52,null));};exports[_0x5adb('0x45')]=function(_0x3a5409,_0x39840e){if(_0x3a5409[_0x5adb('0x44')]['id']){delete _0x3a5409['body']['id'];}return db[_0x5adb('0x39')]['find']({'where':{'id':_0x3a5409['params']['id']}})['then'](handleEntityNotFound(_0x39840e,null))[_0x5adb('0x22')](saveUpdates(_0x3a5409[_0x5adb('0x44')],null))[_0x5adb('0x22')](respondWithResult(_0x39840e,null))['catch'](handleError(_0x39840e,null));};exports[_0x5adb('0x23')]=function(_0x5cbab5,_0x177a81){return db[_0x5adb('0x39')][_0x5adb('0x42')]({'where':{'id':_0x5cbab5['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x177a81,null))['then'](removeEntity(_0x177a81,null))[_0x5adb('0x3c')](handleError(_0x177a81,null));};exports[_0x5adb('0x46')]=function(_0x55c535,_0x2402a3){return db[_0x5adb('0x39')][_0x5adb('0x46')]()[_0x5adb('0x22')](respondWithResult(_0x2402a3,null))[_0x5adb('0x3c')](handleError(_0x2402a3,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 92dc9d3..44d442f 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 _0x9e09=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x3abd89,_0x312c67){var _0x2b1d72=function(_0x1876f1){while(--_0x1876f1){_0x3abd89['push'](_0x3abd89['shift']());}};_0x2b1d72(++_0x312c67);}(_0x9e09,0x152));var _0x99e0=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9e09[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x99e0('0x0'));var util=require(_0x99e0('0x1'));var logger=require('../../config/logger')(_0x99e0('0x2'));var moment=require(_0x99e0('0x3'));var BPromise=require('bluebird');var rp=require(_0x99e0('0x4'));var fs=require('fs');var path=require(_0x99e0('0x5'));var rimraf=require(_0x99e0('0x6'));var config=require(_0x99e0('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0x99e0('0x8')]=function(_0x2f4afb,_0x26e559){return _0x2f4afb[_0x99e0('0x9')](_0x99e0('0xa'),attributes,{'tableName':_0x99e0('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x99e0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9265=['bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','report_fax_transfer','uniqueid','lodash','api','moment'];(function(_0x2c2ed3,_0x18a906){var _0x2dc643=function(_0x49d831){while(--_0x49d831){_0x2c2ed3['push'](_0x2c2ed3['shift']());}};_0x2dc643(++_0x18a906);}(_0x9265,0x1dd));var _0x5926=function(_0x2e21ba,_0x129588){_0x2e21ba=_0x2e21ba-0x0;var _0xa7374a=_0x9265[_0x2e21ba];return _0xa7374a;};'use strict';var _=require(_0x5926('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5926('0x1'));var moment=require(_0x5926('0x2'));var BPromise=require(_0x5926('0x3'));var rp=require(_0x5926('0x4'));var fs=require('fs');var path=require(_0x5926('0x5'));var rimraf=require(_0x5926('0x6'));var config=require(_0x5926('0x7'));var attributes=require(_0x5926('0x8'));module['exports']=function(_0x16ceff,_0xb2dc0e){return _0x16ceff[_0x5926('0x9')]('FaxTransferReport',attributes,{'tableName':_0x5926('0xa'),'paranoid':![],'indexes':[{'name':_0x5926('0xb'),'fields':[_0x5926('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 9057b97..ccdca6d 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 _0x00f4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring'];(function(_0x1ae238,_0x2cb50f){var _0x55a511=function(_0x28a7e9){while(--_0x28a7e9){_0x1ae238['push'](_0x1ae238['shift']());}};_0x55a511(++_0x2cb50f);}(_0x00f4,0x179));var _0x400f=function(_0x2ab80f,_0x59362c){_0x2ab80f=_0x2ab80f-0x0;var _0x1af00d=_0x00f4[_0x2ab80f];return _0x1af00d;};'use strict';var _=require(_0x400f('0x0'));var util=require(_0x400f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x400f('0x2'));var fs=require('fs');var Redis=require(_0x400f('0x3'));var db=require(_0x400f('0x4'))['db'];var utils=require(_0x400f('0x5'));var logger=require(_0x400f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x400f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x254f3a,_0x146aae,_0x28e216){return new BPromise(function(_0x12f2fc,_0x57344c){return client[_0x400f('0x8')](_0x254f3a,_0x28e216)[_0x400f('0x9')](function(_0x10c238){logger[_0x400f('0xa')](_0x400f('0xb'),_0x146aae,_0x400f('0xc'));logger[_0x400f('0xd')](_0x400f('0xe'),_0x146aae,_0x400f('0xc'),JSON[_0x400f('0xf')](_0x10c238));if(_0x10c238['error']){if(_0x10c238['error']['code']===0x1f4){logger[_0x400f('0x10')](_0x400f('0xb'),_0x146aae,_0x10c238[_0x400f('0x10')][_0x400f('0x11')]);return _0x57344c(_0x10c238[_0x400f('0x10')]['message']);}logger[_0x400f('0x10')](_0x400f('0xb'),_0x146aae,_0x10c238[_0x400f('0x10')][_0x400f('0x11')]);return _0x12f2fc(_0x10c238[_0x400f('0x10')][_0x400f('0x11')]);}else{logger[_0x400f('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x146aae,_0x400f('0xc'));_0x12f2fc(_0x10c238[_0x400f('0x12')]['message']);}})[_0x400f('0x13')](function(_0x359a3d){logger[_0x400f('0x10')](_0x400f('0xb'),_0x146aae,_0x359a3d);_0x57344c(_0x359a3d);});});} \ No newline at end of file +var _0xbc95=['message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4d3e97,_0x749913){var _0x3147d7=function(_0x250599){while(--_0x250599){_0x4d3e97['push'](_0x4d3e97['shift']());}};_0x3147d7(++_0x749913);}(_0xbc95,0xb6));var _0x5bc9=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0xbc95[_0x360739];return _0x3e23a1;};'use strict';var _=require(_0x5bc9('0x0'));var util=require('util');var moment=require(_0x5bc9('0x1'));var BPromise=require('bluebird');var rs=require(_0x5bc9('0x2'));var fs=require('fs');var Redis=require(_0x5bc9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bc9('0x4'));var logger=require(_0x5bc9('0x5'))(_0x5bc9('0x6'));var config=require('../../config/environment');var jayson=require(_0x5bc9('0x7'));var client=jayson[_0x5bc9('0x8')][_0x5bc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2df270,_0x1392a7,_0x166015){return new BPromise(function(_0x50082c,_0x5afafc){return client[_0x5bc9('0xa')](_0x2df270,_0x166015)[_0x5bc9('0xb')](function(_0x3d2274){logger[_0x5bc9('0xc')](_0x5bc9('0xd'),_0x1392a7,_0x5bc9('0xe'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x1392a7,_0x5bc9('0xe'),JSON[_0x5bc9('0xf')](_0x3d2274));if(_0x3d2274[_0x5bc9('0x10')]){if(_0x3d2274[_0x5bc9('0x10')][_0x5bc9('0x11')]===0x1f4){logger[_0x5bc9('0x10')](_0x5bc9('0xd'),_0x1392a7,_0x3d2274['error'][_0x5bc9('0x12')]);return _0x5afafc(_0x3d2274[_0x5bc9('0x10')][_0x5bc9('0x12')]);}logger[_0x5bc9('0x10')](_0x5bc9('0xd'),_0x1392a7,_0x3d2274[_0x5bc9('0x10')][_0x5bc9('0x12')]);return _0x50082c(_0x3d2274[_0x5bc9('0x10')][_0x5bc9('0x12')]);}else{logger['info'](_0x5bc9('0xd'),_0x1392a7,_0x5bc9('0xe'));_0x50082c(_0x3d2274[_0x5bc9('0x13')]['message']);}})['catch'](function(_0xec50d4){logger[_0x5bc9('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x1392a7,_0xec50d4);_0x5afafc(_0xec50d4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0c90f6a..fde9354 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 _0xfd1e=['/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','./faxTransferReport.controller','get','index'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xfd1e,0x1ad));var _0xefd1=function(_0x4b624f,_0x5d946c){_0x4b624f=_0x4b624f-0x0;var _0x170d9e=_0xfd1e[_0x4b624f];return _0x170d9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xefd1('0x0'));var timeout=require(_0xefd1('0x1'));var express=require(_0xefd1('0x2'));var router=express[_0xefd1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xefd1('0x4'));var config=require('../../config/environment');var controller=require(_0xefd1('0x5'));router[_0xefd1('0x6')]('/',auth['isAuthenticated'](),controller[_0xefd1('0x7')]);router[_0xefd1('0x6')](_0xefd1('0x8'),auth['isAuthenticated'](),controller[_0xefd1('0x9')]);router[_0xefd1('0x6')](_0xefd1('0xa'),auth[_0xefd1('0xb')](),controller[_0xefd1('0xc')]);router[_0xefd1('0xd')]('/',auth['isAuthenticated'](),controller[_0xefd1('0xe')]);router[_0xefd1('0xf')](_0xefd1('0xa'),auth[_0xefd1('0xb')](),controller[_0xefd1('0x10')]);router[_0xefd1('0x11')](_0xefd1('0xa'),auth[_0xefd1('0xb')](),controller['destroy']);module[_0xefd1('0x12')]=router; \ No newline at end of file +var _0xeb59=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get'];(function(_0x149363,_0x3dc0c9){var _0x2fe3e4=function(_0x2b0cde){while(--_0x2b0cde){_0x149363['push'](_0x149363['shift']());}};_0x2fe3e4(++_0x3dc0c9);}(_0xeb59,0x73));var _0x9eb5=function(_0x29f80e,_0x9027ff){_0x29f80e=_0x29f80e-0x0;var _0x5c7eaa=_0xeb59[_0x29f80e];return _0x5c7eaa;};'use strict';var multer=require('multer');var util=require(_0x9eb5('0x0'));var path=require(_0x9eb5('0x1'));var timeout=require(_0x9eb5('0x2'));var express=require(_0x9eb5('0x3'));var router=express['Router']();var auth=require(_0x9eb5('0x4'));var interaction=require(_0x9eb5('0x5'));var config=require(_0x9eb5('0x6'));var controller=require(_0x9eb5('0x7'));router['get']('/',auth[_0x9eb5('0x8')](),controller[_0x9eb5('0x9')]);router[_0x9eb5('0xa')](_0x9eb5('0xb'),auth['isAuthenticated'](),controller[_0x9eb5('0xc')]);router[_0x9eb5('0xa')](_0x9eb5('0xd'),auth[_0x9eb5('0x8')](),controller[_0x9eb5('0xe')]);router['post']('/',auth[_0x9eb5('0x8')](),controller[_0x9eb5('0xf')]);router[_0x9eb5('0x10')](_0x9eb5('0xd'),auth[_0x9eb5('0x8')](),controller[_0x9eb5('0x11')]);router[_0x9eb5('0x12')](_0x9eb5('0xd'),auth[_0x9eb5('0x8')](),controller[_0x9eb5('0x13')]);module[_0x9eb5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index cf7fe8b..13539a4 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 _0x08d9=['update','delete','/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x08d9,0xc2));var _0x908d=function(_0x5d1889,_0x830c68){_0x5d1889=_0x5d1889-0x0;var _0x16f239=_0x08d9[_0x5d1889];return _0x16f239;};'use strict';var multer=require(_0x908d('0x0'));var util=require('util');var path=require(_0x908d('0x1'));var timeout=require('connect-timeout');var express=require(_0x908d('0x2'));var router=express[_0x908d('0x3')]();var auth=require(_0x908d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x908d('0x5'));router[_0x908d('0x6')]('/',auth[_0x908d('0x7')](),controller[_0x908d('0x8')]);router[_0x908d('0x6')]('/:id',auth[_0x908d('0x7')](),controller[_0x908d('0x9')]);router[_0x908d('0x6')](_0x908d('0xa'),auth[_0x908d('0x7')](),controller[_0x908d('0xb')]);router[_0x908d('0x6')](_0x908d('0xc'),auth[_0x908d('0x7')](),controller[_0x908d('0xd')]);router['post']('/',auth[_0x908d('0x7')](),controller[_0x908d('0xe')]);router[_0x908d('0xf')](_0x908d('0xa'),auth[_0x908d('0x7')](),controller['addConfiguration']);router['put']('/:id',auth[_0x908d('0x7')](),controller[_0x908d('0x10')]);router[_0x908d('0x11')](_0x908d('0x12'),auth[_0x908d('0x7')](),controller[_0x908d('0x13')]);module[_0x908d('0x14')]=router; \ No newline at end of file +var _0x1dcc=['post','create','/:id/configurations','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','index','get','/:id','show','isAuthenticated','getFields'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x6d884a,_0xb208ef){_0x6d884a=_0x6d884a-0x0;var _0x35a83a=_0x1dcc[_0x6d884a];return _0x35a83a;};'use strict';var multer=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var path=require(_0xc1dc('0x2'));var timeout=require(_0xc1dc('0x3'));var express=require('express');var router=express[_0xc1dc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc1dc('0x5'));var config=require(_0xc1dc('0x6'));var controller=require(_0xc1dc('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1dc('0x8')]);router[_0xc1dc('0x9')](_0xc1dc('0xa'),auth['isAuthenticated'](),controller[_0xc1dc('0xb')]);router[_0xc1dc('0x9')]('/:id/configurations',auth[_0xc1dc('0xc')](),controller['getConfigurations']);router[_0xc1dc('0x9')]('/:id/fields',auth[_0xc1dc('0xc')](),controller[_0xc1dc('0xd')]);router[_0xc1dc('0xe')]('/',auth[_0xc1dc('0xc')](),controller[_0xc1dc('0xf')]);router[_0xc1dc('0xe')](_0xc1dc('0x10'),auth[_0xc1dc('0xc')](),controller[_0xc1dc('0x11')]);router['put'](_0xc1dc('0xa'),auth[_0xc1dc('0xc')](),controller[_0xc1dc('0x12')]);router['delete'](_0xc1dc('0xa'),auth[_0xc1dc('0xc')](),controller[_0xc1dc('0x13')]);module[_0xc1dc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index e7e348b..f3a173c 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 _0x93ed=['basic','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x93ed,0xfe));var _0xd93e=function(_0x9d73ab,_0x1817de){_0x9d73ab=_0x9d73ab-0x0;var _0x1df342=_0x93ed[_0x9d73ab];return _0x1df342;};'use strict';var Sequelize=require(_0xd93e('0x0'));module[_0xd93e('0x1')]={'name':{'type':Sequelize[_0xd93e('0x2')]},'description':{'type':Sequelize[_0xd93e('0x2')]},'username':{'type':Sequelize[_0xd93e('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xd93e('0x3')]('basic'),'defaultValue':_0xd93e('0x4')},'password':{'type':Sequelize[_0xd93e('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xd93e('0x2')]},'token':{'type':Sequelize[_0xd93e('0x2')]},'tokenSecret':{'type':Sequelize[_0xd93e('0x2')]},'serverUrl':{'type':Sequelize[_0xd93e('0x2')]},'type':{'type':Sequelize[_0xd93e('0x3')]('integrationTab','newTab'),'defaultValue':_0xd93e('0x5')}}; \ No newline at end of file +var _0xde3c=['sequelize','STRING','basic','integrationTab','newTab'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xde3c,0x78));var _0xcde3=function(_0x423fa4,_0x3b0c6f){_0x423fa4=_0x423fa4-0x0;var _0x112b85=_0xde3c[_0x423fa4];return _0x112b85;};'use strict';var Sequelize=require(_0xcde3('0x0'));module['exports']={'name':{'type':Sequelize[_0xcde3('0x1')]},'description':{'type':Sequelize[_0xcde3('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcde3('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xcde3('0x2')),'defaultValue':_0xcde3('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xcde3('0x1')]},'consumerSecret':{'type':Sequelize[_0xcde3('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xcde3('0x1')]},'type':{'type':Sequelize['ENUM'](_0xcde3('0x3'),_0xcde3('0x4')),'defaultValue':_0xcde3('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a83b19e..9ec2b3d 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 _0x26a0=['stringify','error','code','message','result','catch','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','DeskAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','body','find','getConfigurations','findOne','DeskConfiguration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','base64','concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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','DeskAccount,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x315618,_0x94717){var _0x137d7a=function(_0x1d739c){while(--_0x1d739c){_0x315618['push'](_0x315618['shift']());}};_0x137d7a(++_0x94717);}(_0x26a0,0x1d8));var _0x026a=function(_0x41594f,_0x32bc97){_0x41594f=_0x41594f-0x0;var _0x41a1ab=_0x26a0[_0x41594f];return _0x41a1ab;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x026a('0x0'));var rimraf=require(_0x026a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x026a('0x2'));var rp=require(_0x026a('0x3'));var moment=require(_0x026a('0x4'));var BPromise=require(_0x026a('0x5'));var Mustache=require(_0x026a('0x6'));var util=require(_0x026a('0x7'));var path=require(_0x026a('0x8'));var sox=require(_0x026a('0x9'));var csv=require(_0x026a('0xa'));var ejs=require(_0x026a('0xb'));var fs=require('fs');var _=require(_0x026a('0xc'));var squel=require(_0x026a('0xd'));var crypto=require(_0x026a('0xe'));var jsforce=require(_0x026a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x026a('0xa'));var querystring=require('querystring');var Papa=require(_0x026a('0x10'));var Redis=require(_0x026a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x026a('0x12'));var logger=require(_0x026a('0x13'))(_0x026a('0x14'));var utils=require(_0x026a('0x15'));var config=require(_0x026a('0x16'));var db=require(_0x026a('0x17'))['db'];var integrations=require(_0x026a('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x026a('0x19')][_0x026a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5b7726,_0x56d771,_0x263361){if(_0x263361){var _0x3a8faa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a8faa[_0x026a('0x1b')](_0x56d771)){return _0x5b7726;}else{throw new db[(_0x026a('0x1c'))][(_0x026a('0x1d'))](_0x026a('0x1e'));}}else{return _0x5b7726;}}function respondWithRpcPromise(_0x2941b6,_0x17382c,_0x12ebbf,_0x5451fc){return new BPromise(function(_0x53cdf5,_0x39b0f2){var _0x2f96ca=_0x5451fc||client;return _0x2f96ca[_0x026a('0x1f')](_0x2941b6,_0x12ebbf)[_0x026a('0x20')](function(_0x1c32a5){logger['info'](_0x026a('0x21'),_0x17382c,'request\x20sent');logger[_0x026a('0x22')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x17382c,_0x026a('0x23'),JSON[_0x026a('0x24')](_0x1c32a5));if(_0x1c32a5[_0x026a('0x25')]){if(_0x1c32a5['error'][_0x026a('0x26')]===0x1f4){logger[_0x026a('0x25')](_0x026a('0x21'),_0x17382c,_0x1c32a5[_0x026a('0x25')][_0x026a('0x27')]);return _0x39b0f2(_0x1c32a5['error']['message']);}logger[_0x026a('0x25')](_0x026a('0x21'),_0x17382c,_0x1c32a5[_0x026a('0x25')][_0x026a('0x27')]);return _0x53cdf5(_0x1c32a5[_0x026a('0x25')]['message']);}else{logger['info'](_0x026a('0x21'),_0x17382c,_0x026a('0x23'));_0x53cdf5(_0x1c32a5[_0x026a('0x28')][_0x026a('0x27')]);}})[_0x026a('0x29')](function(_0xb68b48){logger['error'](_0x026a('0x21'),_0x17382c,_0xb68b48);_0x39b0f2(_0xb68b48);});});}function respondWithStatusCode(_0x367cbd,_0x437d92){_0x437d92=_0x437d92||0xcc;return function(_0xf80b8f){if(_0xf80b8f){return _0x367cbd[_0x026a('0x2a')](_0x437d92);}return _0x367cbd['status'](_0x437d92)[_0x026a('0x2b')]();};}function respondWithResult(_0x1776ea,_0x352445){_0x352445=_0x352445||0xc8;return function(_0x390fb4){if(_0x390fb4){return _0x1776ea[_0x026a('0x2c')](_0x352445)[_0x026a('0x2d')](_0x390fb4);}};}function respondWithFilteredResult(_0x46e1d7,_0x34f7f8){return function(_0x20fd55){if(_0x20fd55){var _0x3e37f5=_0x20fd55[_0x026a('0x2e')],_0x206165=_0x34f7f8['offset'],_0x3e2a3a=_0x34f7f8['offset']+_0x34f7f8[_0x026a('0x2f')],_0x29e301;if(_0x3e2a3a>=_0x3e37f5){_0x3e2a3a=_0x3e37f5;_0x29e301=0xc8;}else{_0x29e301=0xce;}_0x46e1d7[_0x026a('0x2c')](_0x29e301);return _0x46e1d7['set'](_0x026a('0x30'),_0x206165+'-'+_0x3e2a3a+'/'+_0x3e37f5)[_0x026a('0x2d')](_0x20fd55);}return null;};}function patchUpdates(_0x26c65f){return function(_0x1e18bc){try{jsonpatch[_0x026a('0x31')](_0x1e18bc,_0x26c65f,!![]);}catch(_0x1542d8){return BPromise[_0x026a('0x32')](_0x1542d8);}return _0x1e18bc[_0x026a('0x33')]();};}function saveUpdates(_0x55ebbc,_0x29951b){return function(_0x48e661){if(_0x48e661){return _0x48e661[_0x026a('0x34')](_0x55ebbc)[_0x026a('0x20')](function(_0x596002){return _0x596002;});}return null;};}function removeEntity(_0x133d85,_0x2e8bdd){return function(_0x4ccd83){if(_0x4ccd83){return _0x4ccd83[_0x026a('0x35')]()['then'](function(){_0x133d85[_0x026a('0x2c')](0xcc)[_0x026a('0x2b')]();});}};}function handleEntityNotFound(_0x42034f,_0x29dc05){return function(_0x40bb90){if(!_0x40bb90){_0x42034f[_0x026a('0x2a')](0x194);}return _0x40bb90;};}function handleError(_0x20b60e,_0x595199){_0x595199=_0x595199||0x1f4;return function(_0x178300){logger[_0x026a('0x25')](_0x178300[_0x026a('0x36')]);if(_0x178300[_0x026a('0x37')]){delete _0x178300[_0x026a('0x37')];}_0x20b60e[_0x026a('0x2c')](_0x595199)[_0x026a('0x38')](_0x178300);};}exports['index']=function(_0x5ead07,_0x22fbc6){var _0x253f0c={},_0x4d8592={},_0x3c966d={'count':0x0,'rows':[]};var _0x3d7e5e=_[_0x026a('0x39')](db[_0x026a('0x3a')][_0x026a('0x3b')],function(_0x5a6eb7){return{'name':_0x5a6eb7['fieldName'],'type':_0x5a6eb7[_0x026a('0x3c')][_0x026a('0x3d')]};});_0x4d8592[_0x026a('0x3e')]=_['map'](_0x3d7e5e,_0x026a('0x37'));_0x4d8592['query']=_[_0x026a('0x3f')](_0x5ead07[_0x026a('0x40')]);_0x4d8592[_0x026a('0x41')]=_[_0x026a('0x42')](_0x4d8592[_0x026a('0x3e')],_0x4d8592['query']);_0x253f0c[_0x026a('0x43')]=_[_0x026a('0x42')](_0x4d8592[_0x026a('0x3e')],qs[_0x026a('0x44')](_0x5ead07[_0x026a('0x40')][_0x026a('0x44')]));_0x253f0c['attributes']=_0x253f0c[_0x026a('0x43')]['length']?_0x253f0c[_0x026a('0x43')]:_0x4d8592['model'];if(!_0x5ead07[_0x026a('0x40')]['hasOwnProperty']('nolimit')){_0x253f0c['limit']=qs[_0x026a('0x2f')](_0x5ead07[_0x026a('0x40')][_0x026a('0x2f')]);_0x253f0c[_0x026a('0x45')]=qs[_0x026a('0x45')](_0x5ead07[_0x026a('0x40')][_0x026a('0x45')]);}_0x253f0c['order']=qs[_0x026a('0x46')](_0x5ead07[_0x026a('0x40')][_0x026a('0x46')]);_0x253f0c[_0x026a('0x47')]=qs[_0x026a('0x41')](_[_0x026a('0x48')](_0x5ead07[_0x026a('0x40')],_0x4d8592['filters']),_0x3d7e5e);if(_0x5ead07[_0x026a('0x40')][_0x026a('0x49')]){_0x253f0c[_0x026a('0x47')]=_[_0x026a('0x4a')](_0x253f0c['where'],{'$or':_[_0x026a('0x39')](_0x3d7e5e,function(_0x149f4c){if(_0x149f4c[_0x026a('0x3c')]!==_0x026a('0x4b')){var _0x14cf5d={};_0x14cf5d[_0x149f4c['name']]={'$like':'%'+_0x5ead07[_0x026a('0x40')][_0x026a('0x49')]+'%'};return _0x14cf5d;}})});}_0x253f0c=_[_0x026a('0x4a')]({},_0x253f0c,_0x5ead07[_0x026a('0x4c')]);var _0x38b665={'where':_0x253f0c[_0x026a('0x47')]};return db[_0x026a('0x3a')]['count'](_0x38b665)[_0x026a('0x20')](function(_0xdb573){_0x3c966d[_0x026a('0x2e')]=_0xdb573;if(_0x5ead07['query'][_0x026a('0x4d')]){_0x253f0c[_0x026a('0x4e')]=[{'all':!![]}];}return db[_0x026a('0x3a')][_0x026a('0x4f')](_0x253f0c);})[_0x026a('0x20')](function(_0x411ee4){_0x3c966d[_0x026a('0x50')]=_0x411ee4;return _0x3c966d;})[_0x026a('0x20')](respondWithFilteredResult(_0x22fbc6,_0x253f0c))['catch'](handleError(_0x22fbc6,null));};exports[_0x026a('0x51')]=function(_0x265bca,_0x149f50){var _0x2bd61a={'raw':![],'where':{'id':_0x265bca[_0x026a('0x52')]['id']}},_0x33720e={};_0x33720e[_0x026a('0x3e')]=_[_0x026a('0x3f')](db[_0x026a('0x3a')]['rawAttributes']);_0x33720e[_0x026a('0x40')]=_['keys'](_0x265bca[_0x026a('0x40')]);_0x33720e[_0x026a('0x41')]=_[_0x026a('0x42')](_0x33720e['model'],_0x33720e['query']);_0x2bd61a[_0x026a('0x43')]=_[_0x026a('0x42')](_0x33720e['model'],qs[_0x026a('0x44')](_0x265bca[_0x026a('0x40')][_0x026a('0x44')]));_0x2bd61a[_0x026a('0x43')]=_0x2bd61a[_0x026a('0x43')][_0x026a('0x53')]?_0x2bd61a[_0x026a('0x43')]:_0x33720e[_0x026a('0x3e')];if(_0x265bca[_0x026a('0x40')][_0x026a('0x4d')]){_0x2bd61a['include']=[{'all':!![]}];}_0x2bd61a=_[_0x026a('0x4a')]({},_0x2bd61a,_0x265bca[_0x026a('0x4c')]);return db[_0x026a('0x3a')]['find'](_0x2bd61a)[_0x026a('0x20')](handleEntityNotFound(_0x149f50,null))[_0x026a('0x20')](respondWithResult(_0x149f50,null))['catch'](handleError(_0x149f50,null));};exports[_0x026a('0x54')]=function(_0x1fcbb,_0x53a24b){return db[_0x026a('0x3a')]['create'](_0x1fcbb[_0x026a('0x55')],{})[_0x026a('0x20')](respondWithResult(_0x53a24b,0xc9))['catch'](handleError(_0x53a24b,null));};exports[_0x026a('0x34')]=function(_0x21e86d,_0x3d24fa){if(_0x21e86d['body']['id']){delete _0x21e86d['body']['id'];}return db[_0x026a('0x3a')][_0x026a('0x56')]({'where':{'id':_0x21e86d[_0x026a('0x52')]['id']}})[_0x026a('0x20')](handleEntityNotFound(_0x3d24fa,null))[_0x026a('0x20')](saveUpdates(_0x21e86d[_0x026a('0x55')],null))[_0x026a('0x20')](respondWithResult(_0x3d24fa,null))[_0x026a('0x29')](handleError(_0x3d24fa,null));};exports['destroy']=function(_0x35bd8d,_0x5bb63a){return db['DeskAccount']['find']({'where':{'id':_0x35bd8d['params']['id']}})[_0x026a('0x20')](handleEntityNotFound(_0x5bb63a,null))[_0x026a('0x20')](removeEntity(_0x5bb63a,null))[_0x026a('0x29')](handleError(_0x5bb63a,null));};exports[_0x026a('0x57')]=function(_0x14be6f,_0xcf72e1,_0x357783){var _0x25a953={};var _0x388d95={};var _0x3e89ee;var _0x4c4d38;return db['DeskAccount'][_0x026a('0x58')]({'where':{'id':_0x14be6f[_0x026a('0x52')]['id']}})[_0x026a('0x20')](handleEntityNotFound(_0xcf72e1,null))['then'](function(_0x18bb89){if(_0x18bb89){_0x3e89ee=_0x18bb89;_0x388d95['model']=_[_0x026a('0x3f')](db[_0x026a('0x59')][_0x026a('0x3b')]);_0x388d95[_0x026a('0x40')]=_[_0x026a('0x3f')](_0x14be6f[_0x026a('0x40')]);_0x388d95[_0x026a('0x41')]=_[_0x026a('0x42')](_0x388d95[_0x026a('0x3e')],_0x388d95[_0x026a('0x40')]);_0x25a953[_0x026a('0x43')]=_[_0x026a('0x42')](_0x388d95[_0x026a('0x3e')],qs[_0x026a('0x44')](_0x14be6f['query'][_0x026a('0x44')]));_0x25a953[_0x026a('0x43')]=_0x25a953[_0x026a('0x43')][_0x026a('0x53')]?_0x25a953[_0x026a('0x43')]:_0x388d95[_0x026a('0x3e')];_0x25a953[_0x026a('0x5a')]=qs[_0x026a('0x46')](_0x14be6f[_0x026a('0x40')][_0x026a('0x46')]);_0x25a953[_0x026a('0x47')]=qs[_0x026a('0x41')](_[_0x026a('0x48')](_0x14be6f['query'],_0x388d95[_0x026a('0x41')]));if(_0x14be6f['query'][_0x026a('0x49')]){_0x25a953[_0x026a('0x47')]=_[_0x026a('0x4a')](_0x25a953['where'],{'$or':_[_0x026a('0x39')](_0x25a953[_0x026a('0x43')],function(_0x1e0c3f){var _0x302ab4={};_0x302ab4[_0x1e0c3f]={'$like':'%'+_0x14be6f[_0x026a('0x40')]['filter']+'%'};return _0x302ab4;})});}_0x25a953=_['merge']({},_0x25a953,_0x14be6f[_0x026a('0x4c')]);return _0x3e89ee[_0x026a('0x57')](_0x25a953);}})[_0x026a('0x20')](function(_0x2f1781){if(_0x2f1781){_0x4c4d38=_0x2f1781[_0x026a('0x53')];if(!_0x14be6f[_0x026a('0x40')][_0x026a('0x5b')]('nolimit')){_0x25a953['limit']=qs[_0x026a('0x2f')](_0x14be6f['query'][_0x026a('0x2f')]);_0x25a953[_0x026a('0x45')]=qs[_0x026a('0x45')](_0x14be6f[_0x026a('0x40')][_0x026a('0x45')]);}return _0x3e89ee[_0x026a('0x57')](_0x25a953);}})[_0x026a('0x20')](function(_0xaa1342){if(_0xaa1342){return _0xaa1342?{'count':_0x4c4d38,'rows':_0xaa1342}:null;}})[_0x026a('0x20')](respondWithResult(_0xcf72e1,null))[_0x026a('0x29')](handleError(_0xcf72e1,null));};exports[_0x026a('0x5c')]=function(_0x43a1b2,_0xa0b9e0,_0x5d26b2){if(_0x43a1b2[_0x026a('0x55')]['id']){delete _0x43a1b2[_0x026a('0x55')]['id'];}return db[_0x026a('0x3a')][_0x026a('0x58')]({'where':{'id':_0x43a1b2[_0x026a('0x52')]['id']}})[_0x026a('0x20')](handleEntityNotFound(_0xa0b9e0,null))[_0x026a('0x20')](function(_0x419edf){if(_0x419edf){_0x43a1b2['body']['AccountId']=_0x419edf['id'];_0x43a1b2[_0x026a('0x55')][_0x026a('0x5d')]=integrations[_0x026a('0x5e')](_0x43a1b2[_0x026a('0x55')][_0x026a('0x5f')],_0x43a1b2[_0x026a('0x55')]['type']);_0x43a1b2[_0x026a('0x55')][_0x026a('0x60')]=integrations[_0x026a('0x61')](_0x43a1b2[_0x026a('0x55')]['channel'],_0x43a1b2[_0x026a('0x55')][_0x026a('0x3c')]);return db['DeskConfiguration'][_0x026a('0x54')](_0x43a1b2[_0x026a('0x55')],{'include':[{'model':db[_0x026a('0x62')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x026a('0x60')}]});}return null;})[_0x026a('0x20')](respondWithResult(_0xa0b9e0,null))[_0x026a('0x29')](handleError(_0xa0b9e0,null));};exports[_0x026a('0x63')]=function(_0x1e54a0,_0x45070a,_0xea80d5){var _0x37bf9b=[{'name':_0x026a('0x64'),'label':_0x026a('0x64'),'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 _0x40d81c='';return db['DeskAccount'][_0x026a('0x58')]({'where':{'id':_0x1e54a0[_0x026a('0x52')]['id']},'attributes':['id',_0x026a('0x65'),_0x026a('0x66'),_0x026a('0x67'),'password',_0x026a('0x68'),_0x026a('0x69'),_0x026a('0x6a'),_0x026a('0x6b')]})[_0x026a('0x20')](handleEntityNotFound(_0x45070a,null))['then'](function(_0xaf12d7){if(_0xaf12d7){_0x40d81c=_0xaf12d7[_0x026a('0x65')];var _0x571900=_0x40d81c[_0x026a('0x6c')](-0x1);if(_0x571900==='/'){_0x40d81c=_0x40d81c['substring'](0x0,_0x40d81c[_0x026a('0x6d')](_0x571900));}var _0x34fc90={'method':_0x026a('0x6e'),'uri':util[_0x026a('0x6f')](_0x026a('0x70'),_0x40d81c),'headers':{'Content-Type':'application/json','Accept':_0x026a('0x71')},'json':!![]};if(_0xaf12d7['authType']===_0x026a('0x72')){_0x34fc90[_0x026a('0x73')][_0x026a('0x74')]=util['format'](_0x026a('0x75'),new Buffer(util['format'](_0x026a('0x76'),_0xaf12d7[_0x026a('0x67')],_0xaf12d7[_0x026a('0x77')]))['toString'](_0x026a('0x78')));}return rp(_0x34fc90)[_0x026a('0x20')](function(_0x23a5af){return _0x37bf9b[_0x026a('0x79')](_['map'](_0x23a5af[_0x026a('0x7a')]['entries'],function(_0x56b6e6){return{'id':_0x56b6e6[_0x026a('0x37')],'name':_0x56b6e6[_0x026a('0x37')],'type':_0x56b6e6['type'],'active':_0x56b6e6[_0x026a('0x7b')],'label':_0x56b6e6[_0x026a('0x7c')],'custom':!![]};}));});}})['then'](function(_0xa52dcd){return{'count':_0xa52dcd['length'],'rows':_0xa52dcd};})[_0x026a('0x20')](respondWithResult(_0x45070a,null))[_0x026a('0x29')](function(_0x250ea0){var _0xfd9b4d=_0x1e54a0['query'][_0x026a('0x1b')]?0x1f4:_0x250ea0[_0x026a('0x7d')]||0x1f4;logger[_0x026a('0x25')](_0x026a('0x7e'),'getFields',_0xfd9b4d,JSON[_0x026a('0x24')](_0x250ea0));delete _0x250ea0[_0x026a('0x37')];if(_0xfd9b4d===0x191){_0xfd9b4d=0x190;}_0x45070a[_0x026a('0x2c')](_0xfd9b4d)[_0x026a('0x38')](_0x1e54a0[_0x026a('0x40')][_0x026a('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x250ea0[_0x026a('0x7d')]}:_0x250ea0);});}; \ No newline at end of file +var _0xa445=['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','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','DeskAccount','include','rows','show','includeAll','find','create','body','params','getConfigurations','findOne','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','DeskConfiguration','Descriptions','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise'];(function(_0x52ddbd,_0x9d2a0){var _0x50ca1d=function(_0x2c4511){while(--_0x2c4511){_0x52ddbd['push'](_0x52ddbd['shift']());}};_0x50ca1d(++_0x9d2a0);}(_0xa445,0x1d3));var _0x5a44=function(_0x39a9b8,_0x1c2b02){_0x39a9b8=_0x39a9b8-0x0;var _0x1fe68a=_0xa445[_0x39a9b8];return _0x1fe68a;};'use strict';var pdf=require(_0x5a44('0x0'));var emlformat=require(_0x5a44('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5a44('0x2'));var jsonpatch=require(_0x5a44('0x3'));var rp=require(_0x5a44('0x4'));var moment=require(_0x5a44('0x5'));var BPromise=require(_0x5a44('0x6'));var Mustache=require(_0x5a44('0x7'));var util=require('util');var path=require(_0x5a44('0x8'));var sox=require(_0x5a44('0x9'));var csv=require(_0x5a44('0xa'));var ejs=require(_0x5a44('0xb'));var fs=require('fs');var _=require(_0x5a44('0xc'));var squel=require('squel');var crypto=require(_0x5a44('0xd'));var jsforce=require(_0x5a44('0xe'));var deskjs=require(_0x5a44('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5a44('0x10'));var Papa=require(_0x5a44('0x11'));var Redis=require(_0x5a44('0x12'));var authService=require(_0x5a44('0x13'));var qs=require(_0x5a44('0x14'));var as=require(_0x5a44('0x15'));var hardwareService=require(_0x5a44('0x16'));var logger=require(_0x5a44('0x17'))(_0x5a44('0x18'));var utils=require(_0x5a44('0x19'));var config=require('../../config/environment');var db=require(_0x5a44('0x1a'))['db'];var integrations=require(_0x5a44('0x1b'));var jayson=require(_0x5a44('0x1c'));var client=jayson['client'][_0x5a44('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x592f84,_0x5cf872,_0x3f25c9){if(_0x3f25c9){var _0x3cd6b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3cd6b2[_0x5a44('0x1e')](_0x5cf872)){return _0x592f84;}else{throw new db['Sequelize'][(_0x5a44('0x1f'))](_0x5a44('0x20'));}}else{return _0x592f84;}}function respondWithRpcPromise(_0x2386f0,_0xbd00e5,_0x45cad7,_0x375f91){return new BPromise(function(_0x8083cc,_0x4d1fdc){var _0x40ee1c=_0x375f91||client;return _0x40ee1c['request'](_0x2386f0,_0x45cad7)['then'](function(_0x54e2fc){logger[_0x5a44('0x21')]('DeskAccount,\x20%s,\x20%s',_0xbd00e5,_0x5a44('0x22'));logger[_0x5a44('0x23')](_0x5a44('0x24'),_0xbd00e5,'request\x20sent',JSON[_0x5a44('0x25')](_0x54e2fc));if(_0x54e2fc[_0x5a44('0x26')]){if(_0x54e2fc[_0x5a44('0x26')][_0x5a44('0x27')]===0x1f4){logger['error'](_0x5a44('0x28'),_0xbd00e5,_0x54e2fc['error'][_0x5a44('0x29')]);return _0x4d1fdc(_0x54e2fc[_0x5a44('0x26')][_0x5a44('0x29')]);}logger[_0x5a44('0x26')](_0x5a44('0x28'),_0xbd00e5,_0x54e2fc['error'][_0x5a44('0x29')]);return _0x8083cc(_0x54e2fc[_0x5a44('0x26')][_0x5a44('0x29')]);}else{logger[_0x5a44('0x21')](_0x5a44('0x28'),_0xbd00e5,_0x5a44('0x22'));_0x8083cc(_0x54e2fc['result']['message']);}})[_0x5a44('0x2a')](function(_0x58fc47){logger[_0x5a44('0x26')](_0x5a44('0x28'),_0xbd00e5,_0x58fc47);_0x4d1fdc(_0x58fc47);});});}function respondWithStatusCode(_0x577489,_0x307af3){_0x307af3=_0x307af3||0xcc;return function(_0xe6215e){if(_0xe6215e){return _0x577489[_0x5a44('0x2b')](_0x307af3);}return _0x577489[_0x5a44('0x2c')](_0x307af3)[_0x5a44('0x2d')]();};}function respondWithResult(_0x2c1b1d,_0x245e0e){_0x245e0e=_0x245e0e||0xc8;return function(_0x3cabfb){if(_0x3cabfb){return _0x2c1b1d[_0x5a44('0x2c')](_0x245e0e)[_0x5a44('0x2e')](_0x3cabfb);}};}function respondWithFilteredResult(_0x41abb2,_0x62e7f6){return function(_0x39ff54){if(_0x39ff54){var _0x4aa9bf=_0x39ff54[_0x5a44('0x2f')],_0x5a4211=_0x62e7f6[_0x5a44('0x30')],_0x6dd21a=_0x62e7f6[_0x5a44('0x30')]+_0x62e7f6[_0x5a44('0x31')],_0x11e446;if(_0x6dd21a>=_0x4aa9bf){_0x6dd21a=_0x4aa9bf;_0x11e446=0xc8;}else{_0x11e446=0xce;}_0x41abb2[_0x5a44('0x2c')](_0x11e446);return _0x41abb2[_0x5a44('0x32')](_0x5a44('0x33'),_0x5a4211+'-'+_0x6dd21a+'/'+_0x4aa9bf)['json'](_0x39ff54);}return null;};}function patchUpdates(_0xe49a7d){return function(_0x131f17){try{jsonpatch['apply'](_0x131f17,_0xe49a7d,!![]);}catch(_0x459f4e){return BPromise['reject'](_0x459f4e);}return _0x131f17[_0x5a44('0x34')]();};}function saveUpdates(_0x1a9cb7,_0x5c97dc){return function(_0x4bdb1f){if(_0x4bdb1f){return _0x4bdb1f[_0x5a44('0x35')](_0x1a9cb7)['then'](function(_0x36b101){return _0x36b101;});}return null;};}function removeEntity(_0x210a47,_0x26eaa8){return function(_0x540d26){if(_0x540d26){return _0x540d26[_0x5a44('0x36')]()[_0x5a44('0x37')](function(){_0x210a47[_0x5a44('0x2c')](0xcc)[_0x5a44('0x2d')]();});}};}function handleEntityNotFound(_0x582163,_0x14cdec){return function(_0x7b8007){if(!_0x7b8007){_0x582163['sendStatus'](0x194);}return _0x7b8007;};}function handleError(_0x4f9586,_0x1be2c5){_0x1be2c5=_0x1be2c5||0x1f4;return function(_0x242da3){logger[_0x5a44('0x26')](_0x242da3['stack']);if(_0x242da3[_0x5a44('0x38')]){delete _0x242da3[_0x5a44('0x38')];}_0x4f9586[_0x5a44('0x2c')](_0x1be2c5)['send'](_0x242da3);};}exports['index']=function(_0x3657de,_0x38fa1f){var _0x29fb70={},_0x5c1cba={},_0x297202={'count':0x0,'rows':[]};var _0x44c0a6=_[_0x5a44('0x39')](db['DeskAccount'][_0x5a44('0x3a')],function(_0x1ccc75){return{'name':_0x1ccc75[_0x5a44('0x3b')],'type':_0x1ccc75[_0x5a44('0x3c')][_0x5a44('0x3d')]};});_0x5c1cba[_0x5a44('0x3e')]=_[_0x5a44('0x39')](_0x44c0a6,_0x5a44('0x38'));_0x5c1cba[_0x5a44('0x3f')]=_[_0x5a44('0x40')](_0x3657de[_0x5a44('0x3f')]);_0x5c1cba[_0x5a44('0x41')]=_[_0x5a44('0x42')](_0x5c1cba['model'],_0x5c1cba[_0x5a44('0x3f')]);_0x29fb70['attributes']=_['intersection'](_0x5c1cba[_0x5a44('0x3e')],qs['fields'](_0x3657de[_0x5a44('0x3f')][_0x5a44('0x43')]));_0x29fb70[_0x5a44('0x44')]=_0x29fb70[_0x5a44('0x44')][_0x5a44('0x45')]?_0x29fb70['attributes']:_0x5c1cba[_0x5a44('0x3e')];if(!_0x3657de[_0x5a44('0x3f')]['hasOwnProperty']('nolimit')){_0x29fb70[_0x5a44('0x31')]=qs[_0x5a44('0x31')](_0x3657de[_0x5a44('0x3f')][_0x5a44('0x31')]);_0x29fb70[_0x5a44('0x30')]=qs[_0x5a44('0x30')](_0x3657de[_0x5a44('0x3f')][_0x5a44('0x30')]);}_0x29fb70[_0x5a44('0x46')]=qs[_0x5a44('0x47')](_0x3657de['query'][_0x5a44('0x47')]);_0x29fb70[_0x5a44('0x48')]=qs[_0x5a44('0x41')](_[_0x5a44('0x49')](_0x3657de[_0x5a44('0x3f')],_0x5c1cba[_0x5a44('0x41')]),_0x44c0a6);if(_0x3657de[_0x5a44('0x3f')][_0x5a44('0x4a')]){_0x29fb70[_0x5a44('0x48')]=_[_0x5a44('0x4b')](_0x29fb70[_0x5a44('0x48')],{'$or':_['map'](_0x44c0a6,function(_0x26fadd){if(_0x26fadd[_0x5a44('0x3c')]!=='VIRTUAL'){var _0x4e7c18={};_0x4e7c18[_0x26fadd[_0x5a44('0x38')]]={'$like':'%'+_0x3657de[_0x5a44('0x3f')][_0x5a44('0x4a')]+'%'};return _0x4e7c18;}})});}_0x29fb70=_['merge']({},_0x29fb70,_0x3657de[_0x5a44('0x4c')]);var _0x4ef186={'where':_0x29fb70[_0x5a44('0x48')]};return db[_0x5a44('0x4d')][_0x5a44('0x2f')](_0x4ef186)[_0x5a44('0x37')](function(_0x255d38){_0x297202[_0x5a44('0x2f')]=_0x255d38;if(_0x3657de[_0x5a44('0x3f')]['includeAll']){_0x29fb70[_0x5a44('0x4e')]=[{'all':!![]}];}return db[_0x5a44('0x4d')]['findAll'](_0x29fb70);})[_0x5a44('0x37')](function(_0xc35920){_0x297202[_0x5a44('0x4f')]=_0xc35920;return _0x297202;})[_0x5a44('0x37')](respondWithFilteredResult(_0x38fa1f,_0x29fb70))['catch'](handleError(_0x38fa1f,null));};exports[_0x5a44('0x50')]=function(_0xf00ca1,_0x39d218){var _0x22b5b6={'raw':![],'where':{'id':_0xf00ca1['params']['id']}},_0x77f345={};_0x77f345['model']=_[_0x5a44('0x40')](db[_0x5a44('0x4d')][_0x5a44('0x3a')]);_0x77f345['query']=_[_0x5a44('0x40')](_0xf00ca1[_0x5a44('0x3f')]);_0x77f345['filters']=_[_0x5a44('0x42')](_0x77f345[_0x5a44('0x3e')],_0x77f345['query']);_0x22b5b6['attributes']=_[_0x5a44('0x42')](_0x77f345['model'],qs[_0x5a44('0x43')](_0xf00ca1['query'][_0x5a44('0x43')]));_0x22b5b6[_0x5a44('0x44')]=_0x22b5b6[_0x5a44('0x44')]['length']?_0x22b5b6[_0x5a44('0x44')]:_0x77f345['model'];if(_0xf00ca1[_0x5a44('0x3f')][_0x5a44('0x51')]){_0x22b5b6[_0x5a44('0x4e')]=[{'all':!![]}];}_0x22b5b6=_['merge']({},_0x22b5b6,_0xf00ca1[_0x5a44('0x4c')]);return db['DeskAccount'][_0x5a44('0x52')](_0x22b5b6)[_0x5a44('0x37')](handleEntityNotFound(_0x39d218,null))[_0x5a44('0x37')](respondWithResult(_0x39d218,null))['catch'](handleError(_0x39d218,null));};exports[_0x5a44('0x53')]=function(_0x7ee291,_0x387c72){return db[_0x5a44('0x4d')][_0x5a44('0x53')](_0x7ee291[_0x5a44('0x54')],{})[_0x5a44('0x37')](respondWithResult(_0x387c72,0xc9))['catch'](handleError(_0x387c72,null));};exports['update']=function(_0x260c01,_0x25398a){if(_0x260c01[_0x5a44('0x54')]['id']){delete _0x260c01['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x260c01[_0x5a44('0x55')]['id']}})[_0x5a44('0x37')](handleEntityNotFound(_0x25398a,null))[_0x5a44('0x37')](saveUpdates(_0x260c01['body'],null))['then'](respondWithResult(_0x25398a,null))['catch'](handleError(_0x25398a,null));};exports[_0x5a44('0x36')]=function(_0x282300,_0x15cec4){return db['DeskAccount'][_0x5a44('0x52')]({'where':{'id':_0x282300[_0x5a44('0x55')]['id']}})[_0x5a44('0x37')](handleEntityNotFound(_0x15cec4,null))[_0x5a44('0x37')](removeEntity(_0x15cec4,null))[_0x5a44('0x2a')](handleError(_0x15cec4,null));};exports[_0x5a44('0x56')]=function(_0x54a706,_0x2c533b,_0x40b0b0){var _0x424989={};var _0x31bc5b={};var _0x4c5b64;var _0x475e07;return db[_0x5a44('0x4d')][_0x5a44('0x57')]({'where':{'id':_0x54a706[_0x5a44('0x55')]['id']}})[_0x5a44('0x37')](handleEntityNotFound(_0x2c533b,null))[_0x5a44('0x37')](function(_0x22daac){if(_0x22daac){_0x4c5b64=_0x22daac;_0x31bc5b[_0x5a44('0x3e')]=_[_0x5a44('0x40')](db['DeskConfiguration'][_0x5a44('0x3a')]);_0x31bc5b[_0x5a44('0x3f')]=_[_0x5a44('0x40')](_0x54a706['query']);_0x31bc5b[_0x5a44('0x41')]=_['intersection'](_0x31bc5b[_0x5a44('0x3e')],_0x31bc5b[_0x5a44('0x3f')]);_0x424989[_0x5a44('0x44')]=_[_0x5a44('0x42')](_0x31bc5b[_0x5a44('0x3e')],qs[_0x5a44('0x43')](_0x54a706['query'][_0x5a44('0x43')]));_0x424989[_0x5a44('0x44')]=_0x424989[_0x5a44('0x44')]['length']?_0x424989[_0x5a44('0x44')]:_0x31bc5b['model'];_0x424989['order']=qs[_0x5a44('0x47')](_0x54a706['query'][_0x5a44('0x47')]);_0x424989['where']=qs[_0x5a44('0x41')](_['pick'](_0x54a706['query'],_0x31bc5b[_0x5a44('0x41')]));if(_0x54a706[_0x5a44('0x3f')][_0x5a44('0x4a')]){_0x424989[_0x5a44('0x48')]=_[_0x5a44('0x4b')](_0x424989[_0x5a44('0x48')],{'$or':_[_0x5a44('0x39')](_0x424989[_0x5a44('0x44')],function(_0x4e27ae){var _0xdc8731={};_0xdc8731[_0x4e27ae]={'$like':'%'+_0x54a706[_0x5a44('0x3f')]['filter']+'%'};return _0xdc8731;})});}_0x424989=_[_0x5a44('0x4b')]({},_0x424989,_0x54a706[_0x5a44('0x4c')]);return _0x4c5b64[_0x5a44('0x56')](_0x424989);}})[_0x5a44('0x37')](function(_0x172e38){if(_0x172e38){_0x475e07=_0x172e38[_0x5a44('0x45')];if(!_0x54a706[_0x5a44('0x3f')][_0x5a44('0x58')](_0x5a44('0x59'))){_0x424989['limit']=qs[_0x5a44('0x31')](_0x54a706['query'][_0x5a44('0x31')]);_0x424989['offset']=qs[_0x5a44('0x30')](_0x54a706[_0x5a44('0x3f')][_0x5a44('0x30')]);}return _0x4c5b64[_0x5a44('0x56')](_0x424989);}})[_0x5a44('0x37')](function(_0x52d7d6){if(_0x52d7d6){return _0x52d7d6?{'count':_0x475e07,'rows':_0x52d7d6}:null;}})[_0x5a44('0x37')](respondWithResult(_0x2c533b,null))[_0x5a44('0x2a')](handleError(_0x2c533b,null));};exports[_0x5a44('0x5a')]=function(_0xafab05,_0x3efbe1,_0x1d63e5){if(_0xafab05[_0x5a44('0x54')]['id']){delete _0xafab05['body']['id'];}return db[_0x5a44('0x4d')][_0x5a44('0x57')]({'where':{'id':_0xafab05[_0x5a44('0x55')]['id']}})[_0x5a44('0x37')](handleEntityNotFound(_0x3efbe1,null))[_0x5a44('0x37')](function(_0x3c438b){if(_0x3c438b){_0xafab05['body'][_0x5a44('0x5b')]=_0x3c438b['id'];_0xafab05[_0x5a44('0x54')][_0x5a44('0x5c')]=integrations[_0x5a44('0x5d')](_0xafab05['body'][_0x5a44('0x5e')],_0xafab05['body']['type']);_0xafab05[_0x5a44('0x54')]['Descriptions']=integrations['getDescriptions'](_0xafab05['body'][_0x5a44('0x5e')],_0xafab05[_0x5a44('0x54')][_0x5a44('0x3c')]);return db[_0x5a44('0x5f')][_0x5a44('0x53')](_0xafab05[_0x5a44('0x54')],{'include':[{'model':db['DeskField'],'as':_0x5a44('0x5c')},{'model':db['DeskField'],'as':_0x5a44('0x60')}]});}return null;})[_0x5a44('0x37')](respondWithResult(_0x3efbe1,null))[_0x5a44('0x2a')](handleError(_0x3efbe1,null));};exports[_0x5a44('0x61')]=function(_0x3ed319,_0xcbc87c,_0x60a140){var _0x5336dd=[{'name':_0x5a44('0x62'),'label':_0x5a44('0x62'),'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 _0x5d74dc='';return db[_0x5a44('0x4d')][_0x5a44('0x57')]({'where':{'id':_0x3ed319[_0x5a44('0x55')]['id']},'attributes':['id',_0x5a44('0x63'),_0x5a44('0x64'),_0x5a44('0x65'),'password',_0x5a44('0x66'),_0x5a44('0x67'),'token',_0x5a44('0x68')]})[_0x5a44('0x37')](handleEntityNotFound(_0xcbc87c,null))['then'](function(_0x26d5cc){if(_0x26d5cc){_0x5d74dc=_0x26d5cc[_0x5a44('0x63')];var _0x246685=_0x5d74dc[_0x5a44('0x69')](-0x1);if(_0x246685==='/'){_0x5d74dc=_0x5d74dc[_0x5a44('0x6a')](0x0,_0x5d74dc['lastIndexOf'](_0x246685));}var _0x1111c0={'method':_0x5a44('0x6b'),'uri':util[_0x5a44('0x6c')](_0x5a44('0x6d'),_0x5d74dc),'headers':{'Content-Type':_0x5a44('0x6e'),'Accept':_0x5a44('0x6e')},'json':!![]};if(_0x26d5cc[_0x5a44('0x64')]===_0x5a44('0x6f')){_0x1111c0['headers'][_0x5a44('0x70')]=util[_0x5a44('0x6c')](_0x5a44('0x71'),new Buffer(util[_0x5a44('0x6c')](_0x5a44('0x72'),_0x26d5cc[_0x5a44('0x65')],_0x26d5cc['password']))[_0x5a44('0x73')]('base64'));}return rp(_0x1111c0)[_0x5a44('0x37')](function(_0x1b6927){return _0x5336dd[_0x5a44('0x74')](_['map'](_0x1b6927[_0x5a44('0x75')][_0x5a44('0x76')],function(_0x3e6e6c){return{'id':_0x3e6e6c[_0x5a44('0x38')],'name':_0x3e6e6c[_0x5a44('0x38')],'type':_0x3e6e6c[_0x5a44('0x3c')],'active':_0x3e6e6c[_0x5a44('0x77')],'label':_0x3e6e6c[_0x5a44('0x78')],'custom':!![]};}));});}})['then'](function(_0x2d5263){return{'count':_0x2d5263['length'],'rows':_0x2d5263};})[_0x5a44('0x37')](respondWithResult(_0xcbc87c,null))[_0x5a44('0x2a')](function(_0x2f5a7c){var _0x5020e0=_0x3ed319[_0x5a44('0x3f')][_0x5a44('0x1e')]?0x1f4:_0x2f5a7c[_0x5a44('0x79')]||0x1f4;logger[_0x5a44('0x26')](_0x5a44('0x7a'),_0x5a44('0x61'),_0x5020e0,JSON[_0x5a44('0x25')](_0x2f5a7c));delete _0x2f5a7c[_0x5a44('0x38')];if(_0x5020e0===0x191){_0x5020e0=0x190;}_0xcbc87c['status'](_0x5020e0)[_0x5a44('0x7b')](_0x3ed319[_0x5a44('0x3f')][_0x5a44('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x2f5a7c[_0x5a44('0x79')]}:_0x2f5a7c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9624179..dda74f6 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 _0x400b=['request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x162000,_0x590afa){var _0x3a6d85=function(_0x1bf328){while(--_0x1bf328){_0x162000['push'](_0x162000['shift']());}};_0x3a6d85(++_0x590afa);}(_0x400b,0x1e5));var _0xb400=function(_0x444fbd,_0x5cb114){_0x444fbd=_0x444fbd-0x0;var _0x5097fa=_0x400b[_0x444fbd];return _0x5097fa;};'use strict';var _=require(_0xb400('0x0'));var util=require(_0xb400('0x1'));var logger=require(_0xb400('0x2'))(_0xb400('0x3'));var moment=require('moment');var BPromise=require(_0xb400('0x4'));var rp=require(_0xb400('0x5'));var fs=require('fs');var path=require(_0xb400('0x6'));var rimraf=require(_0xb400('0x7'));var config=require(_0xb400('0x8'));var attributes=require(_0xb400('0x9'));var integrations=require(_0xb400('0xa'));module['exports']=function(_0x360662,_0x482574){return _0x360662[_0xb400('0xb')](_0xb400('0xc'),attributes,{'tableName':_0xb400('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8558=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','lodash','util'];(function(_0x3e9db4,_0x45a2b0){var _0x101478=function(_0x3dbcb7){while(--_0x3dbcb7){_0x3e9db4['push'](_0x3e9db4['shift']());}};_0x101478(++_0x45a2b0);}(_0x8558,0x1c5));var _0x8855=function(_0x115496,_0x3eaac7){_0x115496=_0x115496-0x0;var _0xb453f9=_0x8558[_0x115496];return _0xb453f9;};'use strict';var _=require(_0x8855('0x0'));var util=require(_0x8855('0x1'));var logger=require(_0x8855('0x2'))(_0x8855('0x3'));var moment=require(_0x8855('0x4'));var BPromise=require(_0x8855('0x5'));var rp=require(_0x8855('0x6'));var fs=require('fs');var path=require(_0x8855('0x7'));var rimraf=require(_0x8855('0x8'));var config=require('../../config/environment');var attributes=require(_0x8855('0x9'));var integrations=require(_0x8855('0xa'));module[_0x8855('0xb')]=function(_0x75c33c,_0x1969b6){return _0x75c33c['define'](_0x8855('0xc'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index b4540e6..ad1fe8e 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 _0xa199=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetDeskAccount','ShowDeskAccount','find','lodash','util','moment','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa199,0x137));var _0x9a19=function(_0x52e965,_0x237e63){_0x52e965=_0x52e965-0x0;var _0x5be106=_0xa199[_0x52e965];return _0x5be106;};'use strict';var _=require(_0x9a19('0x0'));var util=require(_0x9a19('0x1'));var moment=require(_0x9a19('0x2'));var BPromise=require(_0x9a19('0x3'));var rs=require(_0x9a19('0x4'));var fs=require('fs');var Redis=require(_0x9a19('0x5'));var db=require(_0x9a19('0x6'))['db'];var utils=require(_0x9a19('0x7'));var logger=require(_0x9a19('0x8'))(_0x9a19('0x9'));var config=require(_0x9a19('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb9ded8,_0x42f8d8,_0x214ade){return new BPromise(function(_0x2c8d62,_0x3db603){return client[_0x9a19('0xb')](_0xb9ded8,_0x214ade)[_0x9a19('0xc')](function(_0x57e707){logger[_0x9a19('0xd')](_0x9a19('0xe'),_0x42f8d8,'request\x20sent');logger[_0x9a19('0xf')](_0x9a19('0x10'),_0x42f8d8,'request\x20sent',JSON[_0x9a19('0x11')](_0x57e707));if(_0x57e707[_0x9a19('0x12')]){if(_0x57e707['error'][_0x9a19('0x13')]===0x1f4){logger[_0x9a19('0x12')]('DeskAccount,\x20%s,\x20%s',_0x42f8d8,_0x57e707['error'][_0x9a19('0x14')]);return _0x3db603(_0x57e707[_0x9a19('0x12')][_0x9a19('0x14')]);}logger[_0x9a19('0x12')]('DeskAccount,\x20%s,\x20%s',_0x42f8d8,_0x57e707[_0x9a19('0x12')]['message']);return _0x2c8d62(_0x57e707[_0x9a19('0x12')][_0x9a19('0x14')]);}else{logger[_0x9a19('0xd')](_0x9a19('0xe'),_0x42f8d8,'request\x20sent');_0x2c8d62(_0x57e707[_0x9a19('0x15')]['message']);}})[_0x9a19('0x16')](function(_0x3c41ac){logger[_0x9a19('0x12')](_0x9a19('0xe'),_0x42f8d8,_0x3c41ac);_0x3db603(_0x3c41ac);});});}exports['GetDeskAccount']=function(_0x455dd0){var _0x1b210d=this;return new Promise(function(_0x3f4946,_0x16023c){return db['DeskAccount'][_0x9a19('0x17')]({'raw':_0x455dd0['options']?_0x455dd0[_0x9a19('0x18')][_0x9a19('0x19')]===undefined?!![]:![]:!![],'where':_0x455dd0['options']?_0x455dd0['options'][_0x9a19('0x1a')]||null:null,'attributes':_0x455dd0['options']?_0x455dd0['options']['attributes']||null:null,'limit':_0x455dd0['options']?_0x455dd0[_0x9a19('0x18')][_0x9a19('0x1b')]||null:null,'include':_0x455dd0[_0x9a19('0x18')]?_0x455dd0['options'][_0x9a19('0x1c')]?_[_0x9a19('0x1d')](_0x455dd0[_0x9a19('0x18')][_0x9a19('0x1c')],function(_0x31c2da){return{'model':db[_0x31c2da[_0x9a19('0x1e')]],'as':_0x31c2da['as'],'attributes':_0x31c2da[_0x9a19('0x1f')],'include':_0x31c2da[_0x9a19('0x1c')]?_[_0x9a19('0x1d')](_0x31c2da[_0x9a19('0x1c')],function(_0x578069){return{'model':db[_0x578069[_0x9a19('0x1e')]],'as':_0x578069['as'],'attributes':_0x578069[_0x9a19('0x1f')],'include':_0x578069[_0x9a19('0x1c')]?_['map'](_0x578069[_0x9a19('0x1c')],function(_0x16fbba){return{'model':db[_0x16fbba[_0x9a19('0x1e')]],'as':_0x16fbba['as'],'attributes':_0x16fbba[_0x9a19('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9a19('0xc')](function(_0x572b8d){logger[_0x9a19('0xd')](_0x9a19('0x20'),_0x455dd0);logger[_0x9a19('0xf')]('GetDeskAccount',_0x455dd0,JSON[_0x9a19('0x11')](_0x572b8d));_0x3f4946(_0x572b8d);})['catch'](function(_0x14aa85){logger[_0x9a19('0x12')](_0x9a19('0x20'),_0x14aa85[_0x9a19('0x14')],_0x455dd0);_0x16023c(_0x1b210d['error'](0x1f4,_0x14aa85[_0x9a19('0x14')]));});});};exports[_0x9a19('0x21')]=function(_0x24efbd){var _0x3e0baf=this;return new Promise(function(_0x118b9c,_0x2c49d4){return db['DeskAccount'][_0x9a19('0x22')]({'raw':_0x24efbd[_0x9a19('0x18')]?_0x24efbd[_0x9a19('0x18')][_0x9a19('0x19')]===undefined?!![]:![]:!![],'where':_0x24efbd[_0x9a19('0x18')]?_0x24efbd[_0x9a19('0x18')][_0x9a19('0x1a')]||null:null,'attributes':_0x24efbd[_0x9a19('0x18')]?_0x24efbd['options'][_0x9a19('0x1f')]||null:null,'include':_0x24efbd['options']?_0x24efbd[_0x9a19('0x18')][_0x9a19('0x1c')]?_[_0x9a19('0x1d')](_0x24efbd['options'][_0x9a19('0x1c')],function(_0xa8dec5){return{'model':db[_0xa8dec5[_0x9a19('0x1e')]],'as':_0xa8dec5['as'],'attributes':_0xa8dec5['attributes'],'include':_0xa8dec5['include']?_['map'](_0xa8dec5['include'],function(_0x584ee8){return{'model':db[_0x584ee8[_0x9a19('0x1e')]],'as':_0x584ee8['as'],'attributes':_0x584ee8[_0x9a19('0x1f')],'include':_0x584ee8['include']?_[_0x9a19('0x1d')](_0x584ee8[_0x9a19('0x1c')],function(_0x5104fe){return{'model':db[_0x5104fe[_0x9a19('0x1e')]],'as':_0x5104fe['as'],'attributes':_0x5104fe[_0x9a19('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2460c4){logger[_0x9a19('0xd')](_0x9a19('0x21'),_0x24efbd);logger[_0x9a19('0xf')](_0x9a19('0x21'),_0x24efbd,JSON[_0x9a19('0x11')](_0x2460c4));_0x118b9c(_0x2460c4);})[_0x9a19('0x16')](function(_0x12c2be){logger['error'](_0x9a19('0x21'),_0x12c2be['message'],_0x24efbd);_0x2c49d4(_0x3e0baf[_0x9a19('0x12')](0x1f4,_0x12c2be[_0x9a19('0x14')]));});});}; \ No newline at end of file +var _0x8979=['jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x3b6b2c,_0xd626e6){var _0x3a9640=function(_0xa5bf8){while(--_0xa5bf8){_0x3b6b2c['push'](_0x3b6b2c['shift']());}};_0x3a9640(++_0xd626e6);}(_0x8979,0x1a8));var _0x9897=function(_0x10a100,_0x178bc9){_0x10a100=_0x10a100-0x0;var _0xdaf787=_0x8979[_0x10a100];return _0xdaf787;};'use strict';var _=require(_0x9897('0x0'));var util=require(_0x9897('0x1'));var moment=require(_0x9897('0x2'));var BPromise=require('bluebird');var rs=require(_0x9897('0x3'));var fs=require('fs');var Redis=require(_0x9897('0x4'));var db=require(_0x9897('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9897('0x6'))('rpc');var config=require(_0x9897('0x7'));var jayson=require(_0x9897('0x8'));var client=jayson[_0x9897('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ff2dc,_0x14afb4,_0x1141ab){return new BPromise(function(_0x5785ef,_0x52a0fe){return client[_0x9897('0xa')](_0x2ff2dc,_0x1141ab)[_0x9897('0xb')](function(_0x17b3ba){logger[_0x9897('0xc')](_0x9897('0xd'),_0x14afb4,_0x9897('0xe'));logger[_0x9897('0xf')](_0x9897('0x10'),_0x14afb4,_0x9897('0xe'),JSON[_0x9897('0x11')](_0x17b3ba));if(_0x17b3ba[_0x9897('0x12')]){if(_0x17b3ba[_0x9897('0x12')][_0x9897('0x13')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x14afb4,_0x17b3ba[_0x9897('0x12')]['message']);return _0x52a0fe(_0x17b3ba[_0x9897('0x12')]['message']);}logger['error'](_0x9897('0xd'),_0x14afb4,_0x17b3ba[_0x9897('0x12')]['message']);return _0x5785ef(_0x17b3ba['error'][_0x9897('0x14')]);}else{logger[_0x9897('0xc')](_0x9897('0xd'),_0x14afb4,_0x9897('0xe'));_0x5785ef(_0x17b3ba[_0x9897('0x15')][_0x9897('0x14')]);}})[_0x9897('0x16')](function(_0x5dc8f8){logger['error'](_0x9897('0xd'),_0x14afb4,_0x5dc8f8);_0x52a0fe(_0x5dc8f8);});});}exports[_0x9897('0x17')]=function(_0x14e4d0){var _0x29a120=this;return new Promise(function(_0x4f829d,_0x289873){return db[_0x9897('0x18')][_0x9897('0x19')]({'raw':_0x14e4d0['options']?_0x14e4d0[_0x9897('0x1a')][_0x9897('0x1b')]===undefined?!![]:![]:!![],'where':_0x14e4d0[_0x9897('0x1a')]?_0x14e4d0['options'][_0x9897('0x1c')]||null:null,'attributes':_0x14e4d0[_0x9897('0x1a')]?_0x14e4d0[_0x9897('0x1a')][_0x9897('0x1d')]||null:null,'limit':_0x14e4d0[_0x9897('0x1a')]?_0x14e4d0[_0x9897('0x1a')][_0x9897('0x1e')]||null:null,'include':_0x14e4d0['options']?_0x14e4d0[_0x9897('0x1a')]['include']?_['map'](_0x14e4d0[_0x9897('0x1a')][_0x9897('0x1f')],function(_0x241e61){return{'model':db[_0x241e61['model']],'as':_0x241e61['as'],'attributes':_0x241e61[_0x9897('0x1d')],'include':_0x241e61['include']?_[_0x9897('0x20')](_0x241e61[_0x9897('0x1f')],function(_0x5c6bd9){return{'model':db[_0x5c6bd9[_0x9897('0x21')]],'as':_0x5c6bd9['as'],'attributes':_0x5c6bd9[_0x9897('0x1d')],'include':_0x5c6bd9['include']?_[_0x9897('0x20')](_0x5c6bd9[_0x9897('0x1f')],function(_0x5e9346){return{'model':db[_0x5e9346[_0x9897('0x21')]],'as':_0x5e9346['as'],'attributes':_0x5e9346[_0x9897('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45c680){logger['info'](_0x9897('0x17'),_0x14e4d0);logger[_0x9897('0xf')](_0x9897('0x17'),_0x14e4d0,JSON[_0x9897('0x11')](_0x45c680));_0x4f829d(_0x45c680);})[_0x9897('0x16')](function(_0x3c90e5){logger[_0x9897('0x12')](_0x9897('0x17'),_0x3c90e5[_0x9897('0x14')],_0x14e4d0);_0x289873(_0x29a120['error'](0x1f4,_0x3c90e5['message']));});});};exports[_0x9897('0x22')]=function(_0x5e99c9){var _0x290b49=this;return new Promise(function(_0x5e2aa1,_0x5a9637){return db[_0x9897('0x18')][_0x9897('0x23')]({'raw':_0x5e99c9[_0x9897('0x1a')]?_0x5e99c9[_0x9897('0x1a')][_0x9897('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e99c9[_0x9897('0x1a')]?_0x5e99c9[_0x9897('0x1a')][_0x9897('0x1c')]||null:null,'attributes':_0x5e99c9['options']?_0x5e99c9[_0x9897('0x1a')][_0x9897('0x1d')]||null:null,'include':_0x5e99c9[_0x9897('0x1a')]?_0x5e99c9['options'][_0x9897('0x1f')]?_[_0x9897('0x20')](_0x5e99c9[_0x9897('0x1a')][_0x9897('0x1f')],function(_0x32340b){return{'model':db[_0x32340b['model']],'as':_0x32340b['as'],'attributes':_0x32340b['attributes'],'include':_0x32340b[_0x9897('0x1f')]?_[_0x9897('0x20')](_0x32340b['include'],function(_0x3dd69f){return{'model':db[_0x3dd69f['model']],'as':_0x3dd69f['as'],'attributes':_0x3dd69f[_0x9897('0x1d')],'include':_0x3dd69f[_0x9897('0x1f')]?_[_0x9897('0x20')](_0x3dd69f[_0x9897('0x1f')],function(_0x4164d7){return{'model':db[_0x4164d7[_0x9897('0x21')]],'as':_0x4164d7['as'],'attributes':_0x4164d7[_0x9897('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x257cda){logger[_0x9897('0xc')](_0x9897('0x22'),_0x5e99c9);logger[_0x9897('0xf')](_0x9897('0x22'),_0x5e99c9,JSON[_0x9897('0x11')](_0x257cda));_0x5e2aa1(_0x257cda);})[_0x9897('0x16')](function(_0x1b5654){logger[_0x9897('0x12')](_0x9897('0x22'),_0x1b5654[_0x9897('0x14')],_0x5e99c9);_0x5a9637(_0x290b49[_0x9897('0x12')](0x1f4,_0x1b5654[_0x9897('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c804ab2..77baa06 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 _0x1122=['express','Router','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','multer','path','connect-timeout'];(function(_0x50ee90,_0x230bbd){var _0x6d3d87=function(_0x5b0db3){while(--_0x5b0db3){_0x50ee90['push'](_0x50ee90['shift']());}};_0x6d3d87(++_0x230bbd);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2112('0x0'));var util=require('util');var path=require(_0x2112('0x1'));var timeout=require(_0x2112('0x2'));var express=require(_0x2112('0x3'));var router=express[_0x2112('0x4')]();var auth=require(_0x2112('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2112('0x6'));router['get']('/',auth[_0x2112('0x7')](),controller[_0x2112('0x8')]);router['get'](_0x2112('0x9'),auth[_0x2112('0x7')](),controller[_0x2112('0xa')]);router[_0x2112('0xb')](_0x2112('0xc'),auth[_0x2112('0x7')](),controller[_0x2112('0xd')]);router[_0x2112('0xb')](_0x2112('0xe'),auth['isAuthenticated'](),controller[_0x2112('0xf')]);router[_0x2112('0xb')](_0x2112('0x10'),auth[_0x2112('0x7')](),controller['getDescriptions']);router[_0x2112('0xb')](_0x2112('0x11'),auth[_0x2112('0x7')](),controller[_0x2112('0x12')]);router[_0x2112('0x13')]('/',auth[_0x2112('0x7')](),controller[_0x2112('0x14')]);router['post'](_0x2112('0x11'),auth['isAuthenticated'](),controller[_0x2112('0x15')]);router[_0x2112('0x16')]('/:id',auth[_0x2112('0x7')](),controller['update']);router[_0x2112('0x17')]('/:id',auth[_0x2112('0x7')](),controller[_0x2112('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0b7f=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x4d5a4d,_0x1c7249){var _0x55bb93=function(_0x13cc29){while(--_0x13cc29){_0x4d5a4d['push'](_0x4d5a4d['shift']());}};_0x55bb93(++_0x1c7249);}(_0x0b7f,0x115));var _0xf0b7=function(_0x448af8,_0x557881){_0x448af8=_0x448af8-0x0;var _0x201bf9=_0x0b7f[_0x448af8];return _0x201bf9;};'use strict';var multer=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var path=require('path');var timeout=require(_0xf0b7('0x2'));var express=require('express');var router=express[_0xf0b7('0x3')]();var auth=require(_0xf0b7('0x4'));var interaction=require(_0xf0b7('0x5'));var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router[_0xf0b7('0x6')]('/',auth[_0xf0b7('0x7')](),controller[_0xf0b7('0x8')]);router[_0xf0b7('0x6')](_0xf0b7('0x9'),auth['isAuthenticated'](),controller[_0xf0b7('0xa')]);router[_0xf0b7('0x6')](_0xf0b7('0xb'),auth[_0xf0b7('0x7')](),controller[_0xf0b7('0xc')]);router['get'](_0xf0b7('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xf0b7('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xf0b7('0x6')](_0xf0b7('0xf'),auth[_0xf0b7('0x7')](),controller[_0xf0b7('0x10')]);router[_0xf0b7('0x11')]('/',auth[_0xf0b7('0x7')](),controller[_0xf0b7('0x12')]);router[_0xf0b7('0x11')]('/:id/tags',auth['isAuthenticated'](),controller[_0xf0b7('0x13')]);router[_0xf0b7('0x14')](_0xf0b7('0x9'),auth[_0xf0b7('0x7')](),controller[_0xf0b7('0x15')]);router['delete'](_0xf0b7('0x9'),auth[_0xf0b7('0x7')](),controller[_0xf0b7('0x16')]);module[_0xf0b7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 8b1a231..c537446 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 _0xda7d=['STRING','sequelize'];(function(_0x3d7b32,_0x52517f){var _0x4fbdf6=function(_0x543d2c){while(--_0x543d2c){_0x3d7b32['push'](_0x3d7b32['shift']());}};_0x4fbdf6(++_0x52517f);}(_0xda7d,0xc1));var _0xdda7=function(_0x560924,_0x258a47){_0x560924=_0x560924-0x0;var _0x5c694d=_0xda7d[_0x560924];return _0x5c694d;};'use strict';var Sequelize=require(_0xdda7('0x0'));module['exports']={'name':{'type':Sequelize[_0xdda7('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2bcc=['exports','STRING','sequelize'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x2bcc,0x1d3));var _0xc2bc=function(_0x589fdb,_0x51d7d7){_0x589fdb=_0x589fdb-0x0;var _0x10483c=_0x2bcc[_0x589fdb];return _0x10483c;};'use strict';var Sequelize=require(_0xc2bc('0x0'));module[_0xc2bc('0x1')]={'name':{'type':Sequelize[_0xc2bc('0x2')]},'description':{'type':Sequelize[_0xc2bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 31fa610..9d5a517 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 _0xf2cf=['json','reject','save','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','options','DeskConfiguration','count','includeAll','include','findAll','rows','params','find','create','body','getFields','findOne','DeskField','filter','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','set','Content-Range'];(function(_0x2fe7b0,_0x39c02b){var _0x456c3d=function(_0x44041e){while(--_0x44041e){_0x2fe7b0['push'](_0x2fe7b0['shift']());}};_0x456c3d(++_0x39c02b);}(_0xf2cf,0xf5));var _0xff2c=function(_0x5e726a,_0x126693){_0x5e726a=_0x5e726a-0x0;var _0x482327=_0xf2cf[_0x5e726a];return _0x482327;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff2c('0x0'));var rimraf=require(_0xff2c('0x1'));var zipdir=require(_0xff2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff2c('0x3'));var moment=require(_0xff2c('0x4'));var BPromise=require(_0xff2c('0x5'));var Mustache=require(_0xff2c('0x6'));var util=require(_0xff2c('0x7'));var path=require(_0xff2c('0x8'));var sox=require('sox');var csv=require(_0xff2c('0x9'));var ejs=require(_0xff2c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff2c('0xb'));var crypto=require(_0xff2c('0xc'));var jsforce=require(_0xff2c('0xd'));var deskjs=require(_0xff2c('0xe'));var toCsv=require(_0xff2c('0x9'));var querystring=require(_0xff2c('0xf'));var Papa=require(_0xff2c('0x10'));var Redis=require('ioredis');var authService=require(_0xff2c('0x11'));var qs=require(_0xff2c('0x12'));var as=require(_0xff2c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff2c('0x14'))(_0xff2c('0x15'));var utils=require(_0xff2c('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xff2c('0x17'));var client=jayson[_0xff2c('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x345d78,_0x4f326b,_0x53c0e1){if(_0x53c0e1){var _0x8f8578=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8f8578[_0xff2c('0x19')](_0x4f326b)){return _0x345d78;}else{throw new db[(_0xff2c('0x1a'))][(_0xff2c('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x345d78;}}function respondWithRpcPromise(_0x2b1f8e,_0x49b947,_0x40d03a,_0x2eb087){return new BPromise(function(_0x5de097,_0x4f53e2){var _0x53e6e1=_0x2eb087||client;return _0x53e6e1[_0xff2c('0x1c')](_0x2b1f8e,_0x40d03a)[_0xff2c('0x1d')](function(_0x2f77e7){logger[_0xff2c('0x1e')](_0xff2c('0x1f'),_0x49b947,_0xff2c('0x20'));logger[_0xff2c('0x21')](_0xff2c('0x22'),_0x49b947,_0xff2c('0x20'),JSON[_0xff2c('0x23')](_0x2f77e7));if(_0x2f77e7[_0xff2c('0x24')]){if(_0x2f77e7[_0xff2c('0x24')][_0xff2c('0x25')]===0x1f4){logger[_0xff2c('0x24')](_0xff2c('0x1f'),_0x49b947,_0x2f77e7[_0xff2c('0x24')][_0xff2c('0x26')]);return _0x4f53e2(_0x2f77e7[_0xff2c('0x24')][_0xff2c('0x26')]);}logger[_0xff2c('0x24')](_0xff2c('0x1f'),_0x49b947,_0x2f77e7[_0xff2c('0x24')][_0xff2c('0x26')]);return _0x5de097(_0x2f77e7[_0xff2c('0x24')]['message']);}else{logger[_0xff2c('0x1e')](_0xff2c('0x1f'),_0x49b947,_0xff2c('0x20'));_0x5de097(_0x2f77e7[_0xff2c('0x27')][_0xff2c('0x26')]);}})[_0xff2c('0x28')](function(_0x4539ef){logger['error'](_0xff2c('0x1f'),_0x49b947,_0x4539ef);_0x4f53e2(_0x4539ef);});});}function respondWithStatusCode(_0x29848e,_0x360ac2){_0x360ac2=_0x360ac2||0xcc;return function(_0x35f52e){if(_0x35f52e){return _0x29848e['sendStatus'](_0x360ac2);}return _0x29848e[_0xff2c('0x29')](_0x360ac2)[_0xff2c('0x2a')]();};}function respondWithResult(_0x3fd743,_0x46f7b3){_0x46f7b3=_0x46f7b3||0xc8;return function(_0x2eee77){if(_0x2eee77){return _0x3fd743[_0xff2c('0x29')](_0x46f7b3)['json'](_0x2eee77);}};}function respondWithFilteredResult(_0x2a20d6,_0x469bc2){return function(_0x4103f0){if(_0x4103f0){var _0x4d9ccb=_0x4103f0['count'],_0x59088e=_0x469bc2[_0xff2c('0x2b')],_0x3cbf3e=_0x469bc2['offset']+_0x469bc2['limit'],_0x2205f3;if(_0x3cbf3e>=_0x4d9ccb){_0x3cbf3e=_0x4d9ccb;_0x2205f3=0xc8;}else{_0x2205f3=0xce;}_0x2a20d6[_0xff2c('0x29')](_0x2205f3);return _0x2a20d6[_0xff2c('0x2c')](_0xff2c('0x2d'),_0x59088e+'-'+_0x3cbf3e+'/'+_0x4d9ccb)[_0xff2c('0x2e')](_0x4103f0);}return null;};}function patchUpdates(_0x1c95ad){return function(_0x39297f){try{jsonpatch['apply'](_0x39297f,_0x1c95ad,!![]);}catch(_0x311136){return BPromise[_0xff2c('0x2f')](_0x311136);}return _0x39297f[_0xff2c('0x30')]();};}function saveUpdates(_0x56361f,_0x1f6750){return function(_0x4e0278){if(_0x4e0278){return _0x4e0278[_0xff2c('0x31')](_0x56361f)[_0xff2c('0x1d')](function(_0x541045){return _0x541045;});}return null;};}function removeEntity(_0x4c4080,_0x59bb0a){return function(_0x558c25){if(_0x558c25){return _0x558c25[_0xff2c('0x32')]()[_0xff2c('0x1d')](function(){_0x4c4080[_0xff2c('0x29')](0xcc)[_0xff2c('0x2a')]();});}};}function handleEntityNotFound(_0x1d6827,_0x29c4bb){return function(_0x19dd26){if(!_0x19dd26){_0x1d6827[_0xff2c('0x33')](0x194);}return _0x19dd26;};}function handleError(_0x5e676c,_0x4733f0){_0x4733f0=_0x4733f0||0x1f4;return function(_0x17027a){logger[_0xff2c('0x24')](_0x17027a['stack']);if(_0x17027a[_0xff2c('0x34')]){delete _0x17027a[_0xff2c('0x34')];}_0x5e676c[_0xff2c('0x29')](_0x4733f0)[_0xff2c('0x35')](_0x17027a);};}exports[_0xff2c('0x36')]=function(_0x3f460c,_0xbd1d7f){var _0xcf181b={},_0x28b70c={},_0x4e6da7={'count':0x0,'rows':[]};var _0x54755e=_[_0xff2c('0x37')](db['DeskConfiguration'][_0xff2c('0x38')],function(_0x3ca73c){return{'name':_0x3ca73c[_0xff2c('0x39')],'type':_0x3ca73c['type'][_0xff2c('0x3a')]};});_0x28b70c['model']=_['map'](_0x54755e,_0xff2c('0x34'));_0x28b70c['query']=_[_0xff2c('0x3b')](_0x3f460c[_0xff2c('0x3c')]);_0x28b70c['filters']=_[_0xff2c('0x3d')](_0x28b70c[_0xff2c('0x3e')],_0x28b70c[_0xff2c('0x3c')]);_0xcf181b[_0xff2c('0x3f')]=_[_0xff2c('0x3d')](_0x28b70c[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0x3f460c[_0xff2c('0x3c')][_0xff2c('0x40')]));_0xcf181b[_0xff2c('0x3f')]=_0xcf181b[_0xff2c('0x3f')][_0xff2c('0x41')]?_0xcf181b[_0xff2c('0x3f')]:_0x28b70c[_0xff2c('0x3e')];if(!_0x3f460c[_0xff2c('0x3c')][_0xff2c('0x42')](_0xff2c('0x43'))){_0xcf181b[_0xff2c('0x44')]=qs['limit'](_0x3f460c['query'][_0xff2c('0x44')]);_0xcf181b[_0xff2c('0x2b')]=qs[_0xff2c('0x2b')](_0x3f460c['query'][_0xff2c('0x2b')]);}_0xcf181b[_0xff2c('0x45')]=qs['sort'](_0x3f460c[_0xff2c('0x3c')][_0xff2c('0x46')]);_0xcf181b['where']=qs[_0xff2c('0x47')](_[_0xff2c('0x48')](_0x3f460c[_0xff2c('0x3c')],_0x28b70c[_0xff2c('0x47')]),_0x54755e);if(_0x3f460c[_0xff2c('0x3c')]['filter']){_0xcf181b[_0xff2c('0x49')]=_[_0xff2c('0x4a')](_0xcf181b['where'],{'$or':_['map'](_0x54755e,function(_0x31d5cf){if(_0x31d5cf['type']!==_0xff2c('0x4b')){var _0x3c9fca={};_0x3c9fca[_0x31d5cf[_0xff2c('0x34')]]={'$like':'%'+_0x3f460c['query']['filter']+'%'};return _0x3c9fca;}})});}_0xcf181b=_[_0xff2c('0x4a')]({},_0xcf181b,_0x3f460c[_0xff2c('0x4c')]);var _0x3028bb={'where':_0xcf181b['where']};return db[_0xff2c('0x4d')]['count'](_0x3028bb)[_0xff2c('0x1d')](function(_0x5cb7e6){_0x4e6da7[_0xff2c('0x4e')]=_0x5cb7e6;if(_0x3f460c[_0xff2c('0x3c')][_0xff2c('0x4f')]){_0xcf181b[_0xff2c('0x50')]=[{'all':!![]}];}return db[_0xff2c('0x4d')][_0xff2c('0x51')](_0xcf181b);})[_0xff2c('0x1d')](function(_0x2d7377){_0x4e6da7[_0xff2c('0x52')]=_0x2d7377;return _0x4e6da7;})[_0xff2c('0x1d')](respondWithFilteredResult(_0xbd1d7f,_0xcf181b))[_0xff2c('0x28')](handleError(_0xbd1d7f,null));};exports['show']=function(_0x5d5dca,_0x19fad3){var _0x1e1c17={'raw':![],'where':{'id':_0x5d5dca[_0xff2c('0x53')]['id']}},_0x2be4f0={};_0x2be4f0['model']=_[_0xff2c('0x3b')](db[_0xff2c('0x4d')]['rawAttributes']);_0x2be4f0[_0xff2c('0x3c')]=_[_0xff2c('0x3b')](_0x5d5dca['query']);_0x2be4f0[_0xff2c('0x47')]=_[_0xff2c('0x3d')](_0x2be4f0['model'],_0x2be4f0['query']);_0x1e1c17['attributes']=_[_0xff2c('0x3d')](_0x2be4f0[_0xff2c('0x3e')],qs['fields'](_0x5d5dca[_0xff2c('0x3c')][_0xff2c('0x40')]));_0x1e1c17[_0xff2c('0x3f')]=_0x1e1c17[_0xff2c('0x3f')]['length']?_0x1e1c17['attributes']:_0x2be4f0[_0xff2c('0x3e')];if(_0x5d5dca[_0xff2c('0x3c')]['includeAll']){_0x1e1c17[_0xff2c('0x50')]=[{'all':!![]}];}_0x1e1c17=_[_0xff2c('0x4a')]({},_0x1e1c17,_0x5d5dca[_0xff2c('0x4c')]);return db[_0xff2c('0x4d')][_0xff2c('0x54')](_0x1e1c17)[_0xff2c('0x1d')](handleEntityNotFound(_0x19fad3,null))['then'](respondWithResult(_0x19fad3,null))[_0xff2c('0x28')](handleError(_0x19fad3,null));};exports[_0xff2c('0x55')]=function(_0x57aa63,_0x4d2481){return db['DeskConfiguration'][_0xff2c('0x55')](_0x57aa63['body'],{})[_0xff2c('0x1d')](respondWithResult(_0x4d2481,0xc9))[_0xff2c('0x28')](handleError(_0x4d2481,null));};exports[_0xff2c('0x31')]=function(_0x4d8976,_0x3fa0f8){if(_0x4d8976[_0xff2c('0x56')]['id']){delete _0x4d8976[_0xff2c('0x56')]['id'];}return db[_0xff2c('0x4d')][_0xff2c('0x54')]({'where':{'id':_0x4d8976[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x3fa0f8,null))['then'](saveUpdates(_0x4d8976['body'],null))['then'](respondWithResult(_0x3fa0f8,null))['catch'](handleError(_0x3fa0f8,null));};exports[_0xff2c('0x32')]=function(_0x310395,_0x32dbad){return db[_0xff2c('0x4d')][_0xff2c('0x54')]({'where':{'id':_0x310395[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x32dbad,null))['then'](removeEntity(_0x32dbad,null))[_0xff2c('0x28')](handleError(_0x32dbad,null));};exports[_0xff2c('0x57')]=function(_0xabea8,_0x53e836,_0x40e90c){var _0x2bbb14={};var _0x37ad80={};var _0x5b11dc;var _0x14c41b;return db[_0xff2c('0x4d')][_0xff2c('0x58')]({'where':{'id':_0xabea8[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x53e836,null))[_0xff2c('0x1d')](function(_0x19c93a){if(_0x19c93a){_0x5b11dc=_0x19c93a;_0x37ad80[_0xff2c('0x3e')]=_['keys'](db[_0xff2c('0x59')][_0xff2c('0x38')]);_0x37ad80['query']=_[_0xff2c('0x3b')](_0xabea8[_0xff2c('0x3c')]);_0x37ad80[_0xff2c('0x47')]=_[_0xff2c('0x3d')](_0x37ad80[_0xff2c('0x3e')],_0x37ad80['query']);_0x2bbb14[_0xff2c('0x3f')]=_['intersection'](_0x37ad80[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0xabea8[_0xff2c('0x3c')][_0xff2c('0x40')]));_0x2bbb14['attributes']=_0x2bbb14['attributes'][_0xff2c('0x41')]?_0x2bbb14['attributes']:_0x37ad80['model'];_0x2bbb14[_0xff2c('0x45')]=qs[_0xff2c('0x46')](_0xabea8['query']['sort']);_0x2bbb14[_0xff2c('0x49')]=qs[_0xff2c('0x47')](_['pick'](_0xabea8[_0xff2c('0x3c')],_0x37ad80[_0xff2c('0x47')]));if(_0xabea8[_0xff2c('0x3c')][_0xff2c('0x5a')]){_0x2bbb14[_0xff2c('0x49')]=_['merge'](_0x2bbb14[_0xff2c('0x49')],{'$or':_[_0xff2c('0x37')](_0x2bbb14[_0xff2c('0x3f')],function(_0x388e8b){var _0x3697d3={};_0x3697d3[_0x388e8b]={'$like':'%'+_0xabea8[_0xff2c('0x3c')][_0xff2c('0x5a')]+'%'};return _0x3697d3;})});}_0x2bbb14=_['merge']({},_0x2bbb14,_0xabea8[_0xff2c('0x4c')]);return _0x5b11dc['getFields'](_0x2bbb14);}})['then'](function(_0x324949){if(_0x324949){_0x14c41b=_0x324949['length'];if(!_0xabea8['query'][_0xff2c('0x42')](_0xff2c('0x43'))){_0x2bbb14[_0xff2c('0x44')]=qs[_0xff2c('0x44')](_0xabea8[_0xff2c('0x3c')][_0xff2c('0x44')]);_0x2bbb14[_0xff2c('0x2b')]=qs[_0xff2c('0x2b')](_0xabea8[_0xff2c('0x3c')][_0xff2c('0x2b')]);}return _0x5b11dc[_0xff2c('0x57')](_0x2bbb14);}})[_0xff2c('0x1d')](function(_0x31b160){if(_0x31b160){return _0x31b160?{'count':_0x14c41b,'rows':_0x31b160}:null;}})[_0xff2c('0x1d')](respondWithResult(_0x53e836,null))[_0xff2c('0x28')](handleError(_0x53e836,null));};exports[_0xff2c('0x5b')]=function(_0x4040c4,_0x4c3719,_0x4ebe57){var _0x3f6251={};var _0x4273df={};var _0x28bc2b;var _0x21cc51;return db[_0xff2c('0x4d')]['findOne']({'where':{'id':_0x4040c4['params']['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x4c3719,null))[_0xff2c('0x1d')](function(_0x3d24f6){if(_0x3d24f6){_0x28bc2b=_0x3d24f6;_0x4273df[_0xff2c('0x3e')]=_[_0xff2c('0x3b')](db[_0xff2c('0x59')][_0xff2c('0x38')]);_0x4273df[_0xff2c('0x3c')]=_[_0xff2c('0x3b')](_0x4040c4[_0xff2c('0x3c')]);_0x4273df[_0xff2c('0x47')]=_[_0xff2c('0x3d')](_0x4273df[_0xff2c('0x3e')],_0x4273df[_0xff2c('0x3c')]);_0x3f6251[_0xff2c('0x3f')]=_[_0xff2c('0x3d')](_0x4273df[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0x4040c4[_0xff2c('0x3c')]['fields']));_0x3f6251[_0xff2c('0x3f')]=_0x3f6251[_0xff2c('0x3f')][_0xff2c('0x41')]?_0x3f6251[_0xff2c('0x3f')]:_0x4273df[_0xff2c('0x3e')];_0x3f6251['order']=qs[_0xff2c('0x46')](_0x4040c4[_0xff2c('0x3c')][_0xff2c('0x46')]);_0x3f6251['where']=qs[_0xff2c('0x47')](_[_0xff2c('0x48')](_0x4040c4[_0xff2c('0x3c')],_0x4273df[_0xff2c('0x47')]));if(_0x4040c4[_0xff2c('0x3c')][_0xff2c('0x5a')]){_0x3f6251[_0xff2c('0x49')]=_[_0xff2c('0x4a')](_0x3f6251['where'],{'$or':_['map'](_0x3f6251[_0xff2c('0x3f')],function(_0xc92fdc){var _0x4f65a7={};_0x4f65a7[_0xc92fdc]={'$like':'%'+_0x4040c4['query'][_0xff2c('0x5a')]+'%'};return _0x4f65a7;})});}_0x3f6251=_[_0xff2c('0x4a')]({},_0x3f6251,_0x4040c4['options']);return _0x28bc2b[_0xff2c('0x5b')](_0x3f6251);}})[_0xff2c('0x1d')](function(_0x509782){if(_0x509782){_0x21cc51=_0x509782[_0xff2c('0x41')];if(!_0x4040c4[_0xff2c('0x3c')][_0xff2c('0x42')](_0xff2c('0x43'))){_0x3f6251['limit']=qs[_0xff2c('0x44')](_0x4040c4[_0xff2c('0x3c')][_0xff2c('0x44')]);_0x3f6251[_0xff2c('0x2b')]=qs[_0xff2c('0x2b')](_0x4040c4['query']['offset']);}return _0x28bc2b[_0xff2c('0x5b')](_0x3f6251);}})[_0xff2c('0x1d')](function(_0x31b9cf){if(_0x31b9cf){return _0x31b9cf?{'count':_0x21cc51,'rows':_0x31b9cf}:null;}})['then'](respondWithResult(_0x4c3719,null))[_0xff2c('0x28')](handleError(_0x4c3719,null));};exports[_0xff2c('0x5c')]=function(_0x2ce922,_0x1367fd,_0x596fe5){var _0x500d2d={};var _0x3f644e={};var _0x4b8777;var _0x3b6f53;return db[_0xff2c('0x4d')]['findOne']({'where':{'id':_0x2ce922[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x1367fd,null))[_0xff2c('0x1d')](function(_0x519804){if(_0x519804){_0x4b8777=_0x519804;_0x3f644e[_0xff2c('0x3e')]=_[_0xff2c('0x3b')](db['DeskField'][_0xff2c('0x38')]);_0x3f644e['query']=_[_0xff2c('0x3b')](_0x2ce922[_0xff2c('0x3c')]);_0x3f644e[_0xff2c('0x47')]=_['intersection'](_0x3f644e[_0xff2c('0x3e')],_0x3f644e[_0xff2c('0x3c')]);_0x500d2d[_0xff2c('0x3f')]=_[_0xff2c('0x3d')](_0x3f644e[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0x2ce922[_0xff2c('0x3c')]['fields']));_0x500d2d[_0xff2c('0x3f')]=_0x500d2d[_0xff2c('0x3f')][_0xff2c('0x41')]?_0x500d2d['attributes']:_0x3f644e[_0xff2c('0x3e')];_0x500d2d[_0xff2c('0x45')]=qs[_0xff2c('0x46')](_0x2ce922[_0xff2c('0x3c')][_0xff2c('0x46')]);_0x500d2d[_0xff2c('0x49')]=qs[_0xff2c('0x47')](_[_0xff2c('0x48')](_0x2ce922[_0xff2c('0x3c')],_0x3f644e['filters']));if(_0x2ce922[_0xff2c('0x3c')][_0xff2c('0x5a')]){_0x500d2d[_0xff2c('0x49')]=_['merge'](_0x500d2d[_0xff2c('0x49')],{'$or':_['map'](_0x500d2d[_0xff2c('0x3f')],function(_0x729371){var _0x1058df={};_0x1058df[_0x729371]={'$like':'%'+_0x2ce922[_0xff2c('0x3c')][_0xff2c('0x5a')]+'%'};return _0x1058df;})});}_0x500d2d=_[_0xff2c('0x4a')]({},_0x500d2d,_0x2ce922[_0xff2c('0x4c')]);return _0x4b8777[_0xff2c('0x5c')](_0x500d2d);}})[_0xff2c('0x1d')](function(_0xe93b60){if(_0xe93b60){_0x3b6f53=_0xe93b60[_0xff2c('0x41')];if(!_0x2ce922[_0xff2c('0x3c')]['hasOwnProperty'](_0xff2c('0x43'))){_0x500d2d[_0xff2c('0x44')]=qs[_0xff2c('0x44')](_0x2ce922['query'][_0xff2c('0x44')]);_0x500d2d[_0xff2c('0x2b')]=qs[_0xff2c('0x2b')](_0x2ce922['query']['offset']);}return _0x4b8777[_0xff2c('0x5c')](_0x500d2d);}})[_0xff2c('0x1d')](function(_0x156e55){if(_0x156e55){return _0x156e55?{'count':_0x3b6f53,'rows':_0x156e55}:null;}})[_0xff2c('0x1d')](respondWithResult(_0x1367fd,null))[_0xff2c('0x28')](handleError(_0x1367fd,null));};exports[_0xff2c('0x5d')]=function(_0x55339c,_0x32aefb,_0x168c89){var _0x2ae100={};var _0x46ec63={};var _0x3e90dc;var _0x560707;return db[_0xff2c('0x4d')][_0xff2c('0x58')]({'where':{'id':_0x55339c[_0xff2c('0x53')]['id']}})[_0xff2c('0x1d')](handleEntityNotFound(_0x32aefb,null))[_0xff2c('0x1d')](function(_0x1a7d80){if(_0x1a7d80){_0x3e90dc=_0x1a7d80;_0x46ec63[_0xff2c('0x3e')]=_['keys'](db[_0xff2c('0x5e')][_0xff2c('0x38')]);_0x46ec63[_0xff2c('0x3c')]=_['keys'](_0x55339c[_0xff2c('0x3c')]);_0x46ec63[_0xff2c('0x47')]=_[_0xff2c('0x3d')](_0x46ec63['model'],_0x46ec63['query']);_0x2ae100[_0xff2c('0x3f')]=_[_0xff2c('0x3d')](_0x46ec63[_0xff2c('0x3e')],qs[_0xff2c('0x40')](_0x55339c['query'][_0xff2c('0x40')]));_0x2ae100[_0xff2c('0x3f')]=_0x2ae100[_0xff2c('0x3f')][_0xff2c('0x41')]?_0x2ae100[_0xff2c('0x3f')]:_0x46ec63[_0xff2c('0x3e')];_0x2ae100[_0xff2c('0x45')]=qs[_0xff2c('0x46')](_0x55339c['query'][_0xff2c('0x46')]);_0x2ae100[_0xff2c('0x49')]=qs['filters'](_[_0xff2c('0x48')](_0x55339c[_0xff2c('0x3c')],_0x46ec63[_0xff2c('0x47')]));if(_0x55339c['query'][_0xff2c('0x5a')]){_0x2ae100[_0xff2c('0x49')]=_[_0xff2c('0x4a')](_0x2ae100['where'],{'$or':_['map'](_0x2ae100[_0xff2c('0x3f')],function(_0x2c4d25){var _0x450a5e={};_0x450a5e[_0x2c4d25]={'$like':'%'+_0x55339c[_0xff2c('0x3c')][_0xff2c('0x5a')]+'%'};return _0x450a5e;})});}_0x2ae100=_[_0xff2c('0x4a')]({},_0x2ae100,_0x55339c[_0xff2c('0x4c')]);return _0x3e90dc[_0xff2c('0x5d')](_0x2ae100);}})['then'](function(_0x53f73e){if(_0x53f73e){_0x560707=_0x53f73e['length'];if(!_0x55339c[_0xff2c('0x3c')]['hasOwnProperty'](_0xff2c('0x43'))){_0x2ae100['limit']=qs['limit'](_0x55339c[_0xff2c('0x3c')][_0xff2c('0x44')]);_0x2ae100[_0xff2c('0x2b')]=qs['offset'](_0x55339c[_0xff2c('0x3c')][_0xff2c('0x2b')]);}return _0x3e90dc[_0xff2c('0x5d')](_0x2ae100);}})[_0xff2c('0x1d')](function(_0x3e7a17){if(_0x3e7a17){return _0x3e7a17?{'count':_0x560707,'rows':_0x3e7a17}:null;}})[_0xff2c('0x1d')](respondWithResult(_0x32aefb,null))[_0xff2c('0x28')](handleError(_0x32aefb,null));};exports[_0xff2c('0x5f')]=function(_0x32571d,_0x14faa9,_0x2b7a89){if(_0x32571d[_0xff2c('0x56')]['id']){delete _0x32571d[_0xff2c('0x56')]['id'];}return db[_0xff2c('0x4d')][_0xff2c('0x58')]({'where':{'id':_0x32571d[_0xff2c('0x53')]['id']}})['then'](handleEntityNotFound(_0x14faa9,null))[_0xff2c('0x1d')](function(_0x4f0152){if(_0x4f0152){return _0x4f0152[_0xff2c('0x5f')](_0x32571d[_0xff2c('0x56')][_0xff2c('0x60')]||[]);}return null;})[_0xff2c('0x1d')](respondWithResult(_0x14faa9,null))[_0xff2c('0x28')](handleError(_0x14faa9,null));}; \ No newline at end of file +var _0x5636=['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','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','json','offset','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','DeskConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','type','merge','count','includeAll','findAll','rows','params','rawAttributes','length','include','options','create','body','find','getFields','nolimit','getSubjects','DeskField','getDescriptions','findOne','getTags','Tag','setTags','ids','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError'];(function(_0x2048ac,_0xb23af8){var _0x59bfcf=function(_0x431c39){while(--_0x431c39){_0x2048ac['push'](_0x2048ac['shift']());}};_0x59bfcf(++_0xb23af8);}(_0x5636,0x102));var _0x6563=function(_0x3cb470,_0x357b88){_0x3cb470=_0x3cb470-0x0;var _0xa4e54e=_0x5636[_0x3cb470];return _0xa4e54e;};'use strict';var pdf=require(_0x6563('0x0'));var emlformat=require(_0x6563('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6563('0x2'));var moment=require(_0x6563('0x3'));var BPromise=require(_0x6563('0x4'));var Mustache=require('mustache');var util=require(_0x6563('0x5'));var path=require(_0x6563('0x6'));var sox=require(_0x6563('0x7'));var csv=require(_0x6563('0x8'));var ejs=require(_0x6563('0x9'));var fs=require('fs');var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x8'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var db=require(_0x6563('0x15'))['db'];var jayson=require(_0x6563('0x16'));var client=jayson[_0x6563('0x17')][_0x6563('0x18')]({'port':0x232a});function checkPasswordPattern(_0x31d3fa,_0xbbae72,_0x447f9a){if(_0x447f9a){var _0x51aeca=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51aeca[_0x6563('0x19')](_0xbbae72)){return _0x31d3fa;}else{throw new db['Sequelize'][(_0x6563('0x1a'))](_0x6563('0x1b'));}}else{return _0x31d3fa;}}function respondWithRpcPromise(_0x33f8e4,_0x10d08c,_0x5af5d0,_0x26f26e){return new BPromise(function(_0x11baa2,_0x477d9b){var _0xd398ce=_0x26f26e||client;return _0xd398ce['request'](_0x33f8e4,_0x5af5d0)[_0x6563('0x1c')](function(_0x589632){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x10d08c,_0x6563('0x1d'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x10d08c,_0x6563('0x1d'),JSON[_0x6563('0x1e')](_0x589632));if(_0x589632[_0x6563('0x1f')]){if(_0x589632[_0x6563('0x1f')][_0x6563('0x20')]===0x1f4){logger[_0x6563('0x1f')](_0x6563('0x21'),_0x10d08c,_0x589632[_0x6563('0x1f')][_0x6563('0x22')]);return _0x477d9b(_0x589632['error'][_0x6563('0x22')]);}logger[_0x6563('0x1f')](_0x6563('0x21'),_0x10d08c,_0x589632['error'][_0x6563('0x22')]);return _0x11baa2(_0x589632['error'][_0x6563('0x22')]);}else{logger[_0x6563('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x10d08c,'request\x20sent');_0x11baa2(_0x589632[_0x6563('0x24')]['message']);}})[_0x6563('0x25')](function(_0x19f34e){logger[_0x6563('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0x10d08c,_0x19f34e);_0x477d9b(_0x19f34e);});});}function respondWithStatusCode(_0xd860d5,_0x51ff06){_0x51ff06=_0x51ff06||0xcc;return function(_0x7ea857){if(_0x7ea857){return _0xd860d5[_0x6563('0x26')](_0x51ff06);}return _0xd860d5['status'](_0x51ff06)[_0x6563('0x27')]();};}function respondWithResult(_0x28252d,_0x49a824){_0x49a824=_0x49a824||0xc8;return function(_0x2ddb2b){if(_0x2ddb2b){return _0x28252d['status'](_0x49a824)[_0x6563('0x28')](_0x2ddb2b);}};}function respondWithFilteredResult(_0x4fbb20,_0x480408){return function(_0x30f05a){if(_0x30f05a){var _0x118d31=_0x30f05a['count'],_0x17326c=_0x480408[_0x6563('0x29')],_0x2a1550=_0x480408['offset']+_0x480408['limit'],_0x3eb23b;if(_0x2a1550>=_0x118d31){_0x2a1550=_0x118d31;_0x3eb23b=0xc8;}else{_0x3eb23b=0xce;}_0x4fbb20[_0x6563('0x2a')](_0x3eb23b);return _0x4fbb20[_0x6563('0x2b')](_0x6563('0x2c'),_0x17326c+'-'+_0x2a1550+'/'+_0x118d31)[_0x6563('0x28')](_0x30f05a);}return null;};}function patchUpdates(_0x116605){return function(_0x305861){try{jsonpatch[_0x6563('0x2d')](_0x305861,_0x116605,!![]);}catch(_0x334874){return BPromise[_0x6563('0x2e')](_0x334874);}return _0x305861[_0x6563('0x2f')]();};}function saveUpdates(_0x59b1a6,_0x9b3d86){return function(_0x30b67c){if(_0x30b67c){return _0x30b67c[_0x6563('0x30')](_0x59b1a6)[_0x6563('0x1c')](function(_0x29ab06){return _0x29ab06;});}return null;};}function removeEntity(_0xb9be99,_0x1bd58a){return function(_0x571f86){if(_0x571f86){return _0x571f86[_0x6563('0x31')]()[_0x6563('0x1c')](function(){_0xb9be99[_0x6563('0x2a')](0xcc)[_0x6563('0x27')]();});}};}function handleEntityNotFound(_0x3f79da,_0x3801c1){return function(_0x574a35){if(!_0x574a35){_0x3f79da[_0x6563('0x26')](0x194);}return _0x574a35;};}function handleError(_0x3e04f3,_0x26c24b){_0x26c24b=_0x26c24b||0x1f4;return function(_0x33aa0b){logger[_0x6563('0x1f')](_0x33aa0b[_0x6563('0x32')]);if(_0x33aa0b[_0x6563('0x33')]){delete _0x33aa0b['name'];}_0x3e04f3[_0x6563('0x2a')](_0x26c24b)[_0x6563('0x34')](_0x33aa0b);};}exports['index']=function(_0xf6b446,_0x1ff47d){var _0x5b0c9f={},_0x582650={},_0x38fef5={'count':0x0,'rows':[]};var _0x5ca0ab=_[_0x6563('0x35')](db[_0x6563('0x36')]['rawAttributes'],function(_0x2d36d4){return{'name':_0x2d36d4[_0x6563('0x37')],'type':_0x2d36d4['type'][_0x6563('0x38')]};});_0x582650[_0x6563('0x39')]=_[_0x6563('0x35')](_0x5ca0ab,_0x6563('0x33'));_0x582650[_0x6563('0x3a')]=_[_0x6563('0x3b')](_0xf6b446[_0x6563('0x3a')]);_0x582650[_0x6563('0x3c')]=_[_0x6563('0x3d')](_0x582650['model'],_0x582650[_0x6563('0x3a')]);_0x5b0c9f[_0x6563('0x3e')]=_[_0x6563('0x3d')](_0x582650[_0x6563('0x39')],qs['fields'](_0xf6b446['query'][_0x6563('0x3f')]));_0x5b0c9f[_0x6563('0x3e')]=_0x5b0c9f[_0x6563('0x3e')]['length']?_0x5b0c9f[_0x6563('0x3e')]:_0x582650['model'];if(!_0xf6b446[_0x6563('0x3a')][_0x6563('0x40')]('nolimit')){_0x5b0c9f[_0x6563('0x41')]=qs[_0x6563('0x41')](_0xf6b446[_0x6563('0x3a')][_0x6563('0x41')]);_0x5b0c9f[_0x6563('0x29')]=qs[_0x6563('0x29')](_0xf6b446[_0x6563('0x3a')][_0x6563('0x29')]);}_0x5b0c9f[_0x6563('0x42')]=qs[_0x6563('0x43')](_0xf6b446[_0x6563('0x3a')]['sort']);_0x5b0c9f['where']=qs[_0x6563('0x3c')](_[_0x6563('0x44')](_0xf6b446[_0x6563('0x3a')],_0x582650[_0x6563('0x3c')]),_0x5ca0ab);if(_0xf6b446[_0x6563('0x3a')][_0x6563('0x45')]){_0x5b0c9f[_0x6563('0x46')]=_['merge'](_0x5b0c9f[_0x6563('0x46')],{'$or':_[_0x6563('0x35')](_0x5ca0ab,function(_0x41fff0){if(_0x41fff0[_0x6563('0x47')]!=='VIRTUAL'){var _0x355c97={};_0x355c97[_0x41fff0[_0x6563('0x33')]]={'$like':'%'+_0xf6b446[_0x6563('0x3a')][_0x6563('0x45')]+'%'};return _0x355c97;}})});}_0x5b0c9f=_[_0x6563('0x48')]({},_0x5b0c9f,_0xf6b446['options']);var _0x496602={'where':_0x5b0c9f[_0x6563('0x46')]};return db[_0x6563('0x36')][_0x6563('0x49')](_0x496602)['then'](function(_0x331a4e){_0x38fef5[_0x6563('0x49')]=_0x331a4e;if(_0xf6b446[_0x6563('0x3a')][_0x6563('0x4a')]){_0x5b0c9f['include']=[{'all':!![]}];}return db[_0x6563('0x36')][_0x6563('0x4b')](_0x5b0c9f);})[_0x6563('0x1c')](function(_0x55e927){_0x38fef5[_0x6563('0x4c')]=_0x55e927;return _0x38fef5;})['then'](respondWithFilteredResult(_0x1ff47d,_0x5b0c9f))[_0x6563('0x25')](handleError(_0x1ff47d,null));};exports['show']=function(_0x49090b,_0x1ef2da){var _0x11617b={'raw':![],'where':{'id':_0x49090b[_0x6563('0x4d')]['id']}},_0x2ebab0={};_0x2ebab0[_0x6563('0x39')]=_[_0x6563('0x3b')](db[_0x6563('0x36')][_0x6563('0x4e')]);_0x2ebab0[_0x6563('0x3a')]=_[_0x6563('0x3b')](_0x49090b['query']);_0x2ebab0[_0x6563('0x3c')]=_['intersection'](_0x2ebab0[_0x6563('0x39')],_0x2ebab0[_0x6563('0x3a')]);_0x11617b[_0x6563('0x3e')]=_['intersection'](_0x2ebab0[_0x6563('0x39')],qs[_0x6563('0x3f')](_0x49090b['query'][_0x6563('0x3f')]));_0x11617b[_0x6563('0x3e')]=_0x11617b[_0x6563('0x3e')][_0x6563('0x4f')]?_0x11617b[_0x6563('0x3e')]:_0x2ebab0['model'];if(_0x49090b[_0x6563('0x3a')]['includeAll']){_0x11617b[_0x6563('0x50')]=[{'all':!![]}];}_0x11617b=_['merge']({},_0x11617b,_0x49090b[_0x6563('0x51')]);return db['DeskConfiguration']['find'](_0x11617b)['then'](handleEntityNotFound(_0x1ef2da,null))['then'](respondWithResult(_0x1ef2da,null))[_0x6563('0x25')](handleError(_0x1ef2da,null));};exports['create']=function(_0x2d037c,_0x56411c){return db[_0x6563('0x36')][_0x6563('0x52')](_0x2d037c[_0x6563('0x53')],{})[_0x6563('0x1c')](respondWithResult(_0x56411c,0xc9))[_0x6563('0x25')](handleError(_0x56411c,null));};exports[_0x6563('0x30')]=function(_0x23c94a,_0xdc94f8){if(_0x23c94a[_0x6563('0x53')]['id']){delete _0x23c94a['body']['id'];}return db[_0x6563('0x36')][_0x6563('0x54')]({'where':{'id':_0x23c94a[_0x6563('0x4d')]['id']}})[_0x6563('0x1c')](handleEntityNotFound(_0xdc94f8,null))[_0x6563('0x1c')](saveUpdates(_0x23c94a[_0x6563('0x53')],null))[_0x6563('0x1c')](respondWithResult(_0xdc94f8,null))[_0x6563('0x25')](handleError(_0xdc94f8,null));};exports[_0x6563('0x31')]=function(_0x2c7e9d,_0x1fc431){return db['DeskConfiguration'][_0x6563('0x54')]({'where':{'id':_0x2c7e9d[_0x6563('0x4d')]['id']}})[_0x6563('0x1c')](handleEntityNotFound(_0x1fc431,null))[_0x6563('0x1c')](removeEntity(_0x1fc431,null))[_0x6563('0x25')](handleError(_0x1fc431,null));};exports[_0x6563('0x55')]=function(_0x3f43c2,_0x4268b2,_0x53292e){var _0xbfb2a6={};var _0x4f51d2={};var _0x1f597f;var _0x11751c;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3f43c2[_0x6563('0x4d')]['id']}})[_0x6563('0x1c')](handleEntityNotFound(_0x4268b2,null))[_0x6563('0x1c')](function(_0x39fc04){if(_0x39fc04){_0x1f597f=_0x39fc04;_0x4f51d2['model']=_[_0x6563('0x3b')](db['DeskField'][_0x6563('0x4e')]);_0x4f51d2[_0x6563('0x3a')]=_['keys'](_0x3f43c2['query']);_0x4f51d2[_0x6563('0x3c')]=_['intersection'](_0x4f51d2['model'],_0x4f51d2[_0x6563('0x3a')]);_0xbfb2a6['attributes']=_[_0x6563('0x3d')](_0x4f51d2[_0x6563('0x39')],qs[_0x6563('0x3f')](_0x3f43c2[_0x6563('0x3a')]['fields']));_0xbfb2a6[_0x6563('0x3e')]=_0xbfb2a6[_0x6563('0x3e')][_0x6563('0x4f')]?_0xbfb2a6[_0x6563('0x3e')]:_0x4f51d2[_0x6563('0x39')];_0xbfb2a6[_0x6563('0x42')]=qs[_0x6563('0x43')](_0x3f43c2[_0x6563('0x3a')]['sort']);_0xbfb2a6['where']=qs[_0x6563('0x3c')](_[_0x6563('0x44')](_0x3f43c2['query'],_0x4f51d2['filters']));if(_0x3f43c2['query'][_0x6563('0x45')]){_0xbfb2a6[_0x6563('0x46')]=_[_0x6563('0x48')](_0xbfb2a6[_0x6563('0x46')],{'$or':_['map'](_0xbfb2a6[_0x6563('0x3e')],function(_0x1a5c54){var _0x386597={};_0x386597[_0x1a5c54]={'$like':'%'+_0x3f43c2[_0x6563('0x3a')][_0x6563('0x45')]+'%'};return _0x386597;})});}_0xbfb2a6=_['merge']({},_0xbfb2a6,_0x3f43c2['options']);return _0x1f597f[_0x6563('0x55')](_0xbfb2a6);}})[_0x6563('0x1c')](function(_0x2426cd){if(_0x2426cd){_0x11751c=_0x2426cd['length'];if(!_0x3f43c2[_0x6563('0x3a')]['hasOwnProperty'](_0x6563('0x56'))){_0xbfb2a6[_0x6563('0x41')]=qs[_0x6563('0x41')](_0x3f43c2[_0x6563('0x3a')][_0x6563('0x41')]);_0xbfb2a6[_0x6563('0x29')]=qs[_0x6563('0x29')](_0x3f43c2['query']['offset']);}return _0x1f597f[_0x6563('0x55')](_0xbfb2a6);}})[_0x6563('0x1c')](function(_0x2327fe){if(_0x2327fe){return _0x2327fe?{'count':_0x11751c,'rows':_0x2327fe}:null;}})[_0x6563('0x1c')](respondWithResult(_0x4268b2,null))[_0x6563('0x25')](handleError(_0x4268b2,null));};exports[_0x6563('0x57')]=function(_0x515e98,_0x4dce49,_0x504e05){var _0x20560f={};var _0x1b7fce={};var _0x2a222e;var _0x1d8edb;return db[_0x6563('0x36')]['findOne']({'where':{'id':_0x515e98[_0x6563('0x4d')]['id']}})[_0x6563('0x1c')](handleEntityNotFound(_0x4dce49,null))[_0x6563('0x1c')](function(_0x190c2f){if(_0x190c2f){_0x2a222e=_0x190c2f;_0x1b7fce['model']=_[_0x6563('0x3b')](db[_0x6563('0x58')][_0x6563('0x4e')]);_0x1b7fce[_0x6563('0x3a')]=_[_0x6563('0x3b')](_0x515e98[_0x6563('0x3a')]);_0x1b7fce[_0x6563('0x3c')]=_[_0x6563('0x3d')](_0x1b7fce[_0x6563('0x39')],_0x1b7fce[_0x6563('0x3a')]);_0x20560f[_0x6563('0x3e')]=_[_0x6563('0x3d')](_0x1b7fce[_0x6563('0x39')],qs[_0x6563('0x3f')](_0x515e98[_0x6563('0x3a')]['fields']));_0x20560f[_0x6563('0x3e')]=_0x20560f[_0x6563('0x3e')][_0x6563('0x4f')]?_0x20560f[_0x6563('0x3e')]:_0x1b7fce[_0x6563('0x39')];_0x20560f[_0x6563('0x42')]=qs[_0x6563('0x43')](_0x515e98[_0x6563('0x3a')][_0x6563('0x43')]);_0x20560f[_0x6563('0x46')]=qs['filters'](_[_0x6563('0x44')](_0x515e98[_0x6563('0x3a')],_0x1b7fce[_0x6563('0x3c')]));if(_0x515e98[_0x6563('0x3a')][_0x6563('0x45')]){_0x20560f[_0x6563('0x46')]=_[_0x6563('0x48')](_0x20560f['where'],{'$or':_[_0x6563('0x35')](_0x20560f[_0x6563('0x3e')],function(_0x2b03b4){var _0x3aaf22={};_0x3aaf22[_0x2b03b4]={'$like':'%'+_0x515e98[_0x6563('0x3a')][_0x6563('0x45')]+'%'};return _0x3aaf22;})});}_0x20560f=_['merge']({},_0x20560f,_0x515e98[_0x6563('0x51')]);return _0x2a222e[_0x6563('0x57')](_0x20560f);}})[_0x6563('0x1c')](function(_0x4ff0fa){if(_0x4ff0fa){_0x1d8edb=_0x4ff0fa[_0x6563('0x4f')];if(!_0x515e98[_0x6563('0x3a')][_0x6563('0x40')]('nolimit')){_0x20560f['limit']=qs['limit'](_0x515e98[_0x6563('0x3a')][_0x6563('0x41')]);_0x20560f[_0x6563('0x29')]=qs[_0x6563('0x29')](_0x515e98['query'][_0x6563('0x29')]);}return _0x2a222e[_0x6563('0x57')](_0x20560f);}})['then'](function(_0x4ef39c){if(_0x4ef39c){return _0x4ef39c?{'count':_0x1d8edb,'rows':_0x4ef39c}:null;}})[_0x6563('0x1c')](respondWithResult(_0x4dce49,null))[_0x6563('0x25')](handleError(_0x4dce49,null));};exports[_0x6563('0x59')]=function(_0x2fe67b,_0x4b7821,_0x1c195c){var _0x204538={};var _0x3e5200={};var _0x22c981;var _0x24d334;return db[_0x6563('0x36')][_0x6563('0x5a')]({'where':{'id':_0x2fe67b[_0x6563('0x4d')]['id']}})[_0x6563('0x1c')](handleEntityNotFound(_0x4b7821,null))['then'](function(_0x324d0b){if(_0x324d0b){_0x22c981=_0x324d0b;_0x3e5200[_0x6563('0x39')]=_[_0x6563('0x3b')](db[_0x6563('0x58')][_0x6563('0x4e')]);_0x3e5200[_0x6563('0x3a')]=_['keys'](_0x2fe67b[_0x6563('0x3a')]);_0x3e5200[_0x6563('0x3c')]=_[_0x6563('0x3d')](_0x3e5200['model'],_0x3e5200['query']);_0x204538[_0x6563('0x3e')]=_[_0x6563('0x3d')](_0x3e5200[_0x6563('0x39')],qs[_0x6563('0x3f')](_0x2fe67b[_0x6563('0x3a')]['fields']));_0x204538['attributes']=_0x204538[_0x6563('0x3e')]['length']?_0x204538[_0x6563('0x3e')]:_0x3e5200['model'];_0x204538['order']=qs[_0x6563('0x43')](_0x2fe67b[_0x6563('0x3a')][_0x6563('0x43')]);_0x204538[_0x6563('0x46')]=qs[_0x6563('0x3c')](_[_0x6563('0x44')](_0x2fe67b[_0x6563('0x3a')],_0x3e5200[_0x6563('0x3c')]));if(_0x2fe67b['query'][_0x6563('0x45')]){_0x204538[_0x6563('0x46')]=_[_0x6563('0x48')](_0x204538[_0x6563('0x46')],{'$or':_['map'](_0x204538[_0x6563('0x3e')],function(_0x5b86bd){var _0x4345e0={};_0x4345e0[_0x5b86bd]={'$like':'%'+_0x2fe67b[_0x6563('0x3a')][_0x6563('0x45')]+'%'};return _0x4345e0;})});}_0x204538=_[_0x6563('0x48')]({},_0x204538,_0x2fe67b[_0x6563('0x51')]);return _0x22c981[_0x6563('0x59')](_0x204538);}})[_0x6563('0x1c')](function(_0x32623a){if(_0x32623a){_0x24d334=_0x32623a[_0x6563('0x4f')];if(!_0x2fe67b[_0x6563('0x3a')][_0x6563('0x40')](_0x6563('0x56'))){_0x204538['limit']=qs[_0x6563('0x41')](_0x2fe67b['query'][_0x6563('0x41')]);_0x204538[_0x6563('0x29')]=qs[_0x6563('0x29')](_0x2fe67b[_0x6563('0x3a')][_0x6563('0x29')]);}return _0x22c981[_0x6563('0x59')](_0x204538);}})[_0x6563('0x1c')](function(_0x211568){if(_0x211568){return _0x211568?{'count':_0x24d334,'rows':_0x211568}:null;}})[_0x6563('0x1c')](respondWithResult(_0x4b7821,null))[_0x6563('0x25')](handleError(_0x4b7821,null));};exports[_0x6563('0x5b')]=function(_0x5a14e8,_0x23c42c,_0x442e99){var _0xd233f5={};var _0x50709d={};var _0x345715;var _0x3b5d8e;return db[_0x6563('0x36')][_0x6563('0x5a')]({'where':{'id':_0x5a14e8[_0x6563('0x4d')]['id']}})[_0x6563('0x1c')](handleEntityNotFound(_0x23c42c,null))['then'](function(_0x40bb2f){if(_0x40bb2f){_0x345715=_0x40bb2f;_0x50709d[_0x6563('0x39')]=_['keys'](db[_0x6563('0x5c')]['rawAttributes']);_0x50709d['query']=_[_0x6563('0x3b')](_0x5a14e8[_0x6563('0x3a')]);_0x50709d[_0x6563('0x3c')]=_[_0x6563('0x3d')](_0x50709d[_0x6563('0x39')],_0x50709d[_0x6563('0x3a')]);_0xd233f5[_0x6563('0x3e')]=_[_0x6563('0x3d')](_0x50709d[_0x6563('0x39')],qs[_0x6563('0x3f')](_0x5a14e8['query'][_0x6563('0x3f')]));_0xd233f5[_0x6563('0x3e')]=_0xd233f5['attributes']['length']?_0xd233f5[_0x6563('0x3e')]:_0x50709d[_0x6563('0x39')];_0xd233f5[_0x6563('0x42')]=qs[_0x6563('0x43')](_0x5a14e8['query'][_0x6563('0x43')]);_0xd233f5['where']=qs[_0x6563('0x3c')](_[_0x6563('0x44')](_0x5a14e8[_0x6563('0x3a')],_0x50709d[_0x6563('0x3c')]));if(_0x5a14e8[_0x6563('0x3a')][_0x6563('0x45')]){_0xd233f5['where']=_['merge'](_0xd233f5[_0x6563('0x46')],{'$or':_[_0x6563('0x35')](_0xd233f5['attributes'],function(_0x26753e){var _0x59702c={};_0x59702c[_0x26753e]={'$like':'%'+_0x5a14e8['query'][_0x6563('0x45')]+'%'};return _0x59702c;})});}_0xd233f5=_[_0x6563('0x48')]({},_0xd233f5,_0x5a14e8[_0x6563('0x51')]);return _0x345715[_0x6563('0x5b')](_0xd233f5);}})['then'](function(_0x139682){if(_0x139682){_0x3b5d8e=_0x139682[_0x6563('0x4f')];if(!_0x5a14e8[_0x6563('0x3a')][_0x6563('0x40')](_0x6563('0x56'))){_0xd233f5[_0x6563('0x41')]=qs[_0x6563('0x41')](_0x5a14e8['query'][_0x6563('0x41')]);_0xd233f5[_0x6563('0x29')]=qs[_0x6563('0x29')](_0x5a14e8[_0x6563('0x3a')]['offset']);}return _0x345715['getTags'](_0xd233f5);}})[_0x6563('0x1c')](function(_0x30b501){if(_0x30b501){return _0x30b501?{'count':_0x3b5d8e,'rows':_0x30b501}:null;}})[_0x6563('0x1c')](respondWithResult(_0x23c42c,null))[_0x6563('0x25')](handleError(_0x23c42c,null));};exports[_0x6563('0x5d')]=function(_0x18e58c,_0x33df27,_0x194ddb){if(_0x18e58c[_0x6563('0x53')]['id']){delete _0x18e58c['body']['id'];}return db['DeskConfiguration'][_0x6563('0x5a')]({'where':{'id':_0x18e58c[_0x6563('0x4d')]['id']}})[_0x6563('0x1c')](handleEntityNotFound(_0x33df27,null))[_0x6563('0x1c')](function(_0x30083d){if(_0x30083d){return _0x30083d[_0x6563('0x5d')](_0x18e58c['body'][_0x6563('0x5e')]||[]);}return null;})[_0x6563('0x1c')](respondWithResult(_0x33df27,null))[_0x6563('0x25')](handleError(_0x33df27,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8c93e3c..ac2f869 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 _0x1780=['./intDeskConfiguration.attributes','define','int_desk_configurations','util','../../config/logger','api','moment','path','rimraf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1780,0xe4));var _0x0178=function(_0x24f632,_0x35a081){_0x24f632=_0x24f632-0x0;var _0x2e301b=_0x1780[_0x24f632];return _0x2e301b;};'use strict';var _=require('lodash');var util=require(_0x0178('0x0'));var logger=require(_0x0178('0x1'))(_0x0178('0x2'));var moment=require(_0x0178('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0178('0x4'));var rimraf=require(_0x0178('0x5'));var config=require('../../config/environment');var attributes=require(_0x0178('0x6'));module['exports']=function(_0x4d0ee9,_0xbdce1c){return _0x4d0ee9[_0x0178('0x7')]('DeskConfiguration',attributes,{'tableName':_0x0178('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb92b=['moment','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api'];(function(_0x7661e0,_0x3bbd7b){var _0xa30c06=function(_0x124e29){while(--_0x124e29){_0x7661e0['push'](_0x7661e0['shift']());}};_0xa30c06(++_0x3bbd7b);}(_0xb92b,0xf8));var _0xbb92=function(_0x5ba3d7,_0x222974){_0x5ba3d7=_0x5ba3d7-0x0;var _0x5b0dbc=_0xb92b[_0x5ba3d7];return _0x5b0dbc;};'use strict';var _=require(_0xbb92('0x0'));var util=require(_0xbb92('0x1'));var logger=require(_0xbb92('0x2'))(_0xbb92('0x3'));var moment=require(_0xbb92('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbb92('0x5'));var config=require(_0xbb92('0x6'));var attributes=require(_0xbb92('0x7'));module[_0xbb92('0x8')]=function(_0x849a82,_0x2ef0b9){return _0x849a82[_0xbb92('0x9')](_0xbb92('0xa'),attributes,{'tableName':_0xbb92('0xb'),'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 dcaa3a1..ff8b385 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 _0x8b1a=['rpc','../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4f7e2b,_0x591c7a){var _0xcbf189=function(_0x3ec217){while(--_0x3ec217){_0x4f7e2b['push'](_0x4f7e2b['shift']());}};_0xcbf189(++_0x591c7a);}(_0x8b1a,0x152));var _0xa8b1=function(_0xf5db0e,_0x361652){_0xf5db0e=_0xf5db0e-0x0;var _0x10bbdf=_0x8b1a[_0xf5db0e];return _0x10bbdf;};'use strict';var _=require(_0xa8b1('0x0'));var util=require(_0xa8b1('0x1'));var moment=require(_0xa8b1('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8b1('0x3'));var fs=require('fs');var Redis=require(_0xa8b1('0x4'));var db=require(_0xa8b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8b1('0x6'))(_0xa8b1('0x7'));var config=require(_0xa8b1('0x8'));var jayson=require(_0xa8b1('0x9'));var client=jayson[_0xa8b1('0xa')][_0xa8b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5db169,_0x2a3030,_0x459cf9){return new BPromise(function(_0x5d958d,_0xabb2b9){return client[_0xa8b1('0xc')](_0x5db169,_0x459cf9)['then'](function(_0x112113){logger[_0xa8b1('0xd')](_0xa8b1('0xe'),_0x2a3030,'request\x20sent');logger['debug'](_0xa8b1('0xf'),_0x2a3030,'request\x20sent',JSON[_0xa8b1('0x10')](_0x112113));if(_0x112113[_0xa8b1('0x11')]){if(_0x112113[_0xa8b1('0x11')][_0xa8b1('0x12')]===0x1f4){logger[_0xa8b1('0x11')](_0xa8b1('0xe'),_0x2a3030,_0x112113[_0xa8b1('0x11')][_0xa8b1('0x13')]);return _0xabb2b9(_0x112113['error'][_0xa8b1('0x13')]);}logger[_0xa8b1('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2a3030,_0x112113[_0xa8b1('0x11')]['message']);return _0x5d958d(_0x112113[_0xa8b1('0x11')]['message']);}else{logger[_0xa8b1('0xd')](_0xa8b1('0xe'),_0x2a3030,_0xa8b1('0x14'));_0x5d958d(_0x112113[_0xa8b1('0x15')][_0xa8b1('0x13')]);}})[_0xa8b1('0x16')](function(_0x219e46){logger[_0xa8b1('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2a3030,_0x219e46);_0xabb2b9(_0x219e46);});});} \ No newline at end of file +var _0xb6b8=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','util'];(function(_0x3d4a2b,_0xca71a8){var _0x5c55c6=function(_0x46c01a){while(--_0x46c01a){_0x3d4a2b['push'](_0x3d4a2b['shift']());}};_0x5c55c6(++_0xca71a8);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x432355,_0x4e7a24){_0x432355=_0x432355-0x0;var _0x26762b=_0xb6b8[_0x432355];return _0x26762b;};'use strict';var _=require('lodash');var util=require(_0x8b6b('0x0'));var moment=require(_0x8b6b('0x1'));var BPromise=require(_0x8b6b('0x2'));var rs=require(_0x8b6b('0x3'));var fs=require('fs');var Redis=require(_0x8b6b('0x4'));var db=require(_0x8b6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b6b('0x6'))(_0x8b6b('0x7'));var config=require(_0x8b6b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b6b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56da2a,_0x21bbc2,_0x303c21){return new BPromise(function(_0x142239,_0x21c84e){return client[_0x8b6b('0xa')](_0x56da2a,_0x303c21)[_0x8b6b('0xb')](function(_0x1f2c39){logger[_0x8b6b('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x21bbc2,'request\x20sent');logger['debug'](_0x8b6b('0xd'),_0x21bbc2,_0x8b6b('0xe'),JSON[_0x8b6b('0xf')](_0x1f2c39));if(_0x1f2c39['error']){if(_0x1f2c39[_0x8b6b('0x10')][_0x8b6b('0x11')]===0x1f4){logger['error'](_0x8b6b('0x12'),_0x21bbc2,_0x1f2c39['error'][_0x8b6b('0x13')]);return _0x21c84e(_0x1f2c39[_0x8b6b('0x10')]['message']);}logger['error'](_0x8b6b('0x12'),_0x21bbc2,_0x1f2c39['error'][_0x8b6b('0x13')]);return _0x142239(_0x1f2c39[_0x8b6b('0x10')][_0x8b6b('0x13')]);}else{logger[_0x8b6b('0xc')](_0x8b6b('0x12'),_0x21bbc2,'request\x20sent');_0x142239(_0x1f2c39[_0x8b6b('0x14')][_0x8b6b('0x13')]);}})[_0x8b6b('0x15')](function(_0x2d16c7){logger[_0x8b6b('0x10')](_0x8b6b('0x12'),_0x21bbc2,_0x2d16c7);_0x21c84e(_0x2d16c7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 605e779..c8b2b5c 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 _0x6e84=['update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0x1a8e78,_0x460f70){var _0x583e2b=function(_0xbc5424){while(--_0xbc5424){_0x1a8e78['push'](_0x1a8e78['shift']());}};_0x583e2b(++_0x460f70);}(_0x6e84,0x81));var _0x46e8=function(_0x4d699c,_0x2c6bf6){_0x4d699c=_0x4d699c-0x0;var _0x296854=_0x6e84[_0x4d699c];return _0x296854;};'use strict';var multer=require(_0x46e8('0x0'));var util=require(_0x46e8('0x1'));var path=require(_0x46e8('0x2'));var timeout=require(_0x46e8('0x3'));var express=require(_0x46e8('0x4'));var router=express['Router']();var auth=require(_0x46e8('0x5'));var interaction=require(_0x46e8('0x6'));var config=require(_0x46e8('0x7'));var controller=require(_0x46e8('0x8'));router[_0x46e8('0x9')]('/',auth[_0x46e8('0xa')](),controller[_0x46e8('0xb')]);router[_0x46e8('0x9')](_0x46e8('0xc'),auth[_0x46e8('0xa')](),controller[_0x46e8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x46e8('0xe')]('/:id',auth[_0x46e8('0xa')](),controller[_0x46e8('0xf')]);router[_0x46e8('0x10')](_0x46e8('0xc'),auth[_0x46e8('0xa')](),controller[_0x46e8('0x11')]);module['exports']=router; \ No newline at end of file +var _0x53e6=['post','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show'];(function(_0x508e00,_0x25fa22){var _0x5eed45=function(_0x1a1de9){while(--_0x1a1de9){_0x508e00['push'](_0x508e00['shift']());}};_0x5eed45(++_0x25fa22);}(_0x53e6,0x8a));var _0x653e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x53e6[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x653e('0x0'));var util=require(_0x653e('0x1'));var path=require(_0x653e('0x2'));var timeout=require(_0x653e('0x3'));var express=require(_0x653e('0x4'));var router=express[_0x653e('0x5')]();var auth=require(_0x653e('0x6'));var interaction=require(_0x653e('0x7'));var config=require(_0x653e('0x8'));var controller=require(_0x653e('0x9'));router[_0x653e('0xa')]('/',auth[_0x653e('0xb')](),controller[_0x653e('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x653e('0xd')]);router[_0x653e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x653e('0xf')]('/:id',auth[_0x653e('0xb')](),controller[_0x653e('0x10')]);router['delete'](_0x653e('0x11'),auth[_0x653e('0xb')](),controller[_0x653e('0x12')]);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 495509f..dda4a6d 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 _0xbf24=['ENUM','string','STRING','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0xbf24,0x1b6));var _0x4bf2=function(_0x4611bb,_0x16f2a7){_0x4611bb=_0x4611bb-0x0;var _0x4ab34a=_0xbf24[_0x4611bb];return _0x4ab34a;};'use strict';var Sequelize=require(_0x4bf2('0x0'));module[_0x4bf2('0x1')]={'type':{'type':Sequelize[_0x4bf2('0x2')](_0x4bf2('0x3'),'variable','customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4bf2('0x4')]},'keyType':{'type':Sequelize[_0x4bf2('0x2')]('string',_0x4bf2('0x5'),_0x4bf2('0x6'))},'keyContent':{'type':Sequelize[_0x4bf2('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4bf2('0x4')]},'customField':{'type':Sequelize[_0x4bf2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4bf2('0x4')]}}; \ No newline at end of file +var _0xf46d=['customVariable','string','STRING','ENUM','variable'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xf46d,0xb7));var _0xdf46=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0xf46d[_0x2ae8ce];return _0x4bf686;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xdf46('0x0')]('string',_0xdf46('0x1'),_0xdf46('0x2'),'keyValue'),'defaultValue':_0xdf46('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdf46('0x0')](_0xdf46('0x3'),_0xdf46('0x1'),_0xdf46('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdf46('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2262780..3cbbf77 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 _0x5bc2=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','DeskField','fieldName','type','key','model','map','query'];(function(_0xf24d4d,_0x1ad7f0){var _0x2aa863=function(_0x14ee16){while(--_0x14ee16){_0xf24d4d['push'](_0xf24d4d['shift']());}};_0x2aa863(++_0x1ad7f0);}(_0x5bc2,0xa8));var _0x25bc=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x5bc2[_0x1bb58c];return _0x277586;};'use strict';var pdf=require(_0x25bc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x25bc('0x1'));var jsonpatch=require(_0x25bc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x25bc('0x3'));var Mustache=require(_0x25bc('0x4'));var util=require('util');var path=require(_0x25bc('0x5'));var sox=require('sox');var csv=require(_0x25bc('0x6'));var ejs=require(_0x25bc('0x7'));var fs=require('fs');var _=require(_0x25bc('0x8'));var squel=require(_0x25bc('0x9'));var crypto=require(_0x25bc('0xa'));var jsforce=require(_0x25bc('0xb'));var deskjs=require(_0x25bc('0xc'));var toCsv=require(_0x25bc('0x6'));var querystring=require('querystring');var Papa=require(_0x25bc('0xd'));var Redis=require(_0x25bc('0xe'));var authService=require(_0x25bc('0xf'));var qs=require(_0x25bc('0x10'));var as=require(_0x25bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25bc('0x12'))(_0x25bc('0x13'));var utils=require(_0x25bc('0x14'));var config=require(_0x25bc('0x15'));var db=require(_0x25bc('0x16'))['db'];function respondWithStatusCode(_0x3fbe26,_0x479b5c){_0x479b5c=_0x479b5c||0xcc;return function(_0x257191){if(_0x257191){return _0x3fbe26[_0x25bc('0x17')](_0x479b5c);}return _0x3fbe26[_0x25bc('0x18')](_0x479b5c)[_0x25bc('0x19')]();};}function respondWithResult(_0xee487e,_0x1aff39){_0x1aff39=_0x1aff39||0xc8;return function(_0xf241e4){if(_0xf241e4){return _0xee487e['status'](_0x1aff39)['json'](_0xf241e4);}};}function respondWithFilteredResult(_0x44bc70,_0x144607){return function(_0xdb0d36){if(_0xdb0d36){var _0x390115=_0xdb0d36[_0x25bc('0x1a')],_0x236e3a=_0x144607[_0x25bc('0x1b')],_0xd7e16b=_0x144607['offset']+_0x144607[_0x25bc('0x1c')],_0x5d5799;if(_0xd7e16b>=_0x390115){_0xd7e16b=_0x390115;_0x5d5799=0xc8;}else{_0x5d5799=0xce;}_0x44bc70[_0x25bc('0x18')](_0x5d5799);return _0x44bc70[_0x25bc('0x1d')](_0x25bc('0x1e'),_0x236e3a+'-'+_0xd7e16b+'/'+_0x390115)[_0x25bc('0x1f')](_0xdb0d36);}return null;};}function patchUpdates(_0x5ac8ce){return function(_0x475ea9){try{jsonpatch[_0x25bc('0x20')](_0x475ea9,_0x5ac8ce,!![]);}catch(_0x2dec45){return BPromise[_0x25bc('0x21')](_0x2dec45);}return _0x475ea9['save']();};}function saveUpdates(_0xcc75a8,_0x2a12f3){return function(_0x2e5f59){if(_0x2e5f59){return _0x2e5f59[_0x25bc('0x22')](_0xcc75a8)['then'](function(_0x5795fd){return _0x5795fd;});}return null;};}function removeEntity(_0x194904,_0x4ecb16){return function(_0x659023){if(_0x659023){return _0x659023[_0x25bc('0x23')]()[_0x25bc('0x24')](function(){_0x194904[_0x25bc('0x18')](0xcc)[_0x25bc('0x19')]();});}};}function handleEntityNotFound(_0x3352d5,_0x5175e4){return function(_0x9c760){if(!_0x9c760){_0x3352d5[_0x25bc('0x17')](0x194);}return _0x9c760;};}function handleError(_0x4e2903,_0x380ea0){_0x380ea0=_0x380ea0||0x1f4;return function(_0x310fd4){logger[_0x25bc('0x25')](_0x310fd4[_0x25bc('0x26')]);if(_0x310fd4[_0x25bc('0x27')]){delete _0x310fd4[_0x25bc('0x27')];}_0x4e2903['status'](_0x380ea0)[_0x25bc('0x28')](_0x310fd4);};}exports['index']=function(_0x2e380a,_0x210ef0){var _0x4772c8={},_0x4430ac={},_0x5dc720={'count':0x0,'rows':[]};var _0x8052a0=_['map'](db[_0x25bc('0x29')]['rawAttributes'],function(_0x254ea6){return{'name':_0x254ea6[_0x25bc('0x2a')],'type':_0x254ea6[_0x25bc('0x2b')][_0x25bc('0x2c')]};});_0x4430ac[_0x25bc('0x2d')]=_[_0x25bc('0x2e')](_0x8052a0,_0x25bc('0x27'));_0x4430ac[_0x25bc('0x2f')]=_[_0x25bc('0x30')](_0x2e380a[_0x25bc('0x2f')]);_0x4430ac[_0x25bc('0x31')]=_[_0x25bc('0x32')](_0x4430ac[_0x25bc('0x2d')],_0x4430ac[_0x25bc('0x2f')]);_0x4772c8[_0x25bc('0x33')]=_[_0x25bc('0x32')](_0x4430ac['model'],qs['fields'](_0x2e380a[_0x25bc('0x2f')][_0x25bc('0x34')]));_0x4772c8['attributes']=_0x4772c8[_0x25bc('0x33')][_0x25bc('0x35')]?_0x4772c8[_0x25bc('0x33')]:_0x4430ac[_0x25bc('0x2d')];if(!_0x2e380a['query'][_0x25bc('0x36')](_0x25bc('0x37'))){_0x4772c8[_0x25bc('0x1c')]=qs[_0x25bc('0x1c')](_0x2e380a[_0x25bc('0x2f')][_0x25bc('0x1c')]);_0x4772c8['offset']=qs['offset'](_0x2e380a['query'][_0x25bc('0x1b')]);}_0x4772c8['order']=qs[_0x25bc('0x38')](_0x2e380a['query'][_0x25bc('0x38')]);_0x4772c8[_0x25bc('0x39')]=qs[_0x25bc('0x31')](_['pick'](_0x2e380a[_0x25bc('0x2f')],_0x4430ac[_0x25bc('0x31')]),_0x8052a0);if(_0x2e380a[_0x25bc('0x2f')][_0x25bc('0x3a')]){_0x4772c8[_0x25bc('0x39')]=_[_0x25bc('0x3b')](_0x4772c8[_0x25bc('0x39')],{'$or':_[_0x25bc('0x2e')](_0x8052a0,function(_0xf2a421){if(_0xf2a421[_0x25bc('0x2b')]!==_0x25bc('0x3c')){var _0x5f0922={};_0x5f0922[_0xf2a421['name']]={'$like':'%'+_0x2e380a[_0x25bc('0x2f')][_0x25bc('0x3a')]+'%'};return _0x5f0922;}})});}_0x4772c8=_[_0x25bc('0x3b')]({},_0x4772c8,_0x2e380a[_0x25bc('0x3d')]);var _0x41e72a={'where':_0x4772c8[_0x25bc('0x39')]};return db['DeskField'][_0x25bc('0x1a')](_0x41e72a)['then'](function(_0x207c60){_0x5dc720['count']=_0x207c60;if(_0x2e380a['query'][_0x25bc('0x3e')]){_0x4772c8[_0x25bc('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0x25bc('0x40')](_0x4772c8);})[_0x25bc('0x24')](function(_0x162327){_0x5dc720[_0x25bc('0x41')]=_0x162327;return _0x5dc720;})[_0x25bc('0x24')](respondWithFilteredResult(_0x210ef0,_0x4772c8))[_0x25bc('0x42')](handleError(_0x210ef0,null));};exports['show']=function(_0x29bbaa,_0x235fae){var _0x318e87={'raw':!![],'where':{'id':_0x29bbaa[_0x25bc('0x43')]['id']}},_0x257e38={};_0x257e38['model']=_[_0x25bc('0x30')](db[_0x25bc('0x29')][_0x25bc('0x44')]);_0x257e38[_0x25bc('0x2f')]=_[_0x25bc('0x30')](_0x29bbaa['query']);_0x257e38[_0x25bc('0x31')]=_[_0x25bc('0x32')](_0x257e38[_0x25bc('0x2d')],_0x257e38[_0x25bc('0x2f')]);_0x318e87[_0x25bc('0x33')]=_[_0x25bc('0x32')](_0x257e38[_0x25bc('0x2d')],qs[_0x25bc('0x34')](_0x29bbaa[_0x25bc('0x2f')][_0x25bc('0x34')]));_0x318e87['attributes']=_0x318e87[_0x25bc('0x33')][_0x25bc('0x35')]?_0x318e87[_0x25bc('0x33')]:_0x257e38[_0x25bc('0x2d')];if(_0x29bbaa[_0x25bc('0x2f')][_0x25bc('0x3e')]){_0x318e87[_0x25bc('0x3f')]=[{'all':!![]}];}_0x318e87=_['merge']({},_0x318e87,_0x29bbaa['options']);return db[_0x25bc('0x29')][_0x25bc('0x45')](_0x318e87)[_0x25bc('0x24')](handleEntityNotFound(_0x235fae,null))[_0x25bc('0x24')](respondWithResult(_0x235fae,null))[_0x25bc('0x42')](handleError(_0x235fae,null));};exports['create']=function(_0x351f3d,_0x4e4600){return db['DeskField'][_0x25bc('0x46')](_0x351f3d[_0x25bc('0x47')],{})[_0x25bc('0x24')](respondWithResult(_0x4e4600,0xc9))[_0x25bc('0x42')](handleError(_0x4e4600,null));};exports[_0x25bc('0x22')]=function(_0x156646,_0x39fe1e){if(_0x156646[_0x25bc('0x47')]['id']){delete _0x156646[_0x25bc('0x47')]['id'];}return db['DeskField'][_0x25bc('0x45')]({'where':{'id':_0x156646['params']['id']}})[_0x25bc('0x24')](handleEntityNotFound(_0x39fe1e,null))[_0x25bc('0x24')](saveUpdates(_0x156646[_0x25bc('0x47')],null))[_0x25bc('0x24')](respondWithResult(_0x39fe1e,null))[_0x25bc('0x42')](handleError(_0x39fe1e,null));};exports[_0x25bc('0x23')]=function(_0x4f7246,_0x395390){return db[_0x25bc('0x29')][_0x25bc('0x45')]({'where':{'id':_0x4f7246[_0x25bc('0x43')]['id']}})[_0x25bc('0x24')](handleEntityNotFound(_0x395390,null))[_0x25bc('0x24')](removeEntity(_0x395390,null))[_0x25bc('0x42')](handleError(_0x395390,null));}; \ No newline at end of file +var _0x0bad=['filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','type','key','model','query','keys'];(function(_0x2cd936,_0x3151a3){var _0xe30a9b=function(_0x435996){while(--_0x435996){_0x2cd936['push'](_0x2cd936['shift']());}};_0xe30a9b(++_0x3151a3);}(_0x0bad,0x1a1));var _0xd0ba=function(_0x415b10,_0x55fd39){_0x415b10=_0x415b10-0x0;var _0x55e550=_0x0bad[_0x415b10];return _0x55e550;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd0ba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0ba('0x1'));var rp=require(_0xd0ba('0x2'));var moment=require(_0xd0ba('0x3'));var BPromise=require(_0xd0ba('0x4'));var Mustache=require(_0xd0ba('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd0ba('0x6'));var csv=require('to-csv');var ejs=require(_0xd0ba('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd0ba('0x8'));var crypto=require(_0xd0ba('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd0ba('0xa'));var toCsv=require(_0xd0ba('0xb'));var querystring=require(_0xd0ba('0xc'));var Papa=require(_0xd0ba('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd0ba('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0ba('0xf'))(_0xd0ba('0x10'));var utils=require(_0xd0ba('0x11'));var config=require('../../config/environment');var db=require(_0xd0ba('0x12'))['db'];function respondWithStatusCode(_0x3c794e,_0x4aa5fe){_0x4aa5fe=_0x4aa5fe||0xcc;return function(_0x25aa04){if(_0x25aa04){return _0x3c794e[_0xd0ba('0x13')](_0x4aa5fe);}return _0x3c794e[_0xd0ba('0x14')](_0x4aa5fe)[_0xd0ba('0x15')]();};}function respondWithResult(_0x5981e8,_0x1f946f){_0x1f946f=_0x1f946f||0xc8;return function(_0x35f551){if(_0x35f551){return _0x5981e8[_0xd0ba('0x14')](_0x1f946f)[_0xd0ba('0x16')](_0x35f551);}};}function respondWithFilteredResult(_0x5900e4,_0x1e2b46){return function(_0x3c5396){if(_0x3c5396){var _0x4cc521=_0x3c5396[_0xd0ba('0x17')],_0x26927b=_0x1e2b46[_0xd0ba('0x18')],_0x11b03f=_0x1e2b46[_0xd0ba('0x18')]+_0x1e2b46[_0xd0ba('0x19')],_0x438867;if(_0x11b03f>=_0x4cc521){_0x11b03f=_0x4cc521;_0x438867=0xc8;}else{_0x438867=0xce;}_0x5900e4['status'](_0x438867);return _0x5900e4[_0xd0ba('0x1a')](_0xd0ba('0x1b'),_0x26927b+'-'+_0x11b03f+'/'+_0x4cc521)['json'](_0x3c5396);}return null;};}function patchUpdates(_0x3fdc32){return function(_0xb3deea){try{jsonpatch['apply'](_0xb3deea,_0x3fdc32,!![]);}catch(_0x3ac123){return BPromise['reject'](_0x3ac123);}return _0xb3deea[_0xd0ba('0x1c')]();};}function saveUpdates(_0x1b982d,_0x501e75){return function(_0x7c72a7){if(_0x7c72a7){return _0x7c72a7[_0xd0ba('0x1d')](_0x1b982d)[_0xd0ba('0x1e')](function(_0x36da1f){return _0x36da1f;});}return null;};}function removeEntity(_0x521a72,_0x1a0b3a){return function(_0x2da56a){if(_0x2da56a){return _0x2da56a[_0xd0ba('0x1f')]()[_0xd0ba('0x1e')](function(){_0x521a72[_0xd0ba('0x14')](0xcc)[_0xd0ba('0x15')]();});}};}function handleEntityNotFound(_0x143a6e,_0x878c87){return function(_0x50dc62){if(!_0x50dc62){_0x143a6e[_0xd0ba('0x13')](0x194);}return _0x50dc62;};}function handleError(_0x35cd06,_0xdadb7c){_0xdadb7c=_0xdadb7c||0x1f4;return function(_0x351f38){logger[_0xd0ba('0x20')](_0x351f38[_0xd0ba('0x21')]);if(_0x351f38[_0xd0ba('0x22')]){delete _0x351f38[_0xd0ba('0x22')];}_0x35cd06['status'](_0xdadb7c)[_0xd0ba('0x23')](_0x351f38);};}exports[_0xd0ba('0x24')]=function(_0x38f845,_0x51611d){var _0x1ec45d={},_0x47b1dc={},_0x43485e={'count':0x0,'rows':[]};var _0x282a18=_[_0xd0ba('0x25')](db[_0xd0ba('0x26')][_0xd0ba('0x27')],function(_0x335975){return{'name':_0x335975['fieldName'],'type':_0x335975[_0xd0ba('0x28')][_0xd0ba('0x29')]};});_0x47b1dc[_0xd0ba('0x2a')]=_[_0xd0ba('0x25')](_0x282a18,_0xd0ba('0x22'));_0x47b1dc[_0xd0ba('0x2b')]=_[_0xd0ba('0x2c')](_0x38f845[_0xd0ba('0x2b')]);_0x47b1dc[_0xd0ba('0x2d')]=_[_0xd0ba('0x2e')](_0x47b1dc[_0xd0ba('0x2a')],_0x47b1dc[_0xd0ba('0x2b')]);_0x1ec45d[_0xd0ba('0x2f')]=_[_0xd0ba('0x2e')](_0x47b1dc['model'],qs[_0xd0ba('0x30')](_0x38f845['query'][_0xd0ba('0x30')]));_0x1ec45d[_0xd0ba('0x2f')]=_0x1ec45d['attributes'][_0xd0ba('0x31')]?_0x1ec45d[_0xd0ba('0x2f')]:_0x47b1dc[_0xd0ba('0x2a')];if(!_0x38f845['query']['hasOwnProperty']('nolimit')){_0x1ec45d[_0xd0ba('0x19')]=qs[_0xd0ba('0x19')](_0x38f845[_0xd0ba('0x2b')][_0xd0ba('0x19')]);_0x1ec45d[_0xd0ba('0x18')]=qs['offset'](_0x38f845[_0xd0ba('0x2b')]['offset']);}_0x1ec45d['order']=qs[_0xd0ba('0x32')](_0x38f845[_0xd0ba('0x2b')][_0xd0ba('0x32')]);_0x1ec45d[_0xd0ba('0x33')]=qs['filters'](_[_0xd0ba('0x34')](_0x38f845[_0xd0ba('0x2b')],_0x47b1dc[_0xd0ba('0x2d')]),_0x282a18);if(_0x38f845[_0xd0ba('0x2b')][_0xd0ba('0x35')]){_0x1ec45d[_0xd0ba('0x33')]=_[_0xd0ba('0x36')](_0x1ec45d['where'],{'$or':_['map'](_0x282a18,function(_0x1260e7){if(_0x1260e7[_0xd0ba('0x28')]!==_0xd0ba('0x37')){var _0x36ebc7={};_0x36ebc7[_0x1260e7['name']]={'$like':'%'+_0x38f845[_0xd0ba('0x2b')]['filter']+'%'};return _0x36ebc7;}})});}_0x1ec45d=_['merge']({},_0x1ec45d,_0x38f845[_0xd0ba('0x38')]);var _0x5492c9={'where':_0x1ec45d[_0xd0ba('0x33')]};return db[_0xd0ba('0x26')][_0xd0ba('0x17')](_0x5492c9)['then'](function(_0x2b8787){_0x43485e[_0xd0ba('0x17')]=_0x2b8787;if(_0x38f845[_0xd0ba('0x2b')][_0xd0ba('0x39')]){_0x1ec45d['include']=[{'all':!![]}];}return db[_0xd0ba('0x26')][_0xd0ba('0x3a')](_0x1ec45d);})[_0xd0ba('0x1e')](function(_0xf39ccd){_0x43485e[_0xd0ba('0x3b')]=_0xf39ccd;return _0x43485e;})[_0xd0ba('0x1e')](respondWithFilteredResult(_0x51611d,_0x1ec45d))[_0xd0ba('0x3c')](handleError(_0x51611d,null));};exports[_0xd0ba('0x3d')]=function(_0x5aef84,_0x44714c){var _0x37dc46={'raw':!![],'where':{'id':_0x5aef84['params']['id']}},_0x1b71fb={};_0x1b71fb[_0xd0ba('0x2a')]=_[_0xd0ba('0x2c')](db[_0xd0ba('0x26')][_0xd0ba('0x27')]);_0x1b71fb[_0xd0ba('0x2b')]=_[_0xd0ba('0x2c')](_0x5aef84[_0xd0ba('0x2b')]);_0x1b71fb[_0xd0ba('0x2d')]=_['intersection'](_0x1b71fb[_0xd0ba('0x2a')],_0x1b71fb[_0xd0ba('0x2b')]);_0x37dc46[_0xd0ba('0x2f')]=_[_0xd0ba('0x2e')](_0x1b71fb[_0xd0ba('0x2a')],qs[_0xd0ba('0x30')](_0x5aef84['query'][_0xd0ba('0x30')]));_0x37dc46['attributes']=_0x37dc46[_0xd0ba('0x2f')][_0xd0ba('0x31')]?_0x37dc46[_0xd0ba('0x2f')]:_0x1b71fb[_0xd0ba('0x2a')];if(_0x5aef84['query'][_0xd0ba('0x39')]){_0x37dc46[_0xd0ba('0x3e')]=[{'all':!![]}];}_0x37dc46=_[_0xd0ba('0x36')]({},_0x37dc46,_0x5aef84[_0xd0ba('0x38')]);return db[_0xd0ba('0x26')][_0xd0ba('0x3f')](_0x37dc46)['then'](handleEntityNotFound(_0x44714c,null))[_0xd0ba('0x1e')](respondWithResult(_0x44714c,null))[_0xd0ba('0x3c')](handleError(_0x44714c,null));};exports['create']=function(_0xd70ac7,_0x2013fe){return db[_0xd0ba('0x26')][_0xd0ba('0x40')](_0xd70ac7[_0xd0ba('0x41')],{})[_0xd0ba('0x1e')](respondWithResult(_0x2013fe,0xc9))[_0xd0ba('0x3c')](handleError(_0x2013fe,null));};exports[_0xd0ba('0x1d')]=function(_0x556692,_0x21a244){if(_0x556692[_0xd0ba('0x41')]['id']){delete _0x556692[_0xd0ba('0x41')]['id'];}return db[_0xd0ba('0x26')][_0xd0ba('0x3f')]({'where':{'id':_0x556692['params']['id']}})[_0xd0ba('0x1e')](handleEntityNotFound(_0x21a244,null))[_0xd0ba('0x1e')](saveUpdates(_0x556692['body'],null))[_0xd0ba('0x1e')](respondWithResult(_0x21a244,null))['catch'](handleError(_0x21a244,null));};exports[_0xd0ba('0x1f')]=function(_0x2b1381,_0x2d58fe){return db[_0xd0ba('0x26')]['find']({'where':{'id':_0x2b1381['params']['id']}})[_0xd0ba('0x1e')](handleEntityNotFound(_0x2d58fe,null))['then'](removeEntity(_0x2d58fe,null))['catch'](handleError(_0x2d58fe,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ca174b1..b3c0e97 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 _0xcc24=['path','rimraf','../../config/environment','exports','idField','FieldId','api','moment'];(function(_0x28f858,_0x3d3f00){var _0x14da3f=function(_0x2f3545){while(--_0x2f3545){_0x28f858['push'](_0x28f858['shift']());}};_0x14da3f(++_0x3d3f00);}(_0xcc24,0x186));var _0x4cc2=function(_0x56d1a2,_0x116e7c){_0x56d1a2=_0x56d1a2-0x0;var _0x1f3486=_0xcc24[_0x56d1a2];return _0x1f3486;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4cc2('0x0'));var moment=require(_0x4cc2('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cc2('0x2'));var rimraf=require(_0x4cc2('0x3'));var config=require(_0x4cc2('0x4'));var attributes=require('./intDeskField.attributes');module[_0x4cc2('0x5')]=function(_0x4152ea,_0x440262){return _0x4152ea['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x4cc2('0x6'),_0x4cc2('0x7')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d1a=['./intDeskField.attributes','exports','DeskField','desk_unique_index','FieldId','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xd1e12,_0x4de0d6){var _0x596bc7=function(_0x3add16){while(--_0x3add16){_0xd1e12['push'](_0xd1e12['shift']());}};_0x596bc7(++_0x4de0d6);}(_0x2d1a,0x71));var _0xa2d1=function(_0x31e965,_0xbd1e54){_0x31e965=_0x31e965-0x0;var _0x120351=_0x2d1a[_0x31e965];return _0x120351;};'use strict';var _=require(_0xa2d1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2d1('0x1'));var moment=require(_0xa2d1('0x2'));var BPromise=require(_0xa2d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2d1('0x4'));var rimraf=require(_0xa2d1('0x5'));var config=require(_0xa2d1('0x6'));var attributes=require(_0xa2d1('0x7'));module[_0xa2d1('0x8')]=function(_0x4bf664,_0x3d39fd){return _0x4bf664['define'](_0xa2d1('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa2d1('0xa'),'fields':['idField',_0xa2d1('0xb')],'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 3cd2dcc..71e74de 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 _0xbf1c=['result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','message','info','DeskField,\x20%s,\x20%s'];(function(_0x2cc31d,_0x2f4467){var _0x1d84ce=function(_0x428cac){while(--_0x428cac){_0x2cc31d['push'](_0x2cc31d['shift']());}};_0x1d84ce(++_0x2f4467);}(_0xbf1c,0x1ba));var _0xcbf1=function(_0x3f9dfc,_0x3aacad){_0x3f9dfc=_0x3f9dfc-0x0;var _0x2c0568=_0xbf1c[_0x3f9dfc];return _0x2c0568;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcbf1('0x0'));var BPromise=require(_0xcbf1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbf1('0x2'));var db=require(_0xcbf1('0x3'))['db'];var utils=require(_0xcbf1('0x4'));var logger=require(_0xcbf1('0x5'))(_0xcbf1('0x6'));var config=require(_0xcbf1('0x7'));var jayson=require(_0xcbf1('0x8'));var client=jayson[_0xcbf1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18bbe8,_0xf6481c,_0x5b6745){return new BPromise(function(_0x180783,_0x100c16){return client['request'](_0x18bbe8,_0x5b6745)[_0xcbf1('0xa')](function(_0x2b7581){logger['info']('DeskField,\x20%s,\x20%s',_0xf6481c,_0xcbf1('0xb'));logger[_0xcbf1('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0xf6481c,_0xcbf1('0xb'),JSON[_0xcbf1('0xd')](_0x2b7581));if(_0x2b7581[_0xcbf1('0xe')]){if(_0x2b7581[_0xcbf1('0xe')]['code']===0x1f4){logger[_0xcbf1('0xe')]('DeskField,\x20%s,\x20%s',_0xf6481c,_0x2b7581[_0xcbf1('0xe')][_0xcbf1('0xf')]);return _0x100c16(_0x2b7581[_0xcbf1('0xe')][_0xcbf1('0xf')]);}logger['error']('DeskField,\x20%s,\x20%s',_0xf6481c,_0x2b7581[_0xcbf1('0xe')][_0xcbf1('0xf')]);return _0x180783(_0x2b7581[_0xcbf1('0xe')][_0xcbf1('0xf')]);}else{logger[_0xcbf1('0x10')](_0xcbf1('0x11'),_0xf6481c,'request\x20sent');_0x180783(_0x2b7581[_0xcbf1('0x12')][_0xcbf1('0xf')]);}})[_0xcbf1('0x13')](function(_0x335039){logger['error'](_0xcbf1('0x11'),_0xf6481c,_0x335039);_0x100c16(_0x335039);});});} \ No newline at end of file +var _0x6455=['client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1bb549,_0x272f2b){var _0x82efe2=function(_0x58afd8){while(--_0x58afd8){_0x1bb549['push'](_0x1bb549['shift']());}};_0x82efe2(++_0x272f2b);}(_0x6455,0xf4));var _0x5645=function(_0x36e172,_0x22c664){_0x36e172=_0x36e172-0x0;var _0x482ad0=_0x6455[_0x36e172];return _0x482ad0;};'use strict';var _=require('lodash');var util=require(_0x5645('0x0'));var moment=require('moment');var BPromise=require(_0x5645('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5645('0x2'));var db=require(_0x5645('0x3'))['db'];var utils=require(_0x5645('0x4'));var logger=require(_0x5645('0x5'))(_0x5645('0x6'));var config=require(_0x5645('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5645('0x8')][_0x5645('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3ed2,_0x588258,_0x59a99f){return new BPromise(function(_0x267c8e,_0x54af9e){return client[_0x5645('0xa')](_0x5f3ed2,_0x59a99f)[_0x5645('0xb')](function(_0x217582){logger[_0x5645('0xc')](_0x5645('0xd'),_0x588258,_0x5645('0xe'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x588258,_0x5645('0xe'),JSON[_0x5645('0xf')](_0x217582));if(_0x217582[_0x5645('0x10')]){if(_0x217582[_0x5645('0x10')][_0x5645('0x11')]===0x1f4){logger[_0x5645('0x10')](_0x5645('0xd'),_0x588258,_0x217582[_0x5645('0x10')][_0x5645('0x12')]);return _0x54af9e(_0x217582[_0x5645('0x10')][_0x5645('0x12')]);}logger[_0x5645('0x10')]('DeskField,\x20%s,\x20%s',_0x588258,_0x217582[_0x5645('0x10')][_0x5645('0x12')]);return _0x267c8e(_0x217582['error']['message']);}else{logger[_0x5645('0xc')](_0x5645('0xd'),_0x588258,_0x5645('0xe'));_0x267c8e(_0x217582[_0x5645('0x13')][_0x5645('0x12')]);}})[_0x5645('0x14')](function(_0x642862){logger[_0x5645('0x10')]('DeskField,\x20%s,\x20%s',_0x588258,_0x642862);_0x54af9e(_0x642862);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 62764fa..3658dc6 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 _0x0376=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','multer','util','path','Router','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0376,0xe5));var _0x6037=function(_0x23b5cc,_0x1ea415){_0x23b5cc=_0x23b5cc-0x0;var _0x6a640d=_0x0376[_0x23b5cc];return _0x6a640d;};'use strict';var multer=require(_0x6037('0x0'));var util=require(_0x6037('0x1'));var path=require(_0x6037('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6037('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6037('0x4'));var controller=require(_0x6037('0x5'));router[_0x6037('0x6')]('/',auth[_0x6037('0x7')](),controller[_0x6037('0x8')]);router['get'](_0x6037('0x9'),auth[_0x6037('0x7')](),controller[_0x6037('0xa')]);router[_0x6037('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x6037('0xb')]);router['get'](_0x6037('0xc'),auth[_0x6037('0x7')](),controller[_0x6037('0xd')]);router[_0x6037('0xe')]('/',auth['isAuthenticated'](),controller[_0x6037('0xf')]);router[_0x6037('0xe')](_0x6037('0x10'),auth[_0x6037('0x7')](),controller[_0x6037('0x11')]);router[_0x6037('0x12')](_0x6037('0x9'),auth[_0x6037('0x7')](),controller['update']);router[_0x6037('0x13')]('/:id',auth[_0x6037('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x75bd=['create','addConfiguration','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x75bd,0x1d2));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xd75b('0x0'));var util=require(_0xd75b('0x1'));var path=require(_0xd75b('0x2'));var timeout=require(_0xd75b('0x3'));var express=require(_0xd75b('0x4'));var router=express[_0xd75b('0x5')]();var auth=require(_0xd75b('0x6'));var interaction=require(_0xd75b('0x7'));var config=require(_0xd75b('0x8'));var controller=require('./intDynamics365Account.controller');router[_0xd75b('0x9')]('/',auth[_0xd75b('0xa')](),controller[_0xd75b('0xb')]);router[_0xd75b('0x9')]('/:id',auth[_0xd75b('0xa')](),controller[_0xd75b('0xc')]);router[_0xd75b('0x9')](_0xd75b('0xd'),auth[_0xd75b('0xa')](),controller['getConfigurations']);router[_0xd75b('0x9')](_0xd75b('0xe'),auth[_0xd75b('0xa')](),controller[_0xd75b('0xf')]);router[_0xd75b('0x10')]('/',auth[_0xd75b('0xa')](),controller[_0xd75b('0x11')]);router[_0xd75b('0x10')](_0xd75b('0xd'),auth['isAuthenticated'](),controller[_0xd75b('0x12')]);router[_0xd75b('0x13')](_0xd75b('0x14'),auth['isAuthenticated'](),controller[_0xd75b('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd75b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 24b7a62..d818f72 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 _0x4a04=['STRING'];(function(_0x1f369c,_0x24c38c){var _0x4c669e=function(_0x1f4b83){while(--_0x1f4b83){_0x1f369c['push'](_0x1f369c['shift']());}};_0x4c669e(++_0x24c38c);}(_0x4a04,0x125));var _0x44a0=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x4a04[_0x5e2cb4];return _0x282902;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x44a0('0x0')]},'username':{'type':Sequelize[_0x44a0('0x0')]},'password':{'type':Sequelize[_0x44a0('0x0')]},'remoteUri':{'type':Sequelize[_0x44a0('0x0')]},'tenantId':{'type':Sequelize[_0x44a0('0x0')]},'clientId':{'type':Sequelize[_0x44a0('0x0')]},'clientSecret':{'type':Sequelize[_0x44a0('0x0')]},'serverUrl':{'type':Sequelize[_0x44a0('0x0')]},'description':{'type':Sequelize[_0x44a0('0x0')]}}; \ No newline at end of file +var _0x0c75=['STRING','sequelize'];(function(_0x1a2d1c,_0x4a1873){var _0x56eb67=function(_0x295a7d){while(--_0x295a7d){_0x1a2d1c['push'](_0x1a2d1c['shift']());}};_0x56eb67(++_0x4a1873);}(_0x0c75,0x83));var _0x50c7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c75[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x50c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x50c7('0x1')]},'username':{'type':Sequelize[_0x50c7('0x1')]},'password':{'type':Sequelize[_0x50c7('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x50c7('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x50c7('0x1')]},'serverUrl':{'type':Sequelize[_0x50c7('0x1')]},'description':{'type':Sequelize[_0x50c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 66fbc29..534c87d 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 _0xd3d3=['Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','then','name','send','index','map','Dynamics365Account','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','filter','includeAll','rows','show','rawAttributes','include','merge','options','find','create','body','params','getConfigurations','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','ticketType','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','4.0','OptionSet','TrueOption','FalseOption','false','?$select=DisplayName,LogicalName','rimraf','zip-dir','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xd3d3[_0x409353];return _0x4f4b59;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3d3d('0x0'));var zipdir=require(_0x3d3d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d3d('0x2'));var Mustache=require(_0x3d3d('0x3'));var util=require(_0x3d3d('0x4'));var path=require('path');var sox=require(_0x3d3d('0x5'));var csv=require('to-csv');var ejs=require(_0x3d3d('0x6'));var fs=require('fs');var _=require(_0x3d3d('0x7'));var squel=require(_0x3d3d('0x8'));var crypto=require(_0x3d3d('0x9'));var jsforce=require(_0x3d3d('0xa'));var deskjs=require(_0x3d3d('0xb'));var toCsv=require(_0x3d3d('0xc'));var querystring=require('querystring');var Papa=require(_0x3d3d('0xd'));var Redis=require(_0x3d3d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d3d('0xf'));var as=require(_0x3d3d('0x10'));var hardwareService=require(_0x3d3d('0x11'));var logger=require(_0x3d3d('0x12'))(_0x3d3d('0x13'));var utils=require(_0x3d3d('0x14'));var config=require('../../config/environment');var db=require(_0x3d3d('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3d3d('0x16'));var client=jayson[_0x3d3d('0x17')][_0x3d3d('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5523b0,_0x14a6ab,_0x1c5121){if(_0x1c5121){var _0x25305d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25305d['test'](_0x14a6ab)){return _0x5523b0;}else{throw new db[(_0x3d3d('0x19'))][(_0x3d3d('0x1a'))](_0x3d3d('0x1b'));}}else{return _0x5523b0;}}function respondWithRpcPromise(_0x16274f,_0xb02393,_0x22bb7d,_0x3840b8){return new BPromise(function(_0x4974e0,_0x2190ff){var _0x1ac8d2=_0x3840b8||client;return _0x1ac8d2[_0x3d3d('0x1c')](_0x16274f,_0x22bb7d)['then'](function(_0x9e2afa){logger[_0x3d3d('0x1d')](_0x3d3d('0x1e'),_0xb02393,_0x3d3d('0x1f'));logger[_0x3d3d('0x20')](_0x3d3d('0x21'),_0xb02393,_0x3d3d('0x1f'),JSON['stringify'](_0x9e2afa));if(_0x9e2afa[_0x3d3d('0x22')]){if(_0x9e2afa['error'][_0x3d3d('0x23')]===0x1f4){logger[_0x3d3d('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0xb02393,_0x9e2afa['error'][_0x3d3d('0x24')]);return _0x2190ff(_0x9e2afa[_0x3d3d('0x22')][_0x3d3d('0x24')]);}logger[_0x3d3d('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0xb02393,_0x9e2afa[_0x3d3d('0x22')][_0x3d3d('0x24')]);return _0x4974e0(_0x9e2afa[_0x3d3d('0x22')]['message']);}else{logger[_0x3d3d('0x1d')](_0x3d3d('0x1e'),_0xb02393,_0x3d3d('0x1f'));_0x4974e0(_0x9e2afa['result']['message']);}})[_0x3d3d('0x25')](function(_0x38cd63){logger[_0x3d3d('0x22')](_0x3d3d('0x1e'),_0xb02393,_0x38cd63);_0x2190ff(_0x38cd63);});});}function respondWithStatusCode(_0x58e7b4,_0x421d04){_0x421d04=_0x421d04||0xcc;return function(_0x474b0c){if(_0x474b0c){return _0x58e7b4[_0x3d3d('0x26')](_0x421d04);}return _0x58e7b4[_0x3d3d('0x27')](_0x421d04)[_0x3d3d('0x28')]();};}function respondWithResult(_0x322c7d,_0x158504){_0x158504=_0x158504||0xc8;return function(_0x50fbad){if(_0x50fbad){return _0x322c7d['status'](_0x158504)['json'](_0x50fbad);}};}function respondWithFilteredResult(_0x566dd8,_0x5bf25b){return function(_0x51c8fb){if(_0x51c8fb){var _0xfda534=_0x51c8fb[_0x3d3d('0x29')],_0x8dadd6=_0x5bf25b[_0x3d3d('0x2a')],_0x41464f=_0x5bf25b[_0x3d3d('0x2a')]+_0x5bf25b['limit'],_0x45a836;if(_0x41464f>=_0xfda534){_0x41464f=_0xfda534;_0x45a836=0xc8;}else{_0x45a836=0xce;}_0x566dd8[_0x3d3d('0x27')](_0x45a836);return _0x566dd8[_0x3d3d('0x2b')](_0x3d3d('0x2c'),_0x8dadd6+'-'+_0x41464f+'/'+_0xfda534)[_0x3d3d('0x2d')](_0x51c8fb);}return null;};}function patchUpdates(_0x237815){return function(_0x102857){try{jsonpatch['apply'](_0x102857,_0x237815,!![]);}catch(_0xcedc9e){return BPromise[_0x3d3d('0x2e')](_0xcedc9e);}return _0x102857[_0x3d3d('0x2f')]();};}function saveUpdates(_0x3dfcf9,_0x15c3e6){return function(_0x5b14d2){if(_0x5b14d2){return _0x5b14d2['update'](_0x3dfcf9)[_0x3d3d('0x30')](function(_0x44bffe){return _0x44bffe;});}return null;};}function removeEntity(_0x1e2862,_0x225a2c){return function(_0x55f849){if(_0x55f849){return _0x55f849['destroy']()[_0x3d3d('0x30')](function(){_0x1e2862[_0x3d3d('0x27')](0xcc)[_0x3d3d('0x28')]();});}};}function handleEntityNotFound(_0x9cabd4,_0x4167fb){return function(_0xde1035){if(!_0xde1035){_0x9cabd4[_0x3d3d('0x26')](0x194);}return _0xde1035;};}function handleError(_0x2f711a,_0x214e8a){_0x214e8a=_0x214e8a||0x1f4;return function(_0x1651c0){logger[_0x3d3d('0x22')](_0x1651c0['stack']);if(_0x1651c0[_0x3d3d('0x31')]){delete _0x1651c0[_0x3d3d('0x31')];}_0x2f711a[_0x3d3d('0x27')](_0x214e8a)[_0x3d3d('0x32')](_0x1651c0);};}exports[_0x3d3d('0x33')]=function(_0x173eca,_0x11bc78){var _0x1edd49={},_0x349494={},_0x535430={'count':0x0,'rows':[]};var _0x4c2585=_[_0x3d3d('0x34')](db[_0x3d3d('0x35')]['rawAttributes'],function(_0x28dde0){return{'name':_0x28dde0[_0x3d3d('0x36')],'type':_0x28dde0['type'][_0x3d3d('0x37')]};});_0x349494[_0x3d3d('0x38')]=_[_0x3d3d('0x34')](_0x4c2585,_0x3d3d('0x31'));_0x349494['query']=_[_0x3d3d('0x39')](_0x173eca[_0x3d3d('0x3a')]);_0x349494[_0x3d3d('0x3b')]=_[_0x3d3d('0x3c')](_0x349494[_0x3d3d('0x38')],_0x349494['query']);_0x1edd49[_0x3d3d('0x3d')]=_[_0x3d3d('0x3c')](_0x349494['model'],qs[_0x3d3d('0x3e')](_0x173eca[_0x3d3d('0x3a')][_0x3d3d('0x3e')]));_0x1edd49['attributes']=_0x1edd49[_0x3d3d('0x3d')]['length']?_0x1edd49[_0x3d3d('0x3d')]:_0x349494[_0x3d3d('0x38')];if(!_0x173eca['query'][_0x3d3d('0x3f')](_0x3d3d('0x40'))){_0x1edd49[_0x3d3d('0x41')]=qs[_0x3d3d('0x41')](_0x173eca[_0x3d3d('0x3a')][_0x3d3d('0x41')]);_0x1edd49['offset']=qs['offset'](_0x173eca['query'][_0x3d3d('0x2a')]);}_0x1edd49[_0x3d3d('0x42')]=qs[_0x3d3d('0x43')](_0x173eca[_0x3d3d('0x3a')][_0x3d3d('0x43')]);_0x1edd49[_0x3d3d('0x44')]=qs['filters'](_[_0x3d3d('0x45')](_0x173eca[_0x3d3d('0x3a')],_0x349494[_0x3d3d('0x3b')]),_0x4c2585);if(_0x173eca[_0x3d3d('0x3a')]['filter']){_0x1edd49[_0x3d3d('0x44')]=_['merge'](_0x1edd49[_0x3d3d('0x44')],{'$or':_[_0x3d3d('0x34')](_0x4c2585,function(_0x406937){if(_0x406937[_0x3d3d('0x46')]!=='VIRTUAL'){var _0x3a3e02={};_0x3a3e02[_0x406937[_0x3d3d('0x31')]]={'$like':'%'+_0x173eca['query'][_0x3d3d('0x47')]+'%'};return _0x3a3e02;}})});}_0x1edd49=_['merge']({},_0x1edd49,_0x173eca['options']);var _0x54d288={'where':_0x1edd49[_0x3d3d('0x44')]};return db['Dynamics365Account'][_0x3d3d('0x29')](_0x54d288)['then'](function(_0x4e59bd){_0x535430['count']=_0x4e59bd;if(_0x173eca[_0x3d3d('0x3a')][_0x3d3d('0x48')]){_0x1edd49['include']=[{'all':!![]}];}return db[_0x3d3d('0x35')]['findAll'](_0x1edd49);})[_0x3d3d('0x30')](function(_0x40fd57){_0x535430[_0x3d3d('0x49')]=_0x40fd57;return _0x535430;})[_0x3d3d('0x30')](respondWithFilteredResult(_0x11bc78,_0x1edd49))[_0x3d3d('0x25')](handleError(_0x11bc78,null));};exports[_0x3d3d('0x4a')]=function(_0x1825e8,_0x437782){var _0x1a3220={'raw':![],'where':{'id':_0x1825e8['params']['id']}},_0x449111={};_0x449111[_0x3d3d('0x38')]=_[_0x3d3d('0x39')](db[_0x3d3d('0x35')][_0x3d3d('0x4b')]);_0x449111[_0x3d3d('0x3a')]=_['keys'](_0x1825e8[_0x3d3d('0x3a')]);_0x449111[_0x3d3d('0x3b')]=_[_0x3d3d('0x3c')](_0x449111[_0x3d3d('0x38')],_0x449111[_0x3d3d('0x3a')]);_0x1a3220[_0x3d3d('0x3d')]=_['intersection'](_0x449111[_0x3d3d('0x38')],qs['fields'](_0x1825e8[_0x3d3d('0x3a')][_0x3d3d('0x3e')]));_0x1a3220['attributes']=_0x1a3220['attributes']['length']?_0x1a3220[_0x3d3d('0x3d')]:_0x449111[_0x3d3d('0x38')];if(_0x1825e8['query']['includeAll']){_0x1a3220[_0x3d3d('0x4c')]=[{'all':!![]}];}_0x1a3220=_[_0x3d3d('0x4d')]({},_0x1a3220,_0x1825e8[_0x3d3d('0x4e')]);return db[_0x3d3d('0x35')][_0x3d3d('0x4f')](_0x1a3220)[_0x3d3d('0x30')](handleEntityNotFound(_0x437782,null))[_0x3d3d('0x30')](respondWithResult(_0x437782,null))[_0x3d3d('0x25')](handleError(_0x437782,null));};exports['create']=function(_0x24418d,_0xcd5267){return db['Dynamics365Account'][_0x3d3d('0x50')](_0x24418d[_0x3d3d('0x51')],{})[_0x3d3d('0x30')](respondWithResult(_0xcd5267,0xc9))[_0x3d3d('0x25')](handleError(_0xcd5267,null));};exports['update']=function(_0x4b3bf7,_0x4ef593){if(_0x4b3bf7['body']['id']){delete _0x4b3bf7[_0x3d3d('0x51')]['id'];}return db['Dynamics365Account'][_0x3d3d('0x4f')]({'where':{'id':_0x4b3bf7['params']['id']}})[_0x3d3d('0x30')](handleEntityNotFound(_0x4ef593,null))[_0x3d3d('0x30')](saveUpdates(_0x4b3bf7[_0x3d3d('0x51')],null))[_0x3d3d('0x30')](respondWithResult(_0x4ef593,null))[_0x3d3d('0x25')](handleError(_0x4ef593,null));};exports['destroy']=function(_0x4c0e60,_0x3bc158){return db[_0x3d3d('0x35')]['find']({'where':{'id':_0x4c0e60[_0x3d3d('0x52')]['id']}})['then'](handleEntityNotFound(_0x3bc158,null))[_0x3d3d('0x30')](removeEntity(_0x3bc158,null))['catch'](handleError(_0x3bc158,null));};exports[_0x3d3d('0x53')]=function(_0x3f3645,_0x8385af,_0xbfca01){var _0x4cfab1={};var _0x1a45b5={};var _0x51ad49;var _0x33ea78;return db[_0x3d3d('0x35')]['findOne']({'where':{'id':_0x3f3645[_0x3d3d('0x52')]['id']}})[_0x3d3d('0x30')](handleEntityNotFound(_0x8385af,null))[_0x3d3d('0x30')](function(_0x248581){if(_0x248581){_0x51ad49=_0x248581;_0x1a45b5['model']=_[_0x3d3d('0x39')](db['Dynamics365Configuration'][_0x3d3d('0x4b')]);_0x1a45b5[_0x3d3d('0x3a')]=_[_0x3d3d('0x39')](_0x3f3645[_0x3d3d('0x3a')]);_0x1a45b5[_0x3d3d('0x3b')]=_['intersection'](_0x1a45b5['model'],_0x1a45b5[_0x3d3d('0x3a')]);_0x4cfab1[_0x3d3d('0x3d')]=_['intersection'](_0x1a45b5[_0x3d3d('0x38')],qs[_0x3d3d('0x3e')](_0x3f3645['query'][_0x3d3d('0x3e')]));_0x4cfab1['attributes']=_0x4cfab1[_0x3d3d('0x3d')][_0x3d3d('0x54')]?_0x4cfab1['attributes']:_0x1a45b5[_0x3d3d('0x38')];_0x4cfab1['order']=qs['sort'](_0x3f3645['query'][_0x3d3d('0x43')]);_0x4cfab1[_0x3d3d('0x44')]=qs[_0x3d3d('0x3b')](_[_0x3d3d('0x45')](_0x3f3645[_0x3d3d('0x3a')],_0x1a45b5['filters']));if(_0x3f3645['query'][_0x3d3d('0x47')]){_0x4cfab1[_0x3d3d('0x44')]=_[_0x3d3d('0x4d')](_0x4cfab1[_0x3d3d('0x44')],{'$or':_[_0x3d3d('0x34')](_0x4cfab1['attributes'],function(_0x309c94){var _0x41025d={};_0x41025d[_0x309c94]={'$like':'%'+_0x3f3645[_0x3d3d('0x3a')][_0x3d3d('0x47')]+'%'};return _0x41025d;})});}_0x4cfab1=_[_0x3d3d('0x4d')]({},_0x4cfab1,_0x3f3645[_0x3d3d('0x4e')]);return _0x51ad49[_0x3d3d('0x53')](_0x4cfab1);}})[_0x3d3d('0x30')](function(_0x18334e){if(_0x18334e){_0x33ea78=_0x18334e[_0x3d3d('0x54')];if(!_0x3f3645[_0x3d3d('0x3a')][_0x3d3d('0x3f')]('nolimit')){_0x4cfab1['limit']=qs[_0x3d3d('0x41')](_0x3f3645[_0x3d3d('0x3a')]['limit']);_0x4cfab1[_0x3d3d('0x2a')]=qs[_0x3d3d('0x2a')](_0x3f3645[_0x3d3d('0x3a')][_0x3d3d('0x2a')]);}return _0x51ad49[_0x3d3d('0x53')](_0x4cfab1);}})[_0x3d3d('0x30')](function(_0x1e108a){if(_0x1e108a){return _0x1e108a?{'count':_0x33ea78,'rows':_0x1e108a}:null;}})[_0x3d3d('0x30')](respondWithResult(_0x8385af,null))[_0x3d3d('0x25')](handleError(_0x8385af,null));};exports[_0x3d3d('0x55')]=function(_0x44c5c2,_0x4d9bb0,_0x8e970){if(_0x44c5c2['body']['id']){delete _0x44c5c2[_0x3d3d('0x51')]['id'];}return db[_0x3d3d('0x35')][_0x3d3d('0x56')]({'where':{'id':_0x44c5c2['params']['id']}})['then'](handleEntityNotFound(_0x4d9bb0,null))[_0x3d3d('0x30')](function(_0x520d1e){if(_0x520d1e){_0x44c5c2[_0x3d3d('0x51')][_0x3d3d('0x57')]=_0x520d1e['id'];_0x44c5c2[_0x3d3d('0x51')][_0x3d3d('0x58')]=integrations[_0x3d3d('0x59')](_0x44c5c2[_0x3d3d('0x51')][_0x3d3d('0x5a')],_0x44c5c2[_0x3d3d('0x51')]['type']);_0x44c5c2['body'][_0x3d3d('0x5b')]=integrations[_0x3d3d('0x5c')](_0x44c5c2[_0x3d3d('0x51')][_0x3d3d('0x5a')],_0x44c5c2[_0x3d3d('0x51')][_0x3d3d('0x46')]);return db[_0x3d3d('0x5d')][_0x3d3d('0x50')](_0x44c5c2['body'],{'include':[{'model':db[_0x3d3d('0x5e')],'as':'Subjects'},{'model':db[_0x3d3d('0x5e')],'as':_0x3d3d('0x5b')}]});}return null;})[_0x3d3d('0x30')](respondWithResult(_0x4d9bb0,null))[_0x3d3d('0x25')](handleError(_0x4d9bb0,null));};exports['getFields']=function(_0x1b6f14,_0x20bb3d,_0x537be5){var _0x33e0be=_0x1b6f14[_0x3d3d('0x3a')][_0x3d3d('0x5f')];var _0x52f1d1=_0x33e0be==='incident'?_0x3d3d('0x60'):_0x3d3d('0x61');var _0x3fecf5='';var _0x55efc8='';var _0x1ed60e='';var _0x1417b5='';var _0x30de4e='';var _0x1b7983='';var _0xe664ad='';var _0x51f83e='';var _0x563264=[_0x3d3d('0x62'),'description','customerid',_0x3d3d('0x63'),_0x3d3d('0x64'),_0x3d3d('0x65'),_0x3d3d('0x66'),'regardingobjectid',_0x3d3d('0x67'),'phonecall_activity_parties'];var _0x570054=[_0x3d3d('0x68'),_0x3d3d('0x69'),_0x3d3d('0x6a'),_0x3d3d('0x6b'),_0x3d3d('0x6c'),_0x3d3d('0x6d'),_0x3d3d('0x6e'),_0x3d3d('0x6f'),_0x3d3d('0x70'),_0x3d3d('0x71'),_0x3d3d('0x72'),_0x3d3d('0x73'),_0x3d3d('0x74'),_0x3d3d('0x75'),_0x3d3d('0x76'),'customeridname',_0x3d3d('0x77'),_0x3d3d('0x78'),_0x3d3d('0x79'),_0x3d3d('0x7a'),'entityimage_timestamp','entityimage_url',_0x3d3d('0x7b'),_0x3d3d('0x7c'),_0x3d3d('0x7d'),_0x3d3d('0x7e'),_0x3d3d('0x7f'),_0x3d3d('0x80'),_0x3d3d('0x81'),_0x3d3d('0x82'),_0x3d3d('0x83'),_0x3d3d('0x84'),_0x3d3d('0x85'),_0x3d3d('0x86'),_0x3d3d('0x87'),'modifiedon',_0x3d3d('0x88'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x3d3d('0x89'),_0x3d3d('0x8a'),_0x3d3d('0x8b'),_0x3d3d('0x8c'),_0x3d3d('0x8d'),'owneridtype',_0x3d3d('0x8e'),_0x3d3d('0x8f'),'primarycontactidname',_0x3d3d('0x90'),_0x3d3d('0x91'),_0x3d3d('0x92'),_0x3d3d('0x93'),'resolveby',_0x3d3d('0x94'),_0x3d3d('0x95'),'responsiblecontactidname','responsiblecontactidyominame',_0x3d3d('0x96'),_0x3d3d('0x97'),_0x3d3d('0x98'),_0x3d3d('0x99'),_0x3d3d('0x9a'),_0x3d3d('0x9b'),_0x3d3d('0x9c'),_0x3d3d('0x9d'),_0x3d3d('0x9e'),_0x3d3d('0x9f'),_0x3d3d('0xa0'),'utcconversiontimezonecode',_0x3d3d('0xa1')];var _0x34fa27=_0x563264[_0x3d3d('0xa2')](_0x570054);return db[_0x3d3d('0x35')][_0x3d3d('0x56')]({'where':{'id':_0x1b6f14[_0x3d3d('0x52')]['id']},'attributes':['id',_0x3d3d('0xa3'),_0x3d3d('0xa4'),_0x3d3d('0xa5'),_0x3d3d('0xa6'),_0x3d3d('0xa7'),_0x3d3d('0xa8')]})['then'](handleEntityNotFound(_0x20bb3d,null))[_0x3d3d('0x30')](function(_0x36097a){if(_0x36097a){_0x51f83e=_0x36097a['remoteUri'];var _0x30c2ae=_0x51f83e[_0x3d3d('0xa9')](-0x1);if(_0x30c2ae==='/'){_0x51f83e=_0x51f83e[_0x3d3d('0xaa')](0x0,_0x51f83e[_0x3d3d('0xab')](_0x30c2ae));}_0xe664ad=util[_0x3d3d('0xac')](_0x3d3d('0xad'),_0x51f83e);var _0x1b6fd4={'method':'POST','uri':_0x3d3d('0xae')+_0x36097a['tenantId']+_0x3d3d('0xaf'),'form':{'client_id':_0x36097a[_0x3d3d('0xa7')],'resource':_0x51f83e,'username':_0x36097a[_0x3d3d('0xa3')],'password':_0x36097a[_0x3d3d('0xa4')],'grant_type':_0x3d3d('0xa4'),'client_secret':_0x36097a[_0x3d3d('0xa8')]},'json':!![]};return rp(_0x1b6fd4);}})['then'](function(_0x108fa2){_0x1b7983=_0x108fa2[_0x3d3d('0xb0')];var _0x3d73ad={'method':_0x3d3d('0xb1'),'uri':encodeURI(_0xe664ad+_0x3d3d('0xb2')+_0x52f1d1+'\x27'),'headers':{'Authorization':_0x3d3d('0xb3')+_0x1b7983,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3d73ad);})['then'](function(_0x5e06ed){var _0x13d0ad=_0x5e06ed['value'][0x0];var _0x234852=_0x13d0ad[_0x3d3d('0xb4')];var _0x31ead2={'method':_0x3d3d('0xb1'),'uri':_0xe664ad+_0x3d3d('0xb5')+_0x234852+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x3d3d('0xb3')+_0x1b7983,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x31ead2);})[_0x3d3d('0x30')](function(_0x21f873){_0x3fecf5=_0x21f873;_0x55efc8=_0x3fecf5[_0x3d3d('0xb6')];_0x55efc8=_['remove'](_0x55efc8,function(_0x34b16e){return!_0x34fa27[_0x3d3d('0xb7')](_0x34b16e[_0x3d3d('0xb8')]);});var _0x131921=[];var _0x85ff1f=[];_0x55efc8[_0x3d3d('0xb9')](function(_0x7b801a){if(_0x7b801a[_0x3d3d('0xba')]){var _0x14455b=_0x7b801a[_0x3d3d('0xba')][_0x3d3d('0xaa')](_0x7b801a[_0x3d3d('0xba')][_0x3d3d('0xab')]('.')+0x1);if(_0x14455b===_0x3d3d('0xbb')){_0x131921[_0x3d3d('0xbc')](getSelectList(_0xe664ad,_0x33e0be,_0x85ff1f,_0x3fecf5[_0x3d3d('0xb4')],_0x7b801a[_0x3d3d('0xb4')],_0x1b7983));}}});return Promise[_0x3d3d('0xbd')](_0x131921);})['then'](function(_0x119eac){_0x1ed60e=_0x119eac[0x0];var _0x57970f=[];var _0x277ffb=[];_0x55efc8[_0x3d3d('0xb9')](function(_0x366b92){if(!_[_0x3d3d('0xbe')](_0x366b92[_0x3d3d('0xba')])){var _0x5df276=_0x366b92['@odata.type'][_0x3d3d('0xaa')](_0x366b92['@odata.type'][_0x3d3d('0xab')]('.')+0x1);if(_0x5df276===_0x3d3d('0xbf')){_0x57970f[_0x3d3d('0xbc')](getBooleanList(_0xe664ad,_0x33e0be,_0x277ffb,_0x3fecf5[_0x3d3d('0xb4')],_0x366b92[_0x3d3d('0xb4')],_0x1b7983));}}});return Promise[_0x3d3d('0xbd')](_0x57970f);})[_0x3d3d('0x30')](function(_0xc5ff62){_0x1417b5=_0xc5ff62[0x0];var _0xfeda2a=[];var _0x4578e1=[];_0x55efc8['forEach'](function(_0x2cb36d){if(_0x2cb36d[_0x3d3d('0xba')]){var _0x7fbe8=_0x2cb36d[_0x3d3d('0xba')]['substring'](_0x2cb36d[_0x3d3d('0xba')]['lastIndexOf']('.')+0x1);if(_0x7fbe8===_0x3d3d('0xc0')||_0x7fbe8===_0x3d3d('0xc1')||_0x7fbe8===_0x3d3d('0xc2')||_0x7fbe8===_0x3d3d('0xc3')||_0x7fbe8===_0x3d3d('0xc4')||_0x7fbe8===_0x3d3d('0xc5')||_0x7fbe8===_0x3d3d('0xc6')||_0x7fbe8===_0x3d3d('0xc7')||_0x7fbe8===_0x3d3d('0xc8')||_0x7fbe8===_0x3d3d('0xc9')){_0xfeda2a[_0x3d3d('0xbc')](getInputList(_0xe664ad,_0x33e0be,_0x7fbe8,_0x4578e1,_0x3fecf5[_0x3d3d('0xb4')],_0x2cb36d['MetadataId'],_0x1b7983));}}});return Promise['all'](_0xfeda2a);})[_0x3d3d('0x30')](function(_0x4d1d2b){_0x30de4e=_0x4d1d2b[0x0];var _0x9e7fca=_0x1ed60e['concat'](_0x1417b5)[_0x3d3d('0xa2')](_0x30de4e);var _0x193e5a={'count':_0x9e7fca[_0x3d3d('0x54')],'rows':_0x9e7fca};return _0x193e5a;})[_0x3d3d('0x30')](respondWithResult(_0x20bb3d,null))[_0x3d3d('0x25')](function(_0x3b3875){var _0x2c30ad=_0x1b6f14[_0x3d3d('0x3a')][_0x3d3d('0xca')]?0x1f4:_0x3b3875[_0x3d3d('0xcb')]||0x1f4;logger[_0x3d3d('0x22')](_0x3b3875[_0x3d3d('0xcc')]);delete _0x3b3875['name'];if(_0x2c30ad===0x191){_0x2c30ad=0x190;}_0x20bb3d['status'](_0x2c30ad)['send'](_0x1b6f14[_0x3d3d('0x3a')][_0x3d3d('0xca')]?{'message':'Wrong\x20credentials','statusCode':_0x3b3875[_0x3d3d('0xcb')]}:_0x3b3875);});};function getSelectList(_0x17576e,_0x53ab09,_0x380d03,_0x32a6b5,_0x139d44,_0x2e6420){var _0x5a8ce9={'method':'GET','uri':_0x17576e+_0x3d3d('0xb5')+_0x32a6b5+_0x3d3d('0xcd')+_0x139d44+_0x3d3d('0xce')+_0x3d3d('0xcf'),'headers':{'Authorization':_0x3d3d('0xb3')+_0x2e6420,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5a8ce9)[_0x3d3d('0x30')](function(_0x5c85d5){var _0x2675ea=[];var _0x12959f=_0x5c85d5['OptionSet'][_0x3d3d('0xd0')];_0x12959f[_0x3d3d('0xb9')](function(_0x15743e){_0x2675ea[_0x3d3d('0xbc')]({'name':_0x15743e['Label'][_0x3d3d('0xd1')][_0x3d3d('0xd2')],'value':String(_0x15743e[_0x3d3d('0xd3')])});});var _0xca6603={'id':_0x53ab09+'_'+_0x5c85d5[_0x3d3d('0xb8')],'name':_0x5c85d5[_0x3d3d('0xd4')][_0x3d3d('0xd1')][_0x3d3d('0xd2')],'custom':![],'options':_0x2675ea};_0x380d03[_0x3d3d('0xbc')](_0xca6603);return _0x380d03;});}function getBooleanList(_0x59efc5,_0x34eb29,_0xbedb21,_0x2229d6,_0x1e0dd3,_0x4f09e6){var _0x171fa4={'method':_0x3d3d('0xb1'),'uri':_0x59efc5+'EntityDefinitions('+_0x2229d6+_0x3d3d('0xcd')+_0x1e0dd3+_0x3d3d('0xd5'),'headers':{'Authorization':_0x3d3d('0xb3')+_0x4f09e6,'If-None-Match':null,'OData-Version':_0x3d3d('0xd6')},'json':!![]};return rp(_0x171fa4)[_0x3d3d('0x30')](function(_0x1491a6){var _0xbb7af7=[];_0xbb7af7[_0x3d3d('0xbc')]({'name':_0x1491a6[_0x3d3d('0xd7')][_0x3d3d('0xd8')]['Label'][_0x3d3d('0xd1')][_0x3d3d('0xd2')],'value':'true'},{'name':_0x1491a6[_0x3d3d('0xd7')][_0x3d3d('0xd9')][_0x3d3d('0xd2')][_0x3d3d('0xd1')][_0x3d3d('0xd2')],'value':_0x3d3d('0xda')});var _0x43833d={'id':_0x34eb29+'_'+_0x1491a6[_0x3d3d('0xb8')],'name':_0x1491a6[_0x3d3d('0xd4')][_0x3d3d('0xd1')][_0x3d3d('0xd2')],'custom':![],'options':_0xbb7af7};_0xbedb21['push'](_0x43833d);return _0xbedb21;});}function getInputList(_0x229729,_0x1536db,_0x250301,_0x3bdc09,_0x259b46,_0x3b7648,_0xb25b86){var _0x18077c={'method':_0x3d3d('0xb1'),'uri':_0x229729+_0x3d3d('0xb5')+_0x259b46+_0x3d3d('0xcd')+_0x3b7648+')/Microsoft.Dynamics.CRM.'+_0x250301+_0x3d3d('0xdb'),'headers':{'Authorization':'Bearer\x20'+_0xb25b86,'If-None-Match':null,'OData-Version':_0x3d3d('0xd6')},'json':!![]};return rp(_0x18077c)[_0x3d3d('0x30')](function(_0xa6c83a){var _0x3d82a3={'id':_0x1536db+'_'+_0xa6c83a['LogicalName'],'name':_0xa6c83a[_0x3d3d('0xd4')][_0x3d3d('0xd1')]?_0xa6c83a[_0x3d3d('0xd4')]['UserLocalizedLabel'][_0x3d3d('0xd2')]:_0xa6c83a[_0x3d3d('0xb8')],'custom':![],'options':[]};_0x3bdc09[_0x3d3d('0xbc')](_0x3d82a3);return _0x3bdc09;});} \ No newline at end of file +var _0xbe1b=['filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','length','includeAll','options','create','body','find','params','destroy','findOne','Dynamics365Configuration','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','Incident','PhoneCall','title','description','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','password','remoteUri','tenantId','clientSecret','slice','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientId','username','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','UserLocalizedLabel','false','html-pdf','eml-format','rimraf','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys'];(function(_0x4a04ad,_0x3c60b1){var _0x806240=function(_0x165fe5){while(--_0x165fe5){_0x4a04ad['push'](_0x4a04ad['shift']());}};_0x806240(++_0x3c60b1);}(_0xbe1b,0x8d));var _0xbbe1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe1b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xbbe1('0x0'));var emlformat=require(_0xbbe1('0x1'));var rimraf=require(_0xbbe1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbbe1('0x3'));var BPromise=require(_0xbbe1('0x4'));var Mustache=require('mustache');var util=require(_0xbbe1('0x5'));var path=require(_0xbbe1('0x6'));var sox=require('sox');var csv=require(_0xbbe1('0x7'));var ejs=require(_0xbbe1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbbe1('0x9'));var crypto=require(_0xbbe1('0xa'));var jsforce=require(_0xbbe1('0xb'));var deskjs=require(_0xbbe1('0xc'));var toCsv=require(_0xbbe1('0x7'));var querystring=require(_0xbbe1('0xd'));var Papa=require(_0xbbe1('0xe'));var Redis=require(_0xbbe1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbbe1('0x10'));var as=require(_0xbbe1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbe1('0x12'))(_0xbbe1('0x13'));var utils=require(_0xbbe1('0x14'));var config=require(_0xbbe1('0x15'));var db=require(_0xbbe1('0x16'))['db'];var integrations=require(_0xbbe1('0x17'));var jayson=require(_0xbbe1('0x18'));var client=jayson[_0xbbe1('0x19')][_0xbbe1('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x34a0cd,_0x579385,_0x28da84){if(_0x28da84){var _0x1540fe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1540fe['test'](_0x579385)){return _0x34a0cd;}else{throw new db[(_0xbbe1('0x1b'))][(_0xbbe1('0x1c'))](_0xbbe1('0x1d'));}}else{return _0x34a0cd;}}function respondWithRpcPromise(_0x5c6e4d,_0x24ba3a,_0x38f2c1,_0x4a35ea){return new BPromise(function(_0x1447f9,_0xb52240){var _0x546eda=_0x4a35ea||client;return _0x546eda[_0xbbe1('0x1e')](_0x5c6e4d,_0x38f2c1)[_0xbbe1('0x1f')](function(_0x227764){logger[_0xbbe1('0x20')](_0xbbe1('0x21'),_0x24ba3a,_0xbbe1('0x22'));logger['debug'](_0xbbe1('0x23'),_0x24ba3a,_0xbbe1('0x22'),JSON[_0xbbe1('0x24')](_0x227764));if(_0x227764[_0xbbe1('0x25')]){if(_0x227764['error'][_0xbbe1('0x26')]===0x1f4){logger[_0xbbe1('0x25')](_0xbbe1('0x21'),_0x24ba3a,_0x227764[_0xbbe1('0x25')][_0xbbe1('0x27')]);return _0xb52240(_0x227764[_0xbbe1('0x25')]['message']);}logger[_0xbbe1('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x24ba3a,_0x227764[_0xbbe1('0x25')][_0xbbe1('0x27')]);return _0x1447f9(_0x227764[_0xbbe1('0x25')][_0xbbe1('0x27')]);}else{logger[_0xbbe1('0x20')](_0xbbe1('0x21'),_0x24ba3a,_0xbbe1('0x22'));_0x1447f9(_0x227764[_0xbbe1('0x28')][_0xbbe1('0x27')]);}})[_0xbbe1('0x29')](function(_0x5104a3){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x24ba3a,_0x5104a3);_0xb52240(_0x5104a3);});});}function respondWithStatusCode(_0x412696,_0x4d1a24){_0x4d1a24=_0x4d1a24||0xcc;return function(_0x349ab9){if(_0x349ab9){return _0x412696[_0xbbe1('0x2a')](_0x4d1a24);}return _0x412696[_0xbbe1('0x2b')](_0x4d1a24)[_0xbbe1('0x2c')]();};}function respondWithResult(_0x25ef5a,_0x4645d4){_0x4645d4=_0x4645d4||0xc8;return function(_0x2498f0){if(_0x2498f0){return _0x25ef5a[_0xbbe1('0x2b')](_0x4645d4)[_0xbbe1('0x2d')](_0x2498f0);}};}function respondWithFilteredResult(_0x1f3925,_0xefaff1){return function(_0x4cd7a0){if(_0x4cd7a0){var _0xfe9de8=_0x4cd7a0[_0xbbe1('0x2e')],_0x4dadea=_0xefaff1['offset'],_0xc135a7=_0xefaff1[_0xbbe1('0x2f')]+_0xefaff1['limit'],_0xe9808;if(_0xc135a7>=_0xfe9de8){_0xc135a7=_0xfe9de8;_0xe9808=0xc8;}else{_0xe9808=0xce;}_0x1f3925[_0xbbe1('0x2b')](_0xe9808);return _0x1f3925[_0xbbe1('0x30')](_0xbbe1('0x31'),_0x4dadea+'-'+_0xc135a7+'/'+_0xfe9de8)[_0xbbe1('0x2d')](_0x4cd7a0);}return null;};}function patchUpdates(_0x5e0545){return function(_0x264bf6){try{jsonpatch['apply'](_0x264bf6,_0x5e0545,!![]);}catch(_0x3c88fd){return BPromise[_0xbbe1('0x32')](_0x3c88fd);}return _0x264bf6[_0xbbe1('0x33')]();};}function saveUpdates(_0xf664f1,_0x55801e){return function(_0x3d85ca){if(_0x3d85ca){return _0x3d85ca[_0xbbe1('0x34')](_0xf664f1)[_0xbbe1('0x1f')](function(_0x39c9f2){return _0x39c9f2;});}return null;};}function removeEntity(_0x461ccb,_0x12f6f0){return function(_0x3ecfd0){if(_0x3ecfd0){return _0x3ecfd0['destroy']()[_0xbbe1('0x1f')](function(){_0x461ccb[_0xbbe1('0x2b')](0xcc)[_0xbbe1('0x2c')]();});}};}function handleEntityNotFound(_0x1ebf87,_0x572dff){return function(_0x554424){if(!_0x554424){_0x1ebf87[_0xbbe1('0x2a')](0x194);}return _0x554424;};}function handleError(_0x48e0e6,_0x54cf90){_0x54cf90=_0x54cf90||0x1f4;return function(_0x3176ba){logger[_0xbbe1('0x25')](_0x3176ba[_0xbbe1('0x35')]);if(_0x3176ba[_0xbbe1('0x36')]){delete _0x3176ba[_0xbbe1('0x36')];}_0x48e0e6[_0xbbe1('0x2b')](_0x54cf90)[_0xbbe1('0x37')](_0x3176ba);};}exports['index']=function(_0x27eaf4,_0xb95443){var _0x17f010={},_0x55240b={},_0x1d0101={'count':0x0,'rows':[]};var _0x2939a3=_[_0xbbe1('0x38')](db[_0xbbe1('0x39')][_0xbbe1('0x3a')],function(_0x2072ab){return{'name':_0x2072ab[_0xbbe1('0x3b')],'type':_0x2072ab[_0xbbe1('0x3c')]['key']};});_0x55240b[_0xbbe1('0x3d')]=_[_0xbbe1('0x38')](_0x2939a3,'name');_0x55240b[_0xbbe1('0x3e')]=_[_0xbbe1('0x3f')](_0x27eaf4[_0xbbe1('0x3e')]);_0x55240b[_0xbbe1('0x40')]=_[_0xbbe1('0x41')](_0x55240b[_0xbbe1('0x3d')],_0x55240b[_0xbbe1('0x3e')]);_0x17f010[_0xbbe1('0x42')]=_[_0xbbe1('0x41')](_0x55240b[_0xbbe1('0x3d')],qs[_0xbbe1('0x43')](_0x27eaf4[_0xbbe1('0x3e')][_0xbbe1('0x43')]));_0x17f010[_0xbbe1('0x42')]=_0x17f010[_0xbbe1('0x42')]['length']?_0x17f010['attributes']:_0x55240b[_0xbbe1('0x3d')];if(!_0x27eaf4[_0xbbe1('0x3e')][_0xbbe1('0x44')]('nolimit')){_0x17f010['limit']=qs[_0xbbe1('0x45')](_0x27eaf4[_0xbbe1('0x3e')][_0xbbe1('0x45')]);_0x17f010[_0xbbe1('0x2f')]=qs[_0xbbe1('0x2f')](_0x27eaf4[_0xbbe1('0x3e')][_0xbbe1('0x2f')]);}_0x17f010[_0xbbe1('0x46')]=qs[_0xbbe1('0x47')](_0x27eaf4[_0xbbe1('0x3e')]['sort']);_0x17f010[_0xbbe1('0x48')]=qs[_0xbbe1('0x40')](_[_0xbbe1('0x49')](_0x27eaf4[_0xbbe1('0x3e')],_0x55240b[_0xbbe1('0x40')]),_0x2939a3);if(_0x27eaf4[_0xbbe1('0x3e')][_0xbbe1('0x4a')]){_0x17f010[_0xbbe1('0x48')]=_[_0xbbe1('0x4b')](_0x17f010['where'],{'$or':_['map'](_0x2939a3,function(_0xd1b1c8){if(_0xd1b1c8[_0xbbe1('0x3c')]!==_0xbbe1('0x4c')){var _0x347e3d={};_0x347e3d[_0xd1b1c8['name']]={'$like':'%'+_0x27eaf4[_0xbbe1('0x3e')][_0xbbe1('0x4a')]+'%'};return _0x347e3d;}})});}_0x17f010=_[_0xbbe1('0x4b')]({},_0x17f010,_0x27eaf4['options']);var _0x25a09a={'where':_0x17f010[_0xbbe1('0x48')]};return db['Dynamics365Account'][_0xbbe1('0x2e')](_0x25a09a)[_0xbbe1('0x1f')](function(_0x3899d5){_0x1d0101[_0xbbe1('0x2e')]=_0x3899d5;if(_0x27eaf4[_0xbbe1('0x3e')]['includeAll']){_0x17f010[_0xbbe1('0x4d')]=[{'all':!![]}];}return db[_0xbbe1('0x39')]['findAll'](_0x17f010);})[_0xbbe1('0x1f')](function(_0x3c89ad){_0x1d0101[_0xbbe1('0x4e')]=_0x3c89ad;return _0x1d0101;})[_0xbbe1('0x1f')](respondWithFilteredResult(_0xb95443,_0x17f010))['catch'](handleError(_0xb95443,null));};exports['show']=function(_0x4c78ad,_0x432c71){var _0x138b4a={'raw':![],'where':{'id':_0x4c78ad['params']['id']}},_0x255cb0={};_0x255cb0[_0xbbe1('0x3d')]=_[_0xbbe1('0x3f')](db['Dynamics365Account'][_0xbbe1('0x3a')]);_0x255cb0[_0xbbe1('0x3e')]=_[_0xbbe1('0x3f')](_0x4c78ad['query']);_0x255cb0['filters']=_[_0xbbe1('0x41')](_0x255cb0[_0xbbe1('0x3d')],_0x255cb0[_0xbbe1('0x3e')]);_0x138b4a['attributes']=_['intersection'](_0x255cb0['model'],qs[_0xbbe1('0x43')](_0x4c78ad[_0xbbe1('0x3e')][_0xbbe1('0x43')]));_0x138b4a['attributes']=_0x138b4a[_0xbbe1('0x42')][_0xbbe1('0x4f')]?_0x138b4a[_0xbbe1('0x42')]:_0x255cb0['model'];if(_0x4c78ad[_0xbbe1('0x3e')][_0xbbe1('0x50')]){_0x138b4a[_0xbbe1('0x4d')]=[{'all':!![]}];}_0x138b4a=_[_0xbbe1('0x4b')]({},_0x138b4a,_0x4c78ad[_0xbbe1('0x51')]);return db[_0xbbe1('0x39')]['find'](_0x138b4a)['then'](handleEntityNotFound(_0x432c71,null))[_0xbbe1('0x1f')](respondWithResult(_0x432c71,null))[_0xbbe1('0x29')](handleError(_0x432c71,null));};exports[_0xbbe1('0x52')]=function(_0x1592de,_0x169bdc){return db[_0xbbe1('0x39')][_0xbbe1('0x52')](_0x1592de[_0xbbe1('0x53')],{})['then'](respondWithResult(_0x169bdc,0xc9))[_0xbbe1('0x29')](handleError(_0x169bdc,null));};exports[_0xbbe1('0x34')]=function(_0x3699ae,_0x37c33d){if(_0x3699ae[_0xbbe1('0x53')]['id']){delete _0x3699ae[_0xbbe1('0x53')]['id'];}return db[_0xbbe1('0x39')][_0xbbe1('0x54')]({'where':{'id':_0x3699ae[_0xbbe1('0x55')]['id']}})[_0xbbe1('0x1f')](handleEntityNotFound(_0x37c33d,null))['then'](saveUpdates(_0x3699ae[_0xbbe1('0x53')],null))['then'](respondWithResult(_0x37c33d,null))[_0xbbe1('0x29')](handleError(_0x37c33d,null));};exports[_0xbbe1('0x56')]=function(_0x5e5564,_0x50ff17){return db[_0xbbe1('0x39')][_0xbbe1('0x54')]({'where':{'id':_0x5e5564[_0xbbe1('0x55')]['id']}})[_0xbbe1('0x1f')](handleEntityNotFound(_0x50ff17,null))[_0xbbe1('0x1f')](removeEntity(_0x50ff17,null))[_0xbbe1('0x29')](handleError(_0x50ff17,null));};exports['getConfigurations']=function(_0x3a075d,_0x225cb8,_0x374207){var _0x54431e={};var _0x1dfac4={};var _0x3acd32;var _0x110325;return db['Dynamics365Account'][_0xbbe1('0x57')]({'where':{'id':_0x3a075d[_0xbbe1('0x55')]['id']}})['then'](handleEntityNotFound(_0x225cb8,null))[_0xbbe1('0x1f')](function(_0x117a9c){if(_0x117a9c){_0x3acd32=_0x117a9c;_0x1dfac4[_0xbbe1('0x3d')]=_[_0xbbe1('0x3f')](db[_0xbbe1('0x58')][_0xbbe1('0x3a')]);_0x1dfac4[_0xbbe1('0x3e')]=_['keys'](_0x3a075d['query']);_0x1dfac4['filters']=_[_0xbbe1('0x41')](_0x1dfac4[_0xbbe1('0x3d')],_0x1dfac4[_0xbbe1('0x3e')]);_0x54431e[_0xbbe1('0x42')]=_[_0xbbe1('0x41')](_0x1dfac4[_0xbbe1('0x3d')],qs[_0xbbe1('0x43')](_0x3a075d[_0xbbe1('0x3e')][_0xbbe1('0x43')]));_0x54431e[_0xbbe1('0x42')]=_0x54431e[_0xbbe1('0x42')]['length']?_0x54431e['attributes']:_0x1dfac4['model'];_0x54431e[_0xbbe1('0x46')]=qs[_0xbbe1('0x47')](_0x3a075d['query'][_0xbbe1('0x47')]);_0x54431e[_0xbbe1('0x48')]=qs[_0xbbe1('0x40')](_[_0xbbe1('0x49')](_0x3a075d[_0xbbe1('0x3e')],_0x1dfac4[_0xbbe1('0x40')]));if(_0x3a075d[_0xbbe1('0x3e')][_0xbbe1('0x4a')]){_0x54431e[_0xbbe1('0x48')]=_[_0xbbe1('0x4b')](_0x54431e[_0xbbe1('0x48')],{'$or':_['map'](_0x54431e[_0xbbe1('0x42')],function(_0x3fa7b9){var _0x27fdc5={};_0x27fdc5[_0x3fa7b9]={'$like':'%'+_0x3a075d[_0xbbe1('0x3e')][_0xbbe1('0x4a')]+'%'};return _0x27fdc5;})});}_0x54431e=_['merge']({},_0x54431e,_0x3a075d[_0xbbe1('0x51')]);return _0x3acd32[_0xbbe1('0x59')](_0x54431e);}})[_0xbbe1('0x1f')](function(_0x184509){if(_0x184509){_0x110325=_0x184509[_0xbbe1('0x4f')];if(!_0x3a075d['query'][_0xbbe1('0x44')]('nolimit')){_0x54431e[_0xbbe1('0x45')]=qs[_0xbbe1('0x45')](_0x3a075d['query'][_0xbbe1('0x45')]);_0x54431e[_0xbbe1('0x2f')]=qs[_0xbbe1('0x2f')](_0x3a075d[_0xbbe1('0x3e')][_0xbbe1('0x2f')]);}return _0x3acd32[_0xbbe1('0x59')](_0x54431e);}})[_0xbbe1('0x1f')](function(_0x1014d8){if(_0x1014d8){return _0x1014d8?{'count':_0x110325,'rows':_0x1014d8}:null;}})[_0xbbe1('0x1f')](respondWithResult(_0x225cb8,null))[_0xbbe1('0x29')](handleError(_0x225cb8,null));};exports['addConfiguration']=function(_0x4445ff,_0x1d91af,_0x4d4bf6){if(_0x4445ff[_0xbbe1('0x53')]['id']){delete _0x4445ff[_0xbbe1('0x53')]['id'];}return db[_0xbbe1('0x39')][_0xbbe1('0x57')]({'where':{'id':_0x4445ff[_0xbbe1('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d91af,null))[_0xbbe1('0x1f')](function(_0x1973ef){if(_0x1973ef){_0x4445ff[_0xbbe1('0x53')][_0xbbe1('0x5a')]=_0x1973ef['id'];_0x4445ff[_0xbbe1('0x53')][_0xbbe1('0x5b')]=integrations['getSubjects'](_0x4445ff['body'][_0xbbe1('0x5c')],_0x4445ff['body'][_0xbbe1('0x3c')]);_0x4445ff[_0xbbe1('0x53')][_0xbbe1('0x5d')]=integrations[_0xbbe1('0x5e')](_0x4445ff[_0xbbe1('0x53')][_0xbbe1('0x5c')],_0x4445ff[_0xbbe1('0x53')][_0xbbe1('0x3c')]);return db[_0xbbe1('0x58')][_0xbbe1('0x52')](_0x4445ff[_0xbbe1('0x53')],{'include':[{'model':db[_0xbbe1('0x5f')],'as':'Subjects'},{'model':db[_0xbbe1('0x5f')],'as':'Descriptions'}]});}return null;})[_0xbbe1('0x1f')](respondWithResult(_0x1d91af,null))[_0xbbe1('0x29')](handleError(_0x1d91af,null));};exports['getFields']=function(_0x351f85,_0xbb68f4,_0x93569b){var _0x4c9a56=_0x351f85['query']['ticketType'];var _0x54ee02=_0x4c9a56==='incident'?_0xbbe1('0x60'):_0xbbe1('0x61');var _0x20ed2a='';var _0x402325='';var _0x240a40='';var _0x569da0='';var _0x2c9162='';var _0x42c372='';var _0x591126='';var _0x34aa05='';var _0x390854=[_0xbbe1('0x62'),_0xbbe1('0x63'),'customerid','ownerid',_0xbbe1('0x64'),_0xbbe1('0x65'),'phonenumber',_0xbbe1('0x66'),_0xbbe1('0x67'),_0xbbe1('0x68')];var _0x1943f4=[_0xbbe1('0x69'),_0xbbe1('0x6a'),_0xbbe1('0x6b'),_0xbbe1('0x6c'),'contactidname',_0xbbe1('0x6d'),_0xbbe1('0x6e'),_0xbbe1('0x6f'),_0xbbe1('0x70'),_0xbbe1('0x71'),_0xbbe1('0x72'),_0xbbe1('0x73'),_0xbbe1('0x74'),_0xbbe1('0x75'),_0xbbe1('0x76'),_0xbbe1('0x77'),_0xbbe1('0x78'),'customeridyominame','emailaddress',_0xbbe1('0x79'),_0xbbe1('0x7a'),_0xbbe1('0x7b'),'escalatedon','exchangerate','firstresponsebykpiidname',_0xbbe1('0x7c'),_0xbbe1('0x7d'),'influencescore',_0xbbe1('0x7e'),_0xbbe1('0x7f'),'masteridname',_0xbbe1('0x80'),_0xbbe1('0x81'),'modifiedbyname','modifiedbyyominame',_0xbbe1('0x82'),_0xbbe1('0x83'),'modifiedonbehalfbyyominame',_0xbbe1('0x84'),_0xbbe1('0x85'),_0xbbe1('0x86'),_0xbbe1('0x87'),'overriddencreatedon',_0xbbe1('0x88'),_0xbbe1('0x89'),_0xbbe1('0x8a'),'parentcaseidname',_0xbbe1('0x8b'),'primarycontactidyominame','prioritycodename',_0xbbe1('0x8c'),_0xbbe1('0x8d'),_0xbbe1('0x8e'),_0xbbe1('0x8f'),'responseby',_0xbbe1('0x90'),_0xbbe1('0x91'),_0xbbe1('0x92'),_0xbbe1('0x93'),_0xbbe1('0x94'),'socialprofileidname','statecode',_0xbbe1('0x95'),'subjectidname',_0xbbe1('0x96'),_0xbbe1('0x97'),_0xbbe1('0x98'),'traversedpath','utcconversiontimezonecode',_0xbbe1('0x99')];var _0x46020e=_0x390854[_0xbbe1('0x9a')](_0x1943f4);return db[_0xbbe1('0x39')][_0xbbe1('0x57')]({'where':{'id':_0x351f85['params']['id']},'attributes':['id','username',_0xbbe1('0x9b'),_0xbbe1('0x9c'),_0xbbe1('0x9d'),'clientId',_0xbbe1('0x9e')]})[_0xbbe1('0x1f')](handleEntityNotFound(_0xbb68f4,null))[_0xbbe1('0x1f')](function(_0x20970c){if(_0x20970c){_0x34aa05=_0x20970c['remoteUri'];var _0x18d1f6=_0x34aa05[_0xbbe1('0x9f')](-0x1);if(_0x18d1f6==='/'){_0x34aa05=_0x34aa05['substring'](0x0,_0x34aa05['lastIndexOf'](_0x18d1f6));}_0x591126=util['format'](_0xbbe1('0xa0'),_0x34aa05);var _0x33ead0={'method':'POST','uri':_0xbbe1('0xa1')+_0x20970c[_0xbbe1('0x9d')]+_0xbbe1('0xa2'),'form':{'client_id':_0x20970c[_0xbbe1('0xa3')],'resource':_0x34aa05,'username':_0x20970c[_0xbbe1('0xa4')],'password':_0x20970c[_0xbbe1('0x9b')],'grant_type':_0xbbe1('0x9b'),'client_secret':_0x20970c[_0xbbe1('0x9e')]},'json':!![]};return rp(_0x33ead0);}})[_0xbbe1('0x1f')](function(_0x46831e){_0x42c372=_0x46831e['access_token'];var _0x1931d5={'method':_0xbbe1('0xa5'),'uri':encodeURI(_0x591126+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x54ee02+'\x27'),'headers':{'Authorization':_0xbbe1('0xa6')+_0x42c372,'If-None-Match':null,'OData-Version':_0xbbe1('0xa7')},'json':!![]};return rp(_0x1931d5);})[_0xbbe1('0x1f')](function(_0x15ae85){var _0x3973f9=_0x15ae85[_0xbbe1('0xa8')][0x0];var _0x131917=_0x3973f9[_0xbbe1('0xa9')];var _0x1c3436={'method':_0xbbe1('0xa5'),'uri':_0x591126+_0xbbe1('0xaa')+_0x131917+_0xbbe1('0xab'),'headers':{'Authorization':_0xbbe1('0xa6')+_0x42c372,'If-None-Match':null,'OData-Version':_0xbbe1('0xa7')},'json':!![]};return rp(_0x1c3436);})[_0xbbe1('0x1f')](function(_0x41ec7a){_0x20ed2a=_0x41ec7a;_0x402325=_0x20ed2a['Attributes'];_0x402325=_[_0xbbe1('0xac')](_0x402325,function(_0x3a7d1c){return!_0x46020e[_0xbbe1('0xad')](_0x3a7d1c[_0xbbe1('0xae')]);});var _0x5eb584=[];var _0x5c8b69=[];_0x402325['forEach'](function(_0xa78a9a){if(_0xa78a9a['@odata.type']){var _0x1081c8=_0xa78a9a[_0xbbe1('0xaf')][_0xbbe1('0xb0')](_0xa78a9a[_0xbbe1('0xaf')][_0xbbe1('0xb1')]('.')+0x1);if(_0x1081c8===_0xbbe1('0xb2')){_0x5eb584[_0xbbe1('0xb3')](getSelectList(_0x591126,_0x4c9a56,_0x5c8b69,_0x20ed2a[_0xbbe1('0xa9')],_0xa78a9a[_0xbbe1('0xa9')],_0x42c372));}}});return Promise['all'](_0x5eb584);})[_0xbbe1('0x1f')](function(_0x39e66c){_0x240a40=_0x39e66c[0x0];var _0x5d0840=[];var _0x42ccb2=[];_0x402325[_0xbbe1('0xb4')](function(_0xd0bb86){if(!_[_0xbbe1('0xb5')](_0xd0bb86[_0xbbe1('0xaf')])){var _0x36caf9=_0xd0bb86[_0xbbe1('0xaf')][_0xbbe1('0xb0')](_0xd0bb86['@odata.type'][_0xbbe1('0xb1')]('.')+0x1);if(_0x36caf9===_0xbbe1('0xb6')){_0x5d0840[_0xbbe1('0xb3')](getBooleanList(_0x591126,_0x4c9a56,_0x42ccb2,_0x20ed2a[_0xbbe1('0xa9')],_0xd0bb86[_0xbbe1('0xa9')],_0x42c372));}}});return Promise['all'](_0x5d0840);})[_0xbbe1('0x1f')](function(_0x5a579d){_0x569da0=_0x5a579d[0x0];var _0x501915=[];var _0x4cc49a=[];_0x402325[_0xbbe1('0xb4')](function(_0x1f42a6){if(_0x1f42a6[_0xbbe1('0xaf')]){var _0x367212=_0x1f42a6[_0xbbe1('0xaf')][_0xbbe1('0xb0')](_0x1f42a6[_0xbbe1('0xaf')][_0xbbe1('0xb1')]('.')+0x1);if(_0x367212===_0xbbe1('0xb7')||_0x367212===_0xbbe1('0xb8')||_0x367212===_0xbbe1('0xb9')||_0x367212===_0xbbe1('0xba')||_0x367212==='MemoAttributeMetadata'||_0x367212===_0xbbe1('0xbb')||_0x367212===_0xbbe1('0xbc')||_0x367212===_0xbbe1('0xbd')||_0x367212===_0xbbe1('0xbe')||_0x367212===_0xbbe1('0xbf')){_0x501915[_0xbbe1('0xb3')](getInputList(_0x591126,_0x4c9a56,_0x367212,_0x4cc49a,_0x20ed2a[_0xbbe1('0xa9')],_0x1f42a6['MetadataId'],_0x42c372));}}});return Promise['all'](_0x501915);})[_0xbbe1('0x1f')](function(_0x50d237){_0x2c9162=_0x50d237[0x0];var _0x4bd3c1=_0x240a40[_0xbbe1('0x9a')](_0x569da0)['concat'](_0x2c9162);var _0x1f4e91={'count':_0x4bd3c1[_0xbbe1('0x4f')],'rows':_0x4bd3c1};return _0x1f4e91;})[_0xbbe1('0x1f')](respondWithResult(_0xbb68f4,null))['catch'](function(_0x1ece0f){var _0x3a3384=_0x351f85['query'][_0xbbe1('0xc0')]?0x1f4:_0x1ece0f[_0xbbe1('0xc1')]||0x1f4;logger[_0xbbe1('0x25')](_0x1ece0f[_0xbbe1('0x35')]);delete _0x1ece0f[_0xbbe1('0x36')];if(_0x3a3384===0x191){_0x3a3384=0x190;}_0xbb68f4[_0xbbe1('0x2b')](_0x3a3384)[_0xbbe1('0x37')](_0x351f85[_0xbbe1('0x3e')][_0xbbe1('0xc0')]?{'message':_0xbbe1('0xc2'),'statusCode':_0x1ece0f[_0xbbe1('0xc1')]}:_0x1ece0f);});};function getSelectList(_0x55fd2b,_0x2792fa,_0x2ee461,_0xb3a086,_0x4845b1,_0x2c16b3){var _0x423055={'method':_0xbbe1('0xa5'),'uri':_0x55fd2b+_0xbbe1('0xaa')+_0xb3a086+')/Attributes('+_0x4845b1+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xbbe1('0xc3'),'headers':{'Authorization':_0xbbe1('0xa6')+_0x2c16b3,'If-None-Match':null,'OData-Version':_0xbbe1('0xa7')},'json':!![]};return rp(_0x423055)[_0xbbe1('0x1f')](function(_0x5241ce){var _0x2bc968=[];var _0x1c88a8=_0x5241ce[_0xbbe1('0xc4')]['Options'];_0x1c88a8['forEach'](function(_0x2ab428){_0x2bc968[_0xbbe1('0xb3')]({'name':_0x2ab428[_0xbbe1('0xc5')]['UserLocalizedLabel']['Label'],'value':String(_0x2ab428[_0xbbe1('0xc6')])});});var _0x1cee68={'id':_0x2792fa+'_'+_0x5241ce['LogicalName'],'name':_0x5241ce[_0xbbe1('0xc7')]['UserLocalizedLabel'][_0xbbe1('0xc5')],'custom':![],'options':_0x2bc968};_0x2ee461[_0xbbe1('0xb3')](_0x1cee68);return _0x2ee461;});}function getBooleanList(_0x17a355,_0x193313,_0x3c71d9,_0x9ecc00,_0x493c70,_0x25dabb){var _0x17d007={'method':'GET','uri':_0x17a355+_0xbbe1('0xaa')+_0x9ecc00+_0xbbe1('0xc8')+_0x493c70+_0xbbe1('0xc9'),'headers':{'Authorization':'Bearer\x20'+_0x25dabb,'If-None-Match':null,'OData-Version':_0xbbe1('0xa7')},'json':!![]};return rp(_0x17d007)[_0xbbe1('0x1f')](function(_0x363579){var _0x77e5a6=[];_0x77e5a6[_0xbbe1('0xb3')]({'name':_0x363579['OptionSet'][_0xbbe1('0xca')][_0xbbe1('0xc5')][_0xbbe1('0xcb')][_0xbbe1('0xc5')],'value':'true'},{'name':_0x363579[_0xbbe1('0xc4')]['FalseOption'][_0xbbe1('0xc5')][_0xbbe1('0xcb')][_0xbbe1('0xc5')],'value':_0xbbe1('0xcc')});var _0x37c2bb={'id':_0x193313+'_'+_0x363579[_0xbbe1('0xae')],'name':_0x363579[_0xbbe1('0xc7')][_0xbbe1('0xcb')][_0xbbe1('0xc5')],'custom':![],'options':_0x77e5a6};_0x3c71d9[_0xbbe1('0xb3')](_0x37c2bb);return _0x3c71d9;});}function getInputList(_0x3d0e3b,_0x14e726,_0x29349b,_0x1a25da,_0x404903,_0x470289,_0x1f1087){var _0x464d63={'method':_0xbbe1('0xa5'),'uri':_0x3d0e3b+'EntityDefinitions('+_0x404903+_0xbbe1('0xc8')+_0x470289+')/Microsoft.Dynamics.CRM.'+_0x29349b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xbbe1('0xa6')+_0x1f1087,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x464d63)[_0xbbe1('0x1f')](function(_0x41bc5e){var _0xa8a0d9={'id':_0x14e726+'_'+_0x41bc5e[_0xbbe1('0xae')],'name':_0x41bc5e[_0xbbe1('0xc7')]['UserLocalizedLabel']?_0x41bc5e[_0xbbe1('0xc7')][_0xbbe1('0xcb')][_0xbbe1('0xc5')]:_0x41bc5e[_0xbbe1('0xae')],'custom':![],'options':[]};_0x1a25da[_0xbbe1('0xb3')](_0xa8a0d9);return _0x1a25da;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2a3001c..a0b53ff 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 _0x9632=['request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x9632,0x1b6));var _0x2963=function(_0x34b415,_0x2bbe6c){_0x34b415=_0x34b415-0x0;var _0x30b346=_0x9632[_0x34b415];return _0x30b346;};'use strict';var _=require(_0x2963('0x0'));var util=require(_0x2963('0x1'));var logger=require(_0x2963('0x2'))(_0x2963('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2963('0x4'));var fs=require('fs');var path=require(_0x2963('0x5'));var rimraf=require(_0x2963('0x6'));var config=require(_0x2963('0x7'));var attributes=require(_0x2963('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x2963('0x9')]=function(_0xaf7422,_0xaf1a6){return _0xaf7422[_0x2963('0xa')](_0x2963('0xb'),attributes,{'tableName':_0x2963('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9370=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5121a9,_0x5d0f44){var _0x452a93=function(_0xcb6799){while(--_0xcb6799){_0x5121a9['push'](_0x5121a9['shift']());}};_0x452a93(++_0x5d0f44);}(_0x9370,0x158));var _0x0937=function(_0x54e595,_0x46278e){_0x54e595=_0x54e595-0x0;var _0x6644bd=_0x9370[_0x54e595];return _0x6644bd;};'use strict';var _=require('lodash');var util=require(_0x0937('0x0'));var logger=require('../../config/logger')(_0x0937('0x1'));var moment=require(_0x0937('0x2'));var BPromise=require(_0x0937('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0937('0x4'));var rimraf=require(_0x0937('0x5'));var config=require(_0x0937('0x6'));var attributes=require(_0x0937('0x7'));var integrations=require(_0x0937('0x8'));module[_0x0937('0x9')]=function(_0xe43850,_0x2102b4){return _0xe43850[_0x0937('0xa')](_0x0937('0xb'),attributes,{'tableName':_0x0937('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 afe6d84..6428d19 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 _0xa6bb=['rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','Dynamics365Account','findAll','options','attributes','limit','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','find','raw','where','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x4c0fb4,_0x59decf){var _0x64d16c=function(_0x66f6fd){while(--_0x66f6fd){_0x4c0fb4['push'](_0x4c0fb4['shift']());}};_0x64d16c(++_0x59decf);}(_0xa6bb,0x12c));var _0xba6b=function(_0x34e49a,_0x5919e0){_0x34e49a=_0x34e49a-0x0;var _0x4098e1=_0xa6bb[_0x34e49a];return _0x4098e1;};'use strict';var _=require('lodash');var util=require(_0xba6b('0x0'));var moment=require(_0xba6b('0x1'));var BPromise=require(_0xba6b('0x2'));var rs=require(_0xba6b('0x3'));var fs=require('fs');var Redis=require(_0xba6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba6b('0x5'))(_0xba6b('0x6'));var config=require(_0xba6b('0x7'));var jayson=require(_0xba6b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a00d6,_0x4f6c6c,_0x2f305e){return new BPromise(function(_0x5506d6,_0x55f5c3){return client[_0xba6b('0x9')](_0x2a00d6,_0x2f305e)[_0xba6b('0xa')](function(_0x2cab30){logger[_0xba6b('0xb')](_0xba6b('0xc'),_0x4f6c6c,'request\x20sent');logger[_0xba6b('0xd')](_0xba6b('0xe'),_0x4f6c6c,_0xba6b('0xf'),JSON['stringify'](_0x2cab30));if(_0x2cab30[_0xba6b('0x10')]){if(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x11')]===0x1f4){logger[_0xba6b('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x4f6c6c,_0x2cab30[_0xba6b('0x10')]['message']);return _0x55f5c3(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x12')]);}logger[_0xba6b('0x10')](_0xba6b('0xc'),_0x4f6c6c,_0x2cab30[_0xba6b('0x10')]['message']);return _0x5506d6(_0x2cab30[_0xba6b('0x10')][_0xba6b('0x12')]);}else{logger['info'](_0xba6b('0xc'),_0x4f6c6c,_0xba6b('0xf'));_0x5506d6(_0x2cab30['result']['message']);}})[_0xba6b('0x13')](function(_0x5b32cd){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4f6c6c,_0x5b32cd);_0x55f5c3(_0x5b32cd);});});}exports['GetDynamics365Account']=function(_0x4be059){var _0x16b130=this;return new Promise(function(_0x34aa97,_0x2738fd){return db[_0xba6b('0x14')][_0xba6b('0x15')]({'raw':_0x4be059[_0xba6b('0x16')]?_0x4be059[_0xba6b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4be059[_0xba6b('0x16')]?_0x4be059['options']['where']||null:null,'attributes':_0x4be059[_0xba6b('0x16')]?_0x4be059[_0xba6b('0x16')][_0xba6b('0x17')]||null:null,'limit':_0x4be059[_0xba6b('0x16')]?_0x4be059['options'][_0xba6b('0x18')]||null:null,'include':_0x4be059[_0xba6b('0x16')]?_0x4be059['options'][_0xba6b('0x19')]?_[_0xba6b('0x1a')](_0x4be059[_0xba6b('0x16')][_0xba6b('0x19')],function(_0x426641){return{'model':db[_0x426641['model']],'as':_0x426641['as'],'attributes':_0x426641['attributes'],'include':_0x426641['include']?_['map'](_0x426641[_0xba6b('0x19')],function(_0x2525f8){return{'model':db[_0x2525f8[_0xba6b('0x1b')]],'as':_0x2525f8['as'],'attributes':_0x2525f8[_0xba6b('0x17')],'include':_0x2525f8[_0xba6b('0x19')]?_[_0xba6b('0x1a')](_0x2525f8['include'],function(_0x876e58){return{'model':db[_0x876e58[_0xba6b('0x1b')]],'as':_0x876e58['as'],'attributes':_0x876e58[_0xba6b('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47574c){logger[_0xba6b('0xb')]('GetDynamics365Account',_0x4be059);logger[_0xba6b('0xd')](_0xba6b('0x1c'),_0x4be059,JSON[_0xba6b('0x1d')](_0x47574c));_0x34aa97(_0x47574c);})[_0xba6b('0x13')](function(_0x506f14){logger['error'](_0xba6b('0x1c'),_0x506f14['message'],_0x4be059);_0x2738fd(_0x16b130[_0xba6b('0x10')](0x1f4,_0x506f14['message']));});});};exports[_0xba6b('0x1e')]=function(_0x53649d){var _0x429954=this;return new Promise(function(_0x5008c1,_0x205af9){return db[_0xba6b('0x14')][_0xba6b('0x1f')]({'raw':_0x53649d[_0xba6b('0x16')]?_0x53649d['options'][_0xba6b('0x20')]===undefined?!![]:![]:!![],'where':_0x53649d['options']?_0x53649d['options'][_0xba6b('0x21')]||null:null,'attributes':_0x53649d[_0xba6b('0x16')]?_0x53649d['options'][_0xba6b('0x17')]||null:null,'include':_0x53649d['options']?_0x53649d['options'][_0xba6b('0x19')]?_[_0xba6b('0x1a')](_0x53649d[_0xba6b('0x16')][_0xba6b('0x19')],function(_0x8e4c02){return{'model':db[_0x8e4c02['model']],'as':_0x8e4c02['as'],'attributes':_0x8e4c02[_0xba6b('0x17')],'include':_0x8e4c02[_0xba6b('0x19')]?_[_0xba6b('0x1a')](_0x8e4c02[_0xba6b('0x19')],function(_0x27f665){return{'model':db[_0x27f665[_0xba6b('0x1b')]],'as':_0x27f665['as'],'attributes':_0x27f665[_0xba6b('0x17')],'include':_0x27f665[_0xba6b('0x19')]?_[_0xba6b('0x1a')](_0x27f665['include'],function(_0x2bf030){return{'model':db[_0x2bf030[_0xba6b('0x1b')]],'as':_0x2bf030['as'],'attributes':_0x2bf030[_0xba6b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xba6b('0xa')](function(_0x5e622f){logger['info'](_0xba6b('0x1e'),_0x53649d);logger[_0xba6b('0xd')](_0xba6b('0x1e'),_0x53649d,JSON[_0xba6b('0x1d')](_0x5e622f));_0x5008c1(_0x5e622f);})['catch'](function(_0x3ed42a){logger[_0xba6b('0x10')]('ShowDynamics365Account',_0x3ed42a[_0xba6b('0x12')],_0x53649d);_0x205af9(_0x429954['error'](0x1f4,_0x3ed42a[_0xba6b('0x12')]));});});}; \ No newline at end of file +var _0xed1c=['model','ShowDynamics365Account','find','debug','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','include','map'];(function(_0x1fb573,_0x334e3f){var _0xfc2cde=function(_0x44f790){while(--_0x44f790){_0x1fb573['push'](_0x1fb573['shift']());}};_0xfc2cde(++_0x334e3f);}(_0xed1c,0xe4));var _0xced1=function(_0x1c2d2d,_0xc2eba3){_0x1c2d2d=_0x1c2d2d-0x0;var _0x50fbb8=_0xed1c[_0x1c2d2d];return _0x50fbb8;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});}exports[_0xced1('0x14')]=function(_0x5a563a){var _0x56fc50=this;return new Promise(function(_0x2a92c8,_0x111fb0){return db[_0xced1('0x15')]['findAll']({'raw':_0x5a563a[_0xced1('0x16')]?_0x5a563a[_0xced1('0x16')][_0xced1('0x17')]===undefined?!![]:![]:!![],'where':_0x5a563a['options']?_0x5a563a[_0xced1('0x16')][_0xced1('0x18')]||null:null,'attributes':_0x5a563a[_0xced1('0x16')]?_0x5a563a['options'][_0xced1('0x19')]||null:null,'limit':_0x5a563a[_0xced1('0x16')]?_0x5a563a[_0xced1('0x16')]['limit']||null:null,'include':_0x5a563a['options']?_0x5a563a[_0xced1('0x16')][_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x5a563a[_0xced1('0x16')][_0xced1('0x1a')],function(_0x49c8b9){return{'model':db[_0x49c8b9[_0xced1('0x1c')]],'as':_0x49c8b9['as'],'attributes':_0x49c8b9[_0xced1('0x19')],'include':_0x49c8b9['include']?_['map'](_0x49c8b9[_0xced1('0x1a')],function(_0x258c9a){return{'model':db[_0x258c9a[_0xced1('0x1c')]],'as':_0x258c9a['as'],'attributes':_0x258c9a[_0xced1('0x19')],'include':_0x258c9a[_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x258c9a['include'],function(_0x181f6e){return{'model':db[_0x181f6e[_0xced1('0x1c')]],'as':_0x181f6e['as'],'attributes':_0x181f6e[_0xced1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced1('0xa')](function(_0x34dd2e){logger[_0xced1('0xb')](_0xced1('0x14'),_0x5a563a);logger['debug'](_0xced1('0x14'),_0x5a563a,JSON['stringify'](_0x34dd2e));_0x2a92c8(_0x34dd2e);})[_0xced1('0x13')](function(_0x2c2269){logger[_0xced1('0xf')](_0xced1('0x14'),_0x2c2269['message'],_0x5a563a);_0x111fb0(_0x56fc50['error'](0x1f4,_0x2c2269[_0xced1('0x11')]));});});};exports[_0xced1('0x1d')]=function(_0x2bc785){var _0x4ea07e=this;return new Promise(function(_0x573146,_0x543c47){return db[_0xced1('0x15')][_0xced1('0x1e')]({'raw':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')][_0xced1('0x18')]||null:null,'attributes':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')][_0xced1('0x19')]||null:null,'include':_0x2bc785[_0xced1('0x16')]?_0x2bc785['options']['include']?_[_0xced1('0x1b')](_0x2bc785[_0xced1('0x16')][_0xced1('0x1a')],function(_0x7ebeb3){return{'model':db[_0x7ebeb3[_0xced1('0x1c')]],'as':_0x7ebeb3['as'],'attributes':_0x7ebeb3[_0xced1('0x19')],'include':_0x7ebeb3['include']?_['map'](_0x7ebeb3['include'],function(_0x4d305c){return{'model':db[_0x4d305c[_0xced1('0x1c')]],'as':_0x4d305c['as'],'attributes':_0x4d305c[_0xced1('0x19')],'include':_0x4d305c[_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x4d305c[_0xced1('0x1a')],function(_0x1c36fa){return{'model':db[_0x1c36fa[_0xced1('0x1c')]],'as':_0x1c36fa['as'],'attributes':_0x1c36fa[_0xced1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced1('0xa')](function(_0x3dfd2f){logger[_0xced1('0xb')](_0xced1('0x1d'),_0x2bc785);logger[_0xced1('0x1f')]('ShowDynamics365Account',_0x2bc785,JSON[_0xced1('0xe')](_0x3dfd2f));_0x573146(_0x3dfd2f);})[_0xced1('0x13')](function(_0x1116de){logger[_0xced1('0xf')](_0xced1('0x1d'),_0x1116de[_0xced1('0x11')],_0x2bc785);_0x543c47(_0x4ea07e['error'](0x1f4,_0x1116de[_0xced1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b42cd04..91072df 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 _0xb001=['../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','util','connect-timeout','express','../../components/auth/service'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xb001,0xee));var _0x1b00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb001[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1b00('0x0'));var path=require('path');var timeout=require(_0x1b00('0x1'));var express=require(_0x1b00('0x2'));var router=express['Router']();var auth=require(_0x1b00('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1b00('0x4'));var controller=require(_0x1b00('0x5'));router[_0x1b00('0x6')]('/',auth[_0x1b00('0x7')](),controller[_0x1b00('0x8')]);router[_0x1b00('0x6')](_0x1b00('0x9'),auth[_0x1b00('0x7')](),controller[_0x1b00('0xa')]);router[_0x1b00('0x6')](_0x1b00('0xb'),auth[_0x1b00('0x7')](),controller[_0x1b00('0xc')]);router[_0x1b00('0x6')](_0x1b00('0xd'),auth[_0x1b00('0x7')](),controller[_0x1b00('0xe')]);router[_0x1b00('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x1b00('0xf')]);router[_0x1b00('0x10')]('/',auth[_0x1b00('0x7')](),controller[_0x1b00('0x11')]);router[_0x1b00('0x12')](_0x1b00('0x9'),auth[_0x1b00('0x7')](),controller[_0x1b00('0x13')]);router[_0x1b00('0x14')](_0x1b00('0x9'),auth[_0x1b00('0x7')](),controller[_0x1b00('0x15')]);module['exports']=router; \ No newline at end of file +var _0xab68=['../../components/interaction/service','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xab68,0x18a));var _0x8ab6=function(_0x510a1f,_0x5053c5){_0x510a1f=_0x510a1f-0x0;var _0x57581b=_0xab68[_0x510a1f];return _0x57581b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ab6('0x0'));var timeout=require(_0x8ab6('0x1'));var express=require(_0x8ab6('0x2'));var router=express[_0x8ab6('0x3')]();var auth=require(_0x8ab6('0x4'));var interaction=require(_0x8ab6('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x8ab6('0x6')](),controller[_0x8ab6('0x7')]);router[_0x8ab6('0x8')](_0x8ab6('0x9'),auth['isAuthenticated'](),controller[_0x8ab6('0xa')]);router[_0x8ab6('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8ab6('0xb')]);router[_0x8ab6('0x8')](_0x8ab6('0xc'),auth[_0x8ab6('0x6')](),controller[_0x8ab6('0xd')]);router[_0x8ab6('0x8')](_0x8ab6('0xe'),auth[_0x8ab6('0x6')](),controller[_0x8ab6('0xf')]);router[_0x8ab6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ab6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8ab6('0x12')]);router[_0x8ab6('0x13')](_0x8ab6('0x9'),auth[_0x8ab6('0x6')](),controller[_0x8ab6('0x14')]);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 8657c88..e53ad51 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 _0x3951=['ENUM','incident','sequelize','exports','STRING'];(function(_0x764e6f,_0xfad0b4){var _0x41814f=function(_0x5b7574){while(--_0x5b7574){_0x764e6f['push'](_0x764e6f['shift']());}};_0x41814f(++_0xfad0b4);}(_0x3951,0x1ba));var _0x1395=function(_0x2eb624,_0x45a694){_0x2eb624=_0x2eb624-0x0;var _0x5c14c6=_0x3951[_0x2eb624];return _0x5c14c6;};'use strict';var Sequelize=require(_0x1395('0x0'));module[_0x1395('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1395('0x2')]},'ticketType':{'type':Sequelize[_0x1395('0x3')](_0x1395('0x4'),'phonecall'),'defaultValue':_0x1395('0x4')}}; \ No newline at end of file +var _0xb8b7=['ENUM','phonecall','incident','sequelize','exports','STRING'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0xb8b7,0xff));var _0x7b8b=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb8b7[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0x7b8b('0x0'));module[_0x7b8b('0x1')]={'name':{'type':Sequelize[_0x7b8b('0x2')]},'description':{'type':Sequelize[_0x7b8b('0x2')]},'ticketType':{'type':Sequelize[_0x7b8b('0x3')]('incident',_0x7b8b('0x4')),'defaultValue':_0x7b8b('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a662ad3..9596f56 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 _0x644d=['findAll','rows','show','params','includeAll','find','create','body','Dynamics365Field','order','getFields','findOne','sort','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','include','Dynamics365Configuration'];(function(_0xf5b712,_0x5487bf){var _0x410413=function(_0x5209ce){while(--_0x5209ce){_0xf5b712['push'](_0xf5b712['shift']());}};_0x410413(++_0x5487bf);}(_0x644d,0x1db));var _0xd644=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0x644d[_0x57fc2a];return _0xa839b;};'use strict';var pdf=require(_0xd644('0x0'));var emlformat=require(_0xd644('0x1'));var rimraf=require(_0xd644('0x2'));var zipdir=require(_0xd644('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd644('0x4'));var Mustache=require(_0xd644('0x5'));var util=require(_0xd644('0x6'));var path=require(_0xd644('0x7'));var sox=require(_0xd644('0x8'));var csv=require(_0xd644('0x9'));var ejs=require(_0xd644('0xa'));var fs=require('fs');var _=require(_0xd644('0xb'));var squel=require(_0xd644('0xc'));var crypto=require(_0xd644('0xd'));var jsforce=require(_0xd644('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd644('0x9'));var querystring=require('querystring');var Papa=require(_0xd644('0xf'));var Redis=require(_0xd644('0x10'));var authService=require(_0xd644('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd644('0x12'));var logger=require(_0xd644('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd644('0x14'));var db=require(_0xd644('0x15'))['db'];var jayson=require(_0xd644('0x16'));var client=jayson['client'][_0xd644('0x17')]({'port':0x232a});function checkPasswordPattern(_0x910028,_0x1a0660,_0x4924e1){if(_0x4924e1){var _0x5b17c3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b17c3[_0xd644('0x18')](_0x1a0660)){return _0x910028;}else{throw new db[(_0xd644('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 _0x910028;}}function respondWithRpcPromise(_0x351a86,_0x490c18,_0x20c29,_0x24dbd7){return new BPromise(function(_0x4925fc,_0xd44200){var _0x2662e9=_0x24dbd7||client;return _0x2662e9['request'](_0x351a86,_0x20c29)[_0xd644('0x1a')](function(_0x197380){logger['info'](_0xd644('0x1b'),_0x490c18,_0xd644('0x1c'));logger[_0xd644('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x490c18,'request\x20sent',JSON[_0xd644('0x1e')](_0x197380));if(_0x197380[_0xd644('0x1f')]){if(_0x197380[_0xd644('0x1f')][_0xd644('0x20')]===0x1f4){logger[_0xd644('0x1f')](_0xd644('0x1b'),_0x490c18,_0x197380[_0xd644('0x1f')][_0xd644('0x21')]);return _0xd44200(_0x197380[_0xd644('0x1f')][_0xd644('0x21')]);}logger[_0xd644('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x490c18,_0x197380['error'][_0xd644('0x21')]);return _0x4925fc(_0x197380['error'][_0xd644('0x21')]);}else{logger[_0xd644('0x22')](_0xd644('0x1b'),_0x490c18,'request\x20sent');_0x4925fc(_0x197380[_0xd644('0x23')][_0xd644('0x21')]);}})[_0xd644('0x24')](function(_0x406ecb){logger[_0xd644('0x1f')](_0xd644('0x1b'),_0x490c18,_0x406ecb);_0xd44200(_0x406ecb);});});}function respondWithStatusCode(_0x31bbb1,_0x2d5336){_0x2d5336=_0x2d5336||0xcc;return function(_0x17e5c7){if(_0x17e5c7){return _0x31bbb1[_0xd644('0x25')](_0x2d5336);}return _0x31bbb1[_0xd644('0x26')](_0x2d5336)['end']();};}function respondWithResult(_0x1f810c,_0x4ab0cf){_0x4ab0cf=_0x4ab0cf||0xc8;return function(_0x476050){if(_0x476050){return _0x1f810c['status'](_0x4ab0cf)[_0xd644('0x27')](_0x476050);}};}function respondWithFilteredResult(_0xce96b5,_0x562523){return function(_0x1e4d16){if(_0x1e4d16){var _0x3fd9d1=_0x1e4d16[_0xd644('0x28')],_0x54456e=_0x562523[_0xd644('0x29')],_0x2dad9a=_0x562523[_0xd644('0x29')]+_0x562523[_0xd644('0x2a')],_0x1753b6;if(_0x2dad9a>=_0x3fd9d1){_0x2dad9a=_0x3fd9d1;_0x1753b6=0xc8;}else{_0x1753b6=0xce;}_0xce96b5[_0xd644('0x26')](_0x1753b6);return _0xce96b5[_0xd644('0x2b')](_0xd644('0x2c'),_0x54456e+'-'+_0x2dad9a+'/'+_0x3fd9d1)[_0xd644('0x27')](_0x1e4d16);}return null;};}function patchUpdates(_0x1c422a){return function(_0x4f990d){try{jsonpatch['apply'](_0x4f990d,_0x1c422a,!![]);}catch(_0x2ae2d6){return BPromise[_0xd644('0x2d')](_0x2ae2d6);}return _0x4f990d[_0xd644('0x2e')]();};}function saveUpdates(_0x2457b1,_0x3e4c80){return function(_0x46a339){if(_0x46a339){return _0x46a339[_0xd644('0x2f')](_0x2457b1)[_0xd644('0x1a')](function(_0x2bac5f){return _0x2bac5f;});}return null;};}function removeEntity(_0xf6075d,_0x4247aa){return function(_0x5147b3){if(_0x5147b3){return _0x5147b3[_0xd644('0x30')]()[_0xd644('0x1a')](function(){_0xf6075d[_0xd644('0x26')](0xcc)[_0xd644('0x31')]();});}};}function handleEntityNotFound(_0x5de822,_0x5161f2){return function(_0x2471c4){if(!_0x2471c4){_0x5de822[_0xd644('0x25')](0x194);}return _0x2471c4;};}function handleError(_0x8368a0,_0x2cce0b){_0x2cce0b=_0x2cce0b||0x1f4;return function(_0xa8cc60){logger[_0xd644('0x1f')](_0xa8cc60[_0xd644('0x32')]);if(_0xa8cc60['name']){delete _0xa8cc60['name'];}_0x8368a0[_0xd644('0x26')](_0x2cce0b)[_0xd644('0x33')](_0xa8cc60);};}exports[_0xd644('0x34')]=function(_0x592eb4,_0x2a0ee1){var _0xc30400={},_0x9ef43={},_0x199386={'count':0x0,'rows':[]};var _0x199159=_[_0xd644('0x35')](db['Dynamics365Configuration'][_0xd644('0x36')],function(_0x4d9ad1){return{'name':_0x4d9ad1[_0xd644('0x37')],'type':_0x4d9ad1[_0xd644('0x38')][_0xd644('0x39')]};});_0x9ef43[_0xd644('0x3a')]=_[_0xd644('0x35')](_0x199159,_0xd644('0x3b'));_0x9ef43[_0xd644('0x3c')]=_[_0xd644('0x3d')](_0x592eb4['query']);_0x9ef43[_0xd644('0x3e')]=_[_0xd644('0x3f')](_0x9ef43['model'],_0x9ef43['query']);_0xc30400[_0xd644('0x40')]=_[_0xd644('0x3f')](_0x9ef43[_0xd644('0x3a')],qs[_0xd644('0x41')](_0x592eb4[_0xd644('0x3c')][_0xd644('0x41')]));_0xc30400[_0xd644('0x40')]=_0xc30400[_0xd644('0x40')][_0xd644('0x42')]?_0xc30400[_0xd644('0x40')]:_0x9ef43['model'];if(!_0x592eb4['query'][_0xd644('0x43')](_0xd644('0x44'))){_0xc30400[_0xd644('0x2a')]=qs['limit'](_0x592eb4[_0xd644('0x3c')][_0xd644('0x2a')]);_0xc30400[_0xd644('0x29')]=qs[_0xd644('0x29')](_0x592eb4['query'][_0xd644('0x29')]);}_0xc30400['order']=qs['sort'](_0x592eb4[_0xd644('0x3c')]['sort']);_0xc30400['where']=qs['filters'](_[_0xd644('0x45')](_0x592eb4[_0xd644('0x3c')],_0x9ef43['filters']),_0x199159);if(_0x592eb4['query'][_0xd644('0x46')]){_0xc30400[_0xd644('0x47')]=_[_0xd644('0x48')](_0xc30400['where'],{'$or':_[_0xd644('0x35')](_0x199159,function(_0x49606b){if(_0x49606b[_0xd644('0x38')]!==_0xd644('0x49')){var _0x197a0f={};_0x197a0f[_0x49606b[_0xd644('0x3b')]]={'$like':'%'+_0x592eb4[_0xd644('0x3c')]['filter']+'%'};return _0x197a0f;}})});}_0xc30400=_['merge']({},_0xc30400,_0x592eb4[_0xd644('0x4a')]);var _0x44db08={'where':_0xc30400['where']};return db['Dynamics365Configuration'][_0xd644('0x28')](_0x44db08)['then'](function(_0x1bc804){_0x199386[_0xd644('0x28')]=_0x1bc804;if(_0x592eb4['query']['includeAll']){_0xc30400[_0xd644('0x4b')]=[{'all':!![]}];}return db[_0xd644('0x4c')][_0xd644('0x4d')](_0xc30400);})['then'](function(_0x10c061){_0x199386[_0xd644('0x4e')]=_0x10c061;return _0x199386;})[_0xd644('0x1a')](respondWithFilteredResult(_0x2a0ee1,_0xc30400))['catch'](handleError(_0x2a0ee1,null));};exports[_0xd644('0x4f')]=function(_0x20fc29,_0x42acd6){var _0x331961={'raw':![],'where':{'id':_0x20fc29[_0xd644('0x50')]['id']}},_0x18785e={};_0x18785e['model']=_[_0xd644('0x3d')](db['Dynamics365Configuration'][_0xd644('0x36')]);_0x18785e[_0xd644('0x3c')]=_[_0xd644('0x3d')](_0x20fc29['query']);_0x18785e[_0xd644('0x3e')]=_[_0xd644('0x3f')](_0x18785e[_0xd644('0x3a')],_0x18785e[_0xd644('0x3c')]);_0x331961[_0xd644('0x40')]=_['intersection'](_0x18785e[_0xd644('0x3a')],qs[_0xd644('0x41')](_0x20fc29['query'][_0xd644('0x41')]));_0x331961[_0xd644('0x40')]=_0x331961[_0xd644('0x40')][_0xd644('0x42')]?_0x331961[_0xd644('0x40')]:_0x18785e[_0xd644('0x3a')];if(_0x20fc29['query'][_0xd644('0x51')]){_0x331961[_0xd644('0x4b')]=[{'all':!![]}];}_0x331961=_[_0xd644('0x48')]({},_0x331961,_0x20fc29[_0xd644('0x4a')]);return db[_0xd644('0x4c')][_0xd644('0x52')](_0x331961)[_0xd644('0x1a')](handleEntityNotFound(_0x42acd6,null))[_0xd644('0x1a')](respondWithResult(_0x42acd6,null))[_0xd644('0x24')](handleError(_0x42acd6,null));};exports['create']=function(_0x1e638d,_0x2cca34){return db[_0xd644('0x4c')][_0xd644('0x53')](_0x1e638d[_0xd644('0x54')],{})[_0xd644('0x1a')](respondWithResult(_0x2cca34,0xc9))['catch'](handleError(_0x2cca34,null));};exports[_0xd644('0x2f')]=function(_0x2abae8,_0x14be41){if(_0x2abae8[_0xd644('0x54')]['id']){delete _0x2abae8[_0xd644('0x54')]['id'];}return db[_0xd644('0x4c')][_0xd644('0x52')]({'where':{'id':_0x2abae8[_0xd644('0x50')]['id']}})[_0xd644('0x1a')](handleEntityNotFound(_0x14be41,null))['then'](saveUpdates(_0x2abae8['body'],null))[_0xd644('0x1a')](respondWithResult(_0x14be41,null))[_0xd644('0x24')](handleError(_0x14be41,null));};exports[_0xd644('0x30')]=function(_0x50fae3,_0x2d369f){return db['Dynamics365Configuration']['find']({'where':{'id':_0x50fae3['params']['id']}})[_0xd644('0x1a')](handleEntityNotFound(_0x2d369f,null))[_0xd644('0x1a')](removeEntity(_0x2d369f,null))[_0xd644('0x24')](handleError(_0x2d369f,null));};exports['getFields']=function(_0xa96ee5,_0x31b3e5,_0x5801b9){var _0x28fc1f={};var _0x14a9f1={};var _0x1703d9;var _0x2041b7;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0xa96ee5['params']['id']}})['then'](handleEntityNotFound(_0x31b3e5,null))[_0xd644('0x1a')](function(_0x160227){if(_0x160227){_0x1703d9=_0x160227;_0x14a9f1['model']=_[_0xd644('0x3d')](db[_0xd644('0x55')]['rawAttributes']);_0x14a9f1[_0xd644('0x3c')]=_['keys'](_0xa96ee5['query']);_0x14a9f1[_0xd644('0x3e')]=_[_0xd644('0x3f')](_0x14a9f1[_0xd644('0x3a')],_0x14a9f1[_0xd644('0x3c')]);_0x28fc1f['attributes']=_[_0xd644('0x3f')](_0x14a9f1[_0xd644('0x3a')],qs[_0xd644('0x41')](_0xa96ee5[_0xd644('0x3c')][_0xd644('0x41')]));_0x28fc1f['attributes']=_0x28fc1f[_0xd644('0x40')][_0xd644('0x42')]?_0x28fc1f[_0xd644('0x40')]:_0x14a9f1['model'];_0x28fc1f[_0xd644('0x56')]=qs['sort'](_0xa96ee5['query']['sort']);_0x28fc1f[_0xd644('0x47')]=qs[_0xd644('0x3e')](_[_0xd644('0x45')](_0xa96ee5[_0xd644('0x3c')],_0x14a9f1['filters']));if(_0xa96ee5[_0xd644('0x3c')][_0xd644('0x46')]){_0x28fc1f[_0xd644('0x47')]=_[_0xd644('0x48')](_0x28fc1f[_0xd644('0x47')],{'$or':_[_0xd644('0x35')](_0x28fc1f[_0xd644('0x40')],function(_0x1e5ab8){var _0xd9c93e={};_0xd9c93e[_0x1e5ab8]={'$like':'%'+_0xa96ee5[_0xd644('0x3c')][_0xd644('0x46')]+'%'};return _0xd9c93e;})});}_0x28fc1f=_[_0xd644('0x48')]({},_0x28fc1f,_0xa96ee5[_0xd644('0x4a')]);return _0x1703d9[_0xd644('0x57')](_0x28fc1f);}})[_0xd644('0x1a')](function(_0x2297d2){if(_0x2297d2){_0x2041b7=_0x2297d2[_0xd644('0x42')];if(!_0xa96ee5[_0xd644('0x3c')][_0xd644('0x43')](_0xd644('0x44'))){_0x28fc1f[_0xd644('0x2a')]=qs[_0xd644('0x2a')](_0xa96ee5[_0xd644('0x3c')][_0xd644('0x2a')]);_0x28fc1f[_0xd644('0x29')]=qs[_0xd644('0x29')](_0xa96ee5[_0xd644('0x3c')]['offset']);}return _0x1703d9['getFields'](_0x28fc1f);}})[_0xd644('0x1a')](function(_0x2430bc){if(_0x2430bc){return _0x2430bc?{'count':_0x2041b7,'rows':_0x2430bc}:null;}})[_0xd644('0x1a')](respondWithResult(_0x31b3e5,null))['catch'](handleError(_0x31b3e5,null));};exports['getSubjects']=function(_0x28bbc5,_0x2ae2e2,_0x3a0a10){var _0x1fd8ce={};var _0x5921ee={};var _0x203ba4;var _0x250efc;return db[_0xd644('0x4c')][_0xd644('0x58')]({'where':{'id':_0x28bbc5[_0xd644('0x50')]['id']}})[_0xd644('0x1a')](handleEntityNotFound(_0x2ae2e2,null))[_0xd644('0x1a')](function(_0x587efb){if(_0x587efb){_0x203ba4=_0x587efb;_0x5921ee[_0xd644('0x3a')]=_[_0xd644('0x3d')](db['Dynamics365Field']['rawAttributes']);_0x5921ee[_0xd644('0x3c')]=_[_0xd644('0x3d')](_0x28bbc5[_0xd644('0x3c')]);_0x5921ee['filters']=_[_0xd644('0x3f')](_0x5921ee['model'],_0x5921ee['query']);_0x1fd8ce['attributes']=_[_0xd644('0x3f')](_0x5921ee[_0xd644('0x3a')],qs['fields'](_0x28bbc5['query'][_0xd644('0x41')]));_0x1fd8ce[_0xd644('0x40')]=_0x1fd8ce[_0xd644('0x40')][_0xd644('0x42')]?_0x1fd8ce[_0xd644('0x40')]:_0x5921ee['model'];_0x1fd8ce[_0xd644('0x56')]=qs[_0xd644('0x59')](_0x28bbc5[_0xd644('0x3c')][_0xd644('0x59')]);_0x1fd8ce[_0xd644('0x47')]=qs['filters'](_[_0xd644('0x45')](_0x28bbc5[_0xd644('0x3c')],_0x5921ee[_0xd644('0x3e')]));if(_0x28bbc5['query'][_0xd644('0x46')]){_0x1fd8ce['where']=_['merge'](_0x1fd8ce[_0xd644('0x47')],{'$or':_[_0xd644('0x35')](_0x1fd8ce[_0xd644('0x40')],function(_0x427350){var _0x20c9dc={};_0x20c9dc[_0x427350]={'$like':'%'+_0x28bbc5['query']['filter']+'%'};return _0x20c9dc;})});}_0x1fd8ce=_[_0xd644('0x48')]({},_0x1fd8ce,_0x28bbc5[_0xd644('0x4a')]);return _0x203ba4['getSubjects'](_0x1fd8ce);}})[_0xd644('0x1a')](function(_0x36a7e2){if(_0x36a7e2){_0x250efc=_0x36a7e2[_0xd644('0x42')];if(!_0x28bbc5['query'][_0xd644('0x43')](_0xd644('0x44'))){_0x1fd8ce[_0xd644('0x2a')]=qs[_0xd644('0x2a')](_0x28bbc5['query'][_0xd644('0x2a')]);_0x1fd8ce[_0xd644('0x29')]=qs[_0xd644('0x29')](_0x28bbc5[_0xd644('0x3c')]['offset']);}return _0x203ba4[_0xd644('0x5a')](_0x1fd8ce);}})[_0xd644('0x1a')](function(_0xd66ed3){if(_0xd66ed3){return _0xd66ed3?{'count':_0x250efc,'rows':_0xd66ed3}:null;}})[_0xd644('0x1a')](respondWithResult(_0x2ae2e2,null))[_0xd644('0x24')](handleError(_0x2ae2e2,null));};exports[_0xd644('0x5b')]=function(_0x86d588,_0x4c3c43,_0xee19d1){var _0x1bbbed={};var _0x17817e={};var _0x48f63d;var _0x4a4e28;return db[_0xd644('0x4c')][_0xd644('0x58')]({'where':{'id':_0x86d588[_0xd644('0x50')]['id']}})[_0xd644('0x1a')](handleEntityNotFound(_0x4c3c43,null))[_0xd644('0x1a')](function(_0x42f3fb){if(_0x42f3fb){_0x48f63d=_0x42f3fb;_0x17817e[_0xd644('0x3a')]=_[_0xd644('0x3d')](db[_0xd644('0x55')][_0xd644('0x36')]);_0x17817e[_0xd644('0x3c')]=_['keys'](_0x86d588[_0xd644('0x3c')]);_0x17817e['filters']=_[_0xd644('0x3f')](_0x17817e[_0xd644('0x3a')],_0x17817e['query']);_0x1bbbed[_0xd644('0x40')]=_[_0xd644('0x3f')](_0x17817e['model'],qs[_0xd644('0x41')](_0x86d588['query'][_0xd644('0x41')]));_0x1bbbed[_0xd644('0x40')]=_0x1bbbed[_0xd644('0x40')]['length']?_0x1bbbed['attributes']:_0x17817e[_0xd644('0x3a')];_0x1bbbed[_0xd644('0x56')]=qs['sort'](_0x86d588[_0xd644('0x3c')][_0xd644('0x59')]);_0x1bbbed[_0xd644('0x47')]=qs[_0xd644('0x3e')](_[_0xd644('0x45')](_0x86d588['query'],_0x17817e[_0xd644('0x3e')]));if(_0x86d588['query']['filter']){_0x1bbbed[_0xd644('0x47')]=_[_0xd644('0x48')](_0x1bbbed[_0xd644('0x47')],{'$or':_['map'](_0x1bbbed[_0xd644('0x40')],function(_0x42e630){var _0x7ccffe={};_0x7ccffe[_0x42e630]={'$like':'%'+_0x86d588[_0xd644('0x3c')][_0xd644('0x46')]+'%'};return _0x7ccffe;})});}_0x1bbbed=_['merge']({},_0x1bbbed,_0x86d588['options']);return _0x48f63d[_0xd644('0x5b')](_0x1bbbed);}})[_0xd644('0x1a')](function(_0x2eda31){if(_0x2eda31){_0x4a4e28=_0x2eda31[_0xd644('0x42')];if(!_0x86d588[_0xd644('0x3c')][_0xd644('0x43')](_0xd644('0x44'))){_0x1bbbed['limit']=qs[_0xd644('0x2a')](_0x86d588['query'][_0xd644('0x2a')]);_0x1bbbed[_0xd644('0x29')]=qs[_0xd644('0x29')](_0x86d588[_0xd644('0x3c')]['offset']);}return _0x48f63d[_0xd644('0x5b')](_0x1bbbed);}})[_0xd644('0x1a')](function(_0x4f1fb0){if(_0x4f1fb0){return _0x4f1fb0?{'count':_0x4a4e28,'rows':_0x4f1fb0}:null;}})[_0xd644('0x1a')](respondWithResult(_0x4c3c43,null))[_0xd644('0x24')](handleError(_0x4c3c43,null));}; \ No newline at end of file +var _0xbccf=['test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','destroy','name','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','count','includeAll','include','rows','show','params','keys','length','options','find','create','body','update','getFields','findOne','pick','getSubjects','Dynamics365Field','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x9f30da,_0x1efdcb){var _0x455895=function(_0x2339f8){while(--_0x2339f8){_0x9f30da['push'](_0x9f30da['shift']());}};_0x455895(++_0x1efdcb);}(_0xbccf,0x9d));var _0xfbcc=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xbccf[_0x5d2803];return _0xdcad2c;};'use strict';var pdf=require(_0xfbcc('0x0'));var emlformat=require(_0xfbcc('0x1'));var rimraf=require(_0xfbcc('0x2'));var zipdir=require(_0xfbcc('0x3'));var jsonpatch=require(_0xfbcc('0x4'));var rp=require('request-promise');var moment=require(_0xfbcc('0x5'));var BPromise=require(_0xfbcc('0x6'));var Mustache=require(_0xfbcc('0x7'));var util=require(_0xfbcc('0x8'));var path=require(_0xfbcc('0x9'));var sox=require(_0xfbcc('0xa'));var csv=require('to-csv');var ejs=require(_0xfbcc('0xb'));var fs=require('fs');var _=require(_0xfbcc('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfbcc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfbcc('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfbcc('0xf'));var hardwareService=require(_0xfbcc('0x10'));var logger=require(_0xfbcc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xfbcc('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfbcc('0x13'));var client=jayson[_0xfbcc('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x5daffd,_0x3d04e1,_0x1bb3b9){if(_0x1bb3b9){var _0x22732c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22732c[_0xfbcc('0x15')](_0x3d04e1)){return _0x5daffd;}else{throw new db[(_0xfbcc('0x16'))][(_0xfbcc('0x17'))](_0xfbcc('0x18'));}}else{return _0x5daffd;}}function respondWithRpcPromise(_0x45d5d4,_0x5068cf,_0x14c8e6,_0x5ab76f){return new BPromise(function(_0x115ac3,_0x2cf89d){var _0x37f186=_0x5ab76f||client;return _0x37f186[_0xfbcc('0x19')](_0x45d5d4,_0x14c8e6)[_0xfbcc('0x1a')](function(_0x396f67){logger[_0xfbcc('0x1b')](_0xfbcc('0x1c'),_0x5068cf,_0xfbcc('0x1d'));logger[_0xfbcc('0x1e')](_0xfbcc('0x1f'),_0x5068cf,_0xfbcc('0x1d'),JSON[_0xfbcc('0x20')](_0x396f67));if(_0x396f67['error']){if(_0x396f67[_0xfbcc('0x21')][_0xfbcc('0x22')]===0x1f4){logger[_0xfbcc('0x21')](_0xfbcc('0x1c'),_0x5068cf,_0x396f67['error']['message']);return _0x2cf89d(_0x396f67[_0xfbcc('0x21')]['message']);}logger[_0xfbcc('0x21')](_0xfbcc('0x1c'),_0x5068cf,_0x396f67[_0xfbcc('0x21')][_0xfbcc('0x23')]);return _0x115ac3(_0x396f67[_0xfbcc('0x21')][_0xfbcc('0x23')]);}else{logger[_0xfbcc('0x1b')](_0xfbcc('0x1c'),_0x5068cf,'request\x20sent');_0x115ac3(_0x396f67[_0xfbcc('0x24')][_0xfbcc('0x23')]);}})[_0xfbcc('0x25')](function(_0x4ea641){logger[_0xfbcc('0x21')](_0xfbcc('0x1c'),_0x5068cf,_0x4ea641);_0x2cf89d(_0x4ea641);});});}function respondWithStatusCode(_0x3bb775,_0x3266cd){_0x3266cd=_0x3266cd||0xcc;return function(_0x24264c){if(_0x24264c){return _0x3bb775[_0xfbcc('0x26')](_0x3266cd);}return _0x3bb775[_0xfbcc('0x27')](_0x3266cd)[_0xfbcc('0x28')]();};}function respondWithResult(_0x5188f4,_0x3213a9){_0x3213a9=_0x3213a9||0xc8;return function(_0x1226b3){if(_0x1226b3){return _0x5188f4[_0xfbcc('0x27')](_0x3213a9)['json'](_0x1226b3);}};}function respondWithFilteredResult(_0x45d8d4,_0x18098b){return function(_0x155078){if(_0x155078){var _0x592246=_0x155078['count'],_0x27e9e7=_0x18098b['offset'],_0x4a7a30=_0x18098b[_0xfbcc('0x29')]+_0x18098b[_0xfbcc('0x2a')],_0x4bbda2;if(_0x4a7a30>=_0x592246){_0x4a7a30=_0x592246;_0x4bbda2=0xc8;}else{_0x4bbda2=0xce;}_0x45d8d4[_0xfbcc('0x27')](_0x4bbda2);return _0x45d8d4[_0xfbcc('0x2b')](_0xfbcc('0x2c'),_0x27e9e7+'-'+_0x4a7a30+'/'+_0x592246)[_0xfbcc('0x2d')](_0x155078);}return null;};}function patchUpdates(_0x141862){return function(_0x501156){try{jsonpatch[_0xfbcc('0x2e')](_0x501156,_0x141862,!![]);}catch(_0x40c4d7){return BPromise[_0xfbcc('0x2f')](_0x40c4d7);}return _0x501156[_0xfbcc('0x30')]();};}function saveUpdates(_0x5e6d66,_0x2b1ea0){return function(_0x362e16){if(_0x362e16){return _0x362e16['update'](_0x5e6d66)['then'](function(_0xb34539){return _0xb34539;});}return null;};}function removeEntity(_0x174318,_0x341650){return function(_0x3d471a){if(_0x3d471a){return _0x3d471a[_0xfbcc('0x31')]()[_0xfbcc('0x1a')](function(){_0x174318['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44c7db,_0x1f098b){return function(_0x523ebb){if(!_0x523ebb){_0x44c7db['sendStatus'](0x194);}return _0x523ebb;};}function handleError(_0x5690c8,_0x50d31a){_0x50d31a=_0x50d31a||0x1f4;return function(_0xcd0d57){logger['error'](_0xcd0d57['stack']);if(_0xcd0d57['name']){delete _0xcd0d57[_0xfbcc('0x32')];}_0x5690c8[_0xfbcc('0x27')](_0x50d31a)['send'](_0xcd0d57);};}exports['index']=function(_0x33cde3,_0x51d17f){var _0x1f09b4={},_0x50b01a={},_0x398dfd={'count':0x0,'rows':[]};var _0x1c78a5=_[_0xfbcc('0x33')](db[_0xfbcc('0x34')][_0xfbcc('0x35')],function(_0x49e73f){return{'name':_0x49e73f[_0xfbcc('0x36')],'type':_0x49e73f[_0xfbcc('0x37')][_0xfbcc('0x38')]};});_0x50b01a[_0xfbcc('0x39')]=_['map'](_0x1c78a5,_0xfbcc('0x32'));_0x50b01a[_0xfbcc('0x3a')]=_['keys'](_0x33cde3[_0xfbcc('0x3a')]);_0x50b01a[_0xfbcc('0x3b')]=_[_0xfbcc('0x3c')](_0x50b01a[_0xfbcc('0x39')],_0x50b01a[_0xfbcc('0x3a')]);_0x1f09b4[_0xfbcc('0x3d')]=_[_0xfbcc('0x3c')](_0x50b01a[_0xfbcc('0x39')],qs[_0xfbcc('0x3e')](_0x33cde3['query'][_0xfbcc('0x3e')]));_0x1f09b4[_0xfbcc('0x3d')]=_0x1f09b4[_0xfbcc('0x3d')]['length']?_0x1f09b4[_0xfbcc('0x3d')]:_0x50b01a['model'];if(!_0x33cde3[_0xfbcc('0x3a')][_0xfbcc('0x3f')](_0xfbcc('0x40'))){_0x1f09b4[_0xfbcc('0x2a')]=qs[_0xfbcc('0x2a')](_0x33cde3[_0xfbcc('0x3a')][_0xfbcc('0x2a')]);_0x1f09b4[_0xfbcc('0x29')]=qs['offset'](_0x33cde3['query'][_0xfbcc('0x29')]);}_0x1f09b4['order']=qs[_0xfbcc('0x41')](_0x33cde3['query']['sort']);_0x1f09b4[_0xfbcc('0x42')]=qs['filters'](_['pick'](_0x33cde3[_0xfbcc('0x3a')],_0x50b01a['filters']),_0x1c78a5);if(_0x33cde3['query'][_0xfbcc('0x43')]){_0x1f09b4[_0xfbcc('0x42')]=_[_0xfbcc('0x44')](_0x1f09b4[_0xfbcc('0x42')],{'$or':_[_0xfbcc('0x33')](_0x1c78a5,function(_0x30b2b3){if(_0x30b2b3[_0xfbcc('0x37')]!==_0xfbcc('0x45')){var _0x2bbe1f={};_0x2bbe1f[_0x30b2b3[_0xfbcc('0x32')]]={'$like':'%'+_0x33cde3[_0xfbcc('0x3a')][_0xfbcc('0x43')]+'%'};return _0x2bbe1f;}})});}_0x1f09b4=_[_0xfbcc('0x44')]({},_0x1f09b4,_0x33cde3['options']);var _0x330c77={'where':_0x1f09b4['where']};return db['Dynamics365Configuration'][_0xfbcc('0x46')](_0x330c77)['then'](function(_0x3c96ea){_0x398dfd[_0xfbcc('0x46')]=_0x3c96ea;if(_0x33cde3[_0xfbcc('0x3a')][_0xfbcc('0x47')]){_0x1f09b4[_0xfbcc('0x48')]=[{'all':!![]}];}return db[_0xfbcc('0x34')]['findAll'](_0x1f09b4);})['then'](function(_0xc1b603){_0x398dfd[_0xfbcc('0x49')]=_0xc1b603;return _0x398dfd;})[_0xfbcc('0x1a')](respondWithFilteredResult(_0x51d17f,_0x1f09b4))[_0xfbcc('0x25')](handleError(_0x51d17f,null));};exports[_0xfbcc('0x4a')]=function(_0x40e822,_0x305716){var _0x8ee5ab={'raw':![],'where':{'id':_0x40e822[_0xfbcc('0x4b')]['id']}},_0xed754b={};_0xed754b[_0xfbcc('0x39')]=_[_0xfbcc('0x4c')](db[_0xfbcc('0x34')][_0xfbcc('0x35')]);_0xed754b[_0xfbcc('0x3a')]=_[_0xfbcc('0x4c')](_0x40e822[_0xfbcc('0x3a')]);_0xed754b[_0xfbcc('0x3b')]=_[_0xfbcc('0x3c')](_0xed754b[_0xfbcc('0x39')],_0xed754b[_0xfbcc('0x3a')]);_0x8ee5ab[_0xfbcc('0x3d')]=_['intersection'](_0xed754b[_0xfbcc('0x39')],qs[_0xfbcc('0x3e')](_0x40e822[_0xfbcc('0x3a')][_0xfbcc('0x3e')]));_0x8ee5ab[_0xfbcc('0x3d')]=_0x8ee5ab[_0xfbcc('0x3d')][_0xfbcc('0x4d')]?_0x8ee5ab[_0xfbcc('0x3d')]:_0xed754b['model'];if(_0x40e822[_0xfbcc('0x3a')][_0xfbcc('0x47')]){_0x8ee5ab['include']=[{'all':!![]}];}_0x8ee5ab=_[_0xfbcc('0x44')]({},_0x8ee5ab,_0x40e822[_0xfbcc('0x4e')]);return db['Dynamics365Configuration'][_0xfbcc('0x4f')](_0x8ee5ab)['then'](handleEntityNotFound(_0x305716,null))[_0xfbcc('0x1a')](respondWithResult(_0x305716,null))[_0xfbcc('0x25')](handleError(_0x305716,null));};exports[_0xfbcc('0x50')]=function(_0x135298,_0x3325d4){return db['Dynamics365Configuration'][_0xfbcc('0x50')](_0x135298[_0xfbcc('0x51')],{})['then'](respondWithResult(_0x3325d4,0xc9))['catch'](handleError(_0x3325d4,null));};exports[_0xfbcc('0x52')]=function(_0x2b8e47,_0x52268e){if(_0x2b8e47[_0xfbcc('0x51')]['id']){delete _0x2b8e47[_0xfbcc('0x51')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x2b8e47['params']['id']}})[_0xfbcc('0x1a')](handleEntityNotFound(_0x52268e,null))[_0xfbcc('0x1a')](saveUpdates(_0x2b8e47[_0xfbcc('0x51')],null))[_0xfbcc('0x1a')](respondWithResult(_0x52268e,null))[_0xfbcc('0x25')](handleError(_0x52268e,null));};exports[_0xfbcc('0x31')]=function(_0x34a65b,_0x4baa97){return db['Dynamics365Configuration'][_0xfbcc('0x4f')]({'where':{'id':_0x34a65b[_0xfbcc('0x4b')]['id']}})[_0xfbcc('0x1a')](handleEntityNotFound(_0x4baa97,null))[_0xfbcc('0x1a')](removeEntity(_0x4baa97,null))[_0xfbcc('0x25')](handleError(_0x4baa97,null));};exports[_0xfbcc('0x53')]=function(_0x590bc7,_0x2aed74,_0x8beb59){var _0x3f326a={};var _0x2d1cc8={};var _0x4f510e;var _0x352470;return db[_0xfbcc('0x34')][_0xfbcc('0x54')]({'where':{'id':_0x590bc7[_0xfbcc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2aed74,null))['then'](function(_0x42edcc){if(_0x42edcc){_0x4f510e=_0x42edcc;_0x2d1cc8[_0xfbcc('0x39')]=_[_0xfbcc('0x4c')](db['Dynamics365Field'][_0xfbcc('0x35')]);_0x2d1cc8[_0xfbcc('0x3a')]=_[_0xfbcc('0x4c')](_0x590bc7[_0xfbcc('0x3a')]);_0x2d1cc8[_0xfbcc('0x3b')]=_[_0xfbcc('0x3c')](_0x2d1cc8[_0xfbcc('0x39')],_0x2d1cc8['query']);_0x3f326a['attributes']=_['intersection'](_0x2d1cc8[_0xfbcc('0x39')],qs[_0xfbcc('0x3e')](_0x590bc7[_0xfbcc('0x3a')][_0xfbcc('0x3e')]));_0x3f326a['attributes']=_0x3f326a[_0xfbcc('0x3d')][_0xfbcc('0x4d')]?_0x3f326a['attributes']:_0x2d1cc8['model'];_0x3f326a['order']=qs['sort'](_0x590bc7['query'][_0xfbcc('0x41')]);_0x3f326a['where']=qs[_0xfbcc('0x3b')](_[_0xfbcc('0x55')](_0x590bc7['query'],_0x2d1cc8[_0xfbcc('0x3b')]));if(_0x590bc7[_0xfbcc('0x3a')][_0xfbcc('0x43')]){_0x3f326a['where']=_[_0xfbcc('0x44')](_0x3f326a[_0xfbcc('0x42')],{'$or':_[_0xfbcc('0x33')](_0x3f326a[_0xfbcc('0x3d')],function(_0x542e20){var _0x5721a7={};_0x5721a7[_0x542e20]={'$like':'%'+_0x590bc7[_0xfbcc('0x3a')][_0xfbcc('0x43')]+'%'};return _0x5721a7;})});}_0x3f326a=_[_0xfbcc('0x44')]({},_0x3f326a,_0x590bc7[_0xfbcc('0x4e')]);return _0x4f510e[_0xfbcc('0x53')](_0x3f326a);}})[_0xfbcc('0x1a')](function(_0x43db01){if(_0x43db01){_0x352470=_0x43db01['length'];if(!_0x590bc7[_0xfbcc('0x3a')][_0xfbcc('0x3f')](_0xfbcc('0x40'))){_0x3f326a[_0xfbcc('0x2a')]=qs['limit'](_0x590bc7['query'][_0xfbcc('0x2a')]);_0x3f326a[_0xfbcc('0x29')]=qs[_0xfbcc('0x29')](_0x590bc7[_0xfbcc('0x3a')][_0xfbcc('0x29')]);}return _0x4f510e[_0xfbcc('0x53')](_0x3f326a);}})[_0xfbcc('0x1a')](function(_0x3486bc){if(_0x3486bc){return _0x3486bc?{'count':_0x352470,'rows':_0x3486bc}:null;}})[_0xfbcc('0x1a')](respondWithResult(_0x2aed74,null))[_0xfbcc('0x25')](handleError(_0x2aed74,null));};exports[_0xfbcc('0x56')]=function(_0x5430c9,_0x570381,_0xe47cdc){var _0x284341={};var _0x268d32={};var _0x503c12;var _0x467705;return db['Dynamics365Configuration'][_0xfbcc('0x54')]({'where':{'id':_0x5430c9['params']['id']}})[_0xfbcc('0x1a')](handleEntityNotFound(_0x570381,null))['then'](function(_0x1bb6ca){if(_0x1bb6ca){_0x503c12=_0x1bb6ca;_0x268d32[_0xfbcc('0x39')]=_[_0xfbcc('0x4c')](db[_0xfbcc('0x57')]['rawAttributes']);_0x268d32[_0xfbcc('0x3a')]=_[_0xfbcc('0x4c')](_0x5430c9['query']);_0x268d32[_0xfbcc('0x3b')]=_[_0xfbcc('0x3c')](_0x268d32['model'],_0x268d32[_0xfbcc('0x3a')]);_0x284341[_0xfbcc('0x3d')]=_[_0xfbcc('0x3c')](_0x268d32[_0xfbcc('0x39')],qs['fields'](_0x5430c9[_0xfbcc('0x3a')][_0xfbcc('0x3e')]));_0x284341[_0xfbcc('0x3d')]=_0x284341[_0xfbcc('0x3d')][_0xfbcc('0x4d')]?_0x284341[_0xfbcc('0x3d')]:_0x268d32[_0xfbcc('0x39')];_0x284341['order']=qs['sort'](_0x5430c9[_0xfbcc('0x3a')][_0xfbcc('0x41')]);_0x284341[_0xfbcc('0x42')]=qs[_0xfbcc('0x3b')](_[_0xfbcc('0x55')](_0x5430c9[_0xfbcc('0x3a')],_0x268d32[_0xfbcc('0x3b')]));if(_0x5430c9[_0xfbcc('0x3a')][_0xfbcc('0x43')]){_0x284341[_0xfbcc('0x42')]=_[_0xfbcc('0x44')](_0x284341[_0xfbcc('0x42')],{'$or':_[_0xfbcc('0x33')](_0x284341[_0xfbcc('0x3d')],function(_0x59e9e7){var _0x43fd59={};_0x43fd59[_0x59e9e7]={'$like':'%'+_0x5430c9[_0xfbcc('0x3a')][_0xfbcc('0x43')]+'%'};return _0x43fd59;})});}_0x284341=_[_0xfbcc('0x44')]({},_0x284341,_0x5430c9['options']);return _0x503c12[_0xfbcc('0x56')](_0x284341);}})[_0xfbcc('0x1a')](function(_0x5c1f98){if(_0x5c1f98){_0x467705=_0x5c1f98[_0xfbcc('0x4d')];if(!_0x5430c9[_0xfbcc('0x3a')][_0xfbcc('0x3f')](_0xfbcc('0x40'))){_0x284341['limit']=qs[_0xfbcc('0x2a')](_0x5430c9[_0xfbcc('0x3a')][_0xfbcc('0x2a')]);_0x284341['offset']=qs['offset'](_0x5430c9[_0xfbcc('0x3a')][_0xfbcc('0x29')]);}return _0x503c12[_0xfbcc('0x56')](_0x284341);}})[_0xfbcc('0x1a')](function(_0x5fadbb){if(_0x5fadbb){return _0x5fadbb?{'count':_0x467705,'rows':_0x5fadbb}:null;}})['then'](respondWithResult(_0x570381,null))[_0xfbcc('0x25')](handleError(_0x570381,null));};exports['getDescriptions']=function(_0xc93aed,_0x1e8e16,_0x543e4a){var _0x45040e={};var _0x413f70={};var _0x43d604;var _0x3599cc;return db[_0xfbcc('0x34')][_0xfbcc('0x54')]({'where':{'id':_0xc93aed[_0xfbcc('0x4b')]['id']}})[_0xfbcc('0x1a')](handleEntityNotFound(_0x1e8e16,null))[_0xfbcc('0x1a')](function(_0x5c8788){if(_0x5c8788){_0x43d604=_0x5c8788;_0x413f70['model']=_['keys'](db[_0xfbcc('0x57')]['rawAttributes']);_0x413f70[_0xfbcc('0x3a')]=_[_0xfbcc('0x4c')](_0xc93aed[_0xfbcc('0x3a')]);_0x413f70[_0xfbcc('0x3b')]=_[_0xfbcc('0x3c')](_0x413f70[_0xfbcc('0x39')],_0x413f70[_0xfbcc('0x3a')]);_0x45040e[_0xfbcc('0x3d')]=_[_0xfbcc('0x3c')](_0x413f70[_0xfbcc('0x39')],qs[_0xfbcc('0x3e')](_0xc93aed['query'][_0xfbcc('0x3e')]));_0x45040e['attributes']=_0x45040e[_0xfbcc('0x3d')]['length']?_0x45040e[_0xfbcc('0x3d')]:_0x413f70[_0xfbcc('0x39')];_0x45040e['order']=qs[_0xfbcc('0x41')](_0xc93aed[_0xfbcc('0x3a')]['sort']);_0x45040e['where']=qs[_0xfbcc('0x3b')](_[_0xfbcc('0x55')](_0xc93aed[_0xfbcc('0x3a')],_0x413f70[_0xfbcc('0x3b')]));if(_0xc93aed[_0xfbcc('0x3a')][_0xfbcc('0x43')]){_0x45040e['where']=_[_0xfbcc('0x44')](_0x45040e['where'],{'$or':_[_0xfbcc('0x33')](_0x45040e[_0xfbcc('0x3d')],function(_0x4437e0){var _0x1e27a0={};_0x1e27a0[_0x4437e0]={'$like':'%'+_0xc93aed[_0xfbcc('0x3a')][_0xfbcc('0x43')]+'%'};return _0x1e27a0;})});}_0x45040e=_['merge']({},_0x45040e,_0xc93aed[_0xfbcc('0x4e')]);return _0x43d604[_0xfbcc('0x58')](_0x45040e);}})[_0xfbcc('0x1a')](function(_0x810975){if(_0x810975){_0x3599cc=_0x810975['length'];if(!_0xc93aed[_0xfbcc('0x3a')][_0xfbcc('0x3f')](_0xfbcc('0x40'))){_0x45040e['limit']=qs[_0xfbcc('0x2a')](_0xc93aed[_0xfbcc('0x3a')]['limit']);_0x45040e[_0xfbcc('0x29')]=qs[_0xfbcc('0x29')](_0xc93aed[_0xfbcc('0x3a')][_0xfbcc('0x29')]);}return _0x43d604[_0xfbcc('0x58')](_0x45040e);}})[_0xfbcc('0x1a')](function(_0xe3c2ee){if(_0xe3c2ee){return _0xe3c2ee?{'count':_0x3599cc,'rows':_0xe3c2ee}:null;}})[_0xfbcc('0x1a')](respondWithResult(_0x1e8e16,null))['catch'](handleError(_0x1e8e16,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index cae1319..4d92a6a 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 _0xcecc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_dynamics365_configurations','lodash'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xcecc,0xc2));var _0xccec=function(_0x259e38,_0x1405f7){_0x259e38=_0x259e38-0x0;var _0x12e1b8=_0xcecc[_0x259e38];return _0x12e1b8;};'use strict';var _=require(_0xccec('0x0'));var util=require(_0xccec('0x1'));var logger=require(_0xccec('0x2'))(_0xccec('0x3'));var moment=require(_0xccec('0x4'));var BPromise=require(_0xccec('0x5'));var rp=require(_0xccec('0x6'));var fs=require('fs');var path=require(_0xccec('0x7'));var rimraf=require(_0xccec('0x8'));var config=require(_0xccec('0x9'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xccec('0xa')]=function(_0x2da417,_0x251fea){return _0x2da417[_0xccec('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xccec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd739=['moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','api'];(function(_0x2a9e2a,_0x422e3e){var _0x290b00=function(_0x1c8e2d){while(--_0x1c8e2d){_0x2a9e2a['push'](_0x2a9e2a['shift']());}};_0x290b00(++_0x422e3e);}(_0xd739,0xf0));var _0x9d73=function(_0x47a46a,_0xf9c90f){_0x47a46a=_0x47a46a-0x0;var _0x43df70=_0xd739[_0x47a46a];return _0x43df70;};'use strict';var _=require(_0x9d73('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d73('0x1'));var moment=require(_0x9d73('0x2'));var BPromise=require('bluebird');var rp=require(_0x9d73('0x3'));var fs=require('fs');var path=require(_0x9d73('0x4'));var rimraf=require(_0x9d73('0x5'));var config=require(_0x9d73('0x6'));var attributes=require(_0x9d73('0x7'));module[_0x9d73('0x8')]=function(_0x3c5005,_0xbbcea6){return _0x3c5005[_0x9d73('0x9')](_0x9d73('0xa'),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 b8062af..50e0a5b 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 _0x44e2=['message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3131f0,_0x5c63df){var _0x578891=function(_0x8a2cdf){while(--_0x8a2cdf){_0x3131f0['push'](_0x3131f0['shift']());}};_0x578891(++_0x5c63df);}(_0x44e2,0x17c));var _0x244e=function(_0x2f771f,_0x62f659){_0x2f771f=_0x2f771f-0x0;var _0x1cbe5d=_0x44e2[_0x2f771f];return _0x1cbe5d;};'use strict';var _=require(_0x244e('0x0'));var util=require(_0x244e('0x1'));var moment=require(_0x244e('0x2'));var BPromise=require(_0x244e('0x3'));var rs=require(_0x244e('0x4'));var fs=require('fs');var Redis=require(_0x244e('0x5'));var db=require(_0x244e('0x6'))['db'];var utils=require(_0x244e('0x7'));var logger=require(_0x244e('0x8'))('rpc');var config=require(_0x244e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x244e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f887,_0x48dddd,_0x37d257){return new BPromise(function(_0x12a079,_0x3317db){return client[_0x244e('0xb')](_0x24f887,_0x37d257)[_0x244e('0xc')](function(_0xd6347b){logger['info'](_0x244e('0xd'),_0x48dddd,_0x244e('0xe'));logger['debug'](_0x244e('0xf'),_0x48dddd,_0x244e('0xe'),JSON[_0x244e('0x10')](_0xd6347b));if(_0xd6347b[_0x244e('0x11')]){if(_0xd6347b[_0x244e('0x11')][_0x244e('0x12')]===0x1f4){logger['error'](_0x244e('0xd'),_0x48dddd,_0xd6347b[_0x244e('0x11')][_0x244e('0x13')]);return _0x3317db(_0xd6347b[_0x244e('0x11')][_0x244e('0x13')]);}logger['error'](_0x244e('0xd'),_0x48dddd,_0xd6347b['error'][_0x244e('0x13')]);return _0x12a079(_0xd6347b[_0x244e('0x11')]['message']);}else{logger[_0x244e('0x14')](_0x244e('0xd'),_0x48dddd,_0x244e('0xe'));_0x12a079(_0xd6347b['result'][_0x244e('0x13')]);}})['catch'](function(_0x74f68e){logger[_0x244e('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x48dddd,_0x74f68e);_0x3317db(_0x74f68e);});});} \ No newline at end of file +var _0x1b5d=['rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1b7ea6,_0x195a62){var _0x4fcea6=function(_0x29ace1){while(--_0x29ace1){_0x1b7ea6['push'](_0x1b7ea6['shift']());}};_0x4fcea6(++_0x195a62);}(_0x1b5d,0x7d));var _0xd1b5=function(_0x298632,_0xfaac03){_0x298632=_0x298632-0x0;var _0xfa7deb=_0x1b5d[_0x298632];return _0xfa7deb;};'use strict';var _=require(_0xd1b5('0x0'));var util=require(_0xd1b5('0x1'));var moment=require('moment');var BPromise=require(_0xd1b5('0x2'));var rs=require(_0xd1b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1b5('0x4'))['db'];var utils=require(_0xd1b5('0x5'));var logger=require(_0xd1b5('0x6'))(_0xd1b5('0x7'));var config=require(_0xd1b5('0x8'));var jayson=require(_0xd1b5('0x9'));var client=jayson[_0xd1b5('0xa')][_0xd1b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x589d2a,_0xbef638,_0x3d414f){return new BPromise(function(_0x28b401,_0x16d2f0){return client[_0xd1b5('0xc')](_0x589d2a,_0x3d414f)['then'](function(_0x21c7bc){logger[_0xd1b5('0xd')](_0xd1b5('0xe'),_0xbef638,_0xd1b5('0xf'));logger[_0xd1b5('0x10')](_0xd1b5('0x11'),_0xbef638,_0xd1b5('0xf'),JSON[_0xd1b5('0x12')](_0x21c7bc));if(_0x21c7bc[_0xd1b5('0x13')]){if(_0x21c7bc[_0xd1b5('0x13')]['code']===0x1f4){logger[_0xd1b5('0x13')](_0xd1b5('0xe'),_0xbef638,_0x21c7bc[_0xd1b5('0x13')][_0xd1b5('0x14')]);return _0x16d2f0(_0x21c7bc[_0xd1b5('0x13')]['message']);}logger[_0xd1b5('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0xbef638,_0x21c7bc[_0xd1b5('0x13')][_0xd1b5('0x14')]);return _0x28b401(_0x21c7bc[_0xd1b5('0x13')]['message']);}else{logger['info'](_0xd1b5('0xe'),_0xbef638,_0xd1b5('0xf'));_0x28b401(_0x21c7bc[_0xd1b5('0x15')][_0xd1b5('0x14')]);}})['catch'](function(_0x3176ce){logger[_0xd1b5('0x13')](_0xd1b5('0xe'),_0xbef638,_0x3176ce);_0x16d2f0(_0x3176ce);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9ea3261..36250ed 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 _0xb9a7=['isAuthenticated','index','/:id','show','create','update','delete','exports','util','Router','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb9a7,0x112));var _0x7b9a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb9a7[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x7b9a('0x2'));var config=require(_0x7b9a('0x3'));var controller=require(_0x7b9a('0x4'));router[_0x7b9a('0x5')]('/',auth[_0x7b9a('0x6')](),controller[_0x7b9a('0x7')]);router[_0x7b9a('0x5')](_0x7b9a('0x8'),auth[_0x7b9a('0x6')](),controller[_0x7b9a('0x9')]);router['post']('/',auth[_0x7b9a('0x6')](),controller[_0x7b9a('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7b9a('0xb')]);router[_0x7b9a('0xc')]('/:id',auth[_0x7b9a('0x6')](),controller['destroy']);module[_0x7b9a('0xd')]=router; \ No newline at end of file +var _0x1ba2=['update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','/:id'];(function(_0xf3777b,_0x896c16){var _0x155f65=function(_0x522427){while(--_0x522427){_0xf3777b['push'](_0xf3777b['shift']());}};_0x155f65(++_0x896c16);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x21ba('0x0'));var util=require('util');var path=require(_0x21ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x21ba('0x2'));var router=express[_0x21ba('0x3')]();var auth=require(_0x21ba('0x4'));var interaction=require(_0x21ba('0x5'));var config=require(_0x21ba('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x21ba('0x7')]('/',auth[_0x21ba('0x8')](),controller['index']);router[_0x21ba('0x7')]('/:id',auth[_0x21ba('0x8')](),controller[_0x21ba('0x9')]);router['post']('/',auth[_0x21ba('0x8')](),controller['create']);router[_0x21ba('0xa')](_0x21ba('0xb'),auth['isAuthenticated'](),controller[_0x21ba('0xc')]);router[_0x21ba('0xd')](_0x21ba('0xb'),auth[_0x21ba('0x8')](),controller[_0x21ba('0xe')]);module[_0x21ba('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 15b0e55..6cbbfaf 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 _0x2b52=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x4a1724,_0x581e12){var _0x124874=function(_0xc86215){while(--_0xc86215){_0x4a1724['push'](_0x4a1724['shift']());}};_0x124874(++_0x581e12);}(_0x2b52,0x12a));var _0x22b5=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x2b52[_0x36ed3c];return _0x52a2e0;};'use strict';var Sequelize=require(_0x22b5('0x0'));module[_0x22b5('0x1')]={'type':{'type':Sequelize['ENUM'](_0x22b5('0x2'),_0x22b5('0x3'),_0x22b5('0x4'),_0x22b5('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x22b5('0x6')]},'keyType':{'type':Sequelize[_0x22b5('0x7')](_0x22b5('0x2'),_0x22b5('0x3'),_0x22b5('0x4'))},'keyContent':{'type':Sequelize[_0x22b5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x22b5('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc4f5=['customVariable','keyValue','string','STRING','BOOLEAN','ENUM','variable'];(function(_0x4fa420,_0x4df6de){var _0x39c36d=function(_0x11b9b3){while(--_0x11b9b3){_0x4fa420['push'](_0x4fa420['shift']());}};_0x39c36d(++_0x4df6de);}(_0xc4f5,0x75));var _0x5c4f=function(_0x132d9e,_0x4a0839){_0x132d9e=_0x132d9e-0x0;var _0x40b733=_0xc4f5[_0x132d9e];return _0x40b733;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5c4f('0x0')]('string',_0x5c4f('0x1'),_0x5c4f('0x2'),_0x5c4f('0x3')),'defaultValue':_0x5c4f('0x4')},'content':{'type':Sequelize[_0x5c4f('0x5')]},'key':{'type':Sequelize[_0x5c4f('0x5')]},'keyType':{'type':Sequelize[_0x5c4f('0x0')](_0x5c4f('0x4'),_0x5c4f('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x5c4f('0x5')]},'idField':{'type':Sequelize[_0x5c4f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5c4f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5c4f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b1dab03..be2575f 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 _0xd0b1=['then','error','name','index','Dynamics365Field','fieldName','type','model','map','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','catch','params','keys','include','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x1f88f0,_0x2dc0ac){var _0x3684f5=function(_0x2f5efd){while(--_0x2f5efd){_0x1f88f0['push'](_0x1f88f0['shift']());}};_0x3684f5(++_0x2dc0ac);}(_0xd0b1,0x64));var _0x1d0b=function(_0x1b0619,_0x4fc19c){_0x1b0619=_0x1b0619-0x0;var _0x2def45=_0xd0b1[_0x1b0619];return _0x2def45;};'use strict';var pdf=require(_0x1d0b('0x0'));var emlformat=require(_0x1d0b('0x1'));var rimraf=require(_0x1d0b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d0b('0x3'));var rp=require(_0x1d0b('0x4'));var moment=require(_0x1d0b('0x5'));var BPromise=require(_0x1d0b('0x6'));var Mustache=require(_0x1d0b('0x7'));var util=require('util');var path=require(_0x1d0b('0x8'));var sox=require(_0x1d0b('0x9'));var csv=require('to-csv');var ejs=require(_0x1d0b('0xa'));var fs=require('fs');var _=require(_0x1d0b('0xb'));var squel=require(_0x1d0b('0xc'));var crypto=require('crypto');var jsforce=require(_0x1d0b('0xd'));var deskjs=require(_0x1d0b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1d0b('0xf'));var authService=require(_0x1d0b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1d0b('0x11'));var hardwareService=require(_0x1d0b('0x12'));var logger=require(_0x1d0b('0x13'))(_0x1d0b('0x14'));var utils=require(_0x1d0b('0x15'));var config=require(_0x1d0b('0x16'));var db=require(_0x1d0b('0x17'))['db'];function respondWithStatusCode(_0x495e8f,_0x32817c){_0x32817c=_0x32817c||0xcc;return function(_0x94ed14){if(_0x94ed14){return _0x495e8f[_0x1d0b('0x18')](_0x32817c);}return _0x495e8f[_0x1d0b('0x19')](_0x32817c)[_0x1d0b('0x1a')]();};}function respondWithResult(_0x3e0530,_0x5d6352){_0x5d6352=_0x5d6352||0xc8;return function(_0xb48d4){if(_0xb48d4){return _0x3e0530['status'](_0x5d6352)[_0x1d0b('0x1b')](_0xb48d4);}};}function respondWithFilteredResult(_0x1917eb,_0x403a6a){return function(_0x4416d0){if(_0x4416d0){var _0xddf9c4=_0x4416d0[_0x1d0b('0x1c')],_0x4c266e=_0x403a6a[_0x1d0b('0x1d')],_0x27440e=_0x403a6a['offset']+_0x403a6a[_0x1d0b('0x1e')],_0x35408f;if(_0x27440e>=_0xddf9c4){_0x27440e=_0xddf9c4;_0x35408f=0xc8;}else{_0x35408f=0xce;}_0x1917eb[_0x1d0b('0x19')](_0x35408f);return _0x1917eb[_0x1d0b('0x1f')](_0x1d0b('0x20'),_0x4c266e+'-'+_0x27440e+'/'+_0xddf9c4)[_0x1d0b('0x1b')](_0x4416d0);}return null;};}function patchUpdates(_0x399ab4){return function(_0x26c8fe){try{jsonpatch['apply'](_0x26c8fe,_0x399ab4,!![]);}catch(_0x244d22){return BPromise[_0x1d0b('0x21')](_0x244d22);}return _0x26c8fe[_0x1d0b('0x22')]();};}function saveUpdates(_0x2af372,_0x5a13e4){return function(_0x11b66c){if(_0x11b66c){return _0x11b66c[_0x1d0b('0x23')](_0x2af372)[_0x1d0b('0x24')](function(_0x32b80f){return _0x32b80f;});}return null;};}function removeEntity(_0x3ea0f8,_0x3eb12c){return function(_0xd48533){if(_0xd48533){return _0xd48533['destroy']()['then'](function(){_0x3ea0f8['status'](0xcc)[_0x1d0b('0x1a')]();});}};}function handleEntityNotFound(_0xc9e584,_0x216161){return function(_0x3b33c0){if(!_0x3b33c0){_0xc9e584[_0x1d0b('0x18')](0x194);}return _0x3b33c0;};}function handleError(_0x3df451,_0x1f5516){_0x1f5516=_0x1f5516||0x1f4;return function(_0xef72d2){logger[_0x1d0b('0x25')](_0xef72d2['stack']);if(_0xef72d2[_0x1d0b('0x26')]){delete _0xef72d2[_0x1d0b('0x26')];}_0x3df451[_0x1d0b('0x19')](_0x1f5516)['send'](_0xef72d2);};}exports[_0x1d0b('0x27')]=function(_0x1dcc59,_0x40b16c){var _0x247982={},_0x59c1c1={},_0x3a8fcf={'count':0x0,'rows':[]};var _0x39f9ae=_['map'](db[_0x1d0b('0x28')]['rawAttributes'],function(_0x4b6a93){return{'name':_0x4b6a93[_0x1d0b('0x29')],'type':_0x4b6a93[_0x1d0b('0x2a')]['key']};});_0x59c1c1[_0x1d0b('0x2b')]=_[_0x1d0b('0x2c')](_0x39f9ae,'name');_0x59c1c1['query']=_['keys'](_0x1dcc59['query']);_0x59c1c1[_0x1d0b('0x2d')]=_[_0x1d0b('0x2e')](_0x59c1c1[_0x1d0b('0x2b')],_0x59c1c1[_0x1d0b('0x2f')]);_0x247982[_0x1d0b('0x30')]=_['intersection'](_0x59c1c1['model'],qs[_0x1d0b('0x31')](_0x1dcc59[_0x1d0b('0x2f')][_0x1d0b('0x31')]));_0x247982[_0x1d0b('0x30')]=_0x247982[_0x1d0b('0x30')][_0x1d0b('0x32')]?_0x247982[_0x1d0b('0x30')]:_0x59c1c1['model'];if(!_0x1dcc59[_0x1d0b('0x2f')]['hasOwnProperty'](_0x1d0b('0x33'))){_0x247982[_0x1d0b('0x1e')]=qs['limit'](_0x1dcc59[_0x1d0b('0x2f')][_0x1d0b('0x1e')]);_0x247982[_0x1d0b('0x1d')]=qs[_0x1d0b('0x1d')](_0x1dcc59[_0x1d0b('0x2f')]['offset']);}_0x247982[_0x1d0b('0x34')]=qs[_0x1d0b('0x35')](_0x1dcc59[_0x1d0b('0x2f')][_0x1d0b('0x35')]);_0x247982[_0x1d0b('0x36')]=qs[_0x1d0b('0x2d')](_['pick'](_0x1dcc59[_0x1d0b('0x2f')],_0x59c1c1['filters']),_0x39f9ae);if(_0x1dcc59[_0x1d0b('0x2f')][_0x1d0b('0x37')]){_0x247982[_0x1d0b('0x36')]=_['merge'](_0x247982[_0x1d0b('0x36')],{'$or':_['map'](_0x39f9ae,function(_0x36cf57){if(_0x36cf57['type']!==_0x1d0b('0x38')){var _0x22bd52={};_0x22bd52[_0x36cf57[_0x1d0b('0x26')]]={'$like':'%'+_0x1dcc59[_0x1d0b('0x2f')][_0x1d0b('0x37')]+'%'};return _0x22bd52;}})});}_0x247982=_[_0x1d0b('0x39')]({},_0x247982,_0x1dcc59['options']);var _0x1b48e6={'where':_0x247982[_0x1d0b('0x36')]};return db['Dynamics365Field'][_0x1d0b('0x1c')](_0x1b48e6)[_0x1d0b('0x24')](function(_0x59f8c0){_0x3a8fcf['count']=_0x59f8c0;if(_0x1dcc59[_0x1d0b('0x2f')][_0x1d0b('0x3a')]){_0x247982['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x1d0b('0x3b')](_0x247982);})[_0x1d0b('0x24')](function(_0x177a2b){_0x3a8fcf['rows']=_0x177a2b;return _0x3a8fcf;})['then'](respondWithFilteredResult(_0x40b16c,_0x247982))[_0x1d0b('0x3c')](handleError(_0x40b16c,null));};exports['show']=function(_0xf9a73e,_0x43f89f){var _0x247ffc={'raw':!![],'where':{'id':_0xf9a73e[_0x1d0b('0x3d')]['id']}},_0x37d63d={};_0x37d63d[_0x1d0b('0x2b')]=_[_0x1d0b('0x3e')](db[_0x1d0b('0x28')]['rawAttributes']);_0x37d63d[_0x1d0b('0x2f')]=_[_0x1d0b('0x3e')](_0xf9a73e[_0x1d0b('0x2f')]);_0x37d63d[_0x1d0b('0x2d')]=_[_0x1d0b('0x2e')](_0x37d63d[_0x1d0b('0x2b')],_0x37d63d[_0x1d0b('0x2f')]);_0x247ffc[_0x1d0b('0x30')]=_[_0x1d0b('0x2e')](_0x37d63d['model'],qs['fields'](_0xf9a73e[_0x1d0b('0x2f')][_0x1d0b('0x31')]));_0x247ffc['attributes']=_0x247ffc['attributes'][_0x1d0b('0x32')]?_0x247ffc[_0x1d0b('0x30')]:_0x37d63d[_0x1d0b('0x2b')];if(_0xf9a73e['query'][_0x1d0b('0x3a')]){_0x247ffc[_0x1d0b('0x3f')]=[{'all':!![]}];}_0x247ffc=_[_0x1d0b('0x39')]({},_0x247ffc,_0xf9a73e['options']);return db[_0x1d0b('0x28')][_0x1d0b('0x40')](_0x247ffc)[_0x1d0b('0x24')](handleEntityNotFound(_0x43f89f,null))['then'](respondWithResult(_0x43f89f,null))[_0x1d0b('0x3c')](handleError(_0x43f89f,null));};exports[_0x1d0b('0x41')]=function(_0x4caef2,_0x15e656){return db[_0x1d0b('0x28')]['create'](_0x4caef2['body'],{})[_0x1d0b('0x24')](respondWithResult(_0x15e656,0xc9))[_0x1d0b('0x3c')](handleError(_0x15e656,null));};exports[_0x1d0b('0x23')]=function(_0xfd472c,_0x3fe86b){if(_0xfd472c[_0x1d0b('0x42')]['id']){delete _0xfd472c['body']['id'];}return db[_0x1d0b('0x28')]['find']({'where':{'id':_0xfd472c[_0x1d0b('0x3d')]['id']}})[_0x1d0b('0x24')](handleEntityNotFound(_0x3fe86b,null))[_0x1d0b('0x24')](saveUpdates(_0xfd472c[_0x1d0b('0x42')],null))[_0x1d0b('0x24')](respondWithResult(_0x3fe86b,null))[_0x1d0b('0x3c')](handleError(_0x3fe86b,null));};exports[_0x1d0b('0x43')]=function(_0x5ca410,_0x266e8e){return db[_0x1d0b('0x28')][_0x1d0b('0x40')]({'where':{'id':_0x5ca410[_0x1d0b('0x3d')]['id']}})[_0x1d0b('0x24')](handleEntityNotFound(_0x266e8e,null))['then'](removeEntity(_0x266e8e,null))[_0x1d0b('0x3c')](handleError(_0x266e8e,null));}; \ No newline at end of file +var _0x865d=['sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','Dynamics365Field','includeAll','include','findAll','params','keys','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x5e86b1,_0x157198){var _0x273e9f=function(_0xadc7f6){while(--_0xadc7f6){_0x5e86b1['push'](_0x5e86b1['shift']());}};_0x273e9f(++_0x157198);}(_0x865d,0x1d9));var _0xd865=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x865d[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xd865('0x0'));var emlformat=require(_0xd865('0x1'));var rimraf=require(_0xd865('0x2'));var zipdir=require(_0xd865('0x3'));var jsonpatch=require(_0xd865('0x4'));var rp=require(_0xd865('0x5'));var moment=require(_0xd865('0x6'));var BPromise=require(_0xd865('0x7'));var Mustache=require('mustache');var util=require(_0xd865('0x8'));var path=require(_0xd865('0x9'));var sox=require(_0xd865('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd865('0xb'));var crypto=require(_0xd865('0xc'));var jsforce=require(_0xd865('0xd'));var deskjs=require(_0xd865('0xe'));var toCsv=require(_0xd865('0xf'));var querystring=require('querystring');var Papa=require(_0xd865('0x10'));var Redis=require(_0xd865('0x11'));var authService=require(_0xd865('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd865('0x13'));var hardwareService=require(_0xd865('0x14'));var logger=require(_0xd865('0x15'))(_0xd865('0x16'));var utils=require(_0xd865('0x17'));var config=require('../../config/environment');var db=require(_0xd865('0x18'))['db'];function respondWithStatusCode(_0x5bdba6,_0x454c04){_0x454c04=_0x454c04||0xcc;return function(_0x4d85d1){if(_0x4d85d1){return _0x5bdba6[_0xd865('0x19')](_0x454c04);}return _0x5bdba6[_0xd865('0x1a')](_0x454c04)['end']();};}function respondWithResult(_0x14d301,_0x41dd56){_0x41dd56=_0x41dd56||0xc8;return function(_0x1bface){if(_0x1bface){return _0x14d301[_0xd865('0x1a')](_0x41dd56)[_0xd865('0x1b')](_0x1bface);}};}function respondWithFilteredResult(_0x258f55,_0x554787){return function(_0x272273){if(_0x272273){var _0x192da4=_0x272273[_0xd865('0x1c')],_0x337d2d=_0x554787[_0xd865('0x1d')],_0x1f845b=_0x554787[_0xd865('0x1d')]+_0x554787[_0xd865('0x1e')],_0x291a1d;if(_0x1f845b>=_0x192da4){_0x1f845b=_0x192da4;_0x291a1d=0xc8;}else{_0x291a1d=0xce;}_0x258f55[_0xd865('0x1a')](_0x291a1d);return _0x258f55[_0xd865('0x1f')](_0xd865('0x20'),_0x337d2d+'-'+_0x1f845b+'/'+_0x192da4)[_0xd865('0x1b')](_0x272273);}return null;};}function patchUpdates(_0x361a66){return function(_0xaf327b){try{jsonpatch['apply'](_0xaf327b,_0x361a66,!![]);}catch(_0x5376c5){return BPromise[_0xd865('0x21')](_0x5376c5);}return _0xaf327b[_0xd865('0x22')]();};}function saveUpdates(_0x1d526d,_0x4cf25a){return function(_0x48e573){if(_0x48e573){return _0x48e573[_0xd865('0x23')](_0x1d526d)[_0xd865('0x24')](function(_0x38334e){return _0x38334e;});}return null;};}function removeEntity(_0xf0ef66,_0x21a7c5){return function(_0x4951d5){if(_0x4951d5){return _0x4951d5[_0xd865('0x25')]()['then'](function(){_0xf0ef66[_0xd865('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x360ffc,_0x34b99e){return function(_0x1b1f49){if(!_0x1b1f49){_0x360ffc[_0xd865('0x19')](0x194);}return _0x1b1f49;};}function handleError(_0x277662,_0x36703a){_0x36703a=_0x36703a||0x1f4;return function(_0x563509){logger[_0xd865('0x26')](_0x563509[_0xd865('0x27')]);if(_0x563509[_0xd865('0x28')]){delete _0x563509['name'];}_0x277662[_0xd865('0x1a')](_0x36703a)[_0xd865('0x29')](_0x563509);};}exports[_0xd865('0x2a')]=function(_0x5ab036,_0x2bf515){var _0x54c0ad={},_0x4ae1a9={},_0x534b75={'count':0x0,'rows':[]};var _0x2e9ec5=_[_0xd865('0x2b')](db['Dynamics365Field'][_0xd865('0x2c')],function(_0x5a90e2){return{'name':_0x5a90e2['fieldName'],'type':_0x5a90e2[_0xd865('0x2d')]['key']};});_0x4ae1a9['model']=_[_0xd865('0x2b')](_0x2e9ec5,_0xd865('0x28'));_0x4ae1a9[_0xd865('0x2e')]=_['keys'](_0x5ab036[_0xd865('0x2e')]);_0x4ae1a9[_0xd865('0x2f')]=_[_0xd865('0x30')](_0x4ae1a9[_0xd865('0x31')],_0x4ae1a9[_0xd865('0x2e')]);_0x54c0ad[_0xd865('0x32')]=_['intersection'](_0x4ae1a9['model'],qs[_0xd865('0x33')](_0x5ab036[_0xd865('0x2e')][_0xd865('0x33')]));_0x54c0ad[_0xd865('0x32')]=_0x54c0ad[_0xd865('0x32')][_0xd865('0x34')]?_0x54c0ad[_0xd865('0x32')]:_0x4ae1a9[_0xd865('0x31')];if(!_0x5ab036['query'][_0xd865('0x35')]('nolimit')){_0x54c0ad[_0xd865('0x1e')]=qs[_0xd865('0x1e')](_0x5ab036[_0xd865('0x2e')][_0xd865('0x1e')]);_0x54c0ad[_0xd865('0x1d')]=qs[_0xd865('0x1d')](_0x5ab036[_0xd865('0x2e')]['offset']);}_0x54c0ad[_0xd865('0x36')]=qs[_0xd865('0x37')](_0x5ab036[_0xd865('0x2e')]['sort']);_0x54c0ad[_0xd865('0x38')]=qs[_0xd865('0x2f')](_['pick'](_0x5ab036[_0xd865('0x2e')],_0x4ae1a9['filters']),_0x2e9ec5);if(_0x5ab036['query']['filter']){_0x54c0ad[_0xd865('0x38')]=_[_0xd865('0x39')](_0x54c0ad[_0xd865('0x38')],{'$or':_['map'](_0x2e9ec5,function(_0x442268){if(_0x442268[_0xd865('0x2d')]!==_0xd865('0x3a')){var _0x4b4e18={};_0x4b4e18[_0x442268[_0xd865('0x28')]]={'$like':'%'+_0x5ab036[_0xd865('0x2e')]['filter']+'%'};return _0x4b4e18;}})});}_0x54c0ad=_[_0xd865('0x39')]({},_0x54c0ad,_0x5ab036['options']);var _0x301829={'where':_0x54c0ad[_0xd865('0x38')]};return db[_0xd865('0x3b')][_0xd865('0x1c')](_0x301829)[_0xd865('0x24')](function(_0x1a8a93){_0x534b75['count']=_0x1a8a93;if(_0x5ab036[_0xd865('0x2e')][_0xd865('0x3c')]){_0x54c0ad[_0xd865('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xd865('0x3e')](_0x54c0ad);})['then'](function(_0x9380d3){_0x534b75['rows']=_0x9380d3;return _0x534b75;})[_0xd865('0x24')](respondWithFilteredResult(_0x2bf515,_0x54c0ad))['catch'](handleError(_0x2bf515,null));};exports['show']=function(_0x194e2a,_0x99184b){var _0x34e681={'raw':!![],'where':{'id':_0x194e2a[_0xd865('0x3f')]['id']}},_0x1f8daf={};_0x1f8daf[_0xd865('0x31')]=_[_0xd865('0x40')](db[_0xd865('0x3b')][_0xd865('0x2c')]);_0x1f8daf[_0xd865('0x2e')]=_[_0xd865('0x40')](_0x194e2a[_0xd865('0x2e')]);_0x1f8daf[_0xd865('0x2f')]=_[_0xd865('0x30')](_0x1f8daf[_0xd865('0x31')],_0x1f8daf['query']);_0x34e681[_0xd865('0x32')]=_[_0xd865('0x30')](_0x1f8daf[_0xd865('0x31')],qs[_0xd865('0x33')](_0x194e2a[_0xd865('0x2e')][_0xd865('0x33')]));_0x34e681[_0xd865('0x32')]=_0x34e681['attributes']['length']?_0x34e681[_0xd865('0x32')]:_0x1f8daf[_0xd865('0x31')];if(_0x194e2a[_0xd865('0x2e')][_0xd865('0x3c')]){_0x34e681[_0xd865('0x3d')]=[{'all':!![]}];}_0x34e681=_['merge']({},_0x34e681,_0x194e2a['options']);return db['Dynamics365Field'][_0xd865('0x41')](_0x34e681)[_0xd865('0x24')](handleEntityNotFound(_0x99184b,null))[_0xd865('0x24')](respondWithResult(_0x99184b,null))[_0xd865('0x42')](handleError(_0x99184b,null));};exports[_0xd865('0x43')]=function(_0x29fb1a,_0x17cea8){return db[_0xd865('0x3b')][_0xd865('0x43')](_0x29fb1a[_0xd865('0x44')],{})[_0xd865('0x24')](respondWithResult(_0x17cea8,0xc9))[_0xd865('0x42')](handleError(_0x17cea8,null));};exports['update']=function(_0x9a387e,_0x3daa24){if(_0x9a387e['body']['id']){delete _0x9a387e[_0xd865('0x44')]['id'];}return db[_0xd865('0x3b')][_0xd865('0x41')]({'where':{'id':_0x9a387e[_0xd865('0x3f')]['id']}})[_0xd865('0x24')](handleEntityNotFound(_0x3daa24,null))['then'](saveUpdates(_0x9a387e[_0xd865('0x44')],null))[_0xd865('0x24')](respondWithResult(_0x3daa24,null))[_0xd865('0x42')](handleError(_0x3daa24,null));};exports[_0xd865('0x25')]=function(_0x16ca4f,_0x34170e){return db[_0xd865('0x3b')][_0xd865('0x41')]({'where':{'id':_0x16ca4f[_0xd865('0x3f')]['id']}})[_0xd865('0x24')](handleEntityNotFound(_0x34170e,null))[_0xd865('0x24')](removeEntity(_0x34170e,null))[_0xd865('0x42')](handleError(_0x34170e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1cd4fc5..2f559ef 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 _0x249d=['../../config/logger','api','bluebird','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','FieldId','util'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x249d,0x155));var _0xd249=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x249d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xd249('0x0'));var logger=require(_0xd249('0x1'))(_0xd249('0x2'));var moment=require('moment');var BPromise=require(_0xd249('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd249('0x4'));var attributes=require(_0xd249('0x5'));module['exports']=function(_0x4f9bdc,_0x563597){return _0x4f9bdc['define'](_0xd249('0x6'),attributes,{'tableName':_0xd249('0x7'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xd249('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab10=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xab10,0x117));var _0x0ab1=function(_0x373a7b,_0x7e9e31){_0x373a7b=_0x373a7b-0x0;var _0x5e589c=_0xab10[_0x373a7b];return _0x5e589c;};'use strict';var _=require(_0x0ab1('0x0'));var util=require('util');var logger=require(_0x0ab1('0x1'))(_0x0ab1('0x2'));var moment=require(_0x0ab1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ab1('0x4'));var rimraf=require(_0x0ab1('0x5'));var config=require(_0x0ab1('0x6'));var attributes=require(_0x0ab1('0x7'));module[_0x0ab1('0x8')]=function(_0x2ed90b,_0x3668fa){return _0x2ed90b[_0x0ab1('0x9')](_0x0ab1('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x0ab1('0xb'),'fields':[_0x0ab1('0xc'),_0x0ab1('0xd')],'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 046a1b7..9d452dc 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 _0x41fe=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa72439,_0x3a3541){var _0x17cc0e=function(_0x551889){while(--_0x551889){_0xa72439['push'](_0xa72439['shift']());}};_0x17cc0e(++_0x3a3541);}(_0x41fe,0xd1));var _0xe41f=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x41fe[_0x45fc6a];return _0x14bcfd;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var moment=require(_0xe41f('0x2'));var BPromise=require(_0xe41f('0x3'));var rs=require(_0xe41f('0x4'));var fs=require('fs');var Redis=require(_0xe41f('0x5'));var db=require(_0xe41f('0x6'))['db'];var utils=require(_0xe41f('0x7'));var logger=require(_0xe41f('0x8'))(_0xe41f('0x9'));var config=require(_0xe41f('0xa'));var jayson=require(_0xe41f('0xb'));var client=jayson[_0xe41f('0xc')][_0xe41f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x32a410,_0x6fda32,_0x23fdc9){return new BPromise(function(_0x519361,_0x27ba71){return client[_0xe41f('0xe')](_0x32a410,_0x23fdc9)['then'](function(_0x7303e4){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x6fda32,'request\x20sent');logger[_0xe41f('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x6fda32,'request\x20sent',JSON['stringify'](_0x7303e4));if(_0x7303e4[_0xe41f('0x10')]){if(_0x7303e4[_0xe41f('0x10')][_0xe41f('0x11')]===0x1f4){logger[_0xe41f('0x10')](_0xe41f('0x12'),_0x6fda32,_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);return _0x27ba71(_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);}logger[_0xe41f('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x6fda32,_0x7303e4[_0xe41f('0x10')][_0xe41f('0x13')]);return _0x519361(_0x7303e4['error'][_0xe41f('0x13')]);}else{logger[_0xe41f('0x14')](_0xe41f('0x12'),_0x6fda32,_0xe41f('0x15'));_0x519361(_0x7303e4[_0xe41f('0x16')][_0xe41f('0x13')]);}})[_0xe41f('0x17')](function(_0x54635b){logger['error'](_0xe41f('0x12'),_0x6fda32,_0x54635b);_0x27ba71(_0x54635b);});});} \ No newline at end of file +var _0x8ca9=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0x5bbc68,_0xa50938){var _0x2681a6=function(_0x2a05b2){while(--_0x2a05b2){_0x5bbc68['push'](_0x5bbc68['shift']());}};_0x2681a6(++_0xa50938);}(_0x8ca9,0x9c));var _0x98ca=function(_0x51a6e8,_0x3e754a){_0x51a6e8=_0x51a6e8-0x0;var _0xda6ca=_0x8ca9[_0x51a6e8];return _0xda6ca;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var moment=require(_0x98ca('0x2'));var BPromise=require(_0x98ca('0x3'));var rs=require(_0x98ca('0x4'));var fs=require('fs');var Redis=require(_0x98ca('0x5'));var db=require(_0x98ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ca('0x8'));var client=jayson['client'][_0x98ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca4097,_0x18c349,_0x2852a0){return new BPromise(function(_0x323c95,_0x28a37a){return client[_0x98ca('0xa')](_0xca4097,_0x2852a0)[_0x98ca('0xb')](function(_0x277c29){logger[_0x98ca('0xc')](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));logger[_0x98ca('0xf')](_0x98ca('0x10'),_0x18c349,_0x98ca('0xe'),JSON[_0x98ca('0x11')](_0x277c29));if(_0x277c29[_0x98ca('0x12')]){if(_0x277c29[_0x98ca('0x12')]['code']===0x1f4){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x28a37a(_0x277c29['error'][_0x98ca('0x13')]);}logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x323c95(_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);}else{logger['info'](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));_0x323c95(_0x277c29[_0x98ca('0x14')][_0x98ca('0x13')]);}})['catch'](function(_0x238c1a){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x238c1a);_0x28a37a(_0x238c1a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index af92a42..25320c2 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 _0x2a60=['../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x2a60,0x79));var _0x02a6=function(_0x548e03,_0x101c58){_0x548e03=_0x548e03-0x0;var _0x307c33=_0x2a60[_0x548e03];return _0x307c33;};'use strict';var multer=require(_0x02a6('0x0'));var util=require(_0x02a6('0x1'));var path=require('path');var timeout=require(_0x02a6('0x2'));var express=require('express');var router=express[_0x02a6('0x3')]();var auth=require(_0x02a6('0x4'));var interaction=require(_0x02a6('0x5'));var config=require('../../config/environment');var controller=require(_0x02a6('0x6'));router['get']('/',auth[_0x02a6('0x7')](),controller[_0x02a6('0x8')]);router[_0x02a6('0x9')](_0x02a6('0xa'),auth[_0x02a6('0x7')](),controller[_0x02a6('0xb')]);router[_0x02a6('0x9')](_0x02a6('0xc'),auth[_0x02a6('0x7')](),controller[_0x02a6('0xd')]);router[_0x02a6('0x9')]('/:id/fields',auth[_0x02a6('0x7')](),controller[_0x02a6('0xe')]);router['post']('/',auth[_0x02a6('0x7')](),controller[_0x02a6('0xf')]);router[_0x02a6('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x02a6('0xa'),auth[_0x02a6('0x7')](),controller[_0x02a6('0x11')]);router[_0x02a6('0x12')](_0x02a6('0xa'),auth[_0x02a6('0x7')](),controller[_0x02a6('0x13')]);module[_0x02a6('0x14')]=router; \ No newline at end of file +var _0x8801=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','delete','exports','util','express','../../components/interaction/service','../../config/environment','get','index'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x8801,0x11b));var _0x1880=function(_0x51ef72,_0x42f4ca){_0x51ef72=_0x51ef72-0x0;var _0x5c4305=_0x8801[_0x51ef72];return _0x5c4305;};'use strict';var multer=require('multer');var util=require(_0x1880('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1880('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1880('0x2'));var config=require(_0x1880('0x3'));var controller=require('./intFreshdeskAccount.controller');router[_0x1880('0x4')]('/',auth['isAuthenticated'](),controller[_0x1880('0x5')]);router[_0x1880('0x4')](_0x1880('0x6'),auth[_0x1880('0x7')](),controller[_0x1880('0x8')]);router['get'](_0x1880('0x9'),auth['isAuthenticated'](),controller[_0x1880('0xa')]);router[_0x1880('0x4')]('/:id/fields',auth[_0x1880('0x7')](),controller[_0x1880('0xb')]);router[_0x1880('0xc')]('/',auth[_0x1880('0x7')](),controller['create']);router['post']('/:id/configurations',auth[_0x1880('0x7')](),controller[_0x1880('0xd')]);router[_0x1880('0xe')]('/:id',auth[_0x1880('0x7')](),controller['update']);router[_0x1880('0xf')]('/:id',auth[_0x1880('0x7')](),controller['destroy']);module[_0x1880('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index b0440b5..dfcae70 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 _0x11f3=['remoteUri','sequelize','exports','STRING'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x11f3,0x149));var _0x311f=function(_0x1946e9,_0x4d9047){_0x1946e9=_0x1946e9-0x0;var _0x12237f=_0x11f3[_0x1946e9];return _0x12237f;};'use strict';var Sequelize=require(_0x311f('0x0'));module[_0x311f('0x1')]={'name':{'type':Sequelize[_0x311f('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x311f('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x311f('0x2')]},'remoteUri':{'type':Sequelize[_0x311f('0x2')],'unique':_0x311f('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x056b=['username','remoteUri','exports','STRING'];(function(_0x4e9b66,_0x285d76){var _0x45fb71=function(_0x1afdfa){while(--_0x1afdfa){_0x4e9b66['push'](_0x4e9b66['shift']());}};_0x45fb71(++_0x285d76);}(_0x056b,0xb6));var _0xb056=function(_0x370c8f,_0x3c429d){_0x370c8f=_0x370c8f-0x0;var _0x180dde=_0x056b[_0x370c8f];return _0x180dde;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'apiKey':{'type':Sequelize[_0xb056('0x1')]},'remoteUri':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x3')},'serverUrl':{'type':Sequelize[_0xb056('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d4f6733..8ca3c53 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 _0x3e74=['group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','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','../../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','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','index','fieldName','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','where','FreshdeskAccount','includeAll','include','rows','show','keys','options','find','create','body','update','params','getConfigurations','findOne','FreshdeskConfiguration','rawAttributes','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','toString','requester','agent','description','priority','source'];(function(_0x3cc618,_0x2bb76c){var _0x2dae3a=function(_0x419fa1){while(--_0x419fa1){_0x3cc618['push'](_0x3cc618['shift']());}};_0x2dae3a(++_0x2bb76c);}(_0x3e74,0x175));var _0x43e7=function(_0x1edc0a,_0x257a9b){_0x1edc0a=_0x1edc0a-0x0;var _0x370191=_0x3e74[_0x1edc0a];return _0x370191;};'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 integrations=require(_0x43e7('0x14'));var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4e008c,_0x583d85,_0x2fcb36){if(_0x2fcb36){var _0x21fdd3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21fdd3[_0x43e7('0x18')](_0x583d85)){return _0x4e008c;}else{throw new db['Sequelize']['ValidationError'](_0x43e7('0x19'));}}else{return _0x4e008c;}}function respondWithRpcPromise(_0x14c146,_0x203378,_0x328445,_0x4de324){return new BPromise(function(_0x5c4eaa,_0xdf16c){var _0x264575=_0x4de324||client;return _0x264575[_0x43e7('0x1a')](_0x14c146,_0x328445)['then'](function(_0x4b5a6b){logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x203378,_0x43e7('0x1d'));logger[_0x43e7('0x1e')](_0x43e7('0x1f'),_0x203378,_0x43e7('0x1d'),JSON[_0x43e7('0x20')](_0x4b5a6b));if(_0x4b5a6b[_0x43e7('0x21')]){if(_0x4b5a6b[_0x43e7('0x21')][_0x43e7('0x22')]===0x1f4){logger[_0x43e7('0x21')](_0x43e7('0x1c'),_0x203378,_0x4b5a6b['error'][_0x43e7('0x23')]);return _0xdf16c(_0x4b5a6b[_0x43e7('0x21')]['message']);}logger[_0x43e7('0x21')](_0x43e7('0x1c'),_0x203378,_0x4b5a6b[_0x43e7('0x21')][_0x43e7('0x23')]);return _0x5c4eaa(_0x4b5a6b[_0x43e7('0x21')][_0x43e7('0x23')]);}else{logger['info'](_0x43e7('0x1c'),_0x203378,'request\x20sent');_0x5c4eaa(_0x4b5a6b['result'][_0x43e7('0x23')]);}})[_0x43e7('0x24')](function(_0x4b2b9f){logger[_0x43e7('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x203378,_0x4b2b9f);_0xdf16c(_0x4b2b9f);});});}function respondWithStatusCode(_0x326dab,_0x5c5e67){_0x5c5e67=_0x5c5e67||0xcc;return function(_0x1af208){if(_0x1af208){return _0x326dab[_0x43e7('0x25')](_0x5c5e67);}return _0x326dab[_0x43e7('0x26')](_0x5c5e67)[_0x43e7('0x27')]();};}function respondWithResult(_0x51f4d7,_0x52b7b3){_0x52b7b3=_0x52b7b3||0xc8;return function(_0x805b54){if(_0x805b54){return _0x51f4d7['status'](_0x52b7b3)[_0x43e7('0x28')](_0x805b54);}};}function respondWithFilteredResult(_0x40dc8f,_0x3565cf){return function(_0xb1fc63){if(_0xb1fc63){var _0x5087d7=_0xb1fc63[_0x43e7('0x29')],_0x33a1a5=_0x3565cf[_0x43e7('0x2a')],_0x4690a6=_0x3565cf[_0x43e7('0x2a')]+_0x3565cf[_0x43e7('0x2b')],_0x45b675;if(_0x4690a6>=_0x5087d7){_0x4690a6=_0x5087d7;_0x45b675=0xc8;}else{_0x45b675=0xce;}_0x40dc8f[_0x43e7('0x26')](_0x45b675);return _0x40dc8f[_0x43e7('0x2c')](_0x43e7('0x2d'),_0x33a1a5+'-'+_0x4690a6+'/'+_0x5087d7)[_0x43e7('0x28')](_0xb1fc63);}return null;};}function patchUpdates(_0x19725a){return function(_0x2bde44){try{jsonpatch[_0x43e7('0x2e')](_0x2bde44,_0x19725a,!![]);}catch(_0x4bdb17){return BPromise[_0x43e7('0x2f')](_0x4bdb17);}return _0x2bde44[_0x43e7('0x30')]();};}function saveUpdates(_0x3b8f78,_0x183c81){return function(_0x4251c8){if(_0x4251c8){return _0x4251c8['update'](_0x3b8f78)[_0x43e7('0x31')](function(_0x49b83d){return _0x49b83d;});}return null;};}function removeEntity(_0x30d47e,_0x3f280d){return function(_0x4c61b9){if(_0x4c61b9){return _0x4c61b9['destroy']()['then'](function(){_0x30d47e[_0x43e7('0x26')](0xcc)[_0x43e7('0x27')]();});}};}function handleEntityNotFound(_0x117c07,_0x234fe6){return function(_0x108313){if(!_0x108313){_0x117c07[_0x43e7('0x25')](0x194);}return _0x108313;};}function handleError(_0x485c6c,_0x47baee){_0x47baee=_0x47baee||0x1f4;return function(_0x4ac23d){logger['error'](_0x4ac23d['stack']);if(_0x4ac23d['name']){delete _0x4ac23d['name'];}_0x485c6c[_0x43e7('0x26')](_0x47baee)['send'](_0x4ac23d);};}exports[_0x43e7('0x32')]=function(_0x8e9f40,_0x31bc78){var _0x50a2d0={},_0x40f72f={},_0x449803={'count':0x0,'rows':[]};var _0x101d45=_['map'](db['FreshdeskAccount']['rawAttributes'],function(_0xfa0474){return{'name':_0xfa0474[_0x43e7('0x33')],'type':_0xfa0474[_0x43e7('0x34')][_0x43e7('0x35')]};});_0x40f72f[_0x43e7('0x36')]=_[_0x43e7('0x37')](_0x101d45,_0x43e7('0x38'));_0x40f72f[_0x43e7('0x39')]=_['keys'](_0x8e9f40[_0x43e7('0x39')]);_0x40f72f[_0x43e7('0x3a')]=_['intersection'](_0x40f72f[_0x43e7('0x36')],_0x40f72f['query']);_0x50a2d0[_0x43e7('0x3b')]=_[_0x43e7('0x3c')](_0x40f72f[_0x43e7('0x36')],qs[_0x43e7('0x3d')](_0x8e9f40[_0x43e7('0x39')][_0x43e7('0x3d')]));_0x50a2d0['attributes']=_0x50a2d0['attributes'][_0x43e7('0x3e')]?_0x50a2d0[_0x43e7('0x3b')]:_0x40f72f[_0x43e7('0x36')];if(!_0x8e9f40[_0x43e7('0x39')][_0x43e7('0x3f')]('nolimit')){_0x50a2d0[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x8e9f40['query'][_0x43e7('0x2b')]);_0x50a2d0['offset']=qs[_0x43e7('0x2a')](_0x8e9f40['query'][_0x43e7('0x2a')]);}_0x50a2d0[_0x43e7('0x40')]=qs[_0x43e7('0x41')](_0x8e9f40[_0x43e7('0x39')]['sort']);_0x50a2d0['where']=qs[_0x43e7('0x3a')](_[_0x43e7('0x42')](_0x8e9f40[_0x43e7('0x39')],_0x40f72f[_0x43e7('0x3a')]),_0x101d45);if(_0x8e9f40['query']['filter']){_0x50a2d0['where']=_[_0x43e7('0x43')](_0x50a2d0['where'],{'$or':_[_0x43e7('0x37')](_0x101d45,function(_0x4b3a59){if(_0x4b3a59['type']!==_0x43e7('0x44')){var _0x5ee1c5={};_0x5ee1c5[_0x4b3a59[_0x43e7('0x38')]]={'$like':'%'+_0x8e9f40[_0x43e7('0x39')][_0x43e7('0x45')]+'%'};return _0x5ee1c5;}})});}_0x50a2d0=_[_0x43e7('0x43')]({},_0x50a2d0,_0x8e9f40['options']);var _0x91f1e4={'where':_0x50a2d0[_0x43e7('0x46')]};return db[_0x43e7('0x47')][_0x43e7('0x29')](_0x91f1e4)[_0x43e7('0x31')](function(_0x1efe59){_0x449803['count']=_0x1efe59;if(_0x8e9f40['query'][_0x43e7('0x48')]){_0x50a2d0[_0x43e7('0x49')]=[{'all':!![]}];}return db[_0x43e7('0x47')]['findAll'](_0x50a2d0);})['then'](function(_0x56489b){_0x449803[_0x43e7('0x4a')]=_0x56489b;return _0x449803;})[_0x43e7('0x31')](respondWithFilteredResult(_0x31bc78,_0x50a2d0))['catch'](handleError(_0x31bc78,null));};exports[_0x43e7('0x4b')]=function(_0x47686e,_0x3c96fe){var _0x560329={'raw':![],'where':{'id':_0x47686e['params']['id']}},_0x593155={};_0x593155['model']=_[_0x43e7('0x4c')](db[_0x43e7('0x47')]['rawAttributes']);_0x593155[_0x43e7('0x39')]=_[_0x43e7('0x4c')](_0x47686e[_0x43e7('0x39')]);_0x593155[_0x43e7('0x3a')]=_['intersection'](_0x593155[_0x43e7('0x36')],_0x593155['query']);_0x560329['attributes']=_[_0x43e7('0x3c')](_0x593155[_0x43e7('0x36')],qs[_0x43e7('0x3d')](_0x47686e[_0x43e7('0x39')][_0x43e7('0x3d')]));_0x560329[_0x43e7('0x3b')]=_0x560329[_0x43e7('0x3b')][_0x43e7('0x3e')]?_0x560329[_0x43e7('0x3b')]:_0x593155[_0x43e7('0x36')];if(_0x47686e['query'][_0x43e7('0x48')]){_0x560329[_0x43e7('0x49')]=[{'all':!![]}];}_0x560329=_['merge']({},_0x560329,_0x47686e[_0x43e7('0x4d')]);return db['FreshdeskAccount'][_0x43e7('0x4e')](_0x560329)[_0x43e7('0x31')](handleEntityNotFound(_0x3c96fe,null))[_0x43e7('0x31')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x24')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x4f')]=function(_0x5e5556,_0x542759){return db[_0x43e7('0x47')][_0x43e7('0x4f')](_0x5e5556[_0x43e7('0x50')],{})[_0x43e7('0x31')](respondWithResult(_0x542759,0xc9))[_0x43e7('0x24')](handleError(_0x542759,null));};exports[_0x43e7('0x51')]=function(_0xa47464,_0x44f8a0){if(_0xa47464[_0x43e7('0x50')]['id']){delete _0xa47464[_0x43e7('0x50')]['id'];}return db[_0x43e7('0x47')]['find']({'where':{'id':_0xa47464[_0x43e7('0x52')]['id']}})[_0x43e7('0x31')](handleEntityNotFound(_0x44f8a0,null))['then'](saveUpdates(_0xa47464[_0x43e7('0x50')],null))[_0x43e7('0x31')](respondWithResult(_0x44f8a0,null))[_0x43e7('0x24')](handleError(_0x44f8a0,null));};exports['destroy']=function(_0x5d63c6,_0x459c13){return db[_0x43e7('0x47')]['find']({'where':{'id':_0x5d63c6[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x459c13,null))['then'](removeEntity(_0x459c13,null))[_0x43e7('0x24')](handleError(_0x459c13,null));};exports[_0x43e7('0x53')]=function(_0x1f7c02,_0x40155c,_0x68697){var _0x4dfdb0={};var _0xc3976={};var _0xdb9fbe;var _0x4d89bd;return db[_0x43e7('0x47')][_0x43e7('0x54')]({'where':{'id':_0x1f7c02[_0x43e7('0x52')]['id']}})['then'](handleEntityNotFound(_0x40155c,null))['then'](function(_0x557a47){if(_0x557a47){_0xdb9fbe=_0x557a47;_0xc3976[_0x43e7('0x36')]=_[_0x43e7('0x4c')](db[_0x43e7('0x55')][_0x43e7('0x56')]);_0xc3976['query']=_['keys'](_0x1f7c02[_0x43e7('0x39')]);_0xc3976[_0x43e7('0x3a')]=_[_0x43e7('0x3c')](_0xc3976[_0x43e7('0x36')],_0xc3976['query']);_0x4dfdb0[_0x43e7('0x3b')]=_[_0x43e7('0x3c')](_0xc3976[_0x43e7('0x36')],qs[_0x43e7('0x3d')](_0x1f7c02[_0x43e7('0x39')][_0x43e7('0x3d')]));_0x4dfdb0[_0x43e7('0x3b')]=_0x4dfdb0[_0x43e7('0x3b')][_0x43e7('0x3e')]?_0x4dfdb0[_0x43e7('0x3b')]:_0xc3976[_0x43e7('0x36')];_0x4dfdb0['order']=qs['sort'](_0x1f7c02[_0x43e7('0x39')]['sort']);_0x4dfdb0['where']=qs['filters'](_[_0x43e7('0x42')](_0x1f7c02[_0x43e7('0x39')],_0xc3976['filters']));if(_0x1f7c02[_0x43e7('0x39')][_0x43e7('0x45')]){_0x4dfdb0[_0x43e7('0x46')]=_['merge'](_0x4dfdb0[_0x43e7('0x46')],{'$or':_[_0x43e7('0x37')](_0x4dfdb0[_0x43e7('0x3b')],function(_0xc9723){var _0x2f43d7={};_0x2f43d7[_0xc9723]={'$like':'%'+_0x1f7c02[_0x43e7('0x39')][_0x43e7('0x45')]+'%'};return _0x2f43d7;})});}_0x4dfdb0=_['merge']({},_0x4dfdb0,_0x1f7c02[_0x43e7('0x4d')]);return _0xdb9fbe[_0x43e7('0x53')](_0x4dfdb0);}})[_0x43e7('0x31')](function(_0x549f4e){if(_0x549f4e){_0x4d89bd=_0x549f4e['length'];if(!_0x1f7c02[_0x43e7('0x39')]['hasOwnProperty']('nolimit')){_0x4dfdb0[_0x43e7('0x2b')]=qs[_0x43e7('0x2b')](_0x1f7c02['query'][_0x43e7('0x2b')]);_0x4dfdb0[_0x43e7('0x2a')]=qs[_0x43e7('0x2a')](_0x1f7c02[_0x43e7('0x39')][_0x43e7('0x2a')]);}return _0xdb9fbe[_0x43e7('0x53')](_0x4dfdb0);}})[_0x43e7('0x31')](function(_0x4ce33c){if(_0x4ce33c){return _0x4ce33c?{'count':_0x4d89bd,'rows':_0x4ce33c}:null;}})[_0x43e7('0x31')](respondWithResult(_0x40155c,null))[_0x43e7('0x24')](handleError(_0x40155c,null));};exports['addConfiguration']=function(_0x418213,_0x5c2c5f,_0x26ee52){if(_0x418213[_0x43e7('0x50')]['id']){delete _0x418213[_0x43e7('0x50')]['id'];}return db[_0x43e7('0x47')]['findOne']({'where':{'id':_0x418213[_0x43e7('0x52')]['id']}})[_0x43e7('0x31')](handleEntityNotFound(_0x5c2c5f,null))[_0x43e7('0x31')](function(_0x556001){if(_0x556001){_0x418213[_0x43e7('0x50')][_0x43e7('0x57')]=_0x556001['id'];_0x418213[_0x43e7('0x50')][_0x43e7('0x58')]=integrations[_0x43e7('0x59')](_0x418213['body'][_0x43e7('0x5a')],_0x418213[_0x43e7('0x50')][_0x43e7('0x34')]);_0x418213[_0x43e7('0x50')][_0x43e7('0x5b')]=integrations[_0x43e7('0x5c')](_0x418213[_0x43e7('0x50')]['channel'],_0x418213['body'][_0x43e7('0x34')]);return db['FreshdeskConfiguration']['create'](_0x418213['body'],{'include':[{'model':db[_0x43e7('0x5d')],'as':_0x43e7('0x58')},{'model':db[_0x43e7('0x5d')],'as':_0x43e7('0x5b')}]});}return null;})[_0x43e7('0x31')](respondWithResult(_0x5c2c5f,null))[_0x43e7('0x24')](handleError(_0x5c2c5f,null));};exports['getFields']=function(_0x44ec0e,_0x1ead5b,_0x2cd420){var _0x5b4c76='';return db[_0x43e7('0x47')][_0x43e7('0x54')]({'where':{'id':_0x44ec0e[_0x43e7('0x52')]['id']},'attributes':['id',_0x43e7('0x5e'),_0x43e7('0x5f')]})[_0x43e7('0x31')](handleEntityNotFound(_0x1ead5b,null))[_0x43e7('0x31')](function(_0x819686){if(_0x819686){_0x5b4c76=_0x819686['remoteUri'];var _0x52c757=_0x5b4c76['slice'](-0x1);if(_0x52c757==='/'){_0x5b4c76=_0x5b4c76[_0x43e7('0x60')](0x0,_0x5b4c76[_0x43e7('0x61')](_0x52c757));}return rp({'method':'GET','uri':util[_0x43e7('0x62')](_0x43e7('0x63'),_0x5b4c76,_0x43e7('0x64')),'headers':{'Authorization':util[_0x43e7('0x62')]('Basic\x20%s',new Buffer(util['format']('%s:X',_0x819686[_0x43e7('0x5f')]))[_0x43e7('0x65')]('base64'))},'json':!![]});}})['then'](function(_0x21adf7){if(_0x21adf7){var _0x190125=[_0x43e7('0x66'),'subject',_0x43e7('0x67'),_0x43e7('0x68'),_0x43e7('0x26'),_0x43e7('0x69'),'group',_0x43e7('0x6a'),'ticket_type',_0x43e7('0x6b'),_0x43e7('0x6c')];_[_0x43e7('0x6d')](_0x21adf7,function(_0x90667c){return _0x190125[_0x43e7('0x6e')](_0x90667c[_0x43e7('0x38')])||!_0x90667c[_0x43e7('0x6f')]&&_0x90667c['type']!==_0x43e7('0x70')&&_0x90667c[_0x43e7('0x34')]!==_0x43e7('0x71');});return{'count':_0x21adf7[_0x43e7('0x3e')],'rows':_['map'](_0x21adf7,function(_0x55491f){return{'id':_0x55491f['name'],'name':_0x55491f[_0x43e7('0x72')],'custom':!_0x55491f['default'],'options':_0x55491f[_0x43e7('0x73')]?_[_0x43e7('0x37')](_0x55491f[_0x43e7('0x73')],function(_0x7387f6){return{'name':_[_0x43e7('0x74')](_0x7387f6),'value':_0x7387f6};}):[]};})};}})[_0x43e7('0x31')](respondWithResult(_0x1ead5b,null))[_0x43e7('0x24')](function(_0x1ea46d){var _0x363af5=_0x44ec0e[_0x43e7('0x39')][_0x43e7('0x18')]?0x1f4:_0x1ea46d['statusCode']||0x1f4;logger[_0x43e7('0x21')](_0x43e7('0x75'),_0x43e7('0x76'),_0x363af5,JSON[_0x43e7('0x20')](_0x1ea46d));delete _0x1ea46d[_0x43e7('0x38')];if(_0x363af5===0x191){_0x363af5=0x190;}_0x1ead5b['status'](_0x363af5)['send'](_0x44ec0e[_0x43e7('0x39')][_0x43e7('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x1ea46d[_0x43e7('0x77')]}:_0x1ea46d);});}; \ 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(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x59e773,_0x231872){_0x59e773=_0x59e773-0x0;var _0x33209c=_0x1cb9[_0x59e773];return _0x33209c;};'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 f41542f..3b8a770 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 _0xd0bf=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x5e95b9,_0x59d52c){var _0x3b39dc=function(_0x3abd75){while(--_0x3abd75){_0x5e95b9['push'](_0x5e95b9['shift']());}};_0x3b39dc(++_0x59d52c);}(_0xd0bf,0xa8));var _0xfd0b=function(_0x307142,_0x2ede5b){_0x307142=_0x307142-0x0;var _0x25943d=_0xd0bf[_0x307142];return _0x25943d;};'use strict';var _=require(_0xfd0b('0x0'));var util=require('util');var logger=require(_0xfd0b('0x1'))(_0xfd0b('0x2'));var moment=require(_0xfd0b('0x3'));var BPromise=require(_0xfd0b('0x4'));var rp=require(_0xfd0b('0x5'));var fs=require('fs');var path=require(_0xfd0b('0x6'));var rimraf=require('rimraf');var config=require(_0xfd0b('0x7'));var attributes=require(_0xfd0b('0x8'));var integrations=require(_0xfd0b('0x9'));module[_0xfd0b('0xa')]=function(_0x4ffb1f,_0x3f51c9){return _0x4ffb1f[_0xfd0b('0xb')](_0xfd0b('0xc'),attributes,{'tableName':_0xfd0b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa37e=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x189a72,_0x4ac342){var _0x2b457a=function(_0x151b57){while(--_0x151b57){_0x189a72['push'](_0x189a72['shift']());}};_0x2b457a(++_0x4ac342);}(_0xa37e,0x1d8));var _0xea37=function(_0x39c25f,_0x5b90b8){_0x39c25f=_0x39c25f-0x0;var _0x36c7e8=_0xa37e[_0x39c25f];return _0x36c7e8;};'use strict';var _=require(_0xea37('0x0'));var util=require('util');var logger=require(_0xea37('0x1'))(_0xea37('0x2'));var moment=require(_0xea37('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require(_0xea37('0x5'));var config=require(_0xea37('0x6'));var attributes=require(_0xea37('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xea37('0x8')]=function(_0x5da49b,_0x98590){return _0x5da49b[_0xea37('0x9')](_0xea37('0xa'),attributes,{'tableName':_0xea37('0xb'),'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 3ca44a8..d9075cd 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 _0xd45d=['map','model','then','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','FreshdeskAccount','options','raw','attributes','limit','include'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xd45d,0x98));var _0xdd45=function(_0x331b35,_0x445bc2){_0x331b35=_0x331b35-0x0;var _0x46b4f8=_0xd45d[_0x331b35];return _0x46b4f8;};'use strict';var _=require(_0xdd45('0x0'));var util=require(_0xdd45('0x1'));var moment=require('moment');var BPromise=require(_0xdd45('0x2'));var rs=require(_0xdd45('0x3'));var fs=require('fs');var Redis=require(_0xdd45('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd45('0x5'));var logger=require(_0xdd45('0x6'))(_0xdd45('0x7'));var config=require(_0xdd45('0x8'));var jayson=require(_0xdd45('0x9'));var client=jayson[_0xdd45('0xa')][_0xdd45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4590c2,_0x3d2db6,_0x2f4953){return new BPromise(function(_0x1780d3,_0x6e9f45){return client[_0xdd45('0xc')](_0x4590c2,_0x2f4953)['then'](function(_0x510615){logger[_0xdd45('0xd')](_0xdd45('0xe'),_0x3d2db6,_0xdd45('0xf'));logger[_0xdd45('0x10')](_0xdd45('0x11'),_0x3d2db6,_0xdd45('0xf'),JSON['stringify'](_0x510615));if(_0x510615[_0xdd45('0x12')]){if(_0x510615[_0xdd45('0x12')][_0xdd45('0x13')]===0x1f4){logger[_0xdd45('0x12')](_0xdd45('0xe'),_0x3d2db6,_0x510615['error']['message']);return _0x6e9f45(_0x510615['error'][_0xdd45('0x14')]);}logger[_0xdd45('0x12')](_0xdd45('0xe'),_0x3d2db6,_0x510615[_0xdd45('0x12')]['message']);return _0x1780d3(_0x510615[_0xdd45('0x12')][_0xdd45('0x14')]);}else{logger[_0xdd45('0xd')](_0xdd45('0xe'),_0x3d2db6,_0xdd45('0xf'));_0x1780d3(_0x510615['result'][_0xdd45('0x14')]);}})[_0xdd45('0x15')](function(_0x2a87ea){logger[_0xdd45('0x12')](_0xdd45('0xe'),_0x3d2db6,_0x2a87ea);_0x6e9f45(_0x2a87ea);});});}exports['GetFreshdeskAccount']=function(_0x26e871){var _0x580a0f=this;return new Promise(function(_0x42f3af,_0x2d79e6){return db[_0xdd45('0x16')]['findAll']({'raw':_0x26e871[_0xdd45('0x17')]?_0x26e871[_0xdd45('0x17')][_0xdd45('0x18')]===undefined?!![]:![]:!![],'where':_0x26e871['options']?_0x26e871[_0xdd45('0x17')]['where']||null:null,'attributes':_0x26e871[_0xdd45('0x17')]?_0x26e871[_0xdd45('0x17')][_0xdd45('0x19')]||null:null,'limit':_0x26e871['options']?_0x26e871[_0xdd45('0x17')][_0xdd45('0x1a')]||null:null,'include':_0x26e871[_0xdd45('0x17')]?_0x26e871[_0xdd45('0x17')][_0xdd45('0x1b')]?_[_0xdd45('0x1c')](_0x26e871[_0xdd45('0x17')][_0xdd45('0x1b')],function(_0x59481e){return{'model':db[_0x59481e[_0xdd45('0x1d')]],'as':_0x59481e['as'],'attributes':_0x59481e[_0xdd45('0x19')],'include':_0x59481e[_0xdd45('0x1b')]?_['map'](_0x59481e[_0xdd45('0x1b')],function(_0x43dedd){return{'model':db[_0x43dedd[_0xdd45('0x1d')]],'as':_0x43dedd['as'],'attributes':_0x43dedd['attributes'],'include':_0x43dedd[_0xdd45('0x1b')]?_[_0xdd45('0x1c')](_0x43dedd['include'],function(_0x57681e){return{'model':db[_0x57681e[_0xdd45('0x1d')]],'as':_0x57681e['as'],'attributes':_0x57681e[_0xdd45('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdd45('0x1e')](function(_0x4922e4){logger[_0xdd45('0xd')](_0xdd45('0x1f'),_0x26e871);logger[_0xdd45('0x10')](_0xdd45('0x1f'),_0x26e871,JSON[_0xdd45('0x20')](_0x4922e4));_0x42f3af(_0x4922e4);})['catch'](function(_0x2d215d){logger[_0xdd45('0x12')]('GetFreshdeskAccount',_0x2d215d[_0xdd45('0x14')],_0x26e871);_0x2d79e6(_0x580a0f[_0xdd45('0x12')](0x1f4,_0x2d215d[_0xdd45('0x14')]));});});};exports[_0xdd45('0x21')]=function(_0x293a1e){var _0x46845b=this;return new Promise(function(_0x23cec5,_0x50a50c){return db[_0xdd45('0x16')][_0xdd45('0x22')]({'raw':_0x293a1e[_0xdd45('0x17')]?_0x293a1e[_0xdd45('0x17')][_0xdd45('0x18')]===undefined?!![]:![]:!![],'where':_0x293a1e[_0xdd45('0x17')]?_0x293a1e[_0xdd45('0x17')][_0xdd45('0x23')]||null:null,'attributes':_0x293a1e[_0xdd45('0x17')]?_0x293a1e[_0xdd45('0x17')][_0xdd45('0x19')]||null:null,'include':_0x293a1e['options']?_0x293a1e[_0xdd45('0x17')][_0xdd45('0x1b')]?_[_0xdd45('0x1c')](_0x293a1e[_0xdd45('0x17')][_0xdd45('0x1b')],function(_0xadb3d){return{'model':db[_0xadb3d[_0xdd45('0x1d')]],'as':_0xadb3d['as'],'attributes':_0xadb3d['attributes'],'include':_0xadb3d[_0xdd45('0x1b')]?_[_0xdd45('0x1c')](_0xadb3d[_0xdd45('0x1b')],function(_0x191ddf){return{'model':db[_0x191ddf[_0xdd45('0x1d')]],'as':_0x191ddf['as'],'attributes':_0x191ddf['attributes'],'include':_0x191ddf[_0xdd45('0x1b')]?_[_0xdd45('0x1c')](_0x191ddf[_0xdd45('0x1b')],function(_0x827f01){return{'model':db[_0x827f01[_0xdd45('0x1d')]],'as':_0x827f01['as'],'attributes':_0x827f01['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd45('0x1e')](function(_0x24053d){logger[_0xdd45('0xd')](_0xdd45('0x21'),_0x293a1e);logger[_0xdd45('0x10')](_0xdd45('0x21'),_0x293a1e,JSON[_0xdd45('0x20')](_0x24053d));_0x23cec5(_0x24053d);})[_0xdd45('0x15')](function(_0x3c1be3){logger['error']('ShowFreshdeskAccount',_0x3c1be3['message'],_0x293a1e);_0x50a50c(_0x46845b['error'](0x1f4,_0x3c1be3['message']));});});}; \ No newline at end of file +var _0xe357=['FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','limit','include','map','model','raw','where','ShowFreshdeskAccount','debug','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x710215,_0x1c6c00){var _0x596e1a=function(_0x2cfd8d){while(--_0x2cfd8d){_0x710215['push'](_0x710215['shift']());}};_0x596e1a(++_0x1c6c00);}(_0xe357,0xfe));var _0x7e35=function(_0x1cb1a8,_0x17b037){_0x1cb1a8=_0x1cb1a8-0x0;var _0x719d46=_0xe357[_0x1cb1a8];return _0x719d46;};'use strict';var _=require('lodash');var util=require(_0x7e35('0x0'));var moment=require(_0x7e35('0x1'));var BPromise=require(_0x7e35('0x2'));var rs=require(_0x7e35('0x3'));var fs=require('fs');var Redis=require(_0x7e35('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e35('0x5'));var config=require(_0x7e35('0x6'));var jayson=require(_0x7e35('0x7'));var client=jayson[_0x7e35('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x240ae1,_0x5317ba,_0x13e32d){return new BPromise(function(_0x506772,_0x2cb127){return client[_0x7e35('0x9')](_0x240ae1,_0x13e32d)[_0x7e35('0xa')](function(_0x112387){logger[_0x7e35('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x5317ba,_0x7e35('0xc'));logger['debug'](_0x7e35('0xd'),_0x5317ba,'request\x20sent',JSON[_0x7e35('0xe')](_0x112387));if(_0x112387['error']){if(_0x112387['error'][_0x7e35('0xf')]===0x1f4){logger[_0x7e35('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x5317ba,_0x112387['error'][_0x7e35('0x11')]);return _0x2cb127(_0x112387['error'][_0x7e35('0x11')]);}logger[_0x7e35('0x10')](_0x7e35('0x12'),_0x5317ba,_0x112387['error'][_0x7e35('0x11')]);return _0x506772(_0x112387[_0x7e35('0x10')]['message']);}else{logger[_0x7e35('0xb')](_0x7e35('0x12'),_0x5317ba,_0x7e35('0xc'));_0x506772(_0x112387[_0x7e35('0x13')][_0x7e35('0x11')]);}})[_0x7e35('0x14')](function(_0x5a2577){logger[_0x7e35('0x10')](_0x7e35('0x12'),_0x5317ba,_0x5a2577);_0x2cb127(_0x5a2577);});});}exports[_0x7e35('0x15')]=function(_0x5ca831){var _0x5ec55b=this;return new Promise(function(_0x3472b3,_0x2bf1e6){return db[_0x7e35('0x16')][_0x7e35('0x17')]({'raw':_0x5ca831[_0x7e35('0x18')]?_0x5ca831[_0x7e35('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5ca831[_0x7e35('0x18')]?_0x5ca831[_0x7e35('0x18')]['where']||null:null,'attributes':_0x5ca831[_0x7e35('0x18')]?_0x5ca831[_0x7e35('0x18')][_0x7e35('0x19')]||null:null,'limit':_0x5ca831[_0x7e35('0x18')]?_0x5ca831[_0x7e35('0x18')][_0x7e35('0x1a')]||null:null,'include':_0x5ca831[_0x7e35('0x18')]?_0x5ca831[_0x7e35('0x18')][_0x7e35('0x1b')]?_[_0x7e35('0x1c')](_0x5ca831[_0x7e35('0x18')]['include'],function(_0x2cd938){return{'model':db[_0x2cd938[_0x7e35('0x1d')]],'as':_0x2cd938['as'],'attributes':_0x2cd938[_0x7e35('0x19')],'include':_0x2cd938[_0x7e35('0x1b')]?_[_0x7e35('0x1c')](_0x2cd938['include'],function(_0x2f10a8){return{'model':db[_0x2f10a8[_0x7e35('0x1d')]],'as':_0x2f10a8['as'],'attributes':_0x2f10a8[_0x7e35('0x19')],'include':_0x2f10a8[_0x7e35('0x1b')]?_[_0x7e35('0x1c')](_0x2f10a8['include'],function(_0x2519fe){return{'model':db[_0x2519fe[_0x7e35('0x1d')]],'as':_0x2519fe['as'],'attributes':_0x2519fe[_0x7e35('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7e35('0xa')](function(_0x29de42){logger[_0x7e35('0xb')](_0x7e35('0x15'),_0x5ca831);logger['debug']('GetFreshdeskAccount',_0x5ca831,JSON['stringify'](_0x29de42));_0x3472b3(_0x29de42);})[_0x7e35('0x14')](function(_0x4ee40f){logger[_0x7e35('0x10')](_0x7e35('0x15'),_0x4ee40f[_0x7e35('0x11')],_0x5ca831);_0x2bf1e6(_0x5ec55b['error'](0x1f4,_0x4ee40f[_0x7e35('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x263fbf){var _0x345a69=this;return new Promise(function(_0x2e9169,_0x100ebc){return db[_0x7e35('0x16')]['find']({'raw':_0x263fbf[_0x7e35('0x18')]?_0x263fbf[_0x7e35('0x18')][_0x7e35('0x1e')]===undefined?!![]:![]:!![],'where':_0x263fbf[_0x7e35('0x18')]?_0x263fbf[_0x7e35('0x18')][_0x7e35('0x1f')]||null:null,'attributes':_0x263fbf[_0x7e35('0x18')]?_0x263fbf['options'][_0x7e35('0x19')]||null:null,'include':_0x263fbf[_0x7e35('0x18')]?_0x263fbf[_0x7e35('0x18')][_0x7e35('0x1b')]?_[_0x7e35('0x1c')](_0x263fbf[_0x7e35('0x18')][_0x7e35('0x1b')],function(_0x17fe40){return{'model':db[_0x17fe40['model']],'as':_0x17fe40['as'],'attributes':_0x17fe40[_0x7e35('0x19')],'include':_0x17fe40[_0x7e35('0x1b')]?_[_0x7e35('0x1c')](_0x17fe40['include'],function(_0x390938){return{'model':db[_0x390938[_0x7e35('0x1d')]],'as':_0x390938['as'],'attributes':_0x390938['attributes'],'include':_0x390938['include']?_[_0x7e35('0x1c')](_0x390938[_0x7e35('0x1b')],function(_0x5804a9){return{'model':db[_0x5804a9['model']],'as':_0x5804a9['as'],'attributes':_0x5804a9[_0x7e35('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eb37d){logger[_0x7e35('0xb')](_0x7e35('0x20'),_0x263fbf);logger[_0x7e35('0x21')](_0x7e35('0x20'),_0x263fbf,JSON[_0x7e35('0xe')](_0x4eb37d));_0x2e9169(_0x4eb37d);})[_0x7e35('0x14')](function(_0x568a6a){logger[_0x7e35('0x10')]('ShowFreshdeskAccount',_0x568a6a[_0x7e35('0x11')],_0x263fbf);_0x100ebc(_0x345a69[_0x7e35('0x10')](0x1f4,_0x568a6a[_0x7e35('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 84059a5..0aeb3a5 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 _0x8e6b=['path','connect-timeout','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','delete','destroy','exports','multer','util'];(function(_0x1fdd3e,_0x22735b){var _0x2da065=function(_0x45f972){while(--_0x45f972){_0x1fdd3e['push'](_0x1fdd3e['shift']());}};_0x2da065(++_0x22735b);}(_0x8e6b,0x112));var _0xb8e6=function(_0x131391,_0x34ada7){_0x131391=_0x131391-0x0;var _0x582186=_0x8e6b[_0x131391];return _0x582186;};'use strict';var multer=require(_0xb8e6('0x0'));var util=require(_0xb8e6('0x1'));var path=require(_0xb8e6('0x2'));var timeout=require(_0xb8e6('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb8e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb8e6('0x5'));var controller=require(_0xb8e6('0x6'));router[_0xb8e6('0x7')]('/',auth['isAuthenticated'](),controller[_0xb8e6('0x8')]);router[_0xb8e6('0x7')](_0xb8e6('0x9'),auth[_0xb8e6('0xa')](),controller[_0xb8e6('0xb')]);router[_0xb8e6('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0xb8e6('0xc'),auth[_0xb8e6('0xa')](),controller['getSubjects']);router[_0xb8e6('0x7')](_0xb8e6('0xd'),auth[_0xb8e6('0xa')](),controller[_0xb8e6('0xe')]);router[_0xb8e6('0x7')](_0xb8e6('0xf'),auth[_0xb8e6('0xa')](),controller[_0xb8e6('0x10')]);router[_0xb8e6('0x11')]('/',auth[_0xb8e6('0xa')](),controller['create']);router[_0xb8e6('0x11')](_0xb8e6('0xf'),auth[_0xb8e6('0xa')](),controller[_0xb8e6('0x12')]);router[_0xb8e6('0x13')](_0xb8e6('0x9'),auth[_0xb8e6('0xa')](),controller['update']);router[_0xb8e6('0x14')](_0xb8e6('0x9'),auth[_0xb8e6('0xa')](),controller[_0xb8e6('0x15')]);module[_0xb8e6('0x16')]=router; \ No newline at end of file +var _0x8355=['express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','destroy','exports','util','connect-timeout'];(function(_0x336c9e,_0x479b53){var _0x34befe=function(_0x1681f9){while(--_0x1681f9){_0x336c9e['push'](_0x336c9e['shift']());}};_0x34befe(++_0x479b53);}(_0x8355,0x1a2));var _0x5835=function(_0x4bc47d,_0x4739e2){_0x4bc47d=_0x4bc47d-0x0;var _0x8f8bf9=_0x8355[_0x4bc47d];return _0x8f8bf9;};'use strict';var multer=require('multer');var util=require(_0x5835('0x0'));var path=require('path');var timeout=require(_0x5835('0x1'));var express=require(_0x5835('0x2'));var router=express[_0x5835('0x3')]();var auth=require(_0x5835('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5835('0x5'));var controller=require(_0x5835('0x6'));router[_0x5835('0x7')]('/',auth[_0x5835('0x8')](),controller['index']);router[_0x5835('0x7')](_0x5835('0x9'),auth[_0x5835('0x8')](),controller[_0x5835('0xa')]);router['get']('/:id/fields',auth[_0x5835('0x8')](),controller['getFields']);router[_0x5835('0x7')](_0x5835('0xb'),auth[_0x5835('0x8')](),controller[_0x5835('0xc')]);router[_0x5835('0x7')]('/:id/descriptions',auth[_0x5835('0x8')](),controller['getDescriptions']);router[_0x5835('0x7')](_0x5835('0xd'),auth[_0x5835('0x8')](),controller['getTags']);router[_0x5835('0xe')]('/',auth[_0x5835('0x8')](),controller[_0x5835('0xf')]);router[_0x5835('0xe')](_0x5835('0xd'),auth['isAuthenticated'](),controller[_0x5835('0x10')]);router[_0x5835('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x5835('0x8')](),controller[_0x5835('0x12')]);module[_0x5835('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 10e322e..6a9d4fa 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 _0x228b=['sequelize','STRING'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x228b,0x10e));var _0xb228=function(_0x543df6,_0x124ed7){_0x543df6=_0x543df6-0x0;var _0x5c362=_0x228b[_0x543df6];return _0x5c362;};'use strict';var Sequelize=require(_0xb228('0x0'));module['exports']={'name':{'type':Sequelize[_0xb228('0x1')]},'description':{'type':Sequelize[_0xb228('0x1')]}}; \ No newline at end of file +var _0x0d62=['STRING'];(function(_0x2af276,_0xb15ec5){var _0x4c586e=function(_0x681843){while(--_0x681843){_0x2af276['push'](_0x2af276['shift']());}};_0x4c586e(++_0xb15ec5);}(_0x0d62,0x118));var _0x20d6=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x0d62[_0x25248b];return _0x509939;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x20d6('0x0')]},'description':{'type':Sequelize[_0x20d6('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8bccbf8..8f03b00 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 _0x1d7e=['length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','FreshdeskConfiguration','findAll','rows','show','params','find','create','body','findOne','getFields','hasOwnProperty','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../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','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes'];(function(_0x57bda6,_0x1c5b9e){var _0x55f7f0=function(_0x29c085){while(--_0x29c085){_0x57bda6['push'](_0x57bda6['shift']());}};_0x55f7f0(++_0x1c5b9e);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1d7e[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe1d7('0x0'));var rimraf=require(_0xe1d7('0x1'));var zipdir=require(_0xe1d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1d7('0x3'));var moment=require('moment');var BPromise=require(_0xe1d7('0x4'));var Mustache=require(_0xe1d7('0x5'));var util=require(_0xe1d7('0x6'));var path=require(_0xe1d7('0x7'));var sox=require(_0xe1d7('0x8'));var csv=require(_0xe1d7('0x9'));var ejs=require(_0xe1d7('0xa'));var fs=require('fs');var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x9'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var db=require(_0xe1d7('0x15'))['db'];var jayson=require(_0xe1d7('0x16'));var client=jayson[_0xe1d7('0x17')][_0xe1d7('0x18')]({'port':0x232a});function checkPasswordPattern(_0x445994,_0x383b18,_0x58fb5b){if(_0x58fb5b){var _0x6e0dc7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6e0dc7[_0xe1d7('0x19')](_0x383b18)){return _0x445994;}else{throw new db[(_0xe1d7('0x1a'))][(_0xe1d7('0x1b'))](_0xe1d7('0x1c'));}}else{return _0x445994;}}function respondWithRpcPromise(_0x2d017a,_0x3c1923,_0x565278,_0x391f55){return new BPromise(function(_0x328898,_0x419cf3){var _0x56e1c6=_0x391f55||client;return _0x56e1c6[_0xe1d7('0x1d')](_0x2d017a,_0x565278)[_0xe1d7('0x1e')](function(_0x800c15){logger[_0xe1d7('0x1f')](_0xe1d7('0x20'),_0x3c1923,_0xe1d7('0x21'));logger[_0xe1d7('0x22')](_0xe1d7('0x23'),_0x3c1923,_0xe1d7('0x21'),JSON[_0xe1d7('0x24')](_0x800c15));if(_0x800c15[_0xe1d7('0x25')]){if(_0x800c15[_0xe1d7('0x25')]['code']===0x1f4){logger[_0xe1d7('0x25')](_0xe1d7('0x20'),_0x3c1923,_0x800c15[_0xe1d7('0x25')][_0xe1d7('0x26')]);return _0x419cf3(_0x800c15[_0xe1d7('0x25')]['message']);}logger[_0xe1d7('0x25')](_0xe1d7('0x20'),_0x3c1923,_0x800c15[_0xe1d7('0x25')][_0xe1d7('0x26')]);return _0x328898(_0x800c15[_0xe1d7('0x25')]['message']);}else{logger[_0xe1d7('0x1f')](_0xe1d7('0x20'),_0x3c1923,_0xe1d7('0x21'));_0x328898(_0x800c15[_0xe1d7('0x27')][_0xe1d7('0x26')]);}})[_0xe1d7('0x28')](function(_0x3568ce){logger[_0xe1d7('0x25')](_0xe1d7('0x20'),_0x3c1923,_0x3568ce);_0x419cf3(_0x3568ce);});});}function respondWithStatusCode(_0x2e47f7,_0x55446d){_0x55446d=_0x55446d||0xcc;return function(_0x672bed){if(_0x672bed){return _0x2e47f7[_0xe1d7('0x29')](_0x55446d);}return _0x2e47f7[_0xe1d7('0x2a')](_0x55446d)['end']();};}function respondWithResult(_0x11dde2,_0x4079db){_0x4079db=_0x4079db||0xc8;return function(_0x19c671){if(_0x19c671){return _0x11dde2[_0xe1d7('0x2a')](_0x4079db)[_0xe1d7('0x2b')](_0x19c671);}};}function respondWithFilteredResult(_0x42e74d,_0x95f28c){return function(_0x55f7dd){if(_0x55f7dd){var _0x3e8ca3=_0x55f7dd['count'],_0x4a3344=_0x95f28c['offset'],_0xbc38f3=_0x95f28c[_0xe1d7('0x2c')]+_0x95f28c[_0xe1d7('0x2d')],_0x264481;if(_0xbc38f3>=_0x3e8ca3){_0xbc38f3=_0x3e8ca3;_0x264481=0xc8;}else{_0x264481=0xce;}_0x42e74d[_0xe1d7('0x2a')](_0x264481);return _0x42e74d[_0xe1d7('0x2e')](_0xe1d7('0x2f'),_0x4a3344+'-'+_0xbc38f3+'/'+_0x3e8ca3)['json'](_0x55f7dd);}return null;};}function patchUpdates(_0x311c5f){return function(_0x381aea){try{jsonpatch[_0xe1d7('0x30')](_0x381aea,_0x311c5f,!![]);}catch(_0x401393){return BPromise[_0xe1d7('0x31')](_0x401393);}return _0x381aea['save']();};}function saveUpdates(_0x437f50,_0xec4345){return function(_0x380157){if(_0x380157){return _0x380157[_0xe1d7('0x32')](_0x437f50)[_0xe1d7('0x1e')](function(_0x39a866){return _0x39a866;});}return null;};}function removeEntity(_0x1c044b,_0x39302a){return function(_0x542d78){if(_0x542d78){return _0x542d78[_0xe1d7('0x33')]()[_0xe1d7('0x1e')](function(){_0x1c044b[_0xe1d7('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d6db,_0x2fa371){return function(_0x2056fb){if(!_0x2056fb){_0x42d6db[_0xe1d7('0x29')](0x194);}return _0x2056fb;};}function handleError(_0x30727d,_0x118d32){_0x118d32=_0x118d32||0x1f4;return function(_0x4fd7a5){logger[_0xe1d7('0x25')](_0x4fd7a5[_0xe1d7('0x34')]);if(_0x4fd7a5[_0xe1d7('0x35')]){delete _0x4fd7a5[_0xe1d7('0x35')];}_0x30727d[_0xe1d7('0x2a')](_0x118d32)[_0xe1d7('0x36')](_0x4fd7a5);};}exports['index']=function(_0x3b3e1b,_0x228f2c){var _0x36f1d6={},_0x48d438={},_0x33ba92={'count':0x0,'rows':[]};var _0x3df459=_[_0xe1d7('0x37')](db['FreshdeskConfiguration'][_0xe1d7('0x38')],function(_0x594f4a){return{'name':_0x594f4a[_0xe1d7('0x39')],'type':_0x594f4a[_0xe1d7('0x3a')]['key']};});_0x48d438[_0xe1d7('0x3b')]=_[_0xe1d7('0x37')](_0x3df459,_0xe1d7('0x35'));_0x48d438['query']=_[_0xe1d7('0x3c')](_0x3b3e1b[_0xe1d7('0x3d')]);_0x48d438['filters']=_[_0xe1d7('0x3e')](_0x48d438['model'],_0x48d438[_0xe1d7('0x3d')]);_0x36f1d6['attributes']=_[_0xe1d7('0x3e')](_0x48d438[_0xe1d7('0x3b')],qs[_0xe1d7('0x3f')](_0x3b3e1b[_0xe1d7('0x3d')][_0xe1d7('0x3f')]));_0x36f1d6[_0xe1d7('0x40')]=_0x36f1d6[_0xe1d7('0x40')][_0xe1d7('0x41')]?_0x36f1d6[_0xe1d7('0x40')]:_0x48d438['model'];if(!_0x3b3e1b[_0xe1d7('0x3d')]['hasOwnProperty'](_0xe1d7('0x42'))){_0x36f1d6[_0xe1d7('0x2d')]=qs[_0xe1d7('0x2d')](_0x3b3e1b[_0xe1d7('0x3d')][_0xe1d7('0x2d')]);_0x36f1d6[_0xe1d7('0x2c')]=qs[_0xe1d7('0x2c')](_0x3b3e1b['query'][_0xe1d7('0x2c')]);}_0x36f1d6[_0xe1d7('0x43')]=qs[_0xe1d7('0x44')](_0x3b3e1b[_0xe1d7('0x3d')][_0xe1d7('0x44')]);_0x36f1d6[_0xe1d7('0x45')]=qs['filters'](_[_0xe1d7('0x46')](_0x3b3e1b[_0xe1d7('0x3d')],_0x48d438[_0xe1d7('0x47')]),_0x3df459);if(_0x3b3e1b['query'][_0xe1d7('0x48')]){_0x36f1d6[_0xe1d7('0x45')]=_[_0xe1d7('0x49')](_0x36f1d6[_0xe1d7('0x45')],{'$or':_[_0xe1d7('0x37')](_0x3df459,function(_0x52065d){if(_0x52065d[_0xe1d7('0x3a')]!==_0xe1d7('0x4a')){var _0x3d0022={};_0x3d0022[_0x52065d[_0xe1d7('0x35')]]={'$like':'%'+_0x3b3e1b[_0xe1d7('0x3d')][_0xe1d7('0x48')]+'%'};return _0x3d0022;}})});}_0x36f1d6=_[_0xe1d7('0x49')]({},_0x36f1d6,_0x3b3e1b[_0xe1d7('0x4b')]);var _0x3dc78a={'where':_0x36f1d6[_0xe1d7('0x45')]};return db['FreshdeskConfiguration'][_0xe1d7('0x4c')](_0x3dc78a)[_0xe1d7('0x1e')](function(_0x32555f){_0x33ba92['count']=_0x32555f;if(_0x3b3e1b['query'][_0xe1d7('0x4d')]){_0x36f1d6[_0xe1d7('0x4e')]=[{'all':!![]}];}return db[_0xe1d7('0x4f')][_0xe1d7('0x50')](_0x36f1d6);})[_0xe1d7('0x1e')](function(_0x5242e7){_0x33ba92[_0xe1d7('0x51')]=_0x5242e7;return _0x33ba92;})['then'](respondWithFilteredResult(_0x228f2c,_0x36f1d6))[_0xe1d7('0x28')](handleError(_0x228f2c,null));};exports[_0xe1d7('0x52')]=function(_0x38c40c,_0x32e4a3){var _0xd48848={'raw':![],'where':{'id':_0x38c40c[_0xe1d7('0x53')]['id']}},_0x5dc97a={};_0x5dc97a[_0xe1d7('0x3b')]=_[_0xe1d7('0x3c')](db['FreshdeskConfiguration'][_0xe1d7('0x38')]);_0x5dc97a[_0xe1d7('0x3d')]=_[_0xe1d7('0x3c')](_0x38c40c['query']);_0x5dc97a[_0xe1d7('0x47')]=_['intersection'](_0x5dc97a[_0xe1d7('0x3b')],_0x5dc97a[_0xe1d7('0x3d')]);_0xd48848[_0xe1d7('0x40')]=_['intersection'](_0x5dc97a['model'],qs[_0xe1d7('0x3f')](_0x38c40c[_0xe1d7('0x3d')][_0xe1d7('0x3f')]));_0xd48848[_0xe1d7('0x40')]=_0xd48848['attributes'][_0xe1d7('0x41')]?_0xd48848[_0xe1d7('0x40')]:_0x5dc97a[_0xe1d7('0x3b')];if(_0x38c40c[_0xe1d7('0x3d')]['includeAll']){_0xd48848[_0xe1d7('0x4e')]=[{'all':!![]}];}_0xd48848=_[_0xe1d7('0x49')]({},_0xd48848,_0x38c40c[_0xe1d7('0x4b')]);return db[_0xe1d7('0x4f')][_0xe1d7('0x54')](_0xd48848)['then'](handleEntityNotFound(_0x32e4a3,null))[_0xe1d7('0x1e')](respondWithResult(_0x32e4a3,null))[_0xe1d7('0x28')](handleError(_0x32e4a3,null));};exports[_0xe1d7('0x55')]=function(_0x443d13,_0x4aa854){return db[_0xe1d7('0x4f')]['create'](_0x443d13[_0xe1d7('0x56')],{})[_0xe1d7('0x1e')](respondWithResult(_0x4aa854,0xc9))[_0xe1d7('0x28')](handleError(_0x4aa854,null));};exports[_0xe1d7('0x32')]=function(_0x4b1118,_0x910fe4){if(_0x4b1118[_0xe1d7('0x56')]['id']){delete _0x4b1118['body']['id'];}return db[_0xe1d7('0x4f')][_0xe1d7('0x54')]({'where':{'id':_0x4b1118[_0xe1d7('0x53')]['id']}})[_0xe1d7('0x1e')](handleEntityNotFound(_0x910fe4,null))[_0xe1d7('0x1e')](saveUpdates(_0x4b1118[_0xe1d7('0x56')],null))[_0xe1d7('0x1e')](respondWithResult(_0x910fe4,null))[_0xe1d7('0x28')](handleError(_0x910fe4,null));};exports[_0xe1d7('0x33')]=function(_0x100aed,_0x489862){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x100aed[_0xe1d7('0x53')]['id']}})[_0xe1d7('0x1e')](handleEntityNotFound(_0x489862,null))[_0xe1d7('0x1e')](removeEntity(_0x489862,null))['catch'](handleError(_0x489862,null));};exports['getFields']=function(_0x2712b7,_0x113d44,_0x4a0b36){var _0x56d4cd={};var _0x246b5b={};var _0x733bfd;var _0x447e24;return db[_0xe1d7('0x4f')][_0xe1d7('0x57')]({'where':{'id':_0x2712b7[_0xe1d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x113d44,null))['then'](function(_0x21c634){if(_0x21c634){_0x733bfd=_0x21c634;_0x246b5b['model']=_[_0xe1d7('0x3c')](db['FreshdeskField']['rawAttributes']);_0x246b5b[_0xe1d7('0x3d')]=_['keys'](_0x2712b7[_0xe1d7('0x3d')]);_0x246b5b['filters']=_[_0xe1d7('0x3e')](_0x246b5b[_0xe1d7('0x3b')],_0x246b5b[_0xe1d7('0x3d')]);_0x56d4cd[_0xe1d7('0x40')]=_[_0xe1d7('0x3e')](_0x246b5b[_0xe1d7('0x3b')],qs[_0xe1d7('0x3f')](_0x2712b7[_0xe1d7('0x3d')]['fields']));_0x56d4cd[_0xe1d7('0x40')]=_0x56d4cd[_0xe1d7('0x40')][_0xe1d7('0x41')]?_0x56d4cd[_0xe1d7('0x40')]:_0x246b5b['model'];_0x56d4cd[_0xe1d7('0x43')]=qs[_0xe1d7('0x44')](_0x2712b7['query'][_0xe1d7('0x44')]);_0x56d4cd['where']=qs[_0xe1d7('0x47')](_['pick'](_0x2712b7['query'],_0x246b5b[_0xe1d7('0x47')]));if(_0x2712b7[_0xe1d7('0x3d')][_0xe1d7('0x48')]){_0x56d4cd[_0xe1d7('0x45')]=_[_0xe1d7('0x49')](_0x56d4cd[_0xe1d7('0x45')],{'$or':_[_0xe1d7('0x37')](_0x56d4cd[_0xe1d7('0x40')],function(_0x3de4db){var _0x500bc5={};_0x500bc5[_0x3de4db]={'$like':'%'+_0x2712b7[_0xe1d7('0x3d')][_0xe1d7('0x48')]+'%'};return _0x500bc5;})});}_0x56d4cd=_['merge']({},_0x56d4cd,_0x2712b7[_0xe1d7('0x4b')]);return _0x733bfd[_0xe1d7('0x58')](_0x56d4cd);}})[_0xe1d7('0x1e')](function(_0x150eab){if(_0x150eab){_0x447e24=_0x150eab['length'];if(!_0x2712b7[_0xe1d7('0x3d')][_0xe1d7('0x59')](_0xe1d7('0x42'))){_0x56d4cd[_0xe1d7('0x2d')]=qs[_0xe1d7('0x2d')](_0x2712b7[_0xe1d7('0x3d')][_0xe1d7('0x2d')]);_0x56d4cd['offset']=qs[_0xe1d7('0x2c')](_0x2712b7[_0xe1d7('0x3d')][_0xe1d7('0x2c')]);}return _0x733bfd[_0xe1d7('0x58')](_0x56d4cd);}})[_0xe1d7('0x1e')](function(_0x405a77){if(_0x405a77){return _0x405a77?{'count':_0x447e24,'rows':_0x405a77}:null;}})['then'](respondWithResult(_0x113d44,null))['catch'](handleError(_0x113d44,null));};exports[_0xe1d7('0x5a')]=function(_0x5382dd,_0x31bc16,_0x1efe98){var _0x59a7e7={};var _0x5ba40d={};var _0x25be5a;var _0x548343;return db[_0xe1d7('0x4f')][_0xe1d7('0x57')]({'where':{'id':_0x5382dd['params']['id']}})['then'](handleEntityNotFound(_0x31bc16,null))[_0xe1d7('0x1e')](function(_0x5ac397){if(_0x5ac397){_0x25be5a=_0x5ac397;_0x5ba40d[_0xe1d7('0x3b')]=_[_0xe1d7('0x3c')](db[_0xe1d7('0x5b')][_0xe1d7('0x38')]);_0x5ba40d['query']=_[_0xe1d7('0x3c')](_0x5382dd[_0xe1d7('0x3d')]);_0x5ba40d[_0xe1d7('0x47')]=_[_0xe1d7('0x3e')](_0x5ba40d[_0xe1d7('0x3b')],_0x5ba40d[_0xe1d7('0x3d')]);_0x59a7e7['attributes']=_['intersection'](_0x5ba40d[_0xe1d7('0x3b')],qs[_0xe1d7('0x3f')](_0x5382dd[_0xe1d7('0x3d')][_0xe1d7('0x3f')]));_0x59a7e7['attributes']=_0x59a7e7['attributes'][_0xe1d7('0x41')]?_0x59a7e7[_0xe1d7('0x40')]:_0x5ba40d[_0xe1d7('0x3b')];_0x59a7e7[_0xe1d7('0x43')]=qs[_0xe1d7('0x44')](_0x5382dd[_0xe1d7('0x3d')][_0xe1d7('0x44')]);_0x59a7e7[_0xe1d7('0x45')]=qs['filters'](_[_0xe1d7('0x46')](_0x5382dd['query'],_0x5ba40d[_0xe1d7('0x47')]));if(_0x5382dd[_0xe1d7('0x3d')][_0xe1d7('0x48')]){_0x59a7e7[_0xe1d7('0x45')]=_[_0xe1d7('0x49')](_0x59a7e7['where'],{'$or':_[_0xe1d7('0x37')](_0x59a7e7['attributes'],function(_0x313c7f){var _0x37f6c3={};_0x37f6c3[_0x313c7f]={'$like':'%'+_0x5382dd[_0xe1d7('0x3d')]['filter']+'%'};return _0x37f6c3;})});}_0x59a7e7=_[_0xe1d7('0x49')]({},_0x59a7e7,_0x5382dd['options']);return _0x25be5a[_0xe1d7('0x5a')](_0x59a7e7);}})[_0xe1d7('0x1e')](function(_0x5a438b){if(_0x5a438b){_0x548343=_0x5a438b['length'];if(!_0x5382dd[_0xe1d7('0x3d')][_0xe1d7('0x59')](_0xe1d7('0x42'))){_0x59a7e7[_0xe1d7('0x2d')]=qs[_0xe1d7('0x2d')](_0x5382dd[_0xe1d7('0x3d')][_0xe1d7('0x2d')]);_0x59a7e7[_0xe1d7('0x2c')]=qs[_0xe1d7('0x2c')](_0x5382dd[_0xe1d7('0x3d')]['offset']);}return _0x25be5a[_0xe1d7('0x5a')](_0x59a7e7);}})[_0xe1d7('0x1e')](function(_0x4f79c9){if(_0x4f79c9){return _0x4f79c9?{'count':_0x548343,'rows':_0x4f79c9}:null;}})[_0xe1d7('0x1e')](respondWithResult(_0x31bc16,null))[_0xe1d7('0x28')](handleError(_0x31bc16,null));};exports[_0xe1d7('0x5c')]=function(_0x32cd2a,_0x429090,_0x4b0228){var _0x3d1c17={};var _0x265192={};var _0x1228d9;var _0x35a973;return db[_0xe1d7('0x4f')][_0xe1d7('0x57')]({'where':{'id':_0x32cd2a[_0xe1d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x429090,null))[_0xe1d7('0x1e')](function(_0x4a8bc2){if(_0x4a8bc2){_0x1228d9=_0x4a8bc2;_0x265192['model']=_[_0xe1d7('0x3c')](db[_0xe1d7('0x5b')]['rawAttributes']);_0x265192[_0xe1d7('0x3d')]=_['keys'](_0x32cd2a[_0xe1d7('0x3d')]);_0x265192[_0xe1d7('0x47')]=_[_0xe1d7('0x3e')](_0x265192[_0xe1d7('0x3b')],_0x265192[_0xe1d7('0x3d')]);_0x3d1c17[_0xe1d7('0x40')]=_['intersection'](_0x265192[_0xe1d7('0x3b')],qs[_0xe1d7('0x3f')](_0x32cd2a[_0xe1d7('0x3d')][_0xe1d7('0x3f')]));_0x3d1c17[_0xe1d7('0x40')]=_0x3d1c17[_0xe1d7('0x40')][_0xe1d7('0x41')]?_0x3d1c17['attributes']:_0x265192[_0xe1d7('0x3b')];_0x3d1c17['order']=qs[_0xe1d7('0x44')](_0x32cd2a[_0xe1d7('0x3d')]['sort']);_0x3d1c17[_0xe1d7('0x45')]=qs[_0xe1d7('0x47')](_[_0xe1d7('0x46')](_0x32cd2a['query'],_0x265192[_0xe1d7('0x47')]));if(_0x32cd2a[_0xe1d7('0x3d')][_0xe1d7('0x48')]){_0x3d1c17[_0xe1d7('0x45')]=_[_0xe1d7('0x49')](_0x3d1c17[_0xe1d7('0x45')],{'$or':_[_0xe1d7('0x37')](_0x3d1c17[_0xe1d7('0x40')],function(_0xb91fa9){var _0x5d3679={};_0x5d3679[_0xb91fa9]={'$like':'%'+_0x32cd2a[_0xe1d7('0x3d')]['filter']+'%'};return _0x5d3679;})});}_0x3d1c17=_[_0xe1d7('0x49')]({},_0x3d1c17,_0x32cd2a['options']);return _0x1228d9[_0xe1d7('0x5c')](_0x3d1c17);}})[_0xe1d7('0x1e')](function(_0x40dfca){if(_0x40dfca){_0x35a973=_0x40dfca[_0xe1d7('0x41')];if(!_0x32cd2a[_0xe1d7('0x3d')]['hasOwnProperty'](_0xe1d7('0x42'))){_0x3d1c17[_0xe1d7('0x2d')]=qs[_0xe1d7('0x2d')](_0x32cd2a[_0xe1d7('0x3d')][_0xe1d7('0x2d')]);_0x3d1c17[_0xe1d7('0x2c')]=qs['offset'](_0x32cd2a[_0xe1d7('0x3d')][_0xe1d7('0x2c')]);}return _0x1228d9['getDescriptions'](_0x3d1c17);}})['then'](function(_0x5c408a){if(_0x5c408a){return _0x5c408a?{'count':_0x35a973,'rows':_0x5c408a}:null;}})[_0xe1d7('0x1e')](respondWithResult(_0x429090,null))[_0xe1d7('0x28')](handleError(_0x429090,null));};exports[_0xe1d7('0x5d')]=function(_0x3e0591,_0x2e791c,_0x237a92){var _0x73f9e2={};var _0x4d9098={};var _0x2e8da1;var _0x40b418;return db[_0xe1d7('0x4f')][_0xe1d7('0x57')]({'where':{'id':_0x3e0591[_0xe1d7('0x53')]['id']}})[_0xe1d7('0x1e')](handleEntityNotFound(_0x2e791c,null))[_0xe1d7('0x1e')](function(_0x4d04ea){if(_0x4d04ea){_0x2e8da1=_0x4d04ea;_0x4d9098['model']=_[_0xe1d7('0x3c')](db[_0xe1d7('0x5e')]['rawAttributes']);_0x4d9098[_0xe1d7('0x3d')]=_[_0xe1d7('0x3c')](_0x3e0591[_0xe1d7('0x3d')]);_0x4d9098['filters']=_[_0xe1d7('0x3e')](_0x4d9098[_0xe1d7('0x3b')],_0x4d9098['query']);_0x73f9e2[_0xe1d7('0x40')]=_[_0xe1d7('0x3e')](_0x4d9098[_0xe1d7('0x3b')],qs['fields'](_0x3e0591[_0xe1d7('0x3d')][_0xe1d7('0x3f')]));_0x73f9e2[_0xe1d7('0x40')]=_0x73f9e2[_0xe1d7('0x40')]['length']?_0x73f9e2[_0xe1d7('0x40')]:_0x4d9098[_0xe1d7('0x3b')];_0x73f9e2[_0xe1d7('0x43')]=qs[_0xe1d7('0x44')](_0x3e0591['query'][_0xe1d7('0x44')]);_0x73f9e2[_0xe1d7('0x45')]=qs[_0xe1d7('0x47')](_[_0xe1d7('0x46')](_0x3e0591[_0xe1d7('0x3d')],_0x4d9098['filters']));if(_0x3e0591['query'][_0xe1d7('0x48')]){_0x73f9e2['where']=_[_0xe1d7('0x49')](_0x73f9e2[_0xe1d7('0x45')],{'$or':_[_0xe1d7('0x37')](_0x73f9e2['attributes'],function(_0x2c84ad){var _0x3c3709={};_0x3c3709[_0x2c84ad]={'$like':'%'+_0x3e0591['query']['filter']+'%'};return _0x3c3709;})});}_0x73f9e2=_[_0xe1d7('0x49')]({},_0x73f9e2,_0x3e0591[_0xe1d7('0x4b')]);return _0x2e8da1[_0xe1d7('0x5d')](_0x73f9e2);}})[_0xe1d7('0x1e')](function(_0x5dd938){if(_0x5dd938){_0x40b418=_0x5dd938[_0xe1d7('0x41')];if(!_0x3e0591[_0xe1d7('0x3d')][_0xe1d7('0x59')](_0xe1d7('0x42'))){_0x73f9e2[_0xe1d7('0x2d')]=qs['limit'](_0x3e0591[_0xe1d7('0x3d')][_0xe1d7('0x2d')]);_0x73f9e2[_0xe1d7('0x2c')]=qs[_0xe1d7('0x2c')](_0x3e0591[_0xe1d7('0x3d')][_0xe1d7('0x2c')]);}return _0x2e8da1[_0xe1d7('0x5d')](_0x73f9e2);}})['then'](function(_0x472a04){if(_0x472a04){return _0x472a04?{'count':_0x40b418,'rows':_0x472a04}:null;}})[_0xe1d7('0x1e')](respondWithResult(_0x2e791c,null))[_0xe1d7('0x28')](handleError(_0x2e791c,null));};exports['setTags']=function(_0x1f0e69,_0x352025,_0x54cd44){if(_0x1f0e69[_0xe1d7('0x56')]['id']){delete _0x1f0e69[_0xe1d7('0x56')]['id'];}return db['FreshdeskConfiguration'][_0xe1d7('0x57')]({'where':{'id':_0x1f0e69[_0xe1d7('0x53')]['id']}})['then'](handleEntityNotFound(_0x352025,null))['then'](function(_0x4f92ea){if(_0x4f92ea){return _0x4f92ea['setTags'](_0x1f0e69['body']['ids']||[]);}return null;})[_0xe1d7('0x1e')](respondWithResult(_0x352025,null))[_0xe1d7('0x28')](handleError(_0x352025,null));}; \ No newline at end of file +var _0x68de=['offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','fields','attributes','model','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','length','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','FreshdeskField','getTags','Tag','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','test','Sequelize','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count'];(function(_0x182377,_0xd15726){var _0x21a0ab=function(_0x1d6730){while(--_0x1d6730){_0x182377['push'](_0x182377['shift']());}};_0x21a0ab(++_0xd15726);}(_0x68de,0xfa));var _0xe68d=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0x68de[_0x4503df];return _0x3f1b2b;};'use strict';var pdf=require(_0xe68d('0x0'));var emlformat=require(_0xe68d('0x1'));var rimraf=require(_0xe68d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe68d('0x3'));var rp=require(_0xe68d('0x4'));var moment=require(_0xe68d('0x5'));var BPromise=require(_0xe68d('0x6'));var Mustache=require('mustache');var util=require(_0xe68d('0x7'));var path=require(_0xe68d('0x8'));var sox=require(_0xe68d('0x9'));var csv=require(_0xe68d('0xa'));var ejs=require(_0xe68d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe68d('0xc'));var crypto=require('crypto');var jsforce=require(_0xe68d('0xd'));var deskjs=require(_0xe68d('0xe'));var toCsv=require(_0xe68d('0xa'));var querystring=require(_0xe68d('0xf'));var Papa=require(_0xe68d('0x10'));var Redis=require(_0xe68d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe68d('0x12'));var as=require(_0xe68d('0x13'));var hardwareService=require(_0xe68d('0x14'));var logger=require('../../config/logger')(_0xe68d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe68d('0x16'))['db'];var jayson=require(_0xe68d('0x17'));var client=jayson[_0xe68d('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x42e532,_0x5afe30,_0x398ba3){if(_0x398ba3){var _0x196e5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x196e5c[_0xe68d('0x19')](_0x5afe30)){return _0x42e532;}else{throw new db[(_0xe68d('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x42e532;}}function respondWithRpcPromise(_0xa445d8,_0x1f0baa,_0x2ece27,_0x459352){return new BPromise(function(_0x25c502,_0x216777){var _0x3b6364=_0x459352||client;return _0x3b6364[_0xe68d('0x1b')](_0xa445d8,_0x2ece27)[_0xe68d('0x1c')](function(_0x2f9dc7){logger[_0xe68d('0x1d')](_0xe68d('0x1e'),_0x1f0baa,_0xe68d('0x1f'));logger[_0xe68d('0x20')](_0xe68d('0x21'),_0x1f0baa,'request\x20sent',JSON[_0xe68d('0x22')](_0x2f9dc7));if(_0x2f9dc7[_0xe68d('0x23')]){if(_0x2f9dc7[_0xe68d('0x23')][_0xe68d('0x24')]===0x1f4){logger[_0xe68d('0x23')](_0xe68d('0x1e'),_0x1f0baa,_0x2f9dc7[_0xe68d('0x23')][_0xe68d('0x25')]);return _0x216777(_0x2f9dc7[_0xe68d('0x23')][_0xe68d('0x25')]);}logger[_0xe68d('0x23')](_0xe68d('0x1e'),_0x1f0baa,_0x2f9dc7[_0xe68d('0x23')]['message']);return _0x25c502(_0x2f9dc7[_0xe68d('0x23')]['message']);}else{logger[_0xe68d('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f0baa,'request\x20sent');_0x25c502(_0x2f9dc7[_0xe68d('0x26')][_0xe68d('0x25')]);}})[_0xe68d('0x27')](function(_0x1fd98a){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f0baa,_0x1fd98a);_0x216777(_0x1fd98a);});});}function respondWithStatusCode(_0x53b957,_0x5cead6){_0x5cead6=_0x5cead6||0xcc;return function(_0x19fc4a){if(_0x19fc4a){return _0x53b957[_0xe68d('0x28')](_0x5cead6);}return _0x53b957[_0xe68d('0x29')](_0x5cead6)[_0xe68d('0x2a')]();};}function respondWithResult(_0x9ae1f4,_0x183c4b){_0x183c4b=_0x183c4b||0xc8;return function(_0x489374){if(_0x489374){return _0x9ae1f4[_0xe68d('0x29')](_0x183c4b)['json'](_0x489374);}};}function respondWithFilteredResult(_0x5d7e7e,_0x453c5f){return function(_0x5b4980){if(_0x5b4980){var _0x71c33=_0x5b4980[_0xe68d('0x2b')],_0x14955a=_0x453c5f[_0xe68d('0x2c')],_0x57e8f5=_0x453c5f[_0xe68d('0x2c')]+_0x453c5f[_0xe68d('0x2d')],_0x497a43;if(_0x57e8f5>=_0x71c33){_0x57e8f5=_0x71c33;_0x497a43=0xc8;}else{_0x497a43=0xce;}_0x5d7e7e[_0xe68d('0x29')](_0x497a43);return _0x5d7e7e[_0xe68d('0x2e')](_0xe68d('0x2f'),_0x14955a+'-'+_0x57e8f5+'/'+_0x71c33)['json'](_0x5b4980);}return null;};}function patchUpdates(_0x2eb3b6){return function(_0x1fc4f2){try{jsonpatch[_0xe68d('0x30')](_0x1fc4f2,_0x2eb3b6,!![]);}catch(_0x25999e){return BPromise[_0xe68d('0x31')](_0x25999e);}return _0x1fc4f2[_0xe68d('0x32')]();};}function saveUpdates(_0x1c7360,_0x43caf2){return function(_0x288e8c){if(_0x288e8c){return _0x288e8c[_0xe68d('0x33')](_0x1c7360)[_0xe68d('0x1c')](function(_0x4cd725){return _0x4cd725;});}return null;};}function removeEntity(_0x5c27ab,_0x8cfee){return function(_0x3f1275){if(_0x3f1275){return _0x3f1275[_0xe68d('0x34')]()[_0xe68d('0x1c')](function(){_0x5c27ab['status'](0xcc)[_0xe68d('0x2a')]();});}};}function handleEntityNotFound(_0x2d5414,_0x59026e){return function(_0x4bba56){if(!_0x4bba56){_0x2d5414[_0xe68d('0x28')](0x194);}return _0x4bba56;};}function handleError(_0x2f0459,_0x45ba6b){_0x45ba6b=_0x45ba6b||0x1f4;return function(_0x43402e){logger[_0xe68d('0x23')](_0x43402e[_0xe68d('0x35')]);if(_0x43402e[_0xe68d('0x36')]){delete _0x43402e[_0xe68d('0x36')];}_0x2f0459['status'](_0x45ba6b)[_0xe68d('0x37')](_0x43402e);};}exports[_0xe68d('0x38')]=function(_0xd97d11,_0x49bdba){var _0x599dcc={},_0x2577cb={},_0x4f1695={'count':0x0,'rows':[]};var _0x53c1a2=_[_0xe68d('0x39')](db[_0xe68d('0x3a')][_0xe68d('0x3b')],function(_0x379b17){return{'name':_0x379b17[_0xe68d('0x3c')],'type':_0x379b17[_0xe68d('0x3d')][_0xe68d('0x3e')]};});_0x2577cb['model']=_[_0xe68d('0x39')](_0x53c1a2,_0xe68d('0x36'));_0x2577cb[_0xe68d('0x3f')]=_['keys'](_0xd97d11[_0xe68d('0x3f')]);_0x2577cb[_0xe68d('0x40')]=_['intersection'](_0x2577cb['model'],_0x2577cb[_0xe68d('0x3f')]);_0x599dcc['attributes']=_[_0xe68d('0x41')](_0x2577cb['model'],qs[_0xe68d('0x42')](_0xd97d11[_0xe68d('0x3f')][_0xe68d('0x42')]));_0x599dcc['attributes']=_0x599dcc['attributes']['length']?_0x599dcc[_0xe68d('0x43')]:_0x2577cb[_0xe68d('0x44')];if(!_0xd97d11[_0xe68d('0x3f')]['hasOwnProperty'](_0xe68d('0x45'))){_0x599dcc[_0xe68d('0x2d')]=qs['limit'](_0xd97d11['query'][_0xe68d('0x2d')]);_0x599dcc['offset']=qs[_0xe68d('0x2c')](_0xd97d11['query'][_0xe68d('0x2c')]);}_0x599dcc[_0xe68d('0x46')]=qs[_0xe68d('0x47')](_0xd97d11[_0xe68d('0x3f')][_0xe68d('0x47')]);_0x599dcc[_0xe68d('0x48')]=qs[_0xe68d('0x40')](_[_0xe68d('0x49')](_0xd97d11[_0xe68d('0x3f')],_0x2577cb[_0xe68d('0x40')]),_0x53c1a2);if(_0xd97d11[_0xe68d('0x3f')][_0xe68d('0x4a')]){_0x599dcc[_0xe68d('0x48')]=_['merge'](_0x599dcc['where'],{'$or':_[_0xe68d('0x39')](_0x53c1a2,function(_0x538c6e){if(_0x538c6e[_0xe68d('0x3d')]!==_0xe68d('0x4b')){var _0x26c09f={};_0x26c09f[_0x538c6e[_0xe68d('0x36')]]={'$like':'%'+_0xd97d11[_0xe68d('0x3f')][_0xe68d('0x4a')]+'%'};return _0x26c09f;}})});}_0x599dcc=_[_0xe68d('0x4c')]({},_0x599dcc,_0xd97d11[_0xe68d('0x4d')]);var _0x3c4139={'where':_0x599dcc[_0xe68d('0x48')]};return db[_0xe68d('0x3a')][_0xe68d('0x2b')](_0x3c4139)[_0xe68d('0x1c')](function(_0x6e8ef4){_0x4f1695[_0xe68d('0x2b')]=_0x6e8ef4;if(_0xd97d11[_0xe68d('0x3f')][_0xe68d('0x4e')]){_0x599dcc[_0xe68d('0x4f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xe68d('0x50')](_0x599dcc);})['then'](function(_0x50d627){_0x4f1695[_0xe68d('0x51')]=_0x50d627;return _0x4f1695;})[_0xe68d('0x1c')](respondWithFilteredResult(_0x49bdba,_0x599dcc))[_0xe68d('0x27')](handleError(_0x49bdba,null));};exports[_0xe68d('0x52')]=function(_0x46ff19,_0x114c12){var _0x2e042e={'raw':![],'where':{'id':_0x46ff19[_0xe68d('0x53')]['id']}},_0x3812e4={};_0x3812e4[_0xe68d('0x44')]=_[_0xe68d('0x54')](db[_0xe68d('0x3a')]['rawAttributes']);_0x3812e4[_0xe68d('0x3f')]=_[_0xe68d('0x54')](_0x46ff19[_0xe68d('0x3f')]);_0x3812e4['filters']=_[_0xe68d('0x41')](_0x3812e4[_0xe68d('0x44')],_0x3812e4['query']);_0x2e042e[_0xe68d('0x43')]=_[_0xe68d('0x41')](_0x3812e4['model'],qs['fields'](_0x46ff19[_0xe68d('0x3f')][_0xe68d('0x42')]));_0x2e042e['attributes']=_0x2e042e['attributes']['length']?_0x2e042e[_0xe68d('0x43')]:_0x3812e4[_0xe68d('0x44')];if(_0x46ff19[_0xe68d('0x3f')][_0xe68d('0x4e')]){_0x2e042e[_0xe68d('0x4f')]=[{'all':!![]}];}_0x2e042e=_[_0xe68d('0x4c')]({},_0x2e042e,_0x46ff19[_0xe68d('0x4d')]);return db['FreshdeskConfiguration'][_0xe68d('0x55')](_0x2e042e)[_0xe68d('0x1c')](handleEntityNotFound(_0x114c12,null))[_0xe68d('0x1c')](respondWithResult(_0x114c12,null))[_0xe68d('0x27')](handleError(_0x114c12,null));};exports[_0xe68d('0x56')]=function(_0x177fc6,_0x4fdbfa){return db[_0xe68d('0x3a')][_0xe68d('0x56')](_0x177fc6['body'],{})[_0xe68d('0x1c')](respondWithResult(_0x4fdbfa,0xc9))[_0xe68d('0x27')](handleError(_0x4fdbfa,null));};exports[_0xe68d('0x33')]=function(_0x1ad409,_0x418bbb){if(_0x1ad409['body']['id']){delete _0x1ad409[_0xe68d('0x57')]['id'];}return db[_0xe68d('0x3a')]['find']({'where':{'id':_0x1ad409['params']['id']}})[_0xe68d('0x1c')](handleEntityNotFound(_0x418bbb,null))['then'](saveUpdates(_0x1ad409['body'],null))[_0xe68d('0x1c')](respondWithResult(_0x418bbb,null))[_0xe68d('0x27')](handleError(_0x418bbb,null));};exports['destroy']=function(_0x2e9132,_0x46e4fa){return db[_0xe68d('0x3a')]['find']({'where':{'id':_0x2e9132['params']['id']}})[_0xe68d('0x1c')](handleEntityNotFound(_0x46e4fa,null))['then'](removeEntity(_0x46e4fa,null))[_0xe68d('0x27')](handleError(_0x46e4fa,null));};exports['getFields']=function(_0x42392a,_0x47b79d,_0x17303f){var _0x9056d3={};var _0x749531={};var _0x1752f0;var _0x3dc19f;return db[_0xe68d('0x3a')]['findOne']({'where':{'id':_0x42392a['params']['id']}})[_0xe68d('0x1c')](handleEntityNotFound(_0x47b79d,null))['then'](function(_0x24a8db){if(_0x24a8db){_0x1752f0=_0x24a8db;_0x749531[_0xe68d('0x44')]=_[_0xe68d('0x54')](db['FreshdeskField']['rawAttributes']);_0x749531['query']=_['keys'](_0x42392a['query']);_0x749531[_0xe68d('0x40')]=_['intersection'](_0x749531[_0xe68d('0x44')],_0x749531[_0xe68d('0x3f')]);_0x9056d3[_0xe68d('0x43')]=_[_0xe68d('0x41')](_0x749531['model'],qs['fields'](_0x42392a['query'][_0xe68d('0x42')]));_0x9056d3[_0xe68d('0x43')]=_0x9056d3[_0xe68d('0x43')][_0xe68d('0x58')]?_0x9056d3['attributes']:_0x749531[_0xe68d('0x44')];_0x9056d3[_0xe68d('0x46')]=qs[_0xe68d('0x47')](_0x42392a['query']['sort']);_0x9056d3[_0xe68d('0x48')]=qs[_0xe68d('0x40')](_[_0xe68d('0x49')](_0x42392a[_0xe68d('0x3f')],_0x749531[_0xe68d('0x40')]));if(_0x42392a[_0xe68d('0x3f')][_0xe68d('0x4a')]){_0x9056d3['where']=_['merge'](_0x9056d3[_0xe68d('0x48')],{'$or':_[_0xe68d('0x39')](_0x9056d3[_0xe68d('0x43')],function(_0x27daa5){var _0x22ecac={};_0x22ecac[_0x27daa5]={'$like':'%'+_0x42392a[_0xe68d('0x3f')][_0xe68d('0x4a')]+'%'};return _0x22ecac;})});}_0x9056d3=_[_0xe68d('0x4c')]({},_0x9056d3,_0x42392a[_0xe68d('0x4d')]);return _0x1752f0[_0xe68d('0x59')](_0x9056d3);}})[_0xe68d('0x1c')](function(_0xa17fa6){if(_0xa17fa6){_0x3dc19f=_0xa17fa6['length'];if(!_0x42392a[_0xe68d('0x3f')][_0xe68d('0x5a')](_0xe68d('0x45'))){_0x9056d3[_0xe68d('0x2d')]=qs['limit'](_0x42392a[_0xe68d('0x3f')][_0xe68d('0x2d')]);_0x9056d3[_0xe68d('0x2c')]=qs[_0xe68d('0x2c')](_0x42392a[_0xe68d('0x3f')]['offset']);}return _0x1752f0[_0xe68d('0x59')](_0x9056d3);}})[_0xe68d('0x1c')](function(_0x19e10f){if(_0x19e10f){return _0x19e10f?{'count':_0x3dc19f,'rows':_0x19e10f}:null;}})['then'](respondWithResult(_0x47b79d,null))['catch'](handleError(_0x47b79d,null));};exports[_0xe68d('0x5b')]=function(_0x24fd90,_0x367753,_0x3b9fe9){var _0xee4c8f={};var _0x58c988={};var _0x3f26d0;var _0x39293e;return db[_0xe68d('0x3a')][_0xe68d('0x5c')]({'where':{'id':_0x24fd90[_0xe68d('0x53')]['id']}})[_0xe68d('0x1c')](handleEntityNotFound(_0x367753,null))['then'](function(_0x3cd057){if(_0x3cd057){_0x3f26d0=_0x3cd057;_0x58c988[_0xe68d('0x44')]=_[_0xe68d('0x54')](db['FreshdeskField']['rawAttributes']);_0x58c988[_0xe68d('0x3f')]=_[_0xe68d('0x54')](_0x24fd90['query']);_0x58c988[_0xe68d('0x40')]=_['intersection'](_0x58c988['model'],_0x58c988[_0xe68d('0x3f')]);_0xee4c8f[_0xe68d('0x43')]=_['intersection'](_0x58c988['model'],qs[_0xe68d('0x42')](_0x24fd90[_0xe68d('0x3f')][_0xe68d('0x42')]));_0xee4c8f[_0xe68d('0x43')]=_0xee4c8f[_0xe68d('0x43')][_0xe68d('0x58')]?_0xee4c8f[_0xe68d('0x43')]:_0x58c988['model'];_0xee4c8f[_0xe68d('0x46')]=qs[_0xe68d('0x47')](_0x24fd90[_0xe68d('0x3f')][_0xe68d('0x47')]);_0xee4c8f[_0xe68d('0x48')]=qs[_0xe68d('0x40')](_['pick'](_0x24fd90[_0xe68d('0x3f')],_0x58c988[_0xe68d('0x40')]));if(_0x24fd90[_0xe68d('0x3f')][_0xe68d('0x4a')]){_0xee4c8f[_0xe68d('0x48')]=_['merge'](_0xee4c8f[_0xe68d('0x48')],{'$or':_[_0xe68d('0x39')](_0xee4c8f[_0xe68d('0x43')],function(_0x1a5471){var _0x4a847b={};_0x4a847b[_0x1a5471]={'$like':'%'+_0x24fd90[_0xe68d('0x3f')][_0xe68d('0x4a')]+'%'};return _0x4a847b;})});}_0xee4c8f=_[_0xe68d('0x4c')]({},_0xee4c8f,_0x24fd90[_0xe68d('0x4d')]);return _0x3f26d0[_0xe68d('0x5b')](_0xee4c8f);}})[_0xe68d('0x1c')](function(_0x154898){if(_0x154898){_0x39293e=_0x154898['length'];if(!_0x24fd90['query'][_0xe68d('0x5a')]('nolimit')){_0xee4c8f[_0xe68d('0x2d')]=qs[_0xe68d('0x2d')](_0x24fd90['query'][_0xe68d('0x2d')]);_0xee4c8f[_0xe68d('0x2c')]=qs[_0xe68d('0x2c')](_0x24fd90[_0xe68d('0x3f')][_0xe68d('0x2c')]);}return _0x3f26d0[_0xe68d('0x5b')](_0xee4c8f);}})['then'](function(_0x17749d){if(_0x17749d){return _0x17749d?{'count':_0x39293e,'rows':_0x17749d}:null;}})['then'](respondWithResult(_0x367753,null))[_0xe68d('0x27')](handleError(_0x367753,null));};exports[_0xe68d('0x5d')]=function(_0x4ebc8c,_0x160722,_0x4a22cc){var _0x48e7e5={};var _0x23abe5={};var _0x4097da;var _0x51e1c;return db['FreshdeskConfiguration'][_0xe68d('0x5c')]({'where':{'id':_0x4ebc8c['params']['id']}})[_0xe68d('0x1c')](handleEntityNotFound(_0x160722,null))['then'](function(_0x241ef1){if(_0x241ef1){_0x4097da=_0x241ef1;_0x23abe5['model']=_[_0xe68d('0x54')](db[_0xe68d('0x5e')][_0xe68d('0x3b')]);_0x23abe5[_0xe68d('0x3f')]=_['keys'](_0x4ebc8c[_0xe68d('0x3f')]);_0x23abe5['filters']=_[_0xe68d('0x41')](_0x23abe5[_0xe68d('0x44')],_0x23abe5[_0xe68d('0x3f')]);_0x48e7e5['attributes']=_[_0xe68d('0x41')](_0x23abe5[_0xe68d('0x44')],qs[_0xe68d('0x42')](_0x4ebc8c[_0xe68d('0x3f')][_0xe68d('0x42')]));_0x48e7e5[_0xe68d('0x43')]=_0x48e7e5[_0xe68d('0x43')][_0xe68d('0x58')]?_0x48e7e5[_0xe68d('0x43')]:_0x23abe5[_0xe68d('0x44')];_0x48e7e5[_0xe68d('0x46')]=qs['sort'](_0x4ebc8c[_0xe68d('0x3f')][_0xe68d('0x47')]);_0x48e7e5[_0xe68d('0x48')]=qs[_0xe68d('0x40')](_['pick'](_0x4ebc8c[_0xe68d('0x3f')],_0x23abe5[_0xe68d('0x40')]));if(_0x4ebc8c[_0xe68d('0x3f')][_0xe68d('0x4a')]){_0x48e7e5[_0xe68d('0x48')]=_[_0xe68d('0x4c')](_0x48e7e5['where'],{'$or':_[_0xe68d('0x39')](_0x48e7e5[_0xe68d('0x43')],function(_0x2ed744){var _0x81326b={};_0x81326b[_0x2ed744]={'$like':'%'+_0x4ebc8c[_0xe68d('0x3f')][_0xe68d('0x4a')]+'%'};return _0x81326b;})});}_0x48e7e5=_[_0xe68d('0x4c')]({},_0x48e7e5,_0x4ebc8c['options']);return _0x4097da[_0xe68d('0x5d')](_0x48e7e5);}})[_0xe68d('0x1c')](function(_0x40c44b){if(_0x40c44b){_0x51e1c=_0x40c44b[_0xe68d('0x58')];if(!_0x4ebc8c['query'][_0xe68d('0x5a')](_0xe68d('0x45'))){_0x48e7e5['limit']=qs['limit'](_0x4ebc8c['query']['limit']);_0x48e7e5[_0xe68d('0x2c')]=qs[_0xe68d('0x2c')](_0x4ebc8c[_0xe68d('0x3f')][_0xe68d('0x2c')]);}return _0x4097da[_0xe68d('0x5d')](_0x48e7e5);}})[_0xe68d('0x1c')](function(_0x51045a){if(_0x51045a){return _0x51045a?{'count':_0x51e1c,'rows':_0x51045a}:null;}})[_0xe68d('0x1c')](respondWithResult(_0x160722,null))[_0xe68d('0x27')](handleError(_0x160722,null));};exports[_0xe68d('0x5f')]=function(_0x44aaa1,_0x464deb,_0x2753ca){var _0x4f37e1={};var _0x5512af={};var _0x2d2f6e;var _0x433120;return db['FreshdeskConfiguration'][_0xe68d('0x5c')]({'where':{'id':_0x44aaa1[_0xe68d('0x53')]['id']}})[_0xe68d('0x1c')](handleEntityNotFound(_0x464deb,null))[_0xe68d('0x1c')](function(_0x314b34){if(_0x314b34){_0x2d2f6e=_0x314b34;_0x5512af['model']=_[_0xe68d('0x54')](db[_0xe68d('0x60')][_0xe68d('0x3b')]);_0x5512af[_0xe68d('0x3f')]=_[_0xe68d('0x54')](_0x44aaa1[_0xe68d('0x3f')]);_0x5512af[_0xe68d('0x40')]=_[_0xe68d('0x41')](_0x5512af[_0xe68d('0x44')],_0x5512af['query']);_0x4f37e1['attributes']=_[_0xe68d('0x41')](_0x5512af[_0xe68d('0x44')],qs[_0xe68d('0x42')](_0x44aaa1[_0xe68d('0x3f')][_0xe68d('0x42')]));_0x4f37e1[_0xe68d('0x43')]=_0x4f37e1[_0xe68d('0x43')][_0xe68d('0x58')]?_0x4f37e1[_0xe68d('0x43')]:_0x5512af[_0xe68d('0x44')];_0x4f37e1[_0xe68d('0x46')]=qs[_0xe68d('0x47')](_0x44aaa1[_0xe68d('0x3f')][_0xe68d('0x47')]);_0x4f37e1['where']=qs[_0xe68d('0x40')](_[_0xe68d('0x49')](_0x44aaa1[_0xe68d('0x3f')],_0x5512af[_0xe68d('0x40')]));if(_0x44aaa1[_0xe68d('0x3f')][_0xe68d('0x4a')]){_0x4f37e1[_0xe68d('0x48')]=_['merge'](_0x4f37e1[_0xe68d('0x48')],{'$or':_[_0xe68d('0x39')](_0x4f37e1[_0xe68d('0x43')],function(_0x7c3134){var _0x4338a5={};_0x4338a5[_0x7c3134]={'$like':'%'+_0x44aaa1[_0xe68d('0x3f')][_0xe68d('0x4a')]+'%'};return _0x4338a5;})});}_0x4f37e1=_['merge']({},_0x4f37e1,_0x44aaa1['options']);return _0x2d2f6e[_0xe68d('0x5f')](_0x4f37e1);}})[_0xe68d('0x1c')](function(_0x3facba){if(_0x3facba){_0x433120=_0x3facba[_0xe68d('0x58')];if(!_0x44aaa1[_0xe68d('0x3f')][_0xe68d('0x5a')](_0xe68d('0x45'))){_0x4f37e1[_0xe68d('0x2d')]=qs[_0xe68d('0x2d')](_0x44aaa1[_0xe68d('0x3f')]['limit']);_0x4f37e1['offset']=qs[_0xe68d('0x2c')](_0x44aaa1[_0xe68d('0x3f')][_0xe68d('0x2c')]);}return _0x2d2f6e[_0xe68d('0x5f')](_0x4f37e1);}})[_0xe68d('0x1c')](function(_0x4bfa62){if(_0x4bfa62){return _0x4bfa62?{'count':_0x433120,'rows':_0x4bfa62}:null;}})[_0xe68d('0x1c')](respondWithResult(_0x464deb,null))['catch'](handleError(_0x464deb,null));};exports['setTags']=function(_0x569b08,_0x19c60f,_0x52a897){if(_0x569b08[_0xe68d('0x57')]['id']){delete _0x569b08[_0xe68d('0x57')]['id'];}return db[_0xe68d('0x3a')][_0xe68d('0x5c')]({'where':{'id':_0x569b08[_0xe68d('0x53')]['id']}})[_0xe68d('0x1c')](handleEntityNotFound(_0x19c60f,null))['then'](function(_0x3563d8){if(_0x3563d8){return _0x3563d8[_0xe68d('0x61')](_0x569b08[_0xe68d('0x57')]['ids']||[]);}return null;})['then'](respondWithResult(_0x19c60f,null))[_0xe68d('0x27')](handleError(_0x19c60f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2aab562..efb3d65 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 _0x55ca=['./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0x55ca,0x126));var _0xa55c=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x55ca[_0x154940];return _0x401409;};'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')]('FreshdeskConfiguration',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','int_freshdesk_configurations','lodash'];(function(_0x3c093a,_0x5db48e){var _0xd278c9=function(_0xbf8b3b){while(--_0xbf8b3b){_0x3c093a['push'](_0x3c093a['shift']());}};_0xd278c9(++_0x5db48e);}(_0xabce,0x103));var _0xeabc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xabce[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0xeabc('0x9'),'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 d5cb03d..ddfaf23 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 _0xb3b7=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','ioredis'];(function(_0x2bc7bc,_0x827ea){var _0xbae862=function(_0xdde795){while(--_0xdde795){_0x2bc7bc['push'](_0x2bc7bc['shift']());}};_0xbae862(++_0x827ea);}(_0xb3b7,0x1d7));var _0x7b3b=function(_0x419f31,_0x5bb80c){_0x419f31=_0x419f31-0x0;var _0x2dd03d=_0xb3b7[_0x419f31];return _0x2dd03d;};'use strict';var _=require(_0x7b3b('0x0'));var util=require(_0x7b3b('0x1'));var moment=require(_0x7b3b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b3b('0x3'));var db=require(_0x7b3b('0x4'))['db'];var utils=require(_0x7b3b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7b3b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7b3b('0x7')][_0x7b3b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39fea9,_0x58f0c2,_0x1f1102){return new BPromise(function(_0xbc9f63,_0x27270c){return client[_0x7b3b('0x9')](_0x39fea9,_0x1f1102)[_0x7b3b('0xa')](function(_0x26e78a){logger['info'](_0x7b3b('0xb'),_0x58f0c2,_0x7b3b('0xc'));logger['debug'](_0x7b3b('0xd'),_0x58f0c2,_0x7b3b('0xc'),JSON['stringify'](_0x26e78a));if(_0x26e78a[_0x7b3b('0xe')]){if(_0x26e78a[_0x7b3b('0xe')][_0x7b3b('0xf')]===0x1f4){logger['error'](_0x7b3b('0xb'),_0x58f0c2,_0x26e78a[_0x7b3b('0xe')][_0x7b3b('0x10')]);return _0x27270c(_0x26e78a['error'][_0x7b3b('0x10')]);}logger[_0x7b3b('0xe')](_0x7b3b('0xb'),_0x58f0c2,_0x26e78a[_0x7b3b('0xe')][_0x7b3b('0x10')]);return _0xbc9f63(_0x26e78a[_0x7b3b('0xe')][_0x7b3b('0x10')]);}else{logger[_0x7b3b('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x58f0c2,_0x7b3b('0xc'));_0xbc9f63(_0x26e78a['result'][_0x7b3b('0x10')]);}})[_0x7b3b('0x12')](function(_0x594962){logger[_0x7b3b('0xe')](_0x7b3b('0xb'),_0x58f0c2,_0x594962);_0x27270c(_0x594962);});});} \ No newline at end of file +var _0xbcda=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xbcda,0x190));var _0xabcd=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xbcda[_0xbe200f];return _0x192597;};'use strict';var _=require(_0xabcd('0x0'));var util=require(_0xabcd('0x1'));var moment=require(_0xabcd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xabcd('0x3'));var db=require(_0xabcd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xabcd('0x5'))(_0xabcd('0x6'));var config=require(_0xabcd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xabcd('0x8')][_0xabcd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15c817,_0x3f6199,_0xaa0962){return new BPromise(function(_0x21b25a,_0x1668ca){return client[_0xabcd('0xa')](_0x15c817,_0xaa0962)['then'](function(_0x2a9982){logger[_0xabcd('0xb')](_0xabcd('0xc'),_0x3f6199,_0xabcd('0xd'));logger[_0xabcd('0xe')](_0xabcd('0xf'),_0x3f6199,_0xabcd('0xd'),JSON[_0xabcd('0x10')](_0x2a9982));if(_0x2a9982[_0xabcd('0x11')]){if(_0x2a9982[_0xabcd('0x11')][_0xabcd('0x12')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f6199,_0x2a9982[_0xabcd('0x11')][_0xabcd('0x13')]);return _0x1668ca(_0x2a9982[_0xabcd('0x11')][_0xabcd('0x13')]);}logger[_0xabcd('0x11')](_0xabcd('0xc'),_0x3f6199,_0x2a9982[_0xabcd('0x11')][_0xabcd('0x13')]);return _0x21b25a(_0x2a9982[_0xabcd('0x11')]['message']);}else{logger[_0xabcd('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f6199,_0xabcd('0xd'));_0x21b25a(_0x2a9982['result'][_0xabcd('0x13')]);}})[_0xabcd('0x14')](function(_0x39b67e){logger['error'](_0xabcd('0xc'),_0x3f6199,_0x39b67e);_0x1668ca(_0x39b67e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5957f76..4238522 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x5e4d0f,_0x399f03){var _0x4c878e=function(_0x459d54){while(--_0x459d54){_0x5e4d0f['push'](_0x5e4d0f['shift']());}};_0x4c878e(++_0x399f03);}(_0x008c,0x188));var _0xc008=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x008c[_0x2fd160];return _0x5c2031;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x286beb,_0x47982e){var _0x20b3b9=function(_0x40daee){while(--_0x40daee){_0x286beb['push'](_0x286beb['shift']());}};_0x20b3b9(++_0x47982e);}(_0x3e74,0x175));var _0x43e7=function(_0x178b22,_0x217ec2){_0x178b22=_0x178b22-0x0;var _0xc9b826=_0x3e74[_0x178b22];return _0xc9b826;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ffad98c..48947c2 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 _0x635c=['ENUM','string','variable','keyValue','STRING','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x635c,0xa1));var _0xc635=function(_0x1f42ab,_0x1cc146){_0x1f42ab=_0x1f42ab-0x0;var _0x25c2a7=_0x635c[_0x1f42ab];return _0x25c2a7;};'use strict';var Sequelize=require('sequelize');module[_0xc635('0x0')]={'type':{'type':Sequelize[_0xc635('0x1')](_0xc635('0x2'),_0xc635('0x3'),'customVariable',_0xc635('0x4')),'defaultValue':_0xc635('0x2')},'content':{'type':Sequelize[_0xc635('0x5')]},'key':{'type':Sequelize[_0xc635('0x5')]},'keyType':{'type':Sequelize[_0xc635('0x1')](_0xc635('0x2'),_0xc635('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc635('0x5')]},'idField':{'type':Sequelize[_0xc635('0x5')]},'nameField':{'type':Sequelize[_0xc635('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc635('0x5')]}}; \ No newline at end of file +var _0x029b=['string','variable','keyValue','ENUM','customVariable','STRING','sequelize','exports'];(function(_0x4112fb,_0x40d0c0){var _0x227ab4=function(_0x1765e4){while(--_0x1765e4){_0x4112fb['push'](_0x4112fb['shift']());}};_0x227ab4(++_0x40d0c0);}(_0x029b,0x66));var _0xb029=function(_0x26266d,_0x514c4e){_0x26266d=_0x26266d-0x0;var _0x4738ef=_0x029b[_0x26266d];return _0x4738ef;};'use strict';var Sequelize=require(_0xb029('0x0'));module[_0xb029('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb029('0x2'),_0xb029('0x3'),'customVariable',_0xb029('0x4')),'defaultValue':_0xb029('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb029('0x5')](_0xb029('0x2'),_0xb029('0x3'),_0xb029('0x6'))},'keyContent':{'type':Sequelize[_0xb029('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb029('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb029('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 18ac87f..82e79ab 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 _0x6891=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','update','then','destroy','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','order','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6891,0x150));var _0x1689=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x6891[_0x47a349];return _0x18ab75;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1689('0x0'));var zipdir=require(_0x1689('0x1'));var jsonpatch=require(_0x1689('0x2'));var rp=require(_0x1689('0x3'));var moment=require('moment');var BPromise=require(_0x1689('0x4'));var Mustache=require(_0x1689('0x5'));var util=require(_0x1689('0x6'));var path=require('path');var sox=require(_0x1689('0x7'));var csv=require(_0x1689('0x8'));var ejs=require(_0x1689('0x9'));var fs=require('fs');var _=require(_0x1689('0xa'));var squel=require(_0x1689('0xb'));var crypto=require(_0x1689('0xc'));var jsforce=require(_0x1689('0xd'));var deskjs=require(_0x1689('0xe'));var toCsv=require(_0x1689('0x8'));var querystring=require(_0x1689('0xf'));var Papa=require(_0x1689('0x10'));var Redis=require('ioredis');var authService=require(_0x1689('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1689('0x12'));var logger=require(_0x1689('0x13'))(_0x1689('0x14'));var utils=require(_0x1689('0x15'));var config=require('../../config/environment');var db=require(_0x1689('0x16'))['db'];function respondWithStatusCode(_0x4898cb,_0x5e917a){_0x5e917a=_0x5e917a||0xcc;return function(_0x3f403f){if(_0x3f403f){return _0x4898cb[_0x1689('0x17')](_0x5e917a);}return _0x4898cb[_0x1689('0x18')](_0x5e917a)[_0x1689('0x19')]();};}function respondWithResult(_0x40bf50,_0x22af7d){_0x22af7d=_0x22af7d||0xc8;return function(_0x4d6f61){if(_0x4d6f61){return _0x40bf50[_0x1689('0x18')](_0x22af7d)[_0x1689('0x1a')](_0x4d6f61);}};}function respondWithFilteredResult(_0x3f9295,_0x5bc0b4){return function(_0x33f12d){if(_0x33f12d){var _0x1525ce=_0x33f12d[_0x1689('0x1b')],_0x320321=_0x5bc0b4[_0x1689('0x1c')],_0x183a96=_0x5bc0b4['offset']+_0x5bc0b4[_0x1689('0x1d')],_0x5f36be;if(_0x183a96>=_0x1525ce){_0x183a96=_0x1525ce;_0x5f36be=0xc8;}else{_0x5f36be=0xce;}_0x3f9295[_0x1689('0x18')](_0x5f36be);return _0x3f9295['set']('Content-Range',_0x320321+'-'+_0x183a96+'/'+_0x1525ce)[_0x1689('0x1a')](_0x33f12d);}return null;};}function patchUpdates(_0x1fe5e8){return function(_0x17d48b){try{jsonpatch['apply'](_0x17d48b,_0x1fe5e8,!![]);}catch(_0x54fc9d){return BPromise[_0x1689('0x1e')](_0x54fc9d);}return _0x17d48b['save']();};}function saveUpdates(_0x55800e,_0x2b456d){return function(_0xcabd42){if(_0xcabd42){return _0xcabd42[_0x1689('0x1f')](_0x55800e)[_0x1689('0x20')](function(_0x45e7b8){return _0x45e7b8;});}return null;};}function removeEntity(_0x302384,_0x1aeef5){return function(_0x380a5c){if(_0x380a5c){return _0x380a5c[_0x1689('0x21')]()[_0x1689('0x20')](function(){_0x302384[_0x1689('0x18')](0xcc)[_0x1689('0x19')]();});}};}function handleEntityNotFound(_0x4a5be1,_0x2886f2){return function(_0x290613){if(!_0x290613){_0x4a5be1[_0x1689('0x17')](0x194);}return _0x290613;};}function handleError(_0x5eaf43,_0xa8f1eb){_0xa8f1eb=_0xa8f1eb||0x1f4;return function(_0x177f5f){logger[_0x1689('0x22')](_0x177f5f[_0x1689('0x23')]);if(_0x177f5f[_0x1689('0x24')]){delete _0x177f5f[_0x1689('0x24')];}_0x5eaf43[_0x1689('0x18')](_0xa8f1eb)[_0x1689('0x25')](_0x177f5f);};}exports[_0x1689('0x26')]=function(_0x31f4c7,_0x450f5c){var _0x3e52e8={},_0x53c0bc={},_0xa03b18={'count':0x0,'rows':[]};var _0x5d597a=_['map'](db[_0x1689('0x27')][_0x1689('0x28')],function(_0x4a33a8){return{'name':_0x4a33a8[_0x1689('0x29')],'type':_0x4a33a8[_0x1689('0x2a')]['key']};});_0x53c0bc[_0x1689('0x2b')]=_[_0x1689('0x2c')](_0x5d597a,_0x1689('0x24'));_0x53c0bc[_0x1689('0x2d')]=_['keys'](_0x31f4c7[_0x1689('0x2d')]);_0x53c0bc[_0x1689('0x2e')]=_['intersection'](_0x53c0bc[_0x1689('0x2b')],_0x53c0bc['query']);_0x3e52e8['attributes']=_[_0x1689('0x2f')](_0x53c0bc[_0x1689('0x2b')],qs[_0x1689('0x30')](_0x31f4c7[_0x1689('0x2d')][_0x1689('0x30')]));_0x3e52e8[_0x1689('0x31')]=_0x3e52e8[_0x1689('0x31')][_0x1689('0x32')]?_0x3e52e8[_0x1689('0x31')]:_0x53c0bc['model'];if(!_0x31f4c7[_0x1689('0x2d')]['hasOwnProperty']('nolimit')){_0x3e52e8[_0x1689('0x1d')]=qs['limit'](_0x31f4c7[_0x1689('0x2d')][_0x1689('0x1d')]);_0x3e52e8[_0x1689('0x1c')]=qs[_0x1689('0x1c')](_0x31f4c7[_0x1689('0x2d')]['offset']);}_0x3e52e8[_0x1689('0x33')]=qs['sort'](_0x31f4c7[_0x1689('0x2d')]['sort']);_0x3e52e8['where']=qs['filters'](_[_0x1689('0x34')](_0x31f4c7[_0x1689('0x2d')],_0x53c0bc['filters']),_0x5d597a);if(_0x31f4c7['query'][_0x1689('0x35')]){_0x3e52e8['where']=_['merge'](_0x3e52e8[_0x1689('0x36')],{'$or':_['map'](_0x5d597a,function(_0x4e3ac9){if(_0x4e3ac9[_0x1689('0x2a')]!==_0x1689('0x37')){var _0x245e31={};_0x245e31[_0x4e3ac9[_0x1689('0x24')]]={'$like':'%'+_0x31f4c7[_0x1689('0x2d')]['filter']+'%'};return _0x245e31;}})});}_0x3e52e8=_[_0x1689('0x38')]({},_0x3e52e8,_0x31f4c7[_0x1689('0x39')]);var _0x18955c={'where':_0x3e52e8[_0x1689('0x36')]};return db[_0x1689('0x27')]['count'](_0x18955c)[_0x1689('0x20')](function(_0x501b1a){_0xa03b18[_0x1689('0x1b')]=_0x501b1a;if(_0x31f4c7[_0x1689('0x2d')][_0x1689('0x3a')]){_0x3e52e8['include']=[{'all':!![]}];}return db[_0x1689('0x27')][_0x1689('0x3b')](_0x3e52e8);})[_0x1689('0x20')](function(_0x292e8d){_0xa03b18[_0x1689('0x3c')]=_0x292e8d;return _0xa03b18;})[_0x1689('0x20')](respondWithFilteredResult(_0x450f5c,_0x3e52e8))['catch'](handleError(_0x450f5c,null));};exports[_0x1689('0x3d')]=function(_0xea710f,_0x54843b){var _0x3f2542={'raw':!![],'where':{'id':_0xea710f[_0x1689('0x3e')]['id']}},_0x38498d={};_0x38498d['model']=_['keys'](db['FreshdeskField'][_0x1689('0x28')]);_0x38498d[_0x1689('0x2d')]=_['keys'](_0xea710f['query']);_0x38498d['filters']=_[_0x1689('0x2f')](_0x38498d[_0x1689('0x2b')],_0x38498d[_0x1689('0x2d')]);_0x3f2542[_0x1689('0x31')]=_[_0x1689('0x2f')](_0x38498d['model'],qs[_0x1689('0x30')](_0xea710f[_0x1689('0x2d')][_0x1689('0x30')]));_0x3f2542[_0x1689('0x31')]=_0x3f2542[_0x1689('0x31')][_0x1689('0x32')]?_0x3f2542[_0x1689('0x31')]:_0x38498d[_0x1689('0x2b')];if(_0xea710f[_0x1689('0x2d')][_0x1689('0x3a')]){_0x3f2542[_0x1689('0x3f')]=[{'all':!![]}];}_0x3f2542=_['merge']({},_0x3f2542,_0xea710f[_0x1689('0x39')]);return db[_0x1689('0x27')][_0x1689('0x40')](_0x3f2542)['then'](handleEntityNotFound(_0x54843b,null))['then'](respondWithResult(_0x54843b,null))[_0x1689('0x41')](handleError(_0x54843b,null));};exports[_0x1689('0x42')]=function(_0x3f7097,_0x59bcdc){return db[_0x1689('0x27')][_0x1689('0x42')](_0x3f7097[_0x1689('0x43')],{})['then'](respondWithResult(_0x59bcdc,0xc9))[_0x1689('0x41')](handleError(_0x59bcdc,null));};exports[_0x1689('0x1f')]=function(_0x5e33f0,_0x1d64cf){if(_0x5e33f0['body']['id']){delete _0x5e33f0[_0x1689('0x43')]['id'];}return db[_0x1689('0x27')][_0x1689('0x40')]({'where':{'id':_0x5e33f0[_0x1689('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1d64cf,null))['then'](saveUpdates(_0x5e33f0[_0x1689('0x43')],null))[_0x1689('0x20')](respondWithResult(_0x1d64cf,null))[_0x1689('0x41')](handleError(_0x1d64cf,null));};exports['destroy']=function(_0x178584,_0x1a5b79){return db[_0x1689('0x27')][_0x1689('0x40')]({'where':{'id':_0x178584[_0x1689('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1a5b79,null))['then'](removeEntity(_0x1a5b79,null))[_0x1689('0x41')](handleError(_0x1a5b79,null));}; \ No newline at end of file +var _0xdb68=['catch','show','params','keys','fields','find','create','body','html-pdf','eml-format','rimraf','moment','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','FreshdeskField','rawAttributes','type','key','model','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0xdb68,0x92));var _0x8db6=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xdb68[_0xdeefbd];return _0x4ff63f;};'use strict';var pdf=require(_0x8db6('0x0'));var emlformat=require(_0x8db6('0x1'));var rimraf=require(_0x8db6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8db6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8db6('0x4'));var sox=require(_0x8db6('0x5'));var csv=require(_0x8db6('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8db6('0x7'));var squel=require(_0x8db6('0x8'));var crypto=require('crypto');var jsforce=require(_0x8db6('0x9'));var deskjs=require(_0x8db6('0xa'));var toCsv=require(_0x8db6('0x6'));var querystring=require(_0x8db6('0xb'));var Papa=require(_0x8db6('0xc'));var Redis=require('ioredis');var authService=require(_0x8db6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x8db6('0xe'));var hardwareService=require(_0x8db6('0xf'));var logger=require(_0x8db6('0x10'))(_0x8db6('0x11'));var utils=require(_0x8db6('0x12'));var config=require(_0x8db6('0x13'));var db=require(_0x8db6('0x14'))['db'];function respondWithStatusCode(_0x81e036,_0x79ad5d){_0x79ad5d=_0x79ad5d||0xcc;return function(_0xb48385){if(_0xb48385){return _0x81e036['sendStatus'](_0x79ad5d);}return _0x81e036[_0x8db6('0x15')](_0x79ad5d)[_0x8db6('0x16')]();};}function respondWithResult(_0x59076b,_0x526ef9){_0x526ef9=_0x526ef9||0xc8;return function(_0x20a398){if(_0x20a398){return _0x59076b[_0x8db6('0x15')](_0x526ef9)[_0x8db6('0x17')](_0x20a398);}};}function respondWithFilteredResult(_0x3f9809,_0x13c10a){return function(_0x1dd89c){if(_0x1dd89c){var _0x28da59=_0x1dd89c[_0x8db6('0x18')],_0x124a49=_0x13c10a[_0x8db6('0x19')],_0x4d4917=_0x13c10a['offset']+_0x13c10a['limit'],_0x4f2c12;if(_0x4d4917>=_0x28da59){_0x4d4917=_0x28da59;_0x4f2c12=0xc8;}else{_0x4f2c12=0xce;}_0x3f9809[_0x8db6('0x15')](_0x4f2c12);return _0x3f9809[_0x8db6('0x1a')](_0x8db6('0x1b'),_0x124a49+'-'+_0x4d4917+'/'+_0x28da59)[_0x8db6('0x17')](_0x1dd89c);}return null;};}function patchUpdates(_0xca2de1){return function(_0x5ce157){try{jsonpatch['apply'](_0x5ce157,_0xca2de1,!![]);}catch(_0x36a5f6){return BPromise[_0x8db6('0x1c')](_0x36a5f6);}return _0x5ce157[_0x8db6('0x1d')]();};}function saveUpdates(_0x4c9221,_0x1f2ddd){return function(_0x474040){if(_0x474040){return _0x474040[_0x8db6('0x1e')](_0x4c9221)[_0x8db6('0x1f')](function(_0x1775d3){return _0x1775d3;});}return null;};}function removeEntity(_0x5ae69f,_0x5dda78){return function(_0x44932b){if(_0x44932b){return _0x44932b[_0x8db6('0x20')]()[_0x8db6('0x1f')](function(){_0x5ae69f[_0x8db6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3490,_0x5c9aaa){return function(_0x532cd1){if(!_0x532cd1){_0x1e3490['sendStatus'](0x194);}return _0x532cd1;};}function handleError(_0xaed34c,_0x29b397){_0x29b397=_0x29b397||0x1f4;return function(_0x40f585){logger['error'](_0x40f585[_0x8db6('0x21')]);if(_0x40f585[_0x8db6('0x22')]){delete _0x40f585[_0x8db6('0x22')];}_0xaed34c[_0x8db6('0x15')](_0x29b397)['send'](_0x40f585);};}exports[_0x8db6('0x23')]=function(_0x5a32b8,_0x269575){var _0x1d6e74={},_0x367581={},_0xe412a5={'count':0x0,'rows':[]};var _0x4dedf1=_[_0x8db6('0x24')](db[_0x8db6('0x25')][_0x8db6('0x26')],function(_0x323ee5){return{'name':_0x323ee5['fieldName'],'type':_0x323ee5[_0x8db6('0x27')][_0x8db6('0x28')]};});_0x367581[_0x8db6('0x29')]=_[_0x8db6('0x24')](_0x4dedf1,_0x8db6('0x22'));_0x367581['query']=_['keys'](_0x5a32b8['query']);_0x367581[_0x8db6('0x2a')]=_[_0x8db6('0x2b')](_0x367581['model'],_0x367581[_0x8db6('0x2c')]);_0x1d6e74[_0x8db6('0x2d')]=_['intersection'](_0x367581[_0x8db6('0x29')],qs['fields'](_0x5a32b8[_0x8db6('0x2c')]['fields']));_0x1d6e74[_0x8db6('0x2d')]=_0x1d6e74[_0x8db6('0x2d')][_0x8db6('0x2e')]?_0x1d6e74[_0x8db6('0x2d')]:_0x367581['model'];if(!_0x5a32b8[_0x8db6('0x2c')][_0x8db6('0x2f')](_0x8db6('0x30'))){_0x1d6e74['limit']=qs[_0x8db6('0x31')](_0x5a32b8[_0x8db6('0x2c')][_0x8db6('0x31')]);_0x1d6e74[_0x8db6('0x19')]=qs[_0x8db6('0x19')](_0x5a32b8[_0x8db6('0x2c')][_0x8db6('0x19')]);}_0x1d6e74[_0x8db6('0x32')]=qs['sort'](_0x5a32b8[_0x8db6('0x2c')][_0x8db6('0x33')]);_0x1d6e74['where']=qs[_0x8db6('0x2a')](_[_0x8db6('0x34')](_0x5a32b8[_0x8db6('0x2c')],_0x367581[_0x8db6('0x2a')]),_0x4dedf1);if(_0x5a32b8[_0x8db6('0x2c')][_0x8db6('0x35')]){_0x1d6e74[_0x8db6('0x36')]=_['merge'](_0x1d6e74[_0x8db6('0x36')],{'$or':_[_0x8db6('0x24')](_0x4dedf1,function(_0x28691a){if(_0x28691a[_0x8db6('0x27')]!==_0x8db6('0x37')){var _0x51fab7={};_0x51fab7[_0x28691a[_0x8db6('0x22')]]={'$like':'%'+_0x5a32b8[_0x8db6('0x2c')]['filter']+'%'};return _0x51fab7;}})});}_0x1d6e74=_[_0x8db6('0x38')]({},_0x1d6e74,_0x5a32b8[_0x8db6('0x39')]);var _0x390689={'where':_0x1d6e74[_0x8db6('0x36')]};return db[_0x8db6('0x25')]['count'](_0x390689)[_0x8db6('0x1f')](function(_0x52ac19){_0xe412a5['count']=_0x52ac19;if(_0x5a32b8['query'][_0x8db6('0x3a')]){_0x1d6e74[_0x8db6('0x3b')]=[{'all':!![]}];}return db[_0x8db6('0x25')][_0x8db6('0x3c')](_0x1d6e74);})['then'](function(_0x334b2c){_0xe412a5['rows']=_0x334b2c;return _0xe412a5;})[_0x8db6('0x1f')](respondWithFilteredResult(_0x269575,_0x1d6e74))[_0x8db6('0x3d')](handleError(_0x269575,null));};exports[_0x8db6('0x3e')]=function(_0x2d8631,_0x50fd58){var _0x193d59={'raw':!![],'where':{'id':_0x2d8631[_0x8db6('0x3f')]['id']}},_0x1ae49b={};_0x1ae49b['model']=_[_0x8db6('0x40')](db[_0x8db6('0x25')][_0x8db6('0x26')]);_0x1ae49b[_0x8db6('0x2c')]=_[_0x8db6('0x40')](_0x2d8631[_0x8db6('0x2c')]);_0x1ae49b[_0x8db6('0x2a')]=_['intersection'](_0x1ae49b['model'],_0x1ae49b[_0x8db6('0x2c')]);_0x193d59[_0x8db6('0x2d')]=_[_0x8db6('0x2b')](_0x1ae49b[_0x8db6('0x29')],qs[_0x8db6('0x41')](_0x2d8631[_0x8db6('0x2c')][_0x8db6('0x41')]));_0x193d59[_0x8db6('0x2d')]=_0x193d59[_0x8db6('0x2d')][_0x8db6('0x2e')]?_0x193d59[_0x8db6('0x2d')]:_0x1ae49b[_0x8db6('0x29')];if(_0x2d8631[_0x8db6('0x2c')][_0x8db6('0x3a')]){_0x193d59[_0x8db6('0x3b')]=[{'all':!![]}];}_0x193d59=_[_0x8db6('0x38')]({},_0x193d59,_0x2d8631[_0x8db6('0x39')]);return db[_0x8db6('0x25')][_0x8db6('0x42')](_0x193d59)[_0x8db6('0x1f')](handleEntityNotFound(_0x50fd58,null))[_0x8db6('0x1f')](respondWithResult(_0x50fd58,null))[_0x8db6('0x3d')](handleError(_0x50fd58,null));};exports['create']=function(_0x73dfe7,_0x1106d7){return db['FreshdeskField'][_0x8db6('0x43')](_0x73dfe7[_0x8db6('0x44')],{})[_0x8db6('0x1f')](respondWithResult(_0x1106d7,0xc9))[_0x8db6('0x3d')](handleError(_0x1106d7,null));};exports[_0x8db6('0x1e')]=function(_0x5bdfa1,_0x1657b7){if(_0x5bdfa1[_0x8db6('0x44')]['id']){delete _0x5bdfa1[_0x8db6('0x44')]['id'];}return db[_0x8db6('0x25')][_0x8db6('0x42')]({'where':{'id':_0x5bdfa1[_0x8db6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1657b7,null))[_0x8db6('0x1f')](saveUpdates(_0x5bdfa1[_0x8db6('0x44')],null))[_0x8db6('0x1f')](respondWithResult(_0x1657b7,null))[_0x8db6('0x3d')](handleError(_0x1657b7,null));};exports[_0x8db6('0x20')]=function(_0x4cd7dc,_0x593429){return db[_0x8db6('0x25')]['find']({'where':{'id':_0x4cd7dc[_0x8db6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x593429,null))[_0x8db6('0x1f')](removeEntity(_0x593429,null))[_0x8db6('0x3d')](handleError(_0x593429,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5d5dd5b..e278c7d 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 _0xdaee=['api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','util','../../config/logger'];(function(_0x539630,_0xc7ad57){var _0x7caa4=function(_0x47d001){while(--_0x47d001){_0x539630['push'](_0x539630['shift']());}};_0x7caa4(++_0xc7ad57);}(_0xdaee,0x82));var _0xedae=function(_0x4080c7,_0x460aeb){_0x4080c7=_0x4080c7-0x0;var _0x50da3f=_0xdaee[_0x4080c7];return _0x50da3f;};'use strict';var _=require('lodash');var util=require(_0xedae('0x0'));var logger=require(_0xedae('0x1'))(_0xedae('0x2'));var moment=require('moment');var BPromise=require(_0xedae('0x3'));var rp=require(_0xedae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xedae('0x5'));var config=require(_0xedae('0x6'));var attributes=require(_0xedae('0x7'));module['exports']=function(_0x20af67,_0x6531b){return _0x20af67['define'](_0xedae('0x8'),attributes,{'tableName':_0xedae('0x9'),'paranoid':![],'indexes':[{'name':_0xedae('0xa'),'fields':[_0xedae('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47ee=['define','int_freshdesk_fields','freshdesk_unique_index','idField','util','api','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x183a9b,_0x296e80){var _0x21f4e4=function(_0x4b4fa4){while(--_0x4b4fa4){_0x183a9b['push'](_0x183a9b['shift']());}};_0x21f4e4(++_0x296e80);}(_0x47ee,0xeb));var _0xe47e=function(_0x4326fd,_0x226fad){_0x4326fd=_0x4326fd-0x0;var _0x5bc652=_0x47ee[_0x4326fd];return _0x5bc652;};'use strict';var _=require('lodash');var util=require(_0xe47e('0x0'));var logger=require('../../config/logger')(_0xe47e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe47e('0x2'));var fs=require('fs');var path=require(_0xe47e('0x3'));var rimraf=require('rimraf');var config=require(_0xe47e('0x4'));var attributes=require(_0xe47e('0x5'));module[_0xe47e('0x6')]=function(_0x208a5b,_0x207dd9){return _0x208a5b[_0xe47e('0x7')]('FreshdeskField',attributes,{'tableName':_0xe47e('0x8'),'paranoid':![],'indexes':[{'name':_0xe47e('0x9'),'fields':[_0xe47e('0xa'),'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 7109be1..57c57a3 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x36e37d,_0x4905d2){_0x36e37d=_0x36e37d-0x0;var _0x2c606f=_0x7a54[_0x36e37d];return _0x2c606f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x4ff6b9,_0x56ad3e){_0x4ff6b9=_0x4ff6b9-0x0;var _0x2978c9=_0x7a54[_0x4ff6b9];return _0x2978c9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9eaa4ff..598ac48 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 _0x05dc=['getConfigurations','getFields','post','create','/:id/configurations','put','update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','/:id','isAuthenticated','show','get'];(function(_0x486ca3,_0x2f35ff){var _0x430925=function(_0x495025){while(--_0x495025){_0x486ca3['push'](_0x486ca3['shift']());}};_0x430925(++_0x2f35ff);}(_0x05dc,0x12f));var _0xc05d=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x05dc[_0xcfeda9];return _0x4826c7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc05d('0x0'));var express=require(_0xc05d('0x1'));var router=express[_0xc05d('0x2')]();var auth=require(_0xc05d('0x3'));var interaction=require(_0xc05d('0x4'));var config=require(_0xc05d('0x5'));var controller=require(_0xc05d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc05d('0x7')]);router['get'](_0xc05d('0x8'),auth[_0xc05d('0x9')](),controller[_0xc05d('0xa')]);router[_0xc05d('0xb')]('/:id/configurations',auth[_0xc05d('0x9')](),controller[_0xc05d('0xc')]);router['get']('/:id/fields',auth[_0xc05d('0x9')](),controller[_0xc05d('0xd')]);router[_0xc05d('0xe')]('/',auth[_0xc05d('0x9')](),controller[_0xc05d('0xf')]);router['post'](_0xc05d('0x10'),auth[_0xc05d('0x9')](),controller['addConfiguration']);router[_0xc05d('0x11')](_0xc05d('0x8'),auth[_0xc05d('0x9')](),controller[_0xc05d('0x12')]);router[_0xc05d('0x13')](_0xc05d('0x8'),auth['isAuthenticated'](),controller[_0xc05d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6a31=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','put','delete'];(function(_0x401dbc,_0x536a53){var _0x3b64c3=function(_0x28bbc2){while(--_0x28bbc2){_0x401dbc['push'](_0x401dbc['shift']());}};_0x3b64c3(++_0x536a53);}(_0x6a31,0x172));var _0x16a3=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x6a31[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x16a3('0x0'));var util=require(_0x16a3('0x1'));var path=require(_0x16a3('0x2'));var timeout=require(_0x16a3('0x3'));var express=require(_0x16a3('0x4'));var router=express[_0x16a3('0x5')]();var auth=require(_0x16a3('0x6'));var interaction=require(_0x16a3('0x7'));var config=require(_0x16a3('0x8'));var controller=require(_0x16a3('0x9'));router[_0x16a3('0xa')]('/',auth[_0x16a3('0xb')](),controller[_0x16a3('0xc')]);router[_0x16a3('0xa')](_0x16a3('0xd'),auth[_0x16a3('0xb')](),controller[_0x16a3('0xe')]);router['get'](_0x16a3('0xf'),auth['isAuthenticated'](),controller[_0x16a3('0x10')]);router[_0x16a3('0xa')]('/:id/fields',auth[_0x16a3('0xb')](),controller[_0x16a3('0x11')]);router[_0x16a3('0x12')]('/',auth[_0x16a3('0xb')](),controller['create']);router[_0x16a3('0x12')](_0x16a3('0xf'),auth[_0x16a3('0xb')](),controller['addConfiguration']);router[_0x16a3('0x13')](_0x16a3('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x16a3('0x14')]('/:id',auth[_0x16a3('0xb')](),controller[_0x16a3('0x15')]);module[_0x16a3('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 c2adf05..3e89485 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 _0x33af=['exports','STRING','username','remoteUri'];(function(_0x389089,_0x2e82fc){var _0x4f170c=function(_0x4c7b5b){while(--_0x4c7b5b){_0x389089['push'](_0x389089['shift']());}};_0x4f170c(++_0x2e82fc);}(_0x33af,0xec));var _0xf33a=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x33af[_0x30faee];return _0x3a90ab;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf33a('0x1')]},'username':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x2')},'apiKey':{'type':Sequelize[_0xf33a('0x1')]},'remoteUri':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa848=['STRING','username','remoteUri','sequelize','exports'];(function(_0x48d139,_0x53a2b5){var _0x13508d=function(_0x437f88){while(--_0x437f88){_0x48d139['push'](_0x48d139['shift']());}};_0x13508d(++_0x53a2b5);}(_0xa848,0x99));var _0x8a84=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa848[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x8a84('0x0'));module[_0x8a84('0x1')]={'name':{'type':Sequelize[_0x8a84('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8a84('0x2')],'unique':_0x8a84('0x3')},'apiKey':{'type':Sequelize[_0x8a84('0x2')]},'remoteUri':{'type':Sequelize[_0x8a84('0x2')],'unique':_0x8a84('0x4')},'serverUrl':{'type':Sequelize[_0x8a84('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 863d8aa..7e1bbdf 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 _0xedae=['Content-Range','json','save','update','destroy','stack','name','send','map','FreshsalesAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','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','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','count','offset','limit','set'];(function(_0x237fd1,_0x4fb2da){var _0x3585c2=function(_0x344efa){while(--_0x344efa){_0x237fd1['push'](_0x237fd1['shift']());}};_0x3585c2(++_0x4fb2da);}(_0xedae,0x180));var _0xeeda=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xedae[_0x5b561d];return _0x431060;};'use strict';var pdf=require(_0xeeda('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeeda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeeda('0x2'));var rp=require('request-promise');var moment=require(_0xeeda('0x3'));var BPromise=require(_0xeeda('0x4'));var Mustache=require(_0xeeda('0x5'));var util=require('util');var path=require(_0xeeda('0x6'));var sox=require(_0xeeda('0x7'));var csv=require('to-csv');var ejs=require(_0xeeda('0x8'));var fs=require('fs');var _=require(_0xeeda('0x9'));var squel=require(_0xeeda('0xa'));var crypto=require(_0xeeda('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeeda('0xc'));var toCsv=require(_0xeeda('0xd'));var querystring=require(_0xeeda('0xe'));var Papa=require('papaparse');var Redis=require(_0xeeda('0xf'));var authService=require(_0xeeda('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeeda('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeeda('0x12'))(_0xeeda('0x13'));var utils=require(_0xeeda('0x14'));var config=require(_0xeeda('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeeda('0x16'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeeda('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2bcf3f,_0x1352c9,_0xbeedcd){if(_0xbeedcd){var _0x28ee49=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28ee49[_0xeeda('0x18')](_0x1352c9)){return _0x2bcf3f;}else{throw new db[(_0xeeda('0x19'))][(_0xeeda('0x1a'))](_0xeeda('0x1b'));}}else{return _0x2bcf3f;}}function respondWithRpcPromise(_0x920433,_0x284519,_0xbf4ded,_0x37e13b){return new BPromise(function(_0x3ac3bb,_0x474de0){var _0x24ad4f=_0x37e13b||client;return _0x24ad4f[_0xeeda('0x1c')](_0x920433,_0xbf4ded)[_0xeeda('0x1d')](function(_0x3a4583){logger[_0xeeda('0x1e')](_0xeeda('0x1f'),_0x284519,_0xeeda('0x20'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x284519,'request\x20sent',JSON['stringify'](_0x3a4583));if(_0x3a4583[_0xeeda('0x21')]){if(_0x3a4583['error'][_0xeeda('0x22')]===0x1f4){logger[_0xeeda('0x21')](_0xeeda('0x1f'),_0x284519,_0x3a4583[_0xeeda('0x21')][_0xeeda('0x23')]);return _0x474de0(_0x3a4583[_0xeeda('0x21')][_0xeeda('0x23')]);}logger[_0xeeda('0x21')](_0xeeda('0x1f'),_0x284519,_0x3a4583[_0xeeda('0x21')][_0xeeda('0x23')]);return _0x3ac3bb(_0x3a4583[_0xeeda('0x21')][_0xeeda('0x23')]);}else{logger[_0xeeda('0x1e')](_0xeeda('0x1f'),_0x284519,'request\x20sent');_0x3ac3bb(_0x3a4583['result']['message']);}})[_0xeeda('0x24')](function(_0x42ca8a){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x284519,_0x42ca8a);_0x474de0(_0x42ca8a);});});}function respondWithStatusCode(_0x446b5a,_0x2a68da){_0x2a68da=_0x2a68da||0xcc;return function(_0x5eabe3){if(_0x5eabe3){return _0x446b5a[_0xeeda('0x25')](_0x2a68da);}return _0x446b5a[_0xeeda('0x26')](_0x2a68da)[_0xeeda('0x27')]();};}function respondWithResult(_0x2cdfb3,_0xf3532f){_0xf3532f=_0xf3532f||0xc8;return function(_0x5c30c6){if(_0x5c30c6){return _0x2cdfb3[_0xeeda('0x26')](_0xf3532f)['json'](_0x5c30c6);}};}function respondWithFilteredResult(_0x148c9e,_0xde604f){return function(_0x88aa5c){if(_0x88aa5c){var _0x42c266=_0x88aa5c[_0xeeda('0x28')],_0x3dfb28=_0xde604f[_0xeeda('0x29')],_0x38ec2a=_0xde604f[_0xeeda('0x29')]+_0xde604f[_0xeeda('0x2a')],_0x17f333;if(_0x38ec2a>=_0x42c266){_0x38ec2a=_0x42c266;_0x17f333=0xc8;}else{_0x17f333=0xce;}_0x148c9e[_0xeeda('0x26')](_0x17f333);return _0x148c9e[_0xeeda('0x2b')](_0xeeda('0x2c'),_0x3dfb28+'-'+_0x38ec2a+'/'+_0x42c266)[_0xeeda('0x2d')](_0x88aa5c);}return null;};}function patchUpdates(_0x52b3ed){return function(_0x442e6c){try{jsonpatch['apply'](_0x442e6c,_0x52b3ed,!![]);}catch(_0x58851f){return BPromise['reject'](_0x58851f);}return _0x442e6c[_0xeeda('0x2e')]();};}function saveUpdates(_0x5df798,_0x4496a6){return function(_0x5a15ca){if(_0x5a15ca){return _0x5a15ca[_0xeeda('0x2f')](_0x5df798)['then'](function(_0x91cd98){return _0x91cd98;});}return null;};}function removeEntity(_0x47a3cd,_0x356bda){return function(_0x42e48d){if(_0x42e48d){return _0x42e48d[_0xeeda('0x30')]()[_0xeeda('0x1d')](function(){_0x47a3cd['status'](0xcc)[_0xeeda('0x27')]();});}};}function handleEntityNotFound(_0x2be935,_0x4db76c){return function(_0x4963e8){if(!_0x4963e8){_0x2be935[_0xeeda('0x25')](0x194);}return _0x4963e8;};}function handleError(_0x2e5f06,_0x4f7c4f){_0x4f7c4f=_0x4f7c4f||0x1f4;return function(_0x530441){logger['error'](_0x530441[_0xeeda('0x31')]);if(_0x530441[_0xeeda('0x32')]){delete _0x530441[_0xeeda('0x32')];}_0x2e5f06[_0xeeda('0x26')](_0x4f7c4f)[_0xeeda('0x33')](_0x530441);};}exports['index']=function(_0x5da4cc,_0x58352c){var _0x2c0fb1={},_0x3e2703={},_0x3c82ed={'count':0x0,'rows':[]};var _0x4db7f2=_[_0xeeda('0x34')](db[_0xeeda('0x35')][_0xeeda('0x36')],function(_0x946280){return{'name':_0x946280['fieldName'],'type':_0x946280[_0xeeda('0x37')][_0xeeda('0x38')]};});_0x3e2703[_0xeeda('0x39')]=_[_0xeeda('0x34')](_0x4db7f2,_0xeeda('0x32'));_0x3e2703[_0xeeda('0x3a')]=_[_0xeeda('0x3b')](_0x5da4cc[_0xeeda('0x3a')]);_0x3e2703[_0xeeda('0x3c')]=_[_0xeeda('0x3d')](_0x3e2703[_0xeeda('0x39')],_0x3e2703[_0xeeda('0x3a')]);_0x2c0fb1[_0xeeda('0x3e')]=_[_0xeeda('0x3d')](_0x3e2703[_0xeeda('0x39')],qs[_0xeeda('0x3f')](_0x5da4cc[_0xeeda('0x3a')][_0xeeda('0x3f')]));_0x2c0fb1[_0xeeda('0x3e')]=_0x2c0fb1['attributes'][_0xeeda('0x40')]?_0x2c0fb1[_0xeeda('0x3e')]:_0x3e2703[_0xeeda('0x39')];if(!_0x5da4cc['query'][_0xeeda('0x41')](_0xeeda('0x42'))){_0x2c0fb1[_0xeeda('0x2a')]=qs[_0xeeda('0x2a')](_0x5da4cc[_0xeeda('0x3a')][_0xeeda('0x2a')]);_0x2c0fb1['offset']=qs['offset'](_0x5da4cc[_0xeeda('0x3a')][_0xeeda('0x29')]);}_0x2c0fb1[_0xeeda('0x43')]=qs[_0xeeda('0x44')](_0x5da4cc[_0xeeda('0x3a')][_0xeeda('0x44')]);_0x2c0fb1[_0xeeda('0x45')]=qs[_0xeeda('0x3c')](_[_0xeeda('0x46')](_0x5da4cc[_0xeeda('0x3a')],_0x3e2703[_0xeeda('0x3c')]),_0x4db7f2);if(_0x5da4cc[_0xeeda('0x3a')][_0xeeda('0x47')]){_0x2c0fb1['where']=_[_0xeeda('0x48')](_0x2c0fb1[_0xeeda('0x45')],{'$or':_[_0xeeda('0x34')](_0x4db7f2,function(_0x16023f){if(_0x16023f[_0xeeda('0x37')]!=='VIRTUAL'){var _0x45189d={};_0x45189d[_0x16023f[_0xeeda('0x32')]]={'$like':'%'+_0x5da4cc[_0xeeda('0x3a')][_0xeeda('0x47')]+'%'};return _0x45189d;}})});}_0x2c0fb1=_[_0xeeda('0x48')]({},_0x2c0fb1,_0x5da4cc[_0xeeda('0x49')]);var _0x52a7e1={'where':_0x2c0fb1[_0xeeda('0x45')]};return db[_0xeeda('0x35')]['count'](_0x52a7e1)[_0xeeda('0x1d')](function(_0x3ee45c){_0x3c82ed['count']=_0x3ee45c;if(_0x5da4cc[_0xeeda('0x3a')][_0xeeda('0x4a')]){_0x2c0fb1[_0xeeda('0x4b')]=[{'all':!![]}];}return db[_0xeeda('0x35')]['findAll'](_0x2c0fb1);})[_0xeeda('0x1d')](function(_0x24336){_0x3c82ed[_0xeeda('0x4c')]=_0x24336;return _0x3c82ed;})['then'](respondWithFilteredResult(_0x58352c,_0x2c0fb1))[_0xeeda('0x24')](handleError(_0x58352c,null));};exports[_0xeeda('0x4d')]=function(_0x19bc30,_0xccde87){var _0x87e378={'raw':![],'where':{'id':_0x19bc30[_0xeeda('0x4e')]['id']}},_0x29d98a={};_0x29d98a[_0xeeda('0x39')]=_[_0xeeda('0x3b')](db[_0xeeda('0x35')][_0xeeda('0x36')]);_0x29d98a[_0xeeda('0x3a')]=_[_0xeeda('0x3b')](_0x19bc30[_0xeeda('0x3a')]);_0x29d98a['filters']=_[_0xeeda('0x3d')](_0x29d98a['model'],_0x29d98a['query']);_0x87e378[_0xeeda('0x3e')]=_[_0xeeda('0x3d')](_0x29d98a[_0xeeda('0x39')],qs[_0xeeda('0x3f')](_0x19bc30[_0xeeda('0x3a')][_0xeeda('0x3f')]));_0x87e378['attributes']=_0x87e378[_0xeeda('0x3e')]['length']?_0x87e378['attributes']:_0x29d98a['model'];if(_0x19bc30[_0xeeda('0x3a')][_0xeeda('0x4a')]){_0x87e378[_0xeeda('0x4b')]=[{'all':!![]}];}_0x87e378=_[_0xeeda('0x48')]({},_0x87e378,_0x19bc30['options']);return db[_0xeeda('0x35')][_0xeeda('0x4f')](_0x87e378)['then'](handleEntityNotFound(_0xccde87,null))['then'](respondWithResult(_0xccde87,null))[_0xeeda('0x24')](handleError(_0xccde87,null));};exports[_0xeeda('0x50')]=function(_0x100fa0,_0x47d17d){return db[_0xeeda('0x35')]['create'](_0x100fa0['body'],{})['then'](respondWithResult(_0x47d17d,0xc9))[_0xeeda('0x24')](handleError(_0x47d17d,null));};exports[_0xeeda('0x2f')]=function(_0x4e9382,_0x1730d0){if(_0x4e9382['body']['id']){delete _0x4e9382['body']['id'];}return db['FreshsalesAccount'][_0xeeda('0x4f')]({'where':{'id':_0x4e9382['params']['id']}})[_0xeeda('0x1d')](handleEntityNotFound(_0x1730d0,null))[_0xeeda('0x1d')](saveUpdates(_0x4e9382[_0xeeda('0x51')],null))[_0xeeda('0x1d')](respondWithResult(_0x1730d0,null))[_0xeeda('0x24')](handleError(_0x1730d0,null));};exports[_0xeeda('0x30')]=function(_0x3479a4,_0xd068e4){return db[_0xeeda('0x35')][_0xeeda('0x4f')]({'where':{'id':_0x3479a4[_0xeeda('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd068e4,null))[_0xeeda('0x1d')](removeEntity(_0xd068e4,null))[_0xeeda('0x24')](handleError(_0xd068e4,null));};exports[_0xeeda('0x52')]=function(_0x368b2f,_0x28e464,_0xc16a4c){var _0x10c044={};var _0x30e215={};var _0x17aeb5;var _0x3030fc;return db['FreshsalesAccount'][_0xeeda('0x53')]({'where':{'id':_0x368b2f[_0xeeda('0x4e')]['id']}})[_0xeeda('0x1d')](handleEntityNotFound(_0x28e464,null))[_0xeeda('0x1d')](function(_0x505a34){if(_0x505a34){_0x17aeb5=_0x505a34;_0x30e215[_0xeeda('0x39')]=_[_0xeeda('0x3b')](db[_0xeeda('0x54')][_0xeeda('0x36')]);_0x30e215['query']=_[_0xeeda('0x3b')](_0x368b2f[_0xeeda('0x3a')]);_0x30e215[_0xeeda('0x3c')]=_[_0xeeda('0x3d')](_0x30e215[_0xeeda('0x39')],_0x30e215[_0xeeda('0x3a')]);_0x10c044[_0xeeda('0x3e')]=_[_0xeeda('0x3d')](_0x30e215[_0xeeda('0x39')],qs[_0xeeda('0x3f')](_0x368b2f[_0xeeda('0x3a')][_0xeeda('0x3f')]));_0x10c044['attributes']=_0x10c044['attributes'][_0xeeda('0x40')]?_0x10c044[_0xeeda('0x3e')]:_0x30e215[_0xeeda('0x39')];_0x10c044['order']=qs[_0xeeda('0x44')](_0x368b2f[_0xeeda('0x3a')][_0xeeda('0x44')]);_0x10c044['where']=qs[_0xeeda('0x3c')](_[_0xeeda('0x46')](_0x368b2f[_0xeeda('0x3a')],_0x30e215[_0xeeda('0x3c')]));if(_0x368b2f['query'][_0xeeda('0x47')]){_0x10c044['where']=_[_0xeeda('0x48')](_0x10c044[_0xeeda('0x45')],{'$or':_[_0xeeda('0x34')](_0x10c044[_0xeeda('0x3e')],function(_0x886b43){var _0x38c4e1={};_0x38c4e1[_0x886b43]={'$like':'%'+_0x368b2f[_0xeeda('0x3a')]['filter']+'%'};return _0x38c4e1;})});}_0x10c044=_[_0xeeda('0x48')]({},_0x10c044,_0x368b2f['options']);return _0x17aeb5[_0xeeda('0x52')](_0x10c044);}})[_0xeeda('0x1d')](function(_0x2317fd){if(_0x2317fd){_0x3030fc=_0x2317fd[_0xeeda('0x40')];if(!_0x368b2f['query']['hasOwnProperty'](_0xeeda('0x42'))){_0x10c044[_0xeeda('0x2a')]=qs['limit'](_0x368b2f[_0xeeda('0x3a')][_0xeeda('0x2a')]);_0x10c044['offset']=qs[_0xeeda('0x29')](_0x368b2f[_0xeeda('0x3a')][_0xeeda('0x29')]);}return _0x17aeb5[_0xeeda('0x52')](_0x10c044);}})[_0xeeda('0x1d')](function(_0x393738){if(_0x393738){return _0x393738?{'count':_0x3030fc,'rows':_0x393738}:null;}})['then'](respondWithResult(_0x28e464,null))['catch'](handleError(_0x28e464,null));};exports[_0xeeda('0x55')]=function(_0x5cecf8,_0x4d82a0,_0x1bd352){if(_0x5cecf8[_0xeeda('0x51')]['id']){delete _0x5cecf8[_0xeeda('0x51')]['id'];}return db[_0xeeda('0x35')][_0xeeda('0x53')]({'where':{'id':_0x5cecf8[_0xeeda('0x4e')]['id']}})[_0xeeda('0x1d')](handleEntityNotFound(_0x4d82a0,null))['then'](function(_0x24ea4f){if(_0x24ea4f){_0x5cecf8[_0xeeda('0x51')][_0xeeda('0x56')]=_0x24ea4f['id'];_0x5cecf8[_0xeeda('0x51')][_0xeeda('0x57')]=integrations[_0xeeda('0x58')](_0x5cecf8[_0xeeda('0x51')][_0xeeda('0x59')],_0x5cecf8[_0xeeda('0x51')][_0xeeda('0x37')]);_0x5cecf8[_0xeeda('0x51')][_0xeeda('0x5a')]=integrations[_0xeeda('0x5b')](_0x5cecf8['body'][_0xeeda('0x59')],_0x5cecf8[_0xeeda('0x51')]['type']);return db['FreshsalesConfiguration'][_0xeeda('0x50')](_0x5cecf8[_0xeeda('0x51')],{'include':[{'model':db[_0xeeda('0x5c')],'as':_0xeeda('0x57')},{'model':db[_0xeeda('0x5c')],'as':'Descriptions'}]});}return null;})[_0xeeda('0x1d')](respondWithResult(_0x4d82a0,null))[_0xeeda('0x24')](handleError(_0x4d82a0,null));};exports[_0xeeda('0x5d')]=function(_0x5c90d2,_0x1da621,_0x20cafd){var _0x27bde2='';var _0x5845eb='';return db[_0xeeda('0x35')][_0xeeda('0x53')]({'where':{'id':_0x5c90d2[_0xeeda('0x4e')]['id']},'attributes':['id',_0xeeda('0x5e'),_0xeeda('0x5f'),_0xeeda('0x60')]})[_0xeeda('0x1d')](handleEntityNotFound(_0x1da621,null))[_0xeeda('0x1d')](function(_0x177679){if(_0x177679){_0x5845eb=_0x177679[_0xeeda('0x5e')];_0x27bde2=_0x177679['remoteUri'];var _0x345078=_0x177679[_0xeeda('0x5f')][_0xeeda('0x61')](-0x1);if(_0x345078==='/'){_0x27bde2=_0x27bde2[_0xeeda('0x62')](0x0,_0x27bde2['lastIndexOf'](_0x345078));}return rp({'method':_0xeeda('0x63'),'uri':util['format']('%s%s',_0x27bde2,_0xeeda('0x64')),'headers':{'Authorization':_0xeeda('0x65')+_0x177679[_0xeeda('0x60')]},'json':!![]});}})[_0xeeda('0x1d')](function(_0xd58280){if(_0xd58280){var _0x3bf640=_0xd58280['users'];var _0x253ff4=![];var _0x5e2934=null;for(_0x5e2934=0x0;_0x5e2934<_0x3bf640[_0xeeda('0x40')];_0x5e2934++){if(_0x3bf640[_0x5e2934][_0xeeda('0x66')]===_0x5845eb){_0x253ff4=!![];}}if(_0x253ff4){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xeeda('0x67')});}}})['then'](respondWithResult(_0x1da621,null))[_0xeeda('0x24')](function(_0xf372a6){var _0x41752a=_0x5c90d2['query'][_0xeeda('0x18')]?0x1f4:_0xf372a6[_0xeeda('0x68')]||0x1f4;logger[_0xeeda('0x21')](_0xeeda('0x69'),_0xeeda('0x5d'),_0x41752a,JSON['stringify'](_0xf372a6));delete _0xf372a6[_0xeeda('0x32')];if(_0x41752a===0x191){_0x41752a=0x190;}_0x1da621[_0xeeda('0x26')](_0x41752a)[_0xeeda('0x33')](_0x5c90d2[_0xeeda('0x3a')][_0xeeda('0x18')]?{'message':_0xeeda('0x6a'),'statusCode':_0xf372a6[_0xeeda('0x68')]}:_0xf372a6);});}; \ No newline at end of file +var _0x1851=['GET','format','/api/selector/owners','Token\x20token=','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','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~!@#$%^&-_=+[{]}.','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','end','status','json','count','offset','limit','set','apply','save','update','then','destroy','sendStatus','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','params','include','options','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','channel','type','Descriptions','getDescriptions','create','FreshsalesField','Subjects','getFields','username','apiKey','remoteUri','slice','lastIndexOf'];(function(_0x2dfe05,_0xc45b75){var _0x456bc6=function(_0x15f5ee){while(--_0x15f5ee){_0x2dfe05['push'](_0x2dfe05['shift']());}};_0x456bc6(++_0xc45b75);}(_0x1851,0x1ae));var _0x1185=function(_0x5370d8,_0x5ae45d){_0x5370d8=_0x5370d8-0x0;var _0x424bfc=_0x1851[_0x5370d8];return _0x424bfc;};'use strict';var pdf=require(_0x1185('0x0'));var emlformat=require(_0x1185('0x1'));var rimraf=require(_0x1185('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1185('0x3'));var rp=require(_0x1185('0x4'));var moment=require('moment');var BPromise=require(_0x1185('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1185('0x6'));var sox=require(_0x1185('0x7'));var csv=require(_0x1185('0x8'));var ejs=require(_0x1185('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1185('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1185('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1185('0xc'));var Papa=require(_0x1185('0xd'));var Redis=require(_0x1185('0xe'));var authService=require(_0x1185('0xf'));var qs=require(_0x1185('0x10'));var as=require(_0x1185('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1185('0x12'));var utils=require('../../config/utils');var config=require(_0x1185('0x13'));var db=require(_0x1185('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1185('0x15'));var client=jayson[_0x1185('0x16')][_0x1185('0x17')]({'port':0x232a});function checkPasswordPattern(_0x531828,_0x2dbc21,_0x28d94a){if(_0x28d94a){var _0x581522=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x581522[_0x1185('0x18')](_0x2dbc21)){return _0x531828;}else{throw new db['Sequelize'][(_0x1185('0x19'))](_0x1185('0x1a'));}}else{return _0x531828;}}function respondWithRpcPromise(_0x254967,_0x4bbd34,_0x5e9d1f,_0x28b32b){return new BPromise(function(_0x16c4db,_0x3bd4f4){var _0x5b65b6=_0x28b32b||client;return _0x5b65b6[_0x1185('0x1b')](_0x254967,_0x5e9d1f)['then'](function(_0x34b584){logger['info'](_0x1185('0x1c'),_0x4bbd34,_0x1185('0x1d'));logger['debug'](_0x1185('0x1e'),_0x4bbd34,_0x1185('0x1d'),JSON[_0x1185('0x1f')](_0x34b584));if(_0x34b584['error']){if(_0x34b584[_0x1185('0x20')]['code']===0x1f4){logger[_0x1185('0x20')](_0x1185('0x1c'),_0x4bbd34,_0x34b584[_0x1185('0x20')][_0x1185('0x21')]);return _0x3bd4f4(_0x34b584[_0x1185('0x20')]['message']);}logger[_0x1185('0x20')](_0x1185('0x1c'),_0x4bbd34,_0x34b584[_0x1185('0x20')][_0x1185('0x21')]);return _0x16c4db(_0x34b584[_0x1185('0x20')]['message']);}else{logger[_0x1185('0x22')](_0x1185('0x1c'),_0x4bbd34,_0x1185('0x1d'));_0x16c4db(_0x34b584[_0x1185('0x23')]['message']);}})['catch'](function(_0xbb6f77){logger[_0x1185('0x20')]('FreshsalesAccount,\x20%s,\x20%s',_0x4bbd34,_0xbb6f77);_0x3bd4f4(_0xbb6f77);});});}function respondWithStatusCode(_0x4f72f1,_0x949f50){_0x949f50=_0x949f50||0xcc;return function(_0x54189e){if(_0x54189e){return _0x4f72f1['sendStatus'](_0x949f50);}return _0x4f72f1['status'](_0x949f50)[_0x1185('0x24')]();};}function respondWithResult(_0x5ca7b5,_0x4b94ef){_0x4b94ef=_0x4b94ef||0xc8;return function(_0x4aee08){if(_0x4aee08){return _0x5ca7b5[_0x1185('0x25')](_0x4b94ef)[_0x1185('0x26')](_0x4aee08);}};}function respondWithFilteredResult(_0x5fe507,_0x3fc209){return function(_0x19eb86){if(_0x19eb86){var _0xda75e3=_0x19eb86[_0x1185('0x27')],_0x5ba18f=_0x3fc209[_0x1185('0x28')],_0x151874=_0x3fc209['offset']+_0x3fc209[_0x1185('0x29')],_0x4cfdf4;if(_0x151874>=_0xda75e3){_0x151874=_0xda75e3;_0x4cfdf4=0xc8;}else{_0x4cfdf4=0xce;}_0x5fe507[_0x1185('0x25')](_0x4cfdf4);return _0x5fe507[_0x1185('0x2a')]('Content-Range',_0x5ba18f+'-'+_0x151874+'/'+_0xda75e3)['json'](_0x19eb86);}return null;};}function patchUpdates(_0x5db83d){return function(_0x38aa25){try{jsonpatch[_0x1185('0x2b')](_0x38aa25,_0x5db83d,!![]);}catch(_0x3a6cb2){return BPromise['reject'](_0x3a6cb2);}return _0x38aa25[_0x1185('0x2c')]();};}function saveUpdates(_0x596b39,_0x5557af){return function(_0x3ae00c){if(_0x3ae00c){return _0x3ae00c[_0x1185('0x2d')](_0x596b39)[_0x1185('0x2e')](function(_0xe47976){return _0xe47976;});}return null;};}function removeEntity(_0x1c4b1d,_0x2f2bd5){return function(_0x27d37b){if(_0x27d37b){return _0x27d37b[_0x1185('0x2f')]()['then'](function(){_0x1c4b1d[_0x1185('0x25')](0xcc)[_0x1185('0x24')]();});}};}function handleEntityNotFound(_0x1e88ed,_0x182a2f){return function(_0x1df44f){if(!_0x1df44f){_0x1e88ed[_0x1185('0x30')](0x194);}return _0x1df44f;};}function handleError(_0x2f68f3,_0x5f04ad){_0x5f04ad=_0x5f04ad||0x1f4;return function(_0x1aacc0){logger[_0x1185('0x20')](_0x1aacc0[_0x1185('0x31')]);if(_0x1aacc0[_0x1185('0x32')]){delete _0x1aacc0[_0x1185('0x32')];}_0x2f68f3[_0x1185('0x25')](_0x5f04ad)[_0x1185('0x33')](_0x1aacc0);};}exports[_0x1185('0x34')]=function(_0x43c206,_0x598168){var _0x46ab3a={},_0x77b0d4={},_0xb6dba0={'count':0x0,'rows':[]};var _0x36dca2=_['map'](db[_0x1185('0x35')][_0x1185('0x36')],function(_0x1ccb49){return{'name':_0x1ccb49[_0x1185('0x37')],'type':_0x1ccb49['type'][_0x1185('0x38')]};});_0x77b0d4[_0x1185('0x39')]=_[_0x1185('0x3a')](_0x36dca2,_0x1185('0x32'));_0x77b0d4[_0x1185('0x3b')]=_[_0x1185('0x3c')](_0x43c206[_0x1185('0x3b')]);_0x77b0d4[_0x1185('0x3d')]=_[_0x1185('0x3e')](_0x77b0d4[_0x1185('0x39')],_0x77b0d4[_0x1185('0x3b')]);_0x46ab3a[_0x1185('0x3f')]=_[_0x1185('0x3e')](_0x77b0d4[_0x1185('0x39')],qs[_0x1185('0x40')](_0x43c206[_0x1185('0x3b')][_0x1185('0x40')]));_0x46ab3a[_0x1185('0x3f')]=_0x46ab3a[_0x1185('0x3f')][_0x1185('0x41')]?_0x46ab3a[_0x1185('0x3f')]:_0x77b0d4['model'];if(!_0x43c206[_0x1185('0x3b')][_0x1185('0x42')](_0x1185('0x43'))){_0x46ab3a[_0x1185('0x29')]=qs[_0x1185('0x29')](_0x43c206[_0x1185('0x3b')][_0x1185('0x29')]);_0x46ab3a[_0x1185('0x28')]=qs[_0x1185('0x28')](_0x43c206[_0x1185('0x3b')][_0x1185('0x28')]);}_0x46ab3a[_0x1185('0x44')]=qs[_0x1185('0x45')](_0x43c206[_0x1185('0x3b')]['sort']);_0x46ab3a[_0x1185('0x46')]=qs[_0x1185('0x3d')](_['pick'](_0x43c206['query'],_0x77b0d4[_0x1185('0x3d')]),_0x36dca2);if(_0x43c206[_0x1185('0x3b')][_0x1185('0x47')]){_0x46ab3a[_0x1185('0x46')]=_[_0x1185('0x48')](_0x46ab3a[_0x1185('0x46')],{'$or':_['map'](_0x36dca2,function(_0x3a9105){if(_0x3a9105['type']!=='VIRTUAL'){var _0x305e8a={};_0x305e8a[_0x3a9105[_0x1185('0x32')]]={'$like':'%'+_0x43c206['query']['filter']+'%'};return _0x305e8a;}})});}_0x46ab3a=_[_0x1185('0x48')]({},_0x46ab3a,_0x43c206['options']);var _0x522aec={'where':_0x46ab3a[_0x1185('0x46')]};return db[_0x1185('0x35')][_0x1185('0x27')](_0x522aec)[_0x1185('0x2e')](function(_0x1d7e45){_0xb6dba0[_0x1185('0x27')]=_0x1d7e45;if(_0x43c206[_0x1185('0x3b')][_0x1185('0x49')]){_0x46ab3a['include']=[{'all':!![]}];}return db[_0x1185('0x35')][_0x1185('0x4a')](_0x46ab3a);})[_0x1185('0x2e')](function(_0x13680a){_0xb6dba0[_0x1185('0x4b')]=_0x13680a;return _0xb6dba0;})['then'](respondWithFilteredResult(_0x598168,_0x46ab3a))[_0x1185('0x4c')](handleError(_0x598168,null));};exports['show']=function(_0x35347a,_0x1321cf){var _0x22c414={'raw':![],'where':{'id':_0x35347a[_0x1185('0x4d')]['id']}},_0x24d05e={};_0x24d05e[_0x1185('0x39')]=_[_0x1185('0x3c')](db[_0x1185('0x35')][_0x1185('0x36')]);_0x24d05e['query']=_[_0x1185('0x3c')](_0x35347a[_0x1185('0x3b')]);_0x24d05e[_0x1185('0x3d')]=_[_0x1185('0x3e')](_0x24d05e[_0x1185('0x39')],_0x24d05e[_0x1185('0x3b')]);_0x22c414[_0x1185('0x3f')]=_['intersection'](_0x24d05e[_0x1185('0x39')],qs['fields'](_0x35347a[_0x1185('0x3b')]['fields']));_0x22c414[_0x1185('0x3f')]=_0x22c414['attributes']['length']?_0x22c414['attributes']:_0x24d05e[_0x1185('0x39')];if(_0x35347a[_0x1185('0x3b')]['includeAll']){_0x22c414[_0x1185('0x4e')]=[{'all':!![]}];}_0x22c414=_[_0x1185('0x48')]({},_0x22c414,_0x35347a[_0x1185('0x4f')]);return db[_0x1185('0x35')]['find'](_0x22c414)[_0x1185('0x2e')](handleEntityNotFound(_0x1321cf,null))['then'](respondWithResult(_0x1321cf,null))[_0x1185('0x4c')](handleError(_0x1321cf,null));};exports['create']=function(_0x51f769,_0x3760f8){return db[_0x1185('0x35')]['create'](_0x51f769[_0x1185('0x50')],{})[_0x1185('0x2e')](respondWithResult(_0x3760f8,0xc9))[_0x1185('0x4c')](handleError(_0x3760f8,null));};exports[_0x1185('0x2d')]=function(_0x372f4c,_0x5c78b2){if(_0x372f4c[_0x1185('0x50')]['id']){delete _0x372f4c['body']['id'];}return db[_0x1185('0x35')][_0x1185('0x51')]({'where':{'id':_0x372f4c[_0x1185('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c78b2,null))['then'](saveUpdates(_0x372f4c[_0x1185('0x50')],null))[_0x1185('0x2e')](respondWithResult(_0x5c78b2,null))[_0x1185('0x4c')](handleError(_0x5c78b2,null));};exports['destroy']=function(_0x19e694,_0x20e441){return db[_0x1185('0x35')][_0x1185('0x51')]({'where':{'id':_0x19e694[_0x1185('0x4d')]['id']}})[_0x1185('0x2e')](handleEntityNotFound(_0x20e441,null))[_0x1185('0x2e')](removeEntity(_0x20e441,null))[_0x1185('0x4c')](handleError(_0x20e441,null));};exports[_0x1185('0x52')]=function(_0x2fa269,_0x5e8c03,_0x54ba3a){var _0x1b870d={};var _0x1a2744={};var _0x1a9a68;var _0x45fa69;return db[_0x1185('0x35')][_0x1185('0x53')]({'where':{'id':_0x2fa269[_0x1185('0x4d')]['id']}})[_0x1185('0x2e')](handleEntityNotFound(_0x5e8c03,null))[_0x1185('0x2e')](function(_0x36cc55){if(_0x36cc55){_0x1a9a68=_0x36cc55;_0x1a2744['model']=_[_0x1185('0x3c')](db[_0x1185('0x54')][_0x1185('0x36')]);_0x1a2744[_0x1185('0x3b')]=_[_0x1185('0x3c')](_0x2fa269[_0x1185('0x3b')]);_0x1a2744[_0x1185('0x3d')]=_['intersection'](_0x1a2744[_0x1185('0x39')],_0x1a2744[_0x1185('0x3b')]);_0x1b870d[_0x1185('0x3f')]=_[_0x1185('0x3e')](_0x1a2744[_0x1185('0x39')],qs['fields'](_0x2fa269['query']['fields']));_0x1b870d[_0x1185('0x3f')]=_0x1b870d[_0x1185('0x3f')]['length']?_0x1b870d[_0x1185('0x3f')]:_0x1a2744[_0x1185('0x39')];_0x1b870d[_0x1185('0x44')]=qs[_0x1185('0x45')](_0x2fa269[_0x1185('0x3b')][_0x1185('0x45')]);_0x1b870d[_0x1185('0x46')]=qs[_0x1185('0x3d')](_['pick'](_0x2fa269[_0x1185('0x3b')],_0x1a2744[_0x1185('0x3d')]));if(_0x2fa269['query'][_0x1185('0x47')]){_0x1b870d[_0x1185('0x46')]=_[_0x1185('0x48')](_0x1b870d[_0x1185('0x46')],{'$or':_['map'](_0x1b870d[_0x1185('0x3f')],function(_0xc422a6){var _0x3cb5cb={};_0x3cb5cb[_0xc422a6]={'$like':'%'+_0x2fa269[_0x1185('0x3b')]['filter']+'%'};return _0x3cb5cb;})});}_0x1b870d=_[_0x1185('0x48')]({},_0x1b870d,_0x2fa269[_0x1185('0x4f')]);return _0x1a9a68[_0x1185('0x52')](_0x1b870d);}})[_0x1185('0x2e')](function(_0x182b3d){if(_0x182b3d){_0x45fa69=_0x182b3d[_0x1185('0x41')];if(!_0x2fa269['query']['hasOwnProperty'](_0x1185('0x43'))){_0x1b870d[_0x1185('0x29')]=qs[_0x1185('0x29')](_0x2fa269[_0x1185('0x3b')][_0x1185('0x29')]);_0x1b870d[_0x1185('0x28')]=qs['offset'](_0x2fa269['query']['offset']);}return _0x1a9a68['getConfigurations'](_0x1b870d);}})['then'](function(_0x3af16d){if(_0x3af16d){return _0x3af16d?{'count':_0x45fa69,'rows':_0x3af16d}:null;}})[_0x1185('0x2e')](respondWithResult(_0x5e8c03,null))[_0x1185('0x4c')](handleError(_0x5e8c03,null));};exports[_0x1185('0x55')]=function(_0x3f9745,_0x58119a,_0x37daa0){if(_0x3f9745['body']['id']){delete _0x3f9745[_0x1185('0x50')]['id'];}return db[_0x1185('0x35')][_0x1185('0x53')]({'where':{'id':_0x3f9745[_0x1185('0x4d')]['id']}})[_0x1185('0x2e')](handleEntityNotFound(_0x58119a,null))['then'](function(_0x558699){if(_0x558699){_0x3f9745['body'][_0x1185('0x56')]=_0x558699['id'];_0x3f9745[_0x1185('0x50')]['Subjects']=integrations['getSubjects'](_0x3f9745[_0x1185('0x50')][_0x1185('0x57')],_0x3f9745['body'][_0x1185('0x58')]);_0x3f9745[_0x1185('0x50')][_0x1185('0x59')]=integrations[_0x1185('0x5a')](_0x3f9745[_0x1185('0x50')][_0x1185('0x57')],_0x3f9745[_0x1185('0x50')][_0x1185('0x58')]);return db['FreshsalesConfiguration'][_0x1185('0x5b')](_0x3f9745['body'],{'include':[{'model':db[_0x1185('0x5c')],'as':_0x1185('0x5d')},{'model':db[_0x1185('0x5c')],'as':_0x1185('0x59')}]});}return null;})['then'](respondWithResult(_0x58119a,null))[_0x1185('0x4c')](handleError(_0x58119a,null));};exports[_0x1185('0x5e')]=function(_0x3b672a,_0x13577d,_0x4a46c8){var _0x3a3a4e='';var _0x3cf569='';return db[_0x1185('0x35')][_0x1185('0x53')]({'where':{'id':_0x3b672a[_0x1185('0x4d')]['id']},'attributes':['id',_0x1185('0x5f'),'remoteUri',_0x1185('0x60')]})[_0x1185('0x2e')](handleEntityNotFound(_0x13577d,null))[_0x1185('0x2e')](function(_0xddf41f){if(_0xddf41f){_0x3cf569=_0xddf41f['username'];_0x3a3a4e=_0xddf41f[_0x1185('0x61')];var _0x3909ec=_0xddf41f[_0x1185('0x61')][_0x1185('0x62')](-0x1);if(_0x3909ec==='/'){_0x3a3a4e=_0x3a3a4e['substring'](0x0,_0x3a3a4e[_0x1185('0x63')](_0x3909ec));}return rp({'method':_0x1185('0x64'),'uri':util[_0x1185('0x65')]('%s%s',_0x3a3a4e,_0x1185('0x66')),'headers':{'Authorization':_0x1185('0x67')+_0xddf41f[_0x1185('0x60')]},'json':!![]});}})[_0x1185('0x2e')](function(_0x572fb8){if(_0x572fb8){var _0x349bbb=_0x572fb8['users'];var _0x1842ce=![];var _0x38a859=null;for(_0x38a859=0x0;_0x38a859<_0x349bbb['length'];_0x38a859++){if(_0x349bbb[_0x38a859]['email']===_0x3cf569){_0x1842ce=!![];}}if(_0x1842ce){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x1185('0x2e')](respondWithResult(_0x13577d,null))[_0x1185('0x4c')](function(_0x41e503){var _0x526e34=_0x3b672a[_0x1185('0x3b')][_0x1185('0x18')]?0x1f4:_0x41e503[_0x1185('0x68')]||0x1f4;logger[_0x1185('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x1185('0x5e'),_0x526e34,JSON[_0x1185('0x1f')](_0x41e503));delete _0x41e503[_0x1185('0x32')];if(_0x526e34===0x191){_0x526e34=0x190;}_0x13577d[_0x1185('0x25')](_0x526e34)[_0x1185('0x33')](_0x3b672a[_0x1185('0x3b')][_0x1185('0x18')]?{'message':_0x1185('0x69'),'statusCode':_0x41e503[_0x1185('0x68')]}:_0x41e503);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 673a226..8d1af14 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x9a19,0x114));var _0x99a1=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x9a19[_0x5d07ff];return _0x5226ad;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));var integrations=require(_0x99a1('0xa'));module[_0x99a1('0xb')]=function(_0xff0240,_0x65045d){return _0xff0240['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56e7=['exports','define','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x14ad71,_0x5cff4d){var _0x33ebc9=function(_0x45efc3){while(--_0x45efc3){_0x14ad71['push'](_0x14ad71['shift']());}};_0x33ebc9(++_0x5cff4d);}(_0x56e7,0x7b));var _0x756e=function(_0x3aaa5a,_0x413a5b){_0x3aaa5a=_0x3aaa5a-0x0;var _0x5617c6=_0x56e7[_0x3aaa5a];return _0x5617c6;};'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'));var integrations=require('../../components/integrations/configuration');module[_0x756e('0x9')]=function(_0x404189,_0x26519d){return _0x404189[_0x756e('0xa')]('FreshsalesAccount',attributes,{'tableName':_0x756e('0xb'),'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 354f66b..7900474 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 _0x627e=['request','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','findAll','raw','options','where','map','model','attributes','include','then','debug','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x627e,0x14a));var _0xe627=function(_0x3f2d82,_0x85323b){_0x3f2d82=_0x3f2d82-0x0;var _0x294c63=_0x627e[_0x3f2d82];return _0x294c63;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});}exports[_0xe627('0x14')]=function(_0x56559b){var _0x2fe46a=this;return new Promise(function(_0x538b22,_0x24fddd){return db['FreshsalesAccount'][_0xe627('0x15')]({'raw':_0x56559b['options']?_0x56559b['options'][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x56559b['options']?_0x56559b[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x56559b['options']?_0x56559b['options']['attributes']||null:null,'limit':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['limit']||null:null,'include':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['include']?_[_0xe627('0x19')](_0x56559b[_0xe627('0x17')]['include'],function(_0x42f3d1){return{'model':db[_0x42f3d1[_0xe627('0x1a')]],'as':_0x42f3d1['as'],'attributes':_0x42f3d1[_0xe627('0x1b')],'include':_0x42f3d1['include']?_[_0xe627('0x19')](_0x42f3d1[_0xe627('0x1c')],function(_0x1a5081){return{'model':db[_0x1a5081[_0xe627('0x1a')]],'as':_0x1a5081['as'],'attributes':_0x1a5081['attributes'],'include':_0x1a5081[_0xe627('0x1c')]?_[_0xe627('0x19')](_0x1a5081[_0xe627('0x1c')],function(_0x29eb8e){return{'model':db[_0x29eb8e[_0xe627('0x1a')]],'as':_0x29eb8e['as'],'attributes':_0x29eb8e[_0xe627('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x44c9f7){logger[_0xe627('0xb')]('GetFreshsalesAccount',_0x56559b);logger[_0xe627('0x1e')]('GetFreshsalesAccount',_0x56559b,JSON['stringify'](_0x44c9f7));_0x538b22(_0x44c9f7);})[_0xe627('0x13')](function(_0xdf63c8){logger['error'](_0xe627('0x14'),_0xdf63c8['message'],_0x56559b);_0x24fddd(_0x2fe46a[_0xe627('0x10')](0x1f4,_0xdf63c8['message']));});});};exports[_0xe627('0x1f')]=function(_0x26833a){var _0x5d8992=this;return new Promise(function(_0x33e9dd,_0x4f92c9){return db[_0xe627('0x20')][_0xe627('0x21')]({'raw':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x1b')]||null:null,'include':_0x26833a['options']?_0x26833a['options'][_0xe627('0x1c')]?_['map'](_0x26833a[_0xe627('0x17')]['include'],function(_0x56d1d7){return{'model':db[_0x56d1d7[_0xe627('0x1a')]],'as':_0x56d1d7['as'],'attributes':_0x56d1d7['attributes'],'include':_0x56d1d7['include']?_[_0xe627('0x19')](_0x56d1d7[_0xe627('0x1c')],function(_0x55f001){return{'model':db[_0x55f001['model']],'as':_0x55f001['as'],'attributes':_0x55f001['attributes'],'include':_0x55f001['include']?_[_0xe627('0x19')](_0x55f001['include'],function(_0x39338c){return{'model':db[_0x39338c[_0xe627('0x1a')]],'as':_0x39338c['as'],'attributes':_0x39338c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x35a303){logger['info'](_0xe627('0x1f'),_0x26833a);logger[_0xe627('0x1e')](_0xe627('0x1f'),_0x26833a,JSON[_0xe627('0xf')](_0x35a303));_0x33e9dd(_0x35a303);})[_0xe627('0x13')](function(_0x28fd59){logger['error'](_0xe627('0x1f'),_0x28fd59['message'],_0x26833a);_0x4f92c9(_0x5d8992[_0xe627('0x10')](0x1f4,_0x28fd59['message']));});});}; \ No newline at end of file +var _0xf970=['then','catch','ShowFreshsalesAccount','find','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x29cf10,_0x46b5fd){var _0x522110=function(_0x4070c8){while(--_0x4070c8){_0x29cf10['push'](_0x29cf10['shift']());}};_0x522110(++_0x46b5fd);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var moment=require(_0x0f97('0x1'));var BPromise=require(_0x0f97('0x2'));var rs=require(_0x0f97('0x3'));var fs=require('fs');var Redis=require(_0x0f97('0x4'));var db=require(_0x0f97('0x5'))['db'];var utils=require(_0x0f97('0x6'));var logger=require(_0x0f97('0x7'))('rpc');var config=require(_0x0f97('0x8'));var jayson=require(_0x0f97('0x9'));var client=jayson[_0x0f97('0xa')][_0x0f97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3515,_0x3244a6,_0x12fbb3){return new BPromise(function(_0x374083,_0x2891f7){return client['request'](_0x2e3515,_0x12fbb3)['then'](function(_0x12397b){logger['info'](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));logger[_0x0f97('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3244a6,_0x0f97('0xd'),JSON['stringify'](_0x12397b));if(_0x12397b[_0x0f97('0xf')]){if(_0x12397b[_0x0f97('0xf')][_0x0f97('0x10')]===0x1f4){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b['error'][_0x0f97('0x11')]);return _0x2891f7(_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);}logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);return _0x374083(_0x12397b['error']['message']);}else{logger[_0x0f97('0x12')](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));_0x374083(_0x12397b[_0x0f97('0x13')]['message']);}})['catch'](function(_0x336f61){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x336f61);_0x2891f7(_0x336f61);});});}exports[_0x0f97('0x14')]=function(_0xae246){var _0x208f6b=this;return new Promise(function(_0x5059ad,_0x54717b){return db[_0x0f97('0x15')][_0x0f97('0x16')]({'raw':_0xae246[_0x0f97('0x17')]?_0xae246[_0x0f97('0x17')][_0x0f97('0x18')]===undefined?!![]:![]:!![],'where':_0xae246[_0x0f97('0x17')]?_0xae246['options'][_0x0f97('0x19')]||null:null,'attributes':_0xae246[_0x0f97('0x17')]?_0xae246[_0x0f97('0x17')][_0x0f97('0x1a')]||null:null,'limit':_0xae246[_0x0f97('0x17')]?_0xae246[_0x0f97('0x17')][_0x0f97('0x1b')]||null:null,'include':_0xae246['options']?_0xae246[_0x0f97('0x17')][_0x0f97('0x1c')]?_[_0x0f97('0x1d')](_0xae246['options'][_0x0f97('0x1c')],function(_0x25d1ef){return{'model':db[_0x25d1ef['model']],'as':_0x25d1ef['as'],'attributes':_0x25d1ef[_0x0f97('0x1a')],'include':_0x25d1ef[_0x0f97('0x1c')]?_['map'](_0x25d1ef['include'],function(_0x51aa82){return{'model':db[_0x51aa82[_0x0f97('0x1e')]],'as':_0x51aa82['as'],'attributes':_0x51aa82[_0x0f97('0x1a')],'include':_0x51aa82['include']?_[_0x0f97('0x1d')](_0x51aa82[_0x0f97('0x1c')],function(_0x30a715){return{'model':db[_0x30a715[_0x0f97('0x1e')]],'as':_0x30a715['as'],'attributes':_0x30a715[_0x0f97('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0f97('0x1f')](function(_0x51a376){logger[_0x0f97('0x12')](_0x0f97('0x14'),_0xae246);logger[_0x0f97('0xe')](_0x0f97('0x14'),_0xae246,JSON['stringify'](_0x51a376));_0x5059ad(_0x51a376);})[_0x0f97('0x20')](function(_0x22cc9e){logger[_0x0f97('0xf')](_0x0f97('0x14'),_0x22cc9e[_0x0f97('0x11')],_0xae246);_0x54717b(_0x208f6b[_0x0f97('0xf')](0x1f4,_0x22cc9e[_0x0f97('0x11')]));});});};exports[_0x0f97('0x21')]=function(_0x51de2e){var _0x481654=this;return new Promise(function(_0x2a8acf,_0x3b9f37){return db[_0x0f97('0x15')][_0x0f97('0x22')]({'raw':_0x51de2e[_0x0f97('0x17')]?_0x51de2e[_0x0f97('0x17')][_0x0f97('0x18')]===undefined?!![]:![]:!![],'where':_0x51de2e[_0x0f97('0x17')]?_0x51de2e[_0x0f97('0x17')][_0x0f97('0x19')]||null:null,'attributes':_0x51de2e[_0x0f97('0x17')]?_0x51de2e['options'][_0x0f97('0x1a')]||null:null,'include':_0x51de2e[_0x0f97('0x17')]?_0x51de2e[_0x0f97('0x17')][_0x0f97('0x1c')]?_[_0x0f97('0x1d')](_0x51de2e['options'][_0x0f97('0x1c')],function(_0x4e1471){return{'model':db[_0x4e1471[_0x0f97('0x1e')]],'as':_0x4e1471['as'],'attributes':_0x4e1471['attributes'],'include':_0x4e1471[_0x0f97('0x1c')]?_[_0x0f97('0x1d')](_0x4e1471[_0x0f97('0x1c')],function(_0x44ad1b){return{'model':db[_0x44ad1b[_0x0f97('0x1e')]],'as':_0x44ad1b['as'],'attributes':_0x44ad1b['attributes'],'include':_0x44ad1b['include']?_[_0x0f97('0x1d')](_0x44ad1b[_0x0f97('0x1c')],function(_0x595adf){return{'model':db[_0x595adf[_0x0f97('0x1e')]],'as':_0x595adf['as'],'attributes':_0x595adf[_0x0f97('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0f97('0x1f')](function(_0x1c9b7d){logger['info'](_0x0f97('0x21'),_0x51de2e);logger[_0x0f97('0xe')](_0x0f97('0x21'),_0x51de2e,JSON[_0x0f97('0x23')](_0x1c9b7d));_0x2a8acf(_0x1c9b7d);})[_0x0f97('0x20')](function(_0x507a90){logger[_0x0f97('0xf')](_0x0f97('0x21'),_0x507a90[_0x0f97('0x11')],_0x51de2e);_0x3b9f37(_0x481654[_0x0f97('0xf')](0x1f4,_0x507a90[_0x0f97('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1e6ccab..7c72bcf 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 _0xdc7a=['getFields','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','getSubjects','getDescriptions','/:id/fields'];(function(_0x193a6e,_0x45dd00){var _0x599a9b=function(_0x37a9e2){while(--_0x37a9e2){_0x193a6e['push'](_0x193a6e['shift']());}};_0x599a9b(++_0x45dd00);}(_0xdc7a,0x8c));var _0xadc7=function(_0x30e6cc,_0x38cd70){_0x30e6cc=_0x30e6cc-0x0;var _0x203473=_0xdc7a[_0x30e6cc];return _0x203473;};'use strict';var multer=require(_0xadc7('0x0'));var util=require(_0xadc7('0x1'));var path=require(_0xadc7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xadc7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xadc7('0x4'));var config=require(_0xadc7('0x5'));var controller=require(_0xadc7('0x6'));router[_0xadc7('0x7')]('/',auth[_0xadc7('0x8')](),controller[_0xadc7('0x9')]);router[_0xadc7('0x7')](_0xadc7('0xa'),auth[_0xadc7('0x8')](),controller['show']);router[_0xadc7('0x7')]('/:id/subjects',auth[_0xadc7('0x8')](),controller[_0xadc7('0xb')]);router[_0xadc7('0x7')]('/:id/descriptions',auth[_0xadc7('0x8')](),controller[_0xadc7('0xc')]);router[_0xadc7('0x7')](_0xadc7('0xd'),auth[_0xadc7('0x8')](),controller[_0xadc7('0xe')]);router[_0xadc7('0xf')]('/',auth[_0xadc7('0x8')](),controller[_0xadc7('0x10')]);router[_0xadc7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xadc7('0x12')]);router[_0xadc7('0x13')](_0xadc7('0xa'),auth[_0xadc7('0x8')](),controller[_0xadc7('0x14')]);module[_0xadc7('0x15')]=router; \ No newline at end of file +var _0xc572=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post','create','update','delete'];(function(_0x5f0c63,_0x55e791){var _0x34d290=function(_0x3c852c){while(--_0x3c852c){_0x5f0c63['push'](_0x5f0c63['shift']());}};_0x34d290(++_0x55e791);}(_0xc572,0x1e5));var _0x2c57=function(_0x2c0e0f,_0x4e43a3){_0x2c0e0f=_0x2c0e0f-0x0;var _0x49f071=_0xc572[_0x2c0e0f];return _0x49f071;};'use strict';var multer=require(_0x2c57('0x0'));var util=require(_0x2c57('0x1'));var path=require(_0x2c57('0x2'));var timeout=require(_0x2c57('0x3'));var express=require('express');var router=express[_0x2c57('0x4')]();var auth=require(_0x2c57('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2c57('0x6'));var controller=require(_0x2c57('0x7'));router[_0x2c57('0x8')]('/',auth['isAuthenticated'](),controller[_0x2c57('0x9')]);router[_0x2c57('0x8')](_0x2c57('0xa'),auth[_0x2c57('0xb')](),controller[_0x2c57('0xc')]);router[_0x2c57('0x8')](_0x2c57('0xd'),auth['isAuthenticated'](),controller[_0x2c57('0xe')]);router[_0x2c57('0x8')]('/:id/descriptions',auth[_0x2c57('0xb')](),controller[_0x2c57('0xf')]);router[_0x2c57('0x8')](_0x2c57('0x10'),auth[_0x2c57('0xb')](),controller['getFields']);router[_0x2c57('0x11')]('/',auth[_0x2c57('0xb')](),controller[_0x2c57('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2c57('0x13')]);router[_0x2c57('0x14')](_0x2c57('0xa'),auth[_0x2c57('0xb')](),controller['destroy']);module[_0x2c57('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 37943a0..3fde95e 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 _0x3eda=['STRING','sequelize','exports'];(function(_0x4fc557,_0x4e2491){var _0x9fa268=function(_0x1083ca){while(--_0x1083ca){_0x4fc557['push'](_0x4fc557['shift']());}};_0x9fa268(++_0x4e2491);}(_0x3eda,0xca));var _0xa3ed=function(_0x20f960,_0x497b0c){_0x20f960=_0x20f960-0x0;var _0x293254=_0x3eda[_0x20f960];return _0x293254;};'use strict';var Sequelize=require(_0xa3ed('0x0'));module[_0xa3ed('0x1')]={'name':{'type':Sequelize[_0xa3ed('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xee60=['sequelize','exports','STRING'];(function(_0x93278f,_0x38ae13){var _0x2fd5f4=function(_0x2d6117){while(--_0x2d6117){_0x93278f['push'](_0x93278f['shift']());}};_0x2fd5f4(++_0x38ae13);}(_0xee60,0x1dd));var _0x0ee6=function(_0x508584,_0x678c0b){_0x508584=_0x508584-0x0;var _0x279e0b=_0xee60[_0x508584];return _0x279e0b;};'use strict';var Sequelize=require(_0x0ee6('0x0'));module[_0x0ee6('0x1')]={'name':{'type':Sequelize[_0x0ee6('0x2')]},'description':{'type':Sequelize[_0x0ee6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b8b9ca8..ef5d70d 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 _0x74bf=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','name','send','index','map','FreshsalesConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','findOne','FreshsalesField','options','getSubjects','getDescriptions','nolimit','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x74bf,0x9d));var _0xf74b=function(_0x42a150,_0x36e8b3){_0x42a150=_0x42a150-0x0;var _0x245f97=_0x74bf[_0x42a150];return _0x245f97;};'use strict';var pdf=require(_0xf74b('0x0'));var emlformat=require(_0xf74b('0x1'));var rimraf=require(_0xf74b('0x2'));var zipdir=require(_0xf74b('0x3'));var jsonpatch=require(_0xf74b('0x4'));var rp=require(_0xf74b('0x5'));var moment=require(_0xf74b('0x6'));var BPromise=require(_0xf74b('0x7'));var Mustache=require('mustache');var util=require(_0xf74b('0x8'));var path=require(_0xf74b('0x9'));var sox=require(_0xf74b('0xa'));var csv=require(_0xf74b('0xb'));var ejs=require(_0xf74b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf74b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf74b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf74b('0xf'));var Papa=require(_0xf74b('0x10'));var Redis=require(_0xf74b('0x11'));var authService=require(_0xf74b('0x12'));var qs=require(_0xf74b('0x13'));var as=require(_0xf74b('0x14'));var hardwareService=require(_0xf74b('0x15'));var logger=require(_0xf74b('0x16'))(_0xf74b('0x17'));var utils=require(_0xf74b('0x18'));var config=require(_0xf74b('0x19'));var db=require(_0xf74b('0x1a'))['db'];var jayson=require(_0xf74b('0x1b'));var client=jayson[_0xf74b('0x1c')][_0xf74b('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x84a03c,_0x2683e9,_0x490042){if(_0x490042){var _0x417c7e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x417c7e[_0xf74b('0x1e')](_0x2683e9)){return _0x84a03c;}else{throw new db[(_0xf74b('0x1f'))][(_0xf74b('0x20'))](_0xf74b('0x21'));}}else{return _0x84a03c;}}function respondWithRpcPromise(_0x1ca0d5,_0x37bf0e,_0x5a876c,_0x10b61d){return new BPromise(function(_0x11b268,_0x2c80a4){var _0x2a89bc=_0x10b61d||client;return _0x2a89bc[_0xf74b('0x22')](_0x1ca0d5,_0x5a876c)[_0xf74b('0x23')](function(_0xe5271d){logger[_0xf74b('0x24')](_0xf74b('0x25'),_0x37bf0e,_0xf74b('0x26'));logger['debug'](_0xf74b('0x27'),_0x37bf0e,'request\x20sent',JSON[_0xf74b('0x28')](_0xe5271d));if(_0xe5271d[_0xf74b('0x29')]){if(_0xe5271d[_0xf74b('0x29')][_0xf74b('0x2a')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x37bf0e,_0xe5271d[_0xf74b('0x29')]['message']);return _0x2c80a4(_0xe5271d[_0xf74b('0x29')][_0xf74b('0x2b')]);}logger['error'](_0xf74b('0x25'),_0x37bf0e,_0xe5271d[_0xf74b('0x29')][_0xf74b('0x2b')]);return _0x11b268(_0xe5271d[_0xf74b('0x29')][_0xf74b('0x2b')]);}else{logger[_0xf74b('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x37bf0e,_0xf74b('0x26'));_0x11b268(_0xe5271d[_0xf74b('0x2c')][_0xf74b('0x2b')]);}})['catch'](function(_0xebc9c0){logger[_0xf74b('0x29')](_0xf74b('0x25'),_0x37bf0e,_0xebc9c0);_0x2c80a4(_0xebc9c0);});});}function respondWithStatusCode(_0x3c5783,_0x161d77){_0x161d77=_0x161d77||0xcc;return function(_0x12bbbb){if(_0x12bbbb){return _0x3c5783[_0xf74b('0x2d')](_0x161d77);}return _0x3c5783[_0xf74b('0x2e')](_0x161d77)[_0xf74b('0x2f')]();};}function respondWithResult(_0x303c3b,_0x19d5ca){_0x19d5ca=_0x19d5ca||0xc8;return function(_0x41cbdb){if(_0x41cbdb){return _0x303c3b[_0xf74b('0x2e')](_0x19d5ca)[_0xf74b('0x30')](_0x41cbdb);}};}function respondWithFilteredResult(_0x51aa75,_0x13d6ca){return function(_0x1b9495){if(_0x1b9495){var _0x5c25c1=_0x1b9495[_0xf74b('0x31')],_0x41df40=_0x13d6ca[_0xf74b('0x32')],_0x437832=_0x13d6ca[_0xf74b('0x32')]+_0x13d6ca[_0xf74b('0x33')],_0x41ef22;if(_0x437832>=_0x5c25c1){_0x437832=_0x5c25c1;_0x41ef22=0xc8;}else{_0x41ef22=0xce;}_0x51aa75[_0xf74b('0x2e')](_0x41ef22);return _0x51aa75['set'](_0xf74b('0x34'),_0x41df40+'-'+_0x437832+'/'+_0x5c25c1)[_0xf74b('0x30')](_0x1b9495);}return null;};}function patchUpdates(_0x253e62){return function(_0x50765b){try{jsonpatch[_0xf74b('0x35')](_0x50765b,_0x253e62,!![]);}catch(_0x218788){return BPromise[_0xf74b('0x36')](_0x218788);}return _0x50765b[_0xf74b('0x37')]();};}function saveUpdates(_0x5cb77e,_0x3f7024){return function(_0x217b1a){if(_0x217b1a){return _0x217b1a[_0xf74b('0x38')](_0x5cb77e)[_0xf74b('0x23')](function(_0x8f239f){return _0x8f239f;});}return null;};}function removeEntity(_0x32bbe9,_0x35cbc0){return function(_0x326a26){if(_0x326a26){return _0x326a26[_0xf74b('0x39')]()['then'](function(){_0x32bbe9[_0xf74b('0x2e')](0xcc)[_0xf74b('0x2f')]();});}};}function handleEntityNotFound(_0x689c2d,_0x305468){return function(_0x221b29){if(!_0x221b29){_0x689c2d[_0xf74b('0x2d')](0x194);}return _0x221b29;};}function handleError(_0x2e4554,_0x3f9ee3){_0x3f9ee3=_0x3f9ee3||0x1f4;return function(_0x3fb3f5){logger['error'](_0x3fb3f5['stack']);if(_0x3fb3f5[_0xf74b('0x3a')]){delete _0x3fb3f5[_0xf74b('0x3a')];}_0x2e4554['status'](_0x3f9ee3)[_0xf74b('0x3b')](_0x3fb3f5);};}exports[_0xf74b('0x3c')]=function(_0x3b303d,_0x14a77b){var _0x494da8={},_0x5e659a={},_0x363a6a={'count':0x0,'rows':[]};var _0x1d8532=_[_0xf74b('0x3d')](db[_0xf74b('0x3e')]['rawAttributes'],function(_0x18ce1e){return{'name':_0x18ce1e['fieldName'],'type':_0x18ce1e[_0xf74b('0x3f')][_0xf74b('0x40')]};});_0x5e659a[_0xf74b('0x41')]=_[_0xf74b('0x3d')](_0x1d8532,_0xf74b('0x3a'));_0x5e659a[_0xf74b('0x42')]=_[_0xf74b('0x43')](_0x3b303d[_0xf74b('0x42')]);_0x5e659a[_0xf74b('0x44')]=_[_0xf74b('0x45')](_0x5e659a[_0xf74b('0x41')],_0x5e659a[_0xf74b('0x42')]);_0x494da8[_0xf74b('0x46')]=_['intersection'](_0x5e659a[_0xf74b('0x41')],qs['fields'](_0x3b303d[_0xf74b('0x42')][_0xf74b('0x47')]));_0x494da8[_0xf74b('0x46')]=_0x494da8['attributes'][_0xf74b('0x48')]?_0x494da8[_0xf74b('0x46')]:_0x5e659a['model'];if(!_0x3b303d[_0xf74b('0x42')][_0xf74b('0x49')]('nolimit')){_0x494da8[_0xf74b('0x33')]=qs[_0xf74b('0x33')](_0x3b303d[_0xf74b('0x42')]['limit']);_0x494da8[_0xf74b('0x32')]=qs[_0xf74b('0x32')](_0x3b303d[_0xf74b('0x42')][_0xf74b('0x32')]);}_0x494da8[_0xf74b('0x4a')]=qs[_0xf74b('0x4b')](_0x3b303d[_0xf74b('0x42')][_0xf74b('0x4b')]);_0x494da8[_0xf74b('0x4c')]=qs[_0xf74b('0x44')](_[_0xf74b('0x4d')](_0x3b303d[_0xf74b('0x42')],_0x5e659a[_0xf74b('0x44')]),_0x1d8532);if(_0x3b303d[_0xf74b('0x42')][_0xf74b('0x4e')]){_0x494da8['where']=_[_0xf74b('0x4f')](_0x494da8[_0xf74b('0x4c')],{'$or':_[_0xf74b('0x3d')](_0x1d8532,function(_0x39ffb3){if(_0x39ffb3['type']!==_0xf74b('0x50')){var _0x572375={};_0x572375[_0x39ffb3[_0xf74b('0x3a')]]={'$like':'%'+_0x3b303d[_0xf74b('0x42')][_0xf74b('0x4e')]+'%'};return _0x572375;}})});}_0x494da8=_[_0xf74b('0x4f')]({},_0x494da8,_0x3b303d['options']);var _0x401eee={'where':_0x494da8[_0xf74b('0x4c')]};return db[_0xf74b('0x3e')][_0xf74b('0x31')](_0x401eee)[_0xf74b('0x23')](function(_0x3e9007){_0x363a6a['count']=_0x3e9007;if(_0x3b303d[_0xf74b('0x42')][_0xf74b('0x51')]){_0x494da8['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xf74b('0x52')](_0x494da8);})[_0xf74b('0x23')](function(_0x1a9914){_0x363a6a[_0xf74b('0x53')]=_0x1a9914;return _0x363a6a;})[_0xf74b('0x23')](respondWithFilteredResult(_0x14a77b,_0x494da8))[_0xf74b('0x54')](handleError(_0x14a77b,null));};exports[_0xf74b('0x55')]=function(_0xedae26,_0x4a7876){var _0x4daa81={'raw':![],'where':{'id':_0xedae26[_0xf74b('0x56')]['id']}},_0x2e0d90={};_0x2e0d90['model']=_['keys'](db[_0xf74b('0x3e')][_0xf74b('0x57')]);_0x2e0d90[_0xf74b('0x42')]=_[_0xf74b('0x43')](_0xedae26[_0xf74b('0x42')]);_0x2e0d90[_0xf74b('0x44')]=_[_0xf74b('0x45')](_0x2e0d90[_0xf74b('0x41')],_0x2e0d90['query']);_0x4daa81[_0xf74b('0x46')]=_[_0xf74b('0x45')](_0x2e0d90[_0xf74b('0x41')],qs['fields'](_0xedae26[_0xf74b('0x42')]['fields']));_0x4daa81['attributes']=_0x4daa81[_0xf74b('0x46')][_0xf74b('0x48')]?_0x4daa81[_0xf74b('0x46')]:_0x2e0d90[_0xf74b('0x41')];if(_0xedae26[_0xf74b('0x42')][_0xf74b('0x51')]){_0x4daa81[_0xf74b('0x58')]=[{'all':!![]}];}_0x4daa81=_[_0xf74b('0x4f')]({},_0x4daa81,_0xedae26['options']);return db[_0xf74b('0x3e')]['find'](_0x4daa81)[_0xf74b('0x23')](handleEntityNotFound(_0x4a7876,null))[_0xf74b('0x23')](respondWithResult(_0x4a7876,null))[_0xf74b('0x54')](handleError(_0x4a7876,null));};exports[_0xf74b('0x59')]=function(_0x195760,_0x388af1){return db[_0xf74b('0x3e')][_0xf74b('0x59')](_0x195760[_0xf74b('0x5a')],{})['then'](respondWithResult(_0x388af1,0xc9))[_0xf74b('0x54')](handleError(_0x388af1,null));};exports['update']=function(_0x3e12e5,_0x2b650b){if(_0x3e12e5[_0xf74b('0x5a')]['id']){delete _0x3e12e5[_0xf74b('0x5a')]['id'];}return db[_0xf74b('0x3e')]['find']({'where':{'id':_0x3e12e5[_0xf74b('0x56')]['id']}})['then'](handleEntityNotFound(_0x2b650b,null))[_0xf74b('0x23')](saveUpdates(_0x3e12e5['body'],null))['then'](respondWithResult(_0x2b650b,null))[_0xf74b('0x54')](handleError(_0x2b650b,null));};exports['destroy']=function(_0x5bfab8,_0x5e3e61){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x5bfab8[_0xf74b('0x56')]['id']}})[_0xf74b('0x23')](handleEntityNotFound(_0x5e3e61,null))[_0xf74b('0x23')](removeEntity(_0x5e3e61,null))[_0xf74b('0x54')](handleError(_0x5e3e61,null));};exports['getSubjects']=function(_0x1bb5f7,_0x1f37dc,_0x3be67a){var _0x4714f8={};var _0x18bce1={};var _0x3fd7cc;var _0x211bbb;return db[_0xf74b('0x3e')][_0xf74b('0x5b')]({'where':{'id':_0x1bb5f7['params']['id']}})[_0xf74b('0x23')](handleEntityNotFound(_0x1f37dc,null))['then'](function(_0x4a1793){if(_0x4a1793){_0x3fd7cc=_0x4a1793;_0x18bce1[_0xf74b('0x41')]=_[_0xf74b('0x43')](db[_0xf74b('0x5c')][_0xf74b('0x57')]);_0x18bce1[_0xf74b('0x42')]=_[_0xf74b('0x43')](_0x1bb5f7[_0xf74b('0x42')]);_0x18bce1['filters']=_['intersection'](_0x18bce1[_0xf74b('0x41')],_0x18bce1[_0xf74b('0x42')]);_0x4714f8['attributes']=_[_0xf74b('0x45')](_0x18bce1['model'],qs[_0xf74b('0x47')](_0x1bb5f7['query'][_0xf74b('0x47')]));_0x4714f8[_0xf74b('0x46')]=_0x4714f8[_0xf74b('0x46')][_0xf74b('0x48')]?_0x4714f8[_0xf74b('0x46')]:_0x18bce1[_0xf74b('0x41')];_0x4714f8[_0xf74b('0x4a')]=qs['sort'](_0x1bb5f7[_0xf74b('0x42')][_0xf74b('0x4b')]);_0x4714f8[_0xf74b('0x4c')]=qs[_0xf74b('0x44')](_['pick'](_0x1bb5f7[_0xf74b('0x42')],_0x18bce1[_0xf74b('0x44')]));if(_0x1bb5f7[_0xf74b('0x42')][_0xf74b('0x4e')]){_0x4714f8[_0xf74b('0x4c')]=_[_0xf74b('0x4f')](_0x4714f8[_0xf74b('0x4c')],{'$or':_[_0xf74b('0x3d')](_0x4714f8['attributes'],function(_0x594360){var _0x459ebb={};_0x459ebb[_0x594360]={'$like':'%'+_0x1bb5f7[_0xf74b('0x42')]['filter']+'%'};return _0x459ebb;})});}_0x4714f8=_[_0xf74b('0x4f')]({},_0x4714f8,_0x1bb5f7[_0xf74b('0x5d')]);return _0x3fd7cc[_0xf74b('0x5e')](_0x4714f8);}})[_0xf74b('0x23')](function(_0x11b649){if(_0x11b649){_0x211bbb=_0x11b649[_0xf74b('0x48')];if(!_0x1bb5f7['query'][_0xf74b('0x49')]('nolimit')){_0x4714f8['limit']=qs['limit'](_0x1bb5f7[_0xf74b('0x42')][_0xf74b('0x33')]);_0x4714f8[_0xf74b('0x32')]=qs[_0xf74b('0x32')](_0x1bb5f7[_0xf74b('0x42')]['offset']);}return _0x3fd7cc[_0xf74b('0x5e')](_0x4714f8);}})[_0xf74b('0x23')](function(_0x4007b2){if(_0x4007b2){return _0x4007b2?{'count':_0x211bbb,'rows':_0x4007b2}:null;}})[_0xf74b('0x23')](respondWithResult(_0x1f37dc,null))[_0xf74b('0x54')](handleError(_0x1f37dc,null));};exports['getDescriptions']=function(_0x1a6859,_0x23b255,_0x3afcf5){var _0x2aa247={};var _0x18aa06={};var _0x3c828c;var _0x6173f3;return db[_0xf74b('0x3e')][_0xf74b('0x5b')]({'where':{'id':_0x1a6859['params']['id']}})[_0xf74b('0x23')](handleEntityNotFound(_0x23b255,null))[_0xf74b('0x23')](function(_0x314ba8){if(_0x314ba8){_0x3c828c=_0x314ba8;_0x18aa06[_0xf74b('0x41')]=_[_0xf74b('0x43')](db[_0xf74b('0x5c')]['rawAttributes']);_0x18aa06[_0xf74b('0x42')]=_[_0xf74b('0x43')](_0x1a6859[_0xf74b('0x42')]);_0x18aa06['filters']=_['intersection'](_0x18aa06[_0xf74b('0x41')],_0x18aa06[_0xf74b('0x42')]);_0x2aa247[_0xf74b('0x46')]=_['intersection'](_0x18aa06[_0xf74b('0x41')],qs[_0xf74b('0x47')](_0x1a6859[_0xf74b('0x42')][_0xf74b('0x47')]));_0x2aa247[_0xf74b('0x46')]=_0x2aa247[_0xf74b('0x46')][_0xf74b('0x48')]?_0x2aa247[_0xf74b('0x46')]:_0x18aa06[_0xf74b('0x41')];_0x2aa247['order']=qs[_0xf74b('0x4b')](_0x1a6859[_0xf74b('0x42')]['sort']);_0x2aa247[_0xf74b('0x4c')]=qs[_0xf74b('0x44')](_['pick'](_0x1a6859[_0xf74b('0x42')],_0x18aa06[_0xf74b('0x44')]));if(_0x1a6859['query'][_0xf74b('0x4e')]){_0x2aa247[_0xf74b('0x4c')]=_[_0xf74b('0x4f')](_0x2aa247[_0xf74b('0x4c')],{'$or':_[_0xf74b('0x3d')](_0x2aa247['attributes'],function(_0xe31cae){var _0x54f0c3={};_0x54f0c3[_0xe31cae]={'$like':'%'+_0x1a6859[_0xf74b('0x42')][_0xf74b('0x4e')]+'%'};return _0x54f0c3;})});}_0x2aa247=_[_0xf74b('0x4f')]({},_0x2aa247,_0x1a6859['options']);return _0x3c828c[_0xf74b('0x5f')](_0x2aa247);}})[_0xf74b('0x23')](function(_0x9b2b95){if(_0x9b2b95){_0x6173f3=_0x9b2b95[_0xf74b('0x48')];if(!_0x1a6859[_0xf74b('0x42')][_0xf74b('0x49')](_0xf74b('0x60'))){_0x2aa247[_0xf74b('0x33')]=qs['limit'](_0x1a6859[_0xf74b('0x42')]['limit']);_0x2aa247[_0xf74b('0x32')]=qs[_0xf74b('0x32')](_0x1a6859['query'][_0xf74b('0x32')]);}return _0x3c828c['getDescriptions'](_0x2aa247);}})['then'](function(_0x33d401){if(_0x33d401){return _0x33d401?{'count':_0x6173f3,'rows':_0x33d401}:null;}})[_0xf74b('0x23')](respondWithResult(_0x23b255,null))[_0xf74b('0x54')](handleError(_0x23b255,null));};exports['getFields']=function(_0x92a4ea,_0xccac53,_0x1eaa84){var _0x4c3a0a={};var _0xc9268d={};var _0x5e2096;var _0x5e86d7;return db[_0xf74b('0x3e')][_0xf74b('0x5b')]({'where':{'id':_0x92a4ea[_0xf74b('0x56')]['id']}})[_0xf74b('0x23')](handleEntityNotFound(_0xccac53,null))['then'](function(_0x5ca329){if(_0x5ca329){_0x5e2096=_0x5ca329;_0xc9268d[_0xf74b('0x41')]=_[_0xf74b('0x43')](db[_0xf74b('0x5c')][_0xf74b('0x57')]);_0xc9268d['query']=_['keys'](_0x92a4ea[_0xf74b('0x42')]);_0xc9268d[_0xf74b('0x44')]=_[_0xf74b('0x45')](_0xc9268d[_0xf74b('0x41')],_0xc9268d['query']);_0x4c3a0a[_0xf74b('0x46')]=_['intersection'](_0xc9268d[_0xf74b('0x41')],qs['fields'](_0x92a4ea[_0xf74b('0x42')][_0xf74b('0x47')]));_0x4c3a0a['attributes']=_0x4c3a0a['attributes'][_0xf74b('0x48')]?_0x4c3a0a[_0xf74b('0x46')]:_0xc9268d[_0xf74b('0x41')];_0x4c3a0a[_0xf74b('0x4a')]=qs[_0xf74b('0x4b')](_0x92a4ea['query'][_0xf74b('0x4b')]);_0x4c3a0a['where']=qs[_0xf74b('0x44')](_['pick'](_0x92a4ea['query'],_0xc9268d[_0xf74b('0x44')]));if(_0x92a4ea[_0xf74b('0x42')]['filter']){_0x4c3a0a[_0xf74b('0x4c')]=_[_0xf74b('0x4f')](_0x4c3a0a['where'],{'$or':_[_0xf74b('0x3d')](_0x4c3a0a['attributes'],function(_0x1c0af3){var _0x4aed22={};_0x4aed22[_0x1c0af3]={'$like':'%'+_0x92a4ea['query'][_0xf74b('0x4e')]+'%'};return _0x4aed22;})});}_0x4c3a0a=_[_0xf74b('0x4f')]({},_0x4c3a0a,_0x92a4ea['options']);return _0x5e2096['getFields'](_0x4c3a0a);}})[_0xf74b('0x23')](function(_0x5c6ce5){if(_0x5c6ce5){_0x5e86d7=_0x5c6ce5[_0xf74b('0x48')];if(!_0x92a4ea[_0xf74b('0x42')][_0xf74b('0x49')](_0xf74b('0x60'))){_0x4c3a0a['limit']=qs['limit'](_0x92a4ea['query'][_0xf74b('0x33')]);_0x4c3a0a[_0xf74b('0x32')]=qs[_0xf74b('0x32')](_0x92a4ea['query']['offset']);}return _0x5e2096[_0xf74b('0x61')](_0x4c3a0a);}})[_0xf74b('0x23')](function(_0x539a7f){if(_0x539a7f){return _0x539a7f?{'count':_0x5e86d7,'rows':_0x539a7f}:null;}})[_0xf74b('0x23')](respondWithResult(_0xccac53,null))[_0xf74b('0x54')](handleError(_0xccac53,null));}; \ No newline at end of file +var _0xa26e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','limit','apply','reject','save','update','then','sendStatus','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','nolimit','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','find','body','destroy','params','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa26e,0x1ba));var _0xea26=function(_0x8904b9,_0x39559a){_0x8904b9=_0x8904b9-0x0;var _0x45cd53=_0xa26e[_0x8904b9];return _0x45cd53;};'use strict';var pdf=require(_0xea26('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xea26('0x1'));var zipdir=require(_0xea26('0x2'));var jsonpatch=require(_0xea26('0x3'));var rp=require(_0xea26('0x4'));var moment=require(_0xea26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xea26('0x6'));var util=require(_0xea26('0x7'));var path=require('path');var sox=require(_0xea26('0x8'));var csv=require(_0xea26('0x9'));var ejs=require(_0xea26('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xea26('0xb'));var crypto=require(_0xea26('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xea26('0x9'));var querystring=require(_0xea26('0xd'));var Papa=require(_0xea26('0xe'));var Redis=require(_0xea26('0xf'));var authService=require(_0xea26('0x10'));var qs=require(_0xea26('0x11'));var as=require(_0xea26('0x12'));var hardwareService=require(_0xea26('0x13'));var logger=require('../../config/logger')(_0xea26('0x14'));var utils=require('../../config/utils');var config=require(_0xea26('0x15'));var db=require(_0xea26('0x16'))['db'];var jayson=require(_0xea26('0x17'));var client=jayson[_0xea26('0x18')][_0xea26('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2f26c9,_0x1092fd,_0x245630){if(_0x245630){var _0x27dc7c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27dc7c['test'](_0x1092fd)){return _0x2f26c9;}else{throw new db['Sequelize'][(_0xea26('0x1a'))](_0xea26('0x1b'));}}else{return _0x2f26c9;}}function respondWithRpcPromise(_0xf324c5,_0x26cc3a,_0x4d2106,_0x2b9272){return new BPromise(function(_0x2a2481,_0x1c83bb){var _0x2894a4=_0x2b9272||client;return _0x2894a4[_0xea26('0x1c')](_0xf324c5,_0x4d2106)['then'](function(_0x42a7e4){logger['info'](_0xea26('0x1d'),_0x26cc3a,_0xea26('0x1e'));logger[_0xea26('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x26cc3a,_0xea26('0x1e'),JSON[_0xea26('0x20')](_0x42a7e4));if(_0x42a7e4[_0xea26('0x21')]){if(_0x42a7e4[_0xea26('0x21')][_0xea26('0x22')]===0x1f4){logger['error'](_0xea26('0x1d'),_0x26cc3a,_0x42a7e4['error'][_0xea26('0x23')]);return _0x1c83bb(_0x42a7e4['error'][_0xea26('0x23')]);}logger[_0xea26('0x21')](_0xea26('0x1d'),_0x26cc3a,_0x42a7e4[_0xea26('0x21')][_0xea26('0x23')]);return _0x2a2481(_0x42a7e4[_0xea26('0x21')][_0xea26('0x23')]);}else{logger[_0xea26('0x24')](_0xea26('0x1d'),_0x26cc3a,_0xea26('0x1e'));_0x2a2481(_0x42a7e4[_0xea26('0x25')]['message']);}})[_0xea26('0x26')](function(_0x16b1d1){logger['error'](_0xea26('0x1d'),_0x26cc3a,_0x16b1d1);_0x1c83bb(_0x16b1d1);});});}function respondWithStatusCode(_0xb1512e,_0x21d6d2){_0x21d6d2=_0x21d6d2||0xcc;return function(_0xd575af){if(_0xd575af){return _0xb1512e['sendStatus'](_0x21d6d2);}return _0xb1512e[_0xea26('0x27')](_0x21d6d2)[_0xea26('0x28')]();};}function respondWithResult(_0x4ba9d8,_0x5b52df){_0x5b52df=_0x5b52df||0xc8;return function(_0xce7d43){if(_0xce7d43){return _0x4ba9d8[_0xea26('0x27')](_0x5b52df)[_0xea26('0x29')](_0xce7d43);}};}function respondWithFilteredResult(_0x27bc67,_0x119f1c){return function(_0x385f52){if(_0x385f52){var _0x4afbc2=_0x385f52[_0xea26('0x2a')],_0x2e1c03=_0x119f1c['offset'],_0xad12fb=_0x119f1c['offset']+_0x119f1c[_0xea26('0x2b')],_0x54070d;if(_0xad12fb>=_0x4afbc2){_0xad12fb=_0x4afbc2;_0x54070d=0xc8;}else{_0x54070d=0xce;}_0x27bc67[_0xea26('0x27')](_0x54070d);return _0x27bc67['set']('Content-Range',_0x2e1c03+'-'+_0xad12fb+'/'+_0x4afbc2)[_0xea26('0x29')](_0x385f52);}return null;};}function patchUpdates(_0x40c26b){return function(_0x3dc5db){try{jsonpatch[_0xea26('0x2c')](_0x3dc5db,_0x40c26b,!![]);}catch(_0x2bc2b6){return BPromise[_0xea26('0x2d')](_0x2bc2b6);}return _0x3dc5db[_0xea26('0x2e')]();};}function saveUpdates(_0x1196ac,_0x4d3930){return function(_0x1d0136){if(_0x1d0136){return _0x1d0136[_0xea26('0x2f')](_0x1196ac)[_0xea26('0x30')](function(_0x6f1727){return _0x6f1727;});}return null;};}function removeEntity(_0x3ebeda,_0x3dce1d){return function(_0x4a83c4){if(_0x4a83c4){return _0x4a83c4['destroy']()[_0xea26('0x30')](function(){_0x3ebeda[_0xea26('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4de213,_0x2f3b1c){return function(_0x448e42){if(!_0x448e42){_0x4de213[_0xea26('0x31')](0x194);}return _0x448e42;};}function handleError(_0x15fde8,_0x265a7a){_0x265a7a=_0x265a7a||0x1f4;return function(_0x587da1){logger[_0xea26('0x21')](_0x587da1[_0xea26('0x32')]);if(_0x587da1[_0xea26('0x33')]){delete _0x587da1[_0xea26('0x33')];}_0x15fde8['status'](_0x265a7a)[_0xea26('0x34')](_0x587da1);};}exports['index']=function(_0x4c7dfa,_0x10610c){var _0x10d9d7={},_0x2f7c33={},_0x3110fc={'count':0x0,'rows':[]};var _0x22f29e=_[_0xea26('0x35')](db[_0xea26('0x36')][_0xea26('0x37')],function(_0x224339){return{'name':_0x224339[_0xea26('0x38')],'type':_0x224339['type']['key']};});_0x2f7c33[_0xea26('0x39')]=_[_0xea26('0x35')](_0x22f29e,'name');_0x2f7c33['query']=_[_0xea26('0x3a')](_0x4c7dfa[_0xea26('0x3b')]);_0x2f7c33[_0xea26('0x3c')]=_[_0xea26('0x3d')](_0x2f7c33[_0xea26('0x39')],_0x2f7c33[_0xea26('0x3b')]);_0x10d9d7['attributes']=_[_0xea26('0x3d')](_0x2f7c33[_0xea26('0x39')],qs[_0xea26('0x3e')](_0x4c7dfa[_0xea26('0x3b')][_0xea26('0x3e')]));_0x10d9d7[_0xea26('0x3f')]=_0x10d9d7[_0xea26('0x3f')][_0xea26('0x40')]?_0x10d9d7[_0xea26('0x3f')]:_0x2f7c33[_0xea26('0x39')];if(!_0x4c7dfa[_0xea26('0x3b')]['hasOwnProperty'](_0xea26('0x41'))){_0x10d9d7['limit']=qs[_0xea26('0x2b')](_0x4c7dfa[_0xea26('0x3b')][_0xea26('0x2b')]);_0x10d9d7[_0xea26('0x42')]=qs[_0xea26('0x42')](_0x4c7dfa[_0xea26('0x3b')][_0xea26('0x42')]);}_0x10d9d7[_0xea26('0x43')]=qs['sort'](_0x4c7dfa[_0xea26('0x3b')][_0xea26('0x44')]);_0x10d9d7[_0xea26('0x45')]=qs[_0xea26('0x3c')](_[_0xea26('0x46')](_0x4c7dfa[_0xea26('0x3b')],_0x2f7c33[_0xea26('0x3c')]),_0x22f29e);if(_0x4c7dfa[_0xea26('0x3b')]['filter']){_0x10d9d7['where']=_[_0xea26('0x47')](_0x10d9d7[_0xea26('0x45')],{'$or':_['map'](_0x22f29e,function(_0x2a1151){if(_0x2a1151[_0xea26('0x48')]!==_0xea26('0x49')){var _0x2ef278={};_0x2ef278[_0x2a1151[_0xea26('0x33')]]={'$like':'%'+_0x4c7dfa['query'][_0xea26('0x4a')]+'%'};return _0x2ef278;}})});}_0x10d9d7=_[_0xea26('0x47')]({},_0x10d9d7,_0x4c7dfa[_0xea26('0x4b')]);var _0x4f3bf6={'where':_0x10d9d7[_0xea26('0x45')]};return db['FreshsalesConfiguration'][_0xea26('0x2a')](_0x4f3bf6)[_0xea26('0x30')](function(_0x359be8){_0x3110fc['count']=_0x359be8;if(_0x4c7dfa[_0xea26('0x3b')][_0xea26('0x4c')]){_0x10d9d7['include']=[{'all':!![]}];}return db[_0xea26('0x36')][_0xea26('0x4d')](_0x10d9d7);})['then'](function(_0x29bc63){_0x3110fc[_0xea26('0x4e')]=_0x29bc63;return _0x3110fc;})[_0xea26('0x30')](respondWithFilteredResult(_0x10610c,_0x10d9d7))[_0xea26('0x26')](handleError(_0x10610c,null));};exports[_0xea26('0x4f')]=function(_0x4ff407,_0x15f190){var _0x5df8fd={'raw':![],'where':{'id':_0x4ff407['params']['id']}},_0x20828d={};_0x20828d[_0xea26('0x39')]=_['keys'](db[_0xea26('0x36')][_0xea26('0x37')]);_0x20828d[_0xea26('0x3b')]=_[_0xea26('0x3a')](_0x4ff407[_0xea26('0x3b')]);_0x20828d['filters']=_['intersection'](_0x20828d[_0xea26('0x39')],_0x20828d[_0xea26('0x3b')]);_0x5df8fd[_0xea26('0x3f')]=_[_0xea26('0x3d')](_0x20828d[_0xea26('0x39')],qs['fields'](_0x4ff407['query']['fields']));_0x5df8fd[_0xea26('0x3f')]=_0x5df8fd['attributes']['length']?_0x5df8fd[_0xea26('0x3f')]:_0x20828d[_0xea26('0x39')];if(_0x4ff407['query'][_0xea26('0x4c')]){_0x5df8fd[_0xea26('0x50')]=[{'all':!![]}];}_0x5df8fd=_[_0xea26('0x47')]({},_0x5df8fd,_0x4ff407['options']);return db[_0xea26('0x36')][_0xea26('0x51')](_0x5df8fd)[_0xea26('0x30')](handleEntityNotFound(_0x15f190,null))[_0xea26('0x30')](respondWithResult(_0x15f190,null))[_0xea26('0x26')](handleError(_0x15f190,null));};exports['create']=function(_0xd81579,_0x2dd753){return db[_0xea26('0x36')]['create'](_0xd81579[_0xea26('0x52')],{})[_0xea26('0x30')](respondWithResult(_0x2dd753,0xc9))['catch'](handleError(_0x2dd753,null));};exports[_0xea26('0x2f')]=function(_0x5d7c92,_0x46485d){if(_0x5d7c92[_0xea26('0x52')]['id']){delete _0x5d7c92[_0xea26('0x52')]['id'];}return db[_0xea26('0x36')]['find']({'where':{'id':_0x5d7c92['params']['id']}})[_0xea26('0x30')](handleEntityNotFound(_0x46485d,null))['then'](saveUpdates(_0x5d7c92[_0xea26('0x52')],null))[_0xea26('0x30')](respondWithResult(_0x46485d,null))[_0xea26('0x26')](handleError(_0x46485d,null));};exports[_0xea26('0x53')]=function(_0x3f61ac,_0x176ccd){return db[_0xea26('0x36')]['find']({'where':{'id':_0x3f61ac[_0xea26('0x54')]['id']}})[_0xea26('0x30')](handleEntityNotFound(_0x176ccd,null))[_0xea26('0x30')](removeEntity(_0x176ccd,null))[_0xea26('0x26')](handleError(_0x176ccd,null));};exports[_0xea26('0x55')]=function(_0x2ccd4e,_0x287d2d,_0x1313ad){var _0xea0bb1={};var _0x2f6668={};var _0xc679ff;var _0x44dfec;return db[_0xea26('0x36')][_0xea26('0x56')]({'where':{'id':_0x2ccd4e[_0xea26('0x54')]['id']}})[_0xea26('0x30')](handleEntityNotFound(_0x287d2d,null))[_0xea26('0x30')](function(_0x49af35){if(_0x49af35){_0xc679ff=_0x49af35;_0x2f6668['model']=_[_0xea26('0x3a')](db[_0xea26('0x57')][_0xea26('0x37')]);_0x2f6668[_0xea26('0x3b')]=_[_0xea26('0x3a')](_0x2ccd4e[_0xea26('0x3b')]);_0x2f6668[_0xea26('0x3c')]=_[_0xea26('0x3d')](_0x2f6668[_0xea26('0x39')],_0x2f6668[_0xea26('0x3b')]);_0xea0bb1[_0xea26('0x3f')]=_[_0xea26('0x3d')](_0x2f6668[_0xea26('0x39')],qs[_0xea26('0x3e')](_0x2ccd4e[_0xea26('0x3b')][_0xea26('0x3e')]));_0xea0bb1[_0xea26('0x3f')]=_0xea0bb1['attributes'][_0xea26('0x40')]?_0xea0bb1['attributes']:_0x2f6668[_0xea26('0x39')];_0xea0bb1[_0xea26('0x43')]=qs['sort'](_0x2ccd4e[_0xea26('0x3b')]['sort']);_0xea0bb1[_0xea26('0x45')]=qs[_0xea26('0x3c')](_[_0xea26('0x46')](_0x2ccd4e[_0xea26('0x3b')],_0x2f6668[_0xea26('0x3c')]));if(_0x2ccd4e[_0xea26('0x3b')]['filter']){_0xea0bb1[_0xea26('0x45')]=_[_0xea26('0x47')](_0xea0bb1[_0xea26('0x45')],{'$or':_[_0xea26('0x35')](_0xea0bb1[_0xea26('0x3f')],function(_0xef7ede){var _0x43f952={};_0x43f952[_0xef7ede]={'$like':'%'+_0x2ccd4e[_0xea26('0x3b')][_0xea26('0x4a')]+'%'};return _0x43f952;})});}_0xea0bb1=_['merge']({},_0xea0bb1,_0x2ccd4e['options']);return _0xc679ff[_0xea26('0x55')](_0xea0bb1);}})[_0xea26('0x30')](function(_0x51f057){if(_0x51f057){_0x44dfec=_0x51f057[_0xea26('0x40')];if(!_0x2ccd4e[_0xea26('0x3b')][_0xea26('0x58')](_0xea26('0x41'))){_0xea0bb1[_0xea26('0x2b')]=qs[_0xea26('0x2b')](_0x2ccd4e[_0xea26('0x3b')][_0xea26('0x2b')]);_0xea0bb1[_0xea26('0x42')]=qs['offset'](_0x2ccd4e[_0xea26('0x3b')][_0xea26('0x42')]);}return _0xc679ff[_0xea26('0x55')](_0xea0bb1);}})[_0xea26('0x30')](function(_0x1c8c79){if(_0x1c8c79){return _0x1c8c79?{'count':_0x44dfec,'rows':_0x1c8c79}:null;}})[_0xea26('0x30')](respondWithResult(_0x287d2d,null))[_0xea26('0x26')](handleError(_0x287d2d,null));};exports['getDescriptions']=function(_0x395ff6,_0xe3d694,_0x399df4){var _0x5bc8b7={};var _0x220a52={};var _0x3abaf6;var _0x1a7266;return db[_0xea26('0x36')][_0xea26('0x56')]({'where':{'id':_0x395ff6['params']['id']}})[_0xea26('0x30')](handleEntityNotFound(_0xe3d694,null))[_0xea26('0x30')](function(_0x4b1109){if(_0x4b1109){_0x3abaf6=_0x4b1109;_0x220a52[_0xea26('0x39')]=_['keys'](db[_0xea26('0x57')][_0xea26('0x37')]);_0x220a52[_0xea26('0x3b')]=_[_0xea26('0x3a')](_0x395ff6[_0xea26('0x3b')]);_0x220a52[_0xea26('0x3c')]=_[_0xea26('0x3d')](_0x220a52[_0xea26('0x39')],_0x220a52[_0xea26('0x3b')]);_0x5bc8b7[_0xea26('0x3f')]=_[_0xea26('0x3d')](_0x220a52['model'],qs['fields'](_0x395ff6[_0xea26('0x3b')][_0xea26('0x3e')]));_0x5bc8b7[_0xea26('0x3f')]=_0x5bc8b7[_0xea26('0x3f')][_0xea26('0x40')]?_0x5bc8b7[_0xea26('0x3f')]:_0x220a52[_0xea26('0x39')];_0x5bc8b7[_0xea26('0x43')]=qs[_0xea26('0x44')](_0x395ff6[_0xea26('0x3b')][_0xea26('0x44')]);_0x5bc8b7[_0xea26('0x45')]=qs['filters'](_['pick'](_0x395ff6[_0xea26('0x3b')],_0x220a52[_0xea26('0x3c')]));if(_0x395ff6[_0xea26('0x3b')][_0xea26('0x4a')]){_0x5bc8b7[_0xea26('0x45')]=_[_0xea26('0x47')](_0x5bc8b7[_0xea26('0x45')],{'$or':_['map'](_0x5bc8b7[_0xea26('0x3f')],function(_0x311c20){var _0x41df81={};_0x41df81[_0x311c20]={'$like':'%'+_0x395ff6[_0xea26('0x3b')][_0xea26('0x4a')]+'%'};return _0x41df81;})});}_0x5bc8b7=_[_0xea26('0x47')]({},_0x5bc8b7,_0x395ff6[_0xea26('0x4b')]);return _0x3abaf6[_0xea26('0x59')](_0x5bc8b7);}})[_0xea26('0x30')](function(_0x1cb6ca){if(_0x1cb6ca){_0x1a7266=_0x1cb6ca[_0xea26('0x40')];if(!_0x395ff6['query']['hasOwnProperty'](_0xea26('0x41'))){_0x5bc8b7['limit']=qs['limit'](_0x395ff6['query'][_0xea26('0x2b')]);_0x5bc8b7[_0xea26('0x42')]=qs['offset'](_0x395ff6['query'][_0xea26('0x42')]);}return _0x3abaf6[_0xea26('0x59')](_0x5bc8b7);}})[_0xea26('0x30')](function(_0x1f2c59){if(_0x1f2c59){return _0x1f2c59?{'count':_0x1a7266,'rows':_0x1f2c59}:null;}})[_0xea26('0x30')](respondWithResult(_0xe3d694,null))[_0xea26('0x26')](handleError(_0xe3d694,null));};exports[_0xea26('0x5a')]=function(_0x7fa9fe,_0x36d11e,_0x34df5d){var _0x10d915={};var _0x2d4185={};var _0x3db248;var _0x3e373d;return db[_0xea26('0x36')]['findOne']({'where':{'id':_0x7fa9fe[_0xea26('0x54')]['id']}})[_0xea26('0x30')](handleEntityNotFound(_0x36d11e,null))[_0xea26('0x30')](function(_0x433936){if(_0x433936){_0x3db248=_0x433936;_0x2d4185['model']=_[_0xea26('0x3a')](db[_0xea26('0x57')][_0xea26('0x37')]);_0x2d4185[_0xea26('0x3b')]=_[_0xea26('0x3a')](_0x7fa9fe[_0xea26('0x3b')]);_0x2d4185[_0xea26('0x3c')]=_[_0xea26('0x3d')](_0x2d4185[_0xea26('0x39')],_0x2d4185[_0xea26('0x3b')]);_0x10d915[_0xea26('0x3f')]=_['intersection'](_0x2d4185[_0xea26('0x39')],qs['fields'](_0x7fa9fe[_0xea26('0x3b')][_0xea26('0x3e')]));_0x10d915[_0xea26('0x3f')]=_0x10d915[_0xea26('0x3f')][_0xea26('0x40')]?_0x10d915[_0xea26('0x3f')]:_0x2d4185[_0xea26('0x39')];_0x10d915[_0xea26('0x43')]=qs[_0xea26('0x44')](_0x7fa9fe['query']['sort']);_0x10d915[_0xea26('0x45')]=qs[_0xea26('0x3c')](_[_0xea26('0x46')](_0x7fa9fe[_0xea26('0x3b')],_0x2d4185[_0xea26('0x3c')]));if(_0x7fa9fe[_0xea26('0x3b')]['filter']){_0x10d915[_0xea26('0x45')]=_[_0xea26('0x47')](_0x10d915[_0xea26('0x45')],{'$or':_[_0xea26('0x35')](_0x10d915[_0xea26('0x3f')],function(_0x6e6047){var _0x34fdee={};_0x34fdee[_0x6e6047]={'$like':'%'+_0x7fa9fe['query'][_0xea26('0x4a')]+'%'};return _0x34fdee;})});}_0x10d915=_['merge']({},_0x10d915,_0x7fa9fe[_0xea26('0x4b')]);return _0x3db248[_0xea26('0x5a')](_0x10d915);}})[_0xea26('0x30')](function(_0x1cd6a8){if(_0x1cd6a8){_0x3e373d=_0x1cd6a8[_0xea26('0x40')];if(!_0x7fa9fe[_0xea26('0x3b')][_0xea26('0x58')](_0xea26('0x41'))){_0x10d915[_0xea26('0x2b')]=qs[_0xea26('0x2b')](_0x7fa9fe[_0xea26('0x3b')]['limit']);_0x10d915[_0xea26('0x42')]=qs[_0xea26('0x42')](_0x7fa9fe['query']['offset']);}return _0x3db248['getFields'](_0x10d915);}})[_0xea26('0x30')](function(_0x4e5fa9){if(_0x4e5fa9){return _0x4e5fa9?{'count':_0x3e373d,'rows':_0x4e5fa9}:null;}})['then'](respondWithResult(_0x36d11e,null))[_0xea26('0x26')](handleError(_0x36d11e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 3a61c05..cc61129 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 _0x5c00=['moment','request-promise','path','rimraf','../../config/environment','exports','define','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0xda09dd,_0x1b5d49){var _0x4a7872=function(_0x2c897d){while(--_0x2c897d){_0xda09dd['push'](_0xda09dd['shift']());}};_0x4a7872(++_0x1b5d49);}(_0x5c00,0x17e));var _0x05c0=function(_0x2d6f29,_0x2f6366){_0x2d6f29=_0x2d6f29-0x0;var _0x291f5a=_0x5c00[_0x2d6f29];return _0x291f5a;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c59=['int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x57426f,_0x52f0d3){var _0xe15733=function(_0x11bd27){while(--_0x11bd27){_0x57426f['push'](_0x57426f['shift']());}};_0xe15733(++_0x52f0d3);}(_0x2c59,0x16c));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x92c5('0x0'));var util=require('util');var logger=require(_0x92c5('0x1'))(_0x92c5('0x2'));var moment=require(_0x92c5('0x3'));var BPromise=require(_0x92c5('0x4'));var rp=require(_0x92c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92c5('0x6'));var config=require(_0x92c5('0x7'));var attributes=require(_0x92c5('0x8'));module['exports']=function(_0x4cf76d,_0x59cf6a){return _0x4cf76d[_0x92c5('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x92c5('0xa'),'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 978ed8a..26c61d1 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 _0xcd31=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd31,0x15d));var _0x1cd3=function(_0x4df017,_0x2b1ce7){_0x4df017=_0x4df017-0x0;var _0x4f440d=_0xcd31[_0x4df017];return _0x4f440d;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require(_0x1cd3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd3('0x3'));var db=require(_0x1cd3('0x4'))['db'];var utils=require(_0x1cd3('0x5'));var logger=require(_0x1cd3('0x6'))(_0x1cd3('0x7'));var config=require(_0x1cd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1cd3('0x9')][_0x1cd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xedb6d1,_0x49d849,_0x45cc24){return new BPromise(function(_0x11b139,_0x124659){return client['request'](_0xedb6d1,_0x45cc24)[_0x1cd3('0xb')](function(_0x3953d3){logger[_0x1cd3('0xc')](_0x1cd3('0xd'),_0x49d849,_0x1cd3('0xe'));logger[_0x1cd3('0xf')](_0x1cd3('0x10'),_0x49d849,'request\x20sent',JSON[_0x1cd3('0x11')](_0x3953d3));if(_0x3953d3[_0x1cd3('0x12')]){if(_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x13')]===0x1f4){logger['error'](_0x1cd3('0xd'),_0x49d849,_0x3953d3['error'][_0x1cd3('0x14')]);return _0x124659(_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x14')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x49d849,_0x3953d3[_0x1cd3('0x12')][_0x1cd3('0x14')]);return _0x11b139(_0x3953d3[_0x1cd3('0x12')]['message']);}else{logger[_0x1cd3('0xc')](_0x1cd3('0xd'),_0x49d849,_0x1cd3('0xe'));_0x11b139(_0x3953d3[_0x1cd3('0x15')]['message']);}})['catch'](function(_0x5531c5){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x49d849,_0x5531c5);_0x124659(_0x5531c5);});});} \ No newline at end of file +var _0x0efe=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird'];(function(_0x481ee1,_0x4a2684){var _0x904c27=function(_0x243078){while(--_0x243078){_0x481ee1['push'](_0x481ee1['shift']());}};_0x904c27(++_0x4a2684);}(_0x0efe,0x110));var _0xe0ef=function(_0x559acf,_0x49f635){_0x559acf=_0x559acf-0x0;var _0x1c46a8=_0x0efe[_0x559acf];return _0x1c46a8;};'use strict';var _=require(_0xe0ef('0x0'));var util=require(_0xe0ef('0x1'));var moment=require('moment');var BPromise=require(_0xe0ef('0x2'));var rs=require(_0xe0ef('0x3'));var fs=require('fs');var Redis=require(_0xe0ef('0x4'));var db=require(_0xe0ef('0x5'))['db'];var utils=require(_0xe0ef('0x6'));var logger=require(_0xe0ef('0x7'))(_0xe0ef('0x8'));var config=require(_0xe0ef('0x9'));var jayson=require(_0xe0ef('0xa'));var client=jayson[_0xe0ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49643a,_0x3a6030,_0x1a57fb){return new BPromise(function(_0x161f87,_0xa4f9be){return client[_0xe0ef('0xc')](_0x49643a,_0x1a57fb)[_0xe0ef('0xd')](function(_0x18f982){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3a6030,_0xe0ef('0xe'));logger[_0xe0ef('0xf')](_0xe0ef('0x10'),_0x3a6030,'request\x20sent',JSON[_0xe0ef('0x11')](_0x18f982));if(_0x18f982[_0xe0ef('0x12')]){if(_0x18f982['error'][_0xe0ef('0x13')]===0x1f4){logger['error'](_0xe0ef('0x14'),_0x3a6030,_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);return _0xa4f9be(_0x18f982['error']['message']);}logger[_0xe0ef('0x12')](_0xe0ef('0x14'),_0x3a6030,_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);return _0x161f87(_0x18f982[_0xe0ef('0x12')][_0xe0ef('0x15')]);}else{logger[_0xe0ef('0x16')](_0xe0ef('0x14'),_0x3a6030,'request\x20sent');_0x161f87(_0x18f982[_0xe0ef('0x17')][_0xe0ef('0x15')]);}})[_0xe0ef('0x18')](function(_0xe9b6d4){logger[_0xe0ef('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3a6030,_0xe9b6d4);_0xa4f9be(_0xe9b6d4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 6028f76..c4d9055 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 _0x7a66=['/:id','show','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a66,0x183));var _0x67a6=function(_0x223400,_0x29a1e0){_0x223400=_0x223400-0x0;var _0xcec92e=_0x7a66[_0x223400];return _0xcec92e;};'use strict';var multer=require(_0x67a6('0x0'));var util=require('util');var path=require(_0x67a6('0x1'));var timeout=require(_0x67a6('0x2'));var express=require(_0x67a6('0x3'));var router=express[_0x67a6('0x4')]();var auth=require(_0x67a6('0x5'));var interaction=require(_0x67a6('0x6'));var config=require(_0x67a6('0x7'));var controller=require(_0x67a6('0x8'));router[_0x67a6('0x9')]('/',auth[_0x67a6('0xa')](),controller[_0x67a6('0xb')]);router[_0x67a6('0x9')](_0x67a6('0xc'),auth[_0x67a6('0xa')](),controller[_0x67a6('0xd')]);router[_0x67a6('0xe')]('/',auth[_0x67a6('0xa')](),controller[_0x67a6('0xf')]);router['put'](_0x67a6('0xc'),auth[_0x67a6('0xa')](),controller['update']);router[_0x67a6('0x10')](_0x67a6('0xc'),auth[_0x67a6('0xa')](),controller[_0x67a6('0x11')]);module[_0x67a6('0x12')]=router; \ No newline at end of file +var _0xd095=['get','isAuthenticated','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x317e30,_0x32ad66){var _0x203788=function(_0x264d38){while(--_0x264d38){_0x317e30['push'](_0x317e30['shift']());}};_0x203788(++_0x32ad66);}(_0xd095,0x97));var _0x5d09=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xd095[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0x5d09('0x0'));var util=require(_0x5d09('0x1'));var path=require(_0x5d09('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d09('0x3'));var router=express[_0x5d09('0x4')]();var auth=require(_0x5d09('0x5'));var interaction=require(_0x5d09('0x6'));var config=require(_0x5d09('0x7'));var controller=require(_0x5d09('0x8'));router[_0x5d09('0x9')]('/',auth[_0x5d09('0xa')](),controller['index']);router[_0x5d09('0x9')]('/:id',auth[_0x5d09('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5d09('0xb')]);router[_0x5d09('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x5d09('0xd')]);router[_0x5d09('0xe')]('/:id',auth[_0x5d09('0xa')](),controller['destroy']);module[_0x5d09('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 6db6fa7..f2208df 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 _0x4d2f=['keyValue','ENUM','STRING','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x3ca444,_0x624c1d){var _0x4eaf38=function(_0x9fe9ef){while(--_0x9fe9ef){_0x3ca444['push'](_0x3ca444['shift']());}};_0x4eaf38(++_0x624c1d);}(_0x4d2f,0x19c));var _0xf4d2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d2f[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xf4d2('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf4d2('0x1'),_0xf4d2('0x2'),_0xf4d2('0x3'),_0xf4d2('0x4')),'defaultValue':_0xf4d2('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf4d2('0x5')](_0xf4d2('0x1'),_0xf4d2('0x2'),_0xf4d2('0x3'))},'keyContent':{'type':Sequelize[_0xf4d2('0x6')]},'idField':{'type':Sequelize[_0xf4d2('0x6')]},'nameField':{'type':Sequelize[_0xf4d2('0x6')]},'customField':{'type':Sequelize[_0xf4d2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf4d2('0x6')]}}; \ No newline at end of file +var _0x04cc=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x04cc,0x10d));var _0xc04c=function(_0x2a990c,_0x241e85){_0x2a990c=_0x2a990c-0x0;var _0x47d328=_0x04cc[_0x2a990c];return _0x47d328;};'use strict';var Sequelize=require(_0xc04c('0x0'));module[_0xc04c('0x1')]={'type':{'type':Sequelize[_0xc04c('0x2')]('string',_0xc04c('0x3'),_0xc04c('0x4'),_0xc04c('0x5')),'defaultValue':_0xc04c('0x6')},'content':{'type':Sequelize[_0xc04c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc04c('0x2')]('string',_0xc04c('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc04c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc04c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc04c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0e9569c..68fc442 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 _0x13f5=['then','sendStatus','stack','name','index','map','FreshsalesField','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','merge','where','options','findAll','rows','catch','keys','include','find','create','update','body','params','destroy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','apply','reject','save'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x13f5,0x1c9));var _0x513f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x13f5[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x513f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x513f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x513f('0x2'));var rp=require(_0x513f('0x3'));var moment=require(_0x513f('0x4'));var BPromise=require(_0x513f('0x5'));var Mustache=require('mustache');var util=require(_0x513f('0x6'));var path=require(_0x513f('0x7'));var sox=require(_0x513f('0x8'));var csv=require(_0x513f('0x9'));var ejs=require(_0x513f('0xa'));var fs=require('fs');var _=require(_0x513f('0xb'));var squel=require('squel');var crypto=require(_0x513f('0xc'));var jsforce=require(_0x513f('0xd'));var deskjs=require(_0x513f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x513f('0xf'));var Papa=require(_0x513f('0x10'));var Redis=require('ioredis');var authService=require(_0x513f('0x11'));var qs=require(_0x513f('0x12'));var as=require(_0x513f('0x13'));var hardwareService=require(_0x513f('0x14'));var logger=require(_0x513f('0x15'))(_0x513f('0x16'));var utils=require(_0x513f('0x17'));var config=require(_0x513f('0x18'));var db=require(_0x513f('0x19'))['db'];function respondWithStatusCode(_0x2fd400,_0x37a6ff){_0x37a6ff=_0x37a6ff||0xcc;return function(_0x1f2f7d){if(_0x1f2f7d){return _0x2fd400['sendStatus'](_0x37a6ff);}return _0x2fd400[_0x513f('0x1a')](_0x37a6ff)[_0x513f('0x1b')]();};}function respondWithResult(_0x5abcad,_0x3fec3e){_0x3fec3e=_0x3fec3e||0xc8;return function(_0x3c8f2f){if(_0x3c8f2f){return _0x5abcad[_0x513f('0x1a')](_0x3fec3e)['json'](_0x3c8f2f);}};}function respondWithFilteredResult(_0x53f390,_0x462fcd){return function(_0x5cc54a){if(_0x5cc54a){var _0x35e88c=_0x5cc54a[_0x513f('0x1c')],_0x59f238=_0x462fcd[_0x513f('0x1d')],_0x3c1b8e=_0x462fcd[_0x513f('0x1d')]+_0x462fcd['limit'],_0x1c97f5;if(_0x3c1b8e>=_0x35e88c){_0x3c1b8e=_0x35e88c;_0x1c97f5=0xc8;}else{_0x1c97f5=0xce;}_0x53f390[_0x513f('0x1a')](_0x1c97f5);return _0x53f390['set']('Content-Range',_0x59f238+'-'+_0x3c1b8e+'/'+_0x35e88c)['json'](_0x5cc54a);}return null;};}function patchUpdates(_0x12ee3d){return function(_0x27c52f){try{jsonpatch[_0x513f('0x1e')](_0x27c52f,_0x12ee3d,!![]);}catch(_0x1349aa){return BPromise[_0x513f('0x1f')](_0x1349aa);}return _0x27c52f[_0x513f('0x20')]();};}function saveUpdates(_0x33ef4d,_0x1679ab){return function(_0x41e72d){if(_0x41e72d){return _0x41e72d['update'](_0x33ef4d)[_0x513f('0x21')](function(_0x51f7bc){return _0x51f7bc;});}return null;};}function removeEntity(_0x453346,_0x36bd49){return function(_0x2f6742){if(_0x2f6742){return _0x2f6742['destroy']()[_0x513f('0x21')](function(){_0x453346[_0x513f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f47da,_0x4ebf9d){return function(_0x507efc){if(!_0x507efc){_0x1f47da[_0x513f('0x22')](0x194);}return _0x507efc;};}function handleError(_0x1087dc,_0x268b09){_0x268b09=_0x268b09||0x1f4;return function(_0x2a0c72){logger['error'](_0x2a0c72[_0x513f('0x23')]);if(_0x2a0c72[_0x513f('0x24')]){delete _0x2a0c72[_0x513f('0x24')];}_0x1087dc[_0x513f('0x1a')](_0x268b09)['send'](_0x2a0c72);};}exports[_0x513f('0x25')]=function(_0x47b154,_0x40af0b){var _0x5bb5d7={},_0x40d39b={},_0x11d0b4={'count':0x0,'rows':[]};var _0x27c777=_[_0x513f('0x26')](db[_0x513f('0x27')][_0x513f('0x28')],function(_0x47e5d0){return{'name':_0x47e5d0['fieldName'],'type':_0x47e5d0[_0x513f('0x29')][_0x513f('0x2a')]};});_0x40d39b[_0x513f('0x2b')]=_[_0x513f('0x26')](_0x27c777,'name');_0x40d39b[_0x513f('0x2c')]=_['keys'](_0x47b154[_0x513f('0x2c')]);_0x40d39b['filters']=_[_0x513f('0x2d')](_0x40d39b[_0x513f('0x2b')],_0x40d39b[_0x513f('0x2c')]);_0x5bb5d7[_0x513f('0x2e')]=_['intersection'](_0x40d39b[_0x513f('0x2b')],qs[_0x513f('0x2f')](_0x47b154[_0x513f('0x2c')][_0x513f('0x2f')]));_0x5bb5d7[_0x513f('0x2e')]=_0x5bb5d7[_0x513f('0x2e')][_0x513f('0x30')]?_0x5bb5d7['attributes']:_0x40d39b['model'];if(!_0x47b154[_0x513f('0x2c')][_0x513f('0x31')](_0x513f('0x32'))){_0x5bb5d7['limit']=qs[_0x513f('0x33')](_0x47b154[_0x513f('0x2c')]['limit']);_0x5bb5d7[_0x513f('0x1d')]=qs[_0x513f('0x1d')](_0x47b154[_0x513f('0x2c')]['offset']);}_0x5bb5d7['order']=qs[_0x513f('0x34')](_0x47b154[_0x513f('0x2c')][_0x513f('0x34')]);_0x5bb5d7['where']=qs[_0x513f('0x35')](_[_0x513f('0x36')](_0x47b154['query'],_0x40d39b[_0x513f('0x35')]),_0x27c777);if(_0x47b154[_0x513f('0x2c')][_0x513f('0x37')]){_0x5bb5d7['where']=_[_0x513f('0x38')](_0x5bb5d7[_0x513f('0x39')],{'$or':_['map'](_0x27c777,function(_0x2e61b2){if(_0x2e61b2[_0x513f('0x29')]!=='VIRTUAL'){var _0x587fd4={};_0x587fd4[_0x2e61b2[_0x513f('0x24')]]={'$like':'%'+_0x47b154[_0x513f('0x2c')][_0x513f('0x37')]+'%'};return _0x587fd4;}})});}_0x5bb5d7=_[_0x513f('0x38')]({},_0x5bb5d7,_0x47b154[_0x513f('0x3a')]);var _0xa545f5={'where':_0x5bb5d7[_0x513f('0x39')]};return db[_0x513f('0x27')][_0x513f('0x1c')](_0xa545f5)[_0x513f('0x21')](function(_0x529bda){_0x11d0b4['count']=_0x529bda;if(_0x47b154['query']['includeAll']){_0x5bb5d7['include']=[{'all':!![]}];}return db[_0x513f('0x27')][_0x513f('0x3b')](_0x5bb5d7);})[_0x513f('0x21')](function(_0x2613f4){_0x11d0b4[_0x513f('0x3c')]=_0x2613f4;return _0x11d0b4;})[_0x513f('0x21')](respondWithFilteredResult(_0x40af0b,_0x5bb5d7))[_0x513f('0x3d')](handleError(_0x40af0b,null));};exports['show']=function(_0x508820,_0x1b3fac){var _0x52763b={'raw':!![],'where':{'id':_0x508820['params']['id']}},_0x28a34a={};_0x28a34a['model']=_[_0x513f('0x3e')](db[_0x513f('0x27')][_0x513f('0x28')]);_0x28a34a[_0x513f('0x2c')]=_[_0x513f('0x3e')](_0x508820[_0x513f('0x2c')]);_0x28a34a[_0x513f('0x35')]=_[_0x513f('0x2d')](_0x28a34a[_0x513f('0x2b')],_0x28a34a['query']);_0x52763b[_0x513f('0x2e')]=_[_0x513f('0x2d')](_0x28a34a[_0x513f('0x2b')],qs[_0x513f('0x2f')](_0x508820[_0x513f('0x2c')][_0x513f('0x2f')]));_0x52763b[_0x513f('0x2e')]=_0x52763b[_0x513f('0x2e')][_0x513f('0x30')]?_0x52763b[_0x513f('0x2e')]:_0x28a34a[_0x513f('0x2b')];if(_0x508820['query']['includeAll']){_0x52763b[_0x513f('0x3f')]=[{'all':!![]}];}_0x52763b=_[_0x513f('0x38')]({},_0x52763b,_0x508820[_0x513f('0x3a')]);return db['FreshsalesField'][_0x513f('0x40')](_0x52763b)[_0x513f('0x21')](handleEntityNotFound(_0x1b3fac,null))[_0x513f('0x21')](respondWithResult(_0x1b3fac,null))[_0x513f('0x3d')](handleError(_0x1b3fac,null));};exports[_0x513f('0x41')]=function(_0x5312da,_0xbe93e0){return db['FreshsalesField'][_0x513f('0x41')](_0x5312da['body'],{})[_0x513f('0x21')](respondWithResult(_0xbe93e0,0xc9))['catch'](handleError(_0xbe93e0,null));};exports[_0x513f('0x42')]=function(_0x2f0487,_0x37e8c4){if(_0x2f0487[_0x513f('0x43')]['id']){delete _0x2f0487['body']['id'];}return db[_0x513f('0x27')]['find']({'where':{'id':_0x2f0487[_0x513f('0x44')]['id']}})['then'](handleEntityNotFound(_0x37e8c4,null))[_0x513f('0x21')](saveUpdates(_0x2f0487['body'],null))[_0x513f('0x21')](respondWithResult(_0x37e8c4,null))[_0x513f('0x3d')](handleError(_0x37e8c4,null));};exports[_0x513f('0x45')]=function(_0x3bb67d,_0x439cac){return db['FreshsalesField'][_0x513f('0x40')]({'where':{'id':_0x3bb67d[_0x513f('0x44')]['id']}})['then'](handleEntityNotFound(_0x439cac,null))[_0x513f('0x21')](removeEntity(_0x439cac,null))[_0x513f('0x3d')](handleError(_0x439cac,null));}; \ No newline at end of file +var _0x28dd=['pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','include','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x36dafa,_0x150e86){var _0xbbe36f=function(_0x2fbb22){while(--_0x2fbb22){_0x36dafa['push'](_0x36dafa['shift']());}};_0xbbe36f(++_0x150e86);}(_0x28dd,0x181));var _0xd28d=function(_0x7d78f,_0x22d980){_0x7d78f=_0x7d78f-0x0;var _0x1005c3=_0x28dd[_0x7d78f];return _0x1005c3;};'use strict';var pdf=require(_0xd28d('0x0'));var emlformat=require(_0xd28d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd28d('0x2'));var jsonpatch=require(_0xd28d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd28d('0x4'));var path=require(_0xd28d('0x5'));var sox=require('sox');var csv=require(_0xd28d('0x6'));var ejs=require(_0xd28d('0x7'));var fs=require('fs');var _=require(_0xd28d('0x8'));var squel=require(_0xd28d('0x9'));var crypto=require('crypto');var jsforce=require(_0xd28d('0xa'));var deskjs=require(_0xd28d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd28d('0xc'));var Papa=require(_0xd28d('0xd'));var Redis=require(_0xd28d('0xe'));var authService=require(_0xd28d('0xf'));var qs=require(_0xd28d('0x10'));var as=require(_0xd28d('0x11'));var hardwareService=require(_0xd28d('0x12'));var logger=require(_0xd28d('0x13'))(_0xd28d('0x14'));var utils=require('../../config/utils');var config=require(_0xd28d('0x15'));var db=require(_0xd28d('0x16'))['db'];function respondWithStatusCode(_0x5c77f7,_0x41713c){_0x41713c=_0x41713c||0xcc;return function(_0x163bab){if(_0x163bab){return _0x5c77f7[_0xd28d('0x17')](_0x41713c);}return _0x5c77f7[_0xd28d('0x18')](_0x41713c)[_0xd28d('0x19')]();};}function respondWithResult(_0x37cea4,_0x43cf66){_0x43cf66=_0x43cf66||0xc8;return function(_0x33e9ee){if(_0x33e9ee){return _0x37cea4[_0xd28d('0x18')](_0x43cf66)[_0xd28d('0x1a')](_0x33e9ee);}};}function respondWithFilteredResult(_0x3b7f3c,_0x60df8a){return function(_0xcbd27a){if(_0xcbd27a){var _0x1c10d4=_0xcbd27a[_0xd28d('0x1b')],_0x5aaa7c=_0x60df8a['offset'],_0x5f0866=_0x60df8a[_0xd28d('0x1c')]+_0x60df8a[_0xd28d('0x1d')],_0x29991c;if(_0x5f0866>=_0x1c10d4){_0x5f0866=_0x1c10d4;_0x29991c=0xc8;}else{_0x29991c=0xce;}_0x3b7f3c['status'](_0x29991c);return _0x3b7f3c[_0xd28d('0x1e')](_0xd28d('0x1f'),_0x5aaa7c+'-'+_0x5f0866+'/'+_0x1c10d4)[_0xd28d('0x1a')](_0xcbd27a);}return null;};}function patchUpdates(_0x128150){return function(_0x57ad04){try{jsonpatch[_0xd28d('0x20')](_0x57ad04,_0x128150,!![]);}catch(_0x3a6098){return BPromise[_0xd28d('0x21')](_0x3a6098);}return _0x57ad04[_0xd28d('0x22')]();};}function saveUpdates(_0x321614,_0x2d1c57){return function(_0x4b8fba){if(_0x4b8fba){return _0x4b8fba[_0xd28d('0x23')](_0x321614)[_0xd28d('0x24')](function(_0x577f48){return _0x577f48;});}return null;};}function removeEntity(_0x6abf4a,_0x843704){return function(_0x101e9d){if(_0x101e9d){return _0x101e9d[_0xd28d('0x25')]()[_0xd28d('0x24')](function(){_0x6abf4a[_0xd28d('0x18')](0xcc)[_0xd28d('0x19')]();});}};}function handleEntityNotFound(_0x5e0c15,_0x21b7c7){return function(_0x18bfc0){if(!_0x18bfc0){_0x5e0c15[_0xd28d('0x17')](0x194);}return _0x18bfc0;};}function handleError(_0x12753a,_0x40d2bf){_0x40d2bf=_0x40d2bf||0x1f4;return function(_0x490e8f){logger['error'](_0x490e8f[_0xd28d('0x26')]);if(_0x490e8f[_0xd28d('0x27')]){delete _0x490e8f[_0xd28d('0x27')];}_0x12753a[_0xd28d('0x18')](_0x40d2bf)[_0xd28d('0x28')](_0x490e8f);};}exports[_0xd28d('0x29')]=function(_0x3a46f9,_0x41c717){var _0x58ff3f={},_0x3c27bd={},_0x314353={'count':0x0,'rows':[]};var _0xb77954=_[_0xd28d('0x2a')](db[_0xd28d('0x2b')][_0xd28d('0x2c')],function(_0x409400){return{'name':_0x409400[_0xd28d('0x2d')],'type':_0x409400['type'][_0xd28d('0x2e')]};});_0x3c27bd[_0xd28d('0x2f')]=_['map'](_0xb77954,_0xd28d('0x27'));_0x3c27bd[_0xd28d('0x30')]=_[_0xd28d('0x31')](_0x3a46f9[_0xd28d('0x30')]);_0x3c27bd[_0xd28d('0x32')]=_[_0xd28d('0x33')](_0x3c27bd[_0xd28d('0x2f')],_0x3c27bd[_0xd28d('0x30')]);_0x58ff3f[_0xd28d('0x34')]=_['intersection'](_0x3c27bd[_0xd28d('0x2f')],qs[_0xd28d('0x35')](_0x3a46f9['query'][_0xd28d('0x35')]));_0x58ff3f[_0xd28d('0x34')]=_0x58ff3f['attributes'][_0xd28d('0x36')]?_0x58ff3f['attributes']:_0x3c27bd[_0xd28d('0x2f')];if(!_0x3a46f9[_0xd28d('0x30')][_0xd28d('0x37')](_0xd28d('0x38'))){_0x58ff3f['limit']=qs['limit'](_0x3a46f9[_0xd28d('0x30')]['limit']);_0x58ff3f['offset']=qs[_0xd28d('0x1c')](_0x3a46f9[_0xd28d('0x30')][_0xd28d('0x1c')]);}_0x58ff3f['order']=qs[_0xd28d('0x39')](_0x3a46f9[_0xd28d('0x30')][_0xd28d('0x39')]);_0x58ff3f[_0xd28d('0x3a')]=qs[_0xd28d('0x32')](_[_0xd28d('0x3b')](_0x3a46f9[_0xd28d('0x30')],_0x3c27bd[_0xd28d('0x32')]),_0xb77954);if(_0x3a46f9['query'][_0xd28d('0x3c')]){_0x58ff3f[_0xd28d('0x3a')]=_[_0xd28d('0x3d')](_0x58ff3f[_0xd28d('0x3a')],{'$or':_[_0xd28d('0x2a')](_0xb77954,function(_0x1d13a8){if(_0x1d13a8[_0xd28d('0x3e')]!==_0xd28d('0x3f')){var _0x4205b9={};_0x4205b9[_0x1d13a8[_0xd28d('0x27')]]={'$like':'%'+_0x3a46f9['query'][_0xd28d('0x3c')]+'%'};return _0x4205b9;}})});}_0x58ff3f=_['merge']({},_0x58ff3f,_0x3a46f9[_0xd28d('0x40')]);var _0x3fb4a8={'where':_0x58ff3f['where']};return db[_0xd28d('0x2b')]['count'](_0x3fb4a8)[_0xd28d('0x24')](function(_0x2f62c7){_0x314353['count']=_0x2f62c7;if(_0x3a46f9[_0xd28d('0x30')][_0xd28d('0x41')]){_0x58ff3f['include']=[{'all':!![]}];}return db[_0xd28d('0x2b')]['findAll'](_0x58ff3f);})['then'](function(_0x5bf0fe){_0x314353[_0xd28d('0x42')]=_0x5bf0fe;return _0x314353;})['then'](respondWithFilteredResult(_0x41c717,_0x58ff3f))[_0xd28d('0x43')](handleError(_0x41c717,null));};exports[_0xd28d('0x44')]=function(_0x36a6c5,_0x42df73){var _0xd92e8={'raw':!![],'where':{'id':_0x36a6c5['params']['id']}},_0x4905cf={};_0x4905cf['model']=_[_0xd28d('0x31')](db[_0xd28d('0x2b')][_0xd28d('0x2c')]);_0x4905cf['query']=_[_0xd28d('0x31')](_0x36a6c5[_0xd28d('0x30')]);_0x4905cf[_0xd28d('0x32')]=_[_0xd28d('0x33')](_0x4905cf[_0xd28d('0x2f')],_0x4905cf[_0xd28d('0x30')]);_0xd92e8['attributes']=_['intersection'](_0x4905cf['model'],qs[_0xd28d('0x35')](_0x36a6c5[_0xd28d('0x30')][_0xd28d('0x35')]));_0xd92e8[_0xd28d('0x34')]=_0xd92e8['attributes'][_0xd28d('0x36')]?_0xd92e8['attributes']:_0x4905cf[_0xd28d('0x2f')];if(_0x36a6c5['query'][_0xd28d('0x41')]){_0xd92e8[_0xd28d('0x45')]=[{'all':!![]}];}_0xd92e8=_[_0xd28d('0x3d')]({},_0xd92e8,_0x36a6c5[_0xd28d('0x40')]);return db[_0xd28d('0x2b')][_0xd28d('0x46')](_0xd92e8)['then'](handleEntityNotFound(_0x42df73,null))[_0xd28d('0x24')](respondWithResult(_0x42df73,null))[_0xd28d('0x43')](handleError(_0x42df73,null));};exports[_0xd28d('0x47')]=function(_0x1ec628,_0x2164e2){return db[_0xd28d('0x2b')]['create'](_0x1ec628[_0xd28d('0x48')],{})['then'](respondWithResult(_0x2164e2,0xc9))[_0xd28d('0x43')](handleError(_0x2164e2,null));};exports[_0xd28d('0x23')]=function(_0x231181,_0x31d2ac){if(_0x231181[_0xd28d('0x48')]['id']){delete _0x231181[_0xd28d('0x48')]['id'];}return db[_0xd28d('0x2b')]['find']({'where':{'id':_0x231181[_0xd28d('0x49')]['id']}})['then'](handleEntityNotFound(_0x31d2ac,null))[_0xd28d('0x24')](saveUpdates(_0x231181[_0xd28d('0x48')],null))[_0xd28d('0x24')](respondWithResult(_0x31d2ac,null))['catch'](handleError(_0x31d2ac,null));};exports[_0xd28d('0x25')]=function(_0x50f875,_0x35b9af){return db[_0xd28d('0x2b')][_0xd28d('0x46')]({'where':{'id':_0x50f875[_0xd28d('0x49')]['id']}})[_0xd28d('0x24')](handleEntityNotFound(_0x35b9af,null))[_0xd28d('0x24')](removeEntity(_0x35b9af,null))[_0xd28d('0x43')](handleError(_0x35b9af,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e7b9f51..89a7f8e 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 _0x3166=['rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x5af59e,_0x3771c1){var _0x4240df=function(_0x2267fd){while(--_0x2267fd){_0x5af59e['push'](_0x5af59e['shift']());}};_0x4240df(++_0x3771c1);}(_0x3166,0x174));var _0x6316=function(_0x5819fe,_0x350543){_0x5819fe=_0x5819fe-0x0;var _0x2be656=_0x3166[_0x5819fe];return _0x2be656;};'use strict';var _=require(_0x6316('0x0'));var util=require('util');var logger=require(_0x6316('0x1'))(_0x6316('0x2'));var moment=require(_0x6316('0x3'));var BPromise=require(_0x6316('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6316('0x5'));var rimraf=require(_0x6316('0x6'));var config=require(_0x6316('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x6316('0x8')]=function(_0x4bf633,_0x5d7b0c){return _0x4bf633[_0x6316('0x9')](_0x6316('0xa'),attributes,{'tableName':_0x6316('0xb'),'paranoid':![],'indexes':[{'name':_0x6316('0xc'),'fields':[_0x6316('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f3c=['idField','FieldId','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x366279,_0x209a2b){var _0x3d11b1=function(_0x2541ae){while(--_0x2541ae){_0x366279['push'](_0x366279['shift']());}};_0x3d11b1(++_0x209a2b);}(_0x7f3c,0x16a));var _0xc7f3=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x7f3c[_0x36bf88];return _0x332914;};'use strict';var _=require('lodash');var util=require(_0xc7f3('0x0'));var logger=require('../../config/logger')(_0xc7f3('0x1'));var moment=require(_0xc7f3('0x2'));var BPromise=require(_0xc7f3('0x3'));var rp=require(_0xc7f3('0x4'));var fs=require('fs');var path=require(_0xc7f3('0x5'));var rimraf=require('rimraf');var config=require(_0xc7f3('0x6'));var attributes=require(_0xc7f3('0x7'));module[_0xc7f3('0x8')]=function(_0x560eec,_0x3745ae){return _0x560eec[_0xc7f3('0x9')](_0xc7f3('0xa'),attributes,{'tableName':_0xc7f3('0xb'),'paranoid':![],'indexes':[{'name':_0xc7f3('0xc'),'fields':[_0xc7f3('0xd'),_0xc7f3('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 dd3a66e..831363c 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 _0xf12d=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x4221be,_0x27e511){var _0x3eff7b=function(_0x40f495){while(--_0x40f495){_0x4221be['push'](_0x4221be['shift']());}};_0x3eff7b(++_0x27e511);}(_0xf12d,0x1b7));var _0xdf12=function(_0x710b81,_0x267585){_0x710b81=_0x710b81-0x0;var _0x5e0ee3=_0xf12d[_0x710b81];return _0x5e0ee3;};'use strict';var _=require(_0xdf12('0x0'));var util=require(_0xdf12('0x1'));var moment=require('moment');var BPromise=require(_0xdf12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf12('0x3'));var db=require(_0xdf12('0x4'))['db'];var utils=require(_0xdf12('0x5'));var logger=require('../../config/logger')(_0xdf12('0x6'));var config=require(_0xdf12('0x7'));var jayson=require(_0xdf12('0x8'));var client=jayson[_0xdf12('0x9')][_0xdf12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x165ad1,_0x5defb1,_0x17ce25){return new BPromise(function(_0x393239,_0x11c103){return client[_0xdf12('0xb')](_0x165ad1,_0x17ce25)[_0xdf12('0xc')](function(_0x46c59c){logger[_0xdf12('0xd')](_0xdf12('0xe'),_0x5defb1,'request\x20sent');logger[_0xdf12('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5defb1,_0xdf12('0x10'),JSON[_0xdf12('0x11')](_0x46c59c));if(_0x46c59c[_0xdf12('0x12')]){if(_0x46c59c[_0xdf12('0x12')][_0xdf12('0x13')]===0x1f4){logger[_0xdf12('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x5defb1,_0x46c59c[_0xdf12('0x12')][_0xdf12('0x14')]);return _0x11c103(_0x46c59c[_0xdf12('0x12')][_0xdf12('0x14')]);}logger[_0xdf12('0x12')](_0xdf12('0xe'),_0x5defb1,_0x46c59c[_0xdf12('0x12')][_0xdf12('0x14')]);return _0x393239(_0x46c59c[_0xdf12('0x12')][_0xdf12('0x14')]);}else{logger['info'](_0xdf12('0xe'),_0x5defb1,_0xdf12('0x10'));_0x393239(_0x46c59c[_0xdf12('0x15')][_0xdf12('0x14')]);}})[_0xdf12('0x16')](function(_0x168b44){logger[_0xdf12('0x12')](_0xdf12('0xe'),_0x5defb1,_0x168b44);_0x11c103(_0x168b44);});});} \ No newline at end of file +var _0x8ae8=['http','request','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x8ae8,0xda));var _0x88ae=function(_0xe0dee2,_0x35d2a8){_0xe0dee2=_0xe0dee2-0x0;var _0x568ed0=_0x8ae8[_0xe0dee2];return _0x568ed0;};'use strict';var _=require(_0x88ae('0x0'));var util=require(_0x88ae('0x1'));var moment=require(_0x88ae('0x2'));var BPromise=require(_0x88ae('0x3'));var rs=require(_0x88ae('0x4'));var fs=require('fs');var Redis=require(_0x88ae('0x5'));var db=require(_0x88ae('0x6'))['db'];var utils=require(_0x88ae('0x7'));var logger=require(_0x88ae('0x8'))(_0x88ae('0x9'));var config=require(_0x88ae('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x88ae('0xb')][_0x88ae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b2e01,_0x4e3497,_0xd67176){return new BPromise(function(_0x2b3fe3,_0x94556f){return client[_0x88ae('0xd')](_0x1b2e01,_0xd67176)['then'](function(_0x2a97e3){logger[_0x88ae('0xe')](_0x88ae('0xf'),_0x4e3497,'request\x20sent');logger[_0x88ae('0x10')](_0x88ae('0x11'),_0x4e3497,_0x88ae('0x12'),JSON['stringify'](_0x2a97e3));if(_0x2a97e3[_0x88ae('0x13')]){if(_0x2a97e3[_0x88ae('0x13')][_0x88ae('0x14')]===0x1f4){logger[_0x88ae('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x4e3497,_0x2a97e3['error'][_0x88ae('0x15')]);return _0x94556f(_0x2a97e3[_0x88ae('0x13')][_0x88ae('0x15')]);}logger[_0x88ae('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x4e3497,_0x2a97e3[_0x88ae('0x13')]['message']);return _0x2b3fe3(_0x2a97e3['error'][_0x88ae('0x15')]);}else{logger['info'](_0x88ae('0xf'),_0x4e3497,_0x88ae('0x12'));_0x2b3fe3(_0x2a97e3[_0x88ae('0x16')][_0x88ae('0x15')]);}})['catch'](function(_0x2e4437){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e3497,_0x2e4437);_0x94556f(_0x2e4437);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 111e852..bf97267 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 _0xe1f0=['./intSalesforceAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1c288b,_0x377b72){var _0x5d9225=function(_0x3c1a9e){while(--_0x3c1a9e){_0x1c288b['push'](_0x1c288b['shift']());}};_0x5d9225(++_0x377b72);}(_0xe1f0,0x1c2));var _0x0e1f=function(_0xe85e43,_0x12c6e1){_0xe85e43=_0xe85e43-0x0;var _0x373529=_0xe1f0[_0xe85e43];return _0x373529;};'use strict';var multer=require('multer');var util=require(_0x0e1f('0x0'));var path=require(_0x0e1f('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e1f('0x2'));var router=express[_0x0e1f('0x3')]();var auth=require(_0x0e1f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0e1f('0x5'));var controller=require(_0x0e1f('0x6'));router[_0x0e1f('0x7')]('/',auth['isAuthenticated'](),controller[_0x0e1f('0x8')]);router['get'](_0x0e1f('0x9'),auth[_0x0e1f('0xa')](),controller[_0x0e1f('0xb')]);router['get']('/:id/configurations',auth[_0x0e1f('0xa')](),controller[_0x0e1f('0xc')]);router['get'](_0x0e1f('0xd'),auth[_0x0e1f('0xa')](),controller[_0x0e1f('0xe')]);router[_0x0e1f('0xf')]('/',auth[_0x0e1f('0xa')](),controller[_0x0e1f('0x10')]);router[_0x0e1f('0xf')](_0x0e1f('0x11'),auth[_0x0e1f('0xa')](),controller[_0x0e1f('0x12')]);router[_0x0e1f('0x13')](_0x0e1f('0x9'),auth['isAuthenticated'](),controller[_0x0e1f('0x14')]);router[_0x0e1f('0x15')](_0x0e1f('0x9'),auth[_0x0e1f('0xa')](),controller[_0x0e1f('0x16')]);module[_0x0e1f('0x17')]=router; \ No newline at end of file +var _0x802c=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller'];(function(_0x13e56a,_0x3f48f1){var _0x4ee48e=function(_0x5c0ef1){while(--_0x5c0ef1){_0x13e56a['push'](_0x13e56a['shift']());}};_0x4ee48e(++_0x3f48f1);}(_0x802c,0x1dd));var _0xc802=function(_0x372bd9,_0x2d5ef1){_0x372bd9=_0x372bd9-0x0;var _0x914906=_0x802c[_0x372bd9];return _0x914906;};'use strict';var multer=require(_0xc802('0x0'));var util=require(_0xc802('0x1'));var path=require(_0xc802('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc802('0x3')]();var auth=require(_0xc802('0x4'));var interaction=require(_0xc802('0x5'));var config=require('../../config/environment');var controller=require(_0xc802('0x6'));router[_0xc802('0x7')]('/',auth[_0xc802('0x8')](),controller[_0xc802('0x9')]);router[_0xc802('0x7')](_0xc802('0xa'),auth['isAuthenticated'](),controller[_0xc802('0xb')]);router[_0xc802('0x7')](_0xc802('0xc'),auth[_0xc802('0x8')](),controller[_0xc802('0xd')]);router['get'](_0xc802('0xe'),auth['isAuthenticated'](),controller[_0xc802('0xf')]);router[_0xc802('0x10')]('/',auth[_0xc802('0x8')](),controller[_0xc802('0x11')]);router[_0xc802('0x10')](_0xc802('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc802('0x12')](_0xc802('0xa'),auth[_0xc802('0x8')](),controller[_0xc802('0x13')]);router[_0xc802('0x14')](_0xc802('0xa'),auth['isAuthenticated'](),controller[_0xc802('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b1bb49e..901b040 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 _0x1cb9=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x41b1f6,_0x2dca1b){var _0x358ed8=function(_0xcf494f){while(--_0xcf494f){_0x41b1f6['push'](_0x41b1f6['shift']());}};_0x358ed8(++_0x2dca1b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x20b0ab,_0x3a52c7){_0x20b0ab=_0x20b0ab-0x0;var _0x1bf8b3=_0x1cb9[_0x20b0ab];return _0x1bf8b3;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')]},'description':{'type':Sequelize[_0x91cb('0x1')]},'username':{'type':Sequelize[_0x91cb('0x1')],'unique':_0x91cb('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x91cb('0x1')]},'clientId':{'type':Sequelize[_0x91cb('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x91cb('0x1')]},'serverUrl':{'type':Sequelize[_0x91cb('0x1')]},'type':{'type':Sequelize[_0x91cb('0x3')](_0x91cb('0x4'),_0x91cb('0x5')),'defaultValue':_0x91cb('0x4')}}; \ No newline at end of file +var _0x1261=['STRING','username','integrationTab','newTab','exports'];(function(_0x354279,_0x1573a9){var _0x55db41=function(_0x159f95){while(--_0x159f95){_0x354279['push'](_0x354279['shift']());}};_0x55db41(++_0x1573a9);}(_0x1261,0x144));var _0x1126=function(_0x317497,_0x2d6cf7){_0x317497=_0x317497-0x0;var _0x3445b0=_0x1261[_0x317497];return _0x3445b0;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'name':{'type':Sequelize[_0x1126('0x1')]},'description':{'type':Sequelize[_0x1126('0x1')]},'username':{'type':Sequelize[_0x1126('0x1')],'unique':_0x1126('0x2')},'remoteUri':{'type':Sequelize[_0x1126('0x1')]},'password':{'type':Sequelize[_0x1126('0x1')]},'clientId':{'type':Sequelize[_0x1126('0x1')]},'clientSecret':{'type':Sequelize[_0x1126('0x1')]},'securityToken':{'type':Sequelize[_0x1126('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x1126('0x3'),_0x1126('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b832ece..7f81df6 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 _0x958d=['fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','include','findAll','rows','show','keys','rawAttributes','includeAll','options','body','find','params','findOne','SalesforceConfiguration','length','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','describe','CallDurationInSeconds','IsArchived','Priority','Status','Type','Case','Reason','IsEscalated','SuppliedName','includes','label','picklistValues','boolean','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','Sequelize','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','update','then','destroy','end','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','query','filters','intersection','attributes','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x958d,0x15b));var _0xd958=function(_0x2d9d6b,_0x3d98cb){_0x2d9d6b=_0x2d9d6b-0x0;var _0x606906=_0x958d[_0x2d9d6b];return _0x606906;};'use strict';var pdf=require(_0xd958('0x0'));var emlformat=require(_0xd958('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd958('0x2'));var rp=require(_0xd958('0x3'));var moment=require(_0xd958('0x4'));var BPromise=require(_0xd958('0x5'));var Mustache=require(_0xd958('0x6'));var util=require(_0xd958('0x7'));var path=require('path');var sox=require(_0xd958('0x8'));var csv=require(_0xd958('0x9'));var ejs=require(_0xd958('0xa'));var fs=require('fs');var _=require(_0xd958('0xb'));var squel=require(_0xd958('0xc'));var crypto=require(_0xd958('0xd'));var jsforce=require(_0xd958('0xe'));var deskjs=require(_0xd958('0xf'));var toCsv=require(_0xd958('0x9'));var querystring=require(_0xd958('0x10'));var Papa=require('papaparse');var Redis=require(_0xd958('0x11'));var authService=require(_0xd958('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd958('0x13'));var hardwareService=require(_0xd958('0x14'));var logger=require('../../config/logger')(_0xd958('0x15'));var utils=require(_0xd958('0x16'));var config=require('../../config/environment');var db=require(_0xd958('0x17'))['db'];var integrations=require(_0xd958('0x18'));var jayson=require(_0xd958('0x19'));var client=jayson['client'][_0xd958('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x86d36d,_0x2a530e,_0x330488){if(_0x330488){var _0x42f986=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42f986['test'](_0x2a530e)){return _0x86d36d;}else{throw new db[(_0xd958('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 _0x86d36d;}}function respondWithRpcPromise(_0x31fb6b,_0x549e47,_0x534024,_0xd052a2){return new BPromise(function(_0x3c3a55,_0x22eff4){var _0x599fd5=_0xd052a2||client;return _0x599fd5[_0xd958('0x1c')](_0x31fb6b,_0x534024)['then'](function(_0x5c93a3){logger['info'](_0xd958('0x1d'),_0x549e47,_0xd958('0x1e'));logger['debug'](_0xd958('0x1f'),_0x549e47,_0xd958('0x1e'),JSON['stringify'](_0x5c93a3));if(_0x5c93a3[_0xd958('0x20')]){if(_0x5c93a3['error'][_0xd958('0x21')]===0x1f4){logger[_0xd958('0x20')](_0xd958('0x1d'),_0x549e47,_0x5c93a3['error'][_0xd958('0x22')]);return _0x22eff4(_0x5c93a3[_0xd958('0x20')][_0xd958('0x22')]);}logger[_0xd958('0x20')]('SalesforceAccount,\x20%s,\x20%s',_0x549e47,_0x5c93a3[_0xd958('0x20')][_0xd958('0x22')]);return _0x3c3a55(_0x5c93a3[_0xd958('0x20')]['message']);}else{logger[_0xd958('0x23')](_0xd958('0x1d'),_0x549e47,_0xd958('0x1e'));_0x3c3a55(_0x5c93a3[_0xd958('0x24')][_0xd958('0x22')]);}})[_0xd958('0x25')](function(_0x1a2475){logger[_0xd958('0x20')](_0xd958('0x1d'),_0x549e47,_0x1a2475);_0x22eff4(_0x1a2475);});});}function respondWithStatusCode(_0x44119c,_0x5f2a88){_0x5f2a88=_0x5f2a88||0xcc;return function(_0x1fac09){if(_0x1fac09){return _0x44119c[_0xd958('0x26')](_0x5f2a88);}return _0x44119c[_0xd958('0x27')](_0x5f2a88)['end']();};}function respondWithResult(_0x2c05d4,_0x31813c){_0x31813c=_0x31813c||0xc8;return function(_0x1b0031){if(_0x1b0031){return _0x2c05d4['status'](_0x31813c)['json'](_0x1b0031);}};}function respondWithFilteredResult(_0x409a57,_0x5ea604){return function(_0x5c3f9c){if(_0x5c3f9c){var _0x2eaa86=_0x5c3f9c[_0xd958('0x28')],_0x14f5bc=_0x5ea604['offset'],_0x46fc3e=_0x5ea604[_0xd958('0x29')]+_0x5ea604['limit'],_0x17f669;if(_0x46fc3e>=_0x2eaa86){_0x46fc3e=_0x2eaa86;_0x17f669=0xc8;}else{_0x17f669=0xce;}_0x409a57[_0xd958('0x27')](_0x17f669);return _0x409a57[_0xd958('0x2a')](_0xd958('0x2b'),_0x14f5bc+'-'+_0x46fc3e+'/'+_0x2eaa86)[_0xd958('0x2c')](_0x5c3f9c);}return null;};}function patchUpdates(_0x4a2cd8){return function(_0x50c999){try{jsonpatch[_0xd958('0x2d')](_0x50c999,_0x4a2cd8,!![]);}catch(_0x1af196){return BPromise['reject'](_0x1af196);}return _0x50c999['save']();};}function saveUpdates(_0x5ec1a0,_0x1dd322){return function(_0x2a8e73){if(_0x2a8e73){return _0x2a8e73[_0xd958('0x2e')](_0x5ec1a0)[_0xd958('0x2f')](function(_0x2aa4b5){return _0x2aa4b5;});}return null;};}function removeEntity(_0x6253,_0x3990a9){return function(_0x1f1258){if(_0x1f1258){return _0x1f1258[_0xd958('0x30')]()[_0xd958('0x2f')](function(){_0x6253['status'](0xcc)[_0xd958('0x31')]();});}};}function handleEntityNotFound(_0xd6d92c,_0x1207c3){return function(_0x561969){if(!_0x561969){_0xd6d92c['sendStatus'](0x194);}return _0x561969;};}function handleError(_0x43e121,_0x457298){_0x457298=_0x457298||0x1f4;return function(_0x5c5be6){logger[_0xd958('0x20')](_0x5c5be6[_0xd958('0x32')]);if(_0x5c5be6[_0xd958('0x33')]){delete _0x5c5be6[_0xd958('0x33')];}_0x43e121['status'](_0x457298)[_0xd958('0x34')](_0x5c5be6);};}exports[_0xd958('0x35')]=function(_0x2ad5bb,_0x40cc95){var _0x5dd563={},_0x5ec5dd={},_0x2da44e={'count':0x0,'rows':[]};var _0x38ad6c=_[_0xd958('0x36')](db[_0xd958('0x37')]['rawAttributes'],function(_0xa253dc){return{'name':_0xa253dc[_0xd958('0x38')],'type':_0xa253dc[_0xd958('0x39')][_0xd958('0x3a')]};});_0x5ec5dd['model']=_[_0xd958('0x36')](_0x38ad6c,'name');_0x5ec5dd[_0xd958('0x3b')]=_['keys'](_0x2ad5bb['query']);_0x5ec5dd[_0xd958('0x3c')]=_[_0xd958('0x3d')](_0x5ec5dd['model'],_0x5ec5dd[_0xd958('0x3b')]);_0x5dd563[_0xd958('0x3e')]=_[_0xd958('0x3d')](_0x5ec5dd[_0xd958('0x3f')],qs[_0xd958('0x40')](_0x2ad5bb[_0xd958('0x3b')][_0xd958('0x40')]));_0x5dd563[_0xd958('0x3e')]=_0x5dd563[_0xd958('0x3e')]['length']?_0x5dd563[_0xd958('0x3e')]:_0x5ec5dd[_0xd958('0x3f')];if(!_0x2ad5bb[_0xd958('0x3b')][_0xd958('0x41')](_0xd958('0x42'))){_0x5dd563[_0xd958('0x43')]=qs[_0xd958('0x43')](_0x2ad5bb[_0xd958('0x3b')][_0xd958('0x43')]);_0x5dd563['offset']=qs[_0xd958('0x29')](_0x2ad5bb['query'][_0xd958('0x29')]);}_0x5dd563[_0xd958('0x44')]=qs[_0xd958('0x45')](_0x2ad5bb[_0xd958('0x3b')][_0xd958('0x45')]);_0x5dd563[_0xd958('0x46')]=qs[_0xd958('0x3c')](_['pick'](_0x2ad5bb[_0xd958('0x3b')],_0x5ec5dd[_0xd958('0x3c')]),_0x38ad6c);if(_0x2ad5bb['query']['filter']){_0x5dd563[_0xd958('0x46')]=_[_0xd958('0x47')](_0x5dd563[_0xd958('0x46')],{'$or':_['map'](_0x38ad6c,function(_0x428e7a){if(_0x428e7a[_0xd958('0x39')]!==_0xd958('0x48')){var _0xf68cef={};_0xf68cef[_0x428e7a[_0xd958('0x33')]]={'$like':'%'+_0x2ad5bb[_0xd958('0x3b')][_0xd958('0x49')]+'%'};return _0xf68cef;}})});}_0x5dd563=_[_0xd958('0x47')]({},_0x5dd563,_0x2ad5bb['options']);var _0x2592b8={'where':_0x5dd563['where']};return db[_0xd958('0x37')]['count'](_0x2592b8)['then'](function(_0x5a1cfb){_0x2da44e[_0xd958('0x28')]=_0x5a1cfb;if(_0x2ad5bb[_0xd958('0x3b')]['includeAll']){_0x5dd563[_0xd958('0x4a')]=[{'all':!![]}];}return db[_0xd958('0x37')][_0xd958('0x4b')](_0x5dd563);})[_0xd958('0x2f')](function(_0x164622){_0x2da44e[_0xd958('0x4c')]=_0x164622;return _0x2da44e;})[_0xd958('0x2f')](respondWithFilteredResult(_0x40cc95,_0x5dd563))[_0xd958('0x25')](handleError(_0x40cc95,null));};exports[_0xd958('0x4d')]=function(_0x1ed64d,_0x1a8c9e){var _0x50ab06={'raw':![],'where':{'id':_0x1ed64d['params']['id']}},_0x2432fd={};_0x2432fd[_0xd958('0x3f')]=_[_0xd958('0x4e')](db[_0xd958('0x37')][_0xd958('0x4f')]);_0x2432fd[_0xd958('0x3b')]=_[_0xd958('0x4e')](_0x1ed64d['query']);_0x2432fd['filters']=_['intersection'](_0x2432fd[_0xd958('0x3f')],_0x2432fd[_0xd958('0x3b')]);_0x50ab06[_0xd958('0x3e')]=_[_0xd958('0x3d')](_0x2432fd['model'],qs[_0xd958('0x40')](_0x1ed64d[_0xd958('0x3b')]['fields']));_0x50ab06[_0xd958('0x3e')]=_0x50ab06[_0xd958('0x3e')]['length']?_0x50ab06[_0xd958('0x3e')]:_0x2432fd[_0xd958('0x3f')];if(_0x1ed64d[_0xd958('0x3b')][_0xd958('0x50')]){_0x50ab06[_0xd958('0x4a')]=[{'all':!![]}];}_0x50ab06=_[_0xd958('0x47')]({},_0x50ab06,_0x1ed64d[_0xd958('0x51')]);return db[_0xd958('0x37')]['find'](_0x50ab06)[_0xd958('0x2f')](handleEntityNotFound(_0x1a8c9e,null))[_0xd958('0x2f')](respondWithResult(_0x1a8c9e,null))[_0xd958('0x25')](handleError(_0x1a8c9e,null));};exports['create']=function(_0x48537e,_0x5e5e50){return db[_0xd958('0x37')]['create'](_0x48537e['body'],{})[_0xd958('0x2f')](respondWithResult(_0x5e5e50,0xc9))[_0xd958('0x25')](handleError(_0x5e5e50,null));};exports[_0xd958('0x2e')]=function(_0xce0172,_0x6bed5d){if(_0xce0172[_0xd958('0x52')]['id']){delete _0xce0172[_0xd958('0x52')]['id'];}return db[_0xd958('0x37')][_0xd958('0x53')]({'where':{'id':_0xce0172[_0xd958('0x54')]['id']}})[_0xd958('0x2f')](handleEntityNotFound(_0x6bed5d,null))[_0xd958('0x2f')](saveUpdates(_0xce0172[_0xd958('0x52')],null))[_0xd958('0x2f')](respondWithResult(_0x6bed5d,null))[_0xd958('0x25')](handleError(_0x6bed5d,null));};exports[_0xd958('0x30')]=function(_0x14b7e2,_0x1043a6){return db[_0xd958('0x37')][_0xd958('0x53')]({'where':{'id':_0x14b7e2['params']['id']}})[_0xd958('0x2f')](handleEntityNotFound(_0x1043a6,null))[_0xd958('0x2f')](removeEntity(_0x1043a6,null))[_0xd958('0x25')](handleError(_0x1043a6,null));};exports['getConfigurations']=function(_0xec01b8,_0xf22af1,_0x4f7d1f){var _0x313ba9={};var _0x29c43b={};var _0x56b5ec;var _0x323f64;return db[_0xd958('0x37')][_0xd958('0x55')]({'where':{'id':_0xec01b8[_0xd958('0x54')]['id']}})[_0xd958('0x2f')](handleEntityNotFound(_0xf22af1,null))['then'](function(_0x26dcf){if(_0x26dcf){_0x56b5ec=_0x26dcf;_0x29c43b['model']=_['keys'](db[_0xd958('0x56')][_0xd958('0x4f')]);_0x29c43b[_0xd958('0x3b')]=_[_0xd958('0x4e')](_0xec01b8[_0xd958('0x3b')]);_0x29c43b[_0xd958('0x3c')]=_[_0xd958('0x3d')](_0x29c43b[_0xd958('0x3f')],_0x29c43b[_0xd958('0x3b')]);_0x313ba9[_0xd958('0x3e')]=_[_0xd958('0x3d')](_0x29c43b[_0xd958('0x3f')],qs[_0xd958('0x40')](_0xec01b8['query']['fields']));_0x313ba9['attributes']=_0x313ba9[_0xd958('0x3e')][_0xd958('0x57')]?_0x313ba9[_0xd958('0x3e')]:_0x29c43b[_0xd958('0x3f')];_0x313ba9[_0xd958('0x44')]=qs[_0xd958('0x45')](_0xec01b8['query'][_0xd958('0x45')]);_0x313ba9['where']=qs[_0xd958('0x3c')](_[_0xd958('0x58')](_0xec01b8[_0xd958('0x3b')],_0x29c43b[_0xd958('0x3c')]));if(_0xec01b8[_0xd958('0x3b')][_0xd958('0x49')]){_0x313ba9[_0xd958('0x46')]=_[_0xd958('0x47')](_0x313ba9[_0xd958('0x46')],{'$or':_[_0xd958('0x36')](_0x313ba9[_0xd958('0x3e')],function(_0x158afc){var _0x3471f0={};_0x3471f0[_0x158afc]={'$like':'%'+_0xec01b8[_0xd958('0x3b')][_0xd958('0x49')]+'%'};return _0x3471f0;})});}_0x313ba9=_[_0xd958('0x47')]({},_0x313ba9,_0xec01b8[_0xd958('0x51')]);return _0x56b5ec[_0xd958('0x59')](_0x313ba9);}})[_0xd958('0x2f')](function(_0x1c2266){if(_0x1c2266){_0x323f64=_0x1c2266[_0xd958('0x57')];if(!_0xec01b8[_0xd958('0x3b')][_0xd958('0x41')](_0xd958('0x42'))){_0x313ba9[_0xd958('0x43')]=qs[_0xd958('0x43')](_0xec01b8[_0xd958('0x3b')][_0xd958('0x43')]);_0x313ba9[_0xd958('0x29')]=qs[_0xd958('0x29')](_0xec01b8['query'][_0xd958('0x29')]);}return _0x56b5ec[_0xd958('0x59')](_0x313ba9);}})[_0xd958('0x2f')](function(_0x43774e){if(_0x43774e){return _0x43774e?{'count':_0x323f64,'rows':_0x43774e}:null;}})[_0xd958('0x2f')](respondWithResult(_0xf22af1,null))['catch'](handleError(_0xf22af1,null));};exports['addConfiguration']=function(_0x21285c,_0x4a63d0,_0x100d18){if(_0x21285c[_0xd958('0x52')]['id']){delete _0x21285c[_0xd958('0x52')]['id'];}return db[_0xd958('0x37')][_0xd958('0x55')]({'where':{'id':_0x21285c[_0xd958('0x54')]['id']}})[_0xd958('0x2f')](handleEntityNotFound(_0x4a63d0,null))['then'](function(_0x2c0627){if(_0x2c0627){_0x21285c[_0xd958('0x52')][_0xd958('0x5a')]=_0x2c0627['id'];_0x21285c[_0xd958('0x52')][_0xd958('0x5b')]=integrations[_0xd958('0x5c')](_0x21285c[_0xd958('0x52')][_0xd958('0x5d')],_0x21285c['body']['type']);_0x21285c[_0xd958('0x52')][_0xd958('0x5e')]=integrations[_0xd958('0x5f')](_0x21285c[_0xd958('0x52')]['channel'],_0x21285c['body'][_0xd958('0x39')]);return db['SalesforceConfiguration'][_0xd958('0x60')](_0x21285c[_0xd958('0x52')],{'include':[{'model':db[_0xd958('0x61')],'as':_0xd958('0x5b')},{'model':db[_0xd958('0x61')],'as':'Descriptions'}]});}return null;})[_0xd958('0x2f')](respondWithResult(_0x4a63d0,null))['catch'](handleError(_0x4a63d0,null));};exports[_0xd958('0x62')]=function(_0x132269,_0x29bceb,_0x658a4){var _0xa23233;var _0x3b495a='';var _0x34ac76=_0xd958('0x63');return db['SalesforceAccount'][_0xd958('0x55')]({'where':{'id':_0x132269[_0xd958('0x54')]['id']},'attributes':['id',_0xd958('0x64'),'clientId',_0xd958('0x65'),_0xd958('0x66'),_0xd958('0x67'),_0xd958('0x68')]})[_0xd958('0x2f')](handleEntityNotFound(_0x29bceb,null))[_0xd958('0x2f')](function(_0x59a3ac){if(_0x59a3ac){_0x3b495a=_0x59a3ac[_0xd958('0x64')];var _0x1ab767=_0x3b495a[_0xd958('0x69')](-0x1);if(_0x1ab767==='/'){_0x3b495a=_0x3b495a[_0xd958('0x6a')](0x0,_0x3b495a[_0xd958('0x6b')](_0x1ab767));}_0xa23233=new jsforce[(_0xd958('0x6c'))]({'oauth2':{'loginUrl':_0x3b495a,'clientId':_0x59a3ac[_0xd958('0x6d')],'clientSecret':_0x59a3ac['clientSecret']}});return _0xa23233[_0xd958('0x6e')](_0x59a3ac[_0xd958('0x66')],_0x59a3ac[_0xd958('0x67')][_0xd958('0x6f')](_0x59a3ac['securityToken']));}})[_0xd958('0x2f')](function(_0x82c2cc){if(_0x82c2cc){if(!_[_0xd958('0x70')](_0x132269[_0xd958('0x3b')][_0xd958('0x71')])){_0x34ac76=_0x132269[_0xd958('0x3b')][_0xd958('0x71')];}return _0xa23233[_0xd958('0x72')](_0x34ac76)[_0xd958('0x73')]();}})[_0xd958('0x2f')](function(_0xd1fc58){var _0x530ce0=['CallDisposition',_0xd958('0x74'),'CallObject','CallType',_0xd958('0x75'),_0xd958('0x76'),_0xd958('0x77'),_0xd958('0x78')];if(!_[_0xd958('0x70')](_0x132269[_0xd958('0x3b')]['ticketType'])&&_0x132269[_0xd958('0x3b')][_0xd958('0x71')]===_0xd958('0x79')){_0x530ce0=[_0xd958('0x78'),'Origin',_0xd958('0x7a'),_0xd958('0x77'),'Priority',_0xd958('0x7b'),_0xd958('0x7c'),'SuppliedCompany'];}if(_0xd1fc58){_['remove'](_0xd1fc58[_0xd958('0x40')],function(_0x585ca1){return _0x585ca1['custom']===![]&&!_0x530ce0[_0xd958('0x7d')](_0x585ca1[_0xd958('0x33')]);});return{'count':_0xd1fc58[_0xd958('0x40')][_0xd958('0x57')],'rows':_['map'](_0xd1fc58[_0xd958('0x40')],function(_0x1027d2){return{'id':_0x1027d2[_0xd958('0x33')],'name':_0x1027d2[_0xd958('0x7e')],'custom':_0x1027d2['custom'],'options':_0x1027d2[_0xd958('0x7f')][_0xd958('0x57')]>0x0?_[_0xd958('0x36')](_0x1027d2[_0xd958('0x7f')],function(_0x10c6e4){return{'name':_0x10c6e4['label'],'value':_0x10c6e4['value']};}):_0x1027d2[_0xd958('0x39')]==_0xd958('0x80')?[{'name':_0xd958('0x81'),'value':_0xd958('0x82')},{'name':'False','value':_0xd958('0x83')}]:[]};})};}})['then'](respondWithResult(_0x29bceb,null))['catch'](function(_0x4b2bff){var _0x69373c=_0x132269['query'][_0xd958('0x84')]?0x1f4:_0x4b2bff[_0xd958('0x85')]||0x1f4;logger['error'](_0xd958('0x86'),_0xd958('0x62'),_0x69373c,JSON[_0xd958('0x87')](_0x4b2bff));delete _0x4b2bff[_0xd958('0x33')];if(_0x69373c===0x191){_0x69373c=0x190;}_0x29bceb[_0xd958('0x27')](_0x69373c)['send'](_0x132269[_0xd958('0x3b')][_0xd958('0x84')]?{'message':_0xd958('0x88'),'statusCode':_0x4b2bff[_0xd958('0x85')]}:_0x4b2bff);});}; \ No newline at end of file +var _0xf4cb=['addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','SalesforceField','getFields','Task','password','remoteUri','slice','substring','Connection','clientId','clientSecret','login','username','concat','securityToken','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Status','isNil','Case','Type','Origin','Reason','SuppliedCompany','remove','includes','label','custom','picklistValues','value','boolean','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','intersection','include','find','create','body','getConfigurations','SalesforceConfiguration'];(function(_0x2f813e,_0x41e838){var _0x5ac94c=function(_0x336eff){while(--_0x336eff){_0x2f813e['push'](_0x2f813e['shift']());}};_0x5ac94c(++_0x41e838);}(_0xf4cb,0x1ca));var _0xbf4c=function(_0x3cff34,_0x1164c9){_0x3cff34=_0x3cff34-0x0;var _0x1de8a5=_0xf4cb[_0x3cff34];return _0x1de8a5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbf4c('0x0'));var zipdir=require(_0xbf4c('0x1'));var jsonpatch=require(_0xbf4c('0x2'));var rp=require(_0xbf4c('0x3'));var moment=require('moment');var BPromise=require(_0xbf4c('0x4'));var Mustache=require(_0xbf4c('0x5'));var util=require(_0xbf4c('0x6'));var path=require(_0xbf4c('0x7'));var sox=require(_0xbf4c('0x8'));var csv=require(_0xbf4c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbf4c('0xa'));var crypto=require(_0xbf4c('0xb'));var jsforce=require(_0xbf4c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbf4c('0x9'));var querystring=require(_0xbf4c('0xd'));var Papa=require(_0xbf4c('0xe'));var Redis=require(_0xbf4c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbf4c('0x10'));var as=require(_0xbf4c('0x11'));var hardwareService=require(_0xbf4c('0x12'));var logger=require(_0xbf4c('0x13'))('api');var utils=require(_0xbf4c('0x14'));var config=require(_0xbf4c('0x15'));var db=require(_0xbf4c('0x16'))['db'];var integrations=require(_0xbf4c('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xbf4c('0x18')][_0xbf4c('0x19')]({'port':0x232a});function checkPasswordPattern(_0x52793f,_0xbb8641,_0x198308){if(_0x198308){var _0x1414e6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1414e6[_0xbf4c('0x1a')](_0xbb8641)){return _0x52793f;}else{throw new db['Sequelize'][(_0xbf4c('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 _0x52793f;}}function respondWithRpcPromise(_0x4d5dd0,_0x5ab163,_0x359fda,_0x514dc6){return new BPromise(function(_0x4bcdd0,_0x43e261){var _0x3ef8b2=_0x514dc6||client;return _0x3ef8b2[_0xbf4c('0x1c')](_0x4d5dd0,_0x359fda)[_0xbf4c('0x1d')](function(_0x2d1bbe){logger[_0xbf4c('0x1e')]('SalesforceAccount,\x20%s,\x20%s',_0x5ab163,'request\x20sent');logger[_0xbf4c('0x1f')](_0xbf4c('0x20'),_0x5ab163,_0xbf4c('0x21'),JSON[_0xbf4c('0x22')](_0x2d1bbe));if(_0x2d1bbe['error']){if(_0x2d1bbe[_0xbf4c('0x23')][_0xbf4c('0x24')]===0x1f4){logger[_0xbf4c('0x23')](_0xbf4c('0x25'),_0x5ab163,_0x2d1bbe[_0xbf4c('0x23')]['message']);return _0x43e261(_0x2d1bbe['error'][_0xbf4c('0x26')]);}logger[_0xbf4c('0x23')](_0xbf4c('0x25'),_0x5ab163,_0x2d1bbe[_0xbf4c('0x23')][_0xbf4c('0x26')]);return _0x4bcdd0(_0x2d1bbe[_0xbf4c('0x23')][_0xbf4c('0x26')]);}else{logger[_0xbf4c('0x1e')](_0xbf4c('0x25'),_0x5ab163,_0xbf4c('0x21'));_0x4bcdd0(_0x2d1bbe['result']['message']);}})['catch'](function(_0x246036){logger[_0xbf4c('0x23')](_0xbf4c('0x25'),_0x5ab163,_0x246036);_0x43e261(_0x246036);});});}function respondWithStatusCode(_0x70c5e6,_0x4272c4){_0x4272c4=_0x4272c4||0xcc;return function(_0x9d8caf){if(_0x9d8caf){return _0x70c5e6[_0xbf4c('0x27')](_0x4272c4);}return _0x70c5e6[_0xbf4c('0x28')](_0x4272c4)[_0xbf4c('0x29')]();};}function respondWithResult(_0x1cfe58,_0x37033c){_0x37033c=_0x37033c||0xc8;return function(_0x333152){if(_0x333152){return _0x1cfe58['status'](_0x37033c)[_0xbf4c('0x2a')](_0x333152);}};}function respondWithFilteredResult(_0x121a10,_0x2a4093){return function(_0x504801){if(_0x504801){var _0x11aa90=_0x504801[_0xbf4c('0x2b')],_0x48946=_0x2a4093[_0xbf4c('0x2c')],_0x3a5417=_0x2a4093[_0xbf4c('0x2c')]+_0x2a4093[_0xbf4c('0x2d')],_0x1a4e24;if(_0x3a5417>=_0x11aa90){_0x3a5417=_0x11aa90;_0x1a4e24=0xc8;}else{_0x1a4e24=0xce;}_0x121a10['status'](_0x1a4e24);return _0x121a10[_0xbf4c('0x2e')](_0xbf4c('0x2f'),_0x48946+'-'+_0x3a5417+'/'+_0x11aa90)[_0xbf4c('0x2a')](_0x504801);}return null;};}function patchUpdates(_0x217f85){return function(_0x2958a5){try{jsonpatch[_0xbf4c('0x30')](_0x2958a5,_0x217f85,!![]);}catch(_0x33d827){return BPromise['reject'](_0x33d827);}return _0x2958a5['save']();};}function saveUpdates(_0x18cedc,_0x40fdfd){return function(_0x1a3ae3){if(_0x1a3ae3){return _0x1a3ae3[_0xbf4c('0x31')](_0x18cedc)[_0xbf4c('0x1d')](function(_0x3b0f58){return _0x3b0f58;});}return null;};}function removeEntity(_0xf03a8d,_0x1240ce){return function(_0x394dc3){if(_0x394dc3){return _0x394dc3[_0xbf4c('0x32')]()['then'](function(){_0xf03a8d[_0xbf4c('0x28')](0xcc)[_0xbf4c('0x29')]();});}};}function handleEntityNotFound(_0x11624f,_0x2ced21){return function(_0xefc157){if(!_0xefc157){_0x11624f[_0xbf4c('0x27')](0x194);}return _0xefc157;};}function handleError(_0x295111,_0x14974a){_0x14974a=_0x14974a||0x1f4;return function(_0x46a918){logger[_0xbf4c('0x23')](_0x46a918[_0xbf4c('0x33')]);if(_0x46a918[_0xbf4c('0x34')]){delete _0x46a918[_0xbf4c('0x34')];}_0x295111[_0xbf4c('0x28')](_0x14974a)[_0xbf4c('0x35')](_0x46a918);};}exports[_0xbf4c('0x36')]=function(_0x1ae9f5,_0x5a3e9e){var _0x622a0a={},_0x2dc3df={},_0x2ed415={'count':0x0,'rows':[]};var _0xc6a92=_[_0xbf4c('0x37')](db[_0xbf4c('0x38')][_0xbf4c('0x39')],function(_0x113a23){return{'name':_0x113a23[_0xbf4c('0x3a')],'type':_0x113a23[_0xbf4c('0x3b')][_0xbf4c('0x3c')]};});_0x2dc3df['model']=_[_0xbf4c('0x37')](_0xc6a92,_0xbf4c('0x34'));_0x2dc3df[_0xbf4c('0x3d')]=_['keys'](_0x1ae9f5[_0xbf4c('0x3d')]);_0x2dc3df[_0xbf4c('0x3e')]=_['intersection'](_0x2dc3df['model'],_0x2dc3df['query']);_0x622a0a[_0xbf4c('0x3f')]=_['intersection'](_0x2dc3df[_0xbf4c('0x40')],qs[_0xbf4c('0x41')](_0x1ae9f5[_0xbf4c('0x3d')][_0xbf4c('0x41')]));_0x622a0a[_0xbf4c('0x3f')]=_0x622a0a['attributes'][_0xbf4c('0x42')]?_0x622a0a[_0xbf4c('0x3f')]:_0x2dc3df[_0xbf4c('0x40')];if(!_0x1ae9f5['query'][_0xbf4c('0x43')](_0xbf4c('0x44'))){_0x622a0a['limit']=qs[_0xbf4c('0x2d')](_0x1ae9f5['query'][_0xbf4c('0x2d')]);_0x622a0a[_0xbf4c('0x2c')]=qs[_0xbf4c('0x2c')](_0x1ae9f5[_0xbf4c('0x3d')][_0xbf4c('0x2c')]);}_0x622a0a[_0xbf4c('0x45')]=qs[_0xbf4c('0x46')](_0x1ae9f5['query'][_0xbf4c('0x46')]);_0x622a0a[_0xbf4c('0x47')]=qs['filters'](_[_0xbf4c('0x48')](_0x1ae9f5[_0xbf4c('0x3d')],_0x2dc3df[_0xbf4c('0x3e')]),_0xc6a92);if(_0x1ae9f5[_0xbf4c('0x3d')][_0xbf4c('0x49')]){_0x622a0a[_0xbf4c('0x47')]=_['merge'](_0x622a0a[_0xbf4c('0x47')],{'$or':_[_0xbf4c('0x37')](_0xc6a92,function(_0x563797){if(_0x563797[_0xbf4c('0x3b')]!==_0xbf4c('0x4a')){var _0x579780={};_0x579780[_0x563797['name']]={'$like':'%'+_0x1ae9f5[_0xbf4c('0x3d')][_0xbf4c('0x49')]+'%'};return _0x579780;}})});}_0x622a0a=_[_0xbf4c('0x4b')]({},_0x622a0a,_0x1ae9f5[_0xbf4c('0x4c')]);var _0x33a72e={'where':_0x622a0a[_0xbf4c('0x47')]};return db[_0xbf4c('0x38')][_0xbf4c('0x2b')](_0x33a72e)[_0xbf4c('0x1d')](function(_0x3c8c10){_0x2ed415[_0xbf4c('0x2b')]=_0x3c8c10;if(_0x1ae9f5[_0xbf4c('0x3d')][_0xbf4c('0x4d')]){_0x622a0a['include']=[{'all':!![]}];}return db[_0xbf4c('0x38')][_0xbf4c('0x4e')](_0x622a0a);})[_0xbf4c('0x1d')](function(_0x3b6766){_0x2ed415['rows']=_0x3b6766;return _0x2ed415;})['then'](respondWithFilteredResult(_0x5a3e9e,_0x622a0a))[_0xbf4c('0x4f')](handleError(_0x5a3e9e,null));};exports[_0xbf4c('0x50')]=function(_0x41ba9d,_0x37229a){var _0x44e4af={'raw':![],'where':{'id':_0x41ba9d[_0xbf4c('0x51')]['id']}},_0x489a85={};_0x489a85[_0xbf4c('0x40')]=_[_0xbf4c('0x52')](db[_0xbf4c('0x38')][_0xbf4c('0x39')]);_0x489a85[_0xbf4c('0x3d')]=_[_0xbf4c('0x52')](_0x41ba9d[_0xbf4c('0x3d')]);_0x489a85['filters']=_[_0xbf4c('0x53')](_0x489a85[_0xbf4c('0x40')],_0x489a85['query']);_0x44e4af[_0xbf4c('0x3f')]=_[_0xbf4c('0x53')](_0x489a85[_0xbf4c('0x40')],qs[_0xbf4c('0x41')](_0x41ba9d[_0xbf4c('0x3d')][_0xbf4c('0x41')]));_0x44e4af[_0xbf4c('0x3f')]=_0x44e4af[_0xbf4c('0x3f')][_0xbf4c('0x42')]?_0x44e4af['attributes']:_0x489a85['model'];if(_0x41ba9d[_0xbf4c('0x3d')][_0xbf4c('0x4d')]){_0x44e4af[_0xbf4c('0x54')]=[{'all':!![]}];}_0x44e4af=_[_0xbf4c('0x4b')]({},_0x44e4af,_0x41ba9d[_0xbf4c('0x4c')]);return db['SalesforceAccount'][_0xbf4c('0x55')](_0x44e4af)[_0xbf4c('0x1d')](handleEntityNotFound(_0x37229a,null))[_0xbf4c('0x1d')](respondWithResult(_0x37229a,null))[_0xbf4c('0x4f')](handleError(_0x37229a,null));};exports['create']=function(_0x4a6603,_0x375b4d){return db[_0xbf4c('0x38')][_0xbf4c('0x56')](_0x4a6603[_0xbf4c('0x57')],{})['then'](respondWithResult(_0x375b4d,0xc9))[_0xbf4c('0x4f')](handleError(_0x375b4d,null));};exports[_0xbf4c('0x31')]=function(_0x326ba9,_0x21f781){if(_0x326ba9[_0xbf4c('0x57')]['id']){delete _0x326ba9['body']['id'];}return db[_0xbf4c('0x38')]['find']({'where':{'id':_0x326ba9['params']['id']}})[_0xbf4c('0x1d')](handleEntityNotFound(_0x21f781,null))[_0xbf4c('0x1d')](saveUpdates(_0x326ba9['body'],null))[_0xbf4c('0x1d')](respondWithResult(_0x21f781,null))[_0xbf4c('0x4f')](handleError(_0x21f781,null));};exports[_0xbf4c('0x32')]=function(_0x2b4a8d,_0x1b2b48){return db['SalesforceAccount'][_0xbf4c('0x55')]({'where':{'id':_0x2b4a8d[_0xbf4c('0x51')]['id']}})[_0xbf4c('0x1d')](handleEntityNotFound(_0x1b2b48,null))['then'](removeEntity(_0x1b2b48,null))[_0xbf4c('0x4f')](handleError(_0x1b2b48,null));};exports[_0xbf4c('0x58')]=function(_0x23cca1,_0x10f7fd,_0x218eb2){var _0x2b85a9={};var _0x22b9dd={};var _0x248e03;var _0x5a5844;return db['SalesforceAccount']['findOne']({'where':{'id':_0x23cca1[_0xbf4c('0x51')]['id']}})[_0xbf4c('0x1d')](handleEntityNotFound(_0x10f7fd,null))[_0xbf4c('0x1d')](function(_0x2f6362){if(_0x2f6362){_0x248e03=_0x2f6362;_0x22b9dd['model']=_[_0xbf4c('0x52')](db[_0xbf4c('0x59')][_0xbf4c('0x39')]);_0x22b9dd[_0xbf4c('0x3d')]=_[_0xbf4c('0x52')](_0x23cca1[_0xbf4c('0x3d')]);_0x22b9dd['filters']=_[_0xbf4c('0x53')](_0x22b9dd[_0xbf4c('0x40')],_0x22b9dd[_0xbf4c('0x3d')]);_0x2b85a9[_0xbf4c('0x3f')]=_[_0xbf4c('0x53')](_0x22b9dd['model'],qs['fields'](_0x23cca1[_0xbf4c('0x3d')]['fields']));_0x2b85a9[_0xbf4c('0x3f')]=_0x2b85a9['attributes'][_0xbf4c('0x42')]?_0x2b85a9[_0xbf4c('0x3f')]:_0x22b9dd['model'];_0x2b85a9[_0xbf4c('0x45')]=qs['sort'](_0x23cca1[_0xbf4c('0x3d')][_0xbf4c('0x46')]);_0x2b85a9[_0xbf4c('0x47')]=qs['filters'](_[_0xbf4c('0x48')](_0x23cca1[_0xbf4c('0x3d')],_0x22b9dd[_0xbf4c('0x3e')]));if(_0x23cca1['query'][_0xbf4c('0x49')]){_0x2b85a9['where']=_['merge'](_0x2b85a9[_0xbf4c('0x47')],{'$or':_['map'](_0x2b85a9[_0xbf4c('0x3f')],function(_0x32f2fe){var _0xf58c61={};_0xf58c61[_0x32f2fe]={'$like':'%'+_0x23cca1[_0xbf4c('0x3d')][_0xbf4c('0x49')]+'%'};return _0xf58c61;})});}_0x2b85a9=_[_0xbf4c('0x4b')]({},_0x2b85a9,_0x23cca1[_0xbf4c('0x4c')]);return _0x248e03[_0xbf4c('0x58')](_0x2b85a9);}})['then'](function(_0x53ef61){if(_0x53ef61){_0x5a5844=_0x53ef61[_0xbf4c('0x42')];if(!_0x23cca1[_0xbf4c('0x3d')][_0xbf4c('0x43')]('nolimit')){_0x2b85a9['limit']=qs[_0xbf4c('0x2d')](_0x23cca1[_0xbf4c('0x3d')][_0xbf4c('0x2d')]);_0x2b85a9['offset']=qs['offset'](_0x23cca1[_0xbf4c('0x3d')]['offset']);}return _0x248e03[_0xbf4c('0x58')](_0x2b85a9);}})[_0xbf4c('0x1d')](function(_0x238dde){if(_0x238dde){return _0x238dde?{'count':_0x5a5844,'rows':_0x238dde}:null;}})[_0xbf4c('0x1d')](respondWithResult(_0x10f7fd,null))[_0xbf4c('0x4f')](handleError(_0x10f7fd,null));};exports[_0xbf4c('0x5a')]=function(_0x55d8e0,_0xa77819,_0x9f0148){if(_0x55d8e0[_0xbf4c('0x57')]['id']){delete _0x55d8e0[_0xbf4c('0x57')]['id'];}return db[_0xbf4c('0x38')][_0xbf4c('0x5b')]({'where':{'id':_0x55d8e0[_0xbf4c('0x51')]['id']}})[_0xbf4c('0x1d')](handleEntityNotFound(_0xa77819,null))[_0xbf4c('0x1d')](function(_0x532f73){if(_0x532f73){_0x55d8e0[_0xbf4c('0x57')][_0xbf4c('0x5c')]=_0x532f73['id'];_0x55d8e0[_0xbf4c('0x57')]['Subjects']=integrations[_0xbf4c('0x5d')](_0x55d8e0[_0xbf4c('0x57')][_0xbf4c('0x5e')],_0x55d8e0[_0xbf4c('0x57')][_0xbf4c('0x3b')]);_0x55d8e0[_0xbf4c('0x57')]['Descriptions']=integrations[_0xbf4c('0x5f')](_0x55d8e0[_0xbf4c('0x57')][_0xbf4c('0x5e')],_0x55d8e0[_0xbf4c('0x57')][_0xbf4c('0x3b')]);return db[_0xbf4c('0x59')]['create'](_0x55d8e0['body'],{'include':[{'model':db[_0xbf4c('0x60')],'as':'Subjects'},{'model':db[_0xbf4c('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xa77819,null))['catch'](handleError(_0xa77819,null));};exports[_0xbf4c('0x61')]=function(_0x2aa46d,_0x945f46,_0x6cbc9e){var _0x4d19e9;var _0x4c0d8c='';var _0x138805=_0xbf4c('0x62');return db['SalesforceAccount'][_0xbf4c('0x5b')]({'where':{'id':_0x2aa46d[_0xbf4c('0x51')]['id']},'attributes':['id','remoteUri','clientId','clientSecret','username',_0xbf4c('0x63'),'securityToken']})[_0xbf4c('0x1d')](handleEntityNotFound(_0x945f46,null))['then'](function(_0xd78f2b){if(_0xd78f2b){_0x4c0d8c=_0xd78f2b[_0xbf4c('0x64')];var _0x505ce5=_0x4c0d8c[_0xbf4c('0x65')](-0x1);if(_0x505ce5==='/'){_0x4c0d8c=_0x4c0d8c[_0xbf4c('0x66')](0x0,_0x4c0d8c['lastIndexOf'](_0x505ce5));}_0x4d19e9=new jsforce[(_0xbf4c('0x67'))]({'oauth2':{'loginUrl':_0x4c0d8c,'clientId':_0xd78f2b[_0xbf4c('0x68')],'clientSecret':_0xd78f2b[_0xbf4c('0x69')]}});return _0x4d19e9[_0xbf4c('0x6a')](_0xd78f2b[_0xbf4c('0x6b')],_0xd78f2b[_0xbf4c('0x63')][_0xbf4c('0x6c')](_0xd78f2b[_0xbf4c('0x6d')]));}})['then'](function(_0x4a27f5){if(_0x4a27f5){if(!_['isNil'](_0x2aa46d['query'][_0xbf4c('0x6e')])){_0x138805=_0x2aa46d[_0xbf4c('0x3d')][_0xbf4c('0x6e')];}return _0x4d19e9[_0xbf4c('0x6f')](_0x138805)['describe']();}})['then'](function(_0x161a4f){var _0x485f01=[_0xbf4c('0x70'),_0xbf4c('0x71'),_0xbf4c('0x72'),'CallType',_0xbf4c('0x73'),_0xbf4c('0x74'),_0xbf4c('0x75'),'Type'];if(!_[_0xbf4c('0x76')](_0x2aa46d['query'][_0xbf4c('0x6e')])&&_0x2aa46d['query']['ticketType']===_0xbf4c('0x77')){_0x485f01=[_0xbf4c('0x78'),_0xbf4c('0x79'),_0xbf4c('0x7a'),_0xbf4c('0x75'),_0xbf4c('0x74'),'IsEscalated','SuppliedName',_0xbf4c('0x7b')];}if(_0x161a4f){_[_0xbf4c('0x7c')](_0x161a4f[_0xbf4c('0x41')],function(_0x198ef7){return _0x198ef7['custom']===![]&&!_0x485f01[_0xbf4c('0x7d')](_0x198ef7[_0xbf4c('0x34')]);});return{'count':_0x161a4f['fields'][_0xbf4c('0x42')],'rows':_[_0xbf4c('0x37')](_0x161a4f[_0xbf4c('0x41')],function(_0x25b117){return{'id':_0x25b117[_0xbf4c('0x34')],'name':_0x25b117[_0xbf4c('0x7e')],'custom':_0x25b117[_0xbf4c('0x7f')],'options':_0x25b117[_0xbf4c('0x80')][_0xbf4c('0x42')]>0x0?_['map'](_0x25b117[_0xbf4c('0x80')],function(_0x5ad806){return{'name':_0x5ad806['label'],'value':_0x5ad806[_0xbf4c('0x81')]};}):_0x25b117['type']==_0xbf4c('0x82')?[{'name':_0xbf4c('0x83'),'value':_0xbf4c('0x84')},{'name':'False','value':_0xbf4c('0x85')}]:[]};})};}})[_0xbf4c('0x1d')](respondWithResult(_0x945f46,null))['catch'](function(_0x4fae35){var _0x3bf1b1=_0x2aa46d[_0xbf4c('0x3d')]['test']?0x1f4:_0x4fae35[_0xbf4c('0x86')]||0x1f4;logger[_0xbf4c('0x23')](_0xbf4c('0x87'),_0xbf4c('0x61'),_0x3bf1b1,JSON[_0xbf4c('0x22')](_0x4fae35));delete _0x4fae35[_0xbf4c('0x34')];if(_0x3bf1b1===0x191){_0x3bf1b1=0x190;}_0x945f46[_0xbf4c('0x28')](_0x3bf1b1)[_0xbf4c('0x35')](_0x2aa46d[_0xbf4c('0x3d')][_0xbf4c('0x1a')]?{'message':_0xbf4c('0x88'),'statusCode':_0x4fae35[_0xbf4c('0x86')]}:_0x4fae35);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 558c3a8..f31ae58 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 _0xf4a4=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts'];(function(_0x35a343,_0xfe51c1){var _0x3577ca=function(_0x34e47e){while(--_0x34e47e){_0x35a343['push'](_0x35a343['shift']());}};_0x3577ca(++_0xfe51c1);}(_0xf4a4,0x9c));var _0x4f4a=function(_0x3b45fb,_0x181ec2){_0x3b45fb=_0x3b45fb-0x0;var _0x4924a6=_0xf4a4[_0x3b45fb];return _0x4924a6;};'use strict';var _=require('lodash');var util=require(_0x4f4a('0x0'));var logger=require(_0x4f4a('0x1'))(_0x4f4a('0x2'));var moment=require(_0x4f4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x4f4a('0x4'));var fs=require('fs');var path=require(_0x4f4a('0x5'));var rimraf=require(_0x4f4a('0x6'));var config=require(_0x4f4a('0x7'));var attributes=require(_0x4f4a('0x8'));var integrations=require(_0x4f4a('0x9'));module[_0x4f4a('0xa')]=function(_0x386934,_0x39ff21){return _0x386934[_0x4f4a('0xb')]('SalesforceAccount',attributes,{'tableName':_0x4f4a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bf1=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0x9bf1,0x1da));var _0x19bf=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x9bf1[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require('lodash');var util=require(_0x19bf('0x0'));var logger=require(_0x19bf('0x1'))(_0x19bf('0x2'));var moment=require(_0x19bf('0x3'));var BPromise=require('bluebird');var rp=require(_0x19bf('0x4'));var fs=require('fs');var path=require(_0x19bf('0x5'));var rimraf=require(_0x19bf('0x6'));var config=require(_0x19bf('0x7'));var attributes=require(_0x19bf('0x8'));var integrations=require(_0x19bf('0x9'));module[_0x19bf('0xa')]=function(_0x5bff5b,_0x500e4a){return _0x5bff5b['define'](_0x19bf('0xb'),attributes,{'tableName':_0x19bf('0xc'),'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 ee9c5be..ddeb4de 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 _0xd2ea=['attributes','limit','include','map','model','then','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where'];(function(_0x3da546,_0x2987ec){var _0x46835f=function(_0x18db87){while(--_0x18db87){_0x3da546['push'](_0x3da546['shift']());}};_0x46835f(++_0x2987ec);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2c5bf8,_0x436e68){_0x2c5bf8=_0x2c5bf8-0x0;var _0x1b5ace=_0xd2ea[_0x2c5bf8];return _0x1b5ace;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});}exports[_0xad2e('0x18')]=function(_0x34f946){var _0x1b4889=this;return new Promise(function(_0x163e83,_0x4ef16f){return db[_0xad2e('0x19')][_0xad2e('0x1a')]({'raw':_0x34f946['options']?_0x34f946['options']['raw']===undefined?!![]:![]:!![],'where':_0x34f946['options']?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1c')]||null:null,'attributes':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1d')]||null:null,'limit':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1e')]||null:null,'include':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1f')],function(_0x207517){return{'model':db[_0x207517[_0xad2e('0x21')]],'as':_0x207517['as'],'attributes':_0x207517['attributes'],'include':_0x207517[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x207517[_0xad2e('0x1f')],function(_0x350c66){return{'model':db[_0x350c66[_0xad2e('0x21')]],'as':_0x350c66['as'],'attributes':_0x350c66[_0xad2e('0x1d')],'include':_0x350c66[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x350c66[_0xad2e('0x1f')],function(_0x50d446){return{'model':db[_0x50d446[_0xad2e('0x21')]],'as':_0x50d446['as'],'attributes':_0x50d446['attributes']};}):[]};}):[]};}):[]:[]})[_0xad2e('0x22')](function(_0x28ef72){logger[_0xad2e('0x15')](_0xad2e('0x18'),_0x34f946);logger[_0xad2e('0xf')](_0xad2e('0x18'),_0x34f946,JSON[_0xad2e('0x11')](_0x28ef72));_0x163e83(_0x28ef72);})[_0xad2e('0x17')](function(_0x52fdda){logger[_0xad2e('0x12')]('GetSalesforceAccount',_0x52fdda[_0xad2e('0x14')],_0x34f946);_0x4ef16f(_0x1b4889[_0xad2e('0x12')](0x1f4,_0x52fdda[_0xad2e('0x14')]));});});};exports[_0xad2e('0x23')]=function(_0x42fe6c){var _0x9b4a23=this;return new Promise(function(_0x409f58,_0x3e3d86){return db[_0xad2e('0x19')][_0xad2e('0x24')]({'raw':_0x42fe6c[_0xad2e('0x1b')]?_0x42fe6c['options'][_0xad2e('0x25')]===undefined?!![]:![]:!![],'where':_0x42fe6c['options']?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1c')]||null:null,'attributes':_0x42fe6c[_0xad2e('0x1b')]?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1d')]||null:null,'include':_0x42fe6c['options']?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1f')]?_['map'](_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1f')],function(_0x569b9c){return{'model':db[_0x569b9c[_0xad2e('0x21')]],'as':_0x569b9c['as'],'attributes':_0x569b9c[_0xad2e('0x1d')],'include':_0x569b9c[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x569b9c[_0xad2e('0x1f')],function(_0x2fa320){return{'model':db[_0x2fa320[_0xad2e('0x21')]],'as':_0x2fa320['as'],'attributes':_0x2fa320['attributes'],'include':_0x2fa320[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x2fa320['include'],function(_0x161402){return{'model':db[_0x161402[_0xad2e('0x21')]],'as':_0x161402['as'],'attributes':_0x161402[_0xad2e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xad2e('0x22')](function(_0x48c77b){logger[_0xad2e('0x15')]('ShowSalesforceAccount',_0x42fe6c);logger['debug'](_0xad2e('0x23'),_0x42fe6c,JSON['stringify'](_0x48c77b));_0x409f58(_0x48c77b);})[_0xad2e('0x17')](function(_0x33c2a8){logger[_0xad2e('0x12')](_0xad2e('0x23'),_0x33c2a8[_0xad2e('0x14')],_0x42fe6c);_0x3e3d86(_0x9b4a23['error'](0x1f4,_0x33c2a8[_0xad2e('0x14')]));});});}; \ No newline at end of file +var _0x9aea=['attributes','limit','include','map','model','GetSalesforceAccount','stringify','catch','ShowSalesforceAccount','find','raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','SalesforceAccount','findAll','options','where'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x9aea,0xdd));var _0xa9ae=function(_0x215dda,_0x517862){_0x215dda=_0x215dda-0x0;var _0x24104f=_0x9aea[_0x215dda];return _0x24104f;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var moment=require(_0xa9ae('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9ae('0x2'));var fs=require('fs');var Redis=require(_0xa9ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9ae('0x4'));var logger=require(_0xa9ae('0x5'))(_0xa9ae('0x6'));var config=require(_0xa9ae('0x7'));var jayson=require(_0xa9ae('0x8'));var client=jayson['client'][_0xa9ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22734b,_0x1e57c4,_0x53e52c){return new BPromise(function(_0x1f2e4b,_0x3917f0){return client[_0xa9ae('0xa')](_0x22734b,_0x53e52c)[_0xa9ae('0xb')](function(_0x1882dc){logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));logger[_0xa9ae('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1e57c4,_0xa9ae('0xe'),JSON['stringify'](_0x1882dc));if(_0x1882dc[_0xa9ae('0x10')]){if(_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x11')]===0x1f4){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x3917f0(_0x1882dc[_0xa9ae('0x10')]['message']);}logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x1f2e4b(_0x1882dc['error'][_0xa9ae('0x12')]);}else{logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));_0x1f2e4b(_0x1882dc[_0xa9ae('0x13')][_0xa9ae('0x12')]);}})['catch'](function(_0x3e4810){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x3e4810);_0x3917f0(_0x3e4810);});});}exports['GetSalesforceAccount']=function(_0x4dbb30){var _0xb078d2=this;return new Promise(function(_0x581345,_0x59e7dd){return db[_0xa9ae('0x14')][_0xa9ae('0x15')]({'raw':_0x4dbb30[_0xa9ae('0x16')]?_0x4dbb30[_0xa9ae('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4dbb30[_0xa9ae('0x16')]?_0x4dbb30[_0xa9ae('0x16')][_0xa9ae('0x17')]||null:null,'attributes':_0x4dbb30[_0xa9ae('0x16')]?_0x4dbb30[_0xa9ae('0x16')][_0xa9ae('0x18')]||null:null,'limit':_0x4dbb30[_0xa9ae('0x16')]?_0x4dbb30['options'][_0xa9ae('0x19')]||null:null,'include':_0x4dbb30['options']?_0x4dbb30['options']['include']?_['map'](_0x4dbb30[_0xa9ae('0x16')]['include'],function(_0x13fb05){return{'model':db[_0x13fb05['model']],'as':_0x13fb05['as'],'attributes':_0x13fb05[_0xa9ae('0x18')],'include':_0x13fb05[_0xa9ae('0x1a')]?_[_0xa9ae('0x1b')](_0x13fb05[_0xa9ae('0x1a')],function(_0x12b061){return{'model':db[_0x12b061[_0xa9ae('0x1c')]],'as':_0x12b061['as'],'attributes':_0x12b061[_0xa9ae('0x18')],'include':_0x12b061['include']?_[_0xa9ae('0x1b')](_0x12b061[_0xa9ae('0x1a')],function(_0x2aac9e){return{'model':db[_0x2aac9e[_0xa9ae('0x1c')]],'as':_0x2aac9e['as'],'attributes':_0x2aac9e[_0xa9ae('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa9ae('0xb')](function(_0xb12fa8){logger['info']('GetSalesforceAccount',_0x4dbb30);logger[_0xa9ae('0xf')](_0xa9ae('0x1d'),_0x4dbb30,JSON[_0xa9ae('0x1e')](_0xb12fa8));_0x581345(_0xb12fa8);})[_0xa9ae('0x1f')](function(_0x74cd94){logger['error']('GetSalesforceAccount',_0x74cd94[_0xa9ae('0x12')],_0x4dbb30);_0x59e7dd(_0xb078d2[_0xa9ae('0x10')](0x1f4,_0x74cd94[_0xa9ae('0x12')]));});});};exports[_0xa9ae('0x20')]=function(_0x314969){var _0x36bc28=this;return new Promise(function(_0x5d0c84,_0x5415f1){return db[_0xa9ae('0x14')][_0xa9ae('0x21')]({'raw':_0x314969[_0xa9ae('0x16')]?_0x314969[_0xa9ae('0x16')][_0xa9ae('0x22')]===undefined?!![]:![]:!![],'where':_0x314969[_0xa9ae('0x16')]?_0x314969[_0xa9ae('0x16')][_0xa9ae('0x17')]||null:null,'attributes':_0x314969['options']?_0x314969[_0xa9ae('0x16')]['attributes']||null:null,'include':_0x314969[_0xa9ae('0x16')]?_0x314969[_0xa9ae('0x16')][_0xa9ae('0x1a')]?_['map'](_0x314969[_0xa9ae('0x16')][_0xa9ae('0x1a')],function(_0x383511){return{'model':db[_0x383511[_0xa9ae('0x1c')]],'as':_0x383511['as'],'attributes':_0x383511[_0xa9ae('0x18')],'include':_0x383511['include']?_[_0xa9ae('0x1b')](_0x383511[_0xa9ae('0x1a')],function(_0x44053a){return{'model':db[_0x44053a['model']],'as':_0x44053a['as'],'attributes':_0x44053a['attributes'],'include':_0x44053a[_0xa9ae('0x1a')]?_[_0xa9ae('0x1b')](_0x44053a[_0xa9ae('0x1a')],function(_0x1a01a4){return{'model':db[_0x1a01a4['model']],'as':_0x1a01a4['as'],'attributes':_0x1a01a4[_0xa9ae('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa9ae('0xb')](function(_0x231192){logger[_0xa9ae('0xc')](_0xa9ae('0x20'),_0x314969);logger['debug'](_0xa9ae('0x20'),_0x314969,JSON['stringify'](_0x231192));_0x5d0c84(_0x231192);})[_0xa9ae('0x1f')](function(_0x38f360){logger[_0xa9ae('0x10')]('ShowSalesforceAccount',_0x38f360[_0xa9ae('0x12')],_0x314969);_0x5415f1(_0x36bc28[_0xa9ae('0x10')](0x1f4,_0x38f360[_0xa9ae('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0173a89..81c271c 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 _0xee99=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x38b396,_0x5353aa){var _0x5daa5f=function(_0x2f4fd3){while(--_0x2f4fd3){_0x38b396['push'](_0x38b396['shift']());}};_0x5daa5f(++_0x5353aa);}(_0xee99,0xa1));var _0x9ee9=function(_0x109e4d,_0x570978){_0x109e4d=_0x109e4d-0x0;var _0x4a5963=_0xee99[_0x109e4d];return _0x4a5963;};'use strict';var multer=require(_0x9ee9('0x0'));var util=require(_0x9ee9('0x1'));var path=require(_0x9ee9('0x2'));var timeout=require(_0x9ee9('0x3'));var express=require(_0x9ee9('0x4'));var router=express[_0x9ee9('0x5')]();var auth=require(_0x9ee9('0x6'));var interaction=require(_0x9ee9('0x7'));var config=require(_0x9ee9('0x8'));var controller=require(_0x9ee9('0x9'));router[_0x9ee9('0xa')]('/',auth['isAuthenticated'](),controller[_0x9ee9('0xb')]);router['get'](_0x9ee9('0xc'),auth[_0x9ee9('0xd')](),controller[_0x9ee9('0xe')]);router[_0x9ee9('0xa')](_0x9ee9('0xf'),auth[_0x9ee9('0xd')](),controller[_0x9ee9('0x10')]);router[_0x9ee9('0xa')]('/:id/subjects',auth[_0x9ee9('0xd')](),controller[_0x9ee9('0x11')]);router['get'](_0x9ee9('0x12'),auth[_0x9ee9('0xd')](),controller[_0x9ee9('0x13')]);router[_0x9ee9('0x14')]('/',auth['isAuthenticated'](),controller[_0x9ee9('0x15')]);router['put']('/:id',auth[_0x9ee9('0xd')](),controller[_0x9ee9('0x16')]);router[_0x9ee9('0x17')]('/:id',auth[_0x9ee9('0xd')](),controller[_0x9ee9('0x18')]);module[_0x9ee9('0x19')]=router; \ No newline at end of file +var _0xd9f4=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x26e949,_0x38ed2c){var _0x44daf6=function(_0x5b2496){while(--_0x5b2496){_0x26e949['push'](_0x26e949['shift']());}};_0x44daf6(++_0x38ed2c);}(_0xd9f4,0x1f0));var _0x4d9f=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xd9f4[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0x4d9f('0x0'));var util=require(_0x4d9f('0x1'));var path=require('path');var timeout=require(_0x4d9f('0x2'));var express=require(_0x4d9f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4d9f('0x4'));var config=require(_0x4d9f('0x5'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth[_0x4d9f('0x6')](),controller[_0x4d9f('0x7')]);router[_0x4d9f('0x8')]('/:id',auth[_0x4d9f('0x6')](),controller['show']);router[_0x4d9f('0x8')]('/:id/fields',auth[_0x4d9f('0x6')](),controller[_0x4d9f('0x9')]);router[_0x4d9f('0x8')](_0x4d9f('0xa'),auth[_0x4d9f('0x6')](),controller['getSubjects']);router['get'](_0x4d9f('0xb'),auth[_0x4d9f('0x6')](),controller[_0x4d9f('0xc')]);router[_0x4d9f('0xd')]('/',auth['isAuthenticated'](),controller[_0x4d9f('0xe')]);router[_0x4d9f('0xf')](_0x4d9f('0x10'),auth[_0x4d9f('0x6')](),controller[_0x4d9f('0x11')]);router['delete'](_0x4d9f('0x10'),auth['isAuthenticated'](),controller[_0x4d9f('0x12')]);module[_0x4d9f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index bfe27b0..f7e1588 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 _0xb01e=['contact_lead','lead','ENUM','sequelize','exports','STRING','Case','Task'];(function(_0x498b38,_0x2d9583){var _0x10feb7=function(_0x5a4949){while(--_0x5a4949){_0x498b38['push'](_0x498b38['shift']());}};_0x10feb7(++_0x2d9583);}(_0xb01e,0x13b));var _0xeb01=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb01e[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0xeb01('0x0'));module[_0xeb01('0x1')]={'name':{'type':Sequelize[_0xeb01('0x2')]},'description':{'type':Sequelize[_0xeb01('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0xeb01('0x3')),'defaultValue':_0xeb01('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xeb01('0x5'),'contact',_0xeb01('0x6')),'defaultValue':_0xeb01('0x5')},'moduleCreate':{'type':Sequelize[_0xeb01('0x7')]('nothing','contact','lead'),'defaultValue':_0xeb01('0x6')}}; \ No newline at end of file +var _0xb864=['contact','lead','sequelize','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x2a4a83,_0x187c51){var _0x44a2b0=function(_0x3df495){while(--_0x3df495){_0x2a4a83['push'](_0x2a4a83['shift']());}};_0x44a2b0(++_0x187c51);}(_0xb864,0x1df));var _0x4b86=function(_0x53af11,_0x1f7f88){_0x53af11=_0x53af11-0x0;var _0x32a0fd=_0xb864[_0x53af11];return _0x32a0fd;};'use strict';var Sequelize=require(_0x4b86('0x0'));module[_0x4b86('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b86('0x2')]},'ticketType':{'type':Sequelize[_0x4b86('0x3')](_0x4b86('0x4'),_0x4b86('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x4b86('0x6'),_0x4b86('0x7'),_0x4b86('0x8')),'defaultValue':_0x4b86('0x6')},'moduleCreate':{'type':Sequelize[_0x4b86('0x3')]('nothing',_0x4b86('0x7'),_0x4b86('0x8')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 5f492fd..be57fa7 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 _0x3eca=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','SalesforceConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','create','body','getFields','findOne','SalesforceField','sort','pick','filter','map','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x2920e9,_0x2a97bf){var _0x5e29ad=function(_0x3c58bc){while(--_0x3c58bc){_0x2920e9['push'](_0x2920e9['shift']());}};_0x5e29ad(++_0x2a97bf);}(_0x3eca,0x17e));var _0xa3ec=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x3eca[_0x45d1fd];return _0xd0e542;};'use strict';var pdf=require(_0xa3ec('0x0'));var emlformat=require(_0xa3ec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa3ec('0x2'));var jsonpatch=require(_0xa3ec('0x3'));var rp=require(_0xa3ec('0x4'));var moment=require(_0xa3ec('0x5'));var BPromise=require(_0xa3ec('0x6'));var Mustache=require(_0xa3ec('0x7'));var util=require(_0xa3ec('0x8'));var path=require(_0xa3ec('0x9'));var sox=require(_0xa3ec('0xa'));var csv=require(_0xa3ec('0xb'));var ejs=require(_0xa3ec('0xc'));var fs=require('fs');var _=require(_0xa3ec('0xd'));var squel=require(_0xa3ec('0xe'));var crypto=require(_0xa3ec('0xf'));var jsforce=require(_0xa3ec('0x10'));var deskjs=require(_0xa3ec('0x11'));var toCsv=require(_0xa3ec('0xb'));var querystring=require(_0xa3ec('0x12'));var Papa=require(_0xa3ec('0x13'));var Redis=require(_0xa3ec('0x14'));var authService=require(_0xa3ec('0x15'));var qs=require(_0xa3ec('0x16'));var as=require(_0xa3ec('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ec('0x18'))('api');var utils=require(_0xa3ec('0x19'));var config=require(_0xa3ec('0x1a'));var db=require(_0xa3ec('0x1b'))['db'];var jayson=require(_0xa3ec('0x1c'));var client=jayson[_0xa3ec('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x5e6fdf,_0x30d5fe,_0x3a7b26){if(_0x3a7b26){var _0x409ec2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x409ec2['test'](_0x30d5fe)){return _0x5e6fdf;}else{throw new db['Sequelize'][(_0xa3ec('0x1e'))](_0xa3ec('0x1f'));}}else{return _0x5e6fdf;}}function respondWithRpcPromise(_0x165a57,_0x5c28ed,_0x569ed3,_0x548dfc){return new BPromise(function(_0x55bfd3,_0x51b57f){var _0x6b8d86=_0x548dfc||client;return _0x6b8d86[_0xa3ec('0x20')](_0x165a57,_0x569ed3)['then'](function(_0x1b2ec3){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5c28ed,_0xa3ec('0x21'));logger[_0xa3ec('0x22')](_0xa3ec('0x23'),_0x5c28ed,_0xa3ec('0x21'),JSON[_0xa3ec('0x24')](_0x1b2ec3));if(_0x1b2ec3[_0xa3ec('0x25')]){if(_0x1b2ec3[_0xa3ec('0x25')][_0xa3ec('0x26')]===0x1f4){logger[_0xa3ec('0x25')](_0xa3ec('0x27'),_0x5c28ed,_0x1b2ec3[_0xa3ec('0x25')]['message']);return _0x51b57f(_0x1b2ec3[_0xa3ec('0x25')]['message']);}logger[_0xa3ec('0x25')](_0xa3ec('0x27'),_0x5c28ed,_0x1b2ec3['error'][_0xa3ec('0x28')]);return _0x55bfd3(_0x1b2ec3[_0xa3ec('0x25')][_0xa3ec('0x28')]);}else{logger['info'](_0xa3ec('0x27'),_0x5c28ed,_0xa3ec('0x21'));_0x55bfd3(_0x1b2ec3[_0xa3ec('0x29')][_0xa3ec('0x28')]);}})[_0xa3ec('0x2a')](function(_0x23190a){logger['error'](_0xa3ec('0x27'),_0x5c28ed,_0x23190a);_0x51b57f(_0x23190a);});});}function respondWithStatusCode(_0x259f53,_0x169d4a){_0x169d4a=_0x169d4a||0xcc;return function(_0x44dd53){if(_0x44dd53){return _0x259f53[_0xa3ec('0x2b')](_0x169d4a);}return _0x259f53[_0xa3ec('0x2c')](_0x169d4a)[_0xa3ec('0x2d')]();};}function respondWithResult(_0x44754b,_0x830e3){_0x830e3=_0x830e3||0xc8;return function(_0x5bbaa9){if(_0x5bbaa9){return _0x44754b[_0xa3ec('0x2c')](_0x830e3)[_0xa3ec('0x2e')](_0x5bbaa9);}};}function respondWithFilteredResult(_0x4d294c,_0x1d4d0f){return function(_0xdced81){if(_0xdced81){var _0x31ceec=_0xdced81[_0xa3ec('0x2f')],_0x1da918=_0x1d4d0f[_0xa3ec('0x30')],_0x3d4b4f=_0x1d4d0f[_0xa3ec('0x30')]+_0x1d4d0f[_0xa3ec('0x31')],_0x116e48;if(_0x3d4b4f>=_0x31ceec){_0x3d4b4f=_0x31ceec;_0x116e48=0xc8;}else{_0x116e48=0xce;}_0x4d294c[_0xa3ec('0x2c')](_0x116e48);return _0x4d294c[_0xa3ec('0x32')](_0xa3ec('0x33'),_0x1da918+'-'+_0x3d4b4f+'/'+_0x31ceec)['json'](_0xdced81);}return null;};}function patchUpdates(_0x67541a){return function(_0x2359e8){try{jsonpatch[_0xa3ec('0x34')](_0x2359e8,_0x67541a,!![]);}catch(_0x3d02ba){return BPromise[_0xa3ec('0x35')](_0x3d02ba);}return _0x2359e8[_0xa3ec('0x36')]();};}function saveUpdates(_0x5df0d3,_0x1f15fb){return function(_0x5191da){if(_0x5191da){return _0x5191da[_0xa3ec('0x37')](_0x5df0d3)[_0xa3ec('0x38')](function(_0x14fff7){return _0x14fff7;});}return null;};}function removeEntity(_0x45a359,_0x3520ce){return function(_0x15b32f){if(_0x15b32f){return _0x15b32f[_0xa3ec('0x39')]()[_0xa3ec('0x38')](function(){_0x45a359[_0xa3ec('0x2c')](0xcc)[_0xa3ec('0x2d')]();});}};}function handleEntityNotFound(_0x1411a6,_0x5a8e77){return function(_0xcad6d7){if(!_0xcad6d7){_0x1411a6[_0xa3ec('0x2b')](0x194);}return _0xcad6d7;};}function handleError(_0x3f31fe,_0x2f925d){_0x2f925d=_0x2f925d||0x1f4;return function(_0x53fec6){logger[_0xa3ec('0x25')](_0x53fec6[_0xa3ec('0x3a')]);if(_0x53fec6[_0xa3ec('0x3b')]){delete _0x53fec6[_0xa3ec('0x3b')];}_0x3f31fe['status'](_0x2f925d)['send'](_0x53fec6);};}exports[_0xa3ec('0x3c')]=function(_0x22d346,_0xbf48b1){var _0x2fb585={},_0x2410a4={},_0x11e885={'count':0x0,'rows':[]};var _0xf69284=_['map'](db[_0xa3ec('0x3d')]['rawAttributes'],function(_0x417bec){return{'name':_0x417bec[_0xa3ec('0x3e')],'type':_0x417bec[_0xa3ec('0x3f')][_0xa3ec('0x40')]};});_0x2410a4[_0xa3ec('0x41')]=_['map'](_0xf69284,_0xa3ec('0x3b'));_0x2410a4[_0xa3ec('0x42')]=_['keys'](_0x22d346[_0xa3ec('0x42')]);_0x2410a4[_0xa3ec('0x43')]=_[_0xa3ec('0x44')](_0x2410a4[_0xa3ec('0x41')],_0x2410a4['query']);_0x2fb585[_0xa3ec('0x45')]=_[_0xa3ec('0x44')](_0x2410a4[_0xa3ec('0x41')],qs[_0xa3ec('0x46')](_0x22d346[_0xa3ec('0x42')][_0xa3ec('0x46')]));_0x2fb585[_0xa3ec('0x45')]=_0x2fb585[_0xa3ec('0x45')][_0xa3ec('0x47')]?_0x2fb585['attributes']:_0x2410a4[_0xa3ec('0x41')];if(!_0x22d346[_0xa3ec('0x42')][_0xa3ec('0x48')](_0xa3ec('0x49'))){_0x2fb585['limit']=qs[_0xa3ec('0x31')](_0x22d346[_0xa3ec('0x42')][_0xa3ec('0x31')]);_0x2fb585[_0xa3ec('0x30')]=qs['offset'](_0x22d346[_0xa3ec('0x42')][_0xa3ec('0x30')]);}_0x2fb585[_0xa3ec('0x4a')]=qs['sort'](_0x22d346['query']['sort']);_0x2fb585[_0xa3ec('0x4b')]=qs[_0xa3ec('0x43')](_['pick'](_0x22d346[_0xa3ec('0x42')],_0x2410a4[_0xa3ec('0x43')]),_0xf69284);if(_0x22d346[_0xa3ec('0x42')]['filter']){_0x2fb585[_0xa3ec('0x4b')]=_[_0xa3ec('0x4c')](_0x2fb585[_0xa3ec('0x4b')],{'$or':_['map'](_0xf69284,function(_0x35095a){if(_0x35095a[_0xa3ec('0x3f')]!==_0xa3ec('0x4d')){var _0x3ec0b3={};_0x3ec0b3[_0x35095a[_0xa3ec('0x3b')]]={'$like':'%'+_0x22d346[_0xa3ec('0x42')]['filter']+'%'};return _0x3ec0b3;}})});}_0x2fb585=_[_0xa3ec('0x4c')]({},_0x2fb585,_0x22d346[_0xa3ec('0x4e')]);var _0x2155f6={'where':_0x2fb585[_0xa3ec('0x4b')]};return db[_0xa3ec('0x3d')][_0xa3ec('0x2f')](_0x2155f6)[_0xa3ec('0x38')](function(_0x2dbbf2){_0x11e885[_0xa3ec('0x2f')]=_0x2dbbf2;if(_0x22d346[_0xa3ec('0x42')][_0xa3ec('0x4f')]){_0x2fb585[_0xa3ec('0x50')]=[{'all':!![]}];}return db[_0xa3ec('0x3d')][_0xa3ec('0x51')](_0x2fb585);})[_0xa3ec('0x38')](function(_0x12e1c7){_0x11e885[_0xa3ec('0x52')]=_0x12e1c7;return _0x11e885;})[_0xa3ec('0x38')](respondWithFilteredResult(_0xbf48b1,_0x2fb585))[_0xa3ec('0x2a')](handleError(_0xbf48b1,null));};exports[_0xa3ec('0x53')]=function(_0x338884,_0x12b617){var _0x3c2c35={'raw':![],'where':{'id':_0x338884[_0xa3ec('0x54')]['id']}},_0x346066={};_0x346066[_0xa3ec('0x41')]=_['keys'](db[_0xa3ec('0x3d')][_0xa3ec('0x55')]);_0x346066[_0xa3ec('0x42')]=_[_0xa3ec('0x56')](_0x338884[_0xa3ec('0x42')]);_0x346066[_0xa3ec('0x43')]=_[_0xa3ec('0x44')](_0x346066['model'],_0x346066[_0xa3ec('0x42')]);_0x3c2c35[_0xa3ec('0x45')]=_['intersection'](_0x346066['model'],qs['fields'](_0x338884['query']['fields']));_0x3c2c35[_0xa3ec('0x45')]=_0x3c2c35[_0xa3ec('0x45')]['length']?_0x3c2c35[_0xa3ec('0x45')]:_0x346066[_0xa3ec('0x41')];if(_0x338884[_0xa3ec('0x42')]['includeAll']){_0x3c2c35[_0xa3ec('0x50')]=[{'all':!![]}];}_0x3c2c35=_['merge']({},_0x3c2c35,_0x338884[_0xa3ec('0x4e')]);return db[_0xa3ec('0x3d')][_0xa3ec('0x57')](_0x3c2c35)[_0xa3ec('0x38')](handleEntityNotFound(_0x12b617,null))['then'](respondWithResult(_0x12b617,null))[_0xa3ec('0x2a')](handleError(_0x12b617,null));};exports[_0xa3ec('0x58')]=function(_0x548598,_0x4f769e){return db[_0xa3ec('0x3d')][_0xa3ec('0x58')](_0x548598['body'],{})['then'](respondWithResult(_0x4f769e,0xc9))['catch'](handleError(_0x4f769e,null));};exports[_0xa3ec('0x37')]=function(_0x1f6db5,_0x25048e){if(_0x1f6db5[_0xa3ec('0x59')]['id']){delete _0x1f6db5[_0xa3ec('0x59')]['id'];}return db['SalesforceConfiguration'][_0xa3ec('0x57')]({'where':{'id':_0x1f6db5[_0xa3ec('0x54')]['id']}})[_0xa3ec('0x38')](handleEntityNotFound(_0x25048e,null))[_0xa3ec('0x38')](saveUpdates(_0x1f6db5[_0xa3ec('0x59')],null))['then'](respondWithResult(_0x25048e,null))['catch'](handleError(_0x25048e,null));};exports[_0xa3ec('0x39')]=function(_0x544a85,_0x508573){return db[_0xa3ec('0x3d')][_0xa3ec('0x57')]({'where':{'id':_0x544a85['params']['id']}})['then'](handleEntityNotFound(_0x508573,null))[_0xa3ec('0x38')](removeEntity(_0x508573,null))[_0xa3ec('0x2a')](handleError(_0x508573,null));};exports[_0xa3ec('0x5a')]=function(_0x50dd53,_0x2f8eca,_0x47d8b2){var _0x4a4009={};var _0x49ef45={};var _0x4bec8a;var _0x236004;return db['SalesforceConfiguration'][_0xa3ec('0x5b')]({'where':{'id':_0x50dd53['params']['id']}})[_0xa3ec('0x38')](handleEntityNotFound(_0x2f8eca,null))['then'](function(_0x17a2bc){if(_0x17a2bc){_0x4bec8a=_0x17a2bc;_0x49ef45[_0xa3ec('0x41')]=_[_0xa3ec('0x56')](db[_0xa3ec('0x5c')]['rawAttributes']);_0x49ef45[_0xa3ec('0x42')]=_[_0xa3ec('0x56')](_0x50dd53[_0xa3ec('0x42')]);_0x49ef45[_0xa3ec('0x43')]=_[_0xa3ec('0x44')](_0x49ef45[_0xa3ec('0x41')],_0x49ef45[_0xa3ec('0x42')]);_0x4a4009[_0xa3ec('0x45')]=_[_0xa3ec('0x44')](_0x49ef45['model'],qs[_0xa3ec('0x46')](_0x50dd53['query'][_0xa3ec('0x46')]));_0x4a4009['attributes']=_0x4a4009[_0xa3ec('0x45')][_0xa3ec('0x47')]?_0x4a4009['attributes']:_0x49ef45[_0xa3ec('0x41')];_0x4a4009[_0xa3ec('0x4a')]=qs['sort'](_0x50dd53[_0xa3ec('0x42')][_0xa3ec('0x5d')]);_0x4a4009[_0xa3ec('0x4b')]=qs[_0xa3ec('0x43')](_[_0xa3ec('0x5e')](_0x50dd53[_0xa3ec('0x42')],_0x49ef45[_0xa3ec('0x43')]));if(_0x50dd53['query'][_0xa3ec('0x5f')]){_0x4a4009[_0xa3ec('0x4b')]=_[_0xa3ec('0x4c')](_0x4a4009[_0xa3ec('0x4b')],{'$or':_[_0xa3ec('0x60')](_0x4a4009[_0xa3ec('0x45')],function(_0x502c58){var _0x40d843={};_0x40d843[_0x502c58]={'$like':'%'+_0x50dd53['query']['filter']+'%'};return _0x40d843;})});}_0x4a4009=_[_0xa3ec('0x4c')]({},_0x4a4009,_0x50dd53[_0xa3ec('0x4e')]);return _0x4bec8a['getFields'](_0x4a4009);}})[_0xa3ec('0x38')](function(_0x2659fd){if(_0x2659fd){_0x236004=_0x2659fd[_0xa3ec('0x47')];if(!_0x50dd53['query']['hasOwnProperty'](_0xa3ec('0x49'))){_0x4a4009[_0xa3ec('0x31')]=qs[_0xa3ec('0x31')](_0x50dd53[_0xa3ec('0x42')][_0xa3ec('0x31')]);_0x4a4009[_0xa3ec('0x30')]=qs[_0xa3ec('0x30')](_0x50dd53[_0xa3ec('0x42')][_0xa3ec('0x30')]);}return _0x4bec8a[_0xa3ec('0x5a')](_0x4a4009);}})['then'](function(_0x3b77b2){if(_0x3b77b2){return _0x3b77b2?{'count':_0x236004,'rows':_0x3b77b2}:null;}})[_0xa3ec('0x38')](respondWithResult(_0x2f8eca,null))[_0xa3ec('0x2a')](handleError(_0x2f8eca,null));};exports['getSubjects']=function(_0x2315d4,_0x3f474e,_0x2d8db2){var _0x5ac2b1={};var _0x40f793={};var _0x2665b2;var _0x44849d;return db['SalesforceConfiguration'][_0xa3ec('0x5b')]({'where':{'id':_0x2315d4[_0xa3ec('0x54')]['id']}})[_0xa3ec('0x38')](handleEntityNotFound(_0x3f474e,null))[_0xa3ec('0x38')](function(_0x1c29bb){if(_0x1c29bb){_0x2665b2=_0x1c29bb;_0x40f793['model']=_[_0xa3ec('0x56')](db[_0xa3ec('0x5c')]['rawAttributes']);_0x40f793[_0xa3ec('0x42')]=_[_0xa3ec('0x56')](_0x2315d4[_0xa3ec('0x42')]);_0x40f793[_0xa3ec('0x43')]=_['intersection'](_0x40f793[_0xa3ec('0x41')],_0x40f793[_0xa3ec('0x42')]);_0x5ac2b1[_0xa3ec('0x45')]=_[_0xa3ec('0x44')](_0x40f793['model'],qs[_0xa3ec('0x46')](_0x2315d4[_0xa3ec('0x42')]['fields']));_0x5ac2b1[_0xa3ec('0x45')]=_0x5ac2b1[_0xa3ec('0x45')][_0xa3ec('0x47')]?_0x5ac2b1[_0xa3ec('0x45')]:_0x40f793[_0xa3ec('0x41')];_0x5ac2b1[_0xa3ec('0x4a')]=qs['sort'](_0x2315d4[_0xa3ec('0x42')][_0xa3ec('0x5d')]);_0x5ac2b1[_0xa3ec('0x4b')]=qs[_0xa3ec('0x43')](_[_0xa3ec('0x5e')](_0x2315d4[_0xa3ec('0x42')],_0x40f793[_0xa3ec('0x43')]));if(_0x2315d4['query'][_0xa3ec('0x5f')]){_0x5ac2b1['where']=_[_0xa3ec('0x4c')](_0x5ac2b1[_0xa3ec('0x4b')],{'$or':_[_0xa3ec('0x60')](_0x5ac2b1['attributes'],function(_0x47bdb9){var _0x5f4ca7={};_0x5f4ca7[_0x47bdb9]={'$like':'%'+_0x2315d4[_0xa3ec('0x42')]['filter']+'%'};return _0x5f4ca7;})});}_0x5ac2b1=_[_0xa3ec('0x4c')]({},_0x5ac2b1,_0x2315d4['options']);return _0x2665b2['getSubjects'](_0x5ac2b1);}})['then'](function(_0x521a6a){if(_0x521a6a){_0x44849d=_0x521a6a[_0xa3ec('0x47')];if(!_0x2315d4[_0xa3ec('0x42')]['hasOwnProperty'](_0xa3ec('0x49'))){_0x5ac2b1[_0xa3ec('0x31')]=qs[_0xa3ec('0x31')](_0x2315d4[_0xa3ec('0x42')][_0xa3ec('0x31')]);_0x5ac2b1['offset']=qs['offset'](_0x2315d4[_0xa3ec('0x42')][_0xa3ec('0x30')]);}return _0x2665b2[_0xa3ec('0x61')](_0x5ac2b1);}})[_0xa3ec('0x38')](function(_0x1ffa37){if(_0x1ffa37){return _0x1ffa37?{'count':_0x44849d,'rows':_0x1ffa37}:null;}})[_0xa3ec('0x38')](respondWithResult(_0x3f474e,null))[_0xa3ec('0x2a')](handleError(_0x3f474e,null));};exports[_0xa3ec('0x62')]=function(_0x55cd55,_0x402137,_0x1bb854){var _0x1f56dc={};var _0x473f00={};var _0x19656b;var _0x316751;return db[_0xa3ec('0x3d')]['findOne']({'where':{'id':_0x55cd55[_0xa3ec('0x54')]['id']}})[_0xa3ec('0x38')](handleEntityNotFound(_0x402137,null))['then'](function(_0x1f6d22){if(_0x1f6d22){_0x19656b=_0x1f6d22;_0x473f00['model']=_[_0xa3ec('0x56')](db[_0xa3ec('0x5c')][_0xa3ec('0x55')]);_0x473f00[_0xa3ec('0x42')]=_['keys'](_0x55cd55[_0xa3ec('0x42')]);_0x473f00['filters']=_[_0xa3ec('0x44')](_0x473f00[_0xa3ec('0x41')],_0x473f00[_0xa3ec('0x42')]);_0x1f56dc[_0xa3ec('0x45')]=_[_0xa3ec('0x44')](_0x473f00['model'],qs[_0xa3ec('0x46')](_0x55cd55['query'][_0xa3ec('0x46')]));_0x1f56dc['attributes']=_0x1f56dc['attributes']['length']?_0x1f56dc[_0xa3ec('0x45')]:_0x473f00[_0xa3ec('0x41')];_0x1f56dc[_0xa3ec('0x4a')]=qs[_0xa3ec('0x5d')](_0x55cd55[_0xa3ec('0x42')][_0xa3ec('0x5d')]);_0x1f56dc[_0xa3ec('0x4b')]=qs[_0xa3ec('0x43')](_[_0xa3ec('0x5e')](_0x55cd55[_0xa3ec('0x42')],_0x473f00['filters']));if(_0x55cd55[_0xa3ec('0x42')][_0xa3ec('0x5f')]){_0x1f56dc[_0xa3ec('0x4b')]=_[_0xa3ec('0x4c')](_0x1f56dc[_0xa3ec('0x4b')],{'$or':_[_0xa3ec('0x60')](_0x1f56dc['attributes'],function(_0x319ef8){var _0x4cd529={};_0x4cd529[_0x319ef8]={'$like':'%'+_0x55cd55[_0xa3ec('0x42')][_0xa3ec('0x5f')]+'%'};return _0x4cd529;})});}_0x1f56dc=_[_0xa3ec('0x4c')]({},_0x1f56dc,_0x55cd55[_0xa3ec('0x4e')]);return _0x19656b[_0xa3ec('0x62')](_0x1f56dc);}})[_0xa3ec('0x38')](function(_0x17c7da){if(_0x17c7da){_0x316751=_0x17c7da[_0xa3ec('0x47')];if(!_0x55cd55[_0xa3ec('0x42')][_0xa3ec('0x48')](_0xa3ec('0x49'))){_0x1f56dc[_0xa3ec('0x31')]=qs['limit'](_0x55cd55['query'][_0xa3ec('0x31')]);_0x1f56dc['offset']=qs[_0xa3ec('0x30')](_0x55cd55['query'][_0xa3ec('0x30')]);}return _0x19656b['getDescriptions'](_0x1f56dc);}})[_0xa3ec('0x38')](function(_0x41c2b0){if(_0x41c2b0){return _0x41c2b0?{'count':_0x316751,'rows':_0x41c2b0}:null;}})[_0xa3ec('0x38')](respondWithResult(_0x402137,null))[_0xa3ec('0x2a')](handleError(_0x402137,null));}; \ No newline at end of file +var _0xab05=['limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','keys','length','includeAll','include','find','create','body','getFields','findOne','params','SalesforceField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../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~!@#$%^&-_=+[{]}.','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','sendStatus','status','end','json','count','offset'];(function(_0xcb1264,_0x547aee){var _0x255c60=function(_0x1eaa0f){while(--_0x1eaa0f){_0xcb1264['push'](_0xcb1264['shift']());}};_0x255c60(++_0x547aee);}(_0xab05,0x1b6));var _0x5ab0=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xab05[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x5ab0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5ab0('0x1'));var zipdir=require(_0x5ab0('0x2'));var jsonpatch=require(_0x5ab0('0x3'));var rp=require(_0x5ab0('0x4'));var moment=require(_0x5ab0('0x5'));var BPromise=require(_0x5ab0('0x6'));var Mustache=require(_0x5ab0('0x7'));var util=require(_0x5ab0('0x8'));var path=require(_0x5ab0('0x9'));var sox=require(_0x5ab0('0xa'));var csv=require(_0x5ab0('0xb'));var ejs=require(_0x5ab0('0xc'));var fs=require('fs');var _=require(_0x5ab0('0xd'));var squel=require(_0x5ab0('0xe'));var crypto=require(_0x5ab0('0xf'));var jsforce=require(_0x5ab0('0x10'));var deskjs=require(_0x5ab0('0x11'));var toCsv=require(_0x5ab0('0xb'));var querystring=require(_0x5ab0('0x12'));var Papa=require(_0x5ab0('0x13'));var Redis=require('ioredis');var authService=require(_0x5ab0('0x14'));var qs=require(_0x5ab0('0x15'));var as=require(_0x5ab0('0x16'));var hardwareService=require(_0x5ab0('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5ab0('0x18'))['db'];var jayson=require(_0x5ab0('0x19'));var client=jayson[_0x5ab0('0x1a')][_0x5ab0('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3ec77f,_0x28fa42,_0x2b0cb2){if(_0x2b0cb2){var _0x4c80c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c80c9['test'](_0x28fa42)){return _0x3ec77f;}else{throw new db[(_0x5ab0('0x1c'))]['ValidationError'](_0x5ab0('0x1d'));}}else{return _0x3ec77f;}}function respondWithRpcPromise(_0x3a210c,_0x55b0b5,_0x42e500,_0x2a382d){return new BPromise(function(_0x475b82,_0x54a1fc){var _0xbc3efa=_0x2a382d||client;return _0xbc3efa[_0x5ab0('0x1e')](_0x3a210c,_0x42e500)['then'](function(_0x5a8a18){logger['info'](_0x5ab0('0x1f'),_0x55b0b5,_0x5ab0('0x20'));logger[_0x5ab0('0x21')](_0x5ab0('0x22'),_0x55b0b5,_0x5ab0('0x20'),JSON[_0x5ab0('0x23')](_0x5a8a18));if(_0x5a8a18['error']){if(_0x5a8a18['error'][_0x5ab0('0x24')]===0x1f4){logger['error'](_0x5ab0('0x1f'),_0x55b0b5,_0x5a8a18[_0x5ab0('0x25')][_0x5ab0('0x26')]);return _0x54a1fc(_0x5a8a18['error'][_0x5ab0('0x26')]);}logger[_0x5ab0('0x25')](_0x5ab0('0x1f'),_0x55b0b5,_0x5a8a18[_0x5ab0('0x25')][_0x5ab0('0x26')]);return _0x475b82(_0x5a8a18[_0x5ab0('0x25')][_0x5ab0('0x26')]);}else{logger[_0x5ab0('0x27')]('SalesforceConfiguration,\x20%s,\x20%s',_0x55b0b5,_0x5ab0('0x20'));_0x475b82(_0x5a8a18['result']['message']);}})[_0x5ab0('0x28')](function(_0x4081e1){logger['error'](_0x5ab0('0x1f'),_0x55b0b5,_0x4081e1);_0x54a1fc(_0x4081e1);});});}function respondWithStatusCode(_0x414f52,_0x1c7364){_0x1c7364=_0x1c7364||0xcc;return function(_0x284883){if(_0x284883){return _0x414f52[_0x5ab0('0x29')](_0x1c7364);}return _0x414f52[_0x5ab0('0x2a')](_0x1c7364)[_0x5ab0('0x2b')]();};}function respondWithResult(_0x441272,_0x5e0b03){_0x5e0b03=_0x5e0b03||0xc8;return function(_0x29b146){if(_0x29b146){return _0x441272[_0x5ab0('0x2a')](_0x5e0b03)[_0x5ab0('0x2c')](_0x29b146);}};}function respondWithFilteredResult(_0x94fa1,_0x39d000){return function(_0xc18a0d){if(_0xc18a0d){var _0x498a1d=_0xc18a0d[_0x5ab0('0x2d')],_0x44926c=_0x39d000[_0x5ab0('0x2e')],_0x4985be=_0x39d000[_0x5ab0('0x2e')]+_0x39d000[_0x5ab0('0x2f')],_0x19221f;if(_0x4985be>=_0x498a1d){_0x4985be=_0x498a1d;_0x19221f=0xc8;}else{_0x19221f=0xce;}_0x94fa1[_0x5ab0('0x2a')](_0x19221f);return _0x94fa1[_0x5ab0('0x30')]('Content-Range',_0x44926c+'-'+_0x4985be+'/'+_0x498a1d)[_0x5ab0('0x2c')](_0xc18a0d);}return null;};}function patchUpdates(_0x35e0c2){return function(_0x2df1a5){try{jsonpatch[_0x5ab0('0x31')](_0x2df1a5,_0x35e0c2,!![]);}catch(_0x59929d){return BPromise[_0x5ab0('0x32')](_0x59929d);}return _0x2df1a5[_0x5ab0('0x33')]();};}function saveUpdates(_0x5e0ee4,_0x4acc05){return function(_0x36ea20){if(_0x36ea20){return _0x36ea20[_0x5ab0('0x34')](_0x5e0ee4)[_0x5ab0('0x35')](function(_0x4c9ea3){return _0x4c9ea3;});}return null;};}function removeEntity(_0x46484b,_0x1b0c68){return function(_0x55ed25){if(_0x55ed25){return _0x55ed25[_0x5ab0('0x36')]()[_0x5ab0('0x35')](function(){_0x46484b[_0x5ab0('0x2a')](0xcc)[_0x5ab0('0x2b')]();});}};}function handleEntityNotFound(_0x273555,_0x30d55d){return function(_0x1acc58){if(!_0x1acc58){_0x273555['sendStatus'](0x194);}return _0x1acc58;};}function handleError(_0x1e23d6,_0x1b470f){_0x1b470f=_0x1b470f||0x1f4;return function(_0x252471){logger[_0x5ab0('0x25')](_0x252471[_0x5ab0('0x37')]);if(_0x252471['name']){delete _0x252471[_0x5ab0('0x38')];}_0x1e23d6['status'](_0x1b470f)[_0x5ab0('0x39')](_0x252471);};}exports[_0x5ab0('0x3a')]=function(_0x436ad4,_0x2c2610){var _0x10381f={},_0x2ba2cb={},_0x733e39={'count':0x0,'rows':[]};var _0x5ab7b4=_[_0x5ab0('0x3b')](db[_0x5ab0('0x3c')][_0x5ab0('0x3d')],function(_0x529d64){return{'name':_0x529d64[_0x5ab0('0x3e')],'type':_0x529d64[_0x5ab0('0x3f')][_0x5ab0('0x40')]};});_0x2ba2cb[_0x5ab0('0x41')]=_[_0x5ab0('0x3b')](_0x5ab7b4,_0x5ab0('0x38'));_0x2ba2cb[_0x5ab0('0x42')]=_['keys'](_0x436ad4[_0x5ab0('0x42')]);_0x2ba2cb[_0x5ab0('0x43')]=_[_0x5ab0('0x44')](_0x2ba2cb[_0x5ab0('0x41')],_0x2ba2cb['query']);_0x10381f[_0x5ab0('0x45')]=_[_0x5ab0('0x44')](_0x2ba2cb[_0x5ab0('0x41')],qs[_0x5ab0('0x46')](_0x436ad4['query'][_0x5ab0('0x46')]));_0x10381f['attributes']=_0x10381f['attributes']['length']?_0x10381f[_0x5ab0('0x45')]:_0x2ba2cb[_0x5ab0('0x41')];if(!_0x436ad4['query'][_0x5ab0('0x47')](_0x5ab0('0x48'))){_0x10381f[_0x5ab0('0x2f')]=qs[_0x5ab0('0x2f')](_0x436ad4[_0x5ab0('0x42')][_0x5ab0('0x2f')]);_0x10381f[_0x5ab0('0x2e')]=qs[_0x5ab0('0x2e')](_0x436ad4[_0x5ab0('0x42')][_0x5ab0('0x2e')]);}_0x10381f[_0x5ab0('0x49')]=qs[_0x5ab0('0x4a')](_0x436ad4[_0x5ab0('0x42')][_0x5ab0('0x4a')]);_0x10381f[_0x5ab0('0x4b')]=qs['filters'](_[_0x5ab0('0x4c')](_0x436ad4[_0x5ab0('0x42')],_0x2ba2cb[_0x5ab0('0x43')]),_0x5ab7b4);if(_0x436ad4[_0x5ab0('0x42')][_0x5ab0('0x4d')]){_0x10381f[_0x5ab0('0x4b')]=_[_0x5ab0('0x4e')](_0x10381f[_0x5ab0('0x4b')],{'$or':_['map'](_0x5ab7b4,function(_0x22a690){if(_0x22a690[_0x5ab0('0x3f')]!==_0x5ab0('0x4f')){var _0x589e56={};_0x589e56[_0x22a690[_0x5ab0('0x38')]]={'$like':'%'+_0x436ad4['query'][_0x5ab0('0x4d')]+'%'};return _0x589e56;}})});}_0x10381f=_[_0x5ab0('0x4e')]({},_0x10381f,_0x436ad4[_0x5ab0('0x50')]);var _0x7c1d3c={'where':_0x10381f['where']};return db[_0x5ab0('0x3c')]['count'](_0x7c1d3c)[_0x5ab0('0x35')](function(_0x3c5de2){_0x733e39[_0x5ab0('0x2d')]=_0x3c5de2;if(_0x436ad4[_0x5ab0('0x42')]['includeAll']){_0x10381f['include']=[{'all':!![]}];}return db[_0x5ab0('0x3c')][_0x5ab0('0x51')](_0x10381f);})[_0x5ab0('0x35')](function(_0x2dd043){_0x733e39[_0x5ab0('0x52')]=_0x2dd043;return _0x733e39;})[_0x5ab0('0x35')](respondWithFilteredResult(_0x2c2610,_0x10381f))[_0x5ab0('0x28')](handleError(_0x2c2610,null));};exports[_0x5ab0('0x53')]=function(_0xb3f1df,_0x35b8ec){var _0x4ccaac={'raw':![],'where':{'id':_0xb3f1df['params']['id']}},_0x51c78a={};_0x51c78a[_0x5ab0('0x41')]=_[_0x5ab0('0x54')](db[_0x5ab0('0x3c')][_0x5ab0('0x3d')]);_0x51c78a[_0x5ab0('0x42')]=_[_0x5ab0('0x54')](_0xb3f1df['query']);_0x51c78a[_0x5ab0('0x43')]=_['intersection'](_0x51c78a[_0x5ab0('0x41')],_0x51c78a[_0x5ab0('0x42')]);_0x4ccaac[_0x5ab0('0x45')]=_['intersection'](_0x51c78a[_0x5ab0('0x41')],qs[_0x5ab0('0x46')](_0xb3f1df[_0x5ab0('0x42')][_0x5ab0('0x46')]));_0x4ccaac[_0x5ab0('0x45')]=_0x4ccaac[_0x5ab0('0x45')][_0x5ab0('0x55')]?_0x4ccaac[_0x5ab0('0x45')]:_0x51c78a[_0x5ab0('0x41')];if(_0xb3f1df[_0x5ab0('0x42')][_0x5ab0('0x56')]){_0x4ccaac[_0x5ab0('0x57')]=[{'all':!![]}];}_0x4ccaac=_[_0x5ab0('0x4e')]({},_0x4ccaac,_0xb3f1df[_0x5ab0('0x50')]);return db[_0x5ab0('0x3c')][_0x5ab0('0x58')](_0x4ccaac)[_0x5ab0('0x35')](handleEntityNotFound(_0x35b8ec,null))[_0x5ab0('0x35')](respondWithResult(_0x35b8ec,null))['catch'](handleError(_0x35b8ec,null));};exports[_0x5ab0('0x59')]=function(_0x1d9288,_0x5ca422){return db[_0x5ab0('0x3c')]['create'](_0x1d9288[_0x5ab0('0x5a')],{})['then'](respondWithResult(_0x5ca422,0xc9))[_0x5ab0('0x28')](handleError(_0x5ca422,null));};exports[_0x5ab0('0x34')]=function(_0x3f4ad8,_0x15cd52){if(_0x3f4ad8[_0x5ab0('0x5a')]['id']){delete _0x3f4ad8[_0x5ab0('0x5a')]['id'];}return db[_0x5ab0('0x3c')][_0x5ab0('0x58')]({'where':{'id':_0x3f4ad8['params']['id']}})[_0x5ab0('0x35')](handleEntityNotFound(_0x15cd52,null))[_0x5ab0('0x35')](saveUpdates(_0x3f4ad8['body'],null))[_0x5ab0('0x35')](respondWithResult(_0x15cd52,null))[_0x5ab0('0x28')](handleError(_0x15cd52,null));};exports[_0x5ab0('0x36')]=function(_0x56f621,_0x136f41){return db[_0x5ab0('0x3c')][_0x5ab0('0x58')]({'where':{'id':_0x56f621['params']['id']}})[_0x5ab0('0x35')](handleEntityNotFound(_0x136f41,null))[_0x5ab0('0x35')](removeEntity(_0x136f41,null))[_0x5ab0('0x28')](handleError(_0x136f41,null));};exports[_0x5ab0('0x5b')]=function(_0x39cb26,_0x1ebee9,_0x5d5318){var _0x5e241f={};var _0x2f3e8b={};var _0x493840;var _0x529b97;return db[_0x5ab0('0x3c')][_0x5ab0('0x5c')]({'where':{'id':_0x39cb26[_0x5ab0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1ebee9,null))[_0x5ab0('0x35')](function(_0xc452e7){if(_0xc452e7){_0x493840=_0xc452e7;_0x2f3e8b['model']=_['keys'](db[_0x5ab0('0x5e')][_0x5ab0('0x3d')]);_0x2f3e8b['query']=_[_0x5ab0('0x54')](_0x39cb26[_0x5ab0('0x42')]);_0x2f3e8b[_0x5ab0('0x43')]=_[_0x5ab0('0x44')](_0x2f3e8b[_0x5ab0('0x41')],_0x2f3e8b[_0x5ab0('0x42')]);_0x5e241f[_0x5ab0('0x45')]=_[_0x5ab0('0x44')](_0x2f3e8b['model'],qs[_0x5ab0('0x46')](_0x39cb26[_0x5ab0('0x42')][_0x5ab0('0x46')]));_0x5e241f[_0x5ab0('0x45')]=_0x5e241f[_0x5ab0('0x45')]['length']?_0x5e241f[_0x5ab0('0x45')]:_0x2f3e8b['model'];_0x5e241f[_0x5ab0('0x49')]=qs['sort'](_0x39cb26['query'][_0x5ab0('0x4a')]);_0x5e241f[_0x5ab0('0x4b')]=qs[_0x5ab0('0x43')](_[_0x5ab0('0x4c')](_0x39cb26[_0x5ab0('0x42')],_0x2f3e8b[_0x5ab0('0x43')]));if(_0x39cb26[_0x5ab0('0x42')][_0x5ab0('0x4d')]){_0x5e241f[_0x5ab0('0x4b')]=_[_0x5ab0('0x4e')](_0x5e241f[_0x5ab0('0x4b')],{'$or':_[_0x5ab0('0x3b')](_0x5e241f[_0x5ab0('0x45')],function(_0x3e604c){var _0x3f65cb={};_0x3f65cb[_0x3e604c]={'$like':'%'+_0x39cb26['query']['filter']+'%'};return _0x3f65cb;})});}_0x5e241f=_[_0x5ab0('0x4e')]({},_0x5e241f,_0x39cb26[_0x5ab0('0x50')]);return _0x493840[_0x5ab0('0x5b')](_0x5e241f);}})['then'](function(_0x5a4eb1){if(_0x5a4eb1){_0x529b97=_0x5a4eb1[_0x5ab0('0x55')];if(!_0x39cb26[_0x5ab0('0x42')][_0x5ab0('0x47')](_0x5ab0('0x48'))){_0x5e241f[_0x5ab0('0x2f')]=qs[_0x5ab0('0x2f')](_0x39cb26[_0x5ab0('0x42')]['limit']);_0x5e241f[_0x5ab0('0x2e')]=qs['offset'](_0x39cb26['query'][_0x5ab0('0x2e')]);}return _0x493840[_0x5ab0('0x5b')](_0x5e241f);}})[_0x5ab0('0x35')](function(_0x31c9e6){if(_0x31c9e6){return _0x31c9e6?{'count':_0x529b97,'rows':_0x31c9e6}:null;}})[_0x5ab0('0x35')](respondWithResult(_0x1ebee9,null))[_0x5ab0('0x28')](handleError(_0x1ebee9,null));};exports[_0x5ab0('0x5f')]=function(_0x50974f,_0x59a937,_0x1eac56){var _0x7a9465={};var _0x4a4f79={};var _0x3f80fc;var _0x1a32ee;return db[_0x5ab0('0x3c')][_0x5ab0('0x5c')]({'where':{'id':_0x50974f[_0x5ab0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x59a937,null))[_0x5ab0('0x35')](function(_0x2ae5e8){if(_0x2ae5e8){_0x3f80fc=_0x2ae5e8;_0x4a4f79[_0x5ab0('0x41')]=_[_0x5ab0('0x54')](db['SalesforceField']['rawAttributes']);_0x4a4f79['query']=_[_0x5ab0('0x54')](_0x50974f[_0x5ab0('0x42')]);_0x4a4f79['filters']=_[_0x5ab0('0x44')](_0x4a4f79[_0x5ab0('0x41')],_0x4a4f79['query']);_0x7a9465[_0x5ab0('0x45')]=_[_0x5ab0('0x44')](_0x4a4f79['model'],qs[_0x5ab0('0x46')](_0x50974f[_0x5ab0('0x42')]['fields']));_0x7a9465[_0x5ab0('0x45')]=_0x7a9465[_0x5ab0('0x45')][_0x5ab0('0x55')]?_0x7a9465[_0x5ab0('0x45')]:_0x4a4f79[_0x5ab0('0x41')];_0x7a9465[_0x5ab0('0x49')]=qs['sort'](_0x50974f[_0x5ab0('0x42')][_0x5ab0('0x4a')]);_0x7a9465[_0x5ab0('0x4b')]=qs['filters'](_[_0x5ab0('0x4c')](_0x50974f[_0x5ab0('0x42')],_0x4a4f79[_0x5ab0('0x43')]));if(_0x50974f['query'][_0x5ab0('0x4d')]){_0x7a9465['where']=_[_0x5ab0('0x4e')](_0x7a9465[_0x5ab0('0x4b')],{'$or':_[_0x5ab0('0x3b')](_0x7a9465[_0x5ab0('0x45')],function(_0x187e1e){var _0x5ea9c6={};_0x5ea9c6[_0x187e1e]={'$like':'%'+_0x50974f[_0x5ab0('0x42')]['filter']+'%'};return _0x5ea9c6;})});}_0x7a9465=_[_0x5ab0('0x4e')]({},_0x7a9465,_0x50974f[_0x5ab0('0x50')]);return _0x3f80fc['getSubjects'](_0x7a9465);}})[_0x5ab0('0x35')](function(_0x320e62){if(_0x320e62){_0x1a32ee=_0x320e62[_0x5ab0('0x55')];if(!_0x50974f['query'][_0x5ab0('0x47')](_0x5ab0('0x48'))){_0x7a9465[_0x5ab0('0x2f')]=qs[_0x5ab0('0x2f')](_0x50974f[_0x5ab0('0x42')][_0x5ab0('0x2f')]);_0x7a9465[_0x5ab0('0x2e')]=qs[_0x5ab0('0x2e')](_0x50974f[_0x5ab0('0x42')][_0x5ab0('0x2e')]);}return _0x3f80fc[_0x5ab0('0x5f')](_0x7a9465);}})['then'](function(_0x4bc135){if(_0x4bc135){return _0x4bc135?{'count':_0x1a32ee,'rows':_0x4bc135}:null;}})[_0x5ab0('0x35')](respondWithResult(_0x59a937,null))[_0x5ab0('0x28')](handleError(_0x59a937,null));};exports[_0x5ab0('0x60')]=function(_0xb1f150,_0x308200,_0x301157){var _0x3fdfca={};var _0x4c9026={};var _0x3ad009;var _0x580bfa;return db[_0x5ab0('0x3c')][_0x5ab0('0x5c')]({'where':{'id':_0xb1f150['params']['id']}})[_0x5ab0('0x35')](handleEntityNotFound(_0x308200,null))[_0x5ab0('0x35')](function(_0x545a38){if(_0x545a38){_0x3ad009=_0x545a38;_0x4c9026[_0x5ab0('0x41')]=_[_0x5ab0('0x54')](db[_0x5ab0('0x5e')][_0x5ab0('0x3d')]);_0x4c9026[_0x5ab0('0x42')]=_['keys'](_0xb1f150[_0x5ab0('0x42')]);_0x4c9026[_0x5ab0('0x43')]=_[_0x5ab0('0x44')](_0x4c9026[_0x5ab0('0x41')],_0x4c9026['query']);_0x3fdfca['attributes']=_['intersection'](_0x4c9026['model'],qs[_0x5ab0('0x46')](_0xb1f150['query'][_0x5ab0('0x46')]));_0x3fdfca['attributes']=_0x3fdfca[_0x5ab0('0x45')][_0x5ab0('0x55')]?_0x3fdfca[_0x5ab0('0x45')]:_0x4c9026[_0x5ab0('0x41')];_0x3fdfca[_0x5ab0('0x49')]=qs[_0x5ab0('0x4a')](_0xb1f150[_0x5ab0('0x42')][_0x5ab0('0x4a')]);_0x3fdfca[_0x5ab0('0x4b')]=qs[_0x5ab0('0x43')](_[_0x5ab0('0x4c')](_0xb1f150['query'],_0x4c9026['filters']));if(_0xb1f150[_0x5ab0('0x42')][_0x5ab0('0x4d')]){_0x3fdfca[_0x5ab0('0x4b')]=_[_0x5ab0('0x4e')](_0x3fdfca[_0x5ab0('0x4b')],{'$or':_[_0x5ab0('0x3b')](_0x3fdfca[_0x5ab0('0x45')],function(_0x443e96){var _0x35647c={};_0x35647c[_0x443e96]={'$like':'%'+_0xb1f150[_0x5ab0('0x42')][_0x5ab0('0x4d')]+'%'};return _0x35647c;})});}_0x3fdfca=_['merge']({},_0x3fdfca,_0xb1f150['options']);return _0x3ad009[_0x5ab0('0x60')](_0x3fdfca);}})[_0x5ab0('0x35')](function(_0xe1ba42){if(_0xe1ba42){_0x580bfa=_0xe1ba42[_0x5ab0('0x55')];if(!_0xb1f150[_0x5ab0('0x42')]['hasOwnProperty'](_0x5ab0('0x48'))){_0x3fdfca[_0x5ab0('0x2f')]=qs[_0x5ab0('0x2f')](_0xb1f150[_0x5ab0('0x42')]['limit']);_0x3fdfca[_0x5ab0('0x2e')]=qs[_0x5ab0('0x2e')](_0xb1f150[_0x5ab0('0x42')][_0x5ab0('0x2e')]);}return _0x3ad009[_0x5ab0('0x60')](_0x3fdfca);}})['then'](function(_0x30ebbe){if(_0x30ebbe){return _0x30ebbe?{'count':_0x580bfa,'rows':_0x30ebbe}:null;}})[_0x5ab0('0x35')](respondWithResult(_0x308200,null))['catch'](handleError(_0x308200,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6b271c0..16e92aa 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 _0x9865=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9865,0x191));var _0x5986=function(_0x199169,_0x1a7496){_0x199169=_0x199169-0x0;var _0x8341e3=_0x9865[_0x199169];return _0x8341e3;};'use strict';var _=require(_0x5986('0x0'));var util=require(_0x5986('0x1'));var logger=require(_0x5986('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5986('0x3'));var rimraf=require(_0x5986('0x4'));var config=require(_0x5986('0x5'));var attributes=require(_0x5986('0x6'));module[_0x5986('0x7')]=function(_0x50fb37,_0x5df336){return _0x50fb37[_0x5986('0x8')](_0x5986('0x9'),attributes,{'tableName':_0x5986('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x566f=['rimraf','../../config/environment','exports','define','int_salesforce_configurations','lodash','util','api','moment','request-promise','path'];(function(_0x4f4126,_0x3ab2de){var _0xf5693=function(_0x5bdb6b){while(--_0x5bdb6b){_0x4f4126['push'](_0x4f4126['shift']());}};_0xf5693(++_0x3ab2de);}(_0x566f,0x15a));var _0xf566=function(_0x40cc89,_0x138ceb){_0x40cc89=_0x40cc89-0x0;var _0x5a4484=_0x566f[_0x40cc89];return _0x5a4484;};'use strict';var _=require(_0xf566('0x0'));var util=require(_0xf566('0x1'));var logger=require('../../config/logger')(_0xf566('0x2'));var moment=require(_0xf566('0x3'));var BPromise=require('bluebird');var rp=require(_0xf566('0x4'));var fs=require('fs');var path=require(_0xf566('0x5'));var rimraf=require(_0xf566('0x6'));var config=require(_0xf566('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xf566('0x8')]=function(_0x3fbb67,_0x5a301b){return _0x3fbb67[_0xf566('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0xf566('0xa'),'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 add5396..1b064a6 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 _0xdebb=['http','request','info','request\x20sent','debug','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4938ae,_0xa6036a){var _0xc070e8=function(_0x1fe630){while(--_0x1fe630){_0x4938ae['push'](_0x4938ae['shift']());}};_0xc070e8(++_0xa6036a);}(_0xdebb,0x90));var _0xbdeb=function(_0x3ac8b4,_0x4bdc96){_0x3ac8b4=_0x3ac8b4-0x0;var _0x533904=_0xdebb[_0x3ac8b4];return _0x533904;};'use strict';var _=require(_0xbdeb('0x0'));var util=require('util');var moment=require(_0xbdeb('0x1'));var BPromise=require(_0xbdeb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdeb('0x3'))['db'];var utils=require(_0xbdeb('0x4'));var logger=require(_0xbdeb('0x5'))(_0xbdeb('0x6'));var config=require(_0xbdeb('0x7'));var jayson=require(_0xbdeb('0x8'));var client=jayson[_0xbdeb('0x9')][_0xbdeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f76f,_0x45f055,_0x2c217c){return new BPromise(function(_0x27d8cc,_0x4958c5){return client[_0xbdeb('0xb')](_0x24f76f,_0x2c217c)['then'](function(_0x2f6adf){logger[_0xbdeb('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x45f055,_0xbdeb('0xd'));logger[_0xbdeb('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x45f055,_0xbdeb('0xd'),JSON[_0xbdeb('0xf')](_0x2f6adf));if(_0x2f6adf[_0xbdeb('0x10')]){if(_0x2f6adf[_0xbdeb('0x10')][_0xbdeb('0x11')]===0x1f4){logger[_0xbdeb('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x45f055,_0x2f6adf['error'][_0xbdeb('0x12')]);return _0x4958c5(_0x2f6adf[_0xbdeb('0x10')]['message']);}logger[_0xbdeb('0x10')](_0xbdeb('0x13'),_0x45f055,_0x2f6adf['error'][_0xbdeb('0x12')]);return _0x27d8cc(_0x2f6adf[_0xbdeb('0x10')][_0xbdeb('0x12')]);}else{logger[_0xbdeb('0xc')](_0xbdeb('0x13'),_0x45f055,'request\x20sent');_0x27d8cc(_0x2f6adf[_0xbdeb('0x14')][_0xbdeb('0x12')]);}})[_0xbdeb('0x15')](function(_0xd86ae4){logger[_0xbdeb('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x45f055,_0xd86ae4);_0x4958c5(_0xd86ae4);});});} \ No newline at end of file +var _0xc858=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xc858,0x1c0));var _0x8c85=function(_0x17e730,_0xa878f6){_0x17e730=_0x17e730-0x0;var _0x21f52d=_0xc858[_0x17e730];return _0x21f52d;};'use strict';var _=require(_0x8c85('0x0'));var util=require(_0x8c85('0x1'));var moment=require(_0x8c85('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c85('0x3'));var db=require(_0x8c85('0x4'))['db'];var utils=require(_0x8c85('0x5'));var logger=require(_0x8c85('0x6'))(_0x8c85('0x7'));var config=require(_0x8c85('0x8'));var jayson=require(_0x8c85('0x9'));var client=jayson[_0x8c85('0xa')][_0x8c85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x324ddf,_0x2dac35,_0x1b0e46){return new BPromise(function(_0xe58934,_0x61835c){return client[_0x8c85('0xc')](_0x324ddf,_0x1b0e46)[_0x8c85('0xd')](function(_0x546df4){logger['info'](_0x8c85('0xe'),_0x2dac35,_0x8c85('0xf'));logger[_0x8c85('0x10')](_0x8c85('0x11'),_0x2dac35,_0x8c85('0xf'),JSON[_0x8c85('0x12')](_0x546df4));if(_0x546df4[_0x8c85('0x13')]){if(_0x546df4[_0x8c85('0x13')][_0x8c85('0x14')]===0x1f4){logger['error'](_0x8c85('0xe'),_0x2dac35,_0x546df4[_0x8c85('0x13')][_0x8c85('0x15')]);return _0x61835c(_0x546df4['error'][_0x8c85('0x15')]);}logger[_0x8c85('0x13')](_0x8c85('0xe'),_0x2dac35,_0x546df4['error'][_0x8c85('0x15')]);return _0xe58934(_0x546df4['error']['message']);}else{logger[_0x8c85('0x16')](_0x8c85('0xe'),_0x2dac35,'request\x20sent');_0xe58934(_0x546df4[_0x8c85('0x17')][_0x8c85('0x15')]);}})[_0x8c85('0x18')](function(_0x21d9d8){logger[_0x8c85('0x13')](_0x8c85('0xe'),_0x2dac35,_0x21d9d8);_0x61835c(_0x21d9d8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a8aa74b..b9e6e6d 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(_0x44a4f8,_0x7e8aba){var _0x503e6b=function(_0x3ef5cb){while(--_0x3ef5cb){_0x44a4f8['push'](_0x44a4f8['shift']());}};_0x503e6b(++_0x7e8aba);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x71ee70,_0x1dfd28){_0x71ee70=_0x71ee70-0x0;var _0x594058=_0x3f8a[_0x71ee70];return _0x594058;};'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 _0x0a6b=['show','post','/:id','update','delete','destroy','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0xb129f,_0x1866ff){var _0x4d519e=function(_0xa9e8f8){while(--_0xa9e8f8){_0xb129f['push'](_0xb129f['shift']());}};_0x4d519e(++_0x1866ff);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x221715,_0x2f4acd){_0x221715=_0x221715-0x0;var _0x130c1f=_0x0a6b[_0x221715];return _0x130c1f;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var auth=require(_0xb0a6('0x2'));var interaction=require(_0xb0a6('0x3'));var config=require(_0xb0a6('0x4'));var controller=require('./intSalesforceField.controller');router[_0xb0a6('0x5')]('/',auth['isAuthenticated'](),controller[_0xb0a6('0x6')]);router[_0xb0a6('0x5')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x8')]);router[_0xb0a6('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb0a6('0xa'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xb')]);router[_0xb0a6('0xc')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xd')]);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 13c5c83..e5af49c 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 _0xa95b=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x4d2a3c,_0x26fd6f){var _0x39ff80=function(_0x1e899d){while(--_0x1e899d){_0x4d2a3c['push'](_0x4d2a3c['shift']());}};_0x39ff80(++_0x26fd6f);}(_0xa95b,0xb6));var _0xba95=function(_0x38d0a5,_0x48f40e){_0x38d0a5=_0x38d0a5-0x0;var _0x27ff56=_0xa95b[_0x38d0a5];return _0x27ff56;};'use strict';var Sequelize=require(_0xba95('0x0'));module[_0xba95('0x1')]={'type':{'type':Sequelize[_0xba95('0x2')](_0xba95('0x3'),_0xba95('0x4'),_0xba95('0x5'),_0xba95('0x6')),'defaultValue':_0xba95('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xba95('0x7')]},'keyType':{'type':Sequelize[_0xba95('0x2')](_0xba95('0x3'),_0xba95('0x4'),_0xba95('0x5'))},'keyContent':{'type':Sequelize[_0xba95('0x7')]},'idField':{'type':Sequelize[_0xba95('0x7')]},'variableName':{'type':Sequelize[_0xba95('0x7')]}}; \ No newline at end of file +var _0x9b8c=['string','variable','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x4f6ea8,_0x191395){var _0x39f538=function(_0x8aa4c9){while(--_0x8aa4c9){_0x4f6ea8['push'](_0x4f6ea8['shift']());}};_0x39f538(++_0x191395);}(_0x9b8c,0x155));var _0xc9b8=function(_0x2731f0,_0x126b1b){_0x2731f0=_0x2731f0-0x0;var _0x36a180=_0x9b8c[_0x2731f0];return _0x36a180;};'use strict';var Sequelize=require(_0xc9b8('0x0'));module['exports']={'type':{'type':Sequelize[_0xc9b8('0x1')](_0xc9b8('0x2'),_0xc9b8('0x3'),_0xc9b8('0x4'),_0xc9b8('0x5')),'defaultValue':_0xc9b8('0x2')},'content':{'type':Sequelize[_0xc9b8('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc9b8('0x1')](_0xc9b8('0x2'),_0xc9b8('0x3'),_0xc9b8('0x4'))},'keyContent':{'type':Sequelize[_0xc9b8('0x6')]},'idField':{'type':Sequelize[_0xc9b8('0x6')]},'variableName':{'type':Sequelize[_0xc9b8('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e43e286..0f6d916 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 _0xd963=['hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','update','then','destroy','end','error','stack','name','index','map','SalesforceField','fieldName','type','query','keys','intersection','model','attributes','fields'];(function(_0x340d6f,_0x281798){var _0x5a85de=function(_0x520c4f){while(--_0x520c4f){_0x340d6f['push'](_0x340d6f['shift']());}};_0x5a85de(++_0x281798);}(_0xd963,0xa3));var _0x3d96=function(_0x20efe6,_0x2d6285){_0x20efe6=_0x20efe6-0x0;var _0x2680c2=_0xd963[_0x20efe6];return _0x2680c2;};'use strict';var pdf=require(_0x3d96('0x0'));var emlformat=require(_0x3d96('0x1'));var rimraf=require(_0x3d96('0x2'));var zipdir=require(_0x3d96('0x3'));var jsonpatch=require(_0x3d96('0x4'));var rp=require(_0x3d96('0x5'));var moment=require(_0x3d96('0x6'));var BPromise=require(_0x3d96('0x7'));var Mustache=require(_0x3d96('0x8'));var util=require(_0x3d96('0x9'));var path=require(_0x3d96('0xa'));var sox=require(_0x3d96('0xb'));var csv=require(_0x3d96('0xc'));var ejs=require(_0x3d96('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d96('0xe'));var deskjs=require(_0x3d96('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3d96('0x10'));var Papa=require(_0x3d96('0x11'));var Redis=require(_0x3d96('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3d96('0x13'));var hardwareService=require(_0x3d96('0x14'));var logger=require('../../config/logger')(_0x3d96('0x15'));var utils=require(_0x3d96('0x16'));var config=require(_0x3d96('0x17'));var db=require(_0x3d96('0x18'))['db'];function respondWithStatusCode(_0x3d4fcd,_0x4fb703){_0x4fb703=_0x4fb703||0xcc;return function(_0x4c0f7c){if(_0x4c0f7c){return _0x3d4fcd[_0x3d96('0x19')](_0x4fb703);}return _0x3d4fcd[_0x3d96('0x1a')](_0x4fb703)['end']();};}function respondWithResult(_0x158199,_0x487b57){_0x487b57=_0x487b57||0xc8;return function(_0xeea7fd){if(_0xeea7fd){return _0x158199[_0x3d96('0x1a')](_0x487b57)[_0x3d96('0x1b')](_0xeea7fd);}};}function respondWithFilteredResult(_0x40fadc,_0x3aab29){return function(_0x1ea0ee){if(_0x1ea0ee){var _0x5898d0=_0x1ea0ee['count'],_0x3b9bf3=_0x3aab29[_0x3d96('0x1c')],_0x158b86=_0x3aab29[_0x3d96('0x1c')]+_0x3aab29[_0x3d96('0x1d')],_0x53bd36;if(_0x158b86>=_0x5898d0){_0x158b86=_0x5898d0;_0x53bd36=0xc8;}else{_0x53bd36=0xce;}_0x40fadc['status'](_0x53bd36);return _0x40fadc['set']('Content-Range',_0x3b9bf3+'-'+_0x158b86+'/'+_0x5898d0)[_0x3d96('0x1b')](_0x1ea0ee);}return null;};}function patchUpdates(_0x9b3973){return function(_0x4ac0e7){try{jsonpatch[_0x3d96('0x1e')](_0x4ac0e7,_0x9b3973,!![]);}catch(_0x3d6f78){return BPromise[_0x3d96('0x1f')](_0x3d6f78);}return _0x4ac0e7['save']();};}function saveUpdates(_0x390e58,_0x2c94b3){return function(_0x5bafe9){if(_0x5bafe9){return _0x5bafe9[_0x3d96('0x20')](_0x390e58)[_0x3d96('0x21')](function(_0x1ca5c2){return _0x1ca5c2;});}return null;};}function removeEntity(_0x5612e0,_0x4fa01a){return function(_0x3ff424){if(_0x3ff424){return _0x3ff424[_0x3d96('0x22')]()[_0x3d96('0x21')](function(){_0x5612e0['status'](0xcc)[_0x3d96('0x23')]();});}};}function handleEntityNotFound(_0x3c3d25,_0x26a23f){return function(_0x5087e2){if(!_0x5087e2){_0x3c3d25['sendStatus'](0x194);}return _0x5087e2;};}function handleError(_0x1f5fee,_0x431e53){_0x431e53=_0x431e53||0x1f4;return function(_0x5fa017){logger[_0x3d96('0x24')](_0x5fa017[_0x3d96('0x25')]);if(_0x5fa017[_0x3d96('0x26')]){delete _0x5fa017[_0x3d96('0x26')];}_0x1f5fee['status'](_0x431e53)['send'](_0x5fa017);};}exports[_0x3d96('0x27')]=function(_0x15b66e,_0x47b046){var _0x4c65e9={},_0x1050b8={},_0x3842dd={'count':0x0,'rows':[]};var _0x573180=_[_0x3d96('0x28')](db[_0x3d96('0x29')]['rawAttributes'],function(_0x33aedd){return{'name':_0x33aedd[_0x3d96('0x2a')],'type':_0x33aedd[_0x3d96('0x2b')]['key']};});_0x1050b8['model']=_['map'](_0x573180,_0x3d96('0x26'));_0x1050b8[_0x3d96('0x2c')]=_[_0x3d96('0x2d')](_0x15b66e[_0x3d96('0x2c')]);_0x1050b8['filters']=_[_0x3d96('0x2e')](_0x1050b8[_0x3d96('0x2f')],_0x1050b8[_0x3d96('0x2c')]);_0x4c65e9[_0x3d96('0x30')]=_['intersection'](_0x1050b8['model'],qs[_0x3d96('0x31')](_0x15b66e['query'][_0x3d96('0x31')]));_0x4c65e9[_0x3d96('0x30')]=_0x4c65e9[_0x3d96('0x30')]['length']?_0x4c65e9[_0x3d96('0x30')]:_0x1050b8[_0x3d96('0x2f')];if(!_0x15b66e['query'][_0x3d96('0x32')]('nolimit')){_0x4c65e9[_0x3d96('0x1d')]=qs[_0x3d96('0x1d')](_0x15b66e[_0x3d96('0x2c')][_0x3d96('0x1d')]);_0x4c65e9[_0x3d96('0x1c')]=qs[_0x3d96('0x1c')](_0x15b66e['query'][_0x3d96('0x1c')]);}_0x4c65e9[_0x3d96('0x33')]=qs[_0x3d96('0x34')](_0x15b66e[_0x3d96('0x2c')][_0x3d96('0x34')]);_0x4c65e9[_0x3d96('0x35')]=qs[_0x3d96('0x36')](_[_0x3d96('0x37')](_0x15b66e[_0x3d96('0x2c')],_0x1050b8['filters']),_0x573180);if(_0x15b66e[_0x3d96('0x2c')]['filter']){_0x4c65e9[_0x3d96('0x35')]=_[_0x3d96('0x38')](_0x4c65e9[_0x3d96('0x35')],{'$or':_[_0x3d96('0x28')](_0x573180,function(_0x261860){if(_0x261860[_0x3d96('0x2b')]!==_0x3d96('0x39')){var _0x235849={};_0x235849[_0x261860[_0x3d96('0x26')]]={'$like':'%'+_0x15b66e[_0x3d96('0x2c')][_0x3d96('0x3a')]+'%'};return _0x235849;}})});}_0x4c65e9=_[_0x3d96('0x38')]({},_0x4c65e9,_0x15b66e[_0x3d96('0x3b')]);var _0x176daf={'where':_0x4c65e9[_0x3d96('0x35')]};return db[_0x3d96('0x29')][_0x3d96('0x3c')](_0x176daf)[_0x3d96('0x21')](function(_0x17b93c){_0x3842dd[_0x3d96('0x3c')]=_0x17b93c;if(_0x15b66e['query'][_0x3d96('0x3d')]){_0x4c65e9[_0x3d96('0x3e')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x4c65e9);})[_0x3d96('0x21')](function(_0x143457){_0x3842dd[_0x3d96('0x3f')]=_0x143457;return _0x3842dd;})[_0x3d96('0x21')](respondWithFilteredResult(_0x47b046,_0x4c65e9))[_0x3d96('0x40')](handleError(_0x47b046,null));};exports[_0x3d96('0x41')]=function(_0x1afee1,_0x568035){var _0x571c2e={'raw':!![],'where':{'id':_0x1afee1[_0x3d96('0x42')]['id']}},_0x3a33b3={};_0x3a33b3[_0x3d96('0x2f')]=_[_0x3d96('0x2d')](db[_0x3d96('0x29')]['rawAttributes']);_0x3a33b3[_0x3d96('0x2c')]=_['keys'](_0x1afee1[_0x3d96('0x2c')]);_0x3a33b3[_0x3d96('0x36')]=_[_0x3d96('0x2e')](_0x3a33b3[_0x3d96('0x2f')],_0x3a33b3[_0x3d96('0x2c')]);_0x571c2e['attributes']=_[_0x3d96('0x2e')](_0x3a33b3[_0x3d96('0x2f')],qs['fields'](_0x1afee1['query'][_0x3d96('0x31')]));_0x571c2e[_0x3d96('0x30')]=_0x571c2e[_0x3d96('0x30')][_0x3d96('0x43')]?_0x571c2e['attributes']:_0x3a33b3[_0x3d96('0x2f')];if(_0x1afee1[_0x3d96('0x2c')][_0x3d96('0x3d')]){_0x571c2e[_0x3d96('0x3e')]=[{'all':!![]}];}_0x571c2e=_[_0x3d96('0x38')]({},_0x571c2e,_0x1afee1[_0x3d96('0x3b')]);return db[_0x3d96('0x29')][_0x3d96('0x44')](_0x571c2e)[_0x3d96('0x21')](handleEntityNotFound(_0x568035,null))[_0x3d96('0x21')](respondWithResult(_0x568035,null))[_0x3d96('0x40')](handleError(_0x568035,null));};exports[_0x3d96('0x45')]=function(_0x56fbfa,_0x82fe80){return db[_0x3d96('0x29')][_0x3d96('0x45')](_0x56fbfa[_0x3d96('0x46')],{})[_0x3d96('0x21')](respondWithResult(_0x82fe80,0xc9))['catch'](handleError(_0x82fe80,null));};exports[_0x3d96('0x20')]=function(_0x2d23a5,_0x478e85){if(_0x2d23a5[_0x3d96('0x46')]['id']){delete _0x2d23a5[_0x3d96('0x46')]['id'];}return db[_0x3d96('0x29')][_0x3d96('0x44')]({'where':{'id':_0x2d23a5[_0x3d96('0x42')]['id']}})[_0x3d96('0x21')](handleEntityNotFound(_0x478e85,null))[_0x3d96('0x21')](saveUpdates(_0x2d23a5[_0x3d96('0x46')],null))[_0x3d96('0x21')](respondWithResult(_0x478e85,null))[_0x3d96('0x40')](handleError(_0x478e85,null));};exports[_0x3d96('0x22')]=function(_0xf7a71e,_0x36505e){return db[_0x3d96('0x29')]['find']({'where':{'id':_0xf7a71e['params']['id']}})[_0x3d96('0x21')](handleEntityNotFound(_0x36505e,null))['then'](removeEntity(_0x36505e,null))[_0x3d96('0x40')](handleError(_0x36505e,null));}; \ No newline at end of file +var _0xca04=['order','sort','pick','filter','where','merge','VIRTUAL','options','SalesforceField','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3635b9,_0x48ef56){var _0x290d8c=function(_0x4a4305){while(--_0x4a4305){_0x3635b9['push'](_0x3635b9['shift']());}};_0x290d8c(++_0x48ef56);}(_0xca04,0x138));var _0x4ca0=function(_0x5e8319,_0x391c07){_0x5e8319=_0x5e8319-0x0;var _0x3ced38=_0xca04[_0x5e8319];return _0x3ced38;};'use strict';var pdf=require(_0x4ca0('0x0'));var emlformat=require(_0x4ca0('0x1'));var rimraf=require(_0x4ca0('0x2'));var zipdir=require(_0x4ca0('0x3'));var jsonpatch=require(_0x4ca0('0x4'));var rp=require(_0x4ca0('0x5'));var moment=require(_0x4ca0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4ca0('0x7'));var util=require(_0x4ca0('0x8'));var path=require(_0x4ca0('0x9'));var sox=require(_0x4ca0('0xa'));var csv=require(_0x4ca0('0xb'));var ejs=require(_0x4ca0('0xc'));var fs=require('fs');var _=require(_0x4ca0('0xd'));var squel=require(_0x4ca0('0xe'));var crypto=require('crypto');var jsforce=require(_0x4ca0('0xf'));var deskjs=require(_0x4ca0('0x10'));var toCsv=require(_0x4ca0('0xb'));var querystring=require(_0x4ca0('0x11'));var Papa=require('papaparse');var Redis=require(_0x4ca0('0x12'));var authService=require(_0x4ca0('0x13'));var qs=require(_0x4ca0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ca0('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4ca0('0x16'))['db'];function respondWithStatusCode(_0x1d1cbf,_0x5e2d13){_0x5e2d13=_0x5e2d13||0xcc;return function(_0x399a23){if(_0x399a23){return _0x1d1cbf['sendStatus'](_0x5e2d13);}return _0x1d1cbf[_0x4ca0('0x17')](_0x5e2d13)[_0x4ca0('0x18')]();};}function respondWithResult(_0xb9bae5,_0x2a5241){_0x2a5241=_0x2a5241||0xc8;return function(_0xbb28ff){if(_0xbb28ff){return _0xb9bae5[_0x4ca0('0x17')](_0x2a5241)['json'](_0xbb28ff);}};}function respondWithFilteredResult(_0xcaceec,_0x436964){return function(_0xdddca9){if(_0xdddca9){var _0x1e4aaf=_0xdddca9[_0x4ca0('0x19')],_0x540490=_0x436964[_0x4ca0('0x1a')],_0x58cfbd=_0x436964['offset']+_0x436964[_0x4ca0('0x1b')],_0x108dfe;if(_0x58cfbd>=_0x1e4aaf){_0x58cfbd=_0x1e4aaf;_0x108dfe=0xc8;}else{_0x108dfe=0xce;}_0xcaceec['status'](_0x108dfe);return _0xcaceec['set'](_0x4ca0('0x1c'),_0x540490+'-'+_0x58cfbd+'/'+_0x1e4aaf)[_0x4ca0('0x1d')](_0xdddca9);}return null;};}function patchUpdates(_0x1eaa3a){return function(_0x42a185){try{jsonpatch[_0x4ca0('0x1e')](_0x42a185,_0x1eaa3a,!![]);}catch(_0x4083c6){return BPromise[_0x4ca0('0x1f')](_0x4083c6);}return _0x42a185[_0x4ca0('0x20')]();};}function saveUpdates(_0x551bc6,_0x17bd3f){return function(_0x280bae){if(_0x280bae){return _0x280bae[_0x4ca0('0x21')](_0x551bc6)['then'](function(_0x2e1e56){return _0x2e1e56;});}return null;};}function removeEntity(_0x48a406,_0x2dccf4){return function(_0x431b4e){if(_0x431b4e){return _0x431b4e[_0x4ca0('0x22')]()[_0x4ca0('0x23')](function(){_0x48a406[_0x4ca0('0x17')](0xcc)[_0x4ca0('0x18')]();});}};}function handleEntityNotFound(_0x3b4941,_0x28e255){return function(_0x15f50a){if(!_0x15f50a){_0x3b4941[_0x4ca0('0x24')](0x194);}return _0x15f50a;};}function handleError(_0x45fb8b,_0x141122){_0x141122=_0x141122||0x1f4;return function(_0x38a5d0){logger[_0x4ca0('0x25')](_0x38a5d0[_0x4ca0('0x26')]);if(_0x38a5d0[_0x4ca0('0x27')]){delete _0x38a5d0['name'];}_0x45fb8b[_0x4ca0('0x17')](_0x141122)['send'](_0x38a5d0);};}exports[_0x4ca0('0x28')]=function(_0x485bda,_0x27bcc2){var _0x9a6b06={},_0xa8fb54={},_0x453f24={'count':0x0,'rows':[]};var _0x5b4ebf=_[_0x4ca0('0x29')](db['SalesforceField']['rawAttributes'],function(_0x5ede72){return{'name':_0x5ede72['fieldName'],'type':_0x5ede72[_0x4ca0('0x2a')][_0x4ca0('0x2b')]};});_0xa8fb54['model']=_[_0x4ca0('0x29')](_0x5b4ebf,'name');_0xa8fb54['query']=_['keys'](_0x485bda[_0x4ca0('0x2c')]);_0xa8fb54[_0x4ca0('0x2d')]=_[_0x4ca0('0x2e')](_0xa8fb54[_0x4ca0('0x2f')],_0xa8fb54[_0x4ca0('0x2c')]);_0x9a6b06[_0x4ca0('0x30')]=_['intersection'](_0xa8fb54['model'],qs['fields'](_0x485bda[_0x4ca0('0x2c')][_0x4ca0('0x31')]));_0x9a6b06[_0x4ca0('0x30')]=_0x9a6b06['attributes'][_0x4ca0('0x32')]?_0x9a6b06[_0x4ca0('0x30')]:_0xa8fb54[_0x4ca0('0x2f')];if(!_0x485bda[_0x4ca0('0x2c')][_0x4ca0('0x33')](_0x4ca0('0x34'))){_0x9a6b06[_0x4ca0('0x1b')]=qs[_0x4ca0('0x1b')](_0x485bda[_0x4ca0('0x2c')][_0x4ca0('0x1b')]);_0x9a6b06[_0x4ca0('0x1a')]=qs[_0x4ca0('0x1a')](_0x485bda[_0x4ca0('0x2c')]['offset']);}_0x9a6b06[_0x4ca0('0x35')]=qs[_0x4ca0('0x36')](_0x485bda[_0x4ca0('0x2c')][_0x4ca0('0x36')]);_0x9a6b06['where']=qs['filters'](_[_0x4ca0('0x37')](_0x485bda['query'],_0xa8fb54[_0x4ca0('0x2d')]),_0x5b4ebf);if(_0x485bda[_0x4ca0('0x2c')][_0x4ca0('0x38')]){_0x9a6b06[_0x4ca0('0x39')]=_[_0x4ca0('0x3a')](_0x9a6b06[_0x4ca0('0x39')],{'$or':_[_0x4ca0('0x29')](_0x5b4ebf,function(_0x5b14f3){if(_0x5b14f3[_0x4ca0('0x2a')]!==_0x4ca0('0x3b')){var _0xe2729={};_0xe2729[_0x5b14f3[_0x4ca0('0x27')]]={'$like':'%'+_0x485bda[_0x4ca0('0x2c')][_0x4ca0('0x38')]+'%'};return _0xe2729;}})});}_0x9a6b06=_[_0x4ca0('0x3a')]({},_0x9a6b06,_0x485bda[_0x4ca0('0x3c')]);var _0x39b499={'where':_0x9a6b06[_0x4ca0('0x39')]};return db[_0x4ca0('0x3d')][_0x4ca0('0x19')](_0x39b499)[_0x4ca0('0x23')](function(_0x54f403){_0x453f24['count']=_0x54f403;if(_0x485bda[_0x4ca0('0x2c')][_0x4ca0('0x3e')]){_0x9a6b06[_0x4ca0('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0x4ca0('0x40')](_0x9a6b06);})[_0x4ca0('0x23')](function(_0x3cc396){_0x453f24[_0x4ca0('0x41')]=_0x3cc396;return _0x453f24;})[_0x4ca0('0x23')](respondWithFilteredResult(_0x27bcc2,_0x9a6b06))['catch'](handleError(_0x27bcc2,null));};exports['show']=function(_0x67040,_0x4d5a12){var _0x6502f0={'raw':!![],'where':{'id':_0x67040[_0x4ca0('0x42')]['id']}},_0x969b32={};_0x969b32[_0x4ca0('0x2f')]=_[_0x4ca0('0x43')](db[_0x4ca0('0x3d')][_0x4ca0('0x44')]);_0x969b32['query']=_[_0x4ca0('0x43')](_0x67040[_0x4ca0('0x2c')]);_0x969b32[_0x4ca0('0x2d')]=_[_0x4ca0('0x2e')](_0x969b32[_0x4ca0('0x2f')],_0x969b32[_0x4ca0('0x2c')]);_0x6502f0[_0x4ca0('0x30')]=_[_0x4ca0('0x2e')](_0x969b32[_0x4ca0('0x2f')],qs[_0x4ca0('0x31')](_0x67040[_0x4ca0('0x2c')][_0x4ca0('0x31')]));_0x6502f0['attributes']=_0x6502f0[_0x4ca0('0x30')]['length']?_0x6502f0[_0x4ca0('0x30')]:_0x969b32['model'];if(_0x67040[_0x4ca0('0x2c')][_0x4ca0('0x3e')]){_0x6502f0['include']=[{'all':!![]}];}_0x6502f0=_['merge']({},_0x6502f0,_0x67040[_0x4ca0('0x3c')]);return db[_0x4ca0('0x3d')][_0x4ca0('0x45')](_0x6502f0)[_0x4ca0('0x23')](handleEntityNotFound(_0x4d5a12,null))[_0x4ca0('0x23')](respondWithResult(_0x4d5a12,null))['catch'](handleError(_0x4d5a12,null));};exports[_0x4ca0('0x46')]=function(_0x537010,_0x1c24ea){return db[_0x4ca0('0x3d')][_0x4ca0('0x46')](_0x537010['body'],{})[_0x4ca0('0x23')](respondWithResult(_0x1c24ea,0xc9))[_0x4ca0('0x47')](handleError(_0x1c24ea,null));};exports['update']=function(_0x2bce8c,_0x447dc3){if(_0x2bce8c[_0x4ca0('0x48')]['id']){delete _0x2bce8c[_0x4ca0('0x48')]['id'];}return db[_0x4ca0('0x3d')][_0x4ca0('0x45')]({'where':{'id':_0x2bce8c[_0x4ca0('0x42')]['id']}})[_0x4ca0('0x23')](handleEntityNotFound(_0x447dc3,null))['then'](saveUpdates(_0x2bce8c['body'],null))[_0x4ca0('0x23')](respondWithResult(_0x447dc3,null))[_0x4ca0('0x47')](handleError(_0x447dc3,null));};exports['destroy']=function(_0x4bcd5b,_0x1093da){return db[_0x4ca0('0x3d')]['find']({'where':{'id':_0x4bcd5b[_0x4ca0('0x42')]['id']}})['then'](handleEntityNotFound(_0x1093da,null))[_0x4ca0('0x23')](removeEntity(_0x1093da,null))[_0x4ca0('0x47')](handleError(_0x1093da,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ee9fdcd..c9a161b 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 _0x8dc9=['path','rimraf','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x11ae78,_0x31f3c3){var _0x245e6f=function(_0x588cf3){while(--_0x588cf3){_0x11ae78['push'](_0x11ae78['shift']());}};_0x245e6f(++_0x31f3c3);}(_0x8dc9,0x17b));var _0x98dc=function(_0x8f9639,_0x53cd71){_0x8f9639=_0x8f9639-0x0;var _0x18c36f=_0x8dc9[_0x8f9639];return _0x18c36f;};'use strict';var _=require(_0x98dc('0x0'));var util=require(_0x98dc('0x1'));var logger=require('../../config/logger')(_0x98dc('0x2'));var moment=require(_0x98dc('0x3'));var BPromise=require(_0x98dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98dc('0x5'));var rimraf=require(_0x98dc('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x17c8de,_0x54a755){return _0x17c8de[_0x98dc('0x7')](_0x98dc('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x98dc('0x9'),'fields':[_0x98dc('0xa'),_0x98dc('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0089=['moment','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','../../config/logger','api'];(function(_0xfff52e,_0xd803f6){var _0x42876e=function(_0x4652bc){while(--_0x4652bc){_0xfff52e['push'](_0xfff52e['shift']());}};_0x42876e(++_0xd803f6);}(_0x0089,0x11c));var _0x9008=function(_0xf85242,_0x113527){_0xf85242=_0xf85242-0x0;var _0x461cb7=_0x0089[_0xf85242];return _0x461cb7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9008('0x0'))(_0x9008('0x1'));var moment=require(_0x9008('0x2'));var BPromise=require('bluebird');var rp=require(_0x9008('0x3'));var fs=require('fs');var path=require(_0x9008('0x4'));var rimraf=require('rimraf');var config=require(_0x9008('0x5'));var attributes=require(_0x9008('0x6'));module[_0x9008('0x7')]=function(_0x4498cc,_0x3e7e51){return _0x4498cc[_0x9008('0x8')]('SalesforceField',attributes,{'tableName':_0x9008('0x9'),'paranoid':![],'indexes':[{'name':_0x9008('0xa'),'fields':[_0x9008('0xb'),_0x9008('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 9bb06e6..e155ed3 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 _0x91a7=['message','SalesforceField,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x108c0b,_0x197d5a){var _0x5a7ee1=function(_0x4685e4){while(--_0x4685e4){_0x108c0b['push'](_0x108c0b['shift']());}};_0x5a7ee1(++_0x197d5a);}(_0x91a7,0xe7));var _0x791a=function(_0xf2979d,_0x5e352a){_0xf2979d=_0xf2979d-0x0;var _0x3630b2=_0x91a7[_0xf2979d];return _0x3630b2;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file +var _0xa571=['request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xa571,0x107));var _0x1a57=function(_0x10c90e,_0x2a0672){_0x10c90e=_0x10c90e-0x0;var _0x2fbfee=_0xa571[_0x10c90e];return _0x2fbfee;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('SalesforceField,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('SalesforceField,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index c67fec2..8a45211 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 _0xa6bb=['/:id/configurations','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','post','create'];(function(_0x3bb278,_0x29d03c){var _0x636328=function(_0x531ee8){while(--_0x531ee8){_0x3bb278['push'](_0x3bb278['shift']());}};_0x636328(++_0x29d03c);}(_0xa6bb,0x12c));var _0xba6b=function(_0x49afa4,_0x528d07){_0x49afa4=_0x49afa4-0x0;var _0x879fc2=_0xa6bb[_0x49afa4];return _0x879fc2;};'use strict';var multer=require('multer');var util=require(_0xba6b('0x0'));var path=require(_0xba6b('0x1'));var timeout=require(_0xba6b('0x2'));var express=require(_0xba6b('0x3'));var router=express[_0xba6b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba6b('0x5'));var controller=require(_0xba6b('0x6'));router[_0xba6b('0x7')]('/',auth[_0xba6b('0x8')](),controller['index']);router['get'](_0xba6b('0x9'),auth[_0xba6b('0x8')](),controller[_0xba6b('0xa')]);router['get']('/:id/configurations',auth[_0xba6b('0x8')](),controller[_0xba6b('0xb')]);router[_0xba6b('0x7')](_0xba6b('0xc'),auth[_0xba6b('0x8')](),controller['getFields']);router[_0xba6b('0xd')]('/',auth[_0xba6b('0x8')](),controller[_0xba6b('0xe')]);router['post'](_0xba6b('0xf'),auth[_0xba6b('0x8')](),controller[_0xba6b('0x10')]);router[_0xba6b('0x11')]('/:id',auth[_0xba6b('0x8')](),controller['update']);router[_0xba6b('0x12')](_0xba6b('0x9'),auth[_0xba6b('0x8')](),controller[_0xba6b('0x13')]);module[_0xba6b('0x14')]=router; \ No newline at end of file +var _0x3de2=['post','addConfiguration','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3de2,0x79));var _0x23de=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x3de2[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0x23de('0x0'));var util=require('util');var path=require(_0x23de('0x1'));var timeout=require(_0x23de('0x2'));var express=require(_0x23de('0x3'));var router=express[_0x23de('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x23de('0x5'));var controller=require(_0x23de('0x6'));router[_0x23de('0x7')]('/',auth[_0x23de('0x8')](),controller['index']);router[_0x23de('0x7')]('/:id',auth[_0x23de('0x8')](),controller[_0x23de('0x9')]);router[_0x23de('0x7')](_0x23de('0xa'),auth[_0x23de('0x8')](),controller[_0x23de('0xb')]);router[_0x23de('0x7')]('/:id/fields',auth[_0x23de('0x8')](),controller['getFields']);router[_0x23de('0xc')]('/',auth[_0x23de('0x8')](),controller['create']);router['post'](_0x23de('0xa'),auth['isAuthenticated'](),controller[_0x23de('0xd')]);router['put'](_0x23de('0xe'),auth[_0x23de('0x8')](),controller[_0x23de('0xf')]);router[_0x23de('0x10')](_0x23de('0xe'),auth[_0x23de('0x8')](),controller[_0x23de('0x11')]);module[_0x23de('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8b2b831..ecbca31 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 _0x8c96=['STRING','username','sequelize','exports'];(function(_0x3e03ca,_0x5a7cf1){var _0x3fdfb5=function(_0xdb2ecb){while(--_0xdb2ecb){_0x3e03ca['push'](_0x3e03ca['shift']());}};_0x3fdfb5(++_0x5a7cf1);}(_0x8c96,0xca));var _0x68c9=function(_0x38831b,_0x4611ea){_0x38831b=_0x38831b-0x0;var _0x5a508a=_0x8c96[_0x38831b];return _0x5a508a;};'use strict';var Sequelize=require(_0x68c9('0x0'));module[_0x68c9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x68c9('0x2')]},'username':{'type':Sequelize[_0x68c9('0x2')],'unique':_0x68c9('0x3')},'password':{'type':Sequelize[_0x68c9('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x68c9('0x2')]}}; \ No newline at end of file +var _0x6dc5=['exports','STRING','remoteUri','sequelize'];(function(_0x1b0196,_0x46b5fc){var _0x79d318=function(_0x246e15){while(--_0x246e15){_0x1b0196['push'](_0x1b0196['shift']());}};_0x79d318(++_0x46b5fc);}(_0x6dc5,0x18b));var _0x56dc=function(_0x5234c2,_0x5f4bfe){_0x5234c2=_0x5234c2-0x0;var _0x53a9c5=_0x6dc5[_0x5234c2];return _0x53a9c5;};'use strict';var Sequelize=require(_0x56dc('0x0'));module[_0x56dc('0x1')]={'name':{'type':Sequelize[_0x56dc('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x56dc('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x56dc('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x56dc('0x2')],'unique':_0x56dc('0x3')},'serverUrl':{'type':Sequelize[_0x56dc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 30446c2..ff6cc8f 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 _0xe124=['destroy','end','stack','name','index','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','show','params','ServicenowAccount','rawAttributes','include','merge','find','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','notify','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','upon_approval','correlation_id','location','category','username','password','email','remoteUri','slice','substring','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','statusCode','send','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','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','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update'];(function(_0x566dd5,_0x491250){var _0x184612=function(_0xe8a501){while(--_0xe8a501){_0x566dd5['push'](_0x566dd5['shift']());}};_0x184612(++_0x491250);}(_0xe124,0x154));var _0x4e12=function(_0x2bab9e,_0x40e308){_0x2bab9e=_0x2bab9e-0x0;var _0x5bdf6d=_0xe124[_0x2bab9e];return _0x5bdf6d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e12('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e12('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e12('0x2'));var moment=require(_0x4e12('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4e12('0x4'));var util=require(_0x4e12('0x5'));var path=require(_0x4e12('0x6'));var sox=require(_0x4e12('0x7'));var csv=require(_0x4e12('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4e12('0x9'));var squel=require('squel');var crypto=require(_0x4e12('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4e12('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4e12('0xc'));var Papa=require('papaparse');var Redis=require(_0x4e12('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e12('0xe'));var logger=require(_0x4e12('0xf'))(_0x4e12('0x10'));var utils=require(_0x4e12('0x11'));var config=require('../../config/environment');var db=require(_0x4e12('0x12'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2f7938,_0x38174b,_0xad67ab){if(_0xad67ab){var _0x4fc0da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fc0da[_0x4e12('0x13')](_0x38174b)){return _0x2f7938;}else{throw new db['Sequelize']['ValidationError'](_0x4e12('0x14'));}}else{return _0x2f7938;}}function respondWithRpcPromise(_0x46254c,_0x1214b2,_0x1827ef,_0x32a1fa){return new BPromise(function(_0x5842a3,_0x393625){var _0x383096=_0x32a1fa||client;return _0x383096[_0x4e12('0x15')](_0x46254c,_0x1827ef)[_0x4e12('0x16')](function(_0x51707b){logger['info'](_0x4e12('0x17'),_0x1214b2,_0x4e12('0x18'));logger[_0x4e12('0x19')](_0x4e12('0x1a'),_0x1214b2,'request\x20sent',JSON[_0x4e12('0x1b')](_0x51707b));if(_0x51707b[_0x4e12('0x1c')]){if(_0x51707b[_0x4e12('0x1c')]['code']===0x1f4){logger['error'](_0x4e12('0x17'),_0x1214b2,_0x51707b[_0x4e12('0x1c')][_0x4e12('0x1d')]);return _0x393625(_0x51707b[_0x4e12('0x1c')]['message']);}logger[_0x4e12('0x1c')](_0x4e12('0x17'),_0x1214b2,_0x51707b[_0x4e12('0x1c')][_0x4e12('0x1d')]);return _0x5842a3(_0x51707b['error'][_0x4e12('0x1d')]);}else{logger[_0x4e12('0x1e')](_0x4e12('0x17'),_0x1214b2,_0x4e12('0x18'));_0x5842a3(_0x51707b['result'][_0x4e12('0x1d')]);}})[_0x4e12('0x1f')](function(_0x39b1bd){logger[_0x4e12('0x1c')](_0x4e12('0x17'),_0x1214b2,_0x39b1bd);_0x393625(_0x39b1bd);});});}function respondWithStatusCode(_0x659d63,_0x4b96f5){_0x4b96f5=_0x4b96f5||0xcc;return function(_0x1d1c97){if(_0x1d1c97){return _0x659d63[_0x4e12('0x20')](_0x4b96f5);}return _0x659d63[_0x4e12('0x21')](_0x4b96f5)['end']();};}function respondWithResult(_0x3ebb9d,_0x3361f8){_0x3361f8=_0x3361f8||0xc8;return function(_0x4ca6aa){if(_0x4ca6aa){return _0x3ebb9d['status'](_0x3361f8)[_0x4e12('0x22')](_0x4ca6aa);}};}function respondWithFilteredResult(_0x2f7708,_0xfefd5d){return function(_0x112e50){if(_0x112e50){var _0xc73c62=_0x112e50[_0x4e12('0x23')],_0x4abdc0=_0xfefd5d['offset'],_0x6f6f67=_0xfefd5d[_0x4e12('0x24')]+_0xfefd5d['limit'],_0x2d417f;if(_0x6f6f67>=_0xc73c62){_0x6f6f67=_0xc73c62;_0x2d417f=0xc8;}else{_0x2d417f=0xce;}_0x2f7708[_0x4e12('0x21')](_0x2d417f);return _0x2f7708[_0x4e12('0x25')](_0x4e12('0x26'),_0x4abdc0+'-'+_0x6f6f67+'/'+_0xc73c62)['json'](_0x112e50);}return null;};}function patchUpdates(_0x1f9a67){return function(_0x2baf94){try{jsonpatch[_0x4e12('0x27')](_0x2baf94,_0x1f9a67,!![]);}catch(_0x85bc45){return BPromise['reject'](_0x85bc45);}return _0x2baf94[_0x4e12('0x28')]();};}function saveUpdates(_0x318530,_0x226e40){return function(_0x374ab3){if(_0x374ab3){return _0x374ab3[_0x4e12('0x29')](_0x318530)[_0x4e12('0x16')](function(_0x1b1b59){return _0x1b1b59;});}return null;};}function removeEntity(_0x534a21,_0x9ae23){return function(_0x5d70ef){if(_0x5d70ef){return _0x5d70ef[_0x4e12('0x2a')]()[_0x4e12('0x16')](function(){_0x534a21[_0x4e12('0x21')](0xcc)[_0x4e12('0x2b')]();});}};}function handleEntityNotFound(_0x5a9a6f,_0x3ecc4a){return function(_0x3c0fc3){if(!_0x3c0fc3){_0x5a9a6f[_0x4e12('0x20')](0x194);}return _0x3c0fc3;};}function handleError(_0x4a7342,_0x3e4cd4){_0x3e4cd4=_0x3e4cd4||0x1f4;return function(_0x36845b){logger[_0x4e12('0x1c')](_0x36845b[_0x4e12('0x2c')]);if(_0x36845b[_0x4e12('0x2d')]){delete _0x36845b[_0x4e12('0x2d')];}_0x4a7342['status'](_0x3e4cd4)['send'](_0x36845b);};}exports[_0x4e12('0x2e')]=function(_0x3e67d4,_0x3f9d3b){var _0x46b93c={},_0x36dfad={},_0x158b1d={'count':0x0,'rows':[]};var _0x1da9ce=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x32d06d){return{'name':_0x32d06d['fieldName'],'type':_0x32d06d['type'][_0x4e12('0x2f')]};});_0x36dfad[_0x4e12('0x30')]=_[_0x4e12('0x31')](_0x1da9ce,_0x4e12('0x2d'));_0x36dfad[_0x4e12('0x32')]=_[_0x4e12('0x33')](_0x3e67d4['query']);_0x36dfad[_0x4e12('0x34')]=_[_0x4e12('0x35')](_0x36dfad['model'],_0x36dfad[_0x4e12('0x32')]);_0x46b93c[_0x4e12('0x36')]=_[_0x4e12('0x35')](_0x36dfad['model'],qs[_0x4e12('0x37')](_0x3e67d4[_0x4e12('0x32')][_0x4e12('0x37')]));_0x46b93c[_0x4e12('0x36')]=_0x46b93c[_0x4e12('0x36')][_0x4e12('0x38')]?_0x46b93c['attributes']:_0x36dfad['model'];if(!_0x3e67d4['query'][_0x4e12('0x39')](_0x4e12('0x3a'))){_0x46b93c[_0x4e12('0x3b')]=qs['limit'](_0x3e67d4[_0x4e12('0x32')]['limit']);_0x46b93c['offset']=qs[_0x4e12('0x24')](_0x3e67d4[_0x4e12('0x32')][_0x4e12('0x24')]);}_0x46b93c['order']=qs['sort'](_0x3e67d4[_0x4e12('0x32')]['sort']);_0x46b93c[_0x4e12('0x3c')]=qs[_0x4e12('0x34')](_[_0x4e12('0x3d')](_0x3e67d4[_0x4e12('0x32')],_0x36dfad['filters']),_0x1da9ce);if(_0x3e67d4[_0x4e12('0x32')][_0x4e12('0x3e')]){_0x46b93c['where']=_['merge'](_0x46b93c[_0x4e12('0x3c')],{'$or':_[_0x4e12('0x31')](_0x1da9ce,function(_0x11e5ec){if(_0x11e5ec[_0x4e12('0x3f')]!==_0x4e12('0x40')){var _0x193915={};_0x193915[_0x11e5ec[_0x4e12('0x2d')]]={'$like':'%'+_0x3e67d4[_0x4e12('0x32')][_0x4e12('0x3e')]+'%'};return _0x193915;}})});}_0x46b93c=_['merge']({},_0x46b93c,_0x3e67d4[_0x4e12('0x41')]);var _0x51f586={'where':_0x46b93c[_0x4e12('0x3c')]};return db['ServicenowAccount'][_0x4e12('0x23')](_0x51f586)[_0x4e12('0x16')](function(_0x1daa1d){_0x158b1d[_0x4e12('0x23')]=_0x1daa1d;if(_0x3e67d4[_0x4e12('0x32')][_0x4e12('0x42')]){_0x46b93c['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0x4e12('0x43')](_0x46b93c);})[_0x4e12('0x16')](function(_0x688ed){_0x158b1d[_0x4e12('0x44')]=_0x688ed;return _0x158b1d;})[_0x4e12('0x16')](respondWithFilteredResult(_0x3f9d3b,_0x46b93c))[_0x4e12('0x1f')](handleError(_0x3f9d3b,null));};exports[_0x4e12('0x45')]=function(_0xa15b7b,_0x4396fa){var _0x3eff15={'raw':![],'where':{'id':_0xa15b7b[_0x4e12('0x46')]['id']}},_0x2f6ce5={};_0x2f6ce5[_0x4e12('0x30')]=_[_0x4e12('0x33')](db[_0x4e12('0x47')][_0x4e12('0x48')]);_0x2f6ce5['query']=_[_0x4e12('0x33')](_0xa15b7b[_0x4e12('0x32')]);_0x2f6ce5[_0x4e12('0x34')]=_['intersection'](_0x2f6ce5[_0x4e12('0x30')],_0x2f6ce5[_0x4e12('0x32')]);_0x3eff15[_0x4e12('0x36')]=_[_0x4e12('0x35')](_0x2f6ce5[_0x4e12('0x30')],qs['fields'](_0xa15b7b['query'][_0x4e12('0x37')]));_0x3eff15[_0x4e12('0x36')]=_0x3eff15['attributes']['length']?_0x3eff15[_0x4e12('0x36')]:_0x2f6ce5[_0x4e12('0x30')];if(_0xa15b7b[_0x4e12('0x32')][_0x4e12('0x42')]){_0x3eff15[_0x4e12('0x49')]=[{'all':!![]}];}_0x3eff15=_[_0x4e12('0x4a')]({},_0x3eff15,_0xa15b7b[_0x4e12('0x41')]);return db[_0x4e12('0x47')][_0x4e12('0x4b')](_0x3eff15)[_0x4e12('0x16')](handleEntityNotFound(_0x4396fa,null))['then'](respondWithResult(_0x4396fa,null))[_0x4e12('0x1f')](handleError(_0x4396fa,null));};exports[_0x4e12('0x4c')]=function(_0x4c51f1,_0x54d1a5){return db[_0x4e12('0x47')]['create'](_0x4c51f1[_0x4e12('0x4d')],{})[_0x4e12('0x16')](respondWithResult(_0x54d1a5,0xc9))[_0x4e12('0x1f')](handleError(_0x54d1a5,null));};exports[_0x4e12('0x29')]=function(_0x3acb28,_0xadd3b9){if(_0x3acb28[_0x4e12('0x4d')]['id']){delete _0x3acb28[_0x4e12('0x4d')]['id'];}return db[_0x4e12('0x47')][_0x4e12('0x4b')]({'where':{'id':_0x3acb28[_0x4e12('0x46')]['id']}})[_0x4e12('0x16')](handleEntityNotFound(_0xadd3b9,null))[_0x4e12('0x16')](saveUpdates(_0x3acb28[_0x4e12('0x4d')],null))[_0x4e12('0x16')](respondWithResult(_0xadd3b9,null))[_0x4e12('0x1f')](handleError(_0xadd3b9,null));};exports[_0x4e12('0x2a')]=function(_0x4dcb43,_0x4e00a9){return db[_0x4e12('0x47')][_0x4e12('0x4b')]({'where':{'id':_0x4dcb43[_0x4e12('0x46')]['id']}})[_0x4e12('0x16')](handleEntityNotFound(_0x4e00a9,null))[_0x4e12('0x16')](removeEntity(_0x4e00a9,null))[_0x4e12('0x1f')](handleError(_0x4e00a9,null));};exports[_0x4e12('0x4e')]=function(_0x1de6b7,_0x57237f,_0x3e4cdc){var _0x3f7d6e={};var _0x3c45ba={};var _0x471f1f;var _0x5e923f;return db[_0x4e12('0x47')][_0x4e12('0x4f')]({'where':{'id':_0x1de6b7['params']['id']}})[_0x4e12('0x16')](handleEntityNotFound(_0x57237f,null))[_0x4e12('0x16')](function(_0x41754b){if(_0x41754b){_0x471f1f=_0x41754b;_0x3c45ba[_0x4e12('0x30')]=_[_0x4e12('0x33')](db['ServicenowConfiguration'][_0x4e12('0x48')]);_0x3c45ba['query']=_[_0x4e12('0x33')](_0x1de6b7[_0x4e12('0x32')]);_0x3c45ba[_0x4e12('0x34')]=_['intersection'](_0x3c45ba[_0x4e12('0x30')],_0x3c45ba[_0x4e12('0x32')]);_0x3f7d6e[_0x4e12('0x36')]=_[_0x4e12('0x35')](_0x3c45ba[_0x4e12('0x30')],qs['fields'](_0x1de6b7[_0x4e12('0x32')][_0x4e12('0x37')]));_0x3f7d6e['attributes']=_0x3f7d6e['attributes']['length']?_0x3f7d6e[_0x4e12('0x36')]:_0x3c45ba[_0x4e12('0x30')];_0x3f7d6e[_0x4e12('0x50')]=qs['sort'](_0x1de6b7[_0x4e12('0x32')]['sort']);_0x3f7d6e[_0x4e12('0x3c')]=qs['filters'](_[_0x4e12('0x3d')](_0x1de6b7['query'],_0x3c45ba[_0x4e12('0x34')]));if(_0x1de6b7[_0x4e12('0x32')][_0x4e12('0x3e')]){_0x3f7d6e['where']=_[_0x4e12('0x4a')](_0x3f7d6e[_0x4e12('0x3c')],{'$or':_[_0x4e12('0x31')](_0x3f7d6e[_0x4e12('0x36')],function(_0x3dd2da){var _0x2c1fa3={};_0x2c1fa3[_0x3dd2da]={'$like':'%'+_0x1de6b7['query'][_0x4e12('0x3e')]+'%'};return _0x2c1fa3;})});}_0x3f7d6e=_[_0x4e12('0x4a')]({},_0x3f7d6e,_0x1de6b7[_0x4e12('0x41')]);return _0x471f1f[_0x4e12('0x4e')](_0x3f7d6e);}})[_0x4e12('0x16')](function(_0x1589dc){if(_0x1589dc){_0x5e923f=_0x1589dc[_0x4e12('0x38')];if(!_0x1de6b7[_0x4e12('0x32')][_0x4e12('0x39')](_0x4e12('0x3a'))){_0x3f7d6e['limit']=qs['limit'](_0x1de6b7['query'][_0x4e12('0x3b')]);_0x3f7d6e[_0x4e12('0x24')]=qs['offset'](_0x1de6b7[_0x4e12('0x32')]['offset']);}return _0x471f1f[_0x4e12('0x4e')](_0x3f7d6e);}})[_0x4e12('0x16')](function(_0x4b6491){if(_0x4b6491){return _0x4b6491?{'count':_0x5e923f,'rows':_0x4b6491}:null;}})[_0x4e12('0x16')](respondWithResult(_0x57237f,null))[_0x4e12('0x1f')](handleError(_0x57237f,null));};exports[_0x4e12('0x51')]=function(_0x182056,_0x4696f6,_0x2a7e27){if(_0x182056['body']['id']){delete _0x182056[_0x4e12('0x4d')]['id'];}return db[_0x4e12('0x47')][_0x4e12('0x4f')]({'where':{'id':_0x182056[_0x4e12('0x46')]['id']}})[_0x4e12('0x16')](handleEntityNotFound(_0x4696f6,null))[_0x4e12('0x16')](function(_0x2c8668){if(_0x2c8668){_0x182056[_0x4e12('0x4d')][_0x4e12('0x52')]=_0x2c8668['id'];_0x182056[_0x4e12('0x4d')][_0x4e12('0x53')]=integrations[_0x4e12('0x54')](_0x182056['body'][_0x4e12('0x55')],_0x182056[_0x4e12('0x4d')]['type']);_0x182056[_0x4e12('0x4d')][_0x4e12('0x56')]=integrations[_0x4e12('0x57')](_0x182056[_0x4e12('0x4d')]['channel'],_0x182056[_0x4e12('0x4d')][_0x4e12('0x3f')]);return db[_0x4e12('0x58')][_0x4e12('0x4c')](_0x182056[_0x4e12('0x4d')],{'include':[{'model':db[_0x4e12('0x59')],'as':_0x4e12('0x53')},{'model':db[_0x4e12('0x59')],'as':_0x4e12('0x56')}]});}return null;})[_0x4e12('0x16')](respondWithResult(_0x4696f6,null))[_0x4e12('0x1f')](handleError(_0x4696f6,null));};exports[_0x4e12('0x5a')]=function(_0x407aa2,_0x2b4cc6,_0x20ad20){var _0x1d23dc=[_0x4e12('0x5b'),'hold_reason',_0x4e12('0x5c'),_0x4e12('0x5d'),_0x4e12('0x5e'),_0x4e12('0x5f'),'incident_state',_0x4e12('0x60'),'category'];var _0x4684f3=[_0x4e12('0x61'),_0x4e12('0x5b'),_0x4e12('0x62'),_0x4e12('0x63'),_0x4e12('0x64'),_0x4e12('0x65'),_0x4e12('0x66'),_0x4e12('0x67'),_0x4e12('0x68'),'number',_0x4e12('0x69'),_0x4e12('0x6a'),_0x4e12('0x6b'),_0x4e12('0x6c'),_0x4e12('0x6d'),_0x4e12('0x6e'),_0x4e12('0x6f'),_0x4e12('0x70'),_0x4e12('0x5c'),_0x4e12('0x50'),'calendar_stc',_0x4e12('0x71'),_0x4e12('0x72'),_0x4e12('0x73'),_0x4e12('0x74'),_0x4e12('0x75'),_0x4e12('0x76'),'business_service',_0x4e12('0x77'),_0x4e12('0x78'),'rfc',_0x4e12('0x79'),_0x4e12('0x7a'),_0x4e12('0x7b'),_0x4e12('0x7c'),_0x4e12('0x7d'),_0x4e12('0x7e'),_0x4e12('0x7f'),'resolved_at','caller_id',_0x4e12('0x80'),_0x4e12('0x5d'),_0x4e12('0x81'),_0x4e12('0x82'),_0x4e12('0x5e'),_0x4e12('0x83'),_0x4e12('0x84'),'work_start',_0x4e12('0x85'),_0x4e12('0x86'),_0x4e12('0x87'),_0x4e12('0x88'),'calendar_duration',_0x4e12('0x5f'),'sys_class_name',_0x4e12('0x89'),_0x4e12('0x8a'),_0x4e12('0x8b'),_0x4e12('0x8c'),'sys_id',_0x4e12('0x8d'),_0x4e12('0x8e'),_0x4e12('0x8f'),_0x4e12('0x90'),_0x4e12('0x91'),'company',_0x4e12('0x92'),_0x4e12('0x93'),_0x4e12('0x94'),_0x4e12('0x60'),_0x4e12('0x95'),'sla_due',_0x4e12('0x96'),_0x4e12('0x97'),_0x4e12('0x98'),'sys_mod_count',_0x4e12('0x99'),_0x4e12('0x9a'),'escalation',_0x4e12('0x9b'),_0x4e12('0x9c'),_0x4e12('0x9d'),_0x4e12('0x9e')];var _0x47ca51='';var _0x416dc8='';var _0x499995=[];var _0x13c31e='';var _0x318af7='';var _0xdb5a7f=[];var _0x45aa9d='';var _0x574927='';var _0x499651={};var _0x1ea7a1='';return db[_0x4e12('0x47')]['findOne']({'where':{'id':_0x407aa2[_0x4e12('0x46')]['id']},'attributes':['id',_0x4e12('0x9f'),_0x4e12('0xa0'),_0x4e12('0xa1'),_0x4e12('0xa2'),'serverUrl']})[_0x4e12('0x16')](handleEntityNotFound(_0x2b4cc6,null))['then'](function(_0x581305){if(_0x581305){_0x1ea7a1=_0x581305[_0x4e12('0xa2')];var _0x4f6093=_0x1ea7a1[_0x4e12('0xa3')](-0x1);if(_0x4f6093==='/'){_0x1ea7a1=_0x1ea7a1[_0x4e12('0xa4')](0x0,_0x1ea7a1['lastIndexOf'](_0x4f6093));}_0x574927=util[_0x4e12('0xa5')]('%s/api/now/doc/table/schema/',_0x1ea7a1);_0x45aa9d=util[_0x4e12('0xa5')](_0x4e12('0xa6'),_0x1ea7a1);_0x499651={'user':_0x581305[_0x4e12('0x9f')],'pass':_0x581305[_0x4e12('0xa0')]};var _0x45b14f={'method':_0x4e12('0xa7'),'uri':_0x574927+_0x4e12('0xa8'),'auth':_0x499651,'json':!![]};return rp(_0x45b14f);}})[_0x4e12('0x16')](function(_0xc6c93e){if(_0xc6c93e[_0x4e12('0xa9')][_0x4e12('0x38')]>0x0){_0x47ca51=_0xc6c93e[_0x4e12('0xa9')];}console[_0x4e12('0xaa')](_0x4e12('0xab'),_0x47ca51);_0xdb5a7f=[];_0x416dc8=Object[_0x4e12('0xac')]([],_0x47ca51);_[_0x4e12('0xad')](_0x416dc8,function(_0x506e8a){return!_0x1d23dc[_0x4e12('0xae')](_0x506e8a['name']);});_0x416dc8[_0x4e12('0xaf')](function(_0x12f49c){var _0x1e6cd9=createFieldObject(_0x45aa9d,_0x499651,_0x12f49c[_0x4e12('0xb0')],_0x12f49c[_0x4e12('0x2d')],_0x12f49c[_0x4e12('0xb1')],![]);_0xdb5a7f['push'](_0x1e6cd9);});return Promise[_0x4e12('0xb2')](_0xdb5a7f);})['then'](function(_0x597b2a){_0x499995=_0x597b2a;_0x13c31e=Object[_0x4e12('0xac')]([],_0x47ca51);console['log'](_0x4e12('0xb3'),_0x47ca51);_[_0x4e12('0xad')](_0x13c31e,function(_0x3a9583){return _0x4684f3[_0x4e12('0xae')](_0x3a9583['name']);});console[_0x4e12('0xaa')](_0x4e12('0xb4'),_0x13c31e);_0xdb5a7f=[];_0x13c31e[_0x4e12('0xaf')](function(_0x42d98b){var _0x1f8312=createFieldObject(_0x45aa9d,_0x499651,_0x42d98b[_0x4e12('0xb0')],_0x42d98b[_0x4e12('0x2d')],_0x42d98b['label'],!![]);_0xdb5a7f[_0x4e12('0xb5')](_0x1f8312);});return Promise['all'](_0xdb5a7f);})[_0x4e12('0x16')](function(_0x3bf822){_0x318af7=_0x3bf822;var _0x51584a=_0x499995['concat'](_0x318af7);return{'count':_0x51584a[_0x4e12('0x38')],'rows':_0x51584a};})['then'](respondWithResult(_0x2b4cc6,null))[_0x4e12('0x1f')](function(_0x531599){console['log']('ServiceNow\x20error:\x20'+_0x531599);var _0x382f81=_0x407aa2[_0x4e12('0x32')]['test']?0x1f4:_0x531599[_0x4e12('0xb6')]||0x1f4;logger['error'](_0x531599[_0x4e12('0x2c')]);delete _0x531599[_0x4e12('0x2d')];if(_0x382f81===0x191){_0x382f81=0x190;}_0x2b4cc6[_0x4e12('0x21')](_0x382f81)[_0x4e12('0xb7')](_0x407aa2[_0x4e12('0x32')][_0x4e12('0x13')]?{'message':'Wrong\x20credentials','statusCode':_0x531599[_0x4e12('0xb6')]}:_0x531599);});};function createFieldObject(_0x764bce,_0xa3c1ad,_0x491e99,_0x8f731a,_0x1c380f,_0x4782eb){return new Promise(function(_0x2b8007,_0x378248){var _0x1980ab={'id':_0x8f731a,'name':_0x1c380f,'custom':_0x4782eb};if(_0x491e99===_0x4e12('0xb8')){_0x1980ab[_0x4e12('0x41')]=[{'name':_0x4e12('0xb9'),'value':_0x4e12('0xba')},{'name':_0x4e12('0xbb'),'value':'false'}];_0x2b8007(_0x1980ab);}else{var _0x13797d={'method':'GET','uri':_0x764bce+_0x4e12('0xbc')+_0x8f731a,'auth':_0xa3c1ad,'json':!![]};return rp(_0x13797d)[_0x4e12('0x16')](function(_0x1b53ef){var _0x5d0cdb=[];if(_0x1b53ef[_0x4e12('0xa9')]['length']>0x0){_0x1b53ef[_0x4e12('0xa9')]['forEach'](function(_0x15b47a){if(_0x15b47a[_0x4e12('0xbd')]===_0x4e12('0xbe')){var _0x54521a={'name':_0x15b47a[_0x4e12('0xb1')],'value':_0x15b47a['value']};_0x5d0cdb[_0x4e12('0xb5')](_0x54521a);}});}_0x1980ab[_0x4e12('0x41')]=_0x5d0cdb;if(_0x1980ab[_0x4e12('0x41')][_0x4e12('0x38')]>0x0){_0x2b8007(_0x1980ab);}else{if(_0x4782eb==![]){_0x2b8007();}else{_0x2b8007(_0x1980ab);}}});}});} \ No newline at end of file +var _0x99e9=['closed_by','sys_id','contact_type','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','upon_approval','correlation_id','location','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','statusCode','stack','send','boolean','True','true','False','inactive','false','value','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','limit','set','apply','reject','save','update','destroy','sendStatus','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','params','intersection','find','create','body','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x99e9,0x1bf));var _0x999e=function(_0x43186d,_0x4b40ec){_0x43186d=_0x43186d-0x0;var _0x5f562c=_0x99e9[_0x43186d];return _0x5f562c;};'use strict';var pdf=require(_0x999e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x999e('0x1'));var zipdir=require(_0x999e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x999e('0x3'));var moment=require(_0x999e('0x4'));var BPromise=require(_0x999e('0x5'));var Mustache=require('mustache');var util=require(_0x999e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x999e('0x7'));var squel=require(_0x999e('0x8'));var crypto=require('crypto');var jsforce=require(_0x999e('0x9'));var deskjs=require(_0x999e('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x999e('0xb'));var authService=require(_0x999e('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x999e('0xd'));var hardwareService=require(_0x999e('0xe'));var logger=require(_0x999e('0xf'))('api');var utils=require(_0x999e('0x10'));var config=require('../../config/environment');var db=require(_0x999e('0x11'))['db'];var integrations=require(_0x999e('0x12'));var jayson=require(_0x999e('0x13'));var client=jayson['client'][_0x999e('0x14')]({'port':0x232a});function checkPasswordPattern(_0xec715f,_0x5b1e15,_0x44fc23){if(_0x44fc23){var _0x393c2e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x393c2e[_0x999e('0x15')](_0x5b1e15)){return _0xec715f;}else{throw new db[(_0x999e('0x16'))]['ValidationError'](_0x999e('0x17'));}}else{return _0xec715f;}}function respondWithRpcPromise(_0x20df91,_0x5ceaa6,_0x2a2c34,_0x481cdf){return new BPromise(function(_0x5eafe6,_0x316d30){var _0xc3fdcd=_0x481cdf||client;return _0xc3fdcd[_0x999e('0x18')](_0x20df91,_0x2a2c34)[_0x999e('0x19')](function(_0x221af5){logger[_0x999e('0x1a')]('ServicenowAccount,\x20%s,\x20%s',_0x5ceaa6,_0x999e('0x1b'));logger['debug'](_0x999e('0x1c'),_0x5ceaa6,'request\x20sent',JSON[_0x999e('0x1d')](_0x221af5));if(_0x221af5['error']){if(_0x221af5[_0x999e('0x1e')][_0x999e('0x1f')]===0x1f4){logger[_0x999e('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x5ceaa6,_0x221af5[_0x999e('0x1e')][_0x999e('0x20')]);return _0x316d30(_0x221af5[_0x999e('0x1e')][_0x999e('0x20')]);}logger[_0x999e('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x5ceaa6,_0x221af5['error'][_0x999e('0x20')]);return _0x5eafe6(_0x221af5['error'][_0x999e('0x20')]);}else{logger['info'](_0x999e('0x21'),_0x5ceaa6,'request\x20sent');_0x5eafe6(_0x221af5[_0x999e('0x22')]['message']);}})[_0x999e('0x23')](function(_0x1d1739){logger[_0x999e('0x1e')](_0x999e('0x21'),_0x5ceaa6,_0x1d1739);_0x316d30(_0x1d1739);});});}function respondWithStatusCode(_0x2697f1,_0x251ae5){_0x251ae5=_0x251ae5||0xcc;return function(_0x514bef){if(_0x514bef){return _0x2697f1['sendStatus'](_0x251ae5);}return _0x2697f1[_0x999e('0x24')](_0x251ae5)[_0x999e('0x25')]();};}function respondWithResult(_0x3d3cbd,_0x3e151b){_0x3e151b=_0x3e151b||0xc8;return function(_0x1a6606){if(_0x1a6606){return _0x3d3cbd['status'](_0x3e151b)[_0x999e('0x26')](_0x1a6606);}};}function respondWithFilteredResult(_0x4240ca,_0x5d34cd){return function(_0x2818a9){if(_0x2818a9){var _0x2a59ba=_0x2818a9['count'],_0x30a106=_0x5d34cd['offset'],_0x49694b=_0x5d34cd[_0x999e('0x27')]+_0x5d34cd[_0x999e('0x28')],_0x2fc0cf;if(_0x49694b>=_0x2a59ba){_0x49694b=_0x2a59ba;_0x2fc0cf=0xc8;}else{_0x2fc0cf=0xce;}_0x4240ca[_0x999e('0x24')](_0x2fc0cf);return _0x4240ca[_0x999e('0x29')]('Content-Range',_0x30a106+'-'+_0x49694b+'/'+_0x2a59ba)['json'](_0x2818a9);}return null;};}function patchUpdates(_0x5c7cdb){return function(_0x49328a){try{jsonpatch[_0x999e('0x2a')](_0x49328a,_0x5c7cdb,!![]);}catch(_0x442c15){return BPromise[_0x999e('0x2b')](_0x442c15);}return _0x49328a[_0x999e('0x2c')]();};}function saveUpdates(_0x4ae12a,_0x168391){return function(_0x4b4dd2){if(_0x4b4dd2){return _0x4b4dd2[_0x999e('0x2d')](_0x4ae12a)[_0x999e('0x19')](function(_0x1c7e57){return _0x1c7e57;});}return null;};}function removeEntity(_0x279444,_0x2b855d){return function(_0x3b32d5){if(_0x3b32d5){return _0x3b32d5[_0x999e('0x2e')]()[_0x999e('0x19')](function(){_0x279444[_0x999e('0x24')](0xcc)[_0x999e('0x25')]();});}};}function handleEntityNotFound(_0x4edb5f,_0x32803c){return function(_0x1f29b9){if(!_0x1f29b9){_0x4edb5f[_0x999e('0x2f')](0x194);}return _0x1f29b9;};}function handleError(_0x302876,_0x5518aa){_0x5518aa=_0x5518aa||0x1f4;return function(_0x308edc){logger[_0x999e('0x1e')](_0x308edc['stack']);if(_0x308edc[_0x999e('0x30')]){delete _0x308edc[_0x999e('0x30')];}_0x302876[_0x999e('0x24')](_0x5518aa)['send'](_0x308edc);};}exports[_0x999e('0x31')]=function(_0x1f90fc,_0x5d2875){var _0x4e717d={},_0x1d53d8={},_0x2611fd={'count':0x0,'rows':[]};var _0x210c58=_[_0x999e('0x32')](db[_0x999e('0x33')][_0x999e('0x34')],function(_0x1ed1a3){return{'name':_0x1ed1a3[_0x999e('0x35')],'type':_0x1ed1a3[_0x999e('0x36')][_0x999e('0x37')]};});_0x1d53d8[_0x999e('0x38')]=_[_0x999e('0x32')](_0x210c58,_0x999e('0x30'));_0x1d53d8[_0x999e('0x39')]=_[_0x999e('0x3a')](_0x1f90fc['query']);_0x1d53d8[_0x999e('0x3b')]=_['intersection'](_0x1d53d8[_0x999e('0x38')],_0x1d53d8[_0x999e('0x39')]);_0x4e717d['attributes']=_['intersection'](_0x1d53d8['model'],qs[_0x999e('0x3c')](_0x1f90fc[_0x999e('0x39')][_0x999e('0x3c')]));_0x4e717d[_0x999e('0x3d')]=_0x4e717d[_0x999e('0x3d')][_0x999e('0x3e')]?_0x4e717d[_0x999e('0x3d')]:_0x1d53d8[_0x999e('0x38')];if(!_0x1f90fc[_0x999e('0x39')][_0x999e('0x3f')](_0x999e('0x40'))){_0x4e717d[_0x999e('0x28')]=qs[_0x999e('0x28')](_0x1f90fc[_0x999e('0x39')][_0x999e('0x28')]);_0x4e717d[_0x999e('0x27')]=qs[_0x999e('0x27')](_0x1f90fc['query'][_0x999e('0x27')]);}_0x4e717d[_0x999e('0x41')]=qs[_0x999e('0x42')](_0x1f90fc[_0x999e('0x39')][_0x999e('0x42')]);_0x4e717d[_0x999e('0x43')]=qs[_0x999e('0x3b')](_['pick'](_0x1f90fc[_0x999e('0x39')],_0x1d53d8[_0x999e('0x3b')]),_0x210c58);if(_0x1f90fc[_0x999e('0x39')]['filter']){_0x4e717d[_0x999e('0x43')]=_[_0x999e('0x44')](_0x4e717d[_0x999e('0x43')],{'$or':_[_0x999e('0x32')](_0x210c58,function(_0x18969d){if(_0x18969d[_0x999e('0x36')]!==_0x999e('0x45')){var _0xfb243a={};_0xfb243a[_0x18969d[_0x999e('0x30')]]={'$like':'%'+_0x1f90fc['query'][_0x999e('0x46')]+'%'};return _0xfb243a;}})});}_0x4e717d=_[_0x999e('0x44')]({},_0x4e717d,_0x1f90fc[_0x999e('0x47')]);var _0x4f697b={'where':_0x4e717d['where']};return db[_0x999e('0x33')][_0x999e('0x48')](_0x4f697b)[_0x999e('0x19')](function(_0x4d5747){_0x2611fd[_0x999e('0x48')]=_0x4d5747;if(_0x1f90fc[_0x999e('0x39')][_0x999e('0x49')]){_0x4e717d['include']=[{'all':!![]}];}return db[_0x999e('0x33')][_0x999e('0x4a')](_0x4e717d);})[_0x999e('0x19')](function(_0x5cf710){_0x2611fd[_0x999e('0x4b')]=_0x5cf710;return _0x2611fd;})['then'](respondWithFilteredResult(_0x5d2875,_0x4e717d))['catch'](handleError(_0x5d2875,null));};exports[_0x999e('0x4c')]=function(_0x2a5d1e,_0xdb5a5a){var _0x3fe3c9={'raw':![],'where':{'id':_0x2a5d1e[_0x999e('0x4d')]['id']}},_0x2b1296={};_0x2b1296['model']=_[_0x999e('0x3a')](db[_0x999e('0x33')][_0x999e('0x34')]);_0x2b1296['query']=_[_0x999e('0x3a')](_0x2a5d1e[_0x999e('0x39')]);_0x2b1296[_0x999e('0x3b')]=_['intersection'](_0x2b1296[_0x999e('0x38')],_0x2b1296['query']);_0x3fe3c9[_0x999e('0x3d')]=_[_0x999e('0x4e')](_0x2b1296['model'],qs['fields'](_0x2a5d1e[_0x999e('0x39')][_0x999e('0x3c')]));_0x3fe3c9[_0x999e('0x3d')]=_0x3fe3c9[_0x999e('0x3d')]['length']?_0x3fe3c9[_0x999e('0x3d')]:_0x2b1296[_0x999e('0x38')];if(_0x2a5d1e[_0x999e('0x39')][_0x999e('0x49')]){_0x3fe3c9['include']=[{'all':!![]}];}_0x3fe3c9=_[_0x999e('0x44')]({},_0x3fe3c9,_0x2a5d1e['options']);return db[_0x999e('0x33')][_0x999e('0x4f')](_0x3fe3c9)['then'](handleEntityNotFound(_0xdb5a5a,null))[_0x999e('0x19')](respondWithResult(_0xdb5a5a,null))['catch'](handleError(_0xdb5a5a,null));};exports[_0x999e('0x50')]=function(_0xb27f9d,_0x8bc1ff){return db['ServicenowAccount'][_0x999e('0x50')](_0xb27f9d[_0x999e('0x51')],{})[_0x999e('0x19')](respondWithResult(_0x8bc1ff,0xc9))['catch'](handleError(_0x8bc1ff,null));};exports[_0x999e('0x2d')]=function(_0x2bced0,_0x4bbbf9){if(_0x2bced0['body']['id']){delete _0x2bced0[_0x999e('0x51')]['id'];}return db['ServicenowAccount'][_0x999e('0x4f')]({'where':{'id':_0x2bced0[_0x999e('0x4d')]['id']}})[_0x999e('0x19')](handleEntityNotFound(_0x4bbbf9,null))['then'](saveUpdates(_0x2bced0[_0x999e('0x51')],null))[_0x999e('0x19')](respondWithResult(_0x4bbbf9,null))['catch'](handleError(_0x4bbbf9,null));};exports['destroy']=function(_0x57a46c,_0x39a6c3){return db[_0x999e('0x33')][_0x999e('0x4f')]({'where':{'id':_0x57a46c[_0x999e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39a6c3,null))[_0x999e('0x19')](removeEntity(_0x39a6c3,null))[_0x999e('0x23')](handleError(_0x39a6c3,null));};exports['getConfigurations']=function(_0x5f428e,_0x5417cc,_0x313f5f){var _0x2d5697={};var _0x387556={};var _0x2b9014;var _0x8d5690;return db[_0x999e('0x33')][_0x999e('0x52')]({'where':{'id':_0x5f428e[_0x999e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5417cc,null))[_0x999e('0x19')](function(_0x4fbd14){if(_0x4fbd14){_0x2b9014=_0x4fbd14;_0x387556[_0x999e('0x38')]=_[_0x999e('0x3a')](db[_0x999e('0x53')][_0x999e('0x34')]);_0x387556[_0x999e('0x39')]=_[_0x999e('0x3a')](_0x5f428e[_0x999e('0x39')]);_0x387556[_0x999e('0x3b')]=_[_0x999e('0x4e')](_0x387556[_0x999e('0x38')],_0x387556[_0x999e('0x39')]);_0x2d5697[_0x999e('0x3d')]=_[_0x999e('0x4e')](_0x387556[_0x999e('0x38')],qs['fields'](_0x5f428e['query'][_0x999e('0x3c')]));_0x2d5697[_0x999e('0x3d')]=_0x2d5697[_0x999e('0x3d')][_0x999e('0x3e')]?_0x2d5697['attributes']:_0x387556['model'];_0x2d5697[_0x999e('0x41')]=qs[_0x999e('0x42')](_0x5f428e[_0x999e('0x39')][_0x999e('0x42')]);_0x2d5697[_0x999e('0x43')]=qs[_0x999e('0x3b')](_[_0x999e('0x54')](_0x5f428e['query'],_0x387556[_0x999e('0x3b')]));if(_0x5f428e[_0x999e('0x39')]['filter']){_0x2d5697[_0x999e('0x43')]=_['merge'](_0x2d5697[_0x999e('0x43')],{'$or':_[_0x999e('0x32')](_0x2d5697[_0x999e('0x3d')],function(_0x4df635){var _0x4e0d70={};_0x4e0d70[_0x4df635]={'$like':'%'+_0x5f428e['query'][_0x999e('0x46')]+'%'};return _0x4e0d70;})});}_0x2d5697=_[_0x999e('0x44')]({},_0x2d5697,_0x5f428e[_0x999e('0x47')]);return _0x2b9014[_0x999e('0x55')](_0x2d5697);}})[_0x999e('0x19')](function(_0x4ce499){if(_0x4ce499){_0x8d5690=_0x4ce499['length'];if(!_0x5f428e[_0x999e('0x39')][_0x999e('0x3f')](_0x999e('0x40'))){_0x2d5697[_0x999e('0x28')]=qs['limit'](_0x5f428e[_0x999e('0x39')][_0x999e('0x28')]);_0x2d5697['offset']=qs['offset'](_0x5f428e['query'][_0x999e('0x27')]);}return _0x2b9014[_0x999e('0x55')](_0x2d5697);}})['then'](function(_0x72ff12){if(_0x72ff12){return _0x72ff12?{'count':_0x8d5690,'rows':_0x72ff12}:null;}})[_0x999e('0x19')](respondWithResult(_0x5417cc,null))['catch'](handleError(_0x5417cc,null));};exports[_0x999e('0x56')]=function(_0x53a98c,_0x34f993,_0x3fd9b4){if(_0x53a98c['body']['id']){delete _0x53a98c[_0x999e('0x51')]['id'];}return db[_0x999e('0x33')]['findOne']({'where':{'id':_0x53a98c[_0x999e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34f993,null))[_0x999e('0x19')](function(_0x5ce398){if(_0x5ce398){_0x53a98c[_0x999e('0x51')]['AccountId']=_0x5ce398['id'];_0x53a98c[_0x999e('0x51')][_0x999e('0x57')]=integrations[_0x999e('0x58')](_0x53a98c[_0x999e('0x51')][_0x999e('0x59')],_0x53a98c['body']['type']);_0x53a98c[_0x999e('0x51')][_0x999e('0x5a')]=integrations[_0x999e('0x5b')](_0x53a98c['body']['channel'],_0x53a98c[_0x999e('0x51')]['type']);return db[_0x999e('0x53')]['create'](_0x53a98c[_0x999e('0x51')],{'include':[{'model':db['ServicenowField'],'as':_0x999e('0x57')},{'model':db['ServicenowField'],'as':_0x999e('0x5a')}]});}return null;})[_0x999e('0x19')](respondWithResult(_0x34f993,null))[_0x999e('0x23')](handleError(_0x34f993,null));};exports[_0x999e('0x5c')]=function(_0x48ef0d,_0x4a1156,_0x3624b8){var _0x27050d=['made_sla',_0x999e('0x5d'),'knowledge',_0x999e('0x5e'),_0x999e('0x5f'),_0x999e('0x60'),_0x999e('0x61'),_0x999e('0x62'),_0x999e('0x63')];var _0x12d537=[_0x999e('0x64'),'made_sla',_0x999e('0x65'),_0x999e('0x66'),_0x999e('0x67'),_0x999e('0x68'),_0x999e('0x69'),_0x999e('0x5d'),'approval_history','number',_0x999e('0x6a'),_0x999e('0x6b'),_0x999e('0x6c'),_0x999e('0x6d'),_0x999e('0x6e'),_0x999e('0x6f'),_0x999e('0x70'),_0x999e('0x71'),_0x999e('0x72'),_0x999e('0x41'),_0x999e('0x73'),_0x999e('0x74'),_0x999e('0x75'),_0x999e('0x76'),_0x999e('0x77'),'active',_0x999e('0x78'),_0x999e('0x79'),_0x999e('0x7a'),_0x999e('0x7b'),_0x999e('0x7c'),_0x999e('0x7d'),_0x999e('0x7e'),_0x999e('0x7f'),_0x999e('0x80'),_0x999e('0x81'),_0x999e('0x82'),_0x999e('0x83'),_0x999e('0x84'),_0x999e('0x85'),'approval_set',_0x999e('0x5e'),_0x999e('0x86'),_0x999e('0x87'),_0x999e('0x5f'),_0x999e('0x88'),'delivery_task',_0x999e('0x89'),_0x999e('0x8a'),_0x999e('0x8b'),'additional_assignee_list',_0x999e('0x8c'),_0x999e('0x8d'),_0x999e('0x60'),_0x999e('0x8e'),_0x999e('0x8f'),_0x999e('0x90'),'follow_up','parent_incident',_0x999e('0x91'),_0x999e('0x92'),'reopened_by',_0x999e('0x61'),_0x999e('0x93'),_0x999e('0x94'),_0x999e('0x95'),'reassignment_count',_0x999e('0x96'),_0x999e('0x97'),_0x999e('0x62'),_0x999e('0x98'),_0x999e('0x99'),_0x999e('0x9a'),_0x999e('0x9b'),_0x999e('0x9c'),'sys_mod_count',_0x999e('0x9d'),_0x999e('0x9e'),'escalation',_0x999e('0x9f'),_0x999e('0xa0'),_0x999e('0xa1'),_0x999e('0x63')];var _0x118bab='';var _0x33e647='';var _0x25ff42=[];var _0x25e517='';var _0x1342f5='';var _0x3ecabf=[];var _0xfd0835='';var _0x43668e='';var _0x1f6cb3={};var _0x23d41b='';return db[_0x999e('0x33')][_0x999e('0x52')]({'where':{'id':_0x48ef0d[_0x999e('0x4d')]['id']},'attributes':['id','username','password',_0x999e('0xa2'),_0x999e('0xa3'),_0x999e('0xa4')]})[_0x999e('0x19')](handleEntityNotFound(_0x4a1156,null))['then'](function(_0x294ff3){if(_0x294ff3){_0x23d41b=_0x294ff3[_0x999e('0xa3')];var _0x2bfc1b=_0x23d41b['slice'](-0x1);if(_0x2bfc1b==='/'){_0x23d41b=_0x23d41b[_0x999e('0xa5')](0x0,_0x23d41b[_0x999e('0xa6')](_0x2bfc1b));}_0x43668e=util[_0x999e('0xa7')](_0x999e('0xa8'),_0x23d41b);_0xfd0835=util[_0x999e('0xa7')](_0x999e('0xa9'),_0x23d41b);_0x1f6cb3={'user':_0x294ff3[_0x999e('0xaa')],'pass':_0x294ff3[_0x999e('0xab')]};var _0x25150b={'method':_0x999e('0xac'),'uri':_0x43668e+_0x999e('0xad'),'auth':_0x1f6cb3,'json':!![]};return rp(_0x25150b);}})[_0x999e('0x19')](function(_0xc50d7a){if(_0xc50d7a[_0x999e('0x22')][_0x999e('0x3e')]>0x0){_0x118bab=_0xc50d7a[_0x999e('0x22')];}console[_0x999e('0xae')](_0x999e('0xaf'),_0x118bab);_0x3ecabf=[];_0x33e647=Object[_0x999e('0xb0')]([],_0x118bab);_['remove'](_0x33e647,function(_0x2cd8c0){return!_0x27050d[_0x999e('0xb1')](_0x2cd8c0['name']);});_0x33e647[_0x999e('0xb2')](function(_0x5a4ddc){var _0x1758f3=createFieldObject(_0xfd0835,_0x1f6cb3,_0x5a4ddc[_0x999e('0xb3')],_0x5a4ddc[_0x999e('0x30')],_0x5a4ddc[_0x999e('0xb4')],![]);_0x3ecabf[_0x999e('0xb5')](_0x1758f3);});return Promise[_0x999e('0xb6')](_0x3ecabf);})[_0x999e('0x19')](function(_0x3b6f0f){_0x25ff42=_0x3b6f0f;_0x25e517=Object['assign']([],_0x118bab);console['log'](_0x999e('0xb7'),_0x118bab);_[_0x999e('0xb8')](_0x25e517,function(_0x15656d){return _0x12d537[_0x999e('0xb1')](_0x15656d['name']);});console[_0x999e('0xae')](_0x999e('0xb9'),_0x25e517);_0x3ecabf=[];_0x25e517['forEach'](function(_0x20ed50){var _0x41b524=createFieldObject(_0xfd0835,_0x1f6cb3,_0x20ed50[_0x999e('0xb3')],_0x20ed50[_0x999e('0x30')],_0x20ed50[_0x999e('0xb4')],!![]);_0x3ecabf[_0x999e('0xb5')](_0x41b524);});return Promise[_0x999e('0xb6')](_0x3ecabf);})[_0x999e('0x19')](function(_0x50d71f){_0x1342f5=_0x50d71f;var _0x3ebe3d=_0x25ff42['concat'](_0x1342f5);return{'count':_0x3ebe3d['length'],'rows':_0x3ebe3d};})[_0x999e('0x19')](respondWithResult(_0x4a1156,null))[_0x999e('0x23')](function(_0x3d8810){console['log'](_0x999e('0xba')+_0x3d8810);var _0x19a541=_0x48ef0d[_0x999e('0x39')][_0x999e('0x15')]?0x1f4:_0x3d8810[_0x999e('0xbb')]||0x1f4;logger[_0x999e('0x1e')](_0x3d8810[_0x999e('0xbc')]);delete _0x3d8810[_0x999e('0x30')];if(_0x19a541===0x191){_0x19a541=0x190;}_0x4a1156[_0x999e('0x24')](_0x19a541)[_0x999e('0xbd')](_0x48ef0d[_0x999e('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3d8810['statusCode']}:_0x3d8810);});};function createFieldObject(_0x36757f,_0x15b816,_0x43608d,_0x3189e4,_0x3f55c1,_0x4658a5){return new Promise(function(_0x36cb47,_0x42d239){var _0x41f9fa={'id':_0x3189e4,'name':_0x3f55c1,'custom':_0x4658a5};if(_0x43608d===_0x999e('0xbe')){_0x41f9fa['options']=[{'name':_0x999e('0xbf'),'value':_0x999e('0xc0')},{'name':_0x999e('0xc1'),'value':'false'}];_0x36cb47(_0x41f9fa);}else{var _0x151efe={'method':_0x999e('0xac'),'uri':_0x36757f+'sys_choice?sysparm_query=name=incident^element='+_0x3189e4,'auth':_0x15b816,'json':!![]};return rp(_0x151efe)[_0x999e('0x19')](function(_0x2646e9){var _0x31a22e=[];if(_0x2646e9['result'][_0x999e('0x3e')]>0x0){_0x2646e9[_0x999e('0x22')]['forEach'](function(_0x37213e){if(_0x37213e[_0x999e('0xc2')]===_0x999e('0xc3')){var _0x135bcd={'name':_0x37213e[_0x999e('0xb4')],'value':_0x37213e[_0x999e('0xc4')]};_0x31a22e[_0x999e('0xb5')](_0x135bcd);}});}_0x41f9fa[_0x999e('0x47')]=_0x31a22e;if(_0x41f9fa[_0x999e('0x47')][_0x999e('0x3e')]>0x0){_0x36cb47(_0x41f9fa);}else{if(_0x4658a5==![]){_0x36cb47();}else{_0x36cb47(_0x41f9fa);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0486c91..13832bf 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 _0xa376=['request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','ServicenowAccount','../../config/logger','api','bluebird'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0xa376,0x14a));var _0x6a37=function(_0x2af4bf,_0x2df7cd){_0x2af4bf=_0x2af4bf-0x0;var _0xdc9c8e=_0xa376[_0x2af4bf];return _0xdc9c8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a37('0x0'))(_0x6a37('0x1'));var moment=require('moment');var BPromise=require(_0x6a37('0x2'));var rp=require(_0x6a37('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a37('0x4'));var config=require(_0x6a37('0x5'));var attributes=require(_0x6a37('0x6'));var integrations=require(_0x6a37('0x7'));module['exports']=function(_0x5ed3ac,_0x1b845d){return _0x5ed3ac['define'](_0x6a37('0x8'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef8=['../../components/integrations/configuration','define','ServicenowAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x30aa39,_0x18b317){var _0x47bab8=function(_0x313786){while(--_0x313786){_0x30aa39['push'](_0x30aa39['shift']());}};_0x47bab8(++_0x18b317);}(_0x7ef8,0x123));var _0x87ef=function(_0x3014a4,_0x56b5aa){_0x3014a4=_0x3014a4-0x0;var _0x4ff3da=_0x7ef8[_0x3014a4];return _0x4ff3da;};'use strict';var _=require(_0x87ef('0x0'));var util=require(_0x87ef('0x1'));var logger=require(_0x87ef('0x2'))(_0x87ef('0x3'));var moment=require('moment');var BPromise=require(_0x87ef('0x4'));var rp=require(_0x87ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87ef('0x6'));var config=require(_0x87ef('0x7'));var attributes=require(_0x87ef('0x8'));var integrations=require(_0x87ef('0x9'));module['exports']=function(_0xc71a0f,_0x2a1825){return _0xc71a0f[_0x87ef('0xa')](_0x87ef('0xb'),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 a8da7f4..0aea3b6 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 _0xd0c9=['jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','include','map','model','attributes','ShowServicenowAccount','find','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x90468a,_0x51af79){var _0x310b8e=function(_0x39dcdf){while(--_0x39dcdf){_0x90468a['push'](_0x90468a['shift']());}};_0x310b8e(++_0x51af79);}(_0xd0c9,0x80));var _0x9d0c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd0c9[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x9d0c('0x0'));var util=require(_0x9d0c('0x1'));var moment=require('moment');var BPromise=require(_0x9d0c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d0c('0x3'));var db=require(_0x9d0c('0x4'))['db'];var utils=require(_0x9d0c('0x5'));var logger=require(_0x9d0c('0x6'))('rpc');var config=require(_0x9d0c('0x7'));var jayson=require(_0x9d0c('0x8'));var client=jayson[_0x9d0c('0x9')][_0x9d0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x810d1e,_0x258814,_0x2aafc9){return new BPromise(function(_0x43ace6,_0x489a10){return client[_0x9d0c('0xb')](_0x810d1e,_0x2aafc9)[_0x9d0c('0xc')](function(_0x128189){logger[_0x9d0c('0xd')](_0x9d0c('0xe'),_0x258814,_0x9d0c('0xf'));logger['debug'](_0x9d0c('0x10'),_0x258814,_0x9d0c('0xf'),JSON[_0x9d0c('0x11')](_0x128189));if(_0x128189[_0x9d0c('0x12')]){if(_0x128189[_0x9d0c('0x12')]['code']===0x1f4){logger[_0x9d0c('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x258814,_0x128189[_0x9d0c('0x12')][_0x9d0c('0x13')]);return _0x489a10(_0x128189[_0x9d0c('0x12')]['message']);}logger[_0x9d0c('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x258814,_0x128189[_0x9d0c('0x12')][_0x9d0c('0x13')]);return _0x43ace6(_0x128189[_0x9d0c('0x12')][_0x9d0c('0x13')]);}else{logger['info'](_0x9d0c('0xe'),_0x258814,'request\x20sent');_0x43ace6(_0x128189['result'][_0x9d0c('0x13')]);}})[_0x9d0c('0x14')](function(_0x497431){logger['error'](_0x9d0c('0xe'),_0x258814,_0x497431);_0x489a10(_0x497431);});});}exports[_0x9d0c('0x15')]=function(_0x36da41){var _0x41d65d=this;return new Promise(function(_0x563d4c,_0x53fccb){return db[_0x9d0c('0x16')][_0x9d0c('0x17')]({'raw':_0x36da41[_0x9d0c('0x18')]?_0x36da41[_0x9d0c('0x18')][_0x9d0c('0x19')]===undefined?!![]:![]:!![],'where':_0x36da41['options']?_0x36da41['options'][_0x9d0c('0x1a')]||null:null,'attributes':_0x36da41[_0x9d0c('0x18')]?_0x36da41[_0x9d0c('0x18')]['attributes']||null:null,'limit':_0x36da41['options']?_0x36da41[_0x9d0c('0x18')]['limit']||null:null,'include':_0x36da41[_0x9d0c('0x18')]?_0x36da41[_0x9d0c('0x18')][_0x9d0c('0x1b')]?_[_0x9d0c('0x1c')](_0x36da41['options'][_0x9d0c('0x1b')],function(_0x90adc1){return{'model':db[_0x90adc1[_0x9d0c('0x1d')]],'as':_0x90adc1['as'],'attributes':_0x90adc1[_0x9d0c('0x1e')],'include':_0x90adc1['include']?_[_0x9d0c('0x1c')](_0x90adc1[_0x9d0c('0x1b')],function(_0x499aa1){return{'model':db[_0x499aa1[_0x9d0c('0x1d')]],'as':_0x499aa1['as'],'attributes':_0x499aa1[_0x9d0c('0x1e')],'include':_0x499aa1[_0x9d0c('0x1b')]?_['map'](_0x499aa1['include'],function(_0x4d1b0a){return{'model':db[_0x4d1b0a[_0x9d0c('0x1d')]],'as':_0x4d1b0a['as'],'attributes':_0x4d1b0a[_0x9d0c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9d0c('0xc')](function(_0x247b30){logger[_0x9d0c('0xd')](_0x9d0c('0x15'),_0x36da41);logger['debug'](_0x9d0c('0x15'),_0x36da41,JSON[_0x9d0c('0x11')](_0x247b30));_0x563d4c(_0x247b30);})['catch'](function(_0x2ba363){logger[_0x9d0c('0x12')](_0x9d0c('0x15'),_0x2ba363[_0x9d0c('0x13')],_0x36da41);_0x53fccb(_0x41d65d[_0x9d0c('0x12')](0x1f4,_0x2ba363[_0x9d0c('0x13')]));});});};exports[_0x9d0c('0x1f')]=function(_0x2807e3){var _0x4f980c=this;return new Promise(function(_0x11261e,_0x8164dc){return db[_0x9d0c('0x16')][_0x9d0c('0x20')]({'raw':_0x2807e3[_0x9d0c('0x18')]?_0x2807e3[_0x9d0c('0x18')][_0x9d0c('0x19')]===undefined?!![]:![]:!![],'where':_0x2807e3[_0x9d0c('0x18')]?_0x2807e3[_0x9d0c('0x18')][_0x9d0c('0x1a')]||null:null,'attributes':_0x2807e3[_0x9d0c('0x18')]?_0x2807e3['options'][_0x9d0c('0x1e')]||null:null,'include':_0x2807e3[_0x9d0c('0x18')]?_0x2807e3['options'][_0x9d0c('0x1b')]?_[_0x9d0c('0x1c')](_0x2807e3[_0x9d0c('0x18')][_0x9d0c('0x1b')],function(_0x2bf385){return{'model':db[_0x2bf385[_0x9d0c('0x1d')]],'as':_0x2bf385['as'],'attributes':_0x2bf385[_0x9d0c('0x1e')],'include':_0x2bf385[_0x9d0c('0x1b')]?_[_0x9d0c('0x1c')](_0x2bf385['include'],function(_0x5e118d){return{'model':db[_0x5e118d[_0x9d0c('0x1d')]],'as':_0x5e118d['as'],'attributes':_0x5e118d['attributes'],'include':_0x5e118d['include']?_[_0x9d0c('0x1c')](_0x5e118d[_0x9d0c('0x1b')],function(_0x5765c5){return{'model':db[_0x5765c5['model']],'as':_0x5765c5['as'],'attributes':_0x5765c5[_0x9d0c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9d0c('0xc')](function(_0x17742d){logger['info']('ShowServicenowAccount',_0x2807e3);logger[_0x9d0c('0x21')](_0x9d0c('0x1f'),_0x2807e3,JSON['stringify'](_0x17742d));_0x11261e(_0x17742d);})[_0x9d0c('0x14')](function(_0x23e29f){logger['error'](_0x9d0c('0x1f'),_0x23e29f[_0x9d0c('0x13')],_0x2807e3);_0x8164dc(_0x4f980c['error'](0x1f4,_0x23e29f[_0x9d0c('0x13')]));});});}; \ No newline at end of file +var _0x7d91=['jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','ServicenowAccount','raw','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3edb0b,_0xb5450e){var _0x4107d9=function(_0x14d3d6){while(--_0x14d3d6){_0x3edb0b['push'](_0x3edb0b['shift']());}};_0x4107d9(++_0xb5450e);}(_0x7d91,0x87));var _0x17d9=function(_0x1fae3c,_0x41a75c){_0x1fae3c=_0x1fae3c-0x0;var _0x384ddf=_0x7d91[_0x1fae3c];return _0x384ddf;};'use strict';var _=require(_0x17d9('0x0'));var util=require(_0x17d9('0x1'));var moment=require('moment');var BPromise=require(_0x17d9('0x2'));var rs=require(_0x17d9('0x3'));var fs=require('fs');var Redis=require(_0x17d9('0x4'));var db=require(_0x17d9('0x5'))['db'];var utils=require(_0x17d9('0x6'));var logger=require(_0x17d9('0x7'))(_0x17d9('0x8'));var config=require('../../config/environment');var jayson=require(_0x17d9('0x9'));var client=jayson[_0x17d9('0xa')][_0x17d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b3606,_0x21d8fd,_0x1942ba){return new BPromise(function(_0x1806f3,_0x2c6b45){return client[_0x17d9('0xc')](_0x1b3606,_0x1942ba)[_0x17d9('0xd')](function(_0x26c66b){logger[_0x17d9('0xe')](_0x17d9('0xf'),_0x21d8fd,_0x17d9('0x10'));logger[_0x17d9('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x21d8fd,'request\x20sent',JSON[_0x17d9('0x12')](_0x26c66b));if(_0x26c66b['error']){if(_0x26c66b[_0x17d9('0x13')][_0x17d9('0x14')]===0x1f4){logger[_0x17d9('0x13')](_0x17d9('0xf'),_0x21d8fd,_0x26c66b['error']['message']);return _0x2c6b45(_0x26c66b[_0x17d9('0x13')][_0x17d9('0x15')]);}logger[_0x17d9('0x13')](_0x17d9('0xf'),_0x21d8fd,_0x26c66b['error'][_0x17d9('0x15')]);return _0x1806f3(_0x26c66b[_0x17d9('0x13')]['message']);}else{logger[_0x17d9('0xe')](_0x17d9('0xf'),_0x21d8fd,_0x17d9('0x10'));_0x1806f3(_0x26c66b[_0x17d9('0x16')][_0x17d9('0x15')]);}})[_0x17d9('0x17')](function(_0x519b5f){logger[_0x17d9('0x13')](_0x17d9('0xf'),_0x21d8fd,_0x519b5f);_0x2c6b45(_0x519b5f);});});}exports['GetServicenowAccount']=function(_0x34750f){var _0x2fa015=this;return new Promise(function(_0x31590a,_0x1f7b71){return db['ServicenowAccount'][_0x17d9('0x18')]({'raw':_0x34750f[_0x17d9('0x19')]?_0x34750f['options']['raw']===undefined?!![]:![]:!![],'where':_0x34750f[_0x17d9('0x19')]?_0x34750f[_0x17d9('0x19')]['where']||null:null,'attributes':_0x34750f[_0x17d9('0x19')]?_0x34750f[_0x17d9('0x19')][_0x17d9('0x1a')]||null:null,'limit':_0x34750f[_0x17d9('0x19')]?_0x34750f[_0x17d9('0x19')][_0x17d9('0x1b')]||null:null,'include':_0x34750f['options']?_0x34750f[_0x17d9('0x19')][_0x17d9('0x1c')]?_[_0x17d9('0x1d')](_0x34750f[_0x17d9('0x19')][_0x17d9('0x1c')],function(_0x1974fb){return{'model':db[_0x1974fb[_0x17d9('0x1e')]],'as':_0x1974fb['as'],'attributes':_0x1974fb[_0x17d9('0x1a')],'include':_0x1974fb[_0x17d9('0x1c')]?_[_0x17d9('0x1d')](_0x1974fb[_0x17d9('0x1c')],function(_0x4e538b){return{'model':db[_0x4e538b[_0x17d9('0x1e')]],'as':_0x4e538b['as'],'attributes':_0x4e538b[_0x17d9('0x1a')],'include':_0x4e538b['include']?_[_0x17d9('0x1d')](_0x4e538b['include'],function(_0x3ad927){return{'model':db[_0x3ad927[_0x17d9('0x1e')]],'as':_0x3ad927['as'],'attributes':_0x3ad927[_0x17d9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x17d9('0xd')](function(_0x345d77){logger[_0x17d9('0xe')]('GetServicenowAccount',_0x34750f);logger[_0x17d9('0x11')](_0x17d9('0x1f'),_0x34750f,JSON[_0x17d9('0x12')](_0x345d77));_0x31590a(_0x345d77);})[_0x17d9('0x17')](function(_0x21eb29){logger['error'](_0x17d9('0x1f'),_0x21eb29['message'],_0x34750f);_0x1f7b71(_0x2fa015[_0x17d9('0x13')](0x1f4,_0x21eb29[_0x17d9('0x15')]));});});};exports[_0x17d9('0x20')]=function(_0x230725){var _0x539dd0=this;return new Promise(function(_0x26f77f,_0x1c97aa){return db[_0x17d9('0x21')]['find']({'raw':_0x230725['options']?_0x230725[_0x17d9('0x19')][_0x17d9('0x22')]===undefined?!![]:![]:!![],'where':_0x230725[_0x17d9('0x19')]?_0x230725[_0x17d9('0x19')][_0x17d9('0x23')]||null:null,'attributes':_0x230725[_0x17d9('0x19')]?_0x230725[_0x17d9('0x19')][_0x17d9('0x1a')]||null:null,'include':_0x230725[_0x17d9('0x19')]?_0x230725['options']['include']?_[_0x17d9('0x1d')](_0x230725[_0x17d9('0x19')][_0x17d9('0x1c')],function(_0x3c8b82){return{'model':db[_0x3c8b82[_0x17d9('0x1e')]],'as':_0x3c8b82['as'],'attributes':_0x3c8b82[_0x17d9('0x1a')],'include':_0x3c8b82[_0x17d9('0x1c')]?_[_0x17d9('0x1d')](_0x3c8b82['include'],function(_0x36a029){return{'model':db[_0x36a029[_0x17d9('0x1e')]],'as':_0x36a029['as'],'attributes':_0x36a029[_0x17d9('0x1a')],'include':_0x36a029[_0x17d9('0x1c')]?_[_0x17d9('0x1d')](_0x36a029[_0x17d9('0x1c')],function(_0x1662a3){return{'model':db[_0x1662a3['model']],'as':_0x1662a3['as'],'attributes':_0x1662a3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x505445){logger[_0x17d9('0xe')](_0x17d9('0x20'),_0x230725);logger[_0x17d9('0x11')](_0x17d9('0x20'),_0x230725,JSON[_0x17d9('0x12')](_0x505445));_0x26f77f(_0x505445);})[_0x17d9('0x17')](function(_0x1b1925){logger[_0x17d9('0x13')]('ShowServicenowAccount',_0x1b1925[_0x17d9('0x15')],_0x230725);_0x1c97aa(_0x539dd0['error'](0x1f4,_0x1b1925[_0x17d9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ab735bf..39508bd 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 _0x3e48=['delete','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put'];(function(_0x5b2995,_0xbc08cf){var _0x6cf6e1=function(_0x5ae844){while(--_0x5ae844){_0x5b2995['push'](_0x5b2995['shift']());}};_0x6cf6e1(++_0xbc08cf);}(_0x3e48,0x155));var _0x83e4=function(_0x43a62d,_0x2a2834){_0x43a62d=_0x43a62d-0x0;var _0x5873f2=_0x3e48[_0x43a62d];return _0x5873f2;};'use strict';var multer=require(_0x83e4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x83e4('0x1'));var express=require(_0x83e4('0x2'));var router=express['Router']();var auth=require(_0x83e4('0x3'));var interaction=require(_0x83e4('0x4'));var config=require(_0x83e4('0x5'));var controller=require(_0x83e4('0x6'));router[_0x83e4('0x7')]('/',auth[_0x83e4('0x8')](),controller[_0x83e4('0x9')]);router[_0x83e4('0x7')](_0x83e4('0xa'),auth[_0x83e4('0x8')](),controller[_0x83e4('0xb')]);router[_0x83e4('0x7')](_0x83e4('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x83e4('0x7')](_0x83e4('0xd'),auth['isAuthenticated'](),controller[_0x83e4('0xe')]);router[_0x83e4('0x7')](_0x83e4('0xf'),auth[_0x83e4('0x8')](),controller['getDescriptions']);router[_0x83e4('0x10')]('/',auth['isAuthenticated'](),controller[_0x83e4('0x11')]);router[_0x83e4('0x12')](_0x83e4('0xa'),auth[_0x83e4('0x8')](),controller['update']);router[_0x83e4('0x13')]('/:id',auth[_0x83e4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcf34=['../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x32d002,_0x40d845){var _0x4208bf=function(_0x25693f){while(--_0x25693f){_0x32d002['push'](_0x32d002['shift']());}};_0x4208bf(++_0x40d845);}(_0xcf34,0xbb));var _0x4cf3=function(_0xf74372,_0x51fe82){_0xf74372=_0xf74372-0x0;var _0x36bb65=_0xcf34[_0xf74372];return _0x36bb65;};'use strict';var multer=require(_0x4cf3('0x0'));var util=require(_0x4cf3('0x1'));var path=require('path');var timeout=require(_0x4cf3('0x2'));var express=require(_0x4cf3('0x3'));var router=express[_0x4cf3('0x4')]();var auth=require(_0x4cf3('0x5'));var interaction=require(_0x4cf3('0x6'));var config=require('../../config/environment');var controller=require(_0x4cf3('0x7'));router[_0x4cf3('0x8')]('/',auth[_0x4cf3('0x9')](),controller[_0x4cf3('0xa')]);router[_0x4cf3('0x8')]('/:id',auth[_0x4cf3('0x9')](),controller[_0x4cf3('0xb')]);router['get'](_0x4cf3('0xc'),auth['isAuthenticated'](),controller[_0x4cf3('0xd')]);router[_0x4cf3('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x4cf3('0xe')]);router[_0x4cf3('0x8')](_0x4cf3('0xf'),auth[_0x4cf3('0x9')](),controller[_0x4cf3('0x10')]);router[_0x4cf3('0x11')]('/',auth[_0x4cf3('0x9')](),controller[_0x4cf3('0x12')]);router[_0x4cf3('0x13')](_0x4cf3('0x14'),auth[_0x4cf3('0x9')](),controller[_0x4cf3('0x15')]);router[_0x4cf3('0x16')]('/:id',auth[_0x4cf3('0x9')](),controller['destroy']);module[_0x4cf3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2dee6f1..c7bba50 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 _0x557a=['exports','STRING'];(function(_0x52a057,_0x570e83){var _0x24769f=function(_0x411022){while(--_0x411022){_0x52a057['push'](_0x52a057['shift']());}};_0x24769f(++_0x570e83);}(_0x557a,0x7a));var _0xa557=function(_0x217394,_0x4eb1bf){_0x217394=_0x217394-0x0;var _0x28ffd4=_0x557a[_0x217394];return _0x28ffd4;};'use strict';var Sequelize=require('sequelize');module[_0xa557('0x0')]={'name':{'type':Sequelize[_0xa557('0x1')]},'description':{'type':Sequelize[_0xa557('0x1')]}}; \ No newline at end of file +var _0x0c99=['exports','STRING','sequelize'];(function(_0x435805,_0x297260){var _0x4ddd9b=function(_0x19dea9){while(--_0x19dea9){_0x435805['push'](_0x435805['shift']());}};_0x4ddd9b(++_0x297260);}(_0x0c99,0xcb));var _0x90c9=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0x0c99[_0x52e0ee];return _0x32534c;};'use strict';var Sequelize=require(_0x90c9('0x0'));module[_0x90c9('0x1')]={'name':{'type':Sequelize[_0x90c9('0x2')]},'description':{'type':Sequelize[_0x90c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index cfd9c33..2fcb16a 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 _0x6cb4=['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','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','ServicenowConfiguration','options','body','find','findOne','ServicenowField','length','map','hasOwnProperty','getFields','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','jayson/promise','client'];(function(_0x3dbd6d,_0x3ee9d7){var _0x1216f1=function(_0x27b7ad){while(--_0x27b7ad){_0x3dbd6d['push'](_0x3dbd6d['shift']());}};_0x1216f1(++_0x3ee9d7);}(_0x6cb4,0xff));var _0x46cb=function(_0x4946b3,_0x32f3f4){_0x4946b3=_0x4946b3-0x0;var _0x50f56d=_0x6cb4[_0x4946b3];return _0x50f56d;};'use strict';var pdf=require(_0x46cb('0x0'));var emlformat=require(_0x46cb('0x1'));var rimraf=require(_0x46cb('0x2'));var zipdir=require(_0x46cb('0x3'));var jsonpatch=require(_0x46cb('0x4'));var rp=require(_0x46cb('0x5'));var moment=require(_0x46cb('0x6'));var BPromise=require(_0x46cb('0x7'));var Mustache=require(_0x46cb('0x8'));var util=require('util');var path=require(_0x46cb('0x9'));var sox=require('sox');var csv=require(_0x46cb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0xa'));var querystring=require('querystring');var Papa=require(_0x46cb('0x10'));var Redis=require(_0x46cb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x12'));var as=require(_0x46cb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x14'))(_0x46cb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x46cb('0x16'));var client=jayson[_0x46cb('0x17')][_0x46cb('0x18')]({'port':0x232a});function checkPasswordPattern(_0xf22158,_0x553440,_0x8497cd){if(_0x8497cd){var _0x2ad351=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ad351[_0x46cb('0x19')](_0x553440)){return _0xf22158;}else{throw new db[(_0x46cb('0x1a'))][(_0x46cb('0x1b'))](_0x46cb('0x1c'));}}else{return _0xf22158;}}function respondWithRpcPromise(_0x3d2557,_0x3c396b,_0x37d368,_0x41e398){return new BPromise(function(_0x136215,_0x5cdb4b){var _0x3da031=_0x41e398||client;return _0x3da031['request'](_0x3d2557,_0x37d368)[_0x46cb('0x1d')](function(_0x4ab22b){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x3c396b,_0x46cb('0x1e'));logger[_0x46cb('0x1f')](_0x46cb('0x20'),_0x3c396b,_0x46cb('0x1e'),JSON[_0x46cb('0x21')](_0x4ab22b));if(_0x4ab22b[_0x46cb('0x22')]){if(_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x23')]===0x1f4){logger[_0x46cb('0x22')](_0x46cb('0x24'),_0x3c396b,_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x25')]);return _0x5cdb4b(_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x25')]);}logger[_0x46cb('0x22')](_0x46cb('0x24'),_0x3c396b,_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x25')]);return _0x136215(_0x4ab22b[_0x46cb('0x22')][_0x46cb('0x25')]);}else{logger[_0x46cb('0x26')](_0x46cb('0x24'),_0x3c396b,_0x46cb('0x1e'));_0x136215(_0x4ab22b[_0x46cb('0x27')][_0x46cb('0x25')]);}})['catch'](function(_0x4d663e){logger[_0x46cb('0x22')](_0x46cb('0x24'),_0x3c396b,_0x4d663e);_0x5cdb4b(_0x4d663e);});});}function respondWithStatusCode(_0x2711ac,_0xe078a8){_0xe078a8=_0xe078a8||0xcc;return function(_0x6e6d9){if(_0x6e6d9){return _0x2711ac['sendStatus'](_0xe078a8);}return _0x2711ac[_0x46cb('0x28')](_0xe078a8)['end']();};}function respondWithResult(_0x495886,_0x544465){_0x544465=_0x544465||0xc8;return function(_0x180ce1){if(_0x180ce1){return _0x495886[_0x46cb('0x28')](_0x544465)[_0x46cb('0x29')](_0x180ce1);}};}function respondWithFilteredResult(_0xc1efd3,_0x7cd177){return function(_0x33218b){if(_0x33218b){var _0x378dc7=_0x33218b[_0x46cb('0x2a')],_0x8c65b2=_0x7cd177['offset'],_0x2b846a=_0x7cd177[_0x46cb('0x2b')]+_0x7cd177[_0x46cb('0x2c')],_0x12e01e;if(_0x2b846a>=_0x378dc7){_0x2b846a=_0x378dc7;_0x12e01e=0xc8;}else{_0x12e01e=0xce;}_0xc1efd3['status'](_0x12e01e);return _0xc1efd3['set'](_0x46cb('0x2d'),_0x8c65b2+'-'+_0x2b846a+'/'+_0x378dc7)['json'](_0x33218b);}return null;};}function patchUpdates(_0x27c22d){return function(_0x6f7953){try{jsonpatch[_0x46cb('0x2e')](_0x6f7953,_0x27c22d,!![]);}catch(_0xd96713){return BPromise[_0x46cb('0x2f')](_0xd96713);}return _0x6f7953[_0x46cb('0x30')]();};}function saveUpdates(_0x5dc551,_0x2e2d36){return function(_0x49ffc5){if(_0x49ffc5){return _0x49ffc5[_0x46cb('0x31')](_0x5dc551)[_0x46cb('0x1d')](function(_0x5cd048){return _0x5cd048;});}return null;};}function removeEntity(_0x46489f,_0x3f0eb4){return function(_0x2cc99d){if(_0x2cc99d){return _0x2cc99d[_0x46cb('0x32')]()[_0x46cb('0x1d')](function(){_0x46489f['status'](0xcc)[_0x46cb('0x33')]();});}};}function handleEntityNotFound(_0x49f80a,_0x46485c){return function(_0x414aef){if(!_0x414aef){_0x49f80a[_0x46cb('0x34')](0x194);}return _0x414aef;};}function handleError(_0x50000e,_0x17eb01){_0x17eb01=_0x17eb01||0x1f4;return function(_0x4290c){logger['error'](_0x4290c[_0x46cb('0x35')]);if(_0x4290c[_0x46cb('0x36')]){delete _0x4290c[_0x46cb('0x36')];}_0x50000e[_0x46cb('0x28')](_0x17eb01)[_0x46cb('0x37')](_0x4290c);};}exports[_0x46cb('0x38')]=function(_0x244084,_0x3dabed){var _0x19e0ad={},_0xe4504e={},_0xba5e93={'count':0x0,'rows':[]};var _0x4f0fb6=_['map'](db['ServicenowConfiguration'][_0x46cb('0x39')],function(_0xf8aaec){return{'name':_0xf8aaec[_0x46cb('0x3a')],'type':_0xf8aaec[_0x46cb('0x3b')][_0x46cb('0x3c')]};});_0xe4504e[_0x46cb('0x3d')]=_['map'](_0x4f0fb6,_0x46cb('0x36'));_0xe4504e['query']=_['keys'](_0x244084[_0x46cb('0x3e')]);_0xe4504e['filters']=_['intersection'](_0xe4504e[_0x46cb('0x3d')],_0xe4504e['query']);_0x19e0ad['attributes']=_[_0x46cb('0x3f')](_0xe4504e[_0x46cb('0x3d')],qs[_0x46cb('0x40')](_0x244084[_0x46cb('0x3e')][_0x46cb('0x40')]));_0x19e0ad[_0x46cb('0x41')]=_0x19e0ad[_0x46cb('0x41')]['length']?_0x19e0ad[_0x46cb('0x41')]:_0xe4504e['model'];if(!_0x244084[_0x46cb('0x3e')]['hasOwnProperty'](_0x46cb('0x42'))){_0x19e0ad[_0x46cb('0x2c')]=qs[_0x46cb('0x2c')](_0x244084['query'][_0x46cb('0x2c')]);_0x19e0ad[_0x46cb('0x2b')]=qs['offset'](_0x244084[_0x46cb('0x3e')][_0x46cb('0x2b')]);}_0x19e0ad[_0x46cb('0x43')]=qs[_0x46cb('0x44')](_0x244084[_0x46cb('0x3e')]['sort']);_0x19e0ad['where']=qs[_0x46cb('0x45')](_['pick'](_0x244084[_0x46cb('0x3e')],_0xe4504e[_0x46cb('0x45')]),_0x4f0fb6);if(_0x244084['query'][_0x46cb('0x46')]){_0x19e0ad[_0x46cb('0x47')]=_[_0x46cb('0x48')](_0x19e0ad['where'],{'$or':_['map'](_0x4f0fb6,function(_0x5cbdad){if(_0x5cbdad['type']!==_0x46cb('0x49')){var _0x23dd2e={};_0x23dd2e[_0x5cbdad[_0x46cb('0x36')]]={'$like':'%'+_0x244084[_0x46cb('0x3e')][_0x46cb('0x46')]+'%'};return _0x23dd2e;}})});}_0x19e0ad=_['merge']({},_0x19e0ad,_0x244084['options']);var _0x2908fb={'where':_0x19e0ad[_0x46cb('0x47')]};return db['ServicenowConfiguration'][_0x46cb('0x2a')](_0x2908fb)[_0x46cb('0x1d')](function(_0x12f31e){_0xba5e93[_0x46cb('0x2a')]=_0x12f31e;if(_0x244084[_0x46cb('0x3e')][_0x46cb('0x4a')]){_0x19e0ad[_0x46cb('0x4b')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x19e0ad);})[_0x46cb('0x1d')](function(_0x52ed52){_0xba5e93[_0x46cb('0x4c')]=_0x52ed52;return _0xba5e93;})[_0x46cb('0x1d')](respondWithFilteredResult(_0x3dabed,_0x19e0ad))[_0x46cb('0x4d')](handleError(_0x3dabed,null));};exports['show']=function(_0x37163b,_0x5c1665){var _0x5c02c9={'raw':![],'where':{'id':_0x37163b[_0x46cb('0x4e')]['id']}},_0x16c500={};_0x16c500[_0x46cb('0x3d')]=_[_0x46cb('0x4f')](db[_0x46cb('0x50')][_0x46cb('0x39')]);_0x16c500[_0x46cb('0x3e')]=_['keys'](_0x37163b['query']);_0x16c500[_0x46cb('0x45')]=_[_0x46cb('0x3f')](_0x16c500['model'],_0x16c500[_0x46cb('0x3e')]);_0x5c02c9[_0x46cb('0x41')]=_[_0x46cb('0x3f')](_0x16c500[_0x46cb('0x3d')],qs[_0x46cb('0x40')](_0x37163b['query'][_0x46cb('0x40')]));_0x5c02c9[_0x46cb('0x41')]=_0x5c02c9[_0x46cb('0x41')]['length']?_0x5c02c9[_0x46cb('0x41')]:_0x16c500['model'];if(_0x37163b['query'][_0x46cb('0x4a')]){_0x5c02c9[_0x46cb('0x4b')]=[{'all':!![]}];}_0x5c02c9=_[_0x46cb('0x48')]({},_0x5c02c9,_0x37163b[_0x46cb('0x51')]);return db[_0x46cb('0x50')]['find'](_0x5c02c9)[_0x46cb('0x1d')](handleEntityNotFound(_0x5c1665,null))[_0x46cb('0x1d')](respondWithResult(_0x5c1665,null))['catch'](handleError(_0x5c1665,null));};exports['create']=function(_0x1230db,_0xfccf57){return db[_0x46cb('0x50')]['create'](_0x1230db[_0x46cb('0x52')],{})[_0x46cb('0x1d')](respondWithResult(_0xfccf57,0xc9))[_0x46cb('0x4d')](handleError(_0xfccf57,null));};exports[_0x46cb('0x31')]=function(_0x46407d,_0x3f415d){if(_0x46407d[_0x46cb('0x52')]['id']){delete _0x46407d[_0x46cb('0x52')]['id'];}return db[_0x46cb('0x50')]['find']({'where':{'id':_0x46407d[_0x46cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f415d,null))[_0x46cb('0x1d')](saveUpdates(_0x46407d[_0x46cb('0x52')],null))[_0x46cb('0x1d')](respondWithResult(_0x3f415d,null))[_0x46cb('0x4d')](handleError(_0x3f415d,null));};exports['destroy']=function(_0x67fb77,_0x13d25f){return db[_0x46cb('0x50')][_0x46cb('0x53')]({'where':{'id':_0x67fb77[_0x46cb('0x4e')]['id']}})[_0x46cb('0x1d')](handleEntityNotFound(_0x13d25f,null))[_0x46cb('0x1d')](removeEntity(_0x13d25f,null))[_0x46cb('0x4d')](handleError(_0x13d25f,null));};exports['getFields']=function(_0x4a0606,_0x5a4b11,_0x50626e){var _0x429189={};var _0xdb582b={};var _0x5e08f0;var _0x429b39;return db[_0x46cb('0x50')][_0x46cb('0x54')]({'where':{'id':_0x4a0606['params']['id']}})['then'](handleEntityNotFound(_0x5a4b11,null))[_0x46cb('0x1d')](function(_0x57acfc){if(_0x57acfc){_0x5e08f0=_0x57acfc;_0xdb582b[_0x46cb('0x3d')]=_[_0x46cb('0x4f')](db[_0x46cb('0x55')][_0x46cb('0x39')]);_0xdb582b[_0x46cb('0x3e')]=_[_0x46cb('0x4f')](_0x4a0606[_0x46cb('0x3e')]);_0xdb582b[_0x46cb('0x45')]=_[_0x46cb('0x3f')](_0xdb582b[_0x46cb('0x3d')],_0xdb582b[_0x46cb('0x3e')]);_0x429189[_0x46cb('0x41')]=_[_0x46cb('0x3f')](_0xdb582b['model'],qs[_0x46cb('0x40')](_0x4a0606['query'][_0x46cb('0x40')]));_0x429189[_0x46cb('0x41')]=_0x429189[_0x46cb('0x41')][_0x46cb('0x56')]?_0x429189[_0x46cb('0x41')]:_0xdb582b[_0x46cb('0x3d')];_0x429189[_0x46cb('0x43')]=qs['sort'](_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x44')]);_0x429189[_0x46cb('0x47')]=qs[_0x46cb('0x45')](_['pick'](_0x4a0606[_0x46cb('0x3e')],_0xdb582b[_0x46cb('0x45')]));if(_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x46')]){_0x429189[_0x46cb('0x47')]=_['merge'](_0x429189[_0x46cb('0x47')],{'$or':_[_0x46cb('0x57')](_0x429189[_0x46cb('0x41')],function(_0x2625e4){var _0x38b4a6={};_0x38b4a6[_0x2625e4]={'$like':'%'+_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x46')]+'%'};return _0x38b4a6;})});}_0x429189=_[_0x46cb('0x48')]({},_0x429189,_0x4a0606['options']);return _0x5e08f0['getFields'](_0x429189);}})['then'](function(_0x2bab19){if(_0x2bab19){_0x429b39=_0x2bab19[_0x46cb('0x56')];if(!_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x58')](_0x46cb('0x42'))){_0x429189[_0x46cb('0x2c')]=qs[_0x46cb('0x2c')](_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x2c')]);_0x429189[_0x46cb('0x2b')]=qs[_0x46cb('0x2b')](_0x4a0606[_0x46cb('0x3e')][_0x46cb('0x2b')]);}return _0x5e08f0[_0x46cb('0x59')](_0x429189);}})['then'](function(_0x2e23e4){if(_0x2e23e4){return _0x2e23e4?{'count':_0x429b39,'rows':_0x2e23e4}:null;}})['then'](respondWithResult(_0x5a4b11,null))[_0x46cb('0x4d')](handleError(_0x5a4b11,null));};exports['getSubjects']=function(_0x424e49,_0x3a2aec,_0x2bb425){var _0x3a8b96={};var _0x585e10={};var _0xa7d3ab;var _0x243565;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x424e49[_0x46cb('0x4e')]['id']}})[_0x46cb('0x1d')](handleEntityNotFound(_0x3a2aec,null))[_0x46cb('0x1d')](function(_0x14f580){if(_0x14f580){_0xa7d3ab=_0x14f580;_0x585e10[_0x46cb('0x3d')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x585e10[_0x46cb('0x3e')]=_[_0x46cb('0x4f')](_0x424e49[_0x46cb('0x3e')]);_0x585e10[_0x46cb('0x45')]=_[_0x46cb('0x3f')](_0x585e10[_0x46cb('0x3d')],_0x585e10[_0x46cb('0x3e')]);_0x3a8b96[_0x46cb('0x41')]=_[_0x46cb('0x3f')](_0x585e10[_0x46cb('0x3d')],qs[_0x46cb('0x40')](_0x424e49['query'][_0x46cb('0x40')]));_0x3a8b96[_0x46cb('0x41')]=_0x3a8b96[_0x46cb('0x41')][_0x46cb('0x56')]?_0x3a8b96['attributes']:_0x585e10[_0x46cb('0x3d')];_0x3a8b96[_0x46cb('0x43')]=qs[_0x46cb('0x44')](_0x424e49[_0x46cb('0x3e')]['sort']);_0x3a8b96[_0x46cb('0x47')]=qs[_0x46cb('0x45')](_[_0x46cb('0x5a')](_0x424e49[_0x46cb('0x3e')],_0x585e10['filters']));if(_0x424e49['query']['filter']){_0x3a8b96[_0x46cb('0x47')]=_['merge'](_0x3a8b96[_0x46cb('0x47')],{'$or':_['map'](_0x3a8b96[_0x46cb('0x41')],function(_0x36a82b){var _0x29566a={};_0x29566a[_0x36a82b]={'$like':'%'+_0x424e49[_0x46cb('0x3e')]['filter']+'%'};return _0x29566a;})});}_0x3a8b96=_[_0x46cb('0x48')]({},_0x3a8b96,_0x424e49[_0x46cb('0x51')]);return _0xa7d3ab[_0x46cb('0x5b')](_0x3a8b96);}})[_0x46cb('0x1d')](function(_0x5747da){if(_0x5747da){_0x243565=_0x5747da['length'];if(!_0x424e49[_0x46cb('0x3e')][_0x46cb('0x58')](_0x46cb('0x42'))){_0x3a8b96[_0x46cb('0x2c')]=qs[_0x46cb('0x2c')](_0x424e49[_0x46cb('0x3e')]['limit']);_0x3a8b96['offset']=qs[_0x46cb('0x2b')](_0x424e49[_0x46cb('0x3e')]['offset']);}return _0xa7d3ab[_0x46cb('0x5b')](_0x3a8b96);}})[_0x46cb('0x1d')](function(_0x20c41d){if(_0x20c41d){return _0x20c41d?{'count':_0x243565,'rows':_0x20c41d}:null;}})[_0x46cb('0x1d')](respondWithResult(_0x3a2aec,null))[_0x46cb('0x4d')](handleError(_0x3a2aec,null));};exports[_0x46cb('0x5c')]=function(_0x1aa6f4,_0x50c575,_0x21a9ca){var _0x1264f3={};var _0x392d6d={};var _0x1641b0;var _0x2a09de;return db[_0x46cb('0x50')][_0x46cb('0x54')]({'where':{'id':_0x1aa6f4[_0x46cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x50c575,null))['then'](function(_0x3cb612){if(_0x3cb612){_0x1641b0=_0x3cb612;_0x392d6d[_0x46cb('0x3d')]=_[_0x46cb('0x4f')](db[_0x46cb('0x55')]['rawAttributes']);_0x392d6d[_0x46cb('0x3e')]=_['keys'](_0x1aa6f4['query']);_0x392d6d[_0x46cb('0x45')]=_[_0x46cb('0x3f')](_0x392d6d[_0x46cb('0x3d')],_0x392d6d[_0x46cb('0x3e')]);_0x1264f3['attributes']=_[_0x46cb('0x3f')](_0x392d6d['model'],qs[_0x46cb('0x40')](_0x1aa6f4[_0x46cb('0x3e')][_0x46cb('0x40')]));_0x1264f3[_0x46cb('0x41')]=_0x1264f3[_0x46cb('0x41')][_0x46cb('0x56')]?_0x1264f3['attributes']:_0x392d6d['model'];_0x1264f3[_0x46cb('0x43')]=qs['sort'](_0x1aa6f4[_0x46cb('0x3e')]['sort']);_0x1264f3[_0x46cb('0x47')]=qs[_0x46cb('0x45')](_[_0x46cb('0x5a')](_0x1aa6f4['query'],_0x392d6d[_0x46cb('0x45')]));if(_0x1aa6f4[_0x46cb('0x3e')][_0x46cb('0x46')]){_0x1264f3[_0x46cb('0x47')]=_[_0x46cb('0x48')](_0x1264f3[_0x46cb('0x47')],{'$or':_[_0x46cb('0x57')](_0x1264f3[_0x46cb('0x41')],function(_0x3eadbd){var _0xe82f10={};_0xe82f10[_0x3eadbd]={'$like':'%'+_0x1aa6f4['query']['filter']+'%'};return _0xe82f10;})});}_0x1264f3=_[_0x46cb('0x48')]({},_0x1264f3,_0x1aa6f4[_0x46cb('0x51')]);return _0x1641b0['getDescriptions'](_0x1264f3);}})[_0x46cb('0x1d')](function(_0x4a529b){if(_0x4a529b){_0x2a09de=_0x4a529b['length'];if(!_0x1aa6f4[_0x46cb('0x3e')][_0x46cb('0x58')]('nolimit')){_0x1264f3[_0x46cb('0x2c')]=qs[_0x46cb('0x2c')](_0x1aa6f4[_0x46cb('0x3e')][_0x46cb('0x2c')]);_0x1264f3[_0x46cb('0x2b')]=qs[_0x46cb('0x2b')](_0x1aa6f4['query'][_0x46cb('0x2b')]);}return _0x1641b0[_0x46cb('0x5c')](_0x1264f3);}})[_0x46cb('0x1d')](function(_0x368063){if(_0x368063){return _0x368063?{'count':_0x2a09de,'rows':_0x368063}:null;}})[_0x46cb('0x1d')](respondWithResult(_0x50c575,null))[_0x46cb('0x4d')](handleError(_0x50c575,null));}; \ No newline at end of file +var _0x0972=['ServicenowField','pick','getFields','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','apply','reject','update','destroy','end','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','findAll','rows','params','length','includeAll','include','find','create','body','findOne'];(function(_0x2b4fc4,_0x5b0c6d){var _0x25e0ac=function(_0x15c0bb){while(--_0x15c0bb){_0x2b4fc4['push'](_0x2b4fc4['shift']());}};_0x25e0ac(++_0x5b0c6d);}(_0x0972,0x64));var _0x2097=function(_0x36630d,_0xa6c486){_0x36630d=_0x36630d-0x0;var _0xd59a11=_0x0972[_0x36630d];return _0xd59a11;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2097('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2097('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2097('0x2'));var moment=require(_0x2097('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2097('0x4'));var util=require(_0x2097('0x5'));var path=require(_0x2097('0x6'));var sox=require(_0x2097('0x7'));var csv=require(_0x2097('0x8'));var ejs=require(_0x2097('0x9'));var fs=require('fs');var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x8'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var db=require(_0x2097('0x18'))['db'];var jayson=require(_0x2097('0x19'));var client=jayson[_0x2097('0x1a')][_0x2097('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x16871b,_0x24ca42,_0x3e3fdc){if(_0x3e3fdc){var _0x185be8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x185be8[_0x2097('0x1c')](_0x24ca42)){return _0x16871b;}else{throw new db[(_0x2097('0x1d'))][(_0x2097('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x16871b;}}function respondWithRpcPromise(_0x639c14,_0x35c062,_0x4d31bc,_0x4eec05){return new BPromise(function(_0x4fc8c5,_0x409deb){var _0x588396=_0x4eec05||client;return _0x588396[_0x2097('0x1f')](_0x639c14,_0x4d31bc)[_0x2097('0x20')](function(_0x43fec9){logger[_0x2097('0x21')](_0x2097('0x22'),_0x35c062,'request\x20sent');logger[_0x2097('0x23')](_0x2097('0x24'),_0x35c062,_0x2097('0x25'),JSON[_0x2097('0x26')](_0x43fec9));if(_0x43fec9[_0x2097('0x27')]){if(_0x43fec9[_0x2097('0x27')][_0x2097('0x28')]===0x1f4){logger[_0x2097('0x27')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35c062,_0x43fec9['error'][_0x2097('0x29')]);return _0x409deb(_0x43fec9['error'][_0x2097('0x29')]);}logger[_0x2097('0x27')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35c062,_0x43fec9[_0x2097('0x27')]['message']);return _0x4fc8c5(_0x43fec9[_0x2097('0x27')][_0x2097('0x29')]);}else{logger[_0x2097('0x21')](_0x2097('0x22'),_0x35c062,_0x2097('0x25'));_0x4fc8c5(_0x43fec9[_0x2097('0x2a')]['message']);}})[_0x2097('0x2b')](function(_0x500234){logger[_0x2097('0x27')](_0x2097('0x22'),_0x35c062,_0x500234);_0x409deb(_0x500234);});});}function respondWithStatusCode(_0x345875,_0x9f59bc){_0x9f59bc=_0x9f59bc||0xcc;return function(_0x499988){if(_0x499988){return _0x345875[_0x2097('0x2c')](_0x9f59bc);}return _0x345875[_0x2097('0x2d')](_0x9f59bc)['end']();};}function respondWithResult(_0x1229fc,_0x5ed0fa){_0x5ed0fa=_0x5ed0fa||0xc8;return function(_0x29b879){if(_0x29b879){return _0x1229fc['status'](_0x5ed0fa)[_0x2097('0x2e')](_0x29b879);}};}function respondWithFilteredResult(_0x33e8d1,_0x407a2a){return function(_0x7eefb4){if(_0x7eefb4){var _0x410afa=_0x7eefb4[_0x2097('0x2f')],_0x36228c=_0x407a2a[_0x2097('0x30')],_0x450e0b=_0x407a2a['offset']+_0x407a2a[_0x2097('0x31')],_0x4b443d;if(_0x450e0b>=_0x410afa){_0x450e0b=_0x410afa;_0x4b443d=0xc8;}else{_0x4b443d=0xce;}_0x33e8d1[_0x2097('0x2d')](_0x4b443d);return _0x33e8d1['set']('Content-Range',_0x36228c+'-'+_0x450e0b+'/'+_0x410afa)[_0x2097('0x2e')](_0x7eefb4);}return null;};}function patchUpdates(_0x11b051){return function(_0x1649c8){try{jsonpatch[_0x2097('0x32')](_0x1649c8,_0x11b051,!![]);}catch(_0x74ccdc){return BPromise[_0x2097('0x33')](_0x74ccdc);}return _0x1649c8['save']();};}function saveUpdates(_0xe1a381,_0x56bb42){return function(_0x193160){if(_0x193160){return _0x193160[_0x2097('0x34')](_0xe1a381)[_0x2097('0x20')](function(_0x1e8af9){return _0x1e8af9;});}return null;};}function removeEntity(_0x44e398,_0x395d9f){return function(_0x9bc312){if(_0x9bc312){return _0x9bc312[_0x2097('0x35')]()[_0x2097('0x20')](function(){_0x44e398['status'](0xcc)[_0x2097('0x36')]();});}};}function handleEntityNotFound(_0x40baed,_0x23334d){return function(_0x494131){if(!_0x494131){_0x40baed[_0x2097('0x2c')](0x194);}return _0x494131;};}function handleError(_0x3bda50,_0x3c2fa6){_0x3c2fa6=_0x3c2fa6||0x1f4;return function(_0x396162){logger['error'](_0x396162['stack']);if(_0x396162['name']){delete _0x396162[_0x2097('0x37')];}_0x3bda50[_0x2097('0x2d')](_0x3c2fa6)[_0x2097('0x38')](_0x396162);};}exports[_0x2097('0x39')]=function(_0x3710e0,_0x296281){var _0x49b724={},_0x379032={},_0xf65266={'count':0x0,'rows':[]};var _0x2cf259=_[_0x2097('0x3a')](db[_0x2097('0x3b')][_0x2097('0x3c')],function(_0x52b937){return{'name':_0x52b937[_0x2097('0x3d')],'type':_0x52b937[_0x2097('0x3e')][_0x2097('0x3f')]};});_0x379032['model']=_['map'](_0x2cf259,_0x2097('0x37'));_0x379032[_0x2097('0x40')]=_[_0x2097('0x41')](_0x3710e0[_0x2097('0x40')]);_0x379032[_0x2097('0x42')]=_[_0x2097('0x43')](_0x379032[_0x2097('0x44')],_0x379032[_0x2097('0x40')]);_0x49b724[_0x2097('0x45')]=_[_0x2097('0x43')](_0x379032[_0x2097('0x44')],qs[_0x2097('0x46')](_0x3710e0['query'][_0x2097('0x46')]));_0x49b724[_0x2097('0x45')]=_0x49b724[_0x2097('0x45')]['length']?_0x49b724[_0x2097('0x45')]:_0x379032[_0x2097('0x44')];if(!_0x3710e0[_0x2097('0x40')][_0x2097('0x47')](_0x2097('0x48'))){_0x49b724[_0x2097('0x31')]=qs[_0x2097('0x31')](_0x3710e0[_0x2097('0x40')]['limit']);_0x49b724[_0x2097('0x30')]=qs[_0x2097('0x30')](_0x3710e0[_0x2097('0x40')][_0x2097('0x30')]);}_0x49b724[_0x2097('0x49')]=qs[_0x2097('0x4a')](_0x3710e0[_0x2097('0x40')][_0x2097('0x4a')]);_0x49b724['where']=qs[_0x2097('0x42')](_['pick'](_0x3710e0[_0x2097('0x40')],_0x379032[_0x2097('0x42')]),_0x2cf259);if(_0x3710e0[_0x2097('0x40')][_0x2097('0x4b')]){_0x49b724[_0x2097('0x4c')]=_['merge'](_0x49b724[_0x2097('0x4c')],{'$or':_[_0x2097('0x3a')](_0x2cf259,function(_0x113c3b){if(_0x113c3b[_0x2097('0x3e')]!==_0x2097('0x4d')){var _0x58c7bd={};_0x58c7bd[_0x113c3b[_0x2097('0x37')]]={'$like':'%'+_0x3710e0[_0x2097('0x40')][_0x2097('0x4b')]+'%'};return _0x58c7bd;}})});}_0x49b724=_[_0x2097('0x4e')]({},_0x49b724,_0x3710e0[_0x2097('0x4f')]);var _0x22c4c6={'where':_0x49b724[_0x2097('0x4c')]};return db[_0x2097('0x3b')]['count'](_0x22c4c6)[_0x2097('0x20')](function(_0x594804){_0xf65266[_0x2097('0x2f')]=_0x594804;if(_0x3710e0[_0x2097('0x40')]['includeAll']){_0x49b724['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x2097('0x50')](_0x49b724);})[_0x2097('0x20')](function(_0x4c4ef9){_0xf65266[_0x2097('0x51')]=_0x4c4ef9;return _0xf65266;})[_0x2097('0x20')](respondWithFilteredResult(_0x296281,_0x49b724))['catch'](handleError(_0x296281,null));};exports['show']=function(_0x23acf3,_0x21829d){var _0x1b4de6={'raw':![],'where':{'id':_0x23acf3[_0x2097('0x52')]['id']}},_0x5a0c05={};_0x5a0c05[_0x2097('0x44')]=_['keys'](db[_0x2097('0x3b')][_0x2097('0x3c')]);_0x5a0c05[_0x2097('0x40')]=_[_0x2097('0x41')](_0x23acf3[_0x2097('0x40')]);_0x5a0c05['filters']=_['intersection'](_0x5a0c05[_0x2097('0x44')],_0x5a0c05[_0x2097('0x40')]);_0x1b4de6[_0x2097('0x45')]=_['intersection'](_0x5a0c05['model'],qs[_0x2097('0x46')](_0x23acf3[_0x2097('0x40')]['fields']));_0x1b4de6[_0x2097('0x45')]=_0x1b4de6[_0x2097('0x45')][_0x2097('0x53')]?_0x1b4de6[_0x2097('0x45')]:_0x5a0c05[_0x2097('0x44')];if(_0x23acf3['query'][_0x2097('0x54')]){_0x1b4de6[_0x2097('0x55')]=[{'all':!![]}];}_0x1b4de6=_[_0x2097('0x4e')]({},_0x1b4de6,_0x23acf3['options']);return db[_0x2097('0x3b')][_0x2097('0x56')](_0x1b4de6)['then'](handleEntityNotFound(_0x21829d,null))[_0x2097('0x20')](respondWithResult(_0x21829d,null))['catch'](handleError(_0x21829d,null));};exports[_0x2097('0x57')]=function(_0x56a0d1,_0x48742a){return db['ServicenowConfiguration'][_0x2097('0x57')](_0x56a0d1['body'],{})['then'](respondWithResult(_0x48742a,0xc9))[_0x2097('0x2b')](handleError(_0x48742a,null));};exports['update']=function(_0x597322,_0x5465ea){if(_0x597322['body']['id']){delete _0x597322[_0x2097('0x58')]['id'];}return db[_0x2097('0x3b')][_0x2097('0x56')]({'where':{'id':_0x597322[_0x2097('0x52')]['id']}})[_0x2097('0x20')](handleEntityNotFound(_0x5465ea,null))['then'](saveUpdates(_0x597322[_0x2097('0x58')],null))['then'](respondWithResult(_0x5465ea,null))[_0x2097('0x2b')](handleError(_0x5465ea,null));};exports[_0x2097('0x35')]=function(_0x24f166,_0x55e3cd){return db[_0x2097('0x3b')][_0x2097('0x56')]({'where':{'id':_0x24f166[_0x2097('0x52')]['id']}})[_0x2097('0x20')](handleEntityNotFound(_0x55e3cd,null))[_0x2097('0x20')](removeEntity(_0x55e3cd,null))['catch'](handleError(_0x55e3cd,null));};exports['getFields']=function(_0x265eac,_0x275578,_0x4cc782){var _0x4ddb4b={};var _0x4c5f0d={};var _0x5781aa;var _0x14b2d4;return db['ServicenowConfiguration'][_0x2097('0x59')]({'where':{'id':_0x265eac[_0x2097('0x52')]['id']}})['then'](handleEntityNotFound(_0x275578,null))[_0x2097('0x20')](function(_0x234e7d){if(_0x234e7d){_0x5781aa=_0x234e7d;_0x4c5f0d[_0x2097('0x44')]=_[_0x2097('0x41')](db[_0x2097('0x5a')][_0x2097('0x3c')]);_0x4c5f0d[_0x2097('0x40')]=_[_0x2097('0x41')](_0x265eac[_0x2097('0x40')]);_0x4c5f0d['filters']=_[_0x2097('0x43')](_0x4c5f0d[_0x2097('0x44')],_0x4c5f0d[_0x2097('0x40')]);_0x4ddb4b[_0x2097('0x45')]=_[_0x2097('0x43')](_0x4c5f0d[_0x2097('0x44')],qs['fields'](_0x265eac[_0x2097('0x40')][_0x2097('0x46')]));_0x4ddb4b[_0x2097('0x45')]=_0x4ddb4b[_0x2097('0x45')][_0x2097('0x53')]?_0x4ddb4b['attributes']:_0x4c5f0d[_0x2097('0x44')];_0x4ddb4b[_0x2097('0x49')]=qs['sort'](_0x265eac['query']['sort']);_0x4ddb4b[_0x2097('0x4c')]=qs[_0x2097('0x42')](_[_0x2097('0x5b')](_0x265eac[_0x2097('0x40')],_0x4c5f0d[_0x2097('0x42')]));if(_0x265eac[_0x2097('0x40')][_0x2097('0x4b')]){_0x4ddb4b[_0x2097('0x4c')]=_[_0x2097('0x4e')](_0x4ddb4b['where'],{'$or':_['map'](_0x4ddb4b[_0x2097('0x45')],function(_0x34d832){var _0x1eeb30={};_0x1eeb30[_0x34d832]={'$like':'%'+_0x265eac[_0x2097('0x40')][_0x2097('0x4b')]+'%'};return _0x1eeb30;})});}_0x4ddb4b=_[_0x2097('0x4e')]({},_0x4ddb4b,_0x265eac['options']);return _0x5781aa[_0x2097('0x5c')](_0x4ddb4b);}})[_0x2097('0x20')](function(_0x1614ca){if(_0x1614ca){_0x14b2d4=_0x1614ca[_0x2097('0x53')];if(!_0x265eac['query']['hasOwnProperty'](_0x2097('0x48'))){_0x4ddb4b[_0x2097('0x31')]=qs['limit'](_0x265eac[_0x2097('0x40')][_0x2097('0x31')]);_0x4ddb4b[_0x2097('0x30')]=qs[_0x2097('0x30')](_0x265eac[_0x2097('0x40')][_0x2097('0x30')]);}return _0x5781aa[_0x2097('0x5c')](_0x4ddb4b);}})[_0x2097('0x20')](function(_0x54159e){if(_0x54159e){return _0x54159e?{'count':_0x14b2d4,'rows':_0x54159e}:null;}})[_0x2097('0x20')](respondWithResult(_0x275578,null))[_0x2097('0x2b')](handleError(_0x275578,null));};exports['getSubjects']=function(_0x1742a9,_0xd81d45,_0x2bde2b){var _0x143c4f={};var _0x307c43={};var _0x46d6b5;var _0x4592c2;return db[_0x2097('0x3b')][_0x2097('0x59')]({'where':{'id':_0x1742a9[_0x2097('0x52')]['id']}})[_0x2097('0x20')](handleEntityNotFound(_0xd81d45,null))['then'](function(_0xf365a4){if(_0xf365a4){_0x46d6b5=_0xf365a4;_0x307c43[_0x2097('0x44')]=_[_0x2097('0x41')](db[_0x2097('0x5a')][_0x2097('0x3c')]);_0x307c43['query']=_[_0x2097('0x41')](_0x1742a9[_0x2097('0x40')]);_0x307c43[_0x2097('0x42')]=_['intersection'](_0x307c43[_0x2097('0x44')],_0x307c43['query']);_0x143c4f[_0x2097('0x45')]=_['intersection'](_0x307c43[_0x2097('0x44')],qs['fields'](_0x1742a9[_0x2097('0x40')]['fields']));_0x143c4f[_0x2097('0x45')]=_0x143c4f[_0x2097('0x45')][_0x2097('0x53')]?_0x143c4f[_0x2097('0x45')]:_0x307c43[_0x2097('0x44')];_0x143c4f['order']=qs[_0x2097('0x4a')](_0x1742a9[_0x2097('0x40')][_0x2097('0x4a')]);_0x143c4f[_0x2097('0x4c')]=qs[_0x2097('0x42')](_[_0x2097('0x5b')](_0x1742a9[_0x2097('0x40')],_0x307c43[_0x2097('0x42')]));if(_0x1742a9[_0x2097('0x40')][_0x2097('0x4b')]){_0x143c4f[_0x2097('0x4c')]=_[_0x2097('0x4e')](_0x143c4f[_0x2097('0x4c')],{'$or':_[_0x2097('0x3a')](_0x143c4f[_0x2097('0x45')],function(_0xf3831c){var _0x57a31e={};_0x57a31e[_0xf3831c]={'$like':'%'+_0x1742a9[_0x2097('0x40')]['filter']+'%'};return _0x57a31e;})});}_0x143c4f=_['merge']({},_0x143c4f,_0x1742a9[_0x2097('0x4f')]);return _0x46d6b5[_0x2097('0x5d')](_0x143c4f);}})[_0x2097('0x20')](function(_0x4b33d2){if(_0x4b33d2){_0x4592c2=_0x4b33d2[_0x2097('0x53')];if(!_0x1742a9[_0x2097('0x40')][_0x2097('0x47')](_0x2097('0x48'))){_0x143c4f['limit']=qs[_0x2097('0x31')](_0x1742a9['query'][_0x2097('0x31')]);_0x143c4f[_0x2097('0x30')]=qs[_0x2097('0x30')](_0x1742a9[_0x2097('0x40')]['offset']);}return _0x46d6b5[_0x2097('0x5d')](_0x143c4f);}})[_0x2097('0x20')](function(_0x31ec19){if(_0x31ec19){return _0x31ec19?{'count':_0x4592c2,'rows':_0x31ec19}:null;}})['then'](respondWithResult(_0xd81d45,null))[_0x2097('0x2b')](handleError(_0xd81d45,null));};exports[_0x2097('0x5e')]=function(_0x382302,_0x50ea7d,_0x99f3dd){var _0x33a572={};var _0x266d21={};var _0x1afdd5;var _0x336cda;return db[_0x2097('0x3b')]['findOne']({'where':{'id':_0x382302['params']['id']}})[_0x2097('0x20')](handleEntityNotFound(_0x50ea7d,null))[_0x2097('0x20')](function(_0x4213d0){if(_0x4213d0){_0x1afdd5=_0x4213d0;_0x266d21[_0x2097('0x44')]=_[_0x2097('0x41')](db[_0x2097('0x5a')]['rawAttributes']);_0x266d21[_0x2097('0x40')]=_[_0x2097('0x41')](_0x382302[_0x2097('0x40')]);_0x266d21[_0x2097('0x42')]=_[_0x2097('0x43')](_0x266d21[_0x2097('0x44')],_0x266d21[_0x2097('0x40')]);_0x33a572['attributes']=_[_0x2097('0x43')](_0x266d21[_0x2097('0x44')],qs[_0x2097('0x46')](_0x382302[_0x2097('0x40')][_0x2097('0x46')]));_0x33a572[_0x2097('0x45')]=_0x33a572['attributes']['length']?_0x33a572[_0x2097('0x45')]:_0x266d21['model'];_0x33a572['order']=qs[_0x2097('0x4a')](_0x382302[_0x2097('0x40')][_0x2097('0x4a')]);_0x33a572[_0x2097('0x4c')]=qs[_0x2097('0x42')](_[_0x2097('0x5b')](_0x382302[_0x2097('0x40')],_0x266d21[_0x2097('0x42')]));if(_0x382302['query'][_0x2097('0x4b')]){_0x33a572[_0x2097('0x4c')]=_[_0x2097('0x4e')](_0x33a572[_0x2097('0x4c')],{'$or':_[_0x2097('0x3a')](_0x33a572['attributes'],function(_0x2789ed){var _0xc439e0={};_0xc439e0[_0x2789ed]={'$like':'%'+_0x382302[_0x2097('0x40')][_0x2097('0x4b')]+'%'};return _0xc439e0;})});}_0x33a572=_[_0x2097('0x4e')]({},_0x33a572,_0x382302[_0x2097('0x4f')]);return _0x1afdd5['getDescriptions'](_0x33a572);}})[_0x2097('0x20')](function(_0x79f858){if(_0x79f858){_0x336cda=_0x79f858['length'];if(!_0x382302['query']['hasOwnProperty']('nolimit')){_0x33a572[_0x2097('0x31')]=qs[_0x2097('0x31')](_0x382302[_0x2097('0x40')][_0x2097('0x31')]);_0x33a572[_0x2097('0x30')]=qs['offset'](_0x382302[_0x2097('0x40')][_0x2097('0x30')]);}return _0x1afdd5[_0x2097('0x5e')](_0x33a572);}})[_0x2097('0x20')](function(_0x1afc2d){if(_0x1afc2d){return _0x1afc2d?{'count':_0x336cda,'rows':_0x1afc2d}:null;}})[_0x2097('0x20')](respondWithResult(_0x50ea7d,null))['catch'](handleError(_0x50ea7d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7d44938..dacb197 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 _0x7a2f=['moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api'];(function(_0x14a11f,_0x46feb0){var _0x1db5d6=function(_0x162b5f){while(--_0x162b5f){_0x14a11f['push'](_0x14a11f['shift']());}};_0x1db5d6(++_0x46feb0);}(_0x7a2f,0x99));var _0xf7a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a2f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf7a2('0x0'));var util=require(_0xf7a2('0x1'));var logger=require('../../config/logger')(_0xf7a2('0x2'));var moment=require(_0xf7a2('0x3'));var BPromise=require(_0xf7a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7a2('0x5'));var rimraf=require(_0xf7a2('0x6'));var config=require(_0xf7a2('0x7'));var attributes=require(_0xf7a2('0x8'));module[_0xf7a2('0x9')]=function(_0x2680b9,_0x5698e1){return _0x2680b9[_0xf7a2('0xa')](_0xf7a2('0xb'),attributes,{'tableName':_0xf7a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb697=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','int_servicenow_configurations','lodash','util'];(function(_0xeef1ba,_0x46d82d){var _0x36dfa4=function(_0x2f0597){while(--_0x2f0597){_0xeef1ba['push'](_0xeef1ba['shift']());}};_0x36dfa4(++_0x46d82d);}(_0xb697,0x142));var _0x7b69=function(_0x5a86f6,_0x23e978){_0x5a86f6=_0x5a86f6-0x0;var _0x152235=_0xb697[_0x5a86f6];return _0x152235;};'use strict';var _=require(_0x7b69('0x0'));var util=require(_0x7b69('0x1'));var logger=require(_0x7b69('0x2'))(_0x7b69('0x3'));var moment=require(_0x7b69('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b69('0x5'));var fs=require('fs');var path=require(_0x7b69('0x6'));var rimraf=require(_0x7b69('0x7'));var config=require(_0x7b69('0x8'));var attributes=require(_0x7b69('0x9'));module['exports']=function(_0x244582,_0x5e1ba7){return _0x244582[_0x7b69('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0x7b69('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index d8dd743..ad28303 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 _0x265a=['error','message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x2f5149,_0x17c3b0){var _0x12fd73=function(_0x1b840a){while(--_0x1b840a){_0x2f5149['push'](_0x2f5149['shift']());}};_0x12fd73(++_0x17c3b0);}(_0x265a,0x189));var _0xa265=function(_0x1d434e,_0x2daaf9){_0x1d434e=_0x1d434e-0x0;var _0x35b914=_0x265a[_0x1d434e];return _0x35b914;};'use strict';var _=require(_0xa265('0x0'));var util=require(_0xa265('0x1'));var moment=require(_0xa265('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa265('0x3'));var db=require(_0xa265('0x4'))['db'];var utils=require(_0xa265('0x5'));var logger=require(_0xa265('0x6'))(_0xa265('0x7'));var config=require(_0xa265('0x8'));var jayson=require(_0xa265('0x9'));var client=jayson[_0xa265('0xa')][_0xa265('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d08b7,_0x469cdd,_0x485b14){return new BPromise(function(_0x56c110,_0x5bd63d){return client[_0xa265('0xc')](_0x1d08b7,_0x485b14)[_0xa265('0xd')](function(_0x29974d){logger[_0xa265('0xe')](_0xa265('0xf'),_0x469cdd,_0xa265('0x10'));logger[_0xa265('0x11')](_0xa265('0x12'),_0x469cdd,_0xa265('0x10'),JSON[_0xa265('0x13')](_0x29974d));if(_0x29974d['error']){if(_0x29974d['error'][_0xa265('0x14')]===0x1f4){logger[_0xa265('0x15')](_0xa265('0xf'),_0x469cdd,_0x29974d[_0xa265('0x15')][_0xa265('0x16')]);return _0x5bd63d(_0x29974d[_0xa265('0x15')][_0xa265('0x16')]);}logger[_0xa265('0x15')]('ServicenowConfiguration,\x20%s,\x20%s',_0x469cdd,_0x29974d[_0xa265('0x15')][_0xa265('0x16')]);return _0x56c110(_0x29974d[_0xa265('0x15')][_0xa265('0x16')]);}else{logger['info'](_0xa265('0xf'),_0x469cdd,_0xa265('0x10'));_0x56c110(_0x29974d['result'][_0xa265('0x16')]);}})['catch'](function(_0x2318b6){logger[_0xa265('0x15')](_0xa265('0xf'),_0x469cdd,_0x2318b6);_0x5bd63d(_0x2318b6);});});} \ No newline at end of file +var _0x3804=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4744d9,_0x21abae){var _0x38e47e=function(_0x24d6dc){while(--_0x24d6dc){_0x4744d9['push'](_0x4744d9['shift']());}};_0x38e47e(++_0x21abae);}(_0x3804,0x10c));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4380('0x0'));var util=require(_0x4380('0x1'));var moment=require(_0x4380('0x2'));var BPromise=require(_0x4380('0x3'));var rs=require(_0x4380('0x4'));var fs=require('fs');var Redis=require(_0x4380('0x5'));var db=require(_0x4380('0x6'))['db'];var utils=require(_0x4380('0x7'));var logger=require(_0x4380('0x8'))(_0x4380('0x9'));var config=require(_0x4380('0xa'));var jayson=require(_0x4380('0xb'));var client=jayson[_0x4380('0xc')][_0x4380('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x58b9c2,_0x1cd86b,_0x14d09d){return new BPromise(function(_0x1a8c8a,_0x464660){return client[_0x4380('0xe')](_0x58b9c2,_0x14d09d)['then'](function(_0x2b77f8){logger[_0x4380('0xf')](_0x4380('0x10'),_0x1cd86b,'request\x20sent');logger[_0x4380('0x11')](_0x4380('0x12'),_0x1cd86b,_0x4380('0x13'),JSON[_0x4380('0x14')](_0x2b77f8));if(_0x2b77f8[_0x4380('0x15')]){if(_0x2b77f8['error']['code']===0x1f4){logger[_0x4380('0x15')](_0x4380('0x10'),_0x1cd86b,_0x2b77f8[_0x4380('0x15')]['message']);return _0x464660(_0x2b77f8[_0x4380('0x15')]['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1cd86b,_0x2b77f8[_0x4380('0x15')][_0x4380('0x16')]);return _0x1a8c8a(_0x2b77f8[_0x4380('0x15')][_0x4380('0x16')]);}else{logger[_0x4380('0xf')](_0x4380('0x10'),_0x1cd86b,_0x4380('0x13'));_0x1a8c8a(_0x2b77f8[_0x4380('0x17')][_0x4380('0x16')]);}})[_0x4380('0x18')](function(_0x52c742){logger[_0x4380('0x15')](_0x4380('0x10'),_0x1cd86b,_0x52c742);_0x464660(_0x52c742);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index aae2e78..0a4b552 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 _0x31e5=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x22cb5f,_0x2cdd63){var _0x274d36=function(_0x421472){while(--_0x421472){_0x22cb5f['push'](_0x22cb5f['shift']());}};_0x274d36(++_0x2cdd63);}(_0x31e5,0x161));var _0x531e=function(_0x4f630b,_0x546209){_0x4f630b=_0x4f630b-0x0;var _0x527300=_0x31e5[_0x4f630b];return _0x527300;};'use strict';var multer=require(_0x531e('0x0'));var util=require(_0x531e('0x1'));var path=require(_0x531e('0x2'));var timeout=require(_0x531e('0x3'));var express=require('express');var router=express[_0x531e('0x4')]();var auth=require(_0x531e('0x5'));var interaction=require(_0x531e('0x6'));var config=require(_0x531e('0x7'));var controller=require(_0x531e('0x8'));router[_0x531e('0x9')]('/',auth[_0x531e('0xa')](),controller['index']);router[_0x531e('0x9')](_0x531e('0xb'),auth[_0x531e('0xa')](),controller[_0x531e('0xc')]);router['post']('/',auth[_0x531e('0xa')](),controller[_0x531e('0xd')]);router[_0x531e('0xe')](_0x531e('0xb'),auth[_0x531e('0xa')](),controller[_0x531e('0xf')]);router[_0x531e('0x10')]('/:id',auth[_0x531e('0xa')](),controller['destroy']);module[_0x531e('0x11')]=router; \ No newline at end of file +var _0x9057=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intServicenowField.controller','get','index','show','post','isAuthenticated','create','/:id'];(function(_0x160877,_0x14eb80){var _0x35933c=function(_0x4496ce){while(--_0x4496ce){_0x160877['push'](_0x160877['shift']());}};_0x35933c(++_0x14eb80);}(_0x9057,0x134));var _0x7905=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x9057[_0x289891];return _0x31cf2e;};'use strict';var multer=require(_0x7905('0x0'));var util=require(_0x7905('0x1'));var path=require(_0x7905('0x2'));var timeout=require(_0x7905('0x3'));var express=require(_0x7905('0x4'));var router=express[_0x7905('0x5')]();var auth=require(_0x7905('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7905('0x7'));router[_0x7905('0x8')]('/',auth['isAuthenticated'](),controller[_0x7905('0x9')]);router[_0x7905('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7905('0xa')]);router[_0x7905('0xb')]('/',auth[_0x7905('0xc')](),controller[_0x7905('0xd')]);router['put'](_0x7905('0xe'),auth[_0x7905('0xc')](),controller[_0x7905('0xf')]);router[_0x7905('0x10')]('/:id',auth[_0x7905('0xc')](),controller[_0x7905('0x11')]);module[_0x7905('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e4f4d5c..23e8927 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 _0xdab2=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x26e140,_0x5dd7a1){var _0x29be12=function(_0x149f28){while(--_0x149f28){_0x26e140['push'](_0x26e140['shift']());}};_0x29be12(++_0x5dd7a1);}(_0xdab2,0x15c));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dab('0x0'));module[_0x2dab('0x1')]={'type':{'type':Sequelize[_0x2dab('0x2')](_0x2dab('0x3'),_0x2dab('0x4'),_0x2dab('0x5'),_0x2dab('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2dab('0x7')]},'key':{'type':Sequelize[_0x2dab('0x7')]},'keyType':{'type':Sequelize[_0x2dab('0x2')](_0x2dab('0x3'),_0x2dab('0x4'),_0x2dab('0x5'))},'keyContent':{'type':Sequelize[_0x2dab('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2dab('0x7')]}}; \ No newline at end of file +var _0x5393=['keyValue','string','STRING','ENUM','sequelize','exports','variable'];(function(_0x3b1738,_0x3f9e8b){var _0x4a4cc4=function(_0x28bbcf){while(--_0x28bbcf){_0x3b1738['push'](_0x3b1738['shift']());}};_0x4a4cc4(++_0x3f9e8b);}(_0x5393,0x1b6));var _0x3539=function(_0x31ed45,_0x299f5a){_0x31ed45=_0x31ed45-0x0;var _0x46888a=_0x5393[_0x31ed45];return _0x46888a;};'use strict';var Sequelize=require(_0x3539('0x0'));module[_0x3539('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x3539('0x2'),'customVariable',_0x3539('0x3')),'defaultValue':_0x3539('0x4')},'content':{'type':Sequelize[_0x3539('0x5')]},'key':{'type':Sequelize[_0x3539('0x5')]},'keyType':{'type':Sequelize[_0x3539('0x6')](_0x3539('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x3539('0x5')]},'idField':{'type':Sequelize[_0x3539('0x5')]},'nameField':{'type':Sequelize[_0x3539('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3539('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index dd50d01..6bd3ba8 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(_0x2ddf0c,_0x134849){var _0x1cb3d2=function(_0x35251c){while(--_0x35251c){_0x2ddf0c['push'](_0x2ddf0c['shift']());}};_0x1cb3d2(++_0x134849);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x1094e8,_0x10317a){var _0x1bc9ab=function(_0x209240){while(--_0x209240){_0x1094e8['push'](_0x1094e8['shift']());}};_0x1bc9ab(++_0x10317a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 d513347..78ea51a 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 _0xca56=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowField.attributes'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xca56,0x132));var _0x6ca5=function(_0x43db99,_0x4151cb){_0x43db99=_0x43db99-0x0;var _0x7a9f29=_0xca56[_0x43db99];return _0x7a9f29;};'use strict';var _=require(_0x6ca5('0x0'));var util=require(_0x6ca5('0x1'));var logger=require(_0x6ca5('0x2'))(_0x6ca5('0x3'));var moment=require('moment');var BPromise=require(_0x6ca5('0x4'));var rp=require(_0x6ca5('0x5'));var fs=require('fs');var path=require(_0x6ca5('0x6'));var rimraf=require(_0x6ca5('0x7'));var config=require('../../config/environment');var attributes=require(_0x6ca5('0x8'));module[_0x6ca5('0x9')]=function(_0x504c97,_0x7d878e){return _0x504c97[_0x6ca5('0xa')](_0x6ca5('0xb'),attributes,{'tableName':_0x6ca5('0xc'),'paranoid':![],'indexes':[{'name':_0x6ca5('0xd'),'fields':[_0x6ca5('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60ea=['FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x1b986e,_0x2ebaee){var _0x54ca2e=function(_0x34f03c){while(--_0x34f03c){_0x1b986e['push'](_0x1b986e['shift']());}};_0x54ca2e(++_0x2ebaee);}(_0x60ea,0x71));var _0xa60e=function(_0x205520,_0x2ac651){_0x205520=_0x205520-0x0;var _0x369862=_0x60ea[_0x205520];return _0x369862;};'use strict';var _=require(_0xa60e('0x0'));var util=require(_0xa60e('0x1'));var logger=require('../../config/logger')(_0xa60e('0x2'));var moment=require('moment');var BPromise=require(_0xa60e('0x3'));var rp=require(_0xa60e('0x4'));var fs=require('fs');var path=require(_0xa60e('0x5'));var rimraf=require(_0xa60e('0x6'));var config=require(_0xa60e('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x38d4a1,_0x4ea389){return _0x38d4a1[_0xa60e('0x8')](_0xa60e('0x9'),attributes,{'tableName':_0xa60e('0xa'),'paranoid':![],'indexes':[{'name':_0xa60e('0xb'),'fields':[_0xa60e('0xc'),_0xa60e('0xd')],'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 edd4d55..a75f667 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 _0x491d=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x491d,0xa9));var _0xd491=function(_0x43b086,_0x196431){_0x43b086=_0x43b086-0x0;var _0x42d1f7=_0x491d[_0x43b086];return _0x42d1f7;};'use strict';var _=require(_0xd491('0x0'));var util=require(_0xd491('0x1'));var moment=require(_0xd491('0x2'));var BPromise=require(_0xd491('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd491('0x4'));var db=require(_0xd491('0x5'))['db'];var utils=require(_0xd491('0x6'));var logger=require('../../config/logger')(_0xd491('0x7'));var config=require(_0xd491('0x8'));var jayson=require(_0xd491('0x9'));var client=jayson[_0xd491('0xa')][_0xd491('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x830302,_0x49a440,_0x2182fb){return new BPromise(function(_0x3319f2,_0xe2cb34){return client[_0xd491('0xc')](_0x830302,_0x2182fb)[_0xd491('0xd')](function(_0xb09b25){logger[_0xd491('0xe')](_0xd491('0xf'),_0x49a440,_0xd491('0x10'));logger[_0xd491('0x11')](_0xd491('0x12'),_0x49a440,_0xd491('0x10'),JSON[_0xd491('0x13')](_0xb09b25));if(_0xb09b25[_0xd491('0x14')]){if(_0xb09b25['error'][_0xd491('0x15')]===0x1f4){logger[_0xd491('0x14')](_0xd491('0xf'),_0x49a440,_0xb09b25['error'][_0xd491('0x16')]);return _0xe2cb34(_0xb09b25[_0xd491('0x14')][_0xd491('0x16')]);}logger[_0xd491('0x14')](_0xd491('0xf'),_0x49a440,_0xb09b25['error'][_0xd491('0x16')]);return _0x3319f2(_0xb09b25['error'][_0xd491('0x16')]);}else{logger['info'](_0xd491('0xf'),_0x49a440,_0xd491('0x10'));_0x3319f2(_0xb09b25[_0xd491('0x17')][_0xd491('0x16')]);}})[_0xd491('0x18')](function(_0x373849){logger[_0xd491('0x14')](_0xd491('0xf'),_0x49a440,_0x373849);_0xe2cb34(_0x373849);});});} \ No newline at end of file +var _0xd7d2=['error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5862cb,_0x365117){var _0x45d448=function(_0x163e4a){while(--_0x163e4a){_0x5862cb['push'](_0x5862cb['shift']());}};_0x45d448(++_0x365117);}(_0xd7d2,0x10b));var _0x2d7d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd7d2[_0x432682];return _0x463d05;};'use strict';var _=require(_0x2d7d('0x0'));var util=require(_0x2d7d('0x1'));var moment=require(_0x2d7d('0x2'));var BPromise=require(_0x2d7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d7d('0x4'));var db=require(_0x2d7d('0x5'))['db'];var utils=require(_0x2d7d('0x6'));var logger=require(_0x2d7d('0x7'))('rpc');var config=require(_0x2d7d('0x8'));var jayson=require(_0x2d7d('0x9'));var client=jayson[_0x2d7d('0xa')][_0x2d7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2679b4,_0x5ce786,_0x29afa0){return new BPromise(function(_0x49b0df,_0x1b2e82){return client[_0x2d7d('0xc')](_0x2679b4,_0x29afa0)[_0x2d7d('0xd')](function(_0x55bbf9){logger[_0x2d7d('0xe')](_0x2d7d('0xf'),_0x5ce786,_0x2d7d('0x10'));logger['debug'](_0x2d7d('0x11'),_0x5ce786,_0x2d7d('0x10'),JSON[_0x2d7d('0x12')](_0x55bbf9));if(_0x55bbf9[_0x2d7d('0x13')]){if(_0x55bbf9[_0x2d7d('0x13')][_0x2d7d('0x14')]===0x1f4){logger[_0x2d7d('0x13')](_0x2d7d('0xf'),_0x5ce786,_0x55bbf9[_0x2d7d('0x13')][_0x2d7d('0x15')]);return _0x1b2e82(_0x55bbf9[_0x2d7d('0x13')]['message']);}logger[_0x2d7d('0x13')](_0x2d7d('0xf'),_0x5ce786,_0x55bbf9[_0x2d7d('0x13')][_0x2d7d('0x15')]);return _0x49b0df(_0x55bbf9['error'][_0x2d7d('0x15')]);}else{logger[_0x2d7d('0xe')](_0x2d7d('0xf'),_0x5ce786,_0x2d7d('0x10'));_0x49b0df(_0x55bbf9['result'][_0x2d7d('0x15')]);}})['catch'](function(_0x5e4d9a){logger[_0x2d7d('0x13')](_0x2d7d('0xf'),_0x5ce786,_0x5e4d9a);_0x1b2e82(_0x5e4d9a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9769276..b3254d2 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 _0xa3aa=['../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x493aeb,_0x1f4e0c){var _0x5586f8=function(_0x1cd22a){while(--_0x1cd22a){_0x493aeb['push'](_0x493aeb['shift']());}};_0x5586f8(++_0x1f4e0c);}(_0xa3aa,0x1dc));var _0xaa3a=function(_0x2b3ae9,_0x3b8d10){_0x2b3ae9=_0x2b3ae9-0x0;var _0x1a4274=_0xa3aa[_0x2b3ae9];return _0x1a4274;};'use strict';var multer=require(_0xaa3a('0x0'));var util=require(_0xaa3a('0x1'));var path=require(_0xaa3a('0x2'));var timeout=require(_0xaa3a('0x3'));var express=require(_0xaa3a('0x4'));var router=express[_0xaa3a('0x5')]();var auth=require(_0xaa3a('0x6'));var interaction=require(_0xaa3a('0x7'));var config=require('../../config/environment');var controller=require(_0xaa3a('0x8'));router[_0xaa3a('0x9')]('/',auth[_0xaa3a('0xa')](),controller[_0xaa3a('0xb')]);router[_0xaa3a('0x9')](_0xaa3a('0xc'),auth['isAuthenticated'](),controller[_0xaa3a('0xd')]);router[_0xaa3a('0x9')](_0xaa3a('0xe'),auth[_0xaa3a('0xa')](),controller[_0xaa3a('0xf')]);router[_0xaa3a('0x9')]('/:id/fields',auth[_0xaa3a('0xa')](),controller[_0xaa3a('0x10')]);router[_0xaa3a('0x11')]('/',auth[_0xaa3a('0xa')](),controller[_0xaa3a('0x12')]);router[_0xaa3a('0x11')](_0xaa3a('0xe'),auth[_0xaa3a('0xa')](),controller['addConfiguration']);router[_0xaa3a('0x13')](_0xaa3a('0xc'),auth['isAuthenticated'](),controller[_0xaa3a('0x14')]);router['delete'](_0xaa3a('0xc'),auth[_0xaa3a('0xa')](),controller[_0xaa3a('0x15')]);module[_0xaa3a('0x16')]=router; \ No newline at end of file +var _0xeefa=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','getConfigurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeefa,0x195));var _0xaeef=function(_0x5c465a,_0xf2d0a1){_0x5c465a=_0x5c465a-0x0;var _0x26bd64=_0xeefa[_0x5c465a];return _0x26bd64;};'use strict';var multer=require('multer');var util=require(_0xaeef('0x0'));var path=require(_0xaeef('0x1'));var timeout=require(_0xaeef('0x2'));var express=require(_0xaeef('0x3'));var router=express[_0xaeef('0x4')]();var auth=require(_0xaeef('0x5'));var interaction=require(_0xaeef('0x6'));var config=require(_0xaeef('0x7'));var controller=require(_0xaeef('0x8'));router[_0xaeef('0x9')]('/',auth[_0xaeef('0xa')](),controller[_0xaeef('0xb')]);router['get']('/:id',auth[_0xaeef('0xa')](),controller['show']);router[_0xaeef('0x9')]('/:id/configurations',auth[_0xaeef('0xa')](),controller[_0xaeef('0xc')]);router[_0xaeef('0x9')](_0xaeef('0xd'),auth[_0xaeef('0xa')](),controller[_0xaeef('0xe')]);router[_0xaeef('0xf')]('/',auth[_0xaeef('0xa')](),controller[_0xaeef('0x10')]);router['post'](_0xaeef('0x11'),auth[_0xaeef('0xa')](),controller[_0xaeef('0x12')]);router[_0xaeef('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xaeef('0x14')]);router[_0xaeef('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 44e79c2..3b8a970 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 _0x0896=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5d1093,_0x24361c){var _0x1480e0=function(_0x1331e8){while(--_0x1331e8){_0x5d1093['push'](_0x5d1093['shift']());}};_0x1480e0(++_0x24361c);}(_0x0896,0xfb));var _0x6089=function(_0x215a52,_0xdc984c){_0x215a52=_0x215a52-0x0;var _0x30ce22=_0x0896[_0x215a52];return _0x30ce22;};'use strict';var Sequelize=require(_0x6089('0x0'));module[_0x6089('0x1')]={'name':{'type':Sequelize[_0x6089('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6089('0x2')],'unique':_0x6089('0x3')},'password':{'type':Sequelize[_0x6089('0x2')]},'remoteUri':{'type':Sequelize[_0x6089('0x2')],'unique':_0x6089('0x4')},'serverUrl':{'type':Sequelize[_0x6089('0x2')]}}; \ No newline at end of file +var _0xdcdc=['sequelize','exports','STRING','username','remoteUri'];(function(_0x209eca,_0x2e57d1){var _0x2dad03=function(_0x30cf72){while(--_0x30cf72){_0x209eca['push'](_0x209eca['shift']());}};_0x2dad03(++_0x2e57d1);}(_0xdcdc,0x8c));var _0xcdcd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcdc[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xcdcd('0x0'));module[_0xcdcd('0x1')]={'name':{'type':Sequelize[_0xcdcd('0x2')]},'description':{'type':Sequelize[_0xcdcd('0x2')]},'username':{'type':Sequelize[_0xcdcd('0x2')],'unique':_0xcdcd('0x3')},'password':{'type':Sequelize[_0xcdcd('0x2')]},'remoteUri':{'type':Sequelize[_0xcdcd('0x2')],'unique':_0xcdcd('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 7262e66..dd119ba 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 _0x6dcc=['assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','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','Calls','remove','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','send','SugarcrmAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','find','catch','create','body','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields'];(function(_0x1a5146,_0x5e1078){var _0x5b8eb9=function(_0xff7c41){while(--_0xff7c41){_0x1a5146['push'](_0x1a5146['shift']());}};_0x5b8eb9(++_0x5e1078);}(_0x6dcc,0xa6));var _0xc6dc=function(_0x393afc,_0x663fb0){_0x393afc=_0x393afc-0x0;var _0xba935e=_0x6dcc[_0x393afc];return _0xba935e;};'use strict';var pdf=require(_0xc6dc('0x0'));var emlformat=require(_0xc6dc('0x1'));var rimraf=require(_0xc6dc('0x2'));var zipdir=require(_0xc6dc('0x3'));var jsonpatch=require(_0xc6dc('0x4'));var rp=require(_0xc6dc('0x5'));var moment=require(_0xc6dc('0x6'));var BPromise=require(_0xc6dc('0x7'));var Mustache=require(_0xc6dc('0x8'));var util=require('util');var path=require(_0xc6dc('0x9'));var sox=require(_0xc6dc('0xa'));var csv=require('to-csv');var ejs=require(_0xc6dc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc6dc('0xc'));var crypto=require(_0xc6dc('0xd'));var jsforce=require(_0xc6dc('0xe'));var deskjs=require(_0xc6dc('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc6dc('0x10'));var Papa=require(_0xc6dc('0x11'));var Redis=require('ioredis');var authService=require(_0xc6dc('0x12'));var qs=require(_0xc6dc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6dc('0x14'));var logger=require(_0xc6dc('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc6dc('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc6dc('0x17'));var jayson=require(_0xc6dc('0x18'));var client=jayson[_0xc6dc('0x19')][_0xc6dc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3db086,_0xfe833c,_0x1eeccd){if(_0x1eeccd){var _0xa09a3b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa09a3b[_0xc6dc('0x1b')](_0xfe833c)){return _0x3db086;}else{throw new db[(_0xc6dc('0x1c'))][(_0xc6dc('0x1d'))](_0xc6dc('0x1e'));}}else{return _0x3db086;}}function respondWithRpcPromise(_0x31bf0f,_0x452ff5,_0x37628b,_0x3f7689){return new BPromise(function(_0x13b5d3,_0x5c4f5c){var _0xae31df=_0x3f7689||client;return _0xae31df[_0xc6dc('0x1f')](_0x31bf0f,_0x37628b)[_0xc6dc('0x20')](function(_0x1329e9){logger[_0xc6dc('0x21')](_0xc6dc('0x22'),_0x452ff5,_0xc6dc('0x23'));logger[_0xc6dc('0x24')](_0xc6dc('0x25'),_0x452ff5,_0xc6dc('0x23'),JSON[_0xc6dc('0x26')](_0x1329e9));if(_0x1329e9[_0xc6dc('0x27')]){if(_0x1329e9[_0xc6dc('0x27')][_0xc6dc('0x28')]===0x1f4){logger[_0xc6dc('0x27')](_0xc6dc('0x22'),_0x452ff5,_0x1329e9[_0xc6dc('0x27')]['message']);return _0x5c4f5c(_0x1329e9[_0xc6dc('0x27')][_0xc6dc('0x29')]);}logger[_0xc6dc('0x27')](_0xc6dc('0x22'),_0x452ff5,_0x1329e9[_0xc6dc('0x27')][_0xc6dc('0x29')]);return _0x13b5d3(_0x1329e9[_0xc6dc('0x27')][_0xc6dc('0x29')]);}else{logger[_0xc6dc('0x21')](_0xc6dc('0x22'),_0x452ff5,_0xc6dc('0x23'));_0x13b5d3(_0x1329e9[_0xc6dc('0x2a')][_0xc6dc('0x29')]);}})['catch'](function(_0x19cf48){logger[_0xc6dc('0x27')](_0xc6dc('0x22'),_0x452ff5,_0x19cf48);_0x5c4f5c(_0x19cf48);});});}function respondWithStatusCode(_0xfea270,_0x25ddfb){_0x25ddfb=_0x25ddfb||0xcc;return function(_0x45e57a){if(_0x45e57a){return _0xfea270[_0xc6dc('0x2b')](_0x25ddfb);}return _0xfea270[_0xc6dc('0x2c')](_0x25ddfb)[_0xc6dc('0x2d')]();};}function respondWithResult(_0x4ab710,_0x414a9e){_0x414a9e=_0x414a9e||0xc8;return function(_0x42175d){if(_0x42175d){return _0x4ab710[_0xc6dc('0x2c')](_0x414a9e)[_0xc6dc('0x2e')](_0x42175d);}};}function respondWithFilteredResult(_0x1b0484,_0x560f67){return function(_0x58af0c){if(_0x58af0c){var _0x3af73a=_0x58af0c[_0xc6dc('0x2f')],_0x467183=_0x560f67[_0xc6dc('0x30')],_0x573065=_0x560f67[_0xc6dc('0x30')]+_0x560f67[_0xc6dc('0x31')],_0x3cb082;if(_0x573065>=_0x3af73a){_0x573065=_0x3af73a;_0x3cb082=0xc8;}else{_0x3cb082=0xce;}_0x1b0484[_0xc6dc('0x2c')](_0x3cb082);return _0x1b0484['set']('Content-Range',_0x467183+'-'+_0x573065+'/'+_0x3af73a)[_0xc6dc('0x2e')](_0x58af0c);}return null;};}function patchUpdates(_0x46f4b1){return function(_0x539fa6){try{jsonpatch[_0xc6dc('0x32')](_0x539fa6,_0x46f4b1,!![]);}catch(_0x2a9758){return BPromise[_0xc6dc('0x33')](_0x2a9758);}return _0x539fa6[_0xc6dc('0x34')]();};}function saveUpdates(_0x255881,_0x1f4ccf){return function(_0x3338ea){if(_0x3338ea){return _0x3338ea[_0xc6dc('0x35')](_0x255881)[_0xc6dc('0x20')](function(_0x581af0){return _0x581af0;});}return null;};}function removeEntity(_0x666d29,_0x442ec3){return function(_0x2fb7f2){if(_0x2fb7f2){return _0x2fb7f2[_0xc6dc('0x36')]()['then'](function(){_0x666d29['status'](0xcc)[_0xc6dc('0x2d')]();});}};}function handleEntityNotFound(_0x50e816,_0x343758){return function(_0x443d25){if(!_0x443d25){_0x50e816[_0xc6dc('0x2b')](0x194);}return _0x443d25;};}function handleError(_0x58d475,_0x221917){_0x221917=_0x221917||0x1f4;return function(_0x4b219c){logger[_0xc6dc('0x27')](_0x4b219c[_0xc6dc('0x37')]);if(_0x4b219c[_0xc6dc('0x38')]){delete _0x4b219c[_0xc6dc('0x38')];}_0x58d475[_0xc6dc('0x2c')](_0x221917)[_0xc6dc('0x39')](_0x4b219c);};}exports['index']=function(_0x1950e2,_0x408764){var _0x35b7bf={},_0x4470a2={},_0x5738da={'count':0x0,'rows':[]};var _0x5bf076=_['map'](db[_0xc6dc('0x3a')]['rawAttributes'],function(_0x1e1594){return{'name':_0x1e1594[_0xc6dc('0x3b')],'type':_0x1e1594['type'][_0xc6dc('0x3c')]};});_0x4470a2[_0xc6dc('0x3d')]=_[_0xc6dc('0x3e')](_0x5bf076,_0xc6dc('0x38'));_0x4470a2[_0xc6dc('0x3f')]=_[_0xc6dc('0x40')](_0x1950e2[_0xc6dc('0x3f')]);_0x4470a2[_0xc6dc('0x41')]=_[_0xc6dc('0x42')](_0x4470a2[_0xc6dc('0x3d')],_0x4470a2['query']);_0x35b7bf[_0xc6dc('0x43')]=_['intersection'](_0x4470a2['model'],qs[_0xc6dc('0x44')](_0x1950e2[_0xc6dc('0x3f')][_0xc6dc('0x44')]));_0x35b7bf[_0xc6dc('0x43')]=_0x35b7bf[_0xc6dc('0x43')][_0xc6dc('0x45')]?_0x35b7bf['attributes']:_0x4470a2['model'];if(!_0x1950e2[_0xc6dc('0x3f')][_0xc6dc('0x46')](_0xc6dc('0x47'))){_0x35b7bf[_0xc6dc('0x31')]=qs[_0xc6dc('0x31')](_0x1950e2[_0xc6dc('0x3f')][_0xc6dc('0x31')]);_0x35b7bf[_0xc6dc('0x30')]=qs['offset'](_0x1950e2['query'][_0xc6dc('0x30')]);}_0x35b7bf[_0xc6dc('0x48')]=qs[_0xc6dc('0x49')](_0x1950e2[_0xc6dc('0x3f')][_0xc6dc('0x49')]);_0x35b7bf[_0xc6dc('0x4a')]=qs[_0xc6dc('0x41')](_[_0xc6dc('0x4b')](_0x1950e2['query'],_0x4470a2[_0xc6dc('0x41')]),_0x5bf076);if(_0x1950e2[_0xc6dc('0x3f')][_0xc6dc('0x4c')]){_0x35b7bf[_0xc6dc('0x4a')]=_[_0xc6dc('0x4d')](_0x35b7bf[_0xc6dc('0x4a')],{'$or':_[_0xc6dc('0x3e')](_0x5bf076,function(_0x15b9ec){if(_0x15b9ec[_0xc6dc('0x4e')]!==_0xc6dc('0x4f')){var _0x47755a={};_0x47755a[_0x15b9ec[_0xc6dc('0x38')]]={'$like':'%'+_0x1950e2[_0xc6dc('0x3f')][_0xc6dc('0x4c')]+'%'};return _0x47755a;}})});}_0x35b7bf=_[_0xc6dc('0x4d')]({},_0x35b7bf,_0x1950e2[_0xc6dc('0x50')]);var _0x23e0d8={'where':_0x35b7bf[_0xc6dc('0x4a')]};return db[_0xc6dc('0x3a')][_0xc6dc('0x2f')](_0x23e0d8)['then'](function(_0x21668d){_0x5738da[_0xc6dc('0x2f')]=_0x21668d;if(_0x1950e2[_0xc6dc('0x3f')]['includeAll']){_0x35b7bf[_0xc6dc('0x51')]=[{'all':!![]}];}return db[_0xc6dc('0x3a')][_0xc6dc('0x52')](_0x35b7bf);})['then'](function(_0x20e44c){_0x5738da[_0xc6dc('0x53')]=_0x20e44c;return _0x5738da;})['then'](respondWithFilteredResult(_0x408764,_0x35b7bf))['catch'](handleError(_0x408764,null));};exports['show']=function(_0x545f7c,_0x1fd78c){var _0x17c398={'raw':![],'where':{'id':_0x545f7c[_0xc6dc('0x54')]['id']}},_0x56076a={};_0x56076a[_0xc6dc('0x3d')]=_[_0xc6dc('0x40')](db['SugarcrmAccount'][_0xc6dc('0x55')]);_0x56076a[_0xc6dc('0x3f')]=_['keys'](_0x545f7c[_0xc6dc('0x3f')]);_0x56076a[_0xc6dc('0x41')]=_[_0xc6dc('0x42')](_0x56076a['model'],_0x56076a[_0xc6dc('0x3f')]);_0x17c398['attributes']=_['intersection'](_0x56076a[_0xc6dc('0x3d')],qs[_0xc6dc('0x44')](_0x545f7c[_0xc6dc('0x3f')][_0xc6dc('0x44')]));_0x17c398[_0xc6dc('0x43')]=_0x17c398['attributes'][_0xc6dc('0x45')]?_0x17c398[_0xc6dc('0x43')]:_0x56076a[_0xc6dc('0x3d')];if(_0x545f7c[_0xc6dc('0x3f')][_0xc6dc('0x56')]){_0x17c398[_0xc6dc('0x51')]=[{'all':!![]}];}_0x17c398=_['merge']({},_0x17c398,_0x545f7c[_0xc6dc('0x50')]);return db[_0xc6dc('0x3a')][_0xc6dc('0x57')](_0x17c398)['then'](handleEntityNotFound(_0x1fd78c,null))['then'](respondWithResult(_0x1fd78c,null))[_0xc6dc('0x58')](handleError(_0x1fd78c,null));};exports[_0xc6dc('0x59')]=function(_0x2baf9b,_0x99b1af){return db[_0xc6dc('0x3a')][_0xc6dc('0x59')](_0x2baf9b[_0xc6dc('0x5a')],{})[_0xc6dc('0x20')](respondWithResult(_0x99b1af,0xc9))[_0xc6dc('0x58')](handleError(_0x99b1af,null));};exports[_0xc6dc('0x35')]=function(_0x133553,_0x266351){if(_0x133553[_0xc6dc('0x5a')]['id']){delete _0x133553[_0xc6dc('0x5a')]['id'];}return db[_0xc6dc('0x3a')]['find']({'where':{'id':_0x133553[_0xc6dc('0x54')]['id']}})['then'](handleEntityNotFound(_0x266351,null))[_0xc6dc('0x20')](saveUpdates(_0x133553[_0xc6dc('0x5a')],null))[_0xc6dc('0x20')](respondWithResult(_0x266351,null))[_0xc6dc('0x58')](handleError(_0x266351,null));};exports[_0xc6dc('0x36')]=function(_0x450fe7,_0x527c45){return db[_0xc6dc('0x3a')][_0xc6dc('0x57')]({'where':{'id':_0x450fe7[_0xc6dc('0x54')]['id']}})[_0xc6dc('0x20')](handleEntityNotFound(_0x527c45,null))[_0xc6dc('0x20')](removeEntity(_0x527c45,null))[_0xc6dc('0x58')](handleError(_0x527c45,null));};exports['getConfigurations']=function(_0x512639,_0x377267,_0x40b96e){var _0x49c7de={};var _0x269cb4={};var _0x560741;var _0x46188c;return db['SugarcrmAccount'][_0xc6dc('0x5b')]({'where':{'id':_0x512639[_0xc6dc('0x54')]['id']}})[_0xc6dc('0x20')](handleEntityNotFound(_0x377267,null))[_0xc6dc('0x20')](function(_0x484277){if(_0x484277){_0x560741=_0x484277;_0x269cb4[_0xc6dc('0x3d')]=_['keys'](db[_0xc6dc('0x5c')]['rawAttributes']);_0x269cb4[_0xc6dc('0x3f')]=_[_0xc6dc('0x40')](_0x512639[_0xc6dc('0x3f')]);_0x269cb4[_0xc6dc('0x41')]=_[_0xc6dc('0x42')](_0x269cb4[_0xc6dc('0x3d')],_0x269cb4[_0xc6dc('0x3f')]);_0x49c7de[_0xc6dc('0x43')]=_[_0xc6dc('0x42')](_0x269cb4['model'],qs[_0xc6dc('0x44')](_0x512639[_0xc6dc('0x3f')]['fields']));_0x49c7de[_0xc6dc('0x43')]=_0x49c7de['attributes'][_0xc6dc('0x45')]?_0x49c7de[_0xc6dc('0x43')]:_0x269cb4['model'];_0x49c7de[_0xc6dc('0x48')]=qs[_0xc6dc('0x49')](_0x512639['query'][_0xc6dc('0x49')]);_0x49c7de[_0xc6dc('0x4a')]=qs[_0xc6dc('0x41')](_['pick'](_0x512639['query'],_0x269cb4[_0xc6dc('0x41')]));if(_0x512639['query']['filter']){_0x49c7de['where']=_[_0xc6dc('0x4d')](_0x49c7de[_0xc6dc('0x4a')],{'$or':_['map'](_0x49c7de[_0xc6dc('0x43')],function(_0x403341){var _0xda9ba7={};_0xda9ba7[_0x403341]={'$like':'%'+_0x512639[_0xc6dc('0x3f')][_0xc6dc('0x4c')]+'%'};return _0xda9ba7;})});}_0x49c7de=_['merge']({},_0x49c7de,_0x512639[_0xc6dc('0x50')]);return _0x560741[_0xc6dc('0x5d')](_0x49c7de);}})[_0xc6dc('0x20')](function(_0x20412a){if(_0x20412a){_0x46188c=_0x20412a[_0xc6dc('0x45')];if(!_0x512639[_0xc6dc('0x3f')][_0xc6dc('0x46')]('nolimit')){_0x49c7de[_0xc6dc('0x31')]=qs['limit'](_0x512639[_0xc6dc('0x3f')][_0xc6dc('0x31')]);_0x49c7de[_0xc6dc('0x30')]=qs['offset'](_0x512639[_0xc6dc('0x3f')][_0xc6dc('0x30')]);}return _0x560741[_0xc6dc('0x5d')](_0x49c7de);}})[_0xc6dc('0x20')](function(_0x54f599){if(_0x54f599){return _0x54f599?{'count':_0x46188c,'rows':_0x54f599}:null;}})['then'](respondWithResult(_0x377267,null))[_0xc6dc('0x58')](handleError(_0x377267,null));};exports[_0xc6dc('0x5e')]=function(_0x1d716c,_0x2a26b3,_0x355427){if(_0x1d716c['body']['id']){delete _0x1d716c[_0xc6dc('0x5a')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x1d716c[_0xc6dc('0x54')]['id']}})[_0xc6dc('0x20')](handleEntityNotFound(_0x2a26b3,null))[_0xc6dc('0x20')](function(_0x1a0b16){if(_0x1a0b16){_0x1d716c[_0xc6dc('0x5a')][_0xc6dc('0x5f')]=_0x1a0b16['id'];_0x1d716c[_0xc6dc('0x5a')][_0xc6dc('0x60')]=integrations[_0xc6dc('0x61')](_0x1d716c[_0xc6dc('0x5a')][_0xc6dc('0x62')],_0x1d716c['body'][_0xc6dc('0x4e')]);_0x1d716c[_0xc6dc('0x5a')][_0xc6dc('0x63')]=integrations['getDescriptions'](_0x1d716c[_0xc6dc('0x5a')]['channel'],_0x1d716c[_0xc6dc('0x5a')][_0xc6dc('0x4e')]);return db[_0xc6dc('0x5c')]['create'](_0x1d716c['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xc6dc('0x60')},{'model':db[_0xc6dc('0x64')],'as':_0xc6dc('0x63')}]});}return null;})[_0xc6dc('0x20')](respondWithResult(_0x2a26b3,null))['catch'](handleError(_0x2a26b3,null));};exports[_0xc6dc('0x65')]=function(_0x5169b4,_0x295a3d,_0x167afb){var _0x4ab2da='';var _0x98b839=['id','name',_0xc6dc('0x66'),_0xc6dc('0x67'),_0xc6dc('0x68'),'date_start',_0xc6dc('0x69'),_0xc6dc('0x6a'),_0xc6dc('0x6b'),_0xc6dc('0x6c'),_0xc6dc('0x6d'),'direction'];return db[_0xc6dc('0x3a')][_0xc6dc('0x5b')]({'where':{'id':_0x5169b4[_0xc6dc('0x54')]['id']},'attributes':['id',_0xc6dc('0x6e'),_0xc6dc('0x6f'),_0xc6dc('0x70')]})['then'](handleEntityNotFound(_0x295a3d,null))[_0xc6dc('0x20')](function(_0x308675){if(_0x308675){_0x4ab2da=_0x308675[_0xc6dc('0x70')];var _0x36b092=_0x4ab2da[_0xc6dc('0x71')](-0x1);if(_0x36b092==='/'){_0x4ab2da=_0x4ab2da[_0xc6dc('0x72')](0x0,_0x4ab2da[_0xc6dc('0x73')](_0x36b092));}return rp({'method':_0xc6dc('0x74'),'uri':util[_0xc6dc('0x75')](_0xc6dc('0x76'),_0x4ab2da,_0xc6dc('0x77')),'json':!![],'form':{'method':'login','input_type':_0xc6dc('0x78'),'response_type':_0xc6dc('0x78'),'rest_data':JSON[_0xc6dc('0x26')]({'user_auth':{'user_name':_0x308675[_0xc6dc('0x6e')],'password':_0x308675[_0xc6dc('0x6f')],'encryption':_0xc6dc('0x79')},'application':_0xc6dc('0x7a')})}});}})['then'](function(_0x32dfe8){if(_0x32dfe8&&_0x32dfe8[_0xc6dc('0x38')]!==_0xc6dc('0x7b')&&_0x32dfe8[_0xc6dc('0x38')]!==_0xc6dc('0x7c')){return rp({'method':_0xc6dc('0x74'),'uri':util['format'](_0xc6dc('0x76'),_0x4ab2da,_0xc6dc('0x77')),'json':!![],'form':{'method':_0xc6dc('0x7d'),'input_type':_0xc6dc('0x78'),'response_type':'JSON','rest_data':JSON[_0xc6dc('0x26')]({'session':_0x32dfe8['id'],'module_name':_0xc6dc('0x7e')})}})[_0xc6dc('0x20')](function(_0x142519){if(_0x142519){var _0x57403c=_['values'](_0x142519['module_fields']);_[_0xc6dc('0x7f')](_0x57403c,function(_0x467315){return _0x98b839['includes'](_0x467315[_0xc6dc('0x38')]);});return{'count':_0x57403c[_0xc6dc('0x45')],'rows':_[_0xc6dc('0x3e')](_0x57403c,function(_0x1c1b44){return{'id':_0x1c1b44[_0xc6dc('0x38')],'name':_0x1c1b44[_0xc6dc('0x80')],'custom':_[_0xc6dc('0x81')](_0x1c1b44[_0xc6dc('0x38')],'_c')?!![]:![],'options':_0x1c1b44['options']?_[_0xc6dc('0x3e')](_['values'](_0x1c1b44['options']),function(_0x1a5c54){return{'name':_0x1a5c54[_0xc6dc('0x82')],'value':_0x1a5c54['name']};}):[]};})};}})[_0xc6dc('0x20')](respondWithResult(_0x295a3d,null))[_0xc6dc('0x58')](function(_0x375ab0){var _0x625029=_0x5169b4[_0xc6dc('0x3f')]['test']?0x1f4:_0x375ab0[_0xc6dc('0x83')]||0x1f4;logger[_0xc6dc('0x27')](_0xc6dc('0x84'),_0xc6dc('0x65'),_0x625029,JSON['stringify'](_0x375ab0));delete _0x375ab0[_0xc6dc('0x38')];if(_0x625029===0x191){_0x625029=0x190;}_0x295a3d['status'](_0x625029)[_0xc6dc('0x39')](_0x5169b4['query'][_0xc6dc('0x1b')]?{'message':_0xc6dc('0x85'),'statusCode':_0x375ab0['statusCode']}:_0x375ab0);});}else{var _0x2387cf=0x1f4;_0x295a3d[_0xc6dc('0x2c')](_0x2387cf)[_0xc6dc('0x39')]({'message':_0xc6dc('0x85'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd5dd=['send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','SugarcrmAccount','findAll','rows','show','params','length','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','intersection','pick','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','getFields','assigned_user_id','created_by','description','date_start','parent_type','parent_name','username','password','remoteUri','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','Calls','values','remove','includes','label','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','ejs','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','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','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','stack','name'];(function(_0x152e48,_0x25f775){var _0x30b1a4=function(_0x5dcbf3){while(--_0x5dcbf3){_0x152e48['push'](_0x152e48['shift']());}};_0x30b1a4(++_0x25f775);}(_0xd5dd,0x143));var _0xdd5d=function(_0x415d54,_0x3fcb6c){_0x415d54=_0x415d54-0x0;var _0x566073=_0xd5dd[_0x415d54];return _0x566073;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdd5d('0x0'));var rimraf=require(_0xdd5d('0x1'));var zipdir=require(_0xdd5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd5d('0x3'));var moment=require(_0xdd5d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdd5d('0x5'));var path=require('path');var sox=require(_0xdd5d('0x6'));var csv=require('to-csv');var ejs=require(_0xdd5d('0x7'));var fs=require('fs');var _=require(_0xdd5d('0x8'));var squel=require(_0xdd5d('0x9'));var crypto=require(_0xdd5d('0xa'));var jsforce=require(_0xdd5d('0xb'));var deskjs=require(_0xdd5d('0xc'));var toCsv=require(_0xdd5d('0xd'));var querystring=require('querystring');var Papa=require(_0xdd5d('0xe'));var Redis=require('ioredis');var authService=require(_0xdd5d('0xf'));var qs=require(_0xdd5d('0x10'));var as=require(_0xdd5d('0x11'));var hardwareService=require(_0xdd5d('0x12'));var logger=require(_0xdd5d('0x13'))(_0xdd5d('0x14'));var utils=require(_0xdd5d('0x15'));var config=require(_0xdd5d('0x16'));var db=require(_0xdd5d('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xdd5d('0x18')][_0xdd5d('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3ad43c,_0x11c7b0,_0x293b85){if(_0x293b85){var _0x4fb8c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fb8c7[_0xdd5d('0x1a')](_0x11c7b0)){return _0x3ad43c;}else{throw new db['Sequelize'][(_0xdd5d('0x1b'))](_0xdd5d('0x1c'));}}else{return _0x3ad43c;}}function respondWithRpcPromise(_0x1ca441,_0x2f1d28,_0x3b7fbf,_0x567959){return new BPromise(function(_0x45bbbe,_0x36db0c){var _0x46790c=_0x567959||client;return _0x46790c[_0xdd5d('0x1d')](_0x1ca441,_0x3b7fbf)[_0xdd5d('0x1e')](function(_0xe6b3d3){logger[_0xdd5d('0x1f')](_0xdd5d('0x20'),_0x2f1d28,_0xdd5d('0x21'));logger[_0xdd5d('0x22')](_0xdd5d('0x23'),_0x2f1d28,'request\x20sent',JSON['stringify'](_0xe6b3d3));if(_0xe6b3d3[_0xdd5d('0x24')]){if(_0xe6b3d3[_0xdd5d('0x24')]['code']===0x1f4){logger[_0xdd5d('0x24')]('SugarcrmAccount,\x20%s,\x20%s',_0x2f1d28,_0xe6b3d3[_0xdd5d('0x24')][_0xdd5d('0x25')]);return _0x36db0c(_0xe6b3d3['error'][_0xdd5d('0x25')]);}logger['error'](_0xdd5d('0x20'),_0x2f1d28,_0xe6b3d3[_0xdd5d('0x24')][_0xdd5d('0x25')]);return _0x45bbbe(_0xe6b3d3[_0xdd5d('0x24')][_0xdd5d('0x25')]);}else{logger[_0xdd5d('0x1f')](_0xdd5d('0x20'),_0x2f1d28,_0xdd5d('0x21'));_0x45bbbe(_0xe6b3d3['result'][_0xdd5d('0x25')]);}})[_0xdd5d('0x26')](function(_0x1481d2){logger[_0xdd5d('0x24')](_0xdd5d('0x20'),_0x2f1d28,_0x1481d2);_0x36db0c(_0x1481d2);});});}function respondWithStatusCode(_0x1cad1a,_0x935050){_0x935050=_0x935050||0xcc;return function(_0x542dc1){if(_0x542dc1){return _0x1cad1a[_0xdd5d('0x27')](_0x935050);}return _0x1cad1a[_0xdd5d('0x28')](_0x935050)[_0xdd5d('0x29')]();};}function respondWithResult(_0x35a7a7,_0x3318bd){_0x3318bd=_0x3318bd||0xc8;return function(_0x30e1d1){if(_0x30e1d1){return _0x35a7a7[_0xdd5d('0x28')](_0x3318bd)[_0xdd5d('0x2a')](_0x30e1d1);}};}function respondWithFilteredResult(_0x5c34b7,_0x232c91){return function(_0x1d803c){if(_0x1d803c){var _0x40fd9d=_0x1d803c[_0xdd5d('0x2b')],_0x319996=_0x232c91[_0xdd5d('0x2c')],_0x1dda77=_0x232c91['offset']+_0x232c91[_0xdd5d('0x2d')],_0x44e5f9;if(_0x1dda77>=_0x40fd9d){_0x1dda77=_0x40fd9d;_0x44e5f9=0xc8;}else{_0x44e5f9=0xce;}_0x5c34b7['status'](_0x44e5f9);return _0x5c34b7[_0xdd5d('0x2e')](_0xdd5d('0x2f'),_0x319996+'-'+_0x1dda77+'/'+_0x40fd9d)['json'](_0x1d803c);}return null;};}function patchUpdates(_0x4faf35){return function(_0x55640f){try{jsonpatch[_0xdd5d('0x30')](_0x55640f,_0x4faf35,!![]);}catch(_0x58ad5d){return BPromise['reject'](_0x58ad5d);}return _0x55640f['save']();};}function saveUpdates(_0x5710f1,_0x547e4f){return function(_0x50c74e){if(_0x50c74e){return _0x50c74e['update'](_0x5710f1)[_0xdd5d('0x1e')](function(_0x110dc5){return _0x110dc5;});}return null;};}function removeEntity(_0x4a3113,_0x2d6755){return function(_0x4ccb62){if(_0x4ccb62){return _0x4ccb62[_0xdd5d('0x31')]()[_0xdd5d('0x1e')](function(){_0x4a3113['status'](0xcc)[_0xdd5d('0x29')]();});}};}function handleEntityNotFound(_0x52711e,_0x6fefdf){return function(_0x9bd39c){if(!_0x9bd39c){_0x52711e['sendStatus'](0x194);}return _0x9bd39c;};}function handleError(_0x1da352,_0x37ac37){_0x37ac37=_0x37ac37||0x1f4;return function(_0x4fa3f7){logger[_0xdd5d('0x24')](_0x4fa3f7[_0xdd5d('0x32')]);if(_0x4fa3f7[_0xdd5d('0x33')]){delete _0x4fa3f7[_0xdd5d('0x33')];}_0x1da352[_0xdd5d('0x28')](_0x37ac37)[_0xdd5d('0x34')](_0x4fa3f7);};}exports[_0xdd5d('0x35')]=function(_0x4cea22,_0x3793aa){var _0x519252={},_0x5d8cc0={},_0xe5effc={'count':0x0,'rows':[]};var _0x4fee6c=_['map'](db['SugarcrmAccount'][_0xdd5d('0x36')],function(_0x48b39d){return{'name':_0x48b39d[_0xdd5d('0x37')],'type':_0x48b39d[_0xdd5d('0x38')][_0xdd5d('0x39')]};});_0x5d8cc0[_0xdd5d('0x3a')]=_[_0xdd5d('0x3b')](_0x4fee6c,_0xdd5d('0x33'));_0x5d8cc0[_0xdd5d('0x3c')]=_[_0xdd5d('0x3d')](_0x4cea22[_0xdd5d('0x3c')]);_0x5d8cc0['filters']=_['intersection'](_0x5d8cc0[_0xdd5d('0x3a')],_0x5d8cc0['query']);_0x519252[_0xdd5d('0x3e')]=_['intersection'](_0x5d8cc0['model'],qs['fields'](_0x4cea22[_0xdd5d('0x3c')][_0xdd5d('0x3f')]));_0x519252[_0xdd5d('0x3e')]=_0x519252[_0xdd5d('0x3e')]['length']?_0x519252[_0xdd5d('0x3e')]:_0x5d8cc0[_0xdd5d('0x3a')];if(!_0x4cea22[_0xdd5d('0x3c')][_0xdd5d('0x40')]('nolimit')){_0x519252['limit']=qs[_0xdd5d('0x2d')](_0x4cea22['query'][_0xdd5d('0x2d')]);_0x519252[_0xdd5d('0x2c')]=qs[_0xdd5d('0x2c')](_0x4cea22[_0xdd5d('0x3c')][_0xdd5d('0x2c')]);}_0x519252[_0xdd5d('0x41')]=qs[_0xdd5d('0x42')](_0x4cea22[_0xdd5d('0x3c')][_0xdd5d('0x42')]);_0x519252['where']=qs[_0xdd5d('0x43')](_['pick'](_0x4cea22[_0xdd5d('0x3c')],_0x5d8cc0[_0xdd5d('0x43')]),_0x4fee6c);if(_0x4cea22[_0xdd5d('0x3c')][_0xdd5d('0x44')]){_0x519252[_0xdd5d('0x45')]=_[_0xdd5d('0x46')](_0x519252[_0xdd5d('0x45')],{'$or':_[_0xdd5d('0x3b')](_0x4fee6c,function(_0x26e35d){if(_0x26e35d[_0xdd5d('0x38')]!==_0xdd5d('0x47')){var _0x5de08d={};_0x5de08d[_0x26e35d[_0xdd5d('0x33')]]={'$like':'%'+_0x4cea22['query'][_0xdd5d('0x44')]+'%'};return _0x5de08d;}})});}_0x519252=_['merge']({},_0x519252,_0x4cea22[_0xdd5d('0x48')]);var _0x5b8570={'where':_0x519252[_0xdd5d('0x45')]};return db['SugarcrmAccount'][_0xdd5d('0x2b')](_0x5b8570)[_0xdd5d('0x1e')](function(_0x26119e){_0xe5effc[_0xdd5d('0x2b')]=_0x26119e;if(_0x4cea22[_0xdd5d('0x3c')][_0xdd5d('0x49')]){_0x519252[_0xdd5d('0x4a')]=[{'all':!![]}];}return db[_0xdd5d('0x4b')][_0xdd5d('0x4c')](_0x519252);})[_0xdd5d('0x1e')](function(_0x1b6210){_0xe5effc[_0xdd5d('0x4d')]=_0x1b6210;return _0xe5effc;})['then'](respondWithFilteredResult(_0x3793aa,_0x519252))[_0xdd5d('0x26')](handleError(_0x3793aa,null));};exports[_0xdd5d('0x4e')]=function(_0x27b911,_0x345b36){var _0x4b87c9={'raw':![],'where':{'id':_0x27b911[_0xdd5d('0x4f')]['id']}},_0x30379f={};_0x30379f[_0xdd5d('0x3a')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x30379f[_0xdd5d('0x3c')]=_['keys'](_0x27b911[_0xdd5d('0x3c')]);_0x30379f[_0xdd5d('0x43')]=_['intersection'](_0x30379f['model'],_0x30379f[_0xdd5d('0x3c')]);_0x4b87c9[_0xdd5d('0x3e')]=_['intersection'](_0x30379f[_0xdd5d('0x3a')],qs['fields'](_0x27b911[_0xdd5d('0x3c')][_0xdd5d('0x3f')]));_0x4b87c9[_0xdd5d('0x3e')]=_0x4b87c9[_0xdd5d('0x3e')][_0xdd5d('0x50')]?_0x4b87c9['attributes']:_0x30379f[_0xdd5d('0x3a')];if(_0x27b911['query'][_0xdd5d('0x49')]){_0x4b87c9[_0xdd5d('0x4a')]=[{'all':!![]}];}_0x4b87c9=_[_0xdd5d('0x46')]({},_0x4b87c9,_0x27b911[_0xdd5d('0x48')]);return db[_0xdd5d('0x4b')][_0xdd5d('0x51')](_0x4b87c9)[_0xdd5d('0x1e')](handleEntityNotFound(_0x345b36,null))[_0xdd5d('0x1e')](respondWithResult(_0x345b36,null))['catch'](handleError(_0x345b36,null));};exports[_0xdd5d('0x52')]=function(_0x5985f3,_0x36d404){return db[_0xdd5d('0x4b')][_0xdd5d('0x52')](_0x5985f3[_0xdd5d('0x53')],{})[_0xdd5d('0x1e')](respondWithResult(_0x36d404,0xc9))[_0xdd5d('0x26')](handleError(_0x36d404,null));};exports[_0xdd5d('0x54')]=function(_0x5da645,_0x4b15fe){if(_0x5da645[_0xdd5d('0x53')]['id']){delete _0x5da645[_0xdd5d('0x53')]['id'];}return db[_0xdd5d('0x4b')]['find']({'where':{'id':_0x5da645[_0xdd5d('0x4f')]['id']}})[_0xdd5d('0x1e')](handleEntityNotFound(_0x4b15fe,null))[_0xdd5d('0x1e')](saveUpdates(_0x5da645[_0xdd5d('0x53')],null))['then'](respondWithResult(_0x4b15fe,null))[_0xdd5d('0x26')](handleError(_0x4b15fe,null));};exports[_0xdd5d('0x31')]=function(_0x1e2bee,_0x186f87){return db[_0xdd5d('0x4b')][_0xdd5d('0x51')]({'where':{'id':_0x1e2bee['params']['id']}})[_0xdd5d('0x1e')](handleEntityNotFound(_0x186f87,null))[_0xdd5d('0x1e')](removeEntity(_0x186f87,null))[_0xdd5d('0x26')](handleError(_0x186f87,null));};exports[_0xdd5d('0x55')]=function(_0x1b2112,_0x4f7870,_0x29521e){var _0x6b89f9={};var _0x2adc46={};var _0x2975b4;var _0x4443b9;return db[_0xdd5d('0x4b')][_0xdd5d('0x56')]({'where':{'id':_0x1b2112[_0xdd5d('0x4f')]['id']}})[_0xdd5d('0x1e')](handleEntityNotFound(_0x4f7870,null))[_0xdd5d('0x1e')](function(_0x5868fb){if(_0x5868fb){_0x2975b4=_0x5868fb;_0x2adc46[_0xdd5d('0x3a')]=_[_0xdd5d('0x3d')](db[_0xdd5d('0x57')]['rawAttributes']);_0x2adc46[_0xdd5d('0x3c')]=_[_0xdd5d('0x3d')](_0x1b2112[_0xdd5d('0x3c')]);_0x2adc46[_0xdd5d('0x43')]=_['intersection'](_0x2adc46[_0xdd5d('0x3a')],_0x2adc46[_0xdd5d('0x3c')]);_0x6b89f9[_0xdd5d('0x3e')]=_[_0xdd5d('0x58')](_0x2adc46[_0xdd5d('0x3a')],qs[_0xdd5d('0x3f')](_0x1b2112[_0xdd5d('0x3c')][_0xdd5d('0x3f')]));_0x6b89f9[_0xdd5d('0x3e')]=_0x6b89f9[_0xdd5d('0x3e')][_0xdd5d('0x50')]?_0x6b89f9['attributes']:_0x2adc46[_0xdd5d('0x3a')];_0x6b89f9[_0xdd5d('0x41')]=qs[_0xdd5d('0x42')](_0x1b2112[_0xdd5d('0x3c')][_0xdd5d('0x42')]);_0x6b89f9['where']=qs[_0xdd5d('0x43')](_[_0xdd5d('0x59')](_0x1b2112[_0xdd5d('0x3c')],_0x2adc46[_0xdd5d('0x43')]));if(_0x1b2112[_0xdd5d('0x3c')][_0xdd5d('0x44')]){_0x6b89f9[_0xdd5d('0x45')]=_[_0xdd5d('0x46')](_0x6b89f9[_0xdd5d('0x45')],{'$or':_[_0xdd5d('0x3b')](_0x6b89f9[_0xdd5d('0x3e')],function(_0x4705c2){var _0x1fdd62={};_0x1fdd62[_0x4705c2]={'$like':'%'+_0x1b2112[_0xdd5d('0x3c')][_0xdd5d('0x44')]+'%'};return _0x1fdd62;})});}_0x6b89f9=_[_0xdd5d('0x46')]({},_0x6b89f9,_0x1b2112['options']);return _0x2975b4[_0xdd5d('0x55')](_0x6b89f9);}})['then'](function(_0x13e735){if(_0x13e735){_0x4443b9=_0x13e735[_0xdd5d('0x50')];if(!_0x1b2112['query'][_0xdd5d('0x40')](_0xdd5d('0x5a'))){_0x6b89f9[_0xdd5d('0x2d')]=qs[_0xdd5d('0x2d')](_0x1b2112[_0xdd5d('0x3c')][_0xdd5d('0x2d')]);_0x6b89f9[_0xdd5d('0x2c')]=qs[_0xdd5d('0x2c')](_0x1b2112['query']['offset']);}return _0x2975b4['getConfigurations'](_0x6b89f9);}})[_0xdd5d('0x1e')](function(_0x47b0be){if(_0x47b0be){return _0x47b0be?{'count':_0x4443b9,'rows':_0x47b0be}:null;}})[_0xdd5d('0x1e')](respondWithResult(_0x4f7870,null))[_0xdd5d('0x26')](handleError(_0x4f7870,null));};exports[_0xdd5d('0x5b')]=function(_0x43b8b9,_0x45e388,_0x348fe5){if(_0x43b8b9[_0xdd5d('0x53')]['id']){delete _0x43b8b9[_0xdd5d('0x53')]['id'];}return db['SugarcrmAccount'][_0xdd5d('0x56')]({'where':{'id':_0x43b8b9[_0xdd5d('0x4f')]['id']}})[_0xdd5d('0x1e')](handleEntityNotFound(_0x45e388,null))[_0xdd5d('0x1e')](function(_0x3afb60){if(_0x3afb60){_0x43b8b9['body']['AccountId']=_0x3afb60['id'];_0x43b8b9[_0xdd5d('0x53')][_0xdd5d('0x5c')]=integrations['getSubjects'](_0x43b8b9['body'][_0xdd5d('0x5d')],_0x43b8b9['body'][_0xdd5d('0x38')]);_0x43b8b9[_0xdd5d('0x53')][_0xdd5d('0x5e')]=integrations[_0xdd5d('0x5f')](_0x43b8b9[_0xdd5d('0x53')][_0xdd5d('0x5d')],_0x43b8b9['body'][_0xdd5d('0x38')]);return db[_0xdd5d('0x57')]['create'](_0x43b8b9[_0xdd5d('0x53')],{'include':[{'model':db['SugarcrmField'],'as':_0xdd5d('0x5c')},{'model':db['SugarcrmField'],'as':_0xdd5d('0x5e')}]});}return null;})[_0xdd5d('0x1e')](respondWithResult(_0x45e388,null))['catch'](handleError(_0x45e388,null));};exports[_0xdd5d('0x60')]=function(_0x78c1c0,_0x309f21,_0x5b1007){var _0x1737e6='';var _0x56e5cf=['id',_0xdd5d('0x33'),_0xdd5d('0x61'),_0xdd5d('0x62'),_0xdd5d('0x63'),_0xdd5d('0x64'),'duration_hours','duration_minutes','parent_id',_0xdd5d('0x65'),_0xdd5d('0x66'),'direction'];return db[_0xdd5d('0x4b')][_0xdd5d('0x56')]({'where':{'id':_0x78c1c0[_0xdd5d('0x4f')]['id']},'attributes':['id',_0xdd5d('0x67'),_0xdd5d('0x68'),_0xdd5d('0x69')]})[_0xdd5d('0x1e')](handleEntityNotFound(_0x309f21,null))[_0xdd5d('0x1e')](function(_0x11722a){if(_0x11722a){_0x1737e6=_0x11722a[_0xdd5d('0x69')];var _0x4035db=_0x1737e6['slice'](-0x1);if(_0x4035db==='/'){_0x1737e6=_0x1737e6[_0xdd5d('0x6a')](0x0,_0x1737e6[_0xdd5d('0x6b')](_0x4035db));}return rp({'method':_0xdd5d('0x6c'),'uri':util['format'](_0xdd5d('0x6d'),_0x1737e6,_0xdd5d('0x6e')),'json':!![],'form':{'method':'login','input_type':_0xdd5d('0x6f'),'response_type':_0xdd5d('0x6f'),'rest_data':JSON[_0xdd5d('0x70')]({'user_auth':{'user_name':_0x11722a[_0xdd5d('0x67')],'password':_0x11722a['password'],'encryption':_0xdd5d('0x71')},'application':_0xdd5d('0x72')})}});}})[_0xdd5d('0x1e')](function(_0x28514c){if(_0x28514c&&_0x28514c[_0xdd5d('0x33')]!=='Invalid\x20Login'&&_0x28514c[_0xdd5d('0x33')]!==_0xdd5d('0x73')){return rp({'method':'POST','uri':util['format'](_0xdd5d('0x6d'),_0x1737e6,_0xdd5d('0x6e')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xdd5d('0x6f'),'rest_data':JSON['stringify']({'session':_0x28514c['id'],'module_name':_0xdd5d('0x74')})}})[_0xdd5d('0x1e')](function(_0x28bd53){if(_0x28bd53){var _0x42750a=_[_0xdd5d('0x75')](_0x28bd53['module_fields']);_[_0xdd5d('0x76')](_0x42750a,function(_0x3f18c6){return _0x56e5cf[_0xdd5d('0x77')](_0x3f18c6[_0xdd5d('0x33')]);});return{'count':_0x42750a[_0xdd5d('0x50')],'rows':_['map'](_0x42750a,function(_0xcc0986){return{'id':_0xcc0986[_0xdd5d('0x33')],'name':_0xcc0986[_0xdd5d('0x78')],'custom':_[_0xdd5d('0x79')](_0xcc0986[_0xdd5d('0x33')],'_c')?!![]:![],'options':_0xcc0986['options']?_[_0xdd5d('0x3b')](_['values'](_0xcc0986[_0xdd5d('0x48')]),function(_0x2aacd2){return{'name':_0x2aacd2['value'],'value':_0x2aacd2[_0xdd5d('0x33')]};}):[]};})};}})[_0xdd5d('0x1e')](respondWithResult(_0x309f21,null))[_0xdd5d('0x26')](function(_0x2d0c95){var _0x218d5c=_0x78c1c0[_0xdd5d('0x3c')][_0xdd5d('0x1a')]?0x1f4:_0x2d0c95[_0xdd5d('0x7a')]||0x1f4;logger[_0xdd5d('0x24')](_0xdd5d('0x7b'),'getFields',_0x218d5c,JSON[_0xdd5d('0x70')](_0x2d0c95));delete _0x2d0c95['name'];if(_0x218d5c===0x191){_0x218d5c=0x190;}_0x309f21[_0xdd5d('0x28')](_0x218d5c)[_0xdd5d('0x34')](_0x78c1c0[_0xdd5d('0x3c')][_0xdd5d('0x1a')]?{'message':_0xdd5d('0x7c'),'statusCode':_0x2d0c95[_0xdd5d('0x7a')]}:_0x2d0c95);});}else{var _0x3f4185=0x1f4;_0x309f21[_0xdd5d('0x28')](_0x3f4185)[_0xdd5d('0x34')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index aa393bb..1daddea 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 _0xf471=['../../components/integrations/configuration','lodash','util','api','request-promise','path','rimraf','./intSugarcrmAccount.attributes'];(function(_0x112419,_0x3c5fed){var _0x2e0af1=function(_0x14d421){while(--_0x14d421){_0x112419['push'](_0x112419['shift']());}};_0x2e0af1(++_0x3c5fed);}(_0xf471,0xc9));var _0x1f47=function(_0x47f87a,_0x15eaa0){_0x47f87a=_0x47f87a-0x0;var _0xc6600c=_0xf471[_0x47f87a];return _0xc6600c;};'use strict';var _=require(_0x1f47('0x0'));var util=require(_0x1f47('0x1'));var logger=require('../../config/logger')(_0x1f47('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1f47('0x3'));var fs=require('fs');var path=require(_0x1f47('0x4'));var rimraf=require(_0x1f47('0x5'));var config=require('../../config/environment');var attributes=require(_0x1f47('0x6'));var integrations=require(_0x1f47('0x7'));module['exports']=function(_0x540354,_0x3cbd11){return _0x540354['define']('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87eb=['bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x3b65ea,_0x1e1da0){var _0x1b0bce=function(_0x21d15f){while(--_0x21d15f){_0x3b65ea['push'](_0x3b65ea['shift']());}};_0x1b0bce(++_0x1e1da0);}(_0x87eb,0x82));var _0xb87e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x87eb[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xb87e('0x0'));var util=require(_0xb87e('0x1'));var logger=require(_0xb87e('0x2'))(_0xb87e('0x3'));var moment=require(_0xb87e('0x4'));var BPromise=require(_0xb87e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb87e('0x6'));var rimraf=require(_0xb87e('0x7'));var config=require(_0xb87e('0x8'));var attributes=require(_0xb87e('0x9'));var integrations=require(_0xb87e('0xa'));module[_0xb87e('0xb')]=function(_0x2ef0ea,_0x223e7b){return _0x2ef0ea[_0xb87e('0xc')](_0xb87e('0xd'),attributes,{'tableName':_0xb87e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 6d925ac..aa8def4 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 _0x799c=['jayson/promise','client','request','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','options','raw','where','attributes','limit','include','map','model','debug','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x799c,0x167));var _0xc799=function(_0x52e37a,_0xaff06b){_0x52e37a=_0x52e37a-0x0;var _0x45075a=_0x799c[_0x52e37a];return _0x45075a;};'use strict';var _=require(_0xc799('0x0'));var util=require(_0xc799('0x1'));var moment=require(_0xc799('0x2'));var BPromise=require(_0xc799('0x3'));var rs=require(_0xc799('0x4'));var fs=require('fs');var Redis=require(_0xc799('0x5'));var db=require(_0xc799('0x6'))['db'];var utils=require(_0xc799('0x7'));var logger=require(_0xc799('0x8'))(_0xc799('0x9'));var config=require(_0xc799('0xa'));var jayson=require(_0xc799('0xb'));var client=jayson[_0xc799('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20b425,_0xd9a140,_0x5ccabf){return new BPromise(function(_0x4b5154,_0x17a97f){return client[_0xc799('0xd')](_0x20b425,_0x5ccabf)[_0xc799('0xe')](function(_0x11fa06){logger[_0xc799('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0xd9a140,_0xc799('0x10'));logger['debug'](_0xc799('0x11'),_0xd9a140,_0xc799('0x10'),JSON[_0xc799('0x12')](_0x11fa06));if(_0x11fa06['error']){if(_0x11fa06[_0xc799('0x13')]['code']===0x1f4){logger[_0xc799('0x13')](_0xc799('0x14'),_0xd9a140,_0x11fa06[_0xc799('0x13')]['message']);return _0x17a97f(_0x11fa06[_0xc799('0x13')][_0xc799('0x15')]);}logger[_0xc799('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0xd9a140,_0x11fa06['error']['message']);return _0x4b5154(_0x11fa06[_0xc799('0x13')]['message']);}else{logger['info'](_0xc799('0x14'),_0xd9a140,'request\x20sent');_0x4b5154(_0x11fa06[_0xc799('0x16')]['message']);}})[_0xc799('0x17')](function(_0x170f6b){logger[_0xc799('0x13')](_0xc799('0x14'),_0xd9a140,_0x170f6b);_0x17a97f(_0x170f6b);});});}exports['GetSugarcrmAccount']=function(_0x46f19a){var _0x40df90=this;return new Promise(function(_0x26f83d,_0x3969a8){return db['SugarcrmAccount']['findAll']({'raw':_0x46f19a[_0xc799('0x18')]?_0x46f19a[_0xc799('0x18')][_0xc799('0x19')]===undefined?!![]:![]:!![],'where':_0x46f19a['options']?_0x46f19a[_0xc799('0x18')][_0xc799('0x1a')]||null:null,'attributes':_0x46f19a[_0xc799('0x18')]?_0x46f19a['options'][_0xc799('0x1b')]||null:null,'limit':_0x46f19a[_0xc799('0x18')]?_0x46f19a['options'][_0xc799('0x1c')]||null:null,'include':_0x46f19a[_0xc799('0x18')]?_0x46f19a[_0xc799('0x18')][_0xc799('0x1d')]?_[_0xc799('0x1e')](_0x46f19a[_0xc799('0x18')][_0xc799('0x1d')],function(_0x549325){return{'model':db[_0x549325[_0xc799('0x1f')]],'as':_0x549325['as'],'attributes':_0x549325['attributes'],'include':_0x549325[_0xc799('0x1d')]?_[_0xc799('0x1e')](_0x549325['include'],function(_0x57e1e2){return{'model':db[_0x57e1e2['model']],'as':_0x57e1e2['as'],'attributes':_0x57e1e2[_0xc799('0x1b')],'include':_0x57e1e2[_0xc799('0x1d')]?_['map'](_0x57e1e2[_0xc799('0x1d')],function(_0x169fc0){return{'model':db[_0x169fc0['model']],'as':_0x169fc0['as'],'attributes':_0x169fc0[_0xc799('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53aa8c){logger[_0xc799('0xf')]('GetSugarcrmAccount',_0x46f19a);logger[_0xc799('0x20')](_0xc799('0x21'),_0x46f19a,JSON['stringify'](_0x53aa8c));_0x26f83d(_0x53aa8c);})[_0xc799('0x17')](function(_0x26d008){logger[_0xc799('0x13')](_0xc799('0x21'),_0x26d008[_0xc799('0x15')],_0x46f19a);_0x3969a8(_0x40df90[_0xc799('0x13')](0x1f4,_0x26d008[_0xc799('0x15')]));});});};exports[_0xc799('0x22')]=function(_0x16e232){var _0x558e46=this;return new Promise(function(_0x469dbd,_0x5dde6b){return db[_0xc799('0x23')][_0xc799('0x24')]({'raw':_0x16e232[_0xc799('0x18')]?_0x16e232[_0xc799('0x18')][_0xc799('0x19')]===undefined?!![]:![]:!![],'where':_0x16e232['options']?_0x16e232['options'][_0xc799('0x1a')]||null:null,'attributes':_0x16e232['options']?_0x16e232[_0xc799('0x18')]['attributes']||null:null,'include':_0x16e232[_0xc799('0x18')]?_0x16e232[_0xc799('0x18')][_0xc799('0x1d')]?_[_0xc799('0x1e')](_0x16e232[_0xc799('0x18')][_0xc799('0x1d')],function(_0x379937){return{'model':db[_0x379937[_0xc799('0x1f')]],'as':_0x379937['as'],'attributes':_0x379937[_0xc799('0x1b')],'include':_0x379937[_0xc799('0x1d')]?_['map'](_0x379937['include'],function(_0xfd4d5e){return{'model':db[_0xfd4d5e['model']],'as':_0xfd4d5e['as'],'attributes':_0xfd4d5e['attributes'],'include':_0xfd4d5e[_0xc799('0x1d')]?_[_0xc799('0x1e')](_0xfd4d5e[_0xc799('0x1d')],function(_0x53460c){return{'model':db[_0x53460c[_0xc799('0x1f')]],'as':_0x53460c['as'],'attributes':_0x53460c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16822f){logger[_0xc799('0xf')]('ShowSugarcrmAccount',_0x16e232);logger[_0xc799('0x20')]('ShowSugarcrmAccount',_0x16e232,JSON['stringify'](_0x16822f));_0x469dbd(_0x16822f);})[_0xc799('0x17')](function(_0x63bb3d){logger[_0xc799('0x13')](_0xc799('0x22'),_0x63bb3d[_0xc799('0x15')],_0x16e232);_0x5dde6b(_0x558e46[_0xc799('0x13')](0x1f4,_0x63bb3d[_0xc799('0x15')]));});});}; \ No newline at end of file +var _0xe02e=['where','attributes','limit','map','model','include','ShowSugarcrmAccount','find','raw','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x26f688,_0x43fc55){var _0x2d96f4=function(_0x35d70b){while(--_0x35d70b){_0x26f688['push'](_0x26f688['shift']());}};_0x2d96f4(++_0x43fc55);}(_0xe02e,0xdb));var _0xee02=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xe02e[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xee02('0x0'));var util=require(_0xee02('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee02('0x2'))['db'];var utils=require(_0xee02('0x3'));var logger=require(_0xee02('0x4'))(_0xee02('0x5'));var config=require(_0xee02('0x6'));var jayson=require(_0xee02('0x7'));var client=jayson[_0xee02('0x8')][_0xee02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3204a4,_0x501e97,_0x1ddbdd){return new BPromise(function(_0x45c4ee,_0x14f686){return client['request'](_0x3204a4,_0x1ddbdd)[_0xee02('0xa')](function(_0x54cff1){logger['info'](_0xee02('0xb'),_0x501e97,_0xee02('0xc'));logger[_0xee02('0xd')](_0xee02('0xe'),_0x501e97,_0xee02('0xc'),JSON[_0xee02('0xf')](_0x54cff1));if(_0x54cff1[_0xee02('0x10')]){if(_0x54cff1['error'][_0xee02('0x11')]===0x1f4){logger[_0xee02('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x501e97,_0x54cff1['error'][_0xee02('0x12')]);return _0x14f686(_0x54cff1['error']['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x501e97,_0x54cff1['error']['message']);return _0x45c4ee(_0x54cff1['error'][_0xee02('0x12')]);}else{logger[_0xee02('0x13')](_0xee02('0xb'),_0x501e97,'request\x20sent');_0x45c4ee(_0x54cff1[_0xee02('0x14')][_0xee02('0x12')]);}})[_0xee02('0x15')](function(_0x58cbf3){logger[_0xee02('0x10')](_0xee02('0xb'),_0x501e97,_0x58cbf3);_0x14f686(_0x58cbf3);});});}exports[_0xee02('0x16')]=function(_0x1a451b){var _0x1c155f=this;return new Promise(function(_0x5ac96e,_0x37a144){return db[_0xee02('0x17')][_0xee02('0x18')]({'raw':_0x1a451b[_0xee02('0x19')]?_0x1a451b[_0xee02('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a451b[_0xee02('0x19')]?_0x1a451b[_0xee02('0x19')][_0xee02('0x1a')]||null:null,'attributes':_0x1a451b[_0xee02('0x19')]?_0x1a451b[_0xee02('0x19')][_0xee02('0x1b')]||null:null,'limit':_0x1a451b[_0xee02('0x19')]?_0x1a451b[_0xee02('0x19')][_0xee02('0x1c')]||null:null,'include':_0x1a451b[_0xee02('0x19')]?_0x1a451b['options']['include']?_[_0xee02('0x1d')](_0x1a451b[_0xee02('0x19')]['include'],function(_0x1af17e){return{'model':db[_0x1af17e[_0xee02('0x1e')]],'as':_0x1af17e['as'],'attributes':_0x1af17e['attributes'],'include':_0x1af17e[_0xee02('0x1f')]?_[_0xee02('0x1d')](_0x1af17e[_0xee02('0x1f')],function(_0x30a275){return{'model':db[_0x30a275[_0xee02('0x1e')]],'as':_0x30a275['as'],'attributes':_0x30a275[_0xee02('0x1b')],'include':_0x30a275['include']?_['map'](_0x30a275[_0xee02('0x1f')],function(_0x37a85c){return{'model':db[_0x37a85c[_0xee02('0x1e')]],'as':_0x37a85c['as'],'attributes':_0x37a85c[_0xee02('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fabac){logger[_0xee02('0x13')](_0xee02('0x16'),_0x1a451b);logger[_0xee02('0xd')](_0xee02('0x16'),_0x1a451b,JSON[_0xee02('0xf')](_0x1fabac));_0x5ac96e(_0x1fabac);})[_0xee02('0x15')](function(_0x5a23b0){logger[_0xee02('0x10')](_0xee02('0x16'),_0x5a23b0[_0xee02('0x12')],_0x1a451b);_0x37a144(_0x1c155f[_0xee02('0x10')](0x1f4,_0x5a23b0[_0xee02('0x12')]));});});};exports[_0xee02('0x20')]=function(_0xcc891c){var _0x32f5e2=this;return new Promise(function(_0x37e945,_0x32f9e6){return db[_0xee02('0x17')][_0xee02('0x21')]({'raw':_0xcc891c[_0xee02('0x19')]?_0xcc891c['options'][_0xee02('0x22')]===undefined?!![]:![]:!![],'where':_0xcc891c[_0xee02('0x19')]?_0xcc891c['options'][_0xee02('0x1a')]||null:null,'attributes':_0xcc891c[_0xee02('0x19')]?_0xcc891c[_0xee02('0x19')][_0xee02('0x1b')]||null:null,'include':_0xcc891c[_0xee02('0x19')]?_0xcc891c[_0xee02('0x19')][_0xee02('0x1f')]?_[_0xee02('0x1d')](_0xcc891c['options'][_0xee02('0x1f')],function(_0xe11ea4){return{'model':db[_0xe11ea4[_0xee02('0x1e')]],'as':_0xe11ea4['as'],'attributes':_0xe11ea4[_0xee02('0x1b')],'include':_0xe11ea4[_0xee02('0x1f')]?_[_0xee02('0x1d')](_0xe11ea4[_0xee02('0x1f')],function(_0x20b9e2){return{'model':db[_0x20b9e2[_0xee02('0x1e')]],'as':_0x20b9e2['as'],'attributes':_0x20b9e2['attributes'],'include':_0x20b9e2['include']?_[_0xee02('0x1d')](_0x20b9e2['include'],function(_0x83066d){return{'model':db[_0x83066d[_0xee02('0x1e')]],'as':_0x83066d['as'],'attributes':_0x83066d[_0xee02('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18ce65){logger[_0xee02('0x13')](_0xee02('0x20'),_0xcc891c);logger[_0xee02('0xd')](_0xee02('0x20'),_0xcc891c,JSON[_0xee02('0xf')](_0x18ce65));_0x37e945(_0x18ce65);})['catch'](function(_0x27df4e){logger['error'](_0xee02('0x20'),_0x27df4e[_0xee02('0x12')],_0xcc891c);_0x32f9e6(_0x32f5e2[_0xee02('0x10')](0x1f4,_0x27df4e[_0xee02('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5f3a8f7..939a7d0 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 _0x5943=['getSubjects','/:id/descriptions','post','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects'];(function(_0x4392af,_0xec5afe){var _0x9fa8eb=function(_0x41d7a4){while(--_0x41d7a4){_0x4392af['push'](_0x4392af['shift']());}};_0x9fa8eb(++_0xec5afe);}(_0x5943,0x125));var _0x3594=function(_0x376158,_0x174811){_0x376158=_0x376158-0x0;var _0x3c3382=_0x5943[_0x376158];return _0x3c3382;};'use strict';var multer=require(_0x3594('0x0'));var util=require('util');var path=require(_0x3594('0x1'));var timeout=require(_0x3594('0x2'));var express=require('express');var router=express[_0x3594('0x3')]();var auth=require(_0x3594('0x4'));var interaction=require(_0x3594('0x5'));var config=require(_0x3594('0x6'));var controller=require(_0x3594('0x7'));router['get']('/',auth[_0x3594('0x8')](),controller[_0x3594('0x9')]);router[_0x3594('0xa')](_0x3594('0xb'),auth[_0x3594('0x8')](),controller['show']);router[_0x3594('0xa')](_0x3594('0xc'),auth[_0x3594('0x8')](),controller[_0x3594('0xd')]);router[_0x3594('0xa')](_0x3594('0xe'),auth[_0x3594('0x8')](),controller[_0x3594('0xf')]);router[_0x3594('0xa')](_0x3594('0x10'),auth[_0x3594('0x8')](),controller['getDescriptions']);router[_0x3594('0x11')]('/',auth[_0x3594('0x8')](),controller['create']);router[_0x3594('0x12')](_0x3594('0xb'),auth[_0x3594('0x8')](),controller[_0x3594('0x13')]);router['delete'](_0x3594('0xb'),auth[_0x3594('0x8')](),controller[_0x3594('0x14')]);module[_0x3594('0x15')]=router; \ No newline at end of file +var _0x5dee=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x450ab0,_0x5953a9){var _0x17186f=function(_0x4eae29){while(--_0x4eae29){_0x450ab0['push'](_0x450ab0['shift']());}};_0x17186f(++_0x5953a9);}(_0x5dee,0xaa));var _0xe5de=function(_0x401d4e,_0x2f6357){_0x401d4e=_0x401d4e-0x0;var _0x382ee1=_0x5dee[_0x401d4e];return _0x382ee1;};'use strict';var multer=require(_0xe5de('0x0'));var util=require(_0xe5de('0x1'));var path=require(_0xe5de('0x2'));var timeout=require('connect-timeout');var express=require(_0xe5de('0x3'));var router=express['Router']();var auth=require(_0xe5de('0x4'));var interaction=require(_0xe5de('0x5'));var config=require(_0xe5de('0x6'));var controller=require(_0xe5de('0x7'));router[_0xe5de('0x8')]('/',auth[_0xe5de('0x9')](),controller[_0xe5de('0xa')]);router[_0xe5de('0x8')](_0xe5de('0xb'),auth['isAuthenticated'](),controller[_0xe5de('0xc')]);router[_0xe5de('0x8')]('/:id/fields',auth[_0xe5de('0x9')](),controller[_0xe5de('0xd')]);router['get'](_0xe5de('0xe'),auth[_0xe5de('0x9')](),controller[_0xe5de('0xf')]);router[_0xe5de('0x8')](_0xe5de('0x10'),auth[_0xe5de('0x9')](),controller[_0xe5de('0x11')]);router[_0xe5de('0x12')]('/',auth[_0xe5de('0x9')](),controller[_0xe5de('0x13')]);router[_0xe5de('0x14')](_0xe5de('0xb'),auth[_0xe5de('0x9')](),controller[_0xe5de('0x15')]);router['delete'](_0xe5de('0xb'),auth[_0xe5de('0x9')](),controller[_0xe5de('0x16')]);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 568004a..c615cf5 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 _0x6338=['sequelize','exports','STRING'];(function(_0x53f062,_0x52eab3){var _0x30ad01=function(_0x106c71){while(--_0x106c71){_0x53f062['push'](_0x53f062['shift']());}};_0x30ad01(++_0x52eab3);}(_0x6338,0xd2));var _0x8633=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6338[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8633('0x0'));module[_0x8633('0x1')]={'name':{'type':Sequelize[_0x8633('0x2')]},'description':{'type':Sequelize[_0x8633('0x2')]}}; \ No newline at end of file +var _0xbb63=['exports','STRING','sequelize'];(function(_0x230409,_0x44fc77){var _0x2d8239=function(_0xf31bc9){while(--_0xf31bc9){_0x230409['push'](_0x230409['shift']());}};_0x2d8239(++_0x44fc77);}(_0xbb63,0x1ee));var _0x3bb6=function(_0x39fcc0,_0x1f4242){_0x39fcc0=_0x39fcc0-0x0;var _0x5e4ab5=_0xbb63[_0x39fcc0];return _0x5e4ab5;};'use strict';var Sequelize=require(_0x3bb6('0x0'));module[_0x3bb6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3bb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index eb7b34f..df46ada 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 _0xd4a8=['api','../../config/utils','../../config/environment','../../mysqldb','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','reject','save','destroy','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','params','length','find','create','body','update','getFields','SugarcrmField','findOne','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3c96e5,_0x927545){var _0x25a047=function(_0x4f3ef8){while(--_0x4f3ef8){_0x3c96e5['push'](_0x3c96e5['shift']());}};_0x25a047(++_0x927545);}(_0xd4a8,0x1a8));var _0x8d4a=function(_0x21ecf5,_0xf4a39){_0x21ecf5=_0x21ecf5-0x0;var _0xbe05cd=_0xd4a8[_0x21ecf5];return _0xbe05cd;};'use strict';var pdf=require(_0x8d4a('0x0'));var emlformat=require(_0x8d4a('0x1'));var rimraf=require(_0x8d4a('0x2'));var zipdir=require(_0x8d4a('0x3'));var jsonpatch=require(_0x8d4a('0x4'));var rp=require('request-promise');var moment=require(_0x8d4a('0x5'));var BPromise=require(_0x8d4a('0x6'));var Mustache=require(_0x8d4a('0x7'));var util=require(_0x8d4a('0x8'));var path=require(_0x8d4a('0x9'));var sox=require('sox');var csv=require(_0x8d4a('0xa'));var ejs=require(_0x8d4a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d4a('0xc'));var crypto=require(_0x8d4a('0xd'));var jsforce=require(_0x8d4a('0xe'));var deskjs=require(_0x8d4a('0xf'));var toCsv=require(_0x8d4a('0xa'));var querystring=require(_0x8d4a('0x10'));var Papa=require(_0x8d4a('0x11'));var Redis=require(_0x8d4a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8d4a('0x13'));var as=require(_0x8d4a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8d4a('0x15'));var utils=require(_0x8d4a('0x16'));var config=require(_0x8d4a('0x17'));var db=require(_0x8d4a('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8d4a('0x19')][_0x8d4a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x34c9fd,_0x4a115b,_0x4a5725){if(_0x4a5725){var _0x3180c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3180c9['test'](_0x4a115b)){return _0x34c9fd;}else{throw new db['Sequelize'][(_0x8d4a('0x1b'))](_0x8d4a('0x1c'));}}else{return _0x34c9fd;}}function respondWithRpcPromise(_0x1d4cda,_0x22fcd2,_0x5d61a4,_0xbd970d){return new BPromise(function(_0x539694,_0x38de56){var _0x3c6d4d=_0xbd970d||client;return _0x3c6d4d[_0x8d4a('0x1d')](_0x1d4cda,_0x5d61a4)[_0x8d4a('0x1e')](function(_0x180ad0){logger[_0x8d4a('0x1f')](_0x8d4a('0x20'),_0x22fcd2,_0x8d4a('0x21'));logger[_0x8d4a('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x22fcd2,_0x8d4a('0x21'),JSON[_0x8d4a('0x23')](_0x180ad0));if(_0x180ad0['error']){if(_0x180ad0[_0x8d4a('0x24')][_0x8d4a('0x25')]===0x1f4){logger[_0x8d4a('0x24')](_0x8d4a('0x20'),_0x22fcd2,_0x180ad0[_0x8d4a('0x24')]['message']);return _0x38de56(_0x180ad0[_0x8d4a('0x24')][_0x8d4a('0x26')]);}logger[_0x8d4a('0x24')](_0x8d4a('0x20'),_0x22fcd2,_0x180ad0[_0x8d4a('0x24')]['message']);return _0x539694(_0x180ad0['error'][_0x8d4a('0x26')]);}else{logger[_0x8d4a('0x1f')](_0x8d4a('0x20'),_0x22fcd2,'request\x20sent');_0x539694(_0x180ad0[_0x8d4a('0x27')][_0x8d4a('0x26')]);}})[_0x8d4a('0x28')](function(_0x2e9b6c){logger[_0x8d4a('0x24')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x22fcd2,_0x2e9b6c);_0x38de56(_0x2e9b6c);});});}function respondWithStatusCode(_0x1ff6a6,_0x51fed4){_0x51fed4=_0x51fed4||0xcc;return function(_0x49d391){if(_0x49d391){return _0x1ff6a6[_0x8d4a('0x29')](_0x51fed4);}return _0x1ff6a6[_0x8d4a('0x2a')](_0x51fed4)[_0x8d4a('0x2b')]();};}function respondWithResult(_0x1c6b3d,_0x1386dc){_0x1386dc=_0x1386dc||0xc8;return function(_0x3a4582){if(_0x3a4582){return _0x1c6b3d[_0x8d4a('0x2a')](_0x1386dc)[_0x8d4a('0x2c')](_0x3a4582);}};}function respondWithFilteredResult(_0x7701e9,_0x16225c){return function(_0x27a5dd){if(_0x27a5dd){var _0x2558be=_0x27a5dd[_0x8d4a('0x2d')],_0x28dd1a=_0x16225c[_0x8d4a('0x2e')],_0x512016=_0x16225c[_0x8d4a('0x2e')]+_0x16225c['limit'],_0x29c7df;if(_0x512016>=_0x2558be){_0x512016=_0x2558be;_0x29c7df=0xc8;}else{_0x29c7df=0xce;}_0x7701e9[_0x8d4a('0x2a')](_0x29c7df);return _0x7701e9[_0x8d4a('0x2f')]('Content-Range',_0x28dd1a+'-'+_0x512016+'/'+_0x2558be)[_0x8d4a('0x2c')](_0x27a5dd);}return null;};}function patchUpdates(_0x3eac4f){return function(_0x42e524){try{jsonpatch['apply'](_0x42e524,_0x3eac4f,!![]);}catch(_0x1aed45){return BPromise[_0x8d4a('0x30')](_0x1aed45);}return _0x42e524[_0x8d4a('0x31')]();};}function saveUpdates(_0x2b000a,_0x3d7c87){return function(_0x15f0ba){if(_0x15f0ba){return _0x15f0ba['update'](_0x2b000a)['then'](function(_0x300f1e){return _0x300f1e;});}return null;};}function removeEntity(_0x5d5e1f,_0x4c0373){return function(_0x356b14){if(_0x356b14){return _0x356b14[_0x8d4a('0x32')]()[_0x8d4a('0x1e')](function(){_0x5d5e1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37fde1,_0x46f276){return function(_0x7d48ce){if(!_0x7d48ce){_0x37fde1['sendStatus'](0x194);}return _0x7d48ce;};}function handleError(_0x3d48ae,_0x417f3c){_0x417f3c=_0x417f3c||0x1f4;return function(_0x16d287){logger['error'](_0x16d287[_0x8d4a('0x33')]);if(_0x16d287[_0x8d4a('0x34')]){delete _0x16d287[_0x8d4a('0x34')];}_0x3d48ae[_0x8d4a('0x2a')](_0x417f3c)[_0x8d4a('0x35')](_0x16d287);};}exports['index']=function(_0x66621a,_0x140dee){var _0x5f3c52={},_0x9605c8={},_0x306f69={'count':0x0,'rows':[]};var _0x43f0c0=_[_0x8d4a('0x36')](db[_0x8d4a('0x37')][_0x8d4a('0x38')],function(_0x10d40b){return{'name':_0x10d40b[_0x8d4a('0x39')],'type':_0x10d40b[_0x8d4a('0x3a')][_0x8d4a('0x3b')]};});_0x9605c8[_0x8d4a('0x3c')]=_[_0x8d4a('0x36')](_0x43f0c0,_0x8d4a('0x34'));_0x9605c8[_0x8d4a('0x3d')]=_[_0x8d4a('0x3e')](_0x66621a[_0x8d4a('0x3d')]);_0x9605c8['filters']=_[_0x8d4a('0x3f')](_0x9605c8[_0x8d4a('0x3c')],_0x9605c8['query']);_0x5f3c52[_0x8d4a('0x40')]=_[_0x8d4a('0x3f')](_0x9605c8[_0x8d4a('0x3c')],qs['fields'](_0x66621a['query'][_0x8d4a('0x41')]));_0x5f3c52[_0x8d4a('0x40')]=_0x5f3c52['attributes']['length']?_0x5f3c52[_0x8d4a('0x40')]:_0x9605c8['model'];if(!_0x66621a[_0x8d4a('0x3d')][_0x8d4a('0x42')](_0x8d4a('0x43'))){_0x5f3c52[_0x8d4a('0x44')]=qs['limit'](_0x66621a[_0x8d4a('0x3d')][_0x8d4a('0x44')]);_0x5f3c52[_0x8d4a('0x2e')]=qs[_0x8d4a('0x2e')](_0x66621a[_0x8d4a('0x3d')][_0x8d4a('0x2e')]);}_0x5f3c52[_0x8d4a('0x45')]=qs[_0x8d4a('0x46')](_0x66621a[_0x8d4a('0x3d')][_0x8d4a('0x46')]);_0x5f3c52[_0x8d4a('0x47')]=qs[_0x8d4a('0x48')](_[_0x8d4a('0x49')](_0x66621a[_0x8d4a('0x3d')],_0x9605c8[_0x8d4a('0x48')]),_0x43f0c0);if(_0x66621a[_0x8d4a('0x3d')]['filter']){_0x5f3c52[_0x8d4a('0x47')]=_['merge'](_0x5f3c52[_0x8d4a('0x47')],{'$or':_[_0x8d4a('0x36')](_0x43f0c0,function(_0x5e68a5){if(_0x5e68a5[_0x8d4a('0x3a')]!=='VIRTUAL'){var _0x492a0a={};_0x492a0a[_0x5e68a5[_0x8d4a('0x34')]]={'$like':'%'+_0x66621a[_0x8d4a('0x3d')][_0x8d4a('0x4a')]+'%'};return _0x492a0a;}})});}_0x5f3c52=_[_0x8d4a('0x4b')]({},_0x5f3c52,_0x66621a[_0x8d4a('0x4c')]);var _0x2fcbae={'where':_0x5f3c52[_0x8d4a('0x47')]};return db[_0x8d4a('0x37')][_0x8d4a('0x2d')](_0x2fcbae)[_0x8d4a('0x1e')](function(_0x50565f){_0x306f69[_0x8d4a('0x2d')]=_0x50565f;if(_0x66621a[_0x8d4a('0x3d')][_0x8d4a('0x4d')]){_0x5f3c52['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x5f3c52);})[_0x8d4a('0x1e')](function(_0x503e35){_0x306f69['rows']=_0x503e35;return _0x306f69;})[_0x8d4a('0x1e')](respondWithFilteredResult(_0x140dee,_0x5f3c52))[_0x8d4a('0x28')](handleError(_0x140dee,null));};exports['show']=function(_0x4bbc5a,_0x91ba49){var _0x3d9bb8={'raw':![],'where':{'id':_0x4bbc5a[_0x8d4a('0x4e')]['id']}},_0x52b23f={};_0x52b23f[_0x8d4a('0x3c')]=_['keys'](db[_0x8d4a('0x37')][_0x8d4a('0x38')]);_0x52b23f[_0x8d4a('0x3d')]=_[_0x8d4a('0x3e')](_0x4bbc5a[_0x8d4a('0x3d')]);_0x52b23f[_0x8d4a('0x48')]=_[_0x8d4a('0x3f')](_0x52b23f['model'],_0x52b23f[_0x8d4a('0x3d')]);_0x3d9bb8[_0x8d4a('0x40')]=_[_0x8d4a('0x3f')](_0x52b23f[_0x8d4a('0x3c')],qs['fields'](_0x4bbc5a[_0x8d4a('0x3d')][_0x8d4a('0x41')]));_0x3d9bb8[_0x8d4a('0x40')]=_0x3d9bb8[_0x8d4a('0x40')][_0x8d4a('0x4f')]?_0x3d9bb8[_0x8d4a('0x40')]:_0x52b23f['model'];if(_0x4bbc5a[_0x8d4a('0x3d')]['includeAll']){_0x3d9bb8['include']=[{'all':!![]}];}_0x3d9bb8=_[_0x8d4a('0x4b')]({},_0x3d9bb8,_0x4bbc5a[_0x8d4a('0x4c')]);return db[_0x8d4a('0x37')][_0x8d4a('0x50')](_0x3d9bb8)[_0x8d4a('0x1e')](handleEntityNotFound(_0x91ba49,null))[_0x8d4a('0x1e')](respondWithResult(_0x91ba49,null))['catch'](handleError(_0x91ba49,null));};exports['create']=function(_0x133f44,_0x252102){return db[_0x8d4a('0x37')][_0x8d4a('0x51')](_0x133f44[_0x8d4a('0x52')],{})[_0x8d4a('0x1e')](respondWithResult(_0x252102,0xc9))[_0x8d4a('0x28')](handleError(_0x252102,null));};exports[_0x8d4a('0x53')]=function(_0x423b41,_0x2cc4fa){if(_0x423b41[_0x8d4a('0x52')]['id']){delete _0x423b41[_0x8d4a('0x52')]['id'];}return db[_0x8d4a('0x37')][_0x8d4a('0x50')]({'where':{'id':_0x423b41[_0x8d4a('0x4e')]['id']}})[_0x8d4a('0x1e')](handleEntityNotFound(_0x2cc4fa,null))[_0x8d4a('0x1e')](saveUpdates(_0x423b41[_0x8d4a('0x52')],null))[_0x8d4a('0x1e')](respondWithResult(_0x2cc4fa,null))[_0x8d4a('0x28')](handleError(_0x2cc4fa,null));};exports['destroy']=function(_0x1a4d95,_0x429ba6){return db[_0x8d4a('0x37')]['find']({'where':{'id':_0x1a4d95[_0x8d4a('0x4e')]['id']}})[_0x8d4a('0x1e')](handleEntityNotFound(_0x429ba6,null))[_0x8d4a('0x1e')](removeEntity(_0x429ba6,null))[_0x8d4a('0x28')](handleError(_0x429ba6,null));};exports[_0x8d4a('0x54')]=function(_0x3e177c,_0x158a08,_0x69055f){var _0x8d027e={};var _0x5468dc={};var _0x232ae7;var _0x4e263c;return db[_0x8d4a('0x37')]['findOne']({'where':{'id':_0x3e177c['params']['id']}})[_0x8d4a('0x1e')](handleEntityNotFound(_0x158a08,null))[_0x8d4a('0x1e')](function(_0x54b79c){if(_0x54b79c){_0x232ae7=_0x54b79c;_0x5468dc[_0x8d4a('0x3c')]=_['keys'](db[_0x8d4a('0x55')][_0x8d4a('0x38')]);_0x5468dc[_0x8d4a('0x3d')]=_[_0x8d4a('0x3e')](_0x3e177c['query']);_0x5468dc['filters']=_[_0x8d4a('0x3f')](_0x5468dc['model'],_0x5468dc['query']);_0x8d027e[_0x8d4a('0x40')]=_[_0x8d4a('0x3f')](_0x5468dc[_0x8d4a('0x3c')],qs[_0x8d4a('0x41')](_0x3e177c[_0x8d4a('0x3d')][_0x8d4a('0x41')]));_0x8d027e[_0x8d4a('0x40')]=_0x8d027e[_0x8d4a('0x40')][_0x8d4a('0x4f')]?_0x8d027e[_0x8d4a('0x40')]:_0x5468dc['model'];_0x8d027e[_0x8d4a('0x45')]=qs[_0x8d4a('0x46')](_0x3e177c['query']['sort']);_0x8d027e[_0x8d4a('0x47')]=qs[_0x8d4a('0x48')](_[_0x8d4a('0x49')](_0x3e177c[_0x8d4a('0x3d')],_0x5468dc[_0x8d4a('0x48')]));if(_0x3e177c[_0x8d4a('0x3d')][_0x8d4a('0x4a')]){_0x8d027e['where']=_['merge'](_0x8d027e[_0x8d4a('0x47')],{'$or':_[_0x8d4a('0x36')](_0x8d027e[_0x8d4a('0x40')],function(_0x4308fd){var _0x32552a={};_0x32552a[_0x4308fd]={'$like':'%'+_0x3e177c[_0x8d4a('0x3d')]['filter']+'%'};return _0x32552a;})});}_0x8d027e=_[_0x8d4a('0x4b')]({},_0x8d027e,_0x3e177c[_0x8d4a('0x4c')]);return _0x232ae7[_0x8d4a('0x54')](_0x8d027e);}})['then'](function(_0x4d6503){if(_0x4d6503){_0x4e263c=_0x4d6503[_0x8d4a('0x4f')];if(!_0x3e177c[_0x8d4a('0x3d')][_0x8d4a('0x42')]('nolimit')){_0x8d027e[_0x8d4a('0x44')]=qs[_0x8d4a('0x44')](_0x3e177c['query'][_0x8d4a('0x44')]);_0x8d027e[_0x8d4a('0x2e')]=qs[_0x8d4a('0x2e')](_0x3e177c[_0x8d4a('0x3d')][_0x8d4a('0x2e')]);}return _0x232ae7[_0x8d4a('0x54')](_0x8d027e);}})[_0x8d4a('0x1e')](function(_0x3cb23d){if(_0x3cb23d){return _0x3cb23d?{'count':_0x4e263c,'rows':_0x3cb23d}:null;}})[_0x8d4a('0x1e')](respondWithResult(_0x158a08,null))[_0x8d4a('0x28')](handleError(_0x158a08,null));};exports['getSubjects']=function(_0x394bc6,_0x1cdc0b,_0x42bd04){var _0xa3539c={};var _0x244a33={};var _0x1a2128;var _0x4136dc;return db[_0x8d4a('0x37')][_0x8d4a('0x56')]({'where':{'id':_0x394bc6[_0x8d4a('0x4e')]['id']}})[_0x8d4a('0x1e')](handleEntityNotFound(_0x1cdc0b,null))[_0x8d4a('0x1e')](function(_0x221b98){if(_0x221b98){_0x1a2128=_0x221b98;_0x244a33[_0x8d4a('0x3c')]=_[_0x8d4a('0x3e')](db[_0x8d4a('0x55')][_0x8d4a('0x38')]);_0x244a33[_0x8d4a('0x3d')]=_['keys'](_0x394bc6[_0x8d4a('0x3d')]);_0x244a33[_0x8d4a('0x48')]=_[_0x8d4a('0x3f')](_0x244a33[_0x8d4a('0x3c')],_0x244a33['query']);_0xa3539c['attributes']=_[_0x8d4a('0x3f')](_0x244a33[_0x8d4a('0x3c')],qs['fields'](_0x394bc6[_0x8d4a('0x3d')][_0x8d4a('0x41')]));_0xa3539c[_0x8d4a('0x40')]=_0xa3539c[_0x8d4a('0x40')][_0x8d4a('0x4f')]?_0xa3539c[_0x8d4a('0x40')]:_0x244a33['model'];_0xa3539c[_0x8d4a('0x45')]=qs['sort'](_0x394bc6[_0x8d4a('0x3d')][_0x8d4a('0x46')]);_0xa3539c['where']=qs[_0x8d4a('0x48')](_['pick'](_0x394bc6[_0x8d4a('0x3d')],_0x244a33[_0x8d4a('0x48')]));if(_0x394bc6[_0x8d4a('0x3d')][_0x8d4a('0x4a')]){_0xa3539c[_0x8d4a('0x47')]=_[_0x8d4a('0x4b')](_0xa3539c[_0x8d4a('0x47')],{'$or':_['map'](_0xa3539c['attributes'],function(_0x3aa456){var _0x27f8d8={};_0x27f8d8[_0x3aa456]={'$like':'%'+_0x394bc6[_0x8d4a('0x3d')][_0x8d4a('0x4a')]+'%'};return _0x27f8d8;})});}_0xa3539c=_[_0x8d4a('0x4b')]({},_0xa3539c,_0x394bc6['options']);return _0x1a2128[_0x8d4a('0x57')](_0xa3539c);}})[_0x8d4a('0x1e')](function(_0x2b074e){if(_0x2b074e){_0x4136dc=_0x2b074e[_0x8d4a('0x4f')];if(!_0x394bc6[_0x8d4a('0x3d')][_0x8d4a('0x42')](_0x8d4a('0x43'))){_0xa3539c[_0x8d4a('0x44')]=qs[_0x8d4a('0x44')](_0x394bc6['query'][_0x8d4a('0x44')]);_0xa3539c[_0x8d4a('0x2e')]=qs[_0x8d4a('0x2e')](_0x394bc6['query'][_0x8d4a('0x2e')]);}return _0x1a2128[_0x8d4a('0x57')](_0xa3539c);}})[_0x8d4a('0x1e')](function(_0x26675e){if(_0x26675e){return _0x26675e?{'count':_0x4136dc,'rows':_0x26675e}:null;}})[_0x8d4a('0x1e')](respondWithResult(_0x1cdc0b,null))['catch'](handleError(_0x1cdc0b,null));};exports[_0x8d4a('0x58')]=function(_0x1c55ba,_0x38c29d,_0x59d5f3){var _0x5518f8={};var _0x1696cb={};var _0x187127;var _0x121adf;return db[_0x8d4a('0x37')][_0x8d4a('0x56')]({'where':{'id':_0x1c55ba[_0x8d4a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x38c29d,null))[_0x8d4a('0x1e')](function(_0x34e51e){if(_0x34e51e){_0x187127=_0x34e51e;_0x1696cb[_0x8d4a('0x3c')]=_['keys'](db[_0x8d4a('0x55')][_0x8d4a('0x38')]);_0x1696cb['query']=_['keys'](_0x1c55ba[_0x8d4a('0x3d')]);_0x1696cb[_0x8d4a('0x48')]=_[_0x8d4a('0x3f')](_0x1696cb['model'],_0x1696cb[_0x8d4a('0x3d')]);_0x5518f8['attributes']=_[_0x8d4a('0x3f')](_0x1696cb['model'],qs[_0x8d4a('0x41')](_0x1c55ba[_0x8d4a('0x3d')][_0x8d4a('0x41')]));_0x5518f8['attributes']=_0x5518f8[_0x8d4a('0x40')][_0x8d4a('0x4f')]?_0x5518f8[_0x8d4a('0x40')]:_0x1696cb[_0x8d4a('0x3c')];_0x5518f8[_0x8d4a('0x45')]=qs[_0x8d4a('0x46')](_0x1c55ba[_0x8d4a('0x3d')][_0x8d4a('0x46')]);_0x5518f8[_0x8d4a('0x47')]=qs[_0x8d4a('0x48')](_[_0x8d4a('0x49')](_0x1c55ba[_0x8d4a('0x3d')],_0x1696cb[_0x8d4a('0x48')]));if(_0x1c55ba[_0x8d4a('0x3d')][_0x8d4a('0x4a')]){_0x5518f8[_0x8d4a('0x47')]=_['merge'](_0x5518f8[_0x8d4a('0x47')],{'$or':_[_0x8d4a('0x36')](_0x5518f8[_0x8d4a('0x40')],function(_0x2ed182){var _0x29957b={};_0x29957b[_0x2ed182]={'$like':'%'+_0x1c55ba['query']['filter']+'%'};return _0x29957b;})});}_0x5518f8=_[_0x8d4a('0x4b')]({},_0x5518f8,_0x1c55ba[_0x8d4a('0x4c')]);return _0x187127['getDescriptions'](_0x5518f8);}})['then'](function(_0x423500){if(_0x423500){_0x121adf=_0x423500[_0x8d4a('0x4f')];if(!_0x1c55ba[_0x8d4a('0x3d')]['hasOwnProperty']('nolimit')){_0x5518f8[_0x8d4a('0x44')]=qs[_0x8d4a('0x44')](_0x1c55ba['query'][_0x8d4a('0x44')]);_0x5518f8[_0x8d4a('0x2e')]=qs[_0x8d4a('0x2e')](_0x1c55ba[_0x8d4a('0x3d')]['offset']);}return _0x187127[_0x8d4a('0x58')](_0x5518f8);}})[_0x8d4a('0x1e')](function(_0x595b1f){if(_0x595b1f){return _0x595b1f?{'count':_0x121adf,'rows':_0x595b1f}:null;}})[_0x8d4a('0x1e')](respondWithResult(_0x38c29d,null))[_0x8d4a('0x28')](handleError(_0x38c29d,null));}; \ No newline at end of file +var _0xbf5c=['catch','sendStatus','status','end','count','offset','set','json','reject','update','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','find','create','body','params','getFields','findOne','SugarcrmField','order','pick','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result'];(function(_0x96a34a,_0x48b3c6){var _0x4e325e=function(_0x20e343){while(--_0x20e343){_0x96a34a['push'](_0x96a34a['shift']());}};_0x4e325e(++_0x48b3c6);}(_0xbf5c,0x1f1));var _0xcbf5=function(_0xa1e14b,_0x1c4c77){_0xa1e14b=_0xa1e14b-0x0;var _0x360a88=_0xbf5c[_0xa1e14b];return _0x360a88;};'use strict';var pdf=require(_0xcbf5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcbf5('0x1'));var zipdir=require(_0xcbf5('0x2'));var jsonpatch=require(_0xcbf5('0x3'));var rp=require(_0xcbf5('0x4'));var moment=require('moment');var BPromise=require(_0xcbf5('0x5'));var Mustache=require(_0xcbf5('0x6'));var util=require(_0xcbf5('0x7'));var path=require(_0xcbf5('0x8'));var sox=require(_0xcbf5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcbf5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcbf5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcbf5('0xc'));var querystring=require(_0xcbf5('0xd'));var Papa=require(_0xcbf5('0xe'));var Redis=require(_0xcbf5('0xf'));var authService=require(_0xcbf5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcbf5('0x11'));var logger=require(_0xcbf5('0x12'))(_0xcbf5('0x13'));var utils=require(_0xcbf5('0x14'));var config=require('../../config/environment');var db=require(_0xcbf5('0x15'))['db'];var jayson=require(_0xcbf5('0x16'));var client=jayson[_0xcbf5('0x17')][_0xcbf5('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4ccacf,_0x407863,_0x3c5484){if(_0x3c5484){var _0x2125a6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2125a6[_0xcbf5('0x19')](_0x407863)){return _0x4ccacf;}else{throw new db[(_0xcbf5('0x1a'))][(_0xcbf5('0x1b'))](_0xcbf5('0x1c'));}}else{return _0x4ccacf;}}function respondWithRpcPromise(_0x195d0c,_0xa0510c,_0x3ef1dc,_0x2cc7ac){return new BPromise(function(_0x5bf8d2,_0x1c0942){var _0x216688=_0x2cc7ac||client;return _0x216688['request'](_0x195d0c,_0x3ef1dc)[_0xcbf5('0x1d')](function(_0x2ae444){logger['info'](_0xcbf5('0x1e'),_0xa0510c,'request\x20sent');logger[_0xcbf5('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xa0510c,_0xcbf5('0x20'),JSON[_0xcbf5('0x21')](_0x2ae444));if(_0x2ae444[_0xcbf5('0x22')]){if(_0x2ae444['error']['code']===0x1f4){logger[_0xcbf5('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xa0510c,_0x2ae444['error']['message']);return _0x1c0942(_0x2ae444['error']['message']);}logger[_0xcbf5('0x22')](_0xcbf5('0x1e'),_0xa0510c,_0x2ae444[_0xcbf5('0x22')][_0xcbf5('0x23')]);return _0x5bf8d2(_0x2ae444[_0xcbf5('0x22')][_0xcbf5('0x23')]);}else{logger['info'](_0xcbf5('0x1e'),_0xa0510c,_0xcbf5('0x20'));_0x5bf8d2(_0x2ae444[_0xcbf5('0x24')][_0xcbf5('0x23')]);}})[_0xcbf5('0x25')](function(_0x55b2d0){logger[_0xcbf5('0x22')](_0xcbf5('0x1e'),_0xa0510c,_0x55b2d0);_0x1c0942(_0x55b2d0);});});}function respondWithStatusCode(_0x4a6ad7,_0x1ed1b5){_0x1ed1b5=_0x1ed1b5||0xcc;return function(_0x3cb2db){if(_0x3cb2db){return _0x4a6ad7[_0xcbf5('0x26')](_0x1ed1b5);}return _0x4a6ad7[_0xcbf5('0x27')](_0x1ed1b5)[_0xcbf5('0x28')]();};}function respondWithResult(_0x532892,_0x5cf3e1){_0x5cf3e1=_0x5cf3e1||0xc8;return function(_0x5e8ca5){if(_0x5e8ca5){return _0x532892[_0xcbf5('0x27')](_0x5cf3e1)['json'](_0x5e8ca5);}};}function respondWithFilteredResult(_0x435c2a,_0x2f65cd){return function(_0x52dea3){if(_0x52dea3){var _0x2e40db=_0x52dea3[_0xcbf5('0x29')],_0x5a6a01=_0x2f65cd[_0xcbf5('0x2a')],_0x431e60=_0x2f65cd[_0xcbf5('0x2a')]+_0x2f65cd['limit'],_0x8c5af6;if(_0x431e60>=_0x2e40db){_0x431e60=_0x2e40db;_0x8c5af6=0xc8;}else{_0x8c5af6=0xce;}_0x435c2a[_0xcbf5('0x27')](_0x8c5af6);return _0x435c2a[_0xcbf5('0x2b')]('Content-Range',_0x5a6a01+'-'+_0x431e60+'/'+_0x2e40db)[_0xcbf5('0x2c')](_0x52dea3);}return null;};}function patchUpdates(_0x2053b4){return function(_0x18413d){try{jsonpatch['apply'](_0x18413d,_0x2053b4,!![]);}catch(_0x6875d){return BPromise[_0xcbf5('0x2d')](_0x6875d);}return _0x18413d['save']();};}function saveUpdates(_0x1ce319,_0x7f3430){return function(_0x1584a6){if(_0x1584a6){return _0x1584a6[_0xcbf5('0x2e')](_0x1ce319)[_0xcbf5('0x1d')](function(_0x3f3a81){return _0x3f3a81;});}return null;};}function removeEntity(_0xe6608d,_0x2b17cf){return function(_0x45f7d2){if(_0x45f7d2){return _0x45f7d2[_0xcbf5('0x2f')]()[_0xcbf5('0x1d')](function(){_0xe6608d[_0xcbf5('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b024,_0x17fab4){return function(_0x586e74){if(!_0x586e74){_0x16b024[_0xcbf5('0x26')](0x194);}return _0x586e74;};}function handleError(_0x255df3,_0x3a741a){_0x3a741a=_0x3a741a||0x1f4;return function(_0x4163ce){logger[_0xcbf5('0x22')](_0x4163ce[_0xcbf5('0x30')]);if(_0x4163ce[_0xcbf5('0x31')]){delete _0x4163ce[_0xcbf5('0x31')];}_0x255df3['status'](_0x3a741a)[_0xcbf5('0x32')](_0x4163ce);};}exports[_0xcbf5('0x33')]=function(_0x486936,_0x353ff4){var _0x37e0f6={},_0xdd0b86={},_0x2b6ef3={'count':0x0,'rows':[]};var _0x1154ef=_[_0xcbf5('0x34')](db[_0xcbf5('0x35')][_0xcbf5('0x36')],function(_0xd67a58){return{'name':_0xd67a58['fieldName'],'type':_0xd67a58[_0xcbf5('0x37')][_0xcbf5('0x38')]};});_0xdd0b86['model']=_['map'](_0x1154ef,_0xcbf5('0x31'));_0xdd0b86['query']=_[_0xcbf5('0x39')](_0x486936[_0xcbf5('0x3a')]);_0xdd0b86[_0xcbf5('0x3b')]=_[_0xcbf5('0x3c')](_0xdd0b86[_0xcbf5('0x3d')],_0xdd0b86[_0xcbf5('0x3a')]);_0x37e0f6[_0xcbf5('0x3e')]=_[_0xcbf5('0x3c')](_0xdd0b86['model'],qs[_0xcbf5('0x3f')](_0x486936[_0xcbf5('0x3a')][_0xcbf5('0x3f')]));_0x37e0f6[_0xcbf5('0x3e')]=_0x37e0f6[_0xcbf5('0x3e')][_0xcbf5('0x40')]?_0x37e0f6[_0xcbf5('0x3e')]:_0xdd0b86['model'];if(!_0x486936[_0xcbf5('0x3a')][_0xcbf5('0x41')](_0xcbf5('0x42'))){_0x37e0f6[_0xcbf5('0x43')]=qs[_0xcbf5('0x43')](_0x486936[_0xcbf5('0x3a')]['limit']);_0x37e0f6['offset']=qs[_0xcbf5('0x2a')](_0x486936[_0xcbf5('0x3a')][_0xcbf5('0x2a')]);}_0x37e0f6['order']=qs[_0xcbf5('0x44')](_0x486936['query'][_0xcbf5('0x44')]);_0x37e0f6[_0xcbf5('0x45')]=qs[_0xcbf5('0x3b')](_['pick'](_0x486936[_0xcbf5('0x3a')],_0xdd0b86[_0xcbf5('0x3b')]),_0x1154ef);if(_0x486936[_0xcbf5('0x3a')][_0xcbf5('0x46')]){_0x37e0f6[_0xcbf5('0x45')]=_[_0xcbf5('0x47')](_0x37e0f6['where'],{'$or':_[_0xcbf5('0x34')](_0x1154ef,function(_0x574735){if(_0x574735['type']!=='VIRTUAL'){var _0x1b2899={};_0x1b2899[_0x574735[_0xcbf5('0x31')]]={'$like':'%'+_0x486936['query'][_0xcbf5('0x46')]+'%'};return _0x1b2899;}})});}_0x37e0f6=_[_0xcbf5('0x47')]({},_0x37e0f6,_0x486936[_0xcbf5('0x48')]);var _0xd1cbdc={'where':_0x37e0f6[_0xcbf5('0x45')]};return db[_0xcbf5('0x35')][_0xcbf5('0x29')](_0xd1cbdc)[_0xcbf5('0x1d')](function(_0x1c70a9){_0x2b6ef3['count']=_0x1c70a9;if(_0x486936[_0xcbf5('0x3a')][_0xcbf5('0x49')]){_0x37e0f6[_0xcbf5('0x4a')]=[{'all':!![]}];}return db[_0xcbf5('0x35')][_0xcbf5('0x4b')](_0x37e0f6);})[_0xcbf5('0x1d')](function(_0x4577ee){_0x2b6ef3[_0xcbf5('0x4c')]=_0x4577ee;return _0x2b6ef3;})[_0xcbf5('0x1d')](respondWithFilteredResult(_0x353ff4,_0x37e0f6))[_0xcbf5('0x25')](handleError(_0x353ff4,null));};exports[_0xcbf5('0x4d')]=function(_0x3bda71,_0x2708b3){var _0x29a4ab={'raw':![],'where':{'id':_0x3bda71['params']['id']}},_0x4072af={};_0x4072af[_0xcbf5('0x3d')]=_[_0xcbf5('0x39')](db[_0xcbf5('0x35')]['rawAttributes']);_0x4072af['query']=_['keys'](_0x3bda71[_0xcbf5('0x3a')]);_0x4072af[_0xcbf5('0x3b')]=_[_0xcbf5('0x3c')](_0x4072af[_0xcbf5('0x3d')],_0x4072af[_0xcbf5('0x3a')]);_0x29a4ab[_0xcbf5('0x3e')]=_[_0xcbf5('0x3c')](_0x4072af[_0xcbf5('0x3d')],qs[_0xcbf5('0x3f')](_0x3bda71[_0xcbf5('0x3a')][_0xcbf5('0x3f')]));_0x29a4ab[_0xcbf5('0x3e')]=_0x29a4ab['attributes'][_0xcbf5('0x40')]?_0x29a4ab[_0xcbf5('0x3e')]:_0x4072af['model'];if(_0x3bda71[_0xcbf5('0x3a')]['includeAll']){_0x29a4ab[_0xcbf5('0x4a')]=[{'all':!![]}];}_0x29a4ab=_[_0xcbf5('0x47')]({},_0x29a4ab,_0x3bda71['options']);return db[_0xcbf5('0x35')][_0xcbf5('0x4e')](_0x29a4ab)['then'](handleEntityNotFound(_0x2708b3,null))['then'](respondWithResult(_0x2708b3,null))['catch'](handleError(_0x2708b3,null));};exports[_0xcbf5('0x4f')]=function(_0x4fc037,_0xab34a3){return db[_0xcbf5('0x35')][_0xcbf5('0x4f')](_0x4fc037[_0xcbf5('0x50')],{})['then'](respondWithResult(_0xab34a3,0xc9))[_0xcbf5('0x25')](handleError(_0xab34a3,null));};exports['update']=function(_0xb2a5c8,_0x5e484a){if(_0xb2a5c8[_0xcbf5('0x50')]['id']){delete _0xb2a5c8[_0xcbf5('0x50')]['id'];}return db[_0xcbf5('0x35')]['find']({'where':{'id':_0xb2a5c8['params']['id']}})[_0xcbf5('0x1d')](handleEntityNotFound(_0x5e484a,null))['then'](saveUpdates(_0xb2a5c8[_0xcbf5('0x50')],null))[_0xcbf5('0x1d')](respondWithResult(_0x5e484a,null))[_0xcbf5('0x25')](handleError(_0x5e484a,null));};exports[_0xcbf5('0x2f')]=function(_0x238c5f,_0x2e8f1c){return db[_0xcbf5('0x35')][_0xcbf5('0x4e')]({'where':{'id':_0x238c5f[_0xcbf5('0x51')]['id']}})[_0xcbf5('0x1d')](handleEntityNotFound(_0x2e8f1c,null))[_0xcbf5('0x1d')](removeEntity(_0x2e8f1c,null))[_0xcbf5('0x25')](handleError(_0x2e8f1c,null));};exports[_0xcbf5('0x52')]=function(_0x23af00,_0x54b6d7,_0x5886e9){var _0x3c50a0={};var _0x46e183={};var _0x42ef66;var _0x33f2f1;return db[_0xcbf5('0x35')][_0xcbf5('0x53')]({'where':{'id':_0x23af00[_0xcbf5('0x51')]['id']}})[_0xcbf5('0x1d')](handleEntityNotFound(_0x54b6d7,null))['then'](function(_0x4f6cf0){if(_0x4f6cf0){_0x42ef66=_0x4f6cf0;_0x46e183['model']=_[_0xcbf5('0x39')](db[_0xcbf5('0x54')][_0xcbf5('0x36')]);_0x46e183[_0xcbf5('0x3a')]=_['keys'](_0x23af00[_0xcbf5('0x3a')]);_0x46e183[_0xcbf5('0x3b')]=_['intersection'](_0x46e183[_0xcbf5('0x3d')],_0x46e183[_0xcbf5('0x3a')]);_0x3c50a0[_0xcbf5('0x3e')]=_[_0xcbf5('0x3c')](_0x46e183['model'],qs['fields'](_0x23af00['query'][_0xcbf5('0x3f')]));_0x3c50a0[_0xcbf5('0x3e')]=_0x3c50a0[_0xcbf5('0x3e')][_0xcbf5('0x40')]?_0x3c50a0[_0xcbf5('0x3e')]:_0x46e183[_0xcbf5('0x3d')];_0x3c50a0[_0xcbf5('0x55')]=qs[_0xcbf5('0x44')](_0x23af00[_0xcbf5('0x3a')]['sort']);_0x3c50a0['where']=qs[_0xcbf5('0x3b')](_[_0xcbf5('0x56')](_0x23af00[_0xcbf5('0x3a')],_0x46e183[_0xcbf5('0x3b')]));if(_0x23af00[_0xcbf5('0x3a')][_0xcbf5('0x46')]){_0x3c50a0[_0xcbf5('0x45')]=_[_0xcbf5('0x47')](_0x3c50a0[_0xcbf5('0x45')],{'$or':_['map'](_0x3c50a0[_0xcbf5('0x3e')],function(_0x30415e){var _0x1e0c20={};_0x1e0c20[_0x30415e]={'$like':'%'+_0x23af00[_0xcbf5('0x3a')][_0xcbf5('0x46')]+'%'};return _0x1e0c20;})});}_0x3c50a0=_[_0xcbf5('0x47')]({},_0x3c50a0,_0x23af00[_0xcbf5('0x48')]);return _0x42ef66[_0xcbf5('0x52')](_0x3c50a0);}})[_0xcbf5('0x1d')](function(_0x2dba75){if(_0x2dba75){_0x33f2f1=_0x2dba75[_0xcbf5('0x40')];if(!_0x23af00['query'][_0xcbf5('0x41')](_0xcbf5('0x42'))){_0x3c50a0[_0xcbf5('0x43')]=qs[_0xcbf5('0x43')](_0x23af00[_0xcbf5('0x3a')][_0xcbf5('0x43')]);_0x3c50a0[_0xcbf5('0x2a')]=qs[_0xcbf5('0x2a')](_0x23af00[_0xcbf5('0x3a')]['offset']);}return _0x42ef66[_0xcbf5('0x52')](_0x3c50a0);}})[_0xcbf5('0x1d')](function(_0x28f643){if(_0x28f643){return _0x28f643?{'count':_0x33f2f1,'rows':_0x28f643}:null;}})[_0xcbf5('0x1d')](respondWithResult(_0x54b6d7,null))['catch'](handleError(_0x54b6d7,null));};exports['getSubjects']=function(_0x5b636f,_0x45ad84,_0x3f4966){var _0x393ee1={};var _0x35c988={};var _0x39d531;var _0x4ac8d9;return db[_0xcbf5('0x35')][_0xcbf5('0x53')]({'where':{'id':_0x5b636f[_0xcbf5('0x51')]['id']}})['then'](handleEntityNotFound(_0x45ad84,null))[_0xcbf5('0x1d')](function(_0x5dd1b2){if(_0x5dd1b2){_0x39d531=_0x5dd1b2;_0x35c988['model']=_[_0xcbf5('0x39')](db[_0xcbf5('0x54')][_0xcbf5('0x36')]);_0x35c988[_0xcbf5('0x3a')]=_[_0xcbf5('0x39')](_0x5b636f[_0xcbf5('0x3a')]);_0x35c988[_0xcbf5('0x3b')]=_[_0xcbf5('0x3c')](_0x35c988[_0xcbf5('0x3d')],_0x35c988['query']);_0x393ee1[_0xcbf5('0x3e')]=_[_0xcbf5('0x3c')](_0x35c988['model'],qs[_0xcbf5('0x3f')](_0x5b636f[_0xcbf5('0x3a')][_0xcbf5('0x3f')]));_0x393ee1[_0xcbf5('0x3e')]=_0x393ee1[_0xcbf5('0x3e')][_0xcbf5('0x40')]?_0x393ee1[_0xcbf5('0x3e')]:_0x35c988[_0xcbf5('0x3d')];_0x393ee1[_0xcbf5('0x55')]=qs['sort'](_0x5b636f[_0xcbf5('0x3a')][_0xcbf5('0x44')]);_0x393ee1['where']=qs[_0xcbf5('0x3b')](_['pick'](_0x5b636f['query'],_0x35c988[_0xcbf5('0x3b')]));if(_0x5b636f['query']['filter']){_0x393ee1[_0xcbf5('0x45')]=_[_0xcbf5('0x47')](_0x393ee1[_0xcbf5('0x45')],{'$or':_['map'](_0x393ee1['attributes'],function(_0x3a82fe){var _0x5331f3={};_0x5331f3[_0x3a82fe]={'$like':'%'+_0x5b636f[_0xcbf5('0x3a')][_0xcbf5('0x46')]+'%'};return _0x5331f3;})});}_0x393ee1=_[_0xcbf5('0x47')]({},_0x393ee1,_0x5b636f[_0xcbf5('0x48')]);return _0x39d531[_0xcbf5('0x57')](_0x393ee1);}})['then'](function(_0x5ba2f6){if(_0x5ba2f6){_0x4ac8d9=_0x5ba2f6[_0xcbf5('0x40')];if(!_0x5b636f['query'][_0xcbf5('0x41')]('nolimit')){_0x393ee1[_0xcbf5('0x43')]=qs[_0xcbf5('0x43')](_0x5b636f[_0xcbf5('0x3a')][_0xcbf5('0x43')]);_0x393ee1[_0xcbf5('0x2a')]=qs[_0xcbf5('0x2a')](_0x5b636f['query']['offset']);}return _0x39d531[_0xcbf5('0x57')](_0x393ee1);}})[_0xcbf5('0x1d')](function(_0x5179c2){if(_0x5179c2){return _0x5179c2?{'count':_0x4ac8d9,'rows':_0x5179c2}:null;}})['then'](respondWithResult(_0x45ad84,null))[_0xcbf5('0x25')](handleError(_0x45ad84,null));};exports['getDescriptions']=function(_0x558e39,_0x2636c3,_0x216315){var _0x1a5d89={};var _0xf03741={};var _0x33a4e8;var _0x5940d6;return db[_0xcbf5('0x35')]['findOne']({'where':{'id':_0x558e39[_0xcbf5('0x51')]['id']}})[_0xcbf5('0x1d')](handleEntityNotFound(_0x2636c3,null))['then'](function(_0x4d65cc){if(_0x4d65cc){_0x33a4e8=_0x4d65cc;_0xf03741['model']=_[_0xcbf5('0x39')](db[_0xcbf5('0x54')][_0xcbf5('0x36')]);_0xf03741[_0xcbf5('0x3a')]=_['keys'](_0x558e39['query']);_0xf03741[_0xcbf5('0x3b')]=_[_0xcbf5('0x3c')](_0xf03741[_0xcbf5('0x3d')],_0xf03741[_0xcbf5('0x3a')]);_0x1a5d89[_0xcbf5('0x3e')]=_['intersection'](_0xf03741[_0xcbf5('0x3d')],qs['fields'](_0x558e39[_0xcbf5('0x3a')][_0xcbf5('0x3f')]));_0x1a5d89[_0xcbf5('0x3e')]=_0x1a5d89[_0xcbf5('0x3e')][_0xcbf5('0x40')]?_0x1a5d89['attributes']:_0xf03741[_0xcbf5('0x3d')];_0x1a5d89[_0xcbf5('0x55')]=qs[_0xcbf5('0x44')](_0x558e39['query']['sort']);_0x1a5d89['where']=qs[_0xcbf5('0x3b')](_[_0xcbf5('0x56')](_0x558e39[_0xcbf5('0x3a')],_0xf03741[_0xcbf5('0x3b')]));if(_0x558e39[_0xcbf5('0x3a')][_0xcbf5('0x46')]){_0x1a5d89[_0xcbf5('0x45')]=_['merge'](_0x1a5d89[_0xcbf5('0x45')],{'$or':_['map'](_0x1a5d89['attributes'],function(_0x3c8e51){var _0x422428={};_0x422428[_0x3c8e51]={'$like':'%'+_0x558e39[_0xcbf5('0x3a')][_0xcbf5('0x46')]+'%'};return _0x422428;})});}_0x1a5d89=_[_0xcbf5('0x47')]({},_0x1a5d89,_0x558e39['options']);return _0x33a4e8[_0xcbf5('0x58')](_0x1a5d89);}})[_0xcbf5('0x1d')](function(_0x419302){if(_0x419302){_0x5940d6=_0x419302[_0xcbf5('0x40')];if(!_0x558e39[_0xcbf5('0x3a')][_0xcbf5('0x41')](_0xcbf5('0x42'))){_0x1a5d89[_0xcbf5('0x43')]=qs['limit'](_0x558e39['query'][_0xcbf5('0x43')]);_0x1a5d89[_0xcbf5('0x2a')]=qs[_0xcbf5('0x2a')](_0x558e39[_0xcbf5('0x3a')]['offset']);}return _0x33a4e8[_0xcbf5('0x58')](_0x1a5d89);}})['then'](function(_0x53456b){if(_0x53456b){return _0x53456b?{'count':_0x5940d6,'rows':_0x53456b}:null;}})[_0xcbf5('0x1d')](respondWithResult(_0x2636c3,null))[_0xcbf5('0x25')](handleError(_0x2636c3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index afbd174..e359b9a 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 _0x0fb7=['./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4085c5,_0x5615b6){var _0xee1c3d=function(_0x8ad49b){while(--_0x8ad49b){_0x4085c5['push'](_0x4085c5['shift']());}};_0xee1c3d(++_0x5615b6);}(_0x0fb7,0x15f));var _0x70fb=function(_0x40ce01,_0x1e39c8){_0x40ce01=_0x40ce01-0x0;var _0xa0f16e=_0x0fb7[_0x40ce01];return _0xa0f16e;};'use strict';var _=require(_0x70fb('0x0'));var util=require(_0x70fb('0x1'));var logger=require(_0x70fb('0x2'))(_0x70fb('0x3'));var moment=require(_0x70fb('0x4'));var BPromise=require(_0x70fb('0x5'));var rp=require(_0x70fb('0x6'));var fs=require('fs');var path=require(_0x70fb('0x7'));var rimraf=require(_0x70fb('0x8'));var config=require('../../config/environment');var attributes=require(_0x70fb('0x9'));module['exports']=function(_0x9f19c3,_0x327c32){return _0x9f19c3['define'](_0x70fb('0xa'),attributes,{'tableName':_0x70fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86be=['path','../../config/environment','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x33ca16,_0x1365f3){var _0x7dc0cf=function(_0x434a78){while(--_0x434a78){_0x33ca16['push'](_0x33ca16['shift']());}};_0x7dc0cf(++_0x1365f3);}(_0x86be,0xea));var _0xe86b=function(_0x53687c,_0x346398){_0x53687c=_0x53687c-0x0;var _0x3fb8f2=_0x86be[_0x53687c];return _0x3fb8f2;};'use strict';var _=require(_0xe86b('0x0'));var util=require(_0xe86b('0x1'));var logger=require(_0xe86b('0x2'))('api');var moment=require(_0xe86b('0x3'));var BPromise=require(_0xe86b('0x4'));var rp=require(_0xe86b('0x5'));var fs=require('fs');var path=require(_0xe86b('0x6'));var rimraf=require('rimraf');var config=require(_0xe86b('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x2f8de8,_0x223d58){return _0x2f8de8['define'](_0xe86b('0x8'),attributes,{'tableName':_0xe86b('0x9'),'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 059ee5b..39f358a 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 _0xb415=['../../config/environment','client','http','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','rpc'];(function(_0x54be7c,_0x149e75){var _0x46d170=function(_0x49098e){while(--_0x49098e){_0x54be7c['push'](_0x54be7c['shift']());}};_0x46d170(++_0x149e75);}(_0xb415,0x14e));var _0x5b41=function(_0x3c3b14,_0x1a06c3){_0x3c3b14=_0x3c3b14-0x0;var _0x449c3c=_0xb415[_0x3c3b14];return _0x449c3c;};'use strict';var _=require(_0x5b41('0x0'));var util=require(_0x5b41('0x1'));var moment=require(_0x5b41('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b41('0x3'));var fs=require('fs');var Redis=require(_0x5b41('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b41('0x5'));var config=require(_0x5b41('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5b41('0x7')][_0x5b41('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xece942,_0x8a9260,_0x10d08c){return new BPromise(function(_0x4fafb5,_0x106374){return client['request'](_0xece942,_0x10d08c)['then'](function(_0x302641){logger['info'](_0x5b41('0x9'),_0x8a9260,'request\x20sent');logger[_0x5b41('0xa')](_0x5b41('0xb'),_0x8a9260,_0x5b41('0xc'),JSON[_0x5b41('0xd')](_0x302641));if(_0x302641[_0x5b41('0xe')]){if(_0x302641[_0x5b41('0xe')][_0x5b41('0xf')]===0x1f4){logger['error'](_0x5b41('0x9'),_0x8a9260,_0x302641[_0x5b41('0xe')][_0x5b41('0x10')]);return _0x106374(_0x302641[_0x5b41('0xe')][_0x5b41('0x10')]);}logger[_0x5b41('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x8a9260,_0x302641['error'][_0x5b41('0x10')]);return _0x4fafb5(_0x302641['error'][_0x5b41('0x10')]);}else{logger[_0x5b41('0x11')](_0x5b41('0x9'),_0x8a9260,_0x5b41('0xc'));_0x4fafb5(_0x302641[_0x5b41('0x12')]['message']);}})[_0x5b41('0x13')](function(_0x447b28){logger[_0x5b41('0xe')](_0x5b41('0x9'),_0x8a9260,_0x447b28);_0x106374(_0x447b28);});});} \ No newline at end of file +var _0x4ca3=['request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5d7c8a,_0x2cf80c){var _0x4757d6=function(_0x564e66){while(--_0x564e66){_0x5d7c8a['push'](_0x5d7c8a['shift']());}};_0x4757d6(++_0x2cf80c);}(_0x4ca3,0x136));var _0x34ca=function(_0x22dc3e,_0x39ab8d){_0x22dc3e=_0x22dc3e-0x0;var _0x38eb6c=_0x4ca3[_0x22dc3e];return _0x38eb6c;};'use strict';var _=require('lodash');var util=require(_0x34ca('0x0'));var moment=require('moment');var BPromise=require(_0x34ca('0x1'));var rs=require(_0x34ca('0x2'));var fs=require('fs');var Redis=require(_0x34ca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ca('0x4'));var logger=require(_0x34ca('0x5'))('rpc');var config=require(_0x34ca('0x6'));var jayson=require(_0x34ca('0x7'));var client=jayson[_0x34ca('0x8')][_0x34ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x192b8f,_0x38b1a4,_0x254a64){return new BPromise(function(_0x6dc691,_0x3bc6dd){return client[_0x34ca('0xa')](_0x192b8f,_0x254a64)[_0x34ca('0xb')](function(_0x36a1a5){logger['info'](_0x34ca('0xc'),_0x38b1a4,_0x34ca('0xd'));logger[_0x34ca('0xe')](_0x34ca('0xf'),_0x38b1a4,'request\x20sent',JSON['stringify'](_0x36a1a5));if(_0x36a1a5[_0x34ca('0x10')]){if(_0x36a1a5[_0x34ca('0x10')]['code']===0x1f4){logger[_0x34ca('0x10')](_0x34ca('0xc'),_0x38b1a4,_0x36a1a5[_0x34ca('0x10')]['message']);return _0x3bc6dd(_0x36a1a5['error'][_0x34ca('0x11')]);}logger[_0x34ca('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x38b1a4,_0x36a1a5[_0x34ca('0x10')][_0x34ca('0x11')]);return _0x6dc691(_0x36a1a5[_0x34ca('0x10')][_0x34ca('0x11')]);}else{logger[_0x34ca('0x12')](_0x34ca('0xc'),_0x38b1a4,_0x34ca('0xd'));_0x6dc691(_0x36a1a5['result'][_0x34ca('0x11')]);}})[_0x34ca('0x13')](function(_0x22d6f5){logger[_0x34ca('0x10')](_0x34ca('0xc'),_0x38b1a4,_0x22d6f5);_0x3bc6dd(_0x22d6f5);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a0c75ab..ec81bb2 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 _0xe098=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete','destroy'];(function(_0x2fe7b0,_0x39c02b){var _0x456c3d=function(_0x44041e){while(--_0x44041e){_0x2fe7b0['push'](_0x2fe7b0['shift']());}};_0x456c3d(++_0x39c02b);}(_0xe098,0x86));var _0x8e09=function(_0x250874,_0x325a24){_0x250874=_0x250874-0x0;var _0xca89=_0xe098[_0x250874];return _0xca89;};'use strict';var multer=require(_0x8e09('0x0'));var util=require(_0x8e09('0x1'));var path=require('path');var timeout=require(_0x8e09('0x2'));var express=require('express');var router=express[_0x8e09('0x3')]();var auth=require(_0x8e09('0x4'));var interaction=require(_0x8e09('0x5'));var config=require(_0x8e09('0x6'));var controller=require(_0x8e09('0x7'));router[_0x8e09('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e09('0x9')]);router['get']('/:id',auth[_0x8e09('0xa')](),controller[_0x8e09('0xb')]);router[_0x8e09('0xc')]('/',auth[_0x8e09('0xa')](),controller[_0x8e09('0xd')]);router[_0x8e09('0xe')](_0x8e09('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8e09('0x10')]('/:id',auth[_0x8e09('0xa')](),controller[_0x8e09('0x11')]);module[_0x8e09('0x12')]=router; \ No newline at end of file +var _0xa5f3=['post','create','/:id','delete','destroy','multer','util','./intSugarcrmField.controller','get','isAuthenticated','index','show'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa5f3,0x16d));var _0x3a5f=function(_0x48042f,_0x590844){_0x48042f=_0x48042f-0x0;var _0x143891=_0xa5f3[_0x48042f];return _0x143891;};'use strict';var multer=require(_0x3a5f('0x0'));var util=require(_0x3a5f('0x1'));var path=require('path');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('../../config/environment');var controller=require(_0x3a5f('0x2'));router[_0x3a5f('0x3')]('/',auth[_0x3a5f('0x4')](),controller[_0x3a5f('0x5')]);router[_0x3a5f('0x3')]('/:id',auth[_0x3a5f('0x4')](),controller[_0x3a5f('0x6')]);router[_0x3a5f('0x7')]('/',auth[_0x3a5f('0x4')](),controller[_0x3a5f('0x8')]);router['put'](_0x3a5f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3a5f('0xa')]('/:id',auth[_0x3a5f('0x4')](),controller[_0x3a5f('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8fb9894..8cd378d 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 _0x7a59=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a59,0x16e));var _0x97a5=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x7a59[_0xcd0918];return _0x250704;};'use strict';var Sequelize=require(_0x97a5('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x97a5('0x1'),_0x97a5('0x2'),_0x97a5('0x3'),_0x97a5('0x4')),'defaultValue':_0x97a5('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x97a5('0x5')]},'keyType':{'type':Sequelize[_0x97a5('0x6')](_0x97a5('0x1'),'variable',_0x97a5('0x3'))},'keyContent':{'type':Sequelize[_0x97a5('0x5')]},'idField':{'type':Sequelize[_0x97a5('0x5')]},'nameField':{'type':Sequelize[_0x97a5('0x5')]},'customField':{'type':Sequelize[_0x97a5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x97a5('0x5')]}}; \ No newline at end of file +var _0xbd50=['ENUM','variable','customVariable','keyValue','string','STRING','sequelize','exports'];(function(_0x23a39e,_0x746eb9){var _0x24b30f=function(_0x239e0d){while(--_0x239e0d){_0x23a39e['push'](_0x23a39e['shift']());}};_0x24b30f(++_0x746eb9);}(_0xbd50,0x196));var _0x0bd5=function(_0x4fdf4b,_0x937091){_0x4fdf4b=_0x4fdf4b-0x0;var _0x257469=_0xbd50[_0x4fdf4b];return _0x257469;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'type':{'type':Sequelize[_0x0bd5('0x2')]('string',_0x0bd5('0x3'),_0x0bd5('0x4'),_0x0bd5('0x5')),'defaultValue':_0x0bd5('0x6')},'content':{'type':Sequelize[_0x0bd5('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x0bd5('0x3'),_0x0bd5('0x4'))},'keyContent':{'type':Sequelize[_0x0bd5('0x7')]},'idField':{'type':Sequelize[_0x0bd5('0x7')]},'nameField':{'type':Sequelize[_0x0bd5('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 10d6d3b..1eedf0d 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 _0xad5f=['SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','options','create','body','find','params','catch','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xad5f,0x150));var _0xfad5=function(_0x54e631,_0x3b8396){_0x54e631=_0x54e631-0x0;var _0x3c6b6a=_0xad5f[_0x54e631];return _0x3c6b6a;};'use strict';var pdf=require(_0xfad5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfad5('0x1'));var zipdir=require(_0xfad5('0x2'));var jsonpatch=require(_0xfad5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfad5('0x4'));var Mustache=require('mustache');var util=require(_0xfad5('0x5'));var path=require(_0xfad5('0x6'));var sox=require(_0xfad5('0x7'));var csv=require(_0xfad5('0x8'));var ejs=require(_0xfad5('0x9'));var fs=require('fs');var _=require(_0xfad5('0xa'));var squel=require(_0xfad5('0xb'));var crypto=require(_0xfad5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfad5('0xd'));var toCsv=require(_0xfad5('0x8'));var querystring=require(_0xfad5('0xe'));var Papa=require(_0xfad5('0xf'));var Redis=require(_0xfad5('0x10'));var authService=require(_0xfad5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfad5('0x12'));var hardwareService=require(_0xfad5('0x13'));var logger=require(_0xfad5('0x14'))(_0xfad5('0x15'));var utils=require(_0xfad5('0x16'));var config=require(_0xfad5('0x17'));var db=require(_0xfad5('0x18'))['db'];function respondWithStatusCode(_0x78dcce,_0x2657a9){_0x2657a9=_0x2657a9||0xcc;return function(_0x5d8664){if(_0x5d8664){return _0x78dcce[_0xfad5('0x19')](_0x2657a9);}return _0x78dcce[_0xfad5('0x1a')](_0x2657a9)[_0xfad5('0x1b')]();};}function respondWithResult(_0xddc4d5,_0x65fd51){_0x65fd51=_0x65fd51||0xc8;return function(_0x536018){if(_0x536018){return _0xddc4d5[_0xfad5('0x1a')](_0x65fd51)['json'](_0x536018);}};}function respondWithFilteredResult(_0x3f3334,_0x50923b){return function(_0x304814){if(_0x304814){var _0x114b75=_0x304814[_0xfad5('0x1c')],_0x5c08b9=_0x50923b[_0xfad5('0x1d')],_0xecd6cc=_0x50923b[_0xfad5('0x1d')]+_0x50923b[_0xfad5('0x1e')],_0x17bbbb;if(_0xecd6cc>=_0x114b75){_0xecd6cc=_0x114b75;_0x17bbbb=0xc8;}else{_0x17bbbb=0xce;}_0x3f3334[_0xfad5('0x1a')](_0x17bbbb);return _0x3f3334[_0xfad5('0x1f')](_0xfad5('0x20'),_0x5c08b9+'-'+_0xecd6cc+'/'+_0x114b75)['json'](_0x304814);}return null;};}function patchUpdates(_0x5ecd60){return function(_0x26bb2b){try{jsonpatch['apply'](_0x26bb2b,_0x5ecd60,!![]);}catch(_0x555dd6){return BPromise[_0xfad5('0x21')](_0x555dd6);}return _0x26bb2b[_0xfad5('0x22')]();};}function saveUpdates(_0x447ecf,_0x44d879){return function(_0x54bdf1){if(_0x54bdf1){return _0x54bdf1[_0xfad5('0x23')](_0x447ecf)[_0xfad5('0x24')](function(_0x56e320){return _0x56e320;});}return null;};}function removeEntity(_0x250e4e,_0x5cf8ae){return function(_0x2a7412){if(_0x2a7412){return _0x2a7412[_0xfad5('0x25')]()[_0xfad5('0x24')](function(){_0x250e4e[_0xfad5('0x1a')](0xcc)[_0xfad5('0x1b')]();});}};}function handleEntityNotFound(_0x4a6bdb,_0x62bcb8){return function(_0x4fbf41){if(!_0x4fbf41){_0x4a6bdb[_0xfad5('0x19')](0x194);}return _0x4fbf41;};}function handleError(_0x586d8a,_0x3ee1da){_0x3ee1da=_0x3ee1da||0x1f4;return function(_0x56cc21){logger[_0xfad5('0x26')](_0x56cc21[_0xfad5('0x27')]);if(_0x56cc21[_0xfad5('0x28')]){delete _0x56cc21[_0xfad5('0x28')];}_0x586d8a[_0xfad5('0x1a')](_0x3ee1da)[_0xfad5('0x29')](_0x56cc21);};}exports[_0xfad5('0x2a')]=function(_0x45aae3,_0x211d90){var _0x3d726c={},_0x759f15={},_0x1e7111={'count':0x0,'rows':[]};var _0x5df8c3=_[_0xfad5('0x2b')](db[_0xfad5('0x2c')][_0xfad5('0x2d')],function(_0x501b94){return{'name':_0x501b94[_0xfad5('0x2e')],'type':_0x501b94[_0xfad5('0x2f')][_0xfad5('0x30')]};});_0x759f15[_0xfad5('0x31')]=_['map'](_0x5df8c3,'name');_0x759f15[_0xfad5('0x32')]=_[_0xfad5('0x33')](_0x45aae3['query']);_0x759f15['filters']=_[_0xfad5('0x34')](_0x759f15['model'],_0x759f15[_0xfad5('0x32')]);_0x3d726c[_0xfad5('0x35')]=_[_0xfad5('0x34')](_0x759f15[_0xfad5('0x31')],qs[_0xfad5('0x36')](_0x45aae3[_0xfad5('0x32')][_0xfad5('0x36')]));_0x3d726c[_0xfad5('0x35')]=_0x3d726c['attributes'][_0xfad5('0x37')]?_0x3d726c['attributes']:_0x759f15[_0xfad5('0x31')];if(!_0x45aae3[_0xfad5('0x32')][_0xfad5('0x38')](_0xfad5('0x39'))){_0x3d726c[_0xfad5('0x1e')]=qs['limit'](_0x45aae3[_0xfad5('0x32')][_0xfad5('0x1e')]);_0x3d726c[_0xfad5('0x1d')]=qs[_0xfad5('0x1d')](_0x45aae3[_0xfad5('0x32')]['offset']);}_0x3d726c[_0xfad5('0x3a')]=qs[_0xfad5('0x3b')](_0x45aae3['query']['sort']);_0x3d726c[_0xfad5('0x3c')]=qs[_0xfad5('0x3d')](_[_0xfad5('0x3e')](_0x45aae3[_0xfad5('0x32')],_0x759f15[_0xfad5('0x3d')]),_0x5df8c3);if(_0x45aae3['query']['filter']){_0x3d726c[_0xfad5('0x3c')]=_[_0xfad5('0x3f')](_0x3d726c[_0xfad5('0x3c')],{'$or':_['map'](_0x5df8c3,function(_0x3c472e){if(_0x3c472e[_0xfad5('0x2f')]!==_0xfad5('0x40')){var _0x57a228={};_0x57a228[_0x3c472e[_0xfad5('0x28')]]={'$like':'%'+_0x45aae3[_0xfad5('0x32')][_0xfad5('0x41')]+'%'};return _0x57a228;}})});}_0x3d726c=_['merge']({},_0x3d726c,_0x45aae3['options']);var _0x58ada0={'where':_0x3d726c[_0xfad5('0x3c')]};return db['SugarcrmField'][_0xfad5('0x1c')](_0x58ada0)[_0xfad5('0x24')](function(_0xdb9d4d){_0x1e7111['count']=_0xdb9d4d;if(_0x45aae3[_0xfad5('0x32')][_0xfad5('0x42')]){_0x3d726c[_0xfad5('0x43')]=[{'all':!![]}];}return db[_0xfad5('0x2c')][_0xfad5('0x44')](_0x3d726c);})[_0xfad5('0x24')](function(_0x4a825f){_0x1e7111[_0xfad5('0x45')]=_0x4a825f;return _0x1e7111;})['then'](respondWithFilteredResult(_0x211d90,_0x3d726c))['catch'](handleError(_0x211d90,null));};exports['show']=function(_0x16ec68,_0x84db55){var _0x561ecc={'raw':!![],'where':{'id':_0x16ec68['params']['id']}},_0x4eb6e4={};_0x4eb6e4[_0xfad5('0x31')]=_[_0xfad5('0x33')](db[_0xfad5('0x2c')]['rawAttributes']);_0x4eb6e4[_0xfad5('0x32')]=_[_0xfad5('0x33')](_0x16ec68[_0xfad5('0x32')]);_0x4eb6e4[_0xfad5('0x3d')]=_['intersection'](_0x4eb6e4['model'],_0x4eb6e4['query']);_0x561ecc[_0xfad5('0x35')]=_[_0xfad5('0x34')](_0x4eb6e4[_0xfad5('0x31')],qs['fields'](_0x16ec68[_0xfad5('0x32')]['fields']));_0x561ecc['attributes']=_0x561ecc['attributes'][_0xfad5('0x37')]?_0x561ecc['attributes']:_0x4eb6e4['model'];if(_0x16ec68['query'][_0xfad5('0x42')]){_0x561ecc[_0xfad5('0x43')]=[{'all':!![]}];}_0x561ecc=_['merge']({},_0x561ecc,_0x16ec68[_0xfad5('0x46')]);return db[_0xfad5('0x2c')]['find'](_0x561ecc)[_0xfad5('0x24')](handleEntityNotFound(_0x84db55,null))[_0xfad5('0x24')](respondWithResult(_0x84db55,null))['catch'](handleError(_0x84db55,null));};exports[_0xfad5('0x47')]=function(_0x4bbaad,_0xc234a2){return db[_0xfad5('0x2c')][_0xfad5('0x47')](_0x4bbaad['body'],{})[_0xfad5('0x24')](respondWithResult(_0xc234a2,0xc9))['catch'](handleError(_0xc234a2,null));};exports[_0xfad5('0x23')]=function(_0x4d6f87,_0x7daa55){if(_0x4d6f87[_0xfad5('0x48')]['id']){delete _0x4d6f87[_0xfad5('0x48')]['id'];}return db['SugarcrmField'][_0xfad5('0x49')]({'where':{'id':_0x4d6f87[_0xfad5('0x4a')]['id']}})[_0xfad5('0x24')](handleEntityNotFound(_0x7daa55,null))[_0xfad5('0x24')](saveUpdates(_0x4d6f87[_0xfad5('0x48')],null))[_0xfad5('0x24')](respondWithResult(_0x7daa55,null))[_0xfad5('0x4b')](handleError(_0x7daa55,null));};exports['destroy']=function(_0x480bb3,_0x3bf6b8){return db[_0xfad5('0x2c')]['find']({'where':{'id':_0x480bb3[_0xfad5('0x4a')]['id']}})[_0xfad5('0x24')](handleEntityNotFound(_0x3bf6b8,null))[_0xfad5('0x24')](removeEntity(_0x3bf6b8,null))[_0xfad5('0x4b')](handleError(_0x3bf6b8,null));}; \ No newline at end of file +var _0x1098=['sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','update','then','end'];(function(_0x4d2b72,_0xddc780){var _0x59a924=function(_0xbb996e){while(--_0xbb996e){_0x4d2b72['push'](_0x4d2b72['shift']());}};_0x59a924(++_0xddc780);}(_0x1098,0x72));var _0x8109=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1098[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8109('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8109('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8109('0x2'));var moment=require('moment');var BPromise=require(_0x8109('0x3'));var Mustache=require(_0x8109('0x4'));var util=require('util');var path=require(_0x8109('0x5'));var sox=require(_0x8109('0x6'));var csv=require(_0x8109('0x7'));var ejs=require(_0x8109('0x8'));var fs=require('fs');var _=require(_0x8109('0x9'));var squel=require(_0x8109('0xa'));var crypto=require(_0x8109('0xb'));var jsforce=require(_0x8109('0xc'));var deskjs=require(_0x8109('0xd'));var toCsv=require(_0x8109('0x7'));var querystring=require(_0x8109('0xe'));var Papa=require(_0x8109('0xf'));var Redis=require(_0x8109('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8109('0x11'));var as=require(_0x8109('0x12'));var hardwareService=require(_0x8109('0x13'));var logger=require(_0x8109('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8109('0x15'));var db=require(_0x8109('0x16'))['db'];function respondWithStatusCode(_0x35934d,_0x3b871b){_0x3b871b=_0x3b871b||0xcc;return function(_0x22ed27){if(_0x22ed27){return _0x35934d['sendStatus'](_0x3b871b);}return _0x35934d[_0x8109('0x17')](_0x3b871b)['end']();};}function respondWithResult(_0x2fe76c,_0x54c2a9){_0x54c2a9=_0x54c2a9||0xc8;return function(_0x5cd47b){if(_0x5cd47b){return _0x2fe76c[_0x8109('0x17')](_0x54c2a9)[_0x8109('0x18')](_0x5cd47b);}};}function respondWithFilteredResult(_0x18c7e6,_0x2a5ff8){return function(_0xff501a){if(_0xff501a){var _0x30ce0b=_0xff501a['count'],_0x106145=_0x2a5ff8[_0x8109('0x19')],_0x1a9484=_0x2a5ff8[_0x8109('0x19')]+_0x2a5ff8[_0x8109('0x1a')],_0x20d915;if(_0x1a9484>=_0x30ce0b){_0x1a9484=_0x30ce0b;_0x20d915=0xc8;}else{_0x20d915=0xce;}_0x18c7e6[_0x8109('0x17')](_0x20d915);return _0x18c7e6[_0x8109('0x1b')](_0x8109('0x1c'),_0x106145+'-'+_0x1a9484+'/'+_0x30ce0b)['json'](_0xff501a);}return null;};}function patchUpdates(_0x2b4687){return function(_0x2ff1b1){try{jsonpatch['apply'](_0x2ff1b1,_0x2b4687,!![]);}catch(_0x19d2cf){return BPromise['reject'](_0x19d2cf);}return _0x2ff1b1['save']();};}function saveUpdates(_0x2d1606,_0x1266d4){return function(_0x3c2788){if(_0x3c2788){return _0x3c2788[_0x8109('0x1d')](_0x2d1606)[_0x8109('0x1e')](function(_0x2d7281){return _0x2d7281;});}return null;};}function removeEntity(_0x5c64e2,_0x247447){return function(_0x193d0a){if(_0x193d0a){return _0x193d0a['destroy']()['then'](function(){_0x5c64e2[_0x8109('0x17')](0xcc)[_0x8109('0x1f')]();});}};}function handleEntityNotFound(_0x230a83,_0x48b8b9){return function(_0x1ee386){if(!_0x1ee386){_0x230a83[_0x8109('0x20')](0x194);}return _0x1ee386;};}function handleError(_0x5645f0,_0x587f97){_0x587f97=_0x587f97||0x1f4;return function(_0x5a291d){logger[_0x8109('0x21')](_0x5a291d[_0x8109('0x22')]);if(_0x5a291d[_0x8109('0x23')]){delete _0x5a291d[_0x8109('0x23')];}_0x5645f0[_0x8109('0x17')](_0x587f97)[_0x8109('0x24')](_0x5a291d);};}exports[_0x8109('0x25')]=function(_0x4bdd48,_0x4ce1e3){var _0x3752f6={},_0x1aecf0={},_0x196e04={'count':0x0,'rows':[]};var _0x1a078a=_[_0x8109('0x26')](db[_0x8109('0x27')][_0x8109('0x28')],function(_0x56f11a){return{'name':_0x56f11a[_0x8109('0x29')],'type':_0x56f11a['type'][_0x8109('0x2a')]};});_0x1aecf0[_0x8109('0x2b')]=_['map'](_0x1a078a,_0x8109('0x23'));_0x1aecf0[_0x8109('0x2c')]=_[_0x8109('0x2d')](_0x4bdd48[_0x8109('0x2c')]);_0x1aecf0[_0x8109('0x2e')]=_[_0x8109('0x2f')](_0x1aecf0[_0x8109('0x2b')],_0x1aecf0[_0x8109('0x2c')]);_0x3752f6[_0x8109('0x30')]=_[_0x8109('0x2f')](_0x1aecf0['model'],qs['fields'](_0x4bdd48['query'][_0x8109('0x31')]));_0x3752f6[_0x8109('0x30')]=_0x3752f6['attributes'][_0x8109('0x32')]?_0x3752f6[_0x8109('0x30')]:_0x1aecf0[_0x8109('0x2b')];if(!_0x4bdd48['query'][_0x8109('0x33')](_0x8109('0x34'))){_0x3752f6[_0x8109('0x1a')]=qs[_0x8109('0x1a')](_0x4bdd48[_0x8109('0x2c')][_0x8109('0x1a')]);_0x3752f6['offset']=qs[_0x8109('0x19')](_0x4bdd48[_0x8109('0x2c')][_0x8109('0x19')]);}_0x3752f6[_0x8109('0x35')]=qs[_0x8109('0x36')](_0x4bdd48[_0x8109('0x2c')][_0x8109('0x36')]);_0x3752f6[_0x8109('0x37')]=qs[_0x8109('0x2e')](_[_0x8109('0x38')](_0x4bdd48[_0x8109('0x2c')],_0x1aecf0[_0x8109('0x2e')]),_0x1a078a);if(_0x4bdd48[_0x8109('0x2c')][_0x8109('0x39')]){_0x3752f6[_0x8109('0x37')]=_[_0x8109('0x3a')](_0x3752f6[_0x8109('0x37')],{'$or':_['map'](_0x1a078a,function(_0xfcde20){if(_0xfcde20[_0x8109('0x3b')]!==_0x8109('0x3c')){var _0x2bb81f={};_0x2bb81f[_0xfcde20['name']]={'$like':'%'+_0x4bdd48[_0x8109('0x2c')][_0x8109('0x39')]+'%'};return _0x2bb81f;}})});}_0x3752f6=_[_0x8109('0x3a')]({},_0x3752f6,_0x4bdd48[_0x8109('0x3d')]);var _0x46b9ef={'where':_0x3752f6[_0x8109('0x37')]};return db['SugarcrmField'][_0x8109('0x3e')](_0x46b9ef)['then'](function(_0x2e08d3){_0x196e04['count']=_0x2e08d3;if(_0x4bdd48[_0x8109('0x2c')]['includeAll']){_0x3752f6[_0x8109('0x3f')]=[{'all':!![]}];}return db[_0x8109('0x27')][_0x8109('0x40')](_0x3752f6);})[_0x8109('0x1e')](function(_0x16598c){_0x196e04[_0x8109('0x41')]=_0x16598c;return _0x196e04;})[_0x8109('0x1e')](respondWithFilteredResult(_0x4ce1e3,_0x3752f6))[_0x8109('0x42')](handleError(_0x4ce1e3,null));};exports[_0x8109('0x43')]=function(_0x4ee55b,_0x3cb003){var _0x595bee={'raw':!![],'where':{'id':_0x4ee55b[_0x8109('0x44')]['id']}},_0x18c90c={};_0x18c90c[_0x8109('0x2b')]=_['keys'](db[_0x8109('0x27')]['rawAttributes']);_0x18c90c[_0x8109('0x2c')]=_[_0x8109('0x2d')](_0x4ee55b[_0x8109('0x2c')]);_0x18c90c[_0x8109('0x2e')]=_[_0x8109('0x2f')](_0x18c90c[_0x8109('0x2b')],_0x18c90c[_0x8109('0x2c')]);_0x595bee['attributes']=_[_0x8109('0x2f')](_0x18c90c[_0x8109('0x2b')],qs[_0x8109('0x31')](_0x4ee55b[_0x8109('0x2c')][_0x8109('0x31')]));_0x595bee[_0x8109('0x30')]=_0x595bee[_0x8109('0x30')][_0x8109('0x32')]?_0x595bee[_0x8109('0x30')]:_0x18c90c[_0x8109('0x2b')];if(_0x4ee55b[_0x8109('0x2c')]['includeAll']){_0x595bee[_0x8109('0x3f')]=[{'all':!![]}];}_0x595bee=_[_0x8109('0x3a')]({},_0x595bee,_0x4ee55b[_0x8109('0x3d')]);return db[_0x8109('0x27')][_0x8109('0x45')](_0x595bee)[_0x8109('0x1e')](handleEntityNotFound(_0x3cb003,null))[_0x8109('0x1e')](respondWithResult(_0x3cb003,null))['catch'](handleError(_0x3cb003,null));};exports[_0x8109('0x46')]=function(_0x394d6a,_0x1a8b20){return db[_0x8109('0x27')][_0x8109('0x46')](_0x394d6a[_0x8109('0x47')],{})[_0x8109('0x1e')](respondWithResult(_0x1a8b20,0xc9))[_0x8109('0x42')](handleError(_0x1a8b20,null));};exports[_0x8109('0x1d')]=function(_0x4bbb3f,_0x579dcb){if(_0x4bbb3f[_0x8109('0x47')]['id']){delete _0x4bbb3f[_0x8109('0x47')]['id'];}return db['SugarcrmField'][_0x8109('0x45')]({'where':{'id':_0x4bbb3f['params']['id']}})['then'](handleEntityNotFound(_0x579dcb,null))[_0x8109('0x1e')](saveUpdates(_0x4bbb3f[_0x8109('0x47')],null))[_0x8109('0x1e')](respondWithResult(_0x579dcb,null))[_0x8109('0x42')](handleError(_0x579dcb,null));};exports[_0x8109('0x48')]=function(_0x21a004,_0x53b3fd){return db[_0x8109('0x27')][_0x8109('0x45')]({'where':{'id':_0x21a004[_0x8109('0x44')]['id']}})[_0x8109('0x1e')](handleEntityNotFound(_0x53b3fd,null))[_0x8109('0x1e')](removeEntity(_0x53b3fd,null))['catch'](handleError(_0x53b3fd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 47da2c4..b9a350c 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 _0xbfa2=['api','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','idField','lodash','util','../../config/logger'];(function(_0x5227d2,_0x3a953c){var _0x5e6530=function(_0x2916f9){while(--_0x2916f9){_0x5227d2['push'](_0x5227d2['shift']());}};_0x5e6530(++_0x3a953c);}(_0xbfa2,0x8d));var _0x2bfa=function(_0x606df9,_0x3eb3d5){_0x606df9=_0x606df9-0x0;var _0x3bd3e9=_0xbfa2[_0x606df9];return _0x3bd3e9;};'use strict';var _=require(_0x2bfa('0x0'));var util=require(_0x2bfa('0x1'));var logger=require(_0x2bfa('0x2'))(_0x2bfa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2bfa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2bfa('0x5'));var config=require(_0x2bfa('0x6'));var attributes=require(_0x2bfa('0x7'));module[_0x2bfa('0x8')]=function(_0x1407bd,_0x57e15e){return _0x1407bd['define'](_0x2bfa('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x2bfa('0xa'),'fields':[_0x2bfa('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x78a7=['exports','sugarcrm_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78a7,0x92));var _0x778a=function(_0x3fb23b,_0x4ee81f){_0x3fb23b=_0x3fb23b-0x0;var _0xc01a25=_0x78a7[_0x3fb23b];return _0xc01a25;};'use strict';var _=require(_0x778a('0x0'));var util=require(_0x778a('0x1'));var logger=require('../../config/logger')(_0x778a('0x2'));var moment=require(_0x778a('0x3'));var BPromise=require(_0x778a('0x4'));var rp=require(_0x778a('0x5'));var fs=require('fs');var path=require(_0x778a('0x6'));var rimraf=require(_0x778a('0x7'));var config=require(_0x778a('0x8'));var attributes=require(_0x778a('0x9'));module[_0x778a('0xa')]=function(_0x206638,_0x3c1ee5){return _0x206638['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x778a('0xb'),'fields':['idField',_0x778a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index fe024a2..cffba85 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 _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x0b0e[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x51f643,_0x1e9cea){var _0x3c762b=function(_0x2d23ef){while(--_0x2d23ef){_0x51f643['push'](_0x51f643['shift']());}};_0x3c762b(++_0x1e9cea);}(_0xb10b,0x12a));var _0xbb10=function(_0x96691d,_0x544a9d){_0x96691d=_0x96691d-0x0;var _0x5a79ca=_0xb10b[_0x96691d];return _0x5a79ca;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 596ac9f..f824583 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 _0xad4e=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put'];(function(_0xba3f7b,_0x55881b){var _0x14b0a4=function(_0x4fc245){while(--_0x4fc245){_0xba3f7b['push'](_0xba3f7b['shift']());}};_0x14b0a4(++_0x55881b);}(_0xad4e,0xff));var _0xead4=function(_0x1ad5cd,_0xb2fec7){_0x1ad5cd=_0x1ad5cd-0x0;var _0x8852e8=_0xad4e[_0x1ad5cd];return _0x8852e8;};'use strict';var multer=require(_0xead4('0x0'));var util=require(_0xead4('0x1'));var path=require(_0xead4('0x2'));var timeout=require(_0xead4('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xead4('0x4'));var interaction=require(_0xead4('0x5'));var config=require('../../config/environment');var controller=require(_0xead4('0x6'));router['get']('/',auth[_0xead4('0x7')](),controller[_0xead4('0x8')]);router[_0xead4('0x9')](_0xead4('0xa'),auth[_0xead4('0x7')](),controller[_0xead4('0xb')]);router[_0xead4('0x9')](_0xead4('0xc'),auth[_0xead4('0x7')](),controller[_0xead4('0xd')]);router['get']('/:id/fields',auth[_0xead4('0x7')](),controller[_0xead4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xead4('0xf')]);router['post'](_0xead4('0xc'),auth['isAuthenticated'](),controller[_0xead4('0x10')]);router[_0xead4('0x11')]('/:id',auth[_0xead4('0x7')](),controller['update']);router[_0xead4('0x12')](_0xead4('0xa'),auth[_0xead4('0x7')](),controller[_0xead4('0x13')]);module[_0xead4('0x14')]=router; \ No newline at end of file +var _0x3033=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x5c52a3,_0x13c8d5){var _0x5537b9=function(_0x469e93){while(--_0x469e93){_0x5c52a3['push'](_0x5c52a3['shift']());}};_0x5537b9(++_0x13c8d5);}(_0x3033,0xff));var _0x3303=function(_0x53fa30,_0x27d970){_0x53fa30=_0x53fa30-0x0;var _0x35610f=_0x3033[_0x53fa30];return _0x35610f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3303('0x0'));var timeout=require(_0x3303('0x1'));var express=require(_0x3303('0x2'));var router=express[_0x3303('0x3')]();var auth=require(_0x3303('0x4'));var interaction=require(_0x3303('0x5'));var config=require('../../config/environment');var controller=require(_0x3303('0x6'));router[_0x3303('0x7')]('/',auth[_0x3303('0x8')](),controller[_0x3303('0x9')]);router[_0x3303('0x7')](_0x3303('0xa'),auth[_0x3303('0x8')](),controller[_0x3303('0xb')]);router[_0x3303('0x7')](_0x3303('0xc'),auth[_0x3303('0x8')](),controller['getConfigurations']);router[_0x3303('0x7')](_0x3303('0xd'),auth[_0x3303('0x8')](),controller[_0x3303('0xe')]);router[_0x3303('0xf')]('/',auth['isAuthenticated'](),controller[_0x3303('0x10')]);router[_0x3303('0xf')](_0x3303('0xc'),auth[_0x3303('0x8')](),controller[_0x3303('0x11')]);router[_0x3303('0x12')](_0x3303('0xa'),auth['isAuthenticated'](),controller[_0x3303('0x13')]);router[_0x3303('0x14')](_0x3303('0xa'),auth[_0x3303('0x8')](),controller[_0x3303('0x15')]);module[_0x3303('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a4f8dd4..24de788 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 _0x09d2=['HelpDesk','sequelize','exports','STRING'];(function(_0x2aafce,_0x376623){var _0x3a1e5c=function(_0x251267){while(--_0x251267){_0x2aafce['push'](_0x2aafce['shift']());}};_0x3a1e5c(++_0x376623);}(_0x09d2,0xc9));var _0x209d=function(_0x58ef24,_0x3fc3ab){_0x58ef24=_0x58ef24-0x0;var _0xc6b00=_0x09d2[_0x58ef24];return _0xc6b00;};'use strict';var Sequelize=require(_0x209d('0x0'));module[_0x209d('0x1')]={'name':{'type':Sequelize[_0x209d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x209d('0x2')]},'username':{'type':Sequelize[_0x209d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x209d('0x3')},'remoteUri':{'type':Sequelize[_0x209d('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x209d('0x2')]},'accessKey':{'type':Sequelize[_0x209d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2a85=['exports','STRING','sequelize'];(function(_0x431812,_0x1fec43){var _0x1f9fa2=function(_0x1279e4){while(--_0x1279e4){_0x431812['push'](_0x431812['shift']());}};_0x1f9fa2(++_0x1fec43);}(_0x2a85,0x1df));var _0x52a8=function(_0x184d86,_0x180b98){_0x184d86=_0x184d86-0x0;var _0x4f3c4e=_0x2a85[_0x184d86];return _0x4f3c4e;};'use strict';var Sequelize=require(_0x52a8('0x0'));module[_0x52a8('0x1')]={'name':{'type':Sequelize[_0x52a8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x52a8('0x2')]},'username':{'type':Sequelize[_0x52a8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x52a8('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x52a8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x52a8('0x2')]},'accessKey':{'type':Sequelize[_0x52a8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 3f5dad1..e7187f1 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 _0x5abd=['findAll','rows','show','params','intersection','length','find','create','body','destroy','getConfigurations','VtigerConfiguration','map','addConfiguration','Subjects','getDescriptions','VtigerField','Descriptions','md5','getFields','findOne','moduleName','username','accessKey','remoteUri','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','sessionName','autogenerated','reference','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','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','../../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','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','VtigerAccount','count','includeAll','include'];(function(_0x235ed3,_0x4108ec){var _0x4b82ac=function(_0x706235){while(--_0x706235){_0x235ed3['push'](_0x235ed3['shift']());}};_0x4b82ac(++_0x4108ec);}(_0x5abd,0x14a));var _0xd5ab=function(_0x444caa,_0x581d15){_0x444caa=_0x444caa-0x0;var _0x340ee1=_0x5abd[_0x444caa];return _0x340ee1;};'use strict';var pdf=require(_0xd5ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd5ab('0x1'));var zipdir=require(_0xd5ab('0x2'));var jsonpatch=require(_0xd5ab('0x3'));var rp=require(_0xd5ab('0x4'));var moment=require(_0xd5ab('0x5'));var BPromise=require(_0xd5ab('0x6'));var Mustache=require('mustache');var util=require(_0xd5ab('0x7'));var path=require(_0xd5ab('0x8'));var sox=require(_0xd5ab('0x9'));var csv=require(_0xd5ab('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd5ab('0xb'));var squel=require('squel');var crypto=require(_0xd5ab('0xc'));var jsforce=require(_0xd5ab('0xd'));var deskjs=require(_0xd5ab('0xe'));var toCsv=require(_0xd5ab('0xa'));var querystring=require(_0xd5ab('0xf'));var Papa=require(_0xd5ab('0x10'));var Redis=require(_0xd5ab('0x11'));var authService=require(_0xd5ab('0x12'));var qs=require(_0xd5ab('0x13'));var as=require(_0xd5ab('0x14'));var hardwareService=require(_0xd5ab('0x15'));var logger=require(_0xd5ab('0x16'))(_0xd5ab('0x17'));var utils=require(_0xd5ab('0x18'));var config=require('../../config/environment');var db=require(_0xd5ab('0x19'))['db'];var integrations=require(_0xd5ab('0x1a'));var jayson=require(_0xd5ab('0x1b'));var client=jayson[_0xd5ab('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x442a28,_0x3b89a8,_0x4c0bef){if(_0x4c0bef){var _0x349b29=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x349b29[_0xd5ab('0x1d')](_0x3b89a8)){return _0x442a28;}else{throw new db[(_0xd5ab('0x1e'))][(_0xd5ab('0x1f'))](_0xd5ab('0x20'));}}else{return _0x442a28;}}function respondWithRpcPromise(_0x1b075e,_0x74ad15,_0x46d6c5,_0x14d4fc){return new BPromise(function(_0x3ef84d,_0xbaaec9){var _0x25fda1=_0x14d4fc||client;return _0x25fda1[_0xd5ab('0x21')](_0x1b075e,_0x46d6c5)['then'](function(_0x5d8163){logger['info'](_0xd5ab('0x22'),_0x74ad15,_0xd5ab('0x23'));logger[_0xd5ab('0x24')](_0xd5ab('0x25'),_0x74ad15,_0xd5ab('0x23'),JSON[_0xd5ab('0x26')](_0x5d8163));if(_0x5d8163['error']){if(_0x5d8163['error'][_0xd5ab('0x27')]===0x1f4){logger['error'](_0xd5ab('0x22'),_0x74ad15,_0x5d8163[_0xd5ab('0x28')]['message']);return _0xbaaec9(_0x5d8163[_0xd5ab('0x28')]['message']);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x74ad15,_0x5d8163[_0xd5ab('0x28')]['message']);return _0x3ef84d(_0x5d8163['error'][_0xd5ab('0x29')]);}else{logger[_0xd5ab('0x2a')](_0xd5ab('0x22'),_0x74ad15,_0xd5ab('0x23'));_0x3ef84d(_0x5d8163[_0xd5ab('0x2b')]['message']);}})[_0xd5ab('0x2c')](function(_0x31576b){logger[_0xd5ab('0x28')](_0xd5ab('0x22'),_0x74ad15,_0x31576b);_0xbaaec9(_0x31576b);});});}function respondWithStatusCode(_0x34f743,_0x4bf354){_0x4bf354=_0x4bf354||0xcc;return function(_0x545062){if(_0x545062){return _0x34f743[_0xd5ab('0x2d')](_0x4bf354);}return _0x34f743[_0xd5ab('0x2e')](_0x4bf354)['end']();};}function respondWithResult(_0xc82b54,_0x3552a4){_0x3552a4=_0x3552a4||0xc8;return function(_0x520497){if(_0x520497){return _0xc82b54[_0xd5ab('0x2e')](_0x3552a4)[_0xd5ab('0x2f')](_0x520497);}};}function respondWithFilteredResult(_0x1bdaf2,_0x17268d){return function(_0x232713){if(_0x232713){var _0x4f8008=_0x232713['count'],_0x19170d=_0x17268d[_0xd5ab('0x30')],_0x42ec1b=_0x17268d[_0xd5ab('0x30')]+_0x17268d[_0xd5ab('0x31')],_0xf6c4ec;if(_0x42ec1b>=_0x4f8008){_0x42ec1b=_0x4f8008;_0xf6c4ec=0xc8;}else{_0xf6c4ec=0xce;}_0x1bdaf2[_0xd5ab('0x2e')](_0xf6c4ec);return _0x1bdaf2[_0xd5ab('0x32')](_0xd5ab('0x33'),_0x19170d+'-'+_0x42ec1b+'/'+_0x4f8008)['json'](_0x232713);}return null;};}function patchUpdates(_0x7274e9){return function(_0x43882c){try{jsonpatch[_0xd5ab('0x34')](_0x43882c,_0x7274e9,!![]);}catch(_0x4234f3){return BPromise[_0xd5ab('0x35')](_0x4234f3);}return _0x43882c[_0xd5ab('0x36')]();};}function saveUpdates(_0x5b7a39,_0x125926){return function(_0x268c1d){if(_0x268c1d){return _0x268c1d[_0xd5ab('0x37')](_0x5b7a39)[_0xd5ab('0x38')](function(_0x7c0d4c){return _0x7c0d4c;});}return null;};}function removeEntity(_0x8637c6,_0xfbc882){return function(_0x17f0d4){if(_0x17f0d4){return _0x17f0d4['destroy']()[_0xd5ab('0x38')](function(){_0x8637c6[_0xd5ab('0x2e')](0xcc)[_0xd5ab('0x39')]();});}};}function handleEntityNotFound(_0x4d788e,_0xe207e){return function(_0x52bfdf){if(!_0x52bfdf){_0x4d788e[_0xd5ab('0x2d')](0x194);}return _0x52bfdf;};}function handleError(_0x39ca9e,_0x370f53){_0x370f53=_0x370f53||0x1f4;return function(_0x1e8498){logger[_0xd5ab('0x28')](_0x1e8498[_0xd5ab('0x3a')]);if(_0x1e8498[_0xd5ab('0x3b')]){delete _0x1e8498[_0xd5ab('0x3b')];}_0x39ca9e[_0xd5ab('0x2e')](_0x370f53)['send'](_0x1e8498);};}exports['index']=function(_0x25835e,_0x1d5c89){var _0x5c0071={},_0x5bdaae={},_0x5b3717={'count':0x0,'rows':[]};var _0x1de120=_['map'](db['VtigerAccount'][_0xd5ab('0x3c')],function(_0x1b9bcc){return{'name':_0x1b9bcc[_0xd5ab('0x3d')],'type':_0x1b9bcc[_0xd5ab('0x3e')][_0xd5ab('0x3f')]};});_0x5bdaae['model']=_['map'](_0x1de120,_0xd5ab('0x3b'));_0x5bdaae[_0xd5ab('0x40')]=_[_0xd5ab('0x41')](_0x25835e[_0xd5ab('0x40')]);_0x5bdaae[_0xd5ab('0x42')]=_['intersection'](_0x5bdaae[_0xd5ab('0x43')],_0x5bdaae[_0xd5ab('0x40')]);_0x5c0071['attributes']=_['intersection'](_0x5bdaae['model'],qs[_0xd5ab('0x44')](_0x25835e[_0xd5ab('0x40')]['fields']));_0x5c0071[_0xd5ab('0x45')]=_0x5c0071[_0xd5ab('0x45')]['length']?_0x5c0071[_0xd5ab('0x45')]:_0x5bdaae[_0xd5ab('0x43')];if(!_0x25835e[_0xd5ab('0x40')][_0xd5ab('0x46')](_0xd5ab('0x47'))){_0x5c0071[_0xd5ab('0x31')]=qs['limit'](_0x25835e[_0xd5ab('0x40')][_0xd5ab('0x31')]);_0x5c0071[_0xd5ab('0x30')]=qs[_0xd5ab('0x30')](_0x25835e[_0xd5ab('0x40')][_0xd5ab('0x30')]);}_0x5c0071[_0xd5ab('0x48')]=qs[_0xd5ab('0x49')](_0x25835e['query'][_0xd5ab('0x49')]);_0x5c0071['where']=qs[_0xd5ab('0x42')](_[_0xd5ab('0x4a')](_0x25835e[_0xd5ab('0x40')],_0x5bdaae[_0xd5ab('0x42')]),_0x1de120);if(_0x25835e[_0xd5ab('0x40')]['filter']){_0x5c0071['where']=_[_0xd5ab('0x4b')](_0x5c0071[_0xd5ab('0x4c')],{'$or':_['map'](_0x1de120,function(_0x47bc6d){if(_0x47bc6d[_0xd5ab('0x3e')]!==_0xd5ab('0x4d')){var _0x3a309d={};_0x3a309d[_0x47bc6d[_0xd5ab('0x3b')]]={'$like':'%'+_0x25835e['query'][_0xd5ab('0x4e')]+'%'};return _0x3a309d;}})});}_0x5c0071=_[_0xd5ab('0x4b')]({},_0x5c0071,_0x25835e[_0xd5ab('0x4f')]);var _0x527d56={'where':_0x5c0071[_0xd5ab('0x4c')]};return db[_0xd5ab('0x50')][_0xd5ab('0x51')](_0x527d56)[_0xd5ab('0x38')](function(_0x59ccd1){_0x5b3717['count']=_0x59ccd1;if(_0x25835e[_0xd5ab('0x40')][_0xd5ab('0x52')]){_0x5c0071[_0xd5ab('0x53')]=[{'all':!![]}];}return db['VtigerAccount'][_0xd5ab('0x54')](_0x5c0071);})[_0xd5ab('0x38')](function(_0x191109){_0x5b3717[_0xd5ab('0x55')]=_0x191109;return _0x5b3717;})[_0xd5ab('0x38')](respondWithFilteredResult(_0x1d5c89,_0x5c0071))['catch'](handleError(_0x1d5c89,null));};exports[_0xd5ab('0x56')]=function(_0x1dd0e7,_0x4ad1bc){var _0x4eae01={'raw':![],'where':{'id':_0x1dd0e7[_0xd5ab('0x57')]['id']}},_0x2485f5={};_0x2485f5[_0xd5ab('0x43')]=_[_0xd5ab('0x41')](db[_0xd5ab('0x50')][_0xd5ab('0x3c')]);_0x2485f5[_0xd5ab('0x40')]=_[_0xd5ab('0x41')](_0x1dd0e7[_0xd5ab('0x40')]);_0x2485f5[_0xd5ab('0x42')]=_[_0xd5ab('0x58')](_0x2485f5[_0xd5ab('0x43')],_0x2485f5[_0xd5ab('0x40')]);_0x4eae01[_0xd5ab('0x45')]=_[_0xd5ab('0x58')](_0x2485f5['model'],qs[_0xd5ab('0x44')](_0x1dd0e7[_0xd5ab('0x40')]['fields']));_0x4eae01[_0xd5ab('0x45')]=_0x4eae01[_0xd5ab('0x45')][_0xd5ab('0x59')]?_0x4eae01[_0xd5ab('0x45')]:_0x2485f5['model'];if(_0x1dd0e7['query']['includeAll']){_0x4eae01[_0xd5ab('0x53')]=[{'all':!![]}];}_0x4eae01=_[_0xd5ab('0x4b')]({},_0x4eae01,_0x1dd0e7[_0xd5ab('0x4f')]);return db[_0xd5ab('0x50')][_0xd5ab('0x5a')](_0x4eae01)[_0xd5ab('0x38')](handleEntityNotFound(_0x4ad1bc,null))[_0xd5ab('0x38')](respondWithResult(_0x4ad1bc,null))[_0xd5ab('0x2c')](handleError(_0x4ad1bc,null));};exports[_0xd5ab('0x5b')]=function(_0xbd6624,_0x2ba0a0){return db[_0xd5ab('0x50')][_0xd5ab('0x5b')](_0xbd6624[_0xd5ab('0x5c')],{})[_0xd5ab('0x38')](respondWithResult(_0x2ba0a0,0xc9))[_0xd5ab('0x2c')](handleError(_0x2ba0a0,null));};exports[_0xd5ab('0x37')]=function(_0x2a9916,_0x175b29){if(_0x2a9916[_0xd5ab('0x5c')]['id']){delete _0x2a9916[_0xd5ab('0x5c')]['id'];}return db['VtigerAccount'][_0xd5ab('0x5a')]({'where':{'id':_0x2a9916[_0xd5ab('0x57')]['id']}})['then'](handleEntityNotFound(_0x175b29,null))[_0xd5ab('0x38')](saveUpdates(_0x2a9916[_0xd5ab('0x5c')],null))[_0xd5ab('0x38')](respondWithResult(_0x175b29,null))[_0xd5ab('0x2c')](handleError(_0x175b29,null));};exports[_0xd5ab('0x5d')]=function(_0x83ce58,_0x213244){return db[_0xd5ab('0x50')][_0xd5ab('0x5a')]({'where':{'id':_0x83ce58[_0xd5ab('0x57')]['id']}})[_0xd5ab('0x38')](handleEntityNotFound(_0x213244,null))[_0xd5ab('0x38')](removeEntity(_0x213244,null))[_0xd5ab('0x2c')](handleError(_0x213244,null));};exports[_0xd5ab('0x5e')]=function(_0x46fdb6,_0x1847d4,_0xe04dac){var _0x98fbe0={};var _0x17c6a9={};var _0x1f2573;var _0xb37aea;return db[_0xd5ab('0x50')]['findOne']({'where':{'id':_0x46fdb6['params']['id']}})[_0xd5ab('0x38')](handleEntityNotFound(_0x1847d4,null))[_0xd5ab('0x38')](function(_0x152e77){if(_0x152e77){_0x1f2573=_0x152e77;_0x17c6a9[_0xd5ab('0x43')]=_[_0xd5ab('0x41')](db[_0xd5ab('0x5f')][_0xd5ab('0x3c')]);_0x17c6a9[_0xd5ab('0x40')]=_[_0xd5ab('0x41')](_0x46fdb6['query']);_0x17c6a9[_0xd5ab('0x42')]=_[_0xd5ab('0x58')](_0x17c6a9['model'],_0x17c6a9[_0xd5ab('0x40')]);_0x98fbe0[_0xd5ab('0x45')]=_[_0xd5ab('0x58')](_0x17c6a9['model'],qs[_0xd5ab('0x44')](_0x46fdb6['query'][_0xd5ab('0x44')]));_0x98fbe0[_0xd5ab('0x45')]=_0x98fbe0[_0xd5ab('0x45')][_0xd5ab('0x59')]?_0x98fbe0['attributes']:_0x17c6a9['model'];_0x98fbe0[_0xd5ab('0x48')]=qs[_0xd5ab('0x49')](_0x46fdb6[_0xd5ab('0x40')][_0xd5ab('0x49')]);_0x98fbe0[_0xd5ab('0x4c')]=qs[_0xd5ab('0x42')](_['pick'](_0x46fdb6[_0xd5ab('0x40')],_0x17c6a9[_0xd5ab('0x42')]));if(_0x46fdb6[_0xd5ab('0x40')]['filter']){_0x98fbe0[_0xd5ab('0x4c')]=_['merge'](_0x98fbe0['where'],{'$or':_[_0xd5ab('0x60')](_0x98fbe0[_0xd5ab('0x45')],function(_0x2e8c06){var _0x265204={};_0x265204[_0x2e8c06]={'$like':'%'+_0x46fdb6[_0xd5ab('0x40')][_0xd5ab('0x4e')]+'%'};return _0x265204;})});}_0x98fbe0=_[_0xd5ab('0x4b')]({},_0x98fbe0,_0x46fdb6[_0xd5ab('0x4f')]);return _0x1f2573[_0xd5ab('0x5e')](_0x98fbe0);}})[_0xd5ab('0x38')](function(_0xb0d71){if(_0xb0d71){_0xb37aea=_0xb0d71[_0xd5ab('0x59')];if(!_0x46fdb6[_0xd5ab('0x40')]['hasOwnProperty'](_0xd5ab('0x47'))){_0x98fbe0['limit']=qs['limit'](_0x46fdb6[_0xd5ab('0x40')][_0xd5ab('0x31')]);_0x98fbe0['offset']=qs[_0xd5ab('0x30')](_0x46fdb6['query']['offset']);}return _0x1f2573[_0xd5ab('0x5e')](_0x98fbe0);}})[_0xd5ab('0x38')](function(_0x582ca3){if(_0x582ca3){return _0x582ca3?{'count':_0xb37aea,'rows':_0x582ca3}:null;}})['then'](respondWithResult(_0x1847d4,null))[_0xd5ab('0x2c')](handleError(_0x1847d4,null));};exports[_0xd5ab('0x61')]=function(_0x46b2ca,_0x427456,_0x500447){if(_0x46b2ca['body']['id']){delete _0x46b2ca[_0xd5ab('0x5c')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x46b2ca[_0xd5ab('0x57')]['id']}})[_0xd5ab('0x38')](handleEntityNotFound(_0x427456,null))[_0xd5ab('0x38')](function(_0x825029){if(_0x825029){_0x46b2ca[_0xd5ab('0x5c')]['AccountId']=_0x825029['id'];_0x46b2ca[_0xd5ab('0x5c')][_0xd5ab('0x62')]=integrations['getSubjects'](_0x46b2ca[_0xd5ab('0x5c')]['channel'],_0x46b2ca[_0xd5ab('0x5c')][_0xd5ab('0x3e')]);_0x46b2ca[_0xd5ab('0x5c')]['Descriptions']=integrations[_0xd5ab('0x63')](_0x46b2ca[_0xd5ab('0x5c')]['channel'],_0x46b2ca[_0xd5ab('0x5c')][_0xd5ab('0x3e')]);return db[_0xd5ab('0x5f')][_0xd5ab('0x5b')](_0x46b2ca['body'],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xd5ab('0x64')],'as':_0xd5ab('0x65')}]});}return null;})[_0xd5ab('0x38')](respondWithResult(_0x427456,null))[_0xd5ab('0x2c')](handleError(_0x427456,null));};var md5=require(_0xd5ab('0x66'));exports[_0xd5ab('0x67')]=function(_0x2799d6,_0x4a2265,_0x42358a){var _0x166e60=null;var _0xc8594c=null;var _0xf56b98=null;var _0x470ead=null;var _0x2388e4='';return db[_0xd5ab('0x50')][_0xd5ab('0x68')]({'where':{'id':_0x2799d6['params']['id']},'attributes':['id',_0xd5ab('0x3b'),'username','description',_0xd5ab('0x69'),'remoteUri','serverUrl','accessKey']})['then'](handleEntityNotFound(_0x4a2265,null))[_0xd5ab('0x38')](function(_0x1e03c8){if(_0x1e03c8){_0x166e60=_0x1e03c8[_0xd5ab('0x6a')];_0xc8594c=_0x1e03c8[_0xd5ab('0x6b')];_0xf56b98=_0x1e03c8[_0xd5ab('0x69')];_0x2388e4=_0x1e03c8[_0xd5ab('0x6c')];var _0xd1d8a3=_0x2388e4['slice'](-0x1);if(_0xd1d8a3==='/'){_0x2388e4=_0x2388e4[_0xd5ab('0x6d')](0x0,_0x2388e4[_0xd5ab('0x6e')](_0xd1d8a3));}_0x470ead=util[_0xd5ab('0x6f')](_0xd5ab('0x70'),_0x2388e4);var _0x25e729={'method':'GET','uri':_0x470ead,'qs':{'operation':_0xd5ab('0x71'),'username':_0x1e03c8['username']},'json':!![]};return rp(_0x25e729);}})['then'](function(_0xe64360){if(_0xe64360[_0xd5ab('0x72')]){var _0x30f245={'method':_0xd5ab('0x73'),'uri':_0x470ead,'form':{'operation':_0xd5ab('0x74'),'username':_0x166e60,'accessKey':md5(_0xe64360['result'][_0xd5ab('0x75')]+_0xc8594c)},'json':!![]};return rp(_0x30f245);}})[_0xd5ab('0x38')](function(_0x3b395d){if(_0x3b395d['success']){var _0x125084={'method':_0xd5ab('0x76'),'uri':_0x470ead,'qs':{'operation':_0xd5ab('0x77'),'username':_0x166e60,'sessionName':_0x3b395d[_0xd5ab('0x2b')][_0xd5ab('0x78')],'elementType':_0xf56b98},'json':!![]};return rp(_0x125084);}})[_0xd5ab('0x38')](function(_0x3de843){if(_0x3de843['success']){var _0x244545=[_0xd5ab('0x79'),_0xd5ab('0x7a'),'owner'];_['remove'](_0x3de843[_0xd5ab('0x2b')][_0xd5ab('0x44')],function(_0x3cf9f0){return _0x244545['includes'](_0x3cf9f0[_0xd5ab('0x3e')]['name']);});_[_0xd5ab('0x7b')](_0x3de843['result'][_0xd5ab('0x44')],function(_0x4807a1){return _0x4807a1[_0xd5ab('0x7c')]===_0xd5ab('0x7d');});return{'count':_0x3de843['result'][_0xd5ab('0x44')]['length'],'rows':_['map'](_0x3de843[_0xd5ab('0x2b')][_0xd5ab('0x44')],function(_0x34a6fb){return{'id':_0x34a6fb[_0xd5ab('0x3b')],'name':_0x34a6fb[_0xd5ab('0x7e')],'custom':_[_0xd5ab('0x7f')](_0x34a6fb['name'],_0xd5ab('0x80'))?!![]:![],'options':_0x34a6fb[_0xd5ab('0x3e')][_0xd5ab('0x3b')]===_0xd5ab('0x81')&&_0x34a6fb['type'][_0xd5ab('0x82')]['length']>0x0?_['map'](_0x34a6fb[_0xd5ab('0x3e')]['picklistValues'],function(_0x51dea3){return{'name':_0x51dea3[_0xd5ab('0x7e')],'value':_0x51dea3[_0xd5ab('0x83')]};}):[]};})};}})[_0xd5ab('0x38')](respondWithResult(_0x4a2265,null))[_0xd5ab('0x2c')](function(_0x1dae6e){console[_0xd5ab('0x84')](_0xd5ab('0x85')+_0x1dae6e);var _0x219bb5=_0x2799d6[_0xd5ab('0x40')][_0xd5ab('0x1d')]?0x1f4:_0x1dae6e[_0xd5ab('0x86')]||0x1f4;logger[_0xd5ab('0x28')](_0xd5ab('0x87'),'getFields',_0x219bb5,JSON[_0xd5ab('0x26')](_0x1dae6e));delete _0x1dae6e[_0xd5ab('0x3b')];if(_0x219bb5===0x191){_0x219bb5=0x190;}_0x4a2265[_0xd5ab('0x2e')](_0x219bb5)[_0xd5ab('0x88')](_0x2799d6['query'][_0xd5ab('0x1d')]?{'message':_0xd5ab('0x89'),'statusCode':_0x1dae6e[_0xd5ab('0x86')]}:_0x1dae6e);});}; \ No newline at end of file +var _0xcebd=['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','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','save','update','send','index','rawAttributes','fieldName','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','VtigerAccount','include','show','params','keys','includeAll','find','body','destroy','getConfigurations','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','owner','remove','editable','false','startsWith','cf_','picklistValues','label','value','log','vTiger\x20error:\x20','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError'];(function(_0x334ad9,_0x2b6ffa){var _0x556478=function(_0x4cdd9b){while(--_0x4cdd9b){_0x334ad9['push'](_0x334ad9['shift']());}};_0x556478(++_0x2b6ffa);}(_0xcebd,0x66));var _0xdceb=function(_0x8aef87,_0x5b37be){_0x8aef87=_0x8aef87-0x0;var _0x52c9ae=_0xcebd[_0x8aef87];return _0x52c9ae;};'use strict';var pdf=require(_0xdceb('0x0'));var emlformat=require(_0xdceb('0x1'));var rimraf=require(_0xdceb('0x2'));var zipdir=require(_0xdceb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdceb('0x4'));var moment=require(_0xdceb('0x5'));var BPromise=require(_0xdceb('0x6'));var Mustache=require(_0xdceb('0x7'));var util=require(_0xdceb('0x8'));var path=require(_0xdceb('0x9'));var sox=require('sox');var csv=require(_0xdceb('0xa'));var ejs=require(_0xdceb('0xb'));var fs=require('fs');var _=require(_0xdceb('0xc'));var squel=require(_0xdceb('0xd'));var crypto=require(_0xdceb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdceb('0xf'));var toCsv=require(_0xdceb('0xa'));var querystring=require(_0xdceb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdceb('0x11'));var qs=require(_0xdceb('0x12'));var as=require(_0xdceb('0x13'));var hardwareService=require(_0xdceb('0x14'));var logger=require(_0xdceb('0x15'))(_0xdceb('0x16'));var utils=require(_0xdceb('0x17'));var config=require('../../config/environment');var db=require(_0xdceb('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xdceb('0x19'));var client=jayson[_0xdceb('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x16f5ee,_0x5efced,_0xd641a3){if(_0xd641a3){var _0x1799a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1799a1[_0xdceb('0x1b')](_0x5efced)){return _0x16f5ee;}else{throw new db[(_0xdceb('0x1c'))][(_0xdceb('0x1d'))](_0xdceb('0x1e'));}}else{return _0x16f5ee;}}function respondWithRpcPromise(_0x125b25,_0x53957c,_0x2c722f,_0x8c9ae4){return new BPromise(function(_0x2dd2f5,_0x227134){var _0x4091ad=_0x8c9ae4||client;return _0x4091ad[_0xdceb('0x1f')](_0x125b25,_0x2c722f)[_0xdceb('0x20')](function(_0x5e66de){logger['info'](_0xdceb('0x21'),_0x53957c,_0xdceb('0x22'));logger[_0xdceb('0x23')](_0xdceb('0x24'),_0x53957c,_0xdceb('0x22'),JSON[_0xdceb('0x25')](_0x5e66de));if(_0x5e66de[_0xdceb('0x26')]){if(_0x5e66de[_0xdceb('0x26')][_0xdceb('0x27')]===0x1f4){logger[_0xdceb('0x26')](_0xdceb('0x21'),_0x53957c,_0x5e66de[_0xdceb('0x26')][_0xdceb('0x28')]);return _0x227134(_0x5e66de[_0xdceb('0x26')]['message']);}logger[_0xdceb('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x53957c,_0x5e66de['error'][_0xdceb('0x28')]);return _0x2dd2f5(_0x5e66de[_0xdceb('0x26')][_0xdceb('0x28')]);}else{logger[_0xdceb('0x29')](_0xdceb('0x21'),_0x53957c,'request\x20sent');_0x2dd2f5(_0x5e66de[_0xdceb('0x2a')][_0xdceb('0x28')]);}})[_0xdceb('0x2b')](function(_0x1c4ff3){logger[_0xdceb('0x26')](_0xdceb('0x21'),_0x53957c,_0x1c4ff3);_0x227134(_0x1c4ff3);});});}function respondWithStatusCode(_0x205f06,_0x3b3362){_0x3b3362=_0x3b3362||0xcc;return function(_0x209f29){if(_0x209f29){return _0x205f06[_0xdceb('0x2c')](_0x3b3362);}return _0x205f06[_0xdceb('0x2d')](_0x3b3362)[_0xdceb('0x2e')]();};}function respondWithResult(_0x375bf1,_0x5ed5a7){_0x5ed5a7=_0x5ed5a7||0xc8;return function(_0x401766){if(_0x401766){return _0x375bf1[_0xdceb('0x2d')](_0x5ed5a7)[_0xdceb('0x2f')](_0x401766);}};}function respondWithFilteredResult(_0x1174ce,_0x38dad5){return function(_0x4687bf){if(_0x4687bf){var _0x2b1328=_0x4687bf[_0xdceb('0x30')],_0x8f9038=_0x38dad5['offset'],_0xb3353f=_0x38dad5[_0xdceb('0x31')]+_0x38dad5[_0xdceb('0x32')],_0x197160;if(_0xb3353f>=_0x2b1328){_0xb3353f=_0x2b1328;_0x197160=0xc8;}else{_0x197160=0xce;}_0x1174ce['status'](_0x197160);return _0x1174ce[_0xdceb('0x33')]('Content-Range',_0x8f9038+'-'+_0xb3353f+'/'+_0x2b1328)[_0xdceb('0x2f')](_0x4687bf);}return null;};}function patchUpdates(_0x364506){return function(_0x2b0b78){try{jsonpatch['apply'](_0x2b0b78,_0x364506,!![]);}catch(_0x51c13f){return BPromise['reject'](_0x51c13f);}return _0x2b0b78[_0xdceb('0x34')]();};}function saveUpdates(_0x23acbf,_0x4d2cf6){return function(_0x2b789e){if(_0x2b789e){return _0x2b789e[_0xdceb('0x35')](_0x23acbf)[_0xdceb('0x20')](function(_0x4b43c6){return _0x4b43c6;});}return null;};}function removeEntity(_0x3777f6,_0x3b3d33){return function(_0x412785){if(_0x412785){return _0x412785['destroy']()[_0xdceb('0x20')](function(){_0x3777f6[_0xdceb('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a3de6,_0x3ef6ee){return function(_0x412b57){if(!_0x412b57){_0x2a3de6[_0xdceb('0x2c')](0x194);}return _0x412b57;};}function handleError(_0x27089d,_0x47966a){_0x47966a=_0x47966a||0x1f4;return function(_0x40a25e){logger['error'](_0x40a25e['stack']);if(_0x40a25e['name']){delete _0x40a25e['name'];}_0x27089d[_0xdceb('0x2d')](_0x47966a)[_0xdceb('0x36')](_0x40a25e);};}exports[_0xdceb('0x37')]=function(_0x349880,_0x8b846c){var _0x2a876c={},_0x3e7a6a={},_0x5a05d3={'count':0x0,'rows':[]};var _0x1c195=_['map'](db['VtigerAccount'][_0xdceb('0x38')],function(_0x4a7dd0){return{'name':_0x4a7dd0[_0xdceb('0x39')],'type':_0x4a7dd0['type'][_0xdceb('0x3a')]};});_0x3e7a6a[_0xdceb('0x3b')]=_[_0xdceb('0x3c')](_0x1c195,_0xdceb('0x3d'));_0x3e7a6a[_0xdceb('0x3e')]=_['keys'](_0x349880['query']);_0x3e7a6a[_0xdceb('0x3f')]=_[_0xdceb('0x40')](_0x3e7a6a[_0xdceb('0x3b')],_0x3e7a6a[_0xdceb('0x3e')]);_0x2a876c[_0xdceb('0x41')]=_[_0xdceb('0x40')](_0x3e7a6a[_0xdceb('0x3b')],qs[_0xdceb('0x42')](_0x349880['query'][_0xdceb('0x42')]));_0x2a876c[_0xdceb('0x41')]=_0x2a876c[_0xdceb('0x41')][_0xdceb('0x43')]?_0x2a876c[_0xdceb('0x41')]:_0x3e7a6a[_0xdceb('0x3b')];if(!_0x349880['query'][_0xdceb('0x44')]('nolimit')){_0x2a876c['limit']=qs[_0xdceb('0x32')](_0x349880['query'][_0xdceb('0x32')]);_0x2a876c['offset']=qs[_0xdceb('0x31')](_0x349880[_0xdceb('0x3e')][_0xdceb('0x31')]);}_0x2a876c[_0xdceb('0x45')]=qs['sort'](_0x349880[_0xdceb('0x3e')][_0xdceb('0x46')]);_0x2a876c['where']=qs[_0xdceb('0x3f')](_[_0xdceb('0x47')](_0x349880['query'],_0x3e7a6a[_0xdceb('0x3f')]),_0x1c195);if(_0x349880['query'][_0xdceb('0x48')]){_0x2a876c[_0xdceb('0x49')]=_[_0xdceb('0x4a')](_0x2a876c[_0xdceb('0x49')],{'$or':_[_0xdceb('0x3c')](_0x1c195,function(_0x52f73c){if(_0x52f73c[_0xdceb('0x4b')]!==_0xdceb('0x4c')){var _0xaefd6b={};_0xaefd6b[_0x52f73c[_0xdceb('0x3d')]]={'$like':'%'+_0x349880['query'][_0xdceb('0x48')]+'%'};return _0xaefd6b;}})});}_0x2a876c=_[_0xdceb('0x4a')]({},_0x2a876c,_0x349880[_0xdceb('0x4d')]);var _0x373eb4={'where':_0x2a876c[_0xdceb('0x49')]};return db[_0xdceb('0x4e')]['count'](_0x373eb4)['then'](function(_0x54386b){_0x5a05d3[_0xdceb('0x30')]=_0x54386b;if(_0x349880['query']['includeAll']){_0x2a876c[_0xdceb('0x4f')]=[{'all':!![]}];}return db[_0xdceb('0x4e')]['findAll'](_0x2a876c);})[_0xdceb('0x20')](function(_0x154725){_0x5a05d3['rows']=_0x154725;return _0x5a05d3;})['then'](respondWithFilteredResult(_0x8b846c,_0x2a876c))[_0xdceb('0x2b')](handleError(_0x8b846c,null));};exports[_0xdceb('0x50')]=function(_0x29463e,_0x58fbbf){var _0x258135={'raw':![],'where':{'id':_0x29463e[_0xdceb('0x51')]['id']}},_0xdfba7a={};_0xdfba7a['model']=_['keys'](db[_0xdceb('0x4e')]['rawAttributes']);_0xdfba7a[_0xdceb('0x3e')]=_[_0xdceb('0x52')](_0x29463e['query']);_0xdfba7a['filters']=_[_0xdceb('0x40')](_0xdfba7a[_0xdceb('0x3b')],_0xdfba7a[_0xdceb('0x3e')]);_0x258135['attributes']=_[_0xdceb('0x40')](_0xdfba7a[_0xdceb('0x3b')],qs[_0xdceb('0x42')](_0x29463e[_0xdceb('0x3e')][_0xdceb('0x42')]));_0x258135[_0xdceb('0x41')]=_0x258135[_0xdceb('0x41')][_0xdceb('0x43')]?_0x258135['attributes']:_0xdfba7a['model'];if(_0x29463e[_0xdceb('0x3e')][_0xdceb('0x53')]){_0x258135['include']=[{'all':!![]}];}_0x258135=_[_0xdceb('0x4a')]({},_0x258135,_0x29463e[_0xdceb('0x4d')]);return db['VtigerAccount'][_0xdceb('0x54')](_0x258135)['then'](handleEntityNotFound(_0x58fbbf,null))[_0xdceb('0x20')](respondWithResult(_0x58fbbf,null))[_0xdceb('0x2b')](handleError(_0x58fbbf,null));};exports['create']=function(_0x1a8119,_0x3e0606){return db['VtigerAccount']['create'](_0x1a8119[_0xdceb('0x55')],{})[_0xdceb('0x20')](respondWithResult(_0x3e0606,0xc9))[_0xdceb('0x2b')](handleError(_0x3e0606,null));};exports['update']=function(_0x4f76a2,_0x16a23f){if(_0x4f76a2[_0xdceb('0x55')]['id']){delete _0x4f76a2[_0xdceb('0x55')]['id'];}return db['VtigerAccount'][_0xdceb('0x54')]({'where':{'id':_0x4f76a2[_0xdceb('0x51')]['id']}})[_0xdceb('0x20')](handleEntityNotFound(_0x16a23f,null))[_0xdceb('0x20')](saveUpdates(_0x4f76a2[_0xdceb('0x55')],null))[_0xdceb('0x20')](respondWithResult(_0x16a23f,null))[_0xdceb('0x2b')](handleError(_0x16a23f,null));};exports[_0xdceb('0x56')]=function(_0x5e16c4,_0x333aee){return db[_0xdceb('0x4e')][_0xdceb('0x54')]({'where':{'id':_0x5e16c4[_0xdceb('0x51')]['id']}})[_0xdceb('0x20')](handleEntityNotFound(_0x333aee,null))[_0xdceb('0x20')](removeEntity(_0x333aee,null))[_0xdceb('0x2b')](handleError(_0x333aee,null));};exports[_0xdceb('0x57')]=function(_0x15196e,_0x153246,_0x8bfd29){var _0x64c51c={};var _0x421aa5={};var _0x25621b;var _0x4b46ae;return db[_0xdceb('0x4e')]['findOne']({'where':{'id':_0x15196e['params']['id']}})[_0xdceb('0x20')](handleEntityNotFound(_0x153246,null))[_0xdceb('0x20')](function(_0x3fa6d5){if(_0x3fa6d5){_0x25621b=_0x3fa6d5;_0x421aa5[_0xdceb('0x3b')]=_[_0xdceb('0x52')](db[_0xdceb('0x58')]['rawAttributes']);_0x421aa5[_0xdceb('0x3e')]=_['keys'](_0x15196e['query']);_0x421aa5[_0xdceb('0x3f')]=_[_0xdceb('0x40')](_0x421aa5[_0xdceb('0x3b')],_0x421aa5[_0xdceb('0x3e')]);_0x64c51c[_0xdceb('0x41')]=_[_0xdceb('0x40')](_0x421aa5['model'],qs[_0xdceb('0x42')](_0x15196e[_0xdceb('0x3e')][_0xdceb('0x42')]));_0x64c51c[_0xdceb('0x41')]=_0x64c51c[_0xdceb('0x41')][_0xdceb('0x43')]?_0x64c51c[_0xdceb('0x41')]:_0x421aa5['model'];_0x64c51c[_0xdceb('0x45')]=qs['sort'](_0x15196e[_0xdceb('0x3e')][_0xdceb('0x46')]);_0x64c51c['where']=qs[_0xdceb('0x3f')](_[_0xdceb('0x47')](_0x15196e[_0xdceb('0x3e')],_0x421aa5[_0xdceb('0x3f')]));if(_0x15196e[_0xdceb('0x3e')]['filter']){_0x64c51c[_0xdceb('0x49')]=_[_0xdceb('0x4a')](_0x64c51c[_0xdceb('0x49')],{'$or':_[_0xdceb('0x3c')](_0x64c51c['attributes'],function(_0x143b3b){var _0xc7c484={};_0xc7c484[_0x143b3b]={'$like':'%'+_0x15196e['query']['filter']+'%'};return _0xc7c484;})});}_0x64c51c=_[_0xdceb('0x4a')]({},_0x64c51c,_0x15196e['options']);return _0x25621b['getConfigurations'](_0x64c51c);}})['then'](function(_0x1a2c48){if(_0x1a2c48){_0x4b46ae=_0x1a2c48[_0xdceb('0x43')];if(!_0x15196e[_0xdceb('0x3e')][_0xdceb('0x44')]('nolimit')){_0x64c51c[_0xdceb('0x32')]=qs[_0xdceb('0x32')](_0x15196e['query'][_0xdceb('0x32')]);_0x64c51c[_0xdceb('0x31')]=qs[_0xdceb('0x31')](_0x15196e[_0xdceb('0x3e')][_0xdceb('0x31')]);}return _0x25621b[_0xdceb('0x57')](_0x64c51c);}})[_0xdceb('0x20')](function(_0xc83f74){if(_0xc83f74){return _0xc83f74?{'count':_0x4b46ae,'rows':_0xc83f74}:null;}})[_0xdceb('0x20')](respondWithResult(_0x153246,null))[_0xdceb('0x2b')](handleError(_0x153246,null));};exports[_0xdceb('0x59')]=function(_0x49b501,_0x2f88a1,_0x4d7e11){if(_0x49b501[_0xdceb('0x55')]['id']){delete _0x49b501[_0xdceb('0x55')]['id'];}return db[_0xdceb('0x4e')]['findOne']({'where':{'id':_0x49b501['params']['id']}})[_0xdceb('0x20')](handleEntityNotFound(_0x2f88a1,null))[_0xdceb('0x20')](function(_0x595a85){if(_0x595a85){_0x49b501['body'][_0xdceb('0x5a')]=_0x595a85['id'];_0x49b501['body'][_0xdceb('0x5b')]=integrations[_0xdceb('0x5c')](_0x49b501[_0xdceb('0x55')][_0xdceb('0x5d')],_0x49b501[_0xdceb('0x55')]['type']);_0x49b501[_0xdceb('0x55')][_0xdceb('0x5e')]=integrations[_0xdceb('0x5f')](_0x49b501[_0xdceb('0x55')][_0xdceb('0x5d')],_0x49b501[_0xdceb('0x55')][_0xdceb('0x4b')]);return db['VtigerConfiguration'][_0xdceb('0x60')](_0x49b501[_0xdceb('0x55')],{'include':[{'model':db['VtigerField'],'as':_0xdceb('0x5b')},{'model':db[_0xdceb('0x61')],'as':_0xdceb('0x5e')}]});}return null;})[_0xdceb('0x20')](respondWithResult(_0x2f88a1,null))[_0xdceb('0x2b')](handleError(_0x2f88a1,null));};var md5=require(_0xdceb('0x62'));exports[_0xdceb('0x63')]=function(_0x198df4,_0x55f108,_0x14e844){var _0x4c4f5f=null;var _0x4dcc97=null;var _0x396f31=null;var _0x514436=null;var _0x46f8b0='';return db[_0xdceb('0x4e')]['findOne']({'where':{'id':_0x198df4[_0xdceb('0x51')]['id']},'attributes':['id',_0xdceb('0x3d'),_0xdceb('0x64'),_0xdceb('0x65'),_0xdceb('0x66'),_0xdceb('0x67'),_0xdceb('0x68'),_0xdceb('0x69')]})['then'](handleEntityNotFound(_0x55f108,null))[_0xdceb('0x20')](function(_0x503cd1){if(_0x503cd1){_0x4c4f5f=_0x503cd1['username'];_0x4dcc97=_0x503cd1[_0xdceb('0x69')];_0x396f31=_0x503cd1['moduleName'];_0x46f8b0=_0x503cd1['remoteUri'];var _0x21a01e=_0x46f8b0['slice'](-0x1);if(_0x21a01e==='/'){_0x46f8b0=_0x46f8b0[_0xdceb('0x6a')](0x0,_0x46f8b0[_0xdceb('0x6b')](_0x21a01e));}_0x514436=util[_0xdceb('0x6c')](_0xdceb('0x6d'),_0x46f8b0);var _0x17641c={'method':_0xdceb('0x6e'),'uri':_0x514436,'qs':{'operation':_0xdceb('0x6f'),'username':_0x503cd1[_0xdceb('0x64')]},'json':!![]};return rp(_0x17641c);}})[_0xdceb('0x20')](function(_0x30eb58){if(_0x30eb58[_0xdceb('0x70')]){var _0x5eb0e7={'method':_0xdceb('0x71'),'uri':_0x514436,'form':{'operation':_0xdceb('0x72'),'username':_0x4c4f5f,'accessKey':md5(_0x30eb58['result'][_0xdceb('0x73')]+_0x4dcc97)},'json':!![]};return rp(_0x5eb0e7);}})[_0xdceb('0x20')](function(_0x1862a7){if(_0x1862a7['success']){var _0x3a68ba={'method':_0xdceb('0x6e'),'uri':_0x514436,'qs':{'operation':_0xdceb('0x74'),'username':_0x4c4f5f,'sessionName':_0x1862a7[_0xdceb('0x2a')][_0xdceb('0x75')],'elementType':_0x396f31},'json':!![]};return rp(_0x3a68ba);}})[_0xdceb('0x20')](function(_0x28a07d){if(_0x28a07d['success']){var _0x534961=[_0xdceb('0x76'),'reference',_0xdceb('0x77')];_[_0xdceb('0x78')](_0x28a07d[_0xdceb('0x2a')][_0xdceb('0x42')],function(_0x3a3342){return _0x534961['includes'](_0x3a3342[_0xdceb('0x4b')][_0xdceb('0x3d')]);});_[_0xdceb('0x78')](_0x28a07d[_0xdceb('0x2a')]['fields'],function(_0x6c7bd0){return _0x6c7bd0[_0xdceb('0x79')]===_0xdceb('0x7a');});return{'count':_0x28a07d['result'][_0xdceb('0x42')][_0xdceb('0x43')],'rows':_[_0xdceb('0x3c')](_0x28a07d[_0xdceb('0x2a')][_0xdceb('0x42')],function(_0x51e00d){return{'id':_0x51e00d[_0xdceb('0x3d')],'name':_0x51e00d['label'],'custom':_[_0xdceb('0x7b')](_0x51e00d[_0xdceb('0x3d')],_0xdceb('0x7c'))?!![]:![],'options':_0x51e00d['type'][_0xdceb('0x3d')]==='picklist'&&_0x51e00d['type'][_0xdceb('0x7d')]['length']>0x0?_[_0xdceb('0x3c')](_0x51e00d[_0xdceb('0x4b')]['picklistValues'],function(_0x282045){return{'name':_0x282045[_0xdceb('0x7e')],'value':_0x282045[_0xdceb('0x7f')]};}):[]};})};}})[_0xdceb('0x20')](respondWithResult(_0x55f108,null))[_0xdceb('0x2b')](function(_0x50e771){console[_0xdceb('0x80')](_0xdceb('0x81')+_0x50e771);var _0x17d0c5=_0x198df4[_0xdceb('0x3e')]['test']?0x1f4:_0x50e771[_0xdceb('0x82')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xdceb('0x63'),_0x17d0c5,JSON['stringify'](_0x50e771));delete _0x50e771['name'];if(_0x17d0c5===0x191){_0x17d0c5=0x190;}_0x55f108[_0xdceb('0x2d')](_0x17d0c5)[_0xdceb('0x36')](_0x198df4[_0xdceb('0x3e')][_0xdceb('0x1b')]?{'message':_0xdceb('0x83'),'statusCode':_0x50e771[_0xdceb('0x82')]}:_0x50e771);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7f79f04..4927916 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 _0xb74c=['define','VtigerAccount','int_vtiger_accounts','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','exports'];(function(_0x3a0c7d,_0x3aad82){var _0x4b7fb4=function(_0x24c7f6){while(--_0x24c7f6){_0x3a0c7d['push'](_0x3a0c7d['shift']());}};_0x4b7fb4(++_0x3aad82);}(_0xb74c,0xf3));var _0xcb74=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb74c[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xcb74('0x0'));var util=require(_0xcb74('0x1'));var logger=require('../../config/logger')(_0xcb74('0x2'));var moment=require('moment');var BPromise=require(_0xcb74('0x3'));var rp=require(_0xcb74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb74('0x5'));var config=require(_0xcb74('0x6'));var attributes=require(_0xcb74('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xcb74('0x8')]=function(_0x32e125,_0x2f7fe5){return _0x32e125[_0xcb74('0x9')](_0xcb74('0xa'),attributes,{'tableName':_0xcb74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac90=['lodash','util','../../config/logger','api','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x57a1e9,_0x59aeae){var _0x2acbec=function(_0x53f7d7){while(--_0x53f7d7){_0x57a1e9['push'](_0x57a1e9['shift']());}};_0x2acbec(++_0x59aeae);}(_0xac90,0x9c));var _0x0ac9=function(_0x489cb1,_0x41c67d){_0x489cb1=_0x489cb1-0x0;var _0x494a6b=_0xac90[_0x489cb1];return _0x494a6b;};'use strict';var _=require(_0x0ac9('0x0'));var util=require(_0x0ac9('0x1'));var logger=require(_0x0ac9('0x2'))(_0x0ac9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ac9('0x4'));var rimraf=require(_0x0ac9('0x5'));var config=require('../../config/environment');var attributes=require(_0x0ac9('0x6'));var integrations=require(_0x0ac9('0x7'));module[_0x0ac9('0x8')]=function(_0x287af1,_0x1ea687){return _0x287af1[_0x0ac9('0x9')](_0x0ac9('0xa'),attributes,{'tableName':_0x0ac9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 036ddf9..6746094 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 _0x4d2c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','include','map','model','then','find','raw','where','ShowVtigerAccount','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4d2c,0x67));var _0xc4d2=function(_0x4d8bed,_0x292561){_0x4d8bed=_0x4d8bed-0x0;var _0x5c5256=_0x4d2c[_0x4d8bed];return _0x5c5256;};'use strict';var _=require(_0xc4d2('0x0'));var util=require(_0xc4d2('0x1'));var moment=require('moment');var BPromise=require(_0xc4d2('0x2'));var rs=require(_0xc4d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4d2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4d2('0x5'))(_0xc4d2('0x6'));var config=require(_0xc4d2('0x7'));var jayson=require(_0xc4d2('0x8'));var client=jayson[_0xc4d2('0x9')][_0xc4d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ad58c,_0x4a6e32,_0x524db7){return new BPromise(function(_0x285565,_0xaa1a37){return client[_0xc4d2('0xb')](_0x3ad58c,_0x524db7)['then'](function(_0x31cd6c){logger[_0xc4d2('0xc')](_0xc4d2('0xd'),_0x4a6e32,_0xc4d2('0xe'));logger[_0xc4d2('0xf')](_0xc4d2('0x10'),_0x4a6e32,_0xc4d2('0xe'),JSON[_0xc4d2('0x11')](_0x31cd6c));if(_0x31cd6c['error']){if(_0x31cd6c[_0xc4d2('0x12')][_0xc4d2('0x13')]===0x1f4){logger[_0xc4d2('0x12')](_0xc4d2('0xd'),_0x4a6e32,_0x31cd6c[_0xc4d2('0x12')][_0xc4d2('0x14')]);return _0xaa1a37(_0x31cd6c[_0xc4d2('0x12')]['message']);}logger['error'](_0xc4d2('0xd'),_0x4a6e32,_0x31cd6c[_0xc4d2('0x12')][_0xc4d2('0x14')]);return _0x285565(_0x31cd6c['error'][_0xc4d2('0x14')]);}else{logger[_0xc4d2('0xc')](_0xc4d2('0xd'),_0x4a6e32,_0xc4d2('0xe'));_0x285565(_0x31cd6c[_0xc4d2('0x15')][_0xc4d2('0x14')]);}})[_0xc4d2('0x16')](function(_0x502f2f){logger[_0xc4d2('0x12')](_0xc4d2('0xd'),_0x4a6e32,_0x502f2f);_0xaa1a37(_0x502f2f);});});}exports[_0xc4d2('0x17')]=function(_0x5b1e09){var _0x16b5b5=this;return new Promise(function(_0x35844e,_0x16592e){return db[_0xc4d2('0x18')][_0xc4d2('0x19')]({'raw':_0x5b1e09['options']?_0x5b1e09[_0xc4d2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1e09[_0xc4d2('0x1a')]?_0x5b1e09[_0xc4d2('0x1a')]['where']||null:null,'attributes':_0x5b1e09[_0xc4d2('0x1a')]?_0x5b1e09[_0xc4d2('0x1a')][_0xc4d2('0x1b')]||null:null,'limit':_0x5b1e09['options']?_0x5b1e09['options']['limit']||null:null,'include':_0x5b1e09[_0xc4d2('0x1a')]?_0x5b1e09[_0xc4d2('0x1a')][_0xc4d2('0x1c')]?_[_0xc4d2('0x1d')](_0x5b1e09[_0xc4d2('0x1a')][_0xc4d2('0x1c')],function(_0x5cede5){return{'model':db[_0x5cede5[_0xc4d2('0x1e')]],'as':_0x5cede5['as'],'attributes':_0x5cede5[_0xc4d2('0x1b')],'include':_0x5cede5[_0xc4d2('0x1c')]?_[_0xc4d2('0x1d')](_0x5cede5['include'],function(_0x58c200){return{'model':db[_0x58c200['model']],'as':_0x58c200['as'],'attributes':_0x58c200[_0xc4d2('0x1b')],'include':_0x58c200[_0xc4d2('0x1c')]?_[_0xc4d2('0x1d')](_0x58c200[_0xc4d2('0x1c')],function(_0x2b29da){return{'model':db[_0x2b29da[_0xc4d2('0x1e')]],'as':_0x2b29da['as'],'attributes':_0x2b29da[_0xc4d2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc4d2('0x1f')](function(_0x2d3efd){logger[_0xc4d2('0xc')](_0xc4d2('0x17'),_0x5b1e09);logger[_0xc4d2('0xf')](_0xc4d2('0x17'),_0x5b1e09,JSON['stringify'](_0x2d3efd));_0x35844e(_0x2d3efd);})[_0xc4d2('0x16')](function(_0x389abd){logger[_0xc4d2('0x12')](_0xc4d2('0x17'),_0x389abd[_0xc4d2('0x14')],_0x5b1e09);_0x16592e(_0x16b5b5[_0xc4d2('0x12')](0x1f4,_0x389abd[_0xc4d2('0x14')]));});});};exports['ShowVtigerAccount']=function(_0xe1aa62){var _0x5265ef=this;return new Promise(function(_0x144297,_0x564eb3){return db[_0xc4d2('0x18')][_0xc4d2('0x20')]({'raw':_0xe1aa62['options']?_0xe1aa62[_0xc4d2('0x1a')][_0xc4d2('0x21')]===undefined?!![]:![]:!![],'where':_0xe1aa62[_0xc4d2('0x1a')]?_0xe1aa62[_0xc4d2('0x1a')][_0xc4d2('0x22')]||null:null,'attributes':_0xe1aa62[_0xc4d2('0x1a')]?_0xe1aa62[_0xc4d2('0x1a')][_0xc4d2('0x1b')]||null:null,'include':_0xe1aa62[_0xc4d2('0x1a')]?_0xe1aa62[_0xc4d2('0x1a')][_0xc4d2('0x1c')]?_['map'](_0xe1aa62[_0xc4d2('0x1a')]['include'],function(_0x1667d7){return{'model':db[_0x1667d7[_0xc4d2('0x1e')]],'as':_0x1667d7['as'],'attributes':_0x1667d7[_0xc4d2('0x1b')],'include':_0x1667d7[_0xc4d2('0x1c')]?_[_0xc4d2('0x1d')](_0x1667d7[_0xc4d2('0x1c')],function(_0x2132a2){return{'model':db[_0x2132a2[_0xc4d2('0x1e')]],'as':_0x2132a2['as'],'attributes':_0x2132a2[_0xc4d2('0x1b')],'include':_0x2132a2[_0xc4d2('0x1c')]?_[_0xc4d2('0x1d')](_0x2132a2[_0xc4d2('0x1c')],function(_0x9235ff){return{'model':db[_0x9235ff['model']],'as':_0x9235ff['as'],'attributes':_0x9235ff['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x13c15c){logger[_0xc4d2('0xc')](_0xc4d2('0x23'),_0xe1aa62);logger['debug'](_0xc4d2('0x23'),_0xe1aa62,JSON[_0xc4d2('0x11')](_0x13c15c));_0x144297(_0x13c15c);})[_0xc4d2('0x16')](function(_0x3ccc3f){logger['error'](_0xc4d2('0x23'),_0x3ccc3f[_0xc4d2('0x14')],_0xe1aa62);_0x564eb3(_0x5265ef[_0xc4d2('0x12')](0x1f4,_0x3ccc3f['message']));});});}; \ No newline at end of file +var _0x537f=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VtigerAccount','options','raw','limit','include','map','model','attributes','GetVtigerAccount','find','where','ShowVtigerAccount','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5f55c6,_0x2f3797){var _0x56605d=function(_0x3de233){while(--_0x3de233){_0x5f55c6['push'](_0x5f55c6['shift']());}};_0x56605d(++_0x2f3797);}(_0x537f,0x1e0));var _0xf537=function(_0x52e876,_0x390b3b){_0x52e876=_0x52e876-0x0;var _0x579b98=_0x537f[_0x52e876];return _0x579b98;};'use strict';var _=require('lodash');var util=require(_0xf537('0x0'));var moment=require(_0xf537('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf537('0x2'));var db=require(_0xf537('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf537('0x4'))(_0xf537('0x5'));var config=require(_0xf537('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf537('0x7')][_0xf537('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55891e,_0x30387a,_0xa19af0){return new BPromise(function(_0x4de4a4,_0x550cc8){return client[_0xf537('0x9')](_0x55891e,_0xa19af0)[_0xf537('0xa')](function(_0x76b370){logger[_0xf537('0xb')](_0xf537('0xc'),_0x30387a,_0xf537('0xd'));logger[_0xf537('0xe')](_0xf537('0xf'),_0x30387a,_0xf537('0xd'),JSON[_0xf537('0x10')](_0x76b370));if(_0x76b370[_0xf537('0x11')]){if(_0x76b370[_0xf537('0x11')][_0xf537('0x12')]===0x1f4){logger[_0xf537('0x11')](_0xf537('0xc'),_0x30387a,_0x76b370[_0xf537('0x11')]['message']);return _0x550cc8(_0x76b370[_0xf537('0x11')][_0xf537('0x13')]);}logger[_0xf537('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x30387a,_0x76b370['error'][_0xf537('0x13')]);return _0x4de4a4(_0x76b370[_0xf537('0x11')][_0xf537('0x13')]);}else{logger['info'](_0xf537('0xc'),_0x30387a,_0xf537('0xd'));_0x4de4a4(_0x76b370['result'][_0xf537('0x13')]);}})[_0xf537('0x14')](function(_0x1d048a){logger[_0xf537('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x30387a,_0x1d048a);_0x550cc8(_0x1d048a);});});}exports['GetVtigerAccount']=function(_0x313d96){var _0x569db1=this;return new Promise(function(_0xbcc6f3,_0x381bf7){return db[_0xf537('0x15')]['findAll']({'raw':_0x313d96[_0xf537('0x16')]?_0x313d96[_0xf537('0x16')][_0xf537('0x17')]===undefined?!![]:![]:!![],'where':_0x313d96[_0xf537('0x16')]?_0x313d96[_0xf537('0x16')]['where']||null:null,'attributes':_0x313d96[_0xf537('0x16')]?_0x313d96[_0xf537('0x16')]['attributes']||null:null,'limit':_0x313d96['options']?_0x313d96[_0xf537('0x16')][_0xf537('0x18')]||null:null,'include':_0x313d96[_0xf537('0x16')]?_0x313d96[_0xf537('0x16')][_0xf537('0x19')]?_[_0xf537('0x1a')](_0x313d96[_0xf537('0x16')][_0xf537('0x19')],function(_0x1e4bf9){return{'model':db[_0x1e4bf9['model']],'as':_0x1e4bf9['as'],'attributes':_0x1e4bf9['attributes'],'include':_0x1e4bf9[_0xf537('0x19')]?_['map'](_0x1e4bf9[_0xf537('0x19')],function(_0x1188eb){return{'model':db[_0x1188eb[_0xf537('0x1b')]],'as':_0x1188eb['as'],'attributes':_0x1188eb[_0xf537('0x1c')],'include':_0x1188eb[_0xf537('0x19')]?_['map'](_0x1188eb[_0xf537('0x19')],function(_0x288cf0){return{'model':db[_0x288cf0[_0xf537('0x1b')]],'as':_0x288cf0['as'],'attributes':_0x288cf0[_0xf537('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf537('0xa')](function(_0x3c8470){logger[_0xf537('0xb')]('GetVtigerAccount',_0x313d96);logger['debug'](_0xf537('0x1d'),_0x313d96,JSON[_0xf537('0x10')](_0x3c8470));_0xbcc6f3(_0x3c8470);})['catch'](function(_0x104a17){logger[_0xf537('0x11')]('GetVtigerAccount',_0x104a17[_0xf537('0x13')],_0x313d96);_0x381bf7(_0x569db1['error'](0x1f4,_0x104a17['message']));});});};exports['ShowVtigerAccount']=function(_0x3653c7){var _0x4a272f=this;return new Promise(function(_0x4a3182,_0xa5ae8c){return db['VtigerAccount'][_0xf537('0x1e')]({'raw':_0x3653c7[_0xf537('0x16')]?_0x3653c7['options'][_0xf537('0x17')]===undefined?!![]:![]:!![],'where':_0x3653c7[_0xf537('0x16')]?_0x3653c7['options'][_0xf537('0x1f')]||null:null,'attributes':_0x3653c7[_0xf537('0x16')]?_0x3653c7[_0xf537('0x16')][_0xf537('0x1c')]||null:null,'include':_0x3653c7['options']?_0x3653c7['options'][_0xf537('0x19')]?_['map'](_0x3653c7['options'][_0xf537('0x19')],function(_0x56f787){return{'model':db[_0x56f787[_0xf537('0x1b')]],'as':_0x56f787['as'],'attributes':_0x56f787['attributes'],'include':_0x56f787[_0xf537('0x19')]?_[_0xf537('0x1a')](_0x56f787['include'],function(_0x663b24){return{'model':db[_0x663b24[_0xf537('0x1b')]],'as':_0x663b24['as'],'attributes':_0x663b24[_0xf537('0x1c')],'include':_0x663b24['include']?_[_0xf537('0x1a')](_0x663b24[_0xf537('0x19')],function(_0x4d6292){return{'model':db[_0x4d6292[_0xf537('0x1b')]],'as':_0x4d6292['as'],'attributes':_0x4d6292[_0xf537('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf537('0xa')](function(_0x5b5d37){logger['info'](_0xf537('0x20'),_0x3653c7);logger['debug'](_0xf537('0x20'),_0x3653c7,JSON[_0xf537('0x10')](_0x5b5d37));_0x4a3182(_0x5b5d37);})[_0xf537('0x14')](function(_0x5ae589){logger[_0xf537('0x11')]('ShowVtigerAccount',_0x5ae589['message'],_0x3653c7);_0xa5ae8c(_0x4a272f[_0xf537('0x11')](0x1f4,_0x5ae589[_0xf537('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 08ed46f..fa19436 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x4342b9,_0x6d8524){var _0x1db670=function(_0x3769e0){while(--_0x3769e0){_0x4342b9['push'](_0x4342b9['shift']());}};_0x1db670(++_0x6d8524);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c77e4,_0x1d5ed8){_0x1c77e4=_0x1c77e4-0x0;var _0x17014d=_0x5f2f[_0x1c77e4];return _0x17014d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x227c55,_0x49db56){var _0x49e02b=function(_0x5bdd70){while(--_0x5bdd70){_0x227c55['push'](_0x227c55['shift']());}};_0x49e02b(++_0x49db56);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 1f5f565..5a20b4d 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 _0xf03e=['STRING','sequelize','exports'];(function(_0x414f3f,_0x3b3efb){var _0x2807c8=function(_0x2bef8e){while(--_0x2bef8e){_0x414f3f['push'](_0x414f3f['shift']());}};_0x2807c8(++_0x3b3efb);}(_0xf03e,0xc7));var _0xef03=function(_0x14263c,_0xc568c5){_0x14263c=_0x14263c-0x0;var _0x1d092c=_0xf03e[_0x14263c];return _0x1d092c;};'use strict';var Sequelize=require(_0xef03('0x0'));module[_0xef03('0x1')]={'name':{'type':Sequelize[_0xef03('0x2')]},'description':{'type':Sequelize[_0xef03('0x2')]}}; \ No newline at end of file +var _0x1542=['STRING','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1542,0x1d8));var _0x2154=function(_0x76e00d,_0x551f77){_0x76e00d=_0x76e00d-0x0;var _0x32e584=_0x1542[_0x76e00d];return _0x32e584;};'use strict';var Sequelize=require(_0x2154('0x0'));module[_0x2154('0x1')]={'name':{'type':Sequelize[_0x2154('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 57a5624..f5d4442 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 _0x2f91=['VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','length','find','create','body','getFields','findOne','getSubjects','VtigerField','getDescriptions','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','map'];(function(_0x1690bd,_0x1d81c6){var _0x277e0b=function(_0x3e8f84){while(--_0x3e8f84){_0x1690bd['push'](_0x1690bd['shift']());}};_0x277e0b(++_0x1d81c6);}(_0x2f91,0xdd));var _0x12f9=function(_0x7ebdf4,_0x6f47d){_0x7ebdf4=_0x7ebdf4-0x0;var _0x4bf667=_0x2f91[_0x7ebdf4];return _0x4bf667;};'use strict';var pdf=require(_0x12f9('0x0'));var emlformat=require(_0x12f9('0x1'));var rimraf=require(_0x12f9('0x2'));var zipdir=require(_0x12f9('0x3'));var jsonpatch=require(_0x12f9('0x4'));var rp=require(_0x12f9('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x12f9('0x6'));var util=require(_0x12f9('0x7'));var path=require(_0x12f9('0x8'));var sox=require(_0x12f9('0x9'));var csv=require('to-csv');var ejs=require(_0x12f9('0xa'));var fs=require('fs');var _=require(_0x12f9('0xb'));var squel=require('squel');var crypto=require(_0x12f9('0xc'));var jsforce=require(_0x12f9('0xd'));var deskjs=require(_0x12f9('0xe'));var toCsv=require(_0x12f9('0xf'));var querystring=require('querystring');var Papa=require(_0x12f9('0x10'));var Redis=require(_0x12f9('0x11'));var authService=require(_0x12f9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x12f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12f9('0x14'))(_0x12f9('0x15'));var utils=require(_0x12f9('0x16'));var config=require('../../config/environment');var db=require(_0x12f9('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x12f9('0x18')]({'port':0x232a});function checkPasswordPattern(_0x178f4d,_0x570517,_0x3b8acd){if(_0x3b8acd){var _0x22ab0a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22ab0a[_0x12f9('0x19')](_0x570517)){return _0x178f4d;}else{throw new db[(_0x12f9('0x1a'))][(_0x12f9('0x1b'))](_0x12f9('0x1c'));}}else{return _0x178f4d;}}function respondWithRpcPromise(_0x5a1a1d,_0xc2112f,_0x45c3d7,_0x563d21){return new BPromise(function(_0x4b32f3,_0x34f4c7){var _0x5bd637=_0x563d21||client;return _0x5bd637[_0x12f9('0x1d')](_0x5a1a1d,_0x45c3d7)[_0x12f9('0x1e')](function(_0x4d72af){logger[_0x12f9('0x1f')](_0x12f9('0x20'),_0xc2112f,_0x12f9('0x21'));logger[_0x12f9('0x22')](_0x12f9('0x23'),_0xc2112f,'request\x20sent',JSON['stringify'](_0x4d72af));if(_0x4d72af[_0x12f9('0x24')]){if(_0x4d72af[_0x12f9('0x24')]['code']===0x1f4){logger[_0x12f9('0x24')](_0x12f9('0x20'),_0xc2112f,_0x4d72af[_0x12f9('0x24')][_0x12f9('0x25')]);return _0x34f4c7(_0x4d72af[_0x12f9('0x24')][_0x12f9('0x25')]);}logger[_0x12f9('0x24')]('VtigerConfiguration,\x20%s,\x20%s',_0xc2112f,_0x4d72af[_0x12f9('0x24')]['message']);return _0x4b32f3(_0x4d72af[_0x12f9('0x24')]['message']);}else{logger[_0x12f9('0x1f')](_0x12f9('0x20'),_0xc2112f,'request\x20sent');_0x4b32f3(_0x4d72af['result'][_0x12f9('0x25')]);}})['catch'](function(_0x4595e7){logger[_0x12f9('0x24')](_0x12f9('0x20'),_0xc2112f,_0x4595e7);_0x34f4c7(_0x4595e7);});});}function respondWithStatusCode(_0x46da9b,_0x5d0293){_0x5d0293=_0x5d0293||0xcc;return function(_0x100f90){if(_0x100f90){return _0x46da9b[_0x12f9('0x26')](_0x5d0293);}return _0x46da9b[_0x12f9('0x27')](_0x5d0293)[_0x12f9('0x28')]();};}function respondWithResult(_0x3ee680,_0x2cdca4){_0x2cdca4=_0x2cdca4||0xc8;return function(_0x132118){if(_0x132118){return _0x3ee680[_0x12f9('0x27')](_0x2cdca4)[_0x12f9('0x29')](_0x132118);}};}function respondWithFilteredResult(_0x317269,_0x27e473){return function(_0x47cbc9){if(_0x47cbc9){var _0x5ca89f=_0x47cbc9[_0x12f9('0x2a')],_0x19e92c=_0x27e473[_0x12f9('0x2b')],_0x46cf13=_0x27e473[_0x12f9('0x2b')]+_0x27e473[_0x12f9('0x2c')],_0x918618;if(_0x46cf13>=_0x5ca89f){_0x46cf13=_0x5ca89f;_0x918618=0xc8;}else{_0x918618=0xce;}_0x317269[_0x12f9('0x27')](_0x918618);return _0x317269['set'](_0x12f9('0x2d'),_0x19e92c+'-'+_0x46cf13+'/'+_0x5ca89f)[_0x12f9('0x29')](_0x47cbc9);}return null;};}function patchUpdates(_0x41838a){return function(_0x5dd237){try{jsonpatch['apply'](_0x5dd237,_0x41838a,!![]);}catch(_0xdec39a){return BPromise[_0x12f9('0x2e')](_0xdec39a);}return _0x5dd237[_0x12f9('0x2f')]();};}function saveUpdates(_0x55b687,_0x1f789f){return function(_0x45bc39){if(_0x45bc39){return _0x45bc39[_0x12f9('0x30')](_0x55b687)['then'](function(_0x31cc15){return _0x31cc15;});}return null;};}function removeEntity(_0x514416,_0x3bd4ce){return function(_0x5ad605){if(_0x5ad605){return _0x5ad605[_0x12f9('0x31')]()[_0x12f9('0x1e')](function(){_0x514416[_0x12f9('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x580f5e,_0x2ea74c){return function(_0xb608c4){if(!_0xb608c4){_0x580f5e['sendStatus'](0x194);}return _0xb608c4;};}function handleError(_0x215cee,_0x48501f){_0x48501f=_0x48501f||0x1f4;return function(_0x1d854c){logger['error'](_0x1d854c[_0x12f9('0x32')]);if(_0x1d854c[_0x12f9('0x33')]){delete _0x1d854c['name'];}_0x215cee[_0x12f9('0x27')](_0x48501f)[_0x12f9('0x34')](_0x1d854c);};}exports[_0x12f9('0x35')]=function(_0x1ee062,_0x5acd23){var _0x15eb5b={},_0x3f5008={},_0x10daba={'count':0x0,'rows':[]};var _0x2f067c=_[_0x12f9('0x36')](db[_0x12f9('0x37')][_0x12f9('0x38')],function(_0xb9bbb1){return{'name':_0xb9bbb1[_0x12f9('0x39')],'type':_0xb9bbb1[_0x12f9('0x3a')][_0x12f9('0x3b')]};});_0x3f5008['model']=_[_0x12f9('0x36')](_0x2f067c,_0x12f9('0x33'));_0x3f5008[_0x12f9('0x3c')]=_[_0x12f9('0x3d')](_0x1ee062[_0x12f9('0x3c')]);_0x3f5008[_0x12f9('0x3e')]=_[_0x12f9('0x3f')](_0x3f5008[_0x12f9('0x40')],_0x3f5008[_0x12f9('0x3c')]);_0x15eb5b['attributes']=_[_0x12f9('0x3f')](_0x3f5008[_0x12f9('0x40')],qs['fields'](_0x1ee062[_0x12f9('0x3c')]['fields']));_0x15eb5b[_0x12f9('0x41')]=_0x15eb5b[_0x12f9('0x41')]['length']?_0x15eb5b[_0x12f9('0x41')]:_0x3f5008[_0x12f9('0x40')];if(!_0x1ee062[_0x12f9('0x3c')][_0x12f9('0x42')](_0x12f9('0x43'))){_0x15eb5b['limit']=qs['limit'](_0x1ee062[_0x12f9('0x3c')][_0x12f9('0x2c')]);_0x15eb5b[_0x12f9('0x2b')]=qs[_0x12f9('0x2b')](_0x1ee062[_0x12f9('0x3c')][_0x12f9('0x2b')]);}_0x15eb5b['order']=qs['sort'](_0x1ee062['query'][_0x12f9('0x44')]);_0x15eb5b[_0x12f9('0x45')]=qs[_0x12f9('0x3e')](_[_0x12f9('0x46')](_0x1ee062['query'],_0x3f5008[_0x12f9('0x3e')]),_0x2f067c);if(_0x1ee062[_0x12f9('0x3c')][_0x12f9('0x47')]){_0x15eb5b['where']=_[_0x12f9('0x48')](_0x15eb5b['where'],{'$or':_[_0x12f9('0x36')](_0x2f067c,function(_0x9f9289){if(_0x9f9289[_0x12f9('0x3a')]!==_0x12f9('0x49')){var _0xbadc12={};_0xbadc12[_0x9f9289['name']]={'$like':'%'+_0x1ee062[_0x12f9('0x3c')]['filter']+'%'};return _0xbadc12;}})});}_0x15eb5b=_['merge']({},_0x15eb5b,_0x1ee062[_0x12f9('0x4a')]);var _0x39264f={'where':_0x15eb5b[_0x12f9('0x45')]};return db[_0x12f9('0x37')]['count'](_0x39264f)[_0x12f9('0x1e')](function(_0x3fba43){_0x10daba['count']=_0x3fba43;if(_0x1ee062[_0x12f9('0x3c')][_0x12f9('0x4b')]){_0x15eb5b[_0x12f9('0x4c')]=[{'all':!![]}];}return db[_0x12f9('0x37')][_0x12f9('0x4d')](_0x15eb5b);})[_0x12f9('0x1e')](function(_0x1d0eb1){_0x10daba['rows']=_0x1d0eb1;return _0x10daba;})[_0x12f9('0x1e')](respondWithFilteredResult(_0x5acd23,_0x15eb5b))[_0x12f9('0x4e')](handleError(_0x5acd23,null));};exports[_0x12f9('0x4f')]=function(_0x325dfc,_0x532823){var _0x5446b4={'raw':![],'where':{'id':_0x325dfc[_0x12f9('0x50')]['id']}},_0x33ccf9={};_0x33ccf9['model']=_[_0x12f9('0x3d')](db[_0x12f9('0x37')][_0x12f9('0x38')]);_0x33ccf9[_0x12f9('0x3c')]=_[_0x12f9('0x3d')](_0x325dfc[_0x12f9('0x3c')]);_0x33ccf9[_0x12f9('0x3e')]=_[_0x12f9('0x3f')](_0x33ccf9[_0x12f9('0x40')],_0x33ccf9[_0x12f9('0x3c')]);_0x5446b4[_0x12f9('0x41')]=_[_0x12f9('0x3f')](_0x33ccf9[_0x12f9('0x40')],qs[_0x12f9('0x51')](_0x325dfc[_0x12f9('0x3c')][_0x12f9('0x51')]));_0x5446b4['attributes']=_0x5446b4[_0x12f9('0x41')][_0x12f9('0x52')]?_0x5446b4[_0x12f9('0x41')]:_0x33ccf9[_0x12f9('0x40')];if(_0x325dfc['query'][_0x12f9('0x4b')]){_0x5446b4['include']=[{'all':!![]}];}_0x5446b4=_[_0x12f9('0x48')]({},_0x5446b4,_0x325dfc[_0x12f9('0x4a')]);return db[_0x12f9('0x37')][_0x12f9('0x53')](_0x5446b4)[_0x12f9('0x1e')](handleEntityNotFound(_0x532823,null))[_0x12f9('0x1e')](respondWithResult(_0x532823,null))[_0x12f9('0x4e')](handleError(_0x532823,null));};exports[_0x12f9('0x54')]=function(_0x18b9d8,_0x57a000){return db[_0x12f9('0x37')][_0x12f9('0x54')](_0x18b9d8[_0x12f9('0x55')],{})['then'](respondWithResult(_0x57a000,0xc9))['catch'](handleError(_0x57a000,null));};exports[_0x12f9('0x30')]=function(_0x22cefb,_0x101653){if(_0x22cefb[_0x12f9('0x55')]['id']){delete _0x22cefb[_0x12f9('0x55')]['id'];}return db['VtigerConfiguration'][_0x12f9('0x53')]({'where':{'id':_0x22cefb[_0x12f9('0x50')]['id']}})[_0x12f9('0x1e')](handleEntityNotFound(_0x101653,null))[_0x12f9('0x1e')](saveUpdates(_0x22cefb[_0x12f9('0x55')],null))[_0x12f9('0x1e')](respondWithResult(_0x101653,null))[_0x12f9('0x4e')](handleError(_0x101653,null));};exports['destroy']=function(_0x1b21a8,_0x12ed69){return db[_0x12f9('0x37')][_0x12f9('0x53')]({'where':{'id':_0x1b21a8['params']['id']}})[_0x12f9('0x1e')](handleEntityNotFound(_0x12ed69,null))[_0x12f9('0x1e')](removeEntity(_0x12ed69,null))[_0x12f9('0x4e')](handleError(_0x12ed69,null));};exports[_0x12f9('0x56')]=function(_0x49faa4,_0x379815,_0x1c7b0c){var _0x3278b4={};var _0x51aa6a={};var _0x27f88d;var _0x90e42a;return db['VtigerConfiguration'][_0x12f9('0x57')]({'where':{'id':_0x49faa4[_0x12f9('0x50')]['id']}})[_0x12f9('0x1e')](handleEntityNotFound(_0x379815,null))[_0x12f9('0x1e')](function(_0x27fedc){if(_0x27fedc){_0x27f88d=_0x27fedc;_0x51aa6a[_0x12f9('0x40')]=_[_0x12f9('0x3d')](db['VtigerField']['rawAttributes']);_0x51aa6a[_0x12f9('0x3c')]=_[_0x12f9('0x3d')](_0x49faa4[_0x12f9('0x3c')]);_0x51aa6a['filters']=_[_0x12f9('0x3f')](_0x51aa6a[_0x12f9('0x40')],_0x51aa6a[_0x12f9('0x3c')]);_0x3278b4[_0x12f9('0x41')]=_[_0x12f9('0x3f')](_0x51aa6a[_0x12f9('0x40')],qs[_0x12f9('0x51')](_0x49faa4[_0x12f9('0x3c')]['fields']));_0x3278b4[_0x12f9('0x41')]=_0x3278b4[_0x12f9('0x41')][_0x12f9('0x52')]?_0x3278b4[_0x12f9('0x41')]:_0x51aa6a[_0x12f9('0x40')];_0x3278b4['order']=qs[_0x12f9('0x44')](_0x49faa4[_0x12f9('0x3c')][_0x12f9('0x44')]);_0x3278b4[_0x12f9('0x45')]=qs['filters'](_[_0x12f9('0x46')](_0x49faa4[_0x12f9('0x3c')],_0x51aa6a[_0x12f9('0x3e')]));if(_0x49faa4[_0x12f9('0x3c')]['filter']){_0x3278b4[_0x12f9('0x45')]=_[_0x12f9('0x48')](_0x3278b4[_0x12f9('0x45')],{'$or':_['map'](_0x3278b4[_0x12f9('0x41')],function(_0x1859f3){var _0x1ff0e9={};_0x1ff0e9[_0x1859f3]={'$like':'%'+_0x49faa4[_0x12f9('0x3c')][_0x12f9('0x47')]+'%'};return _0x1ff0e9;})});}_0x3278b4=_[_0x12f9('0x48')]({},_0x3278b4,_0x49faa4[_0x12f9('0x4a')]);return _0x27f88d[_0x12f9('0x56')](_0x3278b4);}})[_0x12f9('0x1e')](function(_0x702e09){if(_0x702e09){_0x90e42a=_0x702e09[_0x12f9('0x52')];if(!_0x49faa4[_0x12f9('0x3c')][_0x12f9('0x42')](_0x12f9('0x43'))){_0x3278b4[_0x12f9('0x2c')]=qs[_0x12f9('0x2c')](_0x49faa4[_0x12f9('0x3c')]['limit']);_0x3278b4[_0x12f9('0x2b')]=qs[_0x12f9('0x2b')](_0x49faa4[_0x12f9('0x3c')][_0x12f9('0x2b')]);}return _0x27f88d[_0x12f9('0x56')](_0x3278b4);}})['then'](function(_0x298d64){if(_0x298d64){return _0x298d64?{'count':_0x90e42a,'rows':_0x298d64}:null;}})[_0x12f9('0x1e')](respondWithResult(_0x379815,null))[_0x12f9('0x4e')](handleError(_0x379815,null));};exports[_0x12f9('0x58')]=function(_0x189a05,_0x489343,_0x5eaeb0){var _0x5d7e57={};var _0x3e5a28={};var _0x4108b3;var _0x4375df;return db[_0x12f9('0x37')]['findOne']({'where':{'id':_0x189a05[_0x12f9('0x50')]['id']}})['then'](handleEntityNotFound(_0x489343,null))['then'](function(_0x4ecdad){if(_0x4ecdad){_0x4108b3=_0x4ecdad;_0x3e5a28['model']=_[_0x12f9('0x3d')](db[_0x12f9('0x59')][_0x12f9('0x38')]);_0x3e5a28[_0x12f9('0x3c')]=_['keys'](_0x189a05[_0x12f9('0x3c')]);_0x3e5a28[_0x12f9('0x3e')]=_[_0x12f9('0x3f')](_0x3e5a28[_0x12f9('0x40')],_0x3e5a28[_0x12f9('0x3c')]);_0x5d7e57['attributes']=_['intersection'](_0x3e5a28[_0x12f9('0x40')],qs['fields'](_0x189a05[_0x12f9('0x3c')][_0x12f9('0x51')]));_0x5d7e57[_0x12f9('0x41')]=_0x5d7e57[_0x12f9('0x41')]['length']?_0x5d7e57[_0x12f9('0x41')]:_0x3e5a28['model'];_0x5d7e57['order']=qs[_0x12f9('0x44')](_0x189a05[_0x12f9('0x3c')][_0x12f9('0x44')]);_0x5d7e57[_0x12f9('0x45')]=qs[_0x12f9('0x3e')](_[_0x12f9('0x46')](_0x189a05['query'],_0x3e5a28[_0x12f9('0x3e')]));if(_0x189a05['query'][_0x12f9('0x47')]){_0x5d7e57[_0x12f9('0x45')]=_[_0x12f9('0x48')](_0x5d7e57[_0x12f9('0x45')],{'$or':_['map'](_0x5d7e57[_0x12f9('0x41')],function(_0x39242d){var _0x1c4870={};_0x1c4870[_0x39242d]={'$like':'%'+_0x189a05[_0x12f9('0x3c')][_0x12f9('0x47')]+'%'};return _0x1c4870;})});}_0x5d7e57=_[_0x12f9('0x48')]({},_0x5d7e57,_0x189a05[_0x12f9('0x4a')]);return _0x4108b3[_0x12f9('0x58')](_0x5d7e57);}})[_0x12f9('0x1e')](function(_0x35887d){if(_0x35887d){_0x4375df=_0x35887d['length'];if(!_0x189a05[_0x12f9('0x3c')]['hasOwnProperty']('nolimit')){_0x5d7e57['limit']=qs['limit'](_0x189a05['query'][_0x12f9('0x2c')]);_0x5d7e57['offset']=qs[_0x12f9('0x2b')](_0x189a05['query'][_0x12f9('0x2b')]);}return _0x4108b3[_0x12f9('0x58')](_0x5d7e57);}})['then'](function(_0x53e860){if(_0x53e860){return _0x53e860?{'count':_0x4375df,'rows':_0x53e860}:null;}})[_0x12f9('0x1e')](respondWithResult(_0x489343,null))[_0x12f9('0x4e')](handleError(_0x489343,null));};exports[_0x12f9('0x5a')]=function(_0x127cfd,_0xf8e4bf,_0x201f7a){var _0x45fc59={};var _0x55ddc1={};var _0x39b4fa;var _0x4874e1;return db[_0x12f9('0x37')]['findOne']({'where':{'id':_0x127cfd[_0x12f9('0x50')]['id']}})[_0x12f9('0x1e')](handleEntityNotFound(_0xf8e4bf,null))[_0x12f9('0x1e')](function(_0x4abf09){if(_0x4abf09){_0x39b4fa=_0x4abf09;_0x55ddc1['model']=_[_0x12f9('0x3d')](db['VtigerField'][_0x12f9('0x38')]);_0x55ddc1[_0x12f9('0x3c')]=_[_0x12f9('0x3d')](_0x127cfd[_0x12f9('0x3c')]);_0x55ddc1[_0x12f9('0x3e')]=_[_0x12f9('0x3f')](_0x55ddc1['model'],_0x55ddc1[_0x12f9('0x3c')]);_0x45fc59[_0x12f9('0x41')]=_['intersection'](_0x55ddc1[_0x12f9('0x40')],qs[_0x12f9('0x51')](_0x127cfd[_0x12f9('0x3c')][_0x12f9('0x51')]));_0x45fc59[_0x12f9('0x41')]=_0x45fc59[_0x12f9('0x41')][_0x12f9('0x52')]?_0x45fc59[_0x12f9('0x41')]:_0x55ddc1['model'];_0x45fc59[_0x12f9('0x5b')]=qs[_0x12f9('0x44')](_0x127cfd[_0x12f9('0x3c')][_0x12f9('0x44')]);_0x45fc59['where']=qs[_0x12f9('0x3e')](_[_0x12f9('0x46')](_0x127cfd[_0x12f9('0x3c')],_0x55ddc1[_0x12f9('0x3e')]));if(_0x127cfd[_0x12f9('0x3c')]['filter']){_0x45fc59[_0x12f9('0x45')]=_[_0x12f9('0x48')](_0x45fc59[_0x12f9('0x45')],{'$or':_[_0x12f9('0x36')](_0x45fc59['attributes'],function(_0x6d9b09){var _0x3d18e9={};_0x3d18e9[_0x6d9b09]={'$like':'%'+_0x127cfd['query']['filter']+'%'};return _0x3d18e9;})});}_0x45fc59=_[_0x12f9('0x48')]({},_0x45fc59,_0x127cfd[_0x12f9('0x4a')]);return _0x39b4fa[_0x12f9('0x5a')](_0x45fc59);}})[_0x12f9('0x1e')](function(_0x148c9f){if(_0x148c9f){_0x4874e1=_0x148c9f['length'];if(!_0x127cfd[_0x12f9('0x3c')][_0x12f9('0x42')](_0x12f9('0x43'))){_0x45fc59[_0x12f9('0x2c')]=qs[_0x12f9('0x2c')](_0x127cfd[_0x12f9('0x3c')][_0x12f9('0x2c')]);_0x45fc59[_0x12f9('0x2b')]=qs['offset'](_0x127cfd[_0x12f9('0x3c')][_0x12f9('0x2b')]);}return _0x39b4fa[_0x12f9('0x5a')](_0x45fc59);}})['then'](function(_0x359f72){if(_0x359f72){return _0x359f72?{'count':_0x4874e1,'rows':_0x359f72}:null;}})['then'](respondWithResult(_0xf8e4bf,null))[_0x12f9('0x4e')](handleError(_0xf8e4bf,null));}; \ No newline at end of file +var _0x92ca=['error','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','map','VtigerConfiguration','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','findAll','show','rawAttributes','include','options','find','create','body','update','params','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x92ca,0x95));var _0xa92c=function(_0x62c286,_0x8afc5f){_0x62c286=_0x62c286-0x0;var _0x446c09=_0x92ca[_0x62c286];return _0x446c09;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa92c('0x0'));var rimraf=require(_0xa92c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa92c('0x2'));var Mustache=require(_0xa92c('0x3'));var util=require(_0xa92c('0x4'));var path=require(_0xa92c('0x5'));var sox=require(_0xa92c('0x6'));var csv=require('to-csv');var ejs=require(_0xa92c('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa92c('0x8'));var crypto=require(_0xa92c('0x9'));var jsforce=require(_0xa92c('0xa'));var deskjs=require(_0xa92c('0xb'));var toCsv=require(_0xa92c('0xc'));var querystring=require('querystring');var Papa=require(_0xa92c('0xd'));var Redis=require('ioredis');var authService=require(_0xa92c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa92c('0xf'));var hardwareService=require(_0xa92c('0x10'));var logger=require(_0xa92c('0x11'))(_0xa92c('0x12'));var utils=require(_0xa92c('0x13'));var config=require('../../config/environment');var db=require(_0xa92c('0x14'))['db'];var jayson=require(_0xa92c('0x15'));var client=jayson[_0xa92c('0x16')][_0xa92c('0x17')]({'port':0x232a});function checkPasswordPattern(_0x586eb8,_0x3157f9,_0x438d7a){if(_0x438d7a){var _0x135f1c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x135f1c[_0xa92c('0x18')](_0x3157f9)){return _0x586eb8;}else{throw new db[(_0xa92c('0x19'))][(_0xa92c('0x1a'))](_0xa92c('0x1b'));}}else{return _0x586eb8;}}function respondWithRpcPromise(_0x55842e,_0x2f0e79,_0x3b67e0,_0x38863b){return new BPromise(function(_0x3b6e2c,_0x114033){var _0x477403=_0x38863b||client;return _0x477403[_0xa92c('0x1c')](_0x55842e,_0x3b67e0)['then'](function(_0x574eec){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x2f0e79,_0xa92c('0x1d'));logger[_0xa92c('0x1e')](_0xa92c('0x1f'),_0x2f0e79,_0xa92c('0x1d'),JSON[_0xa92c('0x20')](_0x574eec));if(_0x574eec[_0xa92c('0x21')]){if(_0x574eec['error']['code']===0x1f4){logger[_0xa92c('0x21')](_0xa92c('0x22'),_0x2f0e79,_0x574eec[_0xa92c('0x21')][_0xa92c('0x23')]);return _0x114033(_0x574eec[_0xa92c('0x21')][_0xa92c('0x23')]);}logger[_0xa92c('0x21')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f0e79,_0x574eec[_0xa92c('0x21')][_0xa92c('0x23')]);return _0x3b6e2c(_0x574eec[_0xa92c('0x21')][_0xa92c('0x23')]);}else{logger[_0xa92c('0x24')](_0xa92c('0x22'),_0x2f0e79,'request\x20sent');_0x3b6e2c(_0x574eec[_0xa92c('0x25')][_0xa92c('0x23')]);}})[_0xa92c('0x26')](function(_0x12cc59){logger[_0xa92c('0x21')](_0xa92c('0x22'),_0x2f0e79,_0x12cc59);_0x114033(_0x12cc59);});});}function respondWithStatusCode(_0x4cd4cd,_0x268351){_0x268351=_0x268351||0xcc;return function(_0x41a11f){if(_0x41a11f){return _0x4cd4cd['sendStatus'](_0x268351);}return _0x4cd4cd[_0xa92c('0x27')](_0x268351)[_0xa92c('0x28')]();};}function respondWithResult(_0x5b5e7d,_0x5deb10){_0x5deb10=_0x5deb10||0xc8;return function(_0x4ef3ae){if(_0x4ef3ae){return _0x5b5e7d[_0xa92c('0x27')](_0x5deb10)[_0xa92c('0x29')](_0x4ef3ae);}};}function respondWithFilteredResult(_0xf4f308,_0x42ac13){return function(_0x834096){if(_0x834096){var _0x723963=_0x834096[_0xa92c('0x2a')],_0x35e0ad=_0x42ac13[_0xa92c('0x2b')],_0x408530=_0x42ac13[_0xa92c('0x2b')]+_0x42ac13[_0xa92c('0x2c')],_0x4063a3;if(_0x408530>=_0x723963){_0x408530=_0x723963;_0x4063a3=0xc8;}else{_0x4063a3=0xce;}_0xf4f308['status'](_0x4063a3);return _0xf4f308[_0xa92c('0x2d')](_0xa92c('0x2e'),_0x35e0ad+'-'+_0x408530+'/'+_0x723963)[_0xa92c('0x29')](_0x834096);}return null;};}function patchUpdates(_0x2adb3a){return function(_0x59122a){try{jsonpatch['apply'](_0x59122a,_0x2adb3a,!![]);}catch(_0x465dd3){return BPromise[_0xa92c('0x2f')](_0x465dd3);}return _0x59122a[_0xa92c('0x30')]();};}function saveUpdates(_0x1904ea,_0x3d57a2){return function(_0x1bb938){if(_0x1bb938){return _0x1bb938['update'](_0x1904ea)[_0xa92c('0x31')](function(_0x16fe01){return _0x16fe01;});}return null;};}function removeEntity(_0x2526e7,_0x42a2b4){return function(_0x40af76){if(_0x40af76){return _0x40af76[_0xa92c('0x32')]()['then'](function(){_0x2526e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x467d02,_0x2948e0){return function(_0x25a043){if(!_0x25a043){_0x467d02[_0xa92c('0x33')](0x194);}return _0x25a043;};}function handleError(_0x739dd9,_0x53d8fe){_0x53d8fe=_0x53d8fe||0x1f4;return function(_0x382f1e){logger[_0xa92c('0x21')](_0x382f1e[_0xa92c('0x34')]);if(_0x382f1e[_0xa92c('0x35')]){delete _0x382f1e[_0xa92c('0x35')];}_0x739dd9['status'](_0x53d8fe)[_0xa92c('0x36')](_0x382f1e);};}exports['index']=function(_0x27af36,_0xedaf1a){var _0x336588={},_0x56143c={},_0x49f20b={'count':0x0,'rows':[]};var _0x10362a=_[_0xa92c('0x37')](db[_0xa92c('0x38')]['rawAttributes'],function(_0x247c7e){return{'name':_0x247c7e['fieldName'],'type':_0x247c7e[_0xa92c('0x39')][_0xa92c('0x3a')]};});_0x56143c['model']=_[_0xa92c('0x37')](_0x10362a,'name');_0x56143c[_0xa92c('0x3b')]=_[_0xa92c('0x3c')](_0x27af36[_0xa92c('0x3b')]);_0x56143c['filters']=_[_0xa92c('0x3d')](_0x56143c[_0xa92c('0x3e')],_0x56143c[_0xa92c('0x3b')]);_0x336588['attributes']=_[_0xa92c('0x3d')](_0x56143c[_0xa92c('0x3e')],qs[_0xa92c('0x3f')](_0x27af36[_0xa92c('0x3b')]['fields']));_0x336588[_0xa92c('0x40')]=_0x336588['attributes'][_0xa92c('0x41')]?_0x336588['attributes']:_0x56143c[_0xa92c('0x3e')];if(!_0x27af36[_0xa92c('0x3b')][_0xa92c('0x42')](_0xa92c('0x43'))){_0x336588[_0xa92c('0x2c')]=qs[_0xa92c('0x2c')](_0x27af36['query'][_0xa92c('0x2c')]);_0x336588[_0xa92c('0x2b')]=qs[_0xa92c('0x2b')](_0x27af36[_0xa92c('0x3b')]['offset']);}_0x336588[_0xa92c('0x44')]=qs[_0xa92c('0x45')](_0x27af36[_0xa92c('0x3b')]['sort']);_0x336588['where']=qs[_0xa92c('0x46')](_[_0xa92c('0x47')](_0x27af36[_0xa92c('0x3b')],_0x56143c[_0xa92c('0x46')]),_0x10362a);if(_0x27af36[_0xa92c('0x3b')][_0xa92c('0x48')]){_0x336588[_0xa92c('0x49')]=_[_0xa92c('0x4a')](_0x336588[_0xa92c('0x49')],{'$or':_['map'](_0x10362a,function(_0xbc62ef){if(_0xbc62ef[_0xa92c('0x39')]!=='VIRTUAL'){var _0x50c468={};_0x50c468[_0xbc62ef['name']]={'$like':'%'+_0x27af36[_0xa92c('0x3b')][_0xa92c('0x48')]+'%'};return _0x50c468;}})});}_0x336588=_[_0xa92c('0x4a')]({},_0x336588,_0x27af36['options']);var _0x12d49f={'where':_0x336588[_0xa92c('0x49')]};return db['VtigerConfiguration'][_0xa92c('0x2a')](_0x12d49f)[_0xa92c('0x31')](function(_0x112282){_0x49f20b['count']=_0x112282;if(_0x27af36[_0xa92c('0x3b')][_0xa92c('0x4b')]){_0x336588['include']=[{'all':!![]}];}return db[_0xa92c('0x38')][_0xa92c('0x4c')](_0x336588);})[_0xa92c('0x31')](function(_0x3c0377){_0x49f20b['rows']=_0x3c0377;return _0x49f20b;})[_0xa92c('0x31')](respondWithFilteredResult(_0xedaf1a,_0x336588))[_0xa92c('0x26')](handleError(_0xedaf1a,null));};exports[_0xa92c('0x4d')]=function(_0xdd9591,_0x589692){var _0x45b710={'raw':![],'where':{'id':_0xdd9591['params']['id']}},_0x2e11af={};_0x2e11af[_0xa92c('0x3e')]=_[_0xa92c('0x3c')](db[_0xa92c('0x38')][_0xa92c('0x4e')]);_0x2e11af[_0xa92c('0x3b')]=_[_0xa92c('0x3c')](_0xdd9591[_0xa92c('0x3b')]);_0x2e11af['filters']=_['intersection'](_0x2e11af[_0xa92c('0x3e')],_0x2e11af[_0xa92c('0x3b')]);_0x45b710[_0xa92c('0x40')]=_[_0xa92c('0x3d')](_0x2e11af[_0xa92c('0x3e')],qs[_0xa92c('0x3f')](_0xdd9591[_0xa92c('0x3b')]['fields']));_0x45b710[_0xa92c('0x40')]=_0x45b710[_0xa92c('0x40')][_0xa92c('0x41')]?_0x45b710[_0xa92c('0x40')]:_0x2e11af[_0xa92c('0x3e')];if(_0xdd9591['query'][_0xa92c('0x4b')]){_0x45b710[_0xa92c('0x4f')]=[{'all':!![]}];}_0x45b710=_[_0xa92c('0x4a')]({},_0x45b710,_0xdd9591[_0xa92c('0x50')]);return db[_0xa92c('0x38')][_0xa92c('0x51')](_0x45b710)[_0xa92c('0x31')](handleEntityNotFound(_0x589692,null))['then'](respondWithResult(_0x589692,null))[_0xa92c('0x26')](handleError(_0x589692,null));};exports[_0xa92c('0x52')]=function(_0x3e4cba,_0x48ab0e){return db[_0xa92c('0x38')][_0xa92c('0x52')](_0x3e4cba[_0xa92c('0x53')],{})[_0xa92c('0x31')](respondWithResult(_0x48ab0e,0xc9))['catch'](handleError(_0x48ab0e,null));};exports[_0xa92c('0x54')]=function(_0x1eb1ed,_0x1fb424){if(_0x1eb1ed[_0xa92c('0x53')]['id']){delete _0x1eb1ed['body']['id'];}return db[_0xa92c('0x38')]['find']({'where':{'id':_0x1eb1ed[_0xa92c('0x55')]['id']}})['then'](handleEntityNotFound(_0x1fb424,null))['then'](saveUpdates(_0x1eb1ed[_0xa92c('0x53')],null))[_0xa92c('0x31')](respondWithResult(_0x1fb424,null))['catch'](handleError(_0x1fb424,null));};exports[_0xa92c('0x32')]=function(_0xd4b319,_0x301e37){return db[_0xa92c('0x38')]['find']({'where':{'id':_0xd4b319['params']['id']}})[_0xa92c('0x31')](handleEntityNotFound(_0x301e37,null))[_0xa92c('0x31')](removeEntity(_0x301e37,null))[_0xa92c('0x26')](handleError(_0x301e37,null));};exports['getFields']=function(_0x38e294,_0x52c6c8,_0x44cc93){var _0x4c8cb7={};var _0xc68314={};var _0x53b2df;var _0x560f7a;return db[_0xa92c('0x38')][_0xa92c('0x56')]({'where':{'id':_0x38e294[_0xa92c('0x55')]['id']}})[_0xa92c('0x31')](handleEntityNotFound(_0x52c6c8,null))[_0xa92c('0x31')](function(_0x227fc6){if(_0x227fc6){_0x53b2df=_0x227fc6;_0xc68314[_0xa92c('0x3e')]=_[_0xa92c('0x3c')](db[_0xa92c('0x57')][_0xa92c('0x4e')]);_0xc68314[_0xa92c('0x3b')]=_[_0xa92c('0x3c')](_0x38e294[_0xa92c('0x3b')]);_0xc68314[_0xa92c('0x46')]=_['intersection'](_0xc68314[_0xa92c('0x3e')],_0xc68314[_0xa92c('0x3b')]);_0x4c8cb7[_0xa92c('0x40')]=_[_0xa92c('0x3d')](_0xc68314[_0xa92c('0x3e')],qs[_0xa92c('0x3f')](_0x38e294[_0xa92c('0x3b')][_0xa92c('0x3f')]));_0x4c8cb7[_0xa92c('0x40')]=_0x4c8cb7[_0xa92c('0x40')]['length']?_0x4c8cb7[_0xa92c('0x40')]:_0xc68314[_0xa92c('0x3e')];_0x4c8cb7[_0xa92c('0x44')]=qs[_0xa92c('0x45')](_0x38e294['query'][_0xa92c('0x45')]);_0x4c8cb7[_0xa92c('0x49')]=qs[_0xa92c('0x46')](_['pick'](_0x38e294[_0xa92c('0x3b')],_0xc68314[_0xa92c('0x46')]));if(_0x38e294[_0xa92c('0x3b')]['filter']){_0x4c8cb7[_0xa92c('0x49')]=_[_0xa92c('0x4a')](_0x4c8cb7[_0xa92c('0x49')],{'$or':_[_0xa92c('0x37')](_0x4c8cb7[_0xa92c('0x40')],function(_0x5c11a7){var _0x4b0300={};_0x4b0300[_0x5c11a7]={'$like':'%'+_0x38e294['query'][_0xa92c('0x48')]+'%'};return _0x4b0300;})});}_0x4c8cb7=_[_0xa92c('0x4a')]({},_0x4c8cb7,_0x38e294[_0xa92c('0x50')]);return _0x53b2df[_0xa92c('0x58')](_0x4c8cb7);}})[_0xa92c('0x31')](function(_0x5619af){if(_0x5619af){_0x560f7a=_0x5619af['length'];if(!_0x38e294[_0xa92c('0x3b')][_0xa92c('0x42')]('nolimit')){_0x4c8cb7[_0xa92c('0x2c')]=qs['limit'](_0x38e294[_0xa92c('0x3b')]['limit']);_0x4c8cb7[_0xa92c('0x2b')]=qs[_0xa92c('0x2b')](_0x38e294[_0xa92c('0x3b')][_0xa92c('0x2b')]);}return _0x53b2df['getFields'](_0x4c8cb7);}})[_0xa92c('0x31')](function(_0x17d178){if(_0x17d178){return _0x17d178?{'count':_0x560f7a,'rows':_0x17d178}:null;}})[_0xa92c('0x31')](respondWithResult(_0x52c6c8,null))[_0xa92c('0x26')](handleError(_0x52c6c8,null));};exports['getSubjects']=function(_0x49a5c0,_0x11d557,_0x5d8075){var _0xd68ef3={};var _0x579aa2={};var _0x589c6f;var _0x123519;return db[_0xa92c('0x38')][_0xa92c('0x56')]({'where':{'id':_0x49a5c0['params']['id']}})[_0xa92c('0x31')](handleEntityNotFound(_0x11d557,null))['then'](function(_0x25d416){if(_0x25d416){_0x589c6f=_0x25d416;_0x579aa2[_0xa92c('0x3e')]=_[_0xa92c('0x3c')](db['VtigerField'][_0xa92c('0x4e')]);_0x579aa2[_0xa92c('0x3b')]=_[_0xa92c('0x3c')](_0x49a5c0[_0xa92c('0x3b')]);_0x579aa2[_0xa92c('0x46')]=_[_0xa92c('0x3d')](_0x579aa2['model'],_0x579aa2[_0xa92c('0x3b')]);_0xd68ef3[_0xa92c('0x40')]=_[_0xa92c('0x3d')](_0x579aa2[_0xa92c('0x3e')],qs[_0xa92c('0x3f')](_0x49a5c0[_0xa92c('0x3b')][_0xa92c('0x3f')]));_0xd68ef3[_0xa92c('0x40')]=_0xd68ef3['attributes'][_0xa92c('0x41')]?_0xd68ef3[_0xa92c('0x40')]:_0x579aa2[_0xa92c('0x3e')];_0xd68ef3['order']=qs[_0xa92c('0x45')](_0x49a5c0['query'][_0xa92c('0x45')]);_0xd68ef3[_0xa92c('0x49')]=qs[_0xa92c('0x46')](_[_0xa92c('0x47')](_0x49a5c0[_0xa92c('0x3b')],_0x579aa2[_0xa92c('0x46')]));if(_0x49a5c0[_0xa92c('0x3b')][_0xa92c('0x48')]){_0xd68ef3[_0xa92c('0x49')]=_[_0xa92c('0x4a')](_0xd68ef3[_0xa92c('0x49')],{'$or':_[_0xa92c('0x37')](_0xd68ef3[_0xa92c('0x40')],function(_0x196a3e){var _0x3c428a={};_0x3c428a[_0x196a3e]={'$like':'%'+_0x49a5c0[_0xa92c('0x3b')][_0xa92c('0x48')]+'%'};return _0x3c428a;})});}_0xd68ef3=_[_0xa92c('0x4a')]({},_0xd68ef3,_0x49a5c0[_0xa92c('0x50')]);return _0x589c6f[_0xa92c('0x59')](_0xd68ef3);}})[_0xa92c('0x31')](function(_0xfa4fab){if(_0xfa4fab){_0x123519=_0xfa4fab[_0xa92c('0x41')];if(!_0x49a5c0[_0xa92c('0x3b')][_0xa92c('0x42')](_0xa92c('0x43'))){_0xd68ef3['limit']=qs[_0xa92c('0x2c')](_0x49a5c0['query'][_0xa92c('0x2c')]);_0xd68ef3['offset']=qs[_0xa92c('0x2b')](_0x49a5c0[_0xa92c('0x3b')][_0xa92c('0x2b')]);}return _0x589c6f['getSubjects'](_0xd68ef3);}})[_0xa92c('0x31')](function(_0x1ee9c5){if(_0x1ee9c5){return _0x1ee9c5?{'count':_0x123519,'rows':_0x1ee9c5}:null;}})[_0xa92c('0x31')](respondWithResult(_0x11d557,null))[_0xa92c('0x26')](handleError(_0x11d557,null));};exports[_0xa92c('0x5a')]=function(_0x5cbfcb,_0x4231f5,_0x505db1){var _0x57b726={};var _0x4c5a7f={};var _0x3812ba;var _0x3ff67c;return db[_0xa92c('0x38')][_0xa92c('0x56')]({'where':{'id':_0x5cbfcb[_0xa92c('0x55')]['id']}})[_0xa92c('0x31')](handleEntityNotFound(_0x4231f5,null))[_0xa92c('0x31')](function(_0x4f4804){if(_0x4f4804){_0x3812ba=_0x4f4804;_0x4c5a7f['model']=_['keys'](db[_0xa92c('0x57')]['rawAttributes']);_0x4c5a7f[_0xa92c('0x3b')]=_[_0xa92c('0x3c')](_0x5cbfcb[_0xa92c('0x3b')]);_0x4c5a7f['filters']=_[_0xa92c('0x3d')](_0x4c5a7f[_0xa92c('0x3e')],_0x4c5a7f[_0xa92c('0x3b')]);_0x57b726[_0xa92c('0x40')]=_[_0xa92c('0x3d')](_0x4c5a7f['model'],qs[_0xa92c('0x3f')](_0x5cbfcb['query']['fields']));_0x57b726[_0xa92c('0x40')]=_0x57b726[_0xa92c('0x40')][_0xa92c('0x41')]?_0x57b726['attributes']:_0x4c5a7f[_0xa92c('0x3e')];_0x57b726['order']=qs[_0xa92c('0x45')](_0x5cbfcb['query'][_0xa92c('0x45')]);_0x57b726[_0xa92c('0x49')]=qs[_0xa92c('0x46')](_[_0xa92c('0x47')](_0x5cbfcb[_0xa92c('0x3b')],_0x4c5a7f['filters']));if(_0x5cbfcb[_0xa92c('0x3b')]['filter']){_0x57b726[_0xa92c('0x49')]=_['merge'](_0x57b726[_0xa92c('0x49')],{'$or':_['map'](_0x57b726[_0xa92c('0x40')],function(_0x312298){var _0x22d28a={};_0x22d28a[_0x312298]={'$like':'%'+_0x5cbfcb[_0xa92c('0x3b')][_0xa92c('0x48')]+'%'};return _0x22d28a;})});}_0x57b726=_[_0xa92c('0x4a')]({},_0x57b726,_0x5cbfcb['options']);return _0x3812ba[_0xa92c('0x5a')](_0x57b726);}})[_0xa92c('0x31')](function(_0x94edb5){if(_0x94edb5){_0x3ff67c=_0x94edb5[_0xa92c('0x41')];if(!_0x5cbfcb[_0xa92c('0x3b')][_0xa92c('0x42')]('nolimit')){_0x57b726['limit']=qs[_0xa92c('0x2c')](_0x5cbfcb[_0xa92c('0x3b')][_0xa92c('0x2c')]);_0x57b726['offset']=qs[_0xa92c('0x2b')](_0x5cbfcb[_0xa92c('0x3b')]['offset']);}return _0x3812ba['getDescriptions'](_0x57b726);}})['then'](function(_0x5d35bd){if(_0x5d35bd){return _0x5d35bd?{'count':_0x3ff67c,'rows':_0x5d35bd}:null;}})['then'](respondWithResult(_0x4231f5,null))['catch'](handleError(_0x4231f5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ea1d725..eb0c0a1 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 _0xc21a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','lodash','util'];(function(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0xc21a,0x136));var _0xac21=function(_0x5bd1f4,_0x44ebb1){_0x5bd1f4=_0x5bd1f4-0x0;var _0x410e68=_0xc21a[_0x5bd1f4];return _0x410e68;};'use strict';var _=require(_0xac21('0x0'));var util=require(_0xac21('0x1'));var logger=require(_0xac21('0x2'))(_0xac21('0x3'));var moment=require(_0xac21('0x4'));var BPromise=require(_0xac21('0x5'));var rp=require(_0xac21('0x6'));var fs=require('fs');var path=require(_0xac21('0x7'));var rimraf=require(_0xac21('0x8'));var config=require(_0xac21('0x9'));var attributes=require(_0xac21('0xa'));module['exports']=function(_0x38a569,_0x3e0d5f){return _0x38a569[_0xac21('0xb')](_0xac21('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88de=['moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api'];(function(_0x569fa6,_0x3210ef){var _0x48d047=function(_0x283812){while(--_0x283812){_0x569fa6['push'](_0x569fa6['shift']());}};_0x48d047(++_0x3210ef);}(_0x88de,0xb9));var _0xe88d=function(_0x5a121a,_0x59b77c){_0x5a121a=_0x5a121a-0x0;var _0x1edd1c=_0x88de[_0x5a121a];return _0x1edd1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe88d('0x0'))(_0xe88d('0x1'));var moment=require(_0xe88d('0x2'));var BPromise=require('bluebird');var rp=require(_0xe88d('0x3'));var fs=require('fs');var path=require(_0xe88d('0x4'));var rimraf=require(_0xe88d('0x5'));var config=require(_0xe88d('0x6'));var attributes=require(_0xe88d('0x7'));module[_0xe88d('0x8')]=function(_0x4f613c,_0x3ef6e8){return _0x4f613c['define'](_0xe88d('0x9'),attributes,{'tableName':_0xe88d('0xa'),'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 4d9a14b..3755a71 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 _0x3afa=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x48e425,_0x34adfd){var _0x55add0=function(_0x1bdb9b){while(--_0x1bdb9b){_0x48e425['push'](_0x48e425['shift']());}};_0x55add0(++_0x34adfd);}(_0x3afa,0xac));var _0xa3af=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0x3afa[_0x49cb71];return _0x3a50fd;};'use strict';var _=require(_0xa3af('0x0'));var util=require(_0xa3af('0x1'));var moment=require(_0xa3af('0x2'));var BPromise=require(_0xa3af('0x3'));var rs=require(_0xa3af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3af('0x5'))['db'];var utils=require(_0xa3af('0x6'));var logger=require(_0xa3af('0x7'))(_0xa3af('0x8'));var config=require(_0xa3af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa3af('0xa')][_0xa3af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6d5b5b,_0x3f8711,_0x270225){return new BPromise(function(_0x5b539e,_0x26027d){return client[_0xa3af('0xc')](_0x6d5b5b,_0x270225)['then'](function(_0x1f8814){logger[_0xa3af('0xd')](_0xa3af('0xe'),_0x3f8711,_0xa3af('0xf'));logger[_0xa3af('0x10')](_0xa3af('0x11'),_0x3f8711,_0xa3af('0xf'),JSON[_0xa3af('0x12')](_0x1f8814));if(_0x1f8814[_0xa3af('0x13')]){if(_0x1f8814[_0xa3af('0x13')][_0xa3af('0x14')]===0x1f4){logger[_0xa3af('0x13')](_0xa3af('0xe'),_0x3f8711,_0x1f8814['error'][_0xa3af('0x15')]);return _0x26027d(_0x1f8814[_0xa3af('0x13')][_0xa3af('0x15')]);}logger['error'](_0xa3af('0xe'),_0x3f8711,_0x1f8814[_0xa3af('0x13')][_0xa3af('0x15')]);return _0x5b539e(_0x1f8814[_0xa3af('0x13')]['message']);}else{logger[_0xa3af('0xd')](_0xa3af('0xe'),_0x3f8711,_0xa3af('0xf'));_0x5b539e(_0x1f8814[_0xa3af('0x16')]['message']);}})[_0xa3af('0x17')](function(_0x5e80ec){logger[_0xa3af('0x13')](_0xa3af('0xe'),_0x3f8711,_0x5e80ec);_0x26027d(_0x5e80ec);});});} \ No newline at end of file +var _0xa457=['request','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa457,0x79));var _0x7a45=function(_0x31a494,_0x4dff0d){_0x31a494=_0x31a494-0x0;var _0x573129=_0xa457[_0x31a494];return _0x573129;};'use strict';var _=require(_0x7a45('0x0'));var util=require(_0x7a45('0x1'));var moment=require(_0x7a45('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a45('0x3'));var fs=require('fs');var Redis=require(_0x7a45('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a45('0x5'));var logger=require(_0x7a45('0x6'))(_0x7a45('0x7'));var config=require('../../config/environment');var jayson=require(_0x7a45('0x8'));var client=jayson[_0x7a45('0x9')][_0x7a45('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x591141,_0x55e37c,_0x2e1db9){return new BPromise(function(_0x4d2a07,_0x454300){return client[_0x7a45('0xb')](_0x591141,_0x2e1db9)[_0x7a45('0xc')](function(_0x976ce8){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x55e37c,_0x7a45('0xd'));logger[_0x7a45('0xe')](_0x7a45('0xf'),_0x55e37c,'request\x20sent',JSON[_0x7a45('0x10')](_0x976ce8));if(_0x976ce8[_0x7a45('0x11')]){if(_0x976ce8[_0x7a45('0x11')]['code']===0x1f4){logger[_0x7a45('0x11')](_0x7a45('0x12'),_0x55e37c,_0x976ce8[_0x7a45('0x11')][_0x7a45('0x13')]);return _0x454300(_0x976ce8['error'][_0x7a45('0x13')]);}logger['error'](_0x7a45('0x12'),_0x55e37c,_0x976ce8[_0x7a45('0x11')]['message']);return _0x4d2a07(_0x976ce8['error']['message']);}else{logger['info'](_0x7a45('0x12'),_0x55e37c,_0x7a45('0xd'));_0x4d2a07(_0x976ce8[_0x7a45('0x14')][_0x7a45('0x13')]);}})[_0x7a45('0x15')](function(_0x57d420){logger[_0x7a45('0x11')](_0x7a45('0x12'),_0x55e37c,_0x57d420);_0x454300(_0x57d420);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7f377d8..01c3a1d 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 _0x8e9b=['index','/:id','show','create','put','update','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated'];(function(_0x207438,_0x267449){var _0x405ae6=function(_0x38dcb8){while(--_0x38dcb8){_0x207438['push'](_0x207438['shift']());}};_0x405ae6(++_0x267449);}(_0x8e9b,0x1ab));var _0xb8e9=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0x8e9b[_0x11d95f];return _0x2b1a14;};'use strict';var multer=require('multer');var util=require(_0xb8e9('0x0'));var path=require(_0xb8e9('0x1'));var timeout=require(_0xb8e9('0x2'));var express=require(_0xb8e9('0x3'));var router=express['Router']();var auth=require(_0xb8e9('0x4'));var interaction=require(_0xb8e9('0x5'));var config=require('../../config/environment');var controller=require(_0xb8e9('0x6'));router['get']('/',auth[_0xb8e9('0x7')](),controller[_0xb8e9('0x8')]);router['get'](_0xb8e9('0x9'),auth[_0xb8e9('0x7')](),controller[_0xb8e9('0xa')]);router['post']('/',auth[_0xb8e9('0x7')](),controller[_0xb8e9('0xb')]);router[_0xb8e9('0xc')]('/:id',auth[_0xb8e9('0x7')](),controller[_0xb8e9('0xd')]);router['delete']('/:id',auth[_0xb8e9('0x7')](),controller[_0xb8e9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5518=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0xf44d31,_0x1b1968){var _0x3f4f97=function(_0x1cc3be){while(--_0x1cc3be){_0xf44d31['push'](_0xf44d31['shift']());}};_0x3f4f97(++_0x1b1968);}(_0x5518,0x108));var _0x8551=function(_0x12aa02,_0x116599){_0x12aa02=_0x12aa02-0x0;var _0x3deddd=_0x5518[_0x12aa02];return _0x3deddd;};'use strict';var multer=require(_0x8551('0x0'));var util=require(_0x8551('0x1'));var path=require(_0x8551('0x2'));var timeout=require(_0x8551('0x3'));var express=require('express');var router=express[_0x8551('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8551('0x5'));var config=require(_0x8551('0x6'));var controller=require(_0x8551('0x7'));router[_0x8551('0x8')]('/',auth[_0x8551('0x9')](),controller[_0x8551('0xa')]);router[_0x8551('0x8')](_0x8551('0xb'),auth['isAuthenticated'](),controller[_0x8551('0xc')]);router[_0x8551('0xd')]('/',auth[_0x8551('0x9')](),controller[_0x8551('0xe')]);router[_0x8551('0xf')](_0x8551('0xb'),auth[_0x8551('0x9')](),controller[_0x8551('0x10')]);router['delete'](_0x8551('0xb'),auth[_0x8551('0x9')](),controller[_0x8551('0x11')]);module[_0x8551('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 3705e56..437d798 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 _0x744c=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x47952c,_0x3049e0){var _0x2616ca=function(_0x5cea1f){while(--_0x5cea1f){_0x47952c['push'](_0x47952c['shift']());}};_0x2616ca(++_0x3049e0);}(_0x744c,0xa0));var _0xc744=function(_0x369d63,_0x386b47){_0x369d63=_0x369d63-0x0;var _0x433d80=_0x744c[_0x369d63];return _0x433d80;};'use strict';var Sequelize=require(_0xc744('0x0'));module[_0xc744('0x1')]={'type':{'type':Sequelize[_0xc744('0x2')](_0xc744('0x3'),'variable',_0xc744('0x4'),_0xc744('0x5')),'defaultValue':_0xc744('0x3')},'content':{'type':Sequelize[_0xc744('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc744('0x3'),_0xc744('0x7'),_0xc744('0x4'))},'keyContent':{'type':Sequelize[_0xc744('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc744('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc744('0x6')]}}; \ No newline at end of file +var _0xf534=['variable','BOOLEAN','sequelize','exports','string','customVariable','STRING','ENUM'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xf534,0x9a));var _0x4f53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf534[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4f53('0x0'));module[_0x4f53('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4f53('0x2'),'variable',_0x4f53('0x3'),'keyValue'),'defaultValue':_0x4f53('0x2')},'content':{'type':Sequelize[_0x4f53('0x4')]},'key':{'type':Sequelize[_0x4f53('0x4')]},'keyType':{'type':Sequelize[_0x4f53('0x5')](_0x4f53('0x2'),_0x4f53('0x6'),_0x4f53('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4f53('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4f53('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f53('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0d72d48..9a9b499 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 _0x92a3=['fields','nolimit','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','json','count','offset','Content-Range','apply','save','update','then','status','end','error','stack','name','map','VtigerField','fieldName','type','key','query','keys','intersection','model','attributes'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x92a3,0x140));var _0x392a=function(_0x3f825c,_0x6e92e4){_0x3f825c=_0x3f825c-0x0;var _0x5cd0cf=_0x92a3[_0x3f825c];return _0x5cd0cf;};'use strict';var pdf=require(_0x392a('0x0'));var emlformat=require(_0x392a('0x1'));var rimraf=require(_0x392a('0x2'));var zipdir=require(_0x392a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x392a('0x4'));var moment=require(_0x392a('0x5'));var BPromise=require(_0x392a('0x6'));var Mustache=require(_0x392a('0x7'));var util=require(_0x392a('0x8'));var path=require(_0x392a('0x9'));var sox=require(_0x392a('0xa'));var csv=require('to-csv');var ejs=require(_0x392a('0xb'));var fs=require('fs');var _=require(_0x392a('0xc'));var squel=require('squel');var crypto=require(_0x392a('0xd'));var jsforce=require(_0x392a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x392a('0xf'));var Papa=require(_0x392a('0x10'));var Redis=require(_0x392a('0x11'));var authService=require(_0x392a('0x12'));var qs=require(_0x392a('0x13'));var as=require(_0x392a('0x14'));var hardwareService=require(_0x392a('0x15'));var logger=require(_0x392a('0x16'))(_0x392a('0x17'));var utils=require(_0x392a('0x18'));var config=require('../../config/environment');var db=require(_0x392a('0x19'))['db'];function respondWithStatusCode(_0x2e6005,_0x186b09){_0x186b09=_0x186b09||0xcc;return function(_0x52cdd2){if(_0x52cdd2){return _0x2e6005[_0x392a('0x1a')](_0x186b09);}return _0x2e6005['status'](_0x186b09)['end']();};}function respondWithResult(_0x307c2a,_0x2b5e4d){_0x2b5e4d=_0x2b5e4d||0xc8;return function(_0xc9d22f){if(_0xc9d22f){return _0x307c2a['status'](_0x2b5e4d)[_0x392a('0x1b')](_0xc9d22f);}};}function respondWithFilteredResult(_0x32f0f3,_0x11c6da){return function(_0x518238){if(_0x518238){var _0x44275a=_0x518238[_0x392a('0x1c')],_0x56c7c9=_0x11c6da['offset'],_0x39a21d=_0x11c6da[_0x392a('0x1d')]+_0x11c6da['limit'],_0x20cadb;if(_0x39a21d>=_0x44275a){_0x39a21d=_0x44275a;_0x20cadb=0xc8;}else{_0x20cadb=0xce;}_0x32f0f3['status'](_0x20cadb);return _0x32f0f3['set'](_0x392a('0x1e'),_0x56c7c9+'-'+_0x39a21d+'/'+_0x44275a)['json'](_0x518238);}return null;};}function patchUpdates(_0x4d2cf6){return function(_0x181e18){try{jsonpatch[_0x392a('0x1f')](_0x181e18,_0x4d2cf6,!![]);}catch(_0x5c2a16){return BPromise['reject'](_0x5c2a16);}return _0x181e18[_0x392a('0x20')]();};}function saveUpdates(_0x1e86cb,_0x45ef31){return function(_0x27cb5c){if(_0x27cb5c){return _0x27cb5c[_0x392a('0x21')](_0x1e86cb)[_0x392a('0x22')](function(_0x3201f2){return _0x3201f2;});}return null;};}function removeEntity(_0x1bd8be,_0x3ea8d4){return function(_0x565786){if(_0x565786){return _0x565786['destroy']()[_0x392a('0x22')](function(){_0x1bd8be[_0x392a('0x23')](0xcc)[_0x392a('0x24')]();});}};}function handleEntityNotFound(_0x5e0c18,_0x2688e2){return function(_0x49f0d1){if(!_0x49f0d1){_0x5e0c18['sendStatus'](0x194);}return _0x49f0d1;};}function handleError(_0x2e439f,_0xff17c7){_0xff17c7=_0xff17c7||0x1f4;return function(_0x137b2c){logger[_0x392a('0x25')](_0x137b2c[_0x392a('0x26')]);if(_0x137b2c['name']){delete _0x137b2c[_0x392a('0x27')];}_0x2e439f['status'](_0xff17c7)['send'](_0x137b2c);};}exports['index']=function(_0x226b3b,_0x1f7255){var _0x1eef31={},_0x3576e4={},_0x4ce792={'count':0x0,'rows':[]};var _0x4e7d69=_[_0x392a('0x28')](db[_0x392a('0x29')]['rawAttributes'],function(_0x1ea5c2){return{'name':_0x1ea5c2[_0x392a('0x2a')],'type':_0x1ea5c2[_0x392a('0x2b')][_0x392a('0x2c')]};});_0x3576e4['model']=_['map'](_0x4e7d69,'name');_0x3576e4[_0x392a('0x2d')]=_[_0x392a('0x2e')](_0x226b3b[_0x392a('0x2d')]);_0x3576e4['filters']=_[_0x392a('0x2f')](_0x3576e4[_0x392a('0x30')],_0x3576e4[_0x392a('0x2d')]);_0x1eef31[_0x392a('0x31')]=_[_0x392a('0x2f')](_0x3576e4[_0x392a('0x30')],qs[_0x392a('0x32')](_0x226b3b['query'][_0x392a('0x32')]));_0x1eef31['attributes']=_0x1eef31['attributes']['length']?_0x1eef31[_0x392a('0x31')]:_0x3576e4[_0x392a('0x30')];if(!_0x226b3b[_0x392a('0x2d')]['hasOwnProperty'](_0x392a('0x33'))){_0x1eef31[_0x392a('0x34')]=qs[_0x392a('0x34')](_0x226b3b[_0x392a('0x2d')][_0x392a('0x34')]);_0x1eef31['offset']=qs['offset'](_0x226b3b['query'][_0x392a('0x1d')]);}_0x1eef31['order']=qs[_0x392a('0x35')](_0x226b3b['query'][_0x392a('0x35')]);_0x1eef31[_0x392a('0x36')]=qs['filters'](_[_0x392a('0x37')](_0x226b3b[_0x392a('0x2d')],_0x3576e4[_0x392a('0x38')]),_0x4e7d69);if(_0x226b3b[_0x392a('0x2d')][_0x392a('0x39')]){_0x1eef31[_0x392a('0x36')]=_[_0x392a('0x3a')](_0x1eef31['where'],{'$or':_[_0x392a('0x28')](_0x4e7d69,function(_0x2f87d0){if(_0x2f87d0[_0x392a('0x2b')]!==_0x392a('0x3b')){var _0x4cd125={};_0x4cd125[_0x2f87d0[_0x392a('0x27')]]={'$like':'%'+_0x226b3b[_0x392a('0x2d')][_0x392a('0x39')]+'%'};return _0x4cd125;}})});}_0x1eef31=_[_0x392a('0x3a')]({},_0x1eef31,_0x226b3b[_0x392a('0x3c')]);var _0x4194d0={'where':_0x1eef31['where']};return db[_0x392a('0x29')][_0x392a('0x1c')](_0x4194d0)['then'](function(_0x4c59ba){_0x4ce792[_0x392a('0x1c')]=_0x4c59ba;if(_0x226b3b['query'][_0x392a('0x3d')]){_0x1eef31[_0x392a('0x3e')]=[{'all':!![]}];}return db['VtigerField'][_0x392a('0x3f')](_0x1eef31);})['then'](function(_0x439507){_0x4ce792[_0x392a('0x40')]=_0x439507;return _0x4ce792;})[_0x392a('0x22')](respondWithFilteredResult(_0x1f7255,_0x1eef31))[_0x392a('0x41')](handleError(_0x1f7255,null));};exports[_0x392a('0x42')]=function(_0x1274e2,_0x4fca36){var _0x1743f4={'raw':!![],'where':{'id':_0x1274e2[_0x392a('0x43')]['id']}},_0x25a2da={};_0x25a2da[_0x392a('0x30')]=_[_0x392a('0x2e')](db[_0x392a('0x29')][_0x392a('0x44')]);_0x25a2da[_0x392a('0x2d')]=_['keys'](_0x1274e2[_0x392a('0x2d')]);_0x25a2da['filters']=_['intersection'](_0x25a2da['model'],_0x25a2da[_0x392a('0x2d')]);_0x1743f4[_0x392a('0x31')]=_[_0x392a('0x2f')](_0x25a2da[_0x392a('0x30')],qs[_0x392a('0x32')](_0x1274e2[_0x392a('0x2d')][_0x392a('0x32')]));_0x1743f4[_0x392a('0x31')]=_0x1743f4[_0x392a('0x31')][_0x392a('0x45')]?_0x1743f4[_0x392a('0x31')]:_0x25a2da['model'];if(_0x1274e2[_0x392a('0x2d')][_0x392a('0x3d')]){_0x1743f4[_0x392a('0x3e')]=[{'all':!![]}];}_0x1743f4=_[_0x392a('0x3a')]({},_0x1743f4,_0x1274e2[_0x392a('0x3c')]);return db[_0x392a('0x29')][_0x392a('0x46')](_0x1743f4)[_0x392a('0x22')](handleEntityNotFound(_0x4fca36,null))[_0x392a('0x22')](respondWithResult(_0x4fca36,null))[_0x392a('0x41')](handleError(_0x4fca36,null));};exports[_0x392a('0x47')]=function(_0x45127a,_0x45dfbe){return db[_0x392a('0x29')]['create'](_0x45127a[_0x392a('0x48')],{})[_0x392a('0x22')](respondWithResult(_0x45dfbe,0xc9))[_0x392a('0x41')](handleError(_0x45dfbe,null));};exports['update']=function(_0x3a5f66,_0x324d4c){if(_0x3a5f66[_0x392a('0x48')]['id']){delete _0x3a5f66[_0x392a('0x48')]['id'];}return db[_0x392a('0x29')]['find']({'where':{'id':_0x3a5f66['params']['id']}})[_0x392a('0x22')](handleEntityNotFound(_0x324d4c,null))[_0x392a('0x22')](saveUpdates(_0x3a5f66['body'],null))[_0x392a('0x22')](respondWithResult(_0x324d4c,null))[_0x392a('0x41')](handleError(_0x324d4c,null));};exports[_0x392a('0x49')]=function(_0x3a4a49,_0xd378c2){return db[_0x392a('0x29')][_0x392a('0x46')]({'where':{'id':_0x3a4a49[_0x392a('0x43')]['id']}})[_0x392a('0x22')](handleEntityNotFound(_0xd378c2,null))[_0x392a('0x22')](removeEntity(_0xd378c2,null))['catch'](handleError(_0xd378c2,null));}; \ No newline at end of file +var _0x1e0c=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','end','json','count','set','Content-Range','reject','save','update','then','sendStatus','stack','name','VtigerField','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','intersection','length','find','create','body','destroy','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x406e1d,_0x58be6a){var _0x175567=function(_0x244575){while(--_0x244575){_0x406e1d['push'](_0x406e1d['shift']());}};_0x175567(++_0x58be6a);}(_0x1e0c,0xc7));var _0xc1e0=function(_0x3f4e4c,_0x4f4d9f){_0x3f4e4c=_0x3f4e4c-0x0;var _0x3c6359=_0x1e0c[_0x3f4e4c];return _0x3c6359;};'use strict';var pdf=require(_0xc1e0('0x0'));var emlformat=require(_0xc1e0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc1e0('0x2'));var rp=require('request-promise');var moment=require(_0xc1e0('0x3'));var BPromise=require(_0xc1e0('0x4'));var Mustache=require(_0xc1e0('0x5'));var util=require(_0xc1e0('0x6'));var path=require('path');var sox=require(_0xc1e0('0x7'));var csv=require(_0xc1e0('0x8'));var ejs=require(_0xc1e0('0x9'));var fs=require('fs');var _=require(_0xc1e0('0xa'));var squel=require('squel');var crypto=require(_0xc1e0('0xb'));var jsforce=require(_0xc1e0('0xc'));var deskjs=require(_0xc1e0('0xd'));var toCsv=require(_0xc1e0('0x8'));var querystring=require(_0xc1e0('0xe'));var Papa=require(_0xc1e0('0xf'));var Redis=require(_0xc1e0('0x10'));var authService=require(_0xc1e0('0x11'));var qs=require(_0xc1e0('0x12'));var as=require(_0xc1e0('0x13'));var hardwareService=require(_0xc1e0('0x14'));var logger=require(_0xc1e0('0x15'))(_0xc1e0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3acb89,_0x53e8c5){_0x53e8c5=_0x53e8c5||0xcc;return function(_0x4a5acb){if(_0x4a5acb){return _0x3acb89['sendStatus'](_0x53e8c5);}return _0x3acb89[_0xc1e0('0x17')](_0x53e8c5)[_0xc1e0('0x18')]();};}function respondWithResult(_0x30a80c,_0x23660d){_0x23660d=_0x23660d||0xc8;return function(_0x5c4dad){if(_0x5c4dad){return _0x30a80c[_0xc1e0('0x17')](_0x23660d)[_0xc1e0('0x19')](_0x5c4dad);}};}function respondWithFilteredResult(_0x4be4bc,_0x408c84){return function(_0x14492f){if(_0x14492f){var _0x493024=_0x14492f[_0xc1e0('0x1a')],_0x48ed32=_0x408c84['offset'],_0x277444=_0x408c84['offset']+_0x408c84['limit'],_0x42fe84;if(_0x277444>=_0x493024){_0x277444=_0x493024;_0x42fe84=0xc8;}else{_0x42fe84=0xce;}_0x4be4bc[_0xc1e0('0x17')](_0x42fe84);return _0x4be4bc[_0xc1e0('0x1b')](_0xc1e0('0x1c'),_0x48ed32+'-'+_0x277444+'/'+_0x493024)[_0xc1e0('0x19')](_0x14492f);}return null;};}function patchUpdates(_0x1dc671){return function(_0x3d6ea9){try{jsonpatch['apply'](_0x3d6ea9,_0x1dc671,!![]);}catch(_0x7d550f){return BPromise[_0xc1e0('0x1d')](_0x7d550f);}return _0x3d6ea9[_0xc1e0('0x1e')]();};}function saveUpdates(_0x1bb079,_0x327d7a){return function(_0x205320){if(_0x205320){return _0x205320[_0xc1e0('0x1f')](_0x1bb079)[_0xc1e0('0x20')](function(_0x1ef8b7){return _0x1ef8b7;});}return null;};}function removeEntity(_0x4980ce,_0x51cef8){return function(_0x16fe3b){if(_0x16fe3b){return _0x16fe3b['destroy']()['then'](function(){_0x4980ce[_0xc1e0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57d01b,_0x213446){return function(_0x3cbf5a){if(!_0x3cbf5a){_0x57d01b[_0xc1e0('0x21')](0x194);}return _0x3cbf5a;};}function handleError(_0x2eb078,_0x205032){_0x205032=_0x205032||0x1f4;return function(_0x1a4821){logger['error'](_0x1a4821[_0xc1e0('0x22')]);if(_0x1a4821['name']){delete _0x1a4821[_0xc1e0('0x23')];}_0x2eb078[_0xc1e0('0x17')](_0x205032)['send'](_0x1a4821);};}exports['index']=function(_0x54a612,_0x4751ea){var _0x577c6c={},_0x2a8aa8={},_0x341d42={'count':0x0,'rows':[]};var _0x66b708=_['map'](db[_0xc1e0('0x24')]['rawAttributes'],function(_0x3867fb){return{'name':_0x3867fb['fieldName'],'type':_0x3867fb[_0xc1e0('0x25')][_0xc1e0('0x26')]};});_0x2a8aa8[_0xc1e0('0x27')]=_[_0xc1e0('0x28')](_0x66b708,'name');_0x2a8aa8[_0xc1e0('0x29')]=_[_0xc1e0('0x2a')](_0x54a612[_0xc1e0('0x29')]);_0x2a8aa8[_0xc1e0('0x2b')]=_['intersection'](_0x2a8aa8['model'],_0x2a8aa8[_0xc1e0('0x29')]);_0x577c6c[_0xc1e0('0x2c')]=_['intersection'](_0x2a8aa8[_0xc1e0('0x27')],qs[_0xc1e0('0x2d')](_0x54a612[_0xc1e0('0x29')][_0xc1e0('0x2d')]));_0x577c6c[_0xc1e0('0x2c')]=_0x577c6c[_0xc1e0('0x2c')]['length']?_0x577c6c[_0xc1e0('0x2c')]:_0x2a8aa8['model'];if(!_0x54a612[_0xc1e0('0x29')][_0xc1e0('0x2e')](_0xc1e0('0x2f'))){_0x577c6c[_0xc1e0('0x30')]=qs['limit'](_0x54a612[_0xc1e0('0x29')][_0xc1e0('0x30')]);_0x577c6c[_0xc1e0('0x31')]=qs[_0xc1e0('0x31')](_0x54a612[_0xc1e0('0x29')][_0xc1e0('0x31')]);}_0x577c6c[_0xc1e0('0x32')]=qs[_0xc1e0('0x33')](_0x54a612[_0xc1e0('0x29')][_0xc1e0('0x33')]);_0x577c6c[_0xc1e0('0x34')]=qs['filters'](_[_0xc1e0('0x35')](_0x54a612[_0xc1e0('0x29')],_0x2a8aa8['filters']),_0x66b708);if(_0x54a612[_0xc1e0('0x29')][_0xc1e0('0x36')]){_0x577c6c['where']=_['merge'](_0x577c6c['where'],{'$or':_[_0xc1e0('0x28')](_0x66b708,function(_0x382895){if(_0x382895['type']!==_0xc1e0('0x37')){var _0x128579={};_0x128579[_0x382895[_0xc1e0('0x23')]]={'$like':'%'+_0x54a612['query']['filter']+'%'};return _0x128579;}})});}_0x577c6c=_[_0xc1e0('0x38')]({},_0x577c6c,_0x54a612[_0xc1e0('0x39')]);var _0x22bd84={'where':_0x577c6c['where']};return db[_0xc1e0('0x24')][_0xc1e0('0x1a')](_0x22bd84)[_0xc1e0('0x20')](function(_0x2354d8){_0x341d42[_0xc1e0('0x1a')]=_0x2354d8;if(_0x54a612[_0xc1e0('0x29')][_0xc1e0('0x3a')]){_0x577c6c[_0xc1e0('0x3b')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x577c6c);})[_0xc1e0('0x20')](function(_0x1960a4){_0x341d42[_0xc1e0('0x3c')]=_0x1960a4;return _0x341d42;})[_0xc1e0('0x20')](respondWithFilteredResult(_0x4751ea,_0x577c6c))[_0xc1e0('0x3d')](handleError(_0x4751ea,null));};exports[_0xc1e0('0x3e')]=function(_0x1e8c83,_0x3fd75b){var _0x2b11b4={'raw':!![],'where':{'id':_0x1e8c83[_0xc1e0('0x3f')]['id']}},_0x49c1af={};_0x49c1af[_0xc1e0('0x27')]=_['keys'](db[_0xc1e0('0x24')]['rawAttributes']);_0x49c1af[_0xc1e0('0x29')]=_['keys'](_0x1e8c83[_0xc1e0('0x29')]);_0x49c1af['filters']=_[_0xc1e0('0x40')](_0x49c1af[_0xc1e0('0x27')],_0x49c1af['query']);_0x2b11b4[_0xc1e0('0x2c')]=_[_0xc1e0('0x40')](_0x49c1af[_0xc1e0('0x27')],qs[_0xc1e0('0x2d')](_0x1e8c83[_0xc1e0('0x29')][_0xc1e0('0x2d')]));_0x2b11b4[_0xc1e0('0x2c')]=_0x2b11b4[_0xc1e0('0x2c')][_0xc1e0('0x41')]?_0x2b11b4[_0xc1e0('0x2c')]:_0x49c1af[_0xc1e0('0x27')];if(_0x1e8c83['query'][_0xc1e0('0x3a')]){_0x2b11b4[_0xc1e0('0x3b')]=[{'all':!![]}];}_0x2b11b4=_[_0xc1e0('0x38')]({},_0x2b11b4,_0x1e8c83[_0xc1e0('0x39')]);return db['VtigerField'][_0xc1e0('0x42')](_0x2b11b4)[_0xc1e0('0x20')](handleEntityNotFound(_0x3fd75b,null))['then'](respondWithResult(_0x3fd75b,null))['catch'](handleError(_0x3fd75b,null));};exports[_0xc1e0('0x43')]=function(_0x441b4f,_0x21cd7c){return db[_0xc1e0('0x24')][_0xc1e0('0x43')](_0x441b4f[_0xc1e0('0x44')],{})[_0xc1e0('0x20')](respondWithResult(_0x21cd7c,0xc9))[_0xc1e0('0x3d')](handleError(_0x21cd7c,null));};exports['update']=function(_0x99b5f5,_0x5de9c9){if(_0x99b5f5[_0xc1e0('0x44')]['id']){delete _0x99b5f5[_0xc1e0('0x44')]['id'];}return db['VtigerField'][_0xc1e0('0x42')]({'where':{'id':_0x99b5f5['params']['id']}})[_0xc1e0('0x20')](handleEntityNotFound(_0x5de9c9,null))['then'](saveUpdates(_0x99b5f5[_0xc1e0('0x44')],null))['then'](respondWithResult(_0x5de9c9,null))[_0xc1e0('0x3d')](handleError(_0x5de9c9,null));};exports[_0xc1e0('0x45')]=function(_0x3856e4,_0x220f51){return db[_0xc1e0('0x24')][_0xc1e0('0x42')]({'where':{'id':_0x3856e4[_0xc1e0('0x3f')]['id']}})[_0xc1e0('0x20')](handleEntityNotFound(_0x220f51,null))['then'](removeEntity(_0x220f51,null))['catch'](handleError(_0x220f51,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1247575..53e1c44 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 _0xf4eb=['int_vtiger_fields','FieldId','lodash','bluebird','rimraf','../../config/environment','./intVtigerField.attributes','exports','define'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1c443b,_0x397389){_0x1c443b=_0x1c443b-0x0;var _0x53a9cc=_0xf4eb[_0x1c443b];return _0x53a9cc;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('VtigerField',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xbf4e('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x26a818,_0x40708a){var _0x5d8ca0=function(_0x3cc7ed){while(--_0x3cc7ed){_0x26a818['push'](_0x26a818['shift']());}};_0x5d8ca0(++_0x40708a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3601f0,_0x34dda6){_0x3601f0=_0x3601f0-0x0;var _0x25e9db=_0x9bde[_0x3601f0];return _0x25e9db;};'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('0xd'),_0xe9bd('0xe')],'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 df59ea5..8e7da85 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 _0xbdfb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0xbdfb[_0x2605dc];return _0x4568c9;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var moment=require(_0xbbdf('0x2'));var BPromise=require(_0xbbdf('0x3'));var rs=require(_0xbbdf('0x4'));var fs=require('fs');var Redis=require(_0xbbdf('0x5'));var db=require(_0xbbdf('0x6'))['db'];var utils=require(_0xbbdf('0x7'));var logger=require(_0xbbdf('0x8'))(_0xbbdf('0x9'));var config=require('../../config/environment');var jayson=require(_0xbbdf('0xa'));var client=jayson[_0xbbdf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c930d,_0x17c835,_0x58a929){return new BPromise(function(_0x2f9954,_0x2ae0d8){return client[_0xbbdf('0xc')](_0x3c930d,_0x58a929)[_0xbbdf('0xd')](function(_0x4c1436){logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');logger[_0xbbdf('0x10')](_0xbbdf('0x11'),_0x17c835,_0xbbdf('0x12'),JSON[_0xbbdf('0x13')](_0x4c1436));if(_0x4c1436['error']){if(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x15')]===0x1f4){logger[_0xbbdf('0x14')]('VtigerField,\x20%s,\x20%s',_0x17c835,_0x4c1436['error']['message']);return _0x2ae0d8(_0x4c1436['error'][_0xbbdf('0x16')]);}logger[_0xbbdf('0x14')](_0xbbdf('0xf'),_0x17c835,_0x4c1436['error'][_0xbbdf('0x16')]);return _0x2f9954(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x16')]);}else{logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');_0x2f9954(_0x4c1436[_0xbbdf('0x17')][_0xbbdf('0x16')]);}})[_0xbbdf('0x18')](function(_0x547b94){logger['error'](_0xbbdf('0xf'),_0x17c835,_0x547b94);_0x2ae0d8(_0x547b94);});});} \ No newline at end of file +var _0x8ba6=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8ba6,0x11b));var _0x68ba=function(_0xc38b80,_0x1e8df9){_0xc38b80=_0xc38b80-0x0;var _0x30388d=_0x8ba6[_0xc38b80];return _0x30388d;};'use strict';var _=require(_0x68ba('0x0'));var util=require('util');var moment=require(_0x68ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x68ba('0x2'));var fs=require('fs');var Redis=require(_0x68ba('0x3'));var db=require(_0x68ba('0x4'))['db'];var utils=require(_0x68ba('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x68ba('0x6'));var jayson=require(_0x68ba('0x7'));var client=jayson[_0x68ba('0x8')][_0x68ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ad848,_0x1ba7fa,_0x97b7a){return new BPromise(function(_0xc67bf0,_0x5aa5bd){return client[_0x68ba('0xa')](_0x2ad848,_0x97b7a)[_0x68ba('0xb')](function(_0x1ec922){logger[_0x68ba('0xc')](_0x68ba('0xd'),_0x1ba7fa,_0x68ba('0xe'));logger[_0x68ba('0xf')](_0x68ba('0x10'),_0x1ba7fa,_0x68ba('0xe'),JSON[_0x68ba('0x11')](_0x1ec922));if(_0x1ec922['error']){if(_0x1ec922[_0x68ba('0x12')][_0x68ba('0x13')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x1ba7fa,_0x1ec922[_0x68ba('0x12')]['message']);return _0x5aa5bd(_0x1ec922[_0x68ba('0x12')][_0x68ba('0x14')]);}logger[_0x68ba('0x12')](_0x68ba('0xd'),_0x1ba7fa,_0x1ec922[_0x68ba('0x12')][_0x68ba('0x14')]);return _0xc67bf0(_0x1ec922[_0x68ba('0x12')]['message']);}else{logger[_0x68ba('0xc')](_0x68ba('0xd'),_0x1ba7fa,_0x68ba('0xe'));_0xc67bf0(_0x1ec922[_0x68ba('0x15')][_0x68ba('0x14')]);}})['catch'](function(_0x2babf4){logger[_0x68ba('0x12')]('VtigerField,\x20%s,\x20%s',_0x1ba7fa,_0x2babf4);_0x5aa5bd(_0x2babf4);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index b66bdac..3c3bc6a 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 _0xcf84=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf84,0x1ac));var _0x4cf8=function(_0x13551e,_0x3a8c79){_0x13551e=_0x13551e-0x0;var _0x55d46f=_0xcf84[_0x13551e];return _0x55d46f;};'use strict';var multer=require(_0x4cf8('0x0'));var util=require(_0x4cf8('0x1'));var path=require('path');var timeout=require(_0x4cf8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4cf8('0x3'));var interaction=require(_0x4cf8('0x4'));var config=require(_0x4cf8('0x5'));var controller=require(_0x4cf8('0x6'));router[_0x4cf8('0x7')]('/',auth[_0x4cf8('0x8')](),controller[_0x4cf8('0x9')]);router[_0x4cf8('0x7')](_0x4cf8('0xa'),auth[_0x4cf8('0x8')](),controller['show']);router['get'](_0x4cf8('0xb'),auth['isAuthenticated'](),controller[_0x4cf8('0xc')]);router['get'](_0x4cf8('0xd'),auth[_0x4cf8('0x8')](),controller[_0x4cf8('0xe')]);router[_0x4cf8('0xf')]('/',auth['isAuthenticated'](),controller[_0x4cf8('0x10')]);router[_0x4cf8('0xf')](_0x4cf8('0xb'),auth[_0x4cf8('0x8')](),controller[_0x4cf8('0x11')]);router['put']('/:id',auth[_0x4cf8('0x8')](),controller[_0x4cf8('0x12')]);router[_0x4cf8('0x13')](_0x4cf8('0xa'),auth[_0x4cf8('0x8')](),controller[_0x4cf8('0x14')]);module[_0x4cf8('0x15')]=router; \ No newline at end of file +var _0x17a7=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','exports'];(function(_0x4d59a5,_0x188334){var _0x59bc80=function(_0x244c1e){while(--_0x244c1e){_0x4d59a5['push'](_0x4d59a5['shift']());}};_0x59bc80(++_0x188334);}(_0x17a7,0xfd));var _0x717a=function(_0x161bba,_0x148aaa){_0x161bba=_0x161bba-0x0;var _0x595113=_0x17a7[_0x161bba];return _0x595113;};'use strict';var multer=require(_0x717a('0x0'));var util=require(_0x717a('0x1'));var path=require(_0x717a('0x2'));var timeout=require('connect-timeout');var express=require(_0x717a('0x3'));var router=express[_0x717a('0x4')]();var auth=require(_0x717a('0x5'));var interaction=require(_0x717a('0x6'));var config=require(_0x717a('0x7'));var controller=require(_0x717a('0x8'));router[_0x717a('0x9')]('/',auth[_0x717a('0xa')](),controller[_0x717a('0xb')]);router[_0x717a('0x9')](_0x717a('0xc'),auth[_0x717a('0xa')](),controller[_0x717a('0xd')]);router['get'](_0x717a('0xe'),auth[_0x717a('0xa')](),controller[_0x717a('0xf')]);router[_0x717a('0x9')](_0x717a('0x10'),auth[_0x717a('0xa')](),controller[_0x717a('0x11')]);router[_0x717a('0x12')]('/',auth[_0x717a('0xa')](),controller['create']);router[_0x717a('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x717a('0x13')]);router[_0x717a('0x14')]('/:id',auth[_0x717a('0xa')](),controller[_0x717a('0x15')]);router['delete'](_0x717a('0xc'),auth[_0x717a('0xa')](),controller['destroy']);module[_0x717a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index fcfc3af..db746c7 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 _0xa607=['exports','STRING','ENUM','password','token','integrationTab'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xa607,0x192));var _0x7a60=function(_0xa2c2e2,_0x535d90){_0xa2c2e2=_0xa2c2e2-0x0;var _0x3d7867=_0xa607[_0xa2c2e2];return _0x3d7867;};'use strict';var Sequelize=require('sequelize');module[_0x7a60('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7a60('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x7a60('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7a60('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x7a60('0x2')](_0x7a60('0x3'),_0x7a60('0x4')),'defaultValue':_0x7a60('0x3')},'serverUrl':{'type':Sequelize[_0x7a60('0x1')]},'type':{'type':Sequelize[_0x7a60('0x2')](_0x7a60('0x5'),'newTab'),'defaultValue':_0x7a60('0x5')}}; \ No newline at end of file +var _0x46ee=['STRING','remoteUri','password','token','ENUM','integrationTab','newTab','exports'];(function(_0x5dfe4e,_0x2188ec){var _0x20b1fb=function(_0x256950){while(--_0x256950){_0x5dfe4e['push'](_0x5dfe4e['shift']());}};_0x20b1fb(++_0x2188ec);}(_0x46ee,0xb7));var _0xe46e=function(_0xb93ef9,_0x3547ca){_0xb93ef9=_0xb93ef9-0x0;var _0x5c7094=_0x46ee[_0xb93ef9];return _0x5c7094;};'use strict';var Sequelize=require('sequelize');module[_0xe46e('0x0')]={'name':{'type':Sequelize[_0xe46e('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe46e('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe46e('0x1')]},'remoteUri':{'type':Sequelize[_0xe46e('0x1')],'unique':_0xe46e('0x2')},'authType':{'type':Sequelize['ENUM'](_0xe46e('0x3'),_0xe46e('0x4')),'defaultValue':_0xe46e('0x3')},'serverUrl':{'type':Sequelize[_0xe46e('0x1')]},'type':{'type':Sequelize[_0xe46e('0x5')](_0xe46e('0x6'),_0xe46e('0x7')),'defaultValue':_0xe46e('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3f09d10..5c124fc 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 _0xde59=['Descriptions','getDescriptions','ZendeskField','getFields','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','include','findAll','show','params','length','includeAll','catch','create','body','find','getConfigurations','findOne','ZendeskConfiguration','pick','options','nolimit','addConfiguration','AccountId','getSubjects'];(function(_0x42c2cf,_0x25c576){var _0x4275d3=function(_0x4f2fd1){while(--_0x4f2fd1){_0x42c2cf['push'](_0x42c2cf['shift']());}};_0x4275d3(++_0x25c576);}(_0xde59,0x18b));var _0x9de5=function(_0x1773e2,_0x9d6577){_0x1773e2=_0x1773e2-0x0;var _0x10944d=_0xde59[_0x1773e2];return _0x10944d;};'use strict';var pdf=require(_0x9de5('0x0'));var emlformat=require(_0x9de5('0x1'));var rimraf=require(_0x9de5('0x2'));var zipdir=require(_0x9de5('0x3'));var jsonpatch=require(_0x9de5('0x4'));var rp=require(_0x9de5('0x5'));var moment=require(_0x9de5('0x6'));var BPromise=require(_0x9de5('0x7'));var Mustache=require(_0x9de5('0x8'));var util=require(_0x9de5('0x9'));var path=require(_0x9de5('0xa'));var sox=require('sox');var csv=require(_0x9de5('0xb'));var ejs=require(_0x9de5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9de5('0xd'));var crypto=require('crypto');var jsforce=require(_0x9de5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9de5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9de5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9de5('0x10'));var as=require(_0x9de5('0x11'));var hardwareService=require(_0x9de5('0x12'));var logger=require(_0x9de5('0x13'))(_0x9de5('0x14'));var utils=require(_0x9de5('0x15'));var config=require(_0x9de5('0x16'));var db=require(_0x9de5('0x17'))['db'];var integrations=require(_0x9de5('0x18'));var jayson=require(_0x9de5('0x19'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x131c0b,_0x330535,_0x3f8767){if(_0x3f8767){var _0x6ca357=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6ca357[_0x9de5('0x1a')](_0x330535)){return _0x131c0b;}else{throw new db['Sequelize']['ValidationError'](_0x9de5('0x1b'));}}else{return _0x131c0b;}}function respondWithRpcPromise(_0x4fffc3,_0x51b22c,_0x2aab8b,_0x179746){return new BPromise(function(_0x241e5a,_0x279056){var _0x2de941=_0x179746||client;return _0x2de941[_0x9de5('0x1c')](_0x4fffc3,_0x2aab8b)['then'](function(_0x374536){logger[_0x9de5('0x1d')](_0x9de5('0x1e'),_0x51b22c,'request\x20sent');logger['debug'](_0x9de5('0x1f'),_0x51b22c,_0x9de5('0x20'),JSON[_0x9de5('0x21')](_0x374536));if(_0x374536[_0x9de5('0x22')]){if(_0x374536['error'][_0x9de5('0x23')]===0x1f4){logger[_0x9de5('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x51b22c,_0x374536['error'][_0x9de5('0x24')]);return _0x279056(_0x374536[_0x9de5('0x22')][_0x9de5('0x24')]);}logger[_0x9de5('0x22')](_0x9de5('0x1e'),_0x51b22c,_0x374536[_0x9de5('0x22')]['message']);return _0x241e5a(_0x374536[_0x9de5('0x22')]['message']);}else{logger[_0x9de5('0x1d')]('ZendeskAccount,\x20%s,\x20%s',_0x51b22c,_0x9de5('0x20'));_0x241e5a(_0x374536['result'][_0x9de5('0x24')]);}})['catch'](function(_0x56980a){logger['error'](_0x9de5('0x1e'),_0x51b22c,_0x56980a);_0x279056(_0x56980a);});});}function respondWithStatusCode(_0x1e28f5,_0x55e050){_0x55e050=_0x55e050||0xcc;return function(_0x1c8a19){if(_0x1c8a19){return _0x1e28f5[_0x9de5('0x25')](_0x55e050);}return _0x1e28f5[_0x9de5('0x26')](_0x55e050)[_0x9de5('0x27')]();};}function respondWithResult(_0x578287,_0x490b88){_0x490b88=_0x490b88||0xc8;return function(_0x1acd2b){if(_0x1acd2b){return _0x578287[_0x9de5('0x26')](_0x490b88)[_0x9de5('0x28')](_0x1acd2b);}};}function respondWithFilteredResult(_0x101085,_0x4f03d6){return function(_0x15b51c){if(_0x15b51c){var _0x35990e=_0x15b51c[_0x9de5('0x29')],_0x2db9cf=_0x4f03d6[_0x9de5('0x2a')],_0x2a1122=_0x4f03d6[_0x9de5('0x2a')]+_0x4f03d6[_0x9de5('0x2b')],_0x2b473d;if(_0x2a1122>=_0x35990e){_0x2a1122=_0x35990e;_0x2b473d=0xc8;}else{_0x2b473d=0xce;}_0x101085[_0x9de5('0x26')](_0x2b473d);return _0x101085['set'](_0x9de5('0x2c'),_0x2db9cf+'-'+_0x2a1122+'/'+_0x35990e)[_0x9de5('0x28')](_0x15b51c);}return null;};}function patchUpdates(_0x1c9805){return function(_0x23d0d3){try{jsonpatch[_0x9de5('0x2d')](_0x23d0d3,_0x1c9805,!![]);}catch(_0xbb4c9){return BPromise[_0x9de5('0x2e')](_0xbb4c9);}return _0x23d0d3[_0x9de5('0x2f')]();};}function saveUpdates(_0x480da4,_0x26f718){return function(_0x1d5f98){if(_0x1d5f98){return _0x1d5f98['update'](_0x480da4)[_0x9de5('0x30')](function(_0x1c7085){return _0x1c7085;});}return null;};}function removeEntity(_0x1fd396,_0x1f9789){return function(_0xb26382){if(_0xb26382){return _0xb26382[_0x9de5('0x31')]()[_0x9de5('0x30')](function(){_0x1fd396['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c7ef8,_0x288249){return function(_0x8078e8){if(!_0x8078e8){_0x3c7ef8[_0x9de5('0x25')](0x194);}return _0x8078e8;};}function handleError(_0x3cca56,_0x3be99c){_0x3be99c=_0x3be99c||0x1f4;return function(_0x572f09){logger[_0x9de5('0x22')](_0x572f09['stack']);if(_0x572f09[_0x9de5('0x32')]){delete _0x572f09[_0x9de5('0x32')];}_0x3cca56[_0x9de5('0x26')](_0x3be99c)[_0x9de5('0x33')](_0x572f09);};}exports[_0x9de5('0x34')]=function(_0x423e0a,_0x87f313){var _0x2a8dc7={},_0x3d11bc={},_0x36ab8d={'count':0x0,'rows':[]};var _0x1aa720=_[_0x9de5('0x35')](db[_0x9de5('0x36')][_0x9de5('0x37')],function(_0xb39a3f){return{'name':_0xb39a3f[_0x9de5('0x38')],'type':_0xb39a3f[_0x9de5('0x39')]['key']};});_0x3d11bc[_0x9de5('0x3a')]=_[_0x9de5('0x35')](_0x1aa720,_0x9de5('0x32'));_0x3d11bc[_0x9de5('0x3b')]=_['keys'](_0x423e0a[_0x9de5('0x3b')]);_0x3d11bc[_0x9de5('0x3c')]=_[_0x9de5('0x3d')](_0x3d11bc[_0x9de5('0x3a')],_0x3d11bc[_0x9de5('0x3b')]);_0x2a8dc7[_0x9de5('0x3e')]=_['intersection'](_0x3d11bc[_0x9de5('0x3a')],qs[_0x9de5('0x3f')](_0x423e0a[_0x9de5('0x3b')][_0x9de5('0x3f')]));_0x2a8dc7[_0x9de5('0x3e')]=_0x2a8dc7[_0x9de5('0x3e')]['length']?_0x2a8dc7[_0x9de5('0x3e')]:_0x3d11bc[_0x9de5('0x3a')];if(!_0x423e0a[_0x9de5('0x3b')][_0x9de5('0x40')]('nolimit')){_0x2a8dc7[_0x9de5('0x2b')]=qs[_0x9de5('0x2b')](_0x423e0a[_0x9de5('0x3b')][_0x9de5('0x2b')]);_0x2a8dc7[_0x9de5('0x2a')]=qs[_0x9de5('0x2a')](_0x423e0a[_0x9de5('0x3b')][_0x9de5('0x2a')]);}_0x2a8dc7[_0x9de5('0x41')]=qs[_0x9de5('0x42')](_0x423e0a['query'][_0x9de5('0x42')]);_0x2a8dc7[_0x9de5('0x43')]=qs[_0x9de5('0x3c')](_['pick'](_0x423e0a['query'],_0x3d11bc[_0x9de5('0x3c')]),_0x1aa720);if(_0x423e0a[_0x9de5('0x3b')]['filter']){_0x2a8dc7[_0x9de5('0x43')]=_['merge'](_0x2a8dc7['where'],{'$or':_[_0x9de5('0x35')](_0x1aa720,function(_0x173c95){if(_0x173c95[_0x9de5('0x39')]!=='VIRTUAL'){var _0x4df9ad={};_0x4df9ad[_0x173c95[_0x9de5('0x32')]]={'$like':'%'+_0x423e0a[_0x9de5('0x3b')][_0x9de5('0x44')]+'%'};return _0x4df9ad;}})});}_0x2a8dc7=_[_0x9de5('0x45')]({},_0x2a8dc7,_0x423e0a['options']);var _0x33832d={'where':_0x2a8dc7[_0x9de5('0x43')]};return db['ZendeskAccount']['count'](_0x33832d)['then'](function(_0x4911a5){_0x36ab8d[_0x9de5('0x29')]=_0x4911a5;if(_0x423e0a[_0x9de5('0x3b')]['includeAll']){_0x2a8dc7[_0x9de5('0x46')]=[{'all':!![]}];}return db[_0x9de5('0x36')][_0x9de5('0x47')](_0x2a8dc7);})[_0x9de5('0x30')](function(_0x3126c0){_0x36ab8d['rows']=_0x3126c0;return _0x36ab8d;})['then'](respondWithFilteredResult(_0x87f313,_0x2a8dc7))['catch'](handleError(_0x87f313,null));};exports[_0x9de5('0x48')]=function(_0x10a7b0,_0x2de494){var _0x3f9253={'raw':![],'where':{'id':_0x10a7b0[_0x9de5('0x49')]['id']}},_0x46c1bb={};_0x46c1bb['model']=_['keys'](db['ZendeskAccount'][_0x9de5('0x37')]);_0x46c1bb['query']=_['keys'](_0x10a7b0['query']);_0x46c1bb[_0x9de5('0x3c')]=_[_0x9de5('0x3d')](_0x46c1bb[_0x9de5('0x3a')],_0x46c1bb[_0x9de5('0x3b')]);_0x3f9253[_0x9de5('0x3e')]=_['intersection'](_0x46c1bb['model'],qs[_0x9de5('0x3f')](_0x10a7b0[_0x9de5('0x3b')][_0x9de5('0x3f')]));_0x3f9253[_0x9de5('0x3e')]=_0x3f9253[_0x9de5('0x3e')][_0x9de5('0x4a')]?_0x3f9253[_0x9de5('0x3e')]:_0x46c1bb[_0x9de5('0x3a')];if(_0x10a7b0[_0x9de5('0x3b')][_0x9de5('0x4b')]){_0x3f9253[_0x9de5('0x46')]=[{'all':!![]}];}_0x3f9253=_[_0x9de5('0x45')]({},_0x3f9253,_0x10a7b0['options']);return db[_0x9de5('0x36')]['find'](_0x3f9253)['then'](handleEntityNotFound(_0x2de494,null))[_0x9de5('0x30')](respondWithResult(_0x2de494,null))[_0x9de5('0x4c')](handleError(_0x2de494,null));};exports[_0x9de5('0x4d')]=function(_0x373373,_0x597313){return db[_0x9de5('0x36')][_0x9de5('0x4d')](_0x373373[_0x9de5('0x4e')],{})[_0x9de5('0x30')](respondWithResult(_0x597313,0xc9))[_0x9de5('0x4c')](handleError(_0x597313,null));};exports['update']=function(_0x349b10,_0x203645){if(_0x349b10['body']['id']){delete _0x349b10[_0x9de5('0x4e')]['id'];}return db[_0x9de5('0x36')]['find']({'where':{'id':_0x349b10[_0x9de5('0x49')]['id']}})['then'](handleEntityNotFound(_0x203645,null))['then'](saveUpdates(_0x349b10['body'],null))[_0x9de5('0x30')](respondWithResult(_0x203645,null))['catch'](handleError(_0x203645,null));};exports[_0x9de5('0x31')]=function(_0x54dc60,_0x1bcdca){return db[_0x9de5('0x36')][_0x9de5('0x4f')]({'where':{'id':_0x54dc60[_0x9de5('0x49')]['id']}})['then'](handleEntityNotFound(_0x1bcdca,null))[_0x9de5('0x30')](removeEntity(_0x1bcdca,null))[_0x9de5('0x4c')](handleError(_0x1bcdca,null));};exports[_0x9de5('0x50')]=function(_0x5bc0b3,_0x155422,_0x286912){var _0xe92f0a={};var _0x4aa7b6={};var _0x1b88cb;var _0x3fa510;return db[_0x9de5('0x36')][_0x9de5('0x51')]({'where':{'id':_0x5bc0b3[_0x9de5('0x49')]['id']}})[_0x9de5('0x30')](handleEntityNotFound(_0x155422,null))[_0x9de5('0x30')](function(_0x400ddd){if(_0x400ddd){_0x1b88cb=_0x400ddd;_0x4aa7b6[_0x9de5('0x3a')]=_['keys'](db[_0x9de5('0x52')][_0x9de5('0x37')]);_0x4aa7b6[_0x9de5('0x3b')]=_['keys'](_0x5bc0b3[_0x9de5('0x3b')]);_0x4aa7b6[_0x9de5('0x3c')]=_[_0x9de5('0x3d')](_0x4aa7b6[_0x9de5('0x3a')],_0x4aa7b6['query']);_0xe92f0a[_0x9de5('0x3e')]=_[_0x9de5('0x3d')](_0x4aa7b6['model'],qs[_0x9de5('0x3f')](_0x5bc0b3['query'][_0x9de5('0x3f')]));_0xe92f0a['attributes']=_0xe92f0a[_0x9de5('0x3e')][_0x9de5('0x4a')]?_0xe92f0a[_0x9de5('0x3e')]:_0x4aa7b6[_0x9de5('0x3a')];_0xe92f0a['order']=qs[_0x9de5('0x42')](_0x5bc0b3[_0x9de5('0x3b')]['sort']);_0xe92f0a[_0x9de5('0x43')]=qs['filters'](_[_0x9de5('0x53')](_0x5bc0b3[_0x9de5('0x3b')],_0x4aa7b6[_0x9de5('0x3c')]));if(_0x5bc0b3[_0x9de5('0x3b')]['filter']){_0xe92f0a['where']=_[_0x9de5('0x45')](_0xe92f0a[_0x9de5('0x43')],{'$or':_[_0x9de5('0x35')](_0xe92f0a[_0x9de5('0x3e')],function(_0x12a4ab){var _0x2379fc={};_0x2379fc[_0x12a4ab]={'$like':'%'+_0x5bc0b3[_0x9de5('0x3b')][_0x9de5('0x44')]+'%'};return _0x2379fc;})});}_0xe92f0a=_[_0x9de5('0x45')]({},_0xe92f0a,_0x5bc0b3[_0x9de5('0x54')]);return _0x1b88cb[_0x9de5('0x50')](_0xe92f0a);}})[_0x9de5('0x30')](function(_0x142e3a){if(_0x142e3a){_0x3fa510=_0x142e3a[_0x9de5('0x4a')];if(!_0x5bc0b3['query']['hasOwnProperty'](_0x9de5('0x55'))){_0xe92f0a[_0x9de5('0x2b')]=qs['limit'](_0x5bc0b3[_0x9de5('0x3b')]['limit']);_0xe92f0a[_0x9de5('0x2a')]=qs[_0x9de5('0x2a')](_0x5bc0b3[_0x9de5('0x3b')][_0x9de5('0x2a')]);}return _0x1b88cb['getConfigurations'](_0xe92f0a);}})[_0x9de5('0x30')](function(_0x193fad){if(_0x193fad){return _0x193fad?{'count':_0x3fa510,'rows':_0x193fad}:null;}})['then'](respondWithResult(_0x155422,null))[_0x9de5('0x4c')](handleError(_0x155422,null));};exports[_0x9de5('0x56')]=function(_0x11c48a,_0x2c4bde,_0x378c7e){if(_0x11c48a[_0x9de5('0x4e')]['id']){delete _0x11c48a[_0x9de5('0x4e')]['id'];}return db[_0x9de5('0x36')][_0x9de5('0x51')]({'where':{'id':_0x11c48a[_0x9de5('0x49')]['id']}})[_0x9de5('0x30')](handleEntityNotFound(_0x2c4bde,null))[_0x9de5('0x30')](function(_0x1dd894){if(_0x1dd894){_0x11c48a['body'][_0x9de5('0x57')]=_0x1dd894['id'];_0x11c48a[_0x9de5('0x4e')]['Subjects']=integrations[_0x9de5('0x58')](_0x11c48a['body']['channel'],_0x11c48a['body']['type']);_0x11c48a[_0x9de5('0x4e')][_0x9de5('0x59')]=integrations[_0x9de5('0x5a')](_0x11c48a[_0x9de5('0x4e')]['channel'],_0x11c48a['body'][_0x9de5('0x39')]);return db[_0x9de5('0x52')][_0x9de5('0x4d')](_0x11c48a[_0x9de5('0x4e')],{'include':[{'model':db[_0x9de5('0x5b')],'as':'Subjects'},{'model':db[_0x9de5('0x5b')],'as':_0x9de5('0x59')}]});}return null;})[_0x9de5('0x30')](respondWithResult(_0x2c4bde,null))[_0x9de5('0x4c')](handleError(_0x2c4bde,null));};exports[_0x9de5('0x5c')]=function(_0x3eb07d,_0x8abe64,_0x47c7a0){var _0x4a1c8f='';return db[_0x9de5('0x36')]['findOne']({'where':{'id':_0x3eb07d[_0x9de5('0x49')]['id']},'attributes':['id',_0x9de5('0x5d'),_0x9de5('0x5e'),'token','authType',_0x9de5('0x5f')]})[_0x9de5('0x30')](handleEntityNotFound(_0x8abe64,null))[_0x9de5('0x30')](function(_0x380a04){if(_0x380a04){_0x4a1c8f=_0x380a04[_0x9de5('0x5f')];var _0x295b8b=_0x4a1c8f[_0x9de5('0x60')](-0x1);if(_0x295b8b==='/'){_0x4a1c8f=_0x4a1c8f[_0x9de5('0x61')](0x0,_0x4a1c8f[_0x9de5('0x62')](_0x295b8b));}var _0x1179cf={'method':'GET','uri':util[_0x9de5('0x63')](_0x9de5('0x64'),_0x4a1c8f,_0x9de5('0x65')),'json':!![]};switch(_0x380a04['authType']){case _0x9de5('0x5e'):_0x1179cf[_0x9de5('0x66')]={'Authorization':util['format'](_0x9de5('0x67'),new Buffer(util[_0x9de5('0x63')]('%s:%s',_0x380a04[_0x9de5('0x5d')],_0x380a04[_0x9de5('0x5e')]))[_0x9de5('0x68')](_0x9de5('0x69')))};break;case _0x9de5('0x6a'):_0x1179cf[_0x9de5('0x66')]={'Authorization':util[_0x9de5('0x63')](_0x9de5('0x67'),new Buffer(util[_0x9de5('0x63')](_0x9de5('0x6b'),_0x380a04['username'],_0x380a04[_0x9de5('0x6a')]))[_0x9de5('0x68')](_0x9de5('0x69')))};break;default:throw new db[(_0x9de5('0x6c'))][(_0x9de5('0x6d'))](_0x9de5('0x6e'));}return rp(_0x1179cf);}})[_0x9de5('0x30')](function(_0x45df74){if(_0x45df74){var _0x30e800=[_0x9de5('0x6f'),_0x9de5('0x70'),_0x9de5('0x71'),'assignee'];_['remove'](_0x45df74['ticket_fields'],function(_0x12d7fb){return _0x30e800['includes'](_0x12d7fb[_0x9de5('0x39')]);});return{'count':_0x45df74['ticket_fields'][_0x9de5('0x4a')],'rows':_['map'](_0x45df74['ticket_fields'],function(_0x1eac5e){return{'id':_0x1eac5e['id'],'name':_0x1eac5e[_0x9de5('0x72')]>0x7?_0x1eac5e[_0x9de5('0x73')]:_0x1eac5e['type'],'custom':_0x1eac5e[_0x9de5('0x72')]>0x7?!![]:![],'options':_0x1eac5e['system_field_options']?_0x1eac5e[_0x9de5('0x74')]:_0x1eac5e[_0x9de5('0x75')]?_0x1eac5e[_0x9de5('0x75')]:[]};})};}})[_0x9de5('0x30')](respondWithResult(_0x8abe64,null))[_0x9de5('0x4c')](function(_0x35cb66){var _0x112a8f=_0x3eb07d[_0x9de5('0x3b')][_0x9de5('0x1a')]?0x1f4:_0x35cb66[_0x9de5('0x76')]||0x1f4;logger[_0x9de5('0x22')](_0x9de5('0x77'),_0x9de5('0x5c'),_0x112a8f,JSON[_0x9de5('0x21')](_0x35cb66));delete _0x35cb66[_0x9de5('0x32')];if(_0x112a8f===0x191){_0x112a8f=0x190;}_0x8abe64[_0x9de5('0x26')](_0x112a8f)[_0x9de5('0x33')](_0x3eb07d[_0x9de5('0x3b')][_0x9de5('0x1a')]?{'message':_0x9de5('0x78'),'statusCode':_0x35cb66[_0x9de5('0x76')]}:_0x35cb66);});}; \ No newline at end of file +var _0xfbd7=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','rows','catch','params','ZendeskAccount','options','create','update','body','destroy','find','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','description','remove','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','bluebird','mustache','util','path','to-csv'];(function(_0x2d2891,_0x4b8dfc){var _0x235af2=function(_0x24884a){while(--_0x24884a){_0x2d2891['push'](_0x2d2891['shift']());}};_0x235af2(++_0x4b8dfc);}(_0xfbd7,0x1dd));var _0x7fbd=function(_0x30e86a,_0x43751b){_0x30e86a=_0x30e86a-0x0;var _0x100869=_0xfbd7[_0x30e86a];return _0x100869;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7fbd('0x0'));var rimraf=require(_0x7fbd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7fbd('0x2'));var Mustache=require(_0x7fbd('0x3'));var util=require(_0x7fbd('0x4'));var path=require(_0x7fbd('0x5'));var sox=require('sox');var csv=require(_0x7fbd('0x6'));var ejs=require(_0x7fbd('0x7'));var fs=require('fs');var _=require(_0x7fbd('0x8'));var squel=require(_0x7fbd('0x9'));var crypto=require(_0x7fbd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7fbd('0xb'));var toCsv=require(_0x7fbd('0x6'));var querystring=require(_0x7fbd('0xc'));var Papa=require(_0x7fbd('0xd'));var Redis=require(_0x7fbd('0xe'));var authService=require(_0x7fbd('0xf'));var qs=require(_0x7fbd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fbd('0x11'))(_0x7fbd('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7fbd('0x13'))['db'];var integrations=require(_0x7fbd('0x14'));var jayson=require(_0x7fbd('0x15'));var client=jayson['client'][_0x7fbd('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3f6299,_0x51e044,_0x228870){if(_0x228870){var _0x6d52f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6d52f[_0x7fbd('0x17')](_0x51e044)){return _0x3f6299;}else{throw new db['Sequelize'][(_0x7fbd('0x18'))](_0x7fbd('0x19'));}}else{return _0x3f6299;}}function respondWithRpcPromise(_0x626975,_0x404b27,_0x399722,_0x1ed4a9){return new BPromise(function(_0x240074,_0x227cd0){var _0x17b3c0=_0x1ed4a9||client;return _0x17b3c0[_0x7fbd('0x1a')](_0x626975,_0x399722)[_0x7fbd('0x1b')](function(_0x429fa9){logger[_0x7fbd('0x1c')](_0x7fbd('0x1d'),_0x404b27,_0x7fbd('0x1e'));logger['debug'](_0x7fbd('0x1f'),_0x404b27,'request\x20sent',JSON[_0x7fbd('0x20')](_0x429fa9));if(_0x429fa9['error']){if(_0x429fa9[_0x7fbd('0x21')][_0x7fbd('0x22')]===0x1f4){logger[_0x7fbd('0x21')](_0x7fbd('0x1d'),_0x404b27,_0x429fa9[_0x7fbd('0x21')][_0x7fbd('0x23')]);return _0x227cd0(_0x429fa9[_0x7fbd('0x21')]['message']);}logger[_0x7fbd('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x404b27,_0x429fa9[_0x7fbd('0x21')][_0x7fbd('0x23')]);return _0x240074(_0x429fa9[_0x7fbd('0x21')]['message']);}else{logger[_0x7fbd('0x1c')](_0x7fbd('0x1d'),_0x404b27,'request\x20sent');_0x240074(_0x429fa9['result'][_0x7fbd('0x23')]);}})['catch'](function(_0x1a4ffc){logger[_0x7fbd('0x21')](_0x7fbd('0x1d'),_0x404b27,_0x1a4ffc);_0x227cd0(_0x1a4ffc);});});}function respondWithStatusCode(_0x4fef16,_0x170cdb){_0x170cdb=_0x170cdb||0xcc;return function(_0x168d7b){if(_0x168d7b){return _0x4fef16[_0x7fbd('0x24')](_0x170cdb);}return _0x4fef16[_0x7fbd('0x25')](_0x170cdb)[_0x7fbd('0x26')]();};}function respondWithResult(_0x3562f0,_0x3f1323){_0x3f1323=_0x3f1323||0xc8;return function(_0x1ecfe6){if(_0x1ecfe6){return _0x3562f0[_0x7fbd('0x25')](_0x3f1323)['json'](_0x1ecfe6);}};}function respondWithFilteredResult(_0x3b7ce4,_0x527512){return function(_0x3ff2d6){if(_0x3ff2d6){var _0x152c50=_0x3ff2d6[_0x7fbd('0x27')],_0x116a97=_0x527512['offset'],_0x134e85=_0x527512[_0x7fbd('0x28')]+_0x527512[_0x7fbd('0x29')],_0x50ddeb;if(_0x134e85>=_0x152c50){_0x134e85=_0x152c50;_0x50ddeb=0xc8;}else{_0x50ddeb=0xce;}_0x3b7ce4[_0x7fbd('0x25')](_0x50ddeb);return _0x3b7ce4[_0x7fbd('0x2a')](_0x7fbd('0x2b'),_0x116a97+'-'+_0x134e85+'/'+_0x152c50)[_0x7fbd('0x2c')](_0x3ff2d6);}return null;};}function patchUpdates(_0x3b0392){return function(_0x24acf9){try{jsonpatch[_0x7fbd('0x2d')](_0x24acf9,_0x3b0392,!![]);}catch(_0x32934c){return BPromise[_0x7fbd('0x2e')](_0x32934c);}return _0x24acf9['save']();};}function saveUpdates(_0x34b17f,_0x52f754){return function(_0x5cd604){if(_0x5cd604){return _0x5cd604['update'](_0x34b17f)['then'](function(_0x567f57){return _0x567f57;});}return null;};}function removeEntity(_0xf223ba,_0x406a8f){return function(_0xeada54){if(_0xeada54){return _0xeada54['destroy']()['then'](function(){_0xf223ba[_0x7fbd('0x25')](0xcc)[_0x7fbd('0x26')]();});}};}function handleEntityNotFound(_0x4e335e,_0xe49566){return function(_0xf4b5a2){if(!_0xf4b5a2){_0x4e335e['sendStatus'](0x194);}return _0xf4b5a2;};}function handleError(_0x10708f,_0x5763f9){_0x5763f9=_0x5763f9||0x1f4;return function(_0x405d1f){logger[_0x7fbd('0x21')](_0x405d1f[_0x7fbd('0x2f')]);if(_0x405d1f[_0x7fbd('0x30')]){delete _0x405d1f['name'];}_0x10708f[_0x7fbd('0x25')](_0x5763f9)[_0x7fbd('0x31')](_0x405d1f);};}exports[_0x7fbd('0x32')]=function(_0x512d5b,_0x3fafb7){var _0x57077d={},_0x1ff088={},_0x1fc910={'count':0x0,'rows':[]};var _0x44ede3=_['map'](db['ZendeskAccount'][_0x7fbd('0x33')],function(_0x3b0e45){return{'name':_0x3b0e45[_0x7fbd('0x34')],'type':_0x3b0e45['type'][_0x7fbd('0x35')]};});_0x1ff088[_0x7fbd('0x36')]=_['map'](_0x44ede3,_0x7fbd('0x30'));_0x1ff088[_0x7fbd('0x37')]=_[_0x7fbd('0x38')](_0x512d5b[_0x7fbd('0x37')]);_0x1ff088[_0x7fbd('0x39')]=_['intersection'](_0x1ff088['model'],_0x1ff088[_0x7fbd('0x37')]);_0x57077d[_0x7fbd('0x3a')]=_[_0x7fbd('0x3b')](_0x1ff088[_0x7fbd('0x36')],qs[_0x7fbd('0x3c')](_0x512d5b[_0x7fbd('0x37')]['fields']));_0x57077d[_0x7fbd('0x3a')]=_0x57077d[_0x7fbd('0x3a')][_0x7fbd('0x3d')]?_0x57077d[_0x7fbd('0x3a')]:_0x1ff088[_0x7fbd('0x36')];if(!_0x512d5b[_0x7fbd('0x37')]['hasOwnProperty'](_0x7fbd('0x3e'))){_0x57077d[_0x7fbd('0x29')]=qs[_0x7fbd('0x29')](_0x512d5b[_0x7fbd('0x37')]['limit']);_0x57077d[_0x7fbd('0x28')]=qs['offset'](_0x512d5b['query'][_0x7fbd('0x28')]);}_0x57077d['order']=qs[_0x7fbd('0x3f')](_0x512d5b[_0x7fbd('0x37')][_0x7fbd('0x3f')]);_0x57077d[_0x7fbd('0x40')]=qs[_0x7fbd('0x39')](_[_0x7fbd('0x41')](_0x512d5b[_0x7fbd('0x37')],_0x1ff088[_0x7fbd('0x39')]),_0x44ede3);if(_0x512d5b[_0x7fbd('0x37')][_0x7fbd('0x42')]){_0x57077d[_0x7fbd('0x40')]=_[_0x7fbd('0x43')](_0x57077d[_0x7fbd('0x40')],{'$or':_[_0x7fbd('0x44')](_0x44ede3,function(_0x48c1d5){if(_0x48c1d5[_0x7fbd('0x45')]!==_0x7fbd('0x46')){var _0xe5689f={};_0xe5689f[_0x48c1d5['name']]={'$like':'%'+_0x512d5b[_0x7fbd('0x37')][_0x7fbd('0x42')]+'%'};return _0xe5689f;}})});}_0x57077d=_[_0x7fbd('0x43')]({},_0x57077d,_0x512d5b['options']);var _0x2bc90b={'where':_0x57077d['where']};return db['ZendeskAccount'][_0x7fbd('0x27')](_0x2bc90b)[_0x7fbd('0x1b')](function(_0x5f185c){_0x1fc910[_0x7fbd('0x27')]=_0x5f185c;if(_0x512d5b[_0x7fbd('0x37')][_0x7fbd('0x47')]){_0x57077d[_0x7fbd('0x48')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x57077d);})[_0x7fbd('0x1b')](function(_0xdab847){_0x1fc910[_0x7fbd('0x49')]=_0xdab847;return _0x1fc910;})[_0x7fbd('0x1b')](respondWithFilteredResult(_0x3fafb7,_0x57077d))[_0x7fbd('0x4a')](handleError(_0x3fafb7,null));};exports['show']=function(_0x3dd1db,_0x421149){var _0x485006={'raw':![],'where':{'id':_0x3dd1db[_0x7fbd('0x4b')]['id']}},_0x40420f={};_0x40420f[_0x7fbd('0x36')]=_[_0x7fbd('0x38')](db[_0x7fbd('0x4c')][_0x7fbd('0x33')]);_0x40420f[_0x7fbd('0x37')]=_[_0x7fbd('0x38')](_0x3dd1db['query']);_0x40420f[_0x7fbd('0x39')]=_['intersection'](_0x40420f['model'],_0x40420f[_0x7fbd('0x37')]);_0x485006[_0x7fbd('0x3a')]=_[_0x7fbd('0x3b')](_0x40420f[_0x7fbd('0x36')],qs['fields'](_0x3dd1db[_0x7fbd('0x37')]['fields']));_0x485006[_0x7fbd('0x3a')]=_0x485006[_0x7fbd('0x3a')][_0x7fbd('0x3d')]?_0x485006[_0x7fbd('0x3a')]:_0x40420f[_0x7fbd('0x36')];if(_0x3dd1db[_0x7fbd('0x37')][_0x7fbd('0x47')]){_0x485006[_0x7fbd('0x48')]=[{'all':!![]}];}_0x485006=_[_0x7fbd('0x43')]({},_0x485006,_0x3dd1db[_0x7fbd('0x4d')]);return db[_0x7fbd('0x4c')]['find'](_0x485006)[_0x7fbd('0x1b')](handleEntityNotFound(_0x421149,null))[_0x7fbd('0x1b')](respondWithResult(_0x421149,null))[_0x7fbd('0x4a')](handleError(_0x421149,null));};exports[_0x7fbd('0x4e')]=function(_0xaab636,_0x4d1d96){return db[_0x7fbd('0x4c')][_0x7fbd('0x4e')](_0xaab636['body'],{})['then'](respondWithResult(_0x4d1d96,0xc9))['catch'](handleError(_0x4d1d96,null));};exports[_0x7fbd('0x4f')]=function(_0x26ff6b,_0xd1d62b){if(_0x26ff6b['body']['id']){delete _0x26ff6b[_0x7fbd('0x50')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x26ff6b['params']['id']}})[_0x7fbd('0x1b')](handleEntityNotFound(_0xd1d62b,null))[_0x7fbd('0x1b')](saveUpdates(_0x26ff6b['body'],null))[_0x7fbd('0x1b')](respondWithResult(_0xd1d62b,null))[_0x7fbd('0x4a')](handleError(_0xd1d62b,null));};exports[_0x7fbd('0x51')]=function(_0x5b39b7,_0x38fcad){return db[_0x7fbd('0x4c')][_0x7fbd('0x52')]({'where':{'id':_0x5b39b7[_0x7fbd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38fcad,null))['then'](removeEntity(_0x38fcad,null))[_0x7fbd('0x4a')](handleError(_0x38fcad,null));};exports[_0x7fbd('0x53')]=function(_0x3102d5,_0x485b07,_0x1b4963){var _0x471430={};var _0x494997={};var _0x122925;var _0x13ff40;return db['ZendeskAccount'][_0x7fbd('0x54')]({'where':{'id':_0x3102d5[_0x7fbd('0x4b')]['id']}})[_0x7fbd('0x1b')](handleEntityNotFound(_0x485b07,null))[_0x7fbd('0x1b')](function(_0x522fbe){if(_0x522fbe){_0x122925=_0x522fbe;_0x494997[_0x7fbd('0x36')]=_['keys'](db[_0x7fbd('0x55')][_0x7fbd('0x33')]);_0x494997[_0x7fbd('0x37')]=_[_0x7fbd('0x38')](_0x3102d5['query']);_0x494997['filters']=_[_0x7fbd('0x3b')](_0x494997[_0x7fbd('0x36')],_0x494997[_0x7fbd('0x37')]);_0x471430[_0x7fbd('0x3a')]=_[_0x7fbd('0x3b')](_0x494997['model'],qs[_0x7fbd('0x3c')](_0x3102d5['query']['fields']));_0x471430['attributes']=_0x471430[_0x7fbd('0x3a')][_0x7fbd('0x3d')]?_0x471430[_0x7fbd('0x3a')]:_0x494997[_0x7fbd('0x36')];_0x471430['order']=qs['sort'](_0x3102d5[_0x7fbd('0x37')][_0x7fbd('0x3f')]);_0x471430['where']=qs[_0x7fbd('0x39')](_[_0x7fbd('0x41')](_0x3102d5[_0x7fbd('0x37')],_0x494997[_0x7fbd('0x39')]));if(_0x3102d5[_0x7fbd('0x37')][_0x7fbd('0x42')]){_0x471430['where']=_[_0x7fbd('0x43')](_0x471430[_0x7fbd('0x40')],{'$or':_[_0x7fbd('0x44')](_0x471430['attributes'],function(_0x20e97f){var _0x28cc4e={};_0x28cc4e[_0x20e97f]={'$like':'%'+_0x3102d5[_0x7fbd('0x37')][_0x7fbd('0x42')]+'%'};return _0x28cc4e;})});}_0x471430=_[_0x7fbd('0x43')]({},_0x471430,_0x3102d5[_0x7fbd('0x4d')]);return _0x122925[_0x7fbd('0x53')](_0x471430);}})[_0x7fbd('0x1b')](function(_0x1f6e08){if(_0x1f6e08){_0x13ff40=_0x1f6e08['length'];if(!_0x3102d5['query'][_0x7fbd('0x56')](_0x7fbd('0x3e'))){_0x471430['limit']=qs[_0x7fbd('0x29')](_0x3102d5[_0x7fbd('0x37')][_0x7fbd('0x29')]);_0x471430[_0x7fbd('0x28')]=qs['offset'](_0x3102d5[_0x7fbd('0x37')][_0x7fbd('0x28')]);}return _0x122925[_0x7fbd('0x53')](_0x471430);}})[_0x7fbd('0x1b')](function(_0x2451a2){if(_0x2451a2){return _0x2451a2?{'count':_0x13ff40,'rows':_0x2451a2}:null;}})[_0x7fbd('0x1b')](respondWithResult(_0x485b07,null))[_0x7fbd('0x4a')](handleError(_0x485b07,null));};exports[_0x7fbd('0x57')]=function(_0x1044ee,_0x4ed09b,_0x37fb02){if(_0x1044ee[_0x7fbd('0x50')]['id']){delete _0x1044ee[_0x7fbd('0x50')]['id'];}return db[_0x7fbd('0x4c')][_0x7fbd('0x54')]({'where':{'id':_0x1044ee[_0x7fbd('0x4b')]['id']}})[_0x7fbd('0x1b')](handleEntityNotFound(_0x4ed09b,null))[_0x7fbd('0x1b')](function(_0x3a5013){if(_0x3a5013){_0x1044ee[_0x7fbd('0x50')]['AccountId']=_0x3a5013['id'];_0x1044ee[_0x7fbd('0x50')][_0x7fbd('0x58')]=integrations[_0x7fbd('0x59')](_0x1044ee['body'][_0x7fbd('0x5a')],_0x1044ee[_0x7fbd('0x50')][_0x7fbd('0x45')]);_0x1044ee['body'][_0x7fbd('0x5b')]=integrations[_0x7fbd('0x5c')](_0x1044ee[_0x7fbd('0x50')]['channel'],_0x1044ee['body'][_0x7fbd('0x45')]);return db[_0x7fbd('0x55')][_0x7fbd('0x4e')](_0x1044ee['body'],{'include':[{'model':db[_0x7fbd('0x5d')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x7fbd('0x1b')](respondWithResult(_0x4ed09b,null))[_0x7fbd('0x4a')](handleError(_0x4ed09b,null));};exports[_0x7fbd('0x5e')]=function(_0x3474bb,_0x5b9e86,_0x2d8d22){var _0x227bf5='';return db[_0x7fbd('0x4c')][_0x7fbd('0x54')]({'where':{'id':_0x3474bb[_0x7fbd('0x4b')]['id']},'attributes':['id',_0x7fbd('0x5f'),_0x7fbd('0x60'),_0x7fbd('0x61'),_0x7fbd('0x62'),_0x7fbd('0x63')]})[_0x7fbd('0x1b')](handleEntityNotFound(_0x5b9e86,null))['then'](function(_0x3b3403){if(_0x3b3403){_0x227bf5=_0x3b3403[_0x7fbd('0x63')];var _0x139b1e=_0x227bf5[_0x7fbd('0x64')](-0x1);if(_0x139b1e==='/'){_0x227bf5=_0x227bf5['substring'](0x0,_0x227bf5[_0x7fbd('0x65')](_0x139b1e));}var _0x2b0281={'method':'GET','uri':util[_0x7fbd('0x66')](_0x7fbd('0x67'),_0x227bf5,_0x7fbd('0x68')),'json':!![]};switch(_0x3b3403[_0x7fbd('0x62')]){case _0x7fbd('0x60'):_0x2b0281[_0x7fbd('0x69')]={'Authorization':util[_0x7fbd('0x66')](_0x7fbd('0x6a'),new Buffer(util[_0x7fbd('0x66')]('%s:%s',_0x3b3403['username'],_0x3b3403[_0x7fbd('0x60')]))[_0x7fbd('0x6b')](_0x7fbd('0x6c')))};break;case _0x7fbd('0x61'):_0x2b0281[_0x7fbd('0x69')]={'Authorization':util[_0x7fbd('0x66')](_0x7fbd('0x6a'),new Buffer(util[_0x7fbd('0x66')](_0x7fbd('0x6d'),_0x3b3403['username'],_0x3b3403[_0x7fbd('0x61')]))[_0x7fbd('0x6b')](_0x7fbd('0x6c')))};break;default:throw new db[(_0x7fbd('0x6e'))][(_0x7fbd('0x18'))](_0x7fbd('0x6f'));}return rp(_0x2b0281);}})['then'](function(_0x4591d8){if(_0x4591d8){var _0x880517=[_0x7fbd('0x70'),_0x7fbd('0x71'),'group','assignee'];_[_0x7fbd('0x72')](_0x4591d8[_0x7fbd('0x68')],function(_0x5946d5){return _0x880517['includes'](_0x5946d5[_0x7fbd('0x45')]);});return{'count':_0x4591d8[_0x7fbd('0x68')][_0x7fbd('0x3d')],'rows':_['map'](_0x4591d8[_0x7fbd('0x68')],function(_0x23bdc2){return{'id':_0x23bdc2['id'],'name':_0x23bdc2['position']>0x7?_0x23bdc2['title']:_0x23bdc2[_0x7fbd('0x45')],'custom':_0x23bdc2[_0x7fbd('0x73')]>0x7?!![]:![],'options':_0x23bdc2[_0x7fbd('0x74')]?_0x23bdc2[_0x7fbd('0x74')]:_0x23bdc2[_0x7fbd('0x75')]?_0x23bdc2[_0x7fbd('0x75')]:[]};})};}})[_0x7fbd('0x1b')](respondWithResult(_0x5b9e86,null))[_0x7fbd('0x4a')](function(_0x2abd50){var _0x8d098b=_0x3474bb[_0x7fbd('0x37')]['test']?0x1f4:_0x2abd50[_0x7fbd('0x76')]||0x1f4;logger[_0x7fbd('0x21')](_0x7fbd('0x77'),'getFields',_0x8d098b,JSON[_0x7fbd('0x20')](_0x2abd50));delete _0x2abd50[_0x7fbd('0x30')];if(_0x8d098b===0x191){_0x8d098b=0x190;}_0x5b9e86['status'](_0x8d098b)[_0x7fbd('0x31')](_0x3474bb['query'][_0x7fbd('0x17')]?{'message':_0x7fbd('0x78'),'statusCode':_0x2abd50[_0x7fbd('0x76')]}:_0x2abd50);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 105059c..347a663 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 _0x637d=['api','bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x414cbe,_0x16a463){var _0x2793fe=function(_0x3a75f6){while(--_0x3a75f6){_0x414cbe['push'](_0x414cbe['shift']());}};_0x2793fe(++_0x16a463);}(_0x637d,0xf7));var _0xd637=function(_0x3c6bd3,_0x1e93b3){_0x3c6bd3=_0x3c6bd3-0x0;var _0x37bbc1=_0x637d[_0x3c6bd3];return _0x37bbc1;};'use strict';var _=require(_0xd637('0x0'));var util=require(_0xd637('0x1'));var logger=require(_0xd637('0x2'))(_0xd637('0x3'));var moment=require('moment');var BPromise=require(_0xd637('0x4'));var rp=require(_0xd637('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd637('0x6'));var integrations=require(_0xd637('0x7'));module['exports']=function(_0x16410b,_0x43f830){return _0x16410b[_0xd637('0x8')]('ZendeskAccount',attributes,{'tableName':_0xd637('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x338b=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x338b,0x1bb));var _0xb338=function(_0x2c0def,_0x19eb50){_0x2c0def=_0x2c0def-0x0;var _0x3fbc3e=_0x338b[_0x2c0def];return _0x3fbc3e;};'use strict';var _=require(_0xb338('0x0'));var util=require(_0xb338('0x1'));var logger=require(_0xb338('0x2'))(_0xb338('0x3'));var moment=require(_0xb338('0x4'));var BPromise=require(_0xb338('0x5'));var rp=require(_0xb338('0x6'));var fs=require('fs');var path=require(_0xb338('0x7'));var rimraf=require(_0xb338('0x8'));var config=require(_0xb338('0x9'));var attributes=require(_0xb338('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xb338('0xb')]=function(_0x382da1,_0x141d58){return _0x382da1[_0xb338('0xc')](_0xb338('0xd'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2d432ee..58a28d7 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 _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2a13ef,_0x53ddb2){var _0x4cea25=function(_0x30f9fb){while(--_0x30f9fb){_0x2a13ef['push'](_0x2a13ef['shift']());}};_0x4cea25(++_0x53ddb2);}(_0x757a,0xde));var _0xa757=function(_0x4ebbb3,_0x51c101){_0x4ebbb3=_0x4ebbb3-0x0;var _0x441ae3=_0x757a[_0x4ebbb3];return _0x441ae3;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0xcb91[_0x596284];return _0x5313c6;};'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 52c03a1..7dca79f 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 _0xa0f0=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa0f0,0x8a));var _0x0a0f=function(_0x5a880c,_0x421751){_0x5a880c=_0x5a880c-0x0;var _0x10497e=_0xa0f0[_0x5a880c];return _0x10497e;};'use strict';var multer=require(_0x0a0f('0x0'));var util=require(_0x0a0f('0x1'));var path=require('path');var timeout=require(_0x0a0f('0x2'));var express=require(_0x0a0f('0x3'));var router=express[_0x0a0f('0x4')]();var auth=require(_0x0a0f('0x5'));var interaction=require(_0x0a0f('0x6'));var config=require(_0x0a0f('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x0a0f('0x8')]('/',auth[_0x0a0f('0x9')](),controller[_0x0a0f('0xa')]);router[_0x0a0f('0x8')](_0x0a0f('0xb'),auth[_0x0a0f('0x9')](),controller[_0x0a0f('0xc')]);router['get'](_0x0a0f('0xd'),auth[_0x0a0f('0x9')](),controller[_0x0a0f('0xe')]);router['get'](_0x0a0f('0xf'),auth[_0x0a0f('0x9')](),controller[_0x0a0f('0x10')]);router[_0x0a0f('0x8')](_0x0a0f('0x11'),auth[_0x0a0f('0x9')](),controller['getDescriptions']);router['get'](_0x0a0f('0x12'),auth[_0x0a0f('0x9')](),controller[_0x0a0f('0x13')]);router[_0x0a0f('0x14')]('/',auth[_0x0a0f('0x9')](),controller[_0x0a0f('0x15')]);router[_0x0a0f('0x14')](_0x0a0f('0x12'),auth[_0x0a0f('0x9')](),controller[_0x0a0f('0x16')]);router[_0x0a0f('0x17')](_0x0a0f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0a0f('0x18')](_0x0a0f('0xb'),auth[_0x0a0f('0x9')](),controller[_0x0a0f('0x19')]);module[_0x0a0f('0x1a')]=router; \ No newline at end of file +var _0xcbbf=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0xcbbf,0x8c));var _0xfcbb=function(_0x30b9e3,_0x42eb82){_0x30b9e3=_0x30b9e3-0x0;var _0x4f26de=_0xcbbf[_0x30b9e3];return _0x4f26de;};'use strict';var multer=require(_0xfcbb('0x0'));var util=require(_0xfcbb('0x1'));var path=require(_0xfcbb('0x2'));var timeout=require(_0xfcbb('0x3'));var express=require(_0xfcbb('0x4'));var router=express['Router']();var auth=require(_0xfcbb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfcbb('0x6'));var controller=require(_0xfcbb('0x7'));router['get']('/',auth[_0xfcbb('0x8')](),controller['index']);router[_0xfcbb('0x9')](_0xfcbb('0xa'),auth[_0xfcbb('0x8')](),controller[_0xfcbb('0xb')]);router[_0xfcbb('0x9')](_0xfcbb('0xc'),auth[_0xfcbb('0x8')](),controller[_0xfcbb('0xd')]);router['get']('/:id/subjects',auth[_0xfcbb('0x8')](),controller[_0xfcbb('0xe')]);router[_0xfcbb('0x9')](_0xfcbb('0xf'),auth[_0xfcbb('0x8')](),controller[_0xfcbb('0x10')]);router[_0xfcbb('0x9')](_0xfcbb('0x11'),auth[_0xfcbb('0x8')](),controller[_0xfcbb('0x12')]);router[_0xfcbb('0x13')]('/',auth[_0xfcbb('0x8')](),controller[_0xfcbb('0x14')]);router['post'](_0xfcbb('0x11'),auth['isAuthenticated'](),controller[_0xfcbb('0x15')]);router[_0xfcbb('0x16')](_0xfcbb('0xa'),auth['isAuthenticated'](),controller[_0xfcbb('0x17')]);router[_0xfcbb('0x18')](_0xfcbb('0xa'),auth[_0xfcbb('0x8')](),controller[_0xfcbb('0x19')]);module[_0xfcbb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e36355d..ee2866a 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 _0x4cfc=['exports','STRING'];(function(_0x4d6e8b,_0x124632){var _0x147b81=function(_0x332c0b){while(--_0x332c0b){_0x4d6e8b['push'](_0x4d6e8b['shift']());}};_0x147b81(++_0x124632);}(_0x4cfc,0xe0));var _0xc4cf=function(_0x1a0592,_0x4ac510){_0x1a0592=_0x1a0592-0x0;var _0x5ade6d=_0x4cfc[_0x1a0592];return _0x5ade6d;};'use strict';var Sequelize=require('sequelize');module[_0xc4cf('0x0')]={'name':{'type':Sequelize[_0xc4cf('0x1')]},'description':{'type':Sequelize[_0xc4cf('0x1')]}}; \ No newline at end of file +var _0xf222=['exports','STRING','sequelize'];(function(_0x42bf9e,_0x54a2f0){var _0x48b8f0=function(_0x3fbd67){while(--_0x3fbd67){_0x42bf9e['push'](_0x42bf9e['shift']());}};_0x48b8f0(++_0x54a2f0);}(_0xf222,0x107));var _0x2f22=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf222[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x2f22('0x0'));module[_0x2f22('0x1')]={'name':{'type':Sequelize[_0x2f22('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5d1ad2e..fdeb5d1 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 _0x5542=['model','attributes','fields','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','length','find','create','body','getFields','findOne','keys','order','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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~!@#$%^&-_=+[{]}.','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','end','status','json','limit','apply','save','update','destroy','stack','name','index','ZendeskConfiguration','rawAttributes','type','map','query','filters','intersection'];(function(_0x608461,_0x276844){var _0x3ad81b=function(_0x46da52){while(--_0x46da52){_0x608461['push'](_0x608461['shift']());}};_0x3ad81b(++_0x276844);}(_0x5542,0xd2));var _0x2554=function(_0x193461,_0x42ce71){_0x193461=_0x193461-0x0;var _0x4c237c=_0x5542[_0x193461];return _0x4c237c;};'use strict';var pdf=require(_0x2554('0x0'));var emlformat=require(_0x2554('0x1'));var rimraf=require(_0x2554('0x2'));var zipdir=require(_0x2554('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2554('0x4'));var BPromise=require(_0x2554('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2554('0x6'));var sox=require('sox');var csv=require(_0x2554('0x7'));var ejs=require(_0x2554('0x8'));var fs=require('fs');var _=require(_0x2554('0x9'));var squel=require(_0x2554('0xa'));var crypto=require(_0x2554('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2554('0xc'));var toCsv=require(_0x2554('0x7'));var querystring=require(_0x2554('0xd'));var Papa=require('papaparse');var Redis=require(_0x2554('0xe'));var authService=require(_0x2554('0xf'));var qs=require(_0x2554('0x10'));var as=require(_0x2554('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2554('0x12'))('api');var utils=require(_0x2554('0x13'));var config=require(_0x2554('0x14'));var db=require(_0x2554('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2554('0x16')][_0x2554('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4e0484,_0x50c188,_0x3cebdd){if(_0x3cebdd){var _0x1f12bc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f12bc[_0x2554('0x18')](_0x50c188)){return _0x4e0484;}else{throw new db['Sequelize']['ValidationError'](_0x2554('0x19'));}}else{return _0x4e0484;}}function respondWithRpcPromise(_0x2b9e3a,_0x133931,_0x4ed655,_0x47ea80){return new BPromise(function(_0x4fd04d,_0xbecc57){var _0x5929af=_0x47ea80||client;return _0x5929af[_0x2554('0x1a')](_0x2b9e3a,_0x4ed655)[_0x2554('0x1b')](function(_0x405f50){logger['info'](_0x2554('0x1c'),_0x133931,_0x2554('0x1d'));logger[_0x2554('0x1e')](_0x2554('0x1f'),_0x133931,'request\x20sent',JSON['stringify'](_0x405f50));if(_0x405f50[_0x2554('0x20')]){if(_0x405f50[_0x2554('0x20')]['code']===0x1f4){logger[_0x2554('0x20')](_0x2554('0x1c'),_0x133931,_0x405f50[_0x2554('0x20')][_0x2554('0x21')]);return _0xbecc57(_0x405f50[_0x2554('0x20')][_0x2554('0x21')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x133931,_0x405f50[_0x2554('0x20')]['message']);return _0x4fd04d(_0x405f50['error'][_0x2554('0x21')]);}else{logger['info'](_0x2554('0x1c'),_0x133931,_0x2554('0x1d'));_0x4fd04d(_0x405f50[_0x2554('0x22')][_0x2554('0x21')]);}})['catch'](function(_0x5e069e){logger[_0x2554('0x20')](_0x2554('0x1c'),_0x133931,_0x5e069e);_0xbecc57(_0x5e069e);});});}function respondWithStatusCode(_0x52ea8f,_0x366df6){_0x366df6=_0x366df6||0xcc;return function(_0x48dc0){if(_0x48dc0){return _0x52ea8f[_0x2554('0x23')](_0x366df6);}return _0x52ea8f['status'](_0x366df6)[_0x2554('0x24')]();};}function respondWithResult(_0x29992f,_0x1b27fa){_0x1b27fa=_0x1b27fa||0xc8;return function(_0xd005fa){if(_0xd005fa){return _0x29992f[_0x2554('0x25')](_0x1b27fa)[_0x2554('0x26')](_0xd005fa);}};}function respondWithFilteredResult(_0x34e897,_0x47bfab){return function(_0x5aac60){if(_0x5aac60){var _0xa3fb4d=_0x5aac60['count'],_0x357815=_0x47bfab['offset'],_0x123326=_0x47bfab['offset']+_0x47bfab[_0x2554('0x27')],_0x5d58d8;if(_0x123326>=_0xa3fb4d){_0x123326=_0xa3fb4d;_0x5d58d8=0xc8;}else{_0x5d58d8=0xce;}_0x34e897[_0x2554('0x25')](_0x5d58d8);return _0x34e897['set']('Content-Range',_0x357815+'-'+_0x123326+'/'+_0xa3fb4d)['json'](_0x5aac60);}return null;};}function patchUpdates(_0x47e609){return function(_0x1c46e3){try{jsonpatch[_0x2554('0x28')](_0x1c46e3,_0x47e609,!![]);}catch(_0x2b6878){return BPromise['reject'](_0x2b6878);}return _0x1c46e3[_0x2554('0x29')]();};}function saveUpdates(_0x197efd,_0x479346){return function(_0xffcc06){if(_0xffcc06){return _0xffcc06[_0x2554('0x2a')](_0x197efd)[_0x2554('0x1b')](function(_0x4ab6a4){return _0x4ab6a4;});}return null;};}function removeEntity(_0x338bc2,_0x37430f){return function(_0x426e2d){if(_0x426e2d){return _0x426e2d[_0x2554('0x2b')]()[_0x2554('0x1b')](function(){_0x338bc2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2958e1,_0x513c0a){return function(_0x2c5ad2){if(!_0x2c5ad2){_0x2958e1[_0x2554('0x23')](0x194);}return _0x2c5ad2;};}function handleError(_0x34fb27,_0x48a587){_0x48a587=_0x48a587||0x1f4;return function(_0x2ccbdc){logger['error'](_0x2ccbdc[_0x2554('0x2c')]);if(_0x2ccbdc['name']){delete _0x2ccbdc[_0x2554('0x2d')];}_0x34fb27[_0x2554('0x25')](_0x48a587)['send'](_0x2ccbdc);};}exports[_0x2554('0x2e')]=function(_0x117ab5,_0x4c2bff){var _0x145c2b={},_0x2cc47c={},_0x3e80cf={'count':0x0,'rows':[]};var _0x5e9073=_['map'](db[_0x2554('0x2f')][_0x2554('0x30')],function(_0x3c6e1d){return{'name':_0x3c6e1d['fieldName'],'type':_0x3c6e1d[_0x2554('0x31')]['key']};});_0x2cc47c['model']=_[_0x2554('0x32')](_0x5e9073,_0x2554('0x2d'));_0x2cc47c[_0x2554('0x33')]=_['keys'](_0x117ab5[_0x2554('0x33')]);_0x2cc47c[_0x2554('0x34')]=_[_0x2554('0x35')](_0x2cc47c[_0x2554('0x36')],_0x2cc47c['query']);_0x145c2b[_0x2554('0x37')]=_[_0x2554('0x35')](_0x2cc47c[_0x2554('0x36')],qs['fields'](_0x117ab5['query'][_0x2554('0x38')]));_0x145c2b[_0x2554('0x37')]=_0x145c2b[_0x2554('0x37')]['length']?_0x145c2b[_0x2554('0x37')]:_0x2cc47c['model'];if(!_0x117ab5[_0x2554('0x33')]['hasOwnProperty'](_0x2554('0x39'))){_0x145c2b[_0x2554('0x27')]=qs[_0x2554('0x27')](_0x117ab5[_0x2554('0x33')][_0x2554('0x27')]);_0x145c2b[_0x2554('0x3a')]=qs['offset'](_0x117ab5['query']['offset']);}_0x145c2b['order']=qs[_0x2554('0x3b')](_0x117ab5[_0x2554('0x33')]['sort']);_0x145c2b[_0x2554('0x3c')]=qs[_0x2554('0x34')](_[_0x2554('0x3d')](_0x117ab5[_0x2554('0x33')],_0x2cc47c[_0x2554('0x34')]),_0x5e9073);if(_0x117ab5[_0x2554('0x33')][_0x2554('0x3e')]){_0x145c2b[_0x2554('0x3c')]=_[_0x2554('0x3f')](_0x145c2b[_0x2554('0x3c')],{'$or':_[_0x2554('0x32')](_0x5e9073,function(_0xe8791f){if(_0xe8791f[_0x2554('0x31')]!==_0x2554('0x40')){var _0x1157e2={};_0x1157e2[_0xe8791f[_0x2554('0x2d')]]={'$like':'%'+_0x117ab5[_0x2554('0x33')]['filter']+'%'};return _0x1157e2;}})});}_0x145c2b=_[_0x2554('0x3f')]({},_0x145c2b,_0x117ab5[_0x2554('0x41')]);var _0x39ca08={'where':_0x145c2b[_0x2554('0x3c')]};return db['ZendeskConfiguration'][_0x2554('0x42')](_0x39ca08)['then'](function(_0x13ac91){_0x3e80cf[_0x2554('0x42')]=_0x13ac91;if(_0x117ab5[_0x2554('0x33')][_0x2554('0x43')]){_0x145c2b[_0x2554('0x44')]=[{'all':!![]}];}return db[_0x2554('0x2f')][_0x2554('0x45')](_0x145c2b);})[_0x2554('0x1b')](function(_0x24f4f6){_0x3e80cf['rows']=_0x24f4f6;return _0x3e80cf;})[_0x2554('0x1b')](respondWithFilteredResult(_0x4c2bff,_0x145c2b))[_0x2554('0x46')](handleError(_0x4c2bff,null));};exports['show']=function(_0x6061b9,_0xcc311f){var _0x34a900={'raw':![],'where':{'id':_0x6061b9[_0x2554('0x47')]['id']}},_0x5e37b3={};_0x5e37b3['model']=_['keys'](db[_0x2554('0x2f')][_0x2554('0x30')]);_0x5e37b3['query']=_['keys'](_0x6061b9['query']);_0x5e37b3[_0x2554('0x34')]=_[_0x2554('0x35')](_0x5e37b3[_0x2554('0x36')],_0x5e37b3['query']);_0x34a900[_0x2554('0x37')]=_[_0x2554('0x35')](_0x5e37b3[_0x2554('0x36')],qs['fields'](_0x6061b9[_0x2554('0x33')][_0x2554('0x38')]));_0x34a900[_0x2554('0x37')]=_0x34a900['attributes'][_0x2554('0x48')]?_0x34a900['attributes']:_0x5e37b3[_0x2554('0x36')];if(_0x6061b9[_0x2554('0x33')][_0x2554('0x43')]){_0x34a900[_0x2554('0x44')]=[{'all':!![]}];}_0x34a900=_['merge']({},_0x34a900,_0x6061b9[_0x2554('0x41')]);return db[_0x2554('0x2f')][_0x2554('0x49')](_0x34a900)[_0x2554('0x1b')](handleEntityNotFound(_0xcc311f,null))['then'](respondWithResult(_0xcc311f,null))[_0x2554('0x46')](handleError(_0xcc311f,null));};exports[_0x2554('0x4a')]=function(_0x1b9796,_0x343bc7){return db[_0x2554('0x2f')]['create'](_0x1b9796[_0x2554('0x4b')],{})[_0x2554('0x1b')](respondWithResult(_0x343bc7,0xc9))[_0x2554('0x46')](handleError(_0x343bc7,null));};exports[_0x2554('0x2a')]=function(_0x6db70a,_0x5ee65b){if(_0x6db70a[_0x2554('0x4b')]['id']){delete _0x6db70a[_0x2554('0x4b')]['id'];}return db[_0x2554('0x2f')][_0x2554('0x49')]({'where':{'id':_0x6db70a[_0x2554('0x47')]['id']}})[_0x2554('0x1b')](handleEntityNotFound(_0x5ee65b,null))[_0x2554('0x1b')](saveUpdates(_0x6db70a['body'],null))[_0x2554('0x1b')](respondWithResult(_0x5ee65b,null))[_0x2554('0x46')](handleError(_0x5ee65b,null));};exports[_0x2554('0x2b')]=function(_0x386120,_0x39b242){return db[_0x2554('0x2f')][_0x2554('0x49')]({'where':{'id':_0x386120[_0x2554('0x47')]['id']}})['then'](handleEntityNotFound(_0x39b242,null))[_0x2554('0x1b')](removeEntity(_0x39b242,null))['catch'](handleError(_0x39b242,null));};exports[_0x2554('0x4c')]=function(_0xd6a851,_0x221e29,_0x4e4d31){var _0x26c6c3={};var _0x5b3d09={};var _0x4e952a;var _0xff781c;return db['ZendeskConfiguration'][_0x2554('0x4d')]({'where':{'id':_0xd6a851['params']['id']}})[_0x2554('0x1b')](handleEntityNotFound(_0x221e29,null))[_0x2554('0x1b')](function(_0x11d8b2){if(_0x11d8b2){_0x4e952a=_0x11d8b2;_0x5b3d09[_0x2554('0x36')]=_[_0x2554('0x4e')](db['ZendeskField'][_0x2554('0x30')]);_0x5b3d09[_0x2554('0x33')]=_[_0x2554('0x4e')](_0xd6a851[_0x2554('0x33')]);_0x5b3d09[_0x2554('0x34')]=_[_0x2554('0x35')](_0x5b3d09[_0x2554('0x36')],_0x5b3d09[_0x2554('0x33')]);_0x26c6c3[_0x2554('0x37')]=_[_0x2554('0x35')](_0x5b3d09[_0x2554('0x36')],qs[_0x2554('0x38')](_0xd6a851[_0x2554('0x33')][_0x2554('0x38')]));_0x26c6c3[_0x2554('0x37')]=_0x26c6c3[_0x2554('0x37')][_0x2554('0x48')]?_0x26c6c3[_0x2554('0x37')]:_0x5b3d09[_0x2554('0x36')];_0x26c6c3[_0x2554('0x4f')]=qs['sort'](_0xd6a851[_0x2554('0x33')][_0x2554('0x3b')]);_0x26c6c3[_0x2554('0x3c')]=qs['filters'](_['pick'](_0xd6a851[_0x2554('0x33')],_0x5b3d09['filters']));if(_0xd6a851[_0x2554('0x33')]['filter']){_0x26c6c3[_0x2554('0x3c')]=_['merge'](_0x26c6c3[_0x2554('0x3c')],{'$or':_['map'](_0x26c6c3[_0x2554('0x37')],function(_0xc8c13a){var _0x59af89={};_0x59af89[_0xc8c13a]={'$like':'%'+_0xd6a851['query']['filter']+'%'};return _0x59af89;})});}_0x26c6c3=_['merge']({},_0x26c6c3,_0xd6a851[_0x2554('0x41')]);return _0x4e952a[_0x2554('0x4c')](_0x26c6c3);}})[_0x2554('0x1b')](function(_0x3a4b92){if(_0x3a4b92){_0xff781c=_0x3a4b92[_0x2554('0x48')];if(!_0xd6a851[_0x2554('0x33')][_0x2554('0x50')](_0x2554('0x39'))){_0x26c6c3['limit']=qs[_0x2554('0x27')](_0xd6a851['query'][_0x2554('0x27')]);_0x26c6c3[_0x2554('0x3a')]=qs[_0x2554('0x3a')](_0xd6a851[_0x2554('0x33')][_0x2554('0x3a')]);}return _0x4e952a[_0x2554('0x4c')](_0x26c6c3);}})['then'](function(_0x297f03){if(_0x297f03){return _0x297f03?{'count':_0xff781c,'rows':_0x297f03}:null;}})['then'](respondWithResult(_0x221e29,null))[_0x2554('0x46')](handleError(_0x221e29,null));};exports[_0x2554('0x51')]=function(_0x5a3fd2,_0x533e64,_0x5d56b7){var _0x11461c={};var _0x3c01dd={};var _0x5a75ec;var _0x45de3c;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5a3fd2[_0x2554('0x47')]['id']}})[_0x2554('0x1b')](handleEntityNotFound(_0x533e64,null))[_0x2554('0x1b')](function(_0x26b268){if(_0x26b268){_0x5a75ec=_0x26b268;_0x3c01dd[_0x2554('0x36')]=_[_0x2554('0x4e')](db[_0x2554('0x52')]['rawAttributes']);_0x3c01dd[_0x2554('0x33')]=_[_0x2554('0x4e')](_0x5a3fd2[_0x2554('0x33')]);_0x3c01dd['filters']=_[_0x2554('0x35')](_0x3c01dd[_0x2554('0x36')],_0x3c01dd[_0x2554('0x33')]);_0x11461c['attributes']=_[_0x2554('0x35')](_0x3c01dd[_0x2554('0x36')],qs[_0x2554('0x38')](_0x5a3fd2['query'][_0x2554('0x38')]));_0x11461c['attributes']=_0x11461c[_0x2554('0x37')]['length']?_0x11461c[_0x2554('0x37')]:_0x3c01dd[_0x2554('0x36')];_0x11461c[_0x2554('0x4f')]=qs[_0x2554('0x3b')](_0x5a3fd2[_0x2554('0x33')][_0x2554('0x3b')]);_0x11461c[_0x2554('0x3c')]=qs[_0x2554('0x34')](_[_0x2554('0x3d')](_0x5a3fd2[_0x2554('0x33')],_0x3c01dd[_0x2554('0x34')]));if(_0x5a3fd2[_0x2554('0x33')][_0x2554('0x3e')]){_0x11461c[_0x2554('0x3c')]=_[_0x2554('0x3f')](_0x11461c[_0x2554('0x3c')],{'$or':_[_0x2554('0x32')](_0x11461c['attributes'],function(_0x3dba6b){var _0x515bf2={};_0x515bf2[_0x3dba6b]={'$like':'%'+_0x5a3fd2[_0x2554('0x33')][_0x2554('0x3e')]+'%'};return _0x515bf2;})});}_0x11461c=_[_0x2554('0x3f')]({},_0x11461c,_0x5a3fd2[_0x2554('0x41')]);return _0x5a75ec[_0x2554('0x51')](_0x11461c);}})[_0x2554('0x1b')](function(_0x284498){if(_0x284498){_0x45de3c=_0x284498['length'];if(!_0x5a3fd2[_0x2554('0x33')]['hasOwnProperty'](_0x2554('0x39'))){_0x11461c['limit']=qs['limit'](_0x5a3fd2[_0x2554('0x33')][_0x2554('0x27')]);_0x11461c[_0x2554('0x3a')]=qs[_0x2554('0x3a')](_0x5a3fd2['query'][_0x2554('0x3a')]);}return _0x5a75ec[_0x2554('0x51')](_0x11461c);}})[_0x2554('0x1b')](function(_0x11b749){if(_0x11b749){return _0x11b749?{'count':_0x45de3c,'rows':_0x11b749}:null;}})['then'](respondWithResult(_0x533e64,null))[_0x2554('0x46')](handleError(_0x533e64,null));};exports[_0x2554('0x53')]=function(_0x5c2b55,_0x3c382d,_0x734b7c){var _0x5ecf65={};var _0x3c04e8={};var _0x15ac1a;var _0x363f2c;return db[_0x2554('0x2f')][_0x2554('0x4d')]({'where':{'id':_0x5c2b55[_0x2554('0x47')]['id']}})[_0x2554('0x1b')](handleEntityNotFound(_0x3c382d,null))[_0x2554('0x1b')](function(_0xa5f858){if(_0xa5f858){_0x15ac1a=_0xa5f858;_0x3c04e8[_0x2554('0x36')]=_[_0x2554('0x4e')](db['ZendeskField'][_0x2554('0x30')]);_0x3c04e8['query']=_[_0x2554('0x4e')](_0x5c2b55[_0x2554('0x33')]);_0x3c04e8[_0x2554('0x34')]=_['intersection'](_0x3c04e8[_0x2554('0x36')],_0x3c04e8['query']);_0x5ecf65['attributes']=_['intersection'](_0x3c04e8['model'],qs[_0x2554('0x38')](_0x5c2b55[_0x2554('0x33')][_0x2554('0x38')]));_0x5ecf65[_0x2554('0x37')]=_0x5ecf65['attributes'][_0x2554('0x48')]?_0x5ecf65[_0x2554('0x37')]:_0x3c04e8['model'];_0x5ecf65[_0x2554('0x4f')]=qs[_0x2554('0x3b')](_0x5c2b55[_0x2554('0x33')][_0x2554('0x3b')]);_0x5ecf65[_0x2554('0x3c')]=qs[_0x2554('0x34')](_[_0x2554('0x3d')](_0x5c2b55['query'],_0x3c04e8[_0x2554('0x34')]));if(_0x5c2b55['query'][_0x2554('0x3e')]){_0x5ecf65[_0x2554('0x3c')]=_[_0x2554('0x3f')](_0x5ecf65['where'],{'$or':_[_0x2554('0x32')](_0x5ecf65['attributes'],function(_0x477c5c){var _0x2a2380={};_0x2a2380[_0x477c5c]={'$like':'%'+_0x5c2b55[_0x2554('0x33')][_0x2554('0x3e')]+'%'};return _0x2a2380;})});}_0x5ecf65=_[_0x2554('0x3f')]({},_0x5ecf65,_0x5c2b55[_0x2554('0x41')]);return _0x15ac1a[_0x2554('0x53')](_0x5ecf65);}})[_0x2554('0x1b')](function(_0x146ff2){if(_0x146ff2){_0x363f2c=_0x146ff2[_0x2554('0x48')];if(!_0x5c2b55[_0x2554('0x33')][_0x2554('0x50')](_0x2554('0x39'))){_0x5ecf65[_0x2554('0x27')]=qs[_0x2554('0x27')](_0x5c2b55[_0x2554('0x33')]['limit']);_0x5ecf65[_0x2554('0x3a')]=qs['offset'](_0x5c2b55[_0x2554('0x33')][_0x2554('0x3a')]);}return _0x15ac1a[_0x2554('0x53')](_0x5ecf65);}})[_0x2554('0x1b')](function(_0x90f4ee){if(_0x90f4ee){return _0x90f4ee?{'count':_0x363f2c,'rows':_0x90f4ee}:null;}})[_0x2554('0x1b')](respondWithResult(_0x3c382d,null))[_0x2554('0x46')](handleError(_0x3c382d,null));};exports['getTags']=function(_0x595785,_0x2159e9,_0x1f0116){var _0x53b52b={};var _0x27428f={};var _0x489cd4;var _0x2ac535;return db['ZendeskConfiguration'][_0x2554('0x4d')]({'where':{'id':_0x595785['params']['id']}})[_0x2554('0x1b')](handleEntityNotFound(_0x2159e9,null))['then'](function(_0x1a4684){if(_0x1a4684){_0x489cd4=_0x1a4684;_0x27428f[_0x2554('0x36')]=_['keys'](db[_0x2554('0x54')][_0x2554('0x30')]);_0x27428f[_0x2554('0x33')]=_[_0x2554('0x4e')](_0x595785['query']);_0x27428f[_0x2554('0x34')]=_[_0x2554('0x35')](_0x27428f[_0x2554('0x36')],_0x27428f[_0x2554('0x33')]);_0x53b52b[_0x2554('0x37')]=_[_0x2554('0x35')](_0x27428f[_0x2554('0x36')],qs[_0x2554('0x38')](_0x595785[_0x2554('0x33')][_0x2554('0x38')]));_0x53b52b[_0x2554('0x37')]=_0x53b52b['attributes'][_0x2554('0x48')]?_0x53b52b[_0x2554('0x37')]:_0x27428f[_0x2554('0x36')];_0x53b52b['order']=qs[_0x2554('0x3b')](_0x595785['query']['sort']);_0x53b52b[_0x2554('0x3c')]=qs['filters'](_[_0x2554('0x3d')](_0x595785[_0x2554('0x33')],_0x27428f['filters']));if(_0x595785[_0x2554('0x33')][_0x2554('0x3e')]){_0x53b52b[_0x2554('0x3c')]=_[_0x2554('0x3f')](_0x53b52b[_0x2554('0x3c')],{'$or':_['map'](_0x53b52b[_0x2554('0x37')],function(_0x15ab7d){var _0x2524c9={};_0x2524c9[_0x15ab7d]={'$like':'%'+_0x595785[_0x2554('0x33')][_0x2554('0x3e')]+'%'};return _0x2524c9;})});}_0x53b52b=_[_0x2554('0x3f')]({},_0x53b52b,_0x595785['options']);return _0x489cd4[_0x2554('0x55')](_0x53b52b);}})[_0x2554('0x1b')](function(_0x4602b1){if(_0x4602b1){_0x2ac535=_0x4602b1[_0x2554('0x48')];if(!_0x595785[_0x2554('0x33')][_0x2554('0x50')]('nolimit')){_0x53b52b[_0x2554('0x27')]=qs[_0x2554('0x27')](_0x595785[_0x2554('0x33')]['limit']);_0x53b52b[_0x2554('0x3a')]=qs[_0x2554('0x3a')](_0x595785[_0x2554('0x33')][_0x2554('0x3a')]);}return _0x489cd4['getTags'](_0x53b52b);}})['then'](function(_0x54ef30){if(_0x54ef30){return _0x54ef30?{'count':_0x2ac535,'rows':_0x54ef30}:null;}})[_0x2554('0x1b')](respondWithResult(_0x2159e9,null))[_0x2554('0x46')](handleError(_0x2159e9,null));};exports[_0x2554('0x56')]=function(_0x3b742d,_0x5f1368,_0xec593e){if(_0x3b742d[_0x2554('0x4b')]['id']){delete _0x3b742d[_0x2554('0x4b')]['id'];}return db[_0x2554('0x2f')][_0x2554('0x4d')]({'where':{'id':_0x3b742d[_0x2554('0x47')]['id']}})[_0x2554('0x1b')](handleEntityNotFound(_0x5f1368,null))[_0x2554('0x1b')](function(_0x43178b){if(_0x43178b){return _0x43178b['setTags'](_0x3b742d[_0x2554('0x4b')][_0x2554('0x57')]||[]);}return null;})[_0x2554('0x1b')](respondWithResult(_0x5f1368,null))[_0x2554('0x46')](handleError(_0x5f1368,null));}; \ No newline at end of file +var _0x9247=['../../config/logger','api','../../config/utils','jayson/promise','client','test','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','sendStatus','name','send','map','ZendeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','length','includeAll','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','getTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x271e0f,_0x5456a4){var _0x4d518a=function(_0x3e517a){while(--_0x3e517a){_0x271e0f['push'](_0x271e0f['shift']());}};_0x4d518a(++_0x5456a4);}(_0x9247,0x104));var _0x7924=function(_0x3fccd0,_0x135d78){_0x3fccd0=_0x3fccd0-0x0;var _0x5a250a=_0x9247[_0x3fccd0];return _0x5a250a;};'use strict';var pdf=require(_0x7924('0x0'));var emlformat=require(_0x7924('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7924('0x2'));var jsonpatch=require(_0x7924('0x3'));var rp=require(_0x7924('0x4'));var moment=require(_0x7924('0x5'));var BPromise=require(_0x7924('0x6'));var Mustache=require(_0x7924('0x7'));var util=require(_0x7924('0x8'));var path=require(_0x7924('0x9'));var sox=require(_0x7924('0xa'));var csv=require(_0x7924('0xb'));var ejs=require(_0x7924('0xc'));var fs=require('fs');var _=require(_0x7924('0xd'));var squel=require(_0x7924('0xe'));var crypto=require('crypto');var jsforce=require(_0x7924('0xf'));var deskjs=require(_0x7924('0x10'));var toCsv=require(_0x7924('0xb'));var querystring=require(_0x7924('0x11'));var Papa=require(_0x7924('0x12'));var Redis=require(_0x7924('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7924('0x14'));var as=require(_0x7924('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7924('0x16'))(_0x7924('0x17'));var utils=require(_0x7924('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x7924('0x19'));var client=jayson[_0x7924('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x213056,_0x5da7b8,_0x543aa8){if(_0x543aa8){var _0x2fa2e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fa2e2[_0x7924('0x1b')](_0x5da7b8)){return _0x213056;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x213056;}}function respondWithRpcPromise(_0x469bd0,_0x1e6c84,_0x40a8c7,_0x1cebb0){return new BPromise(function(_0x5191ca,_0x492a98){var _0x406935=_0x1cebb0||client;return _0x406935[_0x7924('0x1c')](_0x469bd0,_0x40a8c7)[_0x7924('0x1d')](function(_0x5cf04c){logger[_0x7924('0x1e')](_0x7924('0x1f'),_0x1e6c84,_0x7924('0x20'));logger[_0x7924('0x21')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1e6c84,_0x7924('0x20'),JSON[_0x7924('0x22')](_0x5cf04c));if(_0x5cf04c['error']){if(_0x5cf04c[_0x7924('0x23')][_0x7924('0x24')]===0x1f4){logger[_0x7924('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1e6c84,_0x5cf04c[_0x7924('0x23')][_0x7924('0x25')]);return _0x492a98(_0x5cf04c[_0x7924('0x23')]['message']);}logger[_0x7924('0x23')](_0x7924('0x1f'),_0x1e6c84,_0x5cf04c[_0x7924('0x23')][_0x7924('0x25')]);return _0x5191ca(_0x5cf04c[_0x7924('0x23')][_0x7924('0x25')]);}else{logger[_0x7924('0x1e')](_0x7924('0x1f'),_0x1e6c84,_0x7924('0x20'));_0x5191ca(_0x5cf04c[_0x7924('0x26')][_0x7924('0x25')]);}})['catch'](function(_0x2836ac){logger['error'](_0x7924('0x1f'),_0x1e6c84,_0x2836ac);_0x492a98(_0x2836ac);});});}function respondWithStatusCode(_0x139a87,_0x529314){_0x529314=_0x529314||0xcc;return function(_0x161492){if(_0x161492){return _0x139a87['sendStatus'](_0x529314);}return _0x139a87[_0x7924('0x27')](_0x529314)[_0x7924('0x28')]();};}function respondWithResult(_0x48e82b,_0x28d8e2){_0x28d8e2=_0x28d8e2||0xc8;return function(_0x1d2567){if(_0x1d2567){return _0x48e82b[_0x7924('0x27')](_0x28d8e2)[_0x7924('0x29')](_0x1d2567);}};}function respondWithFilteredResult(_0x38dde1,_0x24ddaf){return function(_0x48c78d){if(_0x48c78d){var _0x75d8f4=_0x48c78d[_0x7924('0x2a')],_0x5d0194=_0x24ddaf['offset'],_0x292924=_0x24ddaf[_0x7924('0x2b')]+_0x24ddaf[_0x7924('0x2c')],_0x31663a;if(_0x292924>=_0x75d8f4){_0x292924=_0x75d8f4;_0x31663a=0xc8;}else{_0x31663a=0xce;}_0x38dde1[_0x7924('0x27')](_0x31663a);return _0x38dde1['set'](_0x7924('0x2d'),_0x5d0194+'-'+_0x292924+'/'+_0x75d8f4)['json'](_0x48c78d);}return null;};}function patchUpdates(_0x5f0af4){return function(_0x2364c6){try{jsonpatch[_0x7924('0x2e')](_0x2364c6,_0x5f0af4,!![]);}catch(_0x528fc4){return BPromise[_0x7924('0x2f')](_0x528fc4);}return _0x2364c6[_0x7924('0x30')]();};}function saveUpdates(_0x44ef0b,_0x135f50){return function(_0x4c337d){if(_0x4c337d){return _0x4c337d[_0x7924('0x31')](_0x44ef0b)[_0x7924('0x1d')](function(_0x2e5685){return _0x2e5685;});}return null;};}function removeEntity(_0x1a3459,_0x42ee2a){return function(_0xd309fe){if(_0xd309fe){return _0xd309fe['destroy']()[_0x7924('0x1d')](function(){_0x1a3459[_0x7924('0x27')](0xcc)[_0x7924('0x28')]();});}};}function handleEntityNotFound(_0x56c39a,_0x1b1663){return function(_0x398cbc){if(!_0x398cbc){_0x56c39a[_0x7924('0x32')](0x194);}return _0x398cbc;};}function handleError(_0x6804a,_0x230259){_0x230259=_0x230259||0x1f4;return function(_0xfc3ee8){logger['error'](_0xfc3ee8['stack']);if(_0xfc3ee8[_0x7924('0x33')]){delete _0xfc3ee8[_0x7924('0x33')];}_0x6804a['status'](_0x230259)[_0x7924('0x34')](_0xfc3ee8);};}exports['index']=function(_0x41da90,_0x96223b){var _0x5202ed={},_0x5f0828={},_0x35ce46={'count':0x0,'rows':[]};var _0x2e2b90=_[_0x7924('0x35')](db[_0x7924('0x36')][_0x7924('0x37')],function(_0x3216b9){return{'name':_0x3216b9['fieldName'],'type':_0x3216b9[_0x7924('0x38')][_0x7924('0x39')]};});_0x5f0828[_0x7924('0x3a')]=_['map'](_0x2e2b90,_0x7924('0x33'));_0x5f0828[_0x7924('0x3b')]=_['keys'](_0x41da90[_0x7924('0x3b')]);_0x5f0828[_0x7924('0x3c')]=_['intersection'](_0x5f0828[_0x7924('0x3a')],_0x5f0828['query']);_0x5202ed['attributes']=_[_0x7924('0x3d')](_0x5f0828[_0x7924('0x3a')],qs[_0x7924('0x3e')](_0x41da90[_0x7924('0x3b')]['fields']));_0x5202ed['attributes']=_0x5202ed[_0x7924('0x3f')]['length']?_0x5202ed[_0x7924('0x3f')]:_0x5f0828[_0x7924('0x3a')];if(!_0x41da90['query'][_0x7924('0x40')](_0x7924('0x41'))){_0x5202ed[_0x7924('0x2c')]=qs['limit'](_0x41da90[_0x7924('0x3b')][_0x7924('0x2c')]);_0x5202ed[_0x7924('0x2b')]=qs[_0x7924('0x2b')](_0x41da90[_0x7924('0x3b')][_0x7924('0x2b')]);}_0x5202ed[_0x7924('0x42')]=qs['sort'](_0x41da90[_0x7924('0x3b')][_0x7924('0x43')]);_0x5202ed[_0x7924('0x44')]=qs[_0x7924('0x3c')](_[_0x7924('0x45')](_0x41da90[_0x7924('0x3b')],_0x5f0828['filters']),_0x2e2b90);if(_0x41da90[_0x7924('0x3b')][_0x7924('0x46')]){_0x5202ed['where']=_[_0x7924('0x47')](_0x5202ed[_0x7924('0x44')],{'$or':_['map'](_0x2e2b90,function(_0x205a6b){if(_0x205a6b[_0x7924('0x38')]!==_0x7924('0x48')){var _0x255c3c={};_0x255c3c[_0x205a6b['name']]={'$like':'%'+_0x41da90[_0x7924('0x3b')][_0x7924('0x46')]+'%'};return _0x255c3c;}})});}_0x5202ed=_[_0x7924('0x47')]({},_0x5202ed,_0x41da90[_0x7924('0x49')]);var _0x14d2fd={'where':_0x5202ed[_0x7924('0x44')]};return db['ZendeskConfiguration'][_0x7924('0x2a')](_0x14d2fd)[_0x7924('0x1d')](function(_0x2529ba){_0x35ce46[_0x7924('0x2a')]=_0x2529ba;if(_0x41da90['query']['includeAll']){_0x5202ed[_0x7924('0x4a')]=[{'all':!![]}];}return db[_0x7924('0x36')]['findAll'](_0x5202ed);})[_0x7924('0x1d')](function(_0x453975){_0x35ce46[_0x7924('0x4b')]=_0x453975;return _0x35ce46;})[_0x7924('0x1d')](respondWithFilteredResult(_0x96223b,_0x5202ed))[_0x7924('0x4c')](handleError(_0x96223b,null));};exports[_0x7924('0x4d')]=function(_0x4ce172,_0x24b28f){var _0x4b4db7={'raw':![],'where':{'id':_0x4ce172[_0x7924('0x4e')]['id']}},_0x1aed07={};_0x1aed07[_0x7924('0x3a')]=_[_0x7924('0x4f')](db[_0x7924('0x36')]['rawAttributes']);_0x1aed07[_0x7924('0x3b')]=_[_0x7924('0x4f')](_0x4ce172['query']);_0x1aed07[_0x7924('0x3c')]=_[_0x7924('0x3d')](_0x1aed07[_0x7924('0x3a')],_0x1aed07[_0x7924('0x3b')]);_0x4b4db7[_0x7924('0x3f')]=_[_0x7924('0x3d')](_0x1aed07['model'],qs[_0x7924('0x3e')](_0x4ce172['query'][_0x7924('0x3e')]));_0x4b4db7[_0x7924('0x3f')]=_0x4b4db7['attributes'][_0x7924('0x50')]?_0x4b4db7[_0x7924('0x3f')]:_0x1aed07[_0x7924('0x3a')];if(_0x4ce172[_0x7924('0x3b')][_0x7924('0x51')]){_0x4b4db7['include']=[{'all':!![]}];}_0x4b4db7=_[_0x7924('0x47')]({},_0x4b4db7,_0x4ce172[_0x7924('0x49')]);return db[_0x7924('0x36')][_0x7924('0x52')](_0x4b4db7)[_0x7924('0x1d')](handleEntityNotFound(_0x24b28f,null))[_0x7924('0x1d')](respondWithResult(_0x24b28f,null))['catch'](handleError(_0x24b28f,null));};exports['create']=function(_0x2e9db3,_0x4e815c){return db['ZendeskConfiguration'][_0x7924('0x53')](_0x2e9db3[_0x7924('0x54')],{})[_0x7924('0x1d')](respondWithResult(_0x4e815c,0xc9))['catch'](handleError(_0x4e815c,null));};exports[_0x7924('0x31')]=function(_0x47c8f7,_0x163432){if(_0x47c8f7[_0x7924('0x54')]['id']){delete _0x47c8f7[_0x7924('0x54')]['id'];}return db[_0x7924('0x36')]['find']({'where':{'id':_0x47c8f7[_0x7924('0x4e')]['id']}})['then'](handleEntityNotFound(_0x163432,null))['then'](saveUpdates(_0x47c8f7[_0x7924('0x54')],null))['then'](respondWithResult(_0x163432,null))['catch'](handleError(_0x163432,null));};exports[_0x7924('0x55')]=function(_0x446aa8,_0x272e27){return db['ZendeskConfiguration']['find']({'where':{'id':_0x446aa8[_0x7924('0x4e')]['id']}})[_0x7924('0x1d')](handleEntityNotFound(_0x272e27,null))[_0x7924('0x1d')](removeEntity(_0x272e27,null))['catch'](handleError(_0x272e27,null));};exports[_0x7924('0x56')]=function(_0x446801,_0x796662,_0x69a8a1){var _0x412014={};var _0x240596={};var _0x379e29;var _0x5ddc59;return db[_0x7924('0x36')][_0x7924('0x57')]({'where':{'id':_0x446801[_0x7924('0x4e')]['id']}})[_0x7924('0x1d')](handleEntityNotFound(_0x796662,null))[_0x7924('0x1d')](function(_0x287e07){if(_0x287e07){_0x379e29=_0x287e07;_0x240596['model']=_[_0x7924('0x4f')](db[_0x7924('0x58')][_0x7924('0x37')]);_0x240596['query']=_[_0x7924('0x4f')](_0x446801[_0x7924('0x3b')]);_0x240596[_0x7924('0x3c')]=_[_0x7924('0x3d')](_0x240596[_0x7924('0x3a')],_0x240596['query']);_0x412014[_0x7924('0x3f')]=_['intersection'](_0x240596[_0x7924('0x3a')],qs[_0x7924('0x3e')](_0x446801[_0x7924('0x3b')][_0x7924('0x3e')]));_0x412014[_0x7924('0x3f')]=_0x412014['attributes'][_0x7924('0x50')]?_0x412014['attributes']:_0x240596['model'];_0x412014[_0x7924('0x42')]=qs[_0x7924('0x43')](_0x446801[_0x7924('0x3b')]['sort']);_0x412014['where']=qs['filters'](_['pick'](_0x446801['query'],_0x240596['filters']));if(_0x446801[_0x7924('0x3b')]['filter']){_0x412014[_0x7924('0x44')]=_['merge'](_0x412014[_0x7924('0x44')],{'$or':_[_0x7924('0x35')](_0x412014[_0x7924('0x3f')],function(_0x39e141){var _0x406e04={};_0x406e04[_0x39e141]={'$like':'%'+_0x446801[_0x7924('0x3b')]['filter']+'%'};return _0x406e04;})});}_0x412014=_[_0x7924('0x47')]({},_0x412014,_0x446801[_0x7924('0x49')]);return _0x379e29['getFields'](_0x412014);}})[_0x7924('0x1d')](function(_0x223e1b){if(_0x223e1b){_0x5ddc59=_0x223e1b[_0x7924('0x50')];if(!_0x446801[_0x7924('0x3b')][_0x7924('0x40')](_0x7924('0x41'))){_0x412014[_0x7924('0x2c')]=qs[_0x7924('0x2c')](_0x446801[_0x7924('0x3b')]['limit']);_0x412014[_0x7924('0x2b')]=qs[_0x7924('0x2b')](_0x446801[_0x7924('0x3b')][_0x7924('0x2b')]);}return _0x379e29[_0x7924('0x56')](_0x412014);}})[_0x7924('0x1d')](function(_0x40ff7f){if(_0x40ff7f){return _0x40ff7f?{'count':_0x5ddc59,'rows':_0x40ff7f}:null;}})['then'](respondWithResult(_0x796662,null))[_0x7924('0x4c')](handleError(_0x796662,null));};exports['getSubjects']=function(_0x4dfa8f,_0x2fe0e9,_0x363eca){var _0x12f8d7={};var _0x326e2c={};var _0x47a9a5;var _0xe9a293;return db[_0x7924('0x36')][_0x7924('0x57')]({'where':{'id':_0x4dfa8f[_0x7924('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2fe0e9,null))['then'](function(_0x1d5b98){if(_0x1d5b98){_0x47a9a5=_0x1d5b98;_0x326e2c[_0x7924('0x3a')]=_[_0x7924('0x4f')](db['ZendeskField'][_0x7924('0x37')]);_0x326e2c['query']=_['keys'](_0x4dfa8f[_0x7924('0x3b')]);_0x326e2c[_0x7924('0x3c')]=_[_0x7924('0x3d')](_0x326e2c[_0x7924('0x3a')],_0x326e2c[_0x7924('0x3b')]);_0x12f8d7['attributes']=_['intersection'](_0x326e2c[_0x7924('0x3a')],qs[_0x7924('0x3e')](_0x4dfa8f[_0x7924('0x3b')][_0x7924('0x3e')]));_0x12f8d7[_0x7924('0x3f')]=_0x12f8d7[_0x7924('0x3f')]['length']?_0x12f8d7[_0x7924('0x3f')]:_0x326e2c['model'];_0x12f8d7[_0x7924('0x42')]=qs[_0x7924('0x43')](_0x4dfa8f[_0x7924('0x3b')][_0x7924('0x43')]);_0x12f8d7[_0x7924('0x44')]=qs['filters'](_[_0x7924('0x45')](_0x4dfa8f['query'],_0x326e2c[_0x7924('0x3c')]));if(_0x4dfa8f[_0x7924('0x3b')][_0x7924('0x46')]){_0x12f8d7['where']=_[_0x7924('0x47')](_0x12f8d7['where'],{'$or':_[_0x7924('0x35')](_0x12f8d7[_0x7924('0x3f')],function(_0x4f83a4){var _0x52193d={};_0x52193d[_0x4f83a4]={'$like':'%'+_0x4dfa8f[_0x7924('0x3b')]['filter']+'%'};return _0x52193d;})});}_0x12f8d7=_[_0x7924('0x47')]({},_0x12f8d7,_0x4dfa8f[_0x7924('0x49')]);return _0x47a9a5['getSubjects'](_0x12f8d7);}})[_0x7924('0x1d')](function(_0x41a6b7){if(_0x41a6b7){_0xe9a293=_0x41a6b7[_0x7924('0x50')];if(!_0x4dfa8f[_0x7924('0x3b')]['hasOwnProperty']('nolimit')){_0x12f8d7[_0x7924('0x2c')]=qs[_0x7924('0x2c')](_0x4dfa8f[_0x7924('0x3b')][_0x7924('0x2c')]);_0x12f8d7[_0x7924('0x2b')]=qs[_0x7924('0x2b')](_0x4dfa8f[_0x7924('0x3b')][_0x7924('0x2b')]);}return _0x47a9a5[_0x7924('0x59')](_0x12f8d7);}})[_0x7924('0x1d')](function(_0x199008){if(_0x199008){return _0x199008?{'count':_0xe9a293,'rows':_0x199008}:null;}})[_0x7924('0x1d')](respondWithResult(_0x2fe0e9,null))[_0x7924('0x4c')](handleError(_0x2fe0e9,null));};exports[_0x7924('0x5a')]=function(_0x124490,_0x58bfba,_0x19730a){var _0x3a7b33={};var _0xbf59a5={};var _0x2edce0;var _0x1e3d16;return db[_0x7924('0x36')][_0x7924('0x57')]({'where':{'id':_0x124490[_0x7924('0x4e')]['id']}})['then'](handleEntityNotFound(_0x58bfba,null))[_0x7924('0x1d')](function(_0x33001e){if(_0x33001e){_0x2edce0=_0x33001e;_0xbf59a5[_0x7924('0x3a')]=_[_0x7924('0x4f')](db[_0x7924('0x58')][_0x7924('0x37')]);_0xbf59a5[_0x7924('0x3b')]=_[_0x7924('0x4f')](_0x124490[_0x7924('0x3b')]);_0xbf59a5['filters']=_[_0x7924('0x3d')](_0xbf59a5[_0x7924('0x3a')],_0xbf59a5[_0x7924('0x3b')]);_0x3a7b33[_0x7924('0x3f')]=_[_0x7924('0x3d')](_0xbf59a5[_0x7924('0x3a')],qs[_0x7924('0x3e')](_0x124490[_0x7924('0x3b')][_0x7924('0x3e')]));_0x3a7b33['attributes']=_0x3a7b33[_0x7924('0x3f')]['length']?_0x3a7b33[_0x7924('0x3f')]:_0xbf59a5[_0x7924('0x3a')];_0x3a7b33[_0x7924('0x42')]=qs[_0x7924('0x43')](_0x124490['query'][_0x7924('0x43')]);_0x3a7b33['where']=qs[_0x7924('0x3c')](_[_0x7924('0x45')](_0x124490[_0x7924('0x3b')],_0xbf59a5[_0x7924('0x3c')]));if(_0x124490['query'][_0x7924('0x46')]){_0x3a7b33['where']=_[_0x7924('0x47')](_0x3a7b33[_0x7924('0x44')],{'$or':_[_0x7924('0x35')](_0x3a7b33['attributes'],function(_0x4954db){var _0x5a00c9={};_0x5a00c9[_0x4954db]={'$like':'%'+_0x124490['query'][_0x7924('0x46')]+'%'};return _0x5a00c9;})});}_0x3a7b33=_[_0x7924('0x47')]({},_0x3a7b33,_0x124490[_0x7924('0x49')]);return _0x2edce0[_0x7924('0x5a')](_0x3a7b33);}})['then'](function(_0xaa6532){if(_0xaa6532){_0x1e3d16=_0xaa6532['length'];if(!_0x124490[_0x7924('0x3b')][_0x7924('0x40')](_0x7924('0x41'))){_0x3a7b33[_0x7924('0x2c')]=qs[_0x7924('0x2c')](_0x124490[_0x7924('0x3b')][_0x7924('0x2c')]);_0x3a7b33['offset']=qs[_0x7924('0x2b')](_0x124490[_0x7924('0x3b')]['offset']);}return _0x2edce0[_0x7924('0x5a')](_0x3a7b33);}})[_0x7924('0x1d')](function(_0x4c6626){if(_0x4c6626){return _0x4c6626?{'count':_0x1e3d16,'rows':_0x4c6626}:null;}})[_0x7924('0x1d')](respondWithResult(_0x58bfba,null))[_0x7924('0x4c')](handleError(_0x58bfba,null));};exports['getTags']=function(_0x37f025,_0x278dc3,_0x2c1e00){var _0x31ff30={};var _0x27e1a5={};var _0x1ec9ce;var _0x5819e5;return db['ZendeskConfiguration'][_0x7924('0x57')]({'where':{'id':_0x37f025[_0x7924('0x4e')]['id']}})[_0x7924('0x1d')](handleEntityNotFound(_0x278dc3,null))[_0x7924('0x1d')](function(_0x35ecfc){if(_0x35ecfc){_0x1ec9ce=_0x35ecfc;_0x27e1a5[_0x7924('0x3a')]=_[_0x7924('0x4f')](db[_0x7924('0x5b')][_0x7924('0x37')]);_0x27e1a5[_0x7924('0x3b')]=_[_0x7924('0x4f')](_0x37f025['query']);_0x27e1a5['filters']=_[_0x7924('0x3d')](_0x27e1a5[_0x7924('0x3a')],_0x27e1a5[_0x7924('0x3b')]);_0x31ff30[_0x7924('0x3f')]=_['intersection'](_0x27e1a5[_0x7924('0x3a')],qs[_0x7924('0x3e')](_0x37f025[_0x7924('0x3b')]['fields']));_0x31ff30[_0x7924('0x3f')]=_0x31ff30[_0x7924('0x3f')][_0x7924('0x50')]?_0x31ff30[_0x7924('0x3f')]:_0x27e1a5[_0x7924('0x3a')];_0x31ff30[_0x7924('0x42')]=qs[_0x7924('0x43')](_0x37f025['query'][_0x7924('0x43')]);_0x31ff30[_0x7924('0x44')]=qs['filters'](_['pick'](_0x37f025[_0x7924('0x3b')],_0x27e1a5[_0x7924('0x3c')]));if(_0x37f025['query'][_0x7924('0x46')]){_0x31ff30[_0x7924('0x44')]=_['merge'](_0x31ff30[_0x7924('0x44')],{'$or':_[_0x7924('0x35')](_0x31ff30[_0x7924('0x3f')],function(_0x3cb4b6){var _0x26f06c={};_0x26f06c[_0x3cb4b6]={'$like':'%'+_0x37f025[_0x7924('0x3b')][_0x7924('0x46')]+'%'};return _0x26f06c;})});}_0x31ff30=_['merge']({},_0x31ff30,_0x37f025['options']);return _0x1ec9ce[_0x7924('0x5c')](_0x31ff30);}})[_0x7924('0x1d')](function(_0x3c70f9){if(_0x3c70f9){_0x5819e5=_0x3c70f9[_0x7924('0x50')];if(!_0x37f025[_0x7924('0x3b')]['hasOwnProperty']('nolimit')){_0x31ff30['limit']=qs[_0x7924('0x2c')](_0x37f025[_0x7924('0x3b')][_0x7924('0x2c')]);_0x31ff30['offset']=qs[_0x7924('0x2b')](_0x37f025['query'][_0x7924('0x2b')]);}return _0x1ec9ce['getTags'](_0x31ff30);}})['then'](function(_0x97c790){if(_0x97c790){return _0x97c790?{'count':_0x5819e5,'rows':_0x97c790}:null;}})[_0x7924('0x1d')](respondWithResult(_0x278dc3,null))['catch'](handleError(_0x278dc3,null));};exports['setTags']=function(_0x469aa4,_0x300b5d,_0x21e520){if(_0x469aa4[_0x7924('0x54')]['id']){delete _0x469aa4['body']['id'];}return db['ZendeskConfiguration'][_0x7924('0x57')]({'where':{'id':_0x469aa4['params']['id']}})[_0x7924('0x1d')](handleEntityNotFound(_0x300b5d,null))[_0x7924('0x1d')](function(_0x2808a5){if(_0x2808a5){return _0x2808a5['setTags'](_0x469aa4[_0x7924('0x54')][_0x7924('0x5d')]||[]);}return null;})[_0x7924('0x1d')](respondWithResult(_0x300b5d,null))['catch'](handleError(_0x300b5d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index f6258bc..0fec523 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 _0x14b7=['rimraf','../../config/environment','exports','int_zendesk_configurations','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x485cc6,_0x3f2a33){var _0x18ac35=function(_0x716c46){while(--_0x716c46){_0x485cc6['push'](_0x485cc6['shift']());}};_0x18ac35(++_0x3f2a33);}(_0x14b7,0x130));var _0x714b=function(_0x245690,_0x3bf938){_0x245690=_0x245690-0x0;var _0x3fb9a4=_0x14b7[_0x245690];return _0x3fb9a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x714b('0x0'))(_0x714b('0x1'));var moment=require(_0x714b('0x2'));var BPromise=require(_0x714b('0x3'));var rp=require(_0x714b('0x4'));var fs=require('fs');var path=require(_0x714b('0x5'));var rimraf=require(_0x714b('0x6'));var config=require(_0x714b('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x714b('0x8')]=function(_0xa622a8,_0x4be578){return _0xa622a8['define']('ZendeskConfiguration',attributes,{'tableName':_0x714b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a3=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','bluebird','rimraf','../../config/environment','exports'];(function(_0x38e72d,_0x167d10){var _0x388a26=function(_0x2c9e94){while(--_0x2c9e94){_0x38e72d['push'](_0x38e72d['shift']());}};_0x388a26(++_0x167d10);}(_0x50a3,0x198));var _0x350a=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x50a3[_0x2e913b];return _0x173899;};'use strict';var _=require(_0x350a('0x0'));var util=require('util');var logger=require(_0x350a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x350a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x350a('0x3'));var config=require(_0x350a('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x350a('0x5')]=function(_0xa53ae1,_0x2a4b94){return _0xa53ae1[_0x350a('0x6')](_0x350a('0x7'),attributes,{'tableName':_0x350a('0x8'),'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 043dcf6..4a37869 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 _0x4cf7=['request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56d0af,_0x584828){var _0x23111=function(_0x524a87){while(--_0x524a87){_0x56d0af['push'](_0x56d0af['shift']());}};_0x23111(++_0x584828);}(_0x4cf7,0x11c));var _0x74cf=function(_0x5ab2eb,_0x3df78a){_0x5ab2eb=_0x5ab2eb-0x0;var _0xae166=_0x4cf7[_0x5ab2eb];return _0xae166;};'use strict';var _=require(_0x74cf('0x0'));var util=require(_0x74cf('0x1'));var moment=require(_0x74cf('0x2'));var BPromise=require('bluebird');var rs=require(_0x74cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x74cf('0x5'))(_0x74cf('0x6'));var config=require(_0x74cf('0x7'));var jayson=require(_0x74cf('0x8'));var client=jayson[_0x74cf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c65b6,_0x40d5f3,_0x34b7d1){return new BPromise(function(_0x30ee21,_0x3c8e28){return client[_0x74cf('0xa')](_0x1c65b6,_0x34b7d1)[_0x74cf('0xb')](function(_0x1a1294){logger[_0x74cf('0xc')](_0x74cf('0xd'),_0x40d5f3,'request\x20sent');logger[_0x74cf('0xe')](_0x74cf('0xf'),_0x40d5f3,_0x74cf('0x10'),JSON[_0x74cf('0x11')](_0x1a1294));if(_0x1a1294[_0x74cf('0x12')]){if(_0x1a1294['error']['code']===0x1f4){logger[_0x74cf('0x12')](_0x74cf('0xd'),_0x40d5f3,_0x1a1294['error'][_0x74cf('0x13')]);return _0x3c8e28(_0x1a1294[_0x74cf('0x12')]['message']);}logger['error'](_0x74cf('0xd'),_0x40d5f3,_0x1a1294[_0x74cf('0x12')][_0x74cf('0x13')]);return _0x30ee21(_0x1a1294['error'][_0x74cf('0x13')]);}else{logger[_0x74cf('0xc')](_0x74cf('0xd'),_0x40d5f3,_0x74cf('0x10'));_0x30ee21(_0x1a1294['result'][_0x74cf('0x13')]);}})[_0x74cf('0x14')](function(_0x165e8c){logger[_0x74cf('0x12')](_0x74cf('0xd'),_0x40d5f3,_0x165e8c);_0x3c8e28(_0x165e8c);});});} \ No newline at end of file +var _0x3277=['rpc','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x3277,0x12c));var _0x7327=function(_0x15695b,_0x259c66){_0x15695b=_0x15695b-0x0;var _0x2282ca=_0x3277[_0x15695b];return _0x2282ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7327('0x0'));var BPromise=require('bluebird');var rs=require(_0x7327('0x1'));var fs=require('fs');var Redis=require(_0x7327('0x2'));var db=require(_0x7327('0x3'))['db'];var utils=require(_0x7327('0x4'));var logger=require(_0x7327('0x5'))(_0x7327('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10adcf,_0x500567,_0x54370d){return new BPromise(function(_0x33c7b8,_0x496ec2){return client[_0x7327('0x7')](_0x10adcf,_0x54370d)[_0x7327('0x8')](function(_0x416a7e){logger[_0x7327('0x9')](_0x7327('0xa'),_0x500567,_0x7327('0xb'));logger[_0x7327('0xc')](_0x7327('0xd'),_0x500567,_0x7327('0xb'),JSON[_0x7327('0xe')](_0x416a7e));if(_0x416a7e[_0x7327('0xf')]){if(_0x416a7e['error']['code']===0x1f4){logger['error'](_0x7327('0xa'),_0x500567,_0x416a7e[_0x7327('0xf')]['message']);return _0x496ec2(_0x416a7e['error'][_0x7327('0x10')]);}logger[_0x7327('0xf')](_0x7327('0xa'),_0x500567,_0x416a7e[_0x7327('0xf')]['message']);return _0x33c7b8(_0x416a7e['error'][_0x7327('0x10')]);}else{logger[_0x7327('0x9')](_0x7327('0xa'),_0x500567,'request\x20sent');_0x33c7b8(_0x416a7e[_0x7327('0x11')]['message']);}})['catch'](function(_0x1a9419){logger['error'](_0x7327('0xa'),_0x500567,_0x1a9419);_0x496ec2(_0x1a9419);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index dd0e9dd..8492891 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 _0x8eca=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x47f1f6,_0x5afc03){var _0xd1e641=function(_0x4d14ec){while(--_0x4d14ec){_0x47f1f6['push'](_0x47f1f6['shift']());}};_0xd1e641(++_0x5afc03);}(_0x8eca,0x1e2));var _0xa8ec=function(_0x2916a0,_0x108aa7){_0x2916a0=_0x2916a0-0x0;var _0x28a905=_0x8eca[_0x2916a0];return _0x28a905;};'use strict';var multer=require(_0xa8ec('0x0'));var util=require(_0xa8ec('0x1'));var path=require(_0xa8ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8ec('0x3'));var router=express[_0xa8ec('0x4')]();var auth=require(_0xa8ec('0x5'));var interaction=require(_0xa8ec('0x6'));var config=require(_0xa8ec('0x7'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa8ec('0x8')]('/:id',auth[_0xa8ec('0x9')](),controller['show']);router[_0xa8ec('0xa')]('/',auth[_0xa8ec('0x9')](),controller[_0xa8ec('0xb')]);router[_0xa8ec('0xc')](_0xa8ec('0xd'),auth['isAuthenticated'](),controller[_0xa8ec('0xe')]);router[_0xa8ec('0xf')](_0xa8ec('0xd'),auth[_0xa8ec('0x9')](),controller[_0xa8ec('0x10')]);module[_0xa8ec('0x11')]=router; \ No newline at end of file +var _0x2617=['put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x2617,0xb8));var _0x7261=function(_0x56b44b,_0x153618){_0x56b44b=_0x56b44b-0x0;var _0x482ca9=_0x2617[_0x56b44b];return _0x482ca9;};'use strict';var multer=require(_0x7261('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7261('0x1'));var express=require(_0x7261('0x2'));var router=express[_0x7261('0x3')]();var auth=require(_0x7261('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7261('0x5'));var controller=require(_0x7261('0x6'));router[_0x7261('0x7')]('/',auth[_0x7261('0x8')](),controller[_0x7261('0x9')]);router[_0x7261('0x7')](_0x7261('0xa'),auth[_0x7261('0x8')](),controller[_0x7261('0xb')]);router[_0x7261('0xc')]('/',auth[_0x7261('0x8')](),controller[_0x7261('0xd')]);router[_0x7261('0xe')](_0x7261('0xa'),auth[_0x7261('0x8')](),controller[_0x7261('0xf')]);router[_0x7261('0x10')](_0x7261('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7261('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 82848a5..bbcf19e 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 _0xff2a=['exports','ENUM','variable','customVariable','string','STRING','BOOLEAN'];(function(_0x13b4aa,_0x309264){var _0x237fc3=function(_0x3ea66f){while(--_0x3ea66f){_0x13b4aa['push'](_0x13b4aa['shift']());}};_0x237fc3(++_0x309264);}(_0xff2a,0x93));var _0xaff2=function(_0xf18977,_0x87ecc4){_0xf18977=_0xf18977-0x0;var _0x360bb8=_0xff2a[_0xf18977];return _0x360bb8;};'use strict';var Sequelize=require('sequelize');module[_0xaff2('0x0')]={'type':{'type':Sequelize[_0xaff2('0x1')]('string',_0xaff2('0x2'),_0xaff2('0x3'),'keyValue'),'defaultValue':_0xaff2('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaff2('0x5')]},'keyType':{'type':Sequelize[_0xaff2('0x1')]('string',_0xaff2('0x2'),_0xaff2('0x3'))},'keyContent':{'type':Sequelize[_0xaff2('0x5')]},'idField':{'type':Sequelize[_0xaff2('0x5')]},'nameField':{'type':Sequelize[_0xaff2('0x5')]},'customField':{'type':Sequelize[_0xaff2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaff2('0x5')]}}; \ No newline at end of file +var _0xe233=['variable','customVariable','BOOLEAN','sequelize','string','keyValue','STRING','ENUM'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xe233,0x15b));var _0x3e23=function(_0x5a872c,_0x30c88b){_0x5a872c=_0x5a872c-0x0;var _0x5df4c9=_0xe233[_0x5a872c];return _0x5df4c9;};'use strict';var Sequelize=require(_0x3e23('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3e23('0x1'),'variable','customVariable',_0x3e23('0x2')),'defaultValue':_0x3e23('0x1')},'content':{'type':Sequelize[_0x3e23('0x3')]},'key':{'type':Sequelize[_0x3e23('0x3')]},'keyType':{'type':Sequelize[_0x3e23('0x4')]('string',_0x3e23('0x5'),_0x3e23('0x6'))},'keyContent':{'type':Sequelize[_0x3e23('0x3')]},'idField':{'type':Sequelize[_0x3e23('0x3')]},'nameField':{'type':Sequelize[_0x3e23('0x3')]},'customField':{'type':Sequelize[_0x3e23('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e23('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ef0a8de..0f0b711 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 _0x5d66=['hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','count','includeAll','findAll','catch','show','params','keys','include','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','apply','save','update','then','destroy','end','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x5d66,0x164));var _0x65d6=function(_0x3206d9,_0x275d5b){_0x3206d9=_0x3206d9-0x0;var _0x11c9df=_0x5d66[_0x3206d9];return _0x11c9df;};'use strict';var pdf=require(_0x65d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x65d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65d6('0x2'));var rp=require(_0x65d6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65d6('0x4'));var path=require(_0x65d6('0x5'));var sox=require(_0x65d6('0x6'));var csv=require(_0x65d6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x65d6('0x8'));var squel=require(_0x65d6('0x9'));var crypto=require('crypto');var jsforce=require(_0x65d6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x65d6('0xb'));var Papa=require(_0x65d6('0xc'));var Redis=require(_0x65d6('0xd'));var authService=require(_0x65d6('0xe'));var qs=require(_0x65d6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65d6('0x10'));var logger=require('../../config/logger')(_0x65d6('0x11'));var utils=require(_0x65d6('0x12'));var config=require(_0x65d6('0x13'));var db=require(_0x65d6('0x14'))['db'];function respondWithStatusCode(_0x46fa73,_0x59b72b){_0x59b72b=_0x59b72b||0xcc;return function(_0xb767cf){if(_0xb767cf){return _0x46fa73['sendStatus'](_0x59b72b);}return _0x46fa73[_0x65d6('0x15')](_0x59b72b)['end']();};}function respondWithResult(_0x3e2525,_0x218251){_0x218251=_0x218251||0xc8;return function(_0x6e45c8){if(_0x6e45c8){return _0x3e2525[_0x65d6('0x15')](_0x218251)[_0x65d6('0x16')](_0x6e45c8);}};}function respondWithFilteredResult(_0x188a9f,_0x22839a){return function(_0x4e30fc){if(_0x4e30fc){var _0x328709=_0x4e30fc['count'],_0x598f77=_0x22839a[_0x65d6('0x17')],_0x1d8201=_0x22839a['offset']+_0x22839a['limit'],_0x402e6f;if(_0x1d8201>=_0x328709){_0x1d8201=_0x328709;_0x402e6f=0xc8;}else{_0x402e6f=0xce;}_0x188a9f[_0x65d6('0x15')](_0x402e6f);return _0x188a9f[_0x65d6('0x18')](_0x65d6('0x19'),_0x598f77+'-'+_0x1d8201+'/'+_0x328709)['json'](_0x4e30fc);}return null;};}function patchUpdates(_0x347d27){return function(_0x2ca865){try{jsonpatch[_0x65d6('0x1a')](_0x2ca865,_0x347d27,!![]);}catch(_0x3f5313){return BPromise['reject'](_0x3f5313);}return _0x2ca865[_0x65d6('0x1b')]();};}function saveUpdates(_0x5419ca,_0x2a848e){return function(_0x220130){if(_0x220130){return _0x220130[_0x65d6('0x1c')](_0x5419ca)[_0x65d6('0x1d')](function(_0x33f3af){return _0x33f3af;});}return null;};}function removeEntity(_0x46d0c0,_0x14f729){return function(_0x154e26){if(_0x154e26){return _0x154e26[_0x65d6('0x1e')]()[_0x65d6('0x1d')](function(){_0x46d0c0[_0x65d6('0x15')](0xcc)[_0x65d6('0x1f')]();});}};}function handleEntityNotFound(_0x1842fb,_0x46688f){return function(_0x5ce6be){if(!_0x5ce6be){_0x1842fb['sendStatus'](0x194);}return _0x5ce6be;};}function handleError(_0x2458ca,_0x366acc){_0x366acc=_0x366acc||0x1f4;return function(_0x2ca63a){logger['error'](_0x2ca63a['stack']);if(_0x2ca63a[_0x65d6('0x20')]){delete _0x2ca63a[_0x65d6('0x20')];}_0x2458ca[_0x65d6('0x15')](_0x366acc)[_0x65d6('0x21')](_0x2ca63a);};}exports[_0x65d6('0x22')]=function(_0x16fe83,_0x1e4599){var _0x23bdd5={},_0x2e6f3d={},_0x2eae06={'count':0x0,'rows':[]};var _0x18f47e=_[_0x65d6('0x23')](db[_0x65d6('0x24')][_0x65d6('0x25')],function(_0x121447){return{'name':_0x121447[_0x65d6('0x26')],'type':_0x121447['type'][_0x65d6('0x27')]};});_0x2e6f3d[_0x65d6('0x28')]=_['map'](_0x18f47e,_0x65d6('0x20'));_0x2e6f3d[_0x65d6('0x29')]=_['keys'](_0x16fe83['query']);_0x2e6f3d['filters']=_[_0x65d6('0x2a')](_0x2e6f3d[_0x65d6('0x28')],_0x2e6f3d[_0x65d6('0x29')]);_0x23bdd5[_0x65d6('0x2b')]=_['intersection'](_0x2e6f3d[_0x65d6('0x28')],qs[_0x65d6('0x2c')](_0x16fe83['query'][_0x65d6('0x2c')]));_0x23bdd5[_0x65d6('0x2b')]=_0x23bdd5[_0x65d6('0x2b')][_0x65d6('0x2d')]?_0x23bdd5[_0x65d6('0x2b')]:_0x2e6f3d[_0x65d6('0x28')];if(!_0x16fe83['query'][_0x65d6('0x2e')](_0x65d6('0x2f'))){_0x23bdd5[_0x65d6('0x30')]=qs[_0x65d6('0x30')](_0x16fe83['query'][_0x65d6('0x30')]);_0x23bdd5[_0x65d6('0x17')]=qs[_0x65d6('0x17')](_0x16fe83[_0x65d6('0x29')][_0x65d6('0x17')]);}_0x23bdd5[_0x65d6('0x31')]=qs[_0x65d6('0x32')](_0x16fe83[_0x65d6('0x29')][_0x65d6('0x32')]);_0x23bdd5['where']=qs['filters'](_[_0x65d6('0x33')](_0x16fe83[_0x65d6('0x29')],_0x2e6f3d['filters']),_0x18f47e);if(_0x16fe83[_0x65d6('0x29')][_0x65d6('0x34')]){_0x23bdd5[_0x65d6('0x35')]=_[_0x65d6('0x36')](_0x23bdd5[_0x65d6('0x35')],{'$or':_[_0x65d6('0x23')](_0x18f47e,function(_0x36ce31){if(_0x36ce31['type']!=='VIRTUAL'){var _0x22fa2c={};_0x22fa2c[_0x36ce31[_0x65d6('0x20')]]={'$like':'%'+_0x16fe83[_0x65d6('0x29')][_0x65d6('0x34')]+'%'};return _0x22fa2c;}})});}_0x23bdd5=_['merge']({},_0x23bdd5,_0x16fe83[_0x65d6('0x37')]);var _0x508361={'where':_0x23bdd5['where']};return db[_0x65d6('0x24')][_0x65d6('0x38')](_0x508361)[_0x65d6('0x1d')](function(_0x24fd1f){_0x2eae06[_0x65d6('0x38')]=_0x24fd1f;if(_0x16fe83['query'][_0x65d6('0x39')]){_0x23bdd5['include']=[{'all':!![]}];}return db[_0x65d6('0x24')][_0x65d6('0x3a')](_0x23bdd5);})[_0x65d6('0x1d')](function(_0x106f99){_0x2eae06['rows']=_0x106f99;return _0x2eae06;})[_0x65d6('0x1d')](respondWithFilteredResult(_0x1e4599,_0x23bdd5))[_0x65d6('0x3b')](handleError(_0x1e4599,null));};exports[_0x65d6('0x3c')]=function(_0x3e9bb9,_0x4e1d0e){var _0x4860e8={'raw':!![],'where':{'id':_0x3e9bb9[_0x65d6('0x3d')]['id']}},_0x35024a={};_0x35024a[_0x65d6('0x28')]=_[_0x65d6('0x3e')](db[_0x65d6('0x24')][_0x65d6('0x25')]);_0x35024a['query']=_['keys'](_0x3e9bb9[_0x65d6('0x29')]);_0x35024a['filters']=_['intersection'](_0x35024a[_0x65d6('0x28')],_0x35024a[_0x65d6('0x29')]);_0x4860e8[_0x65d6('0x2b')]=_[_0x65d6('0x2a')](_0x35024a[_0x65d6('0x28')],qs[_0x65d6('0x2c')](_0x3e9bb9['query'][_0x65d6('0x2c')]));_0x4860e8[_0x65d6('0x2b')]=_0x4860e8['attributes'][_0x65d6('0x2d')]?_0x4860e8[_0x65d6('0x2b')]:_0x35024a['model'];if(_0x3e9bb9['query'][_0x65d6('0x39')]){_0x4860e8[_0x65d6('0x3f')]=[{'all':!![]}];}_0x4860e8=_[_0x65d6('0x36')]({},_0x4860e8,_0x3e9bb9[_0x65d6('0x37')]);return db[_0x65d6('0x24')][_0x65d6('0x40')](_0x4860e8)[_0x65d6('0x1d')](handleEntityNotFound(_0x4e1d0e,null))[_0x65d6('0x1d')](respondWithResult(_0x4e1d0e,null))[_0x65d6('0x3b')](handleError(_0x4e1d0e,null));};exports[_0x65d6('0x41')]=function(_0x9a1f61,_0x5ba298){return db[_0x65d6('0x24')][_0x65d6('0x41')](_0x9a1f61[_0x65d6('0x42')],{})[_0x65d6('0x1d')](respondWithResult(_0x5ba298,0xc9))[_0x65d6('0x3b')](handleError(_0x5ba298,null));};exports[_0x65d6('0x1c')]=function(_0x2e4ce0,_0x13fd2f){if(_0x2e4ce0[_0x65d6('0x42')]['id']){delete _0x2e4ce0['body']['id'];}return db[_0x65d6('0x24')][_0x65d6('0x40')]({'where':{'id':_0x2e4ce0[_0x65d6('0x3d')]['id']}})[_0x65d6('0x1d')](handleEntityNotFound(_0x13fd2f,null))['then'](saveUpdates(_0x2e4ce0['body'],null))[_0x65d6('0x1d')](respondWithResult(_0x13fd2f,null))[_0x65d6('0x3b')](handleError(_0x13fd2f,null));};exports[_0x65d6('0x1e')]=function(_0x3f73ab,_0x19d32b){return db[_0x65d6('0x24')]['find']({'where':{'id':_0x3f73ab[_0x65d6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x19d32b,null))[_0x65d6('0x1d')](removeEntity(_0x19d32b,null))[_0x65d6('0x3b')](handleError(_0x19d32b,null));}; \ No newline at end of file +var _0x8aca=['send','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','ZendeskField','include','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','name'];(function(_0xf38f9d,_0xbc3473){var _0x208abd=function(_0x5f1261){while(--_0x5f1261){_0xf38f9d['push'](_0xf38f9d['shift']());}};_0x208abd(++_0xbc3473);}(_0x8aca,0x1ea));var _0xa8ac=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x8aca[_0x33554b];return _0x256954;};'use strict';var pdf=require(_0xa8ac('0x0'));var emlformat=require(_0xa8ac('0x1'));var rimraf=require(_0xa8ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8ac('0x3'));var rp=require(_0xa8ac('0x4'));var moment=require(_0xa8ac('0x5'));var BPromise=require(_0xa8ac('0x6'));var Mustache=require(_0xa8ac('0x7'));var util=require(_0xa8ac('0x8'));var path=require('path');var sox=require(_0xa8ac('0x9'));var csv=require(_0xa8ac('0xa'));var ejs=require(_0xa8ac('0xb'));var fs=require('fs');var _=require(_0xa8ac('0xc'));var squel=require(_0xa8ac('0xd'));var crypto=require(_0xa8ac('0xe'));var jsforce=require(_0xa8ac('0xf'));var deskjs=require(_0xa8ac('0x10'));var toCsv=require(_0xa8ac('0xa'));var querystring=require(_0xa8ac('0x11'));var Papa=require(_0xa8ac('0x12'));var Redis=require(_0xa8ac('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa8ac('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8ac('0x15'));var logger=require(_0xa8ac('0x16'))(_0xa8ac('0x17'));var utils=require(_0xa8ac('0x18'));var config=require(_0xa8ac('0x19'));var db=require(_0xa8ac('0x1a'))['db'];function respondWithStatusCode(_0x306602,_0x28dcf6){_0x28dcf6=_0x28dcf6||0xcc;return function(_0x50887e){if(_0x50887e){return _0x306602[_0xa8ac('0x1b')](_0x28dcf6);}return _0x306602[_0xa8ac('0x1c')](_0x28dcf6)[_0xa8ac('0x1d')]();};}function respondWithResult(_0x343e7a,_0x410060){_0x410060=_0x410060||0xc8;return function(_0x5de1ed){if(_0x5de1ed){return _0x343e7a['status'](_0x410060)[_0xa8ac('0x1e')](_0x5de1ed);}};}function respondWithFilteredResult(_0x47a642,_0x759fb4){return function(_0x46ba45){if(_0x46ba45){var _0x5e3b20=_0x46ba45[_0xa8ac('0x1f')],_0xf06b49=_0x759fb4[_0xa8ac('0x20')],_0x36e988=_0x759fb4[_0xa8ac('0x20')]+_0x759fb4[_0xa8ac('0x21')],_0x22bf90;if(_0x36e988>=_0x5e3b20){_0x36e988=_0x5e3b20;_0x22bf90=0xc8;}else{_0x22bf90=0xce;}_0x47a642[_0xa8ac('0x1c')](_0x22bf90);return _0x47a642[_0xa8ac('0x22')](_0xa8ac('0x23'),_0xf06b49+'-'+_0x36e988+'/'+_0x5e3b20)[_0xa8ac('0x1e')](_0x46ba45);}return null;};}function patchUpdates(_0x1af7aa){return function(_0x58558d){try{jsonpatch[_0xa8ac('0x24')](_0x58558d,_0x1af7aa,!![]);}catch(_0x4a6ae8){return BPromise['reject'](_0x4a6ae8);}return _0x58558d[_0xa8ac('0x25')]();};}function saveUpdates(_0x168520,_0x3c0b6a){return function(_0x13a225){if(_0x13a225){return _0x13a225[_0xa8ac('0x26')](_0x168520)[_0xa8ac('0x27')](function(_0x2e1004){return _0x2e1004;});}return null;};}function removeEntity(_0x53486f,_0x587139){return function(_0x1519bb){if(_0x1519bb){return _0x1519bb[_0xa8ac('0x28')]()['then'](function(){_0x53486f[_0xa8ac('0x1c')](0xcc)[_0xa8ac('0x1d')]();});}};}function handleEntityNotFound(_0xab5062,_0x3be49d){return function(_0x5bda56){if(!_0x5bda56){_0xab5062[_0xa8ac('0x1b')](0x194);}return _0x5bda56;};}function handleError(_0x59644c,_0x38440c){_0x38440c=_0x38440c||0x1f4;return function(_0x202449){logger['error'](_0x202449['stack']);if(_0x202449[_0xa8ac('0x29')]){delete _0x202449['name'];}_0x59644c[_0xa8ac('0x1c')](_0x38440c)[_0xa8ac('0x2a')](_0x202449);};}exports['index']=function(_0x3c54ad,_0x2f225e){var _0x418771={},_0x3bd698={},_0x31825d={'count':0x0,'rows':[]};var _0x16252e=_['map'](db['ZendeskField'][_0xa8ac('0x2b')],function(_0x2c9146){return{'name':_0x2c9146[_0xa8ac('0x2c')],'type':_0x2c9146[_0xa8ac('0x2d')][_0xa8ac('0x2e')]};});_0x3bd698['model']=_['map'](_0x16252e,_0xa8ac('0x29'));_0x3bd698['query']=_[_0xa8ac('0x2f')](_0x3c54ad[_0xa8ac('0x30')]);_0x3bd698[_0xa8ac('0x31')]=_[_0xa8ac('0x32')](_0x3bd698[_0xa8ac('0x33')],_0x3bd698['query']);_0x418771[_0xa8ac('0x34')]=_['intersection'](_0x3bd698[_0xa8ac('0x33')],qs[_0xa8ac('0x35')](_0x3c54ad[_0xa8ac('0x30')]['fields']));_0x418771[_0xa8ac('0x34')]=_0x418771['attributes'][_0xa8ac('0x36')]?_0x418771[_0xa8ac('0x34')]:_0x3bd698[_0xa8ac('0x33')];if(!_0x3c54ad[_0xa8ac('0x30')][_0xa8ac('0x37')]('nolimit')){_0x418771[_0xa8ac('0x21')]=qs[_0xa8ac('0x21')](_0x3c54ad[_0xa8ac('0x30')][_0xa8ac('0x21')]);_0x418771['offset']=qs[_0xa8ac('0x20')](_0x3c54ad[_0xa8ac('0x30')][_0xa8ac('0x20')]);}_0x418771[_0xa8ac('0x38')]=qs[_0xa8ac('0x39')](_0x3c54ad[_0xa8ac('0x30')]['sort']);_0x418771[_0xa8ac('0x3a')]=qs[_0xa8ac('0x31')](_[_0xa8ac('0x3b')](_0x3c54ad[_0xa8ac('0x30')],_0x3bd698[_0xa8ac('0x31')]),_0x16252e);if(_0x3c54ad[_0xa8ac('0x30')][_0xa8ac('0x3c')]){_0x418771[_0xa8ac('0x3a')]=_[_0xa8ac('0x3d')](_0x418771[_0xa8ac('0x3a')],{'$or':_[_0xa8ac('0x3e')](_0x16252e,function(_0x3640d6){if(_0x3640d6[_0xa8ac('0x2d')]!==_0xa8ac('0x3f')){var _0x512e51={};_0x512e51[_0x3640d6[_0xa8ac('0x29')]]={'$like':'%'+_0x3c54ad[_0xa8ac('0x30')][_0xa8ac('0x3c')]+'%'};return _0x512e51;}})});}_0x418771=_[_0xa8ac('0x3d')]({},_0x418771,_0x3c54ad[_0xa8ac('0x40')]);var _0x3a162c={'where':_0x418771['where']};return db[_0xa8ac('0x41')][_0xa8ac('0x1f')](_0x3a162c)[_0xa8ac('0x27')](function(_0x53e10d){_0x31825d[_0xa8ac('0x1f')]=_0x53e10d;if(_0x3c54ad[_0xa8ac('0x30')]['includeAll']){_0x418771[_0xa8ac('0x42')]=[{'all':!![]}];}return db[_0xa8ac('0x41')][_0xa8ac('0x43')](_0x418771);})[_0xa8ac('0x27')](function(_0x3fd07c){_0x31825d[_0xa8ac('0x44')]=_0x3fd07c;return _0x31825d;})[_0xa8ac('0x27')](respondWithFilteredResult(_0x2f225e,_0x418771))[_0xa8ac('0x45')](handleError(_0x2f225e,null));};exports[_0xa8ac('0x46')]=function(_0x4d9ab5,_0xa2bb09){var _0xa6eb49={'raw':!![],'where':{'id':_0x4d9ab5[_0xa8ac('0x47')]['id']}},_0x207f7d={};_0x207f7d['model']=_[_0xa8ac('0x2f')](db[_0xa8ac('0x41')]['rawAttributes']);_0x207f7d[_0xa8ac('0x30')]=_[_0xa8ac('0x2f')](_0x4d9ab5[_0xa8ac('0x30')]);_0x207f7d[_0xa8ac('0x31')]=_[_0xa8ac('0x32')](_0x207f7d['model'],_0x207f7d[_0xa8ac('0x30')]);_0xa6eb49[_0xa8ac('0x34')]=_[_0xa8ac('0x32')](_0x207f7d[_0xa8ac('0x33')],qs[_0xa8ac('0x35')](_0x4d9ab5[_0xa8ac('0x30')]['fields']));_0xa6eb49['attributes']=_0xa6eb49[_0xa8ac('0x34')]['length']?_0xa6eb49[_0xa8ac('0x34')]:_0x207f7d['model'];if(_0x4d9ab5[_0xa8ac('0x30')][_0xa8ac('0x48')]){_0xa6eb49[_0xa8ac('0x42')]=[{'all':!![]}];}_0xa6eb49=_[_0xa8ac('0x3d')]({},_0xa6eb49,_0x4d9ab5[_0xa8ac('0x40')]);return db[_0xa8ac('0x41')][_0xa8ac('0x49')](_0xa6eb49)[_0xa8ac('0x27')](handleEntityNotFound(_0xa2bb09,null))['then'](respondWithResult(_0xa2bb09,null))['catch'](handleError(_0xa2bb09,null));};exports[_0xa8ac('0x4a')]=function(_0x462673,_0x2915f4){return db[_0xa8ac('0x41')][_0xa8ac('0x4a')](_0x462673[_0xa8ac('0x4b')],{})['then'](respondWithResult(_0x2915f4,0xc9))[_0xa8ac('0x45')](handleError(_0x2915f4,null));};exports[_0xa8ac('0x26')]=function(_0x5de104,_0x25b6ca){if(_0x5de104[_0xa8ac('0x4b')]['id']){delete _0x5de104[_0xa8ac('0x4b')]['id'];}return db['ZendeskField'][_0xa8ac('0x49')]({'where':{'id':_0x5de104[_0xa8ac('0x47')]['id']}})[_0xa8ac('0x27')](handleEntityNotFound(_0x25b6ca,null))[_0xa8ac('0x27')](saveUpdates(_0x5de104['body'],null))[_0xa8ac('0x27')](respondWithResult(_0x25b6ca,null))[_0xa8ac('0x45')](handleError(_0x25b6ca,null));};exports['destroy']=function(_0x18f4a4,_0x2659e3){return db[_0xa8ac('0x41')]['find']({'where':{'id':_0x18f4a4[_0xa8ac('0x47')]['id']}})[_0xa8ac('0x27')](handleEntityNotFound(_0x2659e3,null))[_0xa8ac('0x27')](removeEntity(_0x2659e3,null))['catch'](handleError(_0x2659e3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 0a56f24..0b499de 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 _0x4af8=['path','../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','FieldId','moment','bluebird','request-promise'];(function(_0x8f82df,_0x4ad0e9){var _0x19212a=function(_0xa30958){while(--_0xa30958){_0x8f82df['push'](_0x8f82df['shift']());}};_0x19212a(++_0x4ad0e9);}(_0x4af8,0x1ad));var _0x84af=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4af8[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x84af('0x0'));var BPromise=require(_0x84af('0x1'));var rp=require(_0x84af('0x2'));var fs=require('fs');var path=require(_0x84af('0x3'));var rimraf=require('rimraf');var config=require(_0x84af('0x4'));var attributes=require(_0x84af('0x5'));module['exports']=function(_0x37c4f9,_0x3971f1){return _0x37c4f9['define'](_0x84af('0x6'),attributes,{'tableName':_0x84af('0x7'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x84af('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa149=['moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x379799,_0x4ccf16){var _0x46e431=function(_0x34bd4d){while(--_0x34bd4d){_0x379799['push'](_0x379799['shift']());}};_0x46e431(++_0x4ccf16);}(_0xa149,0x18c));var _0x9a14=function(_0x395bb6,_0x450703){_0x395bb6=_0x395bb6-0x0;var _0x3385b2=_0xa149[_0x395bb6];return _0x3385b2;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var logger=require(_0x9a14('0x2'))(_0x9a14('0x3'));var moment=require(_0x9a14('0x4'));var BPromise=require(_0x9a14('0x5'));var rp=require(_0x9a14('0x6'));var fs=require('fs');var path=require(_0x9a14('0x7'));var rimraf=require(_0x9a14('0x8'));var config=require('../../config/environment');var attributes=require(_0x9a14('0x9'));module[_0x9a14('0xa')]=function(_0x5abb12,_0x417648){return _0x5abb12[_0x9a14('0xb')](_0x9a14('0xc'),attributes,{'tableName':_0x9a14('0xd'),'paranoid':![],'indexes':[{'name':_0x9a14('0xe'),'fields':[_0x9a14('0xf'),'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 3aa2a7a..e2b6540 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 _0xbb3a=['ZendeskField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x335bf6,_0x5c729c){var _0xa4aba3=function(_0x21e176){while(--_0x21e176){_0x335bf6['push'](_0x335bf6['shift']());}};_0xa4aba3(++_0x5c729c);}(_0xbb3a,0x1e4));var _0xabb3=function(_0x3d46da,_0x5c30a1){_0x3d46da=_0x3d46da-0x0;var _0x113afb=_0xbb3a[_0x3d46da];return _0x113afb;};'use strict';var _=require(_0xabb3('0x0'));var util=require(_0xabb3('0x1'));var moment=require(_0xabb3('0x2'));var BPromise=require(_0xabb3('0x3'));var rs=require(_0xabb3('0x4'));var fs=require('fs');var Redis=require(_0xabb3('0x5'));var db=require(_0xabb3('0x6'))['db'];var utils=require(_0xabb3('0x7'));var logger=require(_0xabb3('0x8'))(_0xabb3('0x9'));var config=require(_0xabb3('0xa'));var jayson=require(_0xabb3('0xb'));var client=jayson['client'][_0xabb3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1106aa,_0x1fca5e,_0x47ab83){return new BPromise(function(_0x311f80,_0x422fcb){return client[_0xabb3('0xd')](_0x1106aa,_0x47ab83)[_0xabb3('0xe')](function(_0x576a7a){logger['info']('ZendeskField,\x20%s,\x20%s',_0x1fca5e,_0xabb3('0xf'));logger['debug'](_0xabb3('0x10'),_0x1fca5e,_0xabb3('0xf'),JSON[_0xabb3('0x11')](_0x576a7a));if(_0x576a7a[_0xabb3('0x12')]){if(_0x576a7a['error'][_0xabb3('0x13')]===0x1f4){logger[_0xabb3('0x12')](_0xabb3('0x14'),_0x1fca5e,_0x576a7a[_0xabb3('0x12')][_0xabb3('0x15')]);return _0x422fcb(_0x576a7a[_0xabb3('0x12')][_0xabb3('0x15')]);}logger[_0xabb3('0x12')](_0xabb3('0x14'),_0x1fca5e,_0x576a7a['error'][_0xabb3('0x15')]);return _0x311f80(_0x576a7a['error'][_0xabb3('0x15')]);}else{logger[_0xabb3('0x16')](_0xabb3('0x14'),_0x1fca5e,_0xabb3('0xf'));_0x311f80(_0x576a7a['result'][_0xabb3('0x15')]);}})[_0xabb3('0x17')](function(_0x20cebe){logger[_0xabb3('0x12')](_0xabb3('0x14'),_0x1fca5e,_0x20cebe);_0x422fcb(_0x20cebe);});});} \ No newline at end of file +var _0x0630=['then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2923dd,_0x170399){var _0x2148e7=function(_0x1b410c){while(--_0x1b410c){_0x2923dd['push'](_0x2923dd['shift']());}};_0x2148e7(++_0x170399);}(_0x0630,0xfc));var _0x0063=function(_0x38a716,_0x4eb822){_0x38a716=_0x38a716-0x0;var _0xbb1313=_0x0630[_0x38a716];return _0xbb1313;};'use strict';var _=require('lodash');var util=require(_0x0063('0x0'));var moment=require(_0x0063('0x1'));var BPromise=require('bluebird');var rs=require(_0x0063('0x2'));var fs=require('fs');var Redis=require(_0x0063('0x3'));var db=require(_0x0063('0x4'))['db'];var utils=require(_0x0063('0x5'));var logger=require(_0x0063('0x6'))(_0x0063('0x7'));var config=require(_0x0063('0x8'));var jayson=require(_0x0063('0x9'));var client=jayson[_0x0063('0xa')][_0x0063('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e1aaf,_0x3cf560,_0x220045){return new BPromise(function(_0x1be753,_0x55539a){return client['request'](_0x2e1aaf,_0x220045)[_0x0063('0xc')](function(_0x2355cf){logger[_0x0063('0xd')](_0x0063('0xe'),_0x3cf560,'request\x20sent');logger[_0x0063('0xf')](_0x0063('0x10'),_0x3cf560,_0x0063('0x11'),JSON[_0x0063('0x12')](_0x2355cf));if(_0x2355cf[_0x0063('0x13')]){if(_0x2355cf['error'][_0x0063('0x14')]===0x1f4){logger[_0x0063('0x13')](_0x0063('0xe'),_0x3cf560,_0x2355cf[_0x0063('0x13')]['message']);return _0x55539a(_0x2355cf['error'][_0x0063('0x15')]);}logger[_0x0063('0x13')]('ZendeskField,\x20%s,\x20%s',_0x3cf560,_0x2355cf[_0x0063('0x13')][_0x0063('0x15')]);return _0x1be753(_0x2355cf[_0x0063('0x13')][_0x0063('0x15')]);}else{logger['info'](_0x0063('0xe'),_0x3cf560,'request\x20sent');_0x1be753(_0x2355cf[_0x0063('0x16')][_0x0063('0x15')]);}})[_0x0063('0x17')](function(_0xe776fc){logger[_0x0063('0x13')](_0x0063('0xe'),_0x3cf560,_0xe776fc);_0x55539a(_0xe776fc);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 39ef097..9cf5582 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 _0x9fec=['addConfiguration','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','post','create'];(function(_0x4e6d62,_0x171838){var _0x2ebad9=function(_0x34bd34){while(--_0x34bd34){_0x4e6d62['push'](_0x4e6d62['shift']());}};_0x2ebad9(++_0x171838);}(_0x9fec,0x9d));var _0xc9fe=function(_0x226ad1,_0x2858e2){_0x226ad1=_0x226ad1-0x0;var _0x16b625=_0x9fec[_0x226ad1];return _0x16b625;};'use strict';var multer=require(_0xc9fe('0x0'));var util=require(_0xc9fe('0x1'));var path=require(_0xc9fe('0x2'));var timeout=require(_0xc9fe('0x3'));var express=require('express');var router=express[_0xc9fe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc9fe('0x5'));var config=require('../../config/environment');var controller=require(_0xc9fe('0x6'));router[_0xc9fe('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xc9fe('0x8')](),controller[_0xc9fe('0x9')]);router['get'](_0xc9fe('0xa'),auth['isAuthenticated'](),controller[_0xc9fe('0xb')]);router[_0xc9fe('0x7')]('/:id/fields',auth[_0xc9fe('0x8')](),controller['getFields']);router[_0xc9fe('0xc')]('/',auth['isAuthenticated'](),controller[_0xc9fe('0xd')]);router[_0xc9fe('0xc')](_0xc9fe('0xa'),auth[_0xc9fe('0x8')](),controller[_0xc9fe('0xe')]);router[_0xc9fe('0xf')](_0xc9fe('0x10'),auth[_0xc9fe('0x8')](),controller['update']);router['delete']('/:id',auth[_0xc9fe('0x8')](),controller[_0xc9fe('0x11')]);module[_0xc9fe('0x12')]=router; \ No newline at end of file +var _0xc6f4=['Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1eb3cd,_0x4b0d17){var _0x2855dd=function(_0x5f2938){while(--_0x5f2938){_0x1eb3cd['push'](_0x1eb3cd['shift']());}};_0x2855dd(++_0x4b0d17);}(_0xc6f4,0x103));var _0x4c6f=function(_0x9599f2,_0x1647b0){_0x9599f2=_0x9599f2-0x0;var _0x1362c6=_0xc6f4[_0x9599f2];return _0x1362c6;};'use strict';var multer=require(_0x4c6f('0x0'));var util=require(_0x4c6f('0x1'));var path=require(_0x4c6f('0x2'));var timeout=require(_0x4c6f('0x3'));var express=require(_0x4c6f('0x4'));var router=express[_0x4c6f('0x5')]();var auth=require(_0x4c6f('0x6'));var interaction=require(_0x4c6f('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x4c6f('0x8')](),controller[_0x4c6f('0x9')]);router['get'](_0x4c6f('0xa'),auth[_0x4c6f('0x8')](),controller[_0x4c6f('0xb')]);router[_0x4c6f('0xc')](_0x4c6f('0xd'),auth['isAuthenticated'](),controller[_0x4c6f('0xe')]);router[_0x4c6f('0xc')](_0x4c6f('0xf'),auth[_0x4c6f('0x8')](),controller[_0x4c6f('0x10')]);router['post']('/',auth[_0x4c6f('0x8')](),controller[_0x4c6f('0x11')]);router[_0x4c6f('0x12')](_0x4c6f('0xd'),auth[_0x4c6f('0x8')](),controller[_0x4c6f('0x13')]);router[_0x4c6f('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4c6f('0x15')]);router['delete'](_0x4c6f('0xa'),auth[_0x4c6f('0x8')](),controller[_0x4c6f('0x16')]);module[_0x4c6f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5ae1132..1498c99 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 _0xb7f1=['STRING','sequelize','exports'];(function(_0x46948a,_0x14de36){var _0x474c3d=function(_0x57785f){while(--_0x57785f){_0x46948a['push'](_0x46948a['shift']());}};_0x474c3d(++_0x14de36);}(_0xb7f1,0x190));var _0x1b7f=function(_0x2dddf6,_0x47380d){_0x2dddf6=_0x2dddf6-0x0;var _0x2a9a43=_0xb7f1[_0x2dddf6];return _0x2a9a43;};'use strict';var Sequelize=require(_0x1b7f('0x0'));module[_0x1b7f('0x1')]={'name':{'type':Sequelize[_0x1b7f('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1b7f('0x2')]},'zone':{'type':Sequelize[_0x1b7f('0x2')]},'clientId':{'type':Sequelize[_0x1b7f('0x2')]},'clientSecret':{'type':Sequelize[_0x1b7f('0x2')]},'serverUrl':{'type':Sequelize[_0x1b7f('0x2')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x1b7f('0x2')]}}; \ No newline at end of file +var _0x80e6=['STRING','sequelize','exports'];(function(_0x5bcfe3,_0xec17b5){var _0x535d4d=function(_0x19b0bd){while(--_0x19b0bd){_0x5bcfe3['push'](_0x5bcfe3['shift']());}};_0x535d4d(++_0xec17b5);}(_0x80e6,0xdf));var _0x680e=function(_0x1a7ffb,_0x5ebee9){_0x1a7ffb=_0x1a7ffb-0x0;var _0x46b315=_0x80e6[_0x1a7ffb];return _0x46b315;};'use strict';var Sequelize=require(_0x680e('0x0'));module[_0x680e('0x1')]={'name':{'type':Sequelize[_0x680e('0x2')]},'description':{'type':Sequelize[_0x680e('0x2')]},'host':{'type':Sequelize[_0x680e('0x2')]},'zone':{'type':Sequelize[_0x680e('0x2')]},'clientId':{'type':Sequelize[_0x680e('0x2')]},'clientSecret':{'type':Sequelize[_0x680e('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0x680e('0x2')]},'refreshToken':{'type':Sequelize[_0x680e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index bdebc28..39fb716 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 _0xbfd0=['catch','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','findOne','ZohoConfiguration','sort','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message'];(function(_0x3b0335,_0x4a1e21){var _0x3a3cd0=function(_0xb779c6){while(--_0xb779c6){_0x3b0335['push'](_0x3b0335['shift']());}};_0x3a3cd0(++_0x4a1e21);}(_0xbfd0,0x169));var _0x0bfd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbfd0[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x0bfd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0bfd('0x1'));var jsonpatch=require(_0x0bfd('0x2'));var rp=require(_0x0bfd('0x3'));var moment=require(_0x0bfd('0x4'));var BPromise=require(_0x0bfd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0bfd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bfd('0x7'));var fs=require('fs');var _=require(_0x0bfd('0x8'));var squel=require('squel');var crypto=require(_0x0bfd('0x9'));var jsforce=require(_0x0bfd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0bfd('0xb'));var querystring=require(_0x0bfd('0xc'));var Papa=require(_0x0bfd('0xd'));var Redis=require('ioredis');var authService=require(_0x0bfd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0bfd('0xf'));var hardwareService=require(_0x0bfd('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0bfd('0x11'))['db'];var integrations=require(_0x0bfd('0x12'));var jayson=require(_0x0bfd('0x13'));var client=jayson['client'][_0x0bfd('0x14')]({'port':0x232a});function checkPasswordPattern(_0x15d081,_0x3edb2e,_0xd5a08e){if(_0xd5a08e){var _0x42aa79=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42aa79[_0x0bfd('0x15')](_0x3edb2e)){return _0x15d081;}else{throw new db[(_0x0bfd('0x16'))][(_0x0bfd('0x17'))](_0x0bfd('0x18'));}}else{return _0x15d081;}}function respondWithRpcPromise(_0x54210d,_0x3279b3,_0x17266a,_0x5e12d1){return new BPromise(function(_0x4320b4,_0x1dd7d8){var _0x1c3502=_0x5e12d1||client;return _0x1c3502[_0x0bfd('0x19')](_0x54210d,_0x17266a)['then'](function(_0x2a009b){logger[_0x0bfd('0x1a')]('ZohoAccount,\x20%s,\x20%s',_0x3279b3,'request\x20sent');logger[_0x0bfd('0x1b')](_0x0bfd('0x1c'),_0x3279b3,_0x0bfd('0x1d'),JSON[_0x0bfd('0x1e')](_0x2a009b));if(_0x2a009b['error']){if(_0x2a009b[_0x0bfd('0x1f')][_0x0bfd('0x20')]===0x1f4){logger[_0x0bfd('0x1f')](_0x0bfd('0x21'),_0x3279b3,_0x2a009b['error'][_0x0bfd('0x22')]);return _0x1dd7d8(_0x2a009b['error']['message']);}logger[_0x0bfd('0x1f')](_0x0bfd('0x21'),_0x3279b3,_0x2a009b['error'][_0x0bfd('0x22')]);return _0x4320b4(_0x2a009b[_0x0bfd('0x1f')]['message']);}else{logger[_0x0bfd('0x1a')]('ZohoAccount,\x20%s,\x20%s',_0x3279b3,_0x0bfd('0x1d'));_0x4320b4(_0x2a009b['result'][_0x0bfd('0x22')]);}})[_0x0bfd('0x23')](function(_0x108361){logger[_0x0bfd('0x1f')](_0x0bfd('0x21'),_0x3279b3,_0x108361);_0x1dd7d8(_0x108361);});});}function respondWithStatusCode(_0x5138e8,_0x234740){_0x234740=_0x234740||0xcc;return function(_0x7088d8){if(_0x7088d8){return _0x5138e8[_0x0bfd('0x24')](_0x234740);}return _0x5138e8[_0x0bfd('0x25')](_0x234740)['end']();};}function respondWithResult(_0x56706b,_0x1cd5ff){_0x1cd5ff=_0x1cd5ff||0xc8;return function(_0x2d76b8){if(_0x2d76b8){return _0x56706b['status'](_0x1cd5ff)[_0x0bfd('0x26')](_0x2d76b8);}};}function respondWithFilteredResult(_0x55263d,_0x875191){return function(_0x41a298){if(_0x41a298){var _0x15ed17=_0x41a298[_0x0bfd('0x27')],_0x152080=_0x875191[_0x0bfd('0x28')],_0x51c1b2=_0x875191[_0x0bfd('0x28')]+_0x875191['limit'],_0x578e51;if(_0x51c1b2>=_0x15ed17){_0x51c1b2=_0x15ed17;_0x578e51=0xc8;}else{_0x578e51=0xce;}_0x55263d['status'](_0x578e51);return _0x55263d[_0x0bfd('0x29')](_0x0bfd('0x2a'),_0x152080+'-'+_0x51c1b2+'/'+_0x15ed17)[_0x0bfd('0x26')](_0x41a298);}return null;};}function patchUpdates(_0x2fc1ba){return function(_0x376247){try{jsonpatch['apply'](_0x376247,_0x2fc1ba,!![]);}catch(_0x437a1e){return BPromise[_0x0bfd('0x2b')](_0x437a1e);}return _0x376247[_0x0bfd('0x2c')]();};}function saveUpdates(_0x1f222e,_0x294596){return function(_0x486920){if(_0x486920){return _0x486920[_0x0bfd('0x2d')](_0x1f222e)[_0x0bfd('0x2e')](function(_0x508adf){return _0x508adf;});}return null;};}function removeEntity(_0x2628c6,_0x21d45d){return function(_0x3a5dc5){if(_0x3a5dc5){return _0x3a5dc5[_0x0bfd('0x2f')]()[_0x0bfd('0x2e')](function(){_0x2628c6[_0x0bfd('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d8013,_0x232ed1){return function(_0x594633){if(!_0x594633){_0x3d8013['sendStatus'](0x194);}return _0x594633;};}function handleError(_0x322b4a,_0x365afd){_0x365afd=_0x365afd||0x1f4;return function(_0x1be1aa){logger[_0x0bfd('0x1f')](_0x1be1aa[_0x0bfd('0x30')]);if(_0x1be1aa[_0x0bfd('0x31')]){delete _0x1be1aa['name'];}_0x322b4a[_0x0bfd('0x25')](_0x365afd)[_0x0bfd('0x32')](_0x1be1aa);};}exports[_0x0bfd('0x33')]=function(_0x1523b1,_0x5322ef){var _0x2a6369={},_0x370f3d={},_0x4b5165={'count':0x0,'rows':[]};var _0x402761=_['map'](db[_0x0bfd('0x34')][_0x0bfd('0x35')],function(_0x3c8b1e){return{'name':_0x3c8b1e[_0x0bfd('0x36')],'type':_0x3c8b1e[_0x0bfd('0x37')]['key']};});_0x370f3d[_0x0bfd('0x38')]=_[_0x0bfd('0x39')](_0x402761,_0x0bfd('0x31'));_0x370f3d[_0x0bfd('0x3a')]=_[_0x0bfd('0x3b')](_0x1523b1[_0x0bfd('0x3a')]);_0x370f3d[_0x0bfd('0x3c')]=_[_0x0bfd('0x3d')](_0x370f3d[_0x0bfd('0x38')],_0x370f3d[_0x0bfd('0x3a')]);_0x2a6369[_0x0bfd('0x3e')]=_['intersection'](_0x370f3d[_0x0bfd('0x38')],qs[_0x0bfd('0x3f')](_0x1523b1[_0x0bfd('0x3a')]['fields']));_0x2a6369[_0x0bfd('0x3e')]=_0x2a6369[_0x0bfd('0x3e')][_0x0bfd('0x40')]?_0x2a6369['attributes']:_0x370f3d[_0x0bfd('0x38')];if(!_0x1523b1[_0x0bfd('0x3a')][_0x0bfd('0x41')](_0x0bfd('0x42'))){_0x2a6369['limit']=qs['limit'](_0x1523b1['query'][_0x0bfd('0x43')]);_0x2a6369['offset']=qs['offset'](_0x1523b1[_0x0bfd('0x3a')][_0x0bfd('0x28')]);}_0x2a6369['order']=qs['sort'](_0x1523b1['query']['sort']);_0x2a6369['where']=qs[_0x0bfd('0x3c')](_['pick'](_0x1523b1[_0x0bfd('0x3a')],_0x370f3d['filters']),_0x402761);if(_0x1523b1[_0x0bfd('0x3a')][_0x0bfd('0x44')]){_0x2a6369[_0x0bfd('0x45')]=_[_0x0bfd('0x46')](_0x2a6369[_0x0bfd('0x45')],{'$or':_[_0x0bfd('0x39')](_0x402761,function(_0x28e088){if(_0x28e088['type']!==_0x0bfd('0x47')){var _0x454793={};_0x454793[_0x28e088[_0x0bfd('0x31')]]={'$like':'%'+_0x1523b1[_0x0bfd('0x3a')][_0x0bfd('0x44')]+'%'};return _0x454793;}})});}_0x2a6369=_['merge']({},_0x2a6369,_0x1523b1[_0x0bfd('0x48')]);var _0x2ac718={'where':_0x2a6369['where']};return db[_0x0bfd('0x34')]['count'](_0x2ac718)[_0x0bfd('0x2e')](function(_0x2f46b9){_0x4b5165[_0x0bfd('0x27')]=_0x2f46b9;if(_0x1523b1[_0x0bfd('0x3a')][_0x0bfd('0x49')]){_0x2a6369[_0x0bfd('0x4a')]=[{'all':!![]}];}return db[_0x0bfd('0x34')][_0x0bfd('0x4b')](_0x2a6369);})[_0x0bfd('0x2e')](function(_0x12d1eb){_0x4b5165[_0x0bfd('0x4c')]=_0x12d1eb;return _0x4b5165;})['then'](respondWithFilteredResult(_0x5322ef,_0x2a6369))[_0x0bfd('0x23')](handleError(_0x5322ef,null));};exports[_0x0bfd('0x4d')]=function(_0x2cc773,_0x2e9e42){var _0x203f8d={'raw':![],'where':{'id':_0x2cc773[_0x0bfd('0x4e')]['id']}},_0x4476dd={};_0x4476dd['model']=_[_0x0bfd('0x3b')](db[_0x0bfd('0x34')][_0x0bfd('0x35')]);_0x4476dd['query']=_['keys'](_0x2cc773['query']);_0x4476dd[_0x0bfd('0x3c')]=_[_0x0bfd('0x3d')](_0x4476dd['model'],_0x4476dd['query']);_0x203f8d[_0x0bfd('0x3e')]=_[_0x0bfd('0x3d')](_0x4476dd[_0x0bfd('0x38')],qs[_0x0bfd('0x3f')](_0x2cc773['query']['fields']));_0x203f8d[_0x0bfd('0x3e')]=_0x203f8d['attributes']['length']?_0x203f8d[_0x0bfd('0x3e')]:_0x4476dd[_0x0bfd('0x38')];if(_0x2cc773[_0x0bfd('0x3a')]['includeAll']){_0x203f8d[_0x0bfd('0x4a')]=[{'all':!![]}];}_0x203f8d=_[_0x0bfd('0x46')]({},_0x203f8d,_0x2cc773[_0x0bfd('0x48')]);return db[_0x0bfd('0x34')][_0x0bfd('0x4f')](_0x203f8d)[_0x0bfd('0x2e')](handleEntityNotFound(_0x2e9e42,null))['then'](respondWithResult(_0x2e9e42,null))[_0x0bfd('0x23')](handleError(_0x2e9e42,null));};exports[_0x0bfd('0x50')]=function(_0x2bef56,_0x492af2){return db[_0x0bfd('0x34')][_0x0bfd('0x50')](_0x2bef56[_0x0bfd('0x51')],{})[_0x0bfd('0x2e')](respondWithResult(_0x492af2,0xc9))[_0x0bfd('0x23')](handleError(_0x492af2,null));};exports[_0x0bfd('0x2d')]=function(_0x11b35b,_0x2076b2){if(_0x11b35b['body']['id']){delete _0x11b35b[_0x0bfd('0x51')]['id'];}return db[_0x0bfd('0x34')][_0x0bfd('0x4f')]({'where':{'id':_0x11b35b['params']['id']}})[_0x0bfd('0x2e')](handleEntityNotFound(_0x2076b2,null))['then'](saveUpdates(_0x11b35b[_0x0bfd('0x51')],null))[_0x0bfd('0x2e')](respondWithResult(_0x2076b2,null))[_0x0bfd('0x23')](handleError(_0x2076b2,null));};exports['destroy']=function(_0x4fd238,_0x4cd2ba){return db[_0x0bfd('0x34')][_0x0bfd('0x4f')]({'where':{'id':_0x4fd238[_0x0bfd('0x4e')]['id']}})[_0x0bfd('0x2e')](handleEntityNotFound(_0x4cd2ba,null))['then'](removeEntity(_0x4cd2ba,null))['catch'](handleError(_0x4cd2ba,null));};exports['getConfigurations']=function(_0x2215a9,_0x145d1a,_0x1764b3){var _0x331cb6={};var _0x1cbc74={};var _0x206534;var _0x51ab79;return db[_0x0bfd('0x34')][_0x0bfd('0x52')]({'where':{'id':_0x2215a9[_0x0bfd('0x4e')]['id']}})[_0x0bfd('0x2e')](handleEntityNotFound(_0x145d1a,null))[_0x0bfd('0x2e')](function(_0x10c09f){if(_0x10c09f){_0x206534=_0x10c09f;_0x1cbc74[_0x0bfd('0x38')]=_['keys'](db[_0x0bfd('0x53')][_0x0bfd('0x35')]);_0x1cbc74[_0x0bfd('0x3a')]=_[_0x0bfd('0x3b')](_0x2215a9['query']);_0x1cbc74[_0x0bfd('0x3c')]=_[_0x0bfd('0x3d')](_0x1cbc74[_0x0bfd('0x38')],_0x1cbc74[_0x0bfd('0x3a')]);_0x331cb6['attributes']=_[_0x0bfd('0x3d')](_0x1cbc74['model'],qs[_0x0bfd('0x3f')](_0x2215a9[_0x0bfd('0x3a')]['fields']));_0x331cb6['attributes']=_0x331cb6[_0x0bfd('0x3e')][_0x0bfd('0x40')]?_0x331cb6[_0x0bfd('0x3e')]:_0x1cbc74[_0x0bfd('0x38')];_0x331cb6['order']=qs[_0x0bfd('0x54')](_0x2215a9[_0x0bfd('0x3a')][_0x0bfd('0x54')]);_0x331cb6[_0x0bfd('0x45')]=qs[_0x0bfd('0x3c')](_['pick'](_0x2215a9[_0x0bfd('0x3a')],_0x1cbc74[_0x0bfd('0x3c')]));if(_0x2215a9[_0x0bfd('0x3a')][_0x0bfd('0x44')]){_0x331cb6['where']=_[_0x0bfd('0x46')](_0x331cb6[_0x0bfd('0x45')],{'$or':_[_0x0bfd('0x39')](_0x331cb6[_0x0bfd('0x3e')],function(_0x4afbb2){var _0x15fccb={};_0x15fccb[_0x4afbb2]={'$like':'%'+_0x2215a9[_0x0bfd('0x3a')][_0x0bfd('0x44')]+'%'};return _0x15fccb;})});}_0x331cb6=_[_0x0bfd('0x46')]({},_0x331cb6,_0x2215a9['options']);return _0x206534[_0x0bfd('0x55')](_0x331cb6);}})[_0x0bfd('0x2e')](function(_0x155ac7){if(_0x155ac7){_0x51ab79=_0x155ac7[_0x0bfd('0x40')];if(!_0x2215a9['query'][_0x0bfd('0x41')](_0x0bfd('0x42'))){_0x331cb6[_0x0bfd('0x43')]=qs[_0x0bfd('0x43')](_0x2215a9['query'][_0x0bfd('0x43')]);_0x331cb6[_0x0bfd('0x28')]=qs[_0x0bfd('0x28')](_0x2215a9['query'][_0x0bfd('0x28')]);}return _0x206534[_0x0bfd('0x55')](_0x331cb6);}})[_0x0bfd('0x2e')](function(_0xf86bfa){if(_0xf86bfa){return _0xf86bfa?{'count':_0x51ab79,'rows':_0xf86bfa}:null;}})[_0x0bfd('0x2e')](respondWithResult(_0x145d1a,null))[_0x0bfd('0x23')](handleError(_0x145d1a,null));};exports[_0x0bfd('0x56')]=function(_0x427664,_0x2f8b1b,_0xeddaa7){if(_0x427664[_0x0bfd('0x51')]['id']){delete _0x427664[_0x0bfd('0x51')]['id'];}return db[_0x0bfd('0x34')][_0x0bfd('0x52')]({'where':{'id':_0x427664[_0x0bfd('0x4e')]['id']}})[_0x0bfd('0x2e')](handleEntityNotFound(_0x2f8b1b,null))[_0x0bfd('0x2e')](function(_0x13672b){if(_0x13672b){_0x427664['body'][_0x0bfd('0x57')]=_0x13672b['id'];_0x427664[_0x0bfd('0x51')][_0x0bfd('0x58')]=integrations[_0x0bfd('0x59')](_0x427664[_0x0bfd('0x51')][_0x0bfd('0x5a')],_0x427664[_0x0bfd('0x51')][_0x0bfd('0x37')]);_0x427664[_0x0bfd('0x51')][_0x0bfd('0x5b')]=integrations[_0x0bfd('0x5c')](_0x427664['body'][_0x0bfd('0x5a')],_0x427664[_0x0bfd('0x51')][_0x0bfd('0x37')]);return db[_0x0bfd('0x53')][_0x0bfd('0x50')](_0x427664[_0x0bfd('0x51')],{'include':[{'model':db[_0x0bfd('0x5d')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x0bfd('0x5b')}]});}return null;})[_0x0bfd('0x2e')](respondWithResult(_0x2f8b1b,null))['catch'](handleError(_0x2f8b1b,null));};function getAccessToken(_0x33920c){return new Promise(function(_0x13a94e,_0x5afe57){var _0x566bf5;switch(_0x33920c['zone']){case'US':_0x566bf5=_0x0bfd('0x5e');break;case'AU':_0x566bf5='https://accounts.zoho.com.au';break;case'EU':_0x566bf5=_0x0bfd('0x5f');break;case'IN':_0x566bf5=_0x0bfd('0x60');break;case'CN':_0x566bf5='https://accounts.zoho.com.cn';break;default:_0x566bf5=_0x0bfd('0x5f');break;}var _0x4ff201={'method':_0x0bfd('0x61'),'uri':_0x566bf5+_0x0bfd('0x62'),'qs':{'refresh_token':_0x33920c[_0x0bfd('0x63')],'client_id':_0x33920c[_0x0bfd('0x64')],'client_secret':_0x33920c[_0x0bfd('0x65')],'grant_type':_0x0bfd('0x66')},'json':!![]};return rp(_0x4ff201)[_0x0bfd('0x2e')](function(_0x2683c4){if(_0x2683c4[_0x0bfd('0x67')]){_0x13a94e(_0x2683c4[_0x0bfd('0x67')]);}else{_0x5afe57('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x0bfd('0x23')](function(_0x207d5d){_0x5afe57(_0x207d5d);});});}exports[_0x0bfd('0x68')]=function(_0x16980c,_0x32552b,_0x160c46){var _0x556bf9,_0x62bef5,_0xd4e5b2,_0x46e687,_0x33dccb;return db[_0x0bfd('0x34')]['findOne']({'where':{'id':_0x16980c[_0x0bfd('0x4e')]['id']},'attributes':['id',_0x0bfd('0x69'),'zone',_0x0bfd('0x64'),_0x0bfd('0x65'),_0x0bfd('0x6a'),_0x0bfd('0x20'),_0x0bfd('0x63')]})[_0x0bfd('0x2e')](handleEntityNotFound(_0x32552b,null))[_0x0bfd('0x2e')](function(_0x2b0cf7){_0x33dccb=_0x2b0cf7;_0x556bf9=_0x33dccb[_0x0bfd('0x69')];_0x62bef5=_0x556bf9==='zoho.eu'?'eu':_0x0bfd('0x6b');_0xd4e5b2=_0x33dccb['serverUrl'];var _0x378c82=_0xd4e5b2['slice'](-0x1);if(_0x378c82==='/'||_0x378c82==='\x5c'||_0x378c82===':'){_0xd4e5b2=_0xd4e5b2[_0x0bfd('0x6c')](0x0,_0xd4e5b2[_0x0bfd('0x6d')](_0x378c82));}if(!_0x33dccb[_0x0bfd('0x63')]){throw new Error(_0x0bfd('0x6e'));}return getAccessToken(_0x33dccb);})[_0x0bfd('0x2e')](function(_0x42a7b1){if(_0x42a7b1){return rp({'method':_0x0bfd('0x6f'),'uri':util[_0x0bfd('0x70')](_0x0bfd('0x71'),_0x62bef5),'qs':{'module':_0x0bfd('0x72')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x42a7b1},'json':!![]});}})[_0x0bfd('0x2e')](function(_0x14d152){if(_0x14d152){if(_0x14d152[_0x0bfd('0x73')]&&_0x14d152[_0x0bfd('0x73')]['error']){throw new Error(_0x14d152['response'][_0x0bfd('0x1f')]['message']);}var _0x1ec2f7=[];var _0x25ef45=[];var _0x44096d=[_0x0bfd('0x74'),_0x0bfd('0x75'),_0x0bfd('0x76'),_0x0bfd('0x77'),_0x0bfd('0x78'),'Call_Result',_0x0bfd('0x79'),_0x0bfd('0x7a')];_0x25ef45=_[_0x0bfd('0x7b')](_0x14d152[_0x0bfd('0x3f')],function(_0x556d79){return _0x44096d[_0x0bfd('0x7c')](_0x556d79[_0x0bfd('0x7d')]);});for(var _0x15c953=0x0;_0x15c953<_0x25ef45['length'];_0x15c953++){if(_0x25ef45[_0x15c953]['system_mandatory']===![]){_0x1ec2f7[_0x0bfd('0x7e')]({'id':_0x25ef45[_0x15c953]['id'],'name':_0x25ef45[_0x15c953][_0x0bfd('0x7f')],'custom':_0x25ef45[_0x15c953][_0x0bfd('0x80')],'options':_0x25ef45[_0x15c953][_0x0bfd('0x81')]==='picklist'&&_0x25ef45[_0x15c953][_0x0bfd('0x82')][_0x0bfd('0x40')]>-0x1?_[_0x0bfd('0x39')](_0x25ef45[_0x15c953][_0x0bfd('0x82')],function(_0x2c8d7a){return{'name':_0x2c8d7a,'value':_0x2c8d7a};}):[]});}}return{'count':_0x1ec2f7['length'],'rows':_0x1ec2f7};}else{return{'count':0x0,'rows':[]};}})[_0x0bfd('0x2e')](respondWithResult(_0x32552b,null))[_0x0bfd('0x23')](function(_0x542dd6){var _0x2b0f82=_0x16980c[_0x0bfd('0x3a')][_0x0bfd('0x15')]?0x1f4:_0x542dd6['statusCode']||0x1f4;logger[_0x0bfd('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0x0bfd('0x68'),_0x2b0f82,JSON[_0x0bfd('0x1e')](_0x542dd6));delete _0x542dd6[_0x0bfd('0x31')];if(_0x2b0f82===0x191){_0x2b0f82=0x190;}_0x32552b[_0x0bfd('0x25')](_0x2b0f82)[_0x0bfd('0x32')](_0x16980c[_0x0bfd('0x3a')][_0x0bfd('0x15')]?{'message':_0x0bfd('0x83'),'statusCode':_0x542dd6['statusCode']}:_0x542dd6);});}; \ No newline at end of file +var _0x5fc2=['stack','name','map','ZohoAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','show','rawAttributes','keys','options','find','create','body','params','findOne','ZohoConfiguration','getConfigurations','nolimit','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','statusCode','stringify','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','reject','save','then','destroy'];(function(_0x54bbeb,_0x3ad1e0){var _0x54692f=function(_0x3522b2){while(--_0x3522b2){_0x54bbeb['push'](_0x54bbeb['shift']());}};_0x54692f(++_0x3ad1e0);}(_0x5fc2,0x17a));var _0x25fc=function(_0x105e3e,_0x4cb667){_0x105e3e=_0x105e3e-0x0;var _0x5b0125=_0x5fc2[_0x105e3e];return _0x5b0125;};'use strict';var pdf=require(_0x25fc('0x0'));var emlformat=require(_0x25fc('0x1'));var rimraf=require(_0x25fc('0x2'));var zipdir=require(_0x25fc('0x3'));var jsonpatch=require(_0x25fc('0x4'));var rp=require(_0x25fc('0x5'));var moment=require(_0x25fc('0x6'));var BPromise=require(_0x25fc('0x7'));var Mustache=require(_0x25fc('0x8'));var util=require(_0x25fc('0x9'));var path=require('path');var sox=require(_0x25fc('0xa'));var csv=require(_0x25fc('0xb'));var ejs=require(_0x25fc('0xc'));var fs=require('fs');var _=require(_0x25fc('0xd'));var squel=require(_0x25fc('0xe'));var crypto=require(_0x25fc('0xf'));var jsforce=require(_0x25fc('0x10'));var deskjs=require(_0x25fc('0x11'));var toCsv=require('to-csv');var querystring=require(_0x25fc('0x12'));var Papa=require(_0x25fc('0x13'));var Redis=require(_0x25fc('0x14'));var authService=require(_0x25fc('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x25fc('0x16'));var hardwareService=require(_0x25fc('0x17'));var logger=require(_0x25fc('0x18'))(_0x25fc('0x19'));var utils=require('../../config/utils');var config=require(_0x25fc('0x1a'));var db=require(_0x25fc('0x1b'))['db'];var integrations=require(_0x25fc('0x1c'));var jayson=require(_0x25fc('0x1d'));var client=jayson[_0x25fc('0x1e')][_0x25fc('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x507f89,_0x6b2ee3,_0x5a9463){if(_0x5a9463){var _0x16d940=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16d940[_0x25fc('0x20')](_0x6b2ee3)){return _0x507f89;}else{throw new db[(_0x25fc('0x21'))][(_0x25fc('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 _0x507f89;}}function respondWithRpcPromise(_0x2c9dff,_0x3949ad,_0x4d6b3d,_0x236469){return new BPromise(function(_0x3ddc1c,_0x33d1bd){var _0x1a0272=_0x236469||client;return _0x1a0272[_0x25fc('0x23')](_0x2c9dff,_0x4d6b3d)['then'](function(_0x23c9a7){logger['info'](_0x25fc('0x24'),_0x3949ad,_0x25fc('0x25'));logger[_0x25fc('0x26')](_0x25fc('0x27'),_0x3949ad,_0x25fc('0x25'),JSON['stringify'](_0x23c9a7));if(_0x23c9a7['error']){if(_0x23c9a7[_0x25fc('0x28')][_0x25fc('0x29')]===0x1f4){logger[_0x25fc('0x28')](_0x25fc('0x24'),_0x3949ad,_0x23c9a7[_0x25fc('0x28')][_0x25fc('0x2a')]);return _0x33d1bd(_0x23c9a7['error'][_0x25fc('0x2a')]);}logger['error'](_0x25fc('0x24'),_0x3949ad,_0x23c9a7[_0x25fc('0x28')][_0x25fc('0x2a')]);return _0x3ddc1c(_0x23c9a7[_0x25fc('0x28')]['message']);}else{logger[_0x25fc('0x2b')](_0x25fc('0x24'),_0x3949ad,_0x25fc('0x25'));_0x3ddc1c(_0x23c9a7[_0x25fc('0x2c')][_0x25fc('0x2a')]);}})[_0x25fc('0x2d')](function(_0x1e710e){logger[_0x25fc('0x28')]('ZohoAccount,\x20%s,\x20%s',_0x3949ad,_0x1e710e);_0x33d1bd(_0x1e710e);});});}function respondWithStatusCode(_0xfe2647,_0xe011f1){_0xe011f1=_0xe011f1||0xcc;return function(_0xb13ca){if(_0xb13ca){return _0xfe2647[_0x25fc('0x2e')](_0xe011f1);}return _0xfe2647['status'](_0xe011f1)[_0x25fc('0x2f')]();};}function respondWithResult(_0x13992e,_0x51c3f3){_0x51c3f3=_0x51c3f3||0xc8;return function(_0x46b0f4){if(_0x46b0f4){return _0x13992e[_0x25fc('0x30')](_0x51c3f3)['json'](_0x46b0f4);}};}function respondWithFilteredResult(_0x15d8e2,_0x46e3bd){return function(_0x138037){if(_0x138037){var _0x2eb1b8=_0x138037['count'],_0x5d0495=_0x46e3bd['offset'],_0x3147c0=_0x46e3bd[_0x25fc('0x31')]+_0x46e3bd[_0x25fc('0x32')],_0x2d262a;if(_0x3147c0>=_0x2eb1b8){_0x3147c0=_0x2eb1b8;_0x2d262a=0xc8;}else{_0x2d262a=0xce;}_0x15d8e2[_0x25fc('0x30')](_0x2d262a);return _0x15d8e2[_0x25fc('0x33')](_0x25fc('0x34'),_0x5d0495+'-'+_0x3147c0+'/'+_0x2eb1b8)['json'](_0x138037);}return null;};}function patchUpdates(_0x30553a){return function(_0x125457){try{jsonpatch['apply'](_0x125457,_0x30553a,!![]);}catch(_0x4764a5){return BPromise[_0x25fc('0x35')](_0x4764a5);}return _0x125457[_0x25fc('0x36')]();};}function saveUpdates(_0x859233,_0x24d68b){return function(_0x73f024){if(_0x73f024){return _0x73f024['update'](_0x859233)[_0x25fc('0x37')](function(_0x27e179){return _0x27e179;});}return null;};}function removeEntity(_0x414363,_0x5846e6){return function(_0x35f132){if(_0x35f132){return _0x35f132[_0x25fc('0x38')]()[_0x25fc('0x37')](function(){_0x414363['status'](0xcc)[_0x25fc('0x2f')]();});}};}function handleEntityNotFound(_0x5cfb26,_0x33720a){return function(_0x6c6717){if(!_0x6c6717){_0x5cfb26['sendStatus'](0x194);}return _0x6c6717;};}function handleError(_0x423ffb,_0x326872){_0x326872=_0x326872||0x1f4;return function(_0x328e23){logger['error'](_0x328e23[_0x25fc('0x39')]);if(_0x328e23[_0x25fc('0x3a')]){delete _0x328e23['name'];}_0x423ffb[_0x25fc('0x30')](_0x326872)['send'](_0x328e23);};}exports['index']=function(_0x3372f0,_0x201031){var _0x5f3dff={},_0x14f8de={},_0x23004d={'count':0x0,'rows':[]};var _0x31d9e7=_[_0x25fc('0x3b')](db[_0x25fc('0x3c')]['rawAttributes'],function(_0xef3755){return{'name':_0xef3755[_0x25fc('0x3d')],'type':_0xef3755[_0x25fc('0x3e')][_0x25fc('0x3f')]};});_0x14f8de['model']=_[_0x25fc('0x3b')](_0x31d9e7,_0x25fc('0x3a'));_0x14f8de[_0x25fc('0x40')]=_['keys'](_0x3372f0[_0x25fc('0x40')]);_0x14f8de[_0x25fc('0x41')]=_[_0x25fc('0x42')](_0x14f8de[_0x25fc('0x43')],_0x14f8de[_0x25fc('0x40')]);_0x5f3dff[_0x25fc('0x44')]=_[_0x25fc('0x42')](_0x14f8de[_0x25fc('0x43')],qs['fields'](_0x3372f0['query'][_0x25fc('0x45')]));_0x5f3dff['attributes']=_0x5f3dff[_0x25fc('0x44')][_0x25fc('0x46')]?_0x5f3dff[_0x25fc('0x44')]:_0x14f8de[_0x25fc('0x43')];if(!_0x3372f0[_0x25fc('0x40')][_0x25fc('0x47')]('nolimit')){_0x5f3dff['limit']=qs[_0x25fc('0x32')](_0x3372f0['query'][_0x25fc('0x32')]);_0x5f3dff[_0x25fc('0x31')]=qs[_0x25fc('0x31')](_0x3372f0[_0x25fc('0x40')][_0x25fc('0x31')]);}_0x5f3dff[_0x25fc('0x48')]=qs[_0x25fc('0x49')](_0x3372f0[_0x25fc('0x40')][_0x25fc('0x49')]);_0x5f3dff[_0x25fc('0x4a')]=qs[_0x25fc('0x41')](_[_0x25fc('0x4b')](_0x3372f0[_0x25fc('0x40')],_0x14f8de[_0x25fc('0x41')]),_0x31d9e7);if(_0x3372f0['query'][_0x25fc('0x4c')]){_0x5f3dff[_0x25fc('0x4a')]=_[_0x25fc('0x4d')](_0x5f3dff['where'],{'$or':_[_0x25fc('0x3b')](_0x31d9e7,function(_0x4376c1){if(_0x4376c1[_0x25fc('0x3e')]!==_0x25fc('0x4e')){var _0x43bcf9={};_0x43bcf9[_0x4376c1[_0x25fc('0x3a')]]={'$like':'%'+_0x3372f0['query'][_0x25fc('0x4c')]+'%'};return _0x43bcf9;}})});}_0x5f3dff=_[_0x25fc('0x4d')]({},_0x5f3dff,_0x3372f0['options']);var _0x380350={'where':_0x5f3dff[_0x25fc('0x4a')]};return db[_0x25fc('0x3c')][_0x25fc('0x4f')](_0x380350)[_0x25fc('0x37')](function(_0x14c544){_0x23004d[_0x25fc('0x4f')]=_0x14c544;if(_0x3372f0[_0x25fc('0x40')][_0x25fc('0x50')]){_0x5f3dff[_0x25fc('0x51')]=[{'all':!![]}];}return db['ZohoAccount'][_0x25fc('0x52')](_0x5f3dff);})[_0x25fc('0x37')](function(_0x47de7e){_0x23004d['rows']=_0x47de7e;return _0x23004d;})[_0x25fc('0x37')](respondWithFilteredResult(_0x201031,_0x5f3dff))[_0x25fc('0x2d')](handleError(_0x201031,null));};exports[_0x25fc('0x53')]=function(_0x330152,_0x33c5a4){var _0x498529={'raw':![],'where':{'id':_0x330152['params']['id']}},_0xa538b7={};_0xa538b7[_0x25fc('0x43')]=_['keys'](db['ZohoAccount'][_0x25fc('0x54')]);_0xa538b7['query']=_[_0x25fc('0x55')](_0x330152['query']);_0xa538b7[_0x25fc('0x41')]=_[_0x25fc('0x42')](_0xa538b7[_0x25fc('0x43')],_0xa538b7[_0x25fc('0x40')]);_0x498529[_0x25fc('0x44')]=_[_0x25fc('0x42')](_0xa538b7['model'],qs[_0x25fc('0x45')](_0x330152[_0x25fc('0x40')][_0x25fc('0x45')]));_0x498529[_0x25fc('0x44')]=_0x498529[_0x25fc('0x44')][_0x25fc('0x46')]?_0x498529[_0x25fc('0x44')]:_0xa538b7[_0x25fc('0x43')];if(_0x330152[_0x25fc('0x40')][_0x25fc('0x50')]){_0x498529[_0x25fc('0x51')]=[{'all':!![]}];}_0x498529=_[_0x25fc('0x4d')]({},_0x498529,_0x330152[_0x25fc('0x56')]);return db[_0x25fc('0x3c')][_0x25fc('0x57')](_0x498529)[_0x25fc('0x37')](handleEntityNotFound(_0x33c5a4,null))[_0x25fc('0x37')](respondWithResult(_0x33c5a4,null))[_0x25fc('0x2d')](handleError(_0x33c5a4,null));};exports[_0x25fc('0x58')]=function(_0x41f6d5,_0x4de4a5){return db[_0x25fc('0x3c')]['create'](_0x41f6d5[_0x25fc('0x59')],{})[_0x25fc('0x37')](respondWithResult(_0x4de4a5,0xc9))[_0x25fc('0x2d')](handleError(_0x4de4a5,null));};exports['update']=function(_0x24f650,_0x2d15e7){if(_0x24f650[_0x25fc('0x59')]['id']){delete _0x24f650['body']['id'];}return db[_0x25fc('0x3c')][_0x25fc('0x57')]({'where':{'id':_0x24f650['params']['id']}})[_0x25fc('0x37')](handleEntityNotFound(_0x2d15e7,null))[_0x25fc('0x37')](saveUpdates(_0x24f650[_0x25fc('0x59')],null))['then'](respondWithResult(_0x2d15e7,null))[_0x25fc('0x2d')](handleError(_0x2d15e7,null));};exports['destroy']=function(_0x4e985c,_0x4d08b9){return db['ZohoAccount']['find']({'where':{'id':_0x4e985c[_0x25fc('0x5a')]['id']}})[_0x25fc('0x37')](handleEntityNotFound(_0x4d08b9,null))[_0x25fc('0x37')](removeEntity(_0x4d08b9,null))[_0x25fc('0x2d')](handleError(_0x4d08b9,null));};exports['getConfigurations']=function(_0x50be45,_0x4c682b,_0x4ea99e){var _0x52cf66={};var _0x178b3f={};var _0x89db05;var _0x27783a;return db[_0x25fc('0x3c')][_0x25fc('0x5b')]({'where':{'id':_0x50be45[_0x25fc('0x5a')]['id']}})[_0x25fc('0x37')](handleEntityNotFound(_0x4c682b,null))[_0x25fc('0x37')](function(_0x245152){if(_0x245152){_0x89db05=_0x245152;_0x178b3f['model']=_[_0x25fc('0x55')](db[_0x25fc('0x5c')]['rawAttributes']);_0x178b3f[_0x25fc('0x40')]=_['keys'](_0x50be45[_0x25fc('0x40')]);_0x178b3f[_0x25fc('0x41')]=_['intersection'](_0x178b3f[_0x25fc('0x43')],_0x178b3f[_0x25fc('0x40')]);_0x52cf66['attributes']=_[_0x25fc('0x42')](_0x178b3f[_0x25fc('0x43')],qs['fields'](_0x50be45[_0x25fc('0x40')][_0x25fc('0x45')]));_0x52cf66[_0x25fc('0x44')]=_0x52cf66[_0x25fc('0x44')][_0x25fc('0x46')]?_0x52cf66['attributes']:_0x178b3f[_0x25fc('0x43')];_0x52cf66['order']=qs[_0x25fc('0x49')](_0x50be45[_0x25fc('0x40')][_0x25fc('0x49')]);_0x52cf66['where']=qs[_0x25fc('0x41')](_[_0x25fc('0x4b')](_0x50be45['query'],_0x178b3f[_0x25fc('0x41')]));if(_0x50be45['query']['filter']){_0x52cf66[_0x25fc('0x4a')]=_[_0x25fc('0x4d')](_0x52cf66['where'],{'$or':_[_0x25fc('0x3b')](_0x52cf66[_0x25fc('0x44')],function(_0x1caa8f){var _0x6a7838={};_0x6a7838[_0x1caa8f]={'$like':'%'+_0x50be45[_0x25fc('0x40')][_0x25fc('0x4c')]+'%'};return _0x6a7838;})});}_0x52cf66=_[_0x25fc('0x4d')]({},_0x52cf66,_0x50be45[_0x25fc('0x56')]);return _0x89db05[_0x25fc('0x5d')](_0x52cf66);}})[_0x25fc('0x37')](function(_0x3bf3f1){if(_0x3bf3f1){_0x27783a=_0x3bf3f1[_0x25fc('0x46')];if(!_0x50be45['query'][_0x25fc('0x47')](_0x25fc('0x5e'))){_0x52cf66[_0x25fc('0x32')]=qs[_0x25fc('0x32')](_0x50be45[_0x25fc('0x40')][_0x25fc('0x32')]);_0x52cf66['offset']=qs[_0x25fc('0x31')](_0x50be45[_0x25fc('0x40')][_0x25fc('0x31')]);}return _0x89db05['getConfigurations'](_0x52cf66);}})[_0x25fc('0x37')](function(_0x44fcc1){if(_0x44fcc1){return _0x44fcc1?{'count':_0x27783a,'rows':_0x44fcc1}:null;}})[_0x25fc('0x37')](respondWithResult(_0x4c682b,null))[_0x25fc('0x2d')](handleError(_0x4c682b,null));};exports['addConfiguration']=function(_0x153311,_0x27c8e1,_0x45b58f){if(_0x153311['body']['id']){delete _0x153311[_0x25fc('0x59')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x153311[_0x25fc('0x5a')]['id']}})[_0x25fc('0x37')](handleEntityNotFound(_0x27c8e1,null))[_0x25fc('0x37')](function(_0x278787){if(_0x278787){_0x153311[_0x25fc('0x59')]['AccountId']=_0x278787['id'];_0x153311[_0x25fc('0x59')][_0x25fc('0x5f')]=integrations[_0x25fc('0x60')](_0x153311[_0x25fc('0x59')][_0x25fc('0x61')],_0x153311[_0x25fc('0x59')][_0x25fc('0x3e')]);_0x153311[_0x25fc('0x59')][_0x25fc('0x62')]=integrations[_0x25fc('0x63')](_0x153311[_0x25fc('0x59')][_0x25fc('0x61')],_0x153311[_0x25fc('0x59')][_0x25fc('0x3e')]);return db['ZohoConfiguration']['create'](_0x153311['body'],{'include':[{'model':db[_0x25fc('0x64')],'as':_0x25fc('0x5f')},{'model':db[_0x25fc('0x64')],'as':_0x25fc('0x62')}]});}return null;})[_0x25fc('0x37')](respondWithResult(_0x27c8e1,null))[_0x25fc('0x2d')](handleError(_0x27c8e1,null));};function getAccessToken(_0x32b807){return new Promise(function(_0x4886c9,_0x215f58){var _0x1d5f38;switch(_0x32b807[_0x25fc('0x65')]){case'US':_0x1d5f38=_0x25fc('0x66');break;case'AU':_0x1d5f38=_0x25fc('0x67');break;case'EU':_0x1d5f38=_0x25fc('0x68');break;case'IN':_0x1d5f38='https://accounts.zoho.in';break;case'CN':_0x1d5f38=_0x25fc('0x69');break;default:_0x1d5f38='https://accounts.zoho.eu';break;}var _0x3df2cb={'method':_0x25fc('0x6a'),'uri':_0x1d5f38+_0x25fc('0x6b'),'qs':{'refresh_token':_0x32b807[_0x25fc('0x6c')],'client_id':_0x32b807[_0x25fc('0x6d')],'client_secret':_0x32b807[_0x25fc('0x6e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3df2cb)[_0x25fc('0x37')](function(_0x3312f7){if(_0x3312f7[_0x25fc('0x6f')]){_0x4886c9(_0x3312f7[_0x25fc('0x6f')]);}else{_0x215f58('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x25fc('0x2d')](function(_0x58dbb0){_0x215f58(_0x58dbb0);});});}exports[_0x25fc('0x70')]=function(_0x555808,_0x20d7b5,_0x111f2f){var _0x1e3677,_0x5d49d2,_0x3cf6dd,_0x25b77f,_0x249ce2;return db[_0x25fc('0x3c')][_0x25fc('0x5b')]({'where':{'id':_0x555808[_0x25fc('0x5a')]['id']},'attributes':['id',_0x25fc('0x71'),_0x25fc('0x65'),_0x25fc('0x6d'),_0x25fc('0x6e'),_0x25fc('0x72'),'code',_0x25fc('0x6c')]})[_0x25fc('0x37')](handleEntityNotFound(_0x20d7b5,null))[_0x25fc('0x37')](function(_0x442204){_0x249ce2=_0x442204;_0x1e3677=_0x249ce2[_0x25fc('0x71')];_0x5d49d2=_0x1e3677===_0x25fc('0x73')?'eu':_0x25fc('0x74');_0x3cf6dd=_0x249ce2[_0x25fc('0x72')];var _0x5071f1=_0x3cf6dd[_0x25fc('0x75')](-0x1);if(_0x5071f1==='/'||_0x5071f1==='\x5c'||_0x5071f1===':'){_0x3cf6dd=_0x3cf6dd[_0x25fc('0x76')](0x0,_0x3cf6dd[_0x25fc('0x77')](_0x5071f1));}if(!_0x249ce2[_0x25fc('0x6c')]){throw new Error(_0x25fc('0x78'));}return getAccessToken(_0x249ce2);})['then'](function(_0x548576){if(_0x548576){return rp({'method':_0x25fc('0x79'),'uri':util['format'](_0x25fc('0x7a'),_0x5d49d2),'qs':{'module':'Calls'},'headers':{'Authorization':_0x25fc('0x7b')+_0x548576},'json':!![]});}})[_0x25fc('0x37')](function(_0xb0380){if(_0xb0380){if(_0xb0380[_0x25fc('0x7c')]&&_0xb0380['response'][_0x25fc('0x28')]){throw new Error(_0xb0380[_0x25fc('0x7c')][_0x25fc('0x28')][_0x25fc('0x2a')]);}var _0x59e6ad=[];var _0x4836ef=[];var _0x1a50fb=[_0x25fc('0x7d'),_0x25fc('0x7e'),_0x25fc('0x7f'),_0x25fc('0x80'),_0x25fc('0x81'),'Call_Result',_0x25fc('0x82'),_0x25fc('0x83')];_0x4836ef=_[_0x25fc('0x84')](_0xb0380[_0x25fc('0x45')],function(_0x427d11){return _0x1a50fb[_0x25fc('0x85')](_0x427d11[_0x25fc('0x86')]);});for(var _0x3e1b6c=0x0;_0x3e1b6c<_0x4836ef['length'];_0x3e1b6c++){if(_0x4836ef[_0x3e1b6c][_0x25fc('0x87')]===![]){_0x59e6ad[_0x25fc('0x88')]({'id':_0x4836ef[_0x3e1b6c]['id'],'name':_0x4836ef[_0x3e1b6c][_0x25fc('0x89')],'custom':_0x4836ef[_0x3e1b6c]['custom_field'],'options':_0x4836ef[_0x3e1b6c][_0x25fc('0x8a')]===_0x25fc('0x8b')&&_0x4836ef[_0x3e1b6c][_0x25fc('0x8c')][_0x25fc('0x46')]>-0x1?_[_0x25fc('0x3b')](_0x4836ef[_0x3e1b6c][_0x25fc('0x8c')],function(_0x44f018){return{'name':_0x44f018,'value':_0x44f018};}):[]});}}return{'count':_0x59e6ad[_0x25fc('0x46')],'rows':_0x59e6ad};}else{return{'count':0x0,'rows':[]};}})[_0x25fc('0x37')](respondWithResult(_0x20d7b5,null))[_0x25fc('0x2d')](function(_0x385874){var _0x89d048=_0x555808[_0x25fc('0x40')][_0x25fc('0x20')]?0x1f4:_0x385874[_0x25fc('0x8d')]||0x1f4;logger[_0x25fc('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x89d048,JSON[_0x25fc('0x8e')](_0x385874));delete _0x385874['name'];if(_0x89d048===0x191){_0x89d048=0x190;}_0x20d7b5[_0x25fc('0x30')](_0x89d048)[_0x25fc('0x8f')](_0x555808['query']['test']?{'message':_0x25fc('0x90'),'statusCode':_0x385874[_0x25fc('0x8d')]}:_0x385874);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 9e3b8b2..ad0721e 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 _0x37fc=['application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','substring','https://accounts.zoho.com.au','POST','authorization_code','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','clientSecret','code','host','serverUrl','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId'];(function(_0x421eca,_0x1acb1e){var _0x47d52a=function(_0x14df43){while(--_0x14df43){_0x421eca['push'](_0x421eca['shift']());}};_0x47d52a(++_0x1acb1e);}(_0x37fc,0x162));var _0xc37f=function(_0x5d0760,_0x54bd98){_0x5d0760=_0x5d0760-0x0;var _0x214bb0=_0x37fc[_0x5d0760];return _0x214bb0;};'use strict';var _=require(_0xc37f('0x0'));var util=require(_0xc37f('0x1'));var logger=require(_0xc37f('0x2'))(_0xc37f('0x3'));var moment=require(_0xc37f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc37f('0x5'));var rimraf=require(_0xc37f('0x6'));var config=require(_0xc37f('0x7'));var attributes=require(_0xc37f('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc37f('0x9')]=function(_0x7cb398,_0x6fb100){return _0x7cb398[_0xc37f('0xa')]('ZohoAccount',attributes,{'tableName':_0xc37f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2f1b52,_0x1d981f,_0x51fdea){if(_0x2f1b52[_0xc37f('0xc')](_0xc37f('0xd'))||_0x2f1b52[_0xc37f('0xc')]('serverUrl')||_0x2f1b52['changed']('clientId')||_0x2f1b52[_0xc37f('0xc')](_0xc37f('0xe'))||_0x2f1b52[_0xc37f('0xc')](_0xc37f('0xf'))||_0x2f1b52[_0xc37f('0xc')](_0xc37f('0x10'))){var _0x2cb91c,_0x39ddc2;_0x2cb91c=_0x2f1b52[_0xc37f('0x11')];var _0x1a3189=_0x2cb91c['slice'](-0x1);if(_0x1a3189==='/'||_0x1a3189==='\x5c'||_0x1a3189===':'){_0x2cb91c=_0x2cb91c['substring'](0x0,_0x2cb91c['lastIndexOf'](_0x1a3189));}switch(_0x2f1b52[_0xc37f('0xd')]){case'US':_0x39ddc2=_0xc37f('0x12');break;case'AU':_0x39ddc2='https://accounts.zoho.com.au';break;case'IN':_0x39ddc2=_0xc37f('0x13');break;case'CN':_0x39ddc2=_0xc37f('0x14');break;default:_0x39ddc2=_0xc37f('0x15');break;}var _0x94d81c={'method':'POST','uri':_0x39ddc2+_0xc37f('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x2f1b52[_0xc37f('0x17')],'client_secret':_0x2f1b52[_0xc37f('0xe')],'redirect_uri':_0x2f1b52[_0xc37f('0x11')],'code':_0x2f1b52[_0xc37f('0xf')]},'headers':{'Content-Type':_0xc37f('0x18')}};return rp(_0x94d81c)[_0xc37f('0x19')](function(_0x1f96ba){var _0x39ce08=JSON[_0xc37f('0x1a')](_0x1f96ba);if(_0x39ce08[_0xc37f('0x1b')]){_0x2f1b52[_0xc37f('0x1c')]=_0x39ce08[_0xc37f('0x1b')];logger[_0xc37f('0x1d')](util[_0xc37f('0x1e')](_0xc37f('0x1f'),_0x2f1b52[_0xc37f('0x20')],_0x2f1b52['id']));}else{logger[_0xc37f('0x21')](util[_0xc37f('0x1e')](_0xc37f('0x22'),_0x2f1b52['name'],_0x2f1b52['id']),util[_0xc37f('0x23')](_0x39ce08,{'showHidden':![],'depth':null}));}return _0x51fdea(null,_0x1d981f);})[_0xc37f('0x24')](function(_0x446b40){logger[_0xc37f('0x21')](util['format'](_0xc37f('0x22'),_0x2f1b52[_0xc37f('0x20')],_0x2f1b52['id']),util[_0xc37f('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x51fdea(_0x446b40);});}else{return _0x51fdea(null,_0x1d981f);}},'beforeUpdate':function(_0x1fb6ef,_0x26c406,_0x5954c8){if(_0x1fb6ef[_0xc37f('0xc')](_0xc37f('0xd'))||_0x1fb6ef[_0xc37f('0xc')]('serverUrl')||_0x1fb6ef[_0xc37f('0xc')]('clientId')||_0x1fb6ef['changed'](_0xc37f('0xe'))||_0x1fb6ef[_0xc37f('0xc')](_0xc37f('0xf'))||_0x1fb6ef['changed'](_0xc37f('0x10'))){var _0x4e325f,_0x3be5a8;_0x4e325f=_0x1fb6ef['serverUrl'];var _0x2a3081=_0x4e325f[_0xc37f('0x25')](-0x1);if(_0x2a3081==='/'||_0x2a3081==='\x5c'||_0x2a3081===':'){_0x4e325f=_0x4e325f[_0xc37f('0x26')](0x0,_0x4e325f['lastIndexOf'](_0x2a3081));}switch(_0x1fb6ef[_0xc37f('0xd')]){case'US':_0x3be5a8=_0xc37f('0x12');break;case'AU':_0x3be5a8=_0xc37f('0x27');break;case'IN':_0x3be5a8=_0xc37f('0x13');break;case'CN':_0x3be5a8=_0xc37f('0x14');break;default:_0x3be5a8=_0xc37f('0x15');break;}var _0x4c55ba={'method':_0xc37f('0x28'),'uri':_0x3be5a8+_0xc37f('0x16'),'form':{'grant_type':_0xc37f('0x29'),'client_id':_0x1fb6ef[_0xc37f('0x17')],'client_secret':_0x1fb6ef[_0xc37f('0xe')],'redirect_uri':_0x1fb6ef[_0xc37f('0x11')],'code':_0x1fb6ef[_0xc37f('0xf')]},'headers':{'Content-Type':_0xc37f('0x18')}};return rp(_0x4c55ba)[_0xc37f('0x19')](function(_0x327d2e){var _0xbf3b05=JSON['parse'](_0x327d2e);if(_0xbf3b05[_0xc37f('0x1b')]){_0x1fb6ef[_0xc37f('0x1c')]=_0xbf3b05[_0xc37f('0x1b')];logger[_0xc37f('0x1d')](util['format'](_0xc37f('0x1f'),_0x1fb6ef['name'],_0x1fb6ef['id']));}else{logger[_0xc37f('0x21')](util[_0xc37f('0x1e')](_0xc37f('0x22'),_0x1fb6ef[_0xc37f('0x20')],_0x1fb6ef['id']),util[_0xc37f('0x23')](_0xbf3b05,{'showHidden':![],'depth':null}));}return _0x5954c8(null,_0x26c406);})['catch'](function(_0x3071e2){logger[_0xc37f('0x21')](util[_0xc37f('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1fb6ef[_0xc37f('0x20')],_0x1fb6ef['id']),util[_0xc37f('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5954c8(_0x3071e2);});}else{return _0x5954c8(null,_0x26c406);}}}});}; \ No newline at end of file +var _0x76df=['define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','authorization_code','serverUrl','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','slice','https://accounts.zoho.com','https://accounts.zoho.com.cn','/oauth/v2/token','application/x-www-form-urlencoded','then','info','lodash','api','moment','bluebird','request-promise','path','./intZohoAccount.attributes','exports'];(function(_0x41369d,_0x3dbf85){var _0x592a0d=function(_0x444d09){while(--_0x444d09){_0x41369d['push'](_0x41369d['shift']());}};_0x592a0d(++_0x3dbf85);}(_0x76df,0x73));var _0xf76d=function(_0x7671bc,_0x171145){_0x7671bc=_0x7671bc-0x0;var _0x55229f=_0x76df[_0x7671bc];return _0x55229f;};'use strict';var _=require(_0xf76d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf76d('0x1'));var moment=require(_0xf76d('0x2'));var BPromise=require(_0xf76d('0x3'));var rp=require(_0xf76d('0x4'));var fs=require('fs');var path=require(_0xf76d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf76d('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xf76d('0x7')]=function(_0x36a70c,_0x25336c){return _0x36a70c[_0xf76d('0x8')](_0xf76d('0x9'),attributes,{'tableName':_0xf76d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4023f7,_0x425401,_0x20a1d2){if(_0x4023f7[_0xf76d('0xb')](_0xf76d('0xc'))||_0x4023f7[_0xf76d('0xb')]('serverUrl')||_0x4023f7[_0xf76d('0xb')](_0xf76d('0xd'))||_0x4023f7[_0xf76d('0xb')](_0xf76d('0xe'))||_0x4023f7['changed'](_0xf76d('0xf'))||_0x4023f7[_0xf76d('0xb')]('host')){var _0x1d9a6b,_0x2db8cf;_0x1d9a6b=_0x4023f7['serverUrl'];var _0x2c2557=_0x1d9a6b['slice'](-0x1);if(_0x2c2557==='/'||_0x2c2557==='\x5c'||_0x2c2557===':'){_0x1d9a6b=_0x1d9a6b[_0xf76d('0x10')](0x0,_0x1d9a6b[_0xf76d('0x11')](_0x2c2557));}switch(_0x4023f7[_0xf76d('0xc')]){case'US':_0x2db8cf='https://accounts.zoho.com';break;case'AU':_0x2db8cf=_0xf76d('0x12');break;case'IN':_0x2db8cf=_0xf76d('0x13');break;case'CN':_0x2db8cf='https://accounts.zoho.com.cn';break;default:_0x2db8cf=_0xf76d('0x14');break;}var _0x536ec4={'method':'POST','uri':_0x2db8cf+'/oauth/v2/token','form':{'grant_type':_0xf76d('0x15'),'client_id':_0x4023f7['clientId'],'client_secret':_0x4023f7[_0xf76d('0xe')],'redirect_uri':_0x4023f7[_0xf76d('0x16')],'code':_0x4023f7[_0xf76d('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x536ec4)['then'](function(_0xaed691){var _0xc191c0=JSON[_0xf76d('0x17')](_0xaed691);if(_0xc191c0[_0xf76d('0x18')]){_0x4023f7[_0xf76d('0x19')]=_0xc191c0[_0xf76d('0x18')];logger['info'](util[_0xf76d('0x1a')](_0xf76d('0x1b'),_0x4023f7[_0xf76d('0x1c')],_0x4023f7['id']));}else{logger[_0xf76d('0x1d')](util[_0xf76d('0x1a')](_0xf76d('0x1e'),_0x4023f7[_0xf76d('0x1c')],_0x4023f7['id']),util[_0xf76d('0x1f')](_0xc191c0,{'showHidden':![],'depth':null}));}return _0x20a1d2(null,_0x425401);})[_0xf76d('0x20')](function(_0x5c0e82){logger[_0xf76d('0x1d')](util[_0xf76d('0x1a')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4023f7[_0xf76d('0x1c')],_0x4023f7['id']),util[_0xf76d('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x20a1d2(_0x5c0e82);});}else{return _0x20a1d2(null,_0x425401);}},'beforeUpdate':function(_0x220f78,_0x5e4915,_0x51cd1a){if(_0x220f78[_0xf76d('0xb')](_0xf76d('0xc'))||_0x220f78[_0xf76d('0xb')]('serverUrl')||_0x220f78['changed'](_0xf76d('0xd'))||_0x220f78[_0xf76d('0xb')](_0xf76d('0xe'))||_0x220f78[_0xf76d('0xb')](_0xf76d('0xf'))||_0x220f78[_0xf76d('0xb')](_0xf76d('0x21'))){var _0x586426,_0x391440;_0x586426=_0x220f78[_0xf76d('0x16')];var _0x8830d0=_0x586426[_0xf76d('0x22')](-0x1);if(_0x8830d0==='/'||_0x8830d0==='\x5c'||_0x8830d0===':'){_0x586426=_0x586426[_0xf76d('0x10')](0x0,_0x586426[_0xf76d('0x11')](_0x8830d0));}switch(_0x220f78[_0xf76d('0xc')]){case'US':_0x391440=_0xf76d('0x23');break;case'AU':_0x391440=_0xf76d('0x12');break;case'IN':_0x391440='https://accounts.zoho.in';break;case'CN':_0x391440=_0xf76d('0x24');break;default:_0x391440=_0xf76d('0x14');break;}var _0x39678b={'method':'POST','uri':_0x391440+_0xf76d('0x25'),'form':{'grant_type':'authorization_code','client_id':_0x220f78[_0xf76d('0xd')],'client_secret':_0x220f78[_0xf76d('0xe')],'redirect_uri':_0x220f78[_0xf76d('0x16')],'code':_0x220f78[_0xf76d('0xf')]},'headers':{'Content-Type':_0xf76d('0x26')}};return rp(_0x39678b)[_0xf76d('0x27')](function(_0x226f62){var _0x515e06=JSON[_0xf76d('0x17')](_0x226f62);if(_0x515e06[_0xf76d('0x18')]){_0x220f78[_0xf76d('0x19')]=_0x515e06[_0xf76d('0x18')];logger[_0xf76d('0x28')](util[_0xf76d('0x1a')](_0xf76d('0x1b'),_0x220f78[_0xf76d('0x1c')],_0x220f78['id']));}else{logger['error'](util[_0xf76d('0x1a')](_0xf76d('0x1e'),_0x220f78[_0xf76d('0x1c')],_0x220f78['id']),util[_0xf76d('0x1f')](_0x515e06,{'showHidden':![],'depth':null}));}return _0x51cd1a(null,_0x5e4915);})[_0xf76d('0x20')](function(_0x266eb1){logger[_0xf76d('0x1d')](util[_0xf76d('0x1a')](_0xf76d('0x1e'),_0x220f78['name'],_0x220f78['id']),util[_0xf76d('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x51cd1a(_0x266eb1);});}else{return _0x51cd1a(null,_0x5e4915);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b0af86f..5feaa84 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 _0xf920=['client','request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ZohoAccount','findAll','options','where','attributes','include','map','model','GetZohoAccount','debug','ShowZohoAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf920,0x1e5));var _0x0f92=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0xf920[_0x212fcc];return _0x4d8190;};'use strict';var _=require(_0x0f92('0x0'));var util=require(_0x0f92('0x1'));var moment=require(_0x0f92('0x2'));var BPromise=require(_0x0f92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f92('0x4'));var db=require(_0x0f92('0x5'))['db'];var utils=require(_0x0f92('0x6'));var logger=require(_0x0f92('0x7'))(_0x0f92('0x8'));var config=require(_0x0f92('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0f92('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c41d2,_0x31f4de,_0x28c58a){return new BPromise(function(_0x4c4a10,_0x51365a){return client[_0x0f92('0xb')](_0x3c41d2,_0x28c58a)[_0x0f92('0xc')](function(_0x523616){logger[_0x0f92('0xd')](_0x0f92('0xe'),_0x31f4de,'request\x20sent');logger['debug'](_0x0f92('0xf'),_0x31f4de,_0x0f92('0x10'),JSON[_0x0f92('0x11')](_0x523616));if(_0x523616['error']){if(_0x523616[_0x0f92('0x12')][_0x0f92('0x13')]===0x1f4){logger[_0x0f92('0x12')](_0x0f92('0xe'),_0x31f4de,_0x523616[_0x0f92('0x12')]['message']);return _0x51365a(_0x523616[_0x0f92('0x12')][_0x0f92('0x14')]);}logger[_0x0f92('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x31f4de,_0x523616['error'][_0x0f92('0x14')]);return _0x4c4a10(_0x523616[_0x0f92('0x12')][_0x0f92('0x14')]);}else{logger[_0x0f92('0xd')](_0x0f92('0xe'),_0x31f4de,_0x0f92('0x10'));_0x4c4a10(_0x523616['result'][_0x0f92('0x14')]);}})[_0x0f92('0x15')](function(_0x5d2282){logger[_0x0f92('0x12')](_0x0f92('0xe'),_0x31f4de,_0x5d2282);_0x51365a(_0x5d2282);});});}exports['GetZohoAccount']=function(_0x30457e){var _0x379b5d=this;return new Promise(function(_0xc3ecfb,_0x255fc4){return db[_0x0f92('0x16')][_0x0f92('0x17')]({'raw':_0x30457e[_0x0f92('0x18')]?_0x30457e[_0x0f92('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x30457e[_0x0f92('0x18')]?_0x30457e[_0x0f92('0x18')][_0x0f92('0x19')]||null:null,'attributes':_0x30457e[_0x0f92('0x18')]?_0x30457e[_0x0f92('0x18')][_0x0f92('0x1a')]||null:null,'limit':_0x30457e[_0x0f92('0x18')]?_0x30457e['options']['limit']||null:null,'include':_0x30457e[_0x0f92('0x18')]?_0x30457e[_0x0f92('0x18')][_0x0f92('0x1b')]?_[_0x0f92('0x1c')](_0x30457e[_0x0f92('0x18')][_0x0f92('0x1b')],function(_0x11833d){return{'model':db[_0x11833d[_0x0f92('0x1d')]],'as':_0x11833d['as'],'attributes':_0x11833d[_0x0f92('0x1a')],'include':_0x11833d['include']?_[_0x0f92('0x1c')](_0x11833d[_0x0f92('0x1b')],function(_0x29c469){return{'model':db[_0x29c469[_0x0f92('0x1d')]],'as':_0x29c469['as'],'attributes':_0x29c469['attributes'],'include':_0x29c469[_0x0f92('0x1b')]?_['map'](_0x29c469[_0x0f92('0x1b')],function(_0x17dae3){return{'model':db[_0x17dae3['model']],'as':_0x17dae3['as'],'attributes':_0x17dae3[_0x0f92('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a4959){logger[_0x0f92('0xd')](_0x0f92('0x1e'),_0x30457e);logger[_0x0f92('0x1f')]('GetZohoAccount',_0x30457e,JSON[_0x0f92('0x11')](_0x4a4959));_0xc3ecfb(_0x4a4959);})[_0x0f92('0x15')](function(_0x19704c){logger[_0x0f92('0x12')]('GetZohoAccount',_0x19704c[_0x0f92('0x14')],_0x30457e);_0x255fc4(_0x379b5d['error'](0x1f4,_0x19704c[_0x0f92('0x14')]));});});};exports[_0x0f92('0x20')]=function(_0x497d19){var _0x124c3e=this;return new Promise(function(_0x243b02,_0xcb55d7){return db[_0x0f92('0x16')]['find']({'raw':_0x497d19[_0x0f92('0x18')]?_0x497d19[_0x0f92('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x497d19[_0x0f92('0x18')]?_0x497d19[_0x0f92('0x18')]['where']||null:null,'attributes':_0x497d19[_0x0f92('0x18')]?_0x497d19['options'][_0x0f92('0x1a')]||null:null,'include':_0x497d19['options']?_0x497d19['options'][_0x0f92('0x1b')]?_['map'](_0x497d19['options']['include'],function(_0x3a98b8){return{'model':db[_0x3a98b8['model']],'as':_0x3a98b8['as'],'attributes':_0x3a98b8[_0x0f92('0x1a')],'include':_0x3a98b8['include']?_['map'](_0x3a98b8[_0x0f92('0x1b')],function(_0x39ab9e){return{'model':db[_0x39ab9e[_0x0f92('0x1d')]],'as':_0x39ab9e['as'],'attributes':_0x39ab9e['attributes'],'include':_0x39ab9e[_0x0f92('0x1b')]?_[_0x0f92('0x1c')](_0x39ab9e[_0x0f92('0x1b')],function(_0x389fd2){return{'model':db[_0x389fd2['model']],'as':_0x389fd2['as'],'attributes':_0x389fd2[_0x0f92('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0f92('0xc')](function(_0x26299c){logger[_0x0f92('0xd')]('ShowZohoAccount',_0x497d19);logger[_0x0f92('0x1f')]('ShowZohoAccount',_0x497d19,JSON['stringify'](_0x26299c));_0x243b02(_0x26299c);})[_0x0f92('0x15')](function(_0x1a6faa){logger[_0x0f92('0x12')](_0x0f92('0x20'),_0x1a6faa[_0x0f92('0x14')],_0x497d19);_0xcb55d7(_0x124c3e[_0x0f92('0x12')](0x1f4,_0x1a6faa[_0x0f92('0x14')]));});});}; \ No newline at end of file +var _0x9470=['stringify','catch','ShowZohoAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','model','include'];(function(_0x237f2c,_0xb75485){var _0x20ee85=function(_0x5a2a1b){while(--_0x5a2a1b){_0x237f2c['push'](_0x237f2c['shift']());}};_0x20ee85(++_0xb75485);}(_0x9470,0x98));var _0x0947=function(_0x48b5f9,_0x585cfb){_0x48b5f9=_0x48b5f9-0x0;var _0x55ae7a=_0x9470[_0x48b5f9];return _0x55ae7a;};'use strict';var _=require(_0x0947('0x0'));var util=require(_0x0947('0x1'));var moment=require(_0x0947('0x2'));var BPromise=require('bluebird');var rs=require(_0x0947('0x3'));var fs=require('fs');var Redis=require(_0x0947('0x4'));var db=require(_0x0947('0x5'))['db'];var utils=require(_0x0947('0x6'));var logger=require(_0x0947('0x7'))(_0x0947('0x8'));var config=require('../../config/environment');var jayson=require(_0x0947('0x9'));var client=jayson[_0x0947('0xa')][_0x0947('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8937,_0x445934,_0x1f46aa){return new BPromise(function(_0x260a60,_0x126458){return client[_0x0947('0xc')](_0x4a8937,_0x1f46aa)[_0x0947('0xd')](function(_0x3e0129){logger[_0x0947('0xe')](_0x0947('0xf'),_0x445934,_0x0947('0x10'));logger[_0x0947('0x11')](_0x0947('0x12'),_0x445934,'request\x20sent',JSON['stringify'](_0x3e0129));if(_0x3e0129[_0x0947('0x13')]){if(_0x3e0129[_0x0947('0x13')]['code']===0x1f4){logger['error'](_0x0947('0xf'),_0x445934,_0x3e0129[_0x0947('0x13')][_0x0947('0x14')]);return _0x126458(_0x3e0129[_0x0947('0x13')][_0x0947('0x14')]);}logger[_0x0947('0x13')](_0x0947('0xf'),_0x445934,_0x3e0129['error'][_0x0947('0x14')]);return _0x260a60(_0x3e0129['error'][_0x0947('0x14')]);}else{logger['info'](_0x0947('0xf'),_0x445934,_0x0947('0x10'));_0x260a60(_0x3e0129[_0x0947('0x15')]['message']);}})['catch'](function(_0x44ce64){logger[_0x0947('0x13')](_0x0947('0xf'),_0x445934,_0x44ce64);_0x126458(_0x44ce64);});});}exports[_0x0947('0x16')]=function(_0x1c841f){var _0x4d3892=this;return new Promise(function(_0x3ffce1,_0xc39e47){return db[_0x0947('0x17')][_0x0947('0x18')]({'raw':_0x1c841f[_0x0947('0x19')]?_0x1c841f[_0x0947('0x19')][_0x0947('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c841f[_0x0947('0x19')]?_0x1c841f[_0x0947('0x19')][_0x0947('0x1b')]||null:null,'attributes':_0x1c841f['options']?_0x1c841f[_0x0947('0x19')][_0x0947('0x1c')]||null:null,'limit':_0x1c841f['options']?_0x1c841f[_0x0947('0x19')][_0x0947('0x1d')]||null:null,'include':_0x1c841f[_0x0947('0x19')]?_0x1c841f[_0x0947('0x19')]['include']?_[_0x0947('0x1e')](_0x1c841f[_0x0947('0x19')]['include'],function(_0x427448){return{'model':db[_0x427448[_0x0947('0x1f')]],'as':_0x427448['as'],'attributes':_0x427448[_0x0947('0x1c')],'include':_0x427448['include']?_[_0x0947('0x1e')](_0x427448[_0x0947('0x20')],function(_0x3e0882){return{'model':db[_0x3e0882[_0x0947('0x1f')]],'as':_0x3e0882['as'],'attributes':_0x3e0882[_0x0947('0x1c')],'include':_0x3e0882[_0x0947('0x20')]?_['map'](_0x3e0882['include'],function(_0x12b38b){return{'model':db[_0x12b38b['model']],'as':_0x12b38b['as'],'attributes':_0x12b38b[_0x0947('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0947('0xd')](function(_0x5f555b){logger[_0x0947('0xe')]('GetZohoAccount',_0x1c841f);logger[_0x0947('0x11')]('GetZohoAccount',_0x1c841f,JSON[_0x0947('0x21')](_0x5f555b));_0x3ffce1(_0x5f555b);})[_0x0947('0x22')](function(_0x1f4a24){logger[_0x0947('0x13')](_0x0947('0x16'),_0x1f4a24[_0x0947('0x14')],_0x1c841f);_0xc39e47(_0x4d3892[_0x0947('0x13')](0x1f4,_0x1f4a24[_0x0947('0x14')]));});});};exports[_0x0947('0x23')]=function(_0x26cf5a){var _0x138b09=this;return new Promise(function(_0x30b527,_0x1926f4){return db['ZohoAccount'][_0x0947('0x24')]({'raw':_0x26cf5a[_0x0947('0x19')]?_0x26cf5a[_0x0947('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x26cf5a[_0x0947('0x19')]?_0x26cf5a[_0x0947('0x19')]['where']||null:null,'attributes':_0x26cf5a[_0x0947('0x19')]?_0x26cf5a[_0x0947('0x19')][_0x0947('0x1c')]||null:null,'include':_0x26cf5a[_0x0947('0x19')]?_0x26cf5a[_0x0947('0x19')][_0x0947('0x20')]?_['map'](_0x26cf5a[_0x0947('0x19')][_0x0947('0x20')],function(_0xaa8c91){return{'model':db[_0xaa8c91[_0x0947('0x1f')]],'as':_0xaa8c91['as'],'attributes':_0xaa8c91['attributes'],'include':_0xaa8c91[_0x0947('0x20')]?_['map'](_0xaa8c91[_0x0947('0x20')],function(_0x352c8b){return{'model':db[_0x352c8b['model']],'as':_0x352c8b['as'],'attributes':_0x352c8b['attributes'],'include':_0x352c8b['include']?_[_0x0947('0x1e')](_0x352c8b[_0x0947('0x20')],function(_0x4d3f64){return{'model':db[_0x4d3f64['model']],'as':_0x4d3f64['as'],'attributes':_0x4d3f64['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dfb7c){logger[_0x0947('0xe')](_0x0947('0x23'),_0x26cf5a);logger['debug']('ShowZohoAccount',_0x26cf5a,JSON[_0x0947('0x21')](_0x2dfb7c));_0x30b527(_0x2dfb7c);})[_0x0947('0x22')](function(_0x2e5d4c){logger[_0x0947('0x13')](_0x0947('0x23'),_0x2e5d4c[_0x0947('0x14')],_0x26cf5a);_0x1926f4(_0x138b09[_0x0947('0x13')](0x1f4,_0x2e5d4c[_0x0947('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 51fd48c..6b2e061 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 _0x9656=['post','create','delete','/:id','exports','multer','path','connect-timeout','Router','./intZohoConfiguration.controller','isAuthenticated','get','show','getFields','/:id/descriptions'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0x9656,0x15e));var _0x6965=function(_0x51d0c2,_0x1eb50c){_0x51d0c2=_0x51d0c2-0x0;var _0x3bbe0a=_0x9656[_0x51d0c2];return _0x3bbe0a;};'use strict';var multer=require(_0x6965('0x0'));var util=require('util');var path=require(_0x6965('0x1'));var timeout=require(_0x6965('0x2'));var express=require('express');var router=express[_0x6965('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6965('0x4'));router['get']('/',auth[_0x6965('0x5')](),controller['index']);router[_0x6965('0x6')]('/:id',auth[_0x6965('0x5')](),controller[_0x6965('0x7')]);router['get']('/:id/fields',auth[_0x6965('0x5')](),controller[_0x6965('0x8')]);router[_0x6965('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x6965('0x6')](_0x6965('0x9'),auth[_0x6965('0x5')](),controller['getDescriptions']);router[_0x6965('0xa')]('/',auth[_0x6965('0x5')](),controller[_0x6965('0xb')]);router['put']('/:id',auth[_0x6965('0x5')](),controller['update']);router[_0x6965('0xc')](_0x6965('0xd'),auth[_0x6965('0x5')](),controller['destroy']);module[_0x6965('0xe')]=router; \ No newline at end of file +var _0xdadd=['../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','exports','multer','path','express','Router'];(function(_0x37872a,_0xdec874){var _0x5a5300=function(_0x1c2d7a){while(--_0x1c2d7a){_0x37872a['push'](_0x37872a['shift']());}};_0x5a5300(++_0xdec874);}(_0xdadd,0x1c8));var _0xddad=function(_0x341095,_0x4b00e6){_0x341095=_0x341095-0x0;var _0x51e224=_0xdadd[_0x341095];return _0x51e224;};'use strict';var multer=require(_0xddad('0x0'));var util=require('util');var path=require(_0xddad('0x1'));var timeout=require('connect-timeout');var express=require(_0xddad('0x2'));var router=express[_0xddad('0x3')]();var auth=require(_0xddad('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xddad('0x5'));var controller=require(_0xddad('0x6'));router[_0xddad('0x7')]('/',auth[_0xddad('0x8')](),controller['index']);router['get'](_0xddad('0x9'),auth[_0xddad('0x8')](),controller['show']);router[_0xddad('0x7')](_0xddad('0xa'),auth[_0xddad('0x8')](),controller[_0xddad('0xb')]);router[_0xddad('0x7')](_0xddad('0xc'),auth[_0xddad('0x8')](),controller[_0xddad('0xd')]);router[_0xddad('0x7')]('/:id/descriptions',auth[_0xddad('0x8')](),controller[_0xddad('0xe')]);router[_0xddad('0xf')]('/',auth['isAuthenticated'](),controller[_0xddad('0x10')]);router['put'](_0xddad('0x9'),auth[_0xddad('0x8')](),controller[_0xddad('0x11')]);router[_0xddad('0x12')](_0xddad('0x9'),auth[_0xddad('0x8')](),controller['destroy']);module[_0xddad('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2217fc0..3d0ef8d 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 _0x0a01=['exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0xff480c,_0x5cb70a){var _0x443135=function(_0x568635){while(--_0x568635){_0xff480c['push'](_0xff480c['shift']());}};_0x443135(++_0x5cb70a);}(_0x0a01,0x85));var _0x10a0=function(_0x34683e,_0x46427f){_0x34683e=_0x34683e-0x0;var _0x33c7f8=_0x0a01[_0x34683e];return _0x33c7f8;};'use strict';var Sequelize=require('sequelize');module[_0x10a0('0x0')]={'name':{'type':Sequelize[_0x10a0('0x1')]},'moduleCreate':{'type':Sequelize[_0x10a0('0x2')](_0x10a0('0x3'),_0x10a0('0x4'),_0x10a0('0x5')),'defaultValue':_0x10a0('0x3')},'moduleSearch':{'type':Sequelize[_0x10a0('0x2')](_0x10a0('0x6'),_0x10a0('0x4'),_0x10a0('0x3')),'defaultValue':_0x10a0('0x6')},'description':{'type':Sequelize[_0x10a0('0x1')]}}; \ No newline at end of file +var _0x85f6=['contact','ENUM','contact_lead','sequelize','STRING','lead'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x85f6,0x11d));var _0x685f=function(_0x747415,_0x304ca2){_0x747415=_0x747415-0x0;var _0x2c9dc8=_0x85f6[_0x747415];return _0x2c9dc8;};'use strict';var Sequelize=require(_0x685f('0x0'));module['exports']={'name':{'type':Sequelize[_0x685f('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x685f('0x2'),_0x685f('0x3'),'nothing'),'defaultValue':_0x685f('0x2')},'moduleSearch':{'type':Sequelize[_0x685f('0x4')]('contact_lead',_0x685f('0x3'),_0x685f('0x2')),'defaultValue':_0x685f('0x5')},'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 386cf73..cbd93b7 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 _0x6d96=['type','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','ZohoConfiguration','body','ZohoField','getFields','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','json','offset','status','Content-Range','reject','update','destroy','end','sendStatus','stack','index','map','fieldName'];(function(_0x3e7c61,_0xb44529){var _0x41662f=function(_0xbe3f7){while(--_0xbe3f7){_0x3e7c61['push'](_0x3e7c61['shift']());}};_0x41662f(++_0xb44529);}(_0x6d96,0x18e));var _0x66d9=function(_0xa47778,_0x3cd87d){_0xa47778=_0xa47778-0x0;var _0x3a8693=_0x6d96[_0xa47778];return _0x3a8693;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x66d9('0x0'));var rimraf=require(_0x66d9('0x1'));var zipdir=require(_0x66d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66d9('0x3'));var moment=require(_0x66d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x66d9('0x5'));var util=require(_0x66d9('0x6'));var path=require(_0x66d9('0x7'));var sox=require('sox');var csv=require(_0x66d9('0x8'));var ejs=require(_0x66d9('0x9'));var fs=require('fs');var _=require(_0x66d9('0xa'));var squel=require('squel');var crypto=require(_0x66d9('0xb'));var jsforce=require(_0x66d9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x66d9('0x8'));var querystring=require(_0x66d9('0xd'));var Papa=require(_0x66d9('0xe'));var Redis=require(_0x66d9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x66d9('0x10'));var as=require(_0x66d9('0x11'));var hardwareService=require(_0x66d9('0x12'));var logger=require(_0x66d9('0x13'))(_0x66d9('0x14'));var utils=require(_0x66d9('0x15'));var config=require('../../config/environment');var db=require(_0x66d9('0x16'))['db'];var jayson=require(_0x66d9('0x17'));var client=jayson[_0x66d9('0x18')][_0x66d9('0x19')]({'port':0x232a});function checkPasswordPattern(_0x20244f,_0x59277d,_0x18a529){if(_0x18a529){var _0x5e6ed6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e6ed6['test'](_0x59277d)){return _0x20244f;}else{throw new db[(_0x66d9('0x1a'))][(_0x66d9('0x1b'))](_0x66d9('0x1c'));}}else{return _0x20244f;}}function respondWithRpcPromise(_0x5943d7,_0x2972c8,_0x2473d7,_0x58f2a1){return new BPromise(function(_0x108fe3,_0x237c68){var _0xfce1c5=_0x58f2a1||client;return _0xfce1c5['request'](_0x5943d7,_0x2473d7)[_0x66d9('0x1d')](function(_0x4559cc){logger[_0x66d9('0x1e')](_0x66d9('0x1f'),_0x2972c8,_0x66d9('0x20'));logger[_0x66d9('0x21')](_0x66d9('0x22'),_0x2972c8,_0x66d9('0x20'),JSON['stringify'](_0x4559cc));if(_0x4559cc['error']){if(_0x4559cc[_0x66d9('0x23')]['code']===0x1f4){logger[_0x66d9('0x23')](_0x66d9('0x1f'),_0x2972c8,_0x4559cc[_0x66d9('0x23')][_0x66d9('0x24')]);return _0x237c68(_0x4559cc[_0x66d9('0x23')][_0x66d9('0x24')]);}logger['error'](_0x66d9('0x1f'),_0x2972c8,_0x4559cc[_0x66d9('0x23')]['message']);return _0x108fe3(_0x4559cc['error'][_0x66d9('0x24')]);}else{logger['info'](_0x66d9('0x1f'),_0x2972c8,'request\x20sent');_0x108fe3(_0x4559cc[_0x66d9('0x25')][_0x66d9('0x24')]);}})[_0x66d9('0x26')](function(_0x24fa11){logger[_0x66d9('0x23')](_0x66d9('0x1f'),_0x2972c8,_0x24fa11);_0x237c68(_0x24fa11);});});}function respondWithStatusCode(_0x4fa723,_0x333d47){_0x333d47=_0x333d47||0xcc;return function(_0x2010f5){if(_0x2010f5){return _0x4fa723['sendStatus'](_0x333d47);}return _0x4fa723['status'](_0x333d47)['end']();};}function respondWithResult(_0x3a293c,_0x1e7419){_0x1e7419=_0x1e7419||0xc8;return function(_0x245ff8){if(_0x245ff8){return _0x3a293c['status'](_0x1e7419)[_0x66d9('0x27')](_0x245ff8);}};}function respondWithFilteredResult(_0x147771,_0x47705d){return function(_0x132b3d){if(_0x132b3d){var _0x2a209b=_0x132b3d['count'],_0x49ab18=_0x47705d[_0x66d9('0x28')],_0x2fdc4d=_0x47705d[_0x66d9('0x28')]+_0x47705d['limit'],_0x16924b;if(_0x2fdc4d>=_0x2a209b){_0x2fdc4d=_0x2a209b;_0x16924b=0xc8;}else{_0x16924b=0xce;}_0x147771[_0x66d9('0x29')](_0x16924b);return _0x147771['set'](_0x66d9('0x2a'),_0x49ab18+'-'+_0x2fdc4d+'/'+_0x2a209b)['json'](_0x132b3d);}return null;};}function patchUpdates(_0x42c04a){return function(_0x558a86){try{jsonpatch['apply'](_0x558a86,_0x42c04a,!![]);}catch(_0x165bdc){return BPromise[_0x66d9('0x2b')](_0x165bdc);}return _0x558a86['save']();};}function saveUpdates(_0x3f62c9,_0x44542b){return function(_0x55da3d){if(_0x55da3d){return _0x55da3d[_0x66d9('0x2c')](_0x3f62c9)[_0x66d9('0x1d')](function(_0x70dcbd){return _0x70dcbd;});}return null;};}function removeEntity(_0x5f0e32,_0x44071d){return function(_0x1dcd54){if(_0x1dcd54){return _0x1dcd54[_0x66d9('0x2d')]()[_0x66d9('0x1d')](function(){_0x5f0e32[_0x66d9('0x29')](0xcc)[_0x66d9('0x2e')]();});}};}function handleEntityNotFound(_0x651090,_0x5f1a8d){return function(_0x4b6525){if(!_0x4b6525){_0x651090[_0x66d9('0x2f')](0x194);}return _0x4b6525;};}function handleError(_0x43b2fa,_0x728804){_0x728804=_0x728804||0x1f4;return function(_0x3c25f8){logger[_0x66d9('0x23')](_0x3c25f8[_0x66d9('0x30')]);if(_0x3c25f8['name']){delete _0x3c25f8['name'];}_0x43b2fa[_0x66d9('0x29')](_0x728804)['send'](_0x3c25f8);};}exports[_0x66d9('0x31')]=function(_0x3bc4d5,_0x38dd2b){var _0x241d92={},_0x1fca60={},_0xe7392d={'count':0x0,'rows':[]};var _0x4a9760=_[_0x66d9('0x32')](db['ZohoConfiguration']['rawAttributes'],function(_0x4433fb){return{'name':_0x4433fb[_0x66d9('0x33')],'type':_0x4433fb[_0x66d9('0x34')]['key']};});_0x1fca60[_0x66d9('0x35')]=_[_0x66d9('0x32')](_0x4a9760,_0x66d9('0x36'));_0x1fca60['query']=_[_0x66d9('0x37')](_0x3bc4d5[_0x66d9('0x38')]);_0x1fca60['filters']=_[_0x66d9('0x39')](_0x1fca60[_0x66d9('0x35')],_0x1fca60[_0x66d9('0x38')]);_0x241d92['attributes']=_['intersection'](_0x1fca60[_0x66d9('0x35')],qs[_0x66d9('0x3a')](_0x3bc4d5[_0x66d9('0x38')][_0x66d9('0x3a')]));_0x241d92[_0x66d9('0x3b')]=_0x241d92[_0x66d9('0x3b')][_0x66d9('0x3c')]?_0x241d92[_0x66d9('0x3b')]:_0x1fca60[_0x66d9('0x35')];if(!_0x3bc4d5[_0x66d9('0x38')][_0x66d9('0x3d')]('nolimit')){_0x241d92[_0x66d9('0x3e')]=qs[_0x66d9('0x3e')](_0x3bc4d5[_0x66d9('0x38')][_0x66d9('0x3e')]);_0x241d92[_0x66d9('0x28')]=qs[_0x66d9('0x28')](_0x3bc4d5[_0x66d9('0x38')][_0x66d9('0x28')]);}_0x241d92[_0x66d9('0x3f')]=qs[_0x66d9('0x40')](_0x3bc4d5['query'][_0x66d9('0x40')]);_0x241d92[_0x66d9('0x41')]=qs['filters'](_[_0x66d9('0x42')](_0x3bc4d5['query'],_0x1fca60[_0x66d9('0x43')]),_0x4a9760);if(_0x3bc4d5[_0x66d9('0x38')][_0x66d9('0x44')]){_0x241d92[_0x66d9('0x41')]=_[_0x66d9('0x45')](_0x241d92[_0x66d9('0x41')],{'$or':_[_0x66d9('0x32')](_0x4a9760,function(_0x48213b){if(_0x48213b[_0x66d9('0x34')]!==_0x66d9('0x46')){var _0x2ecf9a={};_0x2ecf9a[_0x48213b['name']]={'$like':'%'+_0x3bc4d5['query'][_0x66d9('0x44')]+'%'};return _0x2ecf9a;}})});}_0x241d92=_[_0x66d9('0x45')]({},_0x241d92,_0x3bc4d5[_0x66d9('0x47')]);var _0x49a5e4={'where':_0x241d92[_0x66d9('0x41')]};return db['ZohoConfiguration']['count'](_0x49a5e4)[_0x66d9('0x1d')](function(_0x46bc15){_0xe7392d[_0x66d9('0x48')]=_0x46bc15;if(_0x3bc4d5[_0x66d9('0x38')][_0x66d9('0x49')]){_0x241d92[_0x66d9('0x4a')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x66d9('0x4b')](_0x241d92);})['then'](function(_0xbd25bf){_0xe7392d[_0x66d9('0x4c')]=_0xbd25bf;return _0xe7392d;})[_0x66d9('0x1d')](respondWithFilteredResult(_0x38dd2b,_0x241d92))['catch'](handleError(_0x38dd2b,null));};exports[_0x66d9('0x4d')]=function(_0xe9090b,_0x13f190){var _0x2c4afd={'raw':![],'where':{'id':_0xe9090b[_0x66d9('0x4e')]['id']}},_0x8ee2a8={};_0x8ee2a8['model']=_[_0x66d9('0x37')](db['ZohoConfiguration'][_0x66d9('0x4f')]);_0x8ee2a8[_0x66d9('0x38')]=_[_0x66d9('0x37')](_0xe9090b[_0x66d9('0x38')]);_0x8ee2a8[_0x66d9('0x43')]=_[_0x66d9('0x39')](_0x8ee2a8[_0x66d9('0x35')],_0x8ee2a8[_0x66d9('0x38')]);_0x2c4afd[_0x66d9('0x3b')]=_[_0x66d9('0x39')](_0x8ee2a8[_0x66d9('0x35')],qs[_0x66d9('0x3a')](_0xe9090b[_0x66d9('0x38')][_0x66d9('0x3a')]));_0x2c4afd[_0x66d9('0x3b')]=_0x2c4afd[_0x66d9('0x3b')][_0x66d9('0x3c')]?_0x2c4afd[_0x66d9('0x3b')]:_0x8ee2a8[_0x66d9('0x35')];if(_0xe9090b[_0x66d9('0x38')][_0x66d9('0x49')]){_0x2c4afd['include']=[{'all':!![]}];}_0x2c4afd=_[_0x66d9('0x45')]({},_0x2c4afd,_0xe9090b['options']);return db['ZohoConfiguration'][_0x66d9('0x50')](_0x2c4afd)['then'](handleEntityNotFound(_0x13f190,null))[_0x66d9('0x1d')](respondWithResult(_0x13f190,null))[_0x66d9('0x26')](handleError(_0x13f190,null));};exports[_0x66d9('0x51')]=function(_0x31ae7e,_0x3ec073){return db[_0x66d9('0x52')][_0x66d9('0x51')](_0x31ae7e['body'],{})[_0x66d9('0x1d')](respondWithResult(_0x3ec073,0xc9))['catch'](handleError(_0x3ec073,null));};exports['update']=function(_0x46e49a,_0x2b79f9){if(_0x46e49a[_0x66d9('0x53')]['id']){delete _0x46e49a[_0x66d9('0x53')]['id'];}return db[_0x66d9('0x52')][_0x66d9('0x50')]({'where':{'id':_0x46e49a[_0x66d9('0x4e')]['id']}})[_0x66d9('0x1d')](handleEntityNotFound(_0x2b79f9,null))[_0x66d9('0x1d')](saveUpdates(_0x46e49a[_0x66d9('0x53')],null))[_0x66d9('0x1d')](respondWithResult(_0x2b79f9,null))[_0x66d9('0x26')](handleError(_0x2b79f9,null));};exports[_0x66d9('0x2d')]=function(_0x101857,_0x116b22){return db[_0x66d9('0x52')][_0x66d9('0x50')]({'where':{'id':_0x101857[_0x66d9('0x4e')]['id']}})[_0x66d9('0x1d')](handleEntityNotFound(_0x116b22,null))[_0x66d9('0x1d')](removeEntity(_0x116b22,null))['catch'](handleError(_0x116b22,null));};exports['getFields']=function(_0x48e0cf,_0x7656a0,_0x10f5c6){var _0x1964a4={};var _0x2d57d7={};var _0x179b86;var _0x12383f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x48e0cf[_0x66d9('0x4e')]['id']}})[_0x66d9('0x1d')](handleEntityNotFound(_0x7656a0,null))[_0x66d9('0x1d')](function(_0xc39008){if(_0xc39008){_0x179b86=_0xc39008;_0x2d57d7[_0x66d9('0x35')]=_[_0x66d9('0x37')](db[_0x66d9('0x54')][_0x66d9('0x4f')]);_0x2d57d7['query']=_['keys'](_0x48e0cf['query']);_0x2d57d7[_0x66d9('0x43')]=_[_0x66d9('0x39')](_0x2d57d7[_0x66d9('0x35')],_0x2d57d7[_0x66d9('0x38')]);_0x1964a4[_0x66d9('0x3b')]=_[_0x66d9('0x39')](_0x2d57d7[_0x66d9('0x35')],qs[_0x66d9('0x3a')](_0x48e0cf['query'][_0x66d9('0x3a')]));_0x1964a4[_0x66d9('0x3b')]=_0x1964a4[_0x66d9('0x3b')][_0x66d9('0x3c')]?_0x1964a4[_0x66d9('0x3b')]:_0x2d57d7[_0x66d9('0x35')];_0x1964a4['order']=qs[_0x66d9('0x40')](_0x48e0cf[_0x66d9('0x38')][_0x66d9('0x40')]);_0x1964a4[_0x66d9('0x41')]=qs[_0x66d9('0x43')](_[_0x66d9('0x42')](_0x48e0cf[_0x66d9('0x38')],_0x2d57d7['filters']));if(_0x48e0cf[_0x66d9('0x38')][_0x66d9('0x44')]){_0x1964a4['where']=_[_0x66d9('0x45')](_0x1964a4[_0x66d9('0x41')],{'$or':_[_0x66d9('0x32')](_0x1964a4['attributes'],function(_0x43b06c){var _0x390924={};_0x390924[_0x43b06c]={'$like':'%'+_0x48e0cf['query'][_0x66d9('0x44')]+'%'};return _0x390924;})});}_0x1964a4=_[_0x66d9('0x45')]({},_0x1964a4,_0x48e0cf[_0x66d9('0x47')]);return _0x179b86[_0x66d9('0x55')](_0x1964a4);}})[_0x66d9('0x1d')](function(_0x57f6db){if(_0x57f6db){_0x12383f=_0x57f6db[_0x66d9('0x3c')];if(!_0x48e0cf['query']['hasOwnProperty'](_0x66d9('0x56'))){_0x1964a4[_0x66d9('0x3e')]=qs[_0x66d9('0x3e')](_0x48e0cf[_0x66d9('0x38')][_0x66d9('0x3e')]);_0x1964a4[_0x66d9('0x28')]=qs[_0x66d9('0x28')](_0x48e0cf['query'][_0x66d9('0x28')]);}return _0x179b86[_0x66d9('0x55')](_0x1964a4);}})[_0x66d9('0x1d')](function(_0x4b580b){if(_0x4b580b){return _0x4b580b?{'count':_0x12383f,'rows':_0x4b580b}:null;}})['then'](respondWithResult(_0x7656a0,null))[_0x66d9('0x26')](handleError(_0x7656a0,null));};exports[_0x66d9('0x57')]=function(_0x924a3f,_0x479d25,_0x10feaa){var _0x34b21c={};var _0x34b5e4={};var _0x4dddcd;var _0x16d3af;return db[_0x66d9('0x52')][_0x66d9('0x58')]({'where':{'id':_0x924a3f[_0x66d9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x479d25,null))[_0x66d9('0x1d')](function(_0x439fea){if(_0x439fea){_0x4dddcd=_0x439fea;_0x34b5e4[_0x66d9('0x35')]=_[_0x66d9('0x37')](db[_0x66d9('0x54')][_0x66d9('0x4f')]);_0x34b5e4[_0x66d9('0x38')]=_[_0x66d9('0x37')](_0x924a3f['query']);_0x34b5e4[_0x66d9('0x43')]=_[_0x66d9('0x39')](_0x34b5e4[_0x66d9('0x35')],_0x34b5e4[_0x66d9('0x38')]);_0x34b21c[_0x66d9('0x3b')]=_['intersection'](_0x34b5e4[_0x66d9('0x35')],qs[_0x66d9('0x3a')](_0x924a3f[_0x66d9('0x38')]['fields']));_0x34b21c[_0x66d9('0x3b')]=_0x34b21c['attributes'][_0x66d9('0x3c')]?_0x34b21c['attributes']:_0x34b5e4[_0x66d9('0x35')];_0x34b21c['order']=qs[_0x66d9('0x40')](_0x924a3f[_0x66d9('0x38')][_0x66d9('0x40')]);_0x34b21c[_0x66d9('0x41')]=qs[_0x66d9('0x43')](_[_0x66d9('0x42')](_0x924a3f[_0x66d9('0x38')],_0x34b5e4[_0x66d9('0x43')]));if(_0x924a3f[_0x66d9('0x38')][_0x66d9('0x44')]){_0x34b21c[_0x66d9('0x41')]=_['merge'](_0x34b21c[_0x66d9('0x41')],{'$or':_[_0x66d9('0x32')](_0x34b21c[_0x66d9('0x3b')],function(_0x4f8a04){var _0x48c7e1={};_0x48c7e1[_0x4f8a04]={'$like':'%'+_0x924a3f[_0x66d9('0x38')][_0x66d9('0x44')]+'%'};return _0x48c7e1;})});}_0x34b21c=_['merge']({},_0x34b21c,_0x924a3f[_0x66d9('0x47')]);return _0x4dddcd['getSubjects'](_0x34b21c);}})[_0x66d9('0x1d')](function(_0x323646){if(_0x323646){_0x16d3af=_0x323646[_0x66d9('0x3c')];if(!_0x924a3f['query'][_0x66d9('0x3d')](_0x66d9('0x56'))){_0x34b21c[_0x66d9('0x3e')]=qs[_0x66d9('0x3e')](_0x924a3f[_0x66d9('0x38')][_0x66d9('0x3e')]);_0x34b21c[_0x66d9('0x28')]=qs[_0x66d9('0x28')](_0x924a3f[_0x66d9('0x38')][_0x66d9('0x28')]);}return _0x4dddcd[_0x66d9('0x57')](_0x34b21c);}})[_0x66d9('0x1d')](function(_0xd4160c){if(_0xd4160c){return _0xd4160c?{'count':_0x16d3af,'rows':_0xd4160c}:null;}})[_0x66d9('0x1d')](respondWithResult(_0x479d25,null))[_0x66d9('0x26')](handleError(_0x479d25,null));};exports[_0x66d9('0x59')]=function(_0xbed800,_0x40652e,_0x5e646d){var _0x3c8274={};var _0x158bb0={};var _0x359589;var _0x192d92;return db['ZohoConfiguration'][_0x66d9('0x58')]({'where':{'id':_0xbed800['params']['id']}})[_0x66d9('0x1d')](handleEntityNotFound(_0x40652e,null))[_0x66d9('0x1d')](function(_0x49850e){if(_0x49850e){_0x359589=_0x49850e;_0x158bb0['model']=_[_0x66d9('0x37')](db['ZohoField'][_0x66d9('0x4f')]);_0x158bb0[_0x66d9('0x38')]=_[_0x66d9('0x37')](_0xbed800[_0x66d9('0x38')]);_0x158bb0[_0x66d9('0x43')]=_[_0x66d9('0x39')](_0x158bb0[_0x66d9('0x35')],_0x158bb0[_0x66d9('0x38')]);_0x3c8274[_0x66d9('0x3b')]=_[_0x66d9('0x39')](_0x158bb0[_0x66d9('0x35')],qs[_0x66d9('0x3a')](_0xbed800[_0x66d9('0x38')][_0x66d9('0x3a')]));_0x3c8274[_0x66d9('0x3b')]=_0x3c8274[_0x66d9('0x3b')][_0x66d9('0x3c')]?_0x3c8274[_0x66d9('0x3b')]:_0x158bb0[_0x66d9('0x35')];_0x3c8274[_0x66d9('0x3f')]=qs['sort'](_0xbed800['query'][_0x66d9('0x40')]);_0x3c8274['where']=qs[_0x66d9('0x43')](_['pick'](_0xbed800[_0x66d9('0x38')],_0x158bb0[_0x66d9('0x43')]));if(_0xbed800[_0x66d9('0x38')][_0x66d9('0x44')]){_0x3c8274[_0x66d9('0x41')]=_[_0x66d9('0x45')](_0x3c8274['where'],{'$or':_['map'](_0x3c8274[_0x66d9('0x3b')],function(_0x101f72){var _0x336f53={};_0x336f53[_0x101f72]={'$like':'%'+_0xbed800[_0x66d9('0x38')][_0x66d9('0x44')]+'%'};return _0x336f53;})});}_0x3c8274=_[_0x66d9('0x45')]({},_0x3c8274,_0xbed800[_0x66d9('0x47')]);return _0x359589[_0x66d9('0x59')](_0x3c8274);}})[_0x66d9('0x1d')](function(_0x12d4b9){if(_0x12d4b9){_0x192d92=_0x12d4b9[_0x66d9('0x3c')];if(!_0xbed800['query'][_0x66d9('0x3d')](_0x66d9('0x56'))){_0x3c8274['limit']=qs[_0x66d9('0x3e')](_0xbed800['query'][_0x66d9('0x3e')]);_0x3c8274[_0x66d9('0x28')]=qs['offset'](_0xbed800[_0x66d9('0x38')][_0x66d9('0x28')]);}return _0x359589[_0x66d9('0x59')](_0x3c8274);}})[_0x66d9('0x1d')](function(_0x516733){if(_0x516733){return _0x516733?{'count':_0x192d92,'rows':_0x516733}:null;}})[_0x66d9('0x1d')](respondWithResult(_0x40652e,null))[_0x66d9('0x26')](handleError(_0x40652e,null));}; \ No newline at end of file +var _0xb194=['create','body','update','params','getFields','findOne','ZohoField','rawAttributes','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','error','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','end','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','send','index','map','ZohoConfiguration','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','catch','include','find'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb194,0x176));var _0x4b19=function(_0x115f04,_0xdcc29){_0x115f04=_0x115f04-0x0;var _0x204445=_0xb194[_0x115f04];return _0x204445;};'use strict';var pdf=require(_0x4b19('0x0'));var emlformat=require(_0x4b19('0x1'));var rimraf=require(_0x4b19('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b19('0x3'));var rp=require(_0x4b19('0x4'));var moment=require('moment');var BPromise=require(_0x4b19('0x5'));var Mustache=require('mustache');var util=require(_0x4b19('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4b19('0x7'));var ejs=require(_0x4b19('0x8'));var fs=require('fs');var _=require(_0x4b19('0x9'));var squel=require(_0x4b19('0xa'));var crypto=require(_0x4b19('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b19('0xc'));var toCsv=require(_0x4b19('0x7'));var querystring=require(_0x4b19('0xd'));var Papa=require(_0x4b19('0xe'));var Redis=require(_0x4b19('0xf'));var authService=require(_0x4b19('0x10'));var qs=require(_0x4b19('0x11'));var as=require(_0x4b19('0x12'));var hardwareService=require(_0x4b19('0x13'));var logger=require(_0x4b19('0x14'))(_0x4b19('0x15'));var utils=require('../../config/utils');var config=require(_0x4b19('0x16'));var db=require(_0x4b19('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4b19('0x18')][_0x4b19('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3ee85f,_0x142120,_0x365d92){if(_0x365d92){var _0x26ece7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26ece7['test'](_0x142120)){return _0x3ee85f;}else{throw new db[(_0x4b19('0x1a'))][(_0x4b19('0x1b'))](_0x4b19('0x1c'));}}else{return _0x3ee85f;}}function respondWithRpcPromise(_0x36946f,_0x4093d5,_0x43c506,_0x49e33f){return new BPromise(function(_0x1db620,_0x5a2cb1){var _0x481e3f=_0x49e33f||client;return _0x481e3f[_0x4b19('0x1d')](_0x36946f,_0x43c506)[_0x4b19('0x1e')](function(_0x39e587){logger[_0x4b19('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x4093d5,'request\x20sent');logger[_0x4b19('0x20')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4093d5,'request\x20sent',JSON['stringify'](_0x39e587));if(_0x39e587[_0x4b19('0x21')]){if(_0x39e587['error']['code']===0x1f4){logger[_0x4b19('0x21')](_0x4b19('0x22'),_0x4093d5,_0x39e587[_0x4b19('0x21')][_0x4b19('0x23')]);return _0x5a2cb1(_0x39e587[_0x4b19('0x21')][_0x4b19('0x23')]);}logger[_0x4b19('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x4093d5,_0x39e587[_0x4b19('0x21')][_0x4b19('0x23')]);return _0x1db620(_0x39e587['error']['message']);}else{logger[_0x4b19('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x4093d5,_0x4b19('0x24'));_0x1db620(_0x39e587['result'][_0x4b19('0x23')]);}})['catch'](function(_0xdc90e7){logger[_0x4b19('0x21')](_0x4b19('0x22'),_0x4093d5,_0xdc90e7);_0x5a2cb1(_0xdc90e7);});});}function respondWithStatusCode(_0x50b1ef,_0x48db35){_0x48db35=_0x48db35||0xcc;return function(_0x354ac0){if(_0x354ac0){return _0x50b1ef['sendStatus'](_0x48db35);}return _0x50b1ef['status'](_0x48db35)[_0x4b19('0x25')]();};}function respondWithResult(_0x366c9c,_0x1beb90){_0x1beb90=_0x1beb90||0xc8;return function(_0x2a175c){if(_0x2a175c){return _0x366c9c[_0x4b19('0x26')](_0x1beb90)[_0x4b19('0x27')](_0x2a175c);}};}function respondWithFilteredResult(_0x4828f8,_0x3c5145){return function(_0x3c4603){if(_0x3c4603){var _0x403dc1=_0x3c4603[_0x4b19('0x28')],_0xe5a0ae=_0x3c5145[_0x4b19('0x29')],_0x206b64=_0x3c5145[_0x4b19('0x29')]+_0x3c5145['limit'],_0x4c06d3;if(_0x206b64>=_0x403dc1){_0x206b64=_0x403dc1;_0x4c06d3=0xc8;}else{_0x4c06d3=0xce;}_0x4828f8[_0x4b19('0x26')](_0x4c06d3);return _0x4828f8[_0x4b19('0x2a')](_0x4b19('0x2b'),_0xe5a0ae+'-'+_0x206b64+'/'+_0x403dc1)[_0x4b19('0x27')](_0x3c4603);}return null;};}function patchUpdates(_0x50840a){return function(_0x51cffc){try{jsonpatch[_0x4b19('0x2c')](_0x51cffc,_0x50840a,!![]);}catch(_0x5a3120){return BPromise[_0x4b19('0x2d')](_0x5a3120);}return _0x51cffc[_0x4b19('0x2e')]();};}function saveUpdates(_0xe9a79f,_0x4ddd62){return function(_0x4be6c9){if(_0x4be6c9){return _0x4be6c9['update'](_0xe9a79f)[_0x4b19('0x1e')](function(_0x58580e){return _0x58580e;});}return null;};}function removeEntity(_0x40ccbb,_0x33a39e){return function(_0x59e458){if(_0x59e458){return _0x59e458[_0x4b19('0x2f')]()['then'](function(){_0x40ccbb[_0x4b19('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x584a3b,_0x91cf5b){return function(_0x26bf2d){if(!_0x26bf2d){_0x584a3b['sendStatus'](0x194);}return _0x26bf2d;};}function handleError(_0x55e894,_0x1653a9){_0x1653a9=_0x1653a9||0x1f4;return function(_0x101b15){logger['error'](_0x101b15[_0x4b19('0x30')]);if(_0x101b15['name']){delete _0x101b15['name'];}_0x55e894[_0x4b19('0x26')](_0x1653a9)[_0x4b19('0x31')](_0x101b15);};}exports[_0x4b19('0x32')]=function(_0x1cbceb,_0x1ca9da){var _0x50d470={},_0x2285d5={},_0x522593={'count':0x0,'rows':[]};var _0x56488f=_[_0x4b19('0x33')](db[_0x4b19('0x34')]['rawAttributes'],function(_0x4649a2){return{'name':_0x4649a2[_0x4b19('0x35')],'type':_0x4649a2[_0x4b19('0x36')][_0x4b19('0x37')]};});_0x2285d5[_0x4b19('0x38')]=_['map'](_0x56488f,'name');_0x2285d5['query']=_[_0x4b19('0x39')](_0x1cbceb['query']);_0x2285d5['filters']=_[_0x4b19('0x3a')](_0x2285d5[_0x4b19('0x38')],_0x2285d5[_0x4b19('0x3b')]);_0x50d470[_0x4b19('0x3c')]=_[_0x4b19('0x3a')](_0x2285d5[_0x4b19('0x38')],qs[_0x4b19('0x3d')](_0x1cbceb['query'][_0x4b19('0x3d')]));_0x50d470[_0x4b19('0x3c')]=_0x50d470[_0x4b19('0x3c')][_0x4b19('0x3e')]?_0x50d470[_0x4b19('0x3c')]:_0x2285d5['model'];if(!_0x1cbceb[_0x4b19('0x3b')][_0x4b19('0x3f')](_0x4b19('0x40'))){_0x50d470['limit']=qs['limit'](_0x1cbceb['query'][_0x4b19('0x41')]);_0x50d470['offset']=qs[_0x4b19('0x29')](_0x1cbceb[_0x4b19('0x3b')]['offset']);}_0x50d470[_0x4b19('0x42')]=qs[_0x4b19('0x43')](_0x1cbceb[_0x4b19('0x3b')][_0x4b19('0x43')]);_0x50d470[_0x4b19('0x44')]=qs[_0x4b19('0x45')](_[_0x4b19('0x46')](_0x1cbceb['query'],_0x2285d5[_0x4b19('0x45')]),_0x56488f);if(_0x1cbceb[_0x4b19('0x3b')][_0x4b19('0x47')]){_0x50d470[_0x4b19('0x44')]=_[_0x4b19('0x48')](_0x50d470[_0x4b19('0x44')],{'$or':_[_0x4b19('0x33')](_0x56488f,function(_0x1436e9){if(_0x1436e9[_0x4b19('0x36')]!==_0x4b19('0x49')){var _0x178f20={};_0x178f20[_0x1436e9[_0x4b19('0x4a')]]={'$like':'%'+_0x1cbceb['query']['filter']+'%'};return _0x178f20;}})});}_0x50d470=_[_0x4b19('0x48')]({},_0x50d470,_0x1cbceb[_0x4b19('0x4b')]);var _0x37b4e4={'where':_0x50d470[_0x4b19('0x44')]};return db[_0x4b19('0x34')][_0x4b19('0x28')](_0x37b4e4)[_0x4b19('0x1e')](function(_0x5eec93){_0x522593[_0x4b19('0x28')]=_0x5eec93;if(_0x1cbceb[_0x4b19('0x3b')][_0x4b19('0x4c')]){_0x50d470['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x4b19('0x4d')](_0x50d470);})[_0x4b19('0x1e')](function(_0x5a04ef){_0x522593['rows']=_0x5a04ef;return _0x522593;})[_0x4b19('0x1e')](respondWithFilteredResult(_0x1ca9da,_0x50d470))[_0x4b19('0x4e')](handleError(_0x1ca9da,null));};exports['show']=function(_0x1c50b2,_0x3c70ca){var _0x1c5fc1={'raw':![],'where':{'id':_0x1c50b2['params']['id']}},_0x6da100={};_0x6da100[_0x4b19('0x38')]=_[_0x4b19('0x39')](db[_0x4b19('0x34')]['rawAttributes']);_0x6da100[_0x4b19('0x3b')]=_[_0x4b19('0x39')](_0x1c50b2['query']);_0x6da100[_0x4b19('0x45')]=_[_0x4b19('0x3a')](_0x6da100[_0x4b19('0x38')],_0x6da100[_0x4b19('0x3b')]);_0x1c5fc1[_0x4b19('0x3c')]=_['intersection'](_0x6da100[_0x4b19('0x38')],qs['fields'](_0x1c50b2[_0x4b19('0x3b')][_0x4b19('0x3d')]));_0x1c5fc1[_0x4b19('0x3c')]=_0x1c5fc1['attributes']['length']?_0x1c5fc1[_0x4b19('0x3c')]:_0x6da100[_0x4b19('0x38')];if(_0x1c50b2[_0x4b19('0x3b')][_0x4b19('0x4c')]){_0x1c5fc1[_0x4b19('0x4f')]=[{'all':!![]}];}_0x1c5fc1=_[_0x4b19('0x48')]({},_0x1c5fc1,_0x1c50b2[_0x4b19('0x4b')]);return db[_0x4b19('0x34')][_0x4b19('0x50')](_0x1c5fc1)[_0x4b19('0x1e')](handleEntityNotFound(_0x3c70ca,null))[_0x4b19('0x1e')](respondWithResult(_0x3c70ca,null))['catch'](handleError(_0x3c70ca,null));};exports['create']=function(_0xb978b5,_0x1b8c80){return db['ZohoConfiguration'][_0x4b19('0x51')](_0xb978b5[_0x4b19('0x52')],{})[_0x4b19('0x1e')](respondWithResult(_0x1b8c80,0xc9))[_0x4b19('0x4e')](handleError(_0x1b8c80,null));};exports[_0x4b19('0x53')]=function(_0x24c635,_0x54c45b){if(_0x24c635[_0x4b19('0x52')]['id']){delete _0x24c635['body']['id'];}return db[_0x4b19('0x34')][_0x4b19('0x50')]({'where':{'id':_0x24c635[_0x4b19('0x54')]['id']}})[_0x4b19('0x1e')](handleEntityNotFound(_0x54c45b,null))[_0x4b19('0x1e')](saveUpdates(_0x24c635[_0x4b19('0x52')],null))[_0x4b19('0x1e')](respondWithResult(_0x54c45b,null))['catch'](handleError(_0x54c45b,null));};exports['destroy']=function(_0x3c8ef6,_0x37efd2){return db[_0x4b19('0x34')][_0x4b19('0x50')]({'where':{'id':_0x3c8ef6[_0x4b19('0x54')]['id']}})[_0x4b19('0x1e')](handleEntityNotFound(_0x37efd2,null))[_0x4b19('0x1e')](removeEntity(_0x37efd2,null))[_0x4b19('0x4e')](handleError(_0x37efd2,null));};exports[_0x4b19('0x55')]=function(_0x13ed80,_0x11f40b,_0x1f5a60){var _0x5463c2={};var _0x525b91={};var _0x226316;var _0x55521f;return db[_0x4b19('0x34')][_0x4b19('0x56')]({'where':{'id':_0x13ed80[_0x4b19('0x54')]['id']}})[_0x4b19('0x1e')](handleEntityNotFound(_0x11f40b,null))['then'](function(_0x2d106c){if(_0x2d106c){_0x226316=_0x2d106c;_0x525b91['model']=_[_0x4b19('0x39')](db[_0x4b19('0x57')][_0x4b19('0x58')]);_0x525b91[_0x4b19('0x3b')]=_[_0x4b19('0x39')](_0x13ed80[_0x4b19('0x3b')]);_0x525b91[_0x4b19('0x45')]=_['intersection'](_0x525b91['model'],_0x525b91[_0x4b19('0x3b')]);_0x5463c2['attributes']=_['intersection'](_0x525b91['model'],qs['fields'](_0x13ed80[_0x4b19('0x3b')]['fields']));_0x5463c2[_0x4b19('0x3c')]=_0x5463c2[_0x4b19('0x3c')][_0x4b19('0x3e')]?_0x5463c2[_0x4b19('0x3c')]:_0x525b91['model'];_0x5463c2['order']=qs[_0x4b19('0x43')](_0x13ed80[_0x4b19('0x3b')][_0x4b19('0x43')]);_0x5463c2[_0x4b19('0x44')]=qs[_0x4b19('0x45')](_[_0x4b19('0x46')](_0x13ed80[_0x4b19('0x3b')],_0x525b91[_0x4b19('0x45')]));if(_0x13ed80[_0x4b19('0x3b')][_0x4b19('0x47')]){_0x5463c2['where']=_[_0x4b19('0x48')](_0x5463c2[_0x4b19('0x44')],{'$or':_[_0x4b19('0x33')](_0x5463c2[_0x4b19('0x3c')],function(_0x4a2cae){var _0x4dbbd7={};_0x4dbbd7[_0x4a2cae]={'$like':'%'+_0x13ed80[_0x4b19('0x3b')][_0x4b19('0x47')]+'%'};return _0x4dbbd7;})});}_0x5463c2=_['merge']({},_0x5463c2,_0x13ed80[_0x4b19('0x4b')]);return _0x226316[_0x4b19('0x55')](_0x5463c2);}})[_0x4b19('0x1e')](function(_0x2aba2b){if(_0x2aba2b){_0x55521f=_0x2aba2b[_0x4b19('0x3e')];if(!_0x13ed80[_0x4b19('0x3b')][_0x4b19('0x3f')](_0x4b19('0x40'))){_0x5463c2['limit']=qs[_0x4b19('0x41')](_0x13ed80[_0x4b19('0x3b')][_0x4b19('0x41')]);_0x5463c2[_0x4b19('0x29')]=qs[_0x4b19('0x29')](_0x13ed80[_0x4b19('0x3b')][_0x4b19('0x29')]);}return _0x226316[_0x4b19('0x55')](_0x5463c2);}})[_0x4b19('0x1e')](function(_0x183c09){if(_0x183c09){return _0x183c09?{'count':_0x55521f,'rows':_0x183c09}:null;}})['then'](respondWithResult(_0x11f40b,null))[_0x4b19('0x4e')](handleError(_0x11f40b,null));};exports['getSubjects']=function(_0x28059d,_0x2742d5,_0x5aed11){var _0x2d2917={};var _0x330b55={};var _0x86bb56;var _0x4922a0;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x28059d[_0x4b19('0x54')]['id']}})[_0x4b19('0x1e')](handleEntityNotFound(_0x2742d5,null))[_0x4b19('0x1e')](function(_0x90f157){if(_0x90f157){_0x86bb56=_0x90f157;_0x330b55[_0x4b19('0x38')]=_[_0x4b19('0x39')](db['ZohoField'][_0x4b19('0x58')]);_0x330b55[_0x4b19('0x3b')]=_['keys'](_0x28059d['query']);_0x330b55[_0x4b19('0x45')]=_['intersection'](_0x330b55[_0x4b19('0x38')],_0x330b55[_0x4b19('0x3b')]);_0x2d2917[_0x4b19('0x3c')]=_[_0x4b19('0x3a')](_0x330b55[_0x4b19('0x38')],qs['fields'](_0x28059d[_0x4b19('0x3b')][_0x4b19('0x3d')]));_0x2d2917[_0x4b19('0x3c')]=_0x2d2917['attributes'][_0x4b19('0x3e')]?_0x2d2917[_0x4b19('0x3c')]:_0x330b55[_0x4b19('0x38')];_0x2d2917['order']=qs['sort'](_0x28059d[_0x4b19('0x3b')][_0x4b19('0x43')]);_0x2d2917['where']=qs['filters'](_[_0x4b19('0x46')](_0x28059d[_0x4b19('0x3b')],_0x330b55[_0x4b19('0x45')]));if(_0x28059d[_0x4b19('0x3b')]['filter']){_0x2d2917[_0x4b19('0x44')]=_[_0x4b19('0x48')](_0x2d2917[_0x4b19('0x44')],{'$or':_['map'](_0x2d2917[_0x4b19('0x3c')],function(_0x35d5df){var _0x56b836={};_0x56b836[_0x35d5df]={'$like':'%'+_0x28059d[_0x4b19('0x3b')]['filter']+'%'};return _0x56b836;})});}_0x2d2917=_[_0x4b19('0x48')]({},_0x2d2917,_0x28059d[_0x4b19('0x4b')]);return _0x86bb56[_0x4b19('0x59')](_0x2d2917);}})[_0x4b19('0x1e')](function(_0x5add4e){if(_0x5add4e){_0x4922a0=_0x5add4e[_0x4b19('0x3e')];if(!_0x28059d['query'][_0x4b19('0x3f')](_0x4b19('0x40'))){_0x2d2917[_0x4b19('0x41')]=qs[_0x4b19('0x41')](_0x28059d['query'][_0x4b19('0x41')]);_0x2d2917[_0x4b19('0x29')]=qs[_0x4b19('0x29')](_0x28059d['query'][_0x4b19('0x29')]);}return _0x86bb56[_0x4b19('0x59')](_0x2d2917);}})[_0x4b19('0x1e')](function(_0x29dffa){if(_0x29dffa){return _0x29dffa?{'count':_0x4922a0,'rows':_0x29dffa}:null;}})[_0x4b19('0x1e')](respondWithResult(_0x2742d5,null))[_0x4b19('0x4e')](handleError(_0x2742d5,null));};exports[_0x4b19('0x5a')]=function(_0x5f14c1,_0xe6fe45,_0xb43d47){var _0x402d9d={};var _0x5b8073={};var _0x1399c2;var _0x441329;return db[_0x4b19('0x34')]['findOne']({'where':{'id':_0x5f14c1[_0x4b19('0x54')]['id']}})[_0x4b19('0x1e')](handleEntityNotFound(_0xe6fe45,null))['then'](function(_0x4aa493){if(_0x4aa493){_0x1399c2=_0x4aa493;_0x5b8073[_0x4b19('0x38')]=_[_0x4b19('0x39')](db[_0x4b19('0x57')]['rawAttributes']);_0x5b8073[_0x4b19('0x3b')]=_['keys'](_0x5f14c1[_0x4b19('0x3b')]);_0x5b8073[_0x4b19('0x45')]=_['intersection'](_0x5b8073[_0x4b19('0x38')],_0x5b8073['query']);_0x402d9d['attributes']=_[_0x4b19('0x3a')](_0x5b8073[_0x4b19('0x38')],qs['fields'](_0x5f14c1['query']['fields']));_0x402d9d[_0x4b19('0x3c')]=_0x402d9d[_0x4b19('0x3c')][_0x4b19('0x3e')]?_0x402d9d[_0x4b19('0x3c')]:_0x5b8073[_0x4b19('0x38')];_0x402d9d[_0x4b19('0x42')]=qs[_0x4b19('0x43')](_0x5f14c1['query'][_0x4b19('0x43')]);_0x402d9d['where']=qs[_0x4b19('0x45')](_[_0x4b19('0x46')](_0x5f14c1['query'],_0x5b8073[_0x4b19('0x45')]));if(_0x5f14c1['query']['filter']){_0x402d9d[_0x4b19('0x44')]=_[_0x4b19('0x48')](_0x402d9d[_0x4b19('0x44')],{'$or':_[_0x4b19('0x33')](_0x402d9d[_0x4b19('0x3c')],function(_0x693e2){var _0x32889f={};_0x32889f[_0x693e2]={'$like':'%'+_0x5f14c1[_0x4b19('0x3b')][_0x4b19('0x47')]+'%'};return _0x32889f;})});}_0x402d9d=_[_0x4b19('0x48')]({},_0x402d9d,_0x5f14c1[_0x4b19('0x4b')]);return _0x1399c2[_0x4b19('0x5a')](_0x402d9d);}})[_0x4b19('0x1e')](function(_0x7578cd){if(_0x7578cd){_0x441329=_0x7578cd[_0x4b19('0x3e')];if(!_0x5f14c1[_0x4b19('0x3b')]['hasOwnProperty'](_0x4b19('0x40'))){_0x402d9d[_0x4b19('0x41')]=qs[_0x4b19('0x41')](_0x5f14c1[_0x4b19('0x3b')][_0x4b19('0x41')]);_0x402d9d[_0x4b19('0x29')]=qs['offset'](_0x5f14c1[_0x4b19('0x3b')][_0x4b19('0x29')]);}return _0x1399c2[_0x4b19('0x5a')](_0x402d9d);}})[_0x4b19('0x1e')](function(_0x45ed58){if(_0x45ed58){return _0x45ed58?{'count':_0x441329,'rows':_0x45ed58}:null;}})['then'](respondWithResult(_0xe6fe45,null))[_0x4b19('0x4e')](handleError(_0xe6fe45,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 7f553ed..9c5ccbe 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 _0xa558=['int_zoho_configurations','util','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x4bb593,_0x272ed0){var _0x2da2d8=function(_0x4b25e9){while(--_0x4b25e9){_0x4bb593['push'](_0x4bb593['shift']());}};_0x2da2d8(++_0x272ed0);}(_0xa558,0x1d5));var _0x8a55=function(_0x3333d4,_0xcc4bf0){_0x3333d4=_0x3333d4-0x0;var _0x20014b=_0xa558[_0x3333d4];return _0x20014b;};'use strict';var _=require('lodash');var util=require(_0x8a55('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8a55('0x1'));var rp=require(_0x8a55('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a55('0x3'));var config=require(_0x8a55('0x4'));var attributes=require(_0x8a55('0x5'));module['exports']=function(_0x189cd8,_0x2061a2){return _0x189cd8[_0x8a55('0x6')](_0x8a55('0x7'),attributes,{'tableName':_0x8a55('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbf7=['request-promise','rimraf','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','moment','bluebird'];(function(_0x426b32,_0x3f777d){var _0x20e3a5=function(_0x357c7f){while(--_0x357c7f){_0x426b32['push'](_0x426b32['shift']());}};_0x20e3a5(++_0x3f777d);}(_0xbbf7,0x189));var _0x7bbf=function(_0xe4e4fe,_0x2526b2){_0xe4e4fe=_0xe4e4fe-0x0;var _0x4dc260=_0xbbf7[_0xe4e4fe];return _0x4dc260;};'use strict';var _=require(_0x7bbf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7bbf('0x1'));var BPromise=require(_0x7bbf('0x2'));var rp=require(_0x7bbf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bbf('0x4'));var config=require('../../config/environment');var attributes=require(_0x7bbf('0x5'));module[_0x7bbf('0x6')]=function(_0x5f4fb7,_0x42fe24){return _0x5f4fb7[_0x7bbf('0x7')]('ZohoConfiguration',attributes,{'tableName':_0x7bbf('0x8'),'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 f093988..9400eb5 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 _0x2f22=['stringify','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x2f22,0x1df));var _0x22f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2f22[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x22f2('0x0'));var moment=require(_0x22f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x22f2('0x2'));var fs=require('fs');var Redis=require(_0x22f2('0x3'));var db=require(_0x22f2('0x4'))['db'];var utils=require(_0x22f2('0x5'));var logger=require(_0x22f2('0x6'))(_0x22f2('0x7'));var config=require(_0x22f2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x22f2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dda94,_0x1d8e56,_0x1bb878){return new BPromise(function(_0x446fbd,_0x3e8e34){return client[_0x22f2('0xa')](_0x3dda94,_0x1bb878)['then'](function(_0x2c8e20){logger[_0x22f2('0xb')](_0x22f2('0xc'),_0x1d8e56,_0x22f2('0xd'));logger[_0x22f2('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1d8e56,_0x22f2('0xd'),JSON[_0x22f2('0xf')](_0x2c8e20));if(_0x2c8e20[_0x22f2('0x10')]){if(_0x2c8e20[_0x22f2('0x10')][_0x22f2('0x11')]===0x1f4){logger['error'](_0x22f2('0xc'),_0x1d8e56,_0x2c8e20[_0x22f2('0x10')][_0x22f2('0x12')]);return _0x3e8e34(_0x2c8e20[_0x22f2('0x10')][_0x22f2('0x12')]);}logger['error'](_0x22f2('0xc'),_0x1d8e56,_0x2c8e20['error'][_0x22f2('0x12')]);return _0x446fbd(_0x2c8e20[_0x22f2('0x10')]['message']);}else{logger[_0x22f2('0xb')](_0x22f2('0xc'),_0x1d8e56,_0x22f2('0xd'));_0x446fbd(_0x2c8e20['result']['message']);}})['catch'](function(_0x1f6d3a){logger[_0x22f2('0x10')](_0x22f2('0xc'),_0x1d8e56,_0x1f6d3a);_0x3e8e34(_0x1f6d3a);});});} \ No newline at end of file +var _0x7977=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x1e8350,_0x1cff0a){var _0x5c567e=function(_0x560126){while(--_0x560126){_0x1e8350['push'](_0x1e8350['shift']());}};_0x5c567e(++_0x1cff0a);}(_0x7977,0x1b9));var _0x7797=function(_0x1789bc,_0x1acf84){_0x1789bc=_0x1789bc-0x0;var _0x35efd1=_0x7977[_0x1789bc];return _0x35efd1;};'use strict';var _=require(_0x7797('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7797('0x1'));var rs=require(_0x7797('0x2'));var fs=require('fs');var Redis=require(_0x7797('0x3'));var db=require(_0x7797('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7797('0x5'))('rpc');var config=require(_0x7797('0x6'));var jayson=require(_0x7797('0x7'));var client=jayson[_0x7797('0x8')][_0x7797('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f55cf,_0x12dc9e,_0xa8cb25){return new BPromise(function(_0x3fe6dd,_0x1dab01){return client[_0x7797('0xa')](_0x2f55cf,_0xa8cb25)['then'](function(_0xc5f4c7){logger['info'](_0x7797('0xb'),_0x12dc9e,_0x7797('0xc'));logger[_0x7797('0xd')](_0x7797('0xe'),_0x12dc9e,_0x7797('0xc'),JSON[_0x7797('0xf')](_0xc5f4c7));if(_0xc5f4c7['error']){if(_0xc5f4c7[_0x7797('0x10')][_0x7797('0x11')]===0x1f4){logger[_0x7797('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x12dc9e,_0xc5f4c7[_0x7797('0x10')][_0x7797('0x12')]);return _0x1dab01(_0xc5f4c7[_0x7797('0x10')]['message']);}logger[_0x7797('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x12dc9e,_0xc5f4c7[_0x7797('0x10')]['message']);return _0x3fe6dd(_0xc5f4c7[_0x7797('0x10')]['message']);}else{logger[_0x7797('0x13')](_0x7797('0xb'),_0x12dc9e,_0x7797('0xc'));_0x3fe6dd(_0xc5f4c7['result'][_0x7797('0x12')]);}})[_0x7797('0x14')](function(_0x3701a8){logger[_0x7797('0x10')](_0x7797('0xb'),_0x12dc9e,_0x3701a8);_0x1dab01(_0x3701a8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b8d1073..b430cfc 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 _0xdd4f=['Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','post','create','put','update','destroy','exports','multer','express'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x54d543,_0x1bd0a4){_0x54d543=_0x54d543-0x0;var _0x6bf62b=_0xdd4f[_0x54d543];return _0x6bf62b;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdd4('0x3'));var config=require(_0xfdd4('0x4'));var controller=require(_0xfdd4('0x5'));router['get']('/',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x7')]);router[_0xfdd4('0x8')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller['show']);router[_0xfdd4('0xa')]('/',auth['isAuthenticated'](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xd')]);router['delete'](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file +var _0x2a07=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x2a07,0x74));var _0x72a0=function(_0x5b7696,_0x3ebd92){_0x5b7696=_0x5b7696-0x0;var _0x42d7b9=_0x2a07[_0x5b7696];return _0x42d7b9;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var auth=require(_0x72a0('0x5'));var interaction=require(_0x72a0('0x6'));var config=require(_0x72a0('0x7'));var controller=require(_0x72a0('0x8'));router[_0x72a0('0x9')]('/',auth[_0x72a0('0xa')](),controller[_0x72a0('0xb')]);router[_0x72a0('0x9')](_0x72a0('0xc'),auth[_0x72a0('0xa')](),controller[_0x72a0('0xd')]);router[_0x72a0('0xe')]('/',auth[_0x72a0('0xa')](),controller[_0x72a0('0xf')]);router[_0x72a0('0x10')](_0x72a0('0xc'),auth['isAuthenticated'](),controller[_0x72a0('0x11')]);router[_0x72a0('0x12')]('/:id',auth[_0x72a0('0xa')](),controller[_0x72a0('0x13')]);module[_0x72a0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 20f1f26..2fdb5f3 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 _0xf2ca=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string'];(function(_0x4a0b3b,_0x552251){var _0x6f3911=function(_0x51dad2){while(--_0x51dad2){_0x4a0b3b['push'](_0x4a0b3b['shift']());}};_0x6f3911(++_0x552251);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2b18d8,_0x21778e){_0x2b18d8=_0x2b18d8-0x0;var _0x2bcce2=_0xf2ca[_0x2b18d8];return _0x2bcce2;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'type':{'type':Sequelize[_0xaf2c('0x2')]('string',_0xaf2c('0x3'),_0xaf2c('0x4'),_0xaf2c('0x5')),'defaultValue':_0xaf2c('0x6')},'content':{'type':Sequelize[_0xaf2c('0x7')]},'key':{'type':Sequelize[_0xaf2c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xaf2c('0x6'),_0xaf2c('0x3'),_0xaf2c('0x4'))},'keyContent':{'type':Sequelize[_0xaf2c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaf2c('0x7')]},'customField':{'type':Sequelize[_0xaf2c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e8a=['string','STRING','BOOLEAN','exports','ENUM','variable','customVariable'];(function(_0xe0e53b,_0x243a2f){var _0x4781bc=function(_0x3c9cf5){while(--_0x3c9cf5){_0xe0e53b['push'](_0xe0e53b['shift']());}};_0x4781bc(++_0x243a2f);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x5bce6d,_0x3d3b72){_0x5bce6d=_0x5bce6d-0x0;var _0x4ee73c=_0x2e8a[_0x5bce6d];return _0x4ee73c;};'use strict';var Sequelize=require('sequelize');module[_0xa2e8('0x0')]={'type':{'type':Sequelize[_0xa2e8('0x1')]('string',_0xa2e8('0x2'),_0xa2e8('0x3'),'keyValue'),'defaultValue':_0xa2e8('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xa2e8('0x2'),_0xa2e8('0x3'))},'keyContent':{'type':Sequelize[_0xa2e8('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa2e8('0x5')]},'customField':{'type':Sequelize[_0xa2e8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa2e8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index cd88353..692a110 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(_0x1f5d8c,_0x4c1faf){var _0x3847d0=function(_0x1190df){while(--_0x1190df){_0x1f5d8c['push'](_0x1f5d8c['shift']());}};_0x3847d0(++_0x4c1faf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x14b62e,_0x3b8096){var _0x42ad69=function(_0x1d537a){while(--_0x1d537a){_0x14b62e['push'](_0x14b62e['shift']());}};_0x42ad69(++_0x3b8096);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 08b3452..cf4c1b6 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 _0xb376=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','bluebird','request-promise','path'];(function(_0x48cca6,_0x5cc69a){var _0x134f3c=function(_0x51d84a){while(--_0x51d84a){_0x48cca6['push'](_0x48cca6['shift']());}};_0x134f3c(++_0x5cc69a);}(_0xb376,0x87));var _0x6b37=function(_0x22cb43,_0x408bcd){_0x22cb43=_0x22cb43-0x0;var _0xd8a106=_0xb376[_0x22cb43];return _0xd8a106;};'use strict';var _=require(_0x6b37('0x0'));var util=require(_0x6b37('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6b37('0x2'));var rp=require(_0x6b37('0x3'));var fs=require('fs');var path=require(_0x6b37('0x4'));var rimraf=require(_0x6b37('0x5'));var config=require(_0x6b37('0x6'));var attributes=require(_0x6b37('0x7'));module[_0x6b37('0x8')]=function(_0x27ea78,_0x38859c){return _0x27ea78[_0x6b37('0x9')](_0x6b37('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6b37('0xb'),'fields':[_0x6b37('0xc'),_0x6b37('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa149=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','FieldId','lodash'];(function(_0x551fa8,_0x35ee73){var _0xa879cb=function(_0x89b7b2){while(--_0x89b7b2){_0x551fa8['push'](_0x551fa8['shift']());}};_0xa879cb(++_0x35ee73);}(_0xa149,0xb5));var _0x9a14=function(_0x5d91ea,_0x344f69){_0x5d91ea=_0x5d91ea-0x0;var _0x1b9b8f=_0xa149[_0x5d91ea];return _0x1b9b8f;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var logger=require(_0x9a14('0x2'))(_0x9a14('0x3'));var moment=require(_0x9a14('0x4'));var BPromise=require(_0x9a14('0x5'));var rp=require(_0x9a14('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a14('0x7'));var config=require(_0x9a14('0x8'));var attributes=require(_0x9a14('0x9'));module['exports']=function(_0x37d32f,_0x2fdb28){return _0x37d32f[_0x9a14('0xa')](_0x9a14('0xb'),attributes,{'tableName':_0x9a14('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x9a14('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index a086623..9eb6668 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 _0x98a8=['request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x19a139,_0x35fec3){var _0x5aed19=function(_0x26224f){while(--_0x26224f){_0x19a139['push'](_0x19a139['shift']());}};_0x5aed19(++_0x35fec3);}(_0x98a8,0x12c));var _0x898a=function(_0x27e64d,_0x315a97){_0x27e64d=_0x27e64d-0x0;var _0x35ec66=_0x98a8[_0x27e64d];return _0x35ec66;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('ZohoField,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5b8340,_0x51d885){var _0x55abe5=function(_0x2b6068){while(--_0x2b6068){_0x5b8340['push'](_0x5b8340['shift']());}};_0x55abe5(++_0x51d885);}(_0xa41a,0x6b));var _0xaa41=function(_0x48d1bf,_0x60edb9){_0x48d1bf=_0x48d1bf-0x0;var _0x13716a=_0xa41a[_0x48d1bf];return _0x13716a;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e14c5ee..bc82054 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 _0x08c5=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3481b9,_0x2f1c63){var _0x4e63dc=function(_0x4a6078){while(--_0x4a6078){_0x3481b9['push'](_0x3481b9['shift']());}};_0x4e63dc(++_0x2f1c63);}(_0x08c5,0x1de));var _0x508c=function(_0x17cb2f,_0x1ee8b2){_0x17cb2f=_0x17cb2f-0x0;var _0x4b315f=_0x08c5[_0x17cb2f];return _0x4b315f;};'use strict';var multer=require('multer');var util=require(_0x508c('0x0'));var path=require(_0x508c('0x1'));var timeout=require(_0x508c('0x2'));var express=require(_0x508c('0x3'));var router=express[_0x508c('0x4')]();var auth=require(_0x508c('0x5'));var interaction=require(_0x508c('0x6'));var config=require(_0x508c('0x7'));module[_0x508c('0x8')]=router; \ No newline at end of file +var _0x2f56=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1b87fb,_0x3e6870){var _0xc7de31=function(_0x4eaded){while(--_0x4eaded){_0x1b87fb['push'](_0x1b87fb['shift']());}};_0xc7de31(++_0x3e6870);}(_0x2f56,0x148));var _0x62f5=function(_0x19b066,_0x46d454){_0x19b066=_0x19b066-0x0;var _0x409772=_0x2f56[_0x19b066];return _0x409772;};'use strict';var multer=require(_0x62f5('0x0'));var util=require(_0x62f5('0x1'));var path=require(_0x62f5('0x2'));var timeout=require('connect-timeout');var express=require(_0x62f5('0x3'));var router=express[_0x62f5('0x4')]();var auth=require(_0x62f5('0x5'));var interaction=require(_0x62f5('0x6'));var config=require('../../config/environment');module[_0x62f5('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 fa538a0..baff857 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 _0xcbc2=['STRING','INTEGER','sequelize','exports','unique_name_and_version'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xcbc2,0x14c));var _0x2cbc=function(_0x24502f,_0x134350){_0x24502f=_0x24502f-0x0;var _0x402fd9=_0xcbc2[_0x24502f];return _0x402fd9;};'use strict';var Sequelize=require(_0x2cbc('0x0'));module[_0x2cbc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2cbc('0x2')},'version':{'type':Sequelize[_0x2cbc('0x3')],'allowNull':![],'unique':_0x2cbc('0x2')},'main':{'type':Sequelize[_0x2cbc('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x2cbc('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x2cbc('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x2cbc('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x2cbc('0x3')],'unique':'state'},'description':{'type':Sequelize[_0x2cbc('0x3')]},'title':{'type':Sequelize[_0x2cbc('0x3')]},'remoteUri':{'type':Sequelize[_0x2cbc('0x3')]},'link':{'type':Sequelize[_0x2cbc('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0xa52f=['BOOLEAN','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x502ca3,_0x36be36){var _0x27f42c=function(_0x1e3045){while(--_0x1e3045){_0x502ca3['push'](_0x502ca3['shift']());}};_0x27f42c(++_0x36be36);}(_0xa52f,0xd9));var _0xfa52=function(_0x536f26,_0x4739c3){_0x536f26=_0x536f26-0x0;var _0x4356ca=_0xa52f[_0x536f26];return _0x4356ca;};'use strict';var Sequelize=require(_0xfa52('0x0'));module['exports']={'name':{'type':Sequelize[_0xfa52('0x1')],'allowNull':![],'unique':_0xfa52('0x2')},'version':{'type':Sequelize[_0xfa52('0x1')],'allowNull':![],'unique':_0xfa52('0x2')},'main':{'type':Sequelize[_0xfa52('0x1')],'defaultValue':_0xfa52('0x3')},'filename':{'type':Sequelize[_0xfa52('0x1')]},'path':{'type':Sequelize[_0xfa52('0x1')]},'type':{'type':Sequelize[_0xfa52('0x1')]},'size':{'type':Sequelize[_0xfa52('0x4')]},'active':{'type':Sequelize[_0xfa52('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xfa52('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xfa52('0x1')],'unique':'state'},'description':{'type':Sequelize[_0xfa52('0x1')]},'title':{'type':Sequelize[_0xfa52('0x1')]},'remoteUri':{'type':Sequelize[_0xfa52('0x1')]},'link':{'type':Sequelize[_0xfa52('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 386c560..b6e95c2 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 _0xb19d=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','options','find','create','body','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','map','Integration'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0xb19d,0x1d5));var _0xdb19=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0xb19d[_0x364cf8];return _0x6a59ee;};'use strict';var pdf=require(_0xdb19('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb19('0x2'));var rp=require(_0xdb19('0x3'));var moment=require(_0xdb19('0x4'));var BPromise=require(_0xdb19('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb19('0x6'));var sox=require(_0xdb19('0x7'));var csv=require(_0xdb19('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdb19('0x9'));var squel=require('squel');var crypto=require(_0xdb19('0xa'));var jsforce=require(_0xdb19('0xb'));var deskjs=require(_0xdb19('0xc'));var toCsv=require(_0xdb19('0x8'));var querystring=require(_0xdb19('0xd'));var Papa=require(_0xdb19('0xe'));var Redis=require('ioredis');var authService=require(_0xdb19('0xf'));var qs=require(_0xdb19('0x10'));var as=require(_0xdb19('0x11'));var hardwareService=require(_0xdb19('0x12'));var logger=require(_0xdb19('0x13'))(_0xdb19('0x14'));var utils=require(_0xdb19('0x15'));var config=require(_0xdb19('0x16'));var db=require(_0xdb19('0x17'))['db'];function respondWithStatusCode(_0x2a9173,_0x2b88d5){_0x2b88d5=_0x2b88d5||0xcc;return function(_0x130e0e){if(_0x130e0e){return _0x2a9173[_0xdb19('0x18')](_0x2b88d5);}return _0x2a9173['status'](_0x2b88d5)[_0xdb19('0x19')]();};}function respondWithResult(_0x192bd1,_0x5a1c0f){_0x5a1c0f=_0x5a1c0f||0xc8;return function(_0x1d6990){if(_0x1d6990){return _0x192bd1[_0xdb19('0x1a')](_0x5a1c0f)[_0xdb19('0x1b')](_0x1d6990);}};}function respondWithFilteredResult(_0x55a104,_0x57f088){return function(_0x1caec5){if(_0x1caec5){var _0x113c69=_0x1caec5['count'],_0x475c6c=_0x57f088[_0xdb19('0x1c')],_0x4e8b5e=_0x57f088['offset']+_0x57f088[_0xdb19('0x1d')],_0x19d492;if(_0x4e8b5e>=_0x113c69){_0x4e8b5e=_0x113c69;_0x19d492=0xc8;}else{_0x19d492=0xce;}_0x55a104['status'](_0x19d492);return _0x55a104[_0xdb19('0x1e')]('Content-Range',_0x475c6c+'-'+_0x4e8b5e+'/'+_0x113c69)[_0xdb19('0x1b')](_0x1caec5);}return null;};}function patchUpdates(_0xf9741f){return function(_0x5c5791){try{jsonpatch[_0xdb19('0x1f')](_0x5c5791,_0xf9741f,!![]);}catch(_0x29b5e9){return BPromise[_0xdb19('0x20')](_0x29b5e9);}return _0x5c5791[_0xdb19('0x21')]();};}function saveUpdates(_0x11a1df,_0x59b5af){return function(_0x3c531c){if(_0x3c531c){return _0x3c531c[_0xdb19('0x22')](_0x11a1df)[_0xdb19('0x23')](function(_0x180434){return _0x180434;});}return null;};}function removeEntity(_0x12a392,_0x42de8a){return function(_0x4e2537){if(_0x4e2537){return _0x4e2537[_0xdb19('0x24')]()[_0xdb19('0x23')](function(){_0x12a392[_0xdb19('0x1a')](0xcc)[_0xdb19('0x19')]();});}};}function handleEntityNotFound(_0x225306,_0x25685f){return function(_0xb2cba0){if(!_0xb2cba0){_0x225306[_0xdb19('0x18')](0x194);}return _0xb2cba0;};}function handleError(_0x5f13b5,_0x4f9881){_0x4f9881=_0x4f9881||0x1f4;return function(_0x19d2d5){logger['error'](_0x19d2d5[_0xdb19('0x25')]);if(_0x19d2d5[_0xdb19('0x26')]){delete _0x19d2d5[_0xdb19('0x26')];}_0x5f13b5[_0xdb19('0x1a')](_0x4f9881)[_0xdb19('0x27')](_0x19d2d5);};}exports['index']=function(_0x4fb670,_0x4124ec){var _0x3280b2={},_0x68a741={},_0x125617={'count':0x0,'rows':[]};var _0x376208=_[_0xdb19('0x28')](db[_0xdb19('0x29')][_0xdb19('0x2a')],function(_0x46471e){return{'name':_0x46471e[_0xdb19('0x2b')],'type':_0x46471e[_0xdb19('0x2c')][_0xdb19('0x2d')]};});_0x68a741[_0xdb19('0x2e')]=_[_0xdb19('0x28')](_0x376208,_0xdb19('0x26'));_0x68a741['query']=_[_0xdb19('0x2f')](_0x4fb670[_0xdb19('0x30')]);_0x68a741[_0xdb19('0x31')]=_[_0xdb19('0x32')](_0x68a741[_0xdb19('0x2e')],_0x68a741['query']);_0x3280b2[_0xdb19('0x33')]=_[_0xdb19('0x32')](_0x68a741[_0xdb19('0x2e')],qs[_0xdb19('0x34')](_0x4fb670[_0xdb19('0x30')][_0xdb19('0x34')]));_0x3280b2[_0xdb19('0x33')]=_0x3280b2['attributes'][_0xdb19('0x35')]?_0x3280b2[_0xdb19('0x33')]:_0x68a741[_0xdb19('0x2e')];if(!_0x4fb670[_0xdb19('0x30')][_0xdb19('0x36')](_0xdb19('0x37'))){_0x3280b2[_0xdb19('0x1d')]=qs['limit'](_0x4fb670[_0xdb19('0x30')]['limit']);_0x3280b2[_0xdb19('0x1c')]=qs['offset'](_0x4fb670[_0xdb19('0x30')][_0xdb19('0x1c')]);}_0x3280b2[_0xdb19('0x38')]=qs[_0xdb19('0x39')](_0x4fb670[_0xdb19('0x30')]['sort']);_0x3280b2[_0xdb19('0x3a')]=qs[_0xdb19('0x31')](_['pick'](_0x4fb670[_0xdb19('0x30')],_0x68a741[_0xdb19('0x31')]),_0x376208);if(_0x4fb670[_0xdb19('0x30')][_0xdb19('0x3b')]){_0x3280b2[_0xdb19('0x3a')]=_[_0xdb19('0x3c')](_0x3280b2[_0xdb19('0x3a')],{'$or':_[_0xdb19('0x28')](_0x376208,function(_0x1d083e){if(_0x1d083e[_0xdb19('0x2c')]!==_0xdb19('0x3d')){var _0x408147={};_0x408147[_0x1d083e['name']]={'$like':'%'+_0x4fb670['query'][_0xdb19('0x3b')]+'%'};return _0x408147;}})});}_0x3280b2=_[_0xdb19('0x3c')]({},_0x3280b2,_0x4fb670['options']);var _0x25dfb8={'where':_0x3280b2[_0xdb19('0x3a')]};return db[_0xdb19('0x29')][_0xdb19('0x3e')](_0x25dfb8)[_0xdb19('0x23')](function(_0x510f76){_0x125617[_0xdb19('0x3e')]=_0x510f76;if(_0x4fb670[_0xdb19('0x30')][_0xdb19('0x3f')]){_0x3280b2[_0xdb19('0x40')]=[{'all':!![]}];}return db[_0xdb19('0x29')][_0xdb19('0x41')](_0x3280b2);})[_0xdb19('0x23')](function(_0x2987a6){_0x125617[_0xdb19('0x42')]=_0x2987a6;return _0x125617;})[_0xdb19('0x23')](respondWithFilteredResult(_0x4124ec,_0x3280b2))[_0xdb19('0x43')](handleError(_0x4124ec,null));};exports['show']=function(_0x19051f,_0x22ed7b){var _0x44934e={'raw':![],'where':{'id':_0x19051f['params']['id']}},_0x40d80c={};_0x40d80c[_0xdb19('0x2e')]=_[_0xdb19('0x2f')](db[_0xdb19('0x29')][_0xdb19('0x2a')]);_0x40d80c['query']=_[_0xdb19('0x2f')](_0x19051f['query']);_0x40d80c[_0xdb19('0x31')]=_[_0xdb19('0x32')](_0x40d80c['model'],_0x40d80c['query']);_0x44934e[_0xdb19('0x33')]=_['intersection'](_0x40d80c[_0xdb19('0x2e')],qs['fields'](_0x19051f[_0xdb19('0x30')][_0xdb19('0x34')]));_0x44934e[_0xdb19('0x33')]=_0x44934e['attributes']['length']?_0x44934e[_0xdb19('0x33')]:_0x40d80c[_0xdb19('0x2e')];if(_0x19051f[_0xdb19('0x30')]['includeAll']){_0x44934e['include']=[{'all':!![]}];}_0x44934e=_['merge']({},_0x44934e,_0x19051f[_0xdb19('0x44')]);return db[_0xdb19('0x29')][_0xdb19('0x45')](_0x44934e)[_0xdb19('0x23')](handleEntityNotFound(_0x22ed7b,null))[_0xdb19('0x23')](respondWithResult(_0x22ed7b,null))[_0xdb19('0x43')](handleError(_0x22ed7b,null));};exports['create']=function(_0x47b4d5,_0x48a25d){return db[_0xdb19('0x29')][_0xdb19('0x46')](_0x47b4d5[_0xdb19('0x47')],{})[_0xdb19('0x23')](respondWithResult(_0x48a25d,0xc9))[_0xdb19('0x43')](handleError(_0x48a25d,null));};exports[_0xdb19('0x22')]=function(_0x158f2a,_0x1db1d4){if(_0x158f2a[_0xdb19('0x47')]['id']){delete _0x158f2a[_0xdb19('0x47')]['id'];}return db[_0xdb19('0x29')][_0xdb19('0x45')]({'where':{'id':_0x158f2a[_0xdb19('0x48')]['id']}})['then'](handleEntityNotFound(_0x1db1d4,null))[_0xdb19('0x23')](saveUpdates(_0x158f2a['body'],null))[_0xdb19('0x23')](respondWithResult(_0x1db1d4,null))['catch'](handleError(_0x1db1d4,null));};exports[_0xdb19('0x24')]=function(_0x47de3a,_0x30d718){return db['Integration'][_0xdb19('0x45')]({'where':{'id':_0x47de3a['params']['id']}})[_0xdb19('0x23')](handleEntityNotFound(_0x30d718,null))['then'](removeEntity(_0x30d718,null))['catch'](handleError(_0x30d718,null));}; \ No newline at end of file +var _0x1030=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','Integration','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x2ffd05,_0x1840e3){var _0x5038bf=function(_0xe7e075){while(--_0xe7e075){_0x2ffd05['push'](_0x2ffd05['shift']());}};_0x5038bf(++_0x1840e3);}(_0x1030,0x84));var _0x0103=function(_0x208576,_0x595b40){_0x208576=_0x208576-0x0;var _0x777662=_0x1030[_0x208576];return _0x777662;};'use strict';var pdf=require(_0x0103('0x0'));var emlformat=require(_0x0103('0x1'));var rimraf=require(_0x0103('0x2'));var zipdir=require(_0x0103('0x3'));var jsonpatch=require(_0x0103('0x4'));var rp=require(_0x0103('0x5'));var moment=require(_0x0103('0x6'));var BPromise=require(_0x0103('0x7'));var Mustache=require(_0x0103('0x8'));var util=require(_0x0103('0x9'));var path=require('path');var sox=require(_0x0103('0xa'));var csv=require(_0x0103('0xb'));var ejs=require(_0x0103('0xc'));var fs=require('fs');var _=require(_0x0103('0xd'));var squel=require('squel');var crypto=require(_0x0103('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0103('0xf'));var toCsv=require(_0x0103('0xb'));var querystring=require(_0x0103('0x10'));var Papa=require(_0x0103('0x11'));var Redis=require(_0x0103('0x12'));var authService=require(_0x0103('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0103('0x14'));var logger=require(_0x0103('0x15'))('api');var utils=require(_0x0103('0x16'));var config=require(_0x0103('0x17'));var db=require(_0x0103('0x18'))['db'];function respondWithStatusCode(_0x5f5316,_0x7881dd){_0x7881dd=_0x7881dd||0xcc;return function(_0x3b9206){if(_0x3b9206){return _0x5f5316[_0x0103('0x19')](_0x7881dd);}return _0x5f5316[_0x0103('0x1a')](_0x7881dd)['end']();};}function respondWithResult(_0x4ab43e,_0x34156c){_0x34156c=_0x34156c||0xc8;return function(_0x40f16b){if(_0x40f16b){return _0x4ab43e[_0x0103('0x1a')](_0x34156c)[_0x0103('0x1b')](_0x40f16b);}};}function respondWithFilteredResult(_0x528779,_0x473798){return function(_0xa6023c){if(_0xa6023c){var _0xeeecba=_0xa6023c[_0x0103('0x1c')],_0x38ee9d=_0x473798[_0x0103('0x1d')],_0x206ae4=_0x473798[_0x0103('0x1d')]+_0x473798[_0x0103('0x1e')],_0x482620;if(_0x206ae4>=_0xeeecba){_0x206ae4=_0xeeecba;_0x482620=0xc8;}else{_0x482620=0xce;}_0x528779[_0x0103('0x1a')](_0x482620);return _0x528779[_0x0103('0x1f')](_0x0103('0x20'),_0x38ee9d+'-'+_0x206ae4+'/'+_0xeeecba)[_0x0103('0x1b')](_0xa6023c);}return null;};}function patchUpdates(_0x5ecbe7){return function(_0x101289){try{jsonpatch[_0x0103('0x21')](_0x101289,_0x5ecbe7,!![]);}catch(_0x508027){return BPromise[_0x0103('0x22')](_0x508027);}return _0x101289['save']();};}function saveUpdates(_0xc356fc,_0x2fa993){return function(_0x3de504){if(_0x3de504){return _0x3de504[_0x0103('0x23')](_0xc356fc)['then'](function(_0x1771b1){return _0x1771b1;});}return null;};}function removeEntity(_0x2a7b2a,_0x5b3d67){return function(_0x1daa87){if(_0x1daa87){return _0x1daa87[_0x0103('0x24')]()[_0x0103('0x25')](function(){_0x2a7b2a[_0x0103('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cc991,_0x2d3ee1){return function(_0x948a47){if(!_0x948a47){_0x4cc991[_0x0103('0x19')](0x194);}return _0x948a47;};}function handleError(_0x23acdf,_0x4ca646){_0x4ca646=_0x4ca646||0x1f4;return function(_0x1123dd){logger[_0x0103('0x26')](_0x1123dd[_0x0103('0x27')]);if(_0x1123dd[_0x0103('0x28')]){delete _0x1123dd['name'];}_0x23acdf[_0x0103('0x1a')](_0x4ca646)['send'](_0x1123dd);};}exports[_0x0103('0x29')]=function(_0x322618,_0x3c40d1){var _0xca2d2f={},_0x4a799d={},_0x52a14a={'count':0x0,'rows':[]};var _0x4c7600=_[_0x0103('0x2a')](db[_0x0103('0x2b')][_0x0103('0x2c')],function(_0x1a7b03){return{'name':_0x1a7b03['fieldName'],'type':_0x1a7b03[_0x0103('0x2d')][_0x0103('0x2e')]};});_0x4a799d['model']=_[_0x0103('0x2a')](_0x4c7600,_0x0103('0x28'));_0x4a799d[_0x0103('0x2f')]=_[_0x0103('0x30')](_0x322618[_0x0103('0x2f')]);_0x4a799d[_0x0103('0x31')]=_[_0x0103('0x32')](_0x4a799d['model'],_0x4a799d[_0x0103('0x2f')]);_0xca2d2f[_0x0103('0x33')]=_[_0x0103('0x32')](_0x4a799d['model'],qs[_0x0103('0x34')](_0x322618[_0x0103('0x2f')][_0x0103('0x34')]));_0xca2d2f['attributes']=_0xca2d2f['attributes'][_0x0103('0x35')]?_0xca2d2f['attributes']:_0x4a799d[_0x0103('0x36')];if(!_0x322618['query'][_0x0103('0x37')](_0x0103('0x38'))){_0xca2d2f['limit']=qs[_0x0103('0x1e')](_0x322618[_0x0103('0x2f')]['limit']);_0xca2d2f['offset']=qs[_0x0103('0x1d')](_0x322618[_0x0103('0x2f')][_0x0103('0x1d')]);}_0xca2d2f[_0x0103('0x39')]=qs[_0x0103('0x3a')](_0x322618[_0x0103('0x2f')]['sort']);_0xca2d2f[_0x0103('0x3b')]=qs[_0x0103('0x31')](_['pick'](_0x322618[_0x0103('0x2f')],_0x4a799d[_0x0103('0x31')]),_0x4c7600);if(_0x322618[_0x0103('0x2f')][_0x0103('0x3c')]){_0xca2d2f['where']=_[_0x0103('0x3d')](_0xca2d2f[_0x0103('0x3b')],{'$or':_[_0x0103('0x2a')](_0x4c7600,function(_0x1b889e){if(_0x1b889e['type']!==_0x0103('0x3e')){var _0x135746={};_0x135746[_0x1b889e['name']]={'$like':'%'+_0x322618['query'][_0x0103('0x3c')]+'%'};return _0x135746;}})});}_0xca2d2f=_[_0x0103('0x3d')]({},_0xca2d2f,_0x322618[_0x0103('0x3f')]);var _0xb9ce21={'where':_0xca2d2f[_0x0103('0x3b')]};return db[_0x0103('0x2b')]['count'](_0xb9ce21)['then'](function(_0x39c6dc){_0x52a14a[_0x0103('0x1c')]=_0x39c6dc;if(_0x322618['query'][_0x0103('0x40')]){_0xca2d2f[_0x0103('0x41')]=[{'all':!![]}];}return db[_0x0103('0x2b')][_0x0103('0x42')](_0xca2d2f);})[_0x0103('0x25')](function(_0x5b6411){_0x52a14a[_0x0103('0x43')]=_0x5b6411;return _0x52a14a;})[_0x0103('0x25')](respondWithFilteredResult(_0x3c40d1,_0xca2d2f))[_0x0103('0x44')](handleError(_0x3c40d1,null));};exports['show']=function(_0x2059d8,_0x170fa4){var _0x4f29a5={'raw':![],'where':{'id':_0x2059d8[_0x0103('0x45')]['id']}},_0x23bcf4={};_0x23bcf4['model']=_['keys'](db[_0x0103('0x2b')][_0x0103('0x2c')]);_0x23bcf4['query']=_[_0x0103('0x30')](_0x2059d8[_0x0103('0x2f')]);_0x23bcf4[_0x0103('0x31')]=_[_0x0103('0x32')](_0x23bcf4[_0x0103('0x36')],_0x23bcf4[_0x0103('0x2f')]);_0x4f29a5['attributes']=_['intersection'](_0x23bcf4[_0x0103('0x36')],qs['fields'](_0x2059d8[_0x0103('0x2f')][_0x0103('0x34')]));_0x4f29a5[_0x0103('0x33')]=_0x4f29a5[_0x0103('0x33')]['length']?_0x4f29a5['attributes']:_0x23bcf4[_0x0103('0x36')];if(_0x2059d8['query'][_0x0103('0x40')]){_0x4f29a5[_0x0103('0x41')]=[{'all':!![]}];}_0x4f29a5=_['merge']({},_0x4f29a5,_0x2059d8['options']);return db[_0x0103('0x2b')][_0x0103('0x46')](_0x4f29a5)[_0x0103('0x25')](handleEntityNotFound(_0x170fa4,null))[_0x0103('0x25')](respondWithResult(_0x170fa4,null))[_0x0103('0x44')](handleError(_0x170fa4,null));};exports[_0x0103('0x47')]=function(_0x4cdb81,_0x17ef28){return db[_0x0103('0x2b')][_0x0103('0x47')](_0x4cdb81[_0x0103('0x48')],{})[_0x0103('0x25')](respondWithResult(_0x17ef28,0xc9))[_0x0103('0x44')](handleError(_0x17ef28,null));};exports[_0x0103('0x23')]=function(_0x11a57d,_0x49ecab){if(_0x11a57d[_0x0103('0x48')]['id']){delete _0x11a57d['body']['id'];}return db[_0x0103('0x2b')]['find']({'where':{'id':_0x11a57d['params']['id']}})['then'](handleEntityNotFound(_0x49ecab,null))[_0x0103('0x25')](saveUpdates(_0x11a57d[_0x0103('0x48')],null))['then'](respondWithResult(_0x49ecab,null))[_0x0103('0x44')](handleError(_0x49ecab,null));};exports['destroy']=function(_0x50bc0c,_0x1506d0){return db[_0x0103('0x2b')][_0x0103('0x46')]({'where':{'id':_0x50bc0c[_0x0103('0x45')]['id']}})['then'](handleEntityNotFound(_0x1506d0,null))[_0x0103('0x25')](removeEntity(_0x1506d0,null))[_0x0103('0x44')](handleError(_0x1506d0,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7e326d4..b0b981e 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 _0xd507=['Integration','path','../../config/environment','./integration.attributes','exports'];(function(_0x1c9ada,_0x2a6e15){var _0x40c0b5=function(_0x17491f){while(--_0x17491f){_0x1c9ada['push'](_0x1c9ada['shift']());}};_0x40c0b5(++_0x2a6e15);}(_0xd507,0x10f));var _0x7d50=function(_0x22c03f,_0x2e737c){_0x22c03f=_0x22c03f-0x0;var _0x48f800=_0xd507[_0x22c03f];return _0x48f800;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d50('0x0'));var rimraf=require('rimraf');var config=require(_0x7d50('0x1'));var attributes=require(_0x7d50('0x2'));module[_0x7d50('0x3')]=function(_0x53cec8,_0x5e61ac){return _0x53cec8['define'](_0x7d50('0x4'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x402e=['path','rimraf','../../config/environment','./integration.attributes','exports','integrations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x576dea,_0x4bc527){var _0x4cd999=function(_0x5c1ead){while(--_0x5c1ead){_0x576dea['push'](_0x576dea['shift']());}};_0x4cd999(++_0x4bc527);}(_0x402e,0x119));var _0xe402=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x402e[_0x5b34c0];return _0x242bd3;};'use strict';var _=require(_0xe402('0x0'));var util=require(_0xe402('0x1'));var logger=require(_0xe402('0x2'))('api');var moment=require(_0xe402('0x3'));var BPromise=require(_0xe402('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe402('0x5'));var rimraf=require(_0xe402('0x6'));var config=require(_0xe402('0x7'));var attributes=require(_0xe402('0x8'));module[_0xe402('0x9')]=function(_0x4133d6,_0x2edf98){return _0x4133d6['define']('Integration',attributes,{'tableName':_0xe402('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index fcd100c..93bb883 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 _0x0ba7=['client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x0ba7,0x16d));var _0x70ba=function(_0x44e95a,_0x4e3701){_0x44e95a=_0x44e95a-0x0;var _0x359ae2=_0x0ba7[_0x44e95a];return _0x359ae2;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var moment=require(_0x70ba('0x1'));var BPromise=require(_0x70ba('0x2'));var rs=require(_0x70ba('0x3'));var fs=require('fs');var Redis=require(_0x70ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var config=require(_0x70ba('0x8'));var jayson=require(_0x70ba('0x9'));var client=jayson[_0x70ba('0xa')][_0x70ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d5a16,_0x240696,_0x1185cb){return new BPromise(function(_0x1a968b,_0x41cd10){return client[_0x70ba('0xc')](_0x2d5a16,_0x1185cb)[_0x70ba('0xd')](function(_0x465b7c){logger['info'](_0x70ba('0xe'),_0x240696,'request\x20sent');logger[_0x70ba('0xf')](_0x70ba('0x10'),_0x240696,_0x70ba('0x11'),JSON[_0x70ba('0x12')](_0x465b7c));if(_0x465b7c['error']){if(_0x465b7c['error'][_0x70ba('0x13')]===0x1f4){logger['error'](_0x70ba('0xe'),_0x240696,_0x465b7c['error'][_0x70ba('0x14')]);return _0x41cd10(_0x465b7c[_0x70ba('0x15')]['message']);}logger[_0x70ba('0x15')]('Integration,\x20%s,\x20%s',_0x240696,_0x465b7c[_0x70ba('0x15')][_0x70ba('0x14')]);return _0x1a968b(_0x465b7c[_0x70ba('0x15')][_0x70ba('0x14')]);}else{logger[_0x70ba('0x16')](_0x70ba('0xe'),_0x240696,_0x70ba('0x11'));_0x1a968b(_0x465b7c[_0x70ba('0x17')][_0x70ba('0x14')]);}})[_0x70ba('0x18')](function(_0x30ac22){logger[_0x70ba('0x15')](_0x70ba('0xe'),_0x240696,_0x30ac22);_0x41cd10(_0x30ac22);});});} \ No newline at end of file +var _0x4ddd=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x4bd046,_0x1a8a43){var _0x148457=function(_0x263601){while(--_0x263601){_0x4bd046['push'](_0x4bd046['shift']());}};_0x148457(++_0x1a8a43);}(_0x4ddd,0x18b));var _0xd4dd=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x4ddd[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xd4dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd4dd('0x1'));var logger=require(_0xd4dd('0x2'))(_0xd4dd('0x3'));var config=require('../../config/environment');var jayson=require(_0xd4dd('0x4'));var client=jayson[_0xd4dd('0x5')][_0xd4dd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x65f5a4,_0x3e8b86,_0x1c3abd){return new BPromise(function(_0xa057d1,_0x55b937){return client[_0xd4dd('0x7')](_0x65f5a4,_0x1c3abd)[_0xd4dd('0x8')](function(_0x490200){logger[_0xd4dd('0x9')](_0xd4dd('0xa'),_0x3e8b86,_0xd4dd('0xb'));logger[_0xd4dd('0xc')]('Integration,\x20%s,\x20%s,\x20%s',_0x3e8b86,'request\x20sent',JSON[_0xd4dd('0xd')](_0x490200));if(_0x490200['error']){if(_0x490200[_0xd4dd('0xe')][_0xd4dd('0xf')]===0x1f4){logger[_0xd4dd('0xe')](_0xd4dd('0xa'),_0x3e8b86,_0x490200[_0xd4dd('0xe')][_0xd4dd('0x10')]);return _0x55b937(_0x490200[_0xd4dd('0xe')]['message']);}logger[_0xd4dd('0xe')](_0xd4dd('0xa'),_0x3e8b86,_0x490200[_0xd4dd('0xe')][_0xd4dd('0x10')]);return _0xa057d1(_0x490200['error'][_0xd4dd('0x10')]);}else{logger[_0xd4dd('0x9')](_0xd4dd('0xa'),_0x3e8b86,_0xd4dd('0xb'));_0xa057d1(_0x490200['result'][_0xd4dd('0x10')]);}})[_0xd4dd('0x11')](function(_0x35b901){logger[_0xd4dd('0xe')](_0xd4dd('0xa'),_0x3e8b86,_0x35b901);_0x55b937(_0x35b901);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 00d7aa6..5af7051 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 _0x73a5=['describe','/:id','show','post','create','put','update','delete','exports','util','path','Router','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe'];(function(_0xfbe72b,_0x284351){var _0xe38d9d=function(_0x5199ee){while(--_0x5199ee){_0xfbe72b['push'](_0xfbe72b['shift']());}};_0xe38d9d(++_0x284351);}(_0x73a5,0x15f));var _0x573a=function(_0x7004a8,_0x1ca0ef){_0x7004a8=_0x7004a8-0x0;var _0x3d3a5b=_0x73a5[_0x7004a8];return _0x3d3a5b;};'use strict';var multer=require('multer');var util=require(_0x573a('0x0'));var path=require(_0x573a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x573a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x573a('0x3'));var config=require('../../config/environment');var controller=require(_0x573a('0x4'));router[_0x573a('0x5')]('/',auth[_0x573a('0x6')](),controller[_0x573a('0x7')]);router[_0x573a('0x5')](_0x573a('0x8'),auth[_0x573a('0x6')](),controller[_0x573a('0x9')]);router[_0x573a('0x5')](_0x573a('0xa'),auth[_0x573a('0x6')](),controller[_0x573a('0xb')]);router[_0x573a('0xc')]('/',auth['isAuthenticated'](),controller[_0x573a('0xd')]);router[_0x573a('0xe')](_0x573a('0xa'),auth[_0x573a('0x6')](),controller[_0x573a('0xf')]);router[_0x573a('0x10')](_0x573a('0xa'),auth[_0x573a('0x6')](),controller['destroy']);module[_0x573a('0x11')]=router; \ No newline at end of file +var _0xbe06=['create','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbe06,0x144));var _0x6be0=function(_0x19a3b0,_0xda9044){_0x19a3b0=_0x19a3b0-0x0;var _0x47caee=_0xbe06[_0x19a3b0];return _0x47caee;};'use strict';var multer=require(_0x6be0('0x0'));var util=require('util');var path=require(_0x6be0('0x1'));var timeout=require(_0x6be0('0x2'));var express=require(_0x6be0('0x3'));var router=express[_0x6be0('0x4')]();var auth=require(_0x6be0('0x5'));var interaction=require(_0x6be0('0x6'));var config=require(_0x6be0('0x7'));var controller=require('./integrationReport.controller');router[_0x6be0('0x8')]('/',auth[_0x6be0('0x9')](),controller['index']);router['get']('/describe',auth[_0x6be0('0x9')](),controller['describe']);router[_0x6be0('0x8')](_0x6be0('0xa'),auth[_0x6be0('0x9')](),controller['show']);router[_0x6be0('0xb')]('/',auth['isAuthenticated'](),controller[_0x6be0('0xc')]);router[_0x6be0('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6be0('0xe')]);router['delete'](_0x6be0('0xa'),auth[_0x6be0('0x9')](),controller[_0x6be0('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index a5569a4..f500c6b 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 _0x429f=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','STRING'];(function(_0x2330a1,_0x4bb8d3){var _0x32c0a6=function(_0xba8ada){while(--_0xba8ada){_0x2330a1['push'](_0x2330a1['shift']());}};_0x32c0a6(++_0x4bb8d3);}(_0x429f,0x15c));var _0xf429=function(_0x5b5199,_0x58a8e5){_0x5b5199=_0x5b5199-0x0;var _0x2f5736=_0x429f[_0x5b5199];return _0x2f5736;};'use strict';var Sequelize=require(_0xf429('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xf429('0x1')]},'exitStatus':{'type':Sequelize[_0xf429('0x1')]},'ticketId':{'type':Sequelize[_0xf429('0x1')]},'integrationId':{'type':Sequelize[_0xf429('0x2')]},'contacts':{'type':Sequelize[_0xf429('0x1')]},'uniqueid':{'type':Sequelize[_0xf429('0x1')]},'calleridnum':{'type':Sequelize[_0xf429('0x1')]},'calleridname':{'type':Sequelize[_0xf429('0x1')]},'queue':{'type':Sequelize[_0xf429('0x1')]},'interface':{'type':Sequelize[_0xf429('0x1')]},'membername':{'type':Sequelize[_0xf429('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf429('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf429('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf429('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf429('0x2')]},'reason':{'type':Sequelize[_0xf429('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf429('0x3')]},'agentdump':{'type':Sequelize[_0xf429('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf429('0x3')]},'lastevent':{'type':Sequelize[_0xf429('0x1')]},'channel':{'type':Sequelize[_0xf429('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf429('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf429('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf429('0x1')]},'context':{'type':Sequelize[_0xf429('0x1')]},'exten':{'type':Sequelize[_0xf429('0x1')]},'priority':{'type':Sequelize[_0xf429('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf429('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf429('0x1')]},'destaccountcode':{'type':Sequelize[_0xf429('0x1')]},'destcontext':{'type':Sequelize[_0xf429('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xf429('0x1')]},'messageId':{'type':Sequelize[_0xf429('0x1')]},'inReplyTo':{'type':Sequelize[_0xf429('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xf429('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xf429('0x5')]},'text':{'type':Sequelize[_0xf429('0x5')]},'status':{'type':Sequelize[_0xf429('0x6')](_0xf429('0x7'),'SENDING',_0xf429('0x8'),_0xf429('0x9'))},'url':{'type':Sequelize[_0xf429('0x1')]},'app':{'type':Sequelize[_0xf429('0x1')]},'appdata':{'type':Sequelize[_0xf429('0x1')]},'projectId':{'type':Sequelize[_0xf429('0x2')]}}; \ No newline at end of file +var _0xf788=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED'];(function(_0x1633b7,_0x581d1a){var _0x4da6ad=function(_0x44536f){while(--_0x44536f){_0x1633b7['push'](_0x1633b7['shift']());}};_0x4da6ad(++_0x581d1a);}(_0xf788,0xa2));var _0x8f78=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xf788[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x8f78('0x0')]},'ticketId':{'type':Sequelize[_0x8f78('0x0')]},'integrationId':{'type':Sequelize[_0x8f78('0x1')]},'contacts':{'type':Sequelize[_0x8f78('0x0')]},'uniqueid':{'type':Sequelize[_0x8f78('0x0')]},'calleridnum':{'type':Sequelize[_0x8f78('0x0')]},'calleridname':{'type':Sequelize[_0x8f78('0x0')]},'queue':{'type':Sequelize[_0x8f78('0x0')]},'interface':{'type':Sequelize[_0x8f78('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8f78('0x2')]},'agentconnectAt':{'type':Sequelize[_0x8f78('0x2')]},'holdtime':{'type':Sequelize[_0x8f78('0x1')]},'agentcomplete':{'type':Sequelize[_0x8f78('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8f78('0x2')]},'talktime':{'type':Sequelize[_0x8f78('0x1')]},'agentacw':{'type':Sequelize[_0x8f78('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8f78('0x1')]},'reason':{'type':Sequelize[_0x8f78('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x8f78('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x8f78('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8f78('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8f78('0x0')]},'connectedlinenum':{'type':Sequelize[_0x8f78('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8f78('0x0')]},'accountcode':{'type':Sequelize[_0x8f78('0x0')]},'context':{'type':Sequelize[_0x8f78('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8f78('0x0')]},'destchannel':{'type':Sequelize[_0x8f78('0x0')]},'destchannelstate':{'type':Sequelize[_0x8f78('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x8f78('0x0')]},'destcalleridnum':{'type':Sequelize[_0x8f78('0x0')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8f78('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8f78('0x0')]},'destcontext':{'type':Sequelize[_0x8f78('0x0')]},'destexten':{'type':Sequelize[_0x8f78('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8f78('0x0')]},'messageId':{'type':Sequelize[_0x8f78('0x0')]},'inReplyTo':{'type':Sequelize[_0x8f78('0x0')]},'subject':{'type':Sequelize[_0x8f78('0x0')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x8f78('0x0')]},'cc':{'type':Sequelize[_0x8f78('0x0')]},'attachment':{'type':Sequelize[_0x8f78('0x4')]},'html':{'type':Sequelize[_0x8f78('0x4')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x8f78('0x5')]('SENT',_0x8f78('0x6'),_0x8f78('0x7'),_0x8f78('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x8f78('0x0')]},'appdata':{'type':Sequelize[_0x8f78('0x0')]},'projectId':{'type':Sequelize[_0x8f78('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d1c8d5b..c342226 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 _0xf3df=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','IntegrationReport','includeAll','findAll','rows','catch','params','keys','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf3df,0x88));var _0xff3d=function(_0x185a70,_0x576d8b){_0x185a70=_0x185a70-0x0;var _0x4d599c=_0xf3df[_0x185a70];return _0x4d599c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff3d('0x0'));var rimraf=require(_0xff3d('0x1'));var zipdir=require(_0xff3d('0x2'));var jsonpatch=require(_0xff3d('0x3'));var rp=require(_0xff3d('0x4'));var moment=require(_0xff3d('0x5'));var BPromise=require(_0xff3d('0x6'));var Mustache=require(_0xff3d('0x7'));var util=require(_0xff3d('0x8'));var path=require('path');var sox=require(_0xff3d('0x9'));var csv=require('to-csv');var ejs=require(_0xff3d('0xa'));var fs=require('fs');var _=require(_0xff3d('0xb'));var squel=require(_0xff3d('0xc'));var crypto=require(_0xff3d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xff3d('0xe'));var toCsv=require(_0xff3d('0xf'));var querystring=require(_0xff3d('0x10'));var Papa=require(_0xff3d('0x11'));var Redis=require(_0xff3d('0x12'));var authService=require(_0xff3d('0x13'));var qs=require(_0xff3d('0x14'));var as=require(_0xff3d('0x15'));var hardwareService=require(_0xff3d('0x16'));var logger=require(_0xff3d('0x17'))(_0xff3d('0x18'));var utils=require('../../config/utils');var config=require(_0xff3d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x592b32,_0x1b96b2){_0x1b96b2=_0x1b96b2||0xcc;return function(_0x3f758d){if(_0x3f758d){return _0x592b32[_0xff3d('0x1a')](_0x1b96b2);}return _0x592b32[_0xff3d('0x1b')](_0x1b96b2)['end']();};}function respondWithResult(_0x310c8d,_0x3d99d4){_0x3d99d4=_0x3d99d4||0xc8;return function(_0x57203d){if(_0x57203d){return _0x310c8d[_0xff3d('0x1b')](_0x3d99d4)[_0xff3d('0x1c')](_0x57203d);}};}function respondWithFilteredResult(_0x842fd0,_0x1832ba){return function(_0x153fdd){if(_0x153fdd){var _0x513f1c=_0x153fdd[_0xff3d('0x1d')],_0x8fad0d=_0x1832ba[_0xff3d('0x1e')],_0x9408d8=_0x1832ba[_0xff3d('0x1e')]+_0x1832ba[_0xff3d('0x1f')],_0x202791;if(_0x9408d8>=_0x513f1c){_0x9408d8=_0x513f1c;_0x202791=0xc8;}else{_0x202791=0xce;}_0x842fd0[_0xff3d('0x1b')](_0x202791);return _0x842fd0[_0xff3d('0x20')](_0xff3d('0x21'),_0x8fad0d+'-'+_0x9408d8+'/'+_0x513f1c)[_0xff3d('0x1c')](_0x153fdd);}return null;};}function patchUpdates(_0x79c2fc){return function(_0x3bfe86){try{jsonpatch['apply'](_0x3bfe86,_0x79c2fc,!![]);}catch(_0x5268b4){return BPromise[_0xff3d('0x22')](_0x5268b4);}return _0x3bfe86['save']();};}function saveUpdates(_0x25b073,_0x2ca1fc){return function(_0x4b1eca){if(_0x4b1eca){return _0x4b1eca[_0xff3d('0x23')](_0x25b073)[_0xff3d('0x24')](function(_0x19e256){return _0x19e256;});}return null;};}function removeEntity(_0xc94f18,_0xf43619){return function(_0x478174){if(_0x478174){return _0x478174['destroy']()[_0xff3d('0x24')](function(){_0xc94f18[_0xff3d('0x1b')](0xcc)[_0xff3d('0x25')]();});}};}function handleEntityNotFound(_0x277e85,_0x3f7438){return function(_0x489968){if(!_0x489968){_0x277e85['sendStatus'](0x194);}return _0x489968;};}function handleError(_0x51ceb3,_0x18b47e){_0x18b47e=_0x18b47e||0x1f4;return function(_0xa4c885){logger[_0xff3d('0x26')](_0xa4c885[_0xff3d('0x27')]);if(_0xa4c885[_0xff3d('0x28')]){delete _0xa4c885[_0xff3d('0x28')];}_0x51ceb3['status'](_0x18b47e)[_0xff3d('0x29')](_0xa4c885);};}exports['index']=function(_0x1c0d66,_0x406062){var _0x5189ae={},_0x5d145f={},_0x1642d5={'count':0x0,'rows':[]};var _0x2b2ab6=_[_0xff3d('0x2a')](db['IntegrationReport'][_0xff3d('0x2b')],function(_0x5678b2){return{'name':_0x5678b2[_0xff3d('0x2c')],'type':_0x5678b2['type']['key']};});_0x5d145f[_0xff3d('0x2d')]=_[_0xff3d('0x2a')](_0x2b2ab6,_0xff3d('0x28'));_0x5d145f[_0xff3d('0x2e')]=_['keys'](_0x1c0d66['query']);_0x5d145f['filters']=_['intersection'](_0x5d145f[_0xff3d('0x2d')],_0x5d145f[_0xff3d('0x2e')]);_0x5189ae[_0xff3d('0x2f')]=_[_0xff3d('0x30')](_0x5d145f['model'],qs[_0xff3d('0x31')](_0x1c0d66[_0xff3d('0x2e')][_0xff3d('0x31')]));_0x5189ae[_0xff3d('0x2f')]=_0x5189ae[_0xff3d('0x2f')][_0xff3d('0x32')]?_0x5189ae[_0xff3d('0x2f')]:_0x5d145f[_0xff3d('0x2d')];if(!_0x1c0d66['query'][_0xff3d('0x33')](_0xff3d('0x34'))){_0x5189ae[_0xff3d('0x1f')]=qs[_0xff3d('0x1f')](_0x1c0d66['query'][_0xff3d('0x1f')]);_0x5189ae[_0xff3d('0x1e')]=qs['offset'](_0x1c0d66[_0xff3d('0x2e')][_0xff3d('0x1e')]);}_0x5189ae[_0xff3d('0x35')]=qs[_0xff3d('0x36')](_0x1c0d66[_0xff3d('0x2e')][_0xff3d('0x36')]);_0x5189ae[_0xff3d('0x37')]=qs['filters'](_[_0xff3d('0x38')](_0x1c0d66[_0xff3d('0x2e')],_0x5d145f[_0xff3d('0x39')]),_0x2b2ab6);if(_0x1c0d66[_0xff3d('0x2e')][_0xff3d('0x3a')]){_0x5189ae['where']=_[_0xff3d('0x3b')](_0x5189ae[_0xff3d('0x37')],{'$or':_[_0xff3d('0x2a')](_0x2b2ab6,function(_0x1c8171){if(_0x1c8171[_0xff3d('0x3c')]!=='VIRTUAL'){var _0x46c2bc={};_0x46c2bc[_0x1c8171[_0xff3d('0x28')]]={'$like':'%'+_0x1c0d66['query']['filter']+'%'};return _0x46c2bc;}})});}_0x5189ae=_[_0xff3d('0x3b')]({},_0x5189ae,_0x1c0d66[_0xff3d('0x3d')]);var _0x3e1f09={'where':_0x5189ae[_0xff3d('0x37')]};return db[_0xff3d('0x3e')][_0xff3d('0x1d')](_0x3e1f09)[_0xff3d('0x24')](function(_0x335807){_0x1642d5[_0xff3d('0x1d')]=_0x335807;if(_0x1c0d66[_0xff3d('0x2e')][_0xff3d('0x3f')]){_0x5189ae['include']=[{'all':!![]}];}return db['IntegrationReport'][_0xff3d('0x40')](_0x5189ae);})['then'](function(_0x44cdf9){_0x1642d5[_0xff3d('0x41')]=_0x44cdf9;return _0x1642d5;})[_0xff3d('0x24')](respondWithFilteredResult(_0x406062,_0x5189ae))[_0xff3d('0x42')](handleError(_0x406062,null));};exports['show']=function(_0x1a2ab1,_0x55f8fa){var _0x4d03d8={'raw':![],'where':{'id':_0x1a2ab1[_0xff3d('0x43')]['id']}},_0x138607={};_0x138607[_0xff3d('0x2d')]=_[_0xff3d('0x44')](db[_0xff3d('0x3e')][_0xff3d('0x2b')]);_0x138607[_0xff3d('0x2e')]=_['keys'](_0x1a2ab1[_0xff3d('0x2e')]);_0x138607[_0xff3d('0x39')]=_[_0xff3d('0x30')](_0x138607[_0xff3d('0x2d')],_0x138607[_0xff3d('0x2e')]);_0x4d03d8[_0xff3d('0x2f')]=_[_0xff3d('0x30')](_0x138607[_0xff3d('0x2d')],qs['fields'](_0x1a2ab1[_0xff3d('0x2e')][_0xff3d('0x31')]));_0x4d03d8[_0xff3d('0x2f')]=_0x4d03d8[_0xff3d('0x2f')][_0xff3d('0x32')]?_0x4d03d8['attributes']:_0x138607[_0xff3d('0x2d')];if(_0x1a2ab1[_0xff3d('0x2e')]['includeAll']){_0x4d03d8[_0xff3d('0x45')]=[{'all':!![]}];}_0x4d03d8=_['merge']({},_0x4d03d8,_0x1a2ab1[_0xff3d('0x3d')]);return db[_0xff3d('0x3e')][_0xff3d('0x46')](_0x4d03d8)['then'](handleEntityNotFound(_0x55f8fa,null))[_0xff3d('0x24')](respondWithResult(_0x55f8fa,null))['catch'](handleError(_0x55f8fa,null));};exports[_0xff3d('0x47')]=function(_0x2e3710,_0x36e98c){return db[_0xff3d('0x3e')]['create'](_0x2e3710[_0xff3d('0x48')],{})[_0xff3d('0x24')](respondWithResult(_0x36e98c,0xc9))[_0xff3d('0x42')](handleError(_0x36e98c,null));};exports[_0xff3d('0x23')]=function(_0x1cd702,_0x16ae53){if(_0x1cd702[_0xff3d('0x48')]['id']){delete _0x1cd702[_0xff3d('0x48')]['id'];}return db[_0xff3d('0x3e')][_0xff3d('0x46')]({'where':{'id':_0x1cd702[_0xff3d('0x43')]['id']}})[_0xff3d('0x24')](handleEntityNotFound(_0x16ae53,null))[_0xff3d('0x24')](saveUpdates(_0x1cd702[_0xff3d('0x48')],null))[_0xff3d('0x24')](respondWithResult(_0x16ae53,null))['catch'](handleError(_0x16ae53,null));};exports[_0xff3d('0x49')]=function(_0x22372c,_0x509512){return db[_0xff3d('0x3e')][_0xff3d('0x46')]({'where':{'id':_0x22372c[_0xff3d('0x43')]['id']}})[_0xff3d('0x24')](handleEntityNotFound(_0x509512,null))['then'](removeEntity(_0x509512,null))['catch'](handleError(_0x509512,null));};exports[_0xff3d('0x4a')]=function(_0x98adb4,_0xf622bf){return db[_0xff3d('0x3e')][_0xff3d('0x4a')]()[_0xff3d('0x24')](respondWithResult(_0xf622bf,null))[_0xff3d('0x42')](handleError(_0xf622bf,null));}; \ No newline at end of file +var _0xdf04=['rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','sendStatus','name','send','index','map','IntegrationReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','options','create','update','body','find','params','describe','html-pdf','eml-format'];(function(_0x35400d,_0x41dd4a){var _0x4e4fee=function(_0x4b9569){while(--_0x4b9569){_0x35400d['push'](_0x35400d['shift']());}};_0x4e4fee(++_0x41dd4a);}(_0xdf04,0x15c));var _0x4df0=function(_0x2cbc09,_0x2793bc){_0x2cbc09=_0x2cbc09-0x0;var _0x54bd64=_0xdf04[_0x2cbc09];return _0x54bd64;};'use strict';var pdf=require(_0x4df0('0x0'));var emlformat=require(_0x4df0('0x1'));var rimraf=require(_0x4df0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4df0('0x3'));var rp=require('request-promise');var moment=require(_0x4df0('0x4'));var BPromise=require(_0x4df0('0x5'));var Mustache=require('mustache');var util=require(_0x4df0('0x6'));var path=require(_0x4df0('0x7'));var sox=require(_0x4df0('0x8'));var csv=require(_0x4df0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4df0('0xa'));var squel=require(_0x4df0('0xb'));var crypto=require(_0x4df0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4df0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4df0('0xe'));var Papa=require(_0x4df0('0xf'));var Redis=require('ioredis');var authService=require(_0x4df0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4df0('0x11'));var hardwareService=require(_0x4df0('0x12'));var logger=require(_0x4df0('0x13'))(_0x4df0('0x14'));var utils=require(_0x4df0('0x15'));var config=require(_0x4df0('0x16'));var db=require(_0x4df0('0x17'))['db'];function respondWithStatusCode(_0x3c1e1c,_0x4cb4f5){_0x4cb4f5=_0x4cb4f5||0xcc;return function(_0x3337ec){if(_0x3337ec){return _0x3c1e1c['sendStatus'](_0x4cb4f5);}return _0x3c1e1c[_0x4df0('0x18')](_0x4cb4f5)[_0x4df0('0x19')]();};}function respondWithResult(_0x2dfd3f,_0x53848d){_0x53848d=_0x53848d||0xc8;return function(_0x2dcf04){if(_0x2dcf04){return _0x2dfd3f[_0x4df0('0x18')](_0x53848d)[_0x4df0('0x1a')](_0x2dcf04);}};}function respondWithFilteredResult(_0x15496d,_0x2795bb){return function(_0x47c157){if(_0x47c157){var _0x2b3077=_0x47c157[_0x4df0('0x1b')],_0x5e7f3c=_0x2795bb[_0x4df0('0x1c')],_0xf50bc6=_0x2795bb[_0x4df0('0x1c')]+_0x2795bb[_0x4df0('0x1d')],_0x3cd737;if(_0xf50bc6>=_0x2b3077){_0xf50bc6=_0x2b3077;_0x3cd737=0xc8;}else{_0x3cd737=0xce;}_0x15496d[_0x4df0('0x18')](_0x3cd737);return _0x15496d[_0x4df0('0x1e')](_0x4df0('0x1f'),_0x5e7f3c+'-'+_0xf50bc6+'/'+_0x2b3077)[_0x4df0('0x1a')](_0x47c157);}return null;};}function patchUpdates(_0x2612b7){return function(_0x1c689c){try{jsonpatch['apply'](_0x1c689c,_0x2612b7,!![]);}catch(_0x432e1d){return BPromise['reject'](_0x432e1d);}return _0x1c689c[_0x4df0('0x20')]();};}function saveUpdates(_0x2899ae,_0x5d5b07){return function(_0x15fcc0){if(_0x15fcc0){return _0x15fcc0['update'](_0x2899ae)[_0x4df0('0x21')](function(_0x216686){return _0x216686;});}return null;};}function removeEntity(_0x10d37b,_0x16fee2){return function(_0x8c5219){if(_0x8c5219){return _0x8c5219[_0x4df0('0x22')]()[_0x4df0('0x21')](function(){_0x10d37b[_0x4df0('0x18')](0xcc)[_0x4df0('0x19')]();});}};}function handleEntityNotFound(_0x5b6462,_0x24a086){return function(_0x50101d){if(!_0x50101d){_0x5b6462[_0x4df0('0x23')](0x194);}return _0x50101d;};}function handleError(_0x21d071,_0x5bdc85){_0x5bdc85=_0x5bdc85||0x1f4;return function(_0xdce1ee){logger['error'](_0xdce1ee['stack']);if(_0xdce1ee['name']){delete _0xdce1ee[_0x4df0('0x24')];}_0x21d071[_0x4df0('0x18')](_0x5bdc85)[_0x4df0('0x25')](_0xdce1ee);};}exports[_0x4df0('0x26')]=function(_0x376a0d,_0x40ee75){var _0x873c8e={},_0x1d530d={},_0xc1a362={'count':0x0,'rows':[]};var _0x168a6c=_[_0x4df0('0x27')](db[_0x4df0('0x28')][_0x4df0('0x29')],function(_0x3c0a79){return{'name':_0x3c0a79['fieldName'],'type':_0x3c0a79[_0x4df0('0x2a')][_0x4df0('0x2b')]};});_0x1d530d['model']=_[_0x4df0('0x27')](_0x168a6c,_0x4df0('0x24'));_0x1d530d[_0x4df0('0x2c')]=_[_0x4df0('0x2d')](_0x376a0d['query']);_0x1d530d[_0x4df0('0x2e')]=_[_0x4df0('0x2f')](_0x1d530d[_0x4df0('0x30')],_0x1d530d['query']);_0x873c8e[_0x4df0('0x31')]=_['intersection'](_0x1d530d[_0x4df0('0x30')],qs[_0x4df0('0x32')](_0x376a0d['query'][_0x4df0('0x32')]));_0x873c8e['attributes']=_0x873c8e[_0x4df0('0x31')][_0x4df0('0x33')]?_0x873c8e[_0x4df0('0x31')]:_0x1d530d[_0x4df0('0x30')];if(!_0x376a0d[_0x4df0('0x2c')][_0x4df0('0x34')]('nolimit')){_0x873c8e[_0x4df0('0x1d')]=qs['limit'](_0x376a0d[_0x4df0('0x2c')][_0x4df0('0x1d')]);_0x873c8e[_0x4df0('0x1c')]=qs[_0x4df0('0x1c')](_0x376a0d['query'][_0x4df0('0x1c')]);}_0x873c8e['order']=qs[_0x4df0('0x35')](_0x376a0d[_0x4df0('0x2c')][_0x4df0('0x35')]);_0x873c8e[_0x4df0('0x36')]=qs[_0x4df0('0x2e')](_[_0x4df0('0x37')](_0x376a0d[_0x4df0('0x2c')],_0x1d530d[_0x4df0('0x2e')]),_0x168a6c);if(_0x376a0d[_0x4df0('0x2c')][_0x4df0('0x38')]){_0x873c8e[_0x4df0('0x36')]=_[_0x4df0('0x39')](_0x873c8e['where'],{'$or':_[_0x4df0('0x27')](_0x168a6c,function(_0x3fe689){if(_0x3fe689[_0x4df0('0x2a')]!==_0x4df0('0x3a')){var _0x3a10a1={};_0x3a10a1[_0x3fe689[_0x4df0('0x24')]]={'$like':'%'+_0x376a0d[_0x4df0('0x2c')][_0x4df0('0x38')]+'%'};return _0x3a10a1;}})});}_0x873c8e=_[_0x4df0('0x39')]({},_0x873c8e,_0x376a0d['options']);var _0x2bc932={'where':_0x873c8e[_0x4df0('0x36')]};return db[_0x4df0('0x28')][_0x4df0('0x1b')](_0x2bc932)[_0x4df0('0x21')](function(_0x575663){_0xc1a362[_0x4df0('0x1b')]=_0x575663;if(_0x376a0d[_0x4df0('0x2c')][_0x4df0('0x3b')]){_0x873c8e[_0x4df0('0x3c')]=[{'all':!![]}];}return db[_0x4df0('0x28')]['findAll'](_0x873c8e);})[_0x4df0('0x21')](function(_0x591f3b){_0xc1a362['rows']=_0x591f3b;return _0xc1a362;})[_0x4df0('0x21')](respondWithFilteredResult(_0x40ee75,_0x873c8e))[_0x4df0('0x3d')](handleError(_0x40ee75,null));};exports[_0x4df0('0x3e')]=function(_0x5015f4,_0x1e5944){var _0x3d2846={'raw':![],'where':{'id':_0x5015f4['params']['id']}},_0x26520c={};_0x26520c[_0x4df0('0x30')]=_['keys'](db['IntegrationReport'][_0x4df0('0x29')]);_0x26520c[_0x4df0('0x2c')]=_[_0x4df0('0x2d')](_0x5015f4[_0x4df0('0x2c')]);_0x26520c[_0x4df0('0x2e')]=_['intersection'](_0x26520c[_0x4df0('0x30')],_0x26520c['query']);_0x3d2846[_0x4df0('0x31')]=_[_0x4df0('0x2f')](_0x26520c[_0x4df0('0x30')],qs['fields'](_0x5015f4[_0x4df0('0x2c')][_0x4df0('0x32')]));_0x3d2846[_0x4df0('0x31')]=_0x3d2846[_0x4df0('0x31')][_0x4df0('0x33')]?_0x3d2846[_0x4df0('0x31')]:_0x26520c[_0x4df0('0x30')];if(_0x5015f4[_0x4df0('0x2c')][_0x4df0('0x3b')]){_0x3d2846[_0x4df0('0x3c')]=[{'all':!![]}];}_0x3d2846=_[_0x4df0('0x39')]({},_0x3d2846,_0x5015f4[_0x4df0('0x3f')]);return db[_0x4df0('0x28')]['find'](_0x3d2846)[_0x4df0('0x21')](handleEntityNotFound(_0x1e5944,null))[_0x4df0('0x21')](respondWithResult(_0x1e5944,null))[_0x4df0('0x3d')](handleError(_0x1e5944,null));};exports[_0x4df0('0x40')]=function(_0xd8ef2e,_0x12cdf2){return db['IntegrationReport'][_0x4df0('0x40')](_0xd8ef2e['body'],{})[_0x4df0('0x21')](respondWithResult(_0x12cdf2,0xc9))['catch'](handleError(_0x12cdf2,null));};exports[_0x4df0('0x41')]=function(_0x44b8c5,_0x517430){if(_0x44b8c5[_0x4df0('0x42')]['id']){delete _0x44b8c5[_0x4df0('0x42')]['id'];}return db[_0x4df0('0x28')][_0x4df0('0x43')]({'where':{'id':_0x44b8c5[_0x4df0('0x44')]['id']}})[_0x4df0('0x21')](handleEntityNotFound(_0x517430,null))[_0x4df0('0x21')](saveUpdates(_0x44b8c5[_0x4df0('0x42')],null))[_0x4df0('0x21')](respondWithResult(_0x517430,null))[_0x4df0('0x3d')](handleError(_0x517430,null));};exports[_0x4df0('0x22')]=function(_0x5a98eb,_0x31129d){return db['IntegrationReport'][_0x4df0('0x43')]({'where':{'id':_0x5a98eb['params']['id']}})[_0x4df0('0x21')](handleEntityNotFound(_0x31129d,null))[_0x4df0('0x21')](removeEntity(_0x31129d,null))[_0x4df0('0x3d')](handleError(_0x31129d,null));};exports[_0x4df0('0x45')]=function(_0x16481b,_0x1e035d){return db[_0x4df0('0x28')][_0x4df0('0x45')]()[_0x4df0('0x21')](respondWithResult(_0x1e035d,null))[_0x4df0('0x3d')](handleError(_0x1e035d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 921f3c8..7b01d18 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 _0xee4a=['rimraf','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x38af18,_0x7d1d85){var _0x231ade=function(_0x56d6b3){while(--_0x56d6b3){_0x38af18['push'](_0x38af18['shift']());}};_0x231ade(++_0x7d1d85);}(_0xee4a,0x190));var _0xaee4=function(_0x333bbb,_0x2d1124){_0x333bbb=_0x333bbb-0x0;var _0x1b079e=_0xee4a[_0x333bbb];return _0x1b079e;};'use strict';var _=require(_0xaee4('0x0'));var util=require(_0xaee4('0x1'));var logger=require(_0xaee4('0x2'))(_0xaee4('0x3'));var moment=require(_0xaee4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaee4('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x31abdb,_0x289f66){return _0x31abdb[_0xaee4('0x6')](_0xaee4('0x7'),attributes,{'tableName':_0xaee4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6823=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./integrationReport.attributes'];(function(_0x1a06f0,_0xc3c5c8){var _0x47f356=function(_0x286d89){while(--_0x286d89){_0x1a06f0['push'](_0x1a06f0['shift']());}};_0x47f356(++_0xc3c5c8);}(_0x6823,0xe7));var _0x3682=function(_0x10d5d5,_0x4b624a){_0x10d5d5=_0x10d5d5-0x0;var _0x81aee2=_0x6823[_0x10d5d5];return _0x81aee2;};'use strict';var _=require(_0x3682('0x0'));var util=require(_0x3682('0x1'));var logger=require(_0x3682('0x2'))(_0x3682('0x3'));var moment=require('moment');var BPromise=require(_0x3682('0x4'));var rp=require(_0x3682('0x5'));var fs=require('fs');var path=require(_0x3682('0x6'));var rimraf=require(_0x3682('0x7'));var config=require('../../config/environment');var attributes=require(_0x3682('0x8'));module['exports']=function(_0x4aed2d,_0x5df142){return _0x4aed2d[_0x3682('0x9')](_0x3682('0xa'),attributes,{'tableName':_0x3682('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 9b49237..46487c0 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0x14a0,0x8e));var _0x014a=function(_0x55c90c,_0x310fd3){_0x55c90c=_0x55c90c-0x0;var _0x32739e=_0x14a0[_0x55c90c];return _0x32739e;};'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']('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('IntegrationReport,\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')]('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x475740,_0x4ab048){var _0x518079=function(_0x5bc8da){while(--_0x5bc8da){_0x475740['push'](_0x475740['shift']());}};_0x518079(++_0x4ab048);}(_0x2032,0xd9));var _0x2203=function(_0x294c94,_0x25748a){_0x294c94=_0x294c94-0x0;var _0x2b519f=_0x2032[_0x294c94];return _0x2b519f;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 9bfbc15..97a48be 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x14af83,_0x142cca){var _0xabbc6f=function(_0x17bd64){while(--_0x17bd64){_0x14af83['push'](_0x14af83['shift']());}};_0xabbc6f(++_0x142cca);}(_0x3e74,0x175));var _0x43e7=function(_0x56e87b,_0x2d1815){_0x56e87b=_0x56e87b-0x0;var _0x18e533=_0x3e74[_0x56e87b];return _0x18e533;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x2c71b4,_0x2ebca9){var _0x16025a=function(_0x4a99b9){while(--_0x4a99b9){_0x2c71b4['push'](_0x2c71b4['shift']());}};_0x16025a(++_0x2ebca9);}(_0x008c,0x188));var _0xc008=function(_0x5ef35e,_0x329db7){_0x5ef35e=_0x5ef35e-0x0;var _0x4cdc0c=_0x008c[_0x5ef35e];return _0x4cdc0c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('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 cfbe910..edc11ab 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 _0x6096=['sequelize','exports','STRING'];(function(_0x1c4ea7,_0x25694c){var _0x3e74ba=function(_0xf37d14){while(--_0xf37d14){_0x1c4ea7['push'](_0x1c4ea7['shift']());}};_0x3e74ba(++_0x25694c);}(_0x6096,0x12c));var _0x6609=function(_0x59fdb2,_0x5760cf){_0x59fdb2=_0x59fdb2-0x0;var _0x4c822c=_0x6096[_0x59fdb2];return _0x4c822c;};'use strict';var Sequelize=require(_0x6609('0x0'));module[_0x6609('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6609('0x2')]},'interval':{'type':Sequelize[_0x6609('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6d77=['sequelize','exports','STRING'];(function(_0x19417c,_0x1ed898){var _0x326045=function(_0x2d7caa){while(--_0x2d7caa){_0x19417c['push'](_0x19417c['shift']());}};_0x326045(++_0x1ed898);}(_0x6d77,0x17d));var _0x76d7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6d77[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x76d7('0x0'));module[_0x76d7('0x1')]={'name':{'type':Sequelize[_0x76d7('0x2')]},'description':{'type':Sequelize[_0x76d7('0x2')]},'interval':{'type':Sequelize[_0x76d7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 76366f8..a6c49ef 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 _0x5c2a=['offset','status','set','Content-Range','reject','update','then','get','Intervals','UserProfileResource','destroy','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','transaction','bulkCreate','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count'];(function(_0x260b48,_0x117977){var _0x3f730b=function(_0x7a1e53){while(--_0x7a1e53){_0x260b48['push'](_0x260b48['shift']());}};_0x3f730b(++_0x117977);}(_0x5c2a,0xf9));var _0xa5c2=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x5c2a[_0x2aefb6];return _0x202772;};'use strict';var pdf=require(_0xa5c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa5c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5c2('0x2'));var rp=require(_0xa5c2('0x3'));var moment=require(_0xa5c2('0x4'));var BPromise=require(_0xa5c2('0x5'));var Mustache=require('mustache');var util=require(_0xa5c2('0x6'));var path=require('path');var sox=require(_0xa5c2('0x7'));var csv=require('to-csv');var ejs=require(_0xa5c2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa5c2('0x9'));var jsforce=require(_0xa5c2('0xa'));var deskjs=require(_0xa5c2('0xb'));var toCsv=require(_0xa5c2('0xc'));var querystring=require(_0xa5c2('0xd'));var Papa=require(_0xa5c2('0xe'));var Redis=require(_0xa5c2('0xf'));var authService=require(_0xa5c2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa5c2('0x11'));var hardwareService=require(_0xa5c2('0x12'));var logger=require(_0xa5c2('0x13'))(_0xa5c2('0x14'));var utils=require(_0xa5c2('0x15'));var config=require(_0xa5c2('0x16'));var db=require(_0xa5c2('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xe4bcad,_0x582c29){_0x582c29=_0x582c29||0xcc;return function(_0x590ab){if(_0x590ab){return _0xe4bcad[_0xa5c2('0x18')](_0x582c29);}return _0xe4bcad['status'](_0x582c29)['end']();};}function respondWithResult(_0xa42bb3,_0x1aeda6){_0x1aeda6=_0x1aeda6||0xc8;return function(_0x32dd61){if(_0x32dd61){return _0xa42bb3['status'](_0x1aeda6)[_0xa5c2('0x19')](_0x32dd61);}};}function respondWithFilteredResult(_0x15580b,_0x4ed2ed){return function(_0x5e000e){if(_0x5e000e){var _0x17af4d=_0x5e000e[_0xa5c2('0x1a')],_0x4fe3b2=_0x4ed2ed['offset'],_0x4d3d83=_0x4ed2ed[_0xa5c2('0x1b')]+_0x4ed2ed['limit'],_0x636cb9;if(_0x4d3d83>=_0x17af4d){_0x4d3d83=_0x17af4d;_0x636cb9=0xc8;}else{_0x636cb9=0xce;}_0x15580b[_0xa5c2('0x1c')](_0x636cb9);return _0x15580b[_0xa5c2('0x1d')](_0xa5c2('0x1e'),_0x4fe3b2+'-'+_0x4d3d83+'/'+_0x17af4d)['json'](_0x5e000e);}return null;};}function patchUpdates(_0xa8c00c){return function(_0x101a93){try{jsonpatch['apply'](_0x101a93,_0xa8c00c,!![]);}catch(_0xe6f102){return BPromise[_0xa5c2('0x1f')](_0xe6f102);}return _0x101a93['save']();};}function saveUpdates(_0x3657f9,_0x2dc802){return function(_0x382173){if(_0x382173){return _0x382173[_0xa5c2('0x20')](_0x3657f9)['then'](function(_0x11c53a){return _0x11c53a;});}return null;};}function removeEntity(_0x31f8e9,_0x175212){return function(_0x4911ac){if(_0x4911ac){return _0x4911ac['destroy']()[_0xa5c2('0x21')](function(){var _0x5e0e14=_0x4911ac[_0xa5c2('0x22')]({'plain':!![]});var _0x48b662=_0xa5c2('0x23');return db[_0xa5c2('0x24')][_0xa5c2('0x25')]({'where':{'type':_0x48b662,'resourceId':_0x5e0e14['id']}})[_0xa5c2('0x21')](function(){return _0x4911ac;});})['then'](function(){_0x31f8e9[_0xa5c2('0x1c')](0xcc)[_0xa5c2('0x26')]();});}};}function handleEntityNotFound(_0x39be4b,_0x306bdb){return function(_0xa67b62){if(!_0xa67b62){_0x39be4b[_0xa5c2('0x18')](0x194);}return _0xa67b62;};}function handleError(_0x4b8783,_0x59a2e1){_0x59a2e1=_0x59a2e1||0x1f4;return function(_0x544ed6){logger[_0xa5c2('0x27')](_0x544ed6[_0xa5c2('0x28')]);if(_0x544ed6[_0xa5c2('0x29')]){delete _0x544ed6[_0xa5c2('0x29')];}_0x4b8783[_0xa5c2('0x1c')](_0x59a2e1)[_0xa5c2('0x2a')](_0x544ed6);};}exports[_0xa5c2('0x2b')]=function(_0x29537e,_0x1cc2ac){var _0x343d1c={},_0x452400={},_0x13978a={'count':0x0,'rows':[]};var _0x2a453a=_[_0xa5c2('0x2c')](db[_0xa5c2('0x2d')][_0xa5c2('0x2e')],function(_0x459290){return{'name':_0x459290[_0xa5c2('0x2f')],'type':_0x459290[_0xa5c2('0x30')][_0xa5c2('0x31')]};});_0x452400[_0xa5c2('0x32')]=_[_0xa5c2('0x2c')](_0x2a453a,_0xa5c2('0x29'));_0x452400[_0xa5c2('0x33')]=_[_0xa5c2('0x34')](_0x29537e[_0xa5c2('0x33')]);_0x452400[_0xa5c2('0x35')]=_[_0xa5c2('0x36')](_0x452400['model'],_0x452400[_0xa5c2('0x33')]);_0x343d1c[_0xa5c2('0x37')]=_[_0xa5c2('0x36')](_0x452400[_0xa5c2('0x32')],qs[_0xa5c2('0x38')](_0x29537e['query'][_0xa5c2('0x38')]));_0x343d1c[_0xa5c2('0x37')]=_0x343d1c[_0xa5c2('0x37')][_0xa5c2('0x39')]?_0x343d1c[_0xa5c2('0x37')]:_0x452400[_0xa5c2('0x32')];if(!_0x29537e[_0xa5c2('0x33')][_0xa5c2('0x3a')](_0xa5c2('0x3b'))){_0x343d1c[_0xa5c2('0x3c')]=qs[_0xa5c2('0x3c')](_0x29537e[_0xa5c2('0x33')]['limit']);_0x343d1c[_0xa5c2('0x1b')]=qs[_0xa5c2('0x1b')](_0x29537e['query'][_0xa5c2('0x1b')]);}_0x343d1c[_0xa5c2('0x3d')]=qs[_0xa5c2('0x3e')](_0x29537e[_0xa5c2('0x33')][_0xa5c2('0x3e')]);_0x343d1c[_0xa5c2('0x3f')]=qs['filters'](_[_0xa5c2('0x40')](_0x29537e[_0xa5c2('0x33')],_0x452400[_0xa5c2('0x35')]),_0x2a453a);if(_0x29537e[_0xa5c2('0x33')][_0xa5c2('0x41')]){_0x343d1c[_0xa5c2('0x3f')]=_[_0xa5c2('0x42')](_0x343d1c[_0xa5c2('0x3f')],{'$or':_[_0xa5c2('0x2c')](_0x2a453a,function(_0x4c20c2){if(_0x4c20c2[_0xa5c2('0x30')]!==_0xa5c2('0x43')){var _0x2a052e={};_0x2a052e[_0x4c20c2[_0xa5c2('0x29')]]={'$like':'%'+_0x29537e[_0xa5c2('0x33')][_0xa5c2('0x41')]+'%'};return _0x2a052e;}})});}_0x343d1c=_['merge']({},_0x343d1c,_0x29537e[_0xa5c2('0x44')]);var _0x11dd4f={'where':_0x343d1c[_0xa5c2('0x3f')]};return db['Interval'][_0xa5c2('0x1a')](_0x11dd4f)[_0xa5c2('0x21')](function(_0x49b649){_0x13978a[_0xa5c2('0x1a')]=_0x49b649;if(_0x29537e['query'][_0xa5c2('0x45')]){_0x343d1c[_0xa5c2('0x46')]=[{'all':!![]}];}return db[_0xa5c2('0x2d')][_0xa5c2('0x47')](_0x343d1c);})[_0xa5c2('0x21')](function(_0x3663e4){_0x13978a['rows']=_0x3663e4;return _0x13978a;})[_0xa5c2('0x21')](respondWithFilteredResult(_0x1cc2ac,_0x343d1c))['catch'](handleError(_0x1cc2ac,null));};exports[_0xa5c2('0x48')]=function(_0x5ac913,_0x3bbf4d){var _0x2aec7f={'raw':!![],'where':{'id':_0x5ac913[_0xa5c2('0x49')]['id']}},_0x2160e2={};_0x2160e2['model']=_[_0xa5c2('0x34')](db[_0xa5c2('0x2d')][_0xa5c2('0x2e')]);_0x2160e2[_0xa5c2('0x33')]=_[_0xa5c2('0x34')](_0x5ac913[_0xa5c2('0x33')]);_0x2160e2[_0xa5c2('0x35')]=_[_0xa5c2('0x36')](_0x2160e2['model'],_0x2160e2[_0xa5c2('0x33')]);_0x2aec7f[_0xa5c2('0x37')]=_['intersection'](_0x2160e2['model'],qs[_0xa5c2('0x38')](_0x5ac913[_0xa5c2('0x33')][_0xa5c2('0x38')]));_0x2aec7f[_0xa5c2('0x37')]=_0x2aec7f[_0xa5c2('0x37')]['length']?_0x2aec7f[_0xa5c2('0x37')]:_0x2160e2['model'];if(_0x5ac913['query'][_0xa5c2('0x45')]){_0x2aec7f[_0xa5c2('0x46')]=[{'all':!![]}];}_0x2aec7f=_['merge']({},_0x2aec7f,_0x5ac913[_0xa5c2('0x44')]);return db[_0xa5c2('0x2d')][_0xa5c2('0x4a')](_0x2aec7f)['then'](handleEntityNotFound(_0x3bbf4d,null))[_0xa5c2('0x21')](respondWithResult(_0x3bbf4d,null))[_0xa5c2('0x4b')](handleError(_0x3bbf4d,null));};exports['create']=function(_0x211108,_0x18fa81){return db[_0xa5c2('0x2d')][_0xa5c2('0x4c')](_0x211108[_0xa5c2('0x4d')],{})['then'](function(_0x24331c){var _0x46eb06=_0x211108['user']['get']({'plain':!![]});if(!_0x46eb06)throw new Error(_0xa5c2('0x4e'));if(_0x46eb06[_0xa5c2('0x4f')]===_0xa5c2('0x50')){var _0x472296=_0x24331c['get']({'plain':!![]});var _0x21674e=_0xa5c2('0x23');return db[_0xa5c2('0x51')][_0xa5c2('0x4a')]({'where':{'name':_0x21674e,'userProfileId':_0x46eb06[_0xa5c2('0x52')]},'raw':!![]})[_0xa5c2('0x21')](function(_0x406702){if(_0x406702&&_0x406702[_0xa5c2('0x53')]===0x0){return db[_0xa5c2('0x24')][_0xa5c2('0x4c')]({'name':_0x472296[_0xa5c2('0x29')],'resourceId':_0x472296['id'],'type':_0x406702[_0xa5c2('0x29')],'sectionId':_0x406702['id']},{})[_0xa5c2('0x21')](function(){return _0x24331c;});}else{return _0x24331c;}})[_0xa5c2('0x4b')](function(_0x3314c6){logger[_0xa5c2('0x27')](_0xa5c2('0x54'),_0x3314c6);throw _0x3314c6;});}return _0x24331c;})[_0xa5c2('0x21')](respondWithResult(_0x18fa81,0xc9))[_0xa5c2('0x4b')](handleError(_0x18fa81,null));};exports[_0xa5c2('0x20')]=function(_0x399094,_0x549b50){if(_0x399094[_0xa5c2('0x4d')]['id']){delete _0x399094[_0xa5c2('0x4d')]['id'];}return db[_0xa5c2('0x2d')][_0xa5c2('0x4a')]({'where':{'id':_0x399094[_0xa5c2('0x49')]['id']}})['then'](handleEntityNotFound(_0x549b50,null))[_0xa5c2('0x21')](saveUpdates(_0x399094['body'],null))['then'](respondWithResult(_0x549b50,null))[_0xa5c2('0x4b')](handleError(_0x549b50,null));};exports[_0xa5c2('0x25')]=function(_0x5da690,_0x468407){return db[_0xa5c2('0x2d')]['find']({'where':{'id':_0x5da690['params']['id']}})[_0xa5c2('0x21')](handleEntityNotFound(_0x468407,null))[_0xa5c2('0x21')](removeEntity(_0x468407,null))[_0xa5c2('0x4b')](handleError(_0x468407,null));};exports[_0xa5c2('0x55')]=function(_0x272b33,_0x9c4bc4,_0x32d40c){if(_0x272b33['body']['id']){delete _0x272b33[_0xa5c2('0x4d')]['id'];}return db[_0xa5c2('0x2d')][_0xa5c2('0x4a')]({'where':{'id':_0x272b33[_0xa5c2('0x49')]['id']}})[_0xa5c2('0x21')](handleEntityNotFound(_0x9c4bc4,null))[_0xa5c2('0x21')](function(_0x1840a1){if(_0x1840a1){_0x272b33[_0xa5c2('0x4d')][_0xa5c2('0x56')]=_0x1840a1['id'];return db[_0xa5c2('0x2d')][_0xa5c2('0x4c')](_0x272b33[_0xa5c2('0x4d')]);}})[_0xa5c2('0x21')](respondWithResult(_0x9c4bc4,null))[_0xa5c2('0x4b')](handleError(_0x9c4bc4,null));};exports[_0xa5c2('0x57')]=function(_0x546951,_0x546b19,_0x5b897e){var _0xc98349={};var _0x2eac67={};var _0x43541c;var _0x1b9ae1;return db[_0xa5c2('0x2d')][_0xa5c2('0x58')]({'where':{'id':_0x546951[_0xa5c2('0x49')]['id']}})[_0xa5c2('0x21')](handleEntityNotFound(_0x546b19,null))['then'](function(_0x5ba684){if(_0x5ba684){_0x43541c=_0x5ba684;_0x2eac67[_0xa5c2('0x32')]=_[_0xa5c2('0x34')](db[_0xa5c2('0x2d')]['rawAttributes']);_0x2eac67[_0xa5c2('0x33')]=_[_0xa5c2('0x34')](_0x546951[_0xa5c2('0x33')]);_0x2eac67[_0xa5c2('0x35')]=_['intersection'](_0x2eac67[_0xa5c2('0x32')],_0x2eac67[_0xa5c2('0x33')]);_0xc98349[_0xa5c2('0x37')]=_[_0xa5c2('0x36')](_0x2eac67[_0xa5c2('0x32')],qs['fields'](_0x546951[_0xa5c2('0x33')][_0xa5c2('0x38')]));_0xc98349[_0xa5c2('0x37')]=_0xc98349[_0xa5c2('0x37')][_0xa5c2('0x39')]?_0xc98349[_0xa5c2('0x37')]:_0x2eac67[_0xa5c2('0x32')];_0xc98349[_0xa5c2('0x3d')]=qs[_0xa5c2('0x3e')](_0x546951['query']['sort']);_0xc98349['where']=qs['filters'](_['pick'](_0x546951['query'],_0x2eac67[_0xa5c2('0x35')]));if(_0x546951[_0xa5c2('0x33')][_0xa5c2('0x41')]){_0xc98349[_0xa5c2('0x3f')]=_[_0xa5c2('0x42')](_0xc98349['where'],{'$or':_[_0xa5c2('0x2c')](_0xc98349[_0xa5c2('0x37')],function(_0x434a56){var _0x2eb126={};_0x2eb126[_0x434a56]={'$like':'%'+_0x546951['query'][_0xa5c2('0x41')]+'%'};return _0x2eb126;})});}_0xc98349=_['merge']({},_0xc98349,_0x546951[_0xa5c2('0x44')]);return _0x43541c[_0xa5c2('0x57')](_0xc98349);}})[_0xa5c2('0x21')](function(_0x8168c){if(_0x8168c){_0x1b9ae1=_0x8168c[_0xa5c2('0x39')];if(!_0x546951['query'][_0xa5c2('0x3a')]('nolimit')){_0xc98349[_0xa5c2('0x3c')]=qs[_0xa5c2('0x3c')](_0x546951['query'][_0xa5c2('0x3c')]);_0xc98349[_0xa5c2('0x1b')]=qs[_0xa5c2('0x1b')](_0x546951[_0xa5c2('0x33')][_0xa5c2('0x1b')]);}return _0x43541c['getIntervals'](_0xc98349);}})[_0xa5c2('0x21')](function(_0x4bb62e){if(_0x4bb62e){return _0x4bb62e?{'count':_0x1b9ae1,'rows':_0x4bb62e}:null;}})['then'](respondWithResult(_0x546b19,null))['catch'](handleError(_0x546b19,null));};exports[_0xa5c2('0x59')]=function(_0x24a40e,_0x2ebc15,_0x2a6c73){return db[_0xa5c2('0x2d')][_0xa5c2('0x58')]({'where':{'id':_0x24a40e[_0xa5c2('0x49')]['id']}})[_0xa5c2('0x21')](handleEntityNotFound(_0x2ebc15,null))['then'](function(_0x4f2c1c){if(_0x4f2c1c){return db['sequelize'][_0xa5c2('0x5a')](function(_0x43b5d7){return db[_0xa5c2('0x2d')][_0xa5c2('0x25')]({'where':{'IntervalId':_0x24a40e[_0xa5c2('0x49')]['id']},'transaction':_0x43b5d7})['then'](function(_0xe2e1d6){var _0x20f522=_[_0xa5c2('0x2c')](_0x24a40e[_0xa5c2('0x4d')],function(_0x1a482a){delete _0x1a482a['id'];_0x1a482a[_0xa5c2('0x56')]=_0x24a40e[_0xa5c2('0x49')]['id'];return _0x1a482a;});return db[_0xa5c2('0x2d')][_0xa5c2('0x5b')](_0x20f522,{'transaction':_0x43b5d7});});})[_0xa5c2('0x21')](function(){return db[_0xa5c2('0x2d')]['findAll']({'where':{'IntervalId':_0x24a40e[_0xa5c2('0x49')]['id']}});});}})[_0xa5c2('0x21')](respondWithResult(_0x2ebc15,null))[_0xa5c2('0x4b')](handleError(_0x2ebc15,null));}; \ No newline at end of file +var _0xb816=['UserProfileResource','error','stack','name','send','Interval','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','map','merge','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','transaction','bulkCreate','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','then','destroy','get'];(function(_0x46c8b5,_0x3036f3){var _0x21eb4d=function(_0x1788ad){while(--_0x1788ad){_0x46c8b5['push'](_0x46c8b5['shift']());}};_0x21eb4d(++_0x3036f3);}(_0xb816,0x89));var _0x6b81=function(_0x17ea95,_0x4a8803){_0x17ea95=_0x17ea95-0x0;var _0x4ecadf=_0xb816[_0x17ea95];return _0x4ecadf;};'use strict';var pdf=require(_0x6b81('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b81('0x1'));var zipdir=require(_0x6b81('0x2'));var jsonpatch=require(_0x6b81('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b81('0x4'));var Mustache=require(_0x6b81('0x5'));var util=require(_0x6b81('0x6'));var path=require(_0x6b81('0x7'));var sox=require(_0x6b81('0x8'));var csv=require(_0x6b81('0x9'));var ejs=require(_0x6b81('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6b81('0xb'));var crypto=require(_0x6b81('0xc'));var jsforce=require(_0x6b81('0xd'));var deskjs=require(_0x6b81('0xe'));var toCsv=require(_0x6b81('0x9'));var querystring=require(_0x6b81('0xf'));var Papa=require(_0x6b81('0x10'));var Redis=require(_0x6b81('0x11'));var authService=require(_0x6b81('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6b81('0x13'));var hardwareService=require(_0x6b81('0x14'));var logger=require(_0x6b81('0x15'))('api');var utils=require(_0x6b81('0x16'));var config=require(_0x6b81('0x17'));var db=require(_0x6b81('0x18'))['db'];var extensions=require(_0x6b81('0x19'));function respondWithStatusCode(_0xfd7f18,_0x4ffe0d){_0x4ffe0d=_0x4ffe0d||0xcc;return function(_0x326924){if(_0x326924){return _0xfd7f18[_0x6b81('0x1a')](_0x4ffe0d);}return _0xfd7f18[_0x6b81('0x1b')](_0x4ffe0d)[_0x6b81('0x1c')]();};}function respondWithResult(_0xe7ab90,_0x163eec){_0x163eec=_0x163eec||0xc8;return function(_0xa5e6dd){if(_0xa5e6dd){return _0xe7ab90[_0x6b81('0x1b')](_0x163eec)['json'](_0xa5e6dd);}};}function respondWithFilteredResult(_0x5ceb27,_0x23f6cb){return function(_0x4ff563){if(_0x4ff563){var _0x18151a=_0x4ff563[_0x6b81('0x1d')],_0x2a35a4=_0x23f6cb[_0x6b81('0x1e')],_0x5a8546=_0x23f6cb[_0x6b81('0x1e')]+_0x23f6cb['limit'],_0x56d12b;if(_0x5a8546>=_0x18151a){_0x5a8546=_0x18151a;_0x56d12b=0xc8;}else{_0x56d12b=0xce;}_0x5ceb27[_0x6b81('0x1b')](_0x56d12b);return _0x5ceb27[_0x6b81('0x1f')](_0x6b81('0x20'),_0x2a35a4+'-'+_0x5a8546+'/'+_0x18151a)[_0x6b81('0x21')](_0x4ff563);}return null;};}function patchUpdates(_0x4152be){return function(_0x551a34){try{jsonpatch['apply'](_0x551a34,_0x4152be,!![]);}catch(_0x430abf){return BPromise[_0x6b81('0x22')](_0x430abf);}return _0x551a34[_0x6b81('0x23')]();};}function saveUpdates(_0x3cb69d,_0x423b0c){return function(_0x36a4b7){if(_0x36a4b7){return _0x36a4b7['update'](_0x3cb69d)[_0x6b81('0x24')](function(_0x28c384){return _0x28c384;});}return null;};}function removeEntity(_0x2700d4,_0xde4401){return function(_0x5b94ad){if(_0x5b94ad){return _0x5b94ad[_0x6b81('0x25')]()[_0x6b81('0x24')](function(){var _0x4ec775=_0x5b94ad[_0x6b81('0x26')]({'plain':!![]});var _0x51b955='Intervals';return db[_0x6b81('0x27')][_0x6b81('0x25')]({'where':{'type':_0x51b955,'resourceId':_0x4ec775['id']}})[_0x6b81('0x24')](function(){return _0x5b94ad;});})['then'](function(){_0x2700d4[_0x6b81('0x1b')](0xcc)[_0x6b81('0x1c')]();});}};}function handleEntityNotFound(_0xadfec2,_0x1c4515){return function(_0x540982){if(!_0x540982){_0xadfec2[_0x6b81('0x1a')](0x194);}return _0x540982;};}function handleError(_0x29aaa7,_0x4c3d6d){_0x4c3d6d=_0x4c3d6d||0x1f4;return function(_0x1b4ba7){logger[_0x6b81('0x28')](_0x1b4ba7[_0x6b81('0x29')]);if(_0x1b4ba7[_0x6b81('0x2a')]){delete _0x1b4ba7[_0x6b81('0x2a')];}_0x29aaa7[_0x6b81('0x1b')](_0x4c3d6d)[_0x6b81('0x2b')](_0x1b4ba7);};}exports['index']=function(_0x123bbc,_0x31d871){var _0x241add={},_0x42f8a8={},_0x20b525={'count':0x0,'rows':[]};var _0x1c7e99=_['map'](db[_0x6b81('0x2c')][_0x6b81('0x2d')],function(_0x58810){return{'name':_0x58810['fieldName'],'type':_0x58810[_0x6b81('0x2e')][_0x6b81('0x2f')]};});_0x42f8a8[_0x6b81('0x30')]=_['map'](_0x1c7e99,_0x6b81('0x2a'));_0x42f8a8[_0x6b81('0x31')]=_['keys'](_0x123bbc['query']);_0x42f8a8[_0x6b81('0x32')]=_[_0x6b81('0x33')](_0x42f8a8['model'],_0x42f8a8[_0x6b81('0x31')]);_0x241add['attributes']=_[_0x6b81('0x33')](_0x42f8a8[_0x6b81('0x30')],qs[_0x6b81('0x34')](_0x123bbc[_0x6b81('0x31')][_0x6b81('0x34')]));_0x241add[_0x6b81('0x35')]=_0x241add[_0x6b81('0x35')][_0x6b81('0x36')]?_0x241add[_0x6b81('0x35')]:_0x42f8a8[_0x6b81('0x30')];if(!_0x123bbc[_0x6b81('0x31')][_0x6b81('0x37')](_0x6b81('0x38'))){_0x241add[_0x6b81('0x39')]=qs[_0x6b81('0x39')](_0x123bbc['query'][_0x6b81('0x39')]);_0x241add['offset']=qs[_0x6b81('0x1e')](_0x123bbc[_0x6b81('0x31')][_0x6b81('0x1e')]);}_0x241add['order']=qs[_0x6b81('0x3a')](_0x123bbc['query'][_0x6b81('0x3a')]);_0x241add[_0x6b81('0x3b')]=qs[_0x6b81('0x32')](_['pick'](_0x123bbc['query'],_0x42f8a8['filters']),_0x1c7e99);if(_0x123bbc[_0x6b81('0x31')][_0x6b81('0x3c')]){_0x241add['where']=_['merge'](_0x241add[_0x6b81('0x3b')],{'$or':_[_0x6b81('0x3d')](_0x1c7e99,function(_0x5279f3){if(_0x5279f3['type']!=='VIRTUAL'){var _0x8c7467={};_0x8c7467[_0x5279f3[_0x6b81('0x2a')]]={'$like':'%'+_0x123bbc[_0x6b81('0x31')][_0x6b81('0x3c')]+'%'};return _0x8c7467;}})});}_0x241add=_[_0x6b81('0x3e')]({},_0x241add,_0x123bbc['options']);var _0x5b96b4={'where':_0x241add[_0x6b81('0x3b')]};return db['Interval'][_0x6b81('0x1d')](_0x5b96b4)[_0x6b81('0x24')](function(_0x5ab245){_0x20b525[_0x6b81('0x1d')]=_0x5ab245;if(_0x123bbc[_0x6b81('0x31')]['includeAll']){_0x241add[_0x6b81('0x3f')]=[{'all':!![]}];}return db[_0x6b81('0x2c')][_0x6b81('0x40')](_0x241add);})[_0x6b81('0x24')](function(_0x214cc5){_0x20b525[_0x6b81('0x41')]=_0x214cc5;return _0x20b525;})[_0x6b81('0x24')](respondWithFilteredResult(_0x31d871,_0x241add))[_0x6b81('0x42')](handleError(_0x31d871,null));};exports['show']=function(_0x42f49d,_0xfb6ca1){var _0x1c4be3={'raw':!![],'where':{'id':_0x42f49d[_0x6b81('0x43')]['id']}},_0x1dee4a={};_0x1dee4a[_0x6b81('0x30')]=_[_0x6b81('0x44')](db['Interval'][_0x6b81('0x2d')]);_0x1dee4a[_0x6b81('0x31')]=_[_0x6b81('0x44')](_0x42f49d[_0x6b81('0x31')]);_0x1dee4a['filters']=_[_0x6b81('0x33')](_0x1dee4a['model'],_0x1dee4a[_0x6b81('0x31')]);_0x1c4be3[_0x6b81('0x35')]=_[_0x6b81('0x33')](_0x1dee4a[_0x6b81('0x30')],qs[_0x6b81('0x34')](_0x42f49d[_0x6b81('0x31')]['fields']));_0x1c4be3[_0x6b81('0x35')]=_0x1c4be3[_0x6b81('0x35')]['length']?_0x1c4be3['attributes']:_0x1dee4a[_0x6b81('0x30')];if(_0x42f49d[_0x6b81('0x31')][_0x6b81('0x45')]){_0x1c4be3[_0x6b81('0x3f')]=[{'all':!![]}];}_0x1c4be3=_[_0x6b81('0x3e')]({},_0x1c4be3,_0x42f49d[_0x6b81('0x46')]);return db[_0x6b81('0x2c')][_0x6b81('0x47')](_0x1c4be3)[_0x6b81('0x24')](handleEntityNotFound(_0xfb6ca1,null))['then'](respondWithResult(_0xfb6ca1,null))[_0x6b81('0x42')](handleError(_0xfb6ca1,null));};exports[_0x6b81('0x48')]=function(_0x295846,_0x4622e4){return db['Interval'][_0x6b81('0x48')](_0x295846[_0x6b81('0x49')],{})[_0x6b81('0x24')](function(_0x596eed){var _0xaa2df8=_0x295846[_0x6b81('0x4a')]['get']({'plain':!![]});if(!_0xaa2df8)throw new Error(_0x6b81('0x4b'));if(_0xaa2df8[_0x6b81('0x4c')]===_0x6b81('0x4a')){var _0x508a9c=_0x596eed[_0x6b81('0x26')]({'plain':!![]});var _0x3e3907=_0x6b81('0x4d');return db[_0x6b81('0x4e')][_0x6b81('0x47')]({'where':{'name':_0x3e3907,'userProfileId':_0xaa2df8['userProfileId']},'raw':!![]})['then'](function(_0xa19caf){if(_0xa19caf&&_0xa19caf[_0x6b81('0x4f')]===0x0){return db[_0x6b81('0x27')][_0x6b81('0x48')]({'name':_0x508a9c['name'],'resourceId':_0x508a9c['id'],'type':_0xa19caf[_0x6b81('0x2a')],'sectionId':_0xa19caf['id']},{})['then'](function(){return _0x596eed;});}else{return _0x596eed;}})[_0x6b81('0x42')](function(_0x15b37b){logger['error'](_0x6b81('0x50'),_0x15b37b);throw _0x15b37b;});}return _0x596eed;})[_0x6b81('0x24')](respondWithResult(_0x4622e4,0xc9))[_0x6b81('0x42')](handleError(_0x4622e4,null));};exports[_0x6b81('0x51')]=function(_0x1fbe80,_0x24152e){if(_0x1fbe80['body']['id']){delete _0x1fbe80[_0x6b81('0x49')]['id'];}return db[_0x6b81('0x2c')][_0x6b81('0x47')]({'where':{'id':_0x1fbe80[_0x6b81('0x43')]['id']}})[_0x6b81('0x24')](handleEntityNotFound(_0x24152e,null))[_0x6b81('0x24')](saveUpdates(_0x1fbe80['body'],null))[_0x6b81('0x24')](respondWithResult(_0x24152e,null))[_0x6b81('0x42')](handleError(_0x24152e,null));};exports[_0x6b81('0x25')]=function(_0x18f42f,_0x5f5851){return db[_0x6b81('0x2c')][_0x6b81('0x47')]({'where':{'id':_0x18f42f['params']['id']}})[_0x6b81('0x24')](handleEntityNotFound(_0x5f5851,null))[_0x6b81('0x24')](removeEntity(_0x5f5851,null))['catch'](handleError(_0x5f5851,null));};exports[_0x6b81('0x52')]=function(_0x1de564,_0x29c272,_0x147f97){if(_0x1de564[_0x6b81('0x49')]['id']){delete _0x1de564[_0x6b81('0x49')]['id'];}return db[_0x6b81('0x2c')][_0x6b81('0x47')]({'where':{'id':_0x1de564[_0x6b81('0x43')]['id']}})['then'](handleEntityNotFound(_0x29c272,null))[_0x6b81('0x24')](function(_0xc0cd5){if(_0xc0cd5){_0x1de564[_0x6b81('0x49')][_0x6b81('0x53')]=_0xc0cd5['id'];return db[_0x6b81('0x2c')][_0x6b81('0x48')](_0x1de564[_0x6b81('0x49')]);}})[_0x6b81('0x24')](respondWithResult(_0x29c272,null))['catch'](handleError(_0x29c272,null));};exports[_0x6b81('0x54')]=function(_0x17f881,_0x554bc6,_0x4d3c04){var _0x31d5d7={};var _0x9b82f={};var _0x87dddb;var _0x2b794f;return db[_0x6b81('0x2c')][_0x6b81('0x55')]({'where':{'id':_0x17f881['params']['id']}})[_0x6b81('0x24')](handleEntityNotFound(_0x554bc6,null))[_0x6b81('0x24')](function(_0x40a1c8){if(_0x40a1c8){_0x87dddb=_0x40a1c8;_0x9b82f[_0x6b81('0x30')]=_['keys'](db[_0x6b81('0x2c')][_0x6b81('0x2d')]);_0x9b82f[_0x6b81('0x31')]=_[_0x6b81('0x44')](_0x17f881[_0x6b81('0x31')]);_0x9b82f['filters']=_[_0x6b81('0x33')](_0x9b82f[_0x6b81('0x30')],_0x9b82f[_0x6b81('0x31')]);_0x31d5d7[_0x6b81('0x35')]=_[_0x6b81('0x33')](_0x9b82f[_0x6b81('0x30')],qs['fields'](_0x17f881[_0x6b81('0x31')][_0x6b81('0x34')]));_0x31d5d7[_0x6b81('0x35')]=_0x31d5d7[_0x6b81('0x35')][_0x6b81('0x36')]?_0x31d5d7[_0x6b81('0x35')]:_0x9b82f[_0x6b81('0x30')];_0x31d5d7['order']=qs[_0x6b81('0x3a')](_0x17f881['query']['sort']);_0x31d5d7['where']=qs[_0x6b81('0x32')](_['pick'](_0x17f881[_0x6b81('0x31')],_0x9b82f[_0x6b81('0x32')]));if(_0x17f881['query'][_0x6b81('0x3c')]){_0x31d5d7[_0x6b81('0x3b')]=_[_0x6b81('0x3e')](_0x31d5d7[_0x6b81('0x3b')],{'$or':_['map'](_0x31d5d7[_0x6b81('0x35')],function(_0x2ec7d3){var _0x101fd9={};_0x101fd9[_0x2ec7d3]={'$like':'%'+_0x17f881[_0x6b81('0x31')][_0x6b81('0x3c')]+'%'};return _0x101fd9;})});}_0x31d5d7=_['merge']({},_0x31d5d7,_0x17f881[_0x6b81('0x46')]);return _0x87dddb[_0x6b81('0x54')](_0x31d5d7);}})[_0x6b81('0x24')](function(_0x43930b){if(_0x43930b){_0x2b794f=_0x43930b[_0x6b81('0x36')];if(!_0x17f881[_0x6b81('0x31')]['hasOwnProperty'](_0x6b81('0x38'))){_0x31d5d7['limit']=qs['limit'](_0x17f881[_0x6b81('0x31')]['limit']);_0x31d5d7[_0x6b81('0x1e')]=qs[_0x6b81('0x1e')](_0x17f881[_0x6b81('0x31')][_0x6b81('0x1e')]);}return _0x87dddb['getIntervals'](_0x31d5d7);}})[_0x6b81('0x24')](function(_0x1c33e4){if(_0x1c33e4){return _0x1c33e4?{'count':_0x2b794f,'rows':_0x1c33e4}:null;}})[_0x6b81('0x24')](respondWithResult(_0x554bc6,null))['catch'](handleError(_0x554bc6,null));};exports['addIntervals']=function(_0x499829,_0x5a3aea,_0x268287){return db[_0x6b81('0x2c')]['findOne']({'where':{'id':_0x499829[_0x6b81('0x43')]['id']}})[_0x6b81('0x24')](handleEntityNotFound(_0x5a3aea,null))['then'](function(_0x57372c){if(_0x57372c){return db['sequelize'][_0x6b81('0x56')](function(_0x55f28a){return db[_0x6b81('0x2c')]['destroy']({'where':{'IntervalId':_0x499829[_0x6b81('0x43')]['id']},'transaction':_0x55f28a})[_0x6b81('0x24')](function(_0x309118){var _0x1028f3=_['map'](_0x499829['body'],function(_0x370913){delete _0x370913['id'];_0x370913[_0x6b81('0x53')]=_0x499829[_0x6b81('0x43')]['id'];return _0x370913;});return db[_0x6b81('0x2c')][_0x6b81('0x57')](_0x1028f3,{'transaction':_0x55f28a});});})[_0x6b81('0x24')](function(){return db[_0x6b81('0x2c')][_0x6b81('0x40')]({'where':{'IntervalId':_0x499829[_0x6b81('0x43')]['id']}});});}})[_0x6b81('0x24')](respondWithResult(_0x5a3aea,null))[_0x6b81('0x42')](handleError(_0x5a3aea,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0ef2a8f..0097cb3 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 _0x5e14=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash'];(function(_0x4152c3,_0x25e2cf){var _0x474adf=function(_0x35d430){while(--_0x35d430){_0x4152c3['push'](_0x4152c3['shift']());}};_0x474adf(++_0x25e2cf);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var logger=require(_0x45e1('0x2'))(_0x45e1('0x3'));var moment=require(_0x45e1('0x4'));var BPromise=require(_0x45e1('0x5'));var rp=require(_0x45e1('0x6'));var fs=require('fs');var path=require(_0x45e1('0x7'));var rimraf=require(_0x45e1('0x8'));var config=require(_0x45e1('0x9'));var attributes=require(_0x45e1('0xa'));var extensions=require(_0x45e1('0xb'));module[_0x45e1('0xc')]=function(_0x41b13c,_0x26ee2e){return _0x41b13c[_0x45e1('0xd')](_0x45e1('0xe'),attributes,{'tableName':_0x45e1('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2296b3,_0x128854){extensions[_0x45e1('0x10')](_0x41b13c,_0x2296b3);},'afterBulkCreate':function(_0x1c57cf,_0x542615,_0x3ffc81){_0x3ffc81();extensions[_0x45e1('0x10')](_0x41b13c,_0x1c57cf[0x0]);},'afterUpdate':function(_0x3f45ac,_0x514726){extensions[_0x45e1('0x10')](_0x41b13c,_0x3f45ac);},'afterDestroy':function(_0x5b6062,_0x39e656){extensions[_0x45e1('0x10')](_0x41b13c,_0x5b6062);}}});}; \ No newline at end of file +var _0xbdeb=['rewrite','util','api','bluebird','request-promise','path','rimraf','../../components/extensions/rewrite','exports','tools_intervals'];(function(_0x3eef50,_0x2e745f){var _0x213722=function(_0x17b013){while(--_0x17b013){_0x3eef50['push'](_0x3eef50['shift']());}};_0x213722(++_0x2e745f);}(_0xbdeb,0x6f));var _0xbbde=function(_0x5aa2f1,_0x39e791){_0x5aa2f1=_0x5aa2f1-0x0;var _0x2ef6f8=_0xbdeb[_0x5aa2f1];return _0x2ef6f8;};'use strict';var _=require('lodash');var util=require(_0xbbde('0x0'));var logger=require('../../config/logger')(_0xbbde('0x1'));var moment=require('moment');var BPromise=require(_0xbbde('0x2'));var rp=require(_0xbbde('0x3'));var fs=require('fs');var path=require(_0xbbde('0x4'));var rimraf=require(_0xbbde('0x5'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0xbbde('0x6'));module[_0xbbde('0x7')]=function(_0x278651,_0x1a8482){return _0x278651['define']('Interval',attributes,{'tableName':_0xbbde('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17df59,_0x51706d){extensions[_0xbbde('0x9')](_0x278651,_0x17df59);},'afterBulkCreate':function(_0xec50fa,_0x3164f7,_0x323dc2){_0x323dc2();extensions[_0xbbde('0x9')](_0x278651,_0xec50fa[0x0]);},'afterUpdate':function(_0xd08f3f,_0x162966){extensions[_0xbbde('0x9')](_0x278651,_0xd08f3f);},'afterDestroy':function(_0x419fbe,_0x357c69){extensions['rewrite'](_0x278651,_0x419fbe);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e272861..2a12e74 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 _0xd04a=['model','then','GetInterval','stringify','ShowInterval','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','info','request\x20sent','debug','error','code','message','Interval,\x20%s,\x20%s','result','catch','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x5dfb66,_0x4fcc1e){var _0x459cad=function(_0x32d010){while(--_0x32d010){_0x5dfb66['push'](_0x5dfb66['shift']());}};_0x459cad(++_0x4fcc1e);}(_0xd04a,0xab));var _0xad04=function(_0x5b7f7a,_0x13c252){_0x5b7f7a=_0x5b7f7a-0x0;var _0x5bdc45=_0xd04a[_0x5b7f7a];return _0x5bdc45;};'use strict';var _=require(_0xad04('0x0'));var util=require(_0xad04('0x1'));var moment=require(_0xad04('0x2'));var BPromise=require('bluebird');var rs=require(_0xad04('0x3'));var fs=require('fs');var Redis=require(_0xad04('0x4'));var db=require(_0xad04('0x5'))['db'];var utils=require(_0xad04('0x6'));var logger=require('../../config/logger')(_0xad04('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad04('0x8')][_0xad04('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28fc46,_0x9ce218,_0x321021){return new BPromise(function(_0x55c896,_0x461692){return client['request'](_0x28fc46,_0x321021)['then'](function(_0xcfcc5e){logger[_0xad04('0xa')]('Interval,\x20%s,\x20%s',_0x9ce218,_0xad04('0xb'));logger[_0xad04('0xc')]('Interval,\x20%s,\x20%s,\x20%s',_0x9ce218,_0xad04('0xb'),JSON['stringify'](_0xcfcc5e));if(_0xcfcc5e[_0xad04('0xd')]){if(_0xcfcc5e[_0xad04('0xd')][_0xad04('0xe')]===0x1f4){logger[_0xad04('0xd')]('Interval,\x20%s,\x20%s',_0x9ce218,_0xcfcc5e['error'][_0xad04('0xf')]);return _0x461692(_0xcfcc5e[_0xad04('0xd')][_0xad04('0xf')]);}logger[_0xad04('0xd')](_0xad04('0x10'),_0x9ce218,_0xcfcc5e[_0xad04('0xd')][_0xad04('0xf')]);return _0x55c896(_0xcfcc5e['error'][_0xad04('0xf')]);}else{logger[_0xad04('0xa')](_0xad04('0x10'),_0x9ce218,_0xad04('0xb'));_0x55c896(_0xcfcc5e[_0xad04('0x11')][_0xad04('0xf')]);}})[_0xad04('0x12')](function(_0x37fa18){logger[_0xad04('0xd')](_0xad04('0x10'),_0x9ce218,_0x37fa18);_0x461692(_0x37fa18);});});}exports['GetInterval']=function(_0x2ee075){var _0x33e93b=this;return new Promise(function(_0x44601b,_0x5ca79e){return db['Interval'][_0xad04('0x13')]({'raw':_0x2ee075[_0xad04('0x14')]?_0x2ee075[_0xad04('0x14')][_0xad04('0x15')]===undefined?!![]:![]:!![],'where':_0x2ee075[_0xad04('0x14')]?_0x2ee075['options'][_0xad04('0x16')]||null:null,'attributes':_0x2ee075[_0xad04('0x14')]?_0x2ee075[_0xad04('0x14')][_0xad04('0x17')]||null:null,'limit':_0x2ee075['options']?_0x2ee075['options'][_0xad04('0x18')]||null:null,'include':_0x2ee075[_0xad04('0x14')]?_0x2ee075[_0xad04('0x14')][_0xad04('0x19')]?_[_0xad04('0x1a')](_0x2ee075['options']['include'],function(_0x4315f2){return{'model':db[_0x4315f2['model']],'as':_0x4315f2['as'],'attributes':_0x4315f2[_0xad04('0x17')],'include':_0x4315f2[_0xad04('0x19')]?_['map'](_0x4315f2[_0xad04('0x19')],function(_0x322c8d){return{'model':db[_0x322c8d[_0xad04('0x1b')]],'as':_0x322c8d['as'],'attributes':_0x322c8d[_0xad04('0x17')],'include':_0x322c8d[_0xad04('0x19')]?_[_0xad04('0x1a')](_0x322c8d[_0xad04('0x19')],function(_0x951f8a){return{'model':db[_0x951f8a[_0xad04('0x1b')]],'as':_0x951f8a['as'],'attributes':_0x951f8a[_0xad04('0x17')]};}):[]};}):[]};}):[]:[]})[_0xad04('0x1c')](function(_0x119a7f){logger[_0xad04('0xa')](_0xad04('0x1d'),_0x2ee075);logger[_0xad04('0xc')]('GetInterval',_0x2ee075,JSON[_0xad04('0x1e')](_0x119a7f));_0x44601b(_0x119a7f);})[_0xad04('0x12')](function(_0x97a4f5){logger['error'](_0xad04('0x1d'),_0x97a4f5[_0xad04('0xf')],_0x2ee075);_0x5ca79e(_0x33e93b[_0xad04('0xd')](0x1f4,_0x97a4f5[_0xad04('0xf')]));});});};exports[_0xad04('0x1f')]=function(_0x22bcf1){var _0x1c0110=this;return new Promise(function(_0x5a763d,_0x34921e){return db['Interval'][_0xad04('0x20')]({'raw':_0x22bcf1[_0xad04('0x14')]?_0x22bcf1['options'][_0xad04('0x15')]===undefined?!![]:![]:!![],'where':_0x22bcf1[_0xad04('0x14')]?_0x22bcf1['options'][_0xad04('0x16')]||null:null,'attributes':_0x22bcf1[_0xad04('0x14')]?_0x22bcf1['options']['attributes']||null:null,'include':_0x22bcf1[_0xad04('0x14')]?_0x22bcf1['options'][_0xad04('0x19')]?_[_0xad04('0x1a')](_0x22bcf1['options'][_0xad04('0x19')],function(_0x16431e){return{'model':db[_0x16431e[_0xad04('0x1b')]],'as':_0x16431e['as'],'attributes':_0x16431e['attributes'],'include':_0x16431e['include']?_[_0xad04('0x1a')](_0x16431e['include'],function(_0x313bac){return{'model':db[_0x313bac[_0xad04('0x1b')]],'as':_0x313bac['as'],'attributes':_0x313bac['attributes'],'include':_0x313bac[_0xad04('0x19')]?_['map'](_0x313bac[_0xad04('0x19')],function(_0x3f8f60){return{'model':db[_0x3f8f60[_0xad04('0x1b')]],'as':_0x3f8f60['as'],'attributes':_0x3f8f60['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x54361c){logger[_0xad04('0xa')](_0xad04('0x1f'),_0x22bcf1);logger['debug'](_0xad04('0x1f'),_0x22bcf1,JSON[_0xad04('0x1e')](_0x54361c));_0x5a763d(_0x54361c);})[_0xad04('0x12')](function(_0x1d36fe){logger[_0xad04('0xd')](_0xad04('0x1f'),_0x1d36fe[_0xad04('0xf')],_0x22bcf1);_0x34921e(_0x1c0110['error'](0x1f4,_0x1d36fe['message']));});});}; \ No newline at end of file +var _0x040e=['client','http','request','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetInterval','Interval','options','attributes','include','map','model','then','ShowInterval','find','raw','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x040e,0x129));var _0xe040=function(_0x1d56fa,_0x245f75){_0x1d56fa=_0x1d56fa-0x0;var _0x591df2=_0x040e[_0x1d56fa];return _0x591df2;};'use strict';var _=require('lodash');var util=require(_0xe040('0x0'));var moment=require(_0xe040('0x1'));var BPromise=require(_0xe040('0x2'));var rs=require(_0xe040('0x3'));var fs=require('fs');var Redis=require(_0xe040('0x4'));var db=require(_0xe040('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe040('0x6'))(_0xe040('0x7'));var config=require(_0xe040('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe040('0x9')][_0xe040('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36da31,_0xf504b5,_0x31ef54){return new BPromise(function(_0x31ab05,_0x390b7){return client[_0xe040('0xb')](_0x36da31,_0x31ef54)['then'](function(_0x479699){logger['info'](_0xe040('0xc'),_0xf504b5,_0xe040('0xd'));logger[_0xe040('0xe')](_0xe040('0xf'),_0xf504b5,_0xe040('0xd'),JSON[_0xe040('0x10')](_0x479699));if(_0x479699[_0xe040('0x11')]){if(_0x479699[_0xe040('0x11')][_0xe040('0x12')]===0x1f4){logger['error'](_0xe040('0xc'),_0xf504b5,_0x479699[_0xe040('0x11')]['message']);return _0x390b7(_0x479699[_0xe040('0x11')][_0xe040('0x13')]);}logger[_0xe040('0x11')](_0xe040('0xc'),_0xf504b5,_0x479699[_0xe040('0x11')][_0xe040('0x13')]);return _0x31ab05(_0x479699['error']['message']);}else{logger[_0xe040('0x14')](_0xe040('0xc'),_0xf504b5,_0xe040('0xd'));_0x31ab05(_0x479699['result'][_0xe040('0x13')]);}})[_0xe040('0x15')](function(_0x570cd8){logger['error'](_0xe040('0xc'),_0xf504b5,_0x570cd8);_0x390b7(_0x570cd8);});});}exports[_0xe040('0x16')]=function(_0x3c6d75){var _0x7d66c0=this;return new Promise(function(_0x32b3ac,_0x5650de){return db[_0xe040('0x17')]['findAll']({'raw':_0x3c6d75[_0xe040('0x18')]?_0x3c6d75['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c6d75[_0xe040('0x18')]?_0x3c6d75[_0xe040('0x18')]['where']||null:null,'attributes':_0x3c6d75[_0xe040('0x18')]?_0x3c6d75['options'][_0xe040('0x19')]||null:null,'limit':_0x3c6d75[_0xe040('0x18')]?_0x3c6d75[_0xe040('0x18')]['limit']||null:null,'include':_0x3c6d75['options']?_0x3c6d75[_0xe040('0x18')][_0xe040('0x1a')]?_[_0xe040('0x1b')](_0x3c6d75[_0xe040('0x18')][_0xe040('0x1a')],function(_0x19d37e){return{'model':db[_0x19d37e[_0xe040('0x1c')]],'as':_0x19d37e['as'],'attributes':_0x19d37e[_0xe040('0x19')],'include':_0x19d37e[_0xe040('0x1a')]?_[_0xe040('0x1b')](_0x19d37e['include'],function(_0xac3b2f){return{'model':db[_0xac3b2f[_0xe040('0x1c')]],'as':_0xac3b2f['as'],'attributes':_0xac3b2f[_0xe040('0x19')],'include':_0xac3b2f[_0xe040('0x1a')]?_[_0xe040('0x1b')](_0xac3b2f[_0xe040('0x1a')],function(_0x1d8ccc){return{'model':db[_0x1d8ccc[_0xe040('0x1c')]],'as':_0x1d8ccc['as'],'attributes':_0x1d8ccc[_0xe040('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe040('0x1d')](function(_0x187c9d){logger[_0xe040('0x14')](_0xe040('0x16'),_0x3c6d75);logger[_0xe040('0xe')](_0xe040('0x16'),_0x3c6d75,JSON[_0xe040('0x10')](_0x187c9d));_0x32b3ac(_0x187c9d);})[_0xe040('0x15')](function(_0x142603){logger[_0xe040('0x11')]('GetInterval',_0x142603['message'],_0x3c6d75);_0x5650de(_0x7d66c0[_0xe040('0x11')](0x1f4,_0x142603[_0xe040('0x13')]));});});};exports[_0xe040('0x1e')]=function(_0x4975b8){var _0x4ba873=this;return new Promise(function(_0x18eb5a,_0x2fe926){return db[_0xe040('0x17')][_0xe040('0x1f')]({'raw':_0x4975b8[_0xe040('0x18')]?_0x4975b8['options'][_0xe040('0x20')]===undefined?!![]:![]:!![],'where':_0x4975b8[_0xe040('0x18')]?_0x4975b8[_0xe040('0x18')][_0xe040('0x21')]||null:null,'attributes':_0x4975b8[_0xe040('0x18')]?_0x4975b8[_0xe040('0x18')][_0xe040('0x19')]||null:null,'include':_0x4975b8['options']?_0x4975b8[_0xe040('0x18')][_0xe040('0x1a')]?_['map'](_0x4975b8[_0xe040('0x18')][_0xe040('0x1a')],function(_0x36929b){return{'model':db[_0x36929b['model']],'as':_0x36929b['as'],'attributes':_0x36929b['attributes'],'include':_0x36929b[_0xe040('0x1a')]?_[_0xe040('0x1b')](_0x36929b[_0xe040('0x1a')],function(_0x1c2ef4){return{'model':db[_0x1c2ef4[_0xe040('0x1c')]],'as':_0x1c2ef4['as'],'attributes':_0x1c2ef4[_0xe040('0x19')],'include':_0x1c2ef4['include']?_[_0xe040('0x1b')](_0x1c2ef4['include'],function(_0x9a5cf2){return{'model':db[_0x9a5cf2['model']],'as':_0x9a5cf2['as'],'attributes':_0x9a5cf2[_0xe040('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x301fcf){logger[_0xe040('0x14')](_0xe040('0x1e'),_0x4975b8);logger[_0xe040('0xe')](_0xe040('0x1e'),_0x4975b8,JSON[_0xe040('0x10')](_0x301fcf));_0x18eb5a(_0x301fcf);})[_0xe040('0x15')](function(_0x3b4328){logger['error'](_0xe040('0x1e'),_0x3b4328[_0xe040('0x13')],_0x4975b8);_0x2fe926(_0x4ba873[_0xe040('0x11')](0x1f4,_0x3b4328[_0xe040('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6383893..29ab665 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 _0x277c=['isAuthenticated','send','exports','express','../../components/auth/service','./jira.controller','post'];(function(_0x401926,_0x4fa8e0){var _0x345769=function(_0x113a95){while(--_0x113a95){_0x401926['push'](_0x401926['shift']());}};_0x345769(++_0x4fa8e0);}(_0x277c,0x153));var _0xc277=function(_0x1e19b4,_0x2bccb1){_0x1e19b4=_0x1e19b4-0x0;var _0x39401f=_0x277c[_0x1e19b4];return _0x39401f;};'use strict';var express=require(_0xc277('0x0'));var router=express['Router']();var auth=require(_0xc277('0x1'));var controller=require(_0xc277('0x2'));router[_0xc277('0x3')]('/',auth[_0xc277('0x4')](),controller[_0xc277('0x5')]);module[_0xc277('0x6')]=router; \ No newline at end of file +var _0x21f2=['exports','Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send'];(function(_0x154f26,_0x228c67){var _0x2a1b3f=function(_0x1a93a3){while(--_0x1a93a3){_0x154f26['push'](_0x154f26['shift']());}};_0x2a1b3f(++_0x228c67);}(_0x21f2,0x158));var _0x221f=function(_0x4f6f05,_0x293eed){_0x4f6f05=_0x4f6f05-0x0;var _0x2255fe=_0x21f2[_0x4f6f05];return _0x2255fe;};'use strict';var express=require('express');var router=express[_0x221f('0x0')]();var auth=require(_0x221f('0x1'));var controller=require(_0x221f('0x2'));router[_0x221f('0x3')]('/',auth[_0x221f('0x4')](),controller[_0x221f('0x5')]);module[_0x221f('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 ef2e166..ad252fd 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 _0x0d20=['status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','body','headers','remoteAddress','connection','socket','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','POST','application/json','Basic\x20','request','setEncoding','utf8','data','end'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x0d20,0x1a3));var _0x00d2=function(_0xad5102,_0x3c80d9){_0xad5102=_0xad5102-0x0;var _0x1e1e54=_0x0d20[_0xad5102];return _0x1e1e54;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x00d2('0x0'))(_0x00d2('0x1'));var USERNAME=_0x00d2('0x2');var PASSWORD=_0x00d2('0x3');function openIssue(_0x1b60e5,_0x3943ff){var _0x594178={'fields':{'project':{'key':_0x1b60e5[_0x00d2('0x4')]||_0x00d2('0x5')},'summary':(_0x1b60e5[_0x00d2('0x6')]||_0x00d2('0x7'))+_0x00d2('0x8')+_0x1b60e5['ip'],'description':_0x1b60e5[_0x00d2('0x9')]||JSON[_0x00d2('0xa')](_0x1b60e5),'issuetype':{'name':_0x1b60e5[_0x00d2('0xb')]||_0x00d2('0xc')}}};_0x594178['fields'][_0x00d2('0xd')]=_0x1b60e5[_0x00d2('0xe')];_0x594178['fields'][_0x00d2('0xf')]=_0x1b60e5[_0x00d2('0x10')];_0x594178[_0x00d2('0x11')][_0x00d2('0x12')]=_0x1b60e5['newToken'];_0x594178['fields'][_0x00d2('0x13')]=_0x1b60e5[_0x00d2('0x14')];_0x594178[_0x00d2('0x11')][_0x00d2('0x15')]=_0x1b60e5[_0x00d2('0x16')];_0x594178[_0x00d2('0x11')]['customfield_10102']=_0x1b60e5['ip'];var _0x48303a={'host':_0x00d2('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x00d2('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x00d2('0x19'),'Authorization':_0x00d2('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x5bccca=JSON[_0x00d2('0xa')](_0x594178);var _0x4caf36=https[_0x00d2('0x1b')](_0x48303a,function(_0x345491){_0x345491[_0x00d2('0x1c')](_0x00d2('0x1d'));var _0x177f27='';_0x345491['on'](_0x00d2('0x1e'),function(_0x43416c){_0x177f27+=_0x43416c;});_0x345491['on'](_0x00d2('0x1f'),function(){if(_0x3943ff){return _0x3943ff[_0x00d2('0x20')](_0x345491['statusCode'])['json'](JSON['parse'](_0x177f27));}});});_0x4caf36['on']('error',function(_0x50eb0f){if(_0x3943ff){return _0x3943ff[_0x00d2('0x20')](0x1f4)[_0x00d2('0x21')]({'errors':[{'message':_0x00d2('0x22'),'type':'api.jira'}]});}});_0x4caf36['write'](_0x5bccca);_0x4caf36[_0x00d2('0x1f')]();}exports[_0x00d2('0x23')]=openIssue;exports['send']=function(_0x1e7b28,_0x5592fc){_0x1e7b28[_0x00d2('0x24')]['ip']=_0x1e7b28[_0x00d2('0x25')]['x-forwarded-for']||_0x1e7b28['connection'][_0x00d2('0x26')]||_0x1e7b28['socket'][_0x00d2('0x26')]||_0x1e7b28[_0x00d2('0x27')][_0x00d2('0x28')]['remoteAddress'];return openIssue(_0x1e7b28[_0x00d2('0x24')],_0x5592fc);}; \ No newline at end of file +var _0xd84d=['write','openIssue','send','body','headers','connection','remoteAddress','socket','https','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd84d,0x151));var _0xdd84=function(_0x31f442,_0x32c25f){_0x31f442=_0x31f442-0x0;var _0x5215f3=_0xd84d[_0x31f442];return _0x5215f3;};'use strict';var BPromise=require('bluebird');var https=require(_0xdd84('0x0'));var logger=require('../../config/logger')(_0xdd84('0x1'));var USERNAME=_0xdd84('0x2');var PASSWORD=_0xdd84('0x3');function openIssue(_0x3d8d00,_0x4b52d8){var _0x484f4b={'fields':{'project':{'key':_0x3d8d00['key']||_0xdd84('0x4')},'summary':(_0x3d8d00[_0xdd84('0x5')]||_0xdd84('0x6'))+_0xdd84('0x7')+_0x3d8d00['ip'],'description':_0x3d8d00['description']||JSON['stringify'](_0x3d8d00),'issuetype':{'name':_0x3d8d00['issuetype']||_0xdd84('0x8')}}};_0x484f4b['fields'][_0xdd84('0x9')]=_0x3d8d00[_0xdd84('0xa')];_0x484f4b[_0xdd84('0xb')][_0xdd84('0xc')]=_0x3d8d00[_0xdd84('0xd')];_0x484f4b[_0xdd84('0xb')][_0xdd84('0xe')]=_0x3d8d00[_0xdd84('0xf')];_0x484f4b[_0xdd84('0xb')][_0xdd84('0x10')]=_0x3d8d00[_0xdd84('0x11')];_0x484f4b[_0xdd84('0xb')][_0xdd84('0x12')]=_0x3d8d00[_0xdd84('0x13')];_0x484f4b[_0xdd84('0xb')][_0xdd84('0x14')]=_0x3d8d00['ip'];var _0x934418={'host':_0xdd84('0x15'),'port':0x1bb,'path':_0xdd84('0x16'),'method':_0xdd84('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xdd84('0x18'),'Authorization':_0xdd84('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xdd84('0x1a')](_0xdd84('0x1b'))}};var _0x5388a2=JSON[_0xdd84('0x1c')](_0x484f4b);var _0x463ed6=https[_0xdd84('0x1d')](_0x934418,function(_0x3e2891){_0x3e2891[_0xdd84('0x1e')](_0xdd84('0x1f'));var _0x290b62='';_0x3e2891['on'](_0xdd84('0x20'),function(_0x1f1ffc){_0x290b62+=_0x1f1ffc;});_0x3e2891['on']('end',function(){if(_0x4b52d8){return _0x4b52d8[_0xdd84('0x21')](_0x3e2891['statusCode'])[_0xdd84('0x22')](JSON[_0xdd84('0x23')](_0x290b62));}});});_0x463ed6['on'](_0xdd84('0x24'),function(_0x492226){if(_0x4b52d8){return _0x4b52d8[_0xdd84('0x21')](0x1f4)[_0xdd84('0x22')]({'errors':[{'message':_0xdd84('0x25'),'type':_0xdd84('0x26')}]});}});_0x463ed6[_0xdd84('0x27')](_0x5388a2);_0x463ed6['end']();}exports[_0xdd84('0x28')]=openIssue;exports[_0xdd84('0x29')]=function(_0x29480b,_0x5a383f){_0x29480b[_0xdd84('0x2a')]['ip']=_0x29480b[_0xdd84('0x2b')]['x-forwarded-for']||_0x29480b[_0xdd84('0x2c')][_0xdd84('0x2d')]||_0x29480b[_0xdd84('0x2e')][_0xdd84('0x2d')]||_0x29480b[_0xdd84('0x2c')][_0xdd84('0x2e')][_0xdd84('0x2d')];return openIssue(_0x29480b[_0xdd84('0x2a')],_0x5a383f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3315e5f..02df65b 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 _0x7f4c=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x3f65a8,_0x4d7607){var _0x28283c=function(_0x5897f2){while(--_0x5897f2){_0x3f65a8['push'](_0x3f65a8['shift']());}};_0x28283c(++_0x4d7607);}(_0x7f4c,0xf2));var _0xc7f4=function(_0x1162e9,_0x7b095d){_0x1162e9=_0x1162e9-0x0;var _0x4cfe08=_0x7f4c[_0x1162e9];return _0x4cfe08;};'use strict';var multer=require(_0xc7f4('0x0'));var util=require('util');var path=require(_0xc7f4('0x1'));var timeout=require(_0xc7f4('0x2'));var express=require(_0xc7f4('0x3'));var router=express[_0xc7f4('0x4')]();var auth=require(_0xc7f4('0x5'));var interaction=require(_0xc7f4('0x6'));var config=require(_0xc7f4('0x7'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0xc7f4('0x8')](),controller[_0xc7f4('0x9')]);router['get'](_0xc7f4('0xa'),auth['isAuthenticated'](),controller[_0xc7f4('0xb')]);router['get'](_0xc7f4('0xc'),auth['isAuthenticated'](),controller[_0xc7f4('0xd')]);router[_0xc7f4('0xe')]('/',auth[_0xc7f4('0x8')](),controller[_0xc7f4('0xf')]);router[_0xc7f4('0x10')](_0xc7f4('0xc'),auth[_0xc7f4('0x8')](),controller[_0xc7f4('0x11')]);router[_0xc7f4('0x12')](_0xc7f4('0xc'),auth[_0xc7f4('0x8')](),controller['destroy']);module[_0xc7f4('0x13')]=router; \ No newline at end of file +var _0x06b1=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x3bf3c1,_0x51f9d1){var _0x47d3a4=function(_0x3820e3){while(--_0x3820e3){_0x3bf3c1['push'](_0x3bf3c1['shift']());}};_0x47d3a4(++_0x51f9d1);}(_0x06b1,0x177));var _0x106b=function(_0x43aed7,_0x14a55c){_0x43aed7=_0x43aed7-0x0;var _0x573cb7=_0x06b1[_0x43aed7];return _0x573cb7;};'use strict';var multer=require(_0x106b('0x0'));var util=require(_0x106b('0x1'));var path=require(_0x106b('0x2'));var timeout=require(_0x106b('0x3'));var express=require('express');var router=express[_0x106b('0x4')]();var auth=require(_0x106b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x106b('0x6'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0x106b('0x7')](),controller[_0x106b('0x8')]);router[_0x106b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x106b('0xa')]);router[_0x106b('0x9')](_0x106b('0xb'),auth[_0x106b('0x7')](),controller[_0x106b('0xc')]);router[_0x106b('0xd')]('/',auth['isAuthenticated'](),controller[_0x106b('0xe')]);router['put'](_0x106b('0xb'),auth['isAuthenticated'](),controller[_0x106b('0xf')]);router[_0x106b('0x10')](_0x106b('0xb'),auth['isAuthenticated'](),controller[_0x106b('0x11')]);module[_0x106b('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 50d8be4..20d73d6 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 _0x7618=['exports','STRING','TEXT','long'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x7618,0x1e4));var _0x8761=function(_0x19a9eb,_0x1e8850){_0x19a9eb=_0x19a9eb-0x0;var _0x3b7b6c=_0x7618[_0x19a9eb];return _0x3b7b6c;};'use strict';var Sequelize=require('sequelize');module[_0x8761('0x0')]={'question':{'type':Sequelize[_0x8761('0x1')]},'answer':{'type':Sequelize[_0x8761('0x2')](_0x8761('0x3'))},'membername':{'type':Sequelize[_0x8761('0x1')]},'projectname':{'type':Sequelize[_0x8761('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8761('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c9b=['long','exports','STRING','TEXT'];(function(_0x35abf9,_0x43aee9){var _0x3dd06f=function(_0x49644d){while(--_0x49644d){_0x35abf9['push'](_0x35abf9['shift']());}};_0x3dd06f(++_0x43aee9);}(_0x0c9b,0x1b9));var _0xb0c9=function(_0x46bd3a,_0x3532a6){_0x46bd3a=_0x46bd3a-0x0;var _0x413f8b=_0x0c9b[_0x46bd3a];return _0x413f8b;};'use strict';var Sequelize=require('sequelize');module[_0xb0c9('0x0')]={'question':{'type':Sequelize[_0xb0c9('0x1')]},'answer':{'type':Sequelize[_0xb0c9('0x2')](_0xb0c9('0x3'))},'membername':{'type':Sequelize[_0xb0c9('0x1')]},'projectname':{'type':Sequelize[_0xb0c9('0x1')]},'queue':{'type':Sequelize[_0xb0c9('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb0c9('0x1')]},'calleridnum':{'type':Sequelize[_0xb0c9('0x1')]},'questionId':{'type':Sequelize[_0xb0c9('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index d45e734..3f35046 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 _0xfca8=['options','includeAll','JscriptyAnswerReport','findAll','rows','catch','show','length','include','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','where','merge','filter'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfca8,0x1c5));var _0x8fca=function(_0x174c45,_0x733885){_0x174c45=_0x174c45-0x0;var _0x8d56e3=_0xfca8[_0x174c45];return _0x8d56e3;};'use strict';var pdf=require(_0x8fca('0x0'));var emlformat=require(_0x8fca('0x1'));var rimraf=require(_0x8fca('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fca('0x3'));var rp=require(_0x8fca('0x4'));var moment=require(_0x8fca('0x5'));var BPromise=require(_0x8fca('0x6'));var Mustache=require('mustache');var util=require(_0x8fca('0x7'));var path=require('path');var sox=require(_0x8fca('0x8'));var csv=require(_0x8fca('0x9'));var ejs=require(_0x8fca('0xa'));var fs=require('fs');var _=require(_0x8fca('0xb'));var squel=require(_0x8fca('0xc'));var crypto=require(_0x8fca('0xd'));var jsforce=require(_0x8fca('0xe'));var deskjs=require(_0x8fca('0xf'));var toCsv=require(_0x8fca('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8fca('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8fca('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fca('0x12'))(_0x8fca('0x13'));var utils=require(_0x8fca('0x14'));var config=require(_0x8fca('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25edf6,_0x509fd9){_0x509fd9=_0x509fd9||0xcc;return function(_0x101b94){if(_0x101b94){return _0x25edf6[_0x8fca('0x16')](_0x509fd9);}return _0x25edf6[_0x8fca('0x17')](_0x509fd9)['end']();};}function respondWithResult(_0x41df74,_0x2c9327){_0x2c9327=_0x2c9327||0xc8;return function(_0x4b50f8){if(_0x4b50f8){return _0x41df74[_0x8fca('0x17')](_0x2c9327)[_0x8fca('0x18')](_0x4b50f8);}};}function respondWithFilteredResult(_0x25d931,_0x1eba7c){return function(_0x4ee1a8){if(_0x4ee1a8){var _0x5537f3=_0x4ee1a8[_0x8fca('0x19')],_0x5757a2=_0x1eba7c[_0x8fca('0x1a')],_0x5bd9b5=_0x1eba7c[_0x8fca('0x1a')]+_0x1eba7c['limit'],_0x39140d;if(_0x5bd9b5>=_0x5537f3){_0x5bd9b5=_0x5537f3;_0x39140d=0xc8;}else{_0x39140d=0xce;}_0x25d931['status'](_0x39140d);return _0x25d931[_0x8fca('0x1b')](_0x8fca('0x1c'),_0x5757a2+'-'+_0x5bd9b5+'/'+_0x5537f3)[_0x8fca('0x18')](_0x4ee1a8);}return null;};}function patchUpdates(_0x47415e){return function(_0x2f224){try{jsonpatch[_0x8fca('0x1d')](_0x2f224,_0x47415e,!![]);}catch(_0x4e5359){return BPromise[_0x8fca('0x1e')](_0x4e5359);}return _0x2f224['save']();};}function saveUpdates(_0x4eca2f,_0x426a6c){return function(_0x591449){if(_0x591449){return _0x591449[_0x8fca('0x1f')](_0x4eca2f)[_0x8fca('0x20')](function(_0x1698a0){return _0x1698a0;});}return null;};}function removeEntity(_0x2f4b9d,_0x23d855){return function(_0x5d50fd){if(_0x5d50fd){return _0x5d50fd['destroy']()[_0x8fca('0x20')](function(){_0x2f4b9d[_0x8fca('0x17')](0xcc)[_0x8fca('0x21')]();});}};}function handleEntityNotFound(_0x243a9f,_0x18cfdb){return function(_0x4f72b1){if(!_0x4f72b1){_0x243a9f[_0x8fca('0x16')](0x194);}return _0x4f72b1;};}function handleError(_0xe72155,_0x1017d9){_0x1017d9=_0x1017d9||0x1f4;return function(_0x451236){logger[_0x8fca('0x22')](_0x451236[_0x8fca('0x23')]);if(_0x451236['name']){delete _0x451236[_0x8fca('0x24')];}_0xe72155['status'](_0x1017d9)[_0x8fca('0x25')](_0x451236);};}exports[_0x8fca('0x26')]=function(_0x12796e,_0x25f45f){var _0x589fac={},_0x26769f={},_0x15b977={'count':0x0,'rows':[]};var _0x581fc2=_[_0x8fca('0x27')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x2a0e27){return{'name':_0x2a0e27[_0x8fca('0x28')],'type':_0x2a0e27[_0x8fca('0x29')][_0x8fca('0x2a')]};});_0x26769f[_0x8fca('0x2b')]=_[_0x8fca('0x27')](_0x581fc2,_0x8fca('0x24'));_0x26769f[_0x8fca('0x2c')]=_[_0x8fca('0x2d')](_0x12796e['query']);_0x26769f[_0x8fca('0x2e')]=_[_0x8fca('0x2f')](_0x26769f[_0x8fca('0x2b')],_0x26769f[_0x8fca('0x2c')]);_0x589fac[_0x8fca('0x30')]=_[_0x8fca('0x2f')](_0x26769f[_0x8fca('0x2b')],qs[_0x8fca('0x31')](_0x12796e[_0x8fca('0x2c')][_0x8fca('0x31')]));_0x589fac['attributes']=_0x589fac['attributes']['length']?_0x589fac[_0x8fca('0x30')]:_0x26769f['model'];if(!_0x12796e[_0x8fca('0x2c')][_0x8fca('0x32')](_0x8fca('0x33'))){_0x589fac[_0x8fca('0x34')]=qs['limit'](_0x12796e[_0x8fca('0x2c')][_0x8fca('0x34')]);_0x589fac[_0x8fca('0x1a')]=qs[_0x8fca('0x1a')](_0x12796e[_0x8fca('0x2c')][_0x8fca('0x1a')]);}_0x589fac['order']=qs[_0x8fca('0x35')](_0x12796e[_0x8fca('0x2c')]['sort']);_0x589fac['where']=qs['filters'](_[_0x8fca('0x36')](_0x12796e[_0x8fca('0x2c')],_0x26769f[_0x8fca('0x2e')]),_0x581fc2);if(_0x12796e[_0x8fca('0x2c')]['filter']){_0x589fac[_0x8fca('0x37')]=_[_0x8fca('0x38')](_0x589fac['where'],{'$or':_[_0x8fca('0x27')](_0x581fc2,function(_0x434503){if(_0x434503['type']!=='VIRTUAL'){var _0x259303={};_0x259303[_0x434503[_0x8fca('0x24')]]={'$like':'%'+_0x12796e[_0x8fca('0x2c')][_0x8fca('0x39')]+'%'};return _0x259303;}})});}_0x589fac=_['merge']({},_0x589fac,_0x12796e[_0x8fca('0x3a')]);var _0x373509={'where':_0x589fac[_0x8fca('0x37')]};return db['JscriptyAnswerReport'][_0x8fca('0x19')](_0x373509)[_0x8fca('0x20')](function(_0x27c733){_0x15b977[_0x8fca('0x19')]=_0x27c733;if(_0x12796e[_0x8fca('0x2c')][_0x8fca('0x3b')]){_0x589fac['include']=[{'all':!![]}];}return db[_0x8fca('0x3c')][_0x8fca('0x3d')](_0x589fac);})['then'](function(_0x30204e){_0x15b977[_0x8fca('0x3e')]=_0x30204e;return _0x15b977;})['then'](respondWithFilteredResult(_0x25f45f,_0x589fac))[_0x8fca('0x3f')](handleError(_0x25f45f,null));};exports[_0x8fca('0x40')]=function(_0x5ae4a2,_0x40e7d9){var _0x4c3f65={'raw':!![],'where':{'id':_0x5ae4a2['params']['id']}},_0x22ecfd={};_0x22ecfd['model']=_['keys'](db[_0x8fca('0x3c')]['rawAttributes']);_0x22ecfd[_0x8fca('0x2c')]=_['keys'](_0x5ae4a2['query']);_0x22ecfd[_0x8fca('0x2e')]=_[_0x8fca('0x2f')](_0x22ecfd['model'],_0x22ecfd[_0x8fca('0x2c')]);_0x4c3f65[_0x8fca('0x30')]=_['intersection'](_0x22ecfd[_0x8fca('0x2b')],qs[_0x8fca('0x31')](_0x5ae4a2[_0x8fca('0x2c')][_0x8fca('0x31')]));_0x4c3f65['attributes']=_0x4c3f65[_0x8fca('0x30')][_0x8fca('0x41')]?_0x4c3f65['attributes']:_0x22ecfd[_0x8fca('0x2b')];if(_0x5ae4a2['query']['includeAll']){_0x4c3f65[_0x8fca('0x42')]=[{'all':!![]}];}_0x4c3f65=_[_0x8fca('0x38')]({},_0x4c3f65,_0x5ae4a2[_0x8fca('0x3a')]);return db[_0x8fca('0x3c')][_0x8fca('0x43')](_0x4c3f65)[_0x8fca('0x20')](handleEntityNotFound(_0x40e7d9,null))[_0x8fca('0x20')](respondWithResult(_0x40e7d9,null))[_0x8fca('0x3f')](handleError(_0x40e7d9,null));};exports[_0x8fca('0x44')]=function(_0x2fda83,_0x291446){return db['JscriptyAnswerReport'][_0x8fca('0x44')](_0x2fda83[_0x8fca('0x45')],{})[_0x8fca('0x20')](respondWithResult(_0x291446,0xc9))['catch'](handleError(_0x291446,null));};exports['update']=function(_0x276597,_0x16f1fc){if(_0x276597[_0x8fca('0x45')]['id']){delete _0x276597['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x276597[_0x8fca('0x46')]['id']}})[_0x8fca('0x20')](handleEntityNotFound(_0x16f1fc,null))[_0x8fca('0x20')](saveUpdates(_0x276597[_0x8fca('0x45')],null))['then'](respondWithResult(_0x16f1fc,null))['catch'](handleError(_0x16f1fc,null));};exports[_0x8fca('0x47')]=function(_0x1ab952,_0x35685d){return db[_0x8fca('0x3c')][_0x8fca('0x43')]({'where':{'id':_0x1ab952[_0x8fca('0x46')]['id']}})[_0x8fca('0x20')](handleEntityNotFound(_0x35685d,null))['then'](removeEntity(_0x35685d,null))[_0x8fca('0x3f')](handleError(_0x35685d,null));};exports[_0x8fca('0x48')]=function(_0x1a4fab,_0x24147a){return db[_0x8fca('0x3c')][_0x8fca('0x48')]()['then'](respondWithResult(_0x24147a,null))[_0x8fca('0x3f')](handleError(_0x24147a,null));}; \ No newline at end of file +var _0xd197=['body','update','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','keys','fields','find'];(function(_0x196e97,_0x4a9704){var _0x20d578=function(_0x9fdec6){while(--_0x9fdec6){_0x196e97['push'](_0x196e97['shift']());}};_0x20d578(++_0x4a9704);}(_0xd197,0x18b));var _0x7d19=function(_0xfd046f,_0x21f3fd){_0xfd046f=_0xfd046f-0x0;var _0x2f52c9=_0xd197[_0xfd046f];return _0x2f52c9;};'use strict';var pdf=require(_0x7d19('0x0'));var emlformat=require(_0x7d19('0x1'));var rimraf=require(_0x7d19('0x2'));var zipdir=require(_0x7d19('0x3'));var jsonpatch=require(_0x7d19('0x4'));var rp=require(_0x7d19('0x5'));var moment=require(_0x7d19('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7d19('0x7'));var util=require(_0x7d19('0x8'));var path=require(_0x7d19('0x9'));var sox=require(_0x7d19('0xa'));var csv=require(_0x7d19('0xb'));var ejs=require(_0x7d19('0xc'));var fs=require('fs');var _=require(_0x7d19('0xd'));var squel=require('squel');var crypto=require(_0x7d19('0xe'));var jsforce=require(_0x7d19('0xf'));var deskjs=require(_0x7d19('0x10'));var toCsv=require(_0x7d19('0xb'));var querystring=require(_0x7d19('0x11'));var Papa=require('papaparse');var Redis=require(_0x7d19('0x12'));var authService=require(_0x7d19('0x13'));var qs=require(_0x7d19('0x14'));var as=require(_0x7d19('0x15'));var hardwareService=require(_0x7d19('0x16'));var logger=require(_0x7d19('0x17'))(_0x7d19('0x18'));var utils=require(_0x7d19('0x19'));var config=require(_0x7d19('0x1a'));var db=require(_0x7d19('0x1b'))['db'];function respondWithStatusCode(_0x30a7f2,_0x46d263){_0x46d263=_0x46d263||0xcc;return function(_0x17e18c){if(_0x17e18c){return _0x30a7f2['sendStatus'](_0x46d263);}return _0x30a7f2[_0x7d19('0x1c')](_0x46d263)['end']();};}function respondWithResult(_0x39df48,_0x113fa1){_0x113fa1=_0x113fa1||0xc8;return function(_0xe82434){if(_0xe82434){return _0x39df48[_0x7d19('0x1c')](_0x113fa1)[_0x7d19('0x1d')](_0xe82434);}};}function respondWithFilteredResult(_0x537df5,_0x32af1b){return function(_0x91a30a){if(_0x91a30a){var _0x4cd0c9=_0x91a30a[_0x7d19('0x1e')],_0x27409a=_0x32af1b[_0x7d19('0x1f')],_0xc38963=_0x32af1b[_0x7d19('0x1f')]+_0x32af1b[_0x7d19('0x20')],_0x5b2818;if(_0xc38963>=_0x4cd0c9){_0xc38963=_0x4cd0c9;_0x5b2818=0xc8;}else{_0x5b2818=0xce;}_0x537df5[_0x7d19('0x1c')](_0x5b2818);return _0x537df5[_0x7d19('0x21')](_0x7d19('0x22'),_0x27409a+'-'+_0xc38963+'/'+_0x4cd0c9)['json'](_0x91a30a);}return null;};}function patchUpdates(_0x1c16b1){return function(_0x192ef9){try{jsonpatch['apply'](_0x192ef9,_0x1c16b1,!![]);}catch(_0x16422e){return BPromise[_0x7d19('0x23')](_0x16422e);}return _0x192ef9['save']();};}function saveUpdates(_0x24ed4b,_0x3f6ab2){return function(_0xf2e624){if(_0xf2e624){return _0xf2e624['update'](_0x24ed4b)[_0x7d19('0x24')](function(_0x2ad74b){return _0x2ad74b;});}return null;};}function removeEntity(_0x1bef31,_0x4fb016){return function(_0x1d95c5){if(_0x1d95c5){return _0x1d95c5['destroy']()[_0x7d19('0x24')](function(){_0x1bef31[_0x7d19('0x1c')](0xcc)[_0x7d19('0x25')]();});}};}function handleEntityNotFound(_0x18abca,_0x3071b2){return function(_0x1c05b6){if(!_0x1c05b6){_0x18abca[_0x7d19('0x26')](0x194);}return _0x1c05b6;};}function handleError(_0x4dc75e,_0x129680){_0x129680=_0x129680||0x1f4;return function(_0x4b4bf7){logger[_0x7d19('0x27')](_0x4b4bf7[_0x7d19('0x28')]);if(_0x4b4bf7[_0x7d19('0x29')]){delete _0x4b4bf7[_0x7d19('0x29')];}_0x4dc75e[_0x7d19('0x1c')](_0x129680)[_0x7d19('0x2a')](_0x4b4bf7);};}exports[_0x7d19('0x2b')]=function(_0x5cdec9,_0x345b4d){var _0x336e0e={},_0x17a1b8={},_0x214fdf={'count':0x0,'rows':[]};var _0x1a6c1a=_[_0x7d19('0x2c')](db['JscriptyAnswerReport'][_0x7d19('0x2d')],function(_0x4f72d3){return{'name':_0x4f72d3[_0x7d19('0x2e')],'type':_0x4f72d3[_0x7d19('0x2f')][_0x7d19('0x30')]};});_0x17a1b8['model']=_['map'](_0x1a6c1a,_0x7d19('0x29'));_0x17a1b8[_0x7d19('0x31')]=_['keys'](_0x5cdec9['query']);_0x17a1b8[_0x7d19('0x32')]=_['intersection'](_0x17a1b8[_0x7d19('0x33')],_0x17a1b8[_0x7d19('0x31')]);_0x336e0e[_0x7d19('0x34')]=_[_0x7d19('0x35')](_0x17a1b8['model'],qs['fields'](_0x5cdec9[_0x7d19('0x31')]['fields']));_0x336e0e[_0x7d19('0x34')]=_0x336e0e[_0x7d19('0x34')][_0x7d19('0x36')]?_0x336e0e[_0x7d19('0x34')]:_0x17a1b8['model'];if(!_0x5cdec9[_0x7d19('0x31')][_0x7d19('0x37')](_0x7d19('0x38'))){_0x336e0e[_0x7d19('0x20')]=qs[_0x7d19('0x20')](_0x5cdec9['query'][_0x7d19('0x20')]);_0x336e0e[_0x7d19('0x1f')]=qs['offset'](_0x5cdec9['query'][_0x7d19('0x1f')]);}_0x336e0e[_0x7d19('0x39')]=qs[_0x7d19('0x3a')](_0x5cdec9[_0x7d19('0x31')][_0x7d19('0x3a')]);_0x336e0e[_0x7d19('0x3b')]=qs['filters'](_['pick'](_0x5cdec9[_0x7d19('0x31')],_0x17a1b8[_0x7d19('0x32')]),_0x1a6c1a);if(_0x5cdec9[_0x7d19('0x31')]['filter']){_0x336e0e['where']=_[_0x7d19('0x3c')](_0x336e0e[_0x7d19('0x3b')],{'$or':_[_0x7d19('0x2c')](_0x1a6c1a,function(_0x1437e3){if(_0x1437e3['type']!==_0x7d19('0x3d')){var _0x447c44={};_0x447c44[_0x1437e3[_0x7d19('0x29')]]={'$like':'%'+_0x5cdec9[_0x7d19('0x31')][_0x7d19('0x3e')]+'%'};return _0x447c44;}})});}_0x336e0e=_[_0x7d19('0x3c')]({},_0x336e0e,_0x5cdec9[_0x7d19('0x3f')]);var _0x55b499={'where':_0x336e0e[_0x7d19('0x3b')]};return db[_0x7d19('0x40')][_0x7d19('0x1e')](_0x55b499)['then'](function(_0x46aed1){_0x214fdf['count']=_0x46aed1;if(_0x5cdec9['query'][_0x7d19('0x41')]){_0x336e0e[_0x7d19('0x42')]=[{'all':!![]}];}return db[_0x7d19('0x40')][_0x7d19('0x43')](_0x336e0e);})[_0x7d19('0x24')](function(_0x5f2fe3){_0x214fdf[_0x7d19('0x44')]=_0x5f2fe3;return _0x214fdf;})[_0x7d19('0x24')](respondWithFilteredResult(_0x345b4d,_0x336e0e))[_0x7d19('0x45')](handleError(_0x345b4d,null));};exports['show']=function(_0x380b67,_0x30ba05){var _0x24015c={'raw':!![],'where':{'id':_0x380b67['params']['id']}},_0x1db1c7={};_0x1db1c7[_0x7d19('0x33')]=_[_0x7d19('0x46')](db[_0x7d19('0x40')][_0x7d19('0x2d')]);_0x1db1c7['query']=_[_0x7d19('0x46')](_0x380b67[_0x7d19('0x31')]);_0x1db1c7[_0x7d19('0x32')]=_[_0x7d19('0x35')](_0x1db1c7[_0x7d19('0x33')],_0x1db1c7[_0x7d19('0x31')]);_0x24015c['attributes']=_[_0x7d19('0x35')](_0x1db1c7[_0x7d19('0x33')],qs[_0x7d19('0x47')](_0x380b67[_0x7d19('0x31')][_0x7d19('0x47')]));_0x24015c[_0x7d19('0x34')]=_0x24015c[_0x7d19('0x34')][_0x7d19('0x36')]?_0x24015c[_0x7d19('0x34')]:_0x1db1c7[_0x7d19('0x33')];if(_0x380b67['query'][_0x7d19('0x41')]){_0x24015c[_0x7d19('0x42')]=[{'all':!![]}];}_0x24015c=_[_0x7d19('0x3c')]({},_0x24015c,_0x380b67[_0x7d19('0x3f')]);return db[_0x7d19('0x40')][_0x7d19('0x48')](_0x24015c)[_0x7d19('0x24')](handleEntityNotFound(_0x30ba05,null))[_0x7d19('0x24')](respondWithResult(_0x30ba05,null))['catch'](handleError(_0x30ba05,null));};exports['create']=function(_0x42b45d,_0xa00669){return db[_0x7d19('0x40')]['create'](_0x42b45d[_0x7d19('0x49')],{})[_0x7d19('0x24')](respondWithResult(_0xa00669,0xc9))[_0x7d19('0x45')](handleError(_0xa00669,null));};exports[_0x7d19('0x4a')]=function(_0x590ce9,_0x5a431e){if(_0x590ce9[_0x7d19('0x49')]['id']){delete _0x590ce9[_0x7d19('0x49')]['id'];}return db[_0x7d19('0x40')][_0x7d19('0x48')]({'where':{'id':_0x590ce9[_0x7d19('0x4b')]['id']}})[_0x7d19('0x24')](handleEntityNotFound(_0x5a431e,null))[_0x7d19('0x24')](saveUpdates(_0x590ce9[_0x7d19('0x49')],null))[_0x7d19('0x24')](respondWithResult(_0x5a431e,null))[_0x7d19('0x45')](handleError(_0x5a431e,null));};exports[_0x7d19('0x4c')]=function(_0x5ae490,_0x2ec27c){return db['JscriptyAnswerReport'][_0x7d19('0x48')]({'where':{'id':_0x5ae490['params']['id']}})['then'](handleEntityNotFound(_0x2ec27c,null))['then'](removeEntity(_0x2ec27c,null))[_0x7d19('0x45')](handleError(_0x2ec27c,null));};exports[_0x7d19('0x4d')]=function(_0x56a8c0,_0xeca0f1){return db['JscriptyAnswerReport'][_0x7d19('0x4d')]()[_0x7d19('0x24')](respondWithResult(_0xeca0f1,null))['catch'](handleError(_0xeca0f1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ed59a3a..2a3b89f 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 _0x1329=['path','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','lodash','util','../../config/logger','moment','request-promise'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x1329,0x19f));var _0x9132=function(_0x28d6d4,_0x3a708c){_0x28d6d4=_0x28d6d4-0x0;var _0x3e06d0=_0x1329[_0x28d6d4];return _0x3e06d0;};'use strict';var _=require(_0x9132('0x0'));var util=require(_0x9132('0x1'));var logger=require(_0x9132('0x2'))('api');var moment=require(_0x9132('0x3'));var BPromise=require('bluebird');var rp=require(_0x9132('0x4'));var fs=require('fs');var path=require(_0x9132('0x5'));var rimraf=require(_0x9132('0x6'));var config=require('../../config/environment');var attributes=require(_0x9132('0x7'));module[_0x9132('0x8')]=function(_0x47b3a9,_0x11e513){return _0x47b3a9['define'](_0x9132('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1558=['path','rimraf','./jscriptyAnswerReport.attributes','define','report_jscripty_answers','util','../../config/logger','api','moment','request-promise'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0x1558,0x18b));var _0x8155=function(_0x97c6ea,_0x4cffce){_0x97c6ea=_0x97c6ea-0x0;var _0x2d7f50=_0x1558[_0x97c6ea];return _0x2d7f50;};'use strict';var _=require('lodash');var util=require(_0x8155('0x0'));var logger=require(_0x8155('0x1'))(_0x8155('0x2'));var moment=require(_0x8155('0x3'));var BPromise=require('bluebird');var rp=require(_0x8155('0x4'));var fs=require('fs');var path=require(_0x8155('0x5'));var rimraf=require(_0x8155('0x6'));var config=require('../../config/environment');var attributes=require(_0x8155('0x7'));module['exports']=function(_0xfd3b1b,_0x4896c9){return _0xfd3b1b[_0x8155('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x8155('0x9'),'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 4392b25..d85dc29 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 _0xda23=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x25c0de,_0x46b875){var _0x1ea4fa=function(_0xb7a1e8){while(--_0xb7a1e8){_0x25c0de['push'](_0x25c0de['shift']());}};_0x1ea4fa(++_0x46b875);}(_0xda23,0xcc));var _0x3da2=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0xda23[_0x4350c2];return _0x8b6406;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3da2('0x0'));var BPromise=require(_0x3da2('0x1'));var rs=require(_0x3da2('0x2'));var fs=require('fs');var Redis=require(_0x3da2('0x3'));var db=require(_0x3da2('0x4'))['db'];var utils=require(_0x3da2('0x5'));var logger=require(_0x3da2('0x6'))(_0x3da2('0x7'));var config=require(_0x3da2('0x8'));var jayson=require(_0x3da2('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e0ad7,_0xb191a6,_0x1c504b){return new BPromise(function(_0x30a763,_0x5361d4){return client['request'](_0x2e0ad7,_0x1c504b)['then'](function(_0x387963){logger[_0x3da2('0xa')](_0x3da2('0xb'),_0xb191a6,_0x3da2('0xc'));logger[_0x3da2('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xb191a6,_0x3da2('0xc'),JSON['stringify'](_0x387963));if(_0x387963[_0x3da2('0xe')]){if(_0x387963[_0x3da2('0xe')][_0x3da2('0xf')]===0x1f4){logger[_0x3da2('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xb191a6,_0x387963['error']['message']);return _0x5361d4(_0x387963[_0x3da2('0xe')]['message']);}logger[_0x3da2('0xe')](_0x3da2('0xb'),_0xb191a6,_0x387963[_0x3da2('0xe')][_0x3da2('0x10')]);return _0x30a763(_0x387963[_0x3da2('0xe')][_0x3da2('0x10')]);}else{logger['info'](_0x3da2('0xb'),_0xb191a6,'request\x20sent');_0x30a763(_0x387963[_0x3da2('0x11')][_0x3da2('0x10')]);}})[_0x3da2('0x12')](function(_0x300e09){logger['error'](_0x3da2('0xb'),_0xb191a6,_0x300e09);_0x5361d4(_0x300e09);});});} \ No newline at end of file +var _0x0ed2=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x0ed2,0x158));var _0x20ed=function(_0x4363f3,_0x54b5b9){_0x4363f3=_0x4363f3-0x0;var _0x417409=_0x0ed2[_0x4363f3];return _0x417409;};'use strict';var _=require(_0x20ed('0x0'));var util=require(_0x20ed('0x1'));var moment=require(_0x20ed('0x2'));var BPromise=require(_0x20ed('0x3'));var rs=require(_0x20ed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20ed('0x5'))['db'];var utils=require(_0x20ed('0x6'));var logger=require(_0x20ed('0x7'))(_0x20ed('0x8'));var config=require(_0x20ed('0x9'));var jayson=require(_0x20ed('0xa'));var client=jayson[_0x20ed('0xb')][_0x20ed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22910b,_0x4556c6,_0x44f297){return new BPromise(function(_0x1d2a48,_0x11d0ed){return client[_0x20ed('0xd')](_0x22910b,_0x44f297)[_0x20ed('0xe')](function(_0x3e365b){logger[_0x20ed('0xf')](_0x20ed('0x10'),_0x4556c6,'request\x20sent');logger['debug'](_0x20ed('0x11'),_0x4556c6,_0x20ed('0x12'),JSON['stringify'](_0x3e365b));if(_0x3e365b[_0x20ed('0x13')]){if(_0x3e365b[_0x20ed('0x13')][_0x20ed('0x14')]===0x1f4){logger[_0x20ed('0x13')](_0x20ed('0x10'),_0x4556c6,_0x3e365b[_0x20ed('0x13')][_0x20ed('0x15')]);return _0x11d0ed(_0x3e365b[_0x20ed('0x13')]['message']);}logger[_0x20ed('0x13')](_0x20ed('0x10'),_0x4556c6,_0x3e365b[_0x20ed('0x13')][_0x20ed('0x15')]);return _0x1d2a48(_0x3e365b[_0x20ed('0x13')][_0x20ed('0x15')]);}else{logger[_0x20ed('0xf')](_0x20ed('0x10'),_0x4556c6,_0x20ed('0x12'));_0x1d2a48(_0x3e365b['result'][_0x20ed('0x15')]);}})[_0x20ed('0x16')](function(_0x3c6fe4){logger['error'](_0x20ed('0x10'),_0x4556c6,_0x3c6fe4);_0x11d0ed(_0x3c6fe4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4ee8c4d..8e47843 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 _0x8ec1=['/:id/clone','put','/:id','update','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post'];(function(_0x42d12d,_0x26d4dc){var _0x8f0a4d=function(_0x37a9a9){while(--_0x37a9a9){_0x42d12d['push'](_0x42d12d['shift']());}};_0x8f0a4d(++_0x26d4dc);}(_0x8ec1,0xad));var _0x18ec=function(_0x4309d9,_0x5b0b57){_0x4309d9=_0x4309d9-0x0;var _0x1af166=_0x8ec1[_0x4309d9];return _0x1af166;};'use strict';var multer=require(_0x18ec('0x0'));var util=require('util');var path=require(_0x18ec('0x1'));var timeout=require(_0x18ec('0x2'));var express=require(_0x18ec('0x3'));var router=express['Router']();var auth=require(_0x18ec('0x4'));var interaction=require(_0x18ec('0x5'));var config=require(_0x18ec('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x18ec('0x7')](),controller[_0x18ec('0x8')]);router[_0x18ec('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x18ec('0xa')]);router[_0x18ec('0x9')](_0x18ec('0xb'),auth['isAuthenticated'](),controller['getSessions']);router[_0x18ec('0x9')](_0x18ec('0xc'),auth[_0x18ec('0x7')](),controller[_0x18ec('0xd')]);router[_0x18ec('0x9')](_0x18ec('0xe'),auth['isAuthenticated'](),timeout(_0x18ec('0xf')),controller[_0x18ec('0x10')]);router['post']('/',auth[_0x18ec('0x7')](),controller[_0x18ec('0x11')]);router[_0x18ec('0x12')](_0x18ec('0x13'),auth[_0x18ec('0x7')](),controller['clone']);router[_0x18ec('0x14')](_0x18ec('0x15'),auth[_0x18ec('0x7')](),controller[_0x18ec('0x16')]);router['delete'](_0x18ec('0x15'),auth[_0x18ec('0x7')](),controller[_0x18ec('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1b1f=['express','Router','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','post','clone','put','update','delete','destroy','exports','multer','util','path'];(function(_0xa1a0bf,_0x5efc8e){var _0x3c90dc=function(_0x2c40b4){while(--_0x2c40b4){_0xa1a0bf['push'](_0xa1a0bf['shift']());}};_0x3c90dc(++_0x5efc8e);}(_0x1b1f,0xed));var _0xf1b1=function(_0x543354,_0x576f92){_0x543354=_0x543354-0x0;var _0x11cec2=_0x1b1f[_0x543354];return _0x11cec2;};'use strict';var multer=require(_0xf1b1('0x0'));var util=require(_0xf1b1('0x1'));var path=require(_0xf1b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1b1('0x3'));var router=express[_0xf1b1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf1b1('0x5'));var controller=require(_0xf1b1('0x6'));router[_0xf1b1('0x7')]('/',auth[_0xf1b1('0x8')](),controller[_0xf1b1('0x9')]);router[_0xf1b1('0x7')](_0xf1b1('0xa'),auth[_0xf1b1('0x8')](),controller[_0xf1b1('0xb')]);router[_0xf1b1('0x7')](_0xf1b1('0xc'),auth['isAuthenticated'](),controller[_0xf1b1('0xd')]);router[_0xf1b1('0x7')](_0xf1b1('0xe'),auth[_0xf1b1('0x8')](),controller[_0xf1b1('0xf')]);router[_0xf1b1('0x7')](_0xf1b1('0x10'),auth[_0xf1b1('0x8')](),timeout('30s'),controller['getSummary']);router[_0xf1b1('0x11')]('/',auth[_0xf1b1('0x8')](),controller['create']);router[_0xf1b1('0x11')]('/:id/clone',auth[_0xf1b1('0x8')](),controller[_0xf1b1('0x12')]);router[_0xf1b1('0x13')](_0xf1b1('0xa'),auth[_0xf1b1('0x8')](),controller[_0xf1b1('0x14')]);router[_0xf1b1('0x15')]('/:id',auth[_0xf1b1('0x8')](),controller[_0xf1b1('0x16')]);module[_0xf1b1('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 c8cda50..ae83338 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 _0x1843=['exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x1843,0x158));var _0x3184=function(_0x387451,_0xa3964c){_0x387451=_0x387451-0x0;var _0x535de9=_0x1843[_0x387451];return _0x535de9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3184('0x0'));var util=require('util');module[_0x3184('0x1')]={'name':{'type':Sequelize[_0x3184('0x2')],'unique':_0x3184('0x3')},'description':{'type':Sequelize[_0x3184('0x2')]},'formData':{'type':Sequelize[_0x3184('0x4')](_0x3184('0x5')),'set':function(_0x458de3){if(_[_0x3184('0x6')](_0x458de3)){this[_0x3184('0x7')](_0x3184('0x8'),JSON[_0x3184('0x9')](_0x458de3));}else if(_[_0x3184('0xa')](_0x458de3)){this[_0x3184('0x7')](_0x3184('0x8'),_0x458de3);}else{this[_0x3184('0x7')](_0x3184('0x8'),util['format'](_0x3184('0xb'),this[_0x3184('0xc')](_0x3184('0x3'))||'',this[_0x3184('0xc')](_0x3184('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3184('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3184('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x3060=['isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','name','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x3060,0x1a5));var _0x0306=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0x3060[_0xab9f3d];return _0x5283bf;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0306('0x0'));var util=require(_0x0306('0x1'));module[_0x0306('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x0306('0x3')},'description':{'type':Sequelize[_0x0306('0x4')]},'formData':{'type':Sequelize[_0x0306('0x5')](_0x0306('0x6')),'set':function(_0x385174){if(_[_0x0306('0x7')](_0x385174)){this[_0x0306('0x8')](_0x0306('0x9'),JSON[_0x0306('0xa')](_0x385174));}else if(_[_0x0306('0xb')](_0x385174)){this[_0x0306('0x8')]('formData',_0x385174);}else{this[_0x0306('0x8')](_0x0306('0x9'),util['format'](_0x0306('0xc'),this[_0x0306('0xd')]('name')||'',this[_0x0306('0xd')](_0x0306('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0306('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 5c2e69a..3006999 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 _0x6c07=['createdAt','updatedAt','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','order','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','Projects','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','UserProfileResource','clone','params','omit'];(function(_0x43f8cc,_0x592b95){var _0x1c8808=function(_0x352bf9){while(--_0x352bf9){_0x43f8cc['push'](_0x43f8cc['shift']());}};_0x1c8808(++_0x592b95);}(_0x6c07,0x177));var _0x76c0=function(_0x7517c,_0xd951b8){_0x7517c=_0x7517c-0x0;var _0x38c23c=_0x6c07[_0x7517c];return _0x38c23c;};'use strict';var pdf=require(_0x76c0('0x0'));var emlformat=require(_0x76c0('0x1'));var rimraf=require(_0x76c0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76c0('0x3'));var rp=require(_0x76c0('0x4'));var moment=require(_0x76c0('0x5'));var BPromise=require(_0x76c0('0x6'));var Mustache=require('mustache');var util=require(_0x76c0('0x7'));var path=require(_0x76c0('0x8'));var sox=require(_0x76c0('0x9'));var csv=require(_0x76c0('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76c0('0xb'));var squel=require(_0x76c0('0xc'));var crypto=require('crypto');var jsforce=require(_0x76c0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x76c0('0xa'));var querystring=require('querystring');var Papa=require(_0x76c0('0xe'));var Redis=require('ioredis');var authService=require(_0x76c0('0xf'));var qs=require(_0x76c0('0x10'));var as=require(_0x76c0('0x11'));var hardwareService=require(_0x76c0('0x12'));var logger=require('../../config/logger')(_0x76c0('0x13'));var utils=require(_0x76c0('0x14'));var config=require('../../config/environment');var db=require(_0x76c0('0x15'))['db'];function respondWithStatusCode(_0x27b2c1,_0x5e90a3){_0x5e90a3=_0x5e90a3||0xcc;return function(_0x29153d){if(_0x29153d){return _0x27b2c1[_0x76c0('0x16')](_0x5e90a3);}return _0x27b2c1[_0x76c0('0x17')](_0x5e90a3)['end']();};}function respondWithResult(_0xccbe17,_0x32ebf7){_0x32ebf7=_0x32ebf7||0xc8;return function(_0x4d3ef8){if(_0x4d3ef8){return _0xccbe17['status'](_0x32ebf7)[_0x76c0('0x18')](_0x4d3ef8);}};}function respondWithFilteredResult(_0x2f275b,_0x434680){return function(_0x1acd29){if(_0x1acd29){var _0x4373de=_0x1acd29[_0x76c0('0x19')],_0x3fe76f=_0x434680[_0x76c0('0x1a')],_0x4431a9=_0x434680[_0x76c0('0x1a')]+_0x434680[_0x76c0('0x1b')],_0x2d2634;if(_0x4431a9>=_0x4373de){_0x4431a9=_0x4373de;_0x2d2634=0xc8;}else{_0x2d2634=0xce;}_0x2f275b[_0x76c0('0x17')](_0x2d2634);return _0x2f275b['set'](_0x76c0('0x1c'),_0x3fe76f+'-'+_0x4431a9+'/'+_0x4373de)[_0x76c0('0x18')](_0x1acd29);}return null;};}function patchUpdates(_0x4c1d51){return function(_0x16acd4){try{jsonpatch[_0x76c0('0x1d')](_0x16acd4,_0x4c1d51,!![]);}catch(_0x4bccf1){return BPromise[_0x76c0('0x1e')](_0x4bccf1);}return _0x16acd4[_0x76c0('0x1f')]();};}function saveUpdates(_0x6bf4d3,_0x2b0756){return function(_0x339c84){if(_0x339c84){return _0x339c84[_0x76c0('0x20')](_0x6bf4d3)[_0x76c0('0x21')](function(_0xbe9532){return _0xbe9532;});}return null;};}function removeEntity(_0x3b6e96,_0x360401){return function(_0x1da160){if(_0x1da160){return _0x1da160['destroy']()[_0x76c0('0x21')](function(){var _0xc63e0a=_0x1da160['get']({'plain':!![]});var _0x37556c=_0x76c0('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x37556c,'resourceId':_0xc63e0a['id']}})[_0x76c0('0x21')](function(){return _0x1da160;});})[_0x76c0('0x21')](function(){_0x3b6e96[_0x76c0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d2097,_0x3c59ab){return function(_0x4e4140){if(!_0x4e4140){_0x2d2097[_0x76c0('0x16')](0x194);}return _0x4e4140;};}function handleError(_0xfbb566,_0x57f9a0){_0x57f9a0=_0x57f9a0||0x1f4;return function(_0x34fabd){logger['error'](_0x34fabd['stack']);if(_0x34fabd[_0x76c0('0x23')]){delete _0x34fabd[_0x76c0('0x23')];}_0xfbb566[_0x76c0('0x17')](_0x57f9a0)[_0x76c0('0x24')](_0x34fabd);};}exports['index']=function(_0x5d4883,_0x319852){var _0x480bfd={},_0xcd8989={},_0x342fe1={'count':0x0,'rows':[]};var _0x205980=_[_0x76c0('0x25')](db[_0x76c0('0x26')][_0x76c0('0x27')],function(_0x41f008){return{'name':_0x41f008[_0x76c0('0x28')],'type':_0x41f008[_0x76c0('0x29')][_0x76c0('0x2a')]};});_0xcd8989[_0x76c0('0x2b')]=_[_0x76c0('0x25')](_0x205980,_0x76c0('0x23'));_0xcd8989['query']=_['keys'](_0x5d4883[_0x76c0('0x2c')]);_0xcd8989[_0x76c0('0x2d')]=_['intersection'](_0xcd8989[_0x76c0('0x2b')],_0xcd8989['query']);_0x480bfd[_0x76c0('0x2e')]=_[_0x76c0('0x2f')](_0xcd8989[_0x76c0('0x2b')],qs['fields'](_0x5d4883[_0x76c0('0x2c')][_0x76c0('0x30')]));_0x480bfd[_0x76c0('0x2e')]=_0x480bfd['attributes'][_0x76c0('0x31')]?_0x480bfd[_0x76c0('0x2e')]:_0xcd8989['model'];if(!_0x5d4883['query'][_0x76c0('0x32')](_0x76c0('0x33'))){_0x480bfd[_0x76c0('0x1b')]=qs['limit'](_0x5d4883[_0x76c0('0x2c')][_0x76c0('0x1b')]);_0x480bfd[_0x76c0('0x1a')]=qs[_0x76c0('0x1a')](_0x5d4883[_0x76c0('0x2c')]['offset']);}_0x480bfd['order']=qs['sort'](_0x5d4883['query'][_0x76c0('0x34')]);_0x480bfd['where']=qs[_0x76c0('0x2d')](_['pick'](_0x5d4883[_0x76c0('0x2c')],_0xcd8989[_0x76c0('0x2d')]),_0x205980);if(_0x5d4883['query'][_0x76c0('0x35')]){_0x480bfd[_0x76c0('0x36')]=_['merge'](_0x480bfd[_0x76c0('0x36')],{'$or':_[_0x76c0('0x25')](_0x205980,function(_0x16dddc){if(_0x16dddc[_0x76c0('0x29')]!=='VIRTUAL'){var _0x538d03={};_0x538d03[_0x16dddc[_0x76c0('0x23')]]={'$like':'%'+_0x5d4883[_0x76c0('0x2c')][_0x76c0('0x35')]+'%'};return _0x538d03;}})});}_0x480bfd=_[_0x76c0('0x37')]({},_0x480bfd,_0x5d4883[_0x76c0('0x38')]);var _0x316ec2={'where':_0x480bfd[_0x76c0('0x36')]};return db[_0x76c0('0x26')][_0x76c0('0x19')](_0x316ec2)['then'](function(_0x1cbb19){_0x342fe1[_0x76c0('0x19')]=_0x1cbb19;if(_0x5d4883[_0x76c0('0x2c')][_0x76c0('0x39')]){_0x480bfd[_0x76c0('0x3a')]=[{'all':!![]}];}return db[_0x76c0('0x26')][_0x76c0('0x3b')](_0x480bfd);})['then'](function(_0x2a40cb){_0x342fe1[_0x76c0('0x3c')]=_0x2a40cb;return _0x342fe1;})[_0x76c0('0x21')](respondWithFilteredResult(_0x319852,_0x480bfd))[_0x76c0('0x3d')](handleError(_0x319852,null));};exports[_0x76c0('0x3e')]=function(_0xf704e0,_0x1a9b67){var _0x2bf348={'raw':![],'where':{'id':_0xf704e0['params']['id']}},_0x5a9d6b={};_0x5a9d6b['model']=_[_0x76c0('0x3f')](db[_0x76c0('0x26')][_0x76c0('0x27')]);_0x5a9d6b[_0x76c0('0x2c')]=_['keys'](_0xf704e0[_0x76c0('0x2c')]);_0x5a9d6b[_0x76c0('0x2d')]=_['intersection'](_0x5a9d6b[_0x76c0('0x2b')],_0x5a9d6b[_0x76c0('0x2c')]);_0x2bf348['attributes']=_[_0x76c0('0x2f')](_0x5a9d6b[_0x76c0('0x2b')],qs['fields'](_0xf704e0[_0x76c0('0x2c')][_0x76c0('0x30')]));_0x2bf348[_0x76c0('0x2e')]=_0x2bf348['attributes']['length']?_0x2bf348[_0x76c0('0x2e')]:_0x5a9d6b[_0x76c0('0x2b')];if(_0xf704e0[_0x76c0('0x2c')][_0x76c0('0x39')]){_0x2bf348[_0x76c0('0x3a')]=[{'all':!![]}];}_0x2bf348=_[_0x76c0('0x37')]({},_0x2bf348,_0xf704e0['options']);return db[_0x76c0('0x26')][_0x76c0('0x40')](_0x2bf348)['then'](handleEntityNotFound(_0x1a9b67,null))['then'](respondWithResult(_0x1a9b67,null))[_0x76c0('0x3d')](handleError(_0x1a9b67,null));};exports[_0x76c0('0x41')]=function(_0x164f2c,_0x18252e){return db[_0x76c0('0x26')][_0x76c0('0x41')](_0x164f2c[_0x76c0('0x42')],{})['then'](function(_0xf09c51){var _0x45ece0=_0x164f2c[_0x76c0('0x43')]['get']({'plain':!![]});if(!_0x45ece0)throw new Error(_0x76c0('0x44'));if(_0x45ece0[_0x76c0('0x45')]===_0x76c0('0x43')){var _0x5317f7=_0xf09c51[_0x76c0('0x46')]({'plain':!![]});var _0x318ab5=_0x76c0('0x22');return db[_0x76c0('0x47')][_0x76c0('0x40')]({'where':{'name':_0x318ab5,'userProfileId':_0x45ece0[_0x76c0('0x48')]},'raw':!![]})[_0x76c0('0x21')](function(_0xe9d9ff){if(_0xe9d9ff&&_0xe9d9ff['autoAssociation']===0x0){return db[_0x76c0('0x49')][_0x76c0('0x41')]({'name':_0x5317f7[_0x76c0('0x23')],'resourceId':_0x5317f7['id'],'type':_0xe9d9ff[_0x76c0('0x23')],'sectionId':_0xe9d9ff['id']},{})[_0x76c0('0x21')](function(){return _0xf09c51;});}else{return _0xf09c51;}})[_0x76c0('0x3d')](function(_0x152b32){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x152b32);throw _0x152b32;});}return _0xf09c51;})[_0x76c0('0x21')](respondWithResult(_0x18252e,0xc9))[_0x76c0('0x3d')](handleError(_0x18252e,null));};exports[_0x76c0('0x4a')]=function(_0x3390dc,_0x16327a){var _0x59c29b={'where':{'id':_0x3390dc[_0x76c0('0x4b')]['id']}},_0x4122fc={};_0x4122fc[_0x76c0('0x2b')]=_[_0x76c0('0x3f')](db[_0x76c0('0x26')][_0x76c0('0x27')]);_0x59c29b[_0x76c0('0x2e')]=_['intersection'](_0x4122fc[_0x76c0('0x2b')],qs[_0x76c0('0x30')](_0x3390dc[_0x76c0('0x2c')][_0x76c0('0x30')]));_0x59c29b[_0x76c0('0x2e')]=_0x59c29b['attributes'][_0x76c0('0x31')]?_0x59c29b[_0x76c0('0x2e')]:_0x4122fc[_0x76c0('0x2b')];if(_0x3390dc[_0x76c0('0x2c')]['includeAll']){_0x59c29b[_0x76c0('0x3a')]=[{'all':!![]}];}_0x59c29b=_['merge']({},_0x59c29b,_0x3390dc[_0x76c0('0x38')]);return db[_0x76c0('0x26')]['find'](_0x59c29b)['then'](handleEntityNotFound(_0x16327a,null))[_0x76c0('0x21')](function(_0x13abcd){if(_0x13abcd){var _0x373543=_0x13abcd[_0x76c0('0x46')]({'plain':!![]});_0x373543=qs[_0x76c0('0x4c')](_0x373543,['id',_0x76c0('0x4d'),_0x76c0('0x4e')]);_0x3390dc[_0x76c0('0x42')]=_['omit'](_0x3390dc['body'],['id',_0x76c0('0x4d'),_0x76c0('0x4e')]);return db['JscriptyProject'][_0x76c0('0x41')](_['merge'](_0x373543,_0x3390dc[_0x76c0('0x42')]),{'include':_0x3390dc['query'][_0x76c0('0x39')]?[{'all':!![]}]:undefined})[_0x76c0('0x21')](function(_0x1b914d){var _0xe527be=_0x3390dc[_0x76c0('0x43')]['get']({'plain':!![]});if(!_0xe527be)throw new Error(_0x76c0('0x44'));if(_0xe527be['role']==='user'){var _0x18366d=_0x1b914d[_0x76c0('0x46')]({'plain':!![]});var _0x502c6f=_0x76c0('0x22');return db[_0x76c0('0x47')]['find']({'where':{'name':_0x502c6f,'userProfileId':_0xe527be[_0x76c0('0x48')]},'raw':!![]})['then'](function(_0x5ae68c){if(_0x5ae68c&&_0x5ae68c[_0x76c0('0x4f')]===0x0){return db[_0x76c0('0x49')]['create']({'name':_0x18366d[_0x76c0('0x23')],'resourceId':_0x18366d['id'],'type':_0x5ae68c[_0x76c0('0x23')],'sectionId':_0x5ae68c['id']},{})[_0x76c0('0x21')](function(){return _0x1b914d;});}else{return _0x1b914d;}})[_0x76c0('0x3d')](function(_0x192157){logger[_0x76c0('0x50')](_0x76c0('0x51'),_0x192157);throw _0x192157;});}return _0x1b914d;});}})[_0x76c0('0x21')](respondWithResult(_0x16327a,0xc9))['catch'](handleError(_0x16327a,null));};exports[_0x76c0('0x20')]=function(_0xcbdffe,_0xe88a79){if(_0xcbdffe[_0x76c0('0x42')]['id']){delete _0xcbdffe[_0x76c0('0x42')]['id'];}return db[_0x76c0('0x26')]['find']({'where':{'id':_0xcbdffe['params']['id']}})[_0x76c0('0x21')](handleEntityNotFound(_0xe88a79,null))[_0x76c0('0x21')](saveUpdates(_0xcbdffe[_0x76c0('0x42')],null))[_0x76c0('0x21')](respondWithResult(_0xe88a79,null))[_0x76c0('0x3d')](handleError(_0xe88a79,null));};exports['destroy']=function(_0x3ef76e,_0x58fe88){return db[_0x76c0('0x26')][_0x76c0('0x40')]({'where':{'id':_0x3ef76e['params']['id']}})[_0x76c0('0x21')](handleEntityNotFound(_0x58fe88,null))[_0x76c0('0x21')](removeEntity(_0x58fe88,null))[_0x76c0('0x3d')](handleError(_0x58fe88,null));};exports[_0x76c0('0x52')]=function(_0x355cb1,_0x5cb517,_0x3a6257){var _0x68ff3a={'raw':!![],'where':{}};var _0x1b29e2={};var _0x2b07dd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x76c0('0x53')]({'where':{'id':_0x355cb1[_0x76c0('0x4b')]['id']}})[_0x76c0('0x21')](handleEntityNotFound(_0x5cb517,null))[_0x76c0('0x21')](function(_0x58ac51){if(_0x58ac51){_0x1b29e2[_0x76c0('0x2b')]=_[_0x76c0('0x3f')](db[_0x76c0('0x54')][_0x76c0('0x27')]);_0x1b29e2[_0x76c0('0x2c')]=_[_0x76c0('0x3f')](_0x355cb1[_0x76c0('0x2c')]);_0x1b29e2[_0x76c0('0x2d')]=_[_0x76c0('0x2f')](_0x1b29e2[_0x76c0('0x2b')],_0x1b29e2[_0x76c0('0x2c')]);_0x68ff3a[_0x76c0('0x2e')]=_[_0x76c0('0x2f')](_0x1b29e2['model'],qs[_0x76c0('0x30')](_0x355cb1[_0x76c0('0x2c')][_0x76c0('0x30')]));_0x68ff3a[_0x76c0('0x2e')]=_0x68ff3a[_0x76c0('0x2e')][_0x76c0('0x31')]?_0x68ff3a[_0x76c0('0x2e')]:_0x1b29e2[_0x76c0('0x2b')];if(!_0x355cb1[_0x76c0('0x2c')][_0x76c0('0x32')](_0x76c0('0x33'))){_0x68ff3a[_0x76c0('0x1b')]=qs[_0x76c0('0x1b')](_0x355cb1[_0x76c0('0x2c')]['limit']);_0x68ff3a[_0x76c0('0x1a')]=qs[_0x76c0('0x1a')](_0x355cb1[_0x76c0('0x2c')][_0x76c0('0x1a')]);}_0x68ff3a[_0x76c0('0x55')]=qs[_0x76c0('0x34')](_0x355cb1[_0x76c0('0x2c')][_0x76c0('0x34')]);_0x68ff3a[_0x76c0('0x36')]=qs[_0x76c0('0x2d')](_[_0x76c0('0x56')](_0x355cb1[_0x76c0('0x2c')],_0x1b29e2[_0x76c0('0x2d')]));_0x68ff3a[_0x76c0('0x36')][_0x76c0('0x57')]=_0x58ac51['id'];if(_0x355cb1[_0x76c0('0x2c')][_0x76c0('0x35')]){_0x68ff3a['where']=_['merge'](_0x68ff3a[_0x76c0('0x36')],{'$or':_[_0x76c0('0x25')](_0x68ff3a[_0x76c0('0x2e')],function(_0xc77e01){var _0x597497={};_0x597497[_0xc77e01]={'$like':'%'+_0x355cb1[_0x76c0('0x2c')][_0x76c0('0x35')]+'%'};return _0x597497;})});}_0x68ff3a=_[_0x76c0('0x37')]({},_0x68ff3a,_0x355cb1[_0x76c0('0x38')]);return db[_0x76c0('0x54')][_0x76c0('0x19')]({'where':_0x68ff3a[_0x76c0('0x36')]})[_0x76c0('0x21')](function(_0x24a9b2){_0x2b07dd[_0x76c0('0x19')]=_0x24a9b2;if(_0x355cb1[_0x76c0('0x2c')]['includeAll']){_0x68ff3a[_0x76c0('0x3a')]=[{'all':!![]}];}return db[_0x76c0('0x54')][_0x76c0('0x3b')](_0x68ff3a);})[_0x76c0('0x21')](function(_0x474fd2){_0x2b07dd['rows']=_0x474fd2;return _0x2b07dd;});}})[_0x76c0('0x21')](respondWithFilteredResult(_0x5cb517,_0x68ff3a))[_0x76c0('0x3d')](handleError(_0x5cb517,null));};exports[_0x76c0('0x58')]=function(_0x207fd3,_0x154a2a,_0x9d8c72){var _0x49ca3f={'raw':!![],'where':{}};var _0x1f2edb={};var _0x1e164d={'count':0x0,'rows':[]};return db[_0x76c0('0x26')]['findOne']({'where':{'id':_0x207fd3[_0x76c0('0x4b')]['id']}})[_0x76c0('0x21')](handleEntityNotFound(_0x154a2a,null))['then'](function(_0x8f2e7a){if(_0x8f2e7a){_0x1f2edb[_0x76c0('0x2b')]=_[_0x76c0('0x3f')](db[_0x76c0('0x59')][_0x76c0('0x27')]);_0x1f2edb['query']=_[_0x76c0('0x3f')](_0x207fd3['query']);_0x1f2edb[_0x76c0('0x2d')]=_['intersection'](_0x1f2edb[_0x76c0('0x2b')],_0x1f2edb[_0x76c0('0x2c')]);_0x49ca3f[_0x76c0('0x2e')]=_[_0x76c0('0x2f')](_0x1f2edb[_0x76c0('0x2b')],qs[_0x76c0('0x30')](_0x207fd3['query']['fields']));_0x49ca3f[_0x76c0('0x2e')]=_0x49ca3f[_0x76c0('0x2e')][_0x76c0('0x31')]?_0x49ca3f[_0x76c0('0x2e')]:_0x1f2edb[_0x76c0('0x2b')];if(!_0x207fd3['query'][_0x76c0('0x32')](_0x76c0('0x33'))){_0x49ca3f[_0x76c0('0x1b')]=qs[_0x76c0('0x1b')](_0x207fd3[_0x76c0('0x2c')][_0x76c0('0x1b')]);_0x49ca3f[_0x76c0('0x1a')]=qs['offset'](_0x207fd3['query']['offset']);}_0x49ca3f[_0x76c0('0x55')]=qs['sort'](_0x207fd3['query'][_0x76c0('0x34')]);_0x49ca3f[_0x76c0('0x36')]=qs[_0x76c0('0x2d')](_[_0x76c0('0x56')](_0x207fd3[_0x76c0('0x2c')],_0x1f2edb[_0x76c0('0x2d')]));_0x49ca3f[_0x76c0('0x36')]['ProjectId']=_0x8f2e7a['id'];if(_0x207fd3['query']['filter']){_0x49ca3f['where']=_[_0x76c0('0x37')](_0x49ca3f[_0x76c0('0x36')],{'$or':_['map'](_0x49ca3f[_0x76c0('0x2e')],function(_0x26eb32){var _0x2f347d={};_0x2f347d[_0x26eb32]={'$like':'%'+_0x207fd3[_0x76c0('0x2c')]['filter']+'%'};return _0x2f347d;})});}_0x49ca3f=_[_0x76c0('0x37')]({},_0x49ca3f,_0x207fd3['options']);return db[_0x76c0('0x59')]['count']({'where':_0x49ca3f[_0x76c0('0x36')]})[_0x76c0('0x21')](function(_0x4ca6b5){_0x1e164d['count']=_0x4ca6b5;if(_0x207fd3[_0x76c0('0x2c')][_0x76c0('0x39')]){_0x49ca3f[_0x76c0('0x3a')]=[{'all':!![]}];}return db[_0x76c0('0x59')][_0x76c0('0x3b')](_0x49ca3f);})[_0x76c0('0x21')](function(_0x27c75a){_0x1e164d[_0x76c0('0x3c')]=_0x27c75a;return _0x1e164d;});}})['then'](respondWithFilteredResult(_0x154a2a,_0x49ca3f))[_0x76c0('0x3d')](handleError(_0x154a2a,null));};function char(_0x1b41ca){return _0x76c0('0x5a')===typeof _0x1b41ca?String['fromCharCode'][_0x76c0('0x1d')](null,arguments):_0x1b41ca;}function needsEncapsulation(_0x403589){return!!_0x403589&&(_0x403589[_0x76c0('0x5b')]()[_0x76c0('0x5c')](char(0xd))>=0x0||_0x403589[_0x76c0('0x5b')]()[_0x76c0('0x5c')](char(0xa))>=0x0||_0x403589[_0x76c0('0x5b')]()[_0x76c0('0x5c')](char(0x2c))>=0x0||_0x403589['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x588fa0){var _0x4b1105=char(0x22),_0x1ffa08='\x5c'+char(0x22),_0xd0f56e=_0x588fa0[_0x76c0('0x5b')]()[_0x76c0('0x5d')](new RegExp(_0x4b1105,'g'),_0x1ffa08);return _0x4b1105+_0xd0f56e+_0x4b1105;}exports[_0x76c0('0x5e')]=function(_0x2e2d6d,_0x3ded7a,_0x4e3be2){var _0x3f8584,_0x1cca17;var _0xae1922={'where':{'ProjectId':_0x2e2d6d[_0x76c0('0x4b')]['id']}};if(_0x2e2d6d[_0x76c0('0x2c')][_0x76c0('0x5f')]){_0xae1922['where'][_0x76c0('0x60')]=JSON[_0x76c0('0x61')](_0x2e2d6d[_0x76c0('0x2c')][_0x76c0('0x5f')]);}return db[_0x76c0('0x54')][_0x76c0('0x3b')](_0xae1922)[_0x76c0('0x21')](handleEntityNotFound(_0x3ded7a,null))[_0x76c0('0x21')](function(_0x111cca){if(_0x111cca){_0x3f8584=_0x111cca;return db[_0x76c0('0x62')]['findAll']({'where':{'SessionId':{'$in':_[_0x76c0('0x25')](_0x3f8584,'id')},'ProjectId':_0x2e2d6d[_0x76c0('0x4b')]['id']},'order':_0x76c0('0x63')});}})['then'](handleEntityNotFound(_0x3ded7a,null))[_0x76c0('0x21')](function(_0x22b5dc){if(_0x22b5dc){_0x1cca17=_0x22b5dc;var _0x14b72e={};for(var _0x52ae65=0x0,_0x4901f5=_0x1cca17[_0x76c0('0x31')];_0x52ae65<_0x4901f5;_0x52ae65++){if(!_0x14b72e[_0x76c0('0x32')](_0x1cca17[_0x52ae65][_0x76c0('0x64')])){_0x14b72e[_0x1cca17[_0x52ae65]['questionId']]=needsEncapsulation(_0x1cca17[_0x52ae65]['question'])?encapsulate(_0x1cca17[_0x52ae65][_0x76c0('0x65')]):_0x1cca17[_0x52ae65][_0x76c0('0x65')];}}var _0x4de9dc=[],_0x362620={};for(var _0x3aa37c=0x0,_0x41f5fa=_0x3f8584['length'];_0x3aa37c<_0x41f5fa;_0x3aa37c++){_0x362620={'ProjectId':_0x2e2d6d['params']['id'],'SessionId':_0x3f8584[_0x3aa37c]['id'],'StartTime':moment(_0x3f8584[_0x3aa37c][_0x76c0('0x60')])[_0x76c0('0x66')](_0x76c0('0x67'))};for(var _0xafe231=0x0,_0x2b26c8=_0x1cca17[_0x76c0('0x31')];_0xafe231<_0x2b26c8;_0xafe231++){if(_0x1cca17[_0xafe231]['SessionId']==_0x3f8584[_0x3aa37c]['id']&&_0x14b72e['hasOwnProperty'](_0x1cca17[_0xafe231][_0x76c0('0x64')])){_0x362620[_0x14b72e[_0x1cca17[_0xafe231][_0x76c0('0x64')]]]=_0x1cca17[_0xafe231][_0x76c0('0x68')];}}for(var _0x23ee72 in _0x14b72e){if(!_0x362620[_0x76c0('0x32')](_0x14b72e[_0x23ee72])){_0x362620[_0x14b72e[_0x23ee72]]=null;}}_0x4de9dc['push'](_0x362620);}return _0x4de9dc;}})['then'](function(_0x53e9b5){if(!_[_0x76c0('0x69')](_0x53e9b5)){var _0x2a1aee=toCsv(_0x53e9b5);var _0x196f2b=Date[_0x76c0('0x6a')]();fs[_0x76c0('0x6b')](util[_0x76c0('0x66')](_0x76c0('0x6c'),_0x2e2d6d[_0x76c0('0x4b')]['id'],_0x196f2b),_0x2a1aee);_0x3ded7a[_0x76c0('0x6d')](_0x76c0('0x6e'),_0x76c0('0x6f')+util[_0x76c0('0x66')]('Jscripty_Project_%d_Summary_%s.csv',_0x2e2d6d[_0x76c0('0x4b')]['id'],_0x196f2b));_0x3ded7a[_0x76c0('0x6d')]('Content-type','text/csv');return _0x3ded7a[_0x76c0('0x70')](util[_0x76c0('0x66')](_0x76c0('0x6c'),_0x2e2d6d[_0x76c0('0x4b')]['id'],_0x196f2b));}else{return _0x3ded7a[_0x76c0('0x16')](0xcc);}})['catch'](handleError(_0x3ded7a,null));}; \ No newline at end of file +var _0x0918=['SessionId','answer','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','save','update','then','destroy','Projects','UserProfileResource','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','UserProfileSection','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','starttime','parse','startTime','-createdAt','questionId','question','format'];(function(_0x38d951,_0x41db27){var _0x54d2fb=function(_0x1440d6){while(--_0x1440d6){_0x38d951['push'](_0x38d951['shift']());}};_0x54d2fb(++_0x41db27);}(_0x0918,0x1d4));var _0x8091=function(_0x53c93a,_0x27c349){_0x53c93a=_0x53c93a-0x0;var _0x2ff35e=_0x0918[_0x53c93a];return _0x2ff35e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8091('0x0'));var rimraf=require(_0x8091('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8091('0x2'));var rp=require(_0x8091('0x3'));var moment=require(_0x8091('0x4'));var BPromise=require(_0x8091('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8091('0x6'));var sox=require(_0x8091('0x7'));var csv=require(_0x8091('0x8'));var ejs=require(_0x8091('0x9'));var fs=require('fs');var _=require(_0x8091('0xa'));var squel=require(_0x8091('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8091('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8091('0xd'));var Papa=require(_0x8091('0xe'));var Redis=require(_0x8091('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8091('0x10'));var as=require(_0x8091('0x11'));var hardwareService=require(_0x8091('0x12'));var logger=require(_0x8091('0x13'))(_0x8091('0x14'));var utils=require(_0x8091('0x15'));var config=require(_0x8091('0x16'));var db=require(_0x8091('0x17'))['db'];function respondWithStatusCode(_0x3c286a,_0x44bc03){_0x44bc03=_0x44bc03||0xcc;return function(_0x24cb7b){if(_0x24cb7b){return _0x3c286a[_0x8091('0x18')](_0x44bc03);}return _0x3c286a['status'](_0x44bc03)[_0x8091('0x19')]();};}function respondWithResult(_0x4075e6,_0x5d007f){_0x5d007f=_0x5d007f||0xc8;return function(_0x48bd30){if(_0x48bd30){return _0x4075e6[_0x8091('0x1a')](_0x5d007f)[_0x8091('0x1b')](_0x48bd30);}};}function respondWithFilteredResult(_0x5094fc,_0x250e59){return function(_0x222ec6){if(_0x222ec6){var _0x1989e=_0x222ec6['count'],_0x4b4808=_0x250e59[_0x8091('0x1c')],_0x15ab40=_0x250e59['offset']+_0x250e59['limit'],_0x74101d;if(_0x15ab40>=_0x1989e){_0x15ab40=_0x1989e;_0x74101d=0xc8;}else{_0x74101d=0xce;}_0x5094fc['status'](_0x74101d);return _0x5094fc['set']('Content-Range',_0x4b4808+'-'+_0x15ab40+'/'+_0x1989e)[_0x8091('0x1b')](_0x222ec6);}return null;};}function patchUpdates(_0x47d451){return function(_0x59bb64){try{jsonpatch['apply'](_0x59bb64,_0x47d451,!![]);}catch(_0x3eadec){return BPromise['reject'](_0x3eadec);}return _0x59bb64[_0x8091('0x1d')]();};}function saveUpdates(_0x14c366,_0x35ce90){return function(_0x5dc607){if(_0x5dc607){return _0x5dc607[_0x8091('0x1e')](_0x14c366)[_0x8091('0x1f')](function(_0x2b1536){return _0x2b1536;});}return null;};}function removeEntity(_0x3d7577,_0x5650a0){return function(_0x5a5d47){if(_0x5a5d47){return _0x5a5d47[_0x8091('0x20')]()['then'](function(){var _0x5bcad5=_0x5a5d47['get']({'plain':!![]});var _0x364d42=_0x8091('0x21');return db[_0x8091('0x22')][_0x8091('0x20')]({'where':{'type':_0x364d42,'resourceId':_0x5bcad5['id']}})['then'](function(){return _0x5a5d47;});})[_0x8091('0x1f')](function(){_0x3d7577[_0x8091('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1913b7,_0x473752){return function(_0xa5ef4f){if(!_0xa5ef4f){_0x1913b7['sendStatus'](0x194);}return _0xa5ef4f;};}function handleError(_0x4f9aef,_0x199b8b){_0x199b8b=_0x199b8b||0x1f4;return function(_0xc4e4ec){logger[_0x8091('0x23')](_0xc4e4ec['stack']);if(_0xc4e4ec[_0x8091('0x24')]){delete _0xc4e4ec[_0x8091('0x24')];}_0x4f9aef[_0x8091('0x1a')](_0x199b8b)[_0x8091('0x25')](_0xc4e4ec);};}exports[_0x8091('0x26')]=function(_0x4d65a6,_0x2a0d92){var _0x4be3f1={},_0x1ed8ba={},_0x11d2dd={'count':0x0,'rows':[]};var _0x33d5ac=_[_0x8091('0x27')](db[_0x8091('0x28')][_0x8091('0x29')],function(_0x551e0f){return{'name':_0x551e0f[_0x8091('0x2a')],'type':_0x551e0f[_0x8091('0x2b')]['key']};});_0x1ed8ba[_0x8091('0x2c')]=_[_0x8091('0x27')](_0x33d5ac,_0x8091('0x24'));_0x1ed8ba['query']=_[_0x8091('0x2d')](_0x4d65a6['query']);_0x1ed8ba[_0x8091('0x2e')]=_[_0x8091('0x2f')](_0x1ed8ba[_0x8091('0x2c')],_0x1ed8ba[_0x8091('0x30')]);_0x4be3f1[_0x8091('0x31')]=_[_0x8091('0x2f')](_0x1ed8ba[_0x8091('0x2c')],qs[_0x8091('0x32')](_0x4d65a6[_0x8091('0x30')][_0x8091('0x32')]));_0x4be3f1[_0x8091('0x31')]=_0x4be3f1[_0x8091('0x31')]['length']?_0x4be3f1[_0x8091('0x31')]:_0x1ed8ba[_0x8091('0x2c')];if(!_0x4d65a6['query'][_0x8091('0x33')](_0x8091('0x34'))){_0x4be3f1[_0x8091('0x35')]=qs[_0x8091('0x35')](_0x4d65a6['query']['limit']);_0x4be3f1[_0x8091('0x1c')]=qs[_0x8091('0x1c')](_0x4d65a6[_0x8091('0x30')]['offset']);}_0x4be3f1[_0x8091('0x36')]=qs[_0x8091('0x37')](_0x4d65a6['query'][_0x8091('0x37')]);_0x4be3f1[_0x8091('0x38')]=qs[_0x8091('0x2e')](_[_0x8091('0x39')](_0x4d65a6['query'],_0x1ed8ba[_0x8091('0x2e')]),_0x33d5ac);if(_0x4d65a6[_0x8091('0x30')][_0x8091('0x3a')]){_0x4be3f1['where']=_[_0x8091('0x3b')](_0x4be3f1[_0x8091('0x38')],{'$or':_[_0x8091('0x27')](_0x33d5ac,function(_0x59f0f0){if(_0x59f0f0[_0x8091('0x2b')]!==_0x8091('0x3c')){var _0x21a2c7={};_0x21a2c7[_0x59f0f0[_0x8091('0x24')]]={'$like':'%'+_0x4d65a6[_0x8091('0x30')][_0x8091('0x3a')]+'%'};return _0x21a2c7;}})});}_0x4be3f1=_['merge']({},_0x4be3f1,_0x4d65a6['options']);var _0x327c06={'where':_0x4be3f1[_0x8091('0x38')]};return db[_0x8091('0x28')][_0x8091('0x3d')](_0x327c06)[_0x8091('0x1f')](function(_0x2e0df8){_0x11d2dd[_0x8091('0x3d')]=_0x2e0df8;if(_0x4d65a6[_0x8091('0x30')][_0x8091('0x3e')]){_0x4be3f1[_0x8091('0x3f')]=[{'all':!![]}];}return db[_0x8091('0x28')][_0x8091('0x40')](_0x4be3f1);})[_0x8091('0x1f')](function(_0x1434f1){_0x11d2dd[_0x8091('0x41')]=_0x1434f1;return _0x11d2dd;})[_0x8091('0x1f')](respondWithFilteredResult(_0x2a0d92,_0x4be3f1))[_0x8091('0x42')](handleError(_0x2a0d92,null));};exports['show']=function(_0xa1039a,_0x6e2795){var _0x5415e4={'raw':![],'where':{'id':_0xa1039a[_0x8091('0x43')]['id']}},_0x4a144c={};_0x4a144c[_0x8091('0x2c')]=_[_0x8091('0x2d')](db[_0x8091('0x28')]['rawAttributes']);_0x4a144c[_0x8091('0x30')]=_[_0x8091('0x2d')](_0xa1039a['query']);_0x4a144c['filters']=_[_0x8091('0x2f')](_0x4a144c[_0x8091('0x2c')],_0x4a144c[_0x8091('0x30')]);_0x5415e4['attributes']=_[_0x8091('0x2f')](_0x4a144c[_0x8091('0x2c')],qs['fields'](_0xa1039a['query'][_0x8091('0x32')]));_0x5415e4[_0x8091('0x31')]=_0x5415e4[_0x8091('0x31')][_0x8091('0x44')]?_0x5415e4[_0x8091('0x31')]:_0x4a144c[_0x8091('0x2c')];if(_0xa1039a[_0x8091('0x30')]['includeAll']){_0x5415e4[_0x8091('0x3f')]=[{'all':!![]}];}_0x5415e4=_[_0x8091('0x3b')]({},_0x5415e4,_0xa1039a[_0x8091('0x45')]);return db['JscriptyProject'][_0x8091('0x46')](_0x5415e4)['then'](handleEntityNotFound(_0x6e2795,null))[_0x8091('0x1f')](respondWithResult(_0x6e2795,null))['catch'](handleError(_0x6e2795,null));};exports[_0x8091('0x47')]=function(_0x71fbea,_0x4810e7){return db[_0x8091('0x28')][_0x8091('0x47')](_0x71fbea[_0x8091('0x48')],{})[_0x8091('0x1f')](function(_0x23716f){var _0x6b2026=_0x71fbea[_0x8091('0x49')]['get']({'plain':!![]});if(!_0x6b2026)throw new Error(_0x8091('0x4a'));if(_0x6b2026[_0x8091('0x4b')]==='user'){var _0x530fbd=_0x23716f[_0x8091('0x4c')]({'plain':!![]});var _0x59398f=_0x8091('0x21');return db['UserProfileSection'][_0x8091('0x46')]({'where':{'name':_0x59398f,'userProfileId':_0x6b2026['userProfileId']},'raw':!![]})['then'](function(_0x11366e){if(_0x11366e&&_0x11366e[_0x8091('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x530fbd[_0x8091('0x24')],'resourceId':_0x530fbd['id'],'type':_0x11366e[_0x8091('0x24')],'sectionId':_0x11366e['id']},{})['then'](function(){return _0x23716f;});}else{return _0x23716f;}})['catch'](function(_0x4ebea5){logger[_0x8091('0x23')](_0x8091('0x4e'),_0x4ebea5);throw _0x4ebea5;});}return _0x23716f;})[_0x8091('0x1f')](respondWithResult(_0x4810e7,0xc9))[_0x8091('0x42')](handleError(_0x4810e7,null));};exports[_0x8091('0x4f')]=function(_0x4f8135,_0x49468b){var _0x3a51c8={'where':{'id':_0x4f8135[_0x8091('0x43')]['id']}},_0x48f0fe={};_0x48f0fe[_0x8091('0x2c')]=_[_0x8091('0x2d')](db[_0x8091('0x28')][_0x8091('0x29')]);_0x3a51c8[_0x8091('0x31')]=_[_0x8091('0x2f')](_0x48f0fe['model'],qs['fields'](_0x4f8135[_0x8091('0x30')][_0x8091('0x32')]));_0x3a51c8[_0x8091('0x31')]=_0x3a51c8['attributes'][_0x8091('0x44')]?_0x3a51c8[_0x8091('0x31')]:_0x48f0fe['model'];if(_0x4f8135[_0x8091('0x30')][_0x8091('0x3e')]){_0x3a51c8[_0x8091('0x3f')]=[{'all':!![]}];}_0x3a51c8=_[_0x8091('0x3b')]({},_0x3a51c8,_0x4f8135[_0x8091('0x45')]);return db['JscriptyProject'][_0x8091('0x46')](_0x3a51c8)['then'](handleEntityNotFound(_0x49468b,null))[_0x8091('0x1f')](function(_0x2af4e5){if(_0x2af4e5){var _0xf4026a=_0x2af4e5[_0x8091('0x4c')]({'plain':!![]});_0xf4026a=qs[_0x8091('0x50')](_0xf4026a,['id','createdAt',_0x8091('0x51')]);_0x4f8135[_0x8091('0x48')]=_[_0x8091('0x50')](_0x4f8135[_0x8091('0x48')],['id','createdAt',_0x8091('0x51')]);return db[_0x8091('0x28')][_0x8091('0x47')](_['merge'](_0xf4026a,_0x4f8135[_0x8091('0x48')]),{'include':_0x4f8135['query'][_0x8091('0x3e')]?[{'all':!![]}]:undefined})[_0x8091('0x1f')](function(_0x43f301){var _0x4f5b9c=_0x4f8135['user']['get']({'plain':!![]});if(!_0x4f5b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f5b9c[_0x8091('0x4b')]===_0x8091('0x49')){var _0xccef4e=_0x43f301[_0x8091('0x4c')]({'plain':!![]});var _0x2b2377='Projects';return db[_0x8091('0x52')]['find']({'where':{'name':_0x2b2377,'userProfileId':_0x4f5b9c['userProfileId']},'raw':!![]})[_0x8091('0x1f')](function(_0x190ae5){if(_0x190ae5&&_0x190ae5[_0x8091('0x4d')]===0x0){return db[_0x8091('0x22')][_0x8091('0x47')]({'name':_0xccef4e['name'],'resourceId':_0xccef4e['id'],'type':_0x190ae5[_0x8091('0x24')],'sectionId':_0x190ae5['id']},{})[_0x8091('0x1f')](function(){return _0x43f301;});}else{return _0x43f301;}})[_0x8091('0x42')](function(_0x245b91){logger['error'](_0x8091('0x4e'),_0x245b91);throw _0x245b91;});}return _0x43f301;});}})[_0x8091('0x1f')](respondWithResult(_0x49468b,0xc9))[_0x8091('0x42')](handleError(_0x49468b,null));};exports[_0x8091('0x1e')]=function(_0x569f89,_0x422806){if(_0x569f89['body']['id']){delete _0x569f89[_0x8091('0x48')]['id'];}return db['JscriptyProject'][_0x8091('0x46')]({'where':{'id':_0x569f89[_0x8091('0x43')]['id']}})[_0x8091('0x1f')](handleEntityNotFound(_0x422806,null))[_0x8091('0x1f')](saveUpdates(_0x569f89[_0x8091('0x48')],null))[_0x8091('0x1f')](respondWithResult(_0x422806,null))['catch'](handleError(_0x422806,null));};exports[_0x8091('0x20')]=function(_0xf34c8,_0x398961){return db[_0x8091('0x28')]['find']({'where':{'id':_0xf34c8[_0x8091('0x43')]['id']}})[_0x8091('0x1f')](handleEntityNotFound(_0x398961,null))[_0x8091('0x1f')](removeEntity(_0x398961,null))[_0x8091('0x42')](handleError(_0x398961,null));};exports[_0x8091('0x53')]=function(_0x31b620,_0x4d06c7,_0xbe3d74){var _0x2077d2={'raw':!![],'where':{}};var _0x57f700={};var _0x133ae={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x31b620[_0x8091('0x43')]['id']}})[_0x8091('0x1f')](handleEntityNotFound(_0x4d06c7,null))['then'](function(_0x297be6){if(_0x297be6){_0x57f700['model']=_['keys'](db[_0x8091('0x54')][_0x8091('0x29')]);_0x57f700['query']=_[_0x8091('0x2d')](_0x31b620['query']);_0x57f700['filters']=_['intersection'](_0x57f700['model'],_0x57f700[_0x8091('0x30')]);_0x2077d2[_0x8091('0x31')]=_[_0x8091('0x2f')](_0x57f700['model'],qs[_0x8091('0x32')](_0x31b620[_0x8091('0x30')][_0x8091('0x32')]));_0x2077d2[_0x8091('0x31')]=_0x2077d2[_0x8091('0x31')][_0x8091('0x44')]?_0x2077d2[_0x8091('0x31')]:_0x57f700[_0x8091('0x2c')];if(!_0x31b620['query'][_0x8091('0x33')](_0x8091('0x34'))){_0x2077d2[_0x8091('0x35')]=qs[_0x8091('0x35')](_0x31b620[_0x8091('0x30')][_0x8091('0x35')]);_0x2077d2[_0x8091('0x1c')]=qs[_0x8091('0x1c')](_0x31b620[_0x8091('0x30')]['offset']);}_0x2077d2[_0x8091('0x36')]=qs[_0x8091('0x37')](_0x31b620[_0x8091('0x30')][_0x8091('0x37')]);_0x2077d2['where']=qs['filters'](_[_0x8091('0x39')](_0x31b620[_0x8091('0x30')],_0x57f700[_0x8091('0x2e')]));_0x2077d2['where'][_0x8091('0x55')]=_0x297be6['id'];if(_0x31b620[_0x8091('0x30')]['filter']){_0x2077d2[_0x8091('0x38')]=_['merge'](_0x2077d2[_0x8091('0x38')],{'$or':_[_0x8091('0x27')](_0x2077d2[_0x8091('0x31')],function(_0x1ad697){var _0x298cd7={};_0x298cd7[_0x1ad697]={'$like':'%'+_0x31b620['query']['filter']+'%'};return _0x298cd7;})});}_0x2077d2=_['merge']({},_0x2077d2,_0x31b620[_0x8091('0x45')]);return db[_0x8091('0x54')][_0x8091('0x3d')]({'where':_0x2077d2['where']})[_0x8091('0x1f')](function(_0x3a0e10){_0x133ae[_0x8091('0x3d')]=_0x3a0e10;if(_0x31b620[_0x8091('0x30')][_0x8091('0x3e')]){_0x2077d2[_0x8091('0x3f')]=[{'all':!![]}];}return db[_0x8091('0x54')][_0x8091('0x40')](_0x2077d2);})[_0x8091('0x1f')](function(_0x3ce277){_0x133ae[_0x8091('0x41')]=_0x3ce277;return _0x133ae;});}})[_0x8091('0x1f')](respondWithFilteredResult(_0x4d06c7,_0x2077d2))[_0x8091('0x42')](handleError(_0x4d06c7,null));};exports[_0x8091('0x56')]=function(_0x52b5be,_0x3ee816,_0xf77996){var _0x395d08={'raw':!![],'where':{}};var _0xb2218a={};var _0x267248={'count':0x0,'rows':[]};return db[_0x8091('0x28')][_0x8091('0x57')]({'where':{'id':_0x52b5be['params']['id']}})[_0x8091('0x1f')](handleEntityNotFound(_0x3ee816,null))[_0x8091('0x1f')](function(_0x4f40a7){if(_0x4f40a7){_0xb2218a['model']=_[_0x8091('0x2d')](db[_0x8091('0x58')][_0x8091('0x29')]);_0xb2218a[_0x8091('0x30')]=_['keys'](_0x52b5be['query']);_0xb2218a[_0x8091('0x2e')]=_[_0x8091('0x2f')](_0xb2218a[_0x8091('0x2c')],_0xb2218a[_0x8091('0x30')]);_0x395d08[_0x8091('0x31')]=_[_0x8091('0x2f')](_0xb2218a[_0x8091('0x2c')],qs[_0x8091('0x32')](_0x52b5be[_0x8091('0x30')][_0x8091('0x32')]));_0x395d08[_0x8091('0x31')]=_0x395d08[_0x8091('0x31')]['length']?_0x395d08[_0x8091('0x31')]:_0xb2218a['model'];if(!_0x52b5be[_0x8091('0x30')][_0x8091('0x33')]('nolimit')){_0x395d08['limit']=qs[_0x8091('0x35')](_0x52b5be[_0x8091('0x30')][_0x8091('0x35')]);_0x395d08[_0x8091('0x1c')]=qs[_0x8091('0x1c')](_0x52b5be[_0x8091('0x30')][_0x8091('0x1c')]);}_0x395d08[_0x8091('0x36')]=qs[_0x8091('0x37')](_0x52b5be['query'][_0x8091('0x37')]);_0x395d08[_0x8091('0x38')]=qs[_0x8091('0x2e')](_[_0x8091('0x39')](_0x52b5be['query'],_0xb2218a[_0x8091('0x2e')]));_0x395d08['where'][_0x8091('0x55')]=_0x4f40a7['id'];if(_0x52b5be[_0x8091('0x30')][_0x8091('0x3a')]){_0x395d08[_0x8091('0x38')]=_[_0x8091('0x3b')](_0x395d08[_0x8091('0x38')],{'$or':_['map'](_0x395d08[_0x8091('0x31')],function(_0x161df4){var _0x22fbf4={};_0x22fbf4[_0x161df4]={'$like':'%'+_0x52b5be[_0x8091('0x30')][_0x8091('0x3a')]+'%'};return _0x22fbf4;})});}_0x395d08=_['merge']({},_0x395d08,_0x52b5be[_0x8091('0x45')]);return db[_0x8091('0x58')]['count']({'where':_0x395d08[_0x8091('0x38')]})[_0x8091('0x1f')](function(_0x4dce36){_0x267248[_0x8091('0x3d')]=_0x4dce36;if(_0x52b5be[_0x8091('0x30')][_0x8091('0x3e')]){_0x395d08[_0x8091('0x3f')]=[{'all':!![]}];}return db[_0x8091('0x58')][_0x8091('0x40')](_0x395d08);})['then'](function(_0x30b8a7){_0x267248[_0x8091('0x41')]=_0x30b8a7;return _0x267248;});}})['then'](respondWithFilteredResult(_0x3ee816,_0x395d08))[_0x8091('0x42')](handleError(_0x3ee816,null));};function char(_0x3b5d2e){return _0x8091('0x59')===typeof _0x3b5d2e?String[_0x8091('0x5a')][_0x8091('0x5b')](null,arguments):_0x3b5d2e;}function needsEncapsulation(_0x496271){return!!_0x496271&&(_0x496271[_0x8091('0x5c')]()[_0x8091('0x5d')](char(0xd))>=0x0||_0x496271['toString']()[_0x8091('0x5d')](char(0xa))>=0x0||_0x496271[_0x8091('0x5c')]()[_0x8091('0x5d')](char(0x2c))>=0x0||_0x496271[_0x8091('0x5c')]()[_0x8091('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x392094){var _0x29a779=char(0x22),_0x162204='\x5c'+char(0x22),_0x433d74=_0x392094['toString']()[_0x8091('0x5e')](new RegExp(_0x29a779,'g'),_0x162204);return _0x29a779+_0x433d74+_0x29a779;}exports['getSummary']=function(_0x15405c,_0x31b1a8,_0x15f3f5){var _0x2ee866,_0x422434;var _0x574d93={'where':{'ProjectId':_0x15405c[_0x8091('0x43')]['id']}};if(_0x15405c[_0x8091('0x30')]['startTime']){_0x574d93[_0x8091('0x38')][_0x8091('0x5f')]=JSON[_0x8091('0x60')](_0x15405c[_0x8091('0x30')][_0x8091('0x61')]);}return db['JscriptySessionReport']['findAll'](_0x574d93)['then'](handleEntityNotFound(_0x31b1a8,null))['then'](function(_0x333ca4){if(_0x333ca4){_0x2ee866=_0x333ca4;return db['JscriptyQuestionReport'][_0x8091('0x40')]({'where':{'SessionId':{'$in':_[_0x8091('0x27')](_0x2ee866,'id')},'ProjectId':_0x15405c[_0x8091('0x43')]['id']},'order':_0x8091('0x62')});}})[_0x8091('0x1f')](handleEntityNotFound(_0x31b1a8,null))['then'](function(_0x1876d){if(_0x1876d){_0x422434=_0x1876d;var _0x1acf5b={};for(var _0x2477f8=0x0,_0x2484e5=_0x422434['length'];_0x2477f8<_0x2484e5;_0x2477f8++){if(!_0x1acf5b[_0x8091('0x33')](_0x422434[_0x2477f8][_0x8091('0x63')])){_0x1acf5b[_0x422434[_0x2477f8][_0x8091('0x63')]]=needsEncapsulation(_0x422434[_0x2477f8]['question'])?encapsulate(_0x422434[_0x2477f8][_0x8091('0x64')]):_0x422434[_0x2477f8]['question'];}}var _0x5efc52=[],_0x4d6e4c={};for(var _0x1e74c2=0x0,_0x5a0578=_0x2ee866[_0x8091('0x44')];_0x1e74c2<_0x5a0578;_0x1e74c2++){_0x4d6e4c={'ProjectId':_0x15405c[_0x8091('0x43')]['id'],'SessionId':_0x2ee866[_0x1e74c2]['id'],'StartTime':moment(_0x2ee866[_0x1e74c2]['starttime'])[_0x8091('0x65')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x13659f=0x0,_0x3c74fb=_0x422434[_0x8091('0x44')];_0x13659f<_0x3c74fb;_0x13659f++){if(_0x422434[_0x13659f][_0x8091('0x66')]==_0x2ee866[_0x1e74c2]['id']&&_0x1acf5b[_0x8091('0x33')](_0x422434[_0x13659f]['questionId'])){_0x4d6e4c[_0x1acf5b[_0x422434[_0x13659f][_0x8091('0x63')]]]=_0x422434[_0x13659f][_0x8091('0x67')];}}for(var _0x3a4714 in _0x1acf5b){if(!_0x4d6e4c[_0x8091('0x33')](_0x1acf5b[_0x3a4714])){_0x4d6e4c[_0x1acf5b[_0x3a4714]]=null;}}_0x5efc52['push'](_0x4d6e4c);}return _0x5efc52;}})[_0x8091('0x1f')](function(_0x10f7ef){if(!_[_0x8091('0x68')](_0x10f7ef)){var _0x4aa564=toCsv(_0x10f7ef);var _0x4e9c30=Date[_0x8091('0x69')]();fs[_0x8091('0x6a')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x15405c[_0x8091('0x43')]['id'],_0x4e9c30),_0x4aa564);_0x31b1a8[_0x8091('0x6b')](_0x8091('0x6c'),_0x8091('0x6d')+util[_0x8091('0x65')](_0x8091('0x6e'),_0x15405c[_0x8091('0x43')]['id'],_0x4e9c30));_0x31b1a8[_0x8091('0x6b')](_0x8091('0x6f'),'text/csv');return _0x31b1a8[_0x8091('0x70')](util['format'](_0x8091('0x71'),_0x15405c[_0x8091('0x43')]['id'],_0x4e9c30));}else{return _0x31b1a8[_0x8091('0x18')](0xcc);}})['catch'](handleError(_0x31b1a8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f6645f8..6d12c96 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 _0x6d04=['api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','../../config/logger'];(function(_0x43e097,_0x33e351){var _0x1bb782=function(_0xf9992){while(--_0xf9992){_0x43e097['push'](_0x43e097['shift']());}};_0x1bb782(++_0x33e351);}(_0x6d04,0x113));var _0x46d0=function(_0x540c3d,_0xe787c3){_0x540c3d=_0x540c3d-0x0;var _0x4470e8=_0x6d04[_0x540c3d];return _0x4470e8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x46d0('0x0'))(_0x46d0('0x1'));var moment=require(_0x46d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x46d0('0x3'));var fs=require('fs');var path=require(_0x46d0('0x4'));var rimraf=require(_0x46d0('0x5'));var config=require(_0x46d0('0x6'));var attributes=require(_0x46d0('0x7'));module[_0x46d0('0x8')]=function(_0x30a18c,_0x1fd7b8){return _0x30a18c[_0x46d0('0x9')](_0x46d0('0xa'),attributes,{'tableName':_0x46d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe836=['exports','define','JscriptyProject','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0xc3e090,_0x1cf44f){var _0x4275ad=function(_0x17fd59){while(--_0x17fd59){_0xc3e090['push'](_0xc3e090['shift']());}};_0x4275ad(++_0x1cf44f);}(_0xe836,0x87));var _0x6e83=function(_0x4a1bba,_0x152487){_0x4a1bba=_0x4a1bba-0x0;var _0x52dc0b=_0xe836[_0x4a1bba];return _0x52dc0b;};'use strict';var _=require(_0x6e83('0x0'));var util=require(_0x6e83('0x1'));var logger=require('../../config/logger')(_0x6e83('0x2'));var moment=require(_0x6e83('0x3'));var BPromise=require(_0x6e83('0x4'));var rp=require(_0x6e83('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e83('0x6'));var config=require(_0x6e83('0x7'));var attributes=require(_0x6e83('0x8'));module[_0x6e83('0x9')]=function(_0x40bef9,_0x184a78){return _0x40bef9[_0x6e83('0xa')](_0x6e83('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index a54d578..7769838 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 _0x7dd6=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyProject,\x20%s,\x20%s','message'];(function(_0x3adb5a,_0x594b73){var _0x164bdf=function(_0x3912ca){while(--_0x3912ca){_0x3adb5a['push'](_0x3adb5a['shift']());}};_0x164bdf(++_0x594b73);}(_0x7dd6,0xbe));var _0x67dd=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x7dd6[_0x9d639c];return _0x1671de;};'use strict';var _=require(_0x67dd('0x0'));var util=require(_0x67dd('0x1'));var moment=require(_0x67dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67dd('0x3'));var db=require(_0x67dd('0x4'))['db'];var utils=require(_0x67dd('0x5'));var logger=require(_0x67dd('0x6'))(_0x67dd('0x7'));var config=require('../../config/environment');var jayson=require(_0x67dd('0x8'));var client=jayson[_0x67dd('0x9')][_0x67dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d7629,_0x2c3cee,_0x29a7f){return new BPromise(function(_0xd1df93,_0x4fef6a){return client['request'](_0x3d7629,_0x29a7f)[_0x67dd('0xb')](function(_0x3c206f){logger[_0x67dd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x2c3cee,_0x67dd('0xd'));logger[_0x67dd('0xe')](_0x67dd('0xf'),_0x2c3cee,_0x67dd('0xd'),JSON[_0x67dd('0x10')](_0x3c206f));if(_0x3c206f['error']){if(_0x3c206f[_0x67dd('0x11')]['code']===0x1f4){logger[_0x67dd('0x11')](_0x67dd('0x12'),_0x2c3cee,_0x3c206f[_0x67dd('0x11')][_0x67dd('0x13')]);return _0x4fef6a(_0x3c206f['error'][_0x67dd('0x13')]);}logger[_0x67dd('0x11')](_0x67dd('0x12'),_0x2c3cee,_0x3c206f['error'][_0x67dd('0x13')]);return _0xd1df93(_0x3c206f[_0x67dd('0x11')][_0x67dd('0x13')]);}else{logger[_0x67dd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x2c3cee,_0x67dd('0xd'));_0xd1df93(_0x3c206f['result'][_0x67dd('0x13')]);}})[_0x67dd('0x14')](function(_0xe8dd48){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x2c3cee,_0xe8dd48);_0x4fef6a(_0xe8dd48);});});} \ No newline at end of file +var _0xafbf=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then'];(function(_0x10a718,_0x5f4287){var _0x240a89=function(_0x5c833d){while(--_0x5c833d){_0x10a718['push'](_0x10a718['shift']());}};_0x240a89(++_0x5f4287);}(_0xafbf,0x149));var _0xfafb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xafbf[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xfafb('0x0'));var util=require('util');var moment=require(_0xfafb('0x1'));var BPromise=require(_0xfafb('0x2'));var rs=require(_0xfafb('0x3'));var fs=require('fs');var Redis=require(_0xfafb('0x4'));var db=require(_0xfafb('0x5'))['db'];var utils=require(_0xfafb('0x6'));var logger=require('../../config/logger')(_0xfafb('0x7'));var config=require(_0xfafb('0x8'));var jayson=require(_0xfafb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x235892,_0x4fbda8,_0xed648e){return new BPromise(function(_0x44e2a6,_0x23ec8e){return client['request'](_0x235892,_0xed648e)[_0xfafb('0xa')](function(_0x4a3ed3){logger['info'](_0xfafb('0xb'),_0x4fbda8,_0xfafb('0xc'));logger[_0xfafb('0xd')](_0xfafb('0xe'),_0x4fbda8,_0xfafb('0xc'),JSON[_0xfafb('0xf')](_0x4a3ed3));if(_0x4a3ed3['error']){if(_0x4a3ed3[_0xfafb('0x10')][_0xfafb('0x11')]===0x1f4){logger[_0xfafb('0x10')](_0xfafb('0xb'),_0x4fbda8,_0x4a3ed3[_0xfafb('0x10')]['message']);return _0x23ec8e(_0x4a3ed3[_0xfafb('0x10')]['message']);}logger[_0xfafb('0x10')](_0xfafb('0xb'),_0x4fbda8,_0x4a3ed3[_0xfafb('0x10')][_0xfafb('0x12')]);return _0x44e2a6(_0x4a3ed3['error']['message']);}else{logger['info'](_0xfafb('0xb'),_0x4fbda8,_0xfafb('0xc'));_0x44e2a6(_0x4a3ed3['result'][_0xfafb('0x12')]);}})[_0xfafb('0x13')](function(_0x5463f9){logger[_0xfafb('0x10')](_0xfafb('0xb'),_0x4fbda8,_0x5463f9);_0x23ec8e(_0x5463f9);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index eecb3a9..61af9f1 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 _0xab14=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','post','put','/:id','delete','destroy','exports','multer'];(function(_0x2133a3,_0x41288c){var _0x4e0b16=function(_0x43c4f5){while(--_0x43c4f5){_0x2133a3['push'](_0x2133a3['shift']());}};_0x4e0b16(++_0x41288c);}(_0xab14,0x65));var _0x4ab1=function(_0xe83cf4,_0x1cd033){_0xe83cf4=_0xe83cf4-0x0;var _0x1d9966=_0xab14[_0xe83cf4];return _0x1d9966;};'use strict';var multer=require(_0x4ab1('0x0'));var util=require(_0x4ab1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4ab1('0x2')]();var auth=require(_0x4ab1('0x3'));var interaction=require(_0x4ab1('0x4'));var config=require(_0x4ab1('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0x4ab1('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4ab1('0x7'),auth[_0x4ab1('0x8')](),controller[_0x4ab1('0x9')]);router[_0x4ab1('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4ab1('0xa')]);router[_0x4ab1('0xb')]('/',auth[_0x4ab1('0x8')](),controller['create']);router[_0x4ab1('0xc')](_0x4ab1('0xd'),auth[_0x4ab1('0x8')](),controller['update']);router[_0x4ab1('0xe')]('/:id',auth[_0x4ab1('0x8')](),controller[_0x4ab1('0xf')]);module[_0x4ab1('0x10')]=router; \ No newline at end of file +var _0x0cf3=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x4823a2,_0x227df4){var _0x311071=function(_0x1b30c6){while(--_0x1b30c6){_0x4823a2['push'](_0x4823a2['shift']());}};_0x311071(++_0x227df4);}(_0x0cf3,0x1b5));var _0x30cf=function(_0x464591,_0x48aefa){_0x464591=_0x464591-0x0;var _0x21ea9b=_0x0cf3[_0x464591];return _0x21ea9b;};'use strict';var multer=require(_0x30cf('0x0'));var util=require(_0x30cf('0x1'));var path=require(_0x30cf('0x2'));var timeout=require(_0x30cf('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x30cf('0x4'));var interaction=require(_0x30cf('0x5'));var config=require(_0x30cf('0x6'));var controller=require(_0x30cf('0x7'));router['get']('/',auth[_0x30cf('0x8')](),controller[_0x30cf('0x9')]);router[_0x30cf('0xa')]('/describe',auth[_0x30cf('0x8')](),controller['describe']);router[_0x30cf('0xa')](_0x30cf('0xb'),auth[_0x30cf('0x8')](),controller['show']);router[_0x30cf('0xc')]('/',auth['isAuthenticated'](),controller[_0x30cf('0xd')]);router[_0x30cf('0xe')](_0x30cf('0xb'),auth[_0x30cf('0x8')](),controller[_0x30cf('0xf')]);router[_0x30cf('0x10')](_0x30cf('0xb'),auth[_0x30cf('0x8')](),controller[_0x30cf('0x11')]);module[_0x30cf('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 1c9500f..3dd8808 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 _0x1109=['exports','TEXT','long','STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1109,0x108));var _0x9110=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x1109[_0x1895b7];return _0x1aecdc;};'use strict';var Sequelize=require(_0x9110('0x0'));module[_0x9110('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x9110('0x2')](_0x9110('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x9110('0x4')]},'queue':{'type':Sequelize[_0x9110('0x4')]},'uniqueid':{'type':Sequelize[_0x9110('0x4')]},'calleridname':{'type':Sequelize[_0x9110('0x4')]},'calleridnum':{'type':Sequelize[_0x9110('0x4')]},'questionId':{'type':Sequelize[_0x9110('0x4')]}}; \ No newline at end of file +var _0xa7bf=['long','sequelize','exports','STRING'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xa7bf,0x131));var _0xfa7b=function(_0x497cc6,_0x2c3c08){_0x497cc6=_0x497cc6-0x0;var _0x1107d3=_0xa7bf[_0x497cc6];return _0x1107d3;};'use strict';var Sequelize=require(_0xfa7b('0x0'));module[_0xfa7b('0x1')]={'question':{'type':Sequelize[_0xfa7b('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xfa7b('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xfa7b('0x2')]},'queue':{'type':Sequelize[_0xfa7b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfa7b('0x2')]},'calleridnum':{'type':Sequelize[_0xfa7b('0x2')]},'questionId':{'type':Sequelize[_0xfa7b('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 59626c0..023ee2c 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 _0x9bc1=['map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','end','error','name'];(function(_0xa06a61,_0x3237c4){var _0xd541b9=function(_0x24b4a2){while(--_0x24b4a2){_0xa06a61['push'](_0xa06a61['shift']());}};_0xd541b9(++_0x3237c4);}(_0x9bc1,0xaa));var _0x19bc=function(_0x2514ec,_0x51e1c2){_0x2514ec=_0x2514ec-0x0;var _0x4a4ec3=_0x9bc1[_0x2514ec];return _0x4a4ec3;};'use strict';var pdf=require(_0x19bc('0x0'));var emlformat=require(_0x19bc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x19bc('0x2'));var rp=require(_0x19bc('0x3'));var moment=require('moment');var BPromise=require(_0x19bc('0x4'));var Mustache=require(_0x19bc('0x5'));var util=require(_0x19bc('0x6'));var path=require(_0x19bc('0x7'));var sox=require(_0x19bc('0x8'));var csv=require(_0x19bc('0x9'));var ejs=require(_0x19bc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x19bc('0xb'));var deskjs=require(_0x19bc('0xc'));var toCsv=require(_0x19bc('0x9'));var querystring=require(_0x19bc('0xd'));var Papa=require(_0x19bc('0xe'));var Redis=require(_0x19bc('0xf'));var authService=require(_0x19bc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x19bc('0x11'))(_0x19bc('0x12'));var utils=require('../../config/utils');var config=require(_0x19bc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x326812,_0x27661d){_0x27661d=_0x27661d||0xcc;return function(_0x34d429){if(_0x34d429){return _0x326812[_0x19bc('0x14')](_0x27661d);}return _0x326812[_0x19bc('0x15')](_0x27661d)['end']();};}function respondWithResult(_0x6ded34,_0x1c259a){_0x1c259a=_0x1c259a||0xc8;return function(_0x3f1dd7){if(_0x3f1dd7){return _0x6ded34[_0x19bc('0x15')](_0x1c259a)[_0x19bc('0x16')](_0x3f1dd7);}};}function respondWithFilteredResult(_0x29fb80,_0x545838){return function(_0x1a5579){if(_0x1a5579){var _0x5b3ce7=_0x1a5579[_0x19bc('0x17')],_0x28e695=_0x545838[_0x19bc('0x18')],_0x46e8d0=_0x545838['offset']+_0x545838[_0x19bc('0x19')],_0x519ad1;if(_0x46e8d0>=_0x5b3ce7){_0x46e8d0=_0x5b3ce7;_0x519ad1=0xc8;}else{_0x519ad1=0xce;}_0x29fb80[_0x19bc('0x15')](_0x519ad1);return _0x29fb80[_0x19bc('0x1a')]('Content-Range',_0x28e695+'-'+_0x46e8d0+'/'+_0x5b3ce7)['json'](_0x1a5579);}return null;};}function patchUpdates(_0x319b16){return function(_0x338419){try{jsonpatch[_0x19bc('0x1b')](_0x338419,_0x319b16,!![]);}catch(_0x37e32e){return BPromise[_0x19bc('0x1c')](_0x37e32e);}return _0x338419['save']();};}function saveUpdates(_0x39a742,_0x2a5f8a){return function(_0x13feea){if(_0x13feea){return _0x13feea[_0x19bc('0x1d')](_0x39a742)[_0x19bc('0x1e')](function(_0x3b3373){return _0x3b3373;});}return null;};}function removeEntity(_0x388ac7,_0x447403){return function(_0x5be446){if(_0x5be446){return _0x5be446['destroy']()[_0x19bc('0x1e')](function(){_0x388ac7[_0x19bc('0x15')](0xcc)[_0x19bc('0x1f')]();});}};}function handleEntityNotFound(_0x51dc28,_0x28daac){return function(_0x1c5922){if(!_0x1c5922){_0x51dc28['sendStatus'](0x194);}return _0x1c5922;};}function handleError(_0x40a860,_0x21546f){_0x21546f=_0x21546f||0x1f4;return function(_0x1f0e27){logger[_0x19bc('0x20')](_0x1f0e27['stack']);if(_0x1f0e27[_0x19bc('0x21')]){delete _0x1f0e27[_0x19bc('0x21')];}_0x40a860[_0x19bc('0x15')](_0x21546f)['send'](_0x1f0e27);};}exports['index']=function(_0x3d5f62,_0x308798){var _0x57d44f={},_0x484f2c={},_0x3f2a79={'count':0x0,'rows':[]};var _0x2067c9=_[_0x19bc('0x22')](db[_0x19bc('0x23')][_0x19bc('0x24')],function(_0xe959e){return{'name':_0xe959e[_0x19bc('0x25')],'type':_0xe959e['type'][_0x19bc('0x26')]};});_0x484f2c['model']=_[_0x19bc('0x22')](_0x2067c9,'name');_0x484f2c[_0x19bc('0x27')]=_['keys'](_0x3d5f62['query']);_0x484f2c[_0x19bc('0x28')]=_[_0x19bc('0x29')](_0x484f2c['model'],_0x484f2c[_0x19bc('0x27')]);_0x57d44f['attributes']=_[_0x19bc('0x29')](_0x484f2c[_0x19bc('0x2a')],qs['fields'](_0x3d5f62[_0x19bc('0x27')][_0x19bc('0x2b')]));_0x57d44f[_0x19bc('0x2c')]=_0x57d44f['attributes'][_0x19bc('0x2d')]?_0x57d44f[_0x19bc('0x2c')]:_0x484f2c['model'];if(!_0x3d5f62[_0x19bc('0x27')][_0x19bc('0x2e')](_0x19bc('0x2f'))){_0x57d44f[_0x19bc('0x19')]=qs['limit'](_0x3d5f62['query'][_0x19bc('0x19')]);_0x57d44f['offset']=qs[_0x19bc('0x18')](_0x3d5f62['query'][_0x19bc('0x18')]);}_0x57d44f['order']=qs[_0x19bc('0x30')](_0x3d5f62[_0x19bc('0x27')][_0x19bc('0x30')]);_0x57d44f[_0x19bc('0x31')]=qs[_0x19bc('0x28')](_['pick'](_0x3d5f62[_0x19bc('0x27')],_0x484f2c[_0x19bc('0x28')]),_0x2067c9);if(_0x3d5f62['query'][_0x19bc('0x32')]){_0x57d44f[_0x19bc('0x31')]=_['merge'](_0x57d44f[_0x19bc('0x31')],{'$or':_[_0x19bc('0x22')](_0x2067c9,function(_0x51a3a6){if(_0x51a3a6[_0x19bc('0x33')]!==_0x19bc('0x34')){var _0x35204e={};_0x35204e[_0x51a3a6['name']]={'$like':'%'+_0x3d5f62['query']['filter']+'%'};return _0x35204e;}})});}_0x57d44f=_['merge']({},_0x57d44f,_0x3d5f62['options']);var _0x9fbb2e={'where':_0x57d44f[_0x19bc('0x31')]};return db['JscriptyQuestionReport'][_0x19bc('0x17')](_0x9fbb2e)[_0x19bc('0x1e')](function(_0x525da7){_0x3f2a79[_0x19bc('0x17')]=_0x525da7;if(_0x3d5f62[_0x19bc('0x27')][_0x19bc('0x35')]){_0x57d44f[_0x19bc('0x36')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x19bc('0x37')](_0x57d44f);})[_0x19bc('0x1e')](function(_0x1fd22f){_0x3f2a79[_0x19bc('0x38')]=_0x1fd22f;return _0x3f2a79;})[_0x19bc('0x1e')](respondWithFilteredResult(_0x308798,_0x57d44f))[_0x19bc('0x39')](handleError(_0x308798,null));};exports[_0x19bc('0x3a')]=function(_0x5eb98f,_0x2231d8){var _0x1dcf87={'raw':!![],'where':{'id':_0x5eb98f[_0x19bc('0x3b')]['id']}},_0x2c07d4={};_0x2c07d4[_0x19bc('0x2a')]=_[_0x19bc('0x3c')](db[_0x19bc('0x23')]['rawAttributes']);_0x2c07d4['query']=_[_0x19bc('0x3c')](_0x5eb98f[_0x19bc('0x27')]);_0x2c07d4[_0x19bc('0x28')]=_[_0x19bc('0x29')](_0x2c07d4[_0x19bc('0x2a')],_0x2c07d4[_0x19bc('0x27')]);_0x1dcf87[_0x19bc('0x2c')]=_[_0x19bc('0x29')](_0x2c07d4[_0x19bc('0x2a')],qs['fields'](_0x5eb98f[_0x19bc('0x27')][_0x19bc('0x2b')]));_0x1dcf87[_0x19bc('0x2c')]=_0x1dcf87[_0x19bc('0x2c')][_0x19bc('0x2d')]?_0x1dcf87[_0x19bc('0x2c')]:_0x2c07d4[_0x19bc('0x2a')];if(_0x5eb98f[_0x19bc('0x27')][_0x19bc('0x35')]){_0x1dcf87[_0x19bc('0x36')]=[{'all':!![]}];}_0x1dcf87=_[_0x19bc('0x3d')]({},_0x1dcf87,_0x5eb98f[_0x19bc('0x3e')]);return db[_0x19bc('0x23')][_0x19bc('0x3f')](_0x1dcf87)[_0x19bc('0x1e')](handleEntityNotFound(_0x2231d8,null))['then'](respondWithResult(_0x2231d8,null))[_0x19bc('0x39')](handleError(_0x2231d8,null));};exports[_0x19bc('0x40')]=function(_0x13b0f3,_0x22ac13){return db[_0x19bc('0x23')][_0x19bc('0x40')](_0x13b0f3[_0x19bc('0x41')],{})[_0x19bc('0x1e')](respondWithResult(_0x22ac13,0xc9))[_0x19bc('0x39')](handleError(_0x22ac13,null));};exports[_0x19bc('0x1d')]=function(_0x1a6cd5,_0x52354e){if(_0x1a6cd5[_0x19bc('0x41')]['id']){delete _0x1a6cd5[_0x19bc('0x41')]['id'];}return db['JscriptyQuestionReport'][_0x19bc('0x3f')]({'where':{'id':_0x1a6cd5[_0x19bc('0x3b')]['id']}})[_0x19bc('0x1e')](handleEntityNotFound(_0x52354e,null))[_0x19bc('0x1e')](saveUpdates(_0x1a6cd5[_0x19bc('0x41')],null))[_0x19bc('0x1e')](respondWithResult(_0x52354e,null))['catch'](handleError(_0x52354e,null));};exports[_0x19bc('0x42')]=function(_0x2d5f74,_0x49702e){return db[_0x19bc('0x23')]['find']({'where':{'id':_0x2d5f74['params']['id']}})[_0x19bc('0x1e')](handleEntityNotFound(_0x49702e,null))['then'](removeEntity(_0x49702e,null))[_0x19bc('0x39')](handleError(_0x49702e,null));};exports[_0x19bc('0x43')]=function(_0x53301e,_0x29cc80){return db[_0x19bc('0x23')][_0x19bc('0x43')]()[_0x19bc('0x1e')](respondWithResult(_0x29cc80,null))[_0x19bc('0x39')](handleError(_0x29cc80,null));}; \ No newline at end of file +var _0x193a=['util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x305b9d,_0x1215c1){var _0x802c35=function(_0x42d262){while(--_0x42d262){_0x305b9d['push'](_0x305b9d['shift']());}};_0x802c35(++_0x1215c1);}(_0x193a,0x11d));var _0xa193=function(_0x1bf3cf,_0x437ed6){_0x1bf3cf=_0x1bf3cf-0x0;var _0x2056b0=_0x193a[_0x1bf3cf];return _0x2056b0;};'use strict';var pdf=require(_0xa193('0x0'));var emlformat=require(_0xa193('0x1'));var rimraf=require(_0xa193('0x2'));var zipdir=require(_0xa193('0x3'));var jsonpatch=require(_0xa193('0x4'));var rp=require('request-promise');var moment=require(_0xa193('0x5'));var BPromise=require(_0xa193('0x6'));var Mustache=require('mustache');var util=require(_0xa193('0x7'));var path=require(_0xa193('0x8'));var sox=require(_0xa193('0x9'));var csv=require('to-csv');var ejs=require(_0xa193('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa193('0xb'));var jsforce=require(_0xa193('0xc'));var deskjs=require(_0xa193('0xd'));var toCsv=require(_0xa193('0xe'));var querystring=require(_0xa193('0xf'));var Papa=require(_0xa193('0x10'));var Redis=require(_0xa193('0x11'));var authService=require(_0xa193('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa193('0x13'));var hardwareService=require(_0xa193('0x14'));var logger=require(_0xa193('0x15'))(_0xa193('0x16'));var utils=require(_0xa193('0x17'));var config=require(_0xa193('0x18'));var db=require(_0xa193('0x19'))['db'];function respondWithStatusCode(_0x128a94,_0x5ae8ba){_0x5ae8ba=_0x5ae8ba||0xcc;return function(_0x3c3b66){if(_0x3c3b66){return _0x128a94[_0xa193('0x1a')](_0x5ae8ba);}return _0x128a94[_0xa193('0x1b')](_0x5ae8ba)[_0xa193('0x1c')]();};}function respondWithResult(_0x769ea9,_0x1802f9){_0x1802f9=_0x1802f9||0xc8;return function(_0x544856){if(_0x544856){return _0x769ea9['status'](_0x1802f9)['json'](_0x544856);}};}function respondWithFilteredResult(_0x97c6fa,_0x395d40){return function(_0x18e50b){if(_0x18e50b){var _0x5348a3=_0x18e50b[_0xa193('0x1d')],_0x3c1dfc=_0x395d40[_0xa193('0x1e')],_0x10581b=_0x395d40[_0xa193('0x1e')]+_0x395d40[_0xa193('0x1f')],_0x553ce5;if(_0x10581b>=_0x5348a3){_0x10581b=_0x5348a3;_0x553ce5=0xc8;}else{_0x553ce5=0xce;}_0x97c6fa[_0xa193('0x1b')](_0x553ce5);return _0x97c6fa[_0xa193('0x20')](_0xa193('0x21'),_0x3c1dfc+'-'+_0x10581b+'/'+_0x5348a3)['json'](_0x18e50b);}return null;};}function patchUpdates(_0x40298d){return function(_0xda4f3b){try{jsonpatch[_0xa193('0x22')](_0xda4f3b,_0x40298d,!![]);}catch(_0x171775){return BPromise[_0xa193('0x23')](_0x171775);}return _0xda4f3b['save']();};}function saveUpdates(_0x41acec,_0x26993b){return function(_0x3f2999){if(_0x3f2999){return _0x3f2999[_0xa193('0x24')](_0x41acec)[_0xa193('0x25')](function(_0x40abfc){return _0x40abfc;});}return null;};}function removeEntity(_0x8b4fa4,_0x38563a){return function(_0x3af9b0){if(_0x3af9b0){return _0x3af9b0[_0xa193('0x26')]()[_0xa193('0x25')](function(){_0x8b4fa4['status'](0xcc)[_0xa193('0x1c')]();});}};}function handleEntityNotFound(_0x3a1cdf,_0xee03ad){return function(_0x363ea7){if(!_0x363ea7){_0x3a1cdf[_0xa193('0x1a')](0x194);}return _0x363ea7;};}function handleError(_0x109661,_0x4e55a7){_0x4e55a7=_0x4e55a7||0x1f4;return function(_0x4aca52){logger[_0xa193('0x27')](_0x4aca52[_0xa193('0x28')]);if(_0x4aca52['name']){delete _0x4aca52[_0xa193('0x29')];}_0x109661[_0xa193('0x1b')](_0x4e55a7)[_0xa193('0x2a')](_0x4aca52);};}exports['index']=function(_0x585a98,_0x88e67a){var _0x2595be={},_0x5ec7e2={},_0x11ca83={'count':0x0,'rows':[]};var _0x1f7609=_[_0xa193('0x2b')](db[_0xa193('0x2c')][_0xa193('0x2d')],function(_0x489f05){return{'name':_0x489f05['fieldName'],'type':_0x489f05['type'][_0xa193('0x2e')]};});_0x5ec7e2[_0xa193('0x2f')]=_[_0xa193('0x2b')](_0x1f7609,_0xa193('0x29'));_0x5ec7e2[_0xa193('0x30')]=_[_0xa193('0x31')](_0x585a98['query']);_0x5ec7e2[_0xa193('0x32')]=_[_0xa193('0x33')](_0x5ec7e2['model'],_0x5ec7e2[_0xa193('0x30')]);_0x2595be[_0xa193('0x34')]=_['intersection'](_0x5ec7e2[_0xa193('0x2f')],qs['fields'](_0x585a98[_0xa193('0x30')][_0xa193('0x35')]));_0x2595be[_0xa193('0x34')]=_0x2595be['attributes'][_0xa193('0x36')]?_0x2595be[_0xa193('0x34')]:_0x5ec7e2[_0xa193('0x2f')];if(!_0x585a98[_0xa193('0x30')][_0xa193('0x37')](_0xa193('0x38'))){_0x2595be[_0xa193('0x1f')]=qs[_0xa193('0x1f')](_0x585a98[_0xa193('0x30')][_0xa193('0x1f')]);_0x2595be[_0xa193('0x1e')]=qs[_0xa193('0x1e')](_0x585a98[_0xa193('0x30')][_0xa193('0x1e')]);}_0x2595be['order']=qs[_0xa193('0x39')](_0x585a98[_0xa193('0x30')][_0xa193('0x39')]);_0x2595be[_0xa193('0x3a')]=qs[_0xa193('0x32')](_[_0xa193('0x3b')](_0x585a98[_0xa193('0x30')],_0x5ec7e2[_0xa193('0x32')]),_0x1f7609);if(_0x585a98[_0xa193('0x30')][_0xa193('0x3c')]){_0x2595be[_0xa193('0x3a')]=_['merge'](_0x2595be['where'],{'$or':_['map'](_0x1f7609,function(_0x51d981){if(_0x51d981['type']!==_0xa193('0x3d')){var _0x39c7d1={};_0x39c7d1[_0x51d981[_0xa193('0x29')]]={'$like':'%'+_0x585a98['query'][_0xa193('0x3c')]+'%'};return _0x39c7d1;}})});}_0x2595be=_[_0xa193('0x3e')]({},_0x2595be,_0x585a98[_0xa193('0x3f')]);var _0x4b6224={'where':_0x2595be[_0xa193('0x3a')]};return db[_0xa193('0x2c')][_0xa193('0x1d')](_0x4b6224)['then'](function(_0x29397b){_0x11ca83['count']=_0x29397b;if(_0x585a98[_0xa193('0x30')][_0xa193('0x40')]){_0x2595be[_0xa193('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x2595be);})[_0xa193('0x25')](function(_0x4e05b4){_0x11ca83['rows']=_0x4e05b4;return _0x11ca83;})[_0xa193('0x25')](respondWithFilteredResult(_0x88e67a,_0x2595be))[_0xa193('0x42')](handleError(_0x88e67a,null));};exports[_0xa193('0x43')]=function(_0x5b7ed2,_0x4b026a){var _0xdf7e95={'raw':!![],'where':{'id':_0x5b7ed2[_0xa193('0x44')]['id']}},_0x1cd2eb={};_0x1cd2eb[_0xa193('0x2f')]=_['keys'](db[_0xa193('0x2c')][_0xa193('0x2d')]);_0x1cd2eb[_0xa193('0x30')]=_[_0xa193('0x31')](_0x5b7ed2['query']);_0x1cd2eb[_0xa193('0x32')]=_[_0xa193('0x33')](_0x1cd2eb[_0xa193('0x2f')],_0x1cd2eb[_0xa193('0x30')]);_0xdf7e95[_0xa193('0x34')]=_['intersection'](_0x1cd2eb[_0xa193('0x2f')],qs[_0xa193('0x35')](_0x5b7ed2[_0xa193('0x30')][_0xa193('0x35')]));_0xdf7e95[_0xa193('0x34')]=_0xdf7e95[_0xa193('0x34')]['length']?_0xdf7e95[_0xa193('0x34')]:_0x1cd2eb['model'];if(_0x5b7ed2['query'][_0xa193('0x40')]){_0xdf7e95[_0xa193('0x41')]=[{'all':!![]}];}_0xdf7e95=_[_0xa193('0x3e')]({},_0xdf7e95,_0x5b7ed2[_0xa193('0x3f')]);return db['JscriptyQuestionReport'][_0xa193('0x45')](_0xdf7e95)['then'](handleEntityNotFound(_0x4b026a,null))[_0xa193('0x25')](respondWithResult(_0x4b026a,null))[_0xa193('0x42')](handleError(_0x4b026a,null));};exports[_0xa193('0x46')]=function(_0xeceee6,_0x2f3636){return db[_0xa193('0x2c')][_0xa193('0x46')](_0xeceee6[_0xa193('0x47')],{})[_0xa193('0x25')](respondWithResult(_0x2f3636,0xc9))['catch'](handleError(_0x2f3636,null));};exports[_0xa193('0x24')]=function(_0x319bcb,_0x2885dc){if(_0x319bcb[_0xa193('0x47')]['id']){delete _0x319bcb[_0xa193('0x47')]['id'];}return db[_0xa193('0x2c')]['find']({'where':{'id':_0x319bcb[_0xa193('0x44')]['id']}})[_0xa193('0x25')](handleEntityNotFound(_0x2885dc,null))[_0xa193('0x25')](saveUpdates(_0x319bcb[_0xa193('0x47')],null))['then'](respondWithResult(_0x2885dc,null))[_0xa193('0x42')](handleError(_0x2885dc,null));};exports[_0xa193('0x26')]=function(_0x17fbcc,_0x585a5f){return db[_0xa193('0x2c')]['find']({'where':{'id':_0x17fbcc['params']['id']}})['then'](handleEntityNotFound(_0x585a5f,null))[_0xa193('0x25')](removeEntity(_0x585a5f,null))[_0xa193('0x42')](handleError(_0x585a5f,null));};exports['describe']=function(_0x2bb59e,_0x4f33fa){return db[_0xa193('0x2c')][_0xa193('0x48')]()[_0xa193('0x25')](respondWithResult(_0x4f33fa,null))[_0xa193('0x42')](handleError(_0x4f33fa,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 41f5959..64d0532 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 _0x18d1=['../../config/environment','exports','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3ccaec,_0x516788){var _0x4e90a8=function(_0x2a4138){while(--_0x2a4138){_0x3ccaec['push'](_0x3ccaec['shift']());}};_0x4e90a8(++_0x516788);}(_0x18d1,0x16b));var _0x118d=function(_0x108a5c,_0x4eee94){_0x108a5c=_0x108a5c-0x0;var _0x4a8d0b=_0x18d1[_0x108a5c];return _0x4a8d0b;};'use strict';var _=require('lodash');var util=require(_0x118d('0x0'));var logger=require(_0x118d('0x1'))(_0x118d('0x2'));var moment=require(_0x118d('0x3'));var BPromise=require(_0x118d('0x4'));var rp=require(_0x118d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x118d('0x6'));var config=require(_0x118d('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x118d('0x8')]=function(_0x345bc7,_0x25a03e){return _0x345bc7['define']('JscriptyQuestionReport',attributes,{'tableName':_0x118d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc1f=['../../config/logger','api','moment','path','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','util'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0xcc1f,0x1a5));var _0xfcc1=function(_0x175848,_0x8f2d75){_0x175848=_0x175848-0x0;var _0x845b1=_0xcc1f[_0x175848];return _0x845b1;};'use strict';var _=require(_0xfcc1('0x0'));var util=require(_0xfcc1('0x1'));var logger=require(_0xfcc1('0x2'))(_0xfcc1('0x3'));var moment=require(_0xfcc1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcc1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfcc1('0x6'));module['exports']=function(_0x228d0b,_0x3d3186){return _0x228d0b[_0xfcc1('0x7')]('JscriptyQuestionReport',attributes,{'tableName':_0xfcc1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index bfee768..322e97b 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 _0xba41=['jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba41,0x184));var _0x1ba4=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xba41[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require(_0x1ba4('0x0'));var moment=require(_0x1ba4('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ba4('0x2'));var fs=require('fs');var Redis=require(_0x1ba4('0x3'));var db=require(_0x1ba4('0x4'))['db'];var utils=require(_0x1ba4('0x5'));var logger=require(_0x1ba4('0x6'))(_0x1ba4('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ba4('0x8'));var client=jayson['client'][_0x1ba4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fe079,_0x5e93fb,_0x20b3d7){return new BPromise(function(_0x15590c,_0x409444){return client[_0x1ba4('0xa')](_0x1fe079,_0x20b3d7)[_0x1ba4('0xb')](function(_0x2291c3){logger[_0x1ba4('0xc')](_0x1ba4('0xd'),_0x5e93fb,_0x1ba4('0xe'));logger[_0x1ba4('0xf')](_0x1ba4('0x10'),_0x5e93fb,_0x1ba4('0xe'),JSON[_0x1ba4('0x11')](_0x2291c3));if(_0x2291c3['error']){if(_0x2291c3['error'][_0x1ba4('0x12')]===0x1f4){logger[_0x1ba4('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5e93fb,_0x2291c3['error'][_0x1ba4('0x14')]);return _0x409444(_0x2291c3['error'][_0x1ba4('0x14')]);}logger[_0x1ba4('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5e93fb,_0x2291c3['error'][_0x1ba4('0x14')]);return _0x15590c(_0x2291c3['error']['message']);}else{logger[_0x1ba4('0xc')](_0x1ba4('0xd'),_0x5e93fb,'request\x20sent');_0x15590c(_0x2291c3[_0x1ba4('0x15')][_0x1ba4('0x14')]);}})['catch'](function(_0x89890b){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5e93fb,_0x89890b);_0x409444(_0x89890b);});});} \ No newline at end of file +var _0xc670=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc670,0x1c8));var _0x0c67=function(_0x277ac3,_0x28874c){_0x277ac3=_0x277ac3-0x0;var _0x3d9cf5=_0xc670[_0x277ac3];return _0x3d9cf5;};'use strict';var _=require(_0x0c67('0x0'));var util=require(_0x0c67('0x1'));var moment=require(_0x0c67('0x2'));var BPromise=require(_0x0c67('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c67('0x4'));var db=require(_0x0c67('0x5'))['db'];var utils=require(_0x0c67('0x6'));var logger=require(_0x0c67('0x7'))('rpc');var config=require(_0x0c67('0x8'));var jayson=require(_0x0c67('0x9'));var client=jayson[_0x0c67('0xa')][_0x0c67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2395af,_0x10c640,_0x33bdd7){return new BPromise(function(_0x561e8a,_0x585bf1){return client[_0x0c67('0xc')](_0x2395af,_0x33bdd7)[_0x0c67('0xd')](function(_0x1f146c){logger[_0x0c67('0xe')](_0x0c67('0xf'),_0x10c640,_0x0c67('0x10'));logger['debug'](_0x0c67('0x11'),_0x10c640,_0x0c67('0x10'),JSON[_0x0c67('0x12')](_0x1f146c));if(_0x1f146c[_0x0c67('0x13')]){if(_0x1f146c[_0x0c67('0x13')][_0x0c67('0x14')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x10c640,_0x1f146c[_0x0c67('0x13')]['message']);return _0x585bf1(_0x1f146c['error'][_0x0c67('0x15')]);}logger[_0x0c67('0x13')](_0x0c67('0xf'),_0x10c640,_0x1f146c['error'][_0x0c67('0x15')]);return _0x561e8a(_0x1f146c[_0x0c67('0x13')]['message']);}else{logger[_0x0c67('0xe')](_0x0c67('0xf'),_0x10c640,'request\x20sent');_0x561e8a(_0x1f146c[_0x0c67('0x16')][_0x0c67('0x15')]);}})[_0x0c67('0x17')](function(_0xa29eb4){logger[_0x0c67('0x13')](_0x0c67('0xf'),_0x10c640,_0xa29eb4);_0x585bf1(_0xa29eb4);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a909ab2..1e9266c 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 _0x47c7=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','/:id/questions','getQuestions','create','put'];(function(_0x112e02,_0x4bb03b){var _0x1c7a53=function(_0x501695){while(--_0x501695){_0x112e02['push'](_0x112e02['shift']());}};_0x1c7a53(++_0x4bb03b);}(_0x47c7,0x1ab));var _0x747c=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x47c7[_0x3e6729];return _0x535bcd;};'use strict';var multer=require(_0x747c('0x0'));var util=require('util');var path=require(_0x747c('0x1'));var timeout=require(_0x747c('0x2'));var express=require('express');var router=express[_0x747c('0x3')]();var auth=require(_0x747c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x747c('0x5'));var controller=require(_0x747c('0x6'));router[_0x747c('0x7')]('/',auth[_0x747c('0x8')](),controller['index']);router[_0x747c('0x7')]('/describe',auth[_0x747c('0x8')](),controller[_0x747c('0x9')]);router[_0x747c('0x7')](_0x747c('0xa'),auth[_0x747c('0x8')](),controller['show']);router['get'](_0x747c('0xb'),auth[_0x747c('0x8')](),controller[_0x747c('0xc')]);router['post']('/',auth[_0x747c('0x8')](),controller[_0x747c('0xd')]);router[_0x747c('0xe')]('/:id',auth[_0x747c('0x8')](),controller['update']);router['delete'](_0x747c('0xa'),auth[_0x747c('0x8')](),controller[_0x747c('0xf')]);module[_0x747c('0x10')]=router; \ No newline at end of file +var _0x3645=['../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3645,0x154));var _0x5364=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0x3645[_0x4d0df6];return _0x4e2615;};'use strict';var multer=require('multer');var util=require(_0x5364('0x0'));var path=require(_0x5364('0x1'));var timeout=require(_0x5364('0x2'));var express=require(_0x5364('0x3'));var router=express[_0x5364('0x4')]();var auth=require(_0x5364('0x5'));var interaction=require(_0x5364('0x6'));var config=require('../../config/environment');var controller=require(_0x5364('0x7'));router[_0x5364('0x8')]('/',auth[_0x5364('0x9')](),controller[_0x5364('0xa')]);router[_0x5364('0x8')](_0x5364('0xb'),auth[_0x5364('0x9')](),controller[_0x5364('0xc')]);router[_0x5364('0x8')]('/:id',auth[_0x5364('0x9')](),controller[_0x5364('0xd')]);router[_0x5364('0x8')](_0x5364('0xe'),auth[_0x5364('0x9')](),controller[_0x5364('0xf')]);router[_0x5364('0x10')]('/',auth[_0x5364('0x9')](),controller[_0x5364('0x11')]);router[_0x5364('0x12')](_0x5364('0x13'),auth[_0x5364('0x9')](),controller[_0x5364('0x14')]);router['delete'](_0x5364('0x13'),auth[_0x5364('0x9')](),controller[_0x5364('0x15')]);module[_0x5364('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 1c80627..debb827 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 _0xae23=['exports','starttime','setDataValue','endtime','format','DATE','STRING','BOOLEAN','moment'];(function(_0x1dd74a,_0x1e0dd6){var _0x1710af=function(_0x4dc37d){while(--_0x4dc37d){_0x1dd74a['push'](_0x1dd74a['shift']());}};_0x1710af(++_0x1e0dd6);}(_0xae23,0x7d));var _0x3ae2=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xae23[_0x40ac5e];return _0x2839d6;};'use strict';var moment=require(_0x3ae2('0x0'));var Sequelize=require('sequelize');module[_0x3ae2('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x2fa26d){this['setDataValue'](_0x3ae2('0x2'),_0x2fa26d);this[_0x3ae2('0x3')](_0x3ae2('0x4'),moment()[_0x3ae2('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x3ae2('0x6')]},'membername':{'type':Sequelize[_0x3ae2('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3ae2('0x7')]},'calleridname':{'type':Sequelize[_0x3ae2('0x7')]},'calleridnum':{'type':Sequelize[_0x3ae2('0x7')]},'completed':{'type':Sequelize[_0x3ae2('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x49c8=['exports','DATE','setDataValue','endtime','STRING','BOOLEAN','moment','sequelize'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x49c8,0x19e));var _0x849c=function(_0x3116ed,_0x5a69fa){_0x3116ed=_0x3116ed-0x0;var _0x4b46c2=_0x49c8[_0x3116ed];return _0x4b46c2;};'use strict';var moment=require(_0x849c('0x0'));var Sequelize=require(_0x849c('0x1'));module[_0x849c('0x2')]={'starttime':{'type':Sequelize[_0x849c('0x3')],'set':function(_0x2da91a){this[_0x849c('0x4')]('starttime',_0x2da91a);this[_0x849c('0x4')](_0x849c('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x849c('0x3')]},'membername':{'type':Sequelize[_0x849c('0x6')]},'projectname':{'type':Sequelize[_0x849c('0x6')]},'queue':{'type':Sequelize[_0x849c('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x849c('0x6')]},'calleridnum':{'type':Sequelize[_0x849c('0x6')]},'completed':{'type':Sequelize[_0x849c('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 1b2589d..14324df 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 _0x51a3=['save','update','then','destroy','error','send','map','JscriptySessionReport','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','sort','where','pick','filter','VIRTUAL','merge','count','findAll','show','length','include','options','find','catch','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','nolimit','order','rows','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x51a3,0x15f));var _0x351a=function(_0x407679,_0x47bbcd){_0x407679=_0x407679-0x0;var _0x2b5b9e=_0x51a3[_0x407679];return _0x2b5b9e;};'use strict';var pdf=require(_0x351a('0x0'));var emlformat=require(_0x351a('0x1'));var rimraf=require(_0x351a('0x2'));var zipdir=require(_0x351a('0x3'));var jsonpatch=require(_0x351a('0x4'));var rp=require(_0x351a('0x5'));var moment=require(_0x351a('0x6'));var BPromise=require(_0x351a('0x7'));var Mustache=require(_0x351a('0x8'));var util=require(_0x351a('0x9'));var path=require(_0x351a('0xa'));var sox=require(_0x351a('0xb'));var csv=require(_0x351a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x351a('0xd'));var squel=require(_0x351a('0xe'));var crypto=require('crypto');var jsforce=require(_0x351a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x351a('0xc'));var querystring=require(_0x351a('0x10'));var Papa=require(_0x351a('0x11'));var Redis=require(_0x351a('0x12'));var authService=require(_0x351a('0x13'));var qs=require(_0x351a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x351a('0x15'));var logger=require(_0x351a('0x16'))('api');var utils=require(_0x351a('0x17'));var config=require(_0x351a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22a890,_0x45746f){_0x45746f=_0x45746f||0xcc;return function(_0x470678){if(_0x470678){return _0x22a890[_0x351a('0x19')](_0x45746f);}return _0x22a890[_0x351a('0x1a')](_0x45746f)[_0x351a('0x1b')]();};}function respondWithResult(_0x340910,_0xfe3133){_0xfe3133=_0xfe3133||0xc8;return function(_0x427162){if(_0x427162){return _0x340910['status'](_0xfe3133)[_0x351a('0x1c')](_0x427162);}};}function respondWithFilteredResult(_0x2b945f,_0x30adac){return function(_0x48f58b){if(_0x48f58b){var _0x2f2f7f=_0x48f58b['count'],_0x3cfb7a=_0x30adac['offset'],_0x1f03b2=_0x30adac[_0x351a('0x1d')]+_0x30adac[_0x351a('0x1e')],_0x10ef93;if(_0x1f03b2>=_0x2f2f7f){_0x1f03b2=_0x2f2f7f;_0x10ef93=0xc8;}else{_0x10ef93=0xce;}_0x2b945f[_0x351a('0x1a')](_0x10ef93);return _0x2b945f[_0x351a('0x1f')](_0x351a('0x20'),_0x3cfb7a+'-'+_0x1f03b2+'/'+_0x2f2f7f)[_0x351a('0x1c')](_0x48f58b);}return null;};}function patchUpdates(_0x1f7858){return function(_0xd3a0c3){try{jsonpatch[_0x351a('0x21')](_0xd3a0c3,_0x1f7858,!![]);}catch(_0x4edc28){return BPromise['reject'](_0x4edc28);}return _0xd3a0c3[_0x351a('0x22')]();};}function saveUpdates(_0x513e24,_0x6c3595){return function(_0x5719c1){if(_0x5719c1){return _0x5719c1[_0x351a('0x23')](_0x513e24)[_0x351a('0x24')](function(_0x5a5c35){return _0x5a5c35;});}return null;};}function removeEntity(_0x24a158,_0x4470a6){return function(_0x31017d){if(_0x31017d){return _0x31017d[_0x351a('0x25')]()[_0x351a('0x24')](function(){_0x24a158[_0x351a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x335985,_0x41aa70){return function(_0x156abb){if(!_0x156abb){_0x335985[_0x351a('0x19')](0x194);}return _0x156abb;};}function handleError(_0x5e2597,_0x58a495){_0x58a495=_0x58a495||0x1f4;return function(_0x1a07bf){logger[_0x351a('0x26')](_0x1a07bf['stack']);if(_0x1a07bf['name']){delete _0x1a07bf['name'];}_0x5e2597['status'](_0x58a495)[_0x351a('0x27')](_0x1a07bf);};}exports['index']=function(_0x151a94,_0x398f83){var _0x1b1146={},_0x57a0c9={},_0x227b48={'count':0x0,'rows':[]};var _0xaa23a9=_[_0x351a('0x28')](db[_0x351a('0x29')]['rawAttributes'],function(_0x569dc8){return{'name':_0x569dc8[_0x351a('0x2a')],'type':_0x569dc8[_0x351a('0x2b')][_0x351a('0x2c')]};});_0x57a0c9['model']=_[_0x351a('0x28')](_0xaa23a9,'name');_0x57a0c9[_0x351a('0x2d')]=_[_0x351a('0x2e')](_0x151a94[_0x351a('0x2d')]);_0x57a0c9[_0x351a('0x2f')]=_[_0x351a('0x30')](_0x57a0c9['model'],_0x57a0c9['query']);_0x1b1146[_0x351a('0x31')]=_[_0x351a('0x30')](_0x57a0c9['model'],qs[_0x351a('0x32')](_0x151a94[_0x351a('0x2d')][_0x351a('0x32')]));_0x1b1146[_0x351a('0x31')]=_0x1b1146[_0x351a('0x31')]['length']?_0x1b1146[_0x351a('0x31')]:_0x57a0c9[_0x351a('0x33')];if(!_0x151a94[_0x351a('0x2d')]['hasOwnProperty']('nolimit')){_0x1b1146[_0x351a('0x1e')]=qs[_0x351a('0x1e')](_0x151a94[_0x351a('0x2d')]['limit']);_0x1b1146[_0x351a('0x1d')]=qs['offset'](_0x151a94['query'][_0x351a('0x1d')]);}_0x1b1146['order']=qs[_0x351a('0x34')](_0x151a94[_0x351a('0x2d')][_0x351a('0x34')]);_0x1b1146[_0x351a('0x35')]=qs[_0x351a('0x2f')](_[_0x351a('0x36')](_0x151a94['query'],_0x57a0c9[_0x351a('0x2f')]),_0xaa23a9);if(_0x151a94['query'][_0x351a('0x37')]){_0x1b1146[_0x351a('0x35')]=_['merge'](_0x1b1146['where'],{'$or':_['map'](_0xaa23a9,function(_0x1dec6f){if(_0x1dec6f[_0x351a('0x2b')]!==_0x351a('0x38')){var _0x1f5724={};_0x1f5724[_0x1dec6f['name']]={'$like':'%'+_0x151a94[_0x351a('0x2d')][_0x351a('0x37')]+'%'};return _0x1f5724;}})});}_0x1b1146=_[_0x351a('0x39')]({},_0x1b1146,_0x151a94['options']);var _0x521ca4={'where':_0x1b1146[_0x351a('0x35')]};return db[_0x351a('0x29')][_0x351a('0x3a')](_0x521ca4)[_0x351a('0x24')](function(_0x269ad){_0x227b48[_0x351a('0x3a')]=_0x269ad;if(_0x151a94[_0x351a('0x2d')]['includeAll']){_0x1b1146['include']=[{'all':!![]}];}return db[_0x351a('0x29')][_0x351a('0x3b')](_0x1b1146);})['then'](function(_0x2fb345){_0x227b48['rows']=_0x2fb345;return _0x227b48;})[_0x351a('0x24')](respondWithFilteredResult(_0x398f83,_0x1b1146))['catch'](handleError(_0x398f83,null));};exports[_0x351a('0x3c')]=function(_0xbe932e,_0x206f23){var _0x1726cb={'raw':!![],'where':{'id':_0xbe932e['params']['id']}},_0xc8d3db={};_0xc8d3db['model']=_[_0x351a('0x2e')](db[_0x351a('0x29')]['rawAttributes']);_0xc8d3db[_0x351a('0x2d')]=_[_0x351a('0x2e')](_0xbe932e['query']);_0xc8d3db[_0x351a('0x2f')]=_[_0x351a('0x30')](_0xc8d3db[_0x351a('0x33')],_0xc8d3db[_0x351a('0x2d')]);_0x1726cb[_0x351a('0x31')]=_['intersection'](_0xc8d3db[_0x351a('0x33')],qs[_0x351a('0x32')](_0xbe932e[_0x351a('0x2d')][_0x351a('0x32')]));_0x1726cb['attributes']=_0x1726cb[_0x351a('0x31')][_0x351a('0x3d')]?_0x1726cb[_0x351a('0x31')]:_0xc8d3db[_0x351a('0x33')];if(_0xbe932e[_0x351a('0x2d')]['includeAll']){_0x1726cb[_0x351a('0x3e')]=[{'all':!![]}];}_0x1726cb=_[_0x351a('0x39')]({},_0x1726cb,_0xbe932e[_0x351a('0x3f')]);return db[_0x351a('0x29')][_0x351a('0x40')](_0x1726cb)[_0x351a('0x24')](handleEntityNotFound(_0x206f23,null))[_0x351a('0x24')](respondWithResult(_0x206f23,null))[_0x351a('0x41')](handleError(_0x206f23,null));};exports[_0x351a('0x42')]=function(_0x4986d5,_0x32b31f){return db['JscriptySessionReport']['create'](_0x4986d5[_0x351a('0x43')],{})[_0x351a('0x24')](respondWithResult(_0x32b31f,0xc9))[_0x351a('0x41')](handleError(_0x32b31f,null));};exports[_0x351a('0x23')]=function(_0xd0a03b,_0x6e58da){if(_0xd0a03b[_0x351a('0x43')]['id']){delete _0xd0a03b['body']['id'];}return db[_0x351a('0x29')][_0x351a('0x40')]({'where':{'id':_0xd0a03b[_0x351a('0x44')]['id']}})['then'](handleEntityNotFound(_0x6e58da,null))[_0x351a('0x24')](saveUpdates(_0xd0a03b['body'],null))[_0x351a('0x24')](respondWithResult(_0x6e58da,null))['catch'](handleError(_0x6e58da,null));};exports['destroy']=function(_0xd009ab,_0x17f3dc){return db['JscriptySessionReport'][_0x351a('0x40')]({'where':{'id':_0xd009ab[_0x351a('0x44')]['id']}})['then'](handleEntityNotFound(_0x17f3dc,null))[_0x351a('0x24')](removeEntity(_0x17f3dc,null))[_0x351a('0x41')](handleError(_0x17f3dc,null));};exports[_0x351a('0x45')]=function(_0xc0b66b,_0x5b61c7){return db['JscriptySessionReport'][_0x351a('0x45')]()[_0x351a('0x24')](respondWithResult(_0x5b61c7,null))[_0x351a('0x41')](handleError(_0x5b61c7,null));};exports[_0x351a('0x46')]=function(_0x56b6e8,_0x28f2d4,_0x4a4357){var _0x3a46b1={'raw':!![],'where':{}};var _0x290c60={};var _0x40d4c8={'count':0x0,'rows':[]};return db[_0x351a('0x29')][_0x351a('0x47')]({'where':{'id':_0x56b6e8[_0x351a('0x44')]['id']}})[_0x351a('0x24')](handleEntityNotFound(_0x28f2d4,null))['then'](function(_0x4d3a57){if(_0x4d3a57){_0x290c60[_0x351a('0x33')]=_['keys'](db[_0x351a('0x48')][_0x351a('0x49')]);_0x290c60[_0x351a('0x2d')]=_[_0x351a('0x2e')](_0x56b6e8['query']);_0x290c60[_0x351a('0x2f')]=_[_0x351a('0x30')](_0x290c60['model'],_0x290c60['query']);_0x3a46b1[_0x351a('0x31')]=_[_0x351a('0x30')](_0x290c60[_0x351a('0x33')],qs[_0x351a('0x32')](_0x56b6e8[_0x351a('0x2d')][_0x351a('0x32')]));_0x3a46b1[_0x351a('0x31')]=_0x3a46b1['attributes'][_0x351a('0x3d')]?_0x3a46b1['attributes']:_0x290c60[_0x351a('0x33')];if(!_0x56b6e8['query']['hasOwnProperty'](_0x351a('0x4a'))){_0x3a46b1[_0x351a('0x1e')]=qs[_0x351a('0x1e')](_0x56b6e8['query'][_0x351a('0x1e')]);_0x3a46b1[_0x351a('0x1d')]=qs['offset'](_0x56b6e8[_0x351a('0x2d')]['offset']);}_0x3a46b1[_0x351a('0x4b')]=qs[_0x351a('0x34')](_0x56b6e8[_0x351a('0x2d')][_0x351a('0x34')]);_0x3a46b1[_0x351a('0x35')]=qs[_0x351a('0x2f')](_[_0x351a('0x36')](_0x56b6e8[_0x351a('0x2d')],_0x290c60[_0x351a('0x2f')]));_0x3a46b1['where']['SessionId']=_0x4d3a57['id'];if(_0x56b6e8[_0x351a('0x2d')][_0x351a('0x37')]){_0x3a46b1[_0x351a('0x35')]=_['merge'](_0x3a46b1['where'],{'$or':_[_0x351a('0x28')](_0x3a46b1[_0x351a('0x31')],function(_0x2ec160){var _0x1738cf={};_0x1738cf[_0x2ec160]={'$like':'%'+_0x56b6e8[_0x351a('0x2d')][_0x351a('0x37')]+'%'};return _0x1738cf;})});}_0x3a46b1=_[_0x351a('0x39')]({},_0x3a46b1,_0x56b6e8[_0x351a('0x3f')]);return db[_0x351a('0x48')][_0x351a('0x3a')]({'where':_0x3a46b1[_0x351a('0x35')]})['then'](function(_0x3de844){_0x40d4c8['count']=_0x3de844;if(_0x56b6e8['query']['includeAll']){_0x3a46b1[_0x351a('0x3e')]=[{'all':!![]}];}return db[_0x351a('0x48')]['findAll'](_0x3a46b1);})[_0x351a('0x24')](function(_0xdb3ec2){_0x40d4c8[_0x351a('0x4c')]=_0xdb3ec2;return _0x40d4c8;});}})[_0x351a('0x24')](respondWithFilteredResult(_0x28f2d4,_0x3a46b1))[_0x351a('0x41')](handleError(_0x28f2d4,null));}; \ No newline at end of file +var _0xcffb=['getQuestions','JscriptyQuestionReport','order','pick','SessionId','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','status','count','offset','set','Content-Range','json','apply','save','then','destroy','stack','name','index','JscriptySessionReport','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','describe'];(function(_0x3018fb,_0x507e28){var _0x557c8c=function(_0x1ede9f){while(--_0x1ede9f){_0x3018fb['push'](_0x3018fb['shift']());}};_0x557c8c(++_0x507e28);}(_0xcffb,0x1c1));var _0xbcff=function(_0x20dd23,_0x1a868e){_0x20dd23=_0x20dd23-0x0;var _0xef649e=_0xcffb[_0x20dd23];return _0xef649e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbcff('0x0'));var jsonpatch=require(_0xbcff('0x1'));var rp=require('request-promise');var moment=require(_0xbcff('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbcff('0x3'));var util=require(_0xbcff('0x4'));var path=require(_0xbcff('0x5'));var sox=require(_0xbcff('0x6'));var csv=require('to-csv');var ejs=require(_0xbcff('0x7'));var fs=require('fs');var _=require(_0xbcff('0x8'));var squel=require('squel');var crypto=require(_0xbcff('0x9'));var jsforce=require(_0xbcff('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbcff('0xb'));var Papa=require(_0xbcff('0xc'));var Redis=require(_0xbcff('0xd'));var authService=require(_0xbcff('0xe'));var qs=require(_0xbcff('0xf'));var as=require(_0xbcff('0x10'));var hardwareService=require(_0xbcff('0x11'));var logger=require(_0xbcff('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xbcff('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53706e,_0x466178){_0x466178=_0x466178||0xcc;return function(_0x4d85b6){if(_0x4d85b6){return _0x53706e[_0xbcff('0x14')](_0x466178);}return _0x53706e['status'](_0x466178)[_0xbcff('0x15')]();};}function respondWithResult(_0x532026,_0x237389){_0x237389=_0x237389||0xc8;return function(_0x5ac636){if(_0x5ac636){return _0x532026[_0xbcff('0x16')](_0x237389)['json'](_0x5ac636);}};}function respondWithFilteredResult(_0x475bbe,_0x517409){return function(_0x32c126){if(_0x32c126){var _0x29a4be=_0x32c126[_0xbcff('0x17')],_0x402e47=_0x517409['offset'],_0x15adc6=_0x517409[_0xbcff('0x18')]+_0x517409['limit'],_0x440cec;if(_0x15adc6>=_0x29a4be){_0x15adc6=_0x29a4be;_0x440cec=0xc8;}else{_0x440cec=0xce;}_0x475bbe['status'](_0x440cec);return _0x475bbe[_0xbcff('0x19')](_0xbcff('0x1a'),_0x402e47+'-'+_0x15adc6+'/'+_0x29a4be)[_0xbcff('0x1b')](_0x32c126);}return null;};}function patchUpdates(_0x15197b){return function(_0x3adb13){try{jsonpatch[_0xbcff('0x1c')](_0x3adb13,_0x15197b,!![]);}catch(_0x1f924a){return BPromise['reject'](_0x1f924a);}return _0x3adb13[_0xbcff('0x1d')]();};}function saveUpdates(_0x2b3c0c,_0x52f551){return function(_0x31ae23){if(_0x31ae23){return _0x31ae23['update'](_0x2b3c0c)[_0xbcff('0x1e')](function(_0x5c5eb1){return _0x5c5eb1;});}return null;};}function removeEntity(_0x124e60,_0x2663ef){return function(_0x468a98){if(_0x468a98){return _0x468a98[_0xbcff('0x1f')]()['then'](function(){_0x124e60[_0xbcff('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c4aa6,_0x4f14c4){return function(_0x5f2f9e){if(!_0x5f2f9e){_0x9c4aa6[_0xbcff('0x14')](0x194);}return _0x5f2f9e;};}function handleError(_0x4fc87b,_0x28e193){_0x28e193=_0x28e193||0x1f4;return function(_0x246a2a){logger['error'](_0x246a2a[_0xbcff('0x20')]);if(_0x246a2a[_0xbcff('0x21')]){delete _0x246a2a[_0xbcff('0x21')];}_0x4fc87b[_0xbcff('0x16')](_0x28e193)['send'](_0x246a2a);};}exports[_0xbcff('0x22')]=function(_0x22303a,_0x277636){var _0x546c9b={},_0x5d54cf={},_0xb7e5c0={'count':0x0,'rows':[]};var _0x38a631=_['map'](db[_0xbcff('0x23')]['rawAttributes'],function(_0x2dcac4){return{'name':_0x2dcac4[_0xbcff('0x24')],'type':_0x2dcac4[_0xbcff('0x25')][_0xbcff('0x26')]};});_0x5d54cf[_0xbcff('0x27')]=_[_0xbcff('0x28')](_0x38a631,_0xbcff('0x21'));_0x5d54cf[_0xbcff('0x29')]=_[_0xbcff('0x2a')](_0x22303a[_0xbcff('0x29')]);_0x5d54cf['filters']=_['intersection'](_0x5d54cf[_0xbcff('0x27')],_0x5d54cf[_0xbcff('0x29')]);_0x546c9b[_0xbcff('0x2b')]=_[_0xbcff('0x2c')](_0x5d54cf[_0xbcff('0x27')],qs[_0xbcff('0x2d')](_0x22303a[_0xbcff('0x29')][_0xbcff('0x2d')]));_0x546c9b[_0xbcff('0x2b')]=_0x546c9b[_0xbcff('0x2b')][_0xbcff('0x2e')]?_0x546c9b[_0xbcff('0x2b')]:_0x5d54cf['model'];if(!_0x22303a['query'][_0xbcff('0x2f')](_0xbcff('0x30'))){_0x546c9b[_0xbcff('0x31')]=qs[_0xbcff('0x31')](_0x22303a[_0xbcff('0x29')][_0xbcff('0x31')]);_0x546c9b[_0xbcff('0x18')]=qs[_0xbcff('0x18')](_0x22303a[_0xbcff('0x29')][_0xbcff('0x18')]);}_0x546c9b['order']=qs[_0xbcff('0x32')](_0x22303a['query'][_0xbcff('0x32')]);_0x546c9b['where']=qs[_0xbcff('0x33')](_['pick'](_0x22303a[_0xbcff('0x29')],_0x5d54cf['filters']),_0x38a631);if(_0x22303a[_0xbcff('0x29')][_0xbcff('0x34')]){_0x546c9b['where']=_[_0xbcff('0x35')](_0x546c9b[_0xbcff('0x36')],{'$or':_[_0xbcff('0x28')](_0x38a631,function(_0x520707){if(_0x520707['type']!==_0xbcff('0x37')){var _0x394dca={};_0x394dca[_0x520707[_0xbcff('0x21')]]={'$like':'%'+_0x22303a[_0xbcff('0x29')][_0xbcff('0x34')]+'%'};return _0x394dca;}})});}_0x546c9b=_[_0xbcff('0x35')]({},_0x546c9b,_0x22303a[_0xbcff('0x38')]);var _0x15ca40={'where':_0x546c9b[_0xbcff('0x36')]};return db[_0xbcff('0x23')][_0xbcff('0x17')](_0x15ca40)['then'](function(_0xa5a080){_0xb7e5c0['count']=_0xa5a080;if(_0x22303a[_0xbcff('0x29')][_0xbcff('0x39')]){_0x546c9b[_0xbcff('0x3a')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xbcff('0x3b')](_0x546c9b);})[_0xbcff('0x1e')](function(_0x651032){_0xb7e5c0[_0xbcff('0x3c')]=_0x651032;return _0xb7e5c0;})[_0xbcff('0x1e')](respondWithFilteredResult(_0x277636,_0x546c9b))['catch'](handleError(_0x277636,null));};exports[_0xbcff('0x3d')]=function(_0x3aa794,_0x207a32){var _0x4369f1={'raw':!![],'where':{'id':_0x3aa794[_0xbcff('0x3e')]['id']}},_0x396647={};_0x396647['model']=_[_0xbcff('0x2a')](db[_0xbcff('0x23')][_0xbcff('0x3f')]);_0x396647[_0xbcff('0x29')]=_[_0xbcff('0x2a')](_0x3aa794[_0xbcff('0x29')]);_0x396647['filters']=_[_0xbcff('0x2c')](_0x396647[_0xbcff('0x27')],_0x396647['query']);_0x4369f1[_0xbcff('0x2b')]=_['intersection'](_0x396647['model'],qs['fields'](_0x3aa794[_0xbcff('0x29')][_0xbcff('0x2d')]));_0x4369f1[_0xbcff('0x2b')]=_0x4369f1[_0xbcff('0x2b')][_0xbcff('0x2e')]?_0x4369f1[_0xbcff('0x2b')]:_0x396647['model'];if(_0x3aa794[_0xbcff('0x29')]['includeAll']){_0x4369f1['include']=[{'all':!![]}];}_0x4369f1=_[_0xbcff('0x35')]({},_0x4369f1,_0x3aa794[_0xbcff('0x38')]);return db['JscriptySessionReport'][_0xbcff('0x40')](_0x4369f1)[_0xbcff('0x1e')](handleEntityNotFound(_0x207a32,null))[_0xbcff('0x1e')](respondWithResult(_0x207a32,null))['catch'](handleError(_0x207a32,null));};exports['create']=function(_0x2e4f2a,_0x548650){return db[_0xbcff('0x23')][_0xbcff('0x41')](_0x2e4f2a[_0xbcff('0x42')],{})[_0xbcff('0x1e')](respondWithResult(_0x548650,0xc9))[_0xbcff('0x43')](handleError(_0x548650,null));};exports['update']=function(_0x230f2d,_0x3964b6){if(_0x230f2d[_0xbcff('0x42')]['id']){delete _0x230f2d[_0xbcff('0x42')]['id'];}return db[_0xbcff('0x23')]['find']({'where':{'id':_0x230f2d[_0xbcff('0x3e')]['id']}})[_0xbcff('0x1e')](handleEntityNotFound(_0x3964b6,null))[_0xbcff('0x1e')](saveUpdates(_0x230f2d[_0xbcff('0x42')],null))[_0xbcff('0x1e')](respondWithResult(_0x3964b6,null))[_0xbcff('0x43')](handleError(_0x3964b6,null));};exports['destroy']=function(_0x112a3b,_0x1b8fbb){return db[_0xbcff('0x23')][_0xbcff('0x40')]({'where':{'id':_0x112a3b[_0xbcff('0x3e')]['id']}})[_0xbcff('0x1e')](handleEntityNotFound(_0x1b8fbb,null))[_0xbcff('0x1e')](removeEntity(_0x1b8fbb,null))['catch'](handleError(_0x1b8fbb,null));};exports[_0xbcff('0x44')]=function(_0x5f0e08,_0x53c12c){return db[_0xbcff('0x23')][_0xbcff('0x44')]()[_0xbcff('0x1e')](respondWithResult(_0x53c12c,null))[_0xbcff('0x43')](handleError(_0x53c12c,null));};exports[_0xbcff('0x45')]=function(_0x104490,_0x4ea88c,_0x2f5fa3){var _0x4f2b5b={'raw':!![],'where':{}};var _0x159041={};var _0x289458={'count':0x0,'rows':[]};return db[_0xbcff('0x23')]['findOne']({'where':{'id':_0x104490[_0xbcff('0x3e')]['id']}})[_0xbcff('0x1e')](handleEntityNotFound(_0x4ea88c,null))['then'](function(_0x4e498c){if(_0x4e498c){_0x159041[_0xbcff('0x27')]=_[_0xbcff('0x2a')](db[_0xbcff('0x46')][_0xbcff('0x3f')]);_0x159041[_0xbcff('0x29')]=_[_0xbcff('0x2a')](_0x104490['query']);_0x159041[_0xbcff('0x33')]=_[_0xbcff('0x2c')](_0x159041[_0xbcff('0x27')],_0x159041[_0xbcff('0x29')]);_0x4f2b5b['attributes']=_[_0xbcff('0x2c')](_0x159041['model'],qs[_0xbcff('0x2d')](_0x104490[_0xbcff('0x29')][_0xbcff('0x2d')]));_0x4f2b5b[_0xbcff('0x2b')]=_0x4f2b5b[_0xbcff('0x2b')]['length']?_0x4f2b5b[_0xbcff('0x2b')]:_0x159041[_0xbcff('0x27')];if(!_0x104490['query'][_0xbcff('0x2f')](_0xbcff('0x30'))){_0x4f2b5b[_0xbcff('0x31')]=qs[_0xbcff('0x31')](_0x104490['query']['limit']);_0x4f2b5b[_0xbcff('0x18')]=qs[_0xbcff('0x18')](_0x104490['query'][_0xbcff('0x18')]);}_0x4f2b5b[_0xbcff('0x47')]=qs['sort'](_0x104490[_0xbcff('0x29')][_0xbcff('0x32')]);_0x4f2b5b[_0xbcff('0x36')]=qs[_0xbcff('0x33')](_[_0xbcff('0x48')](_0x104490[_0xbcff('0x29')],_0x159041[_0xbcff('0x33')]));_0x4f2b5b['where'][_0xbcff('0x49')]=_0x4e498c['id'];if(_0x104490[_0xbcff('0x29')]['filter']){_0x4f2b5b[_0xbcff('0x36')]=_[_0xbcff('0x35')](_0x4f2b5b['where'],{'$or':_[_0xbcff('0x28')](_0x4f2b5b[_0xbcff('0x2b')],function(_0x184bfc){var _0x14d71e={};_0x14d71e[_0x184bfc]={'$like':'%'+_0x104490[_0xbcff('0x29')][_0xbcff('0x34')]+'%'};return _0x14d71e;})});}_0x4f2b5b=_[_0xbcff('0x35')]({},_0x4f2b5b,_0x104490[_0xbcff('0x38')]);return db['JscriptyQuestionReport'][_0xbcff('0x17')]({'where':_0x4f2b5b['where']})[_0xbcff('0x1e')](function(_0x1c4151){_0x289458[_0xbcff('0x17')]=_0x1c4151;if(_0x104490[_0xbcff('0x29')][_0xbcff('0x39')]){_0x4f2b5b[_0xbcff('0x3a')]=[{'all':!![]}];}return db[_0xbcff('0x46')][_0xbcff('0x3b')](_0x4f2b5b);})[_0xbcff('0x1e')](function(_0x538e65){_0x289458[_0xbcff('0x3c')]=_0x538e65;return _0x289458;});}})[_0xbcff('0x1e')](respondWithFilteredResult(_0x4ea88c,_0x4f2b5b))['catch'](handleError(_0x4ea88c,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index fefb06c..bb4a2a2 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 _0x5d0a=['report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x24e35e,_0x19d372){var _0x482af5=function(_0x37c50e){while(--_0x37c50e){_0x24e35e['push'](_0x24e35e['shift']());}};_0x482af5(++_0x19d372);}(_0x5d0a,0x175));var _0xa5d0=function(_0x574b3d,_0x32376b){_0x574b3d=_0x574b3d-0x0;var _0x8bb826=_0x5d0a[_0x574b3d];return _0x8bb826;};'use strict';var _=require(_0xa5d0('0x0'));var util=require('util');var logger=require(_0xa5d0('0x1'))('api');var moment=require(_0xa5d0('0x2'));var BPromise=require(_0xa5d0('0x3'));var rp=require(_0xa5d0('0x4'));var fs=require('fs');var path=require(_0xa5d0('0x5'));var rimraf=require('rimraf');var config=require(_0xa5d0('0x6'));var attributes=require(_0xa5d0('0x7'));module[_0xa5d0('0x8')]=function(_0x1e90c4,_0x406289){return _0x1e90c4[_0xa5d0('0x9')](_0xa5d0('0xa'),attributes,{'tableName':_0xa5d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d11=['exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','moment','request-promise','path','./jscriptySessionReport.attributes'];(function(_0x3d8dac,_0x45cb7d){var _0x3688f4=function(_0x31fb4a){while(--_0x31fb4a){_0x3d8dac['push'](_0x3d8dac['shift']());}};_0x3688f4(++_0x45cb7d);}(_0x6d11,0xbf));var _0x16d1=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0x6d11[_0x7729b1];return _0x349504;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));module[_0x16d1('0x7')]=function(_0x3eb9e2,_0x38626d){return _0x3eb9e2[_0x16d1('0x8')](_0x16d1('0x9'),attributes,{'tableName':_0x16d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 6ca51ce..fc20052 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 _0xcdc2=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x49a485,_0x2008ae){var _0x4d7541=function(_0x446d97){while(--_0x446d97){_0x49a485['push'](_0x49a485['shift']());}};_0x4d7541(++_0x2008ae);}(_0xcdc2,0x13d));var _0x2cdc=function(_0x36afd0,_0xea50f){_0x36afd0=_0x36afd0-0x0;var _0x566c0d=_0xcdc2[_0x36afd0];return _0x566c0d;};'use strict';var _=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var moment=require(_0x2cdc('0x2'));var BPromise=require(_0x2cdc('0x3'));var rs=require(_0x2cdc('0x4'));var fs=require('fs');var Redis=require(_0x2cdc('0x5'));var db=require(_0x2cdc('0x6'))['db'];var utils=require(_0x2cdc('0x7'));var logger=require('../../config/logger')(_0x2cdc('0x8'));var config=require(_0x2cdc('0x9'));var jayson=require(_0x2cdc('0xa'));var client=jayson[_0x2cdc('0xb')][_0x2cdc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb2bdfd,_0x5e438b,_0x492329){return new BPromise(function(_0xe2c158,_0x3e5b2a){return client[_0x2cdc('0xd')](_0xb2bdfd,_0x492329)[_0x2cdc('0xe')](function(_0x5e7b2a){logger[_0x2cdc('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5e438b,'request\x20sent');logger[_0x2cdc('0x10')](_0x2cdc('0x11'),_0x5e438b,_0x2cdc('0x12'),JSON[_0x2cdc('0x13')](_0x5e7b2a));if(_0x5e7b2a['error']){if(_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x15')]===0x1f4){logger['error'](_0x2cdc('0x16'),_0x5e438b,_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);return _0x3e5b2a(_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);}logger[_0x2cdc('0x14')](_0x2cdc('0x16'),_0x5e438b,_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);return _0xe2c158(_0x5e7b2a['error']['message']);}else{logger[_0x2cdc('0xf')](_0x2cdc('0x16'),_0x5e438b,_0x2cdc('0x12'));_0xe2c158(_0x5e7b2a['result'][_0x2cdc('0x17')]);}})[_0x2cdc('0x18')](function(_0x5697df){logger[_0x2cdc('0x14')](_0x2cdc('0x16'),_0x5e438b,_0x5697df);_0x3e5b2a(_0x5697df);});});} \ No newline at end of file +var _0x0a1a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x486a95,_0x18bed7){var _0x1cc0ec=function(_0x53a230){while(--_0x53a230){_0x486a95['push'](_0x486a95['shift']());}};_0x1cc0ec(++_0x18bed7);}(_0x0a1a,0x161));var _0xa0a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a1a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa0a1('0x0'));var util=require(_0xa0a1('0x1'));var moment=require(_0xa0a1('0x2'));var BPromise=require(_0xa0a1('0x3'));var rs=require(_0xa0a1('0x4'));var fs=require('fs');var Redis=require(_0xa0a1('0x5'));var db=require(_0xa0a1('0x6'))['db'];var utils=require(_0xa0a1('0x7'));var logger=require('../../config/logger')(_0xa0a1('0x8'));var config=require(_0xa0a1('0x9'));var jayson=require(_0xa0a1('0xa'));var client=jayson[_0xa0a1('0xb')][_0xa0a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e0353,_0x482fd3,_0x2989ff){return new BPromise(function(_0xe8b7b3,_0xf9d4c8){return client[_0xa0a1('0xd')](_0x3e0353,_0x2989ff)[_0xa0a1('0xe')](function(_0x303535){logger[_0xa0a1('0xf')](_0xa0a1('0x10'),_0x482fd3,_0xa0a1('0x11'));logger[_0xa0a1('0x12')](_0xa0a1('0x13'),_0x482fd3,_0xa0a1('0x11'),JSON['stringify'](_0x303535));if(_0x303535[_0xa0a1('0x14')]){if(_0x303535[_0xa0a1('0x14')]['code']===0x1f4){logger[_0xa0a1('0x14')](_0xa0a1('0x10'),_0x482fd3,_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);return _0xf9d4c8(_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);}logger[_0xa0a1('0x14')]('JscriptySessionReport,\x20%s,\x20%s',_0x482fd3,_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);return _0xe8b7b3(_0x303535[_0xa0a1('0x14')][_0xa0a1('0x15')]);}else{logger[_0xa0a1('0xf')](_0xa0a1('0x10'),_0x482fd3,_0xa0a1('0x11'));_0xe8b7b3(_0x303535[_0xa0a1('0x16')][_0xa0a1('0x15')]);}})[_0xa0a1('0x17')](function(_0x58074c){logger[_0xa0a1('0x14')]('JscriptySessionReport,\x20%s,\x20%s',_0x482fd3,_0x58074c);_0xf9d4c8(_0x58074c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 708e655..fa90fe0 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 _0x1a72=['Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','update','exports','multer','path','connect-timeout'];(function(_0x15c9df,_0x50e7ba){var _0x77a36b=function(_0x2ca1e6){while(--_0x2ca1e6){_0x15c9df['push'](_0x15c9df['shift']());}};_0x77a36b(++_0x50e7ba);}(_0x1a72,0x69));var _0x21a7=function(_0x4b0725,_0x337387){_0x4b0725=_0x4b0725-0x0;var _0x5819a8=_0x1a72[_0x4b0725];return _0x5819a8;};'use strict';var multer=require(_0x21a7('0x0'));var util=require('util');var path=require(_0x21a7('0x1'));var timeout=require(_0x21a7('0x2'));var express=require('express');var router=express[_0x21a7('0x3')]();var auth=require(_0x21a7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x21a7('0x5'));var controller=require('./license.controller');router[_0x21a7('0x6')]('/',controller[_0x21a7('0x7')]);router['put'](_0x21a7('0x8'),auth[_0x21a7('0x9')](),controller[_0x21a7('0xa')]);module[_0x21a7('0xb')]=router; \ No newline at end of file +var _0x4a8a=['isAuthenticated','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4a8a,0x1a6));var _0xa4a8=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x4a8a[_0x1911ed];return _0x11edaa;};'use strict';var multer=require('multer');var util=require(_0xa4a8('0x0'));var path=require(_0xa4a8('0x1'));var timeout=require(_0xa4a8('0x2'));var express=require(_0xa4a8('0x3'));var router=express[_0xa4a8('0x4')]();var auth=require(_0xa4a8('0x5'));var interaction=require(_0xa4a8('0x6'));var config=require(_0xa4a8('0x7'));var controller=require(_0xa4a8('0x8'));router['get']('/',controller['index']);router[_0xa4a8('0x9')]('/:id',auth[_0xa4a8('0xa')](),controller['update']);module[_0xa4a8('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 2bbb59e..11c7842 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc97=['exports','TEXT','STRING','sequelize'];(function(_0x399a24,_0x39a2f6){var _0x3b8763=function(_0x3804f1){while(--_0x3804f1){_0x399a24['push'](_0x399a24['shift']());}};_0x3b8763(++_0x39a2f6);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2109b2,_0x19b29f){_0x2109b2=_0x2109b2-0x0;var _0x273f72=_0xdc97[_0x2109b2];return _0x273f72;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'license':{'type':Sequelize[_0x7dc9('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7dc9('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','INTEGER'];(function(_0x58c3ff,_0x124777){var _0x4e5a30=function(_0x4052ef){while(--_0x4052ef){_0x58c3ff['push'](_0x58c3ff['shift']());}};_0x4e5a30(++_0x124777);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5bd792,_0x312a79){_0x5bd792=_0x5bd792-0x0;var _0x421a23=_0xdbf5[_0x5bd792];return _0x421a23;};'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 e54f20a..c67c6f1 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 _0x2d0c=['send','../../config/license/util','index','keys','License','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','error','stack','name'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x2d0c,0x1c8));var _0xc2d0=function(_0x90cba6,_0x3c97d3){_0x90cba6=_0x90cba6-0x0;var _0x500b97=_0x2d0c[_0x90cba6];return _0x500b97;};'use strict';var pdf=require(_0xc2d0('0x0'));var emlformat=require(_0xc2d0('0x1'));var rimraf=require(_0xc2d0('0x2'));var zipdir=require(_0xc2d0('0x3'));var jsonpatch=require(_0xc2d0('0x4'));var rp=require(_0xc2d0('0x5'));var moment=require(_0xc2d0('0x6'));var BPromise=require(_0xc2d0('0x7'));var Mustache=require(_0xc2d0('0x8'));var util=require(_0xc2d0('0x9'));var path=require(_0xc2d0('0xa'));var sox=require('sox');var csv=require(_0xc2d0('0xb'));var ejs=require(_0xc2d0('0xc'));var fs=require('fs');var _=require(_0xc2d0('0xd'));var squel=require(_0xc2d0('0xe'));var crypto=require(_0xc2d0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc2d0('0x10'));var toCsv=require(_0xc2d0('0xb'));var querystring=require(_0xc2d0('0x11'));var Papa=require(_0xc2d0('0x12'));var Redis=require(_0xc2d0('0x13'));var authService=require(_0xc2d0('0x14'));var qs=require(_0xc2d0('0x15'));var as=require(_0xc2d0('0x16'));var hardwareService=require(_0xc2d0('0x17'));var logger=require('../../config/logger')(_0xc2d0('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc2d0('0x19'))['db'];function respondWithStatusCode(_0x56f2e0,_0x38c67d){_0x38c67d=_0x38c67d||0xcc;return function(_0xa86b13){if(_0xa86b13){return _0x56f2e0[_0xc2d0('0x1a')](_0x38c67d);}return _0x56f2e0[_0xc2d0('0x1b')](_0x38c67d)[_0xc2d0('0x1c')]();};}function respondWithResult(_0x151fae,_0x50d948){_0x50d948=_0x50d948||0xc8;return function(_0xc06082){if(_0xc06082){return _0x151fae[_0xc2d0('0x1b')](_0x50d948)[_0xc2d0('0x1d')](_0xc06082);}};}function respondWithFilteredResult(_0x1db247,_0x4302cd){return function(_0x229e46){if(_0x229e46){var _0x2432e6=_0x229e46[_0xc2d0('0x1e')],_0x93fa39=_0x4302cd[_0xc2d0('0x1f')],_0x56473c=_0x4302cd[_0xc2d0('0x1f')]+_0x4302cd[_0xc2d0('0x20')],_0x19010f;if(_0x56473c>=_0x2432e6){_0x56473c=_0x2432e6;_0x19010f=0xc8;}else{_0x19010f=0xce;}_0x1db247[_0xc2d0('0x1b')](_0x19010f);return _0x1db247['set'](_0xc2d0('0x21'),_0x93fa39+'-'+_0x56473c+'/'+_0x2432e6)[_0xc2d0('0x1d')](_0x229e46);}return null;};}function patchUpdates(_0x4b72c1){return function(_0x30ea6f){try{jsonpatch['apply'](_0x30ea6f,_0x4b72c1,!![]);}catch(_0x5ec110){return BPromise['reject'](_0x5ec110);}return _0x30ea6f[_0xc2d0('0x22')]();};}function saveUpdates(_0x4ca429,_0x30aede){return function(_0x16f274){if(_0x16f274){return _0x16f274[_0xc2d0('0x23')](_0x4ca429)[_0xc2d0('0x24')](function(_0x2b3ff6){return _0x2b3ff6;});}return null;};}function removeEntity(_0x1c51c3,_0x1522da){return function(_0x5c32fd){if(_0x5c32fd){return _0x5c32fd['destroy']()[_0xc2d0('0x24')](function(){_0x1c51c3['status'](0xcc)[_0xc2d0('0x1c')]();});}};}function handleEntityNotFound(_0x3196b9,_0x3e68a3){return function(_0x18ba82){if(!_0x18ba82){_0x3196b9['sendStatus'](0x194);}return _0x18ba82;};}function handleError(_0x5cd4ea,_0x4e2766){_0x4e2766=_0x4e2766||0x1f4;return function(_0x1bd554){logger[_0xc2d0('0x25')](_0x1bd554[_0xc2d0('0x26')]);if(_0x1bd554[_0xc2d0('0x27')]){delete _0x1bd554[_0xc2d0('0x27')];}_0x5cd4ea[_0xc2d0('0x1b')](_0x4e2766)[_0xc2d0('0x28')](_0x1bd554);};}var utilLicense=require(_0xc2d0('0x29'));exports[_0xc2d0('0x2a')]=function(_0x16dddf,_0x5e3f71){var _0x194ef5={'raw':!![],'where':{'id':0x1}},_0x1825c5={};_0x1825c5['model']=_[_0xc2d0('0x2b')](db[_0xc2d0('0x2c')]['rawAttributes']);_0x1825c5[_0xc2d0('0x2d')]=_[_0xc2d0('0x2b')](_0x16dddf[_0xc2d0('0x2d')]);_0x1825c5[_0xc2d0('0x2e')]=_[_0xc2d0('0x2f')](_0x1825c5[_0xc2d0('0x30')],_0x1825c5[_0xc2d0('0x2d')]);_0x194ef5[_0xc2d0('0x31')]=_[_0xc2d0('0x2f')](_0x1825c5[_0xc2d0('0x30')],qs[_0xc2d0('0x32')](_0x16dddf[_0xc2d0('0x2d')][_0xc2d0('0x32')]));_0x194ef5[_0xc2d0('0x31')]=_0x194ef5[_0xc2d0('0x31')][_0xc2d0('0x33')]?_0x194ef5[_0xc2d0('0x31')]:_0x1825c5['model'];_0x194ef5=_[_0xc2d0('0x34')]({},_0x194ef5,_0x16dddf[_0xc2d0('0x35')]);return utilLicense[_0xc2d0('0x36')](_0x194ef5)['then'](respondWithResult(_0x5e3f71,null))[_0xc2d0('0x37')](handleError(_0x5e3f71,null));};exports[_0xc2d0('0x23')]=function(_0x3a9a65,_0x1cd1af){if(_0x3a9a65[_0xc2d0('0x38')]['id']){delete _0x3a9a65[_0xc2d0('0x38')]['id'];}return db[_0xc2d0('0x2c')][_0xc2d0('0x39')]({'where':{'id':_0x3a9a65[_0xc2d0('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1cd1af,null))[_0xc2d0('0x24')](function(_0x2574ec){var _0x5c8702=_0x2574ec['get']({'plain':!![]});return utilLicense[_0xc2d0('0x3b')](_0x5c8702,_0x3a9a65[_0xc2d0('0x38')][_0xc2d0('0x3c')]);})[_0xc2d0('0x24')](function(_0x50ab80){if(!_0x50ab80[_0xc2d0('0x3d')]){return saveUpdates(_0x3a9a65[_0xc2d0('0x38')],null);}return _0x50ab80;})[_0xc2d0('0x24')](respondWithResult(_0x1cd1af,null))[_0xc2d0('0x37')](handleError(_0x1cd1af,null));}; \ No newline at end of file +var _0x696d=['rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','../../config/license/util','index','model','keys','query','intersection','attributes','length','merge','options','catch','body','License','find','params','checkLicense','key','html-pdf'];(function(_0x246492,_0x5380c3){var _0x24d41b=function(_0x48decf){while(--_0x48decf){_0x246492['push'](_0x246492['shift']());}};_0x24d41b(++_0x5380c3);}(_0x696d,0xd7));var _0xd696=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x696d[_0x23e7c1];return _0x1add43;};'use strict';var pdf=require(_0xd696('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd696('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd696('0x2'));var moment=require('moment');var BPromise=require(_0xd696('0x3'));var Mustache=require(_0xd696('0x4'));var util=require(_0xd696('0x5'));var path=require(_0xd696('0x6'));var sox=require(_0xd696('0x7'));var csv=require('to-csv');var ejs=require(_0xd696('0x8'));var fs=require('fs');var _=require(_0xd696('0x9'));var squel=require(_0xd696('0xa'));var crypto=require(_0xd696('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd696('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd696('0xd'));var Papa=require(_0xd696('0xe'));var Redis=require(_0xd696('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd696('0x10'));var hardwareService=require(_0xd696('0x11'));var logger=require(_0xd696('0x12'))(_0xd696('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd696('0x14'))['db'];function respondWithStatusCode(_0x17e479,_0x1725c7){_0x1725c7=_0x1725c7||0xcc;return function(_0x4be19c){if(_0x4be19c){return _0x17e479[_0xd696('0x15')](_0x1725c7);}return _0x17e479[_0xd696('0x16')](_0x1725c7)[_0xd696('0x17')]();};}function respondWithResult(_0x128fde,_0x46a402){_0x46a402=_0x46a402||0xc8;return function(_0xf15a6c){if(_0xf15a6c){return _0x128fde[_0xd696('0x16')](_0x46a402)[_0xd696('0x18')](_0xf15a6c);}};}function respondWithFilteredResult(_0x25a5df,_0x10caca){return function(_0x36427e){if(_0x36427e){var _0x2f28bf=_0x36427e[_0xd696('0x19')],_0x45d589=_0x10caca[_0xd696('0x1a')],_0x1f10ff=_0x10caca[_0xd696('0x1a')]+_0x10caca[_0xd696('0x1b')],_0x9d5a57;if(_0x1f10ff>=_0x2f28bf){_0x1f10ff=_0x2f28bf;_0x9d5a57=0xc8;}else{_0x9d5a57=0xce;}_0x25a5df[_0xd696('0x16')](_0x9d5a57);return _0x25a5df['set'](_0xd696('0x1c'),_0x45d589+'-'+_0x1f10ff+'/'+_0x2f28bf)[_0xd696('0x18')](_0x36427e);}return null;};}function patchUpdates(_0x1d25da){return function(_0x66efa1){try{jsonpatch[_0xd696('0x1d')](_0x66efa1,_0x1d25da,!![]);}catch(_0x1a39b7){return BPromise[_0xd696('0x1e')](_0x1a39b7);}return _0x66efa1['save']();};}function saveUpdates(_0x40d7c7,_0xad89cf){return function(_0x79e84f){if(_0x79e84f){return _0x79e84f[_0xd696('0x1f')](_0x40d7c7)[_0xd696('0x20')](function(_0x22ad7a){return _0x22ad7a;});}return null;};}function removeEntity(_0x5aef27,_0x253d86){return function(_0x5d87e7){if(_0x5d87e7){return _0x5d87e7[_0xd696('0x21')]()[_0xd696('0x20')](function(){_0x5aef27[_0xd696('0x16')](0xcc)[_0xd696('0x17')]();});}};}function handleEntityNotFound(_0x280bb1,_0x3a14de){return function(_0x4fc0d2){if(!_0x4fc0d2){_0x280bb1[_0xd696('0x15')](0x194);}return _0x4fc0d2;};}function handleError(_0x915a91,_0xbbdf13){_0xbbdf13=_0xbbdf13||0x1f4;return function(_0x3bac86){logger[_0xd696('0x22')](_0x3bac86[_0xd696('0x23')]);if(_0x3bac86[_0xd696('0x24')]){delete _0x3bac86['name'];}_0x915a91[_0xd696('0x16')](_0xbbdf13)['send'](_0x3bac86);};}var utilLicense=require(_0xd696('0x25'));exports[_0xd696('0x26')]=function(_0x1eaba0,_0x1c51c8){var _0x3023bd={'raw':!![],'where':{'id':0x1}},_0x533840={};_0x533840[_0xd696('0x27')]=_[_0xd696('0x28')](db['License']['rawAttributes']);_0x533840['query']=_[_0xd696('0x28')](_0x1eaba0[_0xd696('0x29')]);_0x533840['filters']=_[_0xd696('0x2a')](_0x533840[_0xd696('0x27')],_0x533840[_0xd696('0x29')]);_0x3023bd[_0xd696('0x2b')]=_[_0xd696('0x2a')](_0x533840[_0xd696('0x27')],qs['fields'](_0x1eaba0[_0xd696('0x29')]['fields']));_0x3023bd[_0xd696('0x2b')]=_0x3023bd[_0xd696('0x2b')][_0xd696('0x2c')]?_0x3023bd[_0xd696('0x2b')]:_0x533840[_0xd696('0x27')];_0x3023bd=_[_0xd696('0x2d')]({},_0x3023bd,_0x1eaba0[_0xd696('0x2e')]);return utilLicense['getLicense'](_0x3023bd)[_0xd696('0x20')](respondWithResult(_0x1c51c8,null))[_0xd696('0x2f')](handleError(_0x1c51c8,null));};exports['update']=function(_0x3c78c4,_0x560e13){if(_0x3c78c4[_0xd696('0x30')]['id']){delete _0x3c78c4[_0xd696('0x30')]['id'];}return db[_0xd696('0x31')][_0xd696('0x32')]({'where':{'id':_0x3c78c4[_0xd696('0x33')]['id']}})[_0xd696('0x20')](handleEntityNotFound(_0x560e13,null))['then'](function(_0x5716d5){var _0xcee6e=_0x5716d5['get']({'plain':!![]});return utilLicense[_0xd696('0x34')](_0xcee6e,_0x3c78c4['body'][_0xd696('0x35')]);})['then'](function(_0x4adf90){if(!_0x4adf90['demo']){return saveUpdates(_0x3c78c4['body'],null);}return _0x4adf90;})[_0xd696('0x20')](respondWithResult(_0x560e13,null))[_0xd696('0x2f')](handleError(_0x560e13,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 77033be..b4f830a 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0xee122e,_0x58ef2e){var _0x34f98a=function(_0x18163e){while(--_0x18163e){_0xee122e['push'](_0xee122e['shift']());}};_0x34f98a(++_0x58ef2e);}(_0xb10b,0x12a));var _0xbb10=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0xb10b[_0x172ed7];return _0xfa8f61;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x5a77fb,_0x2d2d59){var _0x6ca4fb=function(_0x428777){while(--_0x428777){_0x5a77fb['push'](_0x5a77fb['shift']());}};_0x6ca4fb(++_0x2d2d59);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0xb10b[_0x5d6b41];return _0x1c2dd6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 318d934..6f986ed 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 _0xfa7c=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4ab177,_0x2b870f){var _0x4156ee=function(_0x2c08de){while(--_0x2c08de){_0x4ab177['push'](_0x4ab177['shift']());}};_0x4156ee(++_0x2b870f);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x575f8b,_0x4cf57e){_0x575f8b=_0x575f8b-0x0;var _0x155d60=_0xfa7c[_0x575f8b];return _0x155d60;};'use strict';var _=require(_0xcfa7('0x0'));var util=require('util');var moment=require(_0xcfa7('0x1'));var BPromise=require(_0xcfa7('0x2'));var rs=require(_0xcfa7('0x3'));var fs=require('fs');var Redis=require(_0xcfa7('0x4'));var db=require(_0xcfa7('0x5'))['db'];var utils=require(_0xcfa7('0x6'));var logger=require(_0xcfa7('0x7'))(_0xcfa7('0x8'));var config=require('../../config/environment');var jayson=require(_0xcfa7('0x9'));var client=jayson[_0xcfa7('0xa')][_0xcfa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d5f85,_0x4b2669,_0x816590){return new BPromise(function(_0x573432,_0x376c4e){return client[_0xcfa7('0xc')](_0x1d5f85,_0x816590)[_0xcfa7('0xd')](function(_0x14e62a){logger['info'](_0xcfa7('0xe'),_0x4b2669,_0xcfa7('0xf'));logger[_0xcfa7('0x10')](_0xcfa7('0x11'),_0x4b2669,_0xcfa7('0xf'),JSON['stringify'](_0x14e62a));if(_0x14e62a['error']){if(_0x14e62a[_0xcfa7('0x12')]['code']===0x1f4){logger[_0xcfa7('0x12')](_0xcfa7('0xe'),_0x4b2669,_0x14e62a[_0xcfa7('0x12')][_0xcfa7('0x13')]);return _0x376c4e(_0x14e62a[_0xcfa7('0x12')][_0xcfa7('0x13')]);}logger[_0xcfa7('0x12')](_0xcfa7('0xe'),_0x4b2669,_0x14e62a['error'][_0xcfa7('0x13')]);return _0x573432(_0x14e62a['error']['message']);}else{logger[_0xcfa7('0x14')](_0xcfa7('0xe'),_0x4b2669,_0xcfa7('0xf'));_0x573432(_0x14e62a[_0xcfa7('0x15')][_0xcfa7('0x13')]);}})['catch'](function(_0x11d8bf){logger[_0xcfa7('0x12')](_0xcfa7('0xe'),_0x4b2669,_0x11d8bf);_0x376c4e(_0x11d8bf);});});} \ No newline at end of file +var _0x8aa7=['client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xe087a4,_0x1eb412){var _0x26980c=function(_0x36ec0b){while(--_0x36ec0b){_0xe087a4['push'](_0xe087a4['shift']());}};_0x26980c(++_0x1eb412);}(_0x8aa7,0xb6));var _0x78aa=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x8aa7[_0x58dc25];return _0x21b0a7;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var moment=require(_0x78aa('0x1'));var BPromise=require(_0x78aa('0x2'));var rs=require(_0x78aa('0x3'));var fs=require('fs');var Redis=require(_0x78aa('0x4'));var db=require(_0x78aa('0x5'))['db'];var utils=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var jayson=require(_0x78aa('0x9'));var client=jayson[_0x78aa('0xa')][_0x78aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369ee7,_0x462a9a,_0xa79008){return new BPromise(function(_0x2368ac,_0x460488){return client[_0x78aa('0xc')](_0x369ee7,_0xa79008)[_0x78aa('0xd')](function(_0x45d377){logger[_0x78aa('0xe')](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));logger[_0x78aa('0x11')](_0x78aa('0x12'),_0x462a9a,_0x78aa('0x10'),JSON['stringify'](_0x45d377));if(_0x45d377['error']){if(_0x45d377[_0x78aa('0x13')][_0x78aa('0x14')]===0x1f4){logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x460488(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x2368ac(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}else{logger['info'](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));_0x2368ac(_0x45d377[_0x78aa('0x16')][_0x78aa('0x15')]);}})[_0x78aa('0x17')](function(_0x2897f8){logger['error']('License,\x20%s,\x20%s',_0x462a9a,_0x2897f8);_0x460488(_0x2897f8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6da0d6a..3aec8fd 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 _0x19d9=['exports','util','path','connect-timeout','express','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','/:id/dispositions','post','addAnswer','create','addImap','/:id/applications','addApplications','/:id/send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x19d9,0x18d));var _0x919d=function(_0x54005b,_0x2d806d){_0x54005b=_0x54005b-0x0;var _0x2294ee=_0x19d9[_0x54005b];return _0x2294ee;};'use strict';var multer=require('multer');var util=require(_0x919d('0x0'));var path=require(_0x919d('0x1'));var timeout=require(_0x919d('0x2'));var express=require(_0x919d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x919d('0x4'));var controller=require(_0x919d('0x5'));router[_0x919d('0x6')]('/',auth[_0x919d('0x7')](),controller[_0x919d('0x8')]);router[_0x919d('0x6')](_0x919d('0x9'),auth[_0x919d('0x7')](),controller[_0x919d('0xa')]);router['get'](_0x919d('0xb'),auth['isAuthenticated'](),controller[_0x919d('0xc')]);router[_0x919d('0x6')]('/:id/dispositions',auth[_0x919d('0x7')](),controller['getDispositions']);router['get'](_0x919d('0xd'),auth[_0x919d('0x7')](),controller[_0x919d('0xe')]);router[_0x919d('0x6')](_0x919d('0xf'),auth[_0x919d('0x7')](),controller[_0x919d('0x10')]);router[_0x919d('0x6')](_0x919d('0x11'),auth[_0x919d('0x7')](),controller['getSmtp']);router[_0x919d('0x6')](_0x919d('0x12'),auth['isAuthenticated'](),controller[_0x919d('0x13')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x919d('0x14'),auth[_0x919d('0x7')](),controller[_0x919d('0x15')]);router[_0x919d('0x6')](_0x919d('0x16'),auth[_0x919d('0x7')](),controller[_0x919d('0x17')]);router[_0x919d('0x6')](_0x919d('0x18'),auth['isAuthenticated'](),controller[_0x919d('0x19')]);router['post'](_0x919d('0x1a'),auth[_0x919d('0x7')](),controller['addDisposition']);router[_0x919d('0x1b')](_0x919d('0xd'),auth['isAuthenticated'](),controller[_0x919d('0x1c')]);router[_0x919d('0x1b')]('/',auth['isAuthenticated'](),controller[_0x919d('0x1d')]);router[_0x919d('0x1b')]('/:id/in_servers',auth[_0x919d('0x7')](),controller[_0x919d('0x1e')]);router['post'](_0x919d('0x11'),auth[_0x919d('0x7')](),controller['addSmtp']);router[_0x919d('0x1b')](_0x919d('0x12'),auth[_0x919d('0x7')](),controller['addInteraction']);router[_0x919d('0x1b')](_0x919d('0x1f'),auth[_0x919d('0x7')](),controller[_0x919d('0x20')]);router[_0x919d('0x1b')](_0x919d('0x21'),auth['isAuthenticated'](),controller['send']);router['post']('/:id/users',auth[_0x919d('0x7')](),controller[_0x919d('0x22')]);router[_0x919d('0x23')](_0x919d('0xb'),auth['isAuthenticated'](),controller[_0x919d('0x24')]);router[_0x919d('0x25')](_0x919d('0x1a'),auth[_0x919d('0x7')](),controller['removeDispositions']);router['delete'](_0x919d('0xd'),auth['isAuthenticated'](),controller[_0x919d('0x26')]);router[_0x919d('0x25')]('/:id/in_servers',auth[_0x919d('0x7')](),controller[_0x919d('0x27')]);router['delete']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x919d('0x28')]);router[_0x919d('0x25')]('/:id',auth['isAuthenticated'](),controller[_0x919d('0x29')]);router[_0x919d('0x25')]('/:id/users',auth[_0x919d('0x7')](),controller[_0x919d('0x2a')]);module[_0x919d('0x2b')]=router; \ No newline at end of file +var _0xc828=['destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/out_servers','/:id/interactions','/:id/applications','/:id/messages','post','/:id/dispositions','addImap','addSmtp','addInteraction','addApplications','/:id/send','/:id/users','addAgents','update','delete','removeImap','removeSmtp'];(function(_0x3a4667,_0x4845e1){var _0x2fbace=function(_0x2cdff7){while(--_0x2cdff7){_0x3a4667['push'](_0x3a4667['shift']());}};_0x2fbace(++_0x4845e1);}(_0xc828,0x146));var _0x8c82=function(_0x31c4da,_0xd6d192){_0x31c4da=_0x31c4da-0x0;var _0x213a88=_0xc828[_0x31c4da];return _0x213a88;};'use strict';var multer=require(_0x8c82('0x0'));var util=require(_0x8c82('0x1'));var path=require(_0x8c82('0x2'));var timeout=require(_0x8c82('0x3'));var express=require(_0x8c82('0x4'));var router=express[_0x8c82('0x5')]();var auth=require(_0x8c82('0x6'));var interaction=require(_0x8c82('0x7'));var config=require(_0x8c82('0x8'));var controller=require('./mailAccount.controller');router[_0x8c82('0x9')]('/',auth[_0x8c82('0xa')](),controller[_0x8c82('0xb')]);router[_0x8c82('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8c82('0xc')]);router[_0x8c82('0x9')](_0x8c82('0xd'),auth[_0x8c82('0xa')](),controller[_0x8c82('0xe')]);router[_0x8c82('0x9')]('/:id/dispositions',auth[_0x8c82('0xa')](),controller[_0x8c82('0xf')]);router[_0x8c82('0x9')](_0x8c82('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x8c82('0x9')]('/:id/in_servers',auth[_0x8c82('0xa')](),controller['getImap']);router[_0x8c82('0x9')](_0x8c82('0x11'),auth['isAuthenticated'](),controller['getSmtp']);router[_0x8c82('0x9')](_0x8c82('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x8c82('0x9')](_0x8c82('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0x8c82('0x9')](_0x8c82('0x14'),auth[_0x8c82('0xa')](),controller['getMessages']);router[_0x8c82('0x9')]('/:id/verify',auth[_0x8c82('0xa')](),controller['verifySmtp']);router[_0x8c82('0x9')]('/:id/users',auth[_0x8c82('0xa')](),controller['getAgents']);router[_0x8c82('0x15')](_0x8c82('0x16'),auth[_0x8c82('0xa')](),controller['addDisposition']);router[_0x8c82('0x15')](_0x8c82('0x10'),auth[_0x8c82('0xa')](),controller['addAnswer']);router[_0x8c82('0x15')]('/',auth[_0x8c82('0xa')](),controller['create']);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x8c82('0x17')]);router[_0x8c82('0x15')](_0x8c82('0x11'),auth[_0x8c82('0xa')](),controller[_0x8c82('0x18')]);router[_0x8c82('0x15')](_0x8c82('0x12'),auth[_0x8c82('0xa')](),controller[_0x8c82('0x19')]);router[_0x8c82('0x15')](_0x8c82('0x13'),auth[_0x8c82('0xa')](),controller[_0x8c82('0x1a')]);router[_0x8c82('0x15')](_0x8c82('0x1b'),auth[_0x8c82('0xa')](),controller['send']);router['post'](_0x8c82('0x1c'),auth[_0x8c82('0xa')](),controller[_0x8c82('0x1d')]);router['put'](_0x8c82('0xd'),auth['isAuthenticated'](),controller[_0x8c82('0x1e')]);router[_0x8c82('0x1f')](_0x8c82('0x16'),auth[_0x8c82('0xa')](),controller['removeDispositions']);router[_0x8c82('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x8c82('0x1f')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x8c82('0x20')]);router[_0x8c82('0x1f')](_0x8c82('0x11'),auth['isAuthenticated'](),controller[_0x8c82('0x21')]);router['delete']('/:id',auth[_0x8c82('0xa')](),controller[_0x8c82('0x22')]);router[_0x8c82('0x1f')](_0x8c82('0x1c'),auth['isAuthenticated'](),controller[_0x8c82('0x23')]);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 d8cfb88..dd008c8 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 _0x3516=['BOOLEAN','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','TEXT'];(function(_0x475146,_0x31237d){var _0x3a1346=function(_0x26f17f){while(--_0x26f17f){_0x475146['push'](_0x475146['shift']());}};_0x3a1346(++_0x31237d);}(_0x3516,0x164));var _0x6351=function(_0x470612,_0x4ecd52){_0x470612=_0x470612-0x0;var _0x4d0db8=_0x3516[_0x470612];return _0x4d0db8;};'use strict';var Sequelize=require(_0x6351('0x0'));module[_0x6351('0x1')]={'description':{'type':Sequelize[_0x6351('0x2')]},'name':{'type':Sequelize[_0x6351('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x6351('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x6351('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x6351('0x3')]},'markAsUnread':{'type':Sequelize[_0x6351('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6351('0x5')](0x2)[_0x6351('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6351('0x7');}},'notificationSound':{'type':Sequelize[_0x6351('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6351('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6351('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6351('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6351('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6351('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6351('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6351('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x6351('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6351('0x4')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x28d7c1){if(!_0x28d7c1)this[_0x6351('0x9')](_0x6351('0xa'),null);this['setDataValue'](_0x6351('0xb'),_0x28d7c1);}}}; \ No newline at end of file +var _0xefc2=['TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','BOOLEAN'];(function(_0x157b09,_0x1104ba){var _0x3b9f75=function(_0x136da2){while(--_0x136da2){_0x157b09['push'](_0x157b09['shift']());}};_0x3b9f75(++_0x1104ba);}(_0xefc2,0x110));var _0x2efc=function(_0x453e5d,_0x35dd7a){_0x453e5d=_0x453e5d-0x0;var _0x509f82=_0xefc2[_0x453e5d];return _0x509f82;};'use strict';var Sequelize=require(_0x2efc('0x0'));module[_0x2efc('0x1')]={'description':{'type':Sequelize[_0x2efc('0x2')]},'name':{'type':Sequelize[_0x2efc('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2efc('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x2efc('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2efc('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2efc('0x2')],'allowNull':![],'defaultValue':_0x2efc('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x2efc('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2efc('0x4')],'defaultValue':function(){return _0x2efc('0x7');}},'notificationSound':{'type':Sequelize[_0x2efc('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2efc('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2efc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2efc('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2efc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2efc('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2efc('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x2efc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2efc('0x3')],'defaultValue':![],'comment':_0x2efc('0xa'),'set':function(_0x1558d7){if(!_0x1558d7)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x2efc('0xb')]('mandatoryDisposition',_0x1558d7);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 42ceb28..9dac2c1 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 _0xa5c1=['test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','name','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','where','options','includeAll','findAll','catch','show','params','Imap','keys','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','rows','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','send','split','Contacts','updatedAt','from','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','messageId','attach','out','Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','isArray','userMailAccount:remove','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http'];(function(_0x5357ab,_0x2caa1f){var _0x34e402=function(_0x5de494){while(--_0x5de494){_0x5357ab['push'](_0x5357ab['shift']());}};_0x34e402(++_0x2caa1f);}(_0xa5c1,0xa3));var _0x1a5c=function(_0x35c78c,_0x312f63){_0x35c78c=_0x35c78c-0x0;var _0x214419=_0xa5c1[_0x35c78c];return _0x214419;};'use strict';var pdf=require(_0x1a5c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a5c('0x1'));var jsonpatch=require(_0x1a5c('0x2'));var rp=require(_0x1a5c('0x3'));var moment=require(_0x1a5c('0x4'));var BPromise=require(_0x1a5c('0x5'));var Mustache=require(_0x1a5c('0x6'));var util=require(_0x1a5c('0x7'));var path=require(_0x1a5c('0x8'));var sox=require(_0x1a5c('0x9'));var csv=require('to-csv');var ejs=require(_0x1a5c('0xa'));var fs=require('fs');var _=require(_0x1a5c('0xb'));var squel=require(_0x1a5c('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a5c('0xd'));var deskjs=require(_0x1a5c('0xe'));var toCsv=require(_0x1a5c('0xf'));var querystring=require(_0x1a5c('0x10'));var Papa=require(_0x1a5c('0x11'));var Redis=require(_0x1a5c('0x12'));var authService=require(_0x1a5c('0x13'));var qs=require(_0x1a5c('0x14'));var as=require(_0x1a5c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1a5c('0x16'));var utils=require(_0x1a5c('0x17'));var config=require('../../config/environment');var db=require(_0x1a5c('0x18'))['db'];config[_0x1a5c('0x19')]=_[_0x1a5c('0x1a')](config[_0x1a5c('0x19')],{'host':_0x1a5c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a5c('0x19')]));require('./mailAccount.socket')[_0x1a5c('0x1c')](socket);var jayson=require(_0x1a5c('0x1d'));var client=jayson[_0x1a5c('0x1e')][_0x1a5c('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x1b9733,_0x5f5401,_0x1ee70a){if(_0x1ee70a){var _0x545423=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x545423[_0x1a5c('0x20')](_0x5f5401)){return _0x1b9733;}else{throw new db[(_0x1a5c('0x21'))][(_0x1a5c('0x22'))](_0x1a5c('0x23'));}}else{return _0x1b9733;}}function respondWithRpcPromise(_0x558423,_0x2fad6f,_0x9a36f3,_0x55bfc0){return new BPromise(function(_0x5079cd,_0x4cc294){var _0x514e64=_0x55bfc0||client;return _0x514e64[_0x1a5c('0x24')](_0x558423,_0x9a36f3)[_0x1a5c('0x25')](function(_0x1f6199){logger[_0x1a5c('0x26')](_0x1a5c('0x27'),_0x2fad6f,_0x1a5c('0x28'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x2fad6f,_0x1a5c('0x28'),JSON[_0x1a5c('0x29')](_0x1f6199));if(_0x1f6199[_0x1a5c('0x2a')]){if(_0x1f6199[_0x1a5c('0x2a')]['code']===0x1f4){logger[_0x1a5c('0x2a')](_0x1a5c('0x27'),_0x2fad6f,_0x1f6199[_0x1a5c('0x2a')]['message']);return _0x4cc294(_0x1f6199['error'][_0x1a5c('0x2b')]);}logger[_0x1a5c('0x2a')](_0x1a5c('0x27'),_0x2fad6f,_0x1f6199[_0x1a5c('0x2a')]['message']);return _0x5079cd(_0x1f6199[_0x1a5c('0x2a')][_0x1a5c('0x2b')]);}else{logger[_0x1a5c('0x26')](_0x1a5c('0x27'),_0x2fad6f,_0x1a5c('0x28'));_0x5079cd(_0x1f6199[_0x1a5c('0x2c')][_0x1a5c('0x2b')]);}})['catch'](function(_0x5ab79a){logger[_0x1a5c('0x2a')](_0x1a5c('0x27'),_0x2fad6f,_0x5ab79a);_0x4cc294(_0x5ab79a);});});}function respondWithStatusCode(_0x302588,_0x4a7a55){_0x4a7a55=_0x4a7a55||0xcc;return function(_0x5b194d){if(_0x5b194d){return _0x302588['sendStatus'](_0x4a7a55);}return _0x302588[_0x1a5c('0x2d')](_0x4a7a55)[_0x1a5c('0x2e')]();};}function respondWithResult(_0x28112e,_0x1ffdd5){_0x1ffdd5=_0x1ffdd5||0xc8;return function(_0x1a2fa5){if(_0x1a2fa5){return _0x28112e[_0x1a5c('0x2d')](_0x1ffdd5)[_0x1a5c('0x2f')](_0x1a2fa5);}};}function respondWithFilteredResult(_0x57a31f,_0x470141){return function(_0x446103){if(_0x446103){var _0x4de8de=_0x446103[_0x1a5c('0x30')],_0x29e297=_0x470141[_0x1a5c('0x31')],_0x49e10c=_0x470141['offset']+_0x470141['limit'],_0x58f7f9;if(_0x49e10c>=_0x4de8de){_0x49e10c=_0x4de8de;_0x58f7f9=0xc8;}else{_0x58f7f9=0xce;}_0x57a31f['status'](_0x58f7f9);return _0x57a31f['set'](_0x1a5c('0x32'),_0x29e297+'-'+_0x49e10c+'/'+_0x4de8de)[_0x1a5c('0x2f')](_0x446103);}return null;};}function patchUpdates(_0x520c6f){return function(_0x2e6fdc){try{jsonpatch[_0x1a5c('0x33')](_0x2e6fdc,_0x520c6f,!![]);}catch(_0x2c66dd){return BPromise[_0x1a5c('0x34')](_0x2c66dd);}return _0x2e6fdc['save']();};}function saveUpdates(_0xf14512,_0x262518){return function(_0x2c98a8){if(_0x2c98a8){return _0x2c98a8[_0x1a5c('0x35')](_0xf14512)[_0x1a5c('0x25')](function(_0x2a4e0f){return _0x2a4e0f;});}return null;};}function removeEntity(_0x239467,_0x1e17b6){return function(_0xb6ac51){if(_0xb6ac51){return _0xb6ac51[_0x1a5c('0x36')]()[_0x1a5c('0x25')](function(){var _0x10e066=_0xb6ac51[_0x1a5c('0x37')]({'plain':!![]});var _0x296433=_0x1a5c('0x38');return db[_0x1a5c('0x39')][_0x1a5c('0x36')]({'where':{'type':_0x296433,'resourceId':_0x10e066['id']}})[_0x1a5c('0x25')](function(){return _0xb6ac51;});})[_0x1a5c('0x25')](function(){_0x239467[_0x1a5c('0x2d')](0xcc)[_0x1a5c('0x2e')]();});}};}function handleEntityNotFound(_0x2b1774,_0x511ada){return function(_0x32ec7e){if(!_0x32ec7e){_0x2b1774[_0x1a5c('0x3a')](0x194);}return _0x32ec7e;};}function handleError(_0x28f42d,_0x4edb36){_0x4edb36=_0x4edb36||0x1f4;return function(_0x5e65f7){logger[_0x1a5c('0x2a')](_0x5e65f7['stack']);if(_0x5e65f7[_0x1a5c('0x3b')]){delete _0x5e65f7[_0x1a5c('0x3b')];}_0x28f42d[_0x1a5c('0x2d')](_0x4edb36)['send'](_0x5e65f7);};}exports[_0x1a5c('0x3c')]=function(_0x1b9700,_0x564906){var _0x33d3e5={'include':[{'model':db[_0x1a5c('0x3d')],'as':'Imap'},{'model':db[_0x1a5c('0x3e')],'as':_0x1a5c('0x3f')},{'model':db[_0x1a5c('0x40')],'as':_0x1a5c('0x41')}]},_0x167eec={},_0x45d342={'count':0x0,'rows':[]};var _0x52e194=_[_0x1a5c('0x42')](db[_0x1a5c('0x43')][_0x1a5c('0x44')],function(_0x568036){return{'name':_0x568036[_0x1a5c('0x45')],'type':_0x568036[_0x1a5c('0x46')][_0x1a5c('0x47')]};});_0x167eec[_0x1a5c('0x48')]=_[_0x1a5c('0x42')](_0x52e194,_0x1a5c('0x3b'));_0x167eec[_0x1a5c('0x49')]=_['keys'](_0x1b9700[_0x1a5c('0x49')]);_0x167eec[_0x1a5c('0x4a')]=_['intersection'](_0x167eec[_0x1a5c('0x48')],_0x167eec['query']);_0x33d3e5[_0x1a5c('0x4b')]=_[_0x1a5c('0x4c')](_0x167eec[_0x1a5c('0x48')],qs[_0x1a5c('0x4d')](_0x1b9700[_0x1a5c('0x49')]['fields']));_0x33d3e5[_0x1a5c('0x4b')]=_0x33d3e5[_0x1a5c('0x4b')][_0x1a5c('0x4e')]?_0x33d3e5[_0x1a5c('0x4b')]:_0x167eec['model'];if(!_0x1b9700['query'][_0x1a5c('0x4f')](_0x1a5c('0x50'))){_0x33d3e5[_0x1a5c('0x51')]=qs[_0x1a5c('0x51')](_0x1b9700[_0x1a5c('0x49')][_0x1a5c('0x51')]);_0x33d3e5[_0x1a5c('0x31')]=qs['offset'](_0x1b9700[_0x1a5c('0x49')][_0x1a5c('0x31')]);}_0x33d3e5['order']=qs[_0x1a5c('0x52')](_0x1b9700['query']['sort']);_0x33d3e5['where']=qs[_0x1a5c('0x4a')](_[_0x1a5c('0x53')](_0x1b9700[_0x1a5c('0x49')],_0x167eec[_0x1a5c('0x4a')]),_0x52e194);if(_0x1b9700['query'][_0x1a5c('0x54')]){_0x33d3e5['where']=_[_0x1a5c('0x55')](_0x33d3e5[_0x1a5c('0x56')],{'$or':_[_0x1a5c('0x42')](_0x52e194,function(_0x13a8ff){if(_0x13a8ff[_0x1a5c('0x46')]!=='VIRTUAL'){var _0x364fdf={};_0x364fdf[_0x13a8ff[_0x1a5c('0x3b')]]={'$like':'%'+_0x1b9700[_0x1a5c('0x49')][_0x1a5c('0x54')]+'%'};return _0x364fdf;}})});}_0x33d3e5=_[_0x1a5c('0x55')]({},_0x33d3e5,_0x1b9700[_0x1a5c('0x57')]);var _0x3bbe80={'where':_0x33d3e5[_0x1a5c('0x56')]};return db[_0x1a5c('0x43')][_0x1a5c('0x30')](_0x3bbe80)[_0x1a5c('0x25')](function(_0x8e5c7e){_0x45d342[_0x1a5c('0x30')]=_0x8e5c7e;if(_0x1b9700[_0x1a5c('0x49')][_0x1a5c('0x58')]){_0x33d3e5['include']=[{'all':!![]}];}return db[_0x1a5c('0x43')][_0x1a5c('0x59')](_0x33d3e5);})[_0x1a5c('0x25')](function(_0x282c29){_0x45d342['rows']=_0x282c29;return _0x45d342;})[_0x1a5c('0x25')](respondWithFilteredResult(_0x564906,_0x33d3e5))[_0x1a5c('0x5a')](handleError(_0x564906,null));};exports[_0x1a5c('0x5b')]=function(_0x98f5a2,_0x3513ad){var _0x65f836={'raw':![],'where':{'id':_0x98f5a2[_0x1a5c('0x5c')]['id']},'include':[{'model':db[_0x1a5c('0x3d')],'as':_0x1a5c('0x5d')},{'model':db[_0x1a5c('0x3e')],'as':_0x1a5c('0x3f')},{'model':db['Pause'],'as':_0x1a5c('0x41')}]},_0x730cbf={};_0x730cbf[_0x1a5c('0x48')]=_[_0x1a5c('0x5e')](db[_0x1a5c('0x43')][_0x1a5c('0x44')]);_0x730cbf[_0x1a5c('0x49')]=_['keys'](_0x98f5a2[_0x1a5c('0x49')]);_0x730cbf['filters']=_[_0x1a5c('0x4c')](_0x730cbf['model'],_0x730cbf[_0x1a5c('0x49')]);_0x65f836['attributes']=_['intersection'](_0x730cbf['model'],qs[_0x1a5c('0x4d')](_0x98f5a2[_0x1a5c('0x49')][_0x1a5c('0x4d')]));_0x65f836[_0x1a5c('0x4b')]=_0x65f836['attributes']['length']?_0x65f836[_0x1a5c('0x4b')]:_0x730cbf[_0x1a5c('0x48')];if(_0x98f5a2['query'][_0x1a5c('0x58')]){_0x65f836[_0x1a5c('0x5f')]=[{'all':!![]}];}_0x65f836=_[_0x1a5c('0x55')]({},_0x65f836,_0x98f5a2['options']);return db['MailAccount'][_0x1a5c('0x60')](_0x65f836)['then'](handleEntityNotFound(_0x3513ad,null))[_0x1a5c('0x25')](respondWithResult(_0x3513ad,null))[_0x1a5c('0x5a')](handleError(_0x3513ad,null));};exports[_0x1a5c('0x35')]=function(_0x59b76b,_0xfdaab0){if(_0x59b76b[_0x1a5c('0x61')]['id']){delete _0x59b76b[_0x1a5c('0x61')]['id'];}return db['MailAccount'][_0x1a5c('0x60')]({'where':{'id':_0x59b76b[_0x1a5c('0x5c')]['id']},'include':[{'model':db[_0x1a5c('0x3d')],'as':_0x1a5c('0x5d')},{'model':db[_0x1a5c('0x3e')],'as':_0x1a5c('0x3f')},{'model':db[_0x1a5c('0x40')],'as':_0x1a5c('0x41')}]})[_0x1a5c('0x25')](handleEntityNotFound(_0xfdaab0,null))[_0x1a5c('0x25')](saveUpdates(_0x59b76b[_0x1a5c('0x61')],null))[_0x1a5c('0x25')](function(_0x48a238){if(_0x48a238&&_0x59b76b[_0x1a5c('0x61')][_0x1a5c('0x5d')]){return db[_0x1a5c('0x3d')][_0x1a5c('0x35')](_0x59b76b['body'][_0x1a5c('0x5d')],{'where':{'MailAccountId':_0x48a238['id']}})['then'](function(){return _0x48a238;});}return _0x48a238;})['then'](function(_0x168b03){if(_0x168b03&&_0x59b76b[_0x1a5c('0x61')]['Smtp']){return db['MailServerOut'][_0x1a5c('0x35')](_0x59b76b[_0x1a5c('0x61')][_0x1a5c('0x3f')],{'where':{'MailAccountId':_0x168b03['id']}})[_0x1a5c('0x25')](function(){return _0x168b03;});}return _0x168b03;})[_0x1a5c('0x25')](respondWithResult(_0xfdaab0,null))['catch'](handleError(_0xfdaab0,null));};exports[_0x1a5c('0x62')]=function(_0x8343ef,_0x50d1ce){return db[_0x1a5c('0x43')][_0x1a5c('0x62')]()['then'](respondWithResult(_0x50d1ce,null))[_0x1a5c('0x5a')](handleError(_0x50d1ce,null));};exports[_0x1a5c('0x63')]=function(_0x1c3967,_0x4c5282,_0x2b4246){if(_0x1c3967[_0x1a5c('0x61')]['id']){delete _0x1c3967['body']['id'];}return db[_0x1a5c('0x43')][_0x1a5c('0x60')]({'where':{'id':_0x1c3967['params']['id']}})['then'](handleEntityNotFound(_0x4c5282,null))['then'](function(_0x5d42e3){if(_0x5d42e3){_0x1c3967[_0x1a5c('0x61')][_0x1a5c('0x64')]=_0x5d42e3['id'];return db[_0x1a5c('0x65')][_0x1a5c('0x66')](_0x1c3967[_0x1a5c('0x61')]);}})[_0x1a5c('0x25')](respondWithResult(_0x4c5282,null))['catch'](handleError(_0x4c5282,null));};exports[_0x1a5c('0x67')]=function(_0xc34928,_0x10d5e7,_0xf59503){var _0x4bd414={'raw':![],'where':{}};var _0x5765a9={};var _0x46d40e={'count':0x0,'rows':[]};return db['MailAccount'][_0x1a5c('0x68')]({'where':{'id':_0xc34928[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x10d5e7,null))[_0x1a5c('0x25')](function(_0x68b8e6){if(_0x68b8e6){_0x5765a9['model']=_[_0x1a5c('0x5e')](db[_0x1a5c('0x65')][_0x1a5c('0x44')]);_0x5765a9[_0x1a5c('0x49')]=_[_0x1a5c('0x5e')](_0xc34928[_0x1a5c('0x49')]);_0x5765a9['filters']=_[_0x1a5c('0x4c')](_0x5765a9[_0x1a5c('0x48')],_0x5765a9['query']);_0x4bd414[_0x1a5c('0x4b')]=_[_0x1a5c('0x4c')](_0x5765a9['model'],qs[_0x1a5c('0x4d')](_0xc34928[_0x1a5c('0x49')][_0x1a5c('0x4d')]));_0x4bd414[_0x1a5c('0x4b')]=_0x4bd414[_0x1a5c('0x4b')][_0x1a5c('0x4e')]?_0x4bd414[_0x1a5c('0x4b')]:_0x5765a9[_0x1a5c('0x48')];if(!_0xc34928[_0x1a5c('0x49')][_0x1a5c('0x4f')](_0x1a5c('0x50'))){_0x4bd414['limit']=qs[_0x1a5c('0x51')](_0xc34928[_0x1a5c('0x49')][_0x1a5c('0x51')]);_0x4bd414['offset']=qs[_0x1a5c('0x31')](_0xc34928[_0x1a5c('0x49')][_0x1a5c('0x31')]);}_0x4bd414[_0x1a5c('0x69')]=qs[_0x1a5c('0x52')](_0xc34928['query']['sort']);_0x4bd414[_0x1a5c('0x56')]=qs[_0x1a5c('0x4a')](_[_0x1a5c('0x53')](_0xc34928['query'],_0x5765a9[_0x1a5c('0x4a')]));_0x4bd414[_0x1a5c('0x56')]['MailAccountId']=_0x68b8e6['id'];if(_0xc34928[_0x1a5c('0x49')][_0x1a5c('0x54')]){_0x4bd414[_0x1a5c('0x56')]=_[_0x1a5c('0x55')](_0x4bd414[_0x1a5c('0x56')],{'$or':_[_0x1a5c('0x42')](_0x4bd414[_0x1a5c('0x4b')],function(_0x3e8466){var _0x532a5f={};_0x532a5f[_0x3e8466]={'$like':'%'+_0xc34928['query'][_0x1a5c('0x54')]+'%'};return _0x532a5f;})});}_0x4bd414=_[_0x1a5c('0x55')]({},_0x4bd414,_0xc34928[_0x1a5c('0x57')]);return db[_0x1a5c('0x65')][_0x1a5c('0x30')]({'where':_0x4bd414[_0x1a5c('0x56')]})[_0x1a5c('0x25')](function(_0x2c73b4){_0x46d40e[_0x1a5c('0x30')]=_0x2c73b4;if(_0xc34928[_0x1a5c('0x49')][_0x1a5c('0x58')]){_0x4bd414[_0x1a5c('0x5f')]=[{'all':!![]}];}return db['Disposition'][_0x1a5c('0x59')](_0x4bd414);})[_0x1a5c('0x25')](function(_0x3fa26a){_0x46d40e[_0x1a5c('0x6a')]=_0x3fa26a;return _0x46d40e;});}})['then'](respondWithFilteredResult(_0x10d5e7,_0x4bd414))['catch'](handleError(_0x10d5e7,null));};exports['removeDispositions']=function(_0x523c64,_0x5050a9,_0x2cdb87){return db[_0x1a5c('0x43')][_0x1a5c('0x60')]({'where':{'id':_0x523c64[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x5050a9,null))[_0x1a5c('0x25')](function(_0x3aad55){if(_0x3aad55){return _0x3aad55['removeDispositions'](_0x523c64[_0x1a5c('0x49')][_0x1a5c('0x6b')]);}})[_0x1a5c('0x25')](respondWithStatusCode(_0x5050a9,null))[_0x1a5c('0x5a')](handleError(_0x5050a9,null));};exports[_0x1a5c('0x6c')]=function(_0x14d372,_0x14c3d4,_0x18757a){if(_0x14d372[_0x1a5c('0x61')]['id']){delete _0x14d372[_0x1a5c('0x61')]['id'];}return db[_0x1a5c('0x43')][_0x1a5c('0x60')]({'where':{'id':_0x14d372[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x14c3d4,null))[_0x1a5c('0x25')](function(_0x383968){if(_0x383968){_0x14d372['body'][_0x1a5c('0x64')]=_0x383968['id'];return db[_0x1a5c('0x6d')]['create'](_0x14d372['body']);}})['then'](respondWithResult(_0x14c3d4,null))[_0x1a5c('0x5a')](handleError(_0x14c3d4,null));};exports[_0x1a5c('0x6e')]=function(_0x4576ea,_0x5d3c06,_0x3ecfa3){var _0x12ee69={'raw':![],'where':{}};var _0x2f7c04={};var _0x31bc48={'count':0x0,'rows':[]};return db[_0x1a5c('0x43')]['findOne']({'where':{'id':_0x4576ea['params']['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x5d3c06,null))[_0x1a5c('0x25')](function(_0x43207e){if(_0x43207e){_0x2f7c04[_0x1a5c('0x48')]=_['keys'](db[_0x1a5c('0x6d')][_0x1a5c('0x44')]);_0x2f7c04['query']=_['keys'](_0x4576ea[_0x1a5c('0x49')]);_0x2f7c04[_0x1a5c('0x4a')]=_['intersection'](_0x2f7c04[_0x1a5c('0x48')],_0x2f7c04[_0x1a5c('0x49')]);_0x12ee69[_0x1a5c('0x4b')]=_[_0x1a5c('0x4c')](_0x2f7c04['model'],qs['fields'](_0x4576ea[_0x1a5c('0x49')][_0x1a5c('0x4d')]));_0x12ee69['attributes']=_0x12ee69[_0x1a5c('0x4b')][_0x1a5c('0x4e')]?_0x12ee69[_0x1a5c('0x4b')]:_0x2f7c04[_0x1a5c('0x48')];if(!_0x4576ea['query'][_0x1a5c('0x4f')](_0x1a5c('0x50'))){_0x12ee69[_0x1a5c('0x51')]=qs[_0x1a5c('0x51')](_0x4576ea[_0x1a5c('0x49')][_0x1a5c('0x51')]);_0x12ee69[_0x1a5c('0x31')]=qs['offset'](_0x4576ea['query'][_0x1a5c('0x31')]);}_0x12ee69['order']=qs[_0x1a5c('0x52')](_0x4576ea[_0x1a5c('0x49')][_0x1a5c('0x52')]);_0x12ee69[_0x1a5c('0x56')]=qs['filters'](_['pick'](_0x4576ea[_0x1a5c('0x49')],_0x2f7c04['filters']));_0x12ee69[_0x1a5c('0x56')][_0x1a5c('0x64')]=_0x43207e['id'];if(_0x4576ea[_0x1a5c('0x49')][_0x1a5c('0x54')]){_0x12ee69[_0x1a5c('0x56')]=_[_0x1a5c('0x55')](_0x12ee69[_0x1a5c('0x56')],{'$or':_[_0x1a5c('0x42')](_0x12ee69['attributes'],function(_0x267ebb){var _0x197f66={};_0x197f66[_0x267ebb]={'$like':'%'+_0x4576ea[_0x1a5c('0x49')][_0x1a5c('0x54')]+'%'};return _0x197f66;})});}_0x12ee69=_[_0x1a5c('0x55')]({},_0x12ee69,_0x4576ea['options']);return db[_0x1a5c('0x6d')][_0x1a5c('0x30')]({'where':_0x12ee69['where']})[_0x1a5c('0x25')](function(_0x51b117){_0x31bc48[_0x1a5c('0x30')]=_0x51b117;if(_0x4576ea[_0x1a5c('0x49')]['includeAll']){_0x12ee69[_0x1a5c('0x5f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1a5c('0x59')](_0x12ee69);})['then'](function(_0x273653){_0x31bc48[_0x1a5c('0x6a')]=_0x273653;return _0x31bc48;});}})[_0x1a5c('0x25')](respondWithFilteredResult(_0x5d3c06,_0x12ee69))[_0x1a5c('0x5a')](handleError(_0x5d3c06,null));};exports[_0x1a5c('0x6f')]=function(_0x2f6194,_0x4ffa25,_0x5413ed){return db[_0x1a5c('0x43')][_0x1a5c('0x60')]({'where':{'id':_0x2f6194[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x4ffa25,null))[_0x1a5c('0x25')](function(_0x13c31c){if(_0x13c31c){return _0x13c31c['removeAnswers'](_0x2f6194['query'][_0x1a5c('0x6b')]);}})[_0x1a5c('0x25')](respondWithStatusCode(_0x4ffa25,null))[_0x1a5c('0x5a')](handleError(_0x4ffa25,null));};exports['create']=function(_0x172baa,_0x5b70d9){var _0x14a193={'name':_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x3b')],'key':_0x172baa['body'][_0x1a5c('0x47')],'email':_0x172baa[_0x1a5c('0x61')]['email'],'ListId':_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x70')],'active':!_[_0x1a5c('0x71')](_0x172baa['body'][_0x1a5c('0x72')])?_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x72')]:!![],'description':_0x172baa[_0x1a5c('0x61')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x1a5c('0x71')](_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x73')])){if(_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x74')]){_0x14a193[_0x1a5c('0x5d')][_0x1a5c('0x75')]=_0x14a193[_0x1a5c('0x3f')]['user']=_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x76')];_0x14a193['Imap'][_0x1a5c('0x77')]=_0x14a193['Smtp']['pass']=_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x78')];}else{_0x14a193['Imap'][_0x1a5c('0x79')]=_0x14a193['Smtp'][_0x1a5c('0x79')]=![];}_0x14a193[_0x1a5c('0x5d')]['host']=_0x172baa[_0x1a5c('0x61')]['Imap'][_0x1a5c('0x7a')];_0x14a193['Imap'][_0x1a5c('0x7b')]=_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x5d')][_0x1a5c('0x7b')];_0x14a193[_0x1a5c('0x3f')][_0x1a5c('0x7a')]=_0x172baa['body'][_0x1a5c('0x3f')][_0x1a5c('0x7a')];_0x14a193['Smtp'][_0x1a5c('0x7b')]=_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x3f')][_0x1a5c('0x7b')];}else{_0x14a193['Imap'][_0x1a5c('0x7c')]=_0x14a193['Smtp'][_0x1a5c('0x7c')]=_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x73')];_0x14a193[_0x1a5c('0x5d')]['user']=_0x14a193[_0x1a5c('0x3f')][_0x1a5c('0x75')]=_0x172baa[_0x1a5c('0x61')][_0x1a5c('0x76')];_0x14a193[_0x1a5c('0x5d')][_0x1a5c('0x77')]=_0x14a193[_0x1a5c('0x3f')][_0x1a5c('0x7d')]=_0x172baa['body'][_0x1a5c('0x78')];}return db[_0x1a5c('0x43')][_0x1a5c('0x66')](_0x14a193,{'include':[{'model':db[_0x1a5c('0x3e')],'as':'Smtp'},{'model':db[_0x1a5c('0x3d')],'as':'Imap'}]})['then'](function(_0x5f4d4a){var _0x5e3f11=_0x172baa[_0x1a5c('0x75')][_0x1a5c('0x37')]({'plain':!![]});if(!_0x5e3f11)throw new Error(_0x1a5c('0x7e'));if(_0x5e3f11[_0x1a5c('0x7f')]===_0x1a5c('0x75')){var _0x1966d1=_0x5f4d4a[_0x1a5c('0x37')]({'plain':!![]});return db[_0x1a5c('0x80')][_0x1a5c('0x60')]({'where':{'name':_0x1a5c('0x38'),'userProfileId':_0x5e3f11[_0x1a5c('0x81')]},'raw':!![]})[_0x1a5c('0x25')](function(_0x767208){if(_0x767208&&_0x767208[_0x1a5c('0x82')]===0x0){return db[_0x1a5c('0x39')][_0x1a5c('0x66')]({'name':_0x1966d1[_0x1a5c('0x3b')],'resourceId':_0x1966d1['id'],'type':_0x767208['name'],'sectionId':_0x767208['id']},{})[_0x1a5c('0x25')](function(){return _0x5f4d4a;});}else{return _0x5f4d4a;}})[_0x1a5c('0x5a')](function(_0x31c217){logger['error'](_0x1a5c('0x83'),_0x31c217);throw _0x31c217;});}return _0x5f4d4a;})[_0x1a5c('0x25')](respondWithResult(_0x5b70d9,0xc9))[_0x1a5c('0x5a')](handleError(_0x5b70d9,null));};exports[_0x1a5c('0x84')]=function(_0x3d36b8,_0x29edec,_0x1ab865){return db[_0x1a5c('0x43')][_0x1a5c('0x68')]({'where':{'id':_0x3d36b8[_0x1a5c('0x5c')]['id']}})['then'](handleEntityNotFound(_0x29edec,null))[_0x1a5c('0x25')](function(_0x3b533a){if(_0x3b533a){return _0x3b533a[_0x1a5c('0x84')]();}return null;})['then'](respondWithResult(_0x29edec,null))['catch'](handleError(_0x29edec,null));};exports[_0x1a5c('0x85')]=function(_0xbb5449,_0x4ad33b,_0x4b42b4){if(_0xbb5449[_0x1a5c('0x61')]['id']){delete _0xbb5449[_0x1a5c('0x61')]['id'];}return db[_0x1a5c('0x43')]['find']({'where':{'id':_0xbb5449[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x4ad33b,null))[_0x1a5c('0x25')](function(_0x305229){if(_0x305229){_0xbb5449['body'][_0x1a5c('0x64')]=_0x305229['id'];return db[_0x1a5c('0x3d')][_0x1a5c('0x66')](_0xbb5449[_0x1a5c('0x61')]);}})[_0x1a5c('0x25')](respondWithResult(_0x4ad33b,null))[_0x1a5c('0x5a')](handleError(_0x4ad33b,null));};exports[_0x1a5c('0x86')]=function(_0x3a3bde,_0x4bb85b,_0x499111){return db[_0x1a5c('0x43')][_0x1a5c('0x68')]({'where':{'id':_0x3a3bde['params']['id']}})['then'](handleEntityNotFound(_0x4bb85b,null))[_0x1a5c('0x25')](function(_0xb4caaf){if(_0xb4caaf){return _0xb4caaf[_0x1a5c('0x87')](null);}return null;})[_0x1a5c('0x25')](respondWithStatusCode(_0x4bb85b,null))['catch'](handleError(_0x4bb85b,null));};exports['getSmtp']=function(_0x561023,_0x574c21,_0x410406){return db['MailAccount']['findOne']({'where':{'id':_0x561023[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x574c21,null))[_0x1a5c('0x25')](function(_0x955e76){if(_0x955e76){return _0x955e76[_0x1a5c('0x88')]();}return null;})[_0x1a5c('0x25')](respondWithResult(_0x574c21,null))[_0x1a5c('0x5a')](handleError(_0x574c21,null));};exports['addSmtp']=function(_0x5dce51,_0x19abc2,_0x41b6b6){if(_0x5dce51[_0x1a5c('0x61')]['id']){delete _0x5dce51[_0x1a5c('0x61')]['id'];}return db[_0x1a5c('0x43')][_0x1a5c('0x60')]({'where':{'id':_0x5dce51['params']['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x19abc2,null))[_0x1a5c('0x25')](function(_0xff0b5d){if(_0xff0b5d){_0x5dce51[_0x1a5c('0x61')][_0x1a5c('0x64')]=_0xff0b5d['id'];return db[_0x1a5c('0x3e')][_0x1a5c('0x66')](_0x5dce51[_0x1a5c('0x61')]);}})[_0x1a5c('0x25')](respondWithResult(_0x19abc2,null))[_0x1a5c('0x5a')](handleError(_0x19abc2,null));};exports[_0x1a5c('0x89')]=function(_0x40874a,_0x1a4433,_0x1093ff){return db[_0x1a5c('0x43')]['findOne']({'where':{'id':_0x40874a['params']['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x1a4433,null))[_0x1a5c('0x25')](function(_0x54d16a){if(_0x54d16a){return _0x54d16a[_0x1a5c('0x8a')](null);}return null;})['then'](respondWithStatusCode(_0x1a4433,null))[_0x1a5c('0x5a')](handleError(_0x1a4433,null));};exports[_0x1a5c('0x8b')]=function(_0xf0aa57,_0x4544dd,_0x58f931){return db['MailInteraction'][_0x1a5c('0x60')]({'where':{'id':_0xf0aa57['params']['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x4544dd,null))['then'](function(_0x3db7b8){if(_0x3db7b8){return _0x3db7b8[_0x1a5c('0x8b')](_0xf0aa57[_0x1a5c('0x61')][_0x1a5c('0x6b')],_['omit'](_0xf0aa57[_0x1a5c('0x61')],[_0x1a5c('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x4544dd,null))['catch'](handleError(_0x4544dd,null));};exports[_0x1a5c('0x8c')]=function(_0x32c68a,_0x18bbeb,_0x26e17b){var _0xd5d9b={'raw':![],'where':{}};var _0x5c119b={};var _0x3397ab={'count':0x0,'rows':[]};return db[_0x1a5c('0x43')][_0x1a5c('0x68')]({'where':{'id':_0x32c68a[_0x1a5c('0x5c')]['id']}})['then'](handleEntityNotFound(_0x18bbeb,null))['then'](function(_0x160fc4){if(_0x160fc4){_0x5c119b[_0x1a5c('0x48')]=_[_0x1a5c('0x5e')](db[_0x1a5c('0x8d')][_0x1a5c('0x44')]);_0x5c119b['query']=_[_0x1a5c('0x5e')](_0x32c68a[_0x1a5c('0x49')]);_0x5c119b[_0x1a5c('0x4a')]=_[_0x1a5c('0x4c')](_0x5c119b[_0x1a5c('0x48')],_0x5c119b['query']);_0xd5d9b[_0x1a5c('0x4b')]=_[_0x1a5c('0x4c')](_0x5c119b[_0x1a5c('0x48')],qs['fields'](_0x32c68a[_0x1a5c('0x49')][_0x1a5c('0x4d')]));_0xd5d9b[_0x1a5c('0x4b')]=_0xd5d9b[_0x1a5c('0x4b')]['length']?_0xd5d9b[_0x1a5c('0x4b')]:_0x5c119b[_0x1a5c('0x48')];if(!_0x32c68a[_0x1a5c('0x49')][_0x1a5c('0x4f')]('nolimit')){_0xd5d9b[_0x1a5c('0x51')]=qs['limit'](_0x32c68a['query'][_0x1a5c('0x51')]);_0xd5d9b[_0x1a5c('0x31')]=qs[_0x1a5c('0x31')](_0x32c68a[_0x1a5c('0x49')][_0x1a5c('0x31')]);}_0xd5d9b[_0x1a5c('0x69')]=qs[_0x1a5c('0x52')](_0x32c68a['query'][_0x1a5c('0x52')]);_0xd5d9b['where']=qs[_0x1a5c('0x4a')](_[_0x1a5c('0x53')](_0x32c68a['query'],_0x5c119b[_0x1a5c('0x4a')]));_0xd5d9b[_0x1a5c('0x56')][_0x1a5c('0x64')]=_0x160fc4['id'];if(_0x32c68a[_0x1a5c('0x49')]['filter']){_0xd5d9b[_0x1a5c('0x56')]=_['merge'](_0xd5d9b['where'],{'$or':_[_0x1a5c('0x42')](_0xd5d9b[_0x1a5c('0x4b')],function(_0x4045d1){var _0xcb9f4a={};_0xcb9f4a[_0x4045d1]={'$like':'%'+_0x32c68a[_0x1a5c('0x49')]['filter']+'%'};return _0xcb9f4a;})});}_0xd5d9b=_[_0x1a5c('0x55')]({},_0xd5d9b,_0x32c68a[_0x1a5c('0x57')]);return db[_0x1a5c('0x8d')][_0x1a5c('0x30')]({'where':_0xd5d9b[_0x1a5c('0x56')]})['then'](function(_0x2b1493){_0x3397ab[_0x1a5c('0x30')]=_0x2b1493;if(_0x32c68a[_0x1a5c('0x49')][_0x1a5c('0x58')]){_0xd5d9b[_0x1a5c('0x5f')]=[{'model':db[_0x1a5c('0x8e')],'as':_0x1a5c('0x8f'),'required':![]},{'model':db[_0x1a5c('0x90')],'as':_0x1a5c('0x91'),'attributes':[_0x1a5c('0x3b'),_0x1a5c('0x92'),_0x1a5c('0x93')],'required':![]},{'model':db[_0x1a5c('0x94')],'as':_0x1a5c('0x95'),'attributes':['id',_0x1a5c('0x3b'),_0x1a5c('0x96')],'where':_0x32c68a[_0x1a5c('0x49')]['tag']?{'id':_0x32c68a[_0x1a5c('0x49')][_0x1a5c('0x97')]}:undefined,'required':_0x32c68a[_0x1a5c('0x49')][_0x1a5c('0x97')]?!![]:![]}];}return db[_0x1a5c('0x8d')][_0x1a5c('0x59')](_0xd5d9b);})[_0x1a5c('0x25')](function(_0x3d162c){_0x3397ab['rows']=_0x3d162c;return _0x3397ab;});}})[_0x1a5c('0x25')](respondWithFilteredResult(_0x18bbeb,_0xd5d9b))[_0x1a5c('0x5a')](handleError(_0x18bbeb,null));};exports[_0x1a5c('0x98')]=function(_0x5b63d4,_0x5611a9,_0xafb02c){return db[_0x1a5c('0x43')]['findOne']({'where':{'id':_0x5b63d4[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x5611a9,null))[_0x1a5c('0x25')](function(_0x48683b){if(_0x48683b){return db[_0x1a5c('0x99')]['transaction'](function(_0x11521a){return db[_0x1a5c('0x9a')][_0x1a5c('0x36')]({'where':{'MailAccountId':_0x5b63d4[_0x1a5c('0x5c')]['id']},'transaction':_0x11521a})[_0x1a5c('0x25')](function(_0x26bebd){var _0x168f7e=_[_0x1a5c('0x42')](_0x5b63d4[_0x1a5c('0x61')],function(_0x2f7801){_0x2f7801['MailAccountId']=_0x5b63d4[_0x1a5c('0x5c')]['id'];return _0x2f7801;});return db[_0x1a5c('0x9a')]['bulkCreate'](_0x168f7e,{'transaction':_0x11521a});});})['then'](function(){return db[_0x1a5c('0x9a')][_0x1a5c('0x9b')]({'where':{'MailAccountId':_0x5b63d4[_0x1a5c('0x5c')]['id']},'order':_0x1a5c('0x9c')});});}})[_0x1a5c('0x25')](respondWithResult(_0x5611a9,null))[_0x1a5c('0x5a')](handleError(_0x5611a9,null));};exports[_0x1a5c('0x9d')]=function(_0x1214cc,_0x1de3ac,_0x597cd1){var _0x51986f={};var _0x330372={};var _0x34551e;var _0xee6113;return db['MailAccount'][_0x1a5c('0x68')]({'where':{'id':_0x1214cc[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x1de3ac,null))[_0x1a5c('0x25')](function(_0x57a9fb){if(_0x57a9fb){_0x34551e=_0x57a9fb;_0x330372[_0x1a5c('0x48')]=_[_0x1a5c('0x5e')](db[_0x1a5c('0x9a')]['rawAttributes']);_0x330372[_0x1a5c('0x49')]=_[_0x1a5c('0x5e')](_0x1214cc[_0x1a5c('0x49')]);_0x330372[_0x1a5c('0x4a')]=_['intersection'](_0x330372[_0x1a5c('0x48')],_0x330372[_0x1a5c('0x49')]);_0x51986f[_0x1a5c('0x4b')]=_[_0x1a5c('0x4c')](_0x330372[_0x1a5c('0x48')],qs[_0x1a5c('0x4d')](_0x1214cc['query'][_0x1a5c('0x4d')]));_0x51986f[_0x1a5c('0x4b')]=_0x51986f[_0x1a5c('0x4b')]['length']?_0x51986f[_0x1a5c('0x4b')]:_0x330372[_0x1a5c('0x48')];_0x51986f[_0x1a5c('0x69')]=qs[_0x1a5c('0x52')](_0x1214cc[_0x1a5c('0x49')][_0x1a5c('0x52')]);_0x51986f[_0x1a5c('0x56')]=qs[_0x1a5c('0x4a')](_['pick'](_0x1214cc[_0x1a5c('0x49')],_0x330372[_0x1a5c('0x4a')]));if(_0x1214cc[_0x1a5c('0x49')][_0x1a5c('0x54')]){_0x51986f[_0x1a5c('0x56')]=_[_0x1a5c('0x55')](_0x51986f[_0x1a5c('0x56')],{'$or':_[_0x1a5c('0x42')](_0x51986f[_0x1a5c('0x4b')],function(_0x3fe5ff){var _0xe7f0a9={};_0xe7f0a9[_0x3fe5ff]={'$like':'%'+_0x1214cc['query']['filter']+'%'};return _0xe7f0a9;})});}_0x51986f=_[_0x1a5c('0x55')]({},_0x51986f,_0x1214cc[_0x1a5c('0x57')]);return _0x34551e[_0x1a5c('0x9d')](_0x51986f);}})['then'](function(_0x3caad5){if(_0x3caad5){_0xee6113=_0x3caad5['length'];if(!_0x1214cc[_0x1a5c('0x49')][_0x1a5c('0x4f')](_0x1a5c('0x50'))){_0x51986f[_0x1a5c('0x51')]=qs['limit'](_0x1214cc['query'][_0x1a5c('0x51')]);_0x51986f['offset']=qs[_0x1a5c('0x31')](_0x1214cc[_0x1a5c('0x49')][_0x1a5c('0x31')]);}return _0x34551e[_0x1a5c('0x9d')](_0x51986f);}})[_0x1a5c('0x25')](function(_0x2ca991){if(_0x2ca991){return _0x2ca991?{'count':_0xee6113,'rows':_0x2ca991}:null;}})[_0x1a5c('0x25')](respondWithResult(_0x1de3ac,null))[_0x1a5c('0x5a')](handleError(_0x1de3ac,null));};exports[_0x1a5c('0x9e')]=function(_0x4a0223,_0x3cee2e,_0x27ea6e){var _0x3cf34c={'raw':!![],'where':{}};var _0x25d666={};var _0x476c1d={'count':0x0,'rows':[]};return db[_0x1a5c('0x43')][_0x1a5c('0x68')]({'where':{'id':_0x4a0223['params']['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x3cee2e,null))['then'](function(_0x247282){if(_0x247282){_0x25d666[_0x1a5c('0x48')]=_['keys'](db[_0x1a5c('0x9f')][_0x1a5c('0x44')]);_0x25d666[_0x1a5c('0x49')]=_['keys'](_0x4a0223[_0x1a5c('0x49')]);_0x25d666[_0x1a5c('0x4a')]=_[_0x1a5c('0x4c')](_0x25d666['model'],_0x25d666[_0x1a5c('0x49')]);_0x3cf34c[_0x1a5c('0x4b')]=_['intersection'](_0x25d666[_0x1a5c('0x48')],qs['fields'](_0x4a0223['query'][_0x1a5c('0x4d')]));_0x3cf34c[_0x1a5c('0x4b')]=_0x3cf34c['attributes'][_0x1a5c('0x4e')]?_0x3cf34c['attributes']:_0x25d666[_0x1a5c('0x48')];if(!_0x4a0223[_0x1a5c('0x49')][_0x1a5c('0x4f')](_0x1a5c('0x50'))){_0x3cf34c['limit']=qs[_0x1a5c('0x51')](_0x4a0223[_0x1a5c('0x49')][_0x1a5c('0x51')]);_0x3cf34c[_0x1a5c('0x31')]=qs[_0x1a5c('0x31')](_0x4a0223[_0x1a5c('0x49')]['offset']);}_0x3cf34c[_0x1a5c('0x69')]=qs[_0x1a5c('0x52')](_0x4a0223['query'][_0x1a5c('0x52')]);_0x3cf34c['where']=qs['filters'](_[_0x1a5c('0x53')](_0x4a0223[_0x1a5c('0x49')],_0x25d666['filters']));_0x3cf34c['where']['MailAccountId']=_0x247282['id'];if(_0x4a0223[_0x1a5c('0x49')]['filter']){_0x3cf34c['where']=_[_0x1a5c('0x55')](_0x3cf34c[_0x1a5c('0x56')],{'$or':_[_0x1a5c('0x42')](_0x3cf34c[_0x1a5c('0x4b')],function(_0x1c14db){var _0xd770e7={};_0xd770e7[_0x1c14db]={'$like':'%'+_0x4a0223[_0x1a5c('0x49')][_0x1a5c('0x54')]+'%'};return _0xd770e7;})});}if(_0x4a0223['query'][_0x1a5c('0xa0')]){var _0x233a4e=_0x4a0223[_0x1a5c('0x49')]['$gte']['split'](',');var _0x1a6e99={};_0x1a6e99[_0x233a4e[0x0]]={'$gte':moment(_0x233a4e[0x1])['format'](_0x1a5c('0xa1'))};_0x3cf34c[_0x1a5c('0x56')]=_[_0x1a5c('0x55')](_0x3cf34c[_0x1a5c('0x56')],_0x1a6e99);}_0x3cf34c=_['merge']({},_0x3cf34c,_0x4a0223[_0x1a5c('0x57')]);return db[_0x1a5c('0x9f')][_0x1a5c('0x30')]({'where':_0x3cf34c[_0x1a5c('0x56')]})['then'](function(_0x25b876){_0x476c1d[_0x1a5c('0x30')]=_0x25b876;if(_0x4a0223[_0x1a5c('0x49')][_0x1a5c('0x58')]){_0x3cf34c[_0x1a5c('0x5f')]=[{'all':!![]}];}return db[_0x1a5c('0x9f')][_0x1a5c('0x59')](_0x3cf34c);})[_0x1a5c('0x25')](function(_0x5ba1c9){_0x476c1d['rows']=_0x5ba1c9;return _0x476c1d;});}})[_0x1a5c('0x25')](respondWithFilteredResult(_0x3cee2e,_0x3cf34c))[_0x1a5c('0x5a')](handleError(_0x3cee2e,null));};exports[_0x1a5c('0xa2')]=function(_0x372b12,_0x20fb49,_0x5ab145){var _0x3b6986,_0x491e12={},_0xbdf75e;if(_0x372b12[_0x1a5c('0x61')]['to']){_0xbdf75e=_0x372b12['body']['to'][_0x1a5c('0xa3')](',')[0x0];}return db[_0x1a5c('0x43')][_0x1a5c('0x60')]({'where':{'id':_0x372b12[_0x1a5c('0x5c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1a5c('0x8e')],'as':_0x1a5c('0xa4'),'where':{'email':_0xbdf75e},'limit':0x1,'order':[[_0x1a5c('0xa5'),'DESC']]}]},{'model':db[_0x1a5c('0x3e')],'as':_0x1a5c('0x3f'),'raw':!![]}]})[_0x1a5c('0x25')](handleEntityNotFound(_0x20fb49,null))[_0x1a5c('0x25')](function(_0x369160){if(_0x369160){_0x3b6986=_0x369160;if(_0x369160[_0x1a5c('0x3f')]){if(_[_0x1a5c('0x71')](_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xa6')])){_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xa6')]=util[_0x1a5c('0xa7')](_0x1a5c('0xa8'),_0x369160[_0x1a5c('0x3b')],_0x369160[_0x1a5c('0xa9')]||_0x369160[_0x1a5c('0x3f')][_0x1a5c('0x75')]);}if(_0x372b12['body'][_0x1a5c('0xaa')]&&_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xaa')][_0x1a5c('0x4e')]){for(var _0x2da1d0=0x0;_0x2da1d0<_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xaa')]['length'];_0x2da1d0+=0x1){_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xaa')][_0x2da1d0]={'filename':_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xaa')][_0x2da1d0][_0x1a5c('0x3b')],'path':path[_0x1a5c('0xab')](config[_0x1a5c('0xac')],_0x1a5c('0xad'),_0x372b12['body'][_0x1a5c('0xaa')][_0x2da1d0][_0x1a5c('0xae')])};}}var _0x4e8fcc={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x369160[_0x1a5c('0x3f')]['service'])){if(_0x369160['Smtp']['authentication']){_0x4e8fcc[_0x1a5c('0xaf')]={'user':_0x369160[_0x1a5c('0x3f')][_0x1a5c('0x75')],'pass':_0x369160[_0x1a5c('0x3f')]['pass']};}_0x4e8fcc[_0x1a5c('0x7a')]=_0x369160[_0x1a5c('0x3f')]['host'];_0x4e8fcc[_0x1a5c('0x7b')]=_0x369160[_0x1a5c('0x3f')][_0x1a5c('0x7b')];_0x4e8fcc[_0x1a5c('0xb0')]=_0x369160[_0x1a5c('0x3f')][_0x1a5c('0xb0')];}else{_0x4e8fcc['service']=_0x369160[_0x1a5c('0x3f')][_0x1a5c('0x7c')];_0x4e8fcc[_0x1a5c('0xaf')]={'user':_0x369160[_0x1a5c('0x3f')][_0x1a5c('0x75')],'pass':_0x369160[_0x1a5c('0x3f')][_0x1a5c('0x7d')]};}return respondWithRpcPromise(_0x1a5c('0xb1'),_0x1a5c('0xb2'),{'account':_0x4e8fcc,'message':_0x372b12[_0x1a5c('0x61')]});}else{throw new Error(_0x1a5c('0xb3'));}}})[_0x1a5c('0x25')](function(_0x526da8){if(_0x526da8){_0x491e12=_0x526da8;if(_0x3b6986['List']){if(_0x3b6986['List']['Contacts'][_0x1a5c('0x4e')]){return _0x3b6986[_0x1a5c('0xb4')][_0x1a5c('0xa4')][0x0];}else{return db[_0x1a5c('0x8e')]['create'](_[_0x1a5c('0x1a')](_0x372b12[_0x1a5c('0x61')],{'firstName':_0x372b12[_0x1a5c('0x61')]['to'],'email':_0x372b12[_0x1a5c('0x61')]['to'],'phone':_0x372b12[_0x1a5c('0x61')]['to'],'ListId':_0x3b6986[_0x1a5c('0x70')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x1a5c('0x25')](function(_0x27e17b){if(_0x27e17b){var _0x215755={'UserId':_0x372b12[_0x1a5c('0x75')]['id'],'ContactId':_0x27e17b['id'],'MailAccountId':_0x3b6986['id'],'inReplyTo':_0x491e12[_0x1a5c('0xb5')],'to':_0x372b12['body'][_0x1a5c('0xa6')],'cc':_0x372b12['body']['cc'],'subject':_0x372b12[_0x1a5c('0x61')]['subject'],'attach':_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xb6')],'firstMsgDirection':_0x1a5c('0xb7'),'lastMsgAt':moment()[_0x1a5c('0xa7')](_0x1a5c('0xa1')),'lastMsgDirection':_0x1a5c('0xb7'),'lastMsgBody':_0x372b12[_0x1a5c('0x61')][_0x1a5c('0x61')],'Messages':[_[_0x1a5c('0x55')](_0x372b12[_0x1a5c('0x61')],{'messageId':_0x491e12[_0x1a5c('0xb5')],'sentAt':moment()[_0x1a5c('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3b6986['id'],'UserId':_0x372b12[_0x1a5c('0x75')]['id'],'ContactId':_0x27e17b['id']})]};if(_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xb8')]){_0x215755=_[_0x1a5c('0x55')](_0x215755,_0x372b12[_0x1a5c('0x61')][_0x1a5c('0xb8')]);}return db['MailInteraction'][_0x1a5c('0x66')](_0x215755,{'include':[{'model':db[_0x1a5c('0x9f')],'as':'Messages'}]});}})['then'](respondWithResult(_0x20fb49,null))[_0x1a5c('0x5a')](handleError(_0x20fb49,null));};exports[_0x1a5c('0xb9')]=function(_0x4d116d,_0xe335c,_0x5d6f05){return db['MailAccount']['find']({'where':{'id':_0x4d116d[_0x1a5c('0x5c')]['id']},'include':[{'model':db[_0x1a5c('0x3e')],'as':_0x1a5c('0x3f'),'raw':!![]}]})[_0x1a5c('0x25')](handleEntityNotFound(_0xe335c,null))[_0x1a5c('0x25')](function(_0x248bd6){if(_0x248bd6&&_0x248bd6[_0x1a5c('0x3f')]){var _0x3b722f={'id':_0x248bd6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x248bd6[_0x1a5c('0x3f')][_0x1a5c('0x7c')]){_0x3b722f[_0x1a5c('0x7c')]=_0x248bd6[_0x1a5c('0x3f')]['service'];}else{_0x3b722f['host']=_0x248bd6['Smtp']['host'];_0x3b722f['port']=_0x248bd6[_0x1a5c('0x3f')][_0x1a5c('0x7b')];_0x3b722f[_0x1a5c('0xb0')]=_0x248bd6['Smtp'][_0x1a5c('0xb0')];}if(_0x248bd6['Smtp'][_0x1a5c('0x79')]){_0x3b722f['auth']={'user':_0x248bd6[_0x1a5c('0x3f')]['user'],'pass':_0x248bd6[_0x1a5c('0x3f')][_0x1a5c('0x7d')]};}return respondWithRpcPromise(_0x1a5c('0xba'),_0x1a5c('0xb9'),{'account':_0x3b722f});}})[_0x1a5c('0x25')](respondWithResult(_0xe335c,null))[_0x1a5c('0x5a')](handleError(_0xe335c,null));};exports['destroy']=function(_0x2587d6,_0x3f8b0c){return db[_0x1a5c('0x43')][_0x1a5c('0x60')]({'where':{'id':_0x2587d6['params']['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x3f8b0c,null))['then'](function(_0x58b857){if(_0x58b857&&_0x58b857[_0x1a5c('0x7c')]){throw new db[(_0x1a5c('0x21'))][(_0x1a5c('0x22'))](_0x1a5c('0xbb'));}return _0x58b857;})[_0x1a5c('0x25')](removeEntity(_0x3f8b0c,null))[_0x1a5c('0x5a')](handleError(_0x3f8b0c,null));};exports['addAgents']=function(_0x30d9e7,_0x2d31f9,_0x40aaf5){return db[_0x1a5c('0x43')]['find']({'where':{'id':_0x30d9e7[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x2d31f9,null))[_0x1a5c('0x25')](function(_0x1dcdb2){if(_0x1dcdb2){return _0x1dcdb2[_0x1a5c('0xbc')](_0x30d9e7[_0x1a5c('0x61')][_0x1a5c('0x6b')],_[_0x1a5c('0xbd')](_0x30d9e7[_0x1a5c('0x61')],['ids','id'])||{})[_0x1a5c('0xbe')](function(_0x54e7fa){for(var _0x70550f=0x0;_0x70550f<_0x30d9e7['body'][_0x1a5c('0x6b')][_0x1a5c('0x4e')];_0x70550f+=0x1){socket[_0x1a5c('0xbf')]('userMailAccount:save',{'UserId':_0x30d9e7['body']['ids'][_0x70550f],'MailAccountId':_0x30d9e7[_0x1a5c('0x5c')]['id']});}return _0x54e7fa;});}})[_0x1a5c('0x25')](respondWithResult(_0x2d31f9,null))[_0x1a5c('0x5a')](handleError(_0x2d31f9,null));};exports['removeAgents']=function(_0x5903dc,_0x41bfd8,_0x282120){return db['MailAccount']['find']({'where':{'id':_0x5903dc[_0x1a5c('0x5c')]['id']}})['then'](handleEntityNotFound(_0x41bfd8,null))[_0x1a5c('0x25')](function(_0x19e1ef){if(_0x19e1ef){return _0x19e1ef['removeAgents'](_0x5903dc[_0x1a5c('0x49')][_0x1a5c('0x6b')])['then'](function(){if(_[_0x1a5c('0xc0')](_0x5903dc[_0x1a5c('0x49')][_0x1a5c('0x6b')])){for(var _0x50d64f=0x0;_0x50d64f<_0x5903dc[_0x1a5c('0x49')]['ids']['length'];_0x50d64f+=0x1){socket['emit'](_0x1a5c('0xc1'),{'UserId':Number(_0x5903dc[_0x1a5c('0x49')][_0x1a5c('0x6b')][_0x50d64f]),'MailAccountId':Number(_0x5903dc[_0x1a5c('0x5c')]['id'])});}}else{socket[_0x1a5c('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x5903dc['query'][_0x1a5c('0x6b')]),'MailAccountId':Number(_0x5903dc[_0x1a5c('0x5c')]['id'])});}});}})[_0x1a5c('0x25')](respondWithStatusCode(_0x41bfd8,null))['catch'](handleError(_0x41bfd8,null));};exports[_0x1a5c('0xc2')]=function(_0x198a3d,_0x1d1d06,_0x2dac3c){var _0x54a383={};var _0x7fc812={};var _0x249f6a;var _0x1ddb8a;return db[_0x1a5c('0x43')][_0x1a5c('0x68')]({'where':{'id':_0x198a3d[_0x1a5c('0x5c')]['id']}})[_0x1a5c('0x25')](handleEntityNotFound(_0x1d1d06,null))['then'](function(_0x39a298){if(_0x39a298){_0x249f6a=_0x39a298;_0x7fc812[_0x1a5c('0x48')]=_[_0x1a5c('0x5e')](db[_0x1a5c('0x90')][_0x1a5c('0x44')]);_0x7fc812[_0x1a5c('0x49')]=_[_0x1a5c('0x5e')](_0x198a3d[_0x1a5c('0x49')]);_0x7fc812[_0x1a5c('0x4a')]=_['intersection'](_0x7fc812['model'],_0x7fc812[_0x1a5c('0x49')]);_0x54a383[_0x1a5c('0x4b')]=_['intersection'](_0x7fc812[_0x1a5c('0x48')],qs['fields'](_0x198a3d[_0x1a5c('0x49')][_0x1a5c('0x4d')]));_0x54a383[_0x1a5c('0x4b')]=_0x54a383[_0x1a5c('0x4b')]['length']?_0x54a383['attributes']:_0x7fc812[_0x1a5c('0x48')];_0x54a383[_0x1a5c('0x69')]=qs['sort'](_0x198a3d['query'][_0x1a5c('0x52')]);_0x54a383[_0x1a5c('0x56')]=qs['filters'](_[_0x1a5c('0x53')](_0x198a3d[_0x1a5c('0x49')],_0x7fc812[_0x1a5c('0x4a')]));if(_0x198a3d[_0x1a5c('0x49')][_0x1a5c('0x54')]){_0x54a383[_0x1a5c('0x56')]=_[_0x1a5c('0x55')](_0x54a383['where'],{'$or':_[_0x1a5c('0x42')](_0x54a383['attributes'],function(_0x41a208){var _0x4c4222={};_0x4c4222[_0x41a208]={'$like':'%'+_0x198a3d[_0x1a5c('0x49')][_0x1a5c('0x54')]+'%'};return _0x4c4222;})});}_0x54a383=_[_0x1a5c('0x55')]({},_0x54a383,_0x198a3d['options']);return _0x249f6a[_0x1a5c('0xc2')](_0x54a383);}})['then'](function(_0x49b553){if(_0x49b553){_0x1ddb8a=_0x49b553[_0x1a5c('0x4e')];if(!_0x198a3d[_0x1a5c('0x49')][_0x1a5c('0x4f')](_0x1a5c('0x50'))){_0x54a383['limit']=qs[_0x1a5c('0x51')](_0x198a3d[_0x1a5c('0x49')][_0x1a5c('0x51')]);_0x54a383[_0x1a5c('0x31')]=qs[_0x1a5c('0x31')](_0x198a3d[_0x1a5c('0x49')][_0x1a5c('0x31')]);}return _0x249f6a['getAgents'](_0x54a383);}})['then'](function(_0x37073f){if(_0x37073f){return _0x37073f?{'count':_0x1ddb8a,'rows':_0x37073f}:null;}})[_0x1a5c('0x25')](respondWithResult(_0x1d1d06,null))[_0x1a5c('0x5a')](handleError(_0x1d1d06,null));}; \ No newline at end of file +var _0xbea8=['rows','params','options','find','update','body','Imap','MailServerOut','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','cpassword','authentication','port','host','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','MailApplication','priority','getApplications','getMessages','$gte','MailMessage','split','List','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','pass','secure','auth','SendMail','sendMail','List\x20not\x20found','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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','defaults','redis','localhost','socket.io-emitter','register','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','stringify','error','code','message','result','catch','status','end','offset','limit','set','json','apply','reject','save','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','MailServerIn','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll'];(function(_0x372590,_0x1ebb65){var _0x21abe6=function(_0xce83f4){while(--_0xce83f4){_0x372590['push'](_0x372590['shift']());}};_0x21abe6(++_0x1ebb65);}(_0xbea8,0x64));var _0x8bea=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0xbea8[_0x41582d];return _0x59c504;};'use strict';var pdf=require(_0x8bea('0x0'));var emlformat=require(_0x8bea('0x1'));var rimraf=require(_0x8bea('0x2'));var zipdir=require(_0x8bea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8bea('0x4'));var moment=require(_0x8bea('0x5'));var BPromise=require(_0x8bea('0x6'));var Mustache=require(_0x8bea('0x7'));var util=require(_0x8bea('0x8'));var path=require(_0x8bea('0x9'));var sox=require(_0x8bea('0xa'));var csv=require('to-csv');var ejs=require(_0x8bea('0xb'));var fs=require('fs');var _=require(_0x8bea('0xc'));var squel=require(_0x8bea('0xd'));var crypto=require('crypto');var jsforce=require(_0x8bea('0xe'));var deskjs=require(_0x8bea('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8bea('0x10'));var Papa=require(_0x8bea('0x11'));var Redis=require(_0x8bea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8bea('0x13'));var as=require(_0x8bea('0x14'));var hardwareService=require(_0x8bea('0x15'));var logger=require(_0x8bea('0x16'))(_0x8bea('0x17'));var utils=require(_0x8bea('0x18'));var config=require(_0x8bea('0x19'));var db=require(_0x8bea('0x1a'))['db'];config['redis']=_[_0x8bea('0x1b')](config[_0x8bea('0x1c')],{'host':_0x8bea('0x1d'),'port':0x18eb});var socket=require(_0x8bea('0x1e'))(new Redis(config[_0x8bea('0x1c')]));require('./mailAccount.socket')[_0x8bea('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function checkPasswordPattern(_0x2a3186,_0x214b9e,_0xa34a23){if(_0xa34a23){var _0x220bae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x220bae[_0x8bea('0x20')](_0x214b9e)){return _0x2a3186;}else{throw new db['Sequelize'][(_0x8bea('0x21'))](_0x8bea('0x22'));}}else{return _0x2a3186;}}function respondWithRpcPromise(_0x4880b4,_0x18e99b,_0x59713b,_0x1e99e7){return new BPromise(function(_0x3fed84,_0x3cdfd1){var _0xd9d7a=_0x1e99e7||client;return _0xd9d7a[_0x8bea('0x23')](_0x4880b4,_0x59713b)['then'](function(_0x5e3e16){logger[_0x8bea('0x24')](_0x8bea('0x25'),_0x18e99b,'request\x20sent');logger[_0x8bea('0x26')](_0x8bea('0x27'),_0x18e99b,'request\x20sent',JSON[_0x8bea('0x28')](_0x5e3e16));if(_0x5e3e16[_0x8bea('0x29')]){if(_0x5e3e16[_0x8bea('0x29')][_0x8bea('0x2a')]===0x1f4){logger[_0x8bea('0x29')](_0x8bea('0x25'),_0x18e99b,_0x5e3e16[_0x8bea('0x29')][_0x8bea('0x2b')]);return _0x3cdfd1(_0x5e3e16[_0x8bea('0x29')][_0x8bea('0x2b')]);}logger[_0x8bea('0x29')]('MailAccount,\x20%s,\x20%s',_0x18e99b,_0x5e3e16['error'][_0x8bea('0x2b')]);return _0x3fed84(_0x5e3e16[_0x8bea('0x29')][_0x8bea('0x2b')]);}else{logger['info'](_0x8bea('0x25'),_0x18e99b,'request\x20sent');_0x3fed84(_0x5e3e16[_0x8bea('0x2c')]['message']);}})[_0x8bea('0x2d')](function(_0x6b0c71){logger[_0x8bea('0x29')](_0x8bea('0x25'),_0x18e99b,_0x6b0c71);_0x3cdfd1(_0x6b0c71);});});}function respondWithStatusCode(_0x65495,_0xfa9f2f){_0xfa9f2f=_0xfa9f2f||0xcc;return function(_0x4b6efc){if(_0x4b6efc){return _0x65495['sendStatus'](_0xfa9f2f);}return _0x65495[_0x8bea('0x2e')](_0xfa9f2f)[_0x8bea('0x2f')]();};}function respondWithResult(_0x231dd0,_0x208580){_0x208580=_0x208580||0xc8;return function(_0x2e1d10){if(_0x2e1d10){return _0x231dd0[_0x8bea('0x2e')](_0x208580)['json'](_0x2e1d10);}};}function respondWithFilteredResult(_0x4b9940,_0x1a7a52){return function(_0x5d6f74){if(_0x5d6f74){var _0x386315=_0x5d6f74['count'],_0x4c8113=_0x1a7a52[_0x8bea('0x30')],_0x3af7c5=_0x1a7a52[_0x8bea('0x30')]+_0x1a7a52[_0x8bea('0x31')],_0x187543;if(_0x3af7c5>=_0x386315){_0x3af7c5=_0x386315;_0x187543=0xc8;}else{_0x187543=0xce;}_0x4b9940[_0x8bea('0x2e')](_0x187543);return _0x4b9940[_0x8bea('0x32')]('Content-Range',_0x4c8113+'-'+_0x3af7c5+'/'+_0x386315)[_0x8bea('0x33')](_0x5d6f74);}return null;};}function patchUpdates(_0x107726){return function(_0x4e052e){try{jsonpatch[_0x8bea('0x34')](_0x4e052e,_0x107726,!![]);}catch(_0x1e64ae){return BPromise[_0x8bea('0x35')](_0x1e64ae);}return _0x4e052e[_0x8bea('0x36')]();};}function saveUpdates(_0x44c167,_0x56955a){return function(_0x1dc8f3){if(_0x1dc8f3){return _0x1dc8f3['update'](_0x44c167)[_0x8bea('0x37')](function(_0x590611){return _0x590611;});}return null;};}function removeEntity(_0x519e33,_0x12ad2f){return function(_0x12c41f){if(_0x12c41f){return _0x12c41f['destroy']()[_0x8bea('0x37')](function(){var _0x6afb11=_0x12c41f[_0x8bea('0x38')]({'plain':!![]});var _0x3185eb='MailAccounts';return db[_0x8bea('0x39')][_0x8bea('0x3a')]({'where':{'type':_0x3185eb,'resourceId':_0x6afb11['id']}})['then'](function(){return _0x12c41f;});})[_0x8bea('0x37')](function(){_0x519e33[_0x8bea('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43deb9,_0x1a2d53){return function(_0x4670a0){if(!_0x4670a0){_0x43deb9[_0x8bea('0x3b')](0x194);}return _0x4670a0;};}function handleError(_0x36bd86,_0x31b51a){_0x31b51a=_0x31b51a||0x1f4;return function(_0x1b5bf4){logger[_0x8bea('0x29')](_0x1b5bf4[_0x8bea('0x3c')]);if(_0x1b5bf4['name']){delete _0x1b5bf4[_0x8bea('0x3d')];}_0x36bd86[_0x8bea('0x2e')](_0x31b51a)[_0x8bea('0x3e')](_0x1b5bf4);};}exports[_0x8bea('0x3f')]=function(_0x148434,_0x25035f){var _0x5ad54b={'include':[{'model':db[_0x8bea('0x40')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x8bea('0x41')},{'model':db[_0x8bea('0x42')],'as':_0x8bea('0x43')}]},_0x24f0df={},_0x561342={'count':0x0,'rows':[]};var _0x22872f=_[_0x8bea('0x44')](db[_0x8bea('0x45')][_0x8bea('0x46')],function(_0x180ef4){return{'name':_0x180ef4[_0x8bea('0x47')],'type':_0x180ef4[_0x8bea('0x48')][_0x8bea('0x49')]};});_0x24f0df[_0x8bea('0x4a')]=_['map'](_0x22872f,_0x8bea('0x3d'));_0x24f0df[_0x8bea('0x4b')]=_[_0x8bea('0x4c')](_0x148434[_0x8bea('0x4b')]);_0x24f0df[_0x8bea('0x4d')]=_[_0x8bea('0x4e')](_0x24f0df[_0x8bea('0x4a')],_0x24f0df['query']);_0x5ad54b['attributes']=_[_0x8bea('0x4e')](_0x24f0df[_0x8bea('0x4a')],qs[_0x8bea('0x4f')](_0x148434['query']['fields']));_0x5ad54b[_0x8bea('0x50')]=_0x5ad54b['attributes'][_0x8bea('0x51')]?_0x5ad54b[_0x8bea('0x50')]:_0x24f0df['model'];if(!_0x148434[_0x8bea('0x4b')][_0x8bea('0x52')](_0x8bea('0x53'))){_0x5ad54b[_0x8bea('0x31')]=qs[_0x8bea('0x31')](_0x148434[_0x8bea('0x4b')][_0x8bea('0x31')]);_0x5ad54b['offset']=qs[_0x8bea('0x30')](_0x148434[_0x8bea('0x4b')][_0x8bea('0x30')]);}_0x5ad54b[_0x8bea('0x54')]=qs[_0x8bea('0x55')](_0x148434[_0x8bea('0x4b')][_0x8bea('0x55')]);_0x5ad54b[_0x8bea('0x56')]=qs[_0x8bea('0x4d')](_[_0x8bea('0x57')](_0x148434[_0x8bea('0x4b')],_0x24f0df['filters']),_0x22872f);if(_0x148434[_0x8bea('0x4b')][_0x8bea('0x58')]){_0x5ad54b['where']=_[_0x8bea('0x59')](_0x5ad54b[_0x8bea('0x56')],{'$or':_[_0x8bea('0x44')](_0x22872f,function(_0x388a0d){if(_0x388a0d[_0x8bea('0x48')]!=='VIRTUAL'){var _0x2210fc={};_0x2210fc[_0x388a0d['name']]={'$like':'%'+_0x148434[_0x8bea('0x4b')][_0x8bea('0x58')]+'%'};return _0x2210fc;}})});}_0x5ad54b=_['merge']({},_0x5ad54b,_0x148434['options']);var _0x1a3e4b={'where':_0x5ad54b[_0x8bea('0x56')]};return db[_0x8bea('0x45')][_0x8bea('0x5a')](_0x1a3e4b)['then'](function(_0x352b66){_0x561342[_0x8bea('0x5a')]=_0x352b66;if(_0x148434[_0x8bea('0x4b')][_0x8bea('0x5b')]){_0x5ad54b[_0x8bea('0x5c')]=[{'all':!![]}];}return db[_0x8bea('0x45')][_0x8bea('0x5d')](_0x5ad54b);})[_0x8bea('0x37')](function(_0x3e74f2){_0x561342[_0x8bea('0x5e')]=_0x3e74f2;return _0x561342;})[_0x8bea('0x37')](respondWithFilteredResult(_0x25035f,_0x5ad54b))[_0x8bea('0x2d')](handleError(_0x25035f,null));};exports['show']=function(_0x6b197f,_0x4b5d13){var _0x59d6a5={'raw':![],'where':{'id':_0x6b197f[_0x8bea('0x5f')]['id']},'include':[{'model':db[_0x8bea('0x40')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x8bea('0x41')},{'model':db['Pause'],'as':_0x8bea('0x43')}]},_0x3e3762={};_0x3e3762['model']=_[_0x8bea('0x4c')](db['MailAccount'][_0x8bea('0x46')]);_0x3e3762[_0x8bea('0x4b')]=_['keys'](_0x6b197f[_0x8bea('0x4b')]);_0x3e3762[_0x8bea('0x4d')]=_[_0x8bea('0x4e')](_0x3e3762[_0x8bea('0x4a')],_0x3e3762[_0x8bea('0x4b')]);_0x59d6a5[_0x8bea('0x50')]=_[_0x8bea('0x4e')](_0x3e3762[_0x8bea('0x4a')],qs[_0x8bea('0x4f')](_0x6b197f['query'][_0x8bea('0x4f')]));_0x59d6a5['attributes']=_0x59d6a5[_0x8bea('0x50')][_0x8bea('0x51')]?_0x59d6a5['attributes']:_0x3e3762[_0x8bea('0x4a')];if(_0x6b197f['query'][_0x8bea('0x5b')]){_0x59d6a5['include']=[{'all':!![]}];}_0x59d6a5=_[_0x8bea('0x59')]({},_0x59d6a5,_0x6b197f[_0x8bea('0x60')]);return db['MailAccount'][_0x8bea('0x61')](_0x59d6a5)['then'](handleEntityNotFound(_0x4b5d13,null))['then'](respondWithResult(_0x4b5d13,null))[_0x8bea('0x2d')](handleError(_0x4b5d13,null));};exports[_0x8bea('0x62')]=function(_0x2e2f52,_0x2336dc){if(_0x2e2f52[_0x8bea('0x63')]['id']){delete _0x2e2f52['body']['id'];}return db['MailAccount'][_0x8bea('0x61')]({'where':{'id':_0x2e2f52[_0x8bea('0x5f')]['id']},'include':[{'model':db[_0x8bea('0x40')],'as':_0x8bea('0x64')},{'model':db[_0x8bea('0x65')],'as':'Smtp'},{'model':db['Pause'],'as':_0x8bea('0x43')}]})[_0x8bea('0x37')](handleEntityNotFound(_0x2336dc,null))['then'](saveUpdates(_0x2e2f52[_0x8bea('0x63')],null))[_0x8bea('0x37')](function(_0x10f65a){if(_0x10f65a&&_0x2e2f52['body'][_0x8bea('0x64')]){return db[_0x8bea('0x40')][_0x8bea('0x62')](_0x2e2f52[_0x8bea('0x63')][_0x8bea('0x64')],{'where':{'MailAccountId':_0x10f65a['id']}})[_0x8bea('0x37')](function(){return _0x10f65a;});}return _0x10f65a;})[_0x8bea('0x37')](function(_0x18f00c){if(_0x18f00c&&_0x2e2f52['body'][_0x8bea('0x41')]){return db[_0x8bea('0x65')]['update'](_0x2e2f52['body'][_0x8bea('0x41')],{'where':{'MailAccountId':_0x18f00c['id']}})[_0x8bea('0x37')](function(){return _0x18f00c;});}return _0x18f00c;})['then'](respondWithResult(_0x2336dc,null))['catch'](handleError(_0x2336dc,null));};exports['describe']=function(_0x50582e,_0x2b2f97){return db[_0x8bea('0x45')][_0x8bea('0x66')]()[_0x8bea('0x37')](respondWithResult(_0x2b2f97,null))['catch'](handleError(_0x2b2f97,null));};exports[_0x8bea('0x67')]=function(_0x3c3dfa,_0x5600d2,_0x4f949c){if(_0x3c3dfa['body']['id']){delete _0x3c3dfa[_0x8bea('0x63')]['id'];}return db[_0x8bea('0x45')][_0x8bea('0x61')]({'where':{'id':_0x3c3dfa['params']['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x5600d2,null))[_0x8bea('0x37')](function(_0x45e6fc){if(_0x45e6fc){_0x3c3dfa[_0x8bea('0x63')][_0x8bea('0x68')]=_0x45e6fc['id'];return db[_0x8bea('0x69')][_0x8bea('0x6a')](_0x3c3dfa['body']);}})[_0x8bea('0x37')](respondWithResult(_0x5600d2,null))[_0x8bea('0x2d')](handleError(_0x5600d2,null));};exports[_0x8bea('0x6b')]=function(_0x198347,_0x2d46a5,_0x989cbf){var _0x475aa8={'raw':![],'where':{}};var _0x37c78b={};var _0x246b3b={'count':0x0,'rows':[]};return db[_0x8bea('0x45')][_0x8bea('0x6c')]({'where':{'id':_0x198347[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x2d46a5,null))[_0x8bea('0x37')](function(_0x17d207){if(_0x17d207){_0x37c78b[_0x8bea('0x4a')]=_['keys'](db[_0x8bea('0x69')][_0x8bea('0x46')]);_0x37c78b[_0x8bea('0x4b')]=_[_0x8bea('0x4c')](_0x198347[_0x8bea('0x4b')]);_0x37c78b[_0x8bea('0x4d')]=_[_0x8bea('0x4e')](_0x37c78b[_0x8bea('0x4a')],_0x37c78b[_0x8bea('0x4b')]);_0x475aa8[_0x8bea('0x50')]=_['intersection'](_0x37c78b['model'],qs[_0x8bea('0x4f')](_0x198347[_0x8bea('0x4b')]['fields']));_0x475aa8['attributes']=_0x475aa8[_0x8bea('0x50')]['length']?_0x475aa8[_0x8bea('0x50')]:_0x37c78b[_0x8bea('0x4a')];if(!_0x198347['query'][_0x8bea('0x52')](_0x8bea('0x53'))){_0x475aa8['limit']=qs['limit'](_0x198347[_0x8bea('0x4b')]['limit']);_0x475aa8['offset']=qs[_0x8bea('0x30')](_0x198347['query']['offset']);}_0x475aa8[_0x8bea('0x54')]=qs[_0x8bea('0x55')](_0x198347['query']['sort']);_0x475aa8[_0x8bea('0x56')]=qs[_0x8bea('0x4d')](_[_0x8bea('0x57')](_0x198347[_0x8bea('0x4b')],_0x37c78b['filters']));_0x475aa8['where'][_0x8bea('0x68')]=_0x17d207['id'];if(_0x198347[_0x8bea('0x4b')][_0x8bea('0x58')]){_0x475aa8[_0x8bea('0x56')]=_[_0x8bea('0x59')](_0x475aa8[_0x8bea('0x56')],{'$or':_['map'](_0x475aa8[_0x8bea('0x50')],function(_0x2cc730){var _0x2c3fca={};_0x2c3fca[_0x2cc730]={'$like':'%'+_0x198347[_0x8bea('0x4b')][_0x8bea('0x58')]+'%'};return _0x2c3fca;})});}_0x475aa8=_[_0x8bea('0x59')]({},_0x475aa8,_0x198347[_0x8bea('0x60')]);return db[_0x8bea('0x69')]['count']({'where':_0x475aa8['where']})[_0x8bea('0x37')](function(_0x50157b){_0x246b3b[_0x8bea('0x5a')]=_0x50157b;if(_0x198347[_0x8bea('0x4b')][_0x8bea('0x5b')]){_0x475aa8[_0x8bea('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x8bea('0x5d')](_0x475aa8);})[_0x8bea('0x37')](function(_0x4db508){_0x246b3b[_0x8bea('0x5e')]=_0x4db508;return _0x246b3b;});}})[_0x8bea('0x37')](respondWithFilteredResult(_0x2d46a5,_0x475aa8))['catch'](handleError(_0x2d46a5,null));};exports[_0x8bea('0x6d')]=function(_0x2df84d,_0x43fcc8,_0xbd6f65){return db[_0x8bea('0x45')][_0x8bea('0x61')]({'where':{'id':_0x2df84d[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x43fcc8,null))[_0x8bea('0x37')](function(_0x429504){if(_0x429504){return _0x429504[_0x8bea('0x6d')](_0x2df84d['query'][_0x8bea('0x6e')]);}})[_0x8bea('0x37')](respondWithStatusCode(_0x43fcc8,null))[_0x8bea('0x2d')](handleError(_0x43fcc8,null));};exports[_0x8bea('0x6f')]=function(_0x247e42,_0x291b86,_0x354b36){if(_0x247e42['body']['id']){delete _0x247e42[_0x8bea('0x63')]['id'];}return db[_0x8bea('0x45')][_0x8bea('0x61')]({'where':{'id':_0x247e42['params']['id']}})['then'](handleEntityNotFound(_0x291b86,null))[_0x8bea('0x37')](function(_0x429100){if(_0x429100){_0x247e42[_0x8bea('0x63')]['MailAccountId']=_0x429100['id'];return db[_0x8bea('0x70')]['create'](_0x247e42[_0x8bea('0x63')]);}})[_0x8bea('0x37')](respondWithResult(_0x291b86,null))[_0x8bea('0x2d')](handleError(_0x291b86,null));};exports[_0x8bea('0x71')]=function(_0x3906e8,_0x131535,_0x79698){var _0x5271fa={'raw':![],'where':{}};var _0x4023a1={};var _0x18ff5a={'count':0x0,'rows':[]};return db[_0x8bea('0x45')]['findOne']({'where':{'id':_0x3906e8[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x131535,null))[_0x8bea('0x37')](function(_0x181197){if(_0x181197){_0x4023a1[_0x8bea('0x4a')]=_[_0x8bea('0x4c')](db[_0x8bea('0x70')][_0x8bea('0x46')]);_0x4023a1['query']=_[_0x8bea('0x4c')](_0x3906e8[_0x8bea('0x4b')]);_0x4023a1[_0x8bea('0x4d')]=_[_0x8bea('0x4e')](_0x4023a1['model'],_0x4023a1[_0x8bea('0x4b')]);_0x5271fa[_0x8bea('0x50')]=_[_0x8bea('0x4e')](_0x4023a1[_0x8bea('0x4a')],qs[_0x8bea('0x4f')](_0x3906e8['query'][_0x8bea('0x4f')]));_0x5271fa[_0x8bea('0x50')]=_0x5271fa[_0x8bea('0x50')][_0x8bea('0x51')]?_0x5271fa[_0x8bea('0x50')]:_0x4023a1[_0x8bea('0x4a')];if(!_0x3906e8[_0x8bea('0x4b')]['hasOwnProperty'](_0x8bea('0x53'))){_0x5271fa['limit']=qs[_0x8bea('0x31')](_0x3906e8[_0x8bea('0x4b')][_0x8bea('0x31')]);_0x5271fa[_0x8bea('0x30')]=qs[_0x8bea('0x30')](_0x3906e8[_0x8bea('0x4b')]['offset']);}_0x5271fa['order']=qs[_0x8bea('0x55')](_0x3906e8['query'][_0x8bea('0x55')]);_0x5271fa[_0x8bea('0x56')]=qs[_0x8bea('0x4d')](_[_0x8bea('0x57')](_0x3906e8[_0x8bea('0x4b')],_0x4023a1['filters']));_0x5271fa[_0x8bea('0x56')][_0x8bea('0x68')]=_0x181197['id'];if(_0x3906e8[_0x8bea('0x4b')][_0x8bea('0x58')]){_0x5271fa['where']=_['merge'](_0x5271fa[_0x8bea('0x56')],{'$or':_[_0x8bea('0x44')](_0x5271fa[_0x8bea('0x50')],function(_0x3cf1f4){var _0x3e93a4={};_0x3e93a4[_0x3cf1f4]={'$like':'%'+_0x3906e8[_0x8bea('0x4b')]['filter']+'%'};return _0x3e93a4;})});}_0x5271fa=_['merge']({},_0x5271fa,_0x3906e8[_0x8bea('0x60')]);return db[_0x8bea('0x70')][_0x8bea('0x5a')]({'where':_0x5271fa[_0x8bea('0x56')]})['then'](function(_0x584fd5){_0x18ff5a[_0x8bea('0x5a')]=_0x584fd5;if(_0x3906e8[_0x8bea('0x4b')][_0x8bea('0x5b')]){_0x5271fa['include']=[{'all':!![]}];}return db[_0x8bea('0x70')]['findAll'](_0x5271fa);})['then'](function(_0x19a9ec){_0x18ff5a[_0x8bea('0x5e')]=_0x19a9ec;return _0x18ff5a;});}})['then'](respondWithFilteredResult(_0x131535,_0x5271fa))[_0x8bea('0x2d')](handleError(_0x131535,null));};exports[_0x8bea('0x72')]=function(_0x307fae,_0x60e237,_0x3e115f){return db[_0x8bea('0x45')][_0x8bea('0x61')]({'where':{'id':_0x307fae[_0x8bea('0x5f')]['id']}})['then'](handleEntityNotFound(_0x60e237,null))[_0x8bea('0x37')](function(_0xb9342){if(_0xb9342){return _0xb9342[_0x8bea('0x72')](_0x307fae[_0x8bea('0x4b')]['ids']);}})[_0x8bea('0x37')](respondWithStatusCode(_0x60e237,null))[_0x8bea('0x2d')](handleError(_0x60e237,null));};exports[_0x8bea('0x6a')]=function(_0x382320,_0x427274){var _0x157f30={'name':_0x382320[_0x8bea('0x63')][_0x8bea('0x3d')],'key':_0x382320['body'][_0x8bea('0x49')],'email':_0x382320[_0x8bea('0x63')][_0x8bea('0x73')],'ListId':_0x382320[_0x8bea('0x63')][_0x8bea('0x74')],'active':!_[_0x8bea('0x75')](_0x382320[_0x8bea('0x63')]['active'])?_0x382320[_0x8bea('0x63')][_0x8bea('0x76')]:!![],'description':_0x382320[_0x8bea('0x63')][_0x8bea('0x77')]||null,'Imap':{},'Smtp':{}};if(_[_0x8bea('0x75')](_0x382320[_0x8bea('0x63')][_0x8bea('0x78')])){if(_0x382320['body'][_0x8bea('0x79')]){_0x157f30[_0x8bea('0x64')][_0x8bea('0x7a')]=_0x157f30['Smtp']['user']=_0x382320['body'][_0x8bea('0x7b')];_0x157f30[_0x8bea('0x64')][_0x8bea('0x7c')]=_0x157f30[_0x8bea('0x41')]['pass']=_0x382320[_0x8bea('0x63')][_0x8bea('0x7d')];}else{_0x157f30[_0x8bea('0x64')][_0x8bea('0x7e')]=_0x157f30[_0x8bea('0x41')]['authentication']=![];}_0x157f30[_0x8bea('0x64')]['host']=_0x382320[_0x8bea('0x63')][_0x8bea('0x64')]['host'];_0x157f30[_0x8bea('0x64')]['port']=_0x382320[_0x8bea('0x63')][_0x8bea('0x64')][_0x8bea('0x7f')];_0x157f30[_0x8bea('0x41')][_0x8bea('0x80')]=_0x382320[_0x8bea('0x63')][_0x8bea('0x41')]['host'];_0x157f30[_0x8bea('0x41')][_0x8bea('0x7f')]=_0x382320['body'][_0x8bea('0x41')][_0x8bea('0x7f')];}else{_0x157f30[_0x8bea('0x64')][_0x8bea('0x81')]=_0x157f30[_0x8bea('0x41')][_0x8bea('0x81')]=_0x382320[_0x8bea('0x63')]['cservice'];_0x157f30['Imap']['user']=_0x157f30[_0x8bea('0x41')][_0x8bea('0x7a')]=_0x382320['body']['cuser'];_0x157f30[_0x8bea('0x64')][_0x8bea('0x7c')]=_0x157f30[_0x8bea('0x41')]['pass']=_0x382320[_0x8bea('0x63')][_0x8bea('0x7d')];}return db[_0x8bea('0x45')][_0x8bea('0x6a')](_0x157f30,{'include':[{'model':db[_0x8bea('0x65')],'as':_0x8bea('0x41')},{'model':db['MailServerIn'],'as':_0x8bea('0x64')}]})[_0x8bea('0x37')](function(_0x3c0c7e){var _0x32574e=_0x382320[_0x8bea('0x7a')][_0x8bea('0x38')]({'plain':!![]});if(!_0x32574e)throw new Error(_0x8bea('0x82'));if(_0x32574e['role']==='user'){var _0x6306bf=_0x3c0c7e['get']({'plain':!![]});return db[_0x8bea('0x83')][_0x8bea('0x61')]({'where':{'name':_0x8bea('0x84'),'userProfileId':_0x32574e['userProfileId']},'raw':!![]})[_0x8bea('0x37')](function(_0x2c8408){if(_0x2c8408&&_0x2c8408['autoAssociation']===0x0){return db[_0x8bea('0x39')][_0x8bea('0x6a')]({'name':_0x6306bf[_0x8bea('0x3d')],'resourceId':_0x6306bf['id'],'type':_0x2c8408[_0x8bea('0x3d')],'sectionId':_0x2c8408['id']},{})[_0x8bea('0x37')](function(){return _0x3c0c7e;});}else{return _0x3c0c7e;}})[_0x8bea('0x2d')](function(_0xce8792){logger[_0x8bea('0x29')](_0x8bea('0x85'),_0xce8792);throw _0xce8792;});}return _0x3c0c7e;})[_0x8bea('0x37')](respondWithResult(_0x427274,0xc9))[_0x8bea('0x2d')](handleError(_0x427274,null));};exports['getImap']=function(_0x49f640,_0x520f51,_0x4f2e22){return db[_0x8bea('0x45')]['findOne']({'where':{'id':_0x49f640['params']['id']}})['then'](handleEntityNotFound(_0x520f51,null))[_0x8bea('0x37')](function(_0x22b84){if(_0x22b84){return _0x22b84[_0x8bea('0x86')]();}return null;})[_0x8bea('0x37')](respondWithResult(_0x520f51,null))[_0x8bea('0x2d')](handleError(_0x520f51,null));};exports[_0x8bea('0x87')]=function(_0x52b7fe,_0x3330ac,_0x3c8362){if(_0x52b7fe[_0x8bea('0x63')]['id']){delete _0x52b7fe[_0x8bea('0x63')]['id'];}return db[_0x8bea('0x45')]['find']({'where':{'id':_0x52b7fe[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x3330ac,null))[_0x8bea('0x37')](function(_0x4bf1c7){if(_0x4bf1c7){_0x52b7fe[_0x8bea('0x63')][_0x8bea('0x68')]=_0x4bf1c7['id'];return db[_0x8bea('0x40')][_0x8bea('0x6a')](_0x52b7fe[_0x8bea('0x63')]);}})[_0x8bea('0x37')](respondWithResult(_0x3330ac,null))[_0x8bea('0x2d')](handleError(_0x3330ac,null));};exports[_0x8bea('0x88')]=function(_0x4875e8,_0x22eca2,_0x1a3b76){return db['MailAccount']['findOne']({'where':{'id':_0x4875e8[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x22eca2,null))[_0x8bea('0x37')](function(_0x58cc30){if(_0x58cc30){return _0x58cc30[_0x8bea('0x89')](null);}return null;})[_0x8bea('0x37')](respondWithStatusCode(_0x22eca2,null))['catch'](handleError(_0x22eca2,null));};exports[_0x8bea('0x8a')]=function(_0x160f43,_0x3656bc,_0x665807){return db['MailAccount'][_0x8bea('0x6c')]({'where':{'id':_0x160f43[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x3656bc,null))['then'](function(_0x341d76){if(_0x341d76){return _0x341d76['getSmtp']();}return null;})['then'](respondWithResult(_0x3656bc,null))['catch'](handleError(_0x3656bc,null));};exports[_0x8bea('0x8b')]=function(_0x52efb0,_0xb2be0a,_0x4f172d){if(_0x52efb0[_0x8bea('0x63')]['id']){delete _0x52efb0['body']['id'];}return db[_0x8bea('0x45')][_0x8bea('0x61')]({'where':{'id':_0x52efb0[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0xb2be0a,null))[_0x8bea('0x37')](function(_0x4ee972){if(_0x4ee972){_0x52efb0[_0x8bea('0x63')][_0x8bea('0x68')]=_0x4ee972['id'];return db[_0x8bea('0x65')][_0x8bea('0x6a')](_0x52efb0[_0x8bea('0x63')]);}})[_0x8bea('0x37')](respondWithResult(_0xb2be0a,null))[_0x8bea('0x2d')](handleError(_0xb2be0a,null));};exports['removeSmtp']=function(_0x2d230d,_0x536586,_0x4b64b1){return db[_0x8bea('0x45')]['findOne']({'where':{'id':_0x2d230d[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x536586,null))[_0x8bea('0x37')](function(_0x5633a6){if(_0x5633a6){return _0x5633a6[_0x8bea('0x8c')](null);}return null;})[_0x8bea('0x37')](respondWithStatusCode(_0x536586,null))['catch'](handleError(_0x536586,null));};exports[_0x8bea('0x8d')]=function(_0x2cac61,_0x40064c,_0x52ea0c){return db['MailInteraction'][_0x8bea('0x61')]({'where':{'id':_0x2cac61[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x40064c,null))['then'](function(_0x35b9ed){if(_0x35b9ed){return _0x35b9ed['addInteraction'](_0x2cac61[_0x8bea('0x63')][_0x8bea('0x6e')],_['omit'](_0x2cac61[_0x8bea('0x63')],['ids','id'])||{});}})[_0x8bea('0x37')](respondWithResult(_0x40064c,null))[_0x8bea('0x2d')](handleError(_0x40064c,null));};exports[_0x8bea('0x8e')]=function(_0x36ec3e,_0x34e8a1,_0x16969b){var _0x48cc57={'raw':![],'where':{}};var _0x1e319a={};var _0x36fe39={'count':0x0,'rows':[]};return db[_0x8bea('0x45')][_0x8bea('0x6c')]({'where':{'id':_0x36ec3e[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x34e8a1,null))[_0x8bea('0x37')](function(_0xb82c09){if(_0xb82c09){_0x1e319a['model']=_['keys'](db[_0x8bea('0x8f')][_0x8bea('0x46')]);_0x1e319a['query']=_[_0x8bea('0x4c')](_0x36ec3e['query']);_0x1e319a[_0x8bea('0x4d')]=_[_0x8bea('0x4e')](_0x1e319a[_0x8bea('0x4a')],_0x1e319a[_0x8bea('0x4b')]);_0x48cc57['attributes']=_[_0x8bea('0x4e')](_0x1e319a[_0x8bea('0x4a')],qs[_0x8bea('0x4f')](_0x36ec3e[_0x8bea('0x4b')][_0x8bea('0x4f')]));_0x48cc57[_0x8bea('0x50')]=_0x48cc57[_0x8bea('0x50')][_0x8bea('0x51')]?_0x48cc57[_0x8bea('0x50')]:_0x1e319a[_0x8bea('0x4a')];if(!_0x36ec3e[_0x8bea('0x4b')][_0x8bea('0x52')]('nolimit')){_0x48cc57[_0x8bea('0x31')]=qs[_0x8bea('0x31')](_0x36ec3e[_0x8bea('0x4b')][_0x8bea('0x31')]);_0x48cc57[_0x8bea('0x30')]=qs[_0x8bea('0x30')](_0x36ec3e['query'][_0x8bea('0x30')]);}_0x48cc57[_0x8bea('0x54')]=qs[_0x8bea('0x55')](_0x36ec3e[_0x8bea('0x4b')]['sort']);_0x48cc57[_0x8bea('0x56')]=qs[_0x8bea('0x4d')](_[_0x8bea('0x57')](_0x36ec3e[_0x8bea('0x4b')],_0x1e319a[_0x8bea('0x4d')]));_0x48cc57[_0x8bea('0x56')][_0x8bea('0x68')]=_0xb82c09['id'];if(_0x36ec3e[_0x8bea('0x4b')]['filter']){_0x48cc57[_0x8bea('0x56')]=_['merge'](_0x48cc57[_0x8bea('0x56')],{'$or':_[_0x8bea('0x44')](_0x48cc57['attributes'],function(_0x40a669){var _0xc1ee13={};_0xc1ee13[_0x40a669]={'$like':'%'+_0x36ec3e['query'][_0x8bea('0x58')]+'%'};return _0xc1ee13;})});}_0x48cc57=_[_0x8bea('0x59')]({},_0x48cc57,_0x36ec3e['options']);return db['MailInteraction'][_0x8bea('0x5a')]({'where':_0x48cc57[_0x8bea('0x56')]})[_0x8bea('0x37')](function(_0x4b3d03){_0x36fe39[_0x8bea('0x5a')]=_0x4b3d03;if(_0x36ec3e['query'][_0x8bea('0x5b')]){_0x48cc57[_0x8bea('0x5c')]=[{'model':db[_0x8bea('0x90')],'as':'Contact','required':![]},{'model':db[_0x8bea('0x91')],'as':_0x8bea('0x92'),'attributes':['name',_0x8bea('0x93'),'internal'],'required':![]},{'model':db[_0x8bea('0x94')],'as':_0x8bea('0x95'),'attributes':['id','name',_0x8bea('0x96')],'where':_0x36ec3e[_0x8bea('0x4b')]['tag']?{'id':_0x36ec3e[_0x8bea('0x4b')][_0x8bea('0x97')]}:undefined,'required':_0x36ec3e['query'][_0x8bea('0x97')]?!![]:![]}];}return db['MailInteraction'][_0x8bea('0x5d')](_0x48cc57);})[_0x8bea('0x37')](function(_0x30d9ce){_0x36fe39[_0x8bea('0x5e')]=_0x30d9ce;return _0x36fe39;});}})['then'](respondWithFilteredResult(_0x34e8a1,_0x48cc57))[_0x8bea('0x2d')](handleError(_0x34e8a1,null));};exports[_0x8bea('0x98')]=function(_0x4b1847,_0x2abb8f,_0x48e126){return db[_0x8bea('0x45')][_0x8bea('0x6c')]({'where':{'id':_0x4b1847[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x2abb8f,null))['then'](function(_0x517d78){if(_0x517d78){return db['sequelize'][_0x8bea('0x99')](function(_0x5ca376){return db[_0x8bea('0x9a')]['destroy']({'where':{'MailAccountId':_0x4b1847[_0x8bea('0x5f')]['id']},'transaction':_0x5ca376})[_0x8bea('0x37')](function(_0x56dd9b){var _0x30ede2=_[_0x8bea('0x44')](_0x4b1847[_0x8bea('0x63')],function(_0x458e46){_0x458e46['MailAccountId']=_0x4b1847['params']['id'];return _0x458e46;});return db[_0x8bea('0x9a')]['bulkCreate'](_0x30ede2,{'transaction':_0x5ca376});});})[_0x8bea('0x37')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x4b1847[_0x8bea('0x5f')]['id']},'order':_0x8bea('0x9b')});});}})[_0x8bea('0x37')](respondWithResult(_0x2abb8f,null))[_0x8bea('0x2d')](handleError(_0x2abb8f,null));};exports['getApplications']=function(_0x4da8e1,_0x4359a4,_0x47277b){var _0x4f932a={};var _0x4d8172={};var _0x57b757;var _0x88b15f;return db[_0x8bea('0x45')][_0x8bea('0x6c')]({'where':{'id':_0x4da8e1[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x4359a4,null))[_0x8bea('0x37')](function(_0x31d908){if(_0x31d908){_0x57b757=_0x31d908;_0x4d8172[_0x8bea('0x4a')]=_[_0x8bea('0x4c')](db[_0x8bea('0x9a')]['rawAttributes']);_0x4d8172[_0x8bea('0x4b')]=_[_0x8bea('0x4c')](_0x4da8e1['query']);_0x4d8172[_0x8bea('0x4d')]=_[_0x8bea('0x4e')](_0x4d8172[_0x8bea('0x4a')],_0x4d8172[_0x8bea('0x4b')]);_0x4f932a['attributes']=_[_0x8bea('0x4e')](_0x4d8172[_0x8bea('0x4a')],qs[_0x8bea('0x4f')](_0x4da8e1[_0x8bea('0x4b')][_0x8bea('0x4f')]));_0x4f932a['attributes']=_0x4f932a[_0x8bea('0x50')]['length']?_0x4f932a['attributes']:_0x4d8172[_0x8bea('0x4a')];_0x4f932a[_0x8bea('0x54')]=qs[_0x8bea('0x55')](_0x4da8e1[_0x8bea('0x4b')]['sort']);_0x4f932a[_0x8bea('0x56')]=qs[_0x8bea('0x4d')](_['pick'](_0x4da8e1[_0x8bea('0x4b')],_0x4d8172['filters']));if(_0x4da8e1[_0x8bea('0x4b')]['filter']){_0x4f932a[_0x8bea('0x56')]=_[_0x8bea('0x59')](_0x4f932a['where'],{'$or':_[_0x8bea('0x44')](_0x4f932a[_0x8bea('0x50')],function(_0x1c9239){var _0x1f82da={};_0x1f82da[_0x1c9239]={'$like':'%'+_0x4da8e1[_0x8bea('0x4b')][_0x8bea('0x58')]+'%'};return _0x1f82da;})});}_0x4f932a=_[_0x8bea('0x59')]({},_0x4f932a,_0x4da8e1['options']);return _0x57b757[_0x8bea('0x9c')](_0x4f932a);}})[_0x8bea('0x37')](function(_0x2bbe5a){if(_0x2bbe5a){_0x88b15f=_0x2bbe5a[_0x8bea('0x51')];if(!_0x4da8e1['query'][_0x8bea('0x52')]('nolimit')){_0x4f932a[_0x8bea('0x31')]=qs['limit'](_0x4da8e1['query'][_0x8bea('0x31')]);_0x4f932a[_0x8bea('0x30')]=qs['offset'](_0x4da8e1[_0x8bea('0x4b')]['offset']);}return _0x57b757[_0x8bea('0x9c')](_0x4f932a);}})[_0x8bea('0x37')](function(_0x27de99){if(_0x27de99){return _0x27de99?{'count':_0x88b15f,'rows':_0x27de99}:null;}})[_0x8bea('0x37')](respondWithResult(_0x4359a4,null))['catch'](handleError(_0x4359a4,null));};exports[_0x8bea('0x9d')]=function(_0x51a3d7,_0x31b24a,_0x5cf6c8){var _0x551f84={'raw':!![],'where':{}};var _0x359873={};var _0x3d7845={'count':0x0,'rows':[]};return db[_0x8bea('0x45')][_0x8bea('0x6c')]({'where':{'id':_0x51a3d7[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x31b24a,null))[_0x8bea('0x37')](function(_0x3fc27a){if(_0x3fc27a){_0x359873[_0x8bea('0x4a')]=_[_0x8bea('0x4c')](db['MailMessage'][_0x8bea('0x46')]);_0x359873['query']=_['keys'](_0x51a3d7[_0x8bea('0x4b')]);_0x359873[_0x8bea('0x4d')]=_['intersection'](_0x359873[_0x8bea('0x4a')],_0x359873[_0x8bea('0x4b')]);_0x551f84[_0x8bea('0x50')]=_[_0x8bea('0x4e')](_0x359873['model'],qs[_0x8bea('0x4f')](_0x51a3d7['query']['fields']));_0x551f84['attributes']=_0x551f84[_0x8bea('0x50')][_0x8bea('0x51')]?_0x551f84[_0x8bea('0x50')]:_0x359873[_0x8bea('0x4a')];if(!_0x51a3d7[_0x8bea('0x4b')][_0x8bea('0x52')](_0x8bea('0x53'))){_0x551f84[_0x8bea('0x31')]=qs[_0x8bea('0x31')](_0x51a3d7['query'][_0x8bea('0x31')]);_0x551f84[_0x8bea('0x30')]=qs['offset'](_0x51a3d7['query'][_0x8bea('0x30')]);}_0x551f84[_0x8bea('0x54')]=qs[_0x8bea('0x55')](_0x51a3d7['query']['sort']);_0x551f84['where']=qs[_0x8bea('0x4d')](_[_0x8bea('0x57')](_0x51a3d7[_0x8bea('0x4b')],_0x359873[_0x8bea('0x4d')]));_0x551f84[_0x8bea('0x56')][_0x8bea('0x68')]=_0x3fc27a['id'];if(_0x51a3d7[_0x8bea('0x4b')][_0x8bea('0x58')]){_0x551f84[_0x8bea('0x56')]=_[_0x8bea('0x59')](_0x551f84[_0x8bea('0x56')],{'$or':_['map'](_0x551f84[_0x8bea('0x50')],function(_0x7bcd08){var _0x1ce951={};_0x1ce951[_0x7bcd08]={'$like':'%'+_0x51a3d7[_0x8bea('0x4b')][_0x8bea('0x58')]+'%'};return _0x1ce951;})});}if(_0x51a3d7[_0x8bea('0x4b')][_0x8bea('0x9e')]){var _0xd5d74a=_0x51a3d7[_0x8bea('0x4b')][_0x8bea('0x9e')]['split'](',');var _0x32f212={};_0x32f212[_0xd5d74a[0x0]]={'$gte':moment(_0xd5d74a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x551f84[_0x8bea('0x56')]=_[_0x8bea('0x59')](_0x551f84[_0x8bea('0x56')],_0x32f212);}_0x551f84=_[_0x8bea('0x59')]({},_0x551f84,_0x51a3d7['options']);return db[_0x8bea('0x9f')][_0x8bea('0x5a')]({'where':_0x551f84['where']})[_0x8bea('0x37')](function(_0x4dbb27){_0x3d7845[_0x8bea('0x5a')]=_0x4dbb27;if(_0x51a3d7['query']['includeAll']){_0x551f84[_0x8bea('0x5c')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x551f84);})[_0x8bea('0x37')](function(_0x1ff2a2){_0x3d7845[_0x8bea('0x5e')]=_0x1ff2a2;return _0x3d7845;});}})['then'](respondWithFilteredResult(_0x31b24a,_0x551f84))[_0x8bea('0x2d')](handleError(_0x31b24a,null));};exports[_0x8bea('0x3e')]=function(_0x13a0d7,_0xcf1db3,_0x2bade9){var _0x173ba4,_0x222b3b={},_0x4a7576;if(_0x13a0d7['body']['to']){_0x4a7576=_0x13a0d7[_0x8bea('0x63')]['to'][_0x8bea('0xa0')](',')[0x0];}return db[_0x8bea('0x45')]['find']({'where':{'id':_0x13a0d7['params']['id']},'include':[{'model':db['CmList'],'as':_0x8bea('0xa1'),'include':[{'model':db[_0x8bea('0x90')],'as':_0x8bea('0xa2'),'where':{'email':_0x4a7576},'limit':0x1,'order':[[_0x8bea('0xa3'),_0x8bea('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0x8bea('0x41'),'raw':!![]}]})[_0x8bea('0x37')](handleEntityNotFound(_0xcf1db3,null))[_0x8bea('0x37')](function(_0x431fee){if(_0x431fee){_0x173ba4=_0x431fee;if(_0x431fee[_0x8bea('0x41')]){if(_[_0x8bea('0x75')](_0x13a0d7['body'][_0x8bea('0xa5')])){_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xa5')]=util[_0x8bea('0xa6')](_0x8bea('0xa7'),_0x431fee[_0x8bea('0x3d')],_0x431fee['email']||_0x431fee['Smtp']['user']);}if(_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xa8')]&&_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xa8')][_0x8bea('0x51')]){for(var _0x54f7ef=0x0;_0x54f7ef<_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xa8')][_0x8bea('0x51')];_0x54f7ef+=0x1){_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xa8')][_0x54f7ef]={'filename':_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xa8')][_0x54f7ef][_0x8bea('0x3d')],'path':path[_0x8bea('0xa9')](config[_0x8bea('0xaa')],_0x8bea('0xab'),_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xa8')][_0x54f7ef]['basename'])};}}var _0x351bd1={'tls':{'rejectUnauthorized':![]}};if(_[_0x8bea('0x75')](_0x431fee['Smtp'][_0x8bea('0x81')])){if(_0x431fee['Smtp'][_0x8bea('0x7e')]){_0x351bd1['auth']={'user':_0x431fee['Smtp'][_0x8bea('0x7a')],'pass':_0x431fee['Smtp'][_0x8bea('0xac')]};}_0x351bd1[_0x8bea('0x80')]=_0x431fee[_0x8bea('0x41')][_0x8bea('0x80')];_0x351bd1[_0x8bea('0x7f')]=_0x431fee[_0x8bea('0x41')][_0x8bea('0x7f')];_0x351bd1[_0x8bea('0xad')]=_0x431fee['Smtp'][_0x8bea('0xad')];}else{_0x351bd1[_0x8bea('0x81')]=_0x431fee[_0x8bea('0x41')][_0x8bea('0x81')];_0x351bd1[_0x8bea('0xae')]={'user':_0x431fee[_0x8bea('0x41')][_0x8bea('0x7a')],'pass':_0x431fee['Smtp'][_0x8bea('0xac')]};}return respondWithRpcPromise(_0x8bea('0xaf'),_0x8bea('0xb0'),{'account':_0x351bd1,'message':_0x13a0d7[_0x8bea('0x63')]});}else{throw new Error(_0x8bea('0xb1'));}}})[_0x8bea('0x37')](function(_0x9857b0){if(_0x9857b0){_0x222b3b=_0x9857b0;if(_0x173ba4['List']){if(_0x173ba4[_0x8bea('0xa1')][_0x8bea('0xa2')][_0x8bea('0x51')]){return _0x173ba4['List'][_0x8bea('0xa2')][0x0];}else{return db[_0x8bea('0x90')]['create'](_[_0x8bea('0x1b')](_0x13a0d7[_0x8bea('0x63')],{'firstName':_0x13a0d7[_0x8bea('0x63')]['to'],'email':_0x13a0d7['body']['to'],'phone':_0x13a0d7[_0x8bea('0x63')]['to'],'ListId':_0x173ba4[_0x8bea('0x74')]}));}}else{throw new Error(_0x8bea('0xb1'));}}})[_0x8bea('0x37')](function(_0x5e98c6){if(_0x5e98c6){var _0x4613c4={'UserId':_0x13a0d7[_0x8bea('0x7a')]['id'],'ContactId':_0x5e98c6['id'],'MailAccountId':_0x173ba4['id'],'inReplyTo':_0x222b3b[_0x8bea('0xb2')],'to':_0x13a0d7['body'][_0x8bea('0xa5')],'cc':_0x13a0d7[_0x8bea('0x63')]['cc'],'subject':_0x13a0d7[_0x8bea('0x63')]['subject'],'attach':_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8bea('0xa6')](_0x8bea('0xb4')),'lastMsgDirection':_0x8bea('0xb5'),'lastMsgBody':_0x13a0d7[_0x8bea('0x63')][_0x8bea('0x63')],'Messages':[_['merge'](_0x13a0d7[_0x8bea('0x63')],{'messageId':_0x222b3b[_0x8bea('0xb2')],'sentAt':moment()[_0x8bea('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x173ba4['id'],'UserId':_0x13a0d7[_0x8bea('0x7a')]['id'],'ContactId':_0x5e98c6['id']})]};if(_0x13a0d7[_0x8bea('0x63')][_0x8bea('0xb6')]){_0x4613c4=_[_0x8bea('0x59')](_0x4613c4,_0x13a0d7[_0x8bea('0x63')]['Interaction']);}return db[_0x8bea('0x8f')]['create'](_0x4613c4,{'include':[{'model':db[_0x8bea('0x9f')],'as':_0x8bea('0xb7')}]});}})['then'](respondWithResult(_0xcf1db3,null))[_0x8bea('0x2d')](handleError(_0xcf1db3,null));};exports[_0x8bea('0xb8')]=function(_0x1bb6c4,_0x8b8e73,_0x48c821){return db[_0x8bea('0x45')][_0x8bea('0x61')]({'where':{'id':_0x1bb6c4[_0x8bea('0x5f')]['id']},'include':[{'model':db[_0x8bea('0x65')],'as':_0x8bea('0x41'),'raw':!![]}]})[_0x8bea('0x37')](handleEntityNotFound(_0x8b8e73,null))[_0x8bea('0x37')](function(_0x460e15){if(_0x460e15&&_0x460e15[_0x8bea('0x41')]){var _0x41bb02={'id':_0x460e15['id'],'tls':{'rejectUnauthorized':![]}};if(_0x460e15[_0x8bea('0x41')][_0x8bea('0x81')]){_0x41bb02[_0x8bea('0x81')]=_0x460e15[_0x8bea('0x41')]['service'];}else{_0x41bb02[_0x8bea('0x80')]=_0x460e15[_0x8bea('0x41')]['host'];_0x41bb02[_0x8bea('0x7f')]=_0x460e15[_0x8bea('0x41')][_0x8bea('0x7f')];_0x41bb02['secure']=_0x460e15[_0x8bea('0x41')][_0x8bea('0xad')];}if(_0x460e15[_0x8bea('0x41')][_0x8bea('0x7e')]){_0x41bb02['auth']={'user':_0x460e15[_0x8bea('0x41')][_0x8bea('0x7a')],'pass':_0x460e15[_0x8bea('0x41')][_0x8bea('0xac')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x41bb02});}})[_0x8bea('0x37')](respondWithResult(_0x8b8e73,null))['catch'](handleError(_0x8b8e73,null));};exports[_0x8bea('0x3a')]=function(_0x33bcbd,_0x3ab82a){return db['MailAccount'][_0x8bea('0x61')]({'where':{'id':_0x33bcbd[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x3ab82a,null))[_0x8bea('0x37')](function(_0x422ee7){if(_0x422ee7&&_0x422ee7[_0x8bea('0x81')]){throw new db[(_0x8bea('0xb9'))][(_0x8bea('0x21'))](_0x8bea('0xba'));}return _0x422ee7;})[_0x8bea('0x37')](removeEntity(_0x3ab82a,null))[_0x8bea('0x2d')](handleError(_0x3ab82a,null));};exports['addAgents']=function(_0x8ac781,_0x13c274,_0xea730){return db[_0x8bea('0x45')]['find']({'where':{'id':_0x8ac781[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x13c274,null))[_0x8bea('0x37')](function(_0x2ebdd2){if(_0x2ebdd2){return _0x2ebdd2[_0x8bea('0xbb')](_0x8ac781[_0x8bea('0x63')][_0x8bea('0x6e')],_[_0x8bea('0xbc')](_0x8ac781[_0x8bea('0x63')],[_0x8bea('0x6e'),'id'])||{})['spread'](function(_0x267fa5){for(var _0x2ba7c1=0x0;_0x2ba7c1<_0x8ac781['body'][_0x8bea('0x6e')][_0x8bea('0x51')];_0x2ba7c1+=0x1){socket[_0x8bea('0xbd')](_0x8bea('0xbe'),{'UserId':_0x8ac781['body'][_0x8bea('0x6e')][_0x2ba7c1],'MailAccountId':_0x8ac781[_0x8bea('0x5f')]['id']});}return _0x267fa5;});}})[_0x8bea('0x37')](respondWithResult(_0x13c274,null))[_0x8bea('0x2d')](handleError(_0x13c274,null));};exports[_0x8bea('0xbf')]=function(_0x48c276,_0x1264ea,_0x5879a1){return db[_0x8bea('0x45')]['find']({'where':{'id':_0x48c276[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x1264ea,null))[_0x8bea('0x37')](function(_0x2f0011){if(_0x2f0011){return _0x2f0011['removeAgents'](_0x48c276[_0x8bea('0x4b')]['ids'])[_0x8bea('0x37')](function(){if(_['isArray'](_0x48c276[_0x8bea('0x4b')]['ids'])){for(var _0x246fc7=0x0;_0x246fc7<_0x48c276[_0x8bea('0x4b')][_0x8bea('0x6e')]['length'];_0x246fc7+=0x1){socket[_0x8bea('0xbd')](_0x8bea('0xc0'),{'UserId':Number(_0x48c276[_0x8bea('0x4b')]['ids'][_0x246fc7]),'MailAccountId':Number(_0x48c276[_0x8bea('0x5f')]['id'])});}}else{socket[_0x8bea('0xbd')](_0x8bea('0xc0'),{'UserId':Number(_0x48c276[_0x8bea('0x4b')]['ids']),'MailAccountId':Number(_0x48c276[_0x8bea('0x5f')]['id'])});}});}})[_0x8bea('0x37')](respondWithStatusCode(_0x1264ea,null))[_0x8bea('0x2d')](handleError(_0x1264ea,null));};exports[_0x8bea('0xc1')]=function(_0x34fb94,_0x202b05,_0x3c3cdd){var _0x34c14a={};var _0x5e4a64={};var _0x39c7b5;var _0x3e06e6;return db[_0x8bea('0x45')][_0x8bea('0x6c')]({'where':{'id':_0x34fb94[_0x8bea('0x5f')]['id']}})[_0x8bea('0x37')](handleEntityNotFound(_0x202b05,null))[_0x8bea('0x37')](function(_0x20eaf3){if(_0x20eaf3){_0x39c7b5=_0x20eaf3;_0x5e4a64['model']=_['keys'](db[_0x8bea('0x91')][_0x8bea('0x46')]);_0x5e4a64[_0x8bea('0x4b')]=_['keys'](_0x34fb94[_0x8bea('0x4b')]);_0x5e4a64[_0x8bea('0x4d')]=_[_0x8bea('0x4e')](_0x5e4a64[_0x8bea('0x4a')],_0x5e4a64[_0x8bea('0x4b')]);_0x34c14a[_0x8bea('0x50')]=_[_0x8bea('0x4e')](_0x5e4a64[_0x8bea('0x4a')],qs[_0x8bea('0x4f')](_0x34fb94['query'][_0x8bea('0x4f')]));_0x34c14a['attributes']=_0x34c14a['attributes'][_0x8bea('0x51')]?_0x34c14a[_0x8bea('0x50')]:_0x5e4a64[_0x8bea('0x4a')];_0x34c14a[_0x8bea('0x54')]=qs[_0x8bea('0x55')](_0x34fb94[_0x8bea('0x4b')]['sort']);_0x34c14a[_0x8bea('0x56')]=qs['filters'](_[_0x8bea('0x57')](_0x34fb94[_0x8bea('0x4b')],_0x5e4a64['filters']));if(_0x34fb94[_0x8bea('0x4b')][_0x8bea('0x58')]){_0x34c14a['where']=_[_0x8bea('0x59')](_0x34c14a[_0x8bea('0x56')],{'$or':_[_0x8bea('0x44')](_0x34c14a[_0x8bea('0x50')],function(_0x534b08){var _0x5da980={};_0x5da980[_0x534b08]={'$like':'%'+_0x34fb94[_0x8bea('0x4b')][_0x8bea('0x58')]+'%'};return _0x5da980;})});}_0x34c14a=_[_0x8bea('0x59')]({},_0x34c14a,_0x34fb94[_0x8bea('0x60')]);return _0x39c7b5['getAgents'](_0x34c14a);}})[_0x8bea('0x37')](function(_0x440154){if(_0x440154){_0x3e06e6=_0x440154[_0x8bea('0x51')];if(!_0x34fb94[_0x8bea('0x4b')][_0x8bea('0x52')](_0x8bea('0x53'))){_0x34c14a['limit']=qs[_0x8bea('0x31')](_0x34fb94['query']['limit']);_0x34c14a[_0x8bea('0x30')]=qs[_0x8bea('0x30')](_0x34fb94[_0x8bea('0x4b')][_0x8bea('0x30')]);}return _0x39c7b5[_0x8bea('0xc1')](_0x34c14a);}})[_0x8bea('0x37')](function(_0x3292b2){if(_0x3292b2){return _0x3292b2?{'count':_0x3e06e6,'rows':_0x3292b2}:null;}})[_0x8bea('0x37')](respondWithResult(_0x202b05,null))[_0x8bea('0x2d')](handleError(_0x202b05,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index cf85351..06a9f01 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 _0x2778=['MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x43d46c,_0xae9736){var _0x3984a4=function(_0xb43c6a){while(--_0xb43c6a){_0x43d46c['push'](_0x43d46c['shift']());}};_0x3984a4(++_0xae9736);}(_0x2778,0xa8));var _0x8277=function(_0x3c7dcd,_0x2109e2){_0x3c7dcd=_0x3c7dcd-0x0;var _0x3d73fe=_0x2778[_0x3c7dcd];return _0x3d73fe;};'use strict';var EventEmitter=require(_0x8277('0x0'));var MailAccount=require(_0x8277('0x1'))['db'][_0x8277('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8277('0x3')](0x0);var events={'afterCreate':_0x8277('0x4'),'afterUpdate':'update','afterDestroy':_0x8277('0x5')};function emitEvent(_0x5f47b1){return function(_0x438605,_0x3bbd75,_0x3a7f94){MailAccountEvents[_0x8277('0x6')](_0x5f47b1+':'+_0x438605['id'],_0x438605);MailAccountEvents[_0x8277('0x6')](_0x5f47b1,_0x438605);_0x3a7f94(null);};}for(var e in events){if(events[_0x8277('0x7')](e)){var event=events[e];MailAccount[_0x8277('0x8')](e,emitEvent(event));}}module[_0x8277('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x8bb7=['emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x3c0944,_0x226337){var _0x6312be=function(_0x56bb5a){while(--_0x56bb5a){_0x3c0944['push'](_0x3c0944['shift']());}};_0x6312be(++_0x226337);}(_0x8bb7,0xf1));var _0x78bb=function(_0xf9163d,_0xc2ff7d){_0xf9163d=_0xf9163d-0x0;var _0x53914e=_0x8bb7[_0xf9163d];return _0x53914e;};'use strict';var EventEmitter=require(_0x78bb('0x0'));var MailAccount=require(_0x78bb('0x1'))['db'][_0x78bb('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x78bb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xed53e4){return function(_0x221a85,_0x12ce28,_0x35e952){MailAccountEvents['emit'](_0xed53e4+':'+_0x221a85['id'],_0x221a85);MailAccountEvents[_0x78bb('0x4')](_0xed53e4,_0x221a85);_0x35e952(null);};}for(var e in events){if(events[_0x78bb('0x5')](e)){var event=events[e];MailAccount[_0x78bb('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 327dd61..317185c 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 _0x8508=['path','rimraf','./mailAccount.attributes','define','mail_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x48bb87,_0x14bcc4){var _0x36ac48=function(_0x5ac3dd){while(--_0x5ac3dd){_0x48bb87['push'](_0x48bb87['shift']());}};_0x36ac48(++_0x14bcc4);}(_0x8508,0x118));var _0x8850=function(_0x4e8031,_0x4b5b7b){_0x4e8031=_0x4e8031-0x0;var _0x3e970e=_0x8508[_0x4e8031];return _0x3e970e;};'use strict';var _=require(_0x8850('0x0'));var util=require(_0x8850('0x1'));var logger=require(_0x8850('0x2'))(_0x8850('0x3'));var moment=require('moment');var BPromise=require(_0x8850('0x4'));var rp=require(_0x8850('0x5'));var fs=require('fs');var path=require(_0x8850('0x6'));var rimraf=require(_0x8850('0x7'));var config=require('../../config/environment');var attributes=require(_0x8850('0x8'));module['exports']=function(_0x4c8c03,_0x4f341a){return _0x4c8c03[_0x8850('0x9')]('MailAccount',attributes,{'tableName':_0x8850('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1c5=['request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb1c5,0x18e));var _0x5b1c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb1c5[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x5b1c('0x0'));var logger=require(_0x5b1c('0x1'))(_0x5b1c('0x2'));var moment=require(_0x5b1c('0x3'));var BPromise=require(_0x5b1c('0x4'));var rp=require(_0x5b1c('0x5'));var fs=require('fs');var path=require(_0x5b1c('0x6'));var rimraf=require(_0x5b1c('0x7'));var config=require(_0x5b1c('0x8'));var attributes=require(_0x5b1c('0x9'));module['exports']=function(_0x37269d,_0x2a9240){return _0x37269d[_0x5b1c('0xa')](_0x5b1c('0xb'),attributes,{'tableName':_0x5b1c('0xc'),'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 0fc52ea..6b35b30 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 _0x0fd9=['limit','map','include','model','debug','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','updatedAt','DESC','Applications','MailServerOut','Smtp','get','omit','List','applications','list','priority','asc','length','close','autoclose','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','MailInteraction','MailMessage','Messages','inReplyTo','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0fd9,0xa3));var _0x90fd=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x0fd9[_0x4b73a2];return _0x383c66;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232c});config['redis']=_[_0x90fd('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x90fd('0xb'))(new Redis(config[_0x90fd('0xc')]));require('./mailAccount.socket')[_0x90fd('0xd')](socket);function respondWithRpcPromise(_0x464236,_0x3c0592,_0x3262f6){return new BPromise(function(_0x289693,_0x3be346){return client[_0x90fd('0xe')](_0x464236,_0x3262f6)[_0x90fd('0xf')](function(_0x3c541e){logger['info'](_0x90fd('0x10'),_0x3c0592,_0x90fd('0x11'));logger['debug'](_0x90fd('0x12'),_0x3c0592,_0x90fd('0x11'),JSON[_0x90fd('0x13')](_0x3c541e));if(_0x3c541e['error']){if(_0x3c541e[_0x90fd('0x14')]['code']===0x1f4){logger[_0x90fd('0x14')](_0x90fd('0x10'),_0x3c0592,_0x3c541e[_0x90fd('0x14')][_0x90fd('0x15')]);return _0x3be346(_0x3c541e[_0x90fd('0x14')][_0x90fd('0x15')]);}logger[_0x90fd('0x14')]('MailAccount,\x20%s,\x20%s',_0x3c0592,_0x3c541e['error'][_0x90fd('0x15')]);return _0x289693(_0x3c541e[_0x90fd('0x14')]['message']);}else{logger[_0x90fd('0x16')](_0x90fd('0x10'),_0x3c0592,_0x90fd('0x11'));_0x289693(_0x3c541e['result'][_0x90fd('0x15')]);}})[_0x90fd('0x17')](function(_0x16d8a7){logger[_0x90fd('0x14')](_0x90fd('0x10'),_0x3c0592,_0x16d8a7);_0x3be346(_0x16d8a7);});});}exports[_0x90fd('0x18')]=function(_0x10a14b){var _0x301e19=this;return new Promise(function(_0x187cf1,_0x90197e){return db[_0x90fd('0x19')][_0x90fd('0x1a')]({'raw':_0x10a14b[_0x90fd('0x1b')]?_0x10a14b[_0x90fd('0x1b')][_0x90fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x10a14b['options']?_0x10a14b[_0x90fd('0x1b')][_0x90fd('0x1d')]||null:null,'attributes':_0x10a14b[_0x90fd('0x1b')]?_0x10a14b[_0x90fd('0x1b')][_0x90fd('0x1e')]||null:null,'limit':_0x10a14b[_0x90fd('0x1b')]?_0x10a14b[_0x90fd('0x1b')][_0x90fd('0x1f')]||null:null,'include':_0x10a14b['options']?_0x10a14b[_0x90fd('0x1b')]['include']?_[_0x90fd('0x20')](_0x10a14b[_0x90fd('0x1b')][_0x90fd('0x21')],function(_0x31667c){return{'model':db[_0x31667c[_0x90fd('0x22')]],'as':_0x31667c['as'],'attributes':_0x31667c['attributes'],'include':_0x31667c[_0x90fd('0x21')]?_[_0x90fd('0x20')](_0x31667c[_0x90fd('0x21')],function(_0x1cdc38){return{'model':db[_0x1cdc38[_0x90fd('0x22')]],'as':_0x1cdc38['as'],'attributes':_0x1cdc38[_0x90fd('0x1e')],'include':_0x1cdc38['include']?_['map'](_0x1cdc38[_0x90fd('0x21')],function(_0x170cfb){return{'model':db[_0x170cfb[_0x90fd('0x22')]],'as':_0x170cfb['as'],'attributes':_0x170cfb[_0x90fd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0xf')](function(_0x59b3e8){logger['info'](_0x90fd('0x18'),_0x10a14b);logger[_0x90fd('0x23')](_0x90fd('0x18'),_0x10a14b,JSON[_0x90fd('0x13')](_0x59b3e8));_0x187cf1(_0x59b3e8);})['catch'](function(_0x59aede){logger[_0x90fd('0x14')](_0x90fd('0x18'),_0x59aede[_0x90fd('0x15')],_0x10a14b);_0x90197e(_0x301e19[_0x90fd('0x14')](0x1f4,_0x59aede['message']));});});};exports[_0x90fd('0x24')]=function(_0x1127ef){var _0x7fb8bc=this;return new Promise(function(_0x46a6d0,_0x181b63){return db[_0x90fd('0x19')][_0x90fd('0x25')]({'raw':_0x1127ef[_0x90fd('0x1b')]?_0x1127ef[_0x90fd('0x1b')][_0x90fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x1127ef[_0x90fd('0x1b')]?_0x1127ef[_0x90fd('0x1b')][_0x90fd('0x1d')]||null:null,'attributes':_0x1127ef[_0x90fd('0x1b')]?_0x1127ef[_0x90fd('0x1b')][_0x90fd('0x1e')]||null:null,'include':_0x1127ef['options']?_0x1127ef[_0x90fd('0x1b')][_0x90fd('0x21')]?_[_0x90fd('0x20')](_0x1127ef[_0x90fd('0x1b')][_0x90fd('0x21')],function(_0x1a7518){return{'model':db[_0x1a7518[_0x90fd('0x22')]],'as':_0x1a7518['as'],'attributes':_0x1a7518[_0x90fd('0x1e')],'include':_0x1a7518[_0x90fd('0x21')]?_[_0x90fd('0x20')](_0x1a7518[_0x90fd('0x21')],function(_0x3ea88a){return{'model':db[_0x3ea88a[_0x90fd('0x22')]],'as':_0x3ea88a['as'],'attributes':_0x3ea88a['attributes'],'include':_0x3ea88a[_0x90fd('0x21')]?_[_0x90fd('0x20')](_0x3ea88a[_0x90fd('0x21')],function(_0x35a4a9){return{'model':db[_0x35a4a9['model']],'as':_0x35a4a9['as'],'attributes':_0x35a4a9[_0x90fd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0xf')](function(_0xb37e41){logger['info']('ShowMailAccount',_0x1127ef);logger[_0x90fd('0x23')](_0x90fd('0x24'),_0x1127ef,JSON[_0x90fd('0x13')](_0xb37e41));_0x46a6d0(_0xb37e41);})[_0x90fd('0x17')](function(_0x3df3cd){logger[_0x90fd('0x14')](_0x90fd('0x24'),_0x3df3cd[_0x90fd('0x15')],_0x1127ef);_0x181b63(_0x7fb8bc[_0x90fd('0x14')](0x1f4,_0x3df3cd[_0x90fd('0x15')]));});});};exports[_0x90fd('0x26')]=function(_0x43c84c){var _0x21dc9c=this;return new Promise(function(_0x47856d,_0x1ed624){var _0x559a09={'body':_0x43c84c[_0x90fd('0x27')],'channel':_0x90fd('0x28')};var _0x5241d6=_[_0x90fd('0x29')](_[_0x90fd('0x2a')](db[_0x90fd('0x2b')]['rawAttributes']),['createdAt','updatedAt',_0x90fd('0x2c'),_0x90fd('0x2d')]);var _0x3e2ed6=![];if(_0x43c84c[_0x90fd('0x27')]['id']){delete _0x43c84c[_0x90fd('0x27')]['id'];}if(_[_0x90fd('0x2e')](_0x43c84c[_0x90fd('0x27')][_0x90fd('0x2f')])){return _0x1ed624(_0x21dc9c[_0x90fd('0x14')](0x1f4,_0x90fd('0x30')));}if(_[_0x90fd('0x2e')](_0x43c84c[_0x90fd('0x27')][_0x90fd('0x27')])||_0x43c84c[_0x90fd('0x27')][_0x90fd('0x27')]===''){return _0x1ed624(_0x21dc9c['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x90fd('0x2e')](_0x43c84c[_0x90fd('0x27')][_0x90fd('0x31')])){return _0x1ed624(_0x21dc9c['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5241d6));}if(!_[_0x90fd('0x32')](_0x5241d6,_0x43c84c[_0x90fd('0x27')]['mapKey'])){return _0x1ed624(_0x21dc9c['error'](0x1f4,_0x90fd('0x33')+_0x5241d6));}var _0x5fc82e={};_0x5fc82e[_0x43c84c['body']['mapKey']]=_0x43c84c[_0x90fd('0x27')][_0x90fd('0x2f')];return db[_0x90fd('0x19')]['find']({'where':{'id':_0x43c84c[_0x90fd('0x34')]['id']},'include':[{'model':db[_0x90fd('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5fc82e,'limit':0x1,'order':[[_0x90fd('0x36'),_0x90fd('0x37')]]}]},{'model':db['MailApplication'],'as':_0x90fd('0x38')},{'model':db[_0x90fd('0x39')],'as':_0x90fd('0x3a')}]})[_0x90fd('0xf')](function(_0x3a0286){if(_0x3a0286&&_0x3a0286['List']){var _0x4fe48a=_0x3a0286[_0x90fd('0x3b')]({'plain':!![]});_0x559a09[_0x90fd('0x34')]=_[_0x90fd('0x3c')](_0x4fe48a,[_0x90fd('0x38'),_0x90fd('0x3d')]);_0x559a09[_0x90fd('0x3e')]=_0x4fe48a[_0x90fd('0x38')];_0x559a09[_0x90fd('0x3f')]=_0x4fe48a[_0x90fd('0x3d')];_0x559a09[_0x90fd('0x3e')]=_['orderBy'](_0x559a09[_0x90fd('0x3e')],[_0x90fd('0x40')],[_0x90fd('0x41')]);if(_0x559a09[_0x90fd('0x34')]&&_0x559a09['account']['autoclose']){_0x559a09[_0x90fd('0x3e')]['push']({'id':0x0,'priority':_0x559a09['applications'][_0x90fd('0x42')]+0x1,'app':_0x90fd('0x43'),'appdata':_0x90fd('0x44'),'interval':_0x90fd('0x45')});}if(_0x559a09[_0x90fd('0x34')][_0x90fd('0x38')]){delete _0x559a09[_0x90fd('0x34')]['Applications'];}if(_0x559a09['account'][_0x90fd('0x3d')]){delete _0x559a09[_0x90fd('0x34')][_0x90fd('0x3d')];}if(_0x4fe48a['List'][_0x90fd('0x46')][_0x90fd('0x42')]){return _0x4fe48a[_0x90fd('0x3d')][_0x90fd('0x46')][0x0];}var _0x437abd=_[_0x90fd('0xa')](_0x43c84c[_0x90fd('0x27')],{'firstName':_0x43c84c[_0x90fd('0x27')]['from'],'ListId':_0x4fe48a['ListId']});_0x437abd[_0x43c84c[_0x90fd('0x27')][_0x90fd('0x31')]]=_0x43c84c[_0x90fd('0x27')]['from'];return db[_0x90fd('0x2b')][_0x90fd('0x47')](_0x437abd);}else{throw new Error(_0x90fd('0x48'));}})[_0x90fd('0xf')](function(_0x43f75a){_0x559a09[_0x90fd('0x49')]=_0x43f75a;if(_0x43f75a){if(!_0x43c84c['body'][_0x90fd('0x15')]['messageId']){_0x43c84c[_0x90fd('0x27')]['message'][_0x90fd('0x4a')]=rs[_0x90fd('0x4b')]()+'\x20'+_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')]['from'];}var _0x44bc1f={'ContactId':_0x43f75a['id'],'MailAccountId':_0x43c84c[_0x90fd('0x34')]['id'],'inReplyTo':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')][_0x90fd('0x4a')],'to':_0x43c84c[_0x90fd('0x27')]['message']['from'],'cc':_0x43c84c['body']['message']['cc'],'subject':_0x43c84c['body'][_0x90fd('0x15')][_0x90fd('0x4c')],'attach':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')][_0x90fd('0x4d')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x43c84c['body'][_0x90fd('0x27')]};return db[_0x90fd('0x4e')]['find']({'where':{'closed':![],'MailAccountId':_0x43c84c[_0x90fd('0x34')]['id']},'include':[{'model':db[_0x90fd('0x4f')],'as':_0x90fd('0x50'),'attributes':[_0x90fd('0x4a')],'where':{'messageId':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')][_0x90fd('0x51')]}}]})[_0x90fd('0xf')](function(_0x3d835e){if(_0x3d835e){return[_0x3d835e,![]];}return db['MailInteraction'][_0x90fd('0x47')](_0x44bc1f)[_0x90fd('0xf')](function(_0x1e7111){return[_0x1e7111,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4058d4,_0x2111e3){if(_0x4058d4){_0x3e2ed6=_0x2111e3;if(!_0x2111e3){return _0x4058d4['update']({'inReplyTo':_0x43c84c[_0x90fd('0x27')]['message']['messageId'],'to':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')][_0x90fd('0x2f')],'cc':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')]['cc'],'subject':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')][_0x90fd('0x4c')],'attach':_0x4058d4['attach']?_0x4058d4[_0x90fd('0x4d')]:_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')]['attach'],'substatus':null,'substatusAt':moment()[_0x90fd('0x52')](_0x90fd('0x53')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x27')]});}else{return _0x4058d4;}}})[_0x90fd('0xf')](function(_0x4f1777){_0x559a09[_0x90fd('0x54')]=_0x4f1777['get']({'plain':!![]});_0x559a09['interaction'][_0x90fd('0x55')]=_0x3e2ed6;return db['MailMessage'][_0x90fd('0x47')]({'body':_0x43c84c[_0x90fd('0x27')]['body'],'MailAccountId':_0x43c84c[_0x90fd('0x34')]['id'],'MailInteractionId':_0x4f1777['id'],'direction':'in','ContactId':_0x559a09[_0x90fd('0x49')]['id'],'messageId':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')][_0x90fd('0x4a')],'from':_0x43c84c[_0x90fd('0x27')]['message']['from'],'to':_0x43c84c['body']['message']['to'],'cc':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')]['cc'],'subject':_0x43c84c[_0x90fd('0x27')]['message'][_0x90fd('0x4c')],'attach':_0x43c84c[_0x90fd('0x27')]['message'][_0x90fd('0x4d')],'Attachments':_0x43c84c[_0x90fd('0x27')][_0x90fd('0x15')][_0x90fd('0x56')],'originTo':_0x43c84c['body'][_0x90fd('0x15')][_0x90fd('0x57')],'originCc':_0x43c84c['body']['message']['originCc'],'bcc':_0x43c84c[_0x90fd('0x27')]['message']['bcc']},{'include':[{'model':db[_0x90fd('0x58')],'as':'Attachments'}]});})[_0x90fd('0xf')](function(_0x4aed6d){_0x559a09[_0x90fd('0x15')]=_0x4aed6d;if(_0x559a09[_0x90fd('0x54')][_0x90fd('0x59')]){return db[_0x90fd('0x5a')]['find']({'attributes':['id',_0x90fd('0x5b')],'where':{'id':_0x559a09[_0x90fd('0x54')][_0x90fd('0x59')]}})['then'](function(_0x5b16a5){if(_0x5b16a5){_0x559a09[_0x90fd('0x3e')][_0x90fd('0x5c')]({'id':0x0,'priority':0x0,'app':_0x90fd('0x5d'),'appdata':_0x5b16a5[_0x90fd('0x5b')]+','+(_0x559a09[_0x90fd('0x34')][_0x90fd('0x5e')]||0xa),'interval':_0x90fd('0x45')});}return respondWithRpcPromise(_0x90fd('0x5f'),_0x90fd('0x60'),_0x559a09);});}return respondWithRpcPromise(_0x90fd('0x5f'),_0x90fd('0x60'),_0x559a09);})[_0x90fd('0xf')](function(_0x306039){_0x47856d(_0x306039);})[_0x90fd('0x17')](function(_0x37215e){_0x1ed624(_0x21dc9c[_0x90fd('0x14')](0x1f4,_0x37215e[_0x90fd('0x15')]));});});}; \ No newline at end of file +var _0x115a=['includes','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','applications','orderBy','priority','asc','length','close','create','List\x20not\x20found','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','interaction','get','created','contact','attachments','bcc','Attachment','UserId','User','find','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','MailAccount','findAll','options','raw','where','attributes','limit','model','include','map','GetMailAccount','ShowMailAccount','catch','NotifyMailAccount','body','mail','CmContact','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x3c1012,_0x2ad51e){var _0x3c32a3=function(_0x3133c0){while(--_0x3133c0){_0x3c1012['push'](_0x3c1012['shift']());}};_0x3c32a3(++_0x2ad51e);}(_0x115a,0x91));var _0xa115=function(_0x2457c7,_0xc6b53a){_0x2457c7=_0x2457c7-0x0;var _0xce1ded=_0x115a[_0x2457c7];return _0xce1ded;};'use strict';var _=require(_0xa115('0x0'));var util=require(_0xa115('0x1'));var moment=require(_0xa115('0x2'));var BPromise=require(_0xa115('0x3'));var rs=require(_0xa115('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa115('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa115('0x6'))(_0xa115('0x7'));var config=require(_0xa115('0x8'));var jayson=require(_0xa115('0x9'));var client=jayson[_0xa115('0xa')][_0xa115('0xb')]({'port':0x232c});config['redis']=_[_0xa115('0xc')](config[_0xa115('0xd')],{'host':_0xa115('0xe'),'port':0x18eb});var socket=require(_0xa115('0xf'))(new Redis(config[_0xa115('0xd')]));require(_0xa115('0x10'))[_0xa115('0x11')](socket);function respondWithRpcPromise(_0xc66b44,_0x3ba292,_0xa173e8){return new BPromise(function(_0x46b5c0,_0x5683d6){return client[_0xa115('0x12')](_0xc66b44,_0xa173e8)[_0xa115('0x13')](function(_0x35d056){logger[_0xa115('0x14')]('MailAccount,\x20%s,\x20%s',_0x3ba292,_0xa115('0x15'));logger[_0xa115('0x16')](_0xa115('0x17'),_0x3ba292,_0xa115('0x15'),JSON[_0xa115('0x18')](_0x35d056));if(_0x35d056[_0xa115('0x19')]){if(_0x35d056[_0xa115('0x19')]['code']===0x1f4){logger[_0xa115('0x19')](_0xa115('0x1a'),_0x3ba292,_0x35d056[_0xa115('0x19')][_0xa115('0x1b')]);return _0x5683d6(_0x35d056[_0xa115('0x19')][_0xa115('0x1b')]);}logger[_0xa115('0x19')](_0xa115('0x1a'),_0x3ba292,_0x35d056[_0xa115('0x19')][_0xa115('0x1b')]);return _0x46b5c0(_0x35d056[_0xa115('0x19')][_0xa115('0x1b')]);}else{logger[_0xa115('0x14')]('MailAccount,\x20%s,\x20%s',_0x3ba292,_0xa115('0x15'));_0x46b5c0(_0x35d056[_0xa115('0x1c')][_0xa115('0x1b')]);}})['catch'](function(_0x57f366){logger[_0xa115('0x19')](_0xa115('0x1a'),_0x3ba292,_0x57f366);_0x5683d6(_0x57f366);});});}exports['GetMailAccount']=function(_0x2037ad){var _0x856222=this;return new Promise(function(_0x934aee,_0x39a598){return db[_0xa115('0x1d')][_0xa115('0x1e')]({'raw':_0x2037ad[_0xa115('0x1f')]?_0x2037ad[_0xa115('0x1f')][_0xa115('0x20')]===undefined?!![]:![]:!![],'where':_0x2037ad[_0xa115('0x1f')]?_0x2037ad['options'][_0xa115('0x21')]||null:null,'attributes':_0x2037ad[_0xa115('0x1f')]?_0x2037ad[_0xa115('0x1f')][_0xa115('0x22')]||null:null,'limit':_0x2037ad[_0xa115('0x1f')]?_0x2037ad[_0xa115('0x1f')][_0xa115('0x23')]||null:null,'include':_0x2037ad[_0xa115('0x1f')]?_0x2037ad[_0xa115('0x1f')]['include']?_['map'](_0x2037ad[_0xa115('0x1f')]['include'],function(_0x1b1aba){return{'model':db[_0x1b1aba[_0xa115('0x24')]],'as':_0x1b1aba['as'],'attributes':_0x1b1aba[_0xa115('0x22')],'include':_0x1b1aba[_0xa115('0x25')]?_[_0xa115('0x26')](_0x1b1aba['include'],function(_0x27f411){return{'model':db[_0x27f411[_0xa115('0x24')]],'as':_0x27f411['as'],'attributes':_0x27f411[_0xa115('0x22')],'include':_0x27f411['include']?_[_0xa115('0x26')](_0x27f411['include'],function(_0x55ca62){return{'model':db[_0x55ca62[_0xa115('0x24')]],'as':_0x55ca62['as'],'attributes':_0x55ca62[_0xa115('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa115('0x13')](function(_0x47e36d){logger['info']('GetMailAccount',_0x2037ad);logger[_0xa115('0x16')](_0xa115('0x27'),_0x2037ad,JSON['stringify'](_0x47e36d));_0x934aee(_0x47e36d);})['catch'](function(_0x477b35){logger['error'](_0xa115('0x27'),_0x477b35[_0xa115('0x1b')],_0x2037ad);_0x39a598(_0x856222[_0xa115('0x19')](0x1f4,_0x477b35[_0xa115('0x1b')]));});});};exports[_0xa115('0x28')]=function(_0x5412b0){var _0x24b0ac=this;return new Promise(function(_0x368ee2,_0x33baee){return db[_0xa115('0x1d')]['find']({'raw':_0x5412b0['options']?_0x5412b0[_0xa115('0x1f')][_0xa115('0x20')]===undefined?!![]:![]:!![],'where':_0x5412b0[_0xa115('0x1f')]?_0x5412b0['options'][_0xa115('0x21')]||null:null,'attributes':_0x5412b0[_0xa115('0x1f')]?_0x5412b0[_0xa115('0x1f')][_0xa115('0x22')]||null:null,'include':_0x5412b0[_0xa115('0x1f')]?_0x5412b0[_0xa115('0x1f')]['include']?_['map'](_0x5412b0[_0xa115('0x1f')][_0xa115('0x25')],function(_0x308330){return{'model':db[_0x308330[_0xa115('0x24')]],'as':_0x308330['as'],'attributes':_0x308330[_0xa115('0x22')],'include':_0x308330['include']?_['map'](_0x308330['include'],function(_0x2f9d55){return{'model':db[_0x2f9d55[_0xa115('0x24')]],'as':_0x2f9d55['as'],'attributes':_0x2f9d55[_0xa115('0x22')],'include':_0x2f9d55[_0xa115('0x25')]?_[_0xa115('0x26')](_0x2f9d55['include'],function(_0x21981a){return{'model':db[_0x21981a[_0xa115('0x24')]],'as':_0x21981a['as'],'attributes':_0x21981a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa115('0x13')](function(_0x1deb5b){logger[_0xa115('0x14')](_0xa115('0x28'),_0x5412b0);logger[_0xa115('0x16')]('ShowMailAccount',_0x5412b0,JSON[_0xa115('0x18')](_0x1deb5b));_0x368ee2(_0x1deb5b);})[_0xa115('0x29')](function(_0x1ea74d){logger[_0xa115('0x19')](_0xa115('0x28'),_0x1ea74d[_0xa115('0x1b')],_0x5412b0);_0x33baee(_0x24b0ac[_0xa115('0x19')](0x1f4,_0x1ea74d['message']));});});};exports[_0xa115('0x2a')]=function(_0xfe82b1){var _0x41d3b6=this;return new Promise(function(_0x1656dc,_0x28c203){var _0x3c4209={'body':_0xfe82b1[_0xa115('0x2b')],'channel':_0xa115('0x2c')};var _0x344055=_['difference'](_['keys'](db[_0xa115('0x2d')]['rawAttributes']),['createdAt',_0xa115('0x2e'),_0xa115('0x2f'),'ListId']);var _0x10da2b=![];if(_0xfe82b1[_0xa115('0x2b')]['id']){delete _0xfe82b1[_0xa115('0x2b')]['id'];}if(_[_0xa115('0x30')](_0xfe82b1[_0xa115('0x2b')][_0xa115('0x31')])){return _0x28c203(_0x41d3b6[_0xa115('0x19')](0x1f4,_0xa115('0x32')));}if(_[_0xa115('0x30')](_0xfe82b1[_0xa115('0x2b')]['body'])||_0xfe82b1['body'][_0xa115('0x2b')]===''){return _0x28c203(_0x41d3b6[_0xa115('0x19')](0x1f4,_0xa115('0x33')));}if(_[_0xa115('0x30')](_0xfe82b1[_0xa115('0x2b')][_0xa115('0x34')])){return _0x28c203(_0x41d3b6[_0xa115('0x19')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x344055));}if(!_[_0xa115('0x35')](_0x344055,_0xfe82b1[_0xa115('0x2b')][_0xa115('0x34')])){return _0x28c203(_0x41d3b6['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x344055));}var _0x404772={};_0x404772[_0xfe82b1['body'][_0xa115('0x34')]]=_0xfe82b1[_0xa115('0x2b')][_0xa115('0x31')];return db['MailAccount']['find']({'where':{'id':_0xfe82b1[_0xa115('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0xa115('0x37'),'include':[{'model':db[_0xa115('0x2d')],'as':_0xa115('0x38'),'where':_0x404772,'limit':0x1,'order':[[_0xa115('0x2e'),_0xa115('0x39')]]}]},{'model':db[_0xa115('0x3a')],'as':_0xa115('0x3b')},{'model':db[_0xa115('0x3c')],'as':_0xa115('0x3d')}]})[_0xa115('0x13')](function(_0x2b0cbf){if(_0x2b0cbf&&_0x2b0cbf[_0xa115('0x37')]){var _0x51704d=_0x2b0cbf['get']({'plain':!![]});_0x3c4209[_0xa115('0x36')]=_[_0xa115('0x3e')](_0x51704d,[_0xa115('0x3b'),'List']);_0x3c4209[_0xa115('0x3f')]=_0x51704d[_0xa115('0x3b')];_0x3c4209['list']=_0x51704d[_0xa115('0x37')];_0x3c4209['applications']=_[_0xa115('0x40')](_0x3c4209[_0xa115('0x3f')],[_0xa115('0x41')],[_0xa115('0x42')]);if(_0x3c4209[_0xa115('0x36')]&&_0x3c4209[_0xa115('0x36')]['autoclose']){_0x3c4209['applications']['push']({'id':0x0,'priority':_0x3c4209[_0xa115('0x3f')][_0xa115('0x43')]+0x1,'app':_0xa115('0x44'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x3c4209['account'][_0xa115('0x3b')]){delete _0x3c4209['account'][_0xa115('0x3b')];}if(_0x3c4209['account'][_0xa115('0x37')]){delete _0x3c4209[_0xa115('0x36')]['List'];}if(_0x51704d[_0xa115('0x37')][_0xa115('0x38')]['length']){return _0x51704d[_0xa115('0x37')]['Contacts'][0x0];}var _0x40230d=_['defaults'](_0xfe82b1['body'],{'firstName':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x31')],'ListId':_0x51704d['ListId']});_0x40230d[_0xfe82b1[_0xa115('0x2b')][_0xa115('0x34')]]=_0xfe82b1[_0xa115('0x2b')][_0xa115('0x31')];return db['CmContact'][_0xa115('0x45')](_0x40230d);}else{throw new Error(_0xa115('0x46'));}})[_0xa115('0x13')](function(_0x366f12){_0x3c4209['contact']=_0x366f12;if(_0x366f12){if(!_0xfe82b1['body']['message'][_0xa115('0x47')]){_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')]['messageId']=rs[_0xa115('0x48')]()+'\x20'+_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x31')];}var _0x2a430a={'ContactId':_0x366f12['id'],'MailAccountId':_0xfe82b1[_0xa115('0x36')]['id'],'inReplyTo':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x47')],'to':_0xfe82b1[_0xa115('0x2b')]['message']['from'],'cc':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')]['cc'],'subject':_0xfe82b1[_0xa115('0x2b')]['message']['subject'],'attach':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x49')],'lastMsgAt':moment()[_0xa115('0x4a')](_0xa115('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x2b')]};return db[_0xa115('0x4c')]['find']({'where':{'closed':![],'MailAccountId':_0xfe82b1['account']['id']},'include':[{'model':db[_0xa115('0x4d')],'as':_0xa115('0x4e'),'attributes':['messageId'],'where':{'messageId':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x4f')]}}]})[_0xa115('0x13')](function(_0x50a38c){if(_0x50a38c){return[_0x50a38c,![]];}return db['MailInteraction'][_0xa115('0x45')](_0x2a430a)[_0xa115('0x13')](function(_0x40e6f4){return[_0x40e6f4,!![]];});});}else{throw new Error(_0xa115('0x50'));}})[_0xa115('0x51')](function(_0xb26a99,_0x5912da){if(_0xb26a99){_0x10da2b=_0x5912da;if(!_0x5912da){return _0xb26a99[_0xa115('0x52')]({'inReplyTo':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x47')],'to':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x31')],'cc':_0xfe82b1[_0xa115('0x2b')]['message']['cc'],'subject':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x53')],'attach':_0xb26a99['attach']?_0xb26a99[_0xa115('0x49')]:_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x49')],'substatus':null,'substatusAt':moment()[_0xa115('0x4a')](_0xa115('0x4b')),'lastMsgAt':moment()[_0xa115('0x4a')](_0xa115('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x2b')]});}else{return _0xb26a99;}}})['then'](function(_0x48ef2c){_0x3c4209[_0xa115('0x54')]=_0x48ef2c[_0xa115('0x55')]({'plain':!![]});_0x3c4209[_0xa115('0x54')][_0xa115('0x56')]=_0x10da2b;return db[_0xa115('0x4d')][_0xa115('0x45')]({'body':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x2b')],'MailAccountId':_0xfe82b1['account']['id'],'MailInteractionId':_0x48ef2c['id'],'direction':'in','ContactId':_0x3c4209[_0xa115('0x57')]['id'],'messageId':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x47')],'from':_0xfe82b1['body'][_0xa115('0x1b')][_0xa115('0x31')],'to':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')]['to'],'cc':_0xfe82b1['body']['message']['cc'],'subject':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x53')],'attach':_0xfe82b1[_0xa115('0x2b')]['message'][_0xa115('0x49')],'Attachments':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x58')],'originTo':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')]['originTo'],'originCc':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')]['originCc'],'bcc':_0xfe82b1[_0xa115('0x2b')][_0xa115('0x1b')][_0xa115('0x59')]},{'include':[{'model':db[_0xa115('0x5a')],'as':'Attachments'}]});})[_0xa115('0x13')](function(_0x34239e){_0x3c4209[_0xa115('0x1b')]=_0x34239e;if(_0x3c4209[_0xa115('0x54')][_0xa115('0x5b')]){return db[_0xa115('0x5c')][_0xa115('0x5d')]({'attributes':['id',_0xa115('0x5e')],'where':{'id':_0x3c4209['interaction'][_0xa115('0x5b')]}})[_0xa115('0x13')](function(_0xfdbf6b){if(_0xfdbf6b){_0x3c4209[_0xa115('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa115('0x5f'),'appdata':_0xfdbf6b['name']+','+(_0x3c4209['account'][_0xa115('0x60')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa115('0x61'),_0xa115('0x62'),_0x3c4209);});}return respondWithRpcPromise(_0xa115('0x61'),_0xa115('0x62'),_0x3c4209);})[_0xa115('0x13')](function(_0x15c39c){_0x1656dc(_0x15c39c);})[_0xa115('0x29')](function(_0x5a9292){_0x28c203(_0x41d3b6[_0xa115('0x19')](0x1f4,_0x5a9292[_0xa115('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b6237d5..7fd99a3 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 _0xa423=['removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x1df644,_0x513cd7){var _0x236bdb=function(_0x43bc01){while(--_0x43bc01){_0x1df644['push'](_0x1df644['shift']());}};_0x236bdb(++_0x513cd7);}(_0xa423,0x16c));var _0x3a42=function(_0x187404,_0x2e9925){_0x187404=_0x187404-0x0;var _0x30150e=_0xa423[_0x187404];return _0x30150e;};'use strict';var MailAccountEvents=require(_0x3a42('0x0'));var events=[_0x3a42('0x1'),_0x3a42('0x2'),_0x3a42('0x3')];function createListener(_0x27fd92,_0x599118){return function(_0x28bbcd){_0x599118[_0x3a42('0x4')](_0x27fd92,_0x28bbcd);};}function removeListener(_0x5c4f6a,_0xc6780b){return function(){MailAccountEvents[_0x3a42('0x5')](_0x5c4f6a,_0xc6780b);};}exports[_0x3a42('0x6')]=function(_0x1bbd5b){for(var _0x3a83e1=0x0,_0x563134=events[_0x3a42('0x7')];_0x3a83e1<_0x563134;_0x3a83e1++){var _0x439418=events[_0x3a83e1];var _0x3a51c5=createListener(_0x3a42('0x8')+_0x439418,_0x1bbd5b);MailAccountEvents['on'](_0x439418,_0x3a51c5);}}; \ No newline at end of file +var _0x0689=['update','emit','removeListener','register','mailAccount:','save'];(function(_0x281e3a,_0x3e9a4f){var _0x3d5cc0=function(_0x10b843){while(--_0x10b843){_0x281e3a['push'](_0x281e3a['shift']());}};_0x3d5cc0(++_0x3e9a4f);}(_0x0689,0x161));var _0x9068=function(_0x2d6db1,_0x9a6781){_0x2d6db1=_0x2d6db1-0x0;var _0x6379dc=_0x0689[_0x2d6db1];return _0x6379dc;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x9068('0x0'),'remove',_0x9068('0x1')];function createListener(_0xcea3b,_0x222292){return function(_0x45c9e5){_0x222292[_0x9068('0x2')](_0xcea3b,_0x45c9e5);};}function removeListener(_0x1c35ba,_0x3b12f4){return function(){MailAccountEvents[_0x9068('0x3')](_0x1c35ba,_0x3b12f4);};}exports[_0x9068('0x4')]=function(_0x287846){for(var _0x5ce5a7=0x0,_0x34cb67=events['length'];_0x5ce5a7<_0x34cb67;_0x5ce5a7++){var _0x4bdd1b=events[_0x5ce5a7];var _0x17bc63=createListener(_0x9068('0x5')+_0x4bdd1b,_0x287846);MailAccountEvents['on'](_0x4bdd1b,_0x17bc63);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 575fe47..dd0f93f 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 _0xf290=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','show','put','isAuthenticated','update','delete','destroy','exports','util','connect-timeout','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf290,0xde));var _0x0f29=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xf290[_0x51bda1];return _0x1ce08c;};'use strict';var multer=require('multer');var util=require(_0x0f29('0x0'));var path=require('path');var timeout=require(_0x0f29('0x1'));var express=require('express');var router=express[_0x0f29('0x2')]();var auth=require(_0x0f29('0x3'));var interaction=require(_0x0f29('0x4'));var config=require(_0x0f29('0x5'));var controller=require(_0x0f29('0x6'));router['get'](_0x0f29('0x7'),auth['isAuthenticated'](),controller[_0x0f29('0x8')]);router[_0x0f29('0x9')](_0x0f29('0x7'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xb')]);router[_0x0f29('0xc')](_0x0f29('0x7'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xd')]);module[_0x0f29('0xe')]=router; \ No newline at end of file +var _0x153f=['isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/:id'];(function(_0x2b7f1b,_0x387f51){var _0x170e50=function(_0x49a024){while(--_0x49a024){_0x2b7f1b['push'](_0x2b7f1b['shift']());}};_0x170e50(++_0x387f51);}(_0x153f,0x15b));var _0xf153=function(_0x31294d,_0x402504){_0x31294d=_0x31294d-0x0;var _0x5ed716=_0x153f[_0x31294d];return _0x5ed716;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var auth=require(_0xf153('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf153('0x7'));var controller=require('./mailApplication.controller');router[_0xf153('0x8')](_0xf153('0x9'),auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0xc')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0xd')]);router[_0xf153('0xe')](_0xf153('0x9'),auth[_0xf153('0xa')](),controller[_0xf153('0xf')]);module[_0xf153('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 6206a5b..8beefd4 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 _0xd07f=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xd07f,0x7d));var _0xfd07=function(_0x4794c5,_0x2526ac){_0x4794c5=_0x4794c5-0x0;var _0x40c39b=_0xd07f[_0x4794c5];return _0x40c39b;};'use strict';var Sequelize=require('sequelize');module[_0xfd07('0x0')]={'priority':{'type':Sequelize[_0xfd07('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfd07('0x2')],'allowNull':![],'defaultValue':_0xfd07('0x3')},'appdata':{'type':Sequelize[_0xfd07('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfd07('0x2')],'defaultValue':_0xfd07('0x5')}}; \ No newline at end of file +var _0xa3c6=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa3c6,0x1ca));var _0x6a3c=function(_0x39d7f1,_0xf20b2c){_0x39d7f1=_0x39d7f1-0x0;var _0xe92c8d=_0xa3c6[_0x39d7f1];return _0xe92c8d;};'use strict';var Sequelize=require('sequelize');module[_0x6a3c('0x0')]={'priority':{'type':Sequelize[_0x6a3c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6a3c('0x2')],'allowNull':![],'defaultValue':_0x6a3c('0x3')},'appdata':{'type':Sequelize[_0x6a3c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6a3c('0x2')],'defaultValue':_0x6a3c('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index dcd4351..67a975f 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 _0xfafb=['show','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','options','find','update','body','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','Content-Range','apply','reject','save','then','sendStatus','error','name'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xfafb,0xf2));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xbfaf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbfaf('0x1'));var zipdir=require(_0xbfaf('0x2'));var jsonpatch=require(_0xbfaf('0x3'));var rp=require(_0xbfaf('0x4'));var moment=require(_0xbfaf('0x5'));var BPromise=require(_0xbfaf('0x6'));var Mustache=require(_0xbfaf('0x7'));var util=require(_0xbfaf('0x8'));var path=require(_0xbfaf('0x9'));var sox=require(_0xbfaf('0xa'));var csv=require(_0xbfaf('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbfaf('0xc'));var squel=require('squel');var crypto=require(_0xbfaf('0xd'));var jsforce=require(_0xbfaf('0xe'));var deskjs=require(_0xbfaf('0xf'));var toCsv=require(_0xbfaf('0xb'));var querystring=require(_0xbfaf('0x10'));var Papa=require(_0xbfaf('0x11'));var Redis=require('ioredis');var authService=require(_0xbfaf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbfaf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfaf('0x14'))(_0xbfaf('0x15'));var utils=require(_0xbfaf('0x16'));var config=require(_0xbfaf('0x17'));var db=require(_0xbfaf('0x18'))['db'];function respondWithStatusCode(_0x1dab61,_0x466f16){_0x466f16=_0x466f16||0xcc;return function(_0x10375c){if(_0x10375c){return _0x1dab61['sendStatus'](_0x466f16);}return _0x1dab61[_0xbfaf('0x19')](_0x466f16)[_0xbfaf('0x1a')]();};}function respondWithResult(_0x29ecde,_0x46c8cb){_0x46c8cb=_0x46c8cb||0xc8;return function(_0x4f87e2){if(_0x4f87e2){return _0x29ecde[_0xbfaf('0x19')](_0x46c8cb)[_0xbfaf('0x1b')](_0x4f87e2);}};}function respondWithFilteredResult(_0x3b3320,_0x3c80af){return function(_0x570961){if(_0x570961){var _0x386066=_0x570961[_0xbfaf('0x1c')],_0x15bc12=_0x3c80af['offset'],_0x569256=_0x3c80af['offset']+_0x3c80af[_0xbfaf('0x1d')],_0x5c9a01;if(_0x569256>=_0x386066){_0x569256=_0x386066;_0x5c9a01=0xc8;}else{_0x5c9a01=0xce;}_0x3b3320[_0xbfaf('0x19')](_0x5c9a01);return _0x3b3320['set'](_0xbfaf('0x1e'),_0x15bc12+'-'+_0x569256+'/'+_0x386066)[_0xbfaf('0x1b')](_0x570961);}return null;};}function patchUpdates(_0x4dc4e1){return function(_0x298365){try{jsonpatch[_0xbfaf('0x1f')](_0x298365,_0x4dc4e1,!![]);}catch(_0x5cd9e8){return BPromise[_0xbfaf('0x20')](_0x5cd9e8);}return _0x298365[_0xbfaf('0x21')]();};}function saveUpdates(_0x503f89,_0x2d418f){return function(_0x2cf5b5){if(_0x2cf5b5){return _0x2cf5b5['update'](_0x503f89)['then'](function(_0x226830){return _0x226830;});}return null;};}function removeEntity(_0x347999,_0x5e5758){return function(_0x52c41e){if(_0x52c41e){return _0x52c41e['destroy']()[_0xbfaf('0x22')](function(){_0x347999[_0xbfaf('0x19')](0xcc)[_0xbfaf('0x1a')]();});}};}function handleEntityNotFound(_0xad4a44,_0x35bd6a){return function(_0xef1d32){if(!_0xef1d32){_0xad4a44[_0xbfaf('0x23')](0x194);}return _0xef1d32;};}function handleError(_0x406140,_0x263d4a){_0x263d4a=_0x263d4a||0x1f4;return function(_0x323d8e){logger[_0xbfaf('0x24')](_0x323d8e['stack']);if(_0x323d8e[_0xbfaf('0x25')]){delete _0x323d8e['name'];}_0x406140[_0xbfaf('0x19')](_0x263d4a)['send'](_0x323d8e);};}exports[_0xbfaf('0x26')]=function(_0xff7271,_0x4978a6){var _0x10657a={'raw':!![],'where':{'id':_0xff7271[_0xbfaf('0x27')]['id']}},_0x3484c3={};_0x3484c3['model']=_[_0xbfaf('0x28')](db[_0xbfaf('0x29')][_0xbfaf('0x2a')]);_0x3484c3[_0xbfaf('0x2b')]=_['keys'](_0xff7271[_0xbfaf('0x2b')]);_0x3484c3[_0xbfaf('0x2c')]=_[_0xbfaf('0x2d')](_0x3484c3[_0xbfaf('0x2e')],_0x3484c3[_0xbfaf('0x2b')]);_0x10657a[_0xbfaf('0x2f')]=_[_0xbfaf('0x2d')](_0x3484c3[_0xbfaf('0x2e')],qs[_0xbfaf('0x30')](_0xff7271[_0xbfaf('0x2b')]['fields']));_0x10657a['attributes']=_0x10657a[_0xbfaf('0x2f')]['length']?_0x10657a[_0xbfaf('0x2f')]:_0x3484c3['model'];if(_0xff7271['query'][_0xbfaf('0x31')]){_0x10657a[_0xbfaf('0x32')]=[{'all':!![]}];}_0x10657a=_['merge']({},_0x10657a,_0xff7271[_0xbfaf('0x33')]);return db[_0xbfaf('0x29')][_0xbfaf('0x34')](_0x10657a)['then'](handleEntityNotFound(_0x4978a6,null))[_0xbfaf('0x22')](respondWithResult(_0x4978a6,null))['catch'](handleError(_0x4978a6,null));};exports[_0xbfaf('0x35')]=function(_0x4d6c68,_0x12142a){if(_0x4d6c68[_0xbfaf('0x36')]['id']){delete _0x4d6c68[_0xbfaf('0x36')]['id'];}return db[_0xbfaf('0x29')][_0xbfaf('0x34')]({'where':{'id':_0x4d6c68[_0xbfaf('0x27')]['id']}})[_0xbfaf('0x22')](handleEntityNotFound(_0x12142a,null))[_0xbfaf('0x22')](saveUpdates(_0x4d6c68[_0xbfaf('0x36')],null))['then'](respondWithResult(_0x12142a,null))[_0xbfaf('0x37')](handleError(_0x12142a,null));};exports['destroy']=function(_0x4d976d,_0x2c9e67){return db[_0xbfaf('0x29')]['find']({'where':{'id':_0x4d976d[_0xbfaf('0x27')]['id']}})[_0xbfaf('0x22')](handleEntityNotFound(_0x2c9e67,null))[_0xbfaf('0x22')](removeEntity(_0x2c9e67,null))[_0xbfaf('0x37')](handleError(_0x2c9e67,null));}; \ No newline at end of file +var _0xece2=['error','name','send','show','params','keys','MailApplication','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','body','html-pdf','rimraf','fast-json-patch','request-promise','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','update','then','destroy'];(function(_0x1f74e2,_0x208f27){var _0x24ace5=function(_0x129d57){while(--_0x129d57){_0x1f74e2['push'](_0x1f74e2['shift']());}};_0x24ace5(++_0x208f27);}(_0xece2,0x1f2));var _0x2ece=function(_0x84b834,_0x204560){_0x84b834=_0x84b834-0x0;var _0x160b64=_0xece2[_0x84b834];return _0x160b64;};'use strict';var pdf=require(_0x2ece('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2ece('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ece('0x2'));var rp=require(_0x2ece('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2ece('0x4'));var path=require('path');var sox=require(_0x2ece('0x5'));var csv=require(_0x2ece('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2ece('0x7'));var squel=require('squel');var crypto=require(_0x2ece('0x8'));var jsforce=require(_0x2ece('0x9'));var deskjs=require(_0x2ece('0xa'));var toCsv=require(_0x2ece('0x6'));var querystring=require('querystring');var Papa=require(_0x2ece('0xb'));var Redis=require('ioredis');var authService=require(_0x2ece('0xc'));var qs=require(_0x2ece('0xd'));var as=require(_0x2ece('0xe'));var hardwareService=require(_0x2ece('0xf'));var logger=require(_0x2ece('0x10'))(_0x2ece('0x11'));var utils=require(_0x2ece('0x12'));var config=require(_0x2ece('0x13'));var db=require(_0x2ece('0x14'))['db'];function respondWithStatusCode(_0x4d3f64,_0x62e45a){_0x62e45a=_0x62e45a||0xcc;return function(_0x3bcce4){if(_0x3bcce4){return _0x4d3f64[_0x2ece('0x15')](_0x62e45a);}return _0x4d3f64[_0x2ece('0x16')](_0x62e45a)[_0x2ece('0x17')]();};}function respondWithResult(_0x3a2c76,_0x2fa45f){_0x2fa45f=_0x2fa45f||0xc8;return function(_0x247a9b){if(_0x247a9b){return _0x3a2c76[_0x2ece('0x16')](_0x2fa45f)[_0x2ece('0x18')](_0x247a9b);}};}function respondWithFilteredResult(_0x1f4638,_0x1191a2){return function(_0x4f9084){if(_0x4f9084){var _0x2aa769=_0x4f9084[_0x2ece('0x19')],_0x4e502f=_0x1191a2[_0x2ece('0x1a')],_0x2d7ade=_0x1191a2[_0x2ece('0x1a')]+_0x1191a2[_0x2ece('0x1b')],_0x5b73c2;if(_0x2d7ade>=_0x2aa769){_0x2d7ade=_0x2aa769;_0x5b73c2=0xc8;}else{_0x5b73c2=0xce;}_0x1f4638['status'](_0x5b73c2);return _0x1f4638['set'](_0x2ece('0x1c'),_0x4e502f+'-'+_0x2d7ade+'/'+_0x2aa769)['json'](_0x4f9084);}return null;};}function patchUpdates(_0x3bd4c5){return function(_0x3b9484){try{jsonpatch['apply'](_0x3b9484,_0x3bd4c5,!![]);}catch(_0x37b0d7){return BPromise['reject'](_0x37b0d7);}return _0x3b9484['save']();};}function saveUpdates(_0x2eddcc,_0x1c69f9){return function(_0xcecf8){if(_0xcecf8){return _0xcecf8[_0x2ece('0x1d')](_0x2eddcc)[_0x2ece('0x1e')](function(_0x34a5a6){return _0x34a5a6;});}return null;};}function removeEntity(_0xc09cfa,_0x16c27e){return function(_0x384352){if(_0x384352){return _0x384352[_0x2ece('0x1f')]()[_0x2ece('0x1e')](function(){_0xc09cfa[_0x2ece('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3b70,_0x550f68){return function(_0x1f777e){if(!_0x1f777e){_0x1e3b70[_0x2ece('0x15')](0x194);}return _0x1f777e;};}function handleError(_0x5aeaeb,_0x3a8320){_0x3a8320=_0x3a8320||0x1f4;return function(_0x3abfe0){logger[_0x2ece('0x20')](_0x3abfe0['stack']);if(_0x3abfe0[_0x2ece('0x21')]){delete _0x3abfe0[_0x2ece('0x21')];}_0x5aeaeb[_0x2ece('0x16')](_0x3a8320)[_0x2ece('0x22')](_0x3abfe0);};}exports[_0x2ece('0x23')]=function(_0x1cd31e,_0x2149ac){var _0x3904ee={'raw':!![],'where':{'id':_0x1cd31e[_0x2ece('0x24')]['id']}},_0x15e13f={};_0x15e13f['model']=_[_0x2ece('0x25')](db[_0x2ece('0x26')]['rawAttributes']);_0x15e13f[_0x2ece('0x27')]=_[_0x2ece('0x25')](_0x1cd31e[_0x2ece('0x27')]);_0x15e13f[_0x2ece('0x28')]=_[_0x2ece('0x29')](_0x15e13f[_0x2ece('0x2a')],_0x15e13f[_0x2ece('0x27')]);_0x3904ee['attributes']=_['intersection'](_0x15e13f['model'],qs[_0x2ece('0x2b')](_0x1cd31e[_0x2ece('0x27')]['fields']));_0x3904ee[_0x2ece('0x2c')]=_0x3904ee[_0x2ece('0x2c')][_0x2ece('0x2d')]?_0x3904ee[_0x2ece('0x2c')]:_0x15e13f[_0x2ece('0x2a')];if(_0x1cd31e['query'][_0x2ece('0x2e')]){_0x3904ee[_0x2ece('0x2f')]=[{'all':!![]}];}_0x3904ee=_[_0x2ece('0x30')]({},_0x3904ee,_0x1cd31e[_0x2ece('0x31')]);return db[_0x2ece('0x26')][_0x2ece('0x32')](_0x3904ee)[_0x2ece('0x1e')](handleEntityNotFound(_0x2149ac,null))[_0x2ece('0x1e')](respondWithResult(_0x2149ac,null))[_0x2ece('0x33')](handleError(_0x2149ac,null));};exports['update']=function(_0x42bc1c,_0x2ba602){if(_0x42bc1c['body']['id']){delete _0x42bc1c['body']['id'];}return db['MailApplication'][_0x2ece('0x32')]({'where':{'id':_0x42bc1c[_0x2ece('0x24')]['id']}})[_0x2ece('0x1e')](handleEntityNotFound(_0x2ba602,null))[_0x2ece('0x1e')](saveUpdates(_0x42bc1c[_0x2ece('0x34')],null))['then'](respondWithResult(_0x2ba602,null))[_0x2ece('0x33')](handleError(_0x2ba602,null));};exports[_0x2ece('0x1f')]=function(_0x4b7f04,_0x5668f1){return db['MailApplication'][_0x2ece('0x32')]({'where':{'id':_0x4b7f04['params']['id']}})[_0x2ece('0x1e')](handleEntityNotFound(_0x5668f1,null))[_0x2ece('0x1e')](removeEntity(_0x5668f1,null))[_0x2ece('0x33')](handleError(_0x5668f1,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3c96c10..875a0ff 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 _0x95e6=['request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0x95e6,0xe9));var _0x695e=function(_0x101394,_0x2388bb){_0x101394=_0x101394-0x0;var _0x205cf4=_0x95e6[_0x101394];return _0x205cf4;};'use strict';var _=require(_0x695e('0x0'));var util=require(_0x695e('0x1'));var logger=require(_0x695e('0x2'))(_0x695e('0x3'));var moment=require(_0x695e('0x4'));var BPromise=require('bluebird');var rp=require(_0x695e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x695e('0x6'));var config=require(_0x695e('0x7'));var attributes=require(_0x695e('0x8'));module[_0x695e('0x9')]=function(_0x42f9cf,_0x90d5da){return _0x42f9cf[_0x695e('0xa')]('MailApplication',attributes,{'tableName':_0x695e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x695e('0xc'),'collate':_0x695e('0xd')});}; \ No newline at end of file +var _0x3d95=['moment','request-promise','../../config/environment','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d95,0xb2));var _0x53d9=function(_0x394d45,_0x466805){_0x394d45=_0x394d45-0x0;var _0x3ba7f9=_0x3d95[_0x394d45];return _0x3ba7f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53d9('0x0'))(_0x53d9('0x1'));var moment=require(_0x53d9('0x2'));var BPromise=require('bluebird');var rp=require(_0x53d9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x53d9('0x4'));var attributes=require('./mailApplication.attributes');module[_0x53d9('0x5')]=function(_0x29ec42,_0x37b9f0){return _0x29ec42['define'](_0x53d9('0x6'),attributes,{'tableName':_0x53d9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x53d9('0x8'),'collate':_0x53d9('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index b12c731..a1cc5a9 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 _0xfaba=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','update','options','raw','where','limit','then'];(function(_0x123590,_0x525354){var _0x503fb7=function(_0xb294ae){while(--_0xb294ae){_0x123590['push'](_0x123590['shift']());}};_0x503fb7(++_0x525354);}(_0xfaba,0x17a));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xafab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xafab('0x1'));var rs=require(_0xafab('0x2'));var fs=require('fs');var Redis=require(_0xafab('0x3'));var db=require(_0xafab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xafab('0x5'))(_0xafab('0x6'));var config=require(_0xafab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xafab('0x8')][_0xafab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9f0c97,_0x231f50,_0x2b288b){return new BPromise(function(_0x305890,_0x4d4e62){return client[_0xafab('0xa')](_0x9f0c97,_0x2b288b)['then'](function(_0x2d5bf1){logger[_0xafab('0xb')]('MailApplication,\x20%s,\x20%s',_0x231f50,_0xafab('0xc'));logger[_0xafab('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x231f50,_0xafab('0xc'),JSON[_0xafab('0xe')](_0x2d5bf1));if(_0x2d5bf1[_0xafab('0xf')]){if(_0x2d5bf1[_0xafab('0xf')]['code']===0x1f4){logger[_0xafab('0xf')]('MailApplication,\x20%s,\x20%s',_0x231f50,_0x2d5bf1[_0xafab('0xf')]['message']);return _0x4d4e62(_0x2d5bf1[_0xafab('0xf')]['message']);}logger[_0xafab('0xf')](_0xafab('0x10'),_0x231f50,_0x2d5bf1[_0xafab('0xf')]['message']);return _0x305890(_0x2d5bf1[_0xafab('0xf')]['message']);}else{logger[_0xafab('0xb')](_0xafab('0x10'),_0x231f50,_0xafab('0xc'));_0x305890(_0x2d5bf1['result'][_0xafab('0x11')]);}})[_0xafab('0x12')](function(_0x44885d){logger[_0xafab('0xf')](_0xafab('0x10'),_0x231f50,_0x44885d);_0x4d4e62(_0x44885d);});});}exports[_0xafab('0x13')]=function(_0x3d31b7){var _0x44f21c=this;return new Promise(function(_0x692cf6,_0x4adcf0){return db[_0xafab('0x14')][_0xafab('0x15')](_0x3d31b7['body'],{'raw':_0x3d31b7['options']?_0x3d31b7[_0xafab('0x16')][_0xafab('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d31b7['options']?_0x3d31b7['options'][_0xafab('0x18')]||null:null,'attributes':_0x3d31b7[_0xafab('0x16')]?_0x3d31b7[_0xafab('0x16')]['attributes']||null:null,'limit':_0x3d31b7[_0xafab('0x16')]?_0x3d31b7[_0xafab('0x16')][_0xafab('0x19')]||null:null})[_0xafab('0x1a')](function(_0x3dc72b){logger[_0xafab('0xb')](_0xafab('0x13'),_0x3d31b7);logger[_0xafab('0xd')](_0xafab('0x13'),_0x3d31b7,JSON[_0xafab('0xe')](_0x3dc72b));_0x692cf6(_0x3dc72b);})[_0xafab('0x12')](function(_0x2025ab){logger[_0xafab('0xf')](_0xafab('0x13'),_0x2025ab[_0xafab('0x11')],_0x3d31b7);_0x4adcf0(_0x44f21c[_0xafab('0xf')](0x1f4,_0x2025ab[_0xafab('0x11')]));});});}; \ No newline at end of file +var _0x5a3a=['stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','MailApplication','update','body','options','raw','where','attributes','UpdateMailApplication','debug'];(function(_0x240030,_0x3d5869){var _0x101d91=function(_0x37c19d){while(--_0x37c19d){_0x240030['push'](_0x240030['shift']());}};_0x101d91(++_0x3d5869);}(_0x5a3a,0x1a1));var _0xa5a3=function(_0x262739,_0x4d8e86){_0x262739=_0x262739-0x0;var _0x5b7176=_0x5a3a[_0x262739];return _0x5b7176;};'use strict';var _=require(_0xa5a3('0x0'));var util=require(_0xa5a3('0x1'));var moment=require('moment');var BPromise=require(_0xa5a3('0x2'));var rs=require(_0xa5a3('0x3'));var fs=require('fs');var Redis=require(_0xa5a3('0x4'));var db=require(_0xa5a3('0x5'))['db'];var utils=require(_0xa5a3('0x6'));var logger=require(_0xa5a3('0x7'))('rpc');var config=require(_0xa5a3('0x8'));var jayson=require(_0xa5a3('0x9'));var client=jayson[_0xa5a3('0xa')][_0xa5a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab5af,_0x16b75d,_0x90a647){return new BPromise(function(_0x40165a,_0x1d71fe){return client[_0xa5a3('0xc')](_0x5ab5af,_0x90a647)[_0xa5a3('0xd')](function(_0x9714d4){logger[_0xa5a3('0xe')](_0xa5a3('0xf'),_0x16b75d,_0xa5a3('0x10'));logger['debug'](_0xa5a3('0x11'),_0x16b75d,_0xa5a3('0x10'),JSON['stringify'](_0x9714d4));if(_0x9714d4['error']){if(_0x9714d4[_0xa5a3('0x12')][_0xa5a3('0x13')]===0x1f4){logger['error'](_0xa5a3('0xf'),_0x16b75d,_0x9714d4[_0xa5a3('0x12')][_0xa5a3('0x14')]);return _0x1d71fe(_0x9714d4[_0xa5a3('0x12')][_0xa5a3('0x14')]);}logger[_0xa5a3('0x12')](_0xa5a3('0xf'),_0x16b75d,_0x9714d4['error']['message']);return _0x40165a(_0x9714d4[_0xa5a3('0x12')]['message']);}else{logger['info'](_0xa5a3('0xf'),_0x16b75d,_0xa5a3('0x10'));_0x40165a(_0x9714d4['result']['message']);}})[_0xa5a3('0x15')](function(_0x2da6eb){logger[_0xa5a3('0x12')]('MailApplication,\x20%s,\x20%s',_0x16b75d,_0x2da6eb);_0x1d71fe(_0x2da6eb);});});}exports['UpdateMailApplication']=function(_0x45684e){var _0x36ca97=this;return new Promise(function(_0x40c9fe,_0xc6a685){return db[_0xa5a3('0x16')][_0xa5a3('0x17')](_0x45684e[_0xa5a3('0x18')],{'raw':_0x45684e['options']?_0x45684e[_0xa5a3('0x19')][_0xa5a3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45684e[_0xa5a3('0x19')]?_0x45684e[_0xa5a3('0x19')][_0xa5a3('0x1b')]||null:null,'attributes':_0x45684e['options']?_0x45684e[_0xa5a3('0x19')][_0xa5a3('0x1c')]||null:null,'limit':_0x45684e[_0xa5a3('0x19')]?_0x45684e['options']['limit']||null:null})[_0xa5a3('0xd')](function(_0x12af2d){logger[_0xa5a3('0xe')](_0xa5a3('0x1d'),_0x45684e);logger[_0xa5a3('0x1e')]('UpdateMailApplication',_0x45684e,JSON[_0xa5a3('0x1f')](_0x12af2d));_0x40c9fe(_0x12af2d);})[_0xa5a3('0x15')](function(_0x2a32ae){logger[_0xa5a3('0x12')]('UpdateMailApplication',_0x2a32ae[_0xa5a3('0x14')],_0x45684e);_0xc6a685(_0x36ca97['error'](0x1f4,_0x2a32ae[_0xa5a3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a6f06ae..d8c6f92 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 _0x29e0=['addMessage','/:id/tags','tracked','mailinteraction:addtags','put','/:id','mail','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','/describe','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x1c7a0a,_0x2ec050){var _0x10f79e=function(_0x1df661){while(--_0x1df661){_0x1c7a0a['push'](_0x1c7a0a['shift']());}};_0x10f79e(++_0x2ec050);}(_0x29e0,0x1c8));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x029e('0x0'));var util=require(_0x029e('0x1'));var path=require(_0x029e('0x2'));var timeout=require(_0x029e('0x3'));var express=require(_0x029e('0x4'));var router=express[_0x029e('0x5')]();var auth=require(_0x029e('0x6'));var interaction=require(_0x029e('0x7'));var config=require(_0x029e('0x8'));var controller=require(_0x029e('0x9'));router[_0x029e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x029e('0xa')](_0x029e('0xb'),auth[_0x029e('0xc')](),controller['describe']);router[_0x029e('0xa')]('/:id',auth[_0x029e('0xc')](),controller[_0x029e('0xd')]);router[_0x029e('0xa')](_0x029e('0xe'),auth[_0x029e('0xc')](),controller[_0x029e('0xf')]);router['get'](_0x029e('0x10'),auth[_0x029e('0xc')](),controller[_0x029e('0x11')]);router[_0x029e('0x12')]('/',auth['isAuthenticated'](),controller[_0x029e('0x13')]);router[_0x029e('0x12')](_0x029e('0xe'),auth[_0x029e('0xc')](),controller[_0x029e('0x14')]);router[_0x029e('0x12')](_0x029e('0x15'),auth[_0x029e('0xc')](),interaction[_0x029e('0x16')]('mail',_0x029e('0x17')),controller['addTags']);router[_0x029e('0x18')](_0x029e('0x19'),auth[_0x029e('0xc')](),interaction[_0x029e('0x16')](_0x029e('0x1a'),_0x029e('0x1b')),controller[_0x029e('0x1c')]);router['delete']('/:id',auth[_0x029e('0xc')](),interaction[_0x029e('0x16')]('mail',_0x029e('0x1d')),controller[_0x029e('0x1e')]);router[_0x029e('0x1f')]('/:id/tags',auth[_0x029e('0xc')](),controller[_0x029e('0x20')]);module[_0x029e('0x21')]=router; \ No newline at end of file +var _0xb10f=['mail','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x34a714,_0x272a96){var _0x4b8377=function(_0x2178ad){while(--_0x2178ad){_0x34a714['push'](_0x34a714['shift']());}};_0x4b8377(++_0x272a96);}(_0xb10f,0xa3));var _0xfb10=function(_0x209bb2,_0x1cb28d){_0x209bb2=_0x209bb2-0x0;var _0x32ffa1=_0xb10f[_0x209bb2];return _0x32ffa1;};'use strict';var multer=require('multer');var util=require(_0xfb10('0x0'));var path=require(_0xfb10('0x1'));var timeout=require(_0xfb10('0x2'));var express=require('express');var router=express[_0xfb10('0x3')]();var auth=require(_0xfb10('0x4'));var interaction=require(_0xfb10('0x5'));var config=require(_0xfb10('0x6'));var controller=require(_0xfb10('0x7'));router[_0xfb10('0x8')]('/',auth['isAuthenticated'](),controller[_0xfb10('0x9')]);router[_0xfb10('0x8')](_0xfb10('0xa'),auth[_0xfb10('0xb')](),controller['describe']);router[_0xfb10('0x8')](_0xfb10('0xc'),auth['isAuthenticated'](),controller[_0xfb10('0xd')]);router[_0xfb10('0x8')](_0xfb10('0xe'),auth[_0xfb10('0xb')](),controller[_0xfb10('0xf')]);router[_0xfb10('0x8')](_0xfb10('0x10'),auth['isAuthenticated'](),controller[_0xfb10('0x11')]);router[_0xfb10('0x12')]('/',auth[_0xfb10('0xb')](),controller[_0xfb10('0x13')]);router['post'](_0xfb10('0xe'),auth['isAuthenticated'](),controller[_0xfb10('0x14')]);router[_0xfb10('0x12')](_0xfb10('0x15'),auth[_0xfb10('0xb')](),interaction[_0xfb10('0x16')](_0xfb10('0x17'),'mailinteraction:addtags'),controller[_0xfb10('0x18')]);router[_0xfb10('0x19')](_0xfb10('0xc'),auth[_0xfb10('0xb')](),interaction[_0xfb10('0x16')](_0xfb10('0x17'),'mailinteraction:update'),controller[_0xfb10('0x1a')]);router[_0xfb10('0x1b')](_0xfb10('0xc'),auth[_0xfb10('0xb')](),interaction[_0xfb10('0x16')](_0xfb10('0x17'),_0xfb10('0x1c')),controller[_0xfb10('0x1d')]);router[_0xfb10('0x1b')](_0xfb10('0x15'),auth[_0xfb10('0xb')](),controller[_0xfb10('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index dc913c0..e782d21 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 _0x490a=['exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out'];(function(_0x147539,_0x37263a){var _0x54fe18=function(_0x161019){while(--_0x161019){_0x147539['push'](_0x147539['shift']());}};_0x54fe18(++_0x37263a);}(_0x490a,0x1d8));var _0xa490=function(_0x1c0fc4,_0x4b1d43){_0x1c0fc4=_0x1c0fc4-0x0;var _0x5b8bc0=_0x490a[_0x1c0fc4];return _0x5b8bc0;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xa490('0x0')]={'closed':{'type':Sequelize[_0xa490('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa490('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xa490('0x2')](0x1fe)},'to':{'type':Sequelize[_0xa490('0x2')]},'cc':{'type':Sequelize[_0xa490('0x3')](_0xa490('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa490('0x5')]},'substatus':{'type':Sequelize[_0xa490('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0xa490('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xa490('0x6')]('in',_0xa490('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa490('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xa490('0x6')]('in',_0xa490('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0xa490('0x4'))},'lastMsgText':{'type':Sequelize[_0xa490('0x3')](_0xa490('0x4'))}}; \ No newline at end of file +var _0xc139=['out','sequelize','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x3401de,_0x35f46d){var _0x360475=function(_0x3fad4f){while(--_0x3fad4f){_0x3401de['push'](_0x3401de['shift']());}};_0x360475(++_0x35f46d);}(_0xc139,0x1b9));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9c13('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x9c13('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9c13('0x2')]},'disposition':{'type':Sequelize[_0x9c13('0x3')]},'note':{'type':Sequelize[_0x9c13('0x3')]},'inReplyTo':{'type':Sequelize[_0x9c13('0x3')](0x1fe)},'to':{'type':Sequelize[_0x9c13('0x3')]},'cc':{'type':Sequelize[_0x9c13('0x4')](_0x9c13('0x5'))},'subject':{'type':Sequelize[_0x9c13('0x4')]()},'attach':{'type':Sequelize[_0x9c13('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9c13('0x2')]},'substatus':{'type':Sequelize[_0x9c13('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x9c13('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x9c13('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9c13('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9c13('0x6')]('in',_0x9c13('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x9c13('0x5'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x9c13('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c68c003..e3313be 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(_0x1c22d7,_0x502878){var _0x5a9014=function(_0x4f91de){while(--_0x4f91de){_0x1c22d7['push'](_0x1c22d7['shift']());}};_0x5a9014(++_0x502878);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x64f05,_0x4e1a8c){var _0x2625b4=function(_0x2403d4){while(--_0x2403d4){_0x64f05['push'](_0x64f05['shift']());}};_0x2625b4(++_0x4e1a8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 10f4975..61679cf 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 _0xed13=['then','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x2c23eb,_0x3f5331){var _0x297060=function(_0x19d911){while(--_0x19d911){_0x2c23eb['push'](_0x2c23eb['shift']());}};_0x297060(++_0x3f5331);}(_0xed13,0xab));var _0x3ed1=function(_0x2ec3c8,_0x2e0806){_0x2ec3c8=_0x2ec3c8-0x0;var _0x30944b=_0xed13[_0x2ec3c8];return _0x30944b;};'use strict';var EventEmitter=require(_0x3ed1('0x0'));var MailInteraction=require(_0x3ed1('0x1'))['db'][_0x3ed1('0x2')];var MailMessage=require(_0x3ed1('0x1'))['db'][_0x3ed1('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3ed1('0x4')](0x0);var events={'afterCreate':_0x3ed1('0x5'),'afterUpdate':_0x3ed1('0x6'),'afterDestroy':_0x3ed1('0x7')};function emitEvent(_0x56e66e){return function(_0x1cbe73,_0x3f3278,_0x1dc915){_0x1cbe73[_0x3ed1('0x8')]({'attributes':['id'],'raw':!![]})[_0x3ed1('0x9')](function(_0x453f21){_0x1cbe73['setDataValue'](_0x3ed1('0xa'),_0x453f21[_0x3ed1('0xb')](function(_0x35c982){return{'id':_0x35c982['id']};}));return MailMessage[_0x3ed1('0xc')]({'where':{'MailInteractionId':_0x1cbe73['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3ed1('0x9')](function(_0x4e5123){_0x1cbe73['setDataValue'](_0x3ed1('0xd'),_0x4e5123[_0x3ed1('0xe')]);MailInteractionEvents[_0x3ed1('0xf')](_0x56e66e+':'+_0x1cbe73['id'],_0x1cbe73);MailInteractionEvents['emit'](_0x56e66e,_0x1cbe73);_0x1dc915(null);})[_0x3ed1('0x10')](_0x1dc915(null));};}for(var e in events){if(events[_0x3ed1('0x11')](e)){var event=events[e];MailInteraction[_0x3ed1('0x12')](e,emitEvent(event));}}module[_0x3ed1('0x13')]=MailInteractionEvents; \ No newline at end of file +var _0x1975=['save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x1975,0xf7));var _0x5197=function(_0x254635,_0x472b4c){_0x254635=_0x254635-0x0;var _0x35293c=_0x1975[_0x254635];return _0x35293c;};'use strict';var EventEmitter=require(_0x5197('0x0'));var MailInteraction=require(_0x5197('0x1'))['db'][_0x5197('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x5197('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5197('0x4')](0x0);var events={'afterCreate':_0x5197('0x5'),'afterUpdate':_0x5197('0x6'),'afterDestroy':'remove'};function emitEvent(_0x31f551){return function(_0x3dd62e,_0x1eb8a7,_0x41a225){_0x3dd62e[_0x5197('0x7')]({'attributes':['id'],'raw':!![]})[_0x5197('0x8')](function(_0x5cf744){_0x3dd62e['setDataValue'](_0x5197('0x9'),_0x5cf744[_0x5197('0xa')](function(_0x19d44e){return{'id':_0x19d44e['id']};}));return MailMessage[_0x5197('0xb')]({'where':{'MailInteractionId':_0x3dd62e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5197('0x8')](function(_0x3cbe33){_0x3dd62e[_0x5197('0xc')](_0x5197('0xd'),_0x3cbe33['length']);MailInteractionEvents[_0x5197('0xe')](_0x31f551+':'+_0x3dd62e['id'],_0x3dd62e);MailInteractionEvents[_0x5197('0xe')](_0x31f551,_0x3dd62e);_0x41a225(null);})[_0x5197('0xf')](_0x41a225(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x5197('0x10')](e,emitEvent(event));}}module[_0x5197('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ae247c1..af72935 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 _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(_0xa0c409,_0x261654){_0xa0c409=_0xa0c409-0x0;var _0x153ed0=_0x3e74[_0xa0c409];return _0x153ed0;};'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 +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(_0x4ad354,_0x4982b6){var _0x2a8f86=function(_0x391cd1){while(--_0x391cd1){_0x4ad354['push'](_0x4ad354['shift']());}};_0x2a8f86(++_0x4982b6);}(_0x008c,0x188));var _0xc008=function(_0x552dec,_0x27a96d){_0x552dec=_0x552dec-0x0;var _0xcd5ca6=_0x008c[_0x552dec];return _0xcd5ca6;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('MailInteraction',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc008('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52041f,_0x27830d,_0x7231b4){if(_0x52041f['substatus']){_0x52041f['substatusAt']=moment()['format'](_0xc008('0xe'));}if(_0x52041f[_0xc008('0xf')]){_0x52041f['closedAt']=moment()[_0xc008('0x10')](_0xc008('0xe'));}_0x7231b4(null,_0x27830d);},'beforeUpdate':function(_0x2ea200,_0x2a5b4e,_0x9ffa93){if(_0x2ea200[_0xc008('0x11')](_0xc008('0x12'))){_0x2ea200['substatusAt']=_0x2ea200['substatus']?moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ea200[_0xc008('0x11')](_0xc008('0xf'))){_0x2ea200[_0xc008('0x13')]=moment()[_0xc008('0x10')](_0xc008('0xe'));_0x2ea200['substatus']=null;_0x2ea200['substatusAt']=null;}_0x9ffa93(null,_0x2ea200);},'afterUpdate':function(_0x4bd0f4,_0x11ef38,_0x15a6ad){var _0x3cafe3=_0x13aa7[_0xc008('0x14')];var _0x4fe771=_0x4bd0f4['get']({'plain':!![]});if(_0x4fe771['closed']){return _0x3cafe3['MailMessage'][_0xc008('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x4fe771['id']}})[_0xc008('0x16')](function(){_0x15a6ad();})['catch'](function(_0x813397){_0x15a6ad(_0x813397);});}else{_0x15a6ad();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index abc1981..ddfcc06 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 _0x851d=['stringify','error','code','message','info','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','catch','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2be6e9,_0x46a29f){var _0x501586=function(_0x20a68f){while(--_0x20a68f){_0x2be6e9['push'](_0x2be6e9['shift']());}};_0x501586(++_0x46a29f);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd851('0x0'));var util=require('util');var moment=require(_0xd851('0x1'));var BPromise=require(_0xd851('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd851('0x3'));var db=require(_0xd851('0x4'))['db'];var utils=require(_0xd851('0x5'));var logger=require(_0xd851('0x6'))(_0xd851('0x7'));var config=require(_0xd851('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd851('0x9')]({'port':0x232a});config[_0xd851('0xa')]=_[_0xd851('0xb')](config[_0xd851('0xa')],{'host':_0xd851('0xc'),'port':0x18eb});var socket=require(_0xd851('0xd'))(new Redis(config['redis']));require(_0xd851('0xe'))['register'](socket);function respondWithRpcPromise(_0x33e66a,_0x3eb8ca,_0x5b8882){return new BPromise(function(_0x179113,_0x45a15d){return client[_0xd851('0xf')](_0x33e66a,_0x5b8882)[_0xd851('0x10')](function(_0x4cb297){logger['info'](_0xd851('0x11'),_0x3eb8ca,_0xd851('0x12'));logger[_0xd851('0x13')](_0xd851('0x14'),_0x3eb8ca,'request\x20sent',JSON[_0xd851('0x15')](_0x4cb297));if(_0x4cb297[_0xd851('0x16')]){if(_0x4cb297['error'][_0xd851('0x17')]===0x1f4){logger[_0xd851('0x16')](_0xd851('0x11'),_0x3eb8ca,_0x4cb297['error'][_0xd851('0x18')]);return _0x45a15d(_0x4cb297[_0xd851('0x16')][_0xd851('0x18')]);}logger[_0xd851('0x16')](_0xd851('0x11'),_0x3eb8ca,_0x4cb297[_0xd851('0x16')]['message']);return _0x179113(_0x4cb297[_0xd851('0x16')][_0xd851('0x18')]);}else{logger[_0xd851('0x19')](_0xd851('0x11'),_0x3eb8ca,_0xd851('0x12'));_0x179113(_0x4cb297[_0xd851('0x1a')][_0xd851('0x18')]);}})['catch'](function(_0x4b1630){logger[_0xd851('0x16')](_0xd851('0x11'),_0x3eb8ca,_0x4b1630);_0x45a15d(_0x4b1630);});});}exports[_0xd851('0x1b')]=function(_0x300aba){var _0x31b313=this;return new Promise(function(_0x11c845,_0x8585e5){return db[_0xd851('0x1c')][_0xd851('0x1d')](_0x300aba[_0xd851('0x1e')],{'raw':_0x300aba[_0xd851('0x1f')]?_0x300aba[_0xd851('0x1f')][_0xd851('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x300aba['options']?_0x300aba[_0xd851('0x1f')][_0xd851('0x21')]||null:null,'attributes':_0x300aba['options']?_0x300aba[_0xd851('0x1f')][_0xd851('0x22')]||null:null,'limit':_0x300aba[_0xd851('0x1f')]?_0x300aba['options']['limit']||null:null})['then'](function(_0x35a9b0){logger[_0xd851('0x19')](_0xd851('0x1b'),_0x300aba);logger[_0xd851('0x13')](_0xd851('0x1b'),_0x300aba,JSON['stringify'](_0x35a9b0));_0x11c845(_0x35a9b0);})[_0xd851('0x23')](function(_0x54b2ea){logger[_0xd851('0x16')](_0xd851('0x1b'),_0x54b2ea[_0xd851('0x18')],_0x300aba);_0x8585e5(_0x31b313[_0xd851('0x16')](0x1f4,_0x54b2ea[_0xd851('0x18')]));});});};exports[_0xd851('0x24')]=function(_0x4d1fa6){return new Promise(function(_0x94977e,_0x441c27){return db[_0xd851('0x1c')][_0xd851('0x25')]({'where':_0x4d1fa6[_0xd851('0x1f')]?_0x4d1fa6[_0xd851('0x1f')][_0xd851('0x21')]||null:null})[_0xd851('0x10')](function(_0x295677){if(_0x295677){return _0x295677[_0xd851('0x26')](_0x4d1fa6[_0xd851('0x1e')][_0xd851('0x27')],_['omit'](_0x4d1fa6[_0xd851('0x1e')],[_0xd851('0x27'),'id'])||{});}})[_0xd851('0x28')](function(_0x325729){logger['info'](_0xd851('0x29'),_0x4d1fa6);logger['debug']('AddTags',_0x4d1fa6,JSON[_0xd851('0x15')](_0x325729));_0x94977e(_0x325729);})[_0xd851('0x23')](function(_0x48a5b8){logger['error'](_0xd851('0x29'),_0x48a5b8[_0xd851('0x18')],_0x4d1fa6);_0x441c27(_this[_0xd851('0x16')](0x1f4,_0x48a5b8[_0xd851('0x18')]));});});}; \ No newline at end of file +var _0x7633=['request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','./mailInteraction.socket','request','then','MailInteraction,\x20%s,\x20%s'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7633,0x1c4));var _0x3763=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7633[_0x4b369d];return _0x571a98;};'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});config[_0x3763('0xa')]=_[_0x3763('0xb')](config[_0x3763('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3763('0xa')]));require(_0x3763('0xc'))['register'](socket);function respondWithRpcPromise(_0x5c872d,_0x44dc63,_0x1a83bb){return new BPromise(function(_0x401909,_0x29ec1c){return client[_0x3763('0xd')](_0x5c872d,_0x1a83bb)[_0x3763('0xe')](function(_0x8fc2be){logger['info'](_0x3763('0xf'),_0x44dc63,_0x3763('0x10'));logger[_0x3763('0x11')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x44dc63,'request\x20sent',JSON[_0x3763('0x12')](_0x8fc2be));if(_0x8fc2be['error']){if(_0x8fc2be[_0x3763('0x13')][_0x3763('0x14')]===0x1f4){logger[_0x3763('0x13')](_0x3763('0xf'),_0x44dc63,_0x8fc2be[_0x3763('0x13')][_0x3763('0x15')]);return _0x29ec1c(_0x8fc2be[_0x3763('0x13')]['message']);}logger[_0x3763('0x13')](_0x3763('0xf'),_0x44dc63,_0x8fc2be[_0x3763('0x13')]['message']);return _0x401909(_0x8fc2be['error']['message']);}else{logger[_0x3763('0x16')](_0x3763('0xf'),_0x44dc63,_0x3763('0x10'));_0x401909(_0x8fc2be[_0x3763('0x17')][_0x3763('0x15')]);}})[_0x3763('0x18')](function(_0x461924){logger['error'](_0x3763('0xf'),_0x44dc63,_0x461924);_0x29ec1c(_0x461924);});});}exports[_0x3763('0x19')]=function(_0x9a8152){var _0x443422=this;return new Promise(function(_0x4aa7b0,_0x485836){return db[_0x3763('0x1a')][_0x3763('0x1b')](_0x9a8152[_0x3763('0x1c')],{'raw':_0x9a8152[_0x3763('0x1d')]?_0x9a8152['options'][_0x3763('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9a8152['options']?_0x9a8152[_0x3763('0x1d')][_0x3763('0x1f')]||null:null,'attributes':_0x9a8152['options']?_0x9a8152[_0x3763('0x1d')][_0x3763('0x20')]||null:null,'limit':_0x9a8152[_0x3763('0x1d')]?_0x9a8152[_0x3763('0x1d')][_0x3763('0x21')]||null:null})[_0x3763('0xe')](function(_0x6ebb90){logger['info']('UpdateMailInteraction',_0x9a8152);logger['debug'](_0x3763('0x19'),_0x9a8152,JSON[_0x3763('0x12')](_0x6ebb90));_0x4aa7b0(_0x6ebb90);})[_0x3763('0x18')](function(_0xe5beb5){logger[_0x3763('0x13')](_0x3763('0x19'),_0xe5beb5[_0x3763('0x15')],_0x9a8152);_0x485836(_0x443422[_0x3763('0x13')](0x1f4,_0xe5beb5[_0x3763('0x15')]));});});};exports[_0x3763('0x22')]=function(_0x339870){return new Promise(function(_0x136c67,_0x4f9a96){return db[_0x3763('0x1a')][_0x3763('0x23')]({'where':_0x339870[_0x3763('0x1d')]?_0x339870['options'][_0x3763('0x1f')]||null:null})[_0x3763('0xe')](function(_0x18ffb0){if(_0x18ffb0){return _0x18ffb0['addTags'](_0x339870[_0x3763('0x1c')][_0x3763('0x24')],_[_0x3763('0x25')](_0x339870[_0x3763('0x1c')],[_0x3763('0x24'),'id'])||{});}})['spread'](function(_0x482c63){logger[_0x3763('0x16')](_0x3763('0x26'),_0x339870);logger[_0x3763('0x11')](_0x3763('0x26'),_0x339870,JSON[_0x3763('0x12')](_0x482c63));_0x136c67(_0x482c63);})[_0x3763('0x18')](function(_0xf9d6af){logger[_0x3763('0x13')]('AddTags',_0xf9d6af[_0x3763('0x15')],_0x339870);_0x4f9a96(_this[_0x3763('0x13')](0x1f4,_0xf9d6af[_0x3763('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 71a0375..a03f0a4 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 _0x5ecc=['remove','update','removeListener','register','mailInteraction:'];(function(_0x3b2c6f,_0xa9f35c){var _0x22e219=function(_0x3ee04c){while(--_0x3ee04c){_0x3b2c6f['push'](_0x3b2c6f['shift']());}};_0x22e219(++_0xa9f35c);}(_0x5ecc,0x1b8));var _0xc5ec=function(_0x488025,_0xd8f53b){_0x488025=_0x488025-0x0;var _0x15a360=_0x5ecc[_0x488025];return _0x15a360;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xc5ec('0x0'),_0xc5ec('0x1')];function createListener(_0x410892,_0x5b95f8){return function(_0x4567a9){_0x5b95f8['emit'](_0x410892,_0x4567a9);};}function removeListener(_0x1f7a46,_0x4ceb4f){return function(){MailInteractionEvents[_0xc5ec('0x2')](_0x1f7a46,_0x4ceb4f);};}exports[_0xc5ec('0x3')]=function(_0x494adf){for(var _0x2c3eed=0x0,_0x2450f0=events['length'];_0x2c3eed<_0x2450f0;_0x2c3eed++){var _0x22f651=events[_0x2c3eed];var _0x414ded=createListener(_0xc5ec('0x4')+_0x22f651,_0x494adf);MailInteractionEvents['on'](_0x22f651,_0x414ded);}}; \ No newline at end of file +var _0x3ba0=['mailInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0xf670f0,_0x353747){var _0x3c21c6=function(_0xa0e0b2){while(--_0xa0e0b2){_0xf670f0['push'](_0xf670f0['shift']());}};_0x3c21c6(++_0x353747);}(_0x3ba0,0x91));var _0x03ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3ba0[_0x501510];return _0x1e6ee5;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x03ba('0x0'),_0x03ba('0x1'),_0x03ba('0x2')];function createListener(_0x2456c2,_0x14f22d){return function(_0x104a72){_0x14f22d[_0x03ba('0x3')](_0x2456c2,_0x104a72);};}function removeListener(_0x3d849f,_0x280714){return function(){MailInteractionEvents[_0x03ba('0x4')](_0x3d849f,_0x280714);};}exports[_0x03ba('0x5')]=function(_0x35f500){for(var _0x104975=0x0,_0x1a41a4=events[_0x03ba('0x6')];_0x104975<_0x1a41a4;_0x104975++){var _0xd18cae=events[_0x104975];var _0x5aff95=createListener(_0x03ba('0x7')+_0xd18cae,_0x35f500);MailInteractionEvents['on'](_0xd18cae,_0x5aff95);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index d98e7a6..1931eae 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 _0x425d=['show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x9c5536,_0xab6e92){var _0x276a58=function(_0x21fc78){while(--_0x21fc78){_0x9c5536['push'](_0x9c5536['shift']());}};_0x276a58(++_0xab6e92);}(_0x425d,0x1e0));var _0xd425=function(_0x3fd108,_0x5d911f){_0x3fd108=_0x3fd108-0x0;var _0x4f943f=_0x425d[_0x3fd108];return _0x4f943f;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./mailMessage.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0x9')](),interaction[_0xd425('0x11')](_0xd425('0x12'),_0xd425('0x13')),controller[_0xd425('0x14')]);router[_0xd425('0x15')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x16')]);router[_0xd425('0x15')](_0xd425('0x17'),auth['isAuthenticated'](),controller[_0xd425('0x18')]);router[_0xd425('0x15')](_0xd425('0x19'),auth['isAuthenticated'](),controller[_0xd425('0x1a')]);router[_0xd425('0x1b')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x31b97c,_0x2d2d8b){_0x31b97c=_0x31b97c-0x0;var _0x378b0f=_0x8ef6[_0x31b97c];return _0x378b0f;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0x9')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')]('/',auth[_0x68ef('0xa')](),interaction[_0x68ef('0x12')](_0x68ef('0x13'),_0x68ef('0x14')),controller['create']);router[_0x68ef('0x15')](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x15')](_0x68ef('0x17'),auth['isAuthenticated'](),controller[_0x68ef('0x18')]);router[_0x68ef('0x15')](_0x68ef('0x19'),auth['isAuthenticated'](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);module[_0x68ef('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index a186893..1654601 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 _0x110f=['ENUM','out','STRING','long','DATE','INTEGER','sequelize','lodash','TEXT','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x110f,0x1e6));var _0xf110=function(_0x245085,_0x50440a){_0x245085=_0x245085-0x0;var _0x4d72e8=_0x110f[_0x245085];return _0x4d72e8;};'use strict';var Sequelize=require(_0xf110('0x0'));var _=require(_0xf110('0x1'));module['exports']={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf110('0x2')]('medium')},'read':{'type':Sequelize[_0xf110('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf110('0x4')]('in',_0xf110('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf110('0x6')](0x1fe)},'from':{'type':Sequelize[_0xf110('0x6')]},'to':{'type':Sequelize[_0xf110('0x2')]('long')},'cc':{'type':Sequelize[_0xf110('0x2')](_0xf110('0x7'))},'bcc':{'type':Sequelize[_0xf110('0x2')]('long')},'subject':{'type':Sequelize[_0xf110('0x2')]},'sentAt':{'type':Sequelize[_0xf110('0x8')]},'attach':{'type':Sequelize[_0xf110('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf110('0x8')]},'originTo':{'type':Sequelize[_0xf110('0x2')](_0xf110('0x7'))},'originCc':{'type':Sequelize[_0xf110('0x2')]('long')}}; \ No newline at end of file +var _0x2d0b=['out','STRING','long','DATE','INTEGER','lodash','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x37394f,_0x2a0baf){var _0x4dcf2c=function(_0x4466f0){while(--_0x4466f0){_0x37394f['push'](_0x37394f['shift']());}};_0x4dcf2c(++_0x2a0baf);}(_0x2d0b,0x102));var _0xb2d0=function(_0x58e7eb,_0x26a78d){_0x58e7eb=_0x58e7eb-0x0;var _0x1bed29=_0x2d0b[_0x58e7eb];return _0x1bed29;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb2d0('0x0'));module[_0xb2d0('0x1')]={'body':{'type':Sequelize[_0xb2d0('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb2d0('0x2')](_0xb2d0('0x3'))},'read':{'type':Sequelize[_0xb2d0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb2d0('0x5')]('in','out'),'defaultValue':_0xb2d0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xb2d0('0x7')]},'to':{'type':Sequelize[_0xb2d0('0x2')](_0xb2d0('0x8'))},'cc':{'type':Sequelize[_0xb2d0('0x2')](_0xb2d0('0x8'))},'bcc':{'type':Sequelize[_0xb2d0('0x2')](_0xb2d0('0x8'))},'subject':{'type':Sequelize[_0xb2d0('0x2')]},'sentAt':{'type':Sequelize[_0xb2d0('0x9')]},'attach':{'type':Sequelize[_0xb2d0('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb2d0('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0xb2d0('0x2')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 89c0a97..f0dd40a 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 _0x8406=['where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','body','params','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','isNil','service','port','secure','authentication','user','pass','attachments','join','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','UserId','Contact','get','MailInteraction','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','agent','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','rejectmessage','unix','root','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x200ced,_0x503efa){var _0x28e175=function(_0x450010){while(--_0x450010){_0x200ced['push'](_0x200ced['shift']());}};_0x28e175(++_0x503efa);}(_0x8406,0x10c));var _0x6840=function(_0x2e3d7a,_0x20898e){_0x2e3d7a=_0x2e3d7a-0x0;var _0xf516dc=_0x8406[_0x2e3d7a];return _0xf516dc;};'use strict';var pdf=require(_0x6840('0x0'));var emlformat=require(_0x6840('0x1'));var rimraf=require(_0x6840('0x2'));var zipdir=require(_0x6840('0x3'));var jsonpatch=require(_0x6840('0x4'));var rp=require(_0x6840('0x5'));var moment=require(_0x6840('0x6'));var BPromise=require(_0x6840('0x7'));var Mustache=require('mustache');var util=require(_0x6840('0x8'));var path=require(_0x6840('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6840('0xa'));var fs=require('fs');var _=require(_0x6840('0xb'));var squel=require(_0x6840('0xc'));var crypto=require(_0x6840('0xd'));var jsforce=require(_0x6840('0xe'));var deskjs=require(_0x6840('0xf'));var toCsv=require(_0x6840('0x10'));var querystring=require('querystring');var Papa=require(_0x6840('0x11'));var Redis=require('ioredis');var authService=require(_0x6840('0x12'));var qs=require(_0x6840('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6840('0x14'));var logger=require(_0x6840('0x15'))(_0x6840('0x16'));var utils=require('../../config/utils');var config=require(_0x6840('0x17'));var db=require(_0x6840('0x18'))['db'];config['redis']=_[_0x6840('0x19')](config[_0x6840('0x1a')],{'host':_0x6840('0x1b'),'port':0x18eb});var socket=require(_0x6840('0x1c'))(new Redis(config[_0x6840('0x1a')]));require(_0x6840('0x1d'))[_0x6840('0x1e')](socket);var jayson=require(_0x6840('0x1f'));var client=jayson[_0x6840('0x20')][_0x6840('0x21')]({'port':0x232c});var client9003=jayson['client'][_0x6840('0x21')]({'port':0x232b});var client9002=jayson[_0x6840('0x20')][_0x6840('0x21')]({'port':0x232a});function checkPasswordPattern(_0x566394,_0x261295,_0x45e5cf){if(_0x45e5cf){var _0x16c89d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16c89d[_0x6840('0x22')](_0x261295)){return _0x566394;}else{throw new db[(_0x6840('0x23'))]['ValidationError'](_0x6840('0x24'));}}else{return _0x566394;}}function respondWithRpcPromise(_0x17f34d,_0x39d2e,_0x413411,_0x20cfcd){return new BPromise(function(_0x5938d9,_0x40b679){var _0x22f450=_0x20cfcd||client;return _0x22f450[_0x6840('0x25')](_0x17f34d,_0x413411)[_0x6840('0x26')](function(_0x2d38ca){logger[_0x6840('0x27')](_0x6840('0x28'),_0x39d2e,_0x6840('0x29'));logger[_0x6840('0x2a')](_0x6840('0x2b'),_0x39d2e,_0x6840('0x29'),JSON[_0x6840('0x2c')](_0x2d38ca));if(_0x2d38ca['error']){if(_0x2d38ca[_0x6840('0x2d')]['code']===0x1f4){logger['error'](_0x6840('0x28'),_0x39d2e,_0x2d38ca[_0x6840('0x2d')][_0x6840('0x2e')]);return _0x40b679(_0x2d38ca['error']['message']);}logger[_0x6840('0x2d')](_0x6840('0x28'),_0x39d2e,_0x2d38ca[_0x6840('0x2d')][_0x6840('0x2e')]);return _0x5938d9(_0x2d38ca['error']['message']);}else{logger[_0x6840('0x27')](_0x6840('0x28'),_0x39d2e,_0x6840('0x29'));_0x5938d9(_0x2d38ca[_0x6840('0x2f')][_0x6840('0x2e')]);}})['catch'](function(_0x4c5135){logger['error']('MailMessage,\x20%s,\x20%s',_0x39d2e,_0x4c5135);_0x40b679(_0x4c5135);});});}function respondWithStatusCode(_0x5da8b9,_0x4f309f){_0x4f309f=_0x4f309f||0xcc;return function(_0x264028){if(_0x264028){return _0x5da8b9[_0x6840('0x30')](_0x4f309f);}return _0x5da8b9[_0x6840('0x31')](_0x4f309f)['end']();};}function respondWithResult(_0xf6da35,_0x4ec828){_0x4ec828=_0x4ec828||0xc8;return function(_0x4ef76c){if(_0x4ef76c){return _0xf6da35['status'](_0x4ec828)['json'](_0x4ef76c);}};}function respondWithFilteredResult(_0x474c80,_0x486e45){return function(_0x551584){if(_0x551584){var _0x54e24e=_0x551584[_0x6840('0x32')],_0x11a742=_0x486e45['offset'],_0xd08b16=_0x486e45[_0x6840('0x33')]+_0x486e45[_0x6840('0x34')],_0x14b867;if(_0xd08b16>=_0x54e24e){_0xd08b16=_0x54e24e;_0x14b867=0xc8;}else{_0x14b867=0xce;}_0x474c80['status'](_0x14b867);return _0x474c80[_0x6840('0x35')](_0x6840('0x36'),_0x11a742+'-'+_0xd08b16+'/'+_0x54e24e)[_0x6840('0x37')](_0x551584);}return null;};}function patchUpdates(_0x1948c1){return function(_0x4b5bb6){try{jsonpatch[_0x6840('0x38')](_0x4b5bb6,_0x1948c1,!![]);}catch(_0x4fbd07){return BPromise[_0x6840('0x39')](_0x4fbd07);}return _0x4b5bb6['save']();};}function saveUpdates(_0x2fd9b7,_0x36186d){return function(_0x5c2038){if(_0x5c2038){return _0x5c2038[_0x6840('0x3a')](_0x2fd9b7)[_0x6840('0x26')](function(_0x44d472){return _0x44d472;});}return null;};}function removeEntity(_0x2d3388,_0x27fc7d){return function(_0x57907b){if(_0x57907b){return _0x57907b[_0x6840('0x3b')]()[_0x6840('0x26')](function(){_0x2d3388[_0x6840('0x31')](0xcc)[_0x6840('0x3c')]();});}};}function handleEntityNotFound(_0x27df55,_0x51e58f){return function(_0x322a96){if(!_0x322a96){_0x27df55[_0x6840('0x30')](0x194);}return _0x322a96;};}function handleError(_0x573d21,_0x312096){_0x312096=_0x312096||0x1f4;return function(_0x1e04d0){logger[_0x6840('0x2d')](_0x1e04d0[_0x6840('0x3d')]);if(_0x1e04d0[_0x6840('0x3e')]){delete _0x1e04d0[_0x6840('0x3e')];}_0x573d21[_0x6840('0x31')](_0x312096)[_0x6840('0x3f')](_0x1e04d0);};}exports[_0x6840('0x40')]=function(_0x5bc06d,_0x23a847){var _0x54cafb={},_0x434f1d={},_0x5adc77={'count':0x0,'rows':[]};var _0x2b3f1f=_[_0x6840('0x41')](db[_0x6840('0x42')][_0x6840('0x43')],function(_0x3d5e4c){return{'name':_0x3d5e4c[_0x6840('0x44')],'type':_0x3d5e4c[_0x6840('0x45')]['key']};});_0x434f1d['model']=_[_0x6840('0x41')](_0x2b3f1f,_0x6840('0x3e'));_0x434f1d[_0x6840('0x46')]=_[_0x6840('0x47')](_0x5bc06d[_0x6840('0x46')]);_0x434f1d[_0x6840('0x48')]=_[_0x6840('0x49')](_0x434f1d[_0x6840('0x4a')],_0x434f1d[_0x6840('0x46')]);_0x54cafb['attributes']=_['intersection'](_0x434f1d[_0x6840('0x4a')],qs['fields'](_0x5bc06d[_0x6840('0x46')][_0x6840('0x4b')]));_0x54cafb[_0x6840('0x4c')]=_0x54cafb[_0x6840('0x4c')][_0x6840('0x4d')]?_0x54cafb[_0x6840('0x4c')]:_0x434f1d[_0x6840('0x4a')];if(!_0x5bc06d[_0x6840('0x46')][_0x6840('0x4e')](_0x6840('0x4f'))){_0x54cafb[_0x6840('0x34')]=qs['limit'](_0x5bc06d[_0x6840('0x46')][_0x6840('0x34')]);_0x54cafb[_0x6840('0x33')]=qs[_0x6840('0x33')](_0x5bc06d['query'][_0x6840('0x33')]);}_0x54cafb[_0x6840('0x50')]=qs[_0x6840('0x51')](_0x5bc06d['query'][_0x6840('0x51')]);_0x54cafb[_0x6840('0x52')]=qs[_0x6840('0x48')](_[_0x6840('0x53')](_0x5bc06d['query'],_0x434f1d[_0x6840('0x48')]),_0x2b3f1f);if(_0x5bc06d['query'][_0x6840('0x54')]){_0x54cafb['where']=_[_0x6840('0x55')](_0x54cafb[_0x6840('0x52')],{'$or':_[_0x6840('0x41')](_0x2b3f1f,function(_0x3b9bc2){if(_0x3b9bc2[_0x6840('0x45')]!==_0x6840('0x56')){var _0x283375={};_0x283375[_0x3b9bc2[_0x6840('0x3e')]]={'$like':'%'+_0x5bc06d[_0x6840('0x46')][_0x6840('0x54')]+'%'};return _0x283375;}})});}_0x54cafb=_[_0x6840('0x55')]({},_0x54cafb,_0x5bc06d[_0x6840('0x57')]);var _0x1bafc2={'where':_0x54cafb[_0x6840('0x52')]};return db['MailMessage']['count'](_0x1bafc2)['then'](function(_0x383f39){_0x5adc77['count']=_0x383f39;if(_0x5bc06d['query']['includeAll']){_0x54cafb[_0x6840('0x58')]=[{'all':!![]}];}return db[_0x6840('0x42')]['findAll'](_0x54cafb);})[_0x6840('0x26')](function(_0x1138b1){_0x5adc77[_0x6840('0x59')]=_0x1138b1;return _0x5adc77;})['then'](respondWithFilteredResult(_0x23a847,_0x54cafb))[_0x6840('0x5a')](handleError(_0x23a847,null));};exports[_0x6840('0x5b')]=function(_0x3a4834,_0x27605b){var _0x3ce167={'raw':!![],'where':{'id':_0x3a4834['params']['id']}},_0x4e1a00={};_0x4e1a00[_0x6840('0x4a')]=_[_0x6840('0x47')](db[_0x6840('0x42')][_0x6840('0x43')]);_0x4e1a00[_0x6840('0x46')]=_[_0x6840('0x47')](_0x3a4834[_0x6840('0x46')]);_0x4e1a00[_0x6840('0x48')]=_[_0x6840('0x49')](_0x4e1a00['model'],_0x4e1a00[_0x6840('0x46')]);_0x3ce167[_0x6840('0x4c')]=_['intersection'](_0x4e1a00[_0x6840('0x4a')],qs[_0x6840('0x4b')](_0x3a4834[_0x6840('0x46')]['fields']));_0x3ce167[_0x6840('0x4c')]=_0x3ce167['attributes'][_0x6840('0x4d')]?_0x3ce167[_0x6840('0x4c')]:_0x4e1a00['model'];if(_0x3a4834['query'][_0x6840('0x5c')]){_0x3ce167[_0x6840('0x58')]=[{'all':!![]}];}_0x3ce167=_[_0x6840('0x55')]({},_0x3ce167,_0x3a4834[_0x6840('0x57')]);return db[_0x6840('0x42')][_0x6840('0x5d')](_0x3ce167)[_0x6840('0x26')](handleEntityNotFound(_0x27605b,null))[_0x6840('0x26')](respondWithResult(_0x27605b,null))['catch'](handleError(_0x27605b,null));};exports[_0x6840('0x3a')]=function(_0x50ce30,_0x57ea45){if(_0x50ce30['body']['id']){delete _0x50ce30[_0x6840('0x5e')]['id'];}return db['MailMessage'][_0x6840('0x5d')]({'where':{'id':_0x50ce30[_0x6840('0x5f')]['id']}})['then'](handleEntityNotFound(_0x57ea45,null))[_0x6840('0x26')](saveUpdates(_0x50ce30[_0x6840('0x5e')],null))[_0x6840('0x26')](respondWithResult(_0x57ea45,null))[_0x6840('0x5a')](handleError(_0x57ea45,null));};exports[_0x6840('0x3b')]=function(_0x31a45f,_0x59073e){return db[_0x6840('0x42')][_0x6840('0x5d')]({'where':{'id':_0x31a45f[_0x6840('0x5f')]['id']}})[_0x6840('0x26')](handleEntityNotFound(_0x59073e,null))[_0x6840('0x26')](removeEntity(_0x59073e,null))[_0x6840('0x5a')](handleError(_0x59073e,null));};exports[_0x6840('0x60')]=function(_0x5d79dd,_0x1bfc9f){return db['MailMessage']['describe']()['then'](respondWithResult(_0x1bfc9f,null))[_0x6840('0x5a')](handleError(_0x1bfc9f,null));};exports[_0x6840('0x61')]=function(_0x255826,_0x409fab){return db[_0x6840('0x42')][_0x6840('0x61')](_0x255826['body'])['then'](function(_0x370878){if(_0x370878){if(_0x370878['direction']===_0x6840('0x62')&&!_0x370878[_0x6840('0x63')]){var _0x45e63d,_0x2bc5e3,_0x37a23a;if(_0x255826[_0x6840('0x5e')]['to']){_0x2bc5e3=_0x255826[_0x6840('0x5e')]['to'][_0x6840('0x64')](',')[0x0];}return db[_0x6840('0x65')][_0x6840('0x66')]({'where':{'id':_0x370878[_0x6840('0x67')]},'include':[{'model':db[_0x6840('0x68')],'as':_0x6840('0x69'),'include':[{'model':db[_0x6840('0x6a')],'as':'Contacts','where':{'email':_0x2bc5e3},'limit':0x1,'order':[['updatedAt',_0x6840('0x6b')]]}]},{'model':db[_0x6840('0x6c')],'as':_0x6840('0x6d'),'raw':!![]}]})[_0x6840('0x26')](function(_0x38fee1){_0x45e63d=_0x38fee1;if(_0x45e63d&&_0x45e63d[_0x6840('0x6d')]){var _0x55fbeb={'tls':{'rejectUnauthorized':![]}};if(_[_0x6840('0x6e')](_0x45e63d[_0x6840('0x6d')][_0x6840('0x6f')])){_0x55fbeb['host']=_0x45e63d[_0x6840('0x6d')]['host'];_0x55fbeb[_0x6840('0x70')]=_0x45e63d['Smtp'][_0x6840('0x70')];_0x55fbeb[_0x6840('0x71')]=_0x45e63d[_0x6840('0x6d')][_0x6840('0x71')];if(_0x45e63d['Smtp'][_0x6840('0x72')]){_0x55fbeb['auth']={'user':_0x45e63d['Smtp'][_0x6840('0x73')],'pass':_0x45e63d[_0x6840('0x6d')][_0x6840('0x74')]};}}else{_0x55fbeb[_0x6840('0x6f')]=_0x45e63d[_0x6840('0x6d')]['service'];_0x55fbeb['auth']={'user':_0x45e63d[_0x6840('0x6d')][_0x6840('0x73')],'pass':_0x45e63d[_0x6840('0x6d')][_0x6840('0x74')]};_0x55fbeb[_0x6840('0x71')]=_0x45e63d[_0x6840('0x6d')][_0x6840('0x71')];}if(_0x255826[_0x6840('0x5e')][_0x6840('0x75')]&&_0x255826['body'][_0x6840('0x75')][_0x6840('0x4d')]){for(var _0x2ad29e=0x0;_0x2ad29e<_0x255826[_0x6840('0x5e')][_0x6840('0x75')]['length'];_0x2ad29e+=0x1){_0x255826['body'][_0x6840('0x75')][_0x2ad29e]={'filename':_0x255826['body']['attachments'][_0x2ad29e][_0x6840('0x3e')],'path':path[_0x6840('0x76')](config['root'],_0x6840('0x77'),_0x255826['body']['attachments'][_0x2ad29e][_0x6840('0x78')])};}}_0x37a23a={'account':_0x55fbeb,'message':_0x255826['body']};return;}})[_0x6840('0x26')](function(){if(_0x45e63d['List']){if(_0x45e63d[_0x6840('0x69')][_0x6840('0x79')][_0x6840('0x4d')]){return _0x45e63d[_0x6840('0x69')]['Contacts'][0x0];}else{return db[_0x6840('0x6a')][_0x6840('0x61')](_[_0x6840('0x19')](_0x255826[_0x6840('0x5e')],{'firstName':_0x255826[_0x6840('0x5e')]['to'],'email':_0x255826[_0x6840('0x5e')]['to'],'phone':_0x255826['body']['to'],'ListId':_0x45e63d[_0x6840('0x7a')]}));}}else{throw new Error(_0x6840('0x7b'));}})[_0x6840('0x26')](function(){if(_0x37a23a){return respondWithRpcPromise(_0x6840('0x7c'),_0x6840('0x7d'),_0x37a23a,client9003)[_0x6840('0x26')](function(_0x2b9f59){return _0x370878[_0x6840('0x3a')]({'read':!![],'messageId':_0x2b9f59[_0x6840('0x7e')],'sentAt':moment()[_0x6840('0x7f')](_0x6840('0x80'))});})[_0x6840('0x5a')](function(_0x3a4859){logger['error']('%s',JSON[_0x6840('0x2c')](_0x3a4859));return _0x370878;});}return _0x370878;});}return _0x370878;}})[_0x6840('0x26')](respondWithResult(_0x409fab,0xc9))[_0x6840('0x5a')](handleError(_0x409fab,null));};var interaction_log=require(_0x6840('0x15'))(_0x6840('0x81'));exports[_0x6840('0x82')]=function(_0x54e9e2,_0x494d26,_0x606dce){var _0x2f8389={'channel':_0x6840('0x83')};if(_0x54e9e2[_0x6840('0x5e')]['id']){delete _0x54e9e2[_0x6840('0x5e')]['id'];}_0x54e9e2[_0x6840('0x5e')][_0x6840('0x84')]=!![];_0x54e9e2[_0x6840('0x5e')]['readAt']=moment()[_0x6840('0x7f')](_0x6840('0x80'));_0x54e9e2[_0x6840('0x5e')][_0x6840('0x85')]=_0x54e9e2[_0x6840('0x5e')][_0x6840('0x85')]||_0x54e9e2[_0x6840('0x73')]['id'];return db[_0x6840('0x42')][_0x6840('0x5d')]({'where':{'id':_0x54e9e2[_0x6840('0x5f')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6840('0x86')}]})[_0x6840('0x26')](handleEntityNotFound(_0x494d26,null))[_0x6840('0x26')](saveUpdates(_0x54e9e2[_0x6840('0x5e')],null))[_0x6840('0x26')](function(_0xe99586){if(_0xe99586){_0x2f8389[_0x6840('0x2e')]=_0xe99586[_0x6840('0x87')]({'plain':!![]});return db[_0x6840('0x88')][_0x6840('0x5d')]({'where':{'id':_0xe99586['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x494d26,null))[_0x6840('0x26')](function(_0x2d6ed7){if(_0x2d6ed7){return _0x2d6ed7[_0x6840('0x3a')]({'UserId':_0x54e9e2[_0x6840('0x5e')][_0x6840('0x85')],'read1stAt':_[_0x6840('0x6e')](_0x2d6ed7[_0x6840('0x89')])?moment()['format'](_0x6840('0x80')):undefined});}return null;})[_0x6840('0x26')](function(_0x34216f){if(_0x34216f){_0x2f8389[_0x6840('0x8a')]=_0x34216f[_0x6840('0x87')]({'plain':!![]});interaction_log[_0x6840('0x27')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54e9e2[_0x6840('0x73')]['id'],_0x54e9e2[_0x6840('0x73')]['name'],_0x54e9e2[_0x6840('0x73')][_0x6840('0x8b')],_0x2f8389[_0x6840('0x8a')]['id'],_0x54e9e2[_0x6840('0x5e')]?JSON[_0x6840('0x2c')](_0x54e9e2[_0x6840('0x5e')]):_0x6840('0x8c'));return respondWithRpcPromise(_0x6840('0x8d'),_0x6840('0x8e'),_0x2f8389);}return null;})[_0x6840('0x26')](function(_0x37fa75){if(_0x37fa75){if(_0x54e9e2[_0x6840('0x5e')][_0x6840('0x8f')]){_0x2f8389[_0x6840('0x2e')][_0x6840('0x90')]=util[_0x6840('0x7f')]('SIP/%s',_0x54e9e2['user'][_0x6840('0x3e')]);_0x2f8389[_0x6840('0x2e')]['channel']=_0x2f8389[_0x6840('0x91')];_0x2f8389[_0x6840('0x2e')][_0x6840('0x92')]=_0x6840('0x82');return respondWithRpcPromise(_0x6840('0x93'),'EventManager',{'event':_0x6840('0x94'),'message':_0x2f8389[_0x6840('0x2e')]},client9002)['then'](function(){return _0x2f8389;});}return _0x2f8389;}return null;})[_0x6840('0x26')](respondWithResult(_0x494d26,null))[_0x6840('0x5a')](handleError(_0x494d26,null));};var interaction_log=require(_0x6840('0x15'))(_0x6840('0x81'));exports[_0x6840('0x39')]=function(_0x30b27b,_0x5767e4,_0x427089){var _0x5428a3={'agent':{},'channel':_0x6840('0x83')};if(_0x30b27b[_0x6840('0x5e')]['id']){delete _0x30b27b[_0x6840('0x5e')]['id'];}_0x30b27b[_0x6840('0x5e')][_0x6840('0x85')]=_0x30b27b['body'][_0x6840('0x85')]||_0x30b27b['user']['id'];_0x5428a3[_0x6840('0x95')]['id']=_0x30b27b[_0x6840('0x5e')]['UserId'];return db[_0x6840('0x42')][_0x6840('0x5d')]({'where':{'id':_0x30b27b[_0x6840('0x5f')]['id'],'UserId':null}})[_0x6840('0x26')](handleEntityNotFound(_0x5767e4,null))[_0x6840('0x26')](function(_0x1c7bfd){if(_0x1c7bfd){_0x5428a3[_0x6840('0x2e')]=_0x1c7bfd['get']({'plain':!![]});return db[_0x6840('0x88')][_0x6840('0x5d')]({'where':{'id':_0x1c7bfd[_0x6840('0x96')]}});}return null;})[_0x6840('0x26')](handleEntityNotFound(_0x5767e4,null))[_0x6840('0x26')](function(_0x90cfeb){if(_0x90cfeb){_0x5428a3[_0x6840('0x8a')]=_0x90cfeb[_0x6840('0x87')]({'plain':!![]});interaction_log[_0x6840('0x27')](_0x6840('0x97'),_0x30b27b[_0x6840('0x73')]['id'],_0x30b27b[_0x6840('0x73')][_0x6840('0x3e')],_0x30b27b[_0x6840('0x73')][_0x6840('0x8b')],_0x5428a3[_0x6840('0x8a')]['id'],_0x30b27b[_0x6840('0x5e')]?JSON[_0x6840('0x2c')](_0x30b27b[_0x6840('0x5e')]):_0x6840('0x8c'));return respondWithRpcPromise(_0x6840('0x98'),'rejectMessage',_0x5428a3);}return null;})[_0x6840('0x26')](function(_0x4bac23){if(_0x4bac23){_0x4bac23[_0x6840('0x2e')]['interface']=util[_0x6840('0x7f')](_0x6840('0x99'),_0x30b27b[_0x6840('0x73')][_0x6840('0x3e')]);_0x4bac23[_0x6840('0x2e')][_0x6840('0x91')]=_0x5428a3[_0x6840('0x91')];_0x4bac23[_0x6840('0x2e')][_0x6840('0x92')]=_0x6840('0x39');respondWithRpcPromise('EventManager',_0x6840('0x93'),{'event':_0x6840('0x9a'),'message':_0x4bac23[_0x6840('0x2e')]},client9002);return _0x5428a3;}return null;})['then'](respondWithResult(_0x5767e4,null))['catch'](handleError(_0x5767e4,null));};exports['download']=function(_0x5db5ea,_0x296937){var _0x5cc795=moment()[_0x6840('0x9b')]()['toString']();var _0x25916a=path[_0x6840('0x76')](config[_0x6840('0x9c')],_0x6840('0x9d'),_0x6840('0x9e'),'tmp');var _0x326fec=path['join'](config['root'],_0x6840('0x9d'),_0x6840('0x9e'),_0x6840('0x75'));var _0x17a23d=util[_0x6840('0x7f')]('message-%s.eml',_0x5cc795);return db[_0x6840('0x42')][_0x6840('0x5d')]({'where':{'id':_0x5db5ea['params']['id']},'attributes':['id','body',_0x6840('0x9f'),'to','cc',_0x6840('0xa0'),_0x6840('0xa1'),_0x6840('0xa2')],'include':_0x5db5ea[_0x6840('0x46')][_0x6840('0x75')]?[{'model':db[_0x6840('0xa3')],'as':_0x6840('0xa4')}]:undefined})[_0x6840('0x26')](handleEntityNotFound(_0x296937,null))['then'](function(_0x27f4ed){if(_0x27f4ed){var _0x445179=_0x27f4ed;var _0x2c6411={'from':_0x445179[_0x6840('0x9f')],'to':_0x445179['to'],'subject':_0x445179[_0x6840('0xa1')],'html':_0x445179[_0x6840('0x5e')],'headers':{'Date':moment(_0x445179[_0x6840('0xa2')])['format'](_0x6840('0xa5'))},'attachments':[]};if(_0x27f4ed['cc']){_0x2c6411[_0x6840('0xa6')]['Cc']=_0x27f4ed['cc'];}if(_0x27f4ed[_0x6840('0xa0')]){_0x2c6411[_0x6840('0xa6')][_0x6840('0xa7')]=_0x27f4ed[_0x6840('0xa0')];}return new BPromise(function(_0x54bf61,_0x216ce2){if(_0x27f4ed[_0x6840('0xa4')]){for(var _0x4f49ca=0x0;_0x4f49ca<_0x27f4ed[_0x6840('0xa4')]['length'];_0x4f49ca++){var _0x1d58f7=_0x27f4ed[_0x6840('0xa4')][_0x4f49ca];var _0x250168=path[_0x6840('0x76')](_0x326fec,_0x1d58f7[_0x6840('0x78')]);if(fs['existsSync'](_0x250168)){_0x2c6411[_0x6840('0x75')][_0x6840('0xa8')]({'name':_0x1d58f7[_0x6840('0x3e')],'contentType':_0x1d58f7[_0x6840('0x45')],'data':fs[_0x6840('0xa9')](_0x250168)});}}}emlformat[_0x6840('0xaa')](_0x2c6411,function(_0x1d1c8f,_0x134016){if(_0x1d1c8f)return _0x216ce2(_0x1d1c8f);fs['writeFileSync'](path['join'](_0x25916a,_0x17a23d),_0x134016);return _0x54bf61(_0x134016);});});}})[_0x6840('0x26')](function(_0x440e35){if(_0x440e35){return _0x296937[_0x6840('0xab')](path[_0x6840('0x76')](_0x25916a,_0x17a23d),_0x17a23d,function(_0x13d20a){if(_0x13d20a){console[_0x6840('0xac')](_0x6840('0xad'),_0x13d20a);}else{fs[_0x6840('0xae')](path[_0x6840('0x76')](_0x25916a,_0x17a23d));}});}})[_0x6840('0x5a')](handleError(_0x296937,null));}; \ No newline at end of file +var _0x7163=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','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','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','limit','sort','pick','filter','where','VIRTUAL','include','findAll','rows','show','keys','fields','includeAll','merge','options','find','body','params','describe','create','direction','secret','split','MailAccount','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','authentication','auth','user','pass','secure','attachments','length','server/files/attachments','basename','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','info','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','toString','join','root','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','headers','Bcc','existsSync','push','writeFileSync','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x55fc3f,_0x4beb3a){var _0x38b6d3=function(_0x2fc8e4){while(--_0x2fc8e4){_0x55fc3f['push'](_0x55fc3f['shift']());}};_0x38b6d3(++_0x4beb3a);}(_0x7163,0x1ef));var _0x3716=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x7163[_0x40822a];return _0x357420;};'use strict';var pdf=require(_0x3716('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3716('0x1'));var jsonpatch=require(_0x3716('0x2'));var rp=require(_0x3716('0x3'));var moment=require('moment');var BPromise=require(_0x3716('0x4'));var Mustache=require(_0x3716('0x5'));var util=require(_0x3716('0x6'));var path=require(_0x3716('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3716('0x8'));var fs=require('fs');var _=require(_0x3716('0x9'));var squel=require(_0x3716('0xa'));var crypto=require(_0x3716('0xb'));var jsforce=require(_0x3716('0xc'));var deskjs=require(_0x3716('0xd'));var toCsv=require(_0x3716('0xe'));var querystring=require(_0x3716('0xf'));var Papa=require(_0x3716('0x10'));var Redis=require(_0x3716('0x11'));var authService=require(_0x3716('0x12'));var qs=require(_0x3716('0x13'));var as=require(_0x3716('0x14'));var hardwareService=require(_0x3716('0x15'));var logger=require(_0x3716('0x16'))(_0x3716('0x17'));var utils=require(_0x3716('0x18'));var config=require(_0x3716('0x19'));var db=require(_0x3716('0x1a'))['db'];config[_0x3716('0x1b')]=_[_0x3716('0x1c')](config[_0x3716('0x1b')],{'host':_0x3716('0x1d'),'port':0x18eb});var socket=require(_0x3716('0x1e'))(new Redis(config[_0x3716('0x1b')]));require(_0x3716('0x1f'))[_0x3716('0x20')](socket);var jayson=require(_0x3716('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x3716('0x22')]['http']({'port':0x232a});function checkPasswordPattern(_0x166835,_0x3608b6,_0x44680c){if(_0x44680c){var _0x562133=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x562133['test'](_0x3608b6)){return _0x166835;}else{throw new db['Sequelize']['ValidationError'](_0x3716('0x23'));}}else{return _0x166835;}}function respondWithRpcPromise(_0x41cbef,_0x5d16c4,_0x248464,_0x331b57){return new BPromise(function(_0x1fb022,_0xf6c764){var _0x22d1b7=_0x331b57||client;return _0x22d1b7[_0x3716('0x24')](_0x41cbef,_0x248464)[_0x3716('0x25')](function(_0x564d5c){logger['info']('MailMessage,\x20%s,\x20%s',_0x5d16c4,_0x3716('0x26'));logger['debug'](_0x3716('0x27'),_0x5d16c4,_0x3716('0x26'),JSON[_0x3716('0x28')](_0x564d5c));if(_0x564d5c[_0x3716('0x29')]){if(_0x564d5c[_0x3716('0x29')][_0x3716('0x2a')]===0x1f4){logger[_0x3716('0x29')](_0x3716('0x2b'),_0x5d16c4,_0x564d5c[_0x3716('0x29')]['message']);return _0xf6c764(_0x564d5c[_0x3716('0x29')][_0x3716('0x2c')]);}logger[_0x3716('0x29')]('MailMessage,\x20%s,\x20%s',_0x5d16c4,_0x564d5c[_0x3716('0x29')][_0x3716('0x2c')]);return _0x1fb022(_0x564d5c['error'][_0x3716('0x2c')]);}else{logger['info'](_0x3716('0x2b'),_0x5d16c4,_0x3716('0x26'));_0x1fb022(_0x564d5c[_0x3716('0x2d')]['message']);}})[_0x3716('0x2e')](function(_0x5a4476){logger[_0x3716('0x29')](_0x3716('0x2b'),_0x5d16c4,_0x5a4476);_0xf6c764(_0x5a4476);});});}function respondWithStatusCode(_0x4f0f2b,_0x3aec25){_0x3aec25=_0x3aec25||0xcc;return function(_0x3dcf6b){if(_0x3dcf6b){return _0x4f0f2b[_0x3716('0x2f')](_0x3aec25);}return _0x4f0f2b[_0x3716('0x30')](_0x3aec25)[_0x3716('0x31')]();};}function respondWithResult(_0x4f76dc,_0x2fdfa1){_0x2fdfa1=_0x2fdfa1||0xc8;return function(_0x116e40){if(_0x116e40){return _0x4f76dc[_0x3716('0x30')](_0x2fdfa1)[_0x3716('0x32')](_0x116e40);}};}function respondWithFilteredResult(_0x4fee70,_0x3e844f){return function(_0x27553a){if(_0x27553a){var _0x440e7f=_0x27553a[_0x3716('0x33')],_0x3f82c7=_0x3e844f[_0x3716('0x34')],_0x413f6b=_0x3e844f[_0x3716('0x34')]+_0x3e844f['limit'],_0x55956a;if(_0x413f6b>=_0x440e7f){_0x413f6b=_0x440e7f;_0x55956a=0xc8;}else{_0x55956a=0xce;}_0x4fee70['status'](_0x55956a);return _0x4fee70[_0x3716('0x35')](_0x3716('0x36'),_0x3f82c7+'-'+_0x413f6b+'/'+_0x440e7f)[_0x3716('0x32')](_0x27553a);}return null;};}function patchUpdates(_0x357acf){return function(_0x5835d4){try{jsonpatch[_0x3716('0x37')](_0x5835d4,_0x357acf,!![]);}catch(_0x149470){return BPromise[_0x3716('0x38')](_0x149470);}return _0x5835d4[_0x3716('0x39')]();};}function saveUpdates(_0x217bd0,_0x275f04){return function(_0x55fc69){if(_0x55fc69){return _0x55fc69[_0x3716('0x3a')](_0x217bd0)[_0x3716('0x25')](function(_0x2faba3){return _0x2faba3;});}return null;};}function removeEntity(_0x52deab,_0x596f54){return function(_0x3f4702){if(_0x3f4702){return _0x3f4702['destroy']()[_0x3716('0x25')](function(){_0x52deab[_0x3716('0x30')](0xcc)[_0x3716('0x31')]();});}};}function handleEntityNotFound(_0xe32c6f,_0x2e8416){return function(_0x427cbc){if(!_0x427cbc){_0xe32c6f[_0x3716('0x2f')](0x194);}return _0x427cbc;};}function handleError(_0x2fa793,_0x5a33e4){_0x5a33e4=_0x5a33e4||0x1f4;return function(_0x9d03dc){logger[_0x3716('0x29')](_0x9d03dc[_0x3716('0x3b')]);if(_0x9d03dc['name']){delete _0x9d03dc[_0x3716('0x3c')];}_0x2fa793['status'](_0x5a33e4)[_0x3716('0x3d')](_0x9d03dc);};}exports[_0x3716('0x3e')]=function(_0x4781d7,_0x1f14bb){var _0x268f04={},_0x207d5e={},_0x31d495={'count':0x0,'rows':[]};var _0x1b6b6b=_[_0x3716('0x3f')](db[_0x3716('0x40')][_0x3716('0x41')],function(_0x512eea){return{'name':_0x512eea[_0x3716('0x42')],'type':_0x512eea[_0x3716('0x43')][_0x3716('0x44')]};});_0x207d5e[_0x3716('0x45')]=_['map'](_0x1b6b6b,_0x3716('0x3c'));_0x207d5e[_0x3716('0x46')]=_['keys'](_0x4781d7[_0x3716('0x46')]);_0x207d5e[_0x3716('0x47')]=_['intersection'](_0x207d5e[_0x3716('0x45')],_0x207d5e[_0x3716('0x46')]);_0x268f04['attributes']=_[_0x3716('0x48')](_0x207d5e[_0x3716('0x45')],qs['fields'](_0x4781d7[_0x3716('0x46')]['fields']));_0x268f04[_0x3716('0x49')]=_0x268f04[_0x3716('0x49')]['length']?_0x268f04['attributes']:_0x207d5e[_0x3716('0x45')];if(!_0x4781d7[_0x3716('0x46')][_0x3716('0x4a')]('nolimit')){_0x268f04[_0x3716('0x4b')]=qs[_0x3716('0x4b')](_0x4781d7['query'][_0x3716('0x4b')]);_0x268f04['offset']=qs[_0x3716('0x34')](_0x4781d7[_0x3716('0x46')][_0x3716('0x34')]);}_0x268f04['order']=qs['sort'](_0x4781d7[_0x3716('0x46')][_0x3716('0x4c')]);_0x268f04['where']=qs[_0x3716('0x47')](_[_0x3716('0x4d')](_0x4781d7[_0x3716('0x46')],_0x207d5e[_0x3716('0x47')]),_0x1b6b6b);if(_0x4781d7[_0x3716('0x46')][_0x3716('0x4e')]){_0x268f04[_0x3716('0x4f')]=_['merge'](_0x268f04[_0x3716('0x4f')],{'$or':_[_0x3716('0x3f')](_0x1b6b6b,function(_0x30f012){if(_0x30f012[_0x3716('0x43')]!==_0x3716('0x50')){var _0x3015c3={};_0x3015c3[_0x30f012[_0x3716('0x3c')]]={'$like':'%'+_0x4781d7['query']['filter']+'%'};return _0x3015c3;}})});}_0x268f04=_['merge']({},_0x268f04,_0x4781d7['options']);var _0x1ef5da={'where':_0x268f04[_0x3716('0x4f')]};return db[_0x3716('0x40')][_0x3716('0x33')](_0x1ef5da)['then'](function(_0x2aad2a){_0x31d495['count']=_0x2aad2a;if(_0x4781d7[_0x3716('0x46')]['includeAll']){_0x268f04[_0x3716('0x51')]=[{'all':!![]}];}return db['MailMessage'][_0x3716('0x52')](_0x268f04);})[_0x3716('0x25')](function(_0x417ed6){_0x31d495[_0x3716('0x53')]=_0x417ed6;return _0x31d495;})[_0x3716('0x25')](respondWithFilteredResult(_0x1f14bb,_0x268f04))[_0x3716('0x2e')](handleError(_0x1f14bb,null));};exports[_0x3716('0x54')]=function(_0x1ae37c,_0x289a79){var _0xca5eca={'raw':!![],'where':{'id':_0x1ae37c['params']['id']}},_0x3f05de={};_0x3f05de['model']=_[_0x3716('0x55')](db[_0x3716('0x40')]['rawAttributes']);_0x3f05de[_0x3716('0x46')]=_[_0x3716('0x55')](_0x1ae37c[_0x3716('0x46')]);_0x3f05de[_0x3716('0x47')]=_[_0x3716('0x48')](_0x3f05de['model'],_0x3f05de[_0x3716('0x46')]);_0xca5eca[_0x3716('0x49')]=_['intersection'](_0x3f05de[_0x3716('0x45')],qs[_0x3716('0x56')](_0x1ae37c['query'][_0x3716('0x56')]));_0xca5eca[_0x3716('0x49')]=_0xca5eca['attributes']['length']?_0xca5eca[_0x3716('0x49')]:_0x3f05de[_0x3716('0x45')];if(_0x1ae37c[_0x3716('0x46')][_0x3716('0x57')]){_0xca5eca[_0x3716('0x51')]=[{'all':!![]}];}_0xca5eca=_[_0x3716('0x58')]({},_0xca5eca,_0x1ae37c[_0x3716('0x59')]);return db[_0x3716('0x40')][_0x3716('0x5a')](_0xca5eca)['then'](handleEntityNotFound(_0x289a79,null))[_0x3716('0x25')](respondWithResult(_0x289a79,null))[_0x3716('0x2e')](handleError(_0x289a79,null));};exports[_0x3716('0x3a')]=function(_0x50ceee,_0x1e78aa){if(_0x50ceee[_0x3716('0x5b')]['id']){delete _0x50ceee[_0x3716('0x5b')]['id'];}return db[_0x3716('0x40')][_0x3716('0x5a')]({'where':{'id':_0x50ceee[_0x3716('0x5c')]['id']}})[_0x3716('0x25')](handleEntityNotFound(_0x1e78aa,null))[_0x3716('0x25')](saveUpdates(_0x50ceee['body'],null))[_0x3716('0x25')](respondWithResult(_0x1e78aa,null))[_0x3716('0x2e')](handleError(_0x1e78aa,null));};exports['destroy']=function(_0x1a3da5,_0xb16674){return db[_0x3716('0x40')][_0x3716('0x5a')]({'where':{'id':_0x1a3da5[_0x3716('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb16674,null))['then'](removeEntity(_0xb16674,null))[_0x3716('0x2e')](handleError(_0xb16674,null));};exports[_0x3716('0x5d')]=function(_0x4d59bb,_0x1cc549){return db[_0x3716('0x40')][_0x3716('0x5d')]()['then'](respondWithResult(_0x1cc549,null))[_0x3716('0x2e')](handleError(_0x1cc549,null));};exports[_0x3716('0x5e')]=function(_0x5307b9,_0xd25996){return db[_0x3716('0x40')]['create'](_0x5307b9[_0x3716('0x5b')])['then'](function(_0x254d76){if(_0x254d76){if(_0x254d76[_0x3716('0x5f')]==='out'&&!_0x254d76[_0x3716('0x60')]){var _0x503856,_0x241997,_0x72b08d;if(_0x5307b9['body']['to']){_0x241997=_0x5307b9[_0x3716('0x5b')]['to'][_0x3716('0x61')](',')[0x0];}return db[_0x3716('0x62')]['findOne']({'where':{'id':_0x254d76[_0x3716('0x63')]},'include':[{'model':db['CmList'],'as':_0x3716('0x64'),'include':[{'model':db[_0x3716('0x65')],'as':_0x3716('0x66'),'where':{'email':_0x241997},'limit':0x1,'order':[['updatedAt',_0x3716('0x67')]]}]},{'model':db[_0x3716('0x68')],'as':'Smtp','raw':!![]}]})[_0x3716('0x25')](function(_0xf790ad){_0x503856=_0xf790ad;if(_0x503856&&_0x503856[_0x3716('0x69')]){var _0x2ceb1c={'tls':{'rejectUnauthorized':![]}};if(_[_0x3716('0x6a')](_0x503856[_0x3716('0x69')][_0x3716('0x6b')])){_0x2ceb1c[_0x3716('0x6c')]=_0x503856['Smtp'][_0x3716('0x6c')];_0x2ceb1c['port']=_0x503856[_0x3716('0x69')][_0x3716('0x6d')];_0x2ceb1c['secure']=_0x503856[_0x3716('0x69')]['secure'];if(_0x503856[_0x3716('0x69')][_0x3716('0x6e')]){_0x2ceb1c[_0x3716('0x6f')]={'user':_0x503856[_0x3716('0x69')][_0x3716('0x70')],'pass':_0x503856[_0x3716('0x69')]['pass']};}}else{_0x2ceb1c[_0x3716('0x6b')]=_0x503856['Smtp'][_0x3716('0x6b')];_0x2ceb1c['auth']={'user':_0x503856[_0x3716('0x69')][_0x3716('0x70')],'pass':_0x503856['Smtp'][_0x3716('0x71')]};_0x2ceb1c[_0x3716('0x72')]=_0x503856[_0x3716('0x69')][_0x3716('0x72')];}if(_0x5307b9['body'][_0x3716('0x73')]&&_0x5307b9[_0x3716('0x5b')][_0x3716('0x73')][_0x3716('0x74')]){for(var _0x46bd5=0x0;_0x46bd5<_0x5307b9[_0x3716('0x5b')][_0x3716('0x73')]['length'];_0x46bd5+=0x1){_0x5307b9['body'][_0x3716('0x73')][_0x46bd5]={'filename':_0x5307b9['body'][_0x3716('0x73')][_0x46bd5][_0x3716('0x3c')],'path':path['join'](config['root'],_0x3716('0x75'),_0x5307b9['body'][_0x3716('0x73')][_0x46bd5][_0x3716('0x76')])};}}_0x72b08d={'account':_0x2ceb1c,'message':_0x5307b9[_0x3716('0x5b')]};return;}})[_0x3716('0x25')](function(){if(_0x503856[_0x3716('0x64')]){if(_0x503856[_0x3716('0x64')]['Contacts']['length']){return _0x503856[_0x3716('0x64')][_0x3716('0x66')][0x0];}else{return db[_0x3716('0x65')][_0x3716('0x5e')](_[_0x3716('0x1c')](_0x5307b9[_0x3716('0x5b')],{'firstName':_0x5307b9[_0x3716('0x5b')]['to'],'email':_0x5307b9['body']['to'],'phone':_0x5307b9[_0x3716('0x5b')]['to'],'ListId':_0x503856['ListId']}));}}else{throw new Error(_0x3716('0x77'));}})[_0x3716('0x25')](function(){if(_0x72b08d){return respondWithRpcPromise('SendMail',_0x3716('0x78'),_0x72b08d,client9003)[_0x3716('0x25')](function(_0x1b047f){return _0x254d76[_0x3716('0x3a')]({'read':!![],'messageId':_0x1b047f[_0x3716('0x79')],'sentAt':moment()[_0x3716('0x7a')](_0x3716('0x7b'))});})[_0x3716('0x2e')](function(_0x5b61fc){logger['error']('%s',JSON['stringify'](_0x5b61fc));return _0x254d76;});}return _0x254d76;});}return _0x254d76;}})['then'](respondWithResult(_0xd25996,0xc9))[_0x3716('0x2e')](handleError(_0xd25996,null));};var interaction_log=require(_0x3716('0x16'))(_0x3716('0x7c'));exports[_0x3716('0x7d')]=function(_0x2af672,_0x5dcce1,_0x10dc07){var _0xc2a695={'channel':_0x3716('0x7e')};if(_0x2af672[_0x3716('0x5b')]['id']){delete _0x2af672[_0x3716('0x5b')]['id'];}_0x2af672['body'][_0x3716('0x7f')]=!![];_0x2af672[_0x3716('0x5b')][_0x3716('0x80')]=moment()[_0x3716('0x7a')](_0x3716('0x7b'));_0x2af672[_0x3716('0x5b')][_0x3716('0x81')]=_0x2af672[_0x3716('0x5b')][_0x3716('0x81')]||_0x2af672['user']['id'];return db[_0x3716('0x40')]['find']({'where':{'id':_0x2af672[_0x3716('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x3716('0x65')],'as':_0x3716('0x82')}]})[_0x3716('0x25')](handleEntityNotFound(_0x5dcce1,null))[_0x3716('0x25')](saveUpdates(_0x2af672[_0x3716('0x5b')],null))[_0x3716('0x25')](function(_0x4ceebc){if(_0x4ceebc){_0xc2a695[_0x3716('0x2c')]=_0x4ceebc[_0x3716('0x83')]({'plain':!![]});return db[_0x3716('0x84')][_0x3716('0x5a')]({'where':{'id':_0x4ceebc[_0x3716('0x85')]}});}return null;})[_0x3716('0x25')](handleEntityNotFound(_0x5dcce1,null))[_0x3716('0x25')](function(_0x17d7a9){if(_0x17d7a9){return _0x17d7a9[_0x3716('0x3a')]({'UserId':_0x2af672[_0x3716('0x5b')]['UserId'],'read1stAt':_[_0x3716('0x6a')](_0x17d7a9[_0x3716('0x86')])?moment()[_0x3716('0x7a')](_0x3716('0x7b')):undefined});}return null;})[_0x3716('0x25')](function(_0x1cc4e4){if(_0x1cc4e4){_0xc2a695[_0x3716('0x87')]=_0x1cc4e4[_0x3716('0x83')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2af672[_0x3716('0x70')]['id'],_0x2af672[_0x3716('0x70')][_0x3716('0x3c')],_0x2af672[_0x3716('0x70')][_0x3716('0x88')],_0xc2a695[_0x3716('0x87')]['id'],_0x2af672['body']?JSON[_0x3716('0x28')](_0x2af672[_0x3716('0x5b')]):_0x3716('0x89'));return respondWithRpcPromise(_0x3716('0x8a'),'acceptMessage',_0xc2a695);}return null;})[_0x3716('0x25')](function(_0x227d24){if(_0x227d24){if(_0x2af672[_0x3716('0x5b')][_0x3716('0x8b')]){_0xc2a695[_0x3716('0x2c')][_0x3716('0x8c')]=util[_0x3716('0x7a')](_0x3716('0x8d'),_0x2af672[_0x3716('0x70')][_0x3716('0x3c')]);_0xc2a695[_0x3716('0x2c')]['channel']=_0xc2a695[_0x3716('0x8e')];_0xc2a695['message'][_0x3716('0x8f')]=_0x3716('0x7d');return respondWithRpcPromise(_0x3716('0x90'),'EventManager',{'event':'acceptmessage','message':_0xc2a695[_0x3716('0x2c')]},client9002)[_0x3716('0x25')](function(){return _0xc2a695;});}return _0xc2a695;}return null;})[_0x3716('0x25')](respondWithResult(_0x5dcce1,null))[_0x3716('0x2e')](handleError(_0x5dcce1,null));};var interaction_log=require(_0x3716('0x16'))(_0x3716('0x7c'));exports[_0x3716('0x38')]=function(_0x252966,_0x6a77a8,_0x16511f){var _0x4931f8={'agent':{},'channel':_0x3716('0x7e')};if(_0x252966[_0x3716('0x5b')]['id']){delete _0x252966['body']['id'];}_0x252966[_0x3716('0x5b')]['UserId']=_0x252966[_0x3716('0x5b')]['UserId']||_0x252966[_0x3716('0x70')]['id'];_0x4931f8[_0x3716('0x91')]['id']=_0x252966[_0x3716('0x5b')][_0x3716('0x81')];return db[_0x3716('0x40')]['find']({'where':{'id':_0x252966[_0x3716('0x5c')]['id'],'UserId':null}})[_0x3716('0x25')](handleEntityNotFound(_0x6a77a8,null))['then'](function(_0x265377){if(_0x265377){_0x4931f8[_0x3716('0x2c')]=_0x265377[_0x3716('0x83')]({'plain':!![]});return db[_0x3716('0x84')][_0x3716('0x5a')]({'where':{'id':_0x265377[_0x3716('0x85')]}});}return null;})[_0x3716('0x25')](handleEntityNotFound(_0x6a77a8,null))[_0x3716('0x25')](function(_0x14b660){if(_0x14b660){_0x4931f8[_0x3716('0x87')]=_0x14b660[_0x3716('0x83')]({'plain':!![]});interaction_log[_0x3716('0x92')](_0x3716('0x93'),_0x252966[_0x3716('0x70')]['id'],_0x252966['user']['name'],_0x252966[_0x3716('0x70')][_0x3716('0x88')],_0x4931f8['interaction']['id'],_0x252966[_0x3716('0x5b')]?JSON[_0x3716('0x28')](_0x252966['body']):_0x3716('0x89'));return respondWithRpcPromise(_0x3716('0x94'),_0x3716('0x95'),_0x4931f8);}return null;})[_0x3716('0x25')](function(_0x4f7b77){if(_0x4f7b77){_0x4f7b77[_0x3716('0x2c')][_0x3716('0x8c')]=util[_0x3716('0x7a')](_0x3716('0x8d'),_0x252966[_0x3716('0x70')][_0x3716('0x3c')]);_0x4f7b77['message'][_0x3716('0x8e')]=_0x4931f8[_0x3716('0x8e')];_0x4f7b77[_0x3716('0x2c')]['event']=_0x3716('0x38');respondWithRpcPromise(_0x3716('0x90'),'EventManager',{'event':_0x3716('0x96'),'message':_0x4f7b77['message']},client9002);return _0x4931f8;}return null;})[_0x3716('0x25')](respondWithResult(_0x6a77a8,null))[_0x3716('0x2e')](handleError(_0x6a77a8,null));};exports[_0x3716('0x97')]=function(_0x1c8494,_0xfda4a8){var _0x1149a7=moment()['unix']()[_0x3716('0x98')]();var _0x5e0707=path[_0x3716('0x99')](config[_0x3716('0x9a')],_0x3716('0x9b'),_0x3716('0x9c'),_0x3716('0x9d'));var _0x5d09a5=path['join'](config[_0x3716('0x9a')],_0x3716('0x9b'),'files','attachments');var _0x444448=util[_0x3716('0x7a')]('message-%s.eml',_0x1149a7);return db[_0x3716('0x40')][_0x3716('0x5a')]({'where':{'id':_0x1c8494[_0x3716('0x5c')]['id']},'attributes':['id',_0x3716('0x5b'),_0x3716('0x9e'),'to','cc',_0x3716('0x9f'),_0x3716('0xa0'),_0x3716('0xa1')],'include':_0x1c8494[_0x3716('0x46')][_0x3716('0x73')]?[{'model':db[_0x3716('0xa2')],'as':_0x3716('0xa3')}]:undefined})['then'](handleEntityNotFound(_0xfda4a8,null))[_0x3716('0x25')](function(_0x23f8e1){if(_0x23f8e1){var _0x4a826b=_0x23f8e1;var _0x22c511={'from':_0x4a826b['from'],'to':_0x4a826b['to'],'subject':_0x4a826b[_0x3716('0xa0')],'html':_0x4a826b[_0x3716('0x5b')],'headers':{'Date':moment(_0x4a826b[_0x3716('0xa1')])[_0x3716('0x7a')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x23f8e1['cc']){_0x22c511[_0x3716('0xa4')]['Cc']=_0x23f8e1['cc'];}if(_0x23f8e1['bcc']){_0x22c511[_0x3716('0xa4')][_0x3716('0xa5')]=_0x23f8e1['bcc'];}return new BPromise(function(_0x47ffe7,_0xb76d1e){if(_0x23f8e1[_0x3716('0xa3')]){for(var _0x265151=0x0;_0x265151<_0x23f8e1[_0x3716('0xa3')][_0x3716('0x74')];_0x265151++){var _0x154e3c=_0x23f8e1[_0x3716('0xa3')][_0x265151];var _0x293b0e=path[_0x3716('0x99')](_0x5d09a5,_0x154e3c[_0x3716('0x76')]);if(fs[_0x3716('0xa6')](_0x293b0e)){_0x22c511[_0x3716('0x73')][_0x3716('0xa7')]({'name':_0x154e3c['name'],'contentType':_0x154e3c[_0x3716('0x43')],'data':fs['readFileSync'](_0x293b0e)});}}}emlformat['build'](_0x22c511,function(_0x5e4251,_0x5960e7){if(_0x5e4251)return _0xb76d1e(_0x5e4251);fs[_0x3716('0xa8')](path[_0x3716('0x99')](_0x5e0707,_0x444448),_0x5960e7);return _0x47ffe7(_0x5960e7);});});}})[_0x3716('0x25')](function(_0x32d734){if(_0x32d734){return _0xfda4a8[_0x3716('0x97')](path[_0x3716('0x99')](_0x5e0707,_0x444448),_0x444448,function(_0x1f8d53){if(_0x1f8d53){console[_0x3716('0xa9')](_0x3716('0xaa'),_0x1f8d53);}else{fs[_0x3716('0xab')](path['join'](_0x5e0707,_0x444448));}});}})['catch'](handleError(_0xfda4a8,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 1f7c5b3..7769a8a 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 _0x66f8=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x3ae0b6,_0x17df21){var _0x3d5670=function(_0x4b2cd0){while(--_0x4b2cd0){_0x3ae0b6['push'](_0x3ae0b6['shift']());}};_0x3d5670(++_0x17df21);}(_0x66f8,0xb5));var _0x866f=function(_0x54b963,_0x3c7e2d){_0x54b963=_0x54b963-0x0;var _0x3fcd19=_0x66f8[_0x54b963];return _0x3fcd19;};'use strict';var EventEmitter=require(_0x866f('0x0'));var MailMessage=require(_0x866f('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x866f('0x2')](0x0);var events={'afterCreate':_0x866f('0x3'),'afterUpdate':_0x866f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41fd38){return function(_0x2d6b37,_0x245b2d,_0x1aa853){MailMessageEvents[_0x866f('0x5')](_0x41fd38+':'+_0x2d6b37['id'],_0x2d6b37);MailMessageEvents['emit'](_0x41fd38,_0x2d6b37);_0x1aa853(null);};}for(var e in events){if(events[_0x866f('0x6')](e)){var event=events[e];MailMessage[_0x866f('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x1ed7=['remove','hasOwnProperty','MailMessage','setMaxListeners','save'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x1ed7,0xb1));var _0x71ed=function(_0x144334,_0x28f756){_0x144334=_0x144334-0x0;var _0x407ac1=_0x1ed7[_0x144334];return _0x407ac1;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x71ed('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x71ed('0x1')](0x0);var events={'afterCreate':_0x71ed('0x2'),'afterUpdate':'update','afterDestroy':_0x71ed('0x3')};function emitEvent(_0x139793){return function(_0x5a8ff8,_0x58d8e2,_0x413650){MailMessageEvents['emit'](_0x139793+':'+_0x5a8ff8['id'],_0x5a8ff8);MailMessageEvents['emit'](_0x139793,_0x5a8ff8);_0x413650(null);};}for(var e in events){if(events[_0x71ed('0x4')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index bbe3190..2327534 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 _0xa0fd=['MailInteraction','findOne','then','createdAt','catch','error','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','body','direction','toLowerCase','out','secret'];(function(_0x1252e5,_0xa9a929){var _0x27adc8=function(_0x32a153){while(--_0x32a153){_0x1252e5['push'](_0x1252e5['shift']());}};_0x27adc8(++_0xa9a929);}(_0xa0fd,0x18e));var _0xda0f=function(_0x2d9892,_0x42bdd7){_0x2d9892=_0x2d9892-0x0;var _0x4ed609=_0xa0fd[_0x2d9892];return _0x4ed609;};'use strict';var _=require(_0xda0f('0x0'));var util=require(_0xda0f('0x1'));var logger=require(_0xda0f('0x2'))('api');var moment=require(_0xda0f('0x3'));var BPromise=require(_0xda0f('0x4'));var rp=require(_0xda0f('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xda0f('0x6'));var rimraf=require(_0xda0f('0x7'));var config=require(_0xda0f('0x8'));var attributes=require(_0xda0f('0x9'));module[_0xda0f('0xa')]=function(_0x4e2e35,_0xa8741c){return _0x4e2e35[_0xda0f('0xb')](_0xda0f('0xc'),attributes,{'tableName':_0xda0f('0xd'),'paranoid':![],'indexes':[{'name':_0xda0f('0xe'),'fields':[_0xda0f('0xe')]},{'name':'fti_mail_messages','fields':[_0xda0f('0xf'),'subject'],'type':_0xda0f('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xca1460,_0x22af0e,_0x555691){if(_0xca1460[_0xda0f('0x11')]){_0xca1460[_0xda0f('0xf')]=htmlToText['fromString'](_0xca1460[_0xda0f('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x555691(null,_0x22af0e);},'afterCreate':function(_0x76f94,_0x5ecc32,_0x261eff){var _0x1dedcc=_0x4e2e35['models'];var _0xaba215=_0x76f94['get']({'plain':!![]});if(_0xaba215[_0xda0f('0x12')][_0xda0f('0x13')]()==='in'||_0xaba215[_0xda0f('0x12')]['toLowerCase']()===_0xda0f('0x14')&&!_0xaba215[_0xda0f('0x15')]&&!_['isNil'](_0xaba215['UserId'])){_0x1dedcc[_0xda0f('0x16')][_0xda0f('0x17')]({'where':{'id':_0xaba215['MailInteractionId']}})[_0xda0f('0x18')](function(_0x19def1){if(_0x19def1){_0x19def1['update']({'lastMsgAt':_0xaba215[_0xda0f('0x19')],'lastMsgDirection':_0xaba215[_0xda0f('0x12')][_0xda0f('0x13')](),'lastMsgBody':_0xaba215[_0xda0f('0x11')]});}})[_0xda0f('0x1a')](function(_0x3bf96b){console[_0xda0f('0x1b')](_0x3bf96b);});}_0x261eff();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb73a=['MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x49c957,_0x9fe6ef){var _0x3870f7=function(_0x391c6d){while(--_0x391c6d){_0x49c957['push'](_0x49c957['shift']());}};_0x3870f7(++_0x9fe6ef);}(_0xb73a,0x8d));var _0xab73=function(_0x71a175,_0x35e09c){_0x71a175=_0x71a175-0x0;var _0x974718=_0xb73a[_0x71a175];return _0x974718;};'use strict';var _=require('lodash');var util=require(_0xab73('0x0'));var logger=require(_0xab73('0x1'))(_0xab73('0x2'));var moment=require(_0xab73('0x3'));var BPromise=require(_0xab73('0x4'));var rp=require(_0xab73('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xab73('0x6'));var rimraf=require(_0xab73('0x7'));var config=require(_0xab73('0x8'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x38a327,_0x56dff8){return _0x38a327[_0xab73('0x9')]('MailMessage',attributes,{'tableName':_0xab73('0xa'),'paranoid':![],'indexes':[{'name':_0xab73('0xb'),'fields':[_0xab73('0xb')]},{'name':_0xab73('0xc'),'fields':[_0xab73('0xd'),_0xab73('0xe')],'type':_0xab73('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5df3e6,_0x1cdcd6,_0x525451){if(_0x5df3e6['body']){_0x5df3e6['plainBody']=htmlToText['fromString'](_0x5df3e6[_0xab73('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x525451(null,_0x1cdcd6);},'afterCreate':function(_0x3f9dae,_0x30230d,_0xbb11d1){var _0x4bc705=_0x38a327[_0xab73('0x11')];var _0x35c57d=_0x3f9dae['get']({'plain':!![]});if(_0x35c57d[_0xab73('0x12')][_0xab73('0x13')]()==='in'||_0x35c57d[_0xab73('0x12')][_0xab73('0x13')]()===_0xab73('0x14')&&!_0x35c57d[_0xab73('0x15')]&&!_[_0xab73('0x16')](_0x35c57d[_0xab73('0x17')])){_0x4bc705[_0xab73('0x18')][_0xab73('0x19')]({'where':{'id':_0x35c57d['MailInteractionId']}})[_0xab73('0x1a')](function(_0x4d9a7c){if(_0x4d9a7c){_0x4d9a7c[_0xab73('0x1b')]({'lastMsgAt':_0x35c57d[_0xab73('0x1c')],'lastMsgDirection':_0x35c57d[_0xab73('0x12')]['toLowerCase'](),'lastMsgBody':_0x35c57d['body']});}})[_0xab73('0x1d')](function(_0x2fd624){console[_0xab73('0x1e')](_0x2fd624);});}_0xbb11d1();}},'charset':_0xab73('0x1f'),'collate':_0xab73('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 6515ab3..7f7c933 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 _0xb7ae=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateMailMessage','MailMessage','body','options','then','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x558004,_0x2a74a9){_0x558004=_0x558004-0x0;var _0x1e8fcd=_0xb7ae[_0x558004];return _0x1e8fcd;};'use strict';var _=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var moment=require(_0xeb7a('0x2'));var BPromise=require(_0xeb7a('0x3'));var rs=require(_0xeb7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb7a('0x5'))['db'];var utils=require(_0xeb7a('0x6'));var logger=require(_0xeb7a('0x7'))('rpc');var config=require(_0xeb7a('0x8'));var jayson=require(_0xeb7a('0x9'));var client=jayson[_0xeb7a('0xa')][_0xeb7a('0xb')]({'port':0x232a});config[_0xeb7a('0xc')]=_['defaults'](config[_0xeb7a('0xc')],{'host':_0xeb7a('0xd'),'port':0x18eb});var socket=require(_0xeb7a('0xe'))(new Redis(config['redis']));require(_0xeb7a('0xf'))[_0xeb7a('0x10')](socket);function respondWithRpcPromise(_0xb440a6,_0x15581b,_0x1a997e){return new BPromise(function(_0x275d58,_0x1e56db){return client['request'](_0xb440a6,_0x1a997e)['then'](function(_0x31222f){logger[_0xeb7a('0x11')](_0xeb7a('0x12'),_0x15581b,_0xeb7a('0x13'));logger[_0xeb7a('0x14')](_0xeb7a('0x15'),_0x15581b,_0xeb7a('0x13'),JSON['stringify'](_0x31222f));if(_0x31222f[_0xeb7a('0x16')]){if(_0x31222f[_0xeb7a('0x16')]['code']===0x1f4){logger[_0xeb7a('0x16')](_0xeb7a('0x12'),_0x15581b,_0x31222f['error'][_0xeb7a('0x17')]);return _0x1e56db(_0x31222f['error']['message']);}logger[_0xeb7a('0x16')]('MailMessage,\x20%s,\x20%s',_0x15581b,_0x31222f['error'][_0xeb7a('0x17')]);return _0x275d58(_0x31222f[_0xeb7a('0x16')][_0xeb7a('0x17')]);}else{logger[_0xeb7a('0x11')]('MailMessage,\x20%s,\x20%s',_0x15581b,'request\x20sent');_0x275d58(_0x31222f[_0xeb7a('0x18')][_0xeb7a('0x17')]);}})['catch'](function(_0x538311){logger[_0xeb7a('0x16')](_0xeb7a('0x12'),_0x15581b,_0x538311);_0x1e56db(_0x538311);});});}exports[_0xeb7a('0x19')]=function(_0x268a17){var _0x302e41=this;return new Promise(function(_0x3025fc,_0x29fa3f){return db[_0xeb7a('0x1a')]['create'](_0x268a17[_0xeb7a('0x1b')],{'raw':_0x268a17[_0xeb7a('0x1c')]?_0x268a17['options']['raw']===undefined?!![]:![]:!![]})[_0xeb7a('0x1d')](function(_0x434aac){logger[_0xeb7a('0x11')](_0xeb7a('0x19'),_0x268a17);logger[_0xeb7a('0x14')](_0xeb7a('0x19'),_0x268a17,JSON[_0xeb7a('0x1e')](_0x434aac));_0x3025fc(_0x434aac);})['catch'](function(_0x1f0135){logger[_0xeb7a('0x16')](_0xeb7a('0x19'),_0x1f0135['message'],_0x268a17);_0x29fa3f(_0x302e41[_0xeb7a('0x16')](0x1f4,_0x1f0135[_0xeb7a('0x17')]));});});}; \ No newline at end of file +var _0x75a2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateMailMessage','options','raw','stringify','lodash'];(function(_0x396e8c,_0x40b46f){var _0x1415c2=function(_0x4e93ee){while(--_0x4e93ee){_0x396e8c['push'](_0x396e8c['shift']());}};_0x1415c2(++_0x40b46f);}(_0x75a2,0x187));var _0x275a=function(_0x18e602,_0x368f9a){_0x18e602=_0x18e602-0x0;var _0x866210=_0x75a2[_0x18e602];return _0x866210;};'use strict';var _=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var moment=require(_0x275a('0x2'));var BPromise=require('bluebird');var rs=require(_0x275a('0x3'));var fs=require('fs');var Redis=require(_0x275a('0x4'));var db=require(_0x275a('0x5'))['db'];var utils=require(_0x275a('0x6'));var logger=require('../../config/logger')(_0x275a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x275a('0x8')]=_[_0x275a('0x9')](config[_0x275a('0x8')],{'host':_0x275a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x275a('0xb'))[_0x275a('0xc')](socket);function respondWithRpcPromise(_0x56e1c2,_0x4bb07c,_0x4aaece){return new BPromise(function(_0x2d77df,_0x3961da){return client[_0x275a('0xd')](_0x56e1c2,_0x4aaece)[_0x275a('0xe')](function(_0x59b769){logger[_0x275a('0xf')](_0x275a('0x10'),_0x4bb07c,_0x275a('0x11'));logger[_0x275a('0x12')](_0x275a('0x13'),_0x4bb07c,_0x275a('0x11'),JSON['stringify'](_0x59b769));if(_0x59b769[_0x275a('0x14')]){if(_0x59b769[_0x275a('0x14')]['code']===0x1f4){logger['error'](_0x275a('0x10'),_0x4bb07c,_0x59b769[_0x275a('0x14')][_0x275a('0x15')]);return _0x3961da(_0x59b769[_0x275a('0x14')][_0x275a('0x15')]);}logger[_0x275a('0x14')](_0x275a('0x10'),_0x4bb07c,_0x59b769[_0x275a('0x14')][_0x275a('0x15')]);return _0x2d77df(_0x59b769['error']['message']);}else{logger[_0x275a('0xf')](_0x275a('0x10'),_0x4bb07c,'request\x20sent');_0x2d77df(_0x59b769[_0x275a('0x16')]['message']);}})[_0x275a('0x17')](function(_0x236619){logger['error'](_0x275a('0x10'),_0x4bb07c,_0x236619);_0x3961da(_0x236619);});});}exports[_0x275a('0x18')]=function(_0x4a0ddb){var _0x4fb1ad=this;return new Promise(function(_0x260e41,_0x456c61){return db['MailMessage']['create'](_0x4a0ddb['body'],{'raw':_0x4a0ddb[_0x275a('0x19')]?_0x4a0ddb[_0x275a('0x19')][_0x275a('0x1a')]===undefined?!![]:![]:!![]})[_0x275a('0xe')](function(_0xbb91e7){logger['info'](_0x275a('0x18'),_0x4a0ddb);logger[_0x275a('0x12')](_0x275a('0x18'),_0x4a0ddb,JSON[_0x275a('0x1b')](_0xbb91e7));_0x260e41(_0xbb91e7);})[_0x275a('0x17')](function(_0x579aca){logger[_0x275a('0x14')](_0x275a('0x18'),_0x579aca[_0x275a('0x15')],_0x4a0ddb);_0x456c61(_0x4fb1ad[_0x275a('0x14')](0x1f4,_0x579aca[_0x275a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3bd2451..7b67a96 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 _0x0ec2=['length','mailMessage:','./mailMessage.events','remove','update','emit','removeListener','register'];(function(_0x512220,_0x196f2b){var _0x2faee4=function(_0x2c2b34){while(--_0x2c2b34){_0x512220['push'](_0x512220['shift']());}};_0x2faee4(++_0x196f2b);}(_0x0ec2,0x72));var _0x20ec=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x0ec2[_0x13ea00];return _0x1f7347;};'use strict';var MailMessageEvents=require(_0x20ec('0x0'));var events=['save',_0x20ec('0x1'),_0x20ec('0x2')];function createListener(_0xb63093,_0x113e28){return function(_0x3b41b7){_0x113e28[_0x20ec('0x3')](_0xb63093,_0x3b41b7);};}function removeListener(_0x37fc6f,_0x1a5900){return function(){MailMessageEvents[_0x20ec('0x4')](_0x37fc6f,_0x1a5900);};}exports[_0x20ec('0x5')]=function(_0x2b2c94){for(var _0x347f85=0x0,_0x206398=events[_0x20ec('0x6')];_0x347f85<_0x206398;_0x347f85++){var _0x12f5b2=events[_0x347f85];var _0x505472=createListener(_0x20ec('0x7')+_0x12f5b2,_0x2b2c94);MailMessageEvents['on'](_0x12f5b2,_0x505472);}}; \ No newline at end of file +var _0xbc8d=['emit','register','length','mailMessage:','./mailMessage.events','remove','update'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0xdbc8('0x0'));var events=['save',_0xdbc8('0x1'),_0xdbc8('0x2')];function createListener(_0x47835e,_0xd1b1fd){return function(_0x547cf2){_0xd1b1fd[_0xdbc8('0x3')](_0x47835e,_0x547cf2);};}function removeListener(_0x172112,_0x2dd539){return function(){MailMessageEvents['removeListener'](_0x172112,_0x2dd539);};}exports[_0xdbc8('0x4')]=function(_0x10ede0){for(var _0x3ee39d=0x0,_0x47f72b=events[_0xdbc8('0x5')];_0x3ee39d<_0x47f72b;_0x3ee39d++){var _0x4e67e5=events[_0x3ee39d];var _0x26da2c=createListener(_0xdbc8('0x6')+_0x4e67e5,_0x10ede0);MailMessageEvents['on'](_0x4e67e5,_0x26da2c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 89e4277..fd50eea 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 _0x9f2b=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x5596af,_0x5b1499){var _0x50bb9f=function(_0x3c0c04){while(--_0x3c0c04){_0x5596af['push'](_0x5596af['shift']());}};_0x50bb9f(++_0x5b1499);}(_0x9f2b,0x1ba));var _0xb9f2=function(_0x32f1e9,_0x3638e7){_0x32f1e9=_0x32f1e9-0x0;var _0x3ac892=_0x9f2b[_0x32f1e9];return _0x3ac892;};'use strict';var multer=require('multer');var util=require(_0xb9f2('0x0'));var path=require(_0xb9f2('0x1'));var timeout=require(_0xb9f2('0x2'));var express=require('express');var router=express[_0xb9f2('0x3')]();var auth=require(_0xb9f2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb9f2('0x5'));var controller=require('./mailQueue.controller');router[_0xb9f2('0x6')]('/',auth[_0xb9f2('0x7')](),controller['index']);router['get'](_0xb9f2('0x8'),auth[_0xb9f2('0x7')](),controller[_0xb9f2('0x9')]);router['get'](_0xb9f2('0xa'),auth[_0xb9f2('0x7')](),controller[_0xb9f2('0xb')]);router['get']('/:id/members',auth[_0xb9f2('0x7')](),controller['getMembers']);router[_0xb9f2('0x6')](_0xb9f2('0xc'),auth[_0xb9f2('0x7')](),controller[_0xb9f2('0xd')]);router[_0xb9f2('0x6')](_0xb9f2('0xe'),auth[_0xb9f2('0x7')](),controller[_0xb9f2('0xf')]);router[_0xb9f2('0x10')]('/',auth[_0xb9f2('0x7')](),controller[_0xb9f2('0x11')]);router[_0xb9f2('0x10')]('/:id/teams',auth[_0xb9f2('0x7')](),controller[_0xb9f2('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xb9f2('0x13')]);router['put']('/:id',auth[_0xb9f2('0x7')](),controller[_0xb9f2('0x14')]);router[_0xb9f2('0x15')](_0xb9f2('0xa'),auth['isAuthenticated'](),controller[_0xb9f2('0x16')]);router[_0xb9f2('0x15')](_0xb9f2('0xc'),auth[_0xb9f2('0x7')](),controller[_0xb9f2('0x17')]);router[_0xb9f2('0x15')](_0xb9f2('0xe'),auth[_0xb9f2('0x7')](),controller[_0xb9f2('0x18')]);module[_0xb9f2('0x19')]=router; \ No newline at end of file +var _0x0a53=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','/:id','removeAgents'];(function(_0x186d30,_0x477feb){var _0x3fc43c=function(_0x23c5ca){while(--_0x23c5ca){_0x186d30['push'](_0x186d30['shift']());}};_0x3fc43c(++_0x477feb);}(_0x0a53,0xd9));var _0x30a5=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0x0a53[_0x3a4f18];return _0x4c20fc;};'use strict';var multer=require(_0x30a5('0x0'));var util=require(_0x30a5('0x1'));var path=require(_0x30a5('0x2'));var timeout=require(_0x30a5('0x3'));var express=require(_0x30a5('0x4'));var router=express['Router']();var auth=require(_0x30a5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x30a5('0x6'));var controller=require(_0x30a5('0x7'));router[_0x30a5('0x8')]('/',auth[_0x30a5('0x9')](),controller[_0x30a5('0xa')]);router['get'](_0x30a5('0xb'),auth[_0x30a5('0x9')](),controller['describe']);router[_0x30a5('0x8')]('/:id',auth[_0x30a5('0x9')](),controller['show']);router[_0x30a5('0x8')](_0x30a5('0xc'),auth['isAuthenticated'](),controller[_0x30a5('0xd')]);router[_0x30a5('0x8')](_0x30a5('0xe'),auth[_0x30a5('0x9')](),controller[_0x30a5('0xf')]);router[_0x30a5('0x8')](_0x30a5('0x10'),auth[_0x30a5('0x9')](),controller[_0x30a5('0x11')]);router[_0x30a5('0x12')]('/',auth['isAuthenticated'](),controller[_0x30a5('0x13')]);router['post']('/:id/teams',auth[_0x30a5('0x9')](),controller['addTeams']);router[_0x30a5('0x12')](_0x30a5('0x10'),auth[_0x30a5('0x9')](),controller[_0x30a5('0x14')]);router[_0x30a5('0x15')]('/:id',auth[_0x30a5('0x9')](),controller[_0x30a5('0x16')]);router[_0x30a5('0x17')](_0x30a5('0x18'),auth[_0x30a5('0x9')](),controller['destroy']);router[_0x30a5('0x17')](_0x30a5('0xe'),auth[_0x30a5('0x9')](),controller['removeTeams']);router[_0x30a5('0x17')](_0x30a5('0x10'),auth['isAuthenticated'](),controller[_0x30a5('0x19')]);module[_0x30a5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7ee14c6..5209634 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 _0xb96d=['ENUM','rrmemory','exports','STRING','name','INTEGER'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb96d,0x9e));var _0xdb96=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xb96d[_0x1ac120];return _0x19b703;};'use strict';var Sequelize=require('sequelize');module[_0xdb96('0x0')]={'name':{'type':Sequelize[_0xdb96('0x1')],'unique':_0xdb96('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdb96('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb96('0x4')](_0xdb96('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xbaa3=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0xda6c27,_0x547dcc){var _0xc2f713=function(_0x581fd6){while(--_0x581fd6){_0xda6c27['push'](_0xda6c27['shift']());}};_0xc2f713(++_0x547dcc);}(_0xbaa3,0x100));var _0x3baa=function(_0x1081a3,_0x2ac784){_0x1081a3=_0x1081a3-0x0;var _0x5696a2=_0xbaa3[_0x1081a3];return _0x5696a2;};'use strict';var Sequelize=require(_0x3baa('0x0'));module[_0x3baa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3baa('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3baa('0x3')]},'timeout':{'type':Sequelize[_0x3baa('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3baa('0x5')](_0x3baa('0x6'),_0x3baa('0x7'),_0x3baa('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e73fbc7..e161315 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 _0xcdaa=['sendStatus','end','status','json','offset','save','MailQueues','UserProfileResource','destroy','then','error','stack','name','index','map','MailQueue','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','count','include','rows','catch','show','params','rawAttributes','intersection','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','pick','MailQueueId','UserMailQueue','findAll','User','agent','mailPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','flatMap','sequelize','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./mailQueue.socket','register'];(function(_0x1d6be0,_0x5e2b0b){var _0x4b6c6c=function(_0x45c439){while(--_0x45c439){_0x1d6be0['push'](_0x1d6be0['shift']());}};_0x4b6c6c(++_0x5e2b0b);}(_0xcdaa,0xe9));var _0xacda=function(_0x4f88,_0x596149){_0x4f88=_0x4f88-0x0;var _0x7146e7=_0xcdaa[_0x4f88];return _0x7146e7;};'use strict';var pdf=require(_0xacda('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xacda('0x1'));var zipdir=require(_0xacda('0x2'));var jsonpatch=require(_0xacda('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacda('0x4'));var Mustache=require('mustache');var util=require(_0xacda('0x5'));var path=require(_0xacda('0x6'));var sox=require(_0xacda('0x7'));var csv=require(_0xacda('0x8'));var ejs=require(_0xacda('0x9'));var fs=require('fs');var _=require(_0xacda('0xa'));var squel=require(_0xacda('0xb'));var crypto=require(_0xacda('0xc'));var jsforce=require(_0xacda('0xd'));var deskjs=require(_0xacda('0xe'));var toCsv=require(_0xacda('0x8'));var querystring=require('querystring');var Papa=require(_0xacda('0xf'));var Redis=require('ioredis');var authService=require(_0xacda('0x10'));var qs=require(_0xacda('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacda('0x12'));var logger=require(_0xacda('0x13'))('api');var utils=require(_0xacda('0x14'));var config=require(_0xacda('0x15'));var db=require(_0xacda('0x16'))['db'];config[_0xacda('0x17')]=_[_0xacda('0x18')](config[_0xacda('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacda('0x17')]));require(_0xacda('0x19'))[_0xacda('0x1a')](socket);function respondWithStatusCode(_0x423ed5,_0xbd3326){_0xbd3326=_0xbd3326||0xcc;return function(_0x2611b3){if(_0x2611b3){return _0x423ed5[_0xacda('0x1b')](_0xbd3326);}return _0x423ed5['status'](_0xbd3326)[_0xacda('0x1c')]();};}function respondWithResult(_0x158702,_0x66da5a){_0x66da5a=_0x66da5a||0xc8;return function(_0x5bffc){if(_0x5bffc){return _0x158702[_0xacda('0x1d')](_0x66da5a)[_0xacda('0x1e')](_0x5bffc);}};}function respondWithFilteredResult(_0x48e739,_0x723dae){return function(_0xa912ae){if(_0xa912ae){var _0x1c2258=_0xa912ae['count'],_0x1188d3=_0x723dae['offset'],_0x1ba2e9=_0x723dae[_0xacda('0x1f')]+_0x723dae['limit'],_0x3c5856;if(_0x1ba2e9>=_0x1c2258){_0x1ba2e9=_0x1c2258;_0x3c5856=0xc8;}else{_0x3c5856=0xce;}_0x48e739['status'](_0x3c5856);return _0x48e739['set']('Content-Range',_0x1188d3+'-'+_0x1ba2e9+'/'+_0x1c2258)['json'](_0xa912ae);}return null;};}function patchUpdates(_0x52f420){return function(_0x2e497a){try{jsonpatch['apply'](_0x2e497a,_0x52f420,!![]);}catch(_0x2f9865){return BPromise['reject'](_0x2f9865);}return _0x2e497a[_0xacda('0x20')]();};}function saveUpdates(_0x3d65c6,_0x51df8f){return function(_0x53e24c){if(_0x53e24c){return _0x53e24c['update'](_0x3d65c6)['then'](function(_0x49bdc1){return _0x49bdc1;});}return null;};}function removeEntity(_0x1febba,_0x4e4f98){return function(_0x3d37ec){if(_0x3d37ec){return _0x3d37ec['destroy']()['then'](function(){var _0x2700ed=_0x3d37ec['get']({'plain':!![]});var _0x66ec5b=_0xacda('0x21');return db[_0xacda('0x22')][_0xacda('0x23')]({'where':{'type':_0x66ec5b,'resourceId':_0x2700ed['id']}})[_0xacda('0x24')](function(){return _0x3d37ec;});})['then'](function(){_0x1febba['status'](0xcc)[_0xacda('0x1c')]();});}};}function handleEntityNotFound(_0x5d5591,_0x517154){return function(_0x2d441e){if(!_0x2d441e){_0x5d5591[_0xacda('0x1b')](0x194);}return _0x2d441e;};}function handleError(_0x55405d,_0x3cf5ff){_0x3cf5ff=_0x3cf5ff||0x1f4;return function(_0x2abdbd){logger[_0xacda('0x25')](_0x2abdbd[_0xacda('0x26')]);if(_0x2abdbd[_0xacda('0x27')]){delete _0x2abdbd[_0xacda('0x27')];}_0x55405d[_0xacda('0x1d')](_0x3cf5ff)['send'](_0x2abdbd);};}exports[_0xacda('0x28')]=function(_0x9f992f,_0x4de03d){var _0x4ba2d8={},_0x2d6323={},_0x3e3c79={'count':0x0,'rows':[]};var _0x539f9d=_[_0xacda('0x29')](db[_0xacda('0x2a')]['rawAttributes'],function(_0x59be34){return{'name':_0x59be34['fieldName'],'type':_0x59be34['type'][_0xacda('0x2b')]};});_0x2d6323[_0xacda('0x2c')]=_[_0xacda('0x29')](_0x539f9d,'name');_0x2d6323[_0xacda('0x2d')]=_[_0xacda('0x2e')](_0x9f992f['query']);_0x2d6323[_0xacda('0x2f')]=_['intersection'](_0x2d6323[_0xacda('0x2c')],_0x2d6323[_0xacda('0x2d')]);_0x4ba2d8[_0xacda('0x30')]=_['intersection'](_0x2d6323['model'],qs[_0xacda('0x31')](_0x9f992f[_0xacda('0x2d')][_0xacda('0x31')]));_0x4ba2d8['attributes']=_0x4ba2d8[_0xacda('0x30')][_0xacda('0x32')]?_0x4ba2d8[_0xacda('0x30')]:_0x2d6323[_0xacda('0x2c')];if(!_0x9f992f['query'][_0xacda('0x33')](_0xacda('0x34'))){_0x4ba2d8[_0xacda('0x35')]=qs[_0xacda('0x35')](_0x9f992f[_0xacda('0x2d')][_0xacda('0x35')]);_0x4ba2d8['offset']=qs[_0xacda('0x1f')](_0x9f992f[_0xacda('0x2d')][_0xacda('0x1f')]);}_0x4ba2d8[_0xacda('0x36')]=qs[_0xacda('0x37')](_0x9f992f[_0xacda('0x2d')][_0xacda('0x37')]);_0x4ba2d8[_0xacda('0x38')]=qs[_0xacda('0x2f')](_['pick'](_0x9f992f[_0xacda('0x2d')],_0x2d6323[_0xacda('0x2f')]),_0x539f9d);if(_0x9f992f[_0xacda('0x2d')][_0xacda('0x39')]){_0x4ba2d8['where']=_[_0xacda('0x3a')](_0x4ba2d8[_0xacda('0x38')],{'$or':_['map'](_0x539f9d,function(_0x39e24e){if(_0x39e24e['type']!=='VIRTUAL'){var _0x24eb7d={};_0x24eb7d[_0x39e24e['name']]={'$like':'%'+_0x9f992f[_0xacda('0x2d')][_0xacda('0x39')]+'%'};return _0x24eb7d;}})});}_0x4ba2d8=_['merge']({},_0x4ba2d8,_0x9f992f['options']);var _0x3793d5={'where':_0x4ba2d8[_0xacda('0x38')]};return db[_0xacda('0x2a')][_0xacda('0x3b')](_0x3793d5)[_0xacda('0x24')](function(_0x124a00){_0x3e3c79['count']=_0x124a00;if(_0x9f992f[_0xacda('0x2d')]['includeAll']){_0x4ba2d8[_0xacda('0x3c')]=[{'all':!![]}];}return db[_0xacda('0x2a')]['findAll'](_0x4ba2d8);})[_0xacda('0x24')](function(_0x549357){_0x3e3c79[_0xacda('0x3d')]=_0x549357;return _0x3e3c79;})[_0xacda('0x24')](respondWithFilteredResult(_0x4de03d,_0x4ba2d8))[_0xacda('0x3e')](handleError(_0x4de03d,null));};exports[_0xacda('0x3f')]=function(_0x5d78a4,_0x4f1e5b){var _0x4ae348={'raw':!![],'where':{'id':_0x5d78a4[_0xacda('0x40')]['id']}},_0x4e43a={};_0x4e43a[_0xacda('0x2c')]=_[_0xacda('0x2e')](db[_0xacda('0x2a')][_0xacda('0x41')]);_0x4e43a[_0xacda('0x2d')]=_['keys'](_0x5d78a4['query']);_0x4e43a['filters']=_[_0xacda('0x42')](_0x4e43a['model'],_0x4e43a[_0xacda('0x2d')]);_0x4ae348[_0xacda('0x30')]=_[_0xacda('0x42')](_0x4e43a[_0xacda('0x2c')],qs[_0xacda('0x31')](_0x5d78a4[_0xacda('0x2d')][_0xacda('0x31')]));_0x4ae348[_0xacda('0x30')]=_0x4ae348[_0xacda('0x30')][_0xacda('0x32')]?_0x4ae348[_0xacda('0x30')]:_0x4e43a['model'];if(_0x5d78a4[_0xacda('0x2d')][_0xacda('0x43')]){_0x4ae348[_0xacda('0x3c')]=[{'all':!![]}];}_0x4ae348=_['merge']({},_0x4ae348,_0x5d78a4[_0xacda('0x44')]);return db[_0xacda('0x2a')][_0xacda('0x45')](_0x4ae348)[_0xacda('0x24')](handleEntityNotFound(_0x4f1e5b,null))['then'](respondWithResult(_0x4f1e5b,null))['catch'](handleError(_0x4f1e5b,null));};exports[_0xacda('0x46')]=function(_0x2ed619,_0x5cd8dc){return db['MailQueue'][_0xacda('0x46')](_0x2ed619[_0xacda('0x47')],{})[_0xacda('0x24')](function(_0x21a426){var _0x8013d4=_0x2ed619[_0xacda('0x48')][_0xacda('0x49')]({'plain':!![]});if(!_0x8013d4)throw new Error(_0xacda('0x4a'));if(_0x8013d4[_0xacda('0x4b')]===_0xacda('0x48')){var _0x253678=_0x21a426[_0xacda('0x49')]({'plain':!![]});var _0x4ca663='MailQueues';return db[_0xacda('0x4c')][_0xacda('0x45')]({'where':{'name':_0x4ca663,'userProfileId':_0x8013d4[_0xacda('0x4d')]},'raw':!![]})[_0xacda('0x24')](function(_0x13f8a6){if(_0x13f8a6&&_0x13f8a6['autoAssociation']===0x0){return db[_0xacda('0x22')][_0xacda('0x46')]({'name':_0x253678[_0xacda('0x27')],'resourceId':_0x253678['id'],'type':_0x13f8a6[_0xacda('0x27')],'sectionId':_0x13f8a6['id']},{})[_0xacda('0x24')](function(){return _0x21a426;});}else{return _0x21a426;}})['catch'](function(_0x102b8f){logger[_0xacda('0x25')](_0xacda('0x4e'),_0x102b8f);throw _0x102b8f;});}return _0x21a426;})['then'](respondWithResult(_0x5cd8dc,0xc9))[_0xacda('0x3e')](handleError(_0x5cd8dc,null));};exports[_0xacda('0x4f')]=function(_0x3abc3,_0x42c903){if(_0x3abc3[_0xacda('0x47')]['id']){delete _0x3abc3[_0xacda('0x47')]['id'];}return db[_0xacda('0x2a')]['find']({'where':{'id':_0x3abc3['params']['id']}})['then'](handleEntityNotFound(_0x42c903,null))[_0xacda('0x24')](saveUpdates(_0x3abc3[_0xacda('0x47')],null))[_0xacda('0x24')](respondWithResult(_0x42c903,null))[_0xacda('0x3e')](handleError(_0x42c903,null));};exports['destroy']=function(_0x1428ef,_0x59a9c4){return db[_0xacda('0x2a')][_0xacda('0x45')]({'where':{'id':_0x1428ef['params']['id']}})[_0xacda('0x24')](handleEntityNotFound(_0x59a9c4,null))[_0xacda('0x24')](removeEntity(_0x59a9c4,null))[_0xacda('0x3e')](handleError(_0x59a9c4,null));};exports[_0xacda('0x50')]=function(_0x608779,_0x72ff65){return db[_0xacda('0x2a')][_0xacda('0x50')]()['then'](respondWithResult(_0x72ff65,null))[_0xacda('0x3e')](handleError(_0x72ff65,null));};exports['getMembers']=function(_0x962cba,_0x310802,_0x3185b1){var _0x340113={'raw':!![],'where':{}},_0x7ccb83={},_0x188e97;return db[_0xacda('0x2a')][_0xacda('0x51')]({'where':{'id':_0x962cba[_0xacda('0x40')]['id']}})[_0xacda('0x24')](handleEntityNotFound(_0x310802,null))['then'](function(_0x4eb1e9){if(_0x4eb1e9){_0x188e97=_0x4eb1e9[_0xacda('0x49')]({'plain':!![]});_0x7ccb83['model']=_['keys'](db['UserMailQueue'][_0xacda('0x41')]);_0x7ccb83['query']=_[_0xacda('0x2e')](_0x962cba['query']);_0x7ccb83[_0xacda('0x2f')]=_[_0xacda('0x42')](_0x7ccb83[_0xacda('0x2c')],_0x7ccb83[_0xacda('0x2d')]);_0x340113[_0xacda('0x30')]=_['intersection'](_0x7ccb83[_0xacda('0x2c')],qs[_0xacda('0x31')](_0x962cba[_0xacda('0x2d')][_0xacda('0x31')]));_0x340113['attributes']=_0x340113[_0xacda('0x30')][_0xacda('0x32')]?_0x340113[_0xacda('0x30')]:_0x7ccb83['model'];if(!_0x962cba[_0xacda('0x2d')]['hasOwnProperty'](_0xacda('0x34'))){_0x340113[_0xacda('0x35')]=qs[_0xacda('0x35')](_0x962cba[_0xacda('0x2d')][_0xacda('0x35')]);_0x340113[_0xacda('0x1f')]=qs[_0xacda('0x1f')](_0x962cba['query'][_0xacda('0x1f')]);}_0x340113[_0xacda('0x36')]=qs[_0xacda('0x37')](_0x962cba[_0xacda('0x2d')][_0xacda('0x37')]);_0x340113['where']=qs[_0xacda('0x2f')](_[_0xacda('0x52')](_0x962cba[_0xacda('0x2d')],_0x7ccb83[_0xacda('0x2f')]));_0x340113[_0xacda('0x38')][_0xacda('0x53')]=_0x4eb1e9['id'];if(_0x962cba['query']['filter']){_0x340113[_0xacda('0x38')]=_['merge'](_0x340113[_0xacda('0x38')],{'$or':_['map'](_0x340113['attributes'],function(_0x5a52eb){var _0x19c01a={};_0x19c01a[_0x5a52eb]={'$like':'%'+_0x962cba[_0xacda('0x2d')][_0xacda('0x39')]+'%'};return _0x19c01a;})});}_0x340113=_[_0xacda('0x3a')]({},_0x340113,_0x962cba[_0xacda('0x44')]);return db[_0xacda('0x54')][_0xacda('0x55')](_0x340113);}})[_0xacda('0x24')](function(_0x361a50){if(_0x361a50){return db[_0xacda('0x56')]['findAndCountAll']({'where':{'id':_[_0xacda('0x29')](_0x361a50,'UserId'),'role':_0xacda('0x57')},'attributes':['id','name',_0xacda('0x58'),_0xacda('0x59'),_0xacda('0x5a')]});}})[_0xacda('0x24')](function(_0x498812){if(_0x498812){return{'count':_0x498812['count'],'rows':_['map'](_0x498812['rows'],function(_0x8223d2){return{'membername':_0x8223d2[_0xacda('0x27')],'UserId':_0x8223d2['id'],'queue_name':_0x188e97[_0xacda('0x27')],'MailQueueId':_0x188e97['id'],'interface':util['format'](_0xacda('0x5b'),'SIP',_0x8223d2[_0xacda('0x27')]),'penalty':0x0,'paused':_0x8223d2[_0xacda('0x58')],'createdAt':_0x8223d2[_0xacda('0x5a')],'updatedAt':_0x8223d2[_0xacda('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xacda('0x24')](respondWithFilteredResult(_0x310802,_0x340113))[_0xacda('0x3e')](handleError(_0x310802,null));};exports[_0xacda('0x5c')]=function(_0x27ce0b,_0x1fa60f,_0xcd6260){var _0x11bb06={};var _0x339661={};var _0x1d192d;var _0x355c5b;return db[_0xacda('0x2a')][_0xacda('0x51')]({'where':{'id':_0x27ce0b[_0xacda('0x40')]['id']}})[_0xacda('0x24')](handleEntityNotFound(_0x1fa60f,null))[_0xacda('0x24')](function(_0x290356){if(_0x290356){_0x1d192d=_0x290356;_0x339661['model']=_[_0xacda('0x2e')](db[_0xacda('0x5d')][_0xacda('0x41')]);_0x339661[_0xacda('0x2d')]=_[_0xacda('0x2e')](_0x27ce0b[_0xacda('0x2d')]);_0x339661[_0xacda('0x2f')]=_[_0xacda('0x42')](_0x339661['model'],_0x339661['query']);_0x11bb06[_0xacda('0x30')]=_['intersection'](_0x339661[_0xacda('0x2c')],qs[_0xacda('0x31')](_0x27ce0b[_0xacda('0x2d')][_0xacda('0x31')]));_0x11bb06['attributes']=_0x11bb06[_0xacda('0x30')][_0xacda('0x32')]?_0x11bb06[_0xacda('0x30')]:_0x339661[_0xacda('0x2c')];_0x11bb06[_0xacda('0x36')]=qs['sort'](_0x27ce0b[_0xacda('0x2d')][_0xacda('0x37')]);_0x11bb06['where']=qs[_0xacda('0x2f')](_[_0xacda('0x52')](_0x27ce0b[_0xacda('0x2d')],_0x339661[_0xacda('0x2f')]));if(_0x27ce0b[_0xacda('0x2d')]['filter']){_0x11bb06[_0xacda('0x38')]=_['merge'](_0x11bb06['where'],{'$or':_[_0xacda('0x29')](_0x11bb06[_0xacda('0x30')],function(_0x479d44){var _0x15c6ea={};_0x15c6ea[_0x479d44]={'$like':'%'+_0x27ce0b['query'][_0xacda('0x39')]+'%'};return _0x15c6ea;})});}_0x11bb06=_[_0xacda('0x3a')]({},_0x11bb06,_0x27ce0b['options']);return _0x1d192d[_0xacda('0x5c')](_0x11bb06);}})[_0xacda('0x24')](function(_0x29bf90){if(_0x29bf90){_0x355c5b=_0x29bf90['length'];if(!_0x27ce0b[_0xacda('0x2d')][_0xacda('0x33')](_0xacda('0x34'))){_0x11bb06[_0xacda('0x35')]=qs[_0xacda('0x35')](_0x27ce0b[_0xacda('0x2d')][_0xacda('0x35')]);_0x11bb06['offset']=qs[_0xacda('0x1f')](_0x27ce0b[_0xacda('0x2d')][_0xacda('0x1f')]);}return _0x1d192d['getTeams'](_0x11bb06);}})[_0xacda('0x24')](function(_0x1210e3){if(_0x1210e3){return _0x1210e3?{'count':_0x355c5b,'rows':_0x1210e3}:null;}})[_0xacda('0x24')](respondWithResult(_0x1fa60f,null))[_0xacda('0x3e')](handleError(_0x1fa60f,null));};exports[_0xacda('0x5e')]=function(_0x2be78c,_0x2c1577,_0x26989d){var _0x452b8f=_0x2be78c['body'][_0xacda('0x5f')];return db[_0xacda('0x5d')][_0xacda('0x55')]({'where':{'id':_0x452b8f},'attributes':['id'],'include':[{'model':db[_0xacda('0x56')],'as':_0xacda('0x60'),'attributes':['id',_0xacda('0x27'),_0xacda('0x61'),'voicePause','interface'],'raw':!![]}]})[_0xacda('0x24')](function(_0x1b576a){if(_0x1b576a){var _0x54023a=_[_0xacda('0x62')](_0x1b576a,function(_0x4a096e){var _0x3c6bd2=_0x4a096e[_0xacda('0x49')]({'plain':!![]});return _0x3c6bd2[_0xacda('0x60')];});return db['MailQueue'][_0xacda('0x45')]({'where':{'id':_0x2be78c[_0xacda('0x40')]['id']}})['then'](function(_0x1ff3c0){return db[_0xacda('0x63')]['transaction'](function(_0xc5ac0b){return _0x1ff3c0[_0xacda('0x5e')](_0x452b8f,{'transaction':_0xc5ac0b})['then'](function(){return BPromise['each'](_0x54023a,function(_0xaecf62){return db[_0xacda('0x54')]['findOrCreate']({'where':{'UserId':_0xaecf62['id'],'MailQueueId':_0x2be78c[_0xacda('0x40')]['id']},'transaction':_0xc5ac0b});});})[_0xacda('0x24')](function(){_0x54023a[_0xacda('0x64')](function(_0xe04f55){socket[_0xacda('0x65')]('userMailQueue:save',{'UserId':_0xe04f55['id'],'MailQueueId':_0x1ff3c0['id']});});});});});}})[_0xacda('0x24')](respondWithStatusCode(_0x2c1577,null))[_0xacda('0x3e')](handleError(_0x2c1577,null));};exports[_0xacda('0x66')]=function(_0x2b7a73,_0x1f4ac,_0x3055d7){return db[_0xacda('0x5d')][_0xacda('0x55')]({'where':{'id':_0x2b7a73['query'][_0xacda('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xacda('0x56')],'as':_0xacda('0x60'),'attributes':['id'],'raw':!![]}]})[_0xacda('0x24')](handleEntityNotFound(_0x1f4ac,null))[_0xacda('0x24')](function(_0x1462a0){var _0x203e36=_[_0xacda('0x29')](_0x1462a0,'id');var _0x4fc921=[];var _0x52bd4f=[];var _0x1f48b9=squel[_0xacda('0x67')]();_0x1f48b9[_0xacda('0x68')](_0xacda('0x69'))[_0xacda('0x6a')](_0xacda('0x6b'),'tq')[_0xacda('0x6c')]('user_has_teams','ut',_0xacda('0x6d'))[_0xacda('0x38')](_0xacda('0x6e'),_0x2b7a73[_0xacda('0x40')]['id']);for(var _0x4dcd66=0x0;_0x4dcd66<_0x1462a0['length'];_0x4dcd66+=0x1){let _0x3bf839=_0x1462a0[_0x4dcd66];for(var _0x807ac6=0x0;_0x807ac6<_0x3bf839['Agents'][_0xacda('0x32')];_0x807ac6+=0x1){let _0x5579d8=_0x3bf839['Agents'][_0x807ac6];var _0x5a08be=_0x1f48b9[_0xacda('0x6f')]();_0x5a08be[_0xacda('0x38')](_0xacda('0x70'),_0x5579d8['id']);_0x52bd4f[_0xacda('0x71')](db[_0xacda('0x63')][_0xacda('0x2d')](_0x5a08be[_0xacda('0x72')](),{'type':db['sequelize'][_0xacda('0x73')][_0xacda('0x74')]})[_0xacda('0x24')](function(_0x5bf7ea){if(_0x5bf7ea[_0xacda('0x32')]===0x1){return _0x5579d8['id'];}else{var _0x31c2c2=_['every'](_['map'](_0x5bf7ea,'TeamId'),function(_0x53c830){return _[_0xacda('0x75')](_0x203e36,_0x53c830);});if(_0x31c2c2){return _0x5579d8['id'];}}}));}}return BPromise[_0xacda('0x76')](_0x52bd4f)[_0xacda('0x24')](function(_0x1af34c){_0x4fc921=_(_0x4fc921)[_0xacda('0x77')](_0x1af34c)[_0xacda('0x78')]()[_0xacda('0x79')]();return db[_0xacda('0x2a')][_0xacda('0x45')]({'where':{'id':_0x2b7a73[_0xacda('0x40')]['id']}})[_0xacda('0x24')](function(_0x139d98){return db[_0xacda('0x63')]['transaction'](function(_0x8b07a){return _0x139d98[_0xacda('0x66')](_0x2b7a73[_0xacda('0x2d')][_0xacda('0x5f')],{'transaction':_0x8b07a})[_0xacda('0x24')](function(){if(!_[_0xacda('0x7a')](_0x4fc921)){return _0x139d98[_0xacda('0x7b')](_0x4fc921,{'transaction':_0x8b07a});}})[_0xacda('0x24')](function(){_0x4fc921[_0xacda('0x64')](function(_0x2746c1){socket['emit'](_0xacda('0x7c'),{'UserId':_0x2746c1,'MailQueueId':_0x139d98['id']});});});});});});})[_0xacda('0x24')](respondWithStatusCode(_0x1f4ac,null))['catch'](handleError(_0x1f4ac,null));};exports['addAgents']=function(_0x5c541c,_0x456d76,_0x50493a){return db['MailQueue'][_0xacda('0x45')]({'where':{'id':_0x5c541c[_0xacda('0x40')]['id']}})[_0xacda('0x24')](handleEntityNotFound(_0x456d76,null))[_0xacda('0x24')](function(_0x10f40c){if(_0x10f40c){return _0x10f40c[_0xacda('0x7d')](_0x5c541c[_0xacda('0x47')][_0xacda('0x5f')],_[_0xacda('0x7e')](_0x5c541c[_0xacda('0x47')],[_0xacda('0x5f'),'id'])||{})['spread'](function(_0x54ea8b){for(var _0x5dc59c=0x0;_0x5dc59c<_0x5c541c[_0xacda('0x47')][_0xacda('0x5f')]['length'];_0x5dc59c+=0x1){socket[_0xacda('0x65')](_0xacda('0x7f'),{'UserId':_0x5c541c[_0xacda('0x47')]['ids'][_0x5dc59c],'MailQueueId':_0x5c541c[_0xacda('0x40')]['id']});}return _0x54ea8b;});}})['then'](respondWithResult(_0x456d76,null))['catch'](handleError(_0x456d76,null));};exports[_0xacda('0x7b')]=function(_0x2ded24,_0x2b8ddc,_0x517b19){return db['MailQueue'][_0xacda('0x45')]({'where':{'id':_0x2ded24[_0xacda('0x40')]['id']}})[_0xacda('0x24')](handleEntityNotFound(_0x2b8ddc,null))[_0xacda('0x24')](function(_0x3b43c5){if(_0x3b43c5){return _0x3b43c5['removeAgents'](_0x2ded24[_0xacda('0x2d')][_0xacda('0x5f')])[_0xacda('0x24')](function(){if(_[_0xacda('0x80')](_0x2ded24['query'][_0xacda('0x5f')])){for(var _0x358da8=0x0;_0x358da8<_0x2ded24[_0xacda('0x2d')]['ids']['length'];_0x358da8+=0x1){socket[_0xacda('0x65')](_0xacda('0x7c'),{'UserId':Number(_0x2ded24['query'][_0xacda('0x5f')][_0x358da8]),'MailQueueId':Number(_0x2ded24['params']['id'])});}}else{socket[_0xacda('0x65')](_0xacda('0x7c'),{'UserId':Number(_0x2ded24[_0xacda('0x2d')][_0xacda('0x5f')]),'MailQueueId':Number(_0x2ded24[_0xacda('0x40')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b8ddc,null))[_0xacda('0x3e')](handleError(_0x2b8ddc,null));};exports[_0xacda('0x81')]=function(_0x29c34d,_0x5edce1,_0x4a6ca2){var _0x2c15ff={};var _0x355a20={};var _0x15ca17;var _0x3aebcb;return db[_0xacda('0x2a')][_0xacda('0x51')]({'where':{'id':_0x29c34d[_0xacda('0x40')]['id']}})['then'](handleEntityNotFound(_0x5edce1,null))[_0xacda('0x24')](function(_0x9499ab){if(_0x9499ab){_0x15ca17=_0x9499ab;_0x355a20[_0xacda('0x2c')]=_[_0xacda('0x2e')](db[_0xacda('0x56')][_0xacda('0x41')]);_0x355a20[_0xacda('0x2d')]=_[_0xacda('0x2e')](_0x29c34d[_0xacda('0x2d')]);_0x355a20[_0xacda('0x2f')]=_[_0xacda('0x42')](_0x355a20['model'],_0x355a20[_0xacda('0x2d')]);_0x2c15ff[_0xacda('0x30')]=_[_0xacda('0x42')](_0x355a20[_0xacda('0x2c')],qs[_0xacda('0x31')](_0x29c34d[_0xacda('0x2d')]['fields']));_0x2c15ff['attributes']=_0x2c15ff[_0xacda('0x30')][_0xacda('0x32')]?_0x2c15ff[_0xacda('0x30')]:_0x355a20[_0xacda('0x2c')];_0x2c15ff[_0xacda('0x36')]=qs[_0xacda('0x37')](_0x29c34d['query'][_0xacda('0x37')]);_0x2c15ff[_0xacda('0x38')]=qs['filters'](_[_0xacda('0x52')](_0x29c34d['query'],_0x355a20[_0xacda('0x2f')]));if(_0x29c34d[_0xacda('0x2d')][_0xacda('0x39')]){_0x2c15ff['where']=_['merge'](_0x2c15ff[_0xacda('0x38')],{'$or':_[_0xacda('0x29')](_0x2c15ff[_0xacda('0x30')],function(_0x554855){var _0x3dd02f={};_0x3dd02f[_0x554855]={'$like':'%'+_0x29c34d[_0xacda('0x2d')][_0xacda('0x39')]+'%'};return _0x3dd02f;})});}_0x2c15ff=_[_0xacda('0x3a')]({},_0x2c15ff,_0x29c34d[_0xacda('0x44')]);return _0x15ca17[_0xacda('0x81')](_0x2c15ff);}})[_0xacda('0x24')](function(_0x5207bb){if(_0x5207bb){_0x3aebcb=_0x5207bb['length'];if(!_0x29c34d['query'][_0xacda('0x33')]('nolimit')){_0x2c15ff[_0xacda('0x35')]=qs[_0xacda('0x35')](_0x29c34d[_0xacda('0x2d')][_0xacda('0x35')]);_0x2c15ff[_0xacda('0x1f')]=qs['offset'](_0x29c34d['query'][_0xacda('0x1f')]);}return _0x15ca17[_0xacda('0x81')](_0x2c15ff);}})[_0xacda('0x24')](function(_0x145c3b){if(_0x145c3b){return _0x145c3b?{'count':_0x3aebcb,'rows':_0x145c3b}:null;}})[_0xacda('0x24')](respondWithResult(_0x5edce1,null))['catch'](handleError(_0x5edce1,null));}; \ No newline at end of file +var _0x948d=['sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','MailQueueId','UserMailQueue','findAndCountAll','UserId','agent','mailPause','SIP','updatedAt','getTeams','Team','addTeams','ids','User','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x948d,0x102));var _0xd948=function(_0x344676,_0x5f3ece){_0x344676=_0x344676-0x0;var _0xe8510b=_0x948d[_0x344676];return _0xe8510b;};'use strict';var pdf=require(_0xd948('0x0'));var emlformat=require(_0xd948('0x1'));var rimraf=require(_0xd948('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd948('0x3'));var rp=require(_0xd948('0x4'));var moment=require('moment');var BPromise=require(_0xd948('0x5'));var Mustache=require(_0xd948('0x6'));var util=require(_0xd948('0x7'));var path=require('path');var sox=require(_0xd948('0x8'));var csv=require(_0xd948('0x9'));var ejs=require(_0xd948('0xa'));var fs=require('fs');var _=require(_0xd948('0xb'));var squel=require(_0xd948('0xc'));var crypto=require(_0xd948('0xd'));var jsforce=require(_0xd948('0xe'));var deskjs=require(_0xd948('0xf'));var toCsv=require(_0xd948('0x9'));var querystring=require(_0xd948('0x10'));var Papa=require(_0xd948('0x11'));var Redis=require(_0xd948('0x12'));var authService=require(_0xd948('0x13'));var qs=require(_0xd948('0x14'));var as=require(_0xd948('0x15'));var hardwareService=require(_0xd948('0x16'));var logger=require(_0xd948('0x17'))(_0xd948('0x18'));var utils=require(_0xd948('0x19'));var config=require('../../config/environment');var db=require(_0xd948('0x1a'))['db'];config['redis']=_[_0xd948('0x1b')](config[_0xd948('0x1c')],{'host':_0xd948('0x1d'),'port':0x18eb});var socket=require(_0xd948('0x1e'))(new Redis(config[_0xd948('0x1c')]));require(_0xd948('0x1f'))['register'](socket);function respondWithStatusCode(_0x5ee985,_0x273966){_0x273966=_0x273966||0xcc;return function(_0x13f6ec){if(_0x13f6ec){return _0x5ee985[_0xd948('0x20')](_0x273966);}return _0x5ee985[_0xd948('0x21')](_0x273966)[_0xd948('0x22')]();};}function respondWithResult(_0x214afc,_0x98f041){_0x98f041=_0x98f041||0xc8;return function(_0x5942f6){if(_0x5942f6){return _0x214afc[_0xd948('0x21')](_0x98f041)[_0xd948('0x23')](_0x5942f6);}};}function respondWithFilteredResult(_0x1c2bf4,_0x2e3e4a){return function(_0x1a8e37){if(_0x1a8e37){var _0x2c3d6e=_0x1a8e37['count'],_0xf9ee9d=_0x2e3e4a[_0xd948('0x24')],_0x9417fb=_0x2e3e4a[_0xd948('0x24')]+_0x2e3e4a[_0xd948('0x25')],_0x230846;if(_0x9417fb>=_0x2c3d6e){_0x9417fb=_0x2c3d6e;_0x230846=0xc8;}else{_0x230846=0xce;}_0x1c2bf4[_0xd948('0x21')](_0x230846);return _0x1c2bf4[_0xd948('0x26')](_0xd948('0x27'),_0xf9ee9d+'-'+_0x9417fb+'/'+_0x2c3d6e)[_0xd948('0x23')](_0x1a8e37);}return null;};}function patchUpdates(_0x248930){return function(_0x3d4b83){try{jsonpatch['apply'](_0x3d4b83,_0x248930,!![]);}catch(_0x15d7da){return BPromise['reject'](_0x15d7da);}return _0x3d4b83[_0xd948('0x28')]();};}function saveUpdates(_0x1f24aa,_0x29a0e4){return function(_0x33b90f){if(_0x33b90f){return _0x33b90f[_0xd948('0x29')](_0x1f24aa)[_0xd948('0x2a')](function(_0x2c0312){return _0x2c0312;});}return null;};}function removeEntity(_0x544c26,_0x511f3e){return function(_0x1bdbf4){if(_0x1bdbf4){return _0x1bdbf4[_0xd948('0x2b')]()[_0xd948('0x2a')](function(){var _0x1245e4=_0x1bdbf4[_0xd948('0x2c')]({'plain':!![]});var _0x53baab=_0xd948('0x2d');return db[_0xd948('0x2e')][_0xd948('0x2b')]({'where':{'type':_0x53baab,'resourceId':_0x1245e4['id']}})[_0xd948('0x2a')](function(){return _0x1bdbf4;});})[_0xd948('0x2a')](function(){_0x544c26['status'](0xcc)[_0xd948('0x22')]();});}};}function handleEntityNotFound(_0x227963,_0x585528){return function(_0x10ad78){if(!_0x10ad78){_0x227963['sendStatus'](0x194);}return _0x10ad78;};}function handleError(_0x5233c9,_0x3e254a){_0x3e254a=_0x3e254a||0x1f4;return function(_0x44befd){logger['error'](_0x44befd[_0xd948('0x2f')]);if(_0x44befd[_0xd948('0x30')]){delete _0x44befd[_0xd948('0x30')];}_0x5233c9[_0xd948('0x21')](_0x3e254a)[_0xd948('0x31')](_0x44befd);};}exports[_0xd948('0x32')]=function(_0x4b82ea,_0x28e3bf){var _0x18e115={},_0x3ab0f4={},_0x596600={'count':0x0,'rows':[]};var _0xe9072f=_[_0xd948('0x33')](db[_0xd948('0x34')][_0xd948('0x35')],function(_0x2e763d){return{'name':_0x2e763d[_0xd948('0x36')],'type':_0x2e763d[_0xd948('0x37')][_0xd948('0x38')]};});_0x3ab0f4['model']=_[_0xd948('0x33')](_0xe9072f,_0xd948('0x30'));_0x3ab0f4['query']=_[_0xd948('0x39')](_0x4b82ea[_0xd948('0x3a')]);_0x3ab0f4['filters']=_['intersection'](_0x3ab0f4[_0xd948('0x3b')],_0x3ab0f4['query']);_0x18e115[_0xd948('0x3c')]=_['intersection'](_0x3ab0f4['model'],qs[_0xd948('0x3d')](_0x4b82ea[_0xd948('0x3a')][_0xd948('0x3d')]));_0x18e115['attributes']=_0x18e115[_0xd948('0x3c')][_0xd948('0x3e')]?_0x18e115[_0xd948('0x3c')]:_0x3ab0f4[_0xd948('0x3b')];if(!_0x4b82ea[_0xd948('0x3a')][_0xd948('0x3f')](_0xd948('0x40'))){_0x18e115['limit']=qs[_0xd948('0x25')](_0x4b82ea[_0xd948('0x3a')][_0xd948('0x25')]);_0x18e115[_0xd948('0x24')]=qs[_0xd948('0x24')](_0x4b82ea[_0xd948('0x3a')][_0xd948('0x24')]);}_0x18e115[_0xd948('0x41')]=qs[_0xd948('0x42')](_0x4b82ea[_0xd948('0x3a')][_0xd948('0x42')]);_0x18e115['where']=qs[_0xd948('0x43')](_[_0xd948('0x44')](_0x4b82ea['query'],_0x3ab0f4[_0xd948('0x43')]),_0xe9072f);if(_0x4b82ea[_0xd948('0x3a')][_0xd948('0x45')]){_0x18e115[_0xd948('0x46')]=_[_0xd948('0x47')](_0x18e115['where'],{'$or':_[_0xd948('0x33')](_0xe9072f,function(_0x2e6a8d){if(_0x2e6a8d['type']!==_0xd948('0x48')){var _0x33ca00={};_0x33ca00[_0x2e6a8d['name']]={'$like':'%'+_0x4b82ea[_0xd948('0x3a')][_0xd948('0x45')]+'%'};return _0x33ca00;}})});}_0x18e115=_[_0xd948('0x47')]({},_0x18e115,_0x4b82ea['options']);var _0x10132a={'where':_0x18e115[_0xd948('0x46')]};return db[_0xd948('0x34')]['count'](_0x10132a)[_0xd948('0x2a')](function(_0x7d0798){_0x596600[_0xd948('0x49')]=_0x7d0798;if(_0x4b82ea[_0xd948('0x3a')][_0xd948('0x4a')]){_0x18e115[_0xd948('0x4b')]=[{'all':!![]}];}return db[_0xd948('0x34')][_0xd948('0x4c')](_0x18e115);})[_0xd948('0x2a')](function(_0x3a5352){_0x596600[_0xd948('0x4d')]=_0x3a5352;return _0x596600;})[_0xd948('0x2a')](respondWithFilteredResult(_0x28e3bf,_0x18e115))[_0xd948('0x4e')](handleError(_0x28e3bf,null));};exports[_0xd948('0x4f')]=function(_0x31161d,_0x36879c){var _0x332941={'raw':!![],'where':{'id':_0x31161d[_0xd948('0x50')]['id']}},_0x5efd38={};_0x5efd38[_0xd948('0x3b')]=_[_0xd948('0x39')](db[_0xd948('0x34')][_0xd948('0x35')]);_0x5efd38[_0xd948('0x3a')]=_[_0xd948('0x39')](_0x31161d['query']);_0x5efd38[_0xd948('0x43')]=_['intersection'](_0x5efd38[_0xd948('0x3b')],_0x5efd38[_0xd948('0x3a')]);_0x332941['attributes']=_[_0xd948('0x51')](_0x5efd38[_0xd948('0x3b')],qs[_0xd948('0x3d')](_0x31161d[_0xd948('0x3a')][_0xd948('0x3d')]));_0x332941[_0xd948('0x3c')]=_0x332941[_0xd948('0x3c')][_0xd948('0x3e')]?_0x332941[_0xd948('0x3c')]:_0x5efd38[_0xd948('0x3b')];if(_0x31161d[_0xd948('0x3a')][_0xd948('0x4a')]){_0x332941['include']=[{'all':!![]}];}_0x332941=_[_0xd948('0x47')]({},_0x332941,_0x31161d[_0xd948('0x52')]);return db['MailQueue'][_0xd948('0x53')](_0x332941)[_0xd948('0x2a')](handleEntityNotFound(_0x36879c,null))[_0xd948('0x2a')](respondWithResult(_0x36879c,null))[_0xd948('0x4e')](handleError(_0x36879c,null));};exports[_0xd948('0x54')]=function(_0x43c646,_0x87906f){return db[_0xd948('0x34')][_0xd948('0x54')](_0x43c646[_0xd948('0x55')],{})['then'](function(_0x5d3eb7){var _0x4045e9=_0x43c646[_0xd948('0x56')][_0xd948('0x2c')]({'plain':!![]});if(!_0x4045e9)throw new Error(_0xd948('0x57'));if(_0x4045e9[_0xd948('0x58')]===_0xd948('0x56')){var _0x337088=_0x5d3eb7['get']({'plain':!![]});var _0x27a2e4=_0xd948('0x2d');return db[_0xd948('0x59')][_0xd948('0x53')]({'where':{'name':_0x27a2e4,'userProfileId':_0x4045e9['userProfileId']},'raw':!![]})[_0xd948('0x2a')](function(_0x46afe2){if(_0x46afe2&&_0x46afe2[_0xd948('0x5a')]===0x0){return db[_0xd948('0x2e')][_0xd948('0x54')]({'name':_0x337088[_0xd948('0x30')],'resourceId':_0x337088['id'],'type':_0x46afe2['name'],'sectionId':_0x46afe2['id']},{})[_0xd948('0x2a')](function(){return _0x5d3eb7;});}else{return _0x5d3eb7;}})[_0xd948('0x4e')](function(_0xe5199f){logger[_0xd948('0x5b')](_0xd948('0x5c'),_0xe5199f);throw _0xe5199f;});}return _0x5d3eb7;})[_0xd948('0x2a')](respondWithResult(_0x87906f,0xc9))[_0xd948('0x4e')](handleError(_0x87906f,null));};exports['update']=function(_0x38e6ce,_0x5bc7d8){if(_0x38e6ce[_0xd948('0x55')]['id']){delete _0x38e6ce[_0xd948('0x55')]['id'];}return db[_0xd948('0x34')][_0xd948('0x53')]({'where':{'id':_0x38e6ce[_0xd948('0x50')]['id']}})['then'](handleEntityNotFound(_0x5bc7d8,null))[_0xd948('0x2a')](saveUpdates(_0x38e6ce[_0xd948('0x55')],null))[_0xd948('0x2a')](respondWithResult(_0x5bc7d8,null))[_0xd948('0x4e')](handleError(_0x5bc7d8,null));};exports[_0xd948('0x2b')]=function(_0x57f58d,_0x550e01){return db['MailQueue'][_0xd948('0x53')]({'where':{'id':_0x57f58d[_0xd948('0x50')]['id']}})['then'](handleEntityNotFound(_0x550e01,null))[_0xd948('0x2a')](removeEntity(_0x550e01,null))[_0xd948('0x4e')](handleError(_0x550e01,null));};exports[_0xd948('0x5d')]=function(_0x337240,_0xa9cdc4){return db[_0xd948('0x34')][_0xd948('0x5d')]()[_0xd948('0x2a')](respondWithResult(_0xa9cdc4,null))[_0xd948('0x4e')](handleError(_0xa9cdc4,null));};exports[_0xd948('0x5e')]=function(_0x36f852,_0x4a8be4,_0x6bd5d1){var _0x404d79={'raw':!![],'where':{}},_0x153044={},_0x259494;return db['MailQueue'][_0xd948('0x5f')]({'where':{'id':_0x36f852['params']['id']}})[_0xd948('0x2a')](handleEntityNotFound(_0x4a8be4,null))['then'](function(_0x5d35e4){if(_0x5d35e4){_0x259494=_0x5d35e4[_0xd948('0x2c')]({'plain':!![]});_0x153044['model']=_['keys'](db['UserMailQueue']['rawAttributes']);_0x153044['query']=_['keys'](_0x36f852[_0xd948('0x3a')]);_0x153044['filters']=_[_0xd948('0x51')](_0x153044[_0xd948('0x3b')],_0x153044[_0xd948('0x3a')]);_0x404d79['attributes']=_[_0xd948('0x51')](_0x153044[_0xd948('0x3b')],qs[_0xd948('0x3d')](_0x36f852[_0xd948('0x3a')][_0xd948('0x3d')]));_0x404d79[_0xd948('0x3c')]=_0x404d79[_0xd948('0x3c')][_0xd948('0x3e')]?_0x404d79[_0xd948('0x3c')]:_0x153044[_0xd948('0x3b')];if(!_0x36f852[_0xd948('0x3a')]['hasOwnProperty'](_0xd948('0x40'))){_0x404d79[_0xd948('0x25')]=qs['limit'](_0x36f852['query'][_0xd948('0x25')]);_0x404d79[_0xd948('0x24')]=qs[_0xd948('0x24')](_0x36f852['query'][_0xd948('0x24')]);}_0x404d79[_0xd948('0x41')]=qs['sort'](_0x36f852[_0xd948('0x3a')][_0xd948('0x42')]);_0x404d79[_0xd948('0x46')]=qs[_0xd948('0x43')](_[_0xd948('0x44')](_0x36f852[_0xd948('0x3a')],_0x153044[_0xd948('0x43')]));_0x404d79[_0xd948('0x46')][_0xd948('0x60')]=_0x5d35e4['id'];if(_0x36f852['query'][_0xd948('0x45')]){_0x404d79[_0xd948('0x46')]=_[_0xd948('0x47')](_0x404d79[_0xd948('0x46')],{'$or':_['map'](_0x404d79[_0xd948('0x3c')],function(_0x31bfd0){var _0x5e8a54={};_0x5e8a54[_0x31bfd0]={'$like':'%'+_0x36f852['query'][_0xd948('0x45')]+'%'};return _0x5e8a54;})});}_0x404d79=_['merge']({},_0x404d79,_0x36f852[_0xd948('0x52')]);return db[_0xd948('0x61')][_0xd948('0x4c')](_0x404d79);}})[_0xd948('0x2a')](function(_0x34fc72){if(_0x34fc72){return db['User'][_0xd948('0x62')]({'where':{'id':_[_0xd948('0x33')](_0x34fc72,_0xd948('0x63')),'role':_0xd948('0x64')},'attributes':['id','name',_0xd948('0x65'),'updatedAt','createdAt']});}})[_0xd948('0x2a')](function(_0xd49391){if(_0xd49391){return{'count':_0xd49391[_0xd948('0x49')],'rows':_[_0xd948('0x33')](_0xd49391['rows'],function(_0x5a4932){return{'membername':_0x5a4932[_0xd948('0x30')],'UserId':_0x5a4932['id'],'queue_name':_0x259494['name'],'MailQueueId':_0x259494['id'],'interface':util['format']('%s/%s',_0xd948('0x66'),_0x5a4932[_0xd948('0x30')]),'penalty':0x0,'paused':_0x5a4932[_0xd948('0x65')],'createdAt':_0x5a4932['createdAt'],'updatedAt':_0x5a4932[_0xd948('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd948('0x2a')](respondWithFilteredResult(_0x4a8be4,_0x404d79))['catch'](handleError(_0x4a8be4,null));};exports[_0xd948('0x68')]=function(_0xd9133f,_0x4a77cc,_0x1bdd0a){var _0x333e47={};var _0x12d1ac={};var _0x4af8e9;var _0x3fe249;return db[_0xd948('0x34')]['findOne']({'where':{'id':_0xd9133f[_0xd948('0x50')]['id']}})[_0xd948('0x2a')](handleEntityNotFound(_0x4a77cc,null))['then'](function(_0x1229ce){if(_0x1229ce){_0x4af8e9=_0x1229ce;_0x12d1ac[_0xd948('0x3b')]=_['keys'](db[_0xd948('0x69')][_0xd948('0x35')]);_0x12d1ac[_0xd948('0x3a')]=_[_0xd948('0x39')](_0xd9133f[_0xd948('0x3a')]);_0x12d1ac[_0xd948('0x43')]=_[_0xd948('0x51')](_0x12d1ac[_0xd948('0x3b')],_0x12d1ac[_0xd948('0x3a')]);_0x333e47[_0xd948('0x3c')]=_[_0xd948('0x51')](_0x12d1ac[_0xd948('0x3b')],qs[_0xd948('0x3d')](_0xd9133f[_0xd948('0x3a')][_0xd948('0x3d')]));_0x333e47['attributes']=_0x333e47[_0xd948('0x3c')]['length']?_0x333e47['attributes']:_0x12d1ac[_0xd948('0x3b')];_0x333e47[_0xd948('0x41')]=qs[_0xd948('0x42')](_0xd9133f['query']['sort']);_0x333e47['where']=qs[_0xd948('0x43')](_[_0xd948('0x44')](_0xd9133f['query'],_0x12d1ac[_0xd948('0x43')]));if(_0xd9133f[_0xd948('0x3a')][_0xd948('0x45')]){_0x333e47['where']=_[_0xd948('0x47')](_0x333e47[_0xd948('0x46')],{'$or':_[_0xd948('0x33')](_0x333e47['attributes'],function(_0x516a26){var _0x42d025={};_0x42d025[_0x516a26]={'$like':'%'+_0xd9133f['query'][_0xd948('0x45')]+'%'};return _0x42d025;})});}_0x333e47=_[_0xd948('0x47')]({},_0x333e47,_0xd9133f[_0xd948('0x52')]);return _0x4af8e9[_0xd948('0x68')](_0x333e47);}})[_0xd948('0x2a')](function(_0x23ee4f){if(_0x23ee4f){_0x3fe249=_0x23ee4f['length'];if(!_0xd9133f[_0xd948('0x3a')][_0xd948('0x3f')](_0xd948('0x40'))){_0x333e47['limit']=qs[_0xd948('0x25')](_0xd9133f[_0xd948('0x3a')]['limit']);_0x333e47[_0xd948('0x24')]=qs['offset'](_0xd9133f[_0xd948('0x3a')][_0xd948('0x24')]);}return _0x4af8e9['getTeams'](_0x333e47);}})['then'](function(_0x267e9f){if(_0x267e9f){return _0x267e9f?{'count':_0x3fe249,'rows':_0x267e9f}:null;}})['then'](respondWithResult(_0x4a77cc,null))[_0xd948('0x4e')](handleError(_0x4a77cc,null));};exports[_0xd948('0x6a')]=function(_0x293ab3,_0x5c61ae,_0x2f11c4){var _0x2a0412=_0x293ab3[_0xd948('0x55')][_0xd948('0x6b')];return db[_0xd948('0x69')][_0xd948('0x4c')]({'where':{'id':_0x2a0412},'attributes':['id'],'include':[{'model':db[_0xd948('0x6c')],'as':'Agents','attributes':['id','name',_0xd948('0x6d'),_0xd948('0x6e'),'interface'],'raw':!![]}]})[_0xd948('0x2a')](function(_0x8d90a7){if(_0x8d90a7){var _0x33feca=_['flatMap'](_0x8d90a7,function(_0x415818){var _0x48f5cf=_0x415818['get']({'plain':!![]});return _0x48f5cf['Agents'];});return db[_0xd948('0x34')][_0xd948('0x53')]({'where':{'id':_0x293ab3[_0xd948('0x50')]['id']}})[_0xd948('0x2a')](function(_0x1bacf8){return db[_0xd948('0x6f')][_0xd948('0x70')](function(_0x3f4922){return _0x1bacf8['addTeams'](_0x2a0412,{'transaction':_0x3f4922})[_0xd948('0x2a')](function(){return BPromise[_0xd948('0x71')](_0x33feca,function(_0x3d06a3){return db[_0xd948('0x61')][_0xd948('0x72')]({'where':{'UserId':_0x3d06a3['id'],'MailQueueId':_0x293ab3[_0xd948('0x50')]['id']},'transaction':_0x3f4922});});})['then'](function(){_0x33feca[_0xd948('0x73')](function(_0x1cbc35){socket[_0xd948('0x74')](_0xd948('0x75'),{'UserId':_0x1cbc35['id'],'MailQueueId':_0x1bacf8['id']});});});});});}})[_0xd948('0x2a')](respondWithStatusCode(_0x5c61ae,null))[_0xd948('0x4e')](handleError(_0x5c61ae,null));};exports[_0xd948('0x76')]=function(_0x5502ea,_0x5beb73,_0x3a92d3){return db[_0xd948('0x69')][_0xd948('0x4c')]({'where':{'id':_0x5502ea['query'][_0xd948('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd948('0x2a')](handleEntityNotFound(_0x5beb73,null))[_0xd948('0x2a')](function(_0x545fde){var _0x97d689=_[_0xd948('0x33')](_0x545fde,'id');var _0x5b6813=[];var _0x58e5f3=[];var _0x133fce=squel[_0xd948('0x77')]();_0x133fce['field']('tq.TeamId')[_0xd948('0x78')](_0xd948('0x79'),'tq')['join'](_0xd948('0x7a'),'ut',_0xd948('0x7b'))[_0xd948('0x46')](_0xd948('0x7c'),_0x5502ea[_0xd948('0x50')]['id']);for(var _0xedcf99=0x0;_0xedcf99<_0x545fde[_0xd948('0x3e')];_0xedcf99+=0x1){let _0x46c111=_0x545fde[_0xedcf99];for(var _0x5ec92b=0x0;_0x5ec92b<_0x46c111[_0xd948('0x7d')][_0xd948('0x3e')];_0x5ec92b+=0x1){let _0x8fb580=_0x46c111[_0xd948('0x7d')][_0x5ec92b];var _0xeb78a=_0x133fce[_0xd948('0x7e')]();_0xeb78a[_0xd948('0x46')](_0xd948('0x7f'),_0x8fb580['id']);_0x58e5f3['push'](db[_0xd948('0x6f')]['query'](_0xeb78a[_0xd948('0x80')](),{'type':db[_0xd948('0x6f')][_0xd948('0x81')][_0xd948('0x82')]})[_0xd948('0x2a')](function(_0x21439f){if(_0x21439f[_0xd948('0x3e')]===0x1){return _0x8fb580['id'];}else{var _0x5cebfc=_[_0xd948('0x83')](_[_0xd948('0x33')](_0x21439f,_0xd948('0x84')),function(_0x5587a4){return _[_0xd948('0x85')](_0x97d689,_0x5587a4);});if(_0x5cebfc){return _0x8fb580['id'];}}}));}}return BPromise[_0xd948('0x86')](_0x58e5f3)[_0xd948('0x2a')](function(_0x1116f0){_0x5b6813=_(_0x5b6813)['union'](_0x1116f0)[_0xd948('0x87')]()[_0xd948('0x88')]();return db[_0xd948('0x34')][_0xd948('0x53')]({'where':{'id':_0x5502ea['params']['id']}})[_0xd948('0x2a')](function(_0x250fa0){return db[_0xd948('0x6f')][_0xd948('0x70')](function(_0x23a767){return _0x250fa0['removeTeams'](_0x5502ea[_0xd948('0x3a')]['ids'],{'transaction':_0x23a767})[_0xd948('0x2a')](function(){if(!_[_0xd948('0x89')](_0x5b6813)){return _0x250fa0['removeAgents'](_0x5b6813,{'transaction':_0x23a767});}})['then'](function(){_0x5b6813[_0xd948('0x73')](function(_0x58079a){socket['emit'](_0xd948('0x8a'),{'UserId':_0x58079a,'MailQueueId':_0x250fa0['id']});});});});});});})[_0xd948('0x2a')](respondWithStatusCode(_0x5beb73,null))[_0xd948('0x4e')](handleError(_0x5beb73,null));};exports[_0xd948('0x8b')]=function(_0x5d4467,_0x279d08,_0x38acf4){return db['MailQueue']['find']({'where':{'id':_0x5d4467[_0xd948('0x50')]['id']}})['then'](handleEntityNotFound(_0x279d08,null))['then'](function(_0x5a9ca4){if(_0x5a9ca4){return _0x5a9ca4['addAgents'](_0x5d4467[_0xd948('0x55')][_0xd948('0x6b')],_[_0xd948('0x8c')](_0x5d4467[_0xd948('0x55')],[_0xd948('0x6b'),'id'])||{})[_0xd948('0x8d')](function(_0x4acd3a){for(var _0x54e97f=0x0;_0x54e97f<_0x5d4467[_0xd948('0x55')]['ids']['length'];_0x54e97f+=0x1){socket['emit']('userMailQueue:save',{'UserId':_0x5d4467['body'][_0xd948('0x6b')][_0x54e97f],'MailQueueId':_0x5d4467[_0xd948('0x50')]['id']});}return _0x4acd3a;});}})[_0xd948('0x2a')](respondWithResult(_0x279d08,null))['catch'](handleError(_0x279d08,null));};exports[_0xd948('0x8e')]=function(_0x1a040a,_0x42cf10,_0x1d5ac3){return db[_0xd948('0x34')][_0xd948('0x53')]({'where':{'id':_0x1a040a['params']['id']}})[_0xd948('0x2a')](handleEntityNotFound(_0x42cf10,null))[_0xd948('0x2a')](function(_0x2bcd9e){if(_0x2bcd9e){return _0x2bcd9e[_0xd948('0x8e')](_0x1a040a[_0xd948('0x3a')][_0xd948('0x6b')])[_0xd948('0x2a')](function(){if(_[_0xd948('0x8f')](_0x1a040a[_0xd948('0x3a')][_0xd948('0x6b')])){for(var _0x50e153=0x0;_0x50e153<_0x1a040a[_0xd948('0x3a')][_0xd948('0x6b')][_0xd948('0x3e')];_0x50e153+=0x1){socket[_0xd948('0x74')](_0xd948('0x8a'),{'UserId':Number(_0x1a040a['query'][_0xd948('0x6b')][_0x50e153]),'MailQueueId':Number(_0x1a040a[_0xd948('0x50')]['id'])});}}else{socket[_0xd948('0x74')](_0xd948('0x8a'),{'UserId':Number(_0x1a040a['query'][_0xd948('0x6b')]),'MailQueueId':Number(_0x1a040a[_0xd948('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x42cf10,null))['catch'](handleError(_0x42cf10,null));};exports['getAgents']=function(_0x2da985,_0x194bb9,_0x3170a0){var _0x5d6834={};var _0xc0ac74={};var _0x30f52f;var _0x2be957;return db[_0xd948('0x34')][_0xd948('0x5f')]({'where':{'id':_0x2da985['params']['id']}})['then'](handleEntityNotFound(_0x194bb9,null))['then'](function(_0x437dbd){if(_0x437dbd){_0x30f52f=_0x437dbd;_0xc0ac74['model']=_[_0xd948('0x39')](db[_0xd948('0x6c')][_0xd948('0x35')]);_0xc0ac74[_0xd948('0x3a')]=_[_0xd948('0x39')](_0x2da985[_0xd948('0x3a')]);_0xc0ac74['filters']=_['intersection'](_0xc0ac74[_0xd948('0x3b')],_0xc0ac74[_0xd948('0x3a')]);_0x5d6834[_0xd948('0x3c')]=_[_0xd948('0x51')](_0xc0ac74['model'],qs[_0xd948('0x3d')](_0x2da985[_0xd948('0x3a')][_0xd948('0x3d')]));_0x5d6834[_0xd948('0x3c')]=_0x5d6834[_0xd948('0x3c')]['length']?_0x5d6834[_0xd948('0x3c')]:_0xc0ac74[_0xd948('0x3b')];_0x5d6834[_0xd948('0x41')]=qs['sort'](_0x2da985[_0xd948('0x3a')][_0xd948('0x42')]);_0x5d6834[_0xd948('0x46')]=qs['filters'](_[_0xd948('0x44')](_0x2da985['query'],_0xc0ac74[_0xd948('0x43')]));if(_0x2da985[_0xd948('0x3a')][_0xd948('0x45')]){_0x5d6834[_0xd948('0x46')]=_[_0xd948('0x47')](_0x5d6834[_0xd948('0x46')],{'$or':_['map'](_0x5d6834['attributes'],function(_0x556472){var _0xc62d0={};_0xc62d0[_0x556472]={'$like':'%'+_0x2da985[_0xd948('0x3a')][_0xd948('0x45')]+'%'};return _0xc62d0;})});}_0x5d6834=_[_0xd948('0x47')]({},_0x5d6834,_0x2da985[_0xd948('0x52')]);return _0x30f52f[_0xd948('0x90')](_0x5d6834);}})[_0xd948('0x2a')](function(_0x39733d){if(_0x39733d){_0x2be957=_0x39733d[_0xd948('0x3e')];if(!_0x2da985[_0xd948('0x3a')][_0xd948('0x3f')](_0xd948('0x40'))){_0x5d6834[_0xd948('0x25')]=qs[_0xd948('0x25')](_0x2da985['query'][_0xd948('0x25')]);_0x5d6834[_0xd948('0x24')]=qs['offset'](_0x2da985['query'][_0xd948('0x24')]);}return _0x30f52f[_0xd948('0x90')](_0x5d6834);}})[_0xd948('0x2a')](function(_0x23b203){if(_0x23b203){return _0x23b203?{'count':_0x2be957,'rows':_0x23b203}:null;}})[_0xd948('0x2a')](respondWithResult(_0x194bb9,null))[_0xd948('0x4e')](handleError(_0x194bb9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d8c794a..d2569fd 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 _0x8682=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x1ce0ff,_0x1d224c){var _0x448b56=function(_0x508338){while(--_0x508338){_0x1ce0ff['push'](_0x1ce0ff['shift']());}};_0x448b56(++_0x1d224c);}(_0x8682,0x77));var _0x2868=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8682[_0x297fd3];return _0x2af381;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x2868('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2868('0x1')](0x0);var events={'afterCreate':_0x2868('0x2'),'afterUpdate':_0x2868('0x3'),'afterDestroy':_0x2868('0x4')};function emitEvent(_0x1ad32a){return function(_0x1aecef,_0x1fdaa8,_0x42c4d9){MailQueueEvents[_0x2868('0x5')](_0x1ad32a+':'+_0x1aecef['id'],_0x1aecef);MailQueueEvents[_0x2868('0x5')](_0x1ad32a,_0x1aecef);_0x42c4d9(null);};}for(var e in events){if(events[_0x2868('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x2868('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xe0ea=['events','MailQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x3f2b46,_0x5693e5){var _0x150488=function(_0x35aebf){while(--_0x35aebf){_0x3f2b46['push'](_0x3f2b46['shift']());}};_0x150488(++_0x5693e5);}(_0xe0ea,0x1d8));var _0xae0e=function(_0x86b2a6,_0x1e60ac){_0x86b2a6=_0x86b2a6-0x0;var _0x1c6dca=_0xe0ea[_0x86b2a6];return _0x1c6dca;};'use strict';var EventEmitter=require(_0xae0e('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xae0e('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xae0e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xae0e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x21f895){return function(_0x42e800,_0x4eb1cc,_0x5138cf){MailQueueEvents[_0xae0e('0x4')](_0x21f895+':'+_0x42e800['id'],_0x42e800);MailQueueEvents[_0xae0e('0x4')](_0x21f895,_0x42e800);_0x5138cf(null);};}for(var e in events){if(events[_0xae0e('0x5')](e)){var event=events[e];MailQueue[_0xae0e('0x6')](e,emitEvent(event));}}module[_0xae0e('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 77eb978..687e34c 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 _0x1a41=['rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment'];(function(_0x1fb936,_0x4f4362){var _0x3fe701=function(_0x4fe7b5){while(--_0x4fe7b5){_0x1fb936['push'](_0x1fb936['shift']());}};_0x3fe701(++_0x4f4362);}(_0x1a41,0x1dc));var _0x11a4=function(_0x41f56a,_0x49a25b){_0x41f56a=_0x41f56a-0x0;var _0x25d410=_0x1a41[_0x41f56a];return _0x25d410;};'use strict';var _=require(_0x11a4('0x0'));var util=require(_0x11a4('0x1'));var logger=require(_0x11a4('0x2'))('api');var moment=require(_0x11a4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11a4('0x4'));var config=require(_0x11a4('0x5'));var attributes=require('./mailQueue.attributes');module[_0x11a4('0x6')]=function(_0x5c202a,_0x148c60){return _0x5c202a[_0x11a4('0x7')](_0x11a4('0x8'),attributes,{'tableName':_0x11a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc0c=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','mail_queues','lodash'];(function(_0x17856a,_0x33ff65){var _0x5af2a5=function(_0x3e5f76){while(--_0x3e5f76){_0x17856a['push'](_0x17856a['shift']());}};_0x5af2a5(++_0x33ff65);}(_0xbc0c,0x77));var _0xcbc0=function(_0x2cd0b5,_0x2f6cc4){_0x2cd0b5=_0x2cd0b5-0x0;var _0x482cb3=_0xbc0c[_0x2cd0b5];return _0x482cb3;};'use strict';var _=require(_0xcbc0('0x0'));var util=require(_0xcbc0('0x1'));var logger=require(_0xcbc0('0x2'))('api');var moment=require(_0xcbc0('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbc0('0x4'));var fs=require('fs');var path=require(_0xcbc0('0x5'));var rimraf=require(_0xcbc0('0x6'));var config=require(_0xcbc0('0x7'));var attributes=require(_0xcbc0('0x8'));module[_0xcbc0('0x9')]=function(_0xf15e08,_0x21dd11){return _0xf15e08[_0xcbc0('0xa')]('MailQueue',attributes,{'tableName':_0xcbc0('0xb'),'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 78e74d9..f1c2a28 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 _0xa15a=['error','code','message','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model','map','ShowMailQueue','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x173204,_0x50c175){var _0x39e671=function(_0x36eef8){while(--_0x36eef8){_0x173204['push'](_0x173204['shift']());}};_0x39e671(++_0x50c175);}(_0xa15a,0x142));var _0xaa15=function(_0xe4c784,_0x3cbb87){_0xe4c784=_0xe4c784-0x0;var _0x1bc002=_0xa15a[_0xe4c784];return _0x1bc002;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa15('0x0'));var BPromise=require(_0xaa15('0x1'));var rs=require(_0xaa15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa15('0x3'))['db'];var utils=require(_0xaa15('0x4'));var logger=require(_0xaa15('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaa15('0x6'));var client=jayson[_0xaa15('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xaa15('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaa15('0x9'))[_0xaa15('0xa')](socket);function respondWithRpcPromise(_0xfa04eb,_0x1ef773,_0x556d01){return new BPromise(function(_0x4be2dd,_0x17e7d0){return client[_0xaa15('0xb')](_0xfa04eb,_0x556d01)[_0xaa15('0xc')](function(_0x464b7){logger[_0xaa15('0xd')](_0xaa15('0xe'),_0x1ef773,_0xaa15('0xf'));logger[_0xaa15('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x1ef773,_0xaa15('0xf'),JSON[_0xaa15('0x11')](_0x464b7));if(_0x464b7[_0xaa15('0x12')]){if(_0x464b7[_0xaa15('0x12')][_0xaa15('0x13')]===0x1f4){logger['error'](_0xaa15('0xe'),_0x1ef773,_0x464b7[_0xaa15('0x12')][_0xaa15('0x14')]);return _0x17e7d0(_0x464b7[_0xaa15('0x12')]['message']);}logger[_0xaa15('0x12')](_0xaa15('0xe'),_0x1ef773,_0x464b7['error'][_0xaa15('0x14')]);return _0x4be2dd(_0x464b7[_0xaa15('0x12')][_0xaa15('0x14')]);}else{logger[_0xaa15('0xd')]('MailQueue,\x20%s,\x20%s',_0x1ef773,_0xaa15('0xf'));_0x4be2dd(_0x464b7['result']['message']);}})[_0xaa15('0x15')](function(_0x195658){logger[_0xaa15('0x12')]('MailQueue,\x20%s,\x20%s',_0x1ef773,_0x195658);_0x17e7d0(_0x195658);});});}exports[_0xaa15('0x16')]=function(_0x282e8c){var _0x3ab851=this;return new Promise(function(_0x3692b6,_0x5ad43d){return db[_0xaa15('0x17')]['findAll']({'raw':_0x282e8c[_0xaa15('0x18')]?_0x282e8c[_0xaa15('0x18')][_0xaa15('0x19')]===undefined?!![]:![]:!![],'where':_0x282e8c[_0xaa15('0x18')]?_0x282e8c['options'][_0xaa15('0x1a')]||null:null,'attributes':_0x282e8c[_0xaa15('0x18')]?_0x282e8c[_0xaa15('0x18')][_0xaa15('0x1b')]||null:null,'limit':_0x282e8c[_0xaa15('0x18')]?_0x282e8c['options'][_0xaa15('0x1c')]||null:null,'include':_0x282e8c[_0xaa15('0x18')]?_0x282e8c['options'][_0xaa15('0x1d')]?_['map'](_0x282e8c[_0xaa15('0x18')]['include'],function(_0x5aa836){return{'model':db[_0x5aa836[_0xaa15('0x1e')]],'as':_0x5aa836['as'],'attributes':_0x5aa836[_0xaa15('0x1b')],'include':_0x5aa836['include']?_[_0xaa15('0x1f')](_0x5aa836[_0xaa15('0x1d')],function(_0x190572){return{'model':db[_0x190572[_0xaa15('0x1e')]],'as':_0x190572['as'],'attributes':_0x190572['attributes'],'include':_0x190572['include']?_['map'](_0x190572[_0xaa15('0x1d')],function(_0x5c35df){return{'model':db[_0x5c35df['model']],'as':_0x5c35df['as'],'attributes':_0x5c35df[_0xaa15('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaa15('0xc')](function(_0x32e190){logger[_0xaa15('0xd')](_0xaa15('0x16'),_0x282e8c);logger['debug']('GetMailQueue',_0x282e8c,JSON[_0xaa15('0x11')](_0x32e190));_0x3692b6(_0x32e190);})[_0xaa15('0x15')](function(_0x1050e4){logger[_0xaa15('0x12')](_0xaa15('0x16'),_0x1050e4[_0xaa15('0x14')],_0x282e8c);_0x5ad43d(_0x3ab851[_0xaa15('0x12')](0x1f4,_0x1050e4['message']));});});};exports[_0xaa15('0x20')]=function(_0x3c41b5){var _0x26b75b=this;return new Promise(function(_0x57f72e,_0x2b1262){return db[_0xaa15('0x17')][_0xaa15('0x21')]({'raw':_0x3c41b5[_0xaa15('0x18')]?_0x3c41b5[_0xaa15('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3c41b5[_0xaa15('0x18')]?_0x3c41b5[_0xaa15('0x18')][_0xaa15('0x1a')]||null:null,'attributes':_0x3c41b5[_0xaa15('0x18')]?_0x3c41b5[_0xaa15('0x18')][_0xaa15('0x1b')]||null:null,'include':_0x3c41b5[_0xaa15('0x18')]?_0x3c41b5[_0xaa15('0x18')][_0xaa15('0x1d')]?_[_0xaa15('0x1f')](_0x3c41b5[_0xaa15('0x18')][_0xaa15('0x1d')],function(_0x5b8bab){return{'model':db[_0x5b8bab[_0xaa15('0x1e')]],'as':_0x5b8bab['as'],'attributes':_0x5b8bab[_0xaa15('0x1b')],'include':_0x5b8bab[_0xaa15('0x1d')]?_[_0xaa15('0x1f')](_0x5b8bab[_0xaa15('0x1d')],function(_0x34325c){return{'model':db[_0x34325c['model']],'as':_0x34325c['as'],'attributes':_0x34325c['attributes'],'include':_0x34325c[_0xaa15('0x1d')]?_[_0xaa15('0x1f')](_0x34325c[_0xaa15('0x1d')],function(_0x5af559){return{'model':db[_0x5af559[_0xaa15('0x1e')]],'as':_0x5af559['as'],'attributes':_0x5af559[_0xaa15('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaa15('0xc')](function(_0x2b1134){logger[_0xaa15('0xd')](_0xaa15('0x20'),_0x3c41b5);logger[_0xaa15('0x10')](_0xaa15('0x20'),_0x3c41b5,JSON[_0xaa15('0x11')](_0x2b1134));_0x57f72e(_0x2b1134);})['catch'](function(_0xd3b2eb){logger[_0xaa15('0x12')](_0xaa15('0x20'),_0xd3b2eb[_0xaa15('0x14')],_0x3c41b5);_0x2b1262(_0x26b75b['error'](0x1f4,_0xd3b2eb[_0xaa15('0x14')]));});});}; \ No newline at end of file +var _0xcddb=['attributes','limit','model','include','map','debug','ShowMailQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailQueue','MailQueue','options','where'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xcddb,0xf2));var _0xbcdd=function(_0x42ef15,_0x1f0628){_0x42ef15=_0x42ef15-0x0;var _0x307503=_0xcddb[_0x42ef15];return _0x307503;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var moment=require('moment');var BPromise=require(_0xbcdd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcdd('0x3'));var db=require(_0xbcdd('0x4'))['db'];var utils=require(_0xbcdd('0x5'));var logger=require(_0xbcdd('0x6'))(_0xbcdd('0x7'));var config=require('../../config/environment');var jayson=require(_0xbcdd('0x8'));var client=jayson[_0xbcdd('0x9')][_0xbcdd('0xa')]({'port':0x232a});config[_0xbcdd('0xb')]=_['defaults'](config[_0xbcdd('0xb')],{'host':_0xbcdd('0xc'),'port':0x18eb});var socket=require(_0xbcdd('0xd'))(new Redis(config['redis']));require(_0xbcdd('0xe'))[_0xbcdd('0xf')](socket);function respondWithRpcPromise(_0x4e903a,_0x3b23cb,_0x39bbf6){return new BPromise(function(_0x35f219,_0x5c0b5f){return client[_0xbcdd('0x10')](_0x4e903a,_0x39bbf6)[_0xbcdd('0x11')](function(_0x2a5d95){logger[_0xbcdd('0x12')](_0xbcdd('0x13'),_0x3b23cb,'request\x20sent');logger['debug'](_0xbcdd('0x14'),_0x3b23cb,_0xbcdd('0x15'),JSON[_0xbcdd('0x16')](_0x2a5d95));if(_0x2a5d95[_0xbcdd('0x17')]){if(_0x2a5d95['error']['code']===0x1f4){logger[_0xbcdd('0x17')]('MailQueue,\x20%s,\x20%s',_0x3b23cb,_0x2a5d95['error'][_0xbcdd('0x18')]);return _0x5c0b5f(_0x2a5d95[_0xbcdd('0x17')][_0xbcdd('0x18')]);}logger[_0xbcdd('0x17')](_0xbcdd('0x13'),_0x3b23cb,_0x2a5d95[_0xbcdd('0x17')][_0xbcdd('0x18')]);return _0x35f219(_0x2a5d95[_0xbcdd('0x17')]['message']);}else{logger['info'](_0xbcdd('0x13'),_0x3b23cb,_0xbcdd('0x15'));_0x35f219(_0x2a5d95[_0xbcdd('0x19')][_0xbcdd('0x18')]);}})[_0xbcdd('0x1a')](function(_0x41bac8){logger[_0xbcdd('0x17')](_0xbcdd('0x13'),_0x3b23cb,_0x41bac8);_0x5c0b5f(_0x41bac8);});});}exports[_0xbcdd('0x1b')]=function(_0x50cfc0){var _0x312ca4=this;return new Promise(function(_0x5c194a,_0x27e5fa){return db[_0xbcdd('0x1c')]['findAll']({'raw':_0x50cfc0[_0xbcdd('0x1d')]?_0x50cfc0[_0xbcdd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x50cfc0[_0xbcdd('0x1d')]?_0x50cfc0[_0xbcdd('0x1d')][_0xbcdd('0x1e')]||null:null,'attributes':_0x50cfc0[_0xbcdd('0x1d')]?_0x50cfc0[_0xbcdd('0x1d')][_0xbcdd('0x1f')]||null:null,'limit':_0x50cfc0[_0xbcdd('0x1d')]?_0x50cfc0['options'][_0xbcdd('0x20')]||null:null,'include':_0x50cfc0[_0xbcdd('0x1d')]?_0x50cfc0[_0xbcdd('0x1d')]['include']?_['map'](_0x50cfc0['options']['include'],function(_0x52e44b){return{'model':db[_0x52e44b[_0xbcdd('0x21')]],'as':_0x52e44b['as'],'attributes':_0x52e44b[_0xbcdd('0x1f')],'include':_0x52e44b['include']?_['map'](_0x52e44b[_0xbcdd('0x22')],function(_0xffc147){return{'model':db[_0xffc147[_0xbcdd('0x21')]],'as':_0xffc147['as'],'attributes':_0xffc147[_0xbcdd('0x1f')],'include':_0xffc147[_0xbcdd('0x22')]?_[_0xbcdd('0x23')](_0xffc147[_0xbcdd('0x22')],function(_0x2fcad4){return{'model':db[_0x2fcad4[_0xbcdd('0x21')]],'as':_0x2fcad4['as'],'attributes':_0x2fcad4[_0xbcdd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbcdd('0x11')](function(_0xa1452e){logger['info'](_0xbcdd('0x1b'),_0x50cfc0);logger[_0xbcdd('0x24')](_0xbcdd('0x1b'),_0x50cfc0,JSON[_0xbcdd('0x16')](_0xa1452e));_0x5c194a(_0xa1452e);})['catch'](function(_0x240162){logger['error'](_0xbcdd('0x1b'),_0x240162[_0xbcdd('0x18')],_0x50cfc0);_0x27e5fa(_0x312ca4[_0xbcdd('0x17')](0x1f4,_0x240162[_0xbcdd('0x18')]));});});};exports[_0xbcdd('0x25')]=function(_0x55d453){var _0x90a442=this;return new Promise(function(_0x3f5133,_0x49bff6){return db[_0xbcdd('0x1c')][_0xbcdd('0x26')]({'raw':_0x55d453[_0xbcdd('0x1d')]?_0x55d453[_0xbcdd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x55d453[_0xbcdd('0x1d')]?_0x55d453[_0xbcdd('0x1d')][_0xbcdd('0x1e')]||null:null,'attributes':_0x55d453[_0xbcdd('0x1d')]?_0x55d453[_0xbcdd('0x1d')][_0xbcdd('0x1f')]||null:null,'include':_0x55d453[_0xbcdd('0x1d')]?_0x55d453[_0xbcdd('0x1d')][_0xbcdd('0x22')]?_[_0xbcdd('0x23')](_0x55d453[_0xbcdd('0x1d')][_0xbcdd('0x22')],function(_0x5a8b54){return{'model':db[_0x5a8b54[_0xbcdd('0x21')]],'as':_0x5a8b54['as'],'attributes':_0x5a8b54[_0xbcdd('0x1f')],'include':_0x5a8b54[_0xbcdd('0x22')]?_[_0xbcdd('0x23')](_0x5a8b54[_0xbcdd('0x22')],function(_0x8e5a7f){return{'model':db[_0x8e5a7f['model']],'as':_0x8e5a7f['as'],'attributes':_0x8e5a7f['attributes'],'include':_0x8e5a7f[_0xbcdd('0x22')]?_['map'](_0x8e5a7f[_0xbcdd('0x22')],function(_0xb04861){return{'model':db[_0xb04861[_0xbcdd('0x21')]],'as':_0xb04861['as'],'attributes':_0xb04861['attributes']};}):[]};}):[]};}):[]:[]})[_0xbcdd('0x11')](function(_0x3adc7c){logger[_0xbcdd('0x12')](_0xbcdd('0x25'),_0x55d453);logger[_0xbcdd('0x24')]('ShowMailQueue',_0x55d453,JSON['stringify'](_0x3adc7c));_0x3f5133(_0x3adc7c);})[_0xbcdd('0x1a')](function(_0x54825b){logger[_0xbcdd('0x17')]('ShowMailQueue',_0x54825b[_0xbcdd('0x18')],_0x55d453);_0x49bff6(_0x90a442['error'](0x1f4,_0x54825b[_0xbcdd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8e7a345..9b54cb6 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 _0x861e=['remove','update','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x861e,0x8a));var _0xe861=function(_0x455123,_0x20e8e9){_0x455123=_0x455123-0x0;var _0x3feded=_0x861e[_0x455123];return _0x3feded;};'use strict';var MailQueueEvents=require(_0xe861('0x0'));var events=[_0xe861('0x1'),_0xe861('0x2'),_0xe861('0x3')];function createListener(_0x4969ba,_0x257376){return function(_0x5e54ca){_0x257376['emit'](_0x4969ba,_0x5e54ca);};}function removeListener(_0x48df73,_0x7aff14){return function(){MailQueueEvents['removeListener'](_0x48df73,_0x7aff14);};}exports[_0xe861('0x4')]=function(_0x14b85d){for(var _0x46e2c7=0x0,_0x1cfd22=events[_0xe861('0x5')];_0x46e2c7<_0x1cfd22;_0x46e2c7++){var _0x104d2f=events[_0x46e2c7];var _0x2b8224=createListener(_0xe861('0x6')+_0x104d2f,_0x14b85d);MailQueueEvents['on'](_0x104d2f,_0x2b8224);}}; \ No newline at end of file +var _0xbc78=['length','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x4bbcc2,_0xa345ce){var _0x1cbc6a=function(_0x44a48e){while(--_0x44a48e){_0x4bbcc2['push'](_0x4bbcc2['shift']());}};_0x1cbc6a(++_0xa345ce);}(_0xbc78,0x78));var _0x8bc7=function(_0xfd1d77,_0x380480){_0xfd1d77=_0xfd1d77-0x0;var _0x3fcae9=_0xbc78[_0xfd1d77];return _0x3fcae9;};'use strict';var MailQueueEvents=require(_0x8bc7('0x0'));var events=[_0x8bc7('0x1'),_0x8bc7('0x2'),_0x8bc7('0x3')];function createListener(_0x303cb5,_0x210140){return function(_0x3aa408){_0x210140[_0x8bc7('0x4')](_0x303cb5,_0x3aa408);};}function removeListener(_0x17eb60,_0x13032a){return function(){MailQueueEvents[_0x8bc7('0x5')](_0x17eb60,_0x13032a);};}exports['register']=function(_0x5ee7f5){for(var _0x3e603c=0x0,_0x2e47a7=events[_0x8bc7('0x6')];_0x3e603c<_0x2e47a7;_0x3e603c++){var _0x3d2e2b=events[_0x3e603c];var _0x4b7681=createListener('mailQueue:'+_0x3d2e2b,_0x5ee7f5);MailQueueEvents['on'](_0x3d2e2b,_0x4b7681);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ee2bbe2..3fffe88 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 _0x3fa7=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','destroy'];(function(_0x1b6009,_0x169e55){var _0x43e361=function(_0x4d4ceb){while(--_0x4d4ceb){_0x1b6009['push'](_0x1b6009['shift']());}};_0x43e361(++_0x169e55);}(_0x3fa7,0x151));var _0x73fa=function(_0x1cb973,_0x5e1645){_0x1cb973=_0x1cb973-0x0;var _0x564e7c=_0x3fa7[_0x1cb973];return _0x564e7c;};'use strict';var multer=require(_0x73fa('0x0'));var util=require('util');var path=require(_0x73fa('0x1'));var timeout=require(_0x73fa('0x2'));var express=require('express');var router=express[_0x73fa('0x3')]();var auth=require(_0x73fa('0x4'));var interaction=require(_0x73fa('0x5'));var config=require(_0x73fa('0x6'));var controller=require(_0x73fa('0x7'));router[_0x73fa('0x8')]('/',auth[_0x73fa('0x9')](),controller[_0x73fa('0xa')]);router[_0x73fa('0x8')](_0x73fa('0xb'),auth[_0x73fa('0x9')](),controller[_0x73fa('0xc')]);router[_0x73fa('0x8')]('/:id',auth[_0x73fa('0x9')](),controller[_0x73fa('0xd')]);router[_0x73fa('0xe')]('/',auth['isAuthenticated'](),controller[_0x73fa('0xf')]);router['put'](_0x73fa('0x10'),auth[_0x73fa('0x9')](),controller[_0x73fa('0x11')]);router[_0x73fa('0x12')]('/:id',auth[_0x73fa('0x9')](),controller[_0x73fa('0x13')]);module[_0x73fa('0x14')]=router; \ No newline at end of file +var _0xd8b3=['Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xfdf2ba,_0x55170f){var _0x4b13df=function(_0x3a202e){while(--_0x3a202e){_0xfdf2ba['push'](_0xfdf2ba['shift']());}};_0x4b13df(++_0x55170f);}(_0xd8b3,0x80));var _0x3d8b=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0xd8b3[_0x326e79];return _0x37eb89;};'use strict';var multer=require(_0x3d8b('0x0'));var util=require(_0x3d8b('0x1'));var path=require(_0x3d8b('0x2'));var timeout=require(_0x3d8b('0x3'));var express=require(_0x3d8b('0x4'));var router=express[_0x3d8b('0x5')]();var auth=require(_0x3d8b('0x6'));var interaction=require(_0x3d8b('0x7'));var config=require('../../config/environment');var controller=require(_0x3d8b('0x8'));router[_0x3d8b('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d8b('0xa')]);router[_0x3d8b('0x9')](_0x3d8b('0xb'),auth['isAuthenticated'](),controller[_0x3d8b('0xc')]);router[_0x3d8b('0x9')](_0x3d8b('0xd'),auth[_0x3d8b('0xe')](),controller['show']);router['post']('/',auth[_0x3d8b('0xe')](),controller[_0x3d8b('0xf')]);router[_0x3d8b('0x10')](_0x3d8b('0xd'),auth[_0x3d8b('0xe')](),controller['update']);router['delete'](_0x3d8b('0xd'),auth[_0x3d8b('0xe')](),controller[_0x3d8b('0x11')]);module[_0x3d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 6b56290..de848ef 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 _0xb811=['moment','sequelize','exports','STRING','DATE'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xb811,0x1d1));var _0x1b81=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb811[_0x5d6456];return _0x4d66c1;};'use strict';var moment=require(_0x1b81('0x0'));var Sequelize=require(_0x1b81('0x1'));module[_0x1b81('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1b81('0x3')]},'joinAt':{'type':Sequelize[_0x1b81('0x4')]},'leaveAt':{'type':Sequelize[_0x1b81('0x4')]},'acceptAt':{'type':Sequelize[_0x1b81('0x4')]},'exitAt':{'type':Sequelize[_0x1b81('0x4')]},'reason':{'type':Sequelize[_0x1b81('0x3')]}}; \ No newline at end of file +var _0xef81=['sequelize','STRING','DATE'];(function(_0x5a7fc6,_0x2836c7){var _0x4b97d9=function(_0x1e71e7){while(--_0x1e71e7){_0x5a7fc6['push'](_0x5a7fc6['shift']());}};_0x4b97d9(++_0x2836c7);}(_0xef81,0x1aa));var _0x1ef8=function(_0x136b54,_0x5f157e){_0x136b54=_0x136b54-0x0;var _0x143799=_0xef81[_0x136b54];return _0x143799;};'use strict';var moment=require('moment');var Sequelize=require(_0x1ef8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1ef8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1ef8('0x1')]},'joinAt':{'type':Sequelize[_0x1ef8('0x2')]},'leaveAt':{'type':Sequelize[_0x1ef8('0x2')]},'acceptAt':{'type':Sequelize[_0x1ef8('0x2')]},'exitAt':{'type':Sequelize[_0x1ef8('0x2')]},'reason':{'type':Sequelize[_0x1ef8('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a860f06..c0ac4c3 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 _0x3e74=['save','update','then','destroy','stack','name','send','index','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','count','offset','status','set','Content-Range','json','apply','reject'];(function(_0x27ba82,_0x1f98e7){var _0x319777=function(_0x3d4ff7){while(--_0x3d4ff7){_0x27ba82['push'](_0x27ba82['shift']());}};_0x319777(++_0x1f98e7);}(_0x3e74,0x175));var _0x43e7=function(_0x3338d6,_0x6e5de3){_0x3338d6=_0x3338d6-0x0;var _0x53aa64=_0x3e74[_0x3338d6];return _0x53aa64;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb206,_0xc960ea){_0xc960ea=_0xc960ea||0xcc;return function(_0x2718d3){if(_0x2718d3){return _0x3eb206[_0x43e7('0x14')](_0xc960ea);}return _0x3eb206['status'](_0xc960ea)['end']();};}function respondWithResult(_0x2fcb36,_0x21fdd3){_0x21fdd3=_0x21fdd3||0xc8;return function(_0x44b0bd){if(_0x44b0bd){return _0x2fcb36['status'](_0x21fdd3)['json'](_0x44b0bd);}};}function respondWithFilteredResult(_0x16849c,_0x14c146){return function(_0x203378){if(_0x203378){var _0x328445=_0x203378[_0x43e7('0x15')],_0x4de324=_0x14c146[_0x43e7('0x16')],_0x5c4eaa=_0x14c146['offset']+_0x14c146['limit'],_0xdf16c;if(_0x5c4eaa>=_0x328445){_0x5c4eaa=_0x328445;_0xdf16c=0xc8;}else{_0xdf16c=0xce;}_0x16849c[_0x43e7('0x17')](_0xdf16c);return _0x16849c[_0x43e7('0x18')](_0x43e7('0x19'),_0x4de324+'-'+_0x5c4eaa+'/'+_0x328445)[_0x43e7('0x1a')](_0x203378);}return null;};}function patchUpdates(_0x3776f5){return function(_0x1f24fb){try{jsonpatch[_0x43e7('0x1b')](_0x1f24fb,_0x3776f5,!![]);}catch(_0x1441ef){return BPromise[_0x43e7('0x1c')](_0x1441ef);}return _0x1f24fb[_0x43e7('0x1d')]();};}function saveUpdates(_0x191dd5,_0x177ee1){return function(_0x4b5d64){if(_0x4b5d64){return _0x4b5d64[_0x43e7('0x1e')](_0x191dd5)[_0x43e7('0x1f')](function(_0x4b386b){return _0x4b386b;});}return null;};}function removeEntity(_0x2898b5,_0x3e281e){return function(_0x3945bb){if(_0x3945bb){return _0x3945bb[_0x43e7('0x20')]()[_0x43e7('0x1f')](function(){_0x2898b5[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454359,_0x4eea52){return function(_0x4c9df3){if(!_0x4c9df3){_0x454359[_0x43e7('0x14')](0x194);}return _0x4c9df3;};}function handleError(_0x43f4ff,_0x4b2b9f){_0x4b2b9f=_0x4b2b9f||0x1f4;return function(_0x1f0673){logger['error'](_0x1f0673[_0x43e7('0x21')]);if(_0x1f0673['name']){delete _0x1f0673[_0x43e7('0x22')];}_0x43f4ff[_0x43e7('0x17')](_0x4b2b9f)[_0x43e7('0x23')](_0x1f0673);};}exports[_0x43e7('0x24')]=function(_0x51f4d7,_0x52b7b3){var _0x805b54={},_0x501551={},_0x2dd5f={'count':0x0,'rows':[]};var _0x40dc8f=_[_0x43e7('0x25')](db[_0x43e7('0x26')]['rawAttributes'],function(_0x33a1a5){return{'name':_0x33a1a5[_0x43e7('0x27')],'type':_0x33a1a5[_0x43e7('0x28')][_0x43e7('0x29')]};});_0x501551[_0x43e7('0x2a')]=_[_0x43e7('0x25')](_0x40dc8f,_0x43e7('0x22'));_0x501551[_0x43e7('0x2b')]=_[_0x43e7('0x2c')](_0x51f4d7[_0x43e7('0x2b')]);_0x501551[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],_0x501551[_0x43e7('0x2b')]);_0x805b54['attributes']=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x2f')]));_0x805b54['attributes']=_0x805b54[_0x43e7('0x30')][_0x43e7('0x31')]?_0x805b54[_0x43e7('0x30')]:_0x501551[_0x43e7('0x2a')];if(!_0x51f4d7['query']['hasOwnProperty']('nolimit')){_0x805b54[_0x43e7('0x32')]=qs[_0x43e7('0x32')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x32')]);_0x805b54[_0x43e7('0x16')]=qs[_0x43e7('0x16')](_0x51f4d7['query']['offset']);}_0x805b54['order']=qs['sort'](_0x51f4d7['query']['sort']);_0x805b54['where']=qs[_0x43e7('0x2d')](_['pick'](_0x51f4d7[_0x43e7('0x2b')],_0x501551[_0x43e7('0x2d')]),_0x40dc8f);if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]){_0x805b54[_0x43e7('0x34')]=_[_0x43e7('0x35')](_0x805b54[_0x43e7('0x34')],{'$or':_['map'](_0x40dc8f,function(_0x5332d9){if(_0x5332d9['type']!==_0x43e7('0x36')){var _0xfe70e9={};_0xfe70e9[_0x5332d9[_0x43e7('0x22')]]={'$like':'%'+_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]+'%'};return _0xfe70e9;}})});}_0x805b54=_[_0x43e7('0x35')]({},_0x805b54,_0x51f4d7[_0x43e7('0x37')]);var _0x2ffd43={'where':_0x805b54['where']};return db[_0x43e7('0x26')][_0x43e7('0x15')](_0x2ffd43)['then'](function(_0x2d54c1){_0x2dd5f['count']=_0x2d54c1;if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x38')]){_0x805b54[_0x43e7('0x39')]=[{'all':!![]}];}return db[_0x43e7('0x26')][_0x43e7('0x3a')](_0x805b54);})[_0x43e7('0x1f')](function(_0x5e731b){_0x2dd5f['rows']=_0x5e731b;return _0x2dd5f;})[_0x43e7('0x1f')](respondWithFilteredResult(_0x52b7b3,_0x805b54))[_0x43e7('0x3b')](handleError(_0x52b7b3,null));};exports[_0x43e7('0x3c')]=function(_0xc8ffa5,_0x127d77){var _0x4a4a85={'raw':!![],'where':{'id':_0xc8ffa5[_0x43e7('0x3d')]['id']}},_0x32a451={};_0x32a451['model']=_[_0x43e7('0x2c')](db['MailQueueReport'][_0x43e7('0x3e')]);_0x32a451['query']=_[_0x43e7('0x2c')](_0xc8ffa5[_0x43e7('0x2b')]);_0x32a451[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x32a451['model'],_0x32a451['query']);_0x4a4a85[_0x43e7('0x30')]=_[_0x43e7('0x2e')](_0x32a451[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0xc8ffa5['query']['fields']));_0x4a4a85['attributes']=_0x4a4a85[_0x43e7('0x30')]['length']?_0x4a4a85[_0x43e7('0x30')]:_0x32a451['model'];if(_0xc8ffa5['query'][_0x43e7('0x38')]){_0x4a4a85['include']=[{'all':!![]}];}_0x4a4a85=_[_0x43e7('0x35')]({},_0x4a4a85,_0xc8ffa5[_0x43e7('0x37')]);return db[_0x43e7('0x26')][_0x43e7('0x3f')](_0x4a4a85)['then'](handleEntityNotFound(_0x127d77,null))[_0x43e7('0x1f')](respondWithResult(_0x127d77,null))[_0x43e7('0x3b')](handleError(_0x127d77,null));};exports[_0x43e7('0x40')]=function(_0x1fd277,_0x296dc8){return db[_0x43e7('0x26')]['create'](_0x1fd277['body'],{})[_0x43e7('0x1f')](respondWithResult(_0x296dc8,0xc9))[_0x43e7('0x3b')](handleError(_0x296dc8,null));};exports[_0x43e7('0x1e')]=function(_0x4c00a8,_0x5c1c18){if(_0x4c00a8['body']['id']){delete _0x4c00a8[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x26')]['find']({'where':{'id':_0x4c00a8[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x5c1c18,null))[_0x43e7('0x1f')](saveUpdates(_0x4c00a8['body'],null))['then'](respondWithResult(_0x5c1c18,null))['catch'](handleError(_0x5c1c18,null));};exports['destroy']=function(_0x214e7e,_0xe955fc){return db['MailQueueReport'][_0x43e7('0x3f')]({'where':{'id':_0x214e7e[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x1f')](removeEntity(_0xe955fc,null))['catch'](handleError(_0xe955fc,null));};exports[_0x43e7('0x42')]=function(_0x483f20,_0x4bebd4){return db[_0x43e7('0x26')][_0x43e7('0x42')]()[_0x43e7('0x1f')](respondWithResult(_0x4bebd4,null))[_0x43e7('0x3b')](handleError(_0x4bebd4,null));}; \ No newline at end of file +var _0xa8c4=['filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','describe','eml-format','rimraf','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','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','then','error','stack','name','send','index','MailQueueReport','rawAttributes','type','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xa8c4,0x12d));var _0x4a8c=function(_0x274e82,_0x2b3e01){_0x274e82=_0x274e82-0x0;var _0x361183=_0xa8c4[_0x274e82];return _0x361183;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4a8c('0x0'));var rimraf=require(_0x4a8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a8c('0x2'));var rp=require(_0x4a8c('0x3'));var moment=require('moment');var BPromise=require(_0x4a8c('0x4'));var Mustache=require(_0x4a8c('0x5'));var util=require(_0x4a8c('0x6'));var path=require(_0x4a8c('0x7'));var sox=require(_0x4a8c('0x8'));var csv=require(_0x4a8c('0x9'));var ejs=require(_0x4a8c('0xa'));var fs=require('fs');var _=require(_0x4a8c('0xb'));var squel=require(_0x4a8c('0xc'));var crypto=require(_0x4a8c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4a8c('0xe'));var toCsv=require(_0x4a8c('0x9'));var querystring=require(_0x4a8c('0xf'));var Papa=require(_0x4a8c('0x10'));var Redis=require(_0x4a8c('0x11'));var authService=require(_0x4a8c('0x12'));var qs=require(_0x4a8c('0x13'));var as=require(_0x4a8c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a8c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4a8c('0x16'));var db=require(_0x4a8c('0x17'))['db'];function respondWithStatusCode(_0x199127,_0xead7f8){_0xead7f8=_0xead7f8||0xcc;return function(_0x43104d){if(_0x43104d){return _0x199127[_0x4a8c('0x18')](_0xead7f8);}return _0x199127[_0x4a8c('0x19')](_0xead7f8)[_0x4a8c('0x1a')]();};}function respondWithResult(_0x41ddfa,_0x5873c3){_0x5873c3=_0x5873c3||0xc8;return function(_0x3b245e){if(_0x3b245e){return _0x41ddfa[_0x4a8c('0x19')](_0x5873c3)[_0x4a8c('0x1b')](_0x3b245e);}};}function respondWithFilteredResult(_0x809aa1,_0x28b2d1){return function(_0x2b53ab){if(_0x2b53ab){var _0x1b6428=_0x2b53ab[_0x4a8c('0x1c')],_0x6da391=_0x28b2d1['offset'],_0x53d2f6=_0x28b2d1[_0x4a8c('0x1d')]+_0x28b2d1[_0x4a8c('0x1e')],_0x2b84fb;if(_0x53d2f6>=_0x1b6428){_0x53d2f6=_0x1b6428;_0x2b84fb=0xc8;}else{_0x2b84fb=0xce;}_0x809aa1[_0x4a8c('0x19')](_0x2b84fb);return _0x809aa1[_0x4a8c('0x1f')]('Content-Range',_0x6da391+'-'+_0x53d2f6+'/'+_0x1b6428)['json'](_0x2b53ab);}return null;};}function patchUpdates(_0x3d1ccf){return function(_0x436c03){try{jsonpatch[_0x4a8c('0x20')](_0x436c03,_0x3d1ccf,!![]);}catch(_0x255cbb){return BPromise[_0x4a8c('0x21')](_0x255cbb);}return _0x436c03['save']();};}function saveUpdates(_0x11a8d5,_0x558940){return function(_0x24953a){if(_0x24953a){return _0x24953a[_0x4a8c('0x22')](_0x11a8d5)['then'](function(_0x44da5e){return _0x44da5e;});}return null;};}function removeEntity(_0x1cb460,_0x25a54f){return function(_0xfd41a9){if(_0xfd41a9){return _0xfd41a9[_0x4a8c('0x23')]()[_0x4a8c('0x24')](function(){_0x1cb460['status'](0xcc)[_0x4a8c('0x1a')]();});}};}function handleEntityNotFound(_0x29469b,_0x5937dd){return function(_0x31b910){if(!_0x31b910){_0x29469b[_0x4a8c('0x18')](0x194);}return _0x31b910;};}function handleError(_0x34ebc2,_0x3a049f){_0x3a049f=_0x3a049f||0x1f4;return function(_0x53bb24){logger[_0x4a8c('0x25')](_0x53bb24[_0x4a8c('0x26')]);if(_0x53bb24[_0x4a8c('0x27')]){delete _0x53bb24[_0x4a8c('0x27')];}_0x34ebc2[_0x4a8c('0x19')](_0x3a049f)[_0x4a8c('0x28')](_0x53bb24);};}exports[_0x4a8c('0x29')]=function(_0x56c385,_0x191496){var _0x2db997={},_0x486066={},_0x4a66c8={'count':0x0,'rows':[]};var _0x438a12=_['map'](db[_0x4a8c('0x2a')][_0x4a8c('0x2b')],function(_0x98ada4){return{'name':_0x98ada4['fieldName'],'type':_0x98ada4[_0x4a8c('0x2c')]['key']};});_0x486066['model']=_[_0x4a8c('0x2d')](_0x438a12,_0x4a8c('0x27'));_0x486066['query']=_[_0x4a8c('0x2e')](_0x56c385[_0x4a8c('0x2f')]);_0x486066[_0x4a8c('0x30')]=_[_0x4a8c('0x31')](_0x486066[_0x4a8c('0x32')],_0x486066[_0x4a8c('0x2f')]);_0x2db997[_0x4a8c('0x33')]=_[_0x4a8c('0x31')](_0x486066[_0x4a8c('0x32')],qs[_0x4a8c('0x34')](_0x56c385[_0x4a8c('0x2f')]['fields']));_0x2db997[_0x4a8c('0x33')]=_0x2db997['attributes'][_0x4a8c('0x35')]?_0x2db997[_0x4a8c('0x33')]:_0x486066['model'];if(!_0x56c385['query']['hasOwnProperty'](_0x4a8c('0x36'))){_0x2db997[_0x4a8c('0x1e')]=qs[_0x4a8c('0x1e')](_0x56c385['query'][_0x4a8c('0x1e')]);_0x2db997[_0x4a8c('0x1d')]=qs[_0x4a8c('0x1d')](_0x56c385[_0x4a8c('0x2f')][_0x4a8c('0x1d')]);}_0x2db997[_0x4a8c('0x37')]=qs[_0x4a8c('0x38')](_0x56c385[_0x4a8c('0x2f')][_0x4a8c('0x38')]);_0x2db997[_0x4a8c('0x39')]=qs[_0x4a8c('0x30')](_[_0x4a8c('0x3a')](_0x56c385[_0x4a8c('0x2f')],_0x486066['filters']),_0x438a12);if(_0x56c385['query'][_0x4a8c('0x3b')]){_0x2db997[_0x4a8c('0x39')]=_[_0x4a8c('0x3c')](_0x2db997[_0x4a8c('0x39')],{'$or':_[_0x4a8c('0x2d')](_0x438a12,function(_0x3c643){if(_0x3c643[_0x4a8c('0x2c')]!==_0x4a8c('0x3d')){var _0x4d287e={};_0x4d287e[_0x3c643[_0x4a8c('0x27')]]={'$like':'%'+_0x56c385['query']['filter']+'%'};return _0x4d287e;}})});}_0x2db997=_['merge']({},_0x2db997,_0x56c385['options']);var _0x31eb82={'where':_0x2db997['where']};return db[_0x4a8c('0x2a')][_0x4a8c('0x1c')](_0x31eb82)[_0x4a8c('0x24')](function(_0x201d71){_0x4a66c8['count']=_0x201d71;if(_0x56c385['query'][_0x4a8c('0x3e')]){_0x2db997[_0x4a8c('0x3f')]=[{'all':!![]}];}return db[_0x4a8c('0x2a')]['findAll'](_0x2db997);})['then'](function(_0x1dc2cb){_0x4a66c8['rows']=_0x1dc2cb;return _0x4a66c8;})[_0x4a8c('0x24')](respondWithFilteredResult(_0x191496,_0x2db997))[_0x4a8c('0x40')](handleError(_0x191496,null));};exports[_0x4a8c('0x41')]=function(_0x3f8cda,_0x24e80d){var _0x38028a={'raw':!![],'where':{'id':_0x3f8cda[_0x4a8c('0x42')]['id']}},_0xc4f6e2={};_0xc4f6e2[_0x4a8c('0x32')]=_['keys'](db[_0x4a8c('0x2a')]['rawAttributes']);_0xc4f6e2[_0x4a8c('0x2f')]=_[_0x4a8c('0x2e')](_0x3f8cda[_0x4a8c('0x2f')]);_0xc4f6e2[_0x4a8c('0x30')]=_[_0x4a8c('0x31')](_0xc4f6e2[_0x4a8c('0x32')],_0xc4f6e2['query']);_0x38028a['attributes']=_[_0x4a8c('0x31')](_0xc4f6e2[_0x4a8c('0x32')],qs[_0x4a8c('0x34')](_0x3f8cda[_0x4a8c('0x2f')][_0x4a8c('0x34')]));_0x38028a[_0x4a8c('0x33')]=_0x38028a[_0x4a8c('0x33')][_0x4a8c('0x35')]?_0x38028a[_0x4a8c('0x33')]:_0xc4f6e2[_0x4a8c('0x32')];if(_0x3f8cda[_0x4a8c('0x2f')][_0x4a8c('0x3e')]){_0x38028a['include']=[{'all':!![]}];}_0x38028a=_[_0x4a8c('0x3c')]({},_0x38028a,_0x3f8cda[_0x4a8c('0x43')]);return db[_0x4a8c('0x2a')][_0x4a8c('0x44')](_0x38028a)[_0x4a8c('0x24')](handleEntityNotFound(_0x24e80d,null))['then'](respondWithResult(_0x24e80d,null))[_0x4a8c('0x40')](handleError(_0x24e80d,null));};exports[_0x4a8c('0x45')]=function(_0x77fcee,_0x31f80a){return db[_0x4a8c('0x2a')][_0x4a8c('0x45')](_0x77fcee[_0x4a8c('0x46')],{})[_0x4a8c('0x24')](respondWithResult(_0x31f80a,0xc9))['catch'](handleError(_0x31f80a,null));};exports[_0x4a8c('0x22')]=function(_0x49fdb2,_0x3044fb){if(_0x49fdb2[_0x4a8c('0x46')]['id']){delete _0x49fdb2['body']['id'];}return db[_0x4a8c('0x2a')][_0x4a8c('0x44')]({'where':{'id':_0x49fdb2['params']['id']}})[_0x4a8c('0x24')](handleEntityNotFound(_0x3044fb,null))[_0x4a8c('0x24')](saveUpdates(_0x49fdb2[_0x4a8c('0x46')],null))[_0x4a8c('0x24')](respondWithResult(_0x3044fb,null))[_0x4a8c('0x40')](handleError(_0x3044fb,null));};exports['destroy']=function(_0x24bebc,_0x3df53b){return db[_0x4a8c('0x2a')][_0x4a8c('0x44')]({'where':{'id':_0x24bebc[_0x4a8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3df53b,null))[_0x4a8c('0x24')](removeEntity(_0x3df53b,null))[_0x4a8c('0x40')](handleError(_0x3df53b,null));};exports['describe']=function(_0x3e3a2e,_0x47c675){return db[_0x4a8c('0x2a')][_0x4a8c('0x47')]()[_0x4a8c('0x24')](respondWithResult(_0x47c675,null))[_0x4a8c('0x40')](handleError(_0x47c675,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 6b56b9c..076f861 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 _0xbca0=['rimraf','exports','define','uniqueid','lodash','util','bluebird','request-promise','path'];(function(_0x21fbcd,_0x1ca441){var _0x28ba13=function(_0x2aabb1){while(--_0x2aabb1){_0x21fbcd['push'](_0x21fbcd['shift']());}};_0x28ba13(++_0x1ca441);}(_0xbca0,0x8b));var _0x0bca=function(_0x5b8d97,_0x54f063){_0x5b8d97=_0x5b8d97-0x0;var _0x67bb3c=_0xbca0[_0x5b8d97];return _0x67bb3c;};'use strict';var _=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0bca('0x2'));var rp=require(_0x0bca('0x3'));var fs=require('fs');var path=require(_0x0bca('0x4'));var rimraf=require(_0x0bca('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x0bca('0x6')]=function(_0x3d1155,_0x3dab5e){return _0x3d1155[_0x0bca('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0bca('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8768=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x8768,0xa1));var _0x8876=function(_0x516da4,_0x31c037){_0x516da4=_0x516da4-0x0;var _0x2e5e42=_0x8768[_0x516da4];return _0x2e5e42;};'use strict';var _=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var logger=require(_0x8876('0x2'))(_0x8876('0x3'));var moment=require(_0x8876('0x4'));var BPromise=require(_0x8876('0x5'));var rp=require(_0x8876('0x6'));var fs=require('fs');var path=require(_0x8876('0x7'));var rimraf=require(_0x8876('0x8'));var config=require(_0x8876('0x9'));var attributes=require(_0x8876('0xa'));module[_0x8876('0xb')]=function(_0x159d68,_0x5431cb){return _0x159d68[_0x8876('0xc')](_0x8876('0xd'),attributes,{'tableName':_0x8876('0xe'),'paranoid':![],'indexes':[{'name':_0x8876('0xf'),'fields':[_0x8876('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a6b38bd..4138feb 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 _0x9536=['code','message','info','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9536,0x179));var _0x6953=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x9536[_0x2e7a43];return _0x52e9e1;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')](_0x2da771[_0x6953('0x1a')],{'raw':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![]})[_0x6953('0xc')](function(_0x2ba433){logger[_0x6953('0x15')]('CreateMailQueueReport',_0x2da771);logger[_0x6953('0xf')](_0x6953('0x17'),_0x2da771,JSON['stringify'](_0x2ba433));_0x10858a(_0x2ba433);})[_0x6953('0x16')](function(_0x40c9d1){logger[_0x6953('0x12')](_0x6953('0x17'),_0x40c9d1['message'],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x40c9d1[_0x6953('0x14')]));});});};exports[_0x6953('0x1d')]=function(_0x508ea7){var _0x495ebd=this;return new Promise(function(_0x5a4cd7,_0xc85d42){return db[_0x6953('0x18')]['update'](_0x508ea7[_0x6953('0x1a')],{'raw':_0x508ea7['options']?_0x508ea7[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x508ea7[_0x6953('0x1b')]?_0x508ea7[_0x6953('0x1b')][_0x6953('0x1e')]||null:null,'attributes':_0x508ea7[_0x6953('0x1b')]?_0x508ea7['options'][_0x6953('0x1f')]||null:null,'limit':_0x508ea7[_0x6953('0x1b')]?_0x508ea7['options'][_0x6953('0x20')]||null:null})['then'](function(_0x173b3c){logger[_0x6953('0x15')](_0x6953('0x1d'),_0x508ea7);logger['debug'](_0x6953('0x1d'),_0x508ea7,JSON[_0x6953('0x11')](_0x173b3c));_0x5a4cd7(_0x173b3c);})[_0x6953('0x16')](function(_0x47ed2f){logger[_0x6953('0x12')](_0x6953('0x1d'),_0x47ed2f['message'],_0x508ea7);_0xc85d42(_0x495ebd['error'](0x1f4,_0x47ed2f[_0x6953('0x14')]));});});}; \ No newline at end of file +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(_0x5c7055,_0x550d42){var _0x20d196=function(_0x47e15e){while(--_0x47e15e){_0x5c7055['push'](_0x5c7055['shift']());}};_0x20d196(++_0x550d42);}(_0xdb28,0x106));var _0x8db2=function(_0x1f68ff,_0x411e06){_0x1f68ff=_0x1f68ff-0x0;var _0xbbddc6=_0xdb28[_0x1f68ff];return _0xbbddc6;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 42f55cd..97ae99c 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 _0x526f=['multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x512dc7,_0x38bd31){var _0x3eb48c=function(_0x1479a6){while(--_0x1479a6){_0x512dc7['push'](_0x512dc7['shift']());}};_0x3eb48c(++_0x38bd31);}(_0x526f,0x144));var _0xf526=function(_0x3420b6,_0x41941a){_0x3420b6=_0x3420b6-0x0;var _0x2a7e0f=_0x526f[_0x3420b6];return _0x2a7e0f;};'use strict';var multer=require(_0xf526('0x0'));var util=require(_0xf526('0x1'));var path=require(_0xf526('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf526('0x3')]();var auth=require(_0xf526('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf526('0x5'));module['exports']=router; \ No newline at end of file +var _0xbd08=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbd08,0xa3));var _0x8bd0=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xbd08[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x8bd0('0x0'));var util=require('util');var path=require(_0x8bd0('0x1'));var timeout=require('connect-timeout');var express=require(_0x8bd0('0x2'));var router=express[_0x8bd0('0x3')]();var auth=require(_0x8bd0('0x4'));var interaction=require(_0x8bd0('0x5'));var config=require(_0x8bd0('0x6'));module[_0x8bd0('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b1b3bbe..fe55b1e 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 _0xae94=['BOOLEAN','username','INTEGER','INBOX','exports','STRING'];(function(_0x2871ef,_0x2e8c6e){var _0x2243d2=function(_0x14a4ce){while(--_0x14a4ce){_0x2871ef['push'](_0x2871ef['shift']());}};_0x2243d2(++_0x2e8c6e);}(_0xae94,0x1ae));var _0x4ae9=function(_0xe4e03a,_0x44070d){_0xe4e03a=_0xe4e03a-0x0;var _0x45a6de=_0xae94[_0xe4e03a];return _0x45a6de;};'use strict';var Sequelize=require('sequelize');module[_0x4ae9('0x0')]={'description':{'type':Sequelize[_0x4ae9('0x1')]},'host':{'type':Sequelize[_0x4ae9('0x1')]},'authentication':{'type':Sequelize[_0x4ae9('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4ae9('0x1')],'unique':_0x4ae9('0x3')},'password':{'type':Sequelize[_0x4ae9('0x1')]},'port':{'type':Sequelize[_0x4ae9('0x4')]},'tls':{'type':Sequelize[_0x4ae9('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4ae9('0x1')],'defaultValue':_0x4ae9('0x5')},'connTimeout':{'type':Sequelize[_0x4ae9('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x4ae9('0x1')]}}; \ No newline at end of file +var _0x0e53=['STRING','BOOLEAN','username','INTEGER'];(function(_0x567ac9,_0x43b49e){var _0x101959=function(_0x543727){while(--_0x543727){_0x567ac9['push'](_0x567ac9['shift']());}};_0x101959(++_0x43b49e);}(_0x0e53,0x14c));var _0x30e5=function(_0x13d2e9,_0xba214f){_0x13d2e9=_0x13d2e9-0x0;var _0x40b04e=_0x0e53[_0x13d2e9];return _0x40b04e;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x30e5('0x0')]},'host':{'type':Sequelize[_0x30e5('0x0')]},'authentication':{'type':Sequelize[_0x30e5('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x30e5('0x0')],'unique':_0x30e5('0x2')},'password':{'type':Sequelize[_0x30e5('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x30e5('0x0')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x30e5('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x30e5('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x30e5('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ec88251..fa5d23f 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 _0x965d=['bluebird','path','rimraf','../../config/environment','define','MailServerIn','lodash','util','api','moment'];(function(_0x364a88,_0x5d88d4){var _0x4e79df=function(_0x32f834){while(--_0x32f834){_0x364a88['push'](_0x364a88['shift']());}};_0x4e79df(++_0x5d88d4);}(_0x965d,0x1be));var _0xd965=function(_0x5b174e,_0x555426){_0x5b174e=_0x5b174e-0x0;var _0xda51d0=_0x965d[_0x5b174e];return _0xda51d0;};'use strict';var _=require(_0xd965('0x0'));var util=require(_0xd965('0x1'));var logger=require('../../config/logger')(_0xd965('0x2'));var moment=require(_0xd965('0x3'));var BPromise=require(_0xd965('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd965('0x5'));var rimraf=require(_0xd965('0x6'));var config=require(_0xd965('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x52ee27,_0x483311){return _0x52ee27[_0xd965('0x8')](_0xd965('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['moment','bluebird','request-promise','rimraf','exports','define','MailServerIn','mail_servers_in','util','../../config/logger','api'];(function(_0x39adc3,_0x5aadc7){var _0x5400dd=function(_0x31c327){while(--_0x31c327){_0x39adc3['push'](_0x39adc3['shift']());}};_0x5400dd(++_0x5aadc7);}(_0x2eb2,0x19f));var _0x22eb=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x2eb2[_0xea8947];return _0x2455e9;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index a442713..08b38c6 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 _0xac32=['options','raw','include','model','attributes','then','info','stringify','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn'];(function(_0x20bcec,_0x51a441){var _0x5146d1=function(_0x5c0566){while(--_0x5c0566){_0x20bcec['push'](_0x20bcec['shift']());}};_0x5146d1(++_0x51a441);}(_0xac32,0x19d));var _0x2ac3=function(_0x37c889,_0x3064b9){_0x37c889=_0x37c889-0x0;var _0x579d69=_0xac32[_0x37c889];return _0x579d69;};'use strict';var _=require(_0x2ac3('0x0'));var util=require('util');var moment=require(_0x2ac3('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ac3('0x2'));var fs=require('fs');var Redis=require(_0x2ac3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ac3('0x4'));var logger=require('../../config/logger')(_0x2ac3('0x5'));var config=require(_0x2ac3('0x6'));var jayson=require(_0x2ac3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19918d,_0x118131,_0x29c574){return new BPromise(function(_0xc7f6ff,_0x42920d){return client[_0x2ac3('0x8')](_0x19918d,_0x29c574)['then'](function(_0x36f5d1){logger['info'](_0x2ac3('0x9'),_0x118131,_0x2ac3('0xa'));logger[_0x2ac3('0xb')](_0x2ac3('0xc'),_0x118131,'request\x20sent',JSON['stringify'](_0x36f5d1));if(_0x36f5d1[_0x2ac3('0xd')]){if(_0x36f5d1[_0x2ac3('0xd')][_0x2ac3('0xe')]===0x1f4){logger[_0x2ac3('0xd')]('MailServerIn,\x20%s,\x20%s',_0x118131,_0x36f5d1[_0x2ac3('0xd')][_0x2ac3('0xf')]);return _0x42920d(_0x36f5d1[_0x2ac3('0xd')][_0x2ac3('0xf')]);}logger[_0x2ac3('0xd')](_0x2ac3('0x9'),_0x118131,_0x36f5d1[_0x2ac3('0xd')][_0x2ac3('0xf')]);return _0xc7f6ff(_0x36f5d1[_0x2ac3('0xd')][_0x2ac3('0xf')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x118131,_0x2ac3('0xa'));_0xc7f6ff(_0x36f5d1[_0x2ac3('0x10')][_0x2ac3('0xf')]);}})[_0x2ac3('0x11')](function(_0x25c279){logger[_0x2ac3('0xd')](_0x2ac3('0x9'),_0x118131,_0x25c279);_0x42920d(_0x25c279);});});}exports[_0x2ac3('0x12')]=function(_0x2d22ec){var _0x5eef13=this;return new Promise(function(_0x16fd04,_0x59d48d){return db['MailServerIn']['findAll']({'raw':_0x2d22ec['options']?_0x2d22ec[_0x2ac3('0x13')][_0x2ac3('0x14')]===undefined?!![]:![]:!![],'where':_0x2d22ec[_0x2ac3('0x13')]?_0x2d22ec[_0x2ac3('0x13')]['where']||null:null,'attributes':_0x2d22ec[_0x2ac3('0x13')]?_0x2d22ec[_0x2ac3('0x13')]['attributes']||null:null,'limit':_0x2d22ec[_0x2ac3('0x13')]?_0x2d22ec[_0x2ac3('0x13')]['limit']||null:null,'include':_0x2d22ec[_0x2ac3('0x13')]?_0x2d22ec[_0x2ac3('0x13')][_0x2ac3('0x15')]?_['map'](_0x2d22ec[_0x2ac3('0x13')][_0x2ac3('0x15')],function(_0x386c61){return{'model':db[_0x386c61[_0x2ac3('0x16')]],'as':_0x386c61['as'],'attributes':_0x386c61['attributes'],'include':_0x386c61[_0x2ac3('0x15')]?_['map'](_0x386c61[_0x2ac3('0x15')],function(_0x3a4562){return{'model':db[_0x3a4562['model']],'as':_0x3a4562['as'],'attributes':_0x3a4562[_0x2ac3('0x17')],'include':_0x3a4562[_0x2ac3('0x15')]?_['map'](_0x3a4562[_0x2ac3('0x15')],function(_0x4a32ba){return{'model':db[_0x4a32ba[_0x2ac3('0x16')]],'as':_0x4a32ba['as'],'attributes':_0x4a32ba[_0x2ac3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2ac3('0x18')](function(_0x26ef9d){logger[_0x2ac3('0x19')](_0x2ac3('0x12'),_0x2d22ec);logger['debug']('GetMailServerIn',_0x2d22ec,JSON[_0x2ac3('0x1a')](_0x26ef9d));_0x16fd04(_0x26ef9d);})[_0x2ac3('0x11')](function(_0x339446){logger[_0x2ac3('0xd')](_0x2ac3('0x12'),_0x339446[_0x2ac3('0xf')],_0x2d22ec);_0x59d48d(_0x5eef13[_0x2ac3('0xd')](0x1f4,_0x339446['message']));});});}; \ No newline at end of file +var _0x0041=['include','map','model','GetMailServerIn','debug','stringify','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','MailServerIn','findAll','options','attributes'];(function(_0x47fd88,_0x1e134c){var _0x1994e0=function(_0xd9d714){while(--_0xd9d714){_0x47fd88['push'](_0x47fd88['shift']());}};_0x1994e0(++_0x1e134c);}(_0x0041,0xb4));var _0x1004=function(_0x26e6e9,_0x19aefb){_0x26e6e9=_0x26e6e9-0x0;var _0xe28f87=_0x0041[_0x26e6e9];return _0xe28f87;};'use strict';var _=require('lodash');var util=require(_0x1004('0x0'));var moment=require(_0x1004('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1004('0x2'));var db=require(_0x1004('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1004('0x4'))(_0x1004('0x5'));var config=require(_0x1004('0x6'));var jayson=require(_0x1004('0x7'));var client=jayson[_0x1004('0x8')][_0x1004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4659e8,_0x35dbcc,_0x178054){return new BPromise(function(_0x3bf59d,_0xca6d22){return client[_0x1004('0xa')](_0x4659e8,_0x178054)[_0x1004('0xb')](function(_0x49339b){logger['info'](_0x1004('0xc'),_0x35dbcc,_0x1004('0xd'));logger['debug'](_0x1004('0xe'),_0x35dbcc,_0x1004('0xd'),JSON['stringify'](_0x49339b));if(_0x49339b[_0x1004('0xf')]){if(_0x49339b[_0x1004('0xf')][_0x1004('0x10')]===0x1f4){logger[_0x1004('0xf')](_0x1004('0xc'),_0x35dbcc,_0x49339b[_0x1004('0xf')][_0x1004('0x11')]);return _0xca6d22(_0x49339b[_0x1004('0xf')][_0x1004('0x11')]);}logger[_0x1004('0xf')]('MailServerIn,\x20%s,\x20%s',_0x35dbcc,_0x49339b['error'][_0x1004('0x11')]);return _0x3bf59d(_0x49339b[_0x1004('0xf')]['message']);}else{logger[_0x1004('0x12')]('MailServerIn,\x20%s,\x20%s',_0x35dbcc,_0x1004('0xd'));_0x3bf59d(_0x49339b['result'][_0x1004('0x11')]);}})['catch'](function(_0x562c0e){logger[_0x1004('0xf')]('MailServerIn,\x20%s,\x20%s',_0x35dbcc,_0x562c0e);_0xca6d22(_0x562c0e);});});}exports['GetMailServerIn']=function(_0x3e24ee){var _0x254480=this;return new Promise(function(_0x44fce4,_0x22525c){return db[_0x1004('0x13')][_0x1004('0x14')]({'raw':_0x3e24ee[_0x1004('0x15')]?_0x3e24ee[_0x1004('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3e24ee[_0x1004('0x15')]?_0x3e24ee['options']['where']||null:null,'attributes':_0x3e24ee[_0x1004('0x15')]?_0x3e24ee[_0x1004('0x15')][_0x1004('0x16')]||null:null,'limit':_0x3e24ee[_0x1004('0x15')]?_0x3e24ee['options']['limit']||null:null,'include':_0x3e24ee[_0x1004('0x15')]?_0x3e24ee[_0x1004('0x15')][_0x1004('0x17')]?_[_0x1004('0x18')](_0x3e24ee[_0x1004('0x15')][_0x1004('0x17')],function(_0x1f9300){return{'model':db[_0x1f9300[_0x1004('0x19')]],'as':_0x1f9300['as'],'attributes':_0x1f9300['attributes'],'include':_0x1f9300[_0x1004('0x17')]?_['map'](_0x1f9300['include'],function(_0x8f580c){return{'model':db[_0x8f580c[_0x1004('0x19')]],'as':_0x8f580c['as'],'attributes':_0x8f580c[_0x1004('0x16')],'include':_0x8f580c[_0x1004('0x17')]?_['map'](_0x8f580c[_0x1004('0x17')],function(_0x619977){return{'model':db[_0x619977[_0x1004('0x19')]],'as':_0x619977['as'],'attributes':_0x619977[_0x1004('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1004('0xb')](function(_0x489140){logger['info'](_0x1004('0x1a'),_0x3e24ee);logger[_0x1004('0x1b')]('GetMailServerIn',_0x3e24ee,JSON[_0x1004('0x1c')](_0x489140));_0x44fce4(_0x489140);})['catch'](function(_0x7681bc){logger['error'](_0x1004('0x1a'),_0x7681bc['message'],_0x3e24ee);_0x22525c(_0x254480[_0x1004('0xf')](0x1f4,_0x7681bc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f8debe8..5685e75 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 _0x0081=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','get','/:id','post','delete','destroy','util'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x0081,0x1c1));var _0x1008=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x0081[_0x376b45];return _0x2341b3;};'use strict';var multer=require('multer');var util=require(_0x1008('0x0'));var path=require('path');var timeout=require(_0x1008('0x1'));var express=require(_0x1008('0x2'));var router=express[_0x1008('0x3')]();var auth=require(_0x1008('0x4'));var interaction=require(_0x1008('0x5'));var config=require(_0x1008('0x6'));var controller=require(_0x1008('0x7'));router['get']('/',auth[_0x1008('0x8')](),controller[_0x1008('0x9')]);router[_0x1008('0xa')](_0x1008('0xb'),auth[_0x1008('0x8')](),controller['show']);router[_0x1008('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x1008('0x8')](),controller['update']);router[_0x1008('0xd')]('/:id',auth[_0x1008('0x8')](),controller[_0x1008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5609=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x5609,0x7c));var _0x9560=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5609[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x9560('0x0'));var util=require(_0x9560('0x1'));var path=require(_0x9560('0x2'));var timeout=require(_0x9560('0x3'));var express=require(_0x9560('0x4'));var router=express['Router']();var auth=require(_0x9560('0x5'));var interaction=require(_0x9560('0x6'));var config=require(_0x9560('0x7'));var controller=require(_0x9560('0x8'));router[_0x9560('0x9')]('/',auth[_0x9560('0xa')](),controller[_0x9560('0xb')]);router[_0x9560('0x9')](_0x9560('0xc'),auth[_0x9560('0xa')](),controller[_0x9560('0xd')]);router[_0x9560('0xe')]('/',auth[_0x9560('0xa')](),controller[_0x9560('0xf')]);router['put'](_0x9560('0xc'),auth[_0x9560('0xa')](),controller[_0x9560('0x10')]);router[_0x9560('0x11')](_0x9560('0xc'),auth[_0x9560('0xa')](),controller[_0x9560('0x12')]);module[_0x9560('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b31cb77..eaa5f81 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 _0x9536=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9536,0x179));var _0x6953=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x9536[_0x20cb20];return _0x2fcf4b;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'description':{'type':Sequelize[_0x6953('0x2')]},'host':{'type':Sequelize[_0x6953('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x6953('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x6953('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x6953('0x2')]},'authentication':{'type':Sequelize[_0x6953('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4e83=['INTEGER','sequelize','STRING'];(function(_0x5807dd,_0x41bb03){var _0x2516e9=function(_0x526ed4){while(--_0x526ed4){_0x5807dd['push'](_0x5807dd['shift']());}};_0x2516e9(++_0x41bb03);}(_0x4e83,0x1ae));var _0x34e8=function(_0x583829,_0x188b0e){_0x583829=_0x583829-0x0;var _0x34d994=_0x4e83[_0x583829];return _0x34d994;};'use strict';var Sequelize=require(_0x34e8('0x0'));module['exports']={'description':{'type':Sequelize[_0x34e8('0x1')]},'host':{'type':Sequelize[_0x34e8('0x1')]},'user':{'type':Sequelize[_0x34e8('0x1')]},'pass':{'type':Sequelize[_0x34e8('0x1')]},'port':{'type':Sequelize[_0x34e8('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7729b3d..1edca96 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 _0xd720=['end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','params','find','create','body','catch','destroy','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x15def4,_0xd7b7bb){var _0x99386=function(_0x33bfee){while(--_0x33bfee){_0x15def4['push'](_0x15def4['shift']());}};_0x99386(++_0xd7b7bb);}(_0xd720,0xba));var _0x0d72=function(_0x167fcb,_0x425957){_0x167fcb=_0x167fcb-0x0;var _0x5e616b=_0xd720[_0x167fcb];return _0x5e616b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0d72('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d72('0x1'));var rp=require(_0x0d72('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0d72('0x3'));var util=require(_0x0d72('0x4'));var path=require(_0x0d72('0x5'));var sox=require(_0x0d72('0x6'));var csv=require(_0x0d72('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0d72('0x8'));var deskjs=require(_0x0d72('0x9'));var toCsv=require(_0x0d72('0x7'));var querystring=require(_0x0d72('0xa'));var Papa=require(_0x0d72('0xb'));var Redis=require(_0x0d72('0xc'));var authService=require(_0x0d72('0xd'));var qs=require(_0x0d72('0xe'));var as=require(_0x0d72('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d72('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x0d72('0x11'));var db=require(_0x0d72('0x12'))['db'];function respondWithStatusCode(_0x4a267a,_0x5a4daa){_0x5a4daa=_0x5a4daa||0xcc;return function(_0x4b8af9){if(_0x4b8af9){return _0x4a267a[_0x0d72('0x13')](_0x5a4daa);}return _0x4a267a[_0x0d72('0x14')](_0x5a4daa)[_0x0d72('0x15')]();};}function respondWithResult(_0x2ffab2,_0x1020ad){_0x1020ad=_0x1020ad||0xc8;return function(_0x18ba3e){if(_0x18ba3e){return _0x2ffab2[_0x0d72('0x14')](_0x1020ad)[_0x0d72('0x16')](_0x18ba3e);}};}function respondWithFilteredResult(_0x282e37,_0x2c788c){return function(_0x3085fa){if(_0x3085fa){var _0x49337f=_0x3085fa[_0x0d72('0x17')],_0x26bcc3=_0x2c788c[_0x0d72('0x18')],_0x1d0ae3=_0x2c788c[_0x0d72('0x18')]+_0x2c788c[_0x0d72('0x19')],_0x1b27f0;if(_0x1d0ae3>=_0x49337f){_0x1d0ae3=_0x49337f;_0x1b27f0=0xc8;}else{_0x1b27f0=0xce;}_0x282e37['status'](_0x1b27f0);return _0x282e37[_0x0d72('0x1a')](_0x0d72('0x1b'),_0x26bcc3+'-'+_0x1d0ae3+'/'+_0x49337f)['json'](_0x3085fa);}return null;};}function patchUpdates(_0xa7714f){return function(_0x34cd3e){try{jsonpatch[_0x0d72('0x1c')](_0x34cd3e,_0xa7714f,!![]);}catch(_0x59f941){return BPromise[_0x0d72('0x1d')](_0x59f941);}return _0x34cd3e[_0x0d72('0x1e')]();};}function saveUpdates(_0x2f9735,_0x50d0fc){return function(_0x4fc2c5){if(_0x4fc2c5){return _0x4fc2c5[_0x0d72('0x1f')](_0x2f9735)[_0x0d72('0x20')](function(_0xd41f48){return _0xd41f48;});}return null;};}function removeEntity(_0x3ac156,_0x352dc1){return function(_0x3a182a){if(_0x3a182a){return _0x3a182a['destroy']()[_0x0d72('0x20')](function(){_0x3ac156['status'](0xcc)[_0x0d72('0x15')]();});}};}function handleEntityNotFound(_0x31f1de,_0x2768e4){return function(_0x37b88a){if(!_0x37b88a){_0x31f1de[_0x0d72('0x13')](0x194);}return _0x37b88a;};}function handleError(_0x2738fa,_0x4cfa39){_0x4cfa39=_0x4cfa39||0x1f4;return function(_0x380dd1){logger[_0x0d72('0x21')](_0x380dd1[_0x0d72('0x22')]);if(_0x380dd1[_0x0d72('0x23')]){delete _0x380dd1[_0x0d72('0x23')];}_0x2738fa['status'](_0x4cfa39)[_0x0d72('0x24')](_0x380dd1);};}exports['index']=function(_0x48ef6c,_0x42a535){var _0x190733={},_0xa481d1={},_0x53bc8a={'count':0x0,'rows':[]};var _0x26b50b=_[_0x0d72('0x25')](db['MailServerOut'][_0x0d72('0x26')],function(_0x4c9ac1){return{'name':_0x4c9ac1[_0x0d72('0x27')],'type':_0x4c9ac1[_0x0d72('0x28')][_0x0d72('0x29')]};});_0xa481d1['model']=_[_0x0d72('0x25')](_0x26b50b,_0x0d72('0x23'));_0xa481d1[_0x0d72('0x2a')]=_[_0x0d72('0x2b')](_0x48ef6c[_0x0d72('0x2a')]);_0xa481d1[_0x0d72('0x2c')]=_[_0x0d72('0x2d')](_0xa481d1[_0x0d72('0x2e')],_0xa481d1[_0x0d72('0x2a')]);_0x190733[_0x0d72('0x2f')]=_['intersection'](_0xa481d1['model'],qs[_0x0d72('0x30')](_0x48ef6c[_0x0d72('0x2a')]['fields']));_0x190733[_0x0d72('0x2f')]=_0x190733['attributes'][_0x0d72('0x31')]?_0x190733[_0x0d72('0x2f')]:_0xa481d1['model'];if(!_0x48ef6c[_0x0d72('0x2a')]['hasOwnProperty'](_0x0d72('0x32'))){_0x190733['limit']=qs[_0x0d72('0x19')](_0x48ef6c[_0x0d72('0x2a')][_0x0d72('0x19')]);_0x190733[_0x0d72('0x18')]=qs[_0x0d72('0x18')](_0x48ef6c[_0x0d72('0x2a')][_0x0d72('0x18')]);}_0x190733[_0x0d72('0x33')]=qs['sort'](_0x48ef6c[_0x0d72('0x2a')]['sort']);_0x190733[_0x0d72('0x34')]=qs['filters'](_[_0x0d72('0x35')](_0x48ef6c[_0x0d72('0x2a')],_0xa481d1[_0x0d72('0x2c')]),_0x26b50b);if(_0x48ef6c['query'][_0x0d72('0x36')]){_0x190733['where']=_[_0x0d72('0x37')](_0x190733[_0x0d72('0x34')],{'$or':_[_0x0d72('0x25')](_0x26b50b,function(_0x406bfb){if(_0x406bfb[_0x0d72('0x28')]!==_0x0d72('0x38')){var _0x1415c5={};_0x1415c5[_0x406bfb[_0x0d72('0x23')]]={'$like':'%'+_0x48ef6c['query']['filter']+'%'};return _0x1415c5;}})});}_0x190733=_[_0x0d72('0x37')]({},_0x190733,_0x48ef6c[_0x0d72('0x39')]);var _0x5514cd={'where':_0x190733[_0x0d72('0x34')]};return db[_0x0d72('0x3a')][_0x0d72('0x17')](_0x5514cd)['then'](function(_0x4a3e02){_0x53bc8a[_0x0d72('0x17')]=_0x4a3e02;if(_0x48ef6c['query'][_0x0d72('0x3b')]){_0x190733[_0x0d72('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0x0d72('0x3d')](_0x190733);})[_0x0d72('0x20')](function(_0x9e4ec4){_0x53bc8a[_0x0d72('0x3e')]=_0x9e4ec4;return _0x53bc8a;})['then'](respondWithFilteredResult(_0x42a535,_0x190733))['catch'](handleError(_0x42a535,null));};exports['show']=function(_0x1abeab,_0x3b8afa){var _0x2026ef={'raw':!![],'where':{'id':_0x1abeab[_0x0d72('0x3f')]['id']}},_0x312b95={};_0x312b95[_0x0d72('0x2e')]=_[_0x0d72('0x2b')](db[_0x0d72('0x3a')][_0x0d72('0x26')]);_0x312b95[_0x0d72('0x2a')]=_['keys'](_0x1abeab['query']);_0x312b95[_0x0d72('0x2c')]=_[_0x0d72('0x2d')](_0x312b95[_0x0d72('0x2e')],_0x312b95[_0x0d72('0x2a')]);_0x2026ef[_0x0d72('0x2f')]=_[_0x0d72('0x2d')](_0x312b95[_0x0d72('0x2e')],qs[_0x0d72('0x30')](_0x1abeab['query']['fields']));_0x2026ef[_0x0d72('0x2f')]=_0x2026ef[_0x0d72('0x2f')]['length']?_0x2026ef[_0x0d72('0x2f')]:_0x312b95[_0x0d72('0x2e')];if(_0x1abeab[_0x0d72('0x2a')][_0x0d72('0x3b')]){_0x2026ef[_0x0d72('0x3c')]=[{'all':!![]}];}_0x2026ef=_[_0x0d72('0x37')]({},_0x2026ef,_0x1abeab[_0x0d72('0x39')]);return db['MailServerOut'][_0x0d72('0x40')](_0x2026ef)[_0x0d72('0x20')](handleEntityNotFound(_0x3b8afa,null))[_0x0d72('0x20')](respondWithResult(_0x3b8afa,null))['catch'](handleError(_0x3b8afa,null));};exports[_0x0d72('0x41')]=function(_0x244b2a,_0x275349){return db[_0x0d72('0x3a')][_0x0d72('0x41')](_0x244b2a[_0x0d72('0x42')],{})[_0x0d72('0x20')](respondWithResult(_0x275349,0xc9))[_0x0d72('0x43')](handleError(_0x275349,null));};exports[_0x0d72('0x1f')]=function(_0x451fee,_0x1feb75){if(_0x451fee['body']['id']){delete _0x451fee[_0x0d72('0x42')]['id'];}return db[_0x0d72('0x3a')][_0x0d72('0x40')]({'where':{'id':_0x451fee['params']['id']}})['then'](handleEntityNotFound(_0x1feb75,null))[_0x0d72('0x20')](saveUpdates(_0x451fee['body'],null))['then'](respondWithResult(_0x1feb75,null))[_0x0d72('0x43')](handleError(_0x1feb75,null));};exports[_0x0d72('0x44')]=function(_0x1e19fa,_0x181e5b){return db[_0x0d72('0x3a')][_0x0d72('0x40')]({'where':{'id':_0x1e19fa[_0x0d72('0x3f')]['id']}})[_0x0d72('0x20')](handleEntityNotFound(_0x181e5b,null))['then'](removeEntity(_0x181e5b,null))[_0x0d72('0x43')](handleError(_0x181e5b,null));}; \ No newline at end of file +var _0xc737=['../../mysqldb','status','end','json','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','MailServerOut','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','catch','show','rawAttributes','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x53a7c9,_0x3f87ae){var _0x2cead0=function(_0x3af130){while(--_0x3af130){_0x53a7c9['push'](_0x53a7c9['shift']());}};_0x2cead0(++_0x3f87ae);}(_0xc737,0x10d));var _0x7c73=function(_0x3ffc19,_0x207411){_0x3ffc19=_0x3ffc19-0x0;var _0x536398=_0xc737[_0x3ffc19];return _0x536398;};'use strict';var pdf=require(_0x7c73('0x0'));var emlformat=require(_0x7c73('0x1'));var rimraf=require(_0x7c73('0x2'));var zipdir=require(_0x7c73('0x3'));var jsonpatch=require(_0x7c73('0x4'));var rp=require(_0x7c73('0x5'));var moment=require(_0x7c73('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7c73('0x7'));var util=require(_0x7c73('0x8'));var path=require('path');var sox=require(_0x7c73('0x9'));var csv=require(_0x7c73('0xa'));var ejs=require(_0x7c73('0xb'));var fs=require('fs');var _=require(_0x7c73('0xc'));var squel=require(_0x7c73('0xd'));var crypto=require(_0x7c73('0xe'));var jsforce=require(_0x7c73('0xf'));var deskjs=require(_0x7c73('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7c73('0x11'));var Papa=require('papaparse');var Redis=require(_0x7c73('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(_0x7c73('0x13'))(_0x7c73('0x14'));var utils=require(_0x7c73('0x15'));var config=require(_0x7c73('0x16'));var db=require(_0x7c73('0x17'))['db'];function respondWithStatusCode(_0x5b6ce1,_0x12713c){_0x12713c=_0x12713c||0xcc;return function(_0x259533){if(_0x259533){return _0x5b6ce1['sendStatus'](_0x12713c);}return _0x5b6ce1[_0x7c73('0x18')](_0x12713c)[_0x7c73('0x19')]();};}function respondWithResult(_0x99e982,_0x91f67e){_0x91f67e=_0x91f67e||0xc8;return function(_0x408a32){if(_0x408a32){return _0x99e982[_0x7c73('0x18')](_0x91f67e)[_0x7c73('0x1a')](_0x408a32);}};}function respondWithFilteredResult(_0x4fce55,_0xe50706){return function(_0x501fc2){if(_0x501fc2){var _0x348ac3=_0x501fc2['count'],_0x36e959=_0xe50706[_0x7c73('0x1b')],_0x19b6d6=_0xe50706['offset']+_0xe50706['limit'],_0x1c3cc3;if(_0x19b6d6>=_0x348ac3){_0x19b6d6=_0x348ac3;_0x1c3cc3=0xc8;}else{_0x1c3cc3=0xce;}_0x4fce55[_0x7c73('0x18')](_0x1c3cc3);return _0x4fce55[_0x7c73('0x1c')]('Content-Range',_0x36e959+'-'+_0x19b6d6+'/'+_0x348ac3)[_0x7c73('0x1a')](_0x501fc2);}return null;};}function patchUpdates(_0x11857d){return function(_0x2af9fa){try{jsonpatch[_0x7c73('0x1d')](_0x2af9fa,_0x11857d,!![]);}catch(_0x274932){return BPromise[_0x7c73('0x1e')](_0x274932);}return _0x2af9fa[_0x7c73('0x1f')]();};}function saveUpdates(_0x8a67ae,_0x10a28d){return function(_0xca84f3){if(_0xca84f3){return _0xca84f3[_0x7c73('0x20')](_0x8a67ae)[_0x7c73('0x21')](function(_0x1753c6){return _0x1753c6;});}return null;};}function removeEntity(_0x2d7dfa,_0x187016){return function(_0x3b2349){if(_0x3b2349){return _0x3b2349[_0x7c73('0x22')]()[_0x7c73('0x21')](function(){_0x2d7dfa[_0x7c73('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50beb6,_0x42c56c){return function(_0x49c7e1){if(!_0x49c7e1){_0x50beb6[_0x7c73('0x23')](0x194);}return _0x49c7e1;};}function handleError(_0x4854fa,_0x49dfae){_0x49dfae=_0x49dfae||0x1f4;return function(_0x4443b2){logger[_0x7c73('0x24')](_0x4443b2[_0x7c73('0x25')]);if(_0x4443b2[_0x7c73('0x26')]){delete _0x4443b2[_0x7c73('0x26')];}_0x4854fa[_0x7c73('0x18')](_0x49dfae)[_0x7c73('0x27')](_0x4443b2);};}exports['index']=function(_0x48bdc7,_0x33bc4b){var _0x33d830={},_0x2f3d2d={},_0x3e1325={'count':0x0,'rows':[]};var _0x1cb929=_['map'](db[_0x7c73('0x28')]['rawAttributes'],function(_0x5b45d2){return{'name':_0x5b45d2[_0x7c73('0x29')],'type':_0x5b45d2[_0x7c73('0x2a')][_0x7c73('0x2b')]};});_0x2f3d2d['model']=_[_0x7c73('0x2c')](_0x1cb929,_0x7c73('0x26'));_0x2f3d2d[_0x7c73('0x2d')]=_[_0x7c73('0x2e')](_0x48bdc7['query']);_0x2f3d2d['filters']=_[_0x7c73('0x2f')](_0x2f3d2d['model'],_0x2f3d2d[_0x7c73('0x2d')]);_0x33d830['attributes']=_[_0x7c73('0x2f')](_0x2f3d2d[_0x7c73('0x30')],qs[_0x7c73('0x31')](_0x48bdc7['query'][_0x7c73('0x31')]));_0x33d830[_0x7c73('0x32')]=_0x33d830[_0x7c73('0x32')][_0x7c73('0x33')]?_0x33d830['attributes']:_0x2f3d2d[_0x7c73('0x30')];if(!_0x48bdc7['query'][_0x7c73('0x34')](_0x7c73('0x35'))){_0x33d830[_0x7c73('0x36')]=qs[_0x7c73('0x36')](_0x48bdc7['query']['limit']);_0x33d830['offset']=qs[_0x7c73('0x1b')](_0x48bdc7[_0x7c73('0x2d')][_0x7c73('0x1b')]);}_0x33d830['order']=qs[_0x7c73('0x37')](_0x48bdc7['query']['sort']);_0x33d830[_0x7c73('0x38')]=qs[_0x7c73('0x39')](_[_0x7c73('0x3a')](_0x48bdc7[_0x7c73('0x2d')],_0x2f3d2d[_0x7c73('0x39')]),_0x1cb929);if(_0x48bdc7[_0x7c73('0x2d')]['filter']){_0x33d830[_0x7c73('0x38')]=_[_0x7c73('0x3b')](_0x33d830['where'],{'$or':_['map'](_0x1cb929,function(_0x1dd8da){if(_0x1dd8da[_0x7c73('0x2a')]!==_0x7c73('0x3c')){var _0xc1ace0={};_0xc1ace0[_0x1dd8da[_0x7c73('0x26')]]={'$like':'%'+_0x48bdc7['query'][_0x7c73('0x3d')]+'%'};return _0xc1ace0;}})});}_0x33d830=_[_0x7c73('0x3b')]({},_0x33d830,_0x48bdc7[_0x7c73('0x3e')]);var _0xd82bd={'where':_0x33d830[_0x7c73('0x38')]};return db[_0x7c73('0x28')][_0x7c73('0x3f')](_0xd82bd)['then'](function(_0x47ac13){_0x3e1325[_0x7c73('0x3f')]=_0x47ac13;if(_0x48bdc7[_0x7c73('0x2d')][_0x7c73('0x40')]){_0x33d830[_0x7c73('0x41')]=[{'all':!![]}];}return db[_0x7c73('0x28')]['findAll'](_0x33d830);})[_0x7c73('0x21')](function(_0x16429e){_0x3e1325['rows']=_0x16429e;return _0x3e1325;})[_0x7c73('0x21')](respondWithFilteredResult(_0x33bc4b,_0x33d830))[_0x7c73('0x42')](handleError(_0x33bc4b,null));};exports[_0x7c73('0x43')]=function(_0x51953a,_0x117248){var _0x25c8dc={'raw':!![],'where':{'id':_0x51953a['params']['id']}},_0xbcb2bc={};_0xbcb2bc[_0x7c73('0x30')]=_['keys'](db[_0x7c73('0x28')][_0x7c73('0x44')]);_0xbcb2bc[_0x7c73('0x2d')]=_[_0x7c73('0x2e')](_0x51953a['query']);_0xbcb2bc['filters']=_[_0x7c73('0x2f')](_0xbcb2bc['model'],_0xbcb2bc['query']);_0x25c8dc[_0x7c73('0x32')]=_[_0x7c73('0x2f')](_0xbcb2bc['model'],qs['fields'](_0x51953a['query'][_0x7c73('0x31')]));_0x25c8dc[_0x7c73('0x32')]=_0x25c8dc[_0x7c73('0x32')][_0x7c73('0x33')]?_0x25c8dc[_0x7c73('0x32')]:_0xbcb2bc[_0x7c73('0x30')];if(_0x51953a[_0x7c73('0x2d')][_0x7c73('0x40')]){_0x25c8dc['include']=[{'all':!![]}];}_0x25c8dc=_[_0x7c73('0x3b')]({},_0x25c8dc,_0x51953a['options']);return db['MailServerOut'][_0x7c73('0x45')](_0x25c8dc)[_0x7c73('0x21')](handleEntityNotFound(_0x117248,null))[_0x7c73('0x21')](respondWithResult(_0x117248,null))[_0x7c73('0x42')](handleError(_0x117248,null));};exports[_0x7c73('0x46')]=function(_0x4784e3,_0x3c3ae4){return db[_0x7c73('0x28')][_0x7c73('0x46')](_0x4784e3[_0x7c73('0x47')],{})['then'](respondWithResult(_0x3c3ae4,0xc9))[_0x7c73('0x42')](handleError(_0x3c3ae4,null));};exports['update']=function(_0xb6067f,_0x25cd5b){if(_0xb6067f[_0x7c73('0x47')]['id']){delete _0xb6067f[_0x7c73('0x47')]['id'];}return db[_0x7c73('0x28')][_0x7c73('0x45')]({'where':{'id':_0xb6067f[_0x7c73('0x48')]['id']}})['then'](handleEntityNotFound(_0x25cd5b,null))[_0x7c73('0x21')](saveUpdates(_0xb6067f[_0x7c73('0x47')],null))[_0x7c73('0x21')](respondWithResult(_0x25cd5b,null))['catch'](handleError(_0x25cd5b,null));};exports[_0x7c73('0x22')]=function(_0x48f10f,_0x2a9de4){return db[_0x7c73('0x28')][_0x7c73('0x45')]({'where':{'id':_0x48f10f['params']['id']}})[_0x7c73('0x21')](handleEntityNotFound(_0x2a9de4,null))[_0x7c73('0x21')](removeEntity(_0x2a9de4,null))[_0x7c73('0x42')](handleError(_0x2a9de4,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c864b28..81ff8a9 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 _0x933f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x933f,0x7a));var _0xf933=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x933f[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xf933('0x0'));var util=require(_0xf933('0x1'));var logger=require(_0xf933('0x2'))(_0xf933('0x3'));var moment=require(_0xf933('0x4'));var BPromise=require(_0xf933('0x5'));var rp=require(_0xf933('0x6'));var fs=require('fs');var path=require(_0xf933('0x7'));var rimraf=require(_0xf933('0x8'));var config=require(_0xf933('0x9'));var attributes=require(_0xf933('0xa'));module['exports']=function(_0x1b2215,_0x490a8b){return _0x1b2215[_0xf933('0xb')](_0xf933('0xc'),attributes,{'tableName':_0xf933('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1ed=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out'];(function(_0x23783b,_0x1d8ad5){var _0xeed397=function(_0xc9071e){while(--_0xc9071e){_0x23783b['push'](_0x23783b['shift']());}};_0xeed397(++_0x1d8ad5);}(_0xf1ed,0x1d9));var _0xdf1e=function(_0x57b60d,_0x1b7744){_0x57b60d=_0x57b60d-0x0;var _0x50f0b5=_0xf1ed[_0x57b60d];return _0x50f0b5;};'use strict';var _=require(_0xdf1e('0x0'));var util=require('util');var logger=require(_0xdf1e('0x1'))('api');var moment=require(_0xdf1e('0x2'));var BPromise=require(_0xdf1e('0x3'));var rp=require(_0xdf1e('0x4'));var fs=require('fs');var path=require(_0xdf1e('0x5'));var rimraf=require('rimraf');var config=require(_0xdf1e('0x6'));var attributes=require(_0xdf1e('0x7'));module[_0xdf1e('0x8')]=function(_0x46ef94,_0x9efac6){return _0x46ef94['define'](_0xdf1e('0x9'),attributes,{'tableName':_0xdf1e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 7cbe5b2..4e79699 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 _0x2d83=['request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x2d83,0xe5));var _0x32d8=function(_0x30fc82,_0x409c41){_0x30fc82=_0x30fc82-0x0;var _0x55f864=_0x2d83[_0x30fc82];return _0x55f864;};'use strict';var _=require(_0x32d8('0x0'));var util=require(_0x32d8('0x1'));var moment=require(_0x32d8('0x2'));var BPromise=require(_0x32d8('0x3'));var rs=require(_0x32d8('0x4'));var fs=require('fs');var Redis=require(_0x32d8('0x5'));var db=require(_0x32d8('0x6'))['db'];var utils=require(_0x32d8('0x7'));var logger=require(_0x32d8('0x8'))(_0x32d8('0x9'));var config=require('../../config/environment');var jayson=require(_0x32d8('0xa'));var client=jayson[_0x32d8('0xb')][_0x32d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f4dff,_0x11c0b5,_0x303e30){return new BPromise(function(_0x21f0de,_0x5dfb46){return client[_0x32d8('0xd')](_0x5f4dff,_0x303e30)[_0x32d8('0xe')](function(_0x428f96){logger[_0x32d8('0xf')](_0x32d8('0x10'),_0x11c0b5,_0x32d8('0x11'));logger[_0x32d8('0x12')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x11c0b5,_0x32d8('0x11'),JSON['stringify'](_0x428f96));if(_0x428f96[_0x32d8('0x13')]){if(_0x428f96[_0x32d8('0x13')][_0x32d8('0x14')]===0x1f4){logger[_0x32d8('0x13')]('MailServerOut,\x20%s,\x20%s',_0x11c0b5,_0x428f96[_0x32d8('0x13')][_0x32d8('0x15')]);return _0x5dfb46(_0x428f96[_0x32d8('0x13')]['message']);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x11c0b5,_0x428f96[_0x32d8('0x13')]['message']);return _0x21f0de(_0x428f96[_0x32d8('0x13')]['message']);}else{logger[_0x32d8('0xf')](_0x32d8('0x10'),_0x11c0b5,_0x32d8('0x11'));_0x21f0de(_0x428f96['result'][_0x32d8('0x15')]);}})['catch'](function(_0x9dddcb){logger[_0x32d8('0x13')](_0x32d8('0x10'),_0x11c0b5,_0x9dddcb);_0x5dfb46(_0x9dddcb);});});} \ No newline at end of file +var _0x1304=['request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerOut,\x20%s,\x20%s'];(function(_0x296a79,_0x125ec7){var _0x245e9d=function(_0x4376e2){while(--_0x4376e2){_0x296a79['push'](_0x296a79['shift']());}};_0x245e9d(++_0x125ec7);}(_0x1304,0x171));var _0x4130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1304[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4130('0x0'));var moment=require(_0x4130('0x1'));var BPromise=require(_0x4130('0x2'));var rs=require(_0x4130('0x3'));var fs=require('fs');var Redis=require(_0x4130('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4130('0x5'));var logger=require(_0x4130('0x6'))(_0x4130('0x7'));var config=require(_0x4130('0x8'));var jayson=require(_0x4130('0x9'));var client=jayson['client'][_0x4130('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b75d4,_0x2f672a,_0x1d1391){return new BPromise(function(_0x3ab341,_0x29f0d0){return client[_0x4130('0xb')](_0x2b75d4,_0x1d1391)[_0x4130('0xc')](function(_0x48dde5){logger[_0x4130('0xd')](_0x4130('0xe'),_0x2f672a,_0x4130('0xf'));logger[_0x4130('0x10')](_0x4130('0x11'),_0x2f672a,_0x4130('0xf'),JSON[_0x4130('0x12')](_0x48dde5));if(_0x48dde5[_0x4130('0x13')]){if(_0x48dde5[_0x4130('0x13')][_0x4130('0x14')]===0x1f4){logger['error'](_0x4130('0xe'),_0x2f672a,_0x48dde5[_0x4130('0x13')][_0x4130('0x15')]);return _0x29f0d0(_0x48dde5[_0x4130('0x13')]['message']);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x2f672a,_0x48dde5['error'][_0x4130('0x15')]);return _0x3ab341(_0x48dde5['error'][_0x4130('0x15')]);}else{logger['info'](_0x4130('0xe'),_0x2f672a,_0x4130('0xf'));_0x3ab341(_0x48dde5[_0x4130('0x16')][_0x4130('0x15')]);}})[_0x4130('0x17')](function(_0x35fa5a){logger[_0x4130('0x13')]('MailServerOut,\x20%s,\x20%s',_0x2f672a,_0x35fa5a);_0x29f0d0(_0x35fa5a);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a484445..663b32e 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 _0x6986=['get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x6986,0x148));var _0x6698=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0x6986[_0x260b48];return _0x3f730b;};'use strict';var multer=require(_0x6698('0x0'));var util=require(_0x6698('0x1'));var path=require('path');var timeout=require(_0x6698('0x2'));var express=require(_0x6698('0x3'));var router=express[_0x6698('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6698('0x5'));var config=require(_0x6698('0x6'));var controller=require(_0x6698('0x7'));router[_0x6698('0x8')]('/',auth[_0x6698('0x9')](),controller[_0x6698('0xa')]);router[_0x6698('0x8')](_0x6698('0xb'),auth['isAuthenticated'](),controller[_0x6698('0xc')]);router['get']('/:id',auth[_0x6698('0x9')](),controller[_0x6698('0xd')]);router[_0x6698('0xe')]('/',auth[_0x6698('0x9')](),controller[_0x6698('0xf')]);router[_0x6698('0x10')](_0x6698('0x11'),auth[_0x6698('0x9')](),controller[_0x6698('0x12')]);router[_0x6698('0x13')](_0x6698('0x11'),auth[_0x6698('0x9')](),controller['destroy']);module[_0x6698('0x14')]=router; \ No newline at end of file +var _0xe789=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x212b52,_0x1b0637){var _0x589d3a=function(_0x25d442){while(--_0x25d442){_0x212b52['push'](_0x212b52['shift']());}};_0x589d3a(++_0x1b0637);}(_0xe789,0x74));var _0x9e78=function(_0x4c02a6,_0x267982){_0x4c02a6=_0x4c02a6-0x0;var _0x5b158e=_0xe789[_0x4c02a6];return _0x5b158e;};'use strict';var multer=require(_0x9e78('0x0'));var util=require(_0x9e78('0x1'));var path=require('path');var timeout=require(_0x9e78('0x2'));var express=require('express');var router=express[_0x9e78('0x3')]();var auth=require(_0x9e78('0x4'));var interaction=require(_0x9e78('0x5'));var config=require(_0x9e78('0x6'));var controller=require(_0x9e78('0x7'));router[_0x9e78('0x8')]('/',auth[_0x9e78('0x9')](),controller[_0x9e78('0xa')]);router[_0x9e78('0x8')](_0x9e78('0xb'),auth[_0x9e78('0x9')](),controller[_0x9e78('0xc')]);router[_0x9e78('0x8')](_0x9e78('0xd'),auth[_0x9e78('0x9')](),controller[_0x9e78('0xe')]);router[_0x9e78('0xf')]('/',auth['isAuthenticated'](),controller[_0x9e78('0x10')]);router[_0x9e78('0x11')](_0x9e78('0xd'),auth[_0x9e78('0x9')](),controller[_0x9e78('0x12')]);router[_0x9e78('0x13')]('/:id',auth[_0x9e78('0x9')](),controller[_0x9e78('0x14')]);module[_0x9e78('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a558490..fe4b1f2 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 _0xe944=['sequelize','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe944,0x174));var _0x4e94=function(_0x14c04f,_0x2a208e){_0x14c04f=_0x14c04f-0x0;var _0x1dc1cc=_0xe944[_0x14c04f];return _0x1dc1cc;};'use strict';var Sequelize=require(_0x4e94('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4e94('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c1d=['exports','STRING','sequelize'];(function(_0x47651c,_0x244398){var _0x3f4fff=function(_0x1b89e6){while(--_0x1b89e6){_0x47651c['push'](_0x47651c['shift']());}};_0x3f4fff(++_0x244398);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x3b0bb5,_0xf889e8){_0x3b0bb5=_0x3b0bb5-0x0;var _0x54f734=_0x9c1d[_0x3b0bb5];return _0x54f734;};'use strict';var Sequelize=require(_0xd9c1('0x0'));module[_0xd9c1('0x1')]={'name':{'type':Sequelize[_0xd9c1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd9c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7ed2ad5..2beaa93 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 _0xd80e=['../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','map','MailSubstatus','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','findAll','rows','catch','params','include','options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x25163e,_0x376c2c){var _0x586b05=function(_0x53fe84){while(--_0x53fe84){_0x25163e['push'](_0x25163e['shift']());}};_0x586b05(++_0x376c2c);}(_0xd80e,0x104));var _0xed80=function(_0x270c4e,_0x5d9606){_0x270c4e=_0x270c4e-0x0;var _0x23fc7d=_0xd80e[_0x270c4e];return _0x23fc7d;};'use strict';var pdf=require(_0xed80('0x0'));var emlformat=require(_0xed80('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed80('0x2'));var jsonpatch=require(_0xed80('0x3'));var rp=require(_0xed80('0x4'));var moment=require(_0xed80('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xed80('0x6'));var path=require(_0xed80('0x7'));var sox=require('sox');var csv=require(_0xed80('0x8'));var ejs=require(_0xed80('0x9'));var fs=require('fs');var _=require(_0xed80('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed80('0xb'));var deskjs=require(_0xed80('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed80('0xd'));var Papa=require(_0xed80('0xe'));var Redis=require(_0xed80('0xf'));var authService=require(_0xed80('0x10'));var qs=require(_0xed80('0x11'));var as=require(_0xed80('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed80('0x13'));var utils=require(_0xed80('0x14'));var config=require(_0xed80('0x15'));var db=require(_0xed80('0x16'))['db'];function respondWithStatusCode(_0x167626,_0x6f9e70){_0x6f9e70=_0x6f9e70||0xcc;return function(_0x270b04){if(_0x270b04){return _0x167626['sendStatus'](_0x6f9e70);}return _0x167626[_0xed80('0x17')](_0x6f9e70)['end']();};}function respondWithResult(_0x1316dd,_0x1fd5aa){_0x1fd5aa=_0x1fd5aa||0xc8;return function(_0x4c108e){if(_0x4c108e){return _0x1316dd[_0xed80('0x17')](_0x1fd5aa)[_0xed80('0x18')](_0x4c108e);}};}function respondWithFilteredResult(_0x36b240,_0x359df7){return function(_0x170b31){if(_0x170b31){var _0x490d6c=_0x170b31[_0xed80('0x19')],_0x4bcac3=_0x359df7[_0xed80('0x1a')],_0x56e0e5=_0x359df7[_0xed80('0x1a')]+_0x359df7['limit'],_0x8483bd;if(_0x56e0e5>=_0x490d6c){_0x56e0e5=_0x490d6c;_0x8483bd=0xc8;}else{_0x8483bd=0xce;}_0x36b240['status'](_0x8483bd);return _0x36b240['set'](_0xed80('0x1b'),_0x4bcac3+'-'+_0x56e0e5+'/'+_0x490d6c)[_0xed80('0x18')](_0x170b31);}return null;};}function patchUpdates(_0x357766){return function(_0x4ca7ec){try{jsonpatch[_0xed80('0x1c')](_0x4ca7ec,_0x357766,!![]);}catch(_0xb39fdf){return BPromise[_0xed80('0x1d')](_0xb39fdf);}return _0x4ca7ec[_0xed80('0x1e')]();};}function saveUpdates(_0x2c8302,_0x33d839){return function(_0x75115f){if(_0x75115f){return _0x75115f[_0xed80('0x1f')](_0x2c8302)['then'](function(_0x32584f){return _0x32584f;});}return null;};}function removeEntity(_0x58b3ce,_0x3801d6){return function(_0x206ef9){if(_0x206ef9){return _0x206ef9[_0xed80('0x20')]()[_0xed80('0x21')](function(){_0x58b3ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fdd23,_0x2ec818){return function(_0x39056d){if(!_0x39056d){_0x3fdd23[_0xed80('0x22')](0x194);}return _0x39056d;};}function handleError(_0x51b7c5,_0x355188){_0x355188=_0x355188||0x1f4;return function(_0x260af6){logger['error'](_0x260af6['stack']);if(_0x260af6[_0xed80('0x23')]){delete _0x260af6['name'];}_0x51b7c5[_0xed80('0x17')](_0x355188)[_0xed80('0x24')](_0x260af6);};}exports['index']=function(_0x3f58ec,_0x1f9494){var _0x735229={},_0x153cae={},_0x57e35f={'count':0x0,'rows':[]};var _0x58e04b=_[_0xed80('0x25')](db[_0xed80('0x26')][_0xed80('0x27')],function(_0x11e9bd){return{'name':_0x11e9bd['fieldName'],'type':_0x11e9bd['type'][_0xed80('0x28')]};});_0x153cae[_0xed80('0x29')]=_[_0xed80('0x25')](_0x58e04b,_0xed80('0x23'));_0x153cae[_0xed80('0x2a')]=_[_0xed80('0x2b')](_0x3f58ec['query']);_0x153cae[_0xed80('0x2c')]=_[_0xed80('0x2d')](_0x153cae[_0xed80('0x29')],_0x153cae['query']);_0x735229[_0xed80('0x2e')]=_[_0xed80('0x2d')](_0x153cae[_0xed80('0x29')],qs[_0xed80('0x2f')](_0x3f58ec[_0xed80('0x2a')]['fields']));_0x735229[_0xed80('0x2e')]=_0x735229['attributes'][_0xed80('0x30')]?_0x735229[_0xed80('0x2e')]:_0x153cae['model'];if(!_0x3f58ec[_0xed80('0x2a')][_0xed80('0x31')](_0xed80('0x32'))){_0x735229[_0xed80('0x33')]=qs[_0xed80('0x33')](_0x3f58ec[_0xed80('0x2a')]['limit']);_0x735229[_0xed80('0x1a')]=qs[_0xed80('0x1a')](_0x3f58ec['query'][_0xed80('0x1a')]);}_0x735229[_0xed80('0x34')]=qs['sort'](_0x3f58ec[_0xed80('0x2a')][_0xed80('0x35')]);_0x735229[_0xed80('0x36')]=qs['filters'](_['pick'](_0x3f58ec['query'],_0x153cae[_0xed80('0x2c')]),_0x58e04b);if(_0x3f58ec[_0xed80('0x2a')][_0xed80('0x37')]){_0x735229['where']=_['merge'](_0x735229[_0xed80('0x36')],{'$or':_[_0xed80('0x25')](_0x58e04b,function(_0x3e4094){if(_0x3e4094[_0xed80('0x38')]!==_0xed80('0x39')){var _0x4c4ccc={};_0x4c4ccc[_0x3e4094[_0xed80('0x23')]]={'$like':'%'+_0x3f58ec[_0xed80('0x2a')][_0xed80('0x37')]+'%'};return _0x4c4ccc;}})});}_0x735229=_[_0xed80('0x3a')]({},_0x735229,_0x3f58ec['options']);var _0x1ebd3b={'where':_0x735229[_0xed80('0x36')]};return db['MailSubstatus'][_0xed80('0x19')](_0x1ebd3b)['then'](function(_0x4413a2){_0x57e35f[_0xed80('0x19')]=_0x4413a2;if(_0x3f58ec[_0xed80('0x2a')][_0xed80('0x3b')]){_0x735229['include']=[{'all':!![]}];}return db[_0xed80('0x26')][_0xed80('0x3c')](_0x735229);})['then'](function(_0x2ce095){_0x57e35f[_0xed80('0x3d')]=_0x2ce095;return _0x57e35f;})['then'](respondWithFilteredResult(_0x1f9494,_0x735229))[_0xed80('0x3e')](handleError(_0x1f9494,null));};exports['show']=function(_0x5e750e,_0x54f540){var _0x157fcb={'raw':!![],'where':{'id':_0x5e750e[_0xed80('0x3f')]['id']}},_0x48e9e5={};_0x48e9e5[_0xed80('0x29')]=_[_0xed80('0x2b')](db[_0xed80('0x26')][_0xed80('0x27')]);_0x48e9e5[_0xed80('0x2a')]=_[_0xed80('0x2b')](_0x5e750e[_0xed80('0x2a')]);_0x48e9e5[_0xed80('0x2c')]=_[_0xed80('0x2d')](_0x48e9e5[_0xed80('0x29')],_0x48e9e5[_0xed80('0x2a')]);_0x157fcb['attributes']=_[_0xed80('0x2d')](_0x48e9e5['model'],qs['fields'](_0x5e750e[_0xed80('0x2a')][_0xed80('0x2f')]));_0x157fcb['attributes']=_0x157fcb[_0xed80('0x2e')][_0xed80('0x30')]?_0x157fcb[_0xed80('0x2e')]:_0x48e9e5['model'];if(_0x5e750e['query'][_0xed80('0x3b')]){_0x157fcb[_0xed80('0x40')]=[{'all':!![]}];}_0x157fcb=_[_0xed80('0x3a')]({},_0x157fcb,_0x5e750e[_0xed80('0x41')]);return db['MailSubstatus'][_0xed80('0x42')](_0x157fcb)[_0xed80('0x21')](handleEntityNotFound(_0x54f540,null))['then'](respondWithResult(_0x54f540,null))['catch'](handleError(_0x54f540,null));};exports[_0xed80('0x43')]=function(_0x49bc0a,_0x26e3dd){return db[_0xed80('0x26')][_0xed80('0x43')](_0x49bc0a[_0xed80('0x44')],{})[_0xed80('0x21')](respondWithResult(_0x26e3dd,0xc9))[_0xed80('0x3e')](handleError(_0x26e3dd,null));};exports[_0xed80('0x1f')]=function(_0x458c45,_0x89bd2d){if(_0x458c45[_0xed80('0x44')]['id']){delete _0x458c45[_0xed80('0x44')]['id'];}return db[_0xed80('0x26')]['find']({'where':{'id':_0x458c45[_0xed80('0x3f')]['id']}})[_0xed80('0x21')](handleEntityNotFound(_0x89bd2d,null))[_0xed80('0x21')](saveUpdates(_0x458c45[_0xed80('0x44')],null))[_0xed80('0x21')](respondWithResult(_0x89bd2d,null))[_0xed80('0x3e')](handleError(_0x89bd2d,null));};exports[_0xed80('0x20')]=function(_0x39f771,_0x2bc87f){return db['MailSubstatus'][_0xed80('0x42')]({'where':{'id':_0x39f771[_0xed80('0x3f')]['id']}})[_0xed80('0x21')](handleEntityNotFound(_0x2bc87f,null))[_0xed80('0x21')](removeEntity(_0x2bc87f,null))[_0xed80('0x3e')](handleError(_0x2bc87f,null));};exports[_0xed80('0x45')]=function(_0x40412f,_0x2764fe){return db[_0xed80('0x26')][_0xed80('0x45')]()[_0xed80('0x21')](respondWithResult(_0x2764fe,null))[_0xed80('0x3e')](handleError(_0x2764fe,null));}; \ No newline at end of file +var _0x01b7=['find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','json','apply','save','update','then','destroy','error','name','send','index','MailSubstatus','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params'];(function(_0x7ceb,_0x1e269e){var _0x132251=function(_0x1b4710){while(--_0x1b4710){_0x7ceb['push'](_0x7ceb['shift']());}};_0x132251(++_0x1e269e);}(_0x01b7,0x1a9));var _0x701b=function(_0x148785,_0x195ee5){_0x148785=_0x148785-0x0;var _0x17a172=_0x01b7[_0x148785];return _0x17a172;};'use strict';var pdf=require(_0x701b('0x0'));var emlformat=require(_0x701b('0x1'));var rimraf=require(_0x701b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x701b('0x3'));var rp=require('request-promise');var moment=require(_0x701b('0x4'));var BPromise=require(_0x701b('0x5'));var Mustache=require('mustache');var util=require(_0x701b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x701b('0x7'));var ejs=require(_0x701b('0x8'));var fs=require('fs');var _=require(_0x701b('0x9'));var squel=require(_0x701b('0xa'));var crypto=require(_0x701b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x701b('0xc'));var toCsv=require(_0x701b('0x7'));var querystring=require('querystring');var Papa=require(_0x701b('0xd'));var Redis=require(_0x701b('0xe'));var authService=require(_0x701b('0xf'));var qs=require(_0x701b('0x10'));var as=require(_0x701b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x701b('0x12'))(_0x701b('0x13'));var utils=require(_0x701b('0x14'));var config=require(_0x701b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e5c6f,_0x16df93){_0x16df93=_0x16df93||0xcc;return function(_0x181424){if(_0x181424){return _0x4e5c6f[_0x701b('0x16')](_0x16df93);}return _0x4e5c6f['status'](_0x16df93)[_0x701b('0x17')]();};}function respondWithResult(_0x27fdb5,_0x500814){_0x500814=_0x500814||0xc8;return function(_0x2a2b23){if(_0x2a2b23){return _0x27fdb5[_0x701b('0x18')](_0x500814)['json'](_0x2a2b23);}};}function respondWithFilteredResult(_0xce0931,_0x25d889){return function(_0x4be758){if(_0x4be758){var _0x7467c1=_0x4be758[_0x701b('0x19')],_0x56f2e5=_0x25d889['offset'],_0x46ea6a=_0x25d889[_0x701b('0x1a')]+_0x25d889[_0x701b('0x1b')],_0x25087b;if(_0x46ea6a>=_0x7467c1){_0x46ea6a=_0x7467c1;_0x25087b=0xc8;}else{_0x25087b=0xce;}_0xce0931[_0x701b('0x18')](_0x25087b);return _0xce0931[_0x701b('0x1c')]('Content-Range',_0x56f2e5+'-'+_0x46ea6a+'/'+_0x7467c1)[_0x701b('0x1d')](_0x4be758);}return null;};}function patchUpdates(_0x49bbe2){return function(_0x4b6a3c){try{jsonpatch[_0x701b('0x1e')](_0x4b6a3c,_0x49bbe2,!![]);}catch(_0x445155){return BPromise['reject'](_0x445155);}return _0x4b6a3c[_0x701b('0x1f')]();};}function saveUpdates(_0x1dbc9f,_0x24266a){return function(_0x45f065){if(_0x45f065){return _0x45f065[_0x701b('0x20')](_0x1dbc9f)[_0x701b('0x21')](function(_0x290dd3){return _0x290dd3;});}return null;};}function removeEntity(_0x34dc87,_0x2e55bd){return function(_0x2ba961){if(_0x2ba961){return _0x2ba961[_0x701b('0x22')]()[_0x701b('0x21')](function(){_0x34dc87[_0x701b('0x18')](0xcc)[_0x701b('0x17')]();});}};}function handleEntityNotFound(_0x173c33,_0x299de4){return function(_0x365287){if(!_0x365287){_0x173c33[_0x701b('0x16')](0x194);}return _0x365287;};}function handleError(_0x4f0527,_0x1c6bc4){_0x1c6bc4=_0x1c6bc4||0x1f4;return function(_0x3c04df){logger[_0x701b('0x23')](_0x3c04df['stack']);if(_0x3c04df[_0x701b('0x24')]){delete _0x3c04df['name'];}_0x4f0527[_0x701b('0x18')](_0x1c6bc4)[_0x701b('0x25')](_0x3c04df);};}exports[_0x701b('0x26')]=function(_0x39631d,_0x59ef4c){var _0x2910b9={},_0x4ffb6a={},_0x4cd143={'count':0x0,'rows':[]};var _0x3679e6=_['map'](db[_0x701b('0x27')][_0x701b('0x28')],function(_0x25d99a){return{'name':_0x25d99a['fieldName'],'type':_0x25d99a[_0x701b('0x29')][_0x701b('0x2a')]};});_0x4ffb6a[_0x701b('0x2b')]=_[_0x701b('0x2c')](_0x3679e6,_0x701b('0x24'));_0x4ffb6a[_0x701b('0x2d')]=_[_0x701b('0x2e')](_0x39631d[_0x701b('0x2d')]);_0x4ffb6a['filters']=_[_0x701b('0x2f')](_0x4ffb6a[_0x701b('0x2b')],_0x4ffb6a[_0x701b('0x2d')]);_0x2910b9['attributes']=_[_0x701b('0x2f')](_0x4ffb6a[_0x701b('0x2b')],qs[_0x701b('0x30')](_0x39631d['query'][_0x701b('0x30')]));_0x2910b9[_0x701b('0x31')]=_0x2910b9[_0x701b('0x31')][_0x701b('0x32')]?_0x2910b9[_0x701b('0x31')]:_0x4ffb6a['model'];if(!_0x39631d[_0x701b('0x2d')][_0x701b('0x33')]('nolimit')){_0x2910b9['limit']=qs['limit'](_0x39631d[_0x701b('0x2d')][_0x701b('0x1b')]);_0x2910b9['offset']=qs[_0x701b('0x1a')](_0x39631d[_0x701b('0x2d')][_0x701b('0x1a')]);}_0x2910b9[_0x701b('0x34')]=qs[_0x701b('0x35')](_0x39631d[_0x701b('0x2d')][_0x701b('0x35')]);_0x2910b9[_0x701b('0x36')]=qs['filters'](_['pick'](_0x39631d['query'],_0x4ffb6a[_0x701b('0x37')]),_0x3679e6);if(_0x39631d[_0x701b('0x2d')][_0x701b('0x38')]){_0x2910b9[_0x701b('0x36')]=_[_0x701b('0x39')](_0x2910b9[_0x701b('0x36')],{'$or':_['map'](_0x3679e6,function(_0x35acbb){if(_0x35acbb[_0x701b('0x29')]!=='VIRTUAL'){var _0xcb54b7={};_0xcb54b7[_0x35acbb[_0x701b('0x24')]]={'$like':'%'+_0x39631d[_0x701b('0x2d')]['filter']+'%'};return _0xcb54b7;}})});}_0x2910b9=_[_0x701b('0x39')]({},_0x2910b9,_0x39631d[_0x701b('0x3a')]);var _0x1d3253={'where':_0x2910b9[_0x701b('0x36')]};return db['MailSubstatus']['count'](_0x1d3253)['then'](function(_0x383061){_0x4cd143[_0x701b('0x19')]=_0x383061;if(_0x39631d[_0x701b('0x2d')][_0x701b('0x3b')]){_0x2910b9[_0x701b('0x3c')]=[{'all':!![]}];}return db[_0x701b('0x27')][_0x701b('0x3d')](_0x2910b9);})[_0x701b('0x21')](function(_0x3735f7){_0x4cd143[_0x701b('0x3e')]=_0x3735f7;return _0x4cd143;})['then'](respondWithFilteredResult(_0x59ef4c,_0x2910b9))['catch'](handleError(_0x59ef4c,null));};exports[_0x701b('0x3f')]=function(_0x10ce80,_0x313027){var _0x56c57c={'raw':!![],'where':{'id':_0x10ce80[_0x701b('0x40')]['id']}},_0x7658d2={};_0x7658d2['model']=_[_0x701b('0x2e')](db['MailSubstatus'][_0x701b('0x28')]);_0x7658d2[_0x701b('0x2d')]=_[_0x701b('0x2e')](_0x10ce80['query']);_0x7658d2[_0x701b('0x37')]=_[_0x701b('0x2f')](_0x7658d2[_0x701b('0x2b')],_0x7658d2[_0x701b('0x2d')]);_0x56c57c[_0x701b('0x31')]=_[_0x701b('0x2f')](_0x7658d2[_0x701b('0x2b')],qs[_0x701b('0x30')](_0x10ce80['query'][_0x701b('0x30')]));_0x56c57c[_0x701b('0x31')]=_0x56c57c[_0x701b('0x31')][_0x701b('0x32')]?_0x56c57c[_0x701b('0x31')]:_0x7658d2['model'];if(_0x10ce80['query'][_0x701b('0x3b')]){_0x56c57c[_0x701b('0x3c')]=[{'all':!![]}];}_0x56c57c=_['merge']({},_0x56c57c,_0x10ce80['options']);return db[_0x701b('0x27')][_0x701b('0x41')](_0x56c57c)['then'](handleEntityNotFound(_0x313027,null))[_0x701b('0x21')](respondWithResult(_0x313027,null))[_0x701b('0x42')](handleError(_0x313027,null));};exports[_0x701b('0x43')]=function(_0x10e386,_0x31b951){return db['MailSubstatus']['create'](_0x10e386['body'],{})['then'](respondWithResult(_0x31b951,0xc9))[_0x701b('0x42')](handleError(_0x31b951,null));};exports[_0x701b('0x20')]=function(_0x32a6e1,_0x270d29){if(_0x32a6e1[_0x701b('0x44')]['id']){delete _0x32a6e1[_0x701b('0x44')]['id'];}return db[_0x701b('0x27')]['find']({'where':{'id':_0x32a6e1['params']['id']}})[_0x701b('0x21')](handleEntityNotFound(_0x270d29,null))[_0x701b('0x21')](saveUpdates(_0x32a6e1[_0x701b('0x44')],null))[_0x701b('0x21')](respondWithResult(_0x270d29,null))[_0x701b('0x42')](handleError(_0x270d29,null));};exports['destroy']=function(_0x5b16c7,_0xf86a50){return db[_0x701b('0x27')]['find']({'where':{'id':_0x5b16c7[_0x701b('0x40')]['id']}})['then'](handleEntityNotFound(_0xf86a50,null))[_0x701b('0x21')](removeEntity(_0xf86a50,null))['catch'](handleError(_0xf86a50,null));};exports[_0x701b('0x45')]=function(_0x11c9aa,_0x3b9c66){return db[_0x701b('0x27')][_0x701b('0x45')]()[_0x701b('0x21')](respondWithResult(_0x3b9c66,null))[_0x701b('0x42')](handleError(_0x3b9c66,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index b32814a..55ecf4b 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 _0x37e0=['bluebird','request-promise','path','../../config/environment','exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger'];(function(_0x302390,_0x3c3f52){var _0x1aec87=function(_0x30d531){while(--_0x30d531){_0x302390['push'](_0x302390['shift']());}};_0x1aec87(++_0x3c3f52);}(_0x37e0,0x93));var _0x037e=function(_0x38c391,_0x2245ed){_0x38c391=_0x38c391-0x0;var _0x30ea1e=_0x37e0[_0x38c391];return _0x30ea1e;};'use strict';var _=require(_0x037e('0x0'));var util=require(_0x037e('0x1'));var logger=require(_0x037e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x037e('0x3'));var rp=require(_0x037e('0x4'));var fs=require('fs');var path=require(_0x037e('0x5'));var rimraf=require('rimraf');var config=require(_0x037e('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0x037e('0x7')]=function(_0x41f66a,_0x47e5fc){return _0x41f66a['define'](_0x037e('0x8'),attributes,{'tableName':_0x037e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x545e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','MailSubstatus','../../config/logger'];(function(_0x3aa9fc,_0x525788){var _0x3f27fd=function(_0x31a5fc){while(--_0x31a5fc){_0x3aa9fc['push'](_0x3aa9fc['shift']());}};_0x3f27fd(++_0x525788);}(_0x545e,0xbd));var _0xe545=function(_0x192dc4,_0x10b4be){_0x192dc4=_0x192dc4-0x0;var _0x109931=_0x545e[_0x192dc4];return _0x109931;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe545('0x0'))(_0xe545('0x1'));var moment=require(_0xe545('0x2'));var BPromise=require(_0xe545('0x3'));var rp=require(_0xe545('0x4'));var fs=require('fs');var path=require(_0xe545('0x5'));var rimraf=require(_0xe545('0x6'));var config=require(_0xe545('0x7'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x1c376d,_0x164500){return _0x1c376d[_0xe545('0x8')](_0xe545('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d45e78f..7dfb235 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 _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x298801,_0x33d454){var _0x20f460=function(_0x580328){while(--_0x580328){_0x298801['push'](_0x298801['shift']());}};_0x20f460(++_0x33d454);}(_0xfd28,0x148));var _0x8fd2=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xfd28[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file +var _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2ce286,_0x4104e4){var _0x4c471f=function(_0x43326c){while(--_0x43326c){_0x2ce286['push'](_0x2ce286['shift']());}};_0x4c471f(++_0x4104e4);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0xb4e6[_0x493a51];return _0xc85756;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3df4814..f5783f3 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 _0xed2e=['index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x3a6ae5,_0x122494){var _0x2b14ee=function(_0x196258){while(--_0x196258){_0x3a6ae5['push'](_0x3a6ae5['shift']());}};_0x2b14ee(++_0x122494);}(_0xed2e,0x185));var _0xeed2=function(_0x3137fe,_0x498941){_0x3137fe=_0x3137fe-0x0;var _0x517821=_0xed2e[_0x3137fe];return _0x517821;};'use strict';var multer=require(_0xeed2('0x0'));var util=require(_0xeed2('0x1'));var path=require(_0xeed2('0x2'));var timeout=require(_0xeed2('0x3'));var express=require(_0xeed2('0x4'));var router=express[_0xeed2('0x5')]();var auth=require(_0xeed2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeed2('0x7'));router[_0xeed2('0x8')]('/',auth[_0xeed2('0x9')](),controller[_0xeed2('0xa')]);router[_0xeed2('0x8')](_0xeed2('0xb'),auth[_0xeed2('0x9')](),controller[_0xeed2('0xc')]);router['get'](_0xeed2('0xd'),auth[_0xeed2('0x9')](),controller[_0xeed2('0xe')]);router['post']('/',auth[_0xeed2('0x9')](),controller[_0xeed2('0xf')]);router[_0xeed2('0x10')](_0xeed2('0xd'),auth[_0xeed2('0x9')](),controller[_0xeed2('0x11')]);router[_0xeed2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xeed2('0x13')]);module[_0xeed2('0x14')]=router; \ No newline at end of file +var _0xfbf6=['express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x386277,_0x5828fe){var _0xec69fc=function(_0x136206){while(--_0x136206){_0x386277['push'](_0x386277['shift']());}};_0xec69fc(++_0x5828fe);}(_0xfbf6,0x1c4));var _0x6fbf=function(_0x24b245,_0x1b3508){_0x24b245=_0x24b245-0x0;var _0x56f828=_0xfbf6[_0x24b245];return _0x56f828;};'use strict';var multer=require(_0x6fbf('0x0'));var util=require(_0x6fbf('0x1'));var path=require(_0x6fbf('0x2'));var timeout=require(_0x6fbf('0x3'));var express=require(_0x6fbf('0x4'));var router=express[_0x6fbf('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6fbf('0x6'));var controller=require('./mailTransferReport.controller');router[_0x6fbf('0x7')]('/',auth[_0x6fbf('0x8')](),controller[_0x6fbf('0x9')]);router[_0x6fbf('0x7')](_0x6fbf('0xa'),auth[_0x6fbf('0x8')](),controller[_0x6fbf('0xb')]);router[_0x6fbf('0x7')](_0x6fbf('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6fbf('0xd')]('/',auth['isAuthenticated'](),controller[_0x6fbf('0xe')]);router[_0x6fbf('0xf')](_0x6fbf('0xc'),auth[_0x6fbf('0x8')](),controller[_0x6fbf('0x10')]);router[_0x6fbf('0x11')](_0x6fbf('0xc'),auth[_0x6fbf('0x8')](),controller[_0x6fbf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 1dd8681..06befa0 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 _0x0ebe=['sequelize','STRING','account','agent','queue','NOW','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0ebe,0xd8));var _0xe0eb=function(_0x5117c8,_0x388084){_0x5117c8=_0x5117c8-0x0;var _0x2bbba4=_0x0ebe[_0x5117c8];return _0x2bbba4;};'use strict';var moment=require(_0xe0eb('0x0'));var Sequelize=require(_0xe0eb('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0eb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0eb('0x3'),_0xe0eb('0x4'),_0xe0eb('0x5')),'allowNull':![],'defaultValue':_0xe0eb('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xe0eb('0x6')]}}; \ No newline at end of file +var _0x22da=['moment','sequelize','STRING','account','agent','DATE'];(function(_0x13f678,_0x2be848){var _0x332514=function(_0xd14016){while(--_0xd14016){_0x13f678['push'](_0x13f678['shift']());}};_0x332514(++_0x2be848);}(_0x22da,0xd8));var _0xa22d=function(_0x5deea2,_0x12d1ce){_0x5deea2=_0x5deea2-0x0;var _0x5c7a61=_0x22da[_0x5deea2];return _0x5c7a61;};'use strict';var moment=require(_0xa22d('0x0'));var Sequelize=require(_0xa22d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa22d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa22d('0x3'),_0xa22d('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xa22d('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 3aca1e4..76cb623 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 _0x6e5c=['error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then'];(function(_0x13378d,_0x595f4f){var _0x4851f8=function(_0x4df64c){while(--_0x4df64c){_0x13378d['push'](_0x13378d['shift']());}};_0x4851f8(++_0x595f4f);}(_0x6e5c,0x6a));var _0xc6e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e5c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc6e5('0x0'));var emlformat=require(_0xc6e5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc6e5('0x2'));var jsonpatch=require(_0xc6e5('0x3'));var rp=require('request-promise');var moment=require(_0xc6e5('0x4'));var BPromise=require(_0xc6e5('0x5'));var Mustache=require(_0xc6e5('0x6'));var util=require('util');var path=require(_0xc6e5('0x7'));var sox=require(_0xc6e5('0x8'));var csv=require(_0xc6e5('0x9'));var ejs=require(_0xc6e5('0xa'));var fs=require('fs');var _=require(_0xc6e5('0xb'));var squel=require(_0xc6e5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc6e5('0xd'));var toCsv=require(_0xc6e5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc6e5('0xe'));var authService=require(_0xc6e5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc6e5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6e5('0x11'))(_0xc6e5('0x12'));var utils=require(_0xc6e5('0x13'));var config=require(_0xc6e5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3592,_0x4f5c7d){_0x4f5c7d=_0x4f5c7d||0xcc;return function(_0x2db1de){if(_0x2db1de){return _0x4d3592[_0xc6e5('0x15')](_0x4f5c7d);}return _0x4d3592[_0xc6e5('0x16')](_0x4f5c7d)['end']();};}function respondWithResult(_0x501432,_0x28a991){_0x28a991=_0x28a991||0xc8;return function(_0x75028b){if(_0x75028b){return _0x501432['status'](_0x28a991)[_0xc6e5('0x17')](_0x75028b);}};}function respondWithFilteredResult(_0x453644,_0x2be9b5){return function(_0x41cfd3){if(_0x41cfd3){var _0x45945a=_0x41cfd3[_0xc6e5('0x18')],_0x4512e0=_0x2be9b5[_0xc6e5('0x19')],_0x2b6560=_0x2be9b5[_0xc6e5('0x19')]+_0x2be9b5[_0xc6e5('0x1a')],_0x206c62;if(_0x2b6560>=_0x45945a){_0x2b6560=_0x45945a;_0x206c62=0xc8;}else{_0x206c62=0xce;}_0x453644[_0xc6e5('0x16')](_0x206c62);return _0x453644[_0xc6e5('0x1b')](_0xc6e5('0x1c'),_0x4512e0+'-'+_0x2b6560+'/'+_0x45945a)[_0xc6e5('0x17')](_0x41cfd3);}return null;};}function patchUpdates(_0x5cbcd7){return function(_0x4a0705){try{jsonpatch[_0xc6e5('0x1d')](_0x4a0705,_0x5cbcd7,!![]);}catch(_0x1063f4){return BPromise[_0xc6e5('0x1e')](_0x1063f4);}return _0x4a0705['save']();};}function saveUpdates(_0x195b13,_0x4ee627){return function(_0x2184aa){if(_0x2184aa){return _0x2184aa['update'](_0x195b13)[_0xc6e5('0x1f')](function(_0x51d0b5){return _0x51d0b5;});}return null;};}function removeEntity(_0x570498,_0x2a143c){return function(_0x480e9d){if(_0x480e9d){return _0x480e9d['destroy']()[_0xc6e5('0x1f')](function(){_0x570498[_0xc6e5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7bc7,_0x458a8e){return function(_0x43ed7b){if(!_0x43ed7b){_0x5c7bc7[_0xc6e5('0x15')](0x194);}return _0x43ed7b;};}function handleError(_0x31ae6b,_0x177b71){_0x177b71=_0x177b71||0x1f4;return function(_0x4ccf8b){logger[_0xc6e5('0x20')](_0x4ccf8b[_0xc6e5('0x21')]);if(_0x4ccf8b[_0xc6e5('0x22')]){delete _0x4ccf8b[_0xc6e5('0x22')];}_0x31ae6b[_0xc6e5('0x16')](_0x177b71)['send'](_0x4ccf8b);};}exports[_0xc6e5('0x23')]=function(_0x596d3f,_0x5cf186){var _0x57e503={},_0x15db75={},_0x35ea5f={'count':0x0,'rows':[]};var _0x4e4314=_[_0xc6e5('0x24')](db[_0xc6e5('0x25')][_0xc6e5('0x26')],function(_0x4368cb){return{'name':_0x4368cb[_0xc6e5('0x27')],'type':_0x4368cb[_0xc6e5('0x28')][_0xc6e5('0x29')]};});_0x15db75[_0xc6e5('0x2a')]=_['map'](_0x4e4314,_0xc6e5('0x22'));_0x15db75[_0xc6e5('0x2b')]=_['keys'](_0x596d3f[_0xc6e5('0x2b')]);_0x15db75['filters']=_[_0xc6e5('0x2c')](_0x15db75[_0xc6e5('0x2a')],_0x15db75[_0xc6e5('0x2b')]);_0x57e503['attributes']=_[_0xc6e5('0x2c')](_0x15db75[_0xc6e5('0x2a')],qs[_0xc6e5('0x2d')](_0x596d3f[_0xc6e5('0x2b')][_0xc6e5('0x2d')]));_0x57e503['attributes']=_0x57e503[_0xc6e5('0x2e')][_0xc6e5('0x2f')]?_0x57e503[_0xc6e5('0x2e')]:_0x15db75[_0xc6e5('0x2a')];if(!_0x596d3f[_0xc6e5('0x2b')]['hasOwnProperty'](_0xc6e5('0x30'))){_0x57e503[_0xc6e5('0x1a')]=qs[_0xc6e5('0x1a')](_0x596d3f[_0xc6e5('0x2b')][_0xc6e5('0x1a')]);_0x57e503[_0xc6e5('0x19')]=qs['offset'](_0x596d3f[_0xc6e5('0x2b')][_0xc6e5('0x19')]);}_0x57e503[_0xc6e5('0x31')]=qs[_0xc6e5('0x32')](_0x596d3f['query'][_0xc6e5('0x32')]);_0x57e503[_0xc6e5('0x33')]=qs['filters'](_[_0xc6e5('0x34')](_0x596d3f[_0xc6e5('0x2b')],_0x15db75[_0xc6e5('0x35')]),_0x4e4314);if(_0x596d3f[_0xc6e5('0x2b')][_0xc6e5('0x36')]){_0x57e503[_0xc6e5('0x33')]=_[_0xc6e5('0x37')](_0x57e503[_0xc6e5('0x33')],{'$or':_[_0xc6e5('0x24')](_0x4e4314,function(_0x5a4a04){if(_0x5a4a04[_0xc6e5('0x28')]!==_0xc6e5('0x38')){var _0x96f695={};_0x96f695[_0x5a4a04[_0xc6e5('0x22')]]={'$like':'%'+_0x596d3f[_0xc6e5('0x2b')][_0xc6e5('0x36')]+'%'};return _0x96f695;}})});}_0x57e503=_[_0xc6e5('0x37')]({},_0x57e503,_0x596d3f[_0xc6e5('0x39')]);var _0x4d81e4={'where':_0x57e503[_0xc6e5('0x33')]};return db[_0xc6e5('0x25')][_0xc6e5('0x18')](_0x4d81e4)[_0xc6e5('0x1f')](function(_0x4e2466){_0x35ea5f[_0xc6e5('0x18')]=_0x4e2466;if(_0x596d3f['query'][_0xc6e5('0x3a')]){_0x57e503[_0xc6e5('0x3b')]=[{'all':!![]}];}return db[_0xc6e5('0x25')][_0xc6e5('0x3c')](_0x57e503);})[_0xc6e5('0x1f')](function(_0x43e8fc){_0x35ea5f[_0xc6e5('0x3d')]=_0x43e8fc;return _0x35ea5f;})[_0xc6e5('0x1f')](respondWithFilteredResult(_0x5cf186,_0x57e503))[_0xc6e5('0x3e')](handleError(_0x5cf186,null));};exports[_0xc6e5('0x3f')]=function(_0x27a706,_0x2dab5f){var _0x3b9e1d={'raw':!![],'where':{'id':_0x27a706['params']['id']}},_0x2e21a7={};_0x2e21a7[_0xc6e5('0x2a')]=_[_0xc6e5('0x40')](db['MailTransferReport'][_0xc6e5('0x26')]);_0x2e21a7['query']=_[_0xc6e5('0x40')](_0x27a706[_0xc6e5('0x2b')]);_0x2e21a7['filters']=_['intersection'](_0x2e21a7['model'],_0x2e21a7[_0xc6e5('0x2b')]);_0x3b9e1d['attributes']=_[_0xc6e5('0x2c')](_0x2e21a7[_0xc6e5('0x2a')],qs[_0xc6e5('0x2d')](_0x27a706[_0xc6e5('0x2b')][_0xc6e5('0x2d')]));_0x3b9e1d[_0xc6e5('0x2e')]=_0x3b9e1d[_0xc6e5('0x2e')][_0xc6e5('0x2f')]?_0x3b9e1d[_0xc6e5('0x2e')]:_0x2e21a7[_0xc6e5('0x2a')];if(_0x27a706[_0xc6e5('0x2b')][_0xc6e5('0x3a')]){_0x3b9e1d[_0xc6e5('0x3b')]=[{'all':!![]}];}_0x3b9e1d=_['merge']({},_0x3b9e1d,_0x27a706[_0xc6e5('0x39')]);return db[_0xc6e5('0x25')][_0xc6e5('0x41')](_0x3b9e1d)[_0xc6e5('0x1f')](handleEntityNotFound(_0x2dab5f,null))[_0xc6e5('0x1f')](respondWithResult(_0x2dab5f,null))['catch'](handleError(_0x2dab5f,null));};exports['create']=function(_0x57c72c,_0x3cdd8a){return db[_0xc6e5('0x25')]['create'](_0x57c72c[_0xc6e5('0x42')],{})['then'](respondWithResult(_0x3cdd8a,0xc9))['catch'](handleError(_0x3cdd8a,null));};exports['update']=function(_0x23615a,_0x16da61){if(_0x23615a['body']['id']){delete _0x23615a[_0xc6e5('0x42')]['id'];}return db[_0xc6e5('0x25')][_0xc6e5('0x41')]({'where':{'id':_0x23615a['params']['id']}})[_0xc6e5('0x1f')](handleEntityNotFound(_0x16da61,null))['then'](saveUpdates(_0x23615a[_0xc6e5('0x42')],null))[_0xc6e5('0x1f')](respondWithResult(_0x16da61,null))[_0xc6e5('0x3e')](handleError(_0x16da61,null));};exports['destroy']=function(_0xe1b728,_0x54ecaa){return db[_0xc6e5('0x25')]['find']({'where':{'id':_0xe1b728[_0xc6e5('0x43')]['id']}})['then'](handleEntityNotFound(_0x54ecaa,null))[_0xc6e5('0x1f')](removeEntity(_0x54ecaa,null))[_0xc6e5('0x3e')](handleError(_0x54ecaa,null));};exports[_0xc6e5('0x44')]=function(_0x11e7c6,_0x4dd7e8){return db[_0xc6e5('0x25')][_0xc6e5('0x44')]()['then'](respondWithResult(_0x4dd7e8,null))[_0xc6e5('0x3e')](handleError(_0x4dd7e8,null));}; \ No newline at end of file +var _0x0930=['name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','count','offset','Content-Range','json','apply','reject','save','then','sendStatus','stack'];(function(_0x464cde,_0x383009){var _0x190615=function(_0x12c029){while(--_0x12c029){_0x464cde['push'](_0x464cde['shift']());}};_0x190615(++_0x383009);}(_0x0930,0x111));var _0x0093=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x0930[_0x510c60];return _0x49c4aa;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0093('0x0'));var zipdir=require(_0x0093('0x1'));var jsonpatch=require(_0x0093('0x2'));var rp=require(_0x0093('0x3'));var moment=require(_0x0093('0x4'));var BPromise=require(_0x0093('0x5'));var Mustache=require(_0x0093('0x6'));var util=require(_0x0093('0x7'));var path=require(_0x0093('0x8'));var sox=require(_0x0093('0x9'));var csv=require(_0x0093('0xa'));var ejs=require(_0x0093('0xb'));var fs=require('fs');var _=require(_0x0093('0xc'));var squel=require(_0x0093('0xd'));var crypto=require(_0x0093('0xe'));var jsforce=require(_0x0093('0xf'));var deskjs=require(_0x0093('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0093('0x11'));var Papa=require(_0x0093('0x12'));var Redis=require(_0x0093('0x13'));var authService=require(_0x0093('0x14'));var qs=require(_0x0093('0x15'));var as=require(_0x0093('0x16'));var hardwareService=require(_0x0093('0x17'));var logger=require(_0x0093('0x18'))(_0x0093('0x19'));var utils=require('../../config/utils');var config=require(_0x0093('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c5e70,_0x5e9ac5){_0x5e9ac5=_0x5e9ac5||0xcc;return function(_0x348698){if(_0x348698){return _0x5c5e70['sendStatus'](_0x5e9ac5);}return _0x5c5e70[_0x0093('0x1b')](_0x5e9ac5)[_0x0093('0x1c')]();};}function respondWithResult(_0x38dd6d,_0x38e3f8){_0x38e3f8=_0x38e3f8||0xc8;return function(_0x356d8b){if(_0x356d8b){return _0x38dd6d['status'](_0x38e3f8)['json'](_0x356d8b);}};}function respondWithFilteredResult(_0x5c1211,_0xce49e5){return function(_0x10e407){if(_0x10e407){var _0x1c1981=_0x10e407[_0x0093('0x1d')],_0x4921c0=_0xce49e5[_0x0093('0x1e')],_0x433541=_0xce49e5[_0x0093('0x1e')]+_0xce49e5['limit'],_0x2fe87d;if(_0x433541>=_0x1c1981){_0x433541=_0x1c1981;_0x2fe87d=0xc8;}else{_0x2fe87d=0xce;}_0x5c1211[_0x0093('0x1b')](_0x2fe87d);return _0x5c1211['set'](_0x0093('0x1f'),_0x4921c0+'-'+_0x433541+'/'+_0x1c1981)[_0x0093('0x20')](_0x10e407);}return null;};}function patchUpdates(_0x2ab6ff){return function(_0x342a77){try{jsonpatch[_0x0093('0x21')](_0x342a77,_0x2ab6ff,!![]);}catch(_0x4162e3){return BPromise[_0x0093('0x22')](_0x4162e3);}return _0x342a77[_0x0093('0x23')]();};}function saveUpdates(_0x4b911c,_0x6e1d37){return function(_0x4db771){if(_0x4db771){return _0x4db771['update'](_0x4b911c)[_0x0093('0x24')](function(_0x1325c7){return _0x1325c7;});}return null;};}function removeEntity(_0x57b497,_0x3116ca){return function(_0xedbad5){if(_0xedbad5){return _0xedbad5['destroy']()['then'](function(){_0x57b497[_0x0093('0x1b')](0xcc)[_0x0093('0x1c')]();});}};}function handleEntityNotFound(_0x52b295,_0x462c26){return function(_0x56e56c){if(!_0x56e56c){_0x52b295[_0x0093('0x25')](0x194);}return _0x56e56c;};}function handleError(_0x43a245,_0x3312fe){_0x3312fe=_0x3312fe||0x1f4;return function(_0x52119e){logger['error'](_0x52119e[_0x0093('0x26')]);if(_0x52119e[_0x0093('0x27')]){delete _0x52119e['name'];}_0x43a245[_0x0093('0x1b')](_0x3312fe)[_0x0093('0x28')](_0x52119e);};}exports[_0x0093('0x29')]=function(_0x497206,_0x245ce7){var _0x4b4827={},_0x5d47ae={},_0x2cdf6d={'count':0x0,'rows':[]};var _0x3f2fa3=_[_0x0093('0x2a')](db[_0x0093('0x2b')][_0x0093('0x2c')],function(_0x1822b7){return{'name':_0x1822b7['fieldName'],'type':_0x1822b7[_0x0093('0x2d')][_0x0093('0x2e')]};});_0x5d47ae[_0x0093('0x2f')]=_[_0x0093('0x2a')](_0x3f2fa3,'name');_0x5d47ae['query']=_['keys'](_0x497206[_0x0093('0x30')]);_0x5d47ae[_0x0093('0x31')]=_[_0x0093('0x32')](_0x5d47ae[_0x0093('0x2f')],_0x5d47ae[_0x0093('0x30')]);_0x4b4827[_0x0093('0x33')]=_['intersection'](_0x5d47ae[_0x0093('0x2f')],qs['fields'](_0x497206[_0x0093('0x30')][_0x0093('0x34')]));_0x4b4827[_0x0093('0x33')]=_0x4b4827[_0x0093('0x33')]['length']?_0x4b4827[_0x0093('0x33')]:_0x5d47ae[_0x0093('0x2f')];if(!_0x497206[_0x0093('0x30')][_0x0093('0x35')](_0x0093('0x36'))){_0x4b4827[_0x0093('0x37')]=qs[_0x0093('0x37')](_0x497206[_0x0093('0x30')][_0x0093('0x37')]);_0x4b4827[_0x0093('0x1e')]=qs[_0x0093('0x1e')](_0x497206[_0x0093('0x30')]['offset']);}_0x4b4827[_0x0093('0x38')]=qs[_0x0093('0x39')](_0x497206['query'][_0x0093('0x39')]);_0x4b4827[_0x0093('0x3a')]=qs['filters'](_[_0x0093('0x3b')](_0x497206[_0x0093('0x30')],_0x5d47ae[_0x0093('0x31')]),_0x3f2fa3);if(_0x497206[_0x0093('0x30')][_0x0093('0x3c')]){_0x4b4827[_0x0093('0x3a')]=_[_0x0093('0x3d')](_0x4b4827[_0x0093('0x3a')],{'$or':_[_0x0093('0x2a')](_0x3f2fa3,function(_0x454074){if(_0x454074[_0x0093('0x2d')]!==_0x0093('0x3e')){var _0xfd5c6a={};_0xfd5c6a[_0x454074[_0x0093('0x27')]]={'$like':'%'+_0x497206[_0x0093('0x30')][_0x0093('0x3c')]+'%'};return _0xfd5c6a;}})});}_0x4b4827=_['merge']({},_0x4b4827,_0x497206['options']);var _0x5cba4f={'where':_0x4b4827['where']};return db['MailTransferReport']['count'](_0x5cba4f)[_0x0093('0x24')](function(_0x5dd929){_0x2cdf6d[_0x0093('0x1d')]=_0x5dd929;if(_0x497206[_0x0093('0x30')][_0x0093('0x3f')]){_0x4b4827[_0x0093('0x40')]=[{'all':!![]}];}return db[_0x0093('0x2b')][_0x0093('0x41')](_0x4b4827);})[_0x0093('0x24')](function(_0x35b89d){_0x2cdf6d[_0x0093('0x42')]=_0x35b89d;return _0x2cdf6d;})[_0x0093('0x24')](respondWithFilteredResult(_0x245ce7,_0x4b4827))['catch'](handleError(_0x245ce7,null));};exports[_0x0093('0x43')]=function(_0x1d7c23,_0x1d4a69){var _0x6c57d8={'raw':!![],'where':{'id':_0x1d7c23[_0x0093('0x44')]['id']}},_0x4ab76f={};_0x4ab76f[_0x0093('0x2f')]=_[_0x0093('0x45')](db['MailTransferReport'][_0x0093('0x2c')]);_0x4ab76f[_0x0093('0x30')]=_[_0x0093('0x45')](_0x1d7c23[_0x0093('0x30')]);_0x4ab76f[_0x0093('0x31')]=_['intersection'](_0x4ab76f[_0x0093('0x2f')],_0x4ab76f[_0x0093('0x30')]);_0x6c57d8[_0x0093('0x33')]=_[_0x0093('0x32')](_0x4ab76f[_0x0093('0x2f')],qs[_0x0093('0x34')](_0x1d7c23['query'][_0x0093('0x34')]));_0x6c57d8[_0x0093('0x33')]=_0x6c57d8[_0x0093('0x33')][_0x0093('0x46')]?_0x6c57d8[_0x0093('0x33')]:_0x4ab76f[_0x0093('0x2f')];if(_0x1d7c23[_0x0093('0x30')][_0x0093('0x3f')]){_0x6c57d8[_0x0093('0x40')]=[{'all':!![]}];}_0x6c57d8=_[_0x0093('0x3d')]({},_0x6c57d8,_0x1d7c23[_0x0093('0x47')]);return db['MailTransferReport'][_0x0093('0x48')](_0x6c57d8)[_0x0093('0x24')](handleEntityNotFound(_0x1d4a69,null))[_0x0093('0x24')](respondWithResult(_0x1d4a69,null))[_0x0093('0x49')](handleError(_0x1d4a69,null));};exports[_0x0093('0x4a')]=function(_0x194630,_0x4f9a3f){return db[_0x0093('0x2b')][_0x0093('0x4a')](_0x194630[_0x0093('0x4b')],{})[_0x0093('0x24')](respondWithResult(_0x4f9a3f,0xc9))[_0x0093('0x49')](handleError(_0x4f9a3f,null));};exports['update']=function(_0x3dd85e,_0x1d8640){if(_0x3dd85e[_0x0093('0x4b')]['id']){delete _0x3dd85e[_0x0093('0x4b')]['id'];}return db[_0x0093('0x2b')][_0x0093('0x48')]({'where':{'id':_0x3dd85e[_0x0093('0x44')]['id']}})[_0x0093('0x24')](handleEntityNotFound(_0x1d8640,null))[_0x0093('0x24')](saveUpdates(_0x3dd85e[_0x0093('0x4b')],null))['then'](respondWithResult(_0x1d8640,null))[_0x0093('0x49')](handleError(_0x1d8640,null));};exports[_0x0093('0x4c')]=function(_0x83c010,_0x35160f){return db[_0x0093('0x2b')]['find']({'where':{'id':_0x83c010[_0x0093('0x44')]['id']}})[_0x0093('0x24')](handleEntityNotFound(_0x35160f,null))['then'](removeEntity(_0x35160f,null))[_0x0093('0x49')](handleError(_0x35160f,null));};exports[_0x0093('0x4d')]=function(_0x1be99d,_0x159baa){return db[_0x0093('0x2b')]['describe']()[_0x0093('0x24')](respondWithResult(_0x159baa,null))['catch'](handleError(_0x159baa,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 3b3e68f..c2154b5 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 _0x5cea=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','define','MailTransferReport'];(function(_0x71a7f0,_0x1fc9e4){var _0x1c172d=function(_0x165695){while(--_0x165695){_0x71a7f0['push'](_0x71a7f0['shift']());}};_0x1c172d(++_0x1fc9e4);}(_0x5cea,0x17b));var _0xa5ce=function(_0x2186f8,_0x1f5477){_0x2186f8=_0x2186f8-0x0;var _0xeeaf70=_0x5cea[_0x2186f8];return _0xeeaf70;};'use strict';var _=require('lodash');var util=require(_0xa5ce('0x0'));var logger=require(_0xa5ce('0x1'))(_0xa5ce('0x2'));var moment=require(_0xa5ce('0x3'));var BPromise=require(_0xa5ce('0x4'));var rp=require(_0xa5ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1424aa,_0x53ae89){return _0x1424aa[_0xa5ce('0x6')](_0xa5ce('0x7'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa5ce('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8dfe=['../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x148130,_0x3a019d){var _0x2ee42d=function(_0x99aebc){while(--_0x99aebc){_0x148130['push'](_0x148130['shift']());}};_0x2ee42d(++_0x3a019d);}(_0x8dfe,0x10d));var _0xe8df=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8dfe[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xe8df('0x0'));var logger=require(_0xe8df('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe8df('0x2'));var rp=require(_0xe8df('0x3'));var fs=require('fs');var path=require(_0xe8df('0x4'));var rimraf=require(_0xe8df('0x5'));var config=require(_0xe8df('0x6'));var attributes=require(_0xe8df('0x7'));module['exports']=function(_0x11b2c9,_0x5a9c24){return _0x11b2c9['define'](_0xe8df('0x8'),attributes,{'tableName':_0xe8df('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe8df('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 cc0fa77..cabf2ff 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 _0xe543=['MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x257d09,_0x415d96){var _0x4dd4be=function(_0x459df7){while(--_0x459df7){_0x257d09['push'](_0x257d09['shift']());}};_0x4dd4be(++_0x415d96);}(_0xe543,0x1a2));var _0x3e54=function(_0x40f332,_0x15cbdb){_0x40f332=_0x40f332-0x0;var _0x4c2c78=_0xe543[_0x40f332];return _0x4c2c78;};'use strict';var _=require(_0x3e54('0x0'));var util=require(_0x3e54('0x1'));var moment=require(_0x3e54('0x2'));var BPromise=require(_0x3e54('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e54('0x4'))['db'];var utils=require(_0x3e54('0x5'));var logger=require(_0x3e54('0x6'))(_0x3e54('0x7'));var config=require(_0x3e54('0x8'));var jayson=require(_0x3e54('0x9'));var client=jayson[_0x3e54('0xa')][_0x3e54('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13aba,_0x5dd2e7,_0x5e720a){return new BPromise(function(_0x4ee484,_0x39dc9e){return client[_0x3e54('0xc')](_0x13aba,_0x5e720a)[_0x3e54('0xd')](function(_0x13c9ba){logger['info'](_0x3e54('0xe'),_0x5dd2e7,_0x3e54('0xf'));logger[_0x3e54('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5dd2e7,'request\x20sent',JSON[_0x3e54('0x11')](_0x13c9ba));if(_0x13c9ba[_0x3e54('0x12')]){if(_0x13c9ba[_0x3e54('0x12')][_0x3e54('0x13')]===0x1f4){logger[_0x3e54('0x12')](_0x3e54('0xe'),_0x5dd2e7,_0x13c9ba[_0x3e54('0x12')][_0x3e54('0x14')]);return _0x39dc9e(_0x13c9ba[_0x3e54('0x12')][_0x3e54('0x14')]);}logger[_0x3e54('0x12')](_0x3e54('0xe'),_0x5dd2e7,_0x13c9ba[_0x3e54('0x12')][_0x3e54('0x14')]);return _0x4ee484(_0x13c9ba[_0x3e54('0x12')][_0x3e54('0x14')]);}else{logger[_0x3e54('0x15')](_0x3e54('0xe'),_0x5dd2e7,_0x3e54('0xf'));_0x4ee484(_0x13c9ba[_0x3e54('0x16')][_0x3e54('0x14')]);}})[_0x3e54('0x17')](function(_0x2f7cb2){logger['error'](_0x3e54('0xe'),_0x5dd2e7,_0x2f7cb2);_0x39dc9e(_0x2f7cb2);});});} \ No newline at end of file +var _0xb288=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','randomstring'];(function(_0x5cb071,_0x221434){var _0x19f64f=function(_0x3edc84){while(--_0x3edc84){_0x5cb071['push'](_0x5cb071['shift']());}};_0x19f64f(++_0x221434);}(_0xb288,0x1b5));var _0x8b28=function(_0x4a02d1,_0x2f05bf){_0x4a02d1=_0x4a02d1-0x0;var _0x3700f8=_0xb288[_0x4a02d1];return _0x3700f8;};'use strict';var _=require(_0x8b28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8b28('0x1'));var rs=require(_0x8b28('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b28('0x3'))['db'];var utils=require(_0x8b28('0x4'));var logger=require(_0x8b28('0x5'))('rpc');var config=require(_0x8b28('0x6'));var jayson=require(_0x8b28('0x7'));var client=jayson[_0x8b28('0x8')][_0x8b28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46595c,_0x19813e,_0x1f63d3){return new BPromise(function(_0x455dd3,_0xe2bbc5){return client['request'](_0x46595c,_0x1f63d3)[_0x8b28('0xa')](function(_0x489d31){logger[_0x8b28('0xb')](_0x8b28('0xc'),_0x19813e,_0x8b28('0xd'));logger[_0x8b28('0xe')](_0x8b28('0xf'),_0x19813e,_0x8b28('0xd'),JSON['stringify'](_0x489d31));if(_0x489d31[_0x8b28('0x10')]){if(_0x489d31['error'][_0x8b28('0x11')]===0x1f4){logger[_0x8b28('0x10')](_0x8b28('0xc'),_0x19813e,_0x489d31[_0x8b28('0x10')][_0x8b28('0x12')]);return _0xe2bbc5(_0x489d31[_0x8b28('0x10')][_0x8b28('0x12')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x19813e,_0x489d31[_0x8b28('0x10')][_0x8b28('0x12')]);return _0x455dd3(_0x489d31[_0x8b28('0x10')][_0x8b28('0x12')]);}else{logger[_0x8b28('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x19813e,_0x8b28('0xd'));_0x455dd3(_0x489d31[_0x8b28('0x13')][_0x8b28('0x12')]);}})['catch'](function(_0x3daa65){logger[_0x8b28('0x10')](_0x8b28('0xc'),_0x19813e,_0x3daa65);_0xe2bbc5(_0x3daa65);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index dee468f..eb37181 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 _0xf88b=['index','describe','get','show','post','create','put','update','destroy','exports','util','connect-timeout','../../config/environment','./memberReport.controller','isAuthenticated'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf88b,0x163));var _0xbf88=function(_0x1f653e,_0x54b3ee){_0x1f653e=_0x1f653e-0x0;var _0x744f60=_0xf88b[_0x1f653e];return _0x744f60;};'use strict';var multer=require('multer');var util=require(_0xbf88('0x0'));var path=require('path');var timeout=require(_0xbf88('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf88('0x2'));var controller=require(_0xbf88('0x3'));router['get']('/',auth[_0xbf88('0x4')](),controller[_0xbf88('0x5')]);router['get']('/describe',auth[_0xbf88('0x4')](),controller[_0xbf88('0x6')]);router[_0xbf88('0x7')]('/:id',auth[_0xbf88('0x4')](),controller[_0xbf88('0x8')]);router[_0xbf88('0x9')]('/',auth['isAuthenticated'](),controller[_0xbf88('0xa')]);router[_0xbf88('0xb')]('/:id',auth[_0xbf88('0x4')](),controller[_0xbf88('0xc')]);router['delete']('/:id',auth[_0xbf88('0x4')](),controller[_0xbf88('0xd')]);module[_0xbf88('0xe')]=router; \ No newline at end of file +var _0x5fd3=['index','/describe','/:id','isAuthenticated','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./memberReport.controller','get'];(function(_0x16dc96,_0x5e317b){var _0x1c3551=function(_0x4da139){while(--_0x4da139){_0x16dc96['push'](_0x16dc96['shift']());}};_0x1c3551(++_0x5e317b);}(_0x5fd3,0x1ba));var _0x35fd=function(_0x13fcce,_0x563df3){_0x13fcce=_0x13fcce-0x0;var _0x20d528=_0x5fd3[_0x13fcce];return _0x20d528;};'use strict';var multer=require(_0x35fd('0x0'));var util=require(_0x35fd('0x1'));var path=require('path');var timeout=require(_0x35fd('0x2'));var express=require(_0x35fd('0x3'));var router=express[_0x35fd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x35fd('0x5'));var config=require('../../config/environment');var controller=require(_0x35fd('0x6'));router[_0x35fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x35fd('0x8')]);router[_0x35fd('0x7')](_0x35fd('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x35fd('0x7')](_0x35fd('0xa'),auth[_0x35fd('0xb')](),controller['show']);router['post']('/',auth[_0x35fd('0xb')](),controller['create']);router[_0x35fd('0xc')]('/:id',auth[_0x35fd('0xb')](),controller['update']);router['delete'](_0x35fd('0xa'),auth['isAuthenticated'](),controller[_0x35fd('0xd')]);module[_0x35fd('0xe')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 39afe4a..cedc5ea 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 _0x36e2=['STRING','INTEGER','DATE','enterAt','diff','seconds','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x1062b6,_0xa51930){var _0x4881b3=function(_0x4d02a4){while(--_0x4d02a4){_0x1062b6['push'](_0x1062b6['shift']());}};_0x4881b3(++_0xa51930);}(_0x36e2,0x107));var _0x236e=function(_0x3b6aca,_0x4378c7){_0x3b6aca=_0x3b6aca-0x0;var _0x3ebe91=_0x36e2[_0x3b6aca];return _0x3ebe91;};'use strict';var Sequelize=require(_0x236e('0x0'));var moment=require(_0x236e('0x1'));module[_0x236e('0x2')]={'channel':{'type':Sequelize[_0x236e('0x3')]},'membername':{'type':Sequelize[_0x236e('0x3')]},'interface':{'type':Sequelize[_0x236e('0x3')]},'type':{'type':Sequelize[_0x236e('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x236e('0x4')]},'enterAt':{'type':Sequelize[_0x236e('0x5')]},'exitAt':{'type':Sequelize[_0x236e('0x5')],'set':function(_0x31b46a){var _0x42ed91=moment(_0x31b46a);var _0x449c5d=moment(this['getDataValue'](_0x236e('0x6')));var _0x41b2e9=_0x42ed91[_0x236e('0x7')](_0x449c5d,_0x236e('0x8'));this['setDataValue'](_0x236e('0x9'),_0x31b46a);this['setDataValue']('duration',_0x41b2e9||null);}},'data1':{'type':Sequelize[_0x236e('0x3')],'comment':_0x236e('0xa')},'data2':{'type':Sequelize[_0x236e('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x236e('0xb')},'data4':{'type':Sequelize[_0x236e('0x3')],'comment':_0x236e('0xc')},'data5':{'type':Sequelize[_0x236e('0x3')],'comment':_0x236e('0xd')},'role':{'type':Sequelize[_0x236e('0x3')]},'internal':{'type':Sequelize[_0x236e('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xebfb=['exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','seconds','setDataValue'];(function(_0x77301c,_0xe4b6e2){var _0x58afe1=function(_0x35639b){while(--_0x35639b){_0x77301c['push'](_0x77301c['shift']());}};_0x58afe1(++_0xe4b6e2);}(_0xebfb,0x87));var _0xbebf=function(_0x52f5e1,_0x2b485b){_0x52f5e1=_0x52f5e1-0x0;var _0xf2b5ea=_0xebfb[_0x52f5e1];return _0xf2b5ea;};'use strict';var Sequelize=require(_0xbebf('0x0'));var moment=require(_0xbebf('0x1'));module['exports']={'channel':{'type':Sequelize[_0xbebf('0x2')]},'membername':{'type':Sequelize[_0xbebf('0x2')]},'interface':{'type':Sequelize[_0xbebf('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xbebf('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xbebf('0x4')]},'exitAt':{'type':Sequelize[_0xbebf('0x4')],'set':function(_0x511f14){var _0x184502=moment(_0x511f14);var _0x399a87=moment(this[_0xbebf('0x5')](_0xbebf('0x6')));var _0x229e47=_0x184502['diff'](_0x399a87,_0xbebf('0x7'));this[_0xbebf('0x8')](_0xbebf('0x9'),_0x511f14);this[_0xbebf('0x8')](_0xbebf('0xa'),_0x229e47||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xbebf('0x2')],'comment':_0xbebf('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0xbebf('0xc')},'data4':{'type':Sequelize['STRING'],'comment':_0xbebf('0xd')},'data5':{'type':Sequelize[_0xbebf('0x2')],'comment':_0xbebf('0xe')},'role':{'type':Sequelize[_0xbebf('0x2')]},'internal':{'type':Sequelize[_0xbebf('0xf')]},'uniqueid':{'type':Sequelize[_0xbebf('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d284842..2ff1274 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 _0x7d30=['set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','sort','where','pick','filter','VIRTUAL','MemberReport','count','includeAll','findAll','rows','catch','show','params','options','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x5f0056,_0x41be2c){var _0x1a0056=function(_0x3f81e8){while(--_0x3f81e8){_0x5f0056['push'](_0x5f0056['shift']());}};_0x1a0056(++_0x41be2c);}(_0x7d30,0xbe));var _0x07d3=function(_0x5cb415,_0x54c013){_0x5cb415=_0x5cb415-0x0;var _0x58070e=_0x7d30[_0x5cb415];return _0x58070e;};'use strict';var pdf=require(_0x07d3('0x0'));var emlformat=require(_0x07d3('0x1'));var rimraf=require(_0x07d3('0x2'));var zipdir=require(_0x07d3('0x3'));var jsonpatch=require(_0x07d3('0x4'));var rp=require(_0x07d3('0x5'));var moment=require(_0x07d3('0x6'));var BPromise=require(_0x07d3('0x7'));var Mustache=require('mustache');var util=require(_0x07d3('0x8'));var path=require(_0x07d3('0x9'));var sox=require('sox');var csv=require(_0x07d3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x07d3('0xb'));var jsforce=require(_0x07d3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x07d3('0xa'));var querystring=require(_0x07d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x07d3('0xe'));var qs=require(_0x07d3('0xf'));var as=require(_0x07d3('0x10'));var hardwareService=require(_0x07d3('0x11'));var logger=require(_0x07d3('0x12'))(_0x07d3('0x13'));var utils=require(_0x07d3('0x14'));var config=require('../../config/environment');var db=require(_0x07d3('0x15'))['db'];function respondWithStatusCode(_0x1d8f8e,_0x587aef){_0x587aef=_0x587aef||0xcc;return function(_0x54c89b){if(_0x54c89b){return _0x1d8f8e[_0x07d3('0x16')](_0x587aef);}return _0x1d8f8e[_0x07d3('0x17')](_0x587aef)[_0x07d3('0x18')]();};}function respondWithResult(_0x1bca63,_0x5e592e){_0x5e592e=_0x5e592e||0xc8;return function(_0x2a5419){if(_0x2a5419){return _0x1bca63[_0x07d3('0x17')](_0x5e592e)[_0x07d3('0x19')](_0x2a5419);}};}function respondWithFilteredResult(_0x3811c4,_0x3ab8fd){return function(_0x463a0f){if(_0x463a0f){var _0x37107a=_0x463a0f['count'],_0x4c76ea=_0x3ab8fd['offset'],_0x8e2aeb=_0x3ab8fd['offset']+_0x3ab8fd['limit'],_0x51e6ec;if(_0x8e2aeb>=_0x37107a){_0x8e2aeb=_0x37107a;_0x51e6ec=0xc8;}else{_0x51e6ec=0xce;}_0x3811c4[_0x07d3('0x17')](_0x51e6ec);return _0x3811c4[_0x07d3('0x1a')](_0x07d3('0x1b'),_0x4c76ea+'-'+_0x8e2aeb+'/'+_0x37107a)[_0x07d3('0x19')](_0x463a0f);}return null;};}function patchUpdates(_0x259ad7){return function(_0x3f4a12){try{jsonpatch[_0x07d3('0x1c')](_0x3f4a12,_0x259ad7,!![]);}catch(_0xb7e365){return BPromise[_0x07d3('0x1d')](_0xb7e365);}return _0x3f4a12[_0x07d3('0x1e')]();};}function saveUpdates(_0x7a65a7,_0x44f523){return function(_0x26dc76){if(_0x26dc76){return _0x26dc76[_0x07d3('0x1f')](_0x7a65a7)['then'](function(_0x461fea){return _0x461fea;});}return null;};}function removeEntity(_0xa03e4b,_0x3660e2){return function(_0x176d98){if(_0x176d98){return _0x176d98['destroy']()[_0x07d3('0x20')](function(){_0xa03e4b[_0x07d3('0x17')](0xcc)[_0x07d3('0x18')]();});}};}function handleEntityNotFound(_0x150a14,_0xa3ac50){return function(_0xa0e736){if(!_0xa0e736){_0x150a14[_0x07d3('0x16')](0x194);}return _0xa0e736;};}function handleError(_0x1e2df8,_0x5799f8){_0x5799f8=_0x5799f8||0x1f4;return function(_0x349a43){logger[_0x07d3('0x21')](_0x349a43[_0x07d3('0x22')]);if(_0x349a43[_0x07d3('0x23')]){delete _0x349a43[_0x07d3('0x23')];}_0x1e2df8[_0x07d3('0x17')](_0x5799f8)[_0x07d3('0x24')](_0x349a43);};}exports[_0x07d3('0x25')]=function(_0x518f17,_0x2cd2ca){var _0x2fa334={},_0x58cb6f={},_0x628bd4={'count':0x0,'rows':[]};var _0x43afdc=_[_0x07d3('0x26')](db['MemberReport'][_0x07d3('0x27')],function(_0x561cf7){return{'name':_0x561cf7[_0x07d3('0x28')],'type':_0x561cf7[_0x07d3('0x29')][_0x07d3('0x2a')]};});_0x58cb6f[_0x07d3('0x2b')]=_[_0x07d3('0x26')](_0x43afdc,'name');_0x58cb6f[_0x07d3('0x2c')]=_[_0x07d3('0x2d')](_0x518f17[_0x07d3('0x2c')]);_0x58cb6f[_0x07d3('0x2e')]=_[_0x07d3('0x2f')](_0x58cb6f[_0x07d3('0x2b')],_0x58cb6f[_0x07d3('0x2c')]);_0x2fa334[_0x07d3('0x30')]=_[_0x07d3('0x2f')](_0x58cb6f[_0x07d3('0x2b')],qs[_0x07d3('0x31')](_0x518f17['query']['fields']));_0x2fa334['attributes']=_0x2fa334[_0x07d3('0x30')][_0x07d3('0x32')]?_0x2fa334[_0x07d3('0x30')]:_0x58cb6f[_0x07d3('0x2b')];if(!_0x518f17[_0x07d3('0x2c')]['hasOwnProperty'](_0x07d3('0x33'))){_0x2fa334[_0x07d3('0x34')]=qs['limit'](_0x518f17[_0x07d3('0x2c')][_0x07d3('0x34')]);_0x2fa334['offset']=qs[_0x07d3('0x35')](_0x518f17['query'][_0x07d3('0x35')]);}_0x2fa334['order']=qs[_0x07d3('0x36')](_0x518f17[_0x07d3('0x2c')][_0x07d3('0x36')]);_0x2fa334[_0x07d3('0x37')]=qs[_0x07d3('0x2e')](_[_0x07d3('0x38')](_0x518f17[_0x07d3('0x2c')],_0x58cb6f['filters']),_0x43afdc);if(_0x518f17[_0x07d3('0x2c')][_0x07d3('0x39')]){_0x2fa334[_0x07d3('0x37')]=_['merge'](_0x2fa334[_0x07d3('0x37')],{'$or':_['map'](_0x43afdc,function(_0x551f08){if(_0x551f08['type']!==_0x07d3('0x3a')){var _0x278646={};_0x278646[_0x551f08[_0x07d3('0x23')]]={'$like':'%'+_0x518f17[_0x07d3('0x2c')][_0x07d3('0x39')]+'%'};return _0x278646;}})});}_0x2fa334=_['merge']({},_0x2fa334,_0x518f17['options']);var _0x48ea9f={'where':_0x2fa334[_0x07d3('0x37')]};return db[_0x07d3('0x3b')][_0x07d3('0x3c')](_0x48ea9f)[_0x07d3('0x20')](function(_0x76d21c){_0x628bd4['count']=_0x76d21c;if(_0x518f17[_0x07d3('0x2c')][_0x07d3('0x3d')]){_0x2fa334['include']=[{'all':!![]}];}return db[_0x07d3('0x3b')][_0x07d3('0x3e')](_0x2fa334);})[_0x07d3('0x20')](function(_0x251b54){_0x628bd4[_0x07d3('0x3f')]=_0x251b54;return _0x628bd4;})[_0x07d3('0x20')](respondWithFilteredResult(_0x2cd2ca,_0x2fa334))[_0x07d3('0x40')](handleError(_0x2cd2ca,null));};exports[_0x07d3('0x41')]=function(_0x274989,_0x759d12){var _0x11c2f3={'raw':!![],'where':{'id':_0x274989[_0x07d3('0x42')]['id']}},_0x2ff06c={};_0x2ff06c[_0x07d3('0x2b')]=_[_0x07d3('0x2d')](db[_0x07d3('0x3b')][_0x07d3('0x27')]);_0x2ff06c[_0x07d3('0x2c')]=_[_0x07d3('0x2d')](_0x274989[_0x07d3('0x2c')]);_0x2ff06c[_0x07d3('0x2e')]=_[_0x07d3('0x2f')](_0x2ff06c['model'],_0x2ff06c[_0x07d3('0x2c')]);_0x11c2f3['attributes']=_[_0x07d3('0x2f')](_0x2ff06c['model'],qs[_0x07d3('0x31')](_0x274989[_0x07d3('0x2c')]['fields']));_0x11c2f3[_0x07d3('0x30')]=_0x11c2f3[_0x07d3('0x30')]['length']?_0x11c2f3[_0x07d3('0x30')]:_0x2ff06c[_0x07d3('0x2b')];if(_0x274989[_0x07d3('0x2c')][_0x07d3('0x3d')]){_0x11c2f3['include']=[{'all':!![]}];}_0x11c2f3=_['merge']({},_0x11c2f3,_0x274989[_0x07d3('0x43')]);return db['MemberReport'][_0x07d3('0x44')](_0x11c2f3)[_0x07d3('0x20')](handleEntityNotFound(_0x759d12,null))['then'](respondWithResult(_0x759d12,null))['catch'](handleError(_0x759d12,null));};exports[_0x07d3('0x45')]=function(_0x10f15e,_0x284f9d){return db[_0x07d3('0x3b')][_0x07d3('0x45')](_0x10f15e[_0x07d3('0x46')],{})['then'](respondWithResult(_0x284f9d,0xc9))[_0x07d3('0x40')](handleError(_0x284f9d,null));};exports[_0x07d3('0x1f')]=function(_0x2e0b72,_0x76b6fa){if(_0x2e0b72['body']['id']){delete _0x2e0b72[_0x07d3('0x46')]['id'];}return db['MemberReport'][_0x07d3('0x44')]({'where':{'id':_0x2e0b72[_0x07d3('0x42')]['id']}})[_0x07d3('0x20')](handleEntityNotFound(_0x76b6fa,null))[_0x07d3('0x20')](saveUpdates(_0x2e0b72['body'],null))[_0x07d3('0x20')](respondWithResult(_0x76b6fa,null))[_0x07d3('0x40')](handleError(_0x76b6fa,null));};exports[_0x07d3('0x47')]=function(_0x277028,_0x58aa16){return db[_0x07d3('0x3b')]['find']({'where':{'id':_0x277028['params']['id']}})['then'](handleEntityNotFound(_0x58aa16,null))[_0x07d3('0x20')](removeEntity(_0x58aa16,null))[_0x07d3('0x40')](handleError(_0x58aa16,null));};exports['describe']=function(_0x57c329,_0x104c77){return db[_0x07d3('0x3b')]['describe']()[_0x07d3('0x20')](respondWithResult(_0x104c77,null))[_0x07d3('0x40')](handleError(_0x104c77,null));}; \ No newline at end of file +var _0xbd5c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','save','update','destroy','then','stack','name','send','map','MemberReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xbd5c,0xca));var _0xcbd5=function(_0x5dc7f9,_0x2d5c21){_0x5dc7f9=_0x5dc7f9-0x0;var _0x13c865=_0xbd5c[_0x5dc7f9];return _0x13c865;};'use strict';var pdf=require(_0xcbd5('0x0'));var emlformat=require(_0xcbd5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcbd5('0x2'));var jsonpatch=require(_0xcbd5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcbd5('0x4'));var Mustache=require(_0xcbd5('0x5'));var util=require(_0xcbd5('0x6'));var path=require(_0xcbd5('0x7'));var sox=require(_0xcbd5('0x8'));var csv=require(_0xcbd5('0x9'));var ejs=require(_0xcbd5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcbd5('0xb'));var deskjs=require(_0xcbd5('0xc'));var toCsv=require(_0xcbd5('0x9'));var querystring=require(_0xcbd5('0xd'));var Papa=require(_0xcbd5('0xe'));var Redis=require(_0xcbd5('0xf'));var authService=require(_0xcbd5('0x10'));var qs=require(_0xcbd5('0x11'));var as=require(_0xcbd5('0x12'));var hardwareService=require(_0xcbd5('0x13'));var logger=require(_0xcbd5('0x14'))('api');var utils=require(_0xcbd5('0x15'));var config=require('../../config/environment');var db=require(_0xcbd5('0x16'))['db'];function respondWithStatusCode(_0x2035ac,_0x4e9f85){_0x4e9f85=_0x4e9f85||0xcc;return function(_0x11997c){if(_0x11997c){return _0x2035ac[_0xcbd5('0x17')](_0x4e9f85);}return _0x2035ac[_0xcbd5('0x18')](_0x4e9f85)[_0xcbd5('0x19')]();};}function respondWithResult(_0x4ad0a0,_0x4b675a){_0x4b675a=_0x4b675a||0xc8;return function(_0x17beb8){if(_0x17beb8){return _0x4ad0a0[_0xcbd5('0x18')](_0x4b675a)[_0xcbd5('0x1a')](_0x17beb8);}};}function respondWithFilteredResult(_0x1e1ddf,_0x5e527e){return function(_0x1dc4bd){if(_0x1dc4bd){var _0x38f91e=_0x1dc4bd[_0xcbd5('0x1b')],_0x1f6330=_0x5e527e['offset'],_0x21fed7=_0x5e527e['offset']+_0x5e527e[_0xcbd5('0x1c')],_0x330873;if(_0x21fed7>=_0x38f91e){_0x21fed7=_0x38f91e;_0x330873=0xc8;}else{_0x330873=0xce;}_0x1e1ddf[_0xcbd5('0x18')](_0x330873);return _0x1e1ddf[_0xcbd5('0x1d')](_0xcbd5('0x1e'),_0x1f6330+'-'+_0x21fed7+'/'+_0x38f91e)[_0xcbd5('0x1a')](_0x1dc4bd);}return null;};}function patchUpdates(_0x56074a){return function(_0x2e9690){try{jsonpatch['apply'](_0x2e9690,_0x56074a,!![]);}catch(_0x22848e){return BPromise['reject'](_0x22848e);}return _0x2e9690[_0xcbd5('0x1f')]();};}function saveUpdates(_0x2324d0,_0x360db7){return function(_0x1e0aa0){if(_0x1e0aa0){return _0x1e0aa0[_0xcbd5('0x20')](_0x2324d0)['then'](function(_0x28e5e4){return _0x28e5e4;});}return null;};}function removeEntity(_0xb1c4f8,_0xbbe36d){return function(_0x10dec4){if(_0x10dec4){return _0x10dec4[_0xcbd5('0x21')]()[_0xcbd5('0x22')](function(){_0xb1c4f8[_0xcbd5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d2770,_0x4a179b){return function(_0x265e68){if(!_0x265e68){_0x9d2770[_0xcbd5('0x17')](0x194);}return _0x265e68;};}function handleError(_0x88fdc1,_0x2fa901){_0x2fa901=_0x2fa901||0x1f4;return function(_0x1db58e){logger['error'](_0x1db58e[_0xcbd5('0x23')]);if(_0x1db58e['name']){delete _0x1db58e[_0xcbd5('0x24')];}_0x88fdc1[_0xcbd5('0x18')](_0x2fa901)[_0xcbd5('0x25')](_0x1db58e);};}exports['index']=function(_0x3de904,_0x922daa){var _0x31f0e2={},_0xe6804a={},_0x17d0a1={'count':0x0,'rows':[]};var _0x23d518=_[_0xcbd5('0x26')](db[_0xcbd5('0x27')][_0xcbd5('0x28')],function(_0x3f098a){return{'name':_0x3f098a['fieldName'],'type':_0x3f098a[_0xcbd5('0x29')][_0xcbd5('0x2a')]};});_0xe6804a[_0xcbd5('0x2b')]=_[_0xcbd5('0x26')](_0x23d518,_0xcbd5('0x24'));_0xe6804a[_0xcbd5('0x2c')]=_[_0xcbd5('0x2d')](_0x3de904[_0xcbd5('0x2c')]);_0xe6804a[_0xcbd5('0x2e')]=_[_0xcbd5('0x2f')](_0xe6804a[_0xcbd5('0x2b')],_0xe6804a['query']);_0x31f0e2[_0xcbd5('0x30')]=_[_0xcbd5('0x2f')](_0xe6804a[_0xcbd5('0x2b')],qs[_0xcbd5('0x31')](_0x3de904[_0xcbd5('0x2c')][_0xcbd5('0x31')]));_0x31f0e2[_0xcbd5('0x30')]=_0x31f0e2['attributes'][_0xcbd5('0x32')]?_0x31f0e2[_0xcbd5('0x30')]:_0xe6804a['model'];if(!_0x3de904[_0xcbd5('0x2c')]['hasOwnProperty'](_0xcbd5('0x33'))){_0x31f0e2[_0xcbd5('0x1c')]=qs[_0xcbd5('0x1c')](_0x3de904[_0xcbd5('0x2c')]['limit']);_0x31f0e2[_0xcbd5('0x34')]=qs[_0xcbd5('0x34')](_0x3de904[_0xcbd5('0x2c')]['offset']);}_0x31f0e2[_0xcbd5('0x35')]=qs[_0xcbd5('0x36')](_0x3de904[_0xcbd5('0x2c')]['sort']);_0x31f0e2['where']=qs[_0xcbd5('0x2e')](_[_0xcbd5('0x37')](_0x3de904[_0xcbd5('0x2c')],_0xe6804a['filters']),_0x23d518);if(_0x3de904[_0xcbd5('0x2c')][_0xcbd5('0x38')]){_0x31f0e2[_0xcbd5('0x39')]=_[_0xcbd5('0x3a')](_0x31f0e2['where'],{'$or':_[_0xcbd5('0x26')](_0x23d518,function(_0x13d91b){if(_0x13d91b[_0xcbd5('0x29')]!==_0xcbd5('0x3b')){var _0x44fed5={};_0x44fed5[_0x13d91b['name']]={'$like':'%'+_0x3de904[_0xcbd5('0x2c')][_0xcbd5('0x38')]+'%'};return _0x44fed5;}})});}_0x31f0e2=_['merge']({},_0x31f0e2,_0x3de904[_0xcbd5('0x3c')]);var _0x43ed56={'where':_0x31f0e2[_0xcbd5('0x39')]};return db[_0xcbd5('0x27')][_0xcbd5('0x1b')](_0x43ed56)[_0xcbd5('0x22')](function(_0x47bbe1){_0x17d0a1[_0xcbd5('0x1b')]=_0x47bbe1;if(_0x3de904['query'][_0xcbd5('0x3d')]){_0x31f0e2[_0xcbd5('0x3e')]=[{'all':!![]}];}return db['MemberReport'][_0xcbd5('0x3f')](_0x31f0e2);})[_0xcbd5('0x22')](function(_0x59c8ef){_0x17d0a1[_0xcbd5('0x40')]=_0x59c8ef;return _0x17d0a1;})[_0xcbd5('0x22')](respondWithFilteredResult(_0x922daa,_0x31f0e2))[_0xcbd5('0x41')](handleError(_0x922daa,null));};exports[_0xcbd5('0x42')]=function(_0x1a86f8,_0x48fa77){var _0x4dd8f2={'raw':!![],'where':{'id':_0x1a86f8['params']['id']}},_0x446b77={};_0x446b77[_0xcbd5('0x2b')]=_[_0xcbd5('0x2d')](db[_0xcbd5('0x27')][_0xcbd5('0x28')]);_0x446b77[_0xcbd5('0x2c')]=_[_0xcbd5('0x2d')](_0x1a86f8[_0xcbd5('0x2c')]);_0x446b77[_0xcbd5('0x2e')]=_[_0xcbd5('0x2f')](_0x446b77[_0xcbd5('0x2b')],_0x446b77['query']);_0x4dd8f2[_0xcbd5('0x30')]=_[_0xcbd5('0x2f')](_0x446b77['model'],qs[_0xcbd5('0x31')](_0x1a86f8[_0xcbd5('0x2c')][_0xcbd5('0x31')]));_0x4dd8f2[_0xcbd5('0x30')]=_0x4dd8f2['attributes'][_0xcbd5('0x32')]?_0x4dd8f2[_0xcbd5('0x30')]:_0x446b77[_0xcbd5('0x2b')];if(_0x1a86f8[_0xcbd5('0x2c')][_0xcbd5('0x3d')]){_0x4dd8f2[_0xcbd5('0x3e')]=[{'all':!![]}];}_0x4dd8f2=_['merge']({},_0x4dd8f2,_0x1a86f8[_0xcbd5('0x3c')]);return db['MemberReport'][_0xcbd5('0x43')](_0x4dd8f2)[_0xcbd5('0x22')](handleEntityNotFound(_0x48fa77,null))[_0xcbd5('0x22')](respondWithResult(_0x48fa77,null))[_0xcbd5('0x41')](handleError(_0x48fa77,null));};exports[_0xcbd5('0x44')]=function(_0x3ab39b,_0x214a43){return db[_0xcbd5('0x27')][_0xcbd5('0x44')](_0x3ab39b['body'],{})['then'](respondWithResult(_0x214a43,0xc9))[_0xcbd5('0x41')](handleError(_0x214a43,null));};exports[_0xcbd5('0x20')]=function(_0x4e0bf0,_0x3a801b){if(_0x4e0bf0[_0xcbd5('0x45')]['id']){delete _0x4e0bf0[_0xcbd5('0x45')]['id'];}return db[_0xcbd5('0x27')][_0xcbd5('0x43')]({'where':{'id':_0x4e0bf0[_0xcbd5('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a801b,null))[_0xcbd5('0x22')](saveUpdates(_0x4e0bf0[_0xcbd5('0x45')],null))[_0xcbd5('0x22')](respondWithResult(_0x3a801b,null))[_0xcbd5('0x41')](handleError(_0x3a801b,null));};exports['destroy']=function(_0x300696,_0x566c98){return db[_0xcbd5('0x27')]['find']({'where':{'id':_0x300696[_0xcbd5('0x46')]['id']}})['then'](handleEntityNotFound(_0x566c98,null))[_0xcbd5('0x22')](removeEntity(_0x566c98,null))[_0xcbd5('0x41')](handleError(_0x566c98,null));};exports[_0xcbd5('0x47')]=function(_0x2c0cea,_0x496803){return db[_0xcbd5('0x27')][_0xcbd5('0x47')]()['then'](respondWithResult(_0x496803,null))[_0xcbd5('0x41')](handleError(_0x496803,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d286753..76e0f11 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 _0x9a19=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','membername','interface','lodash','util','../../config/logger','moment'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x9a19,0x114));var _0x99a1=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x9a19[_0x173452];return _0xee3fd0;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x99a1('0xc'),_0x99a1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x04de=['../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x163aeb,_0x484eba){var _0x404db0=function(_0x51a143){while(--_0x51a143){_0x163aeb['push'](_0x163aeb['shift']());}};_0x404db0(++_0x484eba);}(_0x04de,0x107));var _0xe04d=function(_0x4e0a1a,_0x23c496){_0x4e0a1a=_0x4e0a1a-0x0;var _0x1f5ba3=_0x04de[_0x4e0a1a];return _0x1f5ba3;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var logger=require(_0xe04d('0x2'))(_0xe04d('0x3'));var moment=require(_0xe04d('0x4'));var BPromise=require(_0xe04d('0x5'));var rp=require(_0xe04d('0x6'));var fs=require('fs');var path=require(_0xe04d('0x7'));var rimraf=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var attributes=require(_0xe04d('0xa'));module['exports']=function(_0x4bb925,_0x4f7637){return _0x4bb925['define'](_0xe04d('0xb'),attributes,{'tableName':_0xe04d('0xc'),'paranoid':![],'indexes':[{'name':_0xe04d('0xd'),'fields':[_0xe04d('0xe'),_0xe04d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 110d662..86edadc 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 _0xd48a=['then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','GetMemberReport','findAll','options','raw','where','attributes','limit','include','model','debug','stringify','CreateMemberReport','MemberReport','create','catch','body','UpdateMemberReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3c4274,_0x858023){var _0x36a214=function(_0x5273e5){while(--_0x5273e5){_0x3c4274['push'](_0x3c4274['shift']());}};_0x36a214(++_0x858023);}(_0xd48a,0x139));var _0xad48=function(_0x2f02db,_0x319a6e){_0x2f02db=_0x2f02db-0x0;var _0x451b0e=_0xd48a[_0x2f02db];return _0x451b0e;};'use strict';var _=require(_0xad48('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad48('0x1'));var rs=require(_0xad48('0x2'));var fs=require('fs');var Redis=require(_0xad48('0x3'));var db=require(_0xad48('0x4'))['db'];var utils=require(_0xad48('0x5'));var logger=require(_0xad48('0x6'))(_0xad48('0x7'));var config=require(_0xad48('0x8'));var jayson=require(_0xad48('0x9'));var client=jayson[_0xad48('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x965c63,_0x53c58a,_0x286ad4){return new BPromise(function(_0x26deb8,_0x22ff8c){return client['request'](_0x965c63,_0x286ad4)[_0xad48('0xb')](function(_0x5ce401){logger[_0xad48('0xc')](_0xad48('0xd'),_0x53c58a,_0xad48('0xe'));logger['debug'](_0xad48('0xf'),_0x53c58a,'request\x20sent',JSON['stringify'](_0x5ce401));if(_0x5ce401['error']){if(_0x5ce401[_0xad48('0x10')][_0xad48('0x11')]===0x1f4){logger[_0xad48('0x10')](_0xad48('0xd'),_0x53c58a,_0x5ce401[_0xad48('0x10')]['message']);return _0x22ff8c(_0x5ce401[_0xad48('0x10')]['message']);}logger[_0xad48('0x10')]('MemberReport,\x20%s,\x20%s',_0x53c58a,_0x5ce401[_0xad48('0x10')][_0xad48('0x12')]);return _0x26deb8(_0x5ce401[_0xad48('0x10')][_0xad48('0x12')]);}else{logger[_0xad48('0xc')](_0xad48('0xd'),_0x53c58a,_0xad48('0xe'));_0x26deb8(_0x5ce401['result'][_0xad48('0x12')]);}})['catch'](function(_0x1ba6d2){logger['error'](_0xad48('0xd'),_0x53c58a,_0x1ba6d2);_0x22ff8c(_0x1ba6d2);});});}exports[_0xad48('0x13')]=function(_0x2f83c8){var _0x1f5d8b=this;return new Promise(function(_0x2169e1,_0x3d6654){return db['MemberReport'][_0xad48('0x14')]({'raw':_0x2f83c8[_0xad48('0x15')]?_0x2f83c8[_0xad48('0x15')][_0xad48('0x16')]===undefined?!![]:![]:!![],'where':_0x2f83c8[_0xad48('0x15')]?_0x2f83c8[_0xad48('0x15')][_0xad48('0x17')]||null:null,'attributes':_0x2f83c8[_0xad48('0x15')]?_0x2f83c8['options'][_0xad48('0x18')]||null:null,'limit':_0x2f83c8[_0xad48('0x15')]?_0x2f83c8[_0xad48('0x15')][_0xad48('0x19')]||null:null,'include':_0x2f83c8['options']?_0x2f83c8['options'][_0xad48('0x1a')]?_['map'](_0x2f83c8[_0xad48('0x15')][_0xad48('0x1a')],function(_0x4ef515){return{'model':db[_0x4ef515[_0xad48('0x1b')]],'as':_0x4ef515['as'],'attributes':_0x4ef515[_0xad48('0x18')],'include':_0x4ef515['include']?_['map'](_0x4ef515[_0xad48('0x1a')],function(_0x13fbfe){return{'model':db[_0x13fbfe[_0xad48('0x1b')]],'as':_0x13fbfe['as'],'attributes':_0x13fbfe[_0xad48('0x18')],'include':_0x13fbfe[_0xad48('0x1a')]?_['map'](_0x13fbfe['include'],function(_0x2d77a1){return{'model':db[_0x2d77a1[_0xad48('0x1b')]],'as':_0x2d77a1['as'],'attributes':_0x2d77a1['attributes']};}):[]};}):[]};}):[]:[]})[_0xad48('0xb')](function(_0x4387e9){logger[_0xad48('0xc')](_0xad48('0x13'),_0x2f83c8);logger[_0xad48('0x1c')](_0xad48('0x13'),_0x2f83c8,JSON[_0xad48('0x1d')](_0x4387e9));_0x2169e1(_0x4387e9);})['catch'](function(_0x5087f5){logger[_0xad48('0x10')](_0xad48('0x13'),_0x5087f5[_0xad48('0x12')],_0x2f83c8);_0x3d6654(_0x1f5d8b[_0xad48('0x10')](0x1f4,_0x5087f5[_0xad48('0x12')]));});});};exports[_0xad48('0x1e')]=function(_0x3c7efc){var _0xa4d2a4=this;return new Promise(function(_0x223004,_0x1a1b2c){return db[_0xad48('0x1f')][_0xad48('0x20')](_0x3c7efc['body'],{'raw':_0x3c7efc[_0xad48('0x15')]?_0x3c7efc['options'][_0xad48('0x16')]===undefined?!![]:![]:!![]})[_0xad48('0xb')](function(_0x2abfd2){logger[_0xad48('0xc')](_0xad48('0x1e'),_0x3c7efc);logger[_0xad48('0x1c')](_0xad48('0x1e'),_0x3c7efc,JSON[_0xad48('0x1d')](_0x2abfd2));_0x223004(_0x2abfd2);})[_0xad48('0x21')](function(_0x5b0c7){logger[_0xad48('0x10')](_0xad48('0x1e'),_0x5b0c7[_0xad48('0x12')],_0x3c7efc);_0x1a1b2c(_0xa4d2a4[_0xad48('0x10')](0x1f4,_0x5b0c7[_0xad48('0x12')]));});});};exports['UpdateMemberReport']=function(_0x213ed5){var _0x58d85d=this;return new Promise(function(_0x1a9027,_0x1f126c){return db['MemberReport']['update'](_0x213ed5[_0xad48('0x22')],{'raw':_0x213ed5['options']?_0x213ed5[_0xad48('0x15')][_0xad48('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x213ed5[_0xad48('0x15')]?_0x213ed5['options'][_0xad48('0x17')]||null:null,'attributes':_0x213ed5[_0xad48('0x15')]?_0x213ed5[_0xad48('0x15')][_0xad48('0x18')]||null:null,'limit':_0x213ed5['options']?_0x213ed5[_0xad48('0x15')][_0xad48('0x19')]||null:null})[_0xad48('0xb')](function(_0x285b45){logger['info'](_0xad48('0x23'),_0x213ed5);logger[_0xad48('0x1c')](_0xad48('0x23'),_0x213ed5,JSON[_0xad48('0x1d')](_0x285b45));_0x1a9027(_0x285b45);})[_0xad48('0x21')](function(_0x297f97){logger[_0xad48('0x10')]('UpdateMemberReport',_0x297f97[_0xad48('0x12')],_0x213ed5);_0x1f126c(_0x58d85d[_0xad48('0x10')](0x1f4,_0x297f97[_0xad48('0x12')]));});});}; \ No newline at end of file +var _0x9eeb=['CreateMemberReport','create','body','raw','UpdateMemberReport','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','include','map','model'];(function(_0x5ee18f,_0x5f0488){var _0x519310=function(_0x243dc2){while(--_0x243dc2){_0x5ee18f['push'](_0x5ee18f['shift']());}};_0x519310(++_0x5f0488);}(_0x9eeb,0x1b3));var _0xb9ee=function(_0x3ce889,_0x4072e0){_0x3ce889=_0x3ce889-0x0;var _0x1f05eb=_0x9eeb[_0x3ce889];return _0x1f05eb;};'use strict';var _=require(_0xb9ee('0x0'));var util=require('util');var moment=require(_0xb9ee('0x1'));var BPromise=require(_0xb9ee('0x2'));var rs=require(_0xb9ee('0x3'));var fs=require('fs');var Redis=require(_0xb9ee('0x4'));var db=require(_0xb9ee('0x5'))['db'];var utils=require(_0xb9ee('0x6'));var logger=require(_0xb9ee('0x7'))(_0xb9ee('0x8'));var config=require(_0xb9ee('0x9'));var jayson=require(_0xb9ee('0xa'));var client=jayson[_0xb9ee('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30b888,_0x5b6fde,_0xf2b2cf){return new BPromise(function(_0x370ce6,_0x4c0b8c){return client[_0xb9ee('0xc')](_0x30b888,_0xf2b2cf)['then'](function(_0x496666){logger[_0xb9ee('0xd')](_0xb9ee('0xe'),_0x5b6fde,'request\x20sent');logger[_0xb9ee('0xf')](_0xb9ee('0x10'),_0x5b6fde,_0xb9ee('0x11'),JSON[_0xb9ee('0x12')](_0x496666));if(_0x496666[_0xb9ee('0x13')]){if(_0x496666['error'][_0xb9ee('0x14')]===0x1f4){logger[_0xb9ee('0x13')](_0xb9ee('0xe'),_0x5b6fde,_0x496666['error'][_0xb9ee('0x15')]);return _0x4c0b8c(_0x496666[_0xb9ee('0x13')][_0xb9ee('0x15')]);}logger[_0xb9ee('0x13')](_0xb9ee('0xe'),_0x5b6fde,_0x496666[_0xb9ee('0x13')][_0xb9ee('0x15')]);return _0x370ce6(_0x496666[_0xb9ee('0x13')][_0xb9ee('0x15')]);}else{logger[_0xb9ee('0xd')](_0xb9ee('0xe'),_0x5b6fde,_0xb9ee('0x11'));_0x370ce6(_0x496666[_0xb9ee('0x16')]['message']);}})[_0xb9ee('0x17')](function(_0x3440fe){logger[_0xb9ee('0x13')](_0xb9ee('0xe'),_0x5b6fde,_0x3440fe);_0x4c0b8c(_0x3440fe);});});}exports[_0xb9ee('0x18')]=function(_0x1c06af){var _0x363aeb=this;return new Promise(function(_0x3b90d0,_0x358331){return db[_0xb9ee('0x19')][_0xb9ee('0x1a')]({'raw':_0x1c06af[_0xb9ee('0x1b')]?_0x1c06af[_0xb9ee('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1c06af[_0xb9ee('0x1b')]?_0x1c06af['options'][_0xb9ee('0x1c')]||null:null,'attributes':_0x1c06af[_0xb9ee('0x1b')]?_0x1c06af['options'][_0xb9ee('0x1d')]||null:null,'limit':_0x1c06af['options']?_0x1c06af[_0xb9ee('0x1b')]['limit']||null:null,'include':_0x1c06af[_0xb9ee('0x1b')]?_0x1c06af[_0xb9ee('0x1b')][_0xb9ee('0x1e')]?_[_0xb9ee('0x1f')](_0x1c06af['options']['include'],function(_0x275ee1){return{'model':db[_0x275ee1[_0xb9ee('0x20')]],'as':_0x275ee1['as'],'attributes':_0x275ee1[_0xb9ee('0x1d')],'include':_0x275ee1[_0xb9ee('0x1e')]?_[_0xb9ee('0x1f')](_0x275ee1[_0xb9ee('0x1e')],function(_0x59bc0c){return{'model':db[_0x59bc0c[_0xb9ee('0x20')]],'as':_0x59bc0c['as'],'attributes':_0x59bc0c[_0xb9ee('0x1d')],'include':_0x59bc0c[_0xb9ee('0x1e')]?_[_0xb9ee('0x1f')](_0x59bc0c[_0xb9ee('0x1e')],function(_0x138599){return{'model':db[_0x138599[_0xb9ee('0x20')]],'as':_0x138599['as'],'attributes':_0x138599[_0xb9ee('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ee03a){logger[_0xb9ee('0xd')](_0xb9ee('0x18'),_0x1c06af);logger[_0xb9ee('0xf')](_0xb9ee('0x18'),_0x1c06af,JSON[_0xb9ee('0x12')](_0x5ee03a));_0x3b90d0(_0x5ee03a);})[_0xb9ee('0x17')](function(_0x5b11ae){logger[_0xb9ee('0x13')](_0xb9ee('0x18'),_0x5b11ae['message'],_0x1c06af);_0x358331(_0x363aeb['error'](0x1f4,_0x5b11ae[_0xb9ee('0x15')]));});});};exports[_0xb9ee('0x21')]=function(_0x358330){var _0x4ccc4f=this;return new Promise(function(_0xb89131,_0x99c716){return db[_0xb9ee('0x19')][_0xb9ee('0x22')](_0x358330[_0xb9ee('0x23')],{'raw':_0x358330['options']?_0x358330[_0xb9ee('0x1b')][_0xb9ee('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x3739a3){logger[_0xb9ee('0xd')](_0xb9ee('0x21'),_0x358330);logger[_0xb9ee('0xf')](_0xb9ee('0x21'),_0x358330,JSON[_0xb9ee('0x12')](_0x3739a3));_0xb89131(_0x3739a3);})[_0xb9ee('0x17')](function(_0x192dc8){logger[_0xb9ee('0x13')]('CreateMemberReport',_0x192dc8[_0xb9ee('0x15')],_0x358330);_0x99c716(_0x4ccc4f[_0xb9ee('0x13')](0x1f4,_0x192dc8[_0xb9ee('0x15')]));});});};exports[_0xb9ee('0x25')]=function(_0x30bc90){var _0x33e0cd=this;return new Promise(function(_0x2d1e15,_0x1c68fe){return db[_0xb9ee('0x19')]['update'](_0x30bc90[_0xb9ee('0x23')],{'raw':_0x30bc90[_0xb9ee('0x1b')]?_0x30bc90[_0xb9ee('0x1b')][_0xb9ee('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30bc90[_0xb9ee('0x1b')]?_0x30bc90['options']['where']||null:null,'attributes':_0x30bc90[_0xb9ee('0x1b')]?_0x30bc90['options'][_0xb9ee('0x1d')]||null:null,'limit':_0x30bc90['options']?_0x30bc90['options'][_0xb9ee('0x26')]||null:null})['then'](function(_0x491263){logger[_0xb9ee('0xd')](_0xb9ee('0x25'),_0x30bc90);logger[_0xb9ee('0xf')](_0xb9ee('0x25'),_0x30bc90,JSON[_0xb9ee('0x12')](_0x491263));_0x2d1e15(_0x491263);})[_0xb9ee('0x17')](function(_0x3c3fe1){logger['error']('UpdateMemberReport',_0x3c3fe1['message'],_0x30bc90);_0x1c68fe(_0x33e0cd[_0xb9ee('0x13')](0x1f4,_0x3c3fe1['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7150196..1c319a4 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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','util','path'];(function(_0x11ec20,_0x2a5a5d){var _0x491096=function(_0x2b81a8){while(--_0x2b81a8){_0x11ec20['push'](_0x11ec20['shift']());}};_0x491096(++_0x2a5a5d);}(_0x757a,0xde));var _0xa757=function(_0x3e9fc3,_0x357e9b){_0x3e9fc3=_0x3e9fc3-0x0;var _0x403709=_0x757a[_0x3e9fc3];return _0x403709;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',controller[_0xa757('0x7')]);module['exports']=router; \ No newline at end of file +var _0xb688=['express','Router','../../components/auth/service','../../config/environment','./migration.controller','get','index','util','path','connect-timeout'];(function(_0x2420fb,_0x183d49){var _0x123a0f=function(_0x5e2e46){while(--_0x5e2e46){_0x2420fb['push'](_0x2420fb['shift']());}};_0x123a0f(++_0x183d49);}(_0xb688,0xcf));var _0x8b68=function(_0x4671c4,_0x33a4c3){_0x4671c4=_0x4671c4-0x0;var _0x1470f3=_0xb688[_0x4671c4];return _0x1470f3;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')]('/',controller[_0x8b68('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 84d2c8e..7fe70a6 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 _0x545d=['exports','STRING','version'];(function(_0x21fc63,_0x5c9b80){var _0x5ef05e=function(_0x482c7a){while(--_0x482c7a){_0x21fc63['push'](_0x21fc63['shift']());}};_0x5ef05e(++_0x5c9b80);}(_0x545d,0xe4));var _0xd545=function(_0x265076,_0x5051d0){_0x265076=_0x265076-0x0;var _0x77b002=_0x545d[_0x265076];return _0x77b002;};'use strict';var Sequelize=require('sequelize');module[_0xd545('0x0')]={'version':{'type':Sequelize[_0xd545('0x1')],'unique':_0xd545('0x2')}}; \ No newline at end of file +var _0xe72d=['sequelize','exports','STRING'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xe72d,0xba));var _0xde72=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe72d[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xde72('0x0'));module[_0xde72('0x1')]={'version':{'type':Sequelize[_0xde72('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 70d9986..171e6c2 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 _0x54ef=['where','VIRTUAL','includeAll','include','findAll','rows','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','pick','filter','merge'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x54ef,0x112));var _0xf54e=function(_0x284549,_0x50177c){_0x284549=_0x284549-0x0;var _0x5cff7f=_0x54ef[_0x284549];return _0x5cff7f;};'use strict';var pdf=require(_0xf54e('0x0'));var emlformat=require(_0xf54e('0x1'));var rimraf=require(_0xf54e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf54e('0x3'));var rp=require(_0xf54e('0x4'));var moment=require(_0xf54e('0x5'));var BPromise=require(_0xf54e('0x6'));var Mustache=require(_0xf54e('0x7'));var util=require(_0xf54e('0x8'));var path=require(_0xf54e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf54e('0xa'));var fs=require('fs');var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358c88,_0x4b0ee1){_0x4b0ee1=_0x4b0ee1||0xcc;return function(_0x4bd828){if(_0x4bd828){return _0x358c88[_0xf54e('0x18')](_0x4b0ee1);}return _0x358c88[_0xf54e('0x19')](_0x4b0ee1)[_0xf54e('0x1a')]();};}function respondWithResult(_0x380f26,_0x5644aa){_0x5644aa=_0x5644aa||0xc8;return function(_0x331732){if(_0x331732){return _0x380f26[_0xf54e('0x19')](_0x5644aa)[_0xf54e('0x1b')](_0x331732);}};}function respondWithFilteredResult(_0x15f639,_0x56828e){return function(_0x2366ee){if(_0x2366ee){var _0x389abc=_0x2366ee[_0xf54e('0x1c')],_0x3eb415=_0x56828e[_0xf54e('0x1d')],_0x5c5d00=_0x56828e[_0xf54e('0x1d')]+_0x56828e[_0xf54e('0x1e')],_0x4af633;if(_0x5c5d00>=_0x389abc){_0x5c5d00=_0x389abc;_0x4af633=0xc8;}else{_0x4af633=0xce;}_0x15f639[_0xf54e('0x19')](_0x4af633);return _0x15f639[_0xf54e('0x1f')](_0xf54e('0x20'),_0x3eb415+'-'+_0x5c5d00+'/'+_0x389abc)[_0xf54e('0x1b')](_0x2366ee);}return null;};}function patchUpdates(_0x1dcc04){return function(_0x4689fe){try{jsonpatch[_0xf54e('0x21')](_0x4689fe,_0x1dcc04,!![]);}catch(_0x50fc66){return BPromise['reject'](_0x50fc66);}return _0x4689fe[_0xf54e('0x22')]();};}function saveUpdates(_0x59f338,_0x3e1556){return function(_0x1bfe99){if(_0x1bfe99){return _0x1bfe99[_0xf54e('0x23')](_0x59f338)[_0xf54e('0x24')](function(_0xf64f12){return _0xf64f12;});}return null;};}function removeEntity(_0x3887b0,_0x388aa0){return function(_0x11985e){if(_0x11985e){return _0x11985e[_0xf54e('0x25')]()[_0xf54e('0x24')](function(){_0x3887b0[_0xf54e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(!_0x264a8f){_0x6f6d29[_0xf54e('0x18')](0x194);}return _0x264a8f;};}function handleError(_0x335492,_0x474b61){_0x474b61=_0x474b61||0x1f4;return function(_0x3805a7){logger[_0xf54e('0x26')](_0x3805a7[_0xf54e('0x27')]);if(_0x3805a7[_0xf54e('0x28')]){delete _0x3805a7[_0xf54e('0x28')];}_0x335492[_0xf54e('0x19')](_0x474b61)[_0xf54e('0x29')](_0x3805a7);};}exports[_0xf54e('0x2a')]=function(_0x2ea001,_0x5390b8){var _0xb3706e={},_0x4cbf7c={},_0x282c63={'count':0x0,'rows':[]};var _0x5e63f4=_[_0xf54e('0x2b')](db[_0xf54e('0x2c')][_0xf54e('0x2d')],function(_0xa13cd0){return{'name':_0xa13cd0[_0xf54e('0x2e')],'type':_0xa13cd0[_0xf54e('0x2f')][_0xf54e('0x30')]};});_0x4cbf7c['model']=_['map'](_0x5e63f4,_0xf54e('0x28'));_0x4cbf7c[_0xf54e('0x31')]=_[_0xf54e('0x32')](_0x2ea001[_0xf54e('0x31')]);_0x4cbf7c[_0xf54e('0x33')]=_[_0xf54e('0x34')](_0x4cbf7c[_0xf54e('0x35')],_0x4cbf7c[_0xf54e('0x31')]);_0xb3706e[_0xf54e('0x36')]=_[_0xf54e('0x34')](_0x4cbf7c['model'],qs['fields'](_0x2ea001[_0xf54e('0x31')][_0xf54e('0x37')]));_0xb3706e['attributes']=_0xb3706e[_0xf54e('0x36')][_0xf54e('0x38')]?_0xb3706e[_0xf54e('0x36')]:_0x4cbf7c[_0xf54e('0x35')];if(!_0x2ea001['query']['hasOwnProperty']('nolimit')){_0xb3706e[_0xf54e('0x1e')]=qs[_0xf54e('0x1e')](_0x2ea001[_0xf54e('0x31')][_0xf54e('0x1e')]);_0xb3706e[_0xf54e('0x1d')]=qs[_0xf54e('0x1d')](_0x2ea001['query']['offset']);}_0xb3706e['order']=qs[_0xf54e('0x39')](_0x2ea001[_0xf54e('0x31')]['sort']);_0xb3706e['where']=qs[_0xf54e('0x33')](_[_0xf54e('0x3a')](_0x2ea001[_0xf54e('0x31')],_0x4cbf7c['filters']),_0x5e63f4);if(_0x2ea001[_0xf54e('0x31')][_0xf54e('0x3b')]){_0xb3706e['where']=_[_0xf54e('0x3c')](_0xb3706e[_0xf54e('0x3d')],{'$or':_[_0xf54e('0x2b')](_0x5e63f4,function(_0x1eeeb4){if(_0x1eeeb4[_0xf54e('0x2f')]!==_0xf54e('0x3e')){var _0x4e00b7={};_0x4e00b7[_0x1eeeb4['name']]={'$like':'%'+_0x2ea001[_0xf54e('0x31')][_0xf54e('0x3b')]+'%'};return _0x4e00b7;}})});}_0xb3706e=_[_0xf54e('0x3c')]({},_0xb3706e,_0x2ea001['options']);var _0x4533a2={'where':_0xb3706e[_0xf54e('0x3d')]};return db[_0xf54e('0x2c')][_0xf54e('0x1c')](_0x4533a2)[_0xf54e('0x24')](function(_0x23f297){_0x282c63[_0xf54e('0x1c')]=_0x23f297;if(_0x2ea001[_0xf54e('0x31')][_0xf54e('0x3f')]){_0xb3706e[_0xf54e('0x40')]=[{'all':!![]}];}return db[_0xf54e('0x2c')][_0xf54e('0x41')](_0xb3706e);})[_0xf54e('0x24')](function(_0x2625fd){_0x282c63[_0xf54e('0x42')]=_0x2625fd;return _0x282c63;})['then'](respondWithFilteredResult(_0x5390b8,_0xb3706e))['catch'](handleError(_0x5390b8,null));}; \ No newline at end of file +var _0x4b84=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','set','Content-Range','reject','save','update','then','status','error','stack','name','index','map','Migration','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','ejs','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0x4b84[_0x1d83db];return _0x2dc1d1;};'use strict';var pdf=require(_0x44b8('0x0'));var emlformat=require(_0x44b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44b8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44b8('0x3'));var Mustache=require(_0x44b8('0x4'));var util=require(_0x44b8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44b8('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147529,_0x4301a6){_0x4301a6=_0x4301a6||0xcc;return function(_0x4bcc43){if(_0x4bcc43){return _0x147529[_0x44b8('0x13')](_0x4301a6);}return _0x147529['status'](_0x4301a6)[_0x44b8('0x14')]();};}function respondWithResult(_0x18d642,_0x4df670){_0x4df670=_0x4df670||0xc8;return function(_0x63e8f6){if(_0x63e8f6){return _0x18d642['status'](_0x4df670)['json'](_0x63e8f6);}};}function respondWithFilteredResult(_0x2a3e4c,_0x2af0ad){return function(_0x1722da){if(_0x1722da){var _0x41ab46=_0x1722da[_0x44b8('0x15')],_0x5e52f2=_0x2af0ad['offset'],_0x495c74=_0x2af0ad[_0x44b8('0x16')]+_0x2af0ad[_0x44b8('0x17')],_0x5d6349;if(_0x495c74>=_0x41ab46){_0x495c74=_0x41ab46;_0x5d6349=0xc8;}else{_0x5d6349=0xce;}_0x2a3e4c['status'](_0x5d6349);return _0x2a3e4c[_0x44b8('0x18')](_0x44b8('0x19'),_0x5e52f2+'-'+_0x495c74+'/'+_0x41ab46)['json'](_0x1722da);}return null;};}function patchUpdates(_0x89bc30){return function(_0x3f4688){try{jsonpatch['apply'](_0x3f4688,_0x89bc30,!![]);}catch(_0xcce202){return BPromise[_0x44b8('0x1a')](_0xcce202);}return _0x3f4688[_0x44b8('0x1b')]();};}function saveUpdates(_0x235bdc,_0x102ef9){return function(_0x369c09){if(_0x369c09){return _0x369c09[_0x44b8('0x1c')](_0x235bdc)[_0x44b8('0x1d')](function(_0x429461){return _0x429461;});}return null;};}function removeEntity(_0x1e0f2d,_0x1d642b){return function(_0x14996c){if(_0x14996c){return _0x14996c['destroy']()[_0x44b8('0x1d')](function(){_0x1e0f2d[_0x44b8('0x1e')](0xcc)[_0x44b8('0x14')]();});}};}function handleEntityNotFound(_0x1418db,_0x305a5c){return function(_0x51a34a){if(!_0x51a34a){_0x1418db[_0x44b8('0x13')](0x194);}return _0x51a34a;};}function handleError(_0x54677c,_0x41a922){_0x41a922=_0x41a922||0x1f4;return function(_0x228c81){logger[_0x44b8('0x1f')](_0x228c81[_0x44b8('0x20')]);if(_0x228c81[_0x44b8('0x21')]){delete _0x228c81['name'];}_0x54677c[_0x44b8('0x1e')](_0x41a922)['send'](_0x228c81);};}exports[_0x44b8('0x22')]=function(_0x350482,_0x549a26){var _0x17ac44={},_0x470f49={},_0x2656d7={'count':0x0,'rows':[]};var _0x59c1bf=_[_0x44b8('0x23')](db[_0x44b8('0x24')]['rawAttributes'],function(_0x2e0174){return{'name':_0x2e0174['fieldName'],'type':_0x2e0174[_0x44b8('0x25')]['key']};});_0x470f49['model']=_['map'](_0x59c1bf,_0x44b8('0x21'));_0x470f49[_0x44b8('0x26')]=_[_0x44b8('0x27')](_0x350482[_0x44b8('0x26')]);_0x470f49[_0x44b8('0x28')]=_[_0x44b8('0x29')](_0x470f49[_0x44b8('0x2a')],_0x470f49[_0x44b8('0x26')]);_0x17ac44[_0x44b8('0x2b')]=_[_0x44b8('0x29')](_0x470f49[_0x44b8('0x2a')],qs[_0x44b8('0x2c')](_0x350482[_0x44b8('0x26')]['fields']));_0x17ac44[_0x44b8('0x2b')]=_0x17ac44['attributes'][_0x44b8('0x2d')]?_0x17ac44[_0x44b8('0x2b')]:_0x470f49[_0x44b8('0x2a')];if(!_0x350482[_0x44b8('0x26')][_0x44b8('0x2e')]('nolimit')){_0x17ac44[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x350482[_0x44b8('0x26')][_0x44b8('0x17')]);_0x17ac44[_0x44b8('0x16')]=qs['offset'](_0x350482[_0x44b8('0x26')][_0x44b8('0x16')]);}_0x17ac44[_0x44b8('0x2f')]=qs[_0x44b8('0x30')](_0x350482[_0x44b8('0x26')][_0x44b8('0x30')]);_0x17ac44[_0x44b8('0x31')]=qs[_0x44b8('0x28')](_[_0x44b8('0x32')](_0x350482[_0x44b8('0x26')],_0x470f49[_0x44b8('0x28')]),_0x59c1bf);if(_0x350482[_0x44b8('0x26')][_0x44b8('0x33')]){_0x17ac44[_0x44b8('0x31')]=_[_0x44b8('0x34')](_0x17ac44[_0x44b8('0x31')],{'$or':_[_0x44b8('0x23')](_0x59c1bf,function(_0xeff999){if(_0xeff999[_0x44b8('0x25')]!==_0x44b8('0x35')){var _0x2c02d6={};_0x2c02d6[_0xeff999[_0x44b8('0x21')]]={'$like':'%'+_0x350482['query'][_0x44b8('0x33')]+'%'};return _0x2c02d6;}})});}_0x17ac44=_[_0x44b8('0x34')]({},_0x17ac44,_0x350482['options']);var _0x25688b={'where':_0x17ac44[_0x44b8('0x31')]};return db[_0x44b8('0x24')][_0x44b8('0x15')](_0x25688b)['then'](function(_0x221543){_0x2656d7[_0x44b8('0x15')]=_0x221543;if(_0x350482[_0x44b8('0x26')][_0x44b8('0x36')]){_0x17ac44[_0x44b8('0x37')]=[{'all':!![]}];}return db[_0x44b8('0x24')][_0x44b8('0x38')](_0x17ac44);})[_0x44b8('0x1d')](function(_0x209039){_0x2656d7[_0x44b8('0x39')]=_0x209039;return _0x2656d7;})[_0x44b8('0x1d')](respondWithFilteredResult(_0x549a26,_0x17ac44))[_0x44b8('0x3a')](handleError(_0x549a26,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 148191a..b246cb0 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 _0x9de3=['../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x9de3,0xea));var _0x39de=function(_0xee0df5,_0x197789){_0xee0df5=_0xee0df5-0x0;var _0x5ecdf7=_0x9de3[_0xee0df5];return _0x5ecdf7;};'use strict';var _=require(_0x39de('0x0'));var util=require('util');var logger=require(_0x39de('0x1'))(_0x39de('0x2'));var moment=require(_0x39de('0x3'));var BPromise=require('bluebird');var rp=require(_0x39de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39de('0x5'));var config=require(_0x39de('0x6'));var attributes=require(_0x39de('0x7'));module[_0x39de('0x8')]=function(_0x529524,_0x2e8f82){return _0x529524[_0x39de('0x9')](_0x39de('0xa'),attributes,{'tableName':_0x39de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7df1=['../../config/environment','./migration.attributes','define','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x3861b5,_0x1d7fef){var _0x31e665=function(_0x1f2a43){while(--_0x1f2a43){_0x3861b5['push'](_0x3861b5['shift']());}};_0x31e665(++_0x1d7fef);}(_0x7df1,0xe4));var _0x17df=function(_0x236564,_0xa5063a){_0x236564=_0x236564-0x0;var _0x439ba1=_0x7df1[_0x236564];return _0x439ba1;};'use strict';var _=require(_0x17df('0x0'));var util=require(_0x17df('0x1'));var logger=require(_0x17df('0x2'))('api');var moment=require(_0x17df('0x3'));var BPromise=require(_0x17df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x17df('0x5'));var config=require(_0x17df('0x6'));var attributes=require(_0x17df('0x7'));module['exports']=function(_0xe829a5,_0x4c0c0e){return _0xe829a5[_0x17df('0x8')]('Migration',attributes,{'tableName':'migrations','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 cc9862e..f33638a 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 _0x8ad0=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Migration,\x20%s,\x20%s'];(function(_0x390069,_0x4432cd){var _0x1ab94c=function(_0x664081){while(--_0x664081){_0x390069['push'](_0x390069['shift']());}};_0x1ab94c(++_0x4432cd);}(_0x8ad0,0xb7));var _0x08ad=function(_0x37052b,_0x3c0eab){_0x37052b=_0x37052b-0x0;var _0x53c2e0=_0x8ad0[_0x37052b];return _0x53c2e0;};'use strict';var _=require(_0x08ad('0x0'));var util=require(_0x08ad('0x1'));var moment=require(_0x08ad('0x2'));var BPromise=require(_0x08ad('0x3'));var rs=require(_0x08ad('0x4'));var fs=require('fs');var Redis=require(_0x08ad('0x5'));var db=require(_0x08ad('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x08ad('0x7'))(_0x08ad('0x8'));var config=require(_0x08ad('0x9'));var jayson=require(_0x08ad('0xa'));var client=jayson[_0x08ad('0xb')][_0x08ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c998f,_0x1014cb,_0x19e38a){return new BPromise(function(_0x3844c8,_0x1640ce){return client['request'](_0x9c998f,_0x19e38a)[_0x08ad('0xd')](function(_0x54dd5f){logger['info'](_0x08ad('0xe'),_0x1014cb,_0x08ad('0xf'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x1014cb,_0x08ad('0xf'),JSON[_0x08ad('0x10')](_0x54dd5f));if(_0x54dd5f['error']){if(_0x54dd5f[_0x08ad('0x11')][_0x08ad('0x12')]===0x1f4){logger[_0x08ad('0x11')](_0x08ad('0xe'),_0x1014cb,_0x54dd5f[_0x08ad('0x11')]['message']);return _0x1640ce(_0x54dd5f[_0x08ad('0x11')][_0x08ad('0x13')]);}logger[_0x08ad('0x11')](_0x08ad('0xe'),_0x1014cb,_0x54dd5f[_0x08ad('0x11')]['message']);return _0x3844c8(_0x54dd5f['error']['message']);}else{logger['info'](_0x08ad('0xe'),_0x1014cb,_0x08ad('0xf'));_0x3844c8(_0x54dd5f[_0x08ad('0x14')][_0x08ad('0x13')]);}})[_0x08ad('0x15')](function(_0x4ec665){logger[_0x08ad('0x11')]('Migration,\x20%s,\x20%s',_0x1014cb,_0x4ec665);_0x1640ce(_0x4ec665);});});} \ No newline at end of file +var _0xf750=['info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xf750,0x117));var _0x0f75=function(_0x140d2f,_0x2ad576){_0x140d2f=_0x140d2f-0x0;var _0x1a04c6=_0xf750[_0x140d2f];return _0x1a04c6;};'use strict';var _=require('lodash');var util=require(_0x0f75('0x0'));var moment=require('moment');var BPromise=require(_0x0f75('0x1'));var rs=require(_0x0f75('0x2'));var fs=require('fs');var Redis=require(_0x0f75('0x3'));var db=require(_0x0f75('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f75('0x5'))(_0x0f75('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f75('0x7'));var client=jayson[_0x0f75('0x8')][_0x0f75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54913e,_0x121f4a,_0x3cafe6){return new BPromise(function(_0x5411e8,_0x1b8be3){return client[_0x0f75('0xa')](_0x54913e,_0x3cafe6)[_0x0f75('0xb')](function(_0x3b1f2c){logger['info']('Migration,\x20%s,\x20%s',_0x121f4a,_0x0f75('0xc'));logger[_0x0f75('0xd')](_0x0f75('0xe'),_0x121f4a,_0x0f75('0xc'),JSON[_0x0f75('0xf')](_0x3b1f2c));if(_0x3b1f2c[_0x0f75('0x10')]){if(_0x3b1f2c[_0x0f75('0x10')][_0x0f75('0x11')]===0x1f4){logger[_0x0f75('0x10')]('Migration,\x20%s,\x20%s',_0x121f4a,_0x3b1f2c[_0x0f75('0x10')][_0x0f75('0x12')]);return _0x1b8be3(_0x3b1f2c[_0x0f75('0x10')][_0x0f75('0x12')]);}logger[_0x0f75('0x10')](_0x0f75('0x13'),_0x121f4a,_0x3b1f2c[_0x0f75('0x10')][_0x0f75('0x12')]);return _0x5411e8(_0x3b1f2c[_0x0f75('0x10')][_0x0f75('0x12')]);}else{logger[_0x0f75('0x14')](_0x0f75('0x13'),_0x121f4a,_0x0f75('0xc'));_0x5411e8(_0x3b1f2c[_0x0f75('0x15')][_0x0f75('0x12')]);}})[_0x0f75('0x16')](function(_0x5cbc30){logger[_0x0f75('0x10')](_0x0f75('0x13'),_0x121f4a,_0x5cbc30);_0x1b8be3(_0x5cbc30);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 341961a..4971e77 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 _0x4ea7=['/:id','show','post','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x466b8c,_0x492ed0){var _0x3f461d=function(_0x1bb52c){while(--_0x1bb52c){_0x466b8c['push'](_0x466b8c['shift']());}};_0x3f461d(++_0x492ed0);}(_0x4ea7,0x1d6));var _0x74ea=function(_0x59d594,_0x35e675){_0x59d594=_0x59d594-0x0;var _0x4ab0a2=_0x4ea7[_0x59d594];return _0x4ab0a2;};'use strict';var multer=require(_0x74ea('0x0'));var util=require(_0x74ea('0x1'));var path=require('path');var timeout=require(_0x74ea('0x2'));var express=require(_0x74ea('0x3'));var router=express[_0x74ea('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x74ea('0x5'));var config=require(_0x74ea('0x6'));var controller=require(_0x74ea('0x7'));router[_0x74ea('0x8')]('/',auth[_0x74ea('0x9')](),controller['index']);router[_0x74ea('0x8')](_0x74ea('0xa'),auth[_0x74ea('0x9')](),controller[_0x74ea('0xb')]);router[_0x74ea('0xc')]('/',auth[_0x74ea('0x9')](),controller['create']);router[_0x74ea('0xd')](_0x74ea('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x74ea('0xe')](_0x74ea('0xa'),auth['isAuthenticated'](),controller[_0x74ea('0xf')]);module['exports']=router; \ No newline at end of file +var _0x277c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','index','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x52f6e5,_0x338c96){var _0x5a4304=function(_0x7cb80b){while(--_0x7cb80b){_0x52f6e5['push'](_0x52f6e5['shift']());}};_0x5a4304(++_0x338c96);}(_0x277c,0x153));var _0xc277=function(_0x81bbc3,_0x353d30){_0x81bbc3=_0x81bbc3-0x0;var _0x2b1104=_0x277c[_0x81bbc3];return _0x2b1104;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var auth=require(_0xc277('0x5'));var interaction=require(_0xc277('0x6'));var config=require(_0xc277('0x7'));var controller=require(_0xc277('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc277('0x9')]);router['get'](_0xc277('0xa'),auth['isAuthenticated'](),controller[_0xc277('0xb')]);router[_0xc277('0xc')]('/',auth['isAuthenticated'](),controller[_0xc277('0xd')]);router[_0xc277('0xe')](_0xc277('0xa'),auth[_0xc277('0xf')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc277('0x12')]);module[_0xc277('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 129971e..aa1cef5 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(_0x3487a5,_0x45fa2){var _0x18a29a=function(_0x19775c){while(--_0x19775c){_0x3487a5['push'](_0x3487a5['shift']());}};_0x18a29a(++_0x45fa2);}(_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')]={'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(_0x204f60,_0x1247cc){var _0x3fb242=function(_0x50e617){while(--_0x50e617){_0x204f60['push'](_0x204f60['shift']());}};_0x3fb242(++_0x1247cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 c8484d1..8cf3410 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 _0x17da=['then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','map','Network','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','type','merge','options','count','includeAll','include','findAll','rows','show','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','create','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','update','find','params','server/files/templates/network.ejs','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0x17da,0x18a));var _0xa17d=function(_0x237753,_0x23a765){_0x237753=_0x237753-0x0;var _0x620b53=_0x17da[_0x237753];return _0x620b53;};'use strict';var pdf=require(_0xa17d('0x0'));var emlformat=require(_0xa17d('0x1'));var rimraf=require(_0xa17d('0x2'));var zipdir=require(_0xa17d('0x3'));var jsonpatch=require(_0xa17d('0x4'));var rp=require('request-promise');var moment=require(_0xa17d('0x5'));var BPromise=require(_0xa17d('0x6'));var Mustache=require(_0xa17d('0x7'));var util=require(_0xa17d('0x8'));var path=require('path');var sox=require(_0xa17d('0x9'));var csv=require(_0xa17d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa17d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa17d('0xc'));var deskjs=require(_0xa17d('0xd'));var toCsv=require(_0xa17d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa17d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa17d('0xf'));var hardwareService=require(_0xa17d('0x10'));var logger=require('../../config/logger')(_0xa17d('0x11'));var utils=require(_0xa17d('0x12'));var config=require(_0xa17d('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa17d('0x14'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4c0ee3,_0x28ed24,_0x5e377f){if(_0x5e377f){var _0xc5129d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc5129d[_0xa17d('0x15')](_0x28ed24)){return _0x4c0ee3;}else{throw new db[(_0xa17d('0x16'))][(_0xa17d('0x17'))](_0xa17d('0x18'));}}else{return _0x4c0ee3;}}function respondWithRpcPromise(_0x2f6ca7,_0x1a303f,_0x2314c1,_0x50f018){return new BPromise(function(_0x3e06c7,_0x4e9b6c){var _0x3ba128=_0x50f018||client;return _0x3ba128[_0xa17d('0x19')](_0x2f6ca7,_0x2314c1)[_0xa17d('0x1a')](function(_0x1d9a2c){logger[_0xa17d('0x1b')](_0xa17d('0x1c'),_0x1a303f,_0xa17d('0x1d'));logger['debug'](_0xa17d('0x1e'),_0x1a303f,_0xa17d('0x1d'),JSON['stringify'](_0x1d9a2c));if(_0x1d9a2c[_0xa17d('0x1f')]){if(_0x1d9a2c[_0xa17d('0x1f')][_0xa17d('0x20')]===0x1f4){logger[_0xa17d('0x1f')](_0xa17d('0x1c'),_0x1a303f,_0x1d9a2c[_0xa17d('0x1f')][_0xa17d('0x21')]);return _0x4e9b6c(_0x1d9a2c[_0xa17d('0x1f')]['message']);}logger[_0xa17d('0x1f')](_0xa17d('0x1c'),_0x1a303f,_0x1d9a2c['error'][_0xa17d('0x21')]);return _0x3e06c7(_0x1d9a2c[_0xa17d('0x1f')]['message']);}else{logger[_0xa17d('0x1b')](_0xa17d('0x1c'),_0x1a303f,_0xa17d('0x1d'));_0x3e06c7(_0x1d9a2c[_0xa17d('0x22')][_0xa17d('0x21')]);}})[_0xa17d('0x23')](function(_0x5c7736){logger[_0xa17d('0x1f')](_0xa17d('0x1c'),_0x1a303f,_0x5c7736);_0x4e9b6c(_0x5c7736);});});}function respondWithStatusCode(_0x480ad4,_0x26ec85){_0x26ec85=_0x26ec85||0xcc;return function(_0x4d2c07){if(_0x4d2c07){return _0x480ad4[_0xa17d('0x24')](_0x26ec85);}return _0x480ad4[_0xa17d('0x25')](_0x26ec85)[_0xa17d('0x26')]();};}function respondWithResult(_0x21ae06,_0x5a18dd){_0x5a18dd=_0x5a18dd||0xc8;return function(_0x4bc5ef){if(_0x4bc5ef){return _0x21ae06['status'](_0x5a18dd)[_0xa17d('0x27')](_0x4bc5ef);}};}function respondWithFilteredResult(_0x5a5b98,_0x2ae3e2){return function(_0x3b3451){if(_0x3b3451){var _0x26312f=_0x3b3451['count'],_0x266735=_0x2ae3e2[_0xa17d('0x28')],_0x4a2973=_0x2ae3e2[_0xa17d('0x28')]+_0x2ae3e2[_0xa17d('0x29')],_0x3c23a4;if(_0x4a2973>=_0x26312f){_0x4a2973=_0x26312f;_0x3c23a4=0xc8;}else{_0x3c23a4=0xce;}_0x5a5b98['status'](_0x3c23a4);return _0x5a5b98[_0xa17d('0x2a')](_0xa17d('0x2b'),_0x266735+'-'+_0x4a2973+'/'+_0x26312f)['json'](_0x3b3451);}return null;};}function patchUpdates(_0x211c09){return function(_0x11642b){try{jsonpatch[_0xa17d('0x2c')](_0x11642b,_0x211c09,!![]);}catch(_0x395c0c){return BPromise[_0xa17d('0x2d')](_0x395c0c);}return _0x11642b[_0xa17d('0x2e')]();};}function saveUpdates(_0x59ea9f,_0x9780a3){return function(_0x2cbec7){if(_0x2cbec7){return _0x2cbec7['update'](_0x59ea9f)[_0xa17d('0x1a')](function(_0x9dfe2b){return _0x9dfe2b;});}return null;};}function removeEntity(_0x466bdd,_0x22c543){return function(_0x58c9ec){if(_0x58c9ec){return _0x58c9ec[_0xa17d('0x2f')]()[_0xa17d('0x1a')](function(){_0x466bdd[_0xa17d('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f3d0,_0x281055){return function(_0x1e4841){if(!_0x1e4841){_0x47f3d0[_0xa17d('0x24')](0x194);}return _0x1e4841;};}function handleError(_0x348073,_0x149639){_0x149639=_0x149639||0x1f4;return function(_0xaae783){logger[_0xa17d('0x1f')](_0xaae783[_0xa17d('0x30')]);if(_0xaae783[_0xa17d('0x31')]){delete _0xaae783[_0xa17d('0x31')];}_0x348073['status'](_0x149639)['send'](_0xaae783);};}exports[_0xa17d('0x32')]=function(_0x4694f0,_0x245aef){var _0x48a097={},_0x3115ea={},_0x1f75a8={'count':0x0,'rows':[]};var _0x52abba=_[_0xa17d('0x33')](db[_0xa17d('0x34')][_0xa17d('0x35')],function(_0x560448){return{'name':_0x560448[_0xa17d('0x36')],'type':_0x560448['type'][_0xa17d('0x37')]};});_0x3115ea[_0xa17d('0x38')]=_['map'](_0x52abba,_0xa17d('0x31'));_0x3115ea[_0xa17d('0x39')]=_[_0xa17d('0x3a')](_0x4694f0[_0xa17d('0x39')]);_0x3115ea['filters']=_[_0xa17d('0x3b')](_0x3115ea['model'],_0x3115ea[_0xa17d('0x39')]);_0x48a097[_0xa17d('0x3c')]=_[_0xa17d('0x3b')](_0x3115ea[_0xa17d('0x38')],qs['fields'](_0x4694f0['query'][_0xa17d('0x3d')]));_0x48a097[_0xa17d('0x3c')]=_0x48a097[_0xa17d('0x3c')][_0xa17d('0x3e')]?_0x48a097[_0xa17d('0x3c')]:_0x3115ea[_0xa17d('0x38')];if(!_0x4694f0[_0xa17d('0x39')]['hasOwnProperty']('nolimit')){_0x48a097[_0xa17d('0x29')]=qs[_0xa17d('0x29')](_0x4694f0[_0xa17d('0x39')]['limit']);_0x48a097[_0xa17d('0x28')]=qs['offset'](_0x4694f0[_0xa17d('0x39')][_0xa17d('0x28')]);}_0x48a097[_0xa17d('0x3f')]=qs[_0xa17d('0x40')](_0x4694f0[_0xa17d('0x39')]['sort']);_0x48a097['where']=qs[_0xa17d('0x41')](_[_0xa17d('0x42')](_0x4694f0['query'],_0x3115ea[_0xa17d('0x41')]),_0x52abba);if(_0x4694f0[_0xa17d('0x39')][_0xa17d('0x43')]){_0x48a097[_0xa17d('0x44')]=_['merge'](_0x48a097[_0xa17d('0x44')],{'$or':_[_0xa17d('0x33')](_0x52abba,function(_0x34915d){if(_0x34915d[_0xa17d('0x45')]!=='VIRTUAL'){var _0x2306a1={};_0x2306a1[_0x34915d[_0xa17d('0x31')]]={'$like':'%'+_0x4694f0[_0xa17d('0x39')][_0xa17d('0x43')]+'%'};return _0x2306a1;}})});}_0x48a097=_[_0xa17d('0x46')]({},_0x48a097,_0x4694f0[_0xa17d('0x47')]);var _0x3b5ad1={'where':_0x48a097['where']};return db[_0xa17d('0x34')][_0xa17d('0x48')](_0x3b5ad1)['then'](function(_0x252f7d){_0x1f75a8[_0xa17d('0x48')]=_0x252f7d;if(_0x4694f0[_0xa17d('0x39')][_0xa17d('0x49')]){_0x48a097[_0xa17d('0x4a')]=[{'all':!![]}];}return db[_0xa17d('0x34')][_0xa17d('0x4b')](_0x48a097);})[_0xa17d('0x1a')](function(_0x4de8dd){_0x1f75a8[_0xa17d('0x4c')]=_0x4de8dd;return _0x1f75a8;})[_0xa17d('0x1a')](respondWithFilteredResult(_0x245aef,_0x48a097))[_0xa17d('0x23')](handleError(_0x245aef,null));};exports[_0xa17d('0x4d')]=function(_0x944223,_0x43be28){var _0x2f7ebb={'raw':!![],'where':{'id':_0x944223['params']['id']}},_0x11ad09={};_0x11ad09[_0xa17d('0x38')]=_[_0xa17d('0x3a')](db[_0xa17d('0x34')]['rawAttributes']);_0x11ad09['query']=_[_0xa17d('0x3a')](_0x944223[_0xa17d('0x39')]);_0x11ad09[_0xa17d('0x41')]=_[_0xa17d('0x3b')](_0x11ad09[_0xa17d('0x38')],_0x11ad09['query']);_0x2f7ebb[_0xa17d('0x3c')]=_['intersection'](_0x11ad09[_0xa17d('0x38')],qs['fields'](_0x944223[_0xa17d('0x39')][_0xa17d('0x3d')]));_0x2f7ebb['attributes']=_0x2f7ebb[_0xa17d('0x3c')][_0xa17d('0x3e')]?_0x2f7ebb['attributes']:_0x11ad09[_0xa17d('0x38')];if(_0x944223[_0xa17d('0x39')][_0xa17d('0x49')]){_0x2f7ebb[_0xa17d('0x4a')]=[{'all':!![]}];}_0x2f7ebb=_[_0xa17d('0x46')]({},_0x2f7ebb,_0x944223[_0xa17d('0x47')]);return db[_0xa17d('0x34')]['find'](_0x2f7ebb)['then'](handleEntityNotFound(_0x43be28,null))[_0xa17d('0x1a')](respondWithResult(_0x43be28,null))['catch'](handleError(_0x43be28,null));};exports['create']=function(_0x19e7de,_0x907410,_0x4840e6){var _0x453576;return db[_0xa17d('0x4e')][_0xa17d('0x4f')](function(_0x5d2e1a){return db['Network']['create'](_0x19e7de[_0xa17d('0x50')],{'raw':!![]})[_0xa17d('0x1a')](function(_0x2d39b2){_0x453576=_0x2d39b2;return db[_0xa17d('0x34')][_0xa17d('0x4b')]({'where':{'type':_0x19e7de[_0xa17d('0x50')]['type']},'raw':!![]});})[_0xa17d('0x1a')](function(_0x3fcaeb){if(_0x453576[_0xa17d('0x45')][_0xa17d('0x51')]()==_0xa17d('0x52')){var _0x2eb41a=fs[_0xa17d('0x53')](path[_0xa17d('0x54')](config['root'],_0xa17d('0x55')),_0xa17d('0x56'));var _0x18c3a4=ejs[_0xa17d('0x57')](_0x2eb41a,{'networks':_0x3fcaeb||[]});fs[_0xa17d('0x58')](_0xa17d('0x59'),_0x18c3a4);return respondWithRpcPromise('Reload',_0xa17d('0x5a'),{'module':_0xa17d('0x5b')});}else if(_0x453576['type']['toUpperCase']()==_0xa17d('0x5c')){var _0x238f48=fs[_0xa17d('0x53')](path[_0xa17d('0x54')](config[_0xa17d('0x5d')],_0xa17d('0x5e')),_0xa17d('0x56'));var _0x3a030b=ejs[_0xa17d('0x57')](_0x238f48,{'networks':_0x3fcaeb||[]});fs['writeFileSync'](_0xa17d('0x5f'),_0x3a030b);return respondWithRpcPromise('Reload',_0xa17d('0x5a'),{'module':'res_stun_monitor.so'});}else{var _0x49656f=fs[_0xa17d('0x53')](path['join'](config[_0xa17d('0x5d')],'server/files/templates/network.ejs'),_0xa17d('0x56'));var _0x30bd97=ejs[_0xa17d('0x57')](_0x49656f,{'networks':_0x3fcaeb||[]});fs[_0xa17d('0x58')](util[_0xa17d('0x60')](_0xa17d('0x61'),_0x19e7de[_0xa17d('0x50')][_0xa17d('0x45')][_0xa17d('0x62')]()),_0x30bd97);return respondWithRpcPromise(_0xa17d('0x63'),'create',{'module':'chan_sip.so'});}return null;})[_0xa17d('0x1a')](function(){return _0x453576;});})[_0xa17d('0x1a')](respondWithResult(_0x907410,0xc9))['catch'](handleError(_0x907410,null));};exports[_0xa17d('0x64')]=function(_0x28b061,_0x668619,_0x5614a5){var _0x4c95c1;return db['sequelize'][_0xa17d('0x4f')](function(_0x44c06b){return db[_0xa17d('0x34')][_0xa17d('0x65')]({'where':{'id':_0x28b061[_0xa17d('0x66')]['id']}})[_0xa17d('0x1a')](handleEntityNotFound(_0x668619,null))['then'](saveUpdates(_0x28b061[_0xa17d('0x50')],null))[_0xa17d('0x1a')](function(_0x253b3e){if(_0x253b3e){_0x4c95c1=_0x253b3e;return db[_0xa17d('0x34')]['findAll']({'where':{'type':_0x4c95c1[_0xa17d('0x45')]},'raw':!![]});}return null;})['then'](function(_0x3648bd){if(_0x4c95c1[_0xa17d('0x45')][_0xa17d('0x51')]()==_0xa17d('0x52')){var _0x2b858a=fs[_0xa17d('0x53')](path[_0xa17d('0x54')](config[_0xa17d('0x5d')],_0xa17d('0x55')),'utf8');var _0x440291=ejs[_0xa17d('0x57')](_0x2b858a,{'networks':_0x3648bd||[]});fs[_0xa17d('0x58')](_0xa17d('0x59'),_0x440291);return respondWithRpcPromise(_0xa17d('0x63'),'update',{'module':_0xa17d('0x5b')});}else if(_0x4c95c1[_0xa17d('0x45')][_0xa17d('0x51')]()==_0xa17d('0x5c')){var _0x1bd3c3=fs[_0xa17d('0x53')](path[_0xa17d('0x54')](config[_0xa17d('0x5d')],_0xa17d('0x5e')),_0xa17d('0x56'));var _0x118232=ejs[_0xa17d('0x57')](_0x1bd3c3,{'networks':_0x3648bd||[]});fs[_0xa17d('0x58')](_0xa17d('0x5f'),_0x118232);return respondWithRpcPromise(_0xa17d('0x63'),_0xa17d('0x64'),{'module':_0xa17d('0x5b')});}else{var _0x5c5d91=fs[_0xa17d('0x53')](path['join'](config[_0xa17d('0x5d')],_0xa17d('0x67')),_0xa17d('0x56'));var _0x4204a2=ejs[_0xa17d('0x57')](_0x5c5d91,{'networks':_0x3648bd||[]});fs[_0xa17d('0x58')](util[_0xa17d('0x60')](_0xa17d('0x61'),_0x28b061[_0xa17d('0x50')][_0xa17d('0x45')]['toLowerCase']()),_0x4204a2);return respondWithRpcPromise(_0xa17d('0x63'),_0xa17d('0x64'),{'module':_0xa17d('0x68')});}return null;})[_0xa17d('0x1a')](function(_0x590670){if(_0x590670){return _0x4c95c1;}return null;});})[_0xa17d('0x1a')](respondWithResult(_0x668619,null))[_0xa17d('0x23')](handleError(_0x668619,null));};exports['destroy']=function(_0x4c180d,_0x5763be,_0x101c05){var _0x1af5e0;return db[_0xa17d('0x34')][_0xa17d('0x65')]({'where':{'id':_0x4c180d[_0xa17d('0x66')]['id']}})[_0xa17d('0x1a')](function(_0x27eddf){_0x1af5e0=_0x27eddf;return _0x27eddf;})[_0xa17d('0x1a')](handleEntityNotFound(_0x5763be,null))[_0xa17d('0x1a')](removeEntity(_0x5763be,null))[_0xa17d('0x1a')](function(){if(_0x1af5e0){return db[_0xa17d('0x34')][_0xa17d('0x4b')]({'where':{'type':_0x1af5e0['type']},'raw':!![]});}})[_0xa17d('0x1a')](function(_0x58d41c){if(_0x1af5e0[_0xa17d('0x45')][_0xa17d('0x51')]()=='STUN'){var _0x2eb208=fs[_0xa17d('0x53')](path['join'](config[_0xa17d('0x5d')],_0xa17d('0x55')),_0xa17d('0x56'));var _0x391984=ejs[_0xa17d('0x57')](_0x2eb208,{'networks':_0x58d41c||[]});fs[_0xa17d('0x58')]('/etc/asterisk/stun_xcally.conf',_0x391984);return respondWithRpcPromise(_0xa17d('0x63'),'destroy',{'module':_0xa17d('0x5b')});}else if(_0x1af5e0[_0xa17d('0x45')][_0xa17d('0x51')]()==_0xa17d('0x5c')){var _0x8fa17b=fs[_0xa17d('0x53')](path[_0xa17d('0x54')](config[_0xa17d('0x5d')],_0xa17d('0x5e')),'utf8');var _0x483a7c=ejs[_0xa17d('0x57')](_0x8fa17b,{'networks':_0x58d41c||[]});fs[_0xa17d('0x58')]('/etc/asterisk/turn_xcally.conf',_0x483a7c);return respondWithRpcPromise(_0xa17d('0x63'),_0xa17d('0x2f'),{'module':_0xa17d('0x5b')});}else{var _0x1a9af1=fs['readFileSync'](path[_0xa17d('0x54')](config[_0xa17d('0x5d')],'server/files/templates/network.ejs'),_0xa17d('0x56'));var _0x4ca858=ejs[_0xa17d('0x57')](_0x1a9af1,{'networks':_0x58d41c||[]});fs[_0xa17d('0x58')](util[_0xa17d('0x60')](_0xa17d('0x61'),_0x4c180d[_0xa17d('0x50')][_0xa17d('0x45')][_0xa17d('0x62')]()),_0x4ca858);return respondWithRpcPromise('Reload',_0xa17d('0x2f'),{'module':_0xa17d('0x68')});}return null;})[_0xa17d('0x23')](handleError(_0x5763be,null));}; \ No newline at end of file +var _0x525e=['format','chan_sip.so','sequelize','server/files/templates/stun_multiple.ejs','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','Network,\x20%s,\x20%s','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','transaction','body','toUpperCase','STUN','readFileSync','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','create','TURN','join','root','render','/etc/asterisk/turn_xcally.conf'];(function(_0xbe18c1,_0x4c0bb3){var _0xcaaf01=function(_0x27d071){while(--_0x27d071){_0xbe18c1['push'](_0xbe18c1['shift']());}};_0xcaaf01(++_0x4c0bb3);}(_0x525e,0x78));var _0xe525=function(_0x2fceed,_0xd983dc){_0x2fceed=_0x2fceed-0x0;var _0x28f0f3=_0x525e[_0x2fceed];return _0x28f0f3;};'use strict';var pdf=require(_0xe525('0x0'));var emlformat=require(_0xe525('0x1'));var rimraf=require(_0xe525('0x2'));var zipdir=require(_0xe525('0x3'));var jsonpatch=require(_0xe525('0x4'));var rp=require(_0xe525('0x5'));var moment=require(_0xe525('0x6'));var BPromise=require(_0xe525('0x7'));var Mustache=require('mustache');var util=require(_0xe525('0x8'));var path=require(_0xe525('0x9'));var sox=require(_0xe525('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe525('0xb'));var squel=require('squel');var crypto=require(_0xe525('0xc'));var jsforce=require(_0xe525('0xd'));var deskjs=require(_0xe525('0xe'));var toCsv=require(_0xe525('0xf'));var querystring=require(_0xe525('0x10'));var Papa=require(_0xe525('0x11'));var Redis=require(_0xe525('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe525('0x13'));var as=require(_0xe525('0x14'));var hardwareService=require(_0xe525('0x15'));var logger=require(_0xe525('0x16'))(_0xe525('0x17'));var utils=require('../../config/utils');var config=require(_0xe525('0x18'));var db=require(_0xe525('0x19'))['db'];var jayson=require(_0xe525('0x1a'));var client=jayson[_0xe525('0x1b')][_0xe525('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1faf27,_0x348915,_0x222d90){if(_0x222d90){var _0xa275c4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa275c4[_0xe525('0x1d')](_0x348915)){return _0x1faf27;}else{throw new db[(_0xe525('0x1e'))]['ValidationError'](_0xe525('0x1f'));}}else{return _0x1faf27;}}function respondWithRpcPromise(_0x31e108,_0x1d7f16,_0x4ef025,_0x2488b7){return new BPromise(function(_0x2ded1c,_0x23d220){var _0x107f40=_0x2488b7||client;return _0x107f40[_0xe525('0x20')](_0x31e108,_0x4ef025)['then'](function(_0x5558d9){logger[_0xe525('0x21')]('Network,\x20%s,\x20%s',_0x1d7f16,_0xe525('0x22'));logger[_0xe525('0x23')](_0xe525('0x24'),_0x1d7f16,_0xe525('0x22'),JSON[_0xe525('0x25')](_0x5558d9));if(_0x5558d9[_0xe525('0x26')]){if(_0x5558d9[_0xe525('0x26')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x1d7f16,_0x5558d9['error'][_0xe525('0x27')]);return _0x23d220(_0x5558d9[_0xe525('0x26')][_0xe525('0x27')]);}logger[_0xe525('0x26')](_0xe525('0x28'),_0x1d7f16,_0x5558d9[_0xe525('0x26')][_0xe525('0x27')]);return _0x2ded1c(_0x5558d9['error'][_0xe525('0x27')]);}else{logger[_0xe525('0x21')]('Network,\x20%s,\x20%s',_0x1d7f16,_0xe525('0x22'));_0x2ded1c(_0x5558d9[_0xe525('0x29')][_0xe525('0x27')]);}})['catch'](function(_0x6fc035){logger[_0xe525('0x26')](_0xe525('0x28'),_0x1d7f16,_0x6fc035);_0x23d220(_0x6fc035);});});}function respondWithStatusCode(_0x121980,_0x42a428){_0x42a428=_0x42a428||0xcc;return function(_0x4d5226){if(_0x4d5226){return _0x121980[_0xe525('0x2a')](_0x42a428);}return _0x121980[_0xe525('0x2b')](_0x42a428)[_0xe525('0x2c')]();};}function respondWithResult(_0x2872b9,_0x44098a){_0x44098a=_0x44098a||0xc8;return function(_0x517849){if(_0x517849){return _0x2872b9[_0xe525('0x2b')](_0x44098a)[_0xe525('0x2d')](_0x517849);}};}function respondWithFilteredResult(_0x3facd4,_0x43a4da){return function(_0x537728){if(_0x537728){var _0x1112a8=_0x537728[_0xe525('0x2e')],_0x2d2623=_0x43a4da['offset'],_0xc75d0f=_0x43a4da[_0xe525('0x2f')]+_0x43a4da[_0xe525('0x30')],_0x4bccb3;if(_0xc75d0f>=_0x1112a8){_0xc75d0f=_0x1112a8;_0x4bccb3=0xc8;}else{_0x4bccb3=0xce;}_0x3facd4['status'](_0x4bccb3);return _0x3facd4[_0xe525('0x31')]('Content-Range',_0x2d2623+'-'+_0xc75d0f+'/'+_0x1112a8)[_0xe525('0x2d')](_0x537728);}return null;};}function patchUpdates(_0x2c4a12){return function(_0x534545){try{jsonpatch[_0xe525('0x32')](_0x534545,_0x2c4a12,!![]);}catch(_0x57dafc){return BPromise[_0xe525('0x33')](_0x57dafc);}return _0x534545[_0xe525('0x34')]();};}function saveUpdates(_0x1af210,_0x263ef4){return function(_0x1ef0ba){if(_0x1ef0ba){return _0x1ef0ba[_0xe525('0x35')](_0x1af210)[_0xe525('0x36')](function(_0x8bdb8){return _0x8bdb8;});}return null;};}function removeEntity(_0xf645,_0x3f3964){return function(_0x1f28a7){if(_0x1f28a7){return _0x1f28a7[_0xe525('0x37')]()[_0xe525('0x36')](function(){_0xf645[_0xe525('0x2b')](0xcc)[_0xe525('0x2c')]();});}};}function handleEntityNotFound(_0x38ac7a,_0x4e386b){return function(_0x37fc67){if(!_0x37fc67){_0x38ac7a[_0xe525('0x2a')](0x194);}return _0x37fc67;};}function handleError(_0x35833e,_0x4e6e5f){_0x4e6e5f=_0x4e6e5f||0x1f4;return function(_0x18f322){logger['error'](_0x18f322['stack']);if(_0x18f322[_0xe525('0x38')]){delete _0x18f322['name'];}_0x35833e['status'](_0x4e6e5f)[_0xe525('0x39')](_0x18f322);};}exports[_0xe525('0x3a')]=function(_0x2e85b6,_0x573191){var _0x27b3af={},_0x5a2c57={},_0x47fea5={'count':0x0,'rows':[]};var _0x27b2a1=_[_0xe525('0x3b')](db[_0xe525('0x3c')][_0xe525('0x3d')],function(_0x332f47){return{'name':_0x332f47[_0xe525('0x3e')],'type':_0x332f47[_0xe525('0x3f')][_0xe525('0x40')]};});_0x5a2c57[_0xe525('0x41')]=_[_0xe525('0x3b')](_0x27b2a1,_0xe525('0x38'));_0x5a2c57[_0xe525('0x42')]=_['keys'](_0x2e85b6[_0xe525('0x42')]);_0x5a2c57[_0xe525('0x43')]=_[_0xe525('0x44')](_0x5a2c57['model'],_0x5a2c57[_0xe525('0x42')]);_0x27b3af[_0xe525('0x45')]=_['intersection'](_0x5a2c57[_0xe525('0x41')],qs['fields'](_0x2e85b6[_0xe525('0x42')][_0xe525('0x46')]));_0x27b3af[_0xe525('0x45')]=_0x27b3af[_0xe525('0x45')][_0xe525('0x47')]?_0x27b3af[_0xe525('0x45')]:_0x5a2c57[_0xe525('0x41')];if(!_0x2e85b6[_0xe525('0x42')]['hasOwnProperty']('nolimit')){_0x27b3af[_0xe525('0x30')]=qs['limit'](_0x2e85b6[_0xe525('0x42')]['limit']);_0x27b3af[_0xe525('0x2f')]=qs['offset'](_0x2e85b6[_0xe525('0x42')][_0xe525('0x2f')]);}_0x27b3af['order']=qs['sort'](_0x2e85b6[_0xe525('0x42')][_0xe525('0x48')]);_0x27b3af['where']=qs[_0xe525('0x43')](_[_0xe525('0x49')](_0x2e85b6[_0xe525('0x42')],_0x5a2c57[_0xe525('0x43')]),_0x27b2a1);if(_0x2e85b6['query'][_0xe525('0x4a')]){_0x27b3af[_0xe525('0x4b')]=_[_0xe525('0x4c')](_0x27b3af[_0xe525('0x4b')],{'$or':_[_0xe525('0x3b')](_0x27b2a1,function(_0x4efddf){if(_0x4efddf[_0xe525('0x3f')]!==_0xe525('0x4d')){var _0x964541={};_0x964541[_0x4efddf[_0xe525('0x38')]]={'$like':'%'+_0x2e85b6[_0xe525('0x42')]['filter']+'%'};return _0x964541;}})});}_0x27b3af=_['merge']({},_0x27b3af,_0x2e85b6[_0xe525('0x4e')]);var _0x3d2c0f={'where':_0x27b3af['where']};return db[_0xe525('0x3c')][_0xe525('0x2e')](_0x3d2c0f)[_0xe525('0x36')](function(_0x12fb48){_0x47fea5[_0xe525('0x2e')]=_0x12fb48;if(_0x2e85b6[_0xe525('0x42')]['includeAll']){_0x27b3af[_0xe525('0x4f')]=[{'all':!![]}];}return db[_0xe525('0x3c')][_0xe525('0x50')](_0x27b3af);})[_0xe525('0x36')](function(_0x2211dd){_0x47fea5[_0xe525('0x51')]=_0x2211dd;return _0x47fea5;})[_0xe525('0x36')](respondWithFilteredResult(_0x573191,_0x27b3af))[_0xe525('0x52')](handleError(_0x573191,null));};exports[_0xe525('0x53')]=function(_0x368fd7,_0x380601){var _0x365194={'raw':!![],'where':{'id':_0x368fd7[_0xe525('0x54')]['id']}},_0x59c6e5={};_0x59c6e5['model']=_[_0xe525('0x55')](db[_0xe525('0x3c')]['rawAttributes']);_0x59c6e5[_0xe525('0x42')]=_[_0xe525('0x55')](_0x368fd7[_0xe525('0x42')]);_0x59c6e5[_0xe525('0x43')]=_[_0xe525('0x44')](_0x59c6e5[_0xe525('0x41')],_0x59c6e5[_0xe525('0x42')]);_0x365194[_0xe525('0x45')]=_[_0xe525('0x44')](_0x59c6e5[_0xe525('0x41')],qs[_0xe525('0x46')](_0x368fd7[_0xe525('0x42')][_0xe525('0x46')]));_0x365194[_0xe525('0x45')]=_0x365194[_0xe525('0x45')][_0xe525('0x47')]?_0x365194[_0xe525('0x45')]:_0x59c6e5[_0xe525('0x41')];if(_0x368fd7[_0xe525('0x42')]['includeAll']){_0x365194[_0xe525('0x4f')]=[{'all':!![]}];}_0x365194=_[_0xe525('0x4c')]({},_0x365194,_0x368fd7[_0xe525('0x4e')]);return db[_0xe525('0x3c')][_0xe525('0x56')](_0x365194)[_0xe525('0x36')](handleEntityNotFound(_0x380601,null))[_0xe525('0x36')](respondWithResult(_0x380601,null))[_0xe525('0x52')](handleError(_0x380601,null));};exports['create']=function(_0x3efdc6,_0x3189c9,_0x5de3b7){var _0x5b046d;return db['sequelize'][_0xe525('0x57')](function(_0x3466c3){return db[_0xe525('0x3c')]['create'](_0x3efdc6[_0xe525('0x58')],{'raw':!![]})[_0xe525('0x36')](function(_0x46aa56){_0x5b046d=_0x46aa56;return db['Network'][_0xe525('0x50')]({'where':{'type':_0x3efdc6['body'][_0xe525('0x3f')]},'raw':!![]});})[_0xe525('0x36')](function(_0x36f0b8){if(_0x5b046d[_0xe525('0x3f')][_0xe525('0x59')]()==_0xe525('0x5a')){var _0x5e150c=fs[_0xe525('0x5b')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0xe525('0x5c'));var _0x10b71b=ejs['render'](_0x5e150c,{'networks':_0x36f0b8||[]});fs[_0xe525('0x5d')](_0xe525('0x5e'),_0x10b71b);return respondWithRpcPromise(_0xe525('0x5f'),_0xe525('0x60'),{'module':'res_stun_monitor.so'});}else if(_0x5b046d['type'][_0xe525('0x59')]()==_0xe525('0x61')){var _0x157015=fs[_0xe525('0x5b')](path[_0xe525('0x62')](config[_0xe525('0x63')],'server/files/templates/turn_multiple.ejs'),_0xe525('0x5c'));var _0x43815b=ejs[_0xe525('0x64')](_0x157015,{'networks':_0x36f0b8||[]});fs[_0xe525('0x5d')](_0xe525('0x65'),_0x43815b);return respondWithRpcPromise(_0xe525('0x5f'),_0xe525('0x60'),{'module':'res_stun_monitor.so'});}else{var _0x3a04a0=fs[_0xe525('0x5b')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xe525('0x5c'));var _0x311cf7=ejs['render'](_0x3a04a0,{'networks':_0x36f0b8||[]});fs['writeFileSync'](util[_0xe525('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x3efdc6['body'][_0xe525('0x3f')]['toLowerCase']()),_0x311cf7);return respondWithRpcPromise(_0xe525('0x5f'),_0xe525('0x60'),{'module':_0xe525('0x67')});}return null;})['then'](function(){return _0x5b046d;});})[_0xe525('0x36')](respondWithResult(_0x3189c9,0xc9))[_0xe525('0x52')](handleError(_0x3189c9,null));};exports[_0xe525('0x35')]=function(_0x42a095,_0x3c5918,_0x4ba1ab){var _0x3dd6d7;return db[_0xe525('0x68')]['transaction'](function(_0x350d97){return db['Network']['find']({'where':{'id':_0x42a095[_0xe525('0x54')]['id']}})[_0xe525('0x36')](handleEntityNotFound(_0x3c5918,null))[_0xe525('0x36')](saveUpdates(_0x42a095['body'],null))[_0xe525('0x36')](function(_0x42a930){if(_0x42a930){_0x3dd6d7=_0x42a930;return db['Network'][_0xe525('0x50')]({'where':{'type':_0x3dd6d7[_0xe525('0x3f')]},'raw':!![]});}return null;})[_0xe525('0x36')](function(_0x5a5269){if(_0x3dd6d7[_0xe525('0x3f')]['toUpperCase']()=='STUN'){var _0x3b8477=fs[_0xe525('0x5b')](path[_0xe525('0x62')](config[_0xe525('0x63')],_0xe525('0x69')),_0xe525('0x5c'));var _0xdb08ac=ejs[_0xe525('0x64')](_0x3b8477,{'networks':_0x5a5269||[]});fs['writeFileSync'](_0xe525('0x5e'),_0xdb08ac);return respondWithRpcPromise(_0xe525('0x5f'),'update',{'module':_0xe525('0x6a')});}else if(_0x3dd6d7[_0xe525('0x3f')][_0xe525('0x59')]()==_0xe525('0x61')){var _0x1706c2=fs['readFileSync'](path[_0xe525('0x62')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xe525('0x5c'));var _0x23bae9=ejs['render'](_0x1706c2,{'networks':_0x5a5269||[]});fs[_0xe525('0x5d')](_0xe525('0x65'),_0x23bae9);return respondWithRpcPromise(_0xe525('0x5f'),_0xe525('0x35'),{'module':_0xe525('0x6a')});}else{var _0x2cf4f8=fs[_0xe525('0x5b')](path[_0xe525('0x62')](config['root'],'server/files/templates/network.ejs'),_0xe525('0x5c'));var _0x57fc0e=ejs[_0xe525('0x64')](_0x2cf4f8,{'networks':_0x5a5269||[]});fs[_0xe525('0x5d')](util[_0xe525('0x66')](_0xe525('0x6b'),_0x42a095[_0xe525('0x58')][_0xe525('0x3f')]['toLowerCase']()),_0x57fc0e);return respondWithRpcPromise(_0xe525('0x5f'),_0xe525('0x35'),{'module':_0xe525('0x67')});}return null;})[_0xe525('0x36')](function(_0x184266){if(_0x184266){return _0x3dd6d7;}return null;});})[_0xe525('0x36')](respondWithResult(_0x3c5918,null))['catch'](handleError(_0x3c5918,null));};exports[_0xe525('0x37')]=function(_0x317100,_0x38e7a4,_0x21ce8c){var _0x20480b;return db[_0xe525('0x3c')][_0xe525('0x56')]({'where':{'id':_0x317100[_0xe525('0x54')]['id']}})[_0xe525('0x36')](function(_0x4e1529){_0x20480b=_0x4e1529;return _0x4e1529;})[_0xe525('0x36')](handleEntityNotFound(_0x38e7a4,null))[_0xe525('0x36')](removeEntity(_0x38e7a4,null))[_0xe525('0x36')](function(){if(_0x20480b){return db['Network'][_0xe525('0x50')]({'where':{'type':_0x20480b[_0xe525('0x3f')]},'raw':!![]});}})[_0xe525('0x36')](function(_0x492438){if(_0x20480b[_0xe525('0x3f')][_0xe525('0x59')]()==_0xe525('0x5a')){var _0x4258bb=fs[_0xe525('0x5b')](path[_0xe525('0x62')](config[_0xe525('0x63')],'server/files/templates/stun_multiple.ejs'),_0xe525('0x5c'));var _0x99a41c=ejs[_0xe525('0x64')](_0x4258bb,{'networks':_0x492438||[]});fs[_0xe525('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x99a41c);return respondWithRpcPromise(_0xe525('0x5f'),'destroy',{'module':_0xe525('0x6a')});}else if(_0x20480b['type'][_0xe525('0x59')]()==_0xe525('0x61')){var _0xedf15c=fs[_0xe525('0x5b')](path[_0xe525('0x62')](config['root'],_0xe525('0x6c')),_0xe525('0x5c'));var _0x163288=ejs[_0xe525('0x64')](_0xedf15c,{'networks':_0x492438||[]});fs[_0xe525('0x5d')](_0xe525('0x65'),_0x163288);return respondWithRpcPromise(_0xe525('0x5f'),_0xe525('0x37'),{'module':'res_stun_monitor.so'});}else{var _0x1ca5c5=fs[_0xe525('0x5b')](path[_0xe525('0x62')](config[_0xe525('0x63')],_0xe525('0x6d')),_0xe525('0x5c'));var _0x21915a=ejs[_0xe525('0x64')](_0x1ca5c5,{'networks':_0x492438||[]});fs[_0xe525('0x5d')](util[_0xe525('0x66')](_0xe525('0x6b'),_0x317100[_0xe525('0x58')][_0xe525('0x3f')][_0xe525('0x6e')]()),_0x21915a);return respondWithRpcPromise(_0xe525('0x5f'),_0xe525('0x37'),{'module':_0xe525('0x67')});}return null;})[_0xe525('0x52')](handleError(_0x38e7a4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9c08884..13b002b 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','api','bluebird'];(function(_0x15bae2,_0x3044f3){var _0x1b7239=function(_0x3a214a){while(--_0x3a214a){_0x15bae2['push'](_0x15bae2['shift']());}};_0x1b7239(++_0x3044f3);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2d05f9,_0x491064){_0x2d05f9=_0x2d05f9-0x0;var _0x51d9eb=_0x9bde[_0x2d05f9];return _0x51d9eb;};'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 +var _0x7a2c=['path','rimraf','../../config/environment','exports','network','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15ce82,_0x582660){var _0x13baa2=function(_0x175ae5){while(--_0x175ae5){_0x15ce82['push'](_0x15ce82['shift']());}};_0x13baa2(++_0x582660);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x447fd3,_0x23c6f3){_0x447fd3=_0x447fd3-0x0;var _0x523d5a=_0x7a2c[_0x447fd3];return _0x523d5a;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var attributes=require('./network.attributes');module[_0xc7a2('0x9')]=function(_0x1ddbae,_0x5f334e){return _0x1ddbae['define']('Network',attributes,{'tableName':_0xc7a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index c3a8c2d..9fa72f1 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 _0x9569=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x1c05ce,_0xbc107b){var _0x114ec3=function(_0x3a4e08){while(--_0x3a4e08){_0x1c05ce['push'](_0x1c05ce['shift']());}};_0x114ec3(++_0xbc107b);}(_0x9569,0x1c6));var _0x9956=function(_0x33cb09,_0x11fd9e){_0x33cb09=_0x33cb09-0x0;var _0x1fb66d=_0x9569[_0x33cb09];return _0x1fb66d;};'use strict';var _=require(_0x9956('0x0'));var util=require(_0x9956('0x1'));var moment=require('moment');var BPromise=require(_0x9956('0x2'));var rs=require(_0x9956('0x3'));var fs=require('fs');var Redis=require(_0x9956('0x4'));var db=require(_0x9956('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9956('0x6'))(_0x9956('0x7'));var config=require(_0x9956('0x8'));var jayson=require(_0x9956('0x9'));var client=jayson[_0x9956('0xa')][_0x9956('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50de07,_0x5342c5,_0x2834b7){return new BPromise(function(_0x1210bc,_0x4217f9){return client['request'](_0x50de07,_0x2834b7)[_0x9956('0xc')](function(_0x4151e){logger[_0x9956('0xd')]('Network,\x20%s,\x20%s',_0x5342c5,_0x9956('0xe'));logger[_0x9956('0xf')](_0x9956('0x10'),_0x5342c5,_0x9956('0xe'),JSON[_0x9956('0x11')](_0x4151e));if(_0x4151e[_0x9956('0x12')]){if(_0x4151e[_0x9956('0x12')][_0x9956('0x13')]===0x1f4){logger[_0x9956('0x12')](_0x9956('0x14'),_0x5342c5,_0x4151e[_0x9956('0x12')]['message']);return _0x4217f9(_0x4151e['error'][_0x9956('0x15')]);}logger[_0x9956('0x12')](_0x9956('0x14'),_0x5342c5,_0x4151e[_0x9956('0x12')][_0x9956('0x15')]);return _0x1210bc(_0x4151e['error']['message']);}else{logger[_0x9956('0xd')](_0x9956('0x14'),_0x5342c5,_0x9956('0xe'));_0x1210bc(_0x4151e[_0x9956('0x16')][_0x9956('0x15')]);}})[_0x9956('0x17')](function(_0x21bbdc){logger[_0x9956('0x12')]('Network,\x20%s,\x20%s',_0x5342c5,_0x21bbdc);_0x4217f9(_0x21bbdc);});});} \ No newline at end of file +var _0x8fc5=['then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4c4224,_0xbf6a24){var _0x2b7205=function(_0x5b1f7d){while(--_0x5b1f7d){_0x4c4224['push'](_0x4c4224['shift']());}};_0x2b7205(++_0xbf6a24);}(_0x8fc5,0x109));var _0x58fc=function(_0x9e002b,_0x1640ad){_0x9e002b=_0x9e002b-0x0;var _0x377d8b=_0x8fc5[_0x9e002b];return _0x377d8b;};'use strict';var _=require('lodash');var util=require(_0x58fc('0x0'));var moment=require(_0x58fc('0x1'));var BPromise=require(_0x58fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58fc('0x3'));var db=require(_0x58fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x58fc('0x5'))(_0x58fc('0x6'));var config=require(_0x58fc('0x7'));var jayson=require(_0x58fc('0x8'));var client=jayson[_0x58fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23f8d2,_0x1d2c6a,_0x4ea268){return new BPromise(function(_0xb8f039,_0x2797a2){return client[_0x58fc('0xa')](_0x23f8d2,_0x4ea268)[_0x58fc('0xb')](function(_0x5d8c53){logger[_0x58fc('0xc')](_0x58fc('0xd'),_0x1d2c6a,'request\x20sent');logger[_0x58fc('0xe')](_0x58fc('0xf'),_0x1d2c6a,_0x58fc('0x10'),JSON[_0x58fc('0x11')](_0x5d8c53));if(_0x5d8c53[_0x58fc('0x12')]){if(_0x5d8c53[_0x58fc('0x12')][_0x58fc('0x13')]===0x1f4){logger[_0x58fc('0x12')](_0x58fc('0xd'),_0x1d2c6a,_0x5d8c53[_0x58fc('0x12')][_0x58fc('0x14')]);return _0x2797a2(_0x5d8c53[_0x58fc('0x12')][_0x58fc('0x14')]);}logger[_0x58fc('0x12')]('Network,\x20%s,\x20%s',_0x1d2c6a,_0x5d8c53[_0x58fc('0x12')]['message']);return _0xb8f039(_0x5d8c53['error'][_0x58fc('0x14')]);}else{logger[_0x58fc('0xc')]('Network,\x20%s,\x20%s',_0x1d2c6a,_0x58fc('0x10'));_0xb8f039(_0x5d8c53[_0x58fc('0x15')]['message']);}})[_0x58fc('0x16')](function(_0x4882a1){logger[_0x58fc('0x12')](_0x58fc('0xd'),_0x1d2c6a,_0x4882a1);_0x2797a2(_0x4882a1);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 5f92c1c..058cb51 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 _0x1c17=['post','isAuthenticated','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller'];(function(_0x415cd3,_0x365279){var _0x29ceb1=function(_0x4dcfcc){while(--_0x4dcfcc){_0x415cd3['push'](_0x415cd3['shift']());}};_0x29ceb1(++_0x365279);}(_0x1c17,0x93));var _0x71c1=function(_0x404d1c,_0x5c880a){_0x404d1c=_0x404d1c-0x0;var _0x2a72bc=_0x1c17[_0x404d1c];return _0x2a72bc;};'use strict';var multer=require(_0x71c1('0x0'));var util=require(_0x71c1('0x1'));var path=require(_0x71c1('0x2'));var timeout=require('connect-timeout');var express=require(_0x71c1('0x3'));var router=express[_0x71c1('0x4')]();var auth=require(_0x71c1('0x5'));var interaction=require(_0x71c1('0x6'));var config=require(_0x71c1('0x7'));var controller=require(_0x71c1('0x8'));router[_0x71c1('0x9')]('/',auth[_0x71c1('0xa')](),controller['sendNotification']);module[_0x71c1('0xb')]=router; \ No newline at end of file +var _0x28fe=['util','path','express','Router','../../components/auth/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer'];(function(_0x1ac6a0,_0x5783e7){var _0x26de06=function(_0x4f3e6b){while(--_0x4f3e6b){_0x1ac6a0['push'](_0x1ac6a0['shift']());}};_0x26de06(++_0x5783e7);}(_0x28fe,0x8f));var _0xe28f=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x28fe[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0xe28f('0x0'));var util=require(_0xe28f('0x1'));var path=require(_0xe28f('0x2'));var timeout=require('connect-timeout');var express=require(_0xe28f('0x3'));var router=express[_0xe28f('0x4')]();var auth=require(_0xe28f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe28f('0x6'));var controller=require(_0xe28f('0x7'));router[_0xe28f('0x8')]('/',auth[_0xe28f('0x9')](),controller[_0xe28f('0xa')]);module[_0xe28f('0xb')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index bd9bdc6..82c751b 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 _0x2a33=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x57b9d1,_0x442861){var _0x2581cc=function(_0x332d23){while(--_0x332d23){_0x57b9d1['push'](_0x57b9d1['shift']());}};_0x2581cc(++_0x442861);}(_0x2a33,0x146));var _0x32a3=function(_0x412ff8,_0x4914e4){_0x412ff8=_0x412ff8-0x0;var _0x2cacb5=_0x2a33[_0x412ff8];return _0x2cacb5;};'use strict';var Sequelize=require(_0x32a3('0x0'));module['exports']={'body':{'type':Sequelize[_0x32a3('0x1')]},'senderName':{'type':Sequelize[_0x32a3('0x2')]},'recipientsId':{'type':Sequelize[_0x32a3('0x1')]},'recipientsDescription':{'type':Sequelize[_0x32a3('0x2')]},'beep':{'type':Sequelize[_0x32a3('0x3')]}}; \ No newline at end of file +var _0x4424=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x27c9cc,_0x5424c7){var _0x38f1fc=function(_0xc2e743){while(--_0xc2e743){_0x27c9cc['push'](_0x27c9cc['shift']());}};_0x38f1fc(++_0x5424c7);}(_0x4424,0x80));var _0x4442=function(_0x300317,_0x4e7c52){_0x300317=_0x300317-0x0;var _0x466e7b=_0x4424[_0x300317];return _0x466e7b;};'use strict';var Sequelize=require(_0x4442('0x0'));module[_0x4442('0x1')]={'body':{'type':Sequelize[_0x4442('0x2')]},'senderName':{'type':Sequelize[_0x4442('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x4442('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 8fbd407..dc812bd 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 _0x169a=['moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','Notification','create','forEach','recipient','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','ids','queue','replace','Queue','push','union','flatten','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x300442,_0x2c33cb){var _0x188824=function(_0x20a4e3){while(--_0x20a4e3){_0x300442['push'](_0x300442['shift']());}};_0x188824(++_0x2c33cb);}(_0x169a,0x19b));var _0xa169=function(_0x2c3b0a,_0x20523c){_0x2c3b0a=_0x2c3b0a-0x0;var _0x2f6272=_0x169a[_0x2c3b0a];return _0x2f6272;};'use strict';var pdf=require(_0xa169('0x0'));var emlformat=require(_0xa169('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa169('0x2'));var jsonpatch=require(_0xa169('0x3'));var rp=require(_0xa169('0x4'));var moment=require(_0xa169('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa169('0x6'));var util=require(_0xa169('0x7'));var path=require(_0xa169('0x8'));var sox=require(_0xa169('0x9'));var csv=require(_0xa169('0xa'));var ejs=require(_0xa169('0xb'));var fs=require('fs');var _=require(_0xa169('0xc'));var squel=require(_0xa169('0xd'));var crypto=require(_0xa169('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa169('0xf'));var toCsv=require(_0xa169('0xa'));var querystring=require(_0xa169('0x10'));var Papa=require(_0xa169('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa169('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa169('0x13'));var logger=require(_0xa169('0x14'))(_0xa169('0x15'));var utils=require(_0xa169('0x16'));var config=require(_0xa169('0x17'));var db=require(_0xa169('0x18'))['db'];config[_0xa169('0x19')]=_[_0xa169('0x1a')](config['redis'],{'host':_0xa169('0x1b'),'port':0x18eb});var socket=require(_0xa169('0x1c'))(new Redis(config[_0xa169('0x19')]));require(_0xa169('0x1d'))[_0xa169('0x1e')](socket);function respondWithStatusCode(_0xe529d0,_0x41f2dd){_0x41f2dd=_0x41f2dd||0xcc;return function(_0x26ebbf){if(_0x26ebbf){return _0xe529d0[_0xa169('0x1f')](_0x41f2dd);}return _0xe529d0[_0xa169('0x20')](_0x41f2dd)['end']();};}function respondWithResult(_0x4830c5,_0x13d6f9){_0x13d6f9=_0x13d6f9||0xc8;return function(_0x1db9c0){if(_0x1db9c0){return _0x4830c5['status'](_0x13d6f9)[_0xa169('0x21')](_0x1db9c0);}};}function respondWithFilteredResult(_0x2a54db,_0x3835a1){return function(_0x34d4ce){if(_0x34d4ce){var _0x34c46d=_0x34d4ce[_0xa169('0x22')],_0x4aaf2e=_0x3835a1['offset'],_0x259dcc=_0x3835a1[_0xa169('0x23')]+_0x3835a1[_0xa169('0x24')],_0x5cd747;if(_0x259dcc>=_0x34c46d){_0x259dcc=_0x34c46d;_0x5cd747=0xc8;}else{_0x5cd747=0xce;}_0x2a54db['status'](_0x5cd747);return _0x2a54db[_0xa169('0x25')](_0xa169('0x26'),_0x4aaf2e+'-'+_0x259dcc+'/'+_0x34c46d)[_0xa169('0x21')](_0x34d4ce);}return null;};}function patchUpdates(_0x36255b){return function(_0xf1af90){try{jsonpatch[_0xa169('0x27')](_0xf1af90,_0x36255b,!![]);}catch(_0x1dfc35){return BPromise['reject'](_0x1dfc35);}return _0xf1af90[_0xa169('0x28')]();};}function saveUpdates(_0x5ecae5,_0x227d8b){return function(_0x2a3df4){if(_0x2a3df4){return _0x2a3df4[_0xa169('0x29')](_0x5ecae5)[_0xa169('0x2a')](function(_0x1da65a){return _0x1da65a;});}return null;};}function removeEntity(_0x68dd2b,_0x1621db){return function(_0x580087){if(_0x580087){return _0x580087[_0xa169('0x2b')]()[_0xa169('0x2a')](function(){_0x68dd2b['status'](0xcc)[_0xa169('0x2c')]();});}};}function handleEntityNotFound(_0x710381,_0x38e673){return function(_0x3ca49c){if(!_0x3ca49c){_0x710381[_0xa169('0x1f')](0x194);}return _0x3ca49c;};}function handleError(_0x289ee3,_0x30b757){_0x30b757=_0x30b757||0x1f4;return function(_0x24f36a){logger[_0xa169('0x2d')](_0x24f36a[_0xa169('0x2e')]);if(_0x24f36a[_0xa169('0x2f')]){delete _0x24f36a[_0xa169('0x2f')];}_0x289ee3['status'](_0x30b757)['send'](_0x24f36a);};}exports[_0xa169('0x30')]=function(_0x41f0c2,_0x3cd5d1,_0x1ad41b){if(!_0x41f0c2['body'][_0xa169('0x31')](_0xa169('0x32'))&&!_0x41f0c2[_0xa169('0x33')]['hasOwnProperty'](_0xa169('0x34'))){throw new db[(_0xa169('0x35'))][(_0xa169('0x36'))](_0xa169('0x37'));}else{if(_0x41f0c2[_0xa169('0x33')]['hasOwnProperty'](_0xa169('0x34'))&&!_0x41f0c2[_0xa169('0x33')][_0xa169('0x31')]('view')){throw new db[(_0xa169('0x35'))][(_0xa169('0x36'))](_0xa169('0x38'));}if(!_0x41f0c2[_0xa169('0x33')]['hasOwnProperty'](_0xa169('0x39'))){throw new db['Sequelize'][(_0xa169('0x36'))](_0xa169('0x3a'));}else{try{var _0x581d64=JSON[_0xa169('0x3b')](_0x41f0c2['body'][_0xa169('0x39')]);}catch(_0x5dd5a2){logger[_0xa169('0x2d')](_0x5dd5a2);throw new db[(_0xa169('0x35'))][(_0xa169('0x36'))](_0xa169('0x3c'));}var _0x3f8277=[_0xa169('0x3d'),'faxqueue',_0xa169('0x3e'),'openchannelqueue',_0xa169('0x3f'),_0xa169('0x40'),'whatsappqueue',_0xa169('0x41'),_0xa169('0x42')];if(_[_0xa169('0x43')](_0x581d64,function(_0x4d7cbe){return!_[_0xa169('0x44')](_0x3f8277,_0x4d7cbe[_0xa169('0x45')][_0xa169('0x46')]());})){throw new db[(_0xa169('0x35'))]['ValidationError'](_0xa169('0x47'));}}}var _0x2f444e={};_0x2f444e[_0xa169('0x48')]=_0x41f0c2['body']['hasOwnProperty']('senderName')?_0x41f0c2[_0xa169('0x33')]['senderName']:_0x41f0c2[_0xa169('0x42')][_0xa169('0x49')];_0x2f444e[_0xa169('0x4a')]=_[_0xa169('0x4b')](_0x41f0c2['body'][_0xa169('0x4a')])?null:_0x41f0c2[_0xa169('0x33')][_0xa169('0x4a')];_0x2f444e[_0xa169('0x4c')]=_0x41f0c2[_0xa169('0x33')][_0xa169('0x4c')]||![];_0x2f444e[_0xa169('0x4d')]=_0x41f0c2[_0xa169('0x42')]['id'];return getContent(_0x41f0c2['body'])['then'](function(_0xbecfd4){_0x2f444e[_0xa169('0x33')]=_0xbecfd4;return getRecipients(_0x581d64);})[_0xa169('0x2a')](function(_0x2d4e6b){_0x2f444e[_0xa169('0x4e')]=_[_0xa169('0x4f')](_0x2d4e6b)[_0xa169('0x50')](',');return db[_0xa169('0x51')]['transaction'](function(_0x3f032f){return db[_0xa169('0x52')][_0xa169('0x53')](_0x2f444e,{'raw':!![],'transaction':_0x3f032f})['then'](function(_0x5ee4d6){var _0x55f182={'sender':_0x2f444e[_0xa169('0x48')],'description':_0x2f444e[_0xa169('0x4a')],'content':_0x2f444e[_0xa169('0x33')],'beep':_0x2f444e['beep']};_0x2d4e6b[_0xa169('0x54')](function(_0x1aa4de){_0x55f182[_0xa169('0x55')]=_0x1aa4de;socket[_0xa169('0x56')](_0xa169('0x57'),_0x55f182);});return _0x5ee4d6;});});})[_0xa169('0x2a')](respondWithResult(_0x3cd5d1,0xc9))[_0xa169('0x58')](handleError(_0x3cd5d1,null));};function getContent(_0x38e17d){return new BPromise(function(_0x8bd8f9,_0x138319){if(_0x38e17d['text']){_0x8bd8f9(_0x38e17d[_0xa169('0x32')]);return;}return db[_0xa169('0x59')][_0xa169('0x5a')]({'attributes':[_0xa169('0x5b')],'where':{'id':_0x38e17d['TemplateId']},'raw':!![]})[_0xa169('0x2a')](function(_0x586994){if(!_0x586994)throw new db[(_0xa169('0x35'))]['ValidationError'](_0xa169('0x5c'));var _0xef5cb4=Mustache[_0xa169('0x5d')](_0x586994[_0xa169('0x5b')],_0x38e17d[_0xa169('0x5e')]);_0x8bd8f9(_0xef5cb4);})['catch'](function(_0x170d68){_0x138319(_0x170d68);});});}function getRecipients(_0x523529){return new BPromise(function(_0x105b14,_0x31c5d3){var _0x164eea=[];var _0x2437d6=[];_0x523529[_0xa169('0x54')](function(_0x1cd667){var _0x2f0495=_[_0xa169('0x5f')](_0x1cd667['model']['toLowerCase']());if(_0x2f0495===_0xa169('0x60')){_0x164eea=_['union'](_0x164eea,_0x1cd667[_0xa169('0x61')]);}else{if(_[_0xa169('0x44')](_0x2f0495,_0xa169('0x62')))_0x2f0495=_0x2f0495[_0xa169('0x63')]('queue',_0xa169('0x64'));_0x1cd667[_0xa169('0x61')][_0xa169('0x54')](function(_0x15abea){_0x2437d6[_0xa169('0x65')](getAgents(_0x2f0495,_0x15abea));});}});return BPromise['all'](_0x2437d6)[_0xa169('0x2a')](function(_0x1857f3){_0x164eea=_[_0xa169('0x66')](_0x164eea,_[_0xa169('0x67')](_0x1857f3));_0x105b14(_0x164eea);})[_0xa169('0x58')](function(_0x14bb58){_0x31c5d3(_0x14bb58);});});}function getAgents(_0x51adf3,_0x2a1046){return new BPromise(function(_0x443502,_0x4d956c){return db[_0x51adf3][_0xa169('0x5a')]({'where':{'id':_0x2a1046}})[_0xa169('0x2a')](function(_0x4fd4eb){return _0x4fd4eb['getAgents']({'attributes':['id'],'raw':!![]})[_0xa169('0x2a')](function(_0x1f28a7){var _0x50f1e2=_['map'](_0x1f28a7,'id');_0x443502(_0x50f1e2);});})[_0xa169('0x58')](function(_0xa05f7b){_0x4d956c(_0xa05f7b);});});} \ No newline at end of file +var _0x3dea=['parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','union','ids','queue','replace','Queue','all','flatten','map','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients'];(function(_0x597c29,_0x34c7d8){var _0x1cd80f=function(_0x35c92c){while(--_0x35c92c){_0x597c29['push'](_0x597c29['shift']());}};_0x1cd80f(++_0x34c7d8);}(_0x3dea,0x1d2));var _0xa3de=function(_0x22e031,_0x491dce){_0x22e031=_0x22e031-0x0;var _0x4b58db=_0x3dea[_0x22e031];return _0x4b58db;};'use strict';var pdf=require(_0xa3de('0x0'));var emlformat=require(_0xa3de('0x1'));var rimraf=require(_0xa3de('0x2'));var zipdir=require(_0xa3de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3de('0x4'));var moment=require(_0xa3de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa3de('0x6'));var util=require(_0xa3de('0x7'));var path=require(_0xa3de('0x8'));var sox=require(_0xa3de('0x9'));var csv=require(_0xa3de('0xa'));var ejs=require(_0xa3de('0xb'));var fs=require('fs');var _=require(_0xa3de('0xc'));var squel=require(_0xa3de('0xd'));var crypto=require(_0xa3de('0xe'));var jsforce=require(_0xa3de('0xf'));var deskjs=require(_0xa3de('0x10'));var toCsv=require(_0xa3de('0xa'));var querystring=require(_0xa3de('0x11'));var Papa=require(_0xa3de('0x12'));var Redis=require('ioredis');var authService=require(_0xa3de('0x13'));var qs=require(_0xa3de('0x14'));var as=require(_0xa3de('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3de('0x16'))(_0xa3de('0x17'));var utils=require(_0xa3de('0x18'));var config=require('../../config/environment');var db=require(_0xa3de('0x19'))['db'];config[_0xa3de('0x1a')]=_[_0xa3de('0x1b')](config[_0xa3de('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xa3de('0x1c'))(new Redis(config['redis']));require(_0xa3de('0x1d'))[_0xa3de('0x1e')](socket);function respondWithStatusCode(_0x3d9a94,_0x112041){_0x112041=_0x112041||0xcc;return function(_0x43f281){if(_0x43f281){return _0x3d9a94[_0xa3de('0x1f')](_0x112041);}return _0x3d9a94[_0xa3de('0x20')](_0x112041)[_0xa3de('0x21')]();};}function respondWithResult(_0x13f37f,_0x23dcf3){_0x23dcf3=_0x23dcf3||0xc8;return function(_0x42f6c4){if(_0x42f6c4){return _0x13f37f[_0xa3de('0x20')](_0x23dcf3)[_0xa3de('0x22')](_0x42f6c4);}};}function respondWithFilteredResult(_0x20e4f9,_0x3d5193){return function(_0x557558){if(_0x557558){var _0x1692bc=_0x557558[_0xa3de('0x23')],_0x4cfef3=_0x3d5193[_0xa3de('0x24')],_0x1aa077=_0x3d5193['offset']+_0x3d5193[_0xa3de('0x25')],_0x31c0c2;if(_0x1aa077>=_0x1692bc){_0x1aa077=_0x1692bc;_0x31c0c2=0xc8;}else{_0x31c0c2=0xce;}_0x20e4f9['status'](_0x31c0c2);return _0x20e4f9[_0xa3de('0x26')](_0xa3de('0x27'),_0x4cfef3+'-'+_0x1aa077+'/'+_0x1692bc)[_0xa3de('0x22')](_0x557558);}return null;};}function patchUpdates(_0x245afa){return function(_0x126ca3){try{jsonpatch[_0xa3de('0x28')](_0x126ca3,_0x245afa,!![]);}catch(_0x50013e){return BPromise[_0xa3de('0x29')](_0x50013e);}return _0x126ca3['save']();};}function saveUpdates(_0x729231,_0x3cdb6d){return function(_0x2fbb0f){if(_0x2fbb0f){return _0x2fbb0f[_0xa3de('0x2a')](_0x729231)[_0xa3de('0x2b')](function(_0x508fab){return _0x508fab;});}return null;};}function removeEntity(_0x3e07e0,_0x2bca2f){return function(_0x19efbc){if(_0x19efbc){return _0x19efbc[_0xa3de('0x2c')]()['then'](function(){_0x3e07e0[_0xa3de('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x123e85,_0x1efe8){return function(_0x2fb750){if(!_0x2fb750){_0x123e85['sendStatus'](0x194);}return _0x2fb750;};}function handleError(_0x838fe3,_0xfe6560){_0xfe6560=_0xfe6560||0x1f4;return function(_0x3d1ce9){logger[_0xa3de('0x2d')](_0x3d1ce9[_0xa3de('0x2e')]);if(_0x3d1ce9[_0xa3de('0x2f')]){delete _0x3d1ce9['name'];}_0x838fe3['status'](_0xfe6560)[_0xa3de('0x30')](_0x3d1ce9);};}exports['sendNotification']=function(_0x4dd0d4,_0x535234,_0x1d8746){if(!_0x4dd0d4['body'][_0xa3de('0x31')](_0xa3de('0x32'))&&!_0x4dd0d4['body'][_0xa3de('0x31')](_0xa3de('0x33'))){throw new db[(_0xa3de('0x34'))][(_0xa3de('0x35'))](_0xa3de('0x36'));}else{if(_0x4dd0d4[_0xa3de('0x37')][_0xa3de('0x31')](_0xa3de('0x33'))&&!_0x4dd0d4['body'][_0xa3de('0x31')](_0xa3de('0x38'))){throw new db[(_0xa3de('0x34'))][(_0xa3de('0x35'))](_0xa3de('0x39'));}if(!_0x4dd0d4['body']['hasOwnProperty'](_0xa3de('0x3a'))){throw new db['Sequelize'][(_0xa3de('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0xaade59=JSON[_0xa3de('0x3b')](_0x4dd0d4[_0xa3de('0x37')][_0xa3de('0x3a')]);}catch(_0x1050f6){logger[_0xa3de('0x2d')](_0x1050f6);throw new db['Sequelize'][(_0xa3de('0x35'))](_0xa3de('0x3c'));}var _0x33d749=[_0xa3de('0x3d'),_0xa3de('0x3e'),_0xa3de('0x3f'),_0xa3de('0x40'),_0xa3de('0x41'),_0xa3de('0x42'),'whatsappqueue',_0xa3de('0x43'),_0xa3de('0x44')];if(_[_0xa3de('0x45')](_0xaade59,function(_0x4a15ba){return!_[_0xa3de('0x46')](_0x33d749,_0x4a15ba['model'][_0xa3de('0x47')]());})){throw new db[(_0xa3de('0x34'))][(_0xa3de('0x35'))](_0xa3de('0x48'));}}}var _0x40ccab={};_0x40ccab[_0xa3de('0x49')]=_0x4dd0d4[_0xa3de('0x37')][_0xa3de('0x31')](_0xa3de('0x49'))?_0x4dd0d4[_0xa3de('0x37')][_0xa3de('0x49')]:_0x4dd0d4[_0xa3de('0x44')][_0xa3de('0x4a')];_0x40ccab[_0xa3de('0x4b')]=_[_0xa3de('0x4c')](_0x4dd0d4[_0xa3de('0x37')][_0xa3de('0x4b')])?null:_0x4dd0d4['body'][_0xa3de('0x4b')];_0x40ccab[_0xa3de('0x4d')]=_0x4dd0d4[_0xa3de('0x37')][_0xa3de('0x4d')]||![];_0x40ccab[_0xa3de('0x4e')]=_0x4dd0d4[_0xa3de('0x44')]['id'];return getContent(_0x4dd0d4[_0xa3de('0x37')])[_0xa3de('0x2b')](function(_0x1d0f34){_0x40ccab[_0xa3de('0x37')]=_0x1d0f34;return getRecipients(_0xaade59);})[_0xa3de('0x2b')](function(_0xf5e20){_0x40ccab[_0xa3de('0x4f')]=_[_0xa3de('0x50')](_0xf5e20)[_0xa3de('0x51')](',');return db[_0xa3de('0x52')][_0xa3de('0x53')](function(_0xf2b36f){return db[_0xa3de('0x54')][_0xa3de('0x55')](_0x40ccab,{'raw':!![],'transaction':_0xf2b36f})[_0xa3de('0x2b')](function(_0x16926c){var _0x76ad5c={'sender':_0x40ccab[_0xa3de('0x49')],'description':_0x40ccab[_0xa3de('0x4b')],'content':_0x40ccab[_0xa3de('0x37')],'beep':_0x40ccab[_0xa3de('0x4d')]};_0xf5e20[_0xa3de('0x56')](function(_0x5f1b35){_0x76ad5c[_0xa3de('0x57')]=_0x5f1b35;socket[_0xa3de('0x58')](_0xa3de('0x59'),_0x76ad5c);});return _0x16926c;});});})[_0xa3de('0x2b')](respondWithResult(_0x535234,0xc9))[_0xa3de('0x5a')](handleError(_0x535234,null));};function getContent(_0x5adc42){return new BPromise(function(_0x3b4b8f,_0x29db58){if(_0x5adc42['text']){_0x3b4b8f(_0x5adc42[_0xa3de('0x32')]);return;}return db[_0xa3de('0x5b')]['findOne']({'attributes':[_0xa3de('0x5c')],'where':{'id':_0x5adc42[_0xa3de('0x33')]},'raw':!![]})[_0xa3de('0x2b')](function(_0x2533a2){if(!_0x2533a2)throw new db[(_0xa3de('0x34'))][(_0xa3de('0x35'))](_0xa3de('0x5d'));var _0x17f144=Mustache[_0xa3de('0x5e')](_0x2533a2[_0xa3de('0x5c')],_0x5adc42[_0xa3de('0x38')]);_0x3b4b8f(_0x17f144);})[_0xa3de('0x5a')](function(_0x3f75d5){_0x29db58(_0x3f75d5);});});}function getRecipients(_0x2d1dea){return new BPromise(function(_0x11796f,_0xce543e){var _0x160039=[];var _0x4d6186=[];_0x2d1dea[_0xa3de('0x56')](function(_0x21706c){var _0x33f2e8=_[_0xa3de('0x5f')](_0x21706c[_0xa3de('0x60')][_0xa3de('0x47')]());if(_0x33f2e8==='User'){_0x160039=_[_0xa3de('0x61')](_0x160039,_0x21706c[_0xa3de('0x62')]);}else{if(_[_0xa3de('0x46')](_0x33f2e8,_0xa3de('0x63')))_0x33f2e8=_0x33f2e8[_0xa3de('0x64')](_0xa3de('0x63'),_0xa3de('0x65'));_0x21706c[_0xa3de('0x62')][_0xa3de('0x56')](function(_0x470d21){_0x4d6186['push'](getAgents(_0x33f2e8,_0x470d21));});}});return BPromise[_0xa3de('0x66')](_0x4d6186)[_0xa3de('0x2b')](function(_0x3d4c0e){_0x160039=_[_0xa3de('0x61')](_0x160039,_[_0xa3de('0x67')](_0x3d4c0e));_0x11796f(_0x160039);})[_0xa3de('0x5a')](function(_0x4fc84c){_0xce543e(_0x4fc84c);});});}function getAgents(_0x3714ed,_0x3a76c8){return new BPromise(function(_0x4bda65,_0x47de7e){return db[_0x3714ed]['findOne']({'where':{'id':_0x3a76c8}})[_0xa3de('0x2b')](function(_0x572017){return _0x572017['getAgents']({'attributes':['id'],'raw':!![]})[_0xa3de('0x2b')](function(_0x511be8){var _0x12b6e4=_[_0xa3de('0x68')](_0x511be8,'id');_0x4bda65(_0x12b6e4);});})[_0xa3de('0x5a')](function(_0x294f5e){_0x47de7e(_0x294f5e);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 9f5a216..a934dd8 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x28e91d,_0x45b95b){var _0x3e43c8=function(_0x1b78a3){while(--_0x1b78a3){_0x28e91d['push'](_0x28e91d['shift']());}};_0x3e43c8(++_0x45b95b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x3b85ca,_0x5063a0){var _0x1d623a=function(_0x24f39c){while(--_0x24f39c){_0x3b85ca['push'](_0x3b85ca['shift']());}};_0x1d623a(++_0x5063a0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 683e279..d4ba216 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 _0x4213=['rimraf','./notification.attributes','exports','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x4213,0x77));var _0x3421=function(_0x30f725,_0x56d049){_0x30f725=_0x30f725-0x0;var _0x4acbbf=_0x4213[_0x30f725];return _0x4acbbf;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var logger=require(_0x3421('0x2'))(_0x3421('0x3'));var moment=require(_0x3421('0x4'));var BPromise=require(_0x3421('0x5'));var rp=require(_0x3421('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3421('0x7'));var config=require('../../config/environment');var attributes=require(_0x3421('0x8'));module[_0x3421('0x9')]=function(_0x2155f8,_0x2a04e0){return _0x2155f8['define'](_0x3421('0xa'),attributes,{'tableName':_0x3421('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3421('0xc'),'collate':_0x3421('0xd')});}; \ No newline at end of file +var _0x93e9=['request-promise','../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x93e9,0xcc));var _0x993e=function(_0x32ca32,_0x238b2b){_0x32ca32=_0x32ca32-0x0;var _0x5438ff=_0x93e9[_0x32ca32];return _0x5438ff;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x993e('0xd')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index f92d0cb..54f9436 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 _0xd0fd=['util','moment','bluebird','randomstring','../../config/logger','http','redis','defaults','socket.io-emitter','./notification.socket','request','info','Notification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0xc1317a,_0x42e35e){var _0x1ab912=function(_0x3cdccc){while(--_0x3cdccc){_0xc1317a['push'](_0xc1317a['shift']());}};_0x1ab912(++_0x42e35e);}(_0xd0fd,0xaf));var _0xdd0f=function(_0x283ad6,_0x5f1eee){_0x283ad6=_0x283ad6-0x0;var _0x41f596=_0xd0fd[_0x283ad6];return _0x41f596;};'use strict';var _=require(_0xdd0f('0x0'));var util=require(_0xdd0f('0x1'));var moment=require(_0xdd0f('0x2'));var BPromise=require(_0xdd0f('0x3'));var rs=require(_0xdd0f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdd0f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdd0f('0x6')]({'port':0x232a});config[_0xdd0f('0x7')]=_[_0xdd0f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdd0f('0x9'))(new Redis(config[_0xdd0f('0x7')]));require(_0xdd0f('0xa'))['register'](socket);function respondWithRpcPromise(_0x4542d2,_0x44cf9e,_0x440fc1){return new BPromise(function(_0xa7bf5d,_0x7f7695){return client[_0xdd0f('0xb')](_0x4542d2,_0x440fc1)['then'](function(_0x3cd939){logger[_0xdd0f('0xc')](_0xdd0f('0xd'),_0x44cf9e,_0xdd0f('0xe'));logger[_0xdd0f('0xf')]('Notification,\x20%s,\x20%s,\x20%s',_0x44cf9e,'request\x20sent',JSON[_0xdd0f('0x10')](_0x3cd939));if(_0x3cd939['error']){if(_0x3cd939[_0xdd0f('0x11')][_0xdd0f('0x12')]===0x1f4){logger[_0xdd0f('0x11')]('Notification,\x20%s,\x20%s',_0x44cf9e,_0x3cd939[_0xdd0f('0x11')][_0xdd0f('0x13')]);return _0x7f7695(_0x3cd939[_0xdd0f('0x11')]['message']);}logger[_0xdd0f('0x11')](_0xdd0f('0xd'),_0x44cf9e,_0x3cd939[_0xdd0f('0x11')][_0xdd0f('0x13')]);return _0xa7bf5d(_0x3cd939['error']['message']);}else{logger['info'](_0xdd0f('0xd'),_0x44cf9e,_0xdd0f('0xe'));_0xa7bf5d(_0x3cd939[_0xdd0f('0x14')][_0xdd0f('0x13')]);}})[_0xdd0f('0x15')](function(_0x166a87){logger[_0xdd0f('0x11')]('Notification,\x20%s,\x20%s',_0x44cf9e,_0x166a87);_0x7f7695(_0x166a87);});});} \ No newline at end of file +var _0x2964=['catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','code','Notification,\x20%s,\x20%s','message','result'];(function(_0x4b76ef,_0x292021){var _0xf79a60=function(_0x51e758){while(--_0x51e758){_0x4b76ef['push'](_0x4b76ef['shift']());}};_0xf79a60(++_0x292021);}(_0x2964,0x139));var _0x4296=function(_0x325e37,_0x54507d){_0x325e37=_0x325e37-0x0;var _0x25c034=_0x2964[_0x325e37];return _0x25c034;};'use strict';var _=require('lodash');var util=require(_0x4296('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4296('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4296('0x2'))['db'];var utils=require(_0x4296('0x3'));var logger=require(_0x4296('0x4'))('rpc');var config=require(_0x4296('0x5'));var jayson=require(_0x4296('0x6'));var client=jayson['client'][_0x4296('0x7')]({'port':0x232a});config[_0x4296('0x8')]=_[_0x4296('0x9')](config[_0x4296('0x8')],{'host':_0x4296('0xa'),'port':0x18eb});var socket=require(_0x4296('0xb'))(new Redis(config[_0x4296('0x8')]));require('./notification.socket')[_0x4296('0xc')](socket);function respondWithRpcPromise(_0x4ac795,_0x36f5a4,_0x42a3ce){return new BPromise(function(_0x9b0b3b,_0x29a327){return client[_0x4296('0xd')](_0x4ac795,_0x42a3ce)[_0x4296('0xe')](function(_0x595d9a){logger[_0x4296('0xf')]('Notification,\x20%s,\x20%s',_0x36f5a4,_0x4296('0x10'));logger[_0x4296('0x11')]('Notification,\x20%s,\x20%s,\x20%s',_0x36f5a4,'request\x20sent',JSON['stringify'](_0x595d9a));if(_0x595d9a[_0x4296('0x12')]){if(_0x595d9a[_0x4296('0x12')][_0x4296('0x13')]===0x1f4){logger[_0x4296('0x12')](_0x4296('0x14'),_0x36f5a4,_0x595d9a[_0x4296('0x12')]['message']);return _0x29a327(_0x595d9a['error'][_0x4296('0x15')]);}logger[_0x4296('0x12')](_0x4296('0x14'),_0x36f5a4,_0x595d9a['error'][_0x4296('0x15')]);return _0x9b0b3b(_0x595d9a['error']['message']);}else{logger[_0x4296('0xf')](_0x4296('0x14'),_0x36f5a4,_0x4296('0x10'));_0x9b0b3b(_0x595d9a[_0x4296('0x16')]['message']);}})[_0x4296('0x17')](function(_0x4e296f){logger['error']('Notification,\x20%s,\x20%s',_0x36f5a4,_0x4e296f);_0x29a327(_0x4e296f);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index d2d4bc4..66aec7e 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 _0x41c1=['update','emit','removeListener','length','notification:','save'];(function(_0x39a81b,_0x588170){var _0x58f8c4=function(_0x1631b2){while(--_0x1631b2){_0x39a81b['push'](_0x39a81b['shift']());}};_0x58f8c4(++_0x588170);}(_0x41c1,0x155));var _0x141c=function(_0x56ec52,_0x35e3c3){_0x56ec52=_0x56ec52-0x0;var _0x324eb2=_0x41c1[_0x56ec52];return _0x324eb2;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x141c('0x0'),'remove',_0x141c('0x1')];function createListener(_0x567c24,_0x25b950){return function(_0x784cab){_0x25b950[_0x141c('0x2')](_0x567c24,_0x784cab);};}function removeListener(_0x2cd9f0,_0x3f21be){return function(){NotificationEvents[_0x141c('0x3')](_0x2cd9f0,_0x3f21be);};}exports['register']=function(_0x3d7cb5){for(var _0x1909c9=0x0,_0x1dbdd0=events[_0x141c('0x4')];_0x1909c9<_0x1dbdd0;_0x1909c9++){var _0x5ee9c2=events[_0x1909c9];var _0x1aac4a=createListener(_0x141c('0x5')+_0x5ee9c2,_0x3d7cb5);NotificationEvents['on'](_0x5ee9c2,_0x1aac4a);}}; \ No newline at end of file +var _0x3474=['save','remove','update','register','length','notification:'];(function(_0x4250fe,_0x24633f){var _0x34f212=function(_0x3fcc60){while(--_0x3fcc60){_0x4250fe['push'](_0x4250fe['shift']());}};_0x34f212(++_0x24633f);}(_0x3474,0x1d4));var _0x4347=function(_0x18139a,_0x3348ac){_0x18139a=_0x18139a-0x0;var _0x5e3229=_0x3474[_0x18139a];return _0x5e3229;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x4347('0x0'),_0x4347('0x1'),_0x4347('0x2')];function createListener(_0x2aff12,_0x2f8bfe){return function(_0x22c35b){_0x2f8bfe['emit'](_0x2aff12,_0x22c35b);};}function removeListener(_0x38aab0,_0xa80f8c){return function(){NotificationEvents['removeListener'](_0x38aab0,_0xa80f8c);};}exports[_0x4347('0x3')]=function(_0x557f8e){for(var _0xd79d6f=0x0,_0x47b1f8=events[_0x4347('0x4')];_0xd79d6f<_0x47b1f8;_0xd79d6f++){var _0x1307cd=events[_0xd79d6f];var _0x55902d=createListener(_0x4347('0x5')+_0x1307cd,_0x557f8e);NotificationEvents['on'](_0x1307cd,_0x55902d);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index d76b241..08a8e03 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 _0x28ab=['send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','describe','/:id','getDispositions','getApplications','/:id/interactions','getInteractions','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/applications','/:id/users','addAgents'];(function(_0x5bd055,_0x463d01){var _0xbecdaf=function(_0x10bbc4){while(--_0x10bbc4){_0x5bd055['push'](_0x5bd055['shift']());}};_0xbecdaf(++_0x463d01);}(_0x28ab,0x1c4));var _0xb28a=function(_0x1cfa46,_0x23b295){_0x1cfa46=_0x1cfa46-0x0;var _0x4da082=_0x28ab[_0x1cfa46];return _0x4da082;};'use strict';var multer=require(_0xb28a('0x0'));var util=require(_0xb28a('0x1'));var path=require(_0xb28a('0x2'));var timeout=require(_0xb28a('0x3'));var express=require(_0xb28a('0x4'));var router=express[_0xb28a('0x5')]();var auth=require(_0xb28a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb28a('0x7'));var controller=require(_0xb28a('0x8'));router['get']('/',auth[_0xb28a('0x9')](),controller[_0xb28a('0xa')]);router[_0xb28a('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xb28a('0xc')]);router[_0xb28a('0xb')](_0xb28a('0xd'),auth[_0xb28a('0x9')](),controller['show']);router['get']('/:id/dispositions',auth[_0xb28a('0x9')](),controller[_0xb28a('0xe')]);router[_0xb28a('0xb')]('/:id/canned_answers',auth[_0xb28a('0x9')](),controller['getAnswers']);router[_0xb28a('0xb')]('/:id/applications',auth[_0xb28a('0x9')](),controller[_0xb28a('0xf')]);router[_0xb28a('0xb')](_0xb28a('0x10'),auth[_0xb28a('0x9')](),controller[_0xb28a('0x11')]);router[_0xb28a('0xb')]('/:id/users',auth[_0xb28a('0x9')](),controller[_0xb28a('0x12')]);router[_0xb28a('0x13')]('/',auth[_0xb28a('0x9')](),controller['create']);router['post'](_0xb28a('0x14'),auth[_0xb28a('0x9')](),controller[_0xb28a('0x15')]);router[_0xb28a('0x13')](_0xb28a('0x16'),auth[_0xb28a('0x9')](),controller[_0xb28a('0x17')]);router[_0xb28a('0x13')](_0xb28a('0x18'),controller[_0xb28a('0x19')]);router['post'](_0xb28a('0x1a'),auth[_0xb28a('0x9')](),controller['addApplications']);router[_0xb28a('0x13')](_0xb28a('0x1b'),auth[_0xb28a('0x9')](),controller[_0xb28a('0x1c')]);router[_0xb28a('0x13')]('/:id/send',auth['isAuthenticated'](),controller[_0xb28a('0x1d')]);router['put'](_0xb28a('0xd'),auth['isAuthenticated'](),controller[_0xb28a('0x1e')]);router[_0xb28a('0x1f')](_0xb28a('0xd'),auth[_0xb28a('0x9')](),controller[_0xb28a('0x20')]);router[_0xb28a('0x1f')](_0xb28a('0x14'),auth['isAuthenticated'](),controller[_0xb28a('0x21')]);router['delete'](_0xb28a('0x16'),auth[_0xb28a('0x9')](),controller[_0xb28a('0x22')]);router[_0xb28a('0x1f')](_0xb28a('0x1b'),auth['isAuthenticated'](),controller[_0xb28a('0x23')]);module[_0xb28a('0x24')]=router; \ No newline at end of file +var _0x05b8=['get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0x05b8,0x10e));var _0x805b=function(_0x42e318,_0x430cdc){_0x42e318=_0x42e318-0x0;var _0x24f18f=_0x05b8[_0x42e318];return _0x24f18f;};'use strict';var multer=require(_0x805b('0x0'));var util=require(_0x805b('0x1'));var path=require(_0x805b('0x2'));var timeout=require(_0x805b('0x3'));var express=require(_0x805b('0x4'));var router=express[_0x805b('0x5')]();var auth=require(_0x805b('0x6'));var interaction=require(_0x805b('0x7'));var config=require(_0x805b('0x8'));var controller=require(_0x805b('0x9'));router[_0x805b('0xa')]('/',auth[_0x805b('0xb')](),controller[_0x805b('0xc')]);router[_0x805b('0xa')](_0x805b('0xd'),auth[_0x805b('0xb')](),controller[_0x805b('0xe')]);router[_0x805b('0xa')]('/:id',auth[_0x805b('0xb')](),controller['show']);router[_0x805b('0xa')](_0x805b('0xf'),auth[_0x805b('0xb')](),controller[_0x805b('0x10')]);router[_0x805b('0xa')](_0x805b('0x11'),auth[_0x805b('0xb')](),controller['getAnswers']);router[_0x805b('0xa')](_0x805b('0x12'),auth[_0x805b('0xb')](),controller['getApplications']);router[_0x805b('0xa')]('/:id/interactions',auth[_0x805b('0xb')](),controller[_0x805b('0x13')]);router[_0x805b('0xa')](_0x805b('0x14'),auth['isAuthenticated'](),controller[_0x805b('0x15')]);router['post']('/',auth[_0x805b('0xb')](),controller['create']);router[_0x805b('0x16')]('/:id/dispositions',auth[_0x805b('0xb')](),controller[_0x805b('0x17')]);router[_0x805b('0x16')](_0x805b('0x11'),auth[_0x805b('0xb')](),controller[_0x805b('0x18')]);router[_0x805b('0x16')](_0x805b('0x19'),controller['notify']);router[_0x805b('0x16')](_0x805b('0x12'),auth[_0x805b('0xb')](),controller['addApplications']);router[_0x805b('0x16')](_0x805b('0x14'),auth[_0x805b('0xb')](),controller[_0x805b('0x1a')]);router[_0x805b('0x16')]('/:id/send',auth[_0x805b('0xb')](),controller['send']);router[_0x805b('0x1b')](_0x805b('0x1c'),auth[_0x805b('0xb')](),controller[_0x805b('0x1d')]);router[_0x805b('0x1e')](_0x805b('0x1c'),auth[_0x805b('0xb')](),controller['destroy']);router[_0x805b('0x1e')](_0x805b('0xf'),auth['isAuthenticated'](),controller[_0x805b('0x1f')]);router[_0x805b('0x1e')](_0x805b('0x11'),auth[_0x805b('0xb')](),controller[_0x805b('0x20')]);router[_0x805b('0x1e')](_0x805b('0x14'),auth['isAuthenticated'](),controller[_0x805b('0x21')]);module[_0x805b('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0cdbeac..9fd6b0c 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 _0x188a=['mandatoryDisposition','sequelize','randomstring','exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x1a9fc5,_0x3b6393){var _0x1732d1=function(_0x24999a){while(--_0x24999a){_0x1a9fc5['push'](_0x1a9fc5['shift']());}};_0x1732d1(++_0x3b6393);}(_0x188a,0xc5));var _0xa188=function(_0x60cec1,_0x44c052){_0x60cec1=_0x60cec1-0x0;var _0x3fe622=_0x188a[_0x60cec1];return _0x3fe622;};'use strict';var Sequelize=require(_0xa188('0x0'));var rs=require(_0xa188('0x1'));module[_0xa188('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xa188('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa188('0x4')]},'token':{'type':Sequelize[_0xa188('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xa188('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa188('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa188('0x5')],'defaultValue':function(){return _0xa188('0x6');}},'notificationSound':{'type':Sequelize[_0xa188('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa188('0x4')]},'queueTransfer':{'type':Sequelize[_0xa188('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa188('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa188('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa188('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa188('0x7')],'defaultValue':![],'comment':_0xa188('0xa'),'set':function(_0x409fee){if(!_0x409fee)this[_0xa188('0xb')](_0xa188('0xc'),null);this[_0xa188('0xb')](_0xa188('0xd'),_0x409fee);}}}; \ No newline at end of file +var _0xa835=['exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x5ed304,_0x19f6d3){var _0xfe09fb=function(_0x187e02){while(--_0x187e02){_0x5ed304['push'](_0x5ed304['shift']());}};_0xfe09fb(++_0x19f6d3);}(_0xa835,0x13f));var _0x5a83=function(_0x42c0b5,_0x29ec6d){_0x42c0b5=_0x42c0b5-0x0;var _0x202f69=_0xa835[_0x42c0b5];return _0x202f69;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5a83('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5a83('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x5a83('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x5a83('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5a83('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5a83('0x3')],'defaultValue':function(){return _0x5a83('0x4');}},'notificationSound':{'type':Sequelize[_0x5a83('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5a83('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5a83('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5a83('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5a83('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5a83('0x6')],'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[_0x5a83('0x5')],'defaultValue':![],'comment':_0x5a83('0x7'),'set':function(_0x30a608){if(!_0x30a608)this['setDataValue'](_0x5a83('0x8'),null);this[_0x5a83('0x9')](_0x5a83('0xa'),_0x30a608);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index e14f39e..0d291c9 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 _0xb0e9=['error','code','message','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','get','OpenchannelAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','nolimit','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','applications','list','orderBy','priority','asc','account','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','ListId','out','user','Messages','dataValues','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','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','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x317e45,_0x3fc0e2){var _0x4eb100=function(_0x1af30b){while(--_0x1af30b){_0x317e45['push'](_0x317e45['shift']());}};_0x4eb100(++_0x3fc0e2);}(_0xb0e9,0x99));var _0x9b0e=function(_0x38580f,_0x29c673){_0x38580f=_0x38580f-0x0;var _0x5a9282=_0xb0e9[_0x38580f];return _0x5a9282;};'use strict';var pdf=require(_0x9b0e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9b0e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b0e('0x2'));var moment=require(_0x9b0e('0x3'));var BPromise=require(_0x9b0e('0x4'));var Mustache=require(_0x9b0e('0x5'));var util=require(_0x9b0e('0x6'));var path=require(_0x9b0e('0x7'));var sox=require(_0x9b0e('0x8'));var csv=require(_0x9b0e('0x9'));var ejs=require(_0x9b0e('0xa'));var fs=require('fs');var _=require(_0x9b0e('0xb'));var squel=require(_0x9b0e('0xc'));var crypto=require('crypto');var jsforce=require(_0x9b0e('0xd'));var deskjs=require(_0x9b0e('0xe'));var toCsv=require(_0x9b0e('0x9'));var querystring=require(_0x9b0e('0xf'));var Papa=require(_0x9b0e('0x10'));var Redis=require(_0x9b0e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9b0e('0x12'));var as=require(_0x9b0e('0x13'));var hardwareService=require(_0x9b0e('0x14'));var logger=require(_0x9b0e('0x15'))(_0x9b0e('0x16'));var utils=require(_0x9b0e('0x17'));var config=require(_0x9b0e('0x18'));var db=require(_0x9b0e('0x19'))['db'];config['redis']=_[_0x9b0e('0x1a')](config[_0x9b0e('0x1b')],{'host':_0x9b0e('0x1c'),'port':0x18eb});var socket=require(_0x9b0e('0x1d'))(new Redis(config[_0x9b0e('0x1b')]));require('./openchannelAccount.socket')[_0x9b0e('0x1e')](socket);var jayson=require(_0x9b0e('0x1f'));var client=jayson['client'][_0x9b0e('0x20')]({'port':0x232c});var client9002=jayson[_0x9b0e('0x21')][_0x9b0e('0x20')]({'port':0x232a});function checkPasswordPattern(_0x295570,_0x442523,_0x3ed004){if(_0x3ed004){var _0x243b17=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x243b17[_0x9b0e('0x22')](_0x442523)){return _0x295570;}else{throw new db[(_0x9b0e('0x23'))][(_0x9b0e('0x24'))](_0x9b0e('0x25'));}}else{return _0x295570;}}function respondWithRpcPromise(_0x210ac7,_0x4d1ccf,_0x4a1f8b,_0x124131){return new BPromise(function(_0x2e0619,_0x44feec){var _0x321971=_0x124131||client;return _0x321971[_0x9b0e('0x26')](_0x210ac7,_0x4a1f8b)['then'](function(_0x1995e9){logger[_0x9b0e('0x27')](_0x9b0e('0x28'),_0x4d1ccf,_0x9b0e('0x29'));logger[_0x9b0e('0x2a')](_0x9b0e('0x2b'),_0x4d1ccf,'request\x20sent',JSON[_0x9b0e('0x2c')](_0x1995e9));if(_0x1995e9[_0x9b0e('0x2d')]){if(_0x1995e9[_0x9b0e('0x2d')][_0x9b0e('0x2e')]===0x1f4){logger[_0x9b0e('0x2d')]('OpenchannelAccount,\x20%s,\x20%s',_0x4d1ccf,_0x1995e9[_0x9b0e('0x2d')][_0x9b0e('0x2f')]);return _0x44feec(_0x1995e9[_0x9b0e('0x2d')]['message']);}logger[_0x9b0e('0x2d')]('OpenchannelAccount,\x20%s,\x20%s',_0x4d1ccf,_0x1995e9['error']['message']);return _0x2e0619(_0x1995e9[_0x9b0e('0x2d')][_0x9b0e('0x2f')]);}else{logger[_0x9b0e('0x27')](_0x9b0e('0x28'),_0x4d1ccf,'request\x20sent');_0x2e0619(_0x1995e9['result'][_0x9b0e('0x2f')]);}})['catch'](function(_0x14e258){logger['error'](_0x9b0e('0x28'),_0x4d1ccf,_0x14e258);_0x44feec(_0x14e258);});});}function respondWithStatusCode(_0x274f60,_0x9e0817){_0x9e0817=_0x9e0817||0xcc;return function(_0x4d3696){if(_0x4d3696){return _0x274f60[_0x9b0e('0x30')](_0x9e0817);}return _0x274f60[_0x9b0e('0x31')](_0x9e0817)[_0x9b0e('0x32')]();};}function respondWithResult(_0x441fdc,_0x153ce1){_0x153ce1=_0x153ce1||0xc8;return function(_0x24fb14){if(_0x24fb14){return _0x441fdc['status'](_0x153ce1)[_0x9b0e('0x33')](_0x24fb14);}};}function respondWithFilteredResult(_0x2032cc,_0x1a18e1){return function(_0x2891d2){if(_0x2891d2){var _0x389708=_0x2891d2['count'],_0x4d3142=_0x1a18e1[_0x9b0e('0x34')],_0xdd0e93=_0x1a18e1[_0x9b0e('0x34')]+_0x1a18e1[_0x9b0e('0x35')],_0x493ee7;if(_0xdd0e93>=_0x389708){_0xdd0e93=_0x389708;_0x493ee7=0xc8;}else{_0x493ee7=0xce;}_0x2032cc[_0x9b0e('0x31')](_0x493ee7);return _0x2032cc[_0x9b0e('0x36')](_0x9b0e('0x37'),_0x4d3142+'-'+_0xdd0e93+'/'+_0x389708)[_0x9b0e('0x33')](_0x2891d2);}return null;};}function patchUpdates(_0x1d0569){return function(_0x1aa38e){try{jsonpatch[_0x9b0e('0x38')](_0x1aa38e,_0x1d0569,!![]);}catch(_0x4df3fc){return BPromise['reject'](_0x4df3fc);}return _0x1aa38e[_0x9b0e('0x39')]();};}function saveUpdates(_0x4bc0f3,_0x40b88d){return function(_0x4a707c){if(_0x4a707c){return _0x4a707c['update'](_0x4bc0f3)[_0x9b0e('0x3a')](function(_0x247402){return _0x247402;});}return null;};}function removeEntity(_0x3ba29e,_0x4962ef){return function(_0x5aa137){if(_0x5aa137){return _0x5aa137[_0x9b0e('0x3b')]()[_0x9b0e('0x3a')](function(){var _0x26f779=_0x5aa137[_0x9b0e('0x3c')]({'plain':!![]});var _0x110d27=_0x9b0e('0x3d');return db['UserProfileResource']['destroy']({'where':{'type':_0x110d27,'resourceId':_0x26f779['id']}})[_0x9b0e('0x3a')](function(){return _0x5aa137;});})[_0x9b0e('0x3a')](function(){_0x3ba29e[_0x9b0e('0x31')](0xcc)[_0x9b0e('0x32')]();});}};}function handleEntityNotFound(_0x351523,_0x2061ac){return function(_0xfae977){if(!_0xfae977){_0x351523[_0x9b0e('0x30')](0x194);}return _0xfae977;};}function handleError(_0x477a92,_0x28d505){_0x28d505=_0x28d505||0x1f4;return function(_0x50aae4){logger[_0x9b0e('0x2d')](_0x50aae4[_0x9b0e('0x3e')]);if(_0x50aae4[_0x9b0e('0x3f')]){delete _0x50aae4[_0x9b0e('0x3f')];}_0x477a92[_0x9b0e('0x31')](_0x28d505)[_0x9b0e('0x40')](_0x50aae4);};}exports[_0x9b0e('0x41')]=function(_0x2d152f,_0x2b3da9){var _0x98532d={'include':[{'model':db[_0x9b0e('0x42')],'as':_0x9b0e('0x43')}]},_0x2d6ec5={},_0x5a670f={'count':0x0,'rows':[]};var _0x25cf25=_[_0x9b0e('0x44')](db[_0x9b0e('0x45')][_0x9b0e('0x46')],function(_0x56c0fc){return{'name':_0x56c0fc[_0x9b0e('0x47')],'type':_0x56c0fc[_0x9b0e('0x48')][_0x9b0e('0x49')]};});_0x2d6ec5['model']=_['map'](_0x25cf25,_0x9b0e('0x3f'));_0x2d6ec5['query']=_['keys'](_0x2d152f[_0x9b0e('0x4a')]);_0x2d6ec5[_0x9b0e('0x4b')]=_[_0x9b0e('0x4c')](_0x2d6ec5[_0x9b0e('0x4d')],_0x2d6ec5['query']);_0x98532d[_0x9b0e('0x4e')]=_['intersection'](_0x2d6ec5['model'],qs[_0x9b0e('0x4f')](_0x2d152f[_0x9b0e('0x4a')][_0x9b0e('0x4f')]));_0x98532d['attributes']=_0x98532d['attributes'][_0x9b0e('0x50')]?_0x98532d[_0x9b0e('0x4e')]:_0x2d6ec5[_0x9b0e('0x4d')];if(!_0x2d152f[_0x9b0e('0x4a')][_0x9b0e('0x51')]('nolimit')){_0x98532d[_0x9b0e('0x35')]=qs[_0x9b0e('0x35')](_0x2d152f['query']['limit']);_0x98532d['offset']=qs[_0x9b0e('0x34')](_0x2d152f[_0x9b0e('0x4a')]['offset']);}_0x98532d[_0x9b0e('0x52')]=qs[_0x9b0e('0x53')](_0x2d152f[_0x9b0e('0x4a')][_0x9b0e('0x53')]);_0x98532d[_0x9b0e('0x54')]=qs[_0x9b0e('0x4b')](_[_0x9b0e('0x55')](_0x2d152f['query'],_0x2d6ec5['filters']),_0x25cf25);if(_0x2d152f['query'][_0x9b0e('0x56')]){_0x98532d[_0x9b0e('0x54')]=_[_0x9b0e('0x57')](_0x98532d[_0x9b0e('0x54')],{'$or':_[_0x9b0e('0x44')](_0x25cf25,function(_0x34262b){if(_0x34262b[_0x9b0e('0x48')]!==_0x9b0e('0x58')){var _0x4a74af={};_0x4a74af[_0x34262b[_0x9b0e('0x3f')]]={'$like':'%'+_0x2d152f[_0x9b0e('0x4a')][_0x9b0e('0x56')]+'%'};return _0x4a74af;}})});}_0x98532d=_[_0x9b0e('0x57')]({},_0x98532d,_0x2d152f['options']);var _0x94b77a={'where':_0x98532d[_0x9b0e('0x54')]};return db[_0x9b0e('0x45')][_0x9b0e('0x59')](_0x94b77a)[_0x9b0e('0x3a')](function(_0x551f7e){_0x5a670f[_0x9b0e('0x59')]=_0x551f7e;if(_0x2d152f[_0x9b0e('0x4a')][_0x9b0e('0x5a')]){_0x98532d[_0x9b0e('0x5b')]=[{'all':!![]}];}return db[_0x9b0e('0x45')][_0x9b0e('0x5c')](_0x98532d);})[_0x9b0e('0x3a')](function(_0x40523b){_0x5a670f[_0x9b0e('0x5d')]=_0x40523b;return _0x5a670f;})[_0x9b0e('0x3a')](respondWithFilteredResult(_0x2b3da9,_0x98532d))[_0x9b0e('0x5e')](handleError(_0x2b3da9,null));};exports[_0x9b0e('0x5f')]=function(_0x37e979,_0xac8315){var _0x10955e={'raw':![],'where':{'id':_0x37e979[_0x9b0e('0x60')]['id']},'include':[{'model':db[_0x9b0e('0x42')],'as':_0x9b0e('0x43')}]},_0x4a5cbc={};_0x4a5cbc[_0x9b0e('0x4d')]=_['keys'](db[_0x9b0e('0x45')]['rawAttributes']);_0x4a5cbc[_0x9b0e('0x4a')]=_[_0x9b0e('0x61')](_0x37e979[_0x9b0e('0x4a')]);_0x4a5cbc['filters']=_[_0x9b0e('0x4c')](_0x4a5cbc[_0x9b0e('0x4d')],_0x4a5cbc[_0x9b0e('0x4a')]);_0x10955e[_0x9b0e('0x4e')]=_['intersection'](_0x4a5cbc[_0x9b0e('0x4d')],qs['fields'](_0x37e979[_0x9b0e('0x4a')][_0x9b0e('0x4f')]));_0x10955e[_0x9b0e('0x4e')]=_0x10955e[_0x9b0e('0x4e')][_0x9b0e('0x50')]?_0x10955e['attributes']:_0x4a5cbc['model'];if(_0x37e979['query'][_0x9b0e('0x5a')]){_0x10955e[_0x9b0e('0x5b')]=[{'all':!![]}];}_0x10955e=_[_0x9b0e('0x57')]({},_0x10955e,_0x37e979[_0x9b0e('0x62')]);return db[_0x9b0e('0x45')][_0x9b0e('0x63')](_0x10955e)[_0x9b0e('0x3a')](handleEntityNotFound(_0xac8315,null))['then'](respondWithResult(_0xac8315,null))[_0x9b0e('0x5e')](handleError(_0xac8315,null));};exports['create']=function(_0x2507e4,_0x2e0b89){return db[_0x9b0e('0x45')]['create'](_0x2507e4[_0x9b0e('0x64')],{})[_0x9b0e('0x3a')](function(_0x1d2178){var _0x58df47=_0x2507e4['user'][_0x9b0e('0x3c')]({'plain':!![]});if(!_0x58df47)throw new Error(_0x9b0e('0x65'));if(_0x58df47[_0x9b0e('0x66')]==='user'){var _0x5e69cf=_0x1d2178['get']({'plain':!![]});var _0x154783=_0x9b0e('0x3d');return db[_0x9b0e('0x67')][_0x9b0e('0x63')]({'where':{'name':_0x154783,'userProfileId':_0x58df47[_0x9b0e('0x68')]},'raw':!![]})[_0x9b0e('0x3a')](function(_0x1dd143){if(_0x1dd143&&_0x1dd143['autoAssociation']===0x0){return db[_0x9b0e('0x69')][_0x9b0e('0x6a')]({'name':_0x5e69cf[_0x9b0e('0x3f')],'resourceId':_0x5e69cf['id'],'type':_0x1dd143['name'],'sectionId':_0x1dd143['id']},{})[_0x9b0e('0x3a')](function(){return _0x1d2178;});}else{return _0x1d2178;}})['catch'](function(_0xf76c7f){logger[_0x9b0e('0x2d')](_0x9b0e('0x6b'),_0xf76c7f);throw _0xf76c7f;});}return _0x1d2178;})['then'](respondWithResult(_0x2e0b89,0xc9))[_0x9b0e('0x5e')](handleError(_0x2e0b89,null));};exports[_0x9b0e('0x6c')]=function(_0x195079,_0x1f669e){if(_0x195079[_0x9b0e('0x64')]['id']){delete _0x195079[_0x9b0e('0x64')]['id'];}return db[_0x9b0e('0x45')][_0x9b0e('0x63')]({'where':{'id':_0x195079['params']['id']},'include':[{'model':db[_0x9b0e('0x42')],'as':'mandatoryDispositionPause'}]})[_0x9b0e('0x3a')](handleEntityNotFound(_0x1f669e,null))[_0x9b0e('0x3a')](saveUpdates(_0x195079[_0x9b0e('0x64')],null))[_0x9b0e('0x3a')](respondWithResult(_0x1f669e,null))[_0x9b0e('0x5e')](handleError(_0x1f669e,null));};exports[_0x9b0e('0x3b')]=function(_0x29a278,_0x5b6fa0){return db[_0x9b0e('0x45')][_0x9b0e('0x63')]({'where':{'id':_0x29a278['params']['id']}})['then'](handleEntityNotFound(_0x5b6fa0,null))[_0x9b0e('0x3a')](removeEntity(_0x5b6fa0,null))['catch'](handleError(_0x5b6fa0,null));};exports[_0x9b0e('0x6d')]=function(_0x4d1362,_0x371a39){return db[_0x9b0e('0x45')][_0x9b0e('0x6d')]()[_0x9b0e('0x3a')](respondWithResult(_0x371a39,null))[_0x9b0e('0x5e')](handleError(_0x371a39,null));};exports[_0x9b0e('0x6e')]=function(_0x317e0c,_0x2608cb,_0x26c645){if(_0x317e0c[_0x9b0e('0x64')]['id']){delete _0x317e0c[_0x9b0e('0x64')]['id'];}return db[_0x9b0e('0x45')][_0x9b0e('0x63')]({'where':{'id':_0x317e0c[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x2608cb,null))[_0x9b0e('0x3a')](function(_0x390191){if(_0x390191){_0x317e0c['body'][_0x9b0e('0x6f')]=_0x390191['id'];return db['Disposition'][_0x9b0e('0x6a')](_0x317e0c['body']);}})['then'](respondWithResult(_0x2608cb,null))[_0x9b0e('0x5e')](handleError(_0x2608cb,null));};exports[_0x9b0e('0x70')]=function(_0x5b5fc4,_0x17cbee,_0x17ce3e){var _0x2456c3={'raw':![],'where':{}};var _0x2fec3d={};var _0x4419a6={'count':0x0,'rows':[]};return db[_0x9b0e('0x45')][_0x9b0e('0x71')]({'where':{'id':_0x5b5fc4[_0x9b0e('0x60')]['id']}})['then'](handleEntityNotFound(_0x17cbee,null))['then'](function(_0x4d92a8){if(_0x4d92a8){_0x2fec3d[_0x9b0e('0x4d')]=_['keys'](db[_0x9b0e('0x72')]['rawAttributes']);_0x2fec3d[_0x9b0e('0x4a')]=_[_0x9b0e('0x61')](_0x5b5fc4[_0x9b0e('0x4a')]);_0x2fec3d[_0x9b0e('0x4b')]=_[_0x9b0e('0x4c')](_0x2fec3d[_0x9b0e('0x4d')],_0x2fec3d[_0x9b0e('0x4a')]);_0x2456c3[_0x9b0e('0x4e')]=_[_0x9b0e('0x4c')](_0x2fec3d[_0x9b0e('0x4d')],qs['fields'](_0x5b5fc4['query']['fields']));_0x2456c3[_0x9b0e('0x4e')]=_0x2456c3[_0x9b0e('0x4e')][_0x9b0e('0x50')]?_0x2456c3['attributes']:_0x2fec3d[_0x9b0e('0x4d')];if(!_0x5b5fc4[_0x9b0e('0x4a')][_0x9b0e('0x51')](_0x9b0e('0x73'))){_0x2456c3[_0x9b0e('0x35')]=qs[_0x9b0e('0x35')](_0x5b5fc4[_0x9b0e('0x4a')][_0x9b0e('0x35')]);_0x2456c3[_0x9b0e('0x34')]=qs[_0x9b0e('0x34')](_0x5b5fc4[_0x9b0e('0x4a')]['offset']);}_0x2456c3[_0x9b0e('0x52')]=qs[_0x9b0e('0x53')](_0x5b5fc4['query'][_0x9b0e('0x53')]);_0x2456c3[_0x9b0e('0x54')]=qs['filters'](_['pick'](_0x5b5fc4[_0x9b0e('0x4a')],_0x2fec3d[_0x9b0e('0x4b')]));_0x2456c3['where'][_0x9b0e('0x74')]=_0x4d92a8['id'];if(_0x5b5fc4[_0x9b0e('0x4a')][_0x9b0e('0x56')]){_0x2456c3[_0x9b0e('0x54')]=_['merge'](_0x2456c3['where'],{'$or':_['map'](_0x2456c3[_0x9b0e('0x4e')],function(_0x74e327){var _0x4ac3c7={};_0x4ac3c7[_0x74e327]={'$like':'%'+_0x5b5fc4['query'][_0x9b0e('0x56')]+'%'};return _0x4ac3c7;})});}_0x2456c3=_['merge']({},_0x2456c3,_0x5b5fc4['options']);return db[_0x9b0e('0x72')][_0x9b0e('0x59')]({'where':_0x2456c3[_0x9b0e('0x54')]})[_0x9b0e('0x3a')](function(_0x5d2323){_0x4419a6[_0x9b0e('0x59')]=_0x5d2323;if(_0x5b5fc4[_0x9b0e('0x4a')][_0x9b0e('0x5a')]){_0x2456c3['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2456c3);})[_0x9b0e('0x3a')](function(_0xad15d0){_0x4419a6[_0x9b0e('0x5d')]=_0xad15d0;return _0x4419a6;});}})[_0x9b0e('0x3a')](respondWithFilteredResult(_0x17cbee,_0x2456c3))[_0x9b0e('0x5e')](handleError(_0x17cbee,null));};exports['removeDispositions']=function(_0x4b504b,_0x173d6d,_0x3fe37b){return db[_0x9b0e('0x45')][_0x9b0e('0x63')]({'where':{'id':_0x4b504b['params']['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x173d6d,null))[_0x9b0e('0x3a')](function(_0x2bd075){if(_0x2bd075){return _0x2bd075[_0x9b0e('0x75')](_0x4b504b[_0x9b0e('0x4a')]['ids']);}})[_0x9b0e('0x3a')](respondWithStatusCode(_0x173d6d,null))[_0x9b0e('0x5e')](handleError(_0x173d6d,null));};exports[_0x9b0e('0x76')]=function(_0x351e42,_0x429bce,_0x269a63){if(_0x351e42[_0x9b0e('0x64')]['id']){delete _0x351e42[_0x9b0e('0x64')]['id'];}return db[_0x9b0e('0x45')]['find']({'where':{'id':_0x351e42[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x429bce,null))[_0x9b0e('0x3a')](function(_0x44a05d){if(_0x44a05d){_0x351e42[_0x9b0e('0x64')]['OpenchannelAccountId']=_0x44a05d['id'];return db[_0x9b0e('0x77')][_0x9b0e('0x6a')](_0x351e42['body']);}})['then'](respondWithResult(_0x429bce,null))[_0x9b0e('0x5e')](handleError(_0x429bce,null));};exports['getAnswers']=function(_0x29095f,_0x2b657b,_0x1090fd){var _0x2ca673={'raw':![],'where':{}};var _0x563200={};var _0x206abb={'count':0x0,'rows':[]};return db[_0x9b0e('0x45')][_0x9b0e('0x71')]({'where':{'id':_0x29095f[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x2b657b,null))[_0x9b0e('0x3a')](function(_0x2279fe){if(_0x2279fe){_0x563200[_0x9b0e('0x4d')]=_[_0x9b0e('0x61')](db[_0x9b0e('0x77')]['rawAttributes']);_0x563200[_0x9b0e('0x4a')]=_[_0x9b0e('0x61')](_0x29095f[_0x9b0e('0x4a')]);_0x563200['filters']=_[_0x9b0e('0x4c')](_0x563200['model'],_0x563200[_0x9b0e('0x4a')]);_0x2ca673[_0x9b0e('0x4e')]=_[_0x9b0e('0x4c')](_0x563200[_0x9b0e('0x4d')],qs[_0x9b0e('0x4f')](_0x29095f[_0x9b0e('0x4a')]['fields']));_0x2ca673['attributes']=_0x2ca673[_0x9b0e('0x4e')]['length']?_0x2ca673[_0x9b0e('0x4e')]:_0x563200[_0x9b0e('0x4d')];if(!_0x29095f['query']['hasOwnProperty'](_0x9b0e('0x73'))){_0x2ca673[_0x9b0e('0x35')]=qs['limit'](_0x29095f[_0x9b0e('0x4a')][_0x9b0e('0x35')]);_0x2ca673[_0x9b0e('0x34')]=qs[_0x9b0e('0x34')](_0x29095f['query'][_0x9b0e('0x34')]);}_0x2ca673[_0x9b0e('0x52')]=qs[_0x9b0e('0x53')](_0x29095f[_0x9b0e('0x4a')][_0x9b0e('0x53')]);_0x2ca673['where']=qs['filters'](_[_0x9b0e('0x55')](_0x29095f[_0x9b0e('0x4a')],_0x563200['filters']));_0x2ca673[_0x9b0e('0x54')][_0x9b0e('0x74')]=_0x2279fe['id'];if(_0x29095f[_0x9b0e('0x4a')][_0x9b0e('0x56')]){_0x2ca673[_0x9b0e('0x54')]=_[_0x9b0e('0x57')](_0x2ca673[_0x9b0e('0x54')],{'$or':_[_0x9b0e('0x44')](_0x2ca673[_0x9b0e('0x4e')],function(_0x422486){var _0x3aa79c={};_0x3aa79c[_0x422486]={'$like':'%'+_0x29095f[_0x9b0e('0x4a')][_0x9b0e('0x56')]+'%'};return _0x3aa79c;})});}_0x2ca673=_[_0x9b0e('0x57')]({},_0x2ca673,_0x29095f[_0x9b0e('0x62')]);return db[_0x9b0e('0x77')][_0x9b0e('0x59')]({'where':_0x2ca673['where']})[_0x9b0e('0x3a')](function(_0x4d22f8){_0x206abb[_0x9b0e('0x59')]=_0x4d22f8;if(_0x29095f['query']['includeAll']){_0x2ca673[_0x9b0e('0x5b')]=[{'all':!![]}];}return db[_0x9b0e('0x77')][_0x9b0e('0x5c')](_0x2ca673);})[_0x9b0e('0x3a')](function(_0x1d9474){_0x206abb[_0x9b0e('0x5d')]=_0x1d9474;return _0x206abb;});}})['then'](respondWithFilteredResult(_0x2b657b,_0x2ca673))[_0x9b0e('0x5e')](handleError(_0x2b657b,null));};exports[_0x9b0e('0x78')]=function(_0x5a4805,_0x34256d,_0x1251e2){return db[_0x9b0e('0x45')][_0x9b0e('0x63')]({'where':{'id':_0x5a4805[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x34256d,null))[_0x9b0e('0x3a')](function(_0x3fff09){if(_0x3fff09){return _0x3fff09[_0x9b0e('0x78')](_0x5a4805['query'][_0x9b0e('0x79')]);}})[_0x9b0e('0x3a')](respondWithStatusCode(_0x34256d,null))[_0x9b0e('0x5e')](handleError(_0x34256d,null));};exports['notify']=function(_0x42303b,_0x246698,_0x1cbe79){var _0x4de79f={'body':_0x42303b[_0x9b0e('0x64')],'channel':_0x9b0e('0x7a')};var _0x4abf24=[];var _0x263697=[];var _0x52d75b={};var _0x40a503=![];return db[_0x9b0e('0x7b')]['describe']()[_0x9b0e('0x3a')](function(_0xc175ba){if(!_0xc175ba){throw new db['Sequelize'][(_0x9b0e('0x24'))](_0x9b0e('0x7c'));}_0x4abf24=_[_0x9b0e('0x7d')](_[_0x9b0e('0x61')](_0xc175ba),[_0x9b0e('0x7e'),_0x9b0e('0x7f')]);_0x263697=_[_0x9b0e('0x7d')](_[_0x9b0e('0x61')](_0xc175ba),[_0x9b0e('0x7e'),_0x9b0e('0x7f'),_0x9b0e('0x80'),'ListId']);if(_0x42303b[_0x9b0e('0x64')]['id']){delete _0x42303b['body']['id'];}if(_[_0x9b0e('0x81')](_0x42303b['body'][_0x9b0e('0x82')])){throw new db[(_0x9b0e('0x23'))][(_0x9b0e('0x24'))](_0x9b0e('0x83'));}if(_[_0x9b0e('0x81')](_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x64')])||_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x64')]===''){throw new db[(_0x9b0e('0x23'))]['ValidationError'](_0x9b0e('0x84'));}if(_[_0x9b0e('0x81')](_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x85')])){throw new db['Sequelize'][(_0x9b0e('0x24'))](_0x9b0e('0x86')+_0x263697);}if(!_[_0x9b0e('0x87')](_0x263697,_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x85')])){throw new db[(_0x9b0e('0x23'))][(_0x9b0e('0x24'))](_0x9b0e('0x88')+_0x263697);}_0x52d75b[_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x85')]]=_0x42303b[_0x9b0e('0x64')]['from'];})[_0x9b0e('0x3a')](function(){return db[_0x9b0e('0x45')]['find']({'where':{'id':_0x42303b[_0x9b0e('0x60')]['id']},'include':[{'model':db[_0x9b0e('0x89')],'as':'List','include':[{'model':db[_0x9b0e('0x7b')],'as':_0x9b0e('0x8a'),'where':_0x52d75b,'limit':0x1,'order':[[_0x9b0e('0x7f'),_0x9b0e('0x8b')]]}]},{'model':db[_0x9b0e('0x8c')],'as':_0x9b0e('0x8d')}]});})[_0x9b0e('0x3a')](handleEntityNotFound(_0x246698,null))[_0x9b0e('0x3a')](function(_0x597186){if(_0x597186&&_0x597186[_0x9b0e('0x8e')]){_0x4de79f['account']=_0x597186;_0x4de79f[_0x9b0e('0x8f')]=_0x597186[_0x9b0e('0x8d')];_0x4de79f[_0x9b0e('0x90')]=_0x597186[_0x9b0e('0x8e')];_0x4de79f[_0x9b0e('0x8f')]=_[_0x9b0e('0x91')](_0x4de79f['applications'],[_0x9b0e('0x92')],[_0x9b0e('0x93')]);if(_0x4de79f[_0x9b0e('0x94')][_0x9b0e('0x8d')]){delete _0x4de79f[_0x9b0e('0x94')][_0x9b0e('0x8d')];}if(_0x4de79f[_0x9b0e('0x94')][_0x9b0e('0x8e')]&&_0x4de79f[_0x9b0e('0x94')][_0x9b0e('0x8e')][_0x9b0e('0x8a')][_0x9b0e('0x50')]){return _0x4de79f[_0x9b0e('0x94')][_0x9b0e('0x8e')][_0x9b0e('0x8a')][0x0];}var _0x991f6b=_[_0x9b0e('0x1a')](_0x42303b[_0x9b0e('0x64')],{'firstName':_0x42303b['body']['from'],'ListId':_0x597186['ListId']});_0x991f6b[_0x42303b[_0x9b0e('0x64')]['mapKey']]=_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x82')];return db[_0x9b0e('0x7b')][_0x9b0e('0x6a')](_0x991f6b,{'fields':_0x4abf24,'raw':!![]});}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x246698,null))[_0x9b0e('0x3a')](function(_0x23e95f){_0x4de79f[_0x9b0e('0x95')]=_0x23e95f;if(_0x23e95f){var _0x1de7a3={'ContactId':_0x23e95f['id'],'OpenchannelAccountId':_0x42303b[_0x9b0e('0x60')]['id'],'from':(_0x23e95f[_0x9b0e('0x96')]||'')+'\x20'+(_0x23e95f[_0x9b0e('0x97')]||'')};var _0x14609c={'OpenchannelAccountId':_0x42303b[_0x9b0e('0x60')]['id'],'closed':![]};if(_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x98')]){_0x14609c[_0x9b0e('0x98')]=_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x98')];return db['OpenchannelInteraction'][_0x9b0e('0x63')]({'where':_0x14609c})[_0x9b0e('0x3a')](function(_0x3b3c60){if(_0x3b3c60){return[_0x3b3c60,![]];}_0x1de7a3['threadId']=_0x42303b[_0x9b0e('0x64')]['threadId'];_0x1de7a3[_0x9b0e('0x99')]=_0x42303b['body'][_0x9b0e('0x99')];return db[_0x9b0e('0x9a')][_0x9b0e('0x6a')](_0x1de7a3)[_0x9b0e('0x3a')](function(_0x3def30){return[_0x3def30,!![]];});});}else{_0x14609c['threadId']=null;}_0x14609c['ContactId']=_0x23e95f['id'];return db[_0x9b0e('0x9a')][_0x9b0e('0x63')]({'where':_0x14609c})['then'](function(_0x136315){if(_0x136315){return[_0x136315,![]];}return db[_0x9b0e('0x9a')][_0x9b0e('0x6a')](_0x1de7a3)['then'](function(_0x1ec194){return[_0x1ec194,!![]];});});}})[_0x9b0e('0x9b')](function(_0x8152a2,_0x517f72){if(_0x8152a2){_0x40a503=_0x517f72;if(!_0x517f72){var _0x10c70f={'from':(_0x4de79f['contact'][_0x9b0e('0x96')]||'')+'\x20'+(_0x4de79f[_0x9b0e('0x95')][_0x9b0e('0x97')]||'')};if(_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x98')]&&_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x9c')]&&_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x98')]!=_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x9c')]){_0x10c70f[_0x9b0e('0x98')]=_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x9c')];}return _0x8152a2[_0x9b0e('0x6c')](_0x10c70f);}else{return _0x8152a2;}}})['then'](function(_0x4af8fe){_0x4de79f[_0x9b0e('0x9d')]=_0x4af8fe[_0x9b0e('0x3c')]({'plain':!![]});_0x4de79f[_0x9b0e('0x9d')][_0x9b0e('0x9e')]=_0x40a503;if(_0x4de79f[_0x9b0e('0x9d')][_0x9b0e('0x9e')]){if(_0x4de79f[_0x9b0e('0x94')][_0x9b0e('0x9f')]){_0x4de79f[_0x9b0e('0x8f')][_0x9b0e('0xa0')]({'id':0x0,'priority':_0x4de79f['applications'][_0x9b0e('0x50')]+0x1,'app':_0x9b0e('0xa1'),'appdata':_0x9b0e('0xa2'),'interval':'*,*,*,*'});}}return db[_0x9b0e('0xa3')][_0x9b0e('0x6a')]({'body':_0x42303b[_0x9b0e('0x64')][_0x9b0e('0x64')],'OpenchannelAccountId':_0x42303b['params']['id'],'OpenchannelInteractionId':_0x4af8fe['id'],'direction':'in','ContactId':_0x4de79f[_0x9b0e('0x95')]['id'],'AttachmentId':_0x42303b[_0x9b0e('0x64')][_0x9b0e('0xa4')]});})[_0x9b0e('0x3a')](function(_0x45e608){_0x4de79f['message']=_0x45e608;if(_0x4de79f[_0x9b0e('0x9d')][_0x9b0e('0xa5')]){return db[_0x9b0e('0xa6')][_0x9b0e('0x63')]({'attributes':['id','name'],'where':{'id':_0x4de79f[_0x9b0e('0x9d')][_0x9b0e('0xa5')]}})['then'](function(_0x1802b2){if(_0x1802b2){_0x4de79f[_0x9b0e('0x8f')][_0x9b0e('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1802b2[_0x9b0e('0x3f')]+','+(_0x4de79f[_0x9b0e('0x94')][_0x9b0e('0xa8')]||0xa),'interval':_0x9b0e('0xa9')});_0x4de79f[_0x9b0e('0xaa')]=![];}return respondWithRpcPromise('Start',_0x9b0e('0xab'),_0x4de79f);});}return respondWithRpcPromise(_0x9b0e('0xac'),_0x9b0e('0xab'),_0x4de79f);})[_0x9b0e('0x3a')](function(_0x5dafbe){respondWithRpcPromise(_0x9b0e('0xad'),_0x9b0e('0xad'),{'event':'notify','message':_0x5dafbe},client9002);return _0x5dafbe;})[_0x9b0e('0x3a')](respondWithResult(_0x246698,null))[_0x9b0e('0x5e')](handleError(_0x246698,null));};exports['addApplications']=function(_0x3e9455,_0x59d805,_0x2122b9){return db[_0x9b0e('0x45')]['findOne']({'where':{'id':_0x3e9455[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x59d805,null))[_0x9b0e('0x3a')](function(_0x23bc1c){if(_0x23bc1c){return db['sequelize'][_0x9b0e('0xae')](function(_0x3acf6b){return db[_0x9b0e('0x8c')][_0x9b0e('0x3b')]({'where':{'OpenchannelAccountId':_0x3e9455[_0x9b0e('0x60')]['id']},'transaction':_0x3acf6b})[_0x9b0e('0x3a')](function(_0x5c6cd8){var _0x23baea=_[_0x9b0e('0x44')](_0x3e9455['body'],function(_0x5bec8c){_0x5bec8c[_0x9b0e('0x74')]=_0x3e9455['params']['id'];return _0x5bec8c;});return db[_0x9b0e('0x8c')][_0x9b0e('0xaf')](_0x23baea,{'transaction':_0x3acf6b});});})['then'](function(){return db[_0x9b0e('0x8c')][_0x9b0e('0xb0')]({'where':{'OpenchannelAccountId':_0x3e9455[_0x9b0e('0x60')]['id']},'order':'priority'});});}})[_0x9b0e('0x3a')](respondWithResult(_0x59d805,null))['catch'](handleError(_0x59d805,null));};exports[_0x9b0e('0xb1')]=function(_0x132202,_0x44597a,_0x37fae6){var _0x120b6b={};var _0x438974={};var _0x284b90;var _0x1eccbe;return db[_0x9b0e('0x45')]['findOne']({'where':{'id':_0x132202[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x44597a,null))[_0x9b0e('0x3a')](function(_0x2b522b){if(_0x2b522b){_0x284b90=_0x2b522b;_0x438974[_0x9b0e('0x4d')]=_[_0x9b0e('0x61')](db[_0x9b0e('0x8c')][_0x9b0e('0x46')]);_0x438974[_0x9b0e('0x4a')]=_[_0x9b0e('0x61')](_0x132202[_0x9b0e('0x4a')]);_0x438974[_0x9b0e('0x4b')]=_[_0x9b0e('0x4c')](_0x438974[_0x9b0e('0x4d')],_0x438974[_0x9b0e('0x4a')]);_0x120b6b[_0x9b0e('0x4e')]=_[_0x9b0e('0x4c')](_0x438974[_0x9b0e('0x4d')],qs['fields'](_0x132202[_0x9b0e('0x4a')]['fields']));_0x120b6b[_0x9b0e('0x4e')]=_0x120b6b['attributes'][_0x9b0e('0x50')]?_0x120b6b['attributes']:_0x438974[_0x9b0e('0x4d')];_0x120b6b[_0x9b0e('0x52')]=qs[_0x9b0e('0x53')](_0x132202[_0x9b0e('0x4a')][_0x9b0e('0x53')]);_0x120b6b[_0x9b0e('0x54')]=qs[_0x9b0e('0x4b')](_[_0x9b0e('0x55')](_0x132202['query'],_0x438974[_0x9b0e('0x4b')]));if(_0x132202[_0x9b0e('0x4a')][_0x9b0e('0x56')]){_0x120b6b[_0x9b0e('0x54')]=_['merge'](_0x120b6b[_0x9b0e('0x54')],{'$or':_['map'](_0x120b6b[_0x9b0e('0x4e')],function(_0x775f41){var _0xe8f7ad={};_0xe8f7ad[_0x775f41]={'$like':'%'+_0x132202['query']['filter']+'%'};return _0xe8f7ad;})});}_0x120b6b=_[_0x9b0e('0x57')]({},_0x120b6b,_0x132202['options']);return _0x284b90['getApplications'](_0x120b6b);}})['then'](function(_0x1f7ed9){if(_0x1f7ed9){_0x1eccbe=_0x1f7ed9['length'];if(!_0x132202[_0x9b0e('0x4a')][_0x9b0e('0x51')](_0x9b0e('0x73'))){_0x120b6b['limit']=qs[_0x9b0e('0x35')](_0x132202['query'][_0x9b0e('0x35')]);_0x120b6b[_0x9b0e('0x34')]=qs[_0x9b0e('0x34')](_0x132202[_0x9b0e('0x4a')][_0x9b0e('0x34')]);}return _0x284b90[_0x9b0e('0xb1')](_0x120b6b);}})[_0x9b0e('0x3a')](function(_0x3bd943){if(_0x3bd943){return _0x3bd943?{'count':_0x1eccbe,'rows':_0x3bd943}:null;}})[_0x9b0e('0x3a')](respondWithResult(_0x44597a,null))[_0x9b0e('0x5e')](handleError(_0x44597a,null));};exports[_0x9b0e('0xb2')]=function(_0x197397,_0x36f7cd,_0x426104){var _0x39c85f={'raw':![],'where':{}};var _0x19631b={};var _0x4a47fd={'count':0x0,'rows':[]};return db[_0x9b0e('0x45')][_0x9b0e('0x71')]({'where':{'id':_0x197397[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x36f7cd,null))[_0x9b0e('0x3a')](function(_0x1b08f6){if(_0x1b08f6){_0x19631b[_0x9b0e('0x4d')]=_[_0x9b0e('0x61')](db[_0x9b0e('0x9a')][_0x9b0e('0x46')]);_0x19631b[_0x9b0e('0x4a')]=_[_0x9b0e('0x61')](_0x197397[_0x9b0e('0x4a')]);_0x19631b['filters']=_[_0x9b0e('0x4c')](_0x19631b[_0x9b0e('0x4d')],_0x19631b[_0x9b0e('0x4a')]);_0x39c85f['attributes']=_['intersection'](_0x19631b[_0x9b0e('0x4d')],qs[_0x9b0e('0x4f')](_0x197397[_0x9b0e('0x4a')][_0x9b0e('0x4f')]));_0x39c85f[_0x9b0e('0x4e')]=_0x39c85f['attributes'][_0x9b0e('0x50')]?_0x39c85f[_0x9b0e('0x4e')]:_0x19631b[_0x9b0e('0x4d')];if(!_0x197397[_0x9b0e('0x4a')]['hasOwnProperty']('nolimit')){_0x39c85f['limit']=qs[_0x9b0e('0x35')](_0x197397[_0x9b0e('0x4a')][_0x9b0e('0x35')]);_0x39c85f[_0x9b0e('0x34')]=qs['offset'](_0x197397['query'][_0x9b0e('0x34')]);}_0x39c85f[_0x9b0e('0x52')]=qs['sort'](_0x197397[_0x9b0e('0x4a')][_0x9b0e('0x53')]);_0x39c85f[_0x9b0e('0x54')]=qs['filters'](_[_0x9b0e('0x55')](_0x197397['query'],_0x19631b[_0x9b0e('0x4b')]));_0x39c85f['where'][_0x9b0e('0x74')]=_0x1b08f6['id'];if(_0x197397[_0x9b0e('0x4a')][_0x9b0e('0x56')]){_0x39c85f[_0x9b0e('0x54')]=_[_0x9b0e('0x57')](_0x39c85f[_0x9b0e('0x54')],{'$or':_[_0x9b0e('0x44')](_0x39c85f[_0x9b0e('0x4e')],function(_0x16840a){var _0x2e43eb={};_0x2e43eb[_0x16840a]={'$like':'%'+_0x197397[_0x9b0e('0x4a')][_0x9b0e('0x56')]+'%'};return _0x2e43eb;})});}_0x39c85f=_[_0x9b0e('0x57')]({},_0x39c85f,_0x197397[_0x9b0e('0x62')]);return db[_0x9b0e('0x9a')][_0x9b0e('0x59')]({'where':_0x39c85f[_0x9b0e('0x54')]})[_0x9b0e('0x3a')](function(_0x43cc1b){_0x4a47fd['count']=_0x43cc1b;if(_0x197397[_0x9b0e('0x4a')][_0x9b0e('0x5a')]){_0x39c85f[_0x9b0e('0x5b')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x9b0e('0xa6')],'as':_0x9b0e('0xb3'),'attributes':[_0x9b0e('0x3f'),'fullname',_0x9b0e('0xb4')],'required':![]},{'model':db[_0x9b0e('0xb5')],'as':_0x9b0e('0xb6'),'attributes':['id',_0x9b0e('0x3f'),_0x9b0e('0xb7')],'where':_0x197397[_0x9b0e('0x4a')]['tag']?{'id':_0x197397[_0x9b0e('0x4a')][_0x9b0e('0xb8')]}:undefined,'required':_0x197397[_0x9b0e('0x4a')][_0x9b0e('0xb8')]?!![]:![]}];}return db[_0x9b0e('0x9a')][_0x9b0e('0x5c')](_0x39c85f);})[_0x9b0e('0x3a')](function(_0x273c37){_0x4a47fd[_0x9b0e('0x5d')]=_0x273c37;return _0x4a47fd;});}})[_0x9b0e('0x3a')](respondWithFilteredResult(_0x36f7cd,_0x39c85f))[_0x9b0e('0x5e')](handleError(_0x36f7cd,null));};exports['addAgents']=function(_0x16bcc9,_0x274283,_0x1dc936){return db[_0x9b0e('0x45')]['find']({'where':{'id':_0x16bcc9[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x274283,null))[_0x9b0e('0x3a')](function(_0x23365f){if(_0x23365f){return _0x23365f[_0x9b0e('0xb9')](_0x16bcc9[_0x9b0e('0x64')]['ids'],_[_0x9b0e('0xba')](_0x16bcc9[_0x9b0e('0x64')],[_0x9b0e('0x79'),'id'])||{})['spread'](function(_0x3608d1){for(var _0x3c60e0=0x0;_0x3c60e0<_0x16bcc9[_0x9b0e('0x64')][_0x9b0e('0x79')][_0x9b0e('0x50')];_0x3c60e0+=0x1){socket['emit'](_0x9b0e('0xbb'),{'UserId':_0x16bcc9[_0x9b0e('0x64')][_0x9b0e('0x79')][_0x3c60e0],'OpenchannelAccountId':_0x16bcc9[_0x9b0e('0x60')]['id']});}return _0x3608d1;});}})['then'](respondWithResult(_0x274283,null))[_0x9b0e('0x5e')](handleError(_0x274283,null));};exports['removeAgents']=function(_0x4e8369,_0x30b028,_0x204bcc){return db[_0x9b0e('0x45')][_0x9b0e('0x63')]({'where':{'id':_0x4e8369[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x30b028,null))[_0x9b0e('0x3a')](function(_0x2bf023){if(_0x2bf023){return _0x2bf023[_0x9b0e('0xbc')](_0x4e8369[_0x9b0e('0x4a')][_0x9b0e('0x79')])['then'](function(){if(_[_0x9b0e('0xbd')](_0x4e8369[_0x9b0e('0x4a')]['ids'])){for(var _0x324593=0x0;_0x324593<_0x4e8369['query'][_0x9b0e('0x79')]['length'];_0x324593+=0x1){socket[_0x9b0e('0xbe')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4e8369[_0x9b0e('0x4a')][_0x9b0e('0x79')][_0x324593]),'OpenchannelAccountId':Number(_0x4e8369[_0x9b0e('0x60')]['id'])});}}else{socket[_0x9b0e('0xbe')](_0x9b0e('0xbf'),{'UserId':Number(_0x4e8369[_0x9b0e('0x4a')]['ids']),'OpenchannelAccountId':Number(_0x4e8369[_0x9b0e('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x30b028,null))[_0x9b0e('0x5e')](handleError(_0x30b028,null));};exports[_0x9b0e('0xc0')]=function(_0x3884fc,_0x52a167,_0x9882f7){var _0x1c2b20={};var _0x62c044={};var _0x3e71fc;var _0x2cf948;return db[_0x9b0e('0x45')]['findOne']({'where':{'id':_0x3884fc[_0x9b0e('0x60')]['id']}})[_0x9b0e('0x3a')](handleEntityNotFound(_0x52a167,null))[_0x9b0e('0x3a')](function(_0x114009){if(_0x114009){_0x3e71fc=_0x114009;_0x62c044[_0x9b0e('0x4d')]=_[_0x9b0e('0x61')](db['User'][_0x9b0e('0x46')]);_0x62c044[_0x9b0e('0x4a')]=_['keys'](_0x3884fc[_0x9b0e('0x4a')]);_0x62c044[_0x9b0e('0x4b')]=_[_0x9b0e('0x4c')](_0x62c044[_0x9b0e('0x4d')],_0x62c044[_0x9b0e('0x4a')]);_0x1c2b20['attributes']=_['intersection'](_0x62c044[_0x9b0e('0x4d')],qs[_0x9b0e('0x4f')](_0x3884fc['query'][_0x9b0e('0x4f')]));_0x1c2b20[_0x9b0e('0x4e')]=_0x1c2b20[_0x9b0e('0x4e')][_0x9b0e('0x50')]?_0x1c2b20[_0x9b0e('0x4e')]:_0x62c044[_0x9b0e('0x4d')];_0x1c2b20['order']=qs[_0x9b0e('0x53')](_0x3884fc['query'][_0x9b0e('0x53')]);_0x1c2b20[_0x9b0e('0x54')]=qs[_0x9b0e('0x4b')](_[_0x9b0e('0x55')](_0x3884fc[_0x9b0e('0x4a')],_0x62c044[_0x9b0e('0x4b')]));if(_0x3884fc[_0x9b0e('0x4a')][_0x9b0e('0x56')]){_0x1c2b20['where']=_[_0x9b0e('0x57')](_0x1c2b20[_0x9b0e('0x54')],{'$or':_[_0x9b0e('0x44')](_0x1c2b20[_0x9b0e('0x4e')],function(_0x111abd){var _0x5d7462={};_0x5d7462[_0x111abd]={'$like':'%'+_0x3884fc[_0x9b0e('0x4a')][_0x9b0e('0x56')]+'%'};return _0x5d7462;})});}_0x1c2b20=_[_0x9b0e('0x57')]({},_0x1c2b20,_0x3884fc[_0x9b0e('0x62')]);return _0x3e71fc[_0x9b0e('0xc0')](_0x1c2b20);}})[_0x9b0e('0x3a')](function(_0x566c42){if(_0x566c42){_0x2cf948=_0x566c42['length'];if(!_0x3884fc[_0x9b0e('0x4a')][_0x9b0e('0x51')](_0x9b0e('0x73'))){_0x1c2b20[_0x9b0e('0x35')]=qs[_0x9b0e('0x35')](_0x3884fc[_0x9b0e('0x4a')]['limit']);_0x1c2b20[_0x9b0e('0x34')]=qs[_0x9b0e('0x34')](_0x3884fc[_0x9b0e('0x4a')]['offset']);}return _0x3e71fc[_0x9b0e('0xc0')](_0x1c2b20);}})['then'](function(_0x422595){if(_0x422595){return _0x422595?{'count':_0x2cf948,'rows':_0x422595}:null;}})[_0x9b0e('0x3a')](respondWithResult(_0x52a167,null))[_0x9b0e('0x5e')](handleError(_0x52a167,null));};exports[_0x9b0e('0x40')]=function(_0x47a0fa,_0xc4f5e,_0x510cc8){var _0x56b349,_0x41d0f4,_0xc1f62b;if(_[_0x9b0e('0x81')](_0x47a0fa[_0x9b0e('0x64')][_0x9b0e('0x64')])||_0x47a0fa['body'][_0x9b0e('0x64')]===''){throw new db[(_0x9b0e('0x23'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9b0e('0x81')](_0x47a0fa[_0x9b0e('0x64')]['to'])){}_0x56b349=_0x47a0fa[_0x9b0e('0x64')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x47a0fa[_0x9b0e('0x60')]['id']}})['then'](handleEntityNotFound(_0xc4f5e,null))[_0x9b0e('0x3a')](function(_0x1ededf){if(_0x1ededf){return db[_0x9b0e('0x45')][_0x9b0e('0x63')]({'where':{'id':_0x1ededf['id']},'include':[{'model':db[_0x9b0e('0x89')],'as':_0x9b0e('0x8e'),'include':[{'model':db['CmContact'],'as':_0x9b0e('0x8a'),'where':{[_0x1ededf[_0x9b0e('0x85')]]:_0x56b349},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x9b0e('0x3a')](handleEntityNotFound(_0xc4f5e,null))[_0x9b0e('0x3a')](function(_0x289d20){if(_0x289d20&&_0x289d20[_0x9b0e('0x8e')]){_0x41d0f4=_0x289d20['get']({'plain':!![]});if(_0x41d0f4[_0x9b0e('0x8e')]&&_0x41d0f4[_0x9b0e('0x8e')][_0x9b0e('0x8a')][_0x9b0e('0x50')]){return _0x41d0f4['List'][_0x9b0e('0x8a')][0x0];}return db[_0x9b0e('0x7b')][_0x9b0e('0x6a')](_[_0x9b0e('0x1a')](_0x47a0fa[_0x9b0e('0x64')],{'firstName':_0x56b349,[_0x289d20[_0x9b0e('0x85')]]:_0x56b349,'phone':_0x56b349,'ListId':_0x41d0f4[_0x9b0e('0xc1')]}));}})[_0x9b0e('0x3a')](handleEntityNotFound(_0xc4f5e,null))['then'](function(_0x1f394b){if(_0x1f394b){_0xc1f62b=_0x1f394b;return db[_0x9b0e('0x9a')][_0x9b0e('0x63')]({'where':{'ContactId':_0xc1f62b['id'],'closed':![],'OpenchannelAccountId':_0x41d0f4['id']}})[_0x9b0e('0x3a')](function(_0x51da82){if(_0x51da82){return[_0x51da82,![]];}return db[_0x9b0e('0x9a')][_0x9b0e('0x6a')]({'UserId':_0x47a0fa['user']['id'],'ContactId':_0xc1f62b['id'],'OpenchannelAccountId':_0x41d0f4['id'],'lastMsgDirection':_0x9b0e('0xc2'),'Messages':[_[_0x9b0e('0x57')](_0x47a0fa[_0x9b0e('0x64')],{'read':![],'body':_0x47a0fa[_0x9b0e('0x64')][_0x9b0e('0x64')],'OpenchannelAccountId':_0x41d0f4['id'],'UserId':_0x47a0fa[_0x9b0e('0xc3')]['id'],'ContactId':_0xc1f62b['id']})]},{'include':[{'model':db[_0x9b0e('0xa3')],'as':_0x9b0e('0xc4')}]})['then'](function(_0x9a3ced){return[_0x9a3ced,!![]];});});}})[_0x9b0e('0x9b')](function(_0x1f37df,_0x14c900){if(_0x14c900){return _0x1f37df;}return db[_0x9b0e('0xa3')]['create'](_[_0x9b0e('0x57')](_0x47a0fa[_0x9b0e('0x64')],{'read':![],'body':_0x47a0fa['body']['body'],'OpenchannelAccountId':_0x41d0f4['id'],'OpenchannelInteractionId':_0x1f37df['id'],'UserId':_0x47a0fa[_0x9b0e('0xc3')]['id'],'ContactId':_0xc1f62b['id']}))[_0x9b0e('0x3a')](function(_0x5ef36d){_0x1f37df[_0x9b0e('0xc5')][_0x9b0e('0xc4')]=[];_0x1f37df[_0x9b0e('0xc5')][_0x9b0e('0xc4')][_0x9b0e('0xa0')](_0x5ef36d[_0x9b0e('0xc5')]);return _0x1f37df;});});}})[_0x9b0e('0x3a')](respondWithResult(_0xc4f5e,null))[_0x9b0e('0x5e')](handleError(_0xc4f5e,null));}; \ No newline at end of file +var _0x0c2f=['sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelAccount','count','includeAll','include','findAll','rows','show','params','rawAttributes','keys','fields','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','body','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','List','account','applications','priority','asc','Applications','defaults','contact','firstName','lastName','OpenchannelInteraction','threadId','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','ids','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','send','out','OpenchannelMessage','Messages','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','type','model','query','filters','intersection','attributes','nolimit','order'];(function(_0x470e3f,_0x3b513d){var _0x4fd22b=function(_0x35d0b2){while(--_0x35d0b2){_0x470e3f['push'](_0x470e3f['shift']());}};_0x4fd22b(++_0x3b513d);}(_0x0c2f,0x1f4));var _0xf0c2=function(_0x3c0b76,_0x170065){_0x3c0b76=_0x3c0b76-0x0;var _0x51906d=_0x0c2f[_0x3c0b76];return _0x51906d;};'use strict';var pdf=require(_0xf0c2('0x0'));var emlformat=require(_0xf0c2('0x1'));var rimraf=require(_0xf0c2('0x2'));var zipdir=require(_0xf0c2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0c2('0x4'));var moment=require(_0xf0c2('0x5'));var BPromise=require(_0xf0c2('0x6'));var Mustache=require(_0xf0c2('0x7'));var util=require(_0xf0c2('0x8'));var path=require(_0xf0c2('0x9'));var sox=require(_0xf0c2('0xa'));var csv=require(_0xf0c2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf0c2('0xc'));var crypto=require(_0xf0c2('0xd'));var jsforce=require(_0xf0c2('0xe'));var deskjs=require(_0xf0c2('0xf'));var toCsv=require(_0xf0c2('0xb'));var querystring=require(_0xf0c2('0x10'));var Papa=require(_0xf0c2('0x11'));var Redis=require(_0xf0c2('0x12'));var authService=require(_0xf0c2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0c2('0x14'));var logger=require(_0xf0c2('0x15'))(_0xf0c2('0x16'));var utils=require(_0xf0c2('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xf0c2('0x18')],{'host':_0xf0c2('0x19'),'port':0x18eb});var socket=require(_0xf0c2('0x1a'))(new Redis(config[_0xf0c2('0x18')]));require(_0xf0c2('0x1b'))[_0xf0c2('0x1c')](socket);var jayson=require(_0xf0c2('0x1d'));var client=jayson[_0xf0c2('0x1e')][_0xf0c2('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x40031f,_0x3cd8f6,_0x1959c0){if(_0x1959c0){var _0x574944=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x574944[_0xf0c2('0x20')](_0x3cd8f6)){return _0x40031f;}else{throw new db[(_0xf0c2('0x21'))]['ValidationError'](_0xf0c2('0x22'));}}else{return _0x40031f;}}function respondWithRpcPromise(_0x2f72b9,_0x5b588c,_0xe844a0,_0x21b7c5){return new BPromise(function(_0x516c45,_0x4a7991){var _0x26e82d=_0x21b7c5||client;return _0x26e82d['request'](_0x2f72b9,_0xe844a0)[_0xf0c2('0x23')](function(_0x17c292){logger[_0xf0c2('0x24')](_0xf0c2('0x25'),_0x5b588c,_0xf0c2('0x26'));logger[_0xf0c2('0x27')](_0xf0c2('0x28'),_0x5b588c,'request\x20sent',JSON[_0xf0c2('0x29')](_0x17c292));if(_0x17c292[_0xf0c2('0x2a')]){if(_0x17c292[_0xf0c2('0x2a')]['code']===0x1f4){logger[_0xf0c2('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b588c,_0x17c292[_0xf0c2('0x2a')]['message']);return _0x4a7991(_0x17c292['error']['message']);}logger[_0xf0c2('0x2a')](_0xf0c2('0x25'),_0x5b588c,_0x17c292['error'][_0xf0c2('0x2b')]);return _0x516c45(_0x17c292[_0xf0c2('0x2a')][_0xf0c2('0x2b')]);}else{logger[_0xf0c2('0x24')](_0xf0c2('0x25'),_0x5b588c,_0xf0c2('0x26'));_0x516c45(_0x17c292[_0xf0c2('0x2c')][_0xf0c2('0x2b')]);}})['catch'](function(_0x57509c){logger[_0xf0c2('0x2a')](_0xf0c2('0x25'),_0x5b588c,_0x57509c);_0x4a7991(_0x57509c);});});}function respondWithStatusCode(_0x479775,_0x4a746d){_0x4a746d=_0x4a746d||0xcc;return function(_0x1cb626){if(_0x1cb626){return _0x479775[_0xf0c2('0x2d')](_0x4a746d);}return _0x479775[_0xf0c2('0x2e')](_0x4a746d)[_0xf0c2('0x2f')]();};}function respondWithResult(_0x435a35,_0x13558e){_0x13558e=_0x13558e||0xc8;return function(_0x4a6714){if(_0x4a6714){return _0x435a35['status'](_0x13558e)[_0xf0c2('0x30')](_0x4a6714);}};}function respondWithFilteredResult(_0x232d1d,_0x4f6d58){return function(_0x31df2c){if(_0x31df2c){var _0x586777=_0x31df2c['count'],_0x805379=_0x4f6d58[_0xf0c2('0x31')],_0xee4c8f=_0x4f6d58[_0xf0c2('0x31')]+_0x4f6d58[_0xf0c2('0x32')],_0x1319f2;if(_0xee4c8f>=_0x586777){_0xee4c8f=_0x586777;_0x1319f2=0xc8;}else{_0x1319f2=0xce;}_0x232d1d[_0xf0c2('0x2e')](_0x1319f2);return _0x232d1d[_0xf0c2('0x33')](_0xf0c2('0x34'),_0x805379+'-'+_0xee4c8f+'/'+_0x586777)[_0xf0c2('0x30')](_0x31df2c);}return null;};}function patchUpdates(_0x4517dd){return function(_0x125be4){try{jsonpatch[_0xf0c2('0x35')](_0x125be4,_0x4517dd,!![]);}catch(_0x40d2e6){return BPromise[_0xf0c2('0x36')](_0x40d2e6);}return _0x125be4[_0xf0c2('0x37')]();};}function saveUpdates(_0x28bc6a,_0x248d40){return function(_0xbc4cc7){if(_0xbc4cc7){return _0xbc4cc7[_0xf0c2('0x38')](_0x28bc6a)['then'](function(_0x50a7e3){return _0x50a7e3;});}return null;};}function removeEntity(_0x42af11,_0x2f0e4e){return function(_0x52a348){if(_0x52a348){return _0x52a348[_0xf0c2('0x39')]()['then'](function(){var _0x2f11c6=_0x52a348[_0xf0c2('0x3a')]({'plain':!![]});var _0x4f5878='OpenchannelAccounts';return db[_0xf0c2('0x3b')][_0xf0c2('0x39')]({'where':{'type':_0x4f5878,'resourceId':_0x2f11c6['id']}})[_0xf0c2('0x23')](function(){return _0x52a348;});})['then'](function(){_0x42af11[_0xf0c2('0x2e')](0xcc)[_0xf0c2('0x2f')]();});}};}function handleEntityNotFound(_0x284c87,_0x3c63ee){return function(_0x53c2b4){if(!_0x53c2b4){_0x284c87[_0xf0c2('0x2d')](0x194);}return _0x53c2b4;};}function handleError(_0xc2445c,_0x1790bf){_0x1790bf=_0x1790bf||0x1f4;return function(_0x2b45bc){logger[_0xf0c2('0x2a')](_0x2b45bc[_0xf0c2('0x3c')]);if(_0x2b45bc[_0xf0c2('0x3d')]){delete _0x2b45bc['name'];}_0xc2445c[_0xf0c2('0x2e')](_0x1790bf)['send'](_0x2b45bc);};}exports['index']=function(_0x445a68,_0x1d3fb7){var _0x5e5cdf={'include':[{'model':db[_0xf0c2('0x3e')],'as':_0xf0c2('0x3f')}]},_0x294086={},_0x2133a7={'count':0x0,'rows':[]};var _0x3eea4e=_[_0xf0c2('0x40')](db['OpenchannelAccount']['rawAttributes'],function(_0x2ea169){return{'name':_0x2ea169['fieldName'],'type':_0x2ea169[_0xf0c2('0x41')]['key']};});_0x294086[_0xf0c2('0x42')]=_[_0xf0c2('0x40')](_0x3eea4e,'name');_0x294086[_0xf0c2('0x43')]=_['keys'](_0x445a68[_0xf0c2('0x43')]);_0x294086[_0xf0c2('0x44')]=_[_0xf0c2('0x45')](_0x294086['model'],_0x294086[_0xf0c2('0x43')]);_0x5e5cdf[_0xf0c2('0x46')]=_[_0xf0c2('0x45')](_0x294086['model'],qs['fields'](_0x445a68[_0xf0c2('0x43')]['fields']));_0x5e5cdf['attributes']=_0x5e5cdf['attributes']['length']?_0x5e5cdf['attributes']:_0x294086[_0xf0c2('0x42')];if(!_0x445a68[_0xf0c2('0x43')]['hasOwnProperty'](_0xf0c2('0x47'))){_0x5e5cdf[_0xf0c2('0x32')]=qs['limit'](_0x445a68[_0xf0c2('0x43')][_0xf0c2('0x32')]);_0x5e5cdf[_0xf0c2('0x31')]=qs[_0xf0c2('0x31')](_0x445a68[_0xf0c2('0x43')][_0xf0c2('0x31')]);}_0x5e5cdf[_0xf0c2('0x48')]=qs['sort'](_0x445a68['query'][_0xf0c2('0x49')]);_0x5e5cdf['where']=qs[_0xf0c2('0x44')](_[_0xf0c2('0x4a')](_0x445a68[_0xf0c2('0x43')],_0x294086['filters']),_0x3eea4e);if(_0x445a68[_0xf0c2('0x43')][_0xf0c2('0x4b')]){_0x5e5cdf[_0xf0c2('0x4c')]=_[_0xf0c2('0x4d')](_0x5e5cdf['where'],{'$or':_['map'](_0x3eea4e,function(_0x452b51){if(_0x452b51['type']!==_0xf0c2('0x4e')){var _0x4be077={};_0x4be077[_0x452b51[_0xf0c2('0x3d')]]={'$like':'%'+_0x445a68[_0xf0c2('0x43')][_0xf0c2('0x4b')]+'%'};return _0x4be077;}})});}_0x5e5cdf=_[_0xf0c2('0x4d')]({},_0x5e5cdf,_0x445a68[_0xf0c2('0x4f')]);var _0x10e0a0={'where':_0x5e5cdf[_0xf0c2('0x4c')]};return db[_0xf0c2('0x50')][_0xf0c2('0x51')](_0x10e0a0)['then'](function(_0x5777c6){_0x2133a7[_0xf0c2('0x51')]=_0x5777c6;if(_0x445a68['query'][_0xf0c2('0x52')]){_0x5e5cdf[_0xf0c2('0x53')]=[{'all':!![]}];}return db[_0xf0c2('0x50')][_0xf0c2('0x54')](_0x5e5cdf);})[_0xf0c2('0x23')](function(_0xe41651){_0x2133a7[_0xf0c2('0x55')]=_0xe41651;return _0x2133a7;})[_0xf0c2('0x23')](respondWithFilteredResult(_0x1d3fb7,_0x5e5cdf))['catch'](handleError(_0x1d3fb7,null));};exports[_0xf0c2('0x56')]=function(_0x28610a,_0x19c660){var _0x314a2d={'raw':![],'where':{'id':_0x28610a[_0xf0c2('0x57')]['id']},'include':[{'model':db[_0xf0c2('0x3e')],'as':'mandatoryDispositionPause'}]},_0x104d72={};_0x104d72[_0xf0c2('0x42')]=_['keys'](db['OpenchannelAccount'][_0xf0c2('0x58')]);_0x104d72[_0xf0c2('0x43')]=_[_0xf0c2('0x59')](_0x28610a[_0xf0c2('0x43')]);_0x104d72[_0xf0c2('0x44')]=_[_0xf0c2('0x45')](_0x104d72[_0xf0c2('0x42')],_0x104d72['query']);_0x314a2d[_0xf0c2('0x46')]=_[_0xf0c2('0x45')](_0x104d72[_0xf0c2('0x42')],qs[_0xf0c2('0x5a')](_0x28610a[_0xf0c2('0x43')][_0xf0c2('0x5a')]));_0x314a2d['attributes']=_0x314a2d['attributes'][_0xf0c2('0x5b')]?_0x314a2d['attributes']:_0x104d72[_0xf0c2('0x42')];if(_0x28610a[_0xf0c2('0x43')]['includeAll']){_0x314a2d[_0xf0c2('0x53')]=[{'all':!![]}];}_0x314a2d=_[_0xf0c2('0x4d')]({},_0x314a2d,_0x28610a[_0xf0c2('0x4f')]);return db[_0xf0c2('0x50')][_0xf0c2('0x5c')](_0x314a2d)[_0xf0c2('0x23')](handleEntityNotFound(_0x19c660,null))[_0xf0c2('0x23')](respondWithResult(_0x19c660,null))[_0xf0c2('0x5d')](handleError(_0x19c660,null));};exports['create']=function(_0x20b91e,_0x2cc527){return db['OpenchannelAccount'][_0xf0c2('0x5e')](_0x20b91e['body'],{})['then'](function(_0x4b13ec){var _0x81d4dd=_0x20b91e[_0xf0c2('0x5f')][_0xf0c2('0x3a')]({'plain':!![]});if(!_0x81d4dd)throw new Error(_0xf0c2('0x60'));if(_0x81d4dd['role']===_0xf0c2('0x5f')){var _0x476635=_0x4b13ec[_0xf0c2('0x3a')]({'plain':!![]});var _0x3f5131=_0xf0c2('0x61');return db[_0xf0c2('0x62')][_0xf0c2('0x5c')]({'where':{'name':_0x3f5131,'userProfileId':_0x81d4dd[_0xf0c2('0x63')]},'raw':!![]})[_0xf0c2('0x23')](function(_0x1b0ebe){if(_0x1b0ebe&&_0x1b0ebe[_0xf0c2('0x64')]===0x0){return db[_0xf0c2('0x3b')][_0xf0c2('0x5e')]({'name':_0x476635[_0xf0c2('0x3d')],'resourceId':_0x476635['id'],'type':_0x1b0ebe[_0xf0c2('0x3d')],'sectionId':_0x1b0ebe['id']},{})[_0xf0c2('0x23')](function(){return _0x4b13ec;});}else{return _0x4b13ec;}})[_0xf0c2('0x5d')](function(_0x2f3895){logger[_0xf0c2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f3895);throw _0x2f3895;});}return _0x4b13ec;})[_0xf0c2('0x23')](respondWithResult(_0x2cc527,0xc9))[_0xf0c2('0x5d')](handleError(_0x2cc527,null));};exports[_0xf0c2('0x38')]=function(_0xd07c68,_0x223715){if(_0xd07c68[_0xf0c2('0x65')]['id']){delete _0xd07c68[_0xf0c2('0x65')]['id'];}return db['OpenchannelAccount'][_0xf0c2('0x5c')]({'where':{'id':_0xd07c68[_0xf0c2('0x57')]['id']},'include':[{'model':db[_0xf0c2('0x3e')],'as':_0xf0c2('0x3f')}]})['then'](handleEntityNotFound(_0x223715,null))['then'](saveUpdates(_0xd07c68[_0xf0c2('0x65')],null))[_0xf0c2('0x23')](respondWithResult(_0x223715,null))[_0xf0c2('0x5d')](handleError(_0x223715,null));};exports[_0xf0c2('0x39')]=function(_0x169eab,_0x55b273){return db[_0xf0c2('0x50')][_0xf0c2('0x5c')]({'where':{'id':_0x169eab[_0xf0c2('0x57')]['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x55b273,null))[_0xf0c2('0x23')](removeEntity(_0x55b273,null))[_0xf0c2('0x5d')](handleError(_0x55b273,null));};exports['describe']=function(_0x3e6779,_0x4beeb0){return db[_0xf0c2('0x50')]['describe']()[_0xf0c2('0x23')](respondWithResult(_0x4beeb0,null))[_0xf0c2('0x5d')](handleError(_0x4beeb0,null));};exports[_0xf0c2('0x66')]=function(_0x131835,_0x325504,_0x4b7101){if(_0x131835[_0xf0c2('0x65')]['id']){delete _0x131835[_0xf0c2('0x65')]['id'];}return db[_0xf0c2('0x50')][_0xf0c2('0x5c')]({'where':{'id':_0x131835['params']['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x325504,null))[_0xf0c2('0x23')](function(_0x640337){if(_0x640337){_0x131835[_0xf0c2('0x65')][_0xf0c2('0x67')]=_0x640337['id'];return db['Disposition'][_0xf0c2('0x5e')](_0x131835[_0xf0c2('0x65')]);}})['then'](respondWithResult(_0x325504,null))[_0xf0c2('0x5d')](handleError(_0x325504,null));};exports[_0xf0c2('0x68')]=function(_0x475107,_0x585c0c,_0xb9dc55){var _0x295194={'raw':![],'where':{}};var _0x4db42a={};var _0x50b2fa={'count':0x0,'rows':[]};return db[_0xf0c2('0x50')][_0xf0c2('0x69')]({'where':{'id':_0x475107['params']['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x585c0c,null))[_0xf0c2('0x23')](function(_0x1055fd){if(_0x1055fd){_0x4db42a[_0xf0c2('0x42')]=_['keys'](db[_0xf0c2('0x6a')][_0xf0c2('0x58')]);_0x4db42a[_0xf0c2('0x43')]=_[_0xf0c2('0x59')](_0x475107[_0xf0c2('0x43')]);_0x4db42a[_0xf0c2('0x44')]=_[_0xf0c2('0x45')](_0x4db42a[_0xf0c2('0x42')],_0x4db42a['query']);_0x295194[_0xf0c2('0x46')]=_[_0xf0c2('0x45')](_0x4db42a[_0xf0c2('0x42')],qs[_0xf0c2('0x5a')](_0x475107['query'][_0xf0c2('0x5a')]));_0x295194[_0xf0c2('0x46')]=_0x295194['attributes'][_0xf0c2('0x5b')]?_0x295194[_0xf0c2('0x46')]:_0x4db42a[_0xf0c2('0x42')];if(!_0x475107[_0xf0c2('0x43')][_0xf0c2('0x6b')](_0xf0c2('0x47'))){_0x295194['limit']=qs[_0xf0c2('0x32')](_0x475107['query'][_0xf0c2('0x32')]);_0x295194['offset']=qs[_0xf0c2('0x31')](_0x475107[_0xf0c2('0x43')]['offset']);}_0x295194[_0xf0c2('0x48')]=qs['sort'](_0x475107[_0xf0c2('0x43')][_0xf0c2('0x49')]);_0x295194[_0xf0c2('0x4c')]=qs[_0xf0c2('0x44')](_['pick'](_0x475107['query'],_0x4db42a['filters']));_0x295194[_0xf0c2('0x4c')]['OpenchannelAccountId']=_0x1055fd['id'];if(_0x475107[_0xf0c2('0x43')][_0xf0c2('0x4b')]){_0x295194[_0xf0c2('0x4c')]=_[_0xf0c2('0x4d')](_0x295194[_0xf0c2('0x4c')],{'$or':_['map'](_0x295194['attributes'],function(_0x28386a){var _0x5eb198={};_0x5eb198[_0x28386a]={'$like':'%'+_0x475107[_0xf0c2('0x43')][_0xf0c2('0x4b')]+'%'};return _0x5eb198;})});}_0x295194=_[_0xf0c2('0x4d')]({},_0x295194,_0x475107[_0xf0c2('0x4f')]);return db[_0xf0c2('0x6a')][_0xf0c2('0x51')]({'where':_0x295194[_0xf0c2('0x4c')]})['then'](function(_0x41edbe){_0x50b2fa[_0xf0c2('0x51')]=_0x41edbe;if(_0x475107[_0xf0c2('0x43')][_0xf0c2('0x52')]){_0x295194['include']=[{'all':!![]}];}return db[_0xf0c2('0x6a')][_0xf0c2('0x54')](_0x295194);})['then'](function(_0x5997f7){_0x50b2fa['rows']=_0x5997f7;return _0x50b2fa;});}})[_0xf0c2('0x23')](respondWithFilteredResult(_0x585c0c,_0x295194))[_0xf0c2('0x5d')](handleError(_0x585c0c,null));};exports[_0xf0c2('0x6c')]=function(_0x4cc6db,_0x329080,_0x533c11){return db['OpenchannelAccount'][_0xf0c2('0x5c')]({'where':{'id':_0x4cc6db['params']['id']}})['then'](handleEntityNotFound(_0x329080,null))[_0xf0c2('0x23')](function(_0x5d0c1a){if(_0x5d0c1a){return _0x5d0c1a[_0xf0c2('0x6c')](_0x4cc6db[_0xf0c2('0x43')]['ids']);}})[_0xf0c2('0x23')](respondWithStatusCode(_0x329080,null))['catch'](handleError(_0x329080,null));};exports[_0xf0c2('0x6d')]=function(_0x1dcda1,_0x2c61a4,_0x352bd5){if(_0x1dcda1['body']['id']){delete _0x1dcda1[_0xf0c2('0x65')]['id'];}return db['OpenchannelAccount'][_0xf0c2('0x5c')]({'where':{'id':_0x1dcda1['params']['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x2c61a4,null))[_0xf0c2('0x23')](function(_0x14c46a){if(_0x14c46a){_0x1dcda1['body'][_0xf0c2('0x6e')]=_0x14c46a['id'];return db[_0xf0c2('0x6f')][_0xf0c2('0x5e')](_0x1dcda1[_0xf0c2('0x65')]);}})[_0xf0c2('0x23')](respondWithResult(_0x2c61a4,null))['catch'](handleError(_0x2c61a4,null));};exports[_0xf0c2('0x70')]=function(_0x2c6628,_0xc24933,_0x5228ec){var _0x32738a={'raw':![],'where':{}};var _0x2488f0={};var _0x476a0b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf0c2('0x69')]({'where':{'id':_0x2c6628['params']['id']}})['then'](handleEntityNotFound(_0xc24933,null))[_0xf0c2('0x23')](function(_0x1f3746){if(_0x1f3746){_0x2488f0[_0xf0c2('0x42')]=_[_0xf0c2('0x59')](db[_0xf0c2('0x6f')]['rawAttributes']);_0x2488f0['query']=_[_0xf0c2('0x59')](_0x2c6628['query']);_0x2488f0['filters']=_['intersection'](_0x2488f0[_0xf0c2('0x42')],_0x2488f0[_0xf0c2('0x43')]);_0x32738a[_0xf0c2('0x46')]=_[_0xf0c2('0x45')](_0x2488f0[_0xf0c2('0x42')],qs[_0xf0c2('0x5a')](_0x2c6628[_0xf0c2('0x43')][_0xf0c2('0x5a')]));_0x32738a[_0xf0c2('0x46')]=_0x32738a[_0xf0c2('0x46')]['length']?_0x32738a[_0xf0c2('0x46')]:_0x2488f0[_0xf0c2('0x42')];if(!_0x2c6628[_0xf0c2('0x43')]['hasOwnProperty'](_0xf0c2('0x47'))){_0x32738a[_0xf0c2('0x32')]=qs[_0xf0c2('0x32')](_0x2c6628[_0xf0c2('0x43')]['limit']);_0x32738a[_0xf0c2('0x31')]=qs[_0xf0c2('0x31')](_0x2c6628[_0xf0c2('0x43')]['offset']);}_0x32738a[_0xf0c2('0x48')]=qs['sort'](_0x2c6628[_0xf0c2('0x43')]['sort']);_0x32738a['where']=qs[_0xf0c2('0x44')](_[_0xf0c2('0x4a')](_0x2c6628[_0xf0c2('0x43')],_0x2488f0['filters']));_0x32738a[_0xf0c2('0x4c')][_0xf0c2('0x6e')]=_0x1f3746['id'];if(_0x2c6628[_0xf0c2('0x43')][_0xf0c2('0x4b')]){_0x32738a[_0xf0c2('0x4c')]=_['merge'](_0x32738a['where'],{'$or':_[_0xf0c2('0x40')](_0x32738a['attributes'],function(_0x49a8d7){var _0x1ff907={};_0x1ff907[_0x49a8d7]={'$like':'%'+_0x2c6628[_0xf0c2('0x43')][_0xf0c2('0x4b')]+'%'};return _0x1ff907;})});}_0x32738a=_[_0xf0c2('0x4d')]({},_0x32738a,_0x2c6628[_0xf0c2('0x4f')]);return db[_0xf0c2('0x6f')][_0xf0c2('0x51')]({'where':_0x32738a[_0xf0c2('0x4c')]})['then'](function(_0x53d01b){_0x476a0b[_0xf0c2('0x51')]=_0x53d01b;if(_0x2c6628['query'][_0xf0c2('0x52')]){_0x32738a[_0xf0c2('0x53')]=[{'all':!![]}];}return db[_0xf0c2('0x6f')][_0xf0c2('0x54')](_0x32738a);})[_0xf0c2('0x23')](function(_0x42d96a){_0x476a0b[_0xf0c2('0x55')]=_0x42d96a;return _0x476a0b;});}})[_0xf0c2('0x23')](respondWithFilteredResult(_0xc24933,_0x32738a))[_0xf0c2('0x5d')](handleError(_0xc24933,null));};exports[_0xf0c2('0x71')]=function(_0x3fa21f,_0xa6be90,_0x31590f){return db['OpenchannelAccount'][_0xf0c2('0x5c')]({'where':{'id':_0x3fa21f[_0xf0c2('0x57')]['id']}})['then'](handleEntityNotFound(_0xa6be90,null))[_0xf0c2('0x23')](function(_0x17ea4b){if(_0x17ea4b){return _0x17ea4b['removeAnswers'](_0x3fa21f[_0xf0c2('0x43')]['ids']);}})['then'](respondWithStatusCode(_0xa6be90,null))['catch'](handleError(_0xa6be90,null));};exports[_0xf0c2('0x72')]=function(_0x3cb24f,_0x1da90b,_0x3feb82){var _0x220937={'body':_0x3cb24f[_0xf0c2('0x65')],'channel':'openchannel'};var _0x42f347=[];var _0x585422=[];var _0x25550a={};var _0x29ea0c=![];return db[_0xf0c2('0x73')][_0xf0c2('0x74')]()[_0xf0c2('0x23')](function(_0x154417){if(!_0x154417){throw new db[(_0xf0c2('0x21'))]['ValidationError'](_0xf0c2('0x75'));}_0x42f347=_[_0xf0c2('0x76')](_[_0xf0c2('0x59')](_0x154417),[_0xf0c2('0x77'),_0xf0c2('0x78')]);_0x585422=_[_0xf0c2('0x76')](_[_0xf0c2('0x59')](_0x154417),[_0xf0c2('0x77'),_0xf0c2('0x78'),'CompanyId',_0xf0c2('0x79')]);if(_0x3cb24f['body']['id']){delete _0x3cb24f[_0xf0c2('0x65')]['id'];}if(_[_0xf0c2('0x7a')](_0x3cb24f['body'][_0xf0c2('0x7b')])){throw new db[(_0xf0c2('0x21'))][(_0xf0c2('0x7c'))](_0xf0c2('0x7d'));}if(_[_0xf0c2('0x7a')](_0x3cb24f['body']['body'])||_0x3cb24f[_0xf0c2('0x65')][_0xf0c2('0x65')]===''){throw new db[(_0xf0c2('0x21'))][(_0xf0c2('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf0c2('0x7a')](_0x3cb24f['body'][_0xf0c2('0x7e')])){throw new db[(_0xf0c2('0x21'))][(_0xf0c2('0x7c'))](_0xf0c2('0x7f')+_0x585422);}if(!_[_0xf0c2('0x80')](_0x585422,_0x3cb24f[_0xf0c2('0x65')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x585422);}_0x25550a[_0x3cb24f[_0xf0c2('0x65')][_0xf0c2('0x7e')]]=_0x3cb24f[_0xf0c2('0x65')][_0xf0c2('0x7b')];})[_0xf0c2('0x23')](function(){return db[_0xf0c2('0x50')][_0xf0c2('0x5c')]({'where':{'id':_0x3cb24f['params']['id']},'include':[{'model':db[_0xf0c2('0x81')],'as':'List','include':[{'model':db[_0xf0c2('0x73')],'as':_0xf0c2('0x82'),'where':_0x25550a,'limit':0x1,'order':[['updatedAt',_0xf0c2('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xf0c2('0x23')](handleEntityNotFound(_0x1da90b,null))[_0xf0c2('0x23')](function(_0x4a2d07){if(_0x4a2d07&&_0x4a2d07[_0xf0c2('0x84')]){_0x220937[_0xf0c2('0x85')]=_0x4a2d07;_0x220937[_0xf0c2('0x86')]=_0x4a2d07['Applications'];_0x220937['list']=_0x4a2d07['List'];_0x220937[_0xf0c2('0x86')]=_['orderBy'](_0x220937[_0xf0c2('0x86')],[_0xf0c2('0x87')],[_0xf0c2('0x88')]);if(_0x220937[_0xf0c2('0x85')]['Applications']){delete _0x220937[_0xf0c2('0x85')][_0xf0c2('0x89')];}if(_0x220937[_0xf0c2('0x85')][_0xf0c2('0x84')]&&_0x220937[_0xf0c2('0x85')][_0xf0c2('0x84')][_0xf0c2('0x82')][_0xf0c2('0x5b')]){return _0x220937[_0xf0c2('0x85')][_0xf0c2('0x84')]['Contacts'][0x0];}var _0x1ab8ee=_[_0xf0c2('0x8a')](_0x3cb24f[_0xf0c2('0x65')],{'firstName':_0x3cb24f[_0xf0c2('0x65')][_0xf0c2('0x7b')],'ListId':_0x4a2d07[_0xf0c2('0x79')]});_0x1ab8ee[_0x3cb24f[_0xf0c2('0x65')][_0xf0c2('0x7e')]]=_0x3cb24f[_0xf0c2('0x65')]['from'];return db[_0xf0c2('0x73')][_0xf0c2('0x5e')](_0x1ab8ee,{'fields':_0x42f347,'raw':!![]});}})[_0xf0c2('0x23')](handleEntityNotFound(_0x1da90b,null))[_0xf0c2('0x23')](function(_0x532c2e){_0x220937[_0xf0c2('0x8b')]=_0x532c2e;if(_0x532c2e){var _0x28e4f7={'ContactId':_0x532c2e['id'],'OpenchannelAccountId':_0x3cb24f[_0xf0c2('0x57')]['id'],'from':(_0x532c2e[_0xf0c2('0x8c')]||'')+'\x20'+(_0x532c2e[_0xf0c2('0x8d')]||'')};var _0x588fc6={'OpenchannelAccountId':_0x3cb24f[_0xf0c2('0x57')]['id'],'closed':![]};if(_0x3cb24f['body']['threadId']){_0x588fc6['threadId']=_0x3cb24f[_0xf0c2('0x65')]['threadId'];return db[_0xf0c2('0x8e')][_0xf0c2('0x5c')]({'where':_0x588fc6})[_0xf0c2('0x23')](function(_0x542c4d){if(_0x542c4d){return[_0x542c4d,![]];}_0x28e4f7[_0xf0c2('0x8f')]=_0x3cb24f[_0xf0c2('0x65')]['threadId'];_0x28e4f7['externalUrl']=_0x3cb24f[_0xf0c2('0x65')]['externalUrl'];return db[_0xf0c2('0x8e')][_0xf0c2('0x5e')](_0x28e4f7)[_0xf0c2('0x23')](function(_0xd7c132){return[_0xd7c132,!![]];});});}else{_0x588fc6[_0xf0c2('0x8f')]=null;}_0x588fc6['ContactId']=_0x532c2e['id'];return db[_0xf0c2('0x8e')][_0xf0c2('0x5c')]({'where':_0x588fc6})['then'](function(_0x1f1d18){if(_0x1f1d18){return[_0x1f1d18,![]];}return db[_0xf0c2('0x8e')]['create'](_0x28e4f7)[_0xf0c2('0x23')](function(_0x44923e){return[_0x44923e,!![]];});});}})[_0xf0c2('0x90')](function(_0x733b72,_0x5656b2){if(_0x733b72){_0x29ea0c=_0x5656b2;if(!_0x5656b2){var _0x53ec2c={'from':(_0x220937[_0xf0c2('0x8b')][_0xf0c2('0x8c')]||'')+'\x20'+(_0x220937[_0xf0c2('0x8b')][_0xf0c2('0x8d')]||'')};if(_0x3cb24f[_0xf0c2('0x65')][_0xf0c2('0x8f')]&&_0x3cb24f['body'][_0xf0c2('0x91')]&&_0x3cb24f[_0xf0c2('0x65')]['threadId']!=_0x3cb24f[_0xf0c2('0x65')][_0xf0c2('0x91')]){_0x53ec2c[_0xf0c2('0x8f')]=_0x3cb24f[_0xf0c2('0x65')]['messageId'];}return _0x733b72[_0xf0c2('0x38')](_0x53ec2c);}else{return _0x733b72;}}})[_0xf0c2('0x23')](function(_0x311dc8){_0x220937[_0xf0c2('0x92')]=_0x311dc8[_0xf0c2('0x3a')]({'plain':!![]});_0x220937[_0xf0c2('0x92')][_0xf0c2('0x93')]=_0x29ea0c;if(_0x220937[_0xf0c2('0x92')][_0xf0c2('0x93')]){if(_0x220937[_0xf0c2('0x85')][_0xf0c2('0x94')]){_0x220937[_0xf0c2('0x86')]['push']({'id':0x0,'priority':_0x220937['applications'][_0xf0c2('0x5b')]+0x1,'app':_0xf0c2('0x95'),'appdata':_0xf0c2('0x96'),'interval':_0xf0c2('0x97')});}}return db['OpenchannelMessage'][_0xf0c2('0x5e')]({'body':_0x3cb24f[_0xf0c2('0x65')][_0xf0c2('0x65')],'OpenchannelAccountId':_0x3cb24f['params']['id'],'OpenchannelInteractionId':_0x311dc8['id'],'direction':'in','ContactId':_0x220937['contact']['id'],'AttachmentId':_0x3cb24f['body'][_0xf0c2('0x98')]});})[_0xf0c2('0x23')](function(_0x40f6cd){_0x220937['message']=_0x40f6cd;if(_0x220937[_0xf0c2('0x92')][_0xf0c2('0x99')]){return db[_0xf0c2('0x9a')][_0xf0c2('0x5c')]({'attributes':['id',_0xf0c2('0x3d')],'where':{'id':_0x220937['interaction'][_0xf0c2('0x99')]}})[_0xf0c2('0x23')](function(_0xf469d2){if(_0xf469d2){_0x220937[_0xf0c2('0x86')][_0xf0c2('0x9b')]({'id':0x0,'priority':0x0,'app':_0xf0c2('0x9c'),'appdata':_0xf469d2[_0xf0c2('0x3d')]+','+(_0x220937[_0xf0c2('0x85')][_0xf0c2('0x9d')]||0xa),'interval':'*,*,*,*'});_0x220937[_0xf0c2('0x9e')]=![];}return respondWithRpcPromise('Start',_0xf0c2('0x9f'),_0x220937);});}return respondWithRpcPromise(_0xf0c2('0xa0'),_0xf0c2('0x9f'),_0x220937);})[_0xf0c2('0x23')](function(_0x358b0e){respondWithRpcPromise(_0xf0c2('0xa1'),_0xf0c2('0xa1'),{'event':_0xf0c2('0x72'),'message':_0x358b0e},client9002);return _0x358b0e;})[_0xf0c2('0x23')](respondWithResult(_0x1da90b,null))[_0xf0c2('0x5d')](handleError(_0x1da90b,null));};exports[_0xf0c2('0xa2')]=function(_0x1c1ae5,_0x2a9a95,_0xd1acc6){return db[_0xf0c2('0x50')][_0xf0c2('0x69')]({'where':{'id':_0x1c1ae5[_0xf0c2('0x57')]['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x2a9a95,null))['then'](function(_0x144328){if(_0x144328){return db[_0xf0c2('0xa3')][_0xf0c2('0xa4')](function(_0x128d07){return db[_0xf0c2('0xa5')][_0xf0c2('0x39')]({'where':{'OpenchannelAccountId':_0x1c1ae5[_0xf0c2('0x57')]['id']},'transaction':_0x128d07})['then'](function(_0x8d6a50){var _0x1c746e=_['map'](_0x1c1ae5[_0xf0c2('0x65')],function(_0x15ab5e){_0x15ab5e['OpenchannelAccountId']=_0x1c1ae5[_0xf0c2('0x57')]['id'];return _0x15ab5e;});return db[_0xf0c2('0xa5')][_0xf0c2('0xa6')](_0x1c746e,{'transaction':_0x128d07});});})[_0xf0c2('0x23')](function(){return db[_0xf0c2('0xa5')][_0xf0c2('0xa7')]({'where':{'OpenchannelAccountId':_0x1c1ae5[_0xf0c2('0x57')]['id']},'order':_0xf0c2('0x87')});});}})[_0xf0c2('0x23')](respondWithResult(_0x2a9a95,null))['catch'](handleError(_0x2a9a95,null));};exports[_0xf0c2('0xa8')]=function(_0xa9ba70,_0x2e5c58,_0x4effce){var _0x58ad30={};var _0x2e52e5={};var _0x5a942c;var _0x18d72b;return db['OpenchannelAccount'][_0xf0c2('0x69')]({'where':{'id':_0xa9ba70[_0xf0c2('0x57')]['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x2e5c58,null))[_0xf0c2('0x23')](function(_0x5f2c10){if(_0x5f2c10){_0x5a942c=_0x5f2c10;_0x2e52e5[_0xf0c2('0x42')]=_[_0xf0c2('0x59')](db[_0xf0c2('0xa5')][_0xf0c2('0x58')]);_0x2e52e5[_0xf0c2('0x43')]=_['keys'](_0xa9ba70['query']);_0x2e52e5[_0xf0c2('0x44')]=_[_0xf0c2('0x45')](_0x2e52e5['model'],_0x2e52e5['query']);_0x58ad30[_0xf0c2('0x46')]=_[_0xf0c2('0x45')](_0x2e52e5[_0xf0c2('0x42')],qs[_0xf0c2('0x5a')](_0xa9ba70[_0xf0c2('0x43')][_0xf0c2('0x5a')]));_0x58ad30[_0xf0c2('0x46')]=_0x58ad30[_0xf0c2('0x46')][_0xf0c2('0x5b')]?_0x58ad30[_0xf0c2('0x46')]:_0x2e52e5[_0xf0c2('0x42')];_0x58ad30['order']=qs[_0xf0c2('0x49')](_0xa9ba70[_0xf0c2('0x43')][_0xf0c2('0x49')]);_0x58ad30['where']=qs[_0xf0c2('0x44')](_['pick'](_0xa9ba70[_0xf0c2('0x43')],_0x2e52e5['filters']));if(_0xa9ba70[_0xf0c2('0x43')][_0xf0c2('0x4b')]){_0x58ad30[_0xf0c2('0x4c')]=_['merge'](_0x58ad30[_0xf0c2('0x4c')],{'$or':_[_0xf0c2('0x40')](_0x58ad30[_0xf0c2('0x46')],function(_0xcef377){var _0x3e602d={};_0x3e602d[_0xcef377]={'$like':'%'+_0xa9ba70['query']['filter']+'%'};return _0x3e602d;})});}_0x58ad30=_[_0xf0c2('0x4d')]({},_0x58ad30,_0xa9ba70[_0xf0c2('0x4f')]);return _0x5a942c['getApplications'](_0x58ad30);}})['then'](function(_0x2fc6ab){if(_0x2fc6ab){_0x18d72b=_0x2fc6ab['length'];if(!_0xa9ba70[_0xf0c2('0x43')]['hasOwnProperty'](_0xf0c2('0x47'))){_0x58ad30['limit']=qs['limit'](_0xa9ba70[_0xf0c2('0x43')][_0xf0c2('0x32')]);_0x58ad30['offset']=qs[_0xf0c2('0x31')](_0xa9ba70[_0xf0c2('0x43')][_0xf0c2('0x31')]);}return _0x5a942c[_0xf0c2('0xa8')](_0x58ad30);}})['then'](function(_0x9abdef){if(_0x9abdef){return _0x9abdef?{'count':_0x18d72b,'rows':_0x9abdef}:null;}})['then'](respondWithResult(_0x2e5c58,null))[_0xf0c2('0x5d')](handleError(_0x2e5c58,null));};exports['getInteractions']=function(_0x12f654,_0x143222,_0x489661){var _0x5e32d1={'raw':![],'where':{}};var _0x17b948={};var _0x4b6a7b={'count':0x0,'rows':[]};return db[_0xf0c2('0x50')][_0xf0c2('0x69')]({'where':{'id':_0x12f654[_0xf0c2('0x57')]['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x143222,null))['then'](function(_0x5e9a35){if(_0x5e9a35){_0x17b948[_0xf0c2('0x42')]=_['keys'](db[_0xf0c2('0x8e')][_0xf0c2('0x58')]);_0x17b948[_0xf0c2('0x43')]=_[_0xf0c2('0x59')](_0x12f654[_0xf0c2('0x43')]);_0x17b948['filters']=_[_0xf0c2('0x45')](_0x17b948[_0xf0c2('0x42')],_0x17b948['query']);_0x5e32d1[_0xf0c2('0x46')]=_[_0xf0c2('0x45')](_0x17b948[_0xf0c2('0x42')],qs[_0xf0c2('0x5a')](_0x12f654[_0xf0c2('0x43')][_0xf0c2('0x5a')]));_0x5e32d1['attributes']=_0x5e32d1[_0xf0c2('0x46')][_0xf0c2('0x5b')]?_0x5e32d1[_0xf0c2('0x46')]:_0x17b948[_0xf0c2('0x42')];if(!_0x12f654[_0xf0c2('0x43')][_0xf0c2('0x6b')](_0xf0c2('0x47'))){_0x5e32d1[_0xf0c2('0x32')]=qs[_0xf0c2('0x32')](_0x12f654[_0xf0c2('0x43')][_0xf0c2('0x32')]);_0x5e32d1[_0xf0c2('0x31')]=qs[_0xf0c2('0x31')](_0x12f654[_0xf0c2('0x43')][_0xf0c2('0x31')]);}_0x5e32d1[_0xf0c2('0x48')]=qs[_0xf0c2('0x49')](_0x12f654[_0xf0c2('0x43')][_0xf0c2('0x49')]);_0x5e32d1['where']=qs[_0xf0c2('0x44')](_[_0xf0c2('0x4a')](_0x12f654[_0xf0c2('0x43')],_0x17b948[_0xf0c2('0x44')]));_0x5e32d1[_0xf0c2('0x4c')]['OpenchannelAccountId']=_0x5e9a35['id'];if(_0x12f654['query']['filter']){_0x5e32d1[_0xf0c2('0x4c')]=_[_0xf0c2('0x4d')](_0x5e32d1[_0xf0c2('0x4c')],{'$or':_[_0xf0c2('0x40')](_0x5e32d1[_0xf0c2('0x46')],function(_0x5e4922){var _0x1084a1={};_0x1084a1[_0x5e4922]={'$like':'%'+_0x12f654[_0xf0c2('0x43')][_0xf0c2('0x4b')]+'%'};return _0x1084a1;})});}_0x5e32d1=_[_0xf0c2('0x4d')]({},_0x5e32d1,_0x12f654[_0xf0c2('0x4f')]);return db[_0xf0c2('0x8e')]['count']({'where':_0x5e32d1[_0xf0c2('0x4c')]})[_0xf0c2('0x23')](function(_0xd39f67){_0x4b6a7b[_0xf0c2('0x51')]=_0xd39f67;if(_0x12f654['query'][_0xf0c2('0x52')]){_0x5e32d1['include']=[{'model':db[_0xf0c2('0x73')],'as':_0xf0c2('0xa9'),'required':![]},{'model':db[_0xf0c2('0x9a')],'as':_0xf0c2('0xaa'),'attributes':[_0xf0c2('0x3d'),_0xf0c2('0xab'),_0xf0c2('0xac')],'required':![]},{'model':db['Tag'],'as':_0xf0c2('0xad'),'attributes':['id',_0xf0c2('0x3d'),_0xf0c2('0xae')],'where':_0x12f654[_0xf0c2('0x43')][_0xf0c2('0xaf')]?{'id':_0x12f654[_0xf0c2('0x43')][_0xf0c2('0xaf')]}:undefined,'required':_0x12f654['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xf0c2('0x54')](_0x5e32d1);})[_0xf0c2('0x23')](function(_0x339aed){_0x4b6a7b['rows']=_0x339aed;return _0x4b6a7b;});}})[_0xf0c2('0x23')](respondWithFilteredResult(_0x143222,_0x5e32d1))['catch'](handleError(_0x143222,null));};exports[_0xf0c2('0xb0')]=function(_0x182d09,_0x5301cf,_0x51c5d4){return db[_0xf0c2('0x50')][_0xf0c2('0x5c')]({'where':{'id':_0x182d09[_0xf0c2('0x57')]['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x5301cf,null))['then'](function(_0x172cd0){if(_0x172cd0){return _0x172cd0[_0xf0c2('0xb0')](_0x182d09[_0xf0c2('0x65')]['ids'],_[_0xf0c2('0xb1')](_0x182d09[_0xf0c2('0x65')],[_0xf0c2('0xb2'),'id'])||{})['spread'](function(_0x2f9aa3){for(var _0x3ec782=0x0;_0x3ec782<_0x182d09[_0xf0c2('0x65')][_0xf0c2('0xb2')][_0xf0c2('0x5b')];_0x3ec782+=0x1){socket['emit'](_0xf0c2('0xb3'),{'UserId':_0x182d09[_0xf0c2('0x65')]['ids'][_0x3ec782],'OpenchannelAccountId':_0x182d09[_0xf0c2('0x57')]['id']});}return _0x2f9aa3;});}})[_0xf0c2('0x23')](respondWithResult(_0x5301cf,null))['catch'](handleError(_0x5301cf,null));};exports[_0xf0c2('0xb4')]=function(_0x4d3d82,_0x29051e,_0x1d3bb3){return db['OpenchannelAccount'][_0xf0c2('0x5c')]({'where':{'id':_0x4d3d82[_0xf0c2('0x57')]['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x29051e,null))[_0xf0c2('0x23')](function(_0x44418f){if(_0x44418f){return _0x44418f['removeAgents'](_0x4d3d82[_0xf0c2('0x43')][_0xf0c2('0xb2')])[_0xf0c2('0x23')](function(){if(_[_0xf0c2('0xb5')](_0x4d3d82['query']['ids'])){for(var _0x9f1c8=0x0;_0x9f1c8<_0x4d3d82[_0xf0c2('0x43')]['ids'][_0xf0c2('0x5b')];_0x9f1c8+=0x1){socket[_0xf0c2('0xb6')](_0xf0c2('0xb7'),{'UserId':Number(_0x4d3d82[_0xf0c2('0x43')]['ids'][_0x9f1c8]),'OpenchannelAccountId':Number(_0x4d3d82[_0xf0c2('0x57')]['id'])});}}else{socket[_0xf0c2('0xb6')](_0xf0c2('0xb7'),{'UserId':Number(_0x4d3d82[_0xf0c2('0x43')][_0xf0c2('0xb2')]),'OpenchannelAccountId':Number(_0x4d3d82[_0xf0c2('0x57')]['id'])});}});}})[_0xf0c2('0x23')](respondWithStatusCode(_0x29051e,null))[_0xf0c2('0x5d')](handleError(_0x29051e,null));};exports[_0xf0c2('0xb8')]=function(_0x1a008b,_0x35c4b4,_0x338ae2){var _0x1f28ea={};var _0x181b8a={};var _0x149ab9;var _0x3c926c;return db[_0xf0c2('0x50')]['findOne']({'where':{'id':_0x1a008b[_0xf0c2('0x57')]['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x35c4b4,null))['then'](function(_0x645618){if(_0x645618){_0x149ab9=_0x645618;_0x181b8a[_0xf0c2('0x42')]=_[_0xf0c2('0x59')](db['User'][_0xf0c2('0x58')]);_0x181b8a['query']=_['keys'](_0x1a008b['query']);_0x181b8a[_0xf0c2('0x44')]=_[_0xf0c2('0x45')](_0x181b8a['model'],_0x181b8a[_0xf0c2('0x43')]);_0x1f28ea[_0xf0c2('0x46')]=_[_0xf0c2('0x45')](_0x181b8a[_0xf0c2('0x42')],qs[_0xf0c2('0x5a')](_0x1a008b[_0xf0c2('0x43')][_0xf0c2('0x5a')]));_0x1f28ea[_0xf0c2('0x46')]=_0x1f28ea[_0xf0c2('0x46')][_0xf0c2('0x5b')]?_0x1f28ea[_0xf0c2('0x46')]:_0x181b8a[_0xf0c2('0x42')];_0x1f28ea[_0xf0c2('0x48')]=qs[_0xf0c2('0x49')](_0x1a008b['query'][_0xf0c2('0x49')]);_0x1f28ea[_0xf0c2('0x4c')]=qs[_0xf0c2('0x44')](_[_0xf0c2('0x4a')](_0x1a008b[_0xf0c2('0x43')],_0x181b8a[_0xf0c2('0x44')]));if(_0x1a008b[_0xf0c2('0x43')][_0xf0c2('0x4b')]){_0x1f28ea['where']=_[_0xf0c2('0x4d')](_0x1f28ea['where'],{'$or':_[_0xf0c2('0x40')](_0x1f28ea[_0xf0c2('0x46')],function(_0x15d4a6){var _0x3629c1={};_0x3629c1[_0x15d4a6]={'$like':'%'+_0x1a008b[_0xf0c2('0x43')][_0xf0c2('0x4b')]+'%'};return _0x3629c1;})});}_0x1f28ea=_[_0xf0c2('0x4d')]({},_0x1f28ea,_0x1a008b[_0xf0c2('0x4f')]);return _0x149ab9[_0xf0c2('0xb8')](_0x1f28ea);}})[_0xf0c2('0x23')](function(_0x1e85eb){if(_0x1e85eb){_0x3c926c=_0x1e85eb[_0xf0c2('0x5b')];if(!_0x1a008b[_0xf0c2('0x43')]['hasOwnProperty'](_0xf0c2('0x47'))){_0x1f28ea[_0xf0c2('0x32')]=qs[_0xf0c2('0x32')](_0x1a008b[_0xf0c2('0x43')][_0xf0c2('0x32')]);_0x1f28ea[_0xf0c2('0x31')]=qs[_0xf0c2('0x31')](_0x1a008b['query'][_0xf0c2('0x31')]);}return _0x149ab9['getAgents'](_0x1f28ea);}})[_0xf0c2('0x23')](function(_0x397b3c){if(_0x397b3c){return _0x397b3c?{'count':_0x3c926c,'rows':_0x397b3c}:null;}})[_0xf0c2('0x23')](respondWithResult(_0x35c4b4,null))[_0xf0c2('0x5d')](handleError(_0x35c4b4,null));};exports[_0xf0c2('0xb9')]=function(_0x4bdf5b,_0x3dbf92,_0xf7f82c){var _0x5a6076,_0x405b91,_0x2596c8;if(_[_0xf0c2('0x7a')](_0x4bdf5b[_0xf0c2('0x65')][_0xf0c2('0x65')])||_0x4bdf5b[_0xf0c2('0x65')][_0xf0c2('0x65')]===''){throw new db[(_0xf0c2('0x21'))][(_0xf0c2('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf0c2('0x7a')](_0x4bdf5b[_0xf0c2('0x65')]['to'])){}_0x5a6076=_0x4bdf5b[_0xf0c2('0x65')]['to'];return db[_0xf0c2('0x50')][_0xf0c2('0x69')]({'where':{'id':_0x4bdf5b[_0xf0c2('0x57')]['id']}})[_0xf0c2('0x23')](handleEntityNotFound(_0x3dbf92,null))[_0xf0c2('0x23')](function(_0x45d1f7){if(_0x45d1f7){return db[_0xf0c2('0x50')][_0xf0c2('0x5c')]({'where':{'id':_0x45d1f7['id']},'include':[{'model':db[_0xf0c2('0x81')],'as':_0xf0c2('0x84'),'include':[{'model':db[_0xf0c2('0x73')],'as':_0xf0c2('0x82'),'where':{[_0x45d1f7[_0xf0c2('0x7e')]]:_0x5a6076},'limit':0x1,'order':[[_0xf0c2('0x78'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3dbf92,null))['then'](function(_0x32d234){if(_0x32d234&&_0x32d234[_0xf0c2('0x84')]){_0x405b91=_0x32d234[_0xf0c2('0x3a')]({'plain':!![]});if(_0x405b91['List']&&_0x405b91[_0xf0c2('0x84')][_0xf0c2('0x82')]['length']){return _0x405b91[_0xf0c2('0x84')][_0xf0c2('0x82')][0x0];}return db[_0xf0c2('0x73')][_0xf0c2('0x5e')](_[_0xf0c2('0x8a')](_0x4bdf5b[_0xf0c2('0x65')],{'firstName':_0x5a6076,[_0x32d234[_0xf0c2('0x7e')]]:_0x5a6076,'phone':_0x5a6076,'ListId':_0x405b91['ListId']}));}})[_0xf0c2('0x23')](handleEntityNotFound(_0x3dbf92,null))[_0xf0c2('0x23')](function(_0x255ce0){if(_0x255ce0){_0x2596c8=_0x255ce0;return db[_0xf0c2('0x8e')][_0xf0c2('0x5c')]({'where':{'ContactId':_0x2596c8['id'],'closed':![],'OpenchannelAccountId':_0x405b91['id']}})['then'](function(_0x1be7cf){if(_0x1be7cf){return[_0x1be7cf,![]];}return db['OpenchannelInteraction'][_0xf0c2('0x5e')]({'UserId':_0x4bdf5b[_0xf0c2('0x5f')]['id'],'ContactId':_0x2596c8['id'],'OpenchannelAccountId':_0x405b91['id'],'lastMsgDirection':_0xf0c2('0xba'),'Messages':[_[_0xf0c2('0x4d')](_0x4bdf5b['body'],{'read':![],'body':_0x4bdf5b[_0xf0c2('0x65')][_0xf0c2('0x65')],'OpenchannelAccountId':_0x405b91['id'],'UserId':_0x4bdf5b[_0xf0c2('0x5f')]['id'],'ContactId':_0x2596c8['id']})]},{'include':[{'model':db[_0xf0c2('0xbb')],'as':_0xf0c2('0xbc')}]})[_0xf0c2('0x23')](function(_0x17cf4b){return[_0x17cf4b,!![]];});});}})[_0xf0c2('0x90')](function(_0x2170cd,_0x43626a){if(_0x43626a){return _0x2170cd;}return db[_0xf0c2('0xbb')][_0xf0c2('0x5e')](_[_0xf0c2('0x4d')](_0x4bdf5b[_0xf0c2('0x65')],{'read':![],'body':_0x4bdf5b[_0xf0c2('0x65')][_0xf0c2('0x65')],'OpenchannelAccountId':_0x405b91['id'],'OpenchannelInteractionId':_0x2170cd['id'],'UserId':_0x4bdf5b[_0xf0c2('0x5f')]['id'],'ContactId':_0x2596c8['id']}))['then'](function(_0x58b664){_0x2170cd[_0xf0c2('0xbd')][_0xf0c2('0xbc')]=[];_0x2170cd[_0xf0c2('0xbd')][_0xf0c2('0xbc')][_0xf0c2('0xbe')](_0x58b664['dataValues']);return _0x2170cd;});});}})[_0xf0c2('0x23')](respondWithResult(_0x3dbf92,null))[_0xf0c2('0x5d')](handleError(_0x3dbf92,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ff31a4b..882a439 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 _0xec32=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x4c0e79,_0x480fa7){var _0x2dd3de=function(_0x35d7f5){while(--_0x35d7f5){_0x4c0e79['push'](_0x4c0e79['shift']());}};_0x2dd3de(++_0x480fa7);}(_0xec32,0x143));var _0x2ec3=function(_0x22b662,_0x4c0ae8){_0x22b662=_0x22b662-0x0;var _0x10539f=_0xec32[_0x22b662];return _0x10539f;};'use strict';var EventEmitter=require(_0x2ec3('0x0'));var OpenchannelAccount=require(_0x2ec3('0x1'))['db'][_0x2ec3('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2ec3('0x3')](0x0);var events={'afterCreate':_0x2ec3('0x4'),'afterUpdate':'update','afterDestroy':_0x2ec3('0x5')};function emitEvent(_0x5b8f0f){return function(_0x4922fa,_0x3987d9,_0x59a41b){OpenchannelAccountEvents[_0x2ec3('0x6')](_0x5b8f0f+':'+_0x4922fa['id'],_0x4922fa);OpenchannelAccountEvents[_0x2ec3('0x6')](_0x5b8f0f,_0x4922fa);_0x59a41b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x2ec3('0x7')](e,emitEvent(event));}}module[_0x2ec3('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb489=['remove','emit','hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x559add,_0x153177){var _0x1892af=function(_0xc1f90e){while(--_0xc1f90e){_0x559add['push'](_0x559add['shift']());}};_0x1892af(++_0x153177);}(_0xb489,0x1ab));var _0x9b48=function(_0x2561b7,_0x7ad9c2){_0x2561b7=_0x2561b7-0x0;var _0x4b7f8c=_0xb489[_0x2561b7];return _0x4b7f8c;};'use strict';var EventEmitter=require(_0x9b48('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x9b48('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9b48('0x2')](0x0);var events={'afterCreate':_0x9b48('0x3'),'afterUpdate':_0x9b48('0x4'),'afterDestroy':_0x9b48('0x5')};function emitEvent(_0x24aa9e){return function(_0x2e010a,_0x4a89be,_0x4390b4){OpenchannelAccountEvents[_0x9b48('0x6')](_0x24aa9e+':'+_0x2e010a['id'],_0x2e010a);OpenchannelAccountEvents[_0x9b48('0x6')](_0x24aa9e,_0x2e010a);_0x4390b4(null);};}for(var e in events){if(events[_0x9b48('0x7')](e)){var event=events[e];OpenchannelAccount[_0x9b48('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 52e5269..ecd42fd 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 _0xe4a5=['openchannel_accounts','lodash','bluebird','path','rimraf','./openchannelAccount.attributes','exports','define','OpenchannelAccount'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xe4a5,0x1ba));var _0x5e4a=function(_0x3bd478,_0x1bb19a){_0x3bd478=_0x3bd478-0x0;var _0x5d4211=_0xe4a5[_0x3bd478];return _0x5d4211;};'use strict';var _=require(_0x5e4a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5e4a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e4a('0x2'));var rimraf=require(_0x5e4a('0x3'));var config=require('../../config/environment');var attributes=require(_0x5e4a('0x4'));module[_0x5e4a('0x5')]=function(_0x421742,_0x3e809b){return _0x421742[_0x5e4a('0x6')](_0x5e4a('0x7'),attributes,{'tableName':_0x5e4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fe2=['moment','bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','exports','define','openchannel_accounts','lodash','util','../../config/logger','api'];(function(_0x512c45,_0x36f294){var _0x53de78=function(_0x4382b7){while(--_0x4382b7){_0x512c45['push'](_0x512c45['shift']());}};_0x53de78(++_0x36f294);}(_0x2fe2,0x182));var _0x22fe=function(_0x1b409c,_0x1f91d1){_0x1b409c=_0x1b409c-0x0;var _0x203587=_0x2fe2[_0x1b409c];return _0x203587;};'use strict';var _=require(_0x22fe('0x0'));var util=require(_0x22fe('0x1'));var logger=require(_0x22fe('0x2'))(_0x22fe('0x3'));var moment=require(_0x22fe('0x4'));var BPromise=require(_0x22fe('0x5'));var rp=require(_0x22fe('0x6'));var fs=require('fs');var path=require(_0x22fe('0x7'));var rimraf=require(_0x22fe('0x8'));var config=require('../../config/environment');var attributes=require(_0x22fe('0x9'));module[_0x22fe('0xa')]=function(_0xb63c49,_0x3cae2e){return _0xb63c49[_0x22fe('0xb')]('OpenchannelAccount',attributes,{'tableName':_0x22fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 5e254e7..2ae3700 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 _0x8b42=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info'];(function(_0x107af6,_0x51b56b){var _0x4f267e=function(_0x127253){while(--_0x127253){_0x107af6['push'](_0x107af6['shift']());}};_0x4f267e(++_0x51b56b);}(_0x8b42,0x13c));var _0x28b4=function(_0x3c02d8,_0x42d3e8){_0x3c02d8=_0x3c02d8-0x0;var _0x178444=_0x8b42[_0x3c02d8];return _0x178444;};'use strict';var _=require(_0x28b4('0x0'));var util=require(_0x28b4('0x1'));var moment=require(_0x28b4('0x2'));var BPromise=require(_0x28b4('0x3'));var rs=require(_0x28b4('0x4'));var fs=require('fs');var Redis=require(_0x28b4('0x5'));var db=require(_0x28b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x28b4('0x7'))(_0x28b4('0x8'));var config=require(_0x28b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x28b4('0xa')][_0x28b4('0xb')]({'port':0x232a});config[_0x28b4('0xc')]=_[_0x28b4('0xd')](config[_0x28b4('0xc')],{'host':_0x28b4('0xe'),'port':0x18eb});var socket=require(_0x28b4('0xf'))(new Redis(config['redis']));require(_0x28b4('0x10'))['register'](socket);function respondWithRpcPromise(_0x571dbf,_0x30a0ad,_0x2f297b){return new BPromise(function(_0xf56145,_0x14eb78){return client[_0x28b4('0x11')](_0x571dbf,_0x2f297b)[_0x28b4('0x12')](function(_0x5e3b7a){logger[_0x28b4('0x13')](_0x28b4('0x14'),_0x30a0ad,_0x28b4('0x15'));logger[_0x28b4('0x16')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x30a0ad,_0x28b4('0x15'),JSON[_0x28b4('0x17')](_0x5e3b7a));if(_0x5e3b7a[_0x28b4('0x18')]){if(_0x5e3b7a[_0x28b4('0x18')][_0x28b4('0x19')]===0x1f4){logger[_0x28b4('0x18')](_0x28b4('0x14'),_0x30a0ad,_0x5e3b7a[_0x28b4('0x18')]['message']);return _0x14eb78(_0x5e3b7a[_0x28b4('0x18')]['message']);}logger[_0x28b4('0x18')](_0x28b4('0x14'),_0x30a0ad,_0x5e3b7a[_0x28b4('0x18')][_0x28b4('0x1a')]);return _0xf56145(_0x5e3b7a[_0x28b4('0x18')][_0x28b4('0x1a')]);}else{logger[_0x28b4('0x13')](_0x28b4('0x14'),_0x30a0ad,_0x28b4('0x15'));_0xf56145(_0x5e3b7a[_0x28b4('0x1b')]['message']);}})['catch'](function(_0x3bbf61){logger['error'](_0x28b4('0x14'),_0x30a0ad,_0x3bbf61);_0x14eb78(_0x3bbf61);});});} \ No newline at end of file +var _0x7319=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x22a5b7,_0x30e535){var _0x5f41bb=function(_0x30a656){while(--_0x30a656){_0x22a5b7['push'](_0x22a5b7['shift']());}};_0x5f41bb(++_0x30e535);}(_0x7319,0x12e));var _0x9731=function(_0x2456a0,_0x48d0dc){_0x2456a0=_0x2456a0-0x0;var _0xe0472e=_0x7319[_0x2456a0];return _0xe0472e;};'use strict';var _=require(_0x9731('0x0'));var util=require(_0x9731('0x1'));var moment=require('moment');var BPromise=require(_0x9731('0x2'));var rs=require(_0x9731('0x3'));var fs=require('fs');var Redis=require(_0x9731('0x4'));var db=require(_0x9731('0x5'))['db'];var utils=require(_0x9731('0x6'));var logger=require(_0x9731('0x7'))(_0x9731('0x8'));var config=require(_0x9731('0x9'));var jayson=require(_0x9731('0xa'));var client=jayson[_0x9731('0xb')][_0x9731('0xc')]({'port':0x232a});config[_0x9731('0xd')]=_[_0x9731('0xe')](config[_0x9731('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9731('0xf'))(new Redis(config['redis']));require(_0x9731('0x10'))[_0x9731('0x11')](socket);function respondWithRpcPromise(_0x11c0b0,_0x57c8d9,_0xe5a96b){return new BPromise(function(_0x5ca640,_0x1da6e1){return client['request'](_0x11c0b0,_0xe5a96b)[_0x9731('0x12')](function(_0x49337d){logger[_0x9731('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x57c8d9,_0x9731('0x14'));logger[_0x9731('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x57c8d9,_0x9731('0x14'),JSON[_0x9731('0x16')](_0x49337d));if(_0x49337d[_0x9731('0x17')]){if(_0x49337d[_0x9731('0x17')][_0x9731('0x18')]===0x1f4){logger[_0x9731('0x17')](_0x9731('0x19'),_0x57c8d9,_0x49337d[_0x9731('0x17')]['message']);return _0x1da6e1(_0x49337d[_0x9731('0x17')][_0x9731('0x1a')]);}logger[_0x9731('0x17')](_0x9731('0x19'),_0x57c8d9,_0x49337d['error'][_0x9731('0x1a')]);return _0x5ca640(_0x49337d[_0x9731('0x17')][_0x9731('0x1a')]);}else{logger['info'](_0x9731('0x19'),_0x57c8d9,_0x9731('0x14'));_0x5ca640(_0x49337d['result']['message']);}})[_0x9731('0x1b')](function(_0xa55b41){logger[_0x9731('0x17')](_0x9731('0x19'),_0x57c8d9,_0xa55b41);_0x1da6e1(_0xa55b41);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7202e54..700ec54 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 _0x8b21=['./openchannelAccount.events','save','emit','removeListener','register','length','openchannelAccount:'];(function(_0x1fd163,_0x100876){var _0x56b8e3=function(_0x357184){while(--_0x357184){_0x1fd163['push'](_0x1fd163['shift']());}};_0x56b8e3(++_0x100876);}(_0x8b21,0x134));var _0x18b2=function(_0x4ea0cd,_0x34243a){_0x4ea0cd=_0x4ea0cd-0x0;var _0x508db7=_0x8b21[_0x4ea0cd];return _0x508db7;};'use strict';var OpenchannelAccountEvents=require(_0x18b2('0x0'));var events=[_0x18b2('0x1'),'remove','update'];function createListener(_0x25ec5e,_0xe506dc){return function(_0x13b5e0){_0xe506dc[_0x18b2('0x2')](_0x25ec5e,_0x13b5e0);};}function removeListener(_0x26c4c5,_0x3cdd3e){return function(){OpenchannelAccountEvents[_0x18b2('0x3')](_0x26c4c5,_0x3cdd3e);};}exports[_0x18b2('0x4')]=function(_0x3f40f9){for(var _0x166ae0=0x0,_0x19c708=events[_0x18b2('0x5')];_0x166ae0<_0x19c708;_0x166ae0++){var _0xe0dd43=events[_0x166ae0];var _0x34e4d9=createListener(_0x18b2('0x6')+_0xe0dd43,_0x3f40f9);OpenchannelAccountEvents['on'](_0xe0dd43,_0x34e4d9);}}; \ No newline at end of file +var _0x6768=['remove','update','emit','removeListener','register','length','openchannelAccount:','save'];(function(_0x3ca7a1,_0x5ed7ac){var _0x529e3d=function(_0x4af657){while(--_0x4af657){_0x3ca7a1['push'](_0x3ca7a1['shift']());}};_0x529e3d(++_0x5ed7ac);}(_0x6768,0x1cf));var _0x8676=function(_0x550a61,_0x1c5d8c){_0x550a61=_0x550a61-0x0;var _0x248bfc=_0x6768[_0x550a61];return _0x248bfc;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x8676('0x0'),_0x8676('0x1'),_0x8676('0x2')];function createListener(_0x190201,_0x266671){return function(_0x4f5fd2){_0x266671[_0x8676('0x3')](_0x190201,_0x4f5fd2);};}function removeListener(_0x2d802c,_0x4e622f){return function(){OpenchannelAccountEvents[_0x8676('0x4')](_0x2d802c,_0x4e622f);};}exports[_0x8676('0x5')]=function(_0x300f95){for(var _0x5ae44d=0x0,_0x596961=events[_0x8676('0x6')];_0x5ae44d<_0x596961;_0x5ae44d++){var _0x3278c8=events[_0x5ae44d];var _0xf9d2e1=createListener(_0x8676('0x7')+_0x3278c8,_0x300f95);OpenchannelAccountEvents['on'](_0x3278c8,_0xf9d2e1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6ca3573..2c1abda 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 _0x319d=['/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','index','get'];(function(_0xb48d9e,_0x962045){var _0x1835f9=function(_0x8c7d28){while(--_0x8c7d28){_0xb48d9e['push'](_0xb48d9e['shift']());}};_0x1835f9(++_0x962045);}(_0x319d,0x139));var _0xd319=function(_0x287eaf,_0x41d318){_0x287eaf=_0x287eaf-0x0;var _0x321683=_0x319d[_0x287eaf];return _0x321683;};'use strict';var multer=require(_0xd319('0x0'));var util=require(_0xd319('0x1'));var path=require('path');var timeout=require(_0xd319('0x2'));var express=require(_0xd319('0x3'));var router=express[_0xd319('0x4')]();var auth=require(_0xd319('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd319('0x6'));var controller=require(_0xd319('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd319('0x8')]);router[_0xd319('0x9')](_0xd319('0xa'),auth[_0xd319('0xb')](),controller[_0xd319('0xc')]);router[_0xd319('0xd')]('/',auth[_0xd319('0xb')](),controller['create']);router[_0xd319('0xe')]('/:id',auth[_0xd319('0xb')](),controller[_0xd319('0xf')]);router[_0xd319('0x10')]('/:id',auth[_0xd319('0xb')](),controller[_0xd319('0x11')]);module[_0xd319('0x12')]=router; \ No newline at end of file +var _0xe792=['index','/:id','show','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated'];(function(_0x2c6a5a,_0x4773bd){var _0x564ef8=function(_0x34fbb3){while(--_0x34fbb3){_0x2c6a5a['push'](_0x2c6a5a['shift']());}};_0x564ef8(++_0x4773bd);}(_0xe792,0x1b0));var _0x2e79=function(_0x6687f,_0x386ee1){_0x6687f=_0x6687f-0x0;var _0x236047=_0xe792[_0x6687f];return _0x236047;};'use strict';var multer=require(_0x2e79('0x0'));var util=require(_0x2e79('0x1'));var path=require(_0x2e79('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e79('0x3'));var router=express[_0x2e79('0x4')]();var auth=require(_0x2e79('0x5'));var interaction=require(_0x2e79('0x6'));var config=require(_0x2e79('0x7'));var controller=require(_0x2e79('0x8'));router['get']('/',auth[_0x2e79('0x9')](),controller[_0x2e79('0xa')]);router['get'](_0x2e79('0xb'),auth[_0x2e79('0x9')](),controller[_0x2e79('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2e79('0xd')](_0x2e79('0xb'),auth[_0x2e79('0x9')](),controller[_0x2e79('0xe')]);router[_0x2e79('0xf')]('/:id',auth[_0x2e79('0x9')](),controller['destroy']);module[_0x2e79('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 878bf5b..c4ceb96 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 _0x3dd0=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x22b732,_0x257b9c){var _0x29c474=function(_0x4a78ba){while(--_0x4a78ba){_0x22b732['push'](_0x22b732['shift']());}};_0x29c474(++_0x257b9c);}(_0x3dd0,0x9a));var _0x03dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3dd0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x03dd('0x0'));module[_0x03dd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x03dd('0x2')],'allowNull':![],'defaultValue':_0x03dd('0x3')},'appdata':{'type':Sequelize[_0x03dd('0x4')]()},'description':{'type':Sequelize[_0x03dd('0x2')]},'interval':{'type':Sequelize[_0x03dd('0x2')],'defaultValue':_0x03dd('0x5')}}; \ No newline at end of file +var _0x7395=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x7395,0x144));var _0x5739=function(_0x3f9de7,_0x46d870){_0x3f9de7=_0x3f9de7-0x0;var _0x1a6630=_0x7395[_0x3f9de7];return _0x1a6630;};'use strict';var Sequelize=require(_0x5739('0x0'));module[_0x5739('0x1')]={'priority':{'type':Sequelize[_0x5739('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5739('0x3')},'appdata':{'type':Sequelize[_0x5739('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5739('0x5')],'defaultValue':_0x5739('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index bba724d..fc0f9e0 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 _0x80a5=['then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','query','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','body','update','html-pdf','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save'];(function(_0x305ad3,_0x244a36){var _0x3df215=function(_0xe102aa){while(--_0xe102aa){_0x305ad3['push'](_0x305ad3['shift']());}};_0x3df215(++_0x244a36);}(_0x80a5,0x1d8));var _0x580a=function(_0x5bdc14,_0x48e1ab){_0x5bdc14=_0x5bdc14-0x0;var _0x58a5da=_0x80a5[_0x5bdc14];return _0x58a5da;};'use strict';var pdf=require(_0x580a('0x0'));var emlformat=require(_0x580a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x580a('0x2'));var rp=require('request-promise');var moment=require(_0x580a('0x3'));var BPromise=require(_0x580a('0x4'));var Mustache=require('mustache');var util=require(_0x580a('0x5'));var path=require(_0x580a('0x6'));var sox=require(_0x580a('0x7'));var csv=require(_0x580a('0x8'));var ejs=require(_0x580a('0x9'));var fs=require('fs');var _=require(_0x580a('0xa'));var squel=require(_0x580a('0xb'));var crypto=require(_0x580a('0xc'));var jsforce=require(_0x580a('0xd'));var deskjs=require(_0x580a('0xe'));var toCsv=require(_0x580a('0x8'));var querystring=require(_0x580a('0xf'));var Papa=require(_0x580a('0x10'));var Redis=require(_0x580a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x580a('0x12'));var hardwareService=require(_0x580a('0x13'));var logger=require('../../config/logger')(_0x580a('0x14'));var utils=require(_0x580a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8f9c26,_0x3ef57b){_0x3ef57b=_0x3ef57b||0xcc;return function(_0x3946ce){if(_0x3946ce){return _0x8f9c26[_0x580a('0x16')](_0x3ef57b);}return _0x8f9c26[_0x580a('0x17')](_0x3ef57b)[_0x580a('0x18')]();};}function respondWithResult(_0x1b2259,_0x511f7c){_0x511f7c=_0x511f7c||0xc8;return function(_0x3122a1){if(_0x3122a1){return _0x1b2259[_0x580a('0x17')](_0x511f7c)[_0x580a('0x19')](_0x3122a1);}};}function respondWithFilteredResult(_0xdb856b,_0x375310){return function(_0x2dcf4d){if(_0x2dcf4d){var _0xb59aa6=_0x2dcf4d[_0x580a('0x1a')],_0x4bdb84=_0x375310[_0x580a('0x1b')],_0x37ec8=_0x375310[_0x580a('0x1b')]+_0x375310['limit'],_0x1f0860;if(_0x37ec8>=_0xb59aa6){_0x37ec8=_0xb59aa6;_0x1f0860=0xc8;}else{_0x1f0860=0xce;}_0xdb856b[_0x580a('0x17')](_0x1f0860);return _0xdb856b['set'](_0x580a('0x1c'),_0x4bdb84+'-'+_0x37ec8+'/'+_0xb59aa6)[_0x580a('0x19')](_0x2dcf4d);}return null;};}function patchUpdates(_0x97a276){return function(_0x282c34){try{jsonpatch[_0x580a('0x1d')](_0x282c34,_0x97a276,!![]);}catch(_0x267a3b){return BPromise[_0x580a('0x1e')](_0x267a3b);}return _0x282c34[_0x580a('0x1f')]();};}function saveUpdates(_0x182fa3,_0x2e51a6){return function(_0x59c64d){if(_0x59c64d){return _0x59c64d['update'](_0x182fa3)[_0x580a('0x20')](function(_0x50cd31){return _0x50cd31;});}return null;};}function removeEntity(_0x1c49b7,_0x226992){return function(_0x3b051d){if(_0x3b051d){return _0x3b051d[_0x580a('0x21')]()['then'](function(){_0x1c49b7[_0x580a('0x17')](0xcc)[_0x580a('0x18')]();});}};}function handleEntityNotFound(_0x45e812,_0x7e91f3){return function(_0x553e69){if(!_0x553e69){_0x45e812[_0x580a('0x16')](0x194);}return _0x553e69;};}function handleError(_0x16acfa,_0x28f224){_0x28f224=_0x28f224||0x1f4;return function(_0x2da90f){logger[_0x580a('0x22')](_0x2da90f[_0x580a('0x23')]);if(_0x2da90f[_0x580a('0x24')]){delete _0x2da90f['name'];}_0x16acfa['status'](_0x28f224)[_0x580a('0x25')](_0x2da90f);};}exports[_0x580a('0x26')]=function(_0x3e26e9,_0x207c0d){var _0x48d299={},_0xd0f675={},_0x5ea421={'count':0x0,'rows':[]};var _0x59cf40=_[_0x580a('0x27')](db[_0x580a('0x28')][_0x580a('0x29')],function(_0x25f3d6){return{'name':_0x25f3d6[_0x580a('0x2a')],'type':_0x25f3d6['type'][_0x580a('0x2b')]};});_0xd0f675['model']=_['map'](_0x59cf40,_0x580a('0x24'));_0xd0f675[_0x580a('0x2c')]=_['keys'](_0x3e26e9[_0x580a('0x2c')]);_0xd0f675['filters']=_[_0x580a('0x2d')](_0xd0f675[_0x580a('0x2e')],_0xd0f675[_0x580a('0x2c')]);_0x48d299['attributes']=_['intersection'](_0xd0f675[_0x580a('0x2e')],qs[_0x580a('0x2f')](_0x3e26e9[_0x580a('0x2c')]['fields']));_0x48d299[_0x580a('0x30')]=_0x48d299[_0x580a('0x30')][_0x580a('0x31')]?_0x48d299[_0x580a('0x30')]:_0xd0f675['model'];if(!_0x3e26e9['query'][_0x580a('0x32')]('nolimit')){_0x48d299['limit']=qs[_0x580a('0x33')](_0x3e26e9[_0x580a('0x2c')][_0x580a('0x33')]);_0x48d299['offset']=qs[_0x580a('0x1b')](_0x3e26e9[_0x580a('0x2c')]['offset']);}_0x48d299[_0x580a('0x34')]=qs[_0x580a('0x35')](_0x3e26e9[_0x580a('0x2c')][_0x580a('0x35')]);_0x48d299[_0x580a('0x36')]=qs[_0x580a('0x37')](_[_0x580a('0x38')](_0x3e26e9[_0x580a('0x2c')],_0xd0f675[_0x580a('0x37')]),_0x59cf40);if(_0x3e26e9[_0x580a('0x2c')][_0x580a('0x39')]){_0x48d299[_0x580a('0x36')]=_[_0x580a('0x3a')](_0x48d299[_0x580a('0x36')],{'$or':_[_0x580a('0x27')](_0x59cf40,function(_0x11d094){if(_0x11d094[_0x580a('0x3b')]!==_0x580a('0x3c')){var _0x34e66e={};_0x34e66e[_0x11d094['name']]={'$like':'%'+_0x3e26e9[_0x580a('0x2c')][_0x580a('0x39')]+'%'};return _0x34e66e;}})});}_0x48d299=_[_0x580a('0x3a')]({},_0x48d299,_0x3e26e9[_0x580a('0x3d')]);var _0x11e64c={'where':_0x48d299['where']};return db['OpenchannelApplication'][_0x580a('0x1a')](_0x11e64c)[_0x580a('0x20')](function(_0x5b4337){_0x5ea421[_0x580a('0x1a')]=_0x5b4337;if(_0x3e26e9[_0x580a('0x2c')][_0x580a('0x3e')]){_0x48d299[_0x580a('0x3f')]=[{'all':!![]}];}return db[_0x580a('0x28')][_0x580a('0x40')](_0x48d299);})[_0x580a('0x20')](function(_0x7a8d4c){_0x5ea421[_0x580a('0x41')]=_0x7a8d4c;return _0x5ea421;})[_0x580a('0x20')](respondWithFilteredResult(_0x207c0d,_0x48d299))[_0x580a('0x42')](handleError(_0x207c0d,null));};exports['show']=function(_0xcc3932,_0x3a74d9){var _0xf5fc7a={'raw':!![],'where':{'id':_0xcc3932[_0x580a('0x43')]['id']}},_0x46ecba={};_0x46ecba['model']=_[_0x580a('0x44')](db[_0x580a('0x28')][_0x580a('0x29')]);_0x46ecba[_0x580a('0x2c')]=_[_0x580a('0x44')](_0xcc3932[_0x580a('0x2c')]);_0x46ecba[_0x580a('0x37')]=_[_0x580a('0x2d')](_0x46ecba['model'],_0x46ecba['query']);_0xf5fc7a[_0x580a('0x30')]=_[_0x580a('0x2d')](_0x46ecba[_0x580a('0x2e')],qs[_0x580a('0x2f')](_0xcc3932[_0x580a('0x2c')][_0x580a('0x2f')]));_0xf5fc7a['attributes']=_0xf5fc7a[_0x580a('0x30')]['length']?_0xf5fc7a[_0x580a('0x30')]:_0x46ecba[_0x580a('0x2e')];if(_0xcc3932[_0x580a('0x2c')][_0x580a('0x3e')]){_0xf5fc7a[_0x580a('0x3f')]=[{'all':!![]}];}_0xf5fc7a=_[_0x580a('0x3a')]({},_0xf5fc7a,_0xcc3932[_0x580a('0x3d')]);return db['OpenchannelApplication'][_0x580a('0x45')](_0xf5fc7a)[_0x580a('0x20')](handleEntityNotFound(_0x3a74d9,null))[_0x580a('0x20')](respondWithResult(_0x3a74d9,null))[_0x580a('0x42')](handleError(_0x3a74d9,null));};exports['create']=function(_0x54a677,_0x40d32a){return db[_0x580a('0x28')]['create'](_0x54a677[_0x580a('0x46')],{})[_0x580a('0x20')](respondWithResult(_0x40d32a,0xc9))[_0x580a('0x42')](handleError(_0x40d32a,null));};exports[_0x580a('0x47')]=function(_0x5aa27b,_0x1d869e){if(_0x5aa27b[_0x580a('0x46')]['id']){delete _0x5aa27b[_0x580a('0x46')]['id'];}return db[_0x580a('0x28')][_0x580a('0x45')]({'where':{'id':_0x5aa27b[_0x580a('0x43')]['id']}})[_0x580a('0x20')](handleEntityNotFound(_0x1d869e,null))['then'](saveUpdates(_0x5aa27b[_0x580a('0x46')],null))[_0x580a('0x20')](respondWithResult(_0x1d869e,null))['catch'](handleError(_0x1d869e,null));};exports['destroy']=function(_0x40d453,_0x4dcf4c){return db[_0x580a('0x28')][_0x580a('0x45')]({'where':{'id':_0x40d453[_0x580a('0x43')]['id']}})[_0x580a('0x20')](handleEntityNotFound(_0x4dcf4c,null))[_0x580a('0x20')](removeEntity(_0x4dcf4c,null))[_0x580a('0x42')](handleError(_0x4dcf4c,null));}; \ No newline at end of file +var _0xf957=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','intersection','length','options','find','create','body','update','html-pdf','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js'];(function(_0x474ced,_0xb25add){var _0x550265=function(_0x3203e4){while(--_0x3203e4){_0x474ced['push'](_0x474ced['shift']());}};_0x550265(++_0xb25add);}(_0xf957,0xc0));var _0x7f95=function(_0x32a656,_0x36adfd){_0x32a656=_0x32a656-0x0;var _0x1713fd=_0xf957[_0x32a656];return _0x1713fd;};'use strict';var pdf=require(_0x7f95('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7f95('0x1'));var zipdir=require(_0x7f95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f95('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7f95('0x4'));var util=require('util');var path=require(_0x7f95('0x5'));var sox=require(_0x7f95('0x6'));var csv=require(_0x7f95('0x7'));var ejs=require(_0x7f95('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f95('0x9'));var jsforce=require(_0x7f95('0xa'));var deskjs=require(_0x7f95('0xb'));var toCsv=require(_0x7f95('0x7'));var querystring=require(_0x7f95('0xc'));var Papa=require(_0x7f95('0xd'));var Redis=require('ioredis');var authService=require(_0x7f95('0xe'));var qs=require(_0x7f95('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f95('0x10'))(_0x7f95('0x11'));var utils=require('../../config/utils');var config=require(_0x7f95('0x12'));var db=require(_0x7f95('0x13'))['db'];function respondWithStatusCode(_0x5e5ae6,_0x16da68){_0x16da68=_0x16da68||0xcc;return function(_0x504416){if(_0x504416){return _0x5e5ae6[_0x7f95('0x14')](_0x16da68);}return _0x5e5ae6[_0x7f95('0x15')](_0x16da68)[_0x7f95('0x16')]();};}function respondWithResult(_0x29c7d5,_0x527d9c){_0x527d9c=_0x527d9c||0xc8;return function(_0x30091a){if(_0x30091a){return _0x29c7d5[_0x7f95('0x15')](_0x527d9c)[_0x7f95('0x17')](_0x30091a);}};}function respondWithFilteredResult(_0x102c9d,_0x2ffe14){return function(_0x31384e){if(_0x31384e){var _0x22ed5d=_0x31384e[_0x7f95('0x18')],_0x2b1444=_0x2ffe14[_0x7f95('0x19')],_0x279d01=_0x2ffe14[_0x7f95('0x19')]+_0x2ffe14['limit'],_0x110909;if(_0x279d01>=_0x22ed5d){_0x279d01=_0x22ed5d;_0x110909=0xc8;}else{_0x110909=0xce;}_0x102c9d['status'](_0x110909);return _0x102c9d[_0x7f95('0x1a')](_0x7f95('0x1b'),_0x2b1444+'-'+_0x279d01+'/'+_0x22ed5d)[_0x7f95('0x17')](_0x31384e);}return null;};}function patchUpdates(_0x21a617){return function(_0x2ac1fb){try{jsonpatch[_0x7f95('0x1c')](_0x2ac1fb,_0x21a617,!![]);}catch(_0x1b153b){return BPromise[_0x7f95('0x1d')](_0x1b153b);}return _0x2ac1fb[_0x7f95('0x1e')]();};}function saveUpdates(_0x144cfc,_0x53f68f){return function(_0x10fcc0){if(_0x10fcc0){return _0x10fcc0['update'](_0x144cfc)[_0x7f95('0x1f')](function(_0x383784){return _0x383784;});}return null;};}function removeEntity(_0x455867,_0x12f726){return function(_0x3c36fb){if(_0x3c36fb){return _0x3c36fb['destroy']()[_0x7f95('0x1f')](function(){_0x455867[_0x7f95('0x15')](0xcc)[_0x7f95('0x16')]();});}};}function handleEntityNotFound(_0x159b43,_0x430f1c){return function(_0x5004ba){if(!_0x5004ba){_0x159b43[_0x7f95('0x14')](0x194);}return _0x5004ba;};}function handleError(_0x5b4064,_0xd5d193){_0xd5d193=_0xd5d193||0x1f4;return function(_0x474f36){logger[_0x7f95('0x20')](_0x474f36[_0x7f95('0x21')]);if(_0x474f36[_0x7f95('0x22')]){delete _0x474f36[_0x7f95('0x22')];}_0x5b4064[_0x7f95('0x15')](_0xd5d193)['send'](_0x474f36);};}exports['index']=function(_0x185641,_0x2043b7){var _0x59cf45={},_0x1131aa={},_0x87ed3f={'count':0x0,'rows':[]};var _0x425247=_[_0x7f95('0x23')](db[_0x7f95('0x24')][_0x7f95('0x25')],function(_0x151b52){return{'name':_0x151b52[_0x7f95('0x26')],'type':_0x151b52[_0x7f95('0x27')][_0x7f95('0x28')]};});_0x1131aa[_0x7f95('0x29')]=_[_0x7f95('0x23')](_0x425247,'name');_0x1131aa[_0x7f95('0x2a')]=_[_0x7f95('0x2b')](_0x185641[_0x7f95('0x2a')]);_0x1131aa[_0x7f95('0x2c')]=_['intersection'](_0x1131aa[_0x7f95('0x29')],_0x1131aa['query']);_0x59cf45['attributes']=_['intersection'](_0x1131aa[_0x7f95('0x29')],qs[_0x7f95('0x2d')](_0x185641['query'][_0x7f95('0x2d')]));_0x59cf45['attributes']=_0x59cf45[_0x7f95('0x2e')]['length']?_0x59cf45[_0x7f95('0x2e')]:_0x1131aa['model'];if(!_0x185641[_0x7f95('0x2a')]['hasOwnProperty'](_0x7f95('0x2f'))){_0x59cf45[_0x7f95('0x30')]=qs[_0x7f95('0x30')](_0x185641[_0x7f95('0x2a')][_0x7f95('0x30')]);_0x59cf45[_0x7f95('0x19')]=qs[_0x7f95('0x19')](_0x185641[_0x7f95('0x2a')][_0x7f95('0x19')]);}_0x59cf45['order']=qs[_0x7f95('0x31')](_0x185641[_0x7f95('0x2a')][_0x7f95('0x31')]);_0x59cf45[_0x7f95('0x32')]=qs[_0x7f95('0x2c')](_[_0x7f95('0x33')](_0x185641[_0x7f95('0x2a')],_0x1131aa['filters']),_0x425247);if(_0x185641[_0x7f95('0x2a')]['filter']){_0x59cf45[_0x7f95('0x32')]=_[_0x7f95('0x34')](_0x59cf45[_0x7f95('0x32')],{'$or':_[_0x7f95('0x23')](_0x425247,function(_0xee1d1e){if(_0xee1d1e['type']!==_0x7f95('0x35')){var _0x20ac57={};_0x20ac57[_0xee1d1e[_0x7f95('0x22')]]={'$like':'%'+_0x185641[_0x7f95('0x2a')][_0x7f95('0x36')]+'%'};return _0x20ac57;}})});}_0x59cf45=_['merge']({},_0x59cf45,_0x185641['options']);var _0x313902={'where':_0x59cf45[_0x7f95('0x32')]};return db[_0x7f95('0x24')][_0x7f95('0x18')](_0x313902)[_0x7f95('0x1f')](function(_0x4835d5){_0x87ed3f[_0x7f95('0x18')]=_0x4835d5;if(_0x185641['query'][_0x7f95('0x37')]){_0x59cf45[_0x7f95('0x38')]=[{'all':!![]}];}return db[_0x7f95('0x24')][_0x7f95('0x39')](_0x59cf45);})['then'](function(_0x3e63eb){_0x87ed3f['rows']=_0x3e63eb;return _0x87ed3f;})[_0x7f95('0x1f')](respondWithFilteredResult(_0x2043b7,_0x59cf45))[_0x7f95('0x3a')](handleError(_0x2043b7,null));};exports[_0x7f95('0x3b')]=function(_0xbc308d,_0xda5386){var _0x27645e={'raw':!![],'where':{'id':_0xbc308d[_0x7f95('0x3c')]['id']}},_0x12fbde={};_0x12fbde['model']=_[_0x7f95('0x2b')](db[_0x7f95('0x24')][_0x7f95('0x25')]);_0x12fbde[_0x7f95('0x2a')]=_[_0x7f95('0x2b')](_0xbc308d[_0x7f95('0x2a')]);_0x12fbde['filters']=_['intersection'](_0x12fbde[_0x7f95('0x29')],_0x12fbde[_0x7f95('0x2a')]);_0x27645e[_0x7f95('0x2e')]=_[_0x7f95('0x3d')](_0x12fbde[_0x7f95('0x29')],qs[_0x7f95('0x2d')](_0xbc308d[_0x7f95('0x2a')][_0x7f95('0x2d')]));_0x27645e[_0x7f95('0x2e')]=_0x27645e[_0x7f95('0x2e')][_0x7f95('0x3e')]?_0x27645e[_0x7f95('0x2e')]:_0x12fbde[_0x7f95('0x29')];if(_0xbc308d[_0x7f95('0x2a')][_0x7f95('0x37')]){_0x27645e['include']=[{'all':!![]}];}_0x27645e=_[_0x7f95('0x34')]({},_0x27645e,_0xbc308d[_0x7f95('0x3f')]);return db['OpenchannelApplication'][_0x7f95('0x40')](_0x27645e)['then'](handleEntityNotFound(_0xda5386,null))['then'](respondWithResult(_0xda5386,null))[_0x7f95('0x3a')](handleError(_0xda5386,null));};exports[_0x7f95('0x41')]=function(_0x7dc195,_0x1f660d){return db[_0x7f95('0x24')][_0x7f95('0x41')](_0x7dc195[_0x7f95('0x42')],{})['then'](respondWithResult(_0x1f660d,0xc9))['catch'](handleError(_0x1f660d,null));};exports[_0x7f95('0x43')]=function(_0x1c7c91,_0x1e93dd){if(_0x1c7c91[_0x7f95('0x42')]['id']){delete _0x1c7c91[_0x7f95('0x42')]['id'];}return db[_0x7f95('0x24')][_0x7f95('0x40')]({'where':{'id':_0x1c7c91['params']['id']}})[_0x7f95('0x1f')](handleEntityNotFound(_0x1e93dd,null))[_0x7f95('0x1f')](saveUpdates(_0x1c7c91[_0x7f95('0x42')],null))['then'](respondWithResult(_0x1e93dd,null))[_0x7f95('0x3a')](handleError(_0x1e93dd,null));};exports['destroy']=function(_0x1d4d9d,_0x3888c7){return db['OpenchannelApplication']['find']({'where':{'id':_0x1d4d9d[_0x7f95('0x3c')]['id']}})[_0x7f95('0x1f')](handleEntityNotFound(_0x3888c7,null))[_0x7f95('0x1f')](removeEntity(_0x3888c7,null))['catch'](handleError(_0x3888c7,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index feeb618..15bd085 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 _0xdb62=['OpenchannelApplication','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x469bbb,_0xf1a943){var _0x14ac71=function(_0x2c5580){while(--_0x2c5580){_0x469bbb['push'](_0x469bbb['shift']());}};_0x14ac71(++_0xf1a943);}(_0xdb62,0xca));var _0x2db6=function(_0x12c263,_0x2d9bce){_0x12c263=_0x12c263-0x0;var _0x192cd7=_0xdb62[_0x12c263];return _0x192cd7;};'use strict';var _=require(_0x2db6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2db6('0x1'));var moment=require(_0x2db6('0x2'));var BPromise=require(_0x2db6('0x3'));var rp=require(_0x2db6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2db6('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x2db6('0x6')]=function(_0x4a55b4,_0x18175f){return _0x4a55b4[_0x2db6('0x7')](_0x2db6('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2db6('0x9')});}; \ No newline at end of file +var _0xd4a3=['exports','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','./openchannelApplication.attributes'];(function(_0x104aa8,_0x56c3c4){var _0xecdb7=function(_0x3df399){while(--_0x3df399){_0x104aa8['push'](_0x104aa8['shift']());}};_0xecdb7(++_0x56c3c4);}(_0xd4a3,0x7a));var _0x3d4a=function(_0x19ef3c,_0x4289a0){_0x19ef3c=_0x19ef3c-0x0;var _0x381da3=_0xd4a3[_0x19ef3c];return _0x381da3;};'use strict';var _=require(_0x3d4a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3d4a('0x1'));var BPromise=require(_0x3d4a('0x2'));var rp=require(_0x3d4a('0x3'));var fs=require('fs');var path=require(_0x3d4a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3d4a('0x5'));module[_0x3d4a('0x6')]=function(_0x231d6d,_0x58b8b3){return _0x231d6d['define']('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3d4a('0x7')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f57963b..207de2f 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(_0x2b13ab,_0x3e916f){var _0x1c96ce=function(_0x17e515){while(--_0x17e515){_0x2b13ab['push'](_0x2b13ab['shift']());}};_0x1c96ce(++_0x3e916f);}(_0xb10b,0x12a));var _0xbb10=function(_0xc54c54,_0x59053b){_0xc54c54=_0xc54c54-0x0;var _0x476786=_0xb10b[_0xc54c54];return _0x476786;};'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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 79f33ba..e75513d 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 _0x99c6=['/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3c47bc,_0x5d9c7a){var _0x112482=function(_0x7a450e){while(--_0x7a450e){_0x3c47bc['push'](_0x3c47bc['shift']());}};_0x112482(++_0x5d9c7a);}(_0x99c6,0x1c3));var _0x699c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x99c6[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x699c('0x0'));var util=require(_0x699c('0x1'));var path=require(_0x699c('0x2'));var timeout=require(_0x699c('0x3'));var express=require(_0x699c('0x4'));var router=express['Router']();var auth=require(_0x699c('0x5'));var interaction=require(_0x699c('0x6'));var config=require(_0x699c('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x699c('0x8')](),controller[_0x699c('0x9')]);router[_0x699c('0xa')](_0x699c('0xb'),auth[_0x699c('0x8')](),controller[_0x699c('0xc')]);router[_0x699c('0xa')]('/:id',auth[_0x699c('0x8')](),controller[_0x699c('0xd')]);router[_0x699c('0xa')](_0x699c('0xe'),auth[_0x699c('0x8')](),controller[_0x699c('0xf')]);router['get'](_0x699c('0x10'),auth[_0x699c('0x8')](),controller[_0x699c('0x11')]);router[_0x699c('0x12')]('/',auth[_0x699c('0x8')](),controller[_0x699c('0x13')]);router[_0x699c('0x12')](_0x699c('0xe'),auth[_0x699c('0x8')](),controller['addMessage']);router[_0x699c('0x12')]('/:id/tags',auth[_0x699c('0x8')](),interaction[_0x699c('0x14')](_0x699c('0x15'),_0x699c('0x16')),controller[_0x699c('0x17')]);router[_0x699c('0x18')]('/:id',auth[_0x699c('0x8')](),interaction['tracked'](_0x699c('0x15'),_0x699c('0x19')),controller[_0x699c('0x1a')]);router[_0x699c('0x1b')]('/:id',auth['isAuthenticated'](),interaction[_0x699c('0x14')]('openchannel',_0x699c('0x1c')),controller[_0x699c('0x1d')]);router[_0x699c('0x1b')](_0x699c('0x1e'),auth[_0x699c('0x8')](),controller[_0x699c('0x1f')]);module[_0x699c('0x20')]=router; \ No newline at end of file +var _0x38c2=['addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x680123,_0x36dffe){var _0x3478ea=function(_0x28ef6d){while(--_0x28ef6d){_0x680123['push'](_0x680123['shift']());}};_0x3478ea(++_0x36dffe);}(_0x38c2,0x99));var _0x238c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38c2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x238c('0x0'));var util=require(_0x238c('0x1'));var path=require(_0x238c('0x2'));var timeout=require(_0x238c('0x3'));var express=require(_0x238c('0x4'));var router=express[_0x238c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x238c('0x6'));var config=require(_0x238c('0x7'));var controller=require(_0x238c('0x8'));router[_0x238c('0x9')]('/',auth[_0x238c('0xa')](),controller[_0x238c('0xb')]);router['get'](_0x238c('0xc'),auth[_0x238c('0xa')](),controller[_0x238c('0xd')]);router[_0x238c('0x9')](_0x238c('0xe'),auth[_0x238c('0xa')](),controller[_0x238c('0xf')]);router[_0x238c('0x9')](_0x238c('0x10'),auth['isAuthenticated'](),controller[_0x238c('0x11')]);router[_0x238c('0x9')](_0x238c('0x12'),auth[_0x238c('0xa')](),controller[_0x238c('0x13')]);router[_0x238c('0x14')]('/',auth[_0x238c('0xa')](),controller[_0x238c('0x15')]);router[_0x238c('0x14')]('/:id/messages',auth[_0x238c('0xa')](),controller[_0x238c('0x16')]);router[_0x238c('0x14')](_0x238c('0x17'),auth['isAuthenticated'](),interaction['tracked'](_0x238c('0x18'),_0x238c('0x19')),controller['addTags']);router[_0x238c('0x1a')]('/:id',auth[_0x238c('0xa')](),interaction[_0x238c('0x1b')]('openchannel',_0x238c('0x1c')),controller[_0x238c('0x1d')]);router[_0x238c('0x1e')]('/:id',auth[_0x238c('0xa')](),interaction[_0x238c('0x1b')](_0x238c('0x18'),_0x238c('0x1f')),controller[_0x238c('0x20')]);router[_0x238c('0x1e')](_0x238c('0x17'),auth[_0x238c('0xa')](),controller[_0x238c('0x21')]);module[_0x238c('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7a88d11..52c44c2 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 _0x2d66=['out','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d66,0x158));var _0x62d6=function(_0x577812,_0x14a2c7){_0x577812=_0x577812-0x0;var _0x2b3901=_0x2d66[_0x577812];return _0x2b3901;};'use strict';var Sequelize=require(_0x62d6('0x0'));module[_0x62d6('0x1')]={'closed':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x62d6('0x3')]},'note':{'type':Sequelize[_0x62d6('0x3')]},'read1stAt':{'type':Sequelize[_0x62d6('0x4')]},'threadId':{'type':Sequelize[_0x62d6('0x3')]},'externalUrl':{'type':Sequelize[_0x62d6('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x62d6('0x5')]('in',_0x62d6('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x62d6('0x3')]}}; \ No newline at end of file +var _0x4233=['out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x4f8d90,_0x25943f){var _0x570bda=function(_0xea97ef){while(--_0xea97ef){_0x4f8d90['push'](_0x4f8d90['shift']());}};_0x570bda(++_0x25943f);}(_0x4233,0x6d));var _0x3423=function(_0x1eda2d,_0x22993f){_0x1eda2d=_0x1eda2d-0x0;var _0x3ec5d7=_0x4233[_0x1eda2d];return _0x3ec5d7;};'use strict';var Sequelize=require(_0x3423('0x0'));module[_0x3423('0x1')]={'closed':{'type':Sequelize[_0x3423('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3423('0x3')]},'disposition':{'type':Sequelize[_0x3423('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3423('0x3')]},'threadId':{'type':Sequelize[_0x3423('0x4')]},'externalUrl':{'type':Sequelize[_0x3423('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3423('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3423('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 9328817..8970b4c 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 _0x72b1=['N.A.','closed','closedAt','disposition','Public','Messages','basename','existsSync','createReadStream','pipe','out','lastName','renderFile','downloadInteraction.html','transcript-','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','update','then','destroy','error','send','Users','TagIds','split','forEach','Tags','push','catch','index','OpenchannelInteraction','rawAttributes','type','map','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','start','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','params','includeAll','include','options','find','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','Account'];(function(_0x13b95c,_0x2a02b1){var _0x531f19=function(_0x5e86db){while(--_0x5e86db){_0x13b95c['push'](_0x13b95c['shift']());}};_0x531f19(++_0x2a02b1);}(_0x72b1,0x103));var _0x172b=function(_0x90a804,_0x3bd5f9){_0x90a804=_0x90a804-0x0;var _0x297783=_0x72b1[_0x90a804];return _0x297783;};'use strict';var pdf=require(_0x172b('0x0'));var emlformat=require(_0x172b('0x1'));var rimraf=require(_0x172b('0x2'));var zipdir=require(_0x172b('0x3'));var jsonpatch=require(_0x172b('0x4'));var rp=require(_0x172b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x172b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x172b('0x7'));var csv=require(_0x172b('0x8'));var ejs=require(_0x172b('0x9'));var fs=require('fs');var _=require(_0x172b('0xa'));var squel=require('squel');var crypto=require(_0x172b('0xb'));var jsforce=require(_0x172b('0xc'));var deskjs=require(_0x172b('0xd'));var toCsv=require(_0x172b('0x8'));var querystring=require(_0x172b('0xe'));var Papa=require(_0x172b('0xf'));var Redis=require(_0x172b('0x10'));var authService=require(_0x172b('0x11'));var qs=require(_0x172b('0x12'));var as=require(_0x172b('0x13'));var hardwareService=require(_0x172b('0x14'));var logger=require(_0x172b('0x15'))(_0x172b('0x16'));var utils=require(_0x172b('0x17'));var config=require(_0x172b('0x18'));var db=require(_0x172b('0x19'))['db'];config[_0x172b('0x1a')]=_[_0x172b('0x1b')](config[_0x172b('0x1a')],{'host':_0x172b('0x1c'),'port':0x18eb});var socket=require(_0x172b('0x1d'))(new Redis(config['redis']));require(_0x172b('0x1e'))[_0x172b('0x1f')](socket);function respondWithStatusCode(_0x4c497d,_0x41fd64){_0x41fd64=_0x41fd64||0xcc;return function(_0x55e27b){if(_0x55e27b){return _0x4c497d[_0x172b('0x20')](_0x41fd64);}return _0x4c497d['status'](_0x41fd64)[_0x172b('0x21')]();};}function respondWithResult(_0x185a5c,_0x34c637){_0x34c637=_0x34c637||0xc8;return function(_0x388697){if(_0x388697){return _0x185a5c[_0x172b('0x22')](_0x34c637)[_0x172b('0x23')](_0x388697);}};}function respondWithFilteredResult(_0x45e63e,_0x475627){return function(_0x41edce){if(_0x41edce){var _0x225abd=_0x41edce[_0x172b('0x24')],_0x36e4ef=_0x475627[_0x172b('0x25')],_0x10034f=_0x475627[_0x172b('0x25')]+_0x475627[_0x172b('0x26')],_0x1d9000;if(_0x10034f>=_0x225abd){_0x10034f=_0x225abd;_0x1d9000=0xc8;}else{_0x1d9000=0xce;}_0x45e63e['status'](_0x1d9000);return _0x45e63e[_0x172b('0x27')]('Content-Range',_0x36e4ef+'-'+_0x10034f+'/'+_0x225abd)[_0x172b('0x23')](_0x41edce);}return null;};}function patchUpdates(_0x52e4df){return function(_0x805f10){try{jsonpatch[_0x172b('0x28')](_0x805f10,_0x52e4df,!![]);}catch(_0x2c8329){return BPromise['reject'](_0x2c8329);}return _0x805f10['save']();};}function saveUpdates(_0x2071ad,_0x2ceb4e){return function(_0x3af3f2){if(_0x3af3f2){return _0x3af3f2[_0x172b('0x29')](_0x2071ad)[_0x172b('0x2a')](function(_0x3b3dfb){return _0x3b3dfb;});}return null;};}function removeEntity(_0x2a279c,_0x222a1a){return function(_0x2a195b){if(_0x2a195b){return _0x2a195b[_0x172b('0x2b')]()[_0x172b('0x2a')](function(){_0x2a279c[_0x172b('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341062,_0x3b3180){return function(_0x926be3){if(!_0x926be3){_0x341062['sendStatus'](0x194);}return _0x926be3;};}function handleError(_0x1b9da3,_0x463ed7){_0x463ed7=_0x463ed7||0x1f4;return function(_0x233303){logger[_0x172b('0x2c')](_0x233303['stack']);if(_0x233303['name']){delete _0x233303['name'];}_0x1b9da3[_0x172b('0x22')](_0x463ed7)[_0x172b('0x2d')](_0x233303);};}function getInteractionUsers(_0x2bba6b,_0xeb66e0){return new BPromise(function(_0x4e83a5,_0x3288d8){try{if(_0xeb66e0[_0x2bba6b['id']]){_0x2bba6b[_0x172b('0x2e')]=_['map'](_0xeb66e0[_0x2bba6b['id']],function(_0x1950ce){return{'id':_0x1950ce['id'],'fullname':_0x1950ce['fullname']};});}}catch(_0x4e91c3){_0x3288d8(_0x4e91c3);}_0x4e83a5(_0x2bba6b);});}function getInteractionTags(_0x389855,_0x76cc9){return new BPromise(function(_0x17b227,_0x102e82){try{if(_0x389855[_0x172b('0x2f')]){_0x389855['Tags']=[];_0x389855[_0x172b('0x2f')][_0x172b('0x30')](',')[_0x172b('0x31')](function(_0x3fb396){_0x389855[_0x172b('0x32')][_0x172b('0x33')](_0x76cc9[_0x3fb396]);});}delete _0x389855[_0x172b('0x2f')];}catch(_0x3b9173){_0x102e82(_0x3b9173);}_0x17b227(_0x389855);});}function updateOpenchannelInteraction(_0x6f1751,_0x33401f,_0x13c196){return new BPromise(function(_0x45e4da,_0x509296){return getInteractionUsers(_0x6f1751,_0x13c196)[_0x172b('0x2a')](function(_0x1de84e){return getInteractionTags(_0x1de84e,_0x33401f);})[_0x172b('0x2a')](function(_0x3f1572){_0x45e4da(_0x3f1572);})[_0x172b('0x34')](function(_0x46abd3){_0x509296(_0x46abd3);});});}exports[_0x172b('0x35')]=function(_0x2483c3,_0x1ee74f){var _0x4fc672={},_0x412531={},_0x504845={'count':0x0,'rows':[]};var _0x2b5190=_['map'](db[_0x172b('0x36')][_0x172b('0x37')],function(_0x5cfbaf){return{'name':_0x5cfbaf['fieldName'],'type':_0x5cfbaf[_0x172b('0x38')]['key']};});_0x412531['model']=_[_0x172b('0x39')](_0x2b5190,_0x172b('0x3a'));_0x412531[_0x172b('0x3b')]=_[_0x172b('0x3c')](_0x2483c3[_0x172b('0x3b')]);_0x412531['filters']=_[_0x172b('0x3d')](_0x412531[_0x172b('0x3e')],_0x412531[_0x172b('0x3b')]);_0x4fc672[_0x172b('0x3f')]=_[_0x172b('0x3d')](_0x412531[_0x172b('0x3e')],qs[_0x172b('0x40')](_0x2483c3[_0x172b('0x3b')][_0x172b('0x40')]));_0x4fc672[_0x172b('0x3f')]=_0x4fc672[_0x172b('0x3f')][_0x172b('0x41')]?_0x4fc672[_0x172b('0x3f')]:_0x412531[_0x172b('0x3e')];if(!_0x2483c3['query'][_0x172b('0x42')](_0x172b('0x43'))){_0x4fc672['limit']=qs[_0x172b('0x26')](_0x2483c3[_0x172b('0x3b')][_0x172b('0x26')]);_0x4fc672[_0x172b('0x25')]=qs['offset'](_0x2483c3['query'][_0x172b('0x25')]);}_0x4fc672[_0x172b('0x44')]=qs['sort'](_0x2483c3['query'][_0x172b('0x45')]);_0x4fc672[_0x172b('0x46')]=qs[_0x172b('0x47')](_[_0x172b('0x48')](_0x2483c3[_0x172b('0x3b')],_0x412531[_0x172b('0x47')]),_0x2b5190);var _0x3f7afd=[];var _0x4c0050=squel[_0x172b('0x49')]()[_0x172b('0x4a')]('id')[_0x172b('0x4a')]('name')['field']('color')[_0x172b('0x4b')](_0x172b('0x4c'));var _0x392387=squel[_0x172b('0x49')]()[_0x172b('0x4a')]('u.id')[_0x172b('0x4a')](_0x172b('0x4d'))[_0x172b('0x4a')](_0x172b('0x4e'))['from'](_0x172b('0x4f'),'ui')[_0x172b('0x50')]('users','u',_0x172b('0x51'));var _0x54a1c4=squel[_0x172b('0x49')]()[_0x172b('0x4b')]('openchannel_interactions','i')['left_join'](_0x172b('0x52'),'c',_0x172b('0x53'))[_0x172b('0x50')](_0x172b('0x54'),'o',_0x172b('0x55'))[_0x172b('0x50')](_0x172b('0x56'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x172b('0x50')](_0x172b('0x57'),'me',_0x172b('0x58'))['left_join'](_0x172b('0x59'),'it',_0x172b('0x5a'))['left_join'](_0x172b('0x4c'),'t',_0x172b('0x5b'));var _0x716e8=squel[_0x172b('0x5c')]();var _0x4ad9ca=[];var _0x33ef95=squel[_0x172b('0x5c')]();var _0x22922d;if(_0x2483c3[_0x172b('0x3b')][_0x172b('0x5d')]){_0x22922d=as[_0x172b('0x5e')](_0x2483c3['query']['search']);var _0x3081d3=_0x22922d[_0x172b('0x5f')];for(var _0x2a1f86=0x0;_0x2a1f86<_0x22922d[_0x172b('0x60')]['length'];_0x2a1f86++){var _0xf11235=_0x22922d[_0x172b('0x60')][_0x2a1f86];var _0x4f8d66='i';var _0x21acee=_['find'](_0x2b5190,[_0x172b('0x3a'),_0xf11235['field']]);if(!_0x21acee){switch(_0xf11235[_0x172b('0x4a')]){case _0x172b('0x61'):if(_0xf11235[_0x172b('0x62')]==0x1){_0x54a1c4[_0x172b('0x63')]('`'+_0xf11235[_0x172b('0x4a')]+_0x172b('0x64'));}else{_0x54a1c4[_0x172b('0x63')]('`'+_0xf11235[_0x172b('0x4a')]+'`\x20>\x200');}break;case _0x172b('0x65'):if(_0xf11235[_0x172b('0x66')]===_0x172b('0x67')){if(_0xf11235[_0x172b('0x62')][_0x172b('0x30')]('\x20')['length']>0x1){_0x716e8[_0x3081d3](_0x172b('0x68'),qs[_0x172b('0x69')](_0xf11235[_0x172b('0x62')]),null);}else{var _0x10170f='%'+_0xf11235[_0x172b('0x62')]+'%';_0x716e8[_0x3081d3](_0x172b('0x6a'),_0x10170f,_0x10170f,_0x10170f);}}else{_0x21acee=_['find'](_0x2b5190,[_0x172b('0x3a'),'ContactId']);_0xf11235[_0x172b('0x4a')]=_0x172b('0x6b');_0x19cd1b=as['buildExpression'](_0x4f8d66,_0x21acee[_0x172b('0x38')],_0xf11235);_0x716e8[_0x3081d3](_0x19cd1b[_0x172b('0x6c')],_0x19cd1b[_0x172b('0x62')]['start'],_0x19cd1b[_0x172b('0x62')][_0x172b('0x21')]);}break;case _0x172b('0x6d'):var _0x223704=_0xf11235['value']['split'](',')[_0x172b('0x39')](function(_0x10839c){return Number(_0x10839c);});_0x223704[_0x172b('0x31')](function(_0x446b8a){_0x33ef95['or'](_0x172b('0x6e'),'%,'+_0x446b8a+',%');});_0x4ad9ca=_['union'](_0x4ad9ca,_0x223704);break;case _0x172b('0x6f'):if(_0xf11235[_0x172b('0x66')]===_0x172b('0x67')){_0x716e8[_0x3081d3](_0x172b('0x70'),'%'+_0xf11235[_0x172b('0x62')]+'%',null);}else{_0x21acee=_['find'](_0x2b5190,[_0x172b('0x3a'),'UserId']);_0xf11235[_0x172b('0x4a')]='UserId';_0x19cd1b=as['buildExpression'](_0x4f8d66,_0x21acee['type'],_0xf11235);_0x716e8[_0x3081d3](_0x19cd1b[_0x172b('0x6c')],_0x19cd1b['value']['start'],_0x19cd1b[_0x172b('0x62')]['end']);}break;case _0x172b('0x71'):_0x19cd1b=as[_0x172b('0x72')]('me',null,_0xf11235);_0x716e8[_0x3081d3](_0x19cd1b[_0x172b('0x6c')],_0x19cd1b[_0x172b('0x62')][_0x172b('0x73')],_0x19cd1b[_0x172b('0x62')][_0x172b('0x21')]);break;}}else{var _0x19cd1b=as[_0x172b('0x72')](_0x4f8d66,_0x21acee[_0x172b('0x38')],_0xf11235);_0x716e8[_0x3081d3](_0x19cd1b[_0x172b('0x6c')],_0x19cd1b[_0x172b('0x62')][_0x172b('0x73')],_0x19cd1b[_0x172b('0x62')][_0x172b('0x21')]);}}}else{var _0xe505eb=_(_0x2483c3[_0x172b('0x3b')])[_0x172b('0x3c')]()[_0x172b('0x39')](function(_0x3ab94c){return _[_0x172b('0x74')](_0x2b5190,['name',_0x3ab94c])?_0x3ab94c:undefined;})[_0x172b('0x75')]()[_0x172b('0x62')]();if(!_[_0x172b('0x76')](_0xe505eb)){_0xe505eb[_0x172b('0x31')](function(_0x1662c3){if(_0x1662c3===_0x172b('0x77')){_0x54a1c4[_0x172b('0x46')](_0x172b('0x78'),[][_0x172b('0x79')](_0x2483c3[_0x172b('0x3b')][_0x1662c3]));}else if(_0x1662c3===_0x172b('0x7a')){var _0x221df=JSON[_0x172b('0x7b')](_0x2483c3[_0x172b('0x3b')][_0x1662c3])[_0x172b('0x7c')];var _0x4fb58f=JSON[_0x172b('0x7b')](_0x2483c3['query'][_0x1662c3])[_0x172b('0x7d')];_0x54a1c4[_0x172b('0x46')](_0x172b('0x7e'),_0x221df,_0x4fb58f);}else{if(_0x2483c3[_0x172b('0x3b')][_0x1662c3]==='null'){_0x54a1c4[_0x172b('0x46')]('i.'+_0x1662c3+_0x172b('0x7f'));}else{_0x54a1c4[_0x172b('0x46')]('i.'+_0x1662c3+_0x172b('0x80'),_0x2483c3['query'][_0x1662c3]);}}});}if(_0x2483c3['query'][_0x172b('0x81')]){if(_0x2483c3[_0x172b('0x3b')][_0x172b('0x81')]==0x1){_0x54a1c4['having'](_0x172b('0x82'));}else{_0x54a1c4[_0x172b('0x63')](_0x172b('0x83'));}}if(_0x2483c3[_0x172b('0x3b')][_0x172b('0x84')]){_0x4ad9ca=_[_0x172b('0x85')](_0x2483c3[_0x172b('0x3b')][_0x172b('0x84')])?_0x2483c3[_0x172b('0x3b')][_0x172b('0x84')]:new Array(_0x2483c3[_0x172b('0x3b')][_0x172b('0x84')]);_0x4ad9ca['forEach'](function(_0x387da9){_0x33ef95['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x387da9+',%');});}if(_0x2483c3['query']['filter']){var _0x48dc6e=_0x2483c3['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x172b('0x86')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x48dc6e)){_0x716e8['or'](_0x172b('0x87'),_0x48dc6e+'%');}else{_0x716e8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x172b('0x69')](_0x48dc6e))['or'](_0x172b('0x88'),_0x48dc6e+'%')['or'](_0x172b('0x89'),_0x48dc6e+'%');}}}_0x54a1c4[_0x172b('0x46')](_0x716e8);_0x54a1c4['group']('i.id');var _0x59cb15={'type':db['Sequelize'][_0x172b('0x8a')]['SELECT'],'raw':!![]};var _0x23b0c5=_0x54a1c4[_0x172b('0x8b')]();_0x23b0c5[_0x172b('0x4a')](_0x172b('0x8c'));_0x23b0c5[_0x172b('0x4a')](_0x172b('0x8d'),_0x172b('0x61'));if(_0x4fc672['order']){_0x4fc672[_0x172b('0x44')]['forEach'](function(_0x8c4153){_0x54a1c4['order']('i.'+_0x8c4153[0x0],_0x8c4153[0x1]===_0x172b('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x4ad9ca)){_0x54a1c4[_0x172b('0x63')](_0x33ef95);_0x23b0c5[_0x172b('0x46')]('t.id\x20IN\x20?',_0x4ad9ca);}BPromise[_0x172b('0x8f')]()['then'](function(){if(!_0x22922d){if(_0x2483c3[_0x172b('0x3b')][_0x172b('0x77')]||_0x2483c3[_0x172b('0x3b')][_0x172b('0x90')])return;_0x23b0c5[_0x172b('0x46')](_0x172b('0x91'));_0x54a1c4[_0x172b('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x2483c3['user'][_0x172b('0x92')]({'attributes':['id'],'raw':!![]})[_0x172b('0x2a')](function(_0x50817b){if(_[_0x172b('0x76')](_0x50817b)){_0x23b0c5[_0x172b('0x46')](_0x172b('0x93'));_0x54a1c4['where'](_0x172b('0x93'));}else{_0x23b0c5[_0x172b('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x172b('0x39')](_0x50817b,'id'));_0x54a1c4[_0x172b('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x172b('0x39')](_0x50817b,'id'));}});})[_0x172b('0x2a')](function(){db[_0x172b('0x94')][_0x172b('0x3b')](_0x23b0c5[_0x172b('0x95')](),_0x59cb15)[_0x172b('0x2a')](function(_0x3a4629){_0x504845[_0x172b('0x24')]=_0x3a4629['length'];if(_0x504845[_0x172b('0x24')]===0x0)return[];return db['sequelize'][_0x172b('0x3b')](_0x4c0050[_0x172b('0x95')](),_0x59cb15)[_0x172b('0x2a')](function(_0x35f7f7){_0x3f7afd=_['keyBy'](_0x35f7f7,'id');_0x59cb15=_[_0x172b('0x96')](_0x59cb15,{'model':db[_0x172b('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2483c3[_0x172b('0x3b')]['fields']){_0x4fc672['attributes'][_0x172b('0x31')](function(_0x4cc975){_0x54a1c4[_0x172b('0x4a')]('i.'+_0x4cc975);});}else{_0x54a1c4[_0x172b('0x4a')](_0x172b('0x8d'),_0x172b('0x61'));_0x54a1c4[_0x172b('0x4a')]('a.key',_0x172b('0x97'));_0x54a1c4[_0x172b('0x4a')](_0x172b('0x98'),_0x172b('0x99'));_0x54a1c4['field'](_0x172b('0x9a'));_0x54a1c4[_0x172b('0x4a')](_0x172b('0x9b'),_0x172b('0x9c'));_0x54a1c4[_0x172b('0x4a')](_0x172b('0x9d'),'Contact.lastName');_0x54a1c4[_0x172b('0x4a')](_0x172b('0x9e'),_0x172b('0x9f'));_0x54a1c4[_0x172b('0x4a')](_0x172b('0xa0'),_0x172b('0xa1'));_0x54a1c4['field'](_0x172b('0xa2'),_0x172b('0xa3'));_0x54a1c4['field'](_0x172b('0xa4'),_0x172b('0xa5'));_0x54a1c4[_0x172b('0x4a')](_0x172b('0xa6'),_0x172b('0xa7'));_0x54a1c4[_0x172b('0x4a')](_0x172b('0xa8'),_0x172b('0xa9'));_0x54a1c4[_0x172b('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4fc672[_0x172b('0x26')])_0x54a1c4['limit'](_0x4fc672[_0x172b('0x26')]);if(_0x4fc672['offset'])_0x54a1c4[_0x172b('0x25')](_0x4fc672[_0x172b('0x25')]);return db[_0x172b('0x94')][_0x172b('0x3b')](_0x54a1c4[_0x172b('0x95')](),_0x59cb15);})[_0x172b('0x2a')](function(_0xf91ff0){_0x392387[_0x172b('0x46')](_0x172b('0xaa'),_['map'](_0xf91ff0,'id'));return db[_0x172b('0x94')][_0x172b('0x3b')](_0x392387[_0x172b('0x95')](),_0x59cb15)[_0x172b('0x2a')](function(_0x25d637){var _0x3a21e2=_['groupBy'](_0x25d637,_0x172b('0xab'));var _0x43a393=[];_0xf91ff0[_0x172b('0x31')](function(_0x13f163){_0x43a393[_0x172b('0x33')](updateOpenchannelInteraction(_0x13f163,_0x3f7afd,_0x3a21e2));});return BPromise[_0x172b('0xac')](_0x43a393);});});})['then'](function(_0x41bc32){_0x504845['rows']=_0x41bc32;return _0x504845;})['then'](respondWithFilteredResult(_0x1ee74f,_0x4fc672));})[_0x172b('0x34')](handleError(_0x1ee74f,null));};exports['show']=function(_0x3b7936,_0x4fe446){var _0x346262={'raw':![],'where':{'id':_0x3b7936[_0x172b('0xad')]['id']}},_0x44b796={};_0x44b796[_0x172b('0x3e')]=_['keys'](db['OpenchannelInteraction'][_0x172b('0x37')]);_0x44b796[_0x172b('0x3b')]=_[_0x172b('0x3c')](_0x3b7936[_0x172b('0x3b')]);_0x44b796['filters']=_[_0x172b('0x3d')](_0x44b796['model'],_0x44b796[_0x172b('0x3b')]);_0x346262[_0x172b('0x3f')]=_[_0x172b('0x3d')](_0x44b796['model'],qs[_0x172b('0x40')](_0x3b7936['query'][_0x172b('0x40')]));_0x346262[_0x172b('0x3f')]=_0x346262[_0x172b('0x3f')][_0x172b('0x41')]?_0x346262['attributes']:_0x44b796[_0x172b('0x3e')];if(_0x3b7936[_0x172b('0x3b')][_0x172b('0xae')]){_0x346262[_0x172b('0xaf')]=[{'all':!![]}];}_0x346262=_[_0x172b('0x96')]({},_0x346262,_0x3b7936[_0x172b('0xb0')]);return db[_0x172b('0x36')][_0x172b('0xb1')](_0x346262)['then'](handleEntityNotFound(_0x4fe446,null))[_0x172b('0x2a')](respondWithResult(_0x4fe446,null))[_0x172b('0x34')](handleError(_0x4fe446,null));};exports[_0x172b('0xb2')]=function(_0x1f95ae,_0xb6dc32){return db[_0x172b('0x36')][_0x172b('0xb2')](_0x1f95ae[_0x172b('0x71')],{})['then'](respondWithResult(_0xb6dc32,0xc9))[_0x172b('0x34')](handleError(_0xb6dc32,null));};exports[_0x172b('0x29')]=function(_0x53d6f0,_0x13731a){if(_0x53d6f0[_0x172b('0x71')]['id']){delete _0x53d6f0[_0x172b('0x71')]['id'];}return db[_0x172b('0x36')][_0x172b('0xb1')]({'where':{'id':_0x53d6f0[_0x172b('0xad')]['id']}})[_0x172b('0x2a')](handleEntityNotFound(_0x13731a,null))[_0x172b('0x2a')](saveUpdates(_0x53d6f0[_0x172b('0x71')],null))[_0x172b('0x2a')](respondWithResult(_0x13731a,null))[_0x172b('0x34')](handleError(_0x13731a,null));};exports['destroy']=function(_0x4a6a49,_0x488a2a){return db['OpenchannelInteraction'][_0x172b('0xb1')]({'where':{'id':_0x4a6a49[_0x172b('0xad')]['id']}})[_0x172b('0x2a')](handleEntityNotFound(_0x488a2a,null))[_0x172b('0x2a')](removeEntity(_0x488a2a,null))[_0x172b('0x34')](handleError(_0x488a2a,null));};exports['describe']=function(_0x30bc52,_0x57a2b){return db[_0x172b('0x36')][_0x172b('0xb3')]()[_0x172b('0x2a')](respondWithResult(_0x57a2b,null))[_0x172b('0x34')](handleError(_0x57a2b,null));};exports[_0x172b('0xb4')]=function(_0x355ce3,_0x4a1713,_0x484d9c){return db[_0x172b('0xb5')][_0x172b('0xb1')]({'where':{'id':_0x355ce3['params']['id']}})[_0x172b('0x2a')](handleEntityNotFound(_0x4a1713,null))['then'](function(_0x4f4f64){if(_0x4f4f64){return _0x4f4f64[_0x172b('0xb4')](_0x355ce3[_0x172b('0x71')][_0x172b('0xb6')],_[_0x172b('0xb7')](_0x355ce3[_0x172b('0x71')],[_0x172b('0xb6'),'id'])||{});}})[_0x172b('0x2a')](respondWithResult(_0x4a1713,null))['catch'](handleError(_0x4a1713,null));};exports[_0x172b('0xb8')]=function(_0x4ef971,_0xa7c959,_0x4667e1){var _0x49da4e={'raw':![],'where':{}};var _0x40f6fb={};var _0x401b4c={'count':0x0,'rows':[]};return db[_0x172b('0x36')][_0x172b('0xb9')]({'where':{'id':_0x4ef971[_0x172b('0xad')]['id']}})[_0x172b('0x2a')](handleEntityNotFound(_0xa7c959,null))['then'](function(_0x50ad56){if(_0x50ad56){_0x40f6fb[_0x172b('0x3e')]=_[_0x172b('0x3c')](db['OpenchannelMessage'][_0x172b('0x37')]);_0x40f6fb['query']=_['keys'](_0x4ef971[_0x172b('0x3b')]);_0x40f6fb[_0x172b('0x47')]=_[_0x172b('0x3d')](_0x40f6fb[_0x172b('0x3e')],_0x40f6fb[_0x172b('0x3b')]);_0x49da4e['attributes']=_[_0x172b('0x3d')](_0x40f6fb['model'],qs[_0x172b('0x40')](_0x4ef971[_0x172b('0x3b')][_0x172b('0x40')]));_0x49da4e[_0x172b('0x3f')]=_0x49da4e[_0x172b('0x3f')][_0x172b('0x41')]?_0x49da4e[_0x172b('0x3f')]:_0x40f6fb[_0x172b('0x3e')];if(!_0x4ef971['query']['hasOwnProperty'](_0x172b('0x43'))){_0x49da4e[_0x172b('0x26')]=qs[_0x172b('0x26')](_0x4ef971[_0x172b('0x3b')][_0x172b('0x26')]);_0x49da4e[_0x172b('0x25')]=qs['offset'](_0x4ef971['query'][_0x172b('0x25')]);}_0x49da4e[_0x172b('0x44')]=qs['sort'](_0x4ef971[_0x172b('0x3b')][_0x172b('0x45')]);_0x49da4e[_0x172b('0x46')]=qs[_0x172b('0x47')](_[_0x172b('0x48')](_0x4ef971['query'],_0x40f6fb['filters']));_0x49da4e[_0x172b('0x46')]['OpenchannelInteractionId']=_0x50ad56['id'];if(_0x4ef971[_0x172b('0x3b')][_0x172b('0xba')]){_0x49da4e[_0x172b('0x46')]=_['merge'](_0x49da4e[_0x172b('0x46')],{'$or':_[_0x172b('0x39')](_0x49da4e['attributes'],function(_0x10ea06){var _0x2785c2={};_0x2785c2[_0x10ea06]={'$like':'%'+_0x4ef971[_0x172b('0x3b')]['filter']+'%'};return _0x2785c2;})});}if(_0x4ef971[_0x172b('0x3b')][_0x172b('0x7c')]){var _0x1c9e2e=_0x4ef971[_0x172b('0x3b')][_0x172b('0x7c')][_0x172b('0x30')](',');var _0x253a9f={};_0x253a9f[_0x1c9e2e[0x0]]={'$gte':moment(_0x1c9e2e[0x1])[_0x172b('0xbb')](_0x172b('0xbc'))};_0x49da4e[_0x172b('0x46')]=_[_0x172b('0x96')](_0x49da4e[_0x172b('0x46')],_0x253a9f);}_0x49da4e=_[_0x172b('0x96')]({},_0x49da4e,_0x4ef971['options']);return db[_0x172b('0xb5')]['count']({'where':_0x49da4e[_0x172b('0x46')]})['then'](function(_0x49c02e){_0x401b4c['count']=_0x49c02e;if(_0x4ef971[_0x172b('0x3b')][_0x172b('0xae')]){_0x49da4e[_0x172b('0xaf')]=[{'all':!![]}];}return db[_0x172b('0xb5')][_0x172b('0xbd')](_0x49da4e);})[_0x172b('0x2a')](function(_0x1d8fc7){_0x401b4c[_0x172b('0xbe')]=_0x1d8fc7;return _0x401b4c;});}})[_0x172b('0x2a')](respondWithFilteredResult(_0xa7c959,_0x49da4e))[_0x172b('0x34')](handleError(_0xa7c959,null));};exports[_0x172b('0xbf')]=function(_0x42fd4c,_0x5a4f99,_0x24d9f2){return db[_0x172b('0x36')][_0x172b('0xb1')]({'where':{'id':_0x42fd4c[_0x172b('0xad')]['id']}})['then'](handleEntityNotFound(_0x5a4f99,null))[_0x172b('0x2a')](function(_0x334448){if(_0x334448){return _0x334448[_0x172b('0xc0')](_0x42fd4c[_0x172b('0x71')][_0x172b('0xb6')],_[_0x172b('0xb7')](_0x42fd4c[_0x172b('0x71')],[_0x172b('0xb6'),'id'])||{})[_0x172b('0xc1')](function(){return db[_0x172b('0x6d')][_0x172b('0xbd')]({'attributes':['id',_0x172b('0x3a'),_0x172b('0xc2')],'where':{'id':_0x42fd4c[_0x172b('0x71')][_0x172b('0xb6')]}});})[_0x172b('0x2a')](function(_0xdce3d){socket[_0x172b('0xc3')](_0x172b('0xc4'),{'id':Number(_0x42fd4c[_0x172b('0xad')]['id']),'tags':_0xdce3d||[]});return{'id':Number(_0x42fd4c['params']['id']),'tags':_0xdce3d||[]};});}})[_0x172b('0x2a')](respondWithResult(_0x5a4f99,null))[_0x172b('0x34')](handleError(_0x5a4f99,null));};exports['removeTags']=function(_0xa53da9,_0x43ddd7,_0x1153a7){return db[_0x172b('0x36')][_0x172b('0xb1')]({'where':{'id':_0xa53da9[_0x172b('0xad')]['id']}})[_0x172b('0x2a')](handleEntityNotFound(_0x43ddd7,null))['then'](function(_0x45043c){if(_0x45043c){return _0x45043c[_0x172b('0xc5')](_0xa53da9[_0x172b('0x3b')][_0x172b('0xb6')]);}})[_0x172b('0x2a')](respondWithStatusCode(_0x43ddd7,null))[_0x172b('0x34')](handleError(_0x43ddd7,null));};exports[_0x172b('0xc6')]=function(_0x4c9260,_0x3e58ba){var _0x25fd8a=moment()[_0x172b('0xc7')]()[_0x172b('0x95')]();var _0xa8d0c6=path[_0x172b('0xc8')](config[_0x172b('0xc9')],_0x172b('0xca'),_0x172b('0xcb'),'tmp');var _0x571e6a=path[_0x172b('0xc8')](config[_0x172b('0xc9')],'server',_0x172b('0xcb'),_0x172b('0xcc'));var _0x5c8e90=path['join'](_0xa8d0c6,_0x25fd8a);var _0x5d8009=util['format'](_0x172b('0xcd'),_0x4c9260[_0x172b('0xad')]['id'],_0x25fd8a);var _0x3e0886=path['join'](_0xa8d0c6,_0x5d8009);var _0x1084d4=[];_0x1084d4[_0x172b('0x33')]({'model':db[_0x172b('0x6f')],'as':_0x172b('0x6f'),'attributes':['id',_0x172b('0xce')],'raw':!![]});_0x1084d4[_0x172b('0x33')]({'model':db[_0x172b('0xcf')],'as':'Contact','attributes':['id',_0x172b('0xd0'),'lastName'],'raw':!![]});if(_0x4c9260[_0x172b('0x3b')][_0x172b('0xcc')]){_0x1084d4[_0x172b('0x33')]({'model':db[_0x172b('0xd1')],'as':_0x172b('0xd1'),'raw':!![]});}var _0x1f8d38=[{'model':db[_0x172b('0xb5')],'as':'Messages','attributes':['id',_0x172b('0x71'),_0x172b('0x7a'),_0x172b('0xd2'),_0x172b('0xd3'),'read'],'include':_0x1084d4}];_0x1f8d38[_0x172b('0x33')]({'model':db[_0x172b('0xd4')],'as':'Account','attributes':['id',_0x172b('0x3a')]});_0x1f8d38[_0x172b('0x33')]({'model':db[_0x172b('0x6f')],'as':_0x172b('0xd5'),'attributes':['id',_0x172b('0xce')]});return db[_0x172b('0x36')][_0x172b('0xb1')]({'where':{'id':_0x4c9260[_0x172b('0xad')]['id']},'include':_0x1f8d38})[_0x172b('0x2a')](handleEntityNotFound(_0x3e58ba,null))['then'](function(_0x535fe0){if(_0x535fe0){var _0xe1923b=_0x535fe0[_0x172b('0xd6')]({'plain':!![]});fs[_0x172b('0xd7')](_0x5c8e90);var _0x440a79={'format':'A4','border':_0x172b('0xd8'),'header':{'height':_0x172b('0xd9'),'contents':{'first':_0x172b('0xda')}},'footer':{'height':_0x172b('0xdb'),'contents':{'default':util['format'](_0x172b('0xdc'),util[_0x172b('0xbb')](_0x172b('0xdd'),_0x172b('0xde'),_0xe1923b['id']),moment()[_0x172b('0xbb')](_0x172b('0xdf'))[_0x172b('0x95')]())}}};var _0x5dbbcb={'channel':'Openchannel','account':_0xe1923b[_0x172b('0xe0')][_0x172b('0x3a')],'agent':_0xe1923b[_0x172b('0xd5')]?_0xe1923b[_0x172b('0xd5')][_0x172b('0xce')]:_0x172b('0xe1'),'createdAt':moment(_0xe1923b[_0x172b('0x7a')])[_0x172b('0xbb')](_0x172b('0xbc'))[_0x172b('0x95')](),'closedAt':_0xe1923b[_0x172b('0xe2')]?moment(_0xe1923b[_0x172b('0xe3')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x172b('0x95')]():'','disposition':_0xe1923b[_0x172b('0xe4')],'visibility':_0xe1923b['threadId']?_0x172b('0xe5'):'Private','messages':_(_0xe1923b[_0x172b('0xe6')])[_0x172b('0xba')]({'secret':![]})[_0x172b('0x39')](function(_0x4c64a6){if(_0x4c64a6[_0x172b('0xd1')]){var _0x5ce921=path[_0x172b('0xc8')](_0x571e6a,_0x4c64a6['Attachment'][_0x172b('0xe7')]);if(fs[_0x172b('0xe8')](_0x5ce921)){fs[_0x172b('0xe9')](_0x5ce921)[_0x172b('0xea')](fs['createWriteStream'](path[_0x172b('0xc8')](_0x5c8e90,_0x4c64a6[_0x172b('0xd1')][_0x172b('0xe7')])));}}return{'date':moment(_0x4c64a6[_0x172b('0x7a')])[_0x172b('0xbb')](_0x172b('0xbc'))[_0x172b('0x95')](),'sender':_0x4c64a6[_0x172b('0xd2')]===_0x172b('0xeb')?_0x4c64a6[_0x172b('0x6f')]?_0x4c64a6[_0x172b('0x6f')]['fullname']:'System':_0x4c64a6['Contact']['firstName']+(_0x4c64a6[_0x172b('0x65')][_0x172b('0xec')]?'\x20'+_0x4c64a6[_0x172b('0x65')][_0x172b('0xec')]:''),'body':_0x4c64a6[_0x172b('0xd1')]?_0x4c64a6[_0x172b('0xd1')][_0x172b('0xe7')]:_0x4c64a6[_0x172b('0x71')],'direction':_0x4c64a6[_0x172b('0xd2')]===_0x172b('0xeb')?'A':'C','secret':_0x4c64a6[_0x172b('0xd3')],'read':_0x4c64a6[_0x172b('0x81')],'attachment':_0x4c64a6[_0x172b('0xd1')]};})[_0x172b('0x62')]()};return ejs[_0x172b('0xed')](path[_0x172b('0xc8')](config['root'],'server','views',_0x172b('0xee')),{'interaction':_0x5dbbcb})[_0x172b('0x2a')](function(_0x10108a){return new BPromise(function(_0xd86e8a,_0x1037a9){pdf[_0x172b('0xb2')](_0x10108a,_0x440a79)['toFile'](path['join'](_0x5c8e90,_0x172b('0xef')+_0xe1923b['id']+'-'+_0x25fd8a+'.pdf'),function(_0x22d7ff,_0x232c84){if(_0x22d7ff)return _0x1037a9(_0x22d7ff);_0xd86e8a(_0x232c84);});});})[_0x172b('0x2a')](function(){return new BPromise(function(_0x1bc532,_0x4d5068){zipdir(_0x5c8e90,{'saveTo':_0x3e0886},function(_0x1eb3b2,_0x3d3ecd){if(_0x1eb3b2)return _0x4d5068(_0x1eb3b2);return _0x1bc532(_0x3d3ecd);});})[_0x172b('0x2a')](function(){return new BPromise(function(_0xe746d9,_0x37d43c){rimraf(_0x5c8e90,function(_0x250468){if(_0x250468)_0x37d43c(_0x250468);return _0xe746d9();});});})[_0x172b('0x2a')](function(){return _0x3e58ba[_0x172b('0xc6')](_0x3e0886,_0x5d8009,function(_0x160c45){if(_0x160c45){console[_0x172b('0xf0')]('err',_0x160c45);}else{fs[_0x172b('0xf1')](_0x3e0886);}});});});}else{return _0x3e58ba[_0x172b('0x20')](0xc8);}})[_0x172b('0x34')](handleError(_0x3e58ba,null));}; \ No newline at end of file +var _0xf924=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','Users','fullname','TagIds','split','forEach','Tags','catch','index','map','rawAttributes','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','field','color','from','tools_tags','u.id','u.fullname','users','select','openchannel_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','keys','compact','isEmpty','OpenchannelAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','show','params','OpenchannelInteraction','filters','include','options','create','describe','addMessage','ids','omit','findOne','OpenchannelMessage','nolimit','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','removeTags','download','unix','join','root','server','tmp','files','attachments','User','CmContact','Contact','Attachment','createdAt','secret','OpenchannelAccount','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','format','%s\x20#%d','Openchannel','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','Public','Private','basename','createReadStream','pipe','createWriteStream','direction','out','System','firstName','lastName','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format'];(function(_0x56794a,_0x182681){var _0x938100=function(_0x4079d1){while(--_0x4079d1){_0x56794a['push'](_0x56794a['shift']());}};_0x938100(++_0x182681);}(_0xf924,0x1db));var _0x4f92=function(_0x8d9399,_0x490955){_0x8d9399=_0x8d9399-0x0;var _0x5a0645=_0xf924[_0x8d9399];return _0x5a0645;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f92('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4f92('0x1'));var moment=require(_0x4f92('0x2'));var BPromise=require(_0x4f92('0x3'));var Mustache=require(_0x4f92('0x4'));var util=require(_0x4f92('0x5'));var path=require(_0x4f92('0x6'));var sox=require(_0x4f92('0x7'));var csv=require(_0x4f92('0x8'));var ejs=require(_0x4f92('0x9'));var fs=require('fs');var _=require(_0x4f92('0xa'));var squel=require(_0x4f92('0xb'));var crypto=require(_0x4f92('0xc'));var jsforce=require(_0x4f92('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f92('0x8'));var querystring=require(_0x4f92('0xe'));var Papa=require(_0x4f92('0xf'));var Redis=require(_0x4f92('0x10'));var authService=require(_0x4f92('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4f92('0x12'));var hardwareService=require(_0x4f92('0x13'));var logger=require(_0x4f92('0x14'))(_0x4f92('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4f92('0x16'))['db'];config['redis']=_[_0x4f92('0x17')](config['redis'],{'host':_0x4f92('0x18'),'port':0x18eb});var socket=require(_0x4f92('0x19'))(new Redis(config[_0x4f92('0x1a')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5286f1,_0x8cdc26){_0x8cdc26=_0x8cdc26||0xcc;return function(_0x1b5846){if(_0x1b5846){return _0x5286f1['sendStatus'](_0x8cdc26);}return _0x5286f1[_0x4f92('0x1b')](_0x8cdc26)[_0x4f92('0x1c')]();};}function respondWithResult(_0x3e564b,_0x49c77f){_0x49c77f=_0x49c77f||0xc8;return function(_0x36b4d8){if(_0x36b4d8){return _0x3e564b[_0x4f92('0x1b')](_0x49c77f)[_0x4f92('0x1d')](_0x36b4d8);}};}function respondWithFilteredResult(_0x17f6f6,_0x250cc4){return function(_0x2b3397){if(_0x2b3397){var _0x5a2fc2=_0x2b3397[_0x4f92('0x1e')],_0x3b3758=_0x250cc4['offset'],_0x5baa68=_0x250cc4[_0x4f92('0x1f')]+_0x250cc4[_0x4f92('0x20')],_0x22ffab;if(_0x5baa68>=_0x5a2fc2){_0x5baa68=_0x5a2fc2;_0x22ffab=0xc8;}else{_0x22ffab=0xce;}_0x17f6f6[_0x4f92('0x1b')](_0x22ffab);return _0x17f6f6[_0x4f92('0x21')](_0x4f92('0x22'),_0x3b3758+'-'+_0x5baa68+'/'+_0x5a2fc2)[_0x4f92('0x1d')](_0x2b3397);}return null;};}function patchUpdates(_0x3b9bd2){return function(_0x2aa63f){try{jsonpatch[_0x4f92('0x23')](_0x2aa63f,_0x3b9bd2,!![]);}catch(_0xd0c55b){return BPromise[_0x4f92('0x24')](_0xd0c55b);}return _0x2aa63f['save']();};}function saveUpdates(_0x5e915b,_0x546772){return function(_0x187497){if(_0x187497){return _0x187497[_0x4f92('0x25')](_0x5e915b)[_0x4f92('0x26')](function(_0x522b79){return _0x522b79;});}return null;};}function removeEntity(_0x58250e,_0x2afad8){return function(_0x5be784){if(_0x5be784){return _0x5be784['destroy']()['then'](function(){_0x58250e['status'](0xcc)[_0x4f92('0x1c')]();});}};}function handleEntityNotFound(_0x104ddb,_0x49879c){return function(_0x290351){if(!_0x290351){_0x104ddb[_0x4f92('0x27')](0x194);}return _0x290351;};}function handleError(_0x2dce63,_0x14bcfa){_0x14bcfa=_0x14bcfa||0x1f4;return function(_0x461e89){logger['error'](_0x461e89[_0x4f92('0x28')]);if(_0x461e89[_0x4f92('0x29')]){delete _0x461e89[_0x4f92('0x29')];}_0x2dce63[_0x4f92('0x1b')](_0x14bcfa)[_0x4f92('0x2a')](_0x461e89);};}function getInteractionUsers(_0x1c5e64,_0x534736){return new BPromise(function(_0x545dbe,_0x13f3e0){try{if(_0x534736[_0x1c5e64['id']]){_0x1c5e64[_0x4f92('0x2b')]=_['map'](_0x534736[_0x1c5e64['id']],function(_0x106ed8){return{'id':_0x106ed8['id'],'fullname':_0x106ed8[_0x4f92('0x2c')]};});}}catch(_0x21a257){_0x13f3e0(_0x21a257);}_0x545dbe(_0x1c5e64);});}function getInteractionTags(_0x21c189,_0x516d54){return new BPromise(function(_0x40a5b7,_0x2fd568){try{if(_0x21c189[_0x4f92('0x2d')]){_0x21c189['Tags']=[];_0x21c189[_0x4f92('0x2d')][_0x4f92('0x2e')](',')[_0x4f92('0x2f')](function(_0x2660e0){_0x21c189[_0x4f92('0x30')]['push'](_0x516d54[_0x2660e0]);});}delete _0x21c189[_0x4f92('0x2d')];}catch(_0x10c3f2){_0x2fd568(_0x10c3f2);}_0x40a5b7(_0x21c189);});}function updateOpenchannelInteraction(_0x544784,_0x49dddf,_0x2a3859){return new BPromise(function(_0x1b0657,_0xbb9893){return getInteractionUsers(_0x544784,_0x2a3859)[_0x4f92('0x26')](function(_0x5bcb4c){return getInteractionTags(_0x5bcb4c,_0x49dddf);})[_0x4f92('0x26')](function(_0x642d2f){_0x1b0657(_0x642d2f);})[_0x4f92('0x31')](function(_0x248b14){_0xbb9893(_0x248b14);});});}exports[_0x4f92('0x32')]=function(_0x1e6578,_0x5ea0dc){var _0x63604c={},_0x45fb00={},_0x533747={'count':0x0,'rows':[]};var _0x93dca3=_[_0x4f92('0x33')](db['OpenchannelInteraction'][_0x4f92('0x34')],function(_0x57aa6b){return{'name':_0x57aa6b['fieldName'],'type':_0x57aa6b[_0x4f92('0x35')]['key']};});_0x45fb00[_0x4f92('0x36')]=_[_0x4f92('0x33')](_0x93dca3,_0x4f92('0x29'));_0x45fb00[_0x4f92('0x37')]=_['keys'](_0x1e6578[_0x4f92('0x37')]);_0x45fb00['filters']=_[_0x4f92('0x38')](_0x45fb00['model'],_0x45fb00['query']);_0x63604c['attributes']=_[_0x4f92('0x38')](_0x45fb00[_0x4f92('0x36')],qs[_0x4f92('0x39')](_0x1e6578[_0x4f92('0x37')][_0x4f92('0x39')]));_0x63604c[_0x4f92('0x3a')]=_0x63604c[_0x4f92('0x3a')][_0x4f92('0x3b')]?_0x63604c['attributes']:_0x45fb00['model'];if(!_0x1e6578['query'][_0x4f92('0x3c')]('nolimit')){_0x63604c[_0x4f92('0x20')]=qs[_0x4f92('0x20')](_0x1e6578[_0x4f92('0x37')][_0x4f92('0x20')]);_0x63604c[_0x4f92('0x1f')]=qs[_0x4f92('0x1f')](_0x1e6578[_0x4f92('0x37')][_0x4f92('0x1f')]);}_0x63604c[_0x4f92('0x3d')]=qs[_0x4f92('0x3e')](_0x1e6578['query'][_0x4f92('0x3e')]);_0x63604c['where']=qs['filters'](_[_0x4f92('0x3f')](_0x1e6578[_0x4f92('0x37')],_0x45fb00['filters']),_0x93dca3);var _0x135ec5=[];var _0x43afeb=squel['select']()['field']('id')[_0x4f92('0x40')](_0x4f92('0x29'))['field'](_0x4f92('0x41'))[_0x4f92('0x42')](_0x4f92('0x43'));var _0x1c2352=squel['select']()[_0x4f92('0x40')](_0x4f92('0x44'))['field'](_0x4f92('0x45'))[_0x4f92('0x40')]('ui.OpenchannelInteractionId')[_0x4f92('0x42')]('user_has_openchannel_interactions','ui')['left_join'](_0x4f92('0x46'),'u','u.id\x20=\x20ui.UserId');var _0x11b72d=squel[_0x4f92('0x47')]()[_0x4f92('0x42')](_0x4f92('0x48'),'i')[_0x4f92('0x49')](_0x4f92('0x4a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4f92('0x49')](_0x4f92('0x46'),'o',_0x4f92('0x4b'))[_0x4f92('0x49')](_0x4f92('0x4c'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join']('openchannel_messages','me',_0x4f92('0x4d'))[_0x4f92('0x49')](_0x4f92('0x4e'),'it',_0x4f92('0x4f'))[_0x4f92('0x49')](_0x4f92('0x43'),'t',_0x4f92('0x50'));var _0x2aa724=squel[_0x4f92('0x51')]();var _0x49133d=[];var _0x47e5d3=squel[_0x4f92('0x51')]();var _0x40231c;if(_0x1e6578[_0x4f92('0x37')]['search']){_0x40231c=as[_0x4f92('0x52')](_0x1e6578['query'][_0x4f92('0x53')]);var _0x5748f9=_0x40231c[_0x4f92('0x54')];for(var _0x1e58eb=0x0;_0x1e58eb<_0x40231c[_0x4f92('0x55')][_0x4f92('0x3b')];_0x1e58eb++){var _0x3736dd=_0x40231c[_0x4f92('0x55')][_0x1e58eb];var _0x18faed='i';var _0x5d08a6=_['find'](_0x93dca3,[_0x4f92('0x29'),_0x3736dd[_0x4f92('0x40')]]);if(!_0x5d08a6){switch(_0x3736dd[_0x4f92('0x40')]){case _0x4f92('0x56'):if(_0x3736dd[_0x4f92('0x57')]==0x1){_0x11b72d['having']('`'+_0x3736dd[_0x4f92('0x40')]+'`\x20=\x200');}else{_0x11b72d['having']('`'+_0x3736dd[_0x4f92('0x40')]+_0x4f92('0x58'));}break;case'Contact':if(_0x3736dd['operator']===_0x4f92('0x59')){if(_0x3736dd[_0x4f92('0x57')][_0x4f92('0x2e')]('\x20')[_0x4f92('0x3b')]>0x1){_0x2aa724[_0x5748f9](_0x4f92('0x5a'),qs[_0x4f92('0x5b')](_0x3736dd[_0x4f92('0x57')]),null);}else{var _0x5df877='%'+_0x3736dd['value']+'%';_0x2aa724[_0x5748f9](_0x4f92('0x5c'),_0x5df877,_0x5df877,_0x5df877);}}else{_0x5d08a6=_[_0x4f92('0x5d')](_0x93dca3,[_0x4f92('0x29'),_0x4f92('0x5e')]);_0x3736dd['field']=_0x4f92('0x5e');_0x5b9d87=as[_0x4f92('0x5f')](_0x18faed,_0x5d08a6[_0x4f92('0x35')],_0x3736dd);_0x2aa724[_0x5748f9](_0x5b9d87[_0x4f92('0x60')],_0x5b9d87[_0x4f92('0x57')][_0x4f92('0x61')],_0x5b9d87[_0x4f92('0x57')][_0x4f92('0x1c')]);}break;case _0x4f92('0x62'):var _0x3d298e=_0x3736dd[_0x4f92('0x57')][_0x4f92('0x2e')](',')[_0x4f92('0x33')](function(_0x5865c0){return Number(_0x5865c0);});_0x3d298e[_0x4f92('0x2f')](function(_0x470a31){_0x47e5d3['or'](_0x4f92('0x63'),'%,'+_0x470a31+',%');});_0x49133d=_[_0x4f92('0x64')](_0x49133d,_0x3d298e);break;case'User':if(_0x3736dd['operator']===_0x4f92('0x59')){_0x2aa724[_0x5748f9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3736dd[_0x4f92('0x57')]+'%',null);}else{_0x5d08a6=_[_0x4f92('0x5d')](_0x93dca3,[_0x4f92('0x29'),_0x4f92('0x65')]);_0x3736dd[_0x4f92('0x40')]='UserId';_0x5b9d87=as[_0x4f92('0x5f')](_0x18faed,_0x5d08a6[_0x4f92('0x35')],_0x3736dd);_0x2aa724[_0x5748f9](_0x5b9d87[_0x4f92('0x60')],_0x5b9d87['value'][_0x4f92('0x61')],_0x5b9d87['value']['end']);}break;case _0x4f92('0x66'):_0x5b9d87=as[_0x4f92('0x5f')]('me',null,_0x3736dd);_0x2aa724[_0x5748f9](_0x5b9d87[_0x4f92('0x60')],_0x5b9d87[_0x4f92('0x57')]['start'],_0x5b9d87[_0x4f92('0x57')][_0x4f92('0x1c')]);break;}}else{var _0x5b9d87=as[_0x4f92('0x5f')](_0x18faed,_0x5d08a6[_0x4f92('0x35')],_0x3736dd);_0x2aa724[_0x5748f9](_0x5b9d87[_0x4f92('0x60')],_0x5b9d87['value'][_0x4f92('0x61')],_0x5b9d87[_0x4f92('0x57')][_0x4f92('0x1c')]);}}}else{var _0x367f68=_(_0x1e6578['query'])[_0x4f92('0x67')]()[_0x4f92('0x33')](function(_0x328206){return _['some'](_0x93dca3,[_0x4f92('0x29'),_0x328206])?_0x328206:undefined;})[_0x4f92('0x68')]()[_0x4f92('0x57')]();if(!_[_0x4f92('0x69')](_0x367f68)){_0x367f68[_0x4f92('0x2f')](function(_0x1498f7){if(_0x1498f7===_0x4f92('0x6a')){_0x11b72d['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x4f92('0x6b')](_0x1e6578['query'][_0x1498f7]));}else if(_0x1498f7==='createdAt'){var _0x1630f1=JSON[_0x4f92('0x6c')](_0x1e6578[_0x4f92('0x37')][_0x1498f7])[_0x4f92('0x6d')];var _0x5ee080=JSON[_0x4f92('0x6c')](_0x1e6578[_0x4f92('0x37')][_0x1498f7])[_0x4f92('0x6e')];_0x11b72d['where'](_0x4f92('0x6f'),_0x1630f1,_0x5ee080);}else{if(_0x1e6578['query'][_0x1498f7]==='null'){_0x11b72d[_0x4f92('0x70')]('i.'+_0x1498f7+_0x4f92('0x71'));}else{_0x11b72d[_0x4f92('0x70')]('i.'+_0x1498f7+_0x4f92('0x72'),_0x1e6578[_0x4f92('0x37')][_0x1498f7]);}}});}if(_0x1e6578[_0x4f92('0x37')]['read']){if(_0x1e6578[_0x4f92('0x37')][_0x4f92('0x73')]==0x1){_0x11b72d['having'](_0x4f92('0x74'));}else{_0x11b72d[_0x4f92('0x75')](_0x4f92('0x76'));}}if(_0x1e6578[_0x4f92('0x37')][_0x4f92('0x77')]){_0x49133d=_['isArray'](_0x1e6578[_0x4f92('0x37')][_0x4f92('0x77')])?_0x1e6578[_0x4f92('0x37')][_0x4f92('0x77')]:new Array(_0x1e6578[_0x4f92('0x37')][_0x4f92('0x77')]);_0x49133d[_0x4f92('0x2f')](function(_0x4a02d7){_0x47e5d3['or'](_0x4f92('0x63'),'%,'+_0x4a02d7+',%');});}if(_0x1e6578[_0x4f92('0x37')][_0x4f92('0x78')]){var _0x3604db=_0x1e6578[_0x4f92('0x37')]['filter'][_0x4f92('0x79')]('\x5c','\x5c\x5c')[_0x4f92('0x79')]('\x27\x27',_0x4f92('0x7a'));if(qs[_0x4f92('0x7b')](_0x3604db)){_0x2aa724['or']('i.id\x20LIKE\x20?',_0x3604db+'%');}else{_0x2aa724['or'](_0x4f92('0x7c'),qs[_0x4f92('0x5b')](_0x3604db))['or'](_0x4f92('0x7d'),_0x3604db+'%')['or'](_0x4f92('0x7e'),_0x3604db+'%');}}}_0x11b72d[_0x4f92('0x70')](_0x2aa724);_0x11b72d[_0x4f92('0x7f')](_0x4f92('0x80'));var _0x4f3b48={'type':db[_0x4f92('0x81')][_0x4f92('0x82')][_0x4f92('0x83')],'raw':!![]};var _0x4d9688=_0x11b72d[_0x4f92('0x84')]();_0x4d9688[_0x4f92('0x40')](_0x4f92('0x80'));_0x4d9688['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4f92('0x56'));if(_0x63604c[_0x4f92('0x3d')]){_0x63604c[_0x4f92('0x3d')][_0x4f92('0x2f')](function(_0x5f03c6){_0x11b72d[_0x4f92('0x3d')]('i.'+_0x5f03c6[0x0],_0x5f03c6[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4f92('0x69')](_0x49133d)){_0x11b72d[_0x4f92('0x75')](_0x47e5d3);_0x4d9688[_0x4f92('0x70')](_0x4f92('0x85'),_0x49133d);}BPromise[_0x4f92('0x86')]()[_0x4f92('0x26')](function(){if(!_0x40231c){if(_0x1e6578[_0x4f92('0x37')][_0x4f92('0x6a')]||_0x1e6578[_0x4f92('0x37')][_0x4f92('0x87')])return;_0x4d9688['where'](_0x4f92('0x88'));_0x11b72d[_0x4f92('0x70')](_0x4f92('0x88'));return;}return _0x1e6578[_0x4f92('0x89')][_0x4f92('0x8a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x101762){if(_['isEmpty'](_0x101762)){_0x4d9688[_0x4f92('0x70')](_0x4f92('0x8b'));_0x11b72d[_0x4f92('0x70')](_0x4f92('0x8b'));}else{_0x4d9688[_0x4f92('0x70')](_0x4f92('0x8c'),_[_0x4f92('0x33')](_0x101762,'id'));_0x11b72d[_0x4f92('0x70')](_0x4f92('0x8c'),_['map'](_0x101762,'id'));}});})['then'](function(){db[_0x4f92('0x8d')][_0x4f92('0x37')](_0x4d9688[_0x4f92('0x8e')](),_0x4f3b48)[_0x4f92('0x26')](function(_0x4ad505){_0x533747[_0x4f92('0x1e')]=_0x4ad505['length'];if(_0x533747[_0x4f92('0x1e')]===0x0)return[];return db[_0x4f92('0x8d')][_0x4f92('0x37')](_0x43afeb[_0x4f92('0x8e')](),_0x4f3b48)[_0x4f92('0x26')](function(_0x36fce2){_0x135ec5=_['keyBy'](_0x36fce2,'id');_0x4f3b48=_[_0x4f92('0x8f')](_0x4f3b48,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e6578['query'][_0x4f92('0x39')]){_0x63604c['attributes'][_0x4f92('0x2f')](function(_0x31b7e3){_0x11b72d[_0x4f92('0x40')]('i.'+_0x31b7e3);});}else{_0x11b72d[_0x4f92('0x40')](_0x4f92('0x90'),_0x4f92('0x56'));_0x11b72d[_0x4f92('0x40')](_0x4f92('0x91'),_0x4f92('0x92'));_0x11b72d['field']('a.mandatoryDisposition',_0x4f92('0x93'));_0x11b72d['field'](_0x4f92('0x94'));_0x11b72d[_0x4f92('0x40')](_0x4f92('0x95'),'Contact.firstName');_0x11b72d[_0x4f92('0x40')]('c.lastName',_0x4f92('0x96'));_0x11b72d[_0x4f92('0x40')](_0x4f92('0x97'),_0x4f92('0x98'));_0x11b72d['field'](_0x4f92('0x99'),_0x4f92('0x9a'));_0x11b72d[_0x4f92('0x40')](_0x4f92('0x9b'),_0x4f92('0x9c'));_0x11b72d['field']('c.fax',_0x4f92('0x9d'));_0x11b72d[_0x4f92('0x40')](_0x4f92('0x9e'),_0x4f92('0x9f'));_0x11b72d[_0x4f92('0x40')](_0x4f92('0xa0'),_0x4f92('0xa1'));_0x11b72d[_0x4f92('0x40')](_0x4f92('0xa2'),_0x4f92('0x2d'));}if(_0x63604c[_0x4f92('0x20')])_0x11b72d[_0x4f92('0x20')](_0x63604c[_0x4f92('0x20')]);if(_0x63604c[_0x4f92('0x1f')])_0x11b72d[_0x4f92('0x1f')](_0x63604c['offset']);return db[_0x4f92('0x8d')][_0x4f92('0x37')](_0x11b72d[_0x4f92('0x8e')](),_0x4f3b48);})[_0x4f92('0x26')](function(_0x196cd1){_0x1c2352[_0x4f92('0x70')](_0x4f92('0xa3'),_['map'](_0x196cd1,'id'));return db[_0x4f92('0x8d')][_0x4f92('0x37')](_0x1c2352[_0x4f92('0x8e')](),_0x4f3b48)['then'](function(_0x5719cd){var _0x118400=_[_0x4f92('0xa4')](_0x5719cd,_0x4f92('0xa5'));var _0x19ef98=[];_0x196cd1[_0x4f92('0x2f')](function(_0x1cc165){_0x19ef98[_0x4f92('0xa6')](updateOpenchannelInteraction(_0x1cc165,_0x135ec5,_0x118400));});return BPromise[_0x4f92('0xa7')](_0x19ef98);});});})['then'](function(_0xcfedff){_0x533747[_0x4f92('0xa8')]=_0xcfedff;return _0x533747;})[_0x4f92('0x26')](respondWithFilteredResult(_0x5ea0dc,_0x63604c));})[_0x4f92('0x31')](handleError(_0x5ea0dc,null));};exports[_0x4f92('0xa9')]=function(_0x1ebe12,_0x585eb0){var _0x3bb34e={'raw':![],'where':{'id':_0x1ebe12[_0x4f92('0xaa')]['id']}},_0x44995f={};_0x44995f[_0x4f92('0x36')]=_[_0x4f92('0x67')](db[_0x4f92('0xab')][_0x4f92('0x34')]);_0x44995f[_0x4f92('0x37')]=_[_0x4f92('0x67')](_0x1ebe12[_0x4f92('0x37')]);_0x44995f[_0x4f92('0xac')]=_[_0x4f92('0x38')](_0x44995f[_0x4f92('0x36')],_0x44995f[_0x4f92('0x37')]);_0x3bb34e[_0x4f92('0x3a')]=_['intersection'](_0x44995f[_0x4f92('0x36')],qs[_0x4f92('0x39')](_0x1ebe12[_0x4f92('0x37')][_0x4f92('0x39')]));_0x3bb34e['attributes']=_0x3bb34e[_0x4f92('0x3a')][_0x4f92('0x3b')]?_0x3bb34e[_0x4f92('0x3a')]:_0x44995f['model'];if(_0x1ebe12[_0x4f92('0x37')]['includeAll']){_0x3bb34e[_0x4f92('0xad')]=[{'all':!![]}];}_0x3bb34e=_[_0x4f92('0x8f')]({},_0x3bb34e,_0x1ebe12[_0x4f92('0xae')]);return db['OpenchannelInteraction'][_0x4f92('0x5d')](_0x3bb34e)['then'](handleEntityNotFound(_0x585eb0,null))[_0x4f92('0x26')](respondWithResult(_0x585eb0,null))[_0x4f92('0x31')](handleError(_0x585eb0,null));};exports[_0x4f92('0xaf')]=function(_0x337d76,_0x444e69){return db['OpenchannelInteraction'][_0x4f92('0xaf')](_0x337d76[_0x4f92('0x66')],{})['then'](respondWithResult(_0x444e69,0xc9))[_0x4f92('0x31')](handleError(_0x444e69,null));};exports[_0x4f92('0x25')]=function(_0x488e8d,_0x13220d){if(_0x488e8d['body']['id']){delete _0x488e8d[_0x4f92('0x66')]['id'];}return db[_0x4f92('0xab')][_0x4f92('0x5d')]({'where':{'id':_0x488e8d[_0x4f92('0xaa')]['id']}})[_0x4f92('0x26')](handleEntityNotFound(_0x13220d,null))[_0x4f92('0x26')](saveUpdates(_0x488e8d['body'],null))[_0x4f92('0x26')](respondWithResult(_0x13220d,null))[_0x4f92('0x31')](handleError(_0x13220d,null));};exports['destroy']=function(_0x4b84e4,_0x15a410){return db['OpenchannelInteraction'][_0x4f92('0x5d')]({'where':{'id':_0x4b84e4[_0x4f92('0xaa')]['id']}})[_0x4f92('0x26')](handleEntityNotFound(_0x15a410,null))[_0x4f92('0x26')](removeEntity(_0x15a410,null))['catch'](handleError(_0x15a410,null));};exports['describe']=function(_0x3598b4,_0x11cf54){return db[_0x4f92('0xab')][_0x4f92('0xb0')]()[_0x4f92('0x26')](respondWithResult(_0x11cf54,null))[_0x4f92('0x31')](handleError(_0x11cf54,null));};exports[_0x4f92('0xb1')]=function(_0x2da242,_0x57ad2e,_0x35cc3c){return db['OpenchannelMessage']['find']({'where':{'id':_0x2da242[_0x4f92('0xaa')]['id']}})[_0x4f92('0x26')](handleEntityNotFound(_0x57ad2e,null))[_0x4f92('0x26')](function(_0x19ae1c){if(_0x19ae1c){return _0x19ae1c[_0x4f92('0xb1')](_0x2da242[_0x4f92('0x66')][_0x4f92('0xb2')],_[_0x4f92('0xb3')](_0x2da242[_0x4f92('0x66')],[_0x4f92('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x57ad2e,null))[_0x4f92('0x31')](handleError(_0x57ad2e,null));};exports['getMessages']=function(_0x159e75,_0x38aa36,_0x4a35ad){var _0x3324f2={'raw':![],'where':{}};var _0x44ae39={};var _0x48ab33={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x4f92('0xb4')]({'where':{'id':_0x159e75['params']['id']}})[_0x4f92('0x26')](handleEntityNotFound(_0x38aa36,null))['then'](function(_0x1e218f){if(_0x1e218f){_0x44ae39[_0x4f92('0x36')]=_[_0x4f92('0x67')](db[_0x4f92('0xb5')]['rawAttributes']);_0x44ae39[_0x4f92('0x37')]=_['keys'](_0x159e75[_0x4f92('0x37')]);_0x44ae39[_0x4f92('0xac')]=_[_0x4f92('0x38')](_0x44ae39[_0x4f92('0x36')],_0x44ae39[_0x4f92('0x37')]);_0x3324f2[_0x4f92('0x3a')]=_['intersection'](_0x44ae39[_0x4f92('0x36')],qs[_0x4f92('0x39')](_0x159e75[_0x4f92('0x37')][_0x4f92('0x39')]));_0x3324f2[_0x4f92('0x3a')]=_0x3324f2[_0x4f92('0x3a')]['length']?_0x3324f2[_0x4f92('0x3a')]:_0x44ae39[_0x4f92('0x36')];if(!_0x159e75[_0x4f92('0x37')][_0x4f92('0x3c')](_0x4f92('0xb6'))){_0x3324f2[_0x4f92('0x20')]=qs[_0x4f92('0x20')](_0x159e75[_0x4f92('0x37')][_0x4f92('0x20')]);_0x3324f2[_0x4f92('0x1f')]=qs[_0x4f92('0x1f')](_0x159e75[_0x4f92('0x37')][_0x4f92('0x1f')]);}_0x3324f2[_0x4f92('0x3d')]=qs[_0x4f92('0x3e')](_0x159e75[_0x4f92('0x37')][_0x4f92('0x3e')]);_0x3324f2[_0x4f92('0x70')]=qs[_0x4f92('0xac')](_[_0x4f92('0x3f')](_0x159e75['query'],_0x44ae39[_0x4f92('0xac')]));_0x3324f2[_0x4f92('0x70')]['OpenchannelInteractionId']=_0x1e218f['id'];if(_0x159e75['query']['filter']){_0x3324f2[_0x4f92('0x70')]=_[_0x4f92('0x8f')](_0x3324f2[_0x4f92('0x70')],{'$or':_[_0x4f92('0x33')](_0x3324f2[_0x4f92('0x3a')],function(_0x2e1589){var _0x439b03={};_0x439b03[_0x2e1589]={'$like':'%'+_0x159e75[_0x4f92('0x37')][_0x4f92('0x78')]+'%'};return _0x439b03;})});}if(_0x159e75[_0x4f92('0x37')][_0x4f92('0x6d')]){var _0x4b95a9=_0x159e75[_0x4f92('0x37')]['$gte'][_0x4f92('0x2e')](',');var _0x26adb5={};_0x26adb5[_0x4b95a9[0x0]]={'$gte':moment(_0x4b95a9[0x1])['format'](_0x4f92('0xb7'))};_0x3324f2['where']=_[_0x4f92('0x8f')](_0x3324f2[_0x4f92('0x70')],_0x26adb5);}_0x3324f2=_[_0x4f92('0x8f')]({},_0x3324f2,_0x159e75['options']);return db['OpenchannelMessage'][_0x4f92('0x1e')]({'where':_0x3324f2[_0x4f92('0x70')]})['then'](function(_0x134865){_0x48ab33['count']=_0x134865;if(_0x159e75[_0x4f92('0x37')][_0x4f92('0xb8')]){_0x3324f2[_0x4f92('0xad')]=[{'all':!![]}];}return db[_0x4f92('0xb5')][_0x4f92('0xb9')](_0x3324f2);})[_0x4f92('0x26')](function(_0x4c14be){_0x48ab33['rows']=_0x4c14be;return _0x48ab33;});}})['then'](respondWithFilteredResult(_0x38aa36,_0x3324f2))[_0x4f92('0x31')](handleError(_0x38aa36,null));};exports[_0x4f92('0xba')]=function(_0x2787fb,_0x7d9fe2,_0x30252c){return db['OpenchannelInteraction'][_0x4f92('0x5d')]({'where':{'id':_0x2787fb[_0x4f92('0xaa')]['id']}})[_0x4f92('0x26')](handleEntityNotFound(_0x7d9fe2,null))[_0x4f92('0x26')](function(_0x5708f4){if(_0x5708f4){return _0x5708f4[_0x4f92('0xbb')](_0x2787fb['body'][_0x4f92('0xb2')],_[_0x4f92('0xb3')](_0x2787fb[_0x4f92('0x66')],['ids','id'])||{})[_0x4f92('0xbc')](function(){return db['Tag'][_0x4f92('0xb9')]({'attributes':['id',_0x4f92('0x29'),_0x4f92('0x41')],'where':{'id':_0x2787fb[_0x4f92('0x66')][_0x4f92('0xb2')]}});})['then'](function(_0x39f25a){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x2787fb[_0x4f92('0xaa')]['id']),'tags':_0x39f25a||[]});return{'id':Number(_0x2787fb[_0x4f92('0xaa')]['id']),'tags':_0x39f25a||[]};});}})[_0x4f92('0x26')](respondWithResult(_0x7d9fe2,null))[_0x4f92('0x31')](handleError(_0x7d9fe2,null));};exports[_0x4f92('0xbd')]=function(_0x18c5fb,_0x44d639,_0x4125d2){return db[_0x4f92('0xab')]['find']({'where':{'id':_0x18c5fb['params']['id']}})[_0x4f92('0x26')](handleEntityNotFound(_0x44d639,null))['then'](function(_0x111e1b){if(_0x111e1b){return _0x111e1b['removeTags'](_0x18c5fb[_0x4f92('0x37')][_0x4f92('0xb2')]);}})[_0x4f92('0x26')](respondWithStatusCode(_0x44d639,null))[_0x4f92('0x31')](handleError(_0x44d639,null));};exports[_0x4f92('0xbe')]=function(_0x47bd6b,_0x32cd28){var _0x5e2954=moment()[_0x4f92('0xbf')]()[_0x4f92('0x8e')]();var _0x5aedd6=path[_0x4f92('0xc0')](config[_0x4f92('0xc1')],_0x4f92('0xc2'),'files',_0x4f92('0xc3'));var _0xcd335e=path[_0x4f92('0xc0')](config['root'],'server',_0x4f92('0xc4'),_0x4f92('0xc5'));var _0xe6e73c=path[_0x4f92('0xc0')](_0x5aedd6,_0x5e2954);var _0x16d9c8=util['format']('transcript-%d-%s.zip',_0x47bd6b[_0x4f92('0xaa')]['id'],_0x5e2954);var _0x5a33d0=path[_0x4f92('0xc0')](_0x5aedd6,_0x16d9c8);var _0x33929c=[];_0x33929c[_0x4f92('0xa6')]({'model':db[_0x4f92('0xc6')],'as':_0x4f92('0xc6'),'attributes':['id',_0x4f92('0x2c')],'raw':!![]});_0x33929c[_0x4f92('0xa6')]({'model':db[_0x4f92('0xc7')],'as':_0x4f92('0xc8'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x47bd6b[_0x4f92('0x37')][_0x4f92('0xc5')]){_0x33929c[_0x4f92('0xa6')]({'model':db[_0x4f92('0xc9')],'as':'Attachment','raw':!![]});}var _0x41e49f=[{'model':db[_0x4f92('0xb5')],'as':'Messages','attributes':['id',_0x4f92('0x66'),_0x4f92('0xca'),'direction',_0x4f92('0xcb'),'read'],'include':_0x33929c}];_0x41e49f[_0x4f92('0xa6')]({'model':db[_0x4f92('0xcc')],'as':_0x4f92('0xcd'),'attributes':['id','name']});_0x41e49f['push']({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x4f92('0xab')][_0x4f92('0x5d')]({'where':{'id':_0x47bd6b[_0x4f92('0xaa')]['id']},'include':_0x41e49f})[_0x4f92('0x26')](handleEntityNotFound(_0x32cd28,null))['then'](function(_0x2a1364){if(_0x2a1364){var _0x24393e=_0x2a1364[_0x4f92('0xce')]({'plain':!![]});fs['mkdirSync'](_0xe6e73c);var _0x354ec0={'format':'A4','border':_0x4f92('0xcf'),'header':{'height':_0x4f92('0xd0'),'contents':{'first':_0x4f92('0xd1')}},'footer':{'height':'30px','contents':{'default':util['format'](_0x4f92('0xd2'),util[_0x4f92('0xd3')](_0x4f92('0xd4'),_0x4f92('0xd5'),_0x24393e['id']),moment()[_0x4f92('0xd3')](_0x4f92('0xd6'))[_0x4f92('0x8e')]())}}};var _0x1202ae={'channel':_0x4f92('0xd5'),'account':_0x24393e[_0x4f92('0xcd')][_0x4f92('0x29')],'agent':_0x24393e[_0x4f92('0xd7')]?_0x24393e['Owner'][_0x4f92('0x2c')]:_0x4f92('0xd8'),'createdAt':moment(_0x24393e['createdAt'])[_0x4f92('0xd3')](_0x4f92('0xb7'))[_0x4f92('0x8e')](),'closedAt':_0x24393e[_0x4f92('0xd9')]?moment(_0x24393e[_0x4f92('0xda')])['format'](_0x4f92('0xb7'))[_0x4f92('0x8e')]():'','disposition':_0x24393e[_0x4f92('0xdb')],'visibility':_0x24393e['threadId']?_0x4f92('0xdc'):_0x4f92('0xdd'),'messages':_(_0x24393e['Messages'])[_0x4f92('0x78')]({'secret':![]})[_0x4f92('0x33')](function(_0x51f011){if(_0x51f011[_0x4f92('0xc9')]){var _0x574a57=path[_0x4f92('0xc0')](_0xcd335e,_0x51f011[_0x4f92('0xc9')][_0x4f92('0xde')]);if(fs['existsSync'](_0x574a57)){fs[_0x4f92('0xdf')](_0x574a57)[_0x4f92('0xe0')](fs[_0x4f92('0xe1')](path[_0x4f92('0xc0')](_0xe6e73c,_0x51f011[_0x4f92('0xc9')][_0x4f92('0xde')])));}}return{'date':moment(_0x51f011[_0x4f92('0xca')])[_0x4f92('0xd3')](_0x4f92('0xb7'))[_0x4f92('0x8e')](),'sender':_0x51f011[_0x4f92('0xe2')]===_0x4f92('0xe3')?_0x51f011[_0x4f92('0xc6')]?_0x51f011[_0x4f92('0xc6')][_0x4f92('0x2c')]:_0x4f92('0xe4'):_0x51f011['Contact'][_0x4f92('0xe5')]+(_0x51f011[_0x4f92('0xc8')][_0x4f92('0xe6')]?'\x20'+_0x51f011[_0x4f92('0xc8')][_0x4f92('0xe6')]:''),'body':_0x51f011[_0x4f92('0xc9')]?_0x51f011[_0x4f92('0xc9')][_0x4f92('0xde')]:_0x51f011[_0x4f92('0x66')],'direction':_0x51f011[_0x4f92('0xe2')]===_0x4f92('0xe3')?'A':'C','secret':_0x51f011['secret'],'read':_0x51f011[_0x4f92('0x73')],'attachment':_0x51f011[_0x4f92('0xc9')]};})['value']()};return ejs[_0x4f92('0xe7')](path['join'](config['root'],_0x4f92('0xc2'),_0x4f92('0xe8'),_0x4f92('0xe9')),{'interaction':_0x1202ae})[_0x4f92('0x26')](function(_0x5de7ba){return new BPromise(function(_0x47b18e,_0x417365){pdf[_0x4f92('0xaf')](_0x5de7ba,_0x354ec0)[_0x4f92('0xea')](path[_0x4f92('0xc0')](_0xe6e73c,'transcript-'+_0x24393e['id']+'-'+_0x5e2954+'.pdf'),function(_0x41dc9c,_0x347419){if(_0x41dc9c)return _0x417365(_0x41dc9c);_0x47b18e(_0x347419);});});})[_0x4f92('0x26')](function(){return new BPromise(function(_0x4336eb,_0x322fcf){zipdir(_0xe6e73c,{'saveTo':_0x5a33d0},function(_0x2d7c33,_0x403084){if(_0x2d7c33)return _0x322fcf(_0x2d7c33);return _0x4336eb(_0x403084);});})[_0x4f92('0x26')](function(){return new BPromise(function(_0x85a692,_0x2f61ce){rimraf(_0xe6e73c,function(_0x5e2d4b){if(_0x5e2d4b)_0x2f61ce(_0x5e2d4b);return _0x85a692();});});})['then'](function(){return _0x32cd28[_0x4f92('0xbe')](_0x5a33d0,_0x16d9c8,function(_0x4561db){if(_0x4561db){console[_0x4f92('0xeb')](_0x4f92('0xec'),_0x4561db);}else{fs[_0x4f92('0xed')](_0x5a33d0);}});});});}else{return _0x32cd28[_0x4f92('0x27')](0xc8);}})[_0x4f92('0x31')](handleError(_0x32cd28,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 51d51c4..cb45550 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 _0x2c52=['then','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x2c52,0x15d));var _0x22c5=function(_0x3da905,_0x564277){_0x3da905=_0x3da905-0x0;var _0x3522cf=_0x2c52[_0x3da905];return _0x3522cf;};'use strict';var EventEmitter=require(_0x22c5('0x0'));var OpenchannelInteraction=require(_0x22c5('0x1'))['db'][_0x22c5('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x22c5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x22c5('0x4')](0x0);var events={'afterCreate':_0x22c5('0x5'),'afterUpdate':'update','afterDestroy':_0x22c5('0x6')};function emitEvent(_0x4152ee){return function(_0xe25269,_0x172ee3,_0x52bebb){_0xe25269[_0x22c5('0x7')]({'attributes':['id'],'raw':!![]})[_0x22c5('0x8')](function(_0x3d44ff){_0xe25269[_0x22c5('0x9')]('Users',_0x3d44ff[_0x22c5('0xa')](function(_0x51f9ff){return{'id':_0x51f9ff['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xe25269['id'],'direction':'in','read':![]},'raw':!![]});})[_0x22c5('0x8')](function(_0x2a89ab){_0xe25269[_0x22c5('0x9')](_0x22c5('0xb'),_0x2a89ab[_0x22c5('0xc')]);OpenchannelInteractionEvents[_0x22c5('0xd')](_0x4152ee+':'+_0xe25269['id'],_0xe25269);OpenchannelInteractionEvents[_0x22c5('0xd')](_0x4152ee,_0xe25269);_0x52bebb(null);})[_0x22c5('0xe')](_0x52bebb(null));};}for(var e in events){if(events[_0x22c5('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x22c5('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x23f2=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x23f2,0x137));var _0x223f=function(_0x1116ef,_0x225946){_0x1116ef=_0x1116ef-0x0;var _0x2af2cc=_0x23f2[_0x1116ef];return _0x2af2cc;};'use strict';var EventEmitter=require(_0x223f('0x0'));var OpenchannelInteraction=require(_0x223f('0x1'))['db'][_0x223f('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x223f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x223f('0x4')](0x0);var events={'afterCreate':_0x223f('0x5'),'afterUpdate':_0x223f('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2c0e54){return function(_0x90e5b2,_0x5c1884,_0x386c37){_0x90e5b2['getUsers']({'attributes':['id'],'raw':!![]})[_0x223f('0x7')](function(_0x375f4b){_0x90e5b2[_0x223f('0x8')](_0x223f('0x9'),_0x375f4b[_0x223f('0xa')](function(_0x3a0cb8){return{'id':_0x3a0cb8['id']};}));return OpenchannelMessage[_0x223f('0xb')]({'where':{'OpenchannelInteractionId':_0x90e5b2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x223f('0x7')](function(_0x24229c){_0x90e5b2['setDataValue'](_0x223f('0xc'),_0x24229c[_0x223f('0xd')]);OpenchannelInteractionEvents[_0x223f('0xe')](_0x2c0e54+':'+_0x90e5b2['id'],_0x90e5b2);OpenchannelInteractionEvents[_0x223f('0xe')](_0x2c0e54,_0x90e5b2);_0x386c37(null);})[_0x223f('0xf')](_0x386c37(null));};}for(var e in events){if(events[_0x223f('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x223f('0x11')](e,emitEvent(event));}}module[_0x223f('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index cd2dbe3..47e73f5 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 _0xf406=['bluebird','request-promise','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','format','lodash','util','../../config/logger','api','moment'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xf406,0x19f));var _0x6f40=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0xf406[_0x24c135];return _0x290c66;};'use strict';var _=require(_0x6f40('0x0'));var util=require(_0x6f40('0x1'));var logger=require(_0x6f40('0x2'))(_0x6f40('0x3'));var moment=require(_0x6f40('0x4'));var BPromise=require(_0x6f40('0x5'));var rp=require(_0x6f40('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f40('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x6f40('0x8')]=function(_0x4c9fc5,_0x274dbb){return _0x4c9fc5[_0x6f40('0x9')](_0x6f40('0xa'),attributes,{'tableName':_0x6f40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dafe2,_0x47fcad,_0x2f9207){if(_0x1dafe2['changed'](_0x6f40('0xc'))){_0x1dafe2[_0x6f40('0xd')]=moment()[_0x6f40('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2f9207(null,_0x1dafe2);}}});}; \ No newline at end of file +var _0x31fd=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','format'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x31fd,0x121));var _0xd31f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x31fd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd31f('0x0'));var util=require(_0xd31f('0x1'));var logger=require('../../config/logger')(_0xd31f('0x2'));var moment=require(_0xd31f('0x3'));var BPromise=require(_0xd31f('0x4'));var rp=require(_0xd31f('0x5'));var fs=require('fs');var path=require(_0xd31f('0x6'));var rimraf=require(_0xd31f('0x7'));var config=require(_0xd31f('0x8'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x1dd5e2,_0x3b880d){return _0x1dd5e2[_0xd31f('0x9')](_0xd31f('0xa'),attributes,{'tableName':_0xd31f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3921b2,_0x53a068,_0x10a80f){if(_0x3921b2['changed'](_0xd31f('0xc'))){_0x3921b2[_0xd31f('0xd')]=moment()[_0xd31f('0xe')](_0xd31f('0xf'));}_0x10a80f(null,_0x3921b2);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index db49a6a..7082cc3 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 _0x0ba5=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','update','body','options','raw','where','limit','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','then','addTags','ids','omit','spread','AddTags'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0ba5,0x140));var _0x50ba=function(_0x3897ed,_0x19d57f){_0x3897ed=_0x3897ed-0x0;var _0x4f738f=_0x0ba5[_0x3897ed];return _0x4f738f;};'use strict';var _=require(_0x50ba('0x0'));var util=require(_0x50ba('0x1'));var moment=require(_0x50ba('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x50ba('0x4'));var logger=require(_0x50ba('0x5'))(_0x50ba('0x6'));var config=require('../../config/environment');var jayson=require(_0x50ba('0x7'));var client=jayson[_0x50ba('0x8')][_0x50ba('0x9')]({'port':0x232a});config[_0x50ba('0xa')]=_[_0x50ba('0xb')](config[_0x50ba('0xa')],{'host':_0x50ba('0xc'),'port':0x18eb});var socket=require(_0x50ba('0xd'))(new Redis(config[_0x50ba('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4249b2,_0x31974c,_0xc04ee5){return new BPromise(function(_0x3f08b5,_0x1eb906){return client[_0x50ba('0xe')](_0x4249b2,_0xc04ee5)['then'](function(_0x255bcc){logger[_0x50ba('0xf')](_0x50ba('0x10'),_0x31974c,_0x50ba('0x11'));logger[_0x50ba('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x31974c,_0x50ba('0x11'),JSON[_0x50ba('0x13')](_0x255bcc));if(_0x255bcc['error']){if(_0x255bcc[_0x50ba('0x14')]['code']===0x1f4){logger[_0x50ba('0x14')](_0x50ba('0x10'),_0x31974c,_0x255bcc['error']['message']);return _0x1eb906(_0x255bcc[_0x50ba('0x14')][_0x50ba('0x15')]);}logger[_0x50ba('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x31974c,_0x255bcc[_0x50ba('0x14')]['message']);return _0x3f08b5(_0x255bcc[_0x50ba('0x14')][_0x50ba('0x15')]);}else{logger[_0x50ba('0xf')](_0x50ba('0x10'),_0x31974c,_0x50ba('0x11'));_0x3f08b5(_0x255bcc[_0x50ba('0x16')][_0x50ba('0x15')]);}})['catch'](function(_0x5661bf){logger[_0x50ba('0x14')](_0x50ba('0x10'),_0x31974c,_0x5661bf);_0x1eb906(_0x5661bf);});});}exports['UpdateOpenchannelInteraction']=function(_0x5e9831){var _0x2b9178=this;return new Promise(function(_0x2cedd6,_0x837f2d){return db['OpenchannelInteraction'][_0x50ba('0x17')](_0x5e9831[_0x50ba('0x18')],{'raw':_0x5e9831[_0x50ba('0x19')]?_0x5e9831[_0x50ba('0x19')][_0x50ba('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e9831[_0x50ba('0x19')]?_0x5e9831[_0x50ba('0x19')][_0x50ba('0x1b')]||null:null,'attributes':_0x5e9831[_0x50ba('0x19')]?_0x5e9831['options']['attributes']||null:null,'limit':_0x5e9831[_0x50ba('0x19')]?_0x5e9831[_0x50ba('0x19')][_0x50ba('0x1c')]||null:null})['then'](function(_0x3a5b64){logger[_0x50ba('0xf')](_0x50ba('0x1d'),_0x5e9831);logger[_0x50ba('0x12')]('UpdateOpenchannelInteraction',_0x5e9831,JSON[_0x50ba('0x13')](_0x3a5b64));_0x2cedd6(_0x3a5b64);})[_0x50ba('0x1e')](function(_0x3866cb){logger[_0x50ba('0x14')](_0x50ba('0x1d'),_0x3866cb[_0x50ba('0x15')],_0x5e9831);_0x837f2d(_0x2b9178[_0x50ba('0x14')](0x1f4,_0x3866cb['message']));});});};exports[_0x50ba('0x1f')]=function(_0xc37098){return new Promise(function(_0x3fb025,_0x488531){return db[_0x50ba('0x20')][_0x50ba('0x21')]({'where':_0xc37098[_0x50ba('0x19')]?_0xc37098[_0x50ba('0x19')][_0x50ba('0x1b')]||null:null})[_0x50ba('0x22')](function(_0x29b28b){if(_0x29b28b){return _0x29b28b[_0x50ba('0x23')](_0xc37098[_0x50ba('0x18')][_0x50ba('0x24')],_[_0x50ba('0x25')](_0xc37098['body'],['ids','id'])||{});}})[_0x50ba('0x26')](function(_0x33ce6d){logger[_0x50ba('0xf')]('AddTags',_0xc37098);logger[_0x50ba('0x12')](_0x50ba('0x27'),_0xc37098,JSON[_0x50ba('0x13')](_0x33ce6d));_0x3fb025(_0x33ce6d);})[_0x50ba('0x1e')](function(_0x48de82){logger[_0x50ba('0x14')](_0x50ba('0x27'),_0x48de82[_0x50ba('0x15')],_0xc37098);_0x488531(_this[_0x50ba('0x14')](0x1f4,_0x48de82['message']));});});}; \ No newline at end of file +var _0xd032=['socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','where','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x5d282e,_0x39dead){var _0x237f0e=function(_0x28447e){while(--_0x28447e){_0x5d282e['push'](_0x5d282e['shift']());}};_0x237f0e(++_0x39dead);}(_0xd032,0x1f4));var _0x2d03=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xd032[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x2d03('0x0'));var util=require(_0x2d03('0x1'));var moment=require(_0x2d03('0x2'));var BPromise=require(_0x2d03('0x3'));var rs=require(_0x2d03('0x4'));var fs=require('fs');var Redis=require(_0x2d03('0x5'));var db=require(_0x2d03('0x6'))['db'];var utils=require(_0x2d03('0x7'));var logger=require(_0x2d03('0x8'))(_0x2d03('0x9'));var config=require(_0x2d03('0xa'));var jayson=require(_0x2d03('0xb'));var client=jayson[_0x2d03('0xc')][_0x2d03('0xd')]({'port':0x232a});config[_0x2d03('0xe')]=_[_0x2d03('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2d03('0x10'))(new Redis(config['redis']));require(_0x2d03('0x11'))[_0x2d03('0x12')](socket);function respondWithRpcPromise(_0x5d2c05,_0x55fca5,_0x1c1f2a){return new BPromise(function(_0x5508fb,_0x3d6c23){return client['request'](_0x5d2c05,_0x1c1f2a)[_0x2d03('0x13')](function(_0x5ab395){logger[_0x2d03('0x14')](_0x2d03('0x15'),_0x55fca5,_0x2d03('0x16'));logger[_0x2d03('0x17')](_0x2d03('0x18'),_0x55fca5,'request\x20sent',JSON[_0x2d03('0x19')](_0x5ab395));if(_0x5ab395[_0x2d03('0x1a')]){if(_0x5ab395[_0x2d03('0x1a')][_0x2d03('0x1b')]===0x1f4){logger[_0x2d03('0x1a')](_0x2d03('0x15'),_0x55fca5,_0x5ab395[_0x2d03('0x1a')][_0x2d03('0x1c')]);return _0x3d6c23(_0x5ab395[_0x2d03('0x1a')][_0x2d03('0x1c')]);}logger[_0x2d03('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x55fca5,_0x5ab395['error'][_0x2d03('0x1c')]);return _0x5508fb(_0x5ab395[_0x2d03('0x1a')][_0x2d03('0x1c')]);}else{logger[_0x2d03('0x14')](_0x2d03('0x15'),_0x55fca5,_0x2d03('0x16'));_0x5508fb(_0x5ab395[_0x2d03('0x1d')]['message']);}})[_0x2d03('0x1e')](function(_0x2a6dce){logger[_0x2d03('0x1a')](_0x2d03('0x15'),_0x55fca5,_0x2a6dce);_0x3d6c23(_0x2a6dce);});});}exports[_0x2d03('0x1f')]=function(_0x396133){var _0x26805c=this;return new Promise(function(_0x1d911b,_0x3eedb3){return db['OpenchannelInteraction'][_0x2d03('0x20')](_0x396133[_0x2d03('0x21')],{'raw':_0x396133['options']?_0x396133[_0x2d03('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x396133[_0x2d03('0x22')]?_0x396133[_0x2d03('0x22')][_0x2d03('0x23')]||null:null,'attributes':_0x396133[_0x2d03('0x22')]?_0x396133[_0x2d03('0x22')]['attributes']||null:null,'limit':_0x396133[_0x2d03('0x22')]?_0x396133[_0x2d03('0x22')][_0x2d03('0x24')]||null:null})[_0x2d03('0x13')](function(_0x1754ae){logger[_0x2d03('0x14')](_0x2d03('0x1f'),_0x396133);logger[_0x2d03('0x17')]('UpdateOpenchannelInteraction',_0x396133,JSON['stringify'](_0x1754ae));_0x1d911b(_0x1754ae);})['catch'](function(_0x23a9d3){logger[_0x2d03('0x1a')](_0x2d03('0x1f'),_0x23a9d3[_0x2d03('0x1c')],_0x396133);_0x3eedb3(_0x26805c['error'](0x1f4,_0x23a9d3[_0x2d03('0x1c')]));});});};exports[_0x2d03('0x25')]=function(_0x429bde){return new Promise(function(_0x7b3ec3,_0xcd154d){return db[_0x2d03('0x26')][_0x2d03('0x27')]({'where':_0x429bde['options']?_0x429bde[_0x2d03('0x22')][_0x2d03('0x23')]||null:null})[_0x2d03('0x13')](function(_0x459376){if(_0x459376){return _0x459376[_0x2d03('0x28')](_0x429bde[_0x2d03('0x21')][_0x2d03('0x29')],_['omit'](_0x429bde[_0x2d03('0x21')],[_0x2d03('0x29'),'id'])||{});}})['spread'](function(_0x17128c){logger['info'](_0x2d03('0x2a'),_0x429bde);logger['debug'](_0x2d03('0x2a'),_0x429bde,JSON[_0x2d03('0x19')](_0x17128c));_0x7b3ec3(_0x17128c);})[_0x2d03('0x1e')](function(_0x5d9dd5){logger[_0x2d03('0x1a')]('AddTags',_0x5d9dd5[_0x2d03('0x1c')],_0x429bde);_0xcd154d(_this[_0x2d03('0x1a')](0x1f4,_0x5d9dd5[_0x2d03('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c93c97a..f369e1c 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 _0xea0d=['update','emit','removeListener','length','./openchannelInteraction.events','save'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xea0d,0x11e));var _0xdea0=function(_0x3d8776,_0x5305dc){_0x3d8776=_0x3d8776-0x0;var _0x51d331=_0xea0d[_0x3d8776];return _0x51d331;};'use strict';var OpenchannelInteractionEvents=require(_0xdea0('0x0'));var events=[_0xdea0('0x1'),'remove',_0xdea0('0x2')];function createListener(_0x29b86c,_0x256a72){return function(_0x465302){_0x256a72[_0xdea0('0x3')](_0x29b86c,_0x465302);};}function removeListener(_0x1f28e8,_0x4df070){return function(){OpenchannelInteractionEvents[_0xdea0('0x4')](_0x1f28e8,_0x4df070);};}exports['register']=function(_0x308937){for(var _0x150dda=0x0,_0x3db2ef=events[_0xdea0('0x5')];_0x150dda<_0x3db2ef;_0x150dda++){var _0x4de9a7=events[_0x150dda];var _0x1eff81=createListener('openchannelInteraction:'+_0x4de9a7,_0x308937);OpenchannelInteractionEvents['on'](_0x4de9a7,_0x1eff81);}}; \ No newline at end of file +var _0x2cec=['emit','length','./openchannelInteraction.events','save','remove','update'];(function(_0xf1196,_0x295b06){var _0x4cc7d1=function(_0x6b917b){while(--_0x6b917b){_0xf1196['push'](_0xf1196['shift']());}};_0x4cc7d1(++_0x295b06);}(_0x2cec,0x1dc));var _0xc2ce=function(_0x11e1c8,_0x4d15c6){_0x11e1c8=_0x11e1c8-0x0;var _0x20fa74=_0x2cec[_0x11e1c8];return _0x20fa74;};'use strict';var OpenchannelInteractionEvents=require(_0xc2ce('0x0'));var events=[_0xc2ce('0x1'),_0xc2ce('0x2'),_0xc2ce('0x3')];function createListener(_0x214264,_0x50bc16){return function(_0x1b2b96){_0x50bc16[_0xc2ce('0x4')](_0x214264,_0x1b2b96);};}function removeListener(_0x1a1ac6,_0x10a78a){return function(){OpenchannelInteractionEvents['removeListener'](_0x1a1ac6,_0x10a78a);};}exports['register']=function(_0x259c92){for(var _0x20db04=0x0,_0x931769=events[_0xc2ce('0x5')];_0x20db04<_0x931769;_0x20db04++){var _0x56e77f=events[_0x20db04];var _0x4206c0=createListener('openchannelInteraction:'+_0x56e77f,_0x259c92);OpenchannelInteractionEvents['on'](_0x56e77f,_0x4206c0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f8d4121..ed2fe24 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 _0xc320=['/:id/reject','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','post','tracked','openchannel','openchannelmessage:create','create','put','update','/:id/accept','accept'];(function(_0x2f73a8,_0xa25748){var _0x155b1f=function(_0x1ddbe8){while(--_0x1ddbe8){_0x2f73a8['push'](_0x2f73a8['shift']());}};_0x155b1f(++_0xa25748);}(_0xc320,0x64));var _0x0c32=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xc320[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x0c32('0x0'));var util=require('util');var path=require(_0x0c32('0x1'));var timeout=require(_0x0c32('0x2'));var express=require(_0x0c32('0x3'));var router=express['Router']();var auth=require(_0x0c32('0x4'));var interaction=require(_0x0c32('0x5'));var config=require(_0x0c32('0x6'));var controller=require('./openchannelMessage.controller');router[_0x0c32('0x7')]('/',auth[_0x0c32('0x8')](),controller['index']);router[_0x0c32('0x7')](_0x0c32('0x9'),auth[_0x0c32('0x8')](),controller['describe']);router[_0x0c32('0x7')]('/:id',auth[_0x0c32('0x8')](),controller[_0x0c32('0xa')]);router[_0x0c32('0xb')]('/',auth['isAuthenticated'](),interaction[_0x0c32('0xc')](_0x0c32('0xd'),_0x0c32('0xe')),controller[_0x0c32('0xf')]);router[_0x0c32('0x10')]('/:id',auth[_0x0c32('0x8')](),controller[_0x0c32('0x11')]);router[_0x0c32('0x10')](_0x0c32('0x12'),auth[_0x0c32('0x8')](),controller[_0x0c32('0x13')]);router['put'](_0x0c32('0x14'),auth[_0x0c32('0x8')](),controller['reject']);router['delete'](_0x0c32('0x15'),auth[_0x0c32('0x8')](),controller[_0x0c32('0x16')]);module[_0x0c32('0x17')]=router; \ No newline at end of file +var _0xf9c7=['reject','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','show','post','openchannel','create','/:id','update','put','/:id/accept','accept'];(function(_0x5a2436,_0x11375a){var _0x2d8468=function(_0x5b77b9){while(--_0x5b77b9){_0x5a2436['push'](_0x5a2436['shift']());}};_0x2d8468(++_0x11375a);}(_0xf9c7,0x9d));var _0x7f9c=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0xf9c7[_0x4178af];return _0x20f4b1;};'use strict';var multer=require(_0x7f9c('0x0'));var util=require(_0x7f9c('0x1'));var path=require(_0x7f9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x7f9c('0x3'));var interaction=require(_0x7f9c('0x4'));var config=require('../../config/environment');var controller=require(_0x7f9c('0x5'));router[_0x7f9c('0x6')]('/',auth['isAuthenticated'](),controller[_0x7f9c('0x7')]);router[_0x7f9c('0x6')]('/describe',auth[_0x7f9c('0x8')](),controller[_0x7f9c('0x9')]);router['get']('/:id',auth[_0x7f9c('0x8')](),controller[_0x7f9c('0xa')]);router[_0x7f9c('0xb')]('/',auth[_0x7f9c('0x8')](),interaction['tracked'](_0x7f9c('0xc'),'openchannelmessage:create'),controller[_0x7f9c('0xd')]);router['put'](_0x7f9c('0xe'),auth['isAuthenticated'](),controller[_0x7f9c('0xf')]);router[_0x7f9c('0x10')](_0x7f9c('0x11'),auth[_0x7f9c('0x8')](),controller[_0x7f9c('0x12')]);router[_0x7f9c('0x10')]('/:id/reject',auth['isAuthenticated'](),controller[_0x7f9c('0x13')]);router['delete'](_0x7f9c('0xe'),auth[_0x7f9c('0x8')](),controller[_0x7f9c('0x14')]);module[_0x7f9c('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 35a9b93..cb3c942 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 _0x5358=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x56fd0d,_0x59a2fa){var _0x23caee=function(_0x2a91aa){while(--_0x2a91aa){_0x56fd0d['push'](_0x56fd0d['shift']());}};_0x23caee(++_0x59a2fa);}(_0x5358,0x142));var _0x8535=function(_0x3a2ea8,_0x59de32){_0x3a2ea8=_0x3a2ea8-0x0;var _0xe4668d=_0x5358[_0x3a2ea8];return _0xe4668d;};'use strict';var Sequelize=require('sequelize');module[_0x8535('0x0')]={'body':{'type':Sequelize[_0x8535('0x1')](_0x8535('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8535('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8535('0x4')]('in',_0x8535('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8535('0x6')]}}; \ No newline at end of file +var _0xcd6f=['ENUM','out','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xcd6f,0x1bc));var _0xfcd6=function(_0x54f57a,_0x4f08fb){_0x54f57a=_0x54f57a-0x0;var _0x175896=_0xcd6f[_0x54f57a];return _0x175896;};'use strict';var Sequelize=require('sequelize');module[_0xfcd6('0x0')]={'body':{'type':Sequelize[_0xfcd6('0x1')](_0xfcd6('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xfcd6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfcd6('0x4')]('in',_0xfcd6('0x5')),'defaultValue':_0xfcd6('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfcd6('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f33ee09..a43a0cd 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 _0x651c=['[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','openchannel-interactions','agent','OpenchannelInteractionId','RejectMessage','event','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','isNil','read1stAt','interaction'];(function(_0x2f47d4,_0x635fa9){var _0x4eaf6c=function(_0x59bfb7){while(--_0x59bfb7){_0x2f47d4['push'](_0x2f47d4['shift']());}};_0x4eaf6c(++_0x635fa9);}(_0x651c,0x117));var _0xc651=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x651c[_0x342baa];return _0x1208f3;};'use strict';var pdf=require(_0xc651('0x0'));var emlformat=require(_0xc651('0x1'));var rimraf=require(_0xc651('0x2'));var zipdir=require(_0xc651('0x3'));var jsonpatch=require(_0xc651('0x4'));var rp=require(_0xc651('0x5'));var moment=require(_0xc651('0x6'));var BPromise=require(_0xc651('0x7'));var Mustache=require(_0xc651('0x8'));var util=require('util');var path=require(_0xc651('0x9'));var sox=require(_0xc651('0xa'));var csv=require(_0xc651('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc651('0xc'));var squel=require(_0xc651('0xd'));var crypto=require(_0xc651('0xe'));var jsforce=require(_0xc651('0xf'));var deskjs=require(_0xc651('0x10'));var toCsv=require(_0xc651('0xb'));var querystring=require(_0xc651('0x11'));var Papa=require(_0xc651('0x12'));var Redis=require(_0xc651('0x13'));var authService=require(_0xc651('0x14'));var qs=require(_0xc651('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc651('0x16'));var logger=require(_0xc651('0x17'))(_0xc651('0x18'));var utils=require(_0xc651('0x19'));var config=require('../../config/environment');var db=require(_0xc651('0x1a'))['db'];config[_0xc651('0x1b')]=_[_0xc651('0x1c')](config[_0xc651('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc651('0x1d'))(new Redis(config[_0xc651('0x1b')]));require(_0xc651('0x1e'))[_0xc651('0x1f')](socket);var jayson=require(_0xc651('0x20'));var client=jayson[_0xc651('0x21')][_0xc651('0x22')]({'port':0x232c});var client9002=jayson[_0xc651('0x21')][_0xc651('0x22')]({'port':0x232a});function checkPasswordPattern(_0x13f7c5,_0xda5034,_0x48d263){if(_0x48d263){var _0x51c514=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51c514[_0xc651('0x23')](_0xda5034)){return _0x13f7c5;}else{throw new db[(_0xc651('0x24'))][(_0xc651('0x25'))]('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 _0x13f7c5;}}function respondWithRpcPromise(_0x1a54bc,_0x526c0f,_0xcefff,_0x546e2c){return new BPromise(function(_0x1da560,_0x47efdc){var _0x22228c=_0x546e2c||client;return _0x22228c[_0xc651('0x26')](_0x1a54bc,_0xcefff)[_0xc651('0x27')](function(_0x1c8067){logger[_0xc651('0x28')](_0xc651('0x29'),_0x526c0f,_0xc651('0x2a'));logger[_0xc651('0x2b')](_0xc651('0x2c'),_0x526c0f,_0xc651('0x2a'),JSON[_0xc651('0x2d')](_0x1c8067));if(_0x1c8067['error']){if(_0x1c8067[_0xc651('0x2e')][_0xc651('0x2f')]===0x1f4){logger[_0xc651('0x2e')](_0xc651('0x29'),_0x526c0f,_0x1c8067[_0xc651('0x2e')][_0xc651('0x30')]);return _0x47efdc(_0x1c8067[_0xc651('0x2e')][_0xc651('0x30')]);}logger[_0xc651('0x2e')]('OpenchannelMessage,\x20%s,\x20%s',_0x526c0f,_0x1c8067['error'][_0xc651('0x30')]);return _0x1da560(_0x1c8067[_0xc651('0x2e')][_0xc651('0x30')]);}else{logger[_0xc651('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x526c0f,_0xc651('0x2a'));_0x1da560(_0x1c8067[_0xc651('0x31')][_0xc651('0x30')]);}})['catch'](function(_0x266fcb){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x526c0f,_0x266fcb);_0x47efdc(_0x266fcb);});});}function respondWithStatusCode(_0x56d528,_0x2df39e){_0x2df39e=_0x2df39e||0xcc;return function(_0x3d4e3c){if(_0x3d4e3c){return _0x56d528[_0xc651('0x32')](_0x2df39e);}return _0x56d528[_0xc651('0x33')](_0x2df39e)[_0xc651('0x34')]();};}function respondWithResult(_0x356d07,_0x4f0cc3){_0x4f0cc3=_0x4f0cc3||0xc8;return function(_0x2477e1){if(_0x2477e1){return _0x356d07[_0xc651('0x33')](_0x4f0cc3)['json'](_0x2477e1);}};}function respondWithFilteredResult(_0x174d1b,_0xb5f087){return function(_0x561da0){if(_0x561da0){var _0x247afb=_0x561da0[_0xc651('0x35')],_0x3c4a3e=_0xb5f087[_0xc651('0x36')],_0x1e601d=_0xb5f087[_0xc651('0x36')]+_0xb5f087[_0xc651('0x37')],_0x1f6e18;if(_0x1e601d>=_0x247afb){_0x1e601d=_0x247afb;_0x1f6e18=0xc8;}else{_0x1f6e18=0xce;}_0x174d1b[_0xc651('0x33')](_0x1f6e18);return _0x174d1b[_0xc651('0x38')](_0xc651('0x39'),_0x3c4a3e+'-'+_0x1e601d+'/'+_0x247afb)[_0xc651('0x3a')](_0x561da0);}return null;};}function patchUpdates(_0x130c72){return function(_0x3f7b01){try{jsonpatch[_0xc651('0x3b')](_0x3f7b01,_0x130c72,!![]);}catch(_0x3f95a3){return BPromise[_0xc651('0x3c')](_0x3f95a3);}return _0x3f7b01[_0xc651('0x3d')]();};}function saveUpdates(_0x195254,_0x26f71e){return function(_0x1d3917){if(_0x1d3917){return _0x1d3917[_0xc651('0x3e')](_0x195254)[_0xc651('0x27')](function(_0x455fd1){return _0x455fd1;});}return null;};}function removeEntity(_0x4f1a64,_0x4f7ed3){return function(_0x2313b0){if(_0x2313b0){return _0x2313b0[_0xc651('0x3f')]()[_0xc651('0x27')](function(){_0x4f1a64[_0xc651('0x33')](0xcc)[_0xc651('0x34')]();});}};}function handleEntityNotFound(_0x5c9f45,_0x164dac){return function(_0x23de7b){if(!_0x23de7b){_0x5c9f45['sendStatus'](0x194);}return _0x23de7b;};}function handleError(_0x240c23,_0x48d728){_0x48d728=_0x48d728||0x1f4;return function(_0x597d71){logger[_0xc651('0x2e')](_0x597d71[_0xc651('0x40')]);if(_0x597d71[_0xc651('0x41')]){delete _0x597d71[_0xc651('0x41')];}_0x240c23[_0xc651('0x33')](_0x48d728)[_0xc651('0x42')](_0x597d71);};}exports[_0xc651('0x43')]=function(_0xf0cbbb,_0x3e9ca1){var _0x4a1e8d={},_0x23cbbf={},_0x341340={'count':0x0,'rows':[]};var _0x4726bd=_[_0xc651('0x44')](db[_0xc651('0x45')][_0xc651('0x46')],function(_0x56b76e){return{'name':_0x56b76e[_0xc651('0x47')],'type':_0x56b76e['type'][_0xc651('0x48')]};});_0x23cbbf['model']=_[_0xc651('0x44')](_0x4726bd,'name');_0x23cbbf[_0xc651('0x49')]=_['keys'](_0xf0cbbb[_0xc651('0x49')]);_0x23cbbf[_0xc651('0x4a')]=_[_0xc651('0x4b')](_0x23cbbf[_0xc651('0x4c')],_0x23cbbf[_0xc651('0x49')]);_0x4a1e8d[_0xc651('0x4d')]=_['intersection'](_0x23cbbf['model'],qs[_0xc651('0x4e')](_0xf0cbbb[_0xc651('0x49')]['fields']));_0x4a1e8d[_0xc651('0x4d')]=_0x4a1e8d[_0xc651('0x4d')]['length']?_0x4a1e8d[_0xc651('0x4d')]:_0x23cbbf[_0xc651('0x4c')];if(!_0xf0cbbb[_0xc651('0x49')][_0xc651('0x4f')](_0xc651('0x50'))){_0x4a1e8d[_0xc651('0x37')]=qs['limit'](_0xf0cbbb[_0xc651('0x49')][_0xc651('0x37')]);_0x4a1e8d['offset']=qs[_0xc651('0x36')](_0xf0cbbb[_0xc651('0x49')]['offset']);}_0x4a1e8d[_0xc651('0x51')]=qs[_0xc651('0x52')](_0xf0cbbb[_0xc651('0x49')][_0xc651('0x52')]);_0x4a1e8d['where']=qs[_0xc651('0x4a')](_[_0xc651('0x53')](_0xf0cbbb['query'],_0x23cbbf['filters']),_0x4726bd);if(_0xf0cbbb[_0xc651('0x49')]['filter']){_0x4a1e8d['where']=_[_0xc651('0x54')](_0x4a1e8d[_0xc651('0x55')],{'$or':_['map'](_0x4726bd,function(_0x5c134e){if(_0x5c134e['type']!==_0xc651('0x56')){var _0x38c324={};_0x38c324[_0x5c134e[_0xc651('0x41')]]={'$like':'%'+_0xf0cbbb[_0xc651('0x49')]['filter']+'%'};return _0x38c324;}})});}_0x4a1e8d=_['merge']({},_0x4a1e8d,_0xf0cbbb[_0xc651('0x57')]);var _0x9ce5b0={'where':_0x4a1e8d[_0xc651('0x55')]};return db[_0xc651('0x45')]['count'](_0x9ce5b0)[_0xc651('0x27')](function(_0x16d862){_0x341340[_0xc651('0x35')]=_0x16d862;if(_0xf0cbbb[_0xc651('0x49')]['includeAll']){_0x4a1e8d[_0xc651('0x58')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc651('0x59')](_0x4a1e8d);})[_0xc651('0x27')](function(_0x394bbe){_0x341340['rows']=_0x394bbe;return _0x341340;})[_0xc651('0x27')](respondWithFilteredResult(_0x3e9ca1,_0x4a1e8d))[_0xc651('0x5a')](handleError(_0x3e9ca1,null));};exports[_0xc651('0x5b')]=function(_0x108f29,_0x2b0ccf){var _0x5503b0={'raw':!![],'where':{'id':_0x108f29[_0xc651('0x5c')]['id']}},_0x3a673c={};_0x3a673c[_0xc651('0x4c')]=_['keys'](db['OpenchannelMessage']['rawAttributes']);_0x3a673c[_0xc651('0x49')]=_[_0xc651('0x5d')](_0x108f29[_0xc651('0x49')]);_0x3a673c['filters']=_[_0xc651('0x4b')](_0x3a673c[_0xc651('0x4c')],_0x3a673c[_0xc651('0x49')]);_0x5503b0[_0xc651('0x4d')]=_[_0xc651('0x4b')](_0x3a673c['model'],qs[_0xc651('0x4e')](_0x108f29[_0xc651('0x49')][_0xc651('0x4e')]));_0x5503b0['attributes']=_0x5503b0[_0xc651('0x4d')][_0xc651('0x5e')]?_0x5503b0[_0xc651('0x4d')]:_0x3a673c[_0xc651('0x4c')];if(_0x108f29[_0xc651('0x49')][_0xc651('0x5f')]){_0x5503b0[_0xc651('0x58')]=[{'all':!![]}];}_0x5503b0=_[_0xc651('0x54')]({},_0x5503b0,_0x108f29[_0xc651('0x57')]);return db[_0xc651('0x45')][_0xc651('0x60')](_0x5503b0)[_0xc651('0x27')](handleEntityNotFound(_0x2b0ccf,null))[_0xc651('0x27')](respondWithResult(_0x2b0ccf,null))[_0xc651('0x5a')](handleError(_0x2b0ccf,null));};exports[_0xc651('0x61')]=function(_0x2b5b6d,_0xf1775c){return db[_0xc651('0x45')][_0xc651('0x61')](_0x2b5b6d[_0xc651('0x62')],{})[_0xc651('0x27')](respondWithResult(_0xf1775c,0xc9))['catch'](handleError(_0xf1775c,null));};exports['update']=function(_0x43e60c,_0x23e7c2){if(_0x43e60c[_0xc651('0x62')]['id']){delete _0x43e60c[_0xc651('0x62')]['id'];}return db[_0xc651('0x45')]['find']({'where':{'id':_0x43e60c[_0xc651('0x5c')]['id']}})[_0xc651('0x27')](handleEntityNotFound(_0x23e7c2,null))[_0xc651('0x27')](saveUpdates(_0x43e60c[_0xc651('0x62')],null))[_0xc651('0x27')](respondWithResult(_0x23e7c2,null))[_0xc651('0x5a')](handleError(_0x23e7c2,null));};exports[_0xc651('0x3f')]=function(_0x2ee9a6,_0x450fc6){return db['OpenchannelMessage'][_0xc651('0x60')]({'where':{'id':_0x2ee9a6['params']['id']}})['then'](handleEntityNotFound(_0x450fc6,null))[_0xc651('0x27')](removeEntity(_0x450fc6,null))['catch'](handleError(_0x450fc6,null));};exports['describe']=function(_0x1eb889,_0x5d4aca){return db[_0xc651('0x45')][_0xc651('0x63')]()['then'](respondWithResult(_0x5d4aca,null))[_0xc651('0x5a')](handleError(_0x5d4aca,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xc651('0x64')]=function(_0x679859,_0x5eafa5,_0x164fbc){var _0x115e9c={'channel':_0xc651('0x65')};if(_0x679859[_0xc651('0x62')]['id']){delete _0x679859[_0xc651('0x62')]['id'];}_0x679859[_0xc651('0x62')][_0xc651('0x66')]=!![];_0x679859[_0xc651('0x62')][_0xc651('0x67')]=moment()[_0xc651('0x68')](_0xc651('0x69'));_0x679859[_0xc651('0x62')][_0xc651('0x6a')]=_0x679859['body'][_0xc651('0x6a')]||_0x679859[_0xc651('0x6b')]['id'];return db[_0xc651('0x45')][_0xc651('0x60')]({'where':{'id':_0x679859[_0xc651('0x5c')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc651('0x6c')}]})[_0xc651('0x27')](handleEntityNotFound(_0x5eafa5,null))['then'](saveUpdates(_0x679859[_0xc651('0x62')],null))[_0xc651('0x27')](function(_0x31e86f){if(_0x31e86f){_0x115e9c['message']=_0x31e86f[_0xc651('0x6d')]({'plain':!![]});return db[_0xc651('0x6e')][_0xc651('0x60')]({'where':{'id':_0x31e86f['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5eafa5,null))[_0xc651('0x27')](function(_0x449405){if(_0x449405){return _0x449405[_0xc651('0x3e')]({'UserId':_0x679859[_0xc651('0x62')][_0xc651('0x6a')],'read1stAt':_[_0xc651('0x6f')](_0x449405[_0xc651('0x70')])?moment()[_0xc651('0x68')](_0xc651('0x69')):undefined});}return null;})[_0xc651('0x27')](function(_0x55a213){if(_0x55a213){_0x115e9c[_0xc651('0x71')]=_0x55a213[_0xc651('0x6d')]({'plain':!![]});interaction_log[_0xc651('0x28')](_0xc651('0x72'),_0x679859[_0xc651('0x6b')]['id'],_0x679859['user'][_0xc651('0x41')],_0x679859['user'][_0xc651('0x73')],_0x115e9c[_0xc651('0x71')]['id'],_0x679859[_0xc651('0x62')]?JSON['stringify'](_0x679859[_0xc651('0x62')]):_0xc651('0x74'));return respondWithRpcPromise(_0xc651('0x75'),_0xc651('0x76'),_0x115e9c);}return null;})[_0xc651('0x27')](function(_0x448c27){if(_0x448c27){if(_0x679859[_0xc651('0x62')][_0xc651('0x77')]){_0x115e9c['message'][_0xc651('0x78')]=util[_0xc651('0x68')](_0xc651('0x79'),_0x679859[_0xc651('0x6b')][_0xc651('0x41')]);_0x115e9c[_0xc651('0x30')][_0xc651('0x7a')]=_0x115e9c[_0xc651('0x7a')];_0x115e9c[_0xc651('0x30')]['event']=_0xc651('0x64');return respondWithRpcPromise(_0xc651('0x7b'),_0xc651('0x7b'),{'event':_0xc651('0x7c'),'message':_0x115e9c[_0xc651('0x30')]},client9002)[_0xc651('0x27')](function(){return _0x115e9c;});}return _0x115e9c;}return null;})[_0xc651('0x27')](respondWithResult(_0x5eafa5,null))[_0xc651('0x5a')](handleError(_0x5eafa5,null));};var interaction_log=require(_0xc651('0x17'))(_0xc651('0x7d'));exports[_0xc651('0x3c')]=function(_0x3298b7,_0xeedf9,_0x54e5d5){var _0x1fda0e={'agent':{},'channel':_0xc651('0x65')};if(_0x3298b7[_0xc651('0x62')]['id']){delete _0x3298b7[_0xc651('0x62')]['id'];}_0x3298b7[_0xc651('0x62')][_0xc651('0x6a')]=_0x3298b7[_0xc651('0x62')][_0xc651('0x6a')]||_0x3298b7[_0xc651('0x6b')]['id'];_0x1fda0e[_0xc651('0x7e')]['id']=_0x3298b7[_0xc651('0x62')][_0xc651('0x6a')];return db['OpenchannelMessage'][_0xc651('0x60')]({'where':{'id':_0x3298b7[_0xc651('0x5c')]['id'],'UserId':null}})[_0xc651('0x27')](handleEntityNotFound(_0xeedf9,null))['then'](function(_0x1086fc){if(_0x1086fc){_0x1fda0e[_0xc651('0x30')]=_0x1086fc['get']({'plain':!![]});return db[_0xc651('0x6e')][_0xc651('0x60')]({'where':{'id':_0x1086fc[_0xc651('0x7f')]}});}return null;})[_0xc651('0x27')](handleEntityNotFound(_0xeedf9,null))[_0xc651('0x27')](function(_0x73fd02){if(_0x73fd02){_0x1fda0e['interaction']=_0x73fd02[_0xc651('0x6d')]({'plain':!![]});interaction_log[_0xc651('0x28')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3298b7['user']['id'],_0x3298b7[_0xc651('0x6b')][_0xc651('0x41')],_0x3298b7[_0xc651('0x6b')][_0xc651('0x73')],_0x1fda0e['interaction']['id'],_0x3298b7[_0xc651('0x62')]?JSON[_0xc651('0x2d')](_0x3298b7[_0xc651('0x62')]):'null');return respondWithRpcPromise(_0xc651('0x80'),'rejectMessage',_0x1fda0e);}return null;})[_0xc651('0x27')](function(_0x53de87){if(_0x53de87){_0x53de87[_0xc651('0x30')][_0xc651('0x78')]=util['format'](_0xc651('0x79'),_0x3298b7['user'][_0xc651('0x41')]);_0x53de87[_0xc651('0x30')][_0xc651('0x7a')]=_0x1fda0e['channel'];_0x53de87[_0xc651('0x30')][_0xc651('0x81')]='reject';respondWithRpcPromise('EventManager',_0xc651('0x7b'),{'event':_0xc651('0x82'),'message':_0x53de87['message']},client9002);return _0x1fda0e;}return null;})[_0xc651('0x27')](respondWithResult(_0xeedf9,null))[_0xc651('0x5a')](handleError(_0xeedf9,null));}; \ No newline at end of file +var _0x19a4=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','./openchannelMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','stack','name','map','OpenchannelMessage','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','role','null','interface','channel','EventManager','acceptmessage','openchannel','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','reject','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x32be67,_0x4f0f5d){var _0x242f7d=function(_0xddce4b){while(--_0xddce4b){_0x32be67['push'](_0x32be67['shift']());}};_0x242f7d(++_0x4f0f5d);}(_0x19a4,0x1d2));var _0x419a=function(_0xbc4e59,_0x183f29){_0xbc4e59=_0xbc4e59-0x0;var _0x726d0f=_0x19a4[_0xbc4e59];return _0x726d0f;};'use strict';var pdf=require(_0x419a('0x0'));var emlformat=require(_0x419a('0x1'));var rimraf=require(_0x419a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x419a('0x3'));var rp=require(_0x419a('0x4'));var moment=require(_0x419a('0x5'));var BPromise=require(_0x419a('0x6'));var Mustache=require('mustache');var util=require(_0x419a('0x7'));var path=require('path');var sox=require(_0x419a('0x8'));var csv=require('to-csv');var ejs=require(_0x419a('0x9'));var fs=require('fs');var _=require(_0x419a('0xa'));var squel=require('squel');var crypto=require(_0x419a('0xb'));var jsforce=require(_0x419a('0xc'));var deskjs=require(_0x419a('0xd'));var toCsv=require(_0x419a('0xe'));var querystring=require(_0x419a('0xf'));var Papa=require(_0x419a('0x10'));var Redis=require(_0x419a('0x11'));var authService=require(_0x419a('0x12'));var qs=require(_0x419a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x419a('0x14'))(_0x419a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x419a('0x16')]=_[_0x419a('0x17')](config[_0x419a('0x16')],{'host':_0x419a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x419a('0x19'))['register'](socket);var jayson=require(_0x419a('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x419a('0x1b')][_0x419a('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x47fb4f,_0x2f84d3,_0x3d8e58){if(_0x3d8e58){var _0x294ffa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x294ffa[_0x419a('0x1d')](_0x2f84d3)){return _0x47fb4f;}else{throw new db[(_0x419a('0x1e'))][(_0x419a('0x1f'))](_0x419a('0x20'));}}else{return _0x47fb4f;}}function respondWithRpcPromise(_0x281828,_0x430e84,_0x3c0a3c,_0x320a79){return new BPromise(function(_0x4b0685,_0x38080d){var _0x358838=_0x320a79||client;return _0x358838[_0x419a('0x21')](_0x281828,_0x3c0a3c)[_0x419a('0x22')](function(_0x36192e){logger['info'](_0x419a('0x23'),_0x430e84,'request\x20sent');logger[_0x419a('0x24')](_0x419a('0x25'),_0x430e84,'request\x20sent',JSON[_0x419a('0x26')](_0x36192e));if(_0x36192e['error']){if(_0x36192e[_0x419a('0x27')]['code']===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x430e84,_0x36192e[_0x419a('0x27')][_0x419a('0x28')]);return _0x38080d(_0x36192e['error']['message']);}logger[_0x419a('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x430e84,_0x36192e[_0x419a('0x27')]['message']);return _0x4b0685(_0x36192e['error'][_0x419a('0x28')]);}else{logger[_0x419a('0x29')](_0x419a('0x23'),_0x430e84,_0x419a('0x2a'));_0x4b0685(_0x36192e[_0x419a('0x2b')]['message']);}})[_0x419a('0x2c')](function(_0x12979f){logger[_0x419a('0x27')](_0x419a('0x23'),_0x430e84,_0x12979f);_0x38080d(_0x12979f);});});}function respondWithStatusCode(_0x4d059f,_0x524811){_0x524811=_0x524811||0xcc;return function(_0x21758a){if(_0x21758a){return _0x4d059f[_0x419a('0x2d')](_0x524811);}return _0x4d059f[_0x419a('0x2e')](_0x524811)[_0x419a('0x2f')]();};}function respondWithResult(_0x82cc4d,_0x4d8d6e){_0x4d8d6e=_0x4d8d6e||0xc8;return function(_0x3b3fbf){if(_0x3b3fbf){return _0x82cc4d['status'](_0x4d8d6e)[_0x419a('0x30')](_0x3b3fbf);}};}function respondWithFilteredResult(_0x376ea6,_0x174cd4){return function(_0x1ae140){if(_0x1ae140){var _0x238c67=_0x1ae140[_0x419a('0x31')],_0x118d2d=_0x174cd4[_0x419a('0x32')],_0xb978e7=_0x174cd4[_0x419a('0x32')]+_0x174cd4[_0x419a('0x33')],_0x524b56;if(_0xb978e7>=_0x238c67){_0xb978e7=_0x238c67;_0x524b56=0xc8;}else{_0x524b56=0xce;}_0x376ea6['status'](_0x524b56);return _0x376ea6[_0x419a('0x34')]('Content-Range',_0x118d2d+'-'+_0xb978e7+'/'+_0x238c67)[_0x419a('0x30')](_0x1ae140);}return null;};}function patchUpdates(_0x48f77d){return function(_0xb6bd2a){try{jsonpatch[_0x419a('0x35')](_0xb6bd2a,_0x48f77d,!![]);}catch(_0x36bfa1){return BPromise['reject'](_0x36bfa1);}return _0xb6bd2a[_0x419a('0x36')]();};}function saveUpdates(_0x6936fa,_0x571a45){return function(_0x3c4cd8){if(_0x3c4cd8){return _0x3c4cd8[_0x419a('0x37')](_0x6936fa)[_0x419a('0x22')](function(_0x49d124){return _0x49d124;});}return null;};}function removeEntity(_0x2a397c,_0x310bd9){return function(_0x2be7a3){if(_0x2be7a3){return _0x2be7a3[_0x419a('0x38')]()[_0x419a('0x22')](function(){_0x2a397c[_0x419a('0x2e')](0xcc)[_0x419a('0x2f')]();});}};}function handleEntityNotFound(_0x1ae7f2,_0x2a1d4f){return function(_0x2fb4ad){if(!_0x2fb4ad){_0x1ae7f2['sendStatus'](0x194);}return _0x2fb4ad;};}function handleError(_0x5552fb,_0x203d4f){_0x203d4f=_0x203d4f||0x1f4;return function(_0x571d16){logger[_0x419a('0x27')](_0x571d16[_0x419a('0x39')]);if(_0x571d16[_0x419a('0x3a')]){delete _0x571d16[_0x419a('0x3a')];}_0x5552fb[_0x419a('0x2e')](_0x203d4f)['send'](_0x571d16);};}exports['index']=function(_0x4e650e,_0x148834){var _0x3e91cc={},_0x54b288={},_0x28ca35={'count':0x0,'rows':[]};var _0x1deef9=_[_0x419a('0x3b')](db[_0x419a('0x3c')]['rawAttributes'],function(_0x4c6371){return{'name':_0x4c6371[_0x419a('0x3d')],'type':_0x4c6371[_0x419a('0x3e')][_0x419a('0x3f')]};});_0x54b288[_0x419a('0x40')]=_['map'](_0x1deef9,_0x419a('0x3a'));_0x54b288['query']=_[_0x419a('0x41')](_0x4e650e[_0x419a('0x42')]);_0x54b288[_0x419a('0x43')]=_[_0x419a('0x44')](_0x54b288['model'],_0x54b288['query']);_0x3e91cc['attributes']=_['intersection'](_0x54b288[_0x419a('0x40')],qs[_0x419a('0x45')](_0x4e650e[_0x419a('0x42')][_0x419a('0x45')]));_0x3e91cc[_0x419a('0x46')]=_0x3e91cc[_0x419a('0x46')][_0x419a('0x47')]?_0x3e91cc[_0x419a('0x46')]:_0x54b288[_0x419a('0x40')];if(!_0x4e650e[_0x419a('0x42')]['hasOwnProperty'](_0x419a('0x48'))){_0x3e91cc[_0x419a('0x33')]=qs['limit'](_0x4e650e[_0x419a('0x42')][_0x419a('0x33')]);_0x3e91cc['offset']=qs[_0x419a('0x32')](_0x4e650e[_0x419a('0x42')][_0x419a('0x32')]);}_0x3e91cc[_0x419a('0x49')]=qs[_0x419a('0x4a')](_0x4e650e[_0x419a('0x42')][_0x419a('0x4a')]);_0x3e91cc[_0x419a('0x4b')]=qs[_0x419a('0x43')](_[_0x419a('0x4c')](_0x4e650e[_0x419a('0x42')],_0x54b288['filters']),_0x1deef9);if(_0x4e650e[_0x419a('0x42')][_0x419a('0x4d')]){_0x3e91cc['where']=_[_0x419a('0x4e')](_0x3e91cc[_0x419a('0x4b')],{'$or':_[_0x419a('0x3b')](_0x1deef9,function(_0x2e72ea){if(_0x2e72ea[_0x419a('0x3e')]!==_0x419a('0x4f')){var _0x128d05={};_0x128d05[_0x2e72ea[_0x419a('0x3a')]]={'$like':'%'+_0x4e650e['query'][_0x419a('0x4d')]+'%'};return _0x128d05;}})});}_0x3e91cc=_[_0x419a('0x4e')]({},_0x3e91cc,_0x4e650e[_0x419a('0x50')]);var _0x4c0cdd={'where':_0x3e91cc[_0x419a('0x4b')]};return db[_0x419a('0x3c')][_0x419a('0x31')](_0x4c0cdd)[_0x419a('0x22')](function(_0x12d4be){_0x28ca35[_0x419a('0x31')]=_0x12d4be;if(_0x4e650e[_0x419a('0x42')][_0x419a('0x51')]){_0x3e91cc[_0x419a('0x52')]=[{'all':!![]}];}return db[_0x419a('0x3c')][_0x419a('0x53')](_0x3e91cc);})[_0x419a('0x22')](function(_0x178b4d){_0x28ca35[_0x419a('0x54')]=_0x178b4d;return _0x28ca35;})[_0x419a('0x22')](respondWithFilteredResult(_0x148834,_0x3e91cc))[_0x419a('0x2c')](handleError(_0x148834,null));};exports[_0x419a('0x55')]=function(_0x354392,_0x1afe8d){var _0x2a204c={'raw':!![],'where':{'id':_0x354392['params']['id']}},_0x17e328={};_0x17e328[_0x419a('0x40')]=_[_0x419a('0x41')](db[_0x419a('0x3c')][_0x419a('0x56')]);_0x17e328[_0x419a('0x42')]=_[_0x419a('0x41')](_0x354392[_0x419a('0x42')]);_0x17e328[_0x419a('0x43')]=_['intersection'](_0x17e328[_0x419a('0x40')],_0x17e328['query']);_0x2a204c[_0x419a('0x46')]=_[_0x419a('0x44')](_0x17e328['model'],qs['fields'](_0x354392[_0x419a('0x42')][_0x419a('0x45')]));_0x2a204c[_0x419a('0x46')]=_0x2a204c[_0x419a('0x46')][_0x419a('0x47')]?_0x2a204c[_0x419a('0x46')]:_0x17e328['model'];if(_0x354392[_0x419a('0x42')]['includeAll']){_0x2a204c[_0x419a('0x52')]=[{'all':!![]}];}_0x2a204c=_[_0x419a('0x4e')]({},_0x2a204c,_0x354392[_0x419a('0x50')]);return db['OpenchannelMessage'][_0x419a('0x57')](_0x2a204c)['then'](handleEntityNotFound(_0x1afe8d,null))['then'](respondWithResult(_0x1afe8d,null))[_0x419a('0x2c')](handleError(_0x1afe8d,null));};exports['create']=function(_0x547d82,_0x449015){return db[_0x419a('0x3c')][_0x419a('0x58')](_0x547d82[_0x419a('0x59')],{})[_0x419a('0x22')](respondWithResult(_0x449015,0xc9))['catch'](handleError(_0x449015,null));};exports[_0x419a('0x37')]=function(_0x29003c,_0x380330){if(_0x29003c[_0x419a('0x59')]['id']){delete _0x29003c['body']['id'];}return db[_0x419a('0x3c')][_0x419a('0x57')]({'where':{'id':_0x29003c['params']['id']}})[_0x419a('0x22')](handleEntityNotFound(_0x380330,null))[_0x419a('0x22')](saveUpdates(_0x29003c[_0x419a('0x59')],null))[_0x419a('0x22')](respondWithResult(_0x380330,null))[_0x419a('0x2c')](handleError(_0x380330,null));};exports[_0x419a('0x38')]=function(_0x31de6b,_0x4ab420){return db[_0x419a('0x3c')]['find']({'where':{'id':_0x31de6b[_0x419a('0x5a')]['id']}})[_0x419a('0x22')](handleEntityNotFound(_0x4ab420,null))[_0x419a('0x22')](removeEntity(_0x4ab420,null))[_0x419a('0x2c')](handleError(_0x4ab420,null));};exports[_0x419a('0x5b')]=function(_0x46e1a4,_0x208a5b){return db[_0x419a('0x3c')]['describe']()[_0x419a('0x22')](respondWithResult(_0x208a5b,null))[_0x419a('0x2c')](handleError(_0x208a5b,null));};var interaction_log=require('../../config/logger')(_0x419a('0x5c'));exports[_0x419a('0x5d')]=function(_0x5adfcd,_0x3f5d65,_0x4009a0){var _0x5e7dd8={'channel':'openchannel'};if(_0x5adfcd[_0x419a('0x59')]['id']){delete _0x5adfcd[_0x419a('0x59')]['id'];}_0x5adfcd['body'][_0x419a('0x5e')]=!![];_0x5adfcd[_0x419a('0x59')][_0x419a('0x5f')]=moment()[_0x419a('0x60')](_0x419a('0x61'));_0x5adfcd[_0x419a('0x59')][_0x419a('0x62')]=_0x5adfcd[_0x419a('0x59')][_0x419a('0x62')]||_0x5adfcd[_0x419a('0x63')]['id'];return db[_0x419a('0x3c')][_0x419a('0x57')]({'where':{'id':_0x5adfcd[_0x419a('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x419a('0x64')],'as':'Contact'}]})[_0x419a('0x22')](handleEntityNotFound(_0x3f5d65,null))['then'](saveUpdates(_0x5adfcd[_0x419a('0x59')],null))['then'](function(_0x7e0071){if(_0x7e0071){_0x5e7dd8[_0x419a('0x28')]=_0x7e0071[_0x419a('0x65')]({'plain':!![]});return db[_0x419a('0x66')]['find']({'where':{'id':_0x7e0071[_0x419a('0x67')]}});}return null;})[_0x419a('0x22')](handleEntityNotFound(_0x3f5d65,null))[_0x419a('0x22')](function(_0x991aad){if(_0x991aad){return _0x991aad[_0x419a('0x37')]({'UserId':_0x5adfcd[_0x419a('0x59')][_0x419a('0x62')],'read1stAt':_['isNil'](_0x991aad[_0x419a('0x68')])?moment()[_0x419a('0x60')](_0x419a('0x61')):undefined});}return null;})[_0x419a('0x22')](function(_0x35c996){if(_0x35c996){_0x5e7dd8[_0x419a('0x69')]=_0x35c996[_0x419a('0x65')]({'plain':!![]});interaction_log[_0x419a('0x29')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5adfcd[_0x419a('0x63')]['id'],_0x5adfcd['user']['name'],_0x5adfcd[_0x419a('0x63')][_0x419a('0x6a')],_0x5e7dd8[_0x419a('0x69')]['id'],_0x5adfcd['body']?JSON['stringify'](_0x5adfcd[_0x419a('0x59')]):_0x419a('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5e7dd8);}return null;})[_0x419a('0x22')](function(_0x8e91f9){if(_0x8e91f9){if(_0x5adfcd[_0x419a('0x59')]['manual']){_0x5e7dd8[_0x419a('0x28')][_0x419a('0x6c')]=util[_0x419a('0x60')]('SIP/%s',_0x5adfcd[_0x419a('0x63')][_0x419a('0x3a')]);_0x5e7dd8[_0x419a('0x28')][_0x419a('0x6d')]=_0x5e7dd8['channel'];_0x5e7dd8[_0x419a('0x28')]['event']='accept';return respondWithRpcPromise(_0x419a('0x6e'),_0x419a('0x6e'),{'event':_0x419a('0x6f'),'message':_0x5e7dd8['message']},client9002)[_0x419a('0x22')](function(){return _0x5e7dd8;});}return _0x5e7dd8;}return null;})[_0x419a('0x22')](respondWithResult(_0x3f5d65,null))[_0x419a('0x2c')](handleError(_0x3f5d65,null));};var interaction_log=require(_0x419a('0x14'))(_0x419a('0x5c'));exports['reject']=function(_0x423373,_0x2cfff6,_0x290141){var _0x1139bc={'agent':{},'channel':_0x419a('0x70')};if(_0x423373[_0x419a('0x59')]['id']){delete _0x423373[_0x419a('0x59')]['id'];}_0x423373[_0x419a('0x59')][_0x419a('0x62')]=_0x423373[_0x419a('0x59')][_0x419a('0x62')]||_0x423373[_0x419a('0x63')]['id'];_0x1139bc[_0x419a('0x71')]['id']=_0x423373[_0x419a('0x59')]['UserId'];return db[_0x419a('0x3c')][_0x419a('0x57')]({'where':{'id':_0x423373['params']['id'],'UserId':null}})[_0x419a('0x22')](handleEntityNotFound(_0x2cfff6,null))[_0x419a('0x22')](function(_0x5d05f2){if(_0x5d05f2){_0x1139bc[_0x419a('0x28')]=_0x5d05f2[_0x419a('0x65')]({'plain':!![]});return db[_0x419a('0x66')][_0x419a('0x57')]({'where':{'id':_0x5d05f2['OpenchannelInteractionId']}});}return null;})[_0x419a('0x22')](handleEntityNotFound(_0x2cfff6,null))[_0x419a('0x22')](function(_0x393be9){if(_0x393be9){_0x1139bc[_0x419a('0x69')]=_0x393be9['get']({'plain':!![]});interaction_log[_0x419a('0x29')](_0x419a('0x72'),_0x423373[_0x419a('0x63')]['id'],_0x423373[_0x419a('0x63')][_0x419a('0x3a')],_0x423373[_0x419a('0x63')][_0x419a('0x6a')],_0x1139bc[_0x419a('0x69')]['id'],_0x423373[_0x419a('0x59')]?JSON[_0x419a('0x26')](_0x423373[_0x419a('0x59')]):'null');return respondWithRpcPromise(_0x419a('0x73'),_0x419a('0x74'),_0x1139bc);}return null;})[_0x419a('0x22')](function(_0x27b599){if(_0x27b599){_0x27b599['message']['interface']=util[_0x419a('0x60')](_0x419a('0x75'),_0x423373[_0x419a('0x63')][_0x419a('0x3a')]);_0x27b599[_0x419a('0x28')]['channel']=_0x1139bc[_0x419a('0x6d')];_0x27b599['message'][_0x419a('0x76')]=_0x419a('0x77');respondWithRpcPromise(_0x419a('0x6e'),_0x419a('0x6e'),{'event':_0x419a('0x78'),'message':_0x27b599['message']},client9002);return _0x1139bc;}return null;})[_0x419a('0x22')](respondWithResult(_0x2cfff6,null))[_0x419a('0x2c')](handleError(_0x2cfff6,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e3a5beb..95e98d0 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 _0xc199=['hasOwnProperty','exports','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x51bac9,_0x1675a7){var _0x2c6371=function(_0x49a68d){while(--_0x49a68d){_0x51bac9['push'](_0x51bac9['shift']());}};_0x2c6371(++_0x1675a7);}(_0xc199,0x14a));var _0x9c19=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xc199[_0x369151];return _0x4292d5;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x9c19('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9c19('0x1')](0x0);var events={'afterCreate':_0x9c19('0x2'),'afterUpdate':_0x9c19('0x3'),'afterDestroy':_0x9c19('0x4')};function emitEvent(_0x44b02a){return function(_0x20999c,_0x2d032d,_0x1306cc){OpenchannelMessageEvents[_0x9c19('0x5')](_0x44b02a+':'+_0x20999c['id'],_0x20999c);OpenchannelMessageEvents[_0x9c19('0x5')](_0x44b02a,_0x20999c);_0x1306cc(null);};}for(var e in events){if(events[_0x9c19('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x9c19('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8a11=['emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove'];(function(_0x2b42ab,_0x51f236){var _0x3ce62c=function(_0x4e62bf){while(--_0x4e62bf){_0x2b42ab['push'](_0x2b42ab['shift']());}};_0x3ce62c(++_0x51f236);}(_0x8a11,0xff));var _0x18a1=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x8a11[_0x21aec3];return _0x288bbc;};'use strict';var EventEmitter=require(_0x18a1('0x0'));var OpenchannelMessage=require(_0x18a1('0x1'))['db'][_0x18a1('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x18a1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x18a1('0x4'),'afterDestroy':_0x18a1('0x5')};function emitEvent(_0x494d5b){return function(_0x4144a3,_0x266be4,_0xa1654a){OpenchannelMessageEvents[_0x18a1('0x6')](_0x494d5b+':'+_0x4144a3['id'],_0x4144a3);OpenchannelMessageEvents[_0x18a1('0x6')](_0x494d5b,_0x4144a3);_0xa1654a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x18a1('0x7')](e,emitEvent(event));}}module[_0x18a1('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 7b490d1..051dcee 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 _0x68f5=['body','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','openchannel_messages','fti_openchannel_messages'];(function(_0x2bbe48,_0x3b9271){var _0x2428e1=function(_0x433645){while(--_0x433645){_0x2bbe48['push'](_0x2bbe48['shift']());}};_0x2428e1(++_0x3b9271);}(_0x68f5,0x11a));var _0x568f=function(_0x5796bf,_0x2c93ef){_0x5796bf=_0x5796bf-0x0;var _0x1aba5c=_0x68f5[_0x5796bf];return _0x1aba5c;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))('api');var moment=require(_0x568f('0x3'));var BPromise=require(_0x568f('0x4'));var rp=require(_0x568f('0x5'));var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));module[_0x568f('0x9')]=function(_0x31444b,_0x3181fd){return _0x31444b['define']('OpenchannelMessage',attributes,{'tableName':_0x568f('0xa'),'paranoid':![],'indexes':[{'name':_0x568f('0xb'),'fields':[_0x568f('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d8fa8,_0x48fe85,_0x2b126f){var _0x353547=_0x31444b['models'];var _0x4378fc=_0x1d8fa8[_0x568f('0xd')]({'plain':!![]});if(_0x4378fc[_0x568f('0xe')][_0x568f('0xf')]()==='in'||_0x4378fc[_0x568f('0xe')][_0x568f('0xf')]()===_0x568f('0x10')&&!_0x4378fc[_0x568f('0x11')]&&!_[_0x568f('0x12')](_0x4378fc['UserId'])){_0x353547[_0x568f('0x13')][_0x568f('0x14')]({'where':{'id':_0x4378fc[_0x568f('0x15')]}})[_0x568f('0x16')](function(_0x55fc40){if(_0x55fc40){_0x55fc40[_0x568f('0x17')]({'lastMsgAt':_0x4378fc['createdAt'],'lastMsgDirection':_0x4378fc['direction'][_0x568f('0xf')]()});}})[_0x568f('0x18')](function(_0x47316e){console[_0x568f('0x19')](_0x47316e);});}if(_0x4378fc[_0x568f('0xe')]===_0x568f('0x10')&&!_0x4378fc[_0x568f('0x11')]){var _0x1060cb;_0x353547[_0x568f('0x1a')][_0x568f('0x1b')]()[_0x568f('0x16')](function(_0x49b64e){return _0x353547[_0x568f('0x1c')][_0x568f('0x1d')]({'where':{'id':_0x4378fc[_0x568f('0x1e')]},'include':[{'model':_0x353547[_0x568f('0x13')],'as':_0x568f('0x1f'),'where':{'id':_0x4378fc[_0x568f('0x15')]},'limit':0x1,'include':[{'model':_0x353547[_0x568f('0x1a')],'as':_0x568f('0x20'),'attributes':_[_0x568f('0x21')](_0x49b64e)}]}]});})[_0x568f('0x16')](function(_0x1a09a9){_0x1060cb=_0x1a09a9[_0x568f('0xd')]({'plain':!![]});if(_0x1060cb&&_0x1060cb[_0x568f('0x22')]){logger[_0x568f('0x23')](_0x568f('0x24'),_0x568f('0x25'),util[_0x568f('0x26')](_0x568f('0x27'),_0x4378fc['id'],_0x1060cb[_0x568f('0x22')]));if(_0x1060cb[_0x568f('0x1f')]&&_0x1060cb[_0x568f('0x1f')][_0x568f('0x28')]){_0x4378fc[_0x568f('0x29')]=_[_0x568f('0x2a')](_0x1060cb[_0x568f('0x1f')][0x0],_0x568f('0x20'));_0x4378fc['Contact']=_0x1060cb['Interactions'][0x0][_0x568f('0x20')];}var _0x48fe85={'method':_0x568f('0x2b'),'uri':encodeURI(_0x1060cb[_0x568f('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x48fe85['method']){case'GET':_0x48fe85['qs']=_0x4378fc;break;case _0x568f('0x2b'):_0x48fe85['body']=_0x4378fc;break;}return rp(_0x48fe85)['then'](function(_0x5ea140){logger[_0x568f('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x568f('0x25'),util['format'](_0x568f('0x2c'),_0x4378fc['id'],_0x1060cb[_0x568f('0x22')]));if(_0x5ea140[_0x568f('0xc')]['threadId']&&_0x5ea140[_0x568f('0xc')][_0x568f('0x2d')]!=_0x4378fc['Interaction'][_0x568f('0x2d')]){return _0x353547['OpenchannelInteraction'][_0x568f('0x17')]({'threadId':_0x5ea140['body']['threadId']},{'logging':!![],'where':{'id':_0x4378fc[_0x568f('0x29')]['id']}});}else{return;}})[_0x568f('0x16')](function(){return _0x1d8fa8[_0x568f('0x17')]({'read':!![]});})[_0x568f('0x18')](function(_0x1e90bf){logger[_0x568f('0x19')](_0x568f('0x24'),_0x568f('0x25'),util['inspect'](_0x1e90bf,{'showHidden':![],'depth':null}));_0x2b126f();});}else{_0x2b126f();}})[_0x568f('0x2e')](function(){_0x2b126f();});}else{_0x2b126f();}}},'charset':_0x568f('0x2f'),'collate':_0x568f('0x30')});}; \ No newline at end of file +var _0xe700=['OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','method','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','find'];(function(_0xdafc09,_0x26e1f6){var _0x2f1806=function(_0x543e8c){while(--_0x543e8c){_0xdafc09['push'](_0xdafc09['shift']());}};_0x2f1806(++_0x26e1f6);}(_0xe700,0x16a));var _0x0e70=function(_0x4b3531,_0x1667be){_0x4b3531=_0x4b3531-0x0;var _0x2cde39=_0xe700[_0x4b3531];return _0x2cde39;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var logger=require(_0x0e70('0x2'))(_0x0e70('0x3'));var moment=require(_0x0e70('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e70('0x6'));var config=require(_0x0e70('0x7'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0xf3ba11,_0xc96045){return _0xf3ba11[_0x0e70('0x8')](_0x0e70('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x0e70('0xa'),'fields':[_0x0e70('0xb')],'type':_0x0e70('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x175008,_0x151c76,_0x138187){var _0x34cac5=_0xf3ba11['models'];var _0x4364c9=_0x175008[_0x0e70('0xd')]({'plain':!![]});if(_0x4364c9[_0x0e70('0xe')]['toLowerCase']()==='in'||_0x4364c9[_0x0e70('0xe')][_0x0e70('0xf')]()===_0x0e70('0x10')&&!_0x4364c9[_0x0e70('0x11')]&&!_[_0x0e70('0x12')](_0x4364c9[_0x0e70('0x13')])){_0x34cac5['OpenchannelInteraction'][_0x0e70('0x14')]({'where':{'id':_0x4364c9[_0x0e70('0x15')]}})[_0x0e70('0x16')](function(_0x296f48){if(_0x296f48){_0x296f48[_0x0e70('0x17')]({'lastMsgAt':_0x4364c9[_0x0e70('0x18')],'lastMsgDirection':_0x4364c9['direction']['toLowerCase']()});}})[_0x0e70('0x19')](function(_0x17b763){console[_0x0e70('0x1a')](_0x17b763);});}if(_0x4364c9['direction']===_0x0e70('0x10')&&!_0x4364c9[_0x0e70('0x11')]){var _0x3c9545;_0x34cac5[_0x0e70('0x1b')][_0x0e70('0x1c')]()[_0x0e70('0x16')](function(_0x5300d6){return _0x34cac5['OpenchannelAccount'][_0x0e70('0x1d')]({'where':{'id':_0x4364c9[_0x0e70('0x1e')]},'include':[{'model':_0x34cac5[_0x0e70('0x1f')],'as':_0x0e70('0x20'),'where':{'id':_0x4364c9['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x34cac5[_0x0e70('0x1b')],'as':_0x0e70('0x21'),'attributes':_[_0x0e70('0x22')](_0x5300d6)}]}]});})[_0x0e70('0x16')](function(_0x1e51ab){_0x3c9545=_0x1e51ab[_0x0e70('0xd')]({'plain':!![]});if(_0x3c9545&&_0x3c9545[_0x0e70('0x23')]){logger['info'](_0x0e70('0x24'),_0x0e70('0x25'),util[_0x0e70('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x4364c9['id'],_0x3c9545[_0x0e70('0x23')]));if(_0x3c9545['Interactions']&&_0x3c9545[_0x0e70('0x20')][_0x0e70('0x27')]){_0x4364c9[_0x0e70('0x28')]=_[_0x0e70('0x29')](_0x3c9545['Interactions'][0x0],'Contact');_0x4364c9[_0x0e70('0x21')]=_0x3c9545[_0x0e70('0x20')][0x0][_0x0e70('0x21')];}var _0x151c76={'method':'POST','uri':encodeURI(_0x3c9545[_0x0e70('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x151c76[_0x0e70('0x2a')]){case'GET':_0x151c76['qs']=_0x4364c9;break;case _0x0e70('0x2b'):_0x151c76[_0x0e70('0xb')]=_0x4364c9;break;}return rp(_0x151c76)['then'](function(_0x492299){logger[_0x0e70('0x2c')](_0x0e70('0x24'),_0x0e70('0x25'),util[_0x0e70('0x26')](_0x0e70('0x2d'),_0x4364c9['id'],_0x3c9545[_0x0e70('0x23')]));if(_0x492299[_0x0e70('0xb')]['threadId']&&_0x492299[_0x0e70('0xb')]['threadId']!=_0x4364c9['Interaction'][_0x0e70('0x2e')]){return _0x34cac5[_0x0e70('0x1f')][_0x0e70('0x17')]({'threadId':_0x492299[_0x0e70('0xb')]['threadId']},{'logging':!![],'where':{'id':_0x4364c9[_0x0e70('0x28')]['id']}});}else{return;}})['then'](function(){return _0x175008[_0x0e70('0x17')]({'read':!![]});})['catch'](function(_0x34a11a){logger['error'](_0x0e70('0x24'),_0x0e70('0x25'),util[_0x0e70('0x2f')](_0x34a11a,{'showHidden':![],'depth':null}));_0x138187();});}else{_0x138187();}})[_0x0e70('0x30')](function(){_0x138187();});}else{_0x138187();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6276256..4ce5d38 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 _0x81c6=['client','redis','defaults','socket.io-emitter','./openchannelMessage.socket','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','raw','info','stringify','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x485e0b,_0x5eb3e3){var _0x12283c=function(_0x12b84b){while(--_0x12b84b){_0x485e0b['push'](_0x485e0b['shift']());}};_0x12283c(++_0x5eb3e3);}(_0x81c6,0x1d5));var _0x681c=function(_0x1f0639,_0x306cfb){_0x1f0639=_0x1f0639-0x0;var _0x1080c2=_0x81c6[_0x1f0639];return _0x1080c2;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});config[_0x681c('0x8')]=_[_0x681c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x681c('0xa'))(new Redis(config[_0x681c('0x8')]));require(_0x681c('0xb'))['register'](socket);function respondWithRpcPromise(_0x4f0228,_0x3e3770,_0x4ff60b){return new BPromise(function(_0x82b6ad,_0x83927a){return client[_0x681c('0xc')](_0x4f0228,_0x4ff60b)[_0x681c('0xd')](function(_0x48dc05){logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));logger[_0x681c('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3e3770,_0x681c('0xf'),JSON['stringify'](_0x48dc05));if(_0x48dc05[_0x681c('0x11')]){if(_0x48dc05['error'][_0x681c('0x12')]===0x1f4){logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x83927a(_0x48dc05[_0x681c('0x11')]['message']);}logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x82b6ad(_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);}else{logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));_0x82b6ad(_0x48dc05[_0x681c('0x14')][_0x681c('0x13')]);}})['catch'](function(_0x22e608){logger[_0x681c('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e3770,_0x22e608);_0x83927a(_0x22e608);});});}exports[_0x681c('0x15')]=function(_0x4c22c7){var _0x46cafc=this;return new Promise(function(_0x11836c,_0x11d68d){return db[_0x681c('0x16')][_0x681c('0x17')](_0x4c22c7['body'],{'raw':_0x4c22c7['options']?_0x4c22c7['options'][_0x681c('0x18')]===undefined?!![]:![]:!![]})[_0x681c('0xd')](function(_0x3adfe3){logger[_0x681c('0x19')](_0x681c('0x15'),_0x4c22c7);logger[_0x681c('0x10')](_0x681c('0x15'),_0x4c22c7,JSON[_0x681c('0x1a')](_0x3adfe3));_0x11836c(_0x3adfe3);})[_0x681c('0x1b')](function(_0x397ae3){logger[_0x681c('0x11')](_0x681c('0x15'),_0x397ae3[_0x681c('0x13')],_0x4c22c7);_0x11d68d(_0x46cafc[_0x681c('0x11')](0x1f4,_0x397ae3[_0x681c('0x13')]));});});}; \ No newline at end of file +var _0xcac3=['catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelMessage.socket','register','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','info','result'];(function(_0x5c58b3,_0x5635e5){var _0x46c871=function(_0x326543){while(--_0x326543){_0x5c58b3['push'](_0x5c58b3['shift']());}};_0x46c871(++_0x5635e5);}(_0xcac3,0x193));var _0x3cac=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xcac3[_0x919445];return _0x511b3e;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var moment=require(_0x3cac('0x1'));var BPromise=require(_0x3cac('0x2'));var rs=require(_0x3cac('0x3'));var fs=require('fs');var Redis=require(_0x3cac('0x4'));var db=require(_0x3cac('0x5'))['db'];var utils=require(_0x3cac('0x6'));var logger=require(_0x3cac('0x7'))(_0x3cac('0x8'));var config=require(_0x3cac('0x9'));var jayson=require(_0x3cac('0xa'));var client=jayson[_0x3cac('0xb')][_0x3cac('0xc')]({'port':0x232a});config[_0x3cac('0xd')]=_[_0x3cac('0xe')](config[_0x3cac('0xd')],{'host':_0x3cac('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3cac('0xd')]));require(_0x3cac('0x10'))[_0x3cac('0x11')](socket);function respondWithRpcPromise(_0x306664,_0x131e0d,_0x5a3ece){return new BPromise(function(_0x1e8fef,_0x169e39){return client[_0x3cac('0x12')](_0x306664,_0x5a3ece)[_0x3cac('0x13')](function(_0x1c5c70){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x131e0d,_0x3cac('0x14'));logger[_0x3cac('0x15')](_0x3cac('0x16'),_0x131e0d,_0x3cac('0x14'),JSON[_0x3cac('0x17')](_0x1c5c70));if(_0x1c5c70[_0x3cac('0x18')]){if(_0x1c5c70[_0x3cac('0x18')]['code']===0x1f4){logger[_0x3cac('0x18')](_0x3cac('0x19'),_0x131e0d,_0x1c5c70[_0x3cac('0x18')][_0x3cac('0x1a')]);return _0x169e39(_0x1c5c70[_0x3cac('0x18')][_0x3cac('0x1a')]);}logger[_0x3cac('0x18')](_0x3cac('0x19'),_0x131e0d,_0x1c5c70[_0x3cac('0x18')][_0x3cac('0x1a')]);return _0x1e8fef(_0x1c5c70[_0x3cac('0x18')][_0x3cac('0x1a')]);}else{logger[_0x3cac('0x1b')](_0x3cac('0x19'),_0x131e0d,_0x3cac('0x14'));_0x1e8fef(_0x1c5c70[_0x3cac('0x1c')][_0x3cac('0x1a')]);}})[_0x3cac('0x1d')](function(_0x3cb08f){logger[_0x3cac('0x18')](_0x3cac('0x19'),_0x131e0d,_0x3cb08f);_0x169e39(_0x3cb08f);});});}exports[_0x3cac('0x1e')]=function(_0x4fa448){var _0x14d84b=this;return new Promise(function(_0x25ae9c,_0x5af4b9){return db[_0x3cac('0x1f')][_0x3cac('0x20')](_0x4fa448[_0x3cac('0x21')],{'raw':_0x4fa448[_0x3cac('0x22')]?_0x4fa448[_0x3cac('0x22')][_0x3cac('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x19010f){logger['info']('CreateOpenchannelMessage',_0x4fa448);logger['debug'](_0x3cac('0x1e'),_0x4fa448,JSON[_0x3cac('0x17')](_0x19010f));_0x25ae9c(_0x19010f);})[_0x3cac('0x1d')](function(_0x12640a){logger[_0x3cac('0x18')](_0x3cac('0x1e'),_0x12640a[_0x3cac('0x1a')],_0x4fa448);_0x5af4b9(_0x14d84b[_0x3cac('0x18')](0x1f4,_0x12640a[_0x3cac('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index c24c2a1..c494ded 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 _0x70e0=['openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x1eda33,_0x368a6c){var _0xb24ed1=function(_0x6628d3){while(--_0x6628d3){_0x1eda33['push'](_0x1eda33['shift']());}};_0xb24ed1(++_0x368a6c);}(_0x70e0,0x17b));var _0x070e=function(_0x10a6b3,_0xe2111b){_0x10a6b3=_0x10a6b3-0x0;var _0xa884f6=_0x70e0[_0x10a6b3];return _0xa884f6;};'use strict';var OpenchannelMessageEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){OpenchannelMessageEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);OpenchannelMessageEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file +var _0x54ef=['remove','emit','removeListener','length','./openchannelMessage.events','save'];(function(_0x17042b,_0x595c02){var _0x246bf6=function(_0x2facf1){while(--_0x2facf1){_0x17042b['push'](_0x17042b['shift']());}};_0x246bf6(++_0x595c02);}(_0x54ef,0x112));var _0xf54e=function(_0x318a90,_0x1d5d96){_0x318a90=_0x318a90-0x0;var _0x5ec197=_0x54ef[_0x318a90];return _0x5ec197;};'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 8297bbb..b7c5465 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 _0x88d5=['getAgents','create','post','/:id/teams','/:id/users','addAgents','update','destroy','delete','removeTeams','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams'];(function(_0x37c3b2,_0xdaedbb){var _0x88a2af=function(_0x30b617){while(--_0x30b617){_0x37c3b2['push'](_0x37c3b2['shift']());}};_0x88a2af(++_0xdaedbb);}(_0x88d5,0x76));var _0x588d=function(_0x32a47d,_0x32e261){_0x32a47d=_0x32a47d-0x0;var _0x1a4559=_0x88d5[_0x32a47d];return _0x1a4559;};'use strict';var multer=require(_0x588d('0x0'));var util=require(_0x588d('0x1'));var path=require(_0x588d('0x2'));var timeout=require(_0x588d('0x3'));var express=require(_0x588d('0x4'));var router=express['Router']();var auth=require(_0x588d('0x5'));var interaction=require(_0x588d('0x6'));var config=require('../../config/environment');var controller=require(_0x588d('0x7'));router[_0x588d('0x8')]('/',auth[_0x588d('0x9')](),controller[_0x588d('0xa')]);router[_0x588d('0x8')](_0x588d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x588d('0x8')](_0x588d('0xc'),auth[_0x588d('0x9')](),controller[_0x588d('0xd')]);router['get'](_0x588d('0xe'),auth['isAuthenticated'](),controller[_0x588d('0xf')]);router[_0x588d('0x8')]('/:id/teams',auth[_0x588d('0x9')](),controller[_0x588d('0x10')]);router[_0x588d('0x8')]('/:id/users',auth[_0x588d('0x9')](),controller[_0x588d('0x11')]);router['post']('/',auth[_0x588d('0x9')](),controller[_0x588d('0x12')]);router[_0x588d('0x13')](_0x588d('0x14'),auth[_0x588d('0x9')](),controller['addTeams']);router['post'](_0x588d('0x15'),auth[_0x588d('0x9')](),controller[_0x588d('0x16')]);router['put']('/:id',auth[_0x588d('0x9')](),controller[_0x588d('0x17')]);router['delete'](_0x588d('0xc'),auth[_0x588d('0x9')](),controller[_0x588d('0x18')]);router[_0x588d('0x19')]('/:id/teams',auth[_0x588d('0x9')](),controller[_0x588d('0x1a')]);router['delete'](_0x588d('0x15'),auth[_0x588d('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5fab=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','update','delete','/:id','removeTeams','removeAgents','exports','multer','util'];(function(_0x5f584a,_0x47f064){var _0x3788d9=function(_0x29c10b){while(--_0x29c10b){_0x5f584a['push'](_0x5f584a['shift']());}};_0x3788d9(++_0x47f064);}(_0x5fab,0x177));var _0xb5fa=function(_0x873d48,_0x3cf3c0){_0x873d48=_0x873d48-0x0;var _0x50c8ca=_0x5fab[_0x873d48];return _0x50c8ca;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')]('/',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xb')]);router['get']('/describe',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0x9')]('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xd')]);router[_0xb5fa('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0x9')](_0xb5fa('0xf'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x9')](_0xb5fa('0x11'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x12')]);router['post']('/',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x13')]);router['post'](_0xb5fa('0xf'),auth['isAuthenticated'](),controller[_0xb5fa('0x14')]);router[_0xb5fa('0x15')](_0xb5fa('0x11'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x16')]);router['put']('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x17')]);router[_0xb5fa('0x18')](_0xb5fa('0x19'),auth['isAuthenticated'](),controller['destroy']);router[_0xb5fa('0x18')](_0xb5fa('0xf'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x1a')]);router[_0xb5fa('0x18')](_0xb5fa('0x11'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x1b')]);module[_0xb5fa('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7cd2ebe..a45d73d 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 _0x6ca3=['beepall','STRING','name','INTEGER','ENUM'];(function(_0x289643,_0x3d1ac6){var _0x4bbec3=function(_0x26376a){while(--_0x26376a){_0x289643['push'](_0x289643['shift']());}};_0x4bbec3(++_0x3d1ac6);}(_0x6ca3,0xba));var _0x36ca=function(_0x589589,_0x484d80){_0x589589=_0x589589-0x0;var _0x1ae411=_0x6ca3[_0x589589];return _0x1ae411;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x36ca('0x0')],'unique':_0x36ca('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x36ca('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x36ca('0x3')]('rrmemory',_0x36ca('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x6df9=['ENUM','beepall','sequelize','exports','name'];(function(_0x247765,_0x3c6713){var _0x30bd77=function(_0xc8baaa){while(--_0xc8baaa){_0x247765['push'](_0x247765['shift']());}};_0x30bd77(++_0x3c6713);}(_0x6df9,0x84));var _0x96df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6df9[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x96df('0x0'));module[_0x96df('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x96df('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x96df('0x3')]('rrmemory',_0x96df('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2fcd17c..2f7fc30 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 _0x2818=['length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','pick','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','set','Content-Range','reject','save','update','then','destroy','end','name','OpenchannelQueue','rawAttributes','fieldName','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show'];(function(_0x219977,_0x2ccc9b){var _0x50cde7=function(_0x1aa148){while(--_0x1aa148){_0x219977['push'](_0x219977['shift']());}};_0x50cde7(++_0x2ccc9b);}(_0x2818,0x153));var _0x8281=function(_0x178ef5,_0x1e7d1f){_0x178ef5=_0x178ef5-0x0;var _0x2094b3=_0x2818[_0x178ef5];return _0x2094b3;};'use strict';var pdf=require(_0x8281('0x0'));var emlformat=require(_0x8281('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8281('0x2'));var jsonpatch=require(_0x8281('0x3'));var rp=require(_0x8281('0x4'));var moment=require(_0x8281('0x5'));var BPromise=require(_0x8281('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8281('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8281('0x8'));var fs=require('fs');var _=require(_0x8281('0x9'));var squel=require(_0x8281('0xa'));var crypto=require(_0x8281('0xb'));var jsforce=require(_0x8281('0xc'));var deskjs=require(_0x8281('0xd'));var toCsv=require(_0x8281('0xe'));var querystring=require(_0x8281('0xf'));var Papa=require('papaparse');var Redis=require(_0x8281('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8281('0x11'));var hardwareService=require(_0x8281('0x12'));var logger=require(_0x8281('0x13'))(_0x8281('0x14'));var utils=require('../../config/utils');var config=require(_0x8281('0x15'));var db=require(_0x8281('0x16'))['db'];config[_0x8281('0x17')]=_[_0x8281('0x18')](config[_0x8281('0x17')],{'host':_0x8281('0x19'),'port':0x18eb});var socket=require(_0x8281('0x1a'))(new Redis(config[_0x8281('0x17')]));require(_0x8281('0x1b'))[_0x8281('0x1c')](socket);function respondWithStatusCode(_0x8ba5c7,_0x502b05){_0x502b05=_0x502b05||0xcc;return function(_0x578d0f){if(_0x578d0f){return _0x8ba5c7[_0x8281('0x1d')](_0x502b05);}return _0x8ba5c7[_0x8281('0x1e')](_0x502b05)['end']();};}function respondWithResult(_0x318a81,_0x246421){_0x246421=_0x246421||0xc8;return function(_0x494717){if(_0x494717){return _0x318a81['status'](_0x246421)[_0x8281('0x1f')](_0x494717);}};}function respondWithFilteredResult(_0xf66007,_0xd4aa17){return function(_0x1d1f33){if(_0x1d1f33){var _0x219c72=_0x1d1f33['count'],_0x254492=_0xd4aa17[_0x8281('0x20')],_0x4ae69a=_0xd4aa17['offset']+_0xd4aa17['limit'],_0x41eeb7;if(_0x4ae69a>=_0x219c72){_0x4ae69a=_0x219c72;_0x41eeb7=0xc8;}else{_0x41eeb7=0xce;}_0xf66007[_0x8281('0x1e')](_0x41eeb7);return _0xf66007[_0x8281('0x21')](_0x8281('0x22'),_0x254492+'-'+_0x4ae69a+'/'+_0x219c72)[_0x8281('0x1f')](_0x1d1f33);}return null;};}function patchUpdates(_0xc4d5b){return function(_0x46574d){try{jsonpatch['apply'](_0x46574d,_0xc4d5b,!![]);}catch(_0x2745e2){return BPromise[_0x8281('0x23')](_0x2745e2);}return _0x46574d[_0x8281('0x24')]();};}function saveUpdates(_0x3ad183,_0x5a71e5){return function(_0x504bae){if(_0x504bae){return _0x504bae[_0x8281('0x25')](_0x3ad183)[_0x8281('0x26')](function(_0x53a3bb){return _0x53a3bb;});}return null;};}function removeEntity(_0x5d447a,_0x5e730d){return function(_0x17a2e3){if(_0x17a2e3){return _0x17a2e3[_0x8281('0x27')]()[_0x8281('0x26')](function(){var _0x147cff=_0x17a2e3['get']({'plain':!![]});var _0x549c9d='OpenchannelQueues';return db['UserProfileResource'][_0x8281('0x27')]({'where':{'type':_0x549c9d,'resourceId':_0x147cff['id']}})['then'](function(){return _0x17a2e3;});})[_0x8281('0x26')](function(){_0x5d447a[_0x8281('0x1e')](0xcc)[_0x8281('0x28')]();});}};}function handleEntityNotFound(_0x15e508,_0x2a4e7f){return function(_0x4d8454){if(!_0x4d8454){_0x15e508[_0x8281('0x1d')](0x194);}return _0x4d8454;};}function handleError(_0x5ec1f3,_0x3ffb80){_0x3ffb80=_0x3ffb80||0x1f4;return function(_0x4452cd){logger['error'](_0x4452cd['stack']);if(_0x4452cd[_0x8281('0x29')]){delete _0x4452cd[_0x8281('0x29')];}_0x5ec1f3[_0x8281('0x1e')](_0x3ffb80)['send'](_0x4452cd);};}exports['index']=function(_0x18f864,_0x2d9f23){var _0x4cf032={},_0x17639b={},_0x5002e5={'count':0x0,'rows':[]};var _0xc71ded=_['map'](db[_0x8281('0x2a')][_0x8281('0x2b')],function(_0x2c1b49){return{'name':_0x2c1b49[_0x8281('0x2c')],'type':_0x2c1b49['type']['key']};});_0x17639b['model']=_[_0x8281('0x2d')](_0xc71ded,'name');_0x17639b[_0x8281('0x2e')]=_[_0x8281('0x2f')](_0x18f864[_0x8281('0x2e')]);_0x17639b['filters']=_[_0x8281('0x30')](_0x17639b['model'],_0x17639b[_0x8281('0x2e')]);_0x4cf032['attributes']=_[_0x8281('0x30')](_0x17639b[_0x8281('0x31')],qs[_0x8281('0x32')](_0x18f864[_0x8281('0x2e')][_0x8281('0x32')]));_0x4cf032[_0x8281('0x33')]=_0x4cf032[_0x8281('0x33')]['length']?_0x4cf032[_0x8281('0x33')]:_0x17639b[_0x8281('0x31')];if(!_0x18f864[_0x8281('0x2e')][_0x8281('0x34')]('nolimit')){_0x4cf032[_0x8281('0x35')]=qs['limit'](_0x18f864['query']['limit']);_0x4cf032['offset']=qs['offset'](_0x18f864['query'][_0x8281('0x20')]);}_0x4cf032[_0x8281('0x36')]=qs[_0x8281('0x37')](_0x18f864['query'][_0x8281('0x37')]);_0x4cf032['where']=qs['filters'](_['pick'](_0x18f864['query'],_0x17639b[_0x8281('0x38')]),_0xc71ded);if(_0x18f864[_0x8281('0x2e')][_0x8281('0x39')]){_0x4cf032[_0x8281('0x3a')]=_[_0x8281('0x3b')](_0x4cf032[_0x8281('0x3a')],{'$or':_['map'](_0xc71ded,function(_0x1fb14c){if(_0x1fb14c[_0x8281('0x3c')]!==_0x8281('0x3d')){var _0x59c241={};_0x59c241[_0x1fb14c['name']]={'$like':'%'+_0x18f864[_0x8281('0x2e')][_0x8281('0x39')]+'%'};return _0x59c241;}})});}_0x4cf032=_[_0x8281('0x3b')]({},_0x4cf032,_0x18f864[_0x8281('0x3e')]);var _0x8cc9a5={'where':_0x4cf032[_0x8281('0x3a')]};return db[_0x8281('0x2a')]['count'](_0x8cc9a5)[_0x8281('0x26')](function(_0x35a813){_0x5002e5[_0x8281('0x3f')]=_0x35a813;if(_0x18f864[_0x8281('0x2e')][_0x8281('0x40')]){_0x4cf032[_0x8281('0x41')]=[{'all':!![]}];}return db[_0x8281('0x2a')][_0x8281('0x42')](_0x4cf032);})[_0x8281('0x26')](function(_0x518ac8){_0x5002e5['rows']=_0x518ac8;return _0x5002e5;})[_0x8281('0x26')](respondWithFilteredResult(_0x2d9f23,_0x4cf032))[_0x8281('0x43')](handleError(_0x2d9f23,null));};exports[_0x8281('0x44')]=function(_0x485ae1,_0x1d34f5){var _0x3249a3={'raw':!![],'where':{'id':_0x485ae1['params']['id']}},_0x629f6={};_0x629f6[_0x8281('0x31')]=_[_0x8281('0x2f')](db[_0x8281('0x2a')][_0x8281('0x2b')]);_0x629f6['query']=_['keys'](_0x485ae1[_0x8281('0x2e')]);_0x629f6[_0x8281('0x38')]=_[_0x8281('0x30')](_0x629f6[_0x8281('0x31')],_0x629f6[_0x8281('0x2e')]);_0x3249a3[_0x8281('0x33')]=_[_0x8281('0x30')](_0x629f6['model'],qs['fields'](_0x485ae1[_0x8281('0x2e')][_0x8281('0x32')]));_0x3249a3[_0x8281('0x33')]=_0x3249a3[_0x8281('0x33')][_0x8281('0x45')]?_0x3249a3[_0x8281('0x33')]:_0x629f6['model'];if(_0x485ae1['query'][_0x8281('0x40')]){_0x3249a3[_0x8281('0x41')]=[{'all':!![]}];}_0x3249a3=_['merge']({},_0x3249a3,_0x485ae1[_0x8281('0x3e')]);return db[_0x8281('0x2a')][_0x8281('0x46')](_0x3249a3)['then'](handleEntityNotFound(_0x1d34f5,null))['then'](respondWithResult(_0x1d34f5,null))['catch'](handleError(_0x1d34f5,null));};exports[_0x8281('0x47')]=function(_0x46e282,_0x5c5165){return db[_0x8281('0x2a')][_0x8281('0x47')](_0x46e282[_0x8281('0x48')],{})['then'](function(_0x3d8198){var _0x107cd8=_0x46e282[_0x8281('0x49')][_0x8281('0x4a')]({'plain':!![]});if(!_0x107cd8)throw new Error(_0x8281('0x4b'));if(_0x107cd8[_0x8281('0x4c')]===_0x8281('0x49')){var _0x3f2bd3=_0x3d8198['get']({'plain':!![]});var _0x3f0b47='OpenchannelQueues';return db[_0x8281('0x4d')][_0x8281('0x46')]({'where':{'name':_0x3f0b47,'userProfileId':_0x107cd8[_0x8281('0x4e')]},'raw':!![]})[_0x8281('0x26')](function(_0xca7e99){if(_0xca7e99&&_0xca7e99[_0x8281('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f2bd3['name'],'resourceId':_0x3f2bd3['id'],'type':_0xca7e99[_0x8281('0x29')],'sectionId':_0xca7e99['id']},{})[_0x8281('0x26')](function(){return _0x3d8198;});}else{return _0x3d8198;}})[_0x8281('0x43')](function(_0x5ce4dc){logger[_0x8281('0x50')](_0x8281('0x51'),_0x5ce4dc);throw _0x5ce4dc;});}return _0x3d8198;})[_0x8281('0x26')](respondWithResult(_0x5c5165,0xc9))[_0x8281('0x43')](handleError(_0x5c5165,null));};exports[_0x8281('0x25')]=function(_0x106846,_0x3ae7fb){if(_0x106846[_0x8281('0x48')]['id']){delete _0x106846[_0x8281('0x48')]['id'];}return db[_0x8281('0x2a')][_0x8281('0x46')]({'where':{'id':_0x106846[_0x8281('0x52')]['id']}})[_0x8281('0x26')](handleEntityNotFound(_0x3ae7fb,null))[_0x8281('0x26')](saveUpdates(_0x106846[_0x8281('0x48')],null))[_0x8281('0x26')](respondWithResult(_0x3ae7fb,null))[_0x8281('0x43')](handleError(_0x3ae7fb,null));};exports['destroy']=function(_0xf16312,_0x2ef5bc){return db[_0x8281('0x2a')][_0x8281('0x46')]({'where':{'id':_0xf16312[_0x8281('0x52')]['id']}})[_0x8281('0x26')](handleEntityNotFound(_0x2ef5bc,null))[_0x8281('0x26')](removeEntity(_0x2ef5bc,null))[_0x8281('0x43')](handleError(_0x2ef5bc,null));};exports[_0x8281('0x53')]=function(_0x3ce1e0,_0x40b59a){return db[_0x8281('0x2a')]['describe']()[_0x8281('0x26')](respondWithResult(_0x40b59a,null))[_0x8281('0x43')](handleError(_0x40b59a,null));};exports[_0x8281('0x54')]=function(_0x2d76a7,_0xbc42,_0xe29484){var _0x4ff48b={'raw':!![],'where':{}},_0x330f91={},_0x405c2f;return db[_0x8281('0x2a')][_0x8281('0x55')]({'where':{'id':_0x2d76a7[_0x8281('0x52')]['id']}})['then'](handleEntityNotFound(_0xbc42,null))['then'](function(_0x82b7cd){if(_0x82b7cd){_0x405c2f=_0x82b7cd[_0x8281('0x4a')]({'plain':!![]});_0x330f91[_0x8281('0x31')]=_[_0x8281('0x2f')](db[_0x8281('0x56')][_0x8281('0x2b')]);_0x330f91['query']=_[_0x8281('0x2f')](_0x2d76a7[_0x8281('0x2e')]);_0x330f91[_0x8281('0x38')]=_['intersection'](_0x330f91[_0x8281('0x31')],_0x330f91[_0x8281('0x2e')]);_0x4ff48b[_0x8281('0x33')]=_[_0x8281('0x30')](_0x330f91[_0x8281('0x31')],qs[_0x8281('0x32')](_0x2d76a7[_0x8281('0x2e')]['fields']));_0x4ff48b['attributes']=_0x4ff48b[_0x8281('0x33')][_0x8281('0x45')]?_0x4ff48b[_0x8281('0x33')]:_0x330f91[_0x8281('0x31')];if(!_0x2d76a7[_0x8281('0x2e')]['hasOwnProperty'](_0x8281('0x57'))){_0x4ff48b[_0x8281('0x35')]=qs[_0x8281('0x35')](_0x2d76a7[_0x8281('0x2e')][_0x8281('0x35')]);_0x4ff48b['offset']=qs['offset'](_0x2d76a7[_0x8281('0x2e')]['offset']);}_0x4ff48b[_0x8281('0x36')]=qs[_0x8281('0x37')](_0x2d76a7[_0x8281('0x2e')][_0x8281('0x37')]);_0x4ff48b[_0x8281('0x3a')]=qs['filters'](_[_0x8281('0x58')](_0x2d76a7[_0x8281('0x2e')],_0x330f91[_0x8281('0x38')]));_0x4ff48b['where']['OpenchannelQueueId']=_0x82b7cd['id'];if(_0x2d76a7[_0x8281('0x2e')][_0x8281('0x39')]){_0x4ff48b['where']=_[_0x8281('0x3b')](_0x4ff48b['where'],{'$or':_[_0x8281('0x2d')](_0x4ff48b[_0x8281('0x33')],function(_0x3462e5){var _0x133b79={};_0x133b79[_0x3462e5]={'$like':'%'+_0x2d76a7[_0x8281('0x2e')]['filter']+'%'};return _0x133b79;})});}_0x4ff48b=_[_0x8281('0x3b')]({},_0x4ff48b,_0x2d76a7[_0x8281('0x3e')]);return db[_0x8281('0x56')][_0x8281('0x42')](_0x4ff48b);}})[_0x8281('0x26')](function(_0x217b0c){if(_0x217b0c){return db[_0x8281('0x59')][_0x8281('0x5a')]({'where':{'id':_[_0x8281('0x2d')](_0x217b0c,'UserId'),'role':_0x8281('0x5b')},'attributes':['id',_0x8281('0x29'),_0x8281('0x5c'),_0x8281('0x5d'),_0x8281('0x5e')]});}})[_0x8281('0x26')](function(_0x285cb2){if(_0x285cb2){return{'count':_0x285cb2[_0x8281('0x3f')],'rows':_[_0x8281('0x2d')](_0x285cb2[_0x8281('0x5f')],function(_0x484e72){return{'membername':_0x484e72[_0x8281('0x29')],'UserId':_0x484e72['id'],'queue_name':_0x405c2f[_0x8281('0x29')],'OpenchannelQueueId':_0x405c2f['id'],'interface':util[_0x8281('0x60')]('%s/%s',_0x8281('0x61'),_0x484e72['name']),'penalty':0x0,'paused':_0x484e72['openchannelPause'],'createdAt':_0x484e72['createdAt'],'updatedAt':_0x484e72[_0x8281('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8281('0x26')](respondWithFilteredResult(_0xbc42,_0x4ff48b))[_0x8281('0x43')](handleError(_0xbc42,null));};exports[_0x8281('0x62')]=function(_0x5f32f0,_0x51660c,_0xbbed1a){var _0x4c33d7={};var _0x2bff07={};var _0x460c22;var _0x32124b;return db[_0x8281('0x2a')]['findOne']({'where':{'id':_0x5f32f0[_0x8281('0x52')]['id']}})[_0x8281('0x26')](handleEntityNotFound(_0x51660c,null))[_0x8281('0x26')](function(_0x20ccb9){if(_0x20ccb9){_0x460c22=_0x20ccb9;_0x2bff07['model']=_[_0x8281('0x2f')](db[_0x8281('0x63')]['rawAttributes']);_0x2bff07[_0x8281('0x2e')]=_[_0x8281('0x2f')](_0x5f32f0[_0x8281('0x2e')]);_0x2bff07[_0x8281('0x38')]=_[_0x8281('0x30')](_0x2bff07[_0x8281('0x31')],_0x2bff07['query']);_0x4c33d7[_0x8281('0x33')]=_[_0x8281('0x30')](_0x2bff07[_0x8281('0x31')],qs['fields'](_0x5f32f0[_0x8281('0x2e')]['fields']));_0x4c33d7[_0x8281('0x33')]=_0x4c33d7['attributes'][_0x8281('0x45')]?_0x4c33d7[_0x8281('0x33')]:_0x2bff07[_0x8281('0x31')];_0x4c33d7[_0x8281('0x36')]=qs[_0x8281('0x37')](_0x5f32f0['query'][_0x8281('0x37')]);_0x4c33d7[_0x8281('0x3a')]=qs[_0x8281('0x38')](_[_0x8281('0x58')](_0x5f32f0[_0x8281('0x2e')],_0x2bff07['filters']));if(_0x5f32f0[_0x8281('0x2e')][_0x8281('0x39')]){_0x4c33d7[_0x8281('0x3a')]=_[_0x8281('0x3b')](_0x4c33d7[_0x8281('0x3a')],{'$or':_[_0x8281('0x2d')](_0x4c33d7[_0x8281('0x33')],function(_0x1bc219){var _0x13c9ba={};_0x13c9ba[_0x1bc219]={'$like':'%'+_0x5f32f0['query'][_0x8281('0x39')]+'%'};return _0x13c9ba;})});}_0x4c33d7=_[_0x8281('0x3b')]({},_0x4c33d7,_0x5f32f0['options']);return _0x460c22[_0x8281('0x62')](_0x4c33d7);}})['then'](function(_0x506c87){if(_0x506c87){_0x32124b=_0x506c87[_0x8281('0x45')];if(!_0x5f32f0[_0x8281('0x2e')][_0x8281('0x34')](_0x8281('0x57'))){_0x4c33d7['limit']=qs['limit'](_0x5f32f0[_0x8281('0x2e')]['limit']);_0x4c33d7[_0x8281('0x20')]=qs[_0x8281('0x20')](_0x5f32f0[_0x8281('0x2e')][_0x8281('0x20')]);}return _0x460c22['getTeams'](_0x4c33d7);}})[_0x8281('0x26')](function(_0x38cf18){if(_0x38cf18){return _0x38cf18?{'count':_0x32124b,'rows':_0x38cf18}:null;}})[_0x8281('0x26')](respondWithResult(_0x51660c,null))[_0x8281('0x43')](handleError(_0x51660c,null));};exports[_0x8281('0x64')]=function(_0x3df1de,_0x3c7972,_0x4abb29){var _0x275e4f=_0x3df1de[_0x8281('0x48')][_0x8281('0x65')];return db[_0x8281('0x63')][_0x8281('0x42')]({'where':{'id':_0x275e4f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8281('0x66'),'attributes':['id',_0x8281('0x29'),_0x8281('0x67'),_0x8281('0x68'),_0x8281('0x69')],'raw':!![]}]})[_0x8281('0x26')](function(_0x21b78c){if(_0x21b78c){var _0x342f89=_[_0x8281('0x6a')](_0x21b78c,function(_0x26d10e){var _0x5f4789=_0x26d10e[_0x8281('0x4a')]({'plain':!![]});return _0x5f4789[_0x8281('0x66')];});return db[_0x8281('0x2a')][_0x8281('0x46')]({'where':{'id':_0x3df1de[_0x8281('0x52')]['id']}})['then'](function(_0x3725d6){return db[_0x8281('0x6b')][_0x8281('0x6c')](function(_0x4447d5){return _0x3725d6[_0x8281('0x64')](_0x275e4f,{'transaction':_0x4447d5})[_0x8281('0x26')](function(){return BPromise[_0x8281('0x6d')](_0x342f89,function(_0x5d79e3){return db[_0x8281('0x56')][_0x8281('0x6e')]({'where':{'UserId':_0x5d79e3['id'],'OpenchannelQueueId':_0x3df1de['params']['id']},'transaction':_0x4447d5});});})['then'](function(){_0x342f89['forEach'](function(_0x497e6b){socket[_0x8281('0x6f')]('userOpenchannelQueue:save',{'UserId':_0x497e6b['id'],'OpenchannelQueueId':_0x3725d6['id']});});});});});}})[_0x8281('0x26')](respondWithStatusCode(_0x3c7972,null))[_0x8281('0x43')](handleError(_0x3c7972,null));};exports[_0x8281('0x70')]=function(_0x5653c3,_0x46efca,_0x461746){return db['Team'][_0x8281('0x42')]({'where':{'id':_0x5653c3['query'][_0x8281('0x65')]},'attributes':['id'],'include':[{'model':db[_0x8281('0x59')],'as':_0x8281('0x66'),'attributes':['id'],'raw':!![]}]})[_0x8281('0x26')](handleEntityNotFound(_0x46efca,null))[_0x8281('0x26')](function(_0x119c6c){var _0x2903d4=_['map'](_0x119c6c,'id');var _0x5a1457=[];var _0x3f2fde=[];var _0x4c8a10=squel[_0x8281('0x71')]();_0x4c8a10[_0x8281('0x72')]('tq.TeamId')[_0x8281('0x73')](_0x8281('0x74'),'tq')[_0x8281('0x75')]('user_has_teams','ut',_0x8281('0x76'))['where'](_0x8281('0x77'),_0x5653c3[_0x8281('0x52')]['id']);for(var _0x4bc86b=0x0;_0x4bc86b<_0x119c6c['length'];_0x4bc86b+=0x1){let _0x187ea7=_0x119c6c[_0x4bc86b];for(var _0x5d1566=0x0;_0x5d1566<_0x187ea7['Agents'][_0x8281('0x45')];_0x5d1566+=0x1){let _0x491487=_0x187ea7[_0x8281('0x66')][_0x5d1566];var _0x4a6b13=_0x4c8a10['clone']();_0x4a6b13[_0x8281('0x3a')](_0x8281('0x78'),_0x491487['id']);_0x3f2fde[_0x8281('0x79')](db['sequelize'][_0x8281('0x2e')](_0x4a6b13[_0x8281('0x7a')](),{'type':db[_0x8281('0x6b')][_0x8281('0x7b')]['SELECT']})['then'](function(_0xf1c553){if(_0xf1c553[_0x8281('0x45')]===0x1){return _0x491487['id'];}else{var _0x55b50b=_[_0x8281('0x7c')](_[_0x8281('0x2d')](_0xf1c553,_0x8281('0x7d')),function(_0x1f27c5){return _[_0x8281('0x7e')](_0x2903d4,_0x1f27c5);});if(_0x55b50b){return _0x491487['id'];}}}));}}return BPromise['all'](_0x3f2fde)[_0x8281('0x26')](function(_0x9d968e){_0x5a1457=_(_0x5a1457)['union'](_0x9d968e)['compact']()['value']();return db[_0x8281('0x2a')][_0x8281('0x46')]({'where':{'id':_0x5653c3['params']['id']}})[_0x8281('0x26')](function(_0x273c52){return db[_0x8281('0x6b')][_0x8281('0x6c')](function(_0x38311b){return _0x273c52[_0x8281('0x70')](_0x5653c3[_0x8281('0x2e')]['ids'],{'transaction':_0x38311b})[_0x8281('0x26')](function(){if(!_[_0x8281('0x7f')](_0x5a1457)){return _0x273c52[_0x8281('0x80')](_0x5a1457,{'transaction':_0x38311b});}})['then'](function(){_0x5a1457[_0x8281('0x81')](function(_0x350b12){socket[_0x8281('0x6f')](_0x8281('0x82'),{'UserId':_0x350b12,'OpenchannelQueueId':_0x273c52['id']});});});});});});})['then'](respondWithStatusCode(_0x46efca,null))[_0x8281('0x43')](handleError(_0x46efca,null));};exports[_0x8281('0x83')]=function(_0x39c5da,_0x5c8c8a,_0x23250b){return db[_0x8281('0x2a')][_0x8281('0x46')]({'where':{'id':_0x39c5da['params']['id']}})[_0x8281('0x26')](handleEntityNotFound(_0x5c8c8a,null))[_0x8281('0x26')](function(_0x52037b){if(_0x52037b){return _0x52037b[_0x8281('0x83')](_0x39c5da[_0x8281('0x48')][_0x8281('0x65')],_[_0x8281('0x84')](_0x39c5da[_0x8281('0x48')],[_0x8281('0x65'),'id'])||{})[_0x8281('0x85')](function(_0x807c7e){for(var _0x28315=0x0;_0x28315<_0x39c5da[_0x8281('0x48')][_0x8281('0x65')][_0x8281('0x45')];_0x28315+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x39c5da[_0x8281('0x48')][_0x8281('0x65')][_0x28315],'OpenchannelQueueId':_0x39c5da[_0x8281('0x52')]['id']});}return _0x807c7e;});}})['then'](respondWithResult(_0x5c8c8a,null))[_0x8281('0x43')](handleError(_0x5c8c8a,null));};exports[_0x8281('0x80')]=function(_0x5da38b,_0x380f54,_0x5e0c23){return db['OpenchannelQueue'][_0x8281('0x46')]({'where':{'id':_0x5da38b[_0x8281('0x52')]['id']}})['then'](handleEntityNotFound(_0x380f54,null))['then'](function(_0xc99241){if(_0xc99241){return _0xc99241[_0x8281('0x80')](_0x5da38b[_0x8281('0x2e')]['ids'])[_0x8281('0x26')](function(){if(_[_0x8281('0x86')](_0x5da38b[_0x8281('0x2e')][_0x8281('0x65')])){for(var _0x16b1cb=0x0;_0x16b1cb<_0x5da38b[_0x8281('0x2e')][_0x8281('0x65')]['length'];_0x16b1cb+=0x1){socket['emit'](_0x8281('0x82'),{'UserId':Number(_0x5da38b[_0x8281('0x2e')][_0x8281('0x65')][_0x16b1cb]),'OpenchannelQueueId':Number(_0x5da38b[_0x8281('0x52')]['id'])});}}else{socket[_0x8281('0x6f')](_0x8281('0x82'),{'UserId':Number(_0x5da38b[_0x8281('0x2e')][_0x8281('0x65')]),'OpenchannelQueueId':Number(_0x5da38b[_0x8281('0x52')]['id'])});}});}})[_0x8281('0x26')](respondWithStatusCode(_0x380f54,null))[_0x8281('0x43')](handleError(_0x380f54,null));};exports['getAgents']=function(_0x4da986,_0x73f2aa,_0x310b5c){var _0x150c01={};var _0x19b2d7={};var _0x9f7413;var _0x41e8ae;return db[_0x8281('0x2a')][_0x8281('0x55')]({'where':{'id':_0x4da986[_0x8281('0x52')]['id']}})['then'](handleEntityNotFound(_0x73f2aa,null))['then'](function(_0x1790b2){if(_0x1790b2){_0x9f7413=_0x1790b2;_0x19b2d7[_0x8281('0x31')]=_['keys'](db[_0x8281('0x59')]['rawAttributes']);_0x19b2d7['query']=_[_0x8281('0x2f')](_0x4da986['query']);_0x19b2d7[_0x8281('0x38')]=_[_0x8281('0x30')](_0x19b2d7[_0x8281('0x31')],_0x19b2d7['query']);_0x150c01['attributes']=_[_0x8281('0x30')](_0x19b2d7[_0x8281('0x31')],qs['fields'](_0x4da986[_0x8281('0x2e')][_0x8281('0x32')]));_0x150c01['attributes']=_0x150c01[_0x8281('0x33')][_0x8281('0x45')]?_0x150c01[_0x8281('0x33')]:_0x19b2d7[_0x8281('0x31')];_0x150c01[_0x8281('0x36')]=qs[_0x8281('0x37')](_0x4da986['query'][_0x8281('0x37')]);_0x150c01[_0x8281('0x3a')]=qs[_0x8281('0x38')](_[_0x8281('0x58')](_0x4da986['query'],_0x19b2d7[_0x8281('0x38')]));if(_0x4da986[_0x8281('0x2e')][_0x8281('0x39')]){_0x150c01[_0x8281('0x3a')]=_[_0x8281('0x3b')](_0x150c01[_0x8281('0x3a')],{'$or':_[_0x8281('0x2d')](_0x150c01['attributes'],function(_0x32d45a){var _0x5e633e={};_0x5e633e[_0x32d45a]={'$like':'%'+_0x4da986[_0x8281('0x2e')]['filter']+'%'};return _0x5e633e;})});}_0x150c01=_['merge']({},_0x150c01,_0x4da986['options']);return _0x9f7413['getAgents'](_0x150c01);}})[_0x8281('0x26')](function(_0x56ad3b){if(_0x56ad3b){_0x41e8ae=_0x56ad3b['length'];if(!_0x4da986['query'][_0x8281('0x34')](_0x8281('0x57'))){_0x150c01[_0x8281('0x35')]=qs[_0x8281('0x35')](_0x4da986[_0x8281('0x2e')]['limit']);_0x150c01['offset']=qs[_0x8281('0x20')](_0x4da986[_0x8281('0x2e')][_0x8281('0x20')]);}return _0x9f7413[_0x8281('0x87')](_0x150c01);}})[_0x8281('0x26')](function(_0x22b760){if(_0x22b760){return _0x22b760?{'count':_0x41e8ae,'rows':_0x22b760}:null;}})[_0x8281('0x26')](respondWithResult(_0x73f2aa,null))[_0x8281('0x43')](handleError(_0x73f2aa,null));}; \ No newline at end of file +var _0x3d2f=['findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','params','describe','getMembers','UserOpenchannelQueue','order','OpenchannelQueueId','filter','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','all','union','value','removeTeams','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','stack','name','index','map','OpenchannelQueue','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','options','include'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3d2f,0x166));var _0xf3d2=function(_0x21c21d,_0x5569f7){_0x21c21d=_0x21c21d-0x0;var _0x4101fb=_0x3d2f[_0x21c21d];return _0x4101fb;};'use strict';var pdf=require(_0xf3d2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf3d2('0x1'));var jsonpatch=require(_0xf3d2('0x2'));var rp=require('request-promise');var moment=require(_0xf3d2('0x3'));var BPromise=require(_0xf3d2('0x4'));var Mustache=require(_0xf3d2('0x5'));var util=require(_0xf3d2('0x6'));var path=require(_0xf3d2('0x7'));var sox=require(_0xf3d2('0x8'));var csv=require(_0xf3d2('0x9'));var ejs=require(_0xf3d2('0xa'));var fs=require('fs');var _=require(_0xf3d2('0xb'));var squel=require('squel');var crypto=require(_0xf3d2('0xc'));var jsforce=require(_0xf3d2('0xd'));var deskjs=require(_0xf3d2('0xe'));var toCsv=require(_0xf3d2('0x9'));var querystring=require(_0xf3d2('0xf'));var Papa=require(_0xf3d2('0x10'));var Redis=require(_0xf3d2('0x11'));var authService=require(_0xf3d2('0x12'));var qs=require(_0xf3d2('0x13'));var as=require(_0xf3d2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf3d2('0x15'));var utils=require(_0xf3d2('0x16'));var config=require(_0xf3d2('0x17'));var db=require(_0xf3d2('0x18'))['db'];config[_0xf3d2('0x19')]=_[_0xf3d2('0x1a')](config[_0xf3d2('0x19')],{'host':_0xf3d2('0x1b'),'port':0x18eb});var socket=require(_0xf3d2('0x1c'))(new Redis(config[_0xf3d2('0x19')]));require(_0xf3d2('0x1d'))[_0xf3d2('0x1e')](socket);function respondWithStatusCode(_0x33cfed,_0x2fd1ac){_0x2fd1ac=_0x2fd1ac||0xcc;return function(_0x4761bd){if(_0x4761bd){return _0x33cfed[_0xf3d2('0x1f')](_0x2fd1ac);}return _0x33cfed[_0xf3d2('0x20')](_0x2fd1ac)[_0xf3d2('0x21')]();};}function respondWithResult(_0xf14666,_0x4ddca2){_0x4ddca2=_0x4ddca2||0xc8;return function(_0x2246f5){if(_0x2246f5){return _0xf14666[_0xf3d2('0x20')](_0x4ddca2)[_0xf3d2('0x22')](_0x2246f5);}};}function respondWithFilteredResult(_0x586c16,_0x25c2ba){return function(_0x3ad413){if(_0x3ad413){var _0x4a1917=_0x3ad413[_0xf3d2('0x23')],_0x411276=_0x25c2ba[_0xf3d2('0x24')],_0x2bcd21=_0x25c2ba[_0xf3d2('0x24')]+_0x25c2ba['limit'],_0x1ab926;if(_0x2bcd21>=_0x4a1917){_0x2bcd21=_0x4a1917;_0x1ab926=0xc8;}else{_0x1ab926=0xce;}_0x586c16[_0xf3d2('0x20')](_0x1ab926);return _0x586c16[_0xf3d2('0x25')]('Content-Range',_0x411276+'-'+_0x2bcd21+'/'+_0x4a1917)[_0xf3d2('0x22')](_0x3ad413);}return null;};}function patchUpdates(_0xe01782){return function(_0x9d5ed){try{jsonpatch[_0xf3d2('0x26')](_0x9d5ed,_0xe01782,!![]);}catch(_0x607190){return BPromise[_0xf3d2('0x27')](_0x607190);}return _0x9d5ed[_0xf3d2('0x28')]();};}function saveUpdates(_0x4c9efc,_0x5ed9c4){return function(_0xda02e4){if(_0xda02e4){return _0xda02e4[_0xf3d2('0x29')](_0x4c9efc)[_0xf3d2('0x2a')](function(_0x5dffcc){return _0x5dffcc;});}return null;};}function removeEntity(_0x266309,_0x4c2e25){return function(_0x58ff06){if(_0x58ff06){return _0x58ff06[_0xf3d2('0x2b')]()[_0xf3d2('0x2a')](function(){var _0x145379=_0x58ff06[_0xf3d2('0x2c')]({'plain':!![]});var _0x4e5c19='OpenchannelQueues';return db['UserProfileResource'][_0xf3d2('0x2b')]({'where':{'type':_0x4e5c19,'resourceId':_0x145379['id']}})[_0xf3d2('0x2a')](function(){return _0x58ff06;});})[_0xf3d2('0x2a')](function(){_0x266309[_0xf3d2('0x20')](0xcc)[_0xf3d2('0x21')]();});}};}function handleEntityNotFound(_0x2196fb,_0x6cd11a){return function(_0x396eb9){if(!_0x396eb9){_0x2196fb['sendStatus'](0x194);}return _0x396eb9;};}function handleError(_0xbcd8db,_0xd20ad3){_0xd20ad3=_0xd20ad3||0x1f4;return function(_0x4a261c){logger['error'](_0x4a261c[_0xf3d2('0x2d')]);if(_0x4a261c[_0xf3d2('0x2e')]){delete _0x4a261c[_0xf3d2('0x2e')];}_0xbcd8db['status'](_0xd20ad3)['send'](_0x4a261c);};}exports[_0xf3d2('0x2f')]=function(_0x1369d4,_0x1eb713){var _0x2050b7={},_0x38d8ee={},_0x44616b={'count':0x0,'rows':[]};var _0x4d6263=_[_0xf3d2('0x30')](db[_0xf3d2('0x31')]['rawAttributes'],function(_0x371b8c){return{'name':_0x371b8c[_0xf3d2('0x32')],'type':_0x371b8c[_0xf3d2('0x33')][_0xf3d2('0x34')]};});_0x38d8ee[_0xf3d2('0x35')]=_[_0xf3d2('0x30')](_0x4d6263,'name');_0x38d8ee[_0xf3d2('0x36')]=_[_0xf3d2('0x37')](_0x1369d4[_0xf3d2('0x36')]);_0x38d8ee[_0xf3d2('0x38')]=_['intersection'](_0x38d8ee['model'],_0x38d8ee[_0xf3d2('0x36')]);_0x2050b7['attributes']=_[_0xf3d2('0x39')](_0x38d8ee['model'],qs[_0xf3d2('0x3a')](_0x1369d4[_0xf3d2('0x36')][_0xf3d2('0x3a')]));_0x2050b7[_0xf3d2('0x3b')]=_0x2050b7[_0xf3d2('0x3b')][_0xf3d2('0x3c')]?_0x2050b7[_0xf3d2('0x3b')]:_0x38d8ee['model'];if(!_0x1369d4[_0xf3d2('0x36')][_0xf3d2('0x3d')](_0xf3d2('0x3e'))){_0x2050b7['limit']=qs[_0xf3d2('0x3f')](_0x1369d4[_0xf3d2('0x36')][_0xf3d2('0x3f')]);_0x2050b7[_0xf3d2('0x24')]=qs['offset'](_0x1369d4[_0xf3d2('0x36')][_0xf3d2('0x24')]);}_0x2050b7['order']=qs[_0xf3d2('0x40')](_0x1369d4[_0xf3d2('0x36')]['sort']);_0x2050b7['where']=qs[_0xf3d2('0x38')](_[_0xf3d2('0x41')](_0x1369d4[_0xf3d2('0x36')],_0x38d8ee[_0xf3d2('0x38')]),_0x4d6263);if(_0x1369d4[_0xf3d2('0x36')]['filter']){_0x2050b7[_0xf3d2('0x42')]=_[_0xf3d2('0x43')](_0x2050b7[_0xf3d2('0x42')],{'$or':_[_0xf3d2('0x30')](_0x4d6263,function(_0x56cb59){if(_0x56cb59[_0xf3d2('0x33')]!==_0xf3d2('0x44')){var _0x2a52b7={};_0x2a52b7[_0x56cb59[_0xf3d2('0x2e')]]={'$like':'%'+_0x1369d4['query']['filter']+'%'};return _0x2a52b7;}})});}_0x2050b7=_[_0xf3d2('0x43')]({},_0x2050b7,_0x1369d4[_0xf3d2('0x45')]);var _0x541137={'where':_0x2050b7[_0xf3d2('0x42')]};return db[_0xf3d2('0x31')][_0xf3d2('0x23')](_0x541137)[_0xf3d2('0x2a')](function(_0xd661bc){_0x44616b[_0xf3d2('0x23')]=_0xd661bc;if(_0x1369d4['query']['includeAll']){_0x2050b7[_0xf3d2('0x46')]=[{'all':!![]}];}return db[_0xf3d2('0x31')][_0xf3d2('0x47')](_0x2050b7);})['then'](function(_0x9b166f){_0x44616b[_0xf3d2('0x48')]=_0x9b166f;return _0x44616b;})[_0xf3d2('0x2a')](respondWithFilteredResult(_0x1eb713,_0x2050b7))['catch'](handleError(_0x1eb713,null));};exports[_0xf3d2('0x49')]=function(_0x439b28,_0x3fbbf3){var _0x417173={'raw':!![],'where':{'id':_0x439b28['params']['id']}},_0x1dc2f1={};_0x1dc2f1['model']=_['keys'](db['OpenchannelQueue'][_0xf3d2('0x4a')]);_0x1dc2f1[_0xf3d2('0x36')]=_['keys'](_0x439b28[_0xf3d2('0x36')]);_0x1dc2f1[_0xf3d2('0x38')]=_[_0xf3d2('0x39')](_0x1dc2f1[_0xf3d2('0x35')],_0x1dc2f1[_0xf3d2('0x36')]);_0x417173[_0xf3d2('0x3b')]=_[_0xf3d2('0x39')](_0x1dc2f1[_0xf3d2('0x35')],qs[_0xf3d2('0x3a')](_0x439b28[_0xf3d2('0x36')][_0xf3d2('0x3a')]));_0x417173[_0xf3d2('0x3b')]=_0x417173[_0xf3d2('0x3b')]['length']?_0x417173[_0xf3d2('0x3b')]:_0x1dc2f1['model'];if(_0x439b28['query'][_0xf3d2('0x4b')]){_0x417173['include']=[{'all':!![]}];}_0x417173=_['merge']({},_0x417173,_0x439b28['options']);return db[_0xf3d2('0x31')][_0xf3d2('0x4c')](_0x417173)[_0xf3d2('0x2a')](handleEntityNotFound(_0x3fbbf3,null))[_0xf3d2('0x2a')](respondWithResult(_0x3fbbf3,null))[_0xf3d2('0x4d')](handleError(_0x3fbbf3,null));};exports[_0xf3d2('0x4e')]=function(_0xd89002,_0x2da0c3){return db[_0xf3d2('0x31')][_0xf3d2('0x4e')](_0xd89002[_0xf3d2('0x4f')],{})['then'](function(_0x53d0e6){var _0xa823bd=_0xd89002[_0xf3d2('0x50')][_0xf3d2('0x2c')]({'plain':!![]});if(!_0xa823bd)throw new Error(_0xf3d2('0x51'));if(_0xa823bd[_0xf3d2('0x52')]===_0xf3d2('0x50')){var _0x527eed=_0x53d0e6[_0xf3d2('0x2c')]({'plain':!![]});var _0x48986b='OpenchannelQueues';return db[_0xf3d2('0x53')][_0xf3d2('0x4c')]({'where':{'name':_0x48986b,'userProfileId':_0xa823bd[_0xf3d2('0x54')]},'raw':!![]})[_0xf3d2('0x2a')](function(_0x3ddbe8){if(_0x3ddbe8&&_0x3ddbe8[_0xf3d2('0x55')]===0x0){return db[_0xf3d2('0x56')]['create']({'name':_0x527eed['name'],'resourceId':_0x527eed['id'],'type':_0x3ddbe8[_0xf3d2('0x2e')],'sectionId':_0x3ddbe8['id']},{})[_0xf3d2('0x2a')](function(){return _0x53d0e6;});}else{return _0x53d0e6;}})['catch'](function(_0x33eace){logger[_0xf3d2('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33eace);throw _0x33eace;});}return _0x53d0e6;})[_0xf3d2('0x2a')](respondWithResult(_0x2da0c3,0xc9))[_0xf3d2('0x4d')](handleError(_0x2da0c3,null));};exports[_0xf3d2('0x29')]=function(_0x5e4b12,_0x5899da){if(_0x5e4b12[_0xf3d2('0x4f')]['id']){delete _0x5e4b12['body']['id'];}return db[_0xf3d2('0x31')][_0xf3d2('0x4c')]({'where':{'id':_0x5e4b12[_0xf3d2('0x58')]['id']}})['then'](handleEntityNotFound(_0x5899da,null))[_0xf3d2('0x2a')](saveUpdates(_0x5e4b12[_0xf3d2('0x4f')],null))[_0xf3d2('0x2a')](respondWithResult(_0x5899da,null))[_0xf3d2('0x4d')](handleError(_0x5899da,null));};exports[_0xf3d2('0x2b')]=function(_0x322d76,_0x50ed74){return db[_0xf3d2('0x31')]['find']({'where':{'id':_0x322d76[_0xf3d2('0x58')]['id']}})['then'](handleEntityNotFound(_0x50ed74,null))['then'](removeEntity(_0x50ed74,null))[_0xf3d2('0x4d')](handleError(_0x50ed74,null));};exports[_0xf3d2('0x59')]=function(_0x148f8e,_0x51287c){return db['OpenchannelQueue'][_0xf3d2('0x59')]()[_0xf3d2('0x2a')](respondWithResult(_0x51287c,null))[_0xf3d2('0x4d')](handleError(_0x51287c,null));};exports[_0xf3d2('0x5a')]=function(_0x15dc19,_0x2a4b4b,_0x43464f){var _0x191ada={'raw':!![],'where':{}},_0x3ada4e={},_0xc8c115;return db[_0xf3d2('0x31')]['findOne']({'where':{'id':_0x15dc19['params']['id']}})['then'](handleEntityNotFound(_0x2a4b4b,null))['then'](function(_0x355d9d){if(_0x355d9d){_0xc8c115=_0x355d9d['get']({'plain':!![]});_0x3ada4e['model']=_['keys'](db[_0xf3d2('0x5b')][_0xf3d2('0x4a')]);_0x3ada4e[_0xf3d2('0x36')]=_[_0xf3d2('0x37')](_0x15dc19['query']);_0x3ada4e[_0xf3d2('0x38')]=_[_0xf3d2('0x39')](_0x3ada4e[_0xf3d2('0x35')],_0x3ada4e[_0xf3d2('0x36')]);_0x191ada[_0xf3d2('0x3b')]=_[_0xf3d2('0x39')](_0x3ada4e[_0xf3d2('0x35')],qs[_0xf3d2('0x3a')](_0x15dc19[_0xf3d2('0x36')]['fields']));_0x191ada[_0xf3d2('0x3b')]=_0x191ada['attributes']['length']?_0x191ada['attributes']:_0x3ada4e['model'];if(!_0x15dc19[_0xf3d2('0x36')][_0xf3d2('0x3d')](_0xf3d2('0x3e'))){_0x191ada[_0xf3d2('0x3f')]=qs['limit'](_0x15dc19[_0xf3d2('0x36')]['limit']);_0x191ada[_0xf3d2('0x24')]=qs['offset'](_0x15dc19['query']['offset']);}_0x191ada[_0xf3d2('0x5c')]=qs[_0xf3d2('0x40')](_0x15dc19[_0xf3d2('0x36')]['sort']);_0x191ada[_0xf3d2('0x42')]=qs[_0xf3d2('0x38')](_['pick'](_0x15dc19[_0xf3d2('0x36')],_0x3ada4e[_0xf3d2('0x38')]));_0x191ada[_0xf3d2('0x42')][_0xf3d2('0x5d')]=_0x355d9d['id'];if(_0x15dc19[_0xf3d2('0x36')][_0xf3d2('0x5e')]){_0x191ada[_0xf3d2('0x42')]=_[_0xf3d2('0x43')](_0x191ada[_0xf3d2('0x42')],{'$or':_['map'](_0x191ada['attributes'],function(_0x430b77){var _0x1a1423={};_0x1a1423[_0x430b77]={'$like':'%'+_0x15dc19[_0xf3d2('0x36')]['filter']+'%'};return _0x1a1423;})});}_0x191ada=_['merge']({},_0x191ada,_0x15dc19['options']);return db[_0xf3d2('0x5b')][_0xf3d2('0x47')](_0x191ada);}})[_0xf3d2('0x2a')](function(_0x380c9f){if(_0x380c9f){return db[_0xf3d2('0x5f')]['findAndCountAll']({'where':{'id':_[_0xf3d2('0x30')](_0x380c9f,_0xf3d2('0x60')),'role':_0xf3d2('0x61')},'attributes':['id','name',_0xf3d2('0x62'),_0xf3d2('0x63'),_0xf3d2('0x64')]});}})[_0xf3d2('0x2a')](function(_0x571c9c){if(_0x571c9c){return{'count':_0x571c9c['count'],'rows':_['map'](_0x571c9c[_0xf3d2('0x48')],function(_0x47bbb5){return{'membername':_0x47bbb5[_0xf3d2('0x2e')],'UserId':_0x47bbb5['id'],'queue_name':_0xc8c115[_0xf3d2('0x2e')],'OpenchannelQueueId':_0xc8c115['id'],'interface':util[_0xf3d2('0x65')]('%s/%s',_0xf3d2('0x66'),_0x47bbb5[_0xf3d2('0x2e')]),'penalty':0x0,'paused':_0x47bbb5['openchannelPause'],'createdAt':_0x47bbb5['createdAt'],'updatedAt':_0x47bbb5[_0xf3d2('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf3d2('0x2a')](respondWithFilteredResult(_0x2a4b4b,_0x191ada))[_0xf3d2('0x4d')](handleError(_0x2a4b4b,null));};exports[_0xf3d2('0x67')]=function(_0x4f2670,_0x569b9f,_0x418973){var _0x4559f7={};var _0x264483={};var _0x463cdc;var _0xe2295d;return db[_0xf3d2('0x31')][_0xf3d2('0x68')]({'where':{'id':_0x4f2670[_0xf3d2('0x58')]['id']}})[_0xf3d2('0x2a')](handleEntityNotFound(_0x569b9f,null))[_0xf3d2('0x2a')](function(_0x278e90){if(_0x278e90){_0x463cdc=_0x278e90;_0x264483[_0xf3d2('0x35')]=_[_0xf3d2('0x37')](db[_0xf3d2('0x69')][_0xf3d2('0x4a')]);_0x264483[_0xf3d2('0x36')]=_[_0xf3d2('0x37')](_0x4f2670[_0xf3d2('0x36')]);_0x264483['filters']=_[_0xf3d2('0x39')](_0x264483[_0xf3d2('0x35')],_0x264483[_0xf3d2('0x36')]);_0x4559f7[_0xf3d2('0x3b')]=_[_0xf3d2('0x39')](_0x264483['model'],qs['fields'](_0x4f2670[_0xf3d2('0x36')][_0xf3d2('0x3a')]));_0x4559f7[_0xf3d2('0x3b')]=_0x4559f7[_0xf3d2('0x3b')][_0xf3d2('0x3c')]?_0x4559f7[_0xf3d2('0x3b')]:_0x264483[_0xf3d2('0x35')];_0x4559f7[_0xf3d2('0x5c')]=qs['sort'](_0x4f2670[_0xf3d2('0x36')][_0xf3d2('0x40')]);_0x4559f7[_0xf3d2('0x42')]=qs[_0xf3d2('0x38')](_[_0xf3d2('0x41')](_0x4f2670[_0xf3d2('0x36')],_0x264483[_0xf3d2('0x38')]));if(_0x4f2670[_0xf3d2('0x36')][_0xf3d2('0x5e')]){_0x4559f7['where']=_[_0xf3d2('0x43')](_0x4559f7[_0xf3d2('0x42')],{'$or':_[_0xf3d2('0x30')](_0x4559f7['attributes'],function(_0x1013aa){var _0x4b694c={};_0x4b694c[_0x1013aa]={'$like':'%'+_0x4f2670[_0xf3d2('0x36')]['filter']+'%'};return _0x4b694c;})});}_0x4559f7=_['merge']({},_0x4559f7,_0x4f2670['options']);return _0x463cdc[_0xf3d2('0x67')](_0x4559f7);}})[_0xf3d2('0x2a')](function(_0x598947){if(_0x598947){_0xe2295d=_0x598947[_0xf3d2('0x3c')];if(!_0x4f2670[_0xf3d2('0x36')]['hasOwnProperty'](_0xf3d2('0x3e'))){_0x4559f7['limit']=qs[_0xf3d2('0x3f')](_0x4f2670[_0xf3d2('0x36')]['limit']);_0x4559f7[_0xf3d2('0x24')]=qs[_0xf3d2('0x24')](_0x4f2670['query'][_0xf3d2('0x24')]);}return _0x463cdc[_0xf3d2('0x67')](_0x4559f7);}})['then'](function(_0xe944cb){if(_0xe944cb){return _0xe944cb?{'count':_0xe2295d,'rows':_0xe944cb}:null;}})[_0xf3d2('0x2a')](respondWithResult(_0x569b9f,null))[_0xf3d2('0x4d')](handleError(_0x569b9f,null));};exports[_0xf3d2('0x6a')]=function(_0x5bacf5,_0x27c0c0,_0x2ba9d6){var _0x439952=_0x5bacf5[_0xf3d2('0x4f')][_0xf3d2('0x6b')];return db[_0xf3d2('0x69')][_0xf3d2('0x47')]({'where':{'id':_0x439952},'attributes':['id'],'include':[{'model':db[_0xf3d2('0x5f')],'as':_0xf3d2('0x6c'),'attributes':['id',_0xf3d2('0x2e'),_0xf3d2('0x6d'),_0xf3d2('0x6e'),_0xf3d2('0x6f')],'raw':!![]}]})[_0xf3d2('0x2a')](function(_0x87a8a4){if(_0x87a8a4){var _0x193721=_['flatMap'](_0x87a8a4,function(_0x408c2c){var _0x8bf8f5=_0x408c2c['get']({'plain':!![]});return _0x8bf8f5[_0xf3d2('0x6c')];});return db[_0xf3d2('0x31')][_0xf3d2('0x4c')]({'where':{'id':_0x5bacf5[_0xf3d2('0x58')]['id']}})[_0xf3d2('0x2a')](function(_0x3a1a3c){return db['sequelize'][_0xf3d2('0x70')](function(_0x351822){return _0x3a1a3c['addTeams'](_0x439952,{'transaction':_0x351822})[_0xf3d2('0x2a')](function(){return BPromise[_0xf3d2('0x71')](_0x193721,function(_0x2608a1){return db['UserOpenchannelQueue'][_0xf3d2('0x72')]({'where':{'UserId':_0x2608a1['id'],'OpenchannelQueueId':_0x5bacf5['params']['id']},'transaction':_0x351822});});})[_0xf3d2('0x2a')](function(){_0x193721[_0xf3d2('0x73')](function(_0x1706ef){socket[_0xf3d2('0x74')]('userOpenchannelQueue:save',{'UserId':_0x1706ef['id'],'OpenchannelQueueId':_0x3a1a3c['id']});});});});});}})[_0xf3d2('0x2a')](respondWithStatusCode(_0x27c0c0,null))[_0xf3d2('0x4d')](handleError(_0x27c0c0,null));};exports['removeTeams']=function(_0x2503bf,_0x2da877,_0x1d521e){return db[_0xf3d2('0x69')][_0xf3d2('0x47')]({'where':{'id':_0x2503bf[_0xf3d2('0x36')][_0xf3d2('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xf3d2('0x5f')],'as':_0xf3d2('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf3d2('0x2a')](handleEntityNotFound(_0x2da877,null))['then'](function(_0x3719ef){var _0x150c22=_[_0xf3d2('0x30')](_0x3719ef,'id');var _0x48ab0f=[];var _0x26da82=[];var _0x3fb038=squel[_0xf3d2('0x75')]();_0x3fb038[_0xf3d2('0x76')]('tq.TeamId')[_0xf3d2('0x77')](_0xf3d2('0x78'),'tq')[_0xf3d2('0x79')](_0xf3d2('0x7a'),'ut',_0xf3d2('0x7b'))[_0xf3d2('0x42')](_0xf3d2('0x7c'),_0x2503bf['params']['id']);for(var _0x1d09af=0x0;_0x1d09af<_0x3719ef[_0xf3d2('0x3c')];_0x1d09af+=0x1){let _0x1f05b1=_0x3719ef[_0x1d09af];for(var _0x190516=0x0;_0x190516<_0x1f05b1[_0xf3d2('0x6c')]['length'];_0x190516+=0x1){let _0x1922e8=_0x1f05b1['Agents'][_0x190516];var _0x39efe6=_0x3fb038[_0xf3d2('0x7d')]();_0x39efe6[_0xf3d2('0x42')](_0xf3d2('0x7e'),_0x1922e8['id']);_0x26da82[_0xf3d2('0x7f')](db[_0xf3d2('0x80')][_0xf3d2('0x36')](_0x39efe6[_0xf3d2('0x81')](),{'type':db[_0xf3d2('0x80')]['QueryTypes']['SELECT']})[_0xf3d2('0x2a')](function(_0x2d002e){if(_0x2d002e[_0xf3d2('0x3c')]===0x1){return _0x1922e8['id'];}else{var _0x4d03c3=_[_0xf3d2('0x82')](_[_0xf3d2('0x30')](_0x2d002e,_0xf3d2('0x83')),function(_0xbde95){return _['includes'](_0x150c22,_0xbde95);});if(_0x4d03c3){return _0x1922e8['id'];}}}));}}return BPromise[_0xf3d2('0x84')](_0x26da82)[_0xf3d2('0x2a')](function(_0x2e0b4a){_0x48ab0f=_(_0x48ab0f)[_0xf3d2('0x85')](_0x2e0b4a)['compact']()[_0xf3d2('0x86')]();return db['OpenchannelQueue'][_0xf3d2('0x4c')]({'where':{'id':_0x2503bf[_0xf3d2('0x58')]['id']}})[_0xf3d2('0x2a')](function(_0x1733bb){return db[_0xf3d2('0x80')][_0xf3d2('0x70')](function(_0x31e23d){return _0x1733bb[_0xf3d2('0x87')](_0x2503bf[_0xf3d2('0x36')][_0xf3d2('0x6b')],{'transaction':_0x31e23d})['then'](function(){if(!_[_0xf3d2('0x88')](_0x48ab0f)){return _0x1733bb[_0xf3d2('0x89')](_0x48ab0f,{'transaction':_0x31e23d});}})[_0xf3d2('0x2a')](function(){_0x48ab0f[_0xf3d2('0x73')](function(_0x25f89c){socket[_0xf3d2('0x74')]('userOpenchannelQueue:remove',{'UserId':_0x25f89c,'OpenchannelQueueId':_0x1733bb['id']});});});});});});})[_0xf3d2('0x2a')](respondWithStatusCode(_0x2da877,null))['catch'](handleError(_0x2da877,null));};exports[_0xf3d2('0x8a')]=function(_0x1de0a3,_0x2fbaef,_0x109aa5){return db[_0xf3d2('0x31')][_0xf3d2('0x4c')]({'where':{'id':_0x1de0a3[_0xf3d2('0x58')]['id']}})['then'](handleEntityNotFound(_0x2fbaef,null))['then'](function(_0x523131){if(_0x523131){return _0x523131[_0xf3d2('0x8a')](_0x1de0a3[_0xf3d2('0x4f')][_0xf3d2('0x6b')],_[_0xf3d2('0x8b')](_0x1de0a3[_0xf3d2('0x4f')],[_0xf3d2('0x6b'),'id'])||{})['spread'](function(_0x43600d){for(var _0x3ddaaf=0x0;_0x3ddaaf<_0x1de0a3[_0xf3d2('0x4f')][_0xf3d2('0x6b')][_0xf3d2('0x3c')];_0x3ddaaf+=0x1){socket[_0xf3d2('0x74')]('userOpenchannelQueue:save',{'UserId':_0x1de0a3['body'][_0xf3d2('0x6b')][_0x3ddaaf],'OpenchannelQueueId':_0x1de0a3[_0xf3d2('0x58')]['id']});}return _0x43600d;});}})['then'](respondWithResult(_0x2fbaef,null))[_0xf3d2('0x4d')](handleError(_0x2fbaef,null));};exports[_0xf3d2('0x89')]=function(_0x48bdcb,_0x992414,_0x32fb9d){return db['OpenchannelQueue'][_0xf3d2('0x4c')]({'where':{'id':_0x48bdcb[_0xf3d2('0x58')]['id']}})['then'](handleEntityNotFound(_0x992414,null))['then'](function(_0x548ecd){if(_0x548ecd){return _0x548ecd['removeAgents'](_0x48bdcb[_0xf3d2('0x36')][_0xf3d2('0x6b')])[_0xf3d2('0x2a')](function(){if(_[_0xf3d2('0x8c')](_0x48bdcb[_0xf3d2('0x36')][_0xf3d2('0x6b')])){for(var _0x58a752=0x0;_0x58a752<_0x48bdcb[_0xf3d2('0x36')]['ids'][_0xf3d2('0x3c')];_0x58a752+=0x1){socket[_0xf3d2('0x74')](_0xf3d2('0x8d'),{'UserId':Number(_0x48bdcb[_0xf3d2('0x36')][_0xf3d2('0x6b')][_0x58a752]),'OpenchannelQueueId':Number(_0x48bdcb[_0xf3d2('0x58')]['id'])});}}else{socket[_0xf3d2('0x74')](_0xf3d2('0x8d'),{'UserId':Number(_0x48bdcb['query'][_0xf3d2('0x6b')]),'OpenchannelQueueId':Number(_0x48bdcb[_0xf3d2('0x58')]['id'])});}});}})[_0xf3d2('0x2a')](respondWithStatusCode(_0x992414,null))[_0xf3d2('0x4d')](handleError(_0x992414,null));};exports[_0xf3d2('0x8e')]=function(_0x33153f,_0x4f350c,_0x3f36e3){var _0x439839={};var _0x5b730b={};var _0x1eb00d;var _0x4b98d8;return db['OpenchannelQueue'][_0xf3d2('0x68')]({'where':{'id':_0x33153f[_0xf3d2('0x58')]['id']}})[_0xf3d2('0x2a')](handleEntityNotFound(_0x4f350c,null))[_0xf3d2('0x2a')](function(_0x548902){if(_0x548902){_0x1eb00d=_0x548902;_0x5b730b[_0xf3d2('0x35')]=_['keys'](db[_0xf3d2('0x5f')]['rawAttributes']);_0x5b730b[_0xf3d2('0x36')]=_['keys'](_0x33153f['query']);_0x5b730b[_0xf3d2('0x38')]=_[_0xf3d2('0x39')](_0x5b730b[_0xf3d2('0x35')],_0x5b730b[_0xf3d2('0x36')]);_0x439839[_0xf3d2('0x3b')]=_[_0xf3d2('0x39')](_0x5b730b[_0xf3d2('0x35')],qs[_0xf3d2('0x3a')](_0x33153f['query'][_0xf3d2('0x3a')]));_0x439839['attributes']=_0x439839[_0xf3d2('0x3b')]['length']?_0x439839[_0xf3d2('0x3b')]:_0x5b730b[_0xf3d2('0x35')];_0x439839[_0xf3d2('0x5c')]=qs[_0xf3d2('0x40')](_0x33153f[_0xf3d2('0x36')][_0xf3d2('0x40')]);_0x439839['where']=qs['filters'](_[_0xf3d2('0x41')](_0x33153f[_0xf3d2('0x36')],_0x5b730b[_0xf3d2('0x38')]));if(_0x33153f[_0xf3d2('0x36')][_0xf3d2('0x5e')]){_0x439839[_0xf3d2('0x42')]=_[_0xf3d2('0x43')](_0x439839[_0xf3d2('0x42')],{'$or':_[_0xf3d2('0x30')](_0x439839['attributes'],function(_0x3b82b5){var _0x51b448={};_0x51b448[_0x3b82b5]={'$like':'%'+_0x33153f[_0xf3d2('0x36')]['filter']+'%'};return _0x51b448;})});}_0x439839=_['merge']({},_0x439839,_0x33153f[_0xf3d2('0x45')]);return _0x1eb00d[_0xf3d2('0x8e')](_0x439839);}})[_0xf3d2('0x2a')](function(_0x2e5960){if(_0x2e5960){_0x4b98d8=_0x2e5960[_0xf3d2('0x3c')];if(!_0x33153f[_0xf3d2('0x36')][_0xf3d2('0x3d')](_0xf3d2('0x3e'))){_0x439839[_0xf3d2('0x3f')]=qs[_0xf3d2('0x3f')](_0x33153f[_0xf3d2('0x36')]['limit']);_0x439839['offset']=qs[_0xf3d2('0x24')](_0x33153f[_0xf3d2('0x36')][_0xf3d2('0x24')]);}return _0x1eb00d[_0xf3d2('0x8e')](_0x439839);}})[_0xf3d2('0x2a')](function(_0x51e23a){if(_0x51e23a){return _0x51e23a?{'count':_0x4b98d8,'rows':_0x51e23a}:null;}})['then'](respondWithResult(_0x4f350c,null))['catch'](handleError(_0x4f350c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a7126df..f1dfa23 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 _0x1f51=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x1f51,0x131));var _0x11f5=function(_0x2dad90,_0x466f3e){_0x2dad90=_0x2dad90-0x0;var _0x37af4f=_0x1f51[_0x2dad90];return _0x37af4f;};'use strict';var EventEmitter=require(_0x11f5('0x0'));var OpenchannelQueue=require(_0x11f5('0x1'))['db'][_0x11f5('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x11f5('0x3'),'afterUpdate':_0x11f5('0x4'),'afterDestroy':_0x11f5('0x5')};function emitEvent(_0x4e06fa){return function(_0x427c74,_0x4ff0c9,_0x2b27c9){OpenchannelQueueEvents[_0x11f5('0x6')](_0x4e06fa+':'+_0x427c74['id'],_0x427c74);OpenchannelQueueEvents[_0x11f5('0x6')](_0x4e06fa,_0x427c74);_0x2b27c9(null);};}for(var e in events){if(events[_0x11f5('0x7')](e)){var event=events[e];OpenchannelQueue[_0x11f5('0x8')](e,emitEvent(event));}}module[_0x11f5('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xf5b0=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x137e37,_0x498cf0){var _0x2cda86=function(_0x3c6745){while(--_0x3c6745){_0x137e37['push'](_0x137e37['shift']());}};_0x2cda86(++_0x498cf0);}(_0xf5b0,0x1d3));var _0x0f5b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xf5b0[_0x56482c];return _0x5aae7a;};'use strict';var EventEmitter=require(_0x0f5b('0x0'));var OpenchannelQueue=require(_0x0f5b('0x1'))['db'][_0x0f5b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0f5b('0x3')](0x0);var events={'afterCreate':_0x0f5b('0x4'),'afterUpdate':_0x0f5b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3bc954){return function(_0x311578,_0x15cd50,_0x4304ff){OpenchannelQueueEvents[_0x0f5b('0x6')](_0x3bc954+':'+_0x311578['id'],_0x311578);OpenchannelQueueEvents[_0x0f5b('0x6')](_0x3bc954,_0x311578);_0x4304ff(null);};}for(var e in events){if(events[_0x0f5b('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0f5b('0x8')](e,emitEvent(event));}}module[_0x0f5b('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 28e7015..0fd6a87 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 _0x9725=['request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x941de4,_0x2bc3f7){var _0x39c443=function(_0x4316fc){while(--_0x4316fc){_0x941de4['push'](_0x941de4['shift']());}};_0x39c443(++_0x2bc3f7);}(_0x9725,0x14d));var _0x5972=function(_0x29b4a1,_0x1d0cfb){_0x29b4a1=_0x29b4a1-0x0;var _0x2237fb=_0x9725[_0x29b4a1];return _0x2237fb;};'use strict';var _=require(_0x5972('0x0'));var util=require(_0x5972('0x1'));var logger=require(_0x5972('0x2'))('api');var moment=require(_0x5972('0x3'));var BPromise=require(_0x5972('0x4'));var rp=require(_0x5972('0x5'));var fs=require('fs');var path=require(_0x5972('0x6'));var rimraf=require(_0x5972('0x7'));var config=require(_0x5972('0x8'));var attributes=require(_0x5972('0x9'));module[_0x5972('0xa')]=function(_0x2eacaf,_0x18a35c){return _0x2eacaf[_0x5972('0xb')]('OpenchannelQueue',attributes,{'tableName':_0x5972('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8551=['OpenchannelQueue','openchannel_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x11a39d,_0xa329d8){var _0x2433a3=function(_0x5e477f){while(--_0x5e477f){_0x11a39d['push'](_0x11a39d['shift']());}};_0x2433a3(++_0xa329d8);}(_0x8551,0x19a));var _0x1855=function(_0x31b57a,_0x3dddf3){_0x31b57a=_0x31b57a-0x0;var _0x2df3dd=_0x8551[_0x31b57a];return _0x2df3dd;};'use strict';var _=require(_0x1855('0x0'));var util=require('util');var logger=require(_0x1855('0x1'))('api');var moment=require(_0x1855('0x2'));var BPromise=require(_0x1855('0x3'));var rp=require(_0x1855('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1855('0x5'));var config=require(_0x1855('0x6'));var attributes=require(_0x1855('0x7'));module[_0x1855('0x8')]=function(_0x272a55,_0x4e9910){return _0x272a55[_0x1855('0x9')](_0x1855('0xa'),attributes,{'tableName':_0x1855('0xb'),'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 87f5294..34cd14c 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 _0xbd58=['include','map','model','debug','ShowOpenchannelQueue','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit'];(function(_0x580d0e,_0x1e5f43){var _0xb51111=function(_0x4718e7){while(--_0x4718e7){_0x580d0e['push'](_0x580d0e['shift']());}};_0xb51111(++_0x1e5f43);}(_0xbd58,0x9e));var _0x8bd5=function(_0x12ec76,_0x45f3b4){_0x12ec76=_0x12ec76-0x0;var _0x586d4e=_0xbd58[_0x12ec76];return _0x586d4e;};'use strict';var _=require('lodash');var util=require(_0x8bd5('0x0'));var moment=require('moment');var BPromise=require(_0x8bd5('0x1'));var rs=require(_0x8bd5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bd5('0x3'))['db'];var utils=require(_0x8bd5('0x4'));var logger=require(_0x8bd5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8bd5('0x6')][_0x8bd5('0x7')]({'port':0x232a});config[_0x8bd5('0x8')]=_[_0x8bd5('0x9')](config['redis'],{'host':_0x8bd5('0xa'),'port':0x18eb});var socket=require(_0x8bd5('0xb'))(new Redis(config['redis']));require(_0x8bd5('0xc'))[_0x8bd5('0xd')](socket);function respondWithRpcPromise(_0x12582c,_0x5a176a,_0x5482df){return new BPromise(function(_0x6313c5,_0x725b3d){return client[_0x8bd5('0xe')](_0x12582c,_0x5482df)[_0x8bd5('0xf')](function(_0x197f86){logger[_0x8bd5('0x10')](_0x8bd5('0x11'),_0x5a176a,'request\x20sent');logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5a176a,'request\x20sent',JSON[_0x8bd5('0x12')](_0x197f86));if(_0x197f86[_0x8bd5('0x13')]){if(_0x197f86[_0x8bd5('0x13')][_0x8bd5('0x14')]===0x1f4){logger[_0x8bd5('0x13')](_0x8bd5('0x11'),_0x5a176a,_0x197f86['error'][_0x8bd5('0x15')]);return _0x725b3d(_0x197f86[_0x8bd5('0x13')][_0x8bd5('0x15')]);}logger[_0x8bd5('0x13')](_0x8bd5('0x11'),_0x5a176a,_0x197f86[_0x8bd5('0x13')]['message']);return _0x6313c5(_0x197f86[_0x8bd5('0x13')][_0x8bd5('0x15')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x5a176a,'request\x20sent');_0x6313c5(_0x197f86[_0x8bd5('0x16')][_0x8bd5('0x15')]);}})[_0x8bd5('0x17')](function(_0x4de1f2){logger[_0x8bd5('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x5a176a,_0x4de1f2);_0x725b3d(_0x4de1f2);});});}exports[_0x8bd5('0x18')]=function(_0x55798e){var _0x5cf2c1=this;return new Promise(function(_0x496c2c,_0x5647d8){return db[_0x8bd5('0x19')][_0x8bd5('0x1a')]({'raw':_0x55798e[_0x8bd5('0x1b')]?_0x55798e[_0x8bd5('0x1b')][_0x8bd5('0x1c')]===undefined?!![]:![]:!![],'where':_0x55798e['options']?_0x55798e['options'][_0x8bd5('0x1d')]||null:null,'attributes':_0x55798e[_0x8bd5('0x1b')]?_0x55798e[_0x8bd5('0x1b')][_0x8bd5('0x1e')]||null:null,'limit':_0x55798e['options']?_0x55798e[_0x8bd5('0x1b')][_0x8bd5('0x1f')]||null:null,'include':_0x55798e['options']?_0x55798e[_0x8bd5('0x1b')][_0x8bd5('0x20')]?_[_0x8bd5('0x21')](_0x55798e[_0x8bd5('0x1b')][_0x8bd5('0x20')],function(_0x293ae9){return{'model':db[_0x293ae9[_0x8bd5('0x22')]],'as':_0x293ae9['as'],'attributes':_0x293ae9['attributes'],'include':_0x293ae9[_0x8bd5('0x20')]?_[_0x8bd5('0x21')](_0x293ae9[_0x8bd5('0x20')],function(_0x16e678){return{'model':db[_0x16e678[_0x8bd5('0x22')]],'as':_0x16e678['as'],'attributes':_0x16e678[_0x8bd5('0x1e')],'include':_0x16e678[_0x8bd5('0x20')]?_['map'](_0x16e678['include'],function(_0x2e198b){return{'model':db[_0x2e198b[_0x8bd5('0x22')]],'as':_0x2e198b['as'],'attributes':_0x2e198b[_0x8bd5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8bd5('0xf')](function(_0x499231){logger[_0x8bd5('0x10')](_0x8bd5('0x18'),_0x55798e);logger[_0x8bd5('0x23')](_0x8bd5('0x18'),_0x55798e,JSON[_0x8bd5('0x12')](_0x499231));_0x496c2c(_0x499231);})[_0x8bd5('0x17')](function(_0x145502){logger[_0x8bd5('0x13')](_0x8bd5('0x18'),_0x145502[_0x8bd5('0x15')],_0x55798e);_0x5647d8(_0x5cf2c1[_0x8bd5('0x13')](0x1f4,_0x145502[_0x8bd5('0x15')]));});});};exports[_0x8bd5('0x24')]=function(_0x4e883a){var _0x3b5a97=this;return new Promise(function(_0x219bf0,_0x26e592){return db[_0x8bd5('0x19')][_0x8bd5('0x25')]({'raw':_0x4e883a[_0x8bd5('0x1b')]?_0x4e883a[_0x8bd5('0x1b')][_0x8bd5('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e883a['options']?_0x4e883a[_0x8bd5('0x1b')][_0x8bd5('0x1d')]||null:null,'attributes':_0x4e883a['options']?_0x4e883a[_0x8bd5('0x1b')][_0x8bd5('0x1e')]||null:null,'include':_0x4e883a[_0x8bd5('0x1b')]?_0x4e883a['options'][_0x8bd5('0x20')]?_[_0x8bd5('0x21')](_0x4e883a['options']['include'],function(_0x5e394c){return{'model':db[_0x5e394c[_0x8bd5('0x22')]],'as':_0x5e394c['as'],'attributes':_0x5e394c[_0x8bd5('0x1e')],'include':_0x5e394c['include']?_[_0x8bd5('0x21')](_0x5e394c['include'],function(_0xa63f3){return{'model':db[_0xa63f3[_0x8bd5('0x22')]],'as':_0xa63f3['as'],'attributes':_0xa63f3[_0x8bd5('0x1e')],'include':_0xa63f3[_0x8bd5('0x20')]?_[_0x8bd5('0x21')](_0xa63f3[_0x8bd5('0x20')],function(_0x42ef11){return{'model':db[_0x42ef11[_0x8bd5('0x22')]],'as':_0x42ef11['as'],'attributes':_0x42ef11[_0x8bd5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x569519){logger[_0x8bd5('0x10')]('ShowOpenchannelQueue',_0x4e883a);logger[_0x8bd5('0x23')](_0x8bd5('0x24'),_0x4e883a,JSON[_0x8bd5('0x12')](_0x569519));_0x219bf0(_0x569519);})[_0x8bd5('0x17')](function(_0xdeaadf){logger[_0x8bd5('0x13')](_0x8bd5('0x24'),_0xdeaadf[_0x8bd5('0x15')],_0x4e883a);_0x26e592(_0x3b5a97[_0x8bd5('0x13')](0x1f4,_0xdeaadf[_0x8bd5('0x15')]));});});}; \ No newline at end of file +var _0x57bc=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','find','ShowOpenchannelQueue','lodash','util','bluebird'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x57bc,0x1e9));var _0xc57b=function(_0x466841,_0x139438){_0x466841=_0x466841-0x0;var _0x1beca2=_0x57bc[_0x466841];return _0x1beca2;};'use strict';var _=require(_0xc57b('0x0'));var util=require(_0xc57b('0x1'));var moment=require('moment');var BPromise=require(_0xc57b('0x2'));var rs=require(_0xc57b('0x3'));var fs=require('fs');var Redis=require(_0xc57b('0x4'));var db=require(_0xc57b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc57b('0x6'))(_0xc57b('0x7'));var config=require(_0xc57b('0x8'));var jayson=require(_0xc57b('0x9'));var client=jayson['client'][_0xc57b('0xa')]({'port':0x232a});config[_0xc57b('0xb')]=_[_0xc57b('0xc')](config[_0xc57b('0xb')],{'host':_0xc57b('0xd'),'port':0x18eb});var socket=require(_0xc57b('0xe'))(new Redis(config['redis']));require(_0xc57b('0xf'))[_0xc57b('0x10')](socket);function respondWithRpcPromise(_0x187a97,_0x774d3d,_0x4519d0){return new BPromise(function(_0x594bdb,_0x4d2161){return client[_0xc57b('0x11')](_0x187a97,_0x4519d0)['then'](function(_0x207faa){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x774d3d,'request\x20sent');logger['debug'](_0xc57b('0x12'),_0x774d3d,_0xc57b('0x13'),JSON[_0xc57b('0x14')](_0x207faa));if(_0x207faa[_0xc57b('0x15')]){if(_0x207faa[_0xc57b('0x15')][_0xc57b('0x16')]===0x1f4){logger[_0xc57b('0x15')](_0xc57b('0x17'),_0x774d3d,_0x207faa[_0xc57b('0x15')][_0xc57b('0x18')]);return _0x4d2161(_0x207faa[_0xc57b('0x15')]['message']);}logger[_0xc57b('0x15')](_0xc57b('0x17'),_0x774d3d,_0x207faa[_0xc57b('0x15')][_0xc57b('0x18')]);return _0x594bdb(_0x207faa[_0xc57b('0x15')]['message']);}else{logger['info'](_0xc57b('0x17'),_0x774d3d,_0xc57b('0x13'));_0x594bdb(_0x207faa['result']['message']);}})[_0xc57b('0x19')](function(_0x488973){logger[_0xc57b('0x15')](_0xc57b('0x17'),_0x774d3d,_0x488973);_0x4d2161(_0x488973);});});}exports[_0xc57b('0x1a')]=function(_0x144e33){var _0x1c6459=this;return new Promise(function(_0x47b9d2,_0x119714){return db[_0xc57b('0x1b')][_0xc57b('0x1c')]({'raw':_0x144e33['options']?_0x144e33[_0xc57b('0x1d')][_0xc57b('0x1e')]===undefined?!![]:![]:!![],'where':_0x144e33[_0xc57b('0x1d')]?_0x144e33[_0xc57b('0x1d')]['where']||null:null,'attributes':_0x144e33['options']?_0x144e33[_0xc57b('0x1d')][_0xc57b('0x1f')]||null:null,'limit':_0x144e33[_0xc57b('0x1d')]?_0x144e33[_0xc57b('0x1d')][_0xc57b('0x20')]||null:null,'include':_0x144e33[_0xc57b('0x1d')]?_0x144e33['options'][_0xc57b('0x21')]?_[_0xc57b('0x22')](_0x144e33[_0xc57b('0x1d')][_0xc57b('0x21')],function(_0x147fd6){return{'model':db[_0x147fd6[_0xc57b('0x23')]],'as':_0x147fd6['as'],'attributes':_0x147fd6['attributes'],'include':_0x147fd6[_0xc57b('0x21')]?_[_0xc57b('0x22')](_0x147fd6['include'],function(_0x173b81){return{'model':db[_0x173b81[_0xc57b('0x23')]],'as':_0x173b81['as'],'attributes':_0x173b81[_0xc57b('0x1f')],'include':_0x173b81[_0xc57b('0x21')]?_['map'](_0x173b81[_0xc57b('0x21')],function(_0x3cae80){return{'model':db[_0x3cae80['model']],'as':_0x3cae80['as'],'attributes':_0x3cae80[_0xc57b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc57b('0x24')](function(_0x561b24){logger[_0xc57b('0x25')]('GetOpenchannelQueue',_0x144e33);logger[_0xc57b('0x26')](_0xc57b('0x1a'),_0x144e33,JSON[_0xc57b('0x14')](_0x561b24));_0x47b9d2(_0x561b24);})[_0xc57b('0x19')](function(_0xf737fd){logger['error'](_0xc57b('0x1a'),_0xf737fd['message'],_0x144e33);_0x119714(_0x1c6459[_0xc57b('0x15')](0x1f4,_0xf737fd['message']));});});};exports['ShowOpenchannelQueue']=function(_0x80997b){var _0x219eb7=this;return new Promise(function(_0x3286f9,_0x2c2d91){return db[_0xc57b('0x1b')][_0xc57b('0x27')]({'raw':_0x80997b[_0xc57b('0x1d')]?_0x80997b['options'][_0xc57b('0x1e')]===undefined?!![]:![]:!![],'where':_0x80997b[_0xc57b('0x1d')]?_0x80997b[_0xc57b('0x1d')]['where']||null:null,'attributes':_0x80997b[_0xc57b('0x1d')]?_0x80997b['options'][_0xc57b('0x1f')]||null:null,'include':_0x80997b[_0xc57b('0x1d')]?_0x80997b[_0xc57b('0x1d')][_0xc57b('0x21')]?_[_0xc57b('0x22')](_0x80997b['options']['include'],function(_0x13eda8){return{'model':db[_0x13eda8['model']],'as':_0x13eda8['as'],'attributes':_0x13eda8[_0xc57b('0x1f')],'include':_0x13eda8[_0xc57b('0x21')]?_[_0xc57b('0x22')](_0x13eda8['include'],function(_0x44d739){return{'model':db[_0x44d739['model']],'as':_0x44d739['as'],'attributes':_0x44d739['attributes'],'include':_0x44d739[_0xc57b('0x21')]?_[_0xc57b('0x22')](_0x44d739[_0xc57b('0x21')],function(_0x1652f3){return{'model':db[_0x1652f3[_0xc57b('0x23')]],'as':_0x1652f3['as'],'attributes':_0x1652f3['attributes']};}):[]};}):[]};}):[]:[]})[_0xc57b('0x24')](function(_0x33d49c){logger['info'](_0xc57b('0x28'),_0x80997b);logger[_0xc57b('0x26')](_0xc57b('0x28'),_0x80997b,JSON['stringify'](_0x33d49c));_0x3286f9(_0x33d49c);})[_0xc57b('0x19')](function(_0x1471b2){logger['error'](_0xc57b('0x28'),_0x1471b2[_0xc57b('0x18')],_0x80997b);_0x2c2d91(_0x219eb7[_0xc57b('0x15')](0x1f4,_0x1471b2[_0xc57b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 91c31c1..5130d50 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 _0xc456=['register','length','openchannelQueue:','./openchannelQueue.events','remove','update'];(function(_0x42fc77,_0x37aba9){var _0x7a2239=function(_0xdbc8d0){while(--_0xdbc8d0){_0x42fc77['push'](_0x42fc77['shift']());}};_0x7a2239(++_0x37aba9);}(_0xc456,0x117));var _0x6c45=function(_0x43e47a,_0x12af70){_0x43e47a=_0x43e47a-0x0;var _0x20aa11=_0xc456[_0x43e47a];return _0x20aa11;};'use strict';var OpenchannelQueueEvents=require(_0x6c45('0x0'));var events=['save',_0x6c45('0x1'),_0x6c45('0x2')];function createListener(_0x5882d5,_0x4053cb){return function(_0x438953){_0x4053cb['emit'](_0x5882d5,_0x438953);};}function removeListener(_0xa2c05c,_0x1c4684){return function(){OpenchannelQueueEvents['removeListener'](_0xa2c05c,_0x1c4684);};}exports[_0x6c45('0x3')]=function(_0x4785a2){for(var _0x164db8=0x0,_0x35e64b=events[_0x6c45('0x4')];_0x164db8<_0x35e64b;_0x164db8++){var _0x1101de=events[_0x164db8];var _0x154670=createListener(_0x6c45('0x5')+_0x1101de,_0x4785a2);OpenchannelQueueEvents['on'](_0x1101de,_0x154670);}}; \ No newline at end of file +var _0x13fc=['save','remove','update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x5b1003,_0x4bfeb9){var _0x4a3ca8=function(_0x4f5bde){while(--_0x4f5bde){_0x5b1003['push'](_0x5b1003['shift']());}};_0x4a3ca8(++_0x4bfeb9);}(_0x13fc,0x19f));var _0xc13f=function(_0x1b4cbf,_0x5d9af3){_0x1b4cbf=_0x1b4cbf-0x0;var _0x2b0c7a=_0x13fc[_0x1b4cbf];return _0x2b0c7a;};'use strict';var OpenchannelQueueEvents=require(_0xc13f('0x0'));var events=[_0xc13f('0x1'),_0xc13f('0x2'),_0xc13f('0x3')];function createListener(_0x43dd16,_0x3d3f61){return function(_0x482c48){_0x3d3f61[_0xc13f('0x4')](_0x43dd16,_0x482c48);};}function removeListener(_0x53ac65,_0x3cabe5){return function(){OpenchannelQueueEvents[_0xc13f('0x5')](_0x53ac65,_0x3cabe5);};}exports['register']=function(_0x289b30){for(var _0x40b4f9=0x0,_0x371e6b=events[_0xc13f('0x6')];_0x40b4f9<_0x371e6b;_0x40b4f9++){var _0x3e78a4=events[_0x40b4f9];var _0x286e10=createListener(_0xc13f('0x7')+_0x3e78a4,_0x289b30);OpenchannelQueueEvents['on'](_0x3e78a4,_0x286e10);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 21611e1..150a8ee 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 _0x2263=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','show','create','put'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x2263,0x6e));var _0x3226=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x2263[_0x1b3a5c];return _0x2ae8cb;};'use strict';var multer=require(_0x3226('0x0'));var util=require(_0x3226('0x1'));var path=require(_0x3226('0x2'));var timeout=require(_0x3226('0x3'));var express=require(_0x3226('0x4'));var router=express[_0x3226('0x5')]();var auth=require(_0x3226('0x6'));var interaction=require(_0x3226('0x7'));var config=require('../../config/environment');var controller=require(_0x3226('0x8'));router[_0x3226('0x9')]('/',auth[_0x3226('0xa')](),controller[_0x3226('0xb')]);router[_0x3226('0x9')]('/describe',auth[_0x3226('0xa')](),controller[_0x3226('0xc')]);router['get']('/:id',auth[_0x3226('0xa')](),controller[_0x3226('0xd')]);router['post']('/',auth[_0x3226('0xa')](),controller[_0x3226('0xe')]);router[_0x3226('0xf')](_0x3226('0x10'),auth[_0x3226('0xa')](),controller[_0x3226('0x11')]);router[_0x3226('0x12')]('/:id',auth[_0x3226('0xa')](),controller[_0x3226('0x13')]);module[_0x3226('0x14')]=router; \ No newline at end of file +var _0xfdfe=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2ac980,_0x33829d){var _0x53974d=function(_0x4cd40c){while(--_0x4cd40c){_0x2ac980['push'](_0x2ac980['shift']());}};_0x53974d(++_0x33829d);}(_0xfdfe,0xa7));var _0xefdf=function(_0x47856a,_0x1ad7a0){_0x47856a=_0x47856a-0x0;var _0x1edd96=_0xfdfe[_0x47856a];return _0x1edd96;};'use strict';var multer=require(_0xefdf('0x0'));var util=require(_0xefdf('0x1'));var path=require(_0xefdf('0x2'));var timeout=require(_0xefdf('0x3'));var express=require('express');var router=express[_0xefdf('0x4')]();var auth=require(_0xefdf('0x5'));var interaction=require(_0xefdf('0x6'));var config=require(_0xefdf('0x7'));var controller=require(_0xefdf('0x8'));router['get']('/',auth[_0xefdf('0x9')](),controller[_0xefdf('0xa')]);router['get'](_0xefdf('0xb'),auth[_0xefdf('0x9')](),controller['describe']);router['get'](_0xefdf('0xc'),auth[_0xefdf('0x9')](),controller[_0xefdf('0xd')]);router[_0xefdf('0xe')]('/',auth[_0xefdf('0x9')](),controller[_0xefdf('0xf')]);router[_0xefdf('0x10')](_0xefdf('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xefdf('0x11')](_0xefdf('0xc'),auth[_0xefdf('0x9')](),controller[_0xefdf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index e85c590..e0d839b 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 _0xf5af=['STRING','DATE','moment','sequelize','exports'];(function(_0x226345,_0x1e16fe){var _0x2ca077=function(_0x121bc7){while(--_0x121bc7){_0x226345['push'](_0x226345['shift']());}};_0x2ca077(++_0x1e16fe);}(_0xf5af,0xc0));var _0xff5a=function(_0x2c185a,_0x23e02d){_0x2c185a=_0x2c185a-0x0;var _0x3d919=_0xf5af[_0x2c185a];return _0x3d919;};'use strict';var moment=require(_0xff5a('0x0'));var Sequelize=require(_0xff5a('0x1'));module[_0xff5a('0x2')]={'uniqueid':{'type':Sequelize[_0xff5a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xff5a('0x3')]},'joinAt':{'type':Sequelize[_0xff5a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xff5a('0x4')]},'reason':{'type':Sequelize[_0xff5a('0x3')]}}; \ No newline at end of file +var _0x4cb0=['sequelize','STRING','DATE','moment'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x4cb0,0x15f));var _0x04cb=function(_0x33d0b5,_0x2e5200){_0x33d0b5=_0x33d0b5-0x0;var _0x3bbe87=_0x4cb0[_0x33d0b5];return _0x3bbe87;};'use strict';var moment=require(_0x04cb('0x0'));var Sequelize=require(_0x04cb('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x04cb('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x04cb('0x3')]},'acceptAt':{'type':Sequelize[_0x04cb('0x3')]},'exitAt':{'type':Sequelize[_0x04cb('0x3')]},'reason':{'type':Sequelize[_0x04cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2ec4a1f..8d8bfe9 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 _0x9da3=['filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','catch','show','params','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','set','Content-Range','json','then','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x28e1b8,_0x2175f1){var _0x1bb305=function(_0x5a9c64){while(--_0x5a9c64){_0x28e1b8['push'](_0x28e1b8['shift']());}};_0x1bb305(++_0x2175f1);}(_0x9da3,0x187));var _0x39da=function(_0x26c19d,_0x3f7b9b){_0x26c19d=_0x26c19d-0x0;var _0x37d676=_0x9da3[_0x26c19d];return _0x37d676;};'use strict';var pdf=require(_0x39da('0x0'));var emlformat=require(_0x39da('0x1'));var rimraf=require(_0x39da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39da('0x3'));var rp=require(_0x39da('0x4'));var moment=require(_0x39da('0x5'));var BPromise=require(_0x39da('0x6'));var Mustache=require(_0x39da('0x7'));var util=require(_0x39da('0x8'));var path=require(_0x39da('0x9'));var sox=require('sox');var csv=require(_0x39da('0xa'));var ejs=require(_0x39da('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x39da('0xc'));var crypto=require(_0x39da('0xd'));var jsforce=require(_0x39da('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x39da('0xa'));var querystring=require(_0x39da('0xf'));var Papa=require(_0x39da('0x10'));var Redis=require(_0x39da('0x11'));var authService=require(_0x39da('0x12'));var qs=require(_0x39da('0x13'));var as=require(_0x39da('0x14'));var hardwareService=require(_0x39da('0x15'));var logger=require(_0x39da('0x16'))(_0x39da('0x17'));var utils=require(_0x39da('0x18'));var config=require(_0x39da('0x19'));var db=require(_0x39da('0x1a'))['db'];function respondWithStatusCode(_0x3da38a,_0x11f615){_0x11f615=_0x11f615||0xcc;return function(_0x39c716){if(_0x39c716){return _0x3da38a[_0x39da('0x1b')](_0x11f615);}return _0x3da38a[_0x39da('0x1c')](_0x11f615)[_0x39da('0x1d')]();};}function respondWithResult(_0x32be25,_0x46c955){_0x46c955=_0x46c955||0xc8;return function(_0x51f23f){if(_0x51f23f){return _0x32be25[_0x39da('0x1c')](_0x46c955)['json'](_0x51f23f);}};}function respondWithFilteredResult(_0xced79a,_0x31872a){return function(_0x3dc626){if(_0x3dc626){var _0x1e136d=_0x3dc626['count'],_0x5955bc=_0x31872a['offset'],_0x2c5790=_0x31872a['offset']+_0x31872a['limit'],_0x43ffff;if(_0x2c5790>=_0x1e136d){_0x2c5790=_0x1e136d;_0x43ffff=0xc8;}else{_0x43ffff=0xce;}_0xced79a[_0x39da('0x1c')](_0x43ffff);return _0xced79a[_0x39da('0x1e')](_0x39da('0x1f'),_0x5955bc+'-'+_0x2c5790+'/'+_0x1e136d)[_0x39da('0x20')](_0x3dc626);}return null;};}function patchUpdates(_0x400927){return function(_0x3afec5){try{jsonpatch['apply'](_0x3afec5,_0x400927,!![]);}catch(_0x265020){return BPromise['reject'](_0x265020);}return _0x3afec5['save']();};}function saveUpdates(_0x53664a,_0x8b06ec){return function(_0x54d62f){if(_0x54d62f){return _0x54d62f['update'](_0x53664a)[_0x39da('0x21')](function(_0x2a8e8f){return _0x2a8e8f;});}return null;};}function removeEntity(_0x37fcf4,_0x189b33){return function(_0x3a5029){if(_0x3a5029){return _0x3a5029['destroy']()[_0x39da('0x21')](function(){_0x37fcf4[_0x39da('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b5991,_0x5f503e){return function(_0x4e4d0a){if(!_0x4e4d0a){_0x2b5991['sendStatus'](0x194);}return _0x4e4d0a;};}function handleError(_0xdf2b63,_0x394dd9){_0x394dd9=_0x394dd9||0x1f4;return function(_0x210417){logger[_0x39da('0x22')](_0x210417['stack']);if(_0x210417[_0x39da('0x23')]){delete _0x210417[_0x39da('0x23')];}_0xdf2b63['status'](_0x394dd9)[_0x39da('0x24')](_0x210417);};}exports[_0x39da('0x25')]=function(_0xbfe40d,_0x2f1a1b){var _0x508524={},_0x54364a={},_0x495230={'count':0x0,'rows':[]};var _0x114042=_[_0x39da('0x26')](db[_0x39da('0x27')][_0x39da('0x28')],function(_0x246f19){return{'name':_0x246f19[_0x39da('0x29')],'type':_0x246f19[_0x39da('0x2a')][_0x39da('0x2b')]};});_0x54364a[_0x39da('0x2c')]=_[_0x39da('0x26')](_0x114042,_0x39da('0x23'));_0x54364a['query']=_[_0x39da('0x2d')](_0xbfe40d[_0x39da('0x2e')]);_0x54364a[_0x39da('0x2f')]=_[_0x39da('0x30')](_0x54364a[_0x39da('0x2c')],_0x54364a['query']);_0x508524[_0x39da('0x31')]=_['intersection'](_0x54364a['model'],qs[_0x39da('0x32')](_0xbfe40d[_0x39da('0x2e')][_0x39da('0x32')]));_0x508524[_0x39da('0x31')]=_0x508524[_0x39da('0x31')][_0x39da('0x33')]?_0x508524[_0x39da('0x31')]:_0x54364a[_0x39da('0x2c')];if(!_0xbfe40d[_0x39da('0x2e')][_0x39da('0x34')]('nolimit')){_0x508524[_0x39da('0x35')]=qs['limit'](_0xbfe40d['query'][_0x39da('0x35')]);_0x508524['offset']=qs['offset'](_0xbfe40d[_0x39da('0x2e')][_0x39da('0x36')]);}_0x508524[_0x39da('0x37')]=qs[_0x39da('0x38')](_0xbfe40d[_0x39da('0x2e')]['sort']);_0x508524[_0x39da('0x39')]=qs[_0x39da('0x2f')](_['pick'](_0xbfe40d[_0x39da('0x2e')],_0x54364a[_0x39da('0x2f')]),_0x114042);if(_0xbfe40d[_0x39da('0x2e')][_0x39da('0x3a')]){_0x508524[_0x39da('0x39')]=_[_0x39da('0x3b')](_0x508524[_0x39da('0x39')],{'$or':_[_0x39da('0x26')](_0x114042,function(_0x61b6fd){if(_0x61b6fd[_0x39da('0x2a')]!==_0x39da('0x3c')){var _0x51c6dc={};_0x51c6dc[_0x61b6fd[_0x39da('0x23')]]={'$like':'%'+_0xbfe40d['query'][_0x39da('0x3a')]+'%'};return _0x51c6dc;}})});}_0x508524=_[_0x39da('0x3b')]({},_0x508524,_0xbfe40d['options']);var _0x22411d={'where':_0x508524[_0x39da('0x39')]};return db[_0x39da('0x27')]['count'](_0x22411d)[_0x39da('0x21')](function(_0x3de4a3){_0x495230[_0x39da('0x3d')]=_0x3de4a3;if(_0xbfe40d[_0x39da('0x2e')][_0x39da('0x3e')]){_0x508524[_0x39da('0x3f')]=[{'all':!![]}];}return db[_0x39da('0x27')]['findAll'](_0x508524);})[_0x39da('0x21')](function(_0x266f31){_0x495230['rows']=_0x266f31;return _0x495230;})['then'](respondWithFilteredResult(_0x2f1a1b,_0x508524))[_0x39da('0x40')](handleError(_0x2f1a1b,null));};exports[_0x39da('0x41')]=function(_0x9f1071,_0x1410da){var _0x29f3a3={'raw':!![],'where':{'id':_0x9f1071[_0x39da('0x42')]['id']}},_0xb37547={};_0xb37547['model']=_[_0x39da('0x2d')](db[_0x39da('0x27')]['rawAttributes']);_0xb37547['query']=_[_0x39da('0x2d')](_0x9f1071['query']);_0xb37547['filters']=_['intersection'](_0xb37547[_0x39da('0x2c')],_0xb37547[_0x39da('0x2e')]);_0x29f3a3['attributes']=_['intersection'](_0xb37547[_0x39da('0x2c')],qs[_0x39da('0x32')](_0x9f1071[_0x39da('0x2e')][_0x39da('0x32')]));_0x29f3a3[_0x39da('0x31')]=_0x29f3a3[_0x39da('0x31')][_0x39da('0x33')]?_0x29f3a3[_0x39da('0x31')]:_0xb37547['model'];if(_0x9f1071[_0x39da('0x2e')][_0x39da('0x3e')]){_0x29f3a3['include']=[{'all':!![]}];}_0x29f3a3=_[_0x39da('0x3b')]({},_0x29f3a3,_0x9f1071[_0x39da('0x43')]);return db['OpenchannelQueueReport'][_0x39da('0x44')](_0x29f3a3)['then'](handleEntityNotFound(_0x1410da,null))[_0x39da('0x21')](respondWithResult(_0x1410da,null))[_0x39da('0x40')](handleError(_0x1410da,null));};exports[_0x39da('0x45')]=function(_0x340c6c,_0x5cc454){return db[_0x39da('0x27')]['create'](_0x340c6c[_0x39da('0x46')],{})['then'](respondWithResult(_0x5cc454,0xc9))['catch'](handleError(_0x5cc454,null));};exports[_0x39da('0x47')]=function(_0x17ac66,_0x204aec){if(_0x17ac66['body']['id']){delete _0x17ac66[_0x39da('0x46')]['id'];}return db[_0x39da('0x27')][_0x39da('0x44')]({'where':{'id':_0x17ac66[_0x39da('0x42')]['id']}})[_0x39da('0x21')](handleEntityNotFound(_0x204aec,null))['then'](saveUpdates(_0x17ac66['body'],null))[_0x39da('0x21')](respondWithResult(_0x204aec,null))[_0x39da('0x40')](handleError(_0x204aec,null));};exports['destroy']=function(_0x1142c1,_0x4af62c){return db[_0x39da('0x27')][_0x39da('0x44')]({'where':{'id':_0x1142c1[_0x39da('0x42')]['id']}})['then'](handleEntityNotFound(_0x4af62c,null))[_0x39da('0x21')](removeEntity(_0x4af62c,null))[_0x39da('0x40')](handleError(_0x4af62c,null));};exports[_0x39da('0x48')]=function(_0x280bc8,_0x197b47){return db[_0x39da('0x27')]['describe']()[_0x39da('0x21')](respondWithResult(_0x197b47,null))[_0x39da('0x40')](handleError(_0x197b47,null));}; \ No newline at end of file +var _0xf6e6=['mustache','util','ejs','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','OpenchannelQueueReport','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x191f56,_0x5678e0){var _0x49010c=function(_0x17ed88){while(--_0x17ed88){_0x191f56['push'](_0x191f56['shift']());}};_0x49010c(++_0x5678e0);}(_0xf6e6,0x1a8));var _0x6f6e=function(_0x22d9cc,_0x16d193){_0x22d9cc=_0x22d9cc-0x0;var _0x379ac9=_0xf6e6[_0x22d9cc];return _0x379ac9;};'use strict';var pdf=require(_0x6f6e('0x0'));var emlformat=require(_0x6f6e('0x1'));var rimraf=require(_0x6f6e('0x2'));var zipdir=require(_0x6f6e('0x3'));var jsonpatch=require(_0x6f6e('0x4'));var rp=require(_0x6f6e('0x5'));var moment=require(_0x6f6e('0x6'));var BPromise=require(_0x6f6e('0x7'));var Mustache=require(_0x6f6e('0x8'));var util=require(_0x6f6e('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f6e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f6e('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f6e('0xc'));var deskjs=require(_0x6f6e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f6e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6f6e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f6e('0x10'));var logger=require(_0x6f6e('0x11'))(_0x6f6e('0x12'));var utils=require(_0x6f6e('0x13'));var config=require(_0x6f6e('0x14'));var db=require(_0x6f6e('0x15'))['db'];function respondWithStatusCode(_0x5169ff,_0x4792f3){_0x4792f3=_0x4792f3||0xcc;return function(_0x2f7af0){if(_0x2f7af0){return _0x5169ff['sendStatus'](_0x4792f3);}return _0x5169ff['status'](_0x4792f3)['end']();};}function respondWithResult(_0x5369c5,_0x17eb84){_0x17eb84=_0x17eb84||0xc8;return function(_0x9686fb){if(_0x9686fb){return _0x5369c5['status'](_0x17eb84)[_0x6f6e('0x16')](_0x9686fb);}};}function respondWithFilteredResult(_0x5b21ae,_0x71c1fe){return function(_0x12e293){if(_0x12e293){var _0x1ab0f1=_0x12e293[_0x6f6e('0x17')],_0x15139c=_0x71c1fe['offset'],_0xfac229=_0x71c1fe[_0x6f6e('0x18')]+_0x71c1fe[_0x6f6e('0x19')],_0x1a6ffc;if(_0xfac229>=_0x1ab0f1){_0xfac229=_0x1ab0f1;_0x1a6ffc=0xc8;}else{_0x1a6ffc=0xce;}_0x5b21ae[_0x6f6e('0x1a')](_0x1a6ffc);return _0x5b21ae[_0x6f6e('0x1b')](_0x6f6e('0x1c'),_0x15139c+'-'+_0xfac229+'/'+_0x1ab0f1)[_0x6f6e('0x16')](_0x12e293);}return null;};}function patchUpdates(_0x35f8d0){return function(_0x463da4){try{jsonpatch[_0x6f6e('0x1d')](_0x463da4,_0x35f8d0,!![]);}catch(_0x59e603){return BPromise[_0x6f6e('0x1e')](_0x59e603);}return _0x463da4['save']();};}function saveUpdates(_0x19a0cc,_0xb4d2e5){return function(_0x13dd9e){if(_0x13dd9e){return _0x13dd9e[_0x6f6e('0x1f')](_0x19a0cc)[_0x6f6e('0x20')](function(_0x130970){return _0x130970;});}return null;};}function removeEntity(_0x1b31ec,_0x156ce3){return function(_0xc12e2){if(_0xc12e2){return _0xc12e2[_0x6f6e('0x21')]()['then'](function(){_0x1b31ec[_0x6f6e('0x1a')](0xcc)[_0x6f6e('0x22')]();});}};}function handleEntityNotFound(_0x479feb,_0x3dff1b){return function(_0x4a0565){if(!_0x4a0565){_0x479feb['sendStatus'](0x194);}return _0x4a0565;};}function handleError(_0x49d92c,_0x2f25e0){_0x2f25e0=_0x2f25e0||0x1f4;return function(_0x3b50bd){logger[_0x6f6e('0x23')](_0x3b50bd[_0x6f6e('0x24')]);if(_0x3b50bd[_0x6f6e('0x25')]){delete _0x3b50bd[_0x6f6e('0x25')];}_0x49d92c[_0x6f6e('0x1a')](_0x2f25e0)[_0x6f6e('0x26')](_0x3b50bd);};}exports[_0x6f6e('0x27')]=function(_0x125fa8,_0x21019d){var _0xdb0684={},_0x21d961={},_0x2cdeb8={'count':0x0,'rows':[]};var _0x18852b=_['map'](db['OpenchannelQueueReport'][_0x6f6e('0x28')],function(_0x3172bd){return{'name':_0x3172bd['fieldName'],'type':_0x3172bd['type']['key']};});_0x21d961[_0x6f6e('0x29')]=_[_0x6f6e('0x2a')](_0x18852b,_0x6f6e('0x25'));_0x21d961[_0x6f6e('0x2b')]=_[_0x6f6e('0x2c')](_0x125fa8[_0x6f6e('0x2b')]);_0x21d961[_0x6f6e('0x2d')]=_[_0x6f6e('0x2e')](_0x21d961[_0x6f6e('0x29')],_0x21d961['query']);_0xdb0684[_0x6f6e('0x2f')]=_[_0x6f6e('0x2e')](_0x21d961['model'],qs[_0x6f6e('0x30')](_0x125fa8[_0x6f6e('0x2b')]['fields']));_0xdb0684[_0x6f6e('0x2f')]=_0xdb0684[_0x6f6e('0x2f')][_0x6f6e('0x31')]?_0xdb0684[_0x6f6e('0x2f')]:_0x21d961[_0x6f6e('0x29')];if(!_0x125fa8[_0x6f6e('0x2b')][_0x6f6e('0x32')](_0x6f6e('0x33'))){_0xdb0684[_0x6f6e('0x19')]=qs[_0x6f6e('0x19')](_0x125fa8[_0x6f6e('0x2b')]['limit']);_0xdb0684[_0x6f6e('0x18')]=qs[_0x6f6e('0x18')](_0x125fa8['query']['offset']);}_0xdb0684[_0x6f6e('0x34')]=qs['sort'](_0x125fa8[_0x6f6e('0x2b')][_0x6f6e('0x35')]);_0xdb0684[_0x6f6e('0x36')]=qs[_0x6f6e('0x2d')](_[_0x6f6e('0x37')](_0x125fa8[_0x6f6e('0x2b')],_0x21d961['filters']),_0x18852b);if(_0x125fa8[_0x6f6e('0x2b')]['filter']){_0xdb0684[_0x6f6e('0x36')]=_[_0x6f6e('0x38')](_0xdb0684[_0x6f6e('0x36')],{'$or':_['map'](_0x18852b,function(_0x567c78){if(_0x567c78[_0x6f6e('0x39')]!==_0x6f6e('0x3a')){var _0x2d4db6={};_0x2d4db6[_0x567c78['name']]={'$like':'%'+_0x125fa8[_0x6f6e('0x2b')][_0x6f6e('0x3b')]+'%'};return _0x2d4db6;}})});}_0xdb0684=_[_0x6f6e('0x38')]({},_0xdb0684,_0x125fa8[_0x6f6e('0x3c')]);var _0xc2947c={'where':_0xdb0684[_0x6f6e('0x36')]};return db[_0x6f6e('0x3d')][_0x6f6e('0x17')](_0xc2947c)['then'](function(_0xa183f3){_0x2cdeb8[_0x6f6e('0x17')]=_0xa183f3;if(_0x125fa8[_0x6f6e('0x2b')][_0x6f6e('0x3e')]){_0xdb0684[_0x6f6e('0x3f')]=[{'all':!![]}];}return db[_0x6f6e('0x3d')]['findAll'](_0xdb0684);})[_0x6f6e('0x20')](function(_0x3b0980){_0x2cdeb8[_0x6f6e('0x40')]=_0x3b0980;return _0x2cdeb8;})['then'](respondWithFilteredResult(_0x21019d,_0xdb0684))[_0x6f6e('0x41')](handleError(_0x21019d,null));};exports[_0x6f6e('0x42')]=function(_0x3fdd6e,_0x1d0b3d){var _0xeefa1f={'raw':!![],'where':{'id':_0x3fdd6e[_0x6f6e('0x43')]['id']}},_0x516fc2={};_0x516fc2[_0x6f6e('0x29')]=_['keys'](db[_0x6f6e('0x3d')]['rawAttributes']);_0x516fc2['query']=_[_0x6f6e('0x2c')](_0x3fdd6e[_0x6f6e('0x2b')]);_0x516fc2[_0x6f6e('0x2d')]=_[_0x6f6e('0x2e')](_0x516fc2[_0x6f6e('0x29')],_0x516fc2['query']);_0xeefa1f[_0x6f6e('0x2f')]=_[_0x6f6e('0x2e')](_0x516fc2[_0x6f6e('0x29')],qs[_0x6f6e('0x30')](_0x3fdd6e['query'][_0x6f6e('0x30')]));_0xeefa1f[_0x6f6e('0x2f')]=_0xeefa1f['attributes'][_0x6f6e('0x31')]?_0xeefa1f[_0x6f6e('0x2f')]:_0x516fc2[_0x6f6e('0x29')];if(_0x3fdd6e['query']['includeAll']){_0xeefa1f[_0x6f6e('0x3f')]=[{'all':!![]}];}_0xeefa1f=_[_0x6f6e('0x38')]({},_0xeefa1f,_0x3fdd6e[_0x6f6e('0x3c')]);return db['OpenchannelQueueReport'][_0x6f6e('0x44')](_0xeefa1f)[_0x6f6e('0x20')](handleEntityNotFound(_0x1d0b3d,null))['then'](respondWithResult(_0x1d0b3d,null))[_0x6f6e('0x41')](handleError(_0x1d0b3d,null));};exports['create']=function(_0x37d785,_0x3606e2){return db[_0x6f6e('0x3d')][_0x6f6e('0x45')](_0x37d785['body'],{})[_0x6f6e('0x20')](respondWithResult(_0x3606e2,0xc9))[_0x6f6e('0x41')](handleError(_0x3606e2,null));};exports[_0x6f6e('0x1f')]=function(_0xee9470,_0x4de8d8){if(_0xee9470[_0x6f6e('0x46')]['id']){delete _0xee9470[_0x6f6e('0x46')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0xee9470[_0x6f6e('0x43')]['id']}})['then'](handleEntityNotFound(_0x4de8d8,null))[_0x6f6e('0x20')](saveUpdates(_0xee9470['body'],null))['then'](respondWithResult(_0x4de8d8,null))[_0x6f6e('0x41')](handleError(_0x4de8d8,null));};exports[_0x6f6e('0x21')]=function(_0xa484d4,_0x37fd80){return db[_0x6f6e('0x3d')][_0x6f6e('0x44')]({'where':{'id':_0xa484d4[_0x6f6e('0x43')]['id']}})[_0x6f6e('0x20')](handleEntityNotFound(_0x37fd80,null))[_0x6f6e('0x20')](removeEntity(_0x37fd80,null))[_0x6f6e('0x41')](handleError(_0x37fd80,null));};exports[_0x6f6e('0x47')]=function(_0x5b52dd,_0x47a984){return db[_0x6f6e('0x3d')][_0x6f6e('0x47')]()[_0x6f6e('0x20')](respondWithResult(_0x47a984,null))['catch'](handleError(_0x47a984,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 60eecb0..9dde06f 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 _0x8188=['api','moment','request-promise','path','../../config/environment','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x47608c,_0x26ffcd){var _0x13243d=function(_0x1b105a){while(--_0x1b105a){_0x47608c['push'](_0x47608c['shift']());}};_0x13243d(++_0x26ffcd);}(_0x8188,0x10e));var _0x8818=function(_0x53e317,_0x52393e){_0x53e317=_0x53e317-0x0;var _0x269267=_0x8188[_0x53e317];return _0x269267;};'use strict';var _=require(_0x8818('0x0'));var util=require(_0x8818('0x1'));var logger=require(_0x8818('0x2'))(_0x8818('0x3'));var moment=require(_0x8818('0x4'));var BPromise=require('bluebird');var rp=require(_0x8818('0x5'));var fs=require('fs');var path=require(_0x8818('0x6'));var rimraf=require('rimraf');var config=require(_0x8818('0x7'));var attributes=require('./openchannelQueueReport.attributes');module[_0x8818('0x8')]=function(_0x1253d3,_0x4ccdb0){return _0x1253d3[_0x8818('0x9')](_0x8818('0xa'),attributes,{'tableName':_0x8818('0xb'),'paranoid':![],'indexes':[{'name':_0x8818('0xc'),'fields':[_0x8818('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8239=['OpenchannelQueueReport','report_openchannel_queue','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x8239,0x1f1));var _0x9823=function(_0x32c6ed,_0x591dcf){_0x32c6ed=_0x32c6ed-0x0;var _0x1fbac2=_0x8239[_0x32c6ed];return _0x1fbac2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9823('0x0'))(_0x9823('0x1'));var moment=require(_0x9823('0x2'));var BPromise=require(_0x9823('0x3'));var rp=require(_0x9823('0x4'));var fs=require('fs');var path=require(_0x9823('0x5'));var rimraf=require('rimraf');var config=require(_0x9823('0x6'));var attributes=require(_0x9823('0x7'));module[_0x9823('0x8')]=function(_0x570b63,_0x53d90c){return _0x570b63['define'](_0x9823('0x9'),attributes,{'tableName':_0x9823('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index b76db73..0c21c5f 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 _0xfb0b=['OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','OpenchannelQueueReport','create','options','raw','stringify','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','body','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4dca41,_0x5cd427){var _0x1fedf5=function(_0xeba74e){while(--_0xeba74e){_0x4dca41['push'](_0x4dca41['shift']());}};_0x1fedf5(++_0x5cd427);}(_0xfb0b,0x94));var _0xbfb0=function(_0x49d671,_0x372ed4){_0x49d671=_0x49d671-0x0;var _0x285cc3=_0xfb0b[_0x49d671];return _0x285cc3;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var moment=require(_0xbfb0('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfb0('0x3'));var fs=require('fs');var Redis=require(_0xbfb0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbfb0('0x5'))('rpc');var config=require(_0xbfb0('0x6'));var jayson=require(_0xbfb0('0x7'));var client=jayson[_0xbfb0('0x8')][_0xbfb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3840,_0x46166a,_0x52eba3){return new BPromise(function(_0x3491c7,_0x1afe32){return client[_0xbfb0('0xa')](_0x2b3840,_0x52eba3)[_0xbfb0('0xb')](function(_0x4c2cee){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x46166a,'request\x20sent');logger[_0xbfb0('0xc')](_0xbfb0('0xd'),_0x46166a,_0xbfb0('0xe'),JSON['stringify'](_0x4c2cee));if(_0x4c2cee[_0xbfb0('0xf')]){if(_0x4c2cee['error'][_0xbfb0('0x10')]===0x1f4){logger[_0xbfb0('0xf')](_0xbfb0('0x11'),_0x46166a,_0x4c2cee[_0xbfb0('0xf')][_0xbfb0('0x12')]);return _0x1afe32(_0x4c2cee[_0xbfb0('0xf')]['message']);}logger[_0xbfb0('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x46166a,_0x4c2cee['error']['message']);return _0x3491c7(_0x4c2cee[_0xbfb0('0xf')][_0xbfb0('0x12')]);}else{logger[_0xbfb0('0x13')](_0xbfb0('0x11'),_0x46166a,_0xbfb0('0xe'));_0x3491c7(_0x4c2cee[_0xbfb0('0x14')][_0xbfb0('0x12')]);}})[_0xbfb0('0x15')](function(_0x315b80){logger[_0xbfb0('0xf')](_0xbfb0('0x11'),_0x46166a,_0x315b80);_0x1afe32(_0x315b80);});});}exports['CreateOpenchannelQueueReport']=function(_0x5c8a1e){var _0x3319a1=this;return new Promise(function(_0x3b0a50,_0x51842c){return db[_0xbfb0('0x16')][_0xbfb0('0x17')](_0x5c8a1e['body'],{'raw':_0x5c8a1e[_0xbfb0('0x18')]?_0x5c8a1e['options'][_0xbfb0('0x19')]===undefined?!![]:![]:!![]})[_0xbfb0('0xb')](function(_0xf52bd5){logger[_0xbfb0('0x13')]('CreateOpenchannelQueueReport',_0x5c8a1e);logger[_0xbfb0('0xc')]('CreateOpenchannelQueueReport',_0x5c8a1e,JSON[_0xbfb0('0x1a')](_0xf52bd5));_0x3b0a50(_0xf52bd5);})['catch'](function(_0x16bb6e){logger['error'](_0xbfb0('0x1b'),_0x16bb6e['message'],_0x5c8a1e);_0x51842c(_0x3319a1[_0xbfb0('0xf')](0x1f4,_0x16bb6e[_0xbfb0('0x12')]));});});};exports[_0xbfb0('0x1c')]=function(_0x3ab347){var _0x515d0f=this;return new Promise(function(_0x2efb2a,_0x17f46c){return db['OpenchannelQueueReport']['update'](_0x3ab347[_0xbfb0('0x1d')],{'raw':_0x3ab347[_0xbfb0('0x18')]?_0x3ab347[_0xbfb0('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ab347[_0xbfb0('0x18')]?_0x3ab347['options'][_0xbfb0('0x1e')]||null:null,'attributes':_0x3ab347[_0xbfb0('0x18')]?_0x3ab347[_0xbfb0('0x18')][_0xbfb0('0x1f')]||null:null,'limit':_0x3ab347[_0xbfb0('0x18')]?_0x3ab347[_0xbfb0('0x18')][_0xbfb0('0x20')]||null:null})['then'](function(_0xb2a68d){logger[_0xbfb0('0x13')](_0xbfb0('0x1c'),_0x3ab347);logger[_0xbfb0('0xc')]('UpdateOpenchannelQueueReport',_0x3ab347,JSON[_0xbfb0('0x1a')](_0xb2a68d));_0x2efb2a(_0xb2a68d);})[_0xbfb0('0x15')](function(_0x4e511c){logger[_0xbfb0('0xf')](_0xbfb0('0x1c'),_0x4e511c[_0xbfb0('0x12')],_0x3ab347);_0x17f46c(_0x515d0f[_0xbfb0('0xf')](0x1f4,_0x4e511c[_0xbfb0('0x12')]));});});}; \ No newline at end of file +var _0x5ff9=['body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ff9,0xa0));var _0x95ff=function(_0xed00d9,_0x119c57){_0xed00d9=_0xed00d9-0x0;var _0x205daf=_0x5ff9[_0xed00d9];return _0x205daf;};'use strict';var _=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var moment=require('moment');var BPromise=require(_0x95ff('0x2'));var rs=require(_0x95ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ff('0x5'));var jayson=require(_0x95ff('0x6'));var client=jayson['client'][_0x95ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fd45b,_0x34ace2,_0x384657){return new BPromise(function(_0x491610,_0x2fb3f5){return client['request'](_0x4fd45b,_0x384657)[_0x95ff('0x8')](function(_0x300166){logger['info'](_0x95ff('0x9'),_0x34ace2,_0x95ff('0xa'));logger[_0x95ff('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x34ace2,_0x95ff('0xa'),JSON[_0x95ff('0xc')](_0x300166));if(_0x300166[_0x95ff('0xd')]){if(_0x300166[_0x95ff('0xd')][_0x95ff('0xe')]===0x1f4){logger[_0x95ff('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x34ace2,_0x300166['error'][_0x95ff('0xf')]);return _0x2fb3f5(_0x300166[_0x95ff('0xd')][_0x95ff('0xf')]);}logger[_0x95ff('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x34ace2,_0x300166[_0x95ff('0xd')][_0x95ff('0xf')]);return _0x491610(_0x300166['error'][_0x95ff('0xf')]);}else{logger[_0x95ff('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x34ace2,'request\x20sent');_0x491610(_0x300166[_0x95ff('0x11')][_0x95ff('0xf')]);}})[_0x95ff('0x12')](function(_0x5d5350){logger[_0x95ff('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x34ace2,_0x5d5350);_0x2fb3f5(_0x5d5350);});});}exports['CreateOpenchannelQueueReport']=function(_0x1929c4){var _0x2ac86c=this;return new Promise(function(_0x1c67e4,_0x10f660){return db['OpenchannelQueueReport'][_0x95ff('0x13')](_0x1929c4[_0x95ff('0x14')],{'raw':_0x1929c4[_0x95ff('0x15')]?_0x1929c4[_0x95ff('0x15')][_0x95ff('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x363691){logger[_0x95ff('0x10')](_0x95ff('0x17'),_0x1929c4);logger[_0x95ff('0xb')](_0x95ff('0x17'),_0x1929c4,JSON['stringify'](_0x363691));_0x1c67e4(_0x363691);})['catch'](function(_0x1151d8){logger[_0x95ff('0xd')](_0x95ff('0x17'),_0x1151d8[_0x95ff('0xf')],_0x1929c4);_0x10f660(_0x2ac86c['error'](0x1f4,_0x1151d8[_0x95ff('0xf')]));});});};exports[_0x95ff('0x18')]=function(_0x4fa568){var _0x52b08c=this;return new Promise(function(_0x35fd01,_0x4d1158){return db[_0x95ff('0x19')][_0x95ff('0x1a')](_0x4fa568[_0x95ff('0x14')],{'raw':_0x4fa568[_0x95ff('0x15')]?_0x4fa568[_0x95ff('0x15')][_0x95ff('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fa568['options']?_0x4fa568[_0x95ff('0x15')][_0x95ff('0x1b')]||null:null,'attributes':_0x4fa568[_0x95ff('0x15')]?_0x4fa568[_0x95ff('0x15')][_0x95ff('0x1c')]||null:null,'limit':_0x4fa568[_0x95ff('0x15')]?_0x4fa568[_0x95ff('0x15')][_0x95ff('0x1d')]||null:null})[_0x95ff('0x8')](function(_0x3b4919){logger[_0x95ff('0x10')](_0x95ff('0x18'),_0x4fa568);logger[_0x95ff('0xb')](_0x95ff('0x18'),_0x4fa568,JSON[_0x95ff('0xc')](_0x3b4919));_0x35fd01(_0x3b4919);})['catch'](function(_0x37c7ce){logger[_0x95ff('0xd')](_0x95ff('0x18'),_0x37c7ce[_0x95ff('0xf')],_0x4fa568);_0x4d1158(_0x52b08c[_0x95ff('0xd')](0x1f4,_0x37c7ce[_0x95ff('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 72e606c..62a31de 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(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 83e800a..61237b7 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 _0x1dd1=['queue','NOW','sequelize','exports','STRING','account','agent'];(function(_0x5323f8,_0x1eeebd){var _0xc28b71=function(_0x5b0b24){while(--_0x5b0b24){_0x5323f8['push'](_0x5323f8['shift']());}};_0xc28b71(++_0x1eeebd);}(_0x1dd1,0x136));var _0x11dd=function(_0x5623cb,_0x20b099){_0x5623cb=_0x5623cb-0x0;var _0x368ce6=_0x1dd1[_0x5623cb];return _0x368ce6;};'use strict';var moment=require('moment');var Sequelize=require(_0x11dd('0x0'));module[_0x11dd('0x1')]={'uniqueid':{'type':Sequelize[_0x11dd('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x11dd('0x3'),_0x11dd('0x4'),'queue'),'allowNull':![],'defaultValue':_0x11dd('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x11dd('0x6')]}}; \ No newline at end of file +var _0xe160=['DATE','NOW','moment','sequelize','exports','ENUM','account','agent','queue'];(function(_0x401b64,_0x5cae66){var _0x139aa0=function(_0x4bef1d){while(--_0x4bef1d){_0x401b64['push'](_0x401b64['shift']());}};_0x139aa0(++_0x5cae66);}(_0xe160,0x9b));var _0x0e16=function(_0x4de3f0,_0x4cd0b0){_0x4de3f0=_0x4de3f0-0x0;var _0xe2ae9e=_0xe160[_0x4de3f0];return _0xe2ae9e;};'use strict';var moment=require(_0x0e16('0x0'));var Sequelize=require(_0x0e16('0x1'));module[_0x0e16('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0e16('0x3')](_0x0e16('0x4'),_0x0e16('0x5'),_0x0e16('0x6')),'allowNull':![],'defaultValue':_0x0e16('0x6')},'transferredAt':{'type':Sequelize[_0x0e16('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x0e16('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 58bbcfc..068b2d2 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 _0x85bd=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','OpenchannelTransferReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x2904ec,_0x53edb7){var _0x5de856=function(_0x25c268){while(--_0x25c268){_0x2904ec['push'](_0x2904ec['shift']());}};_0x5de856(++_0x53edb7);}(_0x85bd,0x167));var _0xd85b=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x85bd[_0x5e4563];return _0x8d1bf5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd85b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd85b('0x1'));var jsonpatch=require(_0xd85b('0x2'));var rp=require('request-promise');var moment=require(_0xd85b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd85b('0x4'));var util=require(_0xd85b('0x5'));var path=require(_0xd85b('0x6'));var sox=require(_0xd85b('0x7'));var csv=require('to-csv');var ejs=require(_0xd85b('0x8'));var fs=require('fs');var _=require(_0xd85b('0x9'));var squel=require(_0xd85b('0xa'));var crypto=require(_0xd85b('0xb'));var jsforce=require(_0xd85b('0xc'));var deskjs=require(_0xd85b('0xd'));var toCsv=require(_0xd85b('0xe'));var querystring=require(_0xd85b('0xf'));var Papa=require(_0xd85b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd85b('0x11'));var as=require(_0xd85b('0x12'));var hardwareService=require(_0xd85b('0x13'));var logger=require(_0xd85b('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd85b('0x15'))['db'];function respondWithStatusCode(_0x1b2414,_0x29c6bf){_0x29c6bf=_0x29c6bf||0xcc;return function(_0x4ab71c){if(_0x4ab71c){return _0x1b2414[_0xd85b('0x16')](_0x29c6bf);}return _0x1b2414[_0xd85b('0x17')](_0x29c6bf)['end']();};}function respondWithResult(_0x4f32f3,_0x1c2c7f){_0x1c2c7f=_0x1c2c7f||0xc8;return function(_0x398020){if(_0x398020){return _0x4f32f3[_0xd85b('0x17')](_0x1c2c7f)['json'](_0x398020);}};}function respondWithFilteredResult(_0x3e3679,_0x103434){return function(_0x33bb1d){if(_0x33bb1d){var _0x124df2=_0x33bb1d[_0xd85b('0x18')],_0x4b5594=_0x103434[_0xd85b('0x19')],_0x2acac3=_0x103434['offset']+_0x103434['limit'],_0x51d8f5;if(_0x2acac3>=_0x124df2){_0x2acac3=_0x124df2;_0x51d8f5=0xc8;}else{_0x51d8f5=0xce;}_0x3e3679[_0xd85b('0x17')](_0x51d8f5);return _0x3e3679[_0xd85b('0x1a')](_0xd85b('0x1b'),_0x4b5594+'-'+_0x2acac3+'/'+_0x124df2)[_0xd85b('0x1c')](_0x33bb1d);}return null;};}function patchUpdates(_0x17d1ee){return function(_0x45be53){try{jsonpatch[_0xd85b('0x1d')](_0x45be53,_0x17d1ee,!![]);}catch(_0x2e14c2){return BPromise[_0xd85b('0x1e')](_0x2e14c2);}return _0x45be53[_0xd85b('0x1f')]();};}function saveUpdates(_0x7e512a,_0x1cdf15){return function(_0x2b512a){if(_0x2b512a){return _0x2b512a[_0xd85b('0x20')](_0x7e512a)[_0xd85b('0x21')](function(_0x42d5e0){return _0x42d5e0;});}return null;};}function removeEntity(_0x1d669a,_0x241d0f){return function(_0x202e49){if(_0x202e49){return _0x202e49[_0xd85b('0x22')]()[_0xd85b('0x21')](function(){_0x1d669a[_0xd85b('0x17')](0xcc)[_0xd85b('0x23')]();});}};}function handleEntityNotFound(_0x7e8114,_0xe62deb){return function(_0x596a3b){if(!_0x596a3b){_0x7e8114['sendStatus'](0x194);}return _0x596a3b;};}function handleError(_0x279c6a,_0x49fffa){_0x49fffa=_0x49fffa||0x1f4;return function(_0x255031){logger[_0xd85b('0x24')](_0x255031['stack']);if(_0x255031[_0xd85b('0x25')]){delete _0x255031[_0xd85b('0x25')];}_0x279c6a['status'](_0x49fffa)[_0xd85b('0x26')](_0x255031);};}exports[_0xd85b('0x27')]=function(_0x3bb826,_0x1998da){var _0x3c1153={},_0x5c09f1={},_0x183fa9={'count':0x0,'rows':[]};var _0x2413b4=_[_0xd85b('0x28')](db['OpenchannelTransferReport'][_0xd85b('0x29')],function(_0xc599de){return{'name':_0xc599de[_0xd85b('0x2a')],'type':_0xc599de['type'][_0xd85b('0x2b')]};});_0x5c09f1[_0xd85b('0x2c')]=_[_0xd85b('0x28')](_0x2413b4,_0xd85b('0x25'));_0x5c09f1[_0xd85b('0x2d')]=_[_0xd85b('0x2e')](_0x3bb826[_0xd85b('0x2d')]);_0x5c09f1['filters']=_[_0xd85b('0x2f')](_0x5c09f1[_0xd85b('0x2c')],_0x5c09f1[_0xd85b('0x2d')]);_0x3c1153['attributes']=_[_0xd85b('0x2f')](_0x5c09f1[_0xd85b('0x2c')],qs[_0xd85b('0x30')](_0x3bb826[_0xd85b('0x2d')][_0xd85b('0x30')]));_0x3c1153[_0xd85b('0x31')]=_0x3c1153['attributes'][_0xd85b('0x32')]?_0x3c1153[_0xd85b('0x31')]:_0x5c09f1[_0xd85b('0x2c')];if(!_0x3bb826[_0xd85b('0x2d')][_0xd85b('0x33')](_0xd85b('0x34'))){_0x3c1153[_0xd85b('0x35')]=qs[_0xd85b('0x35')](_0x3bb826[_0xd85b('0x2d')][_0xd85b('0x35')]);_0x3c1153['offset']=qs[_0xd85b('0x19')](_0x3bb826[_0xd85b('0x2d')][_0xd85b('0x19')]);}_0x3c1153[_0xd85b('0x36')]=qs[_0xd85b('0x37')](_0x3bb826['query'][_0xd85b('0x37')]);_0x3c1153[_0xd85b('0x38')]=qs[_0xd85b('0x39')](_[_0xd85b('0x3a')](_0x3bb826['query'],_0x5c09f1[_0xd85b('0x39')]),_0x2413b4);if(_0x3bb826['query'][_0xd85b('0x3b')]){_0x3c1153['where']=_[_0xd85b('0x3c')](_0x3c1153[_0xd85b('0x38')],{'$or':_['map'](_0x2413b4,function(_0x58ec7e){if(_0x58ec7e[_0xd85b('0x3d')]!=='VIRTUAL'){var _0x404774={};_0x404774[_0x58ec7e['name']]={'$like':'%'+_0x3bb826[_0xd85b('0x2d')][_0xd85b('0x3b')]+'%'};return _0x404774;}})});}_0x3c1153=_[_0xd85b('0x3c')]({},_0x3c1153,_0x3bb826[_0xd85b('0x3e')]);var _0xc29fdf={'where':_0x3c1153[_0xd85b('0x38')]};return db[_0xd85b('0x3f')]['count'](_0xc29fdf)['then'](function(_0x310278){_0x183fa9['count']=_0x310278;if(_0x3bb826[_0xd85b('0x2d')]['includeAll']){_0x3c1153[_0xd85b('0x40')]=[{'all':!![]}];}return db[_0xd85b('0x3f')][_0xd85b('0x41')](_0x3c1153);})[_0xd85b('0x21')](function(_0x3c9d2a){_0x183fa9[_0xd85b('0x42')]=_0x3c9d2a;return _0x183fa9;})[_0xd85b('0x21')](respondWithFilteredResult(_0x1998da,_0x3c1153))[_0xd85b('0x43')](handleError(_0x1998da,null));};exports[_0xd85b('0x44')]=function(_0x2aefbf,_0x5b2653){var _0x4ba874={'raw':!![],'where':{'id':_0x2aefbf[_0xd85b('0x45')]['id']}},_0x1f4df8={};_0x1f4df8[_0xd85b('0x2c')]=_[_0xd85b('0x2e')](db[_0xd85b('0x3f')]['rawAttributes']);_0x1f4df8[_0xd85b('0x2d')]=_[_0xd85b('0x2e')](_0x2aefbf[_0xd85b('0x2d')]);_0x1f4df8[_0xd85b('0x39')]=_['intersection'](_0x1f4df8[_0xd85b('0x2c')],_0x1f4df8['query']);_0x4ba874[_0xd85b('0x31')]=_[_0xd85b('0x2f')](_0x1f4df8[_0xd85b('0x2c')],qs[_0xd85b('0x30')](_0x2aefbf['query'][_0xd85b('0x30')]));_0x4ba874['attributes']=_0x4ba874['attributes'][_0xd85b('0x32')]?_0x4ba874['attributes']:_0x1f4df8[_0xd85b('0x2c')];if(_0x2aefbf[_0xd85b('0x2d')][_0xd85b('0x46')]){_0x4ba874[_0xd85b('0x40')]=[{'all':!![]}];}_0x4ba874=_['merge']({},_0x4ba874,_0x2aefbf[_0xd85b('0x3e')]);return db[_0xd85b('0x3f')][_0xd85b('0x47')](_0x4ba874)['then'](handleEntityNotFound(_0x5b2653,null))[_0xd85b('0x21')](respondWithResult(_0x5b2653,null))['catch'](handleError(_0x5b2653,null));};exports[_0xd85b('0x48')]=function(_0x163743,_0x43e3e8){return db[_0xd85b('0x3f')][_0xd85b('0x48')](_0x163743[_0xd85b('0x49')],{})[_0xd85b('0x21')](respondWithResult(_0x43e3e8,0xc9))[_0xd85b('0x43')](handleError(_0x43e3e8,null));};exports['update']=function(_0x3614fb,_0x5890e4){if(_0x3614fb[_0xd85b('0x49')]['id']){delete _0x3614fb[_0xd85b('0x49')]['id'];}return db[_0xd85b('0x3f')][_0xd85b('0x47')]({'where':{'id':_0x3614fb[_0xd85b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5890e4,null))[_0xd85b('0x21')](saveUpdates(_0x3614fb[_0xd85b('0x49')],null))[_0xd85b('0x21')](respondWithResult(_0x5890e4,null))[_0xd85b('0x43')](handleError(_0x5890e4,null));};exports[_0xd85b('0x22')]=function(_0x395066,_0x16babb){return db['OpenchannelTransferReport'][_0xd85b('0x47')]({'where':{'id':_0x395066[_0xd85b('0x45')]['id']}})['then'](handleEntityNotFound(_0x16babb,null))[_0xd85b('0x21')](removeEntity(_0x16babb,null))[_0xd85b('0x43')](handleError(_0x16babb,null));};exports['describe']=function(_0x237e2a,_0x46e22b){return db['OpenchannelTransferReport'][_0xd85b('0x4a')]()['then'](respondWithResult(_0x46e22b,null))[_0xd85b('0x43')](handleError(_0x46e22b,null));}; \ No newline at end of file +var _0xa421=['fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x1977f1,_0x19ef5c){var _0x5185ce=function(_0x388d7c){while(--_0x388d7c){_0x1977f1['push'](_0x1977f1['shift']());}};_0x5185ce(++_0x19ef5c);}(_0xa421,0x1b8));var _0x1a42=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa421[_0x4baae2];return _0x1a2285;};'use strict';var pdf=require(_0x1a42('0x0'));var emlformat=require(_0x1a42('0x1'));var rimraf=require(_0x1a42('0x2'));var zipdir=require(_0x1a42('0x3'));var jsonpatch=require(_0x1a42('0x4'));var rp=require(_0x1a42('0x5'));var moment=require(_0x1a42('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1a42('0x7'));var util=require(_0x1a42('0x8'));var path=require(_0x1a42('0x9'));var sox=require(_0x1a42('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a42('0xb'));var squel=require('squel');var crypto=require(_0x1a42('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a42('0xd'));var toCsv=require(_0x1a42('0xe'));var querystring=require(_0x1a42('0xf'));var Papa=require(_0x1a42('0x10'));var Redis=require(_0x1a42('0x11'));var authService=require(_0x1a42('0x12'));var qs=require(_0x1a42('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a42('0x14'));var logger=require(_0x1a42('0x15'))(_0x1a42('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1a42('0x17'))['db'];function respondWithStatusCode(_0x180eeb,_0x3d0c7f){_0x3d0c7f=_0x3d0c7f||0xcc;return function(_0x58d90d){if(_0x58d90d){return _0x180eeb[_0x1a42('0x18')](_0x3d0c7f);}return _0x180eeb['status'](_0x3d0c7f)[_0x1a42('0x19')]();};}function respondWithResult(_0x39d815,_0x296938){_0x296938=_0x296938||0xc8;return function(_0x288504){if(_0x288504){return _0x39d815[_0x1a42('0x1a')](_0x296938)['json'](_0x288504);}};}function respondWithFilteredResult(_0x1f31a5,_0x25708f){return function(_0xf323f7){if(_0xf323f7){var _0x35cb03=_0xf323f7[_0x1a42('0x1b')],_0x5cf971=_0x25708f[_0x1a42('0x1c')],_0x11f5d0=_0x25708f[_0x1a42('0x1c')]+_0x25708f[_0x1a42('0x1d')],_0x5f40c0;if(_0x11f5d0>=_0x35cb03){_0x11f5d0=_0x35cb03;_0x5f40c0=0xc8;}else{_0x5f40c0=0xce;}_0x1f31a5[_0x1a42('0x1a')](_0x5f40c0);return _0x1f31a5[_0x1a42('0x1e')](_0x1a42('0x1f'),_0x5cf971+'-'+_0x11f5d0+'/'+_0x35cb03)[_0x1a42('0x20')](_0xf323f7);}return null;};}function patchUpdates(_0x5c30a6){return function(_0x496b51){try{jsonpatch['apply'](_0x496b51,_0x5c30a6,!![]);}catch(_0x44e056){return BPromise[_0x1a42('0x21')](_0x44e056);}return _0x496b51[_0x1a42('0x22')]();};}function saveUpdates(_0x242178,_0x89d805){return function(_0x46b275){if(_0x46b275){return _0x46b275[_0x1a42('0x23')](_0x242178)[_0x1a42('0x24')](function(_0x4cbe76){return _0x4cbe76;});}return null;};}function removeEntity(_0x2064c1,_0x868669){return function(_0x28f3c2){if(_0x28f3c2){return _0x28f3c2['destroy']()['then'](function(){_0x2064c1[_0x1a42('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2c9a8,_0x37f1e6){return function(_0x147f08){if(!_0x147f08){_0xa2c9a8[_0x1a42('0x18')](0x194);}return _0x147f08;};}function handleError(_0x43cdb4,_0x7a6912){_0x7a6912=_0x7a6912||0x1f4;return function(_0x9e969c){logger[_0x1a42('0x25')](_0x9e969c[_0x1a42('0x26')]);if(_0x9e969c[_0x1a42('0x27')]){delete _0x9e969c['name'];}_0x43cdb4[_0x1a42('0x1a')](_0x7a6912)['send'](_0x9e969c);};}exports['index']=function(_0x191b9a,_0x4ca268){var _0x529a3e={},_0x533d09={},_0x48b2bd={'count':0x0,'rows':[]};var _0x1fd36c=_[_0x1a42('0x28')](db[_0x1a42('0x29')][_0x1a42('0x2a')],function(_0x28688b){return{'name':_0x28688b['fieldName'],'type':_0x28688b[_0x1a42('0x2b')][_0x1a42('0x2c')]};});_0x533d09[_0x1a42('0x2d')]=_[_0x1a42('0x28')](_0x1fd36c,'name');_0x533d09[_0x1a42('0x2e')]=_[_0x1a42('0x2f')](_0x191b9a[_0x1a42('0x2e')]);_0x533d09['filters']=_[_0x1a42('0x30')](_0x533d09[_0x1a42('0x2d')],_0x533d09[_0x1a42('0x2e')]);_0x529a3e[_0x1a42('0x31')]=_['intersection'](_0x533d09[_0x1a42('0x2d')],qs[_0x1a42('0x32')](_0x191b9a[_0x1a42('0x2e')]['fields']));_0x529a3e[_0x1a42('0x31')]=_0x529a3e[_0x1a42('0x31')][_0x1a42('0x33')]?_0x529a3e[_0x1a42('0x31')]:_0x533d09[_0x1a42('0x2d')];if(!_0x191b9a[_0x1a42('0x2e')]['hasOwnProperty'](_0x1a42('0x34'))){_0x529a3e[_0x1a42('0x1d')]=qs['limit'](_0x191b9a[_0x1a42('0x2e')][_0x1a42('0x1d')]);_0x529a3e[_0x1a42('0x1c')]=qs[_0x1a42('0x1c')](_0x191b9a['query'][_0x1a42('0x1c')]);}_0x529a3e[_0x1a42('0x35')]=qs[_0x1a42('0x36')](_0x191b9a['query'][_0x1a42('0x36')]);_0x529a3e['where']=qs['filters'](_[_0x1a42('0x37')](_0x191b9a[_0x1a42('0x2e')],_0x533d09[_0x1a42('0x38')]),_0x1fd36c);if(_0x191b9a[_0x1a42('0x2e')][_0x1a42('0x39')]){_0x529a3e[_0x1a42('0x3a')]=_[_0x1a42('0x3b')](_0x529a3e[_0x1a42('0x3a')],{'$or':_[_0x1a42('0x28')](_0x1fd36c,function(_0x5edc37){if(_0x5edc37[_0x1a42('0x2b')]!==_0x1a42('0x3c')){var _0x225c6a={};_0x225c6a[_0x5edc37[_0x1a42('0x27')]]={'$like':'%'+_0x191b9a['query'][_0x1a42('0x39')]+'%'};return _0x225c6a;}})});}_0x529a3e=_[_0x1a42('0x3b')]({},_0x529a3e,_0x191b9a['options']);var _0x1dc1eb={'where':_0x529a3e['where']};return db[_0x1a42('0x29')]['count'](_0x1dc1eb)['then'](function(_0x978f78){_0x48b2bd[_0x1a42('0x1b')]=_0x978f78;if(_0x191b9a[_0x1a42('0x2e')][_0x1a42('0x3d')]){_0x529a3e[_0x1a42('0x3e')]=[{'all':!![]}];}return db[_0x1a42('0x29')][_0x1a42('0x3f')](_0x529a3e);})['then'](function(_0x1721da){_0x48b2bd[_0x1a42('0x40')]=_0x1721da;return _0x48b2bd;})[_0x1a42('0x24')](respondWithFilteredResult(_0x4ca268,_0x529a3e))[_0x1a42('0x41')](handleError(_0x4ca268,null));};exports[_0x1a42('0x42')]=function(_0x1a1faa,_0x7e4f35){var _0x1f7219={'raw':!![],'where':{'id':_0x1a1faa[_0x1a42('0x43')]['id']}},_0x11fd5f={};_0x11fd5f['model']=_[_0x1a42('0x2f')](db[_0x1a42('0x29')][_0x1a42('0x2a')]);_0x11fd5f['query']=_[_0x1a42('0x2f')](_0x1a1faa[_0x1a42('0x2e')]);_0x11fd5f['filters']=_['intersection'](_0x11fd5f['model'],_0x11fd5f['query']);_0x1f7219[_0x1a42('0x31')]=_['intersection'](_0x11fd5f['model'],qs['fields'](_0x1a1faa[_0x1a42('0x2e')][_0x1a42('0x32')]));_0x1f7219[_0x1a42('0x31')]=_0x1f7219[_0x1a42('0x31')]['length']?_0x1f7219[_0x1a42('0x31')]:_0x11fd5f[_0x1a42('0x2d')];if(_0x1a1faa[_0x1a42('0x2e')][_0x1a42('0x3d')]){_0x1f7219[_0x1a42('0x3e')]=[{'all':!![]}];}_0x1f7219=_[_0x1a42('0x3b')]({},_0x1f7219,_0x1a1faa[_0x1a42('0x44')]);return db[_0x1a42('0x29')][_0x1a42('0x45')](_0x1f7219)[_0x1a42('0x24')](handleEntityNotFound(_0x7e4f35,null))[_0x1a42('0x24')](respondWithResult(_0x7e4f35,null))[_0x1a42('0x41')](handleError(_0x7e4f35,null));};exports['create']=function(_0x3b7b53,_0x4e862b){return db['OpenchannelTransferReport'][_0x1a42('0x46')](_0x3b7b53[_0x1a42('0x47')],{})[_0x1a42('0x24')](respondWithResult(_0x4e862b,0xc9))[_0x1a42('0x41')](handleError(_0x4e862b,null));};exports[_0x1a42('0x23')]=function(_0x1dad63,_0x2682cf){if(_0x1dad63[_0x1a42('0x47')]['id']){delete _0x1dad63[_0x1a42('0x47')]['id'];}return db[_0x1a42('0x29')][_0x1a42('0x45')]({'where':{'id':_0x1dad63[_0x1a42('0x43')]['id']}})[_0x1a42('0x24')](handleEntityNotFound(_0x2682cf,null))[_0x1a42('0x24')](saveUpdates(_0x1dad63['body'],null))[_0x1a42('0x24')](respondWithResult(_0x2682cf,null))[_0x1a42('0x41')](handleError(_0x2682cf,null));};exports[_0x1a42('0x48')]=function(_0x170226,_0x41a178){return db[_0x1a42('0x29')][_0x1a42('0x45')]({'where':{'id':_0x170226[_0x1a42('0x43')]['id']}})[_0x1a42('0x24')](handleEntityNotFound(_0x41a178,null))[_0x1a42('0x24')](removeEntity(_0x41a178,null))[_0x1a42('0x41')](handleError(_0x41a178,null));};exports['describe']=function(_0x172bd8,_0x20a827){return db[_0x1a42('0x29')][_0x1a42('0x49')]()[_0x1a42('0x24')](respondWithResult(_0x20a827,null))[_0x1a42('0x41')](handleError(_0x20a827,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index bfab3c7..5bcecea 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 _0x6afc=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x6afc,0x16b));var _0xc6af=function(_0x492177,_0x3cbe36){_0x492177=_0x492177-0x0;var _0x143849=_0x6afc[_0x492177];return _0x143849;};'use strict';var _=require(_0xc6af('0x0'));var util=require('util');var logger=require(_0xc6af('0x1'))('api');var moment=require(_0xc6af('0x2'));var BPromise=require(_0xc6af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6af('0x4'));var rimraf=require(_0xc6af('0x5'));var config=require(_0xc6af('0x6'));var attributes=require(_0xc6af('0x7'));module['exports']=function(_0x3beacd,_0x2bca8e){return _0x3beacd[_0xc6af('0x8')](_0xc6af('0x9'),attributes,{'tableName':_0xc6af('0xa'),'paranoid':![],'indexes':[{'name':_0xc6af('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb234=['util','api','moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes','define','uniqueid','lodash'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0xb234,0x13f));var _0x4b23=function(_0x4b275f,_0x8017bd){_0x4b275f=_0x4b275f-0x0;var _0xea89b4=_0xb234[_0x4b275f];return _0xea89b4;};'use strict';var _=require(_0x4b23('0x0'));var util=require(_0x4b23('0x1'));var logger=require('../../config/logger')(_0x4b23('0x2'));var moment=require(_0x4b23('0x3'));var BPromise=require(_0x4b23('0x4'));var rp=require(_0x4b23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4b23('0x6'));var attributes=require(_0x4b23('0x7'));module['exports']=function(_0x3767b1,_0x538204){return _0x3767b1[_0x4b23('0x8')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4b23('0x9'),'fields':[_0x4b23('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index cd8ad09..04d5539 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 _0x960c=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','info'];(function(_0xf1e512,_0x3fb6ac){var _0x455c50=function(_0x53d521){while(--_0x53d521){_0xf1e512['push'](_0xf1e512['shift']());}};_0x455c50(++_0x3fb6ac);}(_0x960c,0x113));var _0xc960=function(_0x1e4893,_0x55214d){_0x1e4893=_0x1e4893-0x0;var _0x278e29=_0x960c[_0x1e4893];return _0x278e29;};'use strict';var _=require(_0xc960('0x0'));var util=require('util');var moment=require(_0xc960('0x1'));var BPromise=require('bluebird');var rs=require(_0xc960('0x2'));var fs=require('fs');var Redis=require(_0xc960('0x3'));var db=require(_0xc960('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc960('0x5'))(_0xc960('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc960('0x7')][_0xc960('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2cd4c9,_0x5686b1,_0x513f9c){return new BPromise(function(_0x2934b2,_0x284b2a){return client['request'](_0x2cd4c9,_0x513f9c)['then'](function(_0xcf6929){logger[_0xc960('0x9')](_0xc960('0xa'),_0x5686b1,_0xc960('0xb'));logger[_0xc960('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5686b1,_0xc960('0xb'),JSON[_0xc960('0xd')](_0xcf6929));if(_0xcf6929[_0xc960('0xe')]){if(_0xcf6929[_0xc960('0xe')][_0xc960('0xf')]===0x1f4){logger[_0xc960('0xe')](_0xc960('0xa'),_0x5686b1,_0xcf6929[_0xc960('0xe')][_0xc960('0x10')]);return _0x284b2a(_0xcf6929[_0xc960('0xe')][_0xc960('0x10')]);}logger['error'](_0xc960('0xa'),_0x5686b1,_0xcf6929[_0xc960('0xe')][_0xc960('0x10')]);return _0x2934b2(_0xcf6929[_0xc960('0xe')]['message']);}else{logger[_0xc960('0x9')](_0xc960('0xa'),_0x5686b1,_0xc960('0xb'));_0x2934b2(_0xcf6929[_0xc960('0x11')][_0xc960('0x10')]);}})[_0xc960('0x12')](function(_0x10c47d){logger[_0xc960('0xe')](_0xc960('0xa'),_0x5686b1,_0x10c47d);_0x284b2a(_0x10c47d);});});} \ No newline at end of file +var _0x78e0=['stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78e0,0x13e));var _0x078e=function(_0x83b4e,_0x47c407){_0x83b4e=_0x83b4e-0x0;var _0x2beec8=_0x78e0[_0x83b4e];return _0x2beec8;};'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});function respondWithRpcPromise(_0x117087,_0x5e67ea,_0x2e5eed){return new BPromise(function(_0x1eec5c,_0x16fa72){return client[_0x078e('0xc')](_0x117087,_0x2e5eed)[_0x078e('0xd')](function(_0x1188fe){logger[_0x078e('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5e67ea,_0x078e('0xf'));logger[_0x078e('0x10')](_0x078e('0x11'),_0x5e67ea,_0x078e('0xf'),JSON[_0x078e('0x12')](_0x1188fe));if(_0x1188fe[_0x078e('0x13')]){if(_0x1188fe[_0x078e('0x13')][_0x078e('0x14')]===0x1f4){logger[_0x078e('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5e67ea,_0x1188fe[_0x078e('0x13')]['message']);return _0x16fa72(_0x1188fe['error'][_0x078e('0x15')]);}logger['error'](_0x078e('0x16'),_0x5e67ea,_0x1188fe[_0x078e('0x13')][_0x078e('0x15')]);return _0x1eec5c(_0x1188fe[_0x078e('0x13')][_0x078e('0x15')]);}else{logger[_0x078e('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5e67ea,'request\x20sent');_0x1eec5c(_0x1188fe['result'][_0x078e('0x15')]);}})[_0x078e('0x17')](function(_0x48aa6b){logger[_0x078e('0x13')](_0x078e('0x16'),_0x5e67ea,_0x48aa6b);_0x16fa72(_0x48aa6b);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 4ba2057..d1efbdc 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 _0xf2ac=['post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','/:id'];(function(_0x3b2da1,_0x5dc17b){var _0x4f530a=function(_0x2e8533){while(--_0x2e8533){_0x3b2da1['push'](_0x3b2da1['shift']());}};_0x4f530a(++_0x5dc17b);}(_0xf2ac,0x1d9));var _0xcf2a=function(_0x211611,_0x2d0896){_0x211611=_0x211611-0x0;var _0x2ba5c9=_0xf2ac[_0x211611];return _0x2ba5c9;};'use strict';var multer=require(_0xcf2a('0x0'));var util=require(_0xcf2a('0x1'));var path=require(_0xcf2a('0x2'));var timeout=require(_0xcf2a('0x3'));var express=require(_0xcf2a('0x4'));var router=express[_0xcf2a('0x5')]();var auth=require(_0xcf2a('0x6'));var interaction=require(_0xcf2a('0x7'));var config=require(_0xcf2a('0x8'));var controller=require(_0xcf2a('0x9'));router['get']('/',auth[_0xcf2a('0xa')](),controller[_0xcf2a('0xb')]);router['get'](_0xcf2a('0xc'),auth[_0xcf2a('0xa')](),controller['show']);router[_0xcf2a('0xd')]('/',auth[_0xcf2a('0xa')](),controller['create']);router['put'](_0xcf2a('0xc'),auth['isAuthenticated'](),controller[_0xcf2a('0xe')]);router[_0xcf2a('0xf')](_0xcf2a('0xc'),auth[_0xcf2a('0xa')](),controller[_0xcf2a('0x10')]);module[_0xcf2a('0x11')]=router; \ No newline at end of file +var _0x9997=['./pause.controller','get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x581f62,_0xf5feb5){var _0x5909a2=function(_0x441ea1){while(--_0x441ea1){_0x581f62['push'](_0x581f62['shift']());}};_0x5909a2(++_0xf5feb5);}(_0x9997,0xf8));var _0x7999=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0x9997[_0x467cb0];return _0x2153f7;};'use strict';var multer=require('multer');var util=require(_0x7999('0x0'));var path=require(_0x7999('0x1'));var timeout=require(_0x7999('0x2'));var express=require('express');var router=express[_0x7999('0x3')]();var auth=require(_0x7999('0x4'));var interaction=require(_0x7999('0x5'));var config=require(_0x7999('0x6'));var controller=require(_0x7999('0x7'));router[_0x7999('0x8')]('/',auth[_0x7999('0x9')](),controller['index']);router[_0x7999('0x8')]('/:id',auth[_0x7999('0x9')](),controller[_0x7999('0xa')]);router[_0x7999('0xb')]('/',auth[_0x7999('0x9')](),controller[_0x7999('0xc')]);router['put'](_0x7999('0xd'),auth[_0x7999('0x9')](),controller['update']);router[_0x7999('0xe')](_0x7999('0xd'),auth['isAuthenticated'](),controller[_0x7999('0xf')]);module[_0x7999('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 763a6e7..63075f3 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 _0xbee6=['sequelize','exports','STRING','name'];(function(_0x1db33d,_0x15befd){var _0x4ec6a9=function(_0x10bbdd){while(--_0x10bbdd){_0x1db33d['push'](_0x1db33d['shift']());}};_0x4ec6a9(++_0x15befd);}(_0xbee6,0x1b0));var _0x6bee=function(_0x5652a3,_0x28b4af){_0x5652a3=_0x5652a3-0x0;var _0xafd7ea=_0xbee6[_0x5652a3];return _0xafd7ea;};'use strict';var Sequelize=require(_0x6bee('0x0'));module[_0x6bee('0x1')]={'name':{'type':Sequelize[_0x6bee('0x2')],'unique':_0x6bee('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6bee('0x2')]}}; \ No newline at end of file +var _0xce48=['exports','STRING'];(function(_0x26bf57,_0x27668e){var _0x2ae579=function(_0x450103){while(--_0x450103){_0x26bf57['push'](_0x26bf57['shift']());}};_0x2ae579(++_0x27668e);}(_0xce48,0x136));var _0x8ce4=function(_0x25344e,_0x41b2f1){_0x25344e=_0x25344e-0x0;var _0x3bf737=_0xce48[_0x25344e];return _0x3bf737;};'use strict';var Sequelize=require('sequelize');module[_0x8ce4('0x0')]={'name':{'type':Sequelize[_0x8ce4('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8ce4('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index cd71a1e..9da01f2 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 _0x2fb6=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','destroy','then','get','Pauses','UserProfileResource','error','stack','send','index','map','Pause','rawAttributes','key','model','name','keys','query','filters','intersection','attributes','fields','length','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','include','find','create','body'];(function(_0x3e5665,_0x20fab9){var _0x382b82=function(_0x53ef41){while(--_0x53ef41){_0x3e5665['push'](_0x3e5665['shift']());}};_0x382b82(++_0x20fab9);}(_0x2fb6,0xee));var _0x62fb=function(_0x20e152,_0x323c5e){_0x20e152=_0x20e152-0x0;var _0x49e0a5=_0x2fb6[_0x20e152];return _0x49e0a5;};'use strict';var pdf=require(_0x62fb('0x0'));var emlformat=require(_0x62fb('0x1'));var rimraf=require(_0x62fb('0x2'));var zipdir=require(_0x62fb('0x3'));var jsonpatch=require(_0x62fb('0x4'));var rp=require(_0x62fb('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x62fb('0x6'));var path=require(_0x62fb('0x7'));var sox=require('sox');var csv=require(_0x62fb('0x8'));var ejs=require(_0x62fb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x62fb('0xa'));var crypto=require(_0x62fb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x62fb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x62fb('0xd'));var Papa=require('papaparse');var Redis=require(_0x62fb('0xe'));var authService=require(_0x62fb('0xf'));var qs=require(_0x62fb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62fb('0x11'));var logger=require(_0x62fb('0x12'))(_0x62fb('0x13'));var utils=require(_0x62fb('0x14'));var config=require(_0x62fb('0x15'));var db=require(_0x62fb('0x16'))['db'];function respondWithStatusCode(_0x13c4bc,_0x30b0c4){_0x30b0c4=_0x30b0c4||0xcc;return function(_0xce9eb9){if(_0xce9eb9){return _0x13c4bc['sendStatus'](_0x30b0c4);}return _0x13c4bc[_0x62fb('0x17')](_0x30b0c4)[_0x62fb('0x18')]();};}function respondWithResult(_0x5754ad,_0x68d261){_0x68d261=_0x68d261||0xc8;return function(_0x5c3eeb){if(_0x5c3eeb){return _0x5754ad[_0x62fb('0x17')](_0x68d261)['json'](_0x5c3eeb);}};}function respondWithFilteredResult(_0x2b1c9c,_0x5002bc){return function(_0x595f9a){if(_0x595f9a){var _0x582100=_0x595f9a[_0x62fb('0x19')],_0x316ecb=_0x5002bc[_0x62fb('0x1a')],_0x5f427e=_0x5002bc[_0x62fb('0x1a')]+_0x5002bc[_0x62fb('0x1b')],_0x226e5f;if(_0x5f427e>=_0x582100){_0x5f427e=_0x582100;_0x226e5f=0xc8;}else{_0x226e5f=0xce;}_0x2b1c9c[_0x62fb('0x17')](_0x226e5f);return _0x2b1c9c['set'](_0x62fb('0x1c'),_0x316ecb+'-'+_0x5f427e+'/'+_0x582100)[_0x62fb('0x1d')](_0x595f9a);}return null;};}function patchUpdates(_0x370629){return function(_0x42be93){try{jsonpatch[_0x62fb('0x1e')](_0x42be93,_0x370629,!![]);}catch(_0x3439fa){return BPromise[_0x62fb('0x1f')](_0x3439fa);}return _0x42be93['save']();};}function saveUpdates(_0x5f1b7e,_0x1315cd){return function(_0x3f249e){if(_0x3f249e){return _0x3f249e['update'](_0x5f1b7e)['then'](function(_0x5c98bb){return _0x5c98bb;});}return null;};}function removeEntity(_0x5d5aab,_0x598ea7){return function(_0x447340){if(_0x447340){return _0x447340[_0x62fb('0x20')]()[_0x62fb('0x21')](function(){var _0x2d9d7a=_0x447340[_0x62fb('0x22')]({'plain':!![]});var _0x27a250=_0x62fb('0x23');return db[_0x62fb('0x24')][_0x62fb('0x20')]({'where':{'type':_0x27a250,'resourceId':_0x2d9d7a['id']}})[_0x62fb('0x21')](function(){return _0x447340;});})[_0x62fb('0x21')](function(){_0x5d5aab['status'](0xcc)[_0x62fb('0x18')]();});}};}function handleEntityNotFound(_0x4371b9,_0x241249){return function(_0x43227e){if(!_0x43227e){_0x4371b9['sendStatus'](0x194);}return _0x43227e;};}function handleError(_0x1c88ba,_0x801c34){_0x801c34=_0x801c34||0x1f4;return function(_0x345bc7){logger[_0x62fb('0x25')](_0x345bc7[_0x62fb('0x26')]);if(_0x345bc7['name']){delete _0x345bc7['name'];}_0x1c88ba[_0x62fb('0x17')](_0x801c34)[_0x62fb('0x27')](_0x345bc7);};}exports[_0x62fb('0x28')]=function(_0x5f27a7,_0x381103){var _0x40e6a1={},_0x143566={},_0x55a144={'count':0x0,'rows':[]};var _0x51d082=_[_0x62fb('0x29')](db[_0x62fb('0x2a')][_0x62fb('0x2b')],function(_0x585815){return{'name':_0x585815['fieldName'],'type':_0x585815['type'][_0x62fb('0x2c')]};});_0x143566[_0x62fb('0x2d')]=_[_0x62fb('0x29')](_0x51d082,_0x62fb('0x2e'));_0x143566['query']=_[_0x62fb('0x2f')](_0x5f27a7[_0x62fb('0x30')]);_0x143566[_0x62fb('0x31')]=_[_0x62fb('0x32')](_0x143566[_0x62fb('0x2d')],_0x143566['query']);_0x40e6a1[_0x62fb('0x33')]=_[_0x62fb('0x32')](_0x143566[_0x62fb('0x2d')],qs[_0x62fb('0x34')](_0x5f27a7['query'][_0x62fb('0x34')]));_0x40e6a1[_0x62fb('0x33')]=_0x40e6a1[_0x62fb('0x33')][_0x62fb('0x35')]?_0x40e6a1[_0x62fb('0x33')]:_0x143566[_0x62fb('0x2d')];if(!_0x5f27a7[_0x62fb('0x30')]['hasOwnProperty']('nolimit')){_0x40e6a1['limit']=qs[_0x62fb('0x1b')](_0x5f27a7[_0x62fb('0x30')]['limit']);_0x40e6a1[_0x62fb('0x1a')]=qs[_0x62fb('0x1a')](_0x5f27a7['query'][_0x62fb('0x1a')]);}_0x40e6a1[_0x62fb('0x36')]=qs['sort'](_0x5f27a7[_0x62fb('0x30')][_0x62fb('0x37')]);_0x40e6a1[_0x62fb('0x38')]=qs[_0x62fb('0x31')](_['pick'](_0x5f27a7[_0x62fb('0x30')],_0x143566[_0x62fb('0x31')]),_0x51d082);if(_0x5f27a7[_0x62fb('0x30')]['filter']){_0x40e6a1[_0x62fb('0x38')]=_[_0x62fb('0x39')](_0x40e6a1['where'],{'$or':_[_0x62fb('0x29')](_0x51d082,function(_0x4b7eea){if(_0x4b7eea[_0x62fb('0x3a')]!==_0x62fb('0x3b')){var _0xdeba11={};_0xdeba11[_0x4b7eea[_0x62fb('0x2e')]]={'$like':'%'+_0x5f27a7[_0x62fb('0x30')][_0x62fb('0x3c')]+'%'};return _0xdeba11;}})});}_0x40e6a1=_[_0x62fb('0x39')]({},_0x40e6a1,_0x5f27a7[_0x62fb('0x3d')]);var _0x4e38e7={'where':_0x40e6a1[_0x62fb('0x38')]};return db['Pause'][_0x62fb('0x19')](_0x4e38e7)['then'](function(_0x2fb474){_0x55a144['count']=_0x2fb474;if(_0x5f27a7[_0x62fb('0x30')][_0x62fb('0x3e')]){_0x40e6a1['include']=[{'all':!![]}];}return db[_0x62fb('0x2a')][_0x62fb('0x3f')](_0x40e6a1);})[_0x62fb('0x21')](function(_0x2b3276){_0x55a144[_0x62fb('0x40')]=_0x2b3276;return _0x55a144;})[_0x62fb('0x21')](respondWithFilteredResult(_0x381103,_0x40e6a1))[_0x62fb('0x41')](handleError(_0x381103,null));};exports['show']=function(_0x5c2b8d,_0xe13488){var _0x6c6e1a={'raw':!![],'where':{'id':_0x5c2b8d['params']['id']}},_0x538f2b={};_0x538f2b[_0x62fb('0x2d')]=_['keys'](db[_0x62fb('0x2a')][_0x62fb('0x2b')]);_0x538f2b[_0x62fb('0x30')]=_['keys'](_0x5c2b8d['query']);_0x538f2b[_0x62fb('0x31')]=_['intersection'](_0x538f2b[_0x62fb('0x2d')],_0x538f2b[_0x62fb('0x30')]);_0x6c6e1a[_0x62fb('0x33')]=_[_0x62fb('0x32')](_0x538f2b[_0x62fb('0x2d')],qs[_0x62fb('0x34')](_0x5c2b8d[_0x62fb('0x30')]['fields']));_0x6c6e1a[_0x62fb('0x33')]=_0x6c6e1a[_0x62fb('0x33')][_0x62fb('0x35')]?_0x6c6e1a[_0x62fb('0x33')]:_0x538f2b[_0x62fb('0x2d')];if(_0x5c2b8d['query'][_0x62fb('0x3e')]){_0x6c6e1a[_0x62fb('0x42')]=[{'all':!![]}];}_0x6c6e1a=_['merge']({},_0x6c6e1a,_0x5c2b8d[_0x62fb('0x3d')]);return db[_0x62fb('0x2a')][_0x62fb('0x43')](_0x6c6e1a)[_0x62fb('0x21')](handleEntityNotFound(_0xe13488,null))[_0x62fb('0x21')](respondWithResult(_0xe13488,null))[_0x62fb('0x41')](handleError(_0xe13488,null));};exports[_0x62fb('0x44')]=function(_0xa2c2eb,_0x30a79b){return db[_0x62fb('0x2a')]['create'](_0xa2c2eb[_0x62fb('0x45')],{})['then'](function(_0x1ea7f0){var _0x32bb83=_0xa2c2eb[_0x62fb('0x46')][_0x62fb('0x22')]({'plain':!![]});if(!_0x32bb83)throw new Error(_0x62fb('0x47'));if(_0x32bb83['role']===_0x62fb('0x46')){var _0x31d737=_0x1ea7f0[_0x62fb('0x22')]({'plain':!![]});var _0x2a3d15=_0x62fb('0x23');return db[_0x62fb('0x48')][_0x62fb('0x43')]({'where':{'name':_0x2a3d15,'userProfileId':_0x32bb83[_0x62fb('0x49')]},'raw':!![]})[_0x62fb('0x21')](function(_0x29c67d){if(_0x29c67d&&_0x29c67d[_0x62fb('0x4a')]===0x0){return db[_0x62fb('0x24')][_0x62fb('0x44')]({'name':_0x31d737[_0x62fb('0x2e')],'resourceId':_0x31d737['id'],'type':_0x29c67d[_0x62fb('0x2e')],'sectionId':_0x29c67d['id']},{})[_0x62fb('0x21')](function(){return _0x1ea7f0;});}else{return _0x1ea7f0;}})[_0x62fb('0x41')](function(_0x407147){logger[_0x62fb('0x25')](_0x62fb('0x4b'),_0x407147);throw _0x407147;});}return _0x1ea7f0;})[_0x62fb('0x21')](respondWithResult(_0x30a79b,0xc9))[_0x62fb('0x41')](handleError(_0x30a79b,null));};exports[_0x62fb('0x4c')]=function(_0x466d96,_0x555ebf){if(_0x466d96['body']['id']){delete _0x466d96['body']['id'];}return db['Pause']['find']({'where':{'id':_0x466d96['params']['id']}})[_0x62fb('0x21')](handleEntityNotFound(_0x555ebf,null))['then'](saveUpdates(_0x466d96['body'],null))[_0x62fb('0x21')](respondWithResult(_0x555ebf,null))[_0x62fb('0x41')](handleError(_0x555ebf,null));};exports['destroy']=function(_0x4cdb3f,_0x874cf6){return db[_0x62fb('0x2a')][_0x62fb('0x43')]({'where':{'id':_0x4cdb3f['params']['id']}})['then'](handleEntityNotFound(_0x874cf6,null))['then'](removeEntity(_0x874cf6,null))[_0x62fb('0x41')](handleError(_0x874cf6,null));}; \ No newline at end of file +var _0x6474=['api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','then','destroy','get','Pauses','UserProfileResource','error','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','limit','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','params','Pause','length','includeAll','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','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xe75a6f,_0x4706ff){var _0x26b549=function(_0x4c37b3){while(--_0x4c37b3){_0xe75a6f['push'](_0xe75a6f['shift']());}};_0x26b549(++_0x4706ff);}(_0x6474,0x8a));var _0x4647=function(_0x224617,_0x35e6e7){_0x224617=_0x224617-0x0;var _0x24711c=_0x6474[_0x224617];return _0x24711c;};'use strict';var pdf=require(_0x4647('0x0'));var emlformat=require(_0x4647('0x1'));var rimraf=require(_0x4647('0x2'));var zipdir=require(_0x4647('0x3'));var jsonpatch=require(_0x4647('0x4'));var rp=require(_0x4647('0x5'));var moment=require(_0x4647('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4647('0x7'));var path=require(_0x4647('0x8'));var sox=require(_0x4647('0x9'));var csv=require(_0x4647('0xa'));var ejs=require(_0x4647('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4647('0xc'));var crypto=require(_0x4647('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4647('0xe'));var toCsv=require(_0x4647('0xa'));var querystring=require(_0x4647('0xf'));var Papa=require(_0x4647('0x10'));var Redis=require(_0x4647('0x11'));var authService=require(_0x4647('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4647('0x13'));var hardwareService=require(_0x4647('0x14'));var logger=require(_0x4647('0x15'))(_0x4647('0x16'));var utils=require('../../config/utils');var config=require(_0x4647('0x17'));var db=require(_0x4647('0x18'))['db'];function respondWithStatusCode(_0x4778fa,_0x2ca4a3){_0x2ca4a3=_0x2ca4a3||0xcc;return function(_0x177501){if(_0x177501){return _0x4778fa[_0x4647('0x19')](_0x2ca4a3);}return _0x4778fa[_0x4647('0x1a')](_0x2ca4a3)[_0x4647('0x1b')]();};}function respondWithResult(_0x47053e,_0x331ad2){_0x331ad2=_0x331ad2||0xc8;return function(_0x523a9f){if(_0x523a9f){return _0x47053e[_0x4647('0x1a')](_0x331ad2)['json'](_0x523a9f);}};}function respondWithFilteredResult(_0x5343c6,_0x49ed35){return function(_0x3dfbde){if(_0x3dfbde){var _0x2ebbcd=_0x3dfbde[_0x4647('0x1c')],_0x404e65=_0x49ed35[_0x4647('0x1d')],_0x36134d=_0x49ed35['offset']+_0x49ed35['limit'],_0x1cda8d;if(_0x36134d>=_0x2ebbcd){_0x36134d=_0x2ebbcd;_0x1cda8d=0xc8;}else{_0x1cda8d=0xce;}_0x5343c6[_0x4647('0x1a')](_0x1cda8d);return _0x5343c6[_0x4647('0x1e')](_0x4647('0x1f'),_0x404e65+'-'+_0x36134d+'/'+_0x2ebbcd)['json'](_0x3dfbde);}return null;};}function patchUpdates(_0x171f08){return function(_0x596bdc){try{jsonpatch[_0x4647('0x20')](_0x596bdc,_0x171f08,!![]);}catch(_0x4c1eae){return BPromise[_0x4647('0x21')](_0x4c1eae);}return _0x596bdc['save']();};}function saveUpdates(_0x1fbfc1,_0x2c83a3){return function(_0x135485){if(_0x135485){return _0x135485['update'](_0x1fbfc1)[_0x4647('0x22')](function(_0x4df499){return _0x4df499;});}return null;};}function removeEntity(_0x3b2a62,_0x5be7f1){return function(_0x5549a4){if(_0x5549a4){return _0x5549a4[_0x4647('0x23')]()[_0x4647('0x22')](function(){var _0xc851e3=_0x5549a4[_0x4647('0x24')]({'plain':!![]});var _0x51fa35=_0x4647('0x25');return db[_0x4647('0x26')]['destroy']({'where':{'type':_0x51fa35,'resourceId':_0xc851e3['id']}})[_0x4647('0x22')](function(){return _0x5549a4;});})[_0x4647('0x22')](function(){_0x3b2a62[_0x4647('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4037,_0x49a368){return function(_0x418d8e){if(!_0x418d8e){_0x2b4037[_0x4647('0x19')](0x194);}return _0x418d8e;};}function handleError(_0x2c7e77,_0x1063a2){_0x1063a2=_0x1063a2||0x1f4;return function(_0x5ead03){logger[_0x4647('0x27')](_0x5ead03['stack']);if(_0x5ead03[_0x4647('0x28')]){delete _0x5ead03['name'];}_0x2c7e77[_0x4647('0x1a')](_0x1063a2)['send'](_0x5ead03);};}exports[_0x4647('0x29')]=function(_0x30f8c6,_0x5dc02a){var _0xea2f6c={},_0x3626cc={},_0x37c96c={'count':0x0,'rows':[]};var _0x28a82a=_['map'](db['Pause'][_0x4647('0x2a')],function(_0x31363f){return{'name':_0x31363f[_0x4647('0x2b')],'type':_0x31363f['type'][_0x4647('0x2c')]};});_0x3626cc[_0x4647('0x2d')]=_[_0x4647('0x2e')](_0x28a82a,_0x4647('0x28'));_0x3626cc[_0x4647('0x2f')]=_[_0x4647('0x30')](_0x30f8c6[_0x4647('0x2f')]);_0x3626cc[_0x4647('0x31')]=_['intersection'](_0x3626cc['model'],_0x3626cc[_0x4647('0x2f')]);_0xea2f6c[_0x4647('0x32')]=_[_0x4647('0x33')](_0x3626cc['model'],qs[_0x4647('0x34')](_0x30f8c6['query'][_0x4647('0x34')]));_0xea2f6c[_0x4647('0x32')]=_0xea2f6c[_0x4647('0x32')]['length']?_0xea2f6c[_0x4647('0x32')]:_0x3626cc[_0x4647('0x2d')];if(!_0x30f8c6[_0x4647('0x2f')]['hasOwnProperty'](_0x4647('0x35'))){_0xea2f6c[_0x4647('0x36')]=qs['limit'](_0x30f8c6[_0x4647('0x2f')]['limit']);_0xea2f6c[_0x4647('0x1d')]=qs[_0x4647('0x1d')](_0x30f8c6['query'][_0x4647('0x1d')]);}_0xea2f6c['order']=qs[_0x4647('0x37')](_0x30f8c6[_0x4647('0x2f')]['sort']);_0xea2f6c[_0x4647('0x38')]=qs[_0x4647('0x31')](_['pick'](_0x30f8c6[_0x4647('0x2f')],_0x3626cc[_0x4647('0x31')]),_0x28a82a);if(_0x30f8c6[_0x4647('0x2f')][_0x4647('0x39')]){_0xea2f6c[_0x4647('0x38')]=_['merge'](_0xea2f6c['where'],{'$or':_[_0x4647('0x2e')](_0x28a82a,function(_0x1c79be){if(_0x1c79be[_0x4647('0x3a')]!==_0x4647('0x3b')){var _0x466108={};_0x466108[_0x1c79be[_0x4647('0x28')]]={'$like':'%'+_0x30f8c6['query'][_0x4647('0x39')]+'%'};return _0x466108;}})});}_0xea2f6c=_[_0x4647('0x3c')]({},_0xea2f6c,_0x30f8c6[_0x4647('0x3d')]);var _0x201977={'where':_0xea2f6c[_0x4647('0x38')]};return db['Pause'][_0x4647('0x1c')](_0x201977)[_0x4647('0x22')](function(_0x31a705){_0x37c96c[_0x4647('0x1c')]=_0x31a705;if(_0x30f8c6[_0x4647('0x2f')]['includeAll']){_0xea2f6c[_0x4647('0x3e')]=[{'all':!![]}];}return db['Pause'][_0x4647('0x3f')](_0xea2f6c);})[_0x4647('0x22')](function(_0x582776){_0x37c96c[_0x4647('0x40')]=_0x582776;return _0x37c96c;})['then'](respondWithFilteredResult(_0x5dc02a,_0xea2f6c))['catch'](handleError(_0x5dc02a,null));};exports['show']=function(_0x1327b0,_0x4886d9){var _0x3b3933={'raw':!![],'where':{'id':_0x1327b0[_0x4647('0x41')]['id']}},_0x1805d3={};_0x1805d3[_0x4647('0x2d')]=_['keys'](db[_0x4647('0x42')][_0x4647('0x2a')]);_0x1805d3['query']=_[_0x4647('0x30')](_0x1327b0[_0x4647('0x2f')]);_0x1805d3[_0x4647('0x31')]=_['intersection'](_0x1805d3['model'],_0x1805d3['query']);_0x3b3933[_0x4647('0x32')]=_[_0x4647('0x33')](_0x1805d3[_0x4647('0x2d')],qs['fields'](_0x1327b0[_0x4647('0x2f')][_0x4647('0x34')]));_0x3b3933[_0x4647('0x32')]=_0x3b3933[_0x4647('0x32')][_0x4647('0x43')]?_0x3b3933['attributes']:_0x1805d3[_0x4647('0x2d')];if(_0x1327b0['query'][_0x4647('0x44')]){_0x3b3933['include']=[{'all':!![]}];}_0x3b3933=_[_0x4647('0x3c')]({},_0x3b3933,_0x1327b0[_0x4647('0x3d')]);return db[_0x4647('0x42')]['find'](_0x3b3933)[_0x4647('0x22')](handleEntityNotFound(_0x4886d9,null))[_0x4647('0x22')](respondWithResult(_0x4886d9,null))['catch'](handleError(_0x4886d9,null));};exports[_0x4647('0x45')]=function(_0x219438,_0x16230c){return db['Pause']['create'](_0x219438[_0x4647('0x46')],{})[_0x4647('0x22')](function(_0x4a5e32){var _0xd6b450=_0x219438[_0x4647('0x47')][_0x4647('0x24')]({'plain':!![]});if(!_0xd6b450)throw new Error(_0x4647('0x48'));if(_0xd6b450[_0x4647('0x49')]===_0x4647('0x47')){var _0x1c4bdb=_0x4a5e32[_0x4647('0x24')]({'plain':!![]});var _0x42842b=_0x4647('0x25');return db[_0x4647('0x4a')][_0x4647('0x4b')]({'where':{'name':_0x42842b,'userProfileId':_0xd6b450[_0x4647('0x4c')]},'raw':!![]})[_0x4647('0x22')](function(_0x562c37){if(_0x562c37&&_0x562c37[_0x4647('0x4d')]===0x0){return db[_0x4647('0x26')][_0x4647('0x45')]({'name':_0x1c4bdb['name'],'resourceId':_0x1c4bdb['id'],'type':_0x562c37[_0x4647('0x28')],'sectionId':_0x562c37['id']},{})[_0x4647('0x22')](function(){return _0x4a5e32;});}else{return _0x4a5e32;}})['catch'](function(_0x1c2882){logger[_0x4647('0x27')](_0x4647('0x4e'),_0x1c2882);throw _0x1c2882;});}return _0x4a5e32;})['then'](respondWithResult(_0x16230c,0xc9))['catch'](handleError(_0x16230c,null));};exports['update']=function(_0x3317a7,_0x204a22){if(_0x3317a7[_0x4647('0x46')]['id']){delete _0x3317a7[_0x4647('0x46')]['id'];}return db[_0x4647('0x42')][_0x4647('0x4b')]({'where':{'id':_0x3317a7[_0x4647('0x41')]['id']}})['then'](handleEntityNotFound(_0x204a22,null))['then'](saveUpdates(_0x3317a7[_0x4647('0x46')],null))[_0x4647('0x22')](respondWithResult(_0x204a22,null))[_0x4647('0x4f')](handleError(_0x204a22,null));};exports['destroy']=function(_0xede724,_0x6a31fe){return db[_0x4647('0x42')][_0x4647('0x4b')]({'where':{'id':_0xede724['params']['id']}})[_0x4647('0x22')](handleEntityNotFound(_0x6a31fe,null))['then'](removeEntity(_0x6a31fe,null))['catch'](handleError(_0x6a31fe,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 679644b..90a716a 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 _0x5f39=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes'];(function(_0x21d07b,_0x358223){var _0x576f85=function(_0xc4e61c){while(--_0xc4e61c){_0x21d07b['push'](_0x21d07b['shift']());}};_0x576f85(++_0x358223);}(_0x5f39,0x1b1));var _0x95f3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5f39[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x95f3('0x0'));var util=require(_0x95f3('0x1'));var logger=require(_0x95f3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x95f3('0x3'));var rp=require(_0x95f3('0x4'));var fs=require('fs');var path=require(_0x95f3('0x5'));var rimraf=require(_0x95f3('0x6'));var config=require(_0x95f3('0x7'));var attributes=require(_0x95f3('0x8'));module[_0x95f3('0x9')]=function(_0x42101a,_0x2eddf2){return _0x42101a[_0x95f3('0xa')](_0x95f3('0xb'),attributes,{'tableName':_0x95f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae24=['lodash','../../config/logger','moment','request-promise','../../config/environment','./pause.attributes','define','Pause'];(function(_0x5230ed,_0x2eb03e){var _0x43bb42=function(_0x407331){while(--_0x407331){_0x5230ed['push'](_0x5230ed['shift']());}};_0x43bb42(++_0x2eb03e);}(_0xae24,0x180));var _0x4ae2=function(_0x7a8d19,_0x32dac4){_0x7a8d19=_0x7a8d19-0x0;var _0x33f3a5=_0xae24[_0x7a8d19];return _0x33f3a5;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require('bluebird');var rp=require(_0x4ae2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ae2('0x4'));var attributes=require(_0x4ae2('0x5'));module['exports']=function(_0x31e734,_0x448c4b){return _0x31e734[_0x4ae2('0x6')](_0x4ae2('0x7'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 20be1db..9cd3c04 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 _0x5a08=['catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','debug','stringify','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x529272,_0x12ca50){var _0x2466ac=function(_0x13e3c6){while(--_0x13e3c6){_0x529272['push'](_0x529272['shift']());}};_0x2466ac(++_0x12ca50);}(_0x5a08,0xc1));var _0x85a0=function(_0x30c0f7,_0x4b53e1){_0x30c0f7=_0x30c0f7-0x0;var _0x519efb=_0x5a08[_0x30c0f7];return _0x519efb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x85a0('0x0'));var rs=require(_0x85a0('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85a0('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x85a0('0x3'))(_0x85a0('0x4'));var config=require(_0x85a0('0x5'));var jayson=require(_0x85a0('0x6'));var client=jayson[_0x85a0('0x7')][_0x85a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13148c,_0x115e69,_0x1483d7){return new BPromise(function(_0xf3b7f5,_0x5668ce){return client[_0x85a0('0x9')](_0x13148c,_0x1483d7)[_0x85a0('0xa')](function(_0x354b2d){logger['info'](_0x85a0('0xb'),_0x115e69,'request\x20sent');logger['debug'](_0x85a0('0xc'),_0x115e69,'request\x20sent',JSON['stringify'](_0x354b2d));if(_0x354b2d[_0x85a0('0xd')]){if(_0x354b2d[_0x85a0('0xd')][_0x85a0('0xe')]===0x1f4){logger[_0x85a0('0xd')](_0x85a0('0xb'),_0x115e69,_0x354b2d[_0x85a0('0xd')][_0x85a0('0xf')]);return _0x5668ce(_0x354b2d[_0x85a0('0xd')][_0x85a0('0xf')]);}logger[_0x85a0('0xd')](_0x85a0('0xb'),_0x115e69,_0x354b2d[_0x85a0('0xd')][_0x85a0('0xf')]);return _0xf3b7f5(_0x354b2d[_0x85a0('0xd')]['message']);}else{logger[_0x85a0('0x10')](_0x85a0('0xb'),_0x115e69,'request\x20sent');_0xf3b7f5(_0x354b2d['result'][_0x85a0('0xf')]);}})[_0x85a0('0x11')](function(_0x4c0cfa){logger[_0x85a0('0xd')]('Pause,\x20%s,\x20%s',_0x115e69,_0x4c0cfa);_0x5668ce(_0x4c0cfa);});});}exports['ShowPause']=function(_0xb48178){var _0x3ed5d7=this;return new Promise(function(_0x255d7b,_0x45448f){return db[_0x85a0('0x12')][_0x85a0('0x13')]({'raw':_0xb48178['options']?_0xb48178[_0x85a0('0x14')][_0x85a0('0x15')]===undefined?!![]:![]:!![],'where':_0xb48178[_0x85a0('0x14')]?_0xb48178[_0x85a0('0x14')][_0x85a0('0x16')]||null:null,'attributes':_0xb48178['options']?_0xb48178[_0x85a0('0x14')][_0x85a0('0x17')]||null:null,'include':_0xb48178[_0x85a0('0x14')]?_0xb48178[_0x85a0('0x14')]['include']?_[_0x85a0('0x18')](_0xb48178[_0x85a0('0x14')][_0x85a0('0x19')],function(_0x52371e){return{'model':db[_0x52371e['model']],'as':_0x52371e['as'],'attributes':_0x52371e[_0x85a0('0x17')],'include':_0x52371e['include']?_[_0x85a0('0x18')](_0x52371e[_0x85a0('0x19')],function(_0x3ee598){return{'model':db[_0x3ee598[_0x85a0('0x1a')]],'as':_0x3ee598['as'],'attributes':_0x3ee598[_0x85a0('0x17')],'include':_0x3ee598[_0x85a0('0x19')]?_['map'](_0x3ee598['include'],function(_0x462341){return{'model':db[_0x462341[_0x85a0('0x1a')]],'as':_0x462341['as'],'attributes':_0x462341[_0x85a0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x85a0('0xa')](function(_0xf78bc5){logger['info'](_0x85a0('0x1b'),_0xb48178);logger[_0x85a0('0x1c')]('ShowPause',_0xb48178,JSON[_0x85a0('0x1d')](_0xf78bc5));_0x255d7b(_0xf78bc5);})['catch'](function(_0xcbfca9){logger['error']('ShowPause',_0xcbfca9[_0x85a0('0xf')],_0xb48178);_0x45448f(_0x3ed5d7[_0x85a0('0xd')](0x1f4,_0xcbfca9[_0x85a0('0xf')]));});});}; \ No newline at end of file +var _0xd572=['message','info','result','ShowPause','find','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','Pause,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd572,0x1cd));var _0x2d57=function(_0x5c1673,_0x1091b8){_0x5c1673=_0x5c1673-0x0;var _0x34315f=_0xd572[_0x5c1673];return _0x34315f;};'use strict';var _=require(_0x2d57('0x0'));var util=require(_0x2d57('0x1'));var moment=require(_0x2d57('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d57('0x3'));var fs=require('fs');var Redis=require(_0x2d57('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2d57('0x5'));var jayson=require(_0x2d57('0x6'));var client=jayson[_0x2d57('0x7')][_0x2d57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5281d6,_0x4edc58,_0x3a5502){return new BPromise(function(_0x1a81e1,_0x182e81){return client[_0x2d57('0x9')](_0x5281d6,_0x3a5502)['then'](function(_0x533c62){logger['info'](_0x2d57('0xa'),_0x4edc58,_0x2d57('0xb'));logger['debug']('Pause,\x20%s,\x20%s,\x20%s',_0x4edc58,_0x2d57('0xb'),JSON[_0x2d57('0xc')](_0x533c62));if(_0x533c62[_0x2d57('0xd')]){if(_0x533c62['error'][_0x2d57('0xe')]===0x1f4){logger['error'](_0x2d57('0xa'),_0x4edc58,_0x533c62[_0x2d57('0xd')][_0x2d57('0xf')]);return _0x182e81(_0x533c62[_0x2d57('0xd')]['message']);}logger[_0x2d57('0xd')](_0x2d57('0xa'),_0x4edc58,_0x533c62['error']['message']);return _0x1a81e1(_0x533c62['error'][_0x2d57('0xf')]);}else{logger[_0x2d57('0x10')]('Pause,\x20%s,\x20%s',_0x4edc58,_0x2d57('0xb'));_0x1a81e1(_0x533c62[_0x2d57('0x11')][_0x2d57('0xf')]);}})['catch'](function(_0x1589a4){logger[_0x2d57('0xd')](_0x2d57('0xa'),_0x4edc58,_0x1589a4);_0x182e81(_0x1589a4);});});}exports[_0x2d57('0x12')]=function(_0x43af65){var _0x544acf=this;return new Promise(function(_0x11810e,_0x170529){return db['Pause'][_0x2d57('0x13')]({'raw':_0x43af65[_0x2d57('0x14')]?_0x43af65[_0x2d57('0x14')][_0x2d57('0x15')]===undefined?!![]:![]:!![],'where':_0x43af65[_0x2d57('0x14')]?_0x43af65[_0x2d57('0x14')][_0x2d57('0x16')]||null:null,'attributes':_0x43af65['options']?_0x43af65[_0x2d57('0x14')]['attributes']||null:null,'include':_0x43af65[_0x2d57('0x14')]?_0x43af65[_0x2d57('0x14')][_0x2d57('0x17')]?_[_0x2d57('0x18')](_0x43af65['options'][_0x2d57('0x17')],function(_0x1af48c){return{'model':db[_0x1af48c[_0x2d57('0x19')]],'as':_0x1af48c['as'],'attributes':_0x1af48c['attributes'],'include':_0x1af48c[_0x2d57('0x17')]?_['map'](_0x1af48c[_0x2d57('0x17')],function(_0x298c4f){return{'model':db[_0x298c4f[_0x2d57('0x19')]],'as':_0x298c4f['as'],'attributes':_0x298c4f[_0x2d57('0x1a')],'include':_0x298c4f['include']?_[_0x2d57('0x18')](_0x298c4f[_0x2d57('0x17')],function(_0xa84576){return{'model':db[_0xa84576[_0x2d57('0x19')]],'as':_0xa84576['as'],'attributes':_0xa84576[_0x2d57('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21eaad){logger[_0x2d57('0x10')](_0x2d57('0x12'),_0x43af65);logger['debug']('ShowPause',_0x43af65,JSON['stringify'](_0x21eaad));_0x11810e(_0x21eaad);})[_0x2d57('0x1b')](function(_0x1a389b){logger[_0x2d57('0xd')]('ShowPause',_0x1a389b[_0x2d57('0xf')],_0x43af65);_0x170529(_0x544acf[_0x2d57('0xd')](0x1f4,_0x1a389b[_0x2d57('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 612e048..989645c 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 _0x717e=['get','isAuthenticated','index','/webhook','webhookGet','/:id','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x717e,0xb4));var _0xe717=function(_0x1614aa,_0x15f8c6){_0x1614aa=_0x1614aa-0x0;var _0x11e4bf=_0x717e[_0x1614aa];return _0x11e4bf;};'use strict';var multer=require(_0xe717('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe717('0x1'));var express=require(_0xe717('0x2'));var router=express[_0xe717('0x3')]();var auth=require(_0xe717('0x4'));var interaction=require(_0xe717('0x5'));var config=require('../../config/environment');var controller=require('./plugin.controller');router[_0xe717('0x6')]('/',auth[_0xe717('0x7')](),controller[_0xe717('0x8')]);router[_0xe717('0x6')](_0xe717('0x9'),controller[_0xe717('0xa')]);router[_0xe717('0x6')](_0xe717('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe717('0x6')]('/:id/download',auth[_0xe717('0x7')](),controller[_0xe717('0xc')]);var upload=multer({'storage':multer[_0xe717('0xd')]({'destination':function(_0x40fb4c,_0x2e7cb7,_0x53d47d){_0x53d47d(null,path[_0xe717('0xe')](config[_0xe717('0xf')],_0xe717('0x10')));},'filename':function(_0x5d8ff9,_0x4c12bd,_0x2e1554){_0x4c12bd[_0xe717('0x11')]=_0x4c12bd[_0xe717('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2e1554(null,util[_0xe717('0x12')](_0xe717('0x13'),path[_0xe717('0x14')](_0x4c12bd[_0xe717('0x11')],path[_0xe717('0x15')](_0x4c12bd['originalname'])),Date[_0xe717('0x16')](),path[_0xe717('0x15')](_0x4c12bd[_0xe717('0x11')])));}})});router[_0xe717('0x17')]('/',upload[_0xe717('0x18')](_0xe717('0x19')),controller[_0xe717('0x1a')]);router[_0xe717('0x17')](_0xe717('0x9'),controller[_0xe717('0x1b')]);router['put'](_0xe717('0xb'),auth[_0xe717('0x7')](),controller[_0xe717('0x1c')]);router[_0xe717('0x1d')](_0xe717('0xb'),auth[_0xe717('0x7')](),controller[_0xe717('0x1d')]);module[_0xe717('0x1e')]=router; \ No newline at end of file +var _0x333b=['connect-timeout','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','show','/:id/download','download','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','/:id','delete','exports','multer','util','path'];(function(_0x5eb8e8,_0x116210){var _0x5974a5=function(_0x11b6dc){while(--_0x11b6dc){_0x5eb8e8['push'](_0x5eb8e8['shift']());}};_0x5974a5(++_0x116210);}(_0x333b,0x183));var _0xb333=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x333b[_0xbc4560];return _0x298cfb;};'use strict';var multer=require(_0xb333('0x0'));var util=require(_0xb333('0x1'));var path=require(_0xb333('0x2'));var timeout=require(_0xb333('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb333('0x4'));var controller=require(_0xb333('0x5'));router['get']('/',auth[_0xb333('0x6')](),controller['index']);router[_0xb333('0x7')](_0xb333('0x8'),controller[_0xb333('0x9')]);router[_0xb333('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb333('0xa')]);router[_0xb333('0x7')](_0xb333('0xb'),auth[_0xb333('0x6')](),controller[_0xb333('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xea978,_0x1fccc0,_0x10448b){_0x10448b(null,path[_0xb333('0xd')](config[_0xb333('0xe')],_0xb333('0xf')));},'filename':function(_0x2f6b2a,_0x24afe9,_0x3f2b38){_0x24afe9[_0xb333('0x10')]=_0x24afe9[_0xb333('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3f2b38(null,util[_0xb333('0x11')](_0xb333('0x12'),path[_0xb333('0x13')](_0x24afe9[_0xb333('0x10')],path[_0xb333('0x14')](_0x24afe9[_0xb333('0x10')])),Date[_0xb333('0x15')](),path[_0xb333('0x14')](_0x24afe9['originalname'])));}})});router[_0xb333('0x16')]('/',upload[_0xb333('0x17')](_0xb333('0x18')),controller[_0xb333('0x19')]);router['post']('/webhook',controller[_0xb333('0x1a')]);router['put'](_0xb333('0x1b'),auth['isAuthenticated'](),controller['update']);router[_0xb333('0x1c')](_0xb333('0x1b'),auth['isAuthenticated'](),controller[_0xb333('0x1c')]);module[_0xb333('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index aa6d6c5..4d0c970 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 _0x3d48=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x13a582,_0x32b71c){var _0x5ccf14=function(_0x12892f){while(--_0x12892f){_0x13a582['push'](_0x13a582['shift']());}};_0x5ccf14(++_0x32b71c);}(_0x3d48,0x1db));var _0x83d4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3d48[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x83d4('0x0'));module['exports']={'name':{'type':Sequelize[_0x83d4('0x1')]},'type':{'type':Sequelize[_0x83d4('0x2')]('html',_0x83d4('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x83d4('0x1')],'comment':_0x83d4('0x4')},'active':{'type':Sequelize[_0x83d4('0x5')],'defaultValue':0x0,'comment':_0x83d4('0x6')},'sidebar':{'type':Sequelize[_0x83d4('0x2')](_0x83d4('0x7'),'agentOnly',_0x83d4('0x8'),'never'),'defaultValue':_0x83d4('0x8'),'comment':_0x83d4('0x9')},'icon':{'type':Sequelize[_0x83d4('0x1')]},'adminUrl':{'type':Sequelize[_0x83d4('0x1')]},'agentUrl':{'type':Sequelize[_0x83d4('0x1')]},'scriptName':{'type':Sequelize[_0x83d4('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f03=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0xd22cdd,_0x57a865){var _0x3a6f7d=function(_0xe51a2d){while(--_0xe51a2d){_0xd22cdd['push'](_0xd22cdd['shift']());}};_0x3a6f7d(++_0x57a865);}(_0x3f03,0xf0));var _0x33f0=function(_0x516069,_0x15e610){_0x516069=_0x516069-0x0;var _0xda0967=_0x3f03[_0x516069];return _0xda0967;};'use strict';var Sequelize=require(_0x33f0('0x0'));module[_0x33f0('0x1')]={'name':{'type':Sequelize[_0x33f0('0x2')]},'type':{'type':Sequelize[_0x33f0('0x3')]('html',_0x33f0('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x33f0('0x5')]},'path':{'type':Sequelize[_0x33f0('0x2')],'comment':_0x33f0('0x6')},'active':{'type':Sequelize[_0x33f0('0x7')],'defaultValue':0x0,'comment':_0x33f0('0x8')},'sidebar':{'type':Sequelize[_0x33f0('0x3')](_0x33f0('0x9'),_0x33f0('0xa'),_0x33f0('0xb'),_0x33f0('0xc')),'defaultValue':_0x33f0('0xb'),'comment':_0x33f0('0xd')},'icon':{'type':Sequelize[_0x33f0('0x2')]},'adminUrl':{'type':Sequelize[_0x33f0('0x2')]},'agentUrl':{'type':Sequelize[_0x33f0('0x2')]},'scriptName':{'type':Sequelize[_0x33f0('0x2')]},'scriptPath':{'type':Sequelize[_0x33f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a2ad6a1..ff10e20 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 _0x3ec3=['merge','VIRTUAL','options','include','findAll','show','params','includeAll','catch','find','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','resolve','http://localhost:','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','./plugin.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','UserProfileResource','error','stack','name','Plugin','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where'];(function(_0x1aa310,_0x3f9e1c){var _0x422070=function(_0x14cf29){while(--_0x14cf29){_0x1aa310['push'](_0x1aa310['shift']());}};_0x422070(++_0x3f9e1c);}(_0x3ec3,0x1c1));var _0x33ec=function(_0x366ce0,_0x4c3fad){_0x366ce0=_0x366ce0-0x0;var _0x5ae1c0=_0x3ec3[_0x366ce0];return _0x5ae1c0;};'use strict';var pdf=require(_0x33ec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x33ec('0x1'));var zipdir=require(_0x33ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33ec('0x3'));var moment=require('moment');var BPromise=require(_0x33ec('0x4'));var Mustache=require(_0x33ec('0x5'));var util=require(_0x33ec('0x6'));var path=require(_0x33ec('0x7'));var sox=require(_0x33ec('0x8'));var csv=require(_0x33ec('0x9'));var ejs=require(_0x33ec('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x33ec('0xb'));var crypto=require(_0x33ec('0xc'));var jsforce=require(_0x33ec('0xd'));var deskjs=require(_0x33ec('0xe'));var toCsv=require(_0x33ec('0x9'));var querystring=require(_0x33ec('0xf'));var Papa=require(_0x33ec('0x10'));var extract=require('extract-zip');var rimraf=require(_0x33ec('0x1'));var archiver=require(_0x33ec('0x11'));var Redis=require(_0x33ec('0x12'));var authService=require(_0x33ec('0x13'));var qs=require(_0x33ec('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x33ec('0x15'))('api');var utils=require(_0x33ec('0x16'));var config=require(_0x33ec('0x17'));var db=require('../../mysqldb')['db'];config[_0x33ec('0x18')]=_[_0x33ec('0x19')](config[_0x33ec('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x33ec('0x1a'))[_0x33ec('0x1b')](socket);function respondWithStatusCode(_0x28c0eb,_0x591e7c){_0x591e7c=_0x591e7c||0xcc;return function(_0x1530d0){if(_0x1530d0){return _0x28c0eb[_0x33ec('0x1c')](_0x591e7c);}return _0x28c0eb[_0x33ec('0x1d')](_0x591e7c)[_0x33ec('0x1e')]();};}function respondWithResult(_0x5a6309,_0x19f262){_0x19f262=_0x19f262||0xc8;return function(_0xb59dde){if(_0xb59dde){return _0x5a6309[_0x33ec('0x1d')](_0x19f262)[_0x33ec('0x1f')](_0xb59dde);}};}function respondWithFilteredResult(_0x5733ff,_0x17a0ba){return function(_0x238167){if(_0x238167){var _0x11d74b=_0x238167[_0x33ec('0x20')],_0x160eea=_0x17a0ba[_0x33ec('0x21')],_0x16ef04=_0x17a0ba[_0x33ec('0x21')]+_0x17a0ba['limit'],_0x56d0a4;if(_0x16ef04>=_0x11d74b){_0x16ef04=_0x11d74b;_0x56d0a4=0xc8;}else{_0x56d0a4=0xce;}_0x5733ff['status'](_0x56d0a4);return _0x5733ff[_0x33ec('0x22')](_0x33ec('0x23'),_0x160eea+'-'+_0x16ef04+'/'+_0x11d74b)[_0x33ec('0x1f')](_0x238167);}return null;};}function patchUpdates(_0x588be3){return function(_0x56fa48){try{jsonpatch['apply'](_0x56fa48,_0x588be3,!![]);}catch(_0x1808fe){return BPromise['reject'](_0x1808fe);}return _0x56fa48[_0x33ec('0x24')]();};}function saveUpdates(_0x1c83eb,_0x2ad256){return function(_0x228b5e){if(_0x228b5e){return _0x228b5e[_0x33ec('0x25')](_0x1c83eb)[_0x33ec('0x26')](function(_0xf5325e){return _0xf5325e;});}return null;};}function removeEntity(_0x3367a5,_0x3d8aac){return function(_0x24ee03){if(_0x24ee03){return _0x24ee03[_0x33ec('0x27')]()[_0x33ec('0x26')](function(){var _0x1b317a=_0x24ee03['get']({'plain':!![]});var _0x2df99a='Plugins';return db[_0x33ec('0x28')]['destroy']({'where':{'type':_0x2df99a,'resourceId':_0x1b317a['id']}})[_0x33ec('0x26')](function(){return _0x24ee03;});})[_0x33ec('0x26')](function(){_0x3367a5[_0x33ec('0x1d')](0xcc)[_0x33ec('0x1e')]();});}};}function handleEntityNotFound(_0x3d4760,_0x225ae5){return function(_0x182b63){if(!_0x182b63){_0x3d4760[_0x33ec('0x1c')](0x194);}return _0x182b63;};}function handleError(_0xeced41,_0x376827){_0x376827=_0x376827||0x1f4;return function(_0x49d79e){logger[_0x33ec('0x29')](_0x49d79e[_0x33ec('0x2a')]);if(_0x49d79e[_0x33ec('0x2b')]){delete _0x49d79e[_0x33ec('0x2b')];}_0xeced41[_0x33ec('0x1d')](_0x376827)['send'](_0x49d79e);};}exports['index']=function(_0x252bcf,_0x397232){var _0x36810d={},_0x32aa14={},_0x5c4e6d={'count':0x0,'rows':[]};var _0x488c3e=_['map'](db[_0x33ec('0x2c')]['rawAttributes'],function(_0x23e5f9){return{'name':_0x23e5f9[_0x33ec('0x2d')],'type':_0x23e5f9[_0x33ec('0x2e')][_0x33ec('0x2f')]};});_0x32aa14[_0x33ec('0x30')]=_[_0x33ec('0x31')](_0x488c3e,_0x33ec('0x2b'));_0x32aa14['query']=_[_0x33ec('0x32')](_0x252bcf[_0x33ec('0x33')]);_0x32aa14[_0x33ec('0x34')]=_[_0x33ec('0x35')](_0x32aa14[_0x33ec('0x30')],_0x32aa14[_0x33ec('0x33')]);_0x36810d[_0x33ec('0x36')]=_[_0x33ec('0x35')](_0x32aa14['model'],qs[_0x33ec('0x37')](_0x252bcf['query'][_0x33ec('0x37')]));_0x36810d[_0x33ec('0x36')]=_0x36810d[_0x33ec('0x36')][_0x33ec('0x38')]?_0x36810d[_0x33ec('0x36')]:_0x32aa14[_0x33ec('0x30')];if(!_0x252bcf['query'][_0x33ec('0x39')]('nolimit')){_0x36810d['limit']=qs[_0x33ec('0x3a')](_0x252bcf[_0x33ec('0x33')][_0x33ec('0x3a')]);_0x36810d['offset']=qs[_0x33ec('0x21')](_0x252bcf['query']['offset']);}_0x36810d[_0x33ec('0x3b')]=qs['sort'](_0x252bcf[_0x33ec('0x33')][_0x33ec('0x3c')]);_0x36810d['where']=qs[_0x33ec('0x34')](_[_0x33ec('0x3d')](_0x252bcf[_0x33ec('0x33')],_0x32aa14['filters']),_0x488c3e);if(_0x252bcf[_0x33ec('0x33')][_0x33ec('0x3e')]){_0x36810d[_0x33ec('0x3f')]=_[_0x33ec('0x40')](_0x36810d[_0x33ec('0x3f')],{'$or':_[_0x33ec('0x31')](_0x488c3e,function(_0x9477e7){if(_0x9477e7[_0x33ec('0x2e')]!==_0x33ec('0x41')){var _0x40528b={};_0x40528b[_0x9477e7[_0x33ec('0x2b')]]={'$like':'%'+_0x252bcf['query']['filter']+'%'};return _0x40528b;}})});}_0x36810d=_[_0x33ec('0x40')]({},_0x36810d,_0x252bcf[_0x33ec('0x42')]);var _0x50e539={'where':_0x36810d[_0x33ec('0x3f')]};return db[_0x33ec('0x2c')][_0x33ec('0x20')](_0x50e539)[_0x33ec('0x26')](function(_0xca35e9){_0x5c4e6d['count']=_0xca35e9;if(_0x252bcf[_0x33ec('0x33')]['includeAll']){_0x36810d[_0x33ec('0x43')]=[{'all':!![]}];}return db['Plugin'][_0x33ec('0x44')](_0x36810d);})[_0x33ec('0x26')](function(_0xf1bb54){_0x5c4e6d['rows']=_0xf1bb54;return _0x5c4e6d;})[_0x33ec('0x26')](respondWithFilteredResult(_0x397232,_0x36810d))['catch'](handleError(_0x397232,null));};exports[_0x33ec('0x45')]=function(_0x5db295,_0x36c1da){var _0x1e545e={'raw':!![],'where':{'id':_0x5db295[_0x33ec('0x46')]['id']}},_0x22c82d={};_0x22c82d[_0x33ec('0x30')]=_[_0x33ec('0x32')](db['Plugin']['rawAttributes']);_0x22c82d[_0x33ec('0x33')]=_[_0x33ec('0x32')](_0x5db295[_0x33ec('0x33')]);_0x22c82d['filters']=_['intersection'](_0x22c82d[_0x33ec('0x30')],_0x22c82d['query']);_0x1e545e['attributes']=_[_0x33ec('0x35')](_0x22c82d[_0x33ec('0x30')],qs['fields'](_0x5db295[_0x33ec('0x33')]['fields']));_0x1e545e[_0x33ec('0x36')]=_0x1e545e['attributes']['length']?_0x1e545e[_0x33ec('0x36')]:_0x22c82d['model'];if(_0x5db295[_0x33ec('0x33')][_0x33ec('0x47')]){_0x1e545e[_0x33ec('0x43')]=[{'all':!![]}];}_0x1e545e=_[_0x33ec('0x40')]({},_0x1e545e,_0x5db295[_0x33ec('0x42')]);return db[_0x33ec('0x2c')]['find'](_0x1e545e)[_0x33ec('0x26')](handleEntityNotFound(_0x36c1da,null))[_0x33ec('0x26')](respondWithResult(_0x36c1da,null))[_0x33ec('0x48')](handleError(_0x36c1da,null));};exports['download']=function(_0x3faec6,_0x45e8fd,_0x185a9b){return db['Plugin'][_0x33ec('0x49')]({'where':{'id':_0x3faec6[_0x33ec('0x46')]['id']},'attributes':[_0x33ec('0x2b'),_0x33ec('0x7')],'raw':!![]})[_0x33ec('0x26')](handleEntityNotFound(_0x45e8fd,null))[_0x33ec('0x26')](function(_0x275079){if(_0x275079){var _0x1427a4=path['join'](config['root'],_0x33ec('0x4a'),util[_0x33ec('0x4b')](_0x33ec('0x4c'),path[_0x33ec('0x4d')](_0x275079[_0x33ec('0x7')])));var _0x453973=fs['createWriteStream'](_0x1427a4);var _0x2642f7=archiver(_0x33ec('0x4e'),{'zlib':{'level':0x9}});_0x2642f7['on'](_0x33ec('0x4f'),function(_0x338e60){if(_0x338e60[_0x33ec('0x50')]===_0x33ec('0x51')){logger[_0x33ec('0x29')](_0x338e60);}else{throw new db[(_0x33ec('0x52'))][(_0x33ec('0x53'))](_0x33ec('0x54'));}});_0x2642f7['on']('error',function(_0x2a51c6){throw new db[(_0x33ec('0x52'))][(_0x33ec('0x53'))](_0x33ec('0x54'));});_0x2642f7[_0x33ec('0x55')](_0x453973);_0x2642f7[_0x33ec('0x56')]('**/*',{'cwd':path[_0x33ec('0x57')](config['root'],_0x33ec('0x4a'),path[_0x33ec('0x58')](_0x275079['path'])),'ignore':[path[_0x33ec('0x57')](path['basename'](_0x275079['path']),_0x33ec('0x59')),path[_0x33ec('0x57')](path[_0x33ec('0x4d')](_0x275079[_0x33ec('0x7')]),_0x33ec('0x5a'))],'nodir':!![]})[_0x33ec('0x5b')]();_0x453973['on'](_0x33ec('0x5c'),function(){if(!fs[_0x33ec('0x5d')](_0x1427a4)){throw new db['Sequelize']['Error'](_0x33ec('0x5e'));}return _0x45e8fd[_0x33ec('0x5f')](_0x1427a4,util[_0x33ec('0x4b')](_0x33ec('0x4c'),path['basename'](_0x275079['path'])),function(_0x176630){if(_0x176630){throw new db[(_0x33ec('0x52'))][(_0x33ec('0x53'))](_0x33ec('0x60'));}fs[_0x33ec('0x61')](_0x1427a4);logger['info'](_0x33ec('0x62'));logger[_0x33ec('0x63')](_0x33ec('0x64'));});});}return null;})[_0x33ec('0x48')](handleError(_0x45e8fd,null));};exports[_0x33ec('0x65')]=function(_0x32b484,_0x38b58e,_0x14bd9f){var _0xbec5a0=path['basename'](_0x32b484[_0x33ec('0x66')][_0x33ec('0x67')],path[_0x33ec('0x68')](_0x32b484[_0x33ec('0x66')][_0x33ec('0x67')]));var _0x33925b=path[_0x33ec('0x57')](config[_0x33ec('0x69')],_0x33ec('0x4a'),_0x32b484['file'][_0x33ec('0x67')]);var _0x4a1b31=path[_0x33ec('0x57')](config[_0x33ec('0x69')],_0x33ec('0x4a'),_0xbec5a0);logger[_0x33ec('0x63')](_0x33ec('0x6a'),_0x33925b);logger['info'](_0x33ec('0x6b'),_0x4a1b31);try{fs[_0x33ec('0x6c')](_0x33925b,parseInt(_0x33ec('0x6d'),0x8));extract(_0x33925b,{'dir':_0x4a1b31},function(_0x267605){if(_0x267605){logger[_0x33ec('0x29')](_0x267605);handleError(_0x267605,!![]);};var _0x414d84=fs[_0x33ec('0x6e')](_0x4a1b31);if(_0x414d84[_0x33ec('0x38')]>0x1){removeReferences(_0x33925b,_0x4a1b31);logger[_0x33ec('0x29')](_0x33ec('0x6f'));return _0x14bd9f(new Error(_0x33ec('0x6f')));}var _0x5df0b2=fs[_0x33ec('0x70')](path['join'](_0x4a1b31,_0x414d84[0x0]));if(_0x5df0b2['isFile']()){removeReferences(_0x33925b,_0x4a1b31);logger[_0x33ec('0x29')](_0x33ec('0x6f'));return _0x14bd9f(new Error('Invalid\x20plugin\x20structure'));}if(_0x5df0b2[_0x33ec('0x71')]()){var _0x263be5=fs['readdirSync'](path['join'](_0x4a1b31,_0x414d84[0x0]));if(_0x263be5[_0x33ec('0x38')]===0x0){removeReferences(_0x33925b,_0x4a1b31);logger[_0x33ec('0x29')](_0x33ec('0x6f'));return _0x14bd9f(new Error(_0x33ec('0x6f')));}var _0x5a9ce9=_0x263be5[_0x33ec('0x72')](function(_0x425b80){return _0x425b80==='manifest.json';});if(!_0x5a9ce9){return _0x14bd9f(new Error(_0x33ec('0x73')));}var _0x35b42d=fs[_0x33ec('0x74')](path[_0x33ec('0x57')](_0x4a1b31,_0x414d84[0x0],'manifest.json'));var _0x412de5=JSON['parse'](_0x35b42d);if(_0x33ec('0x75')==typeof _0x412de5[_0x33ec('0x2b')]){return _0x14bd9f(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x33ec('0x75')==typeof _0x412de5['type']){return _0x14bd9f(new Error(_0x33ec('0x76')));}if(_0x33ec('0x75')==typeof _0x412de5[_0x33ec('0x77')]){return _0x14bd9f(new Error(_0x33ec('0x78')));}if('undefined'==typeof _0x412de5[_0x33ec('0x79')]){return _0x14bd9f(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x412de5[_0x33ec('0x2e')]===_0x33ec('0x7a')){if(_0x33ec('0x75')==typeof _0x412de5[_0x33ec('0x79')][_0x33ec('0x7b')]){return _0x14bd9f(new Error(_0x33ec('0x7c')));}if('undefined'==typeof _0x412de5[_0x33ec('0x79')]['views'][_0x33ec('0x7d')]&&'undefined'==typeof _0x412de5[_0x33ec('0x79')]['views'][_0x33ec('0x7e')]){return _0x14bd9f(new Error(_0x33ec('0x7f')));}}else if(_0x412de5[_0x33ec('0x2e')]==='script'){if(_0x33ec('0x75')==typeof _0x412de5[_0x33ec('0x79')]['scriptName']){return _0x14bd9f(new Error(_0x33ec('0x80')));}if(_0x33ec('0x75')==typeof _0x412de5[_0x33ec('0x79')][_0x33ec('0x81')]){return _0x14bd9f(new Error(_0x33ec('0x82')));}}else{return _0x14bd9f(new Error(_0x33ec('0x83')));}var _0x35af45=_0x412de5[_0x33ec('0x2b')];var _0x22fc21=_0x412de5['description'];var _0x57d8c9=_0x412de5[_0x33ec('0x2e')];var _0x4eb718=_0x412de5[_0x33ec('0x84')]?_0x412de5['sidebar']:_0x33ec('0x85');var _0xdf329f=_0x412de5[_0x33ec('0x86')]?_0x412de5['icon']:_0x33ec('0x87');var _0x130bfa='';var _0xe8d56a='';var _0x2f849d='';var _0x25048c='';var _0x1af691=_0x412de5[_0x33ec('0x77')];if(_0x57d8c9==='html'){if(_0x33ec('0x75')!=typeof _0x412de5[_0x33ec('0x79')][_0x33ec('0x7b')][_0x33ec('0x7d')]){var _0x5d8d1e=_0x412de5[_0x33ec('0x79')][_0x33ec('0x7b')][_0x33ec('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x33ec('0x88')](_0x5d8d1e)){_0x130bfa=path[_0x33ec('0x57')](_0x33ec('0x89'),_0xbec5a0,_0x414d84[0x0],_0x5d8d1e);}else{_0x130bfa=_0x5d8d1e;}}else{logger[_0x33ec('0x63')](_0x33ec('0x8a'));}if('undefined'!=typeof _0x412de5[_0x33ec('0x79')][_0x33ec('0x7b')][_0x33ec('0x7e')]){var _0x5a1fbe=_0x412de5[_0x33ec('0x79')]['views'][_0x33ec('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x33ec('0x88')](_0x5a1fbe)){_0xe8d56a=path[_0x33ec('0x57')](_0x33ec('0x89'),_0xbec5a0,_0x414d84[0x0],_0x5a1fbe);}else{_0xe8d56a=_0x5a1fbe;}}else{logger['info'](_0x33ec('0x8b'));}}else if(_0x57d8c9===_0x33ec('0x8c')){_0x2f849d=_0x412de5[_0x33ec('0x79')][_0x33ec('0x8d')];_0x25048c=_0x412de5['parameters']['scriptPath'];if(_0x33ec('0x75')!=typeof _0x412de5[_0x33ec('0x79')][_0x33ec('0x7b')]){if('undefined'!=typeof _0x412de5['parameters']['views'][_0x33ec('0x7d')]){var _0x5d8d1e=_0x412de5[_0x33ec('0x79')]['views'][_0x33ec('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x33ec('0x88')](_0x5d8d1e)){_0x130bfa=path['join'](_0x33ec('0x89'),_0xbec5a0,_0x414d84[0x0],_0x5d8d1e);}else{_0x130bfa=_0x5d8d1e;}}if(_0x33ec('0x75')!=typeof _0x412de5['parameters'][_0x33ec('0x7b')]['agent']){var _0x5a1fbe=_0x412de5['parameters'][_0x33ec('0x7b')][_0x33ec('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x33ec('0x88')](_0x5a1fbe)){_0xe8d56a=path[_0x33ec('0x57')](_0x33ec('0x89'),_0xbec5a0,_0x414d84[0x0],_0x5a1fbe);}else{_0xe8d56a=_0x5a1fbe;}}}}var _0x1e65fc={'name':_0x35af45,'description':_0x22fc21,'path':path[_0x33ec('0x57')](_0xbec5a0,_0x414d84[0x0]),'type':_0x57d8c9,'sidebar':_0x4eb718,'icon':_0xdf329f,'adminUrl':_0x130bfa,'agentUrl':_0xe8d56a,'scriptName':_0x2f849d,'scriptPath':_0x25048c,'version':_0x1af691};removeReferences(_0x33925b,null);return db[_0x33ec('0x2c')][_0x33ec('0x8e')](_0x1e65fc)[_0x33ec('0x26')](function(_0x868197){var _0x5369e9={'role':_0x32b484['body']['role'],'userProfileId':_0x32b484[_0x33ec('0x8f')][_0x33ec('0x90')]};if(!_0x5369e9)throw new Error(_0x33ec('0x91'));if(_0x5369e9[_0x33ec('0x92')]===_0x33ec('0x93')){var _0x46ea71=_0x868197[_0x33ec('0x94')]({'plain':!![]});return db[_0x33ec('0x95')]['find']({'where':{'name':_0x33ec('0x96'),'userProfileId':_0x5369e9[_0x33ec('0x90')]},'raw':!![]})[_0x33ec('0x26')](function(_0xc499e6){if(_0xc499e6&&_0xc499e6[_0x33ec('0x97')]===0x0){return db[_0x33ec('0x28')][_0x33ec('0x8e')]({'name':_0x46ea71[_0x33ec('0x2b')],'resourceId':_0x46ea71['id'],'type':_0xc499e6[_0x33ec('0x2b')],'sectionId':_0xc499e6['id']},{})[_0x33ec('0x26')](function(){return _0x868197;});}else{return _0x868197;}})[_0x33ec('0x48')](function(_0xc785d7){logger['error'](_0x33ec('0x98'),_0xc785d7);throw _0xc785d7;});}return _0x868197;})[_0x33ec('0x26')](respondWithResult(_0x38b58e,null))[_0x33ec('0x48')](handleError(_0x38b58e,null));}});}catch(_0x35a545){_0x38b58e[_0x33ec('0x1d')](0x1f4)[_0x33ec('0x99')](_0x35a545);}};function removeReferences(_0x1f05fe,_0x4dc5c6){try{if(_0x1f05fe){fs[_0x33ec('0x61')](_0x1f05fe);logger[_0x33ec('0x63')]('Zip\x20archive\x20removed');}if(_0x4dc5c6){rimraf(_0x4dc5c6,function(){});logger[_0x33ec('0x63')](_0x33ec('0x9a'));}}catch(_0x3aeeff){logger[_0x33ec('0x29')](_0x3aeeff);}}exports[_0x33ec('0x25')]=function(_0x3f44a1,_0x45c4c1,_0x3c054c){return db[_0x33ec('0x2c')][_0x33ec('0x49')]({'where':{'id':_0x3f44a1[_0x33ec('0x46')]['id']}})['then'](handleEntityNotFound(_0x45c4c1,null))[_0x33ec('0x26')](saveUpdates(_0x3f44a1[_0x33ec('0x8f')],null))['then'](respondWithResult(_0x45c4c1,null))[_0x33ec('0x48')](handleError(_0x45c4c1,null));};exports[_0x33ec('0x9b')]=function(_0x3ca285,_0x596d7c,_0x4480b2){return db[_0x33ec('0x2c')]['find']({'where':{'id':_0x3ca285[_0x33ec('0x46')]['id']}})[_0x33ec('0x26')](function(_0x5b5efe){if(_0x5b5efe){return _0x5b5efe[_0x33ec('0x27')]();}})[_0x33ec('0x26')](function(_0x5d8b48){rimraf(path[_0x33ec('0x57')](config['root'],_0x33ec('0x4a'),path[_0x33ec('0x58')](_0x5d8b48['path'])),function(){});return _0x5d8b48;})[_0x33ec('0x26')](handleEntityNotFound(_0x596d7c,null))['then'](respondWithStatusCode(_0x596d7c,null))[_0x33ec('0x48')](handleError(_0x596d7c,null));};exports[_0x33ec('0x9c')]=function(_0x3aa7b1,_0x38ba09,_0x2c5fb1){return BPromise['resolve']()[_0x33ec('0x26')](function(){if(!_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0x7')]){throw new Error(_0x33ec('0x9d'));}if(!_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0x9e')]){throw new Error(_0x33ec('0x9f'));}var _0x1f963d=_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0xa0')]?_0x3aa7b1[_0x33ec('0x33')]['hostname']+':'+_0x3aa7b1['query'][_0x33ec('0x9e')]:'http://localhost:'+_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0x9e')];var _0x5f0bab=_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0x1f')]?_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0x1f')]:!![];var _0x348d71=_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0xa1')]?_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0xa1')]:null;var _0x2154a2={'method':_0x3aa7b1[_0x33ec('0xa2')],'uri':util['format'](_0x33ec('0xa3'),_0x1f963d,_0x3aa7b1[_0x33ec('0x33')]['path']),'json':_0x5f0bab,'resolveWithFullResponse':!![],'encoding':_0x348d71,'qs':_0x3aa7b1[_0x33ec('0x33')]};if(_0x3aa7b1['headers']){_0x2154a2[_0x33ec('0xa4')]=_0x3aa7b1[_0x33ec('0xa4')];if(_0x2154a2[_0x33ec('0xa4')][_0x33ec('0xa5')]){delete _0x2154a2[_0x33ec('0xa4')]['content-length'];}}if(_0x2154a2[_0x33ec('0xa4')][_0x33ec('0xa6')]){delete _0x2154a2['headers'][_0x33ec('0xa6')];}return rp(_0x2154a2);})[_0x33ec('0x26')](function(_0x2de903){if(_0x2de903){_0x38ba09['set'](_0x2de903[_0x33ec('0xa4')]);logger[_0x33ec('0x63')](_0x2de903['body']);if(_[_0x33ec('0xa7')](_0x3aa7b1[_0x33ec('0x33')][_0x33ec('0x7')],_0x33ec('0x5f'))&&_0x2de903['statusCode']==0x1f4){return _0x38ba09[_0x33ec('0x1c')](_0x2de903[_0x33ec('0xa8')]);}else{return _0x38ba09[_0x33ec('0x1d')](_0x2de903['statusCode'])[_0x33ec('0x99')](_0x2de903[_0x33ec('0x8f')]);}}else{return _0x38ba09[_0x33ec('0x1c')](0xc8);}})[_0x33ec('0x48')](handleError(_0x38ba09,null));};exports['webhookPost']=function(_0x4fc9cd,_0x3b6126,_0x2a0f59){return BPromise[_0x33ec('0xa9')]()[_0x33ec('0x26')](function(){if(!_0x4fc9cd[_0x33ec('0x33')][_0x33ec('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4fc9cd[_0x33ec('0x33')][_0x33ec('0x9e')]){throw new Error(_0x33ec('0x9f'));}var _0x53790e=_0x4fc9cd['query'][_0x33ec('0xa0')]?_0x4fc9cd[_0x33ec('0x33')][_0x33ec('0xa0')]+':'+_0x4fc9cd['query'][_0x33ec('0x9e')]:_0x33ec('0xaa')+_0x4fc9cd[_0x33ec('0x33')][_0x33ec('0x9e')];var _0x1c118c=_0x4fc9cd[_0x33ec('0x33')]['json']?_0x4fc9cd[_0x33ec('0x33')][_0x33ec('0x1f')]:!![];var _0x2a1678=_0x4fc9cd['query'][_0x33ec('0xa1')]?_0x4fc9cd[_0x33ec('0x33')]['encoding']:null;var _0x3bfc9e={'method':_0x4fc9cd[_0x33ec('0xa2')],'uri':util['format'](_0x33ec('0xa3'),_0x53790e,_0x4fc9cd[_0x33ec('0x33')][_0x33ec('0x7')]),'json':_0x1c118c,'resolveWithFullResponse':!![],'encoding':_0x2a1678,'body':_0x4fc9cd['body']};if(_0x4fc9cd[_0x33ec('0xa4')]){_0x3bfc9e['headers']=_0x4fc9cd['headers'];if(_0x3bfc9e[_0x33ec('0xa4')]['content-length']){delete _0x3bfc9e[_0x33ec('0xa4')][_0x33ec('0xa5')];}}if(_0x3bfc9e[_0x33ec('0xa4')][_0x33ec('0xa6')]){delete _0x3bfc9e['headers'][_0x33ec('0xa6')];}return rp(_0x3bfc9e);})['then'](function(_0x492bd0){if(_0x492bd0){_0x3b6126['set'](_0x492bd0[_0x33ec('0xa4')]);logger[_0x33ec('0x63')](_0x492bd0[_0x33ec('0x8f')]);return _0x3b6126[_0x33ec('0x1d')](_0x492bd0['statusCode'])[_0x33ec('0x99')](_0x492bd0['body']);}else{return _0x3b6126[_0x33ec('0x1c')](0xc8);}})[_0x33ec('0x48')](handleError(_0x3b6126,null));}; \ No newline at end of file +var _0xf15b=['filter','VIRTUAL','merge','Plugin','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','download','root','server/files/plugins','format','basename','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','agent','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','extract-zip','rimraf','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','destroy','get','Plugins','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','where','filters','pick'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xf15b,0x6a));var _0xbf15=function(_0x53b37c,_0x1e3dae){_0x53b37c=_0x53b37c-0x0;var _0x912a5=_0xf15b[_0x53b37c];return _0x912a5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf15('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf15('0x1'));var jsonpatch=require(_0xbf15('0x2'));var rp=require(_0xbf15('0x3'));var moment=require('moment');var BPromise=require(_0xbf15('0x4'));var Mustache=require(_0xbf15('0x5'));var util=require(_0xbf15('0x6'));var path=require(_0xbf15('0x7'));var sox=require(_0xbf15('0x8'));var csv=require('to-csv');var ejs=require(_0xbf15('0x9'));var fs=require('fs');var _=require(_0xbf15('0xa'));var squel=require(_0xbf15('0xb'));var crypto=require(_0xbf15('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbf15('0xd'));var toCsv=require(_0xbf15('0xe'));var querystring=require(_0xbf15('0xf'));var Papa=require(_0xbf15('0x10'));var extract=require(_0xbf15('0x11'));var rimraf=require(_0xbf15('0x12'));var archiver=require(_0xbf15('0x13'));var Redis=require('ioredis');var authService=require(_0xbf15('0x14'));var qs=require(_0xbf15('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf15('0x16'));var logger=require(_0xbf15('0x17'))(_0xbf15('0x18'));var utils=require(_0xbf15('0x19'));var config=require(_0xbf15('0x1a'));var db=require(_0xbf15('0x1b'))['db'];config[_0xbf15('0x1c')]=_[_0xbf15('0x1d')](config[_0xbf15('0x1c')],{'host':_0xbf15('0x1e'),'port':0x18eb});var socket=require(_0xbf15('0x1f'))(new Redis(config[_0xbf15('0x1c')]));require(_0xbf15('0x20'))[_0xbf15('0x21')](socket);function respondWithStatusCode(_0x3f0c4e,_0x19a54b){_0x19a54b=_0x19a54b||0xcc;return function(_0x40445b){if(_0x40445b){return _0x3f0c4e[_0xbf15('0x22')](_0x19a54b);}return _0x3f0c4e[_0xbf15('0x23')](_0x19a54b)[_0xbf15('0x24')]();};}function respondWithResult(_0x3f233f,_0x4ecc34){_0x4ecc34=_0x4ecc34||0xc8;return function(_0xd4510a){if(_0xd4510a){return _0x3f233f['status'](_0x4ecc34)[_0xbf15('0x25')](_0xd4510a);}};}function respondWithFilteredResult(_0x19df5c,_0x4e3103){return function(_0x125f17){if(_0x125f17){var _0x4505f0=_0x125f17['count'],_0x82f5f7=_0x4e3103['offset'],_0x449608=_0x4e3103[_0xbf15('0x26')]+_0x4e3103[_0xbf15('0x27')],_0x4093da;if(_0x449608>=_0x4505f0){_0x449608=_0x4505f0;_0x4093da=0xc8;}else{_0x4093da=0xce;}_0x19df5c[_0xbf15('0x23')](_0x4093da);return _0x19df5c[_0xbf15('0x28')](_0xbf15('0x29'),_0x82f5f7+'-'+_0x449608+'/'+_0x4505f0)[_0xbf15('0x25')](_0x125f17);}return null;};}function patchUpdates(_0x581ccb){return function(_0x35e2e1){try{jsonpatch[_0xbf15('0x2a')](_0x35e2e1,_0x581ccb,!![]);}catch(_0x3c510b){return BPromise['reject'](_0x3c510b);}return _0x35e2e1['save']();};}function saveUpdates(_0x3f3fe4,_0x1b9147){return function(_0x504eff){if(_0x504eff){return _0x504eff['update'](_0x3f3fe4)[_0xbf15('0x2b')](function(_0x4df54d){return _0x4df54d;});}return null;};}function removeEntity(_0x268c9e,_0x2bc8db){return function(_0x240be9){if(_0x240be9){return _0x240be9[_0xbf15('0x2c')]()[_0xbf15('0x2b')](function(){var _0xfbb498=_0x240be9[_0xbf15('0x2d')]({'plain':!![]});var _0x151e31=_0xbf15('0x2e');return db['UserProfileResource'][_0xbf15('0x2c')]({'where':{'type':_0x151e31,'resourceId':_0xfbb498['id']}})[_0xbf15('0x2b')](function(){return _0x240be9;});})[_0xbf15('0x2b')](function(){_0x268c9e['status'](0xcc)[_0xbf15('0x24')]();});}};}function handleEntityNotFound(_0x5ca988,_0x66bf7e){return function(_0x45abe6){if(!_0x45abe6){_0x5ca988[_0xbf15('0x22')](0x194);}return _0x45abe6;};}function handleError(_0xac8ce9,_0xfee53b){_0xfee53b=_0xfee53b||0x1f4;return function(_0x1f0508){logger[_0xbf15('0x2f')](_0x1f0508[_0xbf15('0x30')]);if(_0x1f0508[_0xbf15('0x31')]){delete _0x1f0508[_0xbf15('0x31')];}_0xac8ce9[_0xbf15('0x23')](_0xfee53b)[_0xbf15('0x32')](_0x1f0508);};}exports[_0xbf15('0x33')]=function(_0x2b5066,_0x1e2180){var _0xd52cc3={},_0x482392={},_0x5ed504={'count':0x0,'rows':[]};var _0x181a1e=_[_0xbf15('0x34')](db['Plugin'][_0xbf15('0x35')],function(_0xd7c177){return{'name':_0xd7c177['fieldName'],'type':_0xd7c177[_0xbf15('0x36')][_0xbf15('0x37')]};});_0x482392[_0xbf15('0x38')]=_['map'](_0x181a1e,_0xbf15('0x31'));_0x482392[_0xbf15('0x39')]=_['keys'](_0x2b5066[_0xbf15('0x39')]);_0x482392['filters']=_[_0xbf15('0x3a')](_0x482392[_0xbf15('0x38')],_0x482392[_0xbf15('0x39')]);_0xd52cc3[_0xbf15('0x3b')]=_[_0xbf15('0x3a')](_0x482392['model'],qs['fields'](_0x2b5066[_0xbf15('0x39')][_0xbf15('0x3c')]));_0xd52cc3[_0xbf15('0x3b')]=_0xd52cc3[_0xbf15('0x3b')]['length']?_0xd52cc3['attributes']:_0x482392['model'];if(!_0x2b5066[_0xbf15('0x39')][_0xbf15('0x3d')]('nolimit')){_0xd52cc3['limit']=qs[_0xbf15('0x27')](_0x2b5066[_0xbf15('0x39')][_0xbf15('0x27')]);_0xd52cc3[_0xbf15('0x26')]=qs[_0xbf15('0x26')](_0x2b5066['query'][_0xbf15('0x26')]);}_0xd52cc3['order']=qs['sort'](_0x2b5066[_0xbf15('0x39')]['sort']);_0xd52cc3[_0xbf15('0x3e')]=qs[_0xbf15('0x3f')](_[_0xbf15('0x40')](_0x2b5066[_0xbf15('0x39')],_0x482392[_0xbf15('0x3f')]),_0x181a1e);if(_0x2b5066[_0xbf15('0x39')][_0xbf15('0x41')]){_0xd52cc3[_0xbf15('0x3e')]=_['merge'](_0xd52cc3[_0xbf15('0x3e')],{'$or':_['map'](_0x181a1e,function(_0x6aaec7){if(_0x6aaec7['type']!==_0xbf15('0x42')){var _0x9544fc={};_0x9544fc[_0x6aaec7[_0xbf15('0x31')]]={'$like':'%'+_0x2b5066[_0xbf15('0x39')][_0xbf15('0x41')]+'%'};return _0x9544fc;}})});}_0xd52cc3=_[_0xbf15('0x43')]({},_0xd52cc3,_0x2b5066['options']);var _0x321a41={'where':_0xd52cc3[_0xbf15('0x3e')]};return db[_0xbf15('0x44')][_0xbf15('0x45')](_0x321a41)[_0xbf15('0x2b')](function(_0x9399ac){_0x5ed504['count']=_0x9399ac;if(_0x2b5066[_0xbf15('0x39')][_0xbf15('0x46')]){_0xd52cc3[_0xbf15('0x47')]=[{'all':!![]}];}return db[_0xbf15('0x44')][_0xbf15('0x48')](_0xd52cc3);})[_0xbf15('0x2b')](function(_0x1a6ca1){_0x5ed504[_0xbf15('0x49')]=_0x1a6ca1;return _0x5ed504;})[_0xbf15('0x2b')](respondWithFilteredResult(_0x1e2180,_0xd52cc3))[_0xbf15('0x4a')](handleError(_0x1e2180,null));};exports[_0xbf15('0x4b')]=function(_0xd02f38,_0x23b005){var _0x228670={'raw':!![],'where':{'id':_0xd02f38[_0xbf15('0x4c')]['id']}},_0x1320af={};_0x1320af[_0xbf15('0x38')]=_[_0xbf15('0x4d')](db['Plugin'][_0xbf15('0x35')]);_0x1320af[_0xbf15('0x39')]=_['keys'](_0xd02f38['query']);_0x1320af[_0xbf15('0x3f')]=_[_0xbf15('0x3a')](_0x1320af[_0xbf15('0x38')],_0x1320af[_0xbf15('0x39')]);_0x228670[_0xbf15('0x3b')]=_[_0xbf15('0x3a')](_0x1320af[_0xbf15('0x38')],qs['fields'](_0xd02f38[_0xbf15('0x39')][_0xbf15('0x3c')]));_0x228670[_0xbf15('0x3b')]=_0x228670[_0xbf15('0x3b')][_0xbf15('0x4e')]?_0x228670['attributes']:_0x1320af[_0xbf15('0x38')];if(_0xd02f38['query'][_0xbf15('0x46')]){_0x228670['include']=[{'all':!![]}];}_0x228670=_[_0xbf15('0x43')]({},_0x228670,_0xd02f38['options']);return db[_0xbf15('0x44')][_0xbf15('0x4f')](_0x228670)['then'](handleEntityNotFound(_0x23b005,null))[_0xbf15('0x2b')](respondWithResult(_0x23b005,null))[_0xbf15('0x4a')](handleError(_0x23b005,null));};exports[_0xbf15('0x50')]=function(_0x206085,_0x26bd01,_0x3a9b18){return db[_0xbf15('0x44')]['find']({'where':{'id':_0x206085['params']['id']},'attributes':[_0xbf15('0x31'),'path'],'raw':!![]})[_0xbf15('0x2b')](handleEntityNotFound(_0x26bd01,null))[_0xbf15('0x2b')](function(_0x516469){if(_0x516469){var _0x13e873=path['join'](config[_0xbf15('0x51')],_0xbf15('0x52'),util[_0xbf15('0x53')]('%s.zip',path[_0xbf15('0x54')](_0x516469[_0xbf15('0x7')])));var _0x14d3c8=fs[_0xbf15('0x55')](_0x13e873);var _0x4aba27=archiver('zip',{'zlib':{'level':0x9}});_0x4aba27['on'](_0xbf15('0x56'),function(_0x36e6c8){if(_0x36e6c8['code']===_0xbf15('0x57')){logger[_0xbf15('0x2f')](_0x36e6c8);}else{throw new db[(_0xbf15('0x58'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4aba27['on'](_0xbf15('0x2f'),function(_0xde9c82){throw new db['Sequelize'][(_0xbf15('0x59'))](_0xbf15('0x5a'));});_0x4aba27[_0xbf15('0x5b')](_0x14d3c8);_0x4aba27[_0xbf15('0x5c')](_0xbf15('0x5d'),{'cwd':path['join'](config[_0xbf15('0x51')],_0xbf15('0x52'),path['dirname'](_0x516469[_0xbf15('0x7')])),'ignore':[path[_0xbf15('0x5e')](path['basename'](_0x516469[_0xbf15('0x7')]),_0xbf15('0x5f')),path[_0xbf15('0x5e')](path[_0xbf15('0x54')](_0x516469[_0xbf15('0x7')]),_0xbf15('0x60'))],'nodir':!![]})[_0xbf15('0x61')]();_0x14d3c8['on'](_0xbf15('0x62'),function(){if(!fs[_0xbf15('0x63')](_0x13e873)){throw new db[(_0xbf15('0x58'))][(_0xbf15('0x59'))](_0xbf15('0x64'));}return _0x26bd01[_0xbf15('0x50')](_0x13e873,util[_0xbf15('0x53')](_0xbf15('0x65'),path[_0xbf15('0x54')](_0x516469[_0xbf15('0x7')])),function(_0x282302){if(_0x282302){throw new db[(_0xbf15('0x58'))]['Error'](_0xbf15('0x66'));}fs[_0xbf15('0x67')](_0x13e873);logger[_0xbf15('0x68')](_0xbf15('0x69'));logger[_0xbf15('0x68')](_0xbf15('0x6a'));});});}return null;})[_0xbf15('0x4a')](handleError(_0x26bd01,null));};exports[_0xbf15('0x6b')]=function(_0x3c81ae,_0x33ddd7,_0x38a01d){var _0x1c9023=path[_0xbf15('0x54')](_0x3c81ae[_0xbf15('0x6c')][_0xbf15('0x6d')],path['extname'](_0x3c81ae['file'][_0xbf15('0x6d')]));var _0x1c304e=path[_0xbf15('0x5e')](config[_0xbf15('0x51')],_0xbf15('0x52'),_0x3c81ae[_0xbf15('0x6c')]['filename']);var _0x2ee873=path[_0xbf15('0x5e')](config['root'],_0xbf15('0x52'),_0x1c9023);logger[_0xbf15('0x68')](_0xbf15('0x6e'),_0x1c304e);logger[_0xbf15('0x68')](_0xbf15('0x6f'),_0x2ee873);try{fs[_0xbf15('0x70')](_0x1c304e,parseInt(_0xbf15('0x71'),0x8));extract(_0x1c304e,{'dir':_0x2ee873},function(_0x136d4f){if(_0x136d4f){logger['error'](_0x136d4f);handleError(_0x136d4f,!![]);};var _0x5789b0=fs['readdirSync'](_0x2ee873);if(_0x5789b0[_0xbf15('0x4e')]>0x1){removeReferences(_0x1c304e,_0x2ee873);logger[_0xbf15('0x2f')]('Invalid\x20plugin\x20structure');return _0x38a01d(new Error(_0xbf15('0x72')));}var _0x2ed81f=fs[_0xbf15('0x73')](path['join'](_0x2ee873,_0x5789b0[0x0]));if(_0x2ed81f[_0xbf15('0x74')]()){removeReferences(_0x1c304e,_0x2ee873);logger['error'](_0xbf15('0x72'));return _0x38a01d(new Error(_0xbf15('0x72')));}if(_0x2ed81f[_0xbf15('0x75')]()){var _0x37c8da=fs[_0xbf15('0x76')](path[_0xbf15('0x5e')](_0x2ee873,_0x5789b0[0x0]));if(_0x37c8da[_0xbf15('0x4e')]===0x0){removeReferences(_0x1c304e,_0x2ee873);logger[_0xbf15('0x2f')](_0xbf15('0x72'));return _0x38a01d(new Error(_0xbf15('0x72')));}var _0x9c6955=_0x37c8da[_0xbf15('0x77')](function(_0x252175){return _0x252175===_0xbf15('0x78');});if(!_0x9c6955){return _0x38a01d(new Error(_0xbf15('0x79')));}var _0x4fe81f=fs['readFileSync'](path[_0xbf15('0x5e')](_0x2ee873,_0x5789b0[0x0],'manifest.json'));var _0x16f260=JSON[_0xbf15('0x7a')](_0x4fe81f);if(_0xbf15('0x7b')==typeof _0x16f260[_0xbf15('0x31')]){return _0x38a01d(new Error(_0xbf15('0x7c')));}if(_0xbf15('0x7b')==typeof _0x16f260[_0xbf15('0x36')]){return _0x38a01d(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xbf15('0x7b')==typeof _0x16f260[_0xbf15('0x7d')]){return _0x38a01d(new Error(_0xbf15('0x7e')));}if(_0xbf15('0x7b')==typeof _0x16f260[_0xbf15('0x7f')]){return _0x38a01d(new Error(_0xbf15('0x80')));}if(_0x16f260[_0xbf15('0x36')]===_0xbf15('0x81')){if(_0xbf15('0x7b')==typeof _0x16f260[_0xbf15('0x7f')][_0xbf15('0x82')]){return _0x38a01d(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x16f260['parameters'][_0xbf15('0x82')]['admin']&&_0xbf15('0x7b')==typeof _0x16f260[_0xbf15('0x7f')][_0xbf15('0x82')]['agent']){return _0x38a01d(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x16f260[_0xbf15('0x36')]===_0xbf15('0x83')){if(_0xbf15('0x7b')==typeof _0x16f260[_0xbf15('0x7f')][_0xbf15('0x84')]){return _0x38a01d(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xbf15('0x7b')==typeof _0x16f260[_0xbf15('0x7f')][_0xbf15('0x85')]){return _0x38a01d(new Error(_0xbf15('0x86')));}}else{return _0x38a01d(new Error(_0xbf15('0x87')));}var _0x39624f=_0x16f260[_0xbf15('0x31')];var _0x224d4c=_0x16f260['description'];var _0x527b6e=_0x16f260[_0xbf15('0x36')];var _0xd862d7=_0x16f260[_0xbf15('0x88')]?_0x16f260['sidebar']:'always';var _0x142450=_0x16f260['icon']?_0x16f260['icon']:_0xbf15('0x89');var _0x25e9ea='';var _0x5454bf='';var _0x13e4b5='';var _0x416169='';var _0x4cde49=_0x16f260[_0xbf15('0x7d')];if(_0x527b6e===_0xbf15('0x81')){if(_0xbf15('0x7b')!=typeof _0x16f260[_0xbf15('0x7f')][_0xbf15('0x82')]['admin']){var _0x560823=_0x16f260[_0xbf15('0x7f')]['views'][_0xbf15('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xbf15('0x8b')](_0x560823)){_0x25e9ea=path[_0xbf15('0x5e')]('plugins',_0x1c9023,_0x5789b0[0x0],_0x560823);}else{_0x25e9ea=_0x560823;}}else{logger[_0xbf15('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x16f260[_0xbf15('0x7f')]['views']['agent']){var _0x56a236=_0x16f260[_0xbf15('0x7f')][_0xbf15('0x82')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xbf15('0x8b')](_0x56a236)){_0x5454bf=path[_0xbf15('0x5e')](_0xbf15('0x8c'),_0x1c9023,_0x5789b0[0x0],_0x56a236);}else{_0x5454bf=_0x56a236;}}else{logger['info'](_0xbf15('0x8d'));}}else if(_0x527b6e===_0xbf15('0x83')){_0x13e4b5=_0x16f260[_0xbf15('0x7f')][_0xbf15('0x84')];_0x416169=_0x16f260[_0xbf15('0x7f')][_0xbf15('0x85')];if('undefined'!=typeof _0x16f260[_0xbf15('0x7f')][_0xbf15('0x82')]){if(_0xbf15('0x7b')!=typeof _0x16f260['parameters'][_0xbf15('0x82')][_0xbf15('0x8a')]){var _0x560823=_0x16f260[_0xbf15('0x7f')][_0xbf15('0x82')][_0xbf15('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xbf15('0x8b')](_0x560823)){_0x25e9ea=path['join']('plugins',_0x1c9023,_0x5789b0[0x0],_0x560823);}else{_0x25e9ea=_0x560823;}}if(_0xbf15('0x7b')!=typeof _0x16f260[_0xbf15('0x7f')]['views'][_0xbf15('0x8e')]){var _0x56a236=_0x16f260['parameters'][_0xbf15('0x82')][_0xbf15('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xbf15('0x8b')](_0x56a236)){_0x5454bf=path[_0xbf15('0x5e')]('plugins',_0x1c9023,_0x5789b0[0x0],_0x56a236);}else{_0x5454bf=_0x56a236;}}}}var _0x1c0350={'name':_0x39624f,'description':_0x224d4c,'path':path[_0xbf15('0x5e')](_0x1c9023,_0x5789b0[0x0]),'type':_0x527b6e,'sidebar':_0xd862d7,'icon':_0x142450,'adminUrl':_0x25e9ea,'agentUrl':_0x5454bf,'scriptName':_0x13e4b5,'scriptPath':_0x416169,'version':_0x4cde49};removeReferences(_0x1c304e,null);return db[_0xbf15('0x44')][_0xbf15('0x8f')](_0x1c0350)[_0xbf15('0x2b')](function(_0x34cb05){var _0x104c29={'role':_0x3c81ae[_0xbf15('0x90')][_0xbf15('0x91')],'userProfileId':_0x3c81ae[_0xbf15('0x90')][_0xbf15('0x92')]};if(!_0x104c29)throw new Error(_0xbf15('0x93'));if(_0x104c29[_0xbf15('0x91')]===_0xbf15('0x94')){var _0x3ae5e6=_0x34cb05['get']({'plain':!![]});return db[_0xbf15('0x95')][_0xbf15('0x4f')]({'where':{'name':_0xbf15('0x2e'),'userProfileId':_0x104c29[_0xbf15('0x92')]},'raw':!![]})[_0xbf15('0x2b')](function(_0x1b003e){if(_0x1b003e&&_0x1b003e[_0xbf15('0x96')]===0x0){return db['UserProfileResource'][_0xbf15('0x8f')]({'name':_0x3ae5e6[_0xbf15('0x31')],'resourceId':_0x3ae5e6['id'],'type':_0x1b003e[_0xbf15('0x31')],'sectionId':_0x1b003e['id']},{})['then'](function(){return _0x34cb05;});}else{return _0x34cb05;}})[_0xbf15('0x4a')](function(_0x4cc6f5){logger[_0xbf15('0x2f')](_0xbf15('0x97'),_0x4cc6f5);throw _0x4cc6f5;});}return _0x34cb05;})[_0xbf15('0x2b')](respondWithResult(_0x33ddd7,null))['catch'](handleError(_0x33ddd7,null));}});}catch(_0x1d55a7){_0x33ddd7[_0xbf15('0x23')](0x1f4)[_0xbf15('0x32')](_0x1d55a7);}};function removeReferences(_0x371ae9,_0x4584ec){try{if(_0x371ae9){fs[_0xbf15('0x67')](_0x371ae9);logger[_0xbf15('0x68')](_0xbf15('0x98'));}if(_0x4584ec){rimraf(_0x4584ec,function(){});logger['info'](_0xbf15('0x99'));}}catch(_0x2d49b6){logger[_0xbf15('0x2f')](_0x2d49b6);}}exports['update']=function(_0xca8eb2,_0x34778d,_0x38c482){return db[_0xbf15('0x44')]['find']({'where':{'id':_0xca8eb2[_0xbf15('0x4c')]['id']}})[_0xbf15('0x2b')](handleEntityNotFound(_0x34778d,null))[_0xbf15('0x2b')](saveUpdates(_0xca8eb2[_0xbf15('0x90')],null))[_0xbf15('0x2b')](respondWithResult(_0x34778d,null))[_0xbf15('0x4a')](handleError(_0x34778d,null));};exports[_0xbf15('0x9a')]=function(_0x1fff0f,_0x53321a,_0x5f452a){return db[_0xbf15('0x44')]['find']({'where':{'id':_0x1fff0f[_0xbf15('0x4c')]['id']}})[_0xbf15('0x2b')](function(_0x3e0bc9){if(_0x3e0bc9){return _0x3e0bc9[_0xbf15('0x2c')]();}})['then'](function(_0x385b32){rimraf(path['join'](config[_0xbf15('0x51')],'server/files/plugins',path[_0xbf15('0x9b')](_0x385b32['path'])),function(){});return _0x385b32;})[_0xbf15('0x2b')](handleEntityNotFound(_0x53321a,null))[_0xbf15('0x2b')](respondWithStatusCode(_0x53321a,null))['catch'](handleError(_0x53321a,null));};exports[_0xbf15('0x9c')]=function(_0x27e928,_0x5a0ef6,_0x32d07a){return BPromise['resolve']()[_0xbf15('0x2b')](function(){if(!_0x27e928[_0xbf15('0x39')][_0xbf15('0x7')]){throw new Error(_0xbf15('0x9d'));}if(!_0x27e928['query']['port']){throw new Error(_0xbf15('0x9e'));}var _0x468369=_0x27e928[_0xbf15('0x39')][_0xbf15('0x9f')]?_0x27e928[_0xbf15('0x39')][_0xbf15('0x9f')]+':'+_0x27e928['query']['port']:_0xbf15('0xa0')+_0x27e928[_0xbf15('0x39')][_0xbf15('0xa1')];var _0x456a43=_0x27e928[_0xbf15('0x39')][_0xbf15('0x25')]?_0x27e928[_0xbf15('0x39')][_0xbf15('0x25')]:!![];var _0x57646c=_0x27e928[_0xbf15('0x39')][_0xbf15('0xa2')]?_0x27e928[_0xbf15('0x39')][_0xbf15('0xa2')]:null;var _0xbf406d={'method':_0x27e928[_0xbf15('0xa3')],'uri':util[_0xbf15('0x53')]('%s%s',_0x468369,_0x27e928[_0xbf15('0x39')][_0xbf15('0x7')]),'json':_0x456a43,'resolveWithFullResponse':!![],'encoding':_0x57646c,'qs':_0x27e928[_0xbf15('0x39')]};if(_0x27e928[_0xbf15('0xa4')]){_0xbf406d[_0xbf15('0xa4')]=_0x27e928['headers'];if(_0xbf406d[_0xbf15('0xa4')][_0xbf15('0xa5')]){delete _0xbf406d[_0xbf15('0xa4')][_0xbf15('0xa5')];}}if(_0xbf406d['headers'][_0xbf15('0xa6')]){delete _0xbf406d[_0xbf15('0xa4')][_0xbf15('0xa6')];}return rp(_0xbf406d);})[_0xbf15('0x2b')](function(_0x549162){if(_0x549162){_0x5a0ef6[_0xbf15('0x28')](_0x549162['headers']);logger[_0xbf15('0x68')](_0x549162[_0xbf15('0x90')]);if(_[_0xbf15('0xa7')](_0x27e928[_0xbf15('0x39')][_0xbf15('0x7')],_0xbf15('0x50'))&&_0x549162['statusCode']==0x1f4){return _0x5a0ef6[_0xbf15('0x22')](_0x549162[_0xbf15('0xa8')]);}else{return _0x5a0ef6[_0xbf15('0x23')](_0x549162['statusCode'])[_0xbf15('0x32')](_0x549162[_0xbf15('0x90')]);}}else{return _0x5a0ef6[_0xbf15('0x22')](0xc8);}})[_0xbf15('0x4a')](handleError(_0x5a0ef6,null));};exports[_0xbf15('0xa9')]=function(_0x1d8f6b,_0xe3ec56,_0x4b4f2a){return BPromise[_0xbf15('0xaa')]()[_0xbf15('0x2b')](function(){if(!_0x1d8f6b[_0xbf15('0x39')][_0xbf15('0x7')]){throw new Error(_0xbf15('0x9d'));}if(!_0x1d8f6b[_0xbf15('0x39')][_0xbf15('0xa1')]){throw new Error(_0xbf15('0x9e'));}var _0x3920c7=_0x1d8f6b[_0xbf15('0x39')][_0xbf15('0x9f')]?_0x1d8f6b['query'][_0xbf15('0x9f')]+':'+_0x1d8f6b['query'][_0xbf15('0xa1')]:_0xbf15('0xa0')+_0x1d8f6b[_0xbf15('0x39')]['port'];var _0x441e7a=_0x1d8f6b['query']['json']?_0x1d8f6b[_0xbf15('0x39')]['json']:!![];var _0x156542=_0x1d8f6b[_0xbf15('0x39')][_0xbf15('0xa2')]?_0x1d8f6b[_0xbf15('0x39')]['encoding']:null;var _0x20fbe3={'method':_0x1d8f6b[_0xbf15('0xa3')],'uri':util[_0xbf15('0x53')]('%s%s',_0x3920c7,_0x1d8f6b[_0xbf15('0x39')]['path']),'json':_0x441e7a,'resolveWithFullResponse':!![],'encoding':_0x156542,'body':_0x1d8f6b['body']};if(_0x1d8f6b['headers']){_0x20fbe3['headers']=_0x1d8f6b[_0xbf15('0xa4')];if(_0x20fbe3[_0xbf15('0xa4')][_0xbf15('0xa5')]){delete _0x20fbe3['headers'][_0xbf15('0xa5')];}}if(_0x20fbe3[_0xbf15('0xa4')][_0xbf15('0xa6')]){delete _0x20fbe3[_0xbf15('0xa4')][_0xbf15('0xa6')];}return rp(_0x20fbe3);})[_0xbf15('0x2b')](function(_0x2a289a){if(_0x2a289a){_0xe3ec56[_0xbf15('0x28')](_0x2a289a[_0xbf15('0xa4')]);logger[_0xbf15('0x68')](_0x2a289a['body']);return _0xe3ec56['status'](_0x2a289a[_0xbf15('0xa8')])[_0xbf15('0x32')](_0x2a289a[_0xbf15('0x90')]);}else{return _0xe3ec56['sendStatus'](0xc8);}})['catch'](handleError(_0xe3ec56,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b6c49ac..c71f8d3 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 _0xaebd=['emit','hook','exports','events','Plugin','setMaxListeners','save','update','remove'];(function(_0x25f823,_0x4037f9){var _0x24c5fa=function(_0x388f9a){while(--_0x388f9a){_0x25f823['push'](_0x25f823['shift']());}};_0x24c5fa(++_0x4037f9);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x508498,_0x91964d){_0x508498=_0x508498-0x0;var _0x2ebaff=_0xaebd[_0x508498];return _0x2ebaff;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var Plugin=require('../../mysqldb')['db'][_0xdaeb('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xdaeb('0x2')](0x0);var events={'afterCreate':_0xdaeb('0x3'),'afterUpdate':_0xdaeb('0x4'),'afterDestroy':_0xdaeb('0x5')};function emitEvent(_0x4acd42){return function(_0x44e982,_0x1c617a,_0x1a99be){PluginEvents[_0xdaeb('0x6')](_0x4acd42+':'+_0x44e982['id'],_0x44e982);PluginEvents[_0xdaeb('0x6')](_0x4acd42,_0x44e982);_0x1a99be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xdaeb('0x7')](e,emitEvent(event));}}module[_0xdaeb('0x8')]=PluginEvents; \ No newline at end of file +var _0xdb28=['Plugin','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3beeea,_0x3f6d7a){var _0x47f053=function(_0x4e824e){while(--_0x4e824e){_0x3beeea['push'](_0x3beeea['shift']());}};_0x47f053(++_0x3f6d7a);}(_0xdb28,0x106));var _0x8db2=function(_0x376e4a,_0x47f626){_0x376e4a=_0x376e4a-0x0;var _0x3f90f0=_0xdb28[_0x376e4a];return _0x3f90f0;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Plugin=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){PluginEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);PluginEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 11ea7cb..032158a 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 _0xf00a=['request-promise','path','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x23b1d6,_0x2e344b){var _0x4d7840=function(_0x25bfda){while(--_0x25bfda){_0x23b1d6['push'](_0x23b1d6['shift']());}};_0x4d7840(++_0x2e344b);}(_0xf00a,0x1b4));var _0xaf00=function(_0x152a03,_0x41a4fe){_0x152a03=_0x152a03-0x0;var _0x3ccbd0=_0xf00a[_0x152a03];return _0x3ccbd0;};'use strict';var _=require(_0xaf00('0x0'));var util=require(_0xaf00('0x1'));var logger=require(_0xaf00('0x2'))(_0xaf00('0x3'));var moment=require(_0xaf00('0x4'));var BPromise=require(_0xaf00('0x5'));var rp=require(_0xaf00('0x6'));var fs=require('fs');var path=require(_0xaf00('0x7'));var rimraf=require('rimraf');var config=require(_0xaf00('0x8'));var attributes=require('./plugin.attributes');module[_0xaf00('0x9')]=function(_0x3c6998,_0x5382be){return _0x3c6998[_0xaf00('0xa')](_0xaf00('0xb'),attributes,{'tableName':_0xaf00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffe8=['define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./plugin.attributes','exports'];(function(_0x41f6d4,_0x255693){var _0x42a2a9=function(_0x1d0a8){while(--_0x1d0a8){_0x41f6d4['push'](_0x41f6d4['shift']());}};_0x42a2a9(++_0x255693);}(_0xffe8,0x1b3));var _0x8ffe=function(_0x4492a8,_0x37056){_0x4492a8=_0x4492a8-0x0;var _0x103d12=_0xffe8[_0x4492a8];return _0x103d12;};'use strict';var _=require(_0x8ffe('0x0'));var util=require('util');var logger=require(_0x8ffe('0x1'))(_0x8ffe('0x2'));var moment=require(_0x8ffe('0x3'));var BPromise=require(_0x8ffe('0x4'));var rp=require(_0x8ffe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ffe('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ffe('0x7'));module[_0x8ffe('0x8')]=function(_0xd32eec,_0x3bd356){return _0xd32eec[_0x8ffe('0x9')](_0x8ffe('0xa'),attributes,{'tableName':_0x8ffe('0xb'),'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 2b60d79..c5cf75c 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 _0xdfc2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xd8933c,_0x230b52){var _0x12f28f=function(_0x4d10fa){while(--_0x4d10fa){_0xd8933c['push'](_0xd8933c['shift']());}};_0x12f28f(++_0x230b52);}(_0xdfc2,0xc6));var _0x2dfc=function(_0x916b01,_0x21405e){_0x916b01=_0x916b01-0x0;var _0x36cf44=_0xdfc2[_0x916b01];return _0x36cf44;};'use strict';var _=require(_0x2dfc('0x0'));var util=require(_0x2dfc('0x1'));var moment=require(_0x2dfc('0x2'));var BPromise=require(_0x2dfc('0x3'));var rs=require(_0x2dfc('0x4'));var fs=require('fs');var Redis=require(_0x2dfc('0x5'));var db=require(_0x2dfc('0x6'))['db'];var utils=require(_0x2dfc('0x7'));var logger=require(_0x2dfc('0x8'))(_0x2dfc('0x9'));var config=require(_0x2dfc('0xa'));var jayson=require(_0x2dfc('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x2dfc('0xc')](config[_0x2dfc('0xd')],{'host':_0x2dfc('0xe'),'port':0x18eb});var socket=require(_0x2dfc('0xf'))(new Redis(config[_0x2dfc('0xd')]));require(_0x2dfc('0x10'))[_0x2dfc('0x11')](socket);function respondWithRpcPromise(_0x4c7a32,_0x532771,_0x20c90a){return new BPromise(function(_0x2f5264,_0x1307a8){return client[_0x2dfc('0x12')](_0x4c7a32,_0x20c90a)[_0x2dfc('0x13')](function(_0x142ccb){logger[_0x2dfc('0x14')](_0x2dfc('0x15'),_0x532771,_0x2dfc('0x16'));logger['debug'](_0x2dfc('0x17'),_0x532771,'request\x20sent',JSON[_0x2dfc('0x18')](_0x142ccb));if(_0x142ccb[_0x2dfc('0x19')]){if(_0x142ccb['error']['code']===0x1f4){logger[_0x2dfc('0x19')]('Plugin,\x20%s,\x20%s',_0x532771,_0x142ccb[_0x2dfc('0x19')][_0x2dfc('0x1a')]);return _0x1307a8(_0x142ccb['error'][_0x2dfc('0x1a')]);}logger['error'](_0x2dfc('0x15'),_0x532771,_0x142ccb[_0x2dfc('0x19')][_0x2dfc('0x1a')]);return _0x2f5264(_0x142ccb[_0x2dfc('0x19')][_0x2dfc('0x1a')]);}else{logger[_0x2dfc('0x14')](_0x2dfc('0x15'),_0x532771,_0x2dfc('0x16'));_0x2f5264(_0x142ccb[_0x2dfc('0x1b')]['message']);}})['catch'](function(_0x5e4312){logger['error'](_0x2dfc('0x15'),_0x532771,_0x5e4312);_0x1307a8(_0x5e4312);});});}exports[_0x2dfc('0x1c')]=function(_0x2333a3){var _0x350b9a=this;return new Promise(function(_0x4c9c12,_0x5a3f41){return db[_0x2dfc('0x1d')][_0x2dfc('0x1e')](_0x2333a3[_0x2dfc('0x1f')],{'raw':_0x2333a3[_0x2dfc('0x20')]?_0x2333a3['options'][_0x2dfc('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xf92b13){logger[_0x2dfc('0x14')](_0x2dfc('0x1c'),_0x2333a3);logger['debug'](_0x2dfc('0x1c'),_0x2333a3,JSON[_0x2dfc('0x18')](_0xf92b13));_0x4c9c12(_0xf92b13);})['catch'](function(_0x4d01c9){logger[_0x2dfc('0x19')](_0x2dfc('0x1c'),_0x4d01c9['message'],_0x2333a3);_0x5a3f41(_0x350b9a[_0x2dfc('0x19')](0x1f4,_0x4d01c9[_0x2dfc('0x1a')]));});});}; \ No newline at end of file +var _0xd212=['jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','Plugin','create','body','options','info','CreatePlugin','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0xd212,0x163));var _0x2d21=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0xd212[_0x3f993e];return _0x39c135;};'use strict';var _=require(_0x2d21('0x0'));var util=require(_0x2d21('0x1'));var moment=require(_0x2d21('0x2'));var BPromise=require(_0x2d21('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d21('0x4'))['db'];var utils=require(_0x2d21('0x5'));var logger=require(_0x2d21('0x6'))('rpc');var config=require(_0x2d21('0x7'));var jayson=require(_0x2d21('0x8'));var client=jayson[_0x2d21('0x9')][_0x2d21('0xa')]({'port':0x232a});config[_0x2d21('0xb')]=_[_0x2d21('0xc')](config['redis'],{'host':_0x2d21('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d21('0xb')]));require(_0x2d21('0xe'))[_0x2d21('0xf')](socket);function respondWithRpcPromise(_0x1ff909,_0x4ba2c0,_0x4976e){return new BPromise(function(_0x4c378f,_0x4cb605){return client[_0x2d21('0x10')](_0x1ff909,_0x4976e)[_0x2d21('0x11')](function(_0x5d2779){logger['info'](_0x2d21('0x12'),_0x4ba2c0,_0x2d21('0x13'));logger[_0x2d21('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x4ba2c0,'request\x20sent',JSON['stringify'](_0x5d2779));if(_0x5d2779[_0x2d21('0x15')]){if(_0x5d2779['error'][_0x2d21('0x16')]===0x1f4){logger[_0x2d21('0x15')]('Plugin,\x20%s,\x20%s',_0x4ba2c0,_0x5d2779['error'][_0x2d21('0x17')]);return _0x4cb605(_0x5d2779['error']['message']);}logger[_0x2d21('0x15')](_0x2d21('0x12'),_0x4ba2c0,_0x5d2779[_0x2d21('0x15')][_0x2d21('0x17')]);return _0x4c378f(_0x5d2779[_0x2d21('0x15')][_0x2d21('0x17')]);}else{logger['info'](_0x2d21('0x12'),_0x4ba2c0,'request\x20sent');_0x4c378f(_0x5d2779[_0x2d21('0x18')][_0x2d21('0x17')]);}})[_0x2d21('0x19')](function(_0x56a128){logger[_0x2d21('0x15')](_0x2d21('0x12'),_0x4ba2c0,_0x56a128);_0x4cb605(_0x56a128);});});}exports['CreatePlugin']=function(_0x231179){var _0xbf0ae3=this;return new Promise(function(_0x37bfaf,_0x5383e3){return db[_0x2d21('0x1a')][_0x2d21('0x1b')](_0x231179[_0x2d21('0x1c')],{'raw':_0x231179[_0x2d21('0x1d')]?_0x231179[_0x2d21('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x2d21('0x11')](function(_0x56b137){logger[_0x2d21('0x1e')](_0x2d21('0x1f'),_0x231179);logger[_0x2d21('0x14')](_0x2d21('0x1f'),_0x231179,JSON[_0x2d21('0x20')](_0x56b137));_0x37bfaf(_0x56b137);})[_0x2d21('0x19')](function(_0x4558f6){logger[_0x2d21('0x15')](_0x2d21('0x1f'),_0x4558f6[_0x2d21('0x17')],_0x231179);_0x5383e3(_0xbf0ae3[_0x2d21('0x15')](0x1f4,_0x4558f6[_0x2d21('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ad1a4fa..694248b 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 _0xa702=['register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x163d52,_0x48ce55){var _0x1743cf=function(_0xcbce34){while(--_0xcbce34){_0x163d52['push'](_0x163d52['shift']());}};_0x1743cf(++_0x48ce55);}(_0xa702,0x1ae));var _0x2a70=function(_0x3c6dcf,_0x316d16){_0x3c6dcf=_0x3c6dcf-0x0;var _0x463d57=_0xa702[_0x3c6dcf];return _0x463d57;};'use strict';var PluginEvents=require(_0x2a70('0x0'));var events=[_0x2a70('0x1'),_0x2a70('0x2'),_0x2a70('0x3')];function createListener(_0x3fd554,_0x53128e){return function(_0x40c062){_0x53128e['emit'](_0x3fd554,_0x40c062);};}function removeListener(_0x55c9b2,_0x3c1629){return function(){PluginEvents['removeListener'](_0x55c9b2,_0x3c1629);};}exports[_0x2a70('0x4')]=function(_0x16cdc3){for(var _0x4b2915=0x0,_0x54e5a2=events[_0x2a70('0x5')];_0x4b2915<_0x54e5a2;_0x4b2915++){var _0x261c54=events[_0x4b2915];var _0x51e726=createListener(_0x2a70('0x6')+_0x261c54,_0x16cdc3);PluginEvents['on'](_0x261c54,_0x51e726);}}; \ No newline at end of file +var _0x9bca=['emit','removeListener','register','length','./plugin.events','save','remove','update'];(function(_0x4577ce,_0x58804e){var _0x1c93c2=function(_0xec35a5){while(--_0xec35a5){_0x4577ce['push'](_0x4577ce['shift']());}};_0x1c93c2(++_0x58804e);}(_0x9bca,0x8c));var _0xa9bc=function(_0x3747b3,_0x812602){_0x3747b3=_0x3747b3-0x0;var _0x128bfc=_0x9bca[_0x3747b3];return _0x128bfc;};'use strict';var PluginEvents=require(_0xa9bc('0x0'));var events=[_0xa9bc('0x1'),_0xa9bc('0x2'),_0xa9bc('0x3')];function createListener(_0x1fc145,_0x3e00f3){return function(_0x432c0a){_0x3e00f3[_0xa9bc('0x4')](_0x1fc145,_0x432c0a);};}function removeListener(_0x1c0a94,_0xe85207){return function(){PluginEvents[_0xa9bc('0x5')](_0x1c0a94,_0xe85207);};}exports[_0xa9bc('0x6')]=function(_0x3c846b){for(var _0x528c1d=0x0,_0x40bf7a=events[_0xa9bc('0x7')];_0x528c1d<_0x40bf7a;_0x528c1d++){var _0x4790ce=events[_0x528c1d];var _0x2e2eef=createListener('plugin:'+_0x4790ce,_0x3c846b);PluginEvents['on'](_0x4790ce,_0x2e2eef);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8878f3e..4c0e71d 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 _0xc54e=['create','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','isAuthenticated','index','/:id','show','post'];(function(_0x2a6d0e,_0x20fe82){var _0x21ef0a=function(_0x40596d){while(--_0x40596d){_0x2a6d0e['push'](_0x2a6d0e['shift']());}};_0x21ef0a(++_0x20fe82);}(_0xc54e,0x105));var _0xec54=function(_0x59bd64,_0x237f2b){_0x59bd64=_0x59bd64-0x0;var _0x378c0e=_0xc54e[_0x59bd64];return _0x378c0e;};'use strict';var express=require(_0xec54('0x0'));var router=express[_0xec54('0x1')]();var auth=require(_0xec54('0x2'));var controller=require(_0xec54('0x3'));router['get']('/',auth[_0xec54('0x4')](),controller[_0xec54('0x5')]);router['get'](_0xec54('0x6'),auth['isAuthenticated'](),controller[_0xec54('0x7')]);router[_0xec54('0x8')]('/',auth[_0xec54('0x4')](),controller[_0xec54('0x9')]);router[_0xec54('0xa')]('/:id',auth[_0xec54('0x4')](),controller[_0xec54('0xb')]);router[_0xec54('0xc')](_0xec54('0x6'),auth[_0xec54('0x4')](),controller[_0xec54('0xd')]);module[_0xec54('0xe')]=router; \ No newline at end of file +var _0x30e6=['update','delete','exports','express','../../components/auth/service','./pm2.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x32d74b,_0x251f81){var _0x507053=function(_0x399d9c){while(--_0x399d9c){_0x32d74b['push'](_0x32d74b['shift']());}};_0x507053(++_0x251f81);}(_0x30e6,0xed));var _0x630e=function(_0x4bf9f4,_0x3c6da1){_0x4bf9f4=_0x4bf9f4-0x0;var _0x1d93cc=_0x30e6[_0x4bf9f4];return _0x1d93cc;};'use strict';var express=require(_0x630e('0x0'));var router=express['Router']();var auth=require(_0x630e('0x1'));var controller=require(_0x630e('0x2'));router[_0x630e('0x3')]('/',auth['isAuthenticated'](),controller[_0x630e('0x4')]);router['get'](_0x630e('0x5'),auth[_0x630e('0x6')](),controller[_0x630e('0x7')]);router[_0x630e('0x8')]('/',auth[_0x630e('0x6')](),controller[_0x630e('0x9')]);router['put'](_0x630e('0x5'),auth[_0x630e('0x6')](),controller[_0x630e('0xa')]);router[_0x630e('0xb')](_0x630e('0x5'),auth[_0x630e('0x6')](),controller['destroy']);module[_0x630e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 9e75b55..a569f4f 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 _0xe916=['dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','info','index','then','reject','express','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','dirname','start'];(function(_0x4f89ff,_0x5e466b){var _0x42f34c=function(_0x2806d6){while(--_0x2806d6){_0x4f89ff['push'](_0x4f89ff['shift']());}};_0x42f34c(++_0x5e466b);}(_0xe916,0x84));var _0x6e91=function(_0x19944d,_0x2183a5){_0x19944d=_0x19944d-0x0;var _0x1c80b1=_0xe916[_0x19944d];return _0x1c80b1;};'use strict';var _=require(_0x6e91('0x0'));var pm2=require(_0x6e91('0x1'));var logger=require(_0x6e91('0x2'))(_0x6e91('0x3'));var path=require(_0x6e91('0x4'));var exec=require(_0x6e91('0x5'))[_0x6e91('0x6')];var BPromise=require(_0x6e91('0x7'));function handleEntityNotFound(_0x45cd3a,_0x3db2bc){return function(_0xca3a3a){if(!_0xca3a3a){_0x45cd3a[_0x6e91('0x8')](0x194);;}return _0xca3a3a;};}function respondWithResult(_0x8d0b9,_0xa0d7b1){_0xa0d7b1=_0xa0d7b1||0xc8;return function(_0x529afa){if(_0x529afa){return _0x8d0b9[_0x6e91('0x9')](_0xa0d7b1)[_0x6e91('0xa')](_0x529afa);}return null;};}function handleError(_0x2c21b8,_0x5a5cea){_0x5a5cea=_0x5a5cea||0x1f4;return function(_0x3f04ca){logger[_0x6e91('0xb')](_0x3f04ca[_0x6e91('0xc')]);if(_0x3f04ca[_0x6e91('0xd')]){delete _0x3f04ca[_0x6e91('0xd')];}_0x2c21b8['status'](_0x5a5cea)['send'](_0x3f04ca);};}function execChildProcess(){return new BPromise(function(_0x69c48d,_0x1bc345){exec('npm\x20install',function(_0x11be68,_0x5b63b3,_0x2edc77){logger[_0x6e91('0xe')](_0x5b63b3);logger[_0x6e91('0xe')](_0x2edc77);if(_0x11be68){logger['error'](_0x11be68);return _0x1bc345(_0x11be68);}return _0x69c48d(_0x5b63b3);});});}exports[_0x6e91('0xf')]=function(_0x4f428e,_0x4d437d){return pm2['list']()[_0x6e91('0x10')](function(_0xff22b4){if(_0xff22b4){var _0x25a610=_[_0x6e91('0x11')](_0xff22b4,function(_0x59140f){return _0x59140f[_0x6e91('0xd')]===_0x6e91('0x12')||_0x59140f[_0x6e91('0xd')]===_0x6e91('0x13');});return{'rows':_0x25a610,'count':_0x25a610['length']};}return null;})[_0x6e91('0x10')](respondWithResult(_0x4d437d,null))[_0x6e91('0x14')](handleError(_0x4d437d,null));};exports[_0x6e91('0x15')]=function(_0x51ecf9,_0x3bc27d){return pm2[_0x6e91('0x16')](_0x51ecf9[_0x6e91('0x17')]['id'])['then'](respondWithResult(_0x3bc27d,null))[_0x6e91('0x10')](handleEntityNotFound(_0x3bc27d,null))['catch'](handleError(_0x3bc27d,null));};exports[_0x6e91('0x18')]=function(_0xf3d0fc,_0x4f814f){if(_0xf3d0fc[_0x6e91('0x19')][_0x6e91('0xd')]&&_0xf3d0fc[_0x6e91('0x19')][_0x6e91('0x1a')]){var _0x120700=path[_0x6e91('0x1b')](__dirname,_0x6e91('0x1c'),_0xf3d0fc[_0x6e91('0x19')]['script']);var _0x45c463=process[_0x6e91('0x1d')]();process['chdir'](path[_0x6e91('0x1e')](_0x120700));return execChildProcess()[_0x6e91('0x10')](function(_0xb1e43b){process['chdir'](_0x45c463);return pm2[_0x6e91('0x1f')]({'name':_0xf3d0fc[_0x6e91('0x19')]['name'],'script':_0x120700});})[_0x6e91('0x10')](function(_0x95304e){pm2[_0x6e91('0x20')]();return _0x95304e[0x0];})['then'](respondWithResult(_0x4f814f,0xc9))[_0x6e91('0x14')](handleError(_0x4f814f,null));}else{return _0x4f814f['status'](0x1f4)[_0x6e91('0x21')]({'message':_0x6e91('0x22')});}};exports[_0x6e91('0x23')]=function(_0x50241f,_0x5caf1c){if(_0x50241f[_0x6e91('0x19')]['id']){delete _0x50241f[_0x6e91('0x19')]['id'];}var _0x59e3ba={'online':_0x6e91('0x24'),'stopped':_0x6e91('0x25')};if(_0x59e3ba[_0x6e91('0x26')](_0x50241f[_0x6e91('0x19')][_0x6e91('0x9')])){return pm2[_0x59e3ba[_0x50241f[_0x6e91('0x19')]['status']]](_0x50241f[_0x6e91('0x17')]['id'])[_0x6e91('0x10')](respondWithResult(_0x5caf1c,0xc8))[_0x6e91('0x14')](handleError(_0x5caf1c,null));}else{return _0x5caf1c[_0x6e91('0x9')](0x1f4)['send']({'message':_0x6e91('0x27')});}};exports['destroy']=function(_0x14b9e0,_0x5c36b6){if(_0x14b9e0[_0x6e91('0x19')]['id']){delete _0x14b9e0[_0x6e91('0x19')]['id'];}if(_0x14b9e0[_0x6e91('0x17')]['id']){return pm2[_0x6e91('0x28')](_0x14b9e0[_0x6e91('0x17')]['id'])[_0x6e91('0x10')](function(_0x59ca57){pm2[_0x6e91('0x20')]();return _0x59ca57[0x0];})['then'](respondWithResult(_0x5c36b6,null))[_0x6e91('0x14')](handleError(_0x5c36b6,null));}else{return _0x5c36b6[_0x6e91('0x9')](0x1f4)[_0x6e91('0x21')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x0694=['../../config/logger','api','path','child_process','exec','bluebird','json','send','npm\x20install','info','index','list','then','reject','name','express','motion2','catch','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','status','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x0694,0xc1));var _0x4069=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x0694[_0x59162a];return _0x35e50d;};'use strict';var _=require(_0x4069('0x0'));var pm2=require(_0x4069('0x1'));var logger=require(_0x4069('0x2'))(_0x4069('0x3'));var path=require(_0x4069('0x4'));var exec=require(_0x4069('0x5'))[_0x4069('0x6')];var BPromise=require(_0x4069('0x7'));function handleEntityNotFound(_0x41d331,_0x52a371){return function(_0x4fbd31){if(!_0x4fbd31){_0x41d331['sendStatus'](0x194);;}return _0x4fbd31;};}function respondWithResult(_0x46905f,_0x50fabc){_0x50fabc=_0x50fabc||0xc8;return function(_0x5308f6){if(_0x5308f6){return _0x46905f['status'](_0x50fabc)[_0x4069('0x8')](_0x5308f6);}return null;};}function handleError(_0x68e068,_0x16aa3f){_0x16aa3f=_0x16aa3f||0x1f4;return function(_0x36a6af){logger['error'](_0x36a6af['stack']);if(_0x36a6af['name']){delete _0x36a6af['name'];}_0x68e068['status'](_0x16aa3f)[_0x4069('0x9')](_0x36a6af);};}function execChildProcess(){return new BPromise(function(_0x2062af,_0xbaa2bc){exec(_0x4069('0xa'),function(_0x121235,_0x1d77b5,_0x2d98c5){logger[_0x4069('0xb')](_0x1d77b5);logger['info'](_0x2d98c5);if(_0x121235){logger['error'](_0x121235);return _0xbaa2bc(_0x121235);}return _0x2062af(_0x1d77b5);});});}exports[_0x4069('0xc')]=function(_0x2e2057,_0x586b74){return pm2[_0x4069('0xd')]()[_0x4069('0xe')](function(_0x5c6425){if(_0x5c6425){var _0x309429=_[_0x4069('0xf')](_0x5c6425,function(_0x1217fe){return _0x1217fe[_0x4069('0x10')]===_0x4069('0x11')||_0x1217fe[_0x4069('0x10')]===_0x4069('0x12');});return{'rows':_0x309429,'count':_0x309429['length']};}return null;})['then'](respondWithResult(_0x586b74,null))[_0x4069('0x13')](handleError(_0x586b74,null));};exports['show']=function(_0x1db859,_0x430d57){return pm2['describe'](_0x1db859[_0x4069('0x14')]['id'])[_0x4069('0xe')](respondWithResult(_0x430d57,null))[_0x4069('0xe')](handleEntityNotFound(_0x430d57,null))[_0x4069('0x13')](handleError(_0x430d57,null));};exports['create']=function(_0x4800e7,_0x41e8f6){if(_0x4800e7[_0x4069('0x15')][_0x4069('0x10')]&&_0x4800e7['body'][_0x4069('0x16')]){var _0x56bbf0=path[_0x4069('0x17')](__dirname,_0x4069('0x18'),_0x4800e7['body'][_0x4069('0x16')]);var _0x501e83=process[_0x4069('0x19')]();process[_0x4069('0x1a')](path[_0x4069('0x1b')](_0x56bbf0));return execChildProcess()['then'](function(_0x577930){process[_0x4069('0x1a')](_0x501e83);return pm2[_0x4069('0x1c')]({'name':_0x4800e7['body']['name'],'script':_0x56bbf0});})[_0x4069('0xe')](function(_0x22af75){pm2['dump']();return _0x22af75[0x0];})['then'](respondWithResult(_0x41e8f6,0xc9))[_0x4069('0x13')](handleError(_0x41e8f6,null));}else{return _0x41e8f6[_0x4069('0x1d')](0x1f4)[_0x4069('0x9')]({'message':_0x4069('0x1e')});}};exports['update']=function(_0x46b6b3,_0x5e2812){if(_0x46b6b3[_0x4069('0x15')]['id']){delete _0x46b6b3[_0x4069('0x15')]['id'];}var _0x4bfba2={'online':_0x4069('0x1f'),'stopped':_0x4069('0x20')};if(_0x4bfba2[_0x4069('0x21')](_0x46b6b3[_0x4069('0x15')][_0x4069('0x1d')])){return pm2[_0x4bfba2[_0x46b6b3['body'][_0x4069('0x1d')]]](_0x46b6b3['params']['id'])[_0x4069('0xe')](respondWithResult(_0x5e2812,0xc8))[_0x4069('0x13')](handleError(_0x5e2812,null));}else{return _0x5e2812['status'](0x1f4)[_0x4069('0x9')]({'message':_0x4069('0x22')});}};exports[_0x4069('0x23')]=function(_0x659c02,_0x7853a0){if(_0x659c02[_0x4069('0x15')]['id']){delete _0x659c02[_0x4069('0x15')]['id'];}if(_0x659c02[_0x4069('0x14')]['id']){return pm2[_0x4069('0x24')](_0x659c02[_0x4069('0x14')]['id'])['then'](function(_0x476d3b){pm2[_0x4069('0x25')]();return _0x476d3b[0x0];})[_0x4069('0xe')](respondWithResult(_0x7853a0,null))[_0x4069('0x13')](handleError(_0x7853a0,null));}else{return _0x7853a0[_0x4069('0x1d')](0x1f4)[_0x4069('0x9')]({'message':_0x4069('0x26')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ec38ad0..a9fede1 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 _0x1b2a=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x330baf,_0x5e8314){var _0x48a847=function(_0x31c79a){while(--_0x31c79a){_0x330baf['push'](_0x330baf['shift']());}};_0x48a847(++_0x5e8314);}(_0x1b2a,0x13c));var _0xa1b2=function(_0x38d897,_0x3d9432){_0x38d897=_0x38d897-0x0;var _0x3a51ab=_0x1b2a[_0x38d897];return _0x3a51ab;};'use strict';var multer=require(_0xa1b2('0x0'));var util=require('util');var path=require(_0xa1b2('0x1'));var timeout=require(_0xa1b2('0x2'));var express=require('express');var router=express[_0xa1b2('0x3')]();var auth=require(_0xa1b2('0x4'));var interaction=require(_0xa1b2('0x5'));var config=require('../../config/environment');module[_0xa1b2('0x6')]=router; \ No newline at end of file +var _0x233a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x12129d,_0x4b00d4){var _0x1c7d80=function(_0x503f6b){while(--_0x503f6b){_0x12129d['push'](_0x12129d['shift']());}};_0x1c7d80(++_0x4b00d4);}(_0x233a,0x16e));var _0xa233=function(_0x4066c7,_0x3f1e0a){_0x4066c7=_0x4066c7-0x0;var _0x1c1a4c=_0x233a[_0x4066c7];return _0x1c1a4c;};'use strict';var multer=require(_0xa233('0x0'));var util=require(_0xa233('0x1'));var path=require(_0xa233('0x2'));var timeout=require(_0xa233('0x3'));var express=require(_0xa233('0x4'));var router=express[_0xa233('0x5')]();var auth=require(_0xa233('0x6'));var interaction=require(_0xa233('0x7'));var config=require('../../config/environment');module[_0xa233('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 2208d69..822eec6 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 _0x91be=['INTEGER','DATE','STRING','sequelize'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x91be,0xf7));var _0xe91b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x91be[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe91b('0x0'));module['exports']={'state':{'type':Sequelize[_0xe91b('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe91b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe91b('0x2')]},'responsetime':{'type':Sequelize[_0xe91b('0x2')]},'ringtime':{'type':Sequelize[_0xe91b('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe91b('0x3')]},'membername':{'type':Sequelize[_0xe91b('0x3')]}}; \ No newline at end of file +var _0x8597=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x1d9efa,_0x134ad4){var _0x327876=function(_0x2d1e19){while(--_0x2d1e19){_0x1d9efa['push'](_0x1d9efa['shift']());}};_0x327876(++_0x134ad4);}(_0x8597,0x185));var _0x7859=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0x8597[_0x212fcc];return _0x4d8190;};'use strict';var Sequelize=require(_0x7859('0x0'));module[_0x7859('0x1')]={'state':{'type':Sequelize[_0x7859('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7859('0x3')]},'scheduledat':{'type':Sequelize[_0x7859('0x4')]},'uniqueid':{'type':Sequelize[_0x7859('0x3')]},'starttime':{'type':Sequelize[_0x7859('0x4')]},'responsetime':{'type':Sequelize[_0x7859('0x4')]},'ringtime':{'type':Sequelize[_0x7859('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7859('0x3')]},'campaigntype':{'type':Sequelize[_0x7859('0x3')]},'membername':{'type':Sequelize[_0x7859('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 058d2c2..265c06e 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 _0xbef2=['bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','util','../../config/logger','api','moment'];(function(_0x50791e,_0x55fe8b){var _0x2c9060=function(_0x28451f){while(--_0x28451f){_0x50791e['push'](_0x50791e['shift']());}};_0x2c9060(++_0x55fe8b);}(_0xbef2,0x146));var _0x2bef=function(_0x3a70ac,_0xce5582){_0x3a70ac=_0x3a70ac-0x0;var _0x489673=_0xbef2[_0x3a70ac];return _0x489673;};'use strict';var _=require('lodash');var util=require(_0x2bef('0x0'));var logger=require(_0x2bef('0x1'))(_0x2bef('0x2'));var moment=require(_0x2bef('0x3'));var BPromise=require(_0x2bef('0x4'));var rp=require(_0x2bef('0x5'));var fs=require('fs');var path=require(_0x2bef('0x6'));var rimraf=require(_0x2bef('0x7'));var config=require('../../config/environment');var attributes=require(_0x2bef('0x8'));module['exports']=function(_0x4fb206,_0xe3732a){return _0x4fb206[_0x2bef('0x9')](_0x2bef('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb185=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x128ef3,_0x38a577){var _0x5a5477=function(_0x3b9123){while(--_0x3b9123){_0x128ef3['push'](_0x128ef3['shift']());}};_0x5a5477(++_0x38a577);}(_0xb185,0x136));var _0x5b18=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb185[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x5b18('0x0'));var util=require(_0x5b18('0x1'));var logger=require(_0x5b18('0x2'))(_0x5b18('0x3'));var moment=require(_0x5b18('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b18('0x5'));var fs=require('fs');var path=require(_0x5b18('0x6'));var rimraf=require(_0x5b18('0x7'));var config=require(_0x5b18('0x8'));var attributes=require(_0x5b18('0x9'));module[_0x5b18('0xa')]=function(_0x53e21f,_0x2d02b8){return _0x53e21f[_0x5b18('0xb')](_0x5b18('0xc'),attributes,{'tableName':_0x5b18('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index fc7cf08..9c975a9 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 _0xae51=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x3429ed,_0x28fb1e){var _0x17f7ce=function(_0x689154){while(--_0x689154){_0x3429ed['push'](_0x3429ed['shift']());}};_0x17f7ce(++_0x28fb1e);}(_0xae51,0xfa));var _0x1ae5=function(_0x4a8c58,_0x258741){_0x4a8c58=_0x4a8c58-0x0;var _0x4b624c=_0xae51[_0x4a8c58];return _0x4b624c;};'use strict';var _=require(_0x1ae5('0x0'));var util=require(_0x1ae5('0x1'));var moment=require(_0x1ae5('0x2'));var BPromise=require(_0x1ae5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ae5('0x4'));var db=require(_0x1ae5('0x5'))['db'];var utils=require(_0x1ae5('0x6'));var logger=require('../../config/logger')(_0x1ae5('0x7'));var config=require(_0x1ae5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1ae5('0x9')][_0x1ae5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2492e7,_0x385fe7,_0x3b594a){return new BPromise(function(_0x12a6f2,_0x423131){return client[_0x1ae5('0xb')](_0x2492e7,_0x3b594a)[_0x1ae5('0xc')](function(_0x8a9201){logger[_0x1ae5('0xd')](_0x1ae5('0xe'),_0x385fe7,_0x1ae5('0xf'));logger[_0x1ae5('0x10')](_0x1ae5('0x11'),_0x385fe7,_0x1ae5('0xf'),JSON[_0x1ae5('0x12')](_0x8a9201));if(_0x8a9201[_0x1ae5('0x13')]){if(_0x8a9201['error'][_0x1ae5('0x14')]===0x1f4){logger[_0x1ae5('0x13')](_0x1ae5('0xe'),_0x385fe7,_0x8a9201[_0x1ae5('0x13')][_0x1ae5('0x15')]);return _0x423131(_0x8a9201[_0x1ae5('0x13')]['message']);}logger[_0x1ae5('0x13')](_0x1ae5('0xe'),_0x385fe7,_0x8a9201['error'][_0x1ae5('0x15')]);return _0x12a6f2(_0x8a9201[_0x1ae5('0x13')][_0x1ae5('0x15')]);}else{logger[_0x1ae5('0xd')](_0x1ae5('0xe'),_0x385fe7,_0x1ae5('0xf'));_0x12a6f2(_0x8a9201[_0x1ae5('0x16')][_0x1ae5('0x15')]);}})[_0x1ae5('0x17')](function(_0x569f88){logger['error'](_0x1ae5('0xe'),_0x385fe7,_0x569f88);_0x423131(_0x569f88);});});}exports[_0x1ae5('0x18')]=function(_0x5b27cf){var _0x38a6b9=this;return new Promise(function(_0x42cade,_0x3b433c){return db[_0x1ae5('0x19')][_0x1ae5('0x1a')](_0x5b27cf['body'],{'raw':_0x5b27cf[_0x1ae5('0x1b')]?_0x5b27cf[_0x1ae5('0x1b')][_0x1ae5('0x1c')]===undefined?!![]:![]:!![]})[_0x1ae5('0xc')](function(_0x2c5d0c){logger[_0x1ae5('0xd')](_0x1ae5('0x18'),_0x5b27cf);logger['debug'](_0x1ae5('0x18'),_0x5b27cf,JSON[_0x1ae5('0x12')](_0x2c5d0c));_0x42cade(_0x2c5d0c);})[_0x1ae5('0x17')](function(_0x399665){logger[_0x1ae5('0x13')](_0x1ae5('0x18'),_0x399665[_0x1ae5('0x15')],_0x5b27cf);_0x3b433c(_0x38a6b9[_0x1ae5('0x13')](0x1f4,_0x399665['message']));});});}; \ No newline at end of file +var _0x4733=['body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','ReportAgentPreview,\x20%s,\x20%s','catch','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x6d7d5e,_0xf9a26){var _0x37a895=function(_0x25875c){while(--_0x25875c){_0x6d7d5e['push'](_0x6d7d5e['shift']());}};_0x37a895(++_0xf9a26);}(_0x4733,0x142));var _0x3473=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0x4733[_0x511b76];return _0x5424ff;};'use strict';var _=require(_0x3473('0x0'));var util=require(_0x3473('0x1'));var moment=require(_0x3473('0x2'));var BPromise=require(_0x3473('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3473('0x4'));var db=require(_0x3473('0x5'))['db'];var utils=require(_0x3473('0x6'));var logger=require(_0x3473('0x7'))('rpc');var config=require(_0x3473('0x8'));var jayson=require(_0x3473('0x9'));var client=jayson[_0x3473('0xa')][_0x3473('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x290a00,_0x2c5513,_0x681a15){return new BPromise(function(_0x3a638d,_0x166ff6){return client[_0x3473('0xc')](_0x290a00,_0x681a15)[_0x3473('0xd')](function(_0x37cd51){logger[_0x3473('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x2c5513,_0x3473('0xf'));logger[_0x3473('0x10')](_0x3473('0x11'),_0x2c5513,'request\x20sent',JSON[_0x3473('0x12')](_0x37cd51));if(_0x37cd51['error']){if(_0x37cd51[_0x3473('0x13')]['code']===0x1f4){logger[_0x3473('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x2c5513,_0x37cd51['error'][_0x3473('0x14')]);return _0x166ff6(_0x37cd51[_0x3473('0x13')]['message']);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2c5513,_0x37cd51[_0x3473('0x13')]['message']);return _0x3a638d(_0x37cd51[_0x3473('0x13')]['message']);}else{logger[_0x3473('0xe')](_0x3473('0x15'),_0x2c5513,_0x3473('0xf'));_0x3a638d(_0x37cd51['result'][_0x3473('0x14')]);}})[_0x3473('0x16')](function(_0x60524){logger[_0x3473('0x13')](_0x3473('0x15'),_0x2c5513,_0x60524);_0x166ff6(_0x60524);});});}exports[_0x3473('0x17')]=function(_0x18426e){var _0x14e939=this;return new Promise(function(_0x52701a,_0x3e30a2){return db[_0x3473('0x18')][_0x3473('0x19')](_0x18426e[_0x3473('0x1a')],{'raw':_0x18426e[_0x3473('0x1b')]?_0x18426e[_0x3473('0x1b')][_0x3473('0x1c')]===undefined?!![]:![]:!![]})[_0x3473('0xd')](function(_0x18d8c1){logger['info'](_0x3473('0x17'),_0x18426e);logger['debug']('CreateReportAgentPreview',_0x18426e,JSON[_0x3473('0x12')](_0x18d8c1));_0x52701a(_0x18d8c1);})[_0x3473('0x16')](function(_0x3ff9e9){logger[_0x3473('0x13')](_0x3473('0x17'),_0x3ff9e9[_0x3473('0x14')],_0x18426e);_0x3e30a2(_0x14e939[_0x3473('0x13')](0x1f4,_0x3ff9e9[_0x3473('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0d02752..60e791a 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 _0xf5b9=['/whatsapp/queues/waitinginteractions','post','/mail/queues/:id/notify','mail','showMailQueues','/chat/queues/:id/notify','queueNotify','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xf5b9,0x19d));var _0x9f5b=function(_0x535c0f,_0x2ec3c4){_0x535c0f=_0x535c0f-0x0;var _0x272919=_0xf5b9[_0x535c0f];return _0x272919;};'use strict';var multer=require(_0x9f5b('0x0'));var util=require(_0x9f5b('0x1'));var path=require('path');var express=require(_0x9f5b('0x2'));var router=express[_0x9f5b('0x3')]();var auth=require(_0x9f5b('0x4'));var controller=require(_0x9f5b('0x5'));router[_0x9f5b('0x6')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router[_0x9f5b('0x6')](_0x9f5b('0x7'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x9')]);router[_0x9f5b('0x6')](_0x9f5b('0xa'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0xb')]);router[_0x9f5b('0x6')](_0x9f5b('0xc'),auth['isAuthenticated'](),controller[_0x9f5b('0xd')]);router[_0x9f5b('0x6')](_0x9f5b('0xe'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0xf')]);router[_0x9f5b('0x6')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x9f5b('0x6')](_0x9f5b('0x10'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x11')]);router[_0x9f5b('0x6')](_0x9f5b('0x12'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x13')]);router[_0x9f5b('0x6')](_0x9f5b('0x14'),auth[_0x9f5b('0x8')](),controller['smsQueues']);router[_0x9f5b('0x6')](_0x9f5b('0x15'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x16')]);router[_0x9f5b('0x6')]('/fax/queues',auth[_0x9f5b('0x8')](),controller['faxQueues']);router[_0x9f5b('0x6')](_0x9f5b('0x17'),auth['isAuthenticated'](),controller[_0x9f5b('0x18')]);router[_0x9f5b('0x6')](_0x9f5b('0x19'),auth[_0x9f5b('0x8')](),controller['voiceQueuesChannels']);router[_0x9f5b('0x6')](_0x9f5b('0x1a'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x1b')]);router[_0x9f5b('0x6')](_0x9f5b('0x1c'),auth['isAuthenticated'](),controller[_0x9f5b('0x1d')]);router[_0x9f5b('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x9f5b('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x9f5b('0x6')](_0x9f5b('0x1e'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x1f')]);router[_0x9f5b('0x6')](_0x9f5b('0x20'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x21')]);router[_0x9f5b('0x6')](_0x9f5b('0x22'),auth['isAuthenticated'](),controller[_0x9f5b('0x23')]);router['get']('/agents',auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x24')]);router[_0x9f5b('0x25')](_0x9f5b('0x26'),auth['isAuthenticated'](),controller[_0x9f5b('0x27')]);router[_0x9f5b('0x6')](_0x9f5b('0x28'),auth['isAuthenticated'](),controller[_0x9f5b('0x29')]);router[_0x9f5b('0x6')](_0x9f5b('0x2a'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x2b')]);router[_0x9f5b('0x6')](_0x9f5b('0x2c'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x2d')]);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x9f5b('0x2e')]);router[_0x9f5b('0x6')](_0x9f5b('0x2f'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x30')]);router[_0x9f5b('0x6')](_0x9f5b('0x31'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x32')]);router[_0x9f5b('0x6')](_0x9f5b('0x33'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x34')]);router[_0x9f5b('0x6')](_0x9f5b('0x35'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x36')]);router['get'](_0x9f5b('0x37'),auth[_0x9f5b('0x8')](),controller['whatsappQueuesWaitingInteractions']);router['get']('/fax/queues/waitinginteractions',auth[_0x9f5b('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x9f5b('0x38')](_0x9f5b('0x39'),auth[_0x9f5b('0x8')](),controller['queueNotify'](_0x9f5b('0x3a')));router[_0x9f5b('0x6')]('/mail/queues/:id',auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x3b')]);router[_0x9f5b('0x38')](_0x9f5b('0x3c'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x3d')]('chat'));router[_0x9f5b('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x9f5b('0x3e')]);router['post'](_0x9f5b('0x3f'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x3d')](_0x9f5b('0x40')));router[_0x9f5b('0x6')](_0x9f5b('0x41'),auth['isAuthenticated'](),controller[_0x9f5b('0x42')]);router[_0x9f5b('0x38')](_0x9f5b('0x43'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x3d')](_0x9f5b('0x44')));router['get']('/openchannel/queues/:id',auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x45')]);router[_0x9f5b('0x38')](_0x9f5b('0x46'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x3d')](_0x9f5b('0x47')));router['post'](_0x9f5b('0x48'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x3d')](_0x9f5b('0x49')));router[_0x9f5b('0x6')](_0x9f5b('0x4a'),auth[_0x9f5b('0x8')](),controller[_0x9f5b('0x4b')]);router[_0x9f5b('0x6')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x9f5b('0x38')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x9f5b('0x4c')]);module[_0x9f5b('0x4d')]=router; \ No newline at end of file +var _0x530b=['agentNotify','exports','multer','util','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','/telephones','telephones','/trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','showChatQueues','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify'];(function(_0x4066d1,_0xddaabe){var _0x4d38cd=function(_0x41f589){while(--_0x41f589){_0x4066d1['push'](_0x4066d1['shift']());}};_0x4d38cd(++_0xddaabe);}(_0x530b,0xe9));var _0xb530=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x530b[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0xb530('0x0'));var util=require(_0xb530('0x1'));var path=require('path');var express=require('express');var router=express[_0xb530('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xb530('0x3'));router[_0xb530('0x4')](_0xb530('0x5'),auth[_0xb530('0x6')](),controller[_0xb530('0x7')]);router[_0xb530('0x4')](_0xb530('0x8'),auth[_0xb530('0x6')](),controller[_0xb530('0x9')]);router[_0xb530('0x4')](_0xb530('0xa'),auth['isAuthenticated'](),controller[_0xb530('0xb')]);router[_0xb530('0x4')]('/voice/queues',auth[_0xb530('0x6')](),controller[_0xb530('0xc')]);router[_0xb530('0x4')](_0xb530('0xd'),auth[_0xb530('0x6')](),controller['chatQueues']);router['get']('/mail/queues',auth[_0xb530('0x6')](),controller[_0xb530('0xe')]);router[_0xb530('0x4')]('/mail/accounts',auth[_0xb530('0x6')](),controller[_0xb530('0xf')]);router['get'](_0xb530('0x10'),auth[_0xb530('0x6')](),controller[_0xb530('0x11')]);router[_0xb530('0x4')](_0xb530('0x12'),auth['isAuthenticated'](),controller[_0xb530('0x13')]);router[_0xb530('0x4')](_0xb530('0x14'),auth[_0xb530('0x6')](),controller[_0xb530('0x15')]);router[_0xb530('0x4')](_0xb530('0x16'),auth[_0xb530('0x6')](),controller[_0xb530('0x17')]);router[_0xb530('0x4')]('/voice/queues/preview/:id',auth[_0xb530('0x6')](),controller[_0xb530('0x18')]);router[_0xb530('0x4')](_0xb530('0x19'),auth['isAuthenticated'](),controller[_0xb530('0x1a')]);router[_0xb530('0x4')]('/voice/queues/channels/:uniqueid',auth[_0xb530('0x6')](),controller[_0xb530('0x1b')]);router[_0xb530('0x4')](_0xb530('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0xb530('0x4')](_0xb530('0x1d'),auth[_0xb530('0x6')](),controller[_0xb530('0x1e')]);router[_0xb530('0x4')](_0xb530('0x1f'),auth['isAuthenticated'](),controller[_0xb530('0x20')]);router[_0xb530('0x4')](_0xb530('0x21'),auth[_0xb530('0x6')](),controller[_0xb530('0x22')]);router[_0xb530('0x4')](_0xb530('0x23'),auth[_0xb530('0x6')](),controller['outboundChannels']);router['get'](_0xb530('0x24'),auth[_0xb530('0x6')](),controller[_0xb530('0x25')]);router[_0xb530('0x26')](_0xb530('0x27'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0xb530('0x4')](_0xb530('0x28'),auth['isAuthenticated'](),controller[_0xb530('0x29')]);router['get'](_0xb530('0x2a'),auth['isAuthenticated'](),controller['trunks']);router[_0xb530('0x4')]('/campaigns',auth[_0xb530('0x6')](),controller['campaigns']);router[_0xb530('0x4')](_0xb530('0x2b'),auth[_0xb530('0x6')](),controller[_0xb530('0x2c')]);router[_0xb530('0x4')](_0xb530('0x2d'),auth[_0xb530('0x6')](),controller[_0xb530('0x2e')]);router[_0xb530('0x4')](_0xb530('0x2f'),auth[_0xb530('0x6')](),controller[_0xb530('0x30')]);router[_0xb530('0x4')](_0xb530('0x31'),auth[_0xb530('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0xb530('0x4')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xb530('0x32')]);router['get'](_0xb530('0x33'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0xb530('0x34'),auth[_0xb530('0x6')](),controller[_0xb530('0x35')]);router['post'](_0xb530('0x36'),auth[_0xb530('0x6')](),controller[_0xb530('0x37')](_0xb530('0x38')));router[_0xb530('0x4')](_0xb530('0x39'),auth['isAuthenticated'](),controller[_0xb530('0x3a')]);router[_0xb530('0x3b')](_0xb530('0x3c'),auth[_0xb530('0x6')](),controller['queueNotify']('chat'));router[_0xb530('0x4')]('/chat/queues/:id',auth[_0xb530('0x6')](),controller[_0xb530('0x3d')]);router['post']('/fax/queues/:id/notify',auth[_0xb530('0x6')](),controller['queueNotify']('fax'));router['get']('/fax/queues/:id',auth[_0xb530('0x6')](),controller[_0xb530('0x3e')]);router['post'](_0xb530('0x3f'),auth[_0xb530('0x6')](),controller[_0xb530('0x37')](_0xb530('0x40')));router[_0xb530('0x4')]('/openchannel/queues/:id',auth[_0xb530('0x6')](),controller[_0xb530('0x41')]);router[_0xb530('0x3b')](_0xb530('0x42'),auth[_0xb530('0x6')](),controller[_0xb530('0x37')](_0xb530('0x43')));router[_0xb530('0x3b')](_0xb530('0x44'),auth[_0xb530('0x6')](),controller[_0xb530('0x37')](_0xb530('0x45')));router['get'](_0xb530('0x46'),auth[_0xb530('0x6')](),controller[_0xb530('0x47')]);router[_0xb530('0x4')](_0xb530('0x48'),auth[_0xb530('0x6')](),controller[_0xb530('0x49')]);router[_0xb530('0x3b')](_0xb530('0x4a'),auth[_0xb530('0x6')](),controller[_0xb530('0x4b')]);module[_0xb530('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5c7ef1c..3c02c56 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 _0xfd2d=['faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','InteractionId','From','TransferReport','create','Start','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','format','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues'];(function(_0x2c0399,_0x15c979){var _0x8af475=function(_0x49cac8){while(--_0x49cac8){_0x2c0399['push'](_0x2c0399['shift']());}};_0x8af475(++_0x15c979);}(_0xfd2d,0x17d));var _0xdfd2=function(_0xbf391b,_0x5b0a21){_0xbf391b=_0xbf391b-0x0;var _0x5ffc5d=_0xfd2d[_0xbf391b];return _0x5ffc5d;};'use strict';var BPromise=require('bluebird');var moment=require(_0xdfd2('0x0'));var _=require(_0xdfd2('0x1'));var util=require(_0xdfd2('0x2'));var db=require(_0xdfd2('0x3'))['db'];var logger=require(_0xdfd2('0x4'))('api');var jayson=require(_0xdfd2('0x5'));var amiClient=jayson['client'][_0xdfd2('0x6')]({'port':0x232a});var mailClient=jayson[_0xdfd2('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xdfd2('0x7')][_0xdfd2('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x2cef46,_0x290d71,_0xb19d58){return new BPromise(function(_0x39d77f,_0x40a10f){var _0x180cc4=_0xb19d58?_0xb19d58:amiClient;return _0x180cc4[_0xdfd2('0x8')](_0x2cef46,_0x290d71)[_0xdfd2('0x9')](function(_0x1819c1){if(_0x1819c1['error']){if(_0x1819c1[_0xdfd2('0xa')][_0xdfd2('0xb')]===0x1f4){return _0x40a10f(_0x1819c1[_0xdfd2('0xa')][_0xdfd2('0xc')]);}return _0x39d77f(_0x1819c1[_0xdfd2('0xa')][_0xdfd2('0xc')]);}else{_0x39d77f(_0x1819c1[_0xdfd2('0xd')]);}})[_0xdfd2('0xe')](function(_0x380dfc){_0x40a10f(_0x380dfc);});});}function respondWithResult(_0x126e67,_0x315379){_0x315379=_0x315379||0xc8;return function(_0x14c3cc){if(_0x14c3cc){return _0x126e67[_0xdfd2('0xf')](_0x315379)[_0xdfd2('0x10')](_0x14c3cc);}return _0x126e67[_0xdfd2('0x11')](0x194);};}function handleError(_0x212a51,_0x2692af){_0x2692af=_0x2692af||0x1f4;return function(_0x2862ce){logger[_0xdfd2('0xa')](_0x2862ce[_0xdfd2('0x12')]);if(_0x2862ce['name']){delete _0x2862ce[_0xdfd2('0x13')];}_0x212a51[_0xdfd2('0xf')](_0x2692af)[_0xdfd2('0x14')](_0x2862ce);};}function findById(_0x25e629){return function(_0x48782b){if(!_[_0xdfd2('0x15')](_0x25e629)&&!_[_0xdfd2('0x15')](_0x48782b)&&!_[_0xdfd2('0x15')](_0x48782b[_0xdfd2('0x16')])){return _[_0xdfd2('0x17')](_0x48782b[_0xdfd2('0x16')],function(_0x55360d){return _0x55360d['id']==_0x25e629;});}return null;};}exports[_0xdfd2('0x18')]=function(_0x270861,_0x1b7630){return respondWithRpcPromise('VoiceChannels',_0x270861[_0xdfd2('0x19')])[_0xdfd2('0x9')](respondWithResult(_0x1b7630,null))[_0xdfd2('0xe')](handleError(_0x1b7630,null));};exports[_0xdfd2('0x1a')]=function(_0x4792e1,_0x25ec7c){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xdfd2('0x1b')](_0x4792e1['query'],_0x4792e1[_0xdfd2('0x1c')]))[_0xdfd2('0x9')](respondWithResult(_0x25ec7c,null))[_0xdfd2('0xe')](handleError(_0x25ec7c,null));};exports['voiceChannelStopMixMonitor']=function(_0x1907d8,_0x24b957){return respondWithRpcPromise(_0xdfd2('0x1d'),_[_0xdfd2('0x1b')](_0x1907d8[_0xdfd2('0x19')],_0x1907d8['params']))[_0xdfd2('0x9')](respondWithResult(_0x24b957,null))[_0xdfd2('0xe')](handleError(_0x24b957,null));};exports['voiceQueues']=function(_0x53dcb6,_0x24b785){return respondWithRpcPromise(_0xdfd2('0x1e'),_0x53dcb6['query'])[_0xdfd2('0x9')](respondWithResult(_0x24b785,null))[_0xdfd2('0xe')](handleError(_0x24b785,null));};exports['showVoiceQueues']=function(_0x4b10a3,_0x3884ef){return respondWithRpcPromise('VoiceQueues',_0x4b10a3['query'])[_0xdfd2('0x9')](findById(_0x4b10a3[_0xdfd2('0x1c')]['id']))[_0xdfd2('0x9')](respondWithResult(_0x3884ef,null))[_0xdfd2('0xe')](handleError(_0x3884ef,null));};exports[_0xdfd2('0x1f')]=function(_0x428d21,_0x4e1951){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x428d21[_0xdfd2('0x19')],_0x428d21['params']))[_0xdfd2('0x9')](respondWithResult(_0x4e1951,null))['catch'](handleError(_0x4e1951,null));};exports[_0xdfd2('0x20')]=function(_0x49eef4,_0x265bae){return respondWithRpcPromise('VoiceQueuesChannels',_0x49eef4[_0xdfd2('0x19')])[_0xdfd2('0x9')](respondWithResult(_0x265bae,null))[_0xdfd2('0xe')](handleError(_0x265bae,null));};exports[_0xdfd2('0x21')]=function(_0x21f376,_0xfd5fe){return respondWithRpcPromise(_0xdfd2('0x22'),_[_0xdfd2('0x1b')](_0x21f376['query'],_0x21f376[_0xdfd2('0x1c')]))[_0xdfd2('0x9')](respondWithResult(_0xfd5fe,null))[_0xdfd2('0xe')](handleError(_0xfd5fe,null));};exports[_0xdfd2('0x23')]=function(_0x1011e3,_0x44ebec){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xdfd2('0x1b')](_0x1011e3[_0xdfd2('0x19')],_0x1011e3['params']))[_0xdfd2('0x9')](respondWithResult(_0x44ebec,null))[_0xdfd2('0xe')](handleError(_0x44ebec,null));};exports[_0xdfd2('0x24')]=function(_0x182974,_0x20a59a){return respondWithRpcPromise(_0xdfd2('0x25'),_[_0xdfd2('0x1b')](_0x182974[_0xdfd2('0x19')],_0x182974['params']))['then'](respondWithResult(_0x20a59a,null))[_0xdfd2('0xe')](handleError(_0x20a59a,null));};exports[_0xdfd2('0x26')]=function(_0x1d16f6,_0x2eaa6b){return respondWithRpcPromise(_0xdfd2('0x27'),_0x1d16f6[_0xdfd2('0x19')])[_0xdfd2('0x9')](respondWithResult(_0x2eaa6b,null))[_0xdfd2('0xe')](handleError(_0x2eaa6b,null));};exports['outboundChannels']=function(_0x43fd6f,_0x57328e){return respondWithRpcPromise(_0xdfd2('0x28'),_0x43fd6f['query'])[_0xdfd2('0x9')](respondWithResult(_0x57328e,null))[_0xdfd2('0xe')](handleError(_0x57328e,null));};exports['agents']=function(_0x18536c,_0x311b14){var _0x31bbc9;return respondWithRpcPromise(_0xdfd2('0x29'),_0x18536c['query'])['then'](function(_0x2da7e){_0x31bbc9=_0x2da7e;return respondWithRpcPromise('Agents',_0x18536c[_0xdfd2('0x19')],routingClient);})[_0xdfd2('0x9')](function(_0x31e3c5){return _[_0xdfd2('0x1b')]({},_0x31e3c5,_0x31bbc9);})[_0xdfd2('0x9')](respondWithResult(_0x311b14,null))[_0xdfd2('0xe')](handleError(_0x311b14,null));};exports[_0xdfd2('0x2a')]=function(_0x371d14,_0xad8373){if(_0x371d14[_0xdfd2('0x2b')]&&_0x371d14[_0xdfd2('0x2b')][_0xdfd2('0x2c')]&&_0x371d14[_0xdfd2('0x2d')]&&_0x371d14[_0xdfd2('0x2d')]['name']){for(var _0x2bef84 in _0x371d14[_0xdfd2('0x2b')][_0xdfd2('0x2c')]){if(_0x371d14['body'][_0xdfd2('0x2c')][_0xdfd2('0x2e')](_0x2bef84)){db[_0xdfd2('0x2f')][_0xdfd2('0x30')]({'where':{'channel':_0x2bef84,'membername':_0x371d14['user'][_0xdfd2('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x371d14['body'][_0xdfd2('0x2c')][_0x2bef84]&&_0x371d14['body'][_0xdfd2('0x2c')][_0x2bef84][_0xdfd2('0x31')]?{'$notIn':_0x371d14[_0xdfd2('0x2b')][_0xdfd2('0x2c')][_0x2bef84]}:{'$ne':null}}})[_0xdfd2('0x9')](function(_0x507a5d){var _0x3ac0ce=moment()['format'](_0xdfd2('0x32'));for(var _0x72528f=0x0,_0x4ef0b8=_0x507a5d[_0xdfd2('0x31')];_0x72528f<_0x4ef0b8;_0x72528f+=0x1){_0x507a5d[_0x72528f][_0xdfd2('0x33')]({'exitAt':_0x3ac0ce});}});for(var _0x4f47f9=0x0;_0x4f47f9<_0x371d14[_0xdfd2('0x2b')][_0xdfd2('0x2c')][_0x2bef84][_0xdfd2('0x31')];_0x4f47f9+=0x1){db['MemberReport'][_0xdfd2('0x34')]({'where':{'channel':_0x2bef84,'membername':_0x371d14[_0xdfd2('0x2d')][_0xdfd2('0x13')],'type':_0xdfd2('0x35'),'uniqueid':_0x371d14[_0xdfd2('0x2b')][_0xdfd2('0x2c')][_0x2bef84][_0x4f47f9],'exitAt':null},'defaults':{'channel':_0x2bef84,'membername':_0x371d14[_0xdfd2('0x2d')][_0xdfd2('0x13')],'interface':_[_0xdfd2('0x15')](_0x371d14[_0xdfd2('0x2d')]['interface'])?util[_0xdfd2('0x36')](_0xdfd2('0x37'),_0x371d14[_0xdfd2('0x2d')][_0xdfd2('0x13')]):_0x371d14['user'][_0xdfd2('0x38')],'type':'INTERACTION','enterAt':moment()[_0xdfd2('0x36')](_0xdfd2('0x32')),'role':_0xdfd2('0x39'),'internal':_0x371d14[_0xdfd2('0x2d')][_0xdfd2('0x3a')],'uniqueid':_0x371d14[_0xdfd2('0x2b')]['interaction'][_0x2bef84][_0x4f47f9]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x371d14['params']['id'],'capacity':_0x371d14['body'][_0xdfd2('0x3b')]},routingClient)[_0xdfd2('0x9')](respondWithResult(_0xad8373,null))[_0xdfd2('0xe')](handleError(_0xad8373,null));};exports[_0xdfd2('0x3c')]=function(_0x1332db,_0x2a2ccd){return respondWithRpcPromise(_0xdfd2('0x3d'),_0x1332db['query'])[_0xdfd2('0x9')](respondWithResult(_0x2a2ccd,null))[_0xdfd2('0xe')](handleError(_0x2a2ccd,null));};exports['trunks']=function(_0x16d928,_0x22260f){return respondWithRpcPromise(_0xdfd2('0x3e'),_0x16d928[_0xdfd2('0x19')])['then'](respondWithResult(_0x22260f,null))[_0xdfd2('0xe')](handleError(_0x22260f,null));};exports[_0xdfd2('0x3f')]=function(_0xf500e9,_0x4863d9){return respondWithRpcPromise(_0xdfd2('0x40'),_0xf500e9['query'])[_0xdfd2('0x9')](respondWithResult(_0x4863d9,null))[_0xdfd2('0xe')](handleError(_0x4863d9,null));};exports['chatQueues']=function(_0x5b9e14,_0x369508){return respondWithRpcPromise('ChatQueues',_0x5b9e14[_0xdfd2('0x19')],routingClient)[_0xdfd2('0x9')](respondWithResult(_0x369508,null))[_0xdfd2('0xe')](handleError(_0x369508,null));};exports[_0xdfd2('0x41')]=function(_0x40e2eb,_0x3ba85c){return respondWithRpcPromise(_0xdfd2('0x42'),_0x40e2eb[_0xdfd2('0x19')],routingClient)[_0xdfd2('0x9')](findById(_0x40e2eb['params']['id']))[_0xdfd2('0x9')](respondWithResult(_0x3ba85c,null))['catch'](handleError(_0x3ba85c,null));};exports[_0xdfd2('0x43')]=function(_0x2edc66,_0x1ebf3a){return respondWithRpcPromise(_0xdfd2('0x44'),_0x2edc66['query'],routingClient)[_0xdfd2('0x9')](respondWithResult(_0x1ebf3a,null))[_0xdfd2('0xe')](handleError(_0x1ebf3a,null));};exports[_0xdfd2('0x45')]=function(_0x4273bd,_0x4fa5d3){return respondWithRpcPromise('MailQueues',_0x4273bd['query'],routingClient)['then'](findById(_0x4273bd[_0xdfd2('0x1c')]['id']))[_0xdfd2('0x9')](respondWithResult(_0x4fa5d3,null))[_0xdfd2('0xe')](handleError(_0x4fa5d3,null));};exports[_0xdfd2('0x46')]=function(_0x23e9ed,_0xda0b17){return respondWithRpcPromise('MailAccounts',_0x23e9ed[_0xdfd2('0x19')],mailClient)['then'](respondWithResult(_0xda0b17,null))['catch'](handleError(_0xda0b17,null));};exports[_0xdfd2('0x47')]=function(_0x236444,_0x324952){return respondWithRpcPromise('OpenchannelQueues',_0x236444[_0xdfd2('0x19')],routingClient)[_0xdfd2('0x9')](respondWithResult(_0x324952,null))[_0xdfd2('0xe')](handleError(_0x324952,null));};exports[_0xdfd2('0x48')]=function(_0x4418d3,_0x1c04b8){return respondWithRpcPromise(_0xdfd2('0x49'),_0x4418d3[_0xdfd2('0x19')],routingClient)[_0xdfd2('0x9')](findById(_0x4418d3[_0xdfd2('0x1c')]['id']))[_0xdfd2('0x9')](respondWithResult(_0x1c04b8,null))[_0xdfd2('0xe')](handleError(_0x1c04b8,null));};exports['smsQueues']=function(_0x5af148,_0x236ac3){return respondWithRpcPromise(_0xdfd2('0x4a'),_0x5af148[_0xdfd2('0x19')],routingClient)['then'](respondWithResult(_0x236ac3,null))[_0xdfd2('0xe')](handleError(_0x236ac3,null));};exports[_0xdfd2('0x4b')]=function(_0x16449e,_0x5975dc){return respondWithRpcPromise(_0xdfd2('0x4a'),_0x16449e[_0xdfd2('0x19')],routingClient)[_0xdfd2('0x9')](findById(_0x16449e[_0xdfd2('0x1c')]['id']))[_0xdfd2('0x9')](respondWithResult(_0x5975dc,null))[_0xdfd2('0xe')](handleError(_0x5975dc,null));};exports[_0xdfd2('0x4c')]=function(_0xbcc9d2,_0x362a85){return respondWithRpcPromise(_0xdfd2('0x4d'),_0xbcc9d2['query'],routingClient)['then'](respondWithResult(_0x362a85,null))['catch'](handleError(_0x362a85,null));};exports[_0xdfd2('0x4e')]=function(_0x5925e3,_0x36929a){return respondWithRpcPromise(_0xdfd2('0x4d'),_0x5925e3['query'],routingClient)['then'](findById(_0x5925e3[_0xdfd2('0x1c')]['id']))[_0xdfd2('0x9')](respondWithResult(_0x36929a,null))[_0xdfd2('0xe')](handleError(_0x36929a,null));};exports[_0xdfd2('0x4f')]=function(_0x1187eb,_0x1c9b2f){return respondWithRpcPromise(_0xdfd2('0x50'),_0x1187eb['query'],routingClient)[_0xdfd2('0x9')](respondWithResult(_0x1c9b2f,null))[_0xdfd2('0xe')](handleError(_0x1c9b2f,null));};exports[_0xdfd2('0x51')]=function(_0x2fd1bf,_0x5bef91){return respondWithRpcPromise(_0xdfd2('0x50'),_0x2fd1bf['query'],routingClient)['then'](findById(_0x2fd1bf['params']['id']))[_0xdfd2('0x9')](respondWithResult(_0x5bef91,null))['catch'](handleError(_0x5bef91,null));};exports['faxAccounts']=function(_0x1d3983,_0x22abb9){return respondWithRpcPromise('FaxAccounts',_0x1d3983[_0xdfd2('0x19')])[_0xdfd2('0x9')](respondWithResult(_0x22abb9,null))[_0xdfd2('0xe')](handleError(_0x22abb9,null));};exports[_0xdfd2('0x52')]=function(_0x5cf7e4,_0x49916c){return respondWithRpcPromise(_0xdfd2('0x53'),_0x5cf7e4[_0xdfd2('0x19')],routingClient)[_0xdfd2('0x9')](respondWithResult(_0x49916c,null))[_0xdfd2('0xe')](handleError(_0x49916c,null));};exports[_0xdfd2('0x54')]=function(_0x105f8b,_0x2085ba){return respondWithRpcPromise(_0xdfd2('0x55'),_0x105f8b[_0xdfd2('0x19')],routingClient)[_0xdfd2('0x9')](respondWithResult(_0x2085ba,null))[_0xdfd2('0xe')](handleError(_0x2085ba,null));};exports[_0xdfd2('0x56')]=function(_0x38efac,_0x23f365){return respondWithRpcPromise(_0xdfd2('0x57'),_0x38efac[_0xdfd2('0x19')],routingClient)['then'](respondWithResult(_0x23f365,null))[_0xdfd2('0xe')](handleError(_0x23f365,null));};exports[_0xdfd2('0x58')]=function(_0x4620c3,_0x37de5e){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x4620c3[_0xdfd2('0x19')],routingClient)[_0xdfd2('0x9')](respondWithResult(_0x37de5e,null))[_0xdfd2('0xe')](handleError(_0x37de5e,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x49bbb0,_0x23f9f6){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x49bbb0['query'],routingClient)[_0xdfd2('0x9')](respondWithResult(_0x23f9f6,null))[_0xdfd2('0xe')](handleError(_0x23f9f6,null));};exports[_0xdfd2('0x59')]=function(_0x507b8c,_0xeb7fbb){return respondWithRpcPromise(_0xdfd2('0x5a'),_0x507b8c[_0xdfd2('0x19')],routingClient)['then'](respondWithResult(_0xeb7fbb,null))[_0xdfd2('0xe')](handleError(_0xeb7fbb,null));};exports['queueNotify']=function(_0x2dd019){return function(_0x9ad7e5,_0x68877d){var _0x2c43d6,_0x263a20;var _0x4adeca=_[_0xdfd2('0x5b')](_0x2dd019);var _0x11aafa=_0x2dd019===_0xdfd2('0x5c')?_0xdfd2('0x5d'):_0xdfd2('0x5e');return db[_0x4adeca+'Queue'][_0xdfd2('0x5f')]({'raw':!![],'where':{'id':_0x9ad7e5[_0xdfd2('0x1c')]['id']}})[_0xdfd2('0x9')](function(_0x10cc9c){if(_['isNil'](_0x10cc9c)){throw new Error(_0x4adeca+'\x20Queue\x20not\x20found');}_0x2c43d6=_0x10cc9c;return db[_0x4adeca+_0xdfd2('0x60')][_0xdfd2('0x5f')]({'where':{'id':_0x9ad7e5[_0xdfd2('0x2b')][_0xdfd2('0x61')]},'include':[{'model':db[_0x4adeca+_0xdfd2('0x62')],'as':_0xdfd2('0x62')},{'model':db[_0x4adeca+_0x11aafa],'as':_0xdfd2('0x5e')}]});})[_0xdfd2('0x9')](function(_0x13f5f4){if(_[_0xdfd2('0x15')](_0x13f5f4)){throw new Error(_0x4adeca+_0xdfd2('0x63'));}_0x263a20=_0x13f5f4;return _0x13f5f4[_0xdfd2('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdfd2('0x9')](function(){var _0x3f2009={'uniqueid':_0x2dd019+'.'+_0x263a20['id']+'.'+_0x263a20[_0xdfd2('0x62')]['id'],'FromUserId':_0x9ad7e5[_0xdfd2('0x2d')]['id'],'type':_0xdfd2('0x65')};_0x3f2009[_0x4adeca+_0xdfd2('0x66')]=_0x263a20['id'];_0x3f2009[_0x4adeca+'InteractionId']=_0x263a20[_0xdfd2('0x62')]['id'];_0x3f2009['From'+_0x4adeca+_0x11aafa+'Id']=_0x263a20[_0xdfd2('0x5e')]['id'];_0x3f2009['To'+_0x4adeca+'QueueId']=_0x2c43d6['id'];return db[_0x4adeca+'TransferReport']['create'](_0x3f2009);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x2dd019,'interaction':_0x263a20[_0xdfd2('0x62')],'message':_0x263a20,'account':_0x263a20[_0xdfd2('0x5e')],'applications':[{'id':0x0,'priority':0x1,'app':_0xdfd2('0x65'),'appdata':_0x2c43d6['name']+','+(_0x263a20['Account'][_0xdfd2('0x67')]||0x12c),'interval':_0xdfd2('0x68')}]},routingClient);})[_0xdfd2('0x9')](respondWithResult(_0x68877d,null))[_0xdfd2('0xe')](handleError(_0x68877d,null));};};exports[_0xdfd2('0x69')]=function(_0x3b5d0e,_0x584d4d){var _0x2f42cc,_0x4911bc;if(_['isNil'](_0x3b5d0e[_0xdfd2('0x2b')][_0xdfd2('0x6a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2e7670=_0x3b5d0e['body'][_0xdfd2('0x6a')];var _0x3acd2a=_['capitalize'](_0x2e7670);var _0x169cc2=_0x2e7670===_0xdfd2('0x5c')?'Website':'Account';return db[_0xdfd2('0x6b')][_0xdfd2('0x5f')]({'raw':!![],'where':{'id':_0x3b5d0e['params']['id'],'role':_0xdfd2('0x39')}})[_0xdfd2('0x9')](function(_0x42676f){if(_[_0xdfd2('0x15')](_0x42676f)){throw new Error(_0xdfd2('0x6c'));}_0x2f42cc=_0x42676f;return db[_0x3acd2a+_0xdfd2('0x60')][_0xdfd2('0x5f')]({'where':{'id':_0x3b5d0e[_0xdfd2('0x2b')]['messageId']},'include':[{'model':db[_0x3acd2a+_0xdfd2('0x62')],'as':'Interaction'},{'model':db[_0x3acd2a+_0x169cc2],'as':'Account'}]});})[_0xdfd2('0x9')](function(_0x403f5b){if(_['isNil'](_0x403f5b)){throw new Error(_0x3acd2a+_0xdfd2('0x63'));}_0x4911bc=_0x403f5b;return _0x403f5b[_0xdfd2('0x64')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x258219={'uniqueid':_0x2e7670+'.'+_0x4911bc['id']+'.'+_0x4911bc[_0xdfd2('0x62')]['id'],'FromUserId':_0x3b5d0e['user']['id'],'type':_0xdfd2('0x65'),'ToUserId':_0x2f42cc['id']};_0x258219[_0x3acd2a+_0xdfd2('0x66')]=_0x4911bc['id'];_0x258219[_0x3acd2a+_0xdfd2('0x6d')]=_0x4911bc['Interaction']['id'];_0x258219[_0xdfd2('0x6e')+_0x3acd2a+_0x169cc2+'Id']=_0x4911bc[_0xdfd2('0x5e')]['id'];return db[_0x3acd2a+_0xdfd2('0x6f')][_0xdfd2('0x70')](_0x258219);})[_0xdfd2('0x9')](function(){return respondWithRpcPromise(_0xdfd2('0x71'),{'channel':_0x2e7670,'interaction':_0x4911bc[_0xdfd2('0x62')],'message':_0x4911bc,'account':_0x4911bc['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xdfd2('0x39'),'appdata':_0x2f42cc[_0xdfd2('0x13')]+','+(_0x4911bc[_0xdfd2('0x5e')][_0xdfd2('0x72')]||0x12c),'interval':_0xdfd2('0x68')}]},routingClient);})[_0xdfd2('0x9')](respondWithResult(_0x584d4d,null))[_0xdfd2('0xe')](handleError(_0x584d4d,null));}; \ No newline at end of file +var _0xa852=['voiceChannelStopMixMonitor','showVoiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','Interaction','queue','MessageId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','Website','User','Agent\x20not\x20found','update','InteractionId','Start','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','code','error','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','query','voiceChannelMixMonitor','merge','params'];(function(_0x26b6d8,_0x43200a){var _0x5c73b9=function(_0x4c8c27){while(--_0x4c8c27){_0x26b6d8['push'](_0x26b6d8['shift']());}};_0x5c73b9(++_0x43200a);}(_0xa852,0x1bc));var _0x2a85=function(_0x532f0e,_0x4b0237){_0x532f0e=_0x532f0e-0x0;var _0x386d76=_0xa852[_0x532f0e];return _0x386d76;};'use strict';var BPromise=require(_0x2a85('0x0'));var moment=require(_0x2a85('0x1'));var _=require(_0x2a85('0x2'));var util=require(_0x2a85('0x3'));var db=require(_0x2a85('0x4'))['db'];var logger=require('../../config/logger')(_0x2a85('0x5'));var jayson=require(_0x2a85('0x6'));var amiClient=jayson[_0x2a85('0x7')][_0x2a85('0x8')]({'port':0x232a});var mailClient=jayson[_0x2a85('0x7')][_0x2a85('0x8')]({'port':0x232b});var routingClient=jayson[_0x2a85('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4b5fa3,_0x21a650,_0xcf48e9){return new BPromise(function(_0xe115e2,_0x4da79c){var _0x1d9eff=_0xcf48e9?_0xcf48e9:amiClient;return _0x1d9eff[_0x2a85('0x9')](_0x4b5fa3,_0x21a650)[_0x2a85('0xa')](function(_0x13aaea){if(_0x13aaea['error']){if(_0x13aaea['error'][_0x2a85('0xb')]===0x1f4){return _0x4da79c(_0x13aaea[_0x2a85('0xc')]['message']);}return _0xe115e2(_0x13aaea['error'][_0x2a85('0xd')]);}else{_0xe115e2(_0x13aaea[_0x2a85('0xe')]);}})[_0x2a85('0xf')](function(_0x499867){_0x4da79c(_0x499867);});});}function respondWithResult(_0x330d7f,_0x1309e2){_0x1309e2=_0x1309e2||0xc8;return function(_0x391868){if(_0x391868){return _0x330d7f[_0x2a85('0x10')](_0x1309e2)[_0x2a85('0x11')](_0x391868);}return _0x330d7f[_0x2a85('0x12')](0x194);};}function handleError(_0x273fbc,_0xfa6fb4){_0xfa6fb4=_0xfa6fb4||0x1f4;return function(_0xb20042){logger[_0x2a85('0xc')](_0xb20042[_0x2a85('0x13')]);if(_0xb20042[_0x2a85('0x14')]){delete _0xb20042[_0x2a85('0x14')];}_0x273fbc[_0x2a85('0x10')](_0xfa6fb4)[_0x2a85('0x15')](_0xb20042);};}function findById(_0x4b91a8){return function(_0x5c0299){if(!_[_0x2a85('0x16')](_0x4b91a8)&&!_[_0x2a85('0x16')](_0x5c0299)&&!_[_0x2a85('0x16')](_0x5c0299[_0x2a85('0x17')])){return _['find'](_0x5c0299['rows'],function(_0xa4c84d){return _0xa4c84d['id']==_0x4b91a8;});}return null;};}exports['voiceChannels']=function(_0x1b4c95,_0x174584){return respondWithRpcPromise('VoiceChannels',_0x1b4c95[_0x2a85('0x18')])[_0x2a85('0xa')](respondWithResult(_0x174584,null))[_0x2a85('0xf')](handleError(_0x174584,null));};exports[_0x2a85('0x19')]=function(_0x22eb76,_0xf88dc4){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x2a85('0x1a')](_0x22eb76[_0x2a85('0x18')],_0x22eb76[_0x2a85('0x1b')]))[_0x2a85('0xa')](respondWithResult(_0xf88dc4,null))[_0x2a85('0xf')](handleError(_0xf88dc4,null));};exports[_0x2a85('0x1c')]=function(_0x1c3084,_0x340d97){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x1c3084[_0x2a85('0x18')],_0x1c3084[_0x2a85('0x1b')]))[_0x2a85('0xa')](respondWithResult(_0x340d97,null))[_0x2a85('0xf')](handleError(_0x340d97,null));};exports['voiceQueues']=function(_0x41d3a3,_0x28fda8){return respondWithRpcPromise('VoiceQueues',_0x41d3a3[_0x2a85('0x18')])[_0x2a85('0xa')](respondWithResult(_0x28fda8,null))[_0x2a85('0xf')](handleError(_0x28fda8,null));};exports[_0x2a85('0x1d')]=function(_0x38c5bd,_0x3f7311){return respondWithRpcPromise(_0x2a85('0x1e'),_0x38c5bd['query'])[_0x2a85('0xa')](findById(_0x38c5bd[_0x2a85('0x1b')]['id']))[_0x2a85('0xa')](respondWithResult(_0x3f7311,null))[_0x2a85('0xf')](handleError(_0x3f7311,null));};exports[_0x2a85('0x1f')]=function(_0x3ed9f6,_0x24f6e5){return respondWithRpcPromise(_0x2a85('0x20'),_['merge'](_0x3ed9f6[_0x2a85('0x18')],_0x3ed9f6['params']))[_0x2a85('0xa')](respondWithResult(_0x24f6e5,null))[_0x2a85('0xf')](handleError(_0x24f6e5,null));};exports[_0x2a85('0x21')]=function(_0x977c66,_0x13f072){return respondWithRpcPromise('VoiceQueuesChannels',_0x977c66['query'])['then'](respondWithResult(_0x13f072,null))[_0x2a85('0xf')](handleError(_0x13f072,null));};exports['voiceQueuesChannel']=function(_0x1c06ed,_0x464bd1){return respondWithRpcPromise(_0x2a85('0x22'),_[_0x2a85('0x1a')](_0x1c06ed[_0x2a85('0x18')],_0x1c06ed[_0x2a85('0x1b')]))[_0x2a85('0xa')](respondWithResult(_0x464bd1,null))[_0x2a85('0xf')](handleError(_0x464bd1,null));};exports[_0x2a85('0x23')]=function(_0x53a81b,_0x1c5350){return respondWithRpcPromise(_0x2a85('0x24'),_[_0x2a85('0x1a')](_0x53a81b[_0x2a85('0x18')],_0x53a81b[_0x2a85('0x1b')]))[_0x2a85('0xa')](respondWithResult(_0x1c5350,null))[_0x2a85('0xf')](handleError(_0x1c5350,null));};exports[_0x2a85('0x25')]=function(_0x582243,_0x5b9df1){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x2a85('0x1a')](_0x582243[_0x2a85('0x18')],_0x582243[_0x2a85('0x1b')]))[_0x2a85('0xa')](respondWithResult(_0x5b9df1,null))[_0x2a85('0xf')](handleError(_0x5b9df1,null));};exports[_0x2a85('0x26')]=function(_0x272bea,_0x4b7c64){return respondWithRpcPromise(_0x2a85('0x27'),_0x272bea[_0x2a85('0x18')])[_0x2a85('0xa')](respondWithResult(_0x4b7c64,null))[_0x2a85('0xf')](handleError(_0x4b7c64,null));};exports[_0x2a85('0x28')]=function(_0x19e816,_0x58dd39){return respondWithRpcPromise('OutboundChannels',_0x19e816[_0x2a85('0x18')])[_0x2a85('0xa')](respondWithResult(_0x58dd39,null))['catch'](handleError(_0x58dd39,null));};exports[_0x2a85('0x29')]=function(_0x373842,_0x32bc0b){var _0x1e532a;return respondWithRpcPromise(_0x2a85('0x2a'),_0x373842[_0x2a85('0x18')])[_0x2a85('0xa')](function(_0x5450ce){_0x1e532a=_0x5450ce;return respondWithRpcPromise(_0x2a85('0x2a'),_0x373842['query'],routingClient);})[_0x2a85('0xa')](function(_0x4d42cb){return _['merge']({},_0x4d42cb,_0x1e532a);})[_0x2a85('0xa')](respondWithResult(_0x32bc0b,null))[_0x2a85('0xf')](handleError(_0x32bc0b,null));};exports['agentCapacity']=function(_0x1028ef,_0x350ded){if(_0x1028ef['body']&&_0x1028ef[_0x2a85('0x2b')][_0x2a85('0x2c')]&&_0x1028ef[_0x2a85('0x2d')]&&_0x1028ef[_0x2a85('0x2d')]['name']){for(var _0x4003bc in _0x1028ef[_0x2a85('0x2b')][_0x2a85('0x2c')]){if(_0x1028ef['body'][_0x2a85('0x2c')][_0x2a85('0x2e')](_0x4003bc)){db[_0x2a85('0x2f')][_0x2a85('0x30')]({'where':{'channel':_0x4003bc,'membername':_0x1028ef[_0x2a85('0x2d')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1028ef['body'][_0x2a85('0x2c')][_0x4003bc]&&_0x1028ef[_0x2a85('0x2b')][_0x2a85('0x2c')][_0x4003bc][_0x2a85('0x31')]?{'$notIn':_0x1028ef['body']['interaction'][_0x4003bc]}:{'$ne':null}}})[_0x2a85('0xa')](function(_0x9c8c32){var _0xfadb67=moment()[_0x2a85('0x32')](_0x2a85('0x33'));for(var _0xdf450=0x0,_0x12efbb=_0x9c8c32[_0x2a85('0x31')];_0xdf450<_0x12efbb;_0xdf450+=0x1){_0x9c8c32[_0xdf450][_0x2a85('0x34')]({'exitAt':_0xfadb67});}});for(var _0x248d0=0x0;_0x248d0<_0x1028ef[_0x2a85('0x2b')][_0x2a85('0x2c')][_0x4003bc][_0x2a85('0x31')];_0x248d0+=0x1){db[_0x2a85('0x2f')][_0x2a85('0x35')]({'where':{'channel':_0x4003bc,'membername':_0x1028ef[_0x2a85('0x2d')][_0x2a85('0x14')],'type':_0x2a85('0x36'),'uniqueid':_0x1028ef[_0x2a85('0x2b')][_0x2a85('0x2c')][_0x4003bc][_0x248d0],'exitAt':null},'defaults':{'channel':_0x4003bc,'membername':_0x1028ef[_0x2a85('0x2d')][_0x2a85('0x14')],'interface':_[_0x2a85('0x16')](_0x1028ef[_0x2a85('0x2d')][_0x2a85('0x37')])?util[_0x2a85('0x32')]('SIP/%s',_0x1028ef['user'][_0x2a85('0x14')]):_0x1028ef[_0x2a85('0x2d')][_0x2a85('0x37')],'type':_0x2a85('0x36'),'enterAt':moment()[_0x2a85('0x32')](_0x2a85('0x33')),'role':_0x2a85('0x38'),'internal':_0x1028ef[_0x2a85('0x2d')]['internal'],'uniqueid':_0x1028ef[_0x2a85('0x2b')][_0x2a85('0x2c')][_0x4003bc][_0x248d0]}});}}}}return respondWithRpcPromise(_0x2a85('0x39'),{'id':_0x1028ef['params']['id'],'capacity':_0x1028ef[_0x2a85('0x2b')][_0x2a85('0x3a')]},routingClient)[_0x2a85('0xa')](respondWithResult(_0x350ded,null))[_0x2a85('0xf')](handleError(_0x350ded,null));};exports[_0x2a85('0x3b')]=function(_0x45053f,_0x2ebd8d){return respondWithRpcPromise(_0x2a85('0x3c'),_0x45053f[_0x2a85('0x18')])[_0x2a85('0xa')](respondWithResult(_0x2ebd8d,null))[_0x2a85('0xf')](handleError(_0x2ebd8d,null));};exports[_0x2a85('0x3d')]=function(_0x13fecf,_0x55bc0f){return respondWithRpcPromise('Trunks',_0x13fecf[_0x2a85('0x18')])[_0x2a85('0xa')](respondWithResult(_0x55bc0f,null))[_0x2a85('0xf')](handleError(_0x55bc0f,null));};exports[_0x2a85('0x3e')]=function(_0x167e97,_0x56b831){return respondWithRpcPromise(_0x2a85('0x3f'),_0x167e97[_0x2a85('0x18')])[_0x2a85('0xa')](respondWithResult(_0x56b831,null))[_0x2a85('0xf')](handleError(_0x56b831,null));};exports['chatQueues']=function(_0x4f7ab7,_0x414a27){return respondWithRpcPromise(_0x2a85('0x40'),_0x4f7ab7[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](respondWithResult(_0x414a27,null))[_0x2a85('0xf')](handleError(_0x414a27,null));};exports[_0x2a85('0x41')]=function(_0x18c05b,_0x1c9bed){return respondWithRpcPromise(_0x2a85('0x40'),_0x18c05b[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](findById(_0x18c05b[_0x2a85('0x1b')]['id']))[_0x2a85('0xa')](respondWithResult(_0x1c9bed,null))[_0x2a85('0xf')](handleError(_0x1c9bed,null));};exports[_0x2a85('0x42')]=function(_0x113d57,_0x3a3cee){return respondWithRpcPromise(_0x2a85('0x43'),_0x113d57[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](respondWithResult(_0x3a3cee,null))[_0x2a85('0xf')](handleError(_0x3a3cee,null));};exports['showMailQueues']=function(_0x22caf0,_0x483c4a){return respondWithRpcPromise(_0x2a85('0x43'),_0x22caf0['query'],routingClient)[_0x2a85('0xa')](findById(_0x22caf0[_0x2a85('0x1b')]['id']))[_0x2a85('0xa')](respondWithResult(_0x483c4a,null))[_0x2a85('0xf')](handleError(_0x483c4a,null));};exports[_0x2a85('0x44')]=function(_0x442838,_0x2a0158){return respondWithRpcPromise('MailAccounts',_0x442838[_0x2a85('0x18')],mailClient)[_0x2a85('0xa')](respondWithResult(_0x2a0158,null))[_0x2a85('0xf')](handleError(_0x2a0158,null));};exports[_0x2a85('0x45')]=function(_0x485cde,_0x584597){return respondWithRpcPromise(_0x2a85('0x46'),_0x485cde[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](respondWithResult(_0x584597,null))[_0x2a85('0xf')](handleError(_0x584597,null));};exports[_0x2a85('0x47')]=function(_0x16f467,_0xa11f94){return respondWithRpcPromise(_0x2a85('0x46'),_0x16f467[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](findById(_0x16f467[_0x2a85('0x1b')]['id']))[_0x2a85('0xa')](respondWithResult(_0xa11f94,null))['catch'](handleError(_0xa11f94,null));};exports['smsQueues']=function(_0x481e35,_0x1585f7){return respondWithRpcPromise('SmsQueues',_0x481e35['query'],routingClient)[_0x2a85('0xa')](respondWithResult(_0x1585f7,null))['catch'](handleError(_0x1585f7,null));};exports['showSmsQueues']=function(_0x48c477,_0x14c74c){return respondWithRpcPromise(_0x2a85('0x48'),_0x48c477[_0x2a85('0x18')],routingClient)['then'](findById(_0x48c477[_0x2a85('0x1b')]['id']))['then'](respondWithResult(_0x14c74c,null))[_0x2a85('0xf')](handleError(_0x14c74c,null));};exports[_0x2a85('0x49')]=function(_0x4399e2,_0x948568){return respondWithRpcPromise(_0x2a85('0x4a'),_0x4399e2['query'],routingClient)[_0x2a85('0xa')](respondWithResult(_0x948568,null))[_0x2a85('0xf')](handleError(_0x948568,null));};exports['showWhatsappQueues']=function(_0x10d858,_0x24c2a0){return respondWithRpcPromise('WhatsappQueues',_0x10d858[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](findById(_0x10d858[_0x2a85('0x1b')]['id']))[_0x2a85('0xa')](respondWithResult(_0x24c2a0,null))[_0x2a85('0xf')](handleError(_0x24c2a0,null));};exports[_0x2a85('0x4b')]=function(_0x129e56,_0x1a176e){return respondWithRpcPromise('FaxQueues',_0x129e56[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](respondWithResult(_0x1a176e,null))[_0x2a85('0xf')](handleError(_0x1a176e,null));};exports[_0x2a85('0x4c')]=function(_0x1fdc78,_0x3109ea){return respondWithRpcPromise(_0x2a85('0x4d'),_0x1fdc78['query'],routingClient)['then'](findById(_0x1fdc78[_0x2a85('0x1b')]['id']))[_0x2a85('0xa')](respondWithResult(_0x3109ea,null))['catch'](handleError(_0x3109ea,null));};exports[_0x2a85('0x4e')]=function(_0x46cf0c,_0x55d003){return respondWithRpcPromise(_0x2a85('0x4f'),_0x46cf0c['query'])[_0x2a85('0xa')](respondWithResult(_0x55d003,null))[_0x2a85('0xf')](handleError(_0x55d003,null));};exports[_0x2a85('0x50')]=function(_0x59bcef,_0x365695){return respondWithRpcPromise(_0x2a85('0x51'),_0x59bcef[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](respondWithResult(_0x365695,null))[_0x2a85('0xf')](handleError(_0x365695,null));};exports[_0x2a85('0x52')]=function(_0x176072,_0x1a2e7d){return respondWithRpcPromise(_0x2a85('0x53'),_0x176072[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](respondWithResult(_0x1a2e7d,null))['catch'](handleError(_0x1a2e7d,null));};exports[_0x2a85('0x54')]=function(_0x2a971b,_0x1adb14){return respondWithRpcPromise(_0x2a85('0x55'),_0x2a971b[_0x2a85('0x18')],routingClient)[_0x2a85('0xa')](respondWithResult(_0x1adb14,null))['catch'](handleError(_0x1adb14,null));};exports['smsQueuesWaitingInteractions']=function(_0x51a627,_0x45880f){return respondWithRpcPromise(_0x2a85('0x56'),_0x51a627['query'],routingClient)[_0x2a85('0xa')](respondWithResult(_0x45880f,null))[_0x2a85('0xf')](handleError(_0x45880f,null));};exports[_0x2a85('0x57')]=function(_0x4c52f2,_0x38f4a3){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x4c52f2['query'],routingClient)[_0x2a85('0xa')](respondWithResult(_0x38f4a3,null))['catch'](handleError(_0x38f4a3,null));};exports[_0x2a85('0x58')]=function(_0x4cae66,_0x15fdd8){return respondWithRpcPromise(_0x2a85('0x59'),_0x4cae66['query'],routingClient)[_0x2a85('0xa')](respondWithResult(_0x15fdd8,null))['catch'](handleError(_0x15fdd8,null));};exports[_0x2a85('0x5a')]=function(_0x432777){return function(_0x1d7ea7,_0x15c8f2){var _0xd181ee,_0x18ed95;var _0x13ec39=_[_0x2a85('0x5b')](_0x432777);var _0x50022c=_0x432777==='chat'?'Website':_0x2a85('0x5c');return db[_0x13ec39+_0x2a85('0x5d')][_0x2a85('0x5e')]({'raw':!![],'where':{'id':_0x1d7ea7[_0x2a85('0x1b')]['id']}})[_0x2a85('0xa')](function(_0x5cc680){if(_['isNil'](_0x5cc680)){throw new Error(_0x13ec39+_0x2a85('0x5f'));}_0xd181ee=_0x5cc680;return db[_0x13ec39+_0x2a85('0x60')][_0x2a85('0x5e')]({'where':{'id':_0x1d7ea7[_0x2a85('0x2b')][_0x2a85('0x61')]},'include':[{'model':db[_0x13ec39+'Interaction'],'as':'Interaction'},{'model':db[_0x13ec39+_0x50022c],'as':'Account'}]});})[_0x2a85('0xa')](function(_0xfe008d){if(_['isNil'](_0xfe008d)){throw new Error(_0x13ec39+_0x2a85('0x62'));}_0x18ed95=_0xfe008d;return _0xfe008d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x104fea={'uniqueid':_0x432777+'.'+_0x18ed95['id']+'.'+_0x18ed95[_0x2a85('0x63')]['id'],'FromUserId':_0x1d7ea7[_0x2a85('0x2d')]['id'],'type':_0x2a85('0x64')};_0x104fea[_0x13ec39+_0x2a85('0x65')]=_0x18ed95['id'];_0x104fea[_0x13ec39+'InteractionId']=_0x18ed95[_0x2a85('0x63')]['id'];_0x104fea[_0x2a85('0x66')+_0x13ec39+_0x50022c+'Id']=_0x18ed95['Account']['id'];_0x104fea['To'+_0x13ec39+_0x2a85('0x67')]=_0xd181ee['id'];return db[_0x13ec39+_0x2a85('0x68')][_0x2a85('0x69')](_0x104fea);})[_0x2a85('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x432777,'interaction':_0x18ed95[_0x2a85('0x63')],'message':_0x18ed95,'account':_0x18ed95[_0x2a85('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2a85('0x64'),'appdata':_0xd181ee['name']+','+(_0x18ed95[_0x2a85('0x5c')][_0x2a85('0x6a')]||0x12c),'interval':_0x2a85('0x6b')}]},routingClient);})[_0x2a85('0xa')](respondWithResult(_0x15c8f2,null))[_0x2a85('0xf')](handleError(_0x15c8f2,null));};};exports[_0x2a85('0x6c')]=function(_0x239292,_0x251db1){var _0x129f04,_0x99199e;if(_[_0x2a85('0x16')](_0x239292[_0x2a85('0x2b')][_0x2a85('0x6d')])){throw new Error(_0x2a85('0x6e'));}var _0x4f44f5=_0x239292[_0x2a85('0x2b')][_0x2a85('0x6d')];var _0x2ef08d=_[_0x2a85('0x5b')](_0x4f44f5);var _0x2f4c84=_0x4f44f5===_0x2a85('0x6f')?_0x2a85('0x70'):_0x2a85('0x5c');return db[_0x2a85('0x71')][_0x2a85('0x5e')]({'raw':!![],'where':{'id':_0x239292[_0x2a85('0x1b')]['id'],'role':'agent'}})[_0x2a85('0xa')](function(_0xab343e){if(_[_0x2a85('0x16')](_0xab343e)){throw new Error(_0x2a85('0x72'));}_0x129f04=_0xab343e;return db[_0x2ef08d+_0x2a85('0x60')]['findOne']({'where':{'id':_0x239292['body'][_0x2a85('0x61')]},'include':[{'model':db[_0x2ef08d+_0x2a85('0x63')],'as':'Interaction'},{'model':db[_0x2ef08d+_0x2f4c84],'as':_0x2a85('0x5c')}]});})[_0x2a85('0xa')](function(_0x23f549){if(_[_0x2a85('0x16')](_0x23f549)){throw new Error(_0x2ef08d+_0x2a85('0x62'));}_0x99199e=_0x23f549;return _0x23f549[_0x2a85('0x73')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2a85('0xa')](function(){var _0x554335={'uniqueid':_0x4f44f5+'.'+_0x99199e['id']+'.'+_0x99199e[_0x2a85('0x63')]['id'],'FromUserId':_0x239292['user']['id'],'type':_0x2a85('0x64'),'ToUserId':_0x129f04['id']};_0x554335[_0x2ef08d+_0x2a85('0x65')]=_0x99199e['id'];_0x554335[_0x2ef08d+_0x2a85('0x74')]=_0x99199e[_0x2a85('0x63')]['id'];_0x554335[_0x2a85('0x66')+_0x2ef08d+_0x2f4c84+'Id']=_0x99199e[_0x2a85('0x5c')]['id'];return db[_0x2ef08d+_0x2a85('0x68')][_0x2a85('0x69')](_0x554335);})[_0x2a85('0xa')](function(){return respondWithRpcPromise(_0x2a85('0x75'),{'channel':_0x4f44f5,'interaction':_0x99199e['Interaction'],'message':_0x99199e,'account':_0x99199e[_0x2a85('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2a85('0x38'),'appdata':_0x129f04['name']+','+(_0x99199e['Account']['agentTransferTimeout']||0x12c),'interval':_0x2a85('0x6b')}]},routingClient);})[_0x2a85('0xa')](respondWithResult(_0x251db1,null))[_0x2a85('0xf')](handleError(_0x251db1,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 7a0327e..d00e974 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 _0x756e=['../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','put','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x756e,0x79));var _0xe756=function(_0x3a75a8,_0x30422d){_0x3a75a8=_0x3a75a8-0x0;var _0x497912=_0x756e[_0x3a75a8];return _0x497912;};'use strict';var multer=require('multer');var util=require(_0xe756('0x0'));var path=require(_0xe756('0x1'));var timeout=require(_0xe756('0x2'));var express=require(_0xe756('0x3'));var router=express['Router']();var auth=require(_0xe756('0x4'));var interaction=require(_0xe756('0x5'));var config=require(_0xe756('0x6'));var controller=require(_0xe756('0x7'));router[_0xe756('0x8')]('/',auth[_0xe756('0x9')](),controller[_0xe756('0xa')]);router['get'](_0xe756('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe756('0xc'),auth[_0xe756('0x9')](),controller[_0xe756('0xd')]);router['post']('/',auth[_0xe756('0x9')](),controller['create']);router[_0xe756('0xe')](_0xe756('0xb'),auth[_0xe756('0x9')](),controller[_0xe756('0xf')]);router['delete'](_0xe756('0xb'),auth[_0xe756('0x9')](),controller[_0xe756('0x10')]);module[_0xe756('0x11')]=router; \ No newline at end of file +var _0x54eb=['/:id','create','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','isAuthenticated','index','get'];(function(_0x80b6a,_0x1b138c){var _0x58de9b=function(_0x1973ae){while(--_0x1973ae){_0x80b6a['push'](_0x80b6a['shift']());}};_0x58de9b(++_0x1b138c);}(_0x54eb,0xe4));var _0xb54e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x54eb[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0xb54e('0x0'));var path=require(_0xb54e('0x1'));var timeout=require('connect-timeout');var express=require(_0xb54e('0x2'));var router=express[_0xb54e('0x3')]();var auth=require(_0xb54e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb54e('0x5'));var controller=require(_0xb54e('0x6'));router['get']('/',auth[_0xb54e('0x7')](),controller[_0xb54e('0x8')]);router[_0xb54e('0x9')](_0xb54e('0xa'),auth[_0xb54e('0x7')](),controller['show']);router[_0xb54e('0x9')]('/:id/run',auth[_0xb54e('0x7')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller[_0xb54e('0xb')]);router['put']('/:id',auth[_0xb54e('0x7')](),controller['update']);router['delete']('/:id',auth[_0xb54e('0x7')](),controller[_0xb54e('0xc')]);module[_0xb54e('0xd')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 994f622..bfd9bfe 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 _0x1696=['INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1696,0x79));var _0x6169=function(_0x43b4a7,_0x5316be){_0x43b4a7=_0x43b4a7-0x0;var _0x4a5f01=_0x1696[_0x43b4a7];return _0x4a5f01;};'use strict';var Sequelize=require(_0x6169('0x0'));module['exports']={'name':{'type':Sequelize[_0x6169('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6169('0x1')]},'active':{'type':Sequelize[_0x6169('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6169('0x1')],'allowNull':![],'defaultValue':_0x6169('0x3')},'startAt':{'type':Sequelize[_0x6169('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x6169('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6169('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6169('0x6')]('years',_0x6169('0x7'),_0x6169('0x8'),_0x6169('0x9'),_0x6169('0xa'),_0x6169('0xb'),_0x6169('0xc')),'allowNull':![],'defaultValue':_0x6169('0xa')},'output':{'type':Sequelize['ENUM'](_0x6169('0xd'),'pdf',_0x6169('0xe')),'allowNull':![],'defaultValue':_0x6169('0xd')},'type':{'type':Sequelize['ENUM'](_0x6169('0xf'),_0x6169('0x10')),'allowNull':![],'defaultValue':_0x6169('0xf')},'sendMail':{'type':Sequelize[_0x6169('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x6169('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x6169('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf8af=['pdf','xlsx','custom','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','months','days','hours','minutes','csv'];(function(_0x24538e,_0x43c6d8){var _0x3fcdcb=function(_0x2493ba){while(--_0x2493ba){_0x24538e['push'](_0x24538e['shift']());}};_0x3fcdcb(++_0x43c6d8);}(_0xf8af,0x8b));var _0xff8a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf8af[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xff8a('0x0'));module['exports']={'name':{'type':Sequelize[_0xff8a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xff8a('0x1')]},'active':{'type':Sequelize[_0xff8a('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xff8a('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xff8a('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xff8a('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xff8a('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xff8a('0x5')]('years','quarters',_0xff8a('0x6'),'weeks',_0xff8a('0x7'),_0xff8a('0x8'),_0xff8a('0x9')),'allowNull':![],'defaultValue':_0xff8a('0x7')},'output':{'type':Sequelize[_0xff8a('0x5')](_0xff8a('0xa'),_0xff8a('0xb'),_0xff8a('0xc')),'allowNull':![],'defaultValue':_0xff8a('0xa')},'type':{'type':Sequelize[_0xff8a('0x5')](_0xff8a('0xd'),'default'),'allowNull':![],'defaultValue':_0xff8a('0xd')},'sendMail':{'type':Sequelize[_0xff8a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xff8a('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xff8a('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xff8a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b1832b1..db0c82e 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 _0x6fcd=['util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','map','filter','merge','options','includeAll','findAll','params','include','find','catch','create','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x6fcd,0x1e0));var _0xd6fc=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x6fcd[_0x46698a];return _0x356db0;};'use strict';var pdf=require(_0xd6fc('0x0'));var emlformat=require(_0xd6fc('0x1'));var rimraf=require(_0xd6fc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd6fc('0x3'));var moment=require('moment');var BPromise=require(_0xd6fc('0x4'));var Mustache=require(_0xd6fc('0x5'));var util=require(_0xd6fc('0x6'));var path=require(_0xd6fc('0x7'));var sox=require('sox');var csv=require(_0xd6fc('0x8'));var ejs=require(_0xd6fc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd6fc('0xa'));var crypto=require(_0xd6fc('0xb'));var jsforce=require(_0xd6fc('0xc'));var deskjs=require(_0xd6fc('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd6fc('0xe'));var Papa=require(_0xd6fc('0xf'));var Redis=require(_0xd6fc('0x10'));var authService=require(_0xd6fc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6fc('0x12'));var logger=require(_0xd6fc('0x13'))('api');var utils=require(_0xd6fc('0x14'));var config=require(_0xd6fc('0x15'));var db=require(_0xd6fc('0x16'))['db'];function respondWithStatusCode(_0x4dcdf1,_0x501baf){_0x501baf=_0x501baf||0xcc;return function(_0x45ccd1){if(_0x45ccd1){return _0x4dcdf1['sendStatus'](_0x501baf);}return _0x4dcdf1[_0xd6fc('0x17')](_0x501baf)[_0xd6fc('0x18')]();};}function respondWithResult(_0x29393b,_0x7a15e1){_0x7a15e1=_0x7a15e1||0xc8;return function(_0x1e9c38){if(_0x1e9c38){return _0x29393b[_0xd6fc('0x17')](_0x7a15e1)[_0xd6fc('0x19')](_0x1e9c38);}};}function respondWithFilteredResult(_0x477e7f,_0x5c2cfb){return function(_0x43f467){if(_0x43f467){var _0x5080b0=_0x43f467[_0xd6fc('0x1a')],_0x5c6c57=_0x5c2cfb['offset'],_0x1ff449=_0x5c2cfb['offset']+_0x5c2cfb[_0xd6fc('0x1b')],_0x4ab9c0;if(_0x1ff449>=_0x5080b0){_0x1ff449=_0x5080b0;_0x4ab9c0=0xc8;}else{_0x4ab9c0=0xce;}_0x477e7f['status'](_0x4ab9c0);return _0x477e7f[_0xd6fc('0x1c')](_0xd6fc('0x1d'),_0x5c6c57+'-'+_0x1ff449+'/'+_0x5080b0)[_0xd6fc('0x19')](_0x43f467);}return null;};}function patchUpdates(_0x1a8f85){return function(_0x112518){try{jsonpatch[_0xd6fc('0x1e')](_0x112518,_0x1a8f85,!![]);}catch(_0x31f191){return BPromise[_0xd6fc('0x1f')](_0x31f191);}return _0x112518[_0xd6fc('0x20')]();};}function saveUpdates(_0x16626f,_0x48c263){return function(_0x27d36b){if(_0x27d36b){return _0x27d36b[_0xd6fc('0x21')](_0x16626f)[_0xd6fc('0x22')](function(_0x28ac56){return _0x28ac56;});}return null;};}function removeEntity(_0x14e96f,_0x30d303){return function(_0x2ad90f){if(_0x2ad90f){return _0x2ad90f[_0xd6fc('0x23')]()['then'](function(){var _0x485e55=_0x2ad90f[_0xd6fc('0x24')]({'plain':!![]});var _0x204866=_0xd6fc('0x25');return db[_0xd6fc('0x26')][_0xd6fc('0x23')]({'where':{'type':_0x204866,'resourceId':_0x485e55['id']}})[_0xd6fc('0x22')](function(){return _0x2ad90f;});})['then'](function(){_0x14e96f[_0xd6fc('0x17')](0xcc)[_0xd6fc('0x18')]();});}};}function handleEntityNotFound(_0x88c3d9,_0x4f013b){return function(_0x2d456b){if(!_0x2d456b){_0x88c3d9[_0xd6fc('0x27')](0x194);}return _0x2d456b;};}function handleError(_0x54e825,_0xb5235f){_0xb5235f=_0xb5235f||0x1f4;return function(_0x3099eb){logger[_0xd6fc('0x28')](_0x3099eb[_0xd6fc('0x29')]);if(_0x3099eb[_0xd6fc('0x2a')]){delete _0x3099eb['name'];}_0x54e825['status'](_0xb5235f)[_0xd6fc('0x2b')](_0x3099eb);};}exports[_0xd6fc('0x2c')]=function(_0x5e019e,_0x2e3507){var _0x5cecae={},_0x28fc2f={},_0x4978ef={'count':0x0,'rows':[]};var _0x34f4ce=_['map'](db[_0xd6fc('0x2d')][_0xd6fc('0x2e')],function(_0x307626){return{'name':_0x307626[_0xd6fc('0x2f')],'type':_0x307626[_0xd6fc('0x30')][_0xd6fc('0x31')]};});_0x28fc2f[_0xd6fc('0x32')]=_['map'](_0x34f4ce,_0xd6fc('0x2a'));_0x28fc2f['query']=_[_0xd6fc('0x33')](_0x5e019e[_0xd6fc('0x34')]);_0x28fc2f[_0xd6fc('0x35')]=_[_0xd6fc('0x36')](_0x28fc2f['model'],_0x28fc2f[_0xd6fc('0x34')]);_0x5cecae[_0xd6fc('0x37')]=_['intersection'](_0x28fc2f[_0xd6fc('0x32')],qs[_0xd6fc('0x38')](_0x5e019e[_0xd6fc('0x34')][_0xd6fc('0x38')]));_0x5cecae[_0xd6fc('0x37')]=_0x5cecae['attributes'][_0xd6fc('0x39')]?_0x5cecae[_0xd6fc('0x37')]:_0x28fc2f[_0xd6fc('0x32')];if(!_0x5e019e['query'][_0xd6fc('0x3a')](_0xd6fc('0x3b'))){_0x5cecae[_0xd6fc('0x1b')]=qs[_0xd6fc('0x1b')](_0x5e019e[_0xd6fc('0x34')]['limit']);_0x5cecae[_0xd6fc('0x3c')]=qs[_0xd6fc('0x3c')](_0x5e019e['query'][_0xd6fc('0x3c')]);}_0x5cecae[_0xd6fc('0x3d')]=qs[_0xd6fc('0x3e')](_0x5e019e['query'][_0xd6fc('0x3e')]);_0x5cecae['where']=qs['filters'](_[_0xd6fc('0x3f')](_0x5e019e[_0xd6fc('0x34')],_0x28fc2f[_0xd6fc('0x35')]),_0x34f4ce);if(_0x5e019e[_0xd6fc('0x34')]['filter']){_0x5cecae[_0xd6fc('0x40')]=_['merge'](_0x5cecae[_0xd6fc('0x40')],{'$or':_[_0xd6fc('0x41')](_0x34f4ce,function(_0x22c15f){if(_0x22c15f[_0xd6fc('0x30')]!=='VIRTUAL'){var _0x4c684b={};_0x4c684b[_0x22c15f[_0xd6fc('0x2a')]]={'$like':'%'+_0x5e019e[_0xd6fc('0x34')][_0xd6fc('0x42')]+'%'};return _0x4c684b;}})});}_0x5cecae=_[_0xd6fc('0x43')]({},_0x5cecae,_0x5e019e[_0xd6fc('0x44')]);var _0x5891bd={'where':_0x5cecae[_0xd6fc('0x40')]};return db['Schedule'][_0xd6fc('0x1a')](_0x5891bd)[_0xd6fc('0x22')](function(_0x4fe408){_0x4978ef[_0xd6fc('0x1a')]=_0x4fe408;if(_0x5e019e[_0xd6fc('0x34')][_0xd6fc('0x45')]){_0x5cecae['include']=[{'all':!![]}];}return db['Schedule'][_0xd6fc('0x46')](_0x5cecae);})[_0xd6fc('0x22')](function(_0x558674){_0x4978ef['rows']=_0x558674;return _0x4978ef;})[_0xd6fc('0x22')](respondWithFilteredResult(_0x2e3507,_0x5cecae))['catch'](handleError(_0x2e3507,null));};exports['show']=function(_0x3f819a,_0x37fede){var _0x32c46e={'raw':![],'where':{'id':_0x3f819a[_0xd6fc('0x47')]['id']}},_0x154af9={};_0x154af9['model']=_[_0xd6fc('0x33')](db['Schedule']['rawAttributes']);_0x154af9['query']=_['keys'](_0x3f819a[_0xd6fc('0x34')]);_0x154af9[_0xd6fc('0x35')]=_['intersection'](_0x154af9[_0xd6fc('0x32')],_0x154af9[_0xd6fc('0x34')]);_0x32c46e[_0xd6fc('0x37')]=_[_0xd6fc('0x36')](_0x154af9[_0xd6fc('0x32')],qs[_0xd6fc('0x38')](_0x3f819a[_0xd6fc('0x34')][_0xd6fc('0x38')]));_0x32c46e['attributes']=_0x32c46e[_0xd6fc('0x37')][_0xd6fc('0x39')]?_0x32c46e[_0xd6fc('0x37')]:_0x154af9[_0xd6fc('0x32')];if(_0x3f819a['query'][_0xd6fc('0x45')]){_0x32c46e[_0xd6fc('0x48')]=[{'all':!![]}];}_0x32c46e=_[_0xd6fc('0x43')]({},_0x32c46e,_0x3f819a['options']);return db[_0xd6fc('0x2d')][_0xd6fc('0x49')](_0x32c46e)['then'](handleEntityNotFound(_0x37fede,null))[_0xd6fc('0x22')](respondWithResult(_0x37fede,null))[_0xd6fc('0x4a')](handleError(_0x37fede,null));};exports[_0xd6fc('0x4b')]=function(_0x1b7639,_0x587520){return db[_0xd6fc('0x2d')][_0xd6fc('0x4b')](_0x1b7639['body'],{})[_0xd6fc('0x22')](function(_0x5b934a){var _0x2bd454=_0x1b7639['user'][_0xd6fc('0x24')]({'plain':!![]});if(!_0x2bd454)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bd454['role']==='user'){var _0x5ed748=_0x5b934a[_0xd6fc('0x24')]({'plain':!![]});var _0x3439b7=_0xd6fc('0x25');return db['UserProfileSection'][_0xd6fc('0x49')]({'where':{'name':_0x3439b7,'userProfileId':_0x2bd454[_0xd6fc('0x4c')]},'raw':!![]})[_0xd6fc('0x22')](function(_0x2bdd5){if(_0x2bdd5&&_0x2bdd5[_0xd6fc('0x4d')]===0x0){return db[_0xd6fc('0x26')]['create']({'name':_0x5ed748[_0xd6fc('0x2a')],'resourceId':_0x5ed748['id'],'type':_0x2bdd5['name'],'sectionId':_0x2bdd5['id']},{})[_0xd6fc('0x22')](function(){return _0x5b934a;});}else{return _0x5b934a;}})[_0xd6fc('0x4a')](function(_0x37cbb4){logger[_0xd6fc('0x28')](_0xd6fc('0x4e'),_0x37cbb4);throw _0x37cbb4;});}return _0x5b934a;})[_0xd6fc('0x22')](respondWithResult(_0x587520,0xc9))['catch'](handleError(_0x587520,null));};exports[_0xd6fc('0x21')]=function(_0x39b675,_0x516146){if(_0x39b675[_0xd6fc('0x4f')]['id']){delete _0x39b675[_0xd6fc('0x4f')]['id'];}return db[_0xd6fc('0x2d')][_0xd6fc('0x49')]({'where':{'id':_0x39b675[_0xd6fc('0x47')]['id']}})[_0xd6fc('0x22')](handleEntityNotFound(_0x516146,null))['then'](saveUpdates(_0x39b675['body'],null))[_0xd6fc('0x22')](respondWithResult(_0x516146,null))[_0xd6fc('0x4a')](handleError(_0x516146,null));};exports[_0xd6fc('0x23')]=function(_0x53db10,_0x50a1e8){return db['Schedule'][_0xd6fc('0x49')]({'where':{'id':_0x53db10[_0xd6fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x50a1e8,null))[_0xd6fc('0x22')](removeEntity(_0x50a1e8,null))[_0xd6fc('0x4a')](handleError(_0x50a1e8,null));};exports[_0xd6fc('0x50')]=function(_0x1701f3,_0x26bca7,_0x3ed3a8){var _0x714ab5=require('../../config/schedule');return db['Schedule'][_0xd6fc('0x49')]({'where':{'id':_0x1701f3['params']['id']},'raw':!![]})[_0xd6fc('0x22')](handleEntityNotFound(_0x26bca7,null))[_0xd6fc('0x22')](function(){_0x714ab5[_0xd6fc('0x50')](_0x1701f3['params']['id']);})[_0xd6fc('0x22')](respondWithStatusCode(_0x26bca7,null))[_0xd6fc('0x4a')](handleError(_0x26bca7,null));}; \ No newline at end of file +var _0x55da=['merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','squel','desk.js','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','apply','reject','save','update','then','get','Scheduler','UserProfileResource','sendStatus','stack','name','send','index','map','Schedule','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','includeAll','findAll','rows','catch','params','rawAttributes','include'];(function(_0x335325,_0x1c7e01){var _0x31ff32=function(_0x306f9d){while(--_0x306f9d){_0x335325['push'](_0x335325['shift']());}};_0x31ff32(++_0x1c7e01);}(_0x55da,0x101));var _0xa55d=function(_0x3db1c7,_0x31bbd9){_0x3db1c7=_0x3db1c7-0x0;var _0x189086=_0x55da[_0x3db1c7];return _0x189086;};'use strict';var pdf=require(_0xa55d('0x0'));var emlformat=require(_0xa55d('0x1'));var rimraf=require(_0xa55d('0x2'));var zipdir=require(_0xa55d('0x3'));var jsonpatch=require(_0xa55d('0x4'));var rp=require(_0xa55d('0x5'));var moment=require(_0xa55d('0x6'));var BPromise=require(_0xa55d('0x7'));var Mustache=require(_0xa55d('0x8'));var util=require('util');var path=require('path');var sox=require(_0xa55d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa55d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa55d('0xb'));var toCsv=require(_0xa55d('0xc'));var querystring=require(_0xa55d('0xd'));var Papa=require(_0xa55d('0xe'));var Redis=require(_0xa55d('0xf'));var authService=require(_0xa55d('0x10'));var qs=require(_0xa55d('0x11'));var as=require(_0xa55d('0x12'));var hardwareService=require(_0xa55d('0x13'));var logger=require('../../config/logger')(_0xa55d('0x14'));var utils=require(_0xa55d('0x15'));var config=require(_0xa55d('0x16'));var db=require(_0xa55d('0x17'))['db'];function respondWithStatusCode(_0x321437,_0x462b87){_0x462b87=_0x462b87||0xcc;return function(_0x27cda7){if(_0x27cda7){return _0x321437['sendStatus'](_0x462b87);}return _0x321437[_0xa55d('0x18')](_0x462b87)[_0xa55d('0x19')]();};}function respondWithResult(_0x9b11dd,_0x4f4339){_0x4f4339=_0x4f4339||0xc8;return function(_0x2c60e7){if(_0x2c60e7){return _0x9b11dd['status'](_0x4f4339)[_0xa55d('0x1a')](_0x2c60e7);}};}function respondWithFilteredResult(_0x153d60,_0x45334d){return function(_0x80038a){if(_0x80038a){var _0x3ea25e=_0x80038a[_0xa55d('0x1b')],_0x1ece72=_0x45334d[_0xa55d('0x1c')],_0x118daf=_0x45334d['offset']+_0x45334d[_0xa55d('0x1d')],_0x1712dc;if(_0x118daf>=_0x3ea25e){_0x118daf=_0x3ea25e;_0x1712dc=0xc8;}else{_0x1712dc=0xce;}_0x153d60['status'](_0x1712dc);return _0x153d60['set']('Content-Range',_0x1ece72+'-'+_0x118daf+'/'+_0x3ea25e)[_0xa55d('0x1a')](_0x80038a);}return null;};}function patchUpdates(_0x34707c){return function(_0x4dcd9e){try{jsonpatch[_0xa55d('0x1e')](_0x4dcd9e,_0x34707c,!![]);}catch(_0x3b7935){return BPromise[_0xa55d('0x1f')](_0x3b7935);}return _0x4dcd9e[_0xa55d('0x20')]();};}function saveUpdates(_0x47fae9,_0x22e16b){return function(_0x1c921e){if(_0x1c921e){return _0x1c921e[_0xa55d('0x21')](_0x47fae9)['then'](function(_0x5f2b2f){return _0x5f2b2f;});}return null;};}function removeEntity(_0x502a64,_0x347345){return function(_0x2b71e5){if(_0x2b71e5){return _0x2b71e5['destroy']()[_0xa55d('0x22')](function(){var _0x5f5da2=_0x2b71e5[_0xa55d('0x23')]({'plain':!![]});var _0x597453=_0xa55d('0x24');return db[_0xa55d('0x25')]['destroy']({'where':{'type':_0x597453,'resourceId':_0x5f5da2['id']}})['then'](function(){return _0x2b71e5;});})[_0xa55d('0x22')](function(){_0x502a64[_0xa55d('0x18')](0xcc)[_0xa55d('0x19')]();});}};}function handleEntityNotFound(_0x4b813f,_0x113354){return function(_0x585569){if(!_0x585569){_0x4b813f[_0xa55d('0x26')](0x194);}return _0x585569;};}function handleError(_0x57fff5,_0x3aac8c){_0x3aac8c=_0x3aac8c||0x1f4;return function(_0x1c3c35){logger['error'](_0x1c3c35[_0xa55d('0x27')]);if(_0x1c3c35[_0xa55d('0x28')]){delete _0x1c3c35[_0xa55d('0x28')];}_0x57fff5['status'](_0x3aac8c)[_0xa55d('0x29')](_0x1c3c35);};}exports[_0xa55d('0x2a')]=function(_0x29a1a8,_0x42e555){var _0x3dc1de={},_0x1949f2={},_0x114ad8={'count':0x0,'rows':[]};var _0x2448c5=_[_0xa55d('0x2b')](db[_0xa55d('0x2c')]['rawAttributes'],function(_0x568ffc){return{'name':_0x568ffc['fieldName'],'type':_0x568ffc[_0xa55d('0x2d')][_0xa55d('0x2e')]};});_0x1949f2[_0xa55d('0x2f')]=_[_0xa55d('0x2b')](_0x2448c5,_0xa55d('0x28'));_0x1949f2[_0xa55d('0x30')]=_[_0xa55d('0x31')](_0x29a1a8[_0xa55d('0x30')]);_0x1949f2[_0xa55d('0x32')]=_[_0xa55d('0x33')](_0x1949f2[_0xa55d('0x2f')],_0x1949f2[_0xa55d('0x30')]);_0x3dc1de[_0xa55d('0x34')]=_[_0xa55d('0x33')](_0x1949f2[_0xa55d('0x2f')],qs[_0xa55d('0x35')](_0x29a1a8[_0xa55d('0x30')][_0xa55d('0x35')]));_0x3dc1de[_0xa55d('0x34')]=_0x3dc1de[_0xa55d('0x34')][_0xa55d('0x36')]?_0x3dc1de['attributes']:_0x1949f2[_0xa55d('0x2f')];if(!_0x29a1a8[_0xa55d('0x30')]['hasOwnProperty'](_0xa55d('0x37'))){_0x3dc1de[_0xa55d('0x1d')]=qs[_0xa55d('0x1d')](_0x29a1a8['query'][_0xa55d('0x1d')]);_0x3dc1de[_0xa55d('0x1c')]=qs['offset'](_0x29a1a8['query']['offset']);}_0x3dc1de[_0xa55d('0x38')]=qs[_0xa55d('0x39')](_0x29a1a8['query'][_0xa55d('0x39')]);_0x3dc1de[_0xa55d('0x3a')]=qs[_0xa55d('0x32')](_['pick'](_0x29a1a8[_0xa55d('0x30')],_0x1949f2[_0xa55d('0x32')]),_0x2448c5);if(_0x29a1a8[_0xa55d('0x30')]['filter']){_0x3dc1de['where']=_['merge'](_0x3dc1de[_0xa55d('0x3a')],{'$or':_[_0xa55d('0x2b')](_0x2448c5,function(_0x1f6126){if(_0x1f6126[_0xa55d('0x2d')]!==_0xa55d('0x3b')){var _0x1b011e={};_0x1b011e[_0x1f6126[_0xa55d('0x28')]]={'$like':'%'+_0x29a1a8[_0xa55d('0x30')]['filter']+'%'};return _0x1b011e;}})});}_0x3dc1de=_['merge']({},_0x3dc1de,_0x29a1a8['options']);var _0x4e5833={'where':_0x3dc1de['where']};return db[_0xa55d('0x2c')]['count'](_0x4e5833)[_0xa55d('0x22')](function(_0x2e61c1){_0x114ad8[_0xa55d('0x1b')]=_0x2e61c1;if(_0x29a1a8[_0xa55d('0x30')][_0xa55d('0x3c')]){_0x3dc1de['include']=[{'all':!![]}];}return db[_0xa55d('0x2c')][_0xa55d('0x3d')](_0x3dc1de);})['then'](function(_0xc637d1){_0x114ad8[_0xa55d('0x3e')]=_0xc637d1;return _0x114ad8;})[_0xa55d('0x22')](respondWithFilteredResult(_0x42e555,_0x3dc1de))[_0xa55d('0x3f')](handleError(_0x42e555,null));};exports['show']=function(_0x45089d,_0x15b26c){var _0x50ccf8={'raw':![],'where':{'id':_0x45089d[_0xa55d('0x40')]['id']}},_0x46250e={};_0x46250e['model']=_['keys'](db[_0xa55d('0x2c')][_0xa55d('0x41')]);_0x46250e[_0xa55d('0x30')]=_[_0xa55d('0x31')](_0x45089d[_0xa55d('0x30')]);_0x46250e[_0xa55d('0x32')]=_[_0xa55d('0x33')](_0x46250e[_0xa55d('0x2f')],_0x46250e[_0xa55d('0x30')]);_0x50ccf8[_0xa55d('0x34')]=_[_0xa55d('0x33')](_0x46250e['model'],qs['fields'](_0x45089d[_0xa55d('0x30')]['fields']));_0x50ccf8[_0xa55d('0x34')]=_0x50ccf8[_0xa55d('0x34')][_0xa55d('0x36')]?_0x50ccf8[_0xa55d('0x34')]:_0x46250e['model'];if(_0x45089d[_0xa55d('0x30')][_0xa55d('0x3c')]){_0x50ccf8[_0xa55d('0x42')]=[{'all':!![]}];}_0x50ccf8=_[_0xa55d('0x43')]({},_0x50ccf8,_0x45089d[_0xa55d('0x44')]);return db[_0xa55d('0x2c')][_0xa55d('0x45')](_0x50ccf8)[_0xa55d('0x22')](handleEntityNotFound(_0x15b26c,null))[_0xa55d('0x22')](respondWithResult(_0x15b26c,null))['catch'](handleError(_0x15b26c,null));};exports[_0xa55d('0x46')]=function(_0x160507,_0xd234ad){return db[_0xa55d('0x2c')]['create'](_0x160507[_0xa55d('0x47')],{})[_0xa55d('0x22')](function(_0x4ef45a){var _0x2ba85b=_0x160507[_0xa55d('0x48')][_0xa55d('0x23')]({'plain':!![]});if(!_0x2ba85b)throw new Error(_0xa55d('0x49'));if(_0x2ba85b['role']==='user'){var _0x36e81d=_0x4ef45a[_0xa55d('0x23')]({'plain':!![]});var _0x12c429=_0xa55d('0x24');return db[_0xa55d('0x4a')][_0xa55d('0x45')]({'where':{'name':_0x12c429,'userProfileId':_0x2ba85b[_0xa55d('0x4b')]},'raw':!![]})[_0xa55d('0x22')](function(_0x885b25){if(_0x885b25&&_0x885b25[_0xa55d('0x4c')]===0x0){return db['UserProfileResource'][_0xa55d('0x46')]({'name':_0x36e81d[_0xa55d('0x28')],'resourceId':_0x36e81d['id'],'type':_0x885b25[_0xa55d('0x28')],'sectionId':_0x885b25['id']},{})[_0xa55d('0x22')](function(){return _0x4ef45a;});}else{return _0x4ef45a;}})[_0xa55d('0x3f')](function(_0x2cfa38){logger[_0xa55d('0x4d')](_0xa55d('0x4e'),_0x2cfa38);throw _0x2cfa38;});}return _0x4ef45a;})[_0xa55d('0x22')](respondWithResult(_0xd234ad,0xc9))[_0xa55d('0x3f')](handleError(_0xd234ad,null));};exports[_0xa55d('0x21')]=function(_0xc592b8,_0x27318f){if(_0xc592b8['body']['id']){delete _0xc592b8[_0xa55d('0x47')]['id'];}return db['Schedule'][_0xa55d('0x45')]({'where':{'id':_0xc592b8[_0xa55d('0x40')]['id']}})[_0xa55d('0x22')](handleEntityNotFound(_0x27318f,null))[_0xa55d('0x22')](saveUpdates(_0xc592b8[_0xa55d('0x47')],null))[_0xa55d('0x22')](respondWithResult(_0x27318f,null))[_0xa55d('0x3f')](handleError(_0x27318f,null));};exports[_0xa55d('0x4f')]=function(_0x9fa6e8,_0x331df0){return db[_0xa55d('0x2c')][_0xa55d('0x45')]({'where':{'id':_0x9fa6e8['params']['id']}})[_0xa55d('0x22')](handleEntityNotFound(_0x331df0,null))['then'](removeEntity(_0x331df0,null))[_0xa55d('0x3f')](handleError(_0x331df0,null));};exports['run']=function(_0x2783be,_0x261a8e,_0x3897ec){var _0x51074b=require('../../config/schedule');return db[_0xa55d('0x2c')][_0xa55d('0x45')]({'where':{'id':_0x2783be[_0xa55d('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x261a8e,null))[_0xa55d('0x22')](function(){_0x51074b[_0xa55d('0x50')](_0x2783be[_0xa55d('0x40')]['id']);})['then'](respondWithStatusCode(_0x261a8e,null))[_0xa55d('0x3f')](handleError(_0x261a8e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 8706949..7ec3982 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 _0x7599=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash'];(function(_0x452139,_0x4bdd9e){var _0x13abcb=function(_0x31a75c){while(--_0x31a75c){_0x452139['push'](_0x452139['shift']());}};_0x13abcb(++_0x4bdd9e);}(_0x7599,0xfb));var _0x9759=function(_0xbe200a,_0x28adcb){_0xbe200a=_0xbe200a-0x0;var _0x27a4e7=_0x7599[_0xbe200a];return _0x27a4e7;};'use strict';var _=require(_0x9759('0x0'));var util=require('util');var logger=require(_0x9759('0x1'))(_0x9759('0x2'));var moment=require(_0x9759('0x3'));var BPromise=require(_0x9759('0x4'));var rp=require(_0x9759('0x5'));var fs=require('fs');var path=require(_0x9759('0x6'));var rimraf=require(_0x9759('0x7'));var config=require(_0x9759('0x8'));var attributes=require(_0x9759('0x9'));module[_0x9759('0xa')]=function(_0x384372,_0x40ca85){return _0x384372[_0x9759('0xb')](_0x9759('0xc'),attributes,{'tableName':_0x9759('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e6a=['tools_schedules','util','api','bluebird','path','rimraf','./schedule.attributes','Schedule'];(function(_0x53f46d,_0x418b02){var _0x441fe8=function(_0xe5ae50){while(--_0xe5ae50){_0x53f46d['push'](_0x53f46d['shift']());}};_0x441fe8(++_0x418b02);}(_0x7e6a,0x89));var _0xa7e6=function(_0x39f03b,_0x368ae5){_0x39f03b=_0x39f03b-0x0;var _0xe7fa36=_0x7e6a[_0x39f03b];return _0xe7fa36;};'use strict';var _=require('lodash');var util=require(_0xa7e6('0x0'));var logger=require('../../config/logger')(_0xa7e6('0x1'));var moment=require('moment');var BPromise=require(_0xa7e6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7e6('0x3'));var rimraf=require(_0xa7e6('0x4'));var config=require('../../config/environment');var attributes=require(_0xa7e6('0x5'));module['exports']=function(_0x4da55c,_0x1aee56){return _0x4da55c['define'](_0xa7e6('0x6'),attributes,{'tableName':_0xa7e6('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 f1895fa..25dc655 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 _0xa2b6=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x373913,_0x4f0099){var _0x4313d9=function(_0x349b47){while(--_0x349b47){_0x373913['push'](_0x373913['shift']());}};_0x4313d9(++_0x4f0099);}(_0xa2b6,0xf8));var _0x6a2b=function(_0x3e2f72,_0x23cfca){_0x3e2f72=_0x3e2f72-0x0;var _0x3d2794=_0xa2b6[_0x3e2f72];return _0x3d2794;};'use strict';var _=require(_0x6a2b('0x0'));var util=require(_0x6a2b('0x1'));var moment=require(_0x6a2b('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a2b('0x3'));var fs=require('fs');var Redis=require(_0x6a2b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a2b('0x5'));var logger=require(_0x6a2b('0x6'))(_0x6a2b('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a2b('0x8'));var client=jayson[_0x6a2b('0x9')][_0x6a2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42123f,_0x4aca34,_0x2a4890){return new BPromise(function(_0x187ba4,_0x5f189f){return client[_0x6a2b('0xb')](_0x42123f,_0x2a4890)['then'](function(_0x1a82bb){logger[_0x6a2b('0xc')](_0x6a2b('0xd'),_0x4aca34,_0x6a2b('0xe'));logger['debug'](_0x6a2b('0xf'),_0x4aca34,_0x6a2b('0xe'),JSON[_0x6a2b('0x10')](_0x1a82bb));if(_0x1a82bb[_0x6a2b('0x11')]){if(_0x1a82bb[_0x6a2b('0x11')]['code']===0x1f4){logger[_0x6a2b('0x11')](_0x6a2b('0xd'),_0x4aca34,_0x1a82bb[_0x6a2b('0x11')]['message']);return _0x5f189f(_0x1a82bb[_0x6a2b('0x11')][_0x6a2b('0x12')]);}logger[_0x6a2b('0x11')](_0x6a2b('0xd'),_0x4aca34,_0x1a82bb['error'][_0x6a2b('0x12')]);return _0x187ba4(_0x1a82bb[_0x6a2b('0x11')][_0x6a2b('0x12')]);}else{logger[_0x6a2b('0xc')](_0x6a2b('0xd'),_0x4aca34,_0x6a2b('0xe'));_0x187ba4(_0x1a82bb[_0x6a2b('0x13')][_0x6a2b('0x12')]);}})[_0x6a2b('0x14')](function(_0x511913){logger['error'](_0x6a2b('0xd'),_0x4aca34,_0x511913);_0x5f189f(_0x511913);});});} \ No newline at end of file +var _0xb4bd=['request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Schedule,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb4bd,0xbb));var _0xdb4b=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xb4bd[_0x59d89e];return _0x554e93;};'use strict';var _=require('lodash');var util=require(_0xdb4b('0x0'));var moment=require(_0xdb4b('0x1'));var BPromise=require(_0xdb4b('0x2'));var rs=require(_0xdb4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb4b('0x4'))['db'];var utils=require(_0xdb4b('0x5'));var logger=require(_0xdb4b('0x6'))(_0xdb4b('0x7'));var config=require(_0xdb4b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb4b('0x9')][_0xdb4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x537f40,_0x3db67e,_0x25848b){return new BPromise(function(_0x57ef94,_0x4c3c77){return client[_0xdb4b('0xb')](_0x537f40,_0x25848b)[_0xdb4b('0xc')](function(_0x2b624d){logger[_0xdb4b('0xd')]('Schedule,\x20%s,\x20%s',_0x3db67e,'request\x20sent');logger[_0xdb4b('0xe')](_0xdb4b('0xf'),_0x3db67e,_0xdb4b('0x10'),JSON[_0xdb4b('0x11')](_0x2b624d));if(_0x2b624d['error']){if(_0x2b624d['error'][_0xdb4b('0x12')]===0x1f4){logger[_0xdb4b('0x13')](_0xdb4b('0x14'),_0x3db67e,_0x2b624d[_0xdb4b('0x13')]['message']);return _0x4c3c77(_0x2b624d[_0xdb4b('0x13')][_0xdb4b('0x15')]);}logger[_0xdb4b('0x13')](_0xdb4b('0x14'),_0x3db67e,_0x2b624d['error'][_0xdb4b('0x15')]);return _0x57ef94(_0x2b624d['error'][_0xdb4b('0x15')]);}else{logger[_0xdb4b('0xd')](_0xdb4b('0x14'),_0x3db67e,'request\x20sent');_0x57ef94(_0x2b624d['result'][_0xdb4b('0x15')]);}})['catch'](function(_0x429a35){logger[_0xdb4b('0x13')](_0xdb4b('0x14'),_0x3db67e,_0x429a35);_0x4c3c77(_0x429a35);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d05365d..0398964 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 _0x32fc=['multer','util','path','express','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','download','post','create','put','update','delete','destroy'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0x32fc,0x1a2));var _0xc32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc32f('0x0'));var util=require(_0xc32f('0x1'));var path=require(_0xc32f('0x2'));var timeout=require('connect-timeout');var express=require(_0xc32f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc32f('0x4'));var config=require(_0xc32f('0x5'));var controller=require(_0xc32f('0x6'));router[_0xc32f('0x7')]('/',auth[_0xc32f('0x8')](),controller[_0xc32f('0x9')]);router[_0xc32f('0x7')](_0xc32f('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xc32f('0x7')](_0xc32f('0xb'),auth[_0xc32f('0x8')](),controller['show']);router[_0xc32f('0x7')]('/:id/download',auth[_0xc32f('0x8')](),controller[_0xc32f('0xc')]);router[_0xc32f('0xd')]('/',auth[_0xc32f('0x8')](),controller[_0xc32f('0xe')]);router[_0xc32f('0xf')](_0xc32f('0xb'),auth[_0xc32f('0x8')](),controller[_0xc32f('0x10')]);router[_0xc32f('0x11')](_0xc32f('0xb'),auth['isAuthenticated'](),controller[_0xc32f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4fad=['/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x5e6e8d,_0x37e707){var _0x36d4ce=function(_0x4060b2){while(--_0x4060b2){_0x5e6e8d['push'](_0x5e6e8d['shift']());}};_0x36d4ce(++_0x37e707);}(_0x4fad,0x1e9));var _0xd4fa=function(_0x48ccf7,_0x2c95b6){_0x48ccf7=_0x48ccf7-0x0;var _0x31601c=_0x4fad[_0x48ccf7];return _0x31601c;};'use strict';var multer=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var path=require(_0xd4fa('0x2'));var timeout=require(_0xd4fa('0x3'));var express=require(_0xd4fa('0x4'));var router=express[_0xd4fa('0x5')]();var auth=require(_0xd4fa('0x6'));var interaction=require(_0xd4fa('0x7'));var config=require('../../config/environment');var controller=require(_0xd4fa('0x8'));router['get']('/',auth[_0xd4fa('0x9')](),controller['index']);router[_0xd4fa('0xa')](_0xd4fa('0xb'),auth[_0xd4fa('0x9')](),controller[_0xd4fa('0xc')]);router[_0xd4fa('0xa')](_0xd4fa('0xd'),auth[_0xd4fa('0x9')](),controller[_0xd4fa('0xe')]);router[_0xd4fa('0xa')](_0xd4fa('0xf'),auth[_0xd4fa('0x9')](),controller[_0xd4fa('0x10')]);router[_0xd4fa('0x11')]('/',auth[_0xd4fa('0x9')](),controller[_0xd4fa('0x12')]);router[_0xd4fa('0x13')](_0xd4fa('0xd'),auth[_0xd4fa('0x9')](),controller[_0xd4fa('0x14')]);router[_0xd4fa('0x15')](_0xd4fa('0xd'),auth[_0xd4fa('0x9')](),controller[_0xd4fa('0x16')]);module[_0xd4fa('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 43df0ac..7e3832a 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 _0x6f47=['updatedAt','moment','path','exports','getDataValue','extname','value','STRING','setDataValue','INTEGER','subtract','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x6f47,0xc7));var _0x76f4=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x6f47[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var config=require('../../config/environment');module[_0x76f4('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x76f4('0x3')]('value')?path[_0x76f4('0x4')](this[_0x76f4('0x3')](_0x76f4('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x76f4('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x76f4('0x6')],'set':function(_0xfc2405){var _0x2176a7=_0xfc2405['replace'](/\\/g,'/');this[_0x76f4('0x7')](_0x76f4('0x5'),_0x2176a7);}},'rating':{'type':Sequelize[_0x76f4('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x76f4('0x8')],'set':function(_0x101f55){this['setDataValue']('startedAt',moment()[_0x76f4('0x9')](_0x101f55,'ms'));this[_0x76f4('0x7')]('closedAt',moment());this['setDataValue'](_0x76f4('0xa'),_0x101f55);}},'startedAt':{'type':Sequelize[_0x76f4('0xb')],'get':function(){return moment(this[_0x76f4('0x3')](_0x76f4('0xc')))[_0x76f4('0xd')](_0x76f4('0xe'))[_0x76f4('0xf')]();}},'closedAt':{'type':Sequelize[_0x76f4('0xb')],'get':function(){return moment(this[_0x76f4('0x3')]('closedAt'))[_0x76f4('0xd')](_0x76f4('0xe'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x76f4('0x10')))[_0x76f4('0xd')](_0x76f4('0xe'))[_0x76f4('0xf')]();}},'updatedAt':{'type':Sequelize[_0x76f4('0xb')],'get':function(){return moment(this[_0x76f4('0x3')](_0x76f4('0x11')))[_0x76f4('0xd')](_0x76f4('0xe'))[_0x76f4('0xf')]();}}}; \ No newline at end of file +var _0x9a19=['VIRTUAL','getDataValue','value','extname','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports'];(function(_0x3f2ecf,_0x4ccad6){var _0xa6dd7e=function(_0x5e04c3){while(--_0x5e04c3){_0x3f2ecf['push'](_0x3f2ecf['shift']());}};_0xa6dd7e(++_0x4ccad6);}(_0x9a19,0x114));var _0x99a1=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x9a19[_0xdd2bfa];return _0x55397e;};'use strict';var Sequelize=require(_0x99a1('0x0'));var moment=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var config=require('../../config/environment');module[_0x99a1('0x3')]={'format':{'type':Sequelize[_0x99a1('0x4')],'get':function(){return this[_0x99a1('0x5')](_0x99a1('0x6'))?path[_0x99a1('0x7')](this[_0x99a1('0x5')](_0x99a1('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x99a1('0x8')]},'channel':{'type':Sequelize[_0x99a1('0x8')]},'value':{'type':Sequelize[_0x99a1('0x8')],'set':function(_0x65045d){var _0x523b9e=_0x65045d['replace'](/\\/g,'/');this['setDataValue'](_0x99a1('0x6'),_0x523b9e);}},'rating':{'type':Sequelize[_0x99a1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5874fc){this[_0x99a1('0xa')](_0x99a1('0xb'),moment()[_0x99a1('0xc')](_0x5874fc,'ms'));this[_0x99a1('0xa')](_0x99a1('0xd'),moment());this['setDataValue'](_0x99a1('0xe'),_0x5874fc);}},'startedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0xb')))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'closedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0xd')))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'createdAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')]('createdAt'))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'updatedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0x13')))[_0x99a1('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 48b6ad6..442fa7e 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 _0xf03e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','options','ScreenRecording','include','findAll','rows','catch','params','keys','includeAll','merge','find','create','body','closedAt','describe','download','uniqueid','value','root','%s.cypher','existsSync','decryptFile','secrets','join','server/files/screen_recordings','Sequelize','ValidationError','filename','extname','unlink','ScreenRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0xf03e,0x114));var _0xef03=function(_0x505a6e,_0x23154a){_0x505a6e=_0x505a6e-0x0;var _0x44f85d=_0xf03e[_0x505a6e];return _0x44f85d;};'use strict';var pdf=require(_0xef03('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef03('0x1'));var jsonpatch=require(_0xef03('0x2'));var rp=require(_0xef03('0x3'));var moment=require(_0xef03('0x4'));var BPromise=require(_0xef03('0x5'));var Mustache=require('mustache');var util=require(_0xef03('0x6'));var path=require('path');var sox=require(_0xef03('0x7'));var csv=require(_0xef03('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xef03('0x9'));var squel=require(_0xef03('0xa'));var crypto=require(_0xef03('0xb'));var jsforce=require(_0xef03('0xc'));var deskjs=require(_0xef03('0xd'));var toCsv=require(_0xef03('0x8'));var querystring=require(_0xef03('0xe'));var Papa=require(_0xef03('0xf'));var Redis=require(_0xef03('0x10'));var authService=require(_0xef03('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xef03('0x12'));var hardwareService=require(_0xef03('0x13'));var logger=require(_0xef03('0x14'))(_0xef03('0x15'));var utils=require(_0xef03('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b59b1,_0x25bf58){_0x25bf58=_0x25bf58||0xcc;return function(_0x3af021){if(_0x3af021){return _0x1b59b1[_0xef03('0x17')](_0x25bf58);}return _0x1b59b1['status'](_0x25bf58)[_0xef03('0x18')]();};}function respondWithResult(_0x2bf14d,_0xf30b1d){_0xf30b1d=_0xf30b1d||0xc8;return function(_0x811697){if(_0x811697){return _0x2bf14d[_0xef03('0x19')](_0xf30b1d)[_0xef03('0x1a')](_0x811697);}};}function respondWithFilteredResult(_0x274841,_0x179ee6){return function(_0x42a4f3){if(_0x42a4f3){var _0x3a211c=_0x42a4f3[_0xef03('0x1b')],_0x41cd42=_0x179ee6[_0xef03('0x1c')],_0xdfe6e3=_0x179ee6[_0xef03('0x1c')]+_0x179ee6[_0xef03('0x1d')],_0x12da47;if(_0xdfe6e3>=_0x3a211c){_0xdfe6e3=_0x3a211c;_0x12da47=0xc8;}else{_0x12da47=0xce;}_0x274841[_0xef03('0x19')](_0x12da47);return _0x274841[_0xef03('0x1e')](_0xef03('0x1f'),_0x41cd42+'-'+_0xdfe6e3+'/'+_0x3a211c)[_0xef03('0x1a')](_0x42a4f3);}return null;};}function patchUpdates(_0x5bbdcb){return function(_0x36b9f9){try{jsonpatch['apply'](_0x36b9f9,_0x5bbdcb,!![]);}catch(_0x4d2517){return BPromise[_0xef03('0x20')](_0x4d2517);}return _0x36b9f9['save']();};}function saveUpdates(_0x1064d8,_0x176c52){return function(_0x3be338){if(_0x3be338){return _0x3be338[_0xef03('0x21')](_0x1064d8)[_0xef03('0x22')](function(_0x3212b3){return _0x3212b3;});}return null;};}function removeEntity(_0x5b67bb,_0x18dfb5){return function(_0x4c46b8){if(_0x4c46b8){return _0x4c46b8[_0xef03('0x23')]()[_0xef03('0x22')](function(){_0x5b67bb[_0xef03('0x19')](0xcc)[_0xef03('0x18')]();});}};}function handleEntityNotFound(_0x5f02e6,_0x497a67){return function(_0x4c174a){if(!_0x4c174a){_0x5f02e6['sendStatus'](0x194);}return _0x4c174a;};}function handleError(_0x1726b3,_0xa6baa){_0xa6baa=_0xa6baa||0x1f4;return function(_0x1f40fa){logger['error'](_0x1f40fa[_0xef03('0x24')]);if(_0x1f40fa[_0xef03('0x25')]){delete _0x1f40fa[_0xef03('0x25')];}_0x1726b3['status'](_0xa6baa)[_0xef03('0x26')](_0x1f40fa);};}exports[_0xef03('0x27')]=function(_0x42b36f,_0x19e843){var _0x4f2aa3={},_0x1024d8={},_0xc17f00={'count':0x0,'rows':[]};var _0x256a86=_[_0xef03('0x28')](db['ScreenRecording'][_0xef03('0x29')],function(_0x596990){return{'name':_0x596990[_0xef03('0x2a')],'type':_0x596990[_0xef03('0x2b')][_0xef03('0x2c')]};});_0x1024d8[_0xef03('0x2d')]=_[_0xef03('0x2e')](_[_0xef03('0x28')](_0x256a86,_0xef03('0x25')),[_0xef03('0x2f')]);_0x1024d8[_0xef03('0x30')]=_['keys'](_0x42b36f[_0xef03('0x30')]);_0x1024d8[_0xef03('0x31')]=_[_0xef03('0x32')](_0x1024d8['model'],_0x1024d8[_0xef03('0x30')]);_0x4f2aa3[_0xef03('0x33')]=_[_0xef03('0x32')](_0x1024d8['model'],qs[_0xef03('0x34')](_0x42b36f[_0xef03('0x30')]['fields']));_0x4f2aa3[_0xef03('0x33')]=_0x4f2aa3[_0xef03('0x33')][_0xef03('0x35')]?_0x4f2aa3[_0xef03('0x33')]:_0x1024d8[_0xef03('0x2d')];if(!_0x42b36f[_0xef03('0x30')]['hasOwnProperty'](_0xef03('0x36'))){_0x4f2aa3[_0xef03('0x1d')]=qs[_0xef03('0x1d')](_0x42b36f['query'][_0xef03('0x1d')]);_0x4f2aa3[_0xef03('0x1c')]=qs[_0xef03('0x1c')](_0x42b36f[_0xef03('0x30')]['offset']);}_0x4f2aa3['order']=qs[_0xef03('0x37')](_0x42b36f['query'][_0xef03('0x37')]);_0x4f2aa3[_0xef03('0x38')]=qs[_0xef03('0x31')](_[_0xef03('0x39')](_0x42b36f[_0xef03('0x30')],_0x1024d8[_0xef03('0x31')]),_0x256a86);if(_0x42b36f['query']['filter']){_0x4f2aa3['where']=_['merge'](_0x4f2aa3[_0xef03('0x38')],{'$or':_[_0xef03('0x28')](_0x256a86,function(_0x2fca99){if(_0x2fca99[_0xef03('0x2b')]!==_0xef03('0x3a')){var _0x5773b5={};_0x5773b5[_0x2fca99[_0xef03('0x25')]]={'$like':'%'+_0x42b36f[_0xef03('0x30')][_0xef03('0x3b')]+'%'};return _0x5773b5;}})});}_0x4f2aa3=_['merge']({},_0x4f2aa3,_0x42b36f[_0xef03('0x3c')]);var _0x5e7ce9={'where':_0x4f2aa3[_0xef03('0x38')]};return db[_0xef03('0x3d')][_0xef03('0x1b')](_0x5e7ce9)[_0xef03('0x22')](function(_0x4ab58b){_0xc17f00[_0xef03('0x1b')]=_0x4ab58b;if(_0x42b36f['query']['includeAll']){_0x4f2aa3[_0xef03('0x3e')]=[{'all':!![]}];}return db[_0xef03('0x3d')][_0xef03('0x3f')](_0x4f2aa3);})['then'](function(_0x1f86dc){_0xc17f00[_0xef03('0x40')]=_0x1f86dc;return _0xc17f00;})[_0xef03('0x22')](respondWithFilteredResult(_0x19e843,_0x4f2aa3))[_0xef03('0x41')](handleError(_0x19e843,null));};exports['show']=function(_0x357912,_0x3ba13d){var _0x440372={'raw':![],'where':{'id':_0x357912[_0xef03('0x42')]['id']}},_0x29d7cd={};_0x29d7cd[_0xef03('0x2d')]=_[_0xef03('0x43')](db[_0xef03('0x3d')]['rawAttributes']);_0x29d7cd[_0xef03('0x30')]=_[_0xef03('0x43')](_0x357912[_0xef03('0x30')]);_0x29d7cd['filters']=_['intersection'](_0x29d7cd[_0xef03('0x2d')],_0x29d7cd[_0xef03('0x30')]);_0x440372['attributes']=_[_0xef03('0x32')](_0x29d7cd[_0xef03('0x2d')],qs[_0xef03('0x34')](_0x357912['query'][_0xef03('0x34')]));_0x440372[_0xef03('0x33')]=_0x440372[_0xef03('0x33')][_0xef03('0x35')]?_0x440372[_0xef03('0x33')]:_0x29d7cd[_0xef03('0x2d')];if(_0x357912['query'][_0xef03('0x44')]){_0x440372['include']=[{'all':!![]}];}_0x440372=_[_0xef03('0x45')]({},_0x440372,_0x357912['options']);return db['ScreenRecording'][_0xef03('0x46')](_0x440372)[_0xef03('0x22')](handleEntityNotFound(_0x3ba13d,null))[_0xef03('0x22')](respondWithResult(_0x3ba13d,null))[_0xef03('0x41')](handleError(_0x3ba13d,null));};exports['create']=function(_0x2f5e0d,_0x39ce1f){return db[_0xef03('0x3d')][_0xef03('0x47')](_0x2f5e0d[_0xef03('0x48')],{})[_0xef03('0x22')](respondWithResult(_0x39ce1f,0xc9))[_0xef03('0x41')](handleError(_0x39ce1f,null));};exports['update']=function(_0x463363,_0x1a8a16){if(_0x463363[_0xef03('0x48')]['id']){delete _0x463363[_0xef03('0x48')]['id'];}delete _0x463363[_0xef03('0x48')]['duration'];delete _0x463363[_0xef03('0x48')]['createdAt'];delete _0x463363[_0xef03('0x48')][_0xef03('0x49')];delete _0x463363[_0xef03('0x48')]['value'];return db[_0xef03('0x3d')][_0xef03('0x46')]({'where':{'id':_0x463363['params']['id']}})['then'](handleEntityNotFound(_0x1a8a16,null))['then'](saveUpdates(_0x463363[_0xef03('0x48')],null))[_0xef03('0x22')](respondWithResult(_0x1a8a16,null))[_0xef03('0x41')](handleError(_0x1a8a16,null));};exports['describe']=function(_0x4a58f4,_0x5b8e21){return db[_0xef03('0x3d')][_0xef03('0x4a')]()[_0xef03('0x22')](respondWithResult(_0x5b8e21,null))['catch'](handleError(_0x5b8e21,null));};exports[_0xef03('0x4b')]=function(_0x10e0cf,_0x4e2f4c,_0x37c6e7){var _0x3e84a4=require('../../components/encryptor');var _0x56c48c=![];var _0x299e2c={};if(_0x10e0cf['query'][_0xef03('0x2b')]&&_0x10e0cf['query'][_0xef03('0x2b')]===_0xef03('0x4c')){_0x299e2c[_0xef03('0x4c')]=_0x10e0cf[_0xef03('0x42')]['id'];}else{_0x299e2c['id']=_0x10e0cf[_0xef03('0x42')]['id'];}return db[_0xef03('0x3d')]['find']({'where':_0x299e2c,'attributes':['id',_0xef03('0x4d')],'raw':!![]})[_0xef03('0x22')](handleEntityNotFound(_0x4e2f4c,null))['then'](function(_0x4594d7){if(_0x4594d7){var _0x3bfcac=path['join'](config[_0xef03('0x4e')],'server/files/screen_recordings',_0x4594d7[_0xef03('0x4d')]);var _0x56adcb=util[_0xef03('0x2f')](_0xef03('0x4f'),_0x3bfcac);if(fs[_0xef03('0x50')](_0x56adcb)){_0x56c48c=!![];return _0x3e84a4[_0xef03('0x51')](_0x56adcb,_0x3bfcac,config[_0xef03('0x52')]['recording'])[_0xef03('0x22')](function(){return _0x4594d7;});}return _0x4594d7;}})[_0xef03('0x22')](function(_0x2f05b9){if(_0x2f05b9){var _0x4d1325=path[_0xef03('0x53')](config[_0xef03('0x4e')],_0xef03('0x54'),_0x2f05b9[_0xef03('0x4d')]);if(!fs['existsSync'](_0x4d1325)){throw new db[(_0xef03('0x55'))][(_0xef03('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2f05b9['filename']){return _0x4e2f4c[_0xef03('0x4b')](_0x4d1325,_0x2f05b9[_0xef03('0x57')]+path[_0xef03('0x58')](_0x4d1325),function(){if(_0x56c48c){fs[_0xef03('0x59')](_0x4d1325);}});}else{return _0x4e2f4c['download'](_0x4d1325,function(_0x4678c6){if(_0x56c48c){fs['unlink'](_0x4d1325);}});}}})[_0xef03('0x41')](function(_0x304111){if(_0x304111['message']===_0xef03('0x5a')){_0x4e2f4c['status'](0x194)[_0xef03('0x26')]('Not\x20found');}else{return handleError(_0x4e2f4c,null);}});};exports[_0xef03('0x23')]=function(_0x3025e4,_0x2cec59){return db[_0xef03('0x3d')][_0xef03('0x46')]({'where':{'id':_0x3025e4[_0xef03('0x42')]['id']}})[_0xef03('0x22')](function(_0x313488){if(!_0x313488)throw new ReferenceError(_0xef03('0x5b'));return _0x313488;})['then'](function(_0x334650){var _0x40cdf5=path[_0xef03('0x53')](config[_0xef03('0x4e')],_0xef03('0x54'),_0x334650['value']);logger[_0xef03('0x5c')](_0xef03('0x5d'),_0x40cdf5);if(!_[_0xef03('0x5e')](_0x334650[_0xef03('0x4d')])&&fs[_0xef03('0x50')](_0x40cdf5)){logger[_0xef03('0x5c')]('File:\x20\x22'+_0x40cdf5+_0xef03('0x5f'));fs['unlinkSync'](_0x40cdf5);}_0x40cdf5=_0x40cdf5+_0xef03('0x60');if(!_[_0xef03('0x5e')](_0x334650[_0xef03('0x4d')])&&fs[_0xef03('0x50')](_0x40cdf5)){logger[_0xef03('0x5c')]('File:\x20\x22'+_0x40cdf5+_0xef03('0x5f'));fs['unlinkSync'](_0x40cdf5);}return _0x334650;})[_0xef03('0x22')](function(_0x115d63){if(!_0x115d63)throw new InternalError();return _0x115d63[_0xef03('0x23')]();})[_0xef03('0x22')](function(){_0x2cec59[_0xef03('0x19')](0xcc)[_0xef03('0x18')]();})['catch'](handleError(_0x2cec59,null));}; \ No newline at end of file +var _0x7b83=['reject','save','update','then','destroy','error','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','attributes','fields','hasOwnProperty','nolimit','limit','sort','filters','where','merge','VIRTUAL','include','findAll','rows','catch','params','intersection','length','includeAll','options','find','create','body','duration','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','join','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','apply'];(function(_0x122cc1,_0x5c956e){var _0x1e33af=function(_0x949b75){while(--_0x949b75){_0x122cc1['push'](_0x122cc1['shift']());}};_0x1e33af(++_0x5c956e);}(_0x7b83,0xa1));var _0x37b8=function(_0x55625c,_0x134b4f){_0x55625c=_0x55625c-0x0;var _0x4436f4=_0x7b83[_0x55625c];return _0x4436f4;};'use strict';var pdf=require(_0x37b8('0x0'));var emlformat=require(_0x37b8('0x1'));var rimraf=require(_0x37b8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x37b8('0x3'));var moment=require(_0x37b8('0x4'));var BPromise=require(_0x37b8('0x5'));var Mustache=require('mustache');var util=require(_0x37b8('0x6'));var path=require(_0x37b8('0x7'));var sox=require(_0x37b8('0x8'));var csv=require(_0x37b8('0x9'));var ejs=require(_0x37b8('0xa'));var fs=require('fs');var _=require(_0x37b8('0xb'));var squel=require('squel');var crypto=require(_0x37b8('0xc'));var jsforce=require(_0x37b8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x37b8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x37b8('0xe'));var as=require(_0x37b8('0xf'));var hardwareService=require(_0x37b8('0x10'));var logger=require(_0x37b8('0x11'))(_0x37b8('0x12'));var utils=require('../../config/utils');var config=require(_0x37b8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb2c6ff,_0x4ee19c){_0x4ee19c=_0x4ee19c||0xcc;return function(_0x2c9dba){if(_0x2c9dba){return _0xb2c6ff[_0x37b8('0x14')](_0x4ee19c);}return _0xb2c6ff[_0x37b8('0x15')](_0x4ee19c)[_0x37b8('0x16')]();};}function respondWithResult(_0x3dc8c5,_0x5bac2a){_0x5bac2a=_0x5bac2a||0xc8;return function(_0x5745be){if(_0x5745be){return _0x3dc8c5[_0x37b8('0x15')](_0x5bac2a)[_0x37b8('0x17')](_0x5745be);}};}function respondWithFilteredResult(_0x915af8,_0x4ab58e){return function(_0x48cfae){if(_0x48cfae){var _0x39b791=_0x48cfae[_0x37b8('0x18')],_0x29b875=_0x4ab58e[_0x37b8('0x19')],_0xd017bd=_0x4ab58e[_0x37b8('0x19')]+_0x4ab58e['limit'],_0x1fd6e6;if(_0xd017bd>=_0x39b791){_0xd017bd=_0x39b791;_0x1fd6e6=0xc8;}else{_0x1fd6e6=0xce;}_0x915af8[_0x37b8('0x15')](_0x1fd6e6);return _0x915af8['set']('Content-Range',_0x29b875+'-'+_0xd017bd+'/'+_0x39b791)[_0x37b8('0x17')](_0x48cfae);}return null;};}function patchUpdates(_0x36367a){return function(_0x39a1c8){try{jsonpatch[_0x37b8('0x1a')](_0x39a1c8,_0x36367a,!![]);}catch(_0x5dbdee){return BPromise[_0x37b8('0x1b')](_0x5dbdee);}return _0x39a1c8[_0x37b8('0x1c')]();};}function saveUpdates(_0x273de4,_0x655575){return function(_0x497623){if(_0x497623){return _0x497623[_0x37b8('0x1d')](_0x273de4)[_0x37b8('0x1e')](function(_0x307195){return _0x307195;});}return null;};}function removeEntity(_0x30ff05,_0x5aa644){return function(_0x10cdf9){if(_0x10cdf9){return _0x10cdf9[_0x37b8('0x1f')]()[_0x37b8('0x1e')](function(){_0x30ff05[_0x37b8('0x15')](0xcc)[_0x37b8('0x16')]();});}};}function handleEntityNotFound(_0x3579da,_0x275c77){return function(_0x4a1044){if(!_0x4a1044){_0x3579da[_0x37b8('0x14')](0x194);}return _0x4a1044;};}function handleError(_0x203bd3,_0x3bfd8d){_0x3bfd8d=_0x3bfd8d||0x1f4;return function(_0x36bb7c){logger[_0x37b8('0x20')](_0x36bb7c['stack']);if(_0x36bb7c['name']){delete _0x36bb7c[_0x37b8('0x21')];}_0x203bd3[_0x37b8('0x15')](_0x3bfd8d)['send'](_0x36bb7c);};}exports[_0x37b8('0x22')]=function(_0x5a988a,_0x14d814){var _0x141d3a={},_0x1adad0={},_0x139435={'count':0x0,'rows':[]};var _0x4d0438=_[_0x37b8('0x23')](db[_0x37b8('0x24')][_0x37b8('0x25')],function(_0x33eea4){return{'name':_0x33eea4[_0x37b8('0x26')],'type':_0x33eea4[_0x37b8('0x27')][_0x37b8('0x28')]};});_0x1adad0[_0x37b8('0x29')]=_['differenceBy'](_[_0x37b8('0x23')](_0x4d0438,'name'),[_0x37b8('0x2a')]);_0x1adad0[_0x37b8('0x2b')]=_[_0x37b8('0x2c')](_0x5a988a['query']);_0x1adad0['filters']=_['intersection'](_0x1adad0['model'],_0x1adad0['query']);_0x141d3a[_0x37b8('0x2d')]=_['intersection'](_0x1adad0[_0x37b8('0x29')],qs['fields'](_0x5a988a[_0x37b8('0x2b')][_0x37b8('0x2e')]));_0x141d3a['attributes']=_0x141d3a[_0x37b8('0x2d')]['length']?_0x141d3a[_0x37b8('0x2d')]:_0x1adad0[_0x37b8('0x29')];if(!_0x5a988a['query'][_0x37b8('0x2f')](_0x37b8('0x30'))){_0x141d3a[_0x37b8('0x31')]=qs[_0x37b8('0x31')](_0x5a988a['query'][_0x37b8('0x31')]);_0x141d3a[_0x37b8('0x19')]=qs['offset'](_0x5a988a[_0x37b8('0x2b')][_0x37b8('0x19')]);}_0x141d3a['order']=qs['sort'](_0x5a988a[_0x37b8('0x2b')][_0x37b8('0x32')]);_0x141d3a['where']=qs[_0x37b8('0x33')](_['pick'](_0x5a988a[_0x37b8('0x2b')],_0x1adad0['filters']),_0x4d0438);if(_0x5a988a['query']['filter']){_0x141d3a[_0x37b8('0x34')]=_[_0x37b8('0x35')](_0x141d3a[_0x37b8('0x34')],{'$or':_[_0x37b8('0x23')](_0x4d0438,function(_0x58db6e){if(_0x58db6e[_0x37b8('0x27')]!==_0x37b8('0x36')){var _0x438b72={};_0x438b72[_0x58db6e[_0x37b8('0x21')]]={'$like':'%'+_0x5a988a['query']['filter']+'%'};return _0x438b72;}})});}_0x141d3a=_[_0x37b8('0x35')]({},_0x141d3a,_0x5a988a['options']);var _0x5d85d7={'where':_0x141d3a[_0x37b8('0x34')]};return db['ScreenRecording'][_0x37b8('0x18')](_0x5d85d7)[_0x37b8('0x1e')](function(_0x392b8c){_0x139435[_0x37b8('0x18')]=_0x392b8c;if(_0x5a988a[_0x37b8('0x2b')]['includeAll']){_0x141d3a[_0x37b8('0x37')]=[{'all':!![]}];}return db['ScreenRecording'][_0x37b8('0x38')](_0x141d3a);})['then'](function(_0x22141c){_0x139435[_0x37b8('0x39')]=_0x22141c;return _0x139435;})[_0x37b8('0x1e')](respondWithFilteredResult(_0x14d814,_0x141d3a))[_0x37b8('0x3a')](handleError(_0x14d814,null));};exports['show']=function(_0x251dd5,_0x28e36a){var _0x328442={'raw':![],'where':{'id':_0x251dd5[_0x37b8('0x3b')]['id']}},_0x2f2bb4={};_0x2f2bb4[_0x37b8('0x29')]=_['keys'](db[_0x37b8('0x24')]['rawAttributes']);_0x2f2bb4[_0x37b8('0x2b')]=_['keys'](_0x251dd5['query']);_0x2f2bb4[_0x37b8('0x33')]=_['intersection'](_0x2f2bb4['model'],_0x2f2bb4[_0x37b8('0x2b')]);_0x328442[_0x37b8('0x2d')]=_[_0x37b8('0x3c')](_0x2f2bb4[_0x37b8('0x29')],qs[_0x37b8('0x2e')](_0x251dd5['query']['fields']));_0x328442[_0x37b8('0x2d')]=_0x328442[_0x37b8('0x2d')][_0x37b8('0x3d')]?_0x328442[_0x37b8('0x2d')]:_0x2f2bb4[_0x37b8('0x29')];if(_0x251dd5[_0x37b8('0x2b')][_0x37b8('0x3e')]){_0x328442[_0x37b8('0x37')]=[{'all':!![]}];}_0x328442=_['merge']({},_0x328442,_0x251dd5[_0x37b8('0x3f')]);return db[_0x37b8('0x24')][_0x37b8('0x40')](_0x328442)[_0x37b8('0x1e')](handleEntityNotFound(_0x28e36a,null))['then'](respondWithResult(_0x28e36a,null))[_0x37b8('0x3a')](handleError(_0x28e36a,null));};exports[_0x37b8('0x41')]=function(_0x2a804f,_0x39595d){return db[_0x37b8('0x24')]['create'](_0x2a804f[_0x37b8('0x42')],{})[_0x37b8('0x1e')](respondWithResult(_0x39595d,0xc9))[_0x37b8('0x3a')](handleError(_0x39595d,null));};exports['update']=function(_0x5ccd70,_0x4bc2cf){if(_0x5ccd70['body']['id']){delete _0x5ccd70['body']['id'];}delete _0x5ccd70['body'][_0x37b8('0x43')];delete _0x5ccd70['body']['createdAt'];delete _0x5ccd70['body']['closedAt'];delete _0x5ccd70[_0x37b8('0x42')][_0x37b8('0x44')];return db[_0x37b8('0x24')]['find']({'where':{'id':_0x5ccd70[_0x37b8('0x3b')]['id']}})[_0x37b8('0x1e')](handleEntityNotFound(_0x4bc2cf,null))['then'](saveUpdates(_0x5ccd70['body'],null))[_0x37b8('0x1e')](respondWithResult(_0x4bc2cf,null))[_0x37b8('0x3a')](handleError(_0x4bc2cf,null));};exports[_0x37b8('0x45')]=function(_0x5e7e0a,_0x694340){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x694340,null))['catch'](handleError(_0x694340,null));};exports[_0x37b8('0x46')]=function(_0x4a14b7,_0x1d3148,_0x4ee18d){var _0x16edec=require(_0x37b8('0x47'));var _0x4d9ba0=![];var _0x2c24c2={};if(_0x4a14b7[_0x37b8('0x2b')][_0x37b8('0x27')]&&_0x4a14b7['query'][_0x37b8('0x27')]===_0x37b8('0x48')){_0x2c24c2['uniqueid']=_0x4a14b7[_0x37b8('0x3b')]['id'];}else{_0x2c24c2['id']=_0x4a14b7['params']['id'];}return db[_0x37b8('0x24')][_0x37b8('0x40')]({'where':_0x2c24c2,'attributes':['id',_0x37b8('0x44')],'raw':!![]})[_0x37b8('0x1e')](handleEntityNotFound(_0x1d3148,null))['then'](function(_0x44cda7){if(_0x44cda7){var _0x12afd4=path['join'](config[_0x37b8('0x49')],_0x37b8('0x4a'),_0x44cda7['value']);var _0x5e4d3e=util[_0x37b8('0x2a')](_0x37b8('0x4b'),_0x12afd4);if(fs['existsSync'](_0x5e4d3e)){_0x4d9ba0=!![];return _0x16edec[_0x37b8('0x4c')](_0x5e4d3e,_0x12afd4,config[_0x37b8('0x4d')]['recording'])[_0x37b8('0x1e')](function(){return _0x44cda7;});}return _0x44cda7;}})['then'](function(_0x1b23cb){if(_0x1b23cb){var _0x296659=path[_0x37b8('0x4e')](config['root'],_0x37b8('0x4a'),_0x1b23cb[_0x37b8('0x44')]);if(!fs[_0x37b8('0x4f')](_0x296659)){throw new db['Sequelize'][(_0x37b8('0x50'))](_0x37b8('0x51'));}if(_0x1b23cb[_0x37b8('0x52')]){return _0x1d3148['download'](_0x296659,_0x1b23cb['filename']+path[_0x37b8('0x53')](_0x296659),function(){if(_0x4d9ba0){fs[_0x37b8('0x54')](_0x296659);}});}else{return _0x1d3148[_0x37b8('0x46')](_0x296659,function(_0xb55751){if(_0x4d9ba0){fs[_0x37b8('0x54')](_0x296659);}});}}})[_0x37b8('0x3a')](function(_0x424e58){if(_0x424e58[_0x37b8('0x55')]===_0x37b8('0x51')){_0x1d3148[_0x37b8('0x15')](0x194)[_0x37b8('0x56')](_0x37b8('0x57'));}else{return handleError(_0x1d3148,null);}});};exports['destroy']=function(_0x414a0e,_0x36c09b){return db[_0x37b8('0x24')][_0x37b8('0x40')]({'where':{'id':_0x414a0e[_0x37b8('0x3b')]['id']}})['then'](function(_0xaa0620){if(!_0xaa0620)throw new ReferenceError('Entity\x20not\x20found');return _0xaa0620;})[_0x37b8('0x1e')](function(_0xedb9d8){var _0x4e7813=path[_0x37b8('0x4e')](config['root'],_0x37b8('0x4a'),_0xedb9d8[_0x37b8('0x44')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x4e7813);if(!_[_0x37b8('0x58')](_0xedb9d8[_0x37b8('0x44')])&&fs[_0x37b8('0x4f')](_0x4e7813)){logger['info'](_0x37b8('0x59')+_0x4e7813+_0x37b8('0x5a'));fs[_0x37b8('0x5b')](_0x4e7813);}_0x4e7813=_0x4e7813+_0x37b8('0x5c');if(!_[_0x37b8('0x58')](_0xedb9d8[_0x37b8('0x44')])&&fs[_0x37b8('0x4f')](_0x4e7813)){logger[_0x37b8('0x5d')](_0x37b8('0x59')+_0x4e7813+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4e7813);}return _0xedb9d8;})['then'](function(_0x25c7dc){if(!_0x25c7dc)throw new InternalError();return _0x25c7dc[_0x37b8('0x1f')]();})['then'](function(){_0x36c09b[_0x37b8('0x15')](0xcc)[_0x37b8('0x16')]();})[_0x37b8('0x3a')](handleError(_0x36c09b,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2c3c05b..ea8a7e5 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 _0xa852=['moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x24e807,_0x5b3e76){var _0x2cadd2=function(_0x220c7a){while(--_0x220c7a){_0x24e807['push'](_0x24e807['shift']());}};_0x2cadd2(++_0x5b3e76);}(_0xa852,0x1bc));var _0x2a85=function(_0x10940b,_0x2f155f){_0x10940b=_0x10940b-0x0;var _0x1e7e3a=_0xa852[_0x10940b];return _0x1e7e3a;};'use strict';var _=require(_0x2a85('0x0'));var util=require(_0x2a85('0x1'));var logger=require(_0x2a85('0x2'))(_0x2a85('0x3'));var moment=require(_0x2a85('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a85('0x5'));var fs=require('fs');var path=require(_0x2a85('0x6'));var rimraf=require(_0x2a85('0x7'));var config=require(_0x2a85('0x8'));var attributes=require(_0x2a85('0x9'));module[_0x2a85('0xa')]=function(_0xca3655,_0x52d285){return _0xca3655['define'](_0x2a85('0xb'),attributes,{'tableName':_0x2a85('0xc'),'paranoid':![],'indexes':[{'name':_0x2a85('0xd'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5752=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid'];(function(_0x49f30e,_0xf28439){var _0x2cafd5=function(_0x581d4c){while(--_0x581d4c){_0x49f30e['push'](_0x49f30e['shift']());}};_0x2cafd5(++_0xf28439);}(_0x5752,0x144));var _0x2575=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x5752[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2575('0x0'));var rp=require(_0x2575('0x1'));var fs=require('fs');var path=require(_0x2575('0x2'));var rimraf=require(_0x2575('0x3'));var config=require(_0x2575('0x4'));var attributes=require(_0x2575('0x5'));module[_0x2575('0x6')]=function(_0x112783,_0x522fad){return _0x112783['define']('ScreenRecording',attributes,{'tableName':_0x2575('0x7'),'paranoid':![],'indexes':[{'name':_0x2575('0x8'),'fields':[_0x2575('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 67388de..bbfea73 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(_0x2bfbda,_0x35e425){var _0xed99c2=function(_0x4c9ad2){while(--_0x4c9ad2){_0x2bfbda['push'](_0x2bfbda['shift']());}};_0xed99c2(++_0x35e425);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x239502,_0x4e8178){var _0x13391d=function(_0x4f8fa4){while(--_0x4f8fa4){_0x239502['push'](_0x239502['shift']());}};_0x13391d(++_0x4e8178);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 ffba316..cb49afe 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 _0x92ff=['join','preferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','server/files/images/logos/','format','%s%s','logo','originalname','post','single','file','addLogo','root','logologin','extname','addLogoLogin'];(function(_0xd4c6b,_0xdd9213){var _0x3f6897=function(_0x55f227){while(--_0x55f227){_0xd4c6b['push'](_0xd4c6b['shift']());}};_0x3f6897(++_0xdd9213);}(_0x92ff,0x13b));var _0xf92f=function(_0x485fba,_0x45df65){_0x485fba=_0x485fba-0x0;var _0x1da4a1=_0x92ff[_0x485fba];return _0x1da4a1;};'use strict';var multer=require(_0xf92f('0x0'));var util=require(_0xf92f('0x1'));var path=require(_0xf92f('0x2'));var timeout=require(_0xf92f('0x3'));var express=require(_0xf92f('0x4'));var router=express[_0xf92f('0x5')]();var auth=require(_0xf92f('0x6'));var interaction=require(_0xf92f('0x7'));var config=require(_0xf92f('0x8'));var controller=require('./setting.controller');router['get']('/',auth[_0xf92f('0x9')](),controller[_0xf92f('0xa')]);router[_0xf92f('0xb')](_0xf92f('0xc'),controller[_0xf92f('0xd')]);router[_0xf92f('0xb')](_0xf92f('0xe'),controller[_0xf92f('0xf')]);router['get'](_0xf92f('0x10'),controller[_0xf92f('0x11')]);router[_0xf92f('0xb')](_0xf92f('0x12'),controller[_0xf92f('0x13')]);router[_0xf92f('0xb')](_0xf92f('0x14'),controller[_0xf92f('0x15')]);router[_0xf92f('0xb')](_0xf92f('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0xf92f('0x17')]({'destination':function(_0x33ca5e,_0x4dd7ae,_0x2cae02){_0x2cae02(null,path['join'](config['root'],_0xf92f('0x18')));},'filename':function(_0x4966d2,_0x37de13,_0x387c22){_0x387c22(null,util[_0xf92f('0x19')](_0xf92f('0x1a'),_0xf92f('0x1b'),path['extname'](_0x37de13[_0xf92f('0x1c')])));}})});router[_0xf92f('0x1d')](_0xf92f('0xe'),upload[_0xf92f('0x1e')](_0xf92f('0x1f')),controller[_0xf92f('0x20')]);var upload=multer({'storage':multer[_0xf92f('0x17')]({'destination':function(_0xbb59a9,_0x41a8c9,_0x36497f){_0x36497f(null,path['join'](config[_0xf92f('0x21')],_0xf92f('0x18')));},'filename':function(_0x422f50,_0x173a15,_0x1bbe24){_0x1bbe24(null,util[_0xf92f('0x19')](_0xf92f('0x1a'),_0xf92f('0x22'),path[_0xf92f('0x23')](_0x173a15[_0xf92f('0x1c')])));}})});router['post']('/:id/logo_login',upload['single']('file'),controller[_0xf92f('0x24')]);var upload=multer({'storage':multer[_0xf92f('0x17')]({'destination':function(_0x187f35,_0x1c3044,_0x2832eb){_0x2832eb(null,path[_0xf92f('0x25')](config[_0xf92f('0x21')],_0xf92f('0x18')));},'filename':function(_0x56a435,_0x153d1d,_0x5a2cf3){_0x5a2cf3(null,util[_0xf92f('0x19')](_0xf92f('0x1a'),_0xf92f('0x26'),path['extname'](_0x153d1d[_0xf92f('0x1c')])));}})});router[_0xf92f('0x1d')](_0xf92f('0x14'),upload['single'](_0xf92f('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0xf92f('0x17')]({'destination':function(_0x40d95c,_0x19795b,_0x24a844){_0x24a844(null,path[_0xf92f('0x25')](config[_0xf92f('0x21')],_0xf92f('0x18')));},'filename':function(_0x155a89,_0x542cd2,_0x226738){_0x226738(null,util['format'](_0xf92f('0x1a'),_0xf92f('0x27'),path['extname'](_0x542cd2[_0xf92f('0x1c')])));}})});router['post'](_0xf92f('0x16'),upload['single']('file'),controller[_0xf92f('0x28')]);router[_0xf92f('0x29')](_0xf92f('0xc'),auth[_0xf92f('0x9')](),controller[_0xf92f('0x2a')]);module[_0xf92f('0x2b')]=router; \ No newline at end of file +var _0xe5ca=['post','single','file','addLogo','diskStorage','join','root','server/files/images/logos/','originalname','addLogoLogin','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','format','%s%s','logo','extname'];(function(_0x4fb55a,_0x35b72c){var _0x533821=function(_0x4e20ea){while(--_0x4e20ea){_0x4fb55a['push'](_0x4fb55a['shift']());}};_0x533821(++_0x35b72c);}(_0xe5ca,0x10c));var _0xae5c=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xe5ca[_0x3305de];return _0x3b5a84;};'use strict';var multer=require(_0xae5c('0x0'));var util=require(_0xae5c('0x1'));var path=require(_0xae5c('0x2'));var timeout=require(_0xae5c('0x3'));var express=require(_0xae5c('0x4'));var router=express[_0xae5c('0x5')]();var auth=require(_0xae5c('0x6'));var interaction=require(_0xae5c('0x7'));var config=require('../../config/environment');var controller=require(_0xae5c('0x8'));router[_0xae5c('0x9')]('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0xb')]);router[_0xae5c('0x9')]('/:id',controller[_0xae5c('0xc')]);router[_0xae5c('0x9')](_0xae5c('0xd'),controller[_0xae5c('0xe')]);router[_0xae5c('0x9')](_0xae5c('0xf'),controller[_0xae5c('0x10')]);router[_0xae5c('0x9')](_0xae5c('0x11'),controller[_0xae5c('0x12')]);router['get'](_0xae5c('0x13'),controller['getPreferred']);router[_0xae5c('0x9')](_0xae5c('0x14'),controller[_0xae5c('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x506ab2,_0x5a5804,_0x5c7094){_0x5c7094(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x4027c9,_0x389503,_0x405642){_0x405642(null,util[_0xae5c('0x16')](_0xae5c('0x17'),_0xae5c('0x18'),path[_0xae5c('0x19')](_0x389503['originalname'])));}})});router[_0xae5c('0x1a')](_0xae5c('0xd'),upload[_0xae5c('0x1b')](_0xae5c('0x1c')),controller[_0xae5c('0x1d')]);var upload=multer({'storage':multer[_0xae5c('0x1e')]({'destination':function(_0x57265f,_0x5051df,_0x501a75){_0x501a75(null,path[_0xae5c('0x1f')](config[_0xae5c('0x20')],_0xae5c('0x21')));},'filename':function(_0x43b7be,_0x4b2d18,_0x1179fa){_0x1179fa(null,util[_0xae5c('0x16')](_0xae5c('0x17'),'logologin',path[_0xae5c('0x19')](_0x4b2d18[_0xae5c('0x22')])));}})});router[_0xae5c('0x1a')](_0xae5c('0xf'),upload['single']('file'),controller[_0xae5c('0x23')]);var upload=multer({'storage':multer[_0xae5c('0x1e')]({'destination':function(_0x1c6b33,_0x3b1584,_0x7c605a){_0x7c605a(null,path['join'](config[_0xae5c('0x20')],_0xae5c('0x21')));},'filename':function(_0x1c7431,_0x57373d,_0x365921){_0x365921(null,util[_0xae5c('0x16')](_0xae5c('0x17'),'preferred',path[_0xae5c('0x19')](_0x57373d[_0xae5c('0x22')])));}})});router['post'](_0xae5c('0x13'),upload['single'](_0xae5c('0x1c')),controller[_0xae5c('0x24')]);var upload=multer({'storage':multer[_0xae5c('0x1e')]({'destination':function(_0x38d196,_0xa7e570,_0x10dd3f){_0x10dd3f(null,path[_0xae5c('0x1f')](config[_0xae5c('0x20')],_0xae5c('0x21')));},'filename':function(_0x41448f,_0x1ff85d,_0x254b3e){_0x254b3e(null,util[_0xae5c('0x16')](_0xae5c('0x17'),_0xae5c('0x25'),path['extname'](_0x1ff85d[_0xae5c('0x22')])));}})});router['post'](_0xae5c('0x14'),upload[_0xae5c('0x1b')]('file'),controller[_0xae5c('0x26')]);router[_0xae5c('0x27')]('/:id',auth['isAuthenticated'](),controller[_0xae5c('0x28')]);module[_0xae5c('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3a86eba..5d0ab58 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 _0x066a=['exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate'];(function(_0x586755,_0x5c4daa){var _0x1b3cfe=function(_0x2346bf){while(--_0x2346bf){_0x586755['push'](_0x586755['shift']());}};_0x1b3cfe(++_0x5c4daa);}(_0x066a,0x157));var _0xa066=function(_0x2c7518,_0xcf834f){_0x2c7518=_0x2c7518-0x0;var _0x5f58de=_0x066a[_0x2c7518];return _0x5f58de;};'use strict';var Sequelize=require('sequelize');module[_0xa066('0x0')]={'min_internal':{'type':Sequelize[_0xa066('0x1')](0xb),'unique':_0xa066('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa066('0x1')](0xb),'unique':_0xa066('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa066('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa066('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xa066('0x4')]},'defaultLogo':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa066('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa066('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xa066('0x4')]},'turnpassword':{'type':Sequelize[_0xa066('0x4')]},'pageTitle':{'type':Sequelize[_0xa066('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa066('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xa066('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xa066('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa066('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa066('0x4')],'defaultValue':_0xa066('0x6')},'chatTimeout':{'type':Sequelize[_0xa066('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa066('0x4')]},'defaultPreferred':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa066('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa066('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa066('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xa066('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa066('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa066('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa066('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa066('0x1')]},'transcribeRegion':{'type':Sequelize[_0xa066('0x4')]},'sentiment':{'type':Sequelize[_0xa066('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa066('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa066('0x1')]},'sentimentRegion':{'type':Sequelize[_0xa066('0x4')]},'language':{'type':Sequelize[_0xa066('0x4')]},'bucket':{'type':Sequelize[_0xa066('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xa066('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x285c=['sequelize','exports','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x285c,0x1a7));var _0xc285=function(_0x45723e,_0x39d8af){_0x45723e=_0x45723e-0x0;var _0x3eb56d=_0x285c[_0x45723e];return _0x3eb56d;};'use strict';var Sequelize=require(_0xc285('0x0'));module[_0xc285('0x1')]={'min_internal':{'type':Sequelize[_0xc285('0x2')](0xb),'unique':_0xc285('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xc285('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc285('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc285('0x4')],'defaultValue':_0xc285('0x5')},'logo':{'type':Sequelize[_0xc285('0x4')]},'defaultLogo':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc285('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc285('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xc285('0x4')]},'turnaddr':{'type':Sequelize[_0xc285('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xc285('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xc285('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc285('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xc285('0x4')],'defaultValue':_0xc285('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc285('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xc285('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xc285('0x4')],'defaultValue':_0xc285('0x8')},'chatTimeout':{'type':Sequelize[_0xc285('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc285('0x4')]},'defaultPreferred':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc285('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc285('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc285('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xc285('0x4')]},'defaultFavicon':{'type':Sequelize[_0xc285('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc285('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc285('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xc285('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc285('0x2')]},'transcribeRegion':{'type':Sequelize[_0xc285('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xc285('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc285('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xc285('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 021af23..ddefffa 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 _0x85ae=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Setting','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','keys','find','body','addLogo','file','logo','params','addLogoLogin','loginLogo','filename','../../config/license/util','server/files/images/logos','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','default_logo.svg','\x20not\x20found','download','getLogoLogin','getLicense','preferred','defaultLogo','default_loginLogo.svg','custom','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end'];(function(_0x345655,_0x3cbedb){var _0x5c3e06=function(_0x4d9758){while(--_0x4d9758){_0x345655['push'](_0x345655['shift']());}};_0x5c3e06(++_0x3cbedb);}(_0x85ae,0x1a8));var _0xe85a=function(_0x38e9cd,_0x106b2d){_0x38e9cd=_0x38e9cd-0x0;var _0x31d779=_0x85ae[_0x38e9cd];return _0x31d779;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe85a('0x0'));var rimraf=require(_0xe85a('0x1'));var zipdir=require(_0xe85a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe85a('0x3'));var moment=require(_0xe85a('0x4'));var BPromise=require(_0xe85a('0x5'));var Mustache=require(_0xe85a('0x6'));var util=require('util');var path=require(_0xe85a('0x7'));var sox=require(_0xe85a('0x8'));var csv=require('to-csv');var ejs=require(_0xe85a('0x9'));var fs=require('fs');var _=require(_0xe85a('0xa'));var squel=require('squel');var crypto=require(_0xe85a('0xb'));var jsforce=require(_0xe85a('0xc'));var deskjs=require(_0xe85a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe85a('0xe'));var Redis=require(_0xe85a('0xf'));var authService=require(_0xe85a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe85a('0x11'));var hardwareService=require(_0xe85a('0x12'));var logger=require('../../config/logger')(_0xe85a('0x13'));var utils=require(_0xe85a('0x14'));var config=require('../../config/environment');var db=require(_0xe85a('0x15'))['db'];var jayson=require(_0xe85a('0x16'));var client=jayson[_0xe85a('0x17')][_0xe85a('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4c8dc7,_0x58ef94,_0x1d0b0f){if(_0x1d0b0f){var _0x4474e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4474e9[_0xe85a('0x19')](_0x58ef94)){return _0x4c8dc7;}else{throw new db[(_0xe85a('0x1a'))][(_0xe85a('0x1b'))](_0xe85a('0x1c'));}}else{return _0x4c8dc7;}}function respondWithRpcPromise(_0x46bd41,_0x4c2f15,_0xd4d0b,_0x4b2b11){return new BPromise(function(_0x709ce9,_0x5cbe47){var _0x2b474e=_0x4b2b11||client;return _0x2b474e[_0xe85a('0x1d')](_0x46bd41,_0xd4d0b)[_0xe85a('0x1e')](function(_0x184946){logger['info']('Setting,\x20%s,\x20%s',_0x4c2f15,_0xe85a('0x1f'));logger['debug'](_0xe85a('0x20'),_0x4c2f15,_0xe85a('0x1f'),JSON[_0xe85a('0x21')](_0x184946));if(_0x184946[_0xe85a('0x22')]){if(_0x184946[_0xe85a('0x22')][_0xe85a('0x23')]===0x1f4){logger[_0xe85a('0x22')](_0xe85a('0x24'),_0x4c2f15,_0x184946[_0xe85a('0x22')][_0xe85a('0x25')]);return _0x5cbe47(_0x184946[_0xe85a('0x22')]['message']);}logger[_0xe85a('0x22')](_0xe85a('0x24'),_0x4c2f15,_0x184946[_0xe85a('0x22')]['message']);return _0x709ce9(_0x184946[_0xe85a('0x22')][_0xe85a('0x25')]);}else{logger[_0xe85a('0x26')](_0xe85a('0x24'),_0x4c2f15,'request\x20sent');_0x709ce9(_0x184946[_0xe85a('0x27')]['message']);}})[_0xe85a('0x28')](function(_0x40630c){logger[_0xe85a('0x22')]('Setting,\x20%s,\x20%s',_0x4c2f15,_0x40630c);_0x5cbe47(_0x40630c);});});}function respondWithStatusCode(_0x201590,_0x244fe8){_0x244fe8=_0x244fe8||0xcc;return function(_0x36a7ad){if(_0x36a7ad){return _0x201590[_0xe85a('0x29')](_0x244fe8);}return _0x201590[_0xe85a('0x2a')](_0x244fe8)[_0xe85a('0x2b')]();};}function respondWithResult(_0x27653b,_0x44a938){_0x44a938=_0x44a938||0xc8;return function(_0x13d18a){if(_0x13d18a){return _0x27653b[_0xe85a('0x2a')](_0x44a938)[_0xe85a('0x2c')](_0x13d18a);}};}function respondWithFilteredResult(_0x4f66aa,_0x1ced3b){return function(_0x1960be){if(_0x1960be){var _0x452a20=_0x1960be[_0xe85a('0x2d')],_0x59dd19=_0x1ced3b['offset'],_0x171151=_0x1ced3b[_0xe85a('0x2e')]+_0x1ced3b[_0xe85a('0x2f')],_0x2517e1;if(_0x171151>=_0x452a20){_0x171151=_0x452a20;_0x2517e1=0xc8;}else{_0x2517e1=0xce;}_0x4f66aa[_0xe85a('0x2a')](_0x2517e1);return _0x4f66aa[_0xe85a('0x30')](_0xe85a('0x31'),_0x59dd19+'-'+_0x171151+'/'+_0x452a20)['json'](_0x1960be);}return null;};}function patchUpdates(_0x16986a){return function(_0x18bc66){try{jsonpatch[_0xe85a('0x32')](_0x18bc66,_0x16986a,!![]);}catch(_0x1a6aca){return BPromise[_0xe85a('0x33')](_0x1a6aca);}return _0x18bc66[_0xe85a('0x34')]();};}function saveUpdates(_0x3c0df7,_0x451046){return function(_0x136168){if(_0x136168){return _0x136168[_0xe85a('0x35')](_0x3c0df7)[_0xe85a('0x1e')](function(_0x438c57){return _0x438c57;});}return null;};}function removeEntity(_0x1c1c68,_0x8fd97a){return function(_0x23a510){if(_0x23a510){return _0x23a510[_0xe85a('0x36')]()[_0xe85a('0x1e')](function(){_0x1c1c68[_0xe85a('0x2a')](0xcc)[_0xe85a('0x2b')]();});}};}function handleEntityNotFound(_0x545a52,_0x1522cd){return function(_0x5b3229){if(!_0x5b3229){_0x545a52[_0xe85a('0x29')](0x194);}return _0x5b3229;};}function handleError(_0xdb0016,_0x39f5f5){_0x39f5f5=_0x39f5f5||0x1f4;return function(_0x529aed){logger[_0xe85a('0x22')](_0x529aed[_0xe85a('0x37')]);if(_0x529aed['name']){delete _0x529aed[_0xe85a('0x38')];}_0xdb0016[_0xe85a('0x2a')](_0x39f5f5)['send'](_0x529aed);};}exports[_0xe85a('0x39')]=function(_0xeb36e8,_0x2e85b6){var _0x1b2f62={},_0x41c3b5={},_0x3c1670={'count':0x0,'rows':[]};var _0xc17e31=_[_0xe85a('0x3a')](db[_0xe85a('0x3b')][_0xe85a('0x3c')],function(_0x1d881b){return{'name':_0x1d881b['fieldName'],'type':_0x1d881b[_0xe85a('0x3d')][_0xe85a('0x3e')]};});_0x41c3b5['model']=_[_0xe85a('0x3a')](_0xc17e31,_0xe85a('0x38'));_0x41c3b5[_0xe85a('0x3f')]=_['keys'](_0xeb36e8[_0xe85a('0x3f')]);_0x41c3b5[_0xe85a('0x40')]=_[_0xe85a('0x41')](_0x41c3b5[_0xe85a('0x42')],_0x41c3b5[_0xe85a('0x3f')]);_0x1b2f62['attributes']=_[_0xe85a('0x41')](_0x41c3b5[_0xe85a('0x42')],qs[_0xe85a('0x43')](_0xeb36e8['query'][_0xe85a('0x43')]));_0x1b2f62[_0xe85a('0x44')]=_0x1b2f62[_0xe85a('0x44')][_0xe85a('0x45')]?_0x1b2f62[_0xe85a('0x44')]:_0x41c3b5['model'];if(!_0xeb36e8[_0xe85a('0x3f')][_0xe85a('0x46')]('nolimit')){_0x1b2f62[_0xe85a('0x2f')]=qs[_0xe85a('0x2f')](_0xeb36e8[_0xe85a('0x3f')][_0xe85a('0x2f')]);_0x1b2f62[_0xe85a('0x2e')]=qs[_0xe85a('0x2e')](_0xeb36e8['query']['offset']);}_0x1b2f62[_0xe85a('0x47')]=qs[_0xe85a('0x48')](_0xeb36e8[_0xe85a('0x3f')][_0xe85a('0x48')]);_0x1b2f62[_0xe85a('0x49')]=qs[_0xe85a('0x40')](_['pick'](_0xeb36e8[_0xe85a('0x3f')],_0x41c3b5[_0xe85a('0x40')]),_0xc17e31);if(_0xeb36e8[_0xe85a('0x3f')]['filter']){_0x1b2f62[_0xe85a('0x49')]=_['merge'](_0x1b2f62[_0xe85a('0x49')],{'$or':_[_0xe85a('0x3a')](_0xc17e31,function(_0x35ed42){if(_0x35ed42[_0xe85a('0x3d')]!=='VIRTUAL'){var _0x13c963={};_0x13c963[_0x35ed42['name']]={'$like':'%'+_0xeb36e8[_0xe85a('0x3f')][_0xe85a('0x4a')]+'%'};return _0x13c963;}})});}_0x1b2f62=_[_0xe85a('0x4b')]({},_0x1b2f62,_0xeb36e8[_0xe85a('0x4c')]);var _0x4e139f={'where':_0x1b2f62[_0xe85a('0x49')]};return db[_0xe85a('0x3b')]['count'](_0x4e139f)[_0xe85a('0x1e')](function(_0x1916d6){_0x3c1670[_0xe85a('0x2d')]=_0x1916d6;if(_0xeb36e8[_0xe85a('0x3f')][_0xe85a('0x4d')]){_0x1b2f62[_0xe85a('0x4e')]=[{'all':!![]}];}return db[_0xe85a('0x3b')][_0xe85a('0x4f')](_0x1b2f62);})[_0xe85a('0x1e')](function(_0x3e1077){_0x3c1670[_0xe85a('0x50')]=_0x3e1077;return _0x3c1670;})[_0xe85a('0x1e')](respondWithFilteredResult(_0x2e85b6,_0x1b2f62))[_0xe85a('0x28')](handleError(_0x2e85b6,null));};exports['show']=function(_0x201a32,_0x2dcb6a){var _0x4cfdb2={'raw':![],'where':{'id':_0x201a32['params']['id']}},_0x12d176={};_0x12d176[_0xe85a('0x42')]=_[_0xe85a('0x51')](db[_0xe85a('0x3b')]['rawAttributes']);_0x12d176[_0xe85a('0x3f')]=_[_0xe85a('0x51')](_0x201a32[_0xe85a('0x3f')]);_0x12d176[_0xe85a('0x40')]=_[_0xe85a('0x41')](_0x12d176[_0xe85a('0x42')],_0x12d176['query']);_0x4cfdb2['attributes']=_[_0xe85a('0x41')](_0x12d176[_0xe85a('0x42')],qs[_0xe85a('0x43')](_0x201a32[_0xe85a('0x3f')]['fields']));_0x4cfdb2['attributes']=_0x4cfdb2['attributes']['length']?_0x4cfdb2[_0xe85a('0x44')]:_0x12d176['model'];if(_0x201a32[_0xe85a('0x3f')][_0xe85a('0x4d')]){_0x4cfdb2[_0xe85a('0x4e')]=[{'all':!![]}];}_0x4cfdb2=_[_0xe85a('0x4b')]({},_0x4cfdb2,_0x201a32[_0xe85a('0x4c')]);return db[_0xe85a('0x3b')][_0xe85a('0x52')](_0x4cfdb2)[_0xe85a('0x1e')](handleEntityNotFound(_0x2dcb6a,null))[_0xe85a('0x1e')](respondWithResult(_0x2dcb6a,null))[_0xe85a('0x28')](handleError(_0x2dcb6a,null));};exports[_0xe85a('0x35')]=function(_0x2ed54b,_0x54a9c8){if(_0x2ed54b[_0xe85a('0x53')]['id']){delete _0x2ed54b[_0xe85a('0x53')]['id'];}return db[_0xe85a('0x3b')][_0xe85a('0x52')]({'where':{'id':_0x2ed54b['params']['id']}})['then'](handleEntityNotFound(_0x54a9c8,null))['then'](saveUpdates(_0x2ed54b[_0xe85a('0x53')],null))[_0xe85a('0x1e')](respondWithResult(_0x54a9c8,null))['catch'](handleError(_0x54a9c8,null));};exports[_0xe85a('0x54')]=function(_0x19f229,_0x178cf2,_0x4b1d7c){if(_0x19f229['file']&&_0x19f229[_0xe85a('0x55')]['filename']){_0x19f229[_0xe85a('0x53')][_0xe85a('0x56')]=_0x19f229[_0xe85a('0x55')]['filename'];}return db['Setting']['find']({'where':{'id':_0x19f229[_0xe85a('0x57')]['id']}})[_0xe85a('0x1e')](handleEntityNotFound(_0x178cf2,null))[_0xe85a('0x1e')](saveUpdates(_0x19f229[_0xe85a('0x53')],null))['then'](respondWithResult(_0x178cf2,null))[_0xe85a('0x28')](handleError(_0x178cf2,null));};exports[_0xe85a('0x58')]=function(_0x47fdb2,_0x41a940,_0x27376d){if(_0x47fdb2[_0xe85a('0x55')]&&_0x47fdb2[_0xe85a('0x55')]['filename']){_0x47fdb2['body'][_0xe85a('0x59')]=_0x47fdb2[_0xe85a('0x55')][_0xe85a('0x5a')];}return db[_0xe85a('0x3b')][_0xe85a('0x52')]({'where':{'id':_0x47fdb2['params']['id']}})['then'](handleEntityNotFound(_0x41a940,null))['then'](saveUpdates(_0x47fdb2[_0xe85a('0x53')],null))[_0xe85a('0x1e')](respondWithResult(_0x41a940,null))[_0xe85a('0x28')](handleError(_0x41a940,null));};var utilLicense=require(_0xe85a('0x5b'));exports['getLogo']=function(_0x25b003,_0x1cd576,_0xb3d9de){var _0x11ac1d=_0xe85a('0x5c');var _0x46378b={'custom':![]};return utilLicense['getLicense']()[_0xe85a('0x1e')](function(_0x16e49e){if(_0x16e49e){_0x46378b=_0x16e49e;}return db[_0xe85a('0x3b')]['find']({'where':{'id':_0x25b003['params']['id']},'attributes':[_0xe85a('0x56'),_0xe85a('0x59'),'preferred',_0xe85a('0x5d'),'defaultLogo',_0xe85a('0x5e'),_0xe85a('0x5f'),_0xe85a('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x1cd576,null))[_0xe85a('0x1e')](function(_0x37f572){if(_0x37f572){var _0x55f651=_0x37f572[_0xe85a('0x56')]&&fs[_0xe85a('0x61')](path[_0xe85a('0x62')](config[_0xe85a('0x63')],_0x11ac1d,_[_0xe85a('0x64')](_0x37f572[_0xe85a('0x56')])))?path['join'](config['root'],_0x11ac1d,_[_0xe85a('0x64')](_0x37f572[_0xe85a('0x56')])):path['join'](config[_0xe85a('0x63')],_0x11ac1d,_[_0xe85a('0x64')]('default_logo.svg'));var _0x55f0fd=_0xe85a('0x65')+_[_0xe85a('0x66')](_0xe85a('0x56'));if(_0x37f572[_0x55f0fd]||!_0x46378b['custom']){_0x55f651=path[_0xe85a('0x62')](config['root'],_0x11ac1d,_['toLower'](_0xe85a('0x67')));}if(!fs[_0xe85a('0x61')](_0x55f651)){throw new db[(_0xe85a('0x1a'))][(_0xe85a('0x1b'))](_[_0xe85a('0x66')](_0xe85a('0x56'))+_0xe85a('0x68'));}return _0x1cd576[_0xe85a('0x69')](_0x55f651);}})[_0xe85a('0x28')](handleError(_0x1cd576,null));};var utilLicense=require(_0xe85a('0x5b'));exports[_0xe85a('0x6a')]=function(_0x2dcdb0,_0x34ffa3,_0x25a1c9){var _0x17e2ab=_0xe85a('0x5c');var _0x1889a0={'custom':![]};return utilLicense[_0xe85a('0x6b')]()['then'](function(_0x587bb9){if(_0x587bb9){_0x1889a0=_0x587bb9;}return db[_0xe85a('0x3b')][_0xe85a('0x52')]({'where':{'id':_0x2dcdb0[_0xe85a('0x57')]['id']},'attributes':[_0xe85a('0x56'),_0xe85a('0x59'),_0xe85a('0x6c'),_0xe85a('0x5d'),_0xe85a('0x6d'),'defaultLoginLogo','defaultPreferred',_0xe85a('0x60')],'raw':!![]});})[_0xe85a('0x1e')](handleEntityNotFound(_0x34ffa3,null))['then'](function(_0xcf99b5){if(_0xcf99b5){var _0x1215c4=_0xcf99b5[_0xe85a('0x59')]&&fs[_0xe85a('0x61')](path[_0xe85a('0x62')](config[_0xe85a('0x63')],_0x17e2ab,_[_0xe85a('0x64')](_0xcf99b5[_0xe85a('0x59')])))?path['join'](config[_0xe85a('0x63')],_0x17e2ab,_[_0xe85a('0x64')](_0xcf99b5[_0xe85a('0x59')])):path['join'](config[_0xe85a('0x63')],_0x17e2ab,_[_0xe85a('0x64')](_0xe85a('0x6e')));var _0x17635d=_0xe85a('0x65')+_[_0xe85a('0x66')](_0xe85a('0x59'));if(_0xcf99b5[_0x17635d]||!_0x1889a0[_0xe85a('0x6f')]){_0x1215c4=path[_0xe85a('0x62')](config[_0xe85a('0x63')],_0x17e2ab,_['toLower'](_0xe85a('0x6e')));}if(!fs['existsSync'](_0x1215c4)){throw new db[(_0xe85a('0x1a'))][(_0xe85a('0x1b'))](_['upperFirst'](_0xe85a('0x59'))+_0xe85a('0x68'));}return _0x34ffa3[_0xe85a('0x69')](_0x1215c4);}})[_0xe85a('0x28')](handleError(_0x34ffa3,null));};exports['gdpr']=function(_0x2f4aaa,_0x2c86a5){return db[_0xe85a('0x3b')]['find']({'where':{'id':_0x2f4aaa[_0xe85a('0x57')]['id']},'attributes':['securePassword']})[_0xe85a('0x1e')](respondWithResult(_0x2c86a5,null))['catch'](handleError(_0x2c86a5,null));};exports['addPreferred']=function(_0x5d7037,_0x251b37,_0x111aba){if(_0x5d7037['file']&&_0x5d7037['file'][_0xe85a('0x5a')]){_0x5d7037['body'][_0xe85a('0x6c')]=_0x5d7037[_0xe85a('0x55')][_0xe85a('0x5a')];}return db[_0xe85a('0x3b')][_0xe85a('0x52')]({'where':{'id':_0x5d7037['params']['id']}})[_0xe85a('0x1e')](handleEntityNotFound(_0x251b37,null))[_0xe85a('0x1e')](saveUpdates(_0x5d7037[_0xe85a('0x53')],null))['then'](respondWithResult(_0x251b37,null))['catch'](handleError(_0x251b37,null));};var utilLicense=require('../../config/license/util');exports[_0xe85a('0x70')]=function(_0x1cae70,_0x28eaed,_0x11da84){var _0x2436fe='server/files/images/logos';var _0x19958d={'custom':![]};return utilLicense[_0xe85a('0x6b')]()[_0xe85a('0x1e')](function(_0x4ea9fd){if(_0x4ea9fd){_0x19958d=_0x4ea9fd;}return db[_0xe85a('0x3b')][_0xe85a('0x52')]({'where':{'id':_0x1cae70['params']['id']},'attributes':[_0xe85a('0x56'),_0xe85a('0x59'),_0xe85a('0x6c'),_0xe85a('0x5d'),'defaultLogo',_0xe85a('0x5e'),'defaultPreferred',_0xe85a('0x60')],'raw':!![]});})[_0xe85a('0x1e')](handleEntityNotFound(_0x28eaed,null))[_0xe85a('0x1e')](function(_0x88880){if(_0x88880){var _0x39b0a0=_0x88880[_0xe85a('0x6c')]&&fs[_0xe85a('0x61')](path[_0xe85a('0x62')](config['root'],_0x2436fe,_[_0xe85a('0x64')](_0x88880[_0xe85a('0x6c')])))?path[_0xe85a('0x62')](config[_0xe85a('0x63')],_0x2436fe,_['toLower'](_0x88880[_0xe85a('0x6c')])):path[_0xe85a('0x62')](config['root'],_0x2436fe,_['toLower']('default_preferred.png'));var _0x21cdd0=_0xe85a('0x65')+_[_0xe85a('0x66')](_0xe85a('0x6c'));if(_0x88880[_0x21cdd0]||!_0x19958d['custom']||!_0x19958d[_0xe85a('0x6c')]){_0x39b0a0=path[_0xe85a('0x62')](config[_0xe85a('0x63')],_0x2436fe,_[_0xe85a('0x64')](_0xe85a('0x71')));}if(!fs[_0xe85a('0x61')](_0x39b0a0)){throw new db[(_0xe85a('0x1a'))][(_0xe85a('0x1b'))](_[_0xe85a('0x66')](_0xe85a('0x6c'))+'\x20not\x20found');}return _0x28eaed[_0xe85a('0x69')](_0x39b0a0);}})[_0xe85a('0x28')](handleError(_0x28eaed,null));};exports[_0xe85a('0x72')]=function(_0x1d272a,_0x4aec49,_0x123865){if(_0x1d272a['file']&&_0x1d272a[_0xe85a('0x55')][_0xe85a('0x5a')]){_0x1d272a[_0xe85a('0x53')][_0xe85a('0x5d')]=_0x1d272a['file'][_0xe85a('0x5a')];}return db['Setting'][_0xe85a('0x52')]({'where':{'id':_0x1d272a[_0xe85a('0x57')]['id']}})[_0xe85a('0x1e')](handleEntityNotFound(_0x4aec49,null))[_0xe85a('0x1e')](saveUpdates(_0x1d272a['body'],null))[_0xe85a('0x1e')](respondWithResult(_0x4aec49,null))[_0xe85a('0x28')](handleError(_0x4aec49,null));};var utilLicense=require('../../config/license/util');exports[_0xe85a('0x73')]=function(_0x15e266,_0xdb7e86,_0x927e8e){var _0xb33b4=_0xe85a('0x5c');var _0x5afd59={'custom':![]};return utilLicense['getLicense']()[_0xe85a('0x1e')](function(_0x33ef48){if(_0x33ef48){_0x5afd59=_0x33ef48;}return db['Setting']['find']({'where':{'id':_0x15e266[_0xe85a('0x57')]['id']},'attributes':['logo',_0xe85a('0x59'),'preferred','favicon','defaultLogo',_0xe85a('0x5e'),'defaultPreferred',_0xe85a('0x60')],'raw':!![]});})[_0xe85a('0x1e')](handleEntityNotFound(_0xdb7e86,null))[_0xe85a('0x1e')](function(_0x198680){if(_0x198680){var _0x59ce68=_0x198680[_0xe85a('0x5d')]&&fs[_0xe85a('0x61')](path[_0xe85a('0x62')](config['root'],_0xb33b4,_['toLower'](_0x198680[_0xe85a('0x5d')])))?path[_0xe85a('0x62')](config[_0xe85a('0x63')],_0xb33b4,_['toLower'](_0x198680[_0xe85a('0x5d')])):path[_0xe85a('0x62')](config['root'],_0xb33b4,_['toLower'](_0xe85a('0x74')));var _0x595b35='default'+_[_0xe85a('0x66')](_0xe85a('0x5d'));if(_0x198680[_0x595b35]||!_0x5afd59['custom']){_0x59ce68=path[_0xe85a('0x62')](config[_0xe85a('0x63')],_0xb33b4,_['toLower'](_0xe85a('0x74')));}if(!fs[_0xe85a('0x61')](_0x59ce68)){throw new db[(_0xe85a('0x1a'))][(_0xe85a('0x1b'))](_[_0xe85a('0x66')]('favicon')+'\x20not\x20found');}return _0xdb7e86[_0xe85a('0x69')](_0x59ce68);}})[_0xe85a('0x28')](handleError(_0xdb7e86,null));}; \ No newline at end of file +var _0xd511=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','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','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','count','offset','Content-Range','apply','update','destroy','end','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','includeAll','include','findAll','catch','show','params','find','body','addLogo','filename','logo','addLogoLogin','file','loginLogo','../../config/license/util','server/files/images/logos','preferred','defaultLogo','defaultLoginLogo','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','\x20not\x20found','getLogoLogin','getLicense','favicon','defaultPreferred','defaultFavicon','default_loginLogo.svg','gdpr','addPreferred','download','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs'];(function(_0xc0a8e1,_0x2fbd4e){var _0x237baf=function(_0x49cbb6){while(--_0x49cbb6){_0xc0a8e1['push'](_0xc0a8e1['shift']());}};_0x237baf(++_0x2fbd4e);}(_0xd511,0x68));var _0x1d51=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd511[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1d51('0x0'));var emlformat=require(_0x1d51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1d51('0x2'));var jsonpatch=require(_0x1d51('0x3'));var rp=require(_0x1d51('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1d51('0x5'));var util=require(_0x1d51('0x6'));var path=require(_0x1d51('0x7'));var sox=require(_0x1d51('0x8'));var csv=require(_0x1d51('0x9'));var ejs=require(_0x1d51('0xa'));var fs=require('fs');var _=require(_0x1d51('0xb'));var squel=require(_0x1d51('0xc'));var crypto=require(_0x1d51('0xd'));var jsforce=require(_0x1d51('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1d51('0x9'));var querystring=require('querystring');var Papa=require(_0x1d51('0xf'));var Redis=require(_0x1d51('0x10'));var authService=require(_0x1d51('0x11'));var qs=require(_0x1d51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d51('0x13'));var logger=require('../../config/logger')(_0x1d51('0x14'));var utils=require(_0x1d51('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x1d51('0x16'));var client=jayson[_0x1d51('0x17')][_0x1d51('0x18')]({'port':0x232a});function checkPasswordPattern(_0x462bf1,_0x4dd8c6,_0x3d9942){if(_0x3d9942){var _0x3a7cee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a7cee[_0x1d51('0x19')](_0x4dd8c6)){return _0x462bf1;}else{throw new db[(_0x1d51('0x1a'))][(_0x1d51('0x1b'))](_0x1d51('0x1c'));}}else{return _0x462bf1;}}function respondWithRpcPromise(_0x122a08,_0x219ded,_0x1432e7,_0x47df22){return new BPromise(function(_0x219037,_0x482c3e){var _0x67ee6=_0x47df22||client;return _0x67ee6[_0x1d51('0x1d')](_0x122a08,_0x1432e7)[_0x1d51('0x1e')](function(_0x37e6e0){logger[_0x1d51('0x1f')](_0x1d51('0x20'),_0x219ded,_0x1d51('0x21'));logger['debug'](_0x1d51('0x22'),_0x219ded,_0x1d51('0x21'),JSON[_0x1d51('0x23')](_0x37e6e0));if(_0x37e6e0[_0x1d51('0x24')]){if(_0x37e6e0[_0x1d51('0x24')][_0x1d51('0x25')]===0x1f4){logger[_0x1d51('0x24')](_0x1d51('0x20'),_0x219ded,_0x37e6e0[_0x1d51('0x24')]['message']);return _0x482c3e(_0x37e6e0[_0x1d51('0x24')]['message']);}logger[_0x1d51('0x24')](_0x1d51('0x20'),_0x219ded,_0x37e6e0['error'][_0x1d51('0x26')]);return _0x219037(_0x37e6e0[_0x1d51('0x24')][_0x1d51('0x26')]);}else{logger[_0x1d51('0x1f')](_0x1d51('0x20'),_0x219ded,_0x1d51('0x21'));_0x219037(_0x37e6e0['result']['message']);}})['catch'](function(_0x1552fc){logger[_0x1d51('0x24')]('Setting,\x20%s,\x20%s',_0x219ded,_0x1552fc);_0x482c3e(_0x1552fc);});});}function respondWithStatusCode(_0x5a1409,_0x38576f){_0x38576f=_0x38576f||0xcc;return function(_0x2b1cdd){if(_0x2b1cdd){return _0x5a1409[_0x1d51('0x27')](_0x38576f);}return _0x5a1409[_0x1d51('0x28')](_0x38576f)['end']();};}function respondWithResult(_0x3a11cf,_0x1bdc8f){_0x1bdc8f=_0x1bdc8f||0xc8;return function(_0x3f5750){if(_0x3f5750){return _0x3a11cf[_0x1d51('0x28')](_0x1bdc8f)[_0x1d51('0x29')](_0x3f5750);}};}function respondWithFilteredResult(_0x2b1aa9,_0x21014a){return function(_0x349da7){if(_0x349da7){var _0x57862a=_0x349da7[_0x1d51('0x2a')],_0x1f4de3=_0x21014a[_0x1d51('0x2b')],_0x10c041=_0x21014a[_0x1d51('0x2b')]+_0x21014a['limit'],_0x1b13fa;if(_0x10c041>=_0x57862a){_0x10c041=_0x57862a;_0x1b13fa=0xc8;}else{_0x1b13fa=0xce;}_0x2b1aa9['status'](_0x1b13fa);return _0x2b1aa9['set'](_0x1d51('0x2c'),_0x1f4de3+'-'+_0x10c041+'/'+_0x57862a)[_0x1d51('0x29')](_0x349da7);}return null;};}function patchUpdates(_0x33d537){return function(_0x1625d2){try{jsonpatch[_0x1d51('0x2d')](_0x1625d2,_0x33d537,!![]);}catch(_0x109788){return BPromise['reject'](_0x109788);}return _0x1625d2['save']();};}function saveUpdates(_0x111388,_0x2cc940){return function(_0x40d2ce){if(_0x40d2ce){return _0x40d2ce[_0x1d51('0x2e')](_0x111388)['then'](function(_0x448e81){return _0x448e81;});}return null;};}function removeEntity(_0x2cef76,_0x24b803){return function(_0x20342e){if(_0x20342e){return _0x20342e[_0x1d51('0x2f')]()[_0x1d51('0x1e')](function(){_0x2cef76[_0x1d51('0x28')](0xcc)[_0x1d51('0x30')]();});}};}function handleEntityNotFound(_0x565ac3,_0x55baf8){return function(_0x39d372){if(!_0x39d372){_0x565ac3[_0x1d51('0x27')](0x194);}return _0x39d372;};}function handleError(_0x5539d1,_0x491c2b){_0x491c2b=_0x491c2b||0x1f4;return function(_0x345394){logger[_0x1d51('0x24')](_0x345394['stack']);if(_0x345394[_0x1d51('0x31')]){delete _0x345394[_0x1d51('0x31')];}_0x5539d1[_0x1d51('0x28')](_0x491c2b)['send'](_0x345394);};}exports[_0x1d51('0x32')]=function(_0x12fcf6,_0x2a0086){var _0x40b564={},_0x41a26d={},_0x324d29={'count':0x0,'rows':[]};var _0x401154=_[_0x1d51('0x33')](db['Setting'][_0x1d51('0x34')],function(_0x331053){return{'name':_0x331053[_0x1d51('0x35')],'type':_0x331053[_0x1d51('0x36')][_0x1d51('0x37')]};});_0x41a26d[_0x1d51('0x38')]=_[_0x1d51('0x33')](_0x401154,_0x1d51('0x31'));_0x41a26d['query']=_[_0x1d51('0x39')](_0x12fcf6[_0x1d51('0x3a')]);_0x41a26d[_0x1d51('0x3b')]=_['intersection'](_0x41a26d[_0x1d51('0x38')],_0x41a26d[_0x1d51('0x3a')]);_0x40b564[_0x1d51('0x3c')]=_[_0x1d51('0x3d')](_0x41a26d[_0x1d51('0x38')],qs[_0x1d51('0x3e')](_0x12fcf6[_0x1d51('0x3a')][_0x1d51('0x3e')]));_0x40b564['attributes']=_0x40b564[_0x1d51('0x3c')][_0x1d51('0x3f')]?_0x40b564[_0x1d51('0x3c')]:_0x41a26d[_0x1d51('0x38')];if(!_0x12fcf6[_0x1d51('0x3a')]['hasOwnProperty'](_0x1d51('0x40'))){_0x40b564[_0x1d51('0x41')]=qs[_0x1d51('0x41')](_0x12fcf6['query']['limit']);_0x40b564[_0x1d51('0x2b')]=qs[_0x1d51('0x2b')](_0x12fcf6[_0x1d51('0x3a')][_0x1d51('0x2b')]);}_0x40b564[_0x1d51('0x42')]=qs[_0x1d51('0x43')](_0x12fcf6[_0x1d51('0x3a')][_0x1d51('0x43')]);_0x40b564[_0x1d51('0x44')]=qs[_0x1d51('0x3b')](_[_0x1d51('0x45')](_0x12fcf6[_0x1d51('0x3a')],_0x41a26d[_0x1d51('0x3b')]),_0x401154);if(_0x12fcf6[_0x1d51('0x3a')][_0x1d51('0x46')]){_0x40b564['where']=_[_0x1d51('0x47')](_0x40b564[_0x1d51('0x44')],{'$or':_[_0x1d51('0x33')](_0x401154,function(_0x535b58){if(_0x535b58[_0x1d51('0x36')]!==_0x1d51('0x48')){var _0x1a0b93={};_0x1a0b93[_0x535b58[_0x1d51('0x31')]]={'$like':'%'+_0x12fcf6[_0x1d51('0x3a')][_0x1d51('0x46')]+'%'};return _0x1a0b93;}})});}_0x40b564=_['merge']({},_0x40b564,_0x12fcf6[_0x1d51('0x49')]);var _0x20feb4={'where':_0x40b564['where']};return db[_0x1d51('0x4a')][_0x1d51('0x2a')](_0x20feb4)['then'](function(_0x557f19){_0x324d29[_0x1d51('0x2a')]=_0x557f19;if(_0x12fcf6[_0x1d51('0x3a')][_0x1d51('0x4b')]){_0x40b564[_0x1d51('0x4c')]=[{'all':!![]}];}return db['Setting'][_0x1d51('0x4d')](_0x40b564);})[_0x1d51('0x1e')](function(_0x17f503){_0x324d29['rows']=_0x17f503;return _0x324d29;})['then'](respondWithFilteredResult(_0x2a0086,_0x40b564))[_0x1d51('0x4e')](handleError(_0x2a0086,null));};exports[_0x1d51('0x4f')]=function(_0x589499,_0x1d6f6d){var _0x1f0f8={'raw':![],'where':{'id':_0x589499[_0x1d51('0x50')]['id']}},_0x24186e={};_0x24186e[_0x1d51('0x38')]=_[_0x1d51('0x39')](db['Setting'][_0x1d51('0x34')]);_0x24186e['query']=_[_0x1d51('0x39')](_0x589499[_0x1d51('0x3a')]);_0x24186e[_0x1d51('0x3b')]=_[_0x1d51('0x3d')](_0x24186e[_0x1d51('0x38')],_0x24186e[_0x1d51('0x3a')]);_0x1f0f8[_0x1d51('0x3c')]=_[_0x1d51('0x3d')](_0x24186e[_0x1d51('0x38')],qs['fields'](_0x589499[_0x1d51('0x3a')][_0x1d51('0x3e')]));_0x1f0f8[_0x1d51('0x3c')]=_0x1f0f8[_0x1d51('0x3c')][_0x1d51('0x3f')]?_0x1f0f8[_0x1d51('0x3c')]:_0x24186e[_0x1d51('0x38')];if(_0x589499[_0x1d51('0x3a')][_0x1d51('0x4b')]){_0x1f0f8[_0x1d51('0x4c')]=[{'all':!![]}];}_0x1f0f8=_['merge']({},_0x1f0f8,_0x589499[_0x1d51('0x49')]);return db[_0x1d51('0x4a')][_0x1d51('0x51')](_0x1f0f8)['then'](handleEntityNotFound(_0x1d6f6d,null))[_0x1d51('0x1e')](respondWithResult(_0x1d6f6d,null))[_0x1d51('0x4e')](handleError(_0x1d6f6d,null));};exports[_0x1d51('0x2e')]=function(_0x528d71,_0x27dce2){if(_0x528d71[_0x1d51('0x52')]['id']){delete _0x528d71[_0x1d51('0x52')]['id'];}return db['Setting'][_0x1d51('0x51')]({'where':{'id':_0x528d71[_0x1d51('0x50')]['id']}})[_0x1d51('0x1e')](handleEntityNotFound(_0x27dce2,null))[_0x1d51('0x1e')](saveUpdates(_0x528d71['body'],null))[_0x1d51('0x1e')](respondWithResult(_0x27dce2,null))[_0x1d51('0x4e')](handleError(_0x27dce2,null));};exports[_0x1d51('0x53')]=function(_0x523354,_0x22a70b,_0x313b5e){if(_0x523354['file']&&_0x523354['file'][_0x1d51('0x54')]){_0x523354[_0x1d51('0x52')][_0x1d51('0x55')]=_0x523354['file']['filename'];}return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0x523354[_0x1d51('0x50')]['id']}})[_0x1d51('0x1e')](handleEntityNotFound(_0x22a70b,null))['then'](saveUpdates(_0x523354['body'],null))[_0x1d51('0x1e')](respondWithResult(_0x22a70b,null))[_0x1d51('0x4e')](handleError(_0x22a70b,null));};exports[_0x1d51('0x56')]=function(_0x5ec177,_0x16f5da,_0x48eb11){if(_0x5ec177[_0x1d51('0x57')]&&_0x5ec177[_0x1d51('0x57')][_0x1d51('0x54')]){_0x5ec177[_0x1d51('0x52')][_0x1d51('0x58')]=_0x5ec177[_0x1d51('0x57')][_0x1d51('0x54')];}return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0x5ec177['params']['id']}})['then'](handleEntityNotFound(_0x16f5da,null))[_0x1d51('0x1e')](saveUpdates(_0x5ec177[_0x1d51('0x52')],null))[_0x1d51('0x1e')](respondWithResult(_0x16f5da,null))[_0x1d51('0x4e')](handleError(_0x16f5da,null));};var utilLicense=require(_0x1d51('0x59'));exports['getLogo']=function(_0x32dfd8,_0x1133f2,_0x2717d4){var _0x39413d=_0x1d51('0x5a');var _0x49fb99={'custom':![]};return utilLicense['getLicense']()[_0x1d51('0x1e')](function(_0x2e7bd8){if(_0x2e7bd8){_0x49fb99=_0x2e7bd8;}return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0x32dfd8[_0x1d51('0x50')]['id']},'attributes':[_0x1d51('0x55'),_0x1d51('0x58'),_0x1d51('0x5b'),'favicon',_0x1d51('0x5c'),_0x1d51('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x1d51('0x1e')](handleEntityNotFound(_0x1133f2,null))['then'](function(_0x4e8209){if(_0x4e8209){var _0x2e3aaf=_0x4e8209[_0x1d51('0x55')]&&fs['existsSync'](path[_0x1d51('0x5e')](config[_0x1d51('0x5f')],_0x39413d,_[_0x1d51('0x60')](_0x4e8209[_0x1d51('0x55')])))?path['join'](config['root'],_0x39413d,_['toLower'](_0x4e8209[_0x1d51('0x55')])):path[_0x1d51('0x5e')](config[_0x1d51('0x5f')],_0x39413d,_['toLower'](_0x1d51('0x61')));var _0x1312b7=_0x1d51('0x62')+_[_0x1d51('0x63')]('logo');if(_0x4e8209[_0x1312b7]||!_0x49fb99[_0x1d51('0x64')]){_0x2e3aaf=path[_0x1d51('0x5e')](config['root'],_0x39413d,_['toLower'](_0x1d51('0x61')));}if(!fs[_0x1d51('0x65')](_0x2e3aaf)){throw new db[(_0x1d51('0x1a'))][(_0x1d51('0x1b'))](_[_0x1d51('0x63')]('logo')+_0x1d51('0x66'));}return _0x1133f2['download'](_0x2e3aaf);}})[_0x1d51('0x4e')](handleError(_0x1133f2,null));};var utilLicense=require(_0x1d51('0x59'));exports[_0x1d51('0x67')]=function(_0x3d62f2,_0x112868,_0x5f098b){var _0x35bef4='server/files/images/logos';var _0x2ed7b3={'custom':![]};return utilLicense[_0x1d51('0x68')]()['then'](function(_0x252e22){if(_0x252e22){_0x2ed7b3=_0x252e22;}return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0x3d62f2['params']['id']},'attributes':['logo','loginLogo','preferred',_0x1d51('0x69'),_0x1d51('0x5c'),'defaultLoginLogo',_0x1d51('0x6a'),_0x1d51('0x6b')],'raw':!![]});})['then'](handleEntityNotFound(_0x112868,null))[_0x1d51('0x1e')](function(_0x58b775){if(_0x58b775){var _0xcd4477=_0x58b775[_0x1d51('0x58')]&&fs['existsSync'](path[_0x1d51('0x5e')](config[_0x1d51('0x5f')],_0x35bef4,_[_0x1d51('0x60')](_0x58b775[_0x1d51('0x58')])))?path['join'](config[_0x1d51('0x5f')],_0x35bef4,_[_0x1d51('0x60')](_0x58b775['loginLogo'])):path[_0x1d51('0x5e')](config[_0x1d51('0x5f')],_0x35bef4,_[_0x1d51('0x60')](_0x1d51('0x6c')));var _0x274cc0=_0x1d51('0x62')+_[_0x1d51('0x63')](_0x1d51('0x58'));if(_0x58b775[_0x274cc0]||!_0x2ed7b3['custom']){_0xcd4477=path[_0x1d51('0x5e')](config[_0x1d51('0x5f')],_0x35bef4,_[_0x1d51('0x60')](_0x1d51('0x6c')));}if(!fs[_0x1d51('0x65')](_0xcd4477)){throw new db[(_0x1d51('0x1a'))]['ValidationError'](_[_0x1d51('0x63')](_0x1d51('0x58'))+'\x20not\x20found');}return _0x112868['download'](_0xcd4477);}})[_0x1d51('0x4e')](handleError(_0x112868,null));};exports[_0x1d51('0x6d')]=function(_0x14ce24,_0x22a3c4){return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0x14ce24[_0x1d51('0x50')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x22a3c4,null))[_0x1d51('0x4e')](handleError(_0x22a3c4,null));};exports[_0x1d51('0x6e')]=function(_0xb57517,_0x29be5a,_0x582fb9){if(_0xb57517[_0x1d51('0x57')]&&_0xb57517[_0x1d51('0x57')][_0x1d51('0x54')]){_0xb57517[_0x1d51('0x52')][_0x1d51('0x5b')]=_0xb57517[_0x1d51('0x57')][_0x1d51('0x54')];}return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0xb57517[_0x1d51('0x50')]['id']}})[_0x1d51('0x1e')](handleEntityNotFound(_0x29be5a,null))[_0x1d51('0x1e')](saveUpdates(_0xb57517[_0x1d51('0x52')],null))['then'](respondWithResult(_0x29be5a,null))[_0x1d51('0x4e')](handleError(_0x29be5a,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x3086cc,_0x559034,_0x3eac89){var _0x4a99ff=_0x1d51('0x5a');var _0x47b76d={'custom':![]};return utilLicense[_0x1d51('0x68')]()[_0x1d51('0x1e')](function(_0x5129e8){if(_0x5129e8){_0x47b76d=_0x5129e8;}return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0x3086cc[_0x1d51('0x50')]['id']},'attributes':['logo',_0x1d51('0x58'),_0x1d51('0x5b'),_0x1d51('0x69'),_0x1d51('0x5c'),'defaultLoginLogo',_0x1d51('0x6a'),'defaultFavicon'],'raw':!![]});})[_0x1d51('0x1e')](handleEntityNotFound(_0x559034,null))['then'](function(_0x158895){if(_0x158895){var _0x55b32e=_0x158895['preferred']&&fs[_0x1d51('0x65')](path['join'](config[_0x1d51('0x5f')],_0x4a99ff,_['toLower'](_0x158895['preferred'])))?path[_0x1d51('0x5e')](config[_0x1d51('0x5f')],_0x4a99ff,_[_0x1d51('0x60')](_0x158895[_0x1d51('0x5b')])):path[_0x1d51('0x5e')](config['root'],_0x4a99ff,_['toLower']('default_preferred.png'));var _0xa13c9d=_0x1d51('0x62')+_['upperFirst'](_0x1d51('0x5b'));if(_0x158895[_0xa13c9d]||!_0x47b76d[_0x1d51('0x64')]||!_0x47b76d['preferred']){_0x55b32e=path[_0x1d51('0x5e')](config[_0x1d51('0x5f')],_0x4a99ff,_[_0x1d51('0x60')]('default_preferred.png'));}if(!fs['existsSync'](_0x55b32e)){throw new db[(_0x1d51('0x1a'))][(_0x1d51('0x1b'))](_['upperFirst']('preferred')+'\x20not\x20found');}return _0x559034[_0x1d51('0x6f')](_0x55b32e);}})[_0x1d51('0x4e')](handleError(_0x559034,null));};exports[_0x1d51('0x70')]=function(_0x1d0061,_0x34fce3,_0x479b59){if(_0x1d0061[_0x1d51('0x57')]&&_0x1d0061['file'][_0x1d51('0x54')]){_0x1d0061[_0x1d51('0x52')][_0x1d51('0x69')]=_0x1d0061[_0x1d51('0x57')]['filename'];}return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0x1d0061[_0x1d51('0x50')]['id']}})[_0x1d51('0x1e')](handleEntityNotFound(_0x34fce3,null))[_0x1d51('0x1e')](saveUpdates(_0x1d0061[_0x1d51('0x52')],null))[_0x1d51('0x1e')](respondWithResult(_0x34fce3,null))[_0x1d51('0x4e')](handleError(_0x34fce3,null));};var utilLicense=require(_0x1d51('0x59'));exports[_0x1d51('0x71')]=function(_0x5147fa,_0x1a889d,_0x2038f5){var _0x510b5f='server/files/images/logos';var _0x3e977a={'custom':![]};return utilLicense[_0x1d51('0x68')]()['then'](function(_0x2013af){if(_0x2013af){_0x3e977a=_0x2013af;}return db[_0x1d51('0x4a')][_0x1d51('0x51')]({'where':{'id':_0x5147fa['params']['id']},'attributes':[_0x1d51('0x55'),_0x1d51('0x58'),_0x1d51('0x5b'),_0x1d51('0x69'),'defaultLogo',_0x1d51('0x5d'),_0x1d51('0x6a'),_0x1d51('0x6b')],'raw':!![]});})[_0x1d51('0x1e')](handleEntityNotFound(_0x1a889d,null))[_0x1d51('0x1e')](function(_0x1f8a5d){if(_0x1f8a5d){var _0x53a645=_0x1f8a5d[_0x1d51('0x69')]&&fs['existsSync'](path[_0x1d51('0x5e')](config['root'],_0x510b5f,_[_0x1d51('0x60')](_0x1f8a5d['favicon'])))?path[_0x1d51('0x5e')](config['root'],_0x510b5f,_[_0x1d51('0x60')](_0x1f8a5d['favicon'])):path[_0x1d51('0x5e')](config['root'],_0x510b5f,_[_0x1d51('0x60')]('default_favicon.ico'));var _0x3a5a90=_0x1d51('0x62')+_[_0x1d51('0x63')]('favicon');if(_0x1f8a5d[_0x3a5a90]||!_0x3e977a[_0x1d51('0x64')]){_0x53a645=path['join'](config['root'],_0x510b5f,_['toLower'](_0x1d51('0x72')));}if(!fs[_0x1d51('0x65')](_0x53a645)){throw new db[(_0x1d51('0x1a'))][(_0x1d51('0x1b'))](_['upperFirst'](_0x1d51('0x69'))+_0x1d51('0x66'));}return _0x1a889d[_0x1d51('0x6f')](_0x53a645);}})[_0x1d51('0x4e')](handleError(_0x1a889d,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 324dd69..b626c45 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 _0xfc93=['../../config/environment','exports','define','Setting','settings','../../config/logger','moment','request-promise'];(function(_0xb5b5e3,_0x3621fa){var _0x21f417=function(_0x5423fb){while(--_0x5423fb){_0xb5b5e3['push'](_0xb5b5e3['shift']());}};_0x21f417(++_0x3621fa);}(_0xfc93,0x145));var _0x3fc9=function(_0x8b8237,_0x12055d){_0x8b8237=_0x8b8237-0x0;var _0x4461f7=_0xfc93[_0x8b8237];return _0x4461f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3fc9('0x0'))('api');var moment=require(_0x3fc9('0x1'));var BPromise=require('bluebird');var rp=require(_0x3fc9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3fc9('0x3'));var attributes=require('./setting.attributes');module[_0x3fc9('0x4')]=function(_0xc10cd,_0x53ff0b){return _0xc10cd[_0x3fc9('0x5')](_0x3fc9('0x6'),attributes,{'tableName':_0x3fc9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff24=['util','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xff24,0x17c));var _0x4ff2=function(_0x5c575d,_0x354f54){_0x5c575d=_0x5c575d-0x0;var _0x37c3e5=_0xff24[_0x5c575d];return _0x37c3e5;};'use strict';var _=require('lodash');var util=require(_0x4ff2('0x0'));var logger=require('../../config/logger')(_0x4ff2('0x1'));var moment=require(_0x4ff2('0x2'));var BPromise=require('bluebird');var rp=require(_0x4ff2('0x3'));var fs=require('fs');var path=require(_0x4ff2('0x4'));var rimraf=require(_0x4ff2('0x5'));var config=require(_0x4ff2('0x6'));var attributes=require(_0x4ff2('0x7'));module[_0x4ff2('0x8')]=function(_0x1173c0,_0x2129a1){return _0x1173c0['define'](_0x4ff2('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 2275d4a..e96f494 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 _0xa224=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\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'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa224,0xd4));var _0x4a22=function(_0x4b6fca,_0x1bac3c){_0x4b6fca=_0x4b6fca-0x0;var _0x2577d3=_0xa224[_0x4b6fca];return _0x2577d3;};'use strict';var _=require(_0x4a22('0x0'));var util=require(_0x4a22('0x1'));var moment=require('moment');var BPromise=require(_0x4a22('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a22('0x3'));var db=require(_0x4a22('0x4'))['db'];var utils=require(_0x4a22('0x5'));var logger=require(_0x4a22('0x6'))(_0x4a22('0x7'));var config=require(_0x4a22('0x8'));var jayson=require(_0x4a22('0x9'));var client=jayson[_0x4a22('0xa')][_0x4a22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e5a47,_0x45e9a1,_0x4a2858){return new BPromise(function(_0x259448,_0x62337a){return client[_0x4a22('0xc')](_0x5e5a47,_0x4a2858)[_0x4a22('0xd')](function(_0x2e05d4){logger[_0x4a22('0xe')](_0x4a22('0xf'),_0x45e9a1,_0x4a22('0x10'));logger[_0x4a22('0x11')](_0x4a22('0x12'),_0x45e9a1,_0x4a22('0x10'),JSON[_0x4a22('0x13')](_0x2e05d4));if(_0x2e05d4['error']){if(_0x2e05d4[_0x4a22('0x14')][_0x4a22('0x15')]===0x1f4){logger[_0x4a22('0x14')]('Setting,\x20%s,\x20%s',_0x45e9a1,_0x2e05d4[_0x4a22('0x14')][_0x4a22('0x16')]);return _0x62337a(_0x2e05d4['error']['message']);}logger[_0x4a22('0x14')](_0x4a22('0xf'),_0x45e9a1,_0x2e05d4['error'][_0x4a22('0x16')]);return _0x259448(_0x2e05d4[_0x4a22('0x14')]['message']);}else{logger['info'](_0x4a22('0xf'),_0x45e9a1,_0x4a22('0x10'));_0x259448(_0x2e05d4[_0x4a22('0x17')]['message']);}})[_0x4a22('0x18')](function(_0x1beb1e){logger[_0x4a22('0x14')](_0x4a22('0xf'),_0x45e9a1,_0x1beb1e);_0x62337a(_0x1beb1e);});});} \ No newline at end of file +var _0x29ab=['../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f39da,_0x53cf8b){var _0x56d550=function(_0x15ccda){while(--_0x15ccda){_0x3f39da['push'](_0x3f39da['shift']());}};_0x56d550(++_0x53cf8b);}(_0x29ab,0x189));var _0xb29a=function(_0x436d63,_0x194f8b){_0x436d63=_0x436d63-0x0;var _0x200e83=_0x29ab[_0x436d63];return _0x200e83;};'use strict';var _=require('lodash');var util=require(_0xb29a('0x0'));var moment=require(_0xb29a('0x1'));var BPromise=require(_0xb29a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb29a('0x3'));var db=require(_0xb29a('0x4'))['db'];var utils=require(_0xb29a('0x5'));var logger=require(_0xb29a('0x6'))('rpc');var config=require(_0xb29a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb29a('0x8')][_0xb29a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x352666,_0x39c1d6,_0xdaf432){return new BPromise(function(_0x31abd3,_0x28c7a0){return client['request'](_0x352666,_0xdaf432)[_0xb29a('0xa')](function(_0x148df6){logger[_0xb29a('0xb')](_0xb29a('0xc'),_0x39c1d6,_0xb29a('0xd'));logger[_0xb29a('0xe')](_0xb29a('0xf'),_0x39c1d6,'request\x20sent',JSON[_0xb29a('0x10')](_0x148df6));if(_0x148df6['error']){if(_0x148df6[_0xb29a('0x11')]['code']===0x1f4){logger[_0xb29a('0x11')](_0xb29a('0xc'),_0x39c1d6,_0x148df6[_0xb29a('0x11')]['message']);return _0x28c7a0(_0x148df6[_0xb29a('0x11')][_0xb29a('0x12')]);}logger[_0xb29a('0x11')](_0xb29a('0xc'),_0x39c1d6,_0x148df6[_0xb29a('0x11')][_0xb29a('0x12')]);return _0x31abd3(_0x148df6[_0xb29a('0x11')][_0xb29a('0x12')]);}else{logger['info'](_0xb29a('0xc'),_0x39c1d6,_0xb29a('0xd'));_0x31abd3(_0x148df6['result'][_0xb29a('0x12')]);}})[_0xb29a('0x13')](function(_0x5940b6){logger[_0xb29a('0x11')](_0xb29a('0xc'),_0x39c1d6,_0x5940b6);_0x28c7a0(_0x5940b6);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3572adf..7039e6f 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 _0xc903=['/:id','show','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','addDisposition','post','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeAgents','exports','multer','path','Router','../../components/interaction/service','./smsAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0xe25571,_0x5aa884){var _0x28b1ef=function(_0x3eb560){while(--_0x3eb560){_0xe25571['push'](_0xe25571['shift']());}};_0x28b1ef(++_0x5aa884);}(_0xc903,0x177));var _0x3c90=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0xc903[_0xd578cb];return _0x775533;};'use strict';var multer=require(_0x3c90('0x0'));var util=require('util');var path=require(_0x3c90('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3c90('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3c90('0x3'));var config=require('../../config/environment');var controller=require(_0x3c90('0x4'));router[_0x3c90('0x5')]('/',auth['isAuthenticated'](),controller[_0x3c90('0x6')]);router[_0x3c90('0x5')](_0x3c90('0x7'),auth[_0x3c90('0x8')](),controller[_0x3c90('0x9')]);router[_0x3c90('0x5')](_0x3c90('0xa'),auth[_0x3c90('0x8')](),controller[_0x3c90('0xb')]);router[_0x3c90('0x5')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x3c90('0xc'),auth[_0x3c90('0x8')](),controller[_0x3c90('0xd')]);router[_0x3c90('0x5')]('/:id/applications',auth[_0x3c90('0x8')](),controller[_0x3c90('0xe')]);router[_0x3c90('0x5')](_0x3c90('0xf'),auth[_0x3c90('0x8')](),controller[_0x3c90('0x10')]);router[_0x3c90('0x5')](_0x3c90('0x11'),controller['statusGet']);router[_0x3c90('0x5')](_0x3c90('0x12'),auth[_0x3c90('0x8')](),controller[_0x3c90('0x13')]);router['post']('/',auth[_0x3c90('0x8')](),controller['create']);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3c90('0x14')]);router[_0x3c90('0x15')](_0x3c90('0xc'),auth[_0x3c90('0x8')](),controller['addAnswer']);router[_0x3c90('0x15')](_0x3c90('0x16'),controller[_0x3c90('0x17')]);router[_0x3c90('0x15')](_0x3c90('0x18'),auth['isAuthenticated'](),controller[_0x3c90('0x19')]);router[_0x3c90('0x15')](_0x3c90('0x1a'),auth[_0x3c90('0x8')](),controller[_0x3c90('0x1b')]);router[_0x3c90('0x15')]('/:id/status',controller['status']);router[_0x3c90('0x15')]('/:id/users',auth[_0x3c90('0x8')](),controller[_0x3c90('0x1c')]);router[_0x3c90('0x1d')](_0x3c90('0xa'),auth[_0x3c90('0x8')](),controller[_0x3c90('0x1e')]);router[_0x3c90('0x1f')](_0x3c90('0xa'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x3c90('0x8')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x3c90('0x8')](),controller[_0x3c90('0x20')]);router[_0x3c90('0x1f')](_0x3c90('0x12'),auth[_0x3c90('0x8')](),controller[_0x3c90('0x21')]);module[_0x3c90('0x22')]=router; \ No newline at end of file +var _0xe2d2=['getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','notify','addApplications','/:id/send','send','status','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x49702e,_0x5c6505){var _0x44ef91=function(_0x5c8382){while(--_0x5c8382){_0x49702e['push'](_0x49702e['shift']());}};_0x44ef91(++_0x5c6505);}(_0xe2d2,0x1e8));var _0x2e2d=function(_0x4a4d97,_0x31087f){_0x4a4d97=_0x4a4d97-0x0;var _0x5b8d7f=_0xe2d2[_0x4a4d97];return _0x5b8d7f;};'use strict';var multer=require(_0x2e2d('0x0'));var util=require(_0x2e2d('0x1'));var path=require(_0x2e2d('0x2'));var timeout=require(_0x2e2d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2e2d('0x4'));var interaction=require(_0x2e2d('0x5'));var config=require('../../config/environment');var controller=require(_0x2e2d('0x6'));router[_0x2e2d('0x7')]('/',auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x9')]);router[_0x2e2d('0x7')]('/describe',auth[_0x2e2d('0x8')](),controller[_0x2e2d('0xa')]);router[_0x2e2d('0x7')](_0x2e2d('0xb'),auth[_0x2e2d('0x8')](),controller['show']);router[_0x2e2d('0x7')](_0x2e2d('0xc'),auth[_0x2e2d('0x8')](),controller[_0x2e2d('0xd')]);router[_0x2e2d('0x7')](_0x2e2d('0xe'),auth[_0x2e2d('0x8')](),controller[_0x2e2d('0xf')]);router[_0x2e2d('0x7')](_0x2e2d('0x10'),auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x11')]);router[_0x2e2d('0x7')](_0x2e2d('0x12'),auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x13')]);router[_0x2e2d('0x7')](_0x2e2d('0x14'),controller[_0x2e2d('0x15')]);router[_0x2e2d('0x7')](_0x2e2d('0x16'),auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x17')]);router[_0x2e2d('0x18')]('/',auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x19')]);router[_0x2e2d('0x18')](_0x2e2d('0xc'),auth[_0x2e2d('0x8')](),controller['addDisposition']);router[_0x2e2d('0x18')](_0x2e2d('0xe'),auth[_0x2e2d('0x8')](),controller['addAnswer']);router[_0x2e2d('0x18')]('/:id/notify',controller[_0x2e2d('0x1a')]);router[_0x2e2d('0x18')]('/:id/applications',auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x1b')]);router[_0x2e2d('0x18')](_0x2e2d('0x1c'),auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x1d')]);router[_0x2e2d('0x18')]('/:id/status',controller[_0x2e2d('0x1e')]);router[_0x2e2d('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x2e2d('0x1f')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2e2d('0x20')]);router[_0x2e2d('0x21')](_0x2e2d('0xb'),auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x22')]);router[_0x2e2d('0x21')](_0x2e2d('0xc'),auth[_0x2e2d('0x8')](),controller[_0x2e2d('0x23')]);router['delete'](_0x2e2d('0xe'),auth['isAuthenticated'](),controller[_0x2e2d('0x24')]);router[_0x2e2d('0x21')](_0x2e2d('0x16'),auth['isAuthenticated'](),controller[_0x2e2d('0x25')]);module[_0x2e2d('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index eab0728..6584dec 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 _0xa0ef=['name','generate','twilio','skebby','connectel','clicksend','plivo','csc','infobip','ENUM','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','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x1973a3,_0x53bee8){var _0x229ecf=function(_0x4aa302){while(--_0x4aa302){_0x1973a3['push'](_0x1973a3['shift']());}};_0x229ecf(++_0x53bee8);}(_0xa0ef,0x183));var _0xfa0e=function(_0x11d85a,_0x4a908e){_0x11d85a=_0x11d85a-0x0;var _0x5b5638=_0xa0ef[_0x11d85a];return _0x5b5638;};'use strict';var Sequelize=require(_0xfa0e('0x0'));var rs=require(_0xfa0e('0x1'));module[_0xfa0e('0x2')]={'name':{'type':Sequelize[_0xfa0e('0x3')],'unique':_0xfa0e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xfa0e('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xfa0e('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xfa0e('0x5')]();}},'phone':{'type':Sequelize[_0xfa0e('0x3')]},'type':{'type':Sequelize['ENUM'](_0xfa0e('0x6'),_0xfa0e('0x7'),_0xfa0e('0x8'),_0xfa0e('0x9'),_0xfa0e('0xa'),'clickatell',_0xfa0e('0xb'),_0xfa0e('0xc'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xfa0e('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xfa0e('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfa0e('0x3')]},'password':{'type':Sequelize[_0xfa0e('0x3')]},'apiKey':{'type':Sequelize[_0xfa0e('0x3')]},'senderString':{'type':Sequelize[_0xfa0e('0x3')]},'deliveryReport':{'type':Sequelize[_0xfa0e('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfa0e('0xf')],'defaultValue':function(){return _0xfa0e('0x10');}},'notificationSound':{'type':Sequelize[_0xfa0e('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa0e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfa0e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfa0e('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfa0e('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfa0e('0x13'),'set':function(_0x4a492a){if(!_0x4a492a)this[_0xfa0e('0x14')](_0xfa0e('0x15'),null);this[_0xfa0e('0x14')](_0xfa0e('0x16'),_0x4a492a);}}}; \ No newline at end of file +var _0x4cad=['plivo','clickatell','csc','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','randomstring','exports','STRING','ENUM','twilio','skebby','connectel','clicksend'];(function(_0x448e49,_0x1fc64c){var _0x33a6b8=function(_0x2a831c){while(--_0x2a831c){_0x448e49['push'](_0x448e49['shift']());}};_0x33a6b8(++_0x1fc64c);}(_0x4cad,0x1b9));var _0xd4ca=function(_0x250154,_0x463253){_0x250154=_0x250154-0x0;var _0x4458c7=_0x4cad[_0x250154];return _0x4458c7;};'use strict';var Sequelize=require(_0xd4ca('0x0'));var rs=require(_0xd4ca('0x1'));module[_0xd4ca('0x2')]={'name':{'type':Sequelize[_0xd4ca('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xd4ca('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xd4ca('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd4ca('0x3')]},'type':{'type':Sequelize[_0xd4ca('0x4')](_0xd4ca('0x5'),_0xd4ca('0x6'),_0xd4ca('0x7'),_0xd4ca('0x8'),_0xd4ca('0x9'),_0xd4ca('0xa'),_0xd4ca('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xd4ca('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xd4ca('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xd4ca('0x3')]},'password':{'type':Sequelize[_0xd4ca('0x3')]},'apiKey':{'type':Sequelize[_0xd4ca('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xd4ca('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd4ca('0xc')],'defaultValue':function(){return _0xd4ca('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd4ca('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd4ca('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd4ca('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd4ca('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd4ca('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd4ca('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd4ca('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5aca2b){if(!_0x5aca2b)this[_0xd4ca('0x11')]('mandatoryDispositionPauseId',null);this[_0xd4ca('0x11')]('mandatoryDisposition',_0x5aca2b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ca641c8..f2afe95 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x1f89a7,_0x383e44){var _0x462dc3=function(_0x2dfaf8){while(--_0x2dfaf8){_0x1f89a7['push'](_0x1f89a7['shift']());}};_0x462dc3(++_0x383e44);}(_0x7a54,0x106));var _0x47a5=function(_0x2d0bac,_0x5e9e4c){_0x2d0bac=_0x2d0bac-0x0;var _0x55a174=_0x7a54[_0x2d0bac];return _0x55a174;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file +var _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(_0xa9f5f5,_0x3c0e1b){var _0x1b5b56=function(_0x4a5144){while(--_0x4a5144){_0xa9f5f5['push'](_0xa9f5f5['shift']());}};_0x1b5b56(++_0x3c0e1b);}(_0x7a54,0x106));var _0x47a5=function(_0x536104,_0x155aca){_0x536104=_0x536104-0x0;var _0x7a0ecc=_0x7a54[_0x536104];return _0x7a0ecc;};'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 e4a757e..216a84b 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 _0xcc6d=['emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x10bd94,_0x46b509){var _0x364677=function(_0x417683){while(--_0x417683){_0x10bd94['push'](_0x10bd94['shift']());}};_0x364677(++_0x46b509);}(_0xcc6d,0x73));var _0xdcc6=function(_0x11348e,_0x7e5fc6){_0x11348e=_0x11348e-0x0;var _0x59cdcb=_0xcc6d[_0x11348e];return _0x59cdcb;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xdcc6('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdcc6('0x1')](0x0);var events={'afterCreate':_0xdcc6('0x2'),'afterUpdate':_0xdcc6('0x3'),'afterDestroy':_0xdcc6('0x4')};function emitEvent(_0x15d043){return function(_0x3607ad,_0x5f07af,_0x44c3c7){SmsAccountEvents[_0xdcc6('0x5')](_0x15d043+':'+_0x3607ad['id'],_0x3607ad);SmsAccountEvents['emit'](_0x15d043,_0x3607ad);_0x44c3c7(null);};}for(var e in events){if(events[_0xdcc6('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xdcc6('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x1234=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1582fe,_0x4fdf8b){var _0x15a7cc=function(_0x184740){while(--_0x184740){_0x1582fe['push'](_0x1582fe['shift']());}};_0x15a7cc(++_0x4fdf8b);}(_0x1234,0x119));var _0x4123=function(_0x3d1db4,_0x59f60d){_0x3d1db4=_0x3d1db4-0x0;var _0x196e69=_0x1234[_0x3d1db4];return _0x196e69;};'use strict';var EventEmitter=require(_0x4123('0x0'));var SmsAccount=require(_0x4123('0x1'))['db'][_0x4123('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4123('0x3')](0x0);var events={'afterCreate':_0x4123('0x4'),'afterUpdate':_0x4123('0x5'),'afterDestroy':_0x4123('0x6')};function emitEvent(_0x47a948){return function(_0x3a5076,_0x59265a,_0x31e71d){SmsAccountEvents[_0x4123('0x7')](_0x47a948+':'+_0x3a5076['id'],_0x3a5076);SmsAccountEvents[_0x4123('0x7')](_0x47a948,_0x3a5076);_0x31e71d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x4123('0x8')](e,emitEvent(event));}}module[_0x4123('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 4787dbb..4217fd5 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(_0x8d3be2,_0x4d9c90){var _0x504662=function(_0x595954){while(--_0x595954){_0x8d3be2['push'](_0x8d3be2['shift']());}};_0x504662(++_0x4d9c90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x1f15b9,_0x3b4524){var _0x12b5db=function(_0x154be9){while(--_0x154be9){_0x1f15b9['push'](_0x1f15b9['shift']());}};_0x12b5db(++_0x3b4524);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 c3290ca..e2edf06 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 _0x8258=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','options','raw','include','map','model','attributes','then','ShowSmsAccount','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','debug'];(function(_0x2a6252,_0x1b38ff){var _0x108c1b=function(_0x313611){while(--_0x313611){_0x2a6252['push'](_0x2a6252['shift']());}};_0x108c1b(++_0x1b38ff);}(_0x8258,0x1c8));var _0x8825=function(_0x20fc30,_0x224be4){_0x20fc30=_0x20fc30-0x0;var _0x508068=_0x8258[_0x20fc30];return _0x508068;};'use strict';var _=require('lodash');var util=require(_0x8825('0x0'));var moment=require(_0x8825('0x1'));var BPromise=require('bluebird');var rs=require(_0x8825('0x2'));var fs=require('fs');var Redis=require(_0x8825('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8825('0x4'));var logger=require(_0x8825('0x5'))(_0x8825('0x6'));var config=require(_0x8825('0x7'));var jayson=require(_0x8825('0x8'));var client=jayson[_0x8825('0x9')][_0x8825('0xa')]({'port':0x232a});config[_0x8825('0xb')]=_['defaults'](config[_0x8825('0xb')],{'host':_0x8825('0xc'),'port':0x18eb});var socket=require(_0x8825('0xd'))(new Redis(config[_0x8825('0xb')]));require(_0x8825('0xe'))[_0x8825('0xf')](socket);function respondWithRpcPromise(_0x5f3b38,_0x43d52b,_0x18991a){return new BPromise(function(_0x58e142,_0x11dfdb){return client[_0x8825('0x10')](_0x5f3b38,_0x18991a)['then'](function(_0xbbd2bd){logger[_0x8825('0x11')](_0x8825('0x12'),_0x43d52b,'request\x20sent');logger[_0x8825('0x13')](_0x8825('0x14'),_0x43d52b,'request\x20sent',JSON[_0x8825('0x15')](_0xbbd2bd));if(_0xbbd2bd['error']){if(_0xbbd2bd['error'][_0x8825('0x16')]===0x1f4){logger['error'](_0x8825('0x12'),_0x43d52b,_0xbbd2bd[_0x8825('0x17')]['message']);return _0x11dfdb(_0xbbd2bd[_0x8825('0x17')][_0x8825('0x18')]);}logger[_0x8825('0x17')](_0x8825('0x12'),_0x43d52b,_0xbbd2bd[_0x8825('0x17')][_0x8825('0x18')]);return _0x58e142(_0xbbd2bd['error'][_0x8825('0x18')]);}else{logger['info'](_0x8825('0x12'),_0x43d52b,'request\x20sent');_0x58e142(_0xbbd2bd['result'][_0x8825('0x18')]);}})[_0x8825('0x19')](function(_0x17d3c8){logger[_0x8825('0x17')](_0x8825('0x12'),_0x43d52b,_0x17d3c8);_0x11dfdb(_0x17d3c8);});});}exports['ShowSmsAccount']=function(_0x331c8c){var _0x3efd9a=this;return new Promise(function(_0x2e5e49,_0x2806f4){return db['SmsAccount']['find']({'raw':_0x331c8c['options']?_0x331c8c[_0x8825('0x1a')][_0x8825('0x1b')]===undefined?!![]:![]:!![],'where':_0x331c8c[_0x8825('0x1a')]?_0x331c8c[_0x8825('0x1a')]['where']||null:null,'attributes':_0x331c8c[_0x8825('0x1a')]?_0x331c8c[_0x8825('0x1a')]['attributes']||null:null,'include':_0x331c8c[_0x8825('0x1a')]?_0x331c8c[_0x8825('0x1a')][_0x8825('0x1c')]?_[_0x8825('0x1d')](_0x331c8c[_0x8825('0x1a')][_0x8825('0x1c')],function(_0xa155d8){return{'model':db[_0xa155d8[_0x8825('0x1e')]],'as':_0xa155d8['as'],'attributes':_0xa155d8[_0x8825('0x1f')],'include':_0xa155d8[_0x8825('0x1c')]?_['map'](_0xa155d8[_0x8825('0x1c')],function(_0x50a889){return{'model':db[_0x50a889[_0x8825('0x1e')]],'as':_0x50a889['as'],'attributes':_0x50a889[_0x8825('0x1f')],'include':_0x50a889[_0x8825('0x1c')]?_[_0x8825('0x1d')](_0x50a889['include'],function(_0x5a76ab){return{'model':db[_0x5a76ab['model']],'as':_0x5a76ab['as'],'attributes':_0x5a76ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x8825('0x20')](function(_0xe01776){logger['info'](_0x8825('0x21'),_0x331c8c);logger[_0x8825('0x13')](_0x8825('0x21'),_0x331c8c,JSON['stringify'](_0xe01776));_0x2e5e49(_0xe01776);})[_0x8825('0x19')](function(_0x1f16cf){logger[_0x8825('0x17')]('ShowSmsAccount',_0x1f16cf[_0x8825('0x18')],_0x331c8c);_0x2806f4(_0x3efd9a[_0x8825('0x17')](0x1f4,_0x1f16cf[_0x8825('0x18')]));});});}; \ No newline at end of file +var _0x61b3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','raw','options','where','attributes','include','model','map','util','bluebird'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x61b3,0xd0));var _0x361b=function(_0x461b16,_0x28710e){_0x461b16=_0x461b16-0x0;var _0x327e71=_0x61b3[_0x461b16];return _0x327e71;};'use strict';var _=require('lodash');var util=require(_0x361b('0x0'));var moment=require('moment');var BPromise=require(_0x361b('0x1'));var rs=require(_0x361b('0x2'));var fs=require('fs');var Redis=require(_0x361b('0x3'));var db=require(_0x361b('0x4'))['db'];var utils=require(_0x361b('0x5'));var logger=require(_0x361b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x361b('0x7'));var client=jayson['client'][_0x361b('0x8')]({'port':0x232a});config[_0x361b('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x361b('0xa'))(new Redis(config[_0x361b('0x9')]));require(_0x361b('0xb'))[_0x361b('0xc')](socket);function respondWithRpcPromise(_0x1ab05a,_0x8c57e5,_0x393be5){return new BPromise(function(_0x4d4551,_0x4f24e4){return client[_0x361b('0xd')](_0x1ab05a,_0x393be5)[_0x361b('0xe')](function(_0x32ed36){logger[_0x361b('0xf')](_0x361b('0x10'),_0x8c57e5,'request\x20sent');logger[_0x361b('0x11')](_0x361b('0x12'),_0x8c57e5,_0x361b('0x13'),JSON[_0x361b('0x14')](_0x32ed36));if(_0x32ed36[_0x361b('0x15')]){if(_0x32ed36['error'][_0x361b('0x16')]===0x1f4){logger[_0x361b('0x15')](_0x361b('0x10'),_0x8c57e5,_0x32ed36[_0x361b('0x15')]['message']);return _0x4f24e4(_0x32ed36[_0x361b('0x15')]['message']);}logger[_0x361b('0x15')](_0x361b('0x10'),_0x8c57e5,_0x32ed36[_0x361b('0x15')][_0x361b('0x17')]);return _0x4d4551(_0x32ed36['error'][_0x361b('0x17')]);}else{logger[_0x361b('0xf')](_0x361b('0x10'),_0x8c57e5,'request\x20sent');_0x4d4551(_0x32ed36[_0x361b('0x18')][_0x361b('0x17')]);}})[_0x361b('0x19')](function(_0x945a3d){logger[_0x361b('0x15')](_0x361b('0x10'),_0x8c57e5,_0x945a3d);_0x4f24e4(_0x945a3d);});});}exports[_0x361b('0x1a')]=function(_0x9e8716){var _0x157fda=this;return new Promise(function(_0x42fd27,_0x3bce88){return db[_0x361b('0x1b')]['find']({'raw':_0x9e8716['options']?_0x9e8716['options'][_0x361b('0x1c')]===undefined?!![]:![]:!![],'where':_0x9e8716[_0x361b('0x1d')]?_0x9e8716[_0x361b('0x1d')][_0x361b('0x1e')]||null:null,'attributes':_0x9e8716[_0x361b('0x1d')]?_0x9e8716['options'][_0x361b('0x1f')]||null:null,'include':_0x9e8716[_0x361b('0x1d')]?_0x9e8716[_0x361b('0x1d')][_0x361b('0x20')]?_['map'](_0x9e8716[_0x361b('0x1d')][_0x361b('0x20')],function(_0x22470c){return{'model':db[_0x22470c[_0x361b('0x21')]],'as':_0x22470c['as'],'attributes':_0x22470c[_0x361b('0x1f')],'include':_0x22470c[_0x361b('0x20')]?_[_0x361b('0x22')](_0x22470c[_0x361b('0x20')],function(_0x1e0b01){return{'model':db[_0x1e0b01[_0x361b('0x21')]],'as':_0x1e0b01['as'],'attributes':_0x1e0b01[_0x361b('0x1f')],'include':_0x1e0b01[_0x361b('0x20')]?_['map'](_0x1e0b01[_0x361b('0x20')],function(_0x3214c5){return{'model':db[_0x3214c5[_0x361b('0x21')]],'as':_0x3214c5['as'],'attributes':_0x3214c5[_0x361b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x361b('0xe')](function(_0x30109f){logger[_0x361b('0xf')](_0x361b('0x1a'),_0x9e8716);logger[_0x361b('0x11')](_0x361b('0x1a'),_0x9e8716,JSON['stringify'](_0x30109f));_0x42fd27(_0x30109f);})[_0x361b('0x19')](function(_0x377dfb){logger[_0x361b('0x15')](_0x361b('0x1a'),_0x377dfb['message'],_0x9e8716);_0x3bce88(_0x157fda[_0x361b('0x15')](0x1f4,_0x377dfb[_0x361b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 09f3b8e..8f1ea65 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 _0x79e2=['register','length','smsAccount:','./smsAccount.events','remove','update','removeListener'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x79e2,0x1c3));var _0x279e=function(_0x152c47,_0x229654){_0x152c47=_0x152c47-0x0;var _0x137189=_0x79e2[_0x152c47];return _0x137189;};'use strict';var SmsAccountEvents=require(_0x279e('0x0'));var events=['save',_0x279e('0x1'),_0x279e('0x2')];function createListener(_0x3e7eba,_0x5d7e6d){return function(_0x31f08e){_0x5d7e6d['emit'](_0x3e7eba,_0x31f08e);};}function removeListener(_0x1d99c3,_0x6ea57f){return function(){SmsAccountEvents[_0x279e('0x3')](_0x1d99c3,_0x6ea57f);};}exports[_0x279e('0x4')]=function(_0x4b7028){for(var _0x5a2f72=0x0,_0x1c6b6f=events[_0x279e('0x5')];_0x5a2f72<_0x1c6b6f;_0x5a2f72++){var _0x4696ad=events[_0x5a2f72];var _0x3d2176=createListener(_0x279e('0x6')+_0x4696ad,_0x4b7028);SmsAccountEvents['on'](_0x4696ad,_0x3d2176);}}; \ No newline at end of file +var _0x932a=['remove','update','removeListener','register','length','smsAccount:','./smsAccount.events','save'];(function(_0x22e714,_0x38d207){var _0x1955ab=function(_0x173287){while(--_0x173287){_0x22e714['push'](_0x22e714['shift']());}};_0x1955ab(++_0x38d207);}(_0x932a,0x96));var _0xa932=function(_0x19fee8,_0x17142b){_0x19fee8=_0x19fee8-0x0;var _0xe6fd96=_0x932a[_0x19fee8];return _0xe6fd96;};'use strict';var SmsAccountEvents=require(_0xa932('0x0'));var events=[_0xa932('0x1'),_0xa932('0x2'),_0xa932('0x3')];function createListener(_0x2a511f,_0x589449){return function(_0x402a1d){_0x589449['emit'](_0x2a511f,_0x402a1d);};}function removeListener(_0x32ba3c,_0x5ea854){return function(){SmsAccountEvents[_0xa932('0x4')](_0x32ba3c,_0x5ea854);};}exports[_0xa932('0x5')]=function(_0x56cdd4){for(var _0x1f4055=0x0,_0x44d79d=events[_0xa932('0x6')];_0x1f4055<_0x44d79d;_0x1f4055++){var _0x434792=events[_0x1f4055];var _0x2f2557=createListener(_0xa932('0x7')+_0x434792,_0x56cdd4);SmsAccountEvents['on'](_0x434792,_0x2f2557);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 5cda2c6..91c53d2 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 _0x15ce=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x15ce,0x105));var _0xe15c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15ce[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xe15c('0x0'));var path=require(_0xe15c('0x1'));var timeout=require(_0xe15c('0x2'));var express=require(_0xe15c('0x3'));var router=express[_0xe15c('0x4')]();var auth=require(_0xe15c('0x5'));var interaction=require(_0xe15c('0x6'));var config=require(_0xe15c('0x7'));var controller=require(_0xe15c('0x8'));router[_0xe15c('0x9')]('/',auth[_0xe15c('0xa')](),controller[_0xe15c('0xb')]);router[_0xe15c('0x9')](_0xe15c('0xc'),auth[_0xe15c('0xa')](),controller[_0xe15c('0xd')]);router[_0xe15c('0xe')]('/',auth['isAuthenticated'](),controller[_0xe15c('0xf')]);router['put'](_0xe15c('0xc'),auth[_0xe15c('0xa')](),controller[_0xe15c('0x10')]);router[_0xe15c('0x11')]('/:id',auth[_0xe15c('0xa')](),controller[_0xe15c('0x12')]);module[_0xe15c('0x13')]=router; \ No newline at end of file +var _0xda36=['put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','post','create'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xda36,0x69));var _0x6da3=function(_0x5760dc,_0x3828c3){_0x5760dc=_0x5760dc-0x0;var _0x446ae0=_0xda36[_0x5760dc];return _0x446ae0;};'use strict';var multer=require('multer');var util=require(_0x6da3('0x0'));var path=require(_0x6da3('0x1'));var timeout=require(_0x6da3('0x2'));var express=require(_0x6da3('0x3'));var router=express[_0x6da3('0x4')]();var auth=require(_0x6da3('0x5'));var interaction=require(_0x6da3('0x6'));var config=require(_0x6da3('0x7'));var controller=require(_0x6da3('0x8'));router[_0x6da3('0x9')]('/',auth[_0x6da3('0xa')](),controller[_0x6da3('0xb')]);router[_0x6da3('0x9')]('/:id',auth[_0x6da3('0xa')](),controller[_0x6da3('0xc')]);router[_0x6da3('0xd')]('/',auth[_0x6da3('0xa')](),controller[_0x6da3('0xe')]);router[_0x6da3('0xf')](_0x6da3('0x10'),auth[_0x6da3('0xa')](),controller[_0x6da3('0x11')]);router[_0x6da3('0x12')](_0x6da3('0x10'),auth[_0x6da3('0xa')](),controller[_0x6da3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 61e8730..92188b6 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 _0xda69=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xda69,0x1e5));var _0x9da6=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0xda69[_0xa3463d];return _0x50fd67;};'use strict';var Sequelize=require(_0x9da6('0x0'));module[_0x9da6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9da6('0x2')},'appdata':{'type':Sequelize[_0x9da6('0x3')]()},'description':{'type':Sequelize[_0x9da6('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9da6('0x5')}}; \ No newline at end of file +var _0x9f4b=['sequelize','exports','STRING','TEXT'];(function(_0x1eb501,_0xa2cf7b){var _0x1f6bfd=function(_0x4b7eeb){while(--_0x4b7eeb){_0x1eb501['push'](_0x1eb501['shift']());}};_0x1f6bfd(++_0xa2cf7b);}(_0x9f4b,0x188));var _0xb9f4=function(_0x4367d9,_0x1bbd18){_0x4367d9=_0x4367d9-0x0;var _0x25d3a2=_0x9f4b[_0x4367d9];return _0x25d3a2;};'use strict';var Sequelize=require(_0xb9f4('0x0'));module[_0xb9f4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb9f4('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb9f4('0x3')]()},'description':{'type':Sequelize[_0xb9f4('0x2')]},'interval':{'type':Sequelize[_0xb9f4('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a130233..270045c 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 _0x1eba=['json','count','offset','limit','set','apply','reject','save','then','error','stack','name','index','SmsApplication','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','create','body','update','find','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x1eba[_0x4c98b9];return _0x3a257a;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e28e7,_0x39b4a3){_0x39b4a3=_0x39b4a3||0xcc;return function(_0x5df92d){if(_0x5df92d){return _0x1e28e7[_0xa1eb('0x18')](_0x39b4a3);}return _0x1e28e7['status'](_0x39b4a3)['end']();};}function respondWithResult(_0x35a353,_0x4c7983){_0x4c7983=_0x4c7983||0xc8;return function(_0x25d058){if(_0x25d058){return _0x35a353[_0xa1eb('0x19')](_0x4c7983)[_0xa1eb('0x1a')](_0x25d058);}};}function respondWithFilteredResult(_0x2877cb,_0x3cd675){return function(_0x44f37d){if(_0x44f37d){var _0x1c858c=_0x44f37d[_0xa1eb('0x1b')],_0x45d6dd=_0x3cd675['offset'],_0x211e42=_0x3cd675[_0xa1eb('0x1c')]+_0x3cd675[_0xa1eb('0x1d')],_0x4aa527;if(_0x211e42>=_0x1c858c){_0x211e42=_0x1c858c;_0x4aa527=0xc8;}else{_0x4aa527=0xce;}_0x2877cb[_0xa1eb('0x19')](_0x4aa527);return _0x2877cb[_0xa1eb('0x1e')]('Content-Range',_0x45d6dd+'-'+_0x211e42+'/'+_0x1c858c)[_0xa1eb('0x1a')](_0x44f37d);}return null;};}function patchUpdates(_0x22cd44){return function(_0x83ed15){try{jsonpatch[_0xa1eb('0x1f')](_0x83ed15,_0x22cd44,!![]);}catch(_0x3d0961){return BPromise[_0xa1eb('0x20')](_0x3d0961);}return _0x83ed15[_0xa1eb('0x21')]();};}function saveUpdates(_0x166f7f,_0x4fc14a){return function(_0x137e2c){if(_0x137e2c){return _0x137e2c['update'](_0x166f7f)[_0xa1eb('0x22')](function(_0x215e7f){return _0x215e7f;});}return null;};}function removeEntity(_0x350a08,_0x250f99){return function(_0x5e7a34){if(_0x5e7a34){return _0x5e7a34['destroy']()[_0xa1eb('0x22')](function(){_0x350a08[_0xa1eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x437b2a,_0x250728){return function(_0x258d3a){if(!_0x258d3a){_0x437b2a[_0xa1eb('0x18')](0x194);}return _0x258d3a;};}function handleError(_0x23b49e,_0x1c59e1){_0x1c59e1=_0x1c59e1||0x1f4;return function(_0x33271e){logger[_0xa1eb('0x23')](_0x33271e[_0xa1eb('0x24')]);if(_0x33271e[_0xa1eb('0x25')]){delete _0x33271e[_0xa1eb('0x25')];}_0x23b49e[_0xa1eb('0x19')](_0x1c59e1)['send'](_0x33271e);};}exports[_0xa1eb('0x26')]=function(_0xbd5517,_0x491f37){var _0x2680c0={},_0x4e2aa7={},_0x3aae71={'count':0x0,'rows':[]};var _0x2d31d1=_['map'](db[_0xa1eb('0x27')][_0xa1eb('0x28')],function(_0x136835){return{'name':_0x136835['fieldName'],'type':_0x136835[_0xa1eb('0x29')][_0xa1eb('0x2a')]};});_0x4e2aa7['model']=_[_0xa1eb('0x2b')](_0x2d31d1,_0xa1eb('0x25'));_0x4e2aa7[_0xa1eb('0x2c')]=_[_0xa1eb('0x2d')](_0xbd5517[_0xa1eb('0x2c')]);_0x4e2aa7['filters']=_[_0xa1eb('0x2e')](_0x4e2aa7[_0xa1eb('0x2f')],_0x4e2aa7[_0xa1eb('0x2c')]);_0x2680c0[_0xa1eb('0x30')]=_[_0xa1eb('0x2e')](_0x4e2aa7[_0xa1eb('0x2f')],qs[_0xa1eb('0x31')](_0xbd5517[_0xa1eb('0x2c')][_0xa1eb('0x31')]));_0x2680c0[_0xa1eb('0x30')]=_0x2680c0[_0xa1eb('0x30')]['length']?_0x2680c0['attributes']:_0x4e2aa7[_0xa1eb('0x2f')];if(!_0xbd5517[_0xa1eb('0x2c')][_0xa1eb('0x32')](_0xa1eb('0x33'))){_0x2680c0[_0xa1eb('0x1d')]=qs['limit'](_0xbd5517['query'][_0xa1eb('0x1d')]);_0x2680c0[_0xa1eb('0x1c')]=qs['offset'](_0xbd5517['query'][_0xa1eb('0x1c')]);}_0x2680c0['order']=qs[_0xa1eb('0x34')](_0xbd5517['query'][_0xa1eb('0x34')]);_0x2680c0[_0xa1eb('0x35')]=qs[_0xa1eb('0x36')](_['pick'](_0xbd5517[_0xa1eb('0x2c')],_0x4e2aa7[_0xa1eb('0x36')]),_0x2d31d1);if(_0xbd5517[_0xa1eb('0x2c')]['filter']){_0x2680c0[_0xa1eb('0x35')]=_[_0xa1eb('0x37')](_0x2680c0[_0xa1eb('0x35')],{'$or':_[_0xa1eb('0x2b')](_0x2d31d1,function(_0x3c3982){if(_0x3c3982['type']!==_0xa1eb('0x38')){var _0x28cfa3={};_0x28cfa3[_0x3c3982[_0xa1eb('0x25')]]={'$like':'%'+_0xbd5517[_0xa1eb('0x2c')][_0xa1eb('0x39')]+'%'};return _0x28cfa3;}})});}_0x2680c0=_[_0xa1eb('0x37')]({},_0x2680c0,_0xbd5517[_0xa1eb('0x3a')]);var _0x3f6b47={'where':_0x2680c0['where']};return db[_0xa1eb('0x27')][_0xa1eb('0x1b')](_0x3f6b47)[_0xa1eb('0x22')](function(_0x462313){_0x3aae71[_0xa1eb('0x1b')]=_0x462313;if(_0xbd5517['query'][_0xa1eb('0x3b')]){_0x2680c0[_0xa1eb('0x3c')]=[{'all':!![]}];}return db[_0xa1eb('0x27')]['findAll'](_0x2680c0);})[_0xa1eb('0x22')](function(_0x1b79a1){_0x3aae71[_0xa1eb('0x3d')]=_0x1b79a1;return _0x3aae71;})[_0xa1eb('0x22')](respondWithFilteredResult(_0x491f37,_0x2680c0))[_0xa1eb('0x3e')](handleError(_0x491f37,null));};exports[_0xa1eb('0x3f')]=function(_0x541d4,_0x568617){var _0x3c8713={'raw':!![],'where':{'id':_0x541d4['params']['id']}},_0x14c37a={};_0x14c37a[_0xa1eb('0x2f')]=_['keys'](db[_0xa1eb('0x27')][_0xa1eb('0x28')]);_0x14c37a[_0xa1eb('0x2c')]=_[_0xa1eb('0x2d')](_0x541d4[_0xa1eb('0x2c')]);_0x14c37a[_0xa1eb('0x36')]=_[_0xa1eb('0x2e')](_0x14c37a[_0xa1eb('0x2f')],_0x14c37a[_0xa1eb('0x2c')]);_0x3c8713[_0xa1eb('0x30')]=_[_0xa1eb('0x2e')](_0x14c37a[_0xa1eb('0x2f')],qs[_0xa1eb('0x31')](_0x541d4[_0xa1eb('0x2c')][_0xa1eb('0x31')]));_0x3c8713[_0xa1eb('0x30')]=_0x3c8713['attributes'][_0xa1eb('0x40')]?_0x3c8713['attributes']:_0x14c37a[_0xa1eb('0x2f')];if(_0x541d4[_0xa1eb('0x2c')]['includeAll']){_0x3c8713['include']=[{'all':!![]}];}_0x3c8713=_[_0xa1eb('0x37')]({},_0x3c8713,_0x541d4[_0xa1eb('0x3a')]);return db[_0xa1eb('0x27')]['find'](_0x3c8713)[_0xa1eb('0x22')](handleEntityNotFound(_0x568617,null))[_0xa1eb('0x22')](respondWithResult(_0x568617,null))[_0xa1eb('0x3e')](handleError(_0x568617,null));};exports[_0xa1eb('0x41')]=function(_0x930a93,_0x6f47c5){return db[_0xa1eb('0x27')][_0xa1eb('0x41')](_0x930a93[_0xa1eb('0x42')],{})[_0xa1eb('0x22')](respondWithResult(_0x6f47c5,0xc9))[_0xa1eb('0x3e')](handleError(_0x6f47c5,null));};exports[_0xa1eb('0x43')]=function(_0x39d3c6,_0x10e15a){if(_0x39d3c6['body']['id']){delete _0x39d3c6[_0xa1eb('0x42')]['id'];}return db[_0xa1eb('0x27')][_0xa1eb('0x44')]({'where':{'id':_0x39d3c6[_0xa1eb('0x45')]['id']}})[_0xa1eb('0x22')](handleEntityNotFound(_0x10e15a,null))[_0xa1eb('0x22')](saveUpdates(_0x39d3c6[_0xa1eb('0x42')],null))['then'](respondWithResult(_0x10e15a,null))[_0xa1eb('0x3e')](handleError(_0x10e15a,null));};exports[_0xa1eb('0x46')]=function(_0x27021a,_0x10a6da){return db[_0xa1eb('0x27')][_0xa1eb('0x44')]({'where':{'id':_0x27021a[_0xa1eb('0x45')]['id']}})[_0xa1eb('0x22')](handleEntityNotFound(_0x10a6da,null))[_0xa1eb('0x22')](removeEntity(_0x10a6da,null))['catch'](handleError(_0x10a6da,null));}; \ No newline at end of file +var _0x2272=['zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','count','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','html-pdf','eml-format','rimraf'];(function(_0x5cd30d,_0x1f671b){var _0x21fcbf=function(_0x27b7b4){while(--_0x27b7b4){_0x5cd30d['push'](_0x5cd30d['shift']());}};_0x21fcbf(++_0x1f671b);}(_0x2272,0xd8));var _0x2227=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2272[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x2227('0x0'));var emlformat=require(_0x2227('0x1'));var rimraf=require(_0x2227('0x2'));var zipdir=require(_0x2227('0x3'));var jsonpatch=require(_0x2227('0x4'));var rp=require('request-promise');var moment=require(_0x2227('0x5'));var BPromise=require(_0x2227('0x6'));var Mustache=require(_0x2227('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2227('0x8'));var csv=require(_0x2227('0x9'));var ejs=require(_0x2227('0xa'));var fs=require('fs');var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x9'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var db=require(_0x2227('0x18'))['db'];function respondWithStatusCode(_0x158d0e,_0x2e19fb){_0x2e19fb=_0x2e19fb||0xcc;return function(_0x125c3b){if(_0x125c3b){return _0x158d0e[_0x2227('0x19')](_0x2e19fb);}return _0x158d0e['status'](_0x2e19fb)['end']();};}function respondWithResult(_0x5152ef,_0x136f6b){_0x136f6b=_0x136f6b||0xc8;return function(_0x571dd1){if(_0x571dd1){return _0x5152ef[_0x2227('0x1a')](_0x136f6b)[_0x2227('0x1b')](_0x571dd1);}};}function respondWithFilteredResult(_0x510b09,_0x3da09c){return function(_0x4fa23d){if(_0x4fa23d){var _0x1df1ef=_0x4fa23d['count'],_0x43e174=_0x3da09c[_0x2227('0x1c')],_0x42a93c=_0x3da09c[_0x2227('0x1c')]+_0x3da09c[_0x2227('0x1d')],_0x1e78a8;if(_0x42a93c>=_0x1df1ef){_0x42a93c=_0x1df1ef;_0x1e78a8=0xc8;}else{_0x1e78a8=0xce;}_0x510b09['status'](_0x1e78a8);return _0x510b09[_0x2227('0x1e')](_0x2227('0x1f'),_0x43e174+'-'+_0x42a93c+'/'+_0x1df1ef)[_0x2227('0x1b')](_0x4fa23d);}return null;};}function patchUpdates(_0x2482ba){return function(_0x416152){try{jsonpatch[_0x2227('0x20')](_0x416152,_0x2482ba,!![]);}catch(_0x2e6c98){return BPromise['reject'](_0x2e6c98);}return _0x416152[_0x2227('0x21')]();};}function saveUpdates(_0x59f988,_0x2b26b7){return function(_0x3aed68){if(_0x3aed68){return _0x3aed68[_0x2227('0x22')](_0x59f988)[_0x2227('0x23')](function(_0x3663ae){return _0x3663ae;});}return null;};}function removeEntity(_0x1592b8,_0x19ab59){return function(_0x10d9ca){if(_0x10d9ca){return _0x10d9ca[_0x2227('0x24')]()[_0x2227('0x23')](function(){_0x1592b8[_0x2227('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45def5,_0x42d500){return function(_0x5b3a09){if(!_0x5b3a09){_0x45def5[_0x2227('0x19')](0x194);}return _0x5b3a09;};}function handleError(_0xbfdce1,_0x5ea1c3){_0x5ea1c3=_0x5ea1c3||0x1f4;return function(_0x4cc85f){logger[_0x2227('0x25')](_0x4cc85f[_0x2227('0x26')]);if(_0x4cc85f[_0x2227('0x27')]){delete _0x4cc85f[_0x2227('0x27')];}_0xbfdce1['status'](_0x5ea1c3)[_0x2227('0x28')](_0x4cc85f);};}exports[_0x2227('0x29')]=function(_0x2d8ea0,_0x1957ee){var _0x5d852f={},_0x204def={},_0xbe1ffb={'count':0x0,'rows':[]};var _0xedd3d9=_[_0x2227('0x2a')](db[_0x2227('0x2b')]['rawAttributes'],function(_0x55015e){return{'name':_0x55015e['fieldName'],'type':_0x55015e[_0x2227('0x2c')]['key']};});_0x204def[_0x2227('0x2d')]=_[_0x2227('0x2a')](_0xedd3d9,'name');_0x204def['query']=_[_0x2227('0x2e')](_0x2d8ea0[_0x2227('0x2f')]);_0x204def[_0x2227('0x30')]=_['intersection'](_0x204def[_0x2227('0x2d')],_0x204def['query']);_0x5d852f[_0x2227('0x31')]=_[_0x2227('0x32')](_0x204def[_0x2227('0x2d')],qs[_0x2227('0x33')](_0x2d8ea0[_0x2227('0x2f')][_0x2227('0x33')]));_0x5d852f[_0x2227('0x31')]=_0x5d852f[_0x2227('0x31')][_0x2227('0x34')]?_0x5d852f[_0x2227('0x31')]:_0x204def[_0x2227('0x2d')];if(!_0x2d8ea0['query'][_0x2227('0x35')](_0x2227('0x36'))){_0x5d852f[_0x2227('0x1d')]=qs[_0x2227('0x1d')](_0x2d8ea0['query'][_0x2227('0x1d')]);_0x5d852f[_0x2227('0x1c')]=qs[_0x2227('0x1c')](_0x2d8ea0[_0x2227('0x2f')]['offset']);}_0x5d852f[_0x2227('0x37')]=qs[_0x2227('0x38')](_0x2d8ea0[_0x2227('0x2f')]['sort']);_0x5d852f['where']=qs[_0x2227('0x30')](_[_0x2227('0x39')](_0x2d8ea0['query'],_0x204def[_0x2227('0x30')]),_0xedd3d9);if(_0x2d8ea0[_0x2227('0x2f')]['filter']){_0x5d852f[_0x2227('0x3a')]=_['merge'](_0x5d852f[_0x2227('0x3a')],{'$or':_[_0x2227('0x2a')](_0xedd3d9,function(_0x509938){if(_0x509938[_0x2227('0x2c')]!=='VIRTUAL'){var _0x40679d={};_0x40679d[_0x509938['name']]={'$like':'%'+_0x2d8ea0[_0x2227('0x2f')][_0x2227('0x3b')]+'%'};return _0x40679d;}})});}_0x5d852f=_[_0x2227('0x3c')]({},_0x5d852f,_0x2d8ea0['options']);var _0x26a974={'where':_0x5d852f[_0x2227('0x3a')]};return db[_0x2227('0x2b')][_0x2227('0x3d')](_0x26a974)[_0x2227('0x23')](function(_0x4a0441){_0xbe1ffb['count']=_0x4a0441;if(_0x2d8ea0[_0x2227('0x2f')]['includeAll']){_0x5d852f[_0x2227('0x3e')]=[{'all':!![]}];}return db[_0x2227('0x2b')][_0x2227('0x3f')](_0x5d852f);})[_0x2227('0x23')](function(_0x15dd37){_0xbe1ffb[_0x2227('0x40')]=_0x15dd37;return _0xbe1ffb;})[_0x2227('0x23')](respondWithFilteredResult(_0x1957ee,_0x5d852f))[_0x2227('0x41')](handleError(_0x1957ee,null));};exports['show']=function(_0x41436e,_0x5ebe70){var _0x3c67c6={'raw':!![],'where':{'id':_0x41436e[_0x2227('0x42')]['id']}},_0x5bcc1f={};_0x5bcc1f['model']=_[_0x2227('0x2e')](db['SmsApplication'][_0x2227('0x43')]);_0x5bcc1f[_0x2227('0x2f')]=_[_0x2227('0x2e')](_0x41436e[_0x2227('0x2f')]);_0x5bcc1f[_0x2227('0x30')]=_[_0x2227('0x32')](_0x5bcc1f['model'],_0x5bcc1f['query']);_0x3c67c6[_0x2227('0x31')]=_['intersection'](_0x5bcc1f[_0x2227('0x2d')],qs['fields'](_0x41436e[_0x2227('0x2f')][_0x2227('0x33')]));_0x3c67c6[_0x2227('0x31')]=_0x3c67c6[_0x2227('0x31')][_0x2227('0x34')]?_0x3c67c6[_0x2227('0x31')]:_0x5bcc1f['model'];if(_0x41436e[_0x2227('0x2f')][_0x2227('0x44')]){_0x3c67c6[_0x2227('0x3e')]=[{'all':!![]}];}_0x3c67c6=_[_0x2227('0x3c')]({},_0x3c67c6,_0x41436e[_0x2227('0x45')]);return db[_0x2227('0x2b')][_0x2227('0x46')](_0x3c67c6)[_0x2227('0x23')](handleEntityNotFound(_0x5ebe70,null))['then'](respondWithResult(_0x5ebe70,null))[_0x2227('0x41')](handleError(_0x5ebe70,null));};exports[_0x2227('0x47')]=function(_0x30287e,_0x424e67){return db['SmsApplication'][_0x2227('0x47')](_0x30287e[_0x2227('0x48')],{})['then'](respondWithResult(_0x424e67,0xc9))[_0x2227('0x41')](handleError(_0x424e67,null));};exports[_0x2227('0x22')]=function(_0x1e4d8f,_0x3bfe7a){if(_0x1e4d8f[_0x2227('0x48')]['id']){delete _0x1e4d8f[_0x2227('0x48')]['id'];}return db[_0x2227('0x2b')]['find']({'where':{'id':_0x1e4d8f[_0x2227('0x42')]['id']}})[_0x2227('0x23')](handleEntityNotFound(_0x3bfe7a,null))['then'](saveUpdates(_0x1e4d8f[_0x2227('0x48')],null))['then'](respondWithResult(_0x3bfe7a,null))[_0x2227('0x41')](handleError(_0x3bfe7a,null));};exports[_0x2227('0x24')]=function(_0x31a544,_0x2e4b92){return db['SmsApplication']['find']({'where':{'id':_0x31a544['params']['id']}})[_0x2227('0x23')](handleEntityNotFound(_0x2e4b92,null))[_0x2227('0x23')](removeEntity(_0x2e4b92,null))['catch'](handleError(_0x2e4b92,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1123ea2..8ac4756 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 _0x75af=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3743fc,_0x9bb6e0){var _0x1a5a6b=function(_0xe6280d){while(--_0xe6280d){_0x3743fc['push'](_0x3743fc['shift']());}};_0x1a5a6b(++_0x9bb6e0);}(_0x75af,0x147));var _0xf75a=function(_0x3e82ee,_0x1bde91){_0x3e82ee=_0x3e82ee-0x0;var _0xec15a1=_0x75af[_0x3e82ee];return _0xec15a1;};'use strict';var _=require(_0xf75a('0x0'));var util=require(_0xf75a('0x1'));var logger=require(_0xf75a('0x2'))('api');var moment=require(_0xf75a('0x3'));var BPromise=require('bluebird');var rp=require(_0xf75a('0x4'));var fs=require('fs');var path=require(_0xf75a('0x5'));var rimraf=require(_0xf75a('0x6'));var config=require(_0xf75a('0x7'));var attributes=require('./smsApplication.attributes');module[_0xf75a('0x8')]=function(_0x141e8b,_0x9690a3){return _0x141e8b[_0xf75a('0x9')](_0xf75a('0xa'),attributes,{'tableName':_0xf75a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf75a('0xc'),'collate':_0xf75a('0xd')});}; \ No newline at end of file +var _0x452a=['./smsApplication.attributes','exports','utf8mb4','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xbda3d,_0x23a96d){var _0x1600f4=function(_0x52ca63){while(--_0x52ca63){_0xbda3d['push'](_0xbda3d['shift']());}};_0x1600f4(++_0x23a96d);}(_0x452a,0x7b));var _0xa452=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x452a[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require(_0xa452('0x0'));var logger=require(_0xa452('0x1'))(_0xa452('0x2'));var moment=require('moment');var BPromise=require(_0xa452('0x3'));var rp=require(_0xa452('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa452('0x5'));var config=require(_0xa452('0x6'));var attributes=require(_0xa452('0x7'));module[_0xa452('0x8')]=function(_0x326e05,_0x11c18b){return _0x326e05['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa452('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 613007a..6bfbf1e 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 _0x5a5a=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x344722,_0x2d0c88){var _0x4edb82=function(_0x2620d9){while(--_0x2620d9){_0x344722['push'](_0x344722['shift']());}};_0x4edb82(++_0x2d0c88);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0xdd83e4,_0x356cca){_0xdd83e4=_0xdd83e4-0x0;var _0x5c9bfc=_0x5a5a[_0xdd83e4];return _0x5c9bfc;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var moment=require(_0xa5a5('0x1'));var BPromise=require(_0xa5a5('0x2'));var rs=require(_0xa5a5('0x3'));var fs=require('fs');var Redis=require(_0xa5a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a5('0x5'));var logger=require(_0xa5a5('0x6'))(_0xa5a5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa5a5('0x8')][_0xa5a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5691f1,_0x3ea00f,_0xf2ea20){return new BPromise(function(_0x1234c2,_0x3a23f4){return client[_0xa5a5('0xa')](_0x5691f1,_0xf2ea20)['then'](function(_0x158a80){logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));logger[_0xa5a5('0xe')](_0xa5a5('0xf'),_0x3ea00f,_0xa5a5('0xd'),JSON[_0xa5a5('0x10')](_0x158a80));if(_0x158a80[_0xa5a5('0x11')]){if(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x12')]===0x1f4){logger[_0xa5a5('0x11')]('SmsApplication,\x20%s,\x20%s',_0x3ea00f,_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);return _0x3a23f4(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x158a80['error'][_0xa5a5('0x13')]);return _0x1234c2(_0x158a80[_0xa5a5('0x11')][_0xa5a5('0x13')]);}else{logger[_0xa5a5('0xb')](_0xa5a5('0xc'),_0x3ea00f,_0xa5a5('0xd'));_0x1234c2(_0x158a80[_0xa5a5('0x14')][_0xa5a5('0x13')]);}})['catch'](function(_0x3ef56e){logger[_0xa5a5('0x11')](_0xa5a5('0xc'),_0x3ea00f,_0x3ef56e);_0x3a23f4(_0x3ef56e);});});} \ No newline at end of file +var _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x4bfc64,_0x25976d){var _0x5d8f2a=function(_0x5d184a){while(--_0x5d184a){_0x4bfc64['push'](_0x4bfc64['shift']());}};_0x5d8f2a(++_0x25976d);}(_0x207c,0x1e8));var _0xc207=function(_0x5f0305,_0x4bdfa8){_0x5f0305=_0x5f0305-0x0;var _0x344ecf=_0x207c[_0x5f0305];return _0x344ecf;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('SmsApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('SmsApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index dedfb7a..5d3e067 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 _0xaf6e=['/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','addTags','put','smsinteraction:update','update','delete','sms','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe'];(function(_0x57b8dd,_0x31e539){var _0x10ebd8=function(_0x2c01d6){while(--_0x2c01d6){_0x57b8dd['push'](_0x57b8dd['shift']());}};_0x10ebd8(++_0x31e539);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x3729bd,_0x213457){_0x3729bd=_0x3729bd-0x0;var _0x43b677=_0xaf6e[_0x3729bd];return _0x43b677;};'use strict';var multer=require(_0xeaf6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeaf6('0x1'));var express=require(_0xeaf6('0x2'));var router=express[_0xeaf6('0x3')]();var auth=require(_0xeaf6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeaf6('0x5'));var controller=require(_0xeaf6('0x6'));router[_0xeaf6('0x7')]('/',auth[_0xeaf6('0x8')](),controller[_0xeaf6('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xeaf6('0xa')]);router['get'](_0xeaf6('0xb'),auth['isAuthenticated'](),controller[_0xeaf6('0xc')]);router[_0xeaf6('0x7')](_0xeaf6('0xd'),auth[_0xeaf6('0x8')](),controller[_0xeaf6('0xe')]);router[_0xeaf6('0x7')](_0xeaf6('0xf'),auth[_0xeaf6('0x8')](),controller[_0xeaf6('0x10')]);router[_0xeaf6('0x11')]('/',auth[_0xeaf6('0x8')](),controller['create']);router[_0xeaf6('0x11')](_0xeaf6('0xd'),auth[_0xeaf6('0x8')](),controller[_0xeaf6('0x12')]);router[_0xeaf6('0x11')](_0xeaf6('0x13'),auth[_0xeaf6('0x8')](),interaction[_0xeaf6('0x14')]('sms','smsinteraction:addtags'),controller[_0xeaf6('0x15')]);router[_0xeaf6('0x16')](_0xeaf6('0xb'),auth[_0xeaf6('0x8')](),interaction[_0xeaf6('0x14')]('sms',_0xeaf6('0x17')),controller[_0xeaf6('0x18')]);router[_0xeaf6('0x19')](_0xeaf6('0xb'),auth[_0xeaf6('0x8')](),interaction[_0xeaf6('0x14')](_0xeaf6('0x1a'),'smsinteraction:destroy'),controller[_0xeaf6('0x1b')]);router[_0xeaf6('0x19')](_0xeaf6('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0xeaf6('0x1c')]=router; \ No newline at end of file +var _0x2ef3=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','sms','smsinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x38c5bb,_0x153bdb){var _0x5cbd09=function(_0xe17565){while(--_0xe17565){_0x38c5bb['push'](_0x38c5bb['shift']());}};_0x5cbd09(++_0x153bdb);}(_0x2ef3,0xba));var _0x32ef=function(_0x234ba6,_0x481f5d){_0x234ba6=_0x234ba6-0x0;var _0x39ce7e=_0x2ef3[_0x234ba6];return _0x39ce7e;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./smsInteraction.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0x8')](_0x32ef('0xc'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0x8')](_0x32ef('0xe'),auth[_0x32ef('0x9')](),controller['getMessages']);router['get'](_0x32ef('0xf'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/',auth['isAuthenticated'](),controller[_0x32ef('0x12')]);router['post'](_0x32ef('0xe'),auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router[_0x32ef('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x32ef('0x14')]('sms',_0x32ef('0x15')),controller[_0x32ef('0x16')]);router[_0x32ef('0x17')](_0x32ef('0xc'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x32ef('0x18')),controller[_0x32ef('0x19')]);router[_0x32ef('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x32ef('0x14')](_0x32ef('0x1b'),_0x32ef('0x1c')),controller['destroy']);router[_0x32ef('0x1a')](_0x32ef('0x1d'),auth['isAuthenticated'](),controller[_0x32ef('0x1e')]);module[_0x32ef('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index ead96a4..28fe7cc 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'closed':{'type':Sequelize[_0x3071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3071('0x2')]},'disposition':{'type':Sequelize[_0x3071('0x3')]},'note':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3071('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 6d95d1e..c825df1 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 _0xf4eb=['renderFile','views','downloadInteraction.html','transcript-','download','log','unlinkSync','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','defaults','socket.io-emitter','redis','./smsInteraction.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','Users','fullname','TagIds','Tags','forEach','push','catch','index','map','SmsInteraction','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','select','field','from','tools_tags','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','text','some','compact','isEmpty','SmsAccountId','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\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','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','fields','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','rawAttributes','include','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','spread','smsInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','direction','SmsAccount','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','closedAt','disposition','Messages','out','System','secret'];(function(_0x5693b2,_0x1f7c18){var _0x4b920a=function(_0x5cb762){while(--_0x5cb762){_0x5693b2['push'](_0x5693b2['shift']());}};_0x4b920a(++_0x1f7c18);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2f086e,_0x288f6d){_0x2f086e=_0x2f086e-0x0;var _0x141931=_0xf4eb[_0x2f086e];return _0x141931;};'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'];config['redis']=_[_0xbf4e('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbf4e('0x14'))(new Redis(config[_0xbf4e('0x15')]));require(_0xbf4e('0x16'))[_0xbf4e('0x17')](socket);function respondWithStatusCode(_0x3b74bd,_0x61bd54){_0x61bd54=_0x61bd54||0xcc;return function(_0x4984b4){if(_0x4984b4){return _0x3b74bd['sendStatus'](_0x61bd54);}return _0x3b74bd[_0xbf4e('0x18')](_0x61bd54)[_0xbf4e('0x19')]();};}function respondWithResult(_0x28fc6b,_0x542909){_0x542909=_0x542909||0xc8;return function(_0x14110b){if(_0x14110b){return _0x28fc6b[_0xbf4e('0x18')](_0x542909)[_0xbf4e('0x1a')](_0x14110b);}};}function respondWithFilteredResult(_0x320e7d,_0x5a631e){return function(_0x247322){if(_0x247322){var _0x577c27=_0x247322[_0xbf4e('0x1b')],_0x5db03f=_0x5a631e[_0xbf4e('0x1c')],_0x566ec3=_0x5a631e[_0xbf4e('0x1c')]+_0x5a631e['limit'],_0x4f8762;if(_0x566ec3>=_0x577c27){_0x566ec3=_0x577c27;_0x4f8762=0xc8;}else{_0x4f8762=0xce;}_0x320e7d['status'](_0x4f8762);return _0x320e7d[_0xbf4e('0x1d')](_0xbf4e('0x1e'),_0x5db03f+'-'+_0x566ec3+'/'+_0x577c27)[_0xbf4e('0x1a')](_0x247322);}return null;};}function patchUpdates(_0x3a875b){return function(_0x344727){try{jsonpatch[_0xbf4e('0x1f')](_0x344727,_0x3a875b,!![]);}catch(_0x415963){return BPromise[_0xbf4e('0x20')](_0x415963);}return _0x344727[_0xbf4e('0x21')]();};}function saveUpdates(_0x376832,_0x30539b){return function(_0x59bd84){if(_0x59bd84){return _0x59bd84[_0xbf4e('0x22')](_0x376832)[_0xbf4e('0x23')](function(_0x51648c){return _0x51648c;});}return null;};}function removeEntity(_0x31e3f5,_0x30994d){return function(_0x114412){if(_0x114412){return _0x114412[_0xbf4e('0x24')]()[_0xbf4e('0x23')](function(){_0x31e3f5['status'](0xcc)[_0xbf4e('0x19')]();});}};}function handleEntityNotFound(_0x36688a,_0x3d6863){return function(_0x5766d4){if(!_0x5766d4){_0x36688a[_0xbf4e('0x25')](0x194);}return _0x5766d4;};}function handleError(_0x5e08b1,_0x5bcf71){_0x5bcf71=_0x5bcf71||0x1f4;return function(_0x2bfccf){logger['error'](_0x2bfccf[_0xbf4e('0x26')]);if(_0x2bfccf[_0xbf4e('0x27')]){delete _0x2bfccf[_0xbf4e('0x27')];}_0x5e08b1[_0xbf4e('0x18')](_0x5bcf71)['send'](_0x2bfccf);};}function getInteractionUsers(_0x2d4686,_0x8e0ab5){return new BPromise(function(_0x43879d,_0x4cd4a1){try{if(_0x8e0ab5[_0x2d4686['id']]){_0x2d4686[_0xbf4e('0x28')]=_['map'](_0x8e0ab5[_0x2d4686['id']],function(_0x1dfa81){return{'id':_0x1dfa81['id'],'fullname':_0x1dfa81[_0xbf4e('0x29')]};});}}catch(_0xb8b58e){_0x4cd4a1(_0xb8b58e);}_0x43879d(_0x2d4686);});}function getInteractionTags(_0x498dbd,_0x1d12e2){return new BPromise(function(_0x362716,_0x2f3cf8){try{if(_0x498dbd[_0xbf4e('0x2a')]){_0x498dbd[_0xbf4e('0x2b')]=[];_0x498dbd[_0xbf4e('0x2a')]['split'](',')[_0xbf4e('0x2c')](function(_0x154576){_0x498dbd['Tags'][_0xbf4e('0x2d')](_0x1d12e2[_0x154576]);});}delete _0x498dbd[_0xbf4e('0x2a')];}catch(_0x5473ed){_0x2f3cf8(_0x5473ed);}_0x362716(_0x498dbd);});}function updateSmsInteraction(_0x23d769,_0x5d8285,_0x10722a){return new BPromise(function(_0x59b161,_0x2f49d8){return getInteractionUsers(_0x23d769,_0x10722a)[_0xbf4e('0x23')](function(_0x83e0ef){return getInteractionTags(_0x83e0ef,_0x5d8285);})['then'](function(_0x2716b7){_0x59b161(_0x2716b7);})[_0xbf4e('0x2e')](function(_0x70c54f){_0x2f49d8(_0x70c54f);});});}exports[_0xbf4e('0x2f')]=function(_0xb93672,_0x477873){var _0x5b8440={},_0x99b320={},_0x3dbb2b={'count':0x0,'rows':[]};var _0x25b837=_[_0xbf4e('0x30')](db[_0xbf4e('0x31')]['rawAttributes'],function(_0x4864bd){return{'name':_0x4864bd['fieldName'],'type':_0x4864bd['type'][_0xbf4e('0x32')]};});_0x99b320[_0xbf4e('0x33')]=_[_0xbf4e('0x30')](_0x25b837,_0xbf4e('0x27'));_0x99b320[_0xbf4e('0x34')]=_[_0xbf4e('0x35')](_0xb93672[_0xbf4e('0x34')]);_0x99b320[_0xbf4e('0x36')]=_[_0xbf4e('0x37')](_0x99b320['model'],_0x99b320['query']);_0x5b8440[_0xbf4e('0x38')]=_[_0xbf4e('0x37')](_0x99b320[_0xbf4e('0x33')],qs['fields'](_0xb93672[_0xbf4e('0x34')]['fields']));_0x5b8440[_0xbf4e('0x38')]=_0x5b8440[_0xbf4e('0x38')][_0xbf4e('0x39')]?_0x5b8440[_0xbf4e('0x38')]:_0x99b320['model'];if(!_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x3a')](_0xbf4e('0x3b'))){_0x5b8440[_0xbf4e('0x3c')]=qs['limit'](_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x3c')]);_0x5b8440[_0xbf4e('0x1c')]=qs[_0xbf4e('0x1c')](_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x1c')]);}_0x5b8440[_0xbf4e('0x3d')]=qs['sort'](_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x3e')]);_0x5b8440['where']=qs['filters'](_[_0xbf4e('0x3f')](_0xb93672[_0xbf4e('0x34')],_0x99b320['filters']),_0x25b837);var _0x5bfc4d=[];var _0x2b1bf4=squel[_0xbf4e('0x40')]()[_0xbf4e('0x41')]('id')[_0xbf4e('0x41')](_0xbf4e('0x27'))[_0xbf4e('0x41')]('color')[_0xbf4e('0x42')](_0xbf4e('0x43'));var _0x4d31b6=squel['select']()['field']('u.id')[_0xbf4e('0x41')]('u.fullname')[_0xbf4e('0x41')](_0xbf4e('0x44'))['from']('user_has_sms_interactions','ui')[_0xbf4e('0x45')](_0xbf4e('0x46'),'u',_0xbf4e('0x47'));var _0x40c147=squel[_0xbf4e('0x40')]()['from'](_0xbf4e('0x48'),'i')[_0xbf4e('0x45')](_0xbf4e('0x49'),'c',_0xbf4e('0x4a'))[_0xbf4e('0x45')](_0xbf4e('0x46'),'o',_0xbf4e('0x4b'))[_0xbf4e('0x45')]('sms_accounts','a',_0xbf4e('0x4c'))[_0xbf4e('0x45')](_0xbf4e('0x4d'),'me',_0xbf4e('0x4e'))[_0xbf4e('0x45')](_0xbf4e('0x4f'),'it',_0xbf4e('0x50'))[_0xbf4e('0x45')](_0xbf4e('0x43'),'t',_0xbf4e('0x51'));var _0x2fdba9=squel[_0xbf4e('0x52')]();var _0x370d4c=[];var _0x2ea101=squel[_0xbf4e('0x52')]();var _0x2892ce;if(_0xb93672[_0xbf4e('0x34')]['search']){_0x2892ce=as[_0xbf4e('0x53')](_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x54')]);var _0x4ac47b=_0x2892ce[_0xbf4e('0x55')];for(var _0x5ed838=0x0;_0x5ed838<_0x2892ce['conditions'][_0xbf4e('0x39')];_0x5ed838++){var _0x200393=_0x2892ce['conditions'][_0x5ed838];var _0x22e73b='i';var _0x1ac906=_[_0xbf4e('0x56')](_0x25b837,[_0xbf4e('0x27'),_0x200393[_0xbf4e('0x41')]]);if(!_0x1ac906){switch(_0x200393[_0xbf4e('0x41')]){case _0xbf4e('0x57'):if(_0x200393[_0xbf4e('0x58')]==0x1){_0x40c147[_0xbf4e('0x59')]('`'+_0x200393[_0xbf4e('0x41')]+_0xbf4e('0x5a'));}else{_0x40c147['having']('`'+_0x200393['field']+_0xbf4e('0x5b'));}break;case _0xbf4e('0x5c'):if(_0x200393[_0xbf4e('0x5d')]==='$substring'){if(_0x200393[_0xbf4e('0x58')][_0xbf4e('0x5e')]('\x20')['length']>0x1){_0x2fdba9[_0x4ac47b]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbf4e('0x5f')](_0x200393['value']),null);}else{var _0x510548='%'+_0x200393[_0xbf4e('0x58')]+'%';_0x2fdba9[_0x4ac47b](_0xbf4e('0x60'),_0x510548,_0x510548,_0x510548);}}else{_0x1ac906=_[_0xbf4e('0x56')](_0x25b837,[_0xbf4e('0x27'),_0xbf4e('0x61')]);_0x200393['field']=_0xbf4e('0x61');_0x3ee848=as['buildExpression'](_0x22e73b,_0x1ac906[_0xbf4e('0x62')],_0x200393);_0x2fdba9[_0x4ac47b](_0x3ee848['text'],_0x3ee848[_0xbf4e('0x58')]['start'],_0x3ee848[_0xbf4e('0x58')][_0xbf4e('0x19')]);}break;case _0xbf4e('0x63'):var _0x16592f=_0x200393[_0xbf4e('0x58')]['split'](',')['map'](function(_0x5a0f4a){return Number(_0x5a0f4a);});_0x16592f['forEach'](function(_0x419a69){_0x2ea101['or'](_0xbf4e('0x64'),'%,'+_0x419a69+',%');});_0x370d4c=_['union'](_0x370d4c,_0x16592f);break;case _0xbf4e('0x65'):if(_0x200393[_0xbf4e('0x5d')]===_0xbf4e('0x66')){_0x2fdba9[_0x4ac47b](_0xbf4e('0x67'),'%'+_0x200393[_0xbf4e('0x58')]+'%',null);}else{_0x1ac906=_[_0xbf4e('0x56')](_0x25b837,[_0xbf4e('0x27'),'UserId']);_0x200393[_0xbf4e('0x41')]=_0xbf4e('0x68');_0x3ee848=as[_0xbf4e('0x69')](_0x22e73b,_0x1ac906['type'],_0x200393);_0x2fdba9[_0x4ac47b](_0x3ee848['text'],_0x3ee848[_0xbf4e('0x58')][_0xbf4e('0x6a')],_0x3ee848[_0xbf4e('0x58')]['end']);}break;case _0xbf4e('0x6b'):_0x3ee848=as[_0xbf4e('0x69')]('me',null,_0x200393);_0x2fdba9[_0x4ac47b](_0x3ee848[_0xbf4e('0x6c')],_0x3ee848[_0xbf4e('0x58')][_0xbf4e('0x6a')],_0x3ee848[_0xbf4e('0x58')][_0xbf4e('0x19')]);break;}}else{var _0x3ee848=as[_0xbf4e('0x69')](_0x22e73b,_0x1ac906[_0xbf4e('0x62')],_0x200393);_0x2fdba9[_0x4ac47b](_0x3ee848[_0xbf4e('0x6c')],_0x3ee848[_0xbf4e('0x58')]['start'],_0x3ee848[_0xbf4e('0x58')]['end']);}}}else{var _0x1c5610=_(_0xb93672[_0xbf4e('0x34')])[_0xbf4e('0x35')]()[_0xbf4e('0x30')](function(_0x2080ec){return _[_0xbf4e('0x6d')](_0x25b837,[_0xbf4e('0x27'),_0x2080ec])?_0x2080ec:undefined;})[_0xbf4e('0x6e')]()['value']();if(!_[_0xbf4e('0x6f')](_0x1c5610)){_0x1c5610[_0xbf4e('0x2c')](function(_0x22d5e1){if(_0x22d5e1===_0xbf4e('0x70')){_0x40c147[_0xbf4e('0x71')]('i.SmsAccountId\x20IN\x20?',[][_0xbf4e('0x72')](_0xb93672[_0xbf4e('0x34')][_0x22d5e1]));}else if(_0x22d5e1===_0xbf4e('0x73')){var _0x1770ca=JSON[_0xbf4e('0x74')](_0xb93672[_0xbf4e('0x34')][_0x22d5e1])['$gte'];var _0x2246a2=JSON['parse'](_0xb93672[_0xbf4e('0x34')][_0x22d5e1])[_0xbf4e('0x75')];_0x40c147[_0xbf4e('0x71')](_0xbf4e('0x76'),_0x1770ca,_0x2246a2);}else{if(_0xb93672['query'][_0x22d5e1]===_0xbf4e('0x77')){_0x40c147['where']('i.'+_0x22d5e1+'\x20IS\x20NULL');}else{_0x40c147[_0xbf4e('0x71')]('i.'+_0x22d5e1+_0xbf4e('0x78'),_0xb93672[_0xbf4e('0x34')][_0x22d5e1]);}}});}if(_0xb93672['query'][_0xbf4e('0x79')]){if(_0xb93672[_0xbf4e('0x34')]['read']==0x1){_0x40c147[_0xbf4e('0x59')](_0xbf4e('0x7a'));}else{_0x40c147[_0xbf4e('0x59')](_0xbf4e('0x7b'));}}if(_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x7c')]){_0x370d4c=_[_0xbf4e('0x7d')](_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x7c')])?_0xb93672['query'][_0xbf4e('0x7c')]:new Array(_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x7c')]);_0x370d4c[_0xbf4e('0x2c')](function(_0x54f450){_0x2ea101['or'](_0xbf4e('0x64'),'%,'+_0x54f450+',%');});}if(_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x7e')]){var _0x25ce0d=_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x7e')][_0xbf4e('0x7f')]('\x5c','\x5c\x5c')[_0xbf4e('0x7f')]('\x27\x27',_0xbf4e('0x80'));if(qs['isNumeric'](_0x25ce0d)){_0x2fdba9['or'](_0xbf4e('0x81'),_0x25ce0d+'%')['or']('i.phone\x20LIKE\x20?',_0x25ce0d+'%');}else{_0x2fdba9['or'](_0xbf4e('0x82'),qs[_0xbf4e('0x5f')](_0x25ce0d))['or'](_0xbf4e('0x83'),_0x25ce0d+'%');}}}_0x40c147[_0xbf4e('0x71')](_0x2fdba9);_0x40c147[_0xbf4e('0x84')]('i.id');var _0x276dd8={'type':db[_0xbf4e('0x85')][_0xbf4e('0x86')]['SELECT'],'raw':!![]};var _0x471028=_0x40c147[_0xbf4e('0x87')]();_0x471028[_0xbf4e('0x41')]('i.id');_0x471028[_0xbf4e('0x41')](_0xbf4e('0x88'),_0xbf4e('0x57'));if(_0x5b8440[_0xbf4e('0x3d')]){_0x5b8440[_0xbf4e('0x3d')]['forEach'](function(_0x44c4d9){_0x40c147['order']('i.'+_0x44c4d9[0x0],_0x44c4d9[0x1]===_0xbf4e('0x89')?![]:!![]);});}if(!_['isEmpty'](_0x370d4c)){_0x40c147[_0xbf4e('0x59')](_0x2ea101);_0x471028['where'](_0xbf4e('0x8a'),_0x370d4c);}BPromise['resolve']()[_0xbf4e('0x23')](function(){if(!_0x2892ce){if(_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x70')]||_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x8b')])return;_0x471028[_0xbf4e('0x71')](_0xbf4e('0x8c'));_0x40c147['where'](_0xbf4e('0x8c'));return;}return _0xb93672[_0xbf4e('0x8d')][_0xbf4e('0x8e')]({'attributes':['id'],'raw':!![]})[_0xbf4e('0x23')](function(_0x1bff2e){if(_[_0xbf4e('0x6f')](_0x1bff2e)){_0x471028['where'](_0xbf4e('0x8f'));_0x40c147[_0xbf4e('0x71')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x471028[_0xbf4e('0x71')](_0xbf4e('0x90'),_[_0xbf4e('0x30')](_0x1bff2e,'id'));_0x40c147[_0xbf4e('0x71')](_0xbf4e('0x90'),_[_0xbf4e('0x30')](_0x1bff2e,'id'));}});})[_0xbf4e('0x23')](function(){db[_0xbf4e('0x91')][_0xbf4e('0x34')](_0x471028['toString'](),_0x276dd8)[_0xbf4e('0x23')](function(_0x3af161){_0x3dbb2b[_0xbf4e('0x1b')]=_0x3af161['length'];if(_0x3dbb2b[_0xbf4e('0x1b')]===0x0)return[];return db[_0xbf4e('0x91')]['query'](_0x2b1bf4[_0xbf4e('0x92')](),_0x276dd8)[_0xbf4e('0x23')](function(_0x380d25){_0x5bfc4d=_[_0xbf4e('0x93')](_0x380d25,'id');_0x276dd8=_[_0xbf4e('0x94')](_0x276dd8,{'model':db[_0xbf4e('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb93672[_0xbf4e('0x34')][_0xbf4e('0x95')]){_0x5b8440[_0xbf4e('0x38')][_0xbf4e('0x2c')](function(_0x55bc7c){_0x40c147['field']('i.'+_0x55bc7c);});}else{_0x40c147[_0xbf4e('0x41')](_0xbf4e('0x88'),_0xbf4e('0x57'));_0x40c147[_0xbf4e('0x41')]('a.key',_0xbf4e('0x96'));_0x40c147[_0xbf4e('0x41')](_0xbf4e('0x97'),_0xbf4e('0x98'));_0x40c147[_0xbf4e('0x41')](_0xbf4e('0x99'));_0x40c147[_0xbf4e('0x41')]('c.firstName',_0xbf4e('0x9a'));_0x40c147[_0xbf4e('0x41')](_0xbf4e('0x9b'),_0xbf4e('0x9c'));_0x40c147[_0xbf4e('0x41')](_0xbf4e('0x9d'),'Contact.email');_0x40c147[_0xbf4e('0x41')](_0xbf4e('0x9e'),_0xbf4e('0x9f'));_0x40c147[_0xbf4e('0x41')](_0xbf4e('0xa0'),_0xbf4e('0xa1'));_0x40c147[_0xbf4e('0x41')]('c.fax','Contact.fax');_0x40c147[_0xbf4e('0x41')](_0xbf4e('0xa2'),_0xbf4e('0xa3'));_0x40c147[_0xbf4e('0x41')](_0xbf4e('0xa4'),_0xbf4e('0xa5'));_0x40c147[_0xbf4e('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbf4e('0x2a'));}if(_0x5b8440[_0xbf4e('0x3c')])_0x40c147[_0xbf4e('0x3c')](_0x5b8440['limit']);if(_0x5b8440['offset'])_0x40c147[_0xbf4e('0x1c')](_0x5b8440[_0xbf4e('0x1c')]);return db[_0xbf4e('0x91')]['query'](_0x40c147[_0xbf4e('0x92')](),_0x276dd8);})[_0xbf4e('0x23')](function(_0x2870d4){_0x4d31b6['where'](_0xbf4e('0xa6'),_[_0xbf4e('0x30')](_0x2870d4,'id'));return db[_0xbf4e('0x91')][_0xbf4e('0x34')](_0x4d31b6[_0xbf4e('0x92')](),_0x276dd8)[_0xbf4e('0x23')](function(_0xbcac6d){var _0x321840=_[_0xbf4e('0xa7')](_0xbcac6d,_0xbf4e('0xa8'));var _0x5e2a43=[];_0x2870d4['forEach'](function(_0x30fe07){_0x5e2a43['push'](updateSmsInteraction(_0x30fe07,_0x5bfc4d,_0x321840));});return BPromise[_0xbf4e('0xa9')](_0x5e2a43);});});})[_0xbf4e('0x23')](function(_0x1b79bb){_0x3dbb2b[_0xbf4e('0xaa')]=_0x1b79bb;return _0x3dbb2b;})['then'](respondWithFilteredResult(_0x477873,_0x5b8440));})[_0xbf4e('0x2e')](handleError(_0x477873,null));};exports[_0xbf4e('0xab')]=function(_0x5f596e,_0x1b555c){var _0xbe360e={'raw':![],'where':{'id':_0x5f596e[_0xbf4e('0xac')]['id']}},_0x3cb9a4={};_0x3cb9a4[_0xbf4e('0x33')]=_[_0xbf4e('0x35')](db[_0xbf4e('0x31')][_0xbf4e('0xad')]);_0x3cb9a4[_0xbf4e('0x34')]=_['keys'](_0x5f596e[_0xbf4e('0x34')]);_0x3cb9a4[_0xbf4e('0x36')]=_['intersection'](_0x3cb9a4[_0xbf4e('0x33')],_0x3cb9a4[_0xbf4e('0x34')]);_0xbe360e[_0xbf4e('0x38')]=_[_0xbf4e('0x37')](_0x3cb9a4[_0xbf4e('0x33')],qs[_0xbf4e('0x95')](_0x5f596e[_0xbf4e('0x34')][_0xbf4e('0x95')]));_0xbe360e['attributes']=_0xbe360e[_0xbf4e('0x38')][_0xbf4e('0x39')]?_0xbe360e[_0xbf4e('0x38')]:_0x3cb9a4[_0xbf4e('0x33')];if(_0x5f596e[_0xbf4e('0x34')]['includeAll']){_0xbe360e[_0xbf4e('0xae')]=[{'all':!![]}];}_0xbe360e=_[_0xbf4e('0x94')]({},_0xbe360e,_0x5f596e[_0xbf4e('0xaf')]);return db[_0xbf4e('0x31')][_0xbf4e('0x56')](_0xbe360e)[_0xbf4e('0x23')](handleEntityNotFound(_0x1b555c,null))[_0xbf4e('0x23')](respondWithResult(_0x1b555c,null))[_0xbf4e('0x2e')](handleError(_0x1b555c,null));};exports[_0xbf4e('0xb0')]=function(_0x5f2c43,_0x50106f){return db['SmsInteraction'][_0xbf4e('0xb0')](_0x5f2c43[_0xbf4e('0x6b')],{})[_0xbf4e('0x23')](respondWithResult(_0x50106f,0xc9))['catch'](handleError(_0x50106f,null));};exports[_0xbf4e('0x22')]=function(_0x2322c5,_0x4e0b17){if(_0x2322c5[_0xbf4e('0x6b')]['id']){delete _0x2322c5[_0xbf4e('0x6b')]['id'];}return db['SmsInteraction'][_0xbf4e('0x56')]({'where':{'id':_0x2322c5['params']['id']}})[_0xbf4e('0x23')](handleEntityNotFound(_0x4e0b17,null))['then'](saveUpdates(_0x2322c5['body'],null))['then'](respondWithResult(_0x4e0b17,null))[_0xbf4e('0x2e')](handleError(_0x4e0b17,null));};exports[_0xbf4e('0x24')]=function(_0x4f98f1,_0x29d9ed){return db[_0xbf4e('0x31')][_0xbf4e('0x56')]({'where':{'id':_0x4f98f1[_0xbf4e('0xac')]['id']}})[_0xbf4e('0x23')](handleEntityNotFound(_0x29d9ed,null))[_0xbf4e('0x23')](removeEntity(_0x29d9ed,null))[_0xbf4e('0x2e')](handleError(_0x29d9ed,null));};exports[_0xbf4e('0xb1')]=function(_0x14bf39,_0x46a481){return db[_0xbf4e('0x31')]['describe']()['then'](respondWithResult(_0x46a481,null))['catch'](handleError(_0x46a481,null));};exports[_0xbf4e('0xb2')]=function(_0x145a3f,_0x4e8f19,_0xfafe0d){return db[_0xbf4e('0xb3')][_0xbf4e('0x56')]({'where':{'id':_0x145a3f[_0xbf4e('0xac')]['id']}})['then'](handleEntityNotFound(_0x4e8f19,null))[_0xbf4e('0x23')](function(_0x1f3177){if(_0x1f3177){return _0x1f3177[_0xbf4e('0xb2')](_0x145a3f['body'][_0xbf4e('0xb4')],_[_0xbf4e('0xb5')](_0x145a3f[_0xbf4e('0x6b')],[_0xbf4e('0xb4'),'id'])||{});}})[_0xbf4e('0x23')](respondWithResult(_0x4e8f19,null))[_0xbf4e('0x2e')](handleError(_0x4e8f19,null));};exports[_0xbf4e('0xb6')]=function(_0x74cbb4,_0x452dc2,_0x164112){var _0x1c7860={'raw':![],'where':{}};var _0x5cc246={};var _0x477a0={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x74cbb4[_0xbf4e('0xac')]['id']}})['then'](handleEntityNotFound(_0x452dc2,null))[_0xbf4e('0x23')](function(_0x6a720){if(_0x6a720){_0x5cc246[_0xbf4e('0x33')]=_[_0xbf4e('0x35')](db[_0xbf4e('0xb3')]['rawAttributes']);_0x5cc246['query']=_[_0xbf4e('0x35')](_0x74cbb4[_0xbf4e('0x34')]);_0x5cc246[_0xbf4e('0x36')]=_[_0xbf4e('0x37')](_0x5cc246[_0xbf4e('0x33')],_0x5cc246['query']);_0x1c7860[_0xbf4e('0x38')]=_[_0xbf4e('0x37')](_0x5cc246[_0xbf4e('0x33')],qs['fields'](_0x74cbb4[_0xbf4e('0x34')]['fields']));_0x1c7860[_0xbf4e('0x38')]=_0x1c7860['attributes']['length']?_0x1c7860[_0xbf4e('0x38')]:_0x5cc246[_0xbf4e('0x33')];if(!_0x74cbb4[_0xbf4e('0x34')][_0xbf4e('0x3a')](_0xbf4e('0x3b'))){_0x1c7860[_0xbf4e('0x3c')]=qs[_0xbf4e('0x3c')](_0x74cbb4[_0xbf4e('0x34')]['limit']);_0x1c7860[_0xbf4e('0x1c')]=qs[_0xbf4e('0x1c')](_0x74cbb4[_0xbf4e('0x34')][_0xbf4e('0x1c')]);}_0x1c7860[_0xbf4e('0x3d')]=qs['sort'](_0x74cbb4['query']['sort']);_0x1c7860[_0xbf4e('0x71')]=qs['filters'](_[_0xbf4e('0x3f')](_0x74cbb4[_0xbf4e('0x34')],_0x5cc246[_0xbf4e('0x36')]));_0x1c7860[_0xbf4e('0x71')]['SmsInteractionId']=_0x6a720['id'];if(_0x74cbb4['query']['filter']){_0x1c7860[_0xbf4e('0x71')]=_[_0xbf4e('0x94')](_0x1c7860['where'],{'$or':_[_0xbf4e('0x30')](_0x1c7860[_0xbf4e('0x38')],function(_0x3e3649){var _0x47b762={};_0x47b762[_0x3e3649]={'$like':'%'+_0x74cbb4['query'][_0xbf4e('0x7e')]+'%'};return _0x47b762;})});}if(_0x74cbb4[_0xbf4e('0x34')][_0xbf4e('0xb7')]){var _0x366eee=_0x74cbb4[_0xbf4e('0x34')]['$gte']['split'](',');var _0x11cada={};_0x11cada[_0x366eee[0x0]]={'$gte':moment(_0x366eee[0x1])[_0xbf4e('0xb8')](_0xbf4e('0xb9'))};_0x1c7860['where']=_['merge'](_0x1c7860[_0xbf4e('0x71')],_0x11cada);}_0x1c7860=_[_0xbf4e('0x94')]({},_0x1c7860,_0x74cbb4[_0xbf4e('0xaf')]);return db['SmsMessage'][_0xbf4e('0x1b')]({'where':_0x1c7860[_0xbf4e('0x71')]})[_0xbf4e('0x23')](function(_0x441301){_0x477a0[_0xbf4e('0x1b')]=_0x441301;if(_0x74cbb4[_0xbf4e('0x34')][_0xbf4e('0xba')]){_0x1c7860['include']=[{'all':!![]}];}return db[_0xbf4e('0xb3')][_0xbf4e('0xbb')](_0x1c7860);})['then'](function(_0x5d3217){_0x477a0['rows']=_0x5d3217;return _0x477a0;});}})[_0xbf4e('0x23')](respondWithFilteredResult(_0x452dc2,_0x1c7860))[_0xbf4e('0x2e')](handleError(_0x452dc2,null));};exports[_0xbf4e('0xbc')]=function(_0x44c3c5,_0x3f67ec,_0x1cda9c){return db['SmsInteraction'][_0xbf4e('0x56')]({'where':{'id':_0x44c3c5[_0xbf4e('0xac')]['id']}})['then'](handleEntityNotFound(_0x3f67ec,null))['then'](function(_0x12294e){if(_0x12294e){return _0x12294e['setTags'](_0x44c3c5[_0xbf4e('0x6b')][_0xbf4e('0xb4')],_[_0xbf4e('0xb5')](_0x44c3c5[_0xbf4e('0x6b')],[_0xbf4e('0xb4'),'id'])||{})[_0xbf4e('0xbd')](function(){return db[_0xbf4e('0x63')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x44c3c5[_0xbf4e('0x6b')]['ids']}});})[_0xbf4e('0x23')](function(_0x5d1407){socket['emit'](_0xbf4e('0xbe'),{'id':Number(_0x44c3c5['params']['id']),'tags':_0x5d1407||[]});return{'id':Number(_0x44c3c5[_0xbf4e('0xac')]['id']),'tags':_0x5d1407||[]};});}})[_0xbf4e('0x23')](respondWithResult(_0x3f67ec,null))[_0xbf4e('0x2e')](handleError(_0x3f67ec,null));};exports[_0xbf4e('0xbf')]=function(_0x34cec2,_0x25a181,_0x820681){return db['SmsInteraction']['find']({'where':{'id':_0x34cec2[_0xbf4e('0xac')]['id']}})[_0xbf4e('0x23')](handleEntityNotFound(_0x25a181,null))[_0xbf4e('0x23')](function(_0x4589ce){if(_0x4589ce){return _0x4589ce[_0xbf4e('0xbf')](_0x34cec2[_0xbf4e('0x34')]['ids']);}})['then'](respondWithStatusCode(_0x25a181,null))[_0xbf4e('0x2e')](handleError(_0x25a181,null));};exports['download']=function(_0x5d7f3b,_0x3056d6){var _0x6af5b0=moment()[_0xbf4e('0xc0')]()[_0xbf4e('0x92')]();var _0x14a052=path[_0xbf4e('0xc1')](config[_0xbf4e('0xc2')],_0xbf4e('0xc3'),'files',_0xbf4e('0xc4'));var _0x427d02=path[_0xbf4e('0xc1')](config[_0xbf4e('0xc2')],_0xbf4e('0xc3'),_0xbf4e('0xc5'),_0xbf4e('0xc6'));var _0x50a459=path[_0xbf4e('0xc1')](_0x14a052,_0x6af5b0);var _0x76d0dd=util[_0xbf4e('0xb8')](_0xbf4e('0xc7'),_0x5d7f3b[_0xbf4e('0xac')]['id'],_0x6af5b0);var _0x587cdf=path[_0xbf4e('0xc1')](_0x14a052,_0x76d0dd);var _0x564b33=[];_0x564b33[_0xbf4e('0x2d')]({'model':db[_0xbf4e('0x65')],'as':_0xbf4e('0x65'),'attributes':['id','fullname'],'raw':!![]});_0x564b33['push']({'model':db[_0xbf4e('0xc8')],'as':_0xbf4e('0x5c'),'attributes':['id',_0xbf4e('0xc9'),_0xbf4e('0xca')],'raw':!![]});var _0x5a7ff8=[{'model':db[_0xbf4e('0xb3')],'as':'Messages','attributes':['id',_0xbf4e('0x6b'),_0xbf4e('0x73'),_0xbf4e('0xcb'),'secret',_0xbf4e('0x79')],'include':_0x564b33}];_0x5a7ff8[_0xbf4e('0x2d')]({'model':db[_0xbf4e('0xcc')],'as':_0xbf4e('0xcd'),'attributes':['id',_0xbf4e('0x27')]});_0x5a7ff8['push']({'model':db[_0xbf4e('0x65')],'as':'Owner','attributes':['id','fullname']});return db[_0xbf4e('0x31')]['find']({'where':{'id':_0x5d7f3b[_0xbf4e('0xac')]['id']},'include':_0x5a7ff8})[_0xbf4e('0x23')](handleEntityNotFound(_0x3056d6,null))[_0xbf4e('0x23')](function(_0x35afdb){if(_0x35afdb){var _0x2a1935=_0x35afdb[_0xbf4e('0xce')]({'plain':!![]});fs[_0xbf4e('0xcf')](_0x50a459);var _0x50b04c={'format':'A4','border':_0xbf4e('0xd0'),'header':{'height':_0xbf4e('0xd1'),'contents':{'first':_0xbf4e('0xd2')}},'footer':{'height':_0xbf4e('0xd3'),'contents':{'default':util['format'](_0xbf4e('0xd4'),util[_0xbf4e('0xb8')](_0xbf4e('0xd5'),_0xbf4e('0xd6'),_0x2a1935['id']),moment()[_0xbf4e('0xb8')](_0xbf4e('0xd7'))[_0xbf4e('0x92')]())}}};var _0x217c57={'channel':_0xbf4e('0xd6'),'account':_0x2a1935[_0xbf4e('0xcd')]['name'],'agent':_0x2a1935['Owner']?_0x2a1935['Owner']['fullname']:'N.A.','createdAt':moment(_0x2a1935['createdAt'])[_0xbf4e('0xb8')](_0xbf4e('0xb9'))[_0xbf4e('0x92')](),'closedAt':_0x2a1935['closed']?moment(_0x2a1935[_0xbf4e('0xd8')])[_0xbf4e('0xb8')](_0xbf4e('0xb9'))[_0xbf4e('0x92')]():'','disposition':_0x2a1935[_0xbf4e('0xd9')],'messages':_(_0x2a1935[_0xbf4e('0xda')])[_0xbf4e('0x7e')]({'secret':![]})[_0xbf4e('0x30')](function(_0x3fa3c3){return{'date':moment(_0x3fa3c3[_0xbf4e('0x73')])[_0xbf4e('0xb8')](_0xbf4e('0xb9'))['toString'](),'sender':_0x3fa3c3['direction']===_0xbf4e('0xdb')?_0x3fa3c3['User']?_0x3fa3c3[_0xbf4e('0x65')]['fullname']:_0xbf4e('0xdc'):_0x3fa3c3[_0xbf4e('0x5c')][_0xbf4e('0xc9')]+(_0x3fa3c3['Contact'][_0xbf4e('0xca')]?'\x20'+_0x3fa3c3[_0xbf4e('0x5c')][_0xbf4e('0xca')]:''),'body':_0x3fa3c3[_0xbf4e('0x6b')],'direction':_0x3fa3c3['direction']===_0xbf4e('0xdb')?'A':'C','secret':_0x3fa3c3[_0xbf4e('0xdd')],'read':_0x3fa3c3[_0xbf4e('0x79')]};})[_0xbf4e('0x58')]()};return ejs[_0xbf4e('0xde')](path[_0xbf4e('0xc1')](config['root'],_0xbf4e('0xc3'),_0xbf4e('0xdf'),_0xbf4e('0xe0')),{'interaction':_0x217c57})[_0xbf4e('0x23')](function(_0x4637b6){return new BPromise(function(_0xa8ffa9,_0x17173a){pdf['create'](_0x4637b6,_0x50b04c)['toFile'](path[_0xbf4e('0xc1')](_0x50a459,_0xbf4e('0xe1')+_0x2a1935['id']+'-'+_0x6af5b0+'.pdf'),function(_0x438ba8,_0x4f22ff){if(_0x438ba8)return _0x17173a(_0x438ba8);_0xa8ffa9(_0x4f22ff);});});})[_0xbf4e('0x23')](function(){return new BPromise(function(_0x5030dc,_0x5cf68d){zipdir(_0x50a459,{'saveTo':_0x587cdf},function(_0x3f71d1,_0x279067){if(_0x3f71d1)return _0x5cf68d(_0x3f71d1);return _0x5030dc(_0x279067);});})[_0xbf4e('0x23')](function(){return new BPromise(function(_0x26cf16,_0x34fa08){rimraf(_0x50a459,function(_0x57b42d){if(_0x57b42d)_0x34fa08(_0x57b42d);return _0x26cf16();});});})[_0xbf4e('0x23')](function(){return _0x3056d6[_0xbf4e('0xe2')](_0x587cdf,_0x76d0dd,function(_0x1ebfd7){if(_0x1ebfd7){console[_0xbf4e('0xe3')]('err',_0x1ebfd7);}else{fs[_0xbf4e('0xe4')](_0x587cdf);}});});});}else{return _0x3056d6[_0xbf4e('0x25')](0xc8);}})[_0xbf4e('0x2e')](handleError(_0x3056d6,null));}; \ No newline at end of file +var _0xc368=['isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','params','fields','includeAll','include','options','create','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','rawAttributes','SmsInteractionId','format','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','Messages','direction','Account','Owner','get','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','secret','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','name','Users','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','value','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','buildExpression','some','compact'];(function(_0x489d19,_0x2e7a46){var _0x4cef0d=function(_0x14172e){while(--_0x14172e){_0x489d19['push'](_0x489d19['shift']());}};_0x4cef0d(++_0x2e7a46);}(_0xc368,0x7b));var _0x8c36=function(_0x104874,_0x534ec2){_0x104874=_0x104874-0x0;var _0x5afefb=_0xc368[_0x104874];return _0x5afefb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c36('0x1'));var jsonpatch=require(_0x8c36('0x2'));var rp=require(_0x8c36('0x3'));var moment=require(_0x8c36('0x4'));var BPromise=require(_0x8c36('0x5'));var Mustache=require('mustache');var util=require(_0x8c36('0x6'));var path=require(_0x8c36('0x7'));var sox=require(_0x8c36('0x8'));var csv=require(_0x8c36('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8c36('0xa'));var crypto=require(_0x8c36('0xb'));var jsforce=require(_0x8c36('0xc'));var deskjs=require(_0x8c36('0xd'));var toCsv=require(_0x8c36('0x9'));var querystring=require(_0x8c36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c36('0xf'));var as=require(_0x8c36('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c36('0x11'))(_0x8c36('0x12'));var utils=require(_0x8c36('0x13'));var config=require(_0x8c36('0x14'));var db=require(_0x8c36('0x15'))['db'];config[_0x8c36('0x16')]=_[_0x8c36('0x17')](config[_0x8c36('0x16')],{'host':_0x8c36('0x18'),'port':0x18eb});var socket=require(_0x8c36('0x19'))(new Redis(config[_0x8c36('0x16')]));require(_0x8c36('0x1a'))[_0x8c36('0x1b')](socket);function respondWithStatusCode(_0x220f18,_0x5dfcd5){_0x5dfcd5=_0x5dfcd5||0xcc;return function(_0x31d8bf){if(_0x31d8bf){return _0x220f18['sendStatus'](_0x5dfcd5);}return _0x220f18[_0x8c36('0x1c')](_0x5dfcd5)[_0x8c36('0x1d')]();};}function respondWithResult(_0x29e791,_0x1fc68e){_0x1fc68e=_0x1fc68e||0xc8;return function(_0xcfdbf7){if(_0xcfdbf7){return _0x29e791[_0x8c36('0x1c')](_0x1fc68e)[_0x8c36('0x1e')](_0xcfdbf7);}};}function respondWithFilteredResult(_0x40cecf,_0x30229e){return function(_0x49cafe){if(_0x49cafe){var _0x2be9b0=_0x49cafe[_0x8c36('0x1f')],_0x46ae6e=_0x30229e['offset'],_0x47832a=_0x30229e[_0x8c36('0x20')]+_0x30229e[_0x8c36('0x21')],_0x2d5e5b;if(_0x47832a>=_0x2be9b0){_0x47832a=_0x2be9b0;_0x2d5e5b=0xc8;}else{_0x2d5e5b=0xce;}_0x40cecf[_0x8c36('0x1c')](_0x2d5e5b);return _0x40cecf[_0x8c36('0x22')](_0x8c36('0x23'),_0x46ae6e+'-'+_0x47832a+'/'+_0x2be9b0)[_0x8c36('0x1e')](_0x49cafe);}return null;};}function patchUpdates(_0xfb9763){return function(_0x399d73){try{jsonpatch[_0x8c36('0x24')](_0x399d73,_0xfb9763,!![]);}catch(_0x474c5d){return BPromise[_0x8c36('0x25')](_0x474c5d);}return _0x399d73[_0x8c36('0x26')]();};}function saveUpdates(_0x46645d,_0x51fd6c){return function(_0x5891ef){if(_0x5891ef){return _0x5891ef['update'](_0x46645d)['then'](function(_0x2269f5){return _0x2269f5;});}return null;};}function removeEntity(_0x7effb8,_0x2088aa){return function(_0x2c9e9a){if(_0x2c9e9a){return _0x2c9e9a[_0x8c36('0x27')]()[_0x8c36('0x28')](function(){_0x7effb8['status'](0xcc)[_0x8c36('0x1d')]();});}};}function handleEntityNotFound(_0x49f6f9,_0x40b66f){return function(_0x52b90c){if(!_0x52b90c){_0x49f6f9[_0x8c36('0x29')](0x194);}return _0x52b90c;};}function handleError(_0x1afee4,_0x271ec4){_0x271ec4=_0x271ec4||0x1f4;return function(_0x1010c8){logger['error'](_0x1010c8['stack']);if(_0x1010c8[_0x8c36('0x2a')]){delete _0x1010c8[_0x8c36('0x2a')];}_0x1afee4['status'](_0x271ec4)['send'](_0x1010c8);};}function getInteractionUsers(_0x418663,_0x2b5a8c){return new BPromise(function(_0x502fa3,_0x1280a1){try{if(_0x2b5a8c[_0x418663['id']]){_0x418663[_0x8c36('0x2b')]=_[_0x8c36('0x2c')](_0x2b5a8c[_0x418663['id']],function(_0x4bc057){return{'id':_0x4bc057['id'],'fullname':_0x4bc057['fullname']};});}}catch(_0x46b72f){_0x1280a1(_0x46b72f);}_0x502fa3(_0x418663);});}function getInteractionTags(_0x1531fc,_0x3d7056){return new BPromise(function(_0x192ce3,_0x3ae970){try{if(_0x1531fc[_0x8c36('0x2d')]){_0x1531fc[_0x8c36('0x2e')]=[];_0x1531fc[_0x8c36('0x2d')][_0x8c36('0x2f')](',')[_0x8c36('0x30')](function(_0x35a349){_0x1531fc[_0x8c36('0x2e')][_0x8c36('0x31')](_0x3d7056[_0x35a349]);});}delete _0x1531fc[_0x8c36('0x2d')];}catch(_0x103d26){_0x3ae970(_0x103d26);}_0x192ce3(_0x1531fc);});}function updateSmsInteraction(_0x239fa3,_0x2e6b95,_0x5eae0a){return new BPromise(function(_0x4e8d12,_0x5c110d){return getInteractionUsers(_0x239fa3,_0x5eae0a)[_0x8c36('0x28')](function(_0x2c9a8c){return getInteractionTags(_0x2c9a8c,_0x2e6b95);})[_0x8c36('0x28')](function(_0x2fedd6){_0x4e8d12(_0x2fedd6);})[_0x8c36('0x32')](function(_0x2de1e8){_0x5c110d(_0x2de1e8);});});}exports[_0x8c36('0x33')]=function(_0x5aaab6,_0x17b5e3){var _0x59a4e6={},_0x3def90={},_0x5c743b={'count':0x0,'rows':[]};var _0x43b465=_[_0x8c36('0x2c')](db[_0x8c36('0x34')]['rawAttributes'],function(_0x1f0f9a){return{'name':_0x1f0f9a[_0x8c36('0x35')],'type':_0x1f0f9a[_0x8c36('0x36')][_0x8c36('0x37')]};});_0x3def90[_0x8c36('0x38')]=_[_0x8c36('0x2c')](_0x43b465,_0x8c36('0x2a'));_0x3def90[_0x8c36('0x39')]=_[_0x8c36('0x3a')](_0x5aaab6[_0x8c36('0x39')]);_0x3def90[_0x8c36('0x3b')]=_[_0x8c36('0x3c')](_0x3def90[_0x8c36('0x38')],_0x3def90[_0x8c36('0x39')]);_0x59a4e6[_0x8c36('0x3d')]=_[_0x8c36('0x3c')](_0x3def90[_0x8c36('0x38')],qs['fields'](_0x5aaab6[_0x8c36('0x39')]['fields']));_0x59a4e6[_0x8c36('0x3d')]=_0x59a4e6[_0x8c36('0x3d')][_0x8c36('0x3e')]?_0x59a4e6[_0x8c36('0x3d')]:_0x3def90['model'];if(!_0x5aaab6['query'][_0x8c36('0x3f')](_0x8c36('0x40'))){_0x59a4e6[_0x8c36('0x21')]=qs['limit'](_0x5aaab6['query'][_0x8c36('0x21')]);_0x59a4e6['offset']=qs['offset'](_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x20')]);}_0x59a4e6[_0x8c36('0x41')]=qs[_0x8c36('0x42')](_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x42')]);_0x59a4e6[_0x8c36('0x43')]=qs[_0x8c36('0x3b')](_[_0x8c36('0x44')](_0x5aaab6[_0x8c36('0x39')],_0x3def90['filters']),_0x43b465);var _0x3543b0=[];var _0x24505c=squel[_0x8c36('0x45')]()[_0x8c36('0x46')]('id')[_0x8c36('0x46')]('name')[_0x8c36('0x46')](_0x8c36('0x47'))[_0x8c36('0x48')](_0x8c36('0x49'));var _0x62a72=squel[_0x8c36('0x45')]()['field'](_0x8c36('0x4a'))[_0x8c36('0x46')](_0x8c36('0x4b'))[_0x8c36('0x46')](_0x8c36('0x4c'))[_0x8c36('0x48')](_0x8c36('0x4d'),'ui')['left_join'](_0x8c36('0x4e'),'u',_0x8c36('0x4f'));var _0x9d2165=squel[_0x8c36('0x45')]()[_0x8c36('0x48')](_0x8c36('0x50'),'i')[_0x8c36('0x51')](_0x8c36('0x52'),'c',_0x8c36('0x53'))[_0x8c36('0x51')](_0x8c36('0x4e'),'o',_0x8c36('0x54'))['left_join']('sms_accounts','a',_0x8c36('0x55'))[_0x8c36('0x51')](_0x8c36('0x56'),'me',_0x8c36('0x57'))['left_join'](_0x8c36('0x58'),'it',_0x8c36('0x59'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0xb4ebae=squel[_0x8c36('0x5a')]();var _0x3297f1=[];var _0x197d11=squel[_0x8c36('0x5a')]();var _0x2778b3;if(_0x5aaab6['query'][_0x8c36('0x5b')]){_0x2778b3=as[_0x8c36('0x5c')](_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x5b')]);var _0x579bef=_0x2778b3['sqlOperator'];for(var _0x599116=0x0;_0x599116<_0x2778b3[_0x8c36('0x5d')][_0x8c36('0x3e')];_0x599116++){var _0x2fc48b=_0x2778b3[_0x8c36('0x5d')][_0x599116];var _0x24f3f9='i';var _0x3d5e0d=_[_0x8c36('0x5e')](_0x43b465,[_0x8c36('0x2a'),_0x2fc48b[_0x8c36('0x46')]]);if(!_0x3d5e0d){switch(_0x2fc48b['field']){case'unreadMessages':if(_0x2fc48b[_0x8c36('0x5f')]==0x1){_0x9d2165['having']('`'+_0x2fc48b['field']+_0x8c36('0x60'));}else{_0x9d2165['having']('`'+_0x2fc48b[_0x8c36('0x46')]+_0x8c36('0x61'));}break;case'Contact':if(_0x2fc48b[_0x8c36('0x62')]==='$substring'){if(_0x2fc48b[_0x8c36('0x5f')][_0x8c36('0x2f')]('\x20')[_0x8c36('0x3e')]>0x1){_0xb4ebae[_0x579bef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8c36('0x63')](_0x2fc48b[_0x8c36('0x5f')]),null);}else{var _0x2e1e03='%'+_0x2fc48b[_0x8c36('0x5f')]+'%';_0xb4ebae[_0x579bef](_0x8c36('0x64'),_0x2e1e03,_0x2e1e03,_0x2e1e03);}}else{_0x3d5e0d=_[_0x8c36('0x5e')](_0x43b465,[_0x8c36('0x2a'),_0x8c36('0x65')]);_0x2fc48b[_0x8c36('0x46')]='ContactId';_0xe59f9b=as['buildExpression'](_0x24f3f9,_0x3d5e0d['type'],_0x2fc48b);_0xb4ebae[_0x579bef](_0xe59f9b[_0x8c36('0x66')],_0xe59f9b['value']['start'],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x1d')]);}break;case _0x8c36('0x67'):var _0x444c36=_0x2fc48b[_0x8c36('0x5f')]['split'](',')['map'](function(_0x54c675){return Number(_0x54c675);});_0x444c36[_0x8c36('0x30')](function(_0x243c1a){_0x197d11['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x243c1a+',%');});_0x3297f1=_[_0x8c36('0x68')](_0x3297f1,_0x444c36);break;case _0x8c36('0x69'):if(_0x2fc48b[_0x8c36('0x62')]===_0x8c36('0x6a')){_0xb4ebae[_0x579bef](_0x8c36('0x6b'),'%'+_0x2fc48b[_0x8c36('0x5f')]+'%',null);}else{_0x3d5e0d=_[_0x8c36('0x5e')](_0x43b465,[_0x8c36('0x2a'),_0x8c36('0x6c')]);_0x2fc48b['field']='UserId';_0xe59f9b=as['buildExpression'](_0x24f3f9,_0x3d5e0d[_0x8c36('0x36')],_0x2fc48b);_0xb4ebae[_0x579bef](_0xe59f9b[_0x8c36('0x66')],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x6d')],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x1d')]);}break;case'body':_0xe59f9b=as[_0x8c36('0x6e')]('me',null,_0x2fc48b);_0xb4ebae[_0x579bef](_0xe59f9b['text'],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x6d')],_0xe59f9b[_0x8c36('0x5f')]['end']);break;}}else{var _0xe59f9b=as['buildExpression'](_0x24f3f9,_0x3d5e0d[_0x8c36('0x36')],_0x2fc48b);_0xb4ebae[_0x579bef](_0xe59f9b[_0x8c36('0x66')],_0xe59f9b[_0x8c36('0x5f')][_0x8c36('0x6d')],_0xe59f9b[_0x8c36('0x5f')]['end']);}}}else{var _0x61b2b7=_(_0x5aaab6['query'])[_0x8c36('0x3a')]()[_0x8c36('0x2c')](function(_0x59cceb){return _[_0x8c36('0x6f')](_0x43b465,[_0x8c36('0x2a'),_0x59cceb])?_0x59cceb:undefined;})[_0x8c36('0x70')]()['value']();if(!_[_0x8c36('0x71')](_0x61b2b7)){_0x61b2b7[_0x8c36('0x30')](function(_0x43d4d3){if(_0x43d4d3===_0x8c36('0x72')){_0x9d2165['where'](_0x8c36('0x73'),[][_0x8c36('0x74')](_0x5aaab6['query'][_0x43d4d3]));}else if(_0x43d4d3===_0x8c36('0x75')){var _0x1bfe8c=JSON[_0x8c36('0x76')](_0x5aaab6['query'][_0x43d4d3])[_0x8c36('0x77')];var _0x115a51=JSON['parse'](_0x5aaab6[_0x8c36('0x39')][_0x43d4d3])[_0x8c36('0x78')];_0x9d2165[_0x8c36('0x43')](_0x8c36('0x79'),_0x1bfe8c,_0x115a51);}else{if(_0x5aaab6['query'][_0x43d4d3]===_0x8c36('0x7a')){_0x9d2165['where']('i.'+_0x43d4d3+_0x8c36('0x7b'));}else{_0x9d2165[_0x8c36('0x43')]('i.'+_0x43d4d3+'\x20=\x20?',_0x5aaab6[_0x8c36('0x39')][_0x43d4d3]);}}});}if(_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7c')]){if(_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7c')]==0x1){_0x9d2165[_0x8c36('0x7d')](_0x8c36('0x7e'));}else{_0x9d2165[_0x8c36('0x7d')]('`unreadMessages`\x20>\x200');}}if(_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7f')]){_0x3297f1=_[_0x8c36('0x80')](_0x5aaab6['query'][_0x8c36('0x7f')])?_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7f')]:new Array(_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x7f')]);_0x3297f1['forEach'](function(_0x291a1f){_0x197d11['or'](_0x8c36('0x81'),'%,'+_0x291a1f+',%');});}if(_0x5aaab6[_0x8c36('0x39')]['filter']){var _0x29581d=_0x5aaab6[_0x8c36('0x39')][_0x8c36('0x82')][_0x8c36('0x83')]('\x5c','\x5c\x5c')[_0x8c36('0x83')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x8c36('0x84')](_0x29581d)){_0xb4ebae['or'](_0x8c36('0x85'),_0x29581d+'%')['or'](_0x8c36('0x86'),_0x29581d+'%');}else{_0xb4ebae['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8c36('0x63')](_0x29581d))['or'](_0x8c36('0x87'),_0x29581d+'%');}}}_0x9d2165[_0x8c36('0x43')](_0xb4ebae);_0x9d2165[_0x8c36('0x88')](_0x8c36('0x89'));var _0x114dcc={'type':db[_0x8c36('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4b193f=_0x9d2165[_0x8c36('0x8b')]();_0x4b193f[_0x8c36('0x46')](_0x8c36('0x89'));_0x4b193f[_0x8c36('0x46')](_0x8c36('0x8c'),_0x8c36('0x8d'));if(_0x59a4e6[_0x8c36('0x41')]){_0x59a4e6[_0x8c36('0x41')][_0x8c36('0x30')](function(_0x26a80a){_0x9d2165[_0x8c36('0x41')]('i.'+_0x26a80a[0x0],_0x26a80a[0x1]===_0x8c36('0x8e')?![]:!![]);});}if(!_[_0x8c36('0x71')](_0x3297f1)){_0x9d2165[_0x8c36('0x7d')](_0x197d11);_0x4b193f[_0x8c36('0x43')](_0x8c36('0x8f'),_0x3297f1);}BPromise[_0x8c36('0x90')]()[_0x8c36('0x28')](function(){if(!_0x2778b3){if(_0x5aaab6['query'][_0x8c36('0x72')]||_0x5aaab6['query']['journey'])return;_0x4b193f[_0x8c36('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x9d2165[_0x8c36('0x43')](_0x8c36('0x91'));return;}return _0x5aaab6[_0x8c36('0x92')][_0x8c36('0x93')]({'attributes':['id'],'raw':!![]})[_0x8c36('0x28')](function(_0x438224){if(_[_0x8c36('0x71')](_0x438224)){_0x4b193f['where']('i.SmsAccountId\x20IS\x20NULL');_0x9d2165[_0x8c36('0x43')](_0x8c36('0x94'));}else{_0x4b193f['where'](_0x8c36('0x73'),_[_0x8c36('0x2c')](_0x438224,'id'));_0x9d2165[_0x8c36('0x43')](_0x8c36('0x73'),_['map'](_0x438224,'id'));}});})[_0x8c36('0x28')](function(){db[_0x8c36('0x95')][_0x8c36('0x39')](_0x4b193f[_0x8c36('0x96')](),_0x114dcc)[_0x8c36('0x28')](function(_0x431a8e){_0x5c743b['count']=_0x431a8e[_0x8c36('0x3e')];if(_0x5c743b[_0x8c36('0x1f')]===0x0)return[];return db[_0x8c36('0x95')][_0x8c36('0x39')](_0x24505c[_0x8c36('0x96')](),_0x114dcc)[_0x8c36('0x28')](function(_0x257c2a){_0x3543b0=_[_0x8c36('0x97')](_0x257c2a,'id');_0x114dcc=_[_0x8c36('0x98')](_0x114dcc,{'model':db[_0x8c36('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5aaab6['query']['fields']){_0x59a4e6[_0x8c36('0x3d')]['forEach'](function(_0x4dbf66){_0x9d2165[_0x8c36('0x46')]('i.'+_0x4dbf66);});}else{_0x9d2165[_0x8c36('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8c36('0x8d'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0x99'),_0x8c36('0x9a'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0x9b'),'Account.mandatoryDisposition');_0x9d2165['field'](_0x8c36('0x9c'));_0x9d2165[_0x8c36('0x46')]('c.firstName',_0x8c36('0x9d'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0x9e'),_0x8c36('0x9f'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa0'),'Contact.email');_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa1'),_0x8c36('0xa2'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa3'),_0x8c36('0xa4'));_0x9d2165['field']('c.fax',_0x8c36('0xa5'));_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa6'),_0x8c36('0xa7'));_0x9d2165[_0x8c36('0x46')]('o.internal','Owner.internal');_0x9d2165[_0x8c36('0x46')](_0x8c36('0xa8'),_0x8c36('0x2d'));}if(_0x59a4e6['limit'])_0x9d2165[_0x8c36('0x21')](_0x59a4e6[_0x8c36('0x21')]);if(_0x59a4e6[_0x8c36('0x20')])_0x9d2165[_0x8c36('0x20')](_0x59a4e6[_0x8c36('0x20')]);return db[_0x8c36('0x95')][_0x8c36('0x39')](_0x9d2165[_0x8c36('0x96')](),_0x114dcc);})[_0x8c36('0x28')](function(_0x440eed){_0x62a72[_0x8c36('0x43')](_0x8c36('0xa9'),_['map'](_0x440eed,'id'));return db[_0x8c36('0x95')][_0x8c36('0x39')](_0x62a72['toString'](),_0x114dcc)['then'](function(_0xe69b4a){var _0x2b9027=_[_0x8c36('0xaa')](_0xe69b4a,'SmsInteractionId');var _0x7d675c=[];_0x440eed[_0x8c36('0x30')](function(_0x1743a4){_0x7d675c[_0x8c36('0x31')](updateSmsInteraction(_0x1743a4,_0x3543b0,_0x2b9027));});return BPromise['all'](_0x7d675c);});});})[_0x8c36('0x28')](function(_0x2a7321){_0x5c743b['rows']=_0x2a7321;return _0x5c743b;})[_0x8c36('0x28')](respondWithFilteredResult(_0x17b5e3,_0x59a4e6));})[_0x8c36('0x32')](handleError(_0x17b5e3,null));};exports['show']=function(_0x413519,_0x35ce4a){var _0x3f1102={'raw':![],'where':{'id':_0x413519[_0x8c36('0xab')]['id']}},_0x42fa00={};_0x42fa00[_0x8c36('0x38')]=_[_0x8c36('0x3a')](db['SmsInteraction']['rawAttributes']);_0x42fa00['query']=_[_0x8c36('0x3a')](_0x413519[_0x8c36('0x39')]);_0x42fa00[_0x8c36('0x3b')]=_[_0x8c36('0x3c')](_0x42fa00[_0x8c36('0x38')],_0x42fa00[_0x8c36('0x39')]);_0x3f1102['attributes']=_[_0x8c36('0x3c')](_0x42fa00[_0x8c36('0x38')],qs[_0x8c36('0xac')](_0x413519[_0x8c36('0x39')]['fields']));_0x3f1102['attributes']=_0x3f1102[_0x8c36('0x3d')][_0x8c36('0x3e')]?_0x3f1102[_0x8c36('0x3d')]:_0x42fa00['model'];if(_0x413519[_0x8c36('0x39')][_0x8c36('0xad')]){_0x3f1102[_0x8c36('0xae')]=[{'all':!![]}];}_0x3f1102=_['merge']({},_0x3f1102,_0x413519[_0x8c36('0xaf')]);return db['SmsInteraction'][_0x8c36('0x5e')](_0x3f1102)[_0x8c36('0x28')](handleEntityNotFound(_0x35ce4a,null))['then'](respondWithResult(_0x35ce4a,null))[_0x8c36('0x32')](handleError(_0x35ce4a,null));};exports[_0x8c36('0xb0')]=function(_0x363065,_0x312b13){return db[_0x8c36('0x34')][_0x8c36('0xb0')](_0x363065[_0x8c36('0xb1')],{})[_0x8c36('0x28')](respondWithResult(_0x312b13,0xc9))['catch'](handleError(_0x312b13,null));};exports['update']=function(_0x105057,_0x3a237b){if(_0x105057[_0x8c36('0xb1')]['id']){delete _0x105057['body']['id'];}return db[_0x8c36('0x34')][_0x8c36('0x5e')]({'where':{'id':_0x105057['params']['id']}})['then'](handleEntityNotFound(_0x3a237b,null))[_0x8c36('0x28')](saveUpdates(_0x105057[_0x8c36('0xb1')],null))['then'](respondWithResult(_0x3a237b,null))[_0x8c36('0x32')](handleError(_0x3a237b,null));};exports[_0x8c36('0x27')]=function(_0x216e87,_0x2e800a){return db['SmsInteraction'][_0x8c36('0x5e')]({'where':{'id':_0x216e87[_0x8c36('0xab')]['id']}})[_0x8c36('0x28')](handleEntityNotFound(_0x2e800a,null))[_0x8c36('0x28')](removeEntity(_0x2e800a,null))['catch'](handleError(_0x2e800a,null));};exports[_0x8c36('0xb2')]=function(_0x14e96b,_0x40a276){return db[_0x8c36('0x34')][_0x8c36('0xb2')]()['then'](respondWithResult(_0x40a276,null))[_0x8c36('0x32')](handleError(_0x40a276,null));};exports[_0x8c36('0xb3')]=function(_0x4423dc,_0x52ea62,_0x253db3){return db[_0x8c36('0xb4')][_0x8c36('0x5e')]({'where':{'id':_0x4423dc['params']['id']}})['then'](handleEntityNotFound(_0x52ea62,null))['then'](function(_0x5ba123){if(_0x5ba123){return _0x5ba123[_0x8c36('0xb3')](_0x4423dc['body']['ids'],_[_0x8c36('0xb5')](_0x4423dc['body'],[_0x8c36('0xb6'),'id'])||{});}})[_0x8c36('0x28')](respondWithResult(_0x52ea62,null))[_0x8c36('0x32')](handleError(_0x52ea62,null));};exports[_0x8c36('0xb7')]=function(_0x5887ec,_0x36b1c9,_0xe60a72){var _0x1d4988={'raw':![],'where':{}};var _0x4a308f={};var _0x397deb={'count':0x0,'rows':[]};return db[_0x8c36('0x34')][_0x8c36('0xb8')]({'where':{'id':_0x5887ec[_0x8c36('0xab')]['id']}})[_0x8c36('0x28')](handleEntityNotFound(_0x36b1c9,null))[_0x8c36('0x28')](function(_0x323618){if(_0x323618){_0x4a308f['model']=_[_0x8c36('0x3a')](db[_0x8c36('0xb4')][_0x8c36('0xb9')]);_0x4a308f[_0x8c36('0x39')]=_[_0x8c36('0x3a')](_0x5887ec[_0x8c36('0x39')]);_0x4a308f[_0x8c36('0x3b')]=_[_0x8c36('0x3c')](_0x4a308f[_0x8c36('0x38')],_0x4a308f[_0x8c36('0x39')]);_0x1d4988[_0x8c36('0x3d')]=_[_0x8c36('0x3c')](_0x4a308f['model'],qs['fields'](_0x5887ec[_0x8c36('0x39')][_0x8c36('0xac')]));_0x1d4988[_0x8c36('0x3d')]=_0x1d4988[_0x8c36('0x3d')][_0x8c36('0x3e')]?_0x1d4988[_0x8c36('0x3d')]:_0x4a308f[_0x8c36('0x38')];if(!_0x5887ec['query']['hasOwnProperty']('nolimit')){_0x1d4988[_0x8c36('0x21')]=qs[_0x8c36('0x21')](_0x5887ec[_0x8c36('0x39')][_0x8c36('0x21')]);_0x1d4988['offset']=qs[_0x8c36('0x20')](_0x5887ec[_0x8c36('0x39')][_0x8c36('0x20')]);}_0x1d4988[_0x8c36('0x41')]=qs[_0x8c36('0x42')](_0x5887ec[_0x8c36('0x39')][_0x8c36('0x42')]);_0x1d4988['where']=qs[_0x8c36('0x3b')](_[_0x8c36('0x44')](_0x5887ec[_0x8c36('0x39')],_0x4a308f[_0x8c36('0x3b')]));_0x1d4988[_0x8c36('0x43')][_0x8c36('0xba')]=_0x323618['id'];if(_0x5887ec[_0x8c36('0x39')][_0x8c36('0x82')]){_0x1d4988['where']=_[_0x8c36('0x98')](_0x1d4988[_0x8c36('0x43')],{'$or':_[_0x8c36('0x2c')](_0x1d4988[_0x8c36('0x3d')],function(_0xe1d9ab){var _0x511b31={};_0x511b31[_0xe1d9ab]={'$like':'%'+_0x5887ec[_0x8c36('0x39')][_0x8c36('0x82')]+'%'};return _0x511b31;})});}if(_0x5887ec[_0x8c36('0x39')][_0x8c36('0x77')]){var _0x416405=_0x5887ec[_0x8c36('0x39')][_0x8c36('0x77')][_0x8c36('0x2f')](',');var _0x56c11f={};_0x56c11f[_0x416405[0x0]]={'$gte':moment(_0x416405[0x1])[_0x8c36('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d4988['where']=_['merge'](_0x1d4988[_0x8c36('0x43')],_0x56c11f);}_0x1d4988=_[_0x8c36('0x98')]({},_0x1d4988,_0x5887ec[_0x8c36('0xaf')]);return db['SmsMessage'][_0x8c36('0x1f')]({'where':_0x1d4988[_0x8c36('0x43')]})[_0x8c36('0x28')](function(_0x53106c){_0x397deb['count']=_0x53106c;if(_0x5887ec[_0x8c36('0x39')]['includeAll']){_0x1d4988[_0x8c36('0xae')]=[{'all':!![]}];}return db[_0x8c36('0xb4')][_0x8c36('0xbc')](_0x1d4988);})['then'](function(_0xcb42e){_0x397deb[_0x8c36('0xbd')]=_0xcb42e;return _0x397deb;});}})[_0x8c36('0x28')](respondWithFilteredResult(_0x36b1c9,_0x1d4988))['catch'](handleError(_0x36b1c9,null));};exports[_0x8c36('0xbe')]=function(_0x6cb232,_0xb38f74,_0x2da99c){return db[_0x8c36('0x34')][_0x8c36('0x5e')]({'where':{'id':_0x6cb232['params']['id']}})[_0x8c36('0x28')](handleEntityNotFound(_0xb38f74,null))[_0x8c36('0x28')](function(_0x3a9951){if(_0x3a9951){return _0x3a9951[_0x8c36('0xbf')](_0x6cb232[_0x8c36('0xb1')]['ids'],_['omit'](_0x6cb232['body'],['ids','id'])||{})[_0x8c36('0xc0')](function(){return db['Tag'][_0x8c36('0xbc')]({'attributes':['id',_0x8c36('0x2a'),_0x8c36('0x47')],'where':{'id':_0x6cb232['body'][_0x8c36('0xb6')]}});})['then'](function(_0x21120c){socket[_0x8c36('0xc1')](_0x8c36('0xc2'),{'id':Number(_0x6cb232[_0x8c36('0xab')]['id']),'tags':_0x21120c||[]});return{'id':Number(_0x6cb232[_0x8c36('0xab')]['id']),'tags':_0x21120c||[]};});}})[_0x8c36('0x28')](respondWithResult(_0xb38f74,null))[_0x8c36('0x32')](handleError(_0xb38f74,null));};exports[_0x8c36('0xc3')]=function(_0x4de9c8,_0x47194d,_0x54967c){return db[_0x8c36('0x34')]['find']({'where':{'id':_0x4de9c8['params']['id']}})['then'](handleEntityNotFound(_0x47194d,null))[_0x8c36('0x28')](function(_0x4d322c){if(_0x4d322c){return _0x4d322c[_0x8c36('0xc3')](_0x4de9c8['query'][_0x8c36('0xb6')]);}})[_0x8c36('0x28')](respondWithStatusCode(_0x47194d,null))[_0x8c36('0x32')](handleError(_0x47194d,null));};exports[_0x8c36('0xc4')]=function(_0x2cc362,_0xd2a10e){var _0x222824=moment()['unix']()['toString']();var _0x376e64=path[_0x8c36('0xc5')](config[_0x8c36('0xc6')],_0x8c36('0xc7'),_0x8c36('0xc8'),'tmp');var _0x5466bc=path[_0x8c36('0xc5')](config['root'],_0x8c36('0xc7'),_0x8c36('0xc8'),_0x8c36('0xc9'));var _0x2c76f8=path['join'](_0x376e64,_0x222824);var _0x76be11=util[_0x8c36('0xbb')](_0x8c36('0xca'),_0x2cc362[_0x8c36('0xab')]['id'],_0x222824);var _0x3fa94a=path['join'](_0x376e64,_0x76be11);var _0x1e41d9=[];_0x1e41d9[_0x8c36('0x31')]({'model':db['User'],'as':_0x8c36('0x69'),'attributes':['id',_0x8c36('0xcb')],'raw':!![]});_0x1e41d9[_0x8c36('0x31')]({'model':db[_0x8c36('0xcc')],'as':_0x8c36('0xcd'),'attributes':['id',_0x8c36('0xce'),_0x8c36('0xcf')],'raw':!![]});var _0x44285d=[{'model':db[_0x8c36('0xb4')],'as':_0x8c36('0xd0'),'attributes':['id',_0x8c36('0xb1'),_0x8c36('0x75'),_0x8c36('0xd1'),'secret','read'],'include':_0x1e41d9}];_0x44285d['push']({'model':db['SmsAccount'],'as':_0x8c36('0xd2'),'attributes':['id',_0x8c36('0x2a')]});_0x44285d[_0x8c36('0x31')]({'model':db['User'],'as':_0x8c36('0xd3'),'attributes':['id',_0x8c36('0xcb')]});return db[_0x8c36('0x34')]['find']({'where':{'id':_0x2cc362[_0x8c36('0xab')]['id']},'include':_0x44285d})[_0x8c36('0x28')](handleEntityNotFound(_0xd2a10e,null))[_0x8c36('0x28')](function(_0x1f8f87){if(_0x1f8f87){var _0x2326d8=_0x1f8f87[_0x8c36('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x2c76f8);var _0x2adf71={'format':'A4','border':_0x8c36('0xd5'),'header':{'height':'40px','contents':{'first':_0x8c36('0xd6')}},'footer':{'height':_0x8c36('0xd7'),'contents':{'default':util[_0x8c36('0xbb')](_0x8c36('0xd8'),util[_0x8c36('0xbb')](_0x8c36('0xd9'),_0x8c36('0xda'),_0x2326d8['id']),moment()['format'](_0x8c36('0xdb'))[_0x8c36('0x96')]())}}};var _0x4b4060={'channel':_0x8c36('0xda'),'account':_0x2326d8['Account'][_0x8c36('0x2a')],'agent':_0x2326d8[_0x8c36('0xd3')]?_0x2326d8[_0x8c36('0xd3')][_0x8c36('0xcb')]:_0x8c36('0xdc'),'createdAt':moment(_0x2326d8[_0x8c36('0x75')])[_0x8c36('0xbb')](_0x8c36('0xdd'))[_0x8c36('0x96')](),'closedAt':_0x2326d8[_0x8c36('0xde')]?moment(_0x2326d8[_0x8c36('0xdf')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x8c36('0x96')]():'','disposition':_0x2326d8[_0x8c36('0xe0')],'messages':_(_0x2326d8[_0x8c36('0xd0')])['filter']({'secret':![]})[_0x8c36('0x2c')](function(_0xd3dc5a){return{'date':moment(_0xd3dc5a['createdAt'])[_0x8c36('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8c36('0x96')](),'sender':_0xd3dc5a['direction']===_0x8c36('0xe1')?_0xd3dc5a[_0x8c36('0x69')]?_0xd3dc5a['User'][_0x8c36('0xcb')]:_0x8c36('0xe2'):_0xd3dc5a[_0x8c36('0xcd')][_0x8c36('0xce')]+(_0xd3dc5a[_0x8c36('0xcd')][_0x8c36('0xcf')]?'\x20'+_0xd3dc5a['Contact'][_0x8c36('0xcf')]:''),'body':_0xd3dc5a['body'],'direction':_0xd3dc5a[_0x8c36('0xd1')]==='out'?'A':'C','secret':_0xd3dc5a[_0x8c36('0xe3')],'read':_0xd3dc5a[_0x8c36('0x7c')]};})['value']()};return ejs[_0x8c36('0xe4')](path['join'](config[_0x8c36('0xc6')],_0x8c36('0xc7'),'views',_0x8c36('0xe5')),{'interaction':_0x4b4060})[_0x8c36('0x28')](function(_0x242409){return new BPromise(function(_0x101369,_0x31c8f8){pdf[_0x8c36('0xb0')](_0x242409,_0x2adf71)[_0x8c36('0xe6')](path[_0x8c36('0xc5')](_0x2c76f8,_0x8c36('0xe7')+_0x2326d8['id']+'-'+_0x222824+_0x8c36('0xe8')),function(_0x1e729c,_0x5148d9){if(_0x1e729c)return _0x31c8f8(_0x1e729c);_0x101369(_0x5148d9);});});})['then'](function(){return new BPromise(function(_0x3143b2,_0x2d6b7e){zipdir(_0x2c76f8,{'saveTo':_0x3fa94a},function(_0xecf066,_0x15ec96){if(_0xecf066)return _0x2d6b7e(_0xecf066);return _0x3143b2(_0x15ec96);});})['then'](function(){return new BPromise(function(_0x285a25,_0xbe4063){rimraf(_0x2c76f8,function(_0x484829){if(_0x484829)_0xbe4063(_0x484829);return _0x285a25();});});})[_0x8c36('0x28')](function(){return _0xd2a10e['download'](_0x3fa94a,_0x76be11,function(_0x441465){if(_0x441465){console[_0x8c36('0xe9')](_0x8c36('0xea'),_0x441465);}else{fs[_0x8c36('0xeb')](_0x3fa94a);}});});});}else{return _0xd2a10e['sendStatus'](0xc8);}})[_0x8c36('0x32')](handleError(_0xd2a10e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 133863a..ca96093 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 _0xa41a=['unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','then'];(function(_0x53b721,_0x8427e8){var _0x8dd676=function(_0x4967cd){while(--_0x4967cd){_0x53b721['push'](_0x53b721['shift']());}};_0x8dd676(++_0x8427e8);}(_0xa41a,0x6b));var _0xaa41=function(_0x205b84,_0x4ebafc){_0x205b84=_0x205b84-0x0;var _0x55f842=_0xa41a[_0x205b84];return _0x55f842;};'use strict';var EventEmitter=require(_0xaa41('0x0'));var SmsInteraction=require(_0xaa41('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xaa41('0x1'))['db'][_0xaa41('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xaa41('0x3')](0x0);var events={'afterCreate':_0xaa41('0x4'),'afterUpdate':_0xaa41('0x5'),'afterDestroy':_0xaa41('0x6')};function emitEvent(_0x42896b){return function(_0x251efa,_0x5dad7c,_0x2122a0){_0x251efa[_0xaa41('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5b1fff){_0x251efa[_0xaa41('0x8')](_0xaa41('0x9'),_0x5b1fff['map'](function(_0x31df43){return{'id':_0x31df43['id']};}));return SmsMessage[_0xaa41('0xa')]({'where':{'SmsInteractionId':_0x251efa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa41('0xb')](function(_0x1cc344){_0x251efa[_0xaa41('0x8')](_0xaa41('0xc'),_0x1cc344[_0xaa41('0xd')]);SmsInteractionEvents[_0xaa41('0xe')](_0x42896b+':'+_0x251efa['id'],_0x251efa);SmsInteractionEvents[_0xaa41('0xe')](_0x42896b,_0x251efa);_0x2122a0(null);})['catch'](_0x2122a0(null));};}for(var e in events){if(events[_0xaa41('0xf')](e)){var event=events[e];SmsInteraction[_0xaa41('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x6aa7=['../../mysqldb','SmsMessage','setMaxListeners','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x6aa7,0x178));var _0x76aa=function(_0x28001b,_0x5854cf){_0x28001b=_0x28001b-0x0;var _0x238a36=_0x6aa7[_0x28001b];return _0x238a36;};'use strict';var EventEmitter=require(_0x76aa('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x76aa('0x1')];var SmsMessage=require(_0x76aa('0x2'))['db'][_0x76aa('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x76aa('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x76aa('0x5'),'afterDestroy':_0x76aa('0x6')};function emitEvent(_0x1d6e04){return function(_0x511588,_0x588e62,_0x1aceaa){_0x511588['getUsers']({'attributes':['id'],'raw':!![]})[_0x76aa('0x7')](function(_0x36d12b){_0x511588[_0x76aa('0x8')]('Users',_0x36d12b[_0x76aa('0x9')](function(_0x266bd5){return{'id':_0x266bd5['id']};}));return SmsMessage[_0x76aa('0xa')]({'where':{'SmsInteractionId':_0x511588['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xcd99aa){_0x511588[_0x76aa('0x8')](_0x76aa('0xb'),_0xcd99aa[_0x76aa('0xc')]);SmsInteractionEvents[_0x76aa('0xd')](_0x1d6e04+':'+_0x511588['id'],_0x511588);SmsInteractionEvents[_0x76aa('0xd')](_0x1d6e04,_0x511588);_0x1aceaa(null);})[_0x76aa('0xe')](_0x1aceaa(null));};}for(var e in events){if(events[_0x76aa('0xf')](e)){var event=events[e];SmsInteraction[_0x76aa('0x10')](e,emitEvent(event));}}module[_0x76aa('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index f85ffc6..589859c 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 _0xcc76=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4b7118,_0x58e604){var _0x53e935=function(_0x2c4957){while(--_0x2c4957){_0x4b7118['push'](_0x4b7118['shift']());}};_0x53e935(++_0x58e604);}(_0xcc76,0x7e));var _0x6cc7=function(_0x8a2fad,_0x19afdb){_0x8a2fad=_0x8a2fad-0x0;var _0x371f81=_0xcc76[_0x8a2fad];return _0x371f81;};'use strict';var _=require(_0x6cc7('0x0'));var util=require(_0x6cc7('0x1'));var logger=require(_0x6cc7('0x2'))(_0x6cc7('0x3'));var moment=require('moment');var BPromise=require(_0x6cc7('0x4'));var rp=require(_0x6cc7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cc7('0x6'));var config=require(_0x6cc7('0x7'));var attributes=require(_0x6cc7('0x8'));module['exports']=function(_0xb70e46,_0x5acb3d){return _0xb70e46[_0x6cc7('0x9')](_0x6cc7('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e6b2e,_0x5d33b3,_0x2402a5){if(_0x4e6b2e[_0x6cc7('0xb')]('closed')){_0x4e6b2e['closedAt']=moment()[_0x6cc7('0xc')](_0x6cc7('0xd'));}_0x2402a5(null,_0x4e6b2e);}}});}; \ No newline at end of file +var _0x94c4=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x1d63c2,_0x3d133e){var _0x23c756=function(_0x1947c0){while(--_0x1947c0){_0x1d63c2['push'](_0x1d63c2['shift']());}};_0x23c756(++_0x3d133e);}(_0x94c4,0xd0));var _0x494c=function(_0x514d16,_0x52271e){_0x514d16=_0x514d16-0x0;var _0x2cabce=_0x94c4[_0x514d16];return _0x2cabce;};'use strict';var _=require(_0x494c('0x0'));var util=require(_0x494c('0x1'));var logger=require(_0x494c('0x2'))(_0x494c('0x3'));var moment=require('moment');var BPromise=require(_0x494c('0x4'));var rp=require(_0x494c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x494c('0x6'));var config=require(_0x494c('0x7'));var attributes=require(_0x494c('0x8'));module['exports']=function(_0x3beaa0,_0x4d625a){return _0x3beaa0[_0x494c('0x9')](_0x494c('0xa'),attributes,{'tableName':_0x494c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x170fa0,_0x1682dd,_0x5bef74){if(_0x170fa0[_0x494c('0xc')](_0x494c('0xd'))){_0x170fa0[_0x494c('0xe')]=moment()[_0x494c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5bef74(null,_0x170fa0);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d1c5cb0..0b74e93 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 _0xe864=['addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit'];(function(_0x2c32ad,_0x1a12d4){var _0x1d474f=function(_0xa83df7){while(--_0xa83df7){_0x2c32ad['push'](_0x2c32ad['shift']());}};_0x1d474f(++_0x1a12d4);}(_0xe864,0x83));var _0x4e86=function(_0x2f93d0,_0xde8d29){_0x2f93d0=_0x2f93d0-0x0;var _0x2f4df5=_0xe864[_0x2f93d0];return _0x2f4df5;};'use strict';var _=require(_0x4e86('0x0'));var util=require(_0x4e86('0x1'));var moment=require('moment');var BPromise=require(_0x4e86('0x2'));var rs=require(_0x4e86('0x3'));var fs=require('fs');var Redis=require(_0x4e86('0x4'));var db=require(_0x4e86('0x5'))['db'];var utils=require(_0x4e86('0x6'));var logger=require(_0x4e86('0x7'))(_0x4e86('0x8'));var config=require('../../config/environment');var jayson=require(_0x4e86('0x9'));var client=jayson['client'][_0x4e86('0xa')]({'port':0x232a});config[_0x4e86('0xb')]=_['defaults'](config[_0x4e86('0xb')],{'host':_0x4e86('0xc'),'port':0x18eb});var socket=require(_0x4e86('0xd'))(new Redis(config['redis']));require(_0x4e86('0xe'))[_0x4e86('0xf')](socket);function respondWithRpcPromise(_0x2bf42b,_0x3d3163,_0x1a0a4d){return new BPromise(function(_0xcc5e8,_0x1798ce){return client[_0x4e86('0x10')](_0x2bf42b,_0x1a0a4d)[_0x4e86('0x11')](function(_0x9acf70){logger[_0x4e86('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x3d3163,_0x4e86('0x13'));logger[_0x4e86('0x14')](_0x4e86('0x15'),_0x3d3163,'request\x20sent',JSON[_0x4e86('0x16')](_0x9acf70));if(_0x9acf70[_0x4e86('0x17')]){if(_0x9acf70['error'][_0x4e86('0x18')]===0x1f4){logger[_0x4e86('0x17')](_0x4e86('0x19'),_0x3d3163,_0x9acf70['error'][_0x4e86('0x1a')]);return _0x1798ce(_0x9acf70[_0x4e86('0x17')][_0x4e86('0x1a')]);}logger[_0x4e86('0x17')](_0x4e86('0x19'),_0x3d3163,_0x9acf70['error'][_0x4e86('0x1a')]);return _0xcc5e8(_0x9acf70[_0x4e86('0x17')][_0x4e86('0x1a')]);}else{logger['info'](_0x4e86('0x19'),_0x3d3163,_0x4e86('0x13'));_0xcc5e8(_0x9acf70[_0x4e86('0x1b')][_0x4e86('0x1a')]);}})[_0x4e86('0x1c')](function(_0x5993d3){logger['error'](_0x4e86('0x19'),_0x3d3163,_0x5993d3);_0x1798ce(_0x5993d3);});});}exports[_0x4e86('0x1d')]=function(_0x41593e){var _0x10cadc=this;return new Promise(function(_0x1705a5,_0x18bdaf){return db[_0x4e86('0x1e')][_0x4e86('0x1f')](_0x41593e[_0x4e86('0x20')],{'raw':_0x41593e[_0x4e86('0x21')]?_0x41593e[_0x4e86('0x21')][_0x4e86('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41593e[_0x4e86('0x21')]?_0x41593e[_0x4e86('0x21')][_0x4e86('0x23')]||null:null,'attributes':_0x41593e['options']?_0x41593e[_0x4e86('0x21')]['attributes']||null:null,'limit':_0x41593e[_0x4e86('0x21')]?_0x41593e['options'][_0x4e86('0x24')]||null:null})[_0x4e86('0x11')](function(_0x5b2e06){logger[_0x4e86('0x12')](_0x4e86('0x1d'),_0x41593e);logger[_0x4e86('0x14')](_0x4e86('0x1d'),_0x41593e,JSON[_0x4e86('0x16')](_0x5b2e06));_0x1705a5(_0x5b2e06);})[_0x4e86('0x1c')](function(_0x277ba8){logger[_0x4e86('0x17')](_0x4e86('0x1d'),_0x277ba8[_0x4e86('0x1a')],_0x41593e);_0x18bdaf(_0x10cadc[_0x4e86('0x17')](0x1f4,_0x277ba8[_0x4e86('0x1a')]));});});};exports['AddTagsToSmsInteraction']=function(_0x852a31){return new Promise(function(_0x419021,_0x2c70bd){return db[_0x4e86('0x1e')]['find']({'where':_0x852a31['options']?_0x852a31[_0x4e86('0x21')]['where']||null:null})['then'](function(_0x2fcec3){if(_0x2fcec3){return _0x2fcec3[_0x4e86('0x25')](_0x852a31['body'][_0x4e86('0x26')],_[_0x4e86('0x27')](_0x852a31[_0x4e86('0x20')],[_0x4e86('0x26'),'id'])||{});}})[_0x4e86('0x28')](function(_0x3442af){logger[_0x4e86('0x12')](_0x4e86('0x29'),_0x852a31);logger[_0x4e86('0x14')](_0x4e86('0x29'),_0x852a31,JSON[_0x4e86('0x16')](_0x3442af));_0x419021(_0x3442af);})['catch'](function(_0x28c641){logger[_0x4e86('0x17')](_0x4e86('0x29'),_0x28c641[_0x4e86('0x1a')],_0x852a31);_0x2c70bd(_this['error'](0x1f4,_0x28c641[_0x4e86('0x1a')]));});});}; \ No newline at end of file +var _0x4314=['redis','defaults','localhost','socket.io-emitter','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','debug','find','addTags','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3f271a,_0x4c4ab6){var _0x23b61a=function(_0x1cd453){while(--_0x1cd453){_0x3f271a['push'](_0x3f271a['shift']());}};_0x23b61a(++_0x4c4ab6);}(_0x4314,0xe5));var _0x4431=function(_0x6135f4,_0x5d799d){_0x6135f4=_0x6135f4-0x0;var _0x3b57ba=_0x4314[_0x6135f4];return _0x3b57ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4431('0x0'));var BPromise=require(_0x4431('0x1'));var rs=require(_0x4431('0x2'));var fs=require('fs');var Redis=require(_0x4431('0x3'));var db=require(_0x4431('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4431('0x5'))(_0x4431('0x6'));var config=require(_0x4431('0x7'));var jayson=require(_0x4431('0x8'));var client=jayson[_0x4431('0x9')][_0x4431('0xa')]({'port':0x232a});config[_0x4431('0xb')]=_[_0x4431('0xc')](config[_0x4431('0xb')],{'host':_0x4431('0xd'),'port':0x18eb});var socket=require(_0x4431('0xe'))(new Redis(config[_0x4431('0xb')]));require('./smsInteraction.socket')[_0x4431('0xf')](socket);function respondWithRpcPromise(_0x38bd7f,_0x2b4c1e,_0x4308fe){return new BPromise(function(_0x413b0c,_0x2f9d61){return client[_0x4431('0x10')](_0x38bd7f,_0x4308fe)[_0x4431('0x11')](function(_0x37a771){logger['info'](_0x4431('0x12'),_0x2b4c1e,_0x4431('0x13'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2b4c1e,_0x4431('0x13'),JSON[_0x4431('0x14')](_0x37a771));if(_0x37a771[_0x4431('0x15')]){if(_0x37a771[_0x4431('0x15')][_0x4431('0x16')]===0x1f4){logger[_0x4431('0x15')](_0x4431('0x12'),_0x2b4c1e,_0x37a771['error']['message']);return _0x2f9d61(_0x37a771[_0x4431('0x15')]['message']);}logger[_0x4431('0x15')](_0x4431('0x12'),_0x2b4c1e,_0x37a771[_0x4431('0x15')][_0x4431('0x17')]);return _0x413b0c(_0x37a771[_0x4431('0x15')][_0x4431('0x17')]);}else{logger[_0x4431('0x18')](_0x4431('0x12'),_0x2b4c1e,'request\x20sent');_0x413b0c(_0x37a771[_0x4431('0x19')][_0x4431('0x17')]);}})[_0x4431('0x1a')](function(_0x25bd2c){logger[_0x4431('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x2b4c1e,_0x25bd2c);_0x2f9d61(_0x25bd2c);});});}exports[_0x4431('0x1b')]=function(_0x5f2d63){var _0x3eba80=this;return new Promise(function(_0x30c9fc,_0x131c2b){return db[_0x4431('0x1c')]['update'](_0x5f2d63[_0x4431('0x1d')],{'raw':_0x5f2d63[_0x4431('0x1e')]?_0x5f2d63[_0x4431('0x1e')][_0x4431('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f2d63[_0x4431('0x1e')]?_0x5f2d63[_0x4431('0x1e')][_0x4431('0x20')]||null:null,'attributes':_0x5f2d63['options']?_0x5f2d63[_0x4431('0x1e')][_0x4431('0x21')]||null:null,'limit':_0x5f2d63[_0x4431('0x1e')]?_0x5f2d63['options']['limit']||null:null})[_0x4431('0x11')](function(_0x51f025){logger['info'](_0x4431('0x1b'),_0x5f2d63);logger[_0x4431('0x22')]('UpdateSmsInteraction',_0x5f2d63,JSON[_0x4431('0x14')](_0x51f025));_0x30c9fc(_0x51f025);})[_0x4431('0x1a')](function(_0x3abd77){logger['error'](_0x4431('0x1b'),_0x3abd77[_0x4431('0x17')],_0x5f2d63);_0x131c2b(_0x3eba80[_0x4431('0x15')](0x1f4,_0x3abd77[_0x4431('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x3aff5b){return new Promise(function(_0x314dd0,_0x5a95f0){return db['SmsInteraction'][_0x4431('0x23')]({'where':_0x3aff5b['options']?_0x3aff5b[_0x4431('0x1e')][_0x4431('0x20')]||null:null})[_0x4431('0x11')](function(_0x42c5f1){if(_0x42c5f1){return _0x42c5f1[_0x4431('0x24')](_0x3aff5b['body'][_0x4431('0x25')],_['omit'](_0x3aff5b[_0x4431('0x1d')],['ids','id'])||{});}})[_0x4431('0x26')](function(_0x1e2311){logger[_0x4431('0x18')](_0x4431('0x27'),_0x3aff5b);logger['debug']('AddTags',_0x3aff5b,JSON[_0x4431('0x14')](_0x1e2311));_0x314dd0(_0x1e2311);})[_0x4431('0x1a')](function(_0x49aa23){logger[_0x4431('0x15')]('AddTags',_0x49aa23[_0x4431('0x17')],_0x3aff5b);_0x5a95f0(_this['error'](0x1f4,_0x49aa23[_0x4431('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d05bd69..e19bc14 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(_0x341b18,_0x33da57){var _0x4df120=function(_0x5f03b6){while(--_0x5f03b6){_0x341b18['push'](_0x341b18['shift']());}};_0x4df120(++_0x33da57);}(_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(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x2032,0xd9));var _0x2203=function(_0x4950b4,_0x55289e){_0x4950b4=_0x4950b4-0x0;var _0x463f35=_0x2032[_0x4950b4];return _0x463f35;};'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 1a78c25..3095eb5 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 _0xfe5d=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','post','tracked','sms','smsmessage:create','create','/:id/status','put','/:id'];(function(_0x5b43b6,_0x31b2bd){var _0x4954b6=function(_0x5d3b46){while(--_0x5d3b46){_0x5b43b6['push'](_0x5b43b6['shift']());}};_0x4954b6(++_0x31b2bd);}(_0xfe5d,0x10b));var _0xdfe5=function(_0x280cd6,_0x3db539){_0x280cd6=_0x280cd6-0x0;var _0x6ae2dd=_0xfe5d[_0x280cd6];return _0x6ae2dd;};'use strict';var multer=require('multer');var util=require(_0xdfe5('0x0'));var path=require(_0xdfe5('0x1'));var timeout=require(_0xdfe5('0x2'));var express=require(_0xdfe5('0x3'));var router=express[_0xdfe5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdfe5('0x5'));var config=require(_0xdfe5('0x6'));var controller=require('./smsMessage.controller');router[_0xdfe5('0x7')]('/',auth[_0xdfe5('0x8')](),controller[_0xdfe5('0x9')]);router[_0xdfe5('0x7')]('/describe',auth[_0xdfe5('0x8')](),controller[_0xdfe5('0xa')]);router[_0xdfe5('0x7')]('/:id',auth[_0xdfe5('0x8')](),controller['show']);router[_0xdfe5('0xb')]('/',auth['isAuthenticated'](),interaction[_0xdfe5('0xc')](_0xdfe5('0xd'),_0xdfe5('0xe')),controller[_0xdfe5('0xf')]);router[_0xdfe5('0xb')](_0xdfe5('0x10'),controller['status']);router[_0xdfe5('0x11')](_0xdfe5('0x12'),auth[_0xdfe5('0x8')](),controller['update']);router[_0xdfe5('0x11')](_0xdfe5('0x13'),auth['isAuthenticated'](),controller[_0xdfe5('0x14')]);router[_0xdfe5('0x11')](_0xdfe5('0x15'),auth[_0xdfe5('0x8')](),controller[_0xdfe5('0x16')]);router[_0xdfe5('0x17')]('/:id',auth[_0xdfe5('0x8')](),controller[_0xdfe5('0x18')]);module[_0xdfe5('0x19')]=router; \ No newline at end of file +var _0x4ed8=['isAuthenticated','index','describe','/:id','show','tracked','smsmessage:create','create','post','/:id/status','status','put','/:id/accept','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4ed8,0x186));var _0x84ed=function(_0x20ac7f,_0x2d35c6){_0x20ac7f=_0x20ac7f-0x0;var _0x1829c4=_0x4ed8[_0x20ac7f];return _0x1829c4;};'use strict';var multer=require(_0x84ed('0x0'));var util=require(_0x84ed('0x1'));var path=require(_0x84ed('0x2'));var timeout=require(_0x84ed('0x3'));var express=require(_0x84ed('0x4'));var router=express[_0x84ed('0x5')]();var auth=require(_0x84ed('0x6'));var interaction=require(_0x84ed('0x7'));var config=require(_0x84ed('0x8'));var controller=require('./smsMessage.controller');router[_0x84ed('0x9')]('/',auth[_0x84ed('0xa')](),controller[_0x84ed('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x84ed('0xc')]);router[_0x84ed('0x9')](_0x84ed('0xd'),auth['isAuthenticated'](),controller[_0x84ed('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x84ed('0xf')]('sms',_0x84ed('0x10')),controller[_0x84ed('0x11')]);router[_0x84ed('0x12')](_0x84ed('0x13'),controller[_0x84ed('0x14')]);router[_0x84ed('0x15')](_0x84ed('0xd'),auth[_0x84ed('0xa')](),controller['update']);router['put'](_0x84ed('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0x84ed('0x15')]('/:id/reject',auth[_0x84ed('0xa')](),controller['reject']);router['delete'](_0x84ed('0xd'),auth['isAuthenticated'](),controller[_0x84ed('0x17')]);module[_0x84ed('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 8aa97d2..ce7bc53 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 _0xe653=['DATE','exports','medium','BOOLEAN','out'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xe653,0x15f));var _0x3e65=function(_0xbe31a4,_0x11ba89){_0xbe31a4=_0xbe31a4-0x0;var _0x15ec28=_0xe653[_0xbe31a4];return _0x15ec28;};'use strict';var Sequelize=require('sequelize');module[_0x3e65('0x0')]={'body':{'type':Sequelize['TEXT'](_0x3e65('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3e65('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3e65('0x3')),'defaultValue':_0x3e65('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3e65('0x4')]},'secret':{'type':Sequelize[_0x3e65('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x06d8=['DATE','BOOLEAN','sequelize','medium','ENUM','out','STRING'];(function(_0x14ef7f,_0x34af9d){var _0x5f3e9d=function(_0x3da1f3){while(--_0x3da1f3){_0x14ef7f['push'](_0x14ef7f['shift']());}};_0x5f3e9d(++_0x34af9d);}(_0x06d8,0xd4));var _0x806d=function(_0x3ecfba,_0x58ec2f){_0x3ecfba=_0x3ecfba-0x0;var _0x272815=_0x06d8[_0x3ecfba];return _0x272815;};'use strict';var Sequelize=require(_0x806d('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x806d('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x806d('0x2')]('in',_0x806d('0x3')),'defaultValue':_0x806d('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x806d('0x4')](0xbe)},'phone':{'type':Sequelize[_0x806d('0x4')]},'readAt':{'type':Sequelize[_0x806d('0x5')]},'secret':{'type':Sequelize[_0x806d('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index eed2549..7aff629 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 _0xc9c3=['filters','attributes','intersection','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','rows','catch','show','keys','rawAttributes','fields','includeAll','include','find','create','body','params','describe','sms-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','SmsInteraction','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','localhost','socket.io-emitter','./smsMessage.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~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','SmsMessage','type','model','map','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x8b6e9c,_0x17f051){_0x8b6e9c=_0x8b6e9c-0x0;var _0x4c451a=_0xc9c3[_0x8b6e9c];return _0x4c451a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c9c('0x0'));var rimraf=require(_0x3c9c('0x1'));var zipdir=require(_0x3c9c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3c9c('0x3'));var BPromise=require(_0x3c9c('0x4'));var Mustache=require('mustache');var util=require(_0x3c9c('0x5'));var path=require(_0x3c9c('0x6'));var sox=require(_0x3c9c('0x7'));var csv=require(_0x3c9c('0x8'));var ejs=require(_0x3c9c('0x9'));var fs=require('fs');var _=require(_0x3c9c('0xa'));var squel=require(_0x3c9c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c9c('0xc'));var toCsv=require(_0x3c9c('0x8'));var querystring=require('querystring');var Papa=require(_0x3c9c('0xd'));var Redis=require(_0x3c9c('0xe'));var authService=require(_0x3c9c('0xf'));var qs=require(_0x3c9c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c9c('0x11'))(_0x3c9c('0x12'));var utils=require(_0x3c9c('0x13'));var config=require(_0x3c9c('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3c9c('0x15'),'port':0x18eb});var socket=require(_0x3c9c('0x16'))(new Redis(config['redis']));require(_0x3c9c('0x17'))['register'](socket);var jayson=require(_0x3c9c('0x18'));var client=jayson[_0x3c9c('0x19')][_0x3c9c('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x3c9c('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x59fb0f,_0x3b9fef,_0x4b9b7f){if(_0x4b9b7f){var _0x448319=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x448319[_0x3c9c('0x1b')](_0x3b9fef)){return _0x59fb0f;}else{throw new db[(_0x3c9c('0x1c'))]['ValidationError'](_0x3c9c('0x1d'));}}else{return _0x59fb0f;}}function respondWithRpcPromise(_0x4f0db4,_0x39da0d,_0xa3f509,_0x1d8e47){return new BPromise(function(_0x44ba13,_0x17c57e){var _0x749300=_0x1d8e47||client;return _0x749300[_0x3c9c('0x1e')](_0x4f0db4,_0xa3f509)[_0x3c9c('0x1f')](function(_0x24111f){logger[_0x3c9c('0x20')](_0x3c9c('0x21'),_0x39da0d,_0x3c9c('0x22'));logger['debug'](_0x3c9c('0x23'),_0x39da0d,'request\x20sent',JSON['stringify'](_0x24111f));if(_0x24111f[_0x3c9c('0x24')]){if(_0x24111f[_0x3c9c('0x24')][_0x3c9c('0x25')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x39da0d,_0x24111f[_0x3c9c('0x24')]['message']);return _0x17c57e(_0x24111f['error'][_0x3c9c('0x26')]);}logger[_0x3c9c('0x24')]('SmsMessage,\x20%s,\x20%s',_0x39da0d,_0x24111f[_0x3c9c('0x24')][_0x3c9c('0x26')]);return _0x44ba13(_0x24111f[_0x3c9c('0x24')][_0x3c9c('0x26')]);}else{logger[_0x3c9c('0x20')](_0x3c9c('0x21'),_0x39da0d,'request\x20sent');_0x44ba13(_0x24111f[_0x3c9c('0x27')]['message']);}})['catch'](function(_0x2ea2dc){logger[_0x3c9c('0x24')](_0x3c9c('0x21'),_0x39da0d,_0x2ea2dc);_0x17c57e(_0x2ea2dc);});});}function respondWithStatusCode(_0x2016e0,_0x44f22f){_0x44f22f=_0x44f22f||0xcc;return function(_0x380ab5){if(_0x380ab5){return _0x2016e0[_0x3c9c('0x28')](_0x44f22f);}return _0x2016e0[_0x3c9c('0x29')](_0x44f22f)[_0x3c9c('0x2a')]();};}function respondWithResult(_0x52c9bb,_0x10511f){_0x10511f=_0x10511f||0xc8;return function(_0x2d2e90){if(_0x2d2e90){return _0x52c9bb[_0x3c9c('0x29')](_0x10511f)['json'](_0x2d2e90);}};}function respondWithFilteredResult(_0x5af462,_0x43f063){return function(_0x3bdccc){if(_0x3bdccc){var _0x7c6d8f=_0x3bdccc['count'],_0x59e4b1=_0x43f063[_0x3c9c('0x2b')],_0x27d568=_0x43f063[_0x3c9c('0x2b')]+_0x43f063['limit'],_0x164230;if(_0x27d568>=_0x7c6d8f){_0x27d568=_0x7c6d8f;_0x164230=0xc8;}else{_0x164230=0xce;}_0x5af462[_0x3c9c('0x29')](_0x164230);return _0x5af462[_0x3c9c('0x2c')](_0x3c9c('0x2d'),_0x59e4b1+'-'+_0x27d568+'/'+_0x7c6d8f)[_0x3c9c('0x2e')](_0x3bdccc);}return null;};}function patchUpdates(_0x42b21d){return function(_0x2432a2){try{jsonpatch[_0x3c9c('0x2f')](_0x2432a2,_0x42b21d,!![]);}catch(_0x5e661b){return BPromise[_0x3c9c('0x30')](_0x5e661b);}return _0x2432a2[_0x3c9c('0x31')]();};}function saveUpdates(_0x259d04,_0x31a59b){return function(_0x417abe){if(_0x417abe){return _0x417abe[_0x3c9c('0x32')](_0x259d04)[_0x3c9c('0x1f')](function(_0x3f71bf){return _0x3f71bf;});}return null;};}function removeEntity(_0x22185f,_0x58b8fc){return function(_0x3a7e6e){if(_0x3a7e6e){return _0x3a7e6e[_0x3c9c('0x33')]()[_0x3c9c('0x1f')](function(){_0x22185f[_0x3c9c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd7b6b,_0x247611){return function(_0x20e17e){if(!_0x20e17e){_0xcd7b6b[_0x3c9c('0x28')](0x194);}return _0x20e17e;};}function handleError(_0x35bdb8,_0x57c434){_0x57c434=_0x57c434||0x1f4;return function(_0x1139ed){logger[_0x3c9c('0x24')](_0x1139ed[_0x3c9c('0x34')]);if(_0x1139ed[_0x3c9c('0x35')]){delete _0x1139ed[_0x3c9c('0x35')];}_0x35bdb8[_0x3c9c('0x29')](_0x57c434)[_0x3c9c('0x36')](_0x1139ed);};}exports['index']=function(_0x3d5771,_0x1b9fad){var _0x454d7e={},_0x77c2ad={},_0x50a559={'count':0x0,'rows':[]};var _0x40b744=_['map'](db[_0x3c9c('0x37')]['rawAttributes'],function(_0x39aad0){return{'name':_0x39aad0['fieldName'],'type':_0x39aad0[_0x3c9c('0x38')]['key']};});_0x77c2ad[_0x3c9c('0x39')]=_[_0x3c9c('0x3a')](_0x40b744,_0x3c9c('0x35'));_0x77c2ad[_0x3c9c('0x3b')]=_['keys'](_0x3d5771[_0x3c9c('0x3b')]);_0x77c2ad[_0x3c9c('0x3c')]=_['intersection'](_0x77c2ad[_0x3c9c('0x39')],_0x77c2ad[_0x3c9c('0x3b')]);_0x454d7e[_0x3c9c('0x3d')]=_[_0x3c9c('0x3e')](_0x77c2ad[_0x3c9c('0x39')],qs['fields'](_0x3d5771['query']['fields']));_0x454d7e['attributes']=_0x454d7e[_0x3c9c('0x3d')][_0x3c9c('0x3f')]?_0x454d7e[_0x3c9c('0x3d')]:_0x77c2ad[_0x3c9c('0x39')];if(!_0x3d5771['query'][_0x3c9c('0x40')]('nolimit')){_0x454d7e[_0x3c9c('0x41')]=qs[_0x3c9c('0x41')](_0x3d5771[_0x3c9c('0x3b')][_0x3c9c('0x41')]);_0x454d7e[_0x3c9c('0x2b')]=qs[_0x3c9c('0x2b')](_0x3d5771['query'][_0x3c9c('0x2b')]);}_0x454d7e[_0x3c9c('0x42')]=qs[_0x3c9c('0x43')](_0x3d5771[_0x3c9c('0x3b')][_0x3c9c('0x43')]);_0x454d7e[_0x3c9c('0x44')]=qs[_0x3c9c('0x3c')](_[_0x3c9c('0x45')](_0x3d5771[_0x3c9c('0x3b')],_0x77c2ad['filters']),_0x40b744);if(_0x3d5771['query'][_0x3c9c('0x46')]){_0x454d7e[_0x3c9c('0x44')]=_[_0x3c9c('0x47')](_0x454d7e[_0x3c9c('0x44')],{'$or':_['map'](_0x40b744,function(_0xbb6f2d){if(_0xbb6f2d[_0x3c9c('0x38')]!==_0x3c9c('0x48')){var _0x126ea2={};_0x126ea2[_0xbb6f2d[_0x3c9c('0x35')]]={'$like':'%'+_0x3d5771[_0x3c9c('0x3b')][_0x3c9c('0x46')]+'%'};return _0x126ea2;}})});}_0x454d7e=_[_0x3c9c('0x47')]({},_0x454d7e,_0x3d5771[_0x3c9c('0x49')]);var _0x6ef5b={'where':_0x454d7e[_0x3c9c('0x44')]};return db[_0x3c9c('0x37')][_0x3c9c('0x4a')](_0x6ef5b)['then'](function(_0x1d6c6b){_0x50a559['count']=_0x1d6c6b;if(_0x3d5771[_0x3c9c('0x3b')]['includeAll']){_0x454d7e['include']=[{'all':!![]}];}return db[_0x3c9c('0x37')]['findAll'](_0x454d7e);})[_0x3c9c('0x1f')](function(_0x2855c1){_0x50a559[_0x3c9c('0x4b')]=_0x2855c1;return _0x50a559;})[_0x3c9c('0x1f')](respondWithFilteredResult(_0x1b9fad,_0x454d7e))[_0x3c9c('0x4c')](handleError(_0x1b9fad,null));};exports[_0x3c9c('0x4d')]=function(_0x907232,_0x224412){var _0xf95ffa={'raw':!![],'where':{'id':_0x907232['params']['id']}},_0x2e1975={};_0x2e1975[_0x3c9c('0x39')]=_[_0x3c9c('0x4e')](db['SmsMessage'][_0x3c9c('0x4f')]);_0x2e1975[_0x3c9c('0x3b')]=_[_0x3c9c('0x4e')](_0x907232[_0x3c9c('0x3b')]);_0x2e1975[_0x3c9c('0x3c')]=_['intersection'](_0x2e1975[_0x3c9c('0x39')],_0x2e1975[_0x3c9c('0x3b')]);_0xf95ffa[_0x3c9c('0x3d')]=_[_0x3c9c('0x3e')](_0x2e1975[_0x3c9c('0x39')],qs[_0x3c9c('0x50')](_0x907232[_0x3c9c('0x3b')][_0x3c9c('0x50')]));_0xf95ffa['attributes']=_0xf95ffa[_0x3c9c('0x3d')]['length']?_0xf95ffa[_0x3c9c('0x3d')]:_0x2e1975[_0x3c9c('0x39')];if(_0x907232[_0x3c9c('0x3b')][_0x3c9c('0x51')]){_0xf95ffa[_0x3c9c('0x52')]=[{'all':!![]}];}_0xf95ffa=_[_0x3c9c('0x47')]({},_0xf95ffa,_0x907232['options']);return db[_0x3c9c('0x37')][_0x3c9c('0x53')](_0xf95ffa)[_0x3c9c('0x1f')](handleEntityNotFound(_0x224412,null))[_0x3c9c('0x1f')](respondWithResult(_0x224412,null))['catch'](handleError(_0x224412,null));};exports[_0x3c9c('0x54')]=function(_0x2d703e,_0x467c07){return db[_0x3c9c('0x37')]['create'](_0x2d703e[_0x3c9c('0x55')],{})[_0x3c9c('0x1f')](respondWithResult(_0x467c07,0xc9))[_0x3c9c('0x4c')](handleError(_0x467c07,null));};exports[_0x3c9c('0x32')]=function(_0x330a02,_0x15a592){if(_0x330a02[_0x3c9c('0x55')]['id']){delete _0x330a02[_0x3c9c('0x55')]['id'];}return db[_0x3c9c('0x37')]['find']({'where':{'id':_0x330a02[_0x3c9c('0x56')]['id']}})[_0x3c9c('0x1f')](handleEntityNotFound(_0x15a592,null))['then'](saveUpdates(_0x330a02[_0x3c9c('0x55')],null))[_0x3c9c('0x1f')](respondWithResult(_0x15a592,null))[_0x3c9c('0x4c')](handleError(_0x15a592,null));};exports[_0x3c9c('0x33')]=function(_0x57d0e9,_0x4daada){return db[_0x3c9c('0x37')][_0x3c9c('0x53')]({'where':{'id':_0x57d0e9[_0x3c9c('0x56')]['id']}})[_0x3c9c('0x1f')](handleEntityNotFound(_0x4daada,null))[_0x3c9c('0x1f')](removeEntity(_0x4daada,null))['catch'](handleError(_0x4daada,null));};exports['describe']=function(_0x1cadaa,_0x567753){return db[_0x3c9c('0x37')][_0x3c9c('0x57')]()['then'](respondWithResult(_0x567753,null))['catch'](handleError(_0x567753,null));};var interaction_log=require(_0x3c9c('0x11'))(_0x3c9c('0x58'));exports[_0x3c9c('0x59')]=function(_0x47a2fc,_0x2eda65,_0xd70dee){var _0x198996={'channel':'sms'};if(_0x47a2fc['body']['id']){delete _0x47a2fc[_0x3c9c('0x55')]['id'];}_0x47a2fc['body']['read']=!![];_0x47a2fc[_0x3c9c('0x55')]['readAt']=moment()[_0x3c9c('0x5a')](_0x3c9c('0x5b'));_0x47a2fc[_0x3c9c('0x55')][_0x3c9c('0x5c')]=_0x47a2fc[_0x3c9c('0x55')]['UserId']||_0x47a2fc[_0x3c9c('0x5d')]['id'];return db[_0x3c9c('0x37')][_0x3c9c('0x53')]({'where':{'id':_0x47a2fc[_0x3c9c('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x3c9c('0x5e')],'as':'Contact'}]})[_0x3c9c('0x1f')](handleEntityNotFound(_0x2eda65,null))[_0x3c9c('0x1f')](saveUpdates(_0x47a2fc[_0x3c9c('0x55')],null))['then'](function(_0x154ddf){if(_0x154ddf){_0x198996[_0x3c9c('0x26')]=_0x154ddf['get']({'plain':!![]});return db[_0x3c9c('0x5f')]['find']({'where':{'id':_0x154ddf[_0x3c9c('0x60')]}});}return null;})[_0x3c9c('0x1f')](handleEntityNotFound(_0x2eda65,null))['then'](function(_0x361638){if(_0x361638){return _0x361638['update']({'UserId':_0x47a2fc['body'][_0x3c9c('0x5c')],'read1stAt':_[_0x3c9c('0x61')](_0x361638['read1stAt'])?moment()['format'](_0x3c9c('0x5b')):undefined});}return null;})[_0x3c9c('0x1f')](function(_0x4de3ba){if(_0x4de3ba){_0x198996[_0x3c9c('0x62')]=_0x4de3ba[_0x3c9c('0x63')]({'plain':!![]});interaction_log[_0x3c9c('0x20')](_0x3c9c('0x64'),_0x47a2fc[_0x3c9c('0x5d')]['id'],_0x47a2fc[_0x3c9c('0x5d')][_0x3c9c('0x35')],_0x47a2fc[_0x3c9c('0x5d')][_0x3c9c('0x65')],_0x198996[_0x3c9c('0x62')]['id'],_0x47a2fc['body']?JSON[_0x3c9c('0x66')](_0x47a2fc[_0x3c9c('0x55')]):'null');return respondWithRpcPromise(_0x3c9c('0x67'),_0x3c9c('0x68'),_0x198996);}return null;})['then'](function(_0xb90326){if(_0xb90326){if(_0x47a2fc[_0x3c9c('0x55')][_0x3c9c('0x69')]){_0x198996[_0x3c9c('0x26')][_0x3c9c('0x6a')]=util[_0x3c9c('0x5a')](_0x3c9c('0x6b'),_0x47a2fc['user']['name']);_0x198996[_0x3c9c('0x26')]['channel']=_0x198996[_0x3c9c('0x6c')];_0x198996[_0x3c9c('0x26')][_0x3c9c('0x6d')]=_0x3c9c('0x59');return respondWithRpcPromise(_0x3c9c('0x6e'),'EventManager',{'event':_0x3c9c('0x6f'),'message':_0x198996[_0x3c9c('0x26')]},client9002)['then'](function(){return _0x198996;});}return _0x198996;}return null;})[_0x3c9c('0x1f')](respondWithResult(_0x2eda65,null))[_0x3c9c('0x4c')](handleError(_0x2eda65,null));};var interaction_log=require('../../config/logger')(_0x3c9c('0x58'));exports['reject']=function(_0x3d4bd4,_0x520f81,_0x304313){var _0x22602f={'agent':{},'channel':_0x3c9c('0x70')};if(_0x3d4bd4[_0x3c9c('0x55')]['id']){delete _0x3d4bd4[_0x3c9c('0x55')]['id'];}_0x3d4bd4[_0x3c9c('0x55')][_0x3c9c('0x5c')]=_0x3d4bd4[_0x3c9c('0x55')]['UserId']||_0x3d4bd4[_0x3c9c('0x5d')]['id'];_0x22602f[_0x3c9c('0x71')]['id']=_0x3d4bd4[_0x3c9c('0x55')]['UserId'];return db[_0x3c9c('0x37')][_0x3c9c('0x53')]({'where':{'id':_0x3d4bd4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x520f81,null))[_0x3c9c('0x1f')](function(_0x19d615){if(_0x19d615){_0x22602f[_0x3c9c('0x26')]=_0x19d615[_0x3c9c('0x63')]({'plain':!![]});return db[_0x3c9c('0x5f')][_0x3c9c('0x53')]({'where':{'id':_0x19d615[_0x3c9c('0x60')]}});}return null;})[_0x3c9c('0x1f')](handleEntityNotFound(_0x520f81,null))[_0x3c9c('0x1f')](function(_0x4ecf12){if(_0x4ecf12){_0x22602f['interaction']=_0x4ecf12[_0x3c9c('0x63')]({'plain':!![]});interaction_log[_0x3c9c('0x20')](_0x3c9c('0x72'),_0x3d4bd4[_0x3c9c('0x5d')]['id'],_0x3d4bd4[_0x3c9c('0x5d')][_0x3c9c('0x35')],_0x3d4bd4[_0x3c9c('0x5d')][_0x3c9c('0x65')],_0x22602f['interaction']['id'],_0x3d4bd4[_0x3c9c('0x55')]?JSON[_0x3c9c('0x66')](_0x3d4bd4['body']):'null');return respondWithRpcPromise(_0x3c9c('0x73'),_0x3c9c('0x74'),_0x22602f);}return null;})['then'](function(_0x46a358){if(_0x46a358){_0x46a358[_0x3c9c('0x26')]['interface']=util['format']('SIP/%s',_0x3d4bd4['user'][_0x3c9c('0x35')]);_0x46a358['message'][_0x3c9c('0x6c')]=_0x22602f[_0x3c9c('0x6c')];_0x46a358[_0x3c9c('0x26')][_0x3c9c('0x6d')]=_0x3c9c('0x30');respondWithRpcPromise(_0x3c9c('0x6e'),_0x3c9c('0x6e'),{'event':'rejectmessage','message':_0x46a358['message']},client9002);return _0x22602f;}return null;})[_0x3c9c('0x1f')](respondWithResult(_0x520f81,null))[_0x3c9c('0x4c')](handleError(_0x520f81,null));};exports[_0x3c9c('0x29')]=function(_0x5b8f22,_0x4fd86a,_0x134a02){if(_0x5b8f22['body']['id']){delete _0x5b8f22['body']['id'];}var _0x1ccec5;return db[_0x3c9c('0x37')][_0x3c9c('0x53')]({'where':{'id':_0x5b8f22['params']['id']}})['then'](handleEntityNotFound(_0x4fd86a,null))[_0x3c9c('0x1f')](function(_0x2acbcb){if(_0x2acbcb){_0x1ccec5=_0x2acbcb;return db[_0x3c9c('0x75')][_0x3c9c('0x53')]({'where':{'id':_0x2acbcb['SmsAccountId']}});}})[_0x3c9c('0x1f')](handleEntityNotFound(_0x4fd86a,null))['then'](function(_0x23ca9b){if(_0x23ca9b){logger['debug'](_0x3c9c('0x23'),'status',_0x3c9c('0x76'),_0x23ca9b[_0x3c9c('0x38')],util[_0x3c9c('0x77')](_0x5b8f22[_0x3c9c('0x55')],{'showHidden':![],'depth':null}));switch(_0x23ca9b[_0x3c9c('0x38')]){case _0x3c9c('0x78'):if(_0x5b8f22[_0x3c9c('0x55')][_0x3c9c('0x79')]&&_0x5b8f22[_0x3c9c('0x55')][_0x3c9c('0x79')]===_0x1ccec5[_0x3c9c('0x7a')]){return _0x1ccec5[_0x3c9c('0x32')]({'read':!![]});}else{logger[_0x3c9c('0x24')](_0x3c9c('0x7b'),_0x3c9c('0x29'),_0x3c9c('0x78'),util[_0x3c9c('0x77')](_0x5b8f22[_0x3c9c('0x55')],{'showHidden':![],'depth':null}));}break;case _0x3c9c('0x7c'):if(_0x5b8f22['body'][_0x3c9c('0x7d')]&&_0x5b8f22[_0x3c9c('0x55')][_0x3c9c('0x7d')]===_0x1ccec5[_0x3c9c('0x7a')]&&_[_0x3c9c('0x7e')]([_0x3c9c('0x7f'),_0x3c9c('0x80')],_0x5b8f22[_0x3c9c('0x55')][_0x3c9c('0x81')])>=0x0){return _0x1ccec5[_0x3c9c('0x32')]({'read':!![]});}else{logger[_0x3c9c('0x24')](_0x3c9c('0x7b'),_0x3c9c('0x29'),'plivio',util[_0x3c9c('0x77')](_0x5b8f22[_0x3c9c('0x55')],{'showHidden':![],'depth':null}));}break;case _0x3c9c('0x82'):var _0x4b7ad4=_0x5b8f22[_0x3c9c('0x55')][_0x3c9c('0x83')][0x0];if(_0x4b7ad4[_0x3c9c('0x29')][_0x3c9c('0x84')]===_0x3c9c('0x85')){return _0x1ccec5['update']({'read':!![]});}else{logger[_0x3c9c('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3c9c('0x29'),'infobip',util[_0x3c9c('0x77')](_0x5b8f22[_0x3c9c('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x1ccec5;}})[_0x3c9c('0x1f')](respondWithResult(_0x4fd86a,null))[_0x3c9c('0x4c')](handleError(_0x4fd86a,null));}; \ No newline at end of file +var _0x4e61=['infobip','results','DELIVERED','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test','ValidationError','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','UserId','CmContact','Contact','get','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','interface','channel','event','EventManager','agent','SmsInteractionId','[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','delivered','Status','plivio'];(function(_0xe1269d,_0x57b7c3){var _0x261ca1=function(_0x13b234){while(--_0x13b234){_0xe1269d['push'](_0xe1269d['shift']());}};_0x261ca1(++_0x57b7c3);}(_0x4e61,0x8c));var _0x14e6=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x4e61[_0xaa6a4];return _0xdc31a4;};'use strict';var pdf=require(_0x14e6('0x0'));var emlformat=require(_0x14e6('0x1'));var rimraf=require(_0x14e6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x14e6('0x3'));var moment=require(_0x14e6('0x4'));var BPromise=require(_0x14e6('0x5'));var Mustache=require(_0x14e6('0x6'));var util=require(_0x14e6('0x7'));var path=require(_0x14e6('0x8'));var sox=require(_0x14e6('0x9'));var csv=require(_0x14e6('0xa'));var ejs=require(_0x14e6('0xb'));var fs=require('fs');var _=require(_0x14e6('0xc'));var squel=require(_0x14e6('0xd'));var crypto=require(_0x14e6('0xe'));var jsforce=require(_0x14e6('0xf'));var deskjs=require(_0x14e6('0x10'));var toCsv=require(_0x14e6('0xa'));var querystring=require(_0x14e6('0x11'));var Papa=require(_0x14e6('0x12'));var Redis=require(_0x14e6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x14e6('0x14'));var as=require(_0x14e6('0x15'));var hardwareService=require(_0x14e6('0x16'));var logger=require(_0x14e6('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x14e6('0x18')]=_['defaults'](config['redis'],{'host':_0x14e6('0x19'),'port':0x18eb});var socket=require(_0x14e6('0x1a'))(new Redis(config[_0x14e6('0x18')]));require('./smsMessage.socket')[_0x14e6('0x1b')](socket);var jayson=require(_0x14e6('0x1c'));var client=jayson[_0x14e6('0x1d')][_0x14e6('0x1e')]({'port':0x232c});var client9002=jayson[_0x14e6('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x36738d,_0x353910,_0x753064){if(_0x753064){var _0x3e46c0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e46c0[_0x14e6('0x1f')](_0x353910)){return _0x36738d;}else{throw new db['Sequelize'][(_0x14e6('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 _0x36738d;}}function respondWithRpcPromise(_0x588ffc,_0x4f40b0,_0x12fc87,_0x16b937){return new BPromise(function(_0xbcf29e,_0x3423b3){var _0x5642d4=_0x16b937||client;return _0x5642d4['request'](_0x588ffc,_0x12fc87)[_0x14e6('0x21')](function(_0xaa4597){logger[_0x14e6('0x22')](_0x14e6('0x23'),_0x4f40b0,_0x14e6('0x24'));logger[_0x14e6('0x25')](_0x14e6('0x26'),_0x4f40b0,_0x14e6('0x24'),JSON[_0x14e6('0x27')](_0xaa4597));if(_0xaa4597[_0x14e6('0x28')]){if(_0xaa4597[_0x14e6('0x28')][_0x14e6('0x29')]===0x1f4){logger[_0x14e6('0x28')](_0x14e6('0x23'),_0x4f40b0,_0xaa4597[_0x14e6('0x28')][_0x14e6('0x2a')]);return _0x3423b3(_0xaa4597[_0x14e6('0x28')][_0x14e6('0x2a')]);}logger[_0x14e6('0x28')](_0x14e6('0x23'),_0x4f40b0,_0xaa4597[_0x14e6('0x28')]['message']);return _0xbcf29e(_0xaa4597[_0x14e6('0x28')][_0x14e6('0x2a')]);}else{logger[_0x14e6('0x22')](_0x14e6('0x23'),_0x4f40b0,_0x14e6('0x24'));_0xbcf29e(_0xaa4597[_0x14e6('0x2b')][_0x14e6('0x2a')]);}})['catch'](function(_0x3d9e66){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4f40b0,_0x3d9e66);_0x3423b3(_0x3d9e66);});});}function respondWithStatusCode(_0x57a504,_0x3b5b43){_0x3b5b43=_0x3b5b43||0xcc;return function(_0x52e725){if(_0x52e725){return _0x57a504[_0x14e6('0x2c')](_0x3b5b43);}return _0x57a504[_0x14e6('0x2d')](_0x3b5b43)[_0x14e6('0x2e')]();};}function respondWithResult(_0x5c6a39,_0x3395b1){_0x3395b1=_0x3395b1||0xc8;return function(_0x298a5a){if(_0x298a5a){return _0x5c6a39[_0x14e6('0x2d')](_0x3395b1)['json'](_0x298a5a);}};}function respondWithFilteredResult(_0x1e21a3,_0x1e718a){return function(_0x305105){if(_0x305105){var _0x46863c=_0x305105[_0x14e6('0x2f')],_0x59ae27=_0x1e718a[_0x14e6('0x30')],_0x1290b4=_0x1e718a['offset']+_0x1e718a[_0x14e6('0x31')],_0x4e1ba8;if(_0x1290b4>=_0x46863c){_0x1290b4=_0x46863c;_0x4e1ba8=0xc8;}else{_0x4e1ba8=0xce;}_0x1e21a3[_0x14e6('0x2d')](_0x4e1ba8);return _0x1e21a3[_0x14e6('0x32')](_0x14e6('0x33'),_0x59ae27+'-'+_0x1290b4+'/'+_0x46863c)['json'](_0x305105);}return null;};}function patchUpdates(_0x14b18a){return function(_0x10e715){try{jsonpatch[_0x14e6('0x34')](_0x10e715,_0x14b18a,!![]);}catch(_0x452319){return BPromise[_0x14e6('0x35')](_0x452319);}return _0x10e715[_0x14e6('0x36')]();};}function saveUpdates(_0x2b901f,_0x4b2678){return function(_0x3b0c35){if(_0x3b0c35){return _0x3b0c35[_0x14e6('0x37')](_0x2b901f)[_0x14e6('0x21')](function(_0x1e504e){return _0x1e504e;});}return null;};}function removeEntity(_0x47ecac,_0x26bfee){return function(_0x1e5d37){if(_0x1e5d37){return _0x1e5d37[_0x14e6('0x38')]()[_0x14e6('0x21')](function(){_0x47ecac[_0x14e6('0x2d')](0xcc)[_0x14e6('0x2e')]();});}};}function handleEntityNotFound(_0x263c2f,_0xce0ea7){return function(_0x14d298){if(!_0x14d298){_0x263c2f[_0x14e6('0x2c')](0x194);}return _0x14d298;};}function handleError(_0x19a32c,_0x46a654){_0x46a654=_0x46a654||0x1f4;return function(_0x558f1d){logger[_0x14e6('0x28')](_0x558f1d[_0x14e6('0x39')]);if(_0x558f1d[_0x14e6('0x3a')]){delete _0x558f1d[_0x14e6('0x3a')];}_0x19a32c[_0x14e6('0x2d')](_0x46a654)[_0x14e6('0x3b')](_0x558f1d);};}exports[_0x14e6('0x3c')]=function(_0x3f547f,_0x30289a){var _0x36a581={},_0x25f91c={},_0x190240={'count':0x0,'rows':[]};var _0x2dfd5e=_[_0x14e6('0x3d')](db[_0x14e6('0x3e')][_0x14e6('0x3f')],function(_0x33a1f1){return{'name':_0x33a1f1['fieldName'],'type':_0x33a1f1[_0x14e6('0x40')]['key']};});_0x25f91c[_0x14e6('0x41')]=_[_0x14e6('0x3d')](_0x2dfd5e,_0x14e6('0x3a'));_0x25f91c[_0x14e6('0x42')]=_['keys'](_0x3f547f[_0x14e6('0x42')]);_0x25f91c[_0x14e6('0x43')]=_['intersection'](_0x25f91c[_0x14e6('0x41')],_0x25f91c[_0x14e6('0x42')]);_0x36a581[_0x14e6('0x44')]=_[_0x14e6('0x45')](_0x25f91c[_0x14e6('0x41')],qs['fields'](_0x3f547f[_0x14e6('0x42')][_0x14e6('0x46')]));_0x36a581['attributes']=_0x36a581[_0x14e6('0x44')][_0x14e6('0x47')]?_0x36a581[_0x14e6('0x44')]:_0x25f91c['model'];if(!_0x3f547f['query'][_0x14e6('0x48')](_0x14e6('0x49'))){_0x36a581[_0x14e6('0x31')]=qs[_0x14e6('0x31')](_0x3f547f[_0x14e6('0x42')]['limit']);_0x36a581['offset']=qs['offset'](_0x3f547f[_0x14e6('0x42')][_0x14e6('0x30')]);}_0x36a581[_0x14e6('0x4a')]=qs[_0x14e6('0x4b')](_0x3f547f[_0x14e6('0x42')][_0x14e6('0x4b')]);_0x36a581[_0x14e6('0x4c')]=qs[_0x14e6('0x43')](_[_0x14e6('0x4d')](_0x3f547f[_0x14e6('0x42')],_0x25f91c['filters']),_0x2dfd5e);if(_0x3f547f[_0x14e6('0x42')][_0x14e6('0x4e')]){_0x36a581['where']=_[_0x14e6('0x4f')](_0x36a581[_0x14e6('0x4c')],{'$or':_['map'](_0x2dfd5e,function(_0x15c061){if(_0x15c061[_0x14e6('0x40')]!==_0x14e6('0x50')){var _0x4a7d9f={};_0x4a7d9f[_0x15c061['name']]={'$like':'%'+_0x3f547f[_0x14e6('0x42')][_0x14e6('0x4e')]+'%'};return _0x4a7d9f;}})});}_0x36a581=_[_0x14e6('0x4f')]({},_0x36a581,_0x3f547f[_0x14e6('0x51')]);var _0x4a3b9c={'where':_0x36a581[_0x14e6('0x4c')]};return db[_0x14e6('0x3e')][_0x14e6('0x2f')](_0x4a3b9c)['then'](function(_0x2fc9d5){_0x190240[_0x14e6('0x2f')]=_0x2fc9d5;if(_0x3f547f[_0x14e6('0x42')][_0x14e6('0x52')]){_0x36a581['include']=[{'all':!![]}];}return db[_0x14e6('0x3e')]['findAll'](_0x36a581);})['then'](function(_0x893e8b){_0x190240[_0x14e6('0x53')]=_0x893e8b;return _0x190240;})[_0x14e6('0x21')](respondWithFilteredResult(_0x30289a,_0x36a581))[_0x14e6('0x54')](handleError(_0x30289a,null));};exports[_0x14e6('0x55')]=function(_0xab468d,_0x466bcd){var _0x201ab6={'raw':!![],'where':{'id':_0xab468d[_0x14e6('0x56')]['id']}},_0x1c2627={};_0x1c2627['model']=_['keys'](db['SmsMessage'][_0x14e6('0x3f')]);_0x1c2627[_0x14e6('0x42')]=_['keys'](_0xab468d['query']);_0x1c2627[_0x14e6('0x43')]=_[_0x14e6('0x45')](_0x1c2627[_0x14e6('0x41')],_0x1c2627[_0x14e6('0x42')]);_0x201ab6[_0x14e6('0x44')]=_['intersection'](_0x1c2627[_0x14e6('0x41')],qs[_0x14e6('0x46')](_0xab468d[_0x14e6('0x42')][_0x14e6('0x46')]));_0x201ab6['attributes']=_0x201ab6['attributes'][_0x14e6('0x47')]?_0x201ab6[_0x14e6('0x44')]:_0x1c2627['model'];if(_0xab468d[_0x14e6('0x42')]['includeAll']){_0x201ab6[_0x14e6('0x57')]=[{'all':!![]}];}_0x201ab6=_[_0x14e6('0x4f')]({},_0x201ab6,_0xab468d['options']);return db[_0x14e6('0x3e')]['find'](_0x201ab6)[_0x14e6('0x21')](handleEntityNotFound(_0x466bcd,null))['then'](respondWithResult(_0x466bcd,null))['catch'](handleError(_0x466bcd,null));};exports[_0x14e6('0x58')]=function(_0x345dc2,_0x4317b1){return db['SmsMessage'][_0x14e6('0x58')](_0x345dc2[_0x14e6('0x59')],{})['then'](respondWithResult(_0x4317b1,0xc9))['catch'](handleError(_0x4317b1,null));};exports[_0x14e6('0x37')]=function(_0x517257,_0x3406ce){if(_0x517257[_0x14e6('0x59')]['id']){delete _0x517257[_0x14e6('0x59')]['id'];}return db[_0x14e6('0x3e')][_0x14e6('0x5a')]({'where':{'id':_0x517257[_0x14e6('0x56')]['id']}})['then'](handleEntityNotFound(_0x3406ce,null))[_0x14e6('0x21')](saveUpdates(_0x517257[_0x14e6('0x59')],null))['then'](respondWithResult(_0x3406ce,null))[_0x14e6('0x54')](handleError(_0x3406ce,null));};exports[_0x14e6('0x38')]=function(_0x3b560f,_0x1e6e79){return db[_0x14e6('0x3e')][_0x14e6('0x5a')]({'where':{'id':_0x3b560f['params']['id']}})[_0x14e6('0x21')](handleEntityNotFound(_0x1e6e79,null))[_0x14e6('0x21')](removeEntity(_0x1e6e79,null))[_0x14e6('0x54')](handleError(_0x1e6e79,null));};exports['describe']=function(_0x6a391d,_0x11a465){return db[_0x14e6('0x3e')][_0x14e6('0x5b')]()[_0x14e6('0x21')](respondWithResult(_0x11a465,null))[_0x14e6('0x54')](handleError(_0x11a465,null));};var interaction_log=require(_0x14e6('0x17'))(_0x14e6('0x5c'));exports[_0x14e6('0x5d')]=function(_0x48d9b3,_0x871a5e,_0x2fd492){var _0x771809={'channel':_0x14e6('0x5e')};if(_0x48d9b3['body']['id']){delete _0x48d9b3[_0x14e6('0x59')]['id'];}_0x48d9b3[_0x14e6('0x59')][_0x14e6('0x5f')]=!![];_0x48d9b3[_0x14e6('0x59')][_0x14e6('0x60')]=moment()[_0x14e6('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x48d9b3[_0x14e6('0x59')][_0x14e6('0x62')]=_0x48d9b3['body'][_0x14e6('0x62')]||_0x48d9b3['user']['id'];return db['SmsMessage'][_0x14e6('0x5a')]({'where':{'id':_0x48d9b3[_0x14e6('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x14e6('0x63')],'as':_0x14e6('0x64')}]})[_0x14e6('0x21')](handleEntityNotFound(_0x871a5e,null))[_0x14e6('0x21')](saveUpdates(_0x48d9b3[_0x14e6('0x59')],null))[_0x14e6('0x21')](function(_0x1fe26a){if(_0x1fe26a){_0x771809[_0x14e6('0x2a')]=_0x1fe26a[_0x14e6('0x65')]({'plain':!![]});return db[_0x14e6('0x66')][_0x14e6('0x5a')]({'where':{'id':_0x1fe26a['SmsInteractionId']}});}return null;})[_0x14e6('0x21')](handleEntityNotFound(_0x871a5e,null))['then'](function(_0x1fc138){if(_0x1fc138){return _0x1fc138[_0x14e6('0x37')]({'UserId':_0x48d9b3[_0x14e6('0x59')][_0x14e6('0x62')],'read1stAt':_[_0x14e6('0x67')](_0x1fc138['read1stAt'])?moment()[_0x14e6('0x61')](_0x14e6('0x68')):undefined});}return null;})[_0x14e6('0x21')](function(_0x23b09b){if(_0x23b09b){_0x771809[_0x14e6('0x69')]=_0x23b09b[_0x14e6('0x65')]({'plain':!![]});interaction_log[_0x14e6('0x22')](_0x14e6('0x6a'),_0x48d9b3['user']['id'],_0x48d9b3['user'][_0x14e6('0x3a')],_0x48d9b3[_0x14e6('0x6b')][_0x14e6('0x6c')],_0x771809[_0x14e6('0x69')]['id'],_0x48d9b3[_0x14e6('0x59')]?JSON[_0x14e6('0x27')](_0x48d9b3[_0x14e6('0x59')]):_0x14e6('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x771809);}return null;})[_0x14e6('0x21')](function(_0x93ed06){if(_0x93ed06){if(_0x48d9b3[_0x14e6('0x59')]['manual']){_0x771809[_0x14e6('0x2a')][_0x14e6('0x6e')]=util[_0x14e6('0x61')]('SIP/%s',_0x48d9b3[_0x14e6('0x6b')][_0x14e6('0x3a')]);_0x771809[_0x14e6('0x2a')][_0x14e6('0x6f')]=_0x771809['channel'];_0x771809['message'][_0x14e6('0x70')]='accept';return respondWithRpcPromise(_0x14e6('0x71'),_0x14e6('0x71'),{'event':'acceptmessage','message':_0x771809[_0x14e6('0x2a')]},client9002)['then'](function(){return _0x771809;});}return _0x771809;}return null;})[_0x14e6('0x21')](respondWithResult(_0x871a5e,null))[_0x14e6('0x54')](handleError(_0x871a5e,null));};var interaction_log=require(_0x14e6('0x17'))(_0x14e6('0x5c'));exports[_0x14e6('0x35')]=function(_0x40b7d3,_0x285046,_0x4a88da){var _0x3c5cba={'agent':{},'channel':_0x14e6('0x5e')};if(_0x40b7d3['body']['id']){delete _0x40b7d3[_0x14e6('0x59')]['id'];}_0x40b7d3[_0x14e6('0x59')]['UserId']=_0x40b7d3[_0x14e6('0x59')][_0x14e6('0x62')]||_0x40b7d3['user']['id'];_0x3c5cba[_0x14e6('0x72')]['id']=_0x40b7d3['body'][_0x14e6('0x62')];return db[_0x14e6('0x3e')][_0x14e6('0x5a')]({'where':{'id':_0x40b7d3[_0x14e6('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x285046,null))[_0x14e6('0x21')](function(_0x4ae5c2){if(_0x4ae5c2){_0x3c5cba[_0x14e6('0x2a')]=_0x4ae5c2[_0x14e6('0x65')]({'plain':!![]});return db[_0x14e6('0x66')][_0x14e6('0x5a')]({'where':{'id':_0x4ae5c2[_0x14e6('0x73')]}});}return null;})[_0x14e6('0x21')](handleEntityNotFound(_0x285046,null))[_0x14e6('0x21')](function(_0x3c50a1){if(_0x3c50a1){_0x3c5cba[_0x14e6('0x69')]=_0x3c50a1['get']({'plain':!![]});interaction_log[_0x14e6('0x22')](_0x14e6('0x74'),_0x40b7d3[_0x14e6('0x6b')]['id'],_0x40b7d3[_0x14e6('0x6b')][_0x14e6('0x3a')],_0x40b7d3[_0x14e6('0x6b')]['role'],_0x3c5cba['interaction']['id'],_0x40b7d3[_0x14e6('0x59')]?JSON[_0x14e6('0x27')](_0x40b7d3[_0x14e6('0x59')]):_0x14e6('0x6d'));return respondWithRpcPromise(_0x14e6('0x75'),_0x14e6('0x76'),_0x3c5cba);}return null;})[_0x14e6('0x21')](function(_0x27c479){if(_0x27c479){_0x27c479['message'][_0x14e6('0x6e')]=util[_0x14e6('0x61')](_0x14e6('0x77'),_0x40b7d3[_0x14e6('0x6b')][_0x14e6('0x3a')]);_0x27c479[_0x14e6('0x2a')]['channel']=_0x3c5cba[_0x14e6('0x6f')];_0x27c479[_0x14e6('0x2a')][_0x14e6('0x70')]=_0x14e6('0x35');respondWithRpcPromise(_0x14e6('0x71'),'EventManager',{'event':_0x14e6('0x78'),'message':_0x27c479[_0x14e6('0x2a')]},client9002);return _0x3c5cba;}return null;})['then'](respondWithResult(_0x285046,null))[_0x14e6('0x54')](handleError(_0x285046,null));};exports[_0x14e6('0x2d')]=function(_0x53b1d8,_0xe8e3a4,_0x396381){if(_0x53b1d8['body']['id']){delete _0x53b1d8[_0x14e6('0x59')]['id'];}var _0x55b430;return db[_0x14e6('0x3e')][_0x14e6('0x5a')]({'where':{'id':_0x53b1d8[_0x14e6('0x56')]['id']}})[_0x14e6('0x21')](handleEntityNotFound(_0xe8e3a4,null))[_0x14e6('0x21')](function(_0x7159c3){if(_0x7159c3){_0x55b430=_0x7159c3;return db[_0x14e6('0x79')]['find']({'where':{'id':_0x7159c3[_0x14e6('0x7a')]}});}})[_0x14e6('0x21')](handleEntityNotFound(_0xe8e3a4,null))['then'](function(_0x282fb0){if(_0x282fb0){logger[_0x14e6('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14e6('0x2d'),_0x14e6('0x7b'),_0x282fb0[_0x14e6('0x40')],util[_0x14e6('0x7c')](_0x53b1d8['body'],{'showHidden':![],'depth':null}));switch(_0x282fb0['type']){case _0x14e6('0x7d'):if(_0x53b1d8[_0x14e6('0x59')][_0x14e6('0x7e')]&&_0x53b1d8[_0x14e6('0x59')]['MessageSid']===_0x55b430[_0x14e6('0x7f')]){return _0x55b430[_0x14e6('0x37')]({'read':!![]});}else{logger[_0x14e6('0x28')](_0x14e6('0x80'),_0x14e6('0x2d'),_0x14e6('0x7d'),util[_0x14e6('0x7c')](_0x53b1d8[_0x14e6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x14e6('0x81'):if(_0x53b1d8[_0x14e6('0x59')]['MessageUUID']&&_0x53b1d8[_0x14e6('0x59')][_0x14e6('0x82')]===_0x55b430['messageId']&&_['indexOf'](['sent',_0x14e6('0x83')],_0x53b1d8['body'][_0x14e6('0x84')])>=0x0){return _0x55b430[_0x14e6('0x37')]({'read':!![]});}else{logger[_0x14e6('0x28')](_0x14e6('0x80'),_0x14e6('0x2d'),_0x14e6('0x85'),util['inspect'](_0x53b1d8[_0x14e6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x14e6('0x86'):var _0x285d04=_0x53b1d8[_0x14e6('0x59')][_0x14e6('0x87')][0x0];if(_0x285d04[_0x14e6('0x2d')]['groupName']===_0x14e6('0x88')){return _0x55b430[_0x14e6('0x37')]({'read':!![]});}else{logger[_0x14e6('0x28')](_0x14e6('0x80'),_0x14e6('0x2d'),_0x14e6('0x86'),util[_0x14e6('0x7c')](_0x53b1d8['body'],{'showHidden':![],'depth':null}));}break;}return _0x55b430;}})[_0x14e6('0x21')](respondWithResult(_0xe8e3a4,null))[_0x14e6('0x54')](handleError(_0xe8e3a4,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 60eae3d..ab6198e 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 _0x0b2f=['emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x16f226,_0x27bb11){var _0x476926=function(_0x5a635c){while(--_0x5a635c){_0x16f226['push'](_0x16f226['shift']());}};_0x476926(++_0x27bb11);}(_0x0b2f,0x175));var _0xf0b2=function(_0x17e75f,_0xceff01){_0x17e75f=_0x17e75f-0x0;var _0x50595d=_0x0b2f[_0x17e75f];return _0x50595d;};'use strict';var EventEmitter=require(_0xf0b2('0x0'));var SmsMessage=require(_0xf0b2('0x1'))['db'][_0xf0b2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf0b2('0x3')](0x0);var events={'afterCreate':_0xf0b2('0x4'),'afterUpdate':_0xf0b2('0x5'),'afterDestroy':_0xf0b2('0x6')};function emitEvent(_0x5dafce){return function(_0x11c091,_0xa88f15,_0x208b7a){SmsMessageEvents[_0xf0b2('0x7')](_0x5dafce+':'+_0x11c091['id'],_0x11c091);SmsMessageEvents['emit'](_0x5dafce,_0x11c091);_0x208b7a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xf0b2('0x8')](e,emitEvent(event));}}module[_0xf0b2('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x7c83=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5099d7,_0x58a330){var _0x3b0f0c=function(_0xd09e0a){while(--_0xd09e0a){_0x5099d7['push'](_0x5099d7['shift']());}};_0x3b0f0c(++_0x58a330);}(_0x7c83,0x8b));var _0x37c8=function(_0x407991,_0x59b269){_0x407991=_0x407991-0x0;var _0x106517=_0x7c83[_0x407991];return _0x106517;};'use strict';var EventEmitter=require(_0x37c8('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x37c8('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x37c8('0x2')](0x0);var events={'afterCreate':_0x37c8('0x3'),'afterUpdate':_0x37c8('0x4'),'afterDestroy':_0x37c8('0x5')};function emitEvent(_0x56769e){return function(_0x50818b,_0x29cdf1,_0x3eb41d){SmsMessageEvents[_0x37c8('0x6')](_0x56769e+':'+_0x50818b['id'],_0x50818b);SmsMessageEvents[_0x37c8('0x6')](_0x56769e,_0x50818b);_0x3eb41d(null);};}for(var e in events){if(events[_0x37c8('0x7')](e)){var event=events[e];SmsMessage[_0x37c8('0x8')](e,emitEvent(event));}}module[_0x37c8('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2dcec36..8a30459 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 _0x3b77=['https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','direction','toLowerCase','out','UserId','findOne','SmsInteractionId','then','createdAt','catch','error','secret','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','sender','login?username=','&password=','GET','split','POST','session_key','total_sent','internal_order_id','smsMethod','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','clicksend','xCALLY\x20Motion','senderString','%s:%s','format','Basic\x20%s','base64','http_code','data','queued_count','clickSend','token','https://api.plivo.com/v1/Account/%s/Message/','authId','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','text','length','createHash','digest','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message'];(function(_0x48ace4,_0x3ecb6d){var _0x1605a1=function(_0xe89150){while(--_0xe89150){_0x48ace4['push'](_0x48ace4['shift']());}};_0x1605a1(++_0x3ecb6d);}(_0x3b77,0x76));var _0x73b7=function(_0x8f9335,_0x254d55){_0x8f9335=_0x8f9335-0x0;var _0x4b8472=_0x3b77[_0x8f9335];return _0x4b8472;};'use strict';var _=require(_0x73b7('0x0'));var util=require('util');var logger=require(_0x73b7('0x1'))(_0x73b7('0x2'));var moment=require(_0x73b7('0x3'));var BPromise=require(_0x73b7('0x4'));var rp=require(_0x73b7('0x5'));var fs=require('fs');var path=require(_0x73b7('0x6'));var rimraf=require(_0x73b7('0x7'));var config=require(_0x73b7('0x8'));var attributes=require('./smsMessage.attributes');module[_0x73b7('0x9')]=function(_0x2a10ab,_0x434fe4){return _0x2a10ab['define'](_0x73b7('0xa'),attributes,{'tableName':_0x73b7('0xb'),'paranoid':![],'indexes':[{'name':_0x73b7('0xc'),'fields':[_0x73b7('0xc')]},{'name':_0x73b7('0xd'),'fields':[_0x73b7('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ff689,_0x5df6ab,_0x18e759){var _0x303d8a=_0x2a10ab['models'];var _0x3298db=_0x4ff689[_0x73b7('0xf')]({'plain':!![]});if(_0x3298db[_0x73b7('0x10')][_0x73b7('0x11')]()==='in'||_0x3298db[_0x73b7('0x10')][_0x73b7('0x11')]()===_0x73b7('0x12')&&!_0x3298db['secret']&&!_['isNil'](_0x3298db[_0x73b7('0x13')])){_0x303d8a['SmsInteraction'][_0x73b7('0x14')]({'where':{'id':_0x3298db[_0x73b7('0x15')]}})[_0x73b7('0x16')](function(_0x42dbb1){if(_0x42dbb1){_0x42dbb1['update']({'lastMsgAt':_0x3298db[_0x73b7('0x17')],'lastMsgDirection':_0x3298db[_0x73b7('0x10')][_0x73b7('0x11')]()});}})[_0x73b7('0x18')](function(_0xa8a006){console[_0x73b7('0x19')](_0xa8a006);});}if(_0x3298db[_0x73b7('0x10')]==='out'&&!_0x3298db[_0x73b7('0x1a')]){var _0x1b1aca;_0x303d8a['SmsAccount']['find']({'where':{'id':_0x3298db[_0x73b7('0x1b')]},'raw':!![]})[_0x73b7('0x16')](function(_0xd90d60){_0x1b1aca=_0xd90d60;if(_0x1b1aca&&_0x1b1aca[_0x73b7('0x1c')]){switch(_0x1b1aca[_0x73b7('0x1c')]){case _0x73b7('0x1d'):var _0x27b7e7=require(_0x73b7('0x1d'));if(_0x1b1aca[_0x73b7('0x1e')]&&_0x1b1aca[_0x73b7('0x1f')]&&_0x1b1aca[_0x73b7('0x20')]){var _0x50b612=new _0x27b7e7(_0x1b1aca[_0x73b7('0x1e')],_0x1b1aca[_0x73b7('0x1f')]);_0x50b612[_0x73b7('0x21')][_0x73b7('0x22')]({'body':_0x3298db['body'],'to':_0x3298db[_0x73b7('0x20')],'from':_0x1b1aca[_0x73b7('0x20')],'statusCallback':_0x1b1aca[_0x73b7('0x23')]+_0x73b7('0x24')+_0x3298db['id']+_0x73b7('0x25')+_0x1b1aca['token']})[_0x73b7('0x16')](function(_0x188a03){if(_0x188a03[_0x73b7('0x26')]){return _0x4ff689[_0x73b7('0x27')]({'messageId':_0x188a03[_0x73b7('0x26')]});}})[_0x73b7('0x18')](function(_0x529ac6){logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x1d'),util[_0x73b7('0x2a')](_0x529ac6,{'showHidden':![],'depth':null}));});}else{logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x73b7('0x2b'):var _0x2546e2=_0x73b7('0x2c');if(_0x1b1aca[_0x73b7('0x2d')]&&_0x1b1aca[_0x73b7('0x2e')]){var _0x33e42f={'recipient':[_0x3298db[_0x73b7('0x20')]],'message':_0x3298db[_0x73b7('0xe')],'message_type':_0x1b1aca['smsMethod']};if(_0x1b1aca['smsMethod']&&_0x1b1aca['smsMethod']!=='SI'){_0x33e42f[_0x73b7('0x2f')]=_0x1b1aca[_0x73b7('0x20')];}var _0x414ae0={'url':_0x2546e2+_0x73b7('0x30')+_0x1b1aca[_0x73b7('0x2d')]+_0x73b7('0x31')+_0x1b1aca['password'],'method':_0x73b7('0x32')};rp(_0x414ae0)[_0x73b7('0x16')](function(_0x41b336){var _0xc334de=_0x41b336[_0x73b7('0x33')](';');var _0x863082={'user_key':_0xc334de[0x0],'session_key':_0xc334de[0x1]};_0x414ae0={'url':_0x2546e2+'sms','method':_0x73b7('0x34'),'headers':{'user_key':_0x863082['user_key'],'Session_key':_0x863082[_0x73b7('0x35')]},'json':!![],'body':_0x33e42f};return rp(_0x414ae0);})[_0x73b7('0x16')](function(_0x55a2d3){if(_0x55a2d3[_0x73b7('0x36')]>=0x1){var _0x28fd89={'messageId':_0x55a2d3[_0x73b7('0x37')]};if(_0x1b1aca[_0x73b7('0x38')]!=='GP'||!_0x1b1aca[_0x73b7('0x39')]){_0x28fd89[_0x73b7('0x3a')]=!![];}return _0x4ff689[_0x73b7('0x27')](_0x28fd89);}else{return logger[_0x73b7('0x19')](_0x73b7('0x28'),'afterCreate',_0x73b7('0x2b'),util[_0x73b7('0x2a')](_0x55a2d3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x202ec9){return logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x2b'),util[_0x73b7('0x2a')](_0x202ec9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x2b'),_0x73b7('0x3b'));}break;case _0x73b7('0x3c'):if(_0x1b1aca['authToken']){var _0x5422e9={'recipient':_0x3298db[_0x73b7('0x20')],'message':_0x3298db[_0x73b7('0xe')],'sender':_0x1b1aca['senderString']||_0x1b1aca['phone'],'authorization':_0x1b1aca[_0x73b7('0x1f')]};var _0x5df6ab={'method':_0x73b7('0x34'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x5422e9,'json':!![]};rp(_0x5df6ab)['then'](function(_0x5ef529){var _0x118d51={'messageId':_0x5ef529['requestid']};if(!_0x1b1aca[_0x73b7('0x39')]){_0x118d51['read']=!![];}return _0x4ff689[_0x73b7('0x27')](_0x118d51);})[_0x73b7('0x18')](function(_0x6a5566){logger[_0x73b7('0x19')](_0x73b7('0x28'),'afterCreate',_0x73b7('0x3c'),util[_0x73b7('0x2a')](_0x6a5566,{'showHidden':![],'depth':null}));});}else{logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x73b7('0x3d'):if(_0x1b1aca['username']&&_0x1b1aca[_0x73b7('0x2e')]){var _0x5422e9={'messages':[{'source':_0x73b7('0x3e'),'to':_0x3298db[_0x73b7('0x20')],'body':_0x3298db[_0x73b7('0xe')],'from':_0x1b1aca[_0x73b7('0x3f')]||_0x1b1aca[_0x73b7('0x20')]}]};var _0x48c3f0=util['format'](_0x73b7('0x40'),_0x1b1aca[_0x73b7('0x2d')],_0x1b1aca[_0x73b7('0x2e')]);var _0x5df6ab={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5422e9,'headers':{'Authorization':util[_0x73b7('0x41')](_0x73b7('0x42'),new Buffer(_0x48c3f0)['toString'](_0x73b7('0x43')))},'json':!![]};rp(_0x5df6ab)[_0x73b7('0x16')](function(_0xf34c30){if(_0xf34c30[_0x73b7('0x44')]>=0xc8&&_0xf34c30[_0x73b7('0x44')]<=0xce){if(_0xf34c30[_0x73b7('0x45')]&&_0xf34c30[_0x73b7('0x45')][_0x73b7('0x46')]>0x0){var _0x31afe6=_['head'](_0xf34c30[_0x73b7('0x45')][_0x73b7('0x21')]);var _0x8bc7f9={'messageId':_0x31afe6['message_id']};if(!_0x1b1aca[_0x73b7('0x39')]){_0x8bc7f9[_0x73b7('0x3a')]=!![];}return _0x4ff689[_0x73b7('0x27')](_0x8bc7f9);}else{logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),'clickSend',util[_0x73b7('0x2a')](_0xf34c30,{'showHidden':![],'depth':null}));}}else{logger[_0x73b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73b7('0x29'),'clickSend',util[_0x73b7('0x2a')](_0xf34c30,{'showHidden':![],'depth':null}));}})['catch'](function(_0x482142){logger[_0x73b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73b7('0x29'),_0x73b7('0x47'),util[_0x73b7('0x2a')](_0x482142,{'showHidden':![],'depth':null}));});}else{logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x47'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x1b1aca['authId']&&_0x1b1aca[_0x73b7('0x1f')]){var _0x5422e9={'dst':_0x3298db[_0x73b7('0x20')],'text':_0x3298db[_0x73b7('0xe')],'src':_0x1b1aca[_0x73b7('0x3f')]||_0x1b1aca[_0x73b7('0x20')],'url':_0x1b1aca[_0x73b7('0x23')]+_0x73b7('0x24')+_0x3298db['id']+_0x73b7('0x25')+_0x1b1aca[_0x73b7('0x48')]};var _0x48c3f0=util['format'](_0x73b7('0x40'),_0x1b1aca['authId'],_0x1b1aca[_0x73b7('0x1f')]);var _0x5df6ab={'method':_0x73b7('0x34'),'uri':util[_0x73b7('0x41')](_0x73b7('0x49'),_0x1b1aca[_0x73b7('0x4a')]),'body':_0x5422e9,'headers':{'Authorization':util[_0x73b7('0x41')](_0x73b7('0x42'),new Buffer(_0x48c3f0)[_0x73b7('0x4b')](_0x73b7('0x43')))},'json':!![]};rp(_0x5df6ab)[_0x73b7('0x16')](function(_0x4e6bee){var _0x197d53={'messageId':_0x4e6bee[_0x73b7('0x4c')][0x0]};return _0x4ff689['update'](_0x197d53);})[_0x73b7('0x18')](function(_0x5dd84b){logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x4d'),util[_0x73b7('0x2a')](_0x5dd84b,{'showHidden':![],'depth':null}));});}else{logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),'plivo',_0x73b7('0x4e'));}break;case _0x73b7('0x4f'):if(_0x1b1aca[_0x73b7('0x2d')]&&_0x1b1aca['password']){if(_0x1b1aca[_0x73b7('0x50')]){var _0x32ed28={'method':_0x73b7('0x34'),'uri':_0x1b1aca[_0x73b7('0x50')]+_0x73b7('0x51'),'body':{'username':_0x1b1aca[_0x73b7('0x2d')],'password':_0x1b1aca[_0x73b7('0x2e')]},'json':!![]};return rp(_0x32ed28)[_0x73b7('0x16')](function(_0x1c9eaf){var _0x332f4b={'method':_0x73b7('0x34'),'uri':_0x1b1aca['baseUrl']+_0x73b7('0x52'),'body':{'messages':[{'from':_0x1b1aca[_0x73b7('0x20')],'destinations':[{'to':_0x3298db[_0x73b7('0x20')]}],'text':_0x3298db[_0x73b7('0xe')],'notifyUrl':_0x1b1aca['remote']+'/api/sms/messages/'+_0x3298db['id']+_0x73b7('0x25')+_0x1b1aca[_0x73b7('0x48')],'notifyContentType':_0x73b7('0x53'),'callbackData':_0x1b1aca[_0x73b7('0x20')]+';'+_0x3298db[_0x73b7('0xe')]}]},'headers':{'Authorization':_0x73b7('0x54')+_0x1c9eaf['token']},'json':!![]};return rp(_0x332f4b)[_0x73b7('0x16')](function(_0x5b6406){if(_0x5b6406[_0x73b7('0x21')]){var _0x1e0394={'messageId':_0x5b6406[_0x73b7('0x21')][0x0][_0x73b7('0xc')]};if(!_0x1b1aca[_0x73b7('0x39')]){_0x1e0394[_0x73b7('0x3a')]=!![];}return _0x4ff689[_0x73b7('0x27')](_0x1e0394);}else{return logger[_0x73b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73b7('0x29'),_0x73b7('0x4f'),util[_0x73b7('0x2a')](_0x5b6406,{'showHidden':![],'depth':null}));}});})[_0x73b7('0x18')](function(_0xa9daf2){return logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x4f'),util[_0x73b7('0x2a')](_0xa9daf2,{'showHidden':![],'depth':null}));});}else{logger[_0x73b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73b7('0x29'),_0x73b7('0x4f'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x73b7('0x55'):var _0x22df0c=require(_0x73b7('0x56'));if(_0x1b1aca[_0x73b7('0x57')]){var _0x47d275={};_0x47d275[_0x73b7('0x58')]=_0x1b1aca[_0x73b7('0x2d')];_0x47d275['phone']=_0x3298db[_0x73b7('0x20')];_0x47d275[_0x73b7('0x2f')]=_0x1b1aca[_0x73b7('0x20')];_0x47d275[_0x73b7('0x59')]=_0x3298db[_0x73b7('0xe')];_0x47d275['timestamp']=+new Date();var _0x44ac26='';var _0x1e2232='';var _0x4af006=Object['keys'](_0x47d275);_0x4af006['sort']();for(var _0x7318a8=0x0;_0x7318a8<_0x4af006[_0x73b7('0x5a')];_0x7318a8++){if(_0x44ac26!=''){_0x44ac26+='&';}_0x44ac26+=_0x4af006[_0x7318a8]+'='+encodeURIComponent(_0x47d275[_0x4af006[_0x7318a8]]);_0x1e2232+=_0x47d275[_0x4af006[_0x7318a8]];}_0x1e2232+=_0x1b1aca[_0x73b7('0x57')];_0x1e2232=_0x22df0c[_0x73b7('0x5b')]('md5')[_0x73b7('0x27')](_0x1e2232)[_0x73b7('0x5c')]('hex');if(_0x44ac26!==''){_0x44ac26+='&';}_0x44ac26+=_0x73b7('0x5d')+_0x1e2232;var _0x414ae0={'method':'GET','uri':_0x1b1aca[_0x73b7('0x50')]+_0x73b7('0x5e')+_0x44ac26,'json':!![]};return rp(_0x414ae0)[_0x73b7('0x16')](function(_0x35b583){var _0x184f02=Object[_0x73b7('0x5f')](_0x35b583);if(_0x35b583[_0x184f02[0x0]]['error']&&parseInt(_0x35b583[_0x184f02[0x0]][_0x73b7('0x19')])===0x0){var _0x39017a={'messageId':_0x35b583[_0x184f02[0x0]][_0x73b7('0x60')]};if(!_0x1b1aca[_0x73b7('0x39')]){_0x39017a[_0x73b7('0x3a')]=!![];}return _0x4ff689[_0x73b7('0x27')](_0x39017a);}else{return logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),'csc',util['inspect'](_0x35b583['error'],{'showHidden':![],'depth':null}));}})[_0x73b7('0x18')](function(_0x504f50){return logger[_0x73b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util['inspect'](_0x504f50,{'showHidden':![],'depth':null}));});}else{logger[_0x73b7('0x19')](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x55'),_0x73b7('0x61'));}break;case'clickatell':if(_0x1b1aca[_0x73b7('0x57')]){var _0xe57a43={'method':_0x73b7('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x1b1aca[_0x73b7('0x57')]},'body':{'content':_0x3298db[_0x73b7('0xe')],'to':[_0x3298db['phone']],'from':_0x1b1aca['phone'],'binary':![],'clientMessageId':_0x73b7('0x62'),'charset':_0x73b7('0x63')},'json':!![]};rp(_0xe57a43)[_0x73b7('0x16')](function(_0x487bdd){if(!_0x487bdd[_0x73b7('0x19')]){var _0x39b3a4={'messageId':_0x487bdd[_0x73b7('0x21')][0x0][_0x73b7('0x64')]};if(!_0x1b1aca[_0x73b7('0x39')]){_0x39b3a4['read']=!![];}return _0x4ff689['update'](_0x39b3a4);}else{return logger[_0x73b7('0x19')](_0x73b7('0x28'),'afterCreate',_0x73b7('0x65'),util[_0x73b7('0x2a')](_0x487bdd[_0x73b7('0x19')],{'showHidden':![],'depth':null}));}})[_0x73b7('0x18')](function(_0x17da57){return logger[_0x73b7('0x19')](_0x73b7('0x28'),'afterCreate',_0x73b7('0x65'),util[_0x73b7('0x2a')](_0x17da57,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0x73b7('0x66'):if(_0x1b1aca[_0x73b7('0x57')]){var _0x1dad37={};var _0x414ae0={'method':_0x73b7('0x34'),'uri':_0x73b7('0x67'),'headers':{'Authorization':'Bearer\x20'+_0x1b1aca[_0x73b7('0x57')],'Content-Type':_0x73b7('0x53')},'body':{'from':_0x1b1aca[_0x73b7('0x20')],'to':_0x3298db[_0x73b7('0x20')],'text':_0x3298db['body']},'json':!![]};return rp(_0x414ae0)[_0x73b7('0x16')](function(_0x1f5c80){if(_0x1f5c80[_0x73b7('0x68')]==0xca){_0x1dad37[_0x73b7('0x69')]=_0x1f5c80;var _0x52517e={'method':'POST','uri':_0x73b7('0x6a'),'headers':{'Authorization':'Bearer\x20'+_0x1b1aca['apiKey'],'Content-Type':_0x73b7('0x53')},'body':{'refid':_0x1dad37[_0x73b7('0x69')][_0x73b7('0x6b')]},'json':!![]};return rp(_0x52517e)[_0x73b7('0x16')](function(_0x523ee9){_0x1dad37[_0x73b7('0x6c')]=_0x523ee9;var _0x325f8a={'messageId':_0x1dad37[_0x73b7('0x69')][_0x73b7('0x6b')],'read':!![]};return _0x4ff689[_0x73b7('0x27')](_0x325f8a);});}else{return logger[_0x73b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x73b7('0x66'),util[_0x73b7('0x2a')](_0x1f5c80,{'showHidden':![],'depth':null}));}})[_0x73b7('0x18')](function(_0x48968e){return logger['error'](_0x73b7('0x28'),_0x73b7('0x29'),_0x73b7('0x66'),util[_0x73b7('0x2a')](_0x48968e,{'showHidden':![],'depth':null}));});}else{return logger[_0x73b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x73b7('0x66'),_0x73b7('0x6d'));}break;}}})[_0x73b7('0x6e')](function(){_0x18e759();});}else{_0x18e759();}}},'charset':_0x73b7('0x6f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3f7e=['id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','update','createdAt','error','out','SmsAccount','find','SmsAccountId','then','type','authToken','phone','accountSid','messages','create','/status?token=','token','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','total_sent','deliveryReport','read','inspect','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','format','%s:%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','sort','length','createHash','hex','signature=','/external/get/send.php?','keys'];(function(_0xf597b3,_0x503431){var _0x15097c=function(_0x561ef8){while(--_0x561ef8){_0xf597b3['push'](_0xf597b3['shift']());}};_0x15097c(++_0x503431);}(_0x3f7e,0x83));var _0xe3f7=function(_0x1d4e74,_0x353a9d){_0x1d4e74=_0x1d4e74-0x0;var _0x442c5a=_0x3f7e[_0x1d4e74];return _0x442c5a;};'use strict';var _=require(_0xe3f7('0x0'));var util=require(_0xe3f7('0x1'));var logger=require(_0xe3f7('0x2'))(_0xe3f7('0x3'));var moment=require(_0xe3f7('0x4'));var BPromise=require(_0xe3f7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe3f7('0x6'));var config=require(_0xe3f7('0x7'));var attributes=require(_0xe3f7('0x8'));module[_0xe3f7('0x9')]=function(_0x43fb23,_0x5b4695){return _0x43fb23[_0xe3f7('0xa')](_0xe3f7('0xb'),attributes,{'tableName':_0xe3f7('0xc'),'paranoid':![],'indexes':[{'name':_0xe3f7('0xd'),'fields':[_0xe3f7('0xd')]},{'name':_0xe3f7('0xe'),'fields':[_0xe3f7('0xf')],'type':_0xe3f7('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x655931,_0x2c5c5a,_0x198864){var _0xb32044=_0x43fb23[_0xe3f7('0x11')];var _0x525cec=_0x655931[_0xe3f7('0x12')]({'plain':!![]});if(_0x525cec[_0xe3f7('0x13')][_0xe3f7('0x14')]()==='in'||_0x525cec[_0xe3f7('0x13')][_0xe3f7('0x14')]()==='out'&&!_0x525cec[_0xe3f7('0x15')]&&!_[_0xe3f7('0x16')](_0x525cec[_0xe3f7('0x17')])){_0xb32044['SmsInteraction']['findOne']({'where':{'id':_0x525cec[_0xe3f7('0x18')]}})['then'](function(_0x35b2c4){if(_0x35b2c4){_0x35b2c4[_0xe3f7('0x19')]({'lastMsgAt':_0x525cec[_0xe3f7('0x1a')],'lastMsgDirection':_0x525cec[_0xe3f7('0x13')][_0xe3f7('0x14')]()});}})['catch'](function(_0x275edc){console[_0xe3f7('0x1b')](_0x275edc);});}if(_0x525cec[_0xe3f7('0x13')]===_0xe3f7('0x1c')&&!_0x525cec['secret']){var _0x22dacc;_0xb32044[_0xe3f7('0x1d')][_0xe3f7('0x1e')]({'where':{'id':_0x525cec[_0xe3f7('0x1f')]},'raw':!![]})[_0xe3f7('0x20')](function(_0x600e8b){_0x22dacc=_0x600e8b;if(_0x22dacc&&_0x22dacc[_0xe3f7('0x21')]){switch(_0x22dacc[_0xe3f7('0x21')]){case'twilio':var _0x5aaab3=require('twilio');if(_0x22dacc['accountSid']&&_0x22dacc[_0xe3f7('0x22')]&&_0x22dacc[_0xe3f7('0x23')]){var _0x5b6c7a=new _0x5aaab3(_0x22dacc[_0xe3f7('0x24')],_0x22dacc['authToken']);_0x5b6c7a[_0xe3f7('0x25')][_0xe3f7('0x26')]({'body':_0x525cec['body'],'to':_0x525cec['phone'],'from':_0x22dacc[_0xe3f7('0x23')],'statusCallback':_0x22dacc['remote']+'/api/sms/messages/'+_0x525cec['id']+_0xe3f7('0x27')+_0x22dacc[_0xe3f7('0x28')]})[_0xe3f7('0x20')](function(_0x4d85ff){if(_0x4d85ff['sid']){return _0x655931[_0xe3f7('0x19')]({'messageId':_0x4d85ff['sid']});}})[_0xe3f7('0x29')](function(_0x3a3893){logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x2c'),util['inspect'](_0x3a3893,{'showHidden':![],'depth':null}));});}else{logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x2c'),_0xe3f7('0x2d'));}break;case _0xe3f7('0x2e'):var _0x34d796=_0xe3f7('0x2f');if(_0x22dacc[_0xe3f7('0x30')]&&_0x22dacc[_0xe3f7('0x31')]){var _0x2b99dd={'recipient':[_0x525cec[_0xe3f7('0x23')]],'message':_0x525cec[_0xe3f7('0xf')],'message_type':_0x22dacc['smsMethod']};if(_0x22dacc['smsMethod']&&_0x22dacc[_0xe3f7('0x32')]!=='SI'){_0x2b99dd[_0xe3f7('0x33')]=_0x22dacc['phone'];}var _0x5d237f={'url':_0x34d796+'login?username='+_0x22dacc[_0xe3f7('0x30')]+_0xe3f7('0x34')+_0x22dacc[_0xe3f7('0x31')],'method':_0xe3f7('0x35')};rp(_0x5d237f)['then'](function(_0x28f463){var _0xfa7360=_0x28f463[_0xe3f7('0x36')](';');var _0x7d6972={'user_key':_0xfa7360[0x0],'session_key':_0xfa7360[0x1]};_0x5d237f={'url':_0x34d796+_0xe3f7('0x37'),'method':_0xe3f7('0x38'),'headers':{'user_key':_0x7d6972['user_key'],'Session_key':_0x7d6972['session_key']},'json':!![],'body':_0x2b99dd};return rp(_0x5d237f);})[_0xe3f7('0x20')](function(_0x412704){if(_0x412704[_0xe3f7('0x39')]>=0x1){var _0x133df6={'messageId':_0x412704['internal_order_id']};if(_0x22dacc['smsMethod']!=='GP'||!_0x22dacc[_0xe3f7('0x3a')]){_0x133df6[_0xe3f7('0x3b')]=!![];}return _0x655931[_0xe3f7('0x19')](_0x133df6);}else{return logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x2e'),util[_0xe3f7('0x3c')](_0x412704,{'showHidden':![],'depth':null}));}})['catch'](function(_0x79f38f){return logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x2e'),util[_0xe3f7('0x3c')](_0x79f38f,{'showHidden':![],'depth':null}));});}else{logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe3f7('0x3d'):if(_0x22dacc[_0xe3f7('0x22')]){var _0x24b40b={'recipient':_0x525cec['phone'],'message':_0x525cec[_0xe3f7('0xf')],'sender':_0x22dacc[_0xe3f7('0x3e')]||_0x22dacc['phone'],'authorization':_0x22dacc['authToken']};var _0x2c5c5a={'method':_0xe3f7('0x38'),'uri':_0xe3f7('0x3f'),'body':_0x24b40b,'json':!![]};rp(_0x2c5c5a)[_0xe3f7('0x20')](function(_0x4e6a31){var _0x1ab383={'messageId':_0x4e6a31[_0xe3f7('0x40')]};if(!_0x22dacc['deliveryReport']){_0x1ab383[_0xe3f7('0x3b')]=!![];}return _0x655931[_0xe3f7('0x19')](_0x1ab383);})[_0xe3f7('0x29')](function(_0x27921d){logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),'connectel',util[_0xe3f7('0x3c')](_0x27921d,{'showHidden':![],'depth':null}));});}else{logger[_0xe3f7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe3f7('0x2b'),_0xe3f7('0x3d'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x22dacc[_0xe3f7('0x30')]&&_0x22dacc['password']){var _0x24b40b={'messages':[{'source':'xCALLY\x20Motion','to':_0x525cec[_0xe3f7('0x23')],'body':_0x525cec[_0xe3f7('0xf')],'from':_0x22dacc[_0xe3f7('0x3e')]||_0x22dacc[_0xe3f7('0x23')]}]};var _0xb989c8=util[_0xe3f7('0x41')](_0xe3f7('0x42'),_0x22dacc[_0xe3f7('0x30')],_0x22dacc['password']);var _0x2c5c5a={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x24b40b,'headers':{'Authorization':util[_0xe3f7('0x41')]('Basic\x20%s',new Buffer(_0xb989c8)[_0xe3f7('0x43')](_0xe3f7('0x44')))},'json':!![]};rp(_0x2c5c5a)['then'](function(_0x127f0c){if(_0x127f0c[_0xe3f7('0x45')]>=0xc8&&_0x127f0c[_0xe3f7('0x45')]<=0xce){if(_0x127f0c[_0xe3f7('0x46')]&&_0x127f0c[_0xe3f7('0x46')][_0xe3f7('0x47')]>0x0){var _0xb10d11=_[_0xe3f7('0x48')](_0x127f0c[_0xe3f7('0x46')][_0xe3f7('0x25')]);var _0x301d4c={'messageId':_0xb10d11[_0xe3f7('0x49')]};if(!_0x22dacc[_0xe3f7('0x3a')]){_0x301d4c[_0xe3f7('0x3b')]=!![];}return _0x655931[_0xe3f7('0x19')](_0x301d4c);}else{logger[_0xe3f7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe3f7('0x4a'),util[_0xe3f7('0x3c')](_0x127f0c,{'showHidden':![],'depth':null}));}}else{logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x4a'),util[_0xe3f7('0x3c')](_0x127f0c,{'showHidden':![],'depth':null}));}})[_0xe3f7('0x29')](function(_0x4b117c){logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),'afterCreate',_0xe3f7('0x4a'),util[_0xe3f7('0x3c')](_0x4b117c,{'showHidden':![],'depth':null}));});}else{logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),'afterCreate','clickSend',_0xe3f7('0x4b'));}break;case _0xe3f7('0x4c'):if(_0x22dacc[_0xe3f7('0x4d')]&&_0x22dacc['authToken']){var _0x24b40b={'dst':_0x525cec['phone'],'text':_0x525cec[_0xe3f7('0xf')],'src':_0x22dacc[_0xe3f7('0x3e')]||_0x22dacc[_0xe3f7('0x23')],'url':_0x22dacc[_0xe3f7('0x4e')]+_0xe3f7('0x4f')+_0x525cec['id']+_0xe3f7('0x27')+_0x22dacc[_0xe3f7('0x28')]};var _0xb989c8=util[_0xe3f7('0x41')](_0xe3f7('0x42'),_0x22dacc[_0xe3f7('0x4d')],_0x22dacc[_0xe3f7('0x22')]);var _0x2c5c5a={'method':_0xe3f7('0x38'),'uri':util[_0xe3f7('0x41')](_0xe3f7('0x50'),_0x22dacc[_0xe3f7('0x4d')]),'body':_0x24b40b,'headers':{'Authorization':util[_0xe3f7('0x41')]('Basic\x20%s',new Buffer(_0xb989c8)[_0xe3f7('0x43')](_0xe3f7('0x44')))},'json':!![]};rp(_0x2c5c5a)[_0xe3f7('0x20')](function(_0x29a63e){var _0x357920={'messageId':_0x29a63e[_0xe3f7('0x51')][0x0]};return _0x655931['update'](_0x357920);})[_0xe3f7('0x29')](function(_0x4e9eba){logger['error'](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x4c'),util['inspect'](_0x4e9eba,{'showHidden':![],'depth':null}));});}else{logger[_0xe3f7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe3f7('0x2b'),_0xe3f7('0x4c'),_0xe3f7('0x52'));}break;case'infobip':if(_0x22dacc[_0xe3f7('0x30')]&&_0x22dacc[_0xe3f7('0x31')]){if(_0x22dacc[_0xe3f7('0x53')]){var _0x1bce4b={'method':_0xe3f7('0x38'),'uri':_0x22dacc[_0xe3f7('0x53')]+_0xe3f7('0x54'),'body':{'username':_0x22dacc[_0xe3f7('0x30')],'password':_0x22dacc[_0xe3f7('0x31')]},'json':!![]};return rp(_0x1bce4b)[_0xe3f7('0x20')](function(_0x12d5d0){var _0x2af451={'method':_0xe3f7('0x38'),'uri':_0x22dacc[_0xe3f7('0x53')]+_0xe3f7('0x55'),'body':{'messages':[{'from':_0x22dacc['phone'],'destinations':[{'to':_0x525cec[_0xe3f7('0x23')]}],'text':_0x525cec['body'],'notifyUrl':_0x22dacc[_0xe3f7('0x4e')]+_0xe3f7('0x4f')+_0x525cec['id']+'/status?token='+_0x22dacc[_0xe3f7('0x28')],'notifyContentType':'application/json','callbackData':_0x22dacc[_0xe3f7('0x23')]+';'+_0x525cec[_0xe3f7('0xf')]}]},'headers':{'Authorization':_0xe3f7('0x56')+_0x12d5d0[_0xe3f7('0x28')]},'json':!![]};return rp(_0x2af451)['then'](function(_0x5272b8){if(_0x5272b8['messages']){var _0x157a6e={'messageId':_0x5272b8[_0xe3f7('0x25')][0x0][_0xe3f7('0xd')]};if(!_0x22dacc['deliveryReport']){_0x157a6e[_0xe3f7('0x3b')]=!![];}return _0x655931[_0xe3f7('0x19')](_0x157a6e);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe3f7('0x2b'),_0xe3f7('0x57'),util['inspect'](_0x5272b8,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x25b99e){return logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x57'),util[_0xe3f7('0x3c')](_0x25b99e,{'showHidden':![],'depth':null}));});}else{logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x57'),_0xe3f7('0x58'));}}else{logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),'afterCreate',_0xe3f7('0x57'),_0xe3f7('0x4b'));}break;case _0xe3f7('0x59'):var _0xd86097=require(_0xe3f7('0x5a'));if(_0x22dacc[_0xe3f7('0x5b')]){var _0x4dccf0={};_0x4dccf0[_0xe3f7('0x5c')]=_0x22dacc[_0xe3f7('0x30')];_0x4dccf0['phone']=_0x525cec[_0xe3f7('0x23')];_0x4dccf0[_0xe3f7('0x33')]=_0x22dacc[_0xe3f7('0x23')];_0x4dccf0[_0xe3f7('0x5d')]=_0x525cec[_0xe3f7('0xf')];_0x4dccf0['timestamp']=+new Date();var _0x1b0d86='';var _0x123591='';var _0x47af64=Object['keys'](_0x4dccf0);_0x47af64[_0xe3f7('0x5e')]();for(var _0x198485=0x0;_0x198485<_0x47af64[_0xe3f7('0x5f')];_0x198485++){if(_0x1b0d86!=''){_0x1b0d86+='&';}_0x1b0d86+=_0x47af64[_0x198485]+'='+encodeURIComponent(_0x4dccf0[_0x47af64[_0x198485]]);_0x123591+=_0x4dccf0[_0x47af64[_0x198485]];}_0x123591+=_0x22dacc['apiKey'];_0x123591=_0xd86097[_0xe3f7('0x60')]('md5')[_0xe3f7('0x19')](_0x123591)['digest'](_0xe3f7('0x61'));if(_0x1b0d86!==''){_0x1b0d86+='&';}_0x1b0d86+=_0xe3f7('0x62')+_0x123591;var _0x5d237f={'method':_0xe3f7('0x35'),'uri':_0x22dacc[_0xe3f7('0x53')]+_0xe3f7('0x63')+_0x1b0d86,'json':!![]};return rp(_0x5d237f)['then'](function(_0x10cb4a){var _0x51862e=Object[_0xe3f7('0x64')](_0x10cb4a);if(_0x10cb4a[_0x51862e[0x0]][_0xe3f7('0x1b')]&&parseInt(_0x10cb4a[_0x51862e[0x0]][_0xe3f7('0x1b')])===0x0){var _0x8b27f0={'messageId':_0x10cb4a[_0x51862e[0x0]][_0xe3f7('0x65')]};if(!_0x22dacc[_0xe3f7('0x3a')]){_0x8b27f0[_0xe3f7('0x3b')]=!![];}return _0x655931[_0xe3f7('0x19')](_0x8b27f0);}else{return logger[_0xe3f7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe3f7('0x2b'),_0xe3f7('0x59'),util['inspect'](_0x10cb4a[_0xe3f7('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xa3f0e8){return logger['error'](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x59'),util[_0xe3f7('0x3c')](_0xa3f0e8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x59'),_0xe3f7('0x66'));}break;case _0xe3f7('0x67'):if(_0x22dacc[_0xe3f7('0x5b')]){var _0x33955e={'method':_0xe3f7('0x38'),'uri':_0xe3f7('0x68'),'headers':{'Authorization':_0x22dacc[_0xe3f7('0x5b')]},'body':{'content':_0x525cec[_0xe3f7('0xf')],'to':[_0x525cec[_0xe3f7('0x23')]],'from':_0x22dacc[_0xe3f7('0x23')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x33955e)[_0xe3f7('0x20')](function(_0x1def84){if(!_0x1def84[_0xe3f7('0x1b')]){var _0x49f53e={'messageId':_0x1def84[_0xe3f7('0x25')][0x0][_0xe3f7('0x69')]};if(!_0x22dacc['deliveryReport']){_0x49f53e['read']=!![];}return _0x655931[_0xe3f7('0x19')](_0x49f53e);}else{return logger[_0xe3f7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe3f7('0x2b'),'clickatell',util[_0xe3f7('0x3c')](_0x1def84['error'],{'showHidden':![],'depth':null}));}})[_0xe3f7('0x29')](function(_0x56a2b2){return logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x67'),util[_0xe3f7('0x3c')](_0x56a2b2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe3f7('0x2a'),_0xe3f7('0x2b'),'clickatell',_0xe3f7('0x66'));}break;case _0xe3f7('0x6a'):if(_0x22dacc[_0xe3f7('0x5b')]){var _0x35ee30={};var _0x5d237f={'method':_0xe3f7('0x38'),'uri':_0xe3f7('0x6b'),'headers':{'Authorization':_0xe3f7('0x6c')+_0x22dacc['apiKey'],'Content-Type':_0xe3f7('0x6d')},'body':{'from':_0x22dacc[_0xe3f7('0x23')],'to':_0x525cec[_0xe3f7('0x23')],'text':_0x525cec[_0xe3f7('0xf')]},'json':!![]};return rp(_0x5d237f)['then'](function(_0x4197a5){if(_0x4197a5['code']==0xca){_0x35ee30[_0xe3f7('0x6e')]=_0x4197a5;var _0x4f5586={'method':_0xe3f7('0x38'),'uri':_0xe3f7('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x22dacc[_0xe3f7('0x5b')],'Content-Type':_0xe3f7('0x6d')},'body':{'refid':_0x35ee30[_0xe3f7('0x6e')]['refid']},'json':!![]};return rp(_0x4f5586)[_0xe3f7('0x20')](function(_0x34767b){_0x35ee30[_0xe3f7('0x70')]=_0x34767b;var _0x1a516a={'messageId':_0x35ee30[_0xe3f7('0x6e')]['refid'],'read':!![]};return _0x655931['update'](_0x1a516a);});}else{return logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x6a'),util[_0xe3f7('0x3c')](_0x4197a5,{'showHidden':![],'depth':null}));}})[_0xe3f7('0x29')](function(_0x46bcbf){return logger[_0xe3f7('0x1b')](_0xe3f7('0x2a'),_0xe3f7('0x2b'),_0xe3f7('0x6a'),util[_0xe3f7('0x3c')](_0x46bcbf,{'showHidden':![],'depth':null}));});}else{return logger[_0xe3f7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe3f7('0x2b'),_0xe3f7('0x6a'),'Token\x20not\x20received');}break;}}})[_0xe3f7('0x71')](function(){_0x198864();});}else{_0x198864();}}},'charset':_0xe3f7('0x72'),'collate':_0xe3f7('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fc1a9f2..8528994 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(_0x27d5a1,_0x36f38b){var _0x22e4c4=function(_0x2097bf){while(--_0x2097bf){_0x27d5a1['push'](_0x27d5a1['shift']());}};_0x22e4c4(++_0x36f38b);}(_0x66fa,0x117));var _0xa66f=function(_0x43e5f2,_0x20cf76){_0x43e5f2=_0x43e5f2-0x0;var _0x31dbf9=_0x66fa[_0x43e5f2];return _0x31dbf9;};'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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','body'];(function(_0x8740c3,_0xddd750){var _0x10d404=function(_0x3360a4){while(--_0x3360a4){_0x8740c3['push'](_0x8740c3['shift']());}};_0x10d404(++_0xddd750);}(_0xb10b,0x12a));var _0xbb10=function(_0x21f28f,_0x3be6b8){_0x21f28f=_0x21f28f-0x0;var _0x180f21=_0xb10b[_0x21f28f];return _0x180f21;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f122b66..0b553eb 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 _0x239d=['removeListener','register','length','smsMessage:','save','remove','update','emit'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0x239d,0x194));var _0xd239=function(_0x3f0a50,_0x4823c2){_0x3f0a50=_0x3f0a50-0x0;var _0x202bae=_0x239d[_0x3f0a50];return _0x202bae;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd239('0x0'),_0xd239('0x1'),_0xd239('0x2')];function createListener(_0x5ee7fd,_0x735f82){return function(_0x1e25bf){_0x735f82[_0xd239('0x3')](_0x5ee7fd,_0x1e25bf);};}function removeListener(_0x1464ed,_0x5c9e53){return function(){SmsMessageEvents[_0xd239('0x4')](_0x1464ed,_0x5c9e53);};}exports[_0xd239('0x5')]=function(_0x17c0f3){for(var _0x2790d1=0x0,_0xe529eb=events[_0xd239('0x6')];_0x2790d1<_0xe529eb;_0x2790d1++){var _0x1388ef=events[_0x2790d1];var _0x4182fa=createListener(_0xd239('0x7')+_0x1388ef,_0x17c0f3);SmsMessageEvents['on'](_0x1388ef,_0x4182fa);}}; \ No newline at end of file +var _0xab57=['./smsMessage.events','remove','update','emit','removeListener','length','smsMessage:'];(function(_0x30099e,_0x1ee4b2){var _0x474f63=function(_0x26f35a){while(--_0x26f35a){_0x30099e['push'](_0x30099e['shift']());}};_0x474f63(++_0x1ee4b2);}(_0xab57,0x85));var _0x7ab5=function(_0x5a1dd1,_0x2c5539){_0x5a1dd1=_0x5a1dd1-0x0;var _0x423002=_0xab57[_0x5a1dd1];return _0x423002;};'use strict';var SmsMessageEvents=require(_0x7ab5('0x0'));var events=['save',_0x7ab5('0x1'),_0x7ab5('0x2')];function createListener(_0x3bf1f2,_0x111061){return function(_0x2fb878){_0x111061[_0x7ab5('0x3')](_0x3bf1f2,_0x2fb878);};}function removeListener(_0xb6ac21,_0x512e2a){return function(){SmsMessageEvents[_0x7ab5('0x4')](_0xb6ac21,_0x512e2a);};}exports['register']=function(_0x3e3129){for(var _0x21d45d=0x0,_0x1021c7=events[_0x7ab5('0x5')];_0x21d45d<_0x1021c7;_0x21d45d++){var _0x5227cf=events[_0x21d45d];var _0x3c0413=createListener(_0x7ab5('0x6')+_0x5227cf,_0x3e3129);SmsMessageEvents['on'](_0x5227cf,_0x3c0413);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e09fdd5..8448e54 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 _0x8c46=['get','isAuthenticated','index','/describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','update','destroy','removeTeams','delete','removeAgents','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0xfa40a4,_0x48e6b4){var _0x55f721=function(_0x1a227f){while(--_0x1a227f){_0xfa40a4['push'](_0xfa40a4['shift']());}};_0x55f721(++_0x48e6b4);}(_0x8c46,0x171));var _0x68c4=function(_0x569a1d,_0x4db8f5){_0x569a1d=_0x569a1d-0x0;var _0x2ed86f=_0x8c46[_0x569a1d];return _0x2ed86f;};'use strict';var multer=require(_0x68c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68c4('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x68c4('0x2'));var interaction=require(_0x68c4('0x3'));var config=require(_0x68c4('0x4'));var controller=require(_0x68c4('0x5'));router[_0x68c4('0x6')]('/',auth[_0x68c4('0x7')](),controller[_0x68c4('0x8')]);router[_0x68c4('0x6')](_0x68c4('0x9'),auth[_0x68c4('0x7')](),controller['describe']);router[_0x68c4('0x6')](_0x68c4('0xa'),auth[_0x68c4('0x7')](),controller['show']);router[_0x68c4('0x6')](_0x68c4('0xb'),auth[_0x68c4('0x7')](),controller['getMembers']);router['get'](_0x68c4('0xc'),auth[_0x68c4('0x7')](),controller['getTeams']);router['get'](_0x68c4('0xd'),auth[_0x68c4('0x7')](),controller[_0x68c4('0xe')]);router['post']('/',auth[_0x68c4('0x7')](),controller[_0x68c4('0xf')]);router[_0x68c4('0x10')]('/:id/teams',auth[_0x68c4('0x7')](),controller[_0x68c4('0x11')]);router[_0x68c4('0x10')]('/:id/users',auth[_0x68c4('0x7')](),controller[_0x68c4('0x12')]);router['put'](_0x68c4('0xa'),auth['isAuthenticated'](),controller[_0x68c4('0x13')]);router['delete']('/:id',auth[_0x68c4('0x7')](),controller[_0x68c4('0x14')]);router['delete'](_0x68c4('0xc'),auth[_0x68c4('0x7')](),controller[_0x68c4('0x15')]);router[_0x68c4('0x16')](_0x68c4('0xd'),auth[_0x68c4('0x7')](),controller[_0x68c4('0x17')]);module[_0x68c4('0x18')]=router; \ No newline at end of file +var _0xe1d3=['getAgents','post','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x4fdc84,_0x1dee7c){var _0x17c9eb=function(_0x4d80bd){while(--_0x4d80bd){_0x4fdc84['push'](_0x4fdc84['shift']());}};_0x17c9eb(++_0x1dee7c);}(_0xe1d3,0x159));var _0x3e1d=function(_0x3fb184,_0x30eed8){_0x3fb184=_0x3fb184-0x0;var _0xfd64ae=_0xe1d3[_0x3fb184];return _0xfd64ae;};'use strict';var multer=require(_0x3e1d('0x0'));var util=require(_0x3e1d('0x1'));var path=require(_0x3e1d('0x2'));var timeout=require(_0x3e1d('0x3'));var express=require(_0x3e1d('0x4'));var router=express['Router']();var auth=require(_0x3e1d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3e1d('0x6'));var controller=require(_0x3e1d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3e1d('0x8')]);router[_0x3e1d('0x9')](_0x3e1d('0xa'),auth[_0x3e1d('0xb')](),controller[_0x3e1d('0xc')]);router['get'](_0x3e1d('0xd'),auth[_0x3e1d('0xb')](),controller['show']);router[_0x3e1d('0x9')](_0x3e1d('0xe'),auth[_0x3e1d('0xb')](),controller[_0x3e1d('0xf')]);router[_0x3e1d('0x9')](_0x3e1d('0x10'),auth[_0x3e1d('0xb')](),controller[_0x3e1d('0x11')]);router[_0x3e1d('0x9')](_0x3e1d('0x12'),auth[_0x3e1d('0xb')](),controller[_0x3e1d('0x13')]);router[_0x3e1d('0x14')]('/',auth[_0x3e1d('0xb')](),controller['create']);router[_0x3e1d('0x14')](_0x3e1d('0x10'),auth['isAuthenticated'](),controller[_0x3e1d('0x15')]);router[_0x3e1d('0x14')]('/:id/users',auth[_0x3e1d('0xb')](),controller[_0x3e1d('0x16')]);router[_0x3e1d('0x17')](_0x3e1d('0xd'),auth[_0x3e1d('0xb')](),controller['update']);router[_0x3e1d('0x18')](_0x3e1d('0xd'),auth['isAuthenticated'](),controller[_0x3e1d('0x19')]);router[_0x3e1d('0x18')]('/:id/teams',auth[_0x3e1d('0xb')](),controller[_0x3e1d('0x1a')]);router[_0x3e1d('0x18')](_0x3e1d('0x12'),auth[_0x3e1d('0xb')](),controller[_0x3e1d('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 3269530..8a0e0c4 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 _0xe694=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4e7f89,_0x128d45){var _0x512524=function(_0x2d3e7f){while(--_0x2d3e7f){_0x4e7f89['push'](_0x4e7f89['shift']());}};_0x512524(++_0x128d45);}(_0xe694,0x130));var _0x4e69=function(_0x1163c3,_0x3aedc6){_0x1163c3=_0x1163c3-0x0;var _0x7a7cb5=_0xe694[_0x1163c3];return _0x7a7cb5;};'use strict';var Sequelize=require(_0x4e69('0x0'));module[_0x4e69('0x1')]={'name':{'type':Sequelize[_0x4e69('0x2')],'unique':_0x4e69('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4e69('0x2')]},'timeout':{'type':Sequelize[_0x4e69('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4e69('0x5')](_0x4e69('0x6'),_0x4e69('0x7'),_0x4e69('0x8'))}}; \ No newline at end of file +var _0xf0ad=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x524bf9,_0x47462b){var _0x550148=function(_0x1589b1){while(--_0x1589b1){_0x524bf9['push'](_0x524bf9['shift']());}};_0x550148(++_0x47462b);}(_0xf0ad,0xfd));var _0xdf0a=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xf0ad[_0xd1c39b];return _0x58f5bc;};'use strict';var Sequelize=require(_0xdf0a('0x0'));module[_0xdf0a('0x1')]={'name':{'type':Sequelize[_0xdf0a('0x2')],'unique':_0xdf0a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdf0a('0x2')]},'timeout':{'type':Sequelize[_0xdf0a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdf0a('0x5')](_0xdf0a('0x6'),_0xdf0a('0x7'),_0xdf0a('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a7c213e..558f466 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 _0x35e2=['filter','include','findAll','catch','show','params','keys','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','body','describe','getMembers','UserSmsQueue','User','UserId','updatedAt','createdAt','rows','SIP','smsPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','sequelize','each','forEach','userSmsQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x54a49d,_0x1343b7){var _0x516b4b=function(_0x5bd362){while(--_0x5bd362){_0x54a49d['push'](_0x54a49d['shift']());}};_0x516b4b(++_0x1343b7);}(_0x35e2,0x1d1));var _0x235e=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x35e2[_0x15bc81];return _0x59440e;};'use strict';var pdf=require(_0x235e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x235e('0x1'));var zipdir=require(_0x235e('0x2'));var jsonpatch=require(_0x235e('0x3'));var rp=require(_0x235e('0x4'));var moment=require(_0x235e('0x5'));var BPromise=require(_0x235e('0x6'));var Mustache=require(_0x235e('0x7'));var util=require(_0x235e('0x8'));var path=require(_0x235e('0x9'));var sox=require(_0x235e('0xa'));var csv=require(_0x235e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x235e('0xc'));var jsforce=require(_0x235e('0xd'));var deskjs=require(_0x235e('0xe'));var toCsv=require(_0x235e('0xb'));var querystring=require(_0x235e('0xf'));var Papa=require(_0x235e('0x10'));var Redis=require(_0x235e('0x11'));var authService=require(_0x235e('0x12'));var qs=require(_0x235e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x235e('0x14'))(_0x235e('0x15'));var utils=require('../../config/utils');var config=require(_0x235e('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x235e('0x17')](config[_0x235e('0x18')],{'host':_0x235e('0x19'),'port':0x18eb});var socket=require(_0x235e('0x1a'))(new Redis(config[_0x235e('0x18')]));require(_0x235e('0x1b'))[_0x235e('0x1c')](socket);function respondWithStatusCode(_0x398b08,_0x222d39){_0x222d39=_0x222d39||0xcc;return function(_0x2c7f15){if(_0x2c7f15){return _0x398b08[_0x235e('0x1d')](_0x222d39);}return _0x398b08[_0x235e('0x1e')](_0x222d39)[_0x235e('0x1f')]();};}function respondWithResult(_0x3c50a7,_0xcddf21){_0xcddf21=_0xcddf21||0xc8;return function(_0x5a0483){if(_0x5a0483){return _0x3c50a7[_0x235e('0x1e')](_0xcddf21)[_0x235e('0x20')](_0x5a0483);}};}function respondWithFilteredResult(_0x5705fe,_0xc4a4e1){return function(_0xf3aed6){if(_0xf3aed6){var _0x27d1ab=_0xf3aed6[_0x235e('0x21')],_0x5f4e49=_0xc4a4e1[_0x235e('0x22')],_0xb37c8d=_0xc4a4e1[_0x235e('0x22')]+_0xc4a4e1[_0x235e('0x23')],_0x285beb;if(_0xb37c8d>=_0x27d1ab){_0xb37c8d=_0x27d1ab;_0x285beb=0xc8;}else{_0x285beb=0xce;}_0x5705fe[_0x235e('0x1e')](_0x285beb);return _0x5705fe['set'](_0x235e('0x24'),_0x5f4e49+'-'+_0xb37c8d+'/'+_0x27d1ab)[_0x235e('0x20')](_0xf3aed6);}return null;};}function patchUpdates(_0x261bf4){return function(_0x5a5b10){try{jsonpatch['apply'](_0x5a5b10,_0x261bf4,!![]);}catch(_0x4c45aa){return BPromise[_0x235e('0x25')](_0x4c45aa);}return _0x5a5b10['save']();};}function saveUpdates(_0x5f39f5,_0x60789b){return function(_0x27dd33){if(_0x27dd33){return _0x27dd33[_0x235e('0x26')](_0x5f39f5)[_0x235e('0x27')](function(_0x96017c){return _0x96017c;});}return null;};}function removeEntity(_0x194178,_0xf85359){return function(_0x5de2a0){if(_0x5de2a0){return _0x5de2a0['destroy']()[_0x235e('0x27')](function(){var _0x1defcb=_0x5de2a0['get']({'plain':!![]});var _0x2909c2='SmsQueues';return db['UserProfileResource'][_0x235e('0x28')]({'where':{'type':_0x2909c2,'resourceId':_0x1defcb['id']}})['then'](function(){return _0x5de2a0;});})['then'](function(){_0x194178[_0x235e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a67d4,_0xb84b96){return function(_0x3aae5f){if(!_0x3aae5f){_0x3a67d4[_0x235e('0x1d')](0x194);}return _0x3aae5f;};}function handleError(_0x4d913b,_0x51c41d){_0x51c41d=_0x51c41d||0x1f4;return function(_0x3fd041){logger['error'](_0x3fd041[_0x235e('0x29')]);if(_0x3fd041['name']){delete _0x3fd041[_0x235e('0x2a')];}_0x4d913b['status'](_0x51c41d)[_0x235e('0x2b')](_0x3fd041);};}exports['index']=function(_0x1aec5f,_0xd977dc){var _0x4eabbf={},_0x3d9018={},_0x37363a={'count':0x0,'rows':[]};var _0x1ad80c=_[_0x235e('0x2c')](db[_0x235e('0x2d')][_0x235e('0x2e')],function(_0x5ca1dd){return{'name':_0x5ca1dd[_0x235e('0x2f')],'type':_0x5ca1dd[_0x235e('0x30')][_0x235e('0x31')]};});_0x3d9018[_0x235e('0x32')]=_[_0x235e('0x2c')](_0x1ad80c,_0x235e('0x2a'));_0x3d9018[_0x235e('0x33')]=_['keys'](_0x1aec5f[_0x235e('0x33')]);_0x3d9018[_0x235e('0x34')]=_[_0x235e('0x35')](_0x3d9018[_0x235e('0x32')],_0x3d9018[_0x235e('0x33')]);_0x4eabbf[_0x235e('0x36')]=_[_0x235e('0x35')](_0x3d9018['model'],qs['fields'](_0x1aec5f['query'][_0x235e('0x37')]));_0x4eabbf[_0x235e('0x36')]=_0x4eabbf['attributes'][_0x235e('0x38')]?_0x4eabbf[_0x235e('0x36')]:_0x3d9018[_0x235e('0x32')];if(!_0x1aec5f[_0x235e('0x33')][_0x235e('0x39')](_0x235e('0x3a'))){_0x4eabbf[_0x235e('0x23')]=qs[_0x235e('0x23')](_0x1aec5f[_0x235e('0x33')][_0x235e('0x23')]);_0x4eabbf['offset']=qs[_0x235e('0x22')](_0x1aec5f[_0x235e('0x33')][_0x235e('0x22')]);}_0x4eabbf[_0x235e('0x3b')]=qs[_0x235e('0x3c')](_0x1aec5f[_0x235e('0x33')][_0x235e('0x3c')]);_0x4eabbf[_0x235e('0x3d')]=qs[_0x235e('0x34')](_[_0x235e('0x3e')](_0x1aec5f[_0x235e('0x33')],_0x3d9018[_0x235e('0x34')]),_0x1ad80c);if(_0x1aec5f['query'][_0x235e('0x3f')]){_0x4eabbf[_0x235e('0x3d')]=_['merge'](_0x4eabbf[_0x235e('0x3d')],{'$or':_[_0x235e('0x2c')](_0x1ad80c,function(_0x9d3e91){if(_0x9d3e91[_0x235e('0x30')]!=='VIRTUAL'){var _0x5a1529={};_0x5a1529[_0x9d3e91[_0x235e('0x2a')]]={'$like':'%'+_0x1aec5f[_0x235e('0x33')][_0x235e('0x3f')]+'%'};return _0x5a1529;}})});}_0x4eabbf=_['merge']({},_0x4eabbf,_0x1aec5f['options']);var _0x269190={'where':_0x4eabbf[_0x235e('0x3d')]};return db[_0x235e('0x2d')][_0x235e('0x21')](_0x269190)['then'](function(_0x2d7089){_0x37363a['count']=_0x2d7089;if(_0x1aec5f[_0x235e('0x33')]['includeAll']){_0x4eabbf[_0x235e('0x40')]=[{'all':!![]}];}return db[_0x235e('0x2d')][_0x235e('0x41')](_0x4eabbf);})[_0x235e('0x27')](function(_0x3dd313){_0x37363a['rows']=_0x3dd313;return _0x37363a;})['then'](respondWithFilteredResult(_0xd977dc,_0x4eabbf))[_0x235e('0x42')](handleError(_0xd977dc,null));};exports[_0x235e('0x43')]=function(_0x4f2fbc,_0x1c80e3){var _0x19f339={'raw':!![],'where':{'id':_0x4f2fbc[_0x235e('0x44')]['id']}},_0x2bf0b4={};_0x2bf0b4[_0x235e('0x32')]=_[_0x235e('0x45')](db[_0x235e('0x2d')][_0x235e('0x2e')]);_0x2bf0b4[_0x235e('0x33')]=_['keys'](_0x4f2fbc[_0x235e('0x33')]);_0x2bf0b4[_0x235e('0x34')]=_['intersection'](_0x2bf0b4[_0x235e('0x32')],_0x2bf0b4[_0x235e('0x33')]);_0x19f339['attributes']=_[_0x235e('0x35')](_0x2bf0b4[_0x235e('0x32')],qs['fields'](_0x4f2fbc['query'][_0x235e('0x37')]));_0x19f339[_0x235e('0x36')]=_0x19f339[_0x235e('0x36')]['length']?_0x19f339[_0x235e('0x36')]:_0x2bf0b4[_0x235e('0x32')];if(_0x4f2fbc[_0x235e('0x33')][_0x235e('0x46')]){_0x19f339['include']=[{'all':!![]}];}_0x19f339=_[_0x235e('0x47')]({},_0x19f339,_0x4f2fbc[_0x235e('0x48')]);return db[_0x235e('0x2d')][_0x235e('0x49')](_0x19f339)[_0x235e('0x27')](handleEntityNotFound(_0x1c80e3,null))[_0x235e('0x27')](respondWithResult(_0x1c80e3,null))[_0x235e('0x42')](handleError(_0x1c80e3,null));};exports[_0x235e('0x4a')]=function(_0x15e162,_0x1ddf34){return db[_0x235e('0x2d')][_0x235e('0x4a')](_0x15e162['body'],{})['then'](function(_0x1c5f24){var _0xd8aad=_0x15e162['user']['get']({'plain':!![]});if(!_0xd8aad)throw new Error(_0x235e('0x4b'));if(_0xd8aad[_0x235e('0x4c')]==='user'){var _0x39a23a=_0x1c5f24[_0x235e('0x4d')]({'plain':!![]});var _0x3c975b='SmsQueues';return db[_0x235e('0x4e')][_0x235e('0x49')]({'where':{'name':_0x3c975b,'userProfileId':_0xd8aad[_0x235e('0x4f')]},'raw':!![]})[_0x235e('0x27')](function(_0x5d9abd){if(_0x5d9abd&&_0x5d9abd[_0x235e('0x50')]===0x0){return db['UserProfileResource'][_0x235e('0x4a')]({'name':_0x39a23a[_0x235e('0x2a')],'resourceId':_0x39a23a['id'],'type':_0x5d9abd['name'],'sectionId':_0x5d9abd['id']},{})[_0x235e('0x27')](function(){return _0x1c5f24;});}else{return _0x1c5f24;}})[_0x235e('0x42')](function(_0x11eccf){logger[_0x235e('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11eccf);throw _0x11eccf;});}return _0x1c5f24;})[_0x235e('0x27')](respondWithResult(_0x1ddf34,0xc9))['catch'](handleError(_0x1ddf34,null));};exports[_0x235e('0x26')]=function(_0x57b9de,_0x529451){if(_0x57b9de[_0x235e('0x52')]['id']){delete _0x57b9de['body']['id'];}return db[_0x235e('0x2d')][_0x235e('0x49')]({'where':{'id':_0x57b9de[_0x235e('0x44')]['id']}})[_0x235e('0x27')](handleEntityNotFound(_0x529451,null))[_0x235e('0x27')](saveUpdates(_0x57b9de['body'],null))[_0x235e('0x27')](respondWithResult(_0x529451,null))[_0x235e('0x42')](handleError(_0x529451,null));};exports['destroy']=function(_0x496ad6,_0x2b20e1){return db[_0x235e('0x2d')][_0x235e('0x49')]({'where':{'id':_0x496ad6[_0x235e('0x44')]['id']}})[_0x235e('0x27')](handleEntityNotFound(_0x2b20e1,null))[_0x235e('0x27')](removeEntity(_0x2b20e1,null))[_0x235e('0x42')](handleError(_0x2b20e1,null));};exports[_0x235e('0x53')]=function(_0x1c35f8,_0x4a3d64){return db[_0x235e('0x2d')][_0x235e('0x53')]()[_0x235e('0x27')](respondWithResult(_0x4a3d64,null))['catch'](handleError(_0x4a3d64,null));};exports[_0x235e('0x54')]=function(_0x290e71,_0x49305d,_0x39a52f){var _0x2e9a0e={'raw':!![],'where':{}},_0x2c3aa8={},_0x4b1fb6;return db['SmsQueue']['findOne']({'where':{'id':_0x290e71[_0x235e('0x44')]['id']}})[_0x235e('0x27')](handleEntityNotFound(_0x49305d,null))[_0x235e('0x27')](function(_0x2f7c85){if(_0x2f7c85){_0x4b1fb6=_0x2f7c85[_0x235e('0x4d')]({'plain':!![]});_0x2c3aa8['model']=_[_0x235e('0x45')](db[_0x235e('0x55')][_0x235e('0x2e')]);_0x2c3aa8[_0x235e('0x33')]=_['keys'](_0x290e71[_0x235e('0x33')]);_0x2c3aa8[_0x235e('0x34')]=_['intersection'](_0x2c3aa8[_0x235e('0x32')],_0x2c3aa8[_0x235e('0x33')]);_0x2e9a0e[_0x235e('0x36')]=_[_0x235e('0x35')](_0x2c3aa8[_0x235e('0x32')],qs[_0x235e('0x37')](_0x290e71['query'][_0x235e('0x37')]));_0x2e9a0e[_0x235e('0x36')]=_0x2e9a0e[_0x235e('0x36')][_0x235e('0x38')]?_0x2e9a0e[_0x235e('0x36')]:_0x2c3aa8[_0x235e('0x32')];if(!_0x290e71[_0x235e('0x33')]['hasOwnProperty'](_0x235e('0x3a'))){_0x2e9a0e['limit']=qs[_0x235e('0x23')](_0x290e71[_0x235e('0x33')][_0x235e('0x23')]);_0x2e9a0e[_0x235e('0x22')]=qs[_0x235e('0x22')](_0x290e71[_0x235e('0x33')][_0x235e('0x22')]);}_0x2e9a0e[_0x235e('0x3b')]=qs[_0x235e('0x3c')](_0x290e71['query'][_0x235e('0x3c')]);_0x2e9a0e[_0x235e('0x3d')]=qs['filters'](_['pick'](_0x290e71['query'],_0x2c3aa8[_0x235e('0x34')]));_0x2e9a0e[_0x235e('0x3d')]['SmsQueueId']=_0x2f7c85['id'];if(_0x290e71[_0x235e('0x33')][_0x235e('0x3f')]){_0x2e9a0e['where']=_[_0x235e('0x47')](_0x2e9a0e[_0x235e('0x3d')],{'$or':_[_0x235e('0x2c')](_0x2e9a0e['attributes'],function(_0x5d003a){var _0x57e0b4={};_0x57e0b4[_0x5d003a]={'$like':'%'+_0x290e71[_0x235e('0x33')]['filter']+'%'};return _0x57e0b4;})});}_0x2e9a0e=_[_0x235e('0x47')]({},_0x2e9a0e,_0x290e71[_0x235e('0x48')]);return db[_0x235e('0x55')][_0x235e('0x41')](_0x2e9a0e);}})[_0x235e('0x27')](function(_0x32ce87){if(_0x32ce87){return db[_0x235e('0x56')]['findAndCountAll']({'where':{'id':_['map'](_0x32ce87,_0x235e('0x57')),'role':'agent'},'attributes':['id','name','smsPause',_0x235e('0x58'),_0x235e('0x59')]});}})[_0x235e('0x27')](function(_0x5220e2){if(_0x5220e2){return{'count':_0x5220e2[_0x235e('0x21')],'rows':_[_0x235e('0x2c')](_0x5220e2[_0x235e('0x5a')],function(_0x2a90ec){return{'membername':_0x2a90ec['name'],'UserId':_0x2a90ec['id'],'queue_name':_0x4b1fb6[_0x235e('0x2a')],'SmsQueueId':_0x4b1fb6['id'],'interface':util['format']('%s/%s',_0x235e('0x5b'),_0x2a90ec['name']),'penalty':0x0,'paused':_0x2a90ec[_0x235e('0x5c')],'createdAt':_0x2a90ec[_0x235e('0x59')],'updatedAt':_0x2a90ec[_0x235e('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x235e('0x27')](respondWithFilteredResult(_0x49305d,_0x2e9a0e))[_0x235e('0x42')](handleError(_0x49305d,null));};exports[_0x235e('0x5d')]=function(_0x2cfbe6,_0x57bdfc,_0x439c80){var _0x51f301={};var _0x5cd515={};var _0x5a8207;var _0x3fb751;return db['SmsQueue'][_0x235e('0x5e')]({'where':{'id':_0x2cfbe6[_0x235e('0x44')]['id']}})[_0x235e('0x27')](handleEntityNotFound(_0x57bdfc,null))[_0x235e('0x27')](function(_0xa0b29e){if(_0xa0b29e){_0x5a8207=_0xa0b29e;_0x5cd515[_0x235e('0x32')]=_[_0x235e('0x45')](db[_0x235e('0x5f')][_0x235e('0x2e')]);_0x5cd515[_0x235e('0x33')]=_[_0x235e('0x45')](_0x2cfbe6[_0x235e('0x33')]);_0x5cd515[_0x235e('0x34')]=_[_0x235e('0x35')](_0x5cd515[_0x235e('0x32')],_0x5cd515[_0x235e('0x33')]);_0x51f301['attributes']=_[_0x235e('0x35')](_0x5cd515['model'],qs[_0x235e('0x37')](_0x2cfbe6[_0x235e('0x33')][_0x235e('0x37')]));_0x51f301[_0x235e('0x36')]=_0x51f301[_0x235e('0x36')][_0x235e('0x38')]?_0x51f301[_0x235e('0x36')]:_0x5cd515[_0x235e('0x32')];_0x51f301[_0x235e('0x3b')]=qs[_0x235e('0x3c')](_0x2cfbe6[_0x235e('0x33')][_0x235e('0x3c')]);_0x51f301[_0x235e('0x3d')]=qs[_0x235e('0x34')](_[_0x235e('0x3e')](_0x2cfbe6[_0x235e('0x33')],_0x5cd515[_0x235e('0x34')]));if(_0x2cfbe6[_0x235e('0x33')][_0x235e('0x3f')]){_0x51f301[_0x235e('0x3d')]=_[_0x235e('0x47')](_0x51f301['where'],{'$or':_[_0x235e('0x2c')](_0x51f301[_0x235e('0x36')],function(_0x425250){var _0xdd4e3f={};_0xdd4e3f[_0x425250]={'$like':'%'+_0x2cfbe6[_0x235e('0x33')]['filter']+'%'};return _0xdd4e3f;})});}_0x51f301=_[_0x235e('0x47')]({},_0x51f301,_0x2cfbe6[_0x235e('0x48')]);return _0x5a8207[_0x235e('0x5d')](_0x51f301);}})['then'](function(_0x49ca94){if(_0x49ca94){_0x3fb751=_0x49ca94['length'];if(!_0x2cfbe6[_0x235e('0x33')][_0x235e('0x39')](_0x235e('0x3a'))){_0x51f301[_0x235e('0x23')]=qs[_0x235e('0x23')](_0x2cfbe6[_0x235e('0x33')]['limit']);_0x51f301[_0x235e('0x22')]=qs['offset'](_0x2cfbe6['query']['offset']);}return _0x5a8207[_0x235e('0x5d')](_0x51f301);}})[_0x235e('0x27')](function(_0x4244eb){if(_0x4244eb){return _0x4244eb?{'count':_0x3fb751,'rows':_0x4244eb}:null;}})[_0x235e('0x27')](respondWithResult(_0x57bdfc,null))[_0x235e('0x42')](handleError(_0x57bdfc,null));};exports[_0x235e('0x60')]=function(_0x46ae2d,_0x4ab5cc,_0x89ae88){var _0x30d5ac=_0x46ae2d['body'][_0x235e('0x61')];return db[_0x235e('0x5f')][_0x235e('0x41')]({'where':{'id':_0x30d5ac},'attributes':['id'],'include':[{'model':db[_0x235e('0x56')],'as':_0x235e('0x62'),'attributes':['id',_0x235e('0x2a'),_0x235e('0x63'),_0x235e('0x64'),'interface'],'raw':!![]}]})[_0x235e('0x27')](function(_0x1fa3da){if(_0x1fa3da){var _0xcbe48f=_['flatMap'](_0x1fa3da,function(_0x319b07){var _0x1bd202=_0x319b07['get']({'plain':!![]});return _0x1bd202[_0x235e('0x62')];});return db[_0x235e('0x2d')][_0x235e('0x49')]({'where':{'id':_0x46ae2d[_0x235e('0x44')]['id']}})[_0x235e('0x27')](function(_0x550294){return db[_0x235e('0x65')]['transaction'](function(_0x46689e){return _0x550294[_0x235e('0x60')](_0x30d5ac,{'transaction':_0x46689e})['then'](function(){return BPromise[_0x235e('0x66')](_0xcbe48f,function(_0x2cb783){return db[_0x235e('0x55')]['findOrCreate']({'where':{'UserId':_0x2cb783['id'],'SmsQueueId':_0x46ae2d[_0x235e('0x44')]['id']},'transaction':_0x46689e});});})[_0x235e('0x27')](function(){_0xcbe48f[_0x235e('0x67')](function(_0x47f9b3){socket['emit'](_0x235e('0x68'),{'UserId':_0x47f9b3['id'],'SmsQueueId':_0x550294['id']});});});});});}})[_0x235e('0x27')](respondWithStatusCode(_0x4ab5cc,null))['catch'](handleError(_0x4ab5cc,null));};exports[_0x235e('0x69')]=function(_0x6551ba,_0x390833,_0x3a66ec){return db['Team'][_0x235e('0x41')]({'where':{'id':_0x6551ba[_0x235e('0x33')][_0x235e('0x61')]},'attributes':['id'],'include':[{'model':db[_0x235e('0x56')],'as':_0x235e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x235e('0x27')](handleEntityNotFound(_0x390833,null))['then'](function(_0x51ba7c){var _0x5c8c4c=_[_0x235e('0x2c')](_0x51ba7c,'id');var _0x2da7e9=[];var _0x281f9c=[];var _0x2bc483=squel[_0x235e('0x6a')]();_0x2bc483[_0x235e('0x6b')]('tq.TeamId')[_0x235e('0x6c')]('team_has_sms_queues','tq')[_0x235e('0x6d')](_0x235e('0x6e'),'ut',_0x235e('0x6f'))['where'](_0x235e('0x70'),_0x6551ba[_0x235e('0x44')]['id']);for(var _0x58fb31=0x0;_0x58fb31<_0x51ba7c[_0x235e('0x38')];_0x58fb31+=0x1){let _0xb90946=_0x51ba7c[_0x58fb31];for(var _0x493c01=0x0;_0x493c01<_0xb90946[_0x235e('0x62')][_0x235e('0x38')];_0x493c01+=0x1){let _0xd58b14=_0xb90946[_0x235e('0x62')][_0x493c01];var _0x57646f=_0x2bc483[_0x235e('0x71')]();_0x57646f['where']('ut.UserId\x20=\x20?',_0xd58b14['id']);_0x281f9c[_0x235e('0x72')](db['sequelize'][_0x235e('0x33')](_0x57646f[_0x235e('0x73')](),{'type':db[_0x235e('0x65')][_0x235e('0x74')][_0x235e('0x75')]})['then'](function(_0x154647){if(_0x154647['length']===0x1){return _0xd58b14['id'];}else{var _0x3f66a8=_[_0x235e('0x76')](_[_0x235e('0x2c')](_0x154647,_0x235e('0x77')),function(_0x12831c){return _[_0x235e('0x78')](_0x5c8c4c,_0x12831c);});if(_0x3f66a8){return _0xd58b14['id'];}}}));}}return BPromise[_0x235e('0x79')](_0x281f9c)[_0x235e('0x27')](function(_0x164441){_0x2da7e9=_(_0x2da7e9)[_0x235e('0x7a')](_0x164441)[_0x235e('0x7b')]()['value']();return db['SmsQueue'][_0x235e('0x49')]({'where':{'id':_0x6551ba[_0x235e('0x44')]['id']}})['then'](function(_0x51a264){return db[_0x235e('0x65')][_0x235e('0x7c')](function(_0x9fd8a2){return _0x51a264[_0x235e('0x69')](_0x6551ba['query'][_0x235e('0x61')],{'transaction':_0x9fd8a2})[_0x235e('0x27')](function(){if(!_[_0x235e('0x7d')](_0x2da7e9)){return _0x51a264['removeAgents'](_0x2da7e9,{'transaction':_0x9fd8a2});}})[_0x235e('0x27')](function(){_0x2da7e9['forEach'](function(_0x5590df){socket[_0x235e('0x7e')](_0x235e('0x7f'),{'UserId':_0x5590df,'SmsQueueId':_0x51a264['id']});});});});});});})[_0x235e('0x27')](respondWithStatusCode(_0x390833,null))[_0x235e('0x42')](handleError(_0x390833,null));};exports[_0x235e('0x80')]=function(_0x904157,_0xb3a8ed,_0x323bc1){return db[_0x235e('0x2d')][_0x235e('0x49')]({'where':{'id':_0x904157[_0x235e('0x44')]['id']}})[_0x235e('0x27')](handleEntityNotFound(_0xb3a8ed,null))['then'](function(_0xb43d9c){if(_0xb43d9c){return _0xb43d9c[_0x235e('0x80')](_0x904157[_0x235e('0x52')]['ids'],_['omit'](_0x904157[_0x235e('0x52')],[_0x235e('0x61'),'id'])||{})['spread'](function(_0x181b96){for(var _0x331cf4=0x0;_0x331cf4<_0x904157[_0x235e('0x52')][_0x235e('0x61')]['length'];_0x331cf4+=0x1){socket[_0x235e('0x7e')](_0x235e('0x68'),{'UserId':_0x904157[_0x235e('0x52')][_0x235e('0x61')][_0x331cf4],'SmsQueueId':_0x904157[_0x235e('0x44')]['id']});}return _0x181b96;});}})[_0x235e('0x27')](respondWithResult(_0xb3a8ed,null))[_0x235e('0x42')](handleError(_0xb3a8ed,null));};exports['removeAgents']=function(_0x29ee66,_0x2bb326,_0x2d6106){return db[_0x235e('0x2d')]['find']({'where':{'id':_0x29ee66['params']['id']}})[_0x235e('0x27')](handleEntityNotFound(_0x2bb326,null))[_0x235e('0x27')](function(_0x16bc85){if(_0x16bc85){return _0x16bc85[_0x235e('0x81')](_0x29ee66[_0x235e('0x33')]['ids'])[_0x235e('0x27')](function(){if(_[_0x235e('0x82')](_0x29ee66['query']['ids'])){for(var _0x382b26=0x0;_0x382b26<_0x29ee66[_0x235e('0x33')][_0x235e('0x61')]['length'];_0x382b26+=0x1){socket[_0x235e('0x7e')](_0x235e('0x7f'),{'UserId':Number(_0x29ee66[_0x235e('0x33')][_0x235e('0x61')][_0x382b26]),'SmsQueueId':Number(_0x29ee66['params']['id'])});}}else{socket[_0x235e('0x7e')](_0x235e('0x7f'),{'UserId':Number(_0x29ee66[_0x235e('0x33')]['ids']),'SmsQueueId':Number(_0x29ee66[_0x235e('0x44')]['id'])});}});}})[_0x235e('0x27')](respondWithStatusCode(_0x2bb326,null))[_0x235e('0x42')](handleError(_0x2bb326,null));};exports[_0x235e('0x83')]=function(_0x4c6f34,_0x29608d,_0x1139de){var _0x1c8102={};var _0x31bfdc={};var _0xc64eae;var _0x1757ea;return db[_0x235e('0x2d')][_0x235e('0x5e')]({'where':{'id':_0x4c6f34[_0x235e('0x44')]['id']}})[_0x235e('0x27')](handleEntityNotFound(_0x29608d,null))[_0x235e('0x27')](function(_0x2f0dd9){if(_0x2f0dd9){_0xc64eae=_0x2f0dd9;_0x31bfdc[_0x235e('0x32')]=_[_0x235e('0x45')](db[_0x235e('0x56')][_0x235e('0x2e')]);_0x31bfdc['query']=_[_0x235e('0x45')](_0x4c6f34[_0x235e('0x33')]);_0x31bfdc[_0x235e('0x34')]=_[_0x235e('0x35')](_0x31bfdc['model'],_0x31bfdc[_0x235e('0x33')]);_0x1c8102[_0x235e('0x36')]=_[_0x235e('0x35')](_0x31bfdc['model'],qs[_0x235e('0x37')](_0x4c6f34[_0x235e('0x33')][_0x235e('0x37')]));_0x1c8102[_0x235e('0x36')]=_0x1c8102[_0x235e('0x36')][_0x235e('0x38')]?_0x1c8102[_0x235e('0x36')]:_0x31bfdc[_0x235e('0x32')];_0x1c8102[_0x235e('0x3b')]=qs[_0x235e('0x3c')](_0x4c6f34[_0x235e('0x33')][_0x235e('0x3c')]);_0x1c8102[_0x235e('0x3d')]=qs[_0x235e('0x34')](_[_0x235e('0x3e')](_0x4c6f34[_0x235e('0x33')],_0x31bfdc[_0x235e('0x34')]));if(_0x4c6f34[_0x235e('0x33')][_0x235e('0x3f')]){_0x1c8102['where']=_[_0x235e('0x47')](_0x1c8102[_0x235e('0x3d')],{'$or':_[_0x235e('0x2c')](_0x1c8102[_0x235e('0x36')],function(_0x51c17b){var _0x20039a={};_0x20039a[_0x51c17b]={'$like':'%'+_0x4c6f34[_0x235e('0x33')][_0x235e('0x3f')]+'%'};return _0x20039a;})});}_0x1c8102=_[_0x235e('0x47')]({},_0x1c8102,_0x4c6f34[_0x235e('0x48')]);return _0xc64eae[_0x235e('0x83')](_0x1c8102);}})[_0x235e('0x27')](function(_0x1de652){if(_0x1de652){_0x1757ea=_0x1de652[_0x235e('0x38')];if(!_0x4c6f34[_0x235e('0x33')]['hasOwnProperty'](_0x235e('0x3a'))){_0x1c8102[_0x235e('0x23')]=qs['limit'](_0x4c6f34[_0x235e('0x33')][_0x235e('0x23')]);_0x1c8102[_0x235e('0x22')]=qs[_0x235e('0x22')](_0x4c6f34[_0x235e('0x33')][_0x235e('0x22')]);}return _0xc64eae[_0x235e('0x83')](_0x1c8102);}})['then'](function(_0xbf3d8e){if(_0xbf3d8e){return _0xbf3d8e?{'count':_0x1757ea,'rows':_0xbf3d8e}:null;}})[_0x235e('0x27')](respondWithResult(_0x29608d,null))['catch'](handleError(_0x29608d,null));}; \ No newline at end of file +var _0x449d=['removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./smsQueue.socket','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','map','SmsQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','count','includeAll','findAll','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','error','describe','order','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','rows','%s/%s','createdAt','getTeams','findOne','pick','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','userSmsQueue:save','removeTeams','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','forEach','emit','userSmsQueue:remove','addAgents','omit'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x449d,0x8a));var _0xd449=function(_0x508786,_0x26e090){_0x508786=_0x508786-0x0;var _0x2c9780=_0x449d[_0x508786];return _0x2c9780;};'use strict';var pdf=require(_0xd449('0x0'));var emlformat=require(_0xd449('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd449('0x2'));var jsonpatch=require(_0xd449('0x3'));var rp=require(_0xd449('0x4'));var moment=require(_0xd449('0x5'));var BPromise=require(_0xd449('0x6'));var Mustache=require(_0xd449('0x7'));var util=require(_0xd449('0x8'));var path=require('path');var sox=require(_0xd449('0x9'));var csv=require(_0xd449('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd449('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd449('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd449('0xa'));var querystring=require('querystring');var Papa=require(_0xd449('0xd'));var Redis=require(_0xd449('0xe'));var authService=require(_0xd449('0xf'));var qs=require(_0xd449('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd449('0x11'))(_0xd449('0x12'));var utils=require('../../config/utils');var config=require(_0xd449('0x13'));var db=require(_0xd449('0x14'))['db'];config[_0xd449('0x15')]=_['defaults'](config['redis'],{'host':_0xd449('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd449('0x15')]));require(_0xd449('0x17'))['register'](socket);function respondWithStatusCode(_0x236b7c,_0x43dc63){_0x43dc63=_0x43dc63||0xcc;return function(_0x13da9e){if(_0x13da9e){return _0x236b7c[_0xd449('0x18')](_0x43dc63);}return _0x236b7c[_0xd449('0x19')](_0x43dc63)[_0xd449('0x1a')]();};}function respondWithResult(_0x393865,_0x11bb55){_0x11bb55=_0x11bb55||0xc8;return function(_0x2efb75){if(_0x2efb75){return _0x393865['status'](_0x11bb55)[_0xd449('0x1b')](_0x2efb75);}};}function respondWithFilteredResult(_0x5646f3,_0x3004e3){return function(_0x493a7a){if(_0x493a7a){var _0x5cdaa0=_0x493a7a['count'],_0x11a71c=_0x3004e3[_0xd449('0x1c')],_0x9f2434=_0x3004e3[_0xd449('0x1c')]+_0x3004e3['limit'],_0x2e3db4;if(_0x9f2434>=_0x5cdaa0){_0x9f2434=_0x5cdaa0;_0x2e3db4=0xc8;}else{_0x2e3db4=0xce;}_0x5646f3[_0xd449('0x19')](_0x2e3db4);return _0x5646f3[_0xd449('0x1d')](_0xd449('0x1e'),_0x11a71c+'-'+_0x9f2434+'/'+_0x5cdaa0)['json'](_0x493a7a);}return null;};}function patchUpdates(_0x4bf286){return function(_0x1733bf){try{jsonpatch[_0xd449('0x1f')](_0x1733bf,_0x4bf286,!![]);}catch(_0x3beb88){return BPromise[_0xd449('0x20')](_0x3beb88);}return _0x1733bf[_0xd449('0x21')]();};}function saveUpdates(_0x7c7db9,_0x53ced5){return function(_0x1bb550){if(_0x1bb550){return _0x1bb550[_0xd449('0x22')](_0x7c7db9)[_0xd449('0x23')](function(_0x3b0c0f){return _0x3b0c0f;});}return null;};}function removeEntity(_0xe3d936,_0x33ec0d){return function(_0x27836d){if(_0x27836d){return _0x27836d[_0xd449('0x24')]()[_0xd449('0x23')](function(){var _0x45b3df=_0x27836d[_0xd449('0x25')]({'plain':!![]});var _0x22ddb2='SmsQueues';return db[_0xd449('0x26')][_0xd449('0x24')]({'where':{'type':_0x22ddb2,'resourceId':_0x45b3df['id']}})['then'](function(){return _0x27836d;});})['then'](function(){_0xe3d936[_0xd449('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f7fb9,_0x241fdc){return function(_0x28a866){if(!_0x28a866){_0x3f7fb9[_0xd449('0x18')](0x194);}return _0x28a866;};}function handleError(_0x397a94,_0x70fed0){_0x70fed0=_0x70fed0||0x1f4;return function(_0x4bc0c7){logger['error'](_0x4bc0c7['stack']);if(_0x4bc0c7[_0xd449('0x27')]){delete _0x4bc0c7[_0xd449('0x27')];}_0x397a94[_0xd449('0x19')](_0x70fed0)[_0xd449('0x28')](_0x4bc0c7);};}exports[_0xd449('0x29')]=function(_0x121d91,_0x1eb131){var _0x464f9f={},_0x2a0f2f={},_0x2c7dc0={'count':0x0,'rows':[]};var _0x81537e=_[_0xd449('0x2a')](db[_0xd449('0x2b')][_0xd449('0x2c')],function(_0x177184){return{'name':_0x177184['fieldName'],'type':_0x177184[_0xd449('0x2d')][_0xd449('0x2e')]};});_0x2a0f2f[_0xd449('0x2f')]=_[_0xd449('0x2a')](_0x81537e,_0xd449('0x27'));_0x2a0f2f['query']=_[_0xd449('0x30')](_0x121d91[_0xd449('0x31')]);_0x2a0f2f[_0xd449('0x32')]=_[_0xd449('0x33')](_0x2a0f2f[_0xd449('0x2f')],_0x2a0f2f[_0xd449('0x31')]);_0x464f9f[_0xd449('0x34')]=_[_0xd449('0x33')](_0x2a0f2f['model'],qs[_0xd449('0x35')](_0x121d91[_0xd449('0x31')][_0xd449('0x35')]));_0x464f9f[_0xd449('0x34')]=_0x464f9f[_0xd449('0x34')][_0xd449('0x36')]?_0x464f9f[_0xd449('0x34')]:_0x2a0f2f[_0xd449('0x2f')];if(!_0x121d91[_0xd449('0x31')][_0xd449('0x37')](_0xd449('0x38'))){_0x464f9f[_0xd449('0x39')]=qs[_0xd449('0x39')](_0x121d91[_0xd449('0x31')][_0xd449('0x39')]);_0x464f9f[_0xd449('0x1c')]=qs['offset'](_0x121d91[_0xd449('0x31')][_0xd449('0x1c')]);}_0x464f9f['order']=qs[_0xd449('0x3a')](_0x121d91['query'][_0xd449('0x3a')]);_0x464f9f[_0xd449('0x3b')]=qs[_0xd449('0x32')](_['pick'](_0x121d91[_0xd449('0x31')],_0x2a0f2f[_0xd449('0x32')]),_0x81537e);if(_0x121d91[_0xd449('0x31')][_0xd449('0x3c')]){_0x464f9f[_0xd449('0x3b')]=_[_0xd449('0x3d')](_0x464f9f[_0xd449('0x3b')],{'$or':_[_0xd449('0x2a')](_0x81537e,function(_0x538ace){if(_0x538ace[_0xd449('0x2d')]!=='VIRTUAL'){var _0x212d4e={};_0x212d4e[_0x538ace[_0xd449('0x27')]]={'$like':'%'+_0x121d91[_0xd449('0x31')][_0xd449('0x3c')]+'%'};return _0x212d4e;}})});}_0x464f9f=_[_0xd449('0x3d')]({},_0x464f9f,_0x121d91[_0xd449('0x3e')]);var _0x5a8807={'where':_0x464f9f['where']};return db['SmsQueue']['count'](_0x5a8807)[_0xd449('0x23')](function(_0x5d939d){_0x2c7dc0[_0xd449('0x3f')]=_0x5d939d;if(_0x121d91[_0xd449('0x31')][_0xd449('0x40')]){_0x464f9f['include']=[{'all':!![]}];}return db[_0xd449('0x2b')][_0xd449('0x41')](_0x464f9f);})[_0xd449('0x23')](function(_0x33bdc6){_0x2c7dc0['rows']=_0x33bdc6;return _0x2c7dc0;})[_0xd449('0x23')](respondWithFilteredResult(_0x1eb131,_0x464f9f))[_0xd449('0x42')](handleError(_0x1eb131,null));};exports['show']=function(_0x4966bc,_0x201952){var _0xb0d9ae={'raw':!![],'where':{'id':_0x4966bc[_0xd449('0x43')]['id']}},_0x3bc91c={};_0x3bc91c['model']=_['keys'](db['SmsQueue'][_0xd449('0x2c')]);_0x3bc91c[_0xd449('0x31')]=_['keys'](_0x4966bc[_0xd449('0x31')]);_0x3bc91c[_0xd449('0x32')]=_['intersection'](_0x3bc91c[_0xd449('0x2f')],_0x3bc91c[_0xd449('0x31')]);_0xb0d9ae[_0xd449('0x34')]=_[_0xd449('0x33')](_0x3bc91c[_0xd449('0x2f')],qs[_0xd449('0x35')](_0x4966bc[_0xd449('0x31')][_0xd449('0x35')]));_0xb0d9ae[_0xd449('0x34')]=_0xb0d9ae[_0xd449('0x34')][_0xd449('0x36')]?_0xb0d9ae[_0xd449('0x34')]:_0x3bc91c[_0xd449('0x2f')];if(_0x4966bc[_0xd449('0x31')][_0xd449('0x40')]){_0xb0d9ae['include']=[{'all':!![]}];}_0xb0d9ae=_[_0xd449('0x3d')]({},_0xb0d9ae,_0x4966bc['options']);return db['SmsQueue'][_0xd449('0x44')](_0xb0d9ae)['then'](handleEntityNotFound(_0x201952,null))[_0xd449('0x23')](respondWithResult(_0x201952,null))[_0xd449('0x42')](handleError(_0x201952,null));};exports['create']=function(_0x4e5a3f,_0x45b2b8){return db['SmsQueue'][_0xd449('0x45')](_0x4e5a3f[_0xd449('0x46')],{})[_0xd449('0x23')](function(_0x1ce097){var _0x14816e=_0x4e5a3f['user'][_0xd449('0x25')]({'plain':!![]});if(!_0x14816e)throw new Error(_0xd449('0x47'));if(_0x14816e['role']===_0xd449('0x48')){var _0x4d109e=_0x1ce097[_0xd449('0x25')]({'plain':!![]});var _0x434ff4=_0xd449('0x49');return db[_0xd449('0x4a')][_0xd449('0x44')]({'where':{'name':_0x434ff4,'userProfileId':_0x14816e[_0xd449('0x4b')]},'raw':!![]})[_0xd449('0x23')](function(_0x4d41de){if(_0x4d41de&&_0x4d41de[_0xd449('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x4d109e['name'],'resourceId':_0x4d109e['id'],'type':_0x4d41de[_0xd449('0x27')],'sectionId':_0x4d41de['id']},{})[_0xd449('0x23')](function(){return _0x1ce097;});}else{return _0x1ce097;}})['catch'](function(_0xfaa2b6){logger[_0xd449('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfaa2b6);throw _0xfaa2b6;});}return _0x1ce097;})['then'](respondWithResult(_0x45b2b8,0xc9))[_0xd449('0x42')](handleError(_0x45b2b8,null));};exports[_0xd449('0x22')]=function(_0xb9dc45,_0x101cc5){if(_0xb9dc45[_0xd449('0x46')]['id']){delete _0xb9dc45[_0xd449('0x46')]['id'];}return db['SmsQueue'][_0xd449('0x44')]({'where':{'id':_0xb9dc45[_0xd449('0x43')]['id']}})['then'](handleEntityNotFound(_0x101cc5,null))[_0xd449('0x23')](saveUpdates(_0xb9dc45['body'],null))[_0xd449('0x23')](respondWithResult(_0x101cc5,null))[_0xd449('0x42')](handleError(_0x101cc5,null));};exports[_0xd449('0x24')]=function(_0x56ee33,_0x58b6d8){return db[_0xd449('0x2b')][_0xd449('0x44')]({'where':{'id':_0x56ee33[_0xd449('0x43')]['id']}})[_0xd449('0x23')](handleEntityNotFound(_0x58b6d8,null))[_0xd449('0x23')](removeEntity(_0x58b6d8,null))[_0xd449('0x42')](handleError(_0x58b6d8,null));};exports[_0xd449('0x4e')]=function(_0x12958a,_0x21c95f){return db['SmsQueue'][_0xd449('0x4e')]()[_0xd449('0x23')](respondWithResult(_0x21c95f,null))[_0xd449('0x42')](handleError(_0x21c95f,null));};exports['getMembers']=function(_0x47132c,_0x2585bd,_0x55cdea){var _0x34c6f4={'raw':!![],'where':{}},_0x347bf7={},_0x42fee7;return db[_0xd449('0x2b')]['findOne']({'where':{'id':_0x47132c[_0xd449('0x43')]['id']}})[_0xd449('0x23')](handleEntityNotFound(_0x2585bd,null))['then'](function(_0x4fb41e){if(_0x4fb41e){_0x42fee7=_0x4fb41e['get']({'plain':!![]});_0x347bf7[_0xd449('0x2f')]=_[_0xd449('0x30')](db['UserSmsQueue'][_0xd449('0x2c')]);_0x347bf7[_0xd449('0x31')]=_[_0xd449('0x30')](_0x47132c['query']);_0x347bf7[_0xd449('0x32')]=_[_0xd449('0x33')](_0x347bf7['model'],_0x347bf7[_0xd449('0x31')]);_0x34c6f4[_0xd449('0x34')]=_[_0xd449('0x33')](_0x347bf7[_0xd449('0x2f')],qs['fields'](_0x47132c[_0xd449('0x31')][_0xd449('0x35')]));_0x34c6f4['attributes']=_0x34c6f4[_0xd449('0x34')]['length']?_0x34c6f4[_0xd449('0x34')]:_0x347bf7[_0xd449('0x2f')];if(!_0x47132c[_0xd449('0x31')][_0xd449('0x37')](_0xd449('0x38'))){_0x34c6f4['limit']=qs[_0xd449('0x39')](_0x47132c[_0xd449('0x31')][_0xd449('0x39')]);_0x34c6f4[_0xd449('0x1c')]=qs[_0xd449('0x1c')](_0x47132c[_0xd449('0x31')][_0xd449('0x1c')]);}_0x34c6f4[_0xd449('0x4f')]=qs[_0xd449('0x3a')](_0x47132c[_0xd449('0x31')][_0xd449('0x3a')]);_0x34c6f4[_0xd449('0x3b')]=qs[_0xd449('0x32')](_['pick'](_0x47132c[_0xd449('0x31')],_0x347bf7[_0xd449('0x32')]));_0x34c6f4[_0xd449('0x3b')]['SmsQueueId']=_0x4fb41e['id'];if(_0x47132c[_0xd449('0x31')][_0xd449('0x3c')]){_0x34c6f4[_0xd449('0x3b')]=_[_0xd449('0x3d')](_0x34c6f4[_0xd449('0x3b')],{'$or':_['map'](_0x34c6f4['attributes'],function(_0x1a2f6f){var _0x48c7c3={};_0x48c7c3[_0x1a2f6f]={'$like':'%'+_0x47132c['query'][_0xd449('0x3c')]+'%'};return _0x48c7c3;})});}_0x34c6f4=_[_0xd449('0x3d')]({},_0x34c6f4,_0x47132c[_0xd449('0x3e')]);return db[_0xd449('0x50')]['findAll'](_0x34c6f4);}})['then'](function(_0x14d0f3){if(_0x14d0f3){return db[_0xd449('0x51')][_0xd449('0x52')]({'where':{'id':_[_0xd449('0x2a')](_0x14d0f3,_0xd449('0x53')),'role':_0xd449('0x54')},'attributes':['id',_0xd449('0x27'),_0xd449('0x55'),_0xd449('0x56'),'createdAt']});}})['then'](function(_0x5b4604){if(_0x5b4604){return{'count':_0x5b4604['count'],'rows':_[_0xd449('0x2a')](_0x5b4604[_0xd449('0x57')],function(_0x1d8eb1){return{'membername':_0x1d8eb1[_0xd449('0x27')],'UserId':_0x1d8eb1['id'],'queue_name':_0x42fee7[_0xd449('0x27')],'SmsQueueId':_0x42fee7['id'],'interface':util['format'](_0xd449('0x58'),'SIP',_0x1d8eb1[_0xd449('0x27')]),'penalty':0x0,'paused':_0x1d8eb1[_0xd449('0x55')],'createdAt':_0x1d8eb1[_0xd449('0x59')],'updatedAt':_0x1d8eb1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2585bd,_0x34c6f4))['catch'](handleError(_0x2585bd,null));};exports[_0xd449('0x5a')]=function(_0x10c7c3,_0x5ded69,_0x40d435){var _0x3a2d76={};var _0x3432c4={};var _0x117b74;var _0x1dba12;return db[_0xd449('0x2b')][_0xd449('0x5b')]({'where':{'id':_0x10c7c3['params']['id']}})[_0xd449('0x23')](handleEntityNotFound(_0x5ded69,null))[_0xd449('0x23')](function(_0x5f1662){if(_0x5f1662){_0x117b74=_0x5f1662;_0x3432c4[_0xd449('0x2f')]=_[_0xd449('0x30')](db['Team'][_0xd449('0x2c')]);_0x3432c4[_0xd449('0x31')]=_[_0xd449('0x30')](_0x10c7c3[_0xd449('0x31')]);_0x3432c4[_0xd449('0x32')]=_[_0xd449('0x33')](_0x3432c4[_0xd449('0x2f')],_0x3432c4[_0xd449('0x31')]);_0x3a2d76[_0xd449('0x34')]=_[_0xd449('0x33')](_0x3432c4['model'],qs[_0xd449('0x35')](_0x10c7c3[_0xd449('0x31')][_0xd449('0x35')]));_0x3a2d76[_0xd449('0x34')]=_0x3a2d76['attributes'][_0xd449('0x36')]?_0x3a2d76['attributes']:_0x3432c4[_0xd449('0x2f')];_0x3a2d76[_0xd449('0x4f')]=qs[_0xd449('0x3a')](_0x10c7c3[_0xd449('0x31')]['sort']);_0x3a2d76[_0xd449('0x3b')]=qs['filters'](_[_0xd449('0x5c')](_0x10c7c3['query'],_0x3432c4[_0xd449('0x32')]));if(_0x10c7c3[_0xd449('0x31')][_0xd449('0x3c')]){_0x3a2d76['where']=_[_0xd449('0x3d')](_0x3a2d76[_0xd449('0x3b')],{'$or':_[_0xd449('0x2a')](_0x3a2d76['attributes'],function(_0x176d38){var _0x563422={};_0x563422[_0x176d38]={'$like':'%'+_0x10c7c3[_0xd449('0x31')]['filter']+'%'};return _0x563422;})});}_0x3a2d76=_[_0xd449('0x3d')]({},_0x3a2d76,_0x10c7c3[_0xd449('0x3e')]);return _0x117b74['getTeams'](_0x3a2d76);}})[_0xd449('0x23')](function(_0x4e1032){if(_0x4e1032){_0x1dba12=_0x4e1032['length'];if(!_0x10c7c3[_0xd449('0x31')][_0xd449('0x37')](_0xd449('0x38'))){_0x3a2d76[_0xd449('0x39')]=qs['limit'](_0x10c7c3[_0xd449('0x31')][_0xd449('0x39')]);_0x3a2d76[_0xd449('0x1c')]=qs[_0xd449('0x1c')](_0x10c7c3[_0xd449('0x31')][_0xd449('0x1c')]);}return _0x117b74[_0xd449('0x5a')](_0x3a2d76);}})[_0xd449('0x23')](function(_0x19ec29){if(_0x19ec29){return _0x19ec29?{'count':_0x1dba12,'rows':_0x19ec29}:null;}})[_0xd449('0x23')](respondWithResult(_0x5ded69,null))['catch'](handleError(_0x5ded69,null));};exports[_0xd449('0x5d')]=function(_0x1b5afd,_0x58e884,_0x43f377){var _0x50da21=_0x1b5afd[_0xd449('0x46')][_0xd449('0x5e')];return db[_0xd449('0x5f')][_0xd449('0x41')]({'where':{'id':_0x50da21},'attributes':['id'],'include':[{'model':db[_0xd449('0x51')],'as':_0xd449('0x60'),'attributes':['id','name',_0xd449('0x61'),_0xd449('0x62'),_0xd449('0x63')],'raw':!![]}]})['then'](function(_0x46752f){if(_0x46752f){var _0x2cbd79=_[_0xd449('0x64')](_0x46752f,function(_0x54830d){var _0x55977a=_0x54830d[_0xd449('0x25')]({'plain':!![]});return _0x55977a['Agents'];});return db[_0xd449('0x2b')][_0xd449('0x44')]({'where':{'id':_0x1b5afd['params']['id']}})['then'](function(_0x238e7d){return db['sequelize'][_0xd449('0x65')](function(_0x340d24){return _0x238e7d['addTeams'](_0x50da21,{'transaction':_0x340d24})['then'](function(){return BPromise[_0xd449('0x66')](_0x2cbd79,function(_0x312501){return db[_0xd449('0x50')][_0xd449('0x67')]({'where':{'UserId':_0x312501['id'],'SmsQueueId':_0x1b5afd['params']['id']},'transaction':_0x340d24});});})[_0xd449('0x23')](function(){_0x2cbd79['forEach'](function(_0x28b04a){socket['emit'](_0xd449('0x68'),{'UserId':_0x28b04a['id'],'SmsQueueId':_0x238e7d['id']});});});});});}})[_0xd449('0x23')](respondWithStatusCode(_0x58e884,null))[_0xd449('0x42')](handleError(_0x58e884,null));};exports[_0xd449('0x69')]=function(_0x5802ce,_0x12f124,_0xe28bba){return db[_0xd449('0x5f')][_0xd449('0x41')]({'where':{'id':_0x5802ce[_0xd449('0x31')][_0xd449('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xd449('0x51')],'as':_0xd449('0x60'),'attributes':['id'],'raw':!![]}]})[_0xd449('0x23')](handleEntityNotFound(_0x12f124,null))[_0xd449('0x23')](function(_0x366da2){var _0x3c0b66=_[_0xd449('0x2a')](_0x366da2,'id');var _0x43579c=[];var _0x42d5f4=[];var _0xf10fc6=squel['select']();_0xf10fc6['field'](_0xd449('0x6a'))[_0xd449('0x6b')](_0xd449('0x6c'),'tq')[_0xd449('0x6d')](_0xd449('0x6e'),'ut',_0xd449('0x6f'))[_0xd449('0x3b')](_0xd449('0x70'),_0x5802ce['params']['id']);for(var _0x55cb7c=0x0;_0x55cb7c<_0x366da2[_0xd449('0x36')];_0x55cb7c+=0x1){let _0x4eb3e0=_0x366da2[_0x55cb7c];for(var _0x1fe610=0x0;_0x1fe610<_0x4eb3e0[_0xd449('0x60')][_0xd449('0x36')];_0x1fe610+=0x1){let _0x2f36c1=_0x4eb3e0['Agents'][_0x1fe610];var _0x447d82=_0xf10fc6[_0xd449('0x71')]();_0x447d82[_0xd449('0x3b')](_0xd449('0x72'),_0x2f36c1['id']);_0x42d5f4[_0xd449('0x73')](db[_0xd449('0x74')]['query'](_0x447d82[_0xd449('0x75')](),{'type':db[_0xd449('0x74')][_0xd449('0x76')][_0xd449('0x77')]})[_0xd449('0x23')](function(_0x3b0558){if(_0x3b0558[_0xd449('0x36')]===0x1){return _0x2f36c1['id'];}else{var _0x1b68b7=_['every'](_['map'](_0x3b0558,_0xd449('0x78')),function(_0x2c9d30){return _[_0xd449('0x79')](_0x3c0b66,_0x2c9d30);});if(_0x1b68b7){return _0x2f36c1['id'];}}}));}}return BPromise[_0xd449('0x7a')](_0x42d5f4)[_0xd449('0x23')](function(_0x24920f){_0x43579c=_(_0x43579c)[_0xd449('0x7b')](_0x24920f)[_0xd449('0x7c')]()[_0xd449('0x7d')]();return db[_0xd449('0x2b')][_0xd449('0x44')]({'where':{'id':_0x5802ce['params']['id']}})['then'](function(_0x44e0f6){return db[_0xd449('0x74')][_0xd449('0x65')](function(_0x39d129){return _0x44e0f6[_0xd449('0x69')](_0x5802ce[_0xd449('0x31')][_0xd449('0x5e')],{'transaction':_0x39d129})[_0xd449('0x23')](function(){if(!_[_0xd449('0x7e')](_0x43579c)){return _0x44e0f6['removeAgents'](_0x43579c,{'transaction':_0x39d129});}})['then'](function(){_0x43579c[_0xd449('0x7f')](function(_0x174fb4){socket[_0xd449('0x80')](_0xd449('0x81'),{'UserId':_0x174fb4,'SmsQueueId':_0x44e0f6['id']});});});});});});})[_0xd449('0x23')](respondWithStatusCode(_0x12f124,null))[_0xd449('0x42')](handleError(_0x12f124,null));};exports[_0xd449('0x82')]=function(_0x361d05,_0x2c68e0,_0x533435){return db[_0xd449('0x2b')][_0xd449('0x44')]({'where':{'id':_0x361d05[_0xd449('0x43')]['id']}})[_0xd449('0x23')](handleEntityNotFound(_0x2c68e0,null))[_0xd449('0x23')](function(_0x491940){if(_0x491940){return _0x491940[_0xd449('0x82')](_0x361d05['body'][_0xd449('0x5e')],_[_0xd449('0x83')](_0x361d05[_0xd449('0x46')],[_0xd449('0x5e'),'id'])||{})['spread'](function(_0x121eb1){for(var _0x5220a2=0x0;_0x5220a2<_0x361d05[_0xd449('0x46')]['ids'][_0xd449('0x36')];_0x5220a2+=0x1){socket['emit'](_0xd449('0x68'),{'UserId':_0x361d05['body']['ids'][_0x5220a2],'SmsQueueId':_0x361d05['params']['id']});}return _0x121eb1;});}})[_0xd449('0x23')](respondWithResult(_0x2c68e0,null))['catch'](handleError(_0x2c68e0,null));};exports[_0xd449('0x84')]=function(_0x2a6772,_0x48cab6,_0x6cf269){return db[_0xd449('0x2b')][_0xd449('0x44')]({'where':{'id':_0x2a6772['params']['id']}})['then'](handleEntityNotFound(_0x48cab6,null))[_0xd449('0x23')](function(_0x465d29){if(_0x465d29){return _0x465d29[_0xd449('0x84')](_0x2a6772['query'][_0xd449('0x5e')])[_0xd449('0x23')](function(){if(_[_0xd449('0x85')](_0x2a6772['query']['ids'])){for(var _0xb45147=0x0;_0xb45147<_0x2a6772[_0xd449('0x31')][_0xd449('0x5e')][_0xd449('0x36')];_0xb45147+=0x1){socket[_0xd449('0x80')](_0xd449('0x81'),{'UserId':Number(_0x2a6772[_0xd449('0x31')][_0xd449('0x5e')][_0xb45147]),'SmsQueueId':Number(_0x2a6772[_0xd449('0x43')]['id'])});}}else{socket['emit'](_0xd449('0x81'),{'UserId':Number(_0x2a6772['query'][_0xd449('0x5e')]),'SmsQueueId':Number(_0x2a6772[_0xd449('0x43')]['id'])});}});}})[_0xd449('0x23')](respondWithStatusCode(_0x48cab6,null))[_0xd449('0x42')](handleError(_0x48cab6,null));};exports[_0xd449('0x86')]=function(_0x43c249,_0x48b946,_0x5a5f6b){var _0x5a5bd0={};var _0x2ec22c={};var _0x30e6da;var _0x1d32de;return db[_0xd449('0x2b')][_0xd449('0x5b')]({'where':{'id':_0x43c249[_0xd449('0x43')]['id']}})[_0xd449('0x23')](handleEntityNotFound(_0x48b946,null))[_0xd449('0x23')](function(_0x4a1322){if(_0x4a1322){_0x30e6da=_0x4a1322;_0x2ec22c[_0xd449('0x2f')]=_[_0xd449('0x30')](db[_0xd449('0x51')][_0xd449('0x2c')]);_0x2ec22c[_0xd449('0x31')]=_['keys'](_0x43c249[_0xd449('0x31')]);_0x2ec22c['filters']=_['intersection'](_0x2ec22c[_0xd449('0x2f')],_0x2ec22c[_0xd449('0x31')]);_0x5a5bd0[_0xd449('0x34')]=_[_0xd449('0x33')](_0x2ec22c[_0xd449('0x2f')],qs[_0xd449('0x35')](_0x43c249[_0xd449('0x31')][_0xd449('0x35')]));_0x5a5bd0[_0xd449('0x34')]=_0x5a5bd0[_0xd449('0x34')][_0xd449('0x36')]?_0x5a5bd0[_0xd449('0x34')]:_0x2ec22c[_0xd449('0x2f')];_0x5a5bd0[_0xd449('0x4f')]=qs[_0xd449('0x3a')](_0x43c249[_0xd449('0x31')]['sort']);_0x5a5bd0[_0xd449('0x3b')]=qs[_0xd449('0x32')](_['pick'](_0x43c249[_0xd449('0x31')],_0x2ec22c[_0xd449('0x32')]));if(_0x43c249[_0xd449('0x31')][_0xd449('0x3c')]){_0x5a5bd0[_0xd449('0x3b')]=_[_0xd449('0x3d')](_0x5a5bd0['where'],{'$or':_['map'](_0x5a5bd0[_0xd449('0x34')],function(_0x2c9e81){var _0x179851={};_0x179851[_0x2c9e81]={'$like':'%'+_0x43c249[_0xd449('0x31')]['filter']+'%'};return _0x179851;})});}_0x5a5bd0=_[_0xd449('0x3d')]({},_0x5a5bd0,_0x43c249['options']);return _0x30e6da['getAgents'](_0x5a5bd0);}})[_0xd449('0x23')](function(_0xaefe57){if(_0xaefe57){_0x1d32de=_0xaefe57[_0xd449('0x36')];if(!_0x43c249['query'][_0xd449('0x37')]('nolimit')){_0x5a5bd0['limit']=qs[_0xd449('0x39')](_0x43c249[_0xd449('0x31')]['limit']);_0x5a5bd0[_0xd449('0x1c')]=qs[_0xd449('0x1c')](_0x43c249['query']['offset']);}return _0x30e6da[_0xd449('0x86')](_0x5a5bd0);}})[_0xd449('0x23')](function(_0x41f724){if(_0x41f724){return _0x41f724?{'count':_0x1d32de,'rows':_0x41f724}:null;}})['then'](respondWithResult(_0x48b946,null))['catch'](handleError(_0x48b946,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f1cc4cf..9c14ea6 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 _0xe82b=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x27669b,_0x306a2c){var _0x31ed6e=function(_0x1a6b6c){while(--_0x1a6b6c){_0x27669b['push'](_0x27669b['shift']());}};_0x31ed6e(++_0x306a2c);}(_0xe82b,0x11a));var _0xbe82=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe82b[_0x47b58b];return _0x46bebe;};'use strict';var EventEmitter=require(_0xbe82('0x0'));var SmsQueue=require(_0xbe82('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xbe82('0x2')](0x0);var events={'afterCreate':_0xbe82('0x3'),'afterUpdate':_0xbe82('0x4'),'afterDestroy':_0xbe82('0x5')};function emitEvent(_0xcf0042){return function(_0x3230dc,_0x4c28ba,_0x4494b7){SmsQueueEvents[_0xbe82('0x6')](_0xcf0042+':'+_0x3230dc['id'],_0x3230dc);SmsQueueEvents['emit'](_0xcf0042,_0x3230dc);_0x4494b7(null);};}for(var e in events){if(events[_0xbe82('0x7')](e)){var event=events[e];SmsQueue[_0xbe82('0x8')](e,emitEvent(event));}}module[_0xbe82('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xa36e=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','save','emit'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa36e,0x1b3));var _0xea36=function(_0x190f64,_0x2ae3ac){_0x190f64=_0x190f64-0x0;var _0x2470af=_0xa36e[_0x190f64];return _0x2470af;};'use strict';var EventEmitter=require(_0xea36('0x0'));var SmsQueue=require(_0xea36('0x1'))['db'][_0xea36('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea36('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31355b){return function(_0x11b436,_0x3d4091,_0xde8a2){SmsQueueEvents[_0xea36('0x4')](_0x31355b+':'+_0x11b436['id'],_0x11b436);SmsQueueEvents['emit'](_0x31355b,_0x11b436);_0xde8a2(null);};}for(var e in events){if(events[_0xea36('0x5')](e)){var event=events[e];SmsQueue[_0xea36('0x6')](e,emitEvent(event));}}module[_0xea36('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index f730214..652d5ac 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 _0x3663=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3d5a7c,_0x58dee5){var _0x218eeb=function(_0x565c02){while(--_0x565c02){_0x3d5a7c['push'](_0x3d5a7c['shift']());}};_0x218eeb(++_0x58dee5);}(_0x3663,0x1cf));var _0x3366=function(_0xd902ad,_0x34a4db){_0xd902ad=_0xd902ad-0x0;var _0x2dda06=_0x3663[_0xd902ad];return _0x2dda06;};'use strict';var _=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var logger=require(_0x3366('0x2'))('api');var moment=require(_0x3366('0x3'));var BPromise=require(_0x3366('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3366('0x5'));var rimraf=require(_0x3366('0x6'));var config=require(_0x3366('0x7'));var attributes=require(_0x3366('0x8'));module[_0x3366('0x9')]=function(_0x5284c0,_0x293cdb){return _0x5284c0[_0x3366('0xa')]('SmsQueue',attributes,{'tableName':_0x3366('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb66c=['sms_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x3836f6,_0x59d9c2){var _0x5cdb23=function(_0x343945){while(--_0x343945){_0x3836f6['push'](_0x3836f6['shift']());}};_0x5cdb23(++_0x59d9c2);}(_0xb66c,0x175));var _0xcb66=function(_0x209e0a,_0xcb4b2d){_0x209e0a=_0x209e0a-0x0;var _0x35d3c5=_0xb66c[_0x209e0a];return _0x35d3c5;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 2ef2c8b..f68cdfb 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 _0xc165=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','where','limit','include','map','model','attributes','then','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4cbd5b,_0x5a93ff){var _0x4acc2c=function(_0x20fe86){while(--_0x20fe86){_0x4cbd5b['push'](_0x4cbd5b['shift']());}};_0x4acc2c(++_0x5a93ff);}(_0xc165,0xb1));var _0x5c16=function(_0x452c06,_0x2d6a45){_0x452c06=_0x452c06-0x0;var _0x3c4e54=_0xc165[_0x452c06];return _0x3c4e54;};'use strict';var _=require(_0x5c16('0x0'));var util=require(_0x5c16('0x1'));var moment=require(_0x5c16('0x2'));var BPromise=require(_0x5c16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c16('0x4'))['db'];var utils=require(_0x5c16('0x5'));var logger=require(_0x5c16('0x6'))('rpc');var config=require(_0x5c16('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5c16('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x5c16('0x9')],{'host':_0x5c16('0xa'),'port':0x18eb});var socket=require(_0x5c16('0xb'))(new Redis(config['redis']));require(_0x5c16('0xc'))[_0x5c16('0xd')](socket);function respondWithRpcPromise(_0x592849,_0x584783,_0x23ece4){return new BPromise(function(_0x2060d0,_0x2badcd){return client[_0x5c16('0xe')](_0x592849,_0x23ece4)['then'](function(_0x37ad41){logger[_0x5c16('0xf')](_0x5c16('0x10'),_0x584783,_0x5c16('0x11'));logger[_0x5c16('0x12')](_0x5c16('0x13'),_0x584783,_0x5c16('0x11'),JSON[_0x5c16('0x14')](_0x37ad41));if(_0x37ad41[_0x5c16('0x15')]){if(_0x37ad41[_0x5c16('0x15')][_0x5c16('0x16')]===0x1f4){logger[_0x5c16('0x15')](_0x5c16('0x10'),_0x584783,_0x37ad41[_0x5c16('0x15')][_0x5c16('0x17')]);return _0x2badcd(_0x37ad41[_0x5c16('0x15')][_0x5c16('0x17')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x584783,_0x37ad41[_0x5c16('0x15')]['message']);return _0x2060d0(_0x37ad41[_0x5c16('0x15')][_0x5c16('0x17')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x584783,_0x5c16('0x11'));_0x2060d0(_0x37ad41['result']['message']);}})[_0x5c16('0x18')](function(_0x49feb4){logger[_0x5c16('0x15')](_0x5c16('0x10'),_0x584783,_0x49feb4);_0x2badcd(_0x49feb4);});});}exports[_0x5c16('0x19')]=function(_0x543a8f){var _0x508824=this;return new Promise(function(_0x254594,_0x336f38){return db[_0x5c16('0x1a')][_0x5c16('0x1b')]({'raw':_0x543a8f[_0x5c16('0x1c')]?_0x543a8f[_0x5c16('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x543a8f['options']?_0x543a8f[_0x5c16('0x1c')][_0x5c16('0x1d')]||null:null,'attributes':_0x543a8f['options']?_0x543a8f['options']['attributes']||null:null,'limit':_0x543a8f[_0x5c16('0x1c')]?_0x543a8f[_0x5c16('0x1c')][_0x5c16('0x1e')]||null:null,'include':_0x543a8f[_0x5c16('0x1c')]?_0x543a8f[_0x5c16('0x1c')][_0x5c16('0x1f')]?_[_0x5c16('0x20')](_0x543a8f[_0x5c16('0x1c')]['include'],function(_0x5d3f17){return{'model':db[_0x5d3f17[_0x5c16('0x21')]],'as':_0x5d3f17['as'],'attributes':_0x5d3f17[_0x5c16('0x22')],'include':_0x5d3f17[_0x5c16('0x1f')]?_[_0x5c16('0x20')](_0x5d3f17[_0x5c16('0x1f')],function(_0x49be84){return{'model':db[_0x49be84[_0x5c16('0x21')]],'as':_0x49be84['as'],'attributes':_0x49be84[_0x5c16('0x22')],'include':_0x49be84[_0x5c16('0x1f')]?_[_0x5c16('0x20')](_0x49be84[_0x5c16('0x1f')],function(_0x45d27a){return{'model':db[_0x45d27a[_0x5c16('0x21')]],'as':_0x45d27a['as'],'attributes':_0x45d27a[_0x5c16('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5c16('0x23')](function(_0x16e8f3){logger[_0x5c16('0xf')](_0x5c16('0x19'),_0x543a8f);logger['debug'](_0x5c16('0x19'),_0x543a8f,JSON['stringify'](_0x16e8f3));_0x254594(_0x16e8f3);})[_0x5c16('0x18')](function(_0x5af5c8){logger[_0x5c16('0x15')](_0x5c16('0x19'),_0x5af5c8[_0x5c16('0x17')],_0x543a8f);_0x336f38(_0x508824[_0x5c16('0x15')](0x1f4,_0x5af5c8['message']));});});};exports[_0x5c16('0x24')]=function(_0x45e826){var _0xa44bba=this;return new Promise(function(_0x547fe2,_0x1cfbd7){return db[_0x5c16('0x1a')][_0x5c16('0x25')]({'raw':_0x45e826[_0x5c16('0x1c')]?_0x45e826['options'][_0x5c16('0x26')]===undefined?!![]:![]:!![],'where':_0x45e826['options']?_0x45e826[_0x5c16('0x1c')][_0x5c16('0x1d')]||null:null,'attributes':_0x45e826['options']?_0x45e826[_0x5c16('0x1c')][_0x5c16('0x22')]||null:null,'include':_0x45e826['options']?_0x45e826['options'][_0x5c16('0x1f')]?_[_0x5c16('0x20')](_0x45e826[_0x5c16('0x1c')][_0x5c16('0x1f')],function(_0x3971ec){return{'model':db[_0x3971ec[_0x5c16('0x21')]],'as':_0x3971ec['as'],'attributes':_0x3971ec['attributes'],'include':_0x3971ec[_0x5c16('0x1f')]?_['map'](_0x3971ec[_0x5c16('0x1f')],function(_0x4444b0){return{'model':db[_0x4444b0[_0x5c16('0x21')]],'as':_0x4444b0['as'],'attributes':_0x4444b0[_0x5c16('0x22')],'include':_0x4444b0['include']?_[_0x5c16('0x20')](_0x4444b0[_0x5c16('0x1f')],function(_0xe37f2a){return{'model':db[_0xe37f2a['model']],'as':_0xe37f2a['as'],'attributes':_0xe37f2a[_0x5c16('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e2d30){logger['info']('ShowSmsQueue',_0x45e826);logger['debug'](_0x5c16('0x24'),_0x45e826,JSON['stringify'](_0x1e2d30));_0x547fe2(_0x1e2d30);})[_0x5c16('0x18')](function(_0xf34ce9){logger[_0x5c16('0x15')](_0x5c16('0x24'),_0xf34ce9[_0x5c16('0x17')],_0x45e826);_0x1cfbd7(_0xa44bba['error'](0x1f4,_0xf34ce9['message']));});});}; \ No newline at end of file +var _0xa52c=['jayson/promise','client','http','redis','defaults','localhost','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','map','include','model','attributes','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0xa52c,0x1af));var _0xca52=function(_0x2e9b28,_0x543b5e){_0x2e9b28=_0x2e9b28-0x0;var _0x953e17=_0xa52c[_0x2e9b28];return _0x953e17;};'use strict';var _=require(_0xca52('0x0'));var util=require(_0xca52('0x1'));var moment=require(_0xca52('0x2'));var BPromise=require(_0xca52('0x3'));var rs=require(_0xca52('0x4'));var fs=require('fs');var Redis=require(_0xca52('0x5'));var db=require(_0xca52('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca52('0x7'))('rpc');var config=require(_0xca52('0x8'));var jayson=require(_0xca52('0x9'));var client=jayson[_0xca52('0xa')][_0xca52('0xb')]({'port':0x232a});config[_0xca52('0xc')]=_[_0xca52('0xd')](config['redis'],{'host':_0xca52('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca52('0xc')]));require('./smsQueue.socket')[_0xca52('0xf')](socket);function respondWithRpcPromise(_0x49e3c0,_0xfb6532,_0x4e9fd8){return new BPromise(function(_0x7c0ed2,_0x2019b4){return client[_0xca52('0x10')](_0x49e3c0,_0x4e9fd8)['then'](function(_0x2bbca8){logger[_0xca52('0x11')](_0xca52('0x12'),_0xfb6532,_0xca52('0x13'));logger[_0xca52('0x14')](_0xca52('0x15'),_0xfb6532,'request\x20sent',JSON[_0xca52('0x16')](_0x2bbca8));if(_0x2bbca8[_0xca52('0x17')]){if(_0x2bbca8[_0xca52('0x17')][_0xca52('0x18')]===0x1f4){logger['error'](_0xca52('0x12'),_0xfb6532,_0x2bbca8[_0xca52('0x17')][_0xca52('0x19')]);return _0x2019b4(_0x2bbca8[_0xca52('0x17')][_0xca52('0x19')]);}logger[_0xca52('0x17')](_0xca52('0x12'),_0xfb6532,_0x2bbca8[_0xca52('0x17')][_0xca52('0x19')]);return _0x7c0ed2(_0x2bbca8['error'][_0xca52('0x19')]);}else{logger[_0xca52('0x11')](_0xca52('0x12'),_0xfb6532,_0xca52('0x13'));_0x7c0ed2(_0x2bbca8[_0xca52('0x1a')]['message']);}})[_0xca52('0x1b')](function(_0x1e5302){logger[_0xca52('0x17')](_0xca52('0x12'),_0xfb6532,_0x1e5302);_0x2019b4(_0x1e5302);});});}exports[_0xca52('0x1c')]=function(_0x1cfb4b){var _0x1cfdc7=this;return new Promise(function(_0xe316f5,_0x3e03e6){return db[_0xca52('0x1d')][_0xca52('0x1e')]({'raw':_0x1cfb4b[_0xca52('0x1f')]?_0x1cfb4b[_0xca52('0x1f')][_0xca52('0x20')]===undefined?!![]:![]:!![],'where':_0x1cfb4b[_0xca52('0x1f')]?_0x1cfb4b['options'][_0xca52('0x21')]||null:null,'attributes':_0x1cfb4b[_0xca52('0x1f')]?_0x1cfb4b[_0xca52('0x1f')]['attributes']||null:null,'limit':_0x1cfb4b[_0xca52('0x1f')]?_0x1cfb4b[_0xca52('0x1f')][_0xca52('0x22')]||null:null,'include':_0x1cfb4b[_0xca52('0x1f')]?_0x1cfb4b['options']['include']?_[_0xca52('0x23')](_0x1cfb4b[_0xca52('0x1f')][_0xca52('0x24')],function(_0x1456df){return{'model':db[_0x1456df[_0xca52('0x25')]],'as':_0x1456df['as'],'attributes':_0x1456df['attributes'],'include':_0x1456df[_0xca52('0x24')]?_[_0xca52('0x23')](_0x1456df[_0xca52('0x24')],function(_0x517bc4){return{'model':db[_0x517bc4[_0xca52('0x25')]],'as':_0x517bc4['as'],'attributes':_0x517bc4[_0xca52('0x26')],'include':_0x517bc4[_0xca52('0x24')]?_[_0xca52('0x23')](_0x517bc4[_0xca52('0x24')],function(_0x3c9c91){return{'model':db[_0x3c9c91['model']],'as':_0x3c9c91['as'],'attributes':_0x3c9c91[_0xca52('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x392c08){logger[_0xca52('0x11')]('GetSmsQueue',_0x1cfb4b);logger['debug']('GetSmsQueue',_0x1cfb4b,JSON['stringify'](_0x392c08));_0xe316f5(_0x392c08);})['catch'](function(_0x4a5f22){logger['error'](_0xca52('0x1c'),_0x4a5f22['message'],_0x1cfb4b);_0x3e03e6(_0x1cfdc7['error'](0x1f4,_0x4a5f22['message']));});});};exports['ShowSmsQueue']=function(_0x394aaa){var _0x17f82f=this;return new Promise(function(_0x36d712,_0x5a4bbd){return db[_0xca52('0x1d')]['find']({'raw':_0x394aaa[_0xca52('0x1f')]?_0x394aaa[_0xca52('0x1f')][_0xca52('0x20')]===undefined?!![]:![]:!![],'where':_0x394aaa[_0xca52('0x1f')]?_0x394aaa['options']['where']||null:null,'attributes':_0x394aaa[_0xca52('0x1f')]?_0x394aaa['options'][_0xca52('0x26')]||null:null,'include':_0x394aaa[_0xca52('0x1f')]?_0x394aaa['options']['include']?_[_0xca52('0x23')](_0x394aaa[_0xca52('0x1f')][_0xca52('0x24')],function(_0x4589c2){return{'model':db[_0x4589c2[_0xca52('0x25')]],'as':_0x4589c2['as'],'attributes':_0x4589c2[_0xca52('0x26')],'include':_0x4589c2[_0xca52('0x24')]?_[_0xca52('0x23')](_0x4589c2[_0xca52('0x24')],function(_0x3c06b9){return{'model':db[_0x3c06b9[_0xca52('0x25')]],'as':_0x3c06b9['as'],'attributes':_0x3c06b9['attributes'],'include':_0x3c06b9[_0xca52('0x24')]?_[_0xca52('0x23')](_0x3c06b9[_0xca52('0x24')],function(_0x191cac){return{'model':db[_0x191cac[_0xca52('0x25')]],'as':_0x191cac['as'],'attributes':_0x191cac[_0xca52('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x587660){logger[_0xca52('0x11')]('ShowSmsQueue',_0x394aaa);logger[_0xca52('0x14')](_0xca52('0x27'),_0x394aaa,JSON[_0xca52('0x16')](_0x587660));_0x36d712(_0x587660);})[_0xca52('0x1b')](function(_0x124d33){logger['error'](_0xca52('0x27'),_0x124d33[_0xca52('0x19')],_0x394aaa);_0x5a4bbd(_0x17f82f[_0xca52('0x17')](0x1f4,_0x124d33['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 782cd40..ab6e360 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 _0xd36b=['emit','removeListener','register','length','smsQueue:'];(function(_0x698200,_0x3ca8ea){var _0x421ac3=function(_0x4b4951){while(--_0x4b4951){_0x698200['push'](_0x698200['shift']());}};_0x421ac3(++_0x3ca8ea);}(_0xd36b,0xbe));var _0xbd36=function(_0x428ad7,_0x40e2c4){_0x428ad7=_0x428ad7-0x0;var _0x3b93ff=_0xd36b[_0x428ad7];return _0x3b93ff;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0xe099ff,_0x10c698){return function(_0x684773){_0x10c698[_0xbd36('0x0')](_0xe099ff,_0x684773);};}function removeListener(_0x4fbdf2,_0xd6af72){return function(){SmsQueueEvents[_0xbd36('0x1')](_0x4fbdf2,_0xd6af72);};}exports[_0xbd36('0x2')]=function(_0xd09c3a){for(var _0x4adf5e=0x0,_0x3b5ad4=events[_0xbd36('0x3')];_0x4adf5e<_0x3b5ad4;_0x4adf5e++){var _0x205c93=events[_0x4adf5e];var _0x7797d=createListener(_0xbd36('0x4')+_0x205c93,_0xd09c3a);SmsQueueEvents['on'](_0x205c93,_0x7797d);}}; \ No newline at end of file +var _0x61a9=['update','emit','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x1b55d1,_0x52da8b){var _0x398a50=function(_0x10d62c){while(--_0x10d62c){_0x1b55d1['push'](_0x1b55d1['shift']());}};_0x398a50(++_0x52da8b);}(_0x61a9,0x13f));var _0x961a=function(_0x1ef8f2,_0x1dbf15){_0x1ef8f2=_0x1ef8f2-0x0;var _0x4b5946=_0x61a9[_0x1ef8f2];return _0x4b5946;};'use strict';var SmsQueueEvents=require(_0x961a('0x0'));var events=[_0x961a('0x1'),_0x961a('0x2'),_0x961a('0x3')];function createListener(_0x36ac82,_0x20af20){return function(_0x53c347){_0x20af20[_0x961a('0x4')](_0x36ac82,_0x53c347);};}function removeListener(_0x168cec,_0x352e79){return function(){SmsQueueEvents['removeListener'](_0x168cec,_0x352e79);};}exports['register']=function(_0x3898bd){for(var _0x16260c=0x0,_0x4dee25=events[_0x961a('0x5')];_0x16260c<_0x4dee25;_0x16260c++){var _0x5ee5b3=events[_0x16260c];var _0x5f2a74=createListener(_0x961a('0x6')+_0x5ee5b3,_0x3898bd);SmsQueueEvents['on'](_0x5ee5b3,_0x5f2a74);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index ea61a93..39217cd 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 _0x7a94=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','show','post','create'];(function(_0xa11ff7,_0x193019){var _0x1a8fc8=function(_0x35256c){while(--_0x35256c){_0xa11ff7['push'](_0xa11ff7['shift']());}};_0x1a8fc8(++_0x193019);}(_0x7a94,0x1d4));var _0x47a9=function(_0x1da031,_0x40724d){_0x1da031=_0x1da031-0x0;var _0x51bdd2=_0x7a94[_0x1da031];return _0x51bdd2;};'use strict';var multer=require(_0x47a9('0x0'));var util=require(_0x47a9('0x1'));var path=require(_0x47a9('0x2'));var timeout=require(_0x47a9('0x3'));var express=require(_0x47a9('0x4'));var router=express[_0x47a9('0x5')]();var auth=require(_0x47a9('0x6'));var interaction=require(_0x47a9('0x7'));var config=require(_0x47a9('0x8'));var controller=require(_0x47a9('0x9'));router[_0x47a9('0xa')]('/',auth[_0x47a9('0xb')](),controller['index']);router[_0x47a9('0xa')]('/describe',auth[_0x47a9('0xb')](),controller['describe']);router[_0x47a9('0xa')]('/:id',auth[_0x47a9('0xb')](),controller[_0x47a9('0xc')]);router[_0x47a9('0xd')]('/',auth[_0x47a9('0xb')](),controller[_0x47a9('0xe')]);router[_0x47a9('0xf')](_0x47a9('0x10'),auth[_0x47a9('0xb')](),controller[_0x47a9('0x11')]);router[_0x47a9('0x12')](_0x47a9('0x10'),auth[_0x47a9('0xb')](),controller[_0x47a9('0x13')]);module[_0x47a9('0x14')]=router; \ No newline at end of file +var _0x4537=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x328f61,_0xc7ae7){var _0x177686=function(_0x38ea20){while(--_0x38ea20){_0x328f61['push'](_0x328f61['shift']());}};_0x177686(++_0xc7ae7);}(_0x4537,0x1ce));var _0x7453=function(_0x1cec7a,_0x30ab45){_0x1cec7a=_0x1cec7a-0x0;var _0x5cd440=_0x4537[_0x1cec7a];return _0x5cd440;};'use strict';var multer=require(_0x7453('0x0'));var util=require(_0x7453('0x1'));var path=require(_0x7453('0x2'));var timeout=require(_0x7453('0x3'));var express=require('express');var router=express[_0x7453('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7453('0x5'));var config=require(_0x7453('0x6'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x7453('0x7')](),controller[_0x7453('0x8')]);router[_0x7453('0x9')](_0x7453('0xa'),auth[_0x7453('0x7')](),controller[_0x7453('0xb')]);router[_0x7453('0x9')](_0x7453('0xc'),auth[_0x7453('0x7')](),controller[_0x7453('0xd')]);router['post']('/',auth[_0x7453('0x7')](),controller[_0x7453('0xe')]);router[_0x7453('0xf')](_0x7453('0xc'),auth['isAuthenticated'](),controller[_0x7453('0x10')]);router[_0x7453('0x11')]('/:id',auth[_0x7453('0x7')](),controller[_0x7453('0x12')]);module[_0x7453('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 245e2fa..fb9c596 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 _0xc6b5=['moment','sequelize','exports','DATE','STRING'];(function(_0x23c11f,_0x499cdb){var _0x33eeab=function(_0x1226d1){while(--_0x1226d1){_0x23c11f['push'](_0x23c11f['shift']());}};_0x33eeab(++_0x499cdb);}(_0xc6b5,0x82));var _0x5c6b=function(_0x5a1f6b,_0x21cad5){_0x5a1f6b=_0x5a1f6b-0x0;var _0x178e80=_0xc6b5[_0x5a1f6b];return _0x178e80;};'use strict';var moment=require(_0x5c6b('0x0'));var Sequelize=require(_0x5c6b('0x1'));module[_0x5c6b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5c6b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5c6b('0x3')]},'exitAt':{'type':Sequelize[_0x5c6b('0x3')]},'reason':{'type':Sequelize[_0x5c6b('0x4')]}}; \ No newline at end of file +var _0xc73e=['DATE','moment','sequelize','STRING'];(function(_0x302ac9,_0x16401a){var _0x80e1ff=function(_0x129392){while(--_0x129392){_0x302ac9['push'](_0x302ac9['shift']());}};_0x80e1ff(++_0x16401a);}(_0xc73e,0xbd));var _0xec73=function(_0x37242c,_0x30e3e1){_0x37242c=_0x37242c-0x0;var _0x5e64e9=_0xc73e[_0x37242c];return _0x5e64e9;};'use strict';var moment=require(_0xec73('0x0'));var Sequelize=require(_0xec73('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xec73('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xec73('0x3')]},'acceptAt':{'type':Sequelize[_0xec73('0x3')]},'exitAt':{'type':Sequelize[_0xec73('0x3')]},'reason':{'type':Sequelize[_0xec73('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index be0b42b..9bb978f 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 _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(_0x192c6a,_0xaafed6){var _0x49fe49=function(_0x20d337){while(--_0x20d337){_0x192c6a['push'](_0x192c6a['shift']());}};_0x49fe49(++_0xaafed6);}(_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'];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 +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(_0x26a815,_0xcde2b9){var _0x539ed1=function(_0x66f759){while(--_0x66f759){_0x26a815['push'](_0x26a815['shift']());}};_0x539ed1(++_0xcde2b9);}(_0x814b,0x1a2));var _0xb814=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x814b[_0x56fb33];return _0x435ee4;};'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 diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e4f5742..1545b14 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 _0x8717=['./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x8717,0x1b2));var _0x7871=function(_0x51c726,_0x332b95){_0x51c726=_0x51c726-0x0;var _0x23fe86=_0x8717[_0x51c726];return _0x23fe86;};'use strict';var _=require(_0x7871('0x0'));var util=require(_0x7871('0x1'));var logger=require(_0x7871('0x2'))(_0x7871('0x3'));var moment=require(_0x7871('0x4'));var BPromise=require(_0x7871('0x5'));var rp=require(_0x7871('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7871('0x7'));var config=require('../../config/environment');var attributes=require(_0x7871('0x8'));module[_0x7871('0x9')]=function(_0x2a2762,_0x21bd70){return _0x2a2762[_0x7871('0xa')]('SmsQueueReport',attributes,{'tableName':_0x7871('0xb'),'paranoid':![],'indexes':[{'name':_0x7871('0xc'),'fields':[_0x7871('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c95=['SmsQueueReport','report_sms_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x40d6c3,_0x1ca9d1){var _0x12b825=function(_0x46c8e8){while(--_0x46c8e8){_0x40d6c3['push'](_0x40d6c3['shift']());}};_0x12b825(++_0x1ca9d1);}(_0x1c95,0x1d7));var _0x51c9=function(_0x1fbf07,_0x2d3fc2){_0x1fbf07=_0x1fbf07-0x0;var _0x3c95e6=_0x1c95[_0x1fbf07];return _0x3c95e6;};'use strict';var _=require(_0x51c9('0x0'));var util=require(_0x51c9('0x1'));var logger=require('../../config/logger')(_0x51c9('0x2'));var moment=require(_0x51c9('0x3'));var BPromise=require(_0x51c9('0x4'));var rp=require(_0x51c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51c9('0x6'));var config=require(_0x51c9('0x7'));var attributes=require(_0x51c9('0x8'));module['exports']=function(_0x2ee13d,_0x4722a0){return _0x2ee13d['define'](_0x51c9('0x9'),attributes,{'tableName':_0x51c9('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x51c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0cbde6b..44bb27f 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 _0xc579=['catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','update','raw','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x388633,_0x12fe8a){var _0x24be16=function(_0x37c722){while(--_0x37c722){_0x388633['push'](_0x388633['shift']());}};_0x24be16(++_0x12fe8a);}(_0xc579,0xf1));var _0x9c57=function(_0x1ee7ab,_0x231e04){_0x1ee7ab=_0x1ee7ab-0x0;var _0x5d3350=_0xc579[_0x1ee7ab];return _0x5d3350;};'use strict';var _=require('lodash');var util=require(_0x9c57('0x0'));var moment=require(_0x9c57('0x1'));var BPromise=require(_0x9c57('0x2'));var rs=require(_0x9c57('0x3'));var fs=require('fs');var Redis=require(_0x9c57('0x4'));var db=require(_0x9c57('0x5'))['db'];var utils=require(_0x9c57('0x6'));var logger=require('../../config/logger')(_0x9c57('0x7'));var config=require(_0x9c57('0x8'));var jayson=require(_0x9c57('0x9'));var client=jayson[_0x9c57('0xa')][_0x9c57('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfbc0a5,_0x4d6f5b,_0x7f023e){return new BPromise(function(_0x12fc72,_0x26bd72){return client['request'](_0xfbc0a5,_0x7f023e)[_0x9c57('0xc')](function(_0x89d1f8){logger[_0x9c57('0xd')](_0x9c57('0xe'),_0x4d6f5b,_0x9c57('0xf'));logger[_0x9c57('0x10')](_0x9c57('0x11'),_0x4d6f5b,_0x9c57('0xf'),JSON[_0x9c57('0x12')](_0x89d1f8));if(_0x89d1f8[_0x9c57('0x13')]){if(_0x89d1f8[_0x9c57('0x13')][_0x9c57('0x14')]===0x1f4){logger[_0x9c57('0x13')](_0x9c57('0xe'),_0x4d6f5b,_0x89d1f8[_0x9c57('0x13')][_0x9c57('0x15')]);return _0x26bd72(_0x89d1f8[_0x9c57('0x13')][_0x9c57('0x15')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x4d6f5b,_0x89d1f8[_0x9c57('0x13')][_0x9c57('0x15')]);return _0x12fc72(_0x89d1f8['error'][_0x9c57('0x15')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x4d6f5b,_0x9c57('0xf'));_0x12fc72(_0x89d1f8[_0x9c57('0x16')]['message']);}})[_0x9c57('0x17')](function(_0x57bb3c){logger['error'](_0x9c57('0xe'),_0x4d6f5b,_0x57bb3c);_0x26bd72(_0x57bb3c);});});}exports[_0x9c57('0x18')]=function(_0x1978d8){var _0x305949=this;return new Promise(function(_0xaf29d6,_0x5a81cf){return db[_0x9c57('0x19')][_0x9c57('0x1a')](_0x1978d8[_0x9c57('0x1b')],{'raw':_0x1978d8[_0x9c57('0x1c')]?_0x1978d8[_0x9c57('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x9c57('0xc')](function(_0x495b8f){logger[_0x9c57('0xd')](_0x9c57('0x18'),_0x1978d8);logger[_0x9c57('0x10')](_0x9c57('0x18'),_0x1978d8,JSON[_0x9c57('0x12')](_0x495b8f));_0xaf29d6(_0x495b8f);})['catch'](function(_0x1e4c72){logger[_0x9c57('0x13')](_0x9c57('0x18'),_0x1e4c72[_0x9c57('0x15')],_0x1978d8);_0x5a81cf(_0x305949[_0x9c57('0x13')](0x1f4,_0x1e4c72[_0x9c57('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x4c82b9){var _0x17d365=this;return new Promise(function(_0x1d2362,_0x238bed){return db[_0x9c57('0x19')][_0x9c57('0x1d')](_0x4c82b9[_0x9c57('0x1b')],{'raw':_0x4c82b9[_0x9c57('0x1c')]?_0x4c82b9[_0x9c57('0x1c')][_0x9c57('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c82b9[_0x9c57('0x1c')]?_0x4c82b9[_0x9c57('0x1c')]['where']||null:null,'attributes':_0x4c82b9['options']?_0x4c82b9['options']['attributes']||null:null,'limit':_0x4c82b9[_0x9c57('0x1c')]?_0x4c82b9[_0x9c57('0x1c')][_0x9c57('0x1f')]||null:null})['then'](function(_0x2e5abb){logger[_0x9c57('0xd')](_0x9c57('0x20'),_0x4c82b9);logger[_0x9c57('0x10')](_0x9c57('0x20'),_0x4c82b9,JSON[_0x9c57('0x12')](_0x2e5abb));_0x1d2362(_0x2e5abb);})[_0x9c57('0x17')](function(_0x1f91ca){logger[_0x9c57('0x13')](_0x9c57('0x20'),_0x1f91ca['message'],_0x4c82b9);_0x238bed(_0x17d365[_0x9c57('0x13')](0x1f4,_0x1f91ca[_0x9c57('0x15')]));});});}; \ No newline at end of file +var _0x0de5=['UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateSmsQueueReport','body','options','raw','then','catch'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x0de5,0x1d4));var _0x50de=function(_0x56a9ac,_0x22dd29){_0x56a9ac=_0x56a9ac-0x0;var _0x2ac185=_0x0de5[_0x56a9ac];return _0x2ac185;};'use strict';var _=require(_0x50de('0x0'));var util=require(_0x50de('0x1'));var moment=require('moment');var BPromise=require(_0x50de('0x2'));var rs=require(_0x50de('0x3'));var fs=require('fs');var Redis=require(_0x50de('0x4'));var db=require(_0x50de('0x5'))['db'];var utils=require(_0x50de('0x6'));var logger=require(_0x50de('0x7'))(_0x50de('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x50de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32ca34,_0x21dbe9,_0x15dcbc){return new BPromise(function(_0xb44bee,_0x347f5f){return client[_0x50de('0xa')](_0x32ca34,_0x15dcbc)['then'](function(_0xfc9365){logger[_0x50de('0xb')](_0x50de('0xc'),_0x21dbe9,'request\x20sent');logger[_0x50de('0xd')](_0x50de('0xe'),_0x21dbe9,'request\x20sent',JSON[_0x50de('0xf')](_0xfc9365));if(_0xfc9365[_0x50de('0x10')]){if(_0xfc9365[_0x50de('0x10')][_0x50de('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x21dbe9,_0xfc9365[_0x50de('0x10')][_0x50de('0x12')]);return _0x347f5f(_0xfc9365[_0x50de('0x10')]['message']);}logger[_0x50de('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x21dbe9,_0xfc9365[_0x50de('0x10')][_0x50de('0x12')]);return _0xb44bee(_0xfc9365['error'][_0x50de('0x12')]);}else{logger[_0x50de('0xb')](_0x50de('0xc'),_0x21dbe9,_0x50de('0x13'));_0xb44bee(_0xfc9365[_0x50de('0x14')]['message']);}})['catch'](function(_0x7a4ca1){logger[_0x50de('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x21dbe9,_0x7a4ca1);_0x347f5f(_0x7a4ca1);});});}exports[_0x50de('0x15')]=function(_0x1d450c){var _0x22e8d6=this;return new Promise(function(_0x3d0e2b,_0x494875){return db['SmsQueueReport']['create'](_0x1d450c[_0x50de('0x16')],{'raw':_0x1d450c[_0x50de('0x17')]?_0x1d450c['options'][_0x50de('0x18')]===undefined?!![]:![]:!![]})[_0x50de('0x19')](function(_0x4261b6){logger['info'](_0x50de('0x15'),_0x1d450c);logger[_0x50de('0xd')](_0x50de('0x15'),_0x1d450c,JSON['stringify'](_0x4261b6));_0x3d0e2b(_0x4261b6);})[_0x50de('0x1a')](function(_0x269099){logger[_0x50de('0x10')](_0x50de('0x15'),_0x269099['message'],_0x1d450c);_0x494875(_0x22e8d6[_0x50de('0x10')](0x1f4,_0x269099[_0x50de('0x12')]));});});};exports[_0x50de('0x1b')]=function(_0x5b9198){var _0x303d40=this;return new Promise(function(_0x150ee6,_0x57fd87){return db[_0x50de('0x1c')][_0x50de('0x1d')](_0x5b9198[_0x50de('0x16')],{'raw':_0x5b9198[_0x50de('0x17')]?_0x5b9198[_0x50de('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b9198[_0x50de('0x17')]?_0x5b9198[_0x50de('0x17')][_0x50de('0x1e')]||null:null,'attributes':_0x5b9198['options']?_0x5b9198['options'][_0x50de('0x1f')]||null:null,'limit':_0x5b9198[_0x50de('0x17')]?_0x5b9198[_0x50de('0x17')][_0x50de('0x20')]||null:null})[_0x50de('0x19')](function(_0x3c5b28){logger[_0x50de('0xb')](_0x50de('0x1b'),_0x5b9198);logger[_0x50de('0xd')](_0x50de('0x1b'),_0x5b9198,JSON[_0x50de('0xf')](_0x3c5b28));_0x150ee6(_0x3c5b28);})[_0x50de('0x1a')](function(_0x2be9cc){logger[_0x50de('0x10')]('UpdateSmsQueueReport',_0x2be9cc[_0x50de('0x12')],_0x5b9198);_0x57fd87(_0x303d40[_0x50de('0x10')](0x1f4,_0x2be9cc['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 983da64..04c228c 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 _0xd7d1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1e11c2,_0x1bcbca){var _0x4faa44=function(_0x4c3bf3){while(--_0x4c3bf3){_0x1e11c2['push'](_0x1e11c2['shift']());}};_0x4faa44(++_0x1bcbca);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x58a771,_0x30c5d1){_0x58a771=_0x58a771-0x0;var _0x25ef53=_0xd7d1[_0x58a771];return _0x25ef53;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var auth=require(_0x1d7d('0x6'));var interaction=require(_0x1d7d('0x7'));var config=require(_0x1d7d('0x8'));var controller=require(_0x1d7d('0x9'));router[_0x1d7d('0xa')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xc')]);router['get'](_0x1d7d('0xd'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xa')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0x13')]('/:id',auth[_0x1d7d('0xb')](),controller['update']);router[_0x1d7d('0x14')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf7b4=['update','delete','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf7b4,0x152));var _0x4f7b=function(_0x58abac,_0x312d6a){_0x58abac=_0x58abac-0x0;var _0x2b4e36=_0xf7b4[_0x58abac];return _0x2b4e36;};'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['show']);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x7')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xb'),auth[_0x4f7b('0x7')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')]('/:id',auth[_0x4f7b('0x7')](),controller['destroy']);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 0bdbaba..38663a1 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 _0xe9fb=['exports','STRING','ENUM','agent','DATE','NOW','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe9fb,0x14f));var _0xbe9f=function(_0x1aeabd,_0xc1eb43){_0x1aeabd=_0x1aeabd-0x0;var _0x1af256=_0xe9fb[_0x1aeabd];return _0x1af256;};'use strict';var moment=require('moment');var Sequelize=require(_0xbe9f('0x0'));module[_0xbe9f('0x1')]={'uniqueid':{'type':Sequelize[_0xbe9f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbe9f('0x3')]('account',_0xbe9f('0x4'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbe9f('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xbe9f('0x6')]}}; \ No newline at end of file +var _0x2a36=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x475e55,_0x377709){var _0x245bc7=function(_0x5a370e){while(--_0x5a370e){_0x475e55['push'](_0x475e55['shift']());}};_0x245bc7(++_0x377709);}(_0x2a36,0x198));var _0x62a3=function(_0x668379,_0x32552b){_0x668379=_0x668379-0x0;var _0x571da6=_0x2a36[_0x668379];return _0x571da6;};'use strict';var moment=require(_0x62a3('0x0'));var Sequelize=require('sequelize');module[_0x62a3('0x1')]={'uniqueid':{'type':Sequelize[_0x62a3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x62a3('0x3')](_0x62a3('0x4'),_0x62a3('0x5'),_0x62a3('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x62a3('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x62a3('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4ae7a91..ec8c4b6 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x44b926,_0x22065b){var _0x23344d=function(_0x4749c4){while(--_0x4749c4){_0x44b926['push'](_0x44b926['shift']());}};_0x23344d(++_0x22065b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xcb91[_0x16539a];return _0x200796;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['SmsTransferReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['SmsTransferReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['SmsTransferReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file +var _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0x223b78,_0x429a9a){var _0x1774ef=function(_0x2df976){while(--_0x2df976){_0x223b78['push'](_0x223b78['shift']());}};_0x1774ef(++_0x429a9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['SmsTransferReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f8ea8f5..a150e92 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 _0xef66=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef66,0x1db));var _0x6ef6=function(_0x11cf50,_0x4622c9){_0x11cf50=_0x11cf50-0x0;var _0x15fd51=_0xef66[_0x11cf50];return _0x15fd51;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var logger=require(_0x6ef6('0x2'))(_0x6ef6('0x3'));var moment=require(_0x6ef6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ef6('0x5'));var rimraf=require(_0x6ef6('0x6'));var config=require(_0x6ef6('0x7'));var attributes=require(_0x6ef6('0x8'));module[_0x6ef6('0x9')]=function(_0xce1574,_0x32baa0){return _0xce1574[_0x6ef6('0xa')](_0x6ef6('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6ef6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe216=['util','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x106cc5,_0x383876){var _0x17c990=function(_0x2ed6ea){while(--_0x2ed6ea){_0x106cc5['push'](_0x106cc5['shift']());}};_0x17c990(++_0x383876);}(_0xe216,0x195));var _0x6e21=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xe216[_0x13cab0];return _0x38804f;};'use strict';var _=require(_0x6e21('0x0'));var util=require(_0x6e21('0x1'));var logger=require('../../config/logger')(_0x6e21('0x2'));var moment=require(_0x6e21('0x3'));var BPromise=require(_0x6e21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e21('0x5'));var rimraf=require(_0x6e21('0x6'));var config=require(_0x6e21('0x7'));var attributes=require(_0x6e21('0x8'));module[_0x6e21('0x9')]=function(_0xa8eeb6,_0x4353f7){return _0xa8eeb6[_0x6e21('0xa')](_0x6e21('0xb'),attributes,{'tableName':_0x6e21('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6e21('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index e47f66a..bb539a0 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 _0xc8ae=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xc8ae,0xc8));var _0xec8a=function(_0xaabc42,_0x1af409){_0xaabc42=_0xaabc42-0x0;var _0x4aa9c6=_0xc8ae[_0xaabc42];return _0x4aa9c6;};'use strict';var _=require(_0xec8a('0x0'));var util=require(_0xec8a('0x1'));var moment=require('moment');var BPromise=require(_0xec8a('0x2'));var rs=require(_0xec8a('0x3'));var fs=require('fs');var Redis=require(_0xec8a('0x4'));var db=require(_0xec8a('0x5'))['db'];var utils=require(_0xec8a('0x6'));var logger=require('../../config/logger')(_0xec8a('0x7'));var config=require(_0xec8a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xec8a('0x9')][_0xec8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x286388,_0x53a2e0,_0x1f20e9){return new BPromise(function(_0xf53d23,_0x2b06df){return client[_0xec8a('0xb')](_0x286388,_0x1f20e9)[_0xec8a('0xc')](function(_0x2c726e){logger['info'](_0xec8a('0xd'),_0x53a2e0,_0xec8a('0xe'));logger['debug'](_0xec8a('0xf'),_0x53a2e0,'request\x20sent',JSON[_0xec8a('0x10')](_0x2c726e));if(_0x2c726e[_0xec8a('0x11')]){if(_0x2c726e['error']['code']===0x1f4){logger[_0xec8a('0x11')](_0xec8a('0xd'),_0x53a2e0,_0x2c726e[_0xec8a('0x11')][_0xec8a('0x12')]);return _0x2b06df(_0x2c726e['error'][_0xec8a('0x12')]);}logger[_0xec8a('0x11')](_0xec8a('0xd'),_0x53a2e0,_0x2c726e['error']['message']);return _0xf53d23(_0x2c726e[_0xec8a('0x11')][_0xec8a('0x12')]);}else{logger[_0xec8a('0x13')](_0xec8a('0xd'),_0x53a2e0,'request\x20sent');_0xf53d23(_0x2c726e[_0xec8a('0x14')]['message']);}})[_0xec8a('0x15')](function(_0x1a4433){logger['error'](_0xec8a('0xd'),_0x53a2e0,_0x1a4433);_0x2b06df(_0x1a4433);});});} \ No newline at end of file +var _0x4f6d=['request','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x49217d,_0x5d7e15){var _0x409671=function(_0xfa6cf6){while(--_0xfa6cf6){_0x49217d['push'](_0x49217d['shift']());}};_0x409671(++_0x5d7e15);}(_0x4f6d,0x1a9));var _0xd4f6=function(_0x22ee06,_0x39981f){_0x22ee06=_0x22ee06-0x0;var _0x1d455c=_0x4f6d[_0x22ee06];return _0x1d455c;};'use strict';var _=require('lodash');var util=require(_0xd4f6('0x0'));var moment=require(_0xd4f6('0x1'));var BPromise=require(_0xd4f6('0x2'));var rs=require(_0xd4f6('0x3'));var fs=require('fs');var Redis=require(_0xd4f6('0x4'));var db=require(_0xd4f6('0x5'))['db'];var utils=require(_0xd4f6('0x6'));var logger=require(_0xd4f6('0x7'))(_0xd4f6('0x8'));var config=require(_0xd4f6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd4f6('0xa')][_0xd4f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2faf25,_0x245a98,_0x1d6742){return new BPromise(function(_0x281baa,_0x57f108){return client[_0xd4f6('0xc')](_0x2faf25,_0x1d6742)['then'](function(_0x149420){logger[_0xd4f6('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x245a98,_0xd4f6('0xe'));logger[_0xd4f6('0xf')](_0xd4f6('0x10'),_0x245a98,_0xd4f6('0xe'),JSON[_0xd4f6('0x11')](_0x149420));if(_0x149420[_0xd4f6('0x12')]){if(_0x149420[_0xd4f6('0x12')][_0xd4f6('0x13')]===0x1f4){logger[_0xd4f6('0x12')](_0xd4f6('0x14'),_0x245a98,_0x149420[_0xd4f6('0x12')][_0xd4f6('0x15')]);return _0x57f108(_0x149420['error'][_0xd4f6('0x15')]);}logger[_0xd4f6('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x245a98,_0x149420[_0xd4f6('0x12')]['message']);return _0x281baa(_0x149420[_0xd4f6('0x12')][_0xd4f6('0x15')]);}else{logger[_0xd4f6('0xd')](_0xd4f6('0x14'),_0x245a98,_0xd4f6('0xe'));_0x281baa(_0x149420['result'][_0xd4f6('0x15')]);}})[_0xd4f6('0x16')](function(_0x53b114){logger[_0xd4f6('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x245a98,_0x53b114);_0x57f108(_0x53b114);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 177a4a7..0be2c03 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 _0xda80=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','%s-%s%s','basename','post','single','file','create','put','update','delete'];(function(_0x401a9f,_0x133029){var _0x16750e=function(_0xe2a41){while(--_0xe2a41){_0x401a9f['push'](_0x401a9f['shift']());}};_0x16750e(++_0x133029);}(_0xda80,0x75));var _0x0da8=function(_0x46513a,_0x215d82){_0x46513a=_0x46513a-0x0;var _0x241dfb=_0xda80[_0x46513a];return _0x241dfb;};'use strict';var multer=require(_0x0da8('0x0'));var util=require(_0x0da8('0x1'));var path=require(_0x0da8('0x2'));var timeout=require(_0x0da8('0x3'));var express=require(_0x0da8('0x4'));var router=express['Router']();var auth=require(_0x0da8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0da8('0x6'));router[_0x0da8('0x7')]('/',auth[_0x0da8('0x8')](),controller[_0x0da8('0x9')]);router[_0x0da8('0x7')](_0x0da8('0xa'),auth[_0x0da8('0x8')](),controller[_0x0da8('0xb')]);router[_0x0da8('0x7')](_0x0da8('0xc'),auth['isAuthenticated'](),controller[_0x0da8('0xd')]);var upload=multer({'storage':multer[_0x0da8('0xe')]({'destination':function(_0xf7739b,_0x3d4cd1,_0x225ff3){_0x225ff3(null,path[_0x0da8('0xf')](config[_0x0da8('0x10')],_0x0da8('0x11')));},'filename':function(_0x53a43e,_0x1c7ced,_0x3b179a){_0x1c7ced[_0x0da8('0x12')]=_0x1c7ced['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b179a(null,util['format'](_0x0da8('0x13'),path[_0x0da8('0x14')](_0x1c7ced[_0x0da8('0x12')],path['extname'](_0x1c7ced[_0x0da8('0x12')])),Date['now'](),path['extname'](_0x1c7ced[_0x0da8('0x12')])));}})});router[_0x0da8('0x15')]('/',upload[_0x0da8('0x16')](_0x0da8('0x17')),controller[_0x0da8('0x18')]);router[_0x0da8('0x19')](_0x0da8('0xa'),auth[_0x0da8('0x8')](),controller[_0x0da8('0x1a')]);router['delete'](_0x0da8('0xa'),auth[_0x0da8('0x8')](),controller[_0x0da8('0x1b')]);module[_0x0da8('0x1c')]=router; \ No newline at end of file +var _0x02ef=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','create','put','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x02ef,0x1c4));var _0xf02e=function(_0x27a45d,_0x14499a){_0x27a45d=_0x27a45d-0x0;var _0x5aee32=_0x02ef[_0x27a45d];return _0x5aee32;};'use strict';var multer=require(_0xf02e('0x0'));var util=require('util');var path=require(_0xf02e('0x1'));var timeout=require(_0xf02e('0x2'));var express=require(_0xf02e('0x3'));var router=express[_0xf02e('0x4')]();var auth=require(_0xf02e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf02e('0x6'));var controller=require(_0xf02e('0x7'));router[_0xf02e('0x8')]('/',auth['isAuthenticated'](),controller[_0xf02e('0x9')]);router[_0xf02e('0x8')](_0xf02e('0xa'),auth[_0xf02e('0xb')](),controller[_0xf02e('0xc')]);router[_0xf02e('0x8')](_0xf02e('0xd'),auth[_0xf02e('0xb')](),controller['download']);var upload=multer({'storage':multer[_0xf02e('0xe')]({'destination':function(_0x3c2ba4,_0x2d435a,_0xe500de){_0xe500de(null,path[_0xf02e('0xf')](config[_0xf02e('0x10')],_0xf02e('0x11')));},'filename':function(_0x385ce3,_0x12c489,_0x46d438){_0x12c489[_0xf02e('0x12')]=_0x12c489[_0xf02e('0x12')][_0xf02e('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x46d438(null,util[_0xf02e('0x14')](_0xf02e('0x15'),path[_0xf02e('0x16')](_0x12c489['originalname'],path['extname'](_0x12c489[_0xf02e('0x12')])),Date['now'](),path[_0xf02e('0x17')](_0x12c489[_0xf02e('0x12')])));}})});router[_0xf02e('0x18')]('/',upload['single']('file'),controller[_0xf02e('0x19')]);router[_0xf02e('0x1a')](_0xf02e('0xa'),auth['isAuthenticated'](),controller[_0xf02e('0x1b')]);router[_0xf02e('0x1c')](_0xf02e('0xa'),auth[_0xf02e('0xb')](),controller[_0xf02e('0x1c')]);module[_0xf02e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 917583d..a5a4c13 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 _0x780b=['exports','STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x3328bd,_0x34b6cc){var _0xf2012a=function(_0x35a4e5){while(--_0x35a4e5){_0x3328bd['push'](_0x3328bd['shift']());}};_0xf2012a(++_0x34b6cc);}(_0x780b,0x1f0));var _0xb780=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x780b[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0xb780('0x0'));module[_0xb780('0x1')]={'name':{'type':Sequelize[_0xb780('0x2')],'unique':_0xb780('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb780('0x2')]},'display_name':{'type':Sequelize[_0xb780('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xb780('0x2')]},'original_format':{'type':Sequelize[_0xb780('0x2')]},'original_duration':{'type':Sequelize[_0xb780('0x4')]},'original_sampleCount':{'type':Sequelize[_0xb780('0x5')]},'original_channelCount':{'type':Sequelize[_0xb780('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xb780('0x2')]},'converted_duration':{'type':Sequelize[_0xb780('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xb780('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xb780('0x6')]}}; \ No newline at end of file +var _0xf436=['BIGINT','sequelize','exports','STRING','FLOAT','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf436,0x11b));var _0x6f43=function(_0x3ad134,_0x45369e){_0x3ad134=_0x3ad134-0x0;var _0x31400e=_0xf436[_0x3ad134];return _0x31400e;};'use strict';var Sequelize=require(_0x6f43('0x0'));module[_0x6f43('0x1')]={'name':{'type':Sequelize[_0x6f43('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x6f43('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x6f43('0x2')]},'original_format':{'type':Sequelize[_0x6f43('0x2')]},'original_duration':{'type':Sequelize[_0x6f43('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x6f43('0x4')]},'original_bitRate':{'type':Sequelize[_0x6f43('0x5')]},'original_sampleRate':{'type':Sequelize[_0x6f43('0x4')]},'converted_format':{'type':Sequelize[_0x6f43('0x2')]},'converted_duration':{'type':Sequelize[_0x6f43('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x6f43('0x4')]},'converted_bitRate':{'type':Sequelize[_0x6f43('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x6f43('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 2a68c81..3c1a5db 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 _0x04ac=['%s.%s','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','original_duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','original_format','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','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','Content-Range','apply','reject','then','destroy','get','Sounds','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','Sound','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','format'];(function(_0x456200,_0x3d4c03){var _0x551f2e=function(_0x807f2d){while(--_0x807f2d){_0x456200['push'](_0x456200['shift']());}};_0x551f2e(++_0x3d4c03);}(_0x04ac,0x117));var _0xc04a=function(_0x5af6c8,_0x258975){_0x5af6c8=_0x5af6c8-0x0;var _0x1d5fbb=_0x04ac[_0x5af6c8];return _0x1d5fbb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc04a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc04a('0x1'));var jsonpatch=require(_0xc04a('0x2'));var rp=require('request-promise');var moment=require(_0xc04a('0x3'));var BPromise=require(_0xc04a('0x4'));var Mustache=require(_0xc04a('0x5'));var util=require(_0xc04a('0x6'));var path=require(_0xc04a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc04a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc04a('0x9'));var crypto=require(_0xc04a('0xa'));var jsforce=require(_0xc04a('0xb'));var deskjs=require(_0xc04a('0xc'));var toCsv=require(_0xc04a('0xd'));var querystring=require('querystring');var Papa=require(_0xc04a('0xe'));var Redis=require(_0xc04a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc04a('0x10'));var as=require(_0xc04a('0x11'));var hardwareService=require(_0xc04a('0x12'));var logger=require(_0xc04a('0x13'))('api');var utils=require(_0xc04a('0x14'));var config=require(_0xc04a('0x15'));var db=require(_0xc04a('0x16'))['db'];function respondWithStatusCode(_0x5d1fbd,_0x239e28){_0x239e28=_0x239e28||0xcc;return function(_0xa26220){if(_0xa26220){return _0x5d1fbd[_0xc04a('0x17')](_0x239e28);}return _0x5d1fbd[_0xc04a('0x18')](_0x239e28)[_0xc04a('0x19')]();};}function respondWithResult(_0x5eca03,_0x5000c2){_0x5000c2=_0x5000c2||0xc8;return function(_0xdffce6){if(_0xdffce6){return _0x5eca03['status'](_0x5000c2)[_0xc04a('0x1a')](_0xdffce6);}};}function respondWithFilteredResult(_0x5c43f8,_0x264cf1){return function(_0x564ee0){if(_0x564ee0){var _0x1619c8=_0x564ee0[_0xc04a('0x1b')],_0x4492c6=_0x264cf1[_0xc04a('0x1c')],_0x2968a1=_0x264cf1[_0xc04a('0x1c')]+_0x264cf1[_0xc04a('0x1d')],_0x3b863c;if(_0x2968a1>=_0x1619c8){_0x2968a1=_0x1619c8;_0x3b863c=0xc8;}else{_0x3b863c=0xce;}_0x5c43f8[_0xc04a('0x18')](_0x3b863c);return _0x5c43f8['set'](_0xc04a('0x1e'),_0x4492c6+'-'+_0x2968a1+'/'+_0x1619c8)['json'](_0x564ee0);}return null;};}function patchUpdates(_0x251294){return function(_0x1b7762){try{jsonpatch[_0xc04a('0x1f')](_0x1b7762,_0x251294,!![]);}catch(_0x866c2e){return BPromise[_0xc04a('0x20')](_0x866c2e);}return _0x1b7762['save']();};}function saveUpdates(_0x5f128b,_0x2d2a78){return function(_0x24c4f3){if(_0x24c4f3){return _0x24c4f3['update'](_0x5f128b)[_0xc04a('0x21')](function(_0x155bd3){return _0x155bd3;});}return null;};}function removeEntity(_0x55c545,_0xab8ae9){return function(_0x430c5a){if(_0x430c5a){return _0x430c5a[_0xc04a('0x22')]()[_0xc04a('0x21')](function(){var _0x4a4d9e=_0x430c5a[_0xc04a('0x23')]({'plain':!![]});var _0x45cba0=_0xc04a('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x45cba0,'resourceId':_0x4a4d9e['id']}})[_0xc04a('0x21')](function(){return _0x430c5a;});})[_0xc04a('0x21')](function(){_0x55c545['status'](0xcc)[_0xc04a('0x19')]();});}};}function handleEntityNotFound(_0x59798c,_0x1176f5){return function(_0x52fda3){if(!_0x52fda3){_0x59798c['sendStatus'](0x194);}return _0x52fda3;};}function handleError(_0x2a3a7b,_0x3316ea){_0x3316ea=_0x3316ea||0x1f4;return function(_0xd6f8d){logger['error'](_0xd6f8d[_0xc04a('0x25')]);if(_0xd6f8d[_0xc04a('0x26')]){delete _0xd6f8d[_0xc04a('0x26')];}_0x2a3a7b[_0xc04a('0x18')](_0x3316ea)[_0xc04a('0x27')](_0xd6f8d);};}exports[_0xc04a('0x28')]=function(_0x5a12a7,_0x564072){var _0x42892f={},_0x4c37b6={},_0x24c5ae={'count':0x0,'rows':[]};var _0x5a873a=_[_0xc04a('0x29')](db['Sound'][_0xc04a('0x2a')],function(_0x4bd563){return{'name':_0x4bd563[_0xc04a('0x2b')],'type':_0x4bd563[_0xc04a('0x2c')][_0xc04a('0x2d')]};});_0x4c37b6[_0xc04a('0x2e')]=_[_0xc04a('0x29')](_0x5a873a,_0xc04a('0x26'));_0x4c37b6[_0xc04a('0x2f')]=_['keys'](_0x5a12a7['query']);_0x4c37b6[_0xc04a('0x30')]=_[_0xc04a('0x31')](_0x4c37b6['model'],_0x4c37b6[_0xc04a('0x2f')]);_0x42892f[_0xc04a('0x32')]=_['intersection'](_0x4c37b6[_0xc04a('0x2e')],qs[_0xc04a('0x33')](_0x5a12a7['query'][_0xc04a('0x33')]));_0x42892f[_0xc04a('0x32')]=_0x42892f[_0xc04a('0x32')][_0xc04a('0x34')]?_0x42892f[_0xc04a('0x32')]:_0x4c37b6[_0xc04a('0x2e')];if(!_0x5a12a7[_0xc04a('0x2f')][_0xc04a('0x35')](_0xc04a('0x36'))){_0x42892f['limit']=qs[_0xc04a('0x1d')](_0x5a12a7[_0xc04a('0x2f')][_0xc04a('0x1d')]);_0x42892f[_0xc04a('0x1c')]=qs[_0xc04a('0x1c')](_0x5a12a7['query'][_0xc04a('0x1c')]);}_0x42892f[_0xc04a('0x37')]=qs[_0xc04a('0x38')](_0x5a12a7[_0xc04a('0x2f')][_0xc04a('0x38')]);_0x42892f[_0xc04a('0x39')]=qs[_0xc04a('0x30')](_[_0xc04a('0x3a')](_0x5a12a7[_0xc04a('0x2f')],_0x4c37b6['filters']),_0x5a873a);if(_0x5a12a7[_0xc04a('0x2f')][_0xc04a('0x3b')]){_0x42892f['where']=_[_0xc04a('0x3c')](_0x42892f[_0xc04a('0x39')],{'$or':_[_0xc04a('0x29')](_0x5a873a,function(_0x1afec3){if(_0x1afec3[_0xc04a('0x2c')]!=='VIRTUAL'){var _0x1a8598={};_0x1a8598[_0x1afec3['name']]={'$like':'%'+_0x5a12a7['query'][_0xc04a('0x3b')]+'%'};return _0x1a8598;}})});}_0x42892f=_[_0xc04a('0x3c')]({},_0x42892f,_0x5a12a7[_0xc04a('0x3d')]);var _0x71481e={'where':_0x42892f[_0xc04a('0x39')]};return db['Sound']['count'](_0x71481e)['then'](function(_0x519668){_0x24c5ae['count']=_0x519668;if(_0x5a12a7[_0xc04a('0x2f')][_0xc04a('0x3e')]){_0x42892f[_0xc04a('0x3f')]=[{'all':!![]}];}return db['Sound'][_0xc04a('0x40')](_0x42892f);})[_0xc04a('0x21')](function(_0x1f6e83){_0x24c5ae['rows']=_0x1f6e83;return _0x24c5ae;})[_0xc04a('0x21')](respondWithFilteredResult(_0x564072,_0x42892f))[_0xc04a('0x41')](handleError(_0x564072,null));};exports[_0xc04a('0x42')]=function(_0xdf74c9,_0x119a89){var _0x469e74={'raw':!![],'where':{'id':_0xdf74c9[_0xc04a('0x43')]['id']}},_0x75781a={};_0x75781a[_0xc04a('0x2e')]=_[_0xc04a('0x44')](db[_0xc04a('0x45')]['rawAttributes']);_0x75781a[_0xc04a('0x2f')]=_['keys'](_0xdf74c9[_0xc04a('0x2f')]);_0x75781a['filters']=_[_0xc04a('0x31')](_0x75781a[_0xc04a('0x2e')],_0x75781a[_0xc04a('0x2f')]);_0x469e74[_0xc04a('0x32')]=_[_0xc04a('0x31')](_0x75781a['model'],qs[_0xc04a('0x33')](_0xdf74c9['query'][_0xc04a('0x33')]));_0x469e74['attributes']=_0x469e74[_0xc04a('0x32')][_0xc04a('0x34')]?_0x469e74[_0xc04a('0x32')]:_0x75781a[_0xc04a('0x2e')];if(_0xdf74c9[_0xc04a('0x2f')][_0xc04a('0x3e')]){_0x469e74['include']=[{'all':!![]}];}_0x469e74=_[_0xc04a('0x3c')]({},_0x469e74,_0xdf74c9[_0xc04a('0x3d')]);return db['Sound'][_0xc04a('0x46')](_0x469e74)[_0xc04a('0x21')](handleEntityNotFound(_0x119a89,null))['then'](respondWithResult(_0x119a89,null))[_0xc04a('0x41')](handleError(_0x119a89,null));};exports[_0xc04a('0x47')]=function(_0x2edf56,_0xd40463,_0x3ddb93){return db[_0xc04a('0x45')][_0xc04a('0x46')]({'where':{'id':_0x2edf56['params']['id']},'attributes':[_0xc04a('0x26'),_0xc04a('0x48'),_0xc04a('0x49')],'raw':!![]})[_0xc04a('0x21')](handleEntityNotFound(_0xd40463,null))[_0xc04a('0x21')](function(_0x41ab45){if(_0x41ab45){if(!fs[_0xc04a('0x4a')](path[_0xc04a('0x4b')](config[_0xc04a('0x4c')],_0xc04a('0x4d'),_0x41ab45[_0xc04a('0x48')]+'.'+_0x41ab45[_0xc04a('0x49')]))){throw new db[(_0xc04a('0x4e'))][(_0xc04a('0x4f'))]('Sound\x20not\x20found');}return _0xd40463[_0xc04a('0x47')](path[_0xc04a('0x4b')](config[_0xc04a('0x4c')],_0xc04a('0x4d'),util[_0xc04a('0x50')](_0xc04a('0x51'),_0x41ab45[_0xc04a('0x48')],_0x41ab45[_0xc04a('0x49')])),util[_0xc04a('0x50')]('%s.%s',_0x41ab45[_0xc04a('0x26')],_0x41ab45[_0xc04a('0x49')]));}return null;})[_0xc04a('0x41')](handleError(_0xd40463,null));};exports[_0xc04a('0x52')]=function(_0x1508fb,_0x102633,_0x1acd64){var _0x95af1a={'name':path[_0xc04a('0x53')](_0x1508fb[_0xc04a('0x54')][_0xc04a('0x55')],path['extname'](_0x1508fb[_0xc04a('0x54')][_0xc04a('0x55')])),'save_name':path[_0xc04a('0x53')](_0x1508fb['file'][_0xc04a('0x56')],path[_0xc04a('0x57')](_0x1508fb['file']['filename'])),'original_format':path['extname'](_0x1508fb['file']['originalname'])[_0xc04a('0x58')](0x1),'converted_format':'wav'};var _0x484eff=path[_0xc04a('0x4b')](config['root'],_0xc04a('0x59'),_0x1508fb['file']['filename']);var _0x49a495=path[_0xc04a('0x4b')](config[_0xc04a('0x4c')],_0xc04a('0x4d'),util['format'](_0xc04a('0x51'),path['basename'](_0x1508fb[_0xc04a('0x54')][_0xc04a('0x56')],path['extname'](_0x1508fb[_0xc04a('0x54')][_0xc04a('0x56')])),_0x95af1a[_0xc04a('0x49')]));logger[_0xc04a('0x5a')](_0xc04a('0x5b'),_0x484eff);logger[_0xc04a('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x49a495);try{fs[_0xc04a('0x5c')](_0x484eff,parseInt(_0xc04a('0x5d'),0x8));var _0x4f1278=sox[_0xc04a('0x5e')](_0x484eff,_0x49a495,{'sampleRate':0x1f40,'format':_0xc04a('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4f1278['on'](_0xc04a('0x60'),function(_0x3ea958){fs[_0xc04a('0x61')](_0x484eff);_0x102633[_0xc04a('0x18')](0x1f4)[_0xc04a('0x27')](_0x3ea958);});_0x4f1278['on']('src',function(_0x3e5781){_0x95af1a[_0xc04a('0x62')]=isNaN(_0x3e5781['duration'])?null:_0x3e5781['duration']*0x3e8;_0x95af1a[_0xc04a('0x63')]=isNaN(_0x3e5781[_0xc04a('0x64')])?null:_0x3e5781[_0xc04a('0x64')];_0x95af1a[_0xc04a('0x65')]=isNaN(_0x3e5781[_0xc04a('0x66')])?null:_0x3e5781['channelCount'];_0x95af1a[_0xc04a('0x67')]=isNaN(_0x3e5781[_0xc04a('0x68')])?null:_0x3e5781[_0xc04a('0x68')];_0x95af1a['original_sampleRate']=isNaN(_0x3e5781[_0xc04a('0x69')])?null:_0x3e5781[_0xc04a('0x69')];});_0x4f1278['on'](_0xc04a('0x6a'),function(_0x377935){_0x95af1a[_0xc04a('0x6b')]=isNaN(_0x377935['duration'])?null:_0x377935[_0xc04a('0x6c')]*0x3e8;_0x95af1a[_0xc04a('0x6d')]=isNaN(_0x377935[_0xc04a('0x64')])?null:_0x377935[_0xc04a('0x64')];_0x95af1a['converted_channelCount']=isNaN(_0x377935[_0xc04a('0x66')])?null:_0x377935['channelCount'];_0x95af1a[_0xc04a('0x6e')]=isNaN(_0x377935[_0xc04a('0x68')])?null:_0x377935['bitRate'];_0x95af1a[_0xc04a('0x6f')]=isNaN(_0x377935[_0xc04a('0x69')])?null:_0x377935[_0xc04a('0x69')];});_0x4f1278['on'](_0xc04a('0x19'),function(){fs['chmodSync'](_0x49a495,parseInt(_0xc04a('0x5d'),0x8));return db['Sound'][_0xc04a('0x52')](_0x95af1a)[_0xc04a('0x21')](function(_0x411737){var _0x559252={'role':_0x1508fb[_0xc04a('0x70')]['role'],'userProfileId':_0x1508fb['body'][_0xc04a('0x71')]};if(!_0x559252)throw new Error(_0xc04a('0x72'));if(_0x559252[_0xc04a('0x73')]==='user'){var _0x41c0e2=_0x411737[_0xc04a('0x23')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xc04a('0x24'),'userProfileId':_0x559252[_0xc04a('0x71')]},'raw':!![]})[_0xc04a('0x21')](function(_0x241557){if(_0x241557&&_0x241557[_0xc04a('0x74')]===0x0){return db['UserProfileResource'][_0xc04a('0x52')]({'name':_0x41c0e2[_0xc04a('0x26')],'resourceId':_0x41c0e2['id'],'type':_0x241557[_0xc04a('0x26')],'sectionId':_0x241557['id']},{})[_0xc04a('0x21')](function(){return _0x411737;});}else{return _0x411737;}})['catch'](function(_0x526924){logger[_0xc04a('0x60')](_0xc04a('0x75'),_0x526924);throw _0x526924;});}return _0x411737;})['then'](respondWithResult(_0x102633,null))['catch'](handleError(_0x102633,null));});_0x4f1278['start']();}catch(_0x17bcd0){_0x102633[_0xc04a('0x18')](0x1f4)[_0xc04a('0x27')](_0x17bcd0);}};exports[_0xc04a('0x76')]=function(_0x25adb5,_0x494430,_0x1c2726){return db[_0xc04a('0x45')][_0xc04a('0x46')]({'where':{'id':_0x25adb5[_0xc04a('0x43')]['id']}})[_0xc04a('0x21')](handleEntityNotFound(_0x494430,null))[_0xc04a('0x21')](saveUpdates(_[_0xc04a('0x3a')](_0x25adb5[_0xc04a('0x70')],[_0xc04a('0x26'),'description']),null))[_0xc04a('0x21')](respondWithResult(_0x494430,null))['catch'](handleError(_0x494430,null));};exports['delete']=function(_0x5603ee,_0x180a3a,_0x3d3e90){return db['Sound']['find']({'where':{'id':_0x5603ee[_0xc04a('0x43')]['id']}})[_0xc04a('0x21')](function(_0x2b7cc9){if(_0x2b7cc9){return _0x2b7cc9[_0xc04a('0x22')]();}})[_0xc04a('0x21')](function(_0x50376c){var _0x4aaba2=path[_0xc04a('0x4b')](config[_0xc04a('0x4c')],_0xc04a('0x59'),util['format'](_0xc04a('0x51'),_0x50376c[_0xc04a('0x48')],_0x50376c[_0xc04a('0x77')]));var _0x39d929=path[_0xc04a('0x4b')](config[_0xc04a('0x4c')],'server/files/sounds/converted',util['format'](_0xc04a('0x51'),_0x50376c[_0xc04a('0x48')],_0x50376c[_0xc04a('0x49')]));fs['unlinkSync'](_0x4aaba2);fs[_0xc04a('0x61')](_0x39d929);return _0x50376c;})[_0xc04a('0x21')](function(_0x4cc502){if(_0x4cc502){return _0x180a3a['status'](0xcc)[_0xc04a('0x19')]();}})[_0xc04a('0x21')](handleEntityNotFound(_0x180a3a,null))[_0xc04a('0x41')](handleError(_0x180a3a,null));}; \ No newline at end of file +var _0xde5b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','Sounds','UserProfileResource','sendStatus','error','stack','name','send','Sound','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','merge','map','type','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','basename','file','originalname','extname','filename','substring','wav','format','info','Sound\x20upload\x20destination:\x20%s','transcode','src','original_duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','server/files/sounds/original','original_format','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xde5b,0x1e8));var _0xbde5=function(_0x1d933c,_0x3263af){_0x1d933c=_0x1d933c-0x0;var _0x3fb831=_0xde5b[_0x1d933c];return _0x3fb831;};'use strict';var pdf=require(_0xbde5('0x0'));var emlformat=require(_0xbde5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbde5('0x2'));var jsonpatch=require(_0xbde5('0x3'));var rp=require(_0xbde5('0x4'));var moment=require('moment');var BPromise=require(_0xbde5('0x5'));var Mustache=require(_0xbde5('0x6'));var util=require('util');var path=require(_0xbde5('0x7'));var sox=require(_0xbde5('0x8'));var csv=require(_0xbde5('0x9'));var ejs=require(_0xbde5('0xa'));var fs=require('fs');var _=require(_0xbde5('0xb'));var squel=require('squel');var crypto=require(_0xbde5('0xc'));var jsforce=require(_0xbde5('0xd'));var deskjs=require(_0xbde5('0xe'));var toCsv=require(_0xbde5('0x9'));var querystring=require(_0xbde5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbde5('0x10'));var qs=require(_0xbde5('0x11'));var as=require(_0xbde5('0x12'));var hardwareService=require(_0xbde5('0x13'));var logger=require(_0xbde5('0x14'))(_0xbde5('0x15'));var utils=require(_0xbde5('0x16'));var config=require(_0xbde5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x152230,_0x21fd75){_0x21fd75=_0x21fd75||0xcc;return function(_0x4fa320){if(_0x4fa320){return _0x152230['sendStatus'](_0x21fd75);}return _0x152230[_0xbde5('0x18')](_0x21fd75)[_0xbde5('0x19')]();};}function respondWithResult(_0x3fb070,_0x145120){_0x145120=_0x145120||0xc8;return function(_0x395023){if(_0x395023){return _0x3fb070[_0xbde5('0x18')](_0x145120)[_0xbde5('0x1a')](_0x395023);}};}function respondWithFilteredResult(_0x41dc4d,_0x1b1146){return function(_0x5911b8){if(_0x5911b8){var _0x5a667f=_0x5911b8[_0xbde5('0x1b')],_0x71d9e=_0x1b1146[_0xbde5('0x1c')],_0x45c2d1=_0x1b1146[_0xbde5('0x1c')]+_0x1b1146[_0xbde5('0x1d')],_0xffc01;if(_0x45c2d1>=_0x5a667f){_0x45c2d1=_0x5a667f;_0xffc01=0xc8;}else{_0xffc01=0xce;}_0x41dc4d[_0xbde5('0x18')](_0xffc01);return _0x41dc4d['set'](_0xbde5('0x1e'),_0x71d9e+'-'+_0x45c2d1+'/'+_0x5a667f)[_0xbde5('0x1a')](_0x5911b8);}return null;};}function patchUpdates(_0x554888){return function(_0x2f8397){try{jsonpatch['apply'](_0x2f8397,_0x554888,!![]);}catch(_0x380da4){return BPromise['reject'](_0x380da4);}return _0x2f8397[_0xbde5('0x1f')]();};}function saveUpdates(_0x139846,_0x1812f4){return function(_0x20778a){if(_0x20778a){return _0x20778a[_0xbde5('0x20')](_0x139846)[_0xbde5('0x21')](function(_0x2be70f){return _0x2be70f;});}return null;};}function removeEntity(_0x3511d9,_0x4b4f32){return function(_0x5d4d82){if(_0x5d4d82){return _0x5d4d82[_0xbde5('0x22')]()[_0xbde5('0x21')](function(){var _0x35a584=_0x5d4d82['get']({'plain':!![]});var _0x4643a8=_0xbde5('0x23');return db[_0xbde5('0x24')][_0xbde5('0x22')]({'where':{'type':_0x4643a8,'resourceId':_0x35a584['id']}})['then'](function(){return _0x5d4d82;});})['then'](function(){_0x3511d9[_0xbde5('0x18')](0xcc)[_0xbde5('0x19')]();});}};}function handleEntityNotFound(_0x695016,_0xc8b9f9){return function(_0x402174){if(!_0x402174){_0x695016[_0xbde5('0x25')](0x194);}return _0x402174;};}function handleError(_0x16511c,_0x5bc4d5){_0x5bc4d5=_0x5bc4d5||0x1f4;return function(_0x226e67){logger[_0xbde5('0x26')](_0x226e67[_0xbde5('0x27')]);if(_0x226e67[_0xbde5('0x28')]){delete _0x226e67[_0xbde5('0x28')];}_0x16511c[_0xbde5('0x18')](_0x5bc4d5)[_0xbde5('0x29')](_0x226e67);};}exports['index']=function(_0x31b3d7,_0x3925c3){var _0x343f95={},_0xa65464={},_0x1777ef={'count':0x0,'rows':[]};var _0x4129cc=_['map'](db[_0xbde5('0x2a')][_0xbde5('0x2b')],function(_0x970ee8){return{'name':_0x970ee8['fieldName'],'type':_0x970ee8['type'][_0xbde5('0x2c')]};});_0xa65464[_0xbde5('0x2d')]=_['map'](_0x4129cc,'name');_0xa65464[_0xbde5('0x2e')]=_[_0xbde5('0x2f')](_0x31b3d7[_0xbde5('0x2e')]);_0xa65464[_0xbde5('0x30')]=_['intersection'](_0xa65464[_0xbde5('0x2d')],_0xa65464[_0xbde5('0x2e')]);_0x343f95[_0xbde5('0x31')]=_[_0xbde5('0x32')](_0xa65464[_0xbde5('0x2d')],qs['fields'](_0x31b3d7['query'][_0xbde5('0x33')]));_0x343f95[_0xbde5('0x31')]=_0x343f95[_0xbde5('0x31')][_0xbde5('0x34')]?_0x343f95[_0xbde5('0x31')]:_0xa65464[_0xbde5('0x2d')];if(!_0x31b3d7[_0xbde5('0x2e')]['hasOwnProperty'](_0xbde5('0x35'))){_0x343f95['limit']=qs[_0xbde5('0x1d')](_0x31b3d7[_0xbde5('0x2e')]['limit']);_0x343f95[_0xbde5('0x1c')]=qs['offset'](_0x31b3d7[_0xbde5('0x2e')][_0xbde5('0x1c')]);}_0x343f95[_0xbde5('0x36')]=qs[_0xbde5('0x37')](_0x31b3d7[_0xbde5('0x2e')]['sort']);_0x343f95['where']=qs[_0xbde5('0x30')](_['pick'](_0x31b3d7[_0xbde5('0x2e')],_0xa65464[_0xbde5('0x30')]),_0x4129cc);if(_0x31b3d7['query'][_0xbde5('0x38')]){_0x343f95['where']=_[_0xbde5('0x39')](_0x343f95['where'],{'$or':_[_0xbde5('0x3a')](_0x4129cc,function(_0x568b75){if(_0x568b75[_0xbde5('0x3b')]!==_0xbde5('0x3c')){var _0x1b632c={};_0x1b632c[_0x568b75['name']]={'$like':'%'+_0x31b3d7[_0xbde5('0x2e')][_0xbde5('0x38')]+'%'};return _0x1b632c;}})});}_0x343f95=_[_0xbde5('0x39')]({},_0x343f95,_0x31b3d7[_0xbde5('0x3d')]);var _0xbe81b={'where':_0x343f95[_0xbde5('0x3e')]};return db[_0xbde5('0x2a')][_0xbde5('0x1b')](_0xbe81b)[_0xbde5('0x21')](function(_0x314e2c){_0x1777ef[_0xbde5('0x1b')]=_0x314e2c;if(_0x31b3d7[_0xbde5('0x2e')][_0xbde5('0x3f')]){_0x343f95[_0xbde5('0x40')]=[{'all':!![]}];}return db[_0xbde5('0x2a')][_0xbde5('0x41')](_0x343f95);})['then'](function(_0x21cb62){_0x1777ef[_0xbde5('0x42')]=_0x21cb62;return _0x1777ef;})['then'](respondWithFilteredResult(_0x3925c3,_0x343f95))[_0xbde5('0x43')](handleError(_0x3925c3,null));};exports[_0xbde5('0x44')]=function(_0xd6b7e,_0x5a9b71){var _0x2a2640={'raw':!![],'where':{'id':_0xd6b7e[_0xbde5('0x45')]['id']}},_0x421a7e={};_0x421a7e['model']=_[_0xbde5('0x2f')](db[_0xbde5('0x2a')]['rawAttributes']);_0x421a7e['query']=_['keys'](_0xd6b7e[_0xbde5('0x2e')]);_0x421a7e[_0xbde5('0x30')]=_['intersection'](_0x421a7e[_0xbde5('0x2d')],_0x421a7e[_0xbde5('0x2e')]);_0x2a2640[_0xbde5('0x31')]=_['intersection'](_0x421a7e[_0xbde5('0x2d')],qs[_0xbde5('0x33')](_0xd6b7e[_0xbde5('0x2e')][_0xbde5('0x33')]));_0x2a2640[_0xbde5('0x31')]=_0x2a2640['attributes'][_0xbde5('0x34')]?_0x2a2640[_0xbde5('0x31')]:_0x421a7e[_0xbde5('0x2d')];if(_0xd6b7e[_0xbde5('0x2e')][_0xbde5('0x3f')]){_0x2a2640[_0xbde5('0x40')]=[{'all':!![]}];}_0x2a2640=_[_0xbde5('0x39')]({},_0x2a2640,_0xd6b7e[_0xbde5('0x3d')]);return db[_0xbde5('0x2a')][_0xbde5('0x46')](_0x2a2640)[_0xbde5('0x21')](handleEntityNotFound(_0x5a9b71,null))[_0xbde5('0x21')](respondWithResult(_0x5a9b71,null))[_0xbde5('0x43')](handleError(_0x5a9b71,null));};exports[_0xbde5('0x47')]=function(_0x4a7d7a,_0x43dcaf,_0x1d76a2){return db[_0xbde5('0x2a')][_0xbde5('0x46')]({'where':{'id':_0x4a7d7a[_0xbde5('0x45')]['id']},'attributes':[_0xbde5('0x28'),_0xbde5('0x48'),_0xbde5('0x49')],'raw':!![]})[_0xbde5('0x21')](handleEntityNotFound(_0x43dcaf,null))[_0xbde5('0x21')](function(_0x45ec99){if(_0x45ec99){if(!fs[_0xbde5('0x4a')](path[_0xbde5('0x4b')](config[_0xbde5('0x4c')],_0xbde5('0x4d'),_0x45ec99[_0xbde5('0x48')]+'.'+_0x45ec99[_0xbde5('0x49')]))){throw new db[(_0xbde5('0x4e'))][(_0xbde5('0x4f'))](_0xbde5('0x50'));}return _0x43dcaf['download'](path[_0xbde5('0x4b')](config[_0xbde5('0x4c')],_0xbde5('0x4d'),util['format'](_0xbde5('0x51'),_0x45ec99[_0xbde5('0x48')],_0x45ec99[_0xbde5('0x49')])),util['format']('%s.%s',_0x45ec99[_0xbde5('0x28')],_0x45ec99[_0xbde5('0x49')]));}return null;})[_0xbde5('0x43')](handleError(_0x43dcaf,null));};exports['create']=function(_0x22ff31,_0x3b6f8d,_0x44040b){var _0x42988c={'name':path[_0xbde5('0x52')](_0x22ff31[_0xbde5('0x53')][_0xbde5('0x54')],path[_0xbde5('0x55')](_0x22ff31[_0xbde5('0x53')][_0xbde5('0x54')])),'save_name':path[_0xbde5('0x52')](_0x22ff31[_0xbde5('0x53')]['filename'],path[_0xbde5('0x55')](_0x22ff31[_0xbde5('0x53')][_0xbde5('0x56')])),'original_format':path[_0xbde5('0x55')](_0x22ff31[_0xbde5('0x53')][_0xbde5('0x54')])[_0xbde5('0x57')](0x1),'converted_format':_0xbde5('0x58')};var _0x17f758=path[_0xbde5('0x4b')](config[_0xbde5('0x4c')],'server/files/sounds/original',_0x22ff31[_0xbde5('0x53')][_0xbde5('0x56')]);var _0x4d65b5=path[_0xbde5('0x4b')](config[_0xbde5('0x4c')],_0xbde5('0x4d'),util[_0xbde5('0x59')]('%s.%s',path[_0xbde5('0x52')](_0x22ff31['file'][_0xbde5('0x56')],path[_0xbde5('0x55')](_0x22ff31[_0xbde5('0x53')]['filename'])),_0x42988c['converted_format']));logger[_0xbde5('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x17f758);logger[_0xbde5('0x5a')](_0xbde5('0x5b'),_0x4d65b5);try{fs['chmodSync'](_0x17f758,parseInt('0777',0x8));var _0x180fc3=sox[_0xbde5('0x5c')](_0x17f758,_0x4d65b5,{'sampleRate':0x1f40,'format':_0xbde5('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x180fc3['on']('error',function(_0x4172ac){fs['unlinkSync'](_0x17f758);_0x3b6f8d['status'](0x1f4)[_0xbde5('0x29')](_0x4172ac);});_0x180fc3['on'](_0xbde5('0x5d'),function(_0x22579f){_0x42988c[_0xbde5('0x5e')]=isNaN(_0x22579f['duration'])?null:_0x22579f['duration']*0x3e8;_0x42988c[_0xbde5('0x5f')]=isNaN(_0x22579f['sampleCount'])?null:_0x22579f[_0xbde5('0x60')];_0x42988c[_0xbde5('0x61')]=isNaN(_0x22579f[_0xbde5('0x62')])?null:_0x22579f[_0xbde5('0x62')];_0x42988c[_0xbde5('0x63')]=isNaN(_0x22579f[_0xbde5('0x64')])?null:_0x22579f[_0xbde5('0x64')];_0x42988c[_0xbde5('0x65')]=isNaN(_0x22579f[_0xbde5('0x66')])?null:_0x22579f['sampleRate'];});_0x180fc3['on'](_0xbde5('0x67'),function(_0x167316){_0x42988c[_0xbde5('0x68')]=isNaN(_0x167316[_0xbde5('0x69')])?null:_0x167316[_0xbde5('0x69')]*0x3e8;_0x42988c[_0xbde5('0x6a')]=isNaN(_0x167316['sampleCount'])?null:_0x167316[_0xbde5('0x60')];_0x42988c['converted_channelCount']=isNaN(_0x167316[_0xbde5('0x62')])?null:_0x167316[_0xbde5('0x62')];_0x42988c[_0xbde5('0x6b')]=isNaN(_0x167316[_0xbde5('0x64')])?null:_0x167316[_0xbde5('0x64')];_0x42988c[_0xbde5('0x6c')]=isNaN(_0x167316[_0xbde5('0x66')])?null:_0x167316[_0xbde5('0x66')];});_0x180fc3['on'](_0xbde5('0x19'),function(){fs[_0xbde5('0x6d')](_0x4d65b5,parseInt('0777',0x8));return db[_0xbde5('0x2a')][_0xbde5('0x6e')](_0x42988c)[_0xbde5('0x21')](function(_0x5f42af){var _0x1fccc3={'role':_0x22ff31['body'][_0xbde5('0x6f')],'userProfileId':_0x22ff31[_0xbde5('0x70')][_0xbde5('0x71')]};if(!_0x1fccc3)throw new Error(_0xbde5('0x72'));if(_0x1fccc3[_0xbde5('0x6f')]==='user'){var _0x53cdfd=_0x5f42af[_0xbde5('0x73')]({'plain':!![]});return db[_0xbde5('0x74')][_0xbde5('0x46')]({'where':{'name':'Sounds','userProfileId':_0x1fccc3[_0xbde5('0x71')]},'raw':!![]})['then'](function(_0x23e75d){if(_0x23e75d&&_0x23e75d[_0xbde5('0x75')]===0x0){return db[_0xbde5('0x24')]['create']({'name':_0x53cdfd[_0xbde5('0x28')],'resourceId':_0x53cdfd['id'],'type':_0x23e75d['name'],'sectionId':_0x23e75d['id']},{})[_0xbde5('0x21')](function(){return _0x5f42af;});}else{return _0x5f42af;}})[_0xbde5('0x43')](function(_0x5ca7e8){logger[_0xbde5('0x26')](_0xbde5('0x76'),_0x5ca7e8);throw _0x5ca7e8;});}return _0x5f42af;})[_0xbde5('0x21')](respondWithResult(_0x3b6f8d,null))[_0xbde5('0x43')](handleError(_0x3b6f8d,null));});_0x180fc3[_0xbde5('0x77')]();}catch(_0x3aef25){_0x3b6f8d[_0xbde5('0x18')](0x1f4)[_0xbde5('0x29')](_0x3aef25);}};exports[_0xbde5('0x20')]=function(_0x3b649f,_0x490092,_0x10a340){return db[_0xbde5('0x2a')][_0xbde5('0x46')]({'where':{'id':_0x3b649f[_0xbde5('0x45')]['id']}})[_0xbde5('0x21')](handleEntityNotFound(_0x490092,null))[_0xbde5('0x21')](saveUpdates(_[_0xbde5('0x78')](_0x3b649f[_0xbde5('0x70')],[_0xbde5('0x28'),_0xbde5('0x79')]),null))['then'](respondWithResult(_0x490092,null))['catch'](handleError(_0x490092,null));};exports[_0xbde5('0x7a')]=function(_0x536ecb,_0x1972c7,_0x434bd0){return db['Sound']['find']({'where':{'id':_0x536ecb[_0xbde5('0x45')]['id']}})[_0xbde5('0x21')](function(_0x2f74bb){if(_0x2f74bb){return _0x2f74bb[_0xbde5('0x22')]();}})[_0xbde5('0x21')](function(_0x375a25){var _0xaa71fd=path['join'](config[_0xbde5('0x4c')],_0xbde5('0x7b'),util[_0xbde5('0x59')](_0xbde5('0x51'),_0x375a25[_0xbde5('0x48')],_0x375a25[_0xbde5('0x7c')]));var _0x275d9e=path[_0xbde5('0x4b')](config[_0xbde5('0x4c')],'server/files/sounds/converted',util[_0xbde5('0x59')](_0xbde5('0x51'),_0x375a25[_0xbde5('0x48')],_0x375a25[_0xbde5('0x49')]));fs[_0xbde5('0x7d')](_0xaa71fd);fs[_0xbde5('0x7d')](_0x275d9e);return _0x375a25;})['then'](function(_0x4925c8){if(_0x4925c8){return _0x1972c7['status'](0xcc)[_0xbde5('0x19')]();}})['then'](handleEntityNotFound(_0x1972c7,null))[_0xbde5('0x43')](handleError(_0x1972c7,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d9cf776..e0add5b 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 _0xc2cd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','Sound','lodash','util','../../config/logger','api'];(function(_0x42f672,_0x1c91e2){var _0x265442=function(_0x14db9a){while(--_0x14db9a){_0x42f672['push'](_0x42f672['shift']());}};_0x265442(++_0x1c91e2);}(_0xc2cd,0x1ea));var _0xdc2c=function(_0x125d2a,_0x5b11cd){_0x125d2a=_0x125d2a-0x0;var _0x4aca8e=_0xc2cd[_0x125d2a];return _0x4aca8e;};'use strict';var _=require(_0xdc2c('0x0'));var util=require(_0xdc2c('0x1'));var logger=require(_0xdc2c('0x2'))(_0xdc2c('0x3'));var moment=require(_0xdc2c('0x4'));var BPromise=require(_0xdc2c('0x5'));var rp=require(_0xdc2c('0x6'));var fs=require('fs');var path=require(_0xdc2c('0x7'));var rimraf=require(_0xdc2c('0x8'));var config=require(_0xdc2c('0x9'));var attributes=require(_0xdc2c('0xa'));module[_0xdc2c('0xb')]=function(_0x34f6e9,_0x4f804e){return _0x34f6e9['define'](_0xdc2c('0xc'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb679=['moment','request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util'];(function(_0x4706af,_0x24b450){var _0x2f75c4=function(_0x415a9a){while(--_0x415a9a){_0x4706af['push'](_0x4706af['shift']());}};_0x2f75c4(++_0x24b450);}(_0xb679,0x1e8));var _0x9b67=function(_0x3ff2b4,_0x4554b6){_0x3ff2b4=_0x3ff2b4-0x0;var _0x2d05b8=_0xb679[_0x3ff2b4];return _0x2d05b8;};'use strict';var _=require(_0x9b67('0x0'));var util=require(_0x9b67('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9b67('0x2'));var BPromise=require('bluebird');var rp=require(_0x9b67('0x3'));var fs=require('fs');var path=require(_0x9b67('0x4'));var rimraf=require('rimraf');var config=require(_0x9b67('0x5'));var attributes=require(_0x9b67('0x6'));module[_0x9b67('0x7')]=function(_0x457f6c,_0x5b0ec2){return _0x457f6c[_0x9b67('0x8')](_0x9b67('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index dd99459..c623849 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 _0xdda1=['attributes','include','model','map','ShowSound','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Sound','find','options','raw','where'];(function(_0x46932c,_0x19d83f){var _0x5069c1=function(_0x2d4da0){while(--_0x2d4da0){_0x46932c['push'](_0x46932c['shift']());}};_0x5069c1(++_0x19d83f);}(_0xdda1,0x146));var _0x1dda=function(_0x2f4214,_0x1723da){_0x2f4214=_0x2f4214-0x0;var _0x144e05=_0xdda1[_0x2f4214];return _0x144e05;};'use strict';var _=require('lodash');var util=require(_0x1dda('0x0'));var moment=require('moment');var BPromise=require(_0x1dda('0x1'));var rs=require(_0x1dda('0x2'));var fs=require('fs');var Redis=require(_0x1dda('0x3'));var db=require(_0x1dda('0x4'))['db'];var utils=require(_0x1dda('0x5'));var logger=require(_0x1dda('0x6'))('rpc');var config=require(_0x1dda('0x7'));var jayson=require(_0x1dda('0x8'));var client=jayson['client'][_0x1dda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x465c60,_0x2e6060,_0x2fc9ab){return new BPromise(function(_0x3ec640,_0x515367){return client[_0x1dda('0xa')](_0x465c60,_0x2fc9ab)[_0x1dda('0xb')](function(_0x118919){logger[_0x1dda('0xc')](_0x1dda('0xd'),_0x2e6060,'request\x20sent');logger[_0x1dda('0xe')](_0x1dda('0xf'),_0x2e6060,'request\x20sent',JSON[_0x1dda('0x10')](_0x118919));if(_0x118919[_0x1dda('0x11')]){if(_0x118919[_0x1dda('0x11')][_0x1dda('0x12')]===0x1f4){logger['error'](_0x1dda('0xd'),_0x2e6060,_0x118919[_0x1dda('0x11')][_0x1dda('0x13')]);return _0x515367(_0x118919[_0x1dda('0x11')]['message']);}logger[_0x1dda('0x11')](_0x1dda('0xd'),_0x2e6060,_0x118919[_0x1dda('0x11')][_0x1dda('0x13')]);return _0x3ec640(_0x118919[_0x1dda('0x11')][_0x1dda('0x13')]);}else{logger[_0x1dda('0xc')](_0x1dda('0xd'),_0x2e6060,'request\x20sent');_0x3ec640(_0x118919[_0x1dda('0x14')][_0x1dda('0x13')]);}})['catch'](function(_0x3ab1c3){logger['error'](_0x1dda('0xd'),_0x2e6060,_0x3ab1c3);_0x515367(_0x3ab1c3);});});}exports['ShowSound']=function(_0x38aff5){var _0x3c7bc0=this;return new Promise(function(_0x14d1f8,_0x64cd00){return db[_0x1dda('0x15')][_0x1dda('0x16')]({'raw':_0x38aff5[_0x1dda('0x17')]?_0x38aff5[_0x1dda('0x17')][_0x1dda('0x18')]===undefined?!![]:![]:!![],'where':_0x38aff5[_0x1dda('0x17')]?_0x38aff5[_0x1dda('0x17')][_0x1dda('0x19')]||null:null,'attributes':_0x38aff5[_0x1dda('0x17')]?_0x38aff5['options'][_0x1dda('0x1a')]||null:null,'include':_0x38aff5[_0x1dda('0x17')]?_0x38aff5['options'][_0x1dda('0x1b')]?_['map'](_0x38aff5['options'][_0x1dda('0x1b')],function(_0x3a5523){return{'model':db[_0x3a5523['model']],'as':_0x3a5523['as'],'attributes':_0x3a5523[_0x1dda('0x1a')],'include':_0x3a5523[_0x1dda('0x1b')]?_['map'](_0x3a5523[_0x1dda('0x1b')],function(_0x171d35){return{'model':db[_0x171d35[_0x1dda('0x1c')]],'as':_0x171d35['as'],'attributes':_0x171d35[_0x1dda('0x1a')],'include':_0x171d35[_0x1dda('0x1b')]?_[_0x1dda('0x1d')](_0x171d35[_0x1dda('0x1b')],function(_0x515347){return{'model':db[_0x515347[_0x1dda('0x1c')]],'as':_0x515347['as'],'attributes':_0x515347[_0x1dda('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1dda('0xb')](function(_0x56c11c){logger['info'](_0x1dda('0x1e'),_0x38aff5);logger[_0x1dda('0xe')]('ShowSound',_0x38aff5,JSON[_0x1dda('0x10')](_0x56c11c));_0x14d1f8(_0x56c11c);})[_0x1dda('0x1f')](function(_0x3e0a26){logger[_0x1dda('0x11')](_0x1dda('0x1e'),_0x3e0a26[_0x1dda('0x13')],_0x38aff5);_0x64cd00(_0x3c7bc0[_0x1dda('0x11')](0x1f4,_0x3e0a26[_0x1dda('0x13')]));});});}; \ No newline at end of file +var _0x628f=['request','then','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','result','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x487524,_0x156859){var _0x37a620=function(_0x13dc0b){while(--_0x13dc0b){_0x487524['push'](_0x487524['shift']());}};_0x37a620(++_0x156859);}(_0x628f,0x104));var _0xf628=function(_0x4a2fde,_0x190c2f){_0x4a2fde=_0x4a2fde-0x0;var _0x52ab47=_0x628f[_0x4a2fde];return _0x52ab47;};'use strict';var _=require(_0xf628('0x0'));var util=require('util');var moment=require(_0xf628('0x1'));var BPromise=require(_0xf628('0x2'));var rs=require(_0xf628('0x3'));var fs=require('fs');var Redis=require(_0xf628('0x4'));var db=require(_0xf628('0x5'))['db'];var utils=require(_0xf628('0x6'));var logger=require(_0xf628('0x7'))(_0xf628('0x8'));var config=require('../../config/environment');var jayson=require(_0xf628('0x9'));var client=jayson[_0xf628('0xa')][_0xf628('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47f23a,_0x2b2771,_0x17cd48){return new BPromise(function(_0x643280,_0x2e74a2){return client[_0xf628('0xc')](_0x47f23a,_0x17cd48)[_0xf628('0xd')](function(_0x36a197){logger[_0xf628('0xe')]('Sound,\x20%s,\x20%s',_0x2b2771,_0xf628('0xf'));logger[_0xf628('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x2b2771,_0xf628('0xf'),JSON[_0xf628('0x11')](_0x36a197));if(_0x36a197['error']){if(_0x36a197[_0xf628('0x12')][_0xf628('0x13')]===0x1f4){logger[_0xf628('0x12')](_0xf628('0x14'),_0x2b2771,_0x36a197['error']['message']);return _0x2e74a2(_0x36a197[_0xf628('0x12')][_0xf628('0x15')]);}logger[_0xf628('0x12')]('Sound,\x20%s,\x20%s',_0x2b2771,_0x36a197[_0xf628('0x12')]['message']);return _0x643280(_0x36a197['error'][_0xf628('0x15')]);}else{logger['info'](_0xf628('0x14'),_0x2b2771,_0xf628('0xf'));_0x643280(_0x36a197[_0xf628('0x16')]['message']);}})['catch'](function(_0x4e0f1c){logger[_0xf628('0x12')](_0xf628('0x14'),_0x2b2771,_0x4e0f1c);_0x2e74a2(_0x4e0f1c);});});}exports[_0xf628('0x17')]=function(_0x489ba1){var _0x25195c=this;return new Promise(function(_0x6f544c,_0x3d565e){return db[_0xf628('0x18')][_0xf628('0x19')]({'raw':_0x489ba1['options']?_0x489ba1[_0xf628('0x1a')][_0xf628('0x1b')]===undefined?!![]:![]:!![],'where':_0x489ba1['options']?_0x489ba1[_0xf628('0x1a')][_0xf628('0x1c')]||null:null,'attributes':_0x489ba1[_0xf628('0x1a')]?_0x489ba1[_0xf628('0x1a')][_0xf628('0x1d')]||null:null,'include':_0x489ba1['options']?_0x489ba1[_0xf628('0x1a')][_0xf628('0x1e')]?_[_0xf628('0x1f')](_0x489ba1['options'][_0xf628('0x1e')],function(_0x18bc3c){return{'model':db[_0x18bc3c[_0xf628('0x20')]],'as':_0x18bc3c['as'],'attributes':_0x18bc3c['attributes'],'include':_0x18bc3c[_0xf628('0x1e')]?_[_0xf628('0x1f')](_0x18bc3c[_0xf628('0x1e')],function(_0x398532){return{'model':db[_0x398532['model']],'as':_0x398532['as'],'attributes':_0x398532[_0xf628('0x1d')],'include':_0x398532['include']?_[_0xf628('0x1f')](_0x398532['include'],function(_0x4b02d7){return{'model':db[_0x4b02d7[_0xf628('0x20')]],'as':_0x4b02d7['as'],'attributes':_0x4b02d7[_0xf628('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf628('0xd')](function(_0x5dfdde){logger[_0xf628('0xe')]('ShowSound',_0x489ba1);logger[_0xf628('0x10')](_0xf628('0x17'),_0x489ba1,JSON[_0xf628('0x11')](_0x5dfdde));_0x6f544c(_0x5dfdde);})[_0xf628('0x21')](function(_0x12807d){logger[_0xf628('0x12')](_0xf628('0x17'),_0x12807d['message'],_0x489ba1);_0x3d565e(_0x25195c[_0xf628('0x12')](0x1f4,_0x12807d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 1019bd7..b02e4c9 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 _0x8601=['create','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x2b51f7,_0x1b2059){var _0x12029c=function(_0x53bc73){while(--_0x53bc73){_0x2b51f7['push'](_0x2b51f7['shift']());}};_0x12029c(++_0x1b2059);}(_0x8601,0x1f1));var _0x1860=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8601[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x1860('0x0'));var util=require(_0x1860('0x1'));var path=require('path');var timeout=require(_0x1860('0x2'));var express=require(_0x1860('0x3'));var router=express[_0x1860('0x4')]();var auth=require(_0x1860('0x5'));var interaction=require(_0x1860('0x6'));var config=require(_0x1860('0x7'));var controller=require('./squareMessage.controller');router[_0x1860('0x8')]('/',auth[_0x1860('0x9')](),controller['index']);router[_0x1860('0x8')](_0x1860('0xa'),auth[_0x1860('0x9')](),controller[_0x1860('0xb')]);router[_0x1860('0xc')]('/',auth[_0x1860('0x9')](),controller[_0x1860('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1860('0xe')]);router['delete'](_0x1860('0xa'),auth[_0x1860('0x9')](),controller[_0x1860('0xf')]);module[_0x1860('0x10')]=router; \ No newline at end of file +var _0x1f8c=['show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x1f8c,0xc2));var _0xc1f8=function(_0x7b5cdd,_0x8c88d8){_0x7b5cdd=_0x7b5cdd-0x0;var _0x3a29ae=_0x1f8c[_0x7b5cdd];return _0x3a29ae;};'use strict';var multer=require(_0xc1f8('0x0'));var util=require('util');var path=require(_0xc1f8('0x1'));var timeout=require(_0xc1f8('0x2'));var express=require(_0xc1f8('0x3'));var router=express[_0xc1f8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc1f8('0x5'));var config=require(_0xc1f8('0x6'));var controller=require('./squareMessage.controller');router[_0xc1f8('0x7')]('/',auth[_0xc1f8('0x8')](),controller['index']);router[_0xc1f8('0x7')](_0xc1f8('0x9'),auth[_0xc1f8('0x8')](),controller[_0xc1f8('0xa')]);router['post']('/',auth[_0xc1f8('0x8')](),controller[_0xc1f8('0xb')]);router[_0xc1f8('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xc1f8('0xd')]);router[_0xc1f8('0xe')]('/:id',auth[_0xc1f8('0x8')](),controller[_0xc1f8('0xf')]);module[_0xc1f8('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 3f60455..0a7f485 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 _0x81e9=['out','sequelize','exports','medium','ENUM'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x81e9,0x97));var _0x981e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x81e9[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x981e('0x0'));module[_0x981e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x981e('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x981e('0x3')]('in','out'),'defaultValue':_0x981e('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0xbb6b=['out','sequelize','exports','TEXT','medium','ENUM'];(function(_0x57b2dd,_0x2e900b){var _0x44253c=function(_0x238d60){while(--_0x238d60){_0x57b2dd['push'](_0x57b2dd['shift']());}};_0x44253c(++_0x2e900b);}(_0xbb6b,0x1ed));var _0xbbb6=function(_0xbb799c,_0x36f3fe){_0xbb799c=_0xbb799c-0x0;var _0x2fd8f3=_0xbb6b[_0xbb799c];return _0x2fd8f3;};'use strict';var Sequelize=require(_0xbbb6('0x0'));module[_0xbbb6('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xbbb6('0x2')](_0xbbb6('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xbbb6('0x4')]('in','out'),'defaultValue':_0xbbb6('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 15fe200..8784a56 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 _0x3514=['end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3514,0x135));var _0x4351=function(_0x2a5a5b,_0x414340){_0x2a5a5b=_0x2a5a5b-0x0;var _0x535fb1=_0x3514[_0x2a5a5b];return _0x535fb1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4351('0x0'));var rimraf=require(_0x4351('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4351('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4351('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4351('0x4'));var sox=require(_0x4351('0x5'));var csv=require(_0x4351('0x6'));var ejs=require(_0x4351('0x7'));var fs=require('fs');var _=require(_0x4351('0x8'));var squel=require(_0x4351('0x9'));var crypto=require(_0x4351('0xa'));var jsforce=require(_0x4351('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4351('0xc'));var Redis=require(_0x4351('0xd'));var authService=require(_0x4351('0xe'));var qs=require(_0x4351('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4351('0x10'));var logger=require(_0x4351('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4351('0x12'))['db'];function respondWithStatusCode(_0x470430,_0x4b1865){_0x4b1865=_0x4b1865||0xcc;return function(_0x59ee9a){if(_0x59ee9a){return _0x470430[_0x4351('0x13')](_0x4b1865);}return _0x470430[_0x4351('0x14')](_0x4b1865)[_0x4351('0x15')]();};}function respondWithResult(_0x22c553,_0x213fc1){_0x213fc1=_0x213fc1||0xc8;return function(_0x273d9e){if(_0x273d9e){return _0x22c553['status'](_0x213fc1)[_0x4351('0x16')](_0x273d9e);}};}function respondWithFilteredResult(_0x510452,_0x2807d7){return function(_0x208d84){if(_0x208d84){var _0x23accd=_0x208d84[_0x4351('0x17')],_0x5a66bc=_0x2807d7[_0x4351('0x18')],_0xbdb234=_0x2807d7[_0x4351('0x18')]+_0x2807d7[_0x4351('0x19')],_0x43084c;if(_0xbdb234>=_0x23accd){_0xbdb234=_0x23accd;_0x43084c=0xc8;}else{_0x43084c=0xce;}_0x510452[_0x4351('0x14')](_0x43084c);return _0x510452[_0x4351('0x1a')](_0x4351('0x1b'),_0x5a66bc+'-'+_0xbdb234+'/'+_0x23accd)[_0x4351('0x16')](_0x208d84);}return null;};}function patchUpdates(_0xace7bf){return function(_0x2e4a96){try{jsonpatch['apply'](_0x2e4a96,_0xace7bf,!![]);}catch(_0xee35ea){return BPromise['reject'](_0xee35ea);}return _0x2e4a96[_0x4351('0x1c')]();};}function saveUpdates(_0x19b147,_0x581cce){return function(_0x14253c){if(_0x14253c){return _0x14253c[_0x4351('0x1d')](_0x19b147)['then'](function(_0x3cb70d){return _0x3cb70d;});}return null;};}function removeEntity(_0x5d12f2,_0x3807e4){return function(_0x3b454b){if(_0x3b454b){return _0x3b454b[_0x4351('0x1e')]()[_0x4351('0x1f')](function(){_0x5d12f2[_0x4351('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203f02,_0xb411e0){return function(_0x18b497){if(!_0x18b497){_0x203f02[_0x4351('0x13')](0x194);}return _0x18b497;};}function handleError(_0x421610,_0x5983de){_0x5983de=_0x5983de||0x1f4;return function(_0x430ca9){logger[_0x4351('0x20')](_0x430ca9[_0x4351('0x21')]);if(_0x430ca9[_0x4351('0x22')]){delete _0x430ca9[_0x4351('0x22')];}_0x421610[_0x4351('0x14')](_0x5983de)[_0x4351('0x23')](_0x430ca9);};}exports[_0x4351('0x24')]=function(_0x18cc60,_0x22633f){var _0x2ce21f={},_0x61fcd={},_0x32938e={'count':0x0,'rows':[]};var _0x51840b=_[_0x4351('0x25')](db[_0x4351('0x26')][_0x4351('0x27')],function(_0x17123e){return{'name':_0x17123e[_0x4351('0x28')],'type':_0x17123e['type'][_0x4351('0x29')]};});_0x61fcd[_0x4351('0x2a')]=_[_0x4351('0x25')](_0x51840b,_0x4351('0x22'));_0x61fcd[_0x4351('0x2b')]=_[_0x4351('0x2c')](_0x18cc60['query']);_0x61fcd['filters']=_[_0x4351('0x2d')](_0x61fcd['model'],_0x61fcd[_0x4351('0x2b')]);_0x2ce21f[_0x4351('0x2e')]=_[_0x4351('0x2d')](_0x61fcd['model'],qs[_0x4351('0x2f')](_0x18cc60['query'][_0x4351('0x2f')]));_0x2ce21f[_0x4351('0x2e')]=_0x2ce21f[_0x4351('0x2e')][_0x4351('0x30')]?_0x2ce21f[_0x4351('0x2e')]:_0x61fcd['model'];if(!_0x18cc60[_0x4351('0x2b')]['hasOwnProperty']('nolimit')){_0x2ce21f[_0x4351('0x19')]=qs[_0x4351('0x19')](_0x18cc60[_0x4351('0x2b')][_0x4351('0x19')]);_0x2ce21f[_0x4351('0x18')]=qs[_0x4351('0x18')](_0x18cc60[_0x4351('0x2b')][_0x4351('0x18')]);}_0x2ce21f[_0x4351('0x31')]=qs[_0x4351('0x32')](_0x18cc60[_0x4351('0x2b')][_0x4351('0x32')]);_0x2ce21f[_0x4351('0x33')]=qs[_0x4351('0x34')](_[_0x4351('0x35')](_0x18cc60[_0x4351('0x2b')],_0x61fcd[_0x4351('0x34')]),_0x51840b);if(_0x18cc60[_0x4351('0x2b')][_0x4351('0x36')]){_0x2ce21f[_0x4351('0x33')]=_[_0x4351('0x37')](_0x2ce21f[_0x4351('0x33')],{'$or':_[_0x4351('0x25')](_0x51840b,function(_0x406b1e){if(_0x406b1e[_0x4351('0x38')]!==_0x4351('0x39')){var _0x4b2251={};_0x4b2251[_0x406b1e[_0x4351('0x22')]]={'$like':'%'+_0x18cc60[_0x4351('0x2b')][_0x4351('0x36')]+'%'};return _0x4b2251;}})});}_0x2ce21f=_[_0x4351('0x37')]({},_0x2ce21f,_0x18cc60[_0x4351('0x3a')]);var _0x4b7eec={'where':_0x2ce21f[_0x4351('0x33')]};return db[_0x4351('0x26')]['count'](_0x4b7eec)['then'](function(_0x283c10){_0x32938e[_0x4351('0x17')]=_0x283c10;if(_0x18cc60[_0x4351('0x2b')][_0x4351('0x3b')]){_0x2ce21f[_0x4351('0x3c')]=[{'all':!![]}];}return db[_0x4351('0x26')]['findAll'](_0x2ce21f);})[_0x4351('0x1f')](function(_0x507d54){_0x32938e['rows']=_0x507d54;return _0x32938e;})[_0x4351('0x1f')](respondWithFilteredResult(_0x22633f,_0x2ce21f))['catch'](handleError(_0x22633f,null));};exports['show']=function(_0x11557b,_0x57573d){var _0x4d489f={'raw':!![],'where':{'id':_0x11557b[_0x4351('0x3d')]['id']}},_0xade336={};_0xade336[_0x4351('0x2a')]=_[_0x4351('0x2c')](db[_0x4351('0x26')]['rawAttributes']);_0xade336[_0x4351('0x2b')]=_[_0x4351('0x2c')](_0x11557b['query']);_0xade336[_0x4351('0x34')]=_[_0x4351('0x2d')](_0xade336[_0x4351('0x2a')],_0xade336['query']);_0x4d489f[_0x4351('0x2e')]=_[_0x4351('0x2d')](_0xade336['model'],qs['fields'](_0x11557b[_0x4351('0x2b')][_0x4351('0x2f')]));_0x4d489f[_0x4351('0x2e')]=_0x4d489f[_0x4351('0x2e')]['length']?_0x4d489f[_0x4351('0x2e')]:_0xade336['model'];if(_0x11557b['query'][_0x4351('0x3b')]){_0x4d489f[_0x4351('0x3c')]=[{'all':!![]}];}_0x4d489f=_['merge']({},_0x4d489f,_0x11557b[_0x4351('0x3a')]);return db['SquareMessage'][_0x4351('0x3e')](_0x4d489f)[_0x4351('0x1f')](handleEntityNotFound(_0x57573d,null))['then'](respondWithResult(_0x57573d,null))[_0x4351('0x3f')](handleError(_0x57573d,null));};exports[_0x4351('0x40')]=function(_0x3da3c3,_0x5a8e2c){return db[_0x4351('0x26')][_0x4351('0x40')](_0x3da3c3['body'],{})[_0x4351('0x1f')](respondWithResult(_0x5a8e2c,0xc9))[_0x4351('0x3f')](handleError(_0x5a8e2c,null));};exports[_0x4351('0x1d')]=function(_0x2695fe,_0x3c3a48){if(_0x2695fe[_0x4351('0x41')]['id']){delete _0x2695fe['body']['id'];}return db[_0x4351('0x26')][_0x4351('0x3e')]({'where':{'id':_0x2695fe[_0x4351('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c3a48,null))[_0x4351('0x1f')](saveUpdates(_0x2695fe[_0x4351('0x41')],null))[_0x4351('0x1f')](respondWithResult(_0x3c3a48,null))['catch'](handleError(_0x3c3a48,null));};exports['destroy']=function(_0x234c3f,_0x5a3f2b){return db['SquareMessage'][_0x4351('0x3e')]({'where':{'id':_0x234c3f[_0x4351('0x3d')]['id']}})[_0x4351('0x1f')](handleEntityNotFound(_0x5a3f2b,null))[_0x4351('0x1f')](removeEntity(_0x5a3f2b,null))[_0x4351('0x3f')](handleError(_0x5a3f2b,null));}; \ No newline at end of file +var _0x826c=['save','then','destroy','end','error','name','send','index','SquareMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','map','options','count','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','apply','reject'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x826c,0x6f));var _0xc826=function(_0x1d6d2a,_0x24362e){_0x1d6d2a=_0x1d6d2a-0x0;var _0x399eb7=_0x826c[_0x1d6d2a];return _0x399eb7;};'use strict';var pdf=require(_0xc826('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc826('0x1'));var zipdir=require(_0xc826('0x2'));var jsonpatch=require(_0xc826('0x3'));var rp=require(_0xc826('0x4'));var moment=require(_0xc826('0x5'));var BPromise=require(_0xc826('0x6'));var Mustache=require(_0xc826('0x7'));var util=require(_0xc826('0x8'));var path=require(_0xc826('0x9'));var sox=require(_0xc826('0xa'));var csv=require(_0xc826('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc826('0xc'));var squel=require(_0xc826('0xd'));var crypto=require('crypto');var jsforce=require(_0xc826('0xe'));var deskjs=require(_0xc826('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc826('0x10'));var Redis=require('ioredis');var authService=require(_0xc826('0x11'));var qs=require(_0xc826('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc826('0x13'))(_0xc826('0x14'));var utils=require(_0xc826('0x15'));var config=require(_0xc826('0x16'));var db=require(_0xc826('0x17'))['db'];function respondWithStatusCode(_0x4497e6,_0x4ee288){_0x4ee288=_0x4ee288||0xcc;return function(_0x16f8dc){if(_0x16f8dc){return _0x4497e6[_0xc826('0x18')](_0x4ee288);}return _0x4497e6[_0xc826('0x19')](_0x4ee288)['end']();};}function respondWithResult(_0x179243,_0x2a3199){_0x2a3199=_0x2a3199||0xc8;return function(_0x3d3432){if(_0x3d3432){return _0x179243['status'](_0x2a3199)[_0xc826('0x1a')](_0x3d3432);}};}function respondWithFilteredResult(_0x55be58,_0x839d19){return function(_0x31b591){if(_0x31b591){var _0x46f1e1=_0x31b591['count'],_0x5084ff=_0x839d19[_0xc826('0x1b')],_0x17a3dc=_0x839d19['offset']+_0x839d19['limit'],_0x217d45;if(_0x17a3dc>=_0x46f1e1){_0x17a3dc=_0x46f1e1;_0x217d45=0xc8;}else{_0x217d45=0xce;}_0x55be58[_0xc826('0x19')](_0x217d45);return _0x55be58[_0xc826('0x1c')]('Content-Range',_0x5084ff+'-'+_0x17a3dc+'/'+_0x46f1e1)[_0xc826('0x1a')](_0x31b591);}return null;};}function patchUpdates(_0x5ebbea){return function(_0x5d6e47){try{jsonpatch[_0xc826('0x1d')](_0x5d6e47,_0x5ebbea,!![]);}catch(_0x379997){return BPromise[_0xc826('0x1e')](_0x379997);}return _0x5d6e47[_0xc826('0x1f')]();};}function saveUpdates(_0xec9126,_0x2bb410){return function(_0x838893){if(_0x838893){return _0x838893['update'](_0xec9126)[_0xc826('0x20')](function(_0x2cc865){return _0x2cc865;});}return null;};}function removeEntity(_0x2e32f0,_0xde40cd){return function(_0x345129){if(_0x345129){return _0x345129[_0xc826('0x21')]()['then'](function(){_0x2e32f0['status'](0xcc)[_0xc826('0x22')]();});}};}function handleEntityNotFound(_0x4e0998,_0x4d51c5){return function(_0x115663){if(!_0x115663){_0x4e0998['sendStatus'](0x194);}return _0x115663;};}function handleError(_0x13dca4,_0x1c80f4){_0x1c80f4=_0x1c80f4||0x1f4;return function(_0x1eed05){logger[_0xc826('0x23')](_0x1eed05['stack']);if(_0x1eed05['name']){delete _0x1eed05[_0xc826('0x24')];}_0x13dca4['status'](_0x1c80f4)[_0xc826('0x25')](_0x1eed05);};}exports[_0xc826('0x26')]=function(_0x379fa4,_0x5d11a3){var _0x1c5e02={},_0x5d969c={},_0x2879d1={'count':0x0,'rows':[]};var _0x5eede0=_['map'](db[_0xc826('0x27')][_0xc826('0x28')],function(_0x54f766){return{'name':_0x54f766[_0xc826('0x29')],'type':_0x54f766[_0xc826('0x2a')]['key']};});_0x5d969c[_0xc826('0x2b')]=_['map'](_0x5eede0,_0xc826('0x24'));_0x5d969c['query']=_[_0xc826('0x2c')](_0x379fa4[_0xc826('0x2d')]);_0x5d969c[_0xc826('0x2e')]=_[_0xc826('0x2f')](_0x5d969c[_0xc826('0x2b')],_0x5d969c[_0xc826('0x2d')]);_0x1c5e02[_0xc826('0x30')]=_[_0xc826('0x2f')](_0x5d969c[_0xc826('0x2b')],qs[_0xc826('0x31')](_0x379fa4[_0xc826('0x2d')][_0xc826('0x31')]));_0x1c5e02[_0xc826('0x30')]=_0x1c5e02['attributes']['length']?_0x1c5e02[_0xc826('0x30')]:_0x5d969c[_0xc826('0x2b')];if(!_0x379fa4['query']['hasOwnProperty'](_0xc826('0x32'))){_0x1c5e02['limit']=qs['limit'](_0x379fa4[_0xc826('0x2d')]['limit']);_0x1c5e02['offset']=qs['offset'](_0x379fa4[_0xc826('0x2d')][_0xc826('0x1b')]);}_0x1c5e02['order']=qs['sort'](_0x379fa4[_0xc826('0x2d')][_0xc826('0x33')]);_0x1c5e02['where']=qs[_0xc826('0x2e')](_[_0xc826('0x34')](_0x379fa4[_0xc826('0x2d')],_0x5d969c[_0xc826('0x2e')]),_0x5eede0);if(_0x379fa4[_0xc826('0x2d')][_0xc826('0x35')]){_0x1c5e02[_0xc826('0x36')]=_[_0xc826('0x37')](_0x1c5e02[_0xc826('0x36')],{'$or':_[_0xc826('0x38')](_0x5eede0,function(_0x516b62){if(_0x516b62[_0xc826('0x2a')]!=='VIRTUAL'){var _0x3f0429={};_0x3f0429[_0x516b62['name']]={'$like':'%'+_0x379fa4[_0xc826('0x2d')][_0xc826('0x35')]+'%'};return _0x3f0429;}})});}_0x1c5e02=_[_0xc826('0x37')]({},_0x1c5e02,_0x379fa4[_0xc826('0x39')]);var _0x53ca7c={'where':_0x1c5e02[_0xc826('0x36')]};return db[_0xc826('0x27')][_0xc826('0x3a')](_0x53ca7c)[_0xc826('0x20')](function(_0x3cffb3){_0x2879d1[_0xc826('0x3a')]=_0x3cffb3;if(_0x379fa4[_0xc826('0x2d')][_0xc826('0x3b')]){_0x1c5e02[_0xc826('0x3c')]=[{'all':!![]}];}return db[_0xc826('0x27')][_0xc826('0x3d')](_0x1c5e02);})[_0xc826('0x20')](function(_0x462889){_0x2879d1[_0xc826('0x3e')]=_0x462889;return _0x2879d1;})[_0xc826('0x20')](respondWithFilteredResult(_0x5d11a3,_0x1c5e02))['catch'](handleError(_0x5d11a3,null));};exports[_0xc826('0x3f')]=function(_0x385ac9,_0x52b129){var _0x5b32a3={'raw':!![],'where':{'id':_0x385ac9[_0xc826('0x40')]['id']}},_0x55ffdf={};_0x55ffdf['model']=_[_0xc826('0x2c')](db[_0xc826('0x27')][_0xc826('0x28')]);_0x55ffdf[_0xc826('0x2d')]=_[_0xc826('0x2c')](_0x385ac9[_0xc826('0x2d')]);_0x55ffdf[_0xc826('0x2e')]=_[_0xc826('0x2f')](_0x55ffdf[_0xc826('0x2b')],_0x55ffdf[_0xc826('0x2d')]);_0x5b32a3[_0xc826('0x30')]=_[_0xc826('0x2f')](_0x55ffdf['model'],qs[_0xc826('0x31')](_0x385ac9[_0xc826('0x2d')]['fields']));_0x5b32a3[_0xc826('0x30')]=_0x5b32a3[_0xc826('0x30')][_0xc826('0x41')]?_0x5b32a3[_0xc826('0x30')]:_0x55ffdf[_0xc826('0x2b')];if(_0x385ac9[_0xc826('0x2d')][_0xc826('0x3b')]){_0x5b32a3[_0xc826('0x3c')]=[{'all':!![]}];}_0x5b32a3=_[_0xc826('0x37')]({},_0x5b32a3,_0x385ac9[_0xc826('0x39')]);return db[_0xc826('0x27')][_0xc826('0x42')](_0x5b32a3)[_0xc826('0x20')](handleEntityNotFound(_0x52b129,null))[_0xc826('0x20')](respondWithResult(_0x52b129,null))['catch'](handleError(_0x52b129,null));};exports[_0xc826('0x43')]=function(_0x23b39f,_0x598f9f){return db[_0xc826('0x27')]['create'](_0x23b39f[_0xc826('0x44')],{})[_0xc826('0x20')](respondWithResult(_0x598f9f,0xc9))[_0xc826('0x45')](handleError(_0x598f9f,null));};exports[_0xc826('0x46')]=function(_0x527ff5,_0x422faf){if(_0x527ff5[_0xc826('0x44')]['id']){delete _0x527ff5[_0xc826('0x44')]['id'];}return db[_0xc826('0x27')][_0xc826('0x42')]({'where':{'id':_0x527ff5[_0xc826('0x40')]['id']}})['then'](handleEntityNotFound(_0x422faf,null))[_0xc826('0x20')](saveUpdates(_0x527ff5['body'],null))[_0xc826('0x20')](respondWithResult(_0x422faf,null))[_0xc826('0x45')](handleError(_0x422faf,null));};exports[_0xc826('0x21')]=function(_0x4044b3,_0x5392a7){return db[_0xc826('0x27')][_0xc826('0x42')]({'where':{'id':_0x4044b3[_0xc826('0x40')]['id']}})[_0xc826('0x20')](handleEntityNotFound(_0x5392a7,null))['then'](removeEntity(_0x5392a7,null))[_0xc826('0x45')](handleError(_0x5392a7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fd608cd..bc2b13a 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 _0x3f8a=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x22bedc,_0x115828){var _0x4ef97d=function(_0xa98ea3){while(--_0xa98ea3){_0x22bedc['push'](_0x22bedc['shift']());}};_0x4ef97d(++_0x115828);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x16bfdf,_0x3b6f81){_0x16bfdf=_0x16bfdf-0x0;var _0x50840a=_0x3f8a[_0x16bfdf];return _0x50840a;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','square_messages'];(function(_0xb390f8,_0x3ac4bf){var _0x49fdae=function(_0x13f6e1){while(--_0x13f6e1){_0xb390f8['push'](_0xb390f8['shift']());}};_0x49fdae(++_0x3ac4bf);}(_0x1261,0x144));var _0x1126=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x1261[_0x2b737c];return _0x466ed5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('SquareMessage',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 94c10d0..03f6638 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc48=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','SquareMessage','body','raw','lodash','util'];(function(_0x7fa96,_0x3f7887){var _0x110ec9=function(_0x1a3adf){while(--_0x1a3adf){_0x7fa96['push'](_0x7fa96['shift']());}};_0x110ec9(++_0x3f7887);}(_0xbc48,0x111));var _0x8bc4=function(_0x3d4096,_0x16dcbc){_0x3d4096=_0x3d4096-0x0;var _0x12deb7=_0xbc48[_0x3d4096];return _0x12deb7;};'use strict';var _=require(_0x8bc4('0x0'));var util=require(_0x8bc4('0x1'));var moment=require(_0x8bc4('0x2'));var BPromise=require(_0x8bc4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bc4('0x4'));var db=require(_0x8bc4('0x5'))['db'];var utils=require(_0x8bc4('0x6'));var logger=require(_0x8bc4('0x7'))('rpc');var config=require(_0x8bc4('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaaff2d,_0x5708fe,_0x58df27){return new BPromise(function(_0x19c07e,_0x4bec6c){return client[_0x8bc4('0x9')](_0xaaff2d,_0x58df27)[_0x8bc4('0xa')](function(_0x20229d){logger[_0x8bc4('0xb')]('SquareMessage,\x20%s,\x20%s',_0x5708fe,_0x8bc4('0xc'));logger[_0x8bc4('0xd')](_0x8bc4('0xe'),_0x5708fe,_0x8bc4('0xc'),JSON[_0x8bc4('0xf')](_0x20229d));if(_0x20229d[_0x8bc4('0x10')]){if(_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x11')]===0x1f4){logger[_0x8bc4('0x10')](_0x8bc4('0x12'),_0x5708fe,_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x13')]);return _0x4bec6c(_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x13')]);}logger[_0x8bc4('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5708fe,_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x13')]);return _0x19c07e(_0x20229d[_0x8bc4('0x10')][_0x8bc4('0x13')]);}else{logger[_0x8bc4('0xb')](_0x8bc4('0x12'),_0x5708fe,'request\x20sent');_0x19c07e(_0x20229d['result']['message']);}})[_0x8bc4('0x14')](function(_0x556cef){logger[_0x8bc4('0x10')](_0x8bc4('0x12'),_0x5708fe,_0x556cef);_0x4bec6c(_0x556cef);});});}exports[_0x8bc4('0x15')]=function(_0x5982e6){var _0x13348c=this;return new Promise(function(_0x968929,_0x51b3b2){return db[_0x8bc4('0x16')]['create'](_0x5982e6[_0x8bc4('0x17')],{'raw':_0x5982e6['options']?_0x5982e6['options'][_0x8bc4('0x18')]===undefined?!![]:![]:!![]})[_0x8bc4('0xa')](function(_0x415598){logger[_0x8bc4('0xb')](_0x8bc4('0x15'),_0x5982e6);logger[_0x8bc4('0xd')](_0x8bc4('0x15'),_0x5982e6,JSON[_0x8bc4('0xf')](_0x415598));_0x968929(_0x415598);})[_0x8bc4('0x14')](function(_0x3b402f){logger[_0x8bc4('0x10')]('CreateSquareMessage',_0x3b402f[_0x8bc4('0x13')],_0x5982e6);_0x51b3b2(_0x13348c[_0x8bc4('0x10')](0x1f4,_0x3b402f[_0x8bc4('0x13')]));});});}; \ No newline at end of file +var _0x80c3=['message','result','catch','body','options','raw','then','CreateSquareMessage','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s'];(function(_0x39af10,_0x5466b7){var _0x56f8c8=function(_0x13d8c0){while(--_0x13d8c0){_0x39af10['push'](_0x39af10['shift']());}};_0x56f8c8(++_0x5466b7);}(_0x80c3,0x18f));var _0x380c=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x80c3[_0x27530d];return _0x59e561;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x332ed3,_0x395efa,_0x1cdbad){return new BPromise(function(_0x59445f,_0x1d853e){return client[_0x380c('0x6')](_0x332ed3,_0x1cdbad)['then'](function(_0xdd635d){logger[_0x380c('0x7')]('SquareMessage,\x20%s,\x20%s',_0x395efa,_0x380c('0x8'));logger[_0x380c('0x9')](_0x380c('0xa'),_0x395efa,'request\x20sent',JSON[_0x380c('0xb')](_0xdd635d));if(_0xdd635d[_0x380c('0xc')]){if(_0xdd635d[_0x380c('0xc')][_0x380c('0xd')]===0x1f4){logger[_0x380c('0xc')](_0x380c('0xe'),_0x395efa,_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);return _0x1d853e(_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);}logger['error'](_0x380c('0xe'),_0x395efa,_0xdd635d[_0x380c('0xc')]['message']);return _0x59445f(_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);}else{logger[_0x380c('0x7')](_0x380c('0xe'),_0x395efa,_0x380c('0x8'));_0x59445f(_0xdd635d[_0x380c('0x10')][_0x380c('0xf')]);}})[_0x380c('0x11')](function(_0x3022e6){logger['error'](_0x380c('0xe'),_0x395efa,_0x3022e6);_0x1d853e(_0x3022e6);});});}exports['CreateSquareMessage']=function(_0x5b2c5c){var _0x1a165e=this;return new Promise(function(_0x4fa7a1,_0x48625c){return db['SquareMessage']['create'](_0x5b2c5c[_0x380c('0x12')],{'raw':_0x5b2c5c[_0x380c('0x13')]?_0x5b2c5c[_0x380c('0x13')][_0x380c('0x14')]===undefined?!![]:![]:!![]})[_0x380c('0x15')](function(_0x4086c2){logger[_0x380c('0x7')](_0x380c('0x16'),_0x5b2c5c);logger[_0x380c('0x9')](_0x380c('0x16'),_0x5b2c5c,JSON[_0x380c('0xb')](_0x4086c2));_0x4fa7a1(_0x4086c2);})[_0x380c('0x11')](function(_0x374e50){logger[_0x380c('0xc')](_0x380c('0x16'),_0x374e50[_0x380c('0xf')],_0x5b2c5c);_0x48625c(_0x1a165e[_0x380c('0xc')](0x1f4,_0x374e50[_0x380c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b9be44d..d2526e6 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 _0x75b4=['get','isAuthenticated','/:id','show','test','post','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x75b4,0x1c0));var _0x475b=function(_0x3af828,_0x35f6ba){_0x3af828=_0x3af828-0x0;var _0x2e0b57=_0x75b4[_0x3af828];return _0x2e0b57;};'use strict';var multer=require('multer');var util=require(_0x475b('0x0'));var path=require(_0x475b('0x1'));var timeout=require('connect-timeout');var express=require(_0x475b('0x2'));var router=express[_0x475b('0x3')]();var auth=require(_0x475b('0x4'));var interaction=require(_0x475b('0x5'));var config=require(_0x475b('0x6'));var controller=require(_0x475b('0x7'));router[_0x475b('0x8')]('/',auth[_0x475b('0x9')](),controller['index']);router[_0x475b('0x8')](_0x475b('0xa'),auth[_0x475b('0x9')](),controller[_0x475b('0xb')]);router[_0x475b('0x8')]('/:id/test',auth[_0x475b('0x9')](),timeout('15s'),controller[_0x475b('0xc')]);router[_0x475b('0xd')]('/',auth[_0x475b('0x9')](),controller['create']);router[_0x475b('0xe')](_0x475b('0xa'),auth['isAuthenticated'](),controller[_0x475b('0xf')]);router[_0x475b('0x10')](_0x475b('0xa'),auth[_0x475b('0x9')](),controller[_0x475b('0x11')]);module[_0x475b('0x12')]=router; \ No newline at end of file +var _0x95bf=['../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','15s','test','post','create','put','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service'];(function(_0x20d6f0,_0x33e54c){var _0x105ceb=function(_0x4927e9){while(--_0x4927e9){_0x20d6f0['push'](_0x20d6f0['shift']());}};_0x105ceb(++_0x33e54c);}(_0x95bf,0x150));var _0xf95b=function(_0x3321c7,_0x143b25){_0x3321c7=_0x3321c7-0x0;var _0x1f31a6=_0x95bf[_0x3321c7];return _0x1f31a6;};'use strict';var multer=require('multer');var util=require(_0xf95b('0x0'));var path=require(_0xf95b('0x1'));var timeout=require(_0xf95b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf95b('0x3'));var interaction=require(_0xf95b('0x4'));var config=require(_0xf95b('0x5'));var controller=require(_0xf95b('0x6'));router[_0xf95b('0x7')]('/',auth['isAuthenticated'](),controller[_0xf95b('0x8')]);router[_0xf95b('0x7')](_0xf95b('0x9'),auth[_0xf95b('0xa')](),controller[_0xf95b('0xb')]);router[_0xf95b('0x7')]('/:id/test',auth[_0xf95b('0xa')](),timeout(_0xf95b('0xc')),controller[_0xf95b('0xd')]);router[_0xf95b('0xe')]('/',auth[_0xf95b('0xa')](),controller[_0xf95b('0xf')]);router[_0xf95b('0x10')](_0xf95b('0x9'),auth[_0xf95b('0xa')](),controller['update']);router[_0xf95b('0x11')](_0xf95b('0x9'),auth['isAuthenticated'](),controller[_0xf95b('0x12')]);module[_0xf95b('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5b2c363..6c1729a 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 _0xa9f5=['exports','name','STRING','sequelize'];(function(_0x44ad37,_0x2a7c43){var _0x39a1aa=function(_0xa19b48){while(--_0xa19b48){_0x44ad37['push'](_0x44ad37['shift']());}};_0x39a1aa(++_0x2a7c43);}(_0xa9f5,0x1c3));var _0x5a9f=function(_0x286dfc,_0x2fe9ce){_0x286dfc=_0x286dfc-0x0;var _0x3794ff=_0xa9f5[_0x286dfc];return _0x3794ff;};'use strict';var Sequelize=require(_0x5a9f('0x0'));module[_0x5a9f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5a9f('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5a9f('0x3')]},'description':{'type':Sequelize[_0x5a9f('0x3')]}}; \ No newline at end of file +var _0x9065=['exports','name','STRING','sequelize'];(function(_0x3a276d,_0x58c471){var _0x528d58=function(_0x45d183){while(--_0x45d183){_0x3a276d['push'](_0x3a276d['shift']());}};_0x528d58(++_0x58c471);}(_0x9065,0xab));var _0x5906=function(_0x32c45e,_0x4f445e){_0x32c45e=_0x32c45e-0x0;var _0x4a5548=_0x9065[_0x32c45e];return _0x4a5548;};'use strict';var Sequelize=require(_0x5906('0x0'));module[_0x5906('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5906('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5906('0x3')]},'description':{'type':Sequelize[_0x5906('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 739b3a1..a517ec9 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 _0xaea4=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','find','catch','create','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xaea4,0xa1));var _0x4aea=function(_0x5ef2c4,_0x5aac96){_0x5ef2c4=_0x5ef2c4-0x0;var _0x25b543=_0xaea4[_0x5ef2c4];return _0x25b543;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4aea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4aea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4aea('0x2'));var moment=require(_0x4aea('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4aea('0x4'));var path=require(_0x4aea('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4aea('0x6'));var fs=require('fs');var _=require(_0x4aea('0x7'));var squel=require(_0x4aea('0x8'));var crypto=require(_0x4aea('0x9'));var jsforce=require(_0x4aea('0xa'));var deskjs=require(_0x4aea('0xb'));var toCsv=require(_0x4aea('0xc'));var querystring=require(_0x4aea('0xd'));var Papa=require(_0x4aea('0xe'));var Redis=require(_0x4aea('0xf'));var authService=require(_0x4aea('0x10'));var qs=require(_0x4aea('0x11'));var as=require(_0x4aea('0x12'));var hardwareService=require(_0x4aea('0x13'));var logger=require(_0x4aea('0x14'))(_0x4aea('0x15'));var utils=require(_0x4aea('0x16'));var config=require(_0x4aea('0x17'));var db=require(_0x4aea('0x18'))['db'];function respondWithStatusCode(_0x4775a4,_0x3ee9d7){_0x3ee9d7=_0x3ee9d7||0xcc;return function(_0x8921d){if(_0x8921d){return _0x4775a4[_0x4aea('0x19')](_0x3ee9d7);}return _0x4775a4[_0x4aea('0x1a')](_0x3ee9d7)[_0x4aea('0x1b')]();};}function respondWithResult(_0x45399d,_0x414444){_0x414444=_0x414444||0xc8;return function(_0x451a15){if(_0x451a15){return _0x45399d[_0x4aea('0x1a')](_0x414444)[_0x4aea('0x1c')](_0x451a15);}};}function respondWithFilteredResult(_0x582bb4,_0xd4cbf0){return function(_0x102149){if(_0x102149){var _0xd2f09d=_0x102149[_0x4aea('0x1d')],_0x53e769=_0xd4cbf0[_0x4aea('0x1e')],_0x44a199=_0xd4cbf0[_0x4aea('0x1e')]+_0xd4cbf0[_0x4aea('0x1f')],_0x278570;if(_0x44a199>=_0xd2f09d){_0x44a199=_0xd2f09d;_0x278570=0xc8;}else{_0x278570=0xce;}_0x582bb4['status'](_0x278570);return _0x582bb4['set'](_0x4aea('0x20'),_0x53e769+'-'+_0x44a199+'/'+_0xd2f09d)['json'](_0x102149);}return null;};}function patchUpdates(_0x4a0b3b){return function(_0x3315aa){try{jsonpatch['apply'](_0x3315aa,_0x4a0b3b,!![]);}catch(_0x423346){return BPromise[_0x4aea('0x21')](_0x423346);}return _0x3315aa[_0x4aea('0x22')]();};}function saveUpdates(_0x3e1191,_0x481664){return function(_0x327d5e){if(_0x327d5e){return _0x327d5e[_0x4aea('0x23')](_0x3e1191)[_0x4aea('0x24')](function(_0x39e03a){return _0x39e03a;});}return null;};}function removeEntity(_0x532a7c,_0x17408b){return function(_0x4700f5){if(_0x4700f5){return _0x4700f5[_0x4aea('0x25')]()[_0x4aea('0x24')](function(){var _0x18424b=_0x4700f5[_0x4aea('0x26')]({'plain':!![]});var _0x4fb161=_0x4aea('0x27');return db[_0x4aea('0x28')]['destroy']({'where':{'type':_0x4fb161,'resourceId':_0x18424b['id']}})[_0x4aea('0x24')](function(){return _0x4700f5;});})[_0x4aea('0x24')](function(){_0x532a7c['status'](0xcc)[_0x4aea('0x1b')]();});}};}function handleEntityNotFound(_0x1bff95,_0x38ad1a){return function(_0x50d785){if(!_0x50d785){_0x1bff95[_0x4aea('0x19')](0x194);}return _0x50d785;};}function handleError(_0x283f56,_0x5c1aea){_0x5c1aea=_0x5c1aea||0x1f4;return function(_0x41617e){logger[_0x4aea('0x29')](_0x41617e['stack']);if(_0x41617e[_0x4aea('0x2a')]){delete _0x41617e[_0x4aea('0x2a')];}_0x283f56[_0x4aea('0x1a')](_0x5c1aea)[_0x4aea('0x2b')](_0x41617e);};}exports[_0x4aea('0x2c')]=function(_0x416c23,_0x5662f1){var _0x580765={},_0x5c0a50={},_0x24f91d={'count':0x0,'rows':[]};var _0x545d25=_[_0x4aea('0x2d')](db[_0x4aea('0x2e')][_0x4aea('0x2f')],function(_0x1ba0e5){return{'name':_0x1ba0e5[_0x4aea('0x30')],'type':_0x1ba0e5[_0x4aea('0x31')][_0x4aea('0x32')]};});_0x5c0a50[_0x4aea('0x33')]=_['map'](_0x545d25,_0x4aea('0x2a'));_0x5c0a50['query']=_[_0x4aea('0x34')](_0x416c23[_0x4aea('0x35')]);_0x5c0a50[_0x4aea('0x36')]=_['intersection'](_0x5c0a50[_0x4aea('0x33')],_0x5c0a50[_0x4aea('0x35')]);_0x580765['attributes']=_['intersection'](_0x5c0a50[_0x4aea('0x33')],qs[_0x4aea('0x37')](_0x416c23[_0x4aea('0x35')][_0x4aea('0x37')]));_0x580765['attributes']=_0x580765[_0x4aea('0x38')][_0x4aea('0x39')]?_0x580765[_0x4aea('0x38')]:_0x5c0a50[_0x4aea('0x33')];if(!_0x416c23[_0x4aea('0x35')][_0x4aea('0x3a')](_0x4aea('0x3b'))){_0x580765[_0x4aea('0x1f')]=qs[_0x4aea('0x1f')](_0x416c23[_0x4aea('0x35')][_0x4aea('0x1f')]);_0x580765[_0x4aea('0x1e')]=qs[_0x4aea('0x1e')](_0x416c23['query'][_0x4aea('0x1e')]);}_0x580765[_0x4aea('0x3c')]=qs[_0x4aea('0x3d')](_0x416c23[_0x4aea('0x35')][_0x4aea('0x3d')]);_0x580765[_0x4aea('0x3e')]=qs[_0x4aea('0x36')](_[_0x4aea('0x3f')](_0x416c23[_0x4aea('0x35')],_0x5c0a50[_0x4aea('0x36')]),_0x545d25);if(_0x416c23['query'][_0x4aea('0x40')]){_0x580765[_0x4aea('0x3e')]=_[_0x4aea('0x41')](_0x580765[_0x4aea('0x3e')],{'$or':_[_0x4aea('0x2d')](_0x545d25,function(_0x465868){if(_0x465868[_0x4aea('0x31')]!==_0x4aea('0x42')){var _0x1ab044={};_0x1ab044[_0x465868[_0x4aea('0x2a')]]={'$like':'%'+_0x416c23['query']['filter']+'%'};return _0x1ab044;}})});}_0x580765=_['merge']({},_0x580765,_0x416c23[_0x4aea('0x43')]);var _0x259d45={'where':_0x580765[_0x4aea('0x3e')]};return db[_0x4aea('0x2e')]['count'](_0x259d45)[_0x4aea('0x24')](function(_0x215c00){_0x24f91d[_0x4aea('0x1d')]=_0x215c00;if(_0x416c23[_0x4aea('0x35')][_0x4aea('0x44')]){_0x580765[_0x4aea('0x45')]=[{'all':!![]}];}return db[_0x4aea('0x2e')][_0x4aea('0x46')](_0x580765);})['then'](function(_0x45fa60){_0x24f91d['rows']=_0x45fa60;return _0x24f91d;})[_0x4aea('0x24')](respondWithFilteredResult(_0x5662f1,_0x580765))['catch'](handleError(_0x5662f1,null));};exports[_0x4aea('0x47')]=function(_0x35c45c,_0x2620f3){var _0x173dc8={'raw':!![],'where':{'id':_0x35c45c[_0x4aea('0x48')]['id']}},_0x3a01cd={};_0x3a01cd[_0x4aea('0x33')]=_[_0x4aea('0x34')](db[_0x4aea('0x2e')][_0x4aea('0x2f')]);_0x3a01cd[_0x4aea('0x35')]=_['keys'](_0x35c45c[_0x4aea('0x35')]);_0x3a01cd['filters']=_[_0x4aea('0x49')](_0x3a01cd[_0x4aea('0x33')],_0x3a01cd[_0x4aea('0x35')]);_0x173dc8[_0x4aea('0x38')]=_[_0x4aea('0x49')](_0x3a01cd[_0x4aea('0x33')],qs[_0x4aea('0x37')](_0x35c45c['query']['fields']));_0x173dc8[_0x4aea('0x38')]=_0x173dc8[_0x4aea('0x38')][_0x4aea('0x39')]?_0x173dc8[_0x4aea('0x38')]:_0x3a01cd[_0x4aea('0x33')];if(_0x35c45c[_0x4aea('0x35')][_0x4aea('0x44')]){_0x173dc8[_0x4aea('0x45')]=[{'all':!![]}];}_0x173dc8=_['merge']({},_0x173dc8,_0x35c45c[_0x4aea('0x43')]);return db[_0x4aea('0x2e')][_0x4aea('0x4a')](_0x173dc8)[_0x4aea('0x24')](handleEntityNotFound(_0x2620f3,null))['then'](respondWithResult(_0x2620f3,null))[_0x4aea('0x4b')](handleError(_0x2620f3,null));};exports[_0x4aea('0x4c')]=function(_0x94fc71,_0x572e92){return db[_0x4aea('0x2e')][_0x4aea('0x4c')](_0x94fc71['body'],{})['then'](function(_0x1efebc){var _0x286f67=_0x94fc71['user']['get']({'plain':!![]});if(!_0x286f67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x286f67[_0x4aea('0x4d')]===_0x4aea('0x4e')){var _0x339806=_0x1efebc[_0x4aea('0x26')]({'plain':!![]});var _0x466789=_0x4aea('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x466789,'userProfileId':_0x286f67[_0x4aea('0x4f')]},'raw':!![]})[_0x4aea('0x24')](function(_0x516d4e){if(_0x516d4e&&_0x516d4e['autoAssociation']===0x0){return db[_0x4aea('0x28')][_0x4aea('0x4c')]({'name':_0x339806[_0x4aea('0x2a')],'resourceId':_0x339806['id'],'type':_0x516d4e[_0x4aea('0x2a')],'sectionId':_0x516d4e['id']},{})[_0x4aea('0x24')](function(){return _0x1efebc;});}else{return _0x1efebc;}})[_0x4aea('0x4b')](function(_0x5678ad){logger['error'](_0x4aea('0x50'),_0x5678ad);throw _0x5678ad;});}return _0x1efebc;})[_0x4aea('0x24')](respondWithResult(_0x572e92,0xc9))['catch'](handleError(_0x572e92,null));};exports['update']=function(_0x58778b,_0x4a630e){if(_0x58778b[_0x4aea('0x51')]['id']){delete _0x58778b[_0x4aea('0x51')]['id'];}return db[_0x4aea('0x2e')][_0x4aea('0x4a')]({'where':{'id':_0x58778b['params']['id']}})[_0x4aea('0x24')](handleEntityNotFound(_0x4a630e,null))[_0x4aea('0x24')](saveUpdates(_0x58778b[_0x4aea('0x51')],null))['then'](respondWithResult(_0x4a630e,null))[_0x4aea('0x4b')](handleError(_0x4a630e,null));};exports[_0x4aea('0x25')]=function(_0x346f61,_0x3ffd5f){return db[_0x4aea('0x2e')]['find']({'where':{'id':_0x346f61[_0x4aea('0x48')]['id']}})[_0x4aea('0x24')](handleEntityNotFound(_0x3ffd5f,null))[_0x4aea('0x24')](removeEntity(_0x3ffd5f,null))['catch'](handleError(_0x3ffd5f,null));};exports[_0x4aea('0x52')]=function(_0x22cee0,_0x64dafc,_0x1c8748){var _0x1cb5d2;return db[_0x4aea('0x2e')][_0x4aea('0x4a')]({'where':{'id':_0x22cee0[_0x4aea('0x48')]['id']},'attributes':['id',_0x4aea('0x53')]})[_0x4aea('0x24')](handleEntityNotFound(_0x64dafc,null))[_0x4aea('0x24')](function(_0xc9583a){if(_0xc9583a){var _0x5e803b=require(_0x4aea('0x54'))();_0x5e803b[_0x4aea('0x55')](_0xc9583a[_0x4aea('0x53')]);_0x5e803b[_0x4aea('0x56')]();return _0xc9583a;}})[_0x4aea('0x24')](respondWithResult(_0x64dafc,null))[_0x4aea('0x4b')](handleError(_0x64dafc,null));}; \ No newline at end of file +var _0x04c5=['merge','VIRTUAL','filter','options','includeAll','include','SquareOdbc','findAll','rows','show','params','keys','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','openSync','dsn','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','get','ODBC','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick'];(function(_0x453763,_0x4fbcfb){var _0x1da339=function(_0x33c78a){while(--_0x33c78a){_0x453763['push'](_0x453763['shift']());}};_0x1da339(++_0x4fbcfb);}(_0x04c5,0xcb));var _0x504c=function(_0x2c7fe3,_0xcb51e0){_0x2c7fe3=_0x2c7fe3-0x0;var _0x22fe18=_0x04c5[_0x2c7fe3];return _0x22fe18;};'use strict';var pdf=require(_0x504c('0x0'));var emlformat=require(_0x504c('0x1'));var rimraf=require(_0x504c('0x2'));var zipdir=require(_0x504c('0x3'));var jsonpatch=require(_0x504c('0x4'));var rp=require('request-promise');var moment=require(_0x504c('0x5'));var BPromise=require(_0x504c('0x6'));var Mustache=require(_0x504c('0x7'));var util=require(_0x504c('0x8'));var path=require(_0x504c('0x9'));var sox=require(_0x504c('0xa'));var csv=require(_0x504c('0xb'));var ejs=require(_0x504c('0xc'));var fs=require('fs');var _=require(_0x504c('0xd'));var squel=require(_0x504c('0xe'));var crypto=require(_0x504c('0xf'));var jsforce=require(_0x504c('0x10'));var deskjs=require(_0x504c('0x11'));var toCsv=require(_0x504c('0xb'));var querystring=require(_0x504c('0x12'));var Papa=require(_0x504c('0x13'));var Redis=require(_0x504c('0x14'));var authService=require(_0x504c('0x15'));var qs=require(_0x504c('0x16'));var as=require(_0x504c('0x17'));var hardwareService=require(_0x504c('0x18'));var logger=require(_0x504c('0x19'))(_0x504c('0x1a'));var utils=require(_0x504c('0x1b'));var config=require('../../config/environment');var db=require(_0x504c('0x1c'))['db'];function respondWithStatusCode(_0x20acae,_0x538464){_0x538464=_0x538464||0xcc;return function(_0x20b93e){if(_0x20b93e){return _0x20acae['sendStatus'](_0x538464);}return _0x20acae[_0x504c('0x1d')](_0x538464)[_0x504c('0x1e')]();};}function respondWithResult(_0x2bee11,_0x171fb8){_0x171fb8=_0x171fb8||0xc8;return function(_0x27382f){if(_0x27382f){return _0x2bee11['status'](_0x171fb8)['json'](_0x27382f);}};}function respondWithFilteredResult(_0x38c699,_0x5162f4){return function(_0x52708b){if(_0x52708b){var _0x4f2d19=_0x52708b[_0x504c('0x1f')],_0x90305c=_0x5162f4[_0x504c('0x20')],_0x2109a5=_0x5162f4[_0x504c('0x20')]+_0x5162f4[_0x504c('0x21')],_0x5632f2;if(_0x2109a5>=_0x4f2d19){_0x2109a5=_0x4f2d19;_0x5632f2=0xc8;}else{_0x5632f2=0xce;}_0x38c699[_0x504c('0x1d')](_0x5632f2);return _0x38c699[_0x504c('0x22')](_0x504c('0x23'),_0x90305c+'-'+_0x2109a5+'/'+_0x4f2d19)[_0x504c('0x24')](_0x52708b);}return null;};}function patchUpdates(_0x97a091){return function(_0xb09397){try{jsonpatch[_0x504c('0x25')](_0xb09397,_0x97a091,!![]);}catch(_0x43b6b5){return BPromise['reject'](_0x43b6b5);}return _0xb09397['save']();};}function saveUpdates(_0x84a9d1,_0x2e5a65){return function(_0x32b309){if(_0x32b309){return _0x32b309[_0x504c('0x26')](_0x84a9d1)[_0x504c('0x27')](function(_0x3c21e5){return _0x3c21e5;});}return null;};}function removeEntity(_0x4138bb,_0x687476){return function(_0x565644){if(_0x565644){return _0x565644['destroy']()[_0x504c('0x27')](function(){var _0x2618b7=_0x565644[_0x504c('0x28')]({'plain':!![]});var _0x4df7be=_0x504c('0x29');return db['UserProfileResource'][_0x504c('0x2a')]({'where':{'type':_0x4df7be,'resourceId':_0x2618b7['id']}})[_0x504c('0x27')](function(){return _0x565644;});})[_0x504c('0x27')](function(){_0x4138bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f186d,_0x2f9b8a){return function(_0xb16a09){if(!_0xb16a09){_0x1f186d[_0x504c('0x2b')](0x194);}return _0xb16a09;};}function handleError(_0x366dba,_0x1f66e6){_0x1f66e6=_0x1f66e6||0x1f4;return function(_0xa50550){logger[_0x504c('0x2c')](_0xa50550[_0x504c('0x2d')]);if(_0xa50550[_0x504c('0x2e')]){delete _0xa50550['name'];}_0x366dba[_0x504c('0x1d')](_0x1f66e6)['send'](_0xa50550);};}exports[_0x504c('0x2f')]=function(_0x25f527,_0x59d2fa){var _0x1a8a77={},_0x4eb63d={},_0x5d83e4={'count':0x0,'rows':[]};var _0x38e59a=_[_0x504c('0x30')](db['SquareOdbc'][_0x504c('0x31')],function(_0xfa6fce){return{'name':_0xfa6fce[_0x504c('0x32')],'type':_0xfa6fce[_0x504c('0x33')]['key']};});_0x4eb63d['model']=_['map'](_0x38e59a,_0x504c('0x2e'));_0x4eb63d['query']=_['keys'](_0x25f527[_0x504c('0x34')]);_0x4eb63d[_0x504c('0x35')]=_[_0x504c('0x36')](_0x4eb63d['model'],_0x4eb63d['query']);_0x1a8a77['attributes']=_[_0x504c('0x36')](_0x4eb63d[_0x504c('0x37')],qs[_0x504c('0x38')](_0x25f527['query'][_0x504c('0x38')]));_0x1a8a77[_0x504c('0x39')]=_0x1a8a77[_0x504c('0x39')][_0x504c('0x3a')]?_0x1a8a77['attributes']:_0x4eb63d[_0x504c('0x37')];if(!_0x25f527[_0x504c('0x34')][_0x504c('0x3b')]('nolimit')){_0x1a8a77[_0x504c('0x21')]=qs[_0x504c('0x21')](_0x25f527[_0x504c('0x34')][_0x504c('0x21')]);_0x1a8a77[_0x504c('0x20')]=qs[_0x504c('0x20')](_0x25f527[_0x504c('0x34')][_0x504c('0x20')]);}_0x1a8a77[_0x504c('0x3c')]=qs[_0x504c('0x3d')](_0x25f527[_0x504c('0x34')][_0x504c('0x3d')]);_0x1a8a77[_0x504c('0x3e')]=qs[_0x504c('0x35')](_[_0x504c('0x3f')](_0x25f527[_0x504c('0x34')],_0x4eb63d['filters']),_0x38e59a);if(_0x25f527[_0x504c('0x34')]['filter']){_0x1a8a77[_0x504c('0x3e')]=_[_0x504c('0x40')](_0x1a8a77['where'],{'$or':_[_0x504c('0x30')](_0x38e59a,function(_0x539946){if(_0x539946[_0x504c('0x33')]!==_0x504c('0x41')){var _0x34d9d0={};_0x34d9d0[_0x539946[_0x504c('0x2e')]]={'$like':'%'+_0x25f527[_0x504c('0x34')][_0x504c('0x42')]+'%'};return _0x34d9d0;}})});}_0x1a8a77=_[_0x504c('0x40')]({},_0x1a8a77,_0x25f527[_0x504c('0x43')]);var _0x3174b1={'where':_0x1a8a77[_0x504c('0x3e')]};return db['SquareOdbc'][_0x504c('0x1f')](_0x3174b1)[_0x504c('0x27')](function(_0xa4ac87){_0x5d83e4[_0x504c('0x1f')]=_0xa4ac87;if(_0x25f527[_0x504c('0x34')][_0x504c('0x44')]){_0x1a8a77[_0x504c('0x45')]=[{'all':!![]}];}return db[_0x504c('0x46')][_0x504c('0x47')](_0x1a8a77);})[_0x504c('0x27')](function(_0x314769){_0x5d83e4[_0x504c('0x48')]=_0x314769;return _0x5d83e4;})[_0x504c('0x27')](respondWithFilteredResult(_0x59d2fa,_0x1a8a77))['catch'](handleError(_0x59d2fa,null));};exports[_0x504c('0x49')]=function(_0x59bfbe,_0x319ade){var _0x5436a8={'raw':!![],'where':{'id':_0x59bfbe[_0x504c('0x4a')]['id']}},_0x56a5fa={};_0x56a5fa[_0x504c('0x37')]=_[_0x504c('0x4b')](db[_0x504c('0x46')][_0x504c('0x31')]);_0x56a5fa[_0x504c('0x34')]=_[_0x504c('0x4b')](_0x59bfbe['query']);_0x56a5fa[_0x504c('0x35')]=_['intersection'](_0x56a5fa[_0x504c('0x37')],_0x56a5fa[_0x504c('0x34')]);_0x5436a8[_0x504c('0x39')]=_['intersection'](_0x56a5fa[_0x504c('0x37')],qs[_0x504c('0x38')](_0x59bfbe[_0x504c('0x34')][_0x504c('0x38')]));_0x5436a8[_0x504c('0x39')]=_0x5436a8[_0x504c('0x39')][_0x504c('0x3a')]?_0x5436a8[_0x504c('0x39')]:_0x56a5fa['model'];if(_0x59bfbe[_0x504c('0x34')][_0x504c('0x44')]){_0x5436a8['include']=[{'all':!![]}];}_0x5436a8=_[_0x504c('0x40')]({},_0x5436a8,_0x59bfbe['options']);return db[_0x504c('0x46')][_0x504c('0x4c')](_0x5436a8)['then'](handleEntityNotFound(_0x319ade,null))[_0x504c('0x27')](respondWithResult(_0x319ade,null))[_0x504c('0x4d')](handleError(_0x319ade,null));};exports[_0x504c('0x4e')]=function(_0x135240,_0x5198ee){return db[_0x504c('0x46')][_0x504c('0x4e')](_0x135240['body'],{})[_0x504c('0x27')](function(_0x5912b5){var _0x3254ea=_0x135240['user']['get']({'plain':!![]});if(!_0x3254ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3254ea['role']===_0x504c('0x4f')){var _0x25da02=_0x5912b5['get']({'plain':!![]});var _0x516af0=_0x504c('0x29');return db[_0x504c('0x50')]['find']({'where':{'name':_0x516af0,'userProfileId':_0x3254ea[_0x504c('0x51')]},'raw':!![]})[_0x504c('0x27')](function(_0x50e58d){if(_0x50e58d&&_0x50e58d[_0x504c('0x52')]===0x0){return db[_0x504c('0x53')][_0x504c('0x4e')]({'name':_0x25da02['name'],'resourceId':_0x25da02['id'],'type':_0x50e58d[_0x504c('0x2e')],'sectionId':_0x50e58d['id']},{})[_0x504c('0x27')](function(){return _0x5912b5;});}else{return _0x5912b5;}})[_0x504c('0x4d')](function(_0x11a4dd){logger['error'](_0x504c('0x54'),_0x11a4dd);throw _0x11a4dd;});}return _0x5912b5;})[_0x504c('0x27')](respondWithResult(_0x5198ee,0xc9))[_0x504c('0x4d')](handleError(_0x5198ee,null));};exports[_0x504c('0x26')]=function(_0xc6a1d9,_0x54e80d){if(_0xc6a1d9[_0x504c('0x55')]['id']){delete _0xc6a1d9[_0x504c('0x55')]['id'];}return db[_0x504c('0x46')][_0x504c('0x4c')]({'where':{'id':_0xc6a1d9['params']['id']}})[_0x504c('0x27')](handleEntityNotFound(_0x54e80d,null))[_0x504c('0x27')](saveUpdates(_0xc6a1d9[_0x504c('0x55')],null))['then'](respondWithResult(_0x54e80d,null))[_0x504c('0x4d')](handleError(_0x54e80d,null));};exports[_0x504c('0x2a')]=function(_0x399aeb,_0x3618c7){return db[_0x504c('0x46')][_0x504c('0x4c')]({'where':{'id':_0x399aeb[_0x504c('0x4a')]['id']}})[_0x504c('0x27')](handleEntityNotFound(_0x3618c7,null))['then'](removeEntity(_0x3618c7,null))[_0x504c('0x4d')](handleError(_0x3618c7,null));};exports['test']=function(_0x16ec5f,_0x4390e7,_0x75fd49){var _0x3d4777;return db['SquareOdbc'][_0x504c('0x4c')]({'where':{'id':_0x16ec5f[_0x504c('0x4a')]['id']},'attributes':['id','dsn']})[_0x504c('0x27')](handleEntityNotFound(_0x4390e7,null))['then'](function(_0x68c9df){if(_0x68c9df){var _0x317454=require('odbc')();_0x317454[_0x504c('0x56')](_0x68c9df[_0x504c('0x57')]);_0x317454[_0x504c('0x58')]();return _0x68c9df;}})[_0x504c('0x27')](respondWithResult(_0x4390e7,null))[_0x504c('0x4d')](handleError(_0x4390e7,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3fd8026..e05e3e2 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 _0x1756=['exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x1040ca,_0x4fc975){var _0x496ee9=function(_0x1b6aa3){while(--_0x1b6aa3){_0x1040ca['push'](_0x1040ca['shift']());}};_0x496ee9(++_0x4fc975);}(_0x1756,0x93));var _0x6175=function(_0x416396,_0x66eefa){_0x416396=_0x416396-0x0;var _0x3043be=_0x1756[_0x416396];return _0x3043be;};'use strict';var _=require(_0x6175('0x0'));var util=require(_0x6175('0x1'));var logger=require(_0x6175('0x2'))(_0x6175('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6175('0x4'));var fs=require('fs');var path=require(_0x6175('0x5'));var rimraf=require(_0x6175('0x6'));var config=require(_0x6175('0x7'));var attributes=require(_0x6175('0x8'));module[_0x6175('0x9')]=function(_0x2259cc,_0x416ed1){return _0x2259cc['define'](_0x6175('0xa'),attributes,{'tableName':_0x6175('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21a9=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc'];(function(_0x119b63,_0xff28c1){var _0x4b60d7=function(_0x1a907b){while(--_0x1a907b){_0x119b63['push'](_0x119b63['shift']());}};_0x4b60d7(++_0xff28c1);}(_0x21a9,0x16b));var _0x921a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x21a9[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x921a('0x0'));var util=require(_0x921a('0x1'));var logger=require('../../config/logger')(_0x921a('0x2'));var moment=require(_0x921a('0x3'));var BPromise=require(_0x921a('0x4'));var rp=require(_0x921a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x921a('0x6'));var config=require(_0x921a('0x7'));var attributes=require(_0x921a('0x8'));module['exports']=function(_0x575fc9,_0x362f07){return _0x575fc9['define'](_0x921a('0x9'),attributes,{'tableName':_0x921a('0xa'),'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 92454b4..d3e8550 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(_0x24eb13,_0x9bf446){var _0x36d230=function(_0x5308a7){while(--_0x5308a7){_0x24eb13['push'](_0x24eb13['shift']());}};_0x36d230(++_0x9bf446);}(_0x008c,0x188));var _0xc008=function(_0x44e5f6,_0x1cdb43){_0x44e5f6=_0x44e5f6-0x0;var _0x350e0e=_0x008c[_0x44e5f6];return _0x350e0e;};'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(_0x204191,_0x55d566){var _0x526ccf=function(_0x22427d){while(--_0x22427d){_0x204191['push'](_0x204191['shift']());}};_0x526ccf(++_0x55d566);}(_0x5fc3,0xa8));var _0x35fc=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x5fc3[_0x45bf86];return _0x1f02b7;};'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 c0e5172..b21bc46 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 _0x4024=['express','../../components/auth/service','../../config/environment','./squareProject.controller','index','get','/:id','show','isAuthenticated','post','put','update','delete','destroy','/:id/users','removeUsers','exports','multer','util','connect-timeout'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x4024,0x89));var _0x4402=function(_0x25aa24,_0x47fe6b){_0x25aa24=_0x25aa24-0x0;var _0x947233=_0x4024[_0x25aa24];return _0x947233;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4402('0x7')]);router[_0x4402('0x8')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xa')]);router['get']('/:id/users',auth[_0x4402('0xb')](),controller['getUsers']);router['post']('/',auth[_0x4402('0xb')](),controller['create']);router[_0x4402('0xc')]('/:id/users',auth[_0x4402('0xb')](),controller['addUsers']);router[_0x4402('0xd')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0x10')]);router[_0x4402('0xf')](_0x4402('0x11'),auth[_0x4402('0xb')](),controller[_0x4402('0x12')]);module[_0x4402('0x13')]=router; \ No newline at end of file +var _0x4e81=['update','destroy','delete','removeUsers','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','addUsers','put'];(function(_0x12e509,_0x503590){var _0x5eddc9=function(_0xe9dfac){while(--_0xe9dfac){_0x12e509['push'](_0x12e509['shift']());}};_0x5eddc9(++_0x503590);}(_0x4e81,0x1bc));var _0x14e8=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x4e81[_0xa2c0a3];return _0x52c618;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x14e8('0x3'));var interaction=require(_0x14e8('0x4'));var config=require(_0x14e8('0x5'));var controller=require(_0x14e8('0x6'));router[_0x14e8('0x7')]('/',auth[_0x14e8('0x8')](),controller['index']);router['get'](_0x14e8('0x9'),auth[_0x14e8('0x8')](),controller[_0x14e8('0xa')]);router[_0x14e8('0x7')](_0x14e8('0xb'),auth[_0x14e8('0x8')](),controller[_0x14e8('0xc')]);router[_0x14e8('0xd')]('/',auth[_0x14e8('0x8')](),controller['create']);router[_0x14e8('0xd')](_0x14e8('0xb'),auth[_0x14e8('0x8')](),controller[_0x14e8('0xe')]);router[_0x14e8('0xf')](_0x14e8('0x9'),auth[_0x14e8('0x8')](),controller[_0x14e8('0x10')]);router['delete'](_0x14e8('0x9'),auth['isAuthenticated'](),controller[_0x14e8('0x11')]);router[_0x14e8('0x12')](_0x14e8('0xb'),auth['isAuthenticated'](),controller[_0x14e8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index aaf6fca..fa2e53c 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 _0x005c=['utf8','sequelize','exports','STRING','name','TEXT','long','getDataValue','preproduction','toString'];(function(_0x2331f8,_0x446a3a){var _0x244773=function(_0x2accba){while(--_0x2accba){_0x2331f8['push'](_0x2331f8['shift']());}};_0x244773(++_0x446a3a);}(_0x005c,0x1eb));var _0xc005=function(_0x448441,_0x318c6d){_0x448441=_0x448441-0x0;var _0x4827bc=_0x005c[_0x448441];return _0x4827bc;};'use strict';var Sequelize=require(_0xc005('0x0'));module[_0xc005('0x1')]={'name':{'type':Sequelize[_0xc005('0x2')],'unique':_0xc005('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc005('0x2')]},'notes':{'type':Sequelize[_0xc005('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0xc005('0x5')),'get':function(){if(this[_0xc005('0x6')](_0xc005('0x7'))){return this[_0xc005('0x6')](_0xc005('0x7'))[_0xc005('0x8')](_0xc005('0x9'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xc005('0x6')]('production')){return this[_0xc005('0x6')]('production')['toString'](_0xc005('0x9'));}}}}; \ No newline at end of file +var _0xc7e9=['getDataValue','preproduction','BLOB','production','toString','utf8','sequelize','exports','STRING','TEXT','long'];(function(_0x26c26c,_0x39f9cf){var _0x153b04=function(_0x57aa87){while(--_0x57aa87){_0x26c26c['push'](_0x26c26c['shift']());}};_0x153b04(++_0x39f9cf);}(_0xc7e9,0x1c9));var _0x9c7e=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xc7e9[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0x9c7e('0x0'));module[_0x9c7e('0x1')]={'name':{'type':Sequelize[_0x9c7e('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9c7e('0x2')]},'notes':{'type':Sequelize[_0x9c7e('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x9c7e('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x9c7e('0x5')](_0x9c7e('0x6'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x9c7e('0x7')](_0x9c7e('0x4')),'get':function(){if(this[_0x9c7e('0x5')](_0x9c7e('0x8'))){return this[_0x9c7e('0x5')](_0x9c7e('0x8'))[_0x9c7e('0x9')](_0x9c7e('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1f5ab6c..bff75f0 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 _0xf0e5=['omit','removeUsers','isArray','userSquareProject:remove','getUsers','findOne','User','order','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','SquareProjects','UserProfileResource','sendStatus','error','name','index','map','SquareProject','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','params','includeAll','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xf0e5,0x17c));var _0x5f0e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xf0e5[_0x39096d];return _0x13da4f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5f0e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f0e('0x1'));var rp=require(_0x5f0e('0x2'));var moment=require(_0x5f0e('0x3'));var BPromise=require(_0x5f0e('0x4'));var Mustache=require(_0x5f0e('0x5'));var util=require(_0x5f0e('0x6'));var path=require('path');var sox=require(_0x5f0e('0x7'));var csv=require('to-csv');var ejs=require(_0x5f0e('0x8'));var fs=require('fs');var _=require(_0x5f0e('0x9'));var squel=require(_0x5f0e('0xa'));var crypto=require(_0x5f0e('0xb'));var jsforce=require(_0x5f0e('0xc'));var deskjs=require(_0x5f0e('0xd'));var toCsv=require(_0x5f0e('0xe'));var querystring=require(_0x5f0e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f0e('0x10'));var as=require(_0x5f0e('0x11'));var hardwareService=require(_0x5f0e('0x12'));var logger=require(_0x5f0e('0x13'))(_0x5f0e('0x14'));var utils=require(_0x5f0e('0x15'));var config=require(_0x5f0e('0x16'));var db=require(_0x5f0e('0x17'))['db'];config[_0x5f0e('0x18')]=_[_0x5f0e('0x19')](config[_0x5f0e('0x18')],{'host':_0x5f0e('0x1a'),'port':0x18eb});var socket=require(_0x5f0e('0x1b'))(new Redis(config[_0x5f0e('0x18')]));require(_0x5f0e('0x1c'))[_0x5f0e('0x1d')](socket);function respondWithStatusCode(_0x49add9,_0x4080b3){_0x4080b3=_0x4080b3||0xcc;return function(_0x4efc62){if(_0x4efc62){return _0x49add9['sendStatus'](_0x4080b3);}return _0x49add9[_0x5f0e('0x1e')](_0x4080b3)[_0x5f0e('0x1f')]();};}function respondWithResult(_0x12d477,_0x36213d){_0x36213d=_0x36213d||0xc8;return function(_0x2f3608){if(_0x2f3608){return _0x12d477['status'](_0x36213d)['json'](_0x2f3608);}};}function respondWithFilteredResult(_0x3520dc,_0x1336d1){return function(_0x26aa78){if(_0x26aa78){var _0x732786=_0x26aa78[_0x5f0e('0x20')],_0x10a59=_0x1336d1[_0x5f0e('0x21')],_0xb9a717=_0x1336d1[_0x5f0e('0x21')]+_0x1336d1[_0x5f0e('0x22')],_0x251589;if(_0xb9a717>=_0x732786){_0xb9a717=_0x732786;_0x251589=0xc8;}else{_0x251589=0xce;}_0x3520dc[_0x5f0e('0x1e')](_0x251589);return _0x3520dc[_0x5f0e('0x23')]('Content-Range',_0x10a59+'-'+_0xb9a717+'/'+_0x732786)[_0x5f0e('0x24')](_0x26aa78);}return null;};}function patchUpdates(_0x5dfbbd){return function(_0x116f95){try{jsonpatch[_0x5f0e('0x25')](_0x116f95,_0x5dfbbd,!![]);}catch(_0x18a5ea){return BPromise[_0x5f0e('0x26')](_0x18a5ea);}return _0x116f95[_0x5f0e('0x27')]();};}function saveUpdates(_0x3e42a7,_0x4cbb79){return function(_0x5ac348){if(_0x5ac348){return _0x5ac348[_0x5f0e('0x28')](_0x3e42a7)[_0x5f0e('0x29')](function(_0x51f6c4){return _0x51f6c4;});}return null;};}function removeEntity(_0xbbc79f,_0xf871df){return function(_0xe2899a){if(_0xe2899a){return _0xe2899a[_0x5f0e('0x2a')]()[_0x5f0e('0x29')](function(){var _0x299219=_0xe2899a['get']({'plain':!![]});var _0x556985=_0x5f0e('0x2b');return db[_0x5f0e('0x2c')]['destroy']({'where':{'type':_0x556985,'resourceId':_0x299219['id']}})[_0x5f0e('0x29')](function(){return _0xe2899a;});})[_0x5f0e('0x29')](function(){_0xbbc79f['status'](0xcc)[_0x5f0e('0x1f')]();});}};}function handleEntityNotFound(_0x27e986,_0xe1efe6){return function(_0x46c734){if(!_0x46c734){_0x27e986[_0x5f0e('0x2d')](0x194);}return _0x46c734;};}function handleError(_0x16d57a,_0x202bc1){_0x202bc1=_0x202bc1||0x1f4;return function(_0x14c9c2){logger[_0x5f0e('0x2e')](_0x14c9c2['stack']);if(_0x14c9c2['name']){delete _0x14c9c2[_0x5f0e('0x2f')];}_0x16d57a['status'](_0x202bc1)['send'](_0x14c9c2);};}exports[_0x5f0e('0x30')]=function(_0x46ed0d,_0x2cd642){var _0x2405bb={},_0x126091={},_0x35e506={'count':0x0,'rows':[]};var _0x23c8fa=_[_0x5f0e('0x31')](db[_0x5f0e('0x32')]['rawAttributes'],function(_0x3ef04d){return{'name':_0x3ef04d['fieldName'],'type':_0x3ef04d['type']['key']};});_0x126091['model']=_[_0x5f0e('0x31')](_0x23c8fa,_0x5f0e('0x2f'));_0x126091[_0x5f0e('0x33')]=_[_0x5f0e('0x34')](_0x46ed0d[_0x5f0e('0x33')]);_0x126091['filters']=_[_0x5f0e('0x35')](_0x126091['model'],_0x126091[_0x5f0e('0x33')]);_0x2405bb[_0x5f0e('0x36')]=_[_0x5f0e('0x35')](_0x126091['model'],qs[_0x5f0e('0x37')](_0x46ed0d[_0x5f0e('0x33')]['fields']));_0x2405bb[_0x5f0e('0x36')]=_0x2405bb[_0x5f0e('0x36')][_0x5f0e('0x38')]?_0x2405bb['attributes']:_0x126091[_0x5f0e('0x39')];if(!_0x46ed0d[_0x5f0e('0x33')][_0x5f0e('0x3a')](_0x5f0e('0x3b'))){_0x2405bb[_0x5f0e('0x22')]=qs[_0x5f0e('0x22')](_0x46ed0d[_0x5f0e('0x33')]['limit']);_0x2405bb['offset']=qs[_0x5f0e('0x21')](_0x46ed0d[_0x5f0e('0x33')]['offset']);}_0x2405bb['order']=qs[_0x5f0e('0x3c')](_0x46ed0d[_0x5f0e('0x33')][_0x5f0e('0x3c')]);_0x2405bb['where']=qs[_0x5f0e('0x3d')](_[_0x5f0e('0x3e')](_0x46ed0d[_0x5f0e('0x33')],_0x126091['filters']),_0x23c8fa);if(_0x46ed0d[_0x5f0e('0x33')][_0x5f0e('0x3f')]){_0x2405bb[_0x5f0e('0x40')]=_[_0x5f0e('0x41')](_0x2405bb[_0x5f0e('0x40')],{'$or':_[_0x5f0e('0x31')](_0x23c8fa,function(_0x43d1ba){if(_0x43d1ba[_0x5f0e('0x42')]!==_0x5f0e('0x43')){var _0x86b91b={};_0x86b91b[_0x43d1ba[_0x5f0e('0x2f')]]={'$like':'%'+_0x46ed0d[_0x5f0e('0x33')][_0x5f0e('0x3f')]+'%'};return _0x86b91b;}})});}_0x2405bb=_['merge']({},_0x2405bb,_0x46ed0d[_0x5f0e('0x44')]);var _0x59fd29={'where':_0x2405bb['where']};return db[_0x5f0e('0x32')][_0x5f0e('0x20')](_0x59fd29)[_0x5f0e('0x29')](function(_0x10310f){_0x35e506[_0x5f0e('0x20')]=_0x10310f;if(_0x46ed0d[_0x5f0e('0x33')]['includeAll']){_0x2405bb[_0x5f0e('0x45')]=[{'all':!![]}];}return db[_0x5f0e('0x32')][_0x5f0e('0x46')](_0x2405bb);})[_0x5f0e('0x29')](function(_0x47c478){_0x35e506['rows']=_0x47c478;return _0x35e506;})[_0x5f0e('0x29')](respondWithFilteredResult(_0x2cd642,_0x2405bb))['catch'](handleError(_0x2cd642,null));};exports['show']=function(_0x483e31,_0x968095){var _0x2ecad5={'raw':![],'where':{'id':_0x483e31[_0x5f0e('0x47')]['id']}},_0xb028ce={};_0xb028ce[_0x5f0e('0x39')]=_['keys'](db[_0x5f0e('0x32')]['rawAttributes']);_0xb028ce[_0x5f0e('0x33')]=_[_0x5f0e('0x34')](_0x483e31[_0x5f0e('0x33')]);_0xb028ce[_0x5f0e('0x3d')]=_[_0x5f0e('0x35')](_0xb028ce[_0x5f0e('0x39')],_0xb028ce[_0x5f0e('0x33')]);_0x2ecad5[_0x5f0e('0x36')]=_['intersection'](_0xb028ce[_0x5f0e('0x39')],qs[_0x5f0e('0x37')](_0x483e31['query'][_0x5f0e('0x37')]));_0x2ecad5[_0x5f0e('0x36')]=_0x2ecad5['attributes'][_0x5f0e('0x38')]?_0x2ecad5[_0x5f0e('0x36')]:_0xb028ce[_0x5f0e('0x39')];if(_0x483e31['query'][_0x5f0e('0x48')]){_0x2ecad5[_0x5f0e('0x45')]=[{'all':!![]}];}_0x2ecad5=_['merge']({},_0x2ecad5,_0x483e31[_0x5f0e('0x44')]);return db['SquareProject']['find'](_0x2ecad5)[_0x5f0e('0x29')](handleEntityNotFound(_0x968095,null))[_0x5f0e('0x29')](respondWithResult(_0x968095,null))[_0x5f0e('0x49')](handleError(_0x968095,null));};exports[_0x5f0e('0x4a')]=function(_0x2d3346,_0x57279f){return db[_0x5f0e('0x32')]['create'](_0x2d3346['body'],{})[_0x5f0e('0x29')](function(_0x927598){var _0x36b7f5=_0x2d3346['user'][_0x5f0e('0x4b')]({'plain':!![]});if(!_0x36b7f5)throw new Error(_0x5f0e('0x4c'));if(_0x36b7f5['role']===_0x5f0e('0x4d')){var _0x3ccaf8=_0x927598['get']({'plain':!![]});var _0x1a0f0d=_0x5f0e('0x2b');return db[_0x5f0e('0x4e')][_0x5f0e('0x4f')]({'where':{'name':_0x1a0f0d,'userProfileId':_0x36b7f5[_0x5f0e('0x50')]},'raw':!![]})[_0x5f0e('0x29')](function(_0x2dd3ee){if(_0x2dd3ee&&_0x2dd3ee['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ccaf8[_0x5f0e('0x2f')],'resourceId':_0x3ccaf8['id'],'type':_0x2dd3ee[_0x5f0e('0x2f')],'sectionId':_0x2dd3ee['id']},{})['then'](function(){return _0x927598;});}else{return _0x927598;}})[_0x5f0e('0x49')](function(_0x4e9b53){logger['error'](_0x5f0e('0x51'),_0x4e9b53);throw _0x4e9b53;});}return _0x927598;})[_0x5f0e('0x29')](respondWithResult(_0x57279f,0xc9))[_0x5f0e('0x49')](handleError(_0x57279f,null));};exports['update']=function(_0x2defc1,_0x5c1678){if(_0x2defc1[_0x5f0e('0x52')]['id']){delete _0x2defc1[_0x5f0e('0x52')]['id'];}return db[_0x5f0e('0x32')][_0x5f0e('0x4f')]({'where':{'id':_0x2defc1[_0x5f0e('0x47')]['id']}})[_0x5f0e('0x29')](handleEntityNotFound(_0x5c1678,null))[_0x5f0e('0x29')](saveUpdates(_0x2defc1[_0x5f0e('0x52')],null))[_0x5f0e('0x29')](respondWithResult(_0x5c1678,null))[_0x5f0e('0x49')](handleError(_0x5c1678,null));};exports['destroy']=function(_0x3df23b,_0x47ebff){return db[_0x5f0e('0x32')]['find']({'where':{'id':_0x3df23b[_0x5f0e('0x47')]['id']}})[_0x5f0e('0x29')](handleEntityNotFound(_0x47ebff,null))['then'](removeEntity(_0x47ebff,null))['catch'](handleError(_0x47ebff,null));};exports['addUsers']=function(_0x16bbfc,_0x3f49bc,_0x62ee5c){return db['SquareProject'][_0x5f0e('0x4f')]({'where':{'id':_0x16bbfc[_0x5f0e('0x47')]['id']}})[_0x5f0e('0x29')](handleEntityNotFound(_0x3f49bc,null))[_0x5f0e('0x29')](function(_0x36fcc7){if(_0x36fcc7){return _0x36fcc7[_0x5f0e('0x53')](_0x16bbfc[_0x5f0e('0x52')][_0x5f0e('0x54')],_[_0x5f0e('0x55')](_0x16bbfc[_0x5f0e('0x52')],[_0x5f0e('0x54'),'id'])||{});}})[_0x5f0e('0x29')](respondWithResult(_0x3f49bc,null))[_0x5f0e('0x49')](handleError(_0x3f49bc,null));};exports[_0x5f0e('0x56')]=function(_0x3efa5f,_0x1056be,_0x1d3e20){return db[_0x5f0e('0x32')]['find']({'where':{'id':_0x3efa5f[_0x5f0e('0x47')]['id']}})[_0x5f0e('0x29')](handleEntityNotFound(_0x1056be,null))[_0x5f0e('0x29')](function(_0x54480b){if(_0x54480b){return _0x54480b[_0x5f0e('0x56')](_0x3efa5f['query'][_0x5f0e('0x54')])[_0x5f0e('0x29')](function(){if(_[_0x5f0e('0x57')](_0x3efa5f[_0x5f0e('0x33')][_0x5f0e('0x54')])){for(var _0x1ce85e=0x0;_0x1ce85e<_0x3efa5f[_0x5f0e('0x33')][_0x5f0e('0x54')]['length'];_0x1ce85e+=0x1){socket['emit'](_0x5f0e('0x58'),{'UserId':Number(_0x3efa5f['query']['ids'][_0x1ce85e]),'SquareProjectId':Number(_0x3efa5f[_0x5f0e('0x47')]['id'])});}}else{socket['emit'](_0x5f0e('0x58'),{'UserId':Number(_0x3efa5f[_0x5f0e('0x33')][_0x5f0e('0x54')]),'SquareProjectId':Number(_0x3efa5f[_0x5f0e('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x1056be,null))[_0x5f0e('0x49')](handleError(_0x1056be,null));};exports[_0x5f0e('0x59')]=function(_0x38be8a,_0x4a09b6,_0x13eb44){var _0x3b4165={};var _0x589733={};var _0x9cf64e;var _0x185914;return db[_0x5f0e('0x32')][_0x5f0e('0x5a')]({'where':{'id':_0x38be8a[_0x5f0e('0x47')]['id']}})[_0x5f0e('0x29')](handleEntityNotFound(_0x4a09b6,null))[_0x5f0e('0x29')](function(_0x124b3b){if(_0x124b3b){_0x9cf64e=_0x124b3b;_0x589733[_0x5f0e('0x39')]=_[_0x5f0e('0x34')](db[_0x5f0e('0x5b')]['rawAttributes']);_0x589733[_0x5f0e('0x33')]=_[_0x5f0e('0x34')](_0x38be8a[_0x5f0e('0x33')]);_0x589733['filters']=_[_0x5f0e('0x35')](_0x589733[_0x5f0e('0x39')],_0x589733[_0x5f0e('0x33')]);_0x3b4165[_0x5f0e('0x36')]=_[_0x5f0e('0x35')](_0x589733[_0x5f0e('0x39')],qs['fields'](_0x38be8a[_0x5f0e('0x33')][_0x5f0e('0x37')]));_0x3b4165[_0x5f0e('0x36')]=_0x3b4165[_0x5f0e('0x36')][_0x5f0e('0x38')]?_0x3b4165[_0x5f0e('0x36')]:_0x589733[_0x5f0e('0x39')];_0x3b4165[_0x5f0e('0x5c')]=qs[_0x5f0e('0x3c')](_0x38be8a['query']['sort']);_0x3b4165[_0x5f0e('0x40')]=qs[_0x5f0e('0x3d')](_[_0x5f0e('0x3e')](_0x38be8a[_0x5f0e('0x33')],_0x589733[_0x5f0e('0x3d')]));if(_0x38be8a['query'][_0x5f0e('0x3f')]){_0x3b4165[_0x5f0e('0x40')]=_[_0x5f0e('0x41')](_0x3b4165[_0x5f0e('0x40')],{'$or':_['map'](_0x3b4165[_0x5f0e('0x36')],function(_0x45928d){var _0x359e21={};_0x359e21[_0x45928d]={'$like':'%'+_0x38be8a['query'][_0x5f0e('0x3f')]+'%'};return _0x359e21;})});}_0x3b4165=_['merge']({},_0x3b4165,_0x38be8a[_0x5f0e('0x44')]);return _0x9cf64e[_0x5f0e('0x59')](_0x3b4165);}})[_0x5f0e('0x29')](function(_0x247265){if(_0x247265){_0x185914=_0x247265['length'];if(!_0x38be8a[_0x5f0e('0x33')]['hasOwnProperty'](_0x5f0e('0x3b'))){_0x3b4165[_0x5f0e('0x22')]=qs[_0x5f0e('0x22')](_0x38be8a[_0x5f0e('0x33')][_0x5f0e('0x22')]);_0x3b4165[_0x5f0e('0x21')]=qs['offset'](_0x38be8a[_0x5f0e('0x33')][_0x5f0e('0x21')]);}return _0x9cf64e[_0x5f0e('0x59')](_0x3b4165);}})[_0x5f0e('0x29')](function(_0x36114a){if(_0x36114a){return _0x36114a?{'count':_0x185914,'rows':_0x36114a}:null;}})[_0x5f0e('0x29')](respondWithResult(_0x4a09b6,null))[_0x5f0e('0x49')](handleError(_0x4a09b6,null));}; \ No newline at end of file +var _0x01be=['attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rawAttributes','length','options','catch','create','body','user','role','find','userProfileId','autoAssociation','params','addUsers','omit','removeUsers','ids','emit','userSquareProject:remove','getUsers','User','keys','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','key','model','query','filters','intersection'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x01be,0x7d));var _0xe01b=function(_0x3de499,_0x448ebe){_0x3de499=_0x3de499-0x0;var _0x3c8089=_0x01be[_0x3de499];return _0x3c8089;};'use strict';var pdf=require(_0xe01b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe01b('0x1'));var zipdir=require(_0xe01b('0x2'));var jsonpatch=require(_0xe01b('0x3'));var rp=require(_0xe01b('0x4'));var moment=require(_0xe01b('0x5'));var BPromise=require(_0xe01b('0x6'));var Mustache=require(_0xe01b('0x7'));var util=require(_0xe01b('0x8'));var path=require(_0xe01b('0x9'));var sox=require(_0xe01b('0xa'));var csv=require(_0xe01b('0xb'));var ejs=require(_0xe01b('0xc'));var fs=require('fs');var _=require(_0xe01b('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe01b('0xe'));var deskjs=require(_0xe01b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe01b('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe01b('0x11'));var hardwareService=require(_0xe01b('0x12'));var logger=require(_0xe01b('0x13'))('api');var utils=require(_0xe01b('0x14'));var config=require(_0xe01b('0x15'));var db=require(_0xe01b('0x16'))['db'];config[_0xe01b('0x17')]=_['defaults'](config[_0xe01b('0x17')],{'host':_0xe01b('0x18'),'port':0x18eb});var socket=require(_0xe01b('0x19'))(new Redis(config[_0xe01b('0x17')]));require(_0xe01b('0x1a'))['register'](socket);function respondWithStatusCode(_0x550a0c,_0x526f86){_0x526f86=_0x526f86||0xcc;return function(_0x54f982){if(_0x54f982){return _0x550a0c['sendStatus'](_0x526f86);}return _0x550a0c[_0xe01b('0x1b')](_0x526f86)[_0xe01b('0x1c')]();};}function respondWithResult(_0x14fac8,_0x21474a){_0x21474a=_0x21474a||0xc8;return function(_0x2bcd4a){if(_0x2bcd4a){return _0x14fac8[_0xe01b('0x1b')](_0x21474a)[_0xe01b('0x1d')](_0x2bcd4a);}};}function respondWithFilteredResult(_0x27918b,_0x489d35){return function(_0x559594){if(_0x559594){var _0x2e105a=_0x559594[_0xe01b('0x1e')],_0x11766=_0x489d35['offset'],_0x4cf4dc=_0x489d35[_0xe01b('0x1f')]+_0x489d35[_0xe01b('0x20')],_0x1e2a95;if(_0x4cf4dc>=_0x2e105a){_0x4cf4dc=_0x2e105a;_0x1e2a95=0xc8;}else{_0x1e2a95=0xce;}_0x27918b['status'](_0x1e2a95);return _0x27918b[_0xe01b('0x21')](_0xe01b('0x22'),_0x11766+'-'+_0x4cf4dc+'/'+_0x2e105a)[_0xe01b('0x1d')](_0x559594);}return null;};}function patchUpdates(_0x4165fa){return function(_0x5e32ba){try{jsonpatch[_0xe01b('0x23')](_0x5e32ba,_0x4165fa,!![]);}catch(_0x5e5e06){return BPromise[_0xe01b('0x24')](_0x5e5e06);}return _0x5e32ba['save']();};}function saveUpdates(_0x58d7e9,_0x5b0dda){return function(_0xdb1d80){if(_0xdb1d80){return _0xdb1d80[_0xe01b('0x25')](_0x58d7e9)[_0xe01b('0x26')](function(_0x2cc0fe){return _0x2cc0fe;});}return null;};}function removeEntity(_0x23fa88,_0x359c2c){return function(_0x12bf8c){if(_0x12bf8c){return _0x12bf8c[_0xe01b('0x27')]()[_0xe01b('0x26')](function(){var _0x1520cb=_0x12bf8c[_0xe01b('0x28')]({'plain':!![]});var _0x2d2250=_0xe01b('0x29');return db[_0xe01b('0x2a')][_0xe01b('0x27')]({'where':{'type':_0x2d2250,'resourceId':_0x1520cb['id']}})[_0xe01b('0x26')](function(){return _0x12bf8c;});})['then'](function(){_0x23fa88[_0xe01b('0x1b')](0xcc)[_0xe01b('0x1c')]();});}};}function handleEntityNotFound(_0x118b50,_0x4cc237){return function(_0x2ed4f5){if(!_0x2ed4f5){_0x118b50['sendStatus'](0x194);}return _0x2ed4f5;};}function handleError(_0x4fbf76,_0x3d0cc1){_0x3d0cc1=_0x3d0cc1||0x1f4;return function(_0x5d9b2d){logger[_0xe01b('0x2b')](_0x5d9b2d[_0xe01b('0x2c')]);if(_0x5d9b2d[_0xe01b('0x2d')]){delete _0x5d9b2d[_0xe01b('0x2d')];}_0x4fbf76[_0xe01b('0x1b')](_0x3d0cc1)[_0xe01b('0x2e')](_0x5d9b2d);};}exports[_0xe01b('0x2f')]=function(_0x272bbf,_0x44f55c){var _0x170336={},_0x59c5d2={},_0x22b961={'count':0x0,'rows':[]};var _0xfd64f0=_[_0xe01b('0x30')](db[_0xe01b('0x31')]['rawAttributes'],function(_0x1726c7){return{'name':_0x1726c7['fieldName'],'type':_0x1726c7['type'][_0xe01b('0x32')]};});_0x59c5d2[_0xe01b('0x33')]=_[_0xe01b('0x30')](_0xfd64f0,_0xe01b('0x2d'));_0x59c5d2[_0xe01b('0x34')]=_['keys'](_0x272bbf[_0xe01b('0x34')]);_0x59c5d2[_0xe01b('0x35')]=_[_0xe01b('0x36')](_0x59c5d2['model'],_0x59c5d2[_0xe01b('0x34')]);_0x170336[_0xe01b('0x37')]=_[_0xe01b('0x36')](_0x59c5d2[_0xe01b('0x33')],qs[_0xe01b('0x38')](_0x272bbf[_0xe01b('0x34')][_0xe01b('0x38')]));_0x170336['attributes']=_0x170336['attributes']['length']?_0x170336['attributes']:_0x59c5d2[_0xe01b('0x33')];if(!_0x272bbf[_0xe01b('0x34')]['hasOwnProperty'](_0xe01b('0x39'))){_0x170336[_0xe01b('0x20')]=qs[_0xe01b('0x20')](_0x272bbf[_0xe01b('0x34')][_0xe01b('0x20')]);_0x170336[_0xe01b('0x1f')]=qs[_0xe01b('0x1f')](_0x272bbf[_0xe01b('0x34')][_0xe01b('0x1f')]);}_0x170336[_0xe01b('0x3a')]=qs['sort'](_0x272bbf['query'][_0xe01b('0x3b')]);_0x170336[_0xe01b('0x3c')]=qs[_0xe01b('0x35')](_[_0xe01b('0x3d')](_0x272bbf['query'],_0x59c5d2[_0xe01b('0x35')]),_0xfd64f0);if(_0x272bbf[_0xe01b('0x34')][_0xe01b('0x3e')]){_0x170336[_0xe01b('0x3c')]=_[_0xe01b('0x3f')](_0x170336[_0xe01b('0x3c')],{'$or':_[_0xe01b('0x30')](_0xfd64f0,function(_0x44d90e){if(_0x44d90e['type']!==_0xe01b('0x40')){var _0x289c95={};_0x289c95[_0x44d90e[_0xe01b('0x2d')]]={'$like':'%'+_0x272bbf[_0xe01b('0x34')]['filter']+'%'};return _0x289c95;}})});}_0x170336=_[_0xe01b('0x3f')]({},_0x170336,_0x272bbf['options']);var _0x83dd89={'where':_0x170336['where']};return db[_0xe01b('0x31')][_0xe01b('0x1e')](_0x83dd89)['then'](function(_0x387f51){_0x22b961[_0xe01b('0x1e')]=_0x387f51;if(_0x272bbf['query'][_0xe01b('0x41')]){_0x170336[_0xe01b('0x42')]=[{'all':!![]}];}return db[_0xe01b('0x31')][_0xe01b('0x43')](_0x170336);})[_0xe01b('0x26')](function(_0x273d97){_0x22b961['rows']=_0x273d97;return _0x22b961;})[_0xe01b('0x26')](respondWithFilteredResult(_0x44f55c,_0x170336))['catch'](handleError(_0x44f55c,null));};exports['show']=function(_0x2b17bc,_0x416a92){var _0x28a2d2={'raw':![],'where':{'id':_0x2b17bc['params']['id']}},_0x4ebd3d={};_0x4ebd3d[_0xe01b('0x33')]=_['keys'](db[_0xe01b('0x31')][_0xe01b('0x44')]);_0x4ebd3d[_0xe01b('0x34')]=_['keys'](_0x2b17bc[_0xe01b('0x34')]);_0x4ebd3d[_0xe01b('0x35')]=_[_0xe01b('0x36')](_0x4ebd3d[_0xe01b('0x33')],_0x4ebd3d[_0xe01b('0x34')]);_0x28a2d2[_0xe01b('0x37')]=_[_0xe01b('0x36')](_0x4ebd3d[_0xe01b('0x33')],qs['fields'](_0x2b17bc['query'][_0xe01b('0x38')]));_0x28a2d2['attributes']=_0x28a2d2[_0xe01b('0x37')][_0xe01b('0x45')]?_0x28a2d2[_0xe01b('0x37')]:_0x4ebd3d['model'];if(_0x2b17bc[_0xe01b('0x34')][_0xe01b('0x41')]){_0x28a2d2['include']=[{'all':!![]}];}_0x28a2d2=_[_0xe01b('0x3f')]({},_0x28a2d2,_0x2b17bc[_0xe01b('0x46')]);return db[_0xe01b('0x31')]['find'](_0x28a2d2)[_0xe01b('0x26')](handleEntityNotFound(_0x416a92,null))[_0xe01b('0x26')](respondWithResult(_0x416a92,null))[_0xe01b('0x47')](handleError(_0x416a92,null));};exports['create']=function(_0x3727c6,_0x5223c8){return db['SquareProject'][_0xe01b('0x48')](_0x3727c6[_0xe01b('0x49')],{})['then'](function(_0x3d233c){var _0x23a3f1=_0x3727c6[_0xe01b('0x4a')][_0xe01b('0x28')]({'plain':!![]});if(!_0x23a3f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23a3f1[_0xe01b('0x4b')]==='user'){var _0x462b19=_0x3d233c[_0xe01b('0x28')]({'plain':!![]});var _0x51dabc=_0xe01b('0x29');return db['UserProfileSection'][_0xe01b('0x4c')]({'where':{'name':_0x51dabc,'userProfileId':_0x23a3f1[_0xe01b('0x4d')]},'raw':!![]})[_0xe01b('0x26')](function(_0x2c46de){if(_0x2c46de&&_0x2c46de[_0xe01b('0x4e')]===0x0){return db[_0xe01b('0x2a')]['create']({'name':_0x462b19[_0xe01b('0x2d')],'resourceId':_0x462b19['id'],'type':_0x2c46de[_0xe01b('0x2d')],'sectionId':_0x2c46de['id']},{})['then'](function(){return _0x3d233c;});}else{return _0x3d233c;}})[_0xe01b('0x47')](function(_0x21cd58){logger[_0xe01b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21cd58);throw _0x21cd58;});}return _0x3d233c;})['then'](respondWithResult(_0x5223c8,0xc9))[_0xe01b('0x47')](handleError(_0x5223c8,null));};exports[_0xe01b('0x25')]=function(_0x5a398d,_0xf33cc4){if(_0x5a398d[_0xe01b('0x49')]['id']){delete _0x5a398d['body']['id'];}return db[_0xe01b('0x31')][_0xe01b('0x4c')]({'where':{'id':_0x5a398d[_0xe01b('0x4f')]['id']}})[_0xe01b('0x26')](handleEntityNotFound(_0xf33cc4,null))[_0xe01b('0x26')](saveUpdates(_0x5a398d[_0xe01b('0x49')],null))[_0xe01b('0x26')](respondWithResult(_0xf33cc4,null))['catch'](handleError(_0xf33cc4,null));};exports[_0xe01b('0x27')]=function(_0x1f4505,_0x1ec7d1){return db['SquareProject'][_0xe01b('0x4c')]({'where':{'id':_0x1f4505[_0xe01b('0x4f')]['id']}})[_0xe01b('0x26')](handleEntityNotFound(_0x1ec7d1,null))[_0xe01b('0x26')](removeEntity(_0x1ec7d1,null))[_0xe01b('0x47')](handleError(_0x1ec7d1,null));};exports['addUsers']=function(_0x4b78b0,_0x567f8d,_0x470d6a){return db['SquareProject'][_0xe01b('0x4c')]({'where':{'id':_0x4b78b0[_0xe01b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x567f8d,null))['then'](function(_0x26fb59){if(_0x26fb59){return _0x26fb59[_0xe01b('0x50')](_0x4b78b0['body']['ids'],_[_0xe01b('0x51')](_0x4b78b0[_0xe01b('0x49')],['ids','id'])||{});}})[_0xe01b('0x26')](respondWithResult(_0x567f8d,null))[_0xe01b('0x47')](handleError(_0x567f8d,null));};exports[_0xe01b('0x52')]=function(_0x5b7774,_0x497807,_0x4560b4){return db[_0xe01b('0x31')][_0xe01b('0x4c')]({'where':{'id':_0x5b7774[_0xe01b('0x4f')]['id']}})[_0xe01b('0x26')](handleEntityNotFound(_0x497807,null))['then'](function(_0x5965cf){if(_0x5965cf){return _0x5965cf['removeUsers'](_0x5b7774[_0xe01b('0x34')]['ids'])[_0xe01b('0x26')](function(){if(_['isArray'](_0x5b7774['query'][_0xe01b('0x53')])){for(var _0x3b3ffd=0x0;_0x3b3ffd<_0x5b7774[_0xe01b('0x34')][_0xe01b('0x53')][_0xe01b('0x45')];_0x3b3ffd+=0x1){socket[_0xe01b('0x54')](_0xe01b('0x55'),{'UserId':Number(_0x5b7774[_0xe01b('0x34')][_0xe01b('0x53')][_0x3b3ffd]),'SquareProjectId':Number(_0x5b7774[_0xe01b('0x4f')]['id'])});}}else{socket[_0xe01b('0x54')]('userSquareProject:remove',{'UserId':Number(_0x5b7774[_0xe01b('0x34')][_0xe01b('0x53')]),'SquareProjectId':Number(_0x5b7774['params']['id'])});}});}})[_0xe01b('0x26')](respondWithStatusCode(_0x497807,null))['catch'](handleError(_0x497807,null));};exports[_0xe01b('0x56')]=function(_0x4044c5,_0x47f899,_0x9eced9){var _0x7375e3={};var _0x1803ea={};var _0x2e2b9f;var _0x220c66;return db['SquareProject']['findOne']({'where':{'id':_0x4044c5[_0xe01b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x47f899,null))[_0xe01b('0x26')](function(_0x11f502){if(_0x11f502){_0x2e2b9f=_0x11f502;_0x1803ea[_0xe01b('0x33')]=_['keys'](db[_0xe01b('0x57')]['rawAttributes']);_0x1803ea[_0xe01b('0x34')]=_[_0xe01b('0x58')](_0x4044c5[_0xe01b('0x34')]);_0x1803ea[_0xe01b('0x35')]=_[_0xe01b('0x36')](_0x1803ea['model'],_0x1803ea[_0xe01b('0x34')]);_0x7375e3[_0xe01b('0x37')]=_[_0xe01b('0x36')](_0x1803ea['model'],qs[_0xe01b('0x38')](_0x4044c5['query'][_0xe01b('0x38')]));_0x7375e3[_0xe01b('0x37')]=_0x7375e3[_0xe01b('0x37')][_0xe01b('0x45')]?_0x7375e3[_0xe01b('0x37')]:_0x1803ea[_0xe01b('0x33')];_0x7375e3[_0xe01b('0x3a')]=qs[_0xe01b('0x3b')](_0x4044c5[_0xe01b('0x34')]['sort']);_0x7375e3[_0xe01b('0x3c')]=qs[_0xe01b('0x35')](_[_0xe01b('0x3d')](_0x4044c5['query'],_0x1803ea[_0xe01b('0x35')]));if(_0x4044c5['query']['filter']){_0x7375e3[_0xe01b('0x3c')]=_[_0xe01b('0x3f')](_0x7375e3[_0xe01b('0x3c')],{'$or':_[_0xe01b('0x30')](_0x7375e3['attributes'],function(_0x3094b6){var _0x5a0098={};_0x5a0098[_0x3094b6]={'$like':'%'+_0x4044c5[_0xe01b('0x34')][_0xe01b('0x3e')]+'%'};return _0x5a0098;})});}_0x7375e3=_['merge']({},_0x7375e3,_0x4044c5[_0xe01b('0x46')]);return _0x2e2b9f['getUsers'](_0x7375e3);}})[_0xe01b('0x26')](function(_0x1e58ae){if(_0x1e58ae){_0x220c66=_0x1e58ae[_0xe01b('0x45')];if(!_0x4044c5['query'][_0xe01b('0x59')](_0xe01b('0x39'))){_0x7375e3['limit']=qs[_0xe01b('0x20')](_0x4044c5[_0xe01b('0x34')][_0xe01b('0x20')]);_0x7375e3[_0xe01b('0x1f')]=qs['offset'](_0x4044c5['query'][_0xe01b('0x1f')]);}return _0x2e2b9f[_0xe01b('0x56')](_0x7375e3);}})[_0xe01b('0x26')](function(_0x26deed){if(_0x26deed){return _0x26deed?{'count':_0x220c66,'rows':_0x26deed}:null;}})[_0xe01b('0x26')](respondWithResult(_0x47f899,null))[_0xe01b('0x47')](handleError(_0x47f899,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 814acab..d35c381 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 _0x27c5=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject'];(function(_0xd9f09c,_0x4a3b7d){var _0x746c76=function(_0x541ed5){while(--_0x541ed5){_0xd9f09c['push'](_0xd9f09c['shift']());}};_0x746c76(++_0x4a3b7d);}(_0x27c5,0xf7));var _0x527c=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x27c5[_0x3f8759];return _0x2d33ca;};'use strict';var EventEmitter=require(_0x527c('0x0'));var SquareProject=require(_0x527c('0x1'))['db'][_0x527c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x527c('0x3')](0x0);var events={'afterCreate':_0x527c('0x4'),'afterUpdate':_0x527c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4f67d5){return function(_0x43021f,_0xfac2d7,_0x20c22f){SquareProjectEvents[_0x527c('0x6')](_0x4f67d5+':'+_0x43021f['id'],_0x43021f);SquareProjectEvents[_0x527c('0x6')](_0x4f67d5,_0x43021f);_0x20c22f(null);};}for(var e in events){if(events[_0x527c('0x7')](e)){var event=events[e];SquareProject[_0x527c('0x8')](e,emitEvent(event));}}module[_0x527c('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x67a7=['hook','events','SquareProject','remove','emit'];(function(_0x599570,_0x460668){var _0x3d743f=function(_0x179db6){while(--_0x179db6){_0x599570['push'](_0x599570['shift']());}};_0x3d743f(++_0x460668);}(_0x67a7,0x19b));var _0x767a=function(_0x40f470,_0x3a5975){_0x40f470=_0x40f470-0x0;var _0x46ce5f=_0x67a7[_0x40f470];return _0x46ce5f;};'use strict';var EventEmitter=require(_0x767a('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x767a('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x767a('0x2')};function emitEvent(_0x1275e9){return function(_0x21308b,_0x14c394,_0x1121e6){SquareProjectEvents['emit'](_0x1275e9+':'+_0x21308b['id'],_0x21308b);SquareProjectEvents[_0x767a('0x3')](_0x1275e9,_0x21308b);_0x1121e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x767a('0x4')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index e3567e7..217f8be 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 _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0xbb0ef0,_0x2a3f80){var _0x251fd1=function(_0x96e3a7){while(--_0x96e3a7){_0xbb0ef0['push'](_0xbb0ef0['shift']());}};_0x251fd1(++_0x2a3f80);}(_0x0295,0x1f0));var _0x5029=function(_0x1fa226,_0x575465){_0x1fa226=_0x1fa226-0x0;var _0x3579a6=_0x0295[_0x1fa226];return _0x3579a6;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./squareProject.attributes','exports','define','SquareProject','lodash','util','../../config/logger','api','moment'];(function(_0x19136d,_0x26c252){var _0x18a48c=function(_0x2f6ad0){while(--_0x2f6ad0){_0x19136d['push'](_0x19136d['shift']());}};_0x18a48c(++_0x26c252);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3372a6,_0x505699){_0x3372a6=_0x3372a6-0x0;var _0x77878=_0x5f2f[_0x3372a6];return _0x77878;};'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':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f4b9d42..ebc211b 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 _0x5cd9=['find','options','raw','where','attributes','include','map','then','info','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject'];(function(_0x5633d9,_0xe3ffb5){var _0x2342f8=function(_0x2ff942){while(--_0x2ff942){_0x5633d9['push'](_0x5633d9['shift']());}};_0x2342f8(++_0xe3ffb5);}(_0x5cd9,0x1a0));var _0x95cd=function(_0x3f7242,_0xf6b69a){_0x3f7242=_0x3f7242-0x0;var _0x1cfd88=_0x5cd9[_0x3f7242];return _0x1cfd88;};'use strict';var _=require(_0x95cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x95cd('0x1'));var rs=require(_0x95cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95cd('0x3'))['db'];var utils=require(_0x95cd('0x4'));var logger=require('../../config/logger')(_0x95cd('0x5'));var config=require(_0x95cd('0x6'));var jayson=require(_0x95cd('0x7'));var client=jayson[_0x95cd('0x8')][_0x95cd('0x9')]({'port':0x232a});config[_0x95cd('0xa')]=_[_0x95cd('0xb')](config['redis'],{'host':_0x95cd('0xc'),'port':0x18eb});var socket=require(_0x95cd('0xd'))(new Redis(config['redis']));require(_0x95cd('0xe'))[_0x95cd('0xf')](socket);function respondWithRpcPromise(_0x2c337e,_0x557b81,_0x5926b7){return new BPromise(function(_0x50de80,_0xd03c87){return client[_0x95cd('0x10')](_0x2c337e,_0x5926b7)['then'](function(_0x19aabe){logger['info']('SquareProject,\x20%s,\x20%s',_0x557b81,_0x95cd('0x11'));logger[_0x95cd('0x12')](_0x95cd('0x13'),_0x557b81,_0x95cd('0x11'),JSON[_0x95cd('0x14')](_0x19aabe));if(_0x19aabe[_0x95cd('0x15')]){if(_0x19aabe[_0x95cd('0x15')]['code']===0x1f4){logger['error'](_0x95cd('0x16'),_0x557b81,_0x19aabe[_0x95cd('0x15')][_0x95cd('0x17')]);return _0xd03c87(_0x19aabe[_0x95cd('0x15')][_0x95cd('0x17')]);}logger[_0x95cd('0x15')](_0x95cd('0x16'),_0x557b81,_0x19aabe[_0x95cd('0x15')]['message']);return _0x50de80(_0x19aabe[_0x95cd('0x15')][_0x95cd('0x17')]);}else{logger['info'](_0x95cd('0x16'),_0x557b81,_0x95cd('0x11'));_0x50de80(_0x19aabe[_0x95cd('0x18')][_0x95cd('0x17')]);}})[_0x95cd('0x19')](function(_0x3a9c8a){logger[_0x95cd('0x15')](_0x95cd('0x16'),_0x557b81,_0x3a9c8a);_0xd03c87(_0x3a9c8a);});});}exports[_0x95cd('0x1a')]=function(_0x383e9a){var _0x48480d=this;return new Promise(function(_0x20c732,_0x4e23a9){return db[_0x95cd('0x1b')][_0x95cd('0x1c')]({'raw':_0x383e9a[_0x95cd('0x1d')]?_0x383e9a[_0x95cd('0x1d')][_0x95cd('0x1e')]===undefined?!![]:![]:!![],'where':_0x383e9a['options']?_0x383e9a[_0x95cd('0x1d')][_0x95cd('0x1f')]||null:null,'attributes':_0x383e9a[_0x95cd('0x1d')]?_0x383e9a[_0x95cd('0x1d')][_0x95cd('0x20')]||null:null,'include':_0x383e9a[_0x95cd('0x1d')]?_0x383e9a[_0x95cd('0x1d')][_0x95cd('0x21')]?_[_0x95cd('0x22')](_0x383e9a[_0x95cd('0x1d')][_0x95cd('0x21')],function(_0x258354){return{'model':db[_0x258354['model']],'as':_0x258354['as'],'attributes':_0x258354['attributes'],'include':_0x258354['include']?_['map'](_0x258354[_0x95cd('0x21')],function(_0x43140f){return{'model':db[_0x43140f['model']],'as':_0x43140f['as'],'attributes':_0x43140f[_0x95cd('0x20')],'include':_0x43140f[_0x95cd('0x21')]?_[_0x95cd('0x22')](_0x43140f[_0x95cd('0x21')],function(_0x2d3187){return{'model':db[_0x2d3187['model']],'as':_0x2d3187['as'],'attributes':_0x2d3187[_0x95cd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x95cd('0x23')](function(_0x5608d9){logger[_0x95cd('0x24')](_0x95cd('0x1a'),_0x383e9a);logger[_0x95cd('0x12')]('ShowSquareProject',_0x383e9a,JSON[_0x95cd('0x14')](_0x5608d9));_0x20c732(_0x5608d9);})[_0x95cd('0x19')](function(_0x78239){logger['error'](_0x95cd('0x1a'),_0x78239[_0x95cd('0x17')],_0x383e9a);_0x4e23a9(_0x48480d[_0x95cd('0x15')](0x1f4,_0x78239[_0x95cd('0x17')]));});});}; \ No newline at end of file +var _0xbdbd=['map','attributes','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareProject','find','options','raw','where','include','model'];(function(_0x3730b1,_0x28a04b){var _0x2a75db=function(_0x348b9b){while(--_0x348b9b){_0x3730b1['push'](_0x3730b1['shift']());}};_0x2a75db(++_0x28a04b);}(_0xbdbd,0xda));var _0xdbdb=function(_0x1cba9b,_0x2cfcb4){_0x1cba9b=_0x1cba9b-0x0;var _0xbafdda=_0xbdbd[_0x1cba9b];return _0xbafdda;};'use strict';var _=require(_0xdbdb('0x0'));var util=require('util');var moment=require(_0xdbdb('0x1'));var BPromise=require(_0xdbdb('0x2'));var rs=require(_0xdbdb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdbdb('0x4'));var logger=require(_0xdbdb('0x5'))(_0xdbdb('0x6'));var config=require(_0xdbdb('0x7'));var jayson=require(_0xdbdb('0x8'));var client=jayson[_0xdbdb('0x9')][_0xdbdb('0xa')]({'port':0x232a});config[_0xdbdb('0xb')]=_[_0xdbdb('0xc')](config[_0xdbdb('0xb')],{'host':_0xdbdb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbdb('0xb')]));require(_0xdbdb('0xe'))[_0xdbdb('0xf')](socket);function respondWithRpcPromise(_0x437c4a,_0xe31d77,_0x2dcdbd){return new BPromise(function(_0x4b938e,_0x2a2ade){return client[_0xdbdb('0x10')](_0x437c4a,_0x2dcdbd)[_0xdbdb('0x11')](function(_0xdf4c53){logger[_0xdbdb('0x12')](_0xdbdb('0x13'),_0xe31d77,_0xdbdb('0x14'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0xe31d77,_0xdbdb('0x14'),JSON[_0xdbdb('0x15')](_0xdf4c53));if(_0xdf4c53[_0xdbdb('0x16')]){if(_0xdf4c53[_0xdbdb('0x16')][_0xdbdb('0x17')]===0x1f4){logger[_0xdbdb('0x16')]('SquareProject,\x20%s,\x20%s',_0xe31d77,_0xdf4c53['error'][_0xdbdb('0x18')]);return _0x2a2ade(_0xdf4c53[_0xdbdb('0x16')][_0xdbdb('0x18')]);}logger[_0xdbdb('0x16')](_0xdbdb('0x13'),_0xe31d77,_0xdf4c53['error'][_0xdbdb('0x18')]);return _0x4b938e(_0xdf4c53[_0xdbdb('0x16')][_0xdbdb('0x18')]);}else{logger[_0xdbdb('0x12')]('SquareProject,\x20%s,\x20%s',_0xe31d77,_0xdbdb('0x14'));_0x4b938e(_0xdf4c53[_0xdbdb('0x19')][_0xdbdb('0x18')]);}})[_0xdbdb('0x1a')](function(_0x9e8ff8){logger[_0xdbdb('0x16')](_0xdbdb('0x13'),_0xe31d77,_0x9e8ff8);_0x2a2ade(_0x9e8ff8);});});}exports[_0xdbdb('0x1b')]=function(_0x7e4b14){var _0xc8cb8f=this;return new Promise(function(_0xc0f741,_0x4fe40a){return db['SquareProject'][_0xdbdb('0x1c')]({'raw':_0x7e4b14['options']?_0x7e4b14[_0xdbdb('0x1d')][_0xdbdb('0x1e')]===undefined?!![]:![]:!![],'where':_0x7e4b14[_0xdbdb('0x1d')]?_0x7e4b14[_0xdbdb('0x1d')][_0xdbdb('0x1f')]||null:null,'attributes':_0x7e4b14[_0xdbdb('0x1d')]?_0x7e4b14[_0xdbdb('0x1d')]['attributes']||null:null,'include':_0x7e4b14[_0xdbdb('0x1d')]?_0x7e4b14[_0xdbdb('0x1d')][_0xdbdb('0x20')]?_['map'](_0x7e4b14[_0xdbdb('0x1d')][_0xdbdb('0x20')],function(_0x5f0186){return{'model':db[_0x5f0186[_0xdbdb('0x21')]],'as':_0x5f0186['as'],'attributes':_0x5f0186['attributes'],'include':_0x5f0186[_0xdbdb('0x20')]?_[_0xdbdb('0x22')](_0x5f0186[_0xdbdb('0x20')],function(_0x267ead){return{'model':db[_0x267ead[_0xdbdb('0x21')]],'as':_0x267ead['as'],'attributes':_0x267ead[_0xdbdb('0x23')],'include':_0x267ead[_0xdbdb('0x20')]?_[_0xdbdb('0x22')](_0x267ead[_0xdbdb('0x20')],function(_0x29b7ee){return{'model':db[_0x29b7ee[_0xdbdb('0x21')]],'as':_0x29b7ee['as'],'attributes':_0x29b7ee[_0xdbdb('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdbdb('0x11')](function(_0x91d8f5){logger[_0xdbdb('0x12')](_0xdbdb('0x1b'),_0x7e4b14);logger['debug'](_0xdbdb('0x1b'),_0x7e4b14,JSON[_0xdbdb('0x15')](_0x91d8f5));_0xc0f741(_0x91d8f5);})[_0xdbdb('0x1a')](function(_0x50a78e){logger[_0xdbdb('0x16')](_0xdbdb('0x1b'),_0x50a78e[_0xdbdb('0x18')],_0x7e4b14);_0x4fe40a(_0xc8cb8f[_0xdbdb('0x16')](0x1f4,_0x50a78e[_0xdbdb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9cf2815..9d56a49 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 _0xe2fe=['update','emit','register','length','./squareProject.events'];(function(_0x1d104c,_0x59c49f){var _0x448430=function(_0x2655f3){while(--_0x2655f3){_0x1d104c['push'](_0x1d104c['shift']());}};_0x448430(++_0x59c49f);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var SquareProjectEvents=require(_0xee2f('0x0'));var events=['save','remove',_0xee2f('0x1')];function createListener(_0x5e18ae,_0x169cf9){return function(_0x1b6f4c){_0x169cf9[_0xee2f('0x2')](_0x5e18ae,_0x1b6f4c);};}function removeListener(_0x2d2b03,_0xcb45e6){return function(){SquareProjectEvents['removeListener'](_0x2d2b03,_0xcb45e6);};}exports[_0xee2f('0x3')]=function(_0x2b7e7c){for(var _0x49926b=0x0,_0x1533a0=events[_0xee2f('0x4')];_0x49926b<_0x1533a0;_0x49926b++){var _0x5a7975=events[_0x49926b];var _0x3c4095=createListener('squareProject:'+_0x5a7975,_0x2b7e7c);SquareProjectEvents['on'](_0x5a7975,_0x3c4095);}}; \ No newline at end of file +var _0xd117=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0xd1f7b,_0x3e0b8f){var _0x73f284=function(_0x23cde2){while(--_0x23cde2){_0xd1f7b['push'](_0xd1f7b['shift']());}};_0x73f284(++_0x3e0b8f);}(_0xd117,0x182));var _0x7d11=function(_0x496590,_0x3426e9){_0x496590=_0x496590-0x0;var _0x585ebc=_0xd117[_0x496590];return _0x585ebc;};'use strict';var SquareProjectEvents=require(_0x7d11('0x0'));var events=[_0x7d11('0x1'),_0x7d11('0x2'),_0x7d11('0x3')];function createListener(_0x454387,_0x26e0f0){return function(_0x306ae4){_0x26e0f0[_0x7d11('0x4')](_0x454387,_0x306ae4);};}function removeListener(_0x3c07be,_0x31fcb0){return function(){SquareProjectEvents[_0x7d11('0x5')](_0x3c07be,_0x31fcb0);};}exports[_0x7d11('0x6')]=function(_0x27d7e8){for(var _0x40c3c4=0x0,_0x345602=events[_0x7d11('0x7')];_0x40c3c4<_0x345602;_0x40c3c4++){var _0x47b5e6=events[_0x40c3c4];var _0x3803b5=createListener(_0x7d11('0x8')+_0x47b5e6,_0x27d7e8);SquareProjectEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1f3aed4..acbf1da 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 _0x744a=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x744a,0x186));var _0xa744=function(_0x30851d,_0x1ede8c){_0x30851d=_0x30851d-0x0;var _0x24de2c=_0x744a[_0x30851d];return _0x24de2c;};'use strict';var multer=require(_0xa744('0x0'));var util=require(_0xa744('0x1'));var path=require('path');var timeout=require(_0xa744('0x2'));var express=require('express');var router=express[_0xa744('0x3')]();var auth=require(_0xa744('0x4'));var interaction=require(_0xa744('0x5'));var config=require(_0xa744('0x6'));var controller=require('./squareRecording.controller');router[_0xa744('0x7')]('/',auth[_0xa744('0x8')](),controller[_0xa744('0x9')]);router['get'](_0xa744('0xa'),auth[_0xa744('0x8')](),controller[_0xa744('0xb')]);router[_0xa744('0x7')]('/:id/download',auth[_0xa744('0x8')](),controller[_0xa744('0xc')]);router['post']('/',auth[_0xa744('0x8')](),controller[_0xa744('0xd')]);router[_0xa744('0xe')](_0xa744('0xa'),auth[_0xa744('0x8')](),controller['update']);router['delete']('/:id/delete',auth[_0xa744('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2dbb=['update','delete','/:id/delete','destroy','exports','multer','util','path','express','Router','../../config/environment','./squareRecording.controller','isAuthenticated','index','/:id','show','download','post','create','put'];(function(_0x122450,_0x3e7b54){var _0x1617bd=function(_0x8b1abf){while(--_0x8b1abf){_0x122450['push'](_0x122450['shift']());}};_0x1617bd(++_0x3e7b54);}(_0x2dbb,0x7d));var _0xb2db=function(_0x4bd24c,_0x482453){_0x4bd24c=_0x4bd24c-0x0;var _0x5d7acc=_0x2dbb[_0x4bd24c];return _0x5d7acc;};'use strict';var multer=require(_0xb2db('0x0'));var util=require(_0xb2db('0x1'));var path=require(_0xb2db('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2db('0x3'));var router=express[_0xb2db('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb2db('0x5'));var controller=require(_0xb2db('0x6'));router['get']('/',auth[_0xb2db('0x7')](),controller[_0xb2db('0x8')]);router['get'](_0xb2db('0x9'),auth[_0xb2db('0x7')](),controller[_0xb2db('0xa')]);router['get']('/:id/download',auth[_0xb2db('0x7')](),controller[_0xb2db('0xb')]);router[_0xb2db('0xc')]('/',auth[_0xb2db('0x7')](),controller[_0xb2db('0xd')]);router[_0xb2db('0xe')](_0xb2db('0x9'),auth[_0xb2db('0x7')](),controller[_0xb2db('0xf')]);router[_0xb2db('0x10')](_0xb2db('0x11'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x12')]);module[_0xb2db('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 88f43c7..3bf1f86 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 _0xaff5=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x40662a,_0xb80c85){var _0x2c10b3=function(_0x41248d){while(--_0x41248d){_0x40662a['push'](_0x40662a['shift']());}};_0x2c10b3(++_0xb80c85);}(_0xaff5,0x1b9));var _0x5aff=function(_0x28ed71,_0xa60d88){_0x28ed71=_0x28ed71-0x0;var _0x49af19=_0xaff5[_0x28ed71];return _0x49af19;};'use strict';var Sequelize=require(_0x5aff('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5aff('0x1')]},'callerid':{'type':Sequelize[_0x5aff('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5aff('0x1')]},'extension':{'type':Sequelize[_0x5aff('0x1')]},'priority':{'type':Sequelize[_0x5aff('0x1')]},'accountcode':{'type':Sequelize[_0x5aff('0x1')]},'dnid':{'type':Sequelize[_0x5aff('0x1')]},'projectName':{'type':Sequelize[_0x5aff('0x1')]},'saveName':{'type':Sequelize[_0x5aff('0x1')]},'filename':{'type':Sequelize[_0x5aff('0x1')]},'savePath':{'type':Sequelize[_0x5aff('0x1')]},'format':{'type':Sequelize[_0x5aff('0x2')],'get':function(){var _0x166ab1='';var _0x59f08c=this[_0x5aff('0x3')](_0x5aff('0x4'));if(_0x59f08c){_0x166ab1=_0x59f08c['substring'](_0x59f08c[_0x5aff('0x5')]('.'));}return _0x166ab1;}}}; \ No newline at end of file +var _0x51db=['savePath','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x51db,0xb5));var _0xb51d=function(_0x3e7e4b,_0x57fbc5){_0x3e7e4b=_0x3e7e4b-0x0;var _0x17adc3=_0x51db[_0x3e7e4b];return _0x17adc3;};'use strict';var Sequelize=require(_0xb51d('0x0'));module[_0xb51d('0x1')]={'uniqueid':{'type':Sequelize[_0xb51d('0x2')]},'callerid':{'type':Sequelize[_0xb51d('0x2')]},'calleridname':{'type':Sequelize[_0xb51d('0x2')]},'context':{'type':Sequelize[_0xb51d('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb51d('0x2')]},'dnid':{'type':Sequelize[_0xb51d('0x2')]},'projectName':{'type':Sequelize[_0xb51d('0x2')]},'saveName':{'type':Sequelize[_0xb51d('0x2')]},'filename':{'type':Sequelize[_0xb51d('0x2')]},'savePath':{'type':Sequelize[_0xb51d('0x2')]},'format':{'type':Sequelize[_0xb51d('0x3')],'get':function(){var _0x518cab='';var _0x408d5e=this[_0xb51d('0x4')](_0xb51d('0x5'));if(_0x408d5e){_0x518cab=_0x408d5e['substring'](_0x408d5e['lastIndexOf']('.'));}return _0x518cab;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8ee1a90..0eaaa30 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 _0x3e15=['to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','end','sendStatus','error','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','format','decryptFile','secrets','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0xe32763,_0x528640){var _0x382d75=function(_0x4aab7e){while(--_0x4aab7e){_0xe32763['push'](_0xe32763['shift']());}};_0x382d75(++_0x528640);}(_0x3e15,0x119));var _0x53e1=function(_0x3de9e4,_0x4afa55){_0x3de9e4=_0x3de9e4-0x0;var _0x4d6c97=_0x3e15[_0x3de9e4];return _0x4d6c97;};'use strict';var pdf=require(_0x53e1('0x0'));var emlformat=require(_0x53e1('0x1'));var rimraf=require(_0x53e1('0x2'));var zipdir=require(_0x53e1('0x3'));var jsonpatch=require(_0x53e1('0x4'));var rp=require(_0x53e1('0x5'));var moment=require(_0x53e1('0x6'));var BPromise=require(_0x53e1('0x7'));var Mustache=require('mustache');var util=require(_0x53e1('0x8'));var path=require(_0x53e1('0x9'));var sox=require('sox');var csv=require(_0x53e1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x53e1('0xb'));var squel=require(_0x53e1('0xc'));var crypto=require(_0x53e1('0xd'));var jsforce=require(_0x53e1('0xe'));var deskjs=require(_0x53e1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x53e1('0x10'));var Redis=require(_0x53e1('0x11'));var authService=require(_0x53e1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x53e1('0x13'));var hardwareService=require(_0x53e1('0x14'));var logger=require(_0x53e1('0x15'))(_0x53e1('0x16'));var utils=require(_0x53e1('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55dddc,_0x1f88c5){_0x1f88c5=_0x1f88c5||0xcc;return function(_0x1314b9){if(_0x1314b9){return _0x55dddc['sendStatus'](_0x1f88c5);}return _0x55dddc[_0x53e1('0x18')](_0x1f88c5)['end']();};}function respondWithResult(_0x147869,_0x385a3d){_0x385a3d=_0x385a3d||0xc8;return function(_0x58538e){if(_0x58538e){return _0x147869['status'](_0x385a3d)[_0x53e1('0x19')](_0x58538e);}};}function respondWithFilteredResult(_0x4f0b3e,_0x409820){return function(_0x4a2795){if(_0x4a2795){var _0x5de473=_0x4a2795[_0x53e1('0x1a')],_0x20273a=_0x409820['offset'],_0x33ee95=_0x409820[_0x53e1('0x1b')]+_0x409820[_0x53e1('0x1c')],_0x1d3fe8;if(_0x33ee95>=_0x5de473){_0x33ee95=_0x5de473;_0x1d3fe8=0xc8;}else{_0x1d3fe8=0xce;}_0x4f0b3e['status'](_0x1d3fe8);return _0x4f0b3e[_0x53e1('0x1d')](_0x53e1('0x1e'),_0x20273a+'-'+_0x33ee95+'/'+_0x5de473)[_0x53e1('0x19')](_0x4a2795);}return null;};}function patchUpdates(_0x4192bb){return function(_0x11fb2e){try{jsonpatch[_0x53e1('0x1f')](_0x11fb2e,_0x4192bb,!![]);}catch(_0x2482ae){return BPromise[_0x53e1('0x20')](_0x2482ae);}return _0x11fb2e[_0x53e1('0x21')]();};}function saveUpdates(_0x55f74c,_0x45468b){return function(_0xab2627){if(_0xab2627){return _0xab2627['update'](_0x55f74c)[_0x53e1('0x22')](function(_0xfb721b){return _0xfb721b;});}return null;};}function removeEntity(_0x222379,_0x179809){return function(_0x5163f6){if(_0x5163f6){return _0x5163f6['destroy']()[_0x53e1('0x22')](function(){_0x222379['status'](0xcc)[_0x53e1('0x23')]();});}};}function handleEntityNotFound(_0x2dc0ca,_0x31e3bc){return function(_0x73a7e5){if(!_0x73a7e5){_0x2dc0ca[_0x53e1('0x24')](0x194);}return _0x73a7e5;};}function handleError(_0x4ba14a,_0x3385b3){_0x3385b3=_0x3385b3||0x1f4;return function(_0x7824a5){logger[_0x53e1('0x25')](_0x7824a5['stack']);if(_0x7824a5['name']){delete _0x7824a5[_0x53e1('0x26')];}_0x4ba14a[_0x53e1('0x18')](_0x3385b3)[_0x53e1('0x27')](_0x7824a5);};}exports[_0x53e1('0x28')]=function(_0x4c8952,_0x34024a){var _0x266414={},_0x18f056={},_0x1595d5={'count':0x0,'rows':[]};var _0x115cb5=_['map'](db[_0x53e1('0x29')][_0x53e1('0x2a')],function(_0x53ca45){return{'name':_0x53ca45[_0x53e1('0x2b')],'type':_0x53ca45[_0x53e1('0x2c')][_0x53e1('0x2d')]};});_0x18f056[_0x53e1('0x2e')]=_[_0x53e1('0x2f')](_0x115cb5,_0x53e1('0x26'));_0x18f056[_0x53e1('0x30')]=_[_0x53e1('0x31')](_0x4c8952[_0x53e1('0x30')]);_0x18f056[_0x53e1('0x32')]=_[_0x53e1('0x33')](_0x18f056[_0x53e1('0x2e')],_0x18f056[_0x53e1('0x30')]);_0x266414['attributes']=_['intersection'](_0x18f056[_0x53e1('0x2e')],qs[_0x53e1('0x34')](_0x4c8952[_0x53e1('0x30')][_0x53e1('0x34')]));_0x266414[_0x53e1('0x35')]=_0x266414[_0x53e1('0x35')][_0x53e1('0x36')]?_0x266414[_0x53e1('0x35')]:_0x18f056[_0x53e1('0x2e')];if(!_0x4c8952[_0x53e1('0x30')][_0x53e1('0x37')](_0x53e1('0x38'))){_0x266414[_0x53e1('0x1c')]=qs[_0x53e1('0x1c')](_0x4c8952[_0x53e1('0x30')][_0x53e1('0x1c')]);_0x266414[_0x53e1('0x1b')]=qs[_0x53e1('0x1b')](_0x4c8952[_0x53e1('0x30')][_0x53e1('0x1b')]);}_0x266414[_0x53e1('0x39')]=qs[_0x53e1('0x3a')](_0x4c8952['query'][_0x53e1('0x3a')]);_0x266414[_0x53e1('0x3b')]=qs[_0x53e1('0x32')](_[_0x53e1('0x3c')](_0x4c8952['query'],_0x18f056['filters']),_0x115cb5);if(_0x4c8952['query'][_0x53e1('0x3d')]){_0x266414[_0x53e1('0x3b')]=_[_0x53e1('0x3e')](_0x266414[_0x53e1('0x3b')],{'$or':_['map'](_0x115cb5,function(_0x8cc9bf){if(_0x8cc9bf['type']!==_0x53e1('0x3f')){var _0x257a0f={};_0x257a0f[_0x8cc9bf['name']]={'$like':'%'+_0x4c8952[_0x53e1('0x30')][_0x53e1('0x3d')]+'%'};return _0x257a0f;}})});}_0x266414=_[_0x53e1('0x3e')]({},_0x266414,_0x4c8952[_0x53e1('0x40')]);var _0x2e8f93={'where':_0x266414[_0x53e1('0x3b')]};return db[_0x53e1('0x29')][_0x53e1('0x1a')](_0x2e8f93)[_0x53e1('0x22')](function(_0x228724){_0x1595d5['count']=_0x228724;if(_0x4c8952['query'][_0x53e1('0x41')]){_0x266414['include']=[{'all':!![]}];}return db[_0x53e1('0x29')]['findAll'](_0x266414);})[_0x53e1('0x22')](function(_0x1bc1bc){_0x1595d5[_0x53e1('0x42')]=_0x1bc1bc;return _0x1595d5;})[_0x53e1('0x22')](respondWithFilteredResult(_0x34024a,_0x266414))[_0x53e1('0x43')](handleError(_0x34024a,null));};exports['show']=function(_0x572893,_0x68be1){var _0x39f295={'raw':!![],'where':{'id':_0x572893[_0x53e1('0x44')]['id']}},_0x25317c={};_0x25317c['model']=_['keys'](db[_0x53e1('0x29')]['rawAttributes']);_0x25317c['query']=_[_0x53e1('0x31')](_0x572893[_0x53e1('0x30')]);_0x25317c['filters']=_['intersection'](_0x25317c[_0x53e1('0x2e')],_0x25317c[_0x53e1('0x30')]);_0x39f295[_0x53e1('0x35')]=_[_0x53e1('0x33')](_0x25317c['model'],qs['fields'](_0x572893[_0x53e1('0x30')][_0x53e1('0x34')]));_0x39f295[_0x53e1('0x35')]=_0x39f295['attributes']['length']?_0x39f295[_0x53e1('0x35')]:_0x25317c[_0x53e1('0x2e')];if(_0x572893['query'][_0x53e1('0x41')]){_0x39f295['include']=[{'all':!![]}];}_0x39f295=_['merge']({},_0x39f295,_0x572893[_0x53e1('0x40')]);return db[_0x53e1('0x29')][_0x53e1('0x45')](_0x39f295)[_0x53e1('0x22')](handleEntityNotFound(_0x68be1,null))[_0x53e1('0x22')](respondWithResult(_0x68be1,null))[_0x53e1('0x43')](handleError(_0x68be1,null));};exports[_0x53e1('0x46')]=function(_0x171b02,_0x437f40){return db[_0x53e1('0x29')]['create'](_0x171b02[_0x53e1('0x47')],{})[_0x53e1('0x22')](respondWithResult(_0x437f40,0xc9))[_0x53e1('0x43')](handleError(_0x437f40,null));};exports[_0x53e1('0x48')]=function(_0x218071,_0x4b6a37){if(_0x218071['body']['id']){delete _0x218071['body']['id'];}return db[_0x53e1('0x29')][_0x53e1('0x45')]({'where':{'id':_0x218071[_0x53e1('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b6a37,null))[_0x53e1('0x22')](saveUpdates(_0x218071[_0x53e1('0x47')],null))[_0x53e1('0x22')](respondWithResult(_0x4b6a37,null))[_0x53e1('0x43')](handleError(_0x4b6a37,null));};exports[_0x53e1('0x49')]=function(_0x184fd5,_0xf3b53f,_0x234b49){var _0x135f3d=require(_0x53e1('0x4a'));var _0x362a3a=![];var _0x53e180={};if(_0x184fd5[_0x53e1('0x30')][_0x53e1('0x2c')]&&_0x184fd5[_0x53e1('0x30')][_0x53e1('0x2c')]===_0x53e1('0x4b')){_0x53e180['uniqueid']=_0x184fd5[_0x53e1('0x44')]['id'];}else{_0x53e180['id']=_0x184fd5['params']['id'];}return db[_0x53e1('0x29')][_0x53e1('0x45')]({'where':_0x53e180,'attributes':['id',_0x53e1('0x4c'),_0x53e1('0x4d')],'raw':!![]})[_0x53e1('0x22')](handleEntityNotFound(_0xf3b53f,null))[_0x53e1('0x22')](function(_0xae2ee4){if(_0xae2ee4){var _0x2a0d55=_0xae2ee4[_0x53e1('0x4c')];var _0x347c8d=util[_0x53e1('0x4e')]('%s.cypher',_0x2a0d55);if(fs['existsSync'](_0x347c8d)){_0x362a3a=!![];return _0x135f3d[_0x53e1('0x4f')](_0x347c8d,_0x2a0d55,config[_0x53e1('0x50')]['recording'])['then'](function(){return _0xae2ee4;});}return _0xae2ee4;}})[_0x53e1('0x22')](function(_0x427d8f){if(_0x427d8f){var _0x8afe1f=_0x427d8f[_0x53e1('0x4c')];if(!fs[_0x53e1('0x51')](_0x8afe1f)){throw new db[(_0x53e1('0x52'))][(_0x53e1('0x53'))](_0x53e1('0x54'));}if(_0x427d8f[_0x53e1('0x4d')]){return _0xf3b53f[_0x53e1('0x49')](_0x8afe1f,_0x427d8f[_0x53e1('0x4d')]+path['extname'](_0x8afe1f),function(){if(_0x362a3a){fs[_0x53e1('0x55')](_0x8afe1f);}});}else{return _0xf3b53f[_0x53e1('0x49')](_0x8afe1f,function(_0x2c8f29){if(_0x362a3a){fs['unlink'](_0x8afe1f);}});}}})[_0x53e1('0x43')](function(_0x41bd1d){if(_0x41bd1d[_0x53e1('0x56')]==='SquareRecording\x20not\x20found'){_0xf3b53f[_0x53e1('0x18')](0x194)['send'](_0x53e1('0x57'));}else{return handleError(_0xf3b53f,null);}});};exports[_0x53e1('0x58')]=function(_0x4382fb,_0x1e41fd){return db[_0x53e1('0x29')][_0x53e1('0x45')]({'where':{'id':_0x4382fb[_0x53e1('0x44')]['id']}})['then'](function(_0x2d3f97){if(!_0x2d3f97)throw new ReferenceError(_0x53e1('0x59'));return _0x2d3f97;})[_0x53e1('0x22')](function(_0x5b12f0){var _0xe96bf3=_0x5b12f0[_0x53e1('0x4c')];logger['info'](_0x53e1('0x5a'),_0xe96bf3);if(!_[_0x53e1('0x5b')](_0x5b12f0[_0x53e1('0x4c')])&&fs[_0x53e1('0x51')](_0xe96bf3)){logger[_0x53e1('0x5c')](_0x53e1('0x5d')+_0xe96bf3+_0x53e1('0x5e'));fs[_0x53e1('0x5f')](_0xe96bf3);}_0xe96bf3=_0xe96bf3+_0x53e1('0x60');if(!_[_0x53e1('0x5b')](_0x5b12f0[_0x53e1('0x4c')])&&fs[_0x53e1('0x51')](_0xe96bf3)){logger[_0x53e1('0x5c')]('File:\x20\x22'+_0xe96bf3+_0x53e1('0x5e'));fs[_0x53e1('0x5f')](_0xe96bf3);}return _0x5b12f0;})['then'](function(_0x37b62d){if(!_0x37b62d)throw new InternalError();return _0x37b62d[_0x53e1('0x58')]();})['then'](function(){_0x1e41fd[_0x53e1('0x18')](0xcc)[_0x53e1('0x23')]();})[_0x53e1('0x43')](handleError(_0x1e41fd,null));}; \ No newline at end of file +var _0x0f12=['Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','order','sort','where','filters','filter','VIRTUAL','merge','SquareRecording','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','filename','download','extname','unlink','message','destroy'];(function(_0x6719b,_0x468a3a){var _0xffd93e=function(_0x264e60){while(--_0x264e60){_0x6719b['push'](_0x6719b['shift']());}};_0xffd93e(++_0x468a3a);}(_0x0f12,0x127));var _0x20f1=function(_0x158581,_0x41ecca){_0x158581=_0x158581-0x0;var _0x1a774a=_0x0f12[_0x158581];return _0x1a774a;};'use strict';var pdf=require(_0x20f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x20f1('0x1'));var zipdir=require(_0x20f1('0x2'));var jsonpatch=require(_0x20f1('0x3'));var rp=require('request-promise');var moment=require(_0x20f1('0x4'));var BPromise=require(_0x20f1('0x5'));var Mustache=require(_0x20f1('0x6'));var util=require('util');var path=require(_0x20f1('0x7'));var sox=require(_0x20f1('0x8'));var csv=require(_0x20f1('0x9'));var ejs=require(_0x20f1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x20f1('0xb'));var crypto=require('crypto');var jsforce=require(_0x20f1('0xc'));var deskjs=require(_0x20f1('0xd'));var toCsv=require(_0x20f1('0x9'));var querystring=require(_0x20f1('0xe'));var Papa=require(_0x20f1('0xf'));var Redis=require('ioredis');var authService=require(_0x20f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x20f1('0x11'));var hardwareService=require(_0x20f1('0x12'));var logger=require(_0x20f1('0x13'))(_0x20f1('0x14'));var utils=require(_0x20f1('0x15'));var config=require(_0x20f1('0x16'));var db=require(_0x20f1('0x17'))['db'];function respondWithStatusCode(_0x230fcc,_0x3577fd){_0x3577fd=_0x3577fd||0xcc;return function(_0x3ef14c){if(_0x3ef14c){return _0x230fcc[_0x20f1('0x18')](_0x3577fd);}return _0x230fcc[_0x20f1('0x19')](_0x3577fd)[_0x20f1('0x1a')]();};}function respondWithResult(_0x35d191,_0x1ad3c6){_0x1ad3c6=_0x1ad3c6||0xc8;return function(_0x3c2b29){if(_0x3c2b29){return _0x35d191['status'](_0x1ad3c6)['json'](_0x3c2b29);}};}function respondWithFilteredResult(_0x2914ab,_0x2780cf){return function(_0x55c954){if(_0x55c954){var _0x3d89c7=_0x55c954[_0x20f1('0x1b')],_0x22412b=_0x2780cf[_0x20f1('0x1c')],_0x3a1d1e=_0x2780cf[_0x20f1('0x1c')]+_0x2780cf[_0x20f1('0x1d')],_0x578f50;if(_0x3a1d1e>=_0x3d89c7){_0x3a1d1e=_0x3d89c7;_0x578f50=0xc8;}else{_0x578f50=0xce;}_0x2914ab[_0x20f1('0x19')](_0x578f50);return _0x2914ab[_0x20f1('0x1e')](_0x20f1('0x1f'),_0x22412b+'-'+_0x3a1d1e+'/'+_0x3d89c7)[_0x20f1('0x20')](_0x55c954);}return null;};}function patchUpdates(_0xee8019){return function(_0x5dca32){try{jsonpatch[_0x20f1('0x21')](_0x5dca32,_0xee8019,!![]);}catch(_0x2c4b86){return BPromise[_0x20f1('0x22')](_0x2c4b86);}return _0x5dca32['save']();};}function saveUpdates(_0xaf610e,_0xf9ae2b){return function(_0x38e69c){if(_0x38e69c){return _0x38e69c[_0x20f1('0x23')](_0xaf610e)['then'](function(_0x160b96){return _0x160b96;});}return null;};}function removeEntity(_0x88d726,_0x1db8cd){return function(_0x2a0aed){if(_0x2a0aed){return _0x2a0aed['destroy']()[_0x20f1('0x24')](function(){_0x88d726[_0x20f1('0x19')](0xcc)[_0x20f1('0x1a')]();});}};}function handleEntityNotFound(_0x45976e,_0x21895a){return function(_0x41b2a9){if(!_0x41b2a9){_0x45976e[_0x20f1('0x18')](0x194);}return _0x41b2a9;};}function handleError(_0x46966a,_0xeda2ae){_0xeda2ae=_0xeda2ae||0x1f4;return function(_0x32a39c){logger[_0x20f1('0x25')](_0x32a39c[_0x20f1('0x26')]);if(_0x32a39c[_0x20f1('0x27')]){delete _0x32a39c[_0x20f1('0x27')];}_0x46966a[_0x20f1('0x19')](_0xeda2ae)[_0x20f1('0x28')](_0x32a39c);};}exports[_0x20f1('0x29')]=function(_0x2fd32b,_0x13deb7){var _0x323b29={},_0x5ee576={},_0x47ede8={'count':0x0,'rows':[]};var _0x3cc417=_[_0x20f1('0x2a')](db['SquareRecording'][_0x20f1('0x2b')],function(_0x263874){return{'name':_0x263874[_0x20f1('0x2c')],'type':_0x263874[_0x20f1('0x2d')][_0x20f1('0x2e')]};});_0x5ee576['model']=_[_0x20f1('0x2a')](_0x3cc417,'name');_0x5ee576[_0x20f1('0x2f')]=_[_0x20f1('0x30')](_0x2fd32b[_0x20f1('0x2f')]);_0x5ee576['filters']=_['intersection'](_0x5ee576[_0x20f1('0x31')],_0x5ee576[_0x20f1('0x2f')]);_0x323b29[_0x20f1('0x32')]=_[_0x20f1('0x33')](_0x5ee576[_0x20f1('0x31')],qs[_0x20f1('0x34')](_0x2fd32b[_0x20f1('0x2f')][_0x20f1('0x34')]));_0x323b29[_0x20f1('0x32')]=_0x323b29[_0x20f1('0x32')][_0x20f1('0x35')]?_0x323b29['attributes']:_0x5ee576['model'];if(!_0x2fd32b['query']['hasOwnProperty']('nolimit')){_0x323b29[_0x20f1('0x1d')]=qs[_0x20f1('0x1d')](_0x2fd32b[_0x20f1('0x2f')]['limit']);_0x323b29[_0x20f1('0x1c')]=qs[_0x20f1('0x1c')](_0x2fd32b[_0x20f1('0x2f')][_0x20f1('0x1c')]);}_0x323b29[_0x20f1('0x36')]=qs[_0x20f1('0x37')](_0x2fd32b[_0x20f1('0x2f')]['sort']);_0x323b29[_0x20f1('0x38')]=qs['filters'](_['pick'](_0x2fd32b[_0x20f1('0x2f')],_0x5ee576[_0x20f1('0x39')]),_0x3cc417);if(_0x2fd32b[_0x20f1('0x2f')][_0x20f1('0x3a')]){_0x323b29['where']=_['merge'](_0x323b29[_0x20f1('0x38')],{'$or':_[_0x20f1('0x2a')](_0x3cc417,function(_0x130db8){if(_0x130db8[_0x20f1('0x2d')]!==_0x20f1('0x3b')){var _0x12858b={};_0x12858b[_0x130db8[_0x20f1('0x27')]]={'$like':'%'+_0x2fd32b['query']['filter']+'%'};return _0x12858b;}})});}_0x323b29=_[_0x20f1('0x3c')]({},_0x323b29,_0x2fd32b['options']);var _0x70a816={'where':_0x323b29['where']};return db[_0x20f1('0x3d')]['count'](_0x70a816)[_0x20f1('0x24')](function(_0x19278a){_0x47ede8[_0x20f1('0x1b')]=_0x19278a;if(_0x2fd32b[_0x20f1('0x2f')][_0x20f1('0x3e')]){_0x323b29[_0x20f1('0x3f')]=[{'all':!![]}];}return db[_0x20f1('0x3d')][_0x20f1('0x40')](_0x323b29);})[_0x20f1('0x24')](function(_0x6b2648){_0x47ede8[_0x20f1('0x41')]=_0x6b2648;return _0x47ede8;})[_0x20f1('0x24')](respondWithFilteredResult(_0x13deb7,_0x323b29))['catch'](handleError(_0x13deb7,null));};exports[_0x20f1('0x42')]=function(_0x203daf,_0x136a29){var _0x33998a={'raw':!![],'where':{'id':_0x203daf[_0x20f1('0x43')]['id']}},_0x11ed8c={};_0x11ed8c[_0x20f1('0x31')]=_[_0x20f1('0x30')](db[_0x20f1('0x3d')]['rawAttributes']);_0x11ed8c[_0x20f1('0x2f')]=_[_0x20f1('0x30')](_0x203daf['query']);_0x11ed8c[_0x20f1('0x39')]=_[_0x20f1('0x33')](_0x11ed8c[_0x20f1('0x31')],_0x11ed8c[_0x20f1('0x2f')]);_0x33998a[_0x20f1('0x32')]=_[_0x20f1('0x33')](_0x11ed8c[_0x20f1('0x31')],qs['fields'](_0x203daf['query']['fields']));_0x33998a[_0x20f1('0x32')]=_0x33998a[_0x20f1('0x32')]['length']?_0x33998a[_0x20f1('0x32')]:_0x11ed8c[_0x20f1('0x31')];if(_0x203daf['query']['includeAll']){_0x33998a['include']=[{'all':!![]}];}_0x33998a=_[_0x20f1('0x3c')]({},_0x33998a,_0x203daf[_0x20f1('0x44')]);return db[_0x20f1('0x3d')][_0x20f1('0x45')](_0x33998a)[_0x20f1('0x24')](handleEntityNotFound(_0x136a29,null))[_0x20f1('0x24')](respondWithResult(_0x136a29,null))['catch'](handleError(_0x136a29,null));};exports[_0x20f1('0x46')]=function(_0x72d297,_0x34c329){return db[_0x20f1('0x3d')][_0x20f1('0x46')](_0x72d297[_0x20f1('0x47')],{})[_0x20f1('0x24')](respondWithResult(_0x34c329,0xc9))[_0x20f1('0x48')](handleError(_0x34c329,null));};exports['update']=function(_0x248017,_0x13e853){if(_0x248017[_0x20f1('0x47')]['id']){delete _0x248017[_0x20f1('0x47')]['id'];}return db[_0x20f1('0x3d')][_0x20f1('0x45')]({'where':{'id':_0x248017[_0x20f1('0x43')]['id']}})[_0x20f1('0x24')](handleEntityNotFound(_0x13e853,null))[_0x20f1('0x24')](saveUpdates(_0x248017[_0x20f1('0x47')],null))[_0x20f1('0x24')](respondWithResult(_0x13e853,null))[_0x20f1('0x48')](handleError(_0x13e853,null));};exports['download']=function(_0xa8e103,_0x268687,_0x555d09){var _0x471e10=require(_0x20f1('0x49'));var _0x47f646=![];var _0x55c421={};if(_0xa8e103['query'][_0x20f1('0x2d')]&&_0xa8e103[_0x20f1('0x2f')][_0x20f1('0x2d')]===_0x20f1('0x4a')){_0x55c421[_0x20f1('0x4a')]=_0xa8e103[_0x20f1('0x43')]['id'];}else{_0x55c421['id']=_0xa8e103['params']['id'];}return db['SquareRecording'][_0x20f1('0x45')]({'where':_0x55c421,'attributes':['id',_0x20f1('0x4b'),'filename'],'raw':!![]})[_0x20f1('0x24')](handleEntityNotFound(_0x268687,null))[_0x20f1('0x24')](function(_0x1443a4){if(_0x1443a4){var _0x49dde6=_0x1443a4['savePath'];var _0x13645e=util['format'](_0x20f1('0x4c'),_0x49dde6);if(fs[_0x20f1('0x4d')](_0x13645e)){_0x47f646=!![];return _0x471e10[_0x20f1('0x4e')](_0x13645e,_0x49dde6,config[_0x20f1('0x4f')][_0x20f1('0x50')])[_0x20f1('0x24')](function(){return _0x1443a4;});}return _0x1443a4;}})[_0x20f1('0x24')](function(_0x4bc6b2){if(_0x4bc6b2){var _0xd03b14=_0x4bc6b2[_0x20f1('0x4b')];if(!fs['existsSync'](_0xd03b14)){throw new db[(_0x20f1('0x51'))]['ValidationError'](_0x20f1('0x52'));}if(_0x4bc6b2[_0x20f1('0x53')]){return _0x268687[_0x20f1('0x54')](_0xd03b14,_0x4bc6b2[_0x20f1('0x53')]+path[_0x20f1('0x55')](_0xd03b14),function(){if(_0x47f646){fs[_0x20f1('0x56')](_0xd03b14);}});}else{return _0x268687[_0x20f1('0x54')](_0xd03b14,function(_0x20f361){if(_0x47f646){fs[_0x20f1('0x56')](_0xd03b14);}});}}})[_0x20f1('0x48')](function(_0x563d8e){if(_0x563d8e[_0x20f1('0x57')]==='SquareRecording\x20not\x20found'){_0x268687['status'](0x194)[_0x20f1('0x28')]('Not\x20found');}else{return handleError(_0x268687,null);}});};exports[_0x20f1('0x58')]=function(_0x25f518,_0x399b3b){return db['SquareRecording'][_0x20f1('0x45')]({'where':{'id':_0x25f518[_0x20f1('0x43')]['id']}})['then'](function(_0x5471e6){if(!_0x5471e6)throw new ReferenceError(_0x20f1('0x59'));return _0x5471e6;})['then'](function(_0x2a50e5){var _0x25a791=_0x2a50e5[_0x20f1('0x4b')];logger[_0x20f1('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x25a791);if(!_[_0x20f1('0x5b')](_0x2a50e5[_0x20f1('0x4b')])&&fs[_0x20f1('0x4d')](_0x25a791)){logger[_0x20f1('0x5a')]('File:\x20\x22'+_0x25a791+_0x20f1('0x5c'));fs[_0x20f1('0x5d')](_0x25a791);}_0x25a791=_0x25a791+_0x20f1('0x5e');if(!_['isNil'](_0x2a50e5[_0x20f1('0x4b')])&&fs[_0x20f1('0x4d')](_0x25a791)){logger[_0x20f1('0x5a')](_0x20f1('0x5f')+_0x25a791+_0x20f1('0x5c'));fs[_0x20f1('0x5d')](_0x25a791);}return _0x2a50e5;})[_0x20f1('0x24')](function(_0x132ee5){if(!_0x132ee5)throw new InternalError();return _0x132ee5[_0x20f1('0x58')]();})[_0x20f1('0x24')](function(){_0x399b3b['status'](0xcc)['end']();})['catch'](handleError(_0x399b3b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 06d6380..18f46a8 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 _0xd602=['../../config/environment','./squareRecording.attributes','exports','../../config/logger','request-promise','path'];(function(_0x5820bb,_0x53c67f){var _0x2db587=function(_0x7ba4ad){while(--_0x7ba4ad){_0x5820bb['push'](_0x5820bb['shift']());}};_0x2db587(++_0x53c67f);}(_0xd602,0xdb));var _0x2d60=function(_0x3cbc19,_0x44e148){_0x3cbc19=_0x3cbc19-0x0;var _0x2cbd2f=_0xd602[_0x3cbc19];return _0x2cbd2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d60('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d60('0x1'));var fs=require('fs');var path=require(_0x2d60('0x2'));var rimraf=require('rimraf');var config=require(_0x2d60('0x3'));var attributes=require(_0x2d60('0x4'));module[_0x2d60('0x5')]=function(_0x1e1415,_0xb269f6){return _0x1e1415['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f4c=['rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','bluebird'];(function(_0x307e24,_0x1a1b78){var _0x2b5b89=function(_0x380c38){while(--_0x380c38){_0x307e24['push'](_0x307e24['shift']());}};_0x2b5b89(++_0x1a1b78);}(_0x9f4c,0x8a));var _0xc9f4=function(_0x5daf5e,_0x4b51f5){_0x5daf5e=_0x5daf5e-0x0;var _0x543ae0=_0x9f4c[_0x5daf5e];return _0x543ae0;};'use strict';var _=require(_0xc9f4('0x0'));var util=require(_0xc9f4('0x1'));var logger=require(_0xc9f4('0x2'))('api');var moment=require(_0xc9f4('0x3'));var BPromise=require(_0xc9f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc9f4('0x5'));var config=require(_0xc9f4('0x6'));var attributes=require(_0xc9f4('0x7'));module['exports']=function(_0x142b2d,_0x386752){return _0x142b2d[_0xc9f4('0x8')](_0xc9f4('0x9'),attributes,{'tableName':_0xc9f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 356a54b..a569e7c 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 _0xe746=['raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x125068,_0x19f720){var _0x1da90c=function(_0x175d7c){while(--_0x175d7c){_0x125068['push'](_0x125068['shift']());}};_0x1da90c(++_0x19f720);}(_0xe746,0x17b));var _0x6e74=function(_0x156376,_0x142405){_0x156376=_0x156376-0x0;var _0x43d3ca=_0xe746[_0x156376];return _0x43d3ca;};'use strict';var _=require(_0x6e74('0x0'));var util=require(_0x6e74('0x1'));var moment=require(_0x6e74('0x2'));var BPromise=require(_0x6e74('0x3'));var rs=require(_0x6e74('0x4'));var fs=require('fs');var Redis=require(_0x6e74('0x5'));var db=require(_0x6e74('0x6'))['db'];var utils=require(_0x6e74('0x7'));var logger=require(_0x6e74('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6e74('0x9')][_0x6e74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca759,_0x3f5bdc,_0x418afb){return new BPromise(function(_0x3cbd09,_0x53d364){return client[_0x6e74('0xb')](_0x5ca759,_0x418afb)[_0x6e74('0xc')](function(_0x1962df){logger['info'](_0x6e74('0xd'),_0x3f5bdc,_0x6e74('0xe'));logger[_0x6e74('0xf')](_0x6e74('0x10'),_0x3f5bdc,_0x6e74('0xe'),JSON[_0x6e74('0x11')](_0x1962df));if(_0x1962df[_0x6e74('0x12')]){if(_0x1962df[_0x6e74('0x12')]['code']===0x1f4){logger[_0x6e74('0x12')]('SquareRecording,\x20%s,\x20%s',_0x3f5bdc,_0x1962df[_0x6e74('0x12')][_0x6e74('0x13')]);return _0x53d364(_0x1962df[_0x6e74('0x12')][_0x6e74('0x13')]);}logger[_0x6e74('0x12')](_0x6e74('0xd'),_0x3f5bdc,_0x1962df['error'][_0x6e74('0x13')]);return _0x3cbd09(_0x1962df[_0x6e74('0x12')][_0x6e74('0x13')]);}else{logger['info'](_0x6e74('0xd'),_0x3f5bdc,'request\x20sent');_0x3cbd09(_0x1962df[_0x6e74('0x14')][_0x6e74('0x13')]);}})[_0x6e74('0x15')](function(_0x2f0fc0){logger[_0x6e74('0x12')](_0x6e74('0xd'),_0x3f5bdc,_0x2f0fc0);_0x53d364(_0x2f0fc0);});});}exports[_0x6e74('0x16')]=function(_0x1e5bab){var _0x17cbd0=this;return new Promise(function(_0x5aa011,_0x5476fe){return db[_0x6e74('0x17')][_0x6e74('0x18')](_0x1e5bab[_0x6e74('0x19')],{'raw':_0x1e5bab['options']?_0x1e5bab[_0x6e74('0x1a')][_0x6e74('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x463861){logger[_0x6e74('0x1c')](_0x6e74('0x16'),_0x1e5bab);logger[_0x6e74('0xf')]('CreateSquareRecording',_0x1e5bab,JSON[_0x6e74('0x11')](_0x463861));_0x5aa011(_0x463861);})['catch'](function(_0x48b03c){logger[_0x6e74('0x12')]('CreateSquareRecording',_0x48b03c['message'],_0x1e5bab);_0x5476fe(_0x17cbd0[_0x6e74('0x12')](0x1f4,_0x48b03c['message']));});});}; \ No newline at end of file +var _0x3a90=['jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSquareRecording','SquareRecording','body','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x51edca,_0x18ad70){var _0x2b77ec=function(_0x55a549){while(--_0x55a549){_0x51edca['push'](_0x51edca['shift']());}};_0x2b77ec(++_0x18ad70);}(_0x3a90,0x1cc));var _0x03a9=function(_0x2584b6,_0x640d3d){_0x2584b6=_0x2584b6-0x0;var _0x201baf=_0x3a90[_0x2584b6];return _0x201baf;};'use strict';var _=require(_0x03a9('0x0'));var util=require(_0x03a9('0x1'));var moment=require(_0x03a9('0x2'));var BPromise=require(_0x03a9('0x3'));var rs=require(_0x03a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x03a9('0x5'));var logger=require(_0x03a9('0x6'))(_0x03a9('0x7'));var config=require('../../config/environment');var jayson=require(_0x03a9('0x8'));var client=jayson[_0x03a9('0x9')][_0x03a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x117c2a,_0x481d1b,_0x502bc5){return new BPromise(function(_0x37f16f,_0x20ba17){return client[_0x03a9('0xb')](_0x117c2a,_0x502bc5)[_0x03a9('0xc')](function(_0x462119){logger['info'](_0x03a9('0xd'),_0x481d1b,_0x03a9('0xe'));logger[_0x03a9('0xf')](_0x03a9('0x10'),_0x481d1b,_0x03a9('0xe'),JSON[_0x03a9('0x11')](_0x462119));if(_0x462119[_0x03a9('0x12')]){if(_0x462119[_0x03a9('0x12')]['code']===0x1f4){logger[_0x03a9('0x12')](_0x03a9('0xd'),_0x481d1b,_0x462119[_0x03a9('0x12')][_0x03a9('0x13')]);return _0x20ba17(_0x462119[_0x03a9('0x12')]['message']);}logger[_0x03a9('0x12')]('SquareRecording,\x20%s,\x20%s',_0x481d1b,_0x462119['error']['message']);return _0x37f16f(_0x462119[_0x03a9('0x12')][_0x03a9('0x13')]);}else{logger[_0x03a9('0x14')](_0x03a9('0xd'),_0x481d1b,_0x03a9('0xe'));_0x37f16f(_0x462119['result'][_0x03a9('0x13')]);}})[_0x03a9('0x15')](function(_0x2e2a14){logger[_0x03a9('0x12')](_0x03a9('0xd'),_0x481d1b,_0x2e2a14);_0x20ba17(_0x2e2a14);});});}exports[_0x03a9('0x16')]=function(_0x2654ac){var _0x32e64a=this;return new Promise(function(_0x573755,_0x43f6c6){return db[_0x03a9('0x17')]['create'](_0x2654ac[_0x03a9('0x18')],{'raw':_0x2654ac['options']?_0x2654ac['options'][_0x03a9('0x19')]===undefined?!![]:![]:!![]})[_0x03a9('0xc')](function(_0x5484c0){logger[_0x03a9('0x14')](_0x03a9('0x16'),_0x2654ac);logger[_0x03a9('0xf')](_0x03a9('0x16'),_0x2654ac,JSON[_0x03a9('0x11')](_0x5484c0));_0x573755(_0x5484c0);})[_0x03a9('0x15')](function(_0x26fb6d){logger[_0x03a9('0x12')]('CreateSquareRecording',_0x26fb6d[_0x03a9('0x13')],_0x2654ac);_0x43f6c6(_0x32e64a[_0x03a9('0x12')](0x1f4,_0x26fb6d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7b2f71f..fae0a46 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 _0xda9e=['../../config/environment','./squareReport.controller','index','get','/describe','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','util','path','express','../../components/interaction/service'];(function(_0x1524c0,_0x2072ce){var _0x5b1c82=function(_0x3453a5){while(--_0x3453a5){_0x1524c0['push'](_0x1524c0['shift']());}};_0x5b1c82(++_0x2072ce);}(_0xda9e,0xaf));var _0xeda9=function(_0x3b79fb,_0x3710a8){_0x3b79fb=_0x3b79fb-0x0;var _0x5c95af=_0xda9e[_0x3b79fb];return _0x5c95af;};'use strict';var multer=require(_0xeda9('0x0'));var util=require(_0xeda9('0x1'));var path=require(_0xeda9('0x2'));var timeout=require('connect-timeout');var express=require(_0xeda9('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeda9('0x4'));var config=require(_0xeda9('0x5'));var controller=require(_0xeda9('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xeda9('0x7')]);router[_0xeda9('0x8')](_0xeda9('0x9'),auth[_0xeda9('0xa')](),controller['describe']);router[_0xeda9('0x8')](_0xeda9('0xb'),auth[_0xeda9('0xa')](),controller['show']);router[_0xeda9('0xc')]('/',auth[_0xeda9('0xa')](),controller[_0xeda9('0xd')]);router[_0xeda9('0xe')](_0xeda9('0xb'),auth[_0xeda9('0xa')](),controller[_0xeda9('0xf')]);router['delete'](_0xeda9('0xb'),auth[_0xeda9('0xa')](),controller[_0xeda9('0x10')]);module[_0xeda9('0x11')]=router; \ No newline at end of file +var _0xbaea=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy'];(function(_0x4ec1e0,_0x5b11bd){var _0xb1a743=function(_0x38a559){while(--_0x38a559){_0x4ec1e0['push'](_0x4ec1e0['shift']());}};_0xb1a743(++_0x5b11bd);}(_0xbaea,0x1ef));var _0xabae=function(_0x361475,_0x32ecc5){_0x361475=_0x361475-0x0;var _0x317cf1=_0xbaea[_0x361475];return _0x317cf1;};'use strict';var multer=require(_0xabae('0x0'));var util=require('util');var path=require(_0xabae('0x1'));var timeout=require(_0xabae('0x2'));var express=require('express');var router=express[_0xabae('0x3')]();var auth=require(_0xabae('0x4'));var interaction=require(_0xabae('0x5'));var config=require(_0xabae('0x6'));var controller=require(_0xabae('0x7'));router[_0xabae('0x8')]('/',auth[_0xabae('0x9')](),controller[_0xabae('0xa')]);router[_0xabae('0x8')](_0xabae('0xb'),auth[_0xabae('0x9')](),controller[_0xabae('0xc')]);router['get'](_0xabae('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xabae('0xe')]('/',auth[_0xabae('0x9')](),controller[_0xabae('0xf')]);router['put'](_0xabae('0xd'),auth[_0xabae('0x9')](),controller['update']);router[_0xabae('0x10')]('/:id',auth[_0xabae('0x9')](),controller[_0xabae('0x11')]);module[_0xabae('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index b3d20b4..fe4a56d 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 _0x9727=['STRING','DATE','BOOLEAN','sequelize'];(function(_0xcbac91,_0x25d844){var _0x34d97f=function(_0x538160){while(--_0x538160){_0xcbac91['push'](_0xcbac91['shift']());}};_0x34d97f(++_0x25d844);}(_0x9727,0x113));var _0x7972=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x9727[_0x5be795];return _0x4e8a3b;};'use strict';var Sequelize=require(_0x7972('0x0'));module['exports']={'network':{'type':Sequelize[_0x7972('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7972('0x1')]},'language':{'type':Sequelize[_0x7972('0x1')]},'type':{'type':Sequelize[_0x7972('0x1')]},'uniqueid':{'type':Sequelize[_0x7972('0x1')]},'version':{'type':Sequelize[_0x7972('0x1')]},'callerid':{'type':Sequelize[_0x7972('0x1')]},'calleridname':{'type':Sequelize[_0x7972('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x7972('0x1')]},'callington':{'type':Sequelize[_0x7972('0x1')]},'callingtns':{'type':Sequelize[_0x7972('0x1')]},'dnid':{'type':Sequelize[_0x7972('0x1')]},'rdnis':{'type':Sequelize[_0x7972('0x1')]},'context':{'type':Sequelize[_0x7972('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7972('0x1')]},'enhanced':{'type':Sequelize[_0x7972('0x1')]},'accountcode':{'type':Sequelize[_0x7972('0x1')]},'threadid':{'type':Sequelize[_0x7972('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7972('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x7972('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7bea=['DATE','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7bea,0x115));var _0xa7be=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0x7bea[_0x431ff8];return _0x84ccd4;};'use strict';var Sequelize=require(_0xa7be('0x0'));module[_0xa7be('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa7be('0x2')]},'channel':{'type':Sequelize[_0xa7be('0x2')]},'language':{'type':Sequelize[_0xa7be('0x2')]},'type':{'type':Sequelize[_0xa7be('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa7be('0x2')]},'calleridname':{'type':Sequelize[_0xa7be('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xa7be('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xa7be('0x2')]},'context':{'type':Sequelize[_0xa7be('0x2')]},'extension':{'type':Sequelize[_0xa7be('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xa7be('0x2')]},'accountcode':{'type':Sequelize[_0xa7be('0x2')]},'threadid':{'type':Sequelize[_0xa7be('0x2')]},'project_name':{'type':Sequelize[_0xa7be('0x2')]},'joinAt':{'type':Sequelize[_0xa7be('0x3')]},'leaveAt':{'type':Sequelize[_0xa7be('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 595d801..3e0425f 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 _0xbc38=['reject','update','then','destroy','end','error','stack','send','index','SquareReport','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','catch','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x509d73,_0x17f0cb){var _0x3327c4=function(_0x117cf1){while(--_0x117cf1){_0x509d73['push'](_0x509d73['shift']());}};_0x3327c4(++_0x17f0cb);}(_0xbc38,0x1f2));var _0x8bc3=function(_0x185bad,_0x4ae698){_0x185bad=_0x185bad-0x0;var _0x1846a4=_0xbc38[_0x185bad];return _0x1846a4;};'use strict';var pdf=require(_0x8bc3('0x0'));var emlformat=require(_0x8bc3('0x1'));var rimraf=require(_0x8bc3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bc3('0x3'));var rp=require(_0x8bc3('0x4'));var moment=require(_0x8bc3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8bc3('0x6'));var util=require(_0x8bc3('0x7'));var path=require(_0x8bc3('0x8'));var sox=require(_0x8bc3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8bc3('0xa'));var squel=require(_0x8bc3('0xb'));var crypto=require(_0x8bc3('0xc'));var jsforce=require(_0x8bc3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8bc3('0xe'));var querystring=require(_0x8bc3('0xf'));var Papa=require(_0x8bc3('0x10'));var Redis=require(_0x8bc3('0x11'));var authService=require(_0x8bc3('0x12'));var qs=require(_0x8bc3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bc3('0x14'));var logger=require(_0x8bc3('0x15'))(_0x8bc3('0x16'));var utils=require(_0x8bc3('0x17'));var config=require(_0x8bc3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46862a,_0x130cf6){_0x130cf6=_0x130cf6||0xcc;return function(_0x43afc3){if(_0x43afc3){return _0x46862a[_0x8bc3('0x19')](_0x130cf6);}return _0x46862a[_0x8bc3('0x1a')](_0x130cf6)['end']();};}function respondWithResult(_0x207a14,_0xb3943b){_0xb3943b=_0xb3943b||0xc8;return function(_0x54a189){if(_0x54a189){return _0x207a14[_0x8bc3('0x1a')](_0xb3943b)[_0x8bc3('0x1b')](_0x54a189);}};}function respondWithFilteredResult(_0x5a8bb7,_0x3d92c6){return function(_0x47ab06){if(_0x47ab06){var _0x3d9097=_0x47ab06[_0x8bc3('0x1c')],_0x3bcb65=_0x3d92c6['offset'],_0x27bf65=_0x3d92c6[_0x8bc3('0x1d')]+_0x3d92c6[_0x8bc3('0x1e')],_0x5d889e;if(_0x27bf65>=_0x3d9097){_0x27bf65=_0x3d9097;_0x5d889e=0xc8;}else{_0x5d889e=0xce;}_0x5a8bb7[_0x8bc3('0x1a')](_0x5d889e);return _0x5a8bb7[_0x8bc3('0x1f')](_0x8bc3('0x20'),_0x3bcb65+'-'+_0x27bf65+'/'+_0x3d9097)[_0x8bc3('0x1b')](_0x47ab06);}return null;};}function patchUpdates(_0xb25e92){return function(_0x1013e4){try{jsonpatch[_0x8bc3('0x21')](_0x1013e4,_0xb25e92,!![]);}catch(_0x39b70e){return BPromise[_0x8bc3('0x22')](_0x39b70e);}return _0x1013e4['save']();};}function saveUpdates(_0x1cfa07,_0x3ca641){return function(_0x47974e){if(_0x47974e){return _0x47974e[_0x8bc3('0x23')](_0x1cfa07)[_0x8bc3('0x24')](function(_0x73335e){return _0x73335e;});}return null;};}function removeEntity(_0x4b4971,_0x5b9e23){return function(_0x1872f8){if(_0x1872f8){return _0x1872f8[_0x8bc3('0x25')]()[_0x8bc3('0x24')](function(){_0x4b4971[_0x8bc3('0x1a')](0xcc)[_0x8bc3('0x26')]();});}};}function handleEntityNotFound(_0x1a8dbd,_0x261d83){return function(_0x474bdf){if(!_0x474bdf){_0x1a8dbd[_0x8bc3('0x19')](0x194);}return _0x474bdf;};}function handleError(_0x3fbefc,_0xaec844){_0xaec844=_0xaec844||0x1f4;return function(_0x45a452){logger[_0x8bc3('0x27')](_0x45a452[_0x8bc3('0x28')]);if(_0x45a452['name']){delete _0x45a452['name'];}_0x3fbefc[_0x8bc3('0x1a')](_0xaec844)[_0x8bc3('0x29')](_0x45a452);};}exports[_0x8bc3('0x2a')]=function(_0x411aed,_0x561be1){var _0x10af78={},_0x129e65={},_0x4a6e4a={'count':0x0,'rows':[]};var _0x2927ce=_['map'](db[_0x8bc3('0x2b')]['rawAttributes'],function(_0x5ea756){return{'name':_0x5ea756[_0x8bc3('0x2c')],'type':_0x5ea756['type'][_0x8bc3('0x2d')]};});_0x129e65[_0x8bc3('0x2e')]=_['map'](_0x2927ce,_0x8bc3('0x2f'));_0x129e65[_0x8bc3('0x30')]=_[_0x8bc3('0x31')](_0x411aed[_0x8bc3('0x30')]);_0x129e65[_0x8bc3('0x32')]=_[_0x8bc3('0x33')](_0x129e65[_0x8bc3('0x2e')],_0x129e65[_0x8bc3('0x30')]);_0x10af78[_0x8bc3('0x34')]=_['intersection'](_0x129e65[_0x8bc3('0x2e')],qs[_0x8bc3('0x35')](_0x411aed[_0x8bc3('0x30')][_0x8bc3('0x35')]));_0x10af78[_0x8bc3('0x34')]=_0x10af78[_0x8bc3('0x34')][_0x8bc3('0x36')]?_0x10af78[_0x8bc3('0x34')]:_0x129e65[_0x8bc3('0x2e')];if(!_0x411aed[_0x8bc3('0x30')]['hasOwnProperty'](_0x8bc3('0x37'))){_0x10af78[_0x8bc3('0x1e')]=qs[_0x8bc3('0x1e')](_0x411aed[_0x8bc3('0x30')][_0x8bc3('0x1e')]);_0x10af78[_0x8bc3('0x1d')]=qs[_0x8bc3('0x1d')](_0x411aed['query'][_0x8bc3('0x1d')]);}_0x10af78[_0x8bc3('0x38')]=qs[_0x8bc3('0x39')](_0x411aed[_0x8bc3('0x30')][_0x8bc3('0x39')]);_0x10af78[_0x8bc3('0x3a')]=qs[_0x8bc3('0x32')](_[_0x8bc3('0x3b')](_0x411aed[_0x8bc3('0x30')],_0x129e65[_0x8bc3('0x32')]),_0x2927ce);if(_0x411aed[_0x8bc3('0x30')][_0x8bc3('0x3c')]){_0x10af78['where']=_[_0x8bc3('0x3d')](_0x10af78[_0x8bc3('0x3a')],{'$or':_['map'](_0x2927ce,function(_0x523e7a){if(_0x523e7a[_0x8bc3('0x3e')]!=='VIRTUAL'){var _0x228c9f={};_0x228c9f[_0x523e7a['name']]={'$like':'%'+_0x411aed[_0x8bc3('0x30')]['filter']+'%'};return _0x228c9f;}})});}_0x10af78=_[_0x8bc3('0x3d')]({},_0x10af78,_0x411aed['options']);var _0x5ac9f8={'where':_0x10af78[_0x8bc3('0x3a')]};return db[_0x8bc3('0x2b')][_0x8bc3('0x1c')](_0x5ac9f8)[_0x8bc3('0x24')](function(_0x3583b9){_0x4a6e4a[_0x8bc3('0x1c')]=_0x3583b9;if(_0x411aed[_0x8bc3('0x30')][_0x8bc3('0x3f')]){_0x10af78[_0x8bc3('0x40')]=[{'all':!![]}];}return db[_0x8bc3('0x2b')][_0x8bc3('0x41')](_0x10af78);})[_0x8bc3('0x24')](function(_0x1fe1b6){_0x4a6e4a[_0x8bc3('0x42')]=_0x1fe1b6;return _0x4a6e4a;})[_0x8bc3('0x24')](respondWithFilteredResult(_0x561be1,_0x10af78))['catch'](handleError(_0x561be1,null));};exports[_0x8bc3('0x43')]=function(_0x53caec,_0x25cc1e){var _0x3d7873={'raw':!![],'where':{'id':_0x53caec[_0x8bc3('0x44')]['id']}},_0x2946e5={};_0x2946e5[_0x8bc3('0x2e')]=_['keys'](db[_0x8bc3('0x2b')][_0x8bc3('0x45')]);_0x2946e5[_0x8bc3('0x30')]=_[_0x8bc3('0x31')](_0x53caec['query']);_0x2946e5[_0x8bc3('0x32')]=_[_0x8bc3('0x33')](_0x2946e5['model'],_0x2946e5[_0x8bc3('0x30')]);_0x3d7873['attributes']=_[_0x8bc3('0x33')](_0x2946e5['model'],qs[_0x8bc3('0x35')](_0x53caec[_0x8bc3('0x30')][_0x8bc3('0x35')]));_0x3d7873[_0x8bc3('0x34')]=_0x3d7873[_0x8bc3('0x34')]['length']?_0x3d7873[_0x8bc3('0x34')]:_0x2946e5['model'];if(_0x53caec[_0x8bc3('0x30')]['includeAll']){_0x3d7873[_0x8bc3('0x40')]=[{'all':!![]}];}_0x3d7873=_['merge']({},_0x3d7873,_0x53caec[_0x8bc3('0x46')]);return db[_0x8bc3('0x2b')][_0x8bc3('0x47')](_0x3d7873)[_0x8bc3('0x24')](handleEntityNotFound(_0x25cc1e,null))[_0x8bc3('0x24')](respondWithResult(_0x25cc1e,null))['catch'](handleError(_0x25cc1e,null));};exports[_0x8bc3('0x48')]=function(_0x1fca5b,_0x100f56){return db[_0x8bc3('0x2b')][_0x8bc3('0x48')](_0x1fca5b[_0x8bc3('0x49')],{})[_0x8bc3('0x24')](respondWithResult(_0x100f56,0xc9))[_0x8bc3('0x4a')](handleError(_0x100f56,null));};exports['update']=function(_0xd5b094,_0x324c95){if(_0xd5b094[_0x8bc3('0x49')]['id']){delete _0xd5b094[_0x8bc3('0x49')]['id'];}return db[_0x8bc3('0x2b')]['find']({'where':{'id':_0xd5b094['params']['id']}})[_0x8bc3('0x24')](handleEntityNotFound(_0x324c95,null))[_0x8bc3('0x24')](saveUpdates(_0xd5b094[_0x8bc3('0x49')],null))[_0x8bc3('0x24')](respondWithResult(_0x324c95,null))[_0x8bc3('0x4a')](handleError(_0x324c95,null));};exports[_0x8bc3('0x25')]=function(_0x27c3f7,_0x298d1d){return db[_0x8bc3('0x2b')][_0x8bc3('0x47')]({'where':{'id':_0x27c3f7[_0x8bc3('0x44')]['id']}})[_0x8bc3('0x24')](handleEntityNotFound(_0x298d1d,null))[_0x8bc3('0x24')](removeEntity(_0x298d1d,null))[_0x8bc3('0x4a')](handleError(_0x298d1d,null));};exports[_0x8bc3('0x4b')]=function(_0x1cb14e,_0xefa9c3){return db[_0x8bc3('0x2b')][_0x8bc3('0x4b')]()[_0x8bc3('0x24')](respondWithResult(_0xefa9c3,null))[_0x8bc3('0x4a')](handleError(_0xefa9c3,null));}; \ No newline at end of file +var _0x17ef=['options','find','create','body','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','includeAll','rows','catch','include'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x17ef,0xe1));var _0xf17e=function(_0x54f973,_0x39e1ed){_0x54f973=_0x54f973-0x0;var _0x32d433=_0x17ef[_0x54f973];return _0x32d433;};'use strict';var pdf=require(_0xf17e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf17e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf17e('0x2'));var rp=require(_0xf17e('0x3'));var moment=require(_0xf17e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf17e('0x5'));var util=require(_0xf17e('0x6'));var path=require(_0xf17e('0x7'));var sox=require(_0xf17e('0x8'));var csv=require('to-csv');var ejs=require(_0xf17e('0x9'));var fs=require('fs');var _=require(_0xf17e('0xa'));var squel=require(_0xf17e('0xb'));var crypto=require(_0xf17e('0xc'));var jsforce=require(_0xf17e('0xd'));var deskjs=require(_0xf17e('0xe'));var toCsv=require(_0xf17e('0xf'));var querystring=require('querystring');var Papa=require(_0xf17e('0x10'));var Redis=require(_0xf17e('0x11'));var authService=require(_0xf17e('0x12'));var qs=require(_0xf17e('0x13'));var as=require(_0xf17e('0x14'));var hardwareService=require(_0xf17e('0x15'));var logger=require('../../config/logger')(_0xf17e('0x16'));var utils=require(_0xf17e('0x17'));var config=require(_0xf17e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58acca,_0x323d01){_0x323d01=_0x323d01||0xcc;return function(_0x2df543){if(_0x2df543){return _0x58acca[_0xf17e('0x19')](_0x323d01);}return _0x58acca[_0xf17e('0x1a')](_0x323d01)[_0xf17e('0x1b')]();};}function respondWithResult(_0x26db03,_0x2ce1b0){_0x2ce1b0=_0x2ce1b0||0xc8;return function(_0xd29e4){if(_0xd29e4){return _0x26db03[_0xf17e('0x1a')](_0x2ce1b0)[_0xf17e('0x1c')](_0xd29e4);}};}function respondWithFilteredResult(_0x3635bc,_0x42236c){return function(_0x585207){if(_0x585207){var _0x526399=_0x585207[_0xf17e('0x1d')],_0x5b738d=_0x42236c['offset'],_0x59fb47=_0x42236c[_0xf17e('0x1e')]+_0x42236c[_0xf17e('0x1f')],_0x4857eb;if(_0x59fb47>=_0x526399){_0x59fb47=_0x526399;_0x4857eb=0xc8;}else{_0x4857eb=0xce;}_0x3635bc[_0xf17e('0x1a')](_0x4857eb);return _0x3635bc[_0xf17e('0x20')](_0xf17e('0x21'),_0x5b738d+'-'+_0x59fb47+'/'+_0x526399)['json'](_0x585207);}return null;};}function patchUpdates(_0x28d29e){return function(_0x16a985){try{jsonpatch[_0xf17e('0x22')](_0x16a985,_0x28d29e,!![]);}catch(_0x841447){return BPromise[_0xf17e('0x23')](_0x841447);}return _0x16a985[_0xf17e('0x24')]();};}function saveUpdates(_0x30b98c,_0x28606d){return function(_0x52610d){if(_0x52610d){return _0x52610d[_0xf17e('0x25')](_0x30b98c)[_0xf17e('0x26')](function(_0x4b61b7){return _0x4b61b7;});}return null;};}function removeEntity(_0x1a3274,_0x48cdd3){return function(_0x246041){if(_0x246041){return _0x246041['destroy']()['then'](function(){_0x1a3274['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e3fa3,_0x5a29b2){return function(_0xbe33c3){if(!_0xbe33c3){_0x5e3fa3['sendStatus'](0x194);}return _0xbe33c3;};}function handleError(_0x4f1dd7,_0x5d808b){_0x5d808b=_0x5d808b||0x1f4;return function(_0x53f2d8){logger[_0xf17e('0x27')](_0x53f2d8[_0xf17e('0x28')]);if(_0x53f2d8[_0xf17e('0x29')]){delete _0x53f2d8[_0xf17e('0x29')];}_0x4f1dd7[_0xf17e('0x1a')](_0x5d808b)[_0xf17e('0x2a')](_0x53f2d8);};}exports[_0xf17e('0x2b')]=function(_0x541427,_0xf1cc27){var _0x3b728a={},_0x32ec0e={},_0x3b09ac={'count':0x0,'rows':[]};var _0x22c4b6=_[_0xf17e('0x2c')](db[_0xf17e('0x2d')][_0xf17e('0x2e')],function(_0x834cfa){return{'name':_0x834cfa['fieldName'],'type':_0x834cfa[_0xf17e('0x2f')][_0xf17e('0x30')]};});_0x32ec0e[_0xf17e('0x31')]=_['map'](_0x22c4b6,_0xf17e('0x29'));_0x32ec0e[_0xf17e('0x32')]=_[_0xf17e('0x33')](_0x541427[_0xf17e('0x32')]);_0x32ec0e[_0xf17e('0x34')]=_[_0xf17e('0x35')](_0x32ec0e['model'],_0x32ec0e[_0xf17e('0x32')]);_0x3b728a[_0xf17e('0x36')]=_[_0xf17e('0x35')](_0x32ec0e[_0xf17e('0x31')],qs['fields'](_0x541427[_0xf17e('0x32')][_0xf17e('0x37')]));_0x3b728a[_0xf17e('0x36')]=_0x3b728a[_0xf17e('0x36')][_0xf17e('0x38')]?_0x3b728a[_0xf17e('0x36')]:_0x32ec0e['model'];if(!_0x541427[_0xf17e('0x32')][_0xf17e('0x39')]('nolimit')){_0x3b728a[_0xf17e('0x1f')]=qs[_0xf17e('0x1f')](_0x541427[_0xf17e('0x32')]['limit']);_0x3b728a[_0xf17e('0x1e')]=qs[_0xf17e('0x1e')](_0x541427[_0xf17e('0x32')]['offset']);}_0x3b728a[_0xf17e('0x3a')]=qs['sort'](_0x541427[_0xf17e('0x32')][_0xf17e('0x3b')]);_0x3b728a['where']=qs[_0xf17e('0x34')](_['pick'](_0x541427[_0xf17e('0x32')],_0x32ec0e[_0xf17e('0x34')]),_0x22c4b6);if(_0x541427['query'][_0xf17e('0x3c')]){_0x3b728a['where']=_['merge'](_0x3b728a[_0xf17e('0x3d')],{'$or':_['map'](_0x22c4b6,function(_0x4e3a37){if(_0x4e3a37[_0xf17e('0x2f')]!==_0xf17e('0x3e')){var _0x40612e={};_0x40612e[_0x4e3a37[_0xf17e('0x29')]]={'$like':'%'+_0x541427['query'][_0xf17e('0x3c')]+'%'};return _0x40612e;}})});}_0x3b728a=_['merge']({},_0x3b728a,_0x541427['options']);var _0x48faa8={'where':_0x3b728a[_0xf17e('0x3d')]};return db[_0xf17e('0x2d')][_0xf17e('0x1d')](_0x48faa8)['then'](function(_0x241086){_0x3b09ac['count']=_0x241086;if(_0x541427[_0xf17e('0x32')][_0xf17e('0x3f')]){_0x3b728a['include']=[{'all':!![]}];}return db[_0xf17e('0x2d')]['findAll'](_0x3b728a);})[_0xf17e('0x26')](function(_0x33bfe5){_0x3b09ac[_0xf17e('0x40')]=_0x33bfe5;return _0x3b09ac;})[_0xf17e('0x26')](respondWithFilteredResult(_0xf1cc27,_0x3b728a))[_0xf17e('0x41')](handleError(_0xf1cc27,null));};exports['show']=function(_0x5e9b82,_0x3847ea){var _0x36f0fd={'raw':!![],'where':{'id':_0x5e9b82['params']['id']}},_0x493340={};_0x493340[_0xf17e('0x31')]=_[_0xf17e('0x33')](db[_0xf17e('0x2d')][_0xf17e('0x2e')]);_0x493340['query']=_[_0xf17e('0x33')](_0x5e9b82['query']);_0x493340['filters']=_[_0xf17e('0x35')](_0x493340[_0xf17e('0x31')],_0x493340[_0xf17e('0x32')]);_0x36f0fd[_0xf17e('0x36')]=_[_0xf17e('0x35')](_0x493340[_0xf17e('0x31')],qs[_0xf17e('0x37')](_0x5e9b82[_0xf17e('0x32')][_0xf17e('0x37')]));_0x36f0fd[_0xf17e('0x36')]=_0x36f0fd['attributes'][_0xf17e('0x38')]?_0x36f0fd[_0xf17e('0x36')]:_0x493340[_0xf17e('0x31')];if(_0x5e9b82['query'][_0xf17e('0x3f')]){_0x36f0fd[_0xf17e('0x42')]=[{'all':!![]}];}_0x36f0fd=_['merge']({},_0x36f0fd,_0x5e9b82[_0xf17e('0x43')]);return db[_0xf17e('0x2d')][_0xf17e('0x44')](_0x36f0fd)[_0xf17e('0x26')](handleEntityNotFound(_0x3847ea,null))['then'](respondWithResult(_0x3847ea,null))[_0xf17e('0x41')](handleError(_0x3847ea,null));};exports[_0xf17e('0x45')]=function(_0x3d0ac5,_0x1ef125){return db[_0xf17e('0x2d')][_0xf17e('0x45')](_0x3d0ac5['body'],{})[_0xf17e('0x26')](respondWithResult(_0x1ef125,0xc9))[_0xf17e('0x41')](handleError(_0x1ef125,null));};exports[_0xf17e('0x25')]=function(_0x149660,_0x191350){if(_0x149660[_0xf17e('0x46')]['id']){delete _0x149660[_0xf17e('0x46')]['id'];}return db['SquareReport'][_0xf17e('0x44')]({'where':{'id':_0x149660[_0xf17e('0x47')]['id']}})['then'](handleEntityNotFound(_0x191350,null))[_0xf17e('0x26')](saveUpdates(_0x149660[_0xf17e('0x46')],null))['then'](respondWithResult(_0x191350,null))[_0xf17e('0x41')](handleError(_0x191350,null));};exports['destroy']=function(_0x4ba332,_0x55c15b){return db[_0xf17e('0x2d')]['find']({'where':{'id':_0x4ba332[_0xf17e('0x47')]['id']}})[_0xf17e('0x26')](handleEntityNotFound(_0x55c15b,null))[_0xf17e('0x26')](removeEntity(_0x55c15b,null))[_0xf17e('0x41')](handleError(_0x55c15b,null));};exports[_0xf17e('0x48')]=function(_0x33cdd9,_0x4997c0){return db[_0xf17e('0x2d')][_0xf17e('0x48')]()[_0xf17e('0x26')](respondWithResult(_0x4997c0,null))[_0xf17e('0x41')](handleError(_0x4997c0,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 9b17423..13f71a3 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 _0x6bca=['../../config/logger','api','moment','bluebird','rimraf','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util'];(function(_0x1c5bdb,_0x44bf0e){var _0x4988a1=function(_0x1db1da){while(--_0x1db1da){_0x1c5bdb['push'](_0x1c5bdb['shift']());}};_0x4988a1(++_0x44bf0e);}(_0x6bca,0x1df));var _0xa6bc=function(_0x9f801d,_0x27a799){_0x9f801d=_0x9f801d-0x0;var _0x239986=_0x6bca[_0x9f801d];return _0x239986;};'use strict';var _=require(_0xa6bc('0x0'));var util=require(_0xa6bc('0x1'));var logger=require(_0xa6bc('0x2'))(_0xa6bc('0x3'));var moment=require(_0xa6bc('0x4'));var BPromise=require(_0xa6bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6bc('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module['exports']=function(_0x25653c,_0x20d81a){return _0x25653c[_0xa6bc('0x7')](_0xa6bc('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xa6bc('0x9'),'fields':[_0xa6bc('0xa'),_0xa6bc('0xb')]},{'name':_0xa6bc('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbc2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uniqueid','leaveAt','lodash','../../config/logger','api'];(function(_0xc911b0,_0x4b667a){var _0x8c0c77=function(_0x534140){while(--_0x534140){_0xc911b0['push'](_0xc911b0['shift']());}};_0x8c0c77(++_0x4b667a);}(_0xcbc2,0x1a1));var _0x2cbc=function(_0x30ed7d,_0x238acb){_0x30ed7d=_0x30ed7d-0x0;var _0x50e1fb=_0xcbc2[_0x30ed7d];return _0x50e1fb;};'use strict';var _=require(_0x2cbc('0x0'));var util=require('util');var logger=require(_0x2cbc('0x1'))(_0x2cbc('0x2'));var moment=require(_0x2cbc('0x3'));var BPromise=require(_0x2cbc('0x4'));var rp=require(_0x2cbc('0x5'));var fs=require('fs');var path=require(_0x2cbc('0x6'));var rimraf=require(_0x2cbc('0x7'));var config=require(_0x2cbc('0x8'));var attributes=require(_0x2cbc('0x9'));module['exports']=function(_0x3cd986,_0xa7e98e){return _0x3cd986[_0x2cbc('0xa')](_0x2cbc('0xb'),attributes,{'tableName':_0x2cbc('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x2cbc('0xd'),'project_name']},{'name':'leaveAt','fields':[_0x2cbc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 68f3e9b..3b6c79e 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 _0xd3ea=['update','attributes','limit','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','create','options','raw','then','UpdateSquareReport'];(function(_0x1090f8,_0xd83a11){var _0x180524=function(_0x109ab8){while(--_0x109ab8){_0x1090f8['push'](_0x1090f8['shift']());}};_0x180524(++_0xd83a11);}(_0xd3ea,0xb8));var _0xad3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd3ea[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xad3e('0x0'));var util=require(_0xad3e('0x1'));var moment=require(_0xad3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xad3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad3e('0x4'));var logger=require(_0xad3e('0x5'))(_0xad3e('0x6'));var config=require(_0xad3e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xad3e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x429b9e,_0xa12a0,_0x58d916){return new BPromise(function(_0x13ca9a,_0x210784){return client[_0xad3e('0x9')](_0x429b9e,_0x58d916)['then'](function(_0x35c42f){logger[_0xad3e('0xa')]('SquareReport,\x20%s,\x20%s',_0xa12a0,_0xad3e('0xb'));logger[_0xad3e('0xc')](_0xad3e('0xd'),_0xa12a0,_0xad3e('0xb'),JSON[_0xad3e('0xe')](_0x35c42f));if(_0x35c42f[_0xad3e('0xf')]){if(_0x35c42f[_0xad3e('0xf')][_0xad3e('0x10')]===0x1f4){logger[_0xad3e('0xf')](_0xad3e('0x11'),_0xa12a0,_0x35c42f['error']['message']);return _0x210784(_0x35c42f['error'][_0xad3e('0x12')]);}logger['error'](_0xad3e('0x11'),_0xa12a0,_0x35c42f['error'][_0xad3e('0x12')]);return _0x13ca9a(_0x35c42f[_0xad3e('0xf')][_0xad3e('0x12')]);}else{logger[_0xad3e('0xa')](_0xad3e('0x11'),_0xa12a0,_0xad3e('0xb'));_0x13ca9a(_0x35c42f[_0xad3e('0x13')][_0xad3e('0x12')]);}})['catch'](function(_0xbd9f1b){logger['error'](_0xad3e('0x11'),_0xa12a0,_0xbd9f1b);_0x210784(_0xbd9f1b);});});}exports[_0xad3e('0x14')]=function(_0x4e9262){var _0xfe7ab9=this;return new Promise(function(_0x966f68,_0xebf29d){return db['SquareReport'][_0xad3e('0x15')](_0x4e9262['body'],{'raw':_0x4e9262[_0xad3e('0x16')]?_0x4e9262[_0xad3e('0x16')][_0xad3e('0x17')]===undefined?!![]:![]:!![]})[_0xad3e('0x18')](function(_0x4ab9b5){logger[_0xad3e('0xa')](_0xad3e('0x14'),_0x4e9262);logger[_0xad3e('0xc')](_0xad3e('0x14'),_0x4e9262,JSON[_0xad3e('0xe')](_0x4ab9b5));_0x966f68(_0x4ab9b5);})['catch'](function(_0x36aac2){logger['error']('CreateSquareReport',_0x36aac2['message'],_0x4e9262);_0xebf29d(_0xfe7ab9[_0xad3e('0xf')](0x1f4,_0x36aac2['message']));});});};exports[_0xad3e('0x19')]=function(_0x453302){var _0x36c526=this;return new Promise(function(_0x14fc5c,_0x22662f){return db['SquareReport'][_0xad3e('0x1a')](_0x453302['body'],{'raw':_0x453302['options']?_0x453302[_0xad3e('0x16')][_0xad3e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453302[_0xad3e('0x16')]?_0x453302['options']['where']||null:null,'attributes':_0x453302['options']?_0x453302[_0xad3e('0x16')][_0xad3e('0x1b')]||null:null,'limit':_0x453302[_0xad3e('0x16')]?_0x453302['options'][_0xad3e('0x1c')]||null:null})[_0xad3e('0x18')](function(_0x114935){logger[_0xad3e('0xa')](_0xad3e('0x19'),_0x453302);logger[_0xad3e('0xc')]('UpdateSquareReport',_0x453302,JSON['stringify'](_0x114935));_0x14fc5c(_0x114935);})[_0xad3e('0x1d')](function(_0x52fbe0){logger['error'](_0xad3e('0x19'),_0x52fbe0[_0xad3e('0x12')],_0x453302);_0x22662f(_0x36c526['error'](0x1f4,_0x52fbe0['message']));});});}; \ No newline at end of file +var _0xce60=['request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','where','attributes','limit','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s'];(function(_0x2a52aa,_0x4e7afc){var _0xb18e58=function(_0x12c95e){while(--_0x12c95e){_0x2a52aa['push'](_0x2a52aa['shift']());}};_0xb18e58(++_0x4e7afc);}(_0xce60,0x171));var _0x0ce6=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0xce60[_0x35d3a8];return _0x182378;};'use strict';var _=require(_0x0ce6('0x0'));var util=require(_0x0ce6('0x1'));var moment=require(_0x0ce6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ce6('0x3'));var fs=require('fs');var Redis=require(_0x0ce6('0x4'));var db=require(_0x0ce6('0x5'))['db'];var utils=require(_0x0ce6('0x6'));var logger=require(_0x0ce6('0x7'))(_0x0ce6('0x8'));var config=require(_0x0ce6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0ce6('0xa')][_0x0ce6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc395c5,_0x49e692,_0x4cfc7d){return new BPromise(function(_0x590006,_0x9aa658){return client[_0x0ce6('0xc')](_0xc395c5,_0x4cfc7d)[_0x0ce6('0xd')](function(_0x327ab6){logger[_0x0ce6('0xe')](_0x0ce6('0xf'),_0x49e692,_0x0ce6('0x10'));logger[_0x0ce6('0x11')](_0x0ce6('0x12'),_0x49e692,'request\x20sent',JSON[_0x0ce6('0x13')](_0x327ab6));if(_0x327ab6[_0x0ce6('0x14')]){if(_0x327ab6['error'][_0x0ce6('0x15')]===0x1f4){logger[_0x0ce6('0x14')](_0x0ce6('0xf'),_0x49e692,_0x327ab6[_0x0ce6('0x14')][_0x0ce6('0x16')]);return _0x9aa658(_0x327ab6['error'][_0x0ce6('0x16')]);}logger[_0x0ce6('0x14')](_0x0ce6('0xf'),_0x49e692,_0x327ab6[_0x0ce6('0x14')]['message']);return _0x590006(_0x327ab6[_0x0ce6('0x14')][_0x0ce6('0x16')]);}else{logger[_0x0ce6('0xe')](_0x0ce6('0xf'),_0x49e692,'request\x20sent');_0x590006(_0x327ab6[_0x0ce6('0x17')][_0x0ce6('0x16')]);}})['catch'](function(_0x14fe21){logger[_0x0ce6('0x14')](_0x0ce6('0xf'),_0x49e692,_0x14fe21);_0x9aa658(_0x14fe21);});});}exports[_0x0ce6('0x18')]=function(_0x2cf8e6){var _0x2485a7=this;return new Promise(function(_0x1d69bd,_0xdc75af){return db[_0x0ce6('0x19')][_0x0ce6('0x1a')](_0x2cf8e6[_0x0ce6('0x1b')],{'raw':_0x2cf8e6[_0x0ce6('0x1c')]?_0x2cf8e6[_0x0ce6('0x1c')][_0x0ce6('0x1d')]===undefined?!![]:![]:!![]})[_0x0ce6('0xd')](function(_0x1c8ad3){logger[_0x0ce6('0xe')]('CreateSquareReport',_0x2cf8e6);logger['debug']('CreateSquareReport',_0x2cf8e6,JSON[_0x0ce6('0x13')](_0x1c8ad3));_0x1d69bd(_0x1c8ad3);})[_0x0ce6('0x1e')](function(_0x3a8fcc){logger['error'](_0x0ce6('0x18'),_0x3a8fcc[_0x0ce6('0x16')],_0x2cf8e6);_0xdc75af(_0x2485a7[_0x0ce6('0x14')](0x1f4,_0x3a8fcc[_0x0ce6('0x16')]));});});};exports['UpdateSquareReport']=function(_0x1e3f79){var _0x5d5b58=this;return new Promise(function(_0x3f86d8,_0x30e212){return db[_0x0ce6('0x19')]['update'](_0x1e3f79[_0x0ce6('0x1b')],{'raw':_0x1e3f79[_0x0ce6('0x1c')]?_0x1e3f79['options'][_0x0ce6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e3f79[_0x0ce6('0x1c')]?_0x1e3f79['options'][_0x0ce6('0x1f')]||null:null,'attributes':_0x1e3f79[_0x0ce6('0x1c')]?_0x1e3f79[_0x0ce6('0x1c')][_0x0ce6('0x20')]||null:null,'limit':_0x1e3f79[_0x0ce6('0x1c')]?_0x1e3f79['options'][_0x0ce6('0x21')]||null:null})[_0x0ce6('0xd')](function(_0x58c46a){logger[_0x0ce6('0xe')](_0x0ce6('0x22'),_0x1e3f79);logger[_0x0ce6('0x11')](_0x0ce6('0x22'),_0x1e3f79,JSON[_0x0ce6('0x13')](_0x58c46a));_0x3f86d8(_0x58c46a);})[_0x0ce6('0x1e')](function(_0x50df11){logger[_0x0ce6('0x14')](_0x0ce6('0x22'),_0x50df11['message'],_0x1e3f79);_0x30e212(_0x5d5b58[_0x0ce6('0x14')](0x1f4,_0x50df11[_0x0ce6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1ba5f7c..a27d77a 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x814b,0x1a2));var _0xb814=function(_0x4abc8f,_0xef597d){_0x4abc8f=_0x4abc8f-0x0;var _0x5d7939=_0x814b[_0x4abc8f];return _0x5d7939;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x814b,0x1a2));var _0xb814=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x814b[_0x8b0f43];return _0x3f4425;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4c660b1..0688a1c 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 _0xfdfb=['TEXT','sequelize','exports','STRING'];(function(_0x116ec2,_0x23b3d9){var _0x44c06e=function(_0x26dac3){while(--_0x26dac3){_0x116ec2['push'](_0x116ec2['shift']());}};_0x44c06e(++_0x23b3d9);}(_0xfdfb,0x8d));var _0xbfdf=function(_0x29835a,_0x3064fd){_0x29835a=_0x29835a-0x0;var _0x2a0c3f=_0xfdfb[_0x29835a];return _0x2a0c3f;};'use strict';var Sequelize=require(_0xbfdf('0x0'));module[_0xbfdf('0x1')]={'uniqueid':{'type':Sequelize[_0xbfdf('0x2')]},'node':{'type':Sequelize[_0xbfdf('0x2')]},'application':{'type':Sequelize[_0xbfdf('0x2')]},'data':{'type':Sequelize[_0xbfdf('0x3')]},'project_name':{'type':Sequelize[_0xbfdf('0x2')]},'callerid':{'type':Sequelize[_0xbfdf('0x2')]}}; \ No newline at end of file +var _0xcda3=['TEXT','sequelize','STRING'];(function(_0x1d1f1b,_0x439099){var _0x39b37b=function(_0x38613e){while(--_0x38613e){_0x1d1f1b['push'](_0x1d1f1b['shift']());}};_0x39b37b(++_0x439099);}(_0xcda3,0x70));var _0x3cda=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xcda3[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0x3cda('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x3cda('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x3cda('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 56e0860..422a90c 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 _0xd438=['destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','length','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd438,0x152));var _0x8d43=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xd438[_0x2df507];return _0x1f7167;};'use strict';var pdf=require(_0x8d43('0x0'));var emlformat=require(_0x8d43('0x1'));var rimraf=require(_0x8d43('0x2'));var zipdir=require(_0x8d43('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d43('0x4'));var moment=require(_0x8d43('0x5'));var BPromise=require(_0x8d43('0x6'));var Mustache=require(_0x8d43('0x7'));var util=require(_0x8d43('0x8'));var path=require(_0x8d43('0x9'));var sox=require(_0x8d43('0xa'));var csv=require('to-csv');var ejs=require(_0x8d43('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d43('0xc'));var crypto=require(_0x8d43('0xd'));var jsforce=require(_0x8d43('0xe'));var deskjs=require(_0x8d43('0xf'));var toCsv=require(_0x8d43('0x10'));var querystring=require(_0x8d43('0x11'));var Papa=require(_0x8d43('0x12'));var Redis=require(_0x8d43('0x13'));var authService=require(_0x8d43('0x14'));var qs=require(_0x8d43('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d43('0x16'))(_0x8d43('0x17'));var utils=require('../../config/utils');var config=require(_0x8d43('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ec4cd,_0x12f0cd){_0x12f0cd=_0x12f0cd||0xcc;return function(_0x1be9c9){if(_0x1be9c9){return _0x2ec4cd[_0x8d43('0x19')](_0x12f0cd);}return _0x2ec4cd[_0x8d43('0x1a')](_0x12f0cd)[_0x8d43('0x1b')]();};}function respondWithResult(_0x3d2297,_0x1ff4b6){_0x1ff4b6=_0x1ff4b6||0xc8;return function(_0x3fb67){if(_0x3fb67){return _0x3d2297[_0x8d43('0x1a')](_0x1ff4b6)['json'](_0x3fb67);}};}function respondWithFilteredResult(_0x1eb3e0,_0x189549){return function(_0x42851a){if(_0x42851a){var _0x3e7363=_0x42851a[_0x8d43('0x1c')],_0x579aa6=_0x189549[_0x8d43('0x1d')],_0x32d301=_0x189549['offset']+_0x189549[_0x8d43('0x1e')],_0x5bb81d;if(_0x32d301>=_0x3e7363){_0x32d301=_0x3e7363;_0x5bb81d=0xc8;}else{_0x5bb81d=0xce;}_0x1eb3e0[_0x8d43('0x1a')](_0x5bb81d);return _0x1eb3e0[_0x8d43('0x1f')](_0x8d43('0x20'),_0x579aa6+'-'+_0x32d301+'/'+_0x3e7363)['json'](_0x42851a);}return null;};}function patchUpdates(_0xf97c6f){return function(_0x1f4b52){try{jsonpatch[_0x8d43('0x21')](_0x1f4b52,_0xf97c6f,!![]);}catch(_0xa91161){return BPromise[_0x8d43('0x22')](_0xa91161);}return _0x1f4b52[_0x8d43('0x23')]();};}function saveUpdates(_0x431a3b,_0x4f6ace){return function(_0x3cb6ba){if(_0x3cb6ba){return _0x3cb6ba['update'](_0x431a3b)[_0x8d43('0x24')](function(_0x2d11d5){return _0x2d11d5;});}return null;};}function removeEntity(_0x4b03cf,_0xaaac99){return function(_0x146496){if(_0x146496){return _0x146496[_0x8d43('0x25')]()[_0x8d43('0x24')](function(){_0x4b03cf[_0x8d43('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29148d,_0x41e54a){return function(_0x53e55f){if(!_0x53e55f){_0x29148d['sendStatus'](0x194);}return _0x53e55f;};}function handleError(_0x3812e3,_0x28d4ae){_0x28d4ae=_0x28d4ae||0x1f4;return function(_0x3ddd8e){logger[_0x8d43('0x26')](_0x3ddd8e[_0x8d43('0x27')]);if(_0x3ddd8e[_0x8d43('0x28')]){delete _0x3ddd8e['name'];}_0x3812e3[_0x8d43('0x1a')](_0x28d4ae)[_0x8d43('0x29')](_0x3ddd8e);};}exports['index']=function(_0x513f24,_0x1de45d){var _0x2c44ef={},_0x1e0df3={},_0x5176af={'count':0x0,'rows':[]};var _0x4557a9=_[_0x8d43('0x2a')](db[_0x8d43('0x2b')][_0x8d43('0x2c')],function(_0x1c9832){return{'name':_0x1c9832[_0x8d43('0x2d')],'type':_0x1c9832[_0x8d43('0x2e')][_0x8d43('0x2f')]};});_0x1e0df3[_0x8d43('0x30')]=_[_0x8d43('0x2a')](_0x4557a9,_0x8d43('0x28'));_0x1e0df3[_0x8d43('0x31')]=_['keys'](_0x513f24[_0x8d43('0x31')]);_0x1e0df3['filters']=_[_0x8d43('0x32')](_0x1e0df3[_0x8d43('0x30')],_0x1e0df3['query']);_0x2c44ef[_0x8d43('0x33')]=_['intersection'](_0x1e0df3[_0x8d43('0x30')],qs[_0x8d43('0x34')](_0x513f24['query'][_0x8d43('0x34')]));_0x2c44ef[_0x8d43('0x33')]=_0x2c44ef[_0x8d43('0x33')]['length']?_0x2c44ef[_0x8d43('0x33')]:_0x1e0df3[_0x8d43('0x30')];if(!_0x513f24['query'][_0x8d43('0x35')](_0x8d43('0x36'))){_0x2c44ef[_0x8d43('0x1e')]=qs[_0x8d43('0x1e')](_0x513f24[_0x8d43('0x31')]['limit']);_0x2c44ef[_0x8d43('0x1d')]=qs[_0x8d43('0x1d')](_0x513f24[_0x8d43('0x31')][_0x8d43('0x1d')]);}_0x2c44ef['order']=qs[_0x8d43('0x37')](_0x513f24['query'][_0x8d43('0x37')]);_0x2c44ef[_0x8d43('0x38')]=qs[_0x8d43('0x39')](_[_0x8d43('0x3a')](_0x513f24[_0x8d43('0x31')],_0x1e0df3[_0x8d43('0x39')]),_0x4557a9);if(_0x513f24[_0x8d43('0x31')][_0x8d43('0x3b')]){_0x2c44ef[_0x8d43('0x38')]=_['merge'](_0x2c44ef[_0x8d43('0x38')],{'$or':_['map'](_0x4557a9,function(_0x2fe7f7){if(_0x2fe7f7[_0x8d43('0x2e')]!==_0x8d43('0x3c')){var _0x3ac0e0={};_0x3ac0e0[_0x2fe7f7[_0x8d43('0x28')]]={'$like':'%'+_0x513f24['query'][_0x8d43('0x3b')]+'%'};return _0x3ac0e0;}})});}_0x2c44ef=_[_0x8d43('0x3d')]({},_0x2c44ef,_0x513f24[_0x8d43('0x3e')]);var _0x5a3a0b={'where':_0x2c44ef[_0x8d43('0x38')]};return db[_0x8d43('0x2b')][_0x8d43('0x1c')](_0x5a3a0b)[_0x8d43('0x24')](function(_0xee4dbe){_0x5176af[_0x8d43('0x1c')]=_0xee4dbe;if(_0x513f24['query']['includeAll']){_0x2c44ef[_0x8d43('0x3f')]=[{'all':!![]}];}return db[_0x8d43('0x2b')][_0x8d43('0x40')](_0x2c44ef);})['then'](function(_0x2d4534){_0x5176af[_0x8d43('0x41')]=_0x2d4534;return _0x5176af;})[_0x8d43('0x24')](respondWithFilteredResult(_0x1de45d,_0x2c44ef))[_0x8d43('0x42')](handleError(_0x1de45d,null));};exports[_0x8d43('0x43')]=function(_0x3d1898,_0x28874f){var _0x4005e7={'raw':!![],'where':{'id':_0x3d1898[_0x8d43('0x44')]['id']}},_0x3d3c3b={};_0x3d3c3b['model']=_[_0x8d43('0x45')](db[_0x8d43('0x2b')]['rawAttributes']);_0x3d3c3b[_0x8d43('0x31')]=_[_0x8d43('0x45')](_0x3d1898[_0x8d43('0x31')]);_0x3d3c3b[_0x8d43('0x39')]=_[_0x8d43('0x32')](_0x3d3c3b[_0x8d43('0x30')],_0x3d3c3b[_0x8d43('0x31')]);_0x4005e7[_0x8d43('0x33')]=_[_0x8d43('0x32')](_0x3d3c3b[_0x8d43('0x30')],qs[_0x8d43('0x34')](_0x3d1898[_0x8d43('0x31')][_0x8d43('0x34')]));_0x4005e7[_0x8d43('0x33')]=_0x4005e7[_0x8d43('0x33')][_0x8d43('0x46')]?_0x4005e7[_0x8d43('0x33')]:_0x3d3c3b[_0x8d43('0x30')];if(_0x3d1898[_0x8d43('0x31')]['includeAll']){_0x4005e7[_0x8d43('0x3f')]=[{'all':!![]}];}_0x4005e7=_[_0x8d43('0x3d')]({},_0x4005e7,_0x3d1898[_0x8d43('0x3e')]);return db[_0x8d43('0x2b')][_0x8d43('0x47')](_0x4005e7)['then'](handleEntityNotFound(_0x28874f,null))[_0x8d43('0x24')](respondWithResult(_0x28874f,null))[_0x8d43('0x42')](handleError(_0x28874f,null));};exports[_0x8d43('0x48')]=function(_0x1729d1,_0x5f36c5){return db['SquareDetailsReport']['create'](_0x1729d1['body'],{})['then'](respondWithResult(_0x5f36c5,0xc9))[_0x8d43('0x42')](handleError(_0x5f36c5,null));};exports['update']=function(_0x4bb202,_0x8eda68){if(_0x4bb202[_0x8d43('0x49')]['id']){delete _0x4bb202[_0x8d43('0x49')]['id'];}return db[_0x8d43('0x2b')][_0x8d43('0x47')]({'where':{'id':_0x4bb202[_0x8d43('0x44')]['id']}})['then'](handleEntityNotFound(_0x8eda68,null))[_0x8d43('0x24')](saveUpdates(_0x4bb202[_0x8d43('0x49')],null))[_0x8d43('0x24')](respondWithResult(_0x8eda68,null))[_0x8d43('0x42')](handleError(_0x8eda68,null));};exports[_0x8d43('0x25')]=function(_0x25cb50,_0x3581cf){return db[_0x8d43('0x2b')][_0x8d43('0x47')]({'where':{'id':_0x25cb50[_0x8d43('0x44')]['id']}})[_0x8d43('0x24')](handleEntityNotFound(_0x3581cf,null))[_0x8d43('0x24')](removeEntity(_0x3581cf,null))[_0x8d43('0x42')](handleError(_0x3581cf,null));};exports[_0x8d43('0x4a')]=function(_0x333bd0,_0x408ff9){return db[_0x8d43('0x2b')][_0x8d43('0x4a')]()[_0x8d43('0x24')](respondWithResult(_0x408ff9,null))[_0x8d43('0x42')](handleError(_0x408ff9,null));}; \ No newline at end of file +var _0xeeab=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format'];(function(_0x21a7ed,_0x22e4be){var _0x1ce3c2=function(_0x3cccd5){while(--_0x3cccd5){_0x21a7ed['push'](_0x21a7ed['shift']());}};_0x1ce3c2(++_0x22e4be);}(_0xeeab,0x92));var _0xbeea=function(_0x594dc4,_0x407740){_0x594dc4=_0x594dc4-0x0;var _0x2a9880=_0xeeab[_0x594dc4];return _0x2a9880;};'use strict';var pdf=require(_0xbeea('0x0'));var emlformat=require(_0xbeea('0x1'));var rimraf=require(_0xbeea('0x2'));var zipdir=require(_0xbeea('0x3'));var jsonpatch=require(_0xbeea('0x4'));var rp=require(_0xbeea('0x5'));var moment=require('moment');var BPromise=require(_0xbeea('0x6'));var Mustache=require(_0xbeea('0x7'));var util=require(_0xbeea('0x8'));var path=require('path');var sox=require(_0xbeea('0x9'));var csv=require(_0xbeea('0xa'));var ejs=require(_0xbeea('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbeea('0xc'));var crypto=require(_0xbeea('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbeea('0xe'));var toCsv=require(_0xbeea('0xa'));var querystring=require('querystring');var Papa=require(_0xbeea('0xf'));var Redis=require(_0xbeea('0x10'));var authService=require(_0xbeea('0x11'));var qs=require(_0xbeea('0x12'));var as=require(_0xbeea('0x13'));var hardwareService=require(_0xbeea('0x14'));var logger=require(_0xbeea('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xbeea('0x16'))['db'];function respondWithStatusCode(_0x222080,_0x29f53f){_0x29f53f=_0x29f53f||0xcc;return function(_0x11288c){if(_0x11288c){return _0x222080[_0xbeea('0x17')](_0x29f53f);}return _0x222080[_0xbeea('0x18')](_0x29f53f)[_0xbeea('0x19')]();};}function respondWithResult(_0x2df8b8,_0x1b1889){_0x1b1889=_0x1b1889||0xc8;return function(_0x5acec5){if(_0x5acec5){return _0x2df8b8[_0xbeea('0x18')](_0x1b1889)[_0xbeea('0x1a')](_0x5acec5);}};}function respondWithFilteredResult(_0x3393df,_0x4bba61){return function(_0x3c2a7d){if(_0x3c2a7d){var _0x50901b=_0x3c2a7d[_0xbeea('0x1b')],_0x37865a=_0x4bba61[_0xbeea('0x1c')],_0x360a6e=_0x4bba61[_0xbeea('0x1c')]+_0x4bba61[_0xbeea('0x1d')],_0x1d269c;if(_0x360a6e>=_0x50901b){_0x360a6e=_0x50901b;_0x1d269c=0xc8;}else{_0x1d269c=0xce;}_0x3393df[_0xbeea('0x18')](_0x1d269c);return _0x3393df['set'](_0xbeea('0x1e'),_0x37865a+'-'+_0x360a6e+'/'+_0x50901b)[_0xbeea('0x1a')](_0x3c2a7d);}return null;};}function patchUpdates(_0x31dc39){return function(_0x55613a){try{jsonpatch[_0xbeea('0x1f')](_0x55613a,_0x31dc39,!![]);}catch(_0x12366e){return BPromise[_0xbeea('0x20')](_0x12366e);}return _0x55613a[_0xbeea('0x21')]();};}function saveUpdates(_0x559650,_0x46095a){return function(_0x2db3ef){if(_0x2db3ef){return _0x2db3ef[_0xbeea('0x22')](_0x559650)[_0xbeea('0x23')](function(_0x586b48){return _0x586b48;});}return null;};}function removeEntity(_0x36eabf,_0x3a5661){return function(_0x4d02f6){if(_0x4d02f6){return _0x4d02f6[_0xbeea('0x24')]()[_0xbeea('0x23')](function(){_0x36eabf['status'](0xcc)[_0xbeea('0x19')]();});}};}function handleEntityNotFound(_0x1f3efe,_0x823015){return function(_0x1087c4){if(!_0x1087c4){_0x1f3efe['sendStatus'](0x194);}return _0x1087c4;};}function handleError(_0xb4f591,_0x3d5fc8){_0x3d5fc8=_0x3d5fc8||0x1f4;return function(_0x13b68d){logger[_0xbeea('0x25')](_0x13b68d[_0xbeea('0x26')]);if(_0x13b68d['name']){delete _0x13b68d[_0xbeea('0x27')];}_0xb4f591[_0xbeea('0x18')](_0x3d5fc8)[_0xbeea('0x28')](_0x13b68d);};}exports[_0xbeea('0x29')]=function(_0x20c789,_0x21aa9f){var _0x12aa24={},_0x586e42={},_0x4fb224={'count':0x0,'rows':[]};var _0xea9fc8=_[_0xbeea('0x2a')](db[_0xbeea('0x2b')][_0xbeea('0x2c')],function(_0x207728){return{'name':_0x207728[_0xbeea('0x2d')],'type':_0x207728['type'][_0xbeea('0x2e')]};});_0x586e42[_0xbeea('0x2f')]=_['map'](_0xea9fc8,'name');_0x586e42[_0xbeea('0x30')]=_[_0xbeea('0x31')](_0x20c789[_0xbeea('0x30')]);_0x586e42[_0xbeea('0x32')]=_[_0xbeea('0x33')](_0x586e42[_0xbeea('0x2f')],_0x586e42[_0xbeea('0x30')]);_0x12aa24[_0xbeea('0x34')]=_['intersection'](_0x586e42[_0xbeea('0x2f')],qs[_0xbeea('0x35')](_0x20c789[_0xbeea('0x30')][_0xbeea('0x35')]));_0x12aa24[_0xbeea('0x34')]=_0x12aa24[_0xbeea('0x34')][_0xbeea('0x36')]?_0x12aa24[_0xbeea('0x34')]:_0x586e42[_0xbeea('0x2f')];if(!_0x20c789[_0xbeea('0x30')]['hasOwnProperty'](_0xbeea('0x37'))){_0x12aa24[_0xbeea('0x1d')]=qs[_0xbeea('0x1d')](_0x20c789['query']['limit']);_0x12aa24['offset']=qs[_0xbeea('0x1c')](_0x20c789['query'][_0xbeea('0x1c')]);}_0x12aa24[_0xbeea('0x38')]=qs[_0xbeea('0x39')](_0x20c789[_0xbeea('0x30')]['sort']);_0x12aa24[_0xbeea('0x3a')]=qs['filters'](_[_0xbeea('0x3b')](_0x20c789[_0xbeea('0x30')],_0x586e42['filters']),_0xea9fc8);if(_0x20c789['query'][_0xbeea('0x3c')]){_0x12aa24[_0xbeea('0x3a')]=_[_0xbeea('0x3d')](_0x12aa24[_0xbeea('0x3a')],{'$or':_[_0xbeea('0x2a')](_0xea9fc8,function(_0x367659){if(_0x367659['type']!=='VIRTUAL'){var _0x15ca57={};_0x15ca57[_0x367659['name']]={'$like':'%'+_0x20c789[_0xbeea('0x30')]['filter']+'%'};return _0x15ca57;}})});}_0x12aa24=_['merge']({},_0x12aa24,_0x20c789[_0xbeea('0x3e')]);var _0x421c7c={'where':_0x12aa24['where']};return db[_0xbeea('0x2b')][_0xbeea('0x1b')](_0x421c7c)['then'](function(_0x3abff6){_0x4fb224['count']=_0x3abff6;if(_0x20c789['query'][_0xbeea('0x3f')]){_0x12aa24[_0xbeea('0x40')]=[{'all':!![]}];}return db[_0xbeea('0x2b')][_0xbeea('0x41')](_0x12aa24);})['then'](function(_0x228f78){_0x4fb224[_0xbeea('0x42')]=_0x228f78;return _0x4fb224;})[_0xbeea('0x23')](respondWithFilteredResult(_0x21aa9f,_0x12aa24))[_0xbeea('0x43')](handleError(_0x21aa9f,null));};exports[_0xbeea('0x44')]=function(_0x162591,_0x17140c){var _0x4ee33c={'raw':!![],'where':{'id':_0x162591[_0xbeea('0x45')]['id']}},_0x130fc7={};_0x130fc7['model']=_[_0xbeea('0x31')](db['SquareDetailsReport']['rawAttributes']);_0x130fc7[_0xbeea('0x30')]=_[_0xbeea('0x31')](_0x162591[_0xbeea('0x30')]);_0x130fc7['filters']=_[_0xbeea('0x33')](_0x130fc7['model'],_0x130fc7['query']);_0x4ee33c[_0xbeea('0x34')]=_['intersection'](_0x130fc7[_0xbeea('0x2f')],qs[_0xbeea('0x35')](_0x162591[_0xbeea('0x30')]['fields']));_0x4ee33c[_0xbeea('0x34')]=_0x4ee33c[_0xbeea('0x34')]['length']?_0x4ee33c[_0xbeea('0x34')]:_0x130fc7[_0xbeea('0x2f')];if(_0x162591[_0xbeea('0x30')]['includeAll']){_0x4ee33c[_0xbeea('0x40')]=[{'all':!![]}];}_0x4ee33c=_[_0xbeea('0x3d')]({},_0x4ee33c,_0x162591[_0xbeea('0x3e')]);return db[_0xbeea('0x2b')]['find'](_0x4ee33c)[_0xbeea('0x23')](handleEntityNotFound(_0x17140c,null))['then'](respondWithResult(_0x17140c,null))[_0xbeea('0x43')](handleError(_0x17140c,null));};exports[_0xbeea('0x46')]=function(_0x16e556,_0x500373){return db[_0xbeea('0x2b')][_0xbeea('0x46')](_0x16e556[_0xbeea('0x47')],{})[_0xbeea('0x23')](respondWithResult(_0x500373,0xc9))[_0xbeea('0x43')](handleError(_0x500373,null));};exports[_0xbeea('0x22')]=function(_0x282923,_0x266856){if(_0x282923[_0xbeea('0x47')]['id']){delete _0x282923[_0xbeea('0x47')]['id'];}return db['SquareDetailsReport'][_0xbeea('0x48')]({'where':{'id':_0x282923[_0xbeea('0x45')]['id']}})['then'](handleEntityNotFound(_0x266856,null))[_0xbeea('0x23')](saveUpdates(_0x282923[_0xbeea('0x47')],null))[_0xbeea('0x23')](respondWithResult(_0x266856,null))[_0xbeea('0x43')](handleError(_0x266856,null));};exports[_0xbeea('0x24')]=function(_0x31642d,_0x16c680){return db[_0xbeea('0x2b')][_0xbeea('0x48')]({'where':{'id':_0x31642d['params']['id']}})[_0xbeea('0x23')](handleEntityNotFound(_0x16c680,null))[_0xbeea('0x23')](removeEntity(_0x16c680,null))[_0xbeea('0x43')](handleError(_0x16c680,null));};exports[_0xbeea('0x49')]=function(_0x40fe7a,_0x39c86d){return db['SquareDetailsReport'][_0xbeea('0x49')]()['then'](respondWithResult(_0x39c86d,null))[_0xbeea('0x43')](handleError(_0x39c86d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 898aa0f..c201fbd 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 _0xe73d=['moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger','api'];(function(_0x5332d9,_0x3e16df){var _0x2f247a=function(_0x4c3e1a){while(--_0x4c3e1a){_0x5332d9['push'](_0x5332d9['shift']());}};_0x2f247a(++_0x3e16df);}(_0xe73d,0x1de));var _0xde73=function(_0x41341e,_0x409888){_0x41341e=_0x41341e-0x0;var _0x72e776=_0xe73d[_0x41341e];return _0x72e776;};'use strict';var _=require('lodash');var util=require(_0xde73('0x0'));var logger=require(_0xde73('0x1'))(_0xde73('0x2'));var moment=require(_0xde73('0x3'));var BPromise=require('bluebird');var rp=require(_0xde73('0x4'));var fs=require('fs');var path=require(_0xde73('0x5'));var rimraf=require(_0xde73('0x6'));var config=require(_0xde73('0x7'));var attributes=require(_0xde73('0x8'));module[_0xde73('0x9')]=function(_0x1ae20e,_0x184676){return _0x1ae20e[_0xde73('0xa')](_0xde73('0xb'),attributes,{'tableName':_0xde73('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb05f=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash'];(function(_0x2a08b8,_0xba6d80){var _0x2c3628=function(_0x227942){while(--_0x227942){_0x2a08b8['push'](_0x2a08b8['shift']());}};_0x2c3628(++_0xba6d80);}(_0xb05f,0x185));var _0xfb05=function(_0x473908,_0x3cb043){_0x473908=_0x473908-0x0;var _0x5c1d9f=_0xb05f[_0x473908];return _0x5c1d9f;};'use strict';var _=require(_0xfb05('0x0'));var util=require(_0xfb05('0x1'));var logger=require(_0xfb05('0x2'))('api');var moment=require(_0xfb05('0x3'));var BPromise=require(_0xfb05('0x4'));var rp=require(_0xfb05('0x5'));var fs=require('fs');var path=require(_0xfb05('0x6'));var rimraf=require(_0xfb05('0x7'));var config=require(_0xfb05('0x8'));var attributes=require(_0xfb05('0x9'));module['exports']=function(_0x3d75b6,_0x17c334){return _0x3d75b6[_0xfb05('0xa')](_0xfb05('0xb'),attributes,{'tableName':_0xfb05('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 85b3f88..230be12 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 _0x7757=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareDetailsReport','create','options','raw','CreateSquareDetailsReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info'];(function(_0x1d54cf,_0xffd421){var _0x14710a=function(_0x3fff3d){while(--_0x3fff3d){_0x1d54cf['push'](_0x1d54cf['shift']());}};_0x14710a(++_0xffd421);}(_0x7757,0xe7));var _0x7775=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7757[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7775('0x0'));var BPromise=require(_0x7775('0x1'));var rs=require(_0x7775('0x2'));var fs=require('fs');var Redis=require(_0x7775('0x3'));var db=require(_0x7775('0x4'))['db'];var utils=require(_0x7775('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7775('0x6'));var client=jayson[_0x7775('0x7')][_0x7775('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bda7,_0x15aef1,_0x20b0dd){return new BPromise(function(_0xa96fc8,_0x294664){return client[_0x7775('0x9')](_0x12bda7,_0x20b0dd)[_0x7775('0xa')](function(_0x213d9e){logger[_0x7775('0xb')](_0x7775('0xc'),_0x15aef1,_0x7775('0xd'));logger[_0x7775('0xe')](_0x7775('0xf'),_0x15aef1,'request\x20sent',JSON[_0x7775('0x10')](_0x213d9e));if(_0x213d9e['error']){if(_0x213d9e[_0x7775('0x11')][_0x7775('0x12')]===0x1f4){logger[_0x7775('0x11')](_0x7775('0xc'),_0x15aef1,_0x213d9e[_0x7775('0x11')]['message']);return _0x294664(_0x213d9e['error'][_0x7775('0x13')]);}logger['error'](_0x7775('0xc'),_0x15aef1,_0x213d9e['error'][_0x7775('0x13')]);return _0xa96fc8(_0x213d9e['error'][_0x7775('0x13')]);}else{logger['info'](_0x7775('0xc'),_0x15aef1,_0x7775('0xd'));_0xa96fc8(_0x213d9e[_0x7775('0x14')][_0x7775('0x13')]);}})[_0x7775('0x15')](function(_0x46df9f){logger[_0x7775('0x11')](_0x7775('0xc'),_0x15aef1,_0x46df9f);_0x294664(_0x46df9f);});});}exports['CreateSquareDetailsReport']=function(_0x2a4d3b){var _0x211a3d=this;return new Promise(function(_0x51c1fb,_0x35cbd1){return db[_0x7775('0x16')][_0x7775('0x17')](_0x2a4d3b['body'],{'raw':_0x2a4d3b[_0x7775('0x18')]?_0x2a4d3b['options'][_0x7775('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x170a98){logger[_0x7775('0xb')](_0x7775('0x1a'),_0x2a4d3b);logger['debug'](_0x7775('0x1a'),_0x2a4d3b,JSON['stringify'](_0x170a98));_0x51c1fb(_0x170a98);})[_0x7775('0x15')](function(_0x7e55db){logger[_0x7775('0x11')](_0x7775('0x1a'),_0x7e55db['message'],_0x2a4d3b);_0x35cbd1(_0x211a3d['error'](0x1f4,_0x7e55db[_0x7775('0x13')]));});});}; \ No newline at end of file +var _0xb5da=['../../config/environment','jayson/promise','client','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x88a93,_0x30b485){var _0x1b2497=function(_0x200478){while(--_0x200478){_0x88a93['push'](_0x88a93['shift']());}};_0x1b2497(++_0x30b485);}(_0xb5da,0xae));var _0xab5d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb5da[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xab5d('0x0'));var moment=require(_0xab5d('0x1'));var BPromise=require(_0xab5d('0x2'));var rs=require(_0xab5d('0x3'));var fs=require('fs');var Redis=require(_0xab5d('0x4'));var db=require(_0xab5d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab5d('0x6'))(_0xab5d('0x7'));var config=require(_0xab5d('0x8'));var jayson=require(_0xab5d('0x9'));var client=jayson[_0xab5d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf5a8a6,_0x405925,_0x281ede){return new BPromise(function(_0x4d9862,_0x457db8){return client['request'](_0xf5a8a6,_0x281ede)[_0xab5d('0xb')](function(_0x2f2fb4){logger['info'](_0xab5d('0xc'),_0x405925,_0xab5d('0xd'));logger[_0xab5d('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x405925,_0xab5d('0xd'),JSON[_0xab5d('0xf')](_0x2f2fb4));if(_0x2f2fb4['error']){if(_0x2f2fb4[_0xab5d('0x10')]['code']===0x1f4){logger[_0xab5d('0x10')](_0xab5d('0xc'),_0x405925,_0x2f2fb4[_0xab5d('0x10')][_0xab5d('0x11')]);return _0x457db8(_0x2f2fb4['error'][_0xab5d('0x11')]);}logger[_0xab5d('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x405925,_0x2f2fb4[_0xab5d('0x10')][_0xab5d('0x11')]);return _0x4d9862(_0x2f2fb4[_0xab5d('0x10')][_0xab5d('0x11')]);}else{logger[_0xab5d('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x405925,_0xab5d('0xd'));_0x4d9862(_0x2f2fb4[_0xab5d('0x13')][_0xab5d('0x11')]);}})[_0xab5d('0x14')](function(_0x27ec2f){logger[_0xab5d('0x10')](_0xab5d('0xc'),_0x405925,_0x27ec2f);_0x457db8(_0x27ec2f);});});}exports[_0xab5d('0x15')]=function(_0x1a331e){var _0x334b93=this;return new Promise(function(_0xf0ee02,_0x2f925f){return db[_0xab5d('0x16')][_0xab5d('0x17')](_0x1a331e['body'],{'raw':_0x1a331e[_0xab5d('0x18')]?_0x1a331e[_0xab5d('0x18')][_0xab5d('0x19')]===undefined?!![]:![]:!![]})[_0xab5d('0xb')](function(_0x5c4f39){logger[_0xab5d('0x12')](_0xab5d('0x15'),_0x1a331e);logger[_0xab5d('0xe')](_0xab5d('0x15'),_0x1a331e,JSON[_0xab5d('0xf')](_0x5c4f39));_0xf0ee02(_0x5c4f39);})['catch'](function(_0x24d3cc){logger[_0xab5d('0x10')](_0xab5d('0x15'),_0x24d3cc[_0xab5d('0x11')],_0x1a331e);_0x2f925f(_0x334b93['error'](0x1f4,_0x24d3cc[_0xab5d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 8537761..348e5c5 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 _0x27d6=['get','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','isAuthenticated','index'];(function(_0x3686c8,_0x59c765){var _0xeb6ac1=function(_0x13b243){while(--_0x13b243){_0x3686c8['push'](_0x3686c8['shift']());}};_0xeb6ac1(++_0x59c765);}(_0x27d6,0x11b));var _0x627d=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x27d6[_0x24061a];return _0x82054e;};'use strict';var express=require(_0x627d('0x0'));var router=express[_0x627d('0x1')]();var auth=require(_0x627d('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0x627d('0x3')](),controller[_0x627d('0x4')]);router[_0x627d('0x5')](_0x627d('0x6'),auth[_0x627d('0x3')](),controller[_0x627d('0x7')]);module[_0x627d('0x8')]=router; \ No newline at end of file +var _0x6043=['./system.controller','isAuthenticated','index','killProcess','exports','Router'];(function(_0x5534fe,_0x43c22e){var _0x3d1dc2=function(_0x9df12){while(--_0x9df12){_0x5534fe['push'](_0x5534fe['shift']());}};_0x3d1dc2(++_0x43c22e);}(_0x6043,0x185));var _0x3604=function(_0x4a60b0,_0x432b5c){_0x4a60b0=_0x4a60b0-0x0;var _0x3d2e72=_0x6043[_0x4a60b0];return _0x3d2e72;};'use strict';var express=require('express');var router=express[_0x3604('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x3604('0x1'));router['get']('/',auth[_0x3604('0x2')](),controller[_0x3604('0x3')]);router['get']('/process/:pid/kill',auth[_0x3604('0x2')](),controller[_0x3604('0x4')]);module[_0x3604('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index f91a17a..46e02ef 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 _0x4cdc=['json','catch','killProcess','components/import/cm','format','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4cdc,0x1eb));var _0xc4cd=function(_0x5e7dea,_0x46c88a){_0x5e7dea=_0x5e7dea-0x0;var _0x5c719f=_0x4cdc[_0x5e7dea];return _0x5c719f;};'use strict';var info=require(_0xc4cd('0x0'));var exec=require(_0xc4cd('0x1'))[_0xc4cd('0x2')];var logger=require(_0xc4cd('0x3'))(_0xc4cd('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x5ed4a2,_0xe713eb,_0x578007){_0xe713eb=_0xe713eb||0x1f4;return function(_0x309dba){logger[_0xc4cd('0x5')](_0xc4cd('0x6'),_0x578007,_0xe713eb,util[_0xc4cd('0x7')](_0x309dba,{'showHidden':![],'depth':null}));delete _0x309dba['name'];_0x5ed4a2[_0xc4cd('0x8')](_0xe713eb)[_0xc4cd('0x9')](_0x309dba);};}exports[_0xc4cd('0xa')]=function(_0x55ef5a,_0x531d95){return info[_0xc4cd('0xb')]()[_0xc4cd('0xc')](function(_0x1498e1){return _0x531d95['status'](0xc8)[_0xc4cd('0xd')](_0x1498e1);})[_0xc4cd('0xe')](function(_0x2f9ca1){return _0x531d95[_0xc4cd('0x8')](0x1f4)[_0xc4cd('0xd')](_0x2f9ca1);});};exports[_0xc4cd('0xf')]=function(_0x41bc7c,_0x31ccd2){var _0x5c98b3=[_0xc4cd('0x10')];return new BPromise(function(_0x5c51cd,_0x415a61){return exec(util[_0xc4cd('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x41bc7c[_0xc4cd('0x12')][_0xc4cd('0x13')]),function(_0x249ee5,_0xb11914,_0x4e06c2){if(_0x249ee5){return _0x415a61(_0x249ee5);}return _0x5c51cd(_0xb11914);});})['then'](function(_0x293f70){var _0x3c878f=![];var _0x1b8af4=_0x293f70['split'](/\n/);for(var _0x4dd9d2=0x0,_0x4f1dbc=_0x5c98b3[_0xc4cd('0x14')];_0x4dd9d2<_0x4f1dbc,_0x3c878f===![];_0x4dd9d2+=0x1){if(_0x293f70[_0xc4cd('0x15')](_0x5c98b3[_0x4dd9d2])>=0x0){_0x3c878f=!![];}}if(!_0x3c878f){throw new Error(util[_0xc4cd('0x11')](_0xc4cd('0x16'),_0x41bc7c[_0xc4cd('0x12')][_0xc4cd('0x13')]));}process['kill'](_0x41bc7c['params']['pid'],'SIGINT');return _0x31ccd2[_0xc4cd('0x8')](0xc8)[_0xc4cd('0xd')]({'message':util[_0xc4cd('0x11')](_0xc4cd('0x17'),_0x41bc7c[_0xc4cd('0x12')][_0xc4cd('0x13')])});})[_0xc4cd('0xe')](handleError(_0x31ccd2,null,_0xc4cd('0xf')));}; \ No newline at end of file +var _0xe561=['systeminformation','exec','api','bluebird','error','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess'];(function(_0x200b82,_0x415d58){var _0x232525=function(_0x5bf6f2){while(--_0x5bf6f2){_0x200b82['push'](_0x200b82['shift']());}};_0x232525(++_0x415d58);}(_0xe561,0x104));var _0x1e56=function(_0xb91507,_0x1a4296){_0xb91507=_0xb91507-0x0;var _0x1f1136=_0xe561[_0xb91507];return _0x1f1136;};'use strict';var info=require(_0x1e56('0x0'));var exec=require('child_process')[_0x1e56('0x1')];var logger=require('../../config/logger')(_0x1e56('0x2'));var util=require('util');var BPromise=require(_0x1e56('0x3'));var _=require('lodash');function handleError(_0x7c0f21,_0x3bc0ad,_0x42eb42){_0x3bc0ad=_0x3bc0ad||0x1f4;return function(_0xdb2481){logger[_0x1e56('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x42eb42,_0x3bc0ad,util[_0x1e56('0x5')](_0xdb2481,{'showHidden':![],'depth':null}));delete _0xdb2481[_0x1e56('0x6')];_0x7c0f21[_0x1e56('0x7')](_0x3bc0ad)[_0x1e56('0x8')](_0xdb2481);};}exports[_0x1e56('0x9')]=function(_0x3862b9,_0x4e0803){return info[_0x1e56('0xa')]()[_0x1e56('0xb')](function(_0x478a6d){return _0x4e0803[_0x1e56('0x7')](0xc8)[_0x1e56('0xc')](_0x478a6d);})[_0x1e56('0xd')](function(_0x223931){return _0x4e0803[_0x1e56('0x7')](0x1f4)[_0x1e56('0xc')](_0x223931);});};exports['killProcess']=function(_0x2e0f49,_0x27e312){var _0x291007=[_0x1e56('0xe')];return new BPromise(function(_0x2ec813,_0x1d508a){return exec(util[_0x1e56('0xf')](_0x1e56('0x10'),_0x2e0f49[_0x1e56('0x11')][_0x1e56('0x12')]),function(_0x57c351,_0x325f3a,_0x395314){if(_0x57c351){return _0x1d508a(_0x57c351);}return _0x2ec813(_0x325f3a);});})[_0x1e56('0xb')](function(_0x27d6c7){var _0x4d7bf5=![];var _0x3445be=_0x27d6c7['split'](/\n/);for(var _0x6c7c1e=0x0,_0x46c604=_0x291007[_0x1e56('0x13')];_0x6c7c1e<_0x46c604,_0x4d7bf5===![];_0x6c7c1e+=0x1){if(_0x27d6c7[_0x1e56('0x14')](_0x291007[_0x6c7c1e])>=0x0){_0x4d7bf5=!![];}}if(!_0x4d7bf5){throw new Error(util[_0x1e56('0xf')](_0x1e56('0x15'),_0x2e0f49[_0x1e56('0x11')][_0x1e56('0x12')]));}process[_0x1e56('0x16')](_0x2e0f49[_0x1e56('0x11')][_0x1e56('0x12')],_0x1e56('0x17'));return _0x27e312[_0x1e56('0x7')](0xc8)['json']({'message':util[_0x1e56('0xf')](_0x1e56('0x18'),_0x2e0f49[_0x1e56('0x11')]['pid'])});})[_0x1e56('0xd')](handleError(_0x27e312,null,_0x1e56('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 21873f0..db4fd1e 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 _0x5c12=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x339504,_0x5cf8f5){var _0x3d9711=function(_0x103e50){while(--_0x103e50){_0x339504['push'](_0x339504['shift']());}};_0x3d9711(++_0x5cf8f5);}(_0x5c12,0x188));var _0x25c1=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x5c12[_0x7ad123];return _0x37d073;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var auth=require(_0x25c1('0x4'));var interaction=require(_0x25c1('0x5'));var config=require(_0x25c1('0x6'));var controller=require(_0x25c1('0x7'));router[_0x25c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x25c1('0x9')]);router[_0x25c1('0x8')](_0x25c1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x25c1('0xb')]('/',auth[_0x25c1('0xc')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xe')](_0x25c1('0xa'),auth['isAuthenticated'](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xa'),auth[_0x25c1('0xc')](),controller[_0x25c1('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf4eb=['../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','Router'];(function(_0x2486f7,_0x2469e9){var _0xad4caa=function(_0x272025){while(--_0x272025){_0x2486f7['push'](_0x2486f7['shift']());}};_0xad4caa(++_0x2469e9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x232df3,_0x37abcb){_0x232df3=_0x232df3-0x0;var _0x26ff90=_0xf4eb[_0x232df3];return _0x26ff90;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf4e('0x2'));var controller=require(_0xbf4e('0x3'));router[_0xbf4e('0x4')]('/',auth[_0xbf4e('0x5')](),controller[_0xbf4e('0x6')]);router[_0xbf4e('0x4')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller[_0xbf4e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')](_0xbf4e('0x7'),auth[_0xbf4e('0x5')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf4e('0xd')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9173bff..1a08e98 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 _0x8603=['name','exports','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8603,0x190));var _0x3860=function(_0x3f5d48,_0x1f64bd){_0x3f5d48=_0x3f5d48-0x0;var _0x4576e8=_0x8603[_0x3f5d48];return _0x4576e8;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x3860('0x1')]}}; \ No newline at end of file +var _0x087b=['sequelize','exports','STRING'];(function(_0x21ccd5,_0x54013c){var _0x3f394e=function(_0x3a4ec0){while(--_0x3a4ec0){_0x21ccd5['push'](_0x21ccd5['shift']());}};_0x3f394e(++_0x54013c);}(_0x087b,0x11a));var _0xb087=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x087b[_0x25e7cb];return _0x375d92;};'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 1fc28b1..8373437 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 _0x4667=['params','keys','includeAll','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','update','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','Tags','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','Tag','count','include','findAll','catch','show'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x4667,0x1f3));var _0x7466=function(_0x131679,_0x298f2b){_0x131679=_0x131679-0x0;var _0x3c8158=_0x4667[_0x131679];return _0x3c8158;};'use strict';var pdf=require(_0x7466('0x0'));var emlformat=require(_0x7466('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7466('0x2'));var rp=require(_0x7466('0x3'));var moment=require(_0x7466('0x4'));var BPromise=require(_0x7466('0x5'));var Mustache=require(_0x7466('0x6'));var util=require('util');var path=require(_0x7466('0x7'));var sox=require(_0x7466('0x8'));var csv=require(_0x7466('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7466('0xa'));var crypto=require(_0x7466('0xb'));var jsforce=require(_0x7466('0xc'));var deskjs=require(_0x7466('0xd'));var toCsv=require(_0x7466('0x9'));var querystring=require('querystring');var Papa=require(_0x7466('0xe'));var Redis=require(_0x7466('0xf'));var authService=require(_0x7466('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7466('0x11'));var hardwareService=require(_0x7466('0x12'));var logger=require(_0x7466('0x13'))(_0x7466('0x14'));var utils=require('../../config/utils');var config=require(_0x7466('0x15'));var db=require(_0x7466('0x16'))['db'];function respondWithStatusCode(_0x5448a7,_0x3a66e8){_0x3a66e8=_0x3a66e8||0xcc;return function(_0x2714f7){if(_0x2714f7){return _0x5448a7[_0x7466('0x17')](_0x3a66e8);}return _0x5448a7[_0x7466('0x18')](_0x3a66e8)[_0x7466('0x19')]();};}function respondWithResult(_0x11a1f4,_0x239378){_0x239378=_0x239378||0xc8;return function(_0x6dda33){if(_0x6dda33){return _0x11a1f4[_0x7466('0x18')](_0x239378)[_0x7466('0x1a')](_0x6dda33);}};}function respondWithFilteredResult(_0x9d00b0,_0x559e2f){return function(_0x1f08be){if(_0x1f08be){var _0x12e2b8=_0x1f08be['count'],_0x1a2713=_0x559e2f[_0x7466('0x1b')],_0x4dd605=_0x559e2f[_0x7466('0x1b')]+_0x559e2f[_0x7466('0x1c')],_0x45fed8;if(_0x4dd605>=_0x12e2b8){_0x4dd605=_0x12e2b8;_0x45fed8=0xc8;}else{_0x45fed8=0xce;}_0x9d00b0['status'](_0x45fed8);return _0x9d00b0[_0x7466('0x1d')](_0x7466('0x1e'),_0x1a2713+'-'+_0x4dd605+'/'+_0x12e2b8)[_0x7466('0x1a')](_0x1f08be);}return null;};}function patchUpdates(_0x4d71a6){return function(_0x3f04){try{jsonpatch[_0x7466('0x1f')](_0x3f04,_0x4d71a6,!![]);}catch(_0x222fd3){return BPromise[_0x7466('0x20')](_0x222fd3);}return _0x3f04[_0x7466('0x21')]();};}function saveUpdates(_0x58dc1b,_0x3af5e7){return function(_0x38973d){if(_0x38973d){return _0x38973d['update'](_0x58dc1b)[_0x7466('0x22')](function(_0xa04d54){return _0xa04d54;});}return null;};}function removeEntity(_0x148be7,_0x599295){return function(_0x13bf59){if(_0x13bf59){return _0x13bf59['destroy']()[_0x7466('0x22')](function(){var _0xc9e8bb=_0x13bf59['get']({'plain':!![]});var _0x19c68a=_0x7466('0x23');return db[_0x7466('0x24')][_0x7466('0x25')]({'where':{'type':_0x19c68a,'resourceId':_0xc9e8bb['id']}})[_0x7466('0x22')](function(){return _0x13bf59;});})[_0x7466('0x22')](function(){_0x148be7[_0x7466('0x18')](0xcc)[_0x7466('0x19')]();});}};}function handleEntityNotFound(_0x447f4c,_0x575a3e){return function(_0x223869){if(!_0x223869){_0x447f4c[_0x7466('0x17')](0x194);}return _0x223869;};}function handleError(_0x220499,_0x658a21){_0x658a21=_0x658a21||0x1f4;return function(_0x2644d6){logger[_0x7466('0x26')](_0x2644d6[_0x7466('0x27')]);if(_0x2644d6['name']){delete _0x2644d6[_0x7466('0x28')];}_0x220499[_0x7466('0x18')](_0x658a21)[_0x7466('0x29')](_0x2644d6);};}exports['index']=function(_0x58ec18,_0x1c6473){var _0x15cbb2={},_0x14b91b={},_0x584f8c={'count':0x0,'rows':[]};var _0x9ca5ed=_[_0x7466('0x2a')](db['Tag'][_0x7466('0x2b')],function(_0x1ba7be){return{'name':_0x1ba7be[_0x7466('0x2c')],'type':_0x1ba7be[_0x7466('0x2d')][_0x7466('0x2e')]};});_0x14b91b['model']=_[_0x7466('0x2a')](_0x9ca5ed,_0x7466('0x28'));_0x14b91b[_0x7466('0x2f')]=_['keys'](_0x58ec18[_0x7466('0x2f')]);_0x14b91b[_0x7466('0x30')]=_[_0x7466('0x31')](_0x14b91b[_0x7466('0x32')],_0x14b91b[_0x7466('0x2f')]);_0x15cbb2[_0x7466('0x33')]=_[_0x7466('0x31')](_0x14b91b['model'],qs[_0x7466('0x34')](_0x58ec18[_0x7466('0x2f')][_0x7466('0x34')]));_0x15cbb2[_0x7466('0x33')]=_0x15cbb2['attributes']['length']?_0x15cbb2[_0x7466('0x33')]:_0x14b91b[_0x7466('0x32')];if(!_0x58ec18['query'][_0x7466('0x35')](_0x7466('0x36'))){_0x15cbb2[_0x7466('0x1c')]=qs[_0x7466('0x1c')](_0x58ec18['query'][_0x7466('0x1c')]);_0x15cbb2['offset']=qs[_0x7466('0x1b')](_0x58ec18[_0x7466('0x2f')][_0x7466('0x1b')]);}_0x15cbb2[_0x7466('0x37')]=qs[_0x7466('0x38')](_0x58ec18[_0x7466('0x2f')]['sort']);_0x15cbb2['where']=qs[_0x7466('0x30')](_[_0x7466('0x39')](_0x58ec18[_0x7466('0x2f')],_0x14b91b[_0x7466('0x30')]),_0x9ca5ed);if(_0x58ec18['query']['filter']){_0x15cbb2['where']=_['merge'](_0x15cbb2[_0x7466('0x3a')],{'$or':_[_0x7466('0x2a')](_0x9ca5ed,function(_0x50f4ca){if(_0x50f4ca[_0x7466('0x2d')]!==_0x7466('0x3b')){var _0x304f58={};_0x304f58[_0x50f4ca[_0x7466('0x28')]]={'$like':'%'+_0x58ec18['query'][_0x7466('0x3c')]+'%'};return _0x304f58;}})});}_0x15cbb2=_['merge']({},_0x15cbb2,_0x58ec18[_0x7466('0x3d')]);var _0x30200f={'where':_0x15cbb2[_0x7466('0x3a')]};return db[_0x7466('0x3e')][_0x7466('0x3f')](_0x30200f)[_0x7466('0x22')](function(_0x5ea798){_0x584f8c[_0x7466('0x3f')]=_0x5ea798;if(_0x58ec18[_0x7466('0x2f')]['includeAll']){_0x15cbb2[_0x7466('0x40')]=[{'all':!![]}];}return db[_0x7466('0x3e')][_0x7466('0x41')](_0x15cbb2);})[_0x7466('0x22')](function(_0x127742){_0x584f8c['rows']=_0x127742;return _0x584f8c;})[_0x7466('0x22')](respondWithFilteredResult(_0x1c6473,_0x15cbb2))[_0x7466('0x42')](handleError(_0x1c6473,null));};exports[_0x7466('0x43')]=function(_0x18556d,_0x27409f){var _0x30f7dc={'raw':!![],'where':{'id':_0x18556d[_0x7466('0x44')]['id']}},_0x3bd9ab={};_0x3bd9ab[_0x7466('0x32')]=_[_0x7466('0x45')](db[_0x7466('0x3e')]['rawAttributes']);_0x3bd9ab[_0x7466('0x2f')]=_[_0x7466('0x45')](_0x18556d[_0x7466('0x2f')]);_0x3bd9ab[_0x7466('0x30')]=_[_0x7466('0x31')](_0x3bd9ab[_0x7466('0x32')],_0x3bd9ab['query']);_0x30f7dc[_0x7466('0x33')]=_['intersection'](_0x3bd9ab[_0x7466('0x32')],qs[_0x7466('0x34')](_0x18556d[_0x7466('0x2f')]['fields']));_0x30f7dc[_0x7466('0x33')]=_0x30f7dc[_0x7466('0x33')]['length']?_0x30f7dc[_0x7466('0x33')]:_0x3bd9ab['model'];if(_0x18556d[_0x7466('0x2f')][_0x7466('0x46')]){_0x30f7dc[_0x7466('0x40')]=[{'all':!![]}];}_0x30f7dc=_[_0x7466('0x47')]({},_0x30f7dc,_0x18556d[_0x7466('0x3d')]);return db[_0x7466('0x3e')][_0x7466('0x48')](_0x30f7dc)['then'](handleEntityNotFound(_0x27409f,null))['then'](respondWithResult(_0x27409f,null))[_0x7466('0x42')](handleError(_0x27409f,null));};exports[_0x7466('0x49')]=function(_0x7ea4ac,_0xd2ef9f){return db['Tag'][_0x7466('0x49')](_0x7ea4ac['body'],{})['then'](function(_0x138817){var _0x5056d7=_0x7ea4ac[_0x7466('0x4a')][_0x7466('0x4b')]({'plain':!![]});if(!_0x5056d7)throw new Error(_0x7466('0x4c'));if(_0x5056d7[_0x7466('0x4d')]===_0x7466('0x4a')){var _0x402ac9=_0x138817[_0x7466('0x4b')]({'plain':!![]});var _0x1f8506='Tags';return db[_0x7466('0x4e')]['find']({'where':{'name':_0x1f8506,'userProfileId':_0x5056d7['userProfileId']},'raw':!![]})['then'](function(_0x302bec){if(_0x302bec&&_0x302bec['autoAssociation']===0x0){return db[_0x7466('0x24')][_0x7466('0x49')]({'name':_0x402ac9[_0x7466('0x28')],'resourceId':_0x402ac9['id'],'type':_0x302bec['name'],'sectionId':_0x302bec['id']},{})[_0x7466('0x22')](function(){return _0x138817;});}else{return _0x138817;}})[_0x7466('0x42')](function(_0x120b39){logger[_0x7466('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x120b39);throw _0x120b39;});}return _0x138817;})[_0x7466('0x22')](respondWithResult(_0xd2ef9f,0xc9))[_0x7466('0x42')](handleError(_0xd2ef9f,null));};exports[_0x7466('0x4f')]=function(_0x5f0bf2,_0x2a4d91){if(_0x5f0bf2['body']['id']){delete _0x5f0bf2[_0x7466('0x50')]['id'];}return db[_0x7466('0x3e')][_0x7466('0x48')]({'where':{'id':_0x5f0bf2[_0x7466('0x44')]['id']}})[_0x7466('0x22')](handleEntityNotFound(_0x2a4d91,null))[_0x7466('0x22')](saveUpdates(_0x5f0bf2[_0x7466('0x50')],null))[_0x7466('0x22')](respondWithResult(_0x2a4d91,null))[_0x7466('0x42')](handleError(_0x2a4d91,null));};exports[_0x7466('0x25')]=function(_0x49b5ca,_0x3f791b){return db[_0x7466('0x3e')][_0x7466('0x48')]({'where':{'id':_0x49b5ca[_0x7466('0x44')]['id']}})[_0x7466('0x22')](handleEntityNotFound(_0x3f791b,null))[_0x7466('0x22')](removeEntity(_0x3f791b,null))['catch'](handleError(_0x3f791b,null));}; \ No newline at end of file +var _0x3629=['userProfileId','autoAssociation','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x46e8bb,_0x382eee){var _0x4ef854=function(_0x2b4a22){while(--_0x2b4a22){_0x46e8bb['push'](_0x46e8bb['shift']());}};_0x4ef854(++_0x382eee);}(_0x3629,0xb3));var _0x9362=function(_0x2e0f02,_0x579afe){_0x2e0f02=_0x2e0f02-0x0;var _0x30c4a7=_0x3629[_0x2e0f02];return _0x30c4a7;};'use strict';var pdf=require(_0x9362('0x0'));var emlformat=require(_0x9362('0x1'));var rimraf=require(_0x9362('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9362('0x3'));var rp=require(_0x9362('0x4'));var moment=require(_0x9362('0x5'));var BPromise=require(_0x9362('0x6'));var Mustache=require(_0x9362('0x7'));var util=require(_0x9362('0x8'));var path=require(_0x9362('0x9'));var sox=require(_0x9362('0xa'));var csv=require(_0x9362('0xb'));var ejs=require(_0x9362('0xc'));var fs=require('fs');var _=require(_0x9362('0xd'));var squel=require(_0x9362('0xe'));var crypto=require(_0x9362('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9362('0x10'));var toCsv=require(_0x9362('0xb'));var querystring=require(_0x9362('0x11'));var Papa=require(_0x9362('0x12'));var Redis=require(_0x9362('0x13'));var authService=require(_0x9362('0x14'));var qs=require(_0x9362('0x15'));var as=require(_0x9362('0x16'));var hardwareService=require(_0x9362('0x17'));var logger=require('../../config/logger')(_0x9362('0x18'));var utils=require(_0x9362('0x19'));var config=require(_0x9362('0x1a'));var db=require(_0x9362('0x1b'))['db'];function respondWithStatusCode(_0x498949,_0x4721d4){_0x4721d4=_0x4721d4||0xcc;return function(_0x20e2bd){if(_0x20e2bd){return _0x498949[_0x9362('0x1c')](_0x4721d4);}return _0x498949[_0x9362('0x1d')](_0x4721d4)[_0x9362('0x1e')]();};}function respondWithResult(_0x27728d,_0x5b018d){_0x5b018d=_0x5b018d||0xc8;return function(_0x3de5f5){if(_0x3de5f5){return _0x27728d[_0x9362('0x1d')](_0x5b018d)[_0x9362('0x1f')](_0x3de5f5);}};}function respondWithFilteredResult(_0x15aa1e,_0x5c1696){return function(_0x153dc2){if(_0x153dc2){var _0x182e3e=_0x153dc2['count'],_0x514b3c=_0x5c1696[_0x9362('0x20')],_0x4e046c=_0x5c1696['offset']+_0x5c1696[_0x9362('0x21')],_0x275fa0;if(_0x4e046c>=_0x182e3e){_0x4e046c=_0x182e3e;_0x275fa0=0xc8;}else{_0x275fa0=0xce;}_0x15aa1e['status'](_0x275fa0);return _0x15aa1e[_0x9362('0x22')](_0x9362('0x23'),_0x514b3c+'-'+_0x4e046c+'/'+_0x182e3e)[_0x9362('0x1f')](_0x153dc2);}return null;};}function patchUpdates(_0x9eb6de){return function(_0x31cb9a){try{jsonpatch[_0x9362('0x24')](_0x31cb9a,_0x9eb6de,!![]);}catch(_0x12cf33){return BPromise['reject'](_0x12cf33);}return _0x31cb9a[_0x9362('0x25')]();};}function saveUpdates(_0x5c734f,_0x2bc730){return function(_0x316ec4){if(_0x316ec4){return _0x316ec4[_0x9362('0x26')](_0x5c734f)[_0x9362('0x27')](function(_0x217beb){return _0x217beb;});}return null;};}function removeEntity(_0x406e58,_0x17b70d){return function(_0x16cdd4){if(_0x16cdd4){return _0x16cdd4[_0x9362('0x28')]()[_0x9362('0x27')](function(){var _0x5edaab=_0x16cdd4[_0x9362('0x29')]({'plain':!![]});var _0x473509=_0x9362('0x2a');return db[_0x9362('0x2b')]['destroy']({'where':{'type':_0x473509,'resourceId':_0x5edaab['id']}})['then'](function(){return _0x16cdd4;});})[_0x9362('0x27')](function(){_0x406e58[_0x9362('0x1d')](0xcc)[_0x9362('0x1e')]();});}};}function handleEntityNotFound(_0x451a44,_0x134090){return function(_0x1d507e){if(!_0x1d507e){_0x451a44[_0x9362('0x1c')](0x194);}return _0x1d507e;};}function handleError(_0x36b0d3,_0x46ff83){_0x46ff83=_0x46ff83||0x1f4;return function(_0x3a42e5){logger[_0x9362('0x2c')](_0x3a42e5[_0x9362('0x2d')]);if(_0x3a42e5['name']){delete _0x3a42e5[_0x9362('0x2e')];}_0x36b0d3[_0x9362('0x1d')](_0x46ff83)[_0x9362('0x2f')](_0x3a42e5);};}exports[_0x9362('0x30')]=function(_0x4f6df1,_0x4ef796){var _0x3df42e={},_0x5eeed8={},_0x1f48df={'count':0x0,'rows':[]};var _0x4a5b25=_[_0x9362('0x31')](db[_0x9362('0x32')]['rawAttributes'],function(_0x33d3d1){return{'name':_0x33d3d1[_0x9362('0x33')],'type':_0x33d3d1[_0x9362('0x34')][_0x9362('0x35')]};});_0x5eeed8[_0x9362('0x36')]=_['map'](_0x4a5b25,_0x9362('0x2e'));_0x5eeed8[_0x9362('0x37')]=_[_0x9362('0x38')](_0x4f6df1['query']);_0x5eeed8[_0x9362('0x39')]=_[_0x9362('0x3a')](_0x5eeed8[_0x9362('0x36')],_0x5eeed8['query']);_0x3df42e[_0x9362('0x3b')]=_[_0x9362('0x3a')](_0x5eeed8['model'],qs[_0x9362('0x3c')](_0x4f6df1[_0x9362('0x37')][_0x9362('0x3c')]));_0x3df42e[_0x9362('0x3b')]=_0x3df42e[_0x9362('0x3b')][_0x9362('0x3d')]?_0x3df42e['attributes']:_0x5eeed8['model'];if(!_0x4f6df1[_0x9362('0x37')][_0x9362('0x3e')](_0x9362('0x3f'))){_0x3df42e[_0x9362('0x21')]=qs[_0x9362('0x21')](_0x4f6df1[_0x9362('0x37')][_0x9362('0x21')]);_0x3df42e['offset']=qs['offset'](_0x4f6df1[_0x9362('0x37')]['offset']);}_0x3df42e[_0x9362('0x40')]=qs[_0x9362('0x41')](_0x4f6df1[_0x9362('0x37')][_0x9362('0x41')]);_0x3df42e[_0x9362('0x42')]=qs[_0x9362('0x39')](_[_0x9362('0x43')](_0x4f6df1[_0x9362('0x37')],_0x5eeed8[_0x9362('0x39')]),_0x4a5b25);if(_0x4f6df1[_0x9362('0x37')][_0x9362('0x44')]){_0x3df42e[_0x9362('0x42')]=_[_0x9362('0x45')](_0x3df42e[_0x9362('0x42')],{'$or':_[_0x9362('0x31')](_0x4a5b25,function(_0x11d956){if(_0x11d956['type']!==_0x9362('0x46')){var _0x267f06={};_0x267f06[_0x11d956[_0x9362('0x2e')]]={'$like':'%'+_0x4f6df1[_0x9362('0x37')]['filter']+'%'};return _0x267f06;}})});}_0x3df42e=_[_0x9362('0x45')]({},_0x3df42e,_0x4f6df1[_0x9362('0x47')]);var _0x5a4ce3={'where':_0x3df42e['where']};return db[_0x9362('0x32')][_0x9362('0x48')](_0x5a4ce3)[_0x9362('0x27')](function(_0x364cb4){_0x1f48df[_0x9362('0x48')]=_0x364cb4;if(_0x4f6df1[_0x9362('0x37')]['includeAll']){_0x3df42e[_0x9362('0x49')]=[{'all':!![]}];}return db[_0x9362('0x32')][_0x9362('0x4a')](_0x3df42e);})[_0x9362('0x27')](function(_0x5364fb){_0x1f48df['rows']=_0x5364fb;return _0x1f48df;})[_0x9362('0x27')](respondWithFilteredResult(_0x4ef796,_0x3df42e))['catch'](handleError(_0x4ef796,null));};exports[_0x9362('0x4b')]=function(_0x18dece,_0x3bfe9f){var _0xdb007b={'raw':!![],'where':{'id':_0x18dece[_0x9362('0x4c')]['id']}},_0x12ec99={};_0x12ec99[_0x9362('0x36')]=_['keys'](db[_0x9362('0x32')]['rawAttributes']);_0x12ec99['query']=_[_0x9362('0x38')](_0x18dece[_0x9362('0x37')]);_0x12ec99[_0x9362('0x39')]=_[_0x9362('0x3a')](_0x12ec99[_0x9362('0x36')],_0x12ec99[_0x9362('0x37')]);_0xdb007b['attributes']=_[_0x9362('0x3a')](_0x12ec99[_0x9362('0x36')],qs['fields'](_0x18dece[_0x9362('0x37')][_0x9362('0x3c')]));_0xdb007b[_0x9362('0x3b')]=_0xdb007b[_0x9362('0x3b')][_0x9362('0x3d')]?_0xdb007b[_0x9362('0x3b')]:_0x12ec99[_0x9362('0x36')];if(_0x18dece['query'][_0x9362('0x4d')]){_0xdb007b[_0x9362('0x49')]=[{'all':!![]}];}_0xdb007b=_[_0x9362('0x45')]({},_0xdb007b,_0x18dece[_0x9362('0x47')]);return db['Tag'][_0x9362('0x4e')](_0xdb007b)[_0x9362('0x27')](handleEntityNotFound(_0x3bfe9f,null))[_0x9362('0x27')](respondWithResult(_0x3bfe9f,null))['catch'](handleError(_0x3bfe9f,null));};exports[_0x9362('0x4f')]=function(_0x128c66,_0xd8aa52){return db[_0x9362('0x32')][_0x9362('0x4f')](_0x128c66[_0x9362('0x50')],{})[_0x9362('0x27')](function(_0x408a79){var _0x3f6380=_0x128c66[_0x9362('0x51')]['get']({'plain':!![]});if(!_0x3f6380)throw new Error(_0x9362('0x52'));if(_0x3f6380[_0x9362('0x53')]==='user'){var _0x108e32=_0x408a79[_0x9362('0x29')]({'plain':!![]});var _0x2a0c28=_0x9362('0x2a');return db[_0x9362('0x54')][_0x9362('0x4e')]({'where':{'name':_0x2a0c28,'userProfileId':_0x3f6380[_0x9362('0x55')]},'raw':!![]})[_0x9362('0x27')](function(_0x4461ca){if(_0x4461ca&&_0x4461ca[_0x9362('0x56')]===0x0){return db[_0x9362('0x2b')][_0x9362('0x4f')]({'name':_0x108e32[_0x9362('0x2e')],'resourceId':_0x108e32['id'],'type':_0x4461ca[_0x9362('0x2e')],'sectionId':_0x4461ca['id']},{})[_0x9362('0x27')](function(){return _0x408a79;});}else{return _0x408a79;}})[_0x9362('0x57')](function(_0x4407c0){logger[_0x9362('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4407c0);throw _0x4407c0;});}return _0x408a79;})['then'](respondWithResult(_0xd8aa52,0xc9))[_0x9362('0x57')](handleError(_0xd8aa52,null));};exports[_0x9362('0x26')]=function(_0x31772b,_0xef4022){if(_0x31772b[_0x9362('0x50')]['id']){delete _0x31772b['body']['id'];}return db[_0x9362('0x32')][_0x9362('0x4e')]({'where':{'id':_0x31772b['params']['id']}})[_0x9362('0x27')](handleEntityNotFound(_0xef4022,null))['then'](saveUpdates(_0x31772b[_0x9362('0x50')],null))[_0x9362('0x27')](respondWithResult(_0xef4022,null))[_0x9362('0x57')](handleError(_0xef4022,null));};exports[_0x9362('0x28')]=function(_0x237a06,_0x25a0f3){return db['Tag']['find']({'where':{'id':_0x237a06[_0x9362('0x4c')]['id']}})[_0x9362('0x27')](handleEntityNotFound(_0x25a0f3,null))['then'](removeEntity(_0x25a0f3,null))[_0x9362('0x57')](handleError(_0x25a0f3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 42cb95c..2cce167 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 _0xbf2f=['request-promise','path','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags','lodash','util','../../config/logger','moment'];(function(_0x10711d,_0x1c1df9){var _0xe9fdfd=function(_0x444b24){while(--_0x444b24){_0x10711d['push'](_0x10711d['shift']());}};_0xe9fdfd(++_0x1c1df9);}(_0xbf2f,0x151));var _0xfbf2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf2f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfbf2('0x0'));var util=require(_0xfbf2('0x1'));var logger=require(_0xfbf2('0x2'))('api');var moment=require(_0xfbf2('0x3'));var BPromise=require('bluebird');var rp=require(_0xfbf2('0x4'));var fs=require('fs');var path=require(_0xfbf2('0x5'));var rimraf=require(_0xfbf2('0x6'));var config=require(_0xfbf2('0x7'));var attributes=require(_0xfbf2('0x8'));module['exports']=function(_0x1e1328,_0x2f0bbe){return _0x1e1328['define'](_0xfbf2('0x9'),attributes,{'tableName':_0xfbf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc668=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','Tag','tools_tags','lodash'];(function(_0x30fdda,_0x2da721){var _0x1bba7c=function(_0x488f4f){while(--_0x488f4f){_0x30fdda['push'](_0x30fdda['shift']());}};_0x1bba7c(++_0x2da721);}(_0xc668,0x6d));var _0x8c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc668[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c66('0x0'));var util=require(_0x8c66('0x1'));var logger=require(_0x8c66('0x2'))('api');var moment=require(_0x8c66('0x3'));var BPromise=require(_0x8c66('0x4'));var rp=require(_0x8c66('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c66('0x6'));var config=require(_0x8c66('0x7'));var attributes=require('./tag.attributes');module[_0x8c66('0x8')]=function(_0xcd1033,_0x3c58b9){return _0xcd1033['define'](_0x8c66('0x9'),attributes,{'tableName':_0x8c66('0xa'),'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 91c26c1..6e96633 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 _0x44a3=['http','request','then','info','request\x20sent','debug','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ef9f1,_0x59b026){var _0xc3d2b9=function(_0x3c5ec9){while(--_0x3c5ec9){_0x2ef9f1['push'](_0x2ef9f1['shift']());}};_0xc3d2b9(++_0x59b026);}(_0x44a3,0x1a9));var _0x344a=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0x44a3[_0x269c42];return _0x4dad76;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('Tag,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('Tag,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('Tag,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});} \ No newline at end of file +var _0x3c81=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4a801f,_0x55d3c4){var _0x869b3b=function(_0xff7bd3){while(--_0xff7bd3){_0x4a801f['push'](_0x4a801f['shift']());}};_0x869b3b(++_0x55d3c4);}(_0x3c81,0x102));var _0x13c8=function(_0x45643d,_0x246752){_0x45643d=_0x45643d-0x0;var _0x372493=_0x3c81[_0x45643d];return _0x372493;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('Tag,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 48779f4..e7b479d 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 _0xaa4b=['util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/queues','getQueues','post','create','/:id/users','addAgents','put','/:id','update','delete','removeQueues','removeAgents','multer'];(function(_0x6925fa,_0x4e6100){var _0x56d211=function(_0x59fe6d){while(--_0x59fe6d){_0x6925fa['push'](_0x6925fa['shift']());}};_0x56d211(++_0x4e6100);}(_0xaa4b,0x89));var _0xbaa4=function(_0x1c111b,_0x228210){_0x1c111b=_0x1c111b-0x0;var _0x148b93=_0xaa4b[_0x1c111b];return _0x148b93;};'use strict';var multer=require(_0xbaa4('0x0'));var util=require(_0xbaa4('0x1'));var path=require(_0xbaa4('0x2'));var timeout=require('connect-timeout');var express=require(_0xbaa4('0x3'));var router=express[_0xbaa4('0x4')]();var auth=require(_0xbaa4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbaa4('0x6'));var controller=require('./team.controller');router[_0xbaa4('0x7')]('/',auth[_0xbaa4('0x8')](),controller[_0xbaa4('0x9')]);router['get']('/:id',auth[_0xbaa4('0x8')](),controller[_0xbaa4('0xa')]);router[_0xbaa4('0x7')](_0xbaa4('0xb'),auth['isAuthenticated'](),controller[_0xbaa4('0xc')]);router[_0xbaa4('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xbaa4('0xd')]('/',auth['isAuthenticated'](),controller[_0xbaa4('0xe')]);router[_0xbaa4('0xd')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);router[_0xbaa4('0xd')](_0xbaa4('0xf'),auth[_0xbaa4('0x8')](),controller[_0xbaa4('0x10')]);router[_0xbaa4('0x11')](_0xbaa4('0x12'),auth['isAuthenticated'](),controller[_0xbaa4('0x13')]);router[_0xbaa4('0x14')](_0xbaa4('0x12'),auth['isAuthenticated'](),controller['destroy']);router[_0xbaa4('0x14')](_0xbaa4('0xb'),auth[_0xbaa4('0x8')](),controller[_0xbaa4('0x15')]);router[_0xbaa4('0x14')](_0xbaa4('0xf'),auth['isAuthenticated'](),controller[_0xbaa4('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5f84=['../../components/interaction/service','./team.controller','get','index','/:id','isAuthenticated','show','/:id/queues','/:id/users','getAgents','create','post','addAgents','put','update','delete','removeAgents','exports','multer','util','path','express'];(function(_0x13e197,_0x21b487){var _0x187cdc=function(_0x1634b7){while(--_0x1634b7){_0x13e197['push'](_0x13e197['shift']());}};_0x187cdc(++_0x21b487);}(_0x5f84,0x188));var _0x45f8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f84[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x45f8('0x0'));var util=require(_0x45f8('0x1'));var path=require(_0x45f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x45f8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x45f8('0x4'));var config=require('../../config/environment');var controller=require(_0x45f8('0x5'));router[_0x45f8('0x6')]('/',auth['isAuthenticated'](),controller[_0x45f8('0x7')]);router[_0x45f8('0x6')](_0x45f8('0x8'),auth[_0x45f8('0x9')](),controller[_0x45f8('0xa')]);router[_0x45f8('0x6')](_0x45f8('0xb'),auth[_0x45f8('0x9')](),controller['getQueues']);router[_0x45f8('0x6')](_0x45f8('0xc'),auth[_0x45f8('0x9')](),controller[_0x45f8('0xd')]);router['post']('/',auth[_0x45f8('0x9')](),controller[_0x45f8('0xe')]);router[_0x45f8('0xf')](_0x45f8('0xb'),auth[_0x45f8('0x9')](),controller['addQueues']);router[_0x45f8('0xf')](_0x45f8('0xc'),auth[_0x45f8('0x9')](),controller[_0x45f8('0x10')]);router[_0x45f8('0x11')]('/:id',auth[_0x45f8('0x9')](),controller[_0x45f8('0x12')]);router[_0x45f8('0x13')](_0x45f8('0x8'),auth[_0x45f8('0x9')](),controller['destroy']);router[_0x45f8('0x13')](_0x45f8('0xb'),auth[_0x45f8('0x9')](),controller['removeQueues']);router[_0x45f8('0x13')]('/:id/users',auth[_0x45f8('0x9')](),controller[_0x45f8('0x14')]);module[_0x45f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index ea9e26d..04d9dcb 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 _0x1d5f=['STRING','name','sequelize','exports'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x1d5f,0x17a));var _0xf1d5=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x1d5f[_0x3e32a8];return _0x2997b0;};'use strict';var Sequelize=require(_0xf1d5('0x0'));module[_0xf1d5('0x1')]={'name':{'type':Sequelize[_0xf1d5('0x2')],'allowNull':![],'unique':_0xf1d5('0x3')},'description':{'type':Sequelize[_0xf1d5('0x2')]}}; \ No newline at end of file +var _0x5f60=['exports','name','STRING'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x5f60,0x6f));var _0x05f6=function(_0x8d5844,_0x48eb67){_0x8d5844=_0x8d5844-0x0;var _0x56726c=_0x5f60[_0x8d5844];return _0x56726c;};'use strict';var Sequelize=require('sequelize');module[_0x05f6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x05f6('0x1')},'description':{'type':Sequelize[_0x05f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 0d67107..ba12ea8 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 _0xef7c=['channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','add','Queues','ids','findOne','remove','addAgents','Chat','Mail','Openchannel','Whatsapp','each','Voice','online','voicePause','interface','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','chat','mail','fax','openchannel','whatsapp','voice','userTeam:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','sendStatus','status','end','json','count','offset','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','Team','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','userProfileId','autoAssociation','getQueues'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xef7c,0xa5));var _0xcef7=function(_0x1c050d,_0xc6ffd5){_0x1c050d=_0x1c050d-0x0;var _0x46693b=_0xef7c[_0x1c050d];return _0x46693b;};'use strict';var pdf=require(_0xcef7('0x0'));var emlformat=require(_0xcef7('0x1'));var rimraf=require(_0xcef7('0x2'));var zipdir=require(_0xcef7('0x3'));var jsonpatch=require(_0xcef7('0x4'));var rp=require(_0xcef7('0x5'));var moment=require(_0xcef7('0x6'));var BPromise=require(_0xcef7('0x7'));var Mustache=require(_0xcef7('0x8'));var util=require(_0xcef7('0x9'));var path=require(_0xcef7('0xa'));var sox=require(_0xcef7('0xb'));var csv=require('to-csv');var ejs=require(_0xcef7('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcef7('0xd'));var crypto=require(_0xcef7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcef7('0xf'));var querystring=require(_0xcef7('0x10'));var Papa=require(_0xcef7('0x11'));var Redis=require(_0xcef7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcef7('0x13'));var hardwareService=require(_0xcef7('0x14'));var logger=require(_0xcef7('0x15'))(_0xcef7('0x16'));var utils=require('../../config/utils');var config=require(_0xcef7('0x17'));var db=require(_0xcef7('0x18'))['db'];config[_0xcef7('0x19')]=_[_0xcef7('0x1a')](config[_0xcef7('0x19')],{'host':_0xcef7('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcef7('0x1c'))['register'](socket);function respondWithStatusCode(_0x12dd5d,_0x3ba156){_0x3ba156=_0x3ba156||0xcc;return function(_0x22f02a){if(_0x22f02a){return _0x12dd5d[_0xcef7('0x1d')](_0x3ba156);}return _0x12dd5d[_0xcef7('0x1e')](_0x3ba156)[_0xcef7('0x1f')]();};}function respondWithResult(_0x1e38aa,_0x54098d){_0x54098d=_0x54098d||0xc8;return function(_0x1b242b){if(_0x1b242b){return _0x1e38aa[_0xcef7('0x1e')](_0x54098d)[_0xcef7('0x20')](_0x1b242b);}};}function respondWithFilteredResult(_0x2355ad,_0x502944){return function(_0x395985){if(_0x395985){var _0x3f6018=_0x395985[_0xcef7('0x21')],_0x1d690e=_0x502944[_0xcef7('0x22')],_0x2e9fc8=_0x502944[_0xcef7('0x22')]+_0x502944['limit'],_0x50765e;if(_0x2e9fc8>=_0x3f6018){_0x2e9fc8=_0x3f6018;_0x50765e=0xc8;}else{_0x50765e=0xce;}_0x2355ad[_0xcef7('0x1e')](_0x50765e);return _0x2355ad['set']('Content-Range',_0x1d690e+'-'+_0x2e9fc8+'/'+_0x3f6018)['json'](_0x395985);}return null;};}function patchUpdates(_0xdb9ed7){return function(_0x501555){try{jsonpatch[_0xcef7('0x23')](_0x501555,_0xdb9ed7,!![]);}catch(_0xf99ce1){return BPromise['reject'](_0xf99ce1);}return _0x501555[_0xcef7('0x24')]();};}function saveUpdates(_0x4cf59d,_0xc790c7){return function(_0x41783d){if(_0x41783d){return _0x41783d[_0xcef7('0x25')](_0x4cf59d)[_0xcef7('0x26')](function(_0x56f9e4){return _0x56f9e4;});}return null;};}function removeEntity(_0x40b562,_0x2e91e6){return function(_0x238d85){if(_0x238d85){return _0x238d85[_0xcef7('0x27')]()['then'](function(){var _0x8f48e3=_0x238d85[_0xcef7('0x28')]({'plain':!![]});var _0x1eacb6='Teams';return db[_0xcef7('0x29')][_0xcef7('0x27')]({'where':{'type':_0x1eacb6,'resourceId':_0x8f48e3['id']}})[_0xcef7('0x26')](function(){return _0x238d85;});})[_0xcef7('0x26')](function(){_0x40b562['status'](0xcc)[_0xcef7('0x1f')]();});}};}function handleEntityNotFound(_0xf17a1f,_0x541610){return function(_0x239f28){if(!_0x239f28){_0xf17a1f[_0xcef7('0x1d')](0x194);}return _0x239f28;};}function handleError(_0x4d9577,_0x159f61){_0x159f61=_0x159f61||0x1f4;return function(_0x302e22){logger[_0xcef7('0x2a')](_0x302e22[_0xcef7('0x2b')]);if(_0x302e22[_0xcef7('0x2c')]){delete _0x302e22['name'];}_0x4d9577[_0xcef7('0x1e')](_0x159f61)[_0xcef7('0x2d')](_0x302e22);};}exports[_0xcef7('0x2e')]=function(_0x306293,_0x37a447){var _0x563455={},_0x267cbe={},_0x224bf0={'count':0x0,'rows':[]};var _0x22be6e=_[_0xcef7('0x2f')](db['Team'][_0xcef7('0x30')],function(_0x26001a){return{'name':_0x26001a['fieldName'],'type':_0x26001a[_0xcef7('0x31')]['key']};});_0x267cbe['model']=_['map'](_0x22be6e,'name');_0x267cbe[_0xcef7('0x32')]=_[_0xcef7('0x33')](_0x306293[_0xcef7('0x32')]);_0x267cbe[_0xcef7('0x34')]=_[_0xcef7('0x35')](_0x267cbe[_0xcef7('0x36')],_0x267cbe['query']);_0x563455[_0xcef7('0x37')]=_['intersection'](_0x267cbe[_0xcef7('0x36')],qs[_0xcef7('0x38')](_0x306293['query']['fields']));_0x563455['attributes']=_0x563455['attributes'][_0xcef7('0x39')]?_0x563455['attributes']:_0x267cbe['model'];if(!_0x306293['query'][_0xcef7('0x3a')](_0xcef7('0x3b'))){_0x563455['limit']=qs[_0xcef7('0x3c')](_0x306293[_0xcef7('0x32')]['limit']);_0x563455[_0xcef7('0x22')]=qs[_0xcef7('0x22')](_0x306293['query']['offset']);}_0x563455[_0xcef7('0x3d')]=qs['sort'](_0x306293[_0xcef7('0x32')][_0xcef7('0x3e')]);_0x563455[_0xcef7('0x3f')]=qs['filters'](_[_0xcef7('0x40')](_0x306293[_0xcef7('0x32')],_0x267cbe[_0xcef7('0x34')]),_0x22be6e);if(_0x306293['query'][_0xcef7('0x41')]){_0x563455[_0xcef7('0x3f')]=_[_0xcef7('0x42')](_0x563455[_0xcef7('0x3f')],{'$or':_[_0xcef7('0x2f')](_0x22be6e,function(_0x95b534){if(_0x95b534['type']!==_0xcef7('0x43')){var _0x43b54b={};_0x43b54b[_0x95b534['name']]={'$like':'%'+_0x306293[_0xcef7('0x32')][_0xcef7('0x41')]+'%'};return _0x43b54b;}})});}_0x563455=_[_0xcef7('0x42')]({},_0x563455,_0x306293['options']);var _0x57fcfa={'where':_0x563455[_0xcef7('0x3f')]};return db[_0xcef7('0x44')][_0xcef7('0x21')](_0x57fcfa)[_0xcef7('0x26')](function(_0x578a0c){_0x224bf0['count']=_0x578a0c;if(_0x306293[_0xcef7('0x32')][_0xcef7('0x45')]){_0x563455[_0xcef7('0x46')]=[{'all':!![]}];}return db[_0xcef7('0x44')]['findAll'](_0x563455);})[_0xcef7('0x26')](function(_0x48b37d){_0x224bf0[_0xcef7('0x47')]=_0x48b37d;return _0x224bf0;})['then'](respondWithFilteredResult(_0x37a447,_0x563455))[_0xcef7('0x48')](handleError(_0x37a447,null));};exports[_0xcef7('0x49')]=function(_0x5343cf,_0x259448){var _0x32a87f={'raw':![],'where':{'id':_0x5343cf[_0xcef7('0x4a')]['id']}},_0x44412d={};_0x44412d[_0xcef7('0x36')]=_['keys'](db[_0xcef7('0x44')][_0xcef7('0x30')]);_0x44412d[_0xcef7('0x32')]=_['keys'](_0x5343cf['query']);_0x44412d[_0xcef7('0x34')]=_[_0xcef7('0x35')](_0x44412d[_0xcef7('0x36')],_0x44412d[_0xcef7('0x32')]);_0x32a87f[_0xcef7('0x37')]=_['intersection'](_0x44412d['model'],qs['fields'](_0x5343cf['query'][_0xcef7('0x38')]));_0x32a87f[_0xcef7('0x37')]=_0x32a87f[_0xcef7('0x37')]['length']?_0x32a87f[_0xcef7('0x37')]:_0x44412d['model'];if(_0x5343cf['query'][_0xcef7('0x45')]){_0x32a87f[_0xcef7('0x46')]=[{'all':!![]}];}_0x32a87f=_[_0xcef7('0x42')]({},_0x32a87f,_0x5343cf[_0xcef7('0x4b')]);return db[_0xcef7('0x44')][_0xcef7('0x4c')](_0x32a87f)[_0xcef7('0x26')](handleEntityNotFound(_0x259448,null))[_0xcef7('0x26')](respondWithResult(_0x259448,null))[_0xcef7('0x48')](handleError(_0x259448,null));};exports[_0xcef7('0x4d')]=function(_0x8db49f,_0x16f7e5){return db[_0xcef7('0x44')][_0xcef7('0x4d')](_0x8db49f[_0xcef7('0x4e')],{})['then'](function(_0x226e83){var _0x5e3a61=_0x8db49f[_0xcef7('0x4f')][_0xcef7('0x28')]({'plain':!![]});if(!_0x5e3a61)throw new Error(_0xcef7('0x50'));if(_0x5e3a61['role']===_0xcef7('0x4f')){var _0xeae82a=_0x226e83[_0xcef7('0x28')]({'plain':!![]});var _0x4a7336=_0xcef7('0x51');return db['UserProfileSection'][_0xcef7('0x4c')]({'where':{'name':_0x4a7336,'userProfileId':_0x5e3a61[_0xcef7('0x52')]},'raw':!![]})['then'](function(_0x165e73){if(_0x165e73&&_0x165e73[_0xcef7('0x53')]===0x0){return db[_0xcef7('0x29')][_0xcef7('0x4d')]({'name':_0xeae82a[_0xcef7('0x2c')],'resourceId':_0xeae82a['id'],'type':_0x165e73[_0xcef7('0x2c')],'sectionId':_0x165e73['id']},{})[_0xcef7('0x26')](function(){return _0x226e83;});}else{return _0x226e83;}})[_0xcef7('0x48')](function(_0x17b22e){logger[_0xcef7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17b22e);throw _0x17b22e;});}return _0x226e83;})[_0xcef7('0x26')](respondWithResult(_0x16f7e5,0xc9))['catch'](handleError(_0x16f7e5,null));};exports['update']=function(_0x5db774,_0x1c9a9e){if(_0x5db774[_0xcef7('0x4e')]['id']){delete _0x5db774['body']['id'];}return db[_0xcef7('0x44')][_0xcef7('0x4c')]({'where':{'id':_0x5db774[_0xcef7('0x4a')]['id']}})[_0xcef7('0x26')](handleEntityNotFound(_0x1c9a9e,null))[_0xcef7('0x26')](saveUpdates(_0x5db774[_0xcef7('0x4e')],null))[_0xcef7('0x26')](respondWithResult(_0x1c9a9e,null))[_0xcef7('0x48')](handleError(_0x1c9a9e,null));};exports[_0xcef7('0x27')]=function(_0x3bf178,_0xb4ce5){return db[_0xcef7('0x44')]['find']({'where':{'id':_0x3bf178[_0xcef7('0x4a')]['id']}})[_0xcef7('0x26')](handleEntityNotFound(_0xb4ce5,null))['then'](removeEntity(_0xb4ce5,null))[_0xcef7('0x48')](handleError(_0xb4ce5,null));};exports[_0xcef7('0x54')]=function(_0x1ef4f4,_0x35de61,_0x4f774e){return db[_0xcef7('0x44')]['findOne']({'where':{'id':_0x1ef4f4[_0xcef7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35de61,null))[_0xcef7('0x26')](function(_0x2a0fc1){if(!_0x1ef4f4['query'][_0xcef7('0x55')]||!utils[_0xcef7('0x56')](_0x1ef4f4[_0xcef7('0x32')][_0xcef7('0x55')])){throw new db[(_0xcef7('0x57'))][(_0xcef7('0x58'))](_0xcef7('0x59'));}var _0x20aa76={};var _0x4a7d6a={};_0x4a7d6a[_0xcef7('0x36')]=_[_0xcef7('0x33')](db[_[_0xcef7('0x5a')](_0x1ef4f4[_0xcef7('0x32')]['channel'][_0xcef7('0x5b')]())+_0xcef7('0x5c')][_0xcef7('0x30')]);_0x4a7d6a[_0xcef7('0x32')]=_['keys'](_0x1ef4f4['query']);_0x4a7d6a['filters']=_[_0xcef7('0x35')](_0x4a7d6a[_0xcef7('0x36')],_0x4a7d6a[_0xcef7('0x32')]);_0x20aa76[_0xcef7('0x37')]=_[_0xcef7('0x35')](_0x4a7d6a[_0xcef7('0x36')],qs[_0xcef7('0x38')](_0x1ef4f4['query'][_0xcef7('0x38')]));_0x20aa76[_0xcef7('0x37')]=_0x20aa76[_0xcef7('0x37')][_0xcef7('0x39')]?_0x20aa76['attributes']:_0x4a7d6a['model'];_0x20aa76[_0xcef7('0x3c')]=qs[_0xcef7('0x3c')](_0x1ef4f4[_0xcef7('0x32')]['limit']);_0x20aa76[_0xcef7('0x22')]=qs['offset'](_0x1ef4f4[_0xcef7('0x32')][_0xcef7('0x22')]);_0x20aa76['order']=qs[_0xcef7('0x3e')](_0x1ef4f4[_0xcef7('0x32')][_0xcef7('0x3e')]);_0x20aa76[_0xcef7('0x3f')]=qs['filters'](_[_0xcef7('0x40')](_0x1ef4f4[_0xcef7('0x32')],_0x4a7d6a['filters']));_0x20aa76=_[_0xcef7('0x42')]({},_0x20aa76,_0x1ef4f4[_0xcef7('0x4b')]);return _0x2a0fc1[_0xcef7('0x28')+_[_0xcef7('0x5a')](_0x1ef4f4['query']['channel'][_0xcef7('0x5b')]())+'Queues'](_0x20aa76);})[_0xcef7('0x26')](respondWithResult(_0x35de61,null))[_0xcef7('0x48')](handleError(_0x35de61,null));};exports['addQueues']=function(_0x5efe1b,_0x25b202,_0x539d24){return db[_0xcef7('0x44')]['findOne']({'where':{'id':_0x5efe1b['params']['id']}})[_0xcef7('0x26')](function(_0x2230c7){if(_0x2230c7){if(!_0x5efe1b[_0xcef7('0x4e')][_0xcef7('0x55')]||!utils[_0xcef7('0x56')](_0x5efe1b[_0xcef7('0x4e')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x2230c7[_0xcef7('0x5d')+_[_0xcef7('0x5a')](_0x5efe1b[_0xcef7('0x4e')][_0xcef7('0x55')][_0xcef7('0x5b')]())+_0xcef7('0x5e')](_0x5efe1b[_0xcef7('0x4e')][_0xcef7('0x5f')]);}return null;})[_0xcef7('0x26')](handleEntityNotFound(_0x25b202,null))[_0xcef7('0x26')](respondWithStatusCode(_0x25b202,null))['catch'](handleError(_0x25b202,null));};exports['removeQueues']=function(_0xd949a1,_0x1469b5,_0x2ba83c){return db[_0xcef7('0x44')][_0xcef7('0x60')]({'where':{'id':_0xd949a1[_0xcef7('0x4a')]['id']}})[_0xcef7('0x26')](function(_0x154b54){if(_0x154b54){if(!_0xd949a1['query'][_0xcef7('0x55')]||!utils[_0xcef7('0x56')](_0xd949a1['query'][_0xcef7('0x55')])){throw new db[(_0xcef7('0x57'))][(_0xcef7('0x58'))](_0xcef7('0x59'));}return _0x154b54[_0xcef7('0x61')+_[_0xcef7('0x5a')](_0xd949a1[_0xcef7('0x32')]['channel'][_0xcef7('0x5b')]())+'Queues'](_0xd949a1['query'][_0xcef7('0x5f')]);}return null;})[_0xcef7('0x26')](handleEntityNotFound(_0x1469b5,null))[_0xcef7('0x26')](respondWithStatusCode(_0x1469b5,null))[_0xcef7('0x48')](handleError(_0x1469b5,null));};exports[_0xcef7('0x62')]=function(_0x2b7159,_0x28e6b8,_0x5c422f){return db['Team'][_0xcef7('0x4c')]({'where':{'id':_0x2b7159[_0xcef7('0x4a')]['id']}})[_0xcef7('0x26')](handleEntityNotFound(_0x28e6b8,null))['then'](function(_0x3692c7){if(_0x3692c7){var _0xb5fc32=['Voice',_0xcef7('0x63'),_0xcef7('0x64'),'Sms','Fax',_0xcef7('0x65'),_0xcef7('0x66')];return BPromise[_0xcef7('0x67')](_0xb5fc32,function(_0x3561aa){return _0x3692c7[_0xcef7('0x28')+_0x3561aa+_0xcef7('0x5e')]({'attributes':['id',_0xcef7('0x2c')]})[_0xcef7('0x26')](function(_0xf3d69a){return BPromise[_0xcef7('0x67')](_0xf3d69a,function(_0x4d0f88){return _0x4d0f88[_0xcef7('0x62')](_0x2b7159[_0xcef7('0x4e')][_0xcef7('0x5f')])[_0xcef7('0x26')](function(){if(_0x3561aa===_0xcef7('0x68')){return db['User']['findAll']({'where':{'id':_0x2b7159[_0xcef7('0x4e')][_0xcef7('0x5f')]},'attributes':['id',_0xcef7('0x2c'),_0xcef7('0x69'),_0xcef7('0x6a'),_0xcef7('0x6b')],'raw':!![]})[_0xcef7('0x26')](function(_0x99df86){return BPromise['each'](_[_0xcef7('0x41')](_0x99df86,{'online':0x1}),function(_0x22894b){return db['UserVoiceQueueRt']['upsert']({'membername':_0x22894b[_0xcef7('0x2c')],'UserId':_0x22894b['id'],'queue_name':_0x4d0f88[_0xcef7('0x2c')],'VoiceQueueId':_0x4d0f88['id'],'interface':_[_0xcef7('0x6c')](_0x22894b[_0xcef7('0x6b')])?util[_0xcef7('0x6d')](_0xcef7('0x6e'),_0x22894b['name']):_0x22894b[_0xcef7('0x6b')],'paused':_0x22894b[_0xcef7('0x6a')]||![],'penalty':0x0});});});}});});})[_0xcef7('0x26')](function(){return _0x3692c7;});})['then'](function(){return _0x3692c7;});}})[_0xcef7('0x26')](function(_0x2673f3){if(_0x2673f3){return _0x2673f3['addAgents'](_0x2b7159[_0xcef7('0x4e')][_0xcef7('0x5f')],_[_0xcef7('0x6f')](_0x2b7159['body'],[_0xcef7('0x5f'),'id'])||{})[_0xcef7('0x70')](function(_0x24cdd6){for(var _0x4bc89f=0x0;_0x4bc89f<_0x2b7159[_0xcef7('0x4e')]['ids'][_0xcef7('0x39')];_0x4bc89f+=0x1){socket[_0xcef7('0x71')](_0xcef7('0x72'),{'UserId':_0x2b7159['body'][_0xcef7('0x5f')][_0x4bc89f],'TeamId':_0x2b7159[_0xcef7('0x4a')]['id']});}return _0x24cdd6;});}})[_0xcef7('0x26')](respondWithResult(_0x28e6b8,null))['catch'](handleError(_0x28e6b8,null));};exports[_0xcef7('0x73')]=function(_0x1deffe,_0x48757c,_0x3ef790){return db[_0xcef7('0x44')][_0xcef7('0x4c')]({'where':{'id':_0x1deffe[_0xcef7('0x4a')]['id']}})[_0xcef7('0x26')](handleEntityNotFound(_0x48757c,null))[_0xcef7('0x26')](function(_0x31cfa4){if(_0x31cfa4){return BPromise[_0xcef7('0x67')](['voice',_0xcef7('0x74'),_0xcef7('0x75'),'sms',_0xcef7('0x76'),_0xcef7('0x77'),_0xcef7('0x78')],function(_0x2f4a5f){return _0x31cfa4[_0xcef7('0x28')+_['capitalize'](_0x2f4a5f)+_0xcef7('0x5e')]({'attributes':['id',_0xcef7('0x2c')]})[_0xcef7('0x26')](function(_0xde2187){return BPromise['each'](_0xde2187,function(_0x4448b4){return _0x4448b4['removeAgents'](_0x1deffe['query'][_0xcef7('0x5f')])[_0xcef7('0x26')](function(){if(_0x2f4a5f===_0xcef7('0x79')){return db['UserVoiceQueueRt'][_0xcef7('0x27')]({'where':{'VoiceQueueId':_0x4448b4['id'],'UserId':_0x1deffe[_0xcef7('0x32')]['ids']}});}});});})[_0xcef7('0x26')](function(){return _0x31cfa4;});})[_0xcef7('0x26')](function(){return _0x31cfa4;});}})[_0xcef7('0x26')](function(_0x3e60f4){if(_0x3e60f4){return _0x3e60f4['removeAgents'](_0x1deffe[_0xcef7('0x32')][_0xcef7('0x5f')])['then'](function(){if(_['isArray'](_0x1deffe[_0xcef7('0x32')]['ids'])){for(var _0x31a7bb=0x0;_0x31a7bb<_0x1deffe['query']['ids'][_0xcef7('0x39')];_0x31a7bb+=0x1){socket['emit']('userTeam:remove',{'UserId':Number(_0x1deffe[_0xcef7('0x32')][_0xcef7('0x5f')][_0x31a7bb]),'TeamId':Number(_0x1deffe[_0xcef7('0x4a')]['id'])});}}else{socket[_0xcef7('0x71')](_0xcef7('0x7a'),{'UserId':Number(_0x1deffe['query']['ids']),'TeamId':Number(_0x1deffe[_0xcef7('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x48757c,null))[_0xcef7('0x48')](handleError(_0x48757c,null));};exports[_0xcef7('0x7b')]=function(_0x110bb2,_0x562d03,_0x241503){var _0x19d47d={};var _0x6856ec={};var _0x51a255;var _0xe17f08;return db['Team'][_0xcef7('0x60')]({'where':{'id':_0x110bb2[_0xcef7('0x4a')]['id']}})[_0xcef7('0x26')](handleEntityNotFound(_0x562d03,null))[_0xcef7('0x26')](function(_0x6d81dd){if(_0x6d81dd){_0x51a255=_0x6d81dd;_0x6856ec[_0xcef7('0x36')]=_[_0xcef7('0x33')](db[_0xcef7('0x7c')][_0xcef7('0x30')]);_0x6856ec[_0xcef7('0x32')]=_['keys'](_0x110bb2['query']);_0x6856ec[_0xcef7('0x34')]=_['intersection'](_0x6856ec[_0xcef7('0x36')],_0x6856ec[_0xcef7('0x32')]);_0x19d47d[_0xcef7('0x37')]=_[_0xcef7('0x35')](_0x6856ec[_0xcef7('0x36')],qs['fields'](_0x110bb2[_0xcef7('0x32')]['fields']));_0x19d47d['attributes']=_0x19d47d[_0xcef7('0x37')][_0xcef7('0x39')]?_0x19d47d['attributes']:_0x6856ec[_0xcef7('0x36')];_0x19d47d['order']=qs['sort'](_0x110bb2[_0xcef7('0x32')]['sort']);_0x19d47d[_0xcef7('0x3f')]=qs[_0xcef7('0x34')](_['pick'](_0x110bb2['query'],_0x6856ec['filters']));if(_0x110bb2[_0xcef7('0x32')][_0xcef7('0x41')]){_0x19d47d['where']=_[_0xcef7('0x42')](_0x19d47d['where'],{'$or':_[_0xcef7('0x2f')](_0x19d47d[_0xcef7('0x37')],function(_0x168c43){var _0x41f847={};_0x41f847[_0x168c43]={'$like':'%'+_0x110bb2[_0xcef7('0x32')][_0xcef7('0x41')]+'%'};return _0x41f847;})});}_0x19d47d=_[_0xcef7('0x42')]({},_0x19d47d,_0x110bb2[_0xcef7('0x4b')]);return _0x51a255[_0xcef7('0x7b')](_0x19d47d);}})[_0xcef7('0x26')](function(_0xe5a7ef){if(_0xe5a7ef){_0xe17f08=_0xe5a7ef[_0xcef7('0x39')];if(!_0x110bb2['query'][_0xcef7('0x3a')]('nolimit')){_0x19d47d[_0xcef7('0x3c')]=qs[_0xcef7('0x3c')](_0x110bb2[_0xcef7('0x32')][_0xcef7('0x3c')]);_0x19d47d[_0xcef7('0x22')]=qs[_0xcef7('0x22')](_0x110bb2[_0xcef7('0x32')]['offset']);}return _0x51a255[_0xcef7('0x7b')](_0x19d47d);}})[_0xcef7('0x26')](function(_0x4e0d38){if(_0x4e0d38){return _0x4e0d38?{'count':_0xe17f08,'rows':_0x4e0d38}:null;}})[_0xcef7('0x26')](respondWithResult(_0x562d03,null))['catch'](handleError(_0x562d03,null));}; \ No newline at end of file +var _0x7d33=['length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','toLowerCase','Queue','Queues','addQueues','ValidationError','capitalize','ids','addAgents','Mail','Sms','Fax','each','Voice','online','interface','upsert','isNil','format','SIP/%s','voicePause','spread','emit','userTeam:save','removeAgents','voice','chat','mail','sms','openchannel','whatsapp','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','update','then','destroy','Teams','UserProfileResource','stack','name','index','map','Team','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x13f05b,_0x766818){var _0xb0d121=function(_0x3ff8f8){while(--_0x3ff8f8){_0x13f05b['push'](_0x13f05b['shift']());}};_0xb0d121(++_0x766818);}(_0x7d33,0xb7));var _0x37d3=function(_0x6cfbf7,_0x374cbb){_0x6cfbf7=_0x6cfbf7-0x0;var _0x407dd1=_0x7d33[_0x6cfbf7];return _0x407dd1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x37d3('0x0'));var zipdir=require(_0x37d3('0x1'));var jsonpatch=require(_0x37d3('0x2'));var rp=require(_0x37d3('0x3'));var moment=require(_0x37d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x37d3('0x5'));var util=require(_0x37d3('0x6'));var path=require(_0x37d3('0x7'));var sox=require(_0x37d3('0x8'));var csv=require(_0x37d3('0x9'));var ejs=require(_0x37d3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x37d3('0xb'));var crypto=require('crypto');var jsforce=require(_0x37d3('0xc'));var deskjs=require(_0x37d3('0xd'));var toCsv=require(_0x37d3('0x9'));var querystring=require('querystring');var Papa=require(_0x37d3('0xe'));var Redis=require(_0x37d3('0xf'));var authService=require(_0x37d3('0x10'));var qs=require(_0x37d3('0x11'));var as=require(_0x37d3('0x12'));var hardwareService=require(_0x37d3('0x13'));var logger=require(_0x37d3('0x14'))('api');var utils=require(_0x37d3('0x15'));var config=require(_0x37d3('0x16'));var db=require(_0x37d3('0x17'))['db'];config[_0x37d3('0x18')]=_[_0x37d3('0x19')](config[_0x37d3('0x18')],{'host':_0x37d3('0x1a'),'port':0x18eb});var socket=require(_0x37d3('0x1b'))(new Redis(config[_0x37d3('0x18')]));require(_0x37d3('0x1c'))[_0x37d3('0x1d')](socket);function respondWithStatusCode(_0x215a5e,_0x15a270){_0x15a270=_0x15a270||0xcc;return function(_0x51a63b){if(_0x51a63b){return _0x215a5e[_0x37d3('0x1e')](_0x15a270);}return _0x215a5e['status'](_0x15a270)[_0x37d3('0x1f')]();};}function respondWithResult(_0x1fb67f,_0x4f5fdd){_0x4f5fdd=_0x4f5fdd||0xc8;return function(_0x2473a6){if(_0x2473a6){return _0x1fb67f[_0x37d3('0x20')](_0x4f5fdd)[_0x37d3('0x21')](_0x2473a6);}};}function respondWithFilteredResult(_0x5d36bb,_0x1f30d9){return function(_0x48b1eb){if(_0x48b1eb){var _0x42396f=_0x48b1eb['count'],_0x64c004=_0x1f30d9[_0x37d3('0x22')],_0x2a0871=_0x1f30d9[_0x37d3('0x22')]+_0x1f30d9[_0x37d3('0x23')],_0x2d5aae;if(_0x2a0871>=_0x42396f){_0x2a0871=_0x42396f;_0x2d5aae=0xc8;}else{_0x2d5aae=0xce;}_0x5d36bb['status'](_0x2d5aae);return _0x5d36bb[_0x37d3('0x24')](_0x37d3('0x25'),_0x64c004+'-'+_0x2a0871+'/'+_0x42396f)[_0x37d3('0x21')](_0x48b1eb);}return null;};}function patchUpdates(_0x4ec292){return function(_0x59e0dc){try{jsonpatch[_0x37d3('0x26')](_0x59e0dc,_0x4ec292,!![]);}catch(_0x1a5e0f){return BPromise['reject'](_0x1a5e0f);}return _0x59e0dc['save']();};}function saveUpdates(_0x1469e5,_0x4f80f3){return function(_0x2a83e7){if(_0x2a83e7){return _0x2a83e7[_0x37d3('0x27')](_0x1469e5)[_0x37d3('0x28')](function(_0x13766f){return _0x13766f;});}return null;};}function removeEntity(_0x22d856,_0x3f24c0){return function(_0x46ee7f){if(_0x46ee7f){return _0x46ee7f[_0x37d3('0x29')]()[_0x37d3('0x28')](function(){var _0x148671=_0x46ee7f['get']({'plain':!![]});var _0x3f1b6f=_0x37d3('0x2a');return db[_0x37d3('0x2b')][_0x37d3('0x29')]({'where':{'type':_0x3f1b6f,'resourceId':_0x148671['id']}})['then'](function(){return _0x46ee7f;});})[_0x37d3('0x28')](function(){_0x22d856[_0x37d3('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55c301,_0x435571){return function(_0x5a48fa){if(!_0x5a48fa){_0x55c301[_0x37d3('0x1e')](0x194);}return _0x5a48fa;};}function handleError(_0xe82461,_0x4ec619){_0x4ec619=_0x4ec619||0x1f4;return function(_0x43e21d){logger['error'](_0x43e21d[_0x37d3('0x2c')]);if(_0x43e21d[_0x37d3('0x2d')]){delete _0x43e21d[_0x37d3('0x2d')];}_0xe82461['status'](_0x4ec619)['send'](_0x43e21d);};}exports[_0x37d3('0x2e')]=function(_0x339742,_0x276582){var _0x210ece={},_0x488e5d={},_0xaf8145={'count':0x0,'rows':[]};var _0x4c19d8=_[_0x37d3('0x2f')](db[_0x37d3('0x30')]['rawAttributes'],function(_0x4dc682){return{'name':_0x4dc682[_0x37d3('0x31')],'type':_0x4dc682[_0x37d3('0x32')]['key']};});_0x488e5d[_0x37d3('0x33')]=_[_0x37d3('0x2f')](_0x4c19d8,_0x37d3('0x2d'));_0x488e5d[_0x37d3('0x34')]=_[_0x37d3('0x35')](_0x339742[_0x37d3('0x34')]);_0x488e5d[_0x37d3('0x36')]=_[_0x37d3('0x37')](_0x488e5d[_0x37d3('0x33')],_0x488e5d[_0x37d3('0x34')]);_0x210ece[_0x37d3('0x38')]=_[_0x37d3('0x37')](_0x488e5d['model'],qs[_0x37d3('0x39')](_0x339742[_0x37d3('0x34')]['fields']));_0x210ece[_0x37d3('0x38')]=_0x210ece['attributes']['length']?_0x210ece[_0x37d3('0x38')]:_0x488e5d[_0x37d3('0x33')];if(!_0x339742[_0x37d3('0x34')][_0x37d3('0x3a')](_0x37d3('0x3b'))){_0x210ece['limit']=qs[_0x37d3('0x23')](_0x339742[_0x37d3('0x34')][_0x37d3('0x23')]);_0x210ece[_0x37d3('0x22')]=qs['offset'](_0x339742['query']['offset']);}_0x210ece[_0x37d3('0x3c')]=qs[_0x37d3('0x3d')](_0x339742[_0x37d3('0x34')]['sort']);_0x210ece['where']=qs['filters'](_[_0x37d3('0x3e')](_0x339742['query'],_0x488e5d[_0x37d3('0x36')]),_0x4c19d8);if(_0x339742[_0x37d3('0x34')][_0x37d3('0x3f')]){_0x210ece[_0x37d3('0x40')]=_[_0x37d3('0x41')](_0x210ece['where'],{'$or':_[_0x37d3('0x2f')](_0x4c19d8,function(_0x115374){if(_0x115374[_0x37d3('0x32')]!==_0x37d3('0x42')){var _0x4c8fc9={};_0x4c8fc9[_0x115374[_0x37d3('0x2d')]]={'$like':'%'+_0x339742[_0x37d3('0x34')][_0x37d3('0x3f')]+'%'};return _0x4c8fc9;}})});}_0x210ece=_[_0x37d3('0x41')]({},_0x210ece,_0x339742[_0x37d3('0x43')]);var _0x4c2078={'where':_0x210ece[_0x37d3('0x40')]};return db[_0x37d3('0x30')][_0x37d3('0x44')](_0x4c2078)[_0x37d3('0x28')](function(_0x1b1cd3){_0xaf8145[_0x37d3('0x44')]=_0x1b1cd3;if(_0x339742[_0x37d3('0x34')][_0x37d3('0x45')]){_0x210ece[_0x37d3('0x46')]=[{'all':!![]}];}return db[_0x37d3('0x30')][_0x37d3('0x47')](_0x210ece);})[_0x37d3('0x28')](function(_0x4b0a1a){_0xaf8145[_0x37d3('0x48')]=_0x4b0a1a;return _0xaf8145;})['then'](respondWithFilteredResult(_0x276582,_0x210ece))[_0x37d3('0x49')](handleError(_0x276582,null));};exports[_0x37d3('0x4a')]=function(_0x3a9c37,_0x56c758){var _0x4586b8={'raw':![],'where':{'id':_0x3a9c37[_0x37d3('0x4b')]['id']}},_0x35b26f={};_0x35b26f[_0x37d3('0x33')]=_[_0x37d3('0x35')](db['Team'][_0x37d3('0x4c')]);_0x35b26f[_0x37d3('0x34')]=_[_0x37d3('0x35')](_0x3a9c37[_0x37d3('0x34')]);_0x35b26f[_0x37d3('0x36')]=_[_0x37d3('0x37')](_0x35b26f[_0x37d3('0x33')],_0x35b26f[_0x37d3('0x34')]);_0x4586b8[_0x37d3('0x38')]=_[_0x37d3('0x37')](_0x35b26f['model'],qs[_0x37d3('0x39')](_0x3a9c37['query'][_0x37d3('0x39')]));_0x4586b8[_0x37d3('0x38')]=_0x4586b8[_0x37d3('0x38')][_0x37d3('0x4d')]?_0x4586b8[_0x37d3('0x38')]:_0x35b26f[_0x37d3('0x33')];if(_0x3a9c37[_0x37d3('0x34')][_0x37d3('0x45')]){_0x4586b8[_0x37d3('0x46')]=[{'all':!![]}];}_0x4586b8=_[_0x37d3('0x41')]({},_0x4586b8,_0x3a9c37['options']);return db[_0x37d3('0x30')]['find'](_0x4586b8)[_0x37d3('0x28')](handleEntityNotFound(_0x56c758,null))[_0x37d3('0x28')](respondWithResult(_0x56c758,null))[_0x37d3('0x49')](handleError(_0x56c758,null));};exports[_0x37d3('0x4e')]=function(_0x216e10,_0x12c960){return db[_0x37d3('0x30')][_0x37d3('0x4e')](_0x216e10[_0x37d3('0x4f')],{})['then'](function(_0x2fc89d){var _0x182061=_0x216e10[_0x37d3('0x50')][_0x37d3('0x51')]({'plain':!![]});if(!_0x182061)throw new Error(_0x37d3('0x52'));if(_0x182061[_0x37d3('0x53')]===_0x37d3('0x50')){var _0x12866b=_0x2fc89d[_0x37d3('0x51')]({'plain':!![]});var _0x26e079=_0x37d3('0x2a');return db[_0x37d3('0x54')][_0x37d3('0x55')]({'where':{'name':_0x26e079,'userProfileId':_0x182061[_0x37d3('0x56')]},'raw':!![]})[_0x37d3('0x28')](function(_0x461932){if(_0x461932&&_0x461932[_0x37d3('0x57')]===0x0){return db[_0x37d3('0x2b')][_0x37d3('0x4e')]({'name':_0x12866b[_0x37d3('0x2d')],'resourceId':_0x12866b['id'],'type':_0x461932[_0x37d3('0x2d')],'sectionId':_0x461932['id']},{})[_0x37d3('0x28')](function(){return _0x2fc89d;});}else{return _0x2fc89d;}})[_0x37d3('0x49')](function(_0x4e3f65){logger[_0x37d3('0x58')](_0x37d3('0x59'),_0x4e3f65);throw _0x4e3f65;});}return _0x2fc89d;})[_0x37d3('0x28')](respondWithResult(_0x12c960,0xc9))[_0x37d3('0x49')](handleError(_0x12c960,null));};exports[_0x37d3('0x27')]=function(_0x9ade8,_0x3e5c64){if(_0x9ade8[_0x37d3('0x4f')]['id']){delete _0x9ade8[_0x37d3('0x4f')]['id'];}return db['Team'][_0x37d3('0x55')]({'where':{'id':_0x9ade8[_0x37d3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e5c64,null))[_0x37d3('0x28')](saveUpdates(_0x9ade8[_0x37d3('0x4f')],null))[_0x37d3('0x28')](respondWithResult(_0x3e5c64,null))[_0x37d3('0x49')](handleError(_0x3e5c64,null));};exports[_0x37d3('0x29')]=function(_0x2718d4,_0x9dc8d5){return db[_0x37d3('0x30')][_0x37d3('0x55')]({'where':{'id':_0x2718d4[_0x37d3('0x4b')]['id']}})[_0x37d3('0x28')](handleEntityNotFound(_0x9dc8d5,null))['then'](removeEntity(_0x9dc8d5,null))[_0x37d3('0x49')](handleError(_0x9dc8d5,null));};exports['getQueues']=function(_0x3361ec,_0x1f9856,_0xc47e3e){return db['Team'][_0x37d3('0x5a')]({'where':{'id':_0x3361ec['params']['id']}})['then'](handleEntityNotFound(_0x1f9856,null))[_0x37d3('0x28')](function(_0x5a3b21){if(!_0x3361ec[_0x37d3('0x34')][_0x37d3('0x5b')]||!utils[_0x37d3('0x5c')](_0x3361ec[_0x37d3('0x34')][_0x37d3('0x5b')])){throw new db[(_0x37d3('0x5d'))]['ValidationError'](_0x37d3('0x5e'));}var _0x9c0ff7={};var _0x2f9593={};_0x2f9593[_0x37d3('0x33')]=_[_0x37d3('0x35')](db[_['capitalize'](_0x3361ec[_0x37d3('0x34')]['channel'][_0x37d3('0x5f')]())+_0x37d3('0x60')][_0x37d3('0x4c')]);_0x2f9593[_0x37d3('0x34')]=_[_0x37d3('0x35')](_0x3361ec[_0x37d3('0x34')]);_0x2f9593['filters']=_[_0x37d3('0x37')](_0x2f9593[_0x37d3('0x33')],_0x2f9593['query']);_0x9c0ff7['attributes']=_['intersection'](_0x2f9593[_0x37d3('0x33')],qs[_0x37d3('0x39')](_0x3361ec[_0x37d3('0x34')]['fields']));_0x9c0ff7['attributes']=_0x9c0ff7[_0x37d3('0x38')][_0x37d3('0x4d')]?_0x9c0ff7[_0x37d3('0x38')]:_0x2f9593[_0x37d3('0x33')];_0x9c0ff7[_0x37d3('0x23')]=qs[_0x37d3('0x23')](_0x3361ec['query'][_0x37d3('0x23')]);_0x9c0ff7[_0x37d3('0x22')]=qs[_0x37d3('0x22')](_0x3361ec['query']['offset']);_0x9c0ff7[_0x37d3('0x3c')]=qs['sort'](_0x3361ec['query'][_0x37d3('0x3d')]);_0x9c0ff7[_0x37d3('0x40')]=qs['filters'](_[_0x37d3('0x3e')](_0x3361ec[_0x37d3('0x34')],_0x2f9593[_0x37d3('0x36')]));_0x9c0ff7=_[_0x37d3('0x41')]({},_0x9c0ff7,_0x3361ec[_0x37d3('0x43')]);return _0x5a3b21['get'+_['capitalize'](_0x3361ec[_0x37d3('0x34')][_0x37d3('0x5b')][_0x37d3('0x5f')]())+_0x37d3('0x61')](_0x9c0ff7);})[_0x37d3('0x28')](respondWithResult(_0x1f9856,null))[_0x37d3('0x49')](handleError(_0x1f9856,null));};exports[_0x37d3('0x62')]=function(_0x1c5c6a,_0x4fd134,_0x141593){return db[_0x37d3('0x30')][_0x37d3('0x5a')]({'where':{'id':_0x1c5c6a[_0x37d3('0x4b')]['id']}})[_0x37d3('0x28')](function(_0xbe3da4){if(_0xbe3da4){if(!_0x1c5c6a[_0x37d3('0x4f')]['channel']||!utils['isValidChannel'](_0x1c5c6a[_0x37d3('0x4f')][_0x37d3('0x5b')])){throw new db['Sequelize'][(_0x37d3('0x63'))](_0x37d3('0x5e'));}return _0xbe3da4['add'+_[_0x37d3('0x64')](_0x1c5c6a[_0x37d3('0x4f')][_0x37d3('0x5b')][_0x37d3('0x5f')]())+_0x37d3('0x61')](_0x1c5c6a[_0x37d3('0x4f')][_0x37d3('0x65')]);}return null;})[_0x37d3('0x28')](handleEntityNotFound(_0x4fd134,null))[_0x37d3('0x28')](respondWithStatusCode(_0x4fd134,null))[_0x37d3('0x49')](handleError(_0x4fd134,null));};exports['removeQueues']=function(_0x1d95de,_0xbe55d4,_0x3c8eda){return db[_0x37d3('0x30')][_0x37d3('0x5a')]({'where':{'id':_0x1d95de['params']['id']}})[_0x37d3('0x28')](function(_0x3459f2){if(_0x3459f2){if(!_0x1d95de[_0x37d3('0x34')][_0x37d3('0x5b')]||!utils['isValidChannel'](_0x1d95de['query'][_0x37d3('0x5b')])){throw new db[(_0x37d3('0x5d'))][(_0x37d3('0x63'))](_0x37d3('0x5e'));}return _0x3459f2['remove'+_[_0x37d3('0x64')](_0x1d95de[_0x37d3('0x34')][_0x37d3('0x5b')][_0x37d3('0x5f')]())+'Queues'](_0x1d95de[_0x37d3('0x34')][_0x37d3('0x65')]);}return null;})[_0x37d3('0x28')](handleEntityNotFound(_0xbe55d4,null))[_0x37d3('0x28')](respondWithStatusCode(_0xbe55d4,null))[_0x37d3('0x49')](handleError(_0xbe55d4,null));};exports[_0x37d3('0x66')]=function(_0x277827,_0x5c42dc,_0x2a60b7){return db[_0x37d3('0x30')][_0x37d3('0x55')]({'where':{'id':_0x277827[_0x37d3('0x4b')]['id']}})[_0x37d3('0x28')](handleEntityNotFound(_0x5c42dc,null))[_0x37d3('0x28')](function(_0x3b8614){if(_0x3b8614){var _0x1e5069=['Voice','Chat',_0x37d3('0x67'),_0x37d3('0x68'),_0x37d3('0x69'),'Openchannel','Whatsapp'];return BPromise['each'](_0x1e5069,function(_0x3e033a){return _0x3b8614['get'+_0x3e033a+_0x37d3('0x61')]({'attributes':['id','name']})[_0x37d3('0x28')](function(_0xa3bbce){return BPromise[_0x37d3('0x6a')](_0xa3bbce,function(_0x173555){return _0x173555[_0x37d3('0x66')](_0x277827[_0x37d3('0x4f')][_0x37d3('0x65')])[_0x37d3('0x28')](function(){if(_0x3e033a===_0x37d3('0x6b')){return db['User'][_0x37d3('0x47')]({'where':{'id':_0x277827[_0x37d3('0x4f')]['ids']},'attributes':['id',_0x37d3('0x2d'),_0x37d3('0x6c'),'voicePause',_0x37d3('0x6d')],'raw':!![]})[_0x37d3('0x28')](function(_0xeed79c){return BPromise['each'](_[_0x37d3('0x3f')](_0xeed79c,{'online':0x1}),function(_0x41e04b){return db['UserVoiceQueueRt'][_0x37d3('0x6e')]({'membername':_0x41e04b[_0x37d3('0x2d')],'UserId':_0x41e04b['id'],'queue_name':_0x173555['name'],'VoiceQueueId':_0x173555['id'],'interface':_[_0x37d3('0x6f')](_0x41e04b[_0x37d3('0x6d')])?util[_0x37d3('0x70')](_0x37d3('0x71'),_0x41e04b[_0x37d3('0x2d')]):_0x41e04b[_0x37d3('0x6d')],'paused':_0x41e04b[_0x37d3('0x72')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x3b8614;});})[_0x37d3('0x28')](function(){return _0x3b8614;});}})[_0x37d3('0x28')](function(_0x39ecf7){if(_0x39ecf7){return _0x39ecf7[_0x37d3('0x66')](_0x277827['body'][_0x37d3('0x65')],_['omit'](_0x277827['body'],[_0x37d3('0x65'),'id'])||{})[_0x37d3('0x73')](function(_0x5d4c4f){for(var _0x3c81e2=0x0;_0x3c81e2<_0x277827[_0x37d3('0x4f')]['ids'][_0x37d3('0x4d')];_0x3c81e2+=0x1){socket[_0x37d3('0x74')](_0x37d3('0x75'),{'UserId':_0x277827[_0x37d3('0x4f')][_0x37d3('0x65')][_0x3c81e2],'TeamId':_0x277827['params']['id']});}return _0x5d4c4f;});}})['then'](respondWithResult(_0x5c42dc,null))['catch'](handleError(_0x5c42dc,null));};exports[_0x37d3('0x76')]=function(_0x1c0c39,_0x26af9b,_0x4b1e96){return db[_0x37d3('0x30')][_0x37d3('0x55')]({'where':{'id':_0x1c0c39[_0x37d3('0x4b')]['id']}})[_0x37d3('0x28')](handleEntityNotFound(_0x26af9b,null))[_0x37d3('0x28')](function(_0x491472){if(_0x491472){return BPromise['each']([_0x37d3('0x77'),_0x37d3('0x78'),_0x37d3('0x79'),_0x37d3('0x7a'),'fax',_0x37d3('0x7b'),_0x37d3('0x7c')],function(_0x57e2dd){return _0x491472[_0x37d3('0x51')+_[_0x37d3('0x64')](_0x57e2dd)+_0x37d3('0x61')]({'attributes':['id',_0x37d3('0x2d')]})[_0x37d3('0x28')](function(_0x26a001){return BPromise[_0x37d3('0x6a')](_0x26a001,function(_0x301c64){return _0x301c64[_0x37d3('0x76')](_0x1c0c39['query'][_0x37d3('0x65')])[_0x37d3('0x28')](function(){if(_0x57e2dd===_0x37d3('0x77')){return db[_0x37d3('0x7d')]['destroy']({'where':{'VoiceQueueId':_0x301c64['id'],'UserId':_0x1c0c39['query'][_0x37d3('0x65')]}});}});});})[_0x37d3('0x28')](function(){return _0x491472;});})[_0x37d3('0x28')](function(){return _0x491472;});}})['then'](function(_0x2867e0){if(_0x2867e0){return _0x2867e0[_0x37d3('0x76')](_0x1c0c39['query']['ids'])[_0x37d3('0x28')](function(){if(_[_0x37d3('0x7e')](_0x1c0c39[_0x37d3('0x34')]['ids'])){for(var _0x60bf19=0x0;_0x60bf19<_0x1c0c39[_0x37d3('0x34')]['ids'][_0x37d3('0x4d')];_0x60bf19+=0x1){socket[_0x37d3('0x74')](_0x37d3('0x7f'),{'UserId':Number(_0x1c0c39[_0x37d3('0x34')][_0x37d3('0x65')][_0x60bf19]),'TeamId':Number(_0x1c0c39[_0x37d3('0x4b')]['id'])});}}else{socket[_0x37d3('0x74')](_0x37d3('0x7f'),{'UserId':Number(_0x1c0c39[_0x37d3('0x34')]['ids']),'TeamId':Number(_0x1c0c39[_0x37d3('0x4b')]['id'])});}});}})[_0x37d3('0x28')](respondWithStatusCode(_0x26af9b,null))[_0x37d3('0x49')](handleError(_0x26af9b,null));};exports[_0x37d3('0x80')]=function(_0x5c97b4,_0x10279d,_0x122ebc){var _0x3d13df={};var _0x5dcc22={};var _0x8ac5b;var _0x3af2a0;return db[_0x37d3('0x30')][_0x37d3('0x5a')]({'where':{'id':_0x5c97b4[_0x37d3('0x4b')]['id']}})[_0x37d3('0x28')](handleEntityNotFound(_0x10279d,null))['then'](function(_0x22d3e5){if(_0x22d3e5){_0x8ac5b=_0x22d3e5;_0x5dcc22[_0x37d3('0x33')]=_[_0x37d3('0x35')](db[_0x37d3('0x81')]['rawAttributes']);_0x5dcc22[_0x37d3('0x34')]=_[_0x37d3('0x35')](_0x5c97b4['query']);_0x5dcc22[_0x37d3('0x36')]=_[_0x37d3('0x37')](_0x5dcc22[_0x37d3('0x33')],_0x5dcc22['query']);_0x3d13df[_0x37d3('0x38')]=_['intersection'](_0x5dcc22[_0x37d3('0x33')],qs['fields'](_0x5c97b4[_0x37d3('0x34')][_0x37d3('0x39')]));_0x3d13df[_0x37d3('0x38')]=_0x3d13df[_0x37d3('0x38')][_0x37d3('0x4d')]?_0x3d13df[_0x37d3('0x38')]:_0x5dcc22['model'];_0x3d13df[_0x37d3('0x3c')]=qs['sort'](_0x5c97b4[_0x37d3('0x34')][_0x37d3('0x3d')]);_0x3d13df['where']=qs[_0x37d3('0x36')](_[_0x37d3('0x3e')](_0x5c97b4['query'],_0x5dcc22['filters']));if(_0x5c97b4[_0x37d3('0x34')][_0x37d3('0x3f')]){_0x3d13df[_0x37d3('0x40')]=_[_0x37d3('0x41')](_0x3d13df[_0x37d3('0x40')],{'$or':_['map'](_0x3d13df[_0x37d3('0x38')],function(_0x421e9b){var _0x556507={};_0x556507[_0x421e9b]={'$like':'%'+_0x5c97b4[_0x37d3('0x34')][_0x37d3('0x3f')]+'%'};return _0x556507;})});}_0x3d13df=_[_0x37d3('0x41')]({},_0x3d13df,_0x5c97b4[_0x37d3('0x43')]);return _0x8ac5b[_0x37d3('0x80')](_0x3d13df);}})[_0x37d3('0x28')](function(_0x1ded92){if(_0x1ded92){_0x3af2a0=_0x1ded92[_0x37d3('0x4d')];if(!_0x5c97b4[_0x37d3('0x34')][_0x37d3('0x3a')](_0x37d3('0x3b'))){_0x3d13df[_0x37d3('0x23')]=qs[_0x37d3('0x23')](_0x5c97b4[_0x37d3('0x34')][_0x37d3('0x23')]);_0x3d13df['offset']=qs[_0x37d3('0x22')](_0x5c97b4[_0x37d3('0x34')][_0x37d3('0x22')]);}return _0x8ac5b[_0x37d3('0x80')](_0x3d13df);}})[_0x37d3('0x28')](function(_0x4959c1){if(_0x4959c1){return _0x4959c1?{'count':_0x3af2a0,'rows':_0x4959c1}:null;}})[_0x37d3('0x28')](respondWithResult(_0x10279d,null))['catch'](handleError(_0x10279d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ca9858d..2c1bdf3 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 _0xc201=['hasOwnProperty','events','../../mysqldb','Team','setMaxListeners','save','remove','emit'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xc201,0x1c9));var _0x1c20=function(_0x24a89b,_0x2bdf8a){_0x24a89b=_0x24a89b-0x0;var _0x3d0e9b=_0xc201[_0x24a89b];return _0x3d0e9b;};'use strict';var EventEmitter=require(_0x1c20('0x0'));var Team=require(_0x1c20('0x1'))['db'][_0x1c20('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x1c20('0x3')](0x0);var events={'afterCreate':_0x1c20('0x4'),'afterUpdate':'update','afterDestroy':_0x1c20('0x5')};function emitEvent(_0x284052){return function(_0x3e0f7a,_0x56d1af,_0x210d54){TeamEvents[_0x1c20('0x6')](_0x284052+':'+_0x3e0f7a['id'],_0x3e0f7a);TeamEvents[_0x1c20('0x6')](_0x284052,_0x3e0f7a);_0x210d54(null);};}for(var e in events){if(events[_0x1c20('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xff51=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','update'];(function(_0x51737e,_0x311916){var _0x2b249b=function(_0x32234e){while(--_0x32234e){_0x51737e['push'](_0x51737e['shift']());}};_0x2b249b(++_0x311916);}(_0xff51,0x1ac));var _0x1ff5=function(_0x4d579b,_0x2327f3){_0x4d579b=_0x4d579b-0x0;var _0x288145=_0xff51[_0x4d579b];return _0x288145;};'use strict';var EventEmitter=require(_0x1ff5('0x0'));var Team=require(_0x1ff5('0x1'))['db'][_0x1ff5('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ff5('0x3'),'afterDestroy':_0x1ff5('0x4')};function emitEvent(_0x221f0d){return function(_0x47bee5,_0x31f550,_0x353957){TeamEvents[_0x1ff5('0x5')](_0x221f0d+':'+_0x47bee5['id'],_0x47bee5);TeamEvents[_0x1ff5('0x5')](_0x221f0d,_0x47bee5);_0x353957(null);};}for(var e in events){if(events[_0x1ff5('0x6')](e)){var event=events[e];Team[_0x1ff5('0x7')](e,emitEvent(event));}}module[_0x1ff5('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index f42b4de..e70ec36 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 _0xee0e=['moment','bluebird','rimraf','exports','Team','teams','lodash','../../config/logger','api'];(function(_0x16c2b1,_0x36a70c){var _0x199ac4=function(_0x2f1802){while(--_0x2f1802){_0x16c2b1['push'](_0x16c2b1['shift']());}};_0x199ac4(++_0x36a70c);}(_0xee0e,0x8d));var _0xeee0=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0xee0e[_0x419e17];return _0x1f2044;};'use strict';var _=require(_0xeee0('0x0'));var util=require('util');var logger=require(_0xeee0('0x1'))(_0xeee0('0x2'));var moment=require(_0xeee0('0x3'));var BPromise=require(_0xeee0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeee0('0x5'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0xeee0('0x6')]=function(_0x3be0d4,_0x59076a){return _0x3be0d4['define'](_0xeee0('0x7'),attributes,{'tableName':_0xeee0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd80f=['rimraf','../../config/environment','exports','define','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x423f2b,_0x5972c9){var _0x4ee4a3=function(_0x32fcf2){while(--_0x32fcf2){_0x423f2b['push'](_0x423f2b['shift']());}};_0x4ee4a3(++_0x5972c9);}(_0xd80f,0x18e));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd80('0x0'));var util=require(_0xfd80('0x1'));var logger=require(_0xfd80('0x2'))(_0xfd80('0x3'));var moment=require(_0xfd80('0x4'));var BPromise=require(_0xfd80('0x5'));var rp=require(_0xfd80('0x6'));var fs=require('fs');var path=require(_0xfd80('0x7'));var rimraf=require(_0xfd80('0x8'));var config=require(_0xfd80('0x9'));var attributes=require('./team.attributes');module[_0xfd80('0xa')]=function(_0xc5ef3b,_0x5b0488){return _0xc5ef3b[_0xfd80('0xb')](_0xfd80('0xc'),attributes,{'tableName':_0xfd80('0xd'),'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 ecf92c1..6ffc118 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 _0x5774=['request','then','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./team.socket','register'];(function(_0x490f1a,_0x4a69ad){var _0x388e32=function(_0x18f37a){while(--_0x18f37a){_0x490f1a['push'](_0x490f1a['shift']());}};_0x388e32(++_0x4a69ad);}(_0x5774,0x15b));var _0x4577=function(_0x68161e,_0x6efab6){_0x68161e=_0x68161e-0x0;var _0x5965b3=_0x5774[_0x68161e];return _0x5965b3;};'use strict';var _=require(_0x4577('0x0'));var util=require('util');var moment=require(_0x4577('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4577('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4577('0x3'));var logger=require(_0x4577('0x4'))(_0x4577('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4577('0x6')][_0x4577('0x7')]({'port':0x232a});config[_0x4577('0x8')]=_[_0x4577('0x9')](config[_0x4577('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4577('0xa'))(new Redis(config[_0x4577('0x8')]));require(_0x4577('0xb'))[_0x4577('0xc')](socket);function respondWithRpcPromise(_0x355845,_0x59f94b,_0x38f2ce){return new BPromise(function(_0x33b7e0,_0x50322a){return client[_0x4577('0xd')](_0x355845,_0x38f2ce)[_0x4577('0xe')](function(_0xd51a5a){logger['info'](_0x4577('0xf'),_0x59f94b,'request\x20sent');logger['debug'](_0x4577('0x10'),_0x59f94b,'request\x20sent',JSON[_0x4577('0x11')](_0xd51a5a));if(_0xd51a5a['error']){if(_0xd51a5a[_0x4577('0x12')][_0x4577('0x13')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x59f94b,_0xd51a5a[_0x4577('0x12')][_0x4577('0x14')]);return _0x50322a(_0xd51a5a[_0x4577('0x12')]['message']);}logger[_0x4577('0x12')](_0x4577('0xf'),_0x59f94b,_0xd51a5a[_0x4577('0x12')][_0x4577('0x14')]);return _0x33b7e0(_0xd51a5a[_0x4577('0x12')]['message']);}else{logger['info'](_0x4577('0xf'),_0x59f94b,_0x4577('0x15'));_0x33b7e0(_0xd51a5a[_0x4577('0x16')]['message']);}})[_0x4577('0x17')](function(_0x19a7a4){logger[_0x4577('0x12')](_0x4577('0xf'),_0x59f94b,_0x19a7a4);_0x50322a(_0x19a7a4);});});} \ No newline at end of file +var _0xe618=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x178895,_0x8e0000){var _0x14573e=function(_0x50f158){while(--_0x50f158){_0x178895['push'](_0x178895['shift']());}};_0x14573e(++_0x8e0000);}(_0xe618,0x17a));var _0x8e61=function(_0x3a2bc6,_0xb3d543){_0x3a2bc6=_0x3a2bc6-0x0;var _0x2781d8=_0xe618[_0x3a2bc6];return _0x2781d8;};'use strict';var _=require(_0x8e61('0x0'));var util=require('util');var moment=require(_0x8e61('0x1'));var BPromise=require(_0x8e61('0x2'));var rs=require(_0x8e61('0x3'));var fs=require('fs');var Redis=require(_0x8e61('0x4'));var db=require(_0x8e61('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e61('0x6'))('rpc');var config=require(_0x8e61('0x7'));var jayson=require(_0x8e61('0x8'));var client=jayson[_0x8e61('0x9')]['http']({'port':0x232a});config['redis']=_[_0x8e61('0xa')](config['redis'],{'host':_0x8e61('0xb'),'port':0x18eb});var socket=require(_0x8e61('0xc'))(new Redis(config[_0x8e61('0xd')]));require(_0x8e61('0xe'))[_0x8e61('0xf')](socket);function respondWithRpcPromise(_0x36fc01,_0x504df6,_0x28650c){return new BPromise(function(_0x1e5267,_0x2b7bce){return client[_0x8e61('0x10')](_0x36fc01,_0x28650c)[_0x8e61('0x11')](function(_0x5220ad){logger['info'](_0x8e61('0x12'),_0x504df6,_0x8e61('0x13'));logger[_0x8e61('0x14')](_0x8e61('0x15'),_0x504df6,_0x8e61('0x13'),JSON[_0x8e61('0x16')](_0x5220ad));if(_0x5220ad[_0x8e61('0x17')]){if(_0x5220ad[_0x8e61('0x17')]['code']===0x1f4){logger[_0x8e61('0x17')](_0x8e61('0x12'),_0x504df6,_0x5220ad[_0x8e61('0x17')][_0x8e61('0x18')]);return _0x2b7bce(_0x5220ad[_0x8e61('0x17')][_0x8e61('0x18')]);}logger[_0x8e61('0x17')](_0x8e61('0x12'),_0x504df6,_0x5220ad[_0x8e61('0x17')][_0x8e61('0x18')]);return _0x1e5267(_0x5220ad[_0x8e61('0x17')][_0x8e61('0x18')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x504df6,_0x8e61('0x13'));_0x1e5267(_0x5220ad[_0x8e61('0x19')][_0x8e61('0x18')]);}})[_0x8e61('0x1a')](function(_0x4ab08d){logger[_0x8e61('0x17')](_0x8e61('0x12'),_0x504df6,_0x4ab08d);_0x2b7bce(_0x4ab08d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 123564d..fe8d270 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 _0x110e=['length','team:','./team.events','save','update','emit'];(function(_0x29b387,_0x51bed3){var _0x14a19a=function(_0x3e9e45){while(--_0x3e9e45){_0x29b387['push'](_0x29b387['shift']());}};_0x14a19a(++_0x51bed3);}(_0x110e,0x68));var _0xe110=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x110e[_0x342baa];return _0x1208f3;};'use strict';var TeamEvents=require(_0xe110('0x0'));var events=[_0xe110('0x1'),'remove',_0xe110('0x2')];function createListener(_0x2a7c73,_0x2a4965){return function(_0x3bd783){_0x2a4965[_0xe110('0x3')](_0x2a7c73,_0x3bd783);};}function removeListener(_0x4d182f,_0x563977){return function(){TeamEvents['removeListener'](_0x4d182f,_0x563977);};}exports['register']=function(_0x37f938){for(var _0x553f49=0x0,_0x3dd83c=events[_0xe110('0x4')];_0x553f49<_0x3dd83c;_0x553f49++){var _0x2b69c5=events[_0x553f49];var _0x23c5ae=createListener(_0xe110('0x5')+_0x2b69c5,_0x37f938);TeamEvents['on'](_0x2b69c5,_0x23c5ae);}}; \ No newline at end of file +var _0xefce=['removeListener','register','team:','save','emit'];(function(_0x26ef8e,_0x4de112){var _0x1a2add=function(_0x5378b0){while(--_0x5378b0){_0x26ef8e['push'](_0x26ef8e['shift']());}};_0x1a2add(++_0x4de112);}(_0xefce,0x1e8));var _0xeefc=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0xefce[_0x3ee55a];return _0x581800;};'use strict';var TeamEvents=require('./team.events');var events=[_0xeefc('0x0'),'remove','update'];function createListener(_0x44f0fd,_0x374916){return function(_0x243bdc){_0x374916[_0xeefc('0x1')](_0x44f0fd,_0x243bdc);};}function removeListener(_0x1cb1a5,_0x145a9b){return function(){TeamEvents[_0xeefc('0x2')](_0x1cb1a5,_0x145a9b);};}exports[_0xeefc('0x3')]=function(_0x41ba7c){for(var _0x181dd7=0x0,_0x5a2635=events['length'];_0x181dd7<_0x5a2635;_0x181dd7++){var _0x377309=events[_0x181dd7];var _0xfb5a39=createListener(_0xeefc('0x4')+_0x377309,_0x41ba7c);TeamEvents['on'](_0x377309,_0xfb5a39);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0514bde..850feef 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 _0x7ac7=['create','put','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x3d52db,_0x505bcc){var _0x441ce8=function(_0x1f6e78){while(--_0x1f6e78){_0x3d52db['push'](_0x3d52db['shift']());}};_0x441ce8(++_0x505bcc);}(_0x7ac7,0x117));var _0x77ac=function(_0x2acd49,_0x298d0e){_0x2acd49=_0x2acd49-0x0;var _0x2b3dca=_0x7ac7[_0x2acd49];return _0x2b3dca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x77ac('0x0'));var timeout=require(_0x77ac('0x1'));var express=require(_0x77ac('0x2'));var router=express[_0x77ac('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x77ac('0x4'));var config=require(_0x77ac('0x5'));var controller=require('./template.controller');router[_0x77ac('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x77ac('0x6')](_0x77ac('0x7'),auth[_0x77ac('0x8')](),controller['show']);router['post']('/',auth[_0x77ac('0x8')](),controller[_0x77ac('0x9')]);router[_0x77ac('0xa')](_0x77ac('0x7'),auth[_0x77ac('0x8')](),controller['update']);router['delete'](_0x77ac('0x7'),auth[_0x77ac('0x8')](),controller['destroy']);module[_0x77ac('0xb')]=router; \ No newline at end of file +var _0x15d5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15d5,0x85));var _0x515d=function(_0x1d71a0,_0x7d60a3){_0x1d71a0=_0x1d71a0-0x0;var _0x3b2297=_0x15d5[_0x1d71a0];return _0x3b2297;};'use strict';var multer=require(_0x515d('0x0'));var util=require(_0x515d('0x1'));var path=require(_0x515d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x515d('0x3'));var interaction=require(_0x515d('0x4'));var config=require(_0x515d('0x5'));var controller=require(_0x515d('0x6'));router[_0x515d('0x7')]('/',auth[_0x515d('0x8')](),controller['index']);router[_0x515d('0x7')](_0x515d('0x9'),auth['isAuthenticated'](),controller[_0x515d('0xa')]);router[_0x515d('0xb')]('/',auth[_0x515d('0x8')](),controller[_0x515d('0xc')]);router['put'](_0x515d('0x9'),auth[_0x515d('0x8')](),controller[_0x515d('0xd')]);router[_0x515d('0xe')]('/:id',auth[_0x515d('0x8')](),controller[_0x515d('0xf')]);module[_0x515d('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e51ff10..e42b314 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 _0xe95c=['TEXT','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe95c,0x1f3));var _0xce95=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xe95c[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require('sequelize');module[_0xce95('0x0')]={'name':{'type':Sequelize[_0xce95('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xce95('0x2')]}}; \ No newline at end of file +var _0x2504=['STRING','TEXT','exports'];(function(_0x5c6b8b,_0x442952){var _0xdd7e46=function(_0x143157){while(--_0x143157){_0x5c6b8b['push'](_0x5c6b8b['shift']());}};_0xdd7e46(++_0x442952);}(_0x2504,0x1f1));var _0x4250=function(_0x3df3ac,_0x1d2b7d){_0x3df3ac=_0x3df3ac-0x0;var _0x454a5a=_0x2504[_0x3df3ac];return _0x454a5a;};'use strict';var Sequelize=require('sequelize');module[_0x4250('0x0')]={'name':{'type':Sequelize[_0x4250('0x1')]},'description':{'type':Sequelize[_0x4250('0x1')]},'html':{'type':Sequelize[_0x4250('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5a86f32..51d7039 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 _0x4f0b=['find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Templates','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','Template','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x476a0e,_0x37a2f8){var _0x28b7a8=function(_0xc4de6){while(--_0xc4de6){_0x476a0e['push'](_0x476a0e['shift']());}};_0x28b7a8(++_0x37a2f8);}(_0x4f0b,0xa9));var _0xb4f0=function(_0x42e0b4,_0x541b19){_0x42e0b4=_0x42e0b4-0x0;var _0x35ca34=_0x4f0b[_0x42e0b4];return _0x35ca34;};'use strict';var pdf=require(_0xb4f0('0x0'));var emlformat=require(_0xb4f0('0x1'));var rimraf=require(_0xb4f0('0x2'));var zipdir=require(_0xb4f0('0x3'));var jsonpatch=require(_0xb4f0('0x4'));var rp=require('request-promise');var moment=require(_0xb4f0('0x5'));var BPromise=require(_0xb4f0('0x6'));var Mustache=require(_0xb4f0('0x7'));var util=require(_0xb4f0('0x8'));var path=require(_0xb4f0('0x9'));var sox=require(_0xb4f0('0xa'));var csv=require('to-csv');var ejs=require(_0xb4f0('0xb'));var fs=require('fs');var _=require(_0xb4f0('0xc'));var squel=require(_0xb4f0('0xd'));var crypto=require(_0xb4f0('0xe'));var jsforce=require(_0xb4f0('0xf'));var deskjs=require(_0xb4f0('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb4f0('0x11'));var Papa=require(_0xb4f0('0x12'));var Redis=require(_0xb4f0('0x13'));var authService=require(_0xb4f0('0x14'));var qs=require(_0xb4f0('0x15'));var as=require(_0xb4f0('0x16'));var hardwareService=require(_0xb4f0('0x17'));var logger=require(_0xb4f0('0x18'))(_0xb4f0('0x19'));var utils=require('../../config/utils');var config=require(_0xb4f0('0x1a'));var db=require(_0xb4f0('0x1b'))['db'];function respondWithStatusCode(_0x16dc83,_0x31dcf5){_0x31dcf5=_0x31dcf5||0xcc;return function(_0x14e1cd){if(_0x14e1cd){return _0x16dc83[_0xb4f0('0x1c')](_0x31dcf5);}return _0x16dc83[_0xb4f0('0x1d')](_0x31dcf5)[_0xb4f0('0x1e')]();};}function respondWithResult(_0x3fd96b,_0x3b1c9f){_0x3b1c9f=_0x3b1c9f||0xc8;return function(_0x2bfd5a){if(_0x2bfd5a){return _0x3fd96b['status'](_0x3b1c9f)[_0xb4f0('0x1f')](_0x2bfd5a);}};}function respondWithFilteredResult(_0xe287ea,_0x2cf547){return function(_0x2433e8){if(_0x2433e8){var _0x2a8920=_0x2433e8[_0xb4f0('0x20')],_0x291651=_0x2cf547[_0xb4f0('0x21')],_0x2ed86e=_0x2cf547[_0xb4f0('0x21')]+_0x2cf547[_0xb4f0('0x22')],_0x18611a;if(_0x2ed86e>=_0x2a8920){_0x2ed86e=_0x2a8920;_0x18611a=0xc8;}else{_0x18611a=0xce;}_0xe287ea[_0xb4f0('0x1d')](_0x18611a);return _0xe287ea['set'](_0xb4f0('0x23'),_0x291651+'-'+_0x2ed86e+'/'+_0x2a8920)[_0xb4f0('0x1f')](_0x2433e8);}return null;};}function patchUpdates(_0x462db9){return function(_0x5274be){try{jsonpatch[_0xb4f0('0x24')](_0x5274be,_0x462db9,!![]);}catch(_0x4ce9ad){return BPromise[_0xb4f0('0x25')](_0x4ce9ad);}return _0x5274be[_0xb4f0('0x26')]();};}function saveUpdates(_0x4241e4,_0x33363f){return function(_0x1bff0d){if(_0x1bff0d){return _0x1bff0d[_0xb4f0('0x27')](_0x4241e4)[_0xb4f0('0x28')](function(_0x2ca944){return _0x2ca944;});}return null;};}function removeEntity(_0x26c348,_0x1fca8e){return function(_0x5f1fb4){if(_0x5f1fb4){return _0x5f1fb4[_0xb4f0('0x29')]()[_0xb4f0('0x28')](function(){var _0x498ccf=_0x5f1fb4[_0xb4f0('0x2a')]({'plain':!![]});var _0x1f060c=_0xb4f0('0x2b');return db['UserProfileResource'][_0xb4f0('0x29')]({'where':{'type':_0x1f060c,'resourceId':_0x498ccf['id']}})[_0xb4f0('0x28')](function(){return _0x5f1fb4;});})[_0xb4f0('0x28')](function(){_0x26c348[_0xb4f0('0x1d')](0xcc)[_0xb4f0('0x1e')]();});}};}function handleEntityNotFound(_0x20c164,_0x4890b8){return function(_0x45c5f2){if(!_0x45c5f2){_0x20c164[_0xb4f0('0x1c')](0x194);}return _0x45c5f2;};}function handleError(_0x1c11db,_0x55c8f2){_0x55c8f2=_0x55c8f2||0x1f4;return function(_0x215ba4){logger[_0xb4f0('0x2c')](_0x215ba4[_0xb4f0('0x2d')]);if(_0x215ba4[_0xb4f0('0x2e')]){delete _0x215ba4[_0xb4f0('0x2e')];}_0x1c11db['status'](_0x55c8f2)[_0xb4f0('0x2f')](_0x215ba4);};}exports[_0xb4f0('0x30')]=function(_0x471ee5,_0x4566ec){var _0x51c5d8={},_0x1d19ad={},_0x3f3ef0={'count':0x0,'rows':[]};var _0x6d6051=_[_0xb4f0('0x31')](db['Template'][_0xb4f0('0x32')],function(_0x18ee6f){return{'name':_0x18ee6f[_0xb4f0('0x33')],'type':_0x18ee6f[_0xb4f0('0x34')]['key']};});_0x1d19ad[_0xb4f0('0x35')]=_[_0xb4f0('0x31')](_0x6d6051,_0xb4f0('0x2e'));_0x1d19ad[_0xb4f0('0x36')]=_[_0xb4f0('0x37')](_0x471ee5[_0xb4f0('0x36')]);_0x1d19ad['filters']=_[_0xb4f0('0x38')](_0x1d19ad['model'],_0x1d19ad['query']);_0x51c5d8[_0xb4f0('0x39')]=_[_0xb4f0('0x38')](_0x1d19ad[_0xb4f0('0x35')],qs[_0xb4f0('0x3a')](_0x471ee5[_0xb4f0('0x36')][_0xb4f0('0x3a')]));_0x51c5d8['attributes']=_0x51c5d8[_0xb4f0('0x39')][_0xb4f0('0x3b')]?_0x51c5d8[_0xb4f0('0x39')]:_0x1d19ad['model'];if(!_0x471ee5[_0xb4f0('0x36')][_0xb4f0('0x3c')]('nolimit')){_0x51c5d8[_0xb4f0('0x22')]=qs['limit'](_0x471ee5[_0xb4f0('0x36')][_0xb4f0('0x22')]);_0x51c5d8['offset']=qs[_0xb4f0('0x21')](_0x471ee5[_0xb4f0('0x36')][_0xb4f0('0x21')]);}_0x51c5d8[_0xb4f0('0x3d')]=qs[_0xb4f0('0x3e')](_0x471ee5['query'][_0xb4f0('0x3e')]);_0x51c5d8[_0xb4f0('0x3f')]=qs['filters'](_['pick'](_0x471ee5[_0xb4f0('0x36')],_0x1d19ad[_0xb4f0('0x40')]),_0x6d6051);if(_0x471ee5[_0xb4f0('0x36')][_0xb4f0('0x41')]){_0x51c5d8[_0xb4f0('0x3f')]=_['merge'](_0x51c5d8[_0xb4f0('0x3f')],{'$or':_[_0xb4f0('0x31')](_0x6d6051,function(_0x5f0171){if(_0x5f0171[_0xb4f0('0x34')]!=='VIRTUAL'){var _0x382565={};_0x382565[_0x5f0171[_0xb4f0('0x2e')]]={'$like':'%'+_0x471ee5['query']['filter']+'%'};return _0x382565;}})});}_0x51c5d8=_[_0xb4f0('0x42')]({},_0x51c5d8,_0x471ee5[_0xb4f0('0x43')]);var _0x307960={'where':_0x51c5d8[_0xb4f0('0x3f')]};return db[_0xb4f0('0x44')][_0xb4f0('0x20')](_0x307960)['then'](function(_0x2f8e9e){_0x3f3ef0[_0xb4f0('0x20')]=_0x2f8e9e;if(_0x471ee5[_0xb4f0('0x36')][_0xb4f0('0x45')]){_0x51c5d8[_0xb4f0('0x46')]=[{'all':!![]}];}return db[_0xb4f0('0x44')][_0xb4f0('0x47')](_0x51c5d8);})['then'](function(_0xdc8571){_0x3f3ef0[_0xb4f0('0x48')]=_0xdc8571;return _0x3f3ef0;})[_0xb4f0('0x28')](respondWithFilteredResult(_0x4566ec,_0x51c5d8))[_0xb4f0('0x49')](handleError(_0x4566ec,null));};exports['show']=function(_0x4da36c,_0x80cb17){var _0xd11914={'raw':!![],'where':{'id':_0x4da36c[_0xb4f0('0x4a')]['id']}},_0x59c5ae={};_0x59c5ae['model']=_[_0xb4f0('0x37')](db[_0xb4f0('0x44')]['rawAttributes']);_0x59c5ae[_0xb4f0('0x36')]=_[_0xb4f0('0x37')](_0x4da36c['query']);_0x59c5ae[_0xb4f0('0x40')]=_[_0xb4f0('0x38')](_0x59c5ae[_0xb4f0('0x35')],_0x59c5ae[_0xb4f0('0x36')]);_0xd11914[_0xb4f0('0x39')]=_[_0xb4f0('0x38')](_0x59c5ae[_0xb4f0('0x35')],qs[_0xb4f0('0x3a')](_0x4da36c[_0xb4f0('0x36')][_0xb4f0('0x3a')]));_0xd11914[_0xb4f0('0x39')]=_0xd11914[_0xb4f0('0x39')]['length']?_0xd11914['attributes']:_0x59c5ae[_0xb4f0('0x35')];if(_0x4da36c[_0xb4f0('0x36')][_0xb4f0('0x45')]){_0xd11914[_0xb4f0('0x46')]=[{'all':!![]}];}_0xd11914=_['merge']({},_0xd11914,_0x4da36c['options']);return db[_0xb4f0('0x44')]['find'](_0xd11914)[_0xb4f0('0x28')](handleEntityNotFound(_0x80cb17,null))['then'](respondWithResult(_0x80cb17,null))[_0xb4f0('0x49')](handleError(_0x80cb17,null));};exports[_0xb4f0('0x4b')]=function(_0x1989fa,_0x156e3d){return db[_0xb4f0('0x44')][_0xb4f0('0x4b')](_0x1989fa[_0xb4f0('0x4c')],{})['then'](function(_0x1563e6){var _0x2955a5=_0x1989fa[_0xb4f0('0x4d')]['get']({'plain':!![]});if(!_0x2955a5)throw new Error(_0xb4f0('0x4e'));if(_0x2955a5['role']===_0xb4f0('0x4d')){var _0x2a7486=_0x1563e6[_0xb4f0('0x2a')]({'plain':!![]});var _0x55b022=_0xb4f0('0x2b');return db[_0xb4f0('0x4f')]['find']({'where':{'name':_0x55b022,'userProfileId':_0x2955a5[_0xb4f0('0x50')]},'raw':!![]})[_0xb4f0('0x28')](function(_0x11f274){if(_0x11f274&&_0x11f274[_0xb4f0('0x51')]===0x0){return db[_0xb4f0('0x52')][_0xb4f0('0x4b')]({'name':_0x2a7486[_0xb4f0('0x2e')],'resourceId':_0x2a7486['id'],'type':_0x11f274[_0xb4f0('0x2e')],'sectionId':_0x11f274['id']},{})[_0xb4f0('0x28')](function(){return _0x1563e6;});}else{return _0x1563e6;}})[_0xb4f0('0x49')](function(_0x4d98c1){logger[_0xb4f0('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d98c1);throw _0x4d98c1;});}return _0x1563e6;})[_0xb4f0('0x28')](respondWithResult(_0x156e3d,0xc9))[_0xb4f0('0x49')](handleError(_0x156e3d,null));};exports[_0xb4f0('0x27')]=function(_0x2958ec,_0x2ef884){if(_0x2958ec[_0xb4f0('0x4c')]['id']){delete _0x2958ec[_0xb4f0('0x4c')]['id'];}return db['Template'][_0xb4f0('0x53')]({'where':{'id':_0x2958ec[_0xb4f0('0x4a')]['id']}})[_0xb4f0('0x28')](handleEntityNotFound(_0x2ef884,null))['then'](saveUpdates(_0x2958ec[_0xb4f0('0x4c')],null))[_0xb4f0('0x28')](respondWithResult(_0x2ef884,null))[_0xb4f0('0x49')](handleError(_0x2ef884,null));};exports[_0xb4f0('0x29')]=function(_0x3a7216,_0x361dfa){return db['Template'][_0xb4f0('0x53')]({'where':{'id':_0x3a7216['params']['id']}})[_0xb4f0('0x28')](handleEntityNotFound(_0x361dfa,null))['then'](removeEntity(_0x361dfa,null))[_0xb4f0('0x49')](handleError(_0x361dfa,null));}; \ No newline at end of file +var _0x6af3=['type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','html-pdf','eml-format','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','sendStatus','status','end','json','offset','limit','Content-Range','save','then','destroy','get','Templates','UserProfileResource','stack','name','index','Template','rawAttributes'];(function(_0x530be0,_0x1a84c8){var _0x2ee1d3=function(_0x47ebe3){while(--_0x47ebe3){_0x530be0['push'](_0x530be0['shift']());}};_0x2ee1d3(++_0x1a84c8);}(_0x6af3,0x10f));var _0x36af=function(_0x51f01b,_0x28552f){_0x51f01b=_0x51f01b-0x0;var _0x494902=_0x6af3[_0x51f01b];return _0x494902;};'use strict';var pdf=require(_0x36af('0x0'));var emlformat=require(_0x36af('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x36af('0x2'));var jsonpatch=require(_0x36af('0x3'));var rp=require('request-promise');var moment=require(_0x36af('0x4'));var BPromise=require(_0x36af('0x5'));var Mustache=require(_0x36af('0x6'));var util=require(_0x36af('0x7'));var path=require(_0x36af('0x8'));var sox=require(_0x36af('0x9'));var csv=require(_0x36af('0xa'));var ejs=require(_0x36af('0xb'));var fs=require('fs');var _=require(_0x36af('0xc'));var squel=require(_0x36af('0xd'));var crypto=require(_0x36af('0xe'));var jsforce=require(_0x36af('0xf'));var deskjs=require(_0x36af('0x10'));var toCsv=require(_0x36af('0xa'));var querystring=require(_0x36af('0x11'));var Papa=require(_0x36af('0x12'));var Redis=require(_0x36af('0x13'));var authService=require(_0x36af('0x14'));var qs=require(_0x36af('0x15'));var as=require(_0x36af('0x16'));var hardwareService=require(_0x36af('0x17'));var logger=require(_0x36af('0x18'))(_0x36af('0x19'));var utils=require(_0x36af('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2422,_0x5c6c5b){_0x5c6c5b=_0x5c6c5b||0xcc;return function(_0x4aa399){if(_0x4aa399){return _0x2b2422[_0x36af('0x1b')](_0x5c6c5b);}return _0x2b2422[_0x36af('0x1c')](_0x5c6c5b)[_0x36af('0x1d')]();};}function respondWithResult(_0x4c2b62,_0x2a52cc){_0x2a52cc=_0x2a52cc||0xc8;return function(_0x1fdf84){if(_0x1fdf84){return _0x4c2b62['status'](_0x2a52cc)[_0x36af('0x1e')](_0x1fdf84);}};}function respondWithFilteredResult(_0x5a229f,_0x571a04){return function(_0x592d5d){if(_0x592d5d){var _0x145ef2=_0x592d5d['count'],_0x49fc30=_0x571a04['offset'],_0x31c8b6=_0x571a04[_0x36af('0x1f')]+_0x571a04[_0x36af('0x20')],_0x291756;if(_0x31c8b6>=_0x145ef2){_0x31c8b6=_0x145ef2;_0x291756=0xc8;}else{_0x291756=0xce;}_0x5a229f[_0x36af('0x1c')](_0x291756);return _0x5a229f['set'](_0x36af('0x21'),_0x49fc30+'-'+_0x31c8b6+'/'+_0x145ef2)[_0x36af('0x1e')](_0x592d5d);}return null;};}function patchUpdates(_0x59f3a4){return function(_0x52f507){try{jsonpatch['apply'](_0x52f507,_0x59f3a4,!![]);}catch(_0x309a03){return BPromise['reject'](_0x309a03);}return _0x52f507[_0x36af('0x22')]();};}function saveUpdates(_0xfb7915,_0xe54963){return function(_0x272f27){if(_0x272f27){return _0x272f27['update'](_0xfb7915)[_0x36af('0x23')](function(_0x545aa1){return _0x545aa1;});}return null;};}function removeEntity(_0x555db8,_0x3d93a7){return function(_0x5af2ac){if(_0x5af2ac){return _0x5af2ac[_0x36af('0x24')]()[_0x36af('0x23')](function(){var _0x24b145=_0x5af2ac[_0x36af('0x25')]({'plain':!![]});var _0x164a19=_0x36af('0x26');return db[_0x36af('0x27')][_0x36af('0x24')]({'where':{'type':_0x164a19,'resourceId':_0x24b145['id']}})[_0x36af('0x23')](function(){return _0x5af2ac;});})['then'](function(){_0x555db8[_0x36af('0x1c')](0xcc)[_0x36af('0x1d')]();});}};}function handleEntityNotFound(_0x102b28,_0x2189c6){return function(_0x68062a){if(!_0x68062a){_0x102b28[_0x36af('0x1b')](0x194);}return _0x68062a;};}function handleError(_0x23fc52,_0x387fad){_0x387fad=_0x387fad||0x1f4;return function(_0x85175b){logger['error'](_0x85175b[_0x36af('0x28')]);if(_0x85175b[_0x36af('0x29')]){delete _0x85175b[_0x36af('0x29')];}_0x23fc52['status'](_0x387fad)['send'](_0x85175b);};}exports[_0x36af('0x2a')]=function(_0x2cae08,_0xb8e43a){var _0x55e802={},_0x6c8795={},_0x1918cb={'count':0x0,'rows':[]};var _0x221d54=_['map'](db[_0x36af('0x2b')][_0x36af('0x2c')],function(_0x9d594f){return{'name':_0x9d594f['fieldName'],'type':_0x9d594f[_0x36af('0x2d')]['key']};});_0x6c8795[_0x36af('0x2e')]=_[_0x36af('0x2f')](_0x221d54,_0x36af('0x29'));_0x6c8795[_0x36af('0x30')]=_[_0x36af('0x31')](_0x2cae08['query']);_0x6c8795['filters']=_[_0x36af('0x32')](_0x6c8795['model'],_0x6c8795['query']);_0x55e802[_0x36af('0x33')]=_['intersection'](_0x6c8795['model'],qs[_0x36af('0x34')](_0x2cae08[_0x36af('0x30')][_0x36af('0x34')]));_0x55e802[_0x36af('0x33')]=_0x55e802[_0x36af('0x33')][_0x36af('0x35')]?_0x55e802['attributes']:_0x6c8795[_0x36af('0x2e')];if(!_0x2cae08['query'][_0x36af('0x36')]('nolimit')){_0x55e802[_0x36af('0x20')]=qs[_0x36af('0x20')](_0x2cae08[_0x36af('0x30')][_0x36af('0x20')]);_0x55e802['offset']=qs[_0x36af('0x1f')](_0x2cae08['query'][_0x36af('0x1f')]);}_0x55e802[_0x36af('0x37')]=qs[_0x36af('0x38')](_0x2cae08[_0x36af('0x30')]['sort']);_0x55e802[_0x36af('0x39')]=qs[_0x36af('0x3a')](_[_0x36af('0x3b')](_0x2cae08[_0x36af('0x30')],_0x6c8795['filters']),_0x221d54);if(_0x2cae08['query'][_0x36af('0x3c')]){_0x55e802['where']=_['merge'](_0x55e802['where'],{'$or':_['map'](_0x221d54,function(_0x155b3e){if(_0x155b3e['type']!==_0x36af('0x3d')){var _0x70b44a={};_0x70b44a[_0x155b3e[_0x36af('0x29')]]={'$like':'%'+_0x2cae08[_0x36af('0x30')][_0x36af('0x3c')]+'%'};return _0x70b44a;}})});}_0x55e802=_[_0x36af('0x3e')]({},_0x55e802,_0x2cae08[_0x36af('0x3f')]);var _0x51b031={'where':_0x55e802[_0x36af('0x39')]};return db[_0x36af('0x2b')][_0x36af('0x40')](_0x51b031)[_0x36af('0x23')](function(_0x3b80a0){_0x1918cb[_0x36af('0x40')]=_0x3b80a0;if(_0x2cae08[_0x36af('0x30')][_0x36af('0x41')]){_0x55e802[_0x36af('0x42')]=[{'all':!![]}];}return db[_0x36af('0x2b')][_0x36af('0x43')](_0x55e802);})['then'](function(_0x4d1c09){_0x1918cb[_0x36af('0x44')]=_0x4d1c09;return _0x1918cb;})[_0x36af('0x23')](respondWithFilteredResult(_0xb8e43a,_0x55e802))[_0x36af('0x45')](handleError(_0xb8e43a,null));};exports['show']=function(_0x3aee8d,_0x591aeb){var _0x2cc765={'raw':!![],'where':{'id':_0x3aee8d[_0x36af('0x46')]['id']}},_0x2caff6={};_0x2caff6[_0x36af('0x2e')]=_[_0x36af('0x31')](db[_0x36af('0x2b')]['rawAttributes']);_0x2caff6[_0x36af('0x30')]=_[_0x36af('0x31')](_0x3aee8d[_0x36af('0x30')]);_0x2caff6[_0x36af('0x3a')]=_[_0x36af('0x32')](_0x2caff6[_0x36af('0x2e')],_0x2caff6[_0x36af('0x30')]);_0x2cc765['attributes']=_[_0x36af('0x32')](_0x2caff6[_0x36af('0x2e')],qs[_0x36af('0x34')](_0x3aee8d[_0x36af('0x30')][_0x36af('0x34')]));_0x2cc765[_0x36af('0x33')]=_0x2cc765['attributes'][_0x36af('0x35')]?_0x2cc765[_0x36af('0x33')]:_0x2caff6[_0x36af('0x2e')];if(_0x3aee8d[_0x36af('0x30')]['includeAll']){_0x2cc765[_0x36af('0x42')]=[{'all':!![]}];}_0x2cc765=_['merge']({},_0x2cc765,_0x3aee8d[_0x36af('0x3f')]);return db[_0x36af('0x2b')][_0x36af('0x47')](_0x2cc765)[_0x36af('0x23')](handleEntityNotFound(_0x591aeb,null))[_0x36af('0x23')](respondWithResult(_0x591aeb,null))[_0x36af('0x45')](handleError(_0x591aeb,null));};exports['create']=function(_0x415858,_0x222644){return db[_0x36af('0x2b')][_0x36af('0x48')](_0x415858[_0x36af('0x49')],{})[_0x36af('0x23')](function(_0x37ee6a){var _0x448a9e=_0x415858[_0x36af('0x4a')][_0x36af('0x25')]({'plain':!![]});if(!_0x448a9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x448a9e['role']===_0x36af('0x4a')){var _0x3b2339=_0x37ee6a['get']({'plain':!![]});var _0x12be86='Templates';return db[_0x36af('0x4b')]['find']({'where':{'name':_0x12be86,'userProfileId':_0x448a9e[_0x36af('0x4c')]},'raw':!![]})[_0x36af('0x23')](function(_0x169178){if(_0x169178&&_0x169178[_0x36af('0x4d')]===0x0){return db[_0x36af('0x27')][_0x36af('0x48')]({'name':_0x3b2339[_0x36af('0x29')],'resourceId':_0x3b2339['id'],'type':_0x169178[_0x36af('0x29')],'sectionId':_0x169178['id']},{})[_0x36af('0x23')](function(){return _0x37ee6a;});}else{return _0x37ee6a;}})[_0x36af('0x45')](function(_0xb337be){logger[_0x36af('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb337be);throw _0xb337be;});}return _0x37ee6a;})['then'](respondWithResult(_0x222644,0xc9))[_0x36af('0x45')](handleError(_0x222644,null));};exports['update']=function(_0x497723,_0x3b997b){if(_0x497723[_0x36af('0x49')]['id']){delete _0x497723['body']['id'];}return db[_0x36af('0x2b')][_0x36af('0x47')]({'where':{'id':_0x497723['params']['id']}})[_0x36af('0x23')](handleEntityNotFound(_0x3b997b,null))[_0x36af('0x23')](saveUpdates(_0x497723['body'],null))[_0x36af('0x23')](respondWithResult(_0x3b997b,null))['catch'](handleError(_0x3b997b,null));};exports[_0x36af('0x24')]=function(_0x164c89,_0x1e6a87){return db[_0x36af('0x2b')]['find']({'where':{'id':_0x164c89[_0x36af('0x46')]['id']}})[_0x36af('0x23')](handleEntityNotFound(_0x1e6a87,null))[_0x36af('0x23')](removeEntity(_0x1e6a87,null))[_0x36af('0x45')](handleError(_0x1e6a87,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index dbdcbd0..c40abd3 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 _0xbfe7=['util','api','moment','request-promise','path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash'];(function(_0x4f4fe2,_0x5d66c4){var _0x1644f0=function(_0x434c35){while(--_0x434c35){_0x4f4fe2['push'](_0x4f4fe2['shift']());}};_0x1644f0(++_0x5d66c4);}(_0xbfe7,0x83));var _0x7bfe=function(_0x54045b,_0x2d1ec4){_0x54045b=_0x54045b-0x0;var _0x12a497=_0xbfe7[_0x54045b];return _0x12a497;};'use strict';var _=require(_0x7bfe('0x0'));var util=require(_0x7bfe('0x1'));var logger=require('../../config/logger')(_0x7bfe('0x2'));var moment=require(_0x7bfe('0x3'));var BPromise=require('bluebird');var rp=require(_0x7bfe('0x4'));var fs=require('fs');var path=require(_0x7bfe('0x5'));var rimraf=require(_0x7bfe('0x6'));var config=require('../../config/environment');var attributes=require(_0x7bfe('0x7'));module[_0x7bfe('0x8')]=function(_0x47d331,_0x1b2e62){return _0x47d331[_0x7bfe('0x9')](_0x7bfe('0xa'),attributes,{'tableName':_0x7bfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x645b=['tools_templates','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','Template'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x645b,0x6f));var _0xb645=function(_0xd6d4fd,_0x248cc1){_0xd6d4fd=_0xd6d4fd-0x0;var _0x3eaea3=_0x645b[_0xd6d4fd];return _0x3eaea3;};'use strict';var _=require(_0xb645('0x0'));var util=require('util');var logger=require(_0xb645('0x1'))(_0xb645('0x2'));var moment=require('moment');var BPromise=require(_0xb645('0x3'));var rp=require(_0xb645('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb645('0x5'));var config=require(_0xb645('0x6'));var attributes=require('./template.attributes');module[_0xb645('0x7')]=function(_0x1bab67,_0x2cde36){return _0x1bab67[_0xb645('0x8')](_0xb645('0x9'),attributes,{'tableName':_0xb645('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 b19072c..6d5f62c 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 _0xf23e=['stringify','lodash','util','bluebird','rpc','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x556eff,_0xed522a){var _0x56af3b=function(_0x283ea4){while(--_0x283ea4){_0x556eff['push'](_0x556eff['shift']());}};_0x56af3b(++_0xed522a);}(_0xf23e,0x10f));var _0xef23=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf23e[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xef23('0x0'));var util=require(_0xef23('0x1'));var moment=require('moment');var BPromise=require(_0xef23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef23('0x3'));var config=require(_0xef23('0x4'));var jayson=require(_0xef23('0x5'));var client=jayson[_0xef23('0x6')][_0xef23('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a4019,_0x362140,_0x49e44b){return new BPromise(function(_0x10b4e9,_0x5482cd){return client[_0xef23('0x8')](_0x4a4019,_0x49e44b)[_0xef23('0x9')](function(_0x13b30b){logger['info'](_0xef23('0xa'),_0x362140,_0xef23('0xb'));logger[_0xef23('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x362140,_0xef23('0xb'),JSON['stringify'](_0x13b30b));if(_0x13b30b[_0xef23('0xd')]){if(_0x13b30b['error'][_0xef23('0xe')]===0x1f4){logger[_0xef23('0xd')](_0xef23('0xa'),_0x362140,_0x13b30b['error'][_0xef23('0xf')]);return _0x5482cd(_0x13b30b['error'][_0xef23('0xf')]);}logger[_0xef23('0xd')](_0xef23('0xa'),_0x362140,_0x13b30b['error'][_0xef23('0xf')]);return _0x10b4e9(_0x13b30b['error']['message']);}else{logger[_0xef23('0x10')]('Template,\x20%s,\x20%s',_0x362140,_0xef23('0xb'));_0x10b4e9(_0x13b30b[_0xef23('0x11')][_0xef23('0xf')]);}})[_0xef23('0x12')](function(_0x299c18){logger[_0xef23('0xd')](_0xef23('0xa'),_0x362140,_0x299c18);_0x5482cd(_0x299c18);});});}exports[_0xef23('0x13')]=function(_0x335123){var _0x472b00=this;return new Promise(function(_0x57c5da,_0x297287){return db[_0xef23('0x14')][_0xef23('0x15')]({'raw':_0x335123[_0xef23('0x16')]?_0x335123['options'][_0xef23('0x17')]===undefined?!![]:![]:!![],'where':_0x335123[_0xef23('0x16')]?_0x335123[_0xef23('0x16')]['where']||null:null,'attributes':_0x335123[_0xef23('0x16')]?_0x335123[_0xef23('0x16')][_0xef23('0x18')]||null:null,'limit':_0x335123['options']?_0x335123[_0xef23('0x16')][_0xef23('0x19')]||null:null,'include':_0x335123[_0xef23('0x16')]?_0x335123[_0xef23('0x16')][_0xef23('0x1a')]?_[_0xef23('0x1b')](_0x335123[_0xef23('0x16')]['include'],function(_0x3aa16a){return{'model':db[_0x3aa16a[_0xef23('0x1c')]],'as':_0x3aa16a['as'],'attributes':_0x3aa16a[_0xef23('0x18')],'include':_0x3aa16a[_0xef23('0x1a')]?_[_0xef23('0x1b')](_0x3aa16a[_0xef23('0x1a')],function(_0x48bb04){return{'model':db[_0x48bb04[_0xef23('0x1c')]],'as':_0x48bb04['as'],'attributes':_0x48bb04[_0xef23('0x18')],'include':_0x48bb04['include']?_['map'](_0x48bb04[_0xef23('0x1a')],function(_0xcd1f4a){return{'model':db[_0xcd1f4a[_0xef23('0x1c')]],'as':_0xcd1f4a['as'],'attributes':_0xcd1f4a['attributes']};}):[]};}):[]};}):[]:[]})[_0xef23('0x9')](function(_0xf43cb6){logger['info']('GetTemplate',_0x335123);logger[_0xef23('0xc')]('GetTemplate',_0x335123,JSON[_0xef23('0x1d')](_0xf43cb6));_0x57c5da(_0xf43cb6);})['catch'](function(_0x1fe62c){logger[_0xef23('0xd')](_0xef23('0x13'),_0x1fe62c[_0xef23('0xf')],_0x335123);_0x297287(_0x472b00[_0xef23('0xd')](0x1f4,_0x1fe62c[_0xef23('0xf')]));});});}; \ No newline at end of file +var _0x769f=['info','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','where','limit','include','model','attributes','map','then','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x204c93,_0x2b756c){var _0x513d8f=function(_0x466c17){while(--_0x466c17){_0x204c93['push'](_0x204c93['shift']());}};_0x513d8f(++_0x2b756c);}(_0x769f,0xdc));var _0xf769=function(_0x5cbc17,_0x32d3ab){_0x5cbc17=_0x5cbc17-0x0;var _0x28068b=_0x769f[_0x5cbc17];return _0x28068b;};'use strict';var _=require(_0xf769('0x0'));var util=require(_0xf769('0x1'));var moment=require('moment');var BPromise=require(_0xf769('0x2'));var rs=require(_0xf769('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf769('0x4'))['db'];var utils=require(_0xf769('0x5'));var logger=require(_0xf769('0x6'))('rpc');var config=require(_0xf769('0x7'));var jayson=require(_0xf769('0x8'));var client=jayson[_0xf769('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d55b4,_0x19f954,_0x2773d0){return new BPromise(function(_0x3972d9,_0x5b65da){return client[_0xf769('0xa')](_0x3d55b4,_0x2773d0)['then'](function(_0x4896ac){logger[_0xf769('0xb')]('Template,\x20%s,\x20%s',_0x19f954,'request\x20sent');logger['debug'](_0xf769('0xc'),_0x19f954,_0xf769('0xd'),JSON[_0xf769('0xe')](_0x4896ac));if(_0x4896ac[_0xf769('0xf')]){if(_0x4896ac[_0xf769('0xf')][_0xf769('0x10')]===0x1f4){logger[_0xf769('0xf')](_0xf769('0x11'),_0x19f954,_0x4896ac['error'][_0xf769('0x12')]);return _0x5b65da(_0x4896ac[_0xf769('0xf')][_0xf769('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0x19f954,_0x4896ac[_0xf769('0xf')]['message']);return _0x3972d9(_0x4896ac[_0xf769('0xf')][_0xf769('0x12')]);}else{logger[_0xf769('0xb')]('Template,\x20%s,\x20%s',_0x19f954,'request\x20sent');_0x3972d9(_0x4896ac[_0xf769('0x13')]['message']);}})['catch'](function(_0x594776){logger[_0xf769('0xf')]('Template,\x20%s,\x20%s',_0x19f954,_0x594776);_0x5b65da(_0x594776);});});}exports[_0xf769('0x14')]=function(_0x540032){var _0xaa76ef=this;return new Promise(function(_0x2d43a6,_0x5cd4f4){return db[_0xf769('0x15')][_0xf769('0x16')]({'raw':_0x540032[_0xf769('0x17')]?_0x540032[_0xf769('0x17')][_0xf769('0x18')]===undefined?!![]:![]:!![],'where':_0x540032['options']?_0x540032['options'][_0xf769('0x19')]||null:null,'attributes':_0x540032[_0xf769('0x17')]?_0x540032['options']['attributes']||null:null,'limit':_0x540032[_0xf769('0x17')]?_0x540032['options'][_0xf769('0x1a')]||null:null,'include':_0x540032[_0xf769('0x17')]?_0x540032[_0xf769('0x17')]['include']?_['map'](_0x540032[_0xf769('0x17')][_0xf769('0x1b')],function(_0x573764){return{'model':db[_0x573764[_0xf769('0x1c')]],'as':_0x573764['as'],'attributes':_0x573764[_0xf769('0x1d')],'include':_0x573764['include']?_[_0xf769('0x1e')](_0x573764[_0xf769('0x1b')],function(_0x40294d){return{'model':db[_0x40294d[_0xf769('0x1c')]],'as':_0x40294d['as'],'attributes':_0x40294d[_0xf769('0x1d')],'include':_0x40294d[_0xf769('0x1b')]?_['map'](_0x40294d['include'],function(_0x1295ab){return{'model':db[_0x1295ab[_0xf769('0x1c')]],'as':_0x1295ab['as'],'attributes':_0x1295ab[_0xf769('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf769('0x1f')](function(_0x1c66df){logger[_0xf769('0xb')]('GetTemplate',_0x540032);logger['debug'](_0xf769('0x14'),_0x540032,JSON[_0xf769('0xe')](_0x1c66df));_0x2d43a6(_0x1c66df);})[_0xf769('0x20')](function(_0x2e0877){logger[_0xf769('0xf')](_0xf769('0x14'),_0x2e0877[_0xf769('0x12')],_0x540032);_0x5cd4f4(_0xaa76ef['error'](0x1f4,_0x2e0877[_0xf769('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 578b280..2e9bac5 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 _0xaab9=['index','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','post','addAllCondition','/:id/actions','addAction','put','update','delete','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated'];(function(_0x303964,_0x36959c){var _0x2d25e0=function(_0x40ad02){while(--_0x40ad02){_0x303964['push'](_0x303964['shift']());}};_0x2d25e0(++_0x36959c);}(_0xaab9,0x159));var _0x9aab=function(_0x554819,_0x8c1a83){_0x554819=_0x554819-0x0;var _0x1fa428=_0xaab9[_0x554819];return _0x1fa428;};'use strict';var multer=require(_0x9aab('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9aab('0x1')]();var auth=require(_0x9aab('0x2'));var interaction=require(_0x9aab('0x3'));var config=require(_0x9aab('0x4'));var controller=require(_0x9aab('0x5'));router['get']('/',auth[_0x9aab('0x6')](),controller[_0x9aab('0x7')]);router[_0x9aab('0x8')](_0x9aab('0x9'),auth[_0x9aab('0x6')](),controller['show']);router['get'](_0x9aab('0xa'),auth[_0x9aab('0x6')](),controller[_0x9aab('0xb')]);router[_0x9aab('0x8')](_0x9aab('0xc'),auth[_0x9aab('0x6')](),controller[_0x9aab('0xd')]);router[_0x9aab('0x8')]('/:id/actions',auth[_0x9aab('0x6')](),controller['getActions']);router[_0x9aab('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9aab('0xe')](_0x9aab('0xa'),auth[_0x9aab('0x6')](),controller[_0x9aab('0xf')]);router[_0x9aab('0xe')](_0x9aab('0xc'),auth[_0x9aab('0x6')](),controller['addAnyCondition']);router[_0x9aab('0xe')](_0x9aab('0x10'),auth[_0x9aab('0x6')](),controller[_0x9aab('0x11')]);router[_0x9aab('0x12')](_0x9aab('0x9'),auth[_0x9aab('0x6')](),controller[_0x9aab('0x13')]);router[_0x9aab('0x14')](_0x9aab('0x9'),auth[_0x9aab('0x6')](),controller['destroy']);module[_0x9aab('0x15')]=router; \ No newline at end of file +var _0x6d84=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAction','put','update','exports','multer','util','path'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0x6d84,0xf9));var _0x46d8=function(_0x3c7f7d,_0x1ec2fc){_0x3c7f7d=_0x3c7f7d-0x0;var _0x1e044c=_0x6d84[_0x3c7f7d];return _0x1e044c;};'use strict';var multer=require(_0x46d8('0x0'));var util=require(_0x46d8('0x1'));var path=require(_0x46d8('0x2'));var timeout=require(_0x46d8('0x3'));var express=require(_0x46d8('0x4'));var router=express[_0x46d8('0x5')]();var auth=require(_0x46d8('0x6'));var interaction=require(_0x46d8('0x7'));var config=require(_0x46d8('0x8'));var controller=require(_0x46d8('0x9'));router[_0x46d8('0xa')]('/',auth[_0x46d8('0xb')](),controller[_0x46d8('0xc')]);router[_0x46d8('0xa')](_0x46d8('0xd'),auth[_0x46d8('0xb')](),controller[_0x46d8('0xe')]);router[_0x46d8('0xa')]('/:id/all_conditions',auth[_0x46d8('0xb')](),controller[_0x46d8('0xf')]);router[_0x46d8('0xa')](_0x46d8('0x10'),auth['isAuthenticated'](),controller[_0x46d8('0x11')]);router['get'](_0x46d8('0x12'),auth['isAuthenticated'](),controller[_0x46d8('0x13')]);router[_0x46d8('0x14')]('/',auth[_0x46d8('0xb')](),controller[_0x46d8('0x15')]);router[_0x46d8('0x14')](_0x46d8('0x16'),auth[_0x46d8('0xb')](),controller[_0x46d8('0x17')]);router[_0x46d8('0x14')](_0x46d8('0x10'),auth[_0x46d8('0xb')](),controller['addAnyCondition']);router[_0x46d8('0x14')]('/:id/actions',auth[_0x46d8('0xb')](),controller[_0x46d8('0x18')]);router[_0x46d8('0x19')](_0x46d8('0xd'),auth[_0x46d8('0xb')](),controller[_0x46d8('0x1a')]);router['delete'](_0x46d8('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x46d8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8110aa0..e06ef7d 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 _0x54f3=['exports','STRING','sequelize'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x54f3,0x11f));var _0x354f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x54f3[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x354f('0x0'));module[_0x354f('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x354f('0x2')]},'description':{'type':Sequelize[_0x354f('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x38de=['exports','STRING','BOOLEAN'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x38de,0x19e));var _0xe38d=function(_0x8145e8,_0x346c81){_0x8145e8=_0x8145e8-0x0;var _0x4eb2a6=_0x38de[_0x8145e8];return _0x4eb2a6;};'use strict';var Sequelize=require('sequelize');module[_0xe38d('0x0')]={'name':{'type':Sequelize[_0xe38d('0x1')]},'channel':{'type':Sequelize[_0xe38d('0x1')]},'description':{'type':Sequelize[_0xe38d('0x1')]},'status':{'type':Sequelize[_0xe38d('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 affd83d..443c83c 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 _0xaba0=['reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','keys','intersection','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','TriggerAnyId','create','getAllConditions','findOne','options','hasOwnProperty','getAnyConditions','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaba0,0xf4));var _0x0aba=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xaba0[_0x1ac595];return _0x455fff;};'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(_0x0aba('0x5'));var Mustache=require(_0x0aba('0x6'));var util=require(_0x0aba('0x7'));var path=require(_0x0aba('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0aba('0x9'));var fs=require('fs');var _=require(_0x0aba('0xa'));var squel=require(_0x0aba('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0aba('0xc'));var querystring=require('querystring');var Papa=require(_0x0aba('0xd'));var Redis=require(_0x0aba('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0aba('0xf'));var as=require(_0x0aba('0x10'));var hardwareService=require(_0x0aba('0x11'));var logger=require(_0x0aba('0x12'))(_0x0aba('0x13'));var utils=require('../../config/utils');var config=require(_0x0aba('0x14'));var db=require(_0x0aba('0x15'))['db'];function respondWithStatusCode(_0x572006,_0x4d22b7){_0x4d22b7=_0x4d22b7||0xcc;return function(_0x162222){if(_0x162222){return _0x572006[_0x0aba('0x16')](_0x4d22b7);}return _0x572006['status'](_0x4d22b7)[_0x0aba('0x17')]();};}function respondWithResult(_0x100c05,_0x38943f){_0x38943f=_0x38943f||0xc8;return function(_0x4a52e4){if(_0x4a52e4){return _0x100c05['status'](_0x38943f)[_0x0aba('0x18')](_0x4a52e4);}};}function respondWithFilteredResult(_0x177fdb,_0x4c814d){return function(_0x13dfdb){if(_0x13dfdb){var _0x354102=_0x13dfdb[_0x0aba('0x19')],_0x5f0b11=_0x4c814d[_0x0aba('0x1a')],_0x2dcfdc=_0x4c814d[_0x0aba('0x1a')]+_0x4c814d[_0x0aba('0x1b')],_0x46c85b;if(_0x2dcfdc>=_0x354102){_0x2dcfdc=_0x354102;_0x46c85b=0xc8;}else{_0x46c85b=0xce;}_0x177fdb[_0x0aba('0x1c')](_0x46c85b);return _0x177fdb[_0x0aba('0x1d')](_0x0aba('0x1e'),_0x5f0b11+'-'+_0x2dcfdc+'/'+_0x354102)[_0x0aba('0x18')](_0x13dfdb);}return null;};}function patchUpdates(_0x567dd6){return function(_0x55ab17){try{jsonpatch[_0x0aba('0x1f')](_0x55ab17,_0x567dd6,!![]);}catch(_0x51f374){return BPromise[_0x0aba('0x20')](_0x51f374);}return _0x55ab17[_0x0aba('0x21')]();};}function saveUpdates(_0x16cd52,_0x1447db){return function(_0x4ccfb5){if(_0x4ccfb5){return _0x4ccfb5[_0x0aba('0x22')](_0x16cd52)[_0x0aba('0x23')](function(_0x3ac7a8){return _0x3ac7a8;});}return null;};}function removeEntity(_0x10334c,_0x22437c){return function(_0x381aff){if(_0x381aff){return _0x381aff[_0x0aba('0x24')]()[_0x0aba('0x23')](function(){var _0x5a4359=_0x381aff[_0x0aba('0x25')]({'plain':!![]});var _0x3207de='Triggers';return db[_0x0aba('0x26')][_0x0aba('0x24')]({'where':{'type':_0x3207de,'resourceId':_0x5a4359['id']}})['then'](function(){return _0x381aff;});})[_0x0aba('0x23')](function(){_0x10334c[_0x0aba('0x1c')](0xcc)[_0x0aba('0x17')]();});}};}function handleEntityNotFound(_0x35d093,_0xaa1bf5){return function(_0x25a3db){if(!_0x25a3db){_0x35d093[_0x0aba('0x16')](0x194);}return _0x25a3db;};}function handleError(_0x4ebe11,_0x2a6afa){_0x2a6afa=_0x2a6afa||0x1f4;return function(_0x493676){logger[_0x0aba('0x27')](_0x493676[_0x0aba('0x28')]);if(_0x493676[_0x0aba('0x29')]){delete _0x493676[_0x0aba('0x29')];}_0x4ebe11[_0x0aba('0x1c')](_0x2a6afa)[_0x0aba('0x2a')](_0x493676);};}exports[_0x0aba('0x2b')]=function(_0x44a9f4,_0x1a7af3){var _0x10b058={},_0x2edd7a={},_0x5aa967={'count':0x0,'rows':[]};var _0x47b0a1=_[_0x0aba('0x2c')](db[_0x0aba('0x2d')][_0x0aba('0x2e')],function(_0x21463e){return{'name':_0x21463e[_0x0aba('0x2f')],'type':_0x21463e[_0x0aba('0x30')][_0x0aba('0x31')]};});_0x2edd7a[_0x0aba('0x32')]=_[_0x0aba('0x2c')](_0x47b0a1,_0x0aba('0x29'));_0x2edd7a[_0x0aba('0x33')]=_['keys'](_0x44a9f4[_0x0aba('0x33')]);_0x2edd7a[_0x0aba('0x34')]=_['intersection'](_0x2edd7a[_0x0aba('0x32')],_0x2edd7a[_0x0aba('0x33')]);_0x10b058[_0x0aba('0x35')]=_['intersection'](_0x2edd7a[_0x0aba('0x32')],qs['fields'](_0x44a9f4[_0x0aba('0x33')][_0x0aba('0x36')]));_0x10b058['attributes']=_0x10b058[_0x0aba('0x35')][_0x0aba('0x37')]?_0x10b058[_0x0aba('0x35')]:_0x2edd7a[_0x0aba('0x32')];if(!_0x44a9f4[_0x0aba('0x33')]['hasOwnProperty'](_0x0aba('0x38'))){_0x10b058[_0x0aba('0x1b')]=qs[_0x0aba('0x1b')](_0x44a9f4['query']['limit']);_0x10b058[_0x0aba('0x1a')]=qs[_0x0aba('0x1a')](_0x44a9f4[_0x0aba('0x33')][_0x0aba('0x1a')]);}_0x10b058[_0x0aba('0x39')]=qs[_0x0aba('0x3a')](_0x44a9f4[_0x0aba('0x33')][_0x0aba('0x3a')]);_0x10b058[_0x0aba('0x3b')]=qs[_0x0aba('0x34')](_[_0x0aba('0x3c')](_0x44a9f4[_0x0aba('0x33')],_0x2edd7a['filters']),_0x47b0a1);if(_0x44a9f4[_0x0aba('0x33')][_0x0aba('0x3d')]){_0x10b058[_0x0aba('0x3b')]=_[_0x0aba('0x3e')](_0x10b058[_0x0aba('0x3b')],{'$or':_[_0x0aba('0x2c')](_0x47b0a1,function(_0x480343){if(_0x480343[_0x0aba('0x30')]!=='VIRTUAL'){var _0x53c5e7={};_0x53c5e7[_0x480343[_0x0aba('0x29')]]={'$like':'%'+_0x44a9f4['query'][_0x0aba('0x3d')]+'%'};return _0x53c5e7;}})});}_0x10b058=_['merge']({},_0x10b058,_0x44a9f4['options']);var _0x526f2f={'where':_0x10b058[_0x0aba('0x3b')]};return db[_0x0aba('0x2d')]['count'](_0x526f2f)[_0x0aba('0x23')](function(_0x2e033b){_0x5aa967[_0x0aba('0x19')]=_0x2e033b;if(_0x44a9f4['query'][_0x0aba('0x3f')]){_0x10b058['include']=[{'all':!![]}];}return db[_0x0aba('0x2d')][_0x0aba('0x40')](_0x10b058);})[_0x0aba('0x23')](function(_0x408ff5){_0x5aa967[_0x0aba('0x41')]=_0x408ff5;return _0x5aa967;})[_0x0aba('0x23')](respondWithFilteredResult(_0x1a7af3,_0x10b058))[_0x0aba('0x42')](handleError(_0x1a7af3,null));};exports[_0x0aba('0x43')]=function(_0x59620f,_0xb680fa){var _0x46d764={'raw':![],'where':{'id':_0x59620f[_0x0aba('0x44')]['id']}},_0x14bc89={};_0x14bc89[_0x0aba('0x32')]=_[_0x0aba('0x45')](db[_0x0aba('0x2d')]['rawAttributes']);_0x14bc89['query']=_[_0x0aba('0x45')](_0x59620f[_0x0aba('0x33')]);_0x14bc89[_0x0aba('0x34')]=_[_0x0aba('0x46')](_0x14bc89[_0x0aba('0x32')],_0x14bc89[_0x0aba('0x33')]);_0x46d764[_0x0aba('0x35')]=_['intersection'](_0x14bc89[_0x0aba('0x32')],qs[_0x0aba('0x36')](_0x59620f[_0x0aba('0x33')]['fields']));_0x46d764[_0x0aba('0x35')]=_0x46d764['attributes'][_0x0aba('0x37')]?_0x46d764['attributes']:_0x14bc89['model'];if(_0x59620f[_0x0aba('0x33')][_0x0aba('0x3f')]){_0x46d764['include']=[{'all':!![]}];}_0x46d764=_[_0x0aba('0x3e')]({},_0x46d764,_0x59620f['options']);return db[_0x0aba('0x2d')][_0x0aba('0x47')](_0x46d764)[_0x0aba('0x23')](handleEntityNotFound(_0xb680fa,null))[_0x0aba('0x23')](respondWithResult(_0xb680fa,null))[_0x0aba('0x42')](handleError(_0xb680fa,null));};exports['create']=function(_0x5b7ad8,_0x3aacfc){return db[_0x0aba('0x2d')]['create'](_0x5b7ad8['body'],{})[_0x0aba('0x23')](function(_0x3e0866){var _0x3a0139=_0x5b7ad8[_0x0aba('0x48')]['get']({'plain':!![]});if(!_0x3a0139)throw new Error(_0x0aba('0x49'));if(_0x3a0139[_0x0aba('0x4a')]==='user'){var _0x6b4d7c=_0x3e0866[_0x0aba('0x25')]({'plain':!![]});var _0x133b60=_0x0aba('0x4b');return db[_0x0aba('0x4c')]['find']({'where':{'name':_0x133b60,'userProfileId':_0x3a0139[_0x0aba('0x4d')]},'raw':!![]})['then'](function(_0x3b75e8){if(_0x3b75e8&&_0x3b75e8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x6b4d7c[_0x0aba('0x29')],'resourceId':_0x6b4d7c['id'],'type':_0x3b75e8[_0x0aba('0x29')],'sectionId':_0x3b75e8['id']},{})[_0x0aba('0x23')](function(){return _0x3e0866;});}else{return _0x3e0866;}})[_0x0aba('0x42')](function(_0x8b175c){logger['error'](_0x0aba('0x4e'),_0x8b175c);throw _0x8b175c;});}return _0x3e0866;})[_0x0aba('0x23')](respondWithResult(_0x3aacfc,0xc9))[_0x0aba('0x42')](handleError(_0x3aacfc,null));};exports[_0x0aba('0x22')]=function(_0x361d2b,_0x47f2e6){if(_0x361d2b[_0x0aba('0x4f')]['id']){delete _0x361d2b[_0x0aba('0x4f')]['id'];}return db[_0x0aba('0x2d')][_0x0aba('0x47')]({'where':{'id':_0x361d2b[_0x0aba('0x44')]['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x47f2e6,null))[_0x0aba('0x23')](saveUpdates(_0x361d2b[_0x0aba('0x4f')],null))['then'](respondWithResult(_0x47f2e6,null))[_0x0aba('0x42')](handleError(_0x47f2e6,null));};exports['destroy']=function(_0x2370d1,_0x43f7c9){return db[_0x0aba('0x2d')][_0x0aba('0x47')]({'where':{'id':_0x2370d1[_0x0aba('0x44')]['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x43f7c9,null))[_0x0aba('0x23')](removeEntity(_0x43f7c9,null))[_0x0aba('0x42')](handleError(_0x43f7c9,null));};exports[_0x0aba('0x50')]=function(_0x29b7aa,_0x3825a0,_0x2dcb8e){if(_0x29b7aa[_0x0aba('0x4f')]['id']){delete _0x29b7aa['body']['id'];}return db[_0x0aba('0x2d')]['find']({'where':{'id':_0x29b7aa[_0x0aba('0x44')]['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x3825a0,null))['then'](function(_0x2d4c93){if(_0x2d4c93){_0x29b7aa[_0x0aba('0x4f')][_0x0aba('0x51')]=_0x2d4c93['id'];return db[_0x0aba('0x52')]['create'](_0x29b7aa[_0x0aba('0x4f')]);}})['then'](respondWithResult(_0x3825a0,null))[_0x0aba('0x42')](handleError(_0x3825a0,null));};exports['addAnyCondition']=function(_0x1a0fc1,_0x438171,_0x435a6e){if(_0x1a0fc1[_0x0aba('0x4f')]['id']){delete _0x1a0fc1[_0x0aba('0x4f')]['id'];}return db[_0x0aba('0x2d')][_0x0aba('0x47')]({'where':{'id':_0x1a0fc1[_0x0aba('0x44')]['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x438171,null))['then'](function(_0x14b410){if(_0x14b410){_0x1a0fc1[_0x0aba('0x4f')][_0x0aba('0x53')]=_0x14b410['id'];return db[_0x0aba('0x52')][_0x0aba('0x54')](_0x1a0fc1[_0x0aba('0x4f')]);}})[_0x0aba('0x23')](respondWithResult(_0x438171,null))[_0x0aba('0x42')](handleError(_0x438171,null));};exports[_0x0aba('0x55')]=function(_0x415d77,_0x31d0ee,_0x597a48){var _0x67197e={};var _0x28d0bf={};var _0x43ff18;var _0x589916;return db[_0x0aba('0x2d')][_0x0aba('0x56')]({'where':{'id':_0x415d77[_0x0aba('0x44')]['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x31d0ee,null))[_0x0aba('0x23')](function(_0x2130cb){if(_0x2130cb){_0x43ff18=_0x2130cb;_0x28d0bf[_0x0aba('0x32')]=_[_0x0aba('0x45')](db[_0x0aba('0x52')][_0x0aba('0x2e')]);_0x28d0bf[_0x0aba('0x33')]=_[_0x0aba('0x45')](_0x415d77['query']);_0x28d0bf[_0x0aba('0x34')]=_[_0x0aba('0x46')](_0x28d0bf[_0x0aba('0x32')],_0x28d0bf['query']);_0x67197e[_0x0aba('0x35')]=_[_0x0aba('0x46')](_0x28d0bf['model'],qs['fields'](_0x415d77['query']['fields']));_0x67197e[_0x0aba('0x35')]=_0x67197e['attributes'][_0x0aba('0x37')]?_0x67197e[_0x0aba('0x35')]:_0x28d0bf[_0x0aba('0x32')];_0x67197e[_0x0aba('0x39')]=qs[_0x0aba('0x3a')](_0x415d77[_0x0aba('0x33')][_0x0aba('0x3a')]);_0x67197e[_0x0aba('0x3b')]=qs[_0x0aba('0x34')](_[_0x0aba('0x3c')](_0x415d77[_0x0aba('0x33')],_0x28d0bf[_0x0aba('0x34')]));if(_0x415d77[_0x0aba('0x33')]['filter']){_0x67197e[_0x0aba('0x3b')]=_[_0x0aba('0x3e')](_0x67197e[_0x0aba('0x3b')],{'$or':_[_0x0aba('0x2c')](_0x67197e[_0x0aba('0x35')],function(_0x506efb){var _0x2b5281={};_0x2b5281[_0x506efb]={'$like':'%'+_0x415d77[_0x0aba('0x33')][_0x0aba('0x3d')]+'%'};return _0x2b5281;})});}_0x67197e=_['merge']({},_0x67197e,_0x415d77[_0x0aba('0x57')]);return _0x43ff18[_0x0aba('0x55')](_0x67197e);}})[_0x0aba('0x23')](function(_0x3fa84c){if(_0x3fa84c){_0x589916=_0x3fa84c[_0x0aba('0x37')];if(!_0x415d77[_0x0aba('0x33')][_0x0aba('0x58')]('nolimit')){_0x67197e[_0x0aba('0x1b')]=qs[_0x0aba('0x1b')](_0x415d77['query'][_0x0aba('0x1b')]);_0x67197e['offset']=qs['offset'](_0x415d77['query'][_0x0aba('0x1a')]);}return _0x43ff18['getAllConditions'](_0x67197e);}})[_0x0aba('0x23')](function(_0x2a957b){if(_0x2a957b){return _0x2a957b?{'count':_0x589916,'rows':_0x2a957b}:null;}})[_0x0aba('0x23')](respondWithResult(_0x31d0ee,null))[_0x0aba('0x42')](handleError(_0x31d0ee,null));};exports[_0x0aba('0x59')]=function(_0x124705,_0x3677ac,_0x1d1cb4){var _0x5ef177={};var _0x35af18={};var _0x3bd7ed;var _0xb31e40;return db[_0x0aba('0x2d')][_0x0aba('0x56')]({'where':{'id':_0x124705['params']['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x3677ac,null))['then'](function(_0x245b58){if(_0x245b58){_0x3bd7ed=_0x245b58;_0x35af18[_0x0aba('0x32')]=_[_0x0aba('0x45')](db[_0x0aba('0x52')]['rawAttributes']);_0x35af18[_0x0aba('0x33')]=_['keys'](_0x124705[_0x0aba('0x33')]);_0x35af18[_0x0aba('0x34')]=_[_0x0aba('0x46')](_0x35af18[_0x0aba('0x32')],_0x35af18[_0x0aba('0x33')]);_0x5ef177['attributes']=_[_0x0aba('0x46')](_0x35af18['model'],qs['fields'](_0x124705[_0x0aba('0x33')][_0x0aba('0x36')]));_0x5ef177['attributes']=_0x5ef177['attributes'][_0x0aba('0x37')]?_0x5ef177[_0x0aba('0x35')]:_0x35af18['model'];_0x5ef177['order']=qs[_0x0aba('0x3a')](_0x124705['query'][_0x0aba('0x3a')]);_0x5ef177[_0x0aba('0x3b')]=qs[_0x0aba('0x34')](_[_0x0aba('0x3c')](_0x124705[_0x0aba('0x33')],_0x35af18[_0x0aba('0x34')]));if(_0x124705[_0x0aba('0x33')][_0x0aba('0x3d')]){_0x5ef177['where']=_[_0x0aba('0x3e')](_0x5ef177['where'],{'$or':_['map'](_0x5ef177['attributes'],function(_0x4c32f1){var _0x2d3703={};_0x2d3703[_0x4c32f1]={'$like':'%'+_0x124705['query'][_0x0aba('0x3d')]+'%'};return _0x2d3703;})});}_0x5ef177=_['merge']({},_0x5ef177,_0x124705[_0x0aba('0x57')]);return _0x3bd7ed['getAnyConditions'](_0x5ef177);}})['then'](function(_0x5a541d){if(_0x5a541d){_0xb31e40=_0x5a541d['length'];if(!_0x124705[_0x0aba('0x33')][_0x0aba('0x58')]('nolimit')){_0x5ef177[_0x0aba('0x1b')]=qs['limit'](_0x124705[_0x0aba('0x33')][_0x0aba('0x1b')]);_0x5ef177[_0x0aba('0x1a')]=qs[_0x0aba('0x1a')](_0x124705[_0x0aba('0x33')][_0x0aba('0x1a')]);}return _0x3bd7ed['getAnyConditions'](_0x5ef177);}})[_0x0aba('0x23')](function(_0x38d4ca){if(_0x38d4ca){return _0x38d4ca?{'count':_0xb31e40,'rows':_0x38d4ca}:null;}})['then'](respondWithResult(_0x3677ac,null))[_0x0aba('0x42')](handleError(_0x3677ac,null));};exports['addAction']=function(_0x4b2577,_0x4d38ed,_0x19f04b){if(_0x4b2577[_0x0aba('0x4f')]['id']){delete _0x4b2577[_0x0aba('0x4f')]['id'];}return db['Trigger'][_0x0aba('0x47')]({'where':{'id':_0x4b2577[_0x0aba('0x44')]['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x4d38ed,null))[_0x0aba('0x23')](function(_0x48a95d){if(_0x48a95d){_0x4b2577[_0x0aba('0x4f')]['TriggerId']=_0x48a95d['id'];return db[_0x0aba('0x5a')][_0x0aba('0x54')](_0x4b2577[_0x0aba('0x4f')]);}})[_0x0aba('0x23')](respondWithResult(_0x4d38ed,null))[_0x0aba('0x42')](handleError(_0x4d38ed,null));};exports['getActions']=function(_0x2de267,_0x3e1bc4,_0x588bad){var _0x332de3={};var _0x95a69e={};var _0x335c9a;var _0x24c614;return db['Trigger'][_0x0aba('0x56')]({'where':{'id':_0x2de267['params']['id']}})[_0x0aba('0x23')](handleEntityNotFound(_0x3e1bc4,null))[_0x0aba('0x23')](function(_0x29f371){if(_0x29f371){_0x335c9a=_0x29f371;_0x95a69e['model']=_[_0x0aba('0x45')](db[_0x0aba('0x5a')][_0x0aba('0x2e')]);_0x95a69e[_0x0aba('0x33')]=_[_0x0aba('0x45')](_0x2de267['query']);_0x95a69e[_0x0aba('0x34')]=_[_0x0aba('0x46')](_0x95a69e[_0x0aba('0x32')],_0x95a69e[_0x0aba('0x33')]);_0x332de3[_0x0aba('0x35')]=_['intersection'](_0x95a69e[_0x0aba('0x32')],qs[_0x0aba('0x36')](_0x2de267[_0x0aba('0x33')][_0x0aba('0x36')]));_0x332de3[_0x0aba('0x35')]=_0x332de3[_0x0aba('0x35')][_0x0aba('0x37')]?_0x332de3['attributes']:_0x95a69e[_0x0aba('0x32')];_0x332de3['order']=qs[_0x0aba('0x3a')](_0x2de267[_0x0aba('0x33')][_0x0aba('0x3a')]);_0x332de3[_0x0aba('0x3b')]=qs[_0x0aba('0x34')](_['pick'](_0x2de267[_0x0aba('0x33')],_0x95a69e['filters']));if(_0x2de267[_0x0aba('0x33')]['filter']){_0x332de3[_0x0aba('0x3b')]=_[_0x0aba('0x3e')](_0x332de3[_0x0aba('0x3b')],{'$or':_['map'](_0x332de3[_0x0aba('0x35')],function(_0x3cf5fd){var _0x2559c9={};_0x2559c9[_0x3cf5fd]={'$like':'%'+_0x2de267[_0x0aba('0x33')][_0x0aba('0x3d')]+'%'};return _0x2559c9;})});}_0x332de3=_[_0x0aba('0x3e')]({},_0x332de3,_0x2de267[_0x0aba('0x57')]);return _0x335c9a[_0x0aba('0x5b')](_0x332de3);}})[_0x0aba('0x23')](function(_0x28696a){if(_0x28696a){_0x24c614=_0x28696a[_0x0aba('0x37')];if(!_0x2de267[_0x0aba('0x33')]['hasOwnProperty'](_0x0aba('0x38'))){_0x332de3['limit']=qs[_0x0aba('0x1b')](_0x2de267[_0x0aba('0x33')]['limit']);_0x332de3['offset']=qs['offset'](_0x2de267[_0x0aba('0x33')][_0x0aba('0x1a')]);}return _0x335c9a[_0x0aba('0x5b')](_0x332de3);}})[_0x0aba('0x23')](function(_0x23bf68){if(_0x23bf68){return _0x23bf68?{'count':_0x24c614,'rows':_0x23bf68}:null;}})[_0x0aba('0x23')](respondWithResult(_0x3e1bc4,null))[_0x0aba('0x42')](handleError(_0x3e1bc4,null));}; \ No newline at end of file +var _0x91f6=['Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','Content-Range','apply','reject','then','destroy','get','Triggers','sendStatus','error','stack','name','send','index','Trigger','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','params','include','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','findOne','order','getAllConditions','hasOwnProperty','limit','getAnyConditions','addAction'];(function(_0x12c2d0,_0x34975f){var _0x5d49b8=function(_0x25e795){while(--_0x25e795){_0x12c2d0['push'](_0x12c2d0['shift']());}};_0x5d49b8(++_0x34975f);}(_0x91f6,0x176));var _0x691f=function(_0x499557,_0x574d95){_0x499557=_0x499557-0x0;var _0x19d0c8=_0x91f6[_0x499557];return _0x19d0c8;};'use strict';var pdf=require(_0x691f('0x0'));var emlformat=require(_0x691f('0x1'));var rimraf=require(_0x691f('0x2'));var zipdir=require(_0x691f('0x3'));var jsonpatch=require(_0x691f('0x4'));var rp=require(_0x691f('0x5'));var moment=require(_0x691f('0x6'));var BPromise=require(_0x691f('0x7'));var Mustache=require(_0x691f('0x8'));var util=require('util');var path=require(_0x691f('0x9'));var sox=require(_0x691f('0xa'));var csv=require(_0x691f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x691f('0xc'));var squel=require(_0x691f('0xd'));var crypto=require(_0x691f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x691f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x691f('0x10'));var Papa=require(_0x691f('0x11'));var Redis=require(_0x691f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x691f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x691f('0x14'));var logger=require(_0x691f('0x15'))(_0x691f('0x16'));var utils=require(_0x691f('0x17'));var config=require(_0x691f('0x18'));var db=require(_0x691f('0x19'))['db'];function respondWithStatusCode(_0x172f3a,_0x10aea0){_0x10aea0=_0x10aea0||0xcc;return function(_0x409753){if(_0x409753){return _0x172f3a['sendStatus'](_0x10aea0);}return _0x172f3a[_0x691f('0x1a')](_0x10aea0)[_0x691f('0x1b')]();};}function respondWithResult(_0x165de6,_0x30a33b){_0x30a33b=_0x30a33b||0xc8;return function(_0x156208){if(_0x156208){return _0x165de6[_0x691f('0x1a')](_0x30a33b)[_0x691f('0x1c')](_0x156208);}};}function respondWithFilteredResult(_0x4e9be1,_0x11472b){return function(_0x21d1c8){if(_0x21d1c8){var _0x492ce2=_0x21d1c8['count'],_0x29762b=_0x11472b[_0x691f('0x1d')],_0x22ab15=_0x11472b[_0x691f('0x1d')]+_0x11472b['limit'],_0x41690c;if(_0x22ab15>=_0x492ce2){_0x22ab15=_0x492ce2;_0x41690c=0xc8;}else{_0x41690c=0xce;}_0x4e9be1[_0x691f('0x1a')](_0x41690c);return _0x4e9be1['set'](_0x691f('0x1e'),_0x29762b+'-'+_0x22ab15+'/'+_0x492ce2)[_0x691f('0x1c')](_0x21d1c8);}return null;};}function patchUpdates(_0x22437b){return function(_0x1179a4){try{jsonpatch[_0x691f('0x1f')](_0x1179a4,_0x22437b,!![]);}catch(_0x3a94fb){return BPromise[_0x691f('0x20')](_0x3a94fb);}return _0x1179a4['save']();};}function saveUpdates(_0x15101a,_0x1b723d){return function(_0x5c4b2d){if(_0x5c4b2d){return _0x5c4b2d['update'](_0x15101a)[_0x691f('0x21')](function(_0x3b88ff){return _0x3b88ff;});}return null;};}function removeEntity(_0x1fa10e,_0x143dcb){return function(_0x11785d){if(_0x11785d){return _0x11785d[_0x691f('0x22')]()[_0x691f('0x21')](function(){var _0x429955=_0x11785d[_0x691f('0x23')]({'plain':!![]});var _0x37d6e4=_0x691f('0x24');return db['UserProfileResource'][_0x691f('0x22')]({'where':{'type':_0x37d6e4,'resourceId':_0x429955['id']}})[_0x691f('0x21')](function(){return _0x11785d;});})['then'](function(){_0x1fa10e[_0x691f('0x1a')](0xcc)[_0x691f('0x1b')]();});}};}function handleEntityNotFound(_0x39f339,_0x306b1c){return function(_0x2c74ae){if(!_0x2c74ae){_0x39f339[_0x691f('0x25')](0x194);}return _0x2c74ae;};}function handleError(_0x2afd10,_0x18972c){_0x18972c=_0x18972c||0x1f4;return function(_0x4cbedb){logger[_0x691f('0x26')](_0x4cbedb[_0x691f('0x27')]);if(_0x4cbedb[_0x691f('0x28')]){delete _0x4cbedb['name'];}_0x2afd10[_0x691f('0x1a')](_0x18972c)[_0x691f('0x29')](_0x4cbedb);};}exports[_0x691f('0x2a')]=function(_0x5eaf13,_0x59becf){var _0x161e77={},_0x2a96a5={},_0x4bae9e={'count':0x0,'rows':[]};var _0x174b3c=_['map'](db[_0x691f('0x2b')][_0x691f('0x2c')],function(_0x1f9b6b){return{'name':_0x1f9b6b[_0x691f('0x2d')],'type':_0x1f9b6b[_0x691f('0x2e')][_0x691f('0x2f')]};});_0x2a96a5['model']=_[_0x691f('0x30')](_0x174b3c,_0x691f('0x28'));_0x2a96a5[_0x691f('0x31')]=_[_0x691f('0x32')](_0x5eaf13[_0x691f('0x31')]);_0x2a96a5['filters']=_[_0x691f('0x33')](_0x2a96a5[_0x691f('0x34')],_0x2a96a5[_0x691f('0x31')]);_0x161e77['attributes']=_['intersection'](_0x2a96a5['model'],qs[_0x691f('0x35')](_0x5eaf13['query'][_0x691f('0x35')]));_0x161e77[_0x691f('0x36')]=_0x161e77['attributes'][_0x691f('0x37')]?_0x161e77[_0x691f('0x36')]:_0x2a96a5[_0x691f('0x34')];if(!_0x5eaf13[_0x691f('0x31')]['hasOwnProperty'](_0x691f('0x38'))){_0x161e77['limit']=qs['limit'](_0x5eaf13[_0x691f('0x31')]['limit']);_0x161e77[_0x691f('0x1d')]=qs[_0x691f('0x1d')](_0x5eaf13[_0x691f('0x31')][_0x691f('0x1d')]);}_0x161e77['order']=qs['sort'](_0x5eaf13[_0x691f('0x31')][_0x691f('0x39')]);_0x161e77[_0x691f('0x3a')]=qs[_0x691f('0x3b')](_[_0x691f('0x3c')](_0x5eaf13['query'],_0x2a96a5[_0x691f('0x3b')]),_0x174b3c);if(_0x5eaf13[_0x691f('0x31')][_0x691f('0x3d')]){_0x161e77[_0x691f('0x3a')]=_[_0x691f('0x3e')](_0x161e77[_0x691f('0x3a')],{'$or':_['map'](_0x174b3c,function(_0x167f6c){if(_0x167f6c['type']!==_0x691f('0x3f')){var _0x51e1f3={};_0x51e1f3[_0x167f6c['name']]={'$like':'%'+_0x5eaf13[_0x691f('0x31')][_0x691f('0x3d')]+'%'};return _0x51e1f3;}})});}_0x161e77=_[_0x691f('0x3e')]({},_0x161e77,_0x5eaf13[_0x691f('0x40')]);var _0x1edaaf={'where':_0x161e77['where']};return db[_0x691f('0x2b')][_0x691f('0x41')](_0x1edaaf)[_0x691f('0x21')](function(_0x228da0){_0x4bae9e['count']=_0x228da0;if(_0x5eaf13['query'][_0x691f('0x42')]){_0x161e77['include']=[{'all':!![]}];}return db['Trigger']['findAll'](_0x161e77);})[_0x691f('0x21')](function(_0x5d8d36){_0x4bae9e[_0x691f('0x43')]=_0x5d8d36;return _0x4bae9e;})[_0x691f('0x21')](respondWithFilteredResult(_0x59becf,_0x161e77))[_0x691f('0x44')](handleError(_0x59becf,null));};exports['show']=function(_0x57145f,_0x519647){var _0x398fd1={'raw':![],'where':{'id':_0x57145f[_0x691f('0x45')]['id']}},_0x512d67={};_0x512d67[_0x691f('0x34')]=_[_0x691f('0x32')](db[_0x691f('0x2b')][_0x691f('0x2c')]);_0x512d67[_0x691f('0x31')]=_['keys'](_0x57145f['query']);_0x512d67[_0x691f('0x3b')]=_[_0x691f('0x33')](_0x512d67['model'],_0x512d67[_0x691f('0x31')]);_0x398fd1[_0x691f('0x36')]=_['intersection'](_0x512d67[_0x691f('0x34')],qs[_0x691f('0x35')](_0x57145f['query'][_0x691f('0x35')]));_0x398fd1['attributes']=_0x398fd1[_0x691f('0x36')][_0x691f('0x37')]?_0x398fd1[_0x691f('0x36')]:_0x512d67[_0x691f('0x34')];if(_0x57145f[_0x691f('0x31')]['includeAll']){_0x398fd1[_0x691f('0x46')]=[{'all':!![]}];}_0x398fd1=_[_0x691f('0x3e')]({},_0x398fd1,_0x57145f[_0x691f('0x40')]);return db[_0x691f('0x2b')][_0x691f('0x47')](_0x398fd1)['then'](handleEntityNotFound(_0x519647,null))['then'](respondWithResult(_0x519647,null))[_0x691f('0x44')](handleError(_0x519647,null));};exports['create']=function(_0x10036c,_0x3a363d){return db[_0x691f('0x2b')][_0x691f('0x48')](_0x10036c[_0x691f('0x49')],{})[_0x691f('0x21')](function(_0x5fae2f){var _0x1879b5=_0x10036c[_0x691f('0x4a')][_0x691f('0x23')]({'plain':!![]});if(!_0x1879b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1879b5[_0x691f('0x4b')]===_0x691f('0x4a')){var _0xe8327a=_0x5fae2f[_0x691f('0x23')]({'plain':!![]});var _0x21f665='Triggers';return db[_0x691f('0x4c')][_0x691f('0x47')]({'where':{'name':_0x21f665,'userProfileId':_0x1879b5[_0x691f('0x4d')]},'raw':!![]})['then'](function(_0x113a5a){if(_0x113a5a&&_0x113a5a['autoAssociation']===0x0){return db[_0x691f('0x4e')][_0x691f('0x48')]({'name':_0xe8327a[_0x691f('0x28')],'resourceId':_0xe8327a['id'],'type':_0x113a5a[_0x691f('0x28')],'sectionId':_0x113a5a['id']},{})[_0x691f('0x21')](function(){return _0x5fae2f;});}else{return _0x5fae2f;}})[_0x691f('0x44')](function(_0x2df6b8){logger[_0x691f('0x26')](_0x691f('0x4f'),_0x2df6b8);throw _0x2df6b8;});}return _0x5fae2f;})[_0x691f('0x21')](respondWithResult(_0x3a363d,0xc9))[_0x691f('0x44')](handleError(_0x3a363d,null));};exports[_0x691f('0x50')]=function(_0x58791b,_0x16adf5){if(_0x58791b[_0x691f('0x49')]['id']){delete _0x58791b[_0x691f('0x49')]['id'];}return db['Trigger'][_0x691f('0x47')]({'where':{'id':_0x58791b[_0x691f('0x45')]['id']}})['then'](handleEntityNotFound(_0x16adf5,null))['then'](saveUpdates(_0x58791b[_0x691f('0x49')],null))['then'](respondWithResult(_0x16adf5,null))['catch'](handleError(_0x16adf5,null));};exports[_0x691f('0x22')]=function(_0x45c29a,_0x4f536a){return db[_0x691f('0x2b')][_0x691f('0x47')]({'where':{'id':_0x45c29a[_0x691f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f536a,null))['then'](removeEntity(_0x4f536a,null))[_0x691f('0x44')](handleError(_0x4f536a,null));};exports[_0x691f('0x51')]=function(_0x4572a3,_0x50b923,_0x59f9ec){if(_0x4572a3[_0x691f('0x49')]['id']){delete _0x4572a3[_0x691f('0x49')]['id'];}return db[_0x691f('0x2b')]['find']({'where':{'id':_0x4572a3['params']['id']}})['then'](handleEntityNotFound(_0x50b923,null))[_0x691f('0x21')](function(_0x3c36d6){if(_0x3c36d6){_0x4572a3[_0x691f('0x49')][_0x691f('0x52')]=_0x3c36d6['id'];return db[_0x691f('0x53')]['create'](_0x4572a3[_0x691f('0x49')]);}})[_0x691f('0x21')](respondWithResult(_0x50b923,null))['catch'](handleError(_0x50b923,null));};exports['addAnyCondition']=function(_0x411b9c,_0x243120,_0xaa27b8){if(_0x411b9c['body']['id']){delete _0x411b9c[_0x691f('0x49')]['id'];}return db['Trigger'][_0x691f('0x47')]({'where':{'id':_0x411b9c[_0x691f('0x45')]['id']}})['then'](handleEntityNotFound(_0x243120,null))[_0x691f('0x21')](function(_0xd00228){if(_0xd00228){_0x411b9c['body']['TriggerAnyId']=_0xd00228['id'];return db[_0x691f('0x53')]['create'](_0x411b9c[_0x691f('0x49')]);}})[_0x691f('0x21')](respondWithResult(_0x243120,null))['catch'](handleError(_0x243120,null));};exports['getAllConditions']=function(_0x4eaa84,_0x2a6b4a,_0x28afb1){var _0x3196f0={};var _0x8121d={};var _0x2840f5;var _0x5f1455;return db[_0x691f('0x2b')][_0x691f('0x54')]({'where':{'id':_0x4eaa84[_0x691f('0x45')]['id']}})[_0x691f('0x21')](handleEntityNotFound(_0x2a6b4a,null))[_0x691f('0x21')](function(_0x29baa9){if(_0x29baa9){_0x2840f5=_0x29baa9;_0x8121d['model']=_[_0x691f('0x32')](db[_0x691f('0x53')][_0x691f('0x2c')]);_0x8121d[_0x691f('0x31')]=_[_0x691f('0x32')](_0x4eaa84[_0x691f('0x31')]);_0x8121d[_0x691f('0x3b')]=_[_0x691f('0x33')](_0x8121d['model'],_0x8121d['query']);_0x3196f0[_0x691f('0x36')]=_[_0x691f('0x33')](_0x8121d['model'],qs[_0x691f('0x35')](_0x4eaa84['query'][_0x691f('0x35')]));_0x3196f0[_0x691f('0x36')]=_0x3196f0[_0x691f('0x36')][_0x691f('0x37')]?_0x3196f0['attributes']:_0x8121d[_0x691f('0x34')];_0x3196f0[_0x691f('0x55')]=qs[_0x691f('0x39')](_0x4eaa84[_0x691f('0x31')][_0x691f('0x39')]);_0x3196f0[_0x691f('0x3a')]=qs[_0x691f('0x3b')](_['pick'](_0x4eaa84['query'],_0x8121d[_0x691f('0x3b')]));if(_0x4eaa84[_0x691f('0x31')][_0x691f('0x3d')]){_0x3196f0[_0x691f('0x3a')]=_[_0x691f('0x3e')](_0x3196f0[_0x691f('0x3a')],{'$or':_[_0x691f('0x30')](_0x3196f0[_0x691f('0x36')],function(_0x4ff4f8){var _0x4c3fa1={};_0x4c3fa1[_0x4ff4f8]={'$like':'%'+_0x4eaa84[_0x691f('0x31')][_0x691f('0x3d')]+'%'};return _0x4c3fa1;})});}_0x3196f0=_[_0x691f('0x3e')]({},_0x3196f0,_0x4eaa84[_0x691f('0x40')]);return _0x2840f5[_0x691f('0x56')](_0x3196f0);}})[_0x691f('0x21')](function(_0x84011){if(_0x84011){_0x5f1455=_0x84011[_0x691f('0x37')];if(!_0x4eaa84[_0x691f('0x31')][_0x691f('0x57')](_0x691f('0x38'))){_0x3196f0[_0x691f('0x58')]=qs[_0x691f('0x58')](_0x4eaa84['query'][_0x691f('0x58')]);_0x3196f0[_0x691f('0x1d')]=qs[_0x691f('0x1d')](_0x4eaa84[_0x691f('0x31')][_0x691f('0x1d')]);}return _0x2840f5[_0x691f('0x56')](_0x3196f0);}})[_0x691f('0x21')](function(_0x2bf6ad){if(_0x2bf6ad){return _0x2bf6ad?{'count':_0x5f1455,'rows':_0x2bf6ad}:null;}})['then'](respondWithResult(_0x2a6b4a,null))[_0x691f('0x44')](handleError(_0x2a6b4a,null));};exports['getAnyConditions']=function(_0x46749a,_0x38f76c,_0x50d0b9){var _0x3302f1={};var _0x3c24ea={};var _0x344994;var _0x336425;return db[_0x691f('0x2b')]['findOne']({'where':{'id':_0x46749a['params']['id']}})[_0x691f('0x21')](handleEntityNotFound(_0x38f76c,null))[_0x691f('0x21')](function(_0x57d041){if(_0x57d041){_0x344994=_0x57d041;_0x3c24ea['model']=_[_0x691f('0x32')](db[_0x691f('0x53')][_0x691f('0x2c')]);_0x3c24ea['query']=_[_0x691f('0x32')](_0x46749a['query']);_0x3c24ea[_0x691f('0x3b')]=_[_0x691f('0x33')](_0x3c24ea[_0x691f('0x34')],_0x3c24ea[_0x691f('0x31')]);_0x3302f1[_0x691f('0x36')]=_[_0x691f('0x33')](_0x3c24ea[_0x691f('0x34')],qs[_0x691f('0x35')](_0x46749a[_0x691f('0x31')][_0x691f('0x35')]));_0x3302f1[_0x691f('0x36')]=_0x3302f1[_0x691f('0x36')][_0x691f('0x37')]?_0x3302f1[_0x691f('0x36')]:_0x3c24ea[_0x691f('0x34')];_0x3302f1[_0x691f('0x55')]=qs[_0x691f('0x39')](_0x46749a['query'][_0x691f('0x39')]);_0x3302f1[_0x691f('0x3a')]=qs[_0x691f('0x3b')](_[_0x691f('0x3c')](_0x46749a['query'],_0x3c24ea['filters']));if(_0x46749a[_0x691f('0x31')][_0x691f('0x3d')]){_0x3302f1[_0x691f('0x3a')]=_[_0x691f('0x3e')](_0x3302f1[_0x691f('0x3a')],{'$or':_['map'](_0x3302f1['attributes'],function(_0x389d25){var _0x1d9d8a={};_0x1d9d8a[_0x389d25]={'$like':'%'+_0x46749a[_0x691f('0x31')]['filter']+'%'};return _0x1d9d8a;})});}_0x3302f1=_['merge']({},_0x3302f1,_0x46749a[_0x691f('0x40')]);return _0x344994['getAnyConditions'](_0x3302f1);}})[_0x691f('0x21')](function(_0x3291c6){if(_0x3291c6){_0x336425=_0x3291c6[_0x691f('0x37')];if(!_0x46749a[_0x691f('0x31')][_0x691f('0x57')]('nolimit')){_0x3302f1[_0x691f('0x58')]=qs[_0x691f('0x58')](_0x46749a[_0x691f('0x31')][_0x691f('0x58')]);_0x3302f1[_0x691f('0x1d')]=qs[_0x691f('0x1d')](_0x46749a[_0x691f('0x31')][_0x691f('0x1d')]);}return _0x344994[_0x691f('0x59')](_0x3302f1);}})[_0x691f('0x21')](function(_0x77c86b){if(_0x77c86b){return _0x77c86b?{'count':_0x336425,'rows':_0x77c86b}:null;}})[_0x691f('0x21')](respondWithResult(_0x38f76c,null))['catch'](handleError(_0x38f76c,null));};exports[_0x691f('0x5a')]=function(_0x38cffd,_0x3d0084,_0x47fe85){if(_0x38cffd[_0x691f('0x49')]['id']){delete _0x38cffd[_0x691f('0x49')]['id'];}return db[_0x691f('0x2b')][_0x691f('0x47')]({'where':{'id':_0x38cffd[_0x691f('0x45')]['id']}})[_0x691f('0x21')](handleEntityNotFound(_0x3d0084,null))[_0x691f('0x21')](function(_0x68b6e2){if(_0x68b6e2){_0x38cffd['body']['TriggerId']=_0x68b6e2['id'];return db[_0x691f('0x5b')][_0x691f('0x48')](_0x38cffd['body']);}})['then'](respondWithResult(_0x3d0084,null))[_0x691f('0x44')](handleError(_0x3d0084,null));};exports[_0x691f('0x5c')]=function(_0xc28d5e,_0x10decc,_0x5f6d05){var _0x29df17={};var _0x20999f={};var _0x3ed3f6;var _0x22f2bc;return db[_0x691f('0x2b')][_0x691f('0x54')]({'where':{'id':_0xc28d5e[_0x691f('0x45')]['id']}})[_0x691f('0x21')](handleEntityNotFound(_0x10decc,null))[_0x691f('0x21')](function(_0x5d67e0){if(_0x5d67e0){_0x3ed3f6=_0x5d67e0;_0x20999f[_0x691f('0x34')]=_[_0x691f('0x32')](db['Action'][_0x691f('0x2c')]);_0x20999f[_0x691f('0x31')]=_[_0x691f('0x32')](_0xc28d5e['query']);_0x20999f[_0x691f('0x3b')]=_[_0x691f('0x33')](_0x20999f['model'],_0x20999f[_0x691f('0x31')]);_0x29df17[_0x691f('0x36')]=_[_0x691f('0x33')](_0x20999f[_0x691f('0x34')],qs['fields'](_0xc28d5e[_0x691f('0x31')][_0x691f('0x35')]));_0x29df17['attributes']=_0x29df17['attributes']['length']?_0x29df17[_0x691f('0x36')]:_0x20999f[_0x691f('0x34')];_0x29df17['order']=qs[_0x691f('0x39')](_0xc28d5e[_0x691f('0x31')]['sort']);_0x29df17[_0x691f('0x3a')]=qs['filters'](_[_0x691f('0x3c')](_0xc28d5e[_0x691f('0x31')],_0x20999f[_0x691f('0x3b')]));if(_0xc28d5e[_0x691f('0x31')]['filter']){_0x29df17['where']=_[_0x691f('0x3e')](_0x29df17[_0x691f('0x3a')],{'$or':_[_0x691f('0x30')](_0x29df17[_0x691f('0x36')],function(_0x4c14c3){var _0x564607={};_0x564607[_0x4c14c3]={'$like':'%'+_0xc28d5e['query']['filter']+'%'};return _0x564607;})});}_0x29df17=_[_0x691f('0x3e')]({},_0x29df17,_0xc28d5e['options']);return _0x3ed3f6[_0x691f('0x5c')](_0x29df17);}})[_0x691f('0x21')](function(_0x343acd){if(_0x343acd){_0x22f2bc=_0x343acd[_0x691f('0x37')];if(!_0xc28d5e[_0x691f('0x31')][_0x691f('0x57')]('nolimit')){_0x29df17['limit']=qs['limit'](_0xc28d5e[_0x691f('0x31')]['limit']);_0x29df17[_0x691f('0x1d')]=qs['offset'](_0xc28d5e['query'][_0x691f('0x1d')]);}return _0x3ed3f6[_0x691f('0x5c')](_0x29df17);}})['then'](function(_0x392337){if(_0x392337){return _0x392337?{'count':_0x22f2bc,'rows':_0x392337}:null;}})[_0x691f('0x21')](respondWithResult(_0x10decc,null))[_0x691f('0x44')](handleError(_0x10decc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ed55993..b6fbafb 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','util'];(function(_0x8255fb,_0x30810a){var _0x56b4df=function(_0x12cc7a){while(--_0x12cc7a){_0x8255fb['push'](_0x8255fb['shift']());}};_0x56b4df(++_0x30810a);}(_0xdb28,0x106));var _0x8db2=function(_0x1d82dc,_0x50dc9b){_0x1d82dc=_0x1d82dc-0x0;var _0xfbc09d=_0xdb28[_0x1d82dc];return _0xfbc09d;};'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('./trigger.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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','util'];(function(_0x2166dd,_0x50bcba){var _0x5046ea=function(_0x650045){while(--_0x650045){_0x2166dd['push'](_0x2166dd['shift']());}};_0x5046ea(++_0x50bcba);}(_0xdb28,0x106));var _0x8db2=function(_0x15d34f,_0xfaf2de){_0x15d34f=_0x15d34f-0x0;var _0x57e6df=_0xdb28[_0x15d34f];return _0x57e6df;};'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('./trigger.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 3afa7dc..fbc5146 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 _0x7d25=['raw','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','attributes','limit','include','map','model','then','ShowTrigger','find'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x7d25,0x8a));var _0x57d2=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x7d25[_0x176329];return _0x31997c;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('Trigger,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('Trigger,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')]({'raw':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['where']||null:null,'attributes':_0x7d4cf1['options']?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x18')]||null:null,'limit':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x19')]||null:null,'include':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')],function(_0x456fe1){return{'model':db[_0x456fe1[_0x57d2('0x1c')]],'as':_0x456fe1['as'],'attributes':_0x456fe1[_0x57d2('0x18')],'include':_0x456fe1['include']?_[_0x57d2('0x1b')](_0x456fe1[_0x57d2('0x1a')],function(_0x3c7de8){return{'model':db[_0x3c7de8[_0x57d2('0x1c')]],'as':_0x3c7de8['as'],'attributes':_0x3c7de8[_0x57d2('0x18')],'include':_0x3c7de8['include']?_[_0x57d2('0x1b')](_0x3c7de8[_0x57d2('0x1a')],function(_0x995928){return{'model':db[_0x995928[_0x57d2('0x1c')]],'as':_0x995928['as'],'attributes':_0x995928[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x57d2('0x1d')](function(_0x9bdb11){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x9bdb11));_0x4a94e3(_0x9bdb11);})[_0x57d2('0x13')](function(_0x7c33f3){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x7c33f3[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x7c33f3['message']));});});};exports[_0x57d2('0x1e')]=function(_0x3da926){var _0x26e052=this;return new Promise(function(_0x3e017c,_0x484597){return db[_0x57d2('0x15')][_0x57d2('0x1f')]({'raw':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x20')]===undefined?!![]:![]:!![],'where':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x21')]||null:null,'attributes':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x18')]||null:null,'include':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x3da926['options'][_0x57d2('0x1a')],function(_0x1c4ea5){return{'model':db[_0x1c4ea5[_0x57d2('0x1c')]],'as':_0x1c4ea5['as'],'attributes':_0x1c4ea5[_0x57d2('0x18')],'include':_0x1c4ea5[_0x57d2('0x1a')]?_['map'](_0x1c4ea5['include'],function(_0x581ebc){return{'model':db[_0x581ebc['model']],'as':_0x581ebc['as'],'attributes':_0x581ebc[_0x57d2('0x18')],'include':_0x581ebc[_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x581ebc[_0x57d2('0x1a')],function(_0x13beac){return{'model':db[_0x13beac['model']],'as':_0x13beac['as'],'attributes':_0x13beac[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3378a6){logger[_0x57d2('0x9')](_0x57d2('0x1e'),_0x3da926);logger['debug'](_0x57d2('0x1e'),_0x3da926,JSON[_0x57d2('0xe')](_0x3378a6));_0x3e017c(_0x3378a6);})['catch'](function(_0xb33455){logger[_0x57d2('0xf')](_0x57d2('0x1e'),_0xb33455[_0x57d2('0x11')],_0x3da926);_0x484597(_0x26e052[_0x57d2('0xf')](0x1f4,_0xb33455[_0x57d2('0x11')]));});});}; \ No newline at end of file +var _0x7d25=['raw','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','attributes','limit','include','map','model','then','ShowTrigger','find'];(function(_0xd6aad,_0x3fd78e){var _0x1109e6=function(_0x37f59c){while(--_0x37f59c){_0xd6aad['push'](_0xd6aad['shift']());}};_0x1109e6(++_0x3fd78e);}(_0x7d25,0x8a));var _0x57d2=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x7d25[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('Trigger,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('Trigger,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')]({'raw':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['where']||null:null,'attributes':_0x7d4cf1['options']?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x18')]||null:null,'limit':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x19')]||null:null,'include':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')],function(_0x456fe1){return{'model':db[_0x456fe1[_0x57d2('0x1c')]],'as':_0x456fe1['as'],'attributes':_0x456fe1[_0x57d2('0x18')],'include':_0x456fe1['include']?_[_0x57d2('0x1b')](_0x456fe1[_0x57d2('0x1a')],function(_0x3c7de8){return{'model':db[_0x3c7de8[_0x57d2('0x1c')]],'as':_0x3c7de8['as'],'attributes':_0x3c7de8[_0x57d2('0x18')],'include':_0x3c7de8['include']?_[_0x57d2('0x1b')](_0x3c7de8[_0x57d2('0x1a')],function(_0x995928){return{'model':db[_0x995928[_0x57d2('0x1c')]],'as':_0x995928['as'],'attributes':_0x995928[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x57d2('0x1d')](function(_0x9bdb11){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x9bdb11));_0x4a94e3(_0x9bdb11);})[_0x57d2('0x13')](function(_0x7c33f3){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x7c33f3[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x7c33f3['message']));});});};exports[_0x57d2('0x1e')]=function(_0x3da926){var _0x26e052=this;return new Promise(function(_0x3e017c,_0x484597){return db[_0x57d2('0x15')][_0x57d2('0x1f')]({'raw':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x20')]===undefined?!![]:![]:!![],'where':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x21')]||null:null,'attributes':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x18')]||null:null,'include':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x3da926['options'][_0x57d2('0x1a')],function(_0x1c4ea5){return{'model':db[_0x1c4ea5[_0x57d2('0x1c')]],'as':_0x1c4ea5['as'],'attributes':_0x1c4ea5[_0x57d2('0x18')],'include':_0x1c4ea5[_0x57d2('0x1a')]?_['map'](_0x1c4ea5['include'],function(_0x581ebc){return{'model':db[_0x581ebc['model']],'as':_0x581ebc['as'],'attributes':_0x581ebc[_0x57d2('0x18')],'include':_0x581ebc[_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x581ebc[_0x57d2('0x1a')],function(_0x13beac){return{'model':db[_0x13beac['model']],'as':_0x13beac['as'],'attributes':_0x13beac[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3378a6){logger[_0x57d2('0x9')](_0x57d2('0x1e'),_0x3da926);logger['debug'](_0x57d2('0x1e'),_0x3da926,JSON[_0x57d2('0xe')](_0x3378a6));_0x3e017c(_0x3378a6);})['catch'](function(_0xb33455){logger[_0x57d2('0xf')](_0x57d2('0x1e'),_0xb33455[_0x57d2('0x11')],_0x3da926);_0x484597(_0x26e052[_0x57d2('0xf')](0x1f4,_0xb33455[_0x57d2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index fde521d..ca4a6b9 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 _0x032e=['post','/:id/clone','clone','create','update','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show'];(function(_0x16a1ba,_0x340a79){var _0x5a1fd4=function(_0x388d11){while(--_0x388d11){_0x16a1ba['push'](_0x16a1ba['shift']());}};_0x5a1fd4(++_0x340a79);}(_0x032e,0x124));var _0xe032=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x032e[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe032('0x3'));var interaction=require(_0xe032('0x4'));var config=require(_0xe032('0x5'));var controller=require(_0xe032('0x6'));router[_0xe032('0x7')]('/',auth[_0xe032('0x8')](),controller[_0xe032('0x9')]);router[_0xe032('0x7')](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')](_0xe032('0xd'),auth[_0xe032('0x8')](),controller[_0xe032('0xe')]);router[_0xe032('0xc')]('/',auth[_0xe032('0x8')](),controller[_0xe032('0xf')]);router['put'](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0x10')]);router[_0xe032('0x11')](_0xe032('0xa'),auth[_0xe032('0x8')](),controller[_0xe032('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7217=['./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x16a1dc,_0x2803a7){var _0x5dbe66=function(_0x29ea6d){while(--_0x29ea6d){_0x16a1dc['push'](_0x16a1dc['shift']());}};_0x5dbe66(++_0x2803a7);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')](_0x7721('0xd'),auth[_0x7721('0x8')](),controller[_0x7721('0xe')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['put'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0x11')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);module[_0x7721('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 a993e4a..bd9ffe4 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 _0x7fc0=['never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','nonat','update','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','yes','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','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(_0x515ac0,_0x511ab4){var _0x2fd164=function(_0x105a74){while(--_0x105a74){_0x515ac0['push'](_0x515ac0['shift']());}};_0x2fd164(++_0x511ab4);}(_0x7fc0,0xd8));var _0x07fc=function(_0x3e3064,_0x3dd6f5){_0x3e3064=_0x3e3064-0x0;var _0x4547e1=_0x7fc0[_0x3e3064];return _0x4547e1;};'use strict';var Sequelize=require(_0x07fc('0x0'));module[_0x07fc('0x1')]={'name':{'type':Sequelize[_0x07fc('0x2')],'allowNull':![],'unique':_0x07fc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x5'),_0x07fc('0x6'),_0x07fc('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x07fc('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x07fc('0x4')]('ALLOWED_NOT_SCREENED',_0x07fc('0x8'),_0x07fc('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0x07fc('0xa'),_0x07fc('0xb'),_0x07fc('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x07fc('0x2')]},'secret':{'type':Sequelize[_0x07fc('0x2')]},'md5secret':{'type':Sequelize[_0x07fc('0x2')]},'remotesecret':{'type':Sequelize[_0x07fc('0x2')]},'transport':{'type':Sequelize[_0x07fc('0x2')],'defaultValue':_0x07fc('0xd'),'set':function(_0x5f3276){this[_0x07fc('0xe')](_0x07fc('0xf'),_0x5f3276?_0x5f3276[_0x07fc('0x10')](','):null);},'get':function(){return this[_0x07fc('0x11')]('transport')?this[_0x07fc('0x11')](_0x07fc('0xf'))[_0x07fc('0x12')](','):null;},'comment':_0x07fc('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x07fc('0x14'),_0x07fc('0x15'),'shortinfo','inband','auto'),'defaultValue':_0x07fc('0x14')},'directmedia':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no','nonat','update',_0x07fc('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x07fc('0x2')]},'directmediadeny':{'type':Sequelize[_0x07fc('0x2')]},'nat':{'type':Sequelize[_0x07fc('0x2')],'defaultValue':_0x07fc('0x18'),'set':function(_0x485137){this[_0x07fc('0xe')](_0x07fc('0x19'),_0x485137?_0x485137['join'](','):null);},'get':function(){return this[_0x07fc('0x11')](_0x07fc('0x19'))?this[_0x07fc('0x11')]('nat')[_0x07fc('0x12')](','):null;},'comment':_0x07fc('0x1a')},'callgroup':{'type':Sequelize[_0x07fc('0x2')]},'namedcallgroup':{'type':Sequelize[_0x07fc('0x2')]},'pickupgroup':{'type':Sequelize[_0x07fc('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x07fc('0x2')]},'language':{'type':Sequelize[_0x07fc('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x07fc('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x07fc('0x2')],'defaultValue':_0x07fc('0x1b')},'allow':{'type':Sequelize[_0x07fc('0x2')],'allowNull':![],'defaultValue':_0x07fc('0x1c'),'set':function(_0x4638a6){this[_0x07fc('0xe')](_0x07fc('0x1d'),_0x4638a6?_0x4638a6['join'](';'):_0x07fc('0x1c'));},'get':function(){return this[_0x07fc('0x11')](_0x07fc('0x1d'))?this[_0x07fc('0x11')](_0x07fc('0x1d'))[_0x07fc('0x12')](';'):null;},'comment':_0x07fc('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x07fc('0x16'),'no')},'insecure':{'type':Sequelize[_0x07fc('0x2')],'defaultValue':_0x07fc('0x1f'),'set':function(_0x6771a){this[_0x07fc('0xe')](_0x07fc('0x20'),_0x6771a?_0x6771a['join'](','):null);},'get':function(){return this['getDataValue'](_0x07fc('0x20'))?this[_0x07fc('0x11')](_0x07fc('0x20'))[_0x07fc('0x12')](','):null;},'comment':_0x07fc('0x21')},'trustrpid':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x07fc('0x4')]('yes','no',_0x07fc('0x22'))},'promiscredir':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x07fc('0x16'),'no')},'accountcode':{'type':Sequelize[_0x07fc('0x23')](0xb)},'setvar':{'type':Sequelize[_0x07fc('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x07fc('0x24')},'amaflags':{'type':Sequelize[_0x07fc('0x2')]},'callcounter':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no'),'defaultValue':_0x07fc('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x07fc('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x07fc('0x16'),'no',_0x07fc('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x07fc('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'mailbox':{'type':Sequelize[_0x07fc('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x07fc('0x26'),_0x07fc('0x27'),_0x07fc('0x28'))},'session_expires':{'type':Sequelize[_0x07fc('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x07fc('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x07fc('0x4')]('uac',_0x07fc('0x29')),'defaultValue':_0x07fc('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x07fc('0x2')]},'fromdomain':{'type':Sequelize[_0x07fc('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no'),'defaultValue':_0x07fc('0x16')},'keepalive':{'type':Sequelize[_0x07fc('0x23')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x07fc('0x2')]},'rtptimeout':{'type':Sequelize[_0x07fc('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x07fc('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x07fc('0x4')]('yes','no',_0x07fc('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x07fc('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x07fc('0x23')](0xb)},'timerb':{'type':Sequelize[_0x07fc('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x07fc('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x07fc('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x07fc('0x2')]},'use_q850_reason':{'type':Sequelize[_0x07fc('0x2')]},'maxforwards':{'type':Sequelize[_0x07fc('0x23')](0xb)},'encryption':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'force_avp':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x07fc('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x07fc('0x16'),'no',_0x07fc('0x2b'),_0x07fc('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x07fc('0x2')]},'dtlscafile':{'type':Sequelize[_0x07fc('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x07fc('0x4')](_0x07fc('0x2d'),_0x07fc('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x07fc('0x2')]},'usereqphone':{'type':Sequelize[_0x07fc('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x07fc('0x2')]},'call_limit':{'type':Sequelize[_0x07fc('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x07fc('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x07fc('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x07fc('0x2')]},'mohinterpret':{'type':Sequelize[_0x07fc('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x07fc('0x2')]},'description':{'type':Sequelize[_0x07fc('0x2')]},'host':{'type':Sequelize[_0x07fc('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x07fc('0x4')]('yes','no',_0x07fc('0x2f'),_0x07fc('0x30'),_0x07fc('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x07fc('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x07fc('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x27fe=['fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','update','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai'];(function(_0x110a0a,_0x2a797e){var _0x3f239b=function(_0x51c926){while(--_0x51c926){_0x110a0a['push'](_0x110a0a['shift']());}};_0x3f239b(++_0x2a797e);}(_0x27fe,0x9d));var _0xe27f=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x27fe[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0xe27f('0x0'));module['exports']={'name':{'type':Sequelize[_0xe27f('0x1')],'allowNull':![],'unique':_0xe27f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe27f('0x1')],'allowNull':![],'defaultValue':_0xe27f('0x3')},'callingpres':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x5'),_0xe27f('0x6'),_0xe27f('0x7'),_0xe27f('0x8'),_0xe27f('0x9'),_0xe27f('0xa'),_0xe27f('0xb'),_0xe27f('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xe27f('0x1')]},'secret':{'type':Sequelize[_0xe27f('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xe27f('0x1')]},'transport':{'type':Sequelize[_0xe27f('0x1')],'defaultValue':'udp','set':function(_0x32c066){this[_0xe27f('0xd')](_0xe27f('0xe'),_0x32c066?_0x32c066[_0xe27f('0xf')](','):null);},'get':function(){return this[_0xe27f('0x10')]('transport')?this[_0xe27f('0x10')](_0xe27f('0xe'))[_0xe27f('0x11')](','):null;},'comment':_0xe27f('0x12')},'dtmfmode':{'type':Sequelize[_0xe27f('0x4')]('rfc2833',_0xe27f('0x13'),_0xe27f('0x14'),_0xe27f('0x15'),_0xe27f('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no',_0xe27f('0x18'),_0xe27f('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe27f('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe27f('0x1')]},'directmediadeny':{'type':Sequelize[_0xe27f('0x1')]},'nat':{'type':Sequelize[_0xe27f('0x1')],'defaultValue':_0xe27f('0x1a'),'set':function(_0x128638){this[_0xe27f('0xd')](_0xe27f('0x1b'),_0x128638?_0x128638['join'](','):null);},'get':function(){return this[_0xe27f('0x10')]('nat')?this[_0xe27f('0x10')](_0xe27f('0x1b'))[_0xe27f('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe27f('0x1')]},'namedcallgroup':{'type':Sequelize[_0xe27f('0x1')]},'pickupgroup':{'type':Sequelize[_0xe27f('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe27f('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe27f('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe27f('0x1')],'allowNull':![],'defaultValue':_0xe27f('0x1c'),'set':function(_0x240f59){this['setDataValue'](_0xe27f('0x1d'),_0x240f59?_0x240f59[_0xe27f('0xf')](';'):_0xe27f('0x1c'));},'get':function(){return this[_0xe27f('0x10')](_0xe27f('0x1d'))?this[_0xe27f('0x10')](_0xe27f('0x1d'))[_0xe27f('0x11')](';'):null;},'comment':_0xe27f('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xe27f('0x1f'),'set':function(_0x155881){this[_0xe27f('0xd')]('insecure',_0x155881?_0x155881['join'](','):null);},'get':function(){return this[_0xe27f('0x10')]('insecure')?this[_0xe27f('0x10')](_0xe27f('0x20'))[_0xe27f('0x11')](','):null;},'comment':_0xe27f('0x21')},'trustrpid':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe27f('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe27f('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no')},'accountcode':{'type':Sequelize[_0xe27f('0x22')](0xb)},'setvar':{'type':Sequelize[_0xe27f('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xe27f('0x23')},'amaflags':{'type':Sequelize[_0xe27f('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no'),'defaultValue':_0xe27f('0x17')},'busylevel':{'type':Sequelize[_0xe27f('0x22')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe27f('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xe27f('0x1')]},'template':{'type':Sequelize[_0xe27f('0x1')]},'videosupport':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no',_0xe27f('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe27f('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no')},'mailbox':{'type':Sequelize[_0xe27f('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0xe27f('0x25'),_0xe27f('0x26'),_0xe27f('0x27'))},'session_expires':{'type':Sequelize[_0xe27f('0x22')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x28'),_0xe27f('0x29')),'defaultValue':_0xe27f('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xe27f('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe27f('0x22')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no'),'defaultValue':_0xe27f('0x17')},'keepalive':{'type':Sequelize[_0xe27f('0x22')](0xb)},'defaultip':{'type':Sequelize[_0xe27f('0x1')]},'defaultuser':{'type':Sequelize[_0xe27f('0x1')]},'rtptimeout':{'type':Sequelize[_0xe27f('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe27f('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe27f('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no',_0xe27f('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe27f('0x1')]},'callbackextension':{'type':Sequelize[_0xe27f('0x1')]},'timert1':{'type':Sequelize[_0xe27f('0x22')](0xb)},'timerb':{'type':Sequelize[_0xe27f('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe27f('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xe27f('0x1')]},'contactdeny':{'type':Sequelize[_0xe27f('0x1')]},'contactacl':{'type':Sequelize[_0xe27f('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xe27f('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xe27f('0x22')](0xb)},'encryption':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no')},'force_avp':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no')},'icesupport':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no',_0xe27f('0x2b'),_0xe27f('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xe27f('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0xe27f('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xe27f('0x1')]},'dtlscipher':{'type':Sequelize[_0xe27f('0x1')]},'dtlscafile':{'type':Sequelize[_0xe27f('0x1')]},'dtlscapath':{'type':Sequelize[_0xe27f('0x1')]},'dtlssetup':{'type':Sequelize[_0xe27f('0x4')]('active',_0xe27f('0x2d'),_0xe27f('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe27f('0x1')]},'recordofffeature':{'type':Sequelize[_0xe27f('0x1')]},'call_limit':{'type':Sequelize[_0xe27f('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe27f('0x4')](_0xe27f('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xe27f('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xe27f('0x1')]},'mohsuggest':{'type':Sequelize[_0xe27f('0x1')]},'parkinglot':{'type':Sequelize[_0xe27f('0x1')]},'description':{'type':Sequelize[_0xe27f('0x1')]},'host':{'type':Sequelize[_0xe27f('0x1')],'defaultValue':_0xe27f('0x2f')},'canreinvite':{'type':Sequelize[_0xe27f('0x4')]('yes','no','nonat',_0xe27f('0x19'),_0xe27f('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe27f('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xe27f('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe27f('0x1')],'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 f4e12a6..d944721 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 _0x2f68=['pick','filters','filter','type','VIRTUAL','merge','options','includeAll','include','Trunk','catch','show','params','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','autoAssociation','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','Trunks','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x1f1fbb,_0x4124c6){var _0x24b173=function(_0x25e251){while(--_0x25e251){_0x1f1fbb['push'](_0x1f1fbb['shift']());}};_0x24b173(++_0x4124c6);}(_0x2f68,0x9a));var _0x82f6=function(_0x5bad4b,_0x5c44a6){_0x5bad4b=_0x5bad4b-0x0;var _0x53a64b=_0x2f68[_0x5bad4b];return _0x53a64b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82f6('0x0'));var rimraf=require(_0x82f6('0x1'));var zipdir=require(_0x82f6('0x2'));var jsonpatch=require(_0x82f6('0x3'));var rp=require('request-promise');var moment=require(_0x82f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82f6('0x5'));var util=require(_0x82f6('0x6'));var path=require('path');var sox=require(_0x82f6('0x7'));var csv=require(_0x82f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x8'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x82f6('0x14'));var client=jayson[_0x82f6('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x194da7,_0x1f8bf5,_0x397527){if(_0x397527){var _0x465e5d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x465e5d[_0x82f6('0x16')](_0x1f8bf5)){return _0x194da7;}else{throw new db[(_0x82f6('0x17'))][(_0x82f6('0x18'))](_0x82f6('0x19'));}}else{return _0x194da7;}}function respondWithRpcPromise(_0x1e7cbc,_0x55b58e,_0x389949,_0x5d0827){return new BPromise(function(_0x249222,_0x1d0263){var _0x31b4fb=_0x5d0827||client;return _0x31b4fb[_0x82f6('0x1a')](_0x1e7cbc,_0x389949)[_0x82f6('0x1b')](function(_0x2326ae){logger[_0x82f6('0x1c')](_0x82f6('0x1d'),_0x55b58e,_0x82f6('0x1e'));logger[_0x82f6('0x1f')](_0x82f6('0x20'),_0x55b58e,_0x82f6('0x1e'),JSON[_0x82f6('0x21')](_0x2326ae));if(_0x2326ae[_0x82f6('0x22')]){if(_0x2326ae[_0x82f6('0x22')]['code']===0x1f4){logger[_0x82f6('0x22')](_0x82f6('0x1d'),_0x55b58e,_0x2326ae['error'][_0x82f6('0x23')]);return _0x1d0263(_0x2326ae[_0x82f6('0x22')][_0x82f6('0x23')]);}logger[_0x82f6('0x22')]('Trunk,\x20%s,\x20%s',_0x55b58e,_0x2326ae[_0x82f6('0x22')]['message']);return _0x249222(_0x2326ae[_0x82f6('0x22')][_0x82f6('0x23')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x55b58e,_0x82f6('0x1e'));_0x249222(_0x2326ae[_0x82f6('0x24')]['message']);}})['catch'](function(_0x9f2272){logger[_0x82f6('0x22')]('Trunk,\x20%s,\x20%s',_0x55b58e,_0x9f2272);_0x1d0263(_0x9f2272);});});}function respondWithStatusCode(_0xfd8b68,_0x304e83){_0x304e83=_0x304e83||0xcc;return function(_0x5037f8){if(_0x5037f8){return _0xfd8b68['sendStatus'](_0x304e83);}return _0xfd8b68[_0x82f6('0x25')](_0x304e83)['end']();};}function respondWithResult(_0x469b6b,_0x5a6d69){_0x5a6d69=_0x5a6d69||0xc8;return function(_0x54ce11){if(_0x54ce11){return _0x469b6b[_0x82f6('0x25')](_0x5a6d69)[_0x82f6('0x26')](_0x54ce11);}};}function respondWithFilteredResult(_0x33ef08,_0x1125a0){return function(_0x4f9fa4){if(_0x4f9fa4){var _0x40a071=_0x4f9fa4[_0x82f6('0x27')],_0x1fb461=_0x1125a0[_0x82f6('0x28')],_0x14a309=_0x1125a0[_0x82f6('0x28')]+_0x1125a0[_0x82f6('0x29')],_0x400137;if(_0x14a309>=_0x40a071){_0x14a309=_0x40a071;_0x400137=0xc8;}else{_0x400137=0xce;}_0x33ef08[_0x82f6('0x25')](_0x400137);return _0x33ef08[_0x82f6('0x2a')](_0x82f6('0x2b'),_0x1fb461+'-'+_0x14a309+'/'+_0x40a071)[_0x82f6('0x26')](_0x4f9fa4);}return null;};}function patchUpdates(_0x6ce179){return function(_0x91117b){try{jsonpatch['apply'](_0x91117b,_0x6ce179,!![]);}catch(_0x3bbf5c){return BPromise[_0x82f6('0x2c')](_0x3bbf5c);}return _0x91117b[_0x82f6('0x2d')]();};}function saveUpdates(_0x5a51b4,_0x36f37a){return function(_0x3807c0){if(_0x3807c0){return _0x3807c0[_0x82f6('0x2e')](_0x5a51b4)[_0x82f6('0x1b')](function(_0x41cd65){return _0x41cd65;});}return null;};}function removeEntity(_0x457f09,_0x37025c){return function(_0x299c36){if(_0x299c36){return _0x299c36[_0x82f6('0x2f')]()[_0x82f6('0x1b')](function(){var _0x38942c=_0x299c36[_0x82f6('0x30')]({'plain':!![]});var _0x1e028a=_0x82f6('0x31');return db['UserProfileResource'][_0x82f6('0x2f')]({'where':{'type':_0x1e028a,'resourceId':_0x38942c['id']}})[_0x82f6('0x1b')](function(){return _0x299c36;});})[_0x82f6('0x1b')](function(){_0x457f09[_0x82f6('0x25')](0xcc)[_0x82f6('0x32')]();});}};}function handleEntityNotFound(_0x4390a9,_0x34c2f1){return function(_0x383987){if(!_0x383987){_0x4390a9[_0x82f6('0x33')](0x194);}return _0x383987;};}function handleError(_0x30c6f8,_0x458041){_0x458041=_0x458041||0x1f4;return function(_0x28a740){logger[_0x82f6('0x22')](_0x28a740[_0x82f6('0x34')]);if(_0x28a740['name']){delete _0x28a740[_0x82f6('0x35')];}_0x30c6f8['status'](_0x458041)['send'](_0x28a740);};}exports[_0x82f6('0x36')]=function(_0x18c81e,_0x5e8828){var _0x249cae={},_0x3a3ccb={},_0xb7146b={'count':0x0,'rows':[]};var _0x56e5f1=_[_0x82f6('0x37')](db['Trunk'][_0x82f6('0x38')],function(_0x5f48cf){return{'name':_0x5f48cf[_0x82f6('0x39')],'type':_0x5f48cf['type'][_0x82f6('0x3a')]};});_0x3a3ccb[_0x82f6('0x3b')]=_['map'](_0x56e5f1,_0x82f6('0x35'));_0x3a3ccb[_0x82f6('0x3c')]=_[_0x82f6('0x3d')](_0x18c81e[_0x82f6('0x3c')]);_0x3a3ccb['filters']=_[_0x82f6('0x3e')](_0x3a3ccb[_0x82f6('0x3b')],_0x3a3ccb[_0x82f6('0x3c')]);_0x249cae[_0x82f6('0x3f')]=_['intersection'](_0x3a3ccb[_0x82f6('0x3b')],qs[_0x82f6('0x40')](_0x18c81e['query'][_0x82f6('0x40')]));_0x249cae[_0x82f6('0x3f')]=_0x249cae[_0x82f6('0x3f')][_0x82f6('0x41')]?_0x249cae[_0x82f6('0x3f')]:_0x3a3ccb['model'];if(!_0x18c81e[_0x82f6('0x3c')]['hasOwnProperty'](_0x82f6('0x42'))){_0x249cae[_0x82f6('0x29')]=qs[_0x82f6('0x29')](_0x18c81e[_0x82f6('0x3c')][_0x82f6('0x29')]);_0x249cae[_0x82f6('0x28')]=qs[_0x82f6('0x28')](_0x18c81e['query'][_0x82f6('0x28')]);}_0x249cae[_0x82f6('0x43')]=qs[_0x82f6('0x44')](_0x18c81e[_0x82f6('0x3c')]['sort']);_0x249cae[_0x82f6('0x45')]=qs['filters'](_[_0x82f6('0x46')](_0x18c81e[_0x82f6('0x3c')],_0x3a3ccb[_0x82f6('0x47')]),_0x56e5f1);if(_0x18c81e[_0x82f6('0x3c')][_0x82f6('0x48')]){_0x249cae[_0x82f6('0x45')]=_['merge'](_0x249cae[_0x82f6('0x45')],{'$or':_[_0x82f6('0x37')](_0x56e5f1,function(_0x14a3c4){if(_0x14a3c4[_0x82f6('0x49')]!==_0x82f6('0x4a')){var _0x95c1fa={};_0x95c1fa[_0x14a3c4[_0x82f6('0x35')]]={'$like':'%'+_0x18c81e[_0x82f6('0x3c')]['filter']+'%'};return _0x95c1fa;}})});}_0x249cae=_[_0x82f6('0x4b')]({},_0x249cae,_0x18c81e[_0x82f6('0x4c')]);var _0x4bacd7={'where':_0x249cae[_0x82f6('0x45')]};return db['Trunk'][_0x82f6('0x27')](_0x4bacd7)['then'](function(_0x227ab8){_0xb7146b[_0x82f6('0x27')]=_0x227ab8;if(_0x18c81e[_0x82f6('0x3c')][_0x82f6('0x4d')]){_0x249cae[_0x82f6('0x4e')]=[{'all':!![]}];}return db[_0x82f6('0x4f')]['findAll'](_0x249cae);})[_0x82f6('0x1b')](function(_0xdc77ca){_0xb7146b['rows']=_0xdc77ca;return _0xb7146b;})['then'](respondWithFilteredResult(_0x5e8828,_0x249cae))[_0x82f6('0x50')](handleError(_0x5e8828,null));};exports[_0x82f6('0x51')]=function(_0x2c2b64,_0x596360){var _0x1f7abc={'raw':![],'where':{'id':_0x2c2b64[_0x82f6('0x52')]['id']}},_0x7614da={};_0x7614da[_0x82f6('0x3b')]=_['keys'](db['Trunk'][_0x82f6('0x38')]);_0x7614da[_0x82f6('0x3c')]=_[_0x82f6('0x3d')](_0x2c2b64['query']);_0x7614da[_0x82f6('0x47')]=_[_0x82f6('0x3e')](_0x7614da['model'],_0x7614da['query']);_0x1f7abc['attributes']=_[_0x82f6('0x3e')](_0x7614da['model'],qs[_0x82f6('0x40')](_0x2c2b64['query'][_0x82f6('0x40')]));_0x1f7abc['attributes']=_0x1f7abc[_0x82f6('0x3f')]['length']?_0x1f7abc[_0x82f6('0x3f')]:_0x7614da[_0x82f6('0x3b')];if(_0x2c2b64[_0x82f6('0x3c')][_0x82f6('0x4d')]){_0x1f7abc[_0x82f6('0x4e')]=[{'all':!![]}];}_0x1f7abc=_[_0x82f6('0x4b')]({},_0x1f7abc,_0x2c2b64['options']);return db[_0x82f6('0x4f')][_0x82f6('0x53')](_0x1f7abc)[_0x82f6('0x1b')](handleEntityNotFound(_0x596360,null))['then'](respondWithResult(_0x596360,null))['catch'](handleError(_0x596360,null));};exports[_0x82f6('0x54')]=function(_0x81e595,_0x39ebce){var _0x6932b1={'where':{'id':_0x81e595[_0x82f6('0x52')]['id']}},_0x49a204={};_0x49a204[_0x82f6('0x3b')]=_[_0x82f6('0x3d')](db['Trunk']['rawAttributes']);_0x6932b1['attributes']=_[_0x82f6('0x3e')](_0x49a204[_0x82f6('0x3b')],qs[_0x82f6('0x40')](_0x81e595[_0x82f6('0x3c')][_0x82f6('0x40')]));_0x6932b1[_0x82f6('0x3f')]=_0x6932b1[_0x82f6('0x3f')][_0x82f6('0x41')]?_0x6932b1['attributes']:_0x49a204[_0x82f6('0x3b')];if(_0x81e595[_0x82f6('0x3c')][_0x82f6('0x4d')]){_0x6932b1[_0x82f6('0x4e')]=[{'all':!![]}];}_0x6932b1=_['merge']({},_0x6932b1,_0x81e595['options']);return db[_0x82f6('0x4f')][_0x82f6('0x53')](_0x6932b1)['then'](handleEntityNotFound(_0x39ebce,null))[_0x82f6('0x1b')](function(_0xa12f6e){if(_0xa12f6e){var _0x404d09=_0xa12f6e['get']({'plain':!![]});_0x404d09=qs[_0x82f6('0x55')](_0x404d09,['id',_0x82f6('0x56'),_0x82f6('0x57')]);_0x81e595[_0x82f6('0x58')]=_[_0x82f6('0x55')](_0x81e595[_0x82f6('0x58')],['id','createdAt',_0x82f6('0x57')]);return db[_0x82f6('0x4f')][_0x82f6('0x59')](_[_0x82f6('0x4b')](_0x404d09,_0x81e595[_0x82f6('0x58')]),{'include':_0x81e595['query'][_0x82f6('0x4d')]?[{'all':!![]}]:undefined})[_0x82f6('0x1b')](function(_0x182ad8){var _0x2ba70b=_0x81e595[_0x82f6('0x5a')][_0x82f6('0x30')]({'plain':!![]});if(!_0x2ba70b)throw new Error(_0x82f6('0x5b'));if(_0x2ba70b[_0x82f6('0x5c')]==='user'){var _0x22964c=_0x182ad8['get']({'plain':!![]});var _0x3f0337=_0x82f6('0x31');return db['UserProfileSection'][_0x82f6('0x53')]({'where':{'name':_0x3f0337,'userProfileId':_0x2ba70b[_0x82f6('0x5d')]},'raw':!![]})[_0x82f6('0x1b')](function(_0x5705f2){if(_0x5705f2&&_0x5705f2['autoAssociation']===0x0){return db[_0x82f6('0x5e')][_0x82f6('0x59')]({'name':_0x22964c['name'],'resourceId':_0x22964c['id'],'type':_0x5705f2['name'],'sectionId':_0x5705f2['id']},{})[_0x82f6('0x1b')](function(){return _0x182ad8;});}else{return _0x182ad8;}})[_0x82f6('0x50')](function(_0x1c37d2){logger[_0x82f6('0x22')](_0x82f6('0x5f'),_0x1c37d2);throw _0x1c37d2;});}return _0x182ad8;});}})[_0x82f6('0x1b')](respondWithResult(_0x39ebce,0xc9))[_0x82f6('0x50')](handleError(_0x39ebce,null));};exports[_0x82f6('0x59')]=function(_0x2d0d7c,_0x353508,_0x385902){var _0x41354f;return db['Trunk'][_0x82f6('0x59')](_0x2d0d7c[_0x82f6('0x58')],{'raw':!![]})[_0x82f6('0x1b')](function(_0x27b160){_0x41354f=_0x27b160;return db[_0x82f6('0x4f')]['findAll']({'raw':!![]});})[_0x82f6('0x1b')](function(_0x46d5af){var _0x337050=fs['readFileSync'](path[_0x82f6('0x60')](config[_0x82f6('0x61')],_0x82f6('0x62')),_0x82f6('0x63'));var _0xeec407=fs[_0x82f6('0x64')](path[_0x82f6('0x60')](config['root'],_0x82f6('0x65')),'utf8');var _0x28f36a=ejs[_0x82f6('0x66')](_0x337050,{'trunks':_0x46d5af||[]});fs[_0x82f6('0x67')](_0x82f6('0x68'),_0x28f36a);if(_0x41354f[_0x82f6('0x69')]){var _0x341fde=ejs[_0x82f6('0x66')](_0xeec407,{'trunks':_0x46d5af||[]});fs[_0x82f6('0x67')](_0x82f6('0x6a'),_0x341fde);}})['then'](function(){return respondWithRpcPromise(_0x82f6('0x6b'),_0x82f6('0x59'),{'module':_0x82f6('0x6c')});})[_0x82f6('0x1b')](function(){var _0x36599f=_0x2d0d7c[_0x82f6('0x5a')]['get']({'plain':!![]});if(!_0x36599f)throw new Error(_0x82f6('0x5b'));if(_0x36599f[_0x82f6('0x5c')]==='user'){var _0x51ba65=_0x41354f[_0x82f6('0x30')]({'plain':!![]});return db[_0x82f6('0x6d')][_0x82f6('0x53')]({'where':{'name':_0x82f6('0x31'),'userProfileId':_0x36599f[_0x82f6('0x5d')]},'raw':!![]})[_0x82f6('0x1b')](function(_0x5bf933){if(_0x5bf933&&_0x5bf933[_0x82f6('0x6e')]===0x0){return db['UserProfileResource'][_0x82f6('0x59')]({'name':_0x51ba65['name'],'resourceId':_0x51ba65['id'],'type':_0x5bf933[_0x82f6('0x35')],'sectionId':_0x5bf933['id']},{})['then'](function(){return _0x41354f;});}else{return _0x41354f;}})[_0x82f6('0x50')](function(_0xc21e55){logger[_0x82f6('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc21e55);throw _0xc21e55;});}return _0x41354f;})[_0x82f6('0x1b')](respondWithResult(_0x353508,0xc9))['catch'](handleError(_0x353508,null));};exports[_0x82f6('0x2e')]=function(_0x476ecb,_0x3e69f6,_0x4d1bfd){var _0x2646b2;return db[_0x82f6('0x4f')][_0x82f6('0x53')]({'where':{'id':_0x476ecb['params']['id']}})['then'](handleEntityNotFound(_0x3e69f6,null))[_0x82f6('0x1b')](saveUpdates(_0x476ecb[_0x82f6('0x58')],null))[_0x82f6('0x1b')](function(_0x1a1082){if(_0x1a1082){_0x2646b2=_0x1a1082;return db[_0x82f6('0x4f')][_0x82f6('0x6f')]({'raw':!![]});}})[_0x82f6('0x1b')](function(_0x286f4e){if(_0x286f4e){var _0x4df767=fs[_0x82f6('0x64')](path[_0x82f6('0x60')](config['root'],_0x82f6('0x62')),_0x82f6('0x63'));var _0x1c1901=fs['readFileSync'](path[_0x82f6('0x60')](config[_0x82f6('0x61')],_0x82f6('0x65')),_0x82f6('0x63'));var _0x50ab5c=ejs[_0x82f6('0x66')](_0x4df767,{'trunks':_0x286f4e||[]});fs[_0x82f6('0x67')](_0x82f6('0x68'),_0x50ab5c);var _0x320ccc=ejs[_0x82f6('0x66')](_0x1c1901,{'trunks':_0x286f4e||[]});fs[_0x82f6('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x320ccc);return respondWithRpcPromise(_0x82f6('0x6b'),_0x82f6('0x2e'),{'module':_0x82f6('0x6c')});}return null;})[_0x82f6('0x1b')](function(_0x3f2033){if(_0x3f2033){return _0x2646b2;}})['then'](respondWithResult(_0x3e69f6,null))[_0x82f6('0x50')](handleError(_0x3e69f6,null));};exports['destroy']=function(_0x455afa,_0x1d545a,_0x425e33){var _0xc580c1;return db[_0x82f6('0x4f')][_0x82f6('0x53')]({'where':{'id':_0x455afa[_0x82f6('0x52')]['id']}})['then'](handleEntityNotFound(_0x1d545a,null))[_0x82f6('0x1b')](removeEntity(_0x1d545a,null))[_0x82f6('0x1b')](function(){return db['Trunk'][_0x82f6('0x6f')]({'raw':!![]});})[_0x82f6('0x1b')](function(_0xadf40b){var _0x5c65c7=fs[_0x82f6('0x64')](path['join'](config[_0x82f6('0x61')],_0x82f6('0x62')),'utf8');var _0x450f3e=fs[_0x82f6('0x64')](path[_0x82f6('0x60')](config[_0x82f6('0x61')],'server/files/templates/registry.ejs'),_0x82f6('0x63'));var _0x51b830=ejs['render'](_0x5c65c7,{'trunks':_0xadf40b});var _0x463cd6=ejs[_0x82f6('0x66')](_0x450f3e,{'trunks':_0xadf40b});fs[_0x82f6('0x67')](_0x82f6('0x68'),_0x51b830);fs[_0x82f6('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x463cd6);return respondWithRpcPromise('Reload',_0x82f6('0x2f'),{'module':'chan_sip.so'});})[_0x82f6('0x50')](handleError(_0x1d545a,null));}; \ No newline at end of file +var _0x1eba=['render','/etc/asterisk/sip_xcally_trunks.conf','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','length','find','clone','omit','createdAt','updatedAt','body','user','role','Trunks','autoAssociation','create','readFileSync','join','root','utf8','server/files/templates/registry.ejs'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x1eba[_0xccf869];return _0x21a9db;};'use strict';var pdf=require(_0xa1eb('0x0'));var emlformat=require(_0xa1eb('0x1'));var rimraf=require(_0xa1eb('0x2'));var zipdir=require(_0xa1eb('0x3'));var jsonpatch=require(_0xa1eb('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1eb('0x5'));var Mustache=require(_0xa1eb('0x6'));var util=require(_0xa1eb('0x7'));var path=require(_0xa1eb('0x8'));var sox=require(_0xa1eb('0x9'));var csv=require(_0xa1eb('0xa'));var ejs=require(_0xa1eb('0xb'));var fs=require('fs');var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa1eb('0x18'));var client=jayson[_0xa1eb('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x16a623,_0x4a3774,_0x4e65dc){if(_0x4e65dc){var _0x35a353=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35a353['test'](_0x4a3774)){return _0x16a623;}else{throw new db[(_0xa1eb('0x1a'))][(_0xa1eb('0x1b'))](_0xa1eb('0x1c'));}}else{return _0x16a623;}}function respondWithRpcPromise(_0x2877cb,_0x3cd675,_0x44f37d,_0x1c858c){return new BPromise(function(_0x45d6dd,_0x211e42){var _0x4aa527=_0x1c858c||client;return _0x4aa527[_0xa1eb('0x1d')](_0x2877cb,_0x44f37d)['then'](function(_0x1401ef){logger[_0xa1eb('0x1e')](_0xa1eb('0x1f'),_0x3cd675,_0xa1eb('0x20'));logger['debug'](_0xa1eb('0x21'),_0x3cd675,_0xa1eb('0x20'),JSON[_0xa1eb('0x22')](_0x1401ef));if(_0x1401ef[_0xa1eb('0x23')]){if(_0x1401ef[_0xa1eb('0x23')][_0xa1eb('0x24')]===0x1f4){logger[_0xa1eb('0x23')](_0xa1eb('0x1f'),_0x3cd675,_0x1401ef['error'][_0xa1eb('0x25')]);return _0x211e42(_0x1401ef['error'][_0xa1eb('0x25')]);}logger[_0xa1eb('0x23')](_0xa1eb('0x1f'),_0x3cd675,_0x1401ef[_0xa1eb('0x23')]['message']);return _0x45d6dd(_0x1401ef['error'][_0xa1eb('0x25')]);}else{logger[_0xa1eb('0x1e')]('Trunk,\x20%s,\x20%s',_0x3cd675,_0xa1eb('0x20'));_0x45d6dd(_0x1401ef[_0xa1eb('0x26')][_0xa1eb('0x25')]);}})[_0xa1eb('0x27')](function(_0x23b49e){logger[_0xa1eb('0x23')](_0xa1eb('0x1f'),_0x3cd675,_0x23b49e);_0x211e42(_0x23b49e);});});}function respondWithStatusCode(_0x364b1c,_0xd7bb88){_0xd7bb88=_0xd7bb88||0xcc;return function(_0x352796){if(_0x352796){return _0x364b1c[_0xa1eb('0x28')](_0xd7bb88);}return _0x364b1c[_0xa1eb('0x29')](_0xd7bb88)['end']();};}function respondWithResult(_0x7c617e,_0xbd5517){_0xbd5517=_0xbd5517||0xc8;return function(_0x491f37){if(_0x491f37){return _0x7c617e[_0xa1eb('0x29')](_0xbd5517)['json'](_0x491f37);}};}function respondWithFilteredResult(_0x3aae71,_0x2d31d1){return function(_0x53a890){if(_0x53a890){var _0x45ff0d=_0x53a890[_0xa1eb('0x2a')],_0x1581ee=_0x2d31d1[_0xa1eb('0x2b')],_0x136835=_0x2d31d1['offset']+_0x2d31d1[_0xa1eb('0x2c')],_0x4f64bb;if(_0x136835>=_0x45ff0d){_0x136835=_0x45ff0d;_0x4f64bb=0xc8;}else{_0x4f64bb=0xce;}_0x3aae71[_0xa1eb('0x29')](_0x4f64bb);return _0x3aae71[_0xa1eb('0x2d')](_0xa1eb('0x2e'),_0x1581ee+'-'+_0x136835+'/'+_0x45ff0d)[_0xa1eb('0x2f')](_0x53a890);}return null;};}function patchUpdates(_0x52f9c7){return function(_0x9d49d8){try{jsonpatch[_0xa1eb('0x30')](_0x9d49d8,_0x52f9c7,!![]);}catch(_0x198fdb){return BPromise[_0xa1eb('0x31')](_0x198fdb);}return _0x9d49d8[_0xa1eb('0x32')]();};}function saveUpdates(_0xcd9efd,_0x1d5b64){return function(_0xcfda64){if(_0xcfda64){return _0xcfda64[_0xa1eb('0x33')](_0xcd9efd)[_0xa1eb('0x34')](function(_0x4345a3){return _0x4345a3;});}return null;};}function removeEntity(_0x4fdba4,_0x563b11){return function(_0x126d50){if(_0x126d50){return _0x126d50[_0xa1eb('0x35')]()[_0xa1eb('0x34')](function(){var _0x36cc2a=_0x126d50[_0xa1eb('0x36')]({'plain':!![]});var _0x58d336='Trunks';return db[_0xa1eb('0x37')][_0xa1eb('0x35')]({'where':{'type':_0x58d336,'resourceId':_0x36cc2a['id']}})['then'](function(){return _0x126d50;});})['then'](function(){_0x4fdba4[_0xa1eb('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f33dc,_0x534fe4){return function(_0x47737d){if(!_0x47737d){_0x1f33dc[_0xa1eb('0x28')](0x194);}return _0x47737d;};}function handleError(_0x229931,_0x57355f){_0x57355f=_0x57355f||0x1f4;return function(_0x355839){logger[_0xa1eb('0x23')](_0x355839[_0xa1eb('0x38')]);if(_0x355839['name']){delete _0x355839[_0xa1eb('0x39')];}_0x229931[_0xa1eb('0x29')](_0x57355f)[_0xa1eb('0x3a')](_0x355839);};}exports[_0xa1eb('0x3b')]=function(_0x3c3982,_0x5912d5){var _0x53bf02={},_0x28cfa3={},_0x46374c={'count':0x0,'rows':[]};var _0x3f9486=_[_0xa1eb('0x3c')](db[_0xa1eb('0x3d')][_0xa1eb('0x3e')],function(_0x3f6b47){return{'name':_0x3f6b47['fieldName'],'type':_0x3f6b47[_0xa1eb('0x3f')][_0xa1eb('0x40')]};});_0x28cfa3[_0xa1eb('0x41')]=_[_0xa1eb('0x3c')](_0x3f9486,_0xa1eb('0x39'));_0x28cfa3['query']=_[_0xa1eb('0x42')](_0x3c3982[_0xa1eb('0x43')]);_0x28cfa3[_0xa1eb('0x44')]=_['intersection'](_0x28cfa3[_0xa1eb('0x41')],_0x28cfa3[_0xa1eb('0x43')]);_0x53bf02[_0xa1eb('0x45')]=_[_0xa1eb('0x46')](_0x28cfa3[_0xa1eb('0x41')],qs[_0xa1eb('0x47')](_0x3c3982[_0xa1eb('0x43')]['fields']));_0x53bf02[_0xa1eb('0x45')]=_0x53bf02[_0xa1eb('0x45')]['length']?_0x53bf02[_0xa1eb('0x45')]:_0x28cfa3['model'];if(!_0x3c3982[_0xa1eb('0x43')][_0xa1eb('0x48')](_0xa1eb('0x49'))){_0x53bf02[_0xa1eb('0x2c')]=qs[_0xa1eb('0x2c')](_0x3c3982[_0xa1eb('0x43')][_0xa1eb('0x2c')]);_0x53bf02[_0xa1eb('0x2b')]=qs[_0xa1eb('0x2b')](_0x3c3982[_0xa1eb('0x43')][_0xa1eb('0x2b')]);}_0x53bf02[_0xa1eb('0x4a')]=qs[_0xa1eb('0x4b')](_0x3c3982[_0xa1eb('0x43')][_0xa1eb('0x4b')]);_0x53bf02[_0xa1eb('0x4c')]=qs['filters'](_[_0xa1eb('0x4d')](_0x3c3982['query'],_0x28cfa3[_0xa1eb('0x44')]),_0x3f9486);if(_0x3c3982[_0xa1eb('0x43')]['filter']){_0x53bf02['where']=_[_0xa1eb('0x4e')](_0x53bf02[_0xa1eb('0x4c')],{'$or':_[_0xa1eb('0x3c')](_0x3f9486,function(_0x55c770){if(_0x55c770[_0xa1eb('0x3f')]!==_0xa1eb('0x4f')){var _0x26862a={};_0x26862a[_0x55c770[_0xa1eb('0x39')]]={'$like':'%'+_0x3c3982[_0xa1eb('0x43')][_0xa1eb('0x50')]+'%'};return _0x26862a;}})});}_0x53bf02=_[_0xa1eb('0x4e')]({},_0x53bf02,_0x3c3982[_0xa1eb('0x51')]);var _0xf6da59={'where':_0x53bf02[_0xa1eb('0x4c')]};return db[_0xa1eb('0x3d')][_0xa1eb('0x2a')](_0xf6da59)[_0xa1eb('0x34')](function(_0x10e15a){_0x46374c['count']=_0x10e15a;if(_0x3c3982[_0xa1eb('0x43')][_0xa1eb('0x52')]){_0x53bf02[_0xa1eb('0x53')]=[{'all':!![]}];}return db[_0xa1eb('0x3d')][_0xa1eb('0x54')](_0x53bf02);})[_0xa1eb('0x34')](function(_0x2374c0){_0x46374c['rows']=_0x2374c0;return _0x46374c;})[_0xa1eb('0x34')](respondWithFilteredResult(_0x5912d5,_0x53bf02))[_0xa1eb('0x27')](handleError(_0x5912d5,null));};exports[_0xa1eb('0x55')]=function(_0x10a6da,_0x8975a1){var _0x1302f6={'raw':![],'where':{'id':_0x10a6da[_0xa1eb('0x56')]['id']}},_0x25e146={};_0x25e146[_0xa1eb('0x41')]=_['keys'](db[_0xa1eb('0x3d')]['rawAttributes']);_0x25e146[_0xa1eb('0x43')]=_['keys'](_0x10a6da[_0xa1eb('0x43')]);_0x25e146[_0xa1eb('0x44')]=_[_0xa1eb('0x46')](_0x25e146['model'],_0x25e146[_0xa1eb('0x43')]);_0x1302f6[_0xa1eb('0x45')]=_['intersection'](_0x25e146[_0xa1eb('0x41')],qs[_0xa1eb('0x47')](_0x10a6da[_0xa1eb('0x43')][_0xa1eb('0x47')]));_0x1302f6[_0xa1eb('0x45')]=_0x1302f6[_0xa1eb('0x45')][_0xa1eb('0x57')]?_0x1302f6[_0xa1eb('0x45')]:_0x25e146[_0xa1eb('0x41')];if(_0x10a6da[_0xa1eb('0x43')][_0xa1eb('0x52')]){_0x1302f6[_0xa1eb('0x53')]=[{'all':!![]}];}_0x1302f6=_[_0xa1eb('0x4e')]({},_0x1302f6,_0x10a6da[_0xa1eb('0x51')]);return db[_0xa1eb('0x3d')][_0xa1eb('0x58')](_0x1302f6)[_0xa1eb('0x34')](handleEntityNotFound(_0x8975a1,null))['then'](respondWithResult(_0x8975a1,null))[_0xa1eb('0x27')](handleError(_0x8975a1,null));};exports[_0xa1eb('0x59')]=function(_0x2161ed,_0x1085ca){var _0x3ad4b3={'where':{'id':_0x2161ed['params']['id']}},_0x1f5da6={};_0x1f5da6[_0xa1eb('0x41')]=_[_0xa1eb('0x42')](db[_0xa1eb('0x3d')][_0xa1eb('0x3e')]);_0x3ad4b3[_0xa1eb('0x45')]=_[_0xa1eb('0x46')](_0x1f5da6[_0xa1eb('0x41')],qs['fields'](_0x2161ed[_0xa1eb('0x43')][_0xa1eb('0x47')]));_0x3ad4b3[_0xa1eb('0x45')]=_0x3ad4b3[_0xa1eb('0x45')]['length']?_0x3ad4b3['attributes']:_0x1f5da6['model'];if(_0x2161ed['query'][_0xa1eb('0x52')]){_0x3ad4b3[_0xa1eb('0x53')]=[{'all':!![]}];}_0x3ad4b3=_['merge']({},_0x3ad4b3,_0x2161ed[_0xa1eb('0x51')]);return db[_0xa1eb('0x3d')][_0xa1eb('0x58')](_0x3ad4b3)[_0xa1eb('0x34')](handleEntityNotFound(_0x1085ca,null))['then'](function(_0x481d19){if(_0x481d19){var _0x201e6a=_0x481d19[_0xa1eb('0x36')]({'plain':!![]});_0x201e6a=qs[_0xa1eb('0x5a')](_0x201e6a,['id',_0xa1eb('0x5b'),_0xa1eb('0x5c')]);_0x2161ed[_0xa1eb('0x5d')]=_['omit'](_0x2161ed['body'],['id',_0xa1eb('0x5b'),'updatedAt']);return db[_0xa1eb('0x3d')]['create'](_[_0xa1eb('0x4e')](_0x201e6a,_0x2161ed[_0xa1eb('0x5d')]),{'include':_0x2161ed['query'][_0xa1eb('0x52')]?[{'all':!![]}]:undefined})[_0xa1eb('0x34')](function(_0x501596){var _0x11e99d=_0x2161ed[_0xa1eb('0x5e')][_0xa1eb('0x36')]({'plain':!![]});if(!_0x11e99d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11e99d[_0xa1eb('0x5f')]===_0xa1eb('0x5e')){var _0x4af59a=_0x501596[_0xa1eb('0x36')]({'plain':!![]});var _0x151adf=_0xa1eb('0x60');return db['UserProfileSection'][_0xa1eb('0x58')]({'where':{'name':_0x151adf,'userProfileId':_0x11e99d['userProfileId']},'raw':!![]})[_0xa1eb('0x34')](function(_0x1ea97b){if(_0x1ea97b&&_0x1ea97b[_0xa1eb('0x61')]===0x0){return db[_0xa1eb('0x37')][_0xa1eb('0x62')]({'name':_0x4af59a['name'],'resourceId':_0x4af59a['id'],'type':_0x1ea97b[_0xa1eb('0x39')],'sectionId':_0x1ea97b['id']},{})[_0xa1eb('0x34')](function(){return _0x501596;});}else{return _0x501596;}})[_0xa1eb('0x27')](function(_0x5732e7){logger[_0xa1eb('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5732e7);throw _0x5732e7;});}return _0x501596;});}})['then'](respondWithResult(_0x1085ca,0xc9))['catch'](handleError(_0x1085ca,null));};exports['create']=function(_0x3b60a7,_0x3e6756,_0x29319e){var _0x4039de;return db[_0xa1eb('0x3d')][_0xa1eb('0x62')](_0x3b60a7[_0xa1eb('0x5d')],{'raw':!![]})[_0xa1eb('0x34')](function(_0x267610){_0x4039de=_0x267610;return db[_0xa1eb('0x3d')]['findAll']({'raw':!![]});})[_0xa1eb('0x34')](function(_0x1d1c91){var _0x46207c=fs[_0xa1eb('0x63')](path[_0xa1eb('0x64')](config[_0xa1eb('0x65')],'server/files/templates/trunk.ejs'),_0xa1eb('0x66'));var _0x2b6996=fs[_0xa1eb('0x63')](path['join'](config[_0xa1eb('0x65')],_0xa1eb('0x67')),_0xa1eb('0x66'));var _0xf39210=ejs[_0xa1eb('0x68')](_0x46207c,{'trunks':_0x1d1c91||[]});fs['writeFileSync'](_0xa1eb('0x69'),_0xf39210);if(_0x4039de['registry']){var _0x2597de=ejs['render'](_0x2b6996,{'trunks':_0x1d1c91||[]});fs[_0xa1eb('0x6a')](_0xa1eb('0x6b'),_0x2597de);}})[_0xa1eb('0x34')](function(){return respondWithRpcPromise(_0xa1eb('0x6c'),'create',{'module':_0xa1eb('0x6d')});})[_0xa1eb('0x34')](function(){var _0x2b8191=_0x3b60a7[_0xa1eb('0x5e')]['get']({'plain':!![]});if(!_0x2b8191)throw new Error(_0xa1eb('0x6e'));if(_0x2b8191[_0xa1eb('0x5f')]===_0xa1eb('0x5e')){var _0x13817e=_0x4039de[_0xa1eb('0x36')]({'plain':!![]});return db[_0xa1eb('0x6f')][_0xa1eb('0x58')]({'where':{'name':_0xa1eb('0x60'),'userProfileId':_0x2b8191[_0xa1eb('0x70')]},'raw':!![]})['then'](function(_0x5591c4){if(_0x5591c4&&_0x5591c4['autoAssociation']===0x0){return db[_0xa1eb('0x37')]['create']({'name':_0x13817e[_0xa1eb('0x39')],'resourceId':_0x13817e['id'],'type':_0x5591c4[_0xa1eb('0x39')],'sectionId':_0x5591c4['id']},{})['then'](function(){return _0x4039de;});}else{return _0x4039de;}})['catch'](function(_0xdcaac3){logger[_0xa1eb('0x23')](_0xa1eb('0x71'),_0xdcaac3);throw _0xdcaac3;});}return _0x4039de;})[_0xa1eb('0x34')](respondWithResult(_0x3e6756,0xc9))[_0xa1eb('0x27')](handleError(_0x3e6756,null));};exports['update']=function(_0x57e4b3,_0x1200de,_0x212e57){var _0x1befa3;return db[_0xa1eb('0x3d')]['find']({'where':{'id':_0x57e4b3[_0xa1eb('0x56')]['id']}})[_0xa1eb('0x34')](handleEntityNotFound(_0x1200de,null))[_0xa1eb('0x34')](saveUpdates(_0x57e4b3[_0xa1eb('0x5d')],null))[_0xa1eb('0x34')](function(_0x37d8c4){if(_0x37d8c4){_0x1befa3=_0x37d8c4;return db[_0xa1eb('0x3d')][_0xa1eb('0x54')]({'raw':!![]});}})[_0xa1eb('0x34')](function(_0x168446){if(_0x168446){var _0x46d326=fs['readFileSync'](path[_0xa1eb('0x64')](config[_0xa1eb('0x65')],_0xa1eb('0x72')),_0xa1eb('0x66'));var _0x3fe7ef=fs[_0xa1eb('0x63')](path['join'](config[_0xa1eb('0x65')],_0xa1eb('0x67')),_0xa1eb('0x66'));var _0x28160e=ejs['render'](_0x46d326,{'trunks':_0x168446||[]});fs['writeFileSync'](_0xa1eb('0x69'),_0x28160e);var _0x5e0cd5=ejs[_0xa1eb('0x68')](_0x3fe7ef,{'trunks':_0x168446||[]});fs[_0xa1eb('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x5e0cd5);return respondWithRpcPromise(_0xa1eb('0x6c'),_0xa1eb('0x33'),{'module':'chan_sip.so'});}return null;})[_0xa1eb('0x34')](function(_0x3a6be1){if(_0x3a6be1){return _0x1befa3;}})[_0xa1eb('0x34')](respondWithResult(_0x1200de,null))[_0xa1eb('0x27')](handleError(_0x1200de,null));};exports[_0xa1eb('0x35')]=function(_0x20cf70,_0x824123,_0x2ce2e1){var _0x3d32da;return db[_0xa1eb('0x3d')][_0xa1eb('0x58')]({'where':{'id':_0x20cf70['params']['id']}})[_0xa1eb('0x34')](handleEntityNotFound(_0x824123,null))[_0xa1eb('0x34')](removeEntity(_0x824123,null))[_0xa1eb('0x34')](function(){return db[_0xa1eb('0x3d')]['findAll']({'raw':!![]});})[_0xa1eb('0x34')](function(_0x2ff08e){var _0x1bbf19=fs['readFileSync'](path[_0xa1eb('0x64')](config[_0xa1eb('0x65')],_0xa1eb('0x72')),'utf8');var _0x1d9e1f=fs['readFileSync'](path[_0xa1eb('0x64')](config[_0xa1eb('0x65')],_0xa1eb('0x67')),_0xa1eb('0x66'));var _0x66d82f=ejs[_0xa1eb('0x68')](_0x1bbf19,{'trunks':_0x2ff08e});var _0x1f9e01=ejs[_0xa1eb('0x68')](_0x1d9e1f,{'trunks':_0x2ff08e});fs['writeFileSync'](_0xa1eb('0x69'),_0x66d82f);fs[_0xa1eb('0x6a')](_0xa1eb('0x6b'),_0x1f9e01);return respondWithRpcPromise(_0xa1eb('0x6c'),_0xa1eb('0x35'),{'module':'chan_sip.so'});})[_0xa1eb('0x27')](handleError(_0x824123,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 00d065e..a1ba1f5 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 _0x14a3=['define','Trunk','tools_trunks','util','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0x2c4d9f,_0x266437){var _0x3c558a=function(_0xe83d03){while(--_0xe83d03){_0x2c4d9f['push'](_0x2c4d9f['shift']());}};_0x3c558a(++_0x266437);}(_0x14a3,0x163));var _0x314a=function(_0x30ba85,_0x503490){_0x30ba85=_0x30ba85-0x0;var _0x58b533=_0x14a3[_0x30ba85];return _0x58b533;};'use strict';var _=require('lodash');var util=require(_0x314a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x314a('0x1'));var BPromise=require('bluebird');var rp=require(_0x314a('0x2'));var fs=require('fs');var path=require(_0x314a('0x3'));var rimraf=require(_0x314a('0x4'));var config=require(_0x314a('0x5'));var attributes=require(_0x314a('0x6'));module[_0x314a('0x7')]=function(_0x4ef494,_0x2c08c3){return _0x4ef494[_0x314a('0x8')](_0x314a('0x9'),attributes,{'tableName':_0x314a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ce=['../../config/environment','./trunk.attributes','tools_trunks','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xa9dbb1,_0xc8425f){var _0x2ebc2a=function(_0x5a5074){while(--_0x5a5074){_0xa9dbb1['push'](_0xa9dbb1['shift']());}};_0x2ebc2a(++_0xc8425f);}(_0xc6ce,0xad));var _0xec6c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc6ce[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xec6c('0x0'));var util=require('util');var logger=require(_0xec6c('0x1'))(_0xec6c('0x2'));var moment=require(_0xec6c('0x3'));var BPromise=require(_0xec6c('0x4'));var rp=require(_0xec6c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec6c('0x6'));var config=require(_0xec6c('0x7'));var attributes=require(_0xec6c('0x8'));module['exports']=function(_0x3320ca,_0x72149){return _0x3320ca['define']('Trunk',attributes,{'tableName':_0xec6c('0x9'),'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 62bd154..e2cd3d8 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 _0x0b0e=['model','GetTrunk','Trunk','find','where','include','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','raw','options','attributes','map'];(function(_0x10aadc,_0x45158d){var _0x3d2a72=function(_0x317c6e){while(--_0x317c6e){_0x10aadc['push'](_0x10aadc['shift']());}};_0x3d2a72(++_0x45158d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3d3b05,_0x334c57){_0x3d3b05=_0x3d3b05-0x0;var _0x2c6ca3=_0x0b0e[_0x3d3b05];return _0x2c6ca3;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Trunk,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['GetTrunk']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['Trunk'][_0xe0b0('0x18')]({'raw':_0x54a3eb['options']?_0x54a3eb['options'][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['where']||null:null,'attributes':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')]['limit']||null:null,'include':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['include']?_[_0xe0b0('0x1c')](_0x54a3eb[_0xe0b0('0x1a')]['include'],function(_0x170ad8){return{'model':db[_0x170ad8['model']],'as':_0x170ad8['as'],'attributes':_0x170ad8[_0xe0b0('0x1b')],'include':_0x170ad8['include']?_[_0xe0b0('0x1c')](_0x170ad8['include'],function(_0x3e5c88){return{'model':db[_0x3e5c88['model']],'as':_0x3e5c88['as'],'attributes':_0x3e5c88[_0xe0b0('0x1b')],'include':_0x3e5c88['include']?_[_0xe0b0('0x1c')](_0x3e5c88['include'],function(_0x362aba){return{'model':db[_0x362aba[_0xe0b0('0x1d')]],'as':_0x362aba['as'],'attributes':_0x362aba[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x3ec2){logger[_0xe0b0('0xe')]('GetTrunk',_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1e'),_0x54a3eb,JSON['stringify'](_0x3ec2));_0x50a441(_0x3ec2);})[_0xe0b0('0x17')](function(_0x419b1f){logger[_0xe0b0('0x13')](_0xe0b0('0x1e'),_0x419b1f[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x419b1f[_0xe0b0('0x14')]));});});};exports['ShowTrunk']=function(_0x1854b8){var _0x3c0109=this;return new Promise(function(_0x48a9b5,_0x4fe400){return db[_0xe0b0('0x1f')][_0xe0b0('0x20')]({'raw':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x21')]||null:null,'attributes':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'include':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')],function(_0x12eeb8){return{'model':db[_0x12eeb8[_0xe0b0('0x1d')]],'as':_0x12eeb8['as'],'attributes':_0x12eeb8[_0xe0b0('0x1b')],'include':_0x12eeb8[_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x12eeb8[_0xe0b0('0x22')],function(_0x1a0c90){return{'model':db[_0x1a0c90[_0xe0b0('0x1d')]],'as':_0x1a0c90['as'],'attributes':_0x1a0c90[_0xe0b0('0x1b')],'include':_0x1a0c90[_0xe0b0('0x22')]?_['map'](_0x1a0c90[_0xe0b0('0x22')],function(_0x135be5){return{'model':db[_0x135be5[_0xe0b0('0x1d')]],'as':_0x135be5['as'],'attributes':_0x135be5[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x2c6e60){logger[_0xe0b0('0xe')]('ShowTrunk',_0x1854b8);logger['debug']('ShowTrunk',_0x1854b8,JSON['stringify'](_0x2c6e60));_0x48a9b5(_0x2c6e60);})[_0xe0b0('0x17')](function(_0xc3d967){logger[_0xe0b0('0x13')]('ShowTrunk',_0xc3d967[_0xe0b0('0x14')],_0x1854b8);_0x4fe400(_0x3c0109[_0xe0b0('0x13')](0x1f4,_0xc3d967[_0xe0b0('0x14')]));});});}; \ No newline at end of file +var _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x193a6e,_0x45dd00){var _0x599a9b=function(_0x37a9e2){while(--_0x37a9e2){_0x193a6e['push'](_0x193a6e['shift']());}};_0x599a9b(++_0x45dd00);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 6848095..47ded73 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 _0x05ec=['getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','%s-%s','originalname','single','file','/:id/login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues','/:id/queues_rt','/:id/groups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x05ec,0xae));var _0xc05e=function(_0x5e6302,_0x361abb){_0x5e6302=_0x5e6302-0x0;var _0x5c7e61=_0x05ec[_0x5e6302];return _0x5c7e61;};'use strict';var multer=require(_0xc05e('0x0'));var util=require(_0xc05e('0x1'));var path=require(_0xc05e('0x2'));var timeout=require(_0xc05e('0x3'));var express=require(_0xc05e('0x4'));var router=express[_0xc05e('0x5')]();var auth=require(_0xc05e('0x6'));var interaction=require(_0xc05e('0x7'));var config=require(_0xc05e('0x8'));var controller=require(_0xc05e('0x9'));router[_0xc05e('0xa')]('/',auth[_0xc05e('0xb')](),controller[_0xc05e('0xc')]);router[_0xc05e('0xa')](_0xc05e('0xd'),auth['isAuthenticated'](),controller[_0xc05e('0xe')]);router['get']('/whoami',auth[_0xc05e('0xb')](),controller[_0xc05e('0xf')]);router[_0xc05e('0xa')](_0xc05e('0x10'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x11')]);router[_0xc05e('0xa')](_0xc05e('0x12'),controller[_0xc05e('0x13')]);router[_0xc05e('0xa')]('/:id/contacts',auth[_0xc05e('0xb')](),controller[_0xc05e('0x14')]);router[_0xc05e('0xa')](_0xc05e('0x15'),auth[_0xc05e('0xb')](),controller['getQueues']);router[_0xc05e('0xa')](_0xc05e('0x16'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xc05e('0xa')](_0xc05e('0x17'),auth[_0xc05e('0xb')](),controller['getGroups']);router[_0xc05e('0xa')](_0xc05e('0x18'),auth[_0xc05e('0xb')](),controller['getRecordings']);router['get'](_0xc05e('0x19'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x1a')]);router[_0xc05e('0xa')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xc05e('0x1b')]);router['get'](_0xc05e('0x1c'),auth['isAuthenticated'](),controller[_0xc05e('0x1d')]);router[_0xc05e('0xa')]('/:id/mail/interactions',auth[_0xc05e('0xb')](),controller[_0xc05e('0x1e')]);router[_0xc05e('0xa')](_0xc05e('0x1f'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x20')]);router['get'](_0xc05e('0x21'),auth[_0xc05e('0xb')](),controller['getFaxInteractions']);router[_0xc05e('0xa')](_0xc05e('0x22'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x23')]);router[_0xc05e('0xa')]('/:id/teams',auth[_0xc05e('0xb')](),controller['getTeams']);router[_0xc05e('0xa')](_0xc05e('0x24'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x25')]);router[_0xc05e('0xa')](_0xc05e('0x26'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x27')]);router[_0xc05e('0xa')](_0xc05e('0x28'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x29')]);router['get'](_0xc05e('0x2a'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x2b')]);router['get'](_0xc05e('0x2c'),auth[_0xc05e('0xb')](),controller['getMailAccounts']);router['get'](_0xc05e('0x2d'),auth['isAuthenticated'](),controller[_0xc05e('0x2e')]);router['get'](_0xc05e('0x2f'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x30')]);router[_0xc05e('0xa')](_0xc05e('0x31'),auth['isAuthenticated'](),controller[_0xc05e('0x32')]);router[_0xc05e('0xa')](_0xc05e('0x33'),auth['isAuthenticated'](),controller[_0xc05e('0x34')]);router['get'](_0xc05e('0x35'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x36')]);router['get'](_0xc05e('0x37'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x38')]);router[_0xc05e('0xa')](_0xc05e('0x39'),auth[_0xc05e('0xb')](),controller['getApiKey']);router[_0xc05e('0x3a')](_0xc05e('0x3b'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x3c')]);router[_0xc05e('0x3a')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xc05e('0x3d')]);router[_0xc05e('0x3a')]('/',auth[_0xc05e('0xb')](),controller[_0xc05e('0x3e')]);router[_0xc05e('0x3a')](_0xc05e('0x15'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x3f')]);var upload=multer({'storage':multer[_0xc05e('0x40')]({'destination':function(_0x2c4502,_0x1e0ea7,_0x297e32){_0x297e32(null,path[_0xc05e('0x41')](config[_0xc05e('0x42')],_0xc05e('0x43')));},'filename':function(_0x3ff006,_0x196a28,_0x870192){_0x870192(null,util['format'](_0xc05e('0x44'),Date['now'](),_0x196a28[_0xc05e('0x45')]));}})});router[_0xc05e('0x3a')]('/:id/avatar',upload[_0xc05e('0x46')](_0xc05e('0x47')),controller['addAvatar']);router[_0xc05e('0x3a')](_0xc05e('0x48'),auth[_0xc05e('0xb')](),controller['login']);router[_0xc05e('0x3a')]('/:id/logout',auth[_0xc05e('0xb')](),controller[_0xc05e('0x49')]);router[_0xc05e('0x3a')](_0xc05e('0x4a'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x4b')]);router[_0xc05e('0x3a')](_0xc05e('0x4c'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x4d')]);router['post'](_0xc05e('0x4e'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x4f')]);router[_0xc05e('0x3a')](_0xc05e('0x50'),auth['isAuthenticated'](),controller[_0xc05e('0x51')]);router[_0xc05e('0x3a')](_0xc05e('0x52'),auth['isAuthenticated'](),controller[_0xc05e('0x53')]);router['post'](_0xc05e('0x54'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x55')]);router[_0xc05e('0x3a')](_0xc05e('0x56'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xc05e('0x3a')](_0xc05e('0x57'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x58')]);router[_0xc05e('0x3a')](_0xc05e('0x59'),auth[_0xc05e('0xb')](),controller['addWhatsappInteractions']);router[_0xc05e('0x3a')](_0xc05e('0x2a'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x5a')]);router['post']('/:id/mail_accounts',auth[_0xc05e('0xb')](),controller['addMailAccounts']);router[_0xc05e('0x3a')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xc05e('0x5b')]);router[_0xc05e('0x3a')](_0xc05e('0x2f'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x5c')]);router[_0xc05e('0x3a')](_0xc05e('0x31'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x5d')]);router['post'](_0xc05e('0x33'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x5e')]);router[_0xc05e('0x3a')](_0xc05e('0x35'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x5f')]);router['post'](_0xc05e('0x39'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x60')]);router[_0xc05e('0x61')](_0xc05e('0x10'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x62')]);router['put'](_0xc05e('0x63'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x64')]);router[_0xc05e('0x65')](_0xc05e('0x15'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x66')]);router['delete'](_0xc05e('0x4e'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x67')]);router[_0xc05e('0x65')](_0xc05e('0x10'),auth[_0xc05e('0xb')](),controller['destroy']);router['delete'](_0xc05e('0x50'),auth[_0xc05e('0xb')](),controller['removeChatInteractions']);router[_0xc05e('0x65')](_0xc05e('0x52'),auth[_0xc05e('0xb')](),controller['removeMailInteractions']);router[_0xc05e('0x65')](_0xc05e('0x54'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x68')]);router[_0xc05e('0x65')]('/:id/sms_interactions',auth[_0xc05e('0xb')](),controller[_0xc05e('0x69')]);router[_0xc05e('0x65')](_0xc05e('0x57'),auth[_0xc05e('0xb')](),controller['removeOpenchannelInteractions']);router[_0xc05e('0x65')](_0xc05e('0x59'),auth['isAuthenticated'](),controller[_0xc05e('0x6a')]);router['delete'](_0xc05e('0x2a'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x6b')]);router[_0xc05e('0x65')](_0xc05e('0x2c'),auth['isAuthenticated'](),controller[_0xc05e('0x6c')]);router[_0xc05e('0x65')](_0xc05e('0x2d'),auth[_0xc05e('0xb')](),controller['removeOpenchannelAccounts']);router[_0xc05e('0x65')]('/:id/sms_accounts',auth[_0xc05e('0xb')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xc05e('0x65')](_0xc05e('0x33'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x6d')]);router['delete'](_0xc05e('0x35'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x6e')]);router[_0xc05e('0x65')](_0xc05e('0x39'),auth[_0xc05e('0xb')](),controller[_0xc05e('0x6f')]);module[_0xc05e('0x70')]=router; \ No newline at end of file +var _0xcb72=['/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','addContacts','create','/:id/queues','addQueues','diskStorage','join','server/files/images/','format','now','originalname','single','file','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addChatInteractions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeQueues','/:id/teams','removeTeams','destroy','/:id/chat_interactions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','whoami','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups'];(function(_0x2bdd09,_0x4af9e9){var _0x35b22a=function(_0x58d54f){while(--_0x58d54f){_0x2bdd09['push'](_0x2bdd09['shift']());}};_0x35b22a(++_0x4af9e9);}(_0xcb72,0xc7));var _0x2cb7=function(_0x3ab304,_0x156e6f){_0x3ab304=_0x3ab304-0x0;var _0x461bca=_0xcb72[_0x3ab304];return _0x461bca;};'use strict';var multer=require(_0x2cb7('0x0'));var util=require(_0x2cb7('0x1'));var path=require(_0x2cb7('0x2'));var timeout=require(_0x2cb7('0x3'));var express=require('express');var router=express[_0x2cb7('0x4')]();var auth=require(_0x2cb7('0x5'));var interaction=require(_0x2cb7('0x6'));var config=require(_0x2cb7('0x7'));var controller=require(_0x2cb7('0x8'));router[_0x2cb7('0x9')]('/',auth['isAuthenticated'](),controller[_0x2cb7('0xa')]);router[_0x2cb7('0x9')](_0x2cb7('0xb'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0xd')]);router['get']('/whoami',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0xe')]);router[_0x2cb7('0x9')]('/:id',auth[_0x2cb7('0xc')](),controller['show']);router[_0x2cb7('0x9')](_0x2cb7('0xf'),controller[_0x2cb7('0x10')]);router[_0x2cb7('0x9')](_0x2cb7('0x11'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x12')]);router[_0x2cb7('0x9')]('/:id/queues',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x13')]);router[_0x2cb7('0x9')](_0x2cb7('0x14'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x15')]);router['get'](_0x2cb7('0x16'),auth[_0x2cb7('0xc')](),controller['getGroups']);router[_0x2cb7('0x9')]('/:id/recordings',auth['isAuthenticated'](),controller['getRecordings']);router[_0x2cb7('0x9')](_0x2cb7('0x17'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x2cb7('0x9')]('/:id/chat/interactions',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x18')]);router[_0x2cb7('0x9')](_0x2cb7('0x19'),auth[_0x2cb7('0xc')](),controller['getOpenchannelInteractions']);router['get'](_0x2cb7('0x1a'),auth['isAuthenticated'](),controller['getMailInteractions']);router['get'](_0x2cb7('0x1b'),auth['isAuthenticated'](),controller[_0x2cb7('0x1c')]);router[_0x2cb7('0x9')](_0x2cb7('0x1d'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x1e')]);router['get'](_0x2cb7('0x1f'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x20')]);router[_0x2cb7('0x9')]('/:id/teams',auth[_0x2cb7('0xc')](),controller['getTeams']);router['get'](_0x2cb7('0x21'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x22')]);router[_0x2cb7('0x9')](_0x2cb7('0x23'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x24')]);router[_0x2cb7('0x9')](_0x2cb7('0x25'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x26')]);router['get'](_0x2cb7('0x27'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x28')]);router[_0x2cb7('0x9')](_0x2cb7('0x29'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x2a')]);router['get'](_0x2cb7('0x2b'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x2c')]);router[_0x2cb7('0x9')](_0x2cb7('0x2d'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x2e')]);router[_0x2cb7('0x9')](_0x2cb7('0x2f'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x30')]);router[_0x2cb7('0x9')]('/:id/whatsapp_accounts',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x31')]);router['get'](_0x2cb7('0x32'),auth[_0x2cb7('0xc')](),controller['getSquareProjects']);router[_0x2cb7('0x9')](_0x2cb7('0x33'),auth['isAuthenticated'](),controller[_0x2cb7('0x34')]);router[_0x2cb7('0x9')](_0x2cb7('0x35'),auth[_0x2cb7('0xc')](),controller['getApiKey']);router[_0x2cb7('0x36')](_0x2cb7('0x37'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x38')]);router[_0x2cb7('0x36')](_0x2cb7('0x11'),auth['isAuthenticated'](),controller[_0x2cb7('0x39')]);router[_0x2cb7('0x36')]('/',auth['isAuthenticated'](),controller[_0x2cb7('0x3a')]);router[_0x2cb7('0x36')](_0x2cb7('0x3b'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x3c')]);var upload=multer({'storage':multer[_0x2cb7('0x3d')]({'destination':function(_0x37d38b,_0x4dcc7d,_0x54a5a8){_0x54a5a8(null,path[_0x2cb7('0x3e')](config['root'],_0x2cb7('0x3f')));},'filename':function(_0x2e6bd4,_0x1d6c50,_0x9a212c){_0x9a212c(null,util[_0x2cb7('0x40')]('%s-%s',Date[_0x2cb7('0x41')](),_0x1d6c50[_0x2cb7('0x42')]));}})});router[_0x2cb7('0x36')]('/:id/avatar',upload[_0x2cb7('0x43')](_0x2cb7('0x44')),controller['addAvatar']);router[_0x2cb7('0x36')]('/:id/login',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x45')]);router['post'](_0x2cb7('0x46'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x47')]);router[_0x2cb7('0x36')](_0x2cb7('0x48'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x49')]);router[_0x2cb7('0x36')](_0x2cb7('0x4a'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x4b')]);router['post']('/:id/teams',auth[_0x2cb7('0xc')](),controller['addTeams']);router[_0x2cb7('0x36')]('/:id/chat_interactions',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x4c')]);router[_0x2cb7('0x36')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x2cb7('0x36')](_0x2cb7('0x4d'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x2cb7('0x36')]('/:id/sms_interactions',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x4e')]);router[_0x2cb7('0x36')](_0x2cb7('0x4f'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x50')]);router[_0x2cb7('0x36')]('/:id/whatsapp_interactions',auth[_0x2cb7('0xc')](),controller['addWhatsappInteractions']);router[_0x2cb7('0x36')](_0x2cb7('0x27'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x51')]);router[_0x2cb7('0x36')](_0x2cb7('0x29'),auth[_0x2cb7('0xc')](),controller['addMailAccounts']);router['post'](_0x2cb7('0x2b'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x52')]);router['post'](_0x2cb7('0x2d'),auth['isAuthenticated'](),controller[_0x2cb7('0x53')]);router['post'](_0x2cb7('0x2f'),auth['isAuthenticated'](),controller[_0x2cb7('0x54')]);router['post'](_0x2cb7('0x55'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x56')]);router[_0x2cb7('0x36')](_0x2cb7('0x32'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x57')]);router[_0x2cb7('0x36')](_0x2cb7('0x35'),auth['isAuthenticated'](),controller[_0x2cb7('0x58')]);router[_0x2cb7('0x59')](_0x2cb7('0x5a'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x5b')]);router[_0x2cb7('0x59')](_0x2cb7('0x5c'),auth['isAuthenticated'](),controller[_0x2cb7('0x5d')]);router[_0x2cb7('0x5e')]('/:id/queues',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x5f')]);router[_0x2cb7('0x5e')](_0x2cb7('0x60'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x61')]);router[_0x2cb7('0x5e')](_0x2cb7('0x5a'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x62')]);router[_0x2cb7('0x5e')](_0x2cb7('0x63'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x2cb7('0x5e')](_0x2cb7('0x64'),auth['isAuthenticated'](),controller[_0x2cb7('0x65')]);router[_0x2cb7('0x5e')](_0x2cb7('0x4d'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x66')]);router['delete']('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x2cb7('0x5e')](_0x2cb7('0x4f'),auth['isAuthenticated'](),controller[_0x2cb7('0x67')]);router['delete'](_0x2cb7('0x68'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x2cb7('0x5e')](_0x2cb7('0x27'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x69')]);router['delete'](_0x2cb7('0x29'),auth[_0x2cb7('0xc')](),controller['removeMailAccounts']);router[_0x2cb7('0x5e')]('/:id/openchannel_accounts',auth[_0x2cb7('0xc')](),controller['removeOpenchannelAccounts']);router[_0x2cb7('0x5e')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x2cb7('0x6a')]);router[_0x2cb7('0x5e')]('/:id/chat_websites',auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x6b')]);router[_0x2cb7('0x5e')](_0x2cb7('0x55'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x6c')]);router['delete']('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);router['delete'](_0x2cb7('0x35'),auth[_0x2cb7('0xc')](),controller[_0x2cb7('0x6d')]);module[_0x2cb7('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 38ff1de..77df51a 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 _0xb8aa=['active','actpass','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsenable','dtlsverify','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','format','DATE','BOOLEAN','dynamic','user','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','never','accept','refuse','originate','uac','uas','fingerprint','certificate'];(function(_0x5f6b1a,_0x5d5684){var _0x3d0344=function(_0x4aded3){while(--_0x4aded3){_0x5f6b1a['push'](_0x5f6b1a['shift']());}};_0x3d0344(++_0x5d5684);}(_0xb8aa,0x182));var _0xab8a=function(_0x1cdf10,_0x52d5f3){_0x1cdf10=_0x1cdf10-0x0;var _0x5ca141=_0xb8aa[_0x1cdf10];return _0x5ca141;};'use strict';var Sequelize=require(_0xab8a('0x0'));var moment=require(_0xab8a('0x1'));var util=require('util');var _=require(_0xab8a('0x2'));module['exports']={'name':{'type':Sequelize[_0xab8a('0x3')],'allowNull':![],'unique':_0xab8a('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3b3783){this[_0xab8a('0x5')](_0xab8a('0x4'),_0x3b3783);this['setDataValue'](_0xab8a('0x6'),_0x3b3783);},'comment':_0xab8a('0x7')},'fullname':{'type':Sequelize[_0xab8a('0x3')],'allowNull':![],'set':function(_0xd7677f){this[_0xab8a('0x5')](_0xab8a('0x8'),_0xd7677f);this[_0xab8a('0x5')](_0xab8a('0x9'),util['format'](_0xab8a('0xa'),_0xd7677f,this[_0xab8a('0xb')](_0xab8a('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x487e59){if(_0x487e59){this[_0xab8a('0x5')](_0xab8a('0xd'),_0x487e59[_0xab8a('0xe')]());}}},'role':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x10'),'user',_0xab8a('0x11'),_0xab8a('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xab8a('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xab8a('0x3')],'defaultValue':_0xab8a('0x13')},'internal':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':![],'unique':_0xab8a('0xc'),'set':function(_0x1ea4b3){this[_0xab8a('0x5')](_0xab8a('0xc'),_0x1ea4b3);this[_0xab8a('0x5')]('accountcode',_0x1ea4b3);this[_0xab8a('0x5')](_0xab8a('0x9'),util[_0xab8a('0x15')](_0xab8a('0xa'),this[_0xab8a('0xb')](_0xab8a('0x8')),_0x1ea4b3));}},'salt':{'type':Sequelize[_0xab8a('0x3')]},'phone':{'type':Sequelize[_0xab8a('0x3')]},'mobile':{'type':Sequelize[_0xab8a('0x3')]},'address':{'type':Sequelize[_0xab8a('0x3')]},'zipcode':{'type':Sequelize[_0xab8a('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xab8a('0x3')]},'country':{'type':Sequelize[_0xab8a('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xab8a('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xab8a('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xab8a('0x16')]},'chatCapacity':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xab8a('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![],'defaultValue':_0xab8a('0x18')},'ipaddr':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xab8a('0xf')]('friend',_0xab8a('0x19'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![],'defaultValue':_0xab8a('0x1a')},'callingpres':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x1b'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xab8a('0x1c'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xab8a('0x1d'),_0xab8a('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xab8a('0x1f'),'set':function(_0xea12bd){this['setDataValue'](_0xab8a('0x20'),_0xea12bd?_0xea12bd[_0xab8a('0x21')](','):null);},'get':function(){return this['getDataValue'](_0xab8a('0x20'))?this[_0xab8a('0xb')](_0xab8a('0x20'))['split'](','):null;},'comment':_0xab8a('0x22')},'dtmfmode':{'type':Sequelize['ENUM'](_0xab8a('0x23'),_0xab8a('0x24'),_0xab8a('0x25'),_0xab8a('0x26'),'auto'),'allowNull':!![],'defaultValue':_0xab8a('0x23')},'directmedia':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no',_0xab8a('0x28'),_0xab8a('0x29'),_0xab8a('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xab8a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![],'defaultValue':_0xab8a('0x2b'),'set':function(_0x49ce58){this[_0xab8a('0x5')](_0xab8a('0x2c'),_0x49ce58?_0x49ce58[_0xab8a('0x21')](','):null);},'get':function(){return this[_0xab8a('0xb')]('nat')?this[_0xab8a('0xb')](_0xab8a('0x2c'))[_0xab8a('0x2d')](','):null;},'comment':_0xab8a('0x2e')},'callgroup':{'type':Sequelize[_0xab8a('0x3')]},'namedcallgroup':{'type':Sequelize[_0xab8a('0x3')]},'pickupgroup':{'type':Sequelize[_0xab8a('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xab8a('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xab8a('0x3')]},'disallow':{'type':Sequelize[_0xab8a('0x3')],'allowNull':![],'defaultValue':_0xab8a('0x2f')},'allow':{'type':Sequelize[_0xab8a('0x3')],'allowNull':![],'defaultValue':_0xab8a('0x30'),'set':function(_0x4c9ce8){this[_0xab8a('0x5')](_0xab8a('0x31'),_0x4c9ce8?_0x4c9ce8[_0xab8a('0x21')](';'):_0xab8a('0x30'));},'get':function(){return this[_0xab8a('0xb')]('allow')?this[_0xab8a('0xb')](_0xab8a('0x31'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x55fe05){this['setDataValue'](_0xab8a('0x32'),_0x55fe05?_0x55fe05[_0xab8a('0x21')](','):null);},'get':function(){return this['getDataValue'](_0xab8a('0x32'))?this[_0xab8a('0xb')](_0xab8a('0x32'))[_0xab8a('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xab8a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xab8a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no',_0xab8a('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xab8a('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xab8a('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xab8a('0x27'),'no'),'allowNull':!![],'defaultValue':_0xab8a('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xab8a('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xab8a('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xab8a('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xab8a('0x34'),_0xab8a('0x35'),_0xab8a('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x37'),_0xab8a('0x38')),'allowNull':!![],'defaultValue':_0xab8a('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xab8a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xab8a('0x27')},'keepalive':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xab8a('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no',_0xab8a('0x39'),_0xab8a('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x3b'),'passive',_0xab8a('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xab8a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xab8a('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xab8a('0xf')]('yes','no',_0xab8a('0x28'),_0xab8a('0x29'),_0xab8a('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xab8a('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xab8a('0x16')]},'showWebBar':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0,'set':function(_0x2da766){this['setDataValue'](_0xab8a('0x3e'),_0x2da766);var _0x550999=this[_0xab8a('0x3f')]({'plain':!![]});switch(_0x2da766){case 0x0:case 0x1:var _0x169b21=_0x550999[_0xab8a('0x20')]?_[_0xab8a('0x40')](_0x550999[_0xab8a('0x20')])?_0x550999[_0xab8a('0x20')][_0xab8a('0x21')]():_0x550999[_0xab8a('0x20')]:_0xab8a('0x1f');if(_0x169b21===_0xab8a('0x41')){_0x169b21=_0xab8a('0x1f');}this[_0xab8a('0x5')](_0xab8a('0x20'),_0x169b21);this['setDataValue'](_0xab8a('0x42'),'no');this[_0xab8a('0x5')](_0xab8a('0x43'),null);this[_0xab8a('0x5')](_0xab8a('0x44'),null);this[_0xab8a('0x5')](_0xab8a('0x45'),null);this[_0xab8a('0x5')]('dtlsenable',null);this[_0xab8a('0x5')]('dtlsverify',null);this['setDataValue'](_0xab8a('0x46'),null);this[_0xab8a('0x5')](_0xab8a('0x47'),null);this[_0xab8a('0x5')](_0xab8a('0x48'),null);this[_0xab8a('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue']('transport',_0xab8a('0x41'));this['setDataValue'](_0xab8a('0x42'),_0xab8a('0x27'));this['setDataValue'](_0xab8a('0x43'),'yes');this[_0xab8a('0x5')](_0xab8a('0x44'),'yes');this[_0xab8a('0x5')](_0xab8a('0x45'),_0xab8a('0x27'));this[_0xab8a('0x5')](_0xab8a('0x49'),_0xab8a('0x27'));this[_0xab8a('0x5')](_0xab8a('0x4a'),'no');this['setDataValue'](_0xab8a('0x46'),_0xab8a('0x3c'));this[_0xab8a('0x5')]('dtlscertfile',_0x550999[_0xab8a('0x47')]||_0xab8a('0x4b'));this[_0xab8a('0x5')](_0xab8a('0x48'),_0x550999[_0xab8a('0x48')]||_0xab8a('0x4c'));this[_0xab8a('0x5')](_0xab8a('0x4d'),_0xab8a('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0xab8a('0x4e')],'set':function(_0x1bbe7a){this[_0xab8a('0x5')]('permissions',_0x1bbe7a?_0x1bbe7a['join'](','):[]);},'get':function(){return this['getDataValue'](_0xab8a('0x4f'))?_[_0xab8a('0x50')](this[_0xab8a('0xb')](_0xab8a('0x4f'))['split'](','),function(_0x1dadcb){return parseInt(_0x1dadcb,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xab8a('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xab8a('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xab8a('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xab8a('0xf')](_0xab8a('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xab8a('0x3')]},'passwordResetAt':{'type':Sequelize[_0xab8a('0x16')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xab8a('0x51')],'get':function(){return this['getDataValue'](_0xab8a('0x52'))?this[_0xab8a('0xb')](_0xab8a('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xab8a('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![],'set':function(_0x3dab7b){if(typeof _0x3dab7b===_0xab8a('0x53')){var _0x2cb7a0=_0x3dab7b==='1'?!![]:_0x3dab7b==='0'?![]:_0x3dab7b==='true'?!![]:_0x3dab7b===_0xab8a('0x54')?![]:![];this[_0xab8a('0x5')]('screenrecording',_0x2cb7a0);}else{this[_0xab8a('0x5')](_0xab8a('0x55'),_0x3dab7b);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x38733d){this[_0xab8a('0x5')](_0xab8a('0x56'),_0x38733d);if(_0x38733d===!![]){this[_0xab8a('0x5')]('blockedAt',moment());this[_0xab8a('0x5')](_0xab8a('0x57'),0x0);}else{this[_0xab8a('0x5')](_0xab8a('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xab8a('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xab8a('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0x2ab9=['avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','wss','encryption','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','moment','lodash','exports','STRING','name','setDataValue','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','agent','local','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','get','isArray','udp'];(function(_0x17f0ef,_0x27f9fd){var _0x81615e=function(_0x5e2ce5){while(--_0x5e2ce5){_0x17f0ef['push'](_0x17f0ef['shift']());}};_0x81615e(++_0x27f9fd);}(_0x2ab9,0x120));var _0x92ab=function(_0x587008,_0x51e2c5){_0x587008=_0x587008-0x0;var _0xc8507=_0x2ab9[_0x587008];return _0xc8507;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x92ab('0x0'));var util=require('util');var _=require(_0x92ab('0x1'));module[_0x92ab('0x2')]={'name':{'type':Sequelize[_0x92ab('0x3')],'allowNull':![],'unique':_0x92ab('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5b3f34){this[_0x92ab('0x5')]('name',_0x5b3f34);this['setDataValue']('defaultuser',_0x5b3f34);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x92ab('0x3')],'allowNull':![],'set':function(_0x37799d){this[_0x92ab('0x5')](_0x92ab('0x6'),_0x37799d);this[_0x92ab('0x5')](_0x92ab('0x7'),util[_0x92ab('0x8')](_0x92ab('0x9'),_0x37799d,this[_0x92ab('0xa')]('internal')));}},'alias':{'type':Sequelize[_0x92ab('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x92ab('0xb'),'validate':{'isEmail':!![]},'set':function(_0x126f8a){if(_0x126f8a){this[_0x92ab('0x5')](_0x92ab('0xb'),_0x126f8a[_0x92ab('0xc')]());}}},'role':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0xe'),_0x92ab('0xf'),_0x92ab('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x92ab('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x92ab('0x3')],'defaultValue':_0x92ab('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x92ab('0x12'),'set':function(_0x45f779){this['setDataValue'](_0x92ab('0x12'),_0x45f779);this[_0x92ab('0x5')](_0x92ab('0x13'),_0x45f779);this[_0x92ab('0x5')](_0x92ab('0x7'),util[_0x92ab('0x8')](_0x92ab('0x9'),this[_0x92ab('0xa')](_0x92ab('0x6')),_0x45f779));}},'salt':{'type':Sequelize[_0x92ab('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x92ab('0x3')]},'address':{'type':Sequelize[_0x92ab('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x92ab('0x3')]},'country':{'type':Sequelize[_0x92ab('0x3')]},'online':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x92ab('0x15')]},'voicePause':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x92ab('0x3')],'defaultValue':_0x92ab('0x16')},'lastPauseAt':{'type':Sequelize[_0x92ab('0x15')]},'chatCapacity':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x92ab('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x92ab('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x92ab('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user',_0x92ab('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x1a'),_0x92ab('0x1b'),_0x92ab('0x1c'),_0x92ab('0x1d'),_0x92ab('0x1e'),'PROHIB_PASSED_SCREEN',_0x92ab('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0xc7521e){this[_0x92ab('0x5')]('transport',_0xc7521e?_0xc7521e[_0x92ab('0x20')](','):null);},'get':function(){return this[_0x92ab('0xa')]('transport')?this[_0x92ab('0xa')](_0x92ab('0x21'))['split'](','):null;},'comment':_0x92ab('0x22')},'dtmfmode':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x23'),'info',_0x92ab('0x24'),'inband',_0x92ab('0x25')),'allowNull':!![],'defaultValue':_0x92ab('0x23')},'directmedia':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no',_0x92ab('0x27'),_0x92ab('0x28'),_0x92ab('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![],'defaultValue':_0x92ab('0x2a'),'set':function(_0x2216b2){this[_0x92ab('0x5')](_0x92ab('0x2b'),_0x2216b2?_0x2216b2[_0x92ab('0x20')](','):null);},'get':function(){return this[_0x92ab('0xa')](_0x92ab('0x2b'))?this[_0x92ab('0xa')](_0x92ab('0x2b'))[_0x92ab('0x2c')](','):null;},'comment':_0x92ab('0x2d')},'callgroup':{'type':Sequelize[_0x92ab('0x3')]},'namedcallgroup':{'type':Sequelize[_0x92ab('0x3')]},'pickupgroup':{'type':Sequelize[_0x92ab('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x92ab('0x3')]},'language':{'type':Sequelize[_0x92ab('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x92ab('0x3')]},'disallow':{'type':Sequelize[_0x92ab('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x92ab('0x3')],'allowNull':![],'defaultValue':_0x92ab('0x2e'),'set':function(_0x3462d5){this['setDataValue'](_0x92ab('0x2f'),_0x3462d5?_0x3462d5[_0x92ab('0x20')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x92ab('0x2f'))?this[_0x92ab('0xa')](_0x92ab('0x2f'))[_0x92ab('0x2c')](';'):null;},'comment':_0x92ab('0x30')},'autoframing':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![],'set':function(_0x4b0392){this[_0x92ab('0x5')](_0x92ab('0x31'),_0x4b0392?_0x4b0392[_0x92ab('0x20')](','):null);},'get':function(){return this[_0x92ab('0xa')](_0x92ab('0x31'))?this[_0x92ab('0xa')](_0x92ab('0x31'))[_0x92ab('0x2c')](','):null;},'comment':_0x92ab('0x32')},'trustrpid':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x92ab('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x92ab('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x92ab('0xd')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no',_0x92ab('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x34'),_0x92ab('0x35'),_0x92ab('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x92ab('0x37'),_0x92ab('0x38')),'allowNull':!![],'defaultValue':_0x92ab('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x92ab('0x26'),'no'),'allowNull':!![],'defaultValue':_0x92ab('0x26')},'keepalive':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x92ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x92ab('0x26'),'no',_0x92ab('0x39'),_0x92ab('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x92ab('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x3b'),'passive',_0x92ab('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'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[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x92ab('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no',_0x92ab('0x27'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x92ab('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x92ab('0x15')]},'showWebBar':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x0,'set':function(_0x25a6d8){this[_0x92ab('0x5')]('showWebBar',_0x25a6d8);var _0x1651fd=this[_0x92ab('0x3d')]({'plain':!![]});switch(_0x25a6d8){case 0x0:case 0x1:var _0x4fb46e=_0x1651fd[_0x92ab('0x21')]?_[_0x92ab('0x3e')](_0x1651fd[_0x92ab('0x21')])?_0x1651fd[_0x92ab('0x21')][_0x92ab('0x20')]():_0x1651fd[_0x92ab('0x21')]:'udp';if(_0x4fb46e==='wss'){_0x4fb46e=_0x92ab('0x3f');}this[_0x92ab('0x5')](_0x92ab('0x21'),_0x4fb46e);this[_0x92ab('0x5')]('encryption','no');this[_0x92ab('0x5')](_0x92ab('0x40'),null);this[_0x92ab('0x5')](_0x92ab('0x41'),null);this[_0x92ab('0x5')](_0x92ab('0x42'),null);this[_0x92ab('0x5')](_0x92ab('0x43'),null);this['setDataValue'](_0x92ab('0x44'),null);this['setDataValue']('dtlssetup',null);this[_0x92ab('0x5')]('dtlscertfile',null);this[_0x92ab('0x5')](_0x92ab('0x45'),null);this['setDataValue'](_0x92ab('0x46'),'no');break;case 0x2:this[_0x92ab('0x5')](_0x92ab('0x21'),_0x92ab('0x47'));this[_0x92ab('0x5')](_0x92ab('0x48'),_0x92ab('0x26'));this['setDataValue'](_0x92ab('0x40'),_0x92ab('0x26'));this[_0x92ab('0x5')]('force_avp',_0x92ab('0x26'));this['setDataValue'](_0x92ab('0x42'),'yes');this[_0x92ab('0x5')](_0x92ab('0x43'),_0x92ab('0x26'));this[_0x92ab('0x5')](_0x92ab('0x44'),'no');this[_0x92ab('0x5')](_0x92ab('0x49'),_0x92ab('0x3c'));this[_0x92ab('0x5')](_0x92ab('0x4a'),_0x1651fd[_0x92ab('0x4a')]||_0x92ab('0x4b'));this[_0x92ab('0x5')]('dtlsprivatekey',_0x1651fd[_0x92ab('0x45')]||_0x92ab('0x4c'));this['setDataValue'](_0x92ab('0x46'),_0x92ab('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0x92ab('0x4d')],'set':function(_0x1ca883){this[_0x92ab('0x5')](_0x92ab('0x4e'),_0x1ca883?_0x1ca883[_0x92ab('0x20')](','):[]);},'get':function(){return this[_0x92ab('0xa')](_0x92ab('0x4e'))?_[_0x92ab('0x4f')](this['getDataValue'](_0x92ab('0x4e'))[_0x92ab('0x2c')](','),function(_0x19b0ca){return parseInt(_0x19b0ca,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x92ab('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x92ab('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x92ab('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x92ab('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x92ab('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x92ab('0xd')](_0x92ab('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize[_0x92ab('0x15')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x92ab('0x50')],'get':function(){return this[_0x92ab('0xa')](_0x92ab('0x51'))?this[_0x92ab('0xa')](_0x92ab('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x92ab('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x92ab('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![],'set':function(_0xb430a1){if(typeof _0xb430a1==='string'){var _0x23f0a0=_0xb430a1==='1'?!![]:_0xb430a1==='0'?![]:_0xb430a1===_0x92ab('0x52')?!![]:_0xb430a1===_0x92ab('0x53')?![]:![];this[_0x92ab('0x5')](_0x92ab('0x54'),_0x23f0a0);}else{this[_0x92ab('0x5')](_0x92ab('0x54'),_0xb430a1);}}},'blocked':{'type':Sequelize[_0x92ab('0x14')],'defaultValue':![],'set':function(_0x5a4899){this[_0x92ab('0x5')](_0x92ab('0x55'),_0x5a4899);if(_0x5a4899===!![]){this[_0x92ab('0x5')](_0x92ab('0x56'),moment());this['setDataValue'](_0x92ab('0x57'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 5802362..f6da24e 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 _0xfbc8=['User,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','user','Agents','filter','ignore','map','value','includes','role','find','UserProfileResource','stack','name','send','index','User','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','sequelize','col','options','findAll','rows','catch','params','password','includeAll','include','bulkCreate','body','describe','addContacts','omit','ids','agent','agent\x20role','telephone','admin','../../config/license/util','getLicense','users','isNil','format','count\x20%s:\x20%s','create','internal','Setting','findById','securePassword','min_internal','max','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','from','voicemail','mailbox','fullname','permissions','102','103','113','104','105','108','109','100','111','114','VoiceMail','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','VoiceQueue','online','push','UserVoiceQueueRt','removeQueues','remove','Queue:remove','userpic','file','filename','getAvatar','root','join','server/files/images/','download','CmContact','getContacts','CmList','List','Tag','Tags','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','upsert','MemberReport','forEach','update','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','voice','manual','chat','fax','sms','openchannel','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','each','Queue:save','removeTeams','getFaxQueues','Fax','removeAgent','getDataValue','getLists','getAgents','values','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$any','firstName','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','redis','defaults','socket.io-emitter','./user.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~!@#$%^&-_=+[{]}.','info','User,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x15304d,_0x24b0d5){var _0x5579d2=function(_0x57a504){while(--_0x57a504){_0x15304d['push'](_0x15304d['shift']());}};_0x5579d2(++_0x24b0d5);}(_0xfbc8,0x14c));var _0x8fbc=function(_0x1a4a49,_0xf73c87){_0x1a4a49=_0x1a4a49-0x0;var _0x3be8cd=_0xfbc8[_0x1a4a49];return _0x3be8cd;};'use strict';var pdf=require(_0x8fbc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8fbc('0x1'));var zipdir=require(_0x8fbc('0x2'));var jsonpatch=require(_0x8fbc('0x3'));var rp=require(_0x8fbc('0x4'));var moment=require(_0x8fbc('0x5'));var BPromise=require(_0x8fbc('0x6'));var Mustache=require(_0x8fbc('0x7'));var util=require(_0x8fbc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8fbc('0x9'));var ejs=require(_0x8fbc('0xa'));var fs=require('fs');var _=require(_0x8fbc('0xb'));var squel=require(_0x8fbc('0xc'));var crypto=require('crypto');var jsforce=require(_0x8fbc('0xd'));var deskjs=require(_0x8fbc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8fbc('0xf'));var Papa=require(_0x8fbc('0x10'));var Redis=require(_0x8fbc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8fbc('0x12'));var as=require(_0x8fbc('0x13'));var hardwareService=require(_0x8fbc('0x14'));var logger=require(_0x8fbc('0x15'))(_0x8fbc('0x16'));var utils=require(_0x8fbc('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8fbc('0x18')]=_[_0x8fbc('0x19')](config[_0x8fbc('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8fbc('0x1a'))(new Redis(config[_0x8fbc('0x18')]));require(_0x8fbc('0x1b'))[_0x8fbc('0x1c')](socket);var jayson=require(_0x8fbc('0x1d'));var client=jayson[_0x8fbc('0x1e')][_0x8fbc('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x252115,_0x3aa68b,_0x2b84db){if(_0x2b84db){var _0x14dbb1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14dbb1[_0x8fbc('0x20')](_0x3aa68b)){return _0x252115;}else{throw new db[(_0x8fbc('0x21'))][(_0x8fbc('0x22'))](_0x8fbc('0x23'));}}else{return _0x252115;}}function respondWithRpcPromise(_0x134229,_0x476fbc,_0x406e11,_0x3c789a){return new BPromise(function(_0x36b4ee,_0x4893d8){var _0x2ee782=_0x3c789a||client;return _0x2ee782['request'](_0x134229,_0x406e11)['then'](function(_0x110816){logger[_0x8fbc('0x24')](_0x8fbc('0x25'),_0x476fbc,_0x8fbc('0x26'));logger[_0x8fbc('0x27')](_0x8fbc('0x28'),_0x476fbc,_0x8fbc('0x26'),JSON['stringify'](_0x110816));if(_0x110816[_0x8fbc('0x29')]){if(_0x110816['error'][_0x8fbc('0x2a')]===0x1f4){logger[_0x8fbc('0x29')](_0x8fbc('0x25'),_0x476fbc,_0x110816['error']['message']);return _0x4893d8(_0x110816[_0x8fbc('0x29')]['message']);}logger[_0x8fbc('0x29')](_0x8fbc('0x25'),_0x476fbc,_0x110816[_0x8fbc('0x29')][_0x8fbc('0x2b')]);return _0x36b4ee(_0x110816[_0x8fbc('0x29')][_0x8fbc('0x2b')]);}else{logger[_0x8fbc('0x24')](_0x8fbc('0x25'),_0x476fbc,_0x8fbc('0x26'));_0x36b4ee(_0x110816[_0x8fbc('0x2c')][_0x8fbc('0x2b')]);}})['catch'](function(_0x10d9f4){logger[_0x8fbc('0x29')](_0x8fbc('0x25'),_0x476fbc,_0x10d9f4);_0x4893d8(_0x10d9f4);});});}function respondWithStatusCode(_0x57a2f7,_0x39cb46){_0x39cb46=_0x39cb46||0xcc;return function(_0x4198c5){if(_0x4198c5){return _0x57a2f7[_0x8fbc('0x2d')](_0x39cb46);}return _0x57a2f7['status'](_0x39cb46)[_0x8fbc('0x2e')]();};}function respondWithResult(_0x929c73,_0x58f55f){_0x58f55f=_0x58f55f||0xc8;return function(_0x46db85){if(_0x46db85){return _0x929c73[_0x8fbc('0x2f')](_0x58f55f)[_0x8fbc('0x30')](_0x46db85);}};}function respondWithFilteredResult(_0x3f3caa,_0x143335){return function(_0xee7dbe){if(_0xee7dbe){var _0x1110ae=_0xee7dbe[_0x8fbc('0x31')],_0x1a43ff=_0x143335[_0x8fbc('0x32')],_0x58262c=_0x143335[_0x8fbc('0x32')]+_0x143335[_0x8fbc('0x33')],_0x22578e;if(_0x58262c>=_0x1110ae){_0x58262c=_0x1110ae;_0x22578e=0xc8;}else{_0x22578e=0xce;}_0x3f3caa[_0x8fbc('0x2f')](_0x22578e);return _0x3f3caa[_0x8fbc('0x34')](_0x8fbc('0x35'),_0x1a43ff+'-'+_0x58262c+'/'+_0x1110ae)[_0x8fbc('0x30')](_0xee7dbe);}return null;};}function patchUpdates(_0x44ddb0){return function(_0x455f75){try{jsonpatch['apply'](_0x455f75,_0x44ddb0,!![]);}catch(_0x289383){return BPromise[_0x8fbc('0x36')](_0x289383);}return _0x455f75[_0x8fbc('0x37')]();};}function saveUpdates(_0xe67ef,_0x47e3dc){return function(_0x1406ad){if(_0x1406ad){return _0x1406ad['update'](_0xe67ef)['then'](function(_0x11b870){return _0x11b870;});}return null;};}function removeEntity(_0x259bf1,_0xc30cdd){return function(_0x5bfe6d){if(_0x5bfe6d){return _0x5bfe6d[_0x8fbc('0x38')]()[_0x8fbc('0x39')](function(){var _0x4a0a81=_0x5bfe6d['get']({'plain':!![]});var _0xdf7ce7=[{'name':'Users','value':_0x8fbc('0x3a'),'ignore':!![]},{'name':_0x8fbc('0x3b'),'value':'agent','ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x1ac429=_(_0xdf7ce7)[_0x8fbc('0x3c')](_0x8fbc('0x3d'))[_0x8fbc('0x3e')](_0x8fbc('0x3f'))[_0x8fbc('0x3f')]();if(_[_0x8fbc('0x40')](_0x1ac429,_0x4a0a81[_0x8fbc('0x41')])){return;}var _0x186ac4=_[_0x8fbc('0x42')](_0xdf7ce7,[_0x8fbc('0x3f'),_0x4a0a81['role']])['name'];return db[_0x8fbc('0x43')][_0x8fbc('0x38')]({'where':{'type':_0x186ac4,'resourceId':_0x4a0a81['id']}})[_0x8fbc('0x39')](function(){return _0x5bfe6d;});})[_0x8fbc('0x39')](function(){_0x259bf1[_0x8fbc('0x2f')](0xcc)[_0x8fbc('0x2e')]();});}};}function handleEntityNotFound(_0x10ad2c,_0x32a209){return function(_0x595f06){if(!_0x595f06){_0x10ad2c[_0x8fbc('0x2d')](0x194);}return _0x595f06;};}function handleError(_0x14b6bb,_0x5bff74){_0x5bff74=_0x5bff74||0x1f4;return function(_0xed4572){logger[_0x8fbc('0x29')](_0xed4572[_0x8fbc('0x44')]);if(_0xed4572[_0x8fbc('0x45')]){delete _0xed4572[_0x8fbc('0x45')];}_0x14b6bb['status'](_0x5bff74)[_0x8fbc('0x46')](_0xed4572);};}exports[_0x8fbc('0x47')]=function(_0x110d0d,_0x5aa860){var _0x30859b={},_0xc51989={},_0x825dd5={'count':0x0,'rows':[]};var _0x302e6d=_[_0x8fbc('0x3e')](db[_0x8fbc('0x48')][_0x8fbc('0x49')],function(_0xd76598){return{'name':_0xd76598[_0x8fbc('0x4a')],'type':_0xd76598[_0x8fbc('0x4b')][_0x8fbc('0x4c')]};});_0xc51989[_0x8fbc('0x4d')]=_[_0x8fbc('0x4e')](_[_0x8fbc('0x3e')](_0x302e6d,'name'),['password','salt']);_0xc51989[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x110d0d[_0x8fbc('0x4f')]);_0xc51989[_0x8fbc('0x51')]=_[_0x8fbc('0x52')](_0xc51989[_0x8fbc('0x4d')],_0xc51989[_0x8fbc('0x4f')]);_0x30859b[_0x8fbc('0x53')]=_['intersection'](_0xc51989[_0x8fbc('0x4d')],qs['fields'](_0x110d0d['query'][_0x8fbc('0x54')]));_0x30859b['attributes']=_0x30859b[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0x30859b['attributes']:_0xc51989[_0x8fbc('0x4d')];if(!_0x110d0d[_0x8fbc('0x4f')][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0x30859b[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x110d0d[_0x8fbc('0x4f')][_0x8fbc('0x33')]);_0x30859b[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x110d0d[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}_0x30859b[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x110d0d[_0x8fbc('0x4f')]['sort']);_0x30859b[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x110d0d[_0x8fbc('0x4f')],_0xc51989[_0x8fbc('0x51')]),_0x302e6d);if(_0x110d0d[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x30859b[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x30859b[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x302e6d,function(_0x5270dd){if(_0x5270dd[_0x8fbc('0x4b')]!==_0x8fbc('0x5d')){return db[_0x8fbc('0x5e')][_0x8fbc('0x5a')](db[_0x8fbc('0x5e')]['fn']('lower',db[_0x8fbc('0x5e')][_0x8fbc('0x5f')](_0x5270dd[_0x8fbc('0x45')])),{'$like':db[_0x8fbc('0x5e')]['fn']('lower','%'+_0x110d0d[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%')});}})});}_0x30859b=_['merge']({},_0x30859b,_0x110d0d[_0x8fbc('0x60')]);var _0x4c2a05={'where':_0x30859b['where']};return db[_0x8fbc('0x48')]['count'](_0x4c2a05)[_0x8fbc('0x39')](function(_0x431c1d){_0x825dd5[_0x8fbc('0x31')]=_0x431c1d;if(_0x110d0d[_0x8fbc('0x4f')]['includeAll']){_0x30859b['include']=[{'all':!![]}];}return db[_0x8fbc('0x48')][_0x8fbc('0x61')](_0x30859b);})[_0x8fbc('0x39')](function(_0x4b393e){_0x825dd5[_0x8fbc('0x62')]=_0x4b393e;return _0x825dd5;})['then'](respondWithFilteredResult(_0x5aa860,_0x30859b))[_0x8fbc('0x63')](handleError(_0x5aa860,null));};exports['show']=function(_0x4d7bc5,_0x312891){var _0x511131={'raw':![],'where':{'id':_0x4d7bc5[_0x8fbc('0x64')]['id']}},_0x19d052={};_0x19d052['model']=_[_0x8fbc('0x4e')](_[_0x8fbc('0x50')](db['User'][_0x8fbc('0x49')]),[_0x8fbc('0x65'),'salt']);_0x19d052['query']=_[_0x8fbc('0x50')](_0x4d7bc5[_0x8fbc('0x4f')]);_0x19d052['filters']=_['intersection'](_0x19d052['model'],_0x19d052[_0x8fbc('0x4f')]);_0x511131[_0x8fbc('0x53')]=_['intersection'](_0x19d052[_0x8fbc('0x4d')],qs[_0x8fbc('0x54')](_0x4d7bc5['query'][_0x8fbc('0x54')]));_0x511131[_0x8fbc('0x53')]=_0x511131[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0x511131[_0x8fbc('0x53')]:_0x19d052[_0x8fbc('0x4d')];if(_0x4d7bc5['query'][_0x8fbc('0x66')]){_0x511131[_0x8fbc('0x67')]=[{'all':!![]}];}_0x511131=_[_0x8fbc('0x5c')]({},_0x511131,_0x4d7bc5['options']);return db[_0x8fbc('0x48')][_0x8fbc('0x42')](_0x511131)[_0x8fbc('0x39')](handleEntityNotFound(_0x312891,null))['then'](respondWithResult(_0x312891,null))[_0x8fbc('0x63')](handleError(_0x312891,null));};exports['bulkCreate']=function(_0x29c6d1,_0x10d2f5){return db[_0x8fbc('0x48')][_0x8fbc('0x68')](_0x29c6d1[_0x8fbc('0x69')],{'raw':![],'individualHooks':!![]})[_0x8fbc('0x39')](respondWithResult(_0x10d2f5,0xc9))[_0x8fbc('0x63')](handleError(_0x10d2f5,null));};exports['update']=function(_0x2b45df,_0x1f143b){if(_0x2b45df['body']['id']){delete _0x2b45df[_0x8fbc('0x69')]['id'];}delete _0x2b45df[_0x8fbc('0x69')][_0x8fbc('0x41')];return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0x2b45df[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x1f143b,null))[_0x8fbc('0x39')](saveUpdates(_0x2b45df[_0x8fbc('0x69')],null))[_0x8fbc('0x39')](respondWithResult(_0x1f143b,null))['catch'](handleError(_0x1f143b,null));};exports[_0x8fbc('0x6a')]=function(_0x5c0cf0,_0x151e57){return db[_0x8fbc('0x48')]['describe']()[_0x8fbc('0x39')](respondWithResult(_0x151e57,null))['catch'](handleError(_0x151e57,null));};exports['addContacts']=function(_0x2eb4c2,_0x24c406,_0x588170){return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0x2eb4c2['params']['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x24c406,null))[_0x8fbc('0x39')](function(_0x5d0683){if(_0x5d0683){return _0x5d0683[_0x8fbc('0x6b')](_0x2eb4c2[_0x8fbc('0x69')]['ids'],_[_0x8fbc('0x6c')](_0x2eb4c2[_0x8fbc('0x69')],[_0x8fbc('0x6d'),'id'])||{});}})[_0x8fbc('0x39')](respondWithResult(_0x24c406,null))[_0x8fbc('0x63')](handleError(_0x24c406,null));};var getLicense=function(_0x561dd2){return new BPromise(function(_0x51b3be,_0x2b0b5f){var _0x3848e6=0x0;_0x561dd2[_0x8fbc('0x69')][_0x8fbc('0x41')]===_0x8fbc('0x6e')&&_0x51b3be(_0x8fbc('0x6f'));return db[_0x8fbc('0x48')][_0x8fbc('0x31')]({'where':{'$or':[{'role':_0x561dd2['body'][_0x8fbc('0x41')]===_0x8fbc('0x70')?_0x8fbc('0x70'):[_0x8fbc('0x71'),'user']}]}})[_0x8fbc('0x39')](function(_0x2448ea){_0x3848e6=_0x2448ea;return require(_0x8fbc('0x72'))[_0x8fbc('0x73')]();})[_0x8fbc('0x39')](function(_0x49b83d){var _0x461450=_0x561dd2[_0x8fbc('0x69')]['role']==='telephone'?'telephones':_0x8fbc('0x74');if(!_[_0x8fbc('0x75')](_0x49b83d[_0x461450])&&_0x3848e6>=_0x49b83d[_0x461450]){return _0x2b0b5f({'message':'License\x20limit\x20reached'});}return _0x51b3be(util[_0x8fbc('0x76')](_0x8fbc('0x77'),_0x461450,_0x3848e6));})['catch'](function(_0x31713c){return _0x2b0b5f(_0x31713c);});});};exports[_0x8fbc('0x78')]=function(_0x426efb,_0x2f54ee){return getLicense(_0x426efb)[_0x8fbc('0x39')](function(_0x29cd52){if(!_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x79')]){var _0x1c4b0d;return db[_0x8fbc('0x7a')][_0x8fbc('0x7b')](0x1)[_0x8fbc('0x39')](function(_0x39238a){return checkPasswordPattern(_0x39238a,_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x65')],_0x39238a[_0x8fbc('0x7c')]);})['then'](function(_0xb717b1){_0x1c4b0d=_0xb717b1[_0x8fbc('0x7d')];return db['User'][_0x8fbc('0x7e')]('internal');})[_0x8fbc('0x39')](function(_0xe747bc){if(_['isNil'](_0xe747bc)){if(_0x1c4b0d){_0x426efb['body'][_0x8fbc('0x79')]=_0x1c4b0d;}else{_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x79')]=0x1;}}else{if(_[_0x8fbc('0x75')](_0x1c4b0d)||_0x1c4b0d==_0xe747bc){_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x79')]=_0xe747bc+0x1;}else if(_0x1c4b0d>_0xe747bc){_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x79')]=_0x1c4b0d;}else{return db[_0x8fbc('0x5e')][_0x8fbc('0x4f')](_0x8fbc('0x7f'),{'type':db[_0x8fbc('0x5e')]['QueryTypes']['SELECT']})[_0x8fbc('0x39')](function(_0x2f5379){if(_0x2f5379&&_0x2f5379[_0x8fbc('0x55')]){for(var _0x5db852=0x0,_0x4bfa1b=_0x2f5379[_0x8fbc('0x55')];_0x5db852<_0x4bfa1b&&_[_0x8fbc('0x75')](_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x79')]);_0x5db852++){if(_0x1c4b0d<=_0x2f5379[_0x5db852]['from']){_0x426efb['body'][_0x8fbc('0x79')]=_0x2f5379[_0x5db852]['from'];}else if(_0x1c4b0d>_0x2f5379[_0x5db852][_0x8fbc('0x80')]&&_0x1c4b0d<=_0x2f5379[_0x5db852]['to']){_0x426efb['body']['internal']=_0x1c4b0d;}}}if(_['isNil'](_0x426efb['body'][_0x8fbc('0x79')])){_0x426efb[_0x8fbc('0x69')]['internal']=_0xe747bc+0x1;}});}}});}})[_0x8fbc('0x39')](function(){if(_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x81')]){_0x426efb['body'][_0x8fbc('0x82')]=_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x79')];_0x426efb[_0x8fbc('0x69')]['VoiceMail']={'mailbox':_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x79')],'password':_0x426efb[_0x8fbc('0x69')]['password'],'fullname':_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x83')],'email':_0x426efb[_0x8fbc('0x69')]['email']};}if(_0x426efb[_0x8fbc('0x69')]&&_0x426efb[_0x8fbc('0x69')]['role']===_0x8fbc('0x6e')){if(!_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x84')]){_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x84')]=['101',_0x8fbc('0x85'),_0x8fbc('0x86'),_0x8fbc('0x87'),'110',_0x8fbc('0x88'),_0x8fbc('0x89'),'106','107',_0x8fbc('0x8a'),_0x8fbc('0x8b'),_0x8fbc('0x8c'),_0x8fbc('0x8d'),_0x8fbc('0x8e')];}}return db[_0x8fbc('0x48')][_0x8fbc('0x78')](_0x426efb['body'],{'include':[{'model':db[_0x8fbc('0x8f')],'as':_0x8fbc('0x8f')}]});})[_0x8fbc('0x39')](function(_0x3ba0f3){if(_0x426efb[_0x8fbc('0x69')][_0x8fbc('0x41')]===_0x8fbc('0x3a'))return _0x3ba0f3;var _0x2ea657=_0x426efb[_0x8fbc('0x3a')][_0x8fbc('0x90')]({'plain':!![]});if(!_0x2ea657)throw new Error(_0x8fbc('0x91'));if(_0x2ea657[_0x8fbc('0x41')]===_0x8fbc('0x3a')){var _0x4a1d82=_0x3ba0f3[_0x8fbc('0x90')]({'plain':!![]});var _0x36baa0=[{'name':_0x8fbc('0x3b'),'value':_0x8fbc('0x6e')},{'name':'Telephones','value':_0x8fbc('0x70')}];var _0x5e1cd6=_[_0x8fbc('0x42')](_0x36baa0,[_0x8fbc('0x3f'),_0x4a1d82[_0x8fbc('0x41')]])['name'];return db[_0x8fbc('0x92')]['find']({'where':{'name':_0x5e1cd6,'userProfileId':_0x2ea657[_0x8fbc('0x93')]},'raw':!![]})[_0x8fbc('0x39')](function(_0x2c3630){if(_0x2c3630&&_0x2c3630[_0x8fbc('0x94')]===0x0){return db[_0x8fbc('0x43')][_0x8fbc('0x78')]({'name':_0x4a1d82[_0x8fbc('0x45')],'resourceId':_0x4a1d82['id'],'type':_0x2c3630['name'],'sectionId':_0x2c3630['id']},{})[_0x8fbc('0x39')](function(){return _0x3ba0f3;});}else{return _0x3ba0f3;}})[_0x8fbc('0x63')](function(_0x10c01e){logger['error'](_0x8fbc('0x95'),_0x10c01e);throw _0x10c01e;});}return _0x3ba0f3;})[_0x8fbc('0x39')](respondWithResult(_0x2f54ee,0xc9))[_0x8fbc('0x63')](handleError(_0x2f54ee,null));};exports[_0x8fbc('0x96')]=function(_0x29625f,_0xf16fd7,_0x19f20d){var _0x4a453a=![];if(_0x29625f[_0x8fbc('0x69')]['id']){delete _0x29625f[_0x8fbc('0x69')]['id'];}return db[_0x8fbc('0x7a')][_0x8fbc('0x97')]({'attributes':['id',_0x8fbc('0x7c')]})[_0x8fbc('0x39')](function(_0xeb43df){_0x4a453a=_0xeb43df[_0x8fbc('0x7c')];return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0x29625f[_0x8fbc('0x64')]['id']}});})[_0x8fbc('0x39')](function(_0x314000){if(_0x314000){if(_0x314000['id']==_0x29625f[_0x8fbc('0x3a')]['id']){if(!_0x29625f[_0x8fbc('0x69')]['oldPassword']||!_0x29625f[_0x8fbc('0x69')][_0x8fbc('0x98')]){throw new db[(_0x8fbc('0x21'))][(_0x8fbc('0x22'))](_0x8fbc('0x99'));}if(!_0x314000[_0x8fbc('0x9a')](_0x29625f[_0x8fbc('0x69')]['oldPassword'])){throw new db[(_0x8fbc('0x21'))][(_0x8fbc('0x22'))](_0x8fbc('0x9b'));}if(_0x29625f[_0x8fbc('0x69')][_0x8fbc('0x9c')]==_0x29625f[_0x8fbc('0x69')][_0x8fbc('0x98')]){throw new db[(_0x8fbc('0x21'))][(_0x8fbc('0x22'))](_0x8fbc('0x9d'));}return _0x314000;}else if(_0x29625f[_0x8fbc('0x3a')][_0x8fbc('0x41')]==_0x8fbc('0x71')){if(!_0x29625f['body'][_0x8fbc('0x98')]){throw new db[(_0x8fbc('0x21'))]['ValidationError'](_0x8fbc('0x9e'));}return _0x314000;}else if(_0x29625f[_0x8fbc('0x3a')][_0x8fbc('0x41')]==_0x8fbc('0x3a')){if(!_0x29625f[_0x8fbc('0x69')][_0x8fbc('0x98')]){throw new db['Sequelize'][(_0x8fbc('0x22'))](_0x8fbc('0x9e'));}if(_0x314000[_0x8fbc('0x41')]!='agent'){throw new db['Sequelize'][(_0x8fbc('0x22'))](_0x8fbc('0x9f'));}return _0x314000;}else{throw new db['Sequelize']['ValidationError'](_0x8fbc('0x9f'));}}return null;})[_0x8fbc('0x39')](handleEntityNotFound(_0xf16fd7,null))['then'](function(_0x3aa412){return checkPasswordPattern(_0x3aa412,_0x29625f[_0x8fbc('0x69')][_0x8fbc('0x98')],_0x4a453a);})[_0x8fbc('0x39')](saveUpdates({'password':_0x29625f['body'][_0x8fbc('0x98')],'passwordResetAt':_0x29625f[_0x8fbc('0x3a')]['id']==_0x29625f['params']['id']?moment():null},null))['then'](respondWithResult(_0xf16fd7,null))[_0x8fbc('0x63')](handleError(_0xf16fd7,null));};exports[_0x8fbc('0xa0')]=function(_0x3635d6,_0x352215,_0x57bb72){var _0xf613e8=_0x3635d6[_0x8fbc('0x69')][_0x8fbc('0xa1')];return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0x3635d6['params']['id']},'attributes':['id','name','role','online',_0x8fbc('0xa2'),_0x8fbc('0xa3'),_0x8fbc('0xa4')]})[_0x8fbc('0x39')](handleEntityNotFound(_0x352215,null))[_0x8fbc('0x39')](function(_0x2ba129){if(_0x2ba129){if(!utils[_0x8fbc('0xa5')](_0xf613e8)){throw new db['Sequelize'][(_0x8fbc('0x22'))](_0x8fbc('0xa6'));}return _0x2ba129[_0x8fbc('0xa7')+_[_0x8fbc('0xa8')](_0xf613e8[_0x8fbc('0xa9')]())+_0x8fbc('0xaa')](_0x3635d6[_0x8fbc('0x69')][_0x8fbc('0x6d')],{'penalty':_0x3635d6[_0x8fbc('0x69')][_0x8fbc('0xab')]||0x0})[_0x8fbc('0xac')](function(_0x4abd6e){for(var _0x462972=0x0;_0x462972<_0x3635d6[_0x8fbc('0x69')][_0x8fbc('0x6d')]['length'];_0x462972+=0x1){var _0x23ef57={'UserId':_0x3635d6[_0x8fbc('0x64')]['id']};_0x23ef57[_[_0x8fbc('0xa8')](_0xf613e8[_0x8fbc('0xa9')]())+_0x8fbc('0xad')]=_0x3635d6[_0x8fbc('0x69')][_0x8fbc('0x6d')][_0x462972];socket[_0x8fbc('0xae')](_0x8fbc('0x3a')+_['capitalize'](_0xf613e8[_0x8fbc('0xa9')]())+'Queue:save',_0x23ef57);}return _0x4abd6e;})[_0x8fbc('0x39')](function(){if(_0xf613e8==='voice'){return db[_0x8fbc('0xaf')]['findAll']({'where':{'id':_0x3635d6[_0x8fbc('0x69')][_0x8fbc('0x6d')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x7bb46c){var _0x54a726=_0x2ba129[_0x8fbc('0x90')]({'plain':!![]});var _0x3338c7=[];if(_0xf613e8==='voice'&&_0x54a726['role']===_0x8fbc('0x6e')&&_0x54a726[_0x8fbc('0xb0')]){for(var _0x244235=0x0;_0x244235<_0x7bb46c[_0x8fbc('0x55')];_0x244235+=0x1){_0x3338c7[_0x8fbc('0xb1')]({'membername':_0x54a726['name'],'UserId':_0x54a726['id'],'queue_name':_0x7bb46c[_0x244235][_0x8fbc('0x45')],'VoiceQueueId':_0x7bb46c[_0x244235]['id'],'interface':_['isNil'](_0x54a726['interface'])?util[_0x8fbc('0x76')]('SIP/%s',_0x54a726[_0x8fbc('0x45')]):_0x54a726[_0x8fbc('0xa4')],'paused':_0x54a726['voicePause']||![],'penalty':_0x3635d6[_0x8fbc('0x69')][_0x8fbc('0xab')]||0x0});}return BPromise['each'](_0x3338c7,function(_0x49876e){return db[_0x8fbc('0xb2')]['upsert'](_0x49876e);});}return _0x2ba129;});}})['then'](respondWithStatusCode(_0x352215,null))[_0x8fbc('0x63')](handleError(_0x352215,null));};exports[_0x8fbc('0xb3')]=function(_0x59c54c,_0x5cefa7,_0x35ae76){var _0x2ded31;return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0x59c54c[_0x8fbc('0x64')]['id']},'attributes':['id',_0x8fbc('0x45'),_0x8fbc('0x41')]})[_0x8fbc('0x39')](handleEntityNotFound(_0x5cefa7,null))[_0x8fbc('0x39')](function(_0x304498){if(_0x304498){_0x2ded31=_0x304498;if(!_0x59c54c[_0x8fbc('0x4f')][_0x8fbc('0xa1')]||!utils[_0x8fbc('0xa5')](_0x59c54c[_0x8fbc('0x4f')][_0x8fbc('0xa1')])){throw new db['Sequelize'][(_0x8fbc('0x22'))](_0x8fbc('0xa6'));}return _0x304498[_0x8fbc('0xb4')+_[_0x8fbc('0xa8')](_0x59c54c[_0x8fbc('0x4f')][_0x8fbc('0xa1')][_0x8fbc('0xa9')]())+'Queues'](_0x59c54c['query'][_0x8fbc('0x6d')]);}})[_0x8fbc('0x39')](function(_0x3b4e04){for(var _0x510bee=0x0;_0x510bee<_0x59c54c[_0x8fbc('0x4f')][_0x8fbc('0x6d')]['length'];_0x510bee+=0x1){var _0x47f799={'UserId':_0x59c54c[_0x8fbc('0x64')]['id']};_0x47f799[_[_0x8fbc('0xa8')](_0x59c54c[_0x8fbc('0x4f')][_0x8fbc('0xa1')][_0x8fbc('0xa9')]())+_0x8fbc('0xad')]=_0x59c54c['query'][_0x8fbc('0x6d')][_0x510bee];socket[_0x8fbc('0xae')](_0x8fbc('0x3a')+_[_0x8fbc('0xa8')](_0x59c54c[_0x8fbc('0x4f')][_0x8fbc('0xa1')][_0x8fbc('0xa9')]())+_0x8fbc('0xb5'),_0x47f799);}return _0x3b4e04;})['then'](function(){if(_0x59c54c[_0x8fbc('0x4f')][_0x8fbc('0xa1')]==='voice'){return db[_0x8fbc('0xb2')][_0x8fbc('0x38')]({'where':{'UserId':_0x59c54c[_0x8fbc('0x64')]['id'],'VoiceQueueId':_0x59c54c[_0x8fbc('0x4f')][_0x8fbc('0x6d')]},'individualHooks':!![]})['then'](function(){return _0x2ded31;});}return _0x2ded31;})['then'](respondWithStatusCode(_0x5cefa7,null))['catch'](handleError(_0x5cefa7,null));};exports['addAvatar']=function(_0xd3bcce,_0xc45911,_0x2a186b){_0xd3bcce[_0x8fbc('0x69')][_0x8fbc('0xb6')]=_0xd3bcce[_0x8fbc('0xb7')][_0x8fbc('0xb8')];return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0xd3bcce[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0xc45911,null))[_0x8fbc('0x39')](saveUpdates(_0xd3bcce[_0x8fbc('0x69')],null))[_0x8fbc('0x39')](respondWithResult(_0xc45911,null))[_0x8fbc('0x63')](handleError(_0xc45911,null));};exports[_0x8fbc('0xb9')]=function(_0x50ef03,_0x146f01,_0x5ed02c){var _0x4417c7=path['join'](config[_0x8fbc('0xba')],'server/files/images/logos/default_profile.png');return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0x50ef03['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8fbc('0x39')](handleEntityNotFound(_0x146f01,null))['then'](function(_0x13a3b3){if(_0x13a3b3){if(_[_0x8fbc('0x75')](_0x13a3b3['userpic'])){return _0x146f01['download'](_0x4417c7);}else{if(!fs['existsSync'](path[_0x8fbc('0xbb')](config[_0x8fbc('0xba')],_0x8fbc('0xbc'),_0x13a3b3[_0x8fbc('0xb6')]))){return _0x146f01[_0x8fbc('0xbd')](_0x4417c7);}return _0x146f01['download'](path['join'](config[_0x8fbc('0xba')],_0x8fbc('0xbc'),_0x13a3b3[_0x8fbc('0xb6')]));}}})[_0x8fbc('0x63')](handleError(_0x146f01,null));};exports['getContacts']=function(_0x30ca9f,_0x1701b5,_0xbf8261){var _0x52ad3a={};var _0x28efbd={};var _0x12bac5;var _0x182761;return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x30ca9f[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x1701b5,null))[_0x8fbc('0x39')](function(_0x1999b2){if(_0x1999b2){_0x12bac5=_0x1999b2;_0x28efbd[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](db[_0x8fbc('0xbe')][_0x8fbc('0x49')]);_0x28efbd[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x30ca9f['query']);_0x28efbd['filters']=_['intersection'](_0x28efbd[_0x8fbc('0x4d')],_0x28efbd[_0x8fbc('0x4f')]);_0x52ad3a[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x28efbd[_0x8fbc('0x4d')],qs['fields'](_0x30ca9f[_0x8fbc('0x4f')][_0x8fbc('0x54')]));_0x52ad3a['attributes']=_0x52ad3a[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0x52ad3a[_0x8fbc('0x53')]:_0x28efbd['model'];_0x52ad3a[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x30ca9f[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x52ad3a[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x30ca9f[_0x8fbc('0x4f')],_0x28efbd['filters']));if(_0x30ca9f[_0x8fbc('0x4f')]['filter']){_0x52ad3a[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x52ad3a[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x52ad3a[_0x8fbc('0x53')],function(_0x1ec998){var _0x1920c0={};_0x1920c0[_0x1ec998]={'$like':'%'+_0x30ca9f[_0x8fbc('0x4f')]['filter']+'%'};return _0x1920c0;})});}_0x52ad3a=_['merge']({},_0x52ad3a,_0x30ca9f[_0x8fbc('0x60')]);return _0x12bac5[_0x8fbc('0xbf')](_0x52ad3a);}})[_0x8fbc('0x39')](function(_0x15a694){if(_0x15a694){_0x182761=_0x15a694[_0x8fbc('0x55')];if(_0x30ca9f['query']['hasOwnProperty'](_0x8fbc('0x66'))){_0x52ad3a['include']=[{'model':db[_0x8fbc('0xc0')],'as':_0x8fbc('0xc1'),'required':![]},{'model':db[_0x8fbc('0xc2')],'as':_0x8fbc('0xc3'),'attributes':['id',_0x8fbc('0x45'),'color'],'where':_0x30ca9f[_0x8fbc('0x4f')][_0x8fbc('0xc4')]?{'id':_0x30ca9f[_0x8fbc('0x4f')][_0x8fbc('0xc4')]}:undefined,'required':_0x30ca9f[_0x8fbc('0x4f')]['tag']?!![]:![]}];}if(!_0x30ca9f[_0x8fbc('0x4f')][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0x52ad3a[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x30ca9f['query'][_0x8fbc('0x33')]);_0x52ad3a[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x30ca9f[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}return _0x12bac5[_0x8fbc('0xbf')](_0x52ad3a);}})[_0x8fbc('0x39')](function(_0x40b163){if(_0x40b163){return _0x40b163?{'count':_0x182761,'rows':_0x40b163}:null;}})['then'](respondWithResult(_0x1701b5,null))['catch'](handleError(_0x1701b5,null));};exports[_0x8fbc('0xc5')]=function(_0x256405,_0x1e61ec,_0x4bd387){var _0x57198a;var _0x307466;var _0x1d1b10={};var _0x538c02;return db['User']['findOne']({'where':{'id':_0x256405[_0x8fbc('0x64')]['id']},'attributes':['id',_0x8fbc('0x45'),_0x8fbc('0x41')]})[_0x8fbc('0x39')](handleEntityNotFound(_0x1e61ec,null))[_0x8fbc('0x39')](function(_0xf71479){if(!utils[_0x8fbc('0xa5')](_0x256405[_0x8fbc('0x4f')][_0x8fbc('0xa1')])){throw new db[(_0x8fbc('0x21'))][(_0x8fbc('0x22'))](_0x8fbc('0xa6'));}_0x57198a=_0xf71479;var _0x86f38d={};_0x86f38d[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](db[_['capitalize'](_0x256405[_0x8fbc('0x4f')]['channel'])+_0x8fbc('0xc6')][_0x8fbc('0x49')]);_0x86f38d[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x256405['query']);_0x86f38d[_0x8fbc('0x51')]=_[_0x8fbc('0x52')](_0x86f38d[_0x8fbc('0x4d')],_0x86f38d[_0x8fbc('0x4f')]);_0x1d1b10[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x86f38d[_0x8fbc('0x4d')],qs['fields'](_0x256405[_0x8fbc('0x4f')]['fields']));_0x1d1b10[_0x8fbc('0x53')]=_0x1d1b10['attributes'][_0x8fbc('0x55')]?_0x1d1b10[_0x8fbc('0x53')]:_0x86f38d['model'];_0x1d1b10[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x256405[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x1d1b10[_0x8fbc('0x5a')]=qs['filters'](_[_0x8fbc('0x5b')](_0x256405[_0x8fbc('0x4f')],_0x86f38d['filters']));if(_0x256405['query'][_0x8fbc('0x3c')]){_0x1d1b10[_0x8fbc('0x5a')]=_['merge'](_0x1d1b10[_0x8fbc('0x5a')],{'$or':_['map'](_0x1d1b10[_0x8fbc('0x53')],function(_0x4a98b3){var _0x426413={};_0x426413[_0x4a98b3]={'$like':'%'+_0x256405['query'][_0x8fbc('0x3c')]+'%'};return _0x426413;})});}_0x1d1b10=_[_0x8fbc('0x5c')]({},_0x1d1b10,_0x256405['options']);switch(_0x57198a[_0x8fbc('0x41')]){case _0x8fbc('0x71'):return db[_[_0x8fbc('0xa8')](_0x256405['query'][_0x8fbc('0xa1')])+_0x8fbc('0xc6')][_0x8fbc('0x61')](_0x1d1b10);case'user':case _0x8fbc('0x6e'):return _0x57198a[_0x8fbc('0x90')+_[_0x8fbc('0xa8')](_0x256405[_0x8fbc('0x4f')]['channel'])+'Queues'](_0x1d1b10);default:throw new db[(_0x8fbc('0x21'))][(_0x8fbc('0x22'))](_0x8fbc('0xc7'));}})[_0x8fbc('0x39')](function(_0x2c2e01){_0x538c02=_0x2c2e01['length'];if(!_0x256405[_0x8fbc('0x4f')]['hasOwnProperty'](_0x8fbc('0x57'))){_0x1d1b10[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x256405[_0x8fbc('0x4f')]['limit']);_0x1d1b10[_0x8fbc('0x32')]=qs['offset'](_0x256405['query'][_0x8fbc('0x32')]);}switch(_0x57198a['role']){case _0x8fbc('0x71'):return db[_[_0x8fbc('0xa8')](_0x256405['query'][_0x8fbc('0xa1')])+_0x8fbc('0xc6')][_0x8fbc('0x61')](_0x1d1b10);case _0x8fbc('0x3a'):case _0x8fbc('0x6e'):return _0x57198a[_0x8fbc('0x90')+_[_0x8fbc('0xa8')](_0x256405['query'][_0x8fbc('0xa1')])+'Queues'](_0x1d1b10);}})[_0x8fbc('0x39')](function(_0x56e773){return{'count':_0x538c02,'rows':_0x56e773};})[_0x8fbc('0x39')](respondWithResult(_0x1e61ec,null))['catch'](handleError(_0x1e61ec,null));};exports['getVoiceQueuesRt']=function(_0x3a781c,_0x31f0e2,_0x1b4e97){var _0x21af96={};var _0x39ec0e={};var _0x261de2;var _0x468f6f;return db[_0x8fbc('0x48')]['findOne']({'where':{'id':_0x3a781c[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x31f0e2,null))[_0x8fbc('0x39')](function(_0x385105){if(_0x385105){_0x261de2=_0x385105;_0x39ec0e[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](db[_0x8fbc('0xb2')][_0x8fbc('0x49')]);_0x39ec0e[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x3a781c['query']);_0x39ec0e[_0x8fbc('0x51')]=_['intersection'](_0x39ec0e[_0x8fbc('0x4d')],_0x39ec0e[_0x8fbc('0x4f')]);_0x21af96[_0x8fbc('0x53')]=_['intersection'](_0x39ec0e['model'],qs[_0x8fbc('0x54')](_0x3a781c[_0x8fbc('0x4f')][_0x8fbc('0x54')]));_0x21af96[_0x8fbc('0x53')]=_0x21af96[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0x21af96['attributes']:_0x39ec0e['model'];_0x21af96['order']=qs[_0x8fbc('0x59')](_0x3a781c[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x21af96[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x3a781c[_0x8fbc('0x4f')],_0x39ec0e[_0x8fbc('0x51')]));if(_0x3a781c[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x21af96[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x21af96['where'],{'$or':_['map'](_0x21af96[_0x8fbc('0x53')],function(_0x5d2c65){var _0x598d68={};_0x598d68[_0x5d2c65]={'$like':'%'+_0x3a781c[_0x8fbc('0x4f')]['filter']+'%'};return _0x598d68;})});}_0x21af96=_['merge']({},_0x21af96,_0x3a781c[_0x8fbc('0x60')]);return _0x261de2['getVoiceQueuesRt'](_0x21af96);}})[_0x8fbc('0x39')](function(_0xe4516b){if(_0xe4516b){_0x468f6f=_0xe4516b['length'];if(!_0x3a781c['query']['hasOwnProperty']('nolimit')){_0x21af96[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x3a781c['query'][_0x8fbc('0x33')]);_0x21af96['offset']=qs[_0x8fbc('0x32')](_0x3a781c[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}return _0x261de2[_0x8fbc('0xc8')](_0x21af96);}})[_0x8fbc('0x39')](function(_0x4f9ee0){if(_0x4f9ee0){return _0x4f9ee0?{'count':_0x468f6f,'rows':_0x4f9ee0}:null;}})[_0x8fbc('0x39')](respondWithResult(_0x31f0e2,null))[_0x8fbc('0x63')](handleError(_0x31f0e2,null));};exports[_0x8fbc('0xc9')]=function(_0x1b04cf,_0x21bf11,_0x202ced){var _0x44f441={};var _0x159d3e={};var _0x9a7309;var _0x3efc8e;return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x1b04cf[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x21bf11,null))['then'](function(_0x5501b9){if(_0x5501b9){_0x9a7309=_0x5501b9;_0x159d3e['model']=_[_0x8fbc('0x50')](db[_0x8fbc('0xca')][_0x8fbc('0x49')]);_0x159d3e[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x1b04cf[_0x8fbc('0x4f')]);_0x159d3e[_0x8fbc('0x51')]=_[_0x8fbc('0x52')](_0x159d3e['model'],_0x159d3e['query']);_0x44f441[_0x8fbc('0x53')]=_['intersection'](_0x159d3e['model'],qs[_0x8fbc('0x54')](_0x1b04cf[_0x8fbc('0x4f')][_0x8fbc('0x54')]));_0x44f441[_0x8fbc('0x53')]=_0x44f441[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0x44f441[_0x8fbc('0x53')]:_0x159d3e[_0x8fbc('0x4d')];_0x44f441[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x1b04cf[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x44f441[_0x8fbc('0x5a')]=qs['filters'](_['pick'](_0x1b04cf[_0x8fbc('0x4f')],_0x159d3e[_0x8fbc('0x51')]));if(_0x1b04cf['query'][_0x8fbc('0x3c')]){_0x44f441['where']=_[_0x8fbc('0x5c')](_0x44f441[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x44f441[_0x8fbc('0x53')],function(_0x4d7a4b){var _0x214c05={};_0x214c05[_0x4d7a4b]={'$like':'%'+_0x1b04cf[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%'};return _0x214c05;})});}_0x44f441=_[_0x8fbc('0x5c')]({},_0x44f441,_0x1b04cf[_0x8fbc('0x60')]);return _0x9a7309['getGroups'](_0x44f441);}})[_0x8fbc('0x39')](function(_0x399ba6){if(_0x399ba6){_0x3efc8e=_0x399ba6[_0x8fbc('0x55')];if(!_0x1b04cf[_0x8fbc('0x4f')][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0x44f441[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x1b04cf[_0x8fbc('0x4f')]['limit']);_0x44f441[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x1b04cf[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}return _0x9a7309[_0x8fbc('0xc9')](_0x44f441);}})['then'](function(_0x1167d6){if(_0x1167d6){return _0x1167d6?{'count':_0x3efc8e,'rows':_0x1167d6}:null;}})['then'](respondWithResult(_0x21bf11,null))[_0x8fbc('0x63')](handleError(_0x21bf11,null));};exports[_0x8fbc('0xcb')]=function(_0x3ab81d,_0x305e34,_0x3889dc){var _0x73d778={'raw':!![],'where':{}};var _0x1a1c83={};var _0x5b2797={'count':0x0,'rows':[]};return db[_0x8fbc('0x48')]['findOne']({'where':{'id':_0x3ab81d[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x305e34,null))[_0x8fbc('0x39')](function(_0x6941f6){if(_0x6941f6){_0x1a1c83['model']=_[_0x8fbc('0x50')](db[_0x8fbc('0xcc')][_0x8fbc('0x49')]);_0x1a1c83['query']=_[_0x8fbc('0x50')](_0x3ab81d[_0x8fbc('0x4f')]);_0x1a1c83['filters']=_[_0x8fbc('0x52')](_0x1a1c83[_0x8fbc('0x4d')],_0x1a1c83[_0x8fbc('0x4f')]);_0x73d778[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x1a1c83[_0x8fbc('0x4d')],qs[_0x8fbc('0x54')](_0x3ab81d[_0x8fbc('0x4f')][_0x8fbc('0x54')]));_0x73d778['attributes']=_0x73d778[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0x73d778[_0x8fbc('0x53')]:_0x1a1c83[_0x8fbc('0x4d')];if(!_0x3ab81d[_0x8fbc('0x4f')]['hasOwnProperty'](_0x8fbc('0x57'))){_0x73d778['limit']=qs['limit'](_0x3ab81d[_0x8fbc('0x4f')][_0x8fbc('0x33')]);_0x73d778[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x3ab81d[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}_0x73d778['order']=qs['sort'](_0x3ab81d[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x73d778[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x3ab81d[_0x8fbc('0x4f')],_0x1a1c83['filters']));_0x73d778[_0x8fbc('0x5a')][_0x8fbc('0xcd')]=_0x6941f6['id'];if(_0x3ab81d[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x73d778[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x73d778['where'],{'$or':_['map'](_0x73d778[_0x8fbc('0x53')],function(_0x252557){var _0x143e79={};_0x143e79[_0x252557]={'$like':'%'+_0x3ab81d[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%'};return _0x143e79;})});}_0x73d778=_[_0x8fbc('0x5c')]({},_0x73d778,_0x3ab81d[_0x8fbc('0x60')]);return db[_0x8fbc('0xcc')][_0x8fbc('0x31')]({'where':_0x73d778[_0x8fbc('0x5a')]})[_0x8fbc('0x39')](function(_0x3ecadb){_0x5b2797[_0x8fbc('0x31')]=_0x3ecadb;if(_0x3ab81d[_0x8fbc('0x4f')][_0x8fbc('0x66')]){_0x73d778['include']=[{'all':!![]}];}return db[_0x8fbc('0xcc')][_0x8fbc('0x61')](_0x73d778);})[_0x8fbc('0x39')](function(_0x33e429){_0x5b2797[_0x8fbc('0x62')]=_0x33e429;return _0x5b2797;});}})[_0x8fbc('0x39')](respondWithFilteredResult(_0x305e34,_0x73d778))[_0x8fbc('0x63')](handleError(_0x305e34,null));};exports['getScreenRecordings']=function(_0x1318a8,_0x5ab1dc,_0x2c567b){var _0x5318ba={'raw':!![],'where':{}};var _0x12a1eb={};var _0x32881c={'count':0x0,'rows':[]};return db[_0x8fbc('0x48')]['findOne']({'where':{'id':_0x1318a8[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x5ab1dc,null))[_0x8fbc('0x39')](function(_0x1bd3d3){if(_0x1bd3d3){_0x12a1eb[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](db[_0x8fbc('0xce')][_0x8fbc('0x49')]);_0x12a1eb[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x1318a8[_0x8fbc('0x4f')]);_0x12a1eb[_0x8fbc('0x51')]=_['intersection'](_0x12a1eb[_0x8fbc('0x4d')],_0x12a1eb[_0x8fbc('0x4f')]);_0x5318ba[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x12a1eb['model'],qs[_0x8fbc('0x54')](_0x1318a8[_0x8fbc('0x4f')][_0x8fbc('0x54')]));_0x5318ba['attributes']=_0x5318ba[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0x5318ba[_0x8fbc('0x53')]:_0x12a1eb[_0x8fbc('0x4d')];if(!_0x1318a8[_0x8fbc('0x4f')]['hasOwnProperty'](_0x8fbc('0x57'))){_0x5318ba[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x1318a8['query']['limit']);_0x5318ba[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x1318a8[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}_0x5318ba[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x1318a8[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x5318ba[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x1318a8[_0x8fbc('0x4f')],_0x12a1eb[_0x8fbc('0x51')]));_0x5318ba[_0x8fbc('0x5a')][_0x8fbc('0xcd')]=_0x1bd3d3['id'];if(_0x1318a8['query'][_0x8fbc('0x3c')]){_0x5318ba['where']=_['merge'](_0x5318ba[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x5318ba[_0x8fbc('0x53')],function(_0x26d9e5){var _0x21d563={};_0x21d563[_0x26d9e5]={'$like':'%'+_0x1318a8['query'][_0x8fbc('0x3c')]+'%'};return _0x21d563;})});}_0x5318ba=_['merge']({},_0x5318ba,_0x1318a8[_0x8fbc('0x60')]);return db[_0x8fbc('0xce')]['count']({'where':_0x5318ba['where']})['then'](function(_0x2c8eb2){_0x32881c[_0x8fbc('0x31')]=_0x2c8eb2;if(_0x1318a8[_0x8fbc('0x4f')][_0x8fbc('0x66')]){_0x5318ba[_0x8fbc('0x67')]=[{'all':!![]}];}return db[_0x8fbc('0xce')][_0x8fbc('0x61')](_0x5318ba);})[_0x8fbc('0x39')](function(_0x13b409){_0x32881c[_0x8fbc('0x62')]=_0x13b409;return _0x32881c;});}})[_0x8fbc('0x39')](respondWithFilteredResult(_0x5ab1dc,_0x5318ba))[_0x8fbc('0x63')](handleError(_0x5ab1dc,null));};exports[_0x8fbc('0xcf')]=function(_0x4e719e,_0x6075d1,_0x40529b){var _0x2280ba={};var _0x37dcd1={};var _0x208b1c;var _0x385a24;return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x4e719e[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x6075d1,null))[_0x8fbc('0x39')](function(_0x5d4c57){if(_0x5d4c57){_0x208b1c=_0x5d4c57;_0x37dcd1[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](db['ChatInteraction']['rawAttributes']);_0x37dcd1[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x4e719e['query']);_0x37dcd1[_0x8fbc('0x51')]=_[_0x8fbc('0x52')](_0x37dcd1[_0x8fbc('0x4d')],_0x37dcd1['query']);_0x2280ba[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x37dcd1['model'],qs[_0x8fbc('0x54')](_0x4e719e['query'][_0x8fbc('0x54')]));_0x2280ba[_0x8fbc('0x53')]=_0x2280ba['attributes']['length']?_0x2280ba['attributes']:_0x37dcd1[_0x8fbc('0x4d')];_0x2280ba['order']=qs[_0x8fbc('0x59')](_0x4e719e['query'][_0x8fbc('0x59')]);_0x2280ba[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_['pick'](_0x4e719e[_0x8fbc('0x4f')],_0x37dcd1[_0x8fbc('0x51')]));if(_0x4e719e[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x2280ba[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x2280ba[_0x8fbc('0x5a')],{'$or':_['map'](_0x2280ba[_0x8fbc('0x53')],function(_0x2ab436){var _0x347b8f={};_0x347b8f[_0x2ab436]={'$like':'%'+_0x4e719e[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%'};return _0x347b8f;})});}_0x2280ba=_[_0x8fbc('0x5c')]({},_0x2280ba,_0x4e719e[_0x8fbc('0x60')]);return _0x208b1c[_0x8fbc('0xcf')](_0x2280ba);}})['then'](function(_0x39eceb){if(_0x39eceb){_0x385a24=_0x39eceb[_0x8fbc('0x55')];if(!_0x4e719e[_0x8fbc('0x4f')]['hasOwnProperty'](_0x8fbc('0x57'))){_0x2280ba[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x4e719e[_0x8fbc('0x4f')][_0x8fbc('0x33')]);_0x2280ba[_0x8fbc('0x32')]=qs['offset'](_0x4e719e[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}return _0x208b1c[_0x8fbc('0xcf')](_0x2280ba);}})[_0x8fbc('0x39')](function(_0x8f9aca){if(_0x8f9aca){return _0x8f9aca?{'count':_0x385a24,'rows':_0x8f9aca}:null;}})[_0x8fbc('0x39')](respondWithResult(_0x6075d1,null))['catch'](handleError(_0x6075d1,null));};exports['getOpenchannelInteractions']=function(_0x4d7e62,_0x2816ef,_0x162eb6){var _0xe4933d={};var _0x1c7891={};var _0x5dcccd;var _0x3fb39d;return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x4d7e62['params']['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x2816ef,null))['then'](function(_0x5f2a3a){if(_0x5f2a3a){_0x5dcccd=_0x5f2a3a;_0x1c7891[_0x8fbc('0x4d')]=_['keys'](db[_0x8fbc('0xd0')][_0x8fbc('0x49')]);_0x1c7891[_0x8fbc('0x4f')]=_['keys'](_0x4d7e62['query']);_0x1c7891[_0x8fbc('0x51')]=_['intersection'](_0x1c7891[_0x8fbc('0x4d')],_0x1c7891[_0x8fbc('0x4f')]);_0xe4933d[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x1c7891[_0x8fbc('0x4d')],qs[_0x8fbc('0x54')](_0x4d7e62['query'][_0x8fbc('0x54')]));_0xe4933d['attributes']=_0xe4933d[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0xe4933d[_0x8fbc('0x53')]:_0x1c7891[_0x8fbc('0x4d')];_0xe4933d[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x4d7e62[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0xe4933d[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_['pick'](_0x4d7e62['query'],_0x1c7891[_0x8fbc('0x51')]));if(_0x4d7e62[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0xe4933d[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0xe4933d['where'],{'$or':_[_0x8fbc('0x3e')](_0xe4933d[_0x8fbc('0x53')],function(_0x1b155b){var _0x12c857={};_0x12c857[_0x1b155b]={'$like':'%'+_0x4d7e62[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%'};return _0x12c857;})});}_0xe4933d=_[_0x8fbc('0x5c')]({},_0xe4933d,_0x4d7e62[_0x8fbc('0x60')]);return _0x5dcccd[_0x8fbc('0xd1')](_0xe4933d);}})[_0x8fbc('0x39')](function(_0x46c687){if(_0x46c687){_0x3fb39d=_0x46c687[_0x8fbc('0x55')];if(!_0x4d7e62[_0x8fbc('0x4f')][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0xe4933d[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x4d7e62[_0x8fbc('0x4f')][_0x8fbc('0x33')]);_0xe4933d[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x4d7e62[_0x8fbc('0x4f')]['offset']);}return _0x5dcccd[_0x8fbc('0xd1')](_0xe4933d);}})[_0x8fbc('0x39')](function(_0x46423d){if(_0x46423d){return _0x46423d?{'count':_0x3fb39d,'rows':_0x46423d}:null;}})['then'](respondWithResult(_0x2816ef,null))[_0x8fbc('0x63')](handleError(_0x2816ef,null));};exports[_0x8fbc('0xd2')]=function(_0x3a5cdf,_0x33867a,_0x1e11c0){var _0x3218db={'raw':!![],'where':{}};var _0x4820b1={};var _0x2378a8={'count':0x0,'rows':[]};return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x3a5cdf['params']['id']}})['then'](handleEntityNotFound(_0x33867a,null))[_0x8fbc('0x39')](function(_0x566e21){if(_0x566e21){_0x4820b1[_0x8fbc('0x4d')]=_['keys'](db[_0x8fbc('0xd3')][_0x8fbc('0x49')]);_0x4820b1[_0x8fbc('0x4f')]=_['keys'](_0x3a5cdf[_0x8fbc('0x4f')]);_0x4820b1['filters']=_['intersection'](_0x4820b1[_0x8fbc('0x4d')],_0x4820b1[_0x8fbc('0x4f')]);_0x3218db[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x4820b1['model'],qs[_0x8fbc('0x54')](_0x3a5cdf['query']['fields']));_0x3218db[_0x8fbc('0x53')]=_0x3218db[_0x8fbc('0x53')]['length']?_0x3218db['attributes']:_0x4820b1[_0x8fbc('0x4d')];if(!_0x3a5cdf[_0x8fbc('0x4f')][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0x3218db['limit']=qs[_0x8fbc('0x33')](_0x3a5cdf[_0x8fbc('0x4f')][_0x8fbc('0x33')]);_0x3218db[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x3a5cdf[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}_0x3218db[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x3a5cdf[_0x8fbc('0x4f')]['sort']);_0x3218db[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x3a5cdf[_0x8fbc('0x4f')],_0x4820b1[_0x8fbc('0x51')]));_0x3218db[_0x8fbc('0x5a')][_0x8fbc('0xcd')]=_0x566e21['id'];if(_0x3a5cdf[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x3218db[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x3218db[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x3218db[_0x8fbc('0x53')],function(_0x1508b6){var _0x294c91={};_0x294c91[_0x1508b6]={'$like':'%'+_0x3a5cdf[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%'};return _0x294c91;})});}_0x3218db=_[_0x8fbc('0x5c')]({},_0x3218db,_0x3a5cdf[_0x8fbc('0x60')]);return db['MailInteraction']['count']({'where':_0x3218db[_0x8fbc('0x5a')]})[_0x8fbc('0x39')](function(_0x271acc){_0x2378a8[_0x8fbc('0x31')]=_0x271acc;if(_0x3a5cdf[_0x8fbc('0x4f')][_0x8fbc('0x66')]){_0x3218db[_0x8fbc('0x67')]=[{'all':!![]}];}return db['MailInteraction'][_0x8fbc('0x61')](_0x3218db);})[_0x8fbc('0x39')](function(_0x1be6f1){_0x2378a8['rows']=_0x1be6f1;return _0x2378a8;});}})[_0x8fbc('0x39')](respondWithFilteredResult(_0x33867a,_0x3218db))[_0x8fbc('0x63')](handleError(_0x33867a,null));};exports['getSmsInteractions']=function(_0x4a3bd3,_0x4a821f,_0x239b44){var _0x2a300b={};var _0x3e33ab={};var _0x5b8595;var _0x3f02f7;return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x4a3bd3[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x4a821f,null))['then'](function(_0x2b1238){if(_0x2b1238){_0x5b8595=_0x2b1238;_0x3e33ab[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](db[_0x8fbc('0xd4')]['rawAttributes']);_0x3e33ab[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x4a3bd3['query']);_0x3e33ab[_0x8fbc('0x51')]=_[_0x8fbc('0x52')](_0x3e33ab[_0x8fbc('0x4d')],_0x3e33ab[_0x8fbc('0x4f')]);_0x2a300b[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x3e33ab[_0x8fbc('0x4d')],qs[_0x8fbc('0x54')](_0x4a3bd3[_0x8fbc('0x4f')][_0x8fbc('0x54')]));_0x2a300b[_0x8fbc('0x53')]=_0x2a300b[_0x8fbc('0x53')]['length']?_0x2a300b[_0x8fbc('0x53')]:_0x3e33ab[_0x8fbc('0x4d')];_0x2a300b['order']=qs['sort'](_0x4a3bd3[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x2a300b[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x4a3bd3['query'],_0x3e33ab['filters']));if(_0x4a3bd3[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x2a300b['where']=_[_0x8fbc('0x5c')](_0x2a300b[_0x8fbc('0x5a')],{'$or':_['map'](_0x2a300b[_0x8fbc('0x53')],function(_0x5a7946){var _0x46bf9e={};_0x46bf9e[_0x5a7946]={'$like':'%'+_0x4a3bd3[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%'};return _0x46bf9e;})});}_0x2a300b=_[_0x8fbc('0x5c')]({},_0x2a300b,_0x4a3bd3[_0x8fbc('0x60')]);return _0x5b8595['getSmsInteractions'](_0x2a300b);}})['then'](function(_0x455d2e){if(_0x455d2e){_0x3f02f7=_0x455d2e[_0x8fbc('0x55')];if(!_0x4a3bd3['query'][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0x2a300b[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x4a3bd3[_0x8fbc('0x4f')][_0x8fbc('0x33')]);_0x2a300b[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x4a3bd3[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}return _0x5b8595[_0x8fbc('0xd5')](_0x2a300b);}})[_0x8fbc('0x39')](function(_0x34cf65){if(_0x34cf65){return _0x34cf65?{'count':_0x3f02f7,'rows':_0x34cf65}:null;}})[_0x8fbc('0x39')](respondWithResult(_0x4a821f,null))[_0x8fbc('0x63')](handleError(_0x4a821f,null));};exports['getFaxInteractions']=function(_0x14ae46,_0x2ce91a,_0x20082b){var _0x3d135d={};var _0x11a1d3={};var _0x51b299;var _0x290edc;return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x14ae46[_0x8fbc('0x64')]['id']}})['then'](handleEntityNotFound(_0x2ce91a,null))[_0x8fbc('0x39')](function(_0x1df5b8){if(_0x1df5b8){_0x51b299=_0x1df5b8;_0x11a1d3[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](db[_0x8fbc('0xd6')][_0x8fbc('0x49')]);_0x11a1d3['query']=_[_0x8fbc('0x50')](_0x14ae46[_0x8fbc('0x4f')]);_0x11a1d3[_0x8fbc('0x51')]=_[_0x8fbc('0x52')](_0x11a1d3['model'],_0x11a1d3[_0x8fbc('0x4f')]);_0x3d135d['attributes']=_[_0x8fbc('0x52')](_0x11a1d3[_0x8fbc('0x4d')],qs[_0x8fbc('0x54')](_0x14ae46[_0x8fbc('0x4f')]['fields']));_0x3d135d[_0x8fbc('0x53')]=_0x3d135d[_0x8fbc('0x53')]['length']?_0x3d135d['attributes']:_0x11a1d3['model'];_0x3d135d[_0x8fbc('0x58')]=qs['sort'](_0x14ae46[_0x8fbc('0x4f')]['sort']);_0x3d135d['where']=qs[_0x8fbc('0x51')](_['pick'](_0x14ae46['query'],_0x11a1d3[_0x8fbc('0x51')]));if(_0x14ae46[_0x8fbc('0x4f')]['filter']){_0x3d135d[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x3d135d[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x3d135d['attributes'],function(_0x345d15){var _0x3d40e2={};_0x3d40e2[_0x345d15]={'$like':'%'+_0x14ae46[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%'};return _0x3d40e2;})});}_0x3d135d=_[_0x8fbc('0x5c')]({},_0x3d135d,_0x14ae46[_0x8fbc('0x60')]);return _0x51b299['getFaxInteractions'](_0x3d135d);}})[_0x8fbc('0x39')](function(_0x36f577){if(_0x36f577){_0x290edc=_0x36f577['length'];if(!_0x14ae46['query'][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0x3d135d[_0x8fbc('0x33')]=qs['limit'](_0x14ae46['query'][_0x8fbc('0x33')]);_0x3d135d['offset']=qs[_0x8fbc('0x32')](_0x14ae46[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}return _0x51b299[_0x8fbc('0xd7')](_0x3d135d);}})[_0x8fbc('0x39')](function(_0x7c1b5){if(_0x7c1b5){return _0x7c1b5?{'count':_0x290edc,'rows':_0x7c1b5}:null;}})[_0x8fbc('0x39')](respondWithResult(_0x2ce91a,null))[_0x8fbc('0x63')](handleError(_0x2ce91a,null));};exports[_0x8fbc('0xd8')]=function(_0x545512,_0x5a9f96,_0x2d8d3c){var _0x1d8dd8={};var _0x4251ab={};var _0x3b8f0c;var _0x31cf5f;return db['User'][_0x8fbc('0x97')]({'where':{'id':_0x545512[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x5a9f96,null))['then'](function(_0x35e2c8){if(_0x35e2c8){_0x3b8f0c=_0x35e2c8;_0x4251ab['model']=_[_0x8fbc('0x50')](db[_0x8fbc('0xd9')]['rawAttributes']);_0x4251ab[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x545512[_0x8fbc('0x4f')]);_0x4251ab[_0x8fbc('0x51')]=_[_0x8fbc('0x52')](_0x4251ab[_0x8fbc('0x4d')],_0x4251ab[_0x8fbc('0x4f')]);_0x1d8dd8[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x4251ab['model'],qs[_0x8fbc('0x54')](_0x545512[_0x8fbc('0x4f')][_0x8fbc('0x54')]));_0x1d8dd8[_0x8fbc('0x53')]=_0x1d8dd8[_0x8fbc('0x53')]['length']?_0x1d8dd8['attributes']:_0x4251ab[_0x8fbc('0x4d')];_0x1d8dd8[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x545512[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x1d8dd8[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x545512[_0x8fbc('0x4f')],_0x4251ab[_0x8fbc('0x51')]));if(_0x545512[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x1d8dd8['where']=_['merge'](_0x1d8dd8[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x1d8dd8[_0x8fbc('0x53')],function(_0x5d2345){var _0x28255d={};_0x28255d[_0x5d2345]={'$like':'%'+_0x545512[_0x8fbc('0x4f')][_0x8fbc('0x3c')]+'%'};return _0x28255d;})});}_0x1d8dd8=_[_0x8fbc('0x5c')]({},_0x1d8dd8,_0x545512[_0x8fbc('0x60')]);return _0x3b8f0c[_0x8fbc('0xd8')](_0x1d8dd8);}})['then'](function(_0x3fdd78){if(_0x3fdd78){_0x31cf5f=_0x3fdd78[_0x8fbc('0x55')];if(!_0x545512['query'][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0x1d8dd8[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x545512[_0x8fbc('0x4f')][_0x8fbc('0x33')]);_0x1d8dd8[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x545512['query']['offset']);}return _0x3b8f0c[_0x8fbc('0xd8')](_0x1d8dd8);}})['then'](function(_0x49e984){if(_0x49e984){return _0x49e984?{'count':_0x31cf5f,'rows':_0x49e984}:null;}})[_0x8fbc('0x39')](respondWithResult(_0x5a9f96,null))[_0x8fbc('0x63')](handleError(_0x5a9f96,null));};exports[_0x8fbc('0xda')]=function(_0x5f05ae,_0x3d7187,_0x4b100b){var _0x3ceea6;var _0x49cccf;var _0x52bd42;var _0x58102d=!_['isNil'](_0x5f05ae[_0x8fbc('0x64')]['id'])?_0x5f05ae[_0x8fbc('0x64')]['id']:!_[_0x8fbc('0x75')](_0x5f05ae[_0x8fbc('0x3a')]['id'])?_0x5f05ae[_0x8fbc('0x3a')]['id']:null;return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0x58102d,'role':{'$or':[_0x8fbc('0x71'),_0x8fbc('0x3a'),_0x8fbc('0x6e')]}},'attributes':['id','name',_0x8fbc('0xdb'),'mobile','role',_0x8fbc('0x79'),_0x8fbc('0xa2')]})[_0x8fbc('0x39')](function(_0x4bfa5b){if(_0x4bfa5b){if(_0x4bfa5b[_0x8fbc('0x41')]==='agent'){_0x3ceea6=_0x4bfa5b;if(_0x5f05ae[_0x8fbc('0x69')][_0x8fbc('0xa4')]){_0x52bd42=util[_0x8fbc('0x76')](_0x8fbc('0xdc'),_0x3ceea6[_0x5f05ae[_0x8fbc('0x69')][_0x8fbc('0xa4')]]);}else if(_0x5f05ae[_0x8fbc('0x69')][_0x8fbc('0xdd')]){_0x52bd42=util[_0x8fbc('0x76')](_0x8fbc('0xde'),_0x5f05ae[_0x8fbc('0x69')]['intrf']);}else{_0x52bd42=util[_0x8fbc('0x76')](_0x8fbc('0xde'),_0x3ceea6['name']);}socket['to'](util[_0x8fbc('0x76')]('user:%s',_0x3ceea6[_0x8fbc('0x45')]))[_0x8fbc('0xae')](_0x8fbc('0xdf'),{'ip':_0x5f05ae[_0x8fbc('0xe0')]['x-forwarded-for']||_0x5f05ae[_0x8fbc('0xe1')][_0x8fbc('0xe2')]||_0x5f05ae['socket'][_0x8fbc('0xe2')]||_0x5f05ae[_0x8fbc('0xe1')][_0x8fbc('0xe3')][_0x8fbc('0xe2')]});return db[_0x8fbc('0xb2')][_0x8fbc('0x38')]({'where':{'membername':_0x3ceea6['name']},'individualHooks':!![]});}}else{throw new db[(_0x8fbc('0x21'))][(_0x8fbc('0x22'))](_0x8fbc('0xe4'));}})[_0x8fbc('0x39')](function(){if(_0x3ceea6){return _0x3ceea6[_0x8fbc('0xe5')]({'raw':!![]});}})[_0x8fbc('0x39')](function(_0x21c167){if(_0x3ceea6){var _0x618c2a=[];if(_0x21c167){_0x49cccf=_0x21c167;if(_0x49cccf[_0x8fbc('0x55')]){for(var _0x3b56da=0x0;_0x3b56da<_0x49cccf[_0x8fbc('0x55')];_0x3b56da++){_0x618c2a[_0x8fbc('0xb1')]({'membername':_0x3ceea6[_0x8fbc('0x45')],'UserId':_0x3ceea6['id'],'queue_name':_0x49cccf[_0x3b56da][_0x8fbc('0x45')],'VoiceQueueId':_0x49cccf[_0x3b56da]['id'],'interface':_0x52bd42,'paused':_0x3ceea6['loginInPause']||![],'penalty':_0x49cccf[_0x3b56da]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x618c2a,function(_0x539b74){return db[_0x8fbc('0xb2')][_0x8fbc('0xe6')](_0x539b74);});}}}})[_0x8fbc('0x39')](function(){if(_0x3ceea6){return db[_0x8fbc('0xe7')][_0x8fbc('0x61')]({'where':{'membername':_0x3ceea6[_0x8fbc('0x45')],'exitAt':null}});}})['then'](function(_0x4786c3){if(_0x3ceea6){var _0x1e910f=[];_0x4786c3[_0x8fbc('0xe8')](function(_0xf77a00){_0x1e910f[_0x8fbc('0xb1')](_0xf77a00[_0x8fbc('0xe9')]({'exitAt':moment()[_0x8fbc('0x76')](_0x8fbc('0xea'))}));});return BPromise[_0x8fbc('0xeb')](_0x1e910f);}})[_0x8fbc('0x39')](function(){if(_0x3ceea6){var _0xfb6da9=[];var _0xb4ffcd=[];var _0x5338a5=utils[_0x8fbc('0xec')]();var _0x302633={'membername':_0x3ceea6['name'],'interface':_0x52bd42,'enterAt':moment()[_0x8fbc('0x76')](_0x8fbc('0xea')),'role':_0x3ceea6[_0x8fbc('0x41')],'internal':_0x3ceea6[_0x8fbc('0x79')]};_0x5338a5['forEach'](function(_0x11a760){_0xfb6da9[_0x8fbc('0xb1')](_[_0x8fbc('0x5c')]({'channel':_0x11a760,'type':_0x8fbc('0xed'),'data1':_0x5f05ae[_0x8fbc('0x69')][_0x8fbc('0xee')],'data2':_0x52bd42},_0x302633));if(_0x3ceea6['loginInPause']){_0xb4ffcd[_0x8fbc('0xb1')](_[_0x8fbc('0x5c')]({'channel':_0x11a760,'type':_0x8fbc('0xef'),'data1':_0x8fbc('0xf0')},_0x302633));}});return db[_0x8fbc('0xe7')][_0x8fbc('0x68')](_0xfb6da9[_0x8fbc('0xf1')](_0xb4ffcd),{'individualHooks':!![]});}})[_0x8fbc('0x39')](function(){if(_0x3ceea6){return _0x3ceea6['update']({'online':!![],'lastLoginAt':moment()['format'](_0x8fbc('0xea')),'voicePause':_0x3ceea6['loginInPause']||![],'mailPause':_0x3ceea6[_0x8fbc('0xa2')]||![],'chatPause':_0x3ceea6[_0x8fbc('0xa2')]||![],'faxPause':_0x3ceea6[_0x8fbc('0xa2')]||![],'smsPause':_0x3ceea6[_0x8fbc('0xa2')]||![],'openchannelPause':_0x3ceea6[_0x8fbc('0xa2')]||![],'whatsappPause':_0x3ceea6[_0x8fbc('0xa2')]||![],'pauseType':_0x3ceea6['loginInPause']?_0x8fbc('0xf0'):null,'interface':_0x52bd42,'lastPauseAt':moment()[_0x8fbc('0x76')](_0x8fbc('0xea'))});}})[_0x8fbc('0x39')](function(_0x42ed9a){if(_0x5f05ae[_0x8fbc('0xf2')]){return _0x4b100b();}else{return BPromise[_0x8fbc('0xf3')](_0x42ed9a)[_0x8fbc('0x39')](respondWithResult(_0x3d7187,null));}})['catch'](handleError(_0x3d7187,null));};exports[_0x8fbc('0xf4')]=function(_0x5dfe3a,_0x29c96e,_0x518b68){var _0x3d8574;return db[_0x8fbc('0x48')][_0x8fbc('0x42')]({'where':{'id':_0x5dfe3a[_0x8fbc('0x64')]['id'],'role':_0x8fbc('0x6e')},'attributes':['id',_0x8fbc('0x45'),_0x8fbc('0x41')]})[_0x8fbc('0x39')](handleEntityNotFound(_0x29c96e,null))[_0x8fbc('0x39')](function(_0x4489aa){if(_0x4489aa){_0x3d8574=_0x4489aa;return db[_0x8fbc('0xb2')]['destroy']({'where':{'membername':_0x3d8574['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x8fbc('0xe7')][_0x8fbc('0x61')]({'where':{'membername':_0x3d8574[_0x8fbc('0x45')],'exitAt':null}});})[_0x8fbc('0x39')](function(_0x391e0c){var _0x1b5277=[];_0x391e0c['forEach'](function(_0xa1467){_0x1b5277[_0x8fbc('0xb1')](_0xa1467[_0x8fbc('0xe9')]({'exitAt':moment()[_0x8fbc('0x76')](_0x8fbc('0xea'))}));});return BPromise[_0x8fbc('0xeb')](_0x1b5277);})[_0x8fbc('0x39')](function(){return _0x3d8574['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x29c96e,null))[_0x8fbc('0x63')](handleError(_0x29c96e,null));};exports[_0x8fbc('0xf5')]=function(_0x177d4d,_0x50edb1,_0x290113){var _0x32ccff;return db[_0x8fbc('0xb2')][_0x8fbc('0xe9')]({'paused':0x1},{'where':{'UserId':_0x177d4d[_0x8fbc('0x64')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0x8fbc('0x42')]({'where':{'id':_0x177d4d[_0x8fbc('0x64')]['id'],'role':_0x8fbc('0x6e')},'attributes':['id',_0x8fbc('0x45'),_0x8fbc('0x41'),'internal',_0x8fbc('0xa4')]});})[_0x8fbc('0x39')](handleEntityNotFound(_0x50edb1,null))['then'](function(_0x52b21a){if(_0x52b21a){_0x32ccff=_0x52b21a;return respondWithRpcPromise(_0x8fbc('0xf6'),'pause',{'id':_0x32ccff['id'],'name':_0x32ccff['name'],'pause':!![]});}})[_0x8fbc('0x39')](function(){if(_0x32ccff){return db[_0x8fbc('0xe7')][_0x8fbc('0x61')]({'where':{'membername':_0x32ccff[_0x8fbc('0x45')],'type':_0x8fbc('0xef'),'exitAt':null}});}})[_0x8fbc('0x39')](function(_0x2f7702){if(_0x2f7702[_0x8fbc('0x55')]){var _0x5e46f5=moment()[_0x8fbc('0x76')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x27a514=0x0,_0x13cdb9=_0x2f7702[_0x8fbc('0x55')];_0x27a514<_0x13cdb9;_0x27a514++){_0x2f7702[_0x27a514][_0x8fbc('0xf7')]({'exitAt':_0x5e46f5});}}})[_0x8fbc('0x39')](function(){var _0x4d6262=[];var _0x4029de=utils[_0x8fbc('0xec')]();_0x4029de[_0x8fbc('0xe8')](function(_0x21499e){_0x4d6262[_0x8fbc('0xb1')]({'channel':_0x21499e,'membername':_0x32ccff[_0x8fbc('0x45')],'interface':_[_0x8fbc('0x75')](_0x32ccff[_0x8fbc('0xa4')])?util[_0x8fbc('0x76')](_0x8fbc('0xde'),_0x32ccff[_0x8fbc('0x45')]):_0x32ccff[_0x8fbc('0xa4')],'type':_0x8fbc('0xef'),'enterAt':moment()[_0x8fbc('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x177d4d['body'][_0x8fbc('0x4b')]||_0x8fbc('0xf8'),'role':_0x32ccff[_0x8fbc('0x41')],'internal':_0x32ccff[_0x8fbc('0x79')]});});return db[_0x8fbc('0xe7')][_0x8fbc('0x68')](_0x4d6262,{'individualHooks':!![]});})['then'](function(){return _0x32ccff[_0x8fbc('0xe9')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x177d4d['body'][_0x8fbc('0x4b')]||_0x8fbc('0xf8'),'lastPauseAt':moment()[_0x8fbc('0x76')](_0x8fbc('0xea'))});})[_0x8fbc('0x39')](respondWithResult(_0x50edb1,null))['catch'](handleError(_0x50edb1,null));};exports[_0x8fbc('0xf9')]=function(_0x28d260,_0x4943a2,_0x4ea05e){var _0x2f5262;return db['User']['find']({'where':{'id':_0x28d260['params']['id']},'attributes':['id',_0x8fbc('0x45'),_0x8fbc('0x41'),'voicePause',_0x8fbc('0xfa'),_0x8fbc('0xfb'),_0x8fbc('0xfc'),_0x8fbc('0xfd'),_0x8fbc('0xfe'),_0x8fbc('0xff'),_0x8fbc('0x100'),_0x8fbc('0x101')]})[_0x8fbc('0x39')](handleEntityNotFound(_0x4943a2,null))[_0x8fbc('0x39')](function(_0x31fae8){if(_0x31fae8){_0x2f5262=_0x31fae8;if(_0x28d260['body'][_0x8fbc('0xa1')]&&!utils[_0x8fbc('0xa5')](_0x28d260[_0x8fbc('0x69')][_0x8fbc('0xa1')])){throw new db[(_0x8fbc('0x21'))]['ValidationError'](_0x8fbc('0xa6'));}switch(_0x28d260[_0x8fbc('0x69')][_0x8fbc('0xa1')]){case _0x8fbc('0x102'):return respondWithRpcPromise(_0x8fbc('0xf6'),_0x8fbc('0xf9'),{'id':_0x2f5262['id'],'name':_0x2f5262[_0x8fbc('0x45')],'pause':![]})[_0x8fbc('0x39')](function(){return db['UserVoiceQueueRt'][_0x8fbc('0xe9')]({'paused':0x0},{'where':{'UserId':_0x2f5262['id']},'individualHooks':!![]});})[_0x8fbc('0x39')](function(){return db[_0x8fbc('0xe7')][_0x8fbc('0x42')]({'where':{'channel':_0x28d260[_0x8fbc('0x69')][_0x8fbc('0xa1')],'membername':_0x2f5262[_0x8fbc('0x45')],'type':_0x8fbc('0xef'),'exitAt':null}});})[_0x8fbc('0x39')](function(_0x1096fb){if(_0x1096fb){return _0x1096fb['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8fbc('0x103')},{'individualHooks':!![]});}return null;})[_0x8fbc('0x39')](function(){return _0x2f5262[_0x8fbc('0xe9')]({'voicePause':![]});});case'mail':case _0x8fbc('0x104'):case _0x8fbc('0x105'):case _0x8fbc('0x106'):case'whatsapp':case _0x8fbc('0x107'):return db['MemberReport']['find']({'where':{'channel':_0x28d260[_0x8fbc('0x69')][_0x8fbc('0xa1')],'membername':_0x2f5262[_0x8fbc('0x45')],'type':_0x8fbc('0xef'),'exitAt':null}})[_0x8fbc('0x39')](function(_0xa3b6b2){if(_0xa3b6b2){return _0xa3b6b2[_0x8fbc('0xe9')]({'exitAt':moment()[_0x8fbc('0x76')](_0x8fbc('0xea')),'data2':_0x8fbc('0x103')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x495c9d={};_[_0x8fbc('0x34')](_0x495c9d,util['format'](_0x8fbc('0x108'),_0x28d260[_0x8fbc('0x69')][_0x8fbc('0xa1')],_0x8fbc('0x109')),![]);return _0x2f5262[_0x8fbc('0xe9')](_0x495c9d);});default:return respondWithRpcPromise('QueuePause',_0x8fbc('0xf9'),{'id':_0x2f5262['id'],'name':_0x2f5262['name'],'pause':![]})[_0x8fbc('0x39')](function(){return db['UserVoiceQueueRt'][_0x8fbc('0xe9')]({'paused':0x0},{'where':{'UserId':_0x2f5262['id']}});})[_0x8fbc('0x39')](function(){return db[_0x8fbc('0xe7')][_0x8fbc('0x61')]({'where':{'membername':_0x2f5262[_0x8fbc('0x45')],'type':_0x8fbc('0xef'),'exitAt':null}});})[_0x8fbc('0x39')](function(_0x130aa6){var _0x43aa01=[];_0x130aa6[_0x8fbc('0xe8')](function(_0x5e4535){_0x43aa01[_0x8fbc('0xb1')](_0x5e4535[_0x8fbc('0xe9')]({'exitAt':moment()[_0x8fbc('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8fbc('0x103')}));});return BPromise[_0x8fbc('0xeb')](_0x43aa01);})[_0x8fbc('0x39')](function(){return _0x2f5262[_0x8fbc('0xe9')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x4943a2,null))[_0x8fbc('0x63')](handleError(_0x4943a2,null));};exports[_0x8fbc('0x10a')]=function(_0x5d325e,_0x392d99,_0x480b3c){var _0x23f784={};var _0x22b566={};var _0x93264d;var _0x23d0a;return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x5d325e['params']['id']}})['then'](handleEntityNotFound(_0x392d99,null))[_0x8fbc('0x39')](function(_0x592d4e){if(_0x592d4e){_0x93264d=_0x592d4e;_0x22b566[_0x8fbc('0x4d')]=_['keys'](db[_0x8fbc('0x10b')]['rawAttributes']);_0x22b566[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x5d325e[_0x8fbc('0x4f')]);_0x22b566['filters']=_[_0x8fbc('0x52')](_0x22b566[_0x8fbc('0x4d')],_0x22b566[_0x8fbc('0x4f')]);_0x23f784[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x22b566[_0x8fbc('0x4d')],qs[_0x8fbc('0x54')](_0x5d325e['query'][_0x8fbc('0x54')]));_0x23f784[_0x8fbc('0x53')]=_0x23f784[_0x8fbc('0x53')][_0x8fbc('0x55')]?_0x23f784[_0x8fbc('0x53')]:_0x22b566[_0x8fbc('0x4d')];_0x23f784[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x5d325e[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x23f784[_0x8fbc('0x5a')]=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x5d325e['query'],_0x22b566[_0x8fbc('0x51')]));if(_0x5d325e[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x23f784[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x23f784[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x23f784[_0x8fbc('0x53')],function(_0x2308e7){var _0x5bada7={};_0x5bada7[_0x2308e7]={'$like':'%'+_0x5d325e[_0x8fbc('0x4f')]['filter']+'%'};return _0x5bada7;})});}_0x23f784=_['merge']({},_0x23f784,_0x5d325e[_0x8fbc('0x60')]);return _0x93264d['getTeams'](_0x23f784);}})[_0x8fbc('0x39')](function(_0x558c1a){if(_0x558c1a){_0x23d0a=_0x558c1a['length'];if(!_0x5d325e[_0x8fbc('0x4f')][_0x8fbc('0x56')](_0x8fbc('0x57'))){_0x23f784[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x5d325e['query'][_0x8fbc('0x33')]);_0x23f784[_0x8fbc('0x32')]=qs[_0x8fbc('0x32')](_0x5d325e[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}return _0x93264d[_0x8fbc('0x10a')](_0x23f784);}})[_0x8fbc('0x39')](function(_0x222833){if(_0x222833){return _0x222833?{'count':_0x23d0a,'rows':_0x222833}:null;}})[_0x8fbc('0x39')](respondWithResult(_0x392d99,null))['catch'](handleError(_0x392d99,null));};exports[_0x8fbc('0x10c')]=function(_0x2e19b9,_0x443515){return db['User'][_0x8fbc('0x42')]({'where':{'id':_0x2e19b9[_0x8fbc('0x64')]['id']}})['then'](handleEntityNotFound(_0x443515,null))[_0x8fbc('0x39')](function(_0x26f82d){if(_0x26f82d){var _0x2af80d=_0x26f82d[_0x8fbc('0x90')]({'plain':!![]});return _0x26f82d[_0x8fbc('0x10c')](_0x2e19b9[_0x8fbc('0x69')][_0x8fbc('0x6d')],_[_0x8fbc('0x6c')](_0x2e19b9['body'],[_0x8fbc('0x6d'),'id'])||{})[_0x8fbc('0x39')](function(){for(var _0x1c0a29=0x0;_0x1c0a29<_0x2e19b9[_0x8fbc('0x69')][_0x8fbc('0x6d')][_0x8fbc('0x55')];_0x1c0a29++){var _0x385b61=[];db[_0x8fbc('0x10b')][_0x8fbc('0x97')]({'where':{'id':_0x2e19b9['body'][_0x8fbc('0x6d')][_0x1c0a29]}})[_0x8fbc('0x39')](function(_0x228be5){_0x385b61['push'](_0x228be5['getVoiceQueues']()['then'](function(_0x11b9ed){for(var _0x20a86f=0x0;_0x20a86f<_0x11b9ed[_0x8fbc('0x55')];_0x20a86f++){_0x11b9ed[_0x20a86f][_0x8fbc('0x10d')](_0x8fbc('0xa1'),_0x8fbc('0x10e'));}return _0x11b9ed;}));_0x385b61['push'](_0x228be5[_0x8fbc('0x10f')]()[_0x8fbc('0x39')](function(_0xa0628b){for(var _0x2ac2e2=0x0;_0x2ac2e2<_0xa0628b[_0x8fbc('0x55')];_0x2ac2e2++){_0xa0628b[_0x2ac2e2][_0x8fbc('0x10d')]('channel',_0x8fbc('0x110'));}return _0xa0628b;}));_0x385b61['push'](_0x228be5[_0x8fbc('0x111')]()[_0x8fbc('0x39')](function(_0x38e225){for(var _0x2e097d=0x0;_0x2e097d<_0x38e225[_0x8fbc('0x55')];_0x2e097d++){_0x38e225[_0x2e097d][_0x8fbc('0x10d')](_0x8fbc('0xa1'),_0x8fbc('0x112'));}return _0x38e225;}));_0x385b61[_0x8fbc('0xb1')](_0x228be5[_0x8fbc('0x113')]()[_0x8fbc('0x39')](function(_0x41b5d6){for(var _0x3416bc=0x0;_0x3416bc<_0x41b5d6['length'];_0x3416bc++){_0x41b5d6[_0x3416bc]['setDataValue']('channel',_0x8fbc('0x114'));}return _0x41b5d6;}));_0x385b61['push'](_0x228be5[_0x8fbc('0x115')]()[_0x8fbc('0x39')](function(_0x4f7909){for(var _0x148b83=0x0;_0x148b83<_0x4f7909['length'];_0x148b83++){_0x4f7909[_0x148b83][_0x8fbc('0x10d')]('channel',_0x8fbc('0x116'));}return _0x4f7909;}));_0x385b61['push'](_0x228be5['getFaxQueues']()[_0x8fbc('0x39')](function(_0x50ef72){for(var _0x347610=0x0;_0x347610<_0x50ef72[_0x8fbc('0x55')];_0x347610++){_0x50ef72[_0x347610][_0x8fbc('0x10d')](_0x8fbc('0xa1'),'Fax');}return _0x50ef72;}));_0x385b61[_0x8fbc('0xb1')](_0x228be5[_0x8fbc('0x117')]()[_0x8fbc('0x39')](function(_0xa422ef){for(var _0x1fb830=0x0;_0x1fb830<_0xa422ef[_0x8fbc('0x55')];_0x1fb830++){_0xa422ef[_0x1fb830]['setDataValue'](_0x8fbc('0xa1'),_0x8fbc('0x118'));}return _0xa422ef;}));return BPromise[_0x8fbc('0xeb')](_0x385b61);})[_0x8fbc('0x39')](function(_0xd683ec){var _0x32e562=_[_0x8fbc('0x119')](_0xd683ec);_0x385b61=[];return db['sequelize'][_0x8fbc('0x11a')](function(_0x15b381){for(var _0x301399=0x0;_0x301399<_0x32e562[_0x8fbc('0x55')];_0x301399++){_0x385b61[_0x8fbc('0xb1')](_0x32e562[_0x301399][_0x8fbc('0x11b')](_0x2af80d['id']),{'transaction':_0x15b381});}return BPromise['all'](_0x385b61)[_0x8fbc('0x39')](function(){if(_0x2af80d[_0x8fbc('0xb0')]){return BPromise[_0x8fbc('0x11c')](_[_0x8fbc('0x3c')](_0x32e562,function(_0x5be0dd){return _0x5be0dd['getDataValue'](_0x8fbc('0xa1'))==='Voice';}),function(_0x4ce94e){return db[_0x8fbc('0xb2')]['upsert']({'membername':_0x2af80d['name'],'UserId':_0x2af80d['id'],'queue_name':_0x4ce94e['name'],'VoiceQueueId':_0x4ce94e['id'],'interface':_[_0x8fbc('0x75')](_0x2af80d[_0x8fbc('0xa4')])?util[_0x8fbc('0x76')](_0x8fbc('0xde'),_0x2af80d[_0x8fbc('0x45')]):_0x2af80d[_0x8fbc('0xa4')],'paused':_0x2af80d[_0x8fbc('0xa3')]||![],'penalty':_0x2af80d[_0x8fbc('0xab')]},{'transaction':_0x15b381});});}else{return;}})[_0x8fbc('0x39')](function(){for(var _0x5e0c0a=0x0;_0x5e0c0a<_0x32e562[_0x8fbc('0x55')];_0x5e0c0a++){var _0x1c96dc=_0x32e562[_0x5e0c0a]['getDataValue'](_0x8fbc('0xa1'));var _0x1b45ba=_0x1c96dc+_0x8fbc('0xad');socket['emit']('user'+_0x1c96dc+_0x8fbc('0x11d'),{'UserId':_0x2af80d['id'],['queueField']:_0x32e562[_0x5e0c0a]['id']});}});});});}});}})[_0x8fbc('0x39')](respondWithStatusCode(_0x443515,null))[_0x8fbc('0x63')](handleError(_0x443515,null));};exports[_0x8fbc('0x11e')]=function(_0x5eb3ad,_0x4d5aff){return db[_0x8fbc('0x48')]['findOne']({'where':{'id':_0x5eb3ad[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x4d5aff,null))[_0x8fbc('0x39')](function(_0x303212){if(_0x303212){var _0x98fa73=_0x303212[_0x8fbc('0x90')]({'plain':!![]});var _0x20d4e9=_0x5eb3ad[_0x8fbc('0x4f')][_0x8fbc('0x6d')];return _0x303212[_0x8fbc('0x11e')](_0x20d4e9)['then'](function(){for(var _0x25f469=0x0;_0x25f469<_0x20d4e9[_0x8fbc('0x55')];_0x25f469++){var _0x226caf=[];db[_0x8fbc('0x10b')]['findOne']({'where':{'id':_0x20d4e9[_0x25f469]}})[_0x8fbc('0x39')](function(_0x1b0b08){_0x226caf[_0x8fbc('0xb1')](_0x1b0b08[_0x8fbc('0xe5')]()[_0x8fbc('0x39')](function(_0x4afed2){for(var _0x12355c=0x0;_0x12355c<_0x4afed2[_0x8fbc('0x55')];_0x12355c++){_0x4afed2[_0x12355c][_0x8fbc('0x10d')](_0x8fbc('0xa1'),_0x8fbc('0x10e'));}return _0x4afed2;}));_0x226caf[_0x8fbc('0xb1')](_0x1b0b08[_0x8fbc('0x10f')]()[_0x8fbc('0x39')](function(_0x28f97f){for(var _0x223b19=0x0;_0x223b19<_0x28f97f['length'];_0x223b19++){_0x28f97f[_0x223b19][_0x8fbc('0x10d')](_0x8fbc('0xa1'),_0x8fbc('0x110'));}return _0x28f97f;}));_0x226caf[_0x8fbc('0xb1')](_0x1b0b08[_0x8fbc('0x111')]()['then'](function(_0x152cfb){for(var _0x2eb622=0x0;_0x2eb622<_0x152cfb[_0x8fbc('0x55')];_0x2eb622++){_0x152cfb[_0x2eb622][_0x8fbc('0x10d')](_0x8fbc('0xa1'),_0x8fbc('0x112'));}return _0x152cfb;}));_0x226caf[_0x8fbc('0xb1')](_0x1b0b08[_0x8fbc('0x113')]()[_0x8fbc('0x39')](function(_0x2bdda7){for(var _0x44cd6a=0x0;_0x44cd6a<_0x2bdda7[_0x8fbc('0x55')];_0x44cd6a++){_0x2bdda7[_0x44cd6a][_0x8fbc('0x10d')]('channel',_0x8fbc('0x114'));}return _0x2bdda7;}));_0x226caf[_0x8fbc('0xb1')](_0x1b0b08['getWhatsappQueues']()['then'](function(_0xeed1a2){for(var _0x16af92=0x0;_0x16af92<_0xeed1a2['length'];_0x16af92++){_0xeed1a2[_0x16af92]['setDataValue'](_0x8fbc('0xa1'),_0x8fbc('0x116'));}return _0xeed1a2;}));_0x226caf['push'](_0x1b0b08[_0x8fbc('0x11f')]()['then'](function(_0x109daf){for(var _0x42ae98=0x0;_0x42ae98<_0x109daf[_0x8fbc('0x55')];_0x42ae98++){_0x109daf[_0x42ae98][_0x8fbc('0x10d')](_0x8fbc('0xa1'),_0x8fbc('0x120'));}return _0x109daf;}));_0x226caf[_0x8fbc('0xb1')](_0x1b0b08[_0x8fbc('0x117')]()[_0x8fbc('0x39')](function(_0x34b459){for(var _0x26786a=0x0;_0x26786a<_0x34b459[_0x8fbc('0x55')];_0x26786a++){_0x34b459[_0x26786a][_0x8fbc('0x10d')](_0x8fbc('0xa1'),'Openchannel');}return _0x34b459;}));return BPromise[_0x8fbc('0xeb')](_0x226caf);})['then'](function(_0x3c8e87){var _0x227ee2=_['flatten'](_0x3c8e87);_0x226caf=[];return db[_0x8fbc('0x5e')][_0x8fbc('0x11a')](function(_0x575a06){for(var _0x225157=0x0;_0x225157<_0x227ee2['length'];_0x225157++){_0x226caf[_0x8fbc('0xb1')](_0x227ee2[_0x225157][_0x8fbc('0x121')](_0x98fa73['id']),{'transaction':_0x575a06});}return BPromise[_0x8fbc('0xeb')](_0x226caf)[_0x8fbc('0x39')](function(){if(_0x98fa73['online']){return BPromise['each'](_[_0x8fbc('0x3c')](_0x227ee2,function(_0x1fe3c8){return _0x1fe3c8[_0x8fbc('0x122')](_0x8fbc('0xa1'))===_0x8fbc('0x10e');}),function(_0x322a14){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x322a14['id'],'UserId':_0x98fa73['id']},'transaction':_0x575a06});});}else{return;}})[_0x8fbc('0x39')](function(){for(var _0x4e0dd0=0x0;_0x4e0dd0<_0x227ee2['length'];_0x4e0dd0++){var _0x481d4f=_0x227ee2[_0x4e0dd0][_0x8fbc('0x122')](_0x8fbc('0xa1'));var _0x187722=_0x481d4f+_0x8fbc('0xad');socket['emit'](_0x8fbc('0x3a')+_0x481d4f+_0x8fbc('0xb5'),{'UserId':_0x98fa73['id'],['queueField']:_0x227ee2[_0x4e0dd0]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x4d5aff,null))['catch'](handleError(_0x4d5aff,null));};exports[_0x8fbc('0x123')]=function(_0x48005f,_0x4ba51f,_0x10061e){var _0x4d55bd={};var _0x596d17={};var _0x360cfc;var _0x4dce0b;return db[_0x8fbc('0x48')][_0x8fbc('0x97')]({'where':{'id':_0x48005f[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x4ba51f,null))[_0x8fbc('0x39')](function(_0x104077){if(_0x104077){_0x360cfc=_0x104077;_0x596d17[_0x8fbc('0x4d')]=_['keys'](db[_0x8fbc('0xc0')][_0x8fbc('0x49')]);_0x596d17[_0x8fbc('0x4f')]=_[_0x8fbc('0x50')](_0x48005f[_0x8fbc('0x4f')]);_0x596d17[_0x8fbc('0x51')]=_[_0x8fbc('0x52')](_0x596d17['model'],_0x596d17[_0x8fbc('0x4f')]);_0x4d55bd[_0x8fbc('0x53')]=_['intersection'](_0x596d17[_0x8fbc('0x4d')],qs[_0x8fbc('0x54')](_0x48005f[_0x8fbc('0x4f')][_0x8fbc('0x54')]));_0x4d55bd[_0x8fbc('0x53')]=_0x4d55bd['attributes']['length']?_0x4d55bd[_0x8fbc('0x53')]:_0x596d17['model'];_0x4d55bd[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x48005f[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x4d55bd[_0x8fbc('0x5a')]=qs['filters'](_[_0x8fbc('0x5b')](_0x48005f['query'],_0x596d17[_0x8fbc('0x51')]));if(_0x48005f['query'][_0x8fbc('0x3c')]){_0x4d55bd[_0x8fbc('0x5a')]=_['merge'](_0x4d55bd[_0x8fbc('0x5a')],{'$or':_[_0x8fbc('0x3e')](_0x4d55bd[_0x8fbc('0x53')],function(_0xf517d6){var _0x2fd07c={};_0x2fd07c[_0xf517d6]={'$like':'%'+_0x48005f['query'][_0x8fbc('0x3c')]+'%'};return _0x2fd07c;})});}_0x4d55bd=_['merge']({},_0x4d55bd,_0x48005f['options']);return _0x360cfc[_0x8fbc('0x123')](_0x4d55bd);}})[_0x8fbc('0x39')](function(_0x2cba53){if(_0x2cba53){_0x4dce0b=_0x2cba53['length'];if(!_0x48005f[_0x8fbc('0x4f')]['hasOwnProperty'](_0x8fbc('0x57'))){_0x4d55bd[_0x8fbc('0x33')]=qs[_0x8fbc('0x33')](_0x48005f[_0x8fbc('0x4f')][_0x8fbc('0x33')]);_0x4d55bd['offset']=qs['offset'](_0x48005f[_0x8fbc('0x4f')][_0x8fbc('0x32')]);}return _0x360cfc[_0x8fbc('0x123')](_0x4d55bd);}})[_0x8fbc('0x39')](function(_0x5bb5bc){if(_0x5bb5bc){return _0x5bb5bc?{'count':_0x4dce0b,'rows':_0x5bb5bc}:null;}})['then'](respondWithResult(_0x4ba51f,null))[_0x8fbc('0x63')](handleError(_0x4ba51f,null));};exports[_0x8fbc('0x124')]=function(_0x399a6f,_0x5d11ae,_0xaea222){var _0x20e91b={};var _0x3af449={};var _0x3abf1b;var _0x5a317d;return db['User'][_0x8fbc('0x97')]({'where':{'id':_0x399a6f[_0x8fbc('0x64')]['id']}})[_0x8fbc('0x39')](handleEntityNotFound(_0x5d11ae,null))[_0x8fbc('0x39')](function(_0x5e1be6){if(_0x5e1be6){_0x3abf1b=_0x5e1be6;_0x3af449[_0x8fbc('0x4d')]=_[_0x8fbc('0x50')](db[_0x8fbc('0x48')]['rawAttributes']);_0x3af449['query']=_['keys'](_0x399a6f['query']);_0x3af449['filters']=_[_0x8fbc('0x52')](_0x3af449[_0x8fbc('0x4d')],_0x3af449['query']);_0x20e91b[_0x8fbc('0x53')]=_[_0x8fbc('0x52')](_0x3af449[_0x8fbc('0x4d')],qs[_0x8fbc('0x54')](_0x399a6f[_0x8fbc('0x4f')]['fields']));_0x20e91b[_0x8fbc('0x53')]=_0x20e91b['attributes']['length']?_0x20e91b[_0x8fbc('0x53')]:_0x3af449[_0x8fbc('0x4d')];_0x20e91b[_0x8fbc('0x58')]=qs[_0x8fbc('0x59')](_0x399a6f[_0x8fbc('0x4f')][_0x8fbc('0x59')]);_0x20e91b['where']=qs[_0x8fbc('0x51')](_[_0x8fbc('0x5b')](_0x399a6f[_0x8fbc('0x4f')],_0x3af449[_0x8fbc('0x51')]));if(_0x399a6f[_0x8fbc('0x4f')][_0x8fbc('0x3c')]){_0x20e91b[_0x8fbc('0x5a')]=_[_0x8fbc('0x5c')](_0x20e91b['where'],{'$or':_['map'](_0x20e91b[_0x8fbc('0x53')],function(_0x490319){var _0x59d47e={};_0x59d47e[_0x490319]={'$like':'%'+_0x399a6f[_0x8fbc('0x4f')]['filter']+'%'};return _0x59d47e;})});}_0x20e91b['model']=db['User'];_0x20e91b['as']=_0x8fbc('0x3b');_0x20e91b=_['merge']({},_0x20e91b,_0x399a6f['options']);return _0x3abf1b['getVoiceQueues']({'include':[_0x20e91b]});}})[_0x8fbc('0x39')](function(_0x2009a0){if(_0x2009a0){var _0x2d4bb6={},_0x55071d=[],_0x203df3=0x0;for(var _0xd25acd=0x0;_0xd25acd<_0x2009a0[_0x8fbc('0x55')];_0xd25acd+=0x1){for(var _0x1dcb67=0x0,_0x5ec322;_0x1dcb67<_0x2009a0[_0xd25acd][_0x8fbc('0x3b')][_0x8fbc('0x55')];_0x1dcb67+=0x1){_0x5ec322=_0x2009a0[_0xd25acd][_0x8fbc('0x3b')][_0x1dcb67]['get']({'plain':!![]});_0x2d4bb6[_0x5ec322['id']]=_0x5ec322;}}_0x2d4bb6=_[_0x8fbc('0x125')](_0x2d4bb6);for(var _0x5b8f06=qs[_0x8fbc('0x32')](_0x399a6f[_0x8fbc('0x4f')][_0x8fbc('0x32')]);_0x5b8f06<_0x2d4bb6[_0x8fbc('0x55')]&&_0x55071d[_0x8fbc('0x55')]=_0xd5e80a){_0x2c0f32=_0xd5e80a;_0x290171=0xc8;}else{_0x290171=0xce;}_0x453e05[_0x63b5('0x2b')](_0x290171);return _0x453e05['set'](_0x63b5('0x30'),_0xe6da69+'-'+_0x2c0f32+'/'+_0xd5e80a)[_0x63b5('0x2d')](_0x1f2ff3);}return null;};}function patchUpdates(_0x465890){return function(_0x1fd07c){try{jsonpatch[_0x63b5('0x31')](_0x1fd07c,_0x465890,!![]);}catch(_0x434ce7){return BPromise['reject'](_0x434ce7);}return _0x1fd07c[_0x63b5('0x32')]();};}function saveUpdates(_0x2deb47,_0x333a9d){return function(_0x4b638d){if(_0x4b638d){return _0x4b638d[_0x63b5('0x33')](_0x2deb47)[_0x63b5('0x20')](function(_0x3daef2){return _0x3daef2;});}return null;};}function removeEntity(_0x9563b7,_0x3732f2){return function(_0x479396){if(_0x479396){return _0x479396[_0x63b5('0x34')]()[_0x63b5('0x20')](function(){var _0x3c2dbe=_0x479396[_0x63b5('0x35')]({'plain':!![]});var _0x545bb6=[{'name':_0x63b5('0x36'),'value':_0x63b5('0x37'),'ignore':!![]},{'name':_0x63b5('0x38'),'value':_0x63b5('0x39'),'ignore':![]},{'name':_0x63b5('0x3a'),'value':_0x63b5('0x3b'),'ignore':![]}];var _0xda0b56=_(_0x545bb6)[_0x63b5('0x3c')](_0x63b5('0x3d'))[_0x63b5('0x3e')](_0x63b5('0x3f'))['value']();if(_[_0x63b5('0x40')](_0xda0b56,_0x3c2dbe['role'])){return;}var _0xb654d=_[_0x63b5('0x41')](_0x545bb6,[_0x63b5('0x3f'),_0x3c2dbe[_0x63b5('0x42')]])['name'];return db[_0x63b5('0x43')][_0x63b5('0x34')]({'where':{'type':_0xb654d,'resourceId':_0x3c2dbe['id']}})[_0x63b5('0x20')](function(){return _0x479396;});})[_0x63b5('0x20')](function(){_0x9563b7[_0x63b5('0x2b')](0xcc)[_0x63b5('0x2c')]();});}};}function handleEntityNotFound(_0x4a42a2,_0x2efd48){return function(_0x57f555){if(!_0x57f555){_0x4a42a2[_0x63b5('0x2a')](0x194);}return _0x57f555;};}function handleError(_0x9e4df0,_0x5ccdd2){_0x5ccdd2=_0x5ccdd2||0x1f4;return function(_0x2d95fe){logger['error'](_0x2d95fe[_0x63b5('0x44')]);if(_0x2d95fe['name']){delete _0x2d95fe[_0x63b5('0x45')];}_0x9e4df0['status'](_0x5ccdd2)['send'](_0x2d95fe);};}exports['index']=function(_0x4285b9,_0x1962f0){var _0x4352a5={},_0x13e7fd={},_0x5a32bd={'count':0x0,'rows':[]};var _0x165224=_[_0x63b5('0x3e')](db[_0x63b5('0x46')][_0x63b5('0x47')],function(_0x486756){return{'name':_0x486756[_0x63b5('0x48')],'type':_0x486756['type'][_0x63b5('0x49')]};});_0x13e7fd['model']=_[_0x63b5('0x4a')](_['map'](_0x165224,_0x63b5('0x45')),['password','salt']);_0x13e7fd[_0x63b5('0x4b')]=_['keys'](_0x4285b9[_0x63b5('0x4b')]);_0x13e7fd['filters']=_[_0x63b5('0x4c')](_0x13e7fd[_0x63b5('0x4d')],_0x13e7fd[_0x63b5('0x4b')]);_0x4352a5['attributes']=_[_0x63b5('0x4c')](_0x13e7fd['model'],qs[_0x63b5('0x4e')](_0x4285b9[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x4352a5[_0x63b5('0x4f')]=_0x4352a5[_0x63b5('0x4f')][_0x63b5('0x50')]?_0x4352a5[_0x63b5('0x4f')]:_0x13e7fd[_0x63b5('0x4d')];if(!_0x4285b9['query'][_0x63b5('0x51')]('nolimit')){_0x4352a5['limit']=qs[_0x63b5('0x52')](_0x4285b9[_0x63b5('0x4b')]['limit']);_0x4352a5[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x4285b9[_0x63b5('0x4b')][_0x63b5('0x2f')]);}_0x4352a5['order']=qs[_0x63b5('0x53')](_0x4285b9['query'][_0x63b5('0x53')]);_0x4352a5[_0x63b5('0x54')]=qs[_0x63b5('0x55')](_[_0x63b5('0x56')](_0x4285b9[_0x63b5('0x4b')],_0x13e7fd[_0x63b5('0x55')]),_0x165224);if(_0x4285b9['query'][_0x63b5('0x3c')]){_0x4352a5[_0x63b5('0x54')]=_['merge'](_0x4352a5[_0x63b5('0x54')],{'$or':_[_0x63b5('0x3e')](_0x165224,function(_0x3c7744){if(_0x3c7744[_0x63b5('0x57')]!==_0x63b5('0x58')){return db[_0x63b5('0x59')][_0x63b5('0x54')](db[_0x63b5('0x59')]['fn'](_0x63b5('0x5a'),db[_0x63b5('0x59')][_0x63b5('0x5b')](_0x3c7744[_0x63b5('0x45')])),{'$like':db['sequelize']['fn']('lower','%'+_0x4285b9[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%')});}})});}_0x4352a5=_[_0x63b5('0x5c')]({},_0x4352a5,_0x4285b9['options']);var _0x318c7d={'where':_0x4352a5[_0x63b5('0x54')]};return db[_0x63b5('0x46')][_0x63b5('0x2e')](_0x318c7d)[_0x63b5('0x20')](function(_0x28ab4e){_0x5a32bd[_0x63b5('0x2e')]=_0x28ab4e;if(_0x4285b9[_0x63b5('0x4b')][_0x63b5('0x5d')]){_0x4352a5[_0x63b5('0x5e')]=[{'all':!![]}];}return db[_0x63b5('0x46')][_0x63b5('0x5f')](_0x4352a5);})[_0x63b5('0x20')](function(_0x37dd20){_0x5a32bd['rows']=_0x37dd20;return _0x5a32bd;})[_0x63b5('0x20')](respondWithFilteredResult(_0x1962f0,_0x4352a5))['catch'](handleError(_0x1962f0,null));};exports[_0x63b5('0x60')]=function(_0x2e70f8,_0x4ad046){var _0x4f5376={'raw':![],'where':{'id':_0x2e70f8[_0x63b5('0x61')]['id']}},_0x45d729={};_0x45d729[_0x63b5('0x4d')]=_[_0x63b5('0x4a')](_[_0x63b5('0x62')](db[_0x63b5('0x46')]['rawAttributes']),[_0x63b5('0x63'),'salt']);_0x45d729[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x2e70f8[_0x63b5('0x4b')]);_0x45d729[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x45d729[_0x63b5('0x4d')],_0x45d729[_0x63b5('0x4b')]);_0x4f5376[_0x63b5('0x4f')]=_[_0x63b5('0x4c')](_0x45d729[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x2e70f8[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x4f5376[_0x63b5('0x4f')]=_0x4f5376[_0x63b5('0x4f')][_0x63b5('0x50')]?_0x4f5376[_0x63b5('0x4f')]:_0x45d729['model'];if(_0x2e70f8[_0x63b5('0x4b')][_0x63b5('0x5d')]){_0x4f5376['include']=[{'all':!![]}];}_0x4f5376=_[_0x63b5('0x5c')]({},_0x4f5376,_0x2e70f8['options']);return db[_0x63b5('0x46')]['find'](_0x4f5376)[_0x63b5('0x20')](handleEntityNotFound(_0x4ad046,null))[_0x63b5('0x20')](respondWithResult(_0x4ad046,null))[_0x63b5('0x29')](handleError(_0x4ad046,null));};exports[_0x63b5('0x64')]=function(_0x505ac4,_0x1c4b90){return db[_0x63b5('0x46')][_0x63b5('0x64')](_0x505ac4[_0x63b5('0x65')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1c4b90,0xc9))[_0x63b5('0x29')](handleError(_0x1c4b90,null));};exports[_0x63b5('0x33')]=function(_0x264f9f,_0x2fe49c){if(_0x264f9f[_0x63b5('0x65')]['id']){delete _0x264f9f[_0x63b5('0x65')]['id'];}delete _0x264f9f[_0x63b5('0x65')][_0x63b5('0x42')];return db[_0x63b5('0x46')][_0x63b5('0x41')]({'where':{'id':_0x264f9f[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x2fe49c,null))['then'](saveUpdates(_0x264f9f['body'],null))['then'](respondWithResult(_0x2fe49c,null))[_0x63b5('0x29')](handleError(_0x2fe49c,null));};exports[_0x63b5('0x66')]=function(_0x2afb1b,_0x48245a){return db[_0x63b5('0x46')]['describe']()[_0x63b5('0x20')](respondWithResult(_0x48245a,null))[_0x63b5('0x29')](handleError(_0x48245a,null));};exports[_0x63b5('0x67')]=function(_0x5bbb59,_0x4aa043,_0x121b96){return db[_0x63b5('0x46')][_0x63b5('0x41')]({'where':{'id':_0x5bbb59[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x4aa043,null))[_0x63b5('0x20')](function(_0x1a72cf){if(_0x1a72cf){return _0x1a72cf[_0x63b5('0x67')](_0x5bbb59[_0x63b5('0x65')][_0x63b5('0x68')],_['omit'](_0x5bbb59[_0x63b5('0x65')],[_0x63b5('0x68'),'id'])||{});}})[_0x63b5('0x20')](respondWithResult(_0x4aa043,null))[_0x63b5('0x29')](handleError(_0x4aa043,null));};var getLicense=function(_0x1650c7){return new BPromise(function(_0x1732e9,_0x28d892){var _0x28e674=0x0;_0x1650c7[_0x63b5('0x65')][_0x63b5('0x42')]===_0x63b5('0x39')&&_0x1732e9(_0x63b5('0x69'));return db[_0x63b5('0x46')][_0x63b5('0x2e')]({'where':{'$or':[{'role':_0x1650c7[_0x63b5('0x65')][_0x63b5('0x42')]==='telephone'?_0x63b5('0x3b'):[_0x63b5('0x6a'),_0x63b5('0x37')]}]}})[_0x63b5('0x20')](function(_0x4695b9){_0x28e674=_0x4695b9;return require('../../config/license/util')['getLicense']();})[_0x63b5('0x20')](function(_0x1e4c9b){var _0x100f9a=_0x1650c7['body'][_0x63b5('0x42')]===_0x63b5('0x3b')?_0x63b5('0x6b'):_0x63b5('0x6c');if(!_[_0x63b5('0x6d')](_0x1e4c9b[_0x100f9a])&&_0x28e674>=_0x1e4c9b[_0x100f9a]){return _0x28d892({'message':'License\x20limit\x20reached'});}return _0x1732e9(util[_0x63b5('0x6e')](_0x63b5('0x6f'),_0x100f9a,_0x28e674));})['catch'](function(_0x2ae262){return _0x28d892(_0x2ae262);});});};exports[_0x63b5('0x70')]=function(_0x2884f6,_0x3b15b4){return getLicense(_0x2884f6)[_0x63b5('0x20')](function(_0x2c957a){if(!_0x2884f6['body'][_0x63b5('0x71')]){var _0x202fdf;return db[_0x63b5('0x72')][_0x63b5('0x73')](0x1)[_0x63b5('0x20')](function(_0x1e6356){return checkPasswordPattern(_0x1e6356,_0x2884f6['body'][_0x63b5('0x63')],_0x1e6356[_0x63b5('0x74')]);})[_0x63b5('0x20')](function(_0xc633d6){_0x202fdf=_0xc633d6['min_internal'];return db[_0x63b5('0x46')][_0x63b5('0x75')](_0x63b5('0x71'));})[_0x63b5('0x20')](function(_0x17ab99){if(_['isNil'](_0x17ab99)){if(_0x202fdf){_0x2884f6['body'][_0x63b5('0x71')]=_0x202fdf;}else{_0x2884f6[_0x63b5('0x65')]['internal']=0x1;}}else{if(_[_0x63b5('0x6d')](_0x202fdf)||_0x202fdf==_0x17ab99){_0x2884f6['body']['internal']=_0x17ab99+0x1;}else if(_0x202fdf>_0x17ab99){_0x2884f6[_0x63b5('0x65')][_0x63b5('0x71')]=_0x202fdf;}else{return db[_0x63b5('0x59')][_0x63b5('0x4b')](_0x63b5('0x76'),{'type':db[_0x63b5('0x59')][_0x63b5('0x77')][_0x63b5('0x78')]})[_0x63b5('0x20')](function(_0x432e2d){if(_0x432e2d&&_0x432e2d[_0x63b5('0x50')]){for(var _0x136672=0x0,_0x66613f=_0x432e2d[_0x63b5('0x50')];_0x136672<_0x66613f&&_[_0x63b5('0x6d')](_0x2884f6[_0x63b5('0x65')]['internal']);_0x136672++){if(_0x202fdf<=_0x432e2d[_0x136672]['from']){_0x2884f6[_0x63b5('0x65')][_0x63b5('0x71')]=_0x432e2d[_0x136672][_0x63b5('0x79')];}else if(_0x202fdf>_0x432e2d[_0x136672][_0x63b5('0x79')]&&_0x202fdf<=_0x432e2d[_0x136672]['to']){_0x2884f6[_0x63b5('0x65')]['internal']=_0x202fdf;}}}if(_['isNil'](_0x2884f6[_0x63b5('0x65')][_0x63b5('0x71')])){_0x2884f6[_0x63b5('0x65')][_0x63b5('0x71')]=_0x17ab99+0x1;}});}}});}})[_0x63b5('0x20')](function(){if(_0x2884f6['body'][_0x63b5('0x7a')]){_0x2884f6[_0x63b5('0x65')]['mailbox']=_0x2884f6['body'][_0x63b5('0x71')];_0x2884f6[_0x63b5('0x65')]['VoiceMail']={'mailbox':_0x2884f6[_0x63b5('0x65')][_0x63b5('0x71')],'password':_0x2884f6['body'][_0x63b5('0x63')],'fullname':_0x2884f6[_0x63b5('0x65')]['fullname'],'email':_0x2884f6[_0x63b5('0x65')][_0x63b5('0x7b')]};}if(_0x2884f6[_0x63b5('0x65')]&&_0x2884f6[_0x63b5('0x65')]['role']==='agent'){if(!_0x2884f6[_0x63b5('0x65')]['permissions']){_0x2884f6[_0x63b5('0x65')][_0x63b5('0x7c')]=[_0x63b5('0x7d'),_0x63b5('0x7e'),_0x63b5('0x7f'),_0x63b5('0x80'),_0x63b5('0x81'),_0x63b5('0x82'),_0x63b5('0x83'),_0x63b5('0x84'),_0x63b5('0x85'),_0x63b5('0x86'),_0x63b5('0x87'),_0x63b5('0x88'),_0x63b5('0x89'),_0x63b5('0x8a')];}}return db[_0x63b5('0x46')][_0x63b5('0x70')](_0x2884f6['body'],{'include':[{'model':db[_0x63b5('0x8b')],'as':'VoiceMail'}]});})[_0x63b5('0x20')](function(_0x231f8a){if(_0x2884f6[_0x63b5('0x65')]['role']==='user')return _0x231f8a;var _0x3f5a66=_0x2884f6['user'][_0x63b5('0x35')]({'plain':!![]});if(!_0x3f5a66)throw new Error(_0x63b5('0x8c'));if(_0x3f5a66[_0x63b5('0x42')]===_0x63b5('0x37')){var _0x62f600=_0x231f8a[_0x63b5('0x35')]({'plain':!![]});var _0x32af82=[{'name':_0x63b5('0x38'),'value':'agent'},{'name':_0x63b5('0x3a'),'value':'telephone'}];var _0x539c5d=_[_0x63b5('0x41')](_0x32af82,['value',_0x62f600[_0x63b5('0x42')]])[_0x63b5('0x45')];return db['UserProfileSection']['find']({'where':{'name':_0x539c5d,'userProfileId':_0x3f5a66['userProfileId']},'raw':!![]})[_0x63b5('0x20')](function(_0x47da5e){if(_0x47da5e&&_0x47da5e[_0x63b5('0x8d')]===0x0){return db[_0x63b5('0x43')]['create']({'name':_0x62f600[_0x63b5('0x45')],'resourceId':_0x62f600['id'],'type':_0x47da5e[_0x63b5('0x45')],'sectionId':_0x47da5e['id']},{})['then'](function(){return _0x231f8a;});}else{return _0x231f8a;}})[_0x63b5('0x29')](function(_0x20f785){logger[_0x63b5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20f785);throw _0x20f785;});}return _0x231f8a;})[_0x63b5('0x20')](respondWithResult(_0x3b15b4,0xc9))['catch'](handleError(_0x3b15b4,null));};exports['changePassword']=function(_0x301e36,_0x11fce7,_0x2eacbb){var _0x776947=![];if(_0x301e36[_0x63b5('0x65')]['id']){delete _0x301e36[_0x63b5('0x65')]['id'];}return db[_0x63b5('0x72')][_0x63b5('0x8e')]({'attributes':['id',_0x63b5('0x74')]})[_0x63b5('0x20')](function(_0x321a0d){_0x776947=_0x321a0d[_0x63b5('0x74')];return db['User'][_0x63b5('0x41')]({'where':{'id':_0x301e36[_0x63b5('0x61')]['id']}});})['then'](function(_0x58c629){if(_0x58c629){if(_0x58c629['id']==_0x301e36[_0x63b5('0x37')]['id']){if(!_0x301e36[_0x63b5('0x65')][_0x63b5('0x8f')]||!_0x301e36[_0x63b5('0x65')][_0x63b5('0x90')]){throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x58c629[_0x63b5('0x91')](_0x301e36[_0x63b5('0x65')][_0x63b5('0x8f')])){throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))]('Wrong\x20credentials');}if(_0x301e36['body'][_0x63b5('0x8f')]==_0x301e36[_0x63b5('0x65')][_0x63b5('0x90')]){throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))](_0x63b5('0x92'));}return _0x58c629;}else if(_0x301e36[_0x63b5('0x37')][_0x63b5('0x42')]==_0x63b5('0x6a')){if(!_0x301e36[_0x63b5('0x65')][_0x63b5('0x90')]){throw new db['Sequelize'][(_0x63b5('0x1d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x58c629;}else if(_0x301e36['user']['role']==_0x63b5('0x37')){if(!_0x301e36['body'][_0x63b5('0x90')]){throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x58c629[_0x63b5('0x42')]!=_0x63b5('0x39')){throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))](_0x63b5('0x93'));}return _0x58c629;}else{throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))](_0x63b5('0x93'));}}return null;})[_0x63b5('0x20')](handleEntityNotFound(_0x11fce7,null))[_0x63b5('0x20')](function(_0x26ed02){return checkPasswordPattern(_0x26ed02,_0x301e36[_0x63b5('0x65')]['newPassword'],_0x776947);})['then'](saveUpdates({'password':_0x301e36[_0x63b5('0x65')][_0x63b5('0x90')],'passwordResetAt':_0x301e36['user']['id']==_0x301e36[_0x63b5('0x61')]['id']?moment():null},null))['then'](respondWithResult(_0x11fce7,null))[_0x63b5('0x29')](handleError(_0x11fce7,null));};exports[_0x63b5('0x94')]=function(_0x3e7944,_0x2aa642,_0x3cf296){var _0x495160=_0x3e7944[_0x63b5('0x65')]['channel'];return db['User'][_0x63b5('0x41')]({'where':{'id':_0x3e7944[_0x63b5('0x61')]['id']},'attributes':['id',_0x63b5('0x45'),_0x63b5('0x42'),_0x63b5('0x95'),_0x63b5('0x96'),_0x63b5('0x97'),_0x63b5('0x98')]})[_0x63b5('0x20')](handleEntityNotFound(_0x2aa642,null))[_0x63b5('0x20')](function(_0x35eadb){if(_0x35eadb){if(!utils[_0x63b5('0x99')](_0x495160)){throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))](_0x63b5('0x9a'));}return _0x35eadb[_0x63b5('0x9b')+_[_0x63b5('0x9c')](_0x495160[_0x63b5('0x9d')]())+_0x63b5('0x9e')](_0x3e7944['body'][_0x63b5('0x68')],{'penalty':_0x3e7944[_0x63b5('0x65')][_0x63b5('0x9f')]||0x0})[_0x63b5('0xa0')](function(_0x580bed){for(var _0x274393=0x0;_0x274393<_0x3e7944[_0x63b5('0x65')]['ids'][_0x63b5('0x50')];_0x274393+=0x1){var _0x32c0db={'UserId':_0x3e7944[_0x63b5('0x61')]['id']};_0x32c0db[_[_0x63b5('0x9c')](_0x495160[_0x63b5('0x9d')]())+'QueueId']=_0x3e7944['body'][_0x63b5('0x68')][_0x274393];socket[_0x63b5('0xa1')]('user'+_[_0x63b5('0x9c')](_0x495160['toLowerCase']())+_0x63b5('0xa2'),_0x32c0db);}return _0x580bed;})[_0x63b5('0x20')](function(){if(_0x495160===_0x63b5('0xa3')){return db[_0x63b5('0xa4')][_0x63b5('0x5f')]({'where':{'id':_0x3e7944[_0x63b5('0x65')][_0x63b5('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x63b5('0x20')](function(_0x802dca){var _0x53b860=_0x35eadb[_0x63b5('0x35')]({'plain':!![]});var _0x3b58b4=[];if(_0x495160==='voice'&&_0x53b860[_0x63b5('0x42')]===_0x63b5('0x39')&&_0x53b860[_0x63b5('0x95')]){for(var _0x187455=0x0;_0x187455<_0x802dca[_0x63b5('0x50')];_0x187455+=0x1){_0x3b58b4[_0x63b5('0xa5')]({'membername':_0x53b860['name'],'UserId':_0x53b860['id'],'queue_name':_0x802dca[_0x187455][_0x63b5('0x45')],'VoiceQueueId':_0x802dca[_0x187455]['id'],'interface':_[_0x63b5('0x6d')](_0x53b860['interface'])?util[_0x63b5('0x6e')](_0x63b5('0xa6'),_0x53b860['name']):_0x53b860[_0x63b5('0x98')],'paused':_0x53b860['voicePause']||![],'penalty':_0x3e7944[_0x63b5('0x65')]['penalty']||0x0});}return BPromise[_0x63b5('0xa7')](_0x3b58b4,function(_0x220dde){return db[_0x63b5('0xa8')][_0x63b5('0xa9')](_0x220dde);});}return _0x35eadb;});}})[_0x63b5('0x20')](respondWithStatusCode(_0x2aa642,null))['catch'](handleError(_0x2aa642,null));};exports[_0x63b5('0xaa')]=function(_0x168798,_0x1cdfd3,_0x4498af){var _0x242424;return db[_0x63b5('0x46')][_0x63b5('0x41')]({'where':{'id':_0x168798['params']['id']},'attributes':['id',_0x63b5('0x45'),_0x63b5('0x42')]})[_0x63b5('0x20')](handleEntityNotFound(_0x1cdfd3,null))[_0x63b5('0x20')](function(_0x4b9557){if(_0x4b9557){_0x242424=_0x4b9557;if(!_0x168798[_0x63b5('0x4b')][_0x63b5('0xab')]||!utils[_0x63b5('0x99')](_0x168798['query']['channel'])){throw new db['Sequelize'][(_0x63b5('0x1d'))](_0x63b5('0x9a'));}return _0x4b9557['remove'+_['capitalize'](_0x168798[_0x63b5('0x4b')][_0x63b5('0xab')][_0x63b5('0x9d')]())+'Queues'](_0x168798[_0x63b5('0x4b')]['ids']);}})['then'](function(_0x116111){for(var _0x436f43=0x0;_0x436f43<_0x168798[_0x63b5('0x4b')][_0x63b5('0x68')][_0x63b5('0x50')];_0x436f43+=0x1){var _0xd74d91={'UserId':_0x168798['params']['id']};_0xd74d91[_[_0x63b5('0x9c')](_0x168798['query'][_0x63b5('0xab')]['toLowerCase']())+_0x63b5('0xac')]=_0x168798[_0x63b5('0x4b')][_0x63b5('0x68')][_0x436f43];socket['emit'](_0x63b5('0x37')+_[_0x63b5('0x9c')](_0x168798[_0x63b5('0x4b')][_0x63b5('0xab')][_0x63b5('0x9d')]())+_0x63b5('0xad'),_0xd74d91);}return _0x116111;})[_0x63b5('0x20')](function(){if(_0x168798[_0x63b5('0x4b')]['channel']===_0x63b5('0xa3')){return db[_0x63b5('0xa8')][_0x63b5('0x34')]({'where':{'UserId':_0x168798['params']['id'],'VoiceQueueId':_0x168798[_0x63b5('0x4b')][_0x63b5('0x68')]},'individualHooks':!![]})[_0x63b5('0x20')](function(){return _0x242424;});}return _0x242424;})[_0x63b5('0x20')](respondWithStatusCode(_0x1cdfd3,null))[_0x63b5('0x29')](handleError(_0x1cdfd3,null));};exports[_0x63b5('0xae')]=function(_0x583202,_0xf89209,_0x55d2a4){_0x583202[_0x63b5('0x65')][_0x63b5('0xaf')]=_0x583202['file'][_0x63b5('0xb0')];return db['User'][_0x63b5('0x41')]({'where':{'id':_0x583202['params']['id']}})['then'](handleEntityNotFound(_0xf89209,null))['then'](saveUpdates(_0x583202[_0x63b5('0x65')],null))[_0x63b5('0x20')](respondWithResult(_0xf89209,null))['catch'](handleError(_0xf89209,null));};exports['getAvatar']=function(_0x4e9f71,_0xa6d403,_0x18ac49){var _0x393b71=path[_0x63b5('0xb1')](config[_0x63b5('0xb2')],_0x63b5('0xb3'));return db[_0x63b5('0x46')][_0x63b5('0x41')]({'where':{'id':_0x4e9f71[_0x63b5('0x61')]['id']},'attributes':['id',_0x63b5('0xaf')],'raw':!![]})[_0x63b5('0x20')](handleEntityNotFound(_0xa6d403,null))[_0x63b5('0x20')](function(_0x5cb7ee){if(_0x5cb7ee){if(_[_0x63b5('0x6d')](_0x5cb7ee[_0x63b5('0xaf')])){return _0xa6d403[_0x63b5('0xb4')](_0x393b71);}else{if(!fs[_0x63b5('0xb5')](path[_0x63b5('0xb1')](config[_0x63b5('0xb2')],'server/files/images/',_0x5cb7ee[_0x63b5('0xaf')]))){return _0xa6d403[_0x63b5('0xb4')](_0x393b71);}return _0xa6d403[_0x63b5('0xb4')](path[_0x63b5('0xb1')](config[_0x63b5('0xb2')],_0x63b5('0xb6'),_0x5cb7ee[_0x63b5('0xaf')]));}}})[_0x63b5('0x29')](handleError(_0xa6d403,null));};exports[_0x63b5('0xb7')]=function(_0x7334ee,_0x444d38,_0x4430dd){var _0x3b9f50={};var _0x1edcf5={};var _0x4622a4;var _0x3bb1e2;return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x7334ee[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x444d38,null))['then'](function(_0x359c7a){if(_0x359c7a){_0x4622a4=_0x359c7a;_0x1edcf5['model']=_['keys'](db[_0x63b5('0xb8')][_0x63b5('0x47')]);_0x1edcf5[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x7334ee[_0x63b5('0x4b')]);_0x1edcf5['filters']=_[_0x63b5('0x4c')](_0x1edcf5[_0x63b5('0x4d')],_0x1edcf5[_0x63b5('0x4b')]);_0x3b9f50[_0x63b5('0x4f')]=_[_0x63b5('0x4c')](_0x1edcf5[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x7334ee['query'][_0x63b5('0x4e')]));_0x3b9f50['attributes']=_0x3b9f50[_0x63b5('0x4f')]['length']?_0x3b9f50[_0x63b5('0x4f')]:_0x1edcf5['model'];_0x3b9f50['order']=qs[_0x63b5('0x53')](_0x7334ee[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x3b9f50[_0x63b5('0x54')]=qs['filters'](_[_0x63b5('0x56')](_0x7334ee[_0x63b5('0x4b')],_0x1edcf5[_0x63b5('0x55')]));if(_0x7334ee[_0x63b5('0x4b')]['filter']){_0x3b9f50[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x3b9f50[_0x63b5('0x54')],{'$or':_['map'](_0x3b9f50['attributes'],function(_0x4a2695){var _0x468a58={};_0x468a58[_0x4a2695]={'$like':'%'+_0x7334ee[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%'};return _0x468a58;})});}_0x3b9f50=_[_0x63b5('0x5c')]({},_0x3b9f50,_0x7334ee[_0x63b5('0xb9')]);return _0x4622a4['getContacts'](_0x3b9f50);}})[_0x63b5('0x20')](function(_0x39e381){if(_0x39e381){_0x3bb1e2=_0x39e381[_0x63b5('0x50')];if(_0x7334ee[_0x63b5('0x4b')]['hasOwnProperty'](_0x63b5('0x5d'))){_0x3b9f50[_0x63b5('0x5e')]=[{'model':db['CmList'],'as':_0x63b5('0xba'),'required':![]},{'model':db[_0x63b5('0xbb')],'as':'Tags','attributes':['id','name',_0x63b5('0xbc')],'where':_0x7334ee[_0x63b5('0x4b')]['tag']?{'id':_0x7334ee[_0x63b5('0x4b')][_0x63b5('0xbd')]}:undefined,'required':_0x7334ee[_0x63b5('0x4b')]['tag']?!![]:![]}];}if(!_0x7334ee['query'][_0x63b5('0x51')](_0x63b5('0xbe'))){_0x3b9f50['limit']=qs['limit'](_0x7334ee[_0x63b5('0x4b')][_0x63b5('0x52')]);_0x3b9f50['offset']=qs[_0x63b5('0x2f')](_0x7334ee[_0x63b5('0x4b')]['offset']);}return _0x4622a4['getContacts'](_0x3b9f50);}})[_0x63b5('0x20')](function(_0x36618c){if(_0x36618c){return _0x36618c?{'count':_0x3bb1e2,'rows':_0x36618c}:null;}})[_0x63b5('0x20')](respondWithResult(_0x444d38,null))[_0x63b5('0x29')](handleError(_0x444d38,null));};exports[_0x63b5('0xbf')]=function(_0x4fcd0c,_0x11cc53,_0x23ac8d){var _0x2ddd75;var _0x358f1e;var _0x49b0d9={};var _0x41900b;return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x4fcd0c['params']['id']},'attributes':['id',_0x63b5('0x45'),_0x63b5('0x42')]})['then'](handleEntityNotFound(_0x11cc53,null))[_0x63b5('0x20')](function(_0x49fa22){if(!utils[_0x63b5('0x99')](_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0xab')])){throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))](_0x63b5('0x9a'));}_0x2ddd75=_0x49fa22;var _0x5be713={};_0x5be713[_0x63b5('0x4d')]=_[_0x63b5('0x62')](db[_['capitalize'](_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0xab')])+_0x63b5('0xc0')][_0x63b5('0x47')]);_0x5be713[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x4fcd0c[_0x63b5('0x4b')]);_0x5be713[_0x63b5('0x55')]=_['intersection'](_0x5be713['model'],_0x5be713[_0x63b5('0x4b')]);_0x49b0d9[_0x63b5('0x4f')]=_[_0x63b5('0x4c')](_0x5be713['model'],qs[_0x63b5('0x4e')](_0x4fcd0c['query'][_0x63b5('0x4e')]));_0x49b0d9[_0x63b5('0x4f')]=_0x49b0d9['attributes'][_0x63b5('0x50')]?_0x49b0d9[_0x63b5('0x4f')]:_0x5be713['model'];_0x49b0d9[_0x63b5('0xc1')]=qs['sort'](_0x4fcd0c['query'][_0x63b5('0x53')]);_0x49b0d9[_0x63b5('0x54')]=qs['filters'](_[_0x63b5('0x56')](_0x4fcd0c['query'],_0x5be713['filters']));if(_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0x49b0d9['where']=_['merge'](_0x49b0d9[_0x63b5('0x54')],{'$or':_['map'](_0x49b0d9['attributes'],function(_0x37b037){var _0x567443={};_0x567443[_0x37b037]={'$like':'%'+_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%'};return _0x567443;})});}_0x49b0d9=_[_0x63b5('0x5c')]({},_0x49b0d9,_0x4fcd0c[_0x63b5('0xb9')]);switch(_0x2ddd75[_0x63b5('0x42')]){case _0x63b5('0x6a'):return db[_['capitalize'](_0x4fcd0c['query']['channel'])+_0x63b5('0xc0')][_0x63b5('0x5f')](_0x49b0d9);case _0x63b5('0x37'):case _0x63b5('0x39'):return _0x2ddd75[_0x63b5('0x35')+_[_0x63b5('0x9c')](_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0xab')])+_0x63b5('0x9e')](_0x49b0d9);default:throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))](_0x63b5('0xc2'));}})[_0x63b5('0x20')](function(_0x4a09bf){_0x41900b=_0x4a09bf['length'];if(!_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0x51')](_0x63b5('0xbe'))){_0x49b0d9[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0x52')]);_0x49b0d9[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0x2f')]);}switch(_0x2ddd75[_0x63b5('0x42')]){case _0x63b5('0x6a'):return db[_['capitalize'](_0x4fcd0c[_0x63b5('0x4b')]['channel'])+_0x63b5('0xc0')]['findAll'](_0x49b0d9);case _0x63b5('0x37'):case _0x63b5('0x39'):return _0x2ddd75[_0x63b5('0x35')+_[_0x63b5('0x9c')](_0x4fcd0c[_0x63b5('0x4b')][_0x63b5('0xab')])+'Queues'](_0x49b0d9);}})[_0x63b5('0x20')](function(_0x220efb){return{'count':_0x41900b,'rows':_0x220efb};})[_0x63b5('0x20')](respondWithResult(_0x11cc53,null))[_0x63b5('0x29')](handleError(_0x11cc53,null));};exports[_0x63b5('0xc3')]=function(_0x5c8c70,_0x1a5ebb,_0x416ec6){var _0x2564f3={};var _0x3d7077={};var _0xc91886;var _0x59dcd5;return db['User'][_0x63b5('0x8e')]({'where':{'id':_0x5c8c70['params']['id']}})['then'](handleEntityNotFound(_0x1a5ebb,null))[_0x63b5('0x20')](function(_0x4c698b){if(_0x4c698b){_0xc91886=_0x4c698b;_0x3d7077[_0x63b5('0x4d')]=_[_0x63b5('0x62')](db[_0x63b5('0xa8')][_0x63b5('0x47')]);_0x3d7077['query']=_['keys'](_0x5c8c70[_0x63b5('0x4b')]);_0x3d7077[_0x63b5('0x55')]=_['intersection'](_0x3d7077[_0x63b5('0x4d')],_0x3d7077[_0x63b5('0x4b')]);_0x2564f3['attributes']=_[_0x63b5('0x4c')](_0x3d7077[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x5c8c70[_0x63b5('0x4b')]['fields']));_0x2564f3[_0x63b5('0x4f')]=_0x2564f3['attributes'][_0x63b5('0x50')]?_0x2564f3[_0x63b5('0x4f')]:_0x3d7077[_0x63b5('0x4d')];_0x2564f3[_0x63b5('0xc1')]=qs['sort'](_0x5c8c70[_0x63b5('0x4b')]['sort']);_0x2564f3['where']=qs[_0x63b5('0x55')](_[_0x63b5('0x56')](_0x5c8c70[_0x63b5('0x4b')],_0x3d7077[_0x63b5('0x55')]));if(_0x5c8c70[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0x2564f3[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x2564f3[_0x63b5('0x54')],{'$or':_[_0x63b5('0x3e')](_0x2564f3[_0x63b5('0x4f')],function(_0xef66fa){var _0x77ef06={};_0x77ef06[_0xef66fa]={'$like':'%'+_0x5c8c70[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%'};return _0x77ef06;})});}_0x2564f3=_[_0x63b5('0x5c')]({},_0x2564f3,_0x5c8c70[_0x63b5('0xb9')]);return _0xc91886[_0x63b5('0xc3')](_0x2564f3);}})[_0x63b5('0x20')](function(_0x5c17c4){if(_0x5c17c4){_0x59dcd5=_0x5c17c4[_0x63b5('0x50')];if(!_0x5c8c70[_0x63b5('0x4b')]['hasOwnProperty'](_0x63b5('0xbe'))){_0x2564f3[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x5c8c70[_0x63b5('0x4b')]['limit']);_0x2564f3[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x5c8c70[_0x63b5('0x4b')]['offset']);}return _0xc91886[_0x63b5('0xc3')](_0x2564f3);}})['then'](function(_0x7a005b){if(_0x7a005b){return _0x7a005b?{'count':_0x59dcd5,'rows':_0x7a005b}:null;}})[_0x63b5('0x20')](respondWithResult(_0x1a5ebb,null))[_0x63b5('0x29')](handleError(_0x1a5ebb,null));};exports[_0x63b5('0xc4')]=function(_0x4c92b2,_0xc2ae26,_0x3a754d){var _0x1ae8a6={};var _0x18ba8c={};var _0x3c86d6;var _0x6d310b;return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x4c92b2['params']['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0xc2ae26,null))[_0x63b5('0x20')](function(_0x1df664){if(_0x1df664){_0x3c86d6=_0x1df664;_0x18ba8c['model']=_[_0x63b5('0x62')](db[_0x63b5('0xc5')][_0x63b5('0x47')]);_0x18ba8c[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x4c92b2[_0x63b5('0x4b')]);_0x18ba8c[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x18ba8c['model'],_0x18ba8c[_0x63b5('0x4b')]);_0x1ae8a6[_0x63b5('0x4f')]=_['intersection'](_0x18ba8c[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x4c92b2['query']['fields']));_0x1ae8a6[_0x63b5('0x4f')]=_0x1ae8a6[_0x63b5('0x4f')][_0x63b5('0x50')]?_0x1ae8a6[_0x63b5('0x4f')]:_0x18ba8c[_0x63b5('0x4d')];_0x1ae8a6[_0x63b5('0xc1')]=qs[_0x63b5('0x53')](_0x4c92b2[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x1ae8a6[_0x63b5('0x54')]=qs[_0x63b5('0x55')](_[_0x63b5('0x56')](_0x4c92b2[_0x63b5('0x4b')],_0x18ba8c['filters']));if(_0x4c92b2[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0x1ae8a6[_0x63b5('0x54')]=_['merge'](_0x1ae8a6['where'],{'$or':_[_0x63b5('0x3e')](_0x1ae8a6[_0x63b5('0x4f')],function(_0x1f6dce){var _0x19a9a7={};_0x19a9a7[_0x1f6dce]={'$like':'%'+_0x4c92b2[_0x63b5('0x4b')]['filter']+'%'};return _0x19a9a7;})});}_0x1ae8a6=_[_0x63b5('0x5c')]({},_0x1ae8a6,_0x4c92b2[_0x63b5('0xb9')]);return _0x3c86d6[_0x63b5('0xc4')](_0x1ae8a6);}})[_0x63b5('0x20')](function(_0x537fe5){if(_0x537fe5){_0x6d310b=_0x537fe5[_0x63b5('0x50')];if(!_0x4c92b2[_0x63b5('0x4b')][_0x63b5('0x51')]('nolimit')){_0x1ae8a6[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x4c92b2[_0x63b5('0x4b')][_0x63b5('0x52')]);_0x1ae8a6[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x4c92b2[_0x63b5('0x4b')][_0x63b5('0x2f')]);}return _0x3c86d6['getGroups'](_0x1ae8a6);}})['then'](function(_0x8b52d2){if(_0x8b52d2){return _0x8b52d2?{'count':_0x6d310b,'rows':_0x8b52d2}:null;}})[_0x63b5('0x20')](respondWithResult(_0xc2ae26,null))['catch'](handleError(_0xc2ae26,null));};exports['getRecordings']=function(_0x4fe105,_0x4e1b5e,_0x4152a0){var _0x28f9f7={'raw':!![],'where':{}};var _0x5c4ebc={};var _0x1301f5={'count':0x0,'rows':[]};return db['User'][_0x63b5('0x8e')]({'where':{'id':_0x4fe105[_0x63b5('0x61')]['id']}})['then'](handleEntityNotFound(_0x4e1b5e,null))[_0x63b5('0x20')](function(_0x76c642){if(_0x76c642){_0x5c4ebc['model']=_['keys'](db[_0x63b5('0xc6')][_0x63b5('0x47')]);_0x5c4ebc[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x4fe105['query']);_0x5c4ebc[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x5c4ebc[_0x63b5('0x4d')],_0x5c4ebc[_0x63b5('0x4b')]);_0x28f9f7[_0x63b5('0x4f')]=_[_0x63b5('0x4c')](_0x5c4ebc[_0x63b5('0x4d')],qs['fields'](_0x4fe105[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x28f9f7['attributes']=_0x28f9f7['attributes'][_0x63b5('0x50')]?_0x28f9f7[_0x63b5('0x4f')]:_0x5c4ebc['model'];if(!_0x4fe105['query'][_0x63b5('0x51')](_0x63b5('0xbe'))){_0x28f9f7[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x4fe105[_0x63b5('0x4b')]['limit']);_0x28f9f7[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x4fe105[_0x63b5('0x4b')]['offset']);}_0x28f9f7[_0x63b5('0xc1')]=qs[_0x63b5('0x53')](_0x4fe105[_0x63b5('0x4b')]['sort']);_0x28f9f7[_0x63b5('0x54')]=qs[_0x63b5('0x55')](_[_0x63b5('0x56')](_0x4fe105[_0x63b5('0x4b')],_0x5c4ebc['filters']));_0x28f9f7['where'][_0x63b5('0xc7')]=_0x76c642['id'];if(_0x4fe105['query'][_0x63b5('0x3c')]){_0x28f9f7[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x28f9f7[_0x63b5('0x54')],{'$or':_['map'](_0x28f9f7[_0x63b5('0x4f')],function(_0x47bfff){var _0x2b1e20={};_0x2b1e20[_0x47bfff]={'$like':'%'+_0x4fe105[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%'};return _0x2b1e20;})});}_0x28f9f7=_['merge']({},_0x28f9f7,_0x4fe105[_0x63b5('0xb9')]);return db[_0x63b5('0xc6')][_0x63b5('0x2e')]({'where':_0x28f9f7[_0x63b5('0x54')]})[_0x63b5('0x20')](function(_0x4c1fe8){_0x1301f5[_0x63b5('0x2e')]=_0x4c1fe8;if(_0x4fe105[_0x63b5('0x4b')]['includeAll']){_0x28f9f7[_0x63b5('0x5e')]=[{'all':!![]}];}return db[_0x63b5('0xc6')][_0x63b5('0x5f')](_0x28f9f7);})['then'](function(_0x389e82){_0x1301f5['rows']=_0x389e82;return _0x1301f5;});}})[_0x63b5('0x20')](respondWithFilteredResult(_0x4e1b5e,_0x28f9f7))[_0x63b5('0x29')](handleError(_0x4e1b5e,null));};exports['getScreenRecordings']=function(_0x1f888b,_0x512f55,_0x21db83){var _0x3a0cfa={'raw':!![],'where':{}};var _0x2e9043={};var _0x4a85db={'count':0x0,'rows':[]};return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x1f888b[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x512f55,null))[_0x63b5('0x20')](function(_0x48e100){if(_0x48e100){_0x2e9043[_0x63b5('0x4d')]=_[_0x63b5('0x62')](db['ScreenRecording'][_0x63b5('0x47')]);_0x2e9043[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x1f888b[_0x63b5('0x4b')]);_0x2e9043[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x2e9043[_0x63b5('0x4d')],_0x2e9043[_0x63b5('0x4b')]);_0x3a0cfa[_0x63b5('0x4f')]=_['intersection'](_0x2e9043['model'],qs[_0x63b5('0x4e')](_0x1f888b[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x3a0cfa[_0x63b5('0x4f')]=_0x3a0cfa[_0x63b5('0x4f')]['length']?_0x3a0cfa[_0x63b5('0x4f')]:_0x2e9043[_0x63b5('0x4d')];if(!_0x1f888b[_0x63b5('0x4b')][_0x63b5('0x51')](_0x63b5('0xbe'))){_0x3a0cfa[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x1f888b[_0x63b5('0x4b')]['limit']);_0x3a0cfa[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x1f888b[_0x63b5('0x4b')][_0x63b5('0x2f')]);}_0x3a0cfa['order']=qs[_0x63b5('0x53')](_0x1f888b[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x3a0cfa['where']=qs['filters'](_[_0x63b5('0x56')](_0x1f888b[_0x63b5('0x4b')],_0x2e9043[_0x63b5('0x55')]));_0x3a0cfa[_0x63b5('0x54')][_0x63b5('0xc7')]=_0x48e100['id'];if(_0x1f888b[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0x3a0cfa[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x3a0cfa['where'],{'$or':_[_0x63b5('0x3e')](_0x3a0cfa[_0x63b5('0x4f')],function(_0x277c0f){var _0x42985d={};_0x42985d[_0x277c0f]={'$like':'%'+_0x1f888b['query'][_0x63b5('0x3c')]+'%'};return _0x42985d;})});}_0x3a0cfa=_[_0x63b5('0x5c')]({},_0x3a0cfa,_0x1f888b['options']);return db[_0x63b5('0xc8')][_0x63b5('0x2e')]({'where':_0x3a0cfa[_0x63b5('0x54')]})[_0x63b5('0x20')](function(_0x7d2299){_0x4a85db[_0x63b5('0x2e')]=_0x7d2299;if(_0x1f888b[_0x63b5('0x4b')][_0x63b5('0x5d')]){_0x3a0cfa[_0x63b5('0x5e')]=[{'all':!![]}];}return db[_0x63b5('0xc8')][_0x63b5('0x5f')](_0x3a0cfa);})['then'](function(_0x3f2111){_0x4a85db[_0x63b5('0xc9')]=_0x3f2111;return _0x4a85db;});}})[_0x63b5('0x20')](respondWithFilteredResult(_0x512f55,_0x3a0cfa))[_0x63b5('0x29')](handleError(_0x512f55,null));};exports['getChatInteractions']=function(_0x15ab06,_0xce4f23,_0x37bceb){var _0x121843={};var _0x41640d={};var _0x114805;var _0x1700e8;return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x15ab06[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0xce4f23,null))[_0x63b5('0x20')](function(_0x1ca944){if(_0x1ca944){_0x114805=_0x1ca944;_0x41640d[_0x63b5('0x4d')]=_[_0x63b5('0x62')](db[_0x63b5('0xca')]['rawAttributes']);_0x41640d[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x15ab06[_0x63b5('0x4b')]);_0x41640d[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x41640d[_0x63b5('0x4d')],_0x41640d[_0x63b5('0x4b')]);_0x121843['attributes']=_[_0x63b5('0x4c')](_0x41640d[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x15ab06['query']['fields']));_0x121843[_0x63b5('0x4f')]=_0x121843['attributes'][_0x63b5('0x50')]?_0x121843[_0x63b5('0x4f')]:_0x41640d[_0x63b5('0x4d')];_0x121843['order']=qs['sort'](_0x15ab06[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x121843[_0x63b5('0x54')]=qs['filters'](_[_0x63b5('0x56')](_0x15ab06[_0x63b5('0x4b')],_0x41640d[_0x63b5('0x55')]));if(_0x15ab06[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0x121843[_0x63b5('0x54')]=_['merge'](_0x121843[_0x63b5('0x54')],{'$or':_[_0x63b5('0x3e')](_0x121843[_0x63b5('0x4f')],function(_0x35808e){var _0x2956cd={};_0x2956cd[_0x35808e]={'$like':'%'+_0x15ab06['query'][_0x63b5('0x3c')]+'%'};return _0x2956cd;})});}_0x121843=_[_0x63b5('0x5c')]({},_0x121843,_0x15ab06[_0x63b5('0xb9')]);return _0x114805[_0x63b5('0xcb')](_0x121843);}})[_0x63b5('0x20')](function(_0x5a9e52){if(_0x5a9e52){_0x1700e8=_0x5a9e52['length'];if(!_0x15ab06[_0x63b5('0x4b')]['hasOwnProperty'](_0x63b5('0xbe'))){_0x121843[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x15ab06[_0x63b5('0x4b')]['limit']);_0x121843[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x15ab06[_0x63b5('0x4b')]['offset']);}return _0x114805[_0x63b5('0xcb')](_0x121843);}})['then'](function(_0x3875ed){if(_0x3875ed){return _0x3875ed?{'count':_0x1700e8,'rows':_0x3875ed}:null;}})[_0x63b5('0x20')](respondWithResult(_0xce4f23,null))['catch'](handleError(_0xce4f23,null));};exports[_0x63b5('0xcc')]=function(_0x26ca55,_0xd8aeb4,_0x56f73e){var _0x223dc5={};var _0x496f78={};var _0x36928a;var _0x230ad0;return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x26ca55[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0xd8aeb4,null))[_0x63b5('0x20')](function(_0x5c14c1){if(_0x5c14c1){_0x36928a=_0x5c14c1;_0x496f78[_0x63b5('0x4d')]=_[_0x63b5('0x62')](db['OpenchannelInteraction'][_0x63b5('0x47')]);_0x496f78[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x26ca55['query']);_0x496f78[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x496f78[_0x63b5('0x4d')],_0x496f78[_0x63b5('0x4b')]);_0x223dc5[_0x63b5('0x4f')]=_[_0x63b5('0x4c')](_0x496f78[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x26ca55[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x223dc5['attributes']=_0x223dc5[_0x63b5('0x4f')][_0x63b5('0x50')]?_0x223dc5[_0x63b5('0x4f')]:_0x496f78['model'];_0x223dc5[_0x63b5('0xc1')]=qs[_0x63b5('0x53')](_0x26ca55[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x223dc5[_0x63b5('0x54')]=qs['filters'](_[_0x63b5('0x56')](_0x26ca55[_0x63b5('0x4b')],_0x496f78[_0x63b5('0x55')]));if(_0x26ca55[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0x223dc5[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x223dc5['where'],{'$or':_[_0x63b5('0x3e')](_0x223dc5[_0x63b5('0x4f')],function(_0x445d62){var _0x2bba5={};_0x2bba5[_0x445d62]={'$like':'%'+_0x26ca55[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%'};return _0x2bba5;})});}_0x223dc5=_[_0x63b5('0x5c')]({},_0x223dc5,_0x26ca55[_0x63b5('0xb9')]);return _0x36928a[_0x63b5('0xcc')](_0x223dc5);}})[_0x63b5('0x20')](function(_0x54136e){if(_0x54136e){_0x230ad0=_0x54136e[_0x63b5('0x50')];if(!_0x26ca55[_0x63b5('0x4b')]['hasOwnProperty'](_0x63b5('0xbe'))){_0x223dc5['limit']=qs[_0x63b5('0x52')](_0x26ca55[_0x63b5('0x4b')][_0x63b5('0x52')]);_0x223dc5[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x26ca55[_0x63b5('0x4b')][_0x63b5('0x2f')]);}return _0x36928a[_0x63b5('0xcc')](_0x223dc5);}})[_0x63b5('0x20')](function(_0x522650){if(_0x522650){return _0x522650?{'count':_0x230ad0,'rows':_0x522650}:null;}})[_0x63b5('0x20')](respondWithResult(_0xd8aeb4,null))[_0x63b5('0x29')](handleError(_0xd8aeb4,null));};exports[_0x63b5('0xcd')]=function(_0x2331ca,_0x6633bc,_0x1d0811){var _0x2d73de={'raw':!![],'where':{}};var _0x44e5ff={};var _0x300c9d={'count':0x0,'rows':[]};return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x2331ca[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x6633bc,null))['then'](function(_0x3d5ab0){if(_0x3d5ab0){_0x44e5ff[_0x63b5('0x4d')]=_[_0x63b5('0x62')](db[_0x63b5('0xce')][_0x63b5('0x47')]);_0x44e5ff['query']=_[_0x63b5('0x62')](_0x2331ca[_0x63b5('0x4b')]);_0x44e5ff['filters']=_[_0x63b5('0x4c')](_0x44e5ff[_0x63b5('0x4d')],_0x44e5ff[_0x63b5('0x4b')]);_0x2d73de[_0x63b5('0x4f')]=_['intersection'](_0x44e5ff[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x2331ca[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x2d73de[_0x63b5('0x4f')]=_0x2d73de[_0x63b5('0x4f')][_0x63b5('0x50')]?_0x2d73de[_0x63b5('0x4f')]:_0x44e5ff[_0x63b5('0x4d')];if(!_0x2331ca[_0x63b5('0x4b')][_0x63b5('0x51')](_0x63b5('0xbe'))){_0x2d73de[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x2331ca[_0x63b5('0x4b')][_0x63b5('0x52')]);_0x2d73de[_0x63b5('0x2f')]=qs['offset'](_0x2331ca[_0x63b5('0x4b')][_0x63b5('0x2f')]);}_0x2d73de[_0x63b5('0xc1')]=qs[_0x63b5('0x53')](_0x2331ca['query']['sort']);_0x2d73de[_0x63b5('0x54')]=qs[_0x63b5('0x55')](_[_0x63b5('0x56')](_0x2331ca[_0x63b5('0x4b')],_0x44e5ff[_0x63b5('0x55')]));_0x2d73de['where']['UserId']=_0x3d5ab0['id'];if(_0x2331ca[_0x63b5('0x4b')]['filter']){_0x2d73de[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x2d73de[_0x63b5('0x54')],{'$or':_[_0x63b5('0x3e')](_0x2d73de['attributes'],function(_0x3ec99e){var _0x3a2cec={};_0x3a2cec[_0x3ec99e]={'$like':'%'+_0x2331ca[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%'};return _0x3a2cec;})});}_0x2d73de=_[_0x63b5('0x5c')]({},_0x2d73de,_0x2331ca[_0x63b5('0xb9')]);return db['MailInteraction'][_0x63b5('0x2e')]({'where':_0x2d73de[_0x63b5('0x54')]})['then'](function(_0x4c4455){_0x300c9d['count']=_0x4c4455;if(_0x2331ca[_0x63b5('0x4b')][_0x63b5('0x5d')]){_0x2d73de['include']=[{'all':!![]}];}return db[_0x63b5('0xce')][_0x63b5('0x5f')](_0x2d73de);})[_0x63b5('0x20')](function(_0x302829){_0x300c9d[_0x63b5('0xc9')]=_0x302829;return _0x300c9d;});}})[_0x63b5('0x20')](respondWithFilteredResult(_0x6633bc,_0x2d73de))['catch'](handleError(_0x6633bc,null));};exports[_0x63b5('0xcf')]=function(_0x21fd7f,_0x36c357,_0x52de40){var _0xe1393c={};var _0x5f2d49={};var _0x4f8fb3;var _0x2801f1;return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x21fd7f[_0x63b5('0x61')]['id']}})['then'](handleEntityNotFound(_0x36c357,null))['then'](function(_0x3b8509){if(_0x3b8509){_0x4f8fb3=_0x3b8509;_0x5f2d49[_0x63b5('0x4d')]=_['keys'](db[_0x63b5('0xd0')][_0x63b5('0x47')]);_0x5f2d49[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x21fd7f['query']);_0x5f2d49[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x5f2d49[_0x63b5('0x4d')],_0x5f2d49[_0x63b5('0x4b')]);_0xe1393c[_0x63b5('0x4f')]=_[_0x63b5('0x4c')](_0x5f2d49[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x21fd7f[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0xe1393c[_0x63b5('0x4f')]=_0xe1393c[_0x63b5('0x4f')][_0x63b5('0x50')]?_0xe1393c[_0x63b5('0x4f')]:_0x5f2d49[_0x63b5('0x4d')];_0xe1393c['order']=qs[_0x63b5('0x53')](_0x21fd7f[_0x63b5('0x4b')][_0x63b5('0x53')]);_0xe1393c[_0x63b5('0x54')]=qs['filters'](_['pick'](_0x21fd7f[_0x63b5('0x4b')],_0x5f2d49[_0x63b5('0x55')]));if(_0x21fd7f[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0xe1393c[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0xe1393c[_0x63b5('0x54')],{'$or':_['map'](_0xe1393c[_0x63b5('0x4f')],function(_0x5c8616){var _0x3efd8b={};_0x3efd8b[_0x5c8616]={'$like':'%'+_0x21fd7f[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%'};return _0x3efd8b;})});}_0xe1393c=_[_0x63b5('0x5c')]({},_0xe1393c,_0x21fd7f['options']);return _0x4f8fb3[_0x63b5('0xcf')](_0xe1393c);}})[_0x63b5('0x20')](function(_0x37eb5f){if(_0x37eb5f){_0x2801f1=_0x37eb5f[_0x63b5('0x50')];if(!_0x21fd7f[_0x63b5('0x4b')][_0x63b5('0x51')]('nolimit')){_0xe1393c[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x21fd7f[_0x63b5('0x4b')][_0x63b5('0x52')]);_0xe1393c[_0x63b5('0x2f')]=qs['offset'](_0x21fd7f[_0x63b5('0x4b')][_0x63b5('0x2f')]);}return _0x4f8fb3['getSmsInteractions'](_0xe1393c);}})[_0x63b5('0x20')](function(_0x24f08b){if(_0x24f08b){return _0x24f08b?{'count':_0x2801f1,'rows':_0x24f08b}:null;}})['then'](respondWithResult(_0x36c357,null))['catch'](handleError(_0x36c357,null));};exports[_0x63b5('0xd1')]=function(_0x568606,_0x177467,_0xfc7d30){var _0x13855d={};var _0x127f35={};var _0xbcf8cb;var _0x11c096;return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x568606[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x177467,null))[_0x63b5('0x20')](function(_0xd50d33){if(_0xd50d33){_0xbcf8cb=_0xd50d33;_0x127f35['model']=_[_0x63b5('0x62')](db['FaxInteraction'][_0x63b5('0x47')]);_0x127f35['query']=_['keys'](_0x568606[_0x63b5('0x4b')]);_0x127f35[_0x63b5('0x55')]=_['intersection'](_0x127f35[_0x63b5('0x4d')],_0x127f35[_0x63b5('0x4b')]);_0x13855d['attributes']=_[_0x63b5('0x4c')](_0x127f35[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x568606[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x13855d['attributes']=_0x13855d[_0x63b5('0x4f')][_0x63b5('0x50')]?_0x13855d[_0x63b5('0x4f')]:_0x127f35[_0x63b5('0x4d')];_0x13855d['order']=qs[_0x63b5('0x53')](_0x568606[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x13855d[_0x63b5('0x54')]=qs[_0x63b5('0x55')](_['pick'](_0x568606[_0x63b5('0x4b')],_0x127f35[_0x63b5('0x55')]));if(_0x568606[_0x63b5('0x4b')]['filter']){_0x13855d[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x13855d['where'],{'$or':_[_0x63b5('0x3e')](_0x13855d[_0x63b5('0x4f')],function(_0x59266f){var _0x3a6326={};_0x3a6326[_0x59266f]={'$like':'%'+_0x568606['query'][_0x63b5('0x3c')]+'%'};return _0x3a6326;})});}_0x13855d=_[_0x63b5('0x5c')]({},_0x13855d,_0x568606[_0x63b5('0xb9')]);return _0xbcf8cb[_0x63b5('0xd1')](_0x13855d);}})[_0x63b5('0x20')](function(_0x411134){if(_0x411134){_0x11c096=_0x411134[_0x63b5('0x50')];if(!_0x568606['query'][_0x63b5('0x51')]('nolimit')){_0x13855d[_0x63b5('0x52')]=qs['limit'](_0x568606[_0x63b5('0x4b')]['limit']);_0x13855d['offset']=qs[_0x63b5('0x2f')](_0x568606[_0x63b5('0x4b')]['offset']);}return _0xbcf8cb[_0x63b5('0xd1')](_0x13855d);}})[_0x63b5('0x20')](function(_0x4cb5e8){if(_0x4cb5e8){return _0x4cb5e8?{'count':_0x11c096,'rows':_0x4cb5e8}:null;}})[_0x63b5('0x20')](respondWithResult(_0x177467,null))[_0x63b5('0x29')](handleError(_0x177467,null));};exports[_0x63b5('0xd2')]=function(_0x289df3,_0x2a5daf,_0xa9132c){var _0x36fc3a={};var _0x1c8900={};var _0x1070cf;var _0x5b11d1;return db['User'][_0x63b5('0x8e')]({'where':{'id':_0x289df3[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x2a5daf,null))['then'](function(_0x30636a){if(_0x30636a){_0x1070cf=_0x30636a;_0x1c8900['model']=_[_0x63b5('0x62')](db[_0x63b5('0xd3')][_0x63b5('0x47')]);_0x1c8900[_0x63b5('0x4b')]=_['keys'](_0x289df3[_0x63b5('0x4b')]);_0x1c8900[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x1c8900[_0x63b5('0x4d')],_0x1c8900['query']);_0x36fc3a[_0x63b5('0x4f')]=_[_0x63b5('0x4c')](_0x1c8900[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x289df3[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x36fc3a['attributes']=_0x36fc3a[_0x63b5('0x4f')]['length']?_0x36fc3a[_0x63b5('0x4f')]:_0x1c8900[_0x63b5('0x4d')];_0x36fc3a['order']=qs[_0x63b5('0x53')](_0x289df3[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x36fc3a[_0x63b5('0x54')]=qs['filters'](_[_0x63b5('0x56')](_0x289df3[_0x63b5('0x4b')],_0x1c8900['filters']));if(_0x289df3[_0x63b5('0x4b')]['filter']){_0x36fc3a['where']=_[_0x63b5('0x5c')](_0x36fc3a[_0x63b5('0x54')],{'$or':_[_0x63b5('0x3e')](_0x36fc3a[_0x63b5('0x4f')],function(_0x504b66){var _0xd53b74={};_0xd53b74[_0x504b66]={'$like':'%'+_0x289df3['query'][_0x63b5('0x3c')]+'%'};return _0xd53b74;})});}_0x36fc3a=_[_0x63b5('0x5c')]({},_0x36fc3a,_0x289df3[_0x63b5('0xb9')]);return _0x1070cf[_0x63b5('0xd2')](_0x36fc3a);}})[_0x63b5('0x20')](function(_0x564abd){if(_0x564abd){_0x5b11d1=_0x564abd[_0x63b5('0x50')];if(!_0x289df3[_0x63b5('0x4b')][_0x63b5('0x51')](_0x63b5('0xbe'))){_0x36fc3a[_0x63b5('0x52')]=qs['limit'](_0x289df3[_0x63b5('0x4b')]['limit']);_0x36fc3a[_0x63b5('0x2f')]=qs['offset'](_0x289df3['query'][_0x63b5('0x2f')]);}return _0x1070cf[_0x63b5('0xd2')](_0x36fc3a);}})[_0x63b5('0x20')](function(_0x10c172){if(_0x10c172){return _0x10c172?{'count':_0x5b11d1,'rows':_0x10c172}:null;}})[_0x63b5('0x20')](respondWithResult(_0x2a5daf,null))[_0x63b5('0x29')](handleError(_0x2a5daf,null));};exports[_0x63b5('0xd4')]=function(_0x37bf2f,_0x181a8e,_0x155c2e){var _0x58ed2f;var _0x5c64d4;var _0x437289;var _0x2b9e5e=!_[_0x63b5('0x6d')](_0x37bf2f[_0x63b5('0x61')]['id'])?_0x37bf2f[_0x63b5('0x61')]['id']:!_[_0x63b5('0x6d')](_0x37bf2f[_0x63b5('0x37')]['id'])?_0x37bf2f[_0x63b5('0x37')]['id']:null;return db[_0x63b5('0x46')]['find']({'where':{'id':_0x2b9e5e,'role':{'$or':['admin',_0x63b5('0x37'),_0x63b5('0x39')]}},'attributes':['id',_0x63b5('0x45'),'phone',_0x63b5('0xd5'),_0x63b5('0x42'),'internal','loginInPause']})[_0x63b5('0x20')](function(_0x2aa3eb){if(_0x2aa3eb){if(_0x2aa3eb[_0x63b5('0x42')]===_0x63b5('0x39')){_0x58ed2f=_0x2aa3eb;if(_0x37bf2f[_0x63b5('0x65')]['interface']){_0x437289=util[_0x63b5('0x6e')](_0x63b5('0xd6'),_0x58ed2f[_0x37bf2f[_0x63b5('0x65')][_0x63b5('0x98')]]);}else if(_0x37bf2f['body'][_0x63b5('0xd7')]){_0x437289=util[_0x63b5('0x6e')]('SIP/%s',_0x37bf2f[_0x63b5('0x65')]['intrf']);}else{_0x437289=util[_0x63b5('0x6e')]('SIP/%s',_0x58ed2f[_0x63b5('0x45')]);}socket['to'](util[_0x63b5('0x6e')](_0x63b5('0xd8'),_0x58ed2f[_0x63b5('0x45')]))[_0x63b5('0xa1')](_0x63b5('0xd9'),{'ip':_0x37bf2f[_0x63b5('0xda')][_0x63b5('0xdb')]||_0x37bf2f[_0x63b5('0xdc')][_0x63b5('0xdd')]||_0x37bf2f[_0x63b5('0xde')][_0x63b5('0xdd')]||_0x37bf2f['connection'][_0x63b5('0xde')][_0x63b5('0xdd')]});return db[_0x63b5('0xa8')][_0x63b5('0x34')]({'where':{'membername':_0x58ed2f[_0x63b5('0x45')]},'individualHooks':!![]});}}else{throw new db[(_0x63b5('0x1c'))][(_0x63b5('0x1d'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x63b5('0x20')](function(){if(_0x58ed2f){return _0x58ed2f[_0x63b5('0xdf')]({'raw':!![]});}})[_0x63b5('0x20')](function(_0x237778){if(_0x58ed2f){var _0x171f40=[];if(_0x237778){_0x5c64d4=_0x237778;if(_0x5c64d4[_0x63b5('0x50')]){for(var _0x542e72=0x0;_0x542e72<_0x5c64d4[_0x63b5('0x50')];_0x542e72++){_0x171f40[_0x63b5('0xa5')]({'membername':_0x58ed2f[_0x63b5('0x45')],'UserId':_0x58ed2f['id'],'queue_name':_0x5c64d4[_0x542e72][_0x63b5('0x45')],'VoiceQueueId':_0x5c64d4[_0x542e72]['id'],'interface':_0x437289,'paused':_0x58ed2f[_0x63b5('0x96')]||![],'penalty':_0x5c64d4[_0x542e72]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x63b5('0xa7')](_0x171f40,function(_0x798334){return db[_0x63b5('0xa8')]['upsert'](_0x798334);});}}}})['then'](function(){if(_0x58ed2f){return db[_0x63b5('0xe0')][_0x63b5('0x5f')]({'where':{'membername':_0x58ed2f[_0x63b5('0x45')],'exitAt':null}});}})[_0x63b5('0x20')](function(_0x26fa0f){if(_0x58ed2f){var _0x50c572=[];_0x26fa0f[_0x63b5('0xe1')](function(_0x2d55d0){_0x50c572[_0x63b5('0xa5')](_0x2d55d0['update']({'exitAt':moment()[_0x63b5('0x6e')](_0x63b5('0xe2'))}));});return BPromise[_0x63b5('0xe3')](_0x50c572);}})[_0x63b5('0x20')](function(){if(_0x58ed2f){var _0x50dfb8=[];var _0x43f0bf=[];var _0x4eb4c6=utils[_0x63b5('0xe4')]();var _0x5542b8={'membername':_0x58ed2f[_0x63b5('0x45')],'interface':_0x437289,'enterAt':moment()['format'](_0x63b5('0xe2')),'role':_0x58ed2f[_0x63b5('0x42')],'internal':_0x58ed2f[_0x63b5('0x71')]};_0x4eb4c6[_0x63b5('0xe1')](function(_0x2dd692){_0x50dfb8[_0x63b5('0xa5')](_['merge']({'channel':_0x2dd692,'type':_0x63b5('0xe5'),'data1':_0x37bf2f[_0x63b5('0x65')][_0x63b5('0xe6')],'data2':_0x437289},_0x5542b8));if(_0x58ed2f[_0x63b5('0x96')]){_0x43f0bf[_0x63b5('0xa5')](_[_0x63b5('0x5c')]({'channel':_0x2dd692,'type':_0x63b5('0xe7'),'data1':_0x63b5('0xe8')},_0x5542b8));}});return db[_0x63b5('0xe0')][_0x63b5('0x64')](_0x50dfb8['concat'](_0x43f0bf),{'individualHooks':!![]});}})[_0x63b5('0x20')](function(){if(_0x58ed2f){return _0x58ed2f[_0x63b5('0x33')]({'online':!![],'lastLoginAt':moment()['format'](_0x63b5('0xe2')),'voicePause':_0x58ed2f['loginInPause']||![],'mailPause':_0x58ed2f[_0x63b5('0x96')]||![],'chatPause':_0x58ed2f[_0x63b5('0x96')]||![],'faxPause':_0x58ed2f[_0x63b5('0x96')]||![],'smsPause':_0x58ed2f[_0x63b5('0x96')]||![],'openchannelPause':_0x58ed2f[_0x63b5('0x96')]||![],'whatsappPause':_0x58ed2f[_0x63b5('0x96')]||![],'pauseType':_0x58ed2f[_0x63b5('0x96')]?'LOGININPAUSE':null,'interface':_0x437289,'lastPauseAt':moment()['format'](_0x63b5('0xe2'))});}})[_0x63b5('0x20')](function(_0x6528f2){if(_0x37bf2f[_0x63b5('0xe9')]){return _0x155c2e();}else{return BPromise['resolve'](_0x6528f2)[_0x63b5('0x20')](respondWithResult(_0x181a8e,null));}})[_0x63b5('0x29')](handleError(_0x181a8e,null));};exports[_0x63b5('0xea')]=function(_0x3f9d53,_0x375262,_0x2cc280){var _0x19c317;return db['User']['find']({'where':{'id':_0x3f9d53[_0x63b5('0x61')]['id'],'role':_0x63b5('0x39')},'attributes':['id',_0x63b5('0x45'),_0x63b5('0x42')]})[_0x63b5('0x20')](handleEntityNotFound(_0x375262,null))['then'](function(_0x20b7ed){if(_0x20b7ed){_0x19c317=_0x20b7ed;return db[_0x63b5('0xa8')][_0x63b5('0x34')]({'where':{'membername':_0x19c317[_0x63b5('0x45')]},'individualHooks':!![]});}})['then'](function(){return db[_0x63b5('0xe0')][_0x63b5('0x5f')]({'where':{'membername':_0x19c317[_0x63b5('0x45')],'exitAt':null}});})[_0x63b5('0x20')](function(_0x59ade5){var _0x1931df=[];_0x59ade5['forEach'](function(_0x40e890){_0x1931df[_0x63b5('0xa5')](_0x40e890[_0x63b5('0x33')]({'exitAt':moment()[_0x63b5('0x6e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x63b5('0xe3')](_0x1931df);})[_0x63b5('0x20')](function(){return _0x19c317[_0x63b5('0x33')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x375262,null))[_0x63b5('0x29')](handleError(_0x375262,null));};exports[_0x63b5('0xeb')]=function(_0x4a17d8,_0x43b3df,_0x53d72e){var _0x216e46;return db['UserVoiceQueueRt'][_0x63b5('0x33')]({'paused':0x1},{'where':{'UserId':_0x4a17d8['params']['id']},'individualHooks':!![]})[_0x63b5('0x20')](function(){return db['User'][_0x63b5('0x41')]({'where':{'id':_0x4a17d8[_0x63b5('0x61')]['id'],'role':_0x63b5('0x39')},'attributes':['id','name',_0x63b5('0x42'),_0x63b5('0x71'),_0x63b5('0x98')]});})[_0x63b5('0x20')](handleEntityNotFound(_0x43b3df,null))[_0x63b5('0x20')](function(_0x3c3f96){if(_0x3c3f96){_0x216e46=_0x3c3f96;return respondWithRpcPromise('QueuePause','pause',{'id':_0x216e46['id'],'name':_0x216e46[_0x63b5('0x45')],'pause':!![]});}})[_0x63b5('0x20')](function(){if(_0x216e46){return db[_0x63b5('0xe0')]['findAll']({'where':{'membername':_0x216e46['name'],'type':'PAUSE','exitAt':null}});}})[_0x63b5('0x20')](function(_0x3fd335){if(_0x3fd335['length']){var _0x327600=moment()[_0x63b5('0x6e')](_0x63b5('0xe2'));for(var _0x114c36=0x0,_0x1c3fa1=_0x3fd335[_0x63b5('0x50')];_0x114c36<_0x1c3fa1;_0x114c36++){_0x3fd335[_0x114c36][_0x63b5('0xec')]({'exitAt':_0x327600});}}})['then'](function(){var _0x55975b=[];var _0x1ec33f=utils[_0x63b5('0xe4')]();_0x1ec33f[_0x63b5('0xe1')](function(_0x36e79d){_0x55975b[_0x63b5('0xa5')]({'channel':_0x36e79d,'membername':_0x216e46[_0x63b5('0x45')],'interface':_[_0x63b5('0x6d')](_0x216e46[_0x63b5('0x98')])?util[_0x63b5('0x6e')](_0x63b5('0xa6'),_0x216e46[_0x63b5('0x45')]):_0x216e46[_0x63b5('0x98')],'type':_0x63b5('0xe7'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4a17d8[_0x63b5('0x65')][_0x63b5('0x57')]||'DEFAULT\x20PAUSE','role':_0x216e46['role'],'internal':_0x216e46[_0x63b5('0x71')]});});return db['MemberReport'][_0x63b5('0x64')](_0x55975b,{'individualHooks':!![]});})['then'](function(){return _0x216e46[_0x63b5('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4a17d8['body'][_0x63b5('0x57')]||_0x63b5('0xed'),'lastPauseAt':moment()[_0x63b5('0x6e')](_0x63b5('0xe2'))});})['then'](respondWithResult(_0x43b3df,null))['catch'](handleError(_0x43b3df,null));};exports[_0x63b5('0xee')]=function(_0x23dcc0,_0x22c702,_0x4931a3){var _0x23c038;return db['User'][_0x63b5('0x41')]({'where':{'id':_0x23dcc0[_0x63b5('0x61')]['id']},'attributes':['id',_0x63b5('0x45'),_0x63b5('0x42'),_0x63b5('0x97'),_0x63b5('0xef'),_0x63b5('0xf0'),_0x63b5('0xf1'),_0x63b5('0xf2'),_0x63b5('0xf3'),_0x63b5('0xf4'),_0x63b5('0xf5'),_0x63b5('0xf6')]})['then'](handleEntityNotFound(_0x22c702,null))['then'](function(_0x3fe8e5){if(_0x3fe8e5){_0x23c038=_0x3fe8e5;if(_0x23dcc0[_0x63b5('0x65')][_0x63b5('0xab')]&&!utils[_0x63b5('0x99')](_0x23dcc0[_0x63b5('0x65')][_0x63b5('0xab')])){throw new db['Sequelize'][(_0x63b5('0x1d'))](_0x63b5('0x9a'));}switch(_0x23dcc0[_0x63b5('0x65')][_0x63b5('0xab')]){case _0x63b5('0xa3'):return respondWithRpcPromise(_0x63b5('0xf7'),'unpause',{'id':_0x23c038['id'],'name':_0x23c038['name'],'pause':![]})[_0x63b5('0x20')](function(){return db[_0x63b5('0xa8')][_0x63b5('0x33')]({'paused':0x0},{'where':{'UserId':_0x23c038['id']},'individualHooks':!![]});})['then'](function(){return db[_0x63b5('0xe0')][_0x63b5('0x41')]({'where':{'channel':_0x23dcc0['body'][_0x63b5('0xab')],'membername':_0x23c038['name'],'type':_0x63b5('0xe7'),'exitAt':null}});})['then'](function(_0x189bc1){if(_0x189bc1){return _0x189bc1[_0x63b5('0x33')]({'exitAt':moment()[_0x63b5('0x6e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x63b5('0xf8')},{'individualHooks':!![]});}return null;})[_0x63b5('0x20')](function(){return _0x23c038[_0x63b5('0x33')]({'voicePause':![]});});case _0x63b5('0xf9'):case'chat':case _0x63b5('0xfa'):case'sms':case _0x63b5('0xfb'):case _0x63b5('0xfc'):return db['MemberReport']['find']({'where':{'channel':_0x23dcc0[_0x63b5('0x65')]['channel'],'membername':_0x23c038[_0x63b5('0x45')],'type':_0x63b5('0xe7'),'exitAt':null}})[_0x63b5('0x20')](function(_0x4191da){if(_0x4191da){return _0x4191da[_0x63b5('0x33')]({'exitAt':moment()[_0x63b5('0x6e')](_0x63b5('0xe2')),'data2':_0x63b5('0xf8')},{'individualHooks':!![]});}return null;})[_0x63b5('0x20')](function(){var _0x249dd4={};_[_0x63b5('0xfd')](_0x249dd4,util[_0x63b5('0x6e')](_0x63b5('0xfe'),_0x23dcc0[_0x63b5('0x65')]['channel'],_0x63b5('0xff')),![]);return _0x23c038[_0x63b5('0x33')](_0x249dd4);});default:return respondWithRpcPromise(_0x63b5('0xf7'),_0x63b5('0xee'),{'id':_0x23c038['id'],'name':_0x23c038[_0x63b5('0x45')],'pause':![]})[_0x63b5('0x20')](function(){return db[_0x63b5('0xa8')][_0x63b5('0x33')]({'paused':0x0},{'where':{'UserId':_0x23c038['id']}});})[_0x63b5('0x20')](function(){return db[_0x63b5('0xe0')][_0x63b5('0x5f')]({'where':{'membername':_0x23c038[_0x63b5('0x45')],'type':_0x63b5('0xe7'),'exitAt':null}});})[_0x63b5('0x20')](function(_0x4ee4d2){var _0x4e3fa1=[];_0x4ee4d2[_0x63b5('0xe1')](function(_0x210a09){_0x4e3fa1[_0x63b5('0xa5')](_0x210a09[_0x63b5('0x33')]({'exitAt':moment()[_0x63b5('0x6e')](_0x63b5('0xe2')),'data2':'manual'}));});return BPromise[_0x63b5('0xe3')](_0x4e3fa1);})[_0x63b5('0x20')](function(){return _0x23c038[_0x63b5('0x33')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x63b5('0x20')](respondWithResult(_0x22c702,null))[_0x63b5('0x29')](handleError(_0x22c702,null));};exports['getTeams']=function(_0x249ea2,_0x4fb576,_0x260857){var _0x1edf97={};var _0x52bdbd={};var _0x4d3c40;var _0xbead3e;return db[_0x63b5('0x46')]['findOne']({'where':{'id':_0x249ea2[_0x63b5('0x61')]['id']}})['then'](handleEntityNotFound(_0x4fb576,null))[_0x63b5('0x20')](function(_0x3d0915){if(_0x3d0915){_0x4d3c40=_0x3d0915;_0x52bdbd['model']=_['keys'](db['Team'][_0x63b5('0x47')]);_0x52bdbd['query']=_[_0x63b5('0x62')](_0x249ea2['query']);_0x52bdbd[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x52bdbd[_0x63b5('0x4d')],_0x52bdbd['query']);_0x1edf97[_0x63b5('0x4f')]=_['intersection'](_0x52bdbd[_0x63b5('0x4d')],qs['fields'](_0x249ea2[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x1edf97['attributes']=_0x1edf97['attributes'][_0x63b5('0x50')]?_0x1edf97[_0x63b5('0x4f')]:_0x52bdbd['model'];_0x1edf97['order']=qs[_0x63b5('0x53')](_0x249ea2[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x1edf97['where']=qs[_0x63b5('0x55')](_['pick'](_0x249ea2[_0x63b5('0x4b')],_0x52bdbd[_0x63b5('0x55')]));if(_0x249ea2[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0x1edf97[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x1edf97['where'],{'$or':_[_0x63b5('0x3e')](_0x1edf97[_0x63b5('0x4f')],function(_0x5b1aa0){var _0x1c8f32={};_0x1c8f32[_0x5b1aa0]={'$like':'%'+_0x249ea2[_0x63b5('0x4b')]['filter']+'%'};return _0x1c8f32;})});}_0x1edf97=_[_0x63b5('0x5c')]({},_0x1edf97,_0x249ea2['options']);return _0x4d3c40['getTeams'](_0x1edf97);}})[_0x63b5('0x20')](function(_0x1d60b1){if(_0x1d60b1){_0xbead3e=_0x1d60b1[_0x63b5('0x50')];if(!_0x249ea2[_0x63b5('0x4b')][_0x63b5('0x51')]('nolimit')){_0x1edf97[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x249ea2['query'][_0x63b5('0x52')]);_0x1edf97[_0x63b5('0x2f')]=qs['offset'](_0x249ea2[_0x63b5('0x4b')]['offset']);}return _0x4d3c40[_0x63b5('0x100')](_0x1edf97);}})['then'](function(_0x476f9d){if(_0x476f9d){return _0x476f9d?{'count':_0xbead3e,'rows':_0x476f9d}:null;}})['then'](respondWithResult(_0x4fb576,null))[_0x63b5('0x29')](handleError(_0x4fb576,null));};exports['addTeams']=function(_0x305584,_0x5d4135){return db['User']['find']({'where':{'id':_0x305584[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x5d4135,null))[_0x63b5('0x20')](function(_0x57aeca){if(_0x57aeca){var _0x5adc5e=_0x57aeca[_0x63b5('0x35')]({'plain':!![]});return _0x57aeca[_0x63b5('0x101')](_0x305584['body'][_0x63b5('0x68')],_['omit'](_0x305584['body'],[_0x63b5('0x68'),'id'])||{})[_0x63b5('0x20')](function(){for(var _0x5e66b1=0x0;_0x5e66b1<_0x305584[_0x63b5('0x65')][_0x63b5('0x68')][_0x63b5('0x50')];_0x5e66b1++){var _0x61e50f=[];db[_0x63b5('0x102')]['findOne']({'where':{'id':_0x305584[_0x63b5('0x65')][_0x63b5('0x68')][_0x5e66b1]}})[_0x63b5('0x20')](function(_0x2f77cd){_0x61e50f[_0x63b5('0xa5')](_0x2f77cd[_0x63b5('0xdf')]()[_0x63b5('0x20')](function(_0x5a4571){for(var _0x596b61=0x0;_0x596b61<_0x5a4571[_0x63b5('0x50')];_0x596b61++){_0x5a4571[_0x596b61]['setDataValue']('channel',_0x63b5('0x103'));}return _0x5a4571;}));_0x61e50f[_0x63b5('0xa5')](_0x2f77cd[_0x63b5('0x104')]()[_0x63b5('0x20')](function(_0x2f22b9){for(var _0x245c0f=0x0;_0x245c0f<_0x2f22b9[_0x63b5('0x50')];_0x245c0f++){_0x2f22b9[_0x245c0f][_0x63b5('0x105')](_0x63b5('0xab'),'Chat');}return _0x2f22b9;}));_0x61e50f[_0x63b5('0xa5')](_0x2f77cd[_0x63b5('0x106')]()[_0x63b5('0x20')](function(_0x4e8e92){for(var _0x3679c8=0x0;_0x3679c8<_0x4e8e92[_0x63b5('0x50')];_0x3679c8++){_0x4e8e92[_0x3679c8][_0x63b5('0x105')]('channel','Mail');}return _0x4e8e92;}));_0x61e50f['push'](_0x2f77cd[_0x63b5('0x107')]()[_0x63b5('0x20')](function(_0x4f520b){for(var _0x216b4f=0x0;_0x216b4f<_0x4f520b[_0x63b5('0x50')];_0x216b4f++){_0x4f520b[_0x216b4f]['setDataValue']('channel',_0x63b5('0x108'));}return _0x4f520b;}));_0x61e50f[_0x63b5('0xa5')](_0x2f77cd['getWhatsappQueues']()[_0x63b5('0x20')](function(_0x161cd5){for(var _0x4c1f7c=0x0;_0x4c1f7c<_0x161cd5[_0x63b5('0x50')];_0x4c1f7c++){_0x161cd5[_0x4c1f7c]['setDataValue'](_0x63b5('0xab'),_0x63b5('0x109'));}return _0x161cd5;}));_0x61e50f[_0x63b5('0xa5')](_0x2f77cd[_0x63b5('0x10a')]()[_0x63b5('0x20')](function(_0x57b478){for(var _0x4e8de4=0x0;_0x4e8de4<_0x57b478[_0x63b5('0x50')];_0x4e8de4++){_0x57b478[_0x4e8de4][_0x63b5('0x105')](_0x63b5('0xab'),_0x63b5('0x10b'));}return _0x57b478;}));_0x61e50f[_0x63b5('0xa5')](_0x2f77cd['getOpenchannelQueues']()[_0x63b5('0x20')](function(_0x4a3d05){for(var _0x154e0a=0x0;_0x154e0a<_0x4a3d05[_0x63b5('0x50')];_0x154e0a++){_0x4a3d05[_0x154e0a]['setDataValue']('channel',_0x63b5('0x10c'));}return _0x4a3d05;}));return BPromise[_0x63b5('0xe3')](_0x61e50f);})[_0x63b5('0x20')](function(_0x346481){var _0x5d0567=_[_0x63b5('0x10d')](_0x346481);_0x61e50f=[];return db[_0x63b5('0x59')]['transaction'](function(_0x5c36da){for(var _0x290445=0x0;_0x290445<_0x5d0567['length'];_0x290445++){_0x61e50f[_0x63b5('0xa5')](_0x5d0567[_0x290445]['addAgent'](_0x5adc5e['id']),{'transaction':_0x5c36da});}return BPromise['all'](_0x61e50f)[_0x63b5('0x20')](function(){if(_0x5adc5e[_0x63b5('0x95')]){return BPromise['each'](_[_0x63b5('0x3c')](_0x5d0567,function(_0x54d27f){return _0x54d27f[_0x63b5('0x10e')](_0x63b5('0xab'))===_0x63b5('0x103');}),function(_0x4964c9){return db['UserVoiceQueueRt'][_0x63b5('0xa9')]({'membername':_0x5adc5e[_0x63b5('0x45')],'UserId':_0x5adc5e['id'],'queue_name':_0x4964c9[_0x63b5('0x45')],'VoiceQueueId':_0x4964c9['id'],'interface':_[_0x63b5('0x6d')](_0x5adc5e[_0x63b5('0x98')])?util[_0x63b5('0x6e')](_0x63b5('0xa6'),_0x5adc5e[_0x63b5('0x45')]):_0x5adc5e[_0x63b5('0x98')],'paused':_0x5adc5e[_0x63b5('0x97')]||![],'penalty':_0x5adc5e[_0x63b5('0x9f')]},{'transaction':_0x5c36da});});}else{return;}})[_0x63b5('0x20')](function(){for(var _0x1c697d=0x0;_0x1c697d<_0x5d0567['length'];_0x1c697d++){var _0x5f1e68=_0x5d0567[_0x1c697d]['getDataValue'](_0x63b5('0xab'));var _0x484476=_0x5f1e68+_0x63b5('0xac');socket[_0x63b5('0xa1')](_0x63b5('0x37')+_0x5f1e68+_0x63b5('0xa2'),{'UserId':_0x5adc5e['id'],['queueField']:_0x5d0567[_0x1c697d]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x5d4135,null))['catch'](handleError(_0x5d4135,null));};exports['removeTeams']=function(_0x11a67c,_0x5d8c8f){return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x11a67c[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x5d8c8f,null))[_0x63b5('0x20')](function(_0x115518){if(_0x115518){var _0x51e339=_0x115518[_0x63b5('0x35')]({'plain':!![]});var _0x4292cf=_0x11a67c[_0x63b5('0x4b')][_0x63b5('0x68')];return _0x115518[_0x63b5('0x10f')](_0x4292cf)[_0x63b5('0x20')](function(){for(var _0x4d7fef=0x0;_0x4d7fef<_0x4292cf['length'];_0x4d7fef++){var _0xfc7bd1=[];db[_0x63b5('0x102')]['findOne']({'where':{'id':_0x4292cf[_0x4d7fef]}})[_0x63b5('0x20')](function(_0x2ae61d){_0xfc7bd1[_0x63b5('0xa5')](_0x2ae61d[_0x63b5('0xdf')]()['then'](function(_0x18e411){for(var _0x2b1ca0=0x0;_0x2b1ca0<_0x18e411['length'];_0x2b1ca0++){_0x18e411[_0x2b1ca0][_0x63b5('0x105')]('channel',_0x63b5('0x103'));}return _0x18e411;}));_0xfc7bd1[_0x63b5('0xa5')](_0x2ae61d[_0x63b5('0x104')]()['then'](function(_0x44aea8){for(var _0x6ac22f=0x0;_0x6ac22f<_0x44aea8[_0x63b5('0x50')];_0x6ac22f++){_0x44aea8[_0x6ac22f]['setDataValue'](_0x63b5('0xab'),_0x63b5('0x110'));}return _0x44aea8;}));_0xfc7bd1['push'](_0x2ae61d[_0x63b5('0x106')]()[_0x63b5('0x20')](function(_0x117333){for(var _0xdc4a70=0x0;_0xdc4a70<_0x117333[_0x63b5('0x50')];_0xdc4a70++){_0x117333[_0xdc4a70][_0x63b5('0x105')](_0x63b5('0xab'),'Mail');}return _0x117333;}));_0xfc7bd1[_0x63b5('0xa5')](_0x2ae61d[_0x63b5('0x107')]()[_0x63b5('0x20')](function(_0x4c75de){for(var _0x1a1b65=0x0;_0x1a1b65<_0x4c75de[_0x63b5('0x50')];_0x1a1b65++){_0x4c75de[_0x1a1b65]['setDataValue'](_0x63b5('0xab'),_0x63b5('0x108'));}return _0x4c75de;}));_0xfc7bd1['push'](_0x2ae61d[_0x63b5('0x111')]()[_0x63b5('0x20')](function(_0x52a1a8){for(var _0x59ccac=0x0;_0x59ccac<_0x52a1a8['length'];_0x59ccac++){_0x52a1a8[_0x59ccac][_0x63b5('0x105')]('channel',_0x63b5('0x109'));}return _0x52a1a8;}));_0xfc7bd1[_0x63b5('0xa5')](_0x2ae61d[_0x63b5('0x10a')]()[_0x63b5('0x20')](function(_0x54d86e){for(var _0x7c2010=0x0;_0x7c2010<_0x54d86e[_0x63b5('0x50')];_0x7c2010++){_0x54d86e[_0x7c2010][_0x63b5('0x105')](_0x63b5('0xab'),_0x63b5('0x10b'));}return _0x54d86e;}));_0xfc7bd1[_0x63b5('0xa5')](_0x2ae61d[_0x63b5('0x112')]()[_0x63b5('0x20')](function(_0x4944e4){for(var _0x36604f=0x0;_0x36604f<_0x4944e4[_0x63b5('0x50')];_0x36604f++){_0x4944e4[_0x36604f][_0x63b5('0x105')](_0x63b5('0xab'),_0x63b5('0x10c'));}return _0x4944e4;}));return BPromise[_0x63b5('0xe3')](_0xfc7bd1);})[_0x63b5('0x20')](function(_0x4bf410){var _0x2fafe8=_['flatten'](_0x4bf410);_0xfc7bd1=[];return db[_0x63b5('0x59')]['transaction'](function(_0x18f413){for(var _0xc2a275=0x0;_0xc2a275<_0x2fafe8[_0x63b5('0x50')];_0xc2a275++){_0xfc7bd1[_0x63b5('0xa5')](_0x2fafe8[_0xc2a275]['removeAgent'](_0x51e339['id']),{'transaction':_0x18f413});}return BPromise['all'](_0xfc7bd1)[_0x63b5('0x20')](function(){if(_0x51e339[_0x63b5('0x95')]){return BPromise[_0x63b5('0xa7')](_[_0x63b5('0x3c')](_0x2fafe8,function(_0x2270f8){return _0x2270f8['getDataValue'](_0x63b5('0xab'))==='Voice';}),function(_0x47f78a){return db[_0x63b5('0xa8')][_0x63b5('0x34')]({'where':{'VoiceQueueId':_0x47f78a['id'],'UserId':_0x51e339['id']},'transaction':_0x18f413});});}else{return;}})[_0x63b5('0x20')](function(){for(var _0x4bad8d=0x0;_0x4bad8d<_0x2fafe8['length'];_0x4bad8d++){var _0x64340f=_0x2fafe8[_0x4bad8d][_0x63b5('0x10e')](_0x63b5('0xab'));var _0x1ca3ac=_0x64340f+_0x63b5('0xac');socket[_0x63b5('0xa1')]('user'+_0x64340f+_0x63b5('0xad'),{'UserId':_0x51e339['id'],['queueField']:_0x2fafe8[_0x4bad8d]['id']});}});});});}});}})[_0x63b5('0x20')](respondWithStatusCode(_0x5d8c8f,null))[_0x63b5('0x29')](handleError(_0x5d8c8f,null));};exports[_0x63b5('0x113')]=function(_0x87364f,_0x50752b,_0x5bfa90){var _0x534638={};var _0x7e8dad={};var _0x2425fd;var _0x40a61c;return db[_0x63b5('0x46')]['findOne']({'where':{'id':_0x87364f[_0x63b5('0x61')]['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x50752b,null))[_0x63b5('0x20')](function(_0x1e396d){if(_0x1e396d){_0x2425fd=_0x1e396d;_0x7e8dad['model']=_['keys'](db[_0x63b5('0x114')][_0x63b5('0x47')]);_0x7e8dad['query']=_[_0x63b5('0x62')](_0x87364f['query']);_0x7e8dad[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x7e8dad['model'],_0x7e8dad[_0x63b5('0x4b')]);_0x534638['attributes']=_[_0x63b5('0x4c')](_0x7e8dad[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x87364f[_0x63b5('0x4b')][_0x63b5('0x4e')]));_0x534638[_0x63b5('0x4f')]=_0x534638[_0x63b5('0x4f')]['length']?_0x534638[_0x63b5('0x4f')]:_0x7e8dad['model'];_0x534638[_0x63b5('0xc1')]=qs[_0x63b5('0x53')](_0x87364f[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x534638[_0x63b5('0x54')]=qs[_0x63b5('0x55')](_[_0x63b5('0x56')](_0x87364f[_0x63b5('0x4b')],_0x7e8dad['filters']));if(_0x87364f[_0x63b5('0x4b')]['filter']){_0x534638[_0x63b5('0x54')]=_['merge'](_0x534638['where'],{'$or':_[_0x63b5('0x3e')](_0x534638[_0x63b5('0x4f')],function(_0x35bbf4){var _0x51c672={};_0x51c672[_0x35bbf4]={'$like':'%'+_0x87364f[_0x63b5('0x4b')]['filter']+'%'};return _0x51c672;})});}_0x534638=_[_0x63b5('0x5c')]({},_0x534638,_0x87364f[_0x63b5('0xb9')]);return _0x2425fd['getLists'](_0x534638);}})[_0x63b5('0x20')](function(_0x4f32c8){if(_0x4f32c8){_0x40a61c=_0x4f32c8[_0x63b5('0x50')];if(!_0x87364f[_0x63b5('0x4b')]['hasOwnProperty'](_0x63b5('0xbe'))){_0x534638[_0x63b5('0x52')]=qs[_0x63b5('0x52')](_0x87364f['query'][_0x63b5('0x52')]);_0x534638[_0x63b5('0x2f')]=qs[_0x63b5('0x2f')](_0x87364f[_0x63b5('0x4b')][_0x63b5('0x2f')]);}return _0x2425fd[_0x63b5('0x113')](_0x534638);}})[_0x63b5('0x20')](function(_0x1968f2){if(_0x1968f2){return _0x1968f2?{'count':_0x40a61c,'rows':_0x1968f2}:null;}})[_0x63b5('0x20')](respondWithResult(_0x50752b,null))[_0x63b5('0x29')](handleError(_0x50752b,null));};exports['getAgents']=function(_0x3953b9,_0x3b6d2a,_0x46adb9){var _0x5842d0={};var _0x2ab83a={};var _0xb01ef2;var _0x4e2e0b;return db[_0x63b5('0x46')][_0x63b5('0x8e')]({'where':{'id':_0x3953b9['params']['id']}})[_0x63b5('0x20')](handleEntityNotFound(_0x3b6d2a,null))[_0x63b5('0x20')](function(_0x50de1d){if(_0x50de1d){_0xb01ef2=_0x50de1d;_0x2ab83a[_0x63b5('0x4d')]=_[_0x63b5('0x62')](db['User'][_0x63b5('0x47')]);_0x2ab83a[_0x63b5('0x4b')]=_[_0x63b5('0x62')](_0x3953b9['query']);_0x2ab83a[_0x63b5('0x55')]=_[_0x63b5('0x4c')](_0x2ab83a[_0x63b5('0x4d')],_0x2ab83a[_0x63b5('0x4b')]);_0x5842d0[_0x63b5('0x4f')]=_[_0x63b5('0x4c')](_0x2ab83a[_0x63b5('0x4d')],qs[_0x63b5('0x4e')](_0x3953b9['query']['fields']));_0x5842d0[_0x63b5('0x4f')]=_0x5842d0[_0x63b5('0x4f')][_0x63b5('0x50')]?_0x5842d0[_0x63b5('0x4f')]:_0x2ab83a[_0x63b5('0x4d')];_0x5842d0[_0x63b5('0xc1')]=qs[_0x63b5('0x53')](_0x3953b9[_0x63b5('0x4b')][_0x63b5('0x53')]);_0x5842d0[_0x63b5('0x54')]=qs[_0x63b5('0x55')](_[_0x63b5('0x56')](_0x3953b9[_0x63b5('0x4b')],_0x2ab83a[_0x63b5('0x55')]));if(_0x3953b9[_0x63b5('0x4b')][_0x63b5('0x3c')]){_0x5842d0[_0x63b5('0x54')]=_[_0x63b5('0x5c')](_0x5842d0['where'],{'$or':_['map'](_0x5842d0[_0x63b5('0x4f')],function(_0x574817){var _0x5eb387={};_0x5eb387[_0x574817]={'$like':'%'+_0x3953b9[_0x63b5('0x4b')][_0x63b5('0x3c')]+'%'};return _0x5eb387;})});}_0x5842d0[_0x63b5('0x4d')]=db[_0x63b5('0x46')];_0x5842d0['as']=_0x63b5('0x38');_0x5842d0=_[_0x63b5('0x5c')]({},_0x5842d0,_0x3953b9[_0x63b5('0xb9')]);return _0xb01ef2[_0x63b5('0xdf')]({'include':[_0x5842d0]});}})[_0x63b5('0x20')](function(_0x1621a0){if(_0x1621a0){var _0x4c2d31={},_0x4e6745=[],_0x42fe18=0x0;for(var _0x310841=0x0;_0x310841<_0x1621a0[_0x63b5('0x50')];_0x310841+=0x1){for(var _0x242711=0x0,_0xda43e2;_0x242711<_0x1621a0[_0x310841][_0x63b5('0x38')][_0x63b5('0x50')];_0x242711+=0x1){_0xda43e2=_0x1621a0[_0x310841][_0x63b5('0x38')][_0x242711]['get']({'plain':!![]});_0x4c2d31[_0xda43e2['id']]=_0xda43e2;}}_0x4c2d31=_['values'](_0x4c2d31);for(var _0x26ce93=qs[_0x63b5('0x2f')](_0x3953b9[_0x63b5('0x4b')][_0x63b5('0x2f')]);_0x26ce93<_0x4c2d31[_0x63b5('0x50')]&&_0x4e6745[_0x63b5('0x50')]=_0x4af13a[_0xa42f('0x56')]){throw new Error(_0xa42f('0x57'));}})[_0xa42f('0x27')](function(){if(_0x1db1bd){return db[_0xa42f('0x41')]['destroy']({'where':{'membername':_0x1db1bd[_0xa42f('0x2b')]},'individualHooks':!![]});}})[_0xa42f('0x27')](function(){if(_0x1db1bd){return _0x1db1bd[_0xa42f('0x58')]({'raw':!![]});}})[_0xa42f('0x27')](function(_0x188d49){if(_0x1db1bd){if(_0x188d49){var _0x4654b0=[];_0x1e04c3=_0x188d49;if(_0x1e04c3[_0xa42f('0x30')]){for(var _0x39f1b8=0x0;_0x39f1b8<_0x1e04c3['length'];_0x39f1b8++){_0x4654b0[_0xa42f('0x4a')](db[_0xa42f('0x41')]['upsert']({'membername':_0x1db1bd[_0xa42f('0x2b')],'UserId':_0x1db1bd['id'],'queue_name':_0x1e04c3[_0x39f1b8][_0xa42f('0x2b')],'VoiceQueueId':_0x1e04c3[_0x39f1b8]['id'],'interface':_0x2f78a5,'paused':_0x1db1bd[_0xa42f('0x51')]||![],'penalty':_0x1e04c3[_0x39f1b8][_0xa42f('0x59')]||0x0}));}return BPromise[_0xa42f('0x4b')](_0x4654b0);}}}})['then'](function(){if(_0x1db1bd){return db[_0xa42f('0x2e')]['findAll']({'where':{'membername':_0x1db1bd[_0xa42f('0x2b')],'exitAt':null}});}})['then'](function(_0x10b4e0){if(_0x1db1bd){if(_0x10b4e0&&_0x10b4e0[_0xa42f('0x30')]){var _0x38b982=[];_0x10b4e0[_0xa42f('0x33')](function(_0x485486){_0x38b982[_0xa42f('0x4a')](_0x485486[_0xa42f('0x42')]({'exitAt':moment()[_0xa42f('0x31')](_0xa42f('0x36'))}));});return BPromise[_0xa42f('0x4b')](_0x38b982);}}})['then'](function(_0x231c6e){if(_0x1db1bd){var _0x37ce65=[];var _0x1b697f=[];var _0x3f6543=utils[_0xa42f('0x32')]();var _0x44e69c={'membername':_0x1db1bd[_0xa42f('0x2b')],'interface':_0x2f78a5,'enterAt':moment()[_0xa42f('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1db1bd[_0xa42f('0x2c')],'internal':_0x1db1bd[_0xa42f('0x2d')]};_0x3f6543[_0xa42f('0x33')](function(_0x1d1d5a){_0x37ce65['push'](_[_0xa42f('0x5a')]({'channel':_0x1d1d5a,'type':'LOGIN','data1':_0xa42f('0x5b'),'data2':_0x2f78a5},_0x44e69c));if(_0x1db1bd['loginInPause']){_0x1b697f[_0xa42f('0x4a')](_[_0xa42f('0x5a')]({'channel':_0x1d1d5a,'type':_0xa42f('0x2f'),'data1':_0xa42f('0x5c')},_0x44e69c));}});return db[_0xa42f('0x2e')]['bulkCreate'](_0x37ce65['concat'](_0x1b697f),{'individualHooks':!![]});}})[_0xa42f('0x27')](function(){if(_0x1db1bd){return _0x1db1bd[_0xa42f('0x42')]({'online':!![],'lastLoginAt':moment()['format'](_0xa42f('0x36')),'voicePause':_0x1db1bd['loginInPause']||![],'mailPause':_0x1db1bd[_0xa42f('0x51')]||![],'chatPause':_0x1db1bd[_0xa42f('0x51')]||![],'faxPause':_0x1db1bd[_0xa42f('0x51')]||![],'smsPause':_0x1db1bd[_0xa42f('0x51')]||![],'openchannelPause':_0x1db1bd[_0xa42f('0x51')]||![],'pauseType':_0x1db1bd['loginInPause']?_0xa42f('0x5c'):null,'lastPauseAt':moment()['format'](_0xa42f('0x36')),'interface':_0x2f78a5});}})[_0xa42f('0x27')](function(_0x1f3aff){_0x14270d(_0x1f3aff);})[_0xa42f('0x1b')](function(_0xfa741c){_0x573831(_0x49ce98['error'](0x1f4,_0xfa741c['message']));});});}; \ No newline at end of file +var _0xba8a=['YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','Unknown\x20channel','find','mail','chat','fax','sms','%s%s','Pause','system','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','bulkCreate','concat','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowUser','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','getChannels','forEach','push','SIP/%s'];(function(_0x3cf078,_0x168566){var _0x274dba=function(_0x5ea59e){while(--_0x5ea59e){_0x3cf078['push'](_0x3cf078['shift']());}};_0x274dba(++_0x168566);}(_0xba8a,0x132));var _0xaba8=function(_0x5767d1,_0x20323b){_0x5767d1=_0x5767d1-0x0;var _0x37b060=_0xba8a[_0x5767d1];return _0x37b060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaba8('0x0'));var BPromise=require(_0xaba8('0x1'));var rs=require(_0xaba8('0x2'));var fs=require('fs');var Redis=require(_0xaba8('0x3'));var db=require(_0xaba8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaba8('0x5'))(_0xaba8('0x6'));var config=require('../../config/environment');var jayson=require(_0xaba8('0x7'));var client=jayson[_0xaba8('0x8')][_0xaba8('0x9')]({'port':0x232a});config['redis']=_[_0xaba8('0xa')](config[_0xaba8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaba8('0xc'))(new Redis(config['redis']));require(_0xaba8('0xd'))[_0xaba8('0xe')](socket);function respondWithRpcPromise(_0x439ef5,_0x44c61,_0x145dac){return new BPromise(function(_0x12131f,_0x3a145e){return client[_0xaba8('0xf')](_0x439ef5,_0x145dac)[_0xaba8('0x10')](function(_0x177aa1){logger[_0xaba8('0x11')](_0xaba8('0x12'),_0x44c61,'request\x20sent');logger['debug'](_0xaba8('0x13'),_0x44c61,'request\x20sent',JSON[_0xaba8('0x14')](_0x177aa1));if(_0x177aa1[_0xaba8('0x15')]){if(_0x177aa1[_0xaba8('0x15')][_0xaba8('0x16')]===0x1f4){logger[_0xaba8('0x15')](_0xaba8('0x12'),_0x44c61,_0x177aa1['error'][_0xaba8('0x17')]);return _0x3a145e(_0x177aa1[_0xaba8('0x15')][_0xaba8('0x17')]);}logger['error'](_0xaba8('0x12'),_0x44c61,_0x177aa1[_0xaba8('0x15')][_0xaba8('0x17')]);return _0x12131f(_0x177aa1[_0xaba8('0x15')][_0xaba8('0x17')]);}else{logger['info']('User,\x20%s,\x20%s',_0x44c61,_0xaba8('0x18'));_0x12131f(_0x177aa1['result'][_0xaba8('0x17')]);}})[_0xaba8('0x19')](function(_0x252d05){logger[_0xaba8('0x15')](_0xaba8('0x12'),_0x44c61,_0x252d05);_0x3a145e(_0x252d05);});});}exports[_0xaba8('0x1a')]=function(_0x3f047f){var _0xafb98f=this;return new Promise(function(_0x161d2a,_0x15ded0){return db[_0xaba8('0x1b')][_0xaba8('0x1c')]({'raw':_0x3f047f[_0xaba8('0x1d')]?_0x3f047f['options'][_0xaba8('0x1e')]===undefined?!![]:![]:!![],'where':_0x3f047f['options']?_0x3f047f[_0xaba8('0x1d')][_0xaba8('0x1f')]||null:null,'attributes':_0x3f047f[_0xaba8('0x1d')]?_0x3f047f['options'][_0xaba8('0x20')]||null:null,'limit':_0x3f047f['options']?_0x3f047f[_0xaba8('0x1d')][_0xaba8('0x21')]||null:null,'include':_0x3f047f[_0xaba8('0x1d')]?_0x3f047f['options'][_0xaba8('0x22')]?_[_0xaba8('0x23')](_0x3f047f[_0xaba8('0x1d')][_0xaba8('0x22')],function(_0x4c0b5f){return{'model':db[_0x4c0b5f[_0xaba8('0x24')]],'as':_0x4c0b5f['as'],'attributes':_0x4c0b5f[_0xaba8('0x20')],'include':_0x4c0b5f['include']?_[_0xaba8('0x23')](_0x4c0b5f['include'],function(_0x4e080d){return{'model':db[_0x4e080d[_0xaba8('0x24')]],'as':_0x4e080d['as'],'attributes':_0x4e080d['attributes'],'include':_0x4e080d[_0xaba8('0x22')]?_['map'](_0x4e080d['include'],function(_0x2482eb){return{'model':db[_0x2482eb[_0xaba8('0x24')]],'as':_0x2482eb['as'],'attributes':_0x2482eb['attributes']};}):[]};}):[]};}):[]:[]})[_0xaba8('0x10')](function(_0x2f0f53){logger[_0xaba8('0x11')](_0xaba8('0x1a'),_0x3f047f);logger[_0xaba8('0x25')]('GetUser',_0x3f047f,JSON[_0xaba8('0x14')](_0x2f0f53));_0x161d2a(_0x2f0f53);})[_0xaba8('0x19')](function(_0x2ff8d6){logger['error']('GetUser',_0x2ff8d6[_0xaba8('0x17')],_0x3f047f);_0x15ded0(_0xafb98f[_0xaba8('0x15')](0x1f4,_0x2ff8d6['message']));});});};exports['ShowUser']=function(_0xacdd25){var _0x4e3b5b=this;return new Promise(function(_0x17d115,_0x257b34){return db[_0xaba8('0x1b')]['find']({'raw':_0xacdd25[_0xaba8('0x1d')]?_0xacdd25[_0xaba8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xacdd25[_0xaba8('0x1d')]?_0xacdd25[_0xaba8('0x1d')]['where']||null:null,'attributes':_0xacdd25[_0xaba8('0x1d')]?_0xacdd25['options']['attributes']||null:null,'include':_0xacdd25['options']?_0xacdd25[_0xaba8('0x1d')][_0xaba8('0x22')]?_[_0xaba8('0x23')](_0xacdd25[_0xaba8('0x1d')][_0xaba8('0x22')],function(_0x4d7eeb){return{'model':db[_0x4d7eeb[_0xaba8('0x24')]],'as':_0x4d7eeb['as'],'attributes':_0x4d7eeb['attributes'],'include':_0x4d7eeb[_0xaba8('0x22')]?_[_0xaba8('0x23')](_0x4d7eeb[_0xaba8('0x22')],function(_0x4fa5aa){return{'model':db[_0x4fa5aa[_0xaba8('0x24')]],'as':_0x4fa5aa['as'],'attributes':_0x4fa5aa[_0xaba8('0x20')],'include':_0x4fa5aa[_0xaba8('0x22')]?_[_0xaba8('0x23')](_0x4fa5aa[_0xaba8('0x22')],function(_0x49260b){return{'model':db[_0x49260b[_0xaba8('0x24')]],'as':_0x49260b['as'],'attributes':_0x49260b[_0xaba8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaba8('0x10')](function(_0x1668b1){logger[_0xaba8('0x11')](_0xaba8('0x26'),_0xacdd25);logger[_0xaba8('0x25')](_0xaba8('0x26'),_0xacdd25,JSON[_0xaba8('0x14')](_0x1668b1));_0x17d115(_0x1668b1);})[_0xaba8('0x19')](function(_0x5a5c55){logger[_0xaba8('0x15')]('ShowUser',_0x5a5c55[_0xaba8('0x17')],_0xacdd25);_0x257b34(_0x4e3b5b[_0xaba8('0x15')](0x1f4,_0x5a5c55[_0xaba8('0x17')]));});});};exports[_0xaba8('0x27')]=function(_0x4481c2){var _0x5c7955=this;return new Promise(function(_0x367bc8,_0x412943){var _0x6ed26c;return db['User']['find']({'where':_0x4481c2[_0xaba8('0x1d')][_0xaba8('0x1f')]||{},'attributes':['id',_0xaba8('0x28'),_0xaba8('0x29'),_0xaba8('0x2a'),_0xaba8('0x2b')]})[_0xaba8('0x10')](function(_0x412826){if(_0x412826){_0x6ed26c=_0x412826;return db[_0xaba8('0x2c')][_0xaba8('0x2d')]({'paused':0x1},{'where':{'UserId':_0x6ed26c['id']},'individualHooks':!![]});}})[_0xaba8('0x10')](function(){if(_0x6ed26c){return db[_0xaba8('0x2e')]['findAll']({'where':{'membername':_0x6ed26c['name'],'type':_0xaba8('0x2f'),'exitAt':null}});}})[_0xaba8('0x10')](function(_0x4ed0ac){if(_0x6ed26c){if(_0x4ed0ac&&_0x4ed0ac[_0xaba8('0x30')]){var _0x4e15de=moment()[_0xaba8('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2b44b9=0x0,_0x54c2da=_0x4ed0ac['length'];_0x2b44b9<_0x54c2da;_0x2b44b9++){_0x4ed0ac[_0x2b44b9]['updateAttributes']({'exitAt':_0x4e15de});}}}})[_0xaba8('0x10')](function(){if(_0x6ed26c){var _0x268346=[];var _0x53fbe0=utils[_0xaba8('0x32')]();_0x53fbe0[_0xaba8('0x33')](function(_0x158838){_0x268346[_0xaba8('0x34')]({'channel':_0x158838,'membername':_0x6ed26c[_0xaba8('0x28')],'interface':_['isNil'](_0x6ed26c['interface'])?util['format'](_0xaba8('0x35'),_0x6ed26c[_0xaba8('0x28')]):_0x6ed26c[_0xaba8('0x2b')],'type':_0xaba8('0x2f'),'enterAt':moment()[_0xaba8('0x31')](_0xaba8('0x36')),'data1':_0x4481c2[_0xaba8('0x37')]['type']||'DEFAULT\x20PAUSE','role':_0x6ed26c[_0xaba8('0x29')],'internal':_0x6ed26c[_0xaba8('0x2a')],'uniqueid':_0x4481c2[_0xaba8('0x37')]['uniqueid']||null});});return db[_0xaba8('0x2e')]['bulkCreate'](_0x268346,{'individualHooks':!![]});}})['then'](function(){if(_0x6ed26c){return _0x6ed26c[_0xaba8('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4481c2[_0xaba8('0x37')][_0xaba8('0x38')]||_0xaba8('0x39'),'lastPauseAt':moment()[_0xaba8('0x31')](_0xaba8('0x36'))});}})['then'](function(_0x5d107e){_0x367bc8(_0x5d107e);})[_0xaba8('0x19')](function(_0x4928e7){_0x412943(_0x5c7955[_0xaba8('0x15')](0x1f4,_0x4928e7[_0xaba8('0x17')]));});});};exports[_0xaba8('0x3a')]=function(_0x1a8f2e){var _0x7fb2a3=this;return new Promise(function(_0x34ec2d,_0x36e0e6){var _0x33cb68;return db['User'][_0xaba8('0x3b')]({'where':_0x1a8f2e['options']['where']||{},'attributes':['id','name']})[_0xaba8('0x10')](function(_0x5d92f6){if(_0x5d92f6){_0x33cb68=_0x5d92f6;if(_0x1a8f2e[_0xaba8('0x37')][_0xaba8('0x3c')]&&!utils['isValidChannel'](_0x1a8f2e[_0xaba8('0x37')]['channel'])){throw new Error(_0xaba8('0x3d'));}switch(_0x1a8f2e[_0xaba8('0x37')][_0xaba8('0x3c')]){case'voice':return db[_0xaba8('0x2c')]['update']({'paused':0x0},{'where':{'UserId':_0x33cb68['id']}})[_0xaba8('0x10')](function(){return db[_0xaba8('0x2e')][_0xaba8('0x3e')]({'where':{'channel':_0x1a8f2e[_0xaba8('0x37')]['channel'],'membername':_0x33cb68[_0xaba8('0x28')],'type':_0xaba8('0x2f'),'exitAt':null}});})[_0xaba8('0x10')](function(_0x2007f3){if(_0x2007f3){return _0x2007f3[_0xaba8('0x2d')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x33cb68[_0xaba8('0x2d')]({'voicePause':![]});});case _0xaba8('0x3f'):case _0xaba8('0x40'):case _0xaba8('0x41'):case _0xaba8('0x42'):case'openchannel':return db[_0xaba8('0x2e')][_0xaba8('0x3e')]({'where':{'channel':_0x1a8f2e[_0xaba8('0x37')][_0xaba8('0x3c')],'membername':_0x33cb68[_0xaba8('0x28')],'type':_0xaba8('0x2f'),'exitAt':null}})[_0xaba8('0x10')](function(_0x572464){return _0x572464[_0xaba8('0x2d')]({'exitAt':moment()[_0xaba8('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})[_0xaba8('0x10')](function(){var _0x554455={};_['set'](_0x554455,util[_0xaba8('0x31')](_0xaba8('0x43'),_0x1a8f2e[_0xaba8('0x37')][_0xaba8('0x3c')],_0xaba8('0x44')),![]);return _0x33cb68[_0xaba8('0x2d')](_0x554455);});default:return db['UserVoiceQueueRt'][_0xaba8('0x2d')]({'paused':0x0},{'where':{'UserId':_0x33cb68['id']}})[_0xaba8('0x10')](function(){return db[_0xaba8('0x2e')][_0xaba8('0x1c')]({'where':{'membername':_0x33cb68[_0xaba8('0x28')],'type':_0xaba8('0x2f'),'exitAt':null}});})[_0xaba8('0x10')](function(_0x5b1597){var _0x4d587b=[];_0x5b1597['forEach'](function(_0x30d471){_0x4d587b[_0xaba8('0x34')](_0x30d471['update']({'exitAt':moment()[_0xaba8('0x31')](_0xaba8('0x36')),'data2':_0xaba8('0x45')}));});return BPromise['all'](_0x4d587b);})['then'](function(){return _0x33cb68['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xaba8('0x10')](function(_0x1c9340){_0x34ec2d(_0x1c9340);})[_0xaba8('0x19')](function(_0x3e5198){_0x36e0e6(_0x7fb2a3['error'](0x1f4,_0x3e5198['message']));});});};exports[_0xaba8('0x46')]=function(_0x203821){var _0x5acd4b=this;return new Promise(function(_0x1f44d5,_0x3ec717){var _0xb43e9a;return db[_0xaba8('0x1b')][_0xaba8('0x3b')]({'where':_0x203821[_0xaba8('0x1d')][_0xaba8('0x1f')]||{},'attributes':['id',_0xaba8('0x28')]})[_0xaba8('0x10')](function(_0x481732){if(_0x481732){_0xb43e9a=_0x481732;return db[_0xaba8('0x2c')][_0xaba8('0x47')]({'where':{'membername':_0xb43e9a[_0xaba8('0x28')]},'individualHooks':!![]});}})[_0xaba8('0x10')](function(){if(_0xb43e9a){return db[_0xaba8('0x2e')][_0xaba8('0x1c')]({'where':{'membername':_0xb43e9a[_0xaba8('0x28')],'exitAt':null}});}})[_0xaba8('0x10')](function(_0x3ab40d){if(_0xb43e9a){if(_0x3ab40d&&_0x3ab40d[_0xaba8('0x30')]){var _0x3122f3=[];_0x3ab40d[_0xaba8('0x33')](function(_0x17e72f){_0x3122f3['push'](_0x17e72f[_0xaba8('0x2d')]({'exitAt':moment()[_0xaba8('0x31')](_0xaba8('0x36'))}));});return BPromise[_0xaba8('0x48')](_0x3122f3);}}})[_0xaba8('0x10')](function(){if(_0xb43e9a){return _0xb43e9a[_0xaba8('0x2d')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xaba8('0x10')](function(_0x3554c2){_0x1f44d5(_0x3554c2);})[_0xaba8('0x19')](function(_0x4ddd9d){_0x3ec717(_0x5acd4b['error'](0x1f4,_0x4ddd9d[_0xaba8('0x17')]));});});};exports[_0xaba8('0x49')]=function(_0x28f433){var _0x3e9faf=this;return new Promise(function(_0x2ce33d,_0x3b515f){var _0x3a3a08;var _0x4dd606;var _0x519765;var _0x2ffa47;return db[_0xaba8('0x1b')][_0xaba8('0x3b')]({'where':_0x28f433[_0xaba8('0x1d')][_0xaba8('0x1f')]||{},'attributes':['id',_0xaba8('0x28'),_0xaba8('0x29'),_0xaba8('0x4a'),_0xaba8('0x4b'),_0xaba8('0x2a'),_0xaba8('0x4c'),_0xaba8('0x2b')]})['then'](function(_0x4d54ad){if(_0x4d54ad){_0x3a3a08=_0x4d54ad;_0x2ffa47=_0x28f433[_0xaba8('0x37')]['interface']?_0x28f433['body'][_0xaba8('0x2b')]:util[_0xaba8('0x31')](_0xaba8('0x35'),_0x3a3a08[_0xaba8('0x28')]);return db[_0xaba8('0x1b')][_0xaba8('0x4d')]({'where':{'role':_0xaba8('0x4e'),'online':!![],'id':{'$ne':_0x3a3a08['id']}}});}})['then'](function(_0x36a9ed){if(_0x36a9ed){_0x519765=_0x36a9ed;return require(_0xaba8('0x4f'))[_0xaba8('0x50')]();}})[_0xaba8('0x10')](function(_0x5aaaef){if(_0x5aaaef&&_0x5aaaef['agents']&&_0x519765>=_0x5aaaef[_0xaba8('0x51')]){throw new Error(_0xaba8('0x52'));}})[_0xaba8('0x10')](function(){if(_0x3a3a08){return db[_0xaba8('0x2c')]['destroy']({'where':{'membername':_0x3a3a08[_0xaba8('0x28')]},'individualHooks':!![]});}})[_0xaba8('0x10')](function(){if(_0x3a3a08){return _0x3a3a08['getVoiceQueues']({'raw':!![]});}})[_0xaba8('0x10')](function(_0x166fd1){if(_0x3a3a08){if(_0x166fd1){var _0x3f5548=[];_0x4dd606=_0x166fd1;if(_0x4dd606[_0xaba8('0x30')]){for(var _0x23597d=0x0;_0x23597d<_0x4dd606[_0xaba8('0x30')];_0x23597d++){_0x3f5548[_0xaba8('0x34')](db[_0xaba8('0x2c')][_0xaba8('0x53')]({'membername':_0x3a3a08[_0xaba8('0x28')],'UserId':_0x3a3a08['id'],'queue_name':_0x4dd606[_0x23597d]['name'],'VoiceQueueId':_0x4dd606[_0x23597d]['id'],'interface':_0x2ffa47,'paused':_0x3a3a08['loginInPause']||![],'penalty':_0x4dd606[_0x23597d][_0xaba8('0x54')]||0x0}));}return BPromise[_0xaba8('0x48')](_0x3f5548);}}}})['then'](function(){if(_0x3a3a08){return db[_0xaba8('0x2e')][_0xaba8('0x1c')]({'where':{'membername':_0x3a3a08[_0xaba8('0x28')],'exitAt':null}});}})[_0xaba8('0x10')](function(_0x3c7190){if(_0x3a3a08){if(_0x3c7190&&_0x3c7190['length']){var _0x49ae8f=[];_0x3c7190[_0xaba8('0x33')](function(_0x8f80b3){_0x49ae8f[_0xaba8('0x34')](_0x8f80b3['update']({'exitAt':moment()['format'](_0xaba8('0x36'))}));});return BPromise[_0xaba8('0x48')](_0x49ae8f);}}})[_0xaba8('0x10')](function(_0x263b05){if(_0x3a3a08){var _0x41c298=[];var _0x3bc11f=[];var _0x3da2eb=utils[_0xaba8('0x32')]();var _0x197b47={'membername':_0x3a3a08[_0xaba8('0x28')],'interface':_0x2ffa47,'enterAt':moment()['format'](_0xaba8('0x36')),'role':_0x3a3a08[_0xaba8('0x29')],'internal':_0x3a3a08['internal']};_0x3da2eb[_0xaba8('0x33')](function(_0x35998e){_0x41c298['push'](_[_0xaba8('0x55')]({'channel':_0x35998e,'type':_0xaba8('0x56'),'data1':'callysquare','data2':_0x2ffa47},_0x197b47));if(_0x3a3a08[_0xaba8('0x4c')]){_0x3bc11f[_0xaba8('0x34')](_['merge']({'channel':_0x35998e,'type':_0xaba8('0x2f'),'data1':_0xaba8('0x57')},_0x197b47));}});return db['MemberReport'][_0xaba8('0x58')](_0x41c298[_0xaba8('0x59')](_0x3bc11f),{'individualHooks':!![]});}})[_0xaba8('0x10')](function(){if(_0x3a3a08){return _0x3a3a08['update']({'online':!![],'lastLoginAt':moment()[_0xaba8('0x31')](_0xaba8('0x36')),'voicePause':_0x3a3a08[_0xaba8('0x4c')]||![],'mailPause':_0x3a3a08[_0xaba8('0x4c')]||![],'chatPause':_0x3a3a08[_0xaba8('0x4c')]||![],'faxPause':_0x3a3a08[_0xaba8('0x4c')]||![],'smsPause':_0x3a3a08[_0xaba8('0x4c')]||![],'openchannelPause':_0x3a3a08[_0xaba8('0x4c')]||![],'pauseType':_0x3a3a08['loginInPause']?_0xaba8('0x57'):null,'lastPauseAt':moment()[_0xaba8('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2ffa47});}})[_0xaba8('0x10')](function(_0x545569){_0x2ce33d(_0x545569);})[_0xaba8('0x19')](function(_0x1900f9){_0x3b515f(_0x3e9faf['error'](0x1f4,_0x1900f9[_0xaba8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d3c3912..1e53202 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 _0xf3c4=['remove','update','emit','register','length','./user.events','save'];(function(_0x36fe00,_0x3ff5d0){var _0x34e1c2=function(_0xc7dc03){while(--_0xc7dc03){_0x36fe00['push'](_0x36fe00['shift']());}};_0x34e1c2(++_0x3ff5d0);}(_0xf3c4,0x10f));var _0x4f3c=function(_0x47da0d,_0x34dbae){_0x47da0d=_0x47da0d-0x0;var _0x39996d=_0xf3c4[_0x47da0d];return _0x39996d;};'use strict';var UserEvents=require(_0x4f3c('0x0'));var events=[_0x4f3c('0x1'),_0x4f3c('0x2'),_0x4f3c('0x3')];function createListener(_0x175c91,_0x2868c8){return function(_0x4dec20){_0x2868c8[_0x4f3c('0x4')](_0x175c91,_0x4dec20);};}function removeListener(_0x531161,_0x3e5caa){return function(){UserEvents['removeListener'](_0x531161,_0x3e5caa);};}exports[_0x4f3c('0x5')]=function(_0x2b89ce){for(var _0x5e0663=0x0,_0x554864=events[_0x4f3c('0x6')];_0x5e0663<_0x554864;_0x5e0663++){var _0x515463=events[_0x5e0663];var _0x1fb86c=createListener('user:'+_0x515463,_0x2b89ce);UserEvents['on'](_0x515463,_0x1fb86c);}}; \ No newline at end of file +var _0x31b0=['emit','removeListener','length','user:','./user.events','save'];(function(_0x656f5c,_0x91ffe7){var _0x2beab5=function(_0x314c9b){while(--_0x314c9b){_0x656f5c['push'](_0x656f5c['shift']());}};_0x2beab5(++_0x91ffe7);}(_0x31b0,0x17e));var _0x031b=function(_0x55f343,_0x3abab8){_0x55f343=_0x55f343-0x0;var _0x56c0ef=_0x31b0[_0x55f343];return _0x56c0ef;};'use strict';var UserEvents=require(_0x031b('0x0'));var events=[_0x031b('0x1'),'remove','update'];function createListener(_0x22503f,_0x4057a0){return function(_0x34643b){_0x4057a0[_0x031b('0x2')](_0x22503f,_0x34643b);};}function removeListener(_0xb34993,_0x1f13c1){return function(){UserEvents[_0x031b('0x3')](_0xb34993,_0x1f13c1);};}exports['register']=function(_0x52c5f9){for(var _0xaa5679=0x0,_0x2e5b59=events[_0x031b('0x4')];_0xaa5679<_0x2e5b59;_0xaa5679++){var _0x1ec052=events[_0xaa5679];var _0x1e884b=createListener(_0x031b('0x5')+_0x1ec052,_0x52c5f9);UserEvents['on'](_0x1ec052,_0x1e884b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 973a4e4..efd3729 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 _0x98a1=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x373225,_0x53ec06){var _0x56c9aa=function(_0x1e6f64){while(--_0x1e6f64){_0x373225['push'](_0x373225['shift']());}};_0x56c9aa(++_0x53ec06);}(_0x98a1,0x14a));var _0x198a=function(_0x3de41f,_0x4848d0){_0x3de41f=_0x3de41f-0x0;var _0x36f574=_0x98a1[_0x3de41f];return _0x36f574;};'use strict';var multer=require('multer');var util=require(_0x198a('0x0'));var path=require(_0x198a('0x1'));var timeout=require(_0x198a('0x2'));var express=require(_0x198a('0x3'));var router=express[_0x198a('0x4')]();var auth=require(_0x198a('0x5'));var interaction=require(_0x198a('0x6'));var config=require(_0x198a('0x7'));module[_0x198a('0x8')]=router; \ No newline at end of file +var _0x6594=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x6594,0x13e));var _0x4659=function(_0x3cb051,_0x3aac86){_0x3cb051=_0x3cb051-0x0;var _0x21dd99=_0x6594[_0x3cb051];return _0x21dd99;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4659('0x0'));var timeout=require('connect-timeout');var express=require(_0x4659('0x1'));var router=express[_0x4659('0x2')]();var auth=require(_0x4659('0x3'));var interaction=require(_0x4659('0x4'));var config=require(_0x4659('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 3e38ae7..ddc7df8 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 _0xd8b0=['exports','sequelize'];(function(_0x139a25,_0x1707d7){var _0x330a62=function(_0x3092b4){while(--_0x3092b4){_0x139a25['push'](_0x139a25['shift']());}};_0x330a62(++_0x1707d7);}(_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(_0x4d9d70,_0x471108){var _0x13c333=function(_0x13eab8){while(--_0x13eab8){_0x4d9d70['push'](_0x4d9d70['shift']());}};_0x13c333(++_0x471108);}(_0xe706,0xa3));var _0x6e70=function(_0x199b64,_0x5d1120){_0x199b64=_0x199b64-0x0;var _0x42b220=_0xe706[_0x199b64];return _0x42b220;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index d671925..1a8655b 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 _0x4d00=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x4d00,0x9f));var _0x04d0=function(_0x4d7d3d,_0x590306){_0x4d7d3d=_0x4d7d3d-0x0;var _0x372fa2=_0x4d00[_0x4d7d3d];return _0x372fa2;};'use strict';var _=require(_0x04d0('0x0'));var util=require('util');var logger=require(_0x04d0('0x1'))('api');var moment=require(_0x04d0('0x2'));var BPromise=require(_0x04d0('0x3'));var rp=require(_0x04d0('0x4'));var fs=require('fs');var path=require(_0x04d0('0x5'));var rimraf=require('rimraf');var config=require(_0x04d0('0x6'));var attributes=require(_0x04d0('0x7'));module[_0x04d0('0x8')]=function(_0x366ab0,_0x42369c){return _0x366ab0[_0x04d0('0x9')](_0x04d0('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53d9=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','api','moment','bluebird','path'];(function(_0x4c7f8,_0x2bfb43){var _0x4d9525=function(_0x6a5e4d){while(--_0x6a5e4d){_0x4c7f8['push'](_0x4c7f8['shift']());}};_0x4d9525(++_0x2bfb43);}(_0x53d9,0x97));var _0x953d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x953d('0x0'));var logger=require('../../config/logger')(_0x953d('0x1'));var moment=require(_0x953d('0x2'));var BPromise=require(_0x953d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x953d('0x4'));var rimraf=require(_0x953d('0x5'));var config=require(_0x953d('0x6'));var attributes=require(_0x953d('0x7'));module[_0x953d('0x8')]=function(_0x171100,_0x2f2ab7){return _0x171100[_0x953d('0x9')](_0x953d('0xa'),attributes,{'tableName':_0x953d('0xb'),'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 ccc5912..6805886 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 _0x564d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x216d4a,_0x3bd34d){var _0x512f2d=function(_0x17b14b){while(--_0x17b14b){_0x216d4a['push'](_0x216d4a['shift']());}};_0x512f2d(++_0x3bd34d);}(_0x564d,0xeb));var _0xd564=function(_0x4da196,_0x357dc9){_0x4da196=_0x4da196-0x0;var _0x375df3=_0x564d[_0x4da196];return _0x375df3;};'use strict';var _=require(_0xd564('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd564('0x1'));var rs=require(_0xd564('0x2'));var fs=require('fs');var Redis=require(_0xd564('0x3'));var db=require(_0xd564('0x4'))['db'];var utils=require(_0xd564('0x5'));var logger=require(_0xd564('0x6'))(_0xd564('0x7'));var config=require(_0xd564('0x8'));var jayson=require(_0xd564('0x9'));var client=jayson[_0xd564('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x432b7c,_0x945ef3,_0x31bff7){return new BPromise(function(_0x20b24a,_0x447136){return client[_0xd564('0xb')](_0x432b7c,_0x31bff7)[_0xd564('0xc')](function(_0x1f73f4){logger['info'](_0xd564('0xd'),_0x945ef3,'request\x20sent');logger[_0xd564('0xe')](_0xd564('0xf'),_0x945ef3,'request\x20sent',JSON[_0xd564('0x10')](_0x1f73f4));if(_0x1f73f4[_0xd564('0x11')]){if(_0x1f73f4['error'][_0xd564('0x12')]===0x1f4){logger[_0xd564('0x11')](_0xd564('0xd'),_0x945ef3,_0x1f73f4['error']['message']);return _0x447136(_0x1f73f4[_0xd564('0x11')][_0xd564('0x13')]);}logger[_0xd564('0x11')](_0xd564('0xd'),_0x945ef3,_0x1f73f4['error']['message']);return _0x20b24a(_0x1f73f4[_0xd564('0x11')][_0xd564('0x13')]);}else{logger[_0xd564('0x14')](_0xd564('0xd'),_0x945ef3,_0xd564('0x15'));_0x20b24a(_0x1f73f4[_0xd564('0x16')][_0xd564('0x13')]);}})[_0xd564('0x17')](function(_0x3b958e){logger[_0xd564('0x11')](_0xd564('0xd'),_0x945ef3,_0x3b958e);_0x447136(_0x3b958e);});});} \ No newline at end of file +var _0x87ac=['request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','debug'];(function(_0x17a754,_0x5f1052){var _0x545d3e=function(_0x24ec39){while(--_0x24ec39){_0x17a754['push'](_0x17a754['shift']());}};_0x545d3e(++_0x5f1052);}(_0x87ac,0x150));var _0xc87a=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x87ac[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require(_0xc87a('0x0'));var util=require(_0xc87a('0x1'));var moment=require(_0xc87a('0x2'));var BPromise=require(_0xc87a('0x3'));var rs=require(_0xc87a('0x4'));var fs=require('fs');var Redis=require(_0xc87a('0x5'));var db=require(_0xc87a('0x6'))['db'];var utils=require(_0xc87a('0x7'));var logger=require('../../config/logger')(_0xc87a('0x8'));var config=require('../../config/environment');var jayson=require(_0xc87a('0x9'));var client=jayson[_0xc87a('0xa')][_0xc87a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e766,_0x251029,_0x50fa5d){return new BPromise(function(_0x9e7a9b,_0x17ada5){return client[_0xc87a('0xc')](_0x19e766,_0x50fa5d)['then'](function(_0x542260){logger[_0xc87a('0xd')](_0xc87a('0xe'),_0x251029,'request\x20sent');logger[_0xc87a('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x251029,_0xc87a('0x10'),JSON[_0xc87a('0x11')](_0x542260));if(_0x542260[_0xc87a('0x12')]){if(_0x542260['error'][_0xc87a('0x13')]===0x1f4){logger[_0xc87a('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x251029,_0x542260[_0xc87a('0x12')][_0xc87a('0x14')]);return _0x17ada5(_0x542260[_0xc87a('0x12')][_0xc87a('0x14')]);}logger[_0xc87a('0x12')](_0xc87a('0xe'),_0x251029,_0x542260[_0xc87a('0x12')][_0xc87a('0x14')]);return _0x9e7a9b(_0x542260[_0xc87a('0x12')][_0xc87a('0x14')]);}else{logger[_0xc87a('0xd')](_0xc87a('0xe'),_0x251029,_0xc87a('0x10'));_0x9e7a9b(_0x542260[_0xc87a('0x15')]['message']);}})['catch'](function(_0x4742d5){logger[_0xc87a('0x12')](_0xc87a('0xe'),_0x251029,_0x4742d5);_0x17ada5(_0x4742d5);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f83ae04..2080a02 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 _0x1ab7=['connect-timeout','express','Router','../../components/interaction/service','path'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x1ab7,0x81));var _0x71ab=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x1ab7[_0x5a7f64];return _0x3d30f1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x71ab('0x0'));var timeout=require(_0x71ab('0x1'));var express=require(_0x71ab('0x2'));var router=express[_0x71ab('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x71ab('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xe75f=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0xe75f,0x11e));var _0xfe75=function(_0x363404,_0x862469){_0x363404=_0x363404-0x0;var _0x2d415b=_0xe75f[_0x363404];return _0x2d415b;};'use strict';var multer=require(_0xfe75('0x0'));var util=require(_0xfe75('0x1'));var path=require(_0xfe75('0x2'));var timeout=require(_0xfe75('0x3'));var express=require('express');var router=express[_0xfe75('0x4')]();var auth=require(_0xfe75('0x5'));var interaction=require(_0xfe75('0x6'));var config=require(_0xfe75('0x7'));module[_0xfe75('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b185b2a..521d554 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 _0x2547=['INTEGER','STRING','exports'];(function(_0x47ef28,_0x27da08){var _0x23a06d=function(_0x3d498e){while(--_0x3d498e){_0x47ef28['push'](_0x47ef28['shift']());}};_0x23a06d(++_0x27da08);}(_0x2547,0x1cd));var _0x7254=function(_0x588dc6,_0x421186){_0x588dc6=_0x588dc6-0x0;var _0x10427d=_0x2547[_0x588dc6];return _0x10427d;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'penalty':{'type':Sequelize[_0x7254('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7254('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7254('0x2')]}}; \ No newline at end of file +var _0x0598=['exports','INTEGER','sequelize'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x0598,0x92));var _0x8059=function(_0x4fa7f1,_0x3b4cd8){_0x4fa7f1=_0x4fa7f1-0x0;var _0x1653fd=_0x0598[_0x4fa7f1];return _0x1653fd;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8059('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5d835a5..6818f10 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x269e23,_0x14d11c){var _0x69ad53=function(_0x34066c){while(--_0x34066c){_0x269e23['push'](_0x269e23['shift']());}};_0x69ad53(++_0x14d11c);}(_0xb10b,0x12a));var _0xbb10=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0xb10b[_0x402731];return _0x111736;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment'];(function(_0x4e9833,_0x39fc6c){var _0x83856d=function(_0x1965e4){while(--_0x1965e4){_0x4e9833['push'](_0x4e9833['shift']());}};_0x83856d(++_0x39fc6c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x242b15,_0x546fe1){_0x242b15=_0x242b15-0x0;var _0x40443a=_0x5f2f[_0x242b15];return _0x40443a;};'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 diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index b1fc182..7c9a4c6 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 _0x4996=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4d9487,_0x486daf){var _0x2995a6=function(_0x53cfa9){while(--_0x53cfa9){_0x4d9487['push'](_0x4d9487['shift']());}};_0x2995a6(++_0x486daf);}(_0x4996,0x173));var _0x6499=function(_0x26018c,_0x3c0903){_0x26018c=_0x26018c-0x0;var _0x1efc45=_0x4996[_0x26018c];return _0x1efc45;};'use strict';var _=require(_0x6499('0x0'));var util=require(_0x6499('0x1'));var moment=require(_0x6499('0x2'));var BPromise=require(_0x6499('0x3'));var rs=require(_0x6499('0x4'));var fs=require('fs');var Redis=require(_0x6499('0x5'));var db=require(_0x6499('0x6'))['db'];var utils=require(_0x6499('0x7'));var logger=require(_0x6499('0x8'))('rpc');var config=require(_0x6499('0x9'));var jayson=require(_0x6499('0xa'));var client=jayson[_0x6499('0xb')][_0x6499('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x501eba,_0x4cdc5d,_0x492239){return new BPromise(function(_0x50e7eb,_0x33338f){return client[_0x6499('0xd')](_0x501eba,_0x492239)[_0x6499('0xe')](function(_0x4c1611){logger[_0x6499('0xf')](_0x6499('0x10'),_0x4cdc5d,'request\x20sent');logger['debug'](_0x6499('0x11'),_0x4cdc5d,_0x6499('0x12'),JSON[_0x6499('0x13')](_0x4c1611));if(_0x4c1611[_0x6499('0x14')]){if(_0x4c1611[_0x6499('0x14')][_0x6499('0x15')]===0x1f4){logger[_0x6499('0x14')](_0x6499('0x10'),_0x4cdc5d,_0x4c1611[_0x6499('0x14')]['message']);return _0x33338f(_0x4c1611['error']['message']);}logger[_0x6499('0x14')](_0x6499('0x10'),_0x4cdc5d,_0x4c1611[_0x6499('0x14')][_0x6499('0x16')]);return _0x50e7eb(_0x4c1611[_0x6499('0x14')][_0x6499('0x16')]);}else{logger[_0x6499('0xf')](_0x6499('0x10'),_0x4cdc5d,_0x6499('0x12'));_0x50e7eb(_0x4c1611[_0x6499('0x17')]['message']);}})[_0x6499('0x18')](function(_0x44fb0f){logger['error'](_0x6499('0x10'),_0x4cdc5d,_0x44fb0f);_0x33338f(_0x44fb0f);});});} \ No newline at end of file +var _0x2ab3=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x2ab3,0x162));var _0x32ab=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x2ab3[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x32ab('0x0'));var util=require(_0x32ab('0x1'));var moment=require('moment');var BPromise=require(_0x32ab('0x2'));var rs=require(_0x32ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32ab('0x4'));var logger=require(_0x32ab('0x5'))(_0x32ab('0x6'));var config=require(_0x32ab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ab('0x8')][_0x32ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x120976,_0x33f936,_0x195824){return new BPromise(function(_0x23bd19,_0x433caa){return client[_0x32ab('0xa')](_0x120976,_0x195824)[_0x32ab('0xb')](function(_0x238b6b){logger[_0x32ab('0xc')](_0x32ab('0xd'),_0x33f936,_0x32ab('0xe'));logger['debug'](_0x32ab('0xf'),_0x33f936,_0x32ab('0xe'),JSON['stringify'](_0x238b6b));if(_0x238b6b[_0x32ab('0x10')]){if(_0x238b6b[_0x32ab('0x10')][_0x32ab('0x11')]===0x1f4){logger[_0x32ab('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x33f936,_0x238b6b[_0x32ab('0x10')][_0x32ab('0x12')]);return _0x433caa(_0x238b6b[_0x32ab('0x10')][_0x32ab('0x12')]);}logger[_0x32ab('0x10')](_0x32ab('0xd'),_0x33f936,_0x238b6b['error'][_0x32ab('0x12')]);return _0x23bd19(_0x238b6b[_0x32ab('0x10')][_0x32ab('0x12')]);}else{logger[_0x32ab('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x33f936,_0x32ab('0xe'));_0x23bd19(_0x238b6b[_0x32ab('0x13')][_0x32ab('0x12')]);}})[_0x32ab('0x14')](function(_0x2d830a){logger['error'](_0x32ab('0xd'),_0x33f936,_0x2d830a);_0x433caa(_0x2d830a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 17ef598..16b0d9a 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 _0x1497=['exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40e336,_0x52ada1){var _0x48918b=function(_0x2ee11d){while(--_0x2ee11d){_0x40e336['push'](_0x40e336['shift']());}};_0x48918b(++_0x52ada1);}(_0x1497,0x19e));var _0x7149=function(_0x216f4f,_0x19cdbd){_0x216f4f=_0x216f4f-0x0;var _0x4e237f=_0x1497[_0x216f4f];return _0x4e237f;};'use strict';var multer=require('multer');var util=require(_0x7149('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7149('0x1'));var router=express[_0x7149('0x2')]();var auth=require(_0x7149('0x3'));var interaction=require(_0x7149('0x4'));var config=require(_0x7149('0x5'));module[_0x7149('0x6')]=router; \ No newline at end of file +var _0xd49c=['../../components/auth/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x2f08be,_0x3a01e3){var _0x39bc5e=function(_0x327811){while(--_0x327811){_0x2f08be['push'](_0x2f08be['shift']());}};_0x39bc5e(++_0x3a01e3);}(_0xd49c,0x145));var _0xcd49=function(_0x1e7f98,_0x5b23d9){_0x1e7f98=_0x1e7f98-0x0;var _0x70d2ae=_0xd49c[_0x1e7f98];return _0x70d2ae;};'use strict';var multer=require(_0xcd49('0x0'));var util=require(_0xcd49('0x1'));var path=require('path');var timeout=require(_0xcd49('0x2'));var express=require(_0xcd49('0x3'));var router=express['Router']();var auth=require(_0xcd49('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd49('0x5'));module[_0xcd49('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 665509e..62c71d7 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x2a5ecd,_0x1a6e00){var _0x494c1a=function(_0x554ed4){while(--_0x554ed4){_0x2a5ecd['push'](_0x2a5ecd['shift']());}};_0x494c1a(++_0x1a6e00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x587d3b,_0x2f4c9c){var _0x47ca1a=function(_0x3adc5a){while(--_0x3adc5a){_0x587d3b['push'](_0x587d3b['shift']());}};_0x47ca1a(++_0x2f4c9c);}(_0xe706,0xa3));var _0x6e70=function(_0x2ada99,_0x4ea2aa){_0x2ada99=_0x2ada99-0x0;var _0x5447e5=_0xe706[_0x2ada99];return _0x5447e5;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 2141439..1f7d0b7 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(_0x1bb0ff,_0x38d697){var _0x58ef2c=function(_0x41e9b4){while(--_0x41e9b4){_0x1bb0ff['push'](_0x1bb0ff['shift']());}};_0x58ef2c(++_0x38d697);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x10eace,_0x290e2b){var _0x2a42f8=function(_0x20e344){while(--_0x20e344){_0x10eace['push'](_0x10eace['shift']());}};_0x2a42f8(++_0x290e2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 5eda505..d5ab52f 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 _0x7e3e=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x39a15f,_0x36c3d6){var _0x158e44=function(_0x583057){while(--_0x583057){_0x39a15f['push'](_0x39a15f['shift']());}};_0x158e44(++_0x36c3d6);}(_0x7e3e,0x126));var _0xe7e3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7e3e[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xe7e3('0x0'));var util=require('util');var moment=require(_0xe7e3('0x1'));var BPromise=require(_0xe7e3('0x2'));var rs=require(_0xe7e3('0x3'));var fs=require('fs');var Redis=require(_0xe7e3('0x4'));var db=require(_0xe7e3('0x5'))['db'];var utils=require(_0xe7e3('0x6'));var logger=require(_0xe7e3('0x7'))(_0xe7e3('0x8'));var config=require(_0xe7e3('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x416828,_0x1551aa,_0x202718){return new BPromise(function(_0x49470f,_0x45ac24){return client[_0xe7e3('0xa')](_0x416828,_0x202718)[_0xe7e3('0xb')](function(_0x1f114c){logger[_0xe7e3('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x1551aa,_0xe7e3('0xd'));logger[_0xe7e3('0xe')](_0xe7e3('0xf'),_0x1551aa,_0xe7e3('0xd'),JSON['stringify'](_0x1f114c));if(_0x1f114c[_0xe7e3('0x10')]){if(_0x1f114c[_0xe7e3('0x10')][_0xe7e3('0x11')]===0x1f4){logger[_0xe7e3('0x10')](_0xe7e3('0x12'),_0x1551aa,_0x1f114c[_0xe7e3('0x10')][_0xe7e3('0x13')]);return _0x45ac24(_0x1f114c[_0xe7e3('0x10')]['message']);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x1551aa,_0x1f114c[_0xe7e3('0x10')][_0xe7e3('0x13')]);return _0x49470f(_0x1f114c[_0xe7e3('0x10')]['message']);}else{logger[_0xe7e3('0xc')](_0xe7e3('0x12'),_0x1551aa,_0xe7e3('0xd'));_0x49470f(_0x1f114c[_0xe7e3('0x14')][_0xe7e3('0x13')]);}})['catch'](function(_0x1c3878){logger[_0xe7e3('0x10')](_0xe7e3('0x12'),_0x1551aa,_0x1c3878);_0x45ac24(_0x1c3878);});});} \ No newline at end of file +var _0xcf71=['then','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4a8bf1,_0x4c15b9){var _0x5cb38e=function(_0xbef27b){while(--_0xbef27b){_0x4a8bf1['push'](_0x4a8bf1['shift']());}};_0x5cb38e(++_0x4c15b9);}(_0xcf71,0xba));var _0x1cf7=function(_0x4441cf,_0x4509a6){_0x4441cf=_0x4441cf-0x0;var _0x3b8877=_0xcf71[_0x4441cf];return _0x3b8877;};'use strict';var _=require(_0x1cf7('0x0'));var util=require(_0x1cf7('0x1'));var moment=require(_0x1cf7('0x2'));var BPromise=require(_0x1cf7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cf7('0x4'));var db=require(_0x1cf7('0x5'))['db'];var utils=require(_0x1cf7('0x6'));var logger=require(_0x1cf7('0x7'))(_0x1cf7('0x8'));var config=require(_0x1cf7('0x9'));var jayson=require(_0x1cf7('0xa'));var client=jayson[_0x1cf7('0xb')][_0x1cf7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45ee6b,_0x2de84d,_0x19b626){return new BPromise(function(_0x4f908a,_0x52c8c8){return client[_0x1cf7('0xd')](_0x45ee6b,_0x19b626)[_0x1cf7('0xe')](function(_0x406ba0){logger['info'](_0x1cf7('0xf'),_0x2de84d,'request\x20sent');logger['debug'](_0x1cf7('0x10'),_0x2de84d,_0x1cf7('0x11'),JSON[_0x1cf7('0x12')](_0x406ba0));if(_0x406ba0[_0x1cf7('0x13')]){if(_0x406ba0[_0x1cf7('0x13')][_0x1cf7('0x14')]===0x1f4){logger['error'](_0x1cf7('0xf'),_0x2de84d,_0x406ba0['error'][_0x1cf7('0x15')]);return _0x52c8c8(_0x406ba0['error'][_0x1cf7('0x15')]);}logger[_0x1cf7('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x2de84d,_0x406ba0[_0x1cf7('0x13')][_0x1cf7('0x15')]);return _0x4f908a(_0x406ba0[_0x1cf7('0x13')][_0x1cf7('0x15')]);}else{logger[_0x1cf7('0x16')](_0x1cf7('0xf'),_0x2de84d,_0x1cf7('0x11'));_0x4f908a(_0x406ba0[_0x1cf7('0x17')][_0x1cf7('0x15')]);}})[_0x1cf7('0x18')](function(_0x2a3671){logger[_0x1cf7('0x13')](_0x1cf7('0xf'),_0x2de84d,_0x2a3671);_0x52c8c8(_0x2a3671);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 56b50a7..acccf0f 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 _0x0b37=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x24002e,_0x2e7e6a){var _0x1a2115=function(_0x4da565){while(--_0x4da565){_0x24002e['push'](_0x24002e['shift']());}};_0x1a2115(++_0x2e7e6a);}(_0x0b37,0x187));var _0x70b3=function(_0x26b0c2,_0x72a4d4){_0x26b0c2=_0x26b0c2-0x0;var _0x537d84=_0x0b37[_0x26b0c2];return _0x537d84;};'use strict';var multer=require(_0x70b3('0x0'));var util=require('util');var path=require(_0x70b3('0x1'));var timeout=require(_0x70b3('0x2'));var express=require('express');var router=express[_0x70b3('0x3')]();var auth=require(_0x70b3('0x4'));var interaction=require(_0x70b3('0x5'));var config=require('../../config/environment');module[_0x70b3('0x6')]=router; \ No newline at end of file +var _0x98f1=['exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c2558,_0x5753be){var _0x527cfb=function(_0x9c5ba2){while(--_0x9c5ba2){_0x1c2558['push'](_0x1c2558['shift']());}};_0x527cfb(++_0x5753be);}(_0x98f1,0x1dd));var _0x198f=function(_0x10921d,_0x242a14){_0x10921d=_0x10921d-0x0;var _0x163ca1=_0x98f1[_0x10921d];return _0x163ca1;};'use strict';var multer=require('multer');var util=require(_0x198f('0x0'));var path=require(_0x198f('0x1'));var timeout=require('connect-timeout');var express=require(_0x198f('0x2'));var router=express['Router']();var auth=require(_0x198f('0x3'));var interaction=require(_0x198f('0x4'));var config=require(_0x198f('0x5'));module[_0x198f('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 14250db..826e2a1 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x3a8c91,_0x790f99){var _0x26e0c1=function(_0x14ec8c){while(--_0x14ec8c){_0x3a8c91['push'](_0x3a8c91['shift']());}};_0x26e0c1(++_0x790f99);}(_0xe706,0xa3));var _0x6e70=function(_0x3c0cd6,_0x5ba428){_0x3c0cd6=_0x3c0cd6-0x0;var _0x4381ec=_0xe706[_0x3c0cd6];return _0x4381ec;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2bc6e2,_0x421b11){var _0x241f27=function(_0x104432){while(--_0x104432){_0x2bc6e2['push'](_0x2bc6e2['shift']());}};_0x241f27(++_0x421b11);}(_0xe706,0xa3));var _0x6e70=function(_0x1bef07,_0x2a4e64){_0x1bef07=_0x1bef07-0x0;var _0x29edf6=_0xe706[_0x1bef07];return _0x29edf6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 4776347..e8bd4d3 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 _0x78b7=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','../../config/logger','request-promise'];(function(_0x204ed8,_0x17e799){var _0x14cbe8=function(_0x35f79f){while(--_0x35f79f){_0x204ed8['push'](_0x204ed8['shift']());}};_0x14cbe8(++_0x17e799);}(_0x78b7,0x1d1));var _0x778b=function(_0x2ded87,_0x231b5a){_0x2ded87=_0x2ded87-0x0;var _0x509c77=_0x78b7[_0x2ded87];return _0x509c77;};'use strict';var _=require(_0x778b('0x0'));var util=require('util');var logger=require(_0x778b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x778b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x778b('0x3'));var config=require(_0x778b('0x4'));var attributes=require(_0x778b('0x5'));module[_0x778b('0x6')]=function(_0x1eba49,_0x88a58e){return _0x1eba49[_0x778b('0x7')](_0x778b('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb53=['../../config/environment','define','UserOpenchannelQueue','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x249145,_0x124bcd){var _0x4da183=function(_0x4258a6){while(--_0x4258a6){_0x249145['push'](_0x249145['shift']());}};_0x4da183(++_0x124bcd);}(_0xeb53,0x174));var _0x3eb5=function(_0x274010,_0x2aecd1){_0x274010=_0x274010-0x0;var _0x19101e=_0xeb53[_0x274010];return _0x19101e;};'use strict';var _=require(_0x3eb5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3eb5('0x1'));var moment=require('moment');var BPromise=require(_0x3eb5('0x2'));var rp=require(_0x3eb5('0x3'));var fs=require('fs');var path=require(_0x3eb5('0x4'));var rimraf=require(_0x3eb5('0x5'));var config=require(_0x3eb5('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x3e08ff,_0x110dc6){return _0x3e08ff[_0x3eb5('0x7')](_0x3eb5('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 28539b1..fd0b310 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 _0x7d27=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x1e51a4,_0x1add61){var _0x2e77af=function(_0x890f83){while(--_0x890f83){_0x1e51a4['push'](_0x1e51a4['shift']());}};_0x2e77af(++_0x1add61);}(_0x7d27,0x144));var _0x77d2=function(_0x5247b5,_0x4086f4){_0x5247b5=_0x5247b5-0x0;var _0x2f177f=_0x7d27[_0x5247b5];return _0x2f177f;};'use strict';var _=require(_0x77d2('0x0'));var util=require('util');var moment=require(_0x77d2('0x1'));var BPromise=require(_0x77d2('0x2'));var rs=require(_0x77d2('0x3'));var fs=require('fs');var Redis=require(_0x77d2('0x4'));var db=require(_0x77d2('0x5'))['db'];var utils=require(_0x77d2('0x6'));var logger=require(_0x77d2('0x7'))('rpc');var config=require(_0x77d2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77d2('0x9')][_0x77d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d2de2,_0x135d29,_0xd97e63){return new BPromise(function(_0x3b900d,_0x1bfcdf){return client[_0x77d2('0xb')](_0x5d2de2,_0xd97e63)[_0x77d2('0xc')](function(_0x2e0fef){logger[_0x77d2('0xd')](_0x77d2('0xe'),_0x135d29,_0x77d2('0xf'));logger['debug'](_0x77d2('0x10'),_0x135d29,_0x77d2('0xf'),JSON['stringify'](_0x2e0fef));if(_0x2e0fef[_0x77d2('0x11')]){if(_0x2e0fef[_0x77d2('0x11')][_0x77d2('0x12')]===0x1f4){logger[_0x77d2('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x135d29,_0x2e0fef['error'][_0x77d2('0x13')]);return _0x1bfcdf(_0x2e0fef[_0x77d2('0x11')][_0x77d2('0x13')]);}logger[_0x77d2('0x11')](_0x77d2('0xe'),_0x135d29,_0x2e0fef[_0x77d2('0x11')][_0x77d2('0x13')]);return _0x3b900d(_0x2e0fef[_0x77d2('0x11')][_0x77d2('0x13')]);}else{logger[_0x77d2('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x135d29,_0x77d2('0xf'));_0x3b900d(_0x2e0fef['result'][_0x77d2('0x13')]);}})[_0x77d2('0x14')](function(_0x43e990){logger['error'](_0x77d2('0xe'),_0x135d29,_0x43e990);_0x1bfcdf(_0x43e990);});});} \ No newline at end of file +var _0x49fa=['debug','stringify','error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49fa,0x1f4));var _0xa49f=function(_0x9fb6f8,_0x4277b7){_0x9fb6f8=_0x9fb6f8-0x0;var _0x32089f=_0x49fa[_0x9fb6f8];return _0x32089f;};'use strict';var _=require(_0xa49f('0x0'));var util=require(_0xa49f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa49f('0x2'));var db=require(_0xa49f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa49f('0x4'))(_0xa49f('0x5'));var config=require('../../config/environment');var jayson=require(_0xa49f('0x6'));var client=jayson[_0xa49f('0x7')][_0xa49f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f8cf8,_0x59030f,_0xec9a91){return new BPromise(function(_0x3327f7,_0x313419){return client[_0xa49f('0x9')](_0x3f8cf8,_0xec9a91)[_0xa49f('0xa')](function(_0x32ec9a){logger['info'](_0xa49f('0xb'),_0x59030f,_0xa49f('0xc'));logger[_0xa49f('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x59030f,_0xa49f('0xc'),JSON[_0xa49f('0xe')](_0x32ec9a));if(_0x32ec9a[_0xa49f('0xf')]){if(_0x32ec9a[_0xa49f('0xf')]['code']===0x1f4){logger[_0xa49f('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x59030f,_0x32ec9a['error'][_0xa49f('0x10')]);return _0x313419(_0x32ec9a[_0xa49f('0xf')]['message']);}logger[_0xa49f('0xf')](_0xa49f('0xb'),_0x59030f,_0x32ec9a[_0xa49f('0xf')][_0xa49f('0x10')]);return _0x3327f7(_0x32ec9a[_0xa49f('0xf')][_0xa49f('0x10')]);}else{logger['info'](_0xa49f('0xb'),_0x59030f,_0xa49f('0xc'));_0x3327f7(_0x32ec9a[_0xa49f('0x11')]['message']);}})[_0xa49f('0x12')](function(_0x2d34e4){logger['error'](_0xa49f('0xb'),_0x59030f,_0x2d34e4);_0x313419(_0x2d34e4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index cd571a9..c586712 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 _0x59fa=['/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59fa,0x196));var _0xa59f=function(_0x15977b,_0x4d3413){_0x15977b=_0x15977b-0x0;var _0x47ad28=_0x59fa[_0x15977b];return _0x47ad28;};'use strict';var multer=require(_0xa59f('0x0'));var util=require(_0xa59f('0x1'));var path=require(_0xa59f('0x2'));var timeout=require('connect-timeout');var express=require(_0xa59f('0x3'));var router=express['Router']();var auth=require(_0xa59f('0x4'));var interaction=require(_0xa59f('0x5'));var config=require(_0xa59f('0x6'));var controller=require(_0xa59f('0x7'));router[_0xa59f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa59f('0x8')](_0xa59f('0x9'),auth[_0xa59f('0xa')](),controller[_0xa59f('0xb')]);router['get'](_0xa59f('0xc'),auth[_0xa59f('0xa')](),controller[_0xa59f('0xd')]);router['get'](_0xa59f('0xe'),auth[_0xa59f('0xa')](),controller[_0xa59f('0xf')]);router[_0xa59f('0x8')](_0xa59f('0x10'),auth[_0xa59f('0xa')](),controller[_0xa59f('0x11')]);router[_0xa59f('0x12')]('/',auth['isAuthenticated'](),controller[_0xa59f('0x13')]);router[_0xa59f('0x12')](_0xa59f('0x14'),auth['isAuthenticated'](),controller['clone']);router[_0xa59f('0x12')](_0xa59f('0xe'),auth['isAuthenticated'](),controller[_0xa59f('0x15')]);router[_0xa59f('0x12')](_0xa59f('0x10'),auth[_0xa59f('0xa')](),controller[_0xa59f('0x16')]);router['put'](_0xa59f('0xc'),auth[_0xa59f('0xa')](),controller['update']);router[_0xa59f('0x17')]('/:id',auth[_0xa59f('0xa')](),controller[_0xa59f('0x18')]);router[_0xa59f('0x17')](_0xa59f('0xe'),auth[_0xa59f('0xa')](),controller[_0xa59f('0x19')]);router['delete'](_0xa59f('0x10'),auth[_0xa59f('0xa')](),controller[_0xa59f('0x1a')]);module[_0xa59f('0x1b')]=router; \ No newline at end of file +var _0x5973=['destroy','/:id/sections','removeSections','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','getSections','/:id/resources','getResources','post','create','addSections','addResources','update','delete'];(function(_0x4f77af,_0x5f5793){var _0x254a93=function(_0xff2b57){while(--_0xff2b57){_0x4f77af['push'](_0x4f77af['shift']());}};_0x254a93(++_0x5f5793);}(_0x5973,0x100));var _0x3597=function(_0x51c578,_0x4cb9bb){_0x51c578=_0x51c578-0x0;var _0x59d490=_0x5973[_0x51c578];return _0x59d490;};'use strict';var multer=require(_0x3597('0x0'));var util=require(_0x3597('0x1'));var path=require(_0x3597('0x2'));var timeout=require(_0x3597('0x3'));var express=require(_0x3597('0x4'));var router=express[_0x3597('0x5')]();var auth=require(_0x3597('0x6'));var interaction=require(_0x3597('0x7'));var config=require('../../config/environment');var controller=require(_0x3597('0x8'));router[_0x3597('0x9')]('/',auth[_0x3597('0xa')](),controller[_0x3597('0xb')]);router[_0x3597('0x9')](_0x3597('0xc'),auth[_0x3597('0xa')](),controller['describe']);router[_0x3597('0x9')](_0x3597('0xd'),auth[_0x3597('0xa')](),controller[_0x3597('0xe')]);router[_0x3597('0x9')]('/:id/sections',auth[_0x3597('0xa')](),controller[_0x3597('0xf')]);router[_0x3597('0x9')](_0x3597('0x10'),auth[_0x3597('0xa')](),controller[_0x3597('0x11')]);router[_0x3597('0x12')]('/',auth[_0x3597('0xa')](),controller[_0x3597('0x13')]);router[_0x3597('0x12')]('/:id/clone',auth[_0x3597('0xa')](),controller['clone']);router[_0x3597('0x12')]('/:id/sections',auth[_0x3597('0xa')](),controller[_0x3597('0x14')]);router[_0x3597('0x12')](_0x3597('0x10'),auth[_0x3597('0xa')](),controller[_0x3597('0x15')]);router['put'](_0x3597('0xd'),auth[_0x3597('0xa')](),controller[_0x3597('0x16')]);router[_0x3597('0x17')]('/:id',auth[_0x3597('0xa')](),controller[_0x3597('0x18')]);router[_0x3597('0x17')](_0x3597('0x19'),auth[_0x3597('0xa')](),controller[_0x3597('0x1a')]);router[_0x3597('0x17')](_0x3597('0x10'),auth[_0x3597('0xa')](),controller['removeResources']);module[_0x3597('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9d9e6be..30f45c5 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 _0xa7d7=['split','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xa7d7,0x149));var _0x7a7d=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xa7d7[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require('sequelize');module[_0x7a7d('0x0')]={'name':{'type':Sequelize[_0x7a7d('0x1')],'allowNull':![],'unique':_0x7a7d('0x2')},'crudPermissions':{'type':Sequelize[_0x7a7d('0x1')],'set':function(_0x1d4570){this[_0x7a7d('0x3')](_0x7a7d('0x4'),_0x1d4570?_0x1d4570[_0x7a7d('0x5')](''):[]);},'get':function(){return this[_0x7a7d('0x6')](_0x7a7d('0x4'))?this[_0x7a7d('0x6')]('crudPermissions')[_0x7a7d('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7a7d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xf2b6=['sequelize','exports','STRING','name','setDataValue','getDataValue','crudPermissions','split'];(function(_0x4fcbcc,_0x2bb417){var _0x3c7610=function(_0x37b231){while(--_0x37b231){_0x4fcbcc['push'](_0x4fcbcc['shift']());}};_0x3c7610(++_0x2bb417);}(_0xf2b6,0x178));var _0x6f2b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf2b6[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x6f2b('0x0'));module[_0x6f2b('0x1')]={'name':{'type':Sequelize[_0x6f2b('0x2')],'allowNull':![],'unique':_0x6f2b('0x3')},'crudPermissions':{'type':Sequelize[_0x6f2b('0x2')],'set':function(_0x5164ac){this[_0x6f2b('0x4')]('crudPermissions',_0x5164ac?_0x5164ac['join'](''):[]);},'get':function(){return this[_0x6f2b('0x5')]('crudPermissions')?this[_0x6f2b('0x5')](_0x6f2b('0x6'))[_0x6f2b('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9f4f23a..b1cb3cc 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 _0xda5f=['api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','update','then','destroy','error','stack','name','send','index','map','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','UserProfile','findAll','catch','show','params','rawAttributes','options','find','create','clone','length','get','omit','createdAt','crudPermissions','body','sequelize','transaction','each','autoAssociation','UserProfileResource','updatedAt','sectionId','Resources','UserProfileSection','describe','addSections','userProfileId','removeSections','getSections','enabled','includes','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','isEmpty','parentSections','all','union','ignore','childModel','order','key','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','default','reportId','DefaultReports','CustomReports','rows','CmContact','Tags','tag','ThroughTags','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','role','agent','Telephones','User','VoiceQueues','VoiceQueue','queue','outbound','musiconholds','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','telephones','user','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','templates','Template','triggers','Trigger','variables','Variable','extractedreports','Reports','metrics','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xda5f,0xd0));var _0xfda5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda5f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xfda5('0x0'));var emlformat=require(_0xfda5('0x1'));var rimraf=require(_0xfda5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfda5('0x3'));var rp=require(_0xfda5('0x4'));var moment=require(_0xfda5('0x5'));var BPromise=require(_0xfda5('0x6'));var Mustache=require(_0xfda5('0x7'));var util=require(_0xfda5('0x8'));var path=require(_0xfda5('0x9'));var sox=require(_0xfda5('0xa'));var csv=require(_0xfda5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfda5('0xc'));var crypto=require('crypto');var jsforce=require(_0xfda5('0xd'));var deskjs=require(_0xfda5('0xe'));var toCsv=require(_0xfda5('0xb'));var querystring=require(_0xfda5('0xf'));var Papa=require(_0xfda5('0x10'));var Redis=require(_0xfda5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfda5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfda5('0x13'))(_0xfda5('0x14'));var utils=require(_0xfda5('0x15'));var config=require(_0xfda5('0x16'));var db=require('../../mysqldb')['db'];config[_0xfda5('0x17')]=_[_0xfda5('0x18')](config[_0xfda5('0x17')],{'host':_0xfda5('0x19'),'port':0x18eb});var socket=require(_0xfda5('0x1a'))(new Redis(config[_0xfda5('0x17')]));require(_0xfda5('0x1b'))[_0xfda5('0x1c')](socket);function respondWithStatusCode(_0x132c01,_0x424e6b){_0x424e6b=_0x424e6b||0xcc;return function(_0x2f7aa4){if(_0x2f7aa4){return _0x132c01[_0xfda5('0x1d')](_0x424e6b);}return _0x132c01[_0xfda5('0x1e')](_0x424e6b)[_0xfda5('0x1f')]();};}function respondWithResult(_0x45078a,_0x2ab7fa){_0x2ab7fa=_0x2ab7fa||0xc8;return function(_0x5dfad9){if(_0x5dfad9){return _0x45078a['status'](_0x2ab7fa)['json'](_0x5dfad9);}};}function respondWithFilteredResult(_0x5dc2c1,_0x4c939e){return function(_0x374f4a){if(_0x374f4a){var _0x379e55=_0x374f4a[_0xfda5('0x20')],_0x835cd5=_0x4c939e['offset'],_0x162967=_0x4c939e[_0xfda5('0x21')]+_0x4c939e[_0xfda5('0x22')],_0x11d654;if(_0x162967>=_0x379e55){_0x162967=_0x379e55;_0x11d654=0xc8;}else{_0x11d654=0xce;}_0x5dc2c1[_0xfda5('0x1e')](_0x11d654);return _0x5dc2c1[_0xfda5('0x23')]('Content-Range',_0x835cd5+'-'+_0x162967+'/'+_0x379e55)[_0xfda5('0x24')](_0x374f4a);}return null;};}function patchUpdates(_0x14dfeb){return function(_0x39dee2){try{jsonpatch[_0xfda5('0x25')](_0x39dee2,_0x14dfeb,!![]);}catch(_0x4c0348){return BPromise['reject'](_0x4c0348);}return _0x39dee2['save']();};}function saveUpdates(_0x2e7055,_0x4dccbe){return function(_0x12ae69){if(_0x12ae69){return _0x12ae69[_0xfda5('0x26')](_0x2e7055)[_0xfda5('0x27')](function(_0x2211fb){return _0x2211fb;});}return null;};}function removeEntity(_0x447320,_0x18d2fb){return function(_0x461044){if(_0x461044){return _0x461044[_0xfda5('0x28')]()[_0xfda5('0x27')](function(){_0x447320[_0xfda5('0x1e')](0xcc)[_0xfda5('0x1f')]();});}};}function handleEntityNotFound(_0x59fba4,_0x309c9d){return function(_0x22be5a){if(!_0x22be5a){_0x59fba4[_0xfda5('0x1d')](0x194);}return _0x22be5a;};}function handleError(_0xc64b38,_0x53374b){_0x53374b=_0x53374b||0x1f4;return function(_0x558782){logger[_0xfda5('0x29')](_0x558782[_0xfda5('0x2a')]);if(_0x558782[_0xfda5('0x2b')]){delete _0x558782[_0xfda5('0x2b')];}_0xc64b38['status'](_0x53374b)[_0xfda5('0x2c')](_0x558782);};}exports[_0xfda5('0x2d')]=function(_0x2e3b84,_0x409b35){var _0x426608={},_0x1de587={},_0x4c9411={'count':0x0,'rows':[]};var _0x25d8d2=_[_0xfda5('0x2e')](db['UserProfile']['rawAttributes'],function(_0x46db99){return{'name':_0x46db99['fieldName'],'type':_0x46db99[_0xfda5('0x2f')]['key']};});_0x1de587[_0xfda5('0x30')]=_[_0xfda5('0x2e')](_0x25d8d2,_0xfda5('0x2b'));_0x1de587['query']=_[_0xfda5('0x31')](_0x2e3b84[_0xfda5('0x32')]);_0x1de587[_0xfda5('0x33')]=_[_0xfda5('0x34')](_0x1de587[_0xfda5('0x30')],_0x1de587['query']);_0x426608['attributes']=_[_0xfda5('0x34')](_0x1de587[_0xfda5('0x30')],qs[_0xfda5('0x35')](_0x2e3b84[_0xfda5('0x32')][_0xfda5('0x35')]));_0x426608[_0xfda5('0x36')]=_0x426608[_0xfda5('0x36')]['length']?_0x426608[_0xfda5('0x36')]:_0x1de587['model'];if(!_0x2e3b84[_0xfda5('0x32')][_0xfda5('0x37')](_0xfda5('0x38'))){_0x426608[_0xfda5('0x22')]=qs['limit'](_0x2e3b84[_0xfda5('0x32')][_0xfda5('0x22')]);_0x426608['offset']=qs[_0xfda5('0x21')](_0x2e3b84['query'][_0xfda5('0x21')]);}_0x426608['order']=qs['sort'](_0x2e3b84['query'][_0xfda5('0x39')]);_0x426608[_0xfda5('0x3a')]=qs[_0xfda5('0x33')](_[_0xfda5('0x3b')](_0x2e3b84['query'],_0x1de587[_0xfda5('0x33')]),_0x25d8d2);if(_0x2e3b84[_0xfda5('0x32')][_0xfda5('0x3c')]){_0x426608[_0xfda5('0x3a')]=_[_0xfda5('0x3d')](_0x426608[_0xfda5('0x3a')],{'$or':_[_0xfda5('0x2e')](_0x25d8d2,function(_0x1cc358){if(_0x1cc358[_0xfda5('0x2f')]!==_0xfda5('0x3e')){var _0x526c66={};_0x526c66[_0x1cc358[_0xfda5('0x2b')]]={'$like':'%'+_0x2e3b84[_0xfda5('0x32')]['filter']+'%'};return _0x526c66;}})});}_0x426608=_[_0xfda5('0x3d')]({},_0x426608,_0x2e3b84['options']);var _0x9159ff={'where':_0x426608[_0xfda5('0x3a')]};return db['UserProfile']['count'](_0x9159ff)['then'](function(_0x552948){_0x4c9411['count']=_0x552948;if(_0x2e3b84[_0xfda5('0x32')][_0xfda5('0x3f')]){_0x426608[_0xfda5('0x40')]=[{'all':!![]}];}return db[_0xfda5('0x41')][_0xfda5('0x42')](_0x426608);})[_0xfda5('0x27')](function(_0x3e6f5f){_0x4c9411['rows']=_0x3e6f5f;return _0x4c9411;})['then'](respondWithFilteredResult(_0x409b35,_0x426608))[_0xfda5('0x43')](handleError(_0x409b35,null));};exports[_0xfda5('0x44')]=function(_0x520324,_0x1f00cc){var _0x160822={'raw':![],'where':{'id':_0x520324[_0xfda5('0x45')]['id']}},_0x151f94={};_0x151f94[_0xfda5('0x30')]=_['keys'](db[_0xfda5('0x41')][_0xfda5('0x46')]);_0x151f94[_0xfda5('0x32')]=_[_0xfda5('0x31')](_0x520324[_0xfda5('0x32')]);_0x151f94[_0xfda5('0x33')]=_[_0xfda5('0x34')](_0x151f94[_0xfda5('0x30')],_0x151f94[_0xfda5('0x32')]);_0x160822[_0xfda5('0x36')]=_[_0xfda5('0x34')](_0x151f94['model'],qs[_0xfda5('0x35')](_0x520324['query'][_0xfda5('0x35')]));_0x160822['attributes']=_0x160822[_0xfda5('0x36')]['length']?_0x160822[_0xfda5('0x36')]:_0x151f94[_0xfda5('0x30')];if(_0x520324[_0xfda5('0x32')]['includeAll']){_0x160822['include']=[{'all':!![]}];}_0x160822=_['merge']({},_0x160822,_0x520324[_0xfda5('0x47')]);return db['UserProfile'][_0xfda5('0x48')](_0x160822)['then'](handleEntityNotFound(_0x1f00cc,null))[_0xfda5('0x27')](respondWithResult(_0x1f00cc,null))[_0xfda5('0x43')](handleError(_0x1f00cc,null));};exports[_0xfda5('0x49')]=function(_0x244fc4,_0x1e08a9){return db[_0xfda5('0x41')][_0xfda5('0x49')](_0x244fc4['body'],{})[_0xfda5('0x27')](respondWithResult(_0x1e08a9,0xc9))[_0xfda5('0x43')](handleError(_0x1e08a9,null));};exports[_0xfda5('0x4a')]=function(_0x2c3ce1,_0x1cf043){var _0x54e835={'where':{'id':_0x2c3ce1[_0xfda5('0x45')]['id']}},_0x147e68={};_0x147e68[_0xfda5('0x30')]=_[_0xfda5('0x31')](db['UserProfile'][_0xfda5('0x46')]);_0x54e835[_0xfda5('0x36')]=_[_0xfda5('0x34')](_0x147e68['model'],qs[_0xfda5('0x35')](_0x2c3ce1[_0xfda5('0x32')][_0xfda5('0x35')]));_0x54e835[_0xfda5('0x36')]=_0x54e835['attributes'][_0xfda5('0x4b')]?_0x54e835[_0xfda5('0x36')]:_0x147e68[_0xfda5('0x30')];if(_0x2c3ce1[_0xfda5('0x32')][_0xfda5('0x3f')]){_0x54e835[_0xfda5('0x40')]=[{'all':!![]}];}_0x54e835=_['merge']({},_0x54e835,_0x2c3ce1[_0xfda5('0x47')]);return db[_0xfda5('0x41')]['find'](_0x54e835)['then'](handleEntityNotFound(_0x1cf043,null))[_0xfda5('0x27')](function(_0x447f82){if(_0x447f82){var _0x410b48=_0x447f82[_0xfda5('0x4c')]({'plain':!![]});_0x410b48=qs[_0xfda5('0x4d')](_0x410b48,['id',_0xfda5('0x4e'),'updatedAt',_0xfda5('0x4f')]);_0x2c3ce1[_0xfda5('0x50')]=_[_0xfda5('0x4d')](_0x2c3ce1['body'],['id',_0xfda5('0x4e'),'updatedAt']);return db[_0xfda5('0x51')][_0xfda5('0x52')](function(_0xf5350f){return db[_0xfda5('0x41')][_0xfda5('0x49')](_[_0xfda5('0x3d')](_0x410b48,_0x2c3ce1[_0xfda5('0x50')]),{'include':_0x2c3ce1[_0xfda5('0x32')][_0xfda5('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0xf5350f})[_0xfda5('0x27')](function(_0x5d2fcd){var _0x40c634=_0x5d2fcd[_0xfda5('0x4c')]({'plain':!![]});return db['UserProfileSection'][_0xfda5('0x42')]({'where':{'userProfileId':_0x2c3ce1[_0xfda5('0x45')]['id']},'raw':!![]})[_0xfda5('0x27')](function(_0x426916){if(_0x426916){return BPromise[_0xfda5('0x53')](_0x426916,function(_0x2c73c5){return new BPromise(function(_0x1d3b33,_0x3a5e28){if(_0x2c73c5['autoAssociation']===null||_0x2c73c5[_0xfda5('0x54')]===0x1)_0x1d3b33(null);return db[_0xfda5('0x55')][_0xfda5('0x42')]({'where':{'sectionId':_0x2c73c5['id']},'raw':!![]})[_0xfda5('0x27')](function(_0x4029b5){var _0x3eb0fe=_['map'](_0x4029b5,function(_0x6c3d8b){return qs[_0xfda5('0x4d')](_0x6c3d8b,['id',_0xfda5('0x4e'),_0xfda5('0x56'),_0xfda5('0x57')]);});_0x1d3b33(_0x3eb0fe);})['catch'](function(_0x5dc55a){_0x3a5e28(_0x5dc55a);});})[_0xfda5('0x27')](function(_0x534013){var _0xbea29a=qs[_0xfda5('0x4d')](_0x2c73c5,['id',_0xfda5('0x4e'),_0xfda5('0x56')]);_0xbea29a['userProfileId']=_0x40c634['id'];if(_0x534013)_0xbea29a[_0xfda5('0x58')]=_0x534013;return _0xbea29a;})[_0xfda5('0x27')](function(_0x54b524){return db[_0xfda5('0x59')][_0xfda5('0x49')](_0x54b524,{'include':[{'model':db[_0xfda5('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0xf5350f});});})[_0xfda5('0x27')](function(){return _0x40c634;});}});});});}})['then'](respondWithResult(_0x1cf043,0xc9))[_0xfda5('0x43')](handleError(_0x1cf043,null));};exports[_0xfda5('0x26')]=function(_0x53f364,_0x2fe3f0){if(_0x53f364[_0xfda5('0x50')]['id']){delete _0x53f364[_0xfda5('0x50')]['id'];}return db[_0xfda5('0x41')]['find']({'where':{'id':_0x53f364[_0xfda5('0x45')]['id']}})[_0xfda5('0x27')](handleEntityNotFound(_0x2fe3f0,null))[_0xfda5('0x27')](saveUpdates(_0x53f364[_0xfda5('0x50')],null))[_0xfda5('0x27')](respondWithResult(_0x2fe3f0,null))[_0xfda5('0x43')](handleError(_0x2fe3f0,null));};exports[_0xfda5('0x28')]=function(_0x43cc3f,_0x3e847f){return db[_0xfda5('0x41')][_0xfda5('0x48')]({'where':{'id':_0x43cc3f[_0xfda5('0x45')]['id']}})[_0xfda5('0x27')](handleEntityNotFound(_0x3e847f,null))['then'](removeEntity(_0x3e847f,null))[_0xfda5('0x43')](handleError(_0x3e847f,null));};exports['describe']=function(_0x1f8cfb,_0x785ede){return db[_0xfda5('0x41')][_0xfda5('0x5a')]()[_0xfda5('0x27')](respondWithResult(_0x785ede,null))[_0xfda5('0x43')](handleError(_0x785ede,null));};exports[_0xfda5('0x5b')]=function(_0x47fc00,_0x415312){var _0x4369ba=_0x47fc00[_0xfda5('0x50')];return db[_0xfda5('0x41')]['find']({'where':{'id':_0x47fc00[_0xfda5('0x45')]['id']}})[_0xfda5('0x27')](handleEntityNotFound(_0x415312,null))[_0xfda5('0x27')](function(_0x1741e7){if(_0x1741e7){return db[_0xfda5('0x51')][_0xfda5('0x52')](function(_0x3b3244){return db[_0xfda5('0x59')][_0xfda5('0x28')]({'where':{'userProfileId':_0x47fc00[_0xfda5('0x45')]['id'],'sectionId':_[_0xfda5('0x2e')](_0x4369ba,function(_0x781ed7){return _0x781ed7['sectionId'];})},'transaction':_0x3b3244})[_0xfda5('0x27')](function(){var _0x43d941=_['map'](_0x4369ba,function(_0x410c9e){_0x410c9e[_0xfda5('0x5c')]=_0x47fc00[_0xfda5('0x45')]['id'];return _0x410c9e;});var _0x3f54ab=[];return BPromise[_0xfda5('0x53')](_0x43d941,function(_0x13124a){return db[_0xfda5('0x59')][_0xfda5('0x49')](_0x13124a,{'include':[{'model':db[_0xfda5('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x3b3244})[_0xfda5('0x27')](function(_0xd0c20c){_0x3f54ab['push'](_0xd0c20c[_0xfda5('0x4c')]({'plain':!![]}));});})[_0xfda5('0x27')](function(){return _0x3f54ab;});});});}})[_0xfda5('0x27')](function(_0x327dc1){return _0x327dc1;})[_0xfda5('0x27')](respondWithResult(_0x415312,null))[_0xfda5('0x43')](handleError(_0x415312,null));};exports[_0xfda5('0x5d')]=function(_0x40f5f6,_0x2a4823){var _0x471575;return db[_0xfda5('0x41')][_0xfda5('0x48')]({'where':{'id':_0x40f5f6['params']['id']},'attributes':['id',_0xfda5('0x2b')]})['then'](handleEntityNotFound(_0x2a4823,null))[_0xfda5('0x27')](function(_0x21b0a8){if(_0x21b0a8){_0x471575=_0x21b0a8;return db[_0xfda5('0x59')][_0xfda5('0x28')]({'where':{'userProfileId':_0x40f5f6[_0xfda5('0x45')]['id'],'sectionId':_0x40f5f6['query']['ids']}});}})[_0xfda5('0x27')](function(){return _0x471575;})[_0xfda5('0x27')](respondWithStatusCode(_0x2a4823,null))[_0xfda5('0x43')](handleError(_0x2a4823,null));};exports[_0xfda5('0x5e')]=function(_0x58072e,_0x347d9){var _0x5c15b7=[];var _0x2ddc72=[];return db[_0xfda5('0x59')][_0xfda5('0x42')]({'where':{'userProfileId':_0x58072e['params']['id']},'raw':!![]})['then'](function(_0x669c38){_0x5c15b7=_[_0xfda5('0x3c')](_0x669c38,function(_0x17ab3b){return _0x17ab3b[_0xfda5('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x17ab3b[_0xfda5('0x57')]);});if(!_['isEmpty'](_0x5c15b7)){return _['map'](_0x5c15b7,function(_0x2f5eb3){return _0x2f5eb3['sectionId'];});}else{return;}})[_0xfda5('0x27')](function(_0x11456d){if(_0x11456d)_0x2ddc72=_0x11456d;if(_[_0xfda5('0x60')](_0x2ddc72,0x64)){var _0xa7944e=_[_0xfda5('0x48')](_0x5c15b7,{'sectionId':0x64});return hasDefaultDashboard(_0xa7944e)['then'](function(_0x431259){return _[_0xfda5('0x2e')](_0x5c15b7,function(_0x2dd7f6){if(_0x2dd7f6[_0xfda5('0x57')]===0x64){_0x2dd7f6[_0xfda5('0x61')]=_0x431259;}return _0x2dd7f6;});});}else{return;}})[_0xfda5('0x27')](function(_0x2f5b58){if(_0x2f5b58)_0x5c15b7=_0x2f5b58;if(_[_0xfda5('0x60')](_0x2ddc72,0x3eb)){var _0x5b86a0=_[_0xfda5('0x48')](_0x5c15b7,{'sectionId':0x3eb});return getCustomDashboards(_0x5b86a0)[_0xfda5('0x27')](function(_0x186047){return _[_0xfda5('0x2e')](_0x5c15b7,function(_0x5842b1){if(_0x5b86a0[_0xfda5('0x5f')]){if(_0x5842b1[_0xfda5('0x57')]===0x3eb){_0x5842b1['subsections']=_0x186047;}}else{if(_0x5842b1[_0xfda5('0x57')]===0x64){_0x5842b1[_0xfda5('0x61')]=_0x186047;}}return _0x5842b1;});});}else{return;}})[_0xfda5('0x27')](function(_0x53b9e6){if(_0x53b9e6)_0x5c15b7=_0x53b9e6;if(_[_0xfda5('0x60')](_0x2ddc72,0x709)){var _0x5e4ed3=_[_0xfda5('0x48')](_0x5c15b7,{'sectionId':0x709});return getPlugins(_0x5e4ed3)[_0xfda5('0x27')](function(_0x521774){if(_0x5e4ed3[_0xfda5('0x5f')]){return _[_0xfda5('0x2e')](_0x5c15b7,function(_0xb6d378){if(_0xb6d378[_0xfda5('0x57')]===0x709){_0xb6d378[_0xfda5('0x61')]=_0x521774;}return _0xb6d378;});}else{var _0x2aab36={'sectionId':0x76c,'enabled':0x1,'subsections':_0x521774};var _0x10e0da=_[_0xfda5('0x2e')](_0x5c15b7);_0x10e0da[_0xfda5('0x62')](_0x2aab36);return _0x10e0da;}});}else{return;}})[_0xfda5('0x27')](function(_0x30dc53){if(_0x30dc53)_0x5c15b7=_0x30dc53;return _['filter'](_0x5c15b7,['enabled',0x1]);})[_0xfda5('0x27')](respondWithResult(_0x347d9,null))[_0xfda5('0x43')](handleError(_0x347d9,null));};function hasDefaultDashboard(_0xe0b64d){var _0x287540=[0x65];return new BPromise(function(_0x352838,_0x293402){try{if(_0xe0b64d[_0xfda5('0x54')]){_0x352838(_0x287540);}else{return db[_0xfda5('0x55')][_0xfda5('0x63')]({'where':{'sectionId':_0xe0b64d['id']},'raw':!![]})[_0xfda5('0x27')](function(_0x5eb35b){_0x5eb35b?_0x352838(_0x287540):_0x352838();});}}catch(_0x39fe16){_0x293402(_0x39fe16);}});}function getCustomDashboards(_0x2b2894){var _0x806cbe=[];return new BPromise(function(_0x2f726d,_0xf49d9a){try{if(_0x2b2894[_0xfda5('0x54')]){return db[_0xfda5('0x64')][_0xfda5('0x42')]({'raw':!![]})['then'](function(_0x206681){_0x206681[_0xfda5('0x65')](function(_0xcfa075){_0x806cbe[_0xfda5('0x62')](_0xcfa075['id']+0x1869f);});_0x2f726d(_0x806cbe);});}else{return db[_0xfda5('0x55')][_0xfda5('0x42')]({'where':{'sectionId':_0x2b2894['id']},'raw':!![]})['then'](function(_0x5a4867){_0x5a4867[_0xfda5('0x65')](function(_0x5e8222){_0x806cbe['push'](_0x5e8222[_0xfda5('0x66')]+0x1869f);});_0x2f726d(_0x806cbe);});}}catch(_0x2b8502){_0xf49d9a(_0x2b8502);}});}function getPlugins(_0x3af891){var _0x4065a0=[];return new BPromise(function(_0x361cb7,_0x39491a){try{if(_0x3af891['autoAssociation']){return db[_0xfda5('0x67')][_0xfda5('0x42')]({'raw':!![]})['then'](function(_0x1dec97){_0x1dec97[_0xfda5('0x65')](function(_0x18f613){_0x4065a0[_0xfda5('0x62')](_0x18f613['id']+0x15b38);});_0x361cb7(_0x4065a0);});}else{return db[_0xfda5('0x55')][_0xfda5('0x42')]({'where':{'sectionId':_0x3af891['id']},'raw':!![]})[_0xfda5('0x27')](function(_0x2509b9){_0x2509b9['forEach'](function(_0x4cec3b){_0x4065a0['push'](_0x4cec3b[_0xfda5('0x66')]+0x15b38);});_0x361cb7(_0x4065a0);});}}catch(_0x3a4bda){_0x39491a(_0x3a4bda);}});}exports[_0xfda5('0x68')]=function(_0x5852a9,_0x690f9d){return db[_0xfda5('0x41')][_0xfda5('0x48')]({'where':{'id':_0x5852a9[_0xfda5('0x45')]['id']}})[_0xfda5('0x27')](handleEntityNotFound(_0x690f9d,null))[_0xfda5('0x27')](function(_0x497652){if(_0x497652){return db[_0xfda5('0x51')][_0xfda5('0x52')](function(_0xf271eb){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5852a9[_0xfda5('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xfda5('0x27')](function(_0xa4efea){if(_0xa4efea){return db['UserProfileSection'][_0xfda5('0x28')]({'where':{'userProfileId':_0x5852a9[_0xfda5('0x45')]['id'],'id':_[_0xfda5('0x2e')](_0xa4efea,function(_0x2c3900){return _0x2c3900['id'];})},'transaction':_0xf271eb});}})[_0xfda5('0x27')](function(_0x4490d5){var _0x25dfc9=_['map'](_0x5852a9['body'],function(_0x508299){_0x508299[_0xfda5('0x5c')]=_0x5852a9['params']['id'];return _0x508299;});return db[_0xfda5('0x59')][_0xfda5('0x69')](_0x25dfc9,{'raw':!![],'transaction':_0xf271eb});})[_0xfda5('0x27')](function(_0x5c84c3){var _0x53ccb2=_[_0xfda5('0x3c')](_[_0xfda5('0x2e')](_0x5c84c3,function(_0x3deb92){return _0x3deb92[_0xfda5('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x53ccb2){return db[_0xfda5('0x59')][_0xfda5('0x42')]({'where':{'userProfileId':_0x5852a9[_0xfda5('0x45')]['id'],'sectionId':_[_0xfda5('0x2e')](_0x53ccb2,function(_0x5b8606){return _0x5b8606[_0xfda5('0x57')];})},'attributes':['id',_0xfda5('0x57')],'raw':!![]})[_0xfda5('0x27')](function(_0x4c0473){var _0x901602=_[_0xfda5('0x2e')](_0x5852a9[_0xfda5('0x50')],function(_0x525852){_0x525852[_0xfda5('0x5c')]=_0x5852a9['params']['id'];return _0x525852;});return db['UserProfileResource'][_0xfda5('0x69')](_0x901602,{'raw':!![],'transaction':_0xf271eb});});}})[_0xfda5('0x43')](handleError(_0x690f9d,null));});}})['then'](function(_0x3929fb){var _0x179d66=_['map'](_0x3929fb,function(_0xe10e35){return _0xe10e35[_0xfda5('0x4c')]({'plain':!![]});});})[_0xfda5('0x27')](respondWithResult(_0x690f9d,null))[_0xfda5('0x43')](handleError(_0x690f9d,null));};exports['removeResources']=function(_0x16a143,_0x2bea5d,_0x14890a){return db['UserProfile']['find']({'where':{'id':_0x16a143[_0xfda5('0x45')]['id']}})[_0xfda5('0x27')](handleEntityNotFound(_0x2bea5d,null))[_0xfda5('0x27')](function(_0x1b7ac6){if(_0x1b7ac6){return _0x1b7ac6[_0xfda5('0x6a')](_0x16a143['query']['ids']);}})[_0xfda5('0x27')](respondWithStatusCode(_0x2bea5d,null))[_0xfda5('0x43')](handleError(_0x2bea5d,null));};exports[_0xfda5('0x6b')]=function(_0x38a7e0,_0x2292c8){var _0x32663b={'raw':![],'where':{}};var _0x9151b7={};var _0x1e4f81={'count':0x0,'rows':[]};var _0x566879=_0x38a7e0['query'][_0xfda5('0x6c')];if(typeof _0x566879===_0xfda5('0x6d')){throw new db[(_0xfda5('0x6e'))][(_0xfda5('0x6f'))](_0xfda5('0x70'));}var _0x93ee99=_0x38a7e0['query'][_0xfda5('0x71')]||![];var _0x45ca92=getQueryModels(_0x566879,_0x93ee99);if(typeof _0x45ca92['childModel']==='undefined'){throw new db['Sequelize'][(_0xfda5('0x6f'))](_0xfda5('0x72')+_0x566879+'\x27');}var _0x3227ff=[];if(!_[_0xfda5('0x73')](_0x45ca92[_0xfda5('0x74')])){_0x3227ff=_0x45ca92[_0xfda5('0x74')];}else{_0x3227ff=[{'name':_0x566879}];}return db[_0xfda5('0x41')][_0xfda5('0x63')]({'where':{'id':_0x38a7e0[_0xfda5('0x45')]['id']}})[_0xfda5('0x27')](handleEntityNotFound(_0x2292c8,null))[_0xfda5('0x27')](function(_0x169ad9){if(_0x169ad9){var _0x1dfdb7=[];for(var _0x37a385=0x0;_0x37a385<_0x3227ff[_0xfda5('0x4b')];_0x37a385++){_0x1dfdb7[_0xfda5('0x62')](db[_0xfda5('0x59')]['findOne']({'where':{'userProfileId':_0x169ad9['id'],'name':_0x3227ff[_0x37a385][_0xfda5('0x2b')]},'raw':!![]}));}return BPromise[_0xfda5('0x75')](_0x1dfdb7);}})[_0xfda5('0x27')](function(_0x767295){var _0x36d0ca=_[_0xfda5('0x3c')](_0x767295,function(_0x3901d7){return _0x3901d7?_0x3901d7:undefined;});var _0x25542c=_[_0xfda5('0x3c')](_0x3227ff,['ignore',!![]]);var _0x9ee5d1=_[_0xfda5('0x73')](_0x36d0ca)&&_[_0xfda5('0x73')](_0x25542c)?null:_[_0xfda5('0x76')](_0x25542c,_0x36d0ca);if(_0x9ee5d1){var _0x87758f=[];for(var _0x10cd01=0x0;_0x10cd01<_0x9ee5d1['length'];_0x10cd01++){var _0x3d4803=_[_0xfda5('0x48')](_0x3227ff,function(_0x20fa03){return _0x9ee5d1[_0x10cd01]?_0x20fa03[_0xfda5('0x2b')]===_0x9ee5d1[_0x10cd01][_0xfda5('0x2b')]:null;});if(_0x3d4803){if(_0x9ee5d1[_0x10cd01][_0xfda5('0x77')]){_0x87758f[_0xfda5('0x62')](getAllResources(_0x45ca92[_0xfda5('0x78')],_0x9ee5d1[_0x10cd01]));}else{if(!_0x9ee5d1[_0x10cd01][_0xfda5('0x54')]){_0x87758f[_0xfda5('0x62')](getAllowedResources(_0x3d4803,_0x9ee5d1[_0x10cd01],_0x45ca92['childModel']));}else{if(_0x3d4803[_0xfda5('0x30')]){_0x87758f[_0xfda5('0x62')](getAllFilteredResources(_0x3d4803,_0x9ee5d1[_0x10cd01]));}}}}}return BPromise['all'](_0x87758f);}else{return null;}})[_0xfda5('0x27')](function(_0x2c1ef1){var _0x75d688=_0x2c1ef1;var _0xaeb676=null;if(_0x75d688){_0xaeb676=_0x75d688[_0xfda5('0x4b')]===0x1?_0x75d688[0x0]:null;}if(_0xaeb676||_0x75d688){var _0x4823c7=db[_0x45ca92[_0xfda5('0x78')]][_0xfda5('0x46')];_0x9151b7[_0xfda5('0x30')]=_[_0xfda5('0x31')](_0x4823c7);_0x9151b7[_0xfda5('0x32')]=_[_0xfda5('0x31')](_0x38a7e0[_0xfda5('0x32')]);_0x9151b7[_0xfda5('0x33')]=_[_0xfda5('0x34')](_0x9151b7[_0xfda5('0x30')],_0x9151b7['query']);_0x32663b[_0xfda5('0x36')]=_[_0xfda5('0x34')](_0x9151b7[_0xfda5('0x30')],qs[_0xfda5('0x35')](_0x38a7e0[_0xfda5('0x32')]['fields']));_0x32663b[_0xfda5('0x36')]=_0x32663b[_0xfda5('0x36')]['length']?_0x32663b[_0xfda5('0x36')]:_0x9151b7[_0xfda5('0x30')];if(!_0x38a7e0[_0xfda5('0x32')][_0xfda5('0x37')](_0xfda5('0x38'))){_0x32663b[_0xfda5('0x22')]=qs[_0xfda5('0x22')](_0x38a7e0[_0xfda5('0x32')][_0xfda5('0x22')]);_0x32663b[_0xfda5('0x21')]=qs['offset'](_0x38a7e0['query']['offset']);}_0x32663b[_0xfda5('0x79')]=qs[_0xfda5('0x39')](_0x38a7e0['query'][_0xfda5('0x39')]);_0x32663b['where']=qs[_0xfda5('0x33')](_[_0xfda5('0x3b')](_0x38a7e0[_0xfda5('0x32')],_0x9151b7['filters']));if(_0x38a7e0['query']['filter']){_0x32663b[_0xfda5('0x3a')]=_[_0xfda5('0x3d')](_0x32663b[_0xfda5('0x3a')],{'$or':_[_0xfda5('0x2e')](_0x4823c7,function(_0x4122a4){if(_0x4122a4['type'][_0xfda5('0x7a')]!=='VIRTUAL'){var _0x35645d={};_0x35645d[_0x4122a4[_0xfda5('0x7b')]]={'$like':'%'+_0x38a7e0[_0xfda5('0x32')][_0xfda5('0x3c')]+'%'};return _0x35645d;}})});}var _0x41f2db=[];if(_0xaeb676){var _0x19f911=_['find'](_0x3227ff,[_0xfda5('0x2b'),_0xaeb676[_0xfda5('0x2b')]]);if(_0x19f911[_0xfda5('0x7b')]){var _0x162e41={};if(_0x45ca92[_0xfda5('0x78')]===_0xfda5('0x7c')){_0x162e41[_0x19f911['foreignKey']]=_['map'](_0xaeb676[_0xfda5('0x7d')],'id');}else{_0x162e41[_0x19f911[_0xfda5('0x7e')]]=_0xaeb676[_0xfda5('0x7d')];}_0x41f2db['push'](_0x162e41);}else{_0x32663b[_0xfda5('0x3a')]['id']=_0xaeb676[_0xfda5('0x7d')];}}else{for(var _0x344258=0x0;_0x344258<_0x75d688[_0xfda5('0x4b')];_0x344258++){var _0x19f911=_[_0xfda5('0x48')](_0x3227ff,[_0xfda5('0x2b'),_0x75d688[_0x344258]['name']]);if(_0x19f911[_0xfda5('0x7b')]){var _0x162e41={};_0x162e41[_0x19f911[_0xfda5('0x7e')]]=_0x75d688[_0x344258]['associatedResources'];_0x41f2db[_0xfda5('0x62')](_0x162e41);}else{if(!_0x32663b[_0xfda5('0x3a')]['id'])_0x32663b[_0xfda5('0x3a')]['id']=[];_0x75d688[_0x344258][_0xfda5('0x7d')][_0xfda5('0x65')](function(_0x5aca3d){_0x32663b['where']['id']['push'](_0x5aca3d);});}}}if(!_[_0xfda5('0x73')](_0x41f2db)){_0x32663b[_0xfda5('0x3a')]=_[_0xfda5('0x3d')](_0x32663b['where'],{'$and':{'$or':_0x41f2db}});}_0x32663b=_[_0xfda5('0x3d')]({},_0x32663b,_0x38a7e0[_0xfda5('0x47')]);if(_0xaeb676&&!_0xaeb676[_0xfda5('0x54')]&&_0x45ca92['childModel']===_0xfda5('0x7c')){if(_0x38a7e0['query'][_0xfda5('0x3f')]){_0x32663b[_0xfda5('0x40')]=[{'all':!![]}];}return db[_0x45ca92[_0xfda5('0x78')]][_0xfda5('0x42')](_0x32663b)['then'](function(_0x398bca){var _0x54181b=[];_0x398bca[_0xfda5('0x65')](function(_0x5c318c){var _0x1792da;switch(_0x5c318c[_0xfda5('0x7f')]){case _0xfda5('0x80'):_0x1792da=_['find'](_0xaeb676[_0xfda5('0x7d')],function(_0xb5e05a){return _0xb5e05a['id']===_0x5c318c[_0xfda5('0x81')]&&_0xb5e05a[_0xfda5('0x2f')]===_0xfda5('0x82');});break;case'custom':_0x1792da=_['find'](_0xaeb676[_0xfda5('0x7d')],function(_0x4d8d4b){return _0x4d8d4b['id']===_0x5c318c[_0xfda5('0x81')]&&_0x4d8d4b[_0xfda5('0x2f')]===_0xfda5('0x83');});break;}if(_0x1792da)_0x54181b['push'](_0x5c318c);});_0x1e4f81['count']=_0x54181b[_0xfda5('0x4b')];_0x1e4f81[_0xfda5('0x84')]=_0x54181b;return _0x1e4f81;});}else{return db[_0x45ca92[_0xfda5('0x78')]][_0xfda5('0x20')]({'where':_0x32663b[_0xfda5('0x3a')]})[_0xfda5('0x27')](function(_0x3488ae){_0x1e4f81[_0xfda5('0x20')]=_0x3488ae;if(_0x38a7e0[_0xfda5('0x32')]['includeAll']){if(_0x45ca92[_0xfda5('0x78')]===_0xfda5('0x85')){_0x32663b[_0xfda5('0x40')]=[{'model':db['Tag'],'as':_0xfda5('0x86'),'attributes':['id','name','color'],'required':_0x38a7e0[_0xfda5('0x32')][_0xfda5('0x87')]?!![]:![]},{'model':db['Tag'],'as':_0xfda5('0x88'),'attributes':['id',_0xfda5('0x2b'),'color'],'through':_0x38a7e0[_0xfda5('0x32')][_0xfda5('0x87')]?{'attributes':[],'where':{'TagId':_0x38a7e0[_0xfda5('0x32')][_0xfda5('0x87')]||undefined}}:{},'required':_0x38a7e0[_0xfda5('0x32')][_0xfda5('0x87')]?!![]:![]}];}else{_0x32663b[_0xfda5('0x40')]=[{'all':!![]}];}}return db[_0x45ca92[_0xfda5('0x78')]]['findAll'](_0x32663b);})[_0xfda5('0x27')](function(_0x319b1e){_0x1e4f81[_0xfda5('0x84')]=_0x319b1e;return _0x1e4f81;});}}else{return _0x1e4f81;}})['then'](respondWithFilteredResult(_0x2292c8,_0x32663b))[_0xfda5('0x43')](handleError(_0x2292c8,null));};function getAllResources(_0x5f251a,_0x44a157){return new BPromise(function(_0x15cbab,_0x31b1a8){if(_0x44a157){var _0x240a0e=_0x44a157[_0xfda5('0x3c')]?{[_0x44a157[_0xfda5('0x3c')][_0xfda5('0x7b')]]:_0x44a157[_0xfda5('0x3c')]['value']}:undefined;return db[_0x5f251a][_0xfda5('0x42')]({'where':_0x240a0e,'raw':!![]})['then'](function(_0x3cd897){_0x44a157[_0xfda5('0x7d')]=_[_0xfda5('0x2e')](_0x3cd897,'id');_0x15cbab(_0x44a157);})[_0xfda5('0x43')](function(_0xf697ec){_0x31b1a8(_0xf697ec);});}else{_0x15cbab(null);}});}function getAllFilteredResources(_0x4d576e,_0x1d417a){return new BPromise(function(_0x13b8c9,_0x41d410){var _0x2f1f59=_0x4d576e[_0xfda5('0x3c')]?{[_0x4d576e[_0xfda5('0x3c')][_0xfda5('0x7b')]]:_0x4d576e[_0xfda5('0x3c')]['value']}:undefined;return db[_0x4d576e[_0xfda5('0x30')]][_0xfda5('0x42')]({'where':_0x2f1f59,'raw':!![]})['then'](function(_0x3369f2){_0x1d417a['associatedResources']=_[_0xfda5('0x2e')](_0x3369f2,function(_0x449ffd){return _0x449ffd[_0xfda5('0x2b')];});_0x13b8c9(_0x1d417a);})[_0xfda5('0x43')](function(_0x200a42){_0x41d410(_0x200a42);});});}function getAllowedResources(_0x494b59,_0xd7b672,_0x21836c){return new BPromise(function(_0x2f29ea,_0x2ab879){if(_0xd7b672){return db[_0xfda5('0x55')][_0xfda5('0x42')]({'where':{'sectionId':_0xd7b672['id']},'raw':!![]})[_0xfda5('0x27')](function(_0x5ad0eb){if(_0x494b59[_0xfda5('0x7b')]&&_0x494b59['field']!=='id'){_0xd7b672[_0xfda5('0x7d')]=_[_0xfda5('0x2e')](_0x5ad0eb,function(_0x39c26e){return _0x39c26e[_0x494b59[_0xfda5('0x7b')]];});}else{if(_0x21836c===_0xfda5('0x7c')){_0xd7b672[_0xfda5('0x7d')]=_[_0xfda5('0x2e')](_0x5ad0eb,function(_0x5a1458){return{'id':_0x5a1458[_0xfda5('0x66')],'type':_0x5a1458[_0xfda5('0x2f')]};});}else{_0xd7b672[_0xfda5('0x7d')]=_[_0xfda5('0x2e')](_0x5ad0eb,function(_0x3cf4a6){return _0x3cf4a6[_0xfda5('0x66')];});}}_0x2f29ea(_0xd7b672);})[_0xfda5('0x43')](function(_0x2704aa){_0x2ab879(_0x2704aa);});}else{_0x2f29ea(null);}});}function getQueryModels(_0x54177e,_0xea8906){var _0x5a216a=_0x54177e[_0xfda5('0x89')]();var _0xfbba69={'childModel':undefined,'parentSections':[]};switch(_0x5a216a){case _0xfda5('0x8a'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0x8b');break;case _0xfda5('0x8c'):_0xfbba69['childModel']=_0xfda5('0x8d');break;case _0xfda5('0x8e'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0x8f');_0xfbba69['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0xfda5('0x90')}];break;case'projects':_0xfbba69[_0xfda5('0x78')]=_0xfda5('0x91');break;case _0xfda5('0x92'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0x85');_0xfbba69[_0xfda5('0x74')]=[{'name':_0xfda5('0x93'),'field':'id','foreignKey':_0xfda5('0x94')}];break;case _0xfda5('0x95'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0x96');break;case _0xfda5('0x97'):_0xfbba69['childModel']=_0xfda5('0x98');break;case _0xfda5('0x99'):_0xfbba69['childModel']=_0xfda5('0x9a');break;case'chatqueues':_0xfbba69['childModel']=_0xfda5('0x9b');break;case _0xfda5('0x9c'):_0xfbba69[_0xfda5('0x78')]='ChatWebsite';break;case'faxqueues':_0xfbba69[_0xfda5('0x78')]='FaxQueue';break;case'faxaccounts':_0xfbba69[_0xfda5('0x78')]=_0xfda5('0x9d');break;case _0xfda5('0x9e'):case _0xfda5('0x9f'):case _0xfda5('0xa0'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xa1');break;case'contexts':_0xfbba69[_0xfda5('0x78')]='VoiceContext';break;case _0xfda5('0xa2'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xa3');break;case _0xfda5('0xa4'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xa5');_0xfbba69[_0xfda5('0x74')]=[{'name':'Agents','field':_0xfda5('0x2b'),'foreignKey':_0xfda5('0xa6'),'model':'User','filter':{'field':_0xfda5('0xa7'),'value':[_0xfda5('0xa8')]}},{'name':_0xfda5('0xa9'),'field':'name','foreignKey':_0xfda5('0xa6'),'model':_0xfda5('0xaa'),'filter':{'field':_0xfda5('0xa7'),'value':['telephone']}},{'name':_0xfda5('0xab'),'field':_0xfda5('0x2b'),'foreignKey':'queue','model':_0xfda5('0xac'),'filter':{'field':_0xfda5('0x2f'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xfda5('0x2b'),'foreignKey':_0xfda5('0xad'),'model':'VoiceQueue','filter':{'field':_0xfda5('0x2f'),'value':[_0xfda5('0xae')]}}];break;case _0xfda5('0xaf'):_0xfbba69[_0xfda5('0x78')]='VoiceMusicOnHold';break;case _0xfda5('0xb0'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xb1');break;case'voiceprefixes':_0xfbba69[_0xfda5('0x78')]='VoicePrefix';break;case _0xfda5('0xb2'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xb3');break;case _0xfda5('0xb4'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xb5');break;case'mailaccounts':_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xb6');break;case'mailsubstatuses':_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xb7');break;case _0xfda5('0xb8'):_0xfbba69[_0xfda5('0x78')]='OpenchannelQueue';break;case'openchannelaccounts':_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xb9');break;case'smsqueues':_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xba');break;case _0xfda5('0xbb'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xbc');break;case _0xfda5('0xbd'):_0xfbba69['childModel']=_0xfda5('0xbe');break;case _0xfda5('0xbf'):_0xfbba69['childModel']=_0xfda5('0xc0');break;case _0xfda5('0xc1'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xc2');break;case _0xfda5('0xc3'):case'queuecampaigns':_0xfbba69[_0xfda5('0x78')]='VoiceQueue';if(_0xea8906){_0xfbba69[_0xfda5('0x74')]=[{'name':_0xfda5('0xab')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case _0xfda5('0xc4'):_0xfbba69['childModel']=_0xfda5('0xaa');if(_0xea8906){_0xfbba69[_0xfda5('0x74')]=[{'name':'Users','filter':{'field':_0xfda5('0xa7'),'value':['admin',_0xfda5('0xc5')]},'ignore':!![]},{'name':'Agents'},{'name':_0xfda5('0xa9')}];}break;case _0xfda5('0xc6'):_0xfbba69[_0xfda5('0x78')]='ZendeskAccount';break;case'salesforceaccounts':_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xc7');break;case _0xfda5('0xc8'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xc9');break;case'sugarcrmaccounts':_0xfbba69['childModel']=_0xfda5('0xca');break;case'deskaccounts':_0xfbba69['childModel']=_0xfda5('0xcb');break;case _0xfda5('0xcc'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xcd');break;case _0xfda5('0xce'):_0xfbba69[_0xfda5('0x78')]='User';break;case _0xfda5('0xcf'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xd0');break;case _0xfda5('0xd1'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xd2');break;case'customdashboards':_0xfbba69['childModel']=_0xfda5('0x64');break;case _0xfda5('0xd3'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xd4');break;case _0xfda5('0xd5'):_0xfbba69['childModel']=_0xfda5('0xd6');break;case _0xfda5('0xd7'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xd8');break;case'sounds':_0xfbba69['childModel']=_0xfda5('0xd9');break;case _0xfda5('0xda'):_0xfbba69[_0xfda5('0x78')]='Tag';break;case _0xfda5('0xdb'):_0xfbba69['childModel']=_0xfda5('0xdc');break;case _0xfda5('0xdd'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xde');break;case'trunks':_0xfbba69['childModel']='Trunk';break;case _0xfda5('0xdf'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xe0');break;case'plugins':_0xfbba69[_0xfda5('0x78')]=_0xfda5('0x67');break;case _0xfda5('0xe1'):_0xfbba69['childModel']=_0xfda5('0x7c');_0xfbba69[_0xfda5('0x74')]=[{'name':_0xfda5('0xe2'),'field':'id','foreignKey':'reportId'}];break;case _0xfda5('0xe3'):_0xfbba69[_0xfda5('0x78')]='AnalyticMetric';break;case _0xfda5('0xbf'):_0xfbba69[_0xfda5('0x78')]=_0xfda5('0xc0');break;default:return _0xfbba69;}return _0xfbba69;} \ No newline at end of file +var _0x14da=['bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','childModel','Invalid\x20section\x20\x27','parentSections','findOne','all','union','ignore','filters','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','DefaultReports','custom','reportId','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','membername','User','role','Telephones','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Template','triggers','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','catch','show','create','body','clone','params','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','destroy','describe','addSections','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','Plugin','addResources'];(function(_0x2cc9e5,_0x3a797f){var _0x589d4c=function(_0x7adde6){while(--_0x7adde6){_0x2cc9e5['push'](_0x2cc9e5['shift']());}};_0x589d4c(++_0x3a797f);}(_0x14da,0x86));var _0xa14d=function(_0x14f8ef,_0x1b1107){_0x14f8ef=_0x14f8ef-0x0;var _0x3b97f6=_0x14da[_0x14f8ef];return _0x3b97f6;};'use strict';var pdf=require(_0xa14d('0x0'));var emlformat=require(_0xa14d('0x1'));var rimraf=require(_0xa14d('0x2'));var zipdir=require(_0xa14d('0x3'));var jsonpatch=require(_0xa14d('0x4'));var rp=require(_0xa14d('0x5'));var moment=require(_0xa14d('0x6'));var BPromise=require(_0xa14d('0x7'));var Mustache=require(_0xa14d('0x8'));var util=require(_0xa14d('0x9'));var path=require(_0xa14d('0xa'));var sox=require('sox');var csv=require(_0xa14d('0xb'));var ejs=require(_0xa14d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa14d('0xd'));var crypto=require(_0xa14d('0xe'));var jsforce=require(_0xa14d('0xf'));var deskjs=require(_0xa14d('0x10'));var toCsv=require(_0xa14d('0xb'));var querystring=require(_0xa14d('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa14d('0x12'));var as=require(_0xa14d('0x13'));var hardwareService=require(_0xa14d('0x14'));var logger=require(_0xa14d('0x15'))('api');var utils=require(_0xa14d('0x16'));var config=require(_0xa14d('0x17'));var db=require(_0xa14d('0x18'))['db'];config['redis']=_[_0xa14d('0x19')](config[_0xa14d('0x1a')],{'host':_0xa14d('0x1b'),'port':0x18eb});var socket=require(_0xa14d('0x1c'))(new Redis(config['redis']));require('./userProfile.socket')[_0xa14d('0x1d')](socket);function respondWithStatusCode(_0x1d9ce5,_0x5c5eb8){_0x5c5eb8=_0x5c5eb8||0xcc;return function(_0x120b77){if(_0x120b77){return _0x1d9ce5['sendStatus'](_0x5c5eb8);}return _0x1d9ce5[_0xa14d('0x1e')](_0x5c5eb8)[_0xa14d('0x1f')]();};}function respondWithResult(_0x13403f,_0x182405){_0x182405=_0x182405||0xc8;return function(_0x327254){if(_0x327254){return _0x13403f['status'](_0x182405)[_0xa14d('0x20')](_0x327254);}};}function respondWithFilteredResult(_0x44f0d4,_0x5b277e){return function(_0x1c041c){if(_0x1c041c){var _0x132e68=_0x1c041c[_0xa14d('0x21')],_0x4be14d=_0x5b277e[_0xa14d('0x22')],_0x59bc86=_0x5b277e[_0xa14d('0x22')]+_0x5b277e[_0xa14d('0x23')],_0x357446;if(_0x59bc86>=_0x132e68){_0x59bc86=_0x132e68;_0x357446=0xc8;}else{_0x357446=0xce;}_0x44f0d4[_0xa14d('0x1e')](_0x357446);return _0x44f0d4[_0xa14d('0x24')](_0xa14d('0x25'),_0x4be14d+'-'+_0x59bc86+'/'+_0x132e68)[_0xa14d('0x20')](_0x1c041c);}return null;};}function patchUpdates(_0x282d91){return function(_0x39d4bf){try{jsonpatch[_0xa14d('0x26')](_0x39d4bf,_0x282d91,!![]);}catch(_0x1fe020){return BPromise['reject'](_0x1fe020);}return _0x39d4bf[_0xa14d('0x27')]();};}function saveUpdates(_0x4c0c48,_0x3e5739){return function(_0x47964f){if(_0x47964f){return _0x47964f[_0xa14d('0x28')](_0x4c0c48)[_0xa14d('0x29')](function(_0x4fafef){return _0x4fafef;});}return null;};}function removeEntity(_0x1f4600,_0x162b92){return function(_0x5d826b){if(_0x5d826b){return _0x5d826b['destroy']()[_0xa14d('0x29')](function(){_0x1f4600[_0xa14d('0x1e')](0xcc)[_0xa14d('0x1f')]();});}};}function handleEntityNotFound(_0x50175f,_0x28dbf7){return function(_0x207f92){if(!_0x207f92){_0x50175f['sendStatus'](0x194);}return _0x207f92;};}function handleError(_0x174faa,_0x4a0467){_0x4a0467=_0x4a0467||0x1f4;return function(_0x1cd2f2){logger[_0xa14d('0x2a')](_0x1cd2f2[_0xa14d('0x2b')]);if(_0x1cd2f2['name']){delete _0x1cd2f2[_0xa14d('0x2c')];}_0x174faa['status'](_0x4a0467)[_0xa14d('0x2d')](_0x1cd2f2);};}exports[_0xa14d('0x2e')]=function(_0x55b11a,_0x278651){var _0x3328f7={},_0x286c3e={},_0x709660={'count':0x0,'rows':[]};var _0x19964c=_[_0xa14d('0x2f')](db['UserProfile'][_0xa14d('0x30')],function(_0x123723){return{'name':_0x123723[_0xa14d('0x31')],'type':_0x123723[_0xa14d('0x32')][_0xa14d('0x33')]};});_0x286c3e[_0xa14d('0x34')]=_['map'](_0x19964c,_0xa14d('0x2c'));_0x286c3e[_0xa14d('0x35')]=_[_0xa14d('0x36')](_0x55b11a[_0xa14d('0x35')]);_0x286c3e['filters']=_[_0xa14d('0x37')](_0x286c3e['model'],_0x286c3e[_0xa14d('0x35')]);_0x3328f7['attributes']=_['intersection'](_0x286c3e[_0xa14d('0x34')],qs[_0xa14d('0x38')](_0x55b11a[_0xa14d('0x35')][_0xa14d('0x38')]));_0x3328f7[_0xa14d('0x39')]=_0x3328f7[_0xa14d('0x39')][_0xa14d('0x3a')]?_0x3328f7[_0xa14d('0x39')]:_0x286c3e[_0xa14d('0x34')];if(!_0x55b11a[_0xa14d('0x35')][_0xa14d('0x3b')](_0xa14d('0x3c'))){_0x3328f7[_0xa14d('0x23')]=qs[_0xa14d('0x23')](_0x55b11a[_0xa14d('0x35')]['limit']);_0x3328f7['offset']=qs[_0xa14d('0x22')](_0x55b11a[_0xa14d('0x35')][_0xa14d('0x22')]);}_0x3328f7[_0xa14d('0x3d')]=qs[_0xa14d('0x3e')](_0x55b11a[_0xa14d('0x35')][_0xa14d('0x3e')]);_0x3328f7[_0xa14d('0x3f')]=qs['filters'](_[_0xa14d('0x40')](_0x55b11a['query'],_0x286c3e['filters']),_0x19964c);if(_0x55b11a['query'][_0xa14d('0x41')]){_0x3328f7[_0xa14d('0x3f')]=_[_0xa14d('0x42')](_0x3328f7[_0xa14d('0x3f')],{'$or':_[_0xa14d('0x2f')](_0x19964c,function(_0x203af8){if(_0x203af8[_0xa14d('0x32')]!==_0xa14d('0x43')){var _0x1c50b4={};_0x1c50b4[_0x203af8['name']]={'$like':'%'+_0x55b11a[_0xa14d('0x35')][_0xa14d('0x41')]+'%'};return _0x1c50b4;}})});}_0x3328f7=_[_0xa14d('0x42')]({},_0x3328f7,_0x55b11a[_0xa14d('0x44')]);var _0x3ce833={'where':_0x3328f7['where']};return db[_0xa14d('0x45')][_0xa14d('0x21')](_0x3ce833)[_0xa14d('0x29')](function(_0x32f26c){_0x709660[_0xa14d('0x21')]=_0x32f26c;if(_0x55b11a[_0xa14d('0x35')][_0xa14d('0x46')]){_0x3328f7[_0xa14d('0x47')]=[{'all':!![]}];}return db[_0xa14d('0x45')][_0xa14d('0x48')](_0x3328f7);})[_0xa14d('0x29')](function(_0xc2880){_0x709660[_0xa14d('0x49')]=_0xc2880;return _0x709660;})['then'](respondWithFilteredResult(_0x278651,_0x3328f7))[_0xa14d('0x4a')](handleError(_0x278651,null));};exports[_0xa14d('0x4b')]=function(_0x33bf34,_0xb02050){var _0x3b97be={'raw':![],'where':{'id':_0x33bf34['params']['id']}},_0x3ed14b={};_0x3ed14b['model']=_[_0xa14d('0x36')](db[_0xa14d('0x45')]['rawAttributes']);_0x3ed14b[_0xa14d('0x35')]=_[_0xa14d('0x36')](_0x33bf34[_0xa14d('0x35')]);_0x3ed14b['filters']=_[_0xa14d('0x37')](_0x3ed14b[_0xa14d('0x34')],_0x3ed14b['query']);_0x3b97be[_0xa14d('0x39')]=_['intersection'](_0x3ed14b['model'],qs[_0xa14d('0x38')](_0x33bf34[_0xa14d('0x35')][_0xa14d('0x38')]));_0x3b97be['attributes']=_0x3b97be[_0xa14d('0x39')][_0xa14d('0x3a')]?_0x3b97be[_0xa14d('0x39')]:_0x3ed14b[_0xa14d('0x34')];if(_0x33bf34[_0xa14d('0x35')][_0xa14d('0x46')]){_0x3b97be[_0xa14d('0x47')]=[{'all':!![]}];}_0x3b97be=_[_0xa14d('0x42')]({},_0x3b97be,_0x33bf34[_0xa14d('0x44')]);return db[_0xa14d('0x45')]['find'](_0x3b97be)[_0xa14d('0x29')](handleEntityNotFound(_0xb02050,null))['then'](respondWithResult(_0xb02050,null))[_0xa14d('0x4a')](handleError(_0xb02050,null));};exports[_0xa14d('0x4c')]=function(_0x2f0a8d,_0x50083a){return db[_0xa14d('0x45')][_0xa14d('0x4c')](_0x2f0a8d[_0xa14d('0x4d')],{})[_0xa14d('0x29')](respondWithResult(_0x50083a,0xc9))['catch'](handleError(_0x50083a,null));};exports[_0xa14d('0x4e')]=function(_0x54e9c6,_0x16af76){var _0x20e00a={'where':{'id':_0x54e9c6[_0xa14d('0x4f')]['id']}},_0x248833={};_0x248833[_0xa14d('0x34')]=_['keys'](db[_0xa14d('0x45')]['rawAttributes']);_0x20e00a['attributes']=_[_0xa14d('0x37')](_0x248833[_0xa14d('0x34')],qs[_0xa14d('0x38')](_0x54e9c6[_0xa14d('0x35')]['fields']));_0x20e00a[_0xa14d('0x39')]=_0x20e00a['attributes'][_0xa14d('0x3a')]?_0x20e00a['attributes']:_0x248833[_0xa14d('0x34')];if(_0x54e9c6[_0xa14d('0x35')][_0xa14d('0x46')]){_0x20e00a[_0xa14d('0x47')]=[{'all':!![]}];}_0x20e00a=_[_0xa14d('0x42')]({},_0x20e00a,_0x54e9c6[_0xa14d('0x44')]);return db[_0xa14d('0x45')][_0xa14d('0x50')](_0x20e00a)[_0xa14d('0x29')](handleEntityNotFound(_0x16af76,null))[_0xa14d('0x29')](function(_0x2a9241){if(_0x2a9241){var _0x337c1d=_0x2a9241[_0xa14d('0x51')]({'plain':!![]});_0x337c1d=qs[_0xa14d('0x52')](_0x337c1d,['id',_0xa14d('0x53'),_0xa14d('0x54'),_0xa14d('0x55')]);_0x54e9c6['body']=_[_0xa14d('0x52')](_0x54e9c6[_0xa14d('0x4d')],['id',_0xa14d('0x53'),'updatedAt']);return db[_0xa14d('0x56')][_0xa14d('0x57')](function(_0x3ee463){return db[_0xa14d('0x45')][_0xa14d('0x4c')](_[_0xa14d('0x42')](_0x337c1d,_0x54e9c6['body']),{'include':_0x54e9c6[_0xa14d('0x35')][_0xa14d('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x3ee463})['then'](function(_0x1cd7a5){var _0x45adaf=_0x1cd7a5[_0xa14d('0x51')]({'plain':!![]});return db[_0xa14d('0x58')][_0xa14d('0x48')]({'where':{'userProfileId':_0x54e9c6[_0xa14d('0x4f')]['id']},'raw':!![]})['then'](function(_0x2e1fc3){if(_0x2e1fc3){return BPromise[_0xa14d('0x59')](_0x2e1fc3,function(_0xc72668){return new BPromise(function(_0x277174,_0x14b022){if(_0xc72668[_0xa14d('0x5a')]===null||_0xc72668['autoAssociation']===0x1)_0x277174(null);return db[_0xa14d('0x5b')][_0xa14d('0x48')]({'where':{'sectionId':_0xc72668['id']},'raw':!![]})[_0xa14d('0x29')](function(_0x878c88){var _0x28c274=_['map'](_0x878c88,function(_0x8f787){return qs[_0xa14d('0x52')](_0x8f787,['id',_0xa14d('0x53'),_0xa14d('0x54'),_0xa14d('0x5c')]);});_0x277174(_0x28c274);})[_0xa14d('0x4a')](function(_0x51ffea){_0x14b022(_0x51ffea);});})[_0xa14d('0x29')](function(_0x39adf6){var _0x2e7392=qs[_0xa14d('0x52')](_0xc72668,['id',_0xa14d('0x53'),_0xa14d('0x54')]);_0x2e7392[_0xa14d('0x5d')]=_0x45adaf['id'];if(_0x39adf6)_0x2e7392[_0xa14d('0x5e')]=_0x39adf6;return _0x2e7392;})[_0xa14d('0x29')](function(_0x34fd15){return db[_0xa14d('0x58')][_0xa14d('0x4c')](_0x34fd15,{'include':[{'model':db[_0xa14d('0x5b')],'as':_0xa14d('0x5e')}],'raw':!![],'transaction':_0x3ee463});});})['then'](function(){return _0x45adaf;});}});});});}})[_0xa14d('0x29')](respondWithResult(_0x16af76,0xc9))[_0xa14d('0x4a')](handleError(_0x16af76,null));};exports[_0xa14d('0x28')]=function(_0x49efc9,_0x2d6b32){if(_0x49efc9[_0xa14d('0x4d')]['id']){delete _0x49efc9['body']['id'];}return db[_0xa14d('0x45')][_0xa14d('0x50')]({'where':{'id':_0x49efc9['params']['id']}})[_0xa14d('0x29')](handleEntityNotFound(_0x2d6b32,null))[_0xa14d('0x29')](saveUpdates(_0x49efc9[_0xa14d('0x4d')],null))[_0xa14d('0x29')](respondWithResult(_0x2d6b32,null))[_0xa14d('0x4a')](handleError(_0x2d6b32,null));};exports[_0xa14d('0x5f')]=function(_0x161a47,_0x4be96a){return db['UserProfile']['find']({'where':{'id':_0x161a47[_0xa14d('0x4f')]['id']}})[_0xa14d('0x29')](handleEntityNotFound(_0x4be96a,null))[_0xa14d('0x29')](removeEntity(_0x4be96a,null))[_0xa14d('0x4a')](handleError(_0x4be96a,null));};exports[_0xa14d('0x60')]=function(_0x1507ba,_0xbd1fc0){return db[_0xa14d('0x45')][_0xa14d('0x60')]()[_0xa14d('0x29')](respondWithResult(_0xbd1fc0,null))[_0xa14d('0x4a')](handleError(_0xbd1fc0,null));};exports[_0xa14d('0x61')]=function(_0x5a080e,_0x4b165c){var _0x365f64=_0x5a080e[_0xa14d('0x4d')];return db['UserProfile'][_0xa14d('0x50')]({'where':{'id':_0x5a080e['params']['id']}})[_0xa14d('0x29')](handleEntityNotFound(_0x4b165c,null))['then'](function(_0x3f676c){if(_0x3f676c){return db[_0xa14d('0x56')]['transaction'](function(_0x36c0bb){return db[_0xa14d('0x58')]['destroy']({'where':{'userProfileId':_0x5a080e[_0xa14d('0x4f')]['id'],'sectionId':_[_0xa14d('0x2f')](_0x365f64,function(_0x1c90f0){return _0x1c90f0[_0xa14d('0x5c')];})},'transaction':_0x36c0bb})[_0xa14d('0x29')](function(){var _0x259f10=_[_0xa14d('0x2f')](_0x365f64,function(_0xb32b89){_0xb32b89[_0xa14d('0x5d')]=_0x5a080e[_0xa14d('0x4f')]['id'];return _0xb32b89;});var _0xf5cf03=[];return BPromise[_0xa14d('0x59')](_0x259f10,function(_0xa9fb5e){return db[_0xa14d('0x58')][_0xa14d('0x4c')](_0xa9fb5e,{'include':[{'model':db[_0xa14d('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0x36c0bb})[_0xa14d('0x29')](function(_0x1729b3){_0xf5cf03[_0xa14d('0x62')](_0x1729b3[_0xa14d('0x51')]({'plain':!![]}));});})[_0xa14d('0x29')](function(){return _0xf5cf03;});});});}})[_0xa14d('0x29')](function(_0x1ba9f0){return _0x1ba9f0;})[_0xa14d('0x29')](respondWithResult(_0x4b165c,null))[_0xa14d('0x4a')](handleError(_0x4b165c,null));};exports[_0xa14d('0x63')]=function(_0x569d31,_0x201317){var _0x264f04;return db[_0xa14d('0x45')][_0xa14d('0x50')]({'where':{'id':_0x569d31['params']['id']},'attributes':['id',_0xa14d('0x2c')]})[_0xa14d('0x29')](handleEntityNotFound(_0x201317,null))[_0xa14d('0x29')](function(_0xb820c8){if(_0xb820c8){_0x264f04=_0xb820c8;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x569d31[_0xa14d('0x4f')]['id'],'sectionId':_0x569d31[_0xa14d('0x35')][_0xa14d('0x64')]}});}})[_0xa14d('0x29')](function(){return _0x264f04;})['then'](respondWithStatusCode(_0x201317,null))['catch'](handleError(_0x201317,null));};exports[_0xa14d('0x65')]=function(_0x322f75,_0x42bea6){var _0x2b1cdb=[];var _0x37732d=[];return db[_0xa14d('0x58')]['findAll']({'where':{'userProfileId':_0x322f75[_0xa14d('0x4f')]['id']},'raw':!![]})[_0xa14d('0x29')](function(_0x2a0098){_0x2b1cdb=_['filter'](_0x2a0098,function(_0x349985){return _0x349985[_0xa14d('0x66')]===0x1||_[_0xa14d('0x67')]([0x3eb,0x709],_0x349985[_0xa14d('0x5c')]);});if(!_[_0xa14d('0x68')](_0x2b1cdb)){return _[_0xa14d('0x2f')](_0x2b1cdb,function(_0x3f5746){return _0x3f5746[_0xa14d('0x5c')];});}else{return;}})['then'](function(_0x22052f){if(_0x22052f)_0x37732d=_0x22052f;if(_[_0xa14d('0x67')](_0x37732d,0x64)){var _0x5fd348=_[_0xa14d('0x50')](_0x2b1cdb,{'sectionId':0x64});return hasDefaultDashboard(_0x5fd348)[_0xa14d('0x29')](function(_0x1d9e1e){return _[_0xa14d('0x2f')](_0x2b1cdb,function(_0x2b0315){if(_0x2b0315[_0xa14d('0x5c')]===0x64){_0x2b0315[_0xa14d('0x69')]=_0x1d9e1e;}return _0x2b0315;});});}else{return;}})[_0xa14d('0x29')](function(_0x241eae){if(_0x241eae)_0x2b1cdb=_0x241eae;if(_[_0xa14d('0x67')](_0x37732d,0x3eb)){var _0x1caea8=_[_0xa14d('0x50')](_0x2b1cdb,{'sectionId':0x3eb});return getCustomDashboards(_0x1caea8)[_0xa14d('0x29')](function(_0x270e5a){return _[_0xa14d('0x2f')](_0x2b1cdb,function(_0x5c8e9a){if(_0x1caea8['enabled']){if(_0x5c8e9a[_0xa14d('0x5c')]===0x3eb){_0x5c8e9a['subsections']=_0x270e5a;}}else{if(_0x5c8e9a['sectionId']===0x64){_0x5c8e9a[_0xa14d('0x69')]=_0x270e5a;}}return _0x5c8e9a;});});}else{return;}})[_0xa14d('0x29')](function(_0x8ffa38){if(_0x8ffa38)_0x2b1cdb=_0x8ffa38;if(_[_0xa14d('0x67')](_0x37732d,0x709)){var _0xcece99=_[_0xa14d('0x50')](_0x2b1cdb,{'sectionId':0x709});return getPlugins(_0xcece99)[_0xa14d('0x29')](function(_0x571988){if(_0xcece99['enabled']){return _['map'](_0x2b1cdb,function(_0x3bb030){if(_0x3bb030[_0xa14d('0x5c')]===0x709){_0x3bb030['subsections']=_0x571988;}return _0x3bb030;});}else{var _0x55bbeb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x571988};var _0x51f05d=_[_0xa14d('0x2f')](_0x2b1cdb);_0x51f05d[_0xa14d('0x62')](_0x55bbeb);return _0x51f05d;}});}else{return;}})[_0xa14d('0x29')](function(_0x1644cf){if(_0x1644cf)_0x2b1cdb=_0x1644cf;return _[_0xa14d('0x41')](_0x2b1cdb,['enabled',0x1]);})[_0xa14d('0x29')](respondWithResult(_0x42bea6,null))[_0xa14d('0x4a')](handleError(_0x42bea6,null));};function hasDefaultDashboard(_0x9995a5){var _0x259a37=[0x65];return new BPromise(function(_0x1a786f,_0x5624d5){try{if(_0x9995a5[_0xa14d('0x5a')]){_0x1a786f(_0x259a37);}else{return db[_0xa14d('0x5b')]['findOne']({'where':{'sectionId':_0x9995a5['id']},'raw':!![]})['then'](function(_0xad9b8b){_0xad9b8b?_0x1a786f(_0x259a37):_0x1a786f();});}}catch(_0x5219ad){_0x5624d5(_0x5219ad);}});}function getCustomDashboards(_0x57a91f){var _0x42bfc9=[];return new BPromise(function(_0x7883c7,_0x260ba6){try{if(_0x57a91f[_0xa14d('0x5a')]){return db[_0xa14d('0x6a')]['findAll']({'raw':!![]})[_0xa14d('0x29')](function(_0x299f09){_0x299f09[_0xa14d('0x6b')](function(_0x5e93ca){_0x42bfc9[_0xa14d('0x62')](_0x5e93ca['id']+0x1869f);});_0x7883c7(_0x42bfc9);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x57a91f['id']},'raw':!![]})['then'](function(_0x136ade){_0x136ade[_0xa14d('0x6b')](function(_0x544237){_0x42bfc9[_0xa14d('0x62')](_0x544237[_0xa14d('0x6c')]+0x1869f);});_0x7883c7(_0x42bfc9);});}}catch(_0x293c89){_0x260ba6(_0x293c89);}});}function getPlugins(_0x23e4ec){var _0x40fe7f=[];return new BPromise(function(_0x48b516,_0x376a77){try{if(_0x23e4ec[_0xa14d('0x5a')]){return db[_0xa14d('0x6d')]['findAll']({'raw':!![]})[_0xa14d('0x29')](function(_0xf98b11){_0xf98b11[_0xa14d('0x6b')](function(_0x500877){_0x40fe7f[_0xa14d('0x62')](_0x500877['id']+0x15b38);});_0x48b516(_0x40fe7f);});}else{return db[_0xa14d('0x5b')]['findAll']({'where':{'sectionId':_0x23e4ec['id']},'raw':!![]})[_0xa14d('0x29')](function(_0x2a2a75){_0x2a2a75[_0xa14d('0x6b')](function(_0x506f0c){_0x40fe7f['push'](_0x506f0c[_0xa14d('0x6c')]+0x15b38);});_0x48b516(_0x40fe7f);});}}catch(_0x20715e){_0x376a77(_0x20715e);}});}exports[_0xa14d('0x6e')]=function(_0x4dbef3,_0x3f014e){return db[_0xa14d('0x45')][_0xa14d('0x50')]({'where':{'id':_0x4dbef3['params']['id']}})['then'](handleEntityNotFound(_0x3f014e,null))[_0xa14d('0x29')](function(_0x5e37aa){if(_0x5e37aa){return db[_0xa14d('0x56')][_0xa14d('0x57')](function(_0x19271d){return db[_0xa14d('0x58')][_0xa14d('0x48')]({'where':{'userProfileId':_0x4dbef3[_0xa14d('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0xa14d('0x29')](function(_0x3d4164){if(_0x3d4164){return db[_0xa14d('0x58')]['destroy']({'where':{'userProfileId':_0x4dbef3[_0xa14d('0x4f')]['id'],'id':_[_0xa14d('0x2f')](_0x3d4164,function(_0x5594e5){return _0x5594e5['id'];})},'transaction':_0x19271d});}})['then'](function(_0x170341){var _0x5bb988=_[_0xa14d('0x2f')](_0x4dbef3[_0xa14d('0x4d')],function(_0x49d0e5){_0x49d0e5['userProfileId']=_0x4dbef3[_0xa14d('0x4f')]['id'];return _0x49d0e5;});return db[_0xa14d('0x58')][_0xa14d('0x6f')](_0x5bb988,{'raw':!![],'transaction':_0x19271d});})[_0xa14d('0x29')](function(_0xaf6d57){var _0x2fdd30=_['filter'](_['map'](_0xaf6d57,function(_0x255d7c){return _0x255d7c[_0xa14d('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x2fdd30){return db[_0xa14d('0x58')][_0xa14d('0x48')]({'where':{'userProfileId':_0x4dbef3['params']['id'],'sectionId':_[_0xa14d('0x2f')](_0x2fdd30,function(_0x3c0a0f){return _0x3c0a0f[_0xa14d('0x5c')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xa14d('0x29')](function(_0x5da02b){var _0x3600c9=_['map'](_0x4dbef3['body'],function(_0x55e747){_0x55e747[_0xa14d('0x5d')]=_0x4dbef3[_0xa14d('0x4f')]['id'];return _0x55e747;});return db[_0xa14d('0x5b')]['bulkCreate'](_0x3600c9,{'raw':!![],'transaction':_0x19271d});});}})[_0xa14d('0x4a')](handleError(_0x3f014e,null));});}})[_0xa14d('0x29')](function(_0x331db0){var _0x222ae9=_['map'](_0x331db0,function(_0x27615d){return _0x27615d['get']({'plain':!![]});});})[_0xa14d('0x29')](respondWithResult(_0x3f014e,null))[_0xa14d('0x4a')](handleError(_0x3f014e,null));};exports[_0xa14d('0x70')]=function(_0x486dae,_0x233e64,_0x411cd0){return db['UserProfile'][_0xa14d('0x50')]({'where':{'id':_0x486dae[_0xa14d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x233e64,null))[_0xa14d('0x29')](function(_0x252adb){if(_0x252adb){return _0x252adb[_0xa14d('0x70')](_0x486dae[_0xa14d('0x35')][_0xa14d('0x64')]);}})['then'](respondWithStatusCode(_0x233e64,null))[_0xa14d('0x4a')](handleError(_0x233e64,null));};exports[_0xa14d('0x71')]=function(_0x5c35d6,_0x2c82d0){var _0x36dc69={'raw':![],'where':{}};var _0x5ae897={};var _0xdf9129={'count':0x0,'rows':[]};var _0x420189=_0x5c35d6[_0xa14d('0x35')][_0xa14d('0x72')];if(typeof _0x420189===_0xa14d('0x73')){throw new db[(_0xa14d('0x74'))][(_0xa14d('0x75'))](_0xa14d('0x76'));}var _0x191a65=_0x5c35d6[_0xa14d('0x35')]['mergeResources']||![];var _0x169e91=getQueryModels(_0x420189,_0x191a65);if(typeof _0x169e91[_0xa14d('0x77')]===_0xa14d('0x73')){throw new db[(_0xa14d('0x74'))][(_0xa14d('0x75'))](_0xa14d('0x78')+_0x420189+'\x27');}var _0x58d3d4=[];if(!_[_0xa14d('0x68')](_0x169e91[_0xa14d('0x79')])){_0x58d3d4=_0x169e91['parentSections'];}else{_0x58d3d4=[{'name':_0x420189}];}return db[_0xa14d('0x45')][_0xa14d('0x7a')]({'where':{'id':_0x5c35d6[_0xa14d('0x4f')]['id']}})[_0xa14d('0x29')](handleEntityNotFound(_0x2c82d0,null))[_0xa14d('0x29')](function(_0x5c1e2d){if(_0x5c1e2d){var _0x223f12=[];for(var _0x5800be=0x0;_0x5800be<_0x58d3d4[_0xa14d('0x3a')];_0x5800be++){_0x223f12[_0xa14d('0x62')](db[_0xa14d('0x58')][_0xa14d('0x7a')]({'where':{'userProfileId':_0x5c1e2d['id'],'name':_0x58d3d4[_0x5800be][_0xa14d('0x2c')]},'raw':!![]}));}return BPromise[_0xa14d('0x7b')](_0x223f12);}})[_0xa14d('0x29')](function(_0x3b07d0){var _0x6ba3da=_[_0xa14d('0x41')](_0x3b07d0,function(_0x687817){return _0x687817?_0x687817:undefined;});var _0x56fabf=_[_0xa14d('0x41')](_0x58d3d4,['ignore',!![]]);var _0x27ea01=_[_0xa14d('0x68')](_0x6ba3da)&&_[_0xa14d('0x68')](_0x56fabf)?null:_[_0xa14d('0x7c')](_0x56fabf,_0x6ba3da);if(_0x27ea01){var _0x59ce69=[];for(var _0x4699d1=0x0;_0x4699d1<_0x27ea01['length'];_0x4699d1++){var _0x1f498f=_['find'](_0x58d3d4,function(_0x488a79){return _0x27ea01[_0x4699d1]?_0x488a79[_0xa14d('0x2c')]===_0x27ea01[_0x4699d1][_0xa14d('0x2c')]:null;});if(_0x1f498f){if(_0x27ea01[_0x4699d1][_0xa14d('0x7d')]){_0x59ce69[_0xa14d('0x62')](getAllResources(_0x169e91[_0xa14d('0x77')],_0x27ea01[_0x4699d1]));}else{if(!_0x27ea01[_0x4699d1][_0xa14d('0x5a')]){_0x59ce69[_0xa14d('0x62')](getAllowedResources(_0x1f498f,_0x27ea01[_0x4699d1],_0x169e91[_0xa14d('0x77')]));}else{if(_0x1f498f['model']){_0x59ce69[_0xa14d('0x62')](getAllFilteredResources(_0x1f498f,_0x27ea01[_0x4699d1]));}}}}}return BPromise['all'](_0x59ce69);}else{return null;}})[_0xa14d('0x29')](function(_0x191fad){var _0x2ad9e1=_0x191fad;var _0xc2b104=null;if(_0x2ad9e1){_0xc2b104=_0x2ad9e1[_0xa14d('0x3a')]===0x1?_0x2ad9e1[0x0]:null;}if(_0xc2b104||_0x2ad9e1){var _0x32b622=db[_0x169e91[_0xa14d('0x77')]][_0xa14d('0x30')];_0x5ae897[_0xa14d('0x34')]=_['keys'](_0x32b622);_0x5ae897[_0xa14d('0x35')]=_['keys'](_0x5c35d6[_0xa14d('0x35')]);_0x5ae897[_0xa14d('0x7e')]=_['intersection'](_0x5ae897['model'],_0x5ae897[_0xa14d('0x35')]);_0x36dc69[_0xa14d('0x39')]=_[_0xa14d('0x37')](_0x5ae897[_0xa14d('0x34')],qs[_0xa14d('0x38')](_0x5c35d6['query']['fields']));_0x36dc69[_0xa14d('0x39')]=_0x36dc69[_0xa14d('0x39')][_0xa14d('0x3a')]?_0x36dc69['attributes']:_0x5ae897[_0xa14d('0x34')];if(!_0x5c35d6[_0xa14d('0x35')][_0xa14d('0x3b')](_0xa14d('0x3c'))){_0x36dc69[_0xa14d('0x23')]=qs[_0xa14d('0x23')](_0x5c35d6['query'][_0xa14d('0x23')]);_0x36dc69[_0xa14d('0x22')]=qs['offset'](_0x5c35d6[_0xa14d('0x35')][_0xa14d('0x22')]);}_0x36dc69['order']=qs['sort'](_0x5c35d6[_0xa14d('0x35')]['sort']);_0x36dc69['where']=qs[_0xa14d('0x7e')](_[_0xa14d('0x40')](_0x5c35d6[_0xa14d('0x35')],_0x5ae897[_0xa14d('0x7e')]));if(_0x5c35d6[_0xa14d('0x35')]['filter']){_0x36dc69[_0xa14d('0x3f')]=_['merge'](_0x36dc69[_0xa14d('0x3f')],{'$or':_[_0xa14d('0x2f')](_0x32b622,function(_0x2d217c){if(_0x2d217c['type']['key']!==_0xa14d('0x43')){var _0x3aee34={};_0x3aee34[_0x2d217c['field']]={'$like':'%'+_0x5c35d6['query'][_0xa14d('0x41')]+'%'};return _0x3aee34;}})});}var _0x5a6b0c=[];if(_0xc2b104){var _0x90cdbd=_[_0xa14d('0x50')](_0x58d3d4,['name',_0xc2b104[_0xa14d('0x2c')]]);if(_0x90cdbd[_0xa14d('0x7f')]){var _0x1028e6={};if(_0x169e91[_0xa14d('0x77')]===_0xa14d('0x80')){_0x1028e6[_0x90cdbd['foreignKey']]=_['map'](_0xc2b104[_0xa14d('0x81')],'id');}else{_0x1028e6[_0x90cdbd['foreignKey']]=_0xc2b104[_0xa14d('0x81')];}_0x5a6b0c[_0xa14d('0x62')](_0x1028e6);}else{_0x36dc69[_0xa14d('0x3f')]['id']=_0xc2b104[_0xa14d('0x81')];}}else{for(var _0x498e54=0x0;_0x498e54<_0x2ad9e1[_0xa14d('0x3a')];_0x498e54++){var _0x90cdbd=_[_0xa14d('0x50')](_0x58d3d4,[_0xa14d('0x2c'),_0x2ad9e1[_0x498e54][_0xa14d('0x2c')]]);if(_0x90cdbd[_0xa14d('0x7f')]){var _0x1028e6={};_0x1028e6[_0x90cdbd[_0xa14d('0x82')]]=_0x2ad9e1[_0x498e54]['associatedResources'];_0x5a6b0c['push'](_0x1028e6);}else{if(!_0x36dc69[_0xa14d('0x3f')]['id'])_0x36dc69[_0xa14d('0x3f')]['id']=[];_0x2ad9e1[_0x498e54][_0xa14d('0x81')][_0xa14d('0x6b')](function(_0x45e9ad){_0x36dc69[_0xa14d('0x3f')]['id'][_0xa14d('0x62')](_0x45e9ad);});}}}if(!_[_0xa14d('0x68')](_0x5a6b0c)){_0x36dc69[_0xa14d('0x3f')]=_[_0xa14d('0x42')](_0x36dc69['where'],{'$and':{'$or':_0x5a6b0c}});}_0x36dc69=_[_0xa14d('0x42')]({},_0x36dc69,_0x5c35d6[_0xa14d('0x44')]);if(_0xc2b104&&!_0xc2b104[_0xa14d('0x5a')]&&_0x169e91[_0xa14d('0x77')]===_0xa14d('0x80')){if(_0x5c35d6[_0xa14d('0x35')][_0xa14d('0x46')]){_0x36dc69[_0xa14d('0x47')]=[{'all':!![]}];}return db[_0x169e91['childModel']]['findAll'](_0x36dc69)['then'](function(_0x1cdb49){var _0x57bfa4=[];_0x1cdb49[_0xa14d('0x6b')](function(_0x54d7d8){var _0x3412c9;switch(_0x54d7d8[_0xa14d('0x83')]){case'default':_0x3412c9=_[_0xa14d('0x50')](_0xc2b104[_0xa14d('0x81')],function(_0x5a8ae3){return _0x5a8ae3['id']===_0x54d7d8['reportId']&&_0x5a8ae3[_0xa14d('0x32')]===_0xa14d('0x84');});break;case _0xa14d('0x85'):_0x3412c9=_[_0xa14d('0x50')](_0xc2b104[_0xa14d('0x81')],function(_0x3ad2e7){return _0x3ad2e7['id']===_0x54d7d8[_0xa14d('0x86')]&&_0x3ad2e7['type']===_0xa14d('0x87');});break;}if(_0x3412c9)_0x57bfa4['push'](_0x54d7d8);});_0xdf9129[_0xa14d('0x21')]=_0x57bfa4[_0xa14d('0x3a')];_0xdf9129[_0xa14d('0x49')]=_0x57bfa4;return _0xdf9129;});}else{return db[_0x169e91[_0xa14d('0x77')]]['count']({'where':_0x36dc69[_0xa14d('0x3f')]})[_0xa14d('0x29')](function(_0x315061){_0xdf9129[_0xa14d('0x21')]=_0x315061;if(_0x5c35d6[_0xa14d('0x35')][_0xa14d('0x46')]){if(_0x169e91[_0xa14d('0x77')]===_0xa14d('0x88')){_0x36dc69['include']=[{'model':db[_0xa14d('0x89')],'as':_0xa14d('0x8a'),'attributes':['id',_0xa14d('0x2c'),_0xa14d('0x8b')],'required':_0x5c35d6[_0xa14d('0x35')][_0xa14d('0x8c')]?!![]:![]},{'model':db[_0xa14d('0x89')],'as':_0xa14d('0x8d'),'attributes':['id',_0xa14d('0x2c'),_0xa14d('0x8b')],'through':_0x5c35d6[_0xa14d('0x35')][_0xa14d('0x8c')]?{'attributes':[],'where':{'TagId':_0x5c35d6[_0xa14d('0x35')][_0xa14d('0x8c')]||undefined}}:{},'required':_0x5c35d6[_0xa14d('0x35')]['tag']?!![]:![]}];}else{_0x36dc69[_0xa14d('0x47')]=[{'all':!![]}];}}return db[_0x169e91[_0xa14d('0x77')]]['findAll'](_0x36dc69);})[_0xa14d('0x29')](function(_0x50b554){_0xdf9129[_0xa14d('0x49')]=_0x50b554;return _0xdf9129;});}}else{return _0xdf9129;}})[_0xa14d('0x29')](respondWithFilteredResult(_0x2c82d0,_0x36dc69))['catch'](handleError(_0x2c82d0,null));};function getAllResources(_0x309c80,_0x47a213){return new BPromise(function(_0x2a88b6,_0xc11ccf){if(_0x47a213){var _0x461727=_0x47a213['filter']?{[_0x47a213[_0xa14d('0x41')][_0xa14d('0x7f')]]:_0x47a213['filter']['value']}:undefined;return db[_0x309c80]['findAll']({'where':_0x461727,'raw':!![]})[_0xa14d('0x29')](function(_0x9acf0a){_0x47a213[_0xa14d('0x81')]=_[_0xa14d('0x2f')](_0x9acf0a,'id');_0x2a88b6(_0x47a213);})[_0xa14d('0x4a')](function(_0x3411b5){_0xc11ccf(_0x3411b5);});}else{_0x2a88b6(null);}});}function getAllFilteredResources(_0x1be17d,_0x53be88){return new BPromise(function(_0x221583,_0x5e7db8){var _0x17aa52=_0x1be17d['filter']?{[_0x1be17d['filter']['field']]:_0x1be17d['filter'][_0xa14d('0x8e')]}:undefined;return db[_0x1be17d[_0xa14d('0x34')]][_0xa14d('0x48')]({'where':_0x17aa52,'raw':!![]})[_0xa14d('0x29')](function(_0x124ce5){_0x53be88[_0xa14d('0x81')]=_['map'](_0x124ce5,function(_0x1a623e){return _0x1a623e[_0xa14d('0x2c')];});_0x221583(_0x53be88);})['catch'](function(_0x2c7033){_0x5e7db8(_0x2c7033);});});}function getAllowedResources(_0x35ed89,_0x55b43d,_0x31f3cb){return new BPromise(function(_0x2c98a8,_0x3a3d76){if(_0x55b43d){return db[_0xa14d('0x5b')]['findAll']({'where':{'sectionId':_0x55b43d['id']},'raw':!![]})['then'](function(_0x38ce77){if(_0x35ed89['field']&&_0x35ed89[_0xa14d('0x7f')]!=='id'){_0x55b43d[_0xa14d('0x81')]=_['map'](_0x38ce77,function(_0x948c2a){return _0x948c2a[_0x35ed89[_0xa14d('0x7f')]];});}else{if(_0x31f3cb===_0xa14d('0x80')){_0x55b43d[_0xa14d('0x81')]=_[_0xa14d('0x2f')](_0x38ce77,function(_0x42b6e4){return{'id':_0x42b6e4['resourceId'],'type':_0x42b6e4[_0xa14d('0x32')]};});}else{_0x55b43d[_0xa14d('0x81')]=_[_0xa14d('0x2f')](_0x38ce77,function(_0x1c556a){return _0x1c556a[_0xa14d('0x6c')];});}}_0x2c98a8(_0x55b43d);})[_0xa14d('0x4a')](function(_0x3cf21e){_0x3a3d76(_0x3cf21e);});}else{_0x2c98a8(null);}});}function getQueryModels(_0x396c7d,_0x1b0218){var _0x1d02cb=_0x396c7d[_0xa14d('0x8f')]();var _0x356f5c={'childModel':undefined,'parentSections':[]};switch(_0x1d02cb){case _0xa14d('0x90'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0x91');break;case _0xa14d('0x92'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0x93');break;case'squarerecordings':_0x356f5c[_0xa14d('0x77')]=_0xa14d('0x94');_0x356f5c[_0xa14d('0x79')]=[{'name':'SquareProjects','field':_0xa14d('0x2c'),'foreignKey':_0xa14d('0x95')}];break;case _0xa14d('0x96'):_0x356f5c['childModel']=_0xa14d('0x97');break;case _0xa14d('0x98'):_0x356f5c['childModel']=_0xa14d('0x88');_0x356f5c[_0xa14d('0x79')]=[{'name':'Lists','field':'id','foreignKey':_0xa14d('0x99')}];break;case _0xa14d('0x9a'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0x9b');break;case _0xa14d('0x9c'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0x9d');break;case'globalcustomfields':_0x356f5c['childModel']=_0xa14d('0x9e');break;case _0xa14d('0x9f'):_0x356f5c['childModel']='ChatQueue';break;case _0xa14d('0xa0'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xa1');break;case _0xa14d('0xa2'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xa3');break;case _0xa14d('0xa4'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xa5');break;case _0xa14d('0xa6'):case'internalroutes':case _0xa14d('0xa7'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xa8');break;case _0xa14d('0xa9'):_0x356f5c[_0xa14d('0x77')]='VoiceContext';break;case _0xa14d('0xaa'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xab');break;case'voicerecordings':_0x356f5c['childModel']='VoiceRecording';_0x356f5c[_0xa14d('0x79')]=[{'name':'Agents','field':_0xa14d('0x2c'),'foreignKey':_0xa14d('0xac'),'model':_0xa14d('0xad'),'filter':{'field':_0xa14d('0xae'),'value':['agent']}},{'name':_0xa14d('0xaf'),'field':'name','foreignKey':'membername','model':_0xa14d('0xad'),'filter':{'field':_0xa14d('0xae'),'value':['telephone']}},{'name':_0xa14d('0xb0'),'field':'name','foreignKey':_0xa14d('0xb1'),'model':'VoiceQueue','filter':{'field':_0xa14d('0x32'),'value':[_0xa14d('0xb2')]}},{'name':_0xa14d('0xb3'),'field':_0xa14d('0x2c'),'foreignKey':'queue','model':_0xa14d('0xb4'),'filter':{'field':_0xa14d('0x32'),'value':[_0xa14d('0xb5')]}}];break;case _0xa14d('0xb6'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xb7');break;case _0xa14d('0xb8'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xb9');break;case _0xa14d('0xba'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xbb');break;case _0xa14d('0xbc'):_0x356f5c['childModel']=_0xa14d('0xbd');break;case _0xa14d('0xbe'):_0x356f5c[_0xa14d('0x77')]='MailQueue';break;case'mailaccounts':_0x356f5c['childModel']='MailAccount';break;case _0xa14d('0xbf'):_0x356f5c[_0xa14d('0x77')]='MailSubstatus';break;case _0xa14d('0xc0'):_0x356f5c[_0xa14d('0x77')]='OpenchannelQueue';break;case _0xa14d('0xc1'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xc2');break;case _0xa14d('0xc3'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xc4');break;case _0xa14d('0xc5'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xc6');break;case _0xa14d('0xc7'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xc8');break;case _0xa14d('0xc9'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xca');break;case'teams':_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xcb');break;case _0xa14d('0xcc'):case _0xa14d('0xcd'):_0x356f5c['childModel']=_0xa14d('0xb4');if(_0x1b0218){_0x356f5c[_0xa14d('0x79')]=[{'name':_0xa14d('0xb0')},{'name':'QueueCampaigns'}];}break;case _0xa14d('0xce'):case _0xa14d('0xcf'):case'telephones':_0x356f5c['childModel']=_0xa14d('0xad');if(_0x1b0218){_0x356f5c['parentSections']=[{'name':_0xa14d('0xd0'),'filter':{'field':_0xa14d('0xae'),'value':[_0xa14d('0xd1'),_0xa14d('0xd2')]},'ignore':!![]},{'name':_0xa14d('0xd3')},{'name':_0xa14d('0xaf')}];}break;case _0xa14d('0xd4'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xd5');break;case _0xa14d('0xd6'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xd7');break;case _0xa14d('0xd8'):_0x356f5c[_0xa14d('0x77')]='FreshdeskAccount';break;case _0xa14d('0xd9'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xda');break;case'deskaccounts':_0x356f5c['childModel']=_0xa14d('0xdb');break;case _0xa14d('0xdc'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xdd');break;case _0xa14d('0xde'):_0x356f5c['childModel']='User';break;case'cannedanswers':_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xdf');break;case'dispositions':_0x356f5c['childModel']=_0xa14d('0xe0');break;case _0xa14d('0xe1'):_0x356f5c[_0xa14d('0x77')]='Dashboard';break;case _0xa14d('0xe2'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xe3');break;case _0xa14d('0xe4'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xe5');break;case _0xa14d('0xe6'):_0x356f5c['childModel']='Schedule';break;case _0xa14d('0xe7'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xe8');break;case _0xa14d('0xe9'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0x89');break;case'templates':_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xea');break;case _0xa14d('0xeb'):_0x356f5c['childModel']='Trigger';break;case _0xa14d('0xec'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xed');break;case _0xa14d('0xee'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0xef');break;case _0xa14d('0xf0'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0x6d');break;case _0xa14d('0xf1'):_0x356f5c[_0xa14d('0x77')]=_0xa14d('0x80');_0x356f5c[_0xa14d('0x79')]=[{'name':_0xa14d('0xf2'),'field':'id','foreignKey':'reportId'}];break;case _0xa14d('0xf3'):_0x356f5c['childModel']=_0xa14d('0xf4');break;case _0xa14d('0xc9'):_0x356f5c[_0xa14d('0x77')]='WhatsappAccount';break;default:return _0x356f5c;}return _0x356f5c;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index cfbd744..bde08de 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 _0xda8a=['update','emit','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x226db2,_0x1c1220){var _0xf1ac44=function(_0x4dc120){while(--_0x4dc120){_0x226db2['push'](_0x226db2['shift']());}};_0xf1ac44(++_0x1c1220);}(_0xda8a,0x17e));var _0xada8=function(_0x1f51d8,_0x3376e7){_0x1f51d8=_0x1f51d8-0x0;var _0x4bb2b7=_0xda8a[_0x1f51d8];return _0x4bb2b7;};'use strict';var EventEmitter=require(_0xada8('0x0'));var UserProfile=require(_0xada8('0x1'))['db'][_0xada8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xada8('0x3')](0x0);var events={'afterCreate':_0xada8('0x4'),'afterUpdate':_0xada8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x381347){return function(_0x3d8281,_0x35b3e3,_0x46725f){UserProfileEvents[_0xada8('0x6')](_0x381347+':'+_0x3d8281['id'],_0x3d8281);UserProfileEvents['emit'](_0x381347,_0x3d8281);_0x46725f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xada8('0x7')](e,emitEvent(event));}}module[_0xada8('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xb906=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x82e645,_0x16f7af){var _0x523d0d=function(_0x2b606f){while(--_0x2b606f){_0x82e645['push'](_0x82e645['shift']());}};_0x523d0d(++_0x16f7af);}(_0xb906,0x1b6));var _0x6b90=function(_0x463d21,_0x1143cd){_0x463d21=_0x463d21-0x0;var _0x4e139b=_0xb906[_0x463d21];return _0x4e139b;};'use strict';var EventEmitter=require(_0x6b90('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6b90('0x1')](0x0);var events={'afterCreate':_0x6b90('0x2'),'afterUpdate':_0x6b90('0x3'),'afterDestroy':_0x6b90('0x4')};function emitEvent(_0x37d8bd){return function(_0x3e95f3,_0x28f50a,_0x55345d){UserProfileEvents['emit'](_0x37d8bd+':'+_0x3e95f3['id'],_0x3e95f3);UserProfileEvents[_0x6b90('0x5')](_0x37d8bd,_0x3e95f3);_0x55345d(null);};}for(var e in events){if(events[_0x6b90('0x6')](e)){var event=events[e];UserProfile[_0x6b90('0x7')](e,emitEvent(event));}}module[_0x6b90('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index fbbc5a8..b609125 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 _0x570c=['path','../../config/environment','./userProfile.attributes','exports','define','UserProfile','lodash','util','api','moment','bluebird','request-promise'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0x570c,0xf6));var _0xc570=function(_0x190f15,_0x1b4182){_0x190f15=_0x190f15-0x0;var _0x7e649a=_0x570c[_0x190f15];return _0x7e649a;};'use strict';var _=require(_0xc570('0x0'));var util=require(_0xc570('0x1'));var logger=require('../../config/logger')(_0xc570('0x2'));var moment=require(_0xc570('0x3'));var BPromise=require(_0xc570('0x4'));var rp=require(_0xc570('0x5'));var fs=require('fs');var path=require(_0xc570('0x6'));var rimraf=require('rimraf');var config=require(_0xc570('0x7'));var attributes=require(_0xc570('0x8'));module[_0xc570('0x9')]=function(_0xe4fdee,_0x131a59){return _0xe4fdee[_0xc570('0xa')](_0xc570('0xb'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2d2=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','lodash','util','../../config/logger','api','moment'];(function(_0xe1150a,_0x199580){var _0xf98e7c=function(_0x524855){while(--_0x524855){_0xe1150a['push'](_0xe1150a['shift']());}};_0xf98e7c(++_0x199580);}(_0xa2d2,0xe9));var _0x2a2d=function(_0x1e6b10,_0x4c284d){_0x1e6b10=_0x1e6b10-0x0;var _0x3c6396=_0xa2d2[_0x1e6b10];return _0x3c6396;};'use strict';var _=require(_0x2a2d('0x0'));var util=require(_0x2a2d('0x1'));var logger=require(_0x2a2d('0x2'))(_0x2a2d('0x3'));var moment=require(_0x2a2d('0x4'));var BPromise=require(_0x2a2d('0x5'));var rp=require(_0x2a2d('0x6'));var fs=require('fs');var path=require(_0x2a2d('0x7'));var rimraf=require(_0x2a2d('0x8'));var config=require(_0x2a2d('0x9'));var attributes=require(_0x2a2d('0xa'));module[_0x2a2d('0xb')]=function(_0x14842f,_0x21e804){return _0x14842f[_0x2a2d('0xc')](_0x2a2d('0xd'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index da3b3b6..f0b62c1 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 _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x2daa57,_0x3552fd){var _0x5ce87a=function(_0xc8bbe){while(--_0xc8bbe){_0x2daa57['push'](_0x2daa57['shift']());}};_0x5ce87a(++_0x3552fd);}(_0x814b,0x1a2));var _0xb814=function(_0x2247ab,_0x3f4162){_0x2247ab=_0x2247ab-0x0;var _0x430062=_0x814b[_0x2247ab];return _0x430062;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});config[_0xb814('0xc')]=_[_0xb814('0xd')](config['redis'],{'host':_0xb814('0xe'),'port':0x18eb});var socket=require(_0xb814('0xf'))(new Redis(config[_0xb814('0xc')]));require(_0xb814('0x10'))[_0xb814('0x11')](socket);function respondWithRpcPromise(_0x21d4a5,_0x1086f8,_0x19aad8){return new BPromise(function(_0x207dbc,_0x3450f2){return client[_0xb814('0x12')](_0x21d4a5,_0x19aad8)['then'](function(_0x43dfe6){logger['info'](_0xb814('0x13'),_0x1086f8,_0xb814('0x14'));logger[_0xb814('0x15')](_0xb814('0x16'),_0x1086f8,_0xb814('0x14'),JSON[_0xb814('0x17')](_0x43dfe6));if(_0x43dfe6[_0xb814('0x18')]){if(_0x43dfe6[_0xb814('0x18')][_0xb814('0x19')]===0x1f4){logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x3450f2(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x207dbc(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}else{logger['info'](_0xb814('0x13'),_0x1086f8,'request\x20sent');_0x207dbc(_0x43dfe6[_0xb814('0x1b')][_0xb814('0x1a')]);}})['catch'](function(_0x4b55a7){logger['error'](_0xb814('0x13'),_0x1086f8,_0x4b55a7);_0x3450f2(_0x4b55a7);});});} \ No newline at end of file +var _0x7da7=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2dcccd,_0x51a24f){var _0xbc84bf=function(_0x5c29bc){while(--_0x5c29bc){_0x2dcccd['push'](_0x2dcccd['shift']());}};_0xbc84bf(++_0x51a24f);}(_0x7da7,0x10d));var _0x77da=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0x7da7[_0x58fc2f];return _0x3a1312;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});config[_0x77da('0x9')]=_['defaults'](config[_0x77da('0x9')],{'host':_0x77da('0xa'),'port':0x18eb});var socket=require(_0x77da('0xb'))(new Redis(config[_0x77da('0x9')]));require(_0x77da('0xc'))['register'](socket);function respondWithRpcPromise(_0x40c86e,_0xb55827,_0x172d7f){return new BPromise(function(_0x5ea12f,_0x35d06e){return client[_0x77da('0xd')](_0x40c86e,_0x172d7f)[_0x77da('0xe')](function(_0x2a675a){logger['info'](_0x77da('0xf'),_0xb55827,_0x77da('0x10'));logger[_0x77da('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xb55827,'request\x20sent',JSON[_0x77da('0x12')](_0x2a675a));if(_0x2a675a[_0x77da('0x13')]){if(_0x2a675a['error'][_0x77da('0x14')]===0x1f4){logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x2a675a[_0x77da('0x13')]['message']);return _0x35d06e(_0x2a675a[_0x77da('0x13')]['message']);}logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x2a675a[_0x77da('0x13')][_0x77da('0x15')]);return _0x5ea12f(_0x2a675a['error']['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0xb55827,_0x77da('0x10'));_0x5ea12f(_0x2a675a[_0x77da('0x16')][_0x77da('0x15')]);}})[_0x77da('0x17')](function(_0x19a00c){logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x19a00c);_0x35d06e(_0x19a00c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a712eca..24ec888 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 _0xcbb6=['remove','update','emit','register','length','userProfile:','./userProfile.events','save'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xcbb6,0x7e));var _0x6cbb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcbb6[_0xa464c9];return _0x3d73c4;};'use strict';var UserProfileEvents=require(_0x6cbb('0x0'));var events=[_0x6cbb('0x1'),_0x6cbb('0x2'),_0x6cbb('0x3')];function createListener(_0x47ffa6,_0x54b07a){return function(_0x1baaa5){_0x54b07a[_0x6cbb('0x4')](_0x47ffa6,_0x1baaa5);};}function removeListener(_0x56aacb,_0x1b2e44){return function(){UserProfileEvents['removeListener'](_0x56aacb,_0x1b2e44);};}exports[_0x6cbb('0x5')]=function(_0x39e1ae){for(var _0x4c9ce4=0x0,_0xfb95b5=events[_0x6cbb('0x6')];_0x4c9ce4<_0xfb95b5;_0x4c9ce4++){var _0x16ef43=events[_0x4c9ce4];var _0x64617b=createListener(_0x6cbb('0x7')+_0x16ef43,_0x39e1ae);UserProfileEvents['on'](_0x16ef43,_0x64617b);}}; \ No newline at end of file +var _0xafb3=['remove','removeListener','./userProfile.events','save'];(function(_0x580f8b,_0x19bc1c){var _0x5259b4=function(_0x19bd5c){while(--_0x19bd5c){_0x580f8b['push'](_0x580f8b['shift']());}};_0x5259b4(++_0x19bc1c);}(_0xafb3,0x10a));var _0x3afb=function(_0x1672b4,_0x58df4c){_0x1672b4=_0x1672b4-0x0;var _0x670cc7=_0xafb3[_0x1672b4];return _0x670cc7;};'use strict';var UserProfileEvents=require(_0x3afb('0x0'));var events=[_0x3afb('0x1'),_0x3afb('0x2'),'update'];function createListener(_0x38bf48,_0x32414b){return function(_0x2838cf){_0x32414b['emit'](_0x38bf48,_0x2838cf);};}function removeListener(_0x1d93c2,_0x43b190){return function(){UserProfileEvents[_0x3afb('0x3')](_0x1d93c2,_0x43b190);};}exports['register']=function(_0x672132){for(var _0x6479a0=0x0,_0x531b00=events['length'];_0x6479a0<_0x531b00;_0x6479a0++){var _0x29ba37=events[_0x6479a0];var _0x15f9cd=createListener('userProfile:'+_0x29ba37,_0x672132);UserProfileEvents['on'](_0x29ba37,_0x15f9cd);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c6013dc..65bb9bf 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 _0x7c63=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller'];(function(_0xf13780,_0x1e4a5f){var _0x4c1b1a=function(_0x44655e){while(--_0x44655e){_0xf13780['push'](_0xf13780['shift']());}};_0x4c1b1a(++_0x1e4a5f);}(_0x7c63,0xf3));var _0x37c6=function(_0x1c5d1c,_0x3e5a6e){_0x1c5d1c=_0x1c5d1c-0x0;var _0x3c5ad0=_0x7c63[_0x1c5d1c];return _0x3c5ad0;};'use strict';var multer=require(_0x37c6('0x0'));var util=require(_0x37c6('0x1'));var path=require(_0x37c6('0x2'));var timeout=require(_0x37c6('0x3'));var express=require('express');var router=express[_0x37c6('0x4')]();var auth=require(_0x37c6('0x5'));var interaction=require(_0x37c6('0x6'));var config=require(_0x37c6('0x7'));var controller=require(_0x37c6('0x8'));router[_0x37c6('0x9')]('/',auth[_0x37c6('0xa')](),controller[_0x37c6('0xb')]);router['get'](_0x37c6('0xc'),auth[_0x37c6('0xa')](),controller[_0x37c6('0xd')]);router[_0x37c6('0x9')](_0x37c6('0xe'),auth['isAuthenticated'](),controller[_0x37c6('0xf')]);router[_0x37c6('0x10')]('/',auth[_0x37c6('0xa')](),controller['create']);router[_0x37c6('0x11')](_0x37c6('0xe'),auth[_0x37c6('0xa')](),controller['update']);router[_0x37c6('0x12')](_0x37c6('0xe'),auth[_0x37c6('0xa')](),controller[_0x37c6('0x13')]);module[_0x37c6('0x14')]=router; \ No newline at end of file +var _0x6100=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0x5c2925,_0x4ba252){var _0x50b830=function(_0x43afdd){while(--_0x43afdd){_0x5c2925['push'](_0x5c2925['shift']());}};_0x50b830(++_0x4ba252);}(_0x6100,0x1e1));var _0x0610=function(_0x5bb803,_0x1d8b26){_0x5bb803=_0x5bb803-0x0;var _0x5bd35d=_0x6100[_0x5bb803];return _0x5bd35d;};'use strict';var multer=require(_0x0610('0x0'));var util=require(_0x0610('0x1'));var path=require(_0x0610('0x2'));var timeout=require(_0x0610('0x3'));var express=require(_0x0610('0x4'));var router=express['Router']();var auth=require(_0x0610('0x5'));var interaction=require(_0x0610('0x6'));var config=require(_0x0610('0x7'));var controller=require(_0x0610('0x8'));router[_0x0610('0x9')]('/',auth[_0x0610('0xa')](),controller[_0x0610('0xb')]);router['get'](_0x0610('0xc'),auth['isAuthenticated'](),controller[_0x0610('0xd')]);router[_0x0610('0x9')](_0x0610('0xe'),auth[_0x0610('0xa')](),controller['show']);router[_0x0610('0xf')]('/',auth['isAuthenticated'](),controller[_0x0610('0x10')]);router[_0x0610('0x11')](_0x0610('0xe'),auth[_0x0610('0xa')](),controller[_0x0610('0x12')]);router[_0x0610('0x13')](_0x0610('0xe'),auth[_0x0610('0xa')](),controller[_0x0610('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f5ffcab..293a483 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 _0xf3d2=['STRING','INTEGER','sequelize','exports'];(function(_0x2926d9,_0x16ad9f){var _0x53b48d=function(_0x3a9ce5){while(--_0x3a9ce5){_0x2926d9['push'](_0x2926d9['shift']());}};_0x53b48d(++_0x16ad9f);}(_0xf3d2,0x1da));var _0x2f3d=function(_0x29cd14,_0x245c40){_0x29cd14=_0x29cd14-0x0;var _0x4229d1=_0xf3d2[_0x29cd14];return _0x4229d1;};'use strict';var Sequelize=require(_0x2f3d('0x0'));module[_0x2f3d('0x1')]={'name':{'type':Sequelize[_0x2f3d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2f3d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2f3d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x93e0=['STRING','INTEGER','sequelize','exports'];(function(_0x215124,_0xf4bfd7){var _0x22b149=function(_0x2b53b3){while(--_0x2b53b3){_0x215124['push'](_0x215124['shift']());}};_0x22b149(++_0xf4bfd7);}(_0x93e0,0xf2));var _0x093e=function(_0x4759ab,_0x354f6d){_0x4759ab=_0x4759ab-0x0;var _0x4cdbf8=_0x93e0[_0x4759ab];return _0x4cdbf8;};'use strict';var Sequelize=require(_0x093e('0x0'));module[_0x093e('0x1')]={'name':{'type':Sequelize[_0x093e('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x093e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x093e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index e61a2fb..1bbbfed 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 _0xac31=['end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','UserProfileResource','findAll','rows','catch','show','params','keys','include','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','status'];(function(_0x40fc07,_0x2627f4){var _0x30bded=function(_0x5b87fa){while(--_0x5b87fa){_0x40fc07['push'](_0x40fc07['shift']());}};_0x30bded(++_0x2627f4);}(_0xac31,0xca));var _0x1ac3=function(_0x3ed12c,_0x4ef5e7){_0x3ed12c=_0x3ed12c-0x0;var _0x30a6b5=_0xac31[_0x3ed12c];return _0x30a6b5;};'use strict';var pdf=require(_0x1ac3('0x0'));var emlformat=require(_0x1ac3('0x1'));var rimraf=require(_0x1ac3('0x2'));var zipdir=require(_0x1ac3('0x3'));var jsonpatch=require(_0x1ac3('0x4'));var rp=require(_0x1ac3('0x5'));var moment=require(_0x1ac3('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1ac3('0x7'));var util=require(_0x1ac3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1ac3('0x9'));var ejs=require(_0x1ac3('0xa'));var fs=require('fs');var _=require(_0x1ac3('0xb'));var squel=require(_0x1ac3('0xc'));var crypto=require(_0x1ac3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ac3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ac3('0xf'));var Papa=require(_0x1ac3('0x10'));var Redis=require(_0x1ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ac3('0x12'));var as=require(_0x1ac3('0x13'));var hardwareService=require(_0x1ac3('0x14'));var logger=require(_0x1ac3('0x15'))(_0x1ac3('0x16'));var utils=require(_0x1ac3('0x17'));var config=require('../../config/environment');var db=require(_0x1ac3('0x18'))['db'];function respondWithStatusCode(_0x376814,_0x2eeabf){_0x2eeabf=_0x2eeabf||0xcc;return function(_0x2338b9){if(_0x2338b9){return _0x376814['sendStatus'](_0x2eeabf);}return _0x376814[_0x1ac3('0x19')](_0x2eeabf)[_0x1ac3('0x1a')]();};}function respondWithResult(_0x46c0e9,_0x2def9f){_0x2def9f=_0x2def9f||0xc8;return function(_0x53cc35){if(_0x53cc35){return _0x46c0e9[_0x1ac3('0x19')](_0x2def9f)[_0x1ac3('0x1b')](_0x53cc35);}};}function respondWithFilteredResult(_0x551eac,_0x29a7b3){return function(_0x1f9641){if(_0x1f9641){var _0x38b52a=_0x1f9641[_0x1ac3('0x1c')],_0x51f1e4=_0x29a7b3['offset'],_0x2f14ca=_0x29a7b3[_0x1ac3('0x1d')]+_0x29a7b3['limit'],_0x8590ce;if(_0x2f14ca>=_0x38b52a){_0x2f14ca=_0x38b52a;_0x8590ce=0xc8;}else{_0x8590ce=0xce;}_0x551eac[_0x1ac3('0x19')](_0x8590ce);return _0x551eac[_0x1ac3('0x1e')](_0x1ac3('0x1f'),_0x51f1e4+'-'+_0x2f14ca+'/'+_0x38b52a)[_0x1ac3('0x1b')](_0x1f9641);}return null;};}function patchUpdates(_0x18b985){return function(_0x557076){try{jsonpatch[_0x1ac3('0x20')](_0x557076,_0x18b985,!![]);}catch(_0x2ea481){return BPromise[_0x1ac3('0x21')](_0x2ea481);}return _0x557076[_0x1ac3('0x22')]();};}function saveUpdates(_0x5f1918,_0x48d18a){return function(_0x2879d8){if(_0x2879d8){return _0x2879d8[_0x1ac3('0x23')](_0x5f1918)[_0x1ac3('0x24')](function(_0x139ac6){return _0x139ac6;});}return null;};}function removeEntity(_0x2aff34,_0x319988){return function(_0x23b767){if(_0x23b767){return _0x23b767[_0x1ac3('0x25')]()[_0x1ac3('0x24')](function(){_0x2aff34['status'](0xcc)[_0x1ac3('0x1a')]();});}};}function handleEntityNotFound(_0x231b7f,_0x4b19f2){return function(_0x2b5182){if(!_0x2b5182){_0x231b7f[_0x1ac3('0x26')](0x194);}return _0x2b5182;};}function handleError(_0x5eee48,_0xf9affb){_0xf9affb=_0xf9affb||0x1f4;return function(_0x2f65e8){logger[_0x1ac3('0x27')](_0x2f65e8[_0x1ac3('0x28')]);if(_0x2f65e8[_0x1ac3('0x29')]){delete _0x2f65e8['name'];}_0x5eee48['status'](_0xf9affb)['send'](_0x2f65e8);};}exports['index']=function(_0x52a1a5,_0x3ea482){var _0x4b04fb={},_0x424b68={},_0x3e4a4e={'count':0x0,'rows':[]};var _0x4243e4=_[_0x1ac3('0x2a')](db['UserProfileResource'][_0x1ac3('0x2b')],function(_0x541da0){return{'name':_0x541da0[_0x1ac3('0x2c')],'type':_0x541da0[_0x1ac3('0x2d')][_0x1ac3('0x2e')]};});_0x424b68[_0x1ac3('0x2f')]=_[_0x1ac3('0x2a')](_0x4243e4,_0x1ac3('0x29'));_0x424b68[_0x1ac3('0x30')]=_['keys'](_0x52a1a5[_0x1ac3('0x30')]);_0x424b68[_0x1ac3('0x31')]=_[_0x1ac3('0x32')](_0x424b68[_0x1ac3('0x2f')],_0x424b68['query']);_0x4b04fb[_0x1ac3('0x33')]=_[_0x1ac3('0x32')](_0x424b68[_0x1ac3('0x2f')],qs[_0x1ac3('0x34')](_0x52a1a5[_0x1ac3('0x30')]['fields']));_0x4b04fb[_0x1ac3('0x33')]=_0x4b04fb[_0x1ac3('0x33')][_0x1ac3('0x35')]?_0x4b04fb[_0x1ac3('0x33')]:_0x424b68[_0x1ac3('0x2f')];if(!_0x52a1a5[_0x1ac3('0x30')]['hasOwnProperty'](_0x1ac3('0x36'))){_0x4b04fb[_0x1ac3('0x37')]=qs[_0x1ac3('0x37')](_0x52a1a5[_0x1ac3('0x30')]['limit']);_0x4b04fb[_0x1ac3('0x1d')]=qs[_0x1ac3('0x1d')](_0x52a1a5[_0x1ac3('0x30')][_0x1ac3('0x1d')]);}_0x4b04fb[_0x1ac3('0x38')]=qs[_0x1ac3('0x39')](_0x52a1a5[_0x1ac3('0x30')][_0x1ac3('0x39')]);_0x4b04fb[_0x1ac3('0x3a')]=qs['filters'](_[_0x1ac3('0x3b')](_0x52a1a5[_0x1ac3('0x30')],_0x424b68['filters']),_0x4243e4);if(_0x52a1a5[_0x1ac3('0x30')][_0x1ac3('0x3c')]){_0x4b04fb[_0x1ac3('0x3a')]=_[_0x1ac3('0x3d')](_0x4b04fb[_0x1ac3('0x3a')],{'$or':_[_0x1ac3('0x2a')](_0x4243e4,function(_0x1c8bf5){if(_0x1c8bf5[_0x1ac3('0x2d')]!=='VIRTUAL'){var _0x17fc8a={};_0x17fc8a[_0x1c8bf5['name']]={'$like':'%'+_0x52a1a5[_0x1ac3('0x30')][_0x1ac3('0x3c')]+'%'};return _0x17fc8a;}})});}_0x4b04fb=_[_0x1ac3('0x3d')]({},_0x4b04fb,_0x52a1a5[_0x1ac3('0x3e')]);var _0x3141ae={'where':_0x4b04fb[_0x1ac3('0x3a')]};return db['UserProfileResource'][_0x1ac3('0x1c')](_0x3141ae)[_0x1ac3('0x24')](function(_0x43d15){_0x3e4a4e['count']=_0x43d15;if(_0x52a1a5[_0x1ac3('0x30')][_0x1ac3('0x3f')]){_0x4b04fb['include']=[{'all':!![]}];}return db[_0x1ac3('0x40')][_0x1ac3('0x41')](_0x4b04fb);})[_0x1ac3('0x24')](function(_0x1b0099){_0x3e4a4e[_0x1ac3('0x42')]=_0x1b0099;return _0x3e4a4e;})[_0x1ac3('0x24')](respondWithFilteredResult(_0x3ea482,_0x4b04fb))[_0x1ac3('0x43')](handleError(_0x3ea482,null));};exports[_0x1ac3('0x44')]=function(_0x48a0a2,_0xdb46af){var _0x3e606f={'raw':![],'where':{'id':_0x48a0a2[_0x1ac3('0x45')]['id']}},_0x40ea2c={};_0x40ea2c[_0x1ac3('0x2f')]=_[_0x1ac3('0x46')](db[_0x1ac3('0x40')]['rawAttributes']);_0x40ea2c['query']=_[_0x1ac3('0x46')](_0x48a0a2[_0x1ac3('0x30')]);_0x40ea2c['filters']=_[_0x1ac3('0x32')](_0x40ea2c[_0x1ac3('0x2f')],_0x40ea2c['query']);_0x3e606f[_0x1ac3('0x33')]=_['intersection'](_0x40ea2c[_0x1ac3('0x2f')],qs[_0x1ac3('0x34')](_0x48a0a2[_0x1ac3('0x30')][_0x1ac3('0x34')]));_0x3e606f['attributes']=_0x3e606f[_0x1ac3('0x33')][_0x1ac3('0x35')]?_0x3e606f[_0x1ac3('0x33')]:_0x40ea2c[_0x1ac3('0x2f')];if(_0x48a0a2[_0x1ac3('0x30')]['includeAll']){_0x3e606f[_0x1ac3('0x47')]=[{'all':!![]}];}_0x3e606f=_[_0x1ac3('0x3d')]({},_0x3e606f,_0x48a0a2[_0x1ac3('0x3e')]);return db[_0x1ac3('0x40')]['find'](_0x3e606f)[_0x1ac3('0x24')](handleEntityNotFound(_0xdb46af,null))[_0x1ac3('0x24')](respondWithResult(_0xdb46af,null))[_0x1ac3('0x43')](handleError(_0xdb46af,null));};exports[_0x1ac3('0x48')]=function(_0x47af4e,_0x3e7ea9){return db[_0x1ac3('0x40')][_0x1ac3('0x48')](_0x47af4e[_0x1ac3('0x49')],{})['then'](respondWithResult(_0x3e7ea9,0xc9))[_0x1ac3('0x43')](handleError(_0x3e7ea9,null));};exports['update']=function(_0x290ddb,_0x10bcaf){if(_0x290ddb[_0x1ac3('0x49')]['id']){delete _0x290ddb[_0x1ac3('0x49')]['id'];}return db[_0x1ac3('0x40')][_0x1ac3('0x4a')]({'where':{'id':_0x290ddb[_0x1ac3('0x45')]['id']}})['then'](handleEntityNotFound(_0x10bcaf,null))['then'](saveUpdates(_0x290ddb[_0x1ac3('0x49')],null))[_0x1ac3('0x24')](respondWithResult(_0x10bcaf,null))[_0x1ac3('0x43')](handleError(_0x10bcaf,null));};exports['destroy']=function(_0x593232,_0x5b85c5){return db[_0x1ac3('0x40')][_0x1ac3('0x4a')]({'where':{'id':_0x593232['params']['id']}})[_0x1ac3('0x24')](handleEntityNotFound(_0x5b85c5,null))[_0x1ac3('0x24')](removeEntity(_0x5b85c5,null))[_0x1ac3('0x43')](handleError(_0x5b85c5,null));};exports[_0x1ac3('0x4b')]=function(_0x47bf05,_0x5a890c){return db[_0x1ac3('0x40')][_0x1ac3('0x4b')]()['then'](respondWithResult(_0x5a890c,null))[_0x1ac3('0x43')](handleError(_0x5a890c,null));}; \ No newline at end of file +var _0x2123=['VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x3ac8e9,_0x3b1b6e){var _0x28616b=function(_0x13b3dd){while(--_0x13b3dd){_0x3ac8e9['push'](_0x3ac8e9['shift']());}};_0x28616b(++_0x3b1b6e);}(_0x2123,0x190));var _0x3212=function(_0xcab838,_0x599624){_0xcab838=_0xcab838-0x0;var _0xba7068=_0x2123[_0xcab838];return _0xba7068;};'use strict';var pdf=require(_0x3212('0x0'));var emlformat=require(_0x3212('0x1'));var rimraf=require(_0x3212('0x2'));var zipdir=require(_0x3212('0x3'));var jsonpatch=require(_0x3212('0x4'));var rp=require(_0x3212('0x5'));var moment=require(_0x3212('0x6'));var BPromise=require(_0x3212('0x7'));var Mustache=require(_0x3212('0x8'));var util=require(_0x3212('0x9'));var path=require(_0x3212('0xa'));var sox=require(_0x3212('0xb'));var csv=require('to-csv');var ejs=require(_0x3212('0xc'));var fs=require('fs');var _=require(_0x3212('0xd'));var squel=require(_0x3212('0xe'));var crypto=require('crypto');var jsforce=require(_0x3212('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3212('0x10'));var querystring=require(_0x3212('0x11'));var Papa=require(_0x3212('0x12'));var Redis=require(_0x3212('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3212('0x14'));var hardwareService=require(_0x3212('0x15'));var logger=require(_0x3212('0x16'))(_0x3212('0x17'));var utils=require(_0x3212('0x18'));var config=require(_0x3212('0x19'));var db=require(_0x3212('0x1a'))['db'];function respondWithStatusCode(_0x359cef,_0x26c1c8){_0x26c1c8=_0x26c1c8||0xcc;return function(_0x2d5fce){if(_0x2d5fce){return _0x359cef[_0x3212('0x1b')](_0x26c1c8);}return _0x359cef[_0x3212('0x1c')](_0x26c1c8)[_0x3212('0x1d')]();};}function respondWithResult(_0x3c8cce,_0x271593){_0x271593=_0x271593||0xc8;return function(_0x3d1fda){if(_0x3d1fda){return _0x3c8cce[_0x3212('0x1c')](_0x271593)[_0x3212('0x1e')](_0x3d1fda);}};}function respondWithFilteredResult(_0x19edfb,_0x46c5f5){return function(_0x42069c){if(_0x42069c){var _0x1ef2f7=_0x42069c[_0x3212('0x1f')],_0x5b2ab8=_0x46c5f5[_0x3212('0x20')],_0x43a642=_0x46c5f5[_0x3212('0x20')]+_0x46c5f5[_0x3212('0x21')],_0x1719a5;if(_0x43a642>=_0x1ef2f7){_0x43a642=_0x1ef2f7;_0x1719a5=0xc8;}else{_0x1719a5=0xce;}_0x19edfb[_0x3212('0x1c')](_0x1719a5);return _0x19edfb['set']('Content-Range',_0x5b2ab8+'-'+_0x43a642+'/'+_0x1ef2f7)[_0x3212('0x1e')](_0x42069c);}return null;};}function patchUpdates(_0x49f5c2){return function(_0x2380e8){try{jsonpatch[_0x3212('0x22')](_0x2380e8,_0x49f5c2,!![]);}catch(_0xb0b717){return BPromise[_0x3212('0x23')](_0xb0b717);}return _0x2380e8[_0x3212('0x24')]();};}function saveUpdates(_0x4aa12a,_0x41e61e){return function(_0x462094){if(_0x462094){return _0x462094['update'](_0x4aa12a)[_0x3212('0x25')](function(_0x3fa445){return _0x3fa445;});}return null;};}function removeEntity(_0x293b96,_0x4e3eda){return function(_0x5d27d5){if(_0x5d27d5){return _0x5d27d5[_0x3212('0x26')]()[_0x3212('0x25')](function(){_0x293b96[_0x3212('0x1c')](0xcc)[_0x3212('0x1d')]();});}};}function handleEntityNotFound(_0x3ceb3c,_0x436ecd){return function(_0x47d941){if(!_0x47d941){_0x3ceb3c['sendStatus'](0x194);}return _0x47d941;};}function handleError(_0x2e8518,_0x47cfdc){_0x47cfdc=_0x47cfdc||0x1f4;return function(_0x24cdf3){logger[_0x3212('0x27')](_0x24cdf3[_0x3212('0x28')]);if(_0x24cdf3['name']){delete _0x24cdf3[_0x3212('0x29')];}_0x2e8518[_0x3212('0x1c')](_0x47cfdc)[_0x3212('0x2a')](_0x24cdf3);};}exports['index']=function(_0x206980,_0x35b4eb){var _0x108eee={},_0x443a5={},_0x21f003={'count':0x0,'rows':[]};var _0x1638c5=_[_0x3212('0x2b')](db[_0x3212('0x2c')][_0x3212('0x2d')],function(_0x225bf0){return{'name':_0x225bf0[_0x3212('0x2e')],'type':_0x225bf0[_0x3212('0x2f')]['key']};});_0x443a5[_0x3212('0x30')]=_[_0x3212('0x2b')](_0x1638c5,_0x3212('0x29'));_0x443a5[_0x3212('0x31')]=_[_0x3212('0x32')](_0x206980[_0x3212('0x31')]);_0x443a5[_0x3212('0x33')]=_['intersection'](_0x443a5[_0x3212('0x30')],_0x443a5['query']);_0x108eee[_0x3212('0x34')]=_['intersection'](_0x443a5[_0x3212('0x30')],qs['fields'](_0x206980['query'][_0x3212('0x35')]));_0x108eee['attributes']=_0x108eee[_0x3212('0x34')][_0x3212('0x36')]?_0x108eee[_0x3212('0x34')]:_0x443a5['model'];if(!_0x206980[_0x3212('0x31')][_0x3212('0x37')](_0x3212('0x38'))){_0x108eee['limit']=qs[_0x3212('0x21')](_0x206980[_0x3212('0x31')][_0x3212('0x21')]);_0x108eee[_0x3212('0x20')]=qs[_0x3212('0x20')](_0x206980['query'][_0x3212('0x20')]);}_0x108eee[_0x3212('0x39')]=qs[_0x3212('0x3a')](_0x206980['query'][_0x3212('0x3a')]);_0x108eee[_0x3212('0x3b')]=qs[_0x3212('0x33')](_[_0x3212('0x3c')](_0x206980['query'],_0x443a5[_0x3212('0x33')]),_0x1638c5);if(_0x206980[_0x3212('0x31')][_0x3212('0x3d')]){_0x108eee[_0x3212('0x3b')]=_['merge'](_0x108eee['where'],{'$or':_['map'](_0x1638c5,function(_0x540dfc){if(_0x540dfc[_0x3212('0x2f')]!==_0x3212('0x3e')){var _0x3f8018={};_0x3f8018[_0x540dfc[_0x3212('0x29')]]={'$like':'%'+_0x206980['query'][_0x3212('0x3d')]+'%'};return _0x3f8018;}})});}_0x108eee=_[_0x3212('0x3f')]({},_0x108eee,_0x206980[_0x3212('0x40')]);var _0x2e8605={'where':_0x108eee['where']};return db['UserProfileResource'][_0x3212('0x1f')](_0x2e8605)[_0x3212('0x25')](function(_0x3bb054){_0x21f003[_0x3212('0x1f')]=_0x3bb054;if(_0x206980[_0x3212('0x31')][_0x3212('0x41')]){_0x108eee[_0x3212('0x42')]=[{'all':!![]}];}return db['UserProfileResource'][_0x3212('0x43')](_0x108eee);})[_0x3212('0x25')](function(_0x3e1e84){_0x21f003[_0x3212('0x44')]=_0x3e1e84;return _0x21f003;})['then'](respondWithFilteredResult(_0x35b4eb,_0x108eee))[_0x3212('0x45')](handleError(_0x35b4eb,null));};exports[_0x3212('0x46')]=function(_0x1c71f7,_0x262564){var _0x572429={'raw':![],'where':{'id':_0x1c71f7['params']['id']}},_0xb365f7={};_0xb365f7[_0x3212('0x30')]=_[_0x3212('0x32')](db[_0x3212('0x2c')][_0x3212('0x2d')]);_0xb365f7[_0x3212('0x31')]=_[_0x3212('0x32')](_0x1c71f7[_0x3212('0x31')]);_0xb365f7[_0x3212('0x33')]=_['intersection'](_0xb365f7[_0x3212('0x30')],_0xb365f7[_0x3212('0x31')]);_0x572429[_0x3212('0x34')]=_[_0x3212('0x47')](_0xb365f7[_0x3212('0x30')],qs[_0x3212('0x35')](_0x1c71f7[_0x3212('0x31')]['fields']));_0x572429[_0x3212('0x34')]=_0x572429[_0x3212('0x34')][_0x3212('0x36')]?_0x572429[_0x3212('0x34')]:_0xb365f7['model'];if(_0x1c71f7['query']['includeAll']){_0x572429['include']=[{'all':!![]}];}_0x572429=_[_0x3212('0x3f')]({},_0x572429,_0x1c71f7['options']);return db[_0x3212('0x2c')][_0x3212('0x48')](_0x572429)[_0x3212('0x25')](handleEntityNotFound(_0x262564,null))[_0x3212('0x25')](respondWithResult(_0x262564,null))['catch'](handleError(_0x262564,null));};exports[_0x3212('0x49')]=function(_0xb7124f,_0x75286f){return db['UserProfileResource'][_0x3212('0x49')](_0xb7124f[_0x3212('0x4a')],{})[_0x3212('0x25')](respondWithResult(_0x75286f,0xc9))[_0x3212('0x45')](handleError(_0x75286f,null));};exports['update']=function(_0x3ede8c,_0x13a42d){if(_0x3ede8c['body']['id']){delete _0x3ede8c[_0x3212('0x4a')]['id'];}return db[_0x3212('0x2c')][_0x3212('0x48')]({'where':{'id':_0x3ede8c['params']['id']}})['then'](handleEntityNotFound(_0x13a42d,null))[_0x3212('0x25')](saveUpdates(_0x3ede8c[_0x3212('0x4a')],null))[_0x3212('0x25')](respondWithResult(_0x13a42d,null))['catch'](handleError(_0x13a42d,null));};exports[_0x3212('0x26')]=function(_0x3ef982,_0x4ee235){return db[_0x3212('0x2c')][_0x3212('0x48')]({'where':{'id':_0x3ef982[_0x3212('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ee235,null))['then'](removeEntity(_0x4ee235,null))[_0x3212('0x45')](handleError(_0x4ee235,null));};exports[_0x3212('0x4c')]=function(_0x3faaa1,_0x2de137){return db['UserProfileResource'][_0x3212('0x4c')]()[_0x3212('0x25')](respondWithResult(_0x2de137,null))[_0x3212('0x45')](handleError(_0x2de137,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5cbacd0..1657515 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 _0xb4e6=['bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','compositeIndex','lodash','../../config/logger','api','moment'];(function(_0x2f9907,_0x3d6559){var _0x59527f=function(_0x2ce0b9){while(--_0x2ce0b9){_0x2f9907['push'](_0x2f9907['shift']());}};_0x59527f(++_0x3d6559);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xb4e6[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x6b4e('0xb'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa571=['user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','UserProfileResource'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0xa571,0x107));var _0x1a57=function(_0x330cc5,_0x147150){_0x330cc5=_0x330cc5-0x0;var _0x5b3ad9=_0xa571[_0x330cc5];return _0x5b3ad9;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1a57('0xb'),_0x1a57('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index ef69964..d017ed7 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 _0x2127=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x5597a0,_0x35c11e){var _0x2fc8d6=function(_0x492dcb){while(--_0x492dcb){_0x5597a0['push'](_0x5597a0['shift']());}};_0x2fc8d6(++_0x35c11e);}(_0x2127,0x1d5));var _0x7212=function(_0x541ac8,_0x1234e0){_0x541ac8=_0x541ac8-0x0;var _0x361d48=_0x2127[_0x541ac8];return _0x361d48;};'use strict';var _=require(_0x7212('0x0'));var util=require(_0x7212('0x1'));var moment=require(_0x7212('0x2'));var BPromise=require('bluebird');var rs=require(_0x7212('0x3'));var fs=require('fs');var Redis=require(_0x7212('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7212('0x5'));var logger=require(_0x7212('0x6'))(_0x7212('0x7'));var config=require(_0x7212('0x8'));var jayson=require(_0x7212('0x9'));var client=jayson[_0x7212('0xa')][_0x7212('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f5783,_0x1f87cb,_0x3e08b5){return new BPromise(function(_0x41b795,_0x119875){return client[_0x7212('0xc')](_0x3f5783,_0x3e08b5)['then'](function(_0x436a6a){logger[_0x7212('0xd')](_0x7212('0xe'),_0x1f87cb,_0x7212('0xf'));logger[_0x7212('0x10')](_0x7212('0x11'),_0x1f87cb,_0x7212('0xf'),JSON['stringify'](_0x436a6a));if(_0x436a6a['error']){if(_0x436a6a['error'][_0x7212('0x12')]===0x1f4){logger['error'](_0x7212('0xe'),_0x1f87cb,_0x436a6a[_0x7212('0x13')][_0x7212('0x14')]);return _0x119875(_0x436a6a[_0x7212('0x13')][_0x7212('0x14')]);}logger[_0x7212('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1f87cb,_0x436a6a['error'][_0x7212('0x14')]);return _0x41b795(_0x436a6a[_0x7212('0x13')][_0x7212('0x14')]);}else{logger['info'](_0x7212('0xe'),_0x1f87cb,_0x7212('0xf'));_0x41b795(_0x436a6a[_0x7212('0x15')]['message']);}})[_0x7212('0x16')](function(_0x4aedd9){logger[_0x7212('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x1f87cb,_0x4aedd9);_0x119875(_0x4aedd9);});});} \ No newline at end of file +var _0x839a=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x8d2eef,_0xbf1eab){var _0xf14450=function(_0x45103e){while(--_0x45103e){_0x8d2eef['push'](_0x8d2eef['shift']());}};_0xf14450(++_0xbf1eab);}(_0x839a,0x1f1));var _0xa839=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x839a[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xa839('0x0'));var moment=require(_0xa839('0x1'));var BPromise=require(_0xa839('0x2'));var rs=require(_0xa839('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa839('0x4'))['db'];var utils=require(_0xa839('0x5'));var logger=require(_0xa839('0x6'))(_0xa839('0x7'));var config=require(_0xa839('0x8'));var jayson=require(_0xa839('0x9'));var client=jayson['client'][_0xa839('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fa4e1,_0x31b517,_0x388aa9){return new BPromise(function(_0x3fd59b,_0x53608f){return client[_0xa839('0xb')](_0x3fa4e1,_0x388aa9)[_0xa839('0xc')](function(_0x5037af){logger[_0xa839('0xd')](_0xa839('0xe'),_0x31b517,'request\x20sent');logger[_0xa839('0xf')](_0xa839('0x10'),_0x31b517,_0xa839('0x11'),JSON[_0xa839('0x12')](_0x5037af));if(_0x5037af[_0xa839('0x13')]){if(_0x5037af[_0xa839('0x13')][_0xa839('0x14')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x31b517,_0x5037af[_0xa839('0x13')][_0xa839('0x15')]);return _0x53608f(_0x5037af['error'][_0xa839('0x15')]);}logger['error'](_0xa839('0xe'),_0x31b517,_0x5037af[_0xa839('0x13')]['message']);return _0x3fd59b(_0x5037af['error'][_0xa839('0x15')]);}else{logger['info'](_0xa839('0xe'),_0x31b517,_0xa839('0x11'));_0x3fd59b(_0x5037af[_0xa839('0x16')][_0xa839('0x15')]);}})[_0xa839('0x17')](function(_0x42a14b){logger[_0xa839('0x13')](_0xa839('0xe'),_0x31b517,_0x42a14b);_0x53608f(_0x42a14b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 19c404c..f87202b 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 _0x3316=['get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13464e,_0x4db95e){var _0x8c2f36=function(_0x41fb69){while(--_0x41fb69){_0x13464e['push'](_0x13464e['shift']());}};_0x8c2f36(++_0x4db95e);}(_0x3316,0x161));var _0x6331=function(_0x47041d,_0x42153f){_0x47041d=_0x47041d-0x0;var _0x5022bd=_0x3316[_0x47041d];return _0x5022bd;};'use strict';var multer=require(_0x6331('0x0'));var util=require('util');var path=require(_0x6331('0x1'));var timeout=require('connect-timeout');var express=require(_0x6331('0x2'));var router=express[_0x6331('0x3')]();var auth=require(_0x6331('0x4'));var interaction=require(_0x6331('0x5'));var config=require(_0x6331('0x6'));var controller=require('./userProfileSection.controller');router[_0x6331('0x7')]('/',auth[_0x6331('0x8')](),controller[_0x6331('0x9')]);router[_0x6331('0x7')](_0x6331('0xa'),auth[_0x6331('0x8')](),controller[_0x6331('0xb')]);router[_0x6331('0x7')]('/:id',auth[_0x6331('0x8')](),controller[_0x6331('0xc')]);router[_0x6331('0xd')]('/',auth[_0x6331('0x8')](),controller[_0x6331('0xe')]);router[_0x6331('0xf')](_0x6331('0x10'),auth[_0x6331('0x8')](),controller[_0x6331('0x11')]);router[_0x6331('0x12')]('/:id',auth[_0x6331('0x8')](),controller[_0x6331('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa573=['index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa573,0x95));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3a57('0x0'));var util=require(_0x3a57('0x1'));var path=require(_0x3a57('0x2'));var timeout=require(_0x3a57('0x3'));var express=require(_0x3a57('0x4'));var router=express[_0x3a57('0x5')]();var auth=require(_0x3a57('0x6'));var interaction=require(_0x3a57('0x7'));var config=require(_0x3a57('0x8'));var controller=require(_0x3a57('0x9'));router[_0x3a57('0xa')]('/',auth[_0x3a57('0xb')](),controller[_0x3a57('0xc')]);router[_0x3a57('0xa')](_0x3a57('0xd'),auth[_0x3a57('0xb')](),controller[_0x3a57('0xe')]);router['get'](_0x3a57('0xf'),auth['isAuthenticated'](),controller[_0x3a57('0x10')]);router[_0x3a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x3a57('0x12')]);router[_0x3a57('0x13')](_0x3a57('0xf'),auth[_0x3a57('0xb')](),controller['update']);router[_0x3a57('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3a57('0x15')]);module[_0x3a57('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 313c355..310210f 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 _0xb13b=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports'];(function(_0x381cc1,_0x1cd86d){var _0x3b38d9=function(_0x2e784c){while(--_0x2e784c){_0x381cc1['push'](_0x381cc1['shift']());}};_0x3b38d9(++_0x1cd86d);}(_0xb13b,0x1de));var _0xbb13=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb13b[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0xbb13('0x0'));module[_0xbb13('0x1')]={'name':{'type':Sequelize[_0xbb13('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xbb13('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbb13('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbb13('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbb13('0x2')],'set':function(_0x50898d){this[_0xbb13('0x5')](_0xbb13('0x6'),_0x50898d?_0x50898d[_0xbb13('0x7')](''):[]);},'get':function(){return this[_0xbb13('0x8')](_0xbb13('0x6'))?this[_0xbb13('0x8')](_0xbb13('0x6'))[_0xbb13('0x9')](''):[];}}}; \ No newline at end of file +var _0x668b=['BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x1619c1,_0x21b9fd){var _0x424d3f=function(_0x388463){while(--_0x388463){_0x1619c1['push'](_0x1619c1['shift']());}};_0x424d3f(++_0x21b9fd);}(_0x668b,0x140));var _0xb668=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0x668b[_0x2b49bc];return _0x43cc65;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb668('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xb668('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2fab11){this[_0xb668('0x5')](_0xb668('0x6'),_0x2fab11?_0x2fab11['join'](''):[]);},'get':function(){return this[_0xb668('0x7')](_0xb668('0x6'))?this[_0xb668('0x7')](_0xb668('0x6'))[_0xb668('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 3d8b053..23c710a 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 _0x775d=['intersection','attributes','fields','offset','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','catch','show','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x44fc33,_0x480283){var _0x1e64a1=function(_0x2b642b){while(--_0x2b642b){_0x44fc33['push'](_0x44fc33['shift']());}};_0x1e64a1(++_0x480283);}(_0x775d,0x188));var _0xd775=function(_0x1e365c,_0x67858c){_0x1e365c=_0x1e365c-0x0;var _0x3fd095=_0x775d[_0x1e365c];return _0x3fd095;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd775('0x0'));var rimraf=require(_0xd775('0x1'));var zipdir=require(_0xd775('0x2'));var jsonpatch=require(_0xd775('0x3'));var rp=require(_0xd775('0x4'));var moment=require(_0xd775('0x5'));var BPromise=require(_0xd775('0x6'));var Mustache=require(_0xd775('0x7'));var util=require(_0xd775('0x8'));var path=require(_0xd775('0x9'));var sox=require(_0xd775('0xa'));var csv=require(_0xd775('0xb'));var ejs=require(_0xd775('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd775('0xd'));var crypto=require(_0xd775('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd775('0xf'));var toCsv=require(_0xd775('0xb'));var querystring=require('querystring');var Papa=require(_0xd775('0x10'));var Redis=require(_0xd775('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd775('0x12'));var as=require(_0xd775('0x13'));var hardwareService=require(_0xd775('0x14'));var logger=require(_0xd775('0x15'))('api');var utils=require(_0xd775('0x16'));var config=require(_0xd775('0x17'));var db=require(_0xd775('0x18'))['db'];function respondWithStatusCode(_0x5ac24d,_0x37fbd3){_0x37fbd3=_0x37fbd3||0xcc;return function(_0x9561c){if(_0x9561c){return _0x5ac24d[_0xd775('0x19')](_0x37fbd3);}return _0x5ac24d[_0xd775('0x1a')](_0x37fbd3)['end']();};}function respondWithResult(_0x43b2da,_0x242130){_0x242130=_0x242130||0xc8;return function(_0xd17d18){if(_0xd17d18){return _0x43b2da[_0xd775('0x1a')](_0x242130)[_0xd775('0x1b')](_0xd17d18);}};}function respondWithFilteredResult(_0x4e0019,_0x17dc2e){return function(_0x499451){if(_0x499451){var _0x32db56=_0x499451[_0xd775('0x1c')],_0x21d9a4=_0x17dc2e['offset'],_0x432c1f=_0x17dc2e['offset']+_0x17dc2e[_0xd775('0x1d')],_0x1ad228;if(_0x432c1f>=_0x32db56){_0x432c1f=_0x32db56;_0x1ad228=0xc8;}else{_0x1ad228=0xce;}_0x4e0019[_0xd775('0x1a')](_0x1ad228);return _0x4e0019[_0xd775('0x1e')](_0xd775('0x1f'),_0x21d9a4+'-'+_0x432c1f+'/'+_0x32db56)[_0xd775('0x1b')](_0x499451);}return null;};}function patchUpdates(_0x45cf29){return function(_0x5d87bf){try{jsonpatch[_0xd775('0x20')](_0x5d87bf,_0x45cf29,!![]);}catch(_0x659bfd){return BPromise[_0xd775('0x21')](_0x659bfd);}return _0x5d87bf['save']();};}function saveUpdates(_0x5bd2c8,_0x2d135a){return function(_0x438992){if(_0x438992){return _0x438992['update'](_0x5bd2c8)[_0xd775('0x22')](function(_0x508155){return _0x508155;});}return null;};}function removeEntity(_0x4bbbaf,_0x5b042a){return function(_0x29c2bc){if(_0x29c2bc){return _0x29c2bc[_0xd775('0x23')]()['then'](function(){_0x4bbbaf[_0xd775('0x1a')](0xcc)[_0xd775('0x24')]();});}};}function handleEntityNotFound(_0x482fff,_0x1697d3){return function(_0x1f300e){if(!_0x1f300e){_0x482fff['sendStatus'](0x194);}return _0x1f300e;};}function handleError(_0x2d63d3,_0x4a642a){_0x4a642a=_0x4a642a||0x1f4;return function(_0x1b9219){logger[_0xd775('0x25')](_0x1b9219[_0xd775('0x26')]);if(_0x1b9219[_0xd775('0x27')]){delete _0x1b9219[_0xd775('0x27')];}_0x2d63d3[_0xd775('0x1a')](_0x4a642a)[_0xd775('0x28')](_0x1b9219);};}exports[_0xd775('0x29')]=function(_0x3fdfc9,_0x350f38){var _0x4d5069={},_0x4d2b00={},_0x123978={'count':0x0,'rows':[]};var _0x28af0e=_[_0xd775('0x2a')](db[_0xd775('0x2b')][_0xd775('0x2c')],function(_0x9f062b){return{'name':_0x9f062b[_0xd775('0x2d')],'type':_0x9f062b[_0xd775('0x2e')][_0xd775('0x2f')]};});_0x4d2b00[_0xd775('0x30')]=_[_0xd775('0x2a')](_0x28af0e,_0xd775('0x27'));_0x4d2b00[_0xd775('0x31')]=_[_0xd775('0x32')](_0x3fdfc9[_0xd775('0x31')]);_0x4d2b00[_0xd775('0x33')]=_[_0xd775('0x34')](_0x4d2b00[_0xd775('0x30')],_0x4d2b00[_0xd775('0x31')]);_0x4d5069[_0xd775('0x35')]=_[_0xd775('0x34')](_0x4d2b00['model'],qs[_0xd775('0x36')](_0x3fdfc9[_0xd775('0x31')][_0xd775('0x36')]));_0x4d5069[_0xd775('0x35')]=_0x4d5069['attributes']['length']?_0x4d5069['attributes']:_0x4d2b00[_0xd775('0x30')];if(!_0x3fdfc9[_0xd775('0x31')]['hasOwnProperty']('nolimit')){_0x4d5069[_0xd775('0x1d')]=qs[_0xd775('0x1d')](_0x3fdfc9[_0xd775('0x31')][_0xd775('0x1d')]);_0x4d5069[_0xd775('0x37')]=qs[_0xd775('0x37')](_0x3fdfc9[_0xd775('0x31')][_0xd775('0x37')]);}_0x4d5069[_0xd775('0x38')]=qs[_0xd775('0x39')](_0x3fdfc9[_0xd775('0x31')][_0xd775('0x39')]);_0x4d5069['where']=qs[_0xd775('0x33')](_['pick'](_0x3fdfc9[_0xd775('0x31')],_0x4d2b00[_0xd775('0x33')]),_0x28af0e);if(_0x3fdfc9[_0xd775('0x31')][_0xd775('0x3a')]){_0x4d5069[_0xd775('0x3b')]=_['merge'](_0x4d5069[_0xd775('0x3b')],{'$or':_[_0xd775('0x2a')](_0x28af0e,function(_0x3aa674){if(_0x3aa674[_0xd775('0x2e')]!==_0xd775('0x3c')){var _0x169054={};_0x169054[_0x3aa674[_0xd775('0x27')]]={'$like':'%'+_0x3fdfc9[_0xd775('0x31')][_0xd775('0x3a')]+'%'};return _0x169054;}})});}_0x4d5069=_[_0xd775('0x3d')]({},_0x4d5069,_0x3fdfc9[_0xd775('0x3e')]);var _0x37986e={'where':_0x4d5069[_0xd775('0x3b')]};return db[_0xd775('0x2b')][_0xd775('0x1c')](_0x37986e)[_0xd775('0x22')](function(_0x48442d){_0x123978[_0xd775('0x1c')]=_0x48442d;if(_0x3fdfc9[_0xd775('0x31')][_0xd775('0x3f')]){_0x4d5069[_0xd775('0x40')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x4d5069);})[_0xd775('0x22')](function(_0x4b7503){_0x123978['rows']=_0x4b7503;return _0x123978;})[_0xd775('0x22')](respondWithFilteredResult(_0x350f38,_0x4d5069))[_0xd775('0x41')](handleError(_0x350f38,null));};exports[_0xd775('0x42')]=function(_0x1bdb92,_0x51a626){var _0x400253={'raw':![],'where':{'id':_0x1bdb92[_0xd775('0x43')]['id']}},_0x6b49c9={};_0x6b49c9['model']=_[_0xd775('0x32')](db['UserProfileSection'][_0xd775('0x2c')]);_0x6b49c9[_0xd775('0x31')]=_['keys'](_0x1bdb92['query']);_0x6b49c9['filters']=_[_0xd775('0x34')](_0x6b49c9[_0xd775('0x30')],_0x6b49c9[_0xd775('0x31')]);_0x400253[_0xd775('0x35')]=_[_0xd775('0x34')](_0x6b49c9[_0xd775('0x30')],qs['fields'](_0x1bdb92['query'][_0xd775('0x36')]));_0x400253[_0xd775('0x35')]=_0x400253[_0xd775('0x35')][_0xd775('0x44')]?_0x400253[_0xd775('0x35')]:_0x6b49c9['model'];if(_0x1bdb92['query'][_0xd775('0x3f')]){_0x400253[_0xd775('0x40')]=[{'all':!![]}];}_0x400253=_[_0xd775('0x3d')]({},_0x400253,_0x1bdb92[_0xd775('0x3e')]);return db['UserProfileSection'][_0xd775('0x45')](_0x400253)[_0xd775('0x22')](handleEntityNotFound(_0x51a626,null))[_0xd775('0x22')](respondWithResult(_0x51a626,null))[_0xd775('0x41')](handleError(_0x51a626,null));};exports[_0xd775('0x46')]=function(_0x9e25a0,_0x1bb071){return db[_0xd775('0x2b')][_0xd775('0x46')](_0x9e25a0[_0xd775('0x47')],{})['then'](respondWithResult(_0x1bb071,0xc9))[_0xd775('0x41')](handleError(_0x1bb071,null));};exports[_0xd775('0x48')]=function(_0x55913a,_0x594e6f){if(_0x55913a[_0xd775('0x47')]['id']){delete _0x55913a[_0xd775('0x47')]['id'];}return db['UserProfileSection'][_0xd775('0x45')]({'where':{'id':_0x55913a[_0xd775('0x43')]['id']}})[_0xd775('0x22')](handleEntityNotFound(_0x594e6f,null))[_0xd775('0x22')](saveUpdates(_0x55913a[_0xd775('0x47')],null))[_0xd775('0x22')](respondWithResult(_0x594e6f,null))[_0xd775('0x41')](handleError(_0x594e6f,null));};exports[_0xd775('0x23')]=function(_0x2302d9,_0x1a8cbe){return db[_0xd775('0x2b')][_0xd775('0x45')]({'where':{'id':_0x2302d9[_0xd775('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a8cbe,null))[_0xd775('0x22')](removeEntity(_0x1a8cbe,null))[_0xd775('0x41')](handleError(_0x1a8cbe,null));};exports[_0xd775('0x49')]=function(_0x404fbc,_0x56f5de){return db[_0xd775('0x2b')]['describe']()[_0xd775('0x22')](respondWithResult(_0x56f5de,null))['catch'](handleError(_0x56f5de,null));}; \ No newline at end of file +var _0x342b=['../../mysqldb','status','json','offset','limit','set','Content-Range','reject','update','then','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','key','query','keys','filters','intersection','attributes','fields','length','model','order','sort','pick','filter','merge','where','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x17f235,_0x3785a6){var _0x5b61dd=function(_0x7b4cae){while(--_0x7b4cae){_0x17f235['push'](_0x17f235['shift']());}};_0x5b61dd(++_0x3785a6);}(_0x342b,0xbc));var _0xb342=function(_0x2478d6,_0x1b5b3d){_0x2478d6=_0x2478d6-0x0;var _0x5bb23a=_0x342b[_0x2478d6];return _0x5bb23a;};'use strict';var pdf=require(_0xb342('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb342('0x1'));var zipdir=require(_0xb342('0x2'));var jsonpatch=require(_0xb342('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb342('0x4'));var path=require(_0xb342('0x5'));var sox=require(_0xb342('0x6'));var csv=require(_0xb342('0x7'));var ejs=require(_0xb342('0x8'));var fs=require('fs');var _=require(_0xb342('0x9'));var squel=require(_0xb342('0xa'));var crypto=require(_0xb342('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb342('0x7'));var querystring=require(_0xb342('0xc'));var Papa=require('papaparse');var Redis=require(_0xb342('0xd'));var authService=require(_0xb342('0xe'));var qs=require(_0xb342('0xf'));var as=require(_0xb342('0x10'));var hardwareService=require(_0xb342('0x11'));var logger=require(_0xb342('0x12'))(_0xb342('0x13'));var utils=require(_0xb342('0x14'));var config=require(_0xb342('0x15'));var db=require(_0xb342('0x16'))['db'];function respondWithStatusCode(_0x1362b8,_0x54d945){_0x54d945=_0x54d945||0xcc;return function(_0x879722){if(_0x879722){return _0x1362b8['sendStatus'](_0x54d945);}return _0x1362b8['status'](_0x54d945)['end']();};}function respondWithResult(_0x486d98,_0xcddbb4){_0xcddbb4=_0xcddbb4||0xc8;return function(_0x249257){if(_0x249257){return _0x486d98[_0xb342('0x17')](_0xcddbb4)[_0xb342('0x18')](_0x249257);}};}function respondWithFilteredResult(_0x9494b0,_0x28cfde){return function(_0x17f16a){if(_0x17f16a){var _0x49a7e6=_0x17f16a['count'],_0x435b8c=_0x28cfde['offset'],_0x1057f9=_0x28cfde[_0xb342('0x19')]+_0x28cfde[_0xb342('0x1a')],_0x4ab953;if(_0x1057f9>=_0x49a7e6){_0x1057f9=_0x49a7e6;_0x4ab953=0xc8;}else{_0x4ab953=0xce;}_0x9494b0['status'](_0x4ab953);return _0x9494b0[_0xb342('0x1b')](_0xb342('0x1c'),_0x435b8c+'-'+_0x1057f9+'/'+_0x49a7e6)[_0xb342('0x18')](_0x17f16a);}return null;};}function patchUpdates(_0x95c8d7){return function(_0x15906f){try{jsonpatch['apply'](_0x15906f,_0x95c8d7,!![]);}catch(_0x53542c){return BPromise[_0xb342('0x1d')](_0x53542c);}return _0x15906f['save']();};}function saveUpdates(_0x341a3c,_0x362af8){return function(_0x41f499){if(_0x41f499){return _0x41f499[_0xb342('0x1e')](_0x341a3c)[_0xb342('0x1f')](function(_0x553fd3){return _0x553fd3;});}return null;};}function removeEntity(_0xd3f9be,_0x4dfca1){return function(_0x99593d){if(_0x99593d){return _0x99593d['destroy']()[_0xb342('0x1f')](function(){_0xd3f9be[_0xb342('0x17')](0xcc)[_0xb342('0x20')]();});}};}function handleEntityNotFound(_0x3198b5,_0x4eda3a){return function(_0x388fed){if(!_0x388fed){_0x3198b5['sendStatus'](0x194);}return _0x388fed;};}function handleError(_0x5df27b,_0x2b1a8e){_0x2b1a8e=_0x2b1a8e||0x1f4;return function(_0x5cc8d7){logger[_0xb342('0x21')](_0x5cc8d7[_0xb342('0x22')]);if(_0x5cc8d7[_0xb342('0x23')]){delete _0x5cc8d7[_0xb342('0x23')];}_0x5df27b['status'](_0x2b1a8e)[_0xb342('0x24')](_0x5cc8d7);};}exports[_0xb342('0x25')]=function(_0x1a7b76,_0xe36c4b){var _0x4696ac={},_0x27005b={},_0x127dbc={'count':0x0,'rows':[]};var _0x59f5b4=_[_0xb342('0x26')](db[_0xb342('0x27')][_0xb342('0x28')],function(_0x542ce4){return{'name':_0x542ce4['fieldName'],'type':_0x542ce4['type'][_0xb342('0x29')]};});_0x27005b['model']=_[_0xb342('0x26')](_0x59f5b4,'name');_0x27005b[_0xb342('0x2a')]=_[_0xb342('0x2b')](_0x1a7b76[_0xb342('0x2a')]);_0x27005b[_0xb342('0x2c')]=_[_0xb342('0x2d')](_0x27005b['model'],_0x27005b[_0xb342('0x2a')]);_0x4696ac[_0xb342('0x2e')]=_[_0xb342('0x2d')](_0x27005b['model'],qs[_0xb342('0x2f')](_0x1a7b76['query'][_0xb342('0x2f')]));_0x4696ac[_0xb342('0x2e')]=_0x4696ac[_0xb342('0x2e')][_0xb342('0x30')]?_0x4696ac[_0xb342('0x2e')]:_0x27005b[_0xb342('0x31')];if(!_0x1a7b76[_0xb342('0x2a')]['hasOwnProperty']('nolimit')){_0x4696ac['limit']=qs[_0xb342('0x1a')](_0x1a7b76[_0xb342('0x2a')]['limit']);_0x4696ac['offset']=qs[_0xb342('0x19')](_0x1a7b76[_0xb342('0x2a')][_0xb342('0x19')]);}_0x4696ac[_0xb342('0x32')]=qs[_0xb342('0x33')](_0x1a7b76[_0xb342('0x2a')][_0xb342('0x33')]);_0x4696ac['where']=qs[_0xb342('0x2c')](_[_0xb342('0x34')](_0x1a7b76[_0xb342('0x2a')],_0x27005b[_0xb342('0x2c')]),_0x59f5b4);if(_0x1a7b76[_0xb342('0x2a')][_0xb342('0x35')]){_0x4696ac['where']=_[_0xb342('0x36')](_0x4696ac[_0xb342('0x37')],{'$or':_[_0xb342('0x26')](_0x59f5b4,function(_0x3bd06c){if(_0x3bd06c['type']!=='VIRTUAL'){var _0x481b8e={};_0x481b8e[_0x3bd06c[_0xb342('0x23')]]={'$like':'%'+_0x1a7b76[_0xb342('0x2a')][_0xb342('0x35')]+'%'};return _0x481b8e;}})});}_0x4696ac=_['merge']({},_0x4696ac,_0x1a7b76[_0xb342('0x38')]);var _0x194d08={'where':_0x4696ac['where']};return db[_0xb342('0x27')][_0xb342('0x39')](_0x194d08)[_0xb342('0x1f')](function(_0x3f358a){_0x127dbc[_0xb342('0x39')]=_0x3f358a;if(_0x1a7b76[_0xb342('0x2a')][_0xb342('0x3a')]){_0x4696ac['include']=[{'all':!![]}];}return db['UserProfileSection'][_0xb342('0x3b')](_0x4696ac);})[_0xb342('0x1f')](function(_0x2388eb){_0x127dbc[_0xb342('0x3c')]=_0x2388eb;return _0x127dbc;})[_0xb342('0x1f')](respondWithFilteredResult(_0xe36c4b,_0x4696ac))[_0xb342('0x3d')](handleError(_0xe36c4b,null));};exports[_0xb342('0x3e')]=function(_0x28e053,_0x3de6a9){var _0x299e20={'raw':![],'where':{'id':_0x28e053[_0xb342('0x3f')]['id']}},_0x263633={};_0x263633[_0xb342('0x31')]=_[_0xb342('0x2b')](db[_0xb342('0x27')][_0xb342('0x28')]);_0x263633['query']=_['keys'](_0x28e053['query']);_0x263633[_0xb342('0x2c')]=_[_0xb342('0x2d')](_0x263633[_0xb342('0x31')],_0x263633[_0xb342('0x2a')]);_0x299e20[_0xb342('0x2e')]=_['intersection'](_0x263633['model'],qs[_0xb342('0x2f')](_0x28e053['query'][_0xb342('0x2f')]));_0x299e20[_0xb342('0x2e')]=_0x299e20[_0xb342('0x2e')][_0xb342('0x30')]?_0x299e20[_0xb342('0x2e')]:_0x263633[_0xb342('0x31')];if(_0x28e053['query'][_0xb342('0x3a')]){_0x299e20[_0xb342('0x40')]=[{'all':!![]}];}_0x299e20=_[_0xb342('0x36')]({},_0x299e20,_0x28e053['options']);return db[_0xb342('0x27')][_0xb342('0x41')](_0x299e20)['then'](handleEntityNotFound(_0x3de6a9,null))[_0xb342('0x1f')](respondWithResult(_0x3de6a9,null))['catch'](handleError(_0x3de6a9,null));};exports[_0xb342('0x42')]=function(_0x53326c,_0x1d6700){return db['UserProfileSection']['create'](_0x53326c[_0xb342('0x43')],{})[_0xb342('0x1f')](respondWithResult(_0x1d6700,0xc9))[_0xb342('0x3d')](handleError(_0x1d6700,null));};exports[_0xb342('0x1e')]=function(_0x4dff08,_0x11b5f2){if(_0x4dff08[_0xb342('0x43')]['id']){delete _0x4dff08[_0xb342('0x43')]['id'];}return db[_0xb342('0x27')][_0xb342('0x41')]({'where':{'id':_0x4dff08[_0xb342('0x3f')]['id']}})['then'](handleEntityNotFound(_0x11b5f2,null))[_0xb342('0x1f')](saveUpdates(_0x4dff08[_0xb342('0x43')],null))['then'](respondWithResult(_0x11b5f2,null))[_0xb342('0x3d')](handleError(_0x11b5f2,null));};exports[_0xb342('0x44')]=function(_0x5122c4,_0x8f915c){return db[_0xb342('0x27')][_0xb342('0x41')]({'where':{'id':_0x5122c4[_0xb342('0x3f')]['id']}})[_0xb342('0x1f')](handleEntityNotFound(_0x8f915c,null))[_0xb342('0x1f')](removeEntity(_0x8f915c,null))[_0xb342('0x3d')](handleError(_0x8f915c,null));};exports[_0xb342('0x45')]=function(_0x348ff7,_0x204fde){return db[_0xb342('0x27')][_0xb342('0x45')]()['then'](respondWithResult(_0x204fde,null))[_0xb342('0x3d')](handleError(_0x204fde,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 91d335f..c2fa468 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 _0x6555=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0x6555,0x1e9));var _0x5655=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6555[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5655('0x0'));var util=require(_0x5655('0x1'));var logger=require(_0x5655('0x2'))('api');var moment=require(_0x5655('0x3'));var BPromise=require(_0x5655('0x4'));var rp=require(_0x5655('0x5'));var fs=require('fs');var path=require(_0x5655('0x6'));var rimraf=require('rimraf');var config=require(_0x5655('0x7'));var attributes=require(_0x5655('0x8'));module[_0x5655('0x9')]=function(_0x351467,_0x442bbf){return _0x351467['define'](_0x5655('0xa'),attributes,{'tableName':_0x5655('0xb'),'paranoid':![],'indexes':[{'name':_0x5655('0xc'),'fields':['sectionId',_0x5655('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9fb9=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0x54fdc3,_0x3ad032){var _0x1e89cc=function(_0x1ec301){while(--_0x1ec301){_0x54fdc3['push'](_0x54fdc3['shift']());}};_0x1e89cc(++_0x3ad032);}(_0x9fb9,0x1ac));var _0x99fb=function(_0x4e0e57,_0x1bc647){_0x4e0e57=_0x4e0e57-0x0;var _0x5a5e03=_0x9fb9[_0x4e0e57];return _0x5a5e03;};'use strict';var _=require(_0x99fb('0x0'));var util=require('util');var logger=require(_0x99fb('0x1'))(_0x99fb('0x2'));var moment=require(_0x99fb('0x3'));var BPromise=require('bluebird');var rp=require(_0x99fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99fb('0x5'));var config=require(_0x99fb('0x6'));var attributes=require(_0x99fb('0x7'));module['exports']=function(_0x408940,_0x193978){return _0x408940[_0x99fb('0x8')](_0x99fb('0x9'),attributes,{'tableName':_0x99fb('0xa'),'paranoid':![],'indexes':[{'name':_0x99fb('0xb'),'fields':[_0x99fb('0xc'),'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 4f1a5fa..6b691c9 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 _0xd9aa=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xd9aa,0x91));var _0xad9a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xd9aa[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xad9a('0x0'));var util=require(_0xad9a('0x1'));var moment=require(_0xad9a('0x2'));var BPromise=require(_0xad9a('0x3'));var rs=require(_0xad9a('0x4'));var fs=require('fs');var Redis=require(_0xad9a('0x5'));var db=require(_0xad9a('0x6'))['db'];var utils=require(_0xad9a('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad9a('0x8')][_0xad9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14c554,_0x41aeb8,_0x4981f5){return new BPromise(function(_0x3675a9,_0x48eebe){return client[_0xad9a('0xa')](_0x14c554,_0x4981f5)[_0xad9a('0xb')](function(_0x2d3cd1){logger[_0xad9a('0xc')](_0xad9a('0xd'),_0x41aeb8,_0xad9a('0xe'));logger['debug'](_0xad9a('0xf'),_0x41aeb8,_0xad9a('0xe'),JSON[_0xad9a('0x10')](_0x2d3cd1));if(_0x2d3cd1[_0xad9a('0x11')]){if(_0x2d3cd1[_0xad9a('0x11')][_0xad9a('0x12')]===0x1f4){logger[_0xad9a('0x11')](_0xad9a('0xd'),_0x41aeb8,_0x2d3cd1[_0xad9a('0x11')]['message']);return _0x48eebe(_0x2d3cd1[_0xad9a('0x11')]['message']);}logger[_0xad9a('0x11')](_0xad9a('0xd'),_0x41aeb8,_0x2d3cd1[_0xad9a('0x11')][_0xad9a('0x13')]);return _0x3675a9(_0x2d3cd1[_0xad9a('0x11')][_0xad9a('0x13')]);}else{logger['info'](_0xad9a('0xd'),_0x41aeb8,_0xad9a('0xe'));_0x3675a9(_0x2d3cd1[_0xad9a('0x14')]['message']);}})[_0xad9a('0x15')](function(_0x52b8cc){logger[_0xad9a('0x11')](_0xad9a('0xd'),_0x41aeb8,_0x52b8cc);_0x48eebe(_0x52b8cc);});});} \ No newline at end of file +var _0x28b9=['http','request','then','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1ec197,_0x4a8c29){var _0x53a0ad=function(_0xd1aba4){while(--_0xd1aba4){_0x1ec197['push'](_0x1ec197['shift']());}};_0x53a0ad(++_0x4a8c29);}(_0x28b9,0xad));var _0x928b=function(_0x591e11,_0x363e09){_0x591e11=_0x591e11-0x0;var _0x23a0a=_0x28b9[_0x591e11];return _0x23a0a;};'use strict';var _=require(_0x928b('0x0'));var util=require('util');var moment=require(_0x928b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x928b('0x2'));var logger=require(_0x928b('0x3'))(_0x928b('0x4'));var config=require(_0x928b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x928b('0x6')][_0x928b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f7908,_0x34d188,_0x3331a2){return new BPromise(function(_0x3bab20,_0x51ff1c){return client[_0x928b('0x8')](_0x3f7908,_0x3331a2)[_0x928b('0x9')](function(_0x216441){logger[_0x928b('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x34d188,_0x928b('0xb'));logger['debug'](_0x928b('0xc'),_0x34d188,'request\x20sent',JSON[_0x928b('0xd')](_0x216441));if(_0x216441['error']){if(_0x216441[_0x928b('0xe')][_0x928b('0xf')]===0x1f4){logger[_0x928b('0xe')](_0x928b('0x10'),_0x34d188,_0x216441[_0x928b('0xe')][_0x928b('0x11')]);return _0x51ff1c(_0x216441[_0x928b('0xe')][_0x928b('0x11')]);}logger[_0x928b('0xe')](_0x928b('0x10'),_0x34d188,_0x216441[_0x928b('0xe')][_0x928b('0x11')]);return _0x3bab20(_0x216441[_0x928b('0xe')][_0x928b('0x11')]);}else{logger[_0x928b('0xa')](_0x928b('0x10'),_0x34d188,_0x928b('0xb'));_0x3bab20(_0x216441[_0x928b('0x12')][_0x928b('0x11')]);}})[_0x928b('0x13')](function(_0x266383){logger[_0x928b('0xe')](_0x928b('0x10'),_0x34d188,_0x266383);_0x51ff1c(_0x266383);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index f6f7782..6375d1c 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 _0x48d1=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x46d1c1,_0x57a805){var _0x3114f0=function(_0x3829f4){while(--_0x3829f4){_0x46d1c1['push'](_0x46d1c1['shift']());}};_0x3114f0(++_0x57a805);}(_0x48d1,0x170));var _0x148d=function(_0x4909ab,_0x57732e){_0x4909ab=_0x4909ab-0x0;var _0x5c1425=_0x48d1[_0x4909ab];return _0x5c1425;};'use strict';var multer=require(_0x148d('0x0'));var util=require(_0x148d('0x1'));var path=require('path');var timeout=require(_0x148d('0x2'));var express=require(_0x148d('0x3'));var router=express[_0x148d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x148d('0x5'));var config=require(_0x148d('0x6'));module[_0x148d('0x7')]=router; \ No newline at end of file +var _0x5f0c=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','express','Router'];(function(_0x2d7712,_0x39aba4){var _0x2efa08=function(_0xfbe847){while(--_0xfbe847){_0x2d7712['push'](_0x2d7712['shift']());}};_0x2efa08(++_0x39aba4);}(_0x5f0c,0x1cb));var _0xc5f0=function(_0x59d577,_0x4d90d0){_0x59d577=_0x59d577-0x0;var _0x64cedd=_0x5f0c[_0x59d577];return _0x64cedd;};'use strict';var multer=require('multer');var util=require(_0xc5f0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc5f0('0x1'));var router=express[_0xc5f0('0x2')]();var auth=require(_0xc5f0('0x3'));var interaction=require(_0xc5f0('0x4'));var config=require(_0xc5f0('0x5'));module[_0xc5f0('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2649b6d..44a0cef 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x524c03,_0x43b170){var _0x42145e=function(_0x52543e){while(--_0x52543e){_0x524c03['push'](_0x524c03['shift']());}};_0x42145e(++_0x43b170);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x2c921c,_0x3c6a85){var _0x440bf2=function(_0x4db0df){while(--_0x4db0df){_0x2c921c['push'](_0x2c921c['shift']());}};_0x440bf2(++_0x3c6a85);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index f647442..634ec07 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 _0x702d=['exports','define','UserSmsQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3eb8cf,_0x2dcd95){var _0xa8e96=function(_0x265067){while(--_0x265067){_0x3eb8cf['push'](_0x3eb8cf['shift']());}};_0xa8e96(++_0x2dcd95);}(_0x702d,0x147));var _0xd702=function(_0x232414,_0x288563){_0x232414=_0x232414-0x0;var _0x3a7e2c=_0x702d[_0x232414];return _0x3a7e2c;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81d5=['request-promise','path','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','api','moment','bluebird'];(function(_0x1c87e2,_0x308b29){var _0x21a77f=function(_0x3024e3){while(--_0x3024e3){_0x1c87e2['push'](_0x1c87e2['shift']());}};_0x21a77f(++_0x308b29);}(_0x81d5,0x1ab));var _0x581d=function(_0x5d6a35,_0x2070fa){_0x5d6a35=_0x5d6a35-0x0;var _0x30ece2=_0x81d5[_0x5d6a35];return _0x30ece2;};'use strict';var _=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var logger=require('../../config/logger')(_0x581d('0x2'));var moment=require(_0x581d('0x3'));var BPromise=require(_0x581d('0x4'));var rp=require(_0x581d('0x5'));var fs=require('fs');var path=require(_0x581d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x581d('0x7'));module[_0x581d('0x8')]=function(_0x1895d2,_0x4bb545){return _0x1895d2[_0x581d('0x9')](_0x581d('0xa'),attributes,{'tableName':_0x581d('0xb'),'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 45bfc54..33ed63e 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 _0x5337=['error','code','message','result','catch','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1baa3d,_0x223ca7){var _0x1d9f32=function(_0x2d41f8){while(--_0x2d41f8){_0x1baa3d['push'](_0x1baa3d['shift']());}};_0x1d9f32(++_0x223ca7);}(_0x5337,0xb9));var _0x7533=function(_0x5e4a61,_0x403c59){_0x5e4a61=_0x5e4a61-0x0;var _0x1374aa=_0x5337[_0x5e4a61];return _0x1374aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7533('0x0'));var BPromise=require(_0x7533('0x1'));var rs=require(_0x7533('0x2'));var fs=require('fs');var Redis=require(_0x7533('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7533('0x4'));var config=require(_0x7533('0x5'));var jayson=require(_0x7533('0x6'));var client=jayson[_0x7533('0x7')][_0x7533('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x500e8e,_0x6ee949,_0x51e2ca){return new BPromise(function(_0x4d140d,_0x296c74){return client[_0x7533('0x9')](_0x500e8e,_0x51e2ca)['then'](function(_0x30b39f){logger[_0x7533('0xa')](_0x7533('0xb'),_0x6ee949,_0x7533('0xc'));logger[_0x7533('0xd')](_0x7533('0xe'),_0x6ee949,_0x7533('0xc'),JSON['stringify'](_0x30b39f));if(_0x30b39f[_0x7533('0xf')]){if(_0x30b39f[_0x7533('0xf')][_0x7533('0x10')]===0x1f4){logger[_0x7533('0xf')](_0x7533('0xb'),_0x6ee949,_0x30b39f[_0x7533('0xf')][_0x7533('0x11')]);return _0x296c74(_0x30b39f['error'][_0x7533('0x11')]);}logger[_0x7533('0xf')](_0x7533('0xb'),_0x6ee949,_0x30b39f[_0x7533('0xf')][_0x7533('0x11')]);return _0x4d140d(_0x30b39f[_0x7533('0xf')][_0x7533('0x11')]);}else{logger['info'](_0x7533('0xb'),_0x6ee949,_0x7533('0xc'));_0x4d140d(_0x30b39f[_0x7533('0x12')][_0x7533('0x11')]);}})[_0x7533('0x13')](function(_0x59161a){logger[_0x7533('0xf')](_0x7533('0xb'),_0x6ee949,_0x59161a);_0x296c74(_0x59161a);});});} \ No newline at end of file +var _0x3366=['../../config/environment','jayson/promise','client','then','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserSmsQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5d6e84,_0x541fa5){var _0x8b54=function(_0x7cf06f){while(--_0x7cf06f){_0x5d6e84['push'](_0x5d6e84['shift']());}};_0x8b54(++_0x541fa5);}(_0x3366,0xd3));var _0x6336=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x3366[_0x2f6541];return _0x4d76d8;};'use strict';var _=require(_0x6336('0x0'));var util=require(_0x6336('0x1'));var moment=require(_0x6336('0x2'));var BPromise=require('bluebird');var rs=require(_0x6336('0x3'));var fs=require('fs');var Redis=require(_0x6336('0x4'));var db=require(_0x6336('0x5'))['db'];var utils=require(_0x6336('0x6'));var logger=require(_0x6336('0x7'))(_0x6336('0x8'));var config=require(_0x6336('0x9'));var jayson=require(_0x6336('0xa'));var client=jayson[_0x6336('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a3038,_0x570e0c,_0x4fc419){return new BPromise(function(_0xdbc821,_0x5405f3){return client['request'](_0x1a3038,_0x4fc419)[_0x6336('0xc')](function(_0x29862a){logger[_0x6336('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x570e0c,_0x6336('0xe'));logger['debug'](_0x6336('0xf'),_0x570e0c,_0x6336('0xe'),JSON['stringify'](_0x29862a));if(_0x29862a['error']){if(_0x29862a[_0x6336('0x10')][_0x6336('0x11')]===0x1f4){logger[_0x6336('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x570e0c,_0x29862a[_0x6336('0x10')][_0x6336('0x12')]);return _0x5405f3(_0x29862a[_0x6336('0x10')]['message']);}logger[_0x6336('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x570e0c,_0x29862a[_0x6336('0x10')][_0x6336('0x12')]);return _0xdbc821(_0x29862a[_0x6336('0x10')][_0x6336('0x12')]);}else{logger[_0x6336('0xd')](_0x6336('0x13'),_0x570e0c,_0x6336('0xe'));_0xdbc821(_0x29862a[_0x6336('0x14')][_0x6336('0x12')]);}})[_0x6336('0x15')](function(_0x3fa0b6){logger[_0x6336('0x10')](_0x6336('0x13'),_0x570e0c,_0x3fa0b6);_0x5405f3(_0x3fa0b6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index ce1bfc5..5dd6746 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 _0x7133=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','connect-timeout','express'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7133,0xa5));var _0x3713=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7133[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x3713('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3713('0x1'));var express=require(_0x3713('0x2'));var router=express[_0x3713('0x3')]();var auth=require(_0x3713('0x4'));var interaction=require(_0x3713('0x5'));var config=require('../../config/environment');module[_0x3713('0x6')]=router; \ No newline at end of file +var _0xfb6f=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4c2adc,_0x3741a1){var _0x13e846=function(_0x1a1501){while(--_0x1a1501){_0x4c2adc['push'](_0x4c2adc['shift']());}};_0x13e846(++_0x3741a1);}(_0xfb6f,0x189));var _0xffb6=function(_0x1fbaeb,_0x1273eb){_0x1fbaeb=_0x1fbaeb-0x0;var _0x2c907b=_0xfb6f[_0x1fbaeb];return _0x2c907b;};'use strict';var multer=require(_0xffb6('0x0'));var util=require(_0xffb6('0x1'));var path=require(_0xffb6('0x2'));var timeout=require(_0xffb6('0x3'));var express=require(_0xffb6('0x4'));var router=express[_0xffb6('0x5')]();var auth=require(_0xffb6('0x6'));var interaction=require(_0xffb6('0x7'));var config=require(_0xffb6('0x8'));module[_0xffb6('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 835e40d..1af5e54 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 _0xd8b0=['exports','sequelize'];(function(_0x58916b,_0x43fc5d){var _0x238322=function(_0x5cdf4a){while(--_0x5cdf4a){_0x58916b['push'](_0x58916b['shift']());}};_0x238322(++_0x43fc5d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x574537,_0x1654a3){var _0x46e65e=function(_0x48be85){while(--_0x48be85){_0x574537['push'](_0x574537['shift']());}};_0x46e65e(++_0x1654a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f504c,_0x319b4f){_0x1f504c=_0x1f504c-0x0;var _0x50d2e6=_0xb10b[_0x1f504c];return _0x50d2e6;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 0cbf1fd..9400a9f 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 _0xbfa3=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x10fc4a,_0x58442d){var _0x45d274=function(_0x2d62fc){while(--_0x2d62fc){_0x10fc4a['push'](_0x10fc4a['shift']());}};_0x45d274(++_0x58442d);}(_0xbfa3,0x172));var _0x3bfa=function(_0x5edb5e,_0x698a6d){_0x5edb5e=_0x5edb5e-0x0;var _0x2cc012=_0xbfa3[_0x5edb5e];return _0x2cc012;};'use strict';var _=require(_0x3bfa('0x0'));var util=require(_0x3bfa('0x1'));var logger=require(_0x3bfa('0x2'))(_0x3bfa('0x3'));var moment=require(_0x3bfa('0x4'));var BPromise=require(_0x3bfa('0x5'));var rp=require(_0x3bfa('0x6'));var fs=require('fs');var path=require(_0x3bfa('0x7'));var rimraf=require(_0x3bfa('0x8'));var config=require(_0x3bfa('0x9'));var attributes=require(_0x3bfa('0xa'));module[_0x3bfa('0xb')]=function(_0x4eb9bb,_0x5bec32){return _0x4eb9bb[_0x3bfa('0xc')]('UserVoiceQueue',attributes,{'tableName':_0x3bfa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf188=['./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c8fb8,_0x58db4e){var _0x96a6f3=function(_0x1a93dc){while(--_0x1a93dc){_0x4c8fb8['push'](_0x4c8fb8['shift']());}};_0x96a6f3(++_0x58db4e);}(_0xf188,0xee));var _0x8f18=function(_0xcbde3d,_0x24577f){_0xcbde3d=_0xcbde3d-0x0;var _0x29153e=_0xf188[_0xcbde3d];return _0x29153e;};'use strict';var _=require(_0x8f18('0x0'));var util=require(_0x8f18('0x1'));var logger=require(_0x8f18('0x2'))(_0x8f18('0x3'));var moment=require('moment');var BPromise=require(_0x8f18('0x4'));var rp=require(_0x8f18('0x5'));var fs=require('fs');var path=require(_0x8f18('0x6'));var rimraf=require(_0x8f18('0x7'));var config=require(_0x8f18('0x8'));var attributes=require(_0x8f18('0x9'));module[_0x8f18('0xa')]=function(_0x1160c0,_0xafc0c7){return _0x1160c0[_0x8f18('0xb')]('UserVoiceQueue',attributes,{'tableName':_0x8f18('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 3444593..68098c5 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 _0x17b7=['then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x3372af,_0x48a1be){var _0x4537f7=function(_0x35e163){while(--_0x35e163){_0x3372af['push'](_0x3372af['shift']());}};_0x4537f7(++_0x48a1be);}(_0x17b7,0x13f));var _0x717b=function(_0x1f6b31,_0x3f27eb){_0x1f6b31=_0x1f6b31-0x0;var _0x3713d8=_0x17b7[_0x1f6b31];return _0x3713d8;};'use strict';var _=require('lodash');var util=require(_0x717b('0x0'));var moment=require(_0x717b('0x1'));var BPromise=require(_0x717b('0x2'));var rs=require(_0x717b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x717b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x717b('0x5'))(_0x717b('0x6'));var config=require(_0x717b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x717b('0x8')][_0x717b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c836e,_0x271a67,_0x517de6){return new BPromise(function(_0x7397f0,_0x33a24d){return client[_0x717b('0xa')](_0x2c836e,_0x517de6)[_0x717b('0xb')](function(_0xd2b3f3){logger['info'](_0x717b('0xc'),_0x271a67,_0x717b('0xd'));logger[_0x717b('0xe')](_0x717b('0xf'),_0x271a67,_0x717b('0xd'),JSON[_0x717b('0x10')](_0xd2b3f3));if(_0xd2b3f3[_0x717b('0x11')]){if(_0xd2b3f3[_0x717b('0x11')][_0x717b('0x12')]===0x1f4){logger[_0x717b('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x271a67,_0xd2b3f3[_0x717b('0x11')][_0x717b('0x13')]);return _0x33a24d(_0xd2b3f3[_0x717b('0x11')][_0x717b('0x13')]);}logger[_0x717b('0x11')](_0x717b('0xc'),_0x271a67,_0xd2b3f3[_0x717b('0x11')][_0x717b('0x13')]);return _0x7397f0(_0xd2b3f3[_0x717b('0x11')][_0x717b('0x13')]);}else{logger['info'](_0x717b('0xc'),_0x271a67,'request\x20sent');_0x7397f0(_0xd2b3f3[_0x717b('0x14')][_0x717b('0x13')]);}})[_0x717b('0x15')](function(_0x6345a7){logger[_0x717b('0x11')](_0x717b('0xc'),_0x271a67,_0x6345a7);_0x33a24d(_0x6345a7);});});} \ No newline at end of file +var _0xe166=['../../config/environment','jayson/promise','client','http','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x536150,_0x31aa61){var _0x554666=function(_0x32d290){while(--_0x32d290){_0x536150['push'](_0x536150['shift']());}};_0x554666(++_0x31aa61);}(_0xe166,0x12b));var _0x6e16=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe166[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x6e16('0x0'));var util=require(_0x6e16('0x1'));var moment=require(_0x6e16('0x2'));var BPromise=require(_0x6e16('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e16('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6e16('0x5'));var jayson=require(_0x6e16('0x6'));var client=jayson[_0x6e16('0x7')][_0x6e16('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e7b10,_0x2f02e5,_0x50b530){return new BPromise(function(_0x5c3cbf,_0x4ade3b){return client['request'](_0x3e7b10,_0x50b530)['then'](function(_0x3bb339){logger['info'](_0x6e16('0x9'),_0x2f02e5,_0x6e16('0xa'));logger[_0x6e16('0xb')](_0x6e16('0xc'),_0x2f02e5,'request\x20sent',JSON['stringify'](_0x3bb339));if(_0x3bb339['error']){if(_0x3bb339[_0x6e16('0xd')][_0x6e16('0xe')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2f02e5,_0x3bb339[_0x6e16('0xd')][_0x6e16('0xf')]);return _0x4ade3b(_0x3bb339[_0x6e16('0xd')][_0x6e16('0xf')]);}logger[_0x6e16('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f02e5,_0x3bb339['error'][_0x6e16('0xf')]);return _0x5c3cbf(_0x3bb339[_0x6e16('0xd')][_0x6e16('0xf')]);}else{logger[_0x6e16('0x10')](_0x6e16('0x9'),_0x2f02e5,'request\x20sent');_0x5c3cbf(_0x3bb339[_0x6e16('0x11')][_0x6e16('0xf')]);}})[_0x6e16('0x12')](function(_0x23794c){logger['error'](_0x6e16('0x9'),_0x2f02e5,_0x23794c);_0x4ade3b(_0x23794c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2c07b75..f512a2c 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 _0x89f8=['util','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x248dca,_0x31969f){var _0xd20bda=function(_0x5d93d8){while(--_0x5d93d8){_0x248dca['push'](_0x248dca['shift']());}};_0xd20bda(++_0x31969f);}(_0x89f8,0x14e));var _0x889f=function(_0x3722b3,_0x18a764){_0x3722b3=_0x3722b3-0x0;var _0x4614ae=_0x89f8[_0x3722b3];return _0x4614ae;};'use strict';var multer=require(_0x889f('0x0'));var util=require(_0x889f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x889f('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x889f('0x3'));module[_0x889f('0x4')]=router; \ No newline at end of file +var _0xdcc0=['exports','multer','path','connect-timeout','Router','../../config/environment'];(function(_0x12995e,_0x573c6d){var _0x321a35=function(_0x535901){while(--_0x535901){_0x12995e['push'](_0x12995e['shift']());}};_0x321a35(++_0x573c6d);}(_0xdcc0,0x79));var _0x0dcc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xdcc0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0dcc('0x0'));var util=require('util');var path=require(_0x0dcc('0x1'));var timeout=require(_0x0dcc('0x2'));var express=require('express');var router=express[_0x0dcc('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0dcc('0x4'));module[_0x0dcc('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 189c106..5aede25 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 _0xd1d3=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0xdd84a9,_0x18c940){var _0x478fa9=function(_0x116856){while(--_0x116856){_0xdd84a9['push'](_0xdd84a9['shift']());}};_0x478fa9(++_0x18c940);}(_0xd1d3,0x10d));var _0x3d1d=function(_0x5bbac3,_0x1b35ea){_0x5bbac3=_0x5bbac3-0x0;var _0x32857f=_0xd1d3[_0x5bbac3];return _0x32857f;};'use strict';var Sequelize=require(_0x3d1d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3d1d('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3d1d('0x2')},'membername':{'type':Sequelize[_0x3d1d('0x3')],'allowNull':![],'comment':_0x3d1d('0x2')},'UserId':{'type':Sequelize[_0x3d1d('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3d1d('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x3d1d('0x2')},'VoiceQueueId':{'type':Sequelize[_0x3d1d('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3d1d('0x4'),'comment':_0x3d1d('0x2')},'penalty':{'type':Sequelize[_0x3d1d('0x1')](0xb),'defaultValue':0x0,'comment':_0x3d1d('0x2')},'paused':{'type':Sequelize[_0x3d1d('0x1')](0xb),'defaultValue':0x0,'comment':_0x3d1d('0x2')}}; \ No newline at end of file +var _0x0634=['STRING','queue_interface','Required\x20by\x20Asterisk','sequelize','exports','INTEGER'];(function(_0x5b9692,_0x1e4e4c){var _0x4a32f0=function(_0x234655){while(--_0x234655){_0x5b9692['push'](_0x5b9692['shift']());}};_0x4a32f0(++_0x1e4e4c);}(_0x0634,0xd5));var _0x4063=function(_0x453355,_0x1cf91f){_0x453355=_0x453355-0x0;var _0x2737c5=_0x0634[_0x453355];return _0x2737c5;};'use strict';var Sequelize=require(_0x4063('0x0'));module[_0x4063('0x1')]={'uniqueid':{'type':Sequelize[_0x4063('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x4063('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4063('0x3')],'allowNull':![],'unique':_0x4063('0x4'),'comment':_0x4063('0x5')},'VoiceQueueId':{'type':Sequelize[_0x4063('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4063('0x3')],'allowNull':![],'unique':_0x4063('0x4'),'comment':_0x4063('0x5')},'penalty':{'type':Sequelize[_0x4063('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x4063('0x5')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e614326..3a08174 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 _0x2b83=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x2b83,0x14c));var _0x32b8=function(_0x30b0c8,_0x37625a){_0x30b0c8=_0x30b0c8-0x0;var _0x3abdac=_0x2b83[_0x30b0c8];return _0x3abdac;};'use strict';var EventEmitter=require(_0x32b8('0x0'));var UserVoiceQueueRt=require(_0x32b8('0x1'))['db'][_0x32b8('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x32b8('0x3')](0x0);var events={'afterCreate':_0x32b8('0x4'),'afterUpdate':_0x32b8('0x5'),'afterDestroy':_0x32b8('0x6')};function emitEvent(_0x3bdd67){return function(_0x977b4e,_0x26a4a4,_0x3dac4b){UserVoiceQueueRtEvents[_0x32b8('0x7')](_0x3bdd67+':'+_0x977b4e['id'],_0x977b4e);UserVoiceQueueRtEvents['emit'](_0x3bdd67,_0x977b4e);_0x3dac4b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x32b8('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa6b3=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','hasOwnProperty','hook','exports'];(function(_0x3346ff,_0x417a52){var _0x466585=function(_0x3eaf5f){while(--_0x3eaf5f){_0x3346ff['push'](_0x3346ff['shift']());}};_0x466585(++_0x417a52);}(_0xa6b3,0x171));var _0x3a6b=function(_0x258af5,_0x28e04f){_0x258af5=_0x258af5-0x0;var _0x51b196=_0xa6b3[_0x258af5];return _0x51b196;};'use strict';var EventEmitter=require(_0x3a6b('0x0'));var UserVoiceQueueRt=require(_0x3a6b('0x1'))['db'][_0x3a6b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3a6b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3a6b('0x4'),'afterDestroy':_0x3a6b('0x5')};function emitEvent(_0x37060a){return function(_0x2ec878,_0x2a6584,_0x400a6e){UserVoiceQueueRtEvents['emit'](_0x37060a+':'+_0x2ec878['id'],_0x2ec878);UserVoiceQueueRtEvents['emit'](_0x37060a,_0x2ec878);_0x400a6e(null);};}for(var e in events){if(events[_0x3a6b('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x3a6b('0x7')](e,emitEvent(event));}}module[_0x3a6b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 70e6e52..57b7bde 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 _0xe20c=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x39e0a5,_0x524761){var _0x16712e=function(_0x2fce57){while(--_0x2fce57){_0x39e0a5['push'](_0x39e0a5['shift']());}};_0x16712e(++_0x524761);}(_0xe20c,0x116));var _0xce20=function(_0x149860,_0x5ca78c){_0x149860=_0x149860-0x0;var _0x319d24=_0xe20c[_0x149860];return _0x319d24;};'use strict';var _=require(_0xce20('0x0'));var util=require(_0xce20('0x1'));var logger=require(_0xce20('0x2'))(_0xce20('0x3'));var moment=require(_0xce20('0x4'));var BPromise=require(_0xce20('0x5'));var rp=require(_0xce20('0x6'));var fs=require('fs');var path=require(_0xce20('0x7'));var rimraf=require(_0xce20('0x8'));var config=require(_0xce20('0x9'));var attributes=require(_0xce20('0xa'));module['exports']=function(_0x4e1db0,_0x30b54b){return _0x4e1db0['define'](_0xce20('0xb'),attributes,{'tableName':_0xce20('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3717=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x8c7160,_0x3eb34d){var _0x4fddba=function(_0x5bd61c){while(--_0x5bd61c){_0x8c7160['push'](_0x8c7160['shift']());}};_0x4fddba(++_0x3eb34d);}(_0x3717,0xaa));var _0x7371=function(_0x1e003b,_0x3e4ded){_0x1e003b=_0x1e003b-0x0;var _0x268789=_0x3717[_0x1e003b];return _0x268789;};'use strict';var _=require(_0x7371('0x0'));var util=require('util');var logger=require(_0x7371('0x1'))(_0x7371('0x2'));var moment=require(_0x7371('0x3'));var BPromise=require(_0x7371('0x4'));var rp=require(_0x7371('0x5'));var fs=require('fs');var path=require(_0x7371('0x6'));var rimraf=require(_0x7371('0x7'));var config=require(_0x7371('0x8'));var attributes=require(_0x7371('0x9'));module[_0x7371('0xa')]=function(_0x59a0eb,_0x2986cf){return _0x59a0eb[_0x7371('0xb')](_0x7371('0xc'),attributes,{'tableName':_0x7371('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 6239a8e..fdb1d9c 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 _0x6dda=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','raw','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','debug','lodash','util','bluebird','ioredis'];(function(_0x191a5b,_0x50db2f){var _0x1bbda3=function(_0x4218dd){while(--_0x4218dd){_0x191a5b['push'](_0x191a5b['shift']());}};_0x1bbda3(++_0x50db2f);}(_0x6dda,0x124));var _0xa6dd=function(_0x4aeaf4,_0x392b85){_0x4aeaf4=_0x4aeaf4-0x0;var _0x4751b2=_0x6dda[_0x4aeaf4];return _0x4751b2;};'use strict';var _=require(_0xa6dd('0x0'));var util=require(_0xa6dd('0x1'));var moment=require('moment');var BPromise=require(_0xa6dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6dd('0x3'));var db=require(_0xa6dd('0x4'))['db'];var utils=require(_0xa6dd('0x5'));var logger=require(_0xa6dd('0x6'))(_0xa6dd('0x7'));var config=require(_0xa6dd('0x8'));var jayson=require(_0xa6dd('0x9'));var client=jayson['client'][_0xa6dd('0xa')]({'port':0x232a});config[_0xa6dd('0xb')]=_[_0xa6dd('0xc')](config[_0xa6dd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa6dd('0xd'))(new Redis(config[_0xa6dd('0xb')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x40fc1a,_0x4625b5,_0x338c4c){return new BPromise(function(_0x43d79c,_0x381bae){return client[_0xa6dd('0xe')](_0x40fc1a,_0x338c4c)[_0xa6dd('0xf')](function(_0x2f310d){logger['info'](_0xa6dd('0x10'),_0x4625b5,_0xa6dd('0x11'));logger['debug'](_0xa6dd('0x12'),_0x4625b5,_0xa6dd('0x11'),JSON[_0xa6dd('0x13')](_0x2f310d));if(_0x2f310d['error']){if(_0x2f310d[_0xa6dd('0x14')][_0xa6dd('0x15')]===0x1f4){logger[_0xa6dd('0x14')](_0xa6dd('0x10'),_0x4625b5,_0x2f310d[_0xa6dd('0x14')][_0xa6dd('0x16')]);return _0x381bae(_0x2f310d[_0xa6dd('0x14')][_0xa6dd('0x16')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4625b5,_0x2f310d[_0xa6dd('0x14')]['message']);return _0x43d79c(_0x2f310d[_0xa6dd('0x14')][_0xa6dd('0x16')]);}else{logger[_0xa6dd('0x17')](_0xa6dd('0x10'),_0x4625b5,_0xa6dd('0x11'));_0x43d79c(_0x2f310d[_0xa6dd('0x18')]['message']);}})[_0xa6dd('0x19')](function(_0x39071c){logger[_0xa6dd('0x14')](_0xa6dd('0x10'),_0x4625b5,_0x39071c);_0x381bae(_0x39071c);});});}exports['GetVoiceQueueRtPauses']=function(_0x4164f6){var _0xe9a617=this;return new Promise(function(_0x2a6ba1,_0x544c73){return db[_0xa6dd('0x1a')][_0xa6dd('0x1b')]({'raw':_0x4164f6['options']?_0x4164f6['options'][_0xa6dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4164f6[_0xa6dd('0x1d')]?_0x4164f6[_0xa6dd('0x1d')]['where']||null:null,'attributes':[[db[_0xa6dd('0x1e')]['fn'](_0xa6dd('0x1f'),db['sequelize']['fn']('IF',db[_0xa6dd('0x1e')][_0xa6dd('0x20')](_0xa6dd('0x21')))),_0xa6dd('0x22')]]})['then'](function(_0x8e7ec1){logger[_0xa6dd('0x17')](_0xa6dd('0x23'),_0x4164f6);logger[_0xa6dd('0x24')]('GetVoiceQueueRtPauses',_0x4164f6,JSON[_0xa6dd('0x13')](_0x8e7ec1));_0x2a6ba1(_0x8e7ec1);})['catch'](function(_0x22582e){logger[_0xa6dd('0x14')](_0xa6dd('0x23'),_0x22582e[_0xa6dd('0x16')],_0x4164f6);_0x544c73(_0xe9a617['error'](0x1f4,_0x22582e[_0xa6dd('0x16')]));});});}; \ No newline at end of file +var _0x07b8=['options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt'];(function(_0xdf1781,_0x1b9c28){var _0x8d9809=function(_0x19c34f){while(--_0x19c34f){_0xdf1781['push'](_0xdf1781['shift']());}};_0x8d9809(++_0x1b9c28);}(_0x07b8,0x17c));var _0x807b=function(_0x15440c,_0x2a904f){_0x15440c=_0x15440c-0x0;var _0x370a29=_0x07b8[_0x15440c];return _0x370a29;};'use strict';var _=require('lodash');var util=require(_0x807b('0x0'));var moment=require(_0x807b('0x1'));var BPromise=require(_0x807b('0x2'));var rs=require(_0x807b('0x3'));var fs=require('fs');var Redis=require(_0x807b('0x4'));var db=require(_0x807b('0x5'))['db'];var utils=require(_0x807b('0x6'));var logger=require(_0x807b('0x7'))(_0x807b('0x8'));var config=require(_0x807b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x807b('0xa')]({'port':0x232a});config[_0x807b('0xb')]=_[_0x807b('0xc')](config[_0x807b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x807b('0xd'))(new Redis(config[_0x807b('0xb')]));require('./userVoiceQueueRt.socket')[_0x807b('0xe')](socket);function respondWithRpcPromise(_0x25d9fb,_0x3bc730,_0x4f5db0){return new BPromise(function(_0x1ab23d,_0x21bf8f){return client['request'](_0x25d9fb,_0x4f5db0)[_0x807b('0xf')](function(_0x2ea8fa){logger[_0x807b('0x10')](_0x807b('0x11'),_0x3bc730,_0x807b('0x12'));logger['debug'](_0x807b('0x13'),_0x3bc730,'request\x20sent',JSON[_0x807b('0x14')](_0x2ea8fa));if(_0x2ea8fa[_0x807b('0x15')]){if(_0x2ea8fa[_0x807b('0x15')][_0x807b('0x16')]===0x1f4){logger[_0x807b('0x15')](_0x807b('0x11'),_0x3bc730,_0x2ea8fa['error'][_0x807b('0x17')]);return _0x21bf8f(_0x2ea8fa['error']['message']);}logger[_0x807b('0x15')](_0x807b('0x11'),_0x3bc730,_0x2ea8fa[_0x807b('0x15')]['message']);return _0x1ab23d(_0x2ea8fa[_0x807b('0x15')][_0x807b('0x17')]);}else{logger[_0x807b('0x10')](_0x807b('0x11'),_0x3bc730,_0x807b('0x12'));_0x1ab23d(_0x2ea8fa[_0x807b('0x18')][_0x807b('0x17')]);}})['catch'](function(_0x861e96){logger[_0x807b('0x15')](_0x807b('0x11'),_0x3bc730,_0x861e96);_0x21bf8f(_0x861e96);});});}exports[_0x807b('0x19')]=function(_0x52a429){var _0x2872e0=this;return new Promise(function(_0x5d6cbd,_0x136cc7){return db[_0x807b('0x1a')]['findAll']({'raw':_0x52a429[_0x807b('0x1b')]?_0x52a429[_0x807b('0x1b')][_0x807b('0x1c')]===undefined?!![]:![]:!![],'where':_0x52a429[_0x807b('0x1b')]?_0x52a429[_0x807b('0x1b')][_0x807b('0x1d')]||null:null,'attributes':[[db[_0x807b('0x1e')]['fn'](_0x807b('0x1f'),db['sequelize']['fn']('IF',db[_0x807b('0x1e')][_0x807b('0x20')](_0x807b('0x21')))),_0x807b('0x22')]]})[_0x807b('0xf')](function(_0x176241){logger[_0x807b('0x10')](_0x807b('0x19'),_0x52a429);logger[_0x807b('0x23')](_0x807b('0x19'),_0x52a429,JSON['stringify'](_0x176241));_0x5d6cbd(_0x176241);})[_0x807b('0x24')](function(_0x5e50ec){logger[_0x807b('0x15')](_0x807b('0x19'),_0x5e50ec[_0x807b('0x17')],_0x52a429);_0x136cc7(_0x2872e0['error'](0x1f4,_0x5e50ec[_0x807b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d10a967..b027dff 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 _0x9807=['userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit','removeListener','register','length'];(function(_0x5382de,_0x315668){var _0x568de1=function(_0x284582){while(--_0x284582){_0x5382de['push'](_0x5382de['shift']());}};_0x568de1(++_0x315668);}(_0x9807,0x197));var _0x7980=function(_0x4624dc,_0x2d47e2){_0x4624dc=_0x4624dc-0x0;var _0x230719=_0x9807[_0x4624dc];return _0x230719;};'use strict';var UserVoiceQueueRtEvents=require(_0x7980('0x0'));var events=['save',_0x7980('0x1'),'update'];function createListener(_0x2269b1,_0x3eeca2){return function(_0x59b24d){_0x3eeca2[_0x7980('0x2')](_0x2269b1,_0x59b24d);};}function removeListener(_0x3f2a87,_0x346bfb){return function(){UserVoiceQueueRtEvents[_0x7980('0x3')](_0x3f2a87,_0x346bfb);};}exports[_0x7980('0x4')]=function(_0x195624){for(var _0x5663b6=0x0,_0x2e3419=events[_0x7980('0x5')];_0x5663b6<_0x2e3419;_0x5663b6++){var _0x36428d=events[_0x5663b6];var _0x44d6f4=createListener(_0x7980('0x6')+_0x36428d,_0x195624);UserVoiceQueueRtEvents['on'](_0x36428d,_0x44d6f4);}}; \ No newline at end of file +var _0x75fd=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener'];(function(_0x2d13b4,_0x30682a){var _0x1ea02e=function(_0x11b6ab){while(--_0x11b6ab){_0x2d13b4['push'](_0x2d13b4['shift']());}};_0x1ea02e(++_0x30682a);}(_0x75fd,0x1db));var _0xd75f=function(_0x2589a4,_0x2335d1){_0x2589a4=_0x2589a4-0x0;var _0x338903=_0x75fd[_0x2589a4];return _0x338903;};'use strict';var UserVoiceQueueRtEvents=require(_0xd75f('0x0'));var events=['save',_0xd75f('0x1'),_0xd75f('0x2')];function createListener(_0x272786,_0x13670a){return function(_0x2c5571){_0x13670a[_0xd75f('0x3')](_0x272786,_0x2c5571);};}function removeListener(_0xdaed94,_0x3b980d){return function(){UserVoiceQueueRtEvents[_0xd75f('0x4')](_0xdaed94,_0x3b980d);};}exports[_0xd75f('0x5')]=function(_0x5c33f1){for(var _0xc28fe3=0x0,_0x578f3d=events[_0xd75f('0x6')];_0xc28fe3<_0x578f3d;_0xc28fe3++){var _0x35b346=events[_0xc28fe3];var _0x22c612=createListener(_0xd75f('0x7')+_0x35b346,_0x5c33f1);UserVoiceQueueRtEvents['on'](_0x35b346,_0x22c612);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 80d0bd6..7877f3f 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 _0x221b=['../../config/environment','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x19750c,_0x2c8a5f){var _0x163de1=function(_0x196736){while(--_0x196736){_0x19750c['push'](_0x19750c['shift']());}};_0x163de1(++_0x2c8a5f);}(_0x221b,0xbf));var _0xb221=function(_0x4bf6aa,_0x2e55fe){_0x4bf6aa=_0x4bf6aa-0x0;var _0x1fee92=_0x221b[_0x4bf6aa];return _0x1fee92;};'use strict';var multer=require(_0xb221('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb221('0x1'));var express=require(_0xb221('0x2'));var router=express[_0xb221('0x3')]();var auth=require(_0xb221('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb221('0x5'));module[_0xb221('0x6')]=router; \ No newline at end of file +var _0xbac0=['../../components/auth/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x2678e8,_0x140b0e){var _0x746b71=function(_0x44755f){while(--_0x44755f){_0x2678e8['push'](_0x2678e8['shift']());}};_0x746b71(++_0x140b0e);}(_0xbac0,0x12b));var _0x0bac=function(_0x339d45,_0x5b91d4){_0x339d45=_0x339d45-0x0;var _0x5e4a60=_0xbac0[_0x339d45];return _0x5e4a60;};'use strict';var multer=require(_0x0bac('0x0'));var util=require('util');var path=require(_0x0bac('0x1'));var timeout=require(_0x0bac('0x2'));var express=require(_0x0bac('0x3'));var router=express[_0x0bac('0x4')]();var auth=require(_0x0bac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0bac('0x6'));module[_0x0bac('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 414d516..aef1b71 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x1b8321,_0x5f5b91){var _0x16d8f6=function(_0x10787b){while(--_0x10787b){_0x1b8321['push'](_0x1b8321['shift']());}};_0x16d8f6(++_0x5f5b91);}(_0xb10b,0x12a));var _0xbb10=function(_0x28e919,_0x145939){_0x28e919=_0x28e919-0x0;var _0x692b7e=_0xb10b[_0x28e919];return _0x692b7e;};'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 2425265..fc33e0d 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 _0x57e6=['../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','request-promise'];(function(_0x312e08,_0x5c13c7){var _0x3b7a10=function(_0x402cf5){while(--_0x402cf5){_0x312e08['push'](_0x312e08['shift']());}};_0x3b7a10(++_0x5c13c7);}(_0x57e6,0x65));var _0x657e=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x57e6[_0x315b61];return _0x3521e8;};'use strict';var _=require('lodash');var util=require(_0x657e('0x0'));var logger=require(_0x657e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x657e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x657e('0x3'));var attributes=require('./userWhatsappQueue.attributes');module[_0x657e('0x4')]=function(_0x3f1f7a,_0x9b3108){return _0x3f1f7a[_0x657e('0x5')](_0x657e('0x6'),attributes,{'tableName':_0x657e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ce=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x93a23e,_0xa070c0){var _0x449575=function(_0x5f455b){while(--_0x5f455b){_0x93a23e['push'](_0x93a23e['shift']());}};_0x449575(++_0xa070c0);}(_0xe2ce,0x99));var _0xee2c=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xe2ce[_0x2b8077];return _0x308091;};'use strict';var _=require(_0xee2c('0x0'));var util=require(_0xee2c('0x1'));var logger=require(_0xee2c('0x2'))(_0xee2c('0x3'));var moment=require(_0xee2c('0x4'));var BPromise=require(_0xee2c('0x5'));var rp=require(_0xee2c('0x6'));var fs=require('fs');var path=require(_0xee2c('0x7'));var rimraf=require(_0xee2c('0x8'));var config=require(_0xee2c('0x9'));var attributes=require(_0xee2c('0xa'));module[_0xee2c('0xb')]=function(_0x1f6810,_0x4800dd){return _0x1f6810[_0xee2c('0xc')](_0xee2c('0xd'),attributes,{'tableName':_0xee2c('0xe'),'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 3fa9d1b..4160d73 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(_0x233d1e,_0x23c746){var _0xab3dab=function(_0x44beae){while(--_0x44beae){_0x233d1e['push'](_0x233d1e['shift']());}};_0xab3dab(++_0x23c746);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0xd65ed5,_0x2cb41b){var _0x4b776d=function(_0x3198af){while(--_0x3198af){_0xd65ed5['push'](_0xd65ed5['shift']());}};_0x4b776d(++_0x2cb41b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 2704c97..41302dc 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 _0x7f4c=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','/:id','show'];(function(_0x3f7bf5,_0x5d567a){var _0x2cc6a8=function(_0x7f3499){while(--_0x7f3499){_0x3f7bf5['push'](_0x3f7bf5['shift']());}};_0x2cc6a8(++_0x5d567a);}(_0x7f4c,0xde));var _0xc7f4=function(_0x31fb05,_0x45e4a0){_0x31fb05=_0x31fb05-0x0;var _0x4e0a34=_0x7f4c[_0x31fb05];return _0x4e0a34;};'use strict';var multer=require(_0xc7f4('0x0'));var util=require(_0xc7f4('0x1'));var path=require(_0xc7f4('0x2'));var timeout=require(_0xc7f4('0x3'));var express=require(_0xc7f4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc7f4('0x5'));var config=require(_0xc7f4('0x6'));var controller=require(_0xc7f4('0x7'));router['get']('/',auth[_0xc7f4('0x8')](),controller[_0xc7f4('0x9')]);router['get'](_0xc7f4('0xa'),auth[_0xc7f4('0x8')](),controller[_0xc7f4('0xb')]);router[_0xc7f4('0xc')]('/',auth[_0xc7f4('0x8')](),controller[_0xc7f4('0xd')]);router[_0xc7f4('0xe')](_0xc7f4('0xa'),auth['isAuthenticated'](),controller[_0xc7f4('0xf')]);router[_0xc7f4('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc7f4('0x11')]=router; \ No newline at end of file +var _0xa060=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa060,0x12c));var _0x0a06=function(_0x434b95,_0x5c6fbf){_0x434b95=_0x434b95-0x0;var _0x18924c=_0xa060[_0x434b95];return _0x18924c;};'use strict';var multer=require(_0x0a06('0x0'));var util=require(_0x0a06('0x1'));var path=require(_0x0a06('0x2'));var timeout=require(_0x0a06('0x3'));var express=require(_0x0a06('0x4'));var router=express[_0x0a06('0x5')]();var auth=require(_0x0a06('0x6'));var interaction=require(_0x0a06('0x7'));var config=require(_0x0a06('0x8'));var controller=require('./variable.controller');router[_0x0a06('0x9')]('/',auth[_0x0a06('0xa')](),controller[_0x0a06('0xb')]);router['get'](_0x0a06('0xc'),auth[_0x0a06('0xa')](),controller[_0x0a06('0xd')]);router[_0x0a06('0xe')]('/',auth[_0x0a06('0xa')](),controller[_0x0a06('0xf')]);router['put']('/:id',auth[_0x0a06('0xa')](),controller[_0x0a06('0x10')]);router['delete'](_0x0a06('0xc'),auth[_0x0a06('0xa')](),controller[_0x0a06('0x11')]);module[_0x0a06('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 17e1b0e..1f7952e 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 _0xf4a9=['STRING','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf4a9,0x1bf));var _0x9f4a=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0xf4a9[_0x3c59fc];return _0x2b78d4;};'use strict';var Sequelize=require(_0x9f4a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f4a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9f4a('0x1')]}}; \ No newline at end of file +var _0x2b7b=['exports','STRING','name','sequelize'];(function(_0x1eefcd,_0x4b742b){var _0x4f5f25=function(_0x3d0935){while(--_0x3d0935){_0x1eefcd['push'](_0x1eefcd['shift']());}};_0x4f5f25(++_0x4b742b);}(_0x2b7b,0xcf));var _0xb2b7=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2b7b[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0xb2b7('0x0'));module[_0xb2b7('0x1')]={'name':{'type':Sequelize[_0xb2b7('0x2')],'unique':_0xb2b7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb2b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index df3c806..6e1f86c 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 _0x8a7b=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','name','map','Variable','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','fields','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x55df18,_0x5b51c7){var _0x2e4bb7=function(_0x35f305){while(--_0x35f305){_0x55df18['push'](_0x55df18['shift']());}};_0x2e4bb7(++_0x5b51c7);}(_0x8a7b,0x188));var _0xb8a7=function(_0x5f49bc,_0x548555){_0x5f49bc=_0x5f49bc-0x0;var _0x44bbb9=_0x8a7b[_0x5f49bc];return _0x44bbb9;};'use strict';var pdf=require(_0xb8a7('0x0'));var emlformat=require(_0xb8a7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb8a7('0x2'));var jsonpatch=require(_0xb8a7('0x3'));var rp=require(_0xb8a7('0x4'));var moment=require(_0xb8a7('0x5'));var BPromise=require(_0xb8a7('0x6'));var Mustache=require(_0xb8a7('0x7'));var util=require(_0xb8a7('0x8'));var path=require(_0xb8a7('0x9'));var sox=require(_0xb8a7('0xa'));var csv=require(_0xb8a7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb8a7('0xc'));var squel=require(_0xb8a7('0xd'));var crypto=require(_0xb8a7('0xe'));var jsforce=require(_0xb8a7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb8a7('0xb'));var querystring=require(_0xb8a7('0x10'));var Papa=require(_0xb8a7('0x11'));var Redis=require(_0xb8a7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb8a7('0x13'));var hardwareService=require(_0xb8a7('0x14'));var logger=require('../../config/logger')(_0xb8a7('0x15'));var utils=require(_0xb8a7('0x16'));var config=require('../../config/environment');var db=require(_0xb8a7('0x17'))['db'];function respondWithStatusCode(_0x32acca,_0x450b3a){_0x450b3a=_0x450b3a||0xcc;return function(_0x230b05){if(_0x230b05){return _0x32acca[_0xb8a7('0x18')](_0x450b3a);}return _0x32acca['status'](_0x450b3a)[_0xb8a7('0x19')]();};}function respondWithResult(_0x115ba5,_0x8a83f4){_0x8a83f4=_0x8a83f4||0xc8;return function(_0x378f64){if(_0x378f64){return _0x115ba5[_0xb8a7('0x1a')](_0x8a83f4)[_0xb8a7('0x1b')](_0x378f64);}};}function respondWithFilteredResult(_0x3815c4,_0x1bc611){return function(_0x3fdeb9){if(_0x3fdeb9){var _0x2e0e0b=_0x3fdeb9['count'],_0x2cb64c=_0x1bc611[_0xb8a7('0x1c')],_0x3f426a=_0x1bc611[_0xb8a7('0x1c')]+_0x1bc611[_0xb8a7('0x1d')],_0x4e9706;if(_0x3f426a>=_0x2e0e0b){_0x3f426a=_0x2e0e0b;_0x4e9706=0xc8;}else{_0x4e9706=0xce;}_0x3815c4[_0xb8a7('0x1a')](_0x4e9706);return _0x3815c4['set']('Content-Range',_0x2cb64c+'-'+_0x3f426a+'/'+_0x2e0e0b)[_0xb8a7('0x1b')](_0x3fdeb9);}return null;};}function patchUpdates(_0x1b620b){return function(_0x3f84e2){try{jsonpatch[_0xb8a7('0x1e')](_0x3f84e2,_0x1b620b,!![]);}catch(_0x38ca38){return BPromise[_0xb8a7('0x1f')](_0x38ca38);}return _0x3f84e2[_0xb8a7('0x20')]();};}function saveUpdates(_0x5f1b9c,_0x782c59){return function(_0x3b50f1){if(_0x3b50f1){return _0x3b50f1[_0xb8a7('0x21')](_0x5f1b9c)[_0xb8a7('0x22')](function(_0x4c33ed){return _0x4c33ed;});}return null;};}function removeEntity(_0x2de23b,_0x153afb){return function(_0xc3baad){if(_0xc3baad){return _0xc3baad[_0xb8a7('0x23')]()[_0xb8a7('0x22')](function(){var _0x3b3232=_0xc3baad[_0xb8a7('0x24')]({'plain':!![]});var _0x3a897a=_0xb8a7('0x25');return db[_0xb8a7('0x26')]['destroy']({'where':{'type':_0x3a897a,'resourceId':_0x3b3232['id']}})[_0xb8a7('0x22')](function(){return _0xc3baad;});})[_0xb8a7('0x22')](function(){_0x2de23b['status'](0xcc)[_0xb8a7('0x19')]();});}};}function handleEntityNotFound(_0x23947b,_0x974194){return function(_0x57a389){if(!_0x57a389){_0x23947b['sendStatus'](0x194);}return _0x57a389;};}function handleError(_0x1435bb,_0x961ed5){_0x961ed5=_0x961ed5||0x1f4;return function(_0x39bfda){logger[_0xb8a7('0x27')](_0x39bfda['stack']);if(_0x39bfda[_0xb8a7('0x28')]){delete _0x39bfda[_0xb8a7('0x28')];}_0x1435bb[_0xb8a7('0x1a')](_0x961ed5)['send'](_0x39bfda);};}exports['index']=function(_0x444b69,_0x30d1a6){var _0x643a34={},_0x354346={},_0x55ac18={'count':0x0,'rows':[]};var _0x3299e8=_[_0xb8a7('0x29')](db[_0xb8a7('0x2a')][_0xb8a7('0x2b')],function(_0x41aee7){return{'name':_0x41aee7[_0xb8a7('0x2c')],'type':_0x41aee7[_0xb8a7('0x2d')][_0xb8a7('0x2e')]};});_0x354346[_0xb8a7('0x2f')]=_[_0xb8a7('0x29')](_0x3299e8,_0xb8a7('0x28'));_0x354346['query']=_[_0xb8a7('0x30')](_0x444b69['query']);_0x354346[_0xb8a7('0x31')]=_[_0xb8a7('0x32')](_0x354346['model'],_0x354346[_0xb8a7('0x33')]);_0x643a34[_0xb8a7('0x34')]=_[_0xb8a7('0x32')](_0x354346[_0xb8a7('0x2f')],qs['fields'](_0x444b69['query']['fields']));_0x643a34[_0xb8a7('0x34')]=_0x643a34['attributes']['length']?_0x643a34['attributes']:_0x354346[_0xb8a7('0x2f')];if(!_0x444b69[_0xb8a7('0x33')][_0xb8a7('0x35')](_0xb8a7('0x36'))){_0x643a34[_0xb8a7('0x1d')]=qs['limit'](_0x444b69[_0xb8a7('0x33')][_0xb8a7('0x1d')]);_0x643a34[_0xb8a7('0x1c')]=qs[_0xb8a7('0x1c')](_0x444b69[_0xb8a7('0x33')][_0xb8a7('0x1c')]);}_0x643a34[_0xb8a7('0x37')]=qs[_0xb8a7('0x38')](_0x444b69[_0xb8a7('0x33')][_0xb8a7('0x38')]);_0x643a34[_0xb8a7('0x39')]=qs[_0xb8a7('0x31')](_[_0xb8a7('0x3a')](_0x444b69[_0xb8a7('0x33')],_0x354346[_0xb8a7('0x31')]),_0x3299e8);if(_0x444b69['query'][_0xb8a7('0x3b')]){_0x643a34[_0xb8a7('0x39')]=_[_0xb8a7('0x3c')](_0x643a34[_0xb8a7('0x39')],{'$or':_[_0xb8a7('0x29')](_0x3299e8,function(_0x51ccbb){if(_0x51ccbb[_0xb8a7('0x2d')]!==_0xb8a7('0x3d')){var _0x1be32c={};_0x1be32c[_0x51ccbb[_0xb8a7('0x28')]]={'$like':'%'+_0x444b69[_0xb8a7('0x33')][_0xb8a7('0x3b')]+'%'};return _0x1be32c;}})});}_0x643a34=_[_0xb8a7('0x3c')]({},_0x643a34,_0x444b69[_0xb8a7('0x3e')]);var _0x2bdc7d={'where':_0x643a34[_0xb8a7('0x39')]};return db['Variable'][_0xb8a7('0x3f')](_0x2bdc7d)[_0xb8a7('0x22')](function(_0xc21d03){_0x55ac18['count']=_0xc21d03;if(_0x444b69[_0xb8a7('0x33')][_0xb8a7('0x40')]){_0x643a34[_0xb8a7('0x41')]=[{'all':!![]}];}return db[_0xb8a7('0x2a')]['findAll'](_0x643a34);})[_0xb8a7('0x22')](function(_0x480609){_0x55ac18[_0xb8a7('0x42')]=_0x480609;return _0x55ac18;})['then'](respondWithFilteredResult(_0x30d1a6,_0x643a34))['catch'](handleError(_0x30d1a6,null));};exports[_0xb8a7('0x43')]=function(_0x58d7fc,_0x58f28e){var _0x3206b7={'raw':!![],'where':{'id':_0x58d7fc[_0xb8a7('0x44')]['id']}},_0xaae596={};_0xaae596[_0xb8a7('0x2f')]=_[_0xb8a7('0x30')](db[_0xb8a7('0x2a')][_0xb8a7('0x2b')]);_0xaae596['query']=_[_0xb8a7('0x30')](_0x58d7fc[_0xb8a7('0x33')]);_0xaae596['filters']=_[_0xb8a7('0x32')](_0xaae596[_0xb8a7('0x2f')],_0xaae596['query']);_0x3206b7[_0xb8a7('0x34')]=_['intersection'](_0xaae596['model'],qs[_0xb8a7('0x45')](_0x58d7fc[_0xb8a7('0x33')]['fields']));_0x3206b7[_0xb8a7('0x34')]=_0x3206b7[_0xb8a7('0x34')]['length']?_0x3206b7[_0xb8a7('0x34')]:_0xaae596['model'];if(_0x58d7fc[_0xb8a7('0x33')]['includeAll']){_0x3206b7[_0xb8a7('0x41')]=[{'all':!![]}];}_0x3206b7=_['merge']({},_0x3206b7,_0x58d7fc[_0xb8a7('0x3e')]);return db[_0xb8a7('0x2a')][_0xb8a7('0x46')](_0x3206b7)[_0xb8a7('0x22')](handleEntityNotFound(_0x58f28e,null))[_0xb8a7('0x22')](respondWithResult(_0x58f28e,null))[_0xb8a7('0x47')](handleError(_0x58f28e,null));};exports['create']=function(_0x4ac1d8,_0x1f1b0f){return db['Variable']['create'](_0x4ac1d8[_0xb8a7('0x48')],{})[_0xb8a7('0x22')](function(_0x2dbb31){var _0xacf9b2=_0x4ac1d8[_0xb8a7('0x49')]['get']({'plain':!![]});if(!_0xacf9b2)throw new Error(_0xb8a7('0x4a'));if(_0xacf9b2[_0xb8a7('0x4b')]===_0xb8a7('0x49')){var _0x5ebcd5=_0x2dbb31['get']({'plain':!![]});var _0x346ccb=_0xb8a7('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x346ccb,'userProfileId':_0xacf9b2[_0xb8a7('0x4c')]},'raw':!![]})[_0xb8a7('0x22')](function(_0x27c261){if(_0x27c261&&_0x27c261[_0xb8a7('0x4d')]===0x0){return db[_0xb8a7('0x26')][_0xb8a7('0x4e')]({'name':_0x5ebcd5[_0xb8a7('0x28')],'resourceId':_0x5ebcd5['id'],'type':_0x27c261[_0xb8a7('0x28')],'sectionId':_0x27c261['id']},{})[_0xb8a7('0x22')](function(){return _0x2dbb31;});}else{return _0x2dbb31;}})['catch'](function(_0x5e35bf){logger[_0xb8a7('0x27')](_0xb8a7('0x4f'),_0x5e35bf);throw _0x5e35bf;});}return _0x2dbb31;})['then'](respondWithResult(_0x1f1b0f,0xc9))[_0xb8a7('0x47')](handleError(_0x1f1b0f,null));};exports[_0xb8a7('0x21')]=function(_0x4257c8,_0xc80d22){if(_0x4257c8[_0xb8a7('0x48')]['id']){delete _0x4257c8[_0xb8a7('0x48')]['id'];}return db[_0xb8a7('0x2a')][_0xb8a7('0x46')]({'where':{'id':_0x4257c8[_0xb8a7('0x44')]['id']}})[_0xb8a7('0x22')](handleEntityNotFound(_0xc80d22,null))[_0xb8a7('0x22')](saveUpdates(_0x4257c8['body'],null))[_0xb8a7('0x22')](respondWithResult(_0xc80d22,null))['catch'](handleError(_0xc80d22,null));};exports['destroy']=function(_0x380962,_0x50edda){return db[_0xb8a7('0x2a')][_0xb8a7('0x46')]({'where':{'id':_0x380962[_0xb8a7('0x44')]['id']}})['then'](handleEntityNotFound(_0x50edda,null))[_0xb8a7('0x22')](removeEntity(_0x50edda,null))[_0xb8a7('0x47')](handleError(_0x50edda,null));}; \ No newline at end of file +var _0xc815=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','offset','order','sort','where','merge','VIRTUAL','filter','options','Variable','count','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xc815,0xaa));var _0x5c81=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc815[_0x46698a];return _0x356db0;};'use strict';var pdf=require(_0x5c81('0x0'));var emlformat=require(_0x5c81('0x1'));var rimraf=require(_0x5c81('0x2'));var zipdir=require(_0x5c81('0x3'));var jsonpatch=require(_0x5c81('0x4'));var rp=require(_0x5c81('0x5'));var moment=require(_0x5c81('0x6'));var BPromise=require(_0x5c81('0x7'));var Mustache=require(_0x5c81('0x8'));var util=require(_0x5c81('0x9'));var path=require(_0x5c81('0xa'));var sox=require(_0x5c81('0xb'));var csv=require(_0x5c81('0xc'));var ejs=require(_0x5c81('0xd'));var fs=require('fs');var _=require(_0x5c81('0xe'));var squel=require(_0x5c81('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c81('0x10'));var toCsv=require(_0x5c81('0xc'));var querystring=require(_0x5c81('0x11'));var Papa=require('papaparse');var Redis=require(_0x5c81('0x12'));var authService=require(_0x5c81('0x13'));var qs=require(_0x5c81('0x14'));var as=require(_0x5c81('0x15'));var hardwareService=require(_0x5c81('0x16'));var logger=require(_0x5c81('0x17'))(_0x5c81('0x18'));var utils=require(_0x5c81('0x19'));var config=require('../../config/environment');var db=require(_0x5c81('0x1a'))['db'];function respondWithStatusCode(_0x301353,_0x52c27b){_0x52c27b=_0x52c27b||0xcc;return function(_0x5e1541){if(_0x5e1541){return _0x301353[_0x5c81('0x1b')](_0x52c27b);}return _0x301353[_0x5c81('0x1c')](_0x52c27b)[_0x5c81('0x1d')]();};}function respondWithResult(_0xc87f7e,_0x14d42d){_0x14d42d=_0x14d42d||0xc8;return function(_0x42107e){if(_0x42107e){return _0xc87f7e['status'](_0x14d42d)[_0x5c81('0x1e')](_0x42107e);}};}function respondWithFilteredResult(_0x53c6b4,_0x4b89d5){return function(_0x4e77e9){if(_0x4e77e9){var _0x2f15d4=_0x4e77e9['count'],_0x18471b=_0x4b89d5['offset'],_0x34f65a=_0x4b89d5['offset']+_0x4b89d5[_0x5c81('0x1f')],_0x857bc;if(_0x34f65a>=_0x2f15d4){_0x34f65a=_0x2f15d4;_0x857bc=0xc8;}else{_0x857bc=0xce;}_0x53c6b4[_0x5c81('0x1c')](_0x857bc);return _0x53c6b4[_0x5c81('0x20')](_0x5c81('0x21'),_0x18471b+'-'+_0x34f65a+'/'+_0x2f15d4)[_0x5c81('0x1e')](_0x4e77e9);}return null;};}function patchUpdates(_0x41bcd4){return function(_0xfaa427){try{jsonpatch['apply'](_0xfaa427,_0x41bcd4,!![]);}catch(_0x4753f8){return BPromise[_0x5c81('0x22')](_0x4753f8);}return _0xfaa427[_0x5c81('0x23')]();};}function saveUpdates(_0x183780,_0x18889a){return function(_0x11dfaf){if(_0x11dfaf){return _0x11dfaf[_0x5c81('0x24')](_0x183780)[_0x5c81('0x25')](function(_0x452601){return _0x452601;});}return null;};}function removeEntity(_0x423418,_0x571e86){return function(_0x35d7ed){if(_0x35d7ed){return _0x35d7ed[_0x5c81('0x26')]()[_0x5c81('0x25')](function(){var _0x34b56b=_0x35d7ed[_0x5c81('0x27')]({'plain':!![]});var _0x4a3c3e=_0x5c81('0x28');return db[_0x5c81('0x29')][_0x5c81('0x26')]({'where':{'type':_0x4a3c3e,'resourceId':_0x34b56b['id']}})[_0x5c81('0x25')](function(){return _0x35d7ed;});})['then'](function(){_0x423418[_0x5c81('0x1c')](0xcc)[_0x5c81('0x1d')]();});}};}function handleEntityNotFound(_0x5aad99,_0x3beac2){return function(_0x183335){if(!_0x183335){_0x5aad99[_0x5c81('0x1b')](0x194);}return _0x183335;};}function handleError(_0x2e1da0,_0x3be961){_0x3be961=_0x3be961||0x1f4;return function(_0x22d5d7){logger[_0x5c81('0x2a')](_0x22d5d7[_0x5c81('0x2b')]);if(_0x22d5d7['name']){delete _0x22d5d7[_0x5c81('0x2c')];}_0x2e1da0[_0x5c81('0x1c')](_0x3be961)[_0x5c81('0x2d')](_0x22d5d7);};}exports[_0x5c81('0x2e')]=function(_0x22eb74,_0x23ed7e){var _0x2528b5={},_0x589f98={},_0x1b91ff={'count':0x0,'rows':[]};var _0x343668=_['map'](db['Variable']['rawAttributes'],function(_0x1b0fe5){return{'name':_0x1b0fe5[_0x5c81('0x2f')],'type':_0x1b0fe5[_0x5c81('0x30')][_0x5c81('0x31')]};});_0x589f98[_0x5c81('0x32')]=_[_0x5c81('0x33')](_0x343668,_0x5c81('0x2c'));_0x589f98[_0x5c81('0x34')]=_['keys'](_0x22eb74[_0x5c81('0x34')]);_0x589f98[_0x5c81('0x35')]=_[_0x5c81('0x36')](_0x589f98['model'],_0x589f98[_0x5c81('0x34')]);_0x2528b5[_0x5c81('0x37')]=_[_0x5c81('0x36')](_0x589f98[_0x5c81('0x32')],qs[_0x5c81('0x38')](_0x22eb74[_0x5c81('0x34')]['fields']));_0x2528b5[_0x5c81('0x37')]=_0x2528b5[_0x5c81('0x37')][_0x5c81('0x39')]?_0x2528b5['attributes']:_0x589f98[_0x5c81('0x32')];if(!_0x22eb74[_0x5c81('0x34')]['hasOwnProperty']('nolimit')){_0x2528b5[_0x5c81('0x1f')]=qs['limit'](_0x22eb74[_0x5c81('0x34')][_0x5c81('0x1f')]);_0x2528b5[_0x5c81('0x3a')]=qs[_0x5c81('0x3a')](_0x22eb74['query']['offset']);}_0x2528b5[_0x5c81('0x3b')]=qs[_0x5c81('0x3c')](_0x22eb74[_0x5c81('0x34')]['sort']);_0x2528b5[_0x5c81('0x3d')]=qs[_0x5c81('0x35')](_['pick'](_0x22eb74[_0x5c81('0x34')],_0x589f98[_0x5c81('0x35')]),_0x343668);if(_0x22eb74[_0x5c81('0x34')]['filter']){_0x2528b5[_0x5c81('0x3d')]=_[_0x5c81('0x3e')](_0x2528b5[_0x5c81('0x3d')],{'$or':_[_0x5c81('0x33')](_0x343668,function(_0x3fc584){if(_0x3fc584['type']!==_0x5c81('0x3f')){var _0x5b7bda={};_0x5b7bda[_0x3fc584[_0x5c81('0x2c')]]={'$like':'%'+_0x22eb74[_0x5c81('0x34')][_0x5c81('0x40')]+'%'};return _0x5b7bda;}})});}_0x2528b5=_['merge']({},_0x2528b5,_0x22eb74[_0x5c81('0x41')]);var _0x1e455c={'where':_0x2528b5[_0x5c81('0x3d')]};return db[_0x5c81('0x42')][_0x5c81('0x43')](_0x1e455c)[_0x5c81('0x25')](function(_0xe1802e){_0x1b91ff[_0x5c81('0x43')]=_0xe1802e;if(_0x22eb74['query'][_0x5c81('0x44')]){_0x2528b5['include']=[{'all':!![]}];}return db['Variable'][_0x5c81('0x45')](_0x2528b5);})[_0x5c81('0x25')](function(_0x1d5cd3){_0x1b91ff[_0x5c81('0x46')]=_0x1d5cd3;return _0x1b91ff;})[_0x5c81('0x25')](respondWithFilteredResult(_0x23ed7e,_0x2528b5))[_0x5c81('0x47')](handleError(_0x23ed7e,null));};exports[_0x5c81('0x48')]=function(_0x511374,_0x429e1f){var _0xc1b323={'raw':!![],'where':{'id':_0x511374[_0x5c81('0x49')]['id']}},_0x4c2e49={};_0x4c2e49[_0x5c81('0x32')]=_[_0x5c81('0x4a')](db[_0x5c81('0x42')][_0x5c81('0x4b')]);_0x4c2e49[_0x5c81('0x34')]=_[_0x5c81('0x4a')](_0x511374[_0x5c81('0x34')]);_0x4c2e49[_0x5c81('0x35')]=_['intersection'](_0x4c2e49[_0x5c81('0x32')],_0x4c2e49[_0x5c81('0x34')]);_0xc1b323[_0x5c81('0x37')]=_[_0x5c81('0x36')](_0x4c2e49['model'],qs[_0x5c81('0x38')](_0x511374[_0x5c81('0x34')][_0x5c81('0x38')]));_0xc1b323[_0x5c81('0x37')]=_0xc1b323['attributes']['length']?_0xc1b323['attributes']:_0x4c2e49[_0x5c81('0x32')];if(_0x511374[_0x5c81('0x34')][_0x5c81('0x44')]){_0xc1b323[_0x5c81('0x4c')]=[{'all':!![]}];}_0xc1b323=_[_0x5c81('0x3e')]({},_0xc1b323,_0x511374[_0x5c81('0x41')]);return db[_0x5c81('0x42')][_0x5c81('0x4d')](_0xc1b323)[_0x5c81('0x25')](handleEntityNotFound(_0x429e1f,null))[_0x5c81('0x25')](respondWithResult(_0x429e1f,null))['catch'](handleError(_0x429e1f,null));};exports['create']=function(_0x27140c,_0x4bbfe2){return db['Variable'][_0x5c81('0x4e')](_0x27140c[_0x5c81('0x4f')],{})['then'](function(_0x38fac3){var _0x46f9e0=_0x27140c[_0x5c81('0x50')][_0x5c81('0x27')]({'plain':!![]});if(!_0x46f9e0)throw new Error(_0x5c81('0x51'));if(_0x46f9e0['role']===_0x5c81('0x50')){var _0x1dce65=_0x38fac3['get']({'plain':!![]});var _0x143bff=_0x5c81('0x28');return db[_0x5c81('0x52')]['find']({'where':{'name':_0x143bff,'userProfileId':_0x46f9e0[_0x5c81('0x53')]},'raw':!![]})[_0x5c81('0x25')](function(_0x42269f){if(_0x42269f&&_0x42269f['autoAssociation']===0x0){return db['UserProfileResource'][_0x5c81('0x4e')]({'name':_0x1dce65[_0x5c81('0x2c')],'resourceId':_0x1dce65['id'],'type':_0x42269f[_0x5c81('0x2c')],'sectionId':_0x42269f['id']},{})[_0x5c81('0x25')](function(){return _0x38fac3;});}else{return _0x38fac3;}})['catch'](function(_0x420c45){logger['error'](_0x5c81('0x54'),_0x420c45);throw _0x420c45;});}return _0x38fac3;})[_0x5c81('0x25')](respondWithResult(_0x4bbfe2,0xc9))[_0x5c81('0x47')](handleError(_0x4bbfe2,null));};exports[_0x5c81('0x24')]=function(_0x1c1d18,_0x1644de){if(_0x1c1d18[_0x5c81('0x4f')]['id']){delete _0x1c1d18['body']['id'];}return db[_0x5c81('0x42')]['find']({'where':{'id':_0x1c1d18[_0x5c81('0x49')]['id']}})[_0x5c81('0x25')](handleEntityNotFound(_0x1644de,null))[_0x5c81('0x25')](saveUpdates(_0x1c1d18['body'],null))[_0x5c81('0x25')](respondWithResult(_0x1644de,null))[_0x5c81('0x47')](handleError(_0x1644de,null));};exports[_0x5c81('0x26')]=function(_0x49b430,_0x6ea24e){return db['Variable'][_0x5c81('0x4d')]({'where':{'id':_0x49b430[_0x5c81('0x49')]['id']}})[_0x5c81('0x25')](handleEntityNotFound(_0x6ea24e,null))[_0x5c81('0x25')](removeEntity(_0x6ea24e,null))['catch'](handleError(_0x6ea24e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 89809ec..a1928f6 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 _0x7854=['path','./variable.attributes','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x258c2d,_0x228ca5){var _0x58087f=function(_0xadfd4d){while(--_0xadfd4d){_0x258c2d['push'](_0x258c2d['shift']());}};_0x58087f(++_0x228ca5);}(_0x7854,0xcb));var _0x4785=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x7854[_0x879e31];return _0x3467e8;};'use strict';var _=require(_0x4785('0x0'));var util=require(_0x4785('0x1'));var logger=require(_0x4785('0x2'))(_0x4785('0x3'));var moment=require(_0x4785('0x4'));var BPromise=require('bluebird');var rp=require(_0x4785('0x5'));var fs=require('fs');var path=require(_0x4785('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4785('0x7'));module['exports']=function(_0xcc1bdd,_0x579233){return _0xcc1bdd[_0x4785('0x8')](_0x4785('0x9'),attributes,{'tableName':_0x4785('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6be6=['Variable','tools_variables','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6be6,0x1a6));var _0x66be=function(_0x2925b3,_0x56b8fc){_0x2925b3=_0x2925b3-0x0;var _0x2d71c9=_0x6be6[_0x2925b3];return _0x2d71c9;};'use strict';var _=require('lodash');var util=require(_0x66be('0x0'));var logger=require(_0x66be('0x1'))(_0x66be('0x2'));var moment=require(_0x66be('0x3'));var BPromise=require('bluebird');var rp=require(_0x66be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66be('0x5'));var config=require(_0x66be('0x6'));var attributes=require(_0x66be('0x7'));module[_0x66be('0x8')]=function(_0x5b6bd4,_0x3fa576){return _0x5b6bd4[_0x66be('0x9')](_0x66be('0xa'),attributes,{'tableName':_0x66be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index bd01459..4da1aa2 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 _0xfa09=['where','attributes','map','model','include','then','ShowVariable','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Variable,\x20%s,\x20%s','message','info','Variable','find','raw','options'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xfa09,0x15d));var _0x9fa0=function(_0x3c9ebe,_0x141a21){_0x3c9ebe=_0x3c9ebe-0x0;var _0x3d0499=_0xfa09[_0x3c9ebe];return _0x3d0499;};'use strict';var _=require(_0x9fa0('0x0'));var util=require(_0x9fa0('0x1'));var moment=require('moment');var BPromise=require(_0x9fa0('0x2'));var rs=require(_0x9fa0('0x3'));var fs=require('fs');var Redis=require(_0x9fa0('0x4'));var db=require(_0x9fa0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fa0('0x6'))('rpc');var config=require(_0x9fa0('0x7'));var jayson=require(_0x9fa0('0x8'));var client=jayson['client'][_0x9fa0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a4da,_0x240d59,_0x595bd3){return new BPromise(function(_0x1c0e8a,_0x43c401){return client['request'](_0x57a4da,_0x595bd3)['then'](function(_0x37d635){logger['info']('Variable,\x20%s,\x20%s',_0x240d59,'request\x20sent');logger[_0x9fa0('0xa')](_0x9fa0('0xb'),_0x240d59,_0x9fa0('0xc'),JSON[_0x9fa0('0xd')](_0x37d635));if(_0x37d635['error']){if(_0x37d635[_0x9fa0('0xe')][_0x9fa0('0xf')]===0x1f4){logger[_0x9fa0('0xe')](_0x9fa0('0x10'),_0x240d59,_0x37d635[_0x9fa0('0xe')][_0x9fa0('0x11')]);return _0x43c401(_0x37d635[_0x9fa0('0xe')]['message']);}logger[_0x9fa0('0xe')](_0x9fa0('0x10'),_0x240d59,_0x37d635[_0x9fa0('0xe')][_0x9fa0('0x11')]);return _0x1c0e8a(_0x37d635[_0x9fa0('0xe')][_0x9fa0('0x11')]);}else{logger[_0x9fa0('0x12')](_0x9fa0('0x10'),_0x240d59,_0x9fa0('0xc'));_0x1c0e8a(_0x37d635['result'][_0x9fa0('0x11')]);}})['catch'](function(_0x3d8238){logger['error'](_0x9fa0('0x10'),_0x240d59,_0x3d8238);_0x43c401(_0x3d8238);});});}exports['ShowVariable']=function(_0x1b177a){var _0x469296=this;return new Promise(function(_0x3ef7ff,_0x3e9507){return db[_0x9fa0('0x13')][_0x9fa0('0x14')]({'raw':_0x1b177a['options']?_0x1b177a['options'][_0x9fa0('0x15')]===undefined?!![]:![]:!![],'where':_0x1b177a[_0x9fa0('0x16')]?_0x1b177a[_0x9fa0('0x16')][_0x9fa0('0x17')]||null:null,'attributes':_0x1b177a[_0x9fa0('0x16')]?_0x1b177a[_0x9fa0('0x16')][_0x9fa0('0x18')]||null:null,'include':_0x1b177a[_0x9fa0('0x16')]?_0x1b177a[_0x9fa0('0x16')]['include']?_[_0x9fa0('0x19')](_0x1b177a[_0x9fa0('0x16')]['include'],function(_0x4f498c){return{'model':db[_0x4f498c[_0x9fa0('0x1a')]],'as':_0x4f498c['as'],'attributes':_0x4f498c[_0x9fa0('0x18')],'include':_0x4f498c['include']?_[_0x9fa0('0x19')](_0x4f498c[_0x9fa0('0x1b')],function(_0x3c00e7){return{'model':db[_0x3c00e7[_0x9fa0('0x1a')]],'as':_0x3c00e7['as'],'attributes':_0x3c00e7['attributes'],'include':_0x3c00e7[_0x9fa0('0x1b')]?_[_0x9fa0('0x19')](_0x3c00e7[_0x9fa0('0x1b')],function(_0x5d94b5){return{'model':db[_0x5d94b5[_0x9fa0('0x1a')]],'as':_0x5d94b5['as'],'attributes':_0x5d94b5[_0x9fa0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9fa0('0x1c')](function(_0x277154){logger[_0x9fa0('0x12')](_0x9fa0('0x1d'),_0x1b177a);logger['debug'](_0x9fa0('0x1d'),_0x1b177a,JSON[_0x9fa0('0xd')](_0x277154));_0x3ef7ff(_0x277154);})[_0x9fa0('0x1e')](function(_0x1efce7){logger['error']('ShowVariable',_0x1efce7[_0x9fa0('0x11')],_0x1b177a);_0x3e9507(_0x469296['error'](0x1f4,_0x1efce7[_0x9fa0('0x11')]));});});}; \ No newline at end of file +var _0xbc35=['options','raw','where','map','attributes','include','ShowVariable','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','Variable'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0xbc35,0xd9));var _0x5bc3=function(_0x2c9dad,_0x51ed87){_0x2c9dad=_0x2c9dad-0x0;var _0x572a16=_0xbc35[_0x2c9dad];return _0x572a16;};'use strict';var _=require(_0x5bc3('0x0'));var util=require('util');var moment=require(_0x5bc3('0x1'));var BPromise=require('bluebird');var rs=require(_0x5bc3('0x2'));var fs=require('fs');var Redis=require(_0x5bc3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5bc3('0x4'))(_0x5bc3('0x5'));var config=require(_0x5bc3('0x6'));var jayson=require(_0x5bc3('0x7'));var client=jayson['client'][_0x5bc3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x410c91,_0x5bb70a,_0x25b234){return new BPromise(function(_0x4c0536,_0x39a3b2){return client[_0x5bc3('0x9')](_0x410c91,_0x25b234)[_0x5bc3('0xa')](function(_0x12152b){logger[_0x5bc3('0xb')]('Variable,\x20%s,\x20%s',_0x5bb70a,_0x5bc3('0xc'));logger[_0x5bc3('0xd')](_0x5bc3('0xe'),_0x5bb70a,_0x5bc3('0xc'),JSON[_0x5bc3('0xf')](_0x12152b));if(_0x12152b[_0x5bc3('0x10')]){if(_0x12152b['error'][_0x5bc3('0x11')]===0x1f4){logger[_0x5bc3('0x10')]('Variable,\x20%s,\x20%s',_0x5bb70a,_0x12152b['error'][_0x5bc3('0x12')]);return _0x39a3b2(_0x12152b[_0x5bc3('0x10')]['message']);}logger[_0x5bc3('0x10')](_0x5bc3('0x13'),_0x5bb70a,_0x12152b['error']['message']);return _0x4c0536(_0x12152b[_0x5bc3('0x10')]['message']);}else{logger[_0x5bc3('0xb')](_0x5bc3('0x13'),_0x5bb70a,'request\x20sent');_0x4c0536(_0x12152b[_0x5bc3('0x14')][_0x5bc3('0x12')]);}})[_0x5bc3('0x15')](function(_0x2ee45d){logger[_0x5bc3('0x10')](_0x5bc3('0x13'),_0x5bb70a,_0x2ee45d);_0x39a3b2(_0x2ee45d);});});}exports['ShowVariable']=function(_0x107c56){var _0x299d80=this;return new Promise(function(_0x2236c6,_0x427416){return db[_0x5bc3('0x16')]['find']({'raw':_0x107c56[_0x5bc3('0x17')]?_0x107c56[_0x5bc3('0x17')][_0x5bc3('0x18')]===undefined?!![]:![]:!![],'where':_0x107c56[_0x5bc3('0x17')]?_0x107c56[_0x5bc3('0x17')][_0x5bc3('0x19')]||null:null,'attributes':_0x107c56[_0x5bc3('0x17')]?_0x107c56['options']['attributes']||null:null,'include':_0x107c56[_0x5bc3('0x17')]?_0x107c56[_0x5bc3('0x17')]['include']?_[_0x5bc3('0x1a')](_0x107c56[_0x5bc3('0x17')]['include'],function(_0x4d2b99){return{'model':db[_0x4d2b99['model']],'as':_0x4d2b99['as'],'attributes':_0x4d2b99[_0x5bc3('0x1b')],'include':_0x4d2b99[_0x5bc3('0x1c')]?_[_0x5bc3('0x1a')](_0x4d2b99['include'],function(_0x1d776e){return{'model':db[_0x1d776e['model']],'as':_0x1d776e['as'],'attributes':_0x1d776e[_0x5bc3('0x1b')],'include':_0x1d776e[_0x5bc3('0x1c')]?_[_0x5bc3('0x1a')](_0x1d776e[_0x5bc3('0x1c')],function(_0x4a4d8a){return{'model':db[_0x4a4d8a['model']],'as':_0x4a4d8a['as'],'attributes':_0x4a4d8a[_0x5bc3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18adbc){logger[_0x5bc3('0xb')](_0x5bc3('0x1d'),_0x107c56);logger[_0x5bc3('0xd')]('ShowVariable',_0x107c56,JSON[_0x5bc3('0xf')](_0x18adbc));_0x2236c6(_0x18adbc);})[_0x5bc3('0x15')](function(_0x4b4016){logger[_0x5bc3('0x10')](_0x5bc3('0x1d'),_0x4b4016[_0x5bc3('0x12')],_0x107c56);_0x427416(_0x299d80['error'](0x1f4,_0x4b4016[_0x5bc3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b6c2789..179e494 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 _0xc7bf=['fetch','/reset','reset','pull','/restart','restart','/migrations','migrations','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0xc7bf,0x1e8));var _0xfc7b=function(_0x16302f,_0x54f178){_0x16302f=_0x16302f-0x0;var _0x47636b=_0xc7bf[_0x16302f];return _0x47636b;};'use strict';var express=require(_0xfc7b('0x0'));var router=express['Router']();var auth=require(_0xfc7b('0x1'));var controller=require(_0xfc7b('0x2'));router[_0xfc7b('0x3')]('/',controller[_0xfc7b('0x4')]);router[_0xfc7b('0x3')](_0xfc7b('0x5'),auth[_0xfc7b('0x6')](),auth[_0xfc7b('0x7')](),controller[_0xfc7b('0x8')]);router[_0xfc7b('0x3')](_0xfc7b('0x9'),auth[_0xfc7b('0x6')](),auth['canUpdate'](),controller[_0xfc7b('0xa')]);router['get']('/pull',auth['isAuthenticated'](),auth[_0xfc7b('0x7')](),controller[_0xfc7b('0xb')]);router[_0xfc7b('0x3')](_0xfc7b('0xc'),auth[_0xfc7b('0x6')](),controller[_0xfc7b('0xd')]);router['get'](_0xfc7b('0xe'),controller[_0xfc7b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2dfd=['/restart','migrations','exports','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull'];(function(_0x3a0c83,_0x36d1e8){var _0x3c5d1f=function(_0x1c9d17){while(--_0x1c9d17){_0x3a0c83['push'](_0x3a0c83['shift']());}};_0x3c5d1f(++_0x36d1e8);}(_0x2dfd,0x12f));var _0xd2df=function(_0x25605f,_0x1d19b0){_0x25605f=_0x25605f-0x0;var _0xc74459=_0x2dfd[_0x25605f];return _0xc74459;};'use strict';var express=require(_0xd2df('0x0'));var router=express[_0xd2df('0x1')]();var auth=require(_0xd2df('0x2'));var controller=require('./version.controller');router[_0xd2df('0x3')]('/',controller[_0xd2df('0x4')]);router[_0xd2df('0x3')](_0xd2df('0x5'),auth[_0xd2df('0x6')](),auth[_0xd2df('0x7')](),controller[_0xd2df('0x8')]);router[_0xd2df('0x3')](_0xd2df('0x9'),auth['isAuthenticated'](),auth[_0xd2df('0x7')](),controller['reset']);router[_0xd2df('0x3')](_0xd2df('0xa'),auth[_0xd2df('0x6')](),auth[_0xd2df('0x7')](),controller[_0xd2df('0xb')]);router[_0xd2df('0x3')](_0xd2df('0xc'),auth[_0xd2df('0x6')](),controller['restart']);router[_0xd2df('0x3')]('/migrations',controller[_0xd2df('0xd')]);module[_0xd2df('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c078e29..14a6df7 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 _0xee55=['getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','latest','fetch','tags','exports','json','status','origin','master','error','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','.js','sort','Migration','sequelize'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xee55,0x1a0));var _0x5ee5=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xee55[_0x4d8a8f];return _0xfc4adc;};'use strict';var Umzug=require(_0x5ee5('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x5ee5('0x1'));var pkginfo=require('pkginfo')(module,_0x5ee5('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x5ee5('0x3'))[_0x5ee5('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0x5ee5('0x5'));var pm2=require(_0x5ee5('0x6'));var logger=require(_0x5ee5('0x7'))(_0x5ee5('0x8'));var git=require(_0x5ee5('0x9'))(config[_0x5ee5('0xa')]);exports[_0x5ee5('0xb')]=function(_0x5e0eb2,_0x168427){var _0x54092b={'current':module['exports'][_0x5ee5('0x2')],'phonebar':0x2};if(_0x5e0eb2['query']&&_0x5e0eb2['query'][_0x5ee5('0xc')]){return git[_0x5ee5('0xd')]()[_0x5ee5('0xe')](function(_0xf0d40c,_0x4ab831){_0x54092b[_0x5ee5('0xc')]=(_0xf0d40c?module[_0x5ee5('0xf')][_0x5ee5('0x2')]:_0x4ab831[_0x5ee5('0xc')])||'2.0.0';return _0x168427['status'](0xc8)[_0x5ee5('0x10')](_0x54092b);});}else{return _0x168427[_0x5ee5('0x11')](0xc8)[_0x5ee5('0x10')](_0x54092b);}};exports['fetch']=function(_0x13dabc,_0x2cbfab){return git[_0x5ee5('0xd')]([_0x5ee5('0x12'),_0x5ee5('0x13')],function(_0x3b3c1c){if(_0x3b3c1c){logger[_0x5ee5('0x14')](_0x3b3c1c);return _0x2cbfab['status'](0x1f4)[_0x5ee5('0x10')](_0x3b3c1c);}logger[_0x5ee5('0x15')](_0x5ee5('0x16'));return _0x2cbfab[_0x5ee5('0x11')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x5ee5('0x17')]=function(_0x140070,_0x173043){return git['reset']([_0x5ee5('0x18'),'FETCH_HEAD'],function(_0x458eb0){if(_0x458eb0){logger['error'](_0x458eb0);return _0x173043[_0x5ee5('0x11')](0x1f4)[_0x5ee5('0x10')](_0x458eb0);}logger[_0x5ee5('0x15')](_0x5ee5('0x19'));return _0x173043[_0x5ee5('0x11')](0xc8)[_0x5ee5('0x10')]({'output':_0x5ee5('0x1a')});});};exports[_0x5ee5('0x1b')]=function(_0x45e278,_0x1c5ff6){exec(_0x5ee5('0x1c'),function(_0x72a60d,_0x3a15e2,_0xb133d4){logger[_0x5ee5('0x15')](_0x3a15e2);logger[_0x5ee5('0x15')](_0xb133d4);if(_0x72a60d){logger[_0x5ee5('0x14')](_0x72a60d);return _0x1c5ff6[_0x5ee5('0x11')](0x1f4)[_0x5ee5('0x10')](_0x72a60d);}return _0x1c5ff6[_0x5ee5('0x11')](0xc8)['json']({'output':_0x3a15e2});});};exports['restart']=function(_0x1150c4,_0x22b61f){return pm2[_0x5ee5('0x1d')]('motion2')[_0x5ee5('0x1e')](function(_0x4e52f3){logger[_0x5ee5('0x15')](_0x5ee5('0x1f'),_0x4e52f3);return _0x22b61f[_0x5ee5('0x11')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x5ee5('0x20')](function(_0x3a236c){logger[_0x5ee5('0x14')](_0x3a236c);return _0x22b61f[_0x5ee5('0x11')](0x1f4)[_0x5ee5('0x10')](_0x3a236c);});};exports[_0x5ee5('0x21')]=function(_0x334295,_0x483c28){var _0x3d78a8=fs[_0x5ee5('0x22')](path[_0x5ee5('0x23')](config['root'],_0x5ee5('0x24'),_0x5ee5('0x21')));var _0x2542da=[];for(var _0x33b159=0x0;_0x33b159<_0x3d78a8[_0x5ee5('0x25')];_0x33b159++){var _0x79b5d1=_0x3d78a8[_0x33b159][_0x5ee5('0x26')](_0x5ee5('0x27'),'');if(compareVersions(module['exports'][_0x5ee5('0x2')],_0x79b5d1)===-0x1){_0x2542da['push'](_0x79b5d1);}}if(_0x2542da[_0x5ee5('0x25')]){var _0x59fa09=_0x2542da[_0x5ee5('0x28')](compareVersions);var _0x2188ef=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x5ee5('0x29'),'columnName':_0x5ee5('0x2')},'migrations':{'params':[db[_0x5ee5('0x2a')][_0x5ee5('0x2b')](),db['sequelize'][_0x5ee5('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x5ee5('0x23')](config['root'],_0x5ee5('0x24'),'migrations'),'pattern':/\.js$/}});_0x2188ef['up']({'migrations':_[_0x5ee5('0x2d')](_0x59fa09,function(_0x4ed64d){return _0x4ed64d+_0x5ee5('0x27');})})[_0x5ee5('0x1e')](function(){return _0x483c28[_0x5ee5('0x11')](0xc8)[_0x5ee5('0x10')]({'output':_0x5ee5('0x2e')+module['exports'][_0x5ee5('0x2')]+_0x5ee5('0x2f')+_[_0x5ee5('0x30')](_0x59fa09),'migrations':_[_0x5ee5('0x23')](_0x59fa09)});})['catch'](function(_0xa56d9){if(_0xa56d9 instanceof db['sequelize'][_0x5ee5('0x31')]){return _0x483c28[_0x5ee5('0x11')](0xc8)['json']({'output':_0x5ee5('0x32')});}else{return _0x483c28['status'](0x1f4)[_0x5ee5('0x10')](_0xa56d9);}});}else{return _0x483c28[_0x5ee5('0x11')](0xc8)[_0x5ee5('0x10')]({'output':_0x5ee5('0x32')});}}; \ No newline at end of file +var _0x09d2=['git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','push','length','sequelize','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','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','master','info','git\x20fetch\x20origin\x20master','reset','--hard','error'];(function(_0x39cb13,_0xf7308){var _0x154715=function(_0x184a17){while(--_0x184a17){_0x39cb13['push'](_0x39cb13['shift']());}};_0x154715(++_0xf7308);}(_0x09d2,0x1d2));var _0x209d=function(_0x15afe3,_0x46789c){_0x15afe3=_0x15afe3-0x0;var _0x3088db=_0x09d2[_0x15afe3];return _0x3088db;};'use strict';var Umzug=require(_0x209d('0x0'));var path=require(_0x209d('0x1'));var fs=require('fs');var _=require(_0x209d('0x2'));var pkginfo=require(_0x209d('0x3'))(module,_0x209d('0x4'));var compareVersions=require(_0x209d('0x5'));var exec=require(_0x209d('0x6'))[_0x209d('0x7')];var db=require(_0x209d('0x8'))['db'];var config=require(_0x209d('0x9'));var pm2=require('../../config/pm2');var logger=require(_0x209d('0xa'))(_0x209d('0xb'));var git=require(_0x209d('0xc'))(config[_0x209d('0xd')]);exports[_0x209d('0xe')]=function(_0x5b460d,_0x49cd7a){var _0x306753={'current':module[_0x209d('0xf')][_0x209d('0x4')],'phonebar':0x2};if(_0x5b460d['query']&&_0x5b460d[_0x209d('0x10')]['latest']){return git[_0x209d('0x11')]()[_0x209d('0x12')](function(_0x3ee1eb,_0x35f411){_0x306753[_0x209d('0x13')]=(_0x3ee1eb?module[_0x209d('0xf')][_0x209d('0x4')]:_0x35f411[_0x209d('0x13')])||_0x209d('0x14');return _0x49cd7a[_0x209d('0x15')](0xc8)[_0x209d('0x16')](_0x306753);});}else{return _0x49cd7a[_0x209d('0x15')](0xc8)['json'](_0x306753);}};exports[_0x209d('0x11')]=function(_0x10b2ce,_0x1d6484){return git['fetch'](['origin',_0x209d('0x17')],function(_0x5267d3){if(_0x5267d3){logger['error'](_0x5267d3);return _0x1d6484[_0x209d('0x15')](0x1f4)[_0x209d('0x16')](_0x5267d3);}logger[_0x209d('0x18')]('git\x20fetch');return _0x1d6484[_0x209d('0x15')](0xc8)[_0x209d('0x16')]({'output':_0x209d('0x19')});});};exports[_0x209d('0x1a')]=function(_0x59d750,_0x2cdf73){return git[_0x209d('0x1a')]([_0x209d('0x1b'),'FETCH_HEAD'],function(_0x47daf8){if(_0x47daf8){logger[_0x209d('0x1c')](_0x47daf8);return _0x2cdf73['status'](0x1f4)[_0x209d('0x16')](_0x47daf8);}logger[_0x209d('0x18')](_0x209d('0x1d'));return _0x2cdf73[_0x209d('0x15')](0xc8)[_0x209d('0x16')]({'output':_0x209d('0x1e')});});};exports[_0x209d('0x1f')]=function(_0x1a1226,_0x178584){exec(_0x209d('0x20'),function(_0x35ae52,_0x30fe74,_0x61a720){logger[_0x209d('0x18')](_0x30fe74);logger[_0x209d('0x18')](_0x61a720);if(_0x35ae52){logger[_0x209d('0x1c')](_0x35ae52);return _0x178584[_0x209d('0x15')](0x1f4)[_0x209d('0x16')](_0x35ae52);}return _0x178584[_0x209d('0x15')](0xc8)[_0x209d('0x16')]({'output':_0x30fe74});});};exports[_0x209d('0x21')]=function(_0x4d1579,_0x67382e){return pm2[_0x209d('0x21')]('motion2')[_0x209d('0x22')](function(_0x561ad6){logger[_0x209d('0x18')](_0x209d('0x23'),_0x561ad6);return _0x67382e[_0x209d('0x15')](0xc8)[_0x209d('0x16')]({'output':_0x209d('0x24')});})[_0x209d('0x25')](function(_0x5399e3){logger[_0x209d('0x1c')](_0x5399e3);return _0x67382e[_0x209d('0x15')](0x1f4)['json'](_0x5399e3);});};exports[_0x209d('0x26')]=function(_0x14dc18,_0x21899a){var _0x28750e=fs[_0x209d('0x27')](path[_0x209d('0x28')](config['root'],'server',_0x209d('0x26')));var _0x57d9ad=[];for(var _0x3a69da=0x0;_0x3a69da<_0x28750e['length'];_0x3a69da++){var _0x1fbdba=_0x28750e[_0x3a69da][_0x209d('0x29')]('.js','');if(compareVersions(module['exports'][_0x209d('0x4')],_0x1fbdba)===-0x1){_0x57d9ad[_0x209d('0x2a')](_0x1fbdba);}}if(_0x57d9ad[_0x209d('0x2b')]){var _0x19c3fc=_0x57d9ad['sort'](compareVersions);var _0x182525=new Umzug({'storage':_0x209d('0x2c'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x209d('0x4')},'migrations':{'params':[db['sequelize'][_0x209d('0x2d')](),db[_0x209d('0x2c')][_0x209d('0x2e')],function(){throw new Error(_0x209d('0x2f'));}],'path':path[_0x209d('0x28')](config[_0x209d('0xd')],_0x209d('0x30'),'migrations'),'pattern':/\.js$/}});_0x182525['up']({'migrations':_[_0x209d('0x31')](_0x19c3fc,function(_0x115b8d){return _0x115b8d+_0x209d('0x32');})})[_0x209d('0x22')](function(){return _0x21899a[_0x209d('0x15')](0xc8)[_0x209d('0x16')]({'output':_0x209d('0x33')+module[_0x209d('0xf')][_0x209d('0x4')]+_0x209d('0x34')+_[_0x209d('0x35')](_0x19c3fc),'migrations':_[_0x209d('0x28')](_0x19c3fc)});})[_0x209d('0x25')](function(_0x56d736){if(_0x56d736 instanceof db[_0x209d('0x2c')]['UniqueConstraintError']){return _0x21899a[_0x209d('0x15')](0xc8)[_0x209d('0x16')]({'output':_0x209d('0x36')});}else{return _0x21899a['status'](0x1f4)['json'](_0x56d736);}});}else{return _0x21899a[_0x209d('0x15')](0xc8)[_0x209d('0x16')]({'output':_0x209d('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3a070a2..4856850 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 _0x9339=['describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x9339,0x1ed));var _0x9933=function(_0x1c5f32,_0x1ac260){_0x1c5f32=_0x1c5f32-0x0;var _0x3bd1e8=_0x9339[_0x1c5f32];return _0x3bd1e8;};'use strict';var multer=require(_0x9933('0x0'));var util=require('util');var path=require(_0x9933('0x1'));var timeout=require(_0x9933('0x2'));var express=require(_0x9933('0x3'));var router=express[_0x9933('0x4')]();var auth=require(_0x9933('0x5'));var interaction=require(_0x9933('0x6'));var config=require(_0x9933('0x7'));var controller=require(_0x9933('0x8'));router['get']('/',auth[_0x9933('0x9')](),controller[_0x9933('0xa')]);router[_0x9933('0xb')](_0x9933('0xc'),auth['isAuthenticated'](),controller[_0x9933('0xd')]);router[_0x9933('0xb')](_0x9933('0xe'),auth[_0x9933('0x9')](),controller[_0x9933('0xf')]);router[_0x9933('0x10')]('/',auth[_0x9933('0x9')](),controller[_0x9933('0x11')]);router[_0x9933('0x12')](_0x9933('0xe'),auth[_0x9933('0x9')](),controller[_0x9933('0x13')]);router[_0x9933('0x14')]('/:id',auth[_0x9933('0x9')](),controller['destroy']);module[_0x9933('0x15')]=router; \ No newline at end of file +var _0xd551=['isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe'];(function(_0x1d5bbe,_0x2026b0){var _0x25cae1=function(_0xa9a2c4){while(--_0xa9a2c4){_0x1d5bbe['push'](_0x1d5bbe['shift']());}};_0x25cae1(++_0x2026b0);}(_0xd551,0x122));var _0x1d55=function(_0x48808f,_0x204731){_0x48808f=_0x48808f-0x0;var _0x148654=_0xd551[_0x48808f];return _0x148654;};'use strict';var multer=require(_0x1d55('0x0'));var util=require(_0x1d55('0x1'));var path=require('path');var timeout=require(_0x1d55('0x2'));var express=require(_0x1d55('0x3'));var router=express['Router']();var auth=require(_0x1d55('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1d55('0x5'));var controller=require(_0x1d55('0x6'));router[_0x1d55('0x7')]('/',auth['isAuthenticated'](),controller[_0x1d55('0x8')]);router[_0x1d55('0x7')](_0x1d55('0x9'),auth[_0x1d55('0xa')](),controller[_0x1d55('0xb')]);router[_0x1d55('0x7')](_0x1d55('0xc'),auth[_0x1d55('0xa')](),controller[_0x1d55('0xd')]);router[_0x1d55('0xe')]('/',auth[_0x1d55('0xa')](),controller[_0x1d55('0xf')]);router[_0x1d55('0x10')]('/:id',auth[_0x1d55('0xa')](),controller[_0x1d55('0x11')]);router['delete'](_0x1d55('0xc'),auth[_0x1d55('0xa')](),controller[_0x1d55('0x12')]);module[_0x1d55('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1f1c856..bab2e0b 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 _0xd8fb=['DATE','BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x3e2810,_0x104d34){var _0x577d18=function(_0xbf28){while(--_0xbf28){_0x3e2810['push'](_0x3e2810['shift']());}};_0x577d18(++_0x104d34);}(_0xd8fb,0x99));var _0xbd8f=function(_0x17aaef,_0x3dbcbd){_0x17aaef=_0x17aaef-0x0;var _0x3202c2=_0xd8fb[_0x17aaef];return _0x3202c2;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'type':{'type':Sequelize[_0xbd8f('0x2')]},'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbd8f('0x2')]},'membername':{'type':Sequelize[_0xbd8f('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbd8f('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbd8f('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xbd8f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbd8f('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xbd8f('0x2')]},'lastevent':{'type':Sequelize[_0xbd8f('0x2')]},'channel':{'type':Sequelize[_0xbd8f('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbd8f('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'context':{'type':Sequelize[_0xbd8f('0x2')]},'exten':{'type':Sequelize[_0xbd8f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbd8f('0x2')]},'destchannelstate':{'type':Sequelize[_0xbd8f('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbd8f('0x2')]},'destcalleridname':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbd8f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbd8f('0x2')]},'destlanguage':{'type':Sequelize[_0xbd8f('0x2')]},'destaccountcode':{'type':Sequelize[_0xbd8f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbd8f('0x2')]},'destpriority':{'type':Sequelize[_0xbd8f('0x2')]},'destuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xbd8f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbd8f('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xbd8f('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc4aa=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x1be871,_0x19b9e9){var _0x440d08=function(_0x20f88b){while(--_0x20f88b){_0x1be871['push'](_0x1be871['shift']());}};_0x440d08(++_0x19b9e9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'type':{'type':Sequelize[_0xac4a('0x2')]},'uniqueid':{'type':Sequelize[_0xac4a('0x2')]},'calleridnum':{'type':Sequelize[_0xac4a('0x2')]},'calleridname':{'type':Sequelize[_0xac4a('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xac4a('0x3')]},'agentconnectAt':{'type':Sequelize[_0xac4a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xac4a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xac4a('0x3')]},'agentdumpAt':{'type':Sequelize[_0xac4a('0x3')]},'holdtime':{'type':Sequelize[_0xac4a('0x4')]},'agentcomplete':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xac4a('0x4')]},'reason':{'type':Sequelize[_0xac4a('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xac4a('0x2')]},'channelstate':{'type':Sequelize[_0xac4a('0x4')]},'channelstatedesc':{'type':Sequelize[_0xac4a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xac4a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xac4a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xac4a('0x2')]},'priority':{'type':Sequelize[_0xac4a('0x2')]},'destchannel':{'type':Sequelize[_0xac4a('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xac4a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xac4a('0x2')]},'destcalleridname':{'type':Sequelize[_0xac4a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xac4a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xac4a('0x2')]},'destlanguage':{'type':Sequelize[_0xac4a('0x2')]},'destaccountcode':{'type':Sequelize[_0xac4a('0x2')]},'destcontext':{'type':Sequelize[_0xac4a('0x2')]},'destexten':{'type':Sequelize[_0xac4a('0x2')]},'destpriority':{'type':Sequelize[_0xac4a('0x2')]},'destuniqueid':{'type':Sequelize[_0xac4a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xac4a('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xac4a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xac4a('0x2')],'comment':_0xac4a('0x6')},'transferexten':{'type':Sequelize[_0xac4a('0x2')]},'transferuniqueid':{'type':Sequelize[_0xac4a('0x2')]},'agententerreason':{'type':Sequelize[_0xac4a('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 bde4e30..82fa7af 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 _0x8df2=['ejs','lodash','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','name','index','map','VoiceAgentReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3259af,_0x595931){var _0x49eef1=function(_0x5a47b9){while(--_0x5a47b9){_0x3259af['push'](_0x3259af['shift']());}};_0x49eef1(++_0x595931);}(_0x8df2,0x15d));var _0x28df=function(_0x1a11d2,_0x38f612){_0x1a11d2=_0x1a11d2-0x0;var _0x20a098=_0x8df2[_0x1a11d2];return _0x20a098;};'use strict';var pdf=require(_0x28df('0x0'));var emlformat=require(_0x28df('0x1'));var rimraf=require(_0x28df('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28df('0x3'));var rp=require(_0x28df('0x4'));var moment=require(_0x28df('0x5'));var BPromise=require(_0x28df('0x6'));var Mustache=require(_0x28df('0x7'));var util=require(_0x28df('0x8'));var path=require(_0x28df('0x9'));var sox=require(_0x28df('0xa'));var csv=require('to-csv');var ejs=require(_0x28df('0xb'));var fs=require('fs');var _=require(_0x28df('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x28df('0xd'));var deskjs=require(_0x28df('0xe'));var toCsv=require(_0x28df('0xf'));var querystring=require('querystring');var Papa=require(_0x28df('0x10'));var Redis=require('ioredis');var authService=require(_0x28df('0x11'));var qs=require(_0x28df('0x12'));var as=require(_0x28df('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28df('0x14'))(_0x28df('0x15'));var utils=require(_0x28df('0x16'));var config=require(_0x28df('0x17'));var db=require(_0x28df('0x18'))['db'];function respondWithStatusCode(_0x180e61,_0x13f55a){_0x13f55a=_0x13f55a||0xcc;return function(_0x4b983a){if(_0x4b983a){return _0x180e61[_0x28df('0x19')](_0x13f55a);}return _0x180e61[_0x28df('0x1a')](_0x13f55a)[_0x28df('0x1b')]();};}function respondWithResult(_0x53b09a,_0x5a907e){_0x5a907e=_0x5a907e||0xc8;return function(_0x3d2d05){if(_0x3d2d05){return _0x53b09a[_0x28df('0x1a')](_0x5a907e)[_0x28df('0x1c')](_0x3d2d05);}};}function respondWithFilteredResult(_0x42930e,_0x42ab8f){return function(_0x4248c9){if(_0x4248c9){var _0x3b2661=_0x4248c9[_0x28df('0x1d')],_0x2665e3=_0x42ab8f[_0x28df('0x1e')],_0x15af88=_0x42ab8f['offset']+_0x42ab8f[_0x28df('0x1f')],_0x2e6498;if(_0x15af88>=_0x3b2661){_0x15af88=_0x3b2661;_0x2e6498=0xc8;}else{_0x2e6498=0xce;}_0x42930e['status'](_0x2e6498);return _0x42930e['set'](_0x28df('0x20'),_0x2665e3+'-'+_0x15af88+'/'+_0x3b2661)['json'](_0x4248c9);}return null;};}function patchUpdates(_0x268378){return function(_0x1bd15d){try{jsonpatch['apply'](_0x1bd15d,_0x268378,!![]);}catch(_0x4e216b){return BPromise[_0x28df('0x21')](_0x4e216b);}return _0x1bd15d['save']();};}function saveUpdates(_0x557674,_0x4c51bd){return function(_0x76e809){if(_0x76e809){return _0x76e809[_0x28df('0x22')](_0x557674)[_0x28df('0x23')](function(_0x5566a0){return _0x5566a0;});}return null;};}function removeEntity(_0x352670,_0x90794f){return function(_0x5222d2){if(_0x5222d2){return _0x5222d2[_0x28df('0x24')]()[_0x28df('0x23')](function(){_0x352670[_0x28df('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x447843,_0x28cc79){return function(_0x1b9102){if(!_0x1b9102){_0x447843[_0x28df('0x19')](0x194);}return _0x1b9102;};}function handleError(_0x4fc632,_0xba0e00){_0xba0e00=_0xba0e00||0x1f4;return function(_0x2a2a22){logger[_0x28df('0x25')](_0x2a2a22['stack']);if(_0x2a2a22[_0x28df('0x26')]){delete _0x2a2a22[_0x28df('0x26')];}_0x4fc632[_0x28df('0x1a')](_0xba0e00)['send'](_0x2a2a22);};}exports[_0x28df('0x27')]=function(_0x5336ca,_0x422b4d){var _0x7252af={},_0xe6c3fa={},_0x208374={'count':0x0,'rows':[]};var _0x5581a9=_[_0x28df('0x28')](db[_0x28df('0x29')]['rawAttributes'],function(_0x507b4e){return{'name':_0x507b4e[_0x28df('0x2a')],'type':_0x507b4e[_0x28df('0x2b')][_0x28df('0x2c')]};});_0xe6c3fa[_0x28df('0x2d')]=_[_0x28df('0x28')](_0x5581a9,_0x28df('0x26'));_0xe6c3fa[_0x28df('0x2e')]=_[_0x28df('0x2f')](_0x5336ca[_0x28df('0x2e')]);_0xe6c3fa[_0x28df('0x30')]=_[_0x28df('0x31')](_0xe6c3fa[_0x28df('0x2d')],_0xe6c3fa['query']);_0x7252af[_0x28df('0x32')]=_[_0x28df('0x31')](_0xe6c3fa[_0x28df('0x2d')],qs['fields'](_0x5336ca[_0x28df('0x2e')][_0x28df('0x33')]));_0x7252af[_0x28df('0x32')]=_0x7252af[_0x28df('0x32')]['length']?_0x7252af[_0x28df('0x32')]:_0xe6c3fa[_0x28df('0x2d')];if(!_0x5336ca['query']['hasOwnProperty'](_0x28df('0x34'))){_0x7252af[_0x28df('0x1f')]=qs[_0x28df('0x1f')](_0x5336ca[_0x28df('0x2e')][_0x28df('0x1f')]);_0x7252af[_0x28df('0x1e')]=qs[_0x28df('0x1e')](_0x5336ca[_0x28df('0x2e')][_0x28df('0x1e')]);}_0x7252af[_0x28df('0x35')]=qs['sort'](_0x5336ca[_0x28df('0x2e')][_0x28df('0x36')]);_0x7252af[_0x28df('0x37')]=qs['filters'](_[_0x28df('0x38')](_0x5336ca[_0x28df('0x2e')],_0xe6c3fa[_0x28df('0x30')]),_0x5581a9);if(_0x5336ca[_0x28df('0x2e')][_0x28df('0x39')]){_0x7252af[_0x28df('0x37')]=_[_0x28df('0x3a')](_0x7252af[_0x28df('0x37')],{'$or':_[_0x28df('0x28')](_0x5581a9,function(_0x42018c){if(_0x42018c[_0x28df('0x2b')]!=='VIRTUAL'){var _0x1e89cc={};_0x1e89cc[_0x42018c[_0x28df('0x26')]]={'$like':'%'+_0x5336ca[_0x28df('0x2e')][_0x28df('0x39')]+'%'};return _0x1e89cc;}})});}_0x7252af=_[_0x28df('0x3a')]({},_0x7252af,_0x5336ca[_0x28df('0x3b')]);var _0x48ba70={'where':_0x7252af[_0x28df('0x37')]};return db[_0x28df('0x29')][_0x28df('0x1d')](_0x48ba70)[_0x28df('0x23')](function(_0x4293aa){_0x208374['count']=_0x4293aa;if(_0x5336ca[_0x28df('0x2e')][_0x28df('0x3c')]){_0x7252af[_0x28df('0x3d')]=[{'all':!![]}];}return db[_0x28df('0x29')]['findAll'](_0x7252af);})[_0x28df('0x23')](function(_0x4c18b3){_0x208374[_0x28df('0x3e')]=_0x4c18b3;return _0x208374;})['then'](respondWithFilteredResult(_0x422b4d,_0x7252af))['catch'](handleError(_0x422b4d,null));};exports[_0x28df('0x3f')]=function(_0x5e73f9,_0x2cb987){var _0x84b1ff={'raw':![],'where':{'id':_0x5e73f9[_0x28df('0x40')]['id']}},_0x19b49e={};_0x19b49e['model']=_[_0x28df('0x2f')](db[_0x28df('0x29')][_0x28df('0x41')]);_0x19b49e[_0x28df('0x2e')]=_[_0x28df('0x2f')](_0x5e73f9[_0x28df('0x2e')]);_0x19b49e[_0x28df('0x30')]=_['intersection'](_0x19b49e['model'],_0x19b49e[_0x28df('0x2e')]);_0x84b1ff[_0x28df('0x32')]=_['intersection'](_0x19b49e[_0x28df('0x2d')],qs[_0x28df('0x33')](_0x5e73f9[_0x28df('0x2e')]['fields']));_0x84b1ff[_0x28df('0x32')]=_0x84b1ff[_0x28df('0x32')][_0x28df('0x42')]?_0x84b1ff[_0x28df('0x32')]:_0x19b49e[_0x28df('0x2d')];if(_0x5e73f9[_0x28df('0x2e')]['includeAll']){_0x84b1ff[_0x28df('0x3d')]=[{'all':!![]}];}_0x84b1ff=_[_0x28df('0x3a')]({},_0x84b1ff,_0x5e73f9['options']);return db[_0x28df('0x29')][_0x28df('0x43')](_0x84b1ff)['then'](handleEntityNotFound(_0x2cb987,null))[_0x28df('0x23')](respondWithResult(_0x2cb987,null))[_0x28df('0x44')](handleError(_0x2cb987,null));};exports[_0x28df('0x45')]=function(_0x491c4e,_0x2d0960){return db[_0x28df('0x29')][_0x28df('0x45')](_0x491c4e[_0x28df('0x46')],{})[_0x28df('0x23')](respondWithResult(_0x2d0960,0xc9))[_0x28df('0x44')](handleError(_0x2d0960,null));};exports['update']=function(_0x7d0b30,_0x56e09b){if(_0x7d0b30[_0x28df('0x46')]['id']){delete _0x7d0b30[_0x28df('0x46')]['id'];}return db[_0x28df('0x29')][_0x28df('0x43')]({'where':{'id':_0x7d0b30['params']['id']}})[_0x28df('0x23')](handleEntityNotFound(_0x56e09b,null))[_0x28df('0x23')](saveUpdates(_0x7d0b30[_0x28df('0x46')],null))[_0x28df('0x23')](respondWithResult(_0x56e09b,null))[_0x28df('0x44')](handleError(_0x56e09b,null));};exports[_0x28df('0x24')]=function(_0x2283d4,_0x11953b){return db[_0x28df('0x29')][_0x28df('0x43')]({'where':{'id':_0x2283d4[_0x28df('0x40')]['id']}})[_0x28df('0x23')](handleEntityNotFound(_0x11953b,null))[_0x28df('0x23')](removeEntity(_0x11953b,null))[_0x28df('0x44')](handleError(_0x11953b,null));};exports[_0x28df('0x47')]=function(_0x49ef4f,_0x19b7ed){return db[_0x28df('0x29')][_0x28df('0x47')]()[_0x28df('0x23')](respondWithResult(_0x19b7ed,null))['catch'](handleError(_0x19b7ed,null));}; \ No newline at end of file +var _0x9994=['moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VoiceAgentReport','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x9994,0x11a));var _0x4999=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x9994[_0x51b1a5];return _0x15c738;};'use strict';var pdf=require(_0x4999('0x0'));var emlformat=require(_0x4999('0x1'));var rimraf=require(_0x4999('0x2'));var zipdir=require(_0x4999('0x3'));var jsonpatch=require(_0x4999('0x4'));var rp=require(_0x4999('0x5'));var moment=require(_0x4999('0x6'));var BPromise=require(_0x4999('0x7'));var Mustache=require(_0x4999('0x8'));var util=require('util');var path=require('path');var sox=require(_0x4999('0x9'));var csv=require(_0x4999('0xa'));var ejs=require(_0x4999('0xb'));var fs=require('fs');var _=require(_0x4999('0xc'));var squel=require('squel');var crypto=require(_0x4999('0xd'));var jsforce=require(_0x4999('0xe'));var deskjs=require(_0x4999('0xf'));var toCsv=require(_0x4999('0xa'));var querystring=require(_0x4999('0x10'));var Papa=require(_0x4999('0x11'));var Redis=require(_0x4999('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4999('0x13'));var as=require(_0x4999('0x14'));var hardwareService=require(_0x4999('0x15'));var logger=require('../../config/logger')(_0x4999('0x16'));var utils=require(_0x4999('0x17'));var config=require(_0x4999('0x18'));var db=require(_0x4999('0x19'))['db'];function respondWithStatusCode(_0x46152c,_0x4f8767){_0x4f8767=_0x4f8767||0xcc;return function(_0x9dd751){if(_0x9dd751){return _0x46152c[_0x4999('0x1a')](_0x4f8767);}return _0x46152c['status'](_0x4f8767)[_0x4999('0x1b')]();};}function respondWithResult(_0x4ab8b7,_0x173e07){_0x173e07=_0x173e07||0xc8;return function(_0x58bbc1){if(_0x58bbc1){return _0x4ab8b7[_0x4999('0x1c')](_0x173e07)[_0x4999('0x1d')](_0x58bbc1);}};}function respondWithFilteredResult(_0x31c105,_0x39822e){return function(_0x3117a3){if(_0x3117a3){var _0x3b6975=_0x3117a3[_0x4999('0x1e')],_0x550b54=_0x39822e[_0x4999('0x1f')],_0x4acb4c=_0x39822e[_0x4999('0x1f')]+_0x39822e[_0x4999('0x20')],_0x42c7b9;if(_0x4acb4c>=_0x3b6975){_0x4acb4c=_0x3b6975;_0x42c7b9=0xc8;}else{_0x42c7b9=0xce;}_0x31c105['status'](_0x42c7b9);return _0x31c105[_0x4999('0x21')](_0x4999('0x22'),_0x550b54+'-'+_0x4acb4c+'/'+_0x3b6975)['json'](_0x3117a3);}return null;};}function patchUpdates(_0x2f1e20){return function(_0x3cd70d){try{jsonpatch[_0x4999('0x23')](_0x3cd70d,_0x2f1e20,!![]);}catch(_0x25e921){return BPromise['reject'](_0x25e921);}return _0x3cd70d[_0x4999('0x24')]();};}function saveUpdates(_0x1f0ea6,_0x2f9b98){return function(_0x291619){if(_0x291619){return _0x291619[_0x4999('0x25')](_0x1f0ea6)[_0x4999('0x26')](function(_0x181de5){return _0x181de5;});}return null;};}function removeEntity(_0x296702,_0x35a5a7){return function(_0x3ee725){if(_0x3ee725){return _0x3ee725[_0x4999('0x27')]()[_0x4999('0x26')](function(){_0x296702[_0x4999('0x1c')](0xcc)[_0x4999('0x1b')]();});}};}function handleEntityNotFound(_0x2482ff,_0x986061){return function(_0x46f01e){if(!_0x46f01e){_0x2482ff[_0x4999('0x1a')](0x194);}return _0x46f01e;};}function handleError(_0x2515cc,_0x4e0748){_0x4e0748=_0x4e0748||0x1f4;return function(_0x42a242){logger[_0x4999('0x28')](_0x42a242[_0x4999('0x29')]);if(_0x42a242[_0x4999('0x2a')]){delete _0x42a242['name'];}_0x2515cc[_0x4999('0x1c')](_0x4e0748)[_0x4999('0x2b')](_0x42a242);};}exports['index']=function(_0x15c105,_0x503e24){var _0x22c703={},_0x4d1fc1={},_0x54887d={'count':0x0,'rows':[]};var _0x36d4ee=_[_0x4999('0x2c')](db[_0x4999('0x2d')][_0x4999('0x2e')],function(_0x8f221b){return{'name':_0x8f221b['fieldName'],'type':_0x8f221b['type'][_0x4999('0x2f')]};});_0x4d1fc1[_0x4999('0x30')]=_[_0x4999('0x2c')](_0x36d4ee,_0x4999('0x2a'));_0x4d1fc1[_0x4999('0x31')]=_['keys'](_0x15c105[_0x4999('0x31')]);_0x4d1fc1['filters']=_[_0x4999('0x32')](_0x4d1fc1[_0x4999('0x30')],_0x4d1fc1['query']);_0x22c703[_0x4999('0x33')]=_[_0x4999('0x32')](_0x4d1fc1[_0x4999('0x30')],qs[_0x4999('0x34')](_0x15c105[_0x4999('0x31')][_0x4999('0x34')]));_0x22c703['attributes']=_0x22c703[_0x4999('0x33')][_0x4999('0x35')]?_0x22c703[_0x4999('0x33')]:_0x4d1fc1['model'];if(!_0x15c105[_0x4999('0x31')][_0x4999('0x36')](_0x4999('0x37'))){_0x22c703[_0x4999('0x20')]=qs[_0x4999('0x20')](_0x15c105[_0x4999('0x31')]['limit']);_0x22c703[_0x4999('0x1f')]=qs[_0x4999('0x1f')](_0x15c105[_0x4999('0x31')][_0x4999('0x1f')]);}_0x22c703['order']=qs['sort'](_0x15c105[_0x4999('0x31')]['sort']);_0x22c703[_0x4999('0x38')]=qs['filters'](_[_0x4999('0x39')](_0x15c105[_0x4999('0x31')],_0x4d1fc1['filters']),_0x36d4ee);if(_0x15c105[_0x4999('0x31')][_0x4999('0x3a')]){_0x22c703[_0x4999('0x38')]=_[_0x4999('0x3b')](_0x22c703['where'],{'$or':_[_0x4999('0x2c')](_0x36d4ee,function(_0x410406){if(_0x410406[_0x4999('0x3c')]!=='VIRTUAL'){var _0x16082a={};_0x16082a[_0x410406[_0x4999('0x2a')]]={'$like':'%'+_0x15c105['query'][_0x4999('0x3a')]+'%'};return _0x16082a;}})});}_0x22c703=_[_0x4999('0x3b')]({},_0x22c703,_0x15c105[_0x4999('0x3d')]);var _0x5df89c={'where':_0x22c703['where']};return db[_0x4999('0x2d')][_0x4999('0x1e')](_0x5df89c)[_0x4999('0x26')](function(_0xf65eda){_0x54887d['count']=_0xf65eda;if(_0x15c105[_0x4999('0x31')][_0x4999('0x3e')]){_0x22c703[_0x4999('0x3f')]=[{'all':!![]}];}return db[_0x4999('0x2d')]['findAll'](_0x22c703);})[_0x4999('0x26')](function(_0x1f75e0){_0x54887d[_0x4999('0x40')]=_0x1f75e0;return _0x54887d;})[_0x4999('0x26')](respondWithFilteredResult(_0x503e24,_0x22c703))[_0x4999('0x41')](handleError(_0x503e24,null));};exports[_0x4999('0x42')]=function(_0x210d43,_0x160508){var _0x57746b={'raw':![],'where':{'id':_0x210d43[_0x4999('0x43')]['id']}},_0x33d54e={};_0x33d54e[_0x4999('0x30')]=_[_0x4999('0x44')](db[_0x4999('0x2d')]['rawAttributes']);_0x33d54e[_0x4999('0x31')]=_[_0x4999('0x44')](_0x210d43['query']);_0x33d54e['filters']=_[_0x4999('0x32')](_0x33d54e[_0x4999('0x30')],_0x33d54e['query']);_0x57746b[_0x4999('0x33')]=_[_0x4999('0x32')](_0x33d54e['model'],qs[_0x4999('0x34')](_0x210d43[_0x4999('0x31')][_0x4999('0x34')]));_0x57746b[_0x4999('0x33')]=_0x57746b[_0x4999('0x33')][_0x4999('0x35')]?_0x57746b[_0x4999('0x33')]:_0x33d54e[_0x4999('0x30')];if(_0x210d43[_0x4999('0x31')][_0x4999('0x3e')]){_0x57746b[_0x4999('0x3f')]=[{'all':!![]}];}_0x57746b=_[_0x4999('0x3b')]({},_0x57746b,_0x210d43[_0x4999('0x3d')]);return db[_0x4999('0x2d')]['find'](_0x57746b)[_0x4999('0x26')](handleEntityNotFound(_0x160508,null))[_0x4999('0x26')](respondWithResult(_0x160508,null))['catch'](handleError(_0x160508,null));};exports['create']=function(_0x431f55,_0x5e1799){return db['VoiceAgentReport']['create'](_0x431f55[_0x4999('0x45')],{})['then'](respondWithResult(_0x5e1799,0xc9))[_0x4999('0x41')](handleError(_0x5e1799,null));};exports[_0x4999('0x25')]=function(_0x54cd63,_0x1de930){if(_0x54cd63['body']['id']){delete _0x54cd63[_0x4999('0x45')]['id'];}return db[_0x4999('0x2d')][_0x4999('0x46')]({'where':{'id':_0x54cd63[_0x4999('0x43')]['id']}})[_0x4999('0x26')](handleEntityNotFound(_0x1de930,null))[_0x4999('0x26')](saveUpdates(_0x54cd63['body'],null))['then'](respondWithResult(_0x1de930,null))['catch'](handleError(_0x1de930,null));};exports[_0x4999('0x27')]=function(_0x595ed4,_0x4605bf){return db[_0x4999('0x2d')][_0x4999('0x46')]({'where':{'id':_0x595ed4[_0x4999('0x43')]['id']}})[_0x4999('0x26')](handleEntityNotFound(_0x4605bf,null))[_0x4999('0x26')](removeEntity(_0x4605bf,null))[_0x4999('0x41')](handleError(_0x4605bf,null));};exports[_0x4999('0x47')]=function(_0x244811,_0x4e6cab){return db[_0x4999('0x2d')]['describe']()[_0x4999('0x26')](respondWithResult(_0x4e6cab,null))[_0x4999('0x41')](handleError(_0x4e6cab,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index da1ed64..b53752a 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 _0xcb91=['path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x43ae40,_0x13e7c3){var _0x1f9ac1=function(_0x5499cd){while(--_0x5499cd){_0x43ae40['push'](_0x43ae40['shift']());}};_0x1f9ac1(++_0x13e7c3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xcb91[_0x2e58c7];return _0x26eb00;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb9('0xa'),'destuniqueid']}],'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(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_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 45b0c80..3e412cc 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 _0x20d9=['info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','debug','stringify','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xa4d7e6,_0x378649){var _0x334748=function(_0x2c241b){while(--_0x2c241b){_0xa4d7e6['push'](_0xa4d7e6['shift']());}};_0x334748(++_0x378649);}(_0x20d9,0x1c2));var _0x920d=function(_0x5f9db1,_0x3303e7){_0x5f9db1=_0x5f9db1-0x0;var _0x114c67=_0x20d9[_0x5f9db1];return _0x114c67;};'use strict';var _=require(_0x920d('0x0'));var util=require(_0x920d('0x1'));var moment=require(_0x920d('0x2'));var BPromise=require(_0x920d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x920d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x920d('0x5'))(_0x920d('0x6'));var config=require(_0x920d('0x7'));var jayson=require(_0x920d('0x8'));var client=jayson['client'][_0x920d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5efbbc,_0x3486d8,_0x40a24d){return new BPromise(function(_0xb007a1,_0x338f09){return client[_0x920d('0xa')](_0x5efbbc,_0x40a24d)[_0x920d('0xb')](function(_0x1cc6ec){logger[_0x920d('0xc')](_0x920d('0xd'),_0x3486d8,_0x920d('0xe'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3486d8,_0x920d('0xe'),JSON['stringify'](_0x1cc6ec));if(_0x1cc6ec[_0x920d('0xf')]){if(_0x1cc6ec[_0x920d('0xf')][_0x920d('0x10')]===0x1f4){logger[_0x920d('0xf')](_0x920d('0xd'),_0x3486d8,_0x1cc6ec[_0x920d('0xf')]['message']);return _0x338f09(_0x1cc6ec['error'][_0x920d('0x11')]);}logger[_0x920d('0xf')](_0x920d('0xd'),_0x3486d8,_0x1cc6ec['error']['message']);return _0xb007a1(_0x1cc6ec[_0x920d('0xf')][_0x920d('0x11')]);}else{logger[_0x920d('0xc')](_0x920d('0xd'),_0x3486d8,_0x920d('0xe'));_0xb007a1(_0x1cc6ec[_0x920d('0x12')][_0x920d('0x11')]);}})[_0x920d('0x13')](function(_0x1089fb){logger['error'](_0x920d('0xd'),_0x3486d8,_0x1089fb);_0x338f09(_0x1089fb);});});}exports[_0x920d('0x14')]=function(_0x21afbd){var _0x22943f=this;return new Promise(function(_0x5204e2,_0x244d16){return db[_0x920d('0x15')][_0x920d('0x16')](_0x21afbd[_0x920d('0x17')],{'raw':_0x21afbd[_0x920d('0x18')]?_0x21afbd[_0x920d('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2f0fad){logger[_0x920d('0xc')](_0x920d('0x14'),_0x21afbd);logger[_0x920d('0x19')](_0x920d('0x14'),_0x21afbd,JSON[_0x920d('0x1a')](_0x2f0fad));_0x5204e2(_0x2f0fad);})['catch'](function(_0x138e91){logger[_0x920d('0xf')](_0x920d('0x14'),_0x138e91['message'],_0x21afbd);_0x244d16(_0x22943f[_0x920d('0xf')](0x1f4,_0x138e91[_0x920d('0x11')]));});});};exports[_0x920d('0x1b')]=function(_0x1ed4d4){var _0x5c6d3f=this;return new Promise(function(_0x1c2c0c,_0x562368){return db[_0x920d('0x15')][_0x920d('0x1c')](_0x1ed4d4[_0x920d('0x17')],{'raw':_0x1ed4d4[_0x920d('0x18')]?_0x1ed4d4[_0x920d('0x18')][_0x920d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed4d4[_0x920d('0x18')]?_0x1ed4d4[_0x920d('0x18')][_0x920d('0x1e')]||null:null,'attributes':_0x1ed4d4[_0x920d('0x18')]?_0x1ed4d4[_0x920d('0x18')][_0x920d('0x1f')]||null:null,'limit':_0x1ed4d4[_0x920d('0x18')]?_0x1ed4d4[_0x920d('0x18')][_0x920d('0x20')]||null:null})['then'](function(_0x1e3db6){logger['info'](_0x920d('0x1b'),_0x1ed4d4);logger[_0x920d('0x19')](_0x920d('0x1b'),_0x1ed4d4,JSON[_0x920d('0x1a')](_0x1e3db6));_0x1c2c0c(_0x1e3db6);})['catch'](function(_0x59501e){logger[_0x920d('0xf')](_0x920d('0x1b'),_0x59501e[_0x920d('0x11')],_0x1ed4d4);_0x562368(_0x5c6d3f[_0x920d('0xf')](0x1f4,_0x59501e[_0x920d('0x11')]));});});}; \ No newline at end of file +var _0x9a60=['attributes','limit','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x9a60,0x182));var _0x09a6=function(_0x1dd6d4,_0x18403a){_0x1dd6d4=_0x1dd6d4-0x0;var _0x1dc5ad=_0x9a60[_0x1dd6d4];return _0x1dc5ad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x09a6('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09a6('0x1'))['db'];var utils=require(_0x09a6('0x2'));var logger=require(_0x09a6('0x3'))(_0x09a6('0x4'));var config=require(_0x09a6('0x5'));var jayson=require(_0x09a6('0x6'));var client=jayson[_0x09a6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52c9b8,_0x455009,_0x28789d){return new BPromise(function(_0x444f01,_0x592f46){return client[_0x09a6('0x8')](_0x52c9b8,_0x28789d)[_0x09a6('0x9')](function(_0x39a412){logger[_0x09a6('0xa')](_0x09a6('0xb'),_0x455009,_0x09a6('0xc'));logger[_0x09a6('0xd')](_0x09a6('0xe'),_0x455009,_0x09a6('0xc'),JSON[_0x09a6('0xf')](_0x39a412));if(_0x39a412[_0x09a6('0x10')]){if(_0x39a412[_0x09a6('0x10')][_0x09a6('0x11')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x455009,_0x39a412[_0x09a6('0x10')][_0x09a6('0x12')]);return _0x592f46(_0x39a412[_0x09a6('0x10')][_0x09a6('0x12')]);}logger['error'](_0x09a6('0xb'),_0x455009,_0x39a412[_0x09a6('0x10')][_0x09a6('0x12')]);return _0x444f01(_0x39a412['error']['message']);}else{logger[_0x09a6('0xa')](_0x09a6('0xb'),_0x455009,_0x09a6('0xc'));_0x444f01(_0x39a412[_0x09a6('0x13')][_0x09a6('0x12')]);}})[_0x09a6('0x14')](function(_0x483c53){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x455009,_0x483c53);_0x592f46(_0x483c53);});});}exports['CreateVoiceAgentReport']=function(_0xfe9a48){var _0x3bec01=this;return new Promise(function(_0x2c24e3,_0x5d3eae){return db[_0x09a6('0x15')][_0x09a6('0x16')](_0xfe9a48[_0x09a6('0x17')],{'raw':_0xfe9a48[_0x09a6('0x18')]?_0xfe9a48[_0x09a6('0x18')][_0x09a6('0x19')]===undefined?!![]:![]:!![]})[_0x09a6('0x9')](function(_0x191323){logger[_0x09a6('0xa')](_0x09a6('0x1a'),_0xfe9a48);logger[_0x09a6('0xd')](_0x09a6('0x1a'),_0xfe9a48,JSON[_0x09a6('0xf')](_0x191323));_0x2c24e3(_0x191323);})['catch'](function(_0x5ca1ca){logger[_0x09a6('0x10')](_0x09a6('0x1a'),_0x5ca1ca[_0x09a6('0x12')],_0xfe9a48);_0x5d3eae(_0x3bec01[_0x09a6('0x10')](0x1f4,_0x5ca1ca[_0x09a6('0x12')]));});});};exports[_0x09a6('0x1b')]=function(_0x38c4a0){var _0x1da7fe=this;return new Promise(function(_0x35fc4a,_0x24f97e){return db[_0x09a6('0x15')][_0x09a6('0x1c')](_0x38c4a0[_0x09a6('0x17')],{'raw':_0x38c4a0['options']?_0x38c4a0['options'][_0x09a6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38c4a0['options']?_0x38c4a0[_0x09a6('0x18')][_0x09a6('0x1d')]||null:null,'attributes':_0x38c4a0['options']?_0x38c4a0[_0x09a6('0x18')][_0x09a6('0x1e')]||null:null,'limit':_0x38c4a0['options']?_0x38c4a0[_0x09a6('0x18')][_0x09a6('0x1f')]||null:null})['then'](function(_0x28b762){logger[_0x09a6('0xa')]('UpdateVoiceAgentReport',_0x38c4a0);logger[_0x09a6('0xd')](_0x09a6('0x1b'),_0x38c4a0,JSON['stringify'](_0x28b762));_0x35fc4a(_0x28b762);})['catch'](function(_0x4e5f22){logger[_0x09a6('0x10')](_0x09a6('0x1b'),_0x4e5f22[_0x09a6('0x12')],_0x38c4a0);_0x24f97e(_0x1da7fe['error'](0x1f4,_0x4e5f22[_0x09a6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index cbfdc54..617f520 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 _0x77d4=['./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2e1641,_0xe1f636){var _0x49f5d0=function(_0x46f077){while(--_0x46f077){_0x2e1641['push'](_0x2e1641['shift']());}};_0x49f5d0(++_0xe1f636);}(_0x77d4,0x1f2));var _0x477d=function(_0x107a84,_0x206679){_0x107a84=_0x107a84-0x0;var _0x3c494a=_0x77d4[_0x107a84];return _0x3c494a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x477d('0x0'));var timeout=require(_0x477d('0x1'));var express=require(_0x477d('0x2'));var router=express[_0x477d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x477d('0x4'));var config=require(_0x477d('0x5'));var controller=require(_0x477d('0x6'));router[_0x477d('0x7')]('/',auth[_0x477d('0x8')](),controller[_0x477d('0x9')]);router['get'](_0x477d('0xa'),auth[_0x477d('0x8')](),controller[_0x477d('0xb')]);router[_0x477d('0x7')](_0x477d('0xc'),auth[_0x477d('0x8')](),controller[_0x477d('0xd')]);router[_0x477d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x477d('0xf')]('/:id',auth[_0x477d('0x8')](),controller[_0x477d('0x10')]);router[_0x477d('0x11')](_0x477d('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x842e=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','path'];(function(_0x19cc92,_0x4df512){var _0x4c88d4=function(_0x40bf46){while(--_0x40bf46){_0x19cc92['push'](_0x19cc92['shift']());}};_0x4c88d4(++_0x4df512);}(_0x842e,0x1af));var _0xe842=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x842e[_0x28578d];return _0x524826;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe842('0x0'));var timeout=require('connect-timeout');var express=require(_0xe842('0x1'));var router=express[_0xe842('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe842('0x3'));var config=require(_0xe842('0x4'));var controller=require('./voiceCallReport.controller');router[_0xe842('0x5')]('/',auth[_0xe842('0x6')](),controller[_0xe842('0x7')]);router[_0xe842('0x5')](_0xe842('0x8'),auth[_0xe842('0x6')](),controller[_0xe842('0x9')]);router[_0xe842('0x5')](_0xe842('0xa'),auth[_0xe842('0x6')](),controller[_0xe842('0xb')]);router[_0xe842('0xc')]('/',auth[_0xe842('0x6')](),controller[_0xe842('0xd')]);router['put']('/:id',auth[_0xe842('0x6')](),controller[_0xe842('0xe')]);router[_0xe842('0xf')]('/:id',auth[_0xe842('0x6')](),controller[_0xe842('0x10')]);module[_0xe842('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 4c53886..382886b 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x3ccea2,_0x624323){var _0xeb988=function(_0x565fe4){while(--_0x565fe4){_0x3ccea2['push'](_0x3ccea2['shift']());}};_0xeb988(++_0x624323);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x472402,_0x244d69){var _0x5dedcf=function(_0x498516){while(--_0x498516){_0x472402['push'](_0x472402['shift']());}};_0x5dedcf(++_0x244d69);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 77a6c9c..2568810 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 _0xea37=['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','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','fullname','alias','User','findAll','rows','catch','show','options','find','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xea37,0x132));var _0x7ea3=function(_0x1c9f5f,_0x3dd99c){_0x1c9f5f=_0x1c9f5f-0x0;var _0x435d7d=_0xea37[_0x1c9f5f];return _0x435d7d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ea3('0x0'));var rimraf=require(_0x7ea3('0x1'));var zipdir=require(_0x7ea3('0x2'));var jsonpatch=require(_0x7ea3('0x3'));var rp=require(_0x7ea3('0x4'));var moment=require(_0x7ea3('0x5'));var BPromise=require(_0x7ea3('0x6'));var Mustache=require('mustache');var util=require(_0x7ea3('0x7'));var path=require(_0x7ea3('0x8'));var sox=require('sox');var csv=require(_0x7ea3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ea3('0xa'));var squel=require(_0x7ea3('0xb'));var crypto=require(_0x7ea3('0xc'));var jsforce=require(_0x7ea3('0xd'));var deskjs=require(_0x7ea3('0xe'));var toCsv=require(_0x7ea3('0x9'));var querystring=require(_0x7ea3('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ea3('0x10'));var authService=require(_0x7ea3('0x11'));var qs=require(_0x7ea3('0x12'));var as=require(_0x7ea3('0x13'));var hardwareService=require(_0x7ea3('0x14'));var logger=require(_0x7ea3('0x15'))(_0x7ea3('0x16'));var utils=require(_0x7ea3('0x17'));var config=require('../../config/environment');var db=require(_0x7ea3('0x18'))['db'];function respondWithStatusCode(_0x46f74d,_0x5dc394){_0x5dc394=_0x5dc394||0xcc;return function(_0xa6a58c){if(_0xa6a58c){return _0x46f74d['sendStatus'](_0x5dc394);}return _0x46f74d[_0x7ea3('0x19')](_0x5dc394)[_0x7ea3('0x1a')]();};}function respondWithResult(_0x1b3cbf,_0x4008b9){_0x4008b9=_0x4008b9||0xc8;return function(_0xafbaff){if(_0xafbaff){return _0x1b3cbf['status'](_0x4008b9)[_0x7ea3('0x1b')](_0xafbaff);}};}function respondWithFilteredResult(_0x3f10b5,_0x387c74){return function(_0xd4567){if(_0xd4567){var _0x5c4c94=_0xd4567[_0x7ea3('0x1c')],_0x21270b=_0x387c74[_0x7ea3('0x1d')],_0x159571=_0x387c74['offset']+_0x387c74['limit'],_0x43e0f7;if(_0x159571>=_0x5c4c94){_0x159571=_0x5c4c94;_0x43e0f7=0xc8;}else{_0x43e0f7=0xce;}_0x3f10b5[_0x7ea3('0x19')](_0x43e0f7);return _0x3f10b5[_0x7ea3('0x1e')](_0x7ea3('0x1f'),_0x21270b+'-'+_0x159571+'/'+_0x5c4c94)[_0x7ea3('0x1b')](_0xd4567);}return null;};}function patchUpdates(_0x5f12b0){return function(_0x4e5e24){try{jsonpatch[_0x7ea3('0x20')](_0x4e5e24,_0x5f12b0,!![]);}catch(_0x3fdb84){return BPromise[_0x7ea3('0x21')](_0x3fdb84);}return _0x4e5e24[_0x7ea3('0x22')]();};}function saveUpdates(_0x3fe497,_0x1780df){return function(_0xab644f){if(_0xab644f){return _0xab644f[_0x7ea3('0x23')](_0x3fe497)[_0x7ea3('0x24')](function(_0x3b0c81){return _0x3b0c81;});}return null;};}function removeEntity(_0x245080,_0x34d107){return function(_0x348723){if(_0x348723){return _0x348723['destroy']()['then'](function(){_0x245080[_0x7ea3('0x19')](0xcc)[_0x7ea3('0x1a')]();});}};}function handleEntityNotFound(_0x46001f,_0x48e9f2){return function(_0x419e5a){if(!_0x419e5a){_0x46001f[_0x7ea3('0x25')](0x194);}return _0x419e5a;};}function handleError(_0x2c996d,_0x132a66){_0x132a66=_0x132a66||0x1f4;return function(_0x23dcdf){logger[_0x7ea3('0x26')](_0x23dcdf[_0x7ea3('0x27')]);if(_0x23dcdf[_0x7ea3('0x28')]){delete _0x23dcdf['name'];}_0x2c996d['status'](_0x132a66)[_0x7ea3('0x29')](_0x23dcdf);};}exports['index']=function(_0x58686d,_0x1b1e83){var _0x2abae6={},_0x1f3180={},_0x26172a={'count':0x0,'rows':[]};var _0x434129=_[_0x7ea3('0x2a')](db[_0x7ea3('0x2b')][_0x7ea3('0x2c')],function(_0x42a13f){return{'name':_0x42a13f[_0x7ea3('0x2d')],'type':_0x42a13f[_0x7ea3('0x2e')][_0x7ea3('0x2f')]};});_0x1f3180[_0x7ea3('0x30')]=_[_0x7ea3('0x2a')](_0x434129,_0x7ea3('0x28'));_0x1f3180[_0x7ea3('0x31')]=_[_0x7ea3('0x32')](_0x58686d[_0x7ea3('0x31')]);_0x1f3180[_0x7ea3('0x33')]=_[_0x7ea3('0x34')](_0x1f3180[_0x7ea3('0x30')],_0x1f3180[_0x7ea3('0x31')]);_0x2abae6['attributes']=_['intersection'](_0x1f3180[_0x7ea3('0x30')],qs[_0x7ea3('0x35')](_0x58686d[_0x7ea3('0x31')][_0x7ea3('0x35')]));_0x2abae6[_0x7ea3('0x36')]=_0x2abae6['attributes'][_0x7ea3('0x37')]?_0x2abae6[_0x7ea3('0x36')]:_0x1f3180['model'];if(!_0x58686d[_0x7ea3('0x31')]['hasOwnProperty']('nolimit')){_0x2abae6[_0x7ea3('0x38')]=qs[_0x7ea3('0x38')](_0x58686d['query']['limit']);_0x2abae6[_0x7ea3('0x1d')]=qs[_0x7ea3('0x1d')](_0x58686d['query'][_0x7ea3('0x1d')]);}_0x2abae6[_0x7ea3('0x39')]=qs[_0x7ea3('0x3a')](_0x58686d['query'][_0x7ea3('0x3a')]);_0x2abae6[_0x7ea3('0x3b')]=qs[_0x7ea3('0x33')](_[_0x7ea3('0x3c')](_0x58686d[_0x7ea3('0x31')],_0x1f3180['filters']),_0x434129);if(_0x58686d['query'][_0x7ea3('0x3d')]){_0x2abae6[_0x7ea3('0x3b')]=_[_0x7ea3('0x3e')](_0x2abae6[_0x7ea3('0x3b')],{'$or':_['map'](_0x434129,function(_0x346c9c){if(_0x346c9c[_0x7ea3('0x2e')]!==_0x7ea3('0x3f')){var _0xa3b920={};_0xa3b920[_0x346c9c[_0x7ea3('0x28')]]={'$like':'%'+_0x58686d[_0x7ea3('0x31')][_0x7ea3('0x3d')]+'%'};return _0xa3b920;}})});}_0x2abae6=_['merge']({},_0x2abae6,_0x58686d['options']);var _0x415e05={'where':_0x2abae6['where']};return db[_0x7ea3('0x2b')][_0x7ea3('0x1c')](_0x415e05)['then'](function(_0x333226){_0x26172a[_0x7ea3('0x1c')]=_0x333226;if(_0x58686d[_0x7ea3('0x31')][_0x7ea3('0x40')]){_0x2abae6[_0x7ea3('0x41')]=[{'attributes':['id',_0x7ea3('0x28'),_0x7ea3('0x42'),_0x7ea3('0x43')],'model':db[_0x7ea3('0x44')],'as':_0x7ea3('0x44')}];}return db[_0x7ea3('0x2b')][_0x7ea3('0x45')](_0x2abae6);})[_0x7ea3('0x24')](function(_0x4e482a){_0x26172a[_0x7ea3('0x46')]=_0x4e482a;return _0x26172a;})[_0x7ea3('0x24')](respondWithFilteredResult(_0x1b1e83,_0x2abae6))[_0x7ea3('0x47')](handleError(_0x1b1e83,null));};exports[_0x7ea3('0x48')]=function(_0x41e099,_0x247cce){var _0x54a47d={'raw':!![],'where':{'id':_0x41e099['params']['id']}},_0x4f9f65={};_0x4f9f65['model']=_['keys'](db[_0x7ea3('0x2b')][_0x7ea3('0x2c')]);_0x4f9f65[_0x7ea3('0x31')]=_[_0x7ea3('0x32')](_0x41e099[_0x7ea3('0x31')]);_0x4f9f65[_0x7ea3('0x33')]=_[_0x7ea3('0x34')](_0x4f9f65[_0x7ea3('0x30')],_0x4f9f65[_0x7ea3('0x31')]);_0x54a47d[_0x7ea3('0x36')]=_[_0x7ea3('0x34')](_0x4f9f65[_0x7ea3('0x30')],qs[_0x7ea3('0x35')](_0x41e099['query'][_0x7ea3('0x35')]));_0x54a47d[_0x7ea3('0x36')]=_0x54a47d[_0x7ea3('0x36')][_0x7ea3('0x37')]?_0x54a47d[_0x7ea3('0x36')]:_0x4f9f65[_0x7ea3('0x30')];if(_0x41e099[_0x7ea3('0x31')][_0x7ea3('0x40')]){_0x54a47d[_0x7ea3('0x41')]=[{'all':!![]}];}_0x54a47d=_[_0x7ea3('0x3e')]({},_0x54a47d,_0x41e099[_0x7ea3('0x49')]);return db['VoiceCallReport'][_0x7ea3('0x4a')](_0x54a47d)[_0x7ea3('0x24')](handleEntityNotFound(_0x247cce,null))['then'](respondWithResult(_0x247cce,null))['catch'](handleError(_0x247cce,null));};exports['create']=function(_0x3561d,_0x1ec37b){return db['VoiceCallReport']['create'](_0x3561d[_0x7ea3('0x4b')],{})[_0x7ea3('0x24')](respondWithResult(_0x1ec37b,0xc9))[_0x7ea3('0x47')](handleError(_0x1ec37b,null));};exports[_0x7ea3('0x4c')]=function(_0x3e28e8,_0x1299af){return db['VoiceCallReport']['find']({'where':{'id':_0x3e28e8[_0x7ea3('0x4d')]['id']}})[_0x7ea3('0x24')](handleEntityNotFound(_0x1299af,null))[_0x7ea3('0x24')](removeEntity(_0x1299af,null))[_0x7ea3('0x47')](handleError(_0x1299af,null));};exports['describe']=function(_0x4c85ef,_0x42ce87){return db[_0x7ea3('0x2b')][_0x7ea3('0x4e')]()[_0x7ea3('0x24')](respondWithResult(_0x42ce87,null))['catch'](handleError(_0x42ce87,null));};exports[_0x7ea3('0x23')]=function(_0xa1fcfd,_0x5b6ccb){if(_0xa1fcfd[_0x7ea3('0x4b')]['uniqueid']){delete _0xa1fcfd[_0x7ea3('0x4b')]['uniqueid'];}return db['VoiceCallReport'][_0x7ea3('0x4a')]({'where':{'uniqueid':_0xa1fcfd['params']['id'],'UserId':{'$or':[null,_0xa1fcfd['user']['id']]}}})[_0x7ea3('0x24')](handleEntityNotFound(_0x5b6ccb,null))[_0x7ea3('0x24')](saveUpdates(_0xa1fcfd[_0x7ea3('0x4b')],null))[_0x7ea3('0x24')](respondWithResult(_0x5b6ccb,null))[_0x7ea3('0x47')](handleError(_0x5b6ccb,null));}; \ No newline at end of file +var _0x3072=['user','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','create','describe','update','body','find'];(function(_0x4193e2,_0x8ac4bb){var _0x1cd6c3=function(_0x56f634){while(--_0x56f634){_0x4193e2['push'](_0x4193e2['shift']());}};_0x1cd6c3(++_0x8ac4bb);}(_0x3072,0x1d5));var _0x2307=function(_0x19c4a4,_0x345a60){_0x19c4a4=_0x19c4a4-0x0;var _0x22c39d=_0x3072[_0x19c4a4];return _0x22c39d;};'use strict';var pdf=require(_0x2307('0x0'));var emlformat=require(_0x2307('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2307('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2307('0x3'));var moment=require(_0x2307('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2307('0x5'));var util=require(_0x2307('0x6'));var path=require('path');var sox=require(_0x2307('0x7'));var csv=require(_0x2307('0x8'));var ejs=require(_0x2307('0x9'));var fs=require('fs');var _=require(_0x2307('0xa'));var squel=require('squel');var crypto=require(_0x2307('0xb'));var jsforce=require(_0x2307('0xc'));var deskjs=require(_0x2307('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2307('0xe'));var Papa=require(_0x2307('0xf'));var Redis=require(_0x2307('0x10'));var authService=require(_0x2307('0x11'));var qs=require(_0x2307('0x12'));var as=require(_0x2307('0x13'));var hardwareService=require(_0x2307('0x14'));var logger=require(_0x2307('0x15'))(_0x2307('0x16'));var utils=require('../../config/utils');var config=require(_0x2307('0x17'));var db=require(_0x2307('0x18'))['db'];function respondWithStatusCode(_0x102fd8,_0x350bc0){_0x350bc0=_0x350bc0||0xcc;return function(_0x5c8761){if(_0x5c8761){return _0x102fd8[_0x2307('0x19')](_0x350bc0);}return _0x102fd8[_0x2307('0x1a')](_0x350bc0)['end']();};}function respondWithResult(_0x38f0fe,_0xb91473){_0xb91473=_0xb91473||0xc8;return function(_0x4221c1){if(_0x4221c1){return _0x38f0fe[_0x2307('0x1a')](_0xb91473)[_0x2307('0x1b')](_0x4221c1);}};}function respondWithFilteredResult(_0x2a373e,_0x108e34){return function(_0x220e48){if(_0x220e48){var _0x3d247e=_0x220e48['count'],_0x7e5ea7=_0x108e34[_0x2307('0x1c')],_0x170f96=_0x108e34[_0x2307('0x1c')]+_0x108e34[_0x2307('0x1d')],_0x52cbd1;if(_0x170f96>=_0x3d247e){_0x170f96=_0x3d247e;_0x52cbd1=0xc8;}else{_0x52cbd1=0xce;}_0x2a373e['status'](_0x52cbd1);return _0x2a373e[_0x2307('0x1e')](_0x2307('0x1f'),_0x7e5ea7+'-'+_0x170f96+'/'+_0x3d247e)[_0x2307('0x1b')](_0x220e48);}return null;};}function patchUpdates(_0x5a7c3d){return function(_0x3f48ae){try{jsonpatch[_0x2307('0x20')](_0x3f48ae,_0x5a7c3d,!![]);}catch(_0x131ab5){return BPromise['reject'](_0x131ab5);}return _0x3f48ae['save']();};}function saveUpdates(_0x45979b,_0xb90595){return function(_0x4d024f){if(_0x4d024f){return _0x4d024f['update'](_0x45979b)[_0x2307('0x21')](function(_0x2ec027){return _0x2ec027;});}return null;};}function removeEntity(_0x4c9e06,_0x17b87a){return function(_0x5beb17){if(_0x5beb17){return _0x5beb17[_0x2307('0x22')]()[_0x2307('0x21')](function(){_0x4c9e06[_0x2307('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x108528,_0x30aef1){return function(_0x1ff176){if(!_0x1ff176){_0x108528[_0x2307('0x19')](0x194);}return _0x1ff176;};}function handleError(_0x492a1b,_0x55a780){_0x55a780=_0x55a780||0x1f4;return function(_0x1b28b8){logger[_0x2307('0x23')](_0x1b28b8[_0x2307('0x24')]);if(_0x1b28b8[_0x2307('0x25')]){delete _0x1b28b8[_0x2307('0x25')];}_0x492a1b[_0x2307('0x1a')](_0x55a780)[_0x2307('0x26')](_0x1b28b8);};}exports['index']=function(_0x406707,_0x38b657){var _0x243bd1={},_0x178f4f={},_0x34d379={'count':0x0,'rows':[]};var _0x33a98f=_[_0x2307('0x27')](db[_0x2307('0x28')][_0x2307('0x29')],function(_0x244dd8){return{'name':_0x244dd8[_0x2307('0x2a')],'type':_0x244dd8[_0x2307('0x2b')][_0x2307('0x2c')]};});_0x178f4f[_0x2307('0x2d')]=_[_0x2307('0x27')](_0x33a98f,_0x2307('0x25'));_0x178f4f['query']=_[_0x2307('0x2e')](_0x406707[_0x2307('0x2f')]);_0x178f4f['filters']=_[_0x2307('0x30')](_0x178f4f[_0x2307('0x2d')],_0x178f4f[_0x2307('0x2f')]);_0x243bd1[_0x2307('0x31')]=_[_0x2307('0x30')](_0x178f4f[_0x2307('0x2d')],qs[_0x2307('0x32')](_0x406707[_0x2307('0x2f')][_0x2307('0x32')]));_0x243bd1['attributes']=_0x243bd1['attributes'][_0x2307('0x33')]?_0x243bd1['attributes']:_0x178f4f[_0x2307('0x2d')];if(!_0x406707['query'][_0x2307('0x34')](_0x2307('0x35'))){_0x243bd1[_0x2307('0x1d')]=qs['limit'](_0x406707[_0x2307('0x2f')][_0x2307('0x1d')]);_0x243bd1[_0x2307('0x1c')]=qs['offset'](_0x406707[_0x2307('0x2f')][_0x2307('0x1c')]);}_0x243bd1['order']=qs[_0x2307('0x36')](_0x406707['query'][_0x2307('0x36')]);_0x243bd1[_0x2307('0x37')]=qs[_0x2307('0x38')](_['pick'](_0x406707[_0x2307('0x2f')],_0x178f4f[_0x2307('0x38')]),_0x33a98f);if(_0x406707[_0x2307('0x2f')][_0x2307('0x39')]){_0x243bd1[_0x2307('0x37')]=_[_0x2307('0x3a')](_0x243bd1[_0x2307('0x37')],{'$or':_['map'](_0x33a98f,function(_0x3a618e){if(_0x3a618e[_0x2307('0x2b')]!==_0x2307('0x3b')){var _0x51ff11={};_0x51ff11[_0x3a618e[_0x2307('0x25')]]={'$like':'%'+_0x406707[_0x2307('0x2f')]['filter']+'%'};return _0x51ff11;}})});}_0x243bd1=_[_0x2307('0x3a')]({},_0x243bd1,_0x406707[_0x2307('0x3c')]);var _0x5e38ba={'where':_0x243bd1['where']};return db[_0x2307('0x28')][_0x2307('0x3d')](_0x5e38ba)[_0x2307('0x21')](function(_0x115a48){_0x34d379[_0x2307('0x3d')]=_0x115a48;if(_0x406707[_0x2307('0x2f')][_0x2307('0x3e')]){_0x243bd1[_0x2307('0x3f')]=[{'attributes':['id','name',_0x2307('0x40'),_0x2307('0x41')],'model':db[_0x2307('0x42')],'as':_0x2307('0x42')}];}return db['VoiceCallReport'][_0x2307('0x43')](_0x243bd1);})[_0x2307('0x21')](function(_0x3b7816){_0x34d379[_0x2307('0x44')]=_0x3b7816;return _0x34d379;})[_0x2307('0x21')](respondWithFilteredResult(_0x38b657,_0x243bd1))[_0x2307('0x45')](handleError(_0x38b657,null));};exports[_0x2307('0x46')]=function(_0x50a557,_0x5b83f7){var _0x6aa8ca={'raw':!![],'where':{'id':_0x50a557[_0x2307('0x47')]['id']}},_0x86ddd4={};_0x86ddd4[_0x2307('0x2d')]=_['keys'](db['VoiceCallReport'][_0x2307('0x29')]);_0x86ddd4[_0x2307('0x2f')]=_[_0x2307('0x2e')](_0x50a557[_0x2307('0x2f')]);_0x86ddd4[_0x2307('0x38')]=_[_0x2307('0x30')](_0x86ddd4[_0x2307('0x2d')],_0x86ddd4[_0x2307('0x2f')]);_0x6aa8ca[_0x2307('0x31')]=_[_0x2307('0x30')](_0x86ddd4[_0x2307('0x2d')],qs['fields'](_0x50a557['query'][_0x2307('0x32')]));_0x6aa8ca[_0x2307('0x31')]=_0x6aa8ca[_0x2307('0x31')][_0x2307('0x33')]?_0x6aa8ca[_0x2307('0x31')]:_0x86ddd4[_0x2307('0x2d')];if(_0x50a557['query'][_0x2307('0x3e')]){_0x6aa8ca[_0x2307('0x3f')]=[{'all':!![]}];}_0x6aa8ca=_[_0x2307('0x3a')]({},_0x6aa8ca,_0x50a557[_0x2307('0x3c')]);return db[_0x2307('0x28')]['find'](_0x6aa8ca)[_0x2307('0x21')](handleEntityNotFound(_0x5b83f7,null))[_0x2307('0x21')](respondWithResult(_0x5b83f7,null))[_0x2307('0x45')](handleError(_0x5b83f7,null));};exports[_0x2307('0x48')]=function(_0x5a4bc5,_0x6684b9){return db[_0x2307('0x28')][_0x2307('0x48')](_0x5a4bc5['body'],{})[_0x2307('0x21')](respondWithResult(_0x6684b9,0xc9))[_0x2307('0x45')](handleError(_0x6684b9,null));};exports[_0x2307('0x22')]=function(_0x25707c,_0x1ec7d2){return db[_0x2307('0x28')]['find']({'where':{'id':_0x25707c['params']['id']}})[_0x2307('0x21')](handleEntityNotFound(_0x1ec7d2,null))[_0x2307('0x21')](removeEntity(_0x1ec7d2,null))[_0x2307('0x45')](handleError(_0x1ec7d2,null));};exports[_0x2307('0x49')]=function(_0x1a6fd7,_0x117948){return db[_0x2307('0x28')][_0x2307('0x49')]()[_0x2307('0x21')](respondWithResult(_0x117948,null))[_0x2307('0x45')](handleError(_0x117948,null));};exports[_0x2307('0x4a')]=function(_0x24ae1a,_0xf3dff){if(_0x24ae1a[_0x2307('0x4b')]['uniqueid']){delete _0x24ae1a[_0x2307('0x4b')]['uniqueid'];}return db[_0x2307('0x28')][_0x2307('0x4c')]({'where':{'uniqueid':_0x24ae1a['params']['id'],'UserId':{'$or':[null,_0x24ae1a[_0x2307('0x4d')]['id']]}}})[_0x2307('0x21')](handleEntityNotFound(_0xf3dff,null))[_0x2307('0x21')](saveUpdates(_0x24ae1a['body'],null))['then'](respondWithResult(_0xf3dff,null))[_0x2307('0x45')](handleError(_0xf3dff,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b86fc63..9a5db77 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 _0xa116=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0x596c0a,_0x367cbe){var _0x407cc9=function(_0x55b0ec){while(--_0x55b0ec){_0x596c0a['push'](_0x596c0a['shift']());}};_0x407cc9(++_0x367cbe);}(_0xa116,0x14d));var _0x6a11=function(_0x36335f,_0x448614){_0x36335f=_0x36335f-0x0;var _0x475d6f=_0xa116[_0x36335f];return _0x475d6f;};'use strict';var _=require(_0x6a11('0x0'));var util=require(_0x6a11('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6a11('0x2'));var BPromise=require(_0x6a11('0x3'));var rp=require(_0x6a11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a11('0x5'));var config=require(_0x6a11('0x6'));var attributes=require(_0x6a11('0x7'));module[_0x6a11('0x8')]=function(_0xe334cf,_0x12fee0){return _0xe334cf[_0x6a11('0x9')](_0x6a11('0xa'),attributes,{'tableName':_0x6a11('0xb'),'paranoid':![],'indexes':[{'fields':[_0x6a11('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c07=['lodash','../../config/logger','api','path','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x380a31,_0x832a39){var _0x386380=function(_0x37d141){while(--_0x37d141){_0x380a31['push'](_0x380a31['shift']());}};_0x386380(++_0x832a39);}(_0x8c07,0x10e));var _0x78c0=function(_0x141272,_0x217abe){_0x141272=_0x141272-0x0;var _0x28e8a4=_0x8c07[_0x141272];return _0x28e8a4;};'use strict';var _=require(_0x78c0('0x0'));var util=require('util');var logger=require(_0x78c0('0x1'))(_0x78c0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78c0('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x78c0('0x4'));module[_0x78c0('0x5')]=function(_0xbe0d68,_0x169f2a){return _0xbe0d68[_0x78c0('0x6')](_0x78c0('0x7'),attributes,{'tableName':_0x78c0('0x8'),'paranoid':![],'indexes':[{'fields':[_0x78c0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 377b65c..c067a02 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 _0x16f4=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','model','attributes','map','debug','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x509f32,_0x1ddd4f){var _0x48be5c=function(_0x249e1c){while(--_0x249e1c){_0x509f32['push'](_0x509f32['shift']());}};_0x48be5c(++_0x1ddd4f);}(_0x16f4,0x1e5));var _0x416f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x16f4[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x416f('0x0'));var rs=require(_0x416f('0x1'));var fs=require('fs');var Redis=require(_0x416f('0x2'));var db=require(_0x416f('0x3'))['db'];var utils=require(_0x416f('0x4'));var logger=require(_0x416f('0x5'))(_0x416f('0x6'));var config=require(_0x416f('0x7'));var jayson=require(_0x416f('0x8'));var client=jayson['client'][_0x416f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157fe2,_0x1a9ef6,_0x5dc8d4){return new BPromise(function(_0x535b01,_0x35526f){return client['request'](_0x157fe2,_0x5dc8d4)[_0x416f('0xa')](function(_0x4d5a30){logger[_0x416f('0xb')](_0x416f('0xc'),_0x1a9ef6,_0x416f('0xd'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1a9ef6,_0x416f('0xd'),JSON[_0x416f('0xe')](_0x4d5a30));if(_0x4d5a30['error']){if(_0x4d5a30[_0x416f('0xf')][_0x416f('0x10')]===0x1f4){logger[_0x416f('0xf')](_0x416f('0xc'),_0x1a9ef6,_0x4d5a30[_0x416f('0xf')][_0x416f('0x11')]);return _0x35526f(_0x4d5a30[_0x416f('0xf')]['message']);}logger[_0x416f('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x1a9ef6,_0x4d5a30[_0x416f('0xf')][_0x416f('0x11')]);return _0x535b01(_0x4d5a30[_0x416f('0xf')][_0x416f('0x11')]);}else{logger[_0x416f('0xb')](_0x416f('0xc'),_0x1a9ef6,'request\x20sent');_0x535b01(_0x4d5a30['result']['message']);}})[_0x416f('0x12')](function(_0x51470e){logger[_0x416f('0xf')](_0x416f('0xc'),_0x1a9ef6,_0x51470e);_0x35526f(_0x51470e);});});}exports[_0x416f('0x13')]=function(_0x4e98f6){var _0x379124=this;return new Promise(function(_0x5060bb,_0x3cf1c7){return db[_0x416f('0x14')][_0x416f('0x15')]({'raw':_0x4e98f6['options']?_0x4e98f6[_0x416f('0x16')][_0x416f('0x17')]===undefined?!![]:![]:!![],'where':_0x4e98f6[_0x416f('0x16')]?_0x4e98f6[_0x416f('0x16')][_0x416f('0x18')]||null:null,'attributes':_0x4e98f6['options']?_0x4e98f6[_0x416f('0x16')]['attributes']||null:null,'limit':_0x4e98f6[_0x416f('0x16')]?_0x4e98f6[_0x416f('0x16')]['limit']||null:null,'include':_0x4e98f6['options']?_0x4e98f6[_0x416f('0x16')]['include']?_['map'](_0x4e98f6['options'][_0x416f('0x19')],function(_0x39d982){return{'model':db[_0x39d982[_0x416f('0x1a')]],'as':_0x39d982['as'],'attributes':_0x39d982[_0x416f('0x1b')],'include':_0x39d982[_0x416f('0x19')]?_[_0x416f('0x1c')](_0x39d982[_0x416f('0x19')],function(_0x34328f){return{'model':db[_0x34328f[_0x416f('0x1a')]],'as':_0x34328f['as'],'attributes':_0x34328f[_0x416f('0x1b')],'include':_0x34328f[_0x416f('0x19')]?_['map'](_0x34328f[_0x416f('0x19')],function(_0x3bd81d){return{'model':db[_0x3bd81d[_0x416f('0x1a')]],'as':_0x3bd81d['as'],'attributes':_0x3bd81d[_0x416f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x416f('0xa')](function(_0x322b7e){logger['info'](_0x416f('0x13'),_0x4e98f6);logger[_0x416f('0x1d')](_0x416f('0x13'),_0x4e98f6,JSON[_0x416f('0xe')](_0x322b7e));_0x5060bb(_0x322b7e);})[_0x416f('0x12')](function(_0x21d57){logger['error']('GetVoiceCallReport',_0x21d57['message'],_0x4e98f6);_0x3cf1c7(_0x379124[_0x416f('0xf')](0x1f4,_0x21d57[_0x416f('0x11')]));});});};exports[_0x416f('0x1e')]=function(_0x17abd8){var _0x39d0e8=this;return new Promise(function(_0x65effc,_0x711fa3){return db[_0x416f('0x14')][_0x416f('0x1f')](_0x17abd8['body'],{'raw':_0x17abd8[_0x416f('0x16')]?_0x17abd8['options'][_0x416f('0x17')]===undefined?!![]:![]:!![]})[_0x416f('0xa')](function(_0x2ca28){logger[_0x416f('0xb')](_0x416f('0x1e'),_0x17abd8);logger[_0x416f('0x1d')](_0x416f('0x1e'),_0x17abd8,JSON['stringify'](_0x2ca28));_0x65effc(_0x2ca28);})[_0x416f('0x12')](function(_0x8583d2){logger['error']('CreateVoiceCallReport',_0x8583d2[_0x416f('0x11')],_0x17abd8);_0x711fa3(_0x39d0e8[_0x416f('0xf')](0x1f4,_0x8583d2[_0x416f('0x11')]));});});};exports[_0x416f('0x20')]=function(_0x5c03ad){var _0x1058f7=this;return new Promise(function(_0x23a175,_0x3d37c7){return db['VoiceCallReport'][_0x416f('0x21')](_0x5c03ad['body'],{'raw':_0x5c03ad[_0x416f('0x16')]?_0x5c03ad[_0x416f('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c03ad['options']?_0x5c03ad['options'][_0x416f('0x18')]||null:null,'attributes':_0x5c03ad[_0x416f('0x16')]?_0x5c03ad[_0x416f('0x16')]['attributes']||null:null,'limit':_0x5c03ad[_0x416f('0x16')]?_0x5c03ad['options'][_0x416f('0x22')]||null:null})[_0x416f('0xa')](function(_0x1f45f5){logger['info']('UpdateVoiceCallReport',_0x5c03ad);logger[_0x416f('0x1d')](_0x416f('0x20'),_0x5c03ad,JSON['stringify'](_0x1f45f5));_0x23a175(_0x1f45f5);})['catch'](function(_0x19febf){logger[_0x416f('0xf')](_0x416f('0x20'),_0x19febf[_0x416f('0x11')],_0x5c03ad);_0x3d37c7(_0x1058f7[_0x416f('0xf')](0x1f4,_0x19febf['message']));});});}; \ No newline at end of file +var _0x3c4a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceCallReport','findAll','options','attributes','include','model','map','GetVoiceCallReport','CreateVoiceCallReport','create','debug','update','where','limit','UpdateVoiceCallReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x3c4a,0x1f4));var _0xa3c4=function(_0x137d80,_0x4ca815){_0x137d80=_0x137d80-0x0;var _0x406c15=_0x3c4a[_0x137d80];return _0x406c15;};'use strict';var _=require(_0xa3c4('0x0'));var util=require(_0xa3c4('0x1'));var moment=require('moment');var BPromise=require(_0xa3c4('0x2'));var rs=require(_0xa3c4('0x3'));var fs=require('fs');var Redis=require(_0xa3c4('0x4'));var db=require(_0xa3c4('0x5'))['db'];var utils=require(_0xa3c4('0x6'));var logger=require(_0xa3c4('0x7'))(_0xa3c4('0x8'));var config=require(_0xa3c4('0x9'));var jayson=require(_0xa3c4('0xa'));var client=jayson[_0xa3c4('0xb')][_0xa3c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58f021,_0x54f83e,_0xa696e8){return new BPromise(function(_0x321abf,_0x99af7b){return client[_0xa3c4('0xd')](_0x58f021,_0xa696e8)[_0xa3c4('0xe')](function(_0x38dd22){logger[_0xa3c4('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x54f83e,'request\x20sent');logger['debug'](_0xa3c4('0x10'),_0x54f83e,_0xa3c4('0x11'),JSON[_0xa3c4('0x12')](_0x38dd22));if(_0x38dd22[_0xa3c4('0x13')]){if(_0x38dd22[_0xa3c4('0x13')][_0xa3c4('0x14')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x54f83e,_0x38dd22[_0xa3c4('0x13')][_0xa3c4('0x15')]);return _0x99af7b(_0x38dd22[_0xa3c4('0x13')]['message']);}logger[_0xa3c4('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x54f83e,_0x38dd22['error'][_0xa3c4('0x15')]);return _0x321abf(_0x38dd22['error'][_0xa3c4('0x15')]);}else{logger[_0xa3c4('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x54f83e,_0xa3c4('0x11'));_0x321abf(_0x38dd22[_0xa3c4('0x16')][_0xa3c4('0x15')]);}})[_0xa3c4('0x17')](function(_0x2c9341){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x54f83e,_0x2c9341);_0x99af7b(_0x2c9341);});});}exports['GetVoiceCallReport']=function(_0x37c305){var _0x19566a=this;return new Promise(function(_0x5c30d0,_0x505cad){return db[_0xa3c4('0x18')][_0xa3c4('0x19')]({'raw':_0x37c305['options']?_0x37c305[_0xa3c4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x37c305[_0xa3c4('0x1a')]?_0x37c305[_0xa3c4('0x1a')]['where']||null:null,'attributes':_0x37c305[_0xa3c4('0x1a')]?_0x37c305['options'][_0xa3c4('0x1b')]||null:null,'limit':_0x37c305['options']?_0x37c305[_0xa3c4('0x1a')]['limit']||null:null,'include':_0x37c305['options']?_0x37c305[_0xa3c4('0x1a')]['include']?_['map'](_0x37c305[_0xa3c4('0x1a')][_0xa3c4('0x1c')],function(_0x568f8f){return{'model':db[_0x568f8f[_0xa3c4('0x1d')]],'as':_0x568f8f['as'],'attributes':_0x568f8f[_0xa3c4('0x1b')],'include':_0x568f8f[_0xa3c4('0x1c')]?_[_0xa3c4('0x1e')](_0x568f8f[_0xa3c4('0x1c')],function(_0x3a4ce3){return{'model':db[_0x3a4ce3['model']],'as':_0x3a4ce3['as'],'attributes':_0x3a4ce3[_0xa3c4('0x1b')],'include':_0x3a4ce3[_0xa3c4('0x1c')]?_[_0xa3c4('0x1e')](_0x3a4ce3['include'],function(_0x386c87){return{'model':db[_0x386c87['model']],'as':_0x386c87['as'],'attributes':_0x386c87[_0xa3c4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa3c4('0xe')](function(_0x5903ae){logger[_0xa3c4('0xf')](_0xa3c4('0x1f'),_0x37c305);logger['debug'](_0xa3c4('0x1f'),_0x37c305,JSON[_0xa3c4('0x12')](_0x5903ae));_0x5c30d0(_0x5903ae);})['catch'](function(_0x3a4090){logger['error'](_0xa3c4('0x1f'),_0x3a4090[_0xa3c4('0x15')],_0x37c305);_0x505cad(_0x19566a[_0xa3c4('0x13')](0x1f4,_0x3a4090[_0xa3c4('0x15')]));});});};exports[_0xa3c4('0x20')]=function(_0x48c272){var _0x45d4c2=this;return new Promise(function(_0xf79084,_0x36a5fa){return db[_0xa3c4('0x18')][_0xa3c4('0x21')](_0x48c272['body'],{'raw':_0x48c272[_0xa3c4('0x1a')]?_0x48c272[_0xa3c4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xa3c4('0xe')](function(_0x12c00b){logger[_0xa3c4('0xf')](_0xa3c4('0x20'),_0x48c272);logger[_0xa3c4('0x22')](_0xa3c4('0x20'),_0x48c272,JSON[_0xa3c4('0x12')](_0x12c00b));_0xf79084(_0x12c00b);})[_0xa3c4('0x17')](function(_0x2abdee){logger[_0xa3c4('0x13')](_0xa3c4('0x20'),_0x2abdee[_0xa3c4('0x15')],_0x48c272);_0x36a5fa(_0x45d4c2[_0xa3c4('0x13')](0x1f4,_0x2abdee[_0xa3c4('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x500531){var _0x4ae47d=this;return new Promise(function(_0x4e3b36,_0x37bfad){return db[_0xa3c4('0x18')][_0xa3c4('0x23')](_0x500531['body'],{'raw':_0x500531['options']?_0x500531[_0xa3c4('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x500531['options']?_0x500531[_0xa3c4('0x1a')][_0xa3c4('0x24')]||null:null,'attributes':_0x500531['options']?_0x500531['options'][_0xa3c4('0x1b')]||null:null,'limit':_0x500531['options']?_0x500531['options'][_0xa3c4('0x25')]||null:null})[_0xa3c4('0xe')](function(_0x3c7087){logger[_0xa3c4('0xf')](_0xa3c4('0x26'),_0x500531);logger[_0xa3c4('0x22')](_0xa3c4('0x26'),_0x500531,JSON['stringify'](_0x3c7087));_0x4e3b36(_0x3c7087);})['catch'](function(_0x16cee3){logger[_0xa3c4('0x13')](_0xa3c4('0x26'),_0x16cee3[_0xa3c4('0x15')],_0x500531);_0x37bfad(_0x4ae47d[_0xa3c4('0x13')](0x1f4,_0x16cee3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ebe8c34..a9b60ac 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 _0x1dbb=['express','Router','../../components/interaction/service','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util','path'];(function(_0x54abaa,_0x2263a0){var _0x10fbb0=function(_0x3f108a){while(--_0x3f108a){_0x54abaa['push'](_0x54abaa['shift']());}};_0x10fbb0(++_0x2263a0);}(_0x1dbb,0xed));var _0xb1db=function(_0x1e70d1,_0x1bd4cf){_0x1e70d1=_0x1e70d1-0x0;var _0x151699=_0x1dbb[_0x1e70d1];return _0x151699;};'use strict';var multer=require(_0xb1db('0x0'));var util=require(_0xb1db('0x1'));var path=require(_0xb1db('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1db('0x3'));var router=express[_0xb1db('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb1db('0x5'));var config=require('../../config/environment');var controller=require(_0xb1db('0x6'));router[_0xb1db('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb1db('0x7')](_0xb1db('0x8'),auth[_0xb1db('0x9')](),controller[_0xb1db('0xa')]);router['post']('/',auth[_0xb1db('0x9')](),controller[_0xb1db('0xb')]);router[_0xb1db('0xc')]('/:id',auth[_0xb1db('0x9')](),controller[_0xb1db('0xd')]);router[_0xb1db('0xe')](_0xb1db('0x8'),auth[_0xb1db('0x9')](),controller['destroy']);module[_0xb1db('0xf')]=router; \ No newline at end of file +var _0xd90b=['destroy','exports','multer','connect-timeout','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x4166bd,_0x2e3d96){var _0x307655=function(_0x30b9d6){while(--_0x30b9d6){_0x4166bd['push'](_0x4166bd['shift']());}};_0x307655(++_0x2e3d96);}(_0xd90b,0xbd));var _0xbd90=function(_0x2640ee,_0x287559){_0x2640ee=_0x2640ee-0x0;var _0x5cb9b1=_0xd90b[_0x2640ee];return _0x5cb9b1;};'use strict';var multer=require(_0xbd90('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd90('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xbd90('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xbd90('0x3'));var controller=require(_0xbd90('0x4'));router[_0xbd90('0x5')]('/',auth[_0xbd90('0x6')](),controller[_0xbd90('0x7')]);router[_0xbd90('0x5')]('/:id',auth[_0xbd90('0x6')](),controller[_0xbd90('0x8')]);router[_0xbd90('0x9')]('/',auth[_0xbd90('0x6')](),controller[_0xbd90('0xa')]);router[_0xbd90('0xb')](_0xbd90('0xc'),auth[_0xbd90('0x6')](),controller[_0xbd90('0xd')]);router[_0xbd90('0xe')](_0xbd90('0xc'),auth['isAuthenticated'](),controller[_0xbd90('0xf')]);module[_0xbd90('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 379b5bf..772e34b 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 _0x7950=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x7950,0x158));var _0x0795=function(_0x4beed6,_0x40d50e){_0x4beed6=_0x4beed6-0x0;var _0xfda09d=_0x7950[_0x4beed6];return _0xfda09d;};'use strict';var Sequelize=require(_0x0795('0x0'));module[_0x0795('0x1')]={'name':{'type':Sequelize[_0x0795('0x2')]},'prefix':{'type':Sequelize[_0x0795('0x2')],'unique':_0x0795('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0795('0x2')],'set':function(_0x2daf01){this[_0x0795('0x4')](_0x0795('0x5'),_0x2daf01?_0x2daf01[_0x0795('0x6')](''):[]);},'get':function(){return this[_0x0795('0x7')](_0x0795('0x5'))?this['getDataValue'](_0x0795('0x5'))[_0x0795('0x8')](''):[];}},'auth':{'type':Sequelize[_0x0795('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x0795('0x2')]},'record':{'type':Sequelize[_0x0795('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0795('0x2')]}}; \ No newline at end of file +var _0x6bde=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x4db4a0,_0x1311a8){var _0x32126c=function(_0x138080){while(--_0x138080){_0x4db4a0['push'](_0x4db4a0['shift']());}};_0x32126c(++_0x1311a8);}(_0x6bde,0x91));var _0xe6bd=function(_0x17fef5,_0x422059){_0x17fef5=_0x17fef5-0x0;var _0x5338f2=_0x6bde[_0x17fef5];return _0x5338f2;};'use strict';var Sequelize=require(_0xe6bd('0x0'));module[_0xe6bd('0x1')]={'name':{'type':Sequelize[_0xe6bd('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xe6bd('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe6bd('0x2')],'set':function(_0x27e1a2){this[_0xe6bd('0x4')](_0xe6bd('0x5'),_0x27e1a2?_0x27e1a2[_0xe6bd('0x6')](''):[]);},'get':function(){return this[_0xe6bd('0x7')](_0xe6bd('0x5'))?this[_0xe6bd('0x7')](_0xe6bd('0x5'))[_0xe6bd('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xe6bd('0x2')]},'record':{'type':Sequelize[_0xe6bd('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe6bd('0x2')]},'description':{'type':Sequelize[_0xe6bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ee81a16..b4e9f1b 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 _0xd757=['intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','query','keys','filters'];(function(_0x207498,_0x560606){var _0x42f7cd=function(_0x196cf1){while(--_0x196cf1){_0x207498['push'](_0x207498['shift']());}};_0x42f7cd(++_0x560606);}(_0xd757,0x1bd));var _0x7d75=function(_0x1d216d,_0x1bcd03){_0x1d216d=_0x1d216d-0x0;var _0x292866=_0xd757[_0x1d216d];return _0x292866;};'use strict';var pdf=require(_0x7d75('0x0'));var emlformat=require(_0x7d75('0x1'));var rimraf=require(_0x7d75('0x2'));var zipdir=require(_0x7d75('0x3'));var jsonpatch=require(_0x7d75('0x4'));var rp=require(_0x7d75('0x5'));var moment=require(_0x7d75('0x6'));var BPromise=require(_0x7d75('0x7'));var Mustache=require(_0x7d75('0x8'));var util=require('util');var path=require(_0x7d75('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7d75('0xa'));var fs=require('fs');var _=require(_0x7d75('0xb'));var squel=require(_0x7d75('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d75('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7d75('0xe'));var querystring=require(_0x7d75('0xf'));var Papa=require('papaparse');var Redis=require(_0x7d75('0x10'));var authService=require(_0x7d75('0x11'));var qs=require(_0x7d75('0x12'));var as=require(_0x7d75('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d75('0x14'));var utils=require(_0x7d75('0x15'));var config=require(_0x7d75('0x16'));var db=require(_0x7d75('0x17'))['db'];function respondWithStatusCode(_0x42a415,_0x2da66b){_0x2da66b=_0x2da66b||0xcc;return function(_0x549fb6){if(_0x549fb6){return _0x42a415[_0x7d75('0x18')](_0x2da66b);}return _0x42a415[_0x7d75('0x19')](_0x2da66b)[_0x7d75('0x1a')]();};}function respondWithResult(_0x341177,_0x4c8f2f){_0x4c8f2f=_0x4c8f2f||0xc8;return function(_0x2ab9c7){if(_0x2ab9c7){return _0x341177[_0x7d75('0x19')](_0x4c8f2f)[_0x7d75('0x1b')](_0x2ab9c7);}};}function respondWithFilteredResult(_0x2a9e4d,_0x29e3c8){return function(_0x35a62f){if(_0x35a62f){var _0x355fdb=_0x35a62f[_0x7d75('0x1c')],_0x262d70=_0x29e3c8['offset'],_0x20d75c=_0x29e3c8[_0x7d75('0x1d')]+_0x29e3c8['limit'],_0x176a55;if(_0x20d75c>=_0x355fdb){_0x20d75c=_0x355fdb;_0x176a55=0xc8;}else{_0x176a55=0xce;}_0x2a9e4d['status'](_0x176a55);return _0x2a9e4d[_0x7d75('0x1e')](_0x7d75('0x1f'),_0x262d70+'-'+_0x20d75c+'/'+_0x355fdb)[_0x7d75('0x1b')](_0x35a62f);}return null;};}function patchUpdates(_0x4bc02d){return function(_0x334c65){try{jsonpatch['apply'](_0x334c65,_0x4bc02d,!![]);}catch(_0x3fe0a6){return BPromise[_0x7d75('0x20')](_0x3fe0a6);}return _0x334c65[_0x7d75('0x21')]();};}function saveUpdates(_0x165f70,_0x2ad9dc){return function(_0x1ae91e){if(_0x1ae91e){return _0x1ae91e[_0x7d75('0x22')](_0x165f70)[_0x7d75('0x23')](function(_0x270df2){return _0x270df2;});}return null;};}function removeEntity(_0x24a9be,_0x380584){return function(_0x313bf2){if(_0x313bf2){return _0x313bf2[_0x7d75('0x24')]()[_0x7d75('0x23')](function(){var _0x3fa3c2=_0x313bf2[_0x7d75('0x25')]({'plain':!![]});var _0x5585a5=_0x7d75('0x26');return db[_0x7d75('0x27')]['destroy']({'where':{'type':_0x5585a5,'resourceId':_0x3fa3c2['id']}})[_0x7d75('0x23')](function(){return _0x313bf2;});})['then'](function(){_0x24a9be[_0x7d75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a13d,_0xa27cfd){return function(_0x45ad9a){if(!_0x45ad9a){_0x32a13d[_0x7d75('0x18')](0x194);}return _0x45ad9a;};}function handleError(_0x18d14d,_0x1e545a){_0x1e545a=_0x1e545a||0x1f4;return function(_0x1e1dea){logger[_0x7d75('0x28')](_0x1e1dea[_0x7d75('0x29')]);if(_0x1e1dea[_0x7d75('0x2a')]){delete _0x1e1dea[_0x7d75('0x2a')];}_0x18d14d[_0x7d75('0x19')](_0x1e545a)[_0x7d75('0x2b')](_0x1e1dea);};}exports[_0x7d75('0x2c')]=function(_0x5cc1b2,_0x478a58){var _0xd4bba5={},_0x2eb3d0={},_0x3409c7={'count':0x0,'rows':[]};var _0x7f7610=_[_0x7d75('0x2d')](db[_0x7d75('0x2e')]['rawAttributes'],function(_0x1bd7f9){return{'name':_0x1bd7f9[_0x7d75('0x2f')],'type':_0x1bd7f9[_0x7d75('0x30')][_0x7d75('0x31')]};});_0x2eb3d0['model']=_[_0x7d75('0x2d')](_0x7f7610,_0x7d75('0x2a'));_0x2eb3d0[_0x7d75('0x32')]=_[_0x7d75('0x33')](_0x5cc1b2[_0x7d75('0x32')]);_0x2eb3d0[_0x7d75('0x34')]=_[_0x7d75('0x35')](_0x2eb3d0['model'],_0x2eb3d0[_0x7d75('0x32')]);_0xd4bba5[_0x7d75('0x36')]=_[_0x7d75('0x35')](_0x2eb3d0[_0x7d75('0x37')],qs['fields'](_0x5cc1b2[_0x7d75('0x32')][_0x7d75('0x38')]));_0xd4bba5[_0x7d75('0x36')]=_0xd4bba5[_0x7d75('0x36')][_0x7d75('0x39')]?_0xd4bba5[_0x7d75('0x36')]:_0x2eb3d0[_0x7d75('0x37')];if(!_0x5cc1b2[_0x7d75('0x32')][_0x7d75('0x3a')](_0x7d75('0x3b'))){_0xd4bba5[_0x7d75('0x3c')]=qs['limit'](_0x5cc1b2[_0x7d75('0x32')][_0x7d75('0x3c')]);_0xd4bba5[_0x7d75('0x1d')]=qs[_0x7d75('0x1d')](_0x5cc1b2[_0x7d75('0x32')][_0x7d75('0x1d')]);}_0xd4bba5[_0x7d75('0x3d')]=qs[_0x7d75('0x3e')](_0x5cc1b2[_0x7d75('0x32')][_0x7d75('0x3e')]);_0xd4bba5[_0x7d75('0x3f')]=qs[_0x7d75('0x34')](_['pick'](_0x5cc1b2[_0x7d75('0x32')],_0x2eb3d0[_0x7d75('0x34')]),_0x7f7610);if(_0x5cc1b2[_0x7d75('0x32')][_0x7d75('0x40')]){_0xd4bba5[_0x7d75('0x3f')]=_['merge'](_0xd4bba5[_0x7d75('0x3f')],{'$or':_[_0x7d75('0x2d')](_0x7f7610,function(_0x1b4dfb){if(_0x1b4dfb[_0x7d75('0x30')]!==_0x7d75('0x41')){var _0x503c3b={};_0x503c3b[_0x1b4dfb['name']]={'$like':'%'+_0x5cc1b2[_0x7d75('0x32')][_0x7d75('0x40')]+'%'};return _0x503c3b;}})});}_0xd4bba5=_['merge']({},_0xd4bba5,_0x5cc1b2['options']);var _0x4fec12={'where':_0xd4bba5[_0x7d75('0x3f')]};return db['VoiceChanSpy'][_0x7d75('0x1c')](_0x4fec12)[_0x7d75('0x23')](function(_0x2c775e){_0x3409c7[_0x7d75('0x1c')]=_0x2c775e;if(_0x5cc1b2['query'][_0x7d75('0x42')]){_0xd4bba5[_0x7d75('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x7d75('0x44')](_0xd4bba5);})[_0x7d75('0x23')](function(_0x5264a2){_0x3409c7[_0x7d75('0x45')]=_0x5264a2;return _0x3409c7;})[_0x7d75('0x23')](respondWithFilteredResult(_0x478a58,_0xd4bba5))[_0x7d75('0x46')](handleError(_0x478a58,null));};exports[_0x7d75('0x47')]=function(_0x3482d6,_0x40cd4b){var _0x1bb4bd={'raw':![],'where':{'id':_0x3482d6[_0x7d75('0x48')]['id']}},_0x26674d={};_0x26674d[_0x7d75('0x37')]=_[_0x7d75('0x33')](db[_0x7d75('0x2e')]['rawAttributes']);_0x26674d[_0x7d75('0x32')]=_[_0x7d75('0x33')](_0x3482d6['query']);_0x26674d[_0x7d75('0x34')]=_[_0x7d75('0x35')](_0x26674d['model'],_0x26674d[_0x7d75('0x32')]);_0x1bb4bd[_0x7d75('0x36')]=_[_0x7d75('0x35')](_0x26674d[_0x7d75('0x37')],qs[_0x7d75('0x38')](_0x3482d6['query']['fields']));_0x1bb4bd[_0x7d75('0x36')]=_0x1bb4bd[_0x7d75('0x36')]['length']?_0x1bb4bd['attributes']:_0x26674d[_0x7d75('0x37')];if(_0x3482d6[_0x7d75('0x32')][_0x7d75('0x42')]){_0x1bb4bd[_0x7d75('0x43')]=[{'all':!![]}];}_0x1bb4bd=_[_0x7d75('0x49')]({},_0x1bb4bd,_0x3482d6[_0x7d75('0x4a')]);return db[_0x7d75('0x2e')]['find'](_0x1bb4bd)[_0x7d75('0x23')](handleEntityNotFound(_0x40cd4b,null))[_0x7d75('0x23')](respondWithResult(_0x40cd4b,null))[_0x7d75('0x46')](handleError(_0x40cd4b,null));};exports[_0x7d75('0x4b')]=function(_0x51a2d4,_0x210226){return db[_0x7d75('0x2e')][_0x7d75('0x4b')](_0x51a2d4['body'],{})[_0x7d75('0x23')](function(_0xbe26e7){var _0x382476=_0x51a2d4[_0x7d75('0x4c')][_0x7d75('0x25')]({'plain':!![]});if(!_0x382476)throw new Error(_0x7d75('0x4d'));if(_0x382476[_0x7d75('0x4e')]===_0x7d75('0x4c')){var _0x3647fb=_0xbe26e7[_0x7d75('0x25')]({'plain':!![]});var _0x2a6513=_0x7d75('0x26');return db['UserProfileSection'][_0x7d75('0x4f')]({'where':{'name':_0x2a6513,'userProfileId':_0x382476['userProfileId']},'raw':!![]})[_0x7d75('0x23')](function(_0x43b30e){if(_0x43b30e&&_0x43b30e[_0x7d75('0x50')]===0x0){return db[_0x7d75('0x27')]['create']({'name':_0x3647fb[_0x7d75('0x2a')],'resourceId':_0x3647fb['id'],'type':_0x43b30e[_0x7d75('0x2a')],'sectionId':_0x43b30e['id']},{})[_0x7d75('0x23')](function(){return _0xbe26e7;});}else{return _0xbe26e7;}})['catch'](function(_0x42f731){logger[_0x7d75('0x28')](_0x7d75('0x51'),_0x42f731);throw _0x42f731;});}return _0xbe26e7;})[_0x7d75('0x23')](respondWithResult(_0x210226,0xc9))['catch'](handleError(_0x210226,null));};exports[_0x7d75('0x22')]=function(_0x44cf78,_0x3d7a52){if(_0x44cf78[_0x7d75('0x52')]['id']){delete _0x44cf78[_0x7d75('0x52')]['id'];}return db['VoiceChanSpy'][_0x7d75('0x4f')]({'where':{'id':_0x44cf78[_0x7d75('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d7a52,null))[_0x7d75('0x23')](saveUpdates(_0x44cf78[_0x7d75('0x52')],null))['then'](respondWithResult(_0x3d7a52,null))['catch'](handleError(_0x3d7a52,null));};exports[_0x7d75('0x24')]=function(_0x3afabc,_0x335cca){return db[_0x7d75('0x2e')][_0x7d75('0x4f')]({'where':{'id':_0x3afabc['params']['id']}})[_0x7d75('0x23')](handleEntityNotFound(_0x335cca,null))[_0x7d75('0x23')](removeEntity(_0x335cca,null))['catch'](handleError(_0x335cca,null));}; \ No newline at end of file +var _0x9857=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','VoiceChanSpy','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','user','role'];(function(_0x35c630,_0x2b7b65){var _0xae9371=function(_0x3ed448){while(--_0x3ed448){_0x35c630['push'](_0x35c630['shift']());}};_0xae9371(++_0x2b7b65);}(_0x9857,0xb1));var _0x7985=function(_0x348a3a,_0x147d3d){_0x348a3a=_0x348a3a-0x0;var _0x40e259=_0x9857[_0x348a3a];return _0x40e259;};'use strict';var pdf=require(_0x7985('0x0'));var emlformat=require(_0x7985('0x1'));var rimraf=require(_0x7985('0x2'));var zipdir=require(_0x7985('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7985('0x4'));var moment=require(_0x7985('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7985('0x6'));var path=require(_0x7985('0x7'));var sox=require(_0x7985('0x8'));var csv=require(_0x7985('0x9'));var ejs=require(_0x7985('0xa'));var fs=require('fs');var _=require(_0x7985('0xb'));var squel=require(_0x7985('0xc'));var crypto=require(_0x7985('0xd'));var jsforce=require(_0x7985('0xe'));var deskjs=require(_0x7985('0xf'));var toCsv=require(_0x7985('0x9'));var querystring=require(_0x7985('0x10'));var Papa=require(_0x7985('0x11'));var Redis=require(_0x7985('0x12'));var authService=require(_0x7985('0x13'));var qs=require(_0x7985('0x14'));var as=require(_0x7985('0x15'));var hardwareService=require(_0x7985('0x16'));var logger=require(_0x7985('0x17'))(_0x7985('0x18'));var utils=require(_0x7985('0x19'));var config=require(_0x7985('0x1a'));var db=require(_0x7985('0x1b'))['db'];function respondWithStatusCode(_0x6a017a,_0x1ce629){_0x1ce629=_0x1ce629||0xcc;return function(_0x493185){if(_0x493185){return _0x6a017a[_0x7985('0x1c')](_0x1ce629);}return _0x6a017a[_0x7985('0x1d')](_0x1ce629)[_0x7985('0x1e')]();};}function respondWithResult(_0x3c2f49,_0x599c9a){_0x599c9a=_0x599c9a||0xc8;return function(_0xe14518){if(_0xe14518){return _0x3c2f49[_0x7985('0x1d')](_0x599c9a)['json'](_0xe14518);}};}function respondWithFilteredResult(_0x127a84,_0x8da42a){return function(_0x823992){if(_0x823992){var _0x28b4ff=_0x823992[_0x7985('0x1f')],_0x41a832=_0x8da42a[_0x7985('0x20')],_0x2ee200=_0x8da42a[_0x7985('0x20')]+_0x8da42a['limit'],_0x27152c;if(_0x2ee200>=_0x28b4ff){_0x2ee200=_0x28b4ff;_0x27152c=0xc8;}else{_0x27152c=0xce;}_0x127a84['status'](_0x27152c);return _0x127a84['set'](_0x7985('0x21'),_0x41a832+'-'+_0x2ee200+'/'+_0x28b4ff)[_0x7985('0x22')](_0x823992);}return null;};}function patchUpdates(_0x3a5188){return function(_0x2bda03){try{jsonpatch[_0x7985('0x23')](_0x2bda03,_0x3a5188,!![]);}catch(_0x2905fe){return BPromise[_0x7985('0x24')](_0x2905fe);}return _0x2bda03[_0x7985('0x25')]();};}function saveUpdates(_0x2afbff,_0x58f59a){return function(_0x5ded77){if(_0x5ded77){return _0x5ded77[_0x7985('0x26')](_0x2afbff)[_0x7985('0x27')](function(_0x52fe99){return _0x52fe99;});}return null;};}function removeEntity(_0x642744,_0x53c0b9){return function(_0x9db966){if(_0x9db966){return _0x9db966[_0x7985('0x28')]()['then'](function(){var _0x3c8d39=_0x9db966[_0x7985('0x29')]({'plain':!![]});var _0xda2470=_0x7985('0x2a');return db[_0x7985('0x2b')][_0x7985('0x28')]({'where':{'type':_0xda2470,'resourceId':_0x3c8d39['id']}})[_0x7985('0x27')](function(){return _0x9db966;});})[_0x7985('0x27')](function(){_0x642744[_0x7985('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32eee4,_0x7286fa){return function(_0x26fb0e){if(!_0x26fb0e){_0x32eee4[_0x7985('0x1c')](0x194);}return _0x26fb0e;};}function handleError(_0x58fd61,_0x58ad84){_0x58ad84=_0x58ad84||0x1f4;return function(_0x282636){logger[_0x7985('0x2c')](_0x282636['stack']);if(_0x282636['name']){delete _0x282636[_0x7985('0x2d')];}_0x58fd61[_0x7985('0x1d')](_0x58ad84)[_0x7985('0x2e')](_0x282636);};}exports['index']=function(_0x51f218,_0xe323ca){var _0x54fc8f={},_0x12dc3b={},_0x4cf4ce={'count':0x0,'rows':[]};var _0x524c6a=_['map'](db[_0x7985('0x2f')]['rawAttributes'],function(_0x53c5ce){return{'name':_0x53c5ce['fieldName'],'type':_0x53c5ce[_0x7985('0x30')][_0x7985('0x31')]};});_0x12dc3b[_0x7985('0x32')]=_[_0x7985('0x33')](_0x524c6a,_0x7985('0x2d'));_0x12dc3b[_0x7985('0x34')]=_[_0x7985('0x35')](_0x51f218['query']);_0x12dc3b['filters']=_[_0x7985('0x36')](_0x12dc3b[_0x7985('0x32')],_0x12dc3b[_0x7985('0x34')]);_0x54fc8f['attributes']=_[_0x7985('0x36')](_0x12dc3b[_0x7985('0x32')],qs[_0x7985('0x37')](_0x51f218[_0x7985('0x34')][_0x7985('0x37')]));_0x54fc8f[_0x7985('0x38')]=_0x54fc8f[_0x7985('0x38')][_0x7985('0x39')]?_0x54fc8f['attributes']:_0x12dc3b[_0x7985('0x32')];if(!_0x51f218[_0x7985('0x34')][_0x7985('0x3a')](_0x7985('0x3b'))){_0x54fc8f[_0x7985('0x3c')]=qs['limit'](_0x51f218['query'][_0x7985('0x3c')]);_0x54fc8f[_0x7985('0x20')]=qs[_0x7985('0x20')](_0x51f218[_0x7985('0x34')][_0x7985('0x20')]);}_0x54fc8f['order']=qs[_0x7985('0x3d')](_0x51f218[_0x7985('0x34')]['sort']);_0x54fc8f[_0x7985('0x3e')]=qs[_0x7985('0x3f')](_[_0x7985('0x40')](_0x51f218[_0x7985('0x34')],_0x12dc3b[_0x7985('0x3f')]),_0x524c6a);if(_0x51f218[_0x7985('0x34')][_0x7985('0x41')]){_0x54fc8f[_0x7985('0x3e')]=_[_0x7985('0x42')](_0x54fc8f[_0x7985('0x3e')],{'$or':_['map'](_0x524c6a,function(_0x61c472){if(_0x61c472[_0x7985('0x30')]!==_0x7985('0x43')){var _0x5c9f31={};_0x5c9f31[_0x61c472[_0x7985('0x2d')]]={'$like':'%'+_0x51f218[_0x7985('0x34')]['filter']+'%'};return _0x5c9f31;}})});}_0x54fc8f=_[_0x7985('0x42')]({},_0x54fc8f,_0x51f218[_0x7985('0x44')]);var _0x3e8c88={'where':_0x54fc8f[_0x7985('0x3e')]};return db['VoiceChanSpy']['count'](_0x3e8c88)[_0x7985('0x27')](function(_0x1a1c2b){_0x4cf4ce['count']=_0x1a1c2b;if(_0x51f218['query']['includeAll']){_0x54fc8f['include']=[{'all':!![]}];}return db[_0x7985('0x2f')][_0x7985('0x45')](_0x54fc8f);})[_0x7985('0x27')](function(_0x526101){_0x4cf4ce[_0x7985('0x46')]=_0x526101;return _0x4cf4ce;})[_0x7985('0x27')](respondWithFilteredResult(_0xe323ca,_0x54fc8f))[_0x7985('0x47')](handleError(_0xe323ca,null));};exports[_0x7985('0x48')]=function(_0x45cfc2,_0x16b77c){var _0x2d2145={'raw':![],'where':{'id':_0x45cfc2['params']['id']}},_0x22c773={};_0x22c773[_0x7985('0x32')]=_[_0x7985('0x35')](db['VoiceChanSpy'][_0x7985('0x49')]);_0x22c773['query']=_[_0x7985('0x35')](_0x45cfc2[_0x7985('0x34')]);_0x22c773[_0x7985('0x3f')]=_[_0x7985('0x36')](_0x22c773[_0x7985('0x32')],_0x22c773[_0x7985('0x34')]);_0x2d2145['attributes']=_[_0x7985('0x36')](_0x22c773[_0x7985('0x32')],qs[_0x7985('0x37')](_0x45cfc2[_0x7985('0x34')]['fields']));_0x2d2145[_0x7985('0x38')]=_0x2d2145['attributes'][_0x7985('0x39')]?_0x2d2145[_0x7985('0x38')]:_0x22c773[_0x7985('0x32')];if(_0x45cfc2[_0x7985('0x34')][_0x7985('0x4a')]){_0x2d2145[_0x7985('0x4b')]=[{'all':!![]}];}_0x2d2145=_[_0x7985('0x42')]({},_0x2d2145,_0x45cfc2[_0x7985('0x44')]);return db[_0x7985('0x2f')][_0x7985('0x4c')](_0x2d2145)[_0x7985('0x27')](handleEntityNotFound(_0x16b77c,null))['then'](respondWithResult(_0x16b77c,null))['catch'](handleError(_0x16b77c,null));};exports[_0x7985('0x4d')]=function(_0x21a8fb,_0xb0df02){return db[_0x7985('0x2f')][_0x7985('0x4d')](_0x21a8fb[_0x7985('0x4e')],{})[_0x7985('0x27')](function(_0x7d54f){var _0x4eb5b4=_0x21a8fb[_0x7985('0x4f')]['get']({'plain':!![]});if(!_0x4eb5b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4eb5b4[_0x7985('0x50')]===_0x7985('0x4f')){var _0x4669f5=_0x7d54f[_0x7985('0x29')]({'plain':!![]});var _0x6b6a19=_0x7985('0x2a');return db[_0x7985('0x51')]['find']({'where':{'name':_0x6b6a19,'userProfileId':_0x4eb5b4[_0x7985('0x52')]},'raw':!![]})[_0x7985('0x27')](function(_0x3d90cf){if(_0x3d90cf&&_0x3d90cf[_0x7985('0x53')]===0x0){return db[_0x7985('0x2b')][_0x7985('0x4d')]({'name':_0x4669f5[_0x7985('0x2d')],'resourceId':_0x4669f5['id'],'type':_0x3d90cf[_0x7985('0x2d')],'sectionId':_0x3d90cf['id']},{})[_0x7985('0x27')](function(){return _0x7d54f;});}else{return _0x7d54f;}})[_0x7985('0x47')](function(_0x51b712){logger[_0x7985('0x2c')](_0x7985('0x54'),_0x51b712);throw _0x51b712;});}return _0x7d54f;})[_0x7985('0x27')](respondWithResult(_0xb0df02,0xc9))[_0x7985('0x47')](handleError(_0xb0df02,null));};exports[_0x7985('0x26')]=function(_0x4f9f05,_0x2f973e){if(_0x4f9f05[_0x7985('0x4e')]['id']){delete _0x4f9f05[_0x7985('0x4e')]['id'];}return db[_0x7985('0x2f')][_0x7985('0x4c')]({'where':{'id':_0x4f9f05[_0x7985('0x55')]['id']}})[_0x7985('0x27')](handleEntityNotFound(_0x2f973e,null))[_0x7985('0x27')](saveUpdates(_0x4f9f05['body'],null))['then'](respondWithResult(_0x2f973e,null))[_0x7985('0x47')](handleError(_0x2f973e,null));};exports['destroy']=function(_0x3becaa,_0x9a580a){return db['VoiceChanSpy'][_0x7985('0x4c')]({'where':{'id':_0x3becaa[_0x7985('0x55')]['id']}})[_0x7985('0x27')](handleEntityNotFound(_0x9a580a,null))[_0x7985('0x27')](removeEntity(_0x9a580a,null))[_0x7985('0x47')](handleError(_0x9a580a,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f2dd7ea..40236c3 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 _0x62ec=['bulkCreate','VoiceExtension','destroy','length','util','./voiceChanSpy.attributes','from-sip','format','%s%s','merge','Set','CDR(type)=%s','chanspy','MixMonitor','recordingFormat','auth','push','ChanSpy','options','join','StopMixMonitor','concat','internal','name','User','findAll','agent','then','catch','exports','models','define','voice_chanspy'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x62ec,0xca));var _0xc62e=function(_0x500a6c,_0x3d0f6c){_0x500a6c=_0x500a6c-0x0;var _0x5d9083=_0x62ec[_0x500a6c];return _0x5d9083;};'use strict';var _=require('lodash');var util=require(_0xc62e('0x0'));var BPromise=require('bluebird');var attributes=require(_0xc62e('0x1'));var getUserApplications=function(_0x11b275,_0x456f7d,_0x3d07ef){var _0x5214ba=0x1;var _0x2d9670=[];var _0x4323b1={'context':_0x456f7d['context']||_0xc62e('0x2'),'exten':util[_0xc62e('0x3')](_0xc62e('0x4'),_0x11b275['prefix'],_0x3d07ef),'type':'system','isApp':![],'ChanSpyId':_0x11b275['id'],'UserId':_0x456f7d['id']};_0x2d9670['push'](_[_0xc62e('0x5')]({'app':_0xc62e('0x6'),'appdata':util['format'](_0xc62e('0x7'),_0xc62e('0x8')),'priority':_0x5214ba++},_0x4323b1));if(_0x11b275['record']){_0x2d9670['push'](_[_0xc62e('0x5')]({'app':_0xc62e('0x9'),'appdata':util[_0xc62e('0x3')]('${UNIQUEID}.%s,a',_0x11b275[_0xc62e('0xa')]),'priority':_0x5214ba++},_0x4323b1));}if(_0x11b275[_0xc62e('0xb')]){_0x2d9670[_0xc62e('0xc')](_[_0xc62e('0x5')]({'app':'Authenticate','appdata':_0x11b275['password'],'priority':_0x5214ba++},_0x4323b1));}_0x2d9670[_0xc62e('0xc')](_[_0xc62e('0x5')]({'app':_0xc62e('0xd'),'appdata':util[_0xc62e('0x3')]('SIP/%s,%s',_0x456f7d['name'],_0x11b275[_0xc62e('0xe')]?_0x11b275[_0xc62e('0xe')][_0xc62e('0xf')](''):''),'priority':_0x5214ba++},_0x4323b1));if(_0x11b275['record']){_0x2d9670[_0xc62e('0xc')](_[_0xc62e('0x5')]({'app':_0xc62e('0x10'),'priority':_0x5214ba++},_0x4323b1));}return _0x2d9670;};var getChanSpyApplications=function(_0x57ff13,_0x44bb66){var _0x58ba5f=[];for(var _0x5e24a1=0x0,_0xee7c99=0x1;_0x5e24a1<_0x44bb66['length'];_0x5e24a1++,_0xee7c99=0x1){_0x58ba5f=_0x58ba5f[_0xc62e('0x11')](getUserApplications(_0x57ff13,_0x44bb66[_0x5e24a1],_0x44bb66[_0x5e24a1]['internal']));if(_0x44bb66[_0x5e24a1][_0xc62e('0x12')]!=_0x44bb66[_0x5e24a1][_0xc62e('0x13')]){_0x58ba5f=_0x58ba5f[_0xc62e('0x11')](getUserApplications(_0x57ff13,_0x44bb66[_0x5e24a1],_0x44bb66[_0x5e24a1]['name']));}}return _0x58ba5f;};var getChanSpyPromise=function(_0xde5265,_0x1584e6){return new BPromise(function(_0x572d9e,_0x4b3bff){return _0xde5265[_0xc62e('0x14')][_0xc62e('0x15')]({'attributes':['id',_0xc62e('0x13'),_0xc62e('0x12')],'where':{'role':_0xc62e('0x16'),'chanspy':!![]},'raw':!![]})[_0xc62e('0x17')](function(_0x690f98){if(_0x690f98){return _0x572d9e(getChanSpyApplications(_0x1584e6,_0x690f98));}return _0x572d9e([]);})[_0xc62e('0x18')](function(_0x177b52){_0x4b3bff(_0x177b52);});});};module[_0xc62e('0x19')]=function(_0x16df4d,_0x4b8693){var _0x1c548f=_0x16df4d[_0xc62e('0x1a')];return _0x16df4d[_0xc62e('0x1b')]('VoiceChanSpy',attributes,{'tableName':_0xc62e('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x59264d,_0x242f37,_0x407ad6){return getChanSpyPromise(_0x1c548f,_0x59264d)[_0xc62e('0x17')](function(_0x526f2b){if(_0x526f2b&&_0x526f2b['length']){return _0x1c548f['VoiceExtension'][_0xc62e('0x1d')](_0x526f2b);}})['then'](function(){_0x407ad6();})['catch'](function(_0x3a01b1){_0x407ad6(_0x3a01b1);});},'afterUpdate':function(_0x294002,_0x1abd60,_0x139ee9){return _0x1c548f[_0xc62e('0x1e')][_0xc62e('0x1f')]({'where':{'ChanSpyId':_0x294002['id']}})[_0xc62e('0x17')](function(){return getChanSpyPromise(_0x1c548f,_0x294002);})[_0xc62e('0x17')](function(_0x1d6397){if(_0x1d6397&&_0x1d6397[_0xc62e('0x20')]){return _0x1c548f[_0xc62e('0x1e')][_0xc62e('0x1d')](_0x1d6397);}})[_0xc62e('0x17')](function(){_0x139ee9();})[_0xc62e('0x18')](function(_0x4f1eec){_0x139ee9(_0x4f1eec);});},'afterDestroy':function(_0x117293,_0x10066f,_0x1e8a48){return _0x1c548f[_0xc62e('0x1e')][_0xc62e('0x1f')]({'where':{'ChanSpyId':_0x117293['id']}})[_0xc62e('0x17')](function(){_0x1e8a48();})[_0xc62e('0x18')](function(_0x292aaf){_0x1e8a48(_0x292aaf);});}}});}; \ No newline at end of file +var _0x4c48=['system','merge','CDR(type)=%s','chanspy','record','push','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','SIP/%s,%s','options','StopMixMonitor','concat','internal','name','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix'];(function(_0x4036d4,_0x5994ab){var _0x3bc2a4=function(_0x4303f7){while(--_0x4303f7){_0x4036d4['push'](_0x4036d4['shift']());}};_0x3bc2a4(++_0x5994ab);}(_0x4c48,0x1e4));var _0x84c4=function(_0xda6ad1,_0x5f09e3){_0xda6ad1=_0xda6ad1-0x0;var _0xedc3a5=_0x4c48[_0xda6ad1];return _0xedc3a5;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x84c4('0x0'));var attributes=require(_0x84c4('0x1'));var getUserApplications=function(_0x35de8a,_0x1cb172,_0x4279a6){var _0x5524db=0x1;var _0x5302e8=[];var _0x14b669={'context':_0x1cb172[_0x84c4('0x2')]||_0x84c4('0x3'),'exten':util[_0x84c4('0x4')]('%s%s',_0x35de8a[_0x84c4('0x5')],_0x4279a6),'type':_0x84c4('0x6'),'isApp':![],'ChanSpyId':_0x35de8a['id'],'UserId':_0x1cb172['id']};_0x5302e8['push'](_[_0x84c4('0x7')]({'app':'Set','appdata':util['format'](_0x84c4('0x8'),_0x84c4('0x9')),'priority':_0x5524db++},_0x14b669));if(_0x35de8a[_0x84c4('0xa')]){_0x5302e8[_0x84c4('0xb')](_[_0x84c4('0x7')]({'app':'MixMonitor','appdata':util[_0x84c4('0x4')](_0x84c4('0xc'),_0x35de8a[_0x84c4('0xd')]),'priority':_0x5524db++},_0x14b669));}if(_0x35de8a['auth']){_0x5302e8[_0x84c4('0xb')](_[_0x84c4('0x7')]({'app':_0x84c4('0xe'),'appdata':_0x35de8a[_0x84c4('0xf')],'priority':_0x5524db++},_0x14b669));}_0x5302e8['push'](_[_0x84c4('0x7')]({'app':'ChanSpy','appdata':util[_0x84c4('0x4')](_0x84c4('0x10'),_0x1cb172['name'],_0x35de8a['options']?_0x35de8a[_0x84c4('0x11')]['join'](''):''),'priority':_0x5524db++},_0x14b669));if(_0x35de8a[_0x84c4('0xa')]){_0x5302e8[_0x84c4('0xb')](_['merge']({'app':_0x84c4('0x12'),'priority':_0x5524db++},_0x14b669));}return _0x5302e8;};var getChanSpyApplications=function(_0x3eb625,_0x27a4ef){var _0x430562=[];for(var _0x2e388a=0x0,_0xc94428=0x1;_0x2e388a<_0x27a4ef['length'];_0x2e388a++,_0xc94428=0x1){_0x430562=_0x430562[_0x84c4('0x13')](getUserApplications(_0x3eb625,_0x27a4ef[_0x2e388a],_0x27a4ef[_0x2e388a][_0x84c4('0x14')]));if(_0x27a4ef[_0x2e388a]['internal']!=_0x27a4ef[_0x2e388a]['name']){_0x430562=_0x430562[_0x84c4('0x13')](getUserApplications(_0x3eb625,_0x27a4ef[_0x2e388a],_0x27a4ef[_0x2e388a][_0x84c4('0x15')]));}}return _0x430562;};var getChanSpyPromise=function(_0x3de380,_0x27716d){return new BPromise(function(_0x20e3ef,_0x167ae){return _0x3de380[_0x84c4('0x16')][_0x84c4('0x17')]({'attributes':['id',_0x84c4('0x15'),_0x84c4('0x14')],'where':{'role':_0x84c4('0x18'),'chanspy':!![]},'raw':!![]})[_0x84c4('0x19')](function(_0x370ea9){if(_0x370ea9){return _0x20e3ef(getChanSpyApplications(_0x27716d,_0x370ea9));}return _0x20e3ef([]);})[_0x84c4('0x1a')](function(_0x5f1804){_0x167ae(_0x5f1804);});});};module[_0x84c4('0x1b')]=function(_0x2681e8,_0x2f8864){var _0x325780=_0x2681e8['models'];return _0x2681e8[_0x84c4('0x1c')](_0x84c4('0x1d'),attributes,{'tableName':_0x84c4('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a8153,_0x16cf4b,_0x3cb8c6){return getChanSpyPromise(_0x325780,_0x5a8153)[_0x84c4('0x19')](function(_0x46c126){if(_0x46c126&&_0x46c126[_0x84c4('0x1f')]){return _0x325780[_0x84c4('0x20')][_0x84c4('0x21')](_0x46c126);}})[_0x84c4('0x19')](function(){_0x3cb8c6();})['catch'](function(_0x196d4d){_0x3cb8c6(_0x196d4d);});},'afterUpdate':function(_0x2e4911,_0x4091a6,_0x342309){return _0x325780[_0x84c4('0x20')][_0x84c4('0x22')]({'where':{'ChanSpyId':_0x2e4911['id']}})[_0x84c4('0x19')](function(){return getChanSpyPromise(_0x325780,_0x2e4911);})[_0x84c4('0x19')](function(_0x5c1b13){if(_0x5c1b13&&_0x5c1b13['length']){return _0x325780['VoiceExtension'][_0x84c4('0x21')](_0x5c1b13);}})[_0x84c4('0x19')](function(){_0x342309();})[_0x84c4('0x1a')](function(_0x39135c){_0x342309(_0x39135c);});},'afterDestroy':function(_0x454f3e,_0x2dccad,_0x14a96a){return _0x325780[_0x84c4('0x20')]['destroy']({'where':{'ChanSpyId':_0x454f3e['id']}})[_0x84c4('0x19')](function(){_0x14a96a();})['catch'](function(_0x1a750d){_0x14a96a(_0x1a750d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 50df8bb..8de752b 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 _0x1331=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1331,0xcc));var _0x1133=function(_0x5b0d5d,_0x69f51d){_0x5b0d5d=_0x5b0d5d-0x0;var _0xcedfcc=_0x1331[_0x5b0d5d];return _0xcedfcc;};'use strict';var _=require(_0x1133('0x0'));var util=require(_0x1133('0x1'));var moment=require(_0x1133('0x2'));var BPromise=require(_0x1133('0x3'));var rs=require(_0x1133('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1133('0x5'));var logger=require(_0x1133('0x6'))(_0x1133('0x7'));var config=require(_0x1133('0x8'));var jayson=require(_0x1133('0x9'));var client=jayson[_0x1133('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54169a,_0x1d5389,_0x11670b){return new BPromise(function(_0x104801,_0x4f9ef3){return client[_0x1133('0xb')](_0x54169a,_0x11670b)[_0x1133('0xc')](function(_0x459a2f){logger[_0x1133('0xd')](_0x1133('0xe'),_0x1d5389,'request\x20sent');logger[_0x1133('0xf')](_0x1133('0x10'),_0x1d5389,_0x1133('0x11'),JSON['stringify'](_0x459a2f));if(_0x459a2f[_0x1133('0x12')]){if(_0x459a2f[_0x1133('0x12')]['code']===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x1d5389,_0x459a2f[_0x1133('0x12')][_0x1133('0x13')]);return _0x4f9ef3(_0x459a2f[_0x1133('0x12')]['message']);}logger[_0x1133('0x12')](_0x1133('0xe'),_0x1d5389,_0x459a2f[_0x1133('0x12')]['message']);return _0x104801(_0x459a2f[_0x1133('0x12')][_0x1133('0x13')]);}else{logger['info'](_0x1133('0xe'),_0x1d5389,_0x1133('0x11'));_0x104801(_0x459a2f[_0x1133('0x14')][_0x1133('0x13')]);}})[_0x1133('0x15')](function(_0x42f70c){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x1d5389,_0x42f70c);_0x4f9ef3(_0x42f70c);});});} \ No newline at end of file +var _0x6bee=['info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3edb26,_0x9613b4){var _0x4ad9f5=function(_0x5cb828){while(--_0x5cb828){_0x3edb26['push'](_0x3edb26['shift']());}};_0x4ad9f5(++_0x9613b4);}(_0x6bee,0x163));var _0xe6be=function(_0x77a862,_0x8e62be){_0x77a862=_0x77a862-0x0;var _0x3ecaf1=_0x6bee[_0x77a862];return _0x3ecaf1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe6be('0x0'));var BPromise=require(_0xe6be('0x1'));var rs=require(_0xe6be('0x2'));var fs=require('fs');var Redis=require(_0xe6be('0x3'));var db=require(_0xe6be('0x4'))['db'];var utils=require(_0xe6be('0x5'));var logger=require(_0xe6be('0x6'))(_0xe6be('0x7'));var config=require(_0xe6be('0x8'));var jayson=require(_0xe6be('0x9'));var client=jayson['client'][_0xe6be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d20c2,_0x4367cc,_0x159fc5){return new BPromise(function(_0x1a1085,_0x4f73a3){return client[_0xe6be('0xb')](_0x5d20c2,_0x159fc5)[_0xe6be('0xc')](function(_0x45df8f){logger[_0xe6be('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x4367cc,_0xe6be('0xe'));logger[_0xe6be('0xf')](_0xe6be('0x10'),_0x4367cc,_0xe6be('0xe'),JSON[_0xe6be('0x11')](_0x45df8f));if(_0x45df8f[_0xe6be('0x12')]){if(_0x45df8f[_0xe6be('0x12')][_0xe6be('0x13')]===0x1f4){logger['error'](_0xe6be('0x14'),_0x4367cc,_0x45df8f[_0xe6be('0x12')][_0xe6be('0x15')]);return _0x4f73a3(_0x45df8f['error'][_0xe6be('0x15')]);}logger[_0xe6be('0x12')](_0xe6be('0x14'),_0x4367cc,_0x45df8f[_0xe6be('0x12')]['message']);return _0x1a1085(_0x45df8f['error']['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4367cc,_0xe6be('0xe'));_0x1a1085(_0x45df8f[_0xe6be('0x16')]['message']);}})['catch'](function(_0x4a3390){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4367cc,_0x4a3390);_0x4f73a3(_0x4a3390);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index e746622..251b84f 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 _0xf2a8=['create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2c25f5,_0x34cb37){var _0x444a8b=function(_0x84d16f){while(--_0x84d16f){_0x2c25f5['push'](_0x2c25f5['shift']());}};_0x444a8b(++_0x34cb37);}(_0xf2a8,0xae));var _0x8f2a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf2a8[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x8f2a('0x0'));var util=require(_0x8f2a('0x1'));var path=require(_0x8f2a('0x2'));var timeout=require(_0x8f2a('0x3'));var express=require(_0x8f2a('0x4'));var router=express[_0x8f2a('0x5')]();var auth=require(_0x8f2a('0x6'));var interaction=require(_0x8f2a('0x7'));var config=require(_0x8f2a('0x8'));var controller=require('./voiceContext.controller');router[_0x8f2a('0x9')]('/',auth[_0x8f2a('0xa')](),controller[_0x8f2a('0xb')]);router[_0x8f2a('0x9')](_0x8f2a('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8f2a('0xa')](),controller[_0x8f2a('0xd')]);router['put'](_0x8f2a('0xc'),auth['isAuthenticated'](),controller[_0x8f2a('0xe')]);router['delete'](_0x8f2a('0xc'),auth['isAuthenticated'](),controller[_0x8f2a('0xf')]);module[_0x8f2a('0x10')]=router; \ No newline at end of file +var _0x1550=['put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1550,0x1a3));var _0x0155=function(_0x184c7d,_0x38513e){_0x184c7d=_0x184c7d-0x0;var _0x57564d=_0x1550[_0x184c7d];return _0x57564d;};'use strict';var multer=require('multer');var util=require(_0x0155('0x0'));var path=require(_0x0155('0x1'));var timeout=require(_0x0155('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0155('0x3'));var interaction=require(_0x0155('0x4'));var config=require(_0x0155('0x5'));var controller=require(_0x0155('0x6'));router[_0x0155('0x7')]('/',auth['isAuthenticated'](),controller[_0x0155('0x8')]);router[_0x0155('0x7')](_0x0155('0x9'),auth[_0x0155('0xa')](),controller[_0x0155('0xb')]);router[_0x0155('0xc')]('/',auth[_0x0155('0xa')](),controller['create']);router[_0x0155('0xd')](_0x0155('0x9'),auth[_0x0155('0xa')](),controller[_0x0155('0xe')]);router[_0x0155('0xf')](_0x0155('0x9'),auth[_0x0155('0xa')](),controller[_0x0155('0x10')]);module[_0x0155('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4ce12f9..8bb84ad 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['name','sequelize','STRING'];(function(_0x25f102,_0x2a4c22){var _0x336e6f=function(_0x25adec){while(--_0x25adec){_0x25f102['push'](_0x25f102['shift']());}};_0x336e6f(++_0x2a4c22);}(_0x3e74,0x175));var _0x43e7=function(_0x301415,_0x35176a){_0x301415=_0x301415-0x0;var _0x4d9cc4=_0x3e74[_0x301415];return _0x4d9cc4;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['BOOLEAN','STRING','name'];(function(_0x24d242,_0x1a0f09){var _0x18ae14=function(_0x94d79a){while(--_0x94d79a){_0x24d242['push'](_0x24d242['shift']());}};_0x18ae14(++_0x1a0f09);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index b20ba70..4f151eb 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','get','Contexts','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','show','params','length','options','find','create','body','join','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','root','server/files/templates/context.ejs','utf8','chan_sip.so','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0x7217,0x19e));var _0x7721=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7217[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];var jayson=require(_0x7721('0x1b'));var client=jayson['client'][_0x7721('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x199930,_0x57ff6d,_0x109900){if(_0x109900){var _0x30da54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30da54[_0x7721('0x1d')](_0x57ff6d)){return _0x199930;}else{throw new db[(_0x7721('0x1e'))]['ValidationError'](_0x7721('0x1f'));}}else{return _0x199930;}}function respondWithRpcPromise(_0x25b1c0,_0x534f1b,_0x4e199a,_0x4b183e){return new BPromise(function(_0x5ed54,_0x25a628){var _0x3cc909=_0x4b183e||client;return _0x3cc909[_0x7721('0x20')](_0x25b1c0,_0x4e199a)['then'](function(_0x20f669){logger['info'](_0x7721('0x21'),_0x534f1b,'request\x20sent');logger[_0x7721('0x22')](_0x7721('0x23'),_0x534f1b,_0x7721('0x24'),JSON[_0x7721('0x25')](_0x20f669));if(_0x20f669[_0x7721('0x26')]){if(_0x20f669[_0x7721('0x26')][_0x7721('0x27')]===0x1f4){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669[_0x7721('0x26')]['message']);return _0x25a628(_0x20f669[_0x7721('0x26')][_0x7721('0x28')]);}logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669['error'][_0x7721('0x28')]);return _0x5ed54(_0x20f669['error'][_0x7721('0x28')]);}else{logger[_0x7721('0x29')](_0x7721('0x21'),_0x534f1b,_0x7721('0x24'));_0x5ed54(_0x20f669[_0x7721('0x2a')][_0x7721('0x28')]);}})[_0x7721('0x2b')](function(_0x5b4d74){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x5b4d74);_0x25a628(_0x5b4d74);});});}function respondWithStatusCode(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xcc;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x2c')](_0x1f67c7);}return _0x125564[_0x7721('0x2d')](_0x1f67c7)[_0x7721('0x2e')]();};}function respondWithResult(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0xc8;return function(_0x258ddf){if(_0x258ddf){return _0x40f367['status'](_0x52316e)['json'](_0x258ddf);}};}function respondWithFilteredResult(_0x315202,_0x343c19){return function(_0x53c904){if(_0x53c904){var _0x158d98=_0x53c904[_0x7721('0x2f')],_0x1ea4d=_0x343c19['offset'],_0x37b9f0=_0x343c19[_0x7721('0x30')]+_0x343c19[_0x7721('0x31')],_0xd7d703;if(_0x37b9f0>=_0x158d98){_0x37b9f0=_0x158d98;_0xd7d703=0xc8;}else{_0xd7d703=0xce;}_0x315202['status'](_0xd7d703);return _0x315202['set'](_0x7721('0x32'),_0x1ea4d+'-'+_0x37b9f0+'/'+_0x158d98)[_0x7721('0x33')](_0x53c904);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x34')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x35')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x36')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x37')]()[_0x7721('0x38')](function(){var _0x498654=_0x5c5b33[_0x7721('0x39')]({'plain':!![]});var _0x5ce026=_0x7721('0x3a');return db[_0x7721('0x3b')][_0x7721('0x37')]({'where':{'type':_0x5ce026,'resourceId':_0x498654['id']}})[_0x7721('0x38')](function(){return _0x5c5b33;});})[_0x7721('0x38')](function(){_0x3e4e56[_0x7721('0x2d')](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x15545a,_0x25bdd9){return function(_0x3a2eb7){if(!_0x3a2eb7){_0x15545a[_0x7721('0x2c')](0x194);}return _0x3a2eb7;};}function handleError(_0x5c806d,_0xd1df68){_0xd1df68=_0xd1df68||0x1f4;return function(_0x5e6663){logger[_0x7721('0x26')](_0x5e6663[_0x7721('0x3c')]);if(_0x5e6663[_0x7721('0x3d')]){delete _0x5e6663[_0x7721('0x3d')];}_0x5c806d[_0x7721('0x2d')](_0xd1df68)[_0x7721('0x3e')](_0x5e6663);};}exports['index']=function(_0x557c34,_0x4cadef){var _0x539560={},_0x18001c={},_0x1b3f8d={'count':0x0,'rows':[]};var _0x1acc72=_[_0x7721('0x3f')](db['VoiceContext'][_0x7721('0x40')],function(_0x4cf659){return{'name':_0x4cf659[_0x7721('0x41')],'type':_0x4cf659[_0x7721('0x42')]['key']};});_0x18001c[_0x7721('0x43')]=_[_0x7721('0x3f')](_0x1acc72,'name');_0x18001c['query']=_[_0x7721('0x44')](_0x557c34[_0x7721('0x45')]);_0x18001c[_0x7721('0x46')]=_[_0x7721('0x47')](_0x18001c['model'],_0x18001c[_0x7721('0x45')]);_0x539560[_0x7721('0x48')]=_[_0x7721('0x47')](_0x18001c[_0x7721('0x43')],qs[_0x7721('0x49')](_0x557c34['query'][_0x7721('0x49')]));_0x539560['attributes']=_0x539560[_0x7721('0x48')]['length']?_0x539560[_0x7721('0x48')]:_0x18001c[_0x7721('0x43')];if(!_0x557c34[_0x7721('0x45')]['hasOwnProperty'](_0x7721('0x4a'))){_0x539560[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x557c34['query'][_0x7721('0x31')]);_0x539560[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x557c34[_0x7721('0x45')][_0x7721('0x30')]);}_0x539560[_0x7721('0x4b')]=qs[_0x7721('0x4c')](_0x557c34['query']['sort']);_0x539560[_0x7721('0x4d')]=qs[_0x7721('0x46')](_[_0x7721('0x4e')](_0x557c34[_0x7721('0x45')],_0x18001c[_0x7721('0x46')]),_0x1acc72);if(_0x557c34[_0x7721('0x45')][_0x7721('0x4f')]){_0x539560[_0x7721('0x4d')]=_[_0x7721('0x50')](_0x539560[_0x7721('0x4d')],{'$or':_['map'](_0x1acc72,function(_0x578867){if(_0x578867[_0x7721('0x42')]!==_0x7721('0x51')){var _0x151f69={};_0x151f69[_0x578867[_0x7721('0x3d')]]={'$like':'%'+_0x557c34['query'][_0x7721('0x4f')]+'%'};return _0x151f69;}})});}_0x539560=_[_0x7721('0x50')]({},_0x539560,_0x557c34['options']);var _0x330fac={'where':_0x539560['where']};return db[_0x7721('0x52')]['count'](_0x330fac)[_0x7721('0x38')](function(_0x196be4){_0x1b3f8d[_0x7721('0x2f')]=_0x196be4;if(_0x557c34['query'][_0x7721('0x53')]){_0x539560[_0x7721('0x54')]=[{'all':!![]}];}return db['VoiceContext'][_0x7721('0x55')](_0x539560);})[_0x7721('0x38')](function(_0xf88e8c){_0x1b3f8d['rows']=_0xf88e8c;return _0x1b3f8d;})[_0x7721('0x38')](respondWithFilteredResult(_0x4cadef,_0x539560))['catch'](handleError(_0x4cadef,null));};exports[_0x7721('0x56')]=function(_0x310549,_0x4738ef){var _0x443503={'raw':![],'where':{'id':_0x310549[_0x7721('0x57')]['id']}},_0x1c95d8={};_0x1c95d8[_0x7721('0x43')]=_[_0x7721('0x44')](db[_0x7721('0x52')][_0x7721('0x40')]);_0x1c95d8[_0x7721('0x45')]=_[_0x7721('0x44')](_0x310549[_0x7721('0x45')]);_0x1c95d8[_0x7721('0x46')]=_[_0x7721('0x47')](_0x1c95d8['model'],_0x1c95d8[_0x7721('0x45')]);_0x443503[_0x7721('0x48')]=_[_0x7721('0x47')](_0x1c95d8[_0x7721('0x43')],qs[_0x7721('0x49')](_0x310549[_0x7721('0x45')][_0x7721('0x49')]));_0x443503['attributes']=_0x443503[_0x7721('0x48')][_0x7721('0x58')]?_0x443503[_0x7721('0x48')]:_0x1c95d8[_0x7721('0x43')];if(_0x310549[_0x7721('0x45')][_0x7721('0x53')]){_0x443503[_0x7721('0x54')]=[{'all':!![]}];}_0x443503=_[_0x7721('0x50')]({},_0x443503,_0x310549[_0x7721('0x59')]);return db[_0x7721('0x52')][_0x7721('0x5a')](_0x443503)['then'](handleEntityNotFound(_0x4738ef,null))[_0x7721('0x38')](respondWithResult(_0x4738ef,null))[_0x7721('0x2b')](handleError(_0x4738ef,null));};exports[_0x7721('0x5b')]=function(_0x2ee3c0,_0x15ed3b,_0x3e7918){var _0x41644f;return db[_0x7721('0x52')][_0x7721('0x5b')](_0x2ee3c0[_0x7721('0x5c')],{'raw':!![]})[_0x7721('0x38')](function(_0x2e5c28){_0x41644f=_0x2e5c28;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});})[_0x7721('0x38')](function(_0x577f47){var _0x50e9e9=fs['readFileSync'](path[_0x7721('0x5d')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x5d7036=ejs[_0x7721('0x5e')](_0x50e9e9,{'contexts':_0x577f47||[]});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x5d7036);})['then'](function(){return respondWithRpcPromise(_0x7721('0x61'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x24d1dc=_0x2ee3c0['user']['get']({'plain':!![]});if(!_0x24d1dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d1dc[_0x7721('0x62')]===_0x7721('0x63')){var _0x1ff090=_0x41644f['get']({'plain':!![]});return db[_0x7721('0x64')][_0x7721('0x5a')]({'where':{'name':_0x7721('0x3a'),'userProfileId':_0x24d1dc[_0x7721('0x65')]},'raw':!![]})[_0x7721('0x38')](function(_0x16e80b){if(_0x16e80b&&_0x16e80b[_0x7721('0x66')]===0x0){return db[_0x7721('0x3b')][_0x7721('0x5b')]({'name':_0x1ff090[_0x7721('0x3d')],'resourceId':_0x1ff090['id'],'type':_0x16e80b[_0x7721('0x3d')],'sectionId':_0x16e80b['id']},{})[_0x7721('0x38')](function(){return _0x41644f;});}else{return _0x41644f;}})[_0x7721('0x2b')](function(_0x211d27){logger[_0x7721('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211d27);throw _0x211d27;});}return _0x41644f;})[_0x7721('0x38')](respondWithResult(_0x15ed3b,0xc9))[_0x7721('0x2b')](handleError(_0x15ed3b,null));};exports[_0x7721('0x36')]=function(_0xb6db23,_0x542e30,_0x103009){var _0x104f05;return db['VoiceContext'][_0x7721('0x5a')]({'where':{'id':_0xb6db23['params']['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x542e30,null))[_0x7721('0x38')](saveUpdates(_0xb6db23[_0x7721('0x5c')],null))[_0x7721('0x38')](function(_0x3d2b7d){if(_0x3d2b7d){_0x104f05=_0x3d2b7d;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});}})[_0x7721('0x38')](function(_0x4727b0){var _0x57759a=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),_0x7721('0x6a'));var _0x3ed425=ejs[_0x7721('0x5e')](_0x57759a,{'contexts':_0x4727b0||[]});fs['writeFileSync'](_0x7721('0x60'),_0x3ed425);})[_0x7721('0x38')](function(){return respondWithRpcPromise('Reload',_0x7721('0x36'),{'module':'chan_sip.so'});})[_0x7721('0x38')](function(){return _0x104f05;})[_0x7721('0x38')](respondWithResult(_0x542e30,null))[_0x7721('0x2b')](handleError(_0x542e30,null));};exports[_0x7721('0x37')]=function(_0x1e2436,_0x2bab14,_0x258c57){var _0x5dca04;return db[_0x7721('0x52')][_0x7721('0x5a')]({'where':{'id':_0x1e2436[_0x7721('0x57')]['id']}})['then'](handleEntityNotFound(_0x2bab14,null))['then'](removeEntity(_0x2bab14,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x7721('0x38')](function(_0x2645dd){var _0x580473=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),'utf8');var _0x275b25=ejs[_0x7721('0x5e')](_0x580473,{'contexts':_0x2645dd});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x275b25);return respondWithRpcPromise(_0x7721('0x61'),'destroy',{'module':_0x7721('0x6b')});})[_0x7721('0x2b')](handleError(_0x2bab14,null));}; \ No newline at end of file +var _0x55ca=['ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','name','index','map','VoiceContext','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','render','chan_sip.so','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x23ddcd,_0x1cdbad){var _0x58e43a=function(_0x458540){while(--_0x458540){_0x23ddcd['push'](_0x23ddcd['shift']());}};_0x58e43a(++_0x1cdbad);}(_0x55ca,0x126));var _0xa55c=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x55ca[_0x3358ba];return _0x296e73;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];var jayson=require(_0xa55c('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2a35be,_0x576044,_0x5a3672){if(_0x5a3672){var _0x59ea8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59ea8d[_0xa55c('0x18')](_0x576044)){return _0x2a35be;}else{throw new db[(_0xa55c('0x19'))][(_0xa55c('0x1a'))](_0xa55c('0x1b'));}}else{return _0x2a35be;}}function respondWithRpcPromise(_0x458480,_0x247e77,_0x4e0b2f,_0x3ccf65){return new BPromise(function(_0x3dcf4f,_0x25934f){var _0x31e10d=_0x3ccf65||client;return _0x31e10d[_0xa55c('0x1c')](_0x458480,_0x4e0b2f)[_0xa55c('0x1d')](function(_0x51590e){logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x247e77,'request\x20sent');logger[_0xa55c('0x20')](_0xa55c('0x21'),_0x247e77,_0xa55c('0x22'),JSON[_0xa55c('0x23')](_0x51590e));if(_0x51590e[_0xa55c('0x24')]){if(_0x51590e[_0xa55c('0x24')]['code']===0x1f4){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x25934f(_0x51590e['error'][_0xa55c('0x25')]);}logger[_0xa55c('0x24')]('VoiceContext,\x20%s,\x20%s',_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x3dcf4f(_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);}else{logger[_0xa55c('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x247e77,_0xa55c('0x22'));_0x3dcf4f(_0x51590e['result']['message']);}})['catch'](function(_0x19ae88){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x19ae88);_0x25934f(_0x19ae88);});});}function respondWithStatusCode(_0x190757,_0x3f64de){_0x3f64de=_0x3f64de||0xcc;return function(_0xf0e574){if(_0xf0e574){return _0x190757[_0xa55c('0x26')](_0x3f64de);}return _0x190757[_0xa55c('0x27')](_0x3f64de)[_0xa55c('0x28')]();};}function respondWithResult(_0x11e7f7,_0x192df2){_0x192df2=_0x192df2||0xc8;return function(_0x3cd152){if(_0x3cd152){return _0x11e7f7[_0xa55c('0x27')](_0x192df2)['json'](_0x3cd152);}};}function respondWithFilteredResult(_0x430d55,_0x28814f){return function(_0x1c9f6b){if(_0x1c9f6b){var _0x906caa=_0x1c9f6b[_0xa55c('0x29')],_0x5d940d=_0x28814f[_0xa55c('0x2a')],_0x1377b0=_0x28814f[_0xa55c('0x2a')]+_0x28814f[_0xa55c('0x2b')],_0x22f6b6;if(_0x1377b0>=_0x906caa){_0x1377b0=_0x906caa;_0x22f6b6=0xc8;}else{_0x22f6b6=0xce;}_0x430d55['status'](_0x22f6b6);return _0x430d55[_0xa55c('0x2c')]('Content-Range',_0x5d940d+'-'+_0x1377b0+'/'+_0x906caa)[_0xa55c('0x2d')](_0x1c9f6b);}return null;};}function patchUpdates(_0x1d730b){return function(_0x1cc53e){try{jsonpatch[_0xa55c('0x2e')](_0x1cc53e,_0x1d730b,!![]);}catch(_0x4d8416){return BPromise[_0xa55c('0x2f')](_0x4d8416);}return _0x1cc53e[_0xa55c('0x30')]();};}function saveUpdates(_0x331e58,_0x20da31){return function(_0x10f4b7){if(_0x10f4b7){return _0x10f4b7[_0xa55c('0x31')](_0x331e58)[_0xa55c('0x1d')](function(_0x24d44d){return _0x24d44d;});}return null;};}function removeEntity(_0x2808e9,_0xcbaf2e){return function(_0x197099){if(_0x197099){return _0x197099['destroy']()['then'](function(){var _0x4146f3=_0x197099[_0xa55c('0x32')]({'plain':!![]});var _0x4932d0=_0xa55c('0x33');return db[_0xa55c('0x34')][_0xa55c('0x35')]({'where':{'type':_0x4932d0,'resourceId':_0x4146f3['id']}})[_0xa55c('0x1d')](function(){return _0x197099;});})[_0xa55c('0x1d')](function(){_0x2808e9[_0xa55c('0x27')](0xcc)[_0xa55c('0x28')]();});}};}function handleEntityNotFound(_0x222d4b,_0x3959e3){return function(_0x53590c){if(!_0x53590c){_0x222d4b['sendStatus'](0x194);}return _0x53590c;};}function handleError(_0x4b23d3,_0x3fd75f){_0x3fd75f=_0x3fd75f||0x1f4;return function(_0x18e00e){logger[_0xa55c('0x24')](_0x18e00e['stack']);if(_0x18e00e[_0xa55c('0x36')]){delete _0x18e00e['name'];}_0x4b23d3[_0xa55c('0x27')](_0x3fd75f)['send'](_0x18e00e);};}exports[_0xa55c('0x37')]=function(_0x39267c,_0x3c0ec1){var _0x4d3eb5={},_0x7c4a47={},_0x30f23b={'count':0x0,'rows':[]};var _0x47e93c=_[_0xa55c('0x38')](db[_0xa55c('0x39')]['rawAttributes'],function(_0x529ff8){return{'name':_0x529ff8[_0xa55c('0x3a')],'type':_0x529ff8['type'][_0xa55c('0x3b')]};});_0x7c4a47[_0xa55c('0x3c')]=_['map'](_0x47e93c,'name');_0x7c4a47['query']=_['keys'](_0x39267c[_0xa55c('0x3d')]);_0x7c4a47[_0xa55c('0x3e')]=_[_0xa55c('0x3f')](_0x7c4a47[_0xa55c('0x3c')],_0x7c4a47[_0xa55c('0x3d')]);_0x4d3eb5['attributes']=_[_0xa55c('0x3f')](_0x7c4a47[_0xa55c('0x3c')],qs[_0xa55c('0x40')](_0x39267c[_0xa55c('0x3d')][_0xa55c('0x40')]));_0x4d3eb5[_0xa55c('0x41')]=_0x4d3eb5['attributes'][_0xa55c('0x42')]?_0x4d3eb5['attributes']:_0x7c4a47['model'];if(!_0x39267c[_0xa55c('0x3d')][_0xa55c('0x43')]('nolimit')){_0x4d3eb5[_0xa55c('0x2b')]=qs['limit'](_0x39267c['query'][_0xa55c('0x2b')]);_0x4d3eb5[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x39267c['query'][_0xa55c('0x2a')]);}_0x4d3eb5[_0xa55c('0x44')]=qs['sort'](_0x39267c[_0xa55c('0x3d')]['sort']);_0x4d3eb5[_0xa55c('0x45')]=qs[_0xa55c('0x3e')](_['pick'](_0x39267c[_0xa55c('0x3d')],_0x7c4a47[_0xa55c('0x3e')]),_0x47e93c);if(_0x39267c['query'][_0xa55c('0x46')]){_0x4d3eb5[_0xa55c('0x45')]=_[_0xa55c('0x47')](_0x4d3eb5['where'],{'$or':_[_0xa55c('0x38')](_0x47e93c,function(_0x582901){if(_0x582901[_0xa55c('0x48')]!==_0xa55c('0x49')){var _0x451269={};_0x451269[_0x582901['name']]={'$like':'%'+_0x39267c[_0xa55c('0x3d')][_0xa55c('0x46')]+'%'};return _0x451269;}})});}_0x4d3eb5=_['merge']({},_0x4d3eb5,_0x39267c[_0xa55c('0x4a')]);var _0x931907={'where':_0x4d3eb5['where']};return db[_0xa55c('0x39')][_0xa55c('0x29')](_0x931907)['then'](function(_0x46f839){_0x30f23b[_0xa55c('0x29')]=_0x46f839;if(_0x39267c[_0xa55c('0x3d')][_0xa55c('0x4b')]){_0x4d3eb5['include']=[{'all':!![]}];}return db[_0xa55c('0x39')]['findAll'](_0x4d3eb5);})[_0xa55c('0x1d')](function(_0x213100){_0x30f23b[_0xa55c('0x4c')]=_0x213100;return _0x30f23b;})['then'](respondWithFilteredResult(_0x3c0ec1,_0x4d3eb5))[_0xa55c('0x4d')](handleError(_0x3c0ec1,null));};exports[_0xa55c('0x4e')]=function(_0x574fe9,_0x5be06){var _0x34de95={'raw':![],'where':{'id':_0x574fe9[_0xa55c('0x4f')]['id']}},_0x3822b7={};_0x3822b7[_0xa55c('0x3c')]=_[_0xa55c('0x50')](db[_0xa55c('0x39')][_0xa55c('0x51')]);_0x3822b7[_0xa55c('0x3d')]=_[_0xa55c('0x50')](_0x574fe9['query']);_0x3822b7[_0xa55c('0x3e')]=_[_0xa55c('0x3f')](_0x3822b7[_0xa55c('0x3c')],_0x3822b7['query']);_0x34de95[_0xa55c('0x41')]=_[_0xa55c('0x3f')](_0x3822b7['model'],qs[_0xa55c('0x40')](_0x574fe9['query'][_0xa55c('0x40')]));_0x34de95[_0xa55c('0x41')]=_0x34de95[_0xa55c('0x41')][_0xa55c('0x42')]?_0x34de95[_0xa55c('0x41')]:_0x3822b7['model'];if(_0x574fe9[_0xa55c('0x3d')][_0xa55c('0x4b')]){_0x34de95['include']=[{'all':!![]}];}_0x34de95=_[_0xa55c('0x47')]({},_0x34de95,_0x574fe9[_0xa55c('0x4a')]);return db[_0xa55c('0x39')][_0xa55c('0x52')](_0x34de95)['then'](handleEntityNotFound(_0x5be06,null))['then'](respondWithResult(_0x5be06,null))[_0xa55c('0x4d')](handleError(_0x5be06,null));};exports[_0xa55c('0x53')]=function(_0x3ca5b8,_0x44ac57,_0x54cbde){var _0x30c0c9;return db['VoiceContext'][_0xa55c('0x53')](_0x3ca5b8[_0xa55c('0x54')],{'raw':!![]})[_0xa55c('0x1d')](function(_0x2ccfb1){_0x30c0c9=_0x2ccfb1;return db[_0xa55c('0x39')]['findAll']({'raw':!![]});})[_0xa55c('0x1d')](function(_0x54f776){var _0x23f67f=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],_0xa55c('0x58')),_0xa55c('0x59'));var _0x5d14e0=ejs['render'](_0x23f67f,{'contexts':_0x54f776||[]});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x5d14e0);})[_0xa55c('0x1d')](function(){return respondWithRpcPromise(_0xa55c('0x5c'),_0xa55c('0x53'),{'module':'chan_sip.so'});})[_0xa55c('0x1d')](function(){var _0x3cd40d=_0x3ca5b8[_0xa55c('0x5d')][_0xa55c('0x32')]({'plain':!![]});if(!_0x3cd40d)throw new Error(_0xa55c('0x5e'));if(_0x3cd40d['role']===_0xa55c('0x5d')){var _0x21725b=_0x30c0c9[_0xa55c('0x32')]({'plain':!![]});return db[_0xa55c('0x5f')][_0xa55c('0x52')]({'where':{'name':'Contexts','userProfileId':_0x3cd40d[_0xa55c('0x60')]},'raw':!![]})['then'](function(_0x2e482a){if(_0x2e482a&&_0x2e482a['autoAssociation']===0x0){return db[_0xa55c('0x34')]['create']({'name':_0x21725b[_0xa55c('0x36')],'resourceId':_0x21725b['id'],'type':_0x2e482a[_0xa55c('0x36')],'sectionId':_0x2e482a['id']},{})[_0xa55c('0x1d')](function(){return _0x30c0c9;});}else{return _0x30c0c9;}})[_0xa55c('0x4d')](function(_0x4cb38c){logger[_0xa55c('0x24')](_0xa55c('0x61'),_0x4cb38c);throw _0x4cb38c;});}return _0x30c0c9;})[_0xa55c('0x1d')](respondWithResult(_0x44ac57,0xc9))[_0xa55c('0x4d')](handleError(_0x44ac57,null));};exports[_0xa55c('0x31')]=function(_0x51c736,_0x150a07,_0x311bb9){var _0x4ef914;return db[_0xa55c('0x39')][_0xa55c('0x52')]({'where':{'id':_0x51c736[_0xa55c('0x4f')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x150a07,null))[_0xa55c('0x1d')](saveUpdates(_0x51c736[_0xa55c('0x54')],null))[_0xa55c('0x1d')](function(_0x202191){if(_0x202191){_0x4ef914=_0x202191;return db['VoiceContext'][_0xa55c('0x62')]({'raw':!![]});}})[_0xa55c('0x1d')](function(_0x39861f){var _0xd309a9=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],_0xa55c('0x58')),_0xa55c('0x59'));var _0x4a08ca=ejs[_0xa55c('0x63')](_0xd309a9,{'contexts':_0x39861f||[]});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x4a08ca);})[_0xa55c('0x1d')](function(){return respondWithRpcPromise(_0xa55c('0x5c'),_0xa55c('0x31'),{'module':_0xa55c('0x64')});})[_0xa55c('0x1d')](function(){return _0x4ef914;})[_0xa55c('0x1d')](respondWithResult(_0x150a07,null))[_0xa55c('0x4d')](handleError(_0x150a07,null));};exports[_0xa55c('0x35')]=function(_0x5c598a,_0xe42233,_0x531eee){var _0x1228a4;return db[_0xa55c('0x39')][_0xa55c('0x52')]({'where':{'id':_0x5c598a['params']['id']}})['then'](handleEntityNotFound(_0xe42233,null))[_0xa55c('0x1d')](removeEntity(_0xe42233,null))[_0xa55c('0x1d')](function(){return db[_0xa55c('0x39')][_0xa55c('0x62')]({'raw':!![]});})['then'](function(_0x149cb9){var _0xd02251=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x3f7fca=ejs[_0xa55c('0x63')](_0xd02251,{'contexts':_0x149cb9});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x3f7fca);return respondWithRpcPromise(_0xa55c('0x5c'),'destroy',{'module':_0xa55c('0x64')});})[_0xa55c('0x4d')](handleError(_0xe42233,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index efc139b..db1c206 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x12e2fd,_0x42d96b){var _0x243645=function(_0x11dd9e){while(--_0x11dd9e){_0x12e2fd['push'](_0x12e2fd['shift']());}};_0x243645(++_0x42d96b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 0bce54f..c1ee0c2 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 _0xccd7=['../../config/utils','../../config/logger','rpc','client','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4299dc,_0x12227b){var _0x4551b7=function(_0x1a1b4f){while(--_0x1a1b4f){_0x4299dc['push'](_0x4299dc['shift']());}};_0x4551b7(++_0x12227b);}(_0xccd7,0x185));var _0x7ccd=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xccd7[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0x7ccd('0x0'));var util=require(_0x7ccd('0x1'));var moment=require(_0x7ccd('0x2'));var BPromise=require(_0x7ccd('0x3'));var rs=require(_0x7ccd('0x4'));var fs=require('fs');var Redis=require(_0x7ccd('0x5'));var db=require(_0x7ccd('0x6'))['db'];var utils=require(_0x7ccd('0x7'));var logger=require(_0x7ccd('0x8'))(_0x7ccd('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ccd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34ea24,_0x57516c,_0x22fad7){return new BPromise(function(_0x4ac450,_0x53c0a5){return client[_0x7ccd('0xb')](_0x34ea24,_0x22fad7)['then'](function(_0x304666){logger[_0x7ccd('0xc')]('VoiceContext,\x20%s,\x20%s',_0x57516c,_0x7ccd('0xd'));logger[_0x7ccd('0xe')](_0x7ccd('0xf'),_0x57516c,'request\x20sent',JSON['stringify'](_0x304666));if(_0x304666[_0x7ccd('0x10')]){if(_0x304666['error'][_0x7ccd('0x11')]===0x1f4){logger[_0x7ccd('0x10')]('VoiceContext,\x20%s,\x20%s',_0x57516c,_0x304666[_0x7ccd('0x10')]['message']);return _0x53c0a5(_0x304666[_0x7ccd('0x10')][_0x7ccd('0x12')]);}logger[_0x7ccd('0x10')](_0x7ccd('0x13'),_0x57516c,_0x304666[_0x7ccd('0x10')][_0x7ccd('0x12')]);return _0x4ac450(_0x304666['error'][_0x7ccd('0x12')]);}else{logger[_0x7ccd('0xc')](_0x7ccd('0x13'),_0x57516c,_0x7ccd('0xd'));_0x4ac450(_0x304666[_0x7ccd('0x14')][_0x7ccd('0x12')]);}})[_0x7ccd('0x15')](function(_0x3f4584){logger[_0x7ccd('0x10')](_0x7ccd('0x13'),_0x57516c,_0x3f4584);_0x53c0a5(_0x3f4584);});});} \ No newline at end of file +var _0x361a=['then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','info','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2f1d50,_0x4dfc3a){var _0x4471ca=function(_0x231ad4){while(--_0x231ad4){_0x2f1d50['push'](_0x2f1d50['shift']());}};_0x4471ca(++_0x4dfc3a);}(_0x361a,0x8e));var _0xa361=function(_0x20960c,_0x7df974){_0x20960c=_0x20960c-0x0;var _0x2de4e7=_0x361a[_0x20960c];return _0x2de4e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa361('0x0'));var rs=require(_0xa361('0x1'));var fs=require('fs');var Redis=require(_0xa361('0x2'));var db=require(_0xa361('0x3'))['db'];var utils=require(_0xa361('0x4'));var logger=require(_0xa361('0x5'))(_0xa361('0x6'));var config=require(_0xa361('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa361('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x497bff,_0xb522ea,_0x5813a5){return new BPromise(function(_0x2f9520,_0x555065){return client[_0xa361('0x9')](_0x497bff,_0x5813a5)[_0xa361('0xa')](function(_0x94daa2){logger['info']('VoiceContext,\x20%s,\x20%s',_0xb522ea,_0xa361('0xb'));logger[_0xa361('0xc')](_0xa361('0xd'),_0xb522ea,'request\x20sent',JSON[_0xa361('0xe')](_0x94daa2));if(_0x94daa2[_0xa361('0xf')]){if(_0x94daa2[_0xa361('0xf')]['code']===0x1f4){logger[_0xa361('0xf')](_0xa361('0x10'),_0xb522ea,_0x94daa2[_0xa361('0xf')][_0xa361('0x11')]);return _0x555065(_0x94daa2[_0xa361('0xf')][_0xa361('0x11')]);}logger[_0xa361('0xf')]('VoiceContext,\x20%s,\x20%s',_0xb522ea,_0x94daa2[_0xa361('0xf')][_0xa361('0x11')]);return _0x2f9520(_0x94daa2['error'][_0xa361('0x11')]);}else{logger[_0xa361('0x12')](_0xa361('0x10'),_0xb522ea,_0xa361('0xb'));_0x2f9520(_0x94daa2['result'][_0xa361('0x11')]);}})['catch'](function(_0x227747){logger[_0xa361('0xf')](_0xa361('0x10'),_0xb522ea,_0x227747);_0x555065(_0x227747);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index de48d03..ca73d2e 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 _0x79c7=['post','put','update','destroy','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x79c7,0x64));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x779c('0x0'));var path=require('path');var timeout=require(_0x779c('0x1'));var express=require(_0x779c('0x2'));var router=express[_0x779c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x779c('0x4'));var config=require(_0x779c('0x5'));var controller=require(_0x779c('0x6'));router[_0x779c('0x7')]('/',auth[_0x779c('0x8')](),controller['index']);router[_0x779c('0x7')](_0x779c('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x779c('0x7')](_0x779c('0xa'),auth['isAuthenticated'](),controller[_0x779c('0xb')]);router[_0x779c('0xc')]('/',auth[_0x779c('0x8')](),controller['create']);router[_0x779c('0xd')]('/:id',auth[_0x779c('0x8')](),controller[_0x779c('0xe')]);router['delete'](_0x779c('0xa'),auth[_0x779c('0x8')](),controller[_0x779c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x831e=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','/describe','isAuthenticated','/:id','show','put'];(function(_0x35cc40,_0x4b7677){var _0x5ae78e=function(_0x81c890){while(--_0x81c890){_0x35cc40['push'](_0x35cc40['shift']());}};_0x5ae78e(++_0x4b7677);}(_0x831e,0x108));var _0xe831=function(_0x1901ec,_0x55328d){_0x1901ec=_0x1901ec-0x0;var _0x41243b=_0x831e[_0x1901ec];return _0x41243b;};'use strict';var multer=require(_0xe831('0x0'));var util=require(_0xe831('0x1'));var path=require(_0xe831('0x2'));var timeout=require(_0xe831('0x3'));var express=require(_0xe831('0x4'));var router=express[_0xe831('0x5')]();var auth=require(_0xe831('0x6'));var interaction=require(_0xe831('0x7'));var config=require(_0xe831('0x8'));var controller=require(_0xe831('0x9'));router[_0xe831('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe831('0xb'),auth[_0xe831('0xc')](),controller['describe']);router[_0xe831('0xa')](_0xe831('0xd'),auth['isAuthenticated'](),controller[_0xe831('0xe')]);router['post']('/',auth[_0xe831('0xc')](),controller['create']);router[_0xe831('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe831('0x10')]);router[_0xe831('0x11')](_0xe831('0xd'),auth['isAuthenticated'](),controller[_0xe831('0x12')]);module[_0xe831('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index bcebf92..16c4268 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 _0x208d=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x26ba49,_0xa74ad9){var _0x294f22=function(_0x8bf331){while(--_0x8bf331){_0x26ba49['push'](_0x26ba49['shift']());}};_0x294f22(++_0xa74ad9);}(_0x208d,0x14e));var _0xd208=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x208d[_0x40b3f2];return _0x4ce90c;};'use strict';var Sequelize=require(_0xd208('0x0'));module[_0xd208('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd208('0x2')]},'channelstate':{'type':Sequelize[_0xd208('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd208('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd208('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd208('0x2')]},'connectedlinename':{'type':Sequelize[_0xd208('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd208('0x2')]},'context':{'type':Sequelize[_0xd208('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd208('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd208('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd208('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd208('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd208('0x2')]},'destcalleridname':{'type':Sequelize[_0xd208('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd208('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd208('0x2')]},'destlanguage':{'type':Sequelize[_0xd208('0x2')]},'destaccountcode':{'type':Sequelize[_0xd208('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd208('0x2')]},'destpriority':{'type':Sequelize[_0xd208('0x3')]},'destuniqueid':{'type':Sequelize[_0xd208('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd208('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd208('0x4')]},'lastevent':{'type':Sequelize[_0xd208('0x2')],'comment':_0xd208('0x5')},'routeId':{'type':Sequelize[_0xd208('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd208('0x3')]},'billableseconds':{'type':Sequelize[_0xd208('0x3')]}}; \ No newline at end of file +var _0x364c=['INTEGER','DATE','called,connect,complete','STRING'];(function(_0x212e2f,_0x18fd85){var _0x212595=function(_0x2201cb){while(--_0x2201cb){_0x212e2f['push'](_0x212e2f['shift']());}};_0x212595(++_0x18fd85);}(_0x364c,0xcf));var _0xc364=function(_0x1c41c0,_0x57f2fb){_0x1c41c0=_0x1c41c0-0x0;var _0x5d8b8d=_0x364c[_0x1c41c0];return _0x5d8b8d;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc364('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc364('0x0')]},'calleridnum':{'type':Sequelize[_0xc364('0x0')]},'calleridname':{'type':Sequelize[_0xc364('0x0')]},'connectedlinenum':{'type':Sequelize[_0xc364('0x0')]},'connectedlinename':{'type':Sequelize[_0xc364('0x0')]},'language':{'type':Sequelize[_0xc364('0x0')]},'accountcode':{'type':Sequelize[_0xc364('0x0')]},'context':{'type':Sequelize[_0xc364('0x0')]},'exten':{'type':Sequelize[_0xc364('0x0')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc364('0x0')]},'linkedid':{'type':Sequelize[_0xc364('0x0')]},'destchannel':{'type':Sequelize[_0xc364('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xc364('0x0')]},'destcalleridnum':{'type':Sequelize[_0xc364('0x0')]},'destcalleridname':{'type':Sequelize[_0xc364('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xc364('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xc364('0x0')]},'destlanguage':{'type':Sequelize[_0xc364('0x0')]},'destaccountcode':{'type':Sequelize[_0xc364('0x0')]},'destcontext':{'type':Sequelize[_0xc364('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc364('0x1')]},'destuniqueid':{'type':Sequelize[_0xc364('0x0')]},'destlinkedid':{'type':Sequelize[_0xc364('0x0')]},'dialstring':{'type':Sequelize[_0xc364('0x0')]},'dialstatus':{'type':Sequelize[_0xc364('0x0')]},'starttime':{'type':Sequelize[_0xc364('0x2')]},'answertime':{'type':Sequelize[_0xc364('0x2')]},'endtime':{'type':Sequelize[_0xc364('0x2')]},'lastevent':{'type':Sequelize[_0xc364('0x0')],'comment':_0xc364('0x3')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc364('0x1')]},'billableseconds':{'type':Sequelize[_0xc364('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e29a5d2..fbc372e 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 _0x1928=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','VoiceDialReport','rawAttributes','key','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf'];(function(_0x272e18,_0x75e43c){var _0x572ca9=function(_0xf2b51a){while(--_0xf2b51a){_0x272e18['push'](_0x272e18['shift']());}};_0x572ca9(++_0x75e43c);}(_0x1928,0x183));var _0x8192=function(_0x12ce16,_0x368e00){_0x12ce16=_0x12ce16-0x0;var _0x3884a0=_0x1928[_0x12ce16];return _0x3884a0;};'use strict';var pdf=require(_0x8192('0x0'));var emlformat=require(_0x8192('0x1'));var rimraf=require(_0x8192('0x2'));var zipdir=require(_0x8192('0x3'));var jsonpatch=require(_0x8192('0x4'));var rp=require(_0x8192('0x5'));var moment=require(_0x8192('0x6'));var BPromise=require(_0x8192('0x7'));var Mustache=require(_0x8192('0x8'));var util=require(_0x8192('0x9'));var path=require(_0x8192('0xa'));var sox=require(_0x8192('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8192('0xc'));var squel=require(_0x8192('0xd'));var crypto=require(_0x8192('0xe'));var jsforce=require(_0x8192('0xf'));var deskjs=require(_0x8192('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8192('0x11'));var Redis=require(_0x8192('0x12'));var authService=require(_0x8192('0x13'));var qs=require(_0x8192('0x14'));var as=require(_0x8192('0x15'));var hardwareService=require(_0x8192('0x16'));var logger=require(_0x8192('0x17'))(_0x8192('0x18'));var utils=require(_0x8192('0x19'));var config=require(_0x8192('0x1a'));var db=require(_0x8192('0x1b'))['db'];function respondWithStatusCode(_0x5182a4,_0x8f0851){_0x8f0851=_0x8f0851||0xcc;return function(_0x3a12dd){if(_0x3a12dd){return _0x5182a4[_0x8192('0x1c')](_0x8f0851);}return _0x5182a4[_0x8192('0x1d')](_0x8f0851)[_0x8192('0x1e')]();};}function respondWithResult(_0x18822f,_0x3edbec){_0x3edbec=_0x3edbec||0xc8;return function(_0x1bc58e){if(_0x1bc58e){return _0x18822f[_0x8192('0x1d')](_0x3edbec)[_0x8192('0x1f')](_0x1bc58e);}};}function respondWithFilteredResult(_0x2b6c4a,_0x3626f1){return function(_0x198643){if(_0x198643){var _0x509207=_0x198643[_0x8192('0x20')],_0x571d90=_0x3626f1[_0x8192('0x21')],_0x5de909=_0x3626f1['offset']+_0x3626f1[_0x8192('0x22')],_0x1287df;if(_0x5de909>=_0x509207){_0x5de909=_0x509207;_0x1287df=0xc8;}else{_0x1287df=0xce;}_0x2b6c4a[_0x8192('0x1d')](_0x1287df);return _0x2b6c4a['set'](_0x8192('0x23'),_0x571d90+'-'+_0x5de909+'/'+_0x509207)[_0x8192('0x1f')](_0x198643);}return null;};}function patchUpdates(_0x2ca968){return function(_0x45b0de){try{jsonpatch[_0x8192('0x24')](_0x45b0de,_0x2ca968,!![]);}catch(_0x427d3c){return BPromise[_0x8192('0x25')](_0x427d3c);}return _0x45b0de[_0x8192('0x26')]();};}function saveUpdates(_0x2ea123,_0x26fc7d){return function(_0x2ca59e){if(_0x2ca59e){return _0x2ca59e[_0x8192('0x27')](_0x2ea123)[_0x8192('0x28')](function(_0x4070f9){return _0x4070f9;});}return null;};}function removeEntity(_0x560334,_0x4e65a8){return function(_0x890a85){if(_0x890a85){return _0x890a85[_0x8192('0x29')]()[_0x8192('0x28')](function(){_0x560334['status'](0xcc)[_0x8192('0x1e')]();});}};}function handleEntityNotFound(_0x37b061,_0x4d3b6f){return function(_0x41d60e){if(!_0x41d60e){_0x37b061[_0x8192('0x1c')](0x194);}return _0x41d60e;};}function handleError(_0x3e6c2a,_0x34d405){_0x34d405=_0x34d405||0x1f4;return function(_0x53ad03){logger[_0x8192('0x2a')](_0x53ad03[_0x8192('0x2b')]);if(_0x53ad03['name']){delete _0x53ad03['name'];}_0x3e6c2a[_0x8192('0x1d')](_0x34d405)[_0x8192('0x2c')](_0x53ad03);};}exports['index']=function(_0x378eef,_0x36eb9b){var _0x39b66e={},_0x17830d={},_0x5ad717={'count':0x0,'rows':[]};var _0x10ccf2=_[_0x8192('0x2d')](db[_0x8192('0x2e')][_0x8192('0x2f')],function(_0x3c9efa){return{'name':_0x3c9efa['fieldName'],'type':_0x3c9efa['type'][_0x8192('0x30')]};});_0x17830d['model']=_[_0x8192('0x2d')](_0x10ccf2,_0x8192('0x31'));_0x17830d['query']=_[_0x8192('0x32')](_0x378eef[_0x8192('0x33')]);_0x17830d[_0x8192('0x34')]=_[_0x8192('0x35')](_0x17830d[_0x8192('0x36')],_0x17830d[_0x8192('0x33')]);_0x39b66e[_0x8192('0x37')]=_['intersection'](_0x17830d[_0x8192('0x36')],qs[_0x8192('0x38')](_0x378eef['query'][_0x8192('0x38')]));_0x39b66e[_0x8192('0x37')]=_0x39b66e[_0x8192('0x37')][_0x8192('0x39')]?_0x39b66e[_0x8192('0x37')]:_0x17830d[_0x8192('0x36')];if(!_0x378eef[_0x8192('0x33')][_0x8192('0x3a')](_0x8192('0x3b'))){_0x39b66e[_0x8192('0x22')]=qs['limit'](_0x378eef['query'][_0x8192('0x22')]);_0x39b66e[_0x8192('0x21')]=qs[_0x8192('0x21')](_0x378eef[_0x8192('0x33')][_0x8192('0x21')]);}_0x39b66e[_0x8192('0x3c')]=qs['sort'](_0x378eef[_0x8192('0x33')]['sort']);_0x39b66e[_0x8192('0x3d')]=qs[_0x8192('0x34')](_[_0x8192('0x3e')](_0x378eef[_0x8192('0x33')],_0x17830d[_0x8192('0x34')]),_0x10ccf2);if(_0x378eef[_0x8192('0x33')][_0x8192('0x3f')]){_0x39b66e[_0x8192('0x3d')]=_[_0x8192('0x40')](_0x39b66e[_0x8192('0x3d')],{'$or':_[_0x8192('0x2d')](_0x10ccf2,function(_0x1fd4f8){if(_0x1fd4f8['type']!==_0x8192('0x41')){var _0x378aba={};_0x378aba[_0x1fd4f8[_0x8192('0x31')]]={'$like':'%'+_0x378eef[_0x8192('0x33')][_0x8192('0x3f')]+'%'};return _0x378aba;}})});}_0x39b66e=_['merge']({},_0x39b66e,_0x378eef[_0x8192('0x42')]);var _0x363735={'where':_0x39b66e[_0x8192('0x3d')]};return db[_0x8192('0x2e')][_0x8192('0x20')](_0x363735)['then'](function(_0x28283b){_0x5ad717[_0x8192('0x20')]=_0x28283b;if(_0x378eef['query'][_0x8192('0x43')]){_0x39b66e['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x8192('0x44')](_0x39b66e);})[_0x8192('0x28')](function(_0x2c64fd){_0x5ad717[_0x8192('0x45')]=_0x2c64fd;return _0x5ad717;})['then'](respondWithFilteredResult(_0x36eb9b,_0x39b66e))['catch'](handleError(_0x36eb9b,null));};exports[_0x8192('0x46')]=function(_0x1f377b,_0x652f2a){var _0x597498={'raw':!![],'where':{'id':_0x1f377b['params']['id']}},_0x2621ff={};_0x2621ff[_0x8192('0x36')]=_[_0x8192('0x32')](db[_0x8192('0x2e')][_0x8192('0x2f')]);_0x2621ff[_0x8192('0x33')]=_[_0x8192('0x32')](_0x1f377b[_0x8192('0x33')]);_0x2621ff['filters']=_['intersection'](_0x2621ff[_0x8192('0x36')],_0x2621ff[_0x8192('0x33')]);_0x597498[_0x8192('0x37')]=_[_0x8192('0x35')](_0x2621ff[_0x8192('0x36')],qs[_0x8192('0x38')](_0x1f377b[_0x8192('0x33')][_0x8192('0x38')]));_0x597498['attributes']=_0x597498[_0x8192('0x37')]['length']?_0x597498[_0x8192('0x37')]:_0x2621ff['model'];if(_0x1f377b['query'][_0x8192('0x43')]){_0x597498[_0x8192('0x47')]=[{'all':!![]}];}_0x597498=_['merge']({},_0x597498,_0x1f377b[_0x8192('0x42')]);return db[_0x8192('0x2e')][_0x8192('0x48')](_0x597498)['then'](handleEntityNotFound(_0x652f2a,null))[_0x8192('0x28')](respondWithResult(_0x652f2a,null))[_0x8192('0x49')](handleError(_0x652f2a,null));};exports['create']=function(_0x11bdd2,_0x3e76e3){return db[_0x8192('0x2e')][_0x8192('0x4a')](_0x11bdd2[_0x8192('0x4b')],{})[_0x8192('0x28')](respondWithResult(_0x3e76e3,0xc9))[_0x8192('0x49')](handleError(_0x3e76e3,null));};exports[_0x8192('0x27')]=function(_0x2a1a4e,_0x5b23c4){if(_0x2a1a4e[_0x8192('0x4b')]['id']){delete _0x2a1a4e[_0x8192('0x4b')]['id'];}return db[_0x8192('0x2e')]['find']({'where':{'id':_0x2a1a4e[_0x8192('0x4c')]['id']}})[_0x8192('0x28')](handleEntityNotFound(_0x5b23c4,null))[_0x8192('0x28')](saveUpdates(_0x2a1a4e[_0x8192('0x4b')],null))[_0x8192('0x28')](respondWithResult(_0x5b23c4,null))[_0x8192('0x49')](handleError(_0x5b23c4,null));};exports['destroy']=function(_0x32dcb5,_0x53d573){return db['VoiceDialReport'][_0x8192('0x48')]({'where':{'id':_0x32dcb5[_0x8192('0x4c')]['id']}})[_0x8192('0x28')](handleEntityNotFound(_0x53d573,null))['then'](removeEntity(_0x53d573,null))[_0x8192('0x49')](handleError(_0x53d573,null));};exports['describe']=function(_0x427e5d,_0x46973b){return db[_0x8192('0x2e')][_0x8192('0x4d')]()[_0x8192('0x28')](respondWithResult(_0x46973b,null))['catch'](handleError(_0x46973b,null));}; \ No newline at end of file +var _0x4812=['then','error','stack','name','send','index','map','VoiceDialReport','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','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/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x40a333,_0x5e15f4){var _0xd0bb9=function(_0x5ad565){while(--_0x5ad565){_0x40a333['push'](_0x40a333['shift']());}};_0xd0bb9(++_0x5e15f4);}(_0x4812,0x10a));var _0x2481=function(_0x19f871,_0x5e059a){_0x19f871=_0x19f871-0x0;var _0x3428e1=_0x4812[_0x19f871];return _0x3428e1;};'use strict';var pdf=require(_0x2481('0x0'));var emlformat=require(_0x2481('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2481('0x2'));var jsonpatch=require(_0x2481('0x3'));var rp=require(_0x2481('0x4'));var moment=require(_0x2481('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2481('0x6'));var util=require('util');var path=require(_0x2481('0x7'));var sox=require('sox');var csv=require(_0x2481('0x8'));var ejs=require(_0x2481('0x9'));var fs=require('fs');var _=require(_0x2481('0xa'));var squel=require(_0x2481('0xb'));var crypto=require(_0x2481('0xc'));var jsforce=require(_0x2481('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2481('0xe'));var Papa=require(_0x2481('0xf'));var Redis=require(_0x2481('0x10'));var authService=require(_0x2481('0x11'));var qs=require(_0x2481('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2481('0x13'));var logger=require(_0x2481('0x14'))(_0x2481('0x15'));var utils=require(_0x2481('0x16'));var config=require(_0x2481('0x17'));var db=require(_0x2481('0x18'))['db'];function respondWithStatusCode(_0x4d01e8,_0x160c41){_0x160c41=_0x160c41||0xcc;return function(_0x16d1c3){if(_0x16d1c3){return _0x4d01e8[_0x2481('0x19')](_0x160c41);}return _0x4d01e8[_0x2481('0x1a')](_0x160c41)[_0x2481('0x1b')]();};}function respondWithResult(_0x2e0392,_0x3039e3){_0x3039e3=_0x3039e3||0xc8;return function(_0x1f6499){if(_0x1f6499){return _0x2e0392['status'](_0x3039e3)[_0x2481('0x1c')](_0x1f6499);}};}function respondWithFilteredResult(_0x4550dc,_0x109732){return function(_0x29db67){if(_0x29db67){var _0x121ccb=_0x29db67[_0x2481('0x1d')],_0x49e4fc=_0x109732['offset'],_0x16273a=_0x109732[_0x2481('0x1e')]+_0x109732['limit'],_0x13b862;if(_0x16273a>=_0x121ccb){_0x16273a=_0x121ccb;_0x13b862=0xc8;}else{_0x13b862=0xce;}_0x4550dc[_0x2481('0x1a')](_0x13b862);return _0x4550dc[_0x2481('0x1f')](_0x2481('0x20'),_0x49e4fc+'-'+_0x16273a+'/'+_0x121ccb)[_0x2481('0x1c')](_0x29db67);}return null;};}function patchUpdates(_0x186abb){return function(_0x2ce5f9){try{jsonpatch[_0x2481('0x21')](_0x2ce5f9,_0x186abb,!![]);}catch(_0x55b86d){return BPromise[_0x2481('0x22')](_0x55b86d);}return _0x2ce5f9[_0x2481('0x23')]();};}function saveUpdates(_0x4b965a,_0xee5e9e){return function(_0x1fe3a1){if(_0x1fe3a1){return _0x1fe3a1[_0x2481('0x24')](_0x4b965a)['then'](function(_0xf086b2){return _0xf086b2;});}return null;};}function removeEntity(_0x1412c4,_0x1fabb8){return function(_0x103806){if(_0x103806){return _0x103806[_0x2481('0x25')]()[_0x2481('0x26')](function(){_0x1412c4[_0x2481('0x1a')](0xcc)[_0x2481('0x1b')]();});}};}function handleEntityNotFound(_0x589603,_0x19aff5){return function(_0x646000){if(!_0x646000){_0x589603[_0x2481('0x19')](0x194);}return _0x646000;};}function handleError(_0x3fac1f,_0x58cc2f){_0x58cc2f=_0x58cc2f||0x1f4;return function(_0x32f88c){logger[_0x2481('0x27')](_0x32f88c[_0x2481('0x28')]);if(_0x32f88c[_0x2481('0x29')]){delete _0x32f88c[_0x2481('0x29')];}_0x3fac1f[_0x2481('0x1a')](_0x58cc2f)[_0x2481('0x2a')](_0x32f88c);};}exports[_0x2481('0x2b')]=function(_0x5dde90,_0x5126c9){var _0x3f2b79={},_0x315e4f={},_0x1288f8={'count':0x0,'rows':[]};var _0x54fd93=_[_0x2481('0x2c')](db[_0x2481('0x2d')]['rawAttributes'],function(_0x26a651){return{'name':_0x26a651[_0x2481('0x2e')],'type':_0x26a651['type'][_0x2481('0x2f')]};});_0x315e4f[_0x2481('0x30')]=_['map'](_0x54fd93,_0x2481('0x29'));_0x315e4f[_0x2481('0x31')]=_['keys'](_0x5dde90[_0x2481('0x31')]);_0x315e4f[_0x2481('0x32')]=_[_0x2481('0x33')](_0x315e4f[_0x2481('0x30')],_0x315e4f[_0x2481('0x31')]);_0x3f2b79['attributes']=_[_0x2481('0x33')](_0x315e4f[_0x2481('0x30')],qs['fields'](_0x5dde90['query'][_0x2481('0x34')]));_0x3f2b79[_0x2481('0x35')]=_0x3f2b79[_0x2481('0x35')]['length']?_0x3f2b79[_0x2481('0x35')]:_0x315e4f[_0x2481('0x30')];if(!_0x5dde90[_0x2481('0x31')][_0x2481('0x36')]('nolimit')){_0x3f2b79[_0x2481('0x37')]=qs[_0x2481('0x37')](_0x5dde90[_0x2481('0x31')][_0x2481('0x37')]);_0x3f2b79[_0x2481('0x1e')]=qs[_0x2481('0x1e')](_0x5dde90[_0x2481('0x31')][_0x2481('0x1e')]);}_0x3f2b79[_0x2481('0x38')]=qs[_0x2481('0x39')](_0x5dde90[_0x2481('0x31')][_0x2481('0x39')]);_0x3f2b79[_0x2481('0x3a')]=qs[_0x2481('0x32')](_[_0x2481('0x3b')](_0x5dde90['query'],_0x315e4f[_0x2481('0x32')]),_0x54fd93);if(_0x5dde90[_0x2481('0x31')][_0x2481('0x3c')]){_0x3f2b79[_0x2481('0x3a')]=_[_0x2481('0x3d')](_0x3f2b79[_0x2481('0x3a')],{'$or':_[_0x2481('0x2c')](_0x54fd93,function(_0x21ec13){if(_0x21ec13['type']!==_0x2481('0x3e')){var _0x28fe26={};_0x28fe26[_0x21ec13[_0x2481('0x29')]]={'$like':'%'+_0x5dde90[_0x2481('0x31')][_0x2481('0x3c')]+'%'};return _0x28fe26;}})});}_0x3f2b79=_['merge']({},_0x3f2b79,_0x5dde90[_0x2481('0x3f')]);var _0x3953af={'where':_0x3f2b79['where']};return db[_0x2481('0x2d')]['count'](_0x3953af)[_0x2481('0x26')](function(_0x1e5678){_0x1288f8[_0x2481('0x1d')]=_0x1e5678;if(_0x5dde90[_0x2481('0x31')][_0x2481('0x40')]){_0x3f2b79[_0x2481('0x41')]=[{'all':!![]}];}return db[_0x2481('0x2d')]['findAll'](_0x3f2b79);})[_0x2481('0x26')](function(_0x53117a){_0x1288f8[_0x2481('0x42')]=_0x53117a;return _0x1288f8;})[_0x2481('0x26')](respondWithFilteredResult(_0x5126c9,_0x3f2b79))[_0x2481('0x43')](handleError(_0x5126c9,null));};exports[_0x2481('0x44')]=function(_0x3952df,_0x1902b4){var _0x5e2acc={'raw':!![],'where':{'id':_0x3952df[_0x2481('0x45')]['id']}},_0x1bb4d9={};_0x1bb4d9['model']=_[_0x2481('0x46')](db[_0x2481('0x2d')]['rawAttributes']);_0x1bb4d9['query']=_[_0x2481('0x46')](_0x3952df[_0x2481('0x31')]);_0x1bb4d9['filters']=_[_0x2481('0x33')](_0x1bb4d9[_0x2481('0x30')],_0x1bb4d9[_0x2481('0x31')]);_0x5e2acc[_0x2481('0x35')]=_[_0x2481('0x33')](_0x1bb4d9[_0x2481('0x30')],qs[_0x2481('0x34')](_0x3952df[_0x2481('0x31')]['fields']));_0x5e2acc['attributes']=_0x5e2acc[_0x2481('0x35')][_0x2481('0x47')]?_0x5e2acc[_0x2481('0x35')]:_0x1bb4d9[_0x2481('0x30')];if(_0x3952df[_0x2481('0x31')]['includeAll']){_0x5e2acc[_0x2481('0x41')]=[{'all':!![]}];}_0x5e2acc=_[_0x2481('0x3d')]({},_0x5e2acc,_0x3952df[_0x2481('0x3f')]);return db[_0x2481('0x2d')][_0x2481('0x48')](_0x5e2acc)[_0x2481('0x26')](handleEntityNotFound(_0x1902b4,null))[_0x2481('0x26')](respondWithResult(_0x1902b4,null))[_0x2481('0x43')](handleError(_0x1902b4,null));};exports[_0x2481('0x49')]=function(_0xf0f32c,_0x54c08c){return db[_0x2481('0x2d')][_0x2481('0x49')](_0xf0f32c[_0x2481('0x4a')],{})['then'](respondWithResult(_0x54c08c,0xc9))[_0x2481('0x43')](handleError(_0x54c08c,null));};exports[_0x2481('0x24')]=function(_0xc18c9e,_0x47a46c){if(_0xc18c9e[_0x2481('0x4a')]['id']){delete _0xc18c9e[_0x2481('0x4a')]['id'];}return db[_0x2481('0x2d')][_0x2481('0x48')]({'where':{'id':_0xc18c9e[_0x2481('0x45')]['id']}})['then'](handleEntityNotFound(_0x47a46c,null))[_0x2481('0x26')](saveUpdates(_0xc18c9e[_0x2481('0x4a')],null))[_0x2481('0x26')](respondWithResult(_0x47a46c,null))[_0x2481('0x43')](handleError(_0x47a46c,null));};exports[_0x2481('0x25')]=function(_0x2b37e8,_0x480d94){return db[_0x2481('0x2d')]['find']({'where':{'id':_0x2b37e8[_0x2481('0x45')]['id']}})[_0x2481('0x26')](handleEntityNotFound(_0x480d94,null))['then'](removeEntity(_0x480d94,null))[_0x2481('0x43')](handleError(_0x480d94,null));};exports[_0x2481('0x4b')]=function(_0x4bdb45,_0x236910){return db['VoiceDialReport'][_0x2481('0x4b')]()['then'](respondWithResult(_0x236910,null))['catch'](handleError(_0x236910,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5f97eb5..b096e9c 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 _0xb5af=['api','bluebird','request-promise','rimraf','exports','define','report_dial','uniqueid','../../config/logger'];(function(_0x3785cb,_0x165edb){var _0x151a96=function(_0x351558){while(--_0x351558){_0x3785cb['push'](_0x3785cb['shift']());}};_0x151a96(++_0x165edb);}(_0xb5af,0xb3));var _0xfb5a=function(_0x53003a,_0x3829fa){_0x53003a=_0x53003a-0x0;var _0x25c731=_0xb5af[_0x53003a];return _0x25c731;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb5a('0x0'))(_0xfb5a('0x1'));var moment=require('moment');var BPromise=require(_0xfb5a('0x2'));var rp=require(_0xfb5a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb5a('0x4'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xfb5a('0x5')]=function(_0x17ba26,_0x425e28){return _0x17ba26[_0xfb5a('0x6')]('VoiceDialReport',attributes,{'tableName':_0xfb5a('0x7'),'paranoid':![],'indexes':[{'fields':[_0xfb5a('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68ae=['define','report_dial','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x50ccf2,_0x27068c){var _0x233920=function(_0x50a166){while(--_0x50a166){_0x50ccf2['push'](_0x50ccf2['shift']());}};_0x233920(++_0x27068c);}(_0x68ae,0xdf));var _0xe68a=function(_0x136e37,_0xcb0f92){_0x136e37=_0x136e37-0x0;var _0x27a9ac=_0x68ae[_0x136e37];return _0x27a9ac;};'use strict';var _=require(_0xe68a('0x0'));var util=require(_0xe68a('0x1'));var logger=require(_0xe68a('0x2'))(_0xe68a('0x3'));var moment=require(_0xe68a('0x4'));var BPromise=require(_0xe68a('0x5'));var rp=require(_0xe68a('0x6'));var fs=require('fs');var path=require(_0xe68a('0x7'));var rimraf=require(_0xe68a('0x8'));var config=require(_0xe68a('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0xe68a('0xa')]=function(_0x5eec14,_0x1048a3){return _0x5eec14[_0xe68a('0xb')]('VoiceDialReport',attributes,{'tableName':_0xe68a('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 62e66dd..40e40c2 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 _0x207d=['message','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','debug','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4791a4,_0x2c5f4a){var _0x46627f=function(_0x1beed1){while(--_0x1beed1){_0x4791a4['push'](_0x4791a4['shift']());}};_0x46627f(++_0x2c5f4a);}(_0x207d,0x10d));var _0xd207=function(_0x55e6d6,_0x4c336b){_0x55e6d6=_0x55e6d6-0x0;var _0xeeaa75=_0x207d[_0x55e6d6];return _0xeeaa75;};'use strict';var _=require(_0xd207('0x0'));var util=require(_0xd207('0x1'));var moment=require(_0xd207('0x2'));var BPromise=require(_0xd207('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd207('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd207('0x5'));var logger=require(_0xd207('0x6'))('rpc');var config=require(_0xd207('0x7'));var jayson=require(_0xd207('0x8'));var client=jayson[_0xd207('0x9')][_0xd207('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0cfe,_0x1bfc5a,_0x3e09c7){return new BPromise(function(_0x7def24,_0x304b70){return client[_0xd207('0xb')](_0x2e0cfe,_0x3e09c7)[_0xd207('0xc')](function(_0x545ab1){logger[_0xd207('0xd')](_0xd207('0xe'),_0x1bfc5a,_0xd207('0xf'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1bfc5a,_0xd207('0xf'),JSON[_0xd207('0x10')](_0x545ab1));if(_0x545ab1[_0xd207('0x11')]){if(_0x545ab1['error'][_0xd207('0x12')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1bfc5a,_0x545ab1['error'][_0xd207('0x13')]);return _0x304b70(_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);}logger[_0xd207('0x11')](_0xd207('0xe'),_0x1bfc5a,_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);return _0x7def24(_0x545ab1[_0xd207('0x11')][_0xd207('0x13')]);}else{logger[_0xd207('0xd')](_0xd207('0xe'),_0x1bfc5a,'request\x20sent');_0x7def24(_0x545ab1['result'][_0xd207('0x13')]);}})[_0xd207('0x14')](function(_0x38e8e8){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1bfc5a,_0x38e8e8);_0x304b70(_0x38e8e8);});});}exports[_0xd207('0x15')]=function(_0x1bdac4){var _0x3e7e60=this;return new Promise(function(_0x29a55c,_0x5c2799){return db[_0xd207('0x16')]['create'](_0x1bdac4['body'],{'raw':_0x1bdac4[_0xd207('0x17')]?_0x1bdac4[_0xd207('0x17')][_0xd207('0x18')]===undefined?!![]:![]:!![]})[_0xd207('0xc')](function(_0x2eb236){logger[_0xd207('0xd')](_0xd207('0x15'),_0x1bdac4);logger[_0xd207('0x19')](_0xd207('0x15'),_0x1bdac4,JSON[_0xd207('0x10')](_0x2eb236));_0x29a55c(_0x2eb236);})['catch'](function(_0x53fbf7){logger['error'](_0xd207('0x15'),_0x53fbf7[_0xd207('0x13')],_0x1bdac4);_0x5c2799(_0x3e7e60[_0xd207('0x11')](0x1f4,_0x53fbf7[_0xd207('0x13')]));});});};exports[_0xd207('0x1a')]=function(_0x5727a6){var _0x3b86db=this;return new Promise(function(_0x1b1646,_0x4d2233){return db[_0xd207('0x16')][_0xd207('0x1b')](_0x5727a6[_0xd207('0x1c')],{'raw':_0x5727a6[_0xd207('0x17')]?_0x5727a6['options'][_0xd207('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5727a6['options']?_0x5727a6[_0xd207('0x17')][_0xd207('0x1d')]||null:null,'attributes':_0x5727a6[_0xd207('0x17')]?_0x5727a6[_0xd207('0x17')][_0xd207('0x1e')]||null:null,'limit':_0x5727a6[_0xd207('0x17')]?_0x5727a6['options'][_0xd207('0x1f')]||null:null})[_0xd207('0xc')](function(_0x299999){logger[_0xd207('0xd')](_0xd207('0x1a'),_0x5727a6);logger[_0xd207('0x19')](_0xd207('0x1a'),_0x5727a6,JSON[_0xd207('0x10')](_0x299999));_0x1b1646(_0x299999);})[_0xd207('0x14')](function(_0x2ab534){logger['error'](_0xd207('0x1a'),_0x2ab534[_0xd207('0x13')],_0x5727a6);_0x4d2233(_0x3b86db[_0xd207('0x11')](0x1f4,_0x2ab534[_0xd207('0x13')]));});});}; \ No newline at end of file +var _0xe80c=['limit','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','raw','info','UpdateVoiceDialReport','options','where','attributes'];(function(_0x541423,_0x12c464){var _0x2e644c=function(_0x86dfa){while(--_0x86dfa){_0x541423['push'](_0x541423['shift']());}};_0x2e644c(++_0x12c464);}(_0xe80c,0x1c2));var _0xce80=function(_0x4f394c,_0x281949){_0x4f394c=_0x4f394c-0x0;var _0x442544=_0xe80c[_0x4f394c];return _0x442544;};'use strict';var _=require('lodash');var util=require(_0xce80('0x0'));var moment=require(_0xce80('0x1'));var BPromise=require(_0xce80('0x2'));var rs=require(_0xce80('0x3'));var fs=require('fs');var Redis=require(_0xce80('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xce80('0x5'));var logger=require(_0xce80('0x6'))(_0xce80('0x7'));var config=require(_0xce80('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xce80('0x9')][_0xce80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd8b88e,_0x53574f,_0x2e1dc6){return new BPromise(function(_0x4c2e58,_0x40ee29){return client['request'](_0xd8b88e,_0x2e1dc6)[_0xce80('0xb')](function(_0x3331d6){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x53574f,_0xce80('0xc'));logger[_0xce80('0xd')](_0xce80('0xe'),_0x53574f,_0xce80('0xc'),JSON[_0xce80('0xf')](_0x3331d6));if(_0x3331d6[_0xce80('0x10')]){if(_0x3331d6[_0xce80('0x10')][_0xce80('0x11')]===0x1f4){logger['error'](_0xce80('0x12'),_0x53574f,_0x3331d6[_0xce80('0x10')][_0xce80('0x13')]);return _0x40ee29(_0x3331d6['error']['message']);}logger[_0xce80('0x10')](_0xce80('0x12'),_0x53574f,_0x3331d6[_0xce80('0x10')][_0xce80('0x13')]);return _0x4c2e58(_0x3331d6['error'][_0xce80('0x13')]);}else{logger['info'](_0xce80('0x12'),_0x53574f,'request\x20sent');_0x4c2e58(_0x3331d6[_0xce80('0x14')][_0xce80('0x13')]);}})['catch'](function(_0x58c0ab){logger['error'](_0xce80('0x12'),_0x53574f,_0x58c0ab);_0x40ee29(_0x58c0ab);});});}exports[_0xce80('0x15')]=function(_0x148d57){var _0x27b646=this;return new Promise(function(_0x4375b7,_0x5ebf73){return db[_0xce80('0x16')][_0xce80('0x17')](_0x148d57['body'],{'raw':_0x148d57['options']?_0x148d57['options'][_0xce80('0x18')]===undefined?!![]:![]:!![]})[_0xce80('0xb')](function(_0x468b61){logger[_0xce80('0x19')]('CreateVoiceDialReport',_0x148d57);logger[_0xce80('0xd')](_0xce80('0x15'),_0x148d57,JSON[_0xce80('0xf')](_0x468b61));_0x4375b7(_0x468b61);})['catch'](function(_0x4df9bb){logger[_0xce80('0x10')]('CreateVoiceDialReport',_0x4df9bb[_0xce80('0x13')],_0x148d57);_0x5ebf73(_0x27b646[_0xce80('0x10')](0x1f4,_0x4df9bb[_0xce80('0x13')]));});});};exports[_0xce80('0x1a')]=function(_0x4fc91c){var _0x199d17=this;return new Promise(function(_0x4982a9,_0x42a1dd){return db[_0xce80('0x16')]['update'](_0x4fc91c['body'],{'raw':_0x4fc91c[_0xce80('0x1b')]?_0x4fc91c['options'][_0xce80('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc91c[_0xce80('0x1b')]?_0x4fc91c[_0xce80('0x1b')][_0xce80('0x1c')]||null:null,'attributes':_0x4fc91c['options']?_0x4fc91c[_0xce80('0x1b')][_0xce80('0x1d')]||null:null,'limit':_0x4fc91c[_0xce80('0x1b')]?_0x4fc91c[_0xce80('0x1b')][_0xce80('0x1e')]||null:null})[_0xce80('0xb')](function(_0x4d8796){logger[_0xce80('0x19')]('UpdateVoiceDialReport',_0x4fc91c);logger[_0xce80('0xd')](_0xce80('0x1a'),_0x4fc91c,JSON[_0xce80('0xf')](_0x4d8796));_0x4982a9(_0x4d8796);})[_0xce80('0x1f')](function(_0x279931){logger[_0xce80('0x10')](_0xce80('0x1a'),_0x279931['message'],_0x4fc91c);_0x42a1dd(_0x199d17[_0xce80('0x10')](0x1f4,_0x279931['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 618dee6..8fac33a 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 _0x5973=['post','create','/:id/applications','addApplications','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show'];(function(_0x828125,_0x42c440){var _0xbb2fc6=function(_0x108ab4){while(--_0x108ab4){_0x828125['push'](_0x828125['shift']());}};_0xbb2fc6(++_0x42c440);}(_0x5973,0xb9));var _0x3597=function(_0x59946f,_0x5a12f3){_0x59946f=_0x59946f-0x0;var _0x3d4dd9=_0x5973[_0x59946f];return _0x3d4dd9;};'use strict';var multer=require(_0x3597('0x0'));var util=require(_0x3597('0x1'));var path=require('path');var timeout=require(_0x3597('0x2'));var express=require(_0x3597('0x3'));var router=express['Router']();var auth=require(_0x3597('0x4'));var interaction=require(_0x3597('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x3597('0x6')]('/',auth[_0x3597('0x7')](),controller['index']);router[_0x3597('0x6')](_0x3597('0x8'),auth['isAuthenticated'](),controller[_0x3597('0x9')]);router[_0x3597('0xa')]('/',auth['isAuthenticated'](),controller[_0x3597('0xb')]);router[_0x3597('0xa')](_0x3597('0xc'),auth['isAuthenticated'](),controller[_0x3597('0xd')]);router['put'](_0x3597('0x8'),auth[_0x3597('0x7')](),controller['update']);router[_0x3597('0xe')](_0x3597('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4301=['util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer'];(function(_0x41ca44,_0x26dba4){var _0x42e3a7=function(_0x36845b){while(--_0x36845b){_0x41ca44['push'](_0x41ca44['shift']());}};_0x42e3a7(++_0x26dba4);}(_0x4301,0x103));var _0x1430=function(_0x1c8ee9,_0x4d3e93){_0x1c8ee9=_0x1c8ee9-0x0;var _0x51a54a=_0x4301[_0x1c8ee9];return _0x51a54a;};'use strict';var multer=require(_0x1430('0x0'));var util=require(_0x1430('0x1'));var path=require('path');var timeout=require(_0x1430('0x2'));var express=require('express');var router=express[_0x1430('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1430('0x4'));var config=require(_0x1430('0x5'));var controller=require(_0x1430('0x6'));router[_0x1430('0x7')]('/',auth[_0x1430('0x8')](),controller[_0x1430('0x9')]);router[_0x1430('0x7')](_0x1430('0xa'),auth[_0x1430('0x8')](),controller[_0x1430('0xb')]);router[_0x1430('0xc')]('/',auth[_0x1430('0x8')](),controller[_0x1430('0xd')]);router['post'](_0x1430('0xe'),auth[_0x1430('0x8')](),controller[_0x1430('0xf')]);router[_0x1430('0x10')](_0x1430('0xa'),auth[_0x1430('0x8')](),controller['update']);router[_0x1430('0x11')]('/:id',auth[_0x1430('0x8')](),controller[_0x1430('0x12')]);module[_0x1430('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 45e7ab5..8262871 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(_0x26d158,_0x537afd){var _0x4d6b6f=function(_0x40d025){while(--_0x40d025){_0x26d158['push'](_0x26d158['shift']());}};_0x4d6b6f(++_0x537afd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x42bbc5,_0x4b6111){var _0xc4a454=function(_0x3da3a5){while(--_0x3da3a5){_0x42bbc5['push'](_0x42bbc5['shift']());}};_0xc4a454(++_0x4b6111);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 03eb036..9484d90 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7880=['OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','find','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceExtension','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','length','catch','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','status','end','offset','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x5063bb,_0x613149){var _0x27d6fd=function(_0x1fc0b5){while(--_0x1fc0b5){_0x5063bb['push'](_0x5063bb['shift']());}};_0x27d6fd(++_0x613149);}(_0x7880,0x1f4));var _0x0788=function(_0x240860,_0x20c04d){_0x240860=_0x240860-0x0;var _0x40e288=_0x7880[_0x240860];return _0x40e288;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var db=require(_0x0788('0x18'))['db'];config[_0x0788('0x19')]=_[_0x0788('0x1a')](config[_0x0788('0x19')],{'host':_0x0788('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0x19')]));require(_0x0788('0x1c'))[_0x0788('0x1d')](socket);function respondWithStatusCode(_0x13cf07,_0x51e5d3){_0x51e5d3=_0x51e5d3||0xcc;return function(_0x43ca01){if(_0x43ca01){return _0x13cf07['sendStatus'](_0x51e5d3);}return _0x13cf07[_0x0788('0x1e')](_0x51e5d3)[_0x0788('0x1f')]();};}function respondWithResult(_0x3fd1e4,_0xb406fb){_0xb406fb=_0xb406fb||0xc8;return function(_0x2ddd1a){if(_0x2ddd1a){return _0x3fd1e4[_0x0788('0x1e')](_0xb406fb)['json'](_0x2ddd1a);}};}function respondWithFilteredResult(_0x573822,_0x17d805){return function(_0x461d9d){if(_0x461d9d){var _0x5b2bdc=_0x461d9d['count'],_0x654e4b=_0x17d805[_0x0788('0x20')],_0x415f19=_0x17d805[_0x0788('0x20')]+_0x17d805['limit'],_0x17ae59;if(_0x415f19>=_0x5b2bdc){_0x415f19=_0x5b2bdc;_0x17ae59=0xc8;}else{_0x17ae59=0xce;}_0x573822[_0x0788('0x1e')](_0x17ae59);return _0x573822['set'](_0x0788('0x21'),_0x654e4b+'-'+_0x415f19+'/'+_0x5b2bdc)['json'](_0x461d9d);}return null;};}function patchUpdates(_0x17cca3){return function(_0x3c37ca){try{jsonpatch[_0x0788('0x22')](_0x3c37ca,_0x17cca3,!![]);}catch(_0x3cd197){return BPromise[_0x0788('0x23')](_0x3cd197);}return _0x3c37ca['save']();};}function saveUpdates(_0x48ec43,_0x2270d4){return function(_0x2a1460){if(_0x2a1460){return _0x2a1460[_0x0788('0x24')](_0x48ec43)[_0x0788('0x25')](function(_0x5ba1da){return _0x5ba1da;});}return null;};}function removeEntity(_0x4d5c93,_0x79204e){return function(_0x18cc33){if(_0x18cc33){return _0x18cc33[_0x0788('0x26')]()['then'](function(){var _0x4b2693=_0x18cc33[_0x0788('0x27')]({'plain':!![]});var _0xa1f7dc=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x0788('0x28'),'value':_0x0788('0x29'),'ignore':![]},{'name':'InternalRoutes','value':_0x0788('0x2a'),'ignore':![]}];var _0x40e7a6=_(_0xa1f7dc)[_0x0788('0x2b')](_0x0788('0x2c'))[_0x0788('0x2d')](_0x0788('0x2e'))[_0x0788('0x2e')]();if(_[_0x0788('0x2f')](_0x40e7a6,_0x4b2693['type'])){return;}var _0x5a5178=_[_0x0788('0x30')](_0xa1f7dc,[_0x0788('0x2e'),_0x4b2693['type']])['name'];return db[_0x0788('0x31')][_0x0788('0x26')]({'where':{'type':_0x5a5178,'resourceId':_0x4b2693['id']}})[_0x0788('0x25')](function(){return _0x18cc33;});})[_0x0788('0x25')](function(){_0x4d5c93[_0x0788('0x1e')](0xcc)[_0x0788('0x1f')]();});}};}function handleEntityNotFound(_0x327d67,_0x36e077){return function(_0x28a50a){if(!_0x28a50a){_0x327d67[_0x0788('0x32')](0x194);}return _0x28a50a;};}function handleError(_0x5ec0ed,_0x2a08b7){_0x2a08b7=_0x2a08b7||0x1f4;return function(_0x1aab6a){logger[_0x0788('0x33')](_0x1aab6a[_0x0788('0x34')]);if(_0x1aab6a[_0x0788('0x35')]){delete _0x1aab6a[_0x0788('0x35')];}_0x5ec0ed[_0x0788('0x1e')](_0x2a08b7)[_0x0788('0x36')](_0x1aab6a);};}exports[_0x0788('0x37')]=function(_0xaed27e,_0x4fa055){var _0x4ae132={},_0x5947d3={},_0x5633da={'count':0x0,'rows':[]};var _0x516cce=_['map'](db[_0x0788('0x38')][_0x0788('0x39')],function(_0x2130e3){return{'name':_0x2130e3['fieldName'],'type':_0x2130e3[_0x0788('0x3a')][_0x0788('0x3b')]};});_0x5947d3[_0x0788('0x3c')]=_[_0x0788('0x2d')](_0x516cce,'name');_0x5947d3[_0x0788('0x3d')]=_['keys'](_0xaed27e[_0x0788('0x3d')]);_0x5947d3['filters']=_[_0x0788('0x3e')](_0x5947d3[_0x0788('0x3c')],_0x5947d3['query']);_0x4ae132[_0x0788('0x3f')]=_[_0x0788('0x3e')](_0x5947d3['model'],qs[_0x0788('0x40')](_0xaed27e['query'][_0x0788('0x40')]));_0x4ae132['attributes']=_0x4ae132[_0x0788('0x3f')]['length']?_0x4ae132[_0x0788('0x3f')]:_0x5947d3['model'];if(!_0xaed27e['query'][_0x0788('0x41')](_0x0788('0x42'))){_0x4ae132[_0x0788('0x43')]=qs[_0x0788('0x43')](_0xaed27e[_0x0788('0x3d')]['limit']);_0x4ae132['offset']=qs['offset'](_0xaed27e['query'][_0x0788('0x20')]);}_0x4ae132[_0x0788('0x44')]=qs[_0x0788('0x45')](_0xaed27e[_0x0788('0x3d')][_0x0788('0x45')]);_0x4ae132['where']=qs['filters'](_[_0x0788('0x46')](_0xaed27e[_0x0788('0x3d')],_0x5947d3[_0x0788('0x47')]),_0x516cce);if(_0xaed27e[_0x0788('0x3d')][_0x0788('0x2b')]){_0x4ae132[_0x0788('0x48')]=_[_0x0788('0x49')](_0x4ae132[_0x0788('0x48')],{'$or':_[_0x0788('0x2d')](_0x516cce,function(_0x50e8f5){if(_0x50e8f5['type']!==_0x0788('0x4a')){var _0x1d579d={};_0x1d579d[_0x50e8f5[_0x0788('0x35')]]={'$like':'%'+_0xaed27e['query']['filter']+'%'};return _0x1d579d;}})});}_0x4ae132=_['merge']({},_0x4ae132,_0xaed27e[_0x0788('0x4b')]);var _0x150c1e={'where':_0x4ae132[_0x0788('0x48')]};return db[_0x0788('0x38')][_0x0788('0x4c')](_0x150c1e)[_0x0788('0x25')](function(_0x1ab634){_0x5633da[_0x0788('0x4c')]=_0x1ab634;if(_0xaed27e['query'][_0x0788('0x4d')]){_0x4ae132[_0x0788('0x4e')]=[{'all':!![]}];}return db[_0x0788('0x38')][_0x0788('0x4f')](_0x4ae132);})['then'](function(_0x6aa745){_0x5633da[_0x0788('0x50')]=_0x6aa745;return _0x5633da;})['then'](respondWithFilteredResult(_0x4fa055,_0x4ae132))['catch'](handleError(_0x4fa055,null));};exports['show']=function(_0xad94dc,_0x5e010a){var _0x474027={'raw':![],'where':{'id':_0xad94dc[_0x0788('0x51')]['id']}},_0x2c5e0a={};_0x2c5e0a[_0x0788('0x3c')]=_[_0x0788('0x52')](db[_0x0788('0x38')][_0x0788('0x39')]);_0x2c5e0a[_0x0788('0x3d')]=_['keys'](_0xad94dc['query']);_0x2c5e0a[_0x0788('0x47')]=_[_0x0788('0x3e')](_0x2c5e0a[_0x0788('0x3c')],_0x2c5e0a['query']);_0x474027[_0x0788('0x3f')]=_[_0x0788('0x3e')](_0x2c5e0a[_0x0788('0x3c')],qs[_0x0788('0x40')](_0xad94dc[_0x0788('0x3d')]['fields']));_0x474027['attributes']=_0x474027[_0x0788('0x3f')][_0x0788('0x53')]?_0x474027['attributes']:_0x2c5e0a[_0x0788('0x3c')];if(_0xad94dc['query'][_0x0788('0x4d')]){_0x474027[_0x0788('0x4e')]=[{'all':!![]}];}_0x474027=_[_0x0788('0x49')]({},_0x474027,_0xad94dc[_0x0788('0x4b')]);return db[_0x0788('0x38')][_0x0788('0x30')](_0x474027)[_0x0788('0x25')](handleEntityNotFound(_0x5e010a,null))[_0x0788('0x25')](respondWithResult(_0x5e010a,null))['catch'](handleError(_0x5e010a,null));};exports[_0x0788('0x26')]=function(_0x363ab9,_0x3f2f1b){return db['VoiceExtension'][_0x0788('0x30')]({'where':{'id':_0x363ab9[_0x0788('0x51')]['id']}})['then'](handleEntityNotFound(_0x3f2f1b,null))[_0x0788('0x25')](removeEntity(_0x3f2f1b,null))[_0x0788('0x54')](handleError(_0x3f2f1b,null));};exports[_0x0788('0x55')]=function(_0x1192b4,_0x137e24){if(_0x1192b4[_0x0788('0x56')]['type']==='outbound'&&!_[_0x0788('0x57')](_0x1192b4[_0x0788('0x56')]['exten'],'_')){_0x1192b4[_0x0788('0x56')][_0x0788('0x58')]='_'[_0x0788('0x59')](_0x1192b4[_0x0788('0x56')][_0x0788('0x58')]);}return db[_0x0788('0x38')][_0x0788('0x55')](_0x1192b4[_0x0788('0x56')],{'raw':![]})[_0x0788('0x25')](function(_0x395398){var _0x25b44a=_0x1192b4[_0x0788('0x5a')]['get']({'plain':!![]});if(!_0x25b44a)throw new Error(_0x0788('0x5b'));if(_0x25b44a[_0x0788('0x5c')]===_0x0788('0x5a')){var _0x5ba197=_0x395398[_0x0788('0x27')]({'plain':!![]});var _0x329d44=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x0788('0x28'),'value':_0x0788('0x29')},{'name':_0x0788('0x5d'),'value':_0x0788('0x2a')}];var _0x2c0bcc=_[_0x0788('0x30')](_0x329d44,['value',_0x5ba197[_0x0788('0x3a')]])[_0x0788('0x35')];return db[_0x0788('0x5e')]['find']({'where':{'name':_0x2c0bcc,'userProfileId':_0x25b44a['userProfileId']},'raw':!![]})[_0x0788('0x25')](function(_0x5419d9){if(_0x5419d9&&_0x5419d9[_0x0788('0x5f')]===0x0){return db[_0x0788('0x31')][_0x0788('0x55')]({'name':_0x5ba197[_0x0788('0x35')],'resourceId':_0x5ba197['id'],'type':_0x5419d9[_0x0788('0x35')],'sectionId':_0x5419d9['id']},{})[_0x0788('0x25')](function(){return _0x395398;});}else{return _0x395398;}})[_0x0788('0x54')](function(_0x29c912){logger[_0x0788('0x33')](_0x0788('0x60'),_0x29c912);throw _0x29c912;});}return _0x395398;})['then'](respondWithResult(_0x137e24,0xc9))[_0x0788('0x54')](handleError(_0x137e24,null));};exports[_0x0788('0x24')]=function(_0x602e3b,_0x2822aa){if(_0x602e3b['body']['id']){delete _0x602e3b[_0x0788('0x56')]['id'];}return db[_0x0788('0x38')][_0x0788('0x30')]({'where':{'id':_0x602e3b[_0x0788('0x51')]['id']}})[_0x0788('0x25')](handleEntityNotFound(_0x2822aa,null))['then'](function(_0xf2031){if(_0xf2031){return db['VoiceExtension'][_0x0788('0x24')](_[_0x0788('0x46')](_0x602e3b[_0x0788('0x56')],[_0x0788('0x58'),_0x0788('0x61'),_0x0788('0x62'),_0x0788('0x63'),_0x0788('0x64'),_0x0788('0x65')]),{'where':{'context':_0xf2031['context'],'exten':_0xf2031[_0x0788('0x58')]},'individualHooks':!![]})[_0x0788('0x25')](function(_0x60e880){return _0x60e880;});}return null;})['then'](respondWithStatusCode(_0x2822aa,null))['catch'](handleError(_0x2822aa,null));};exports[_0x0788('0x66')]=function(_0x1bb234,_0x31ed44,_0x51baa4){return db[_0x0788('0x38')][_0x0788('0x67')]({'where':{'id':_0x1bb234[_0x0788('0x51')]['id']}})[_0x0788('0x25')](handleEntityNotFound(_0x31ed44,null))['then'](function(_0x5c2feb){if(_0x5c2feb){return db['sequelize'][_0x0788('0x68')](function(_0x2a55f2){return db[_0x0788('0x38')]['destroy']({'where':{'VoiceExtensionId':_0x1bb234['params']['id']},'transaction':_0x2a55f2})[_0x0788('0x25')](function(_0x56c4bc){var _0x955bfa=_[_0x0788('0x2d')](_0x1bb234[_0x0788('0x56')],function(_0x12ed24){_0x12ed24[_0x0788('0x69')]=_0x1bb234[_0x0788('0x51')]['id'];return _0x12ed24;});return db[_0x0788('0x38')][_0x0788('0x6a')](_0x955bfa,{'transaction':_0x2a55f2});});})[_0x0788('0x25')](function(){return db[_0x0788('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1bb234[_0x0788('0x51')]['id']},'order':_0x0788('0x6b')});});}})['then'](respondWithResult(_0x31ed44,null))['catch'](handleError(_0x31ed44,null));}; \ No newline at end of file +var _0x2ef3=['api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','destroy','end','stack','send','VoiceExtension','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','options','includeAll','rows','catch','show','params','length','include','merge','create','body','exten','concat','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','addApplications','findOne','sequelize','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x934d6d,_0x26be85){var _0x3eec2e=function(_0x21f304){while(--_0x21f304){_0x934d6d['push'](_0x934d6d['shift']());}};_0x3eec2e(++_0x26be85);}(_0x2ef3,0xba));var _0x32ef=function(_0x422603,_0x4808e5){_0x422603=_0x422603-0x0;var _0x1d4b1b=_0x2ef3[_0x422603];return _0x1d4b1b;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];config['redis']=_[_0x32ef('0x19')](config['redis'],{'host':_0x32ef('0x1a'),'port':0x18eb});var socket=require(_0x32ef('0x1b'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x32ef('0x1c')](socket);function respondWithStatusCode(_0x4d8009,_0x326fce){_0x326fce=_0x326fce||0xcc;return function(_0x40a6e6){if(_0x40a6e6){return _0x4d8009[_0x32ef('0x1d')](_0x326fce);}return _0x4d8009[_0x32ef('0x1e')](_0x326fce)['end']();};}function respondWithResult(_0x55bf0b,_0x531e30){_0x531e30=_0x531e30||0xc8;return function(_0x13db1a){if(_0x13db1a){return _0x55bf0b[_0x32ef('0x1e')](_0x531e30)[_0x32ef('0x1f')](_0x13db1a);}};}function respondWithFilteredResult(_0x53a5ca,_0x5d559b){return function(_0x1eb468){if(_0x1eb468){var _0x1a9476=_0x1eb468[_0x32ef('0x20')],_0x286bfb=_0x5d559b['offset'],_0x57863c=_0x5d559b[_0x32ef('0x21')]+_0x5d559b[_0x32ef('0x22')],_0xbe37f6;if(_0x57863c>=_0x1a9476){_0x57863c=_0x1a9476;_0xbe37f6=0xc8;}else{_0xbe37f6=0xce;}_0x53a5ca[_0x32ef('0x1e')](_0xbe37f6);return _0x53a5ca[_0x32ef('0x23')](_0x32ef('0x24'),_0x286bfb+'-'+_0x57863c+'/'+_0x1a9476)[_0x32ef('0x1f')](_0x1eb468);}return null;};}function patchUpdates(_0x4de441){return function(_0x3c5b78){try{jsonpatch['apply'](_0x3c5b78,_0x4de441,!![]);}catch(_0x309866){return BPromise[_0x32ef('0x25')](_0x309866);}return _0x3c5b78['save']();};}function saveUpdates(_0x1af371,_0x97780){return function(_0x5e8898){if(_0x5e8898){return _0x5e8898['update'](_0x1af371)['then'](function(_0x22f2d7){return _0x22f2d7;});}return null;};}function removeEntity(_0xb30fab,_0x225feb){return function(_0x478bef){if(_0x478bef){return _0x478bef['destroy']()[_0x32ef('0x26')](function(){var _0x4d584b=_0x478bef['get']({'plain':!![]});var _0x278495=[{'name':_0x32ef('0x27'),'value':_0x32ef('0x28'),'ignore':![]},{'name':_0x32ef('0x29'),'value':_0x32ef('0x2a'),'ignore':![]},{'name':_0x32ef('0x2b'),'value':_0x32ef('0x2c'),'ignore':![]}];var _0x38aed5=_(_0x278495)[_0x32ef('0x2d')](_0x32ef('0x2e'))[_0x32ef('0x2f')](_0x32ef('0x30'))['value']();if(_[_0x32ef('0x31')](_0x38aed5,_0x4d584b[_0x32ef('0x32')])){return;}var _0x5a04cd=_[_0x32ef('0x33')](_0x278495,[_0x32ef('0x30'),_0x4d584b[_0x32ef('0x32')]])[_0x32ef('0x34')];return db['UserProfileResource'][_0x32ef('0x35')]({'where':{'type':_0x5a04cd,'resourceId':_0x4d584b['id']}})[_0x32ef('0x26')](function(){return _0x478bef;});})[_0x32ef('0x26')](function(){_0xb30fab[_0x32ef('0x1e')](0xcc)[_0x32ef('0x36')]();});}};}function handleEntityNotFound(_0x1a6ed2,_0x1a122d){return function(_0x575f3e){if(!_0x575f3e){_0x1a6ed2[_0x32ef('0x1d')](0x194);}return _0x575f3e;};}function handleError(_0x537214,_0x38bf73){_0x38bf73=_0x38bf73||0x1f4;return function(_0x2b6c6a){logger['error'](_0x2b6c6a[_0x32ef('0x37')]);if(_0x2b6c6a[_0x32ef('0x34')]){delete _0x2b6c6a[_0x32ef('0x34')];}_0x537214[_0x32ef('0x1e')](_0x38bf73)[_0x32ef('0x38')](_0x2b6c6a);};}exports['index']=function(_0x50ecd6,_0x2a5eb5){var _0x5dadf7={},_0x643dc4={},_0x15b873={'count':0x0,'rows':[]};var _0x2f1349=_[_0x32ef('0x2f')](db[_0x32ef('0x39')][_0x32ef('0x3a')],function(_0x566b56){return{'name':_0x566b56['fieldName'],'type':_0x566b56['type'][_0x32ef('0x3b')]};});_0x643dc4[_0x32ef('0x3c')]=_[_0x32ef('0x2f')](_0x2f1349,'name');_0x643dc4['query']=_[_0x32ef('0x3d')](_0x50ecd6[_0x32ef('0x3e')]);_0x643dc4[_0x32ef('0x3f')]=_['intersection'](_0x643dc4['model'],_0x643dc4[_0x32ef('0x3e')]);_0x5dadf7[_0x32ef('0x40')]=_[_0x32ef('0x41')](_0x643dc4[_0x32ef('0x3c')],qs[_0x32ef('0x42')](_0x50ecd6[_0x32ef('0x3e')][_0x32ef('0x42')]));_0x5dadf7[_0x32ef('0x40')]=_0x5dadf7[_0x32ef('0x40')]['length']?_0x5dadf7[_0x32ef('0x40')]:_0x643dc4[_0x32ef('0x3c')];if(!_0x50ecd6[_0x32ef('0x3e')]['hasOwnProperty'](_0x32ef('0x43'))){_0x5dadf7[_0x32ef('0x22')]=qs[_0x32ef('0x22')](_0x50ecd6[_0x32ef('0x3e')][_0x32ef('0x22')]);_0x5dadf7[_0x32ef('0x21')]=qs[_0x32ef('0x21')](_0x50ecd6[_0x32ef('0x3e')][_0x32ef('0x21')]);}_0x5dadf7[_0x32ef('0x44')]=qs[_0x32ef('0x45')](_0x50ecd6[_0x32ef('0x3e')]['sort']);_0x5dadf7[_0x32ef('0x46')]=qs[_0x32ef('0x3f')](_[_0x32ef('0x47')](_0x50ecd6[_0x32ef('0x3e')],_0x643dc4[_0x32ef('0x3f')]),_0x2f1349);if(_0x50ecd6[_0x32ef('0x3e')][_0x32ef('0x2d')]){_0x5dadf7['where']=_['merge'](_0x5dadf7[_0x32ef('0x46')],{'$or':_[_0x32ef('0x2f')](_0x2f1349,function(_0x2a33dd){if(_0x2a33dd[_0x32ef('0x32')]!=='VIRTUAL'){var _0x2901a1={};_0x2901a1[_0x2a33dd[_0x32ef('0x34')]]={'$like':'%'+_0x50ecd6['query'][_0x32ef('0x2d')]+'%'};return _0x2901a1;}})});}_0x5dadf7=_['merge']({},_0x5dadf7,_0x50ecd6[_0x32ef('0x48')]);var _0x100ec7={'where':_0x5dadf7[_0x32ef('0x46')]};return db[_0x32ef('0x39')][_0x32ef('0x20')](_0x100ec7)[_0x32ef('0x26')](function(_0x321ef7){_0x15b873[_0x32ef('0x20')]=_0x321ef7;if(_0x50ecd6[_0x32ef('0x3e')][_0x32ef('0x49')]){_0x5dadf7['include']=[{'all':!![]}];}return db[_0x32ef('0x39')]['findAll'](_0x5dadf7);})[_0x32ef('0x26')](function(_0x33c25b){_0x15b873[_0x32ef('0x4a')]=_0x33c25b;return _0x15b873;})['then'](respondWithFilteredResult(_0x2a5eb5,_0x5dadf7))[_0x32ef('0x4b')](handleError(_0x2a5eb5,null));};exports[_0x32ef('0x4c')]=function(_0x37b954,_0x241f82){var _0x35b4e0={'raw':![],'where':{'id':_0x37b954[_0x32ef('0x4d')]['id']}},_0x40bf12={};_0x40bf12['model']=_['keys'](db[_0x32ef('0x39')][_0x32ef('0x3a')]);_0x40bf12[_0x32ef('0x3e')]=_[_0x32ef('0x3d')](_0x37b954[_0x32ef('0x3e')]);_0x40bf12[_0x32ef('0x3f')]=_[_0x32ef('0x41')](_0x40bf12[_0x32ef('0x3c')],_0x40bf12[_0x32ef('0x3e')]);_0x35b4e0[_0x32ef('0x40')]=_[_0x32ef('0x41')](_0x40bf12[_0x32ef('0x3c')],qs[_0x32ef('0x42')](_0x37b954['query'][_0x32ef('0x42')]));_0x35b4e0[_0x32ef('0x40')]=_0x35b4e0[_0x32ef('0x40')][_0x32ef('0x4e')]?_0x35b4e0[_0x32ef('0x40')]:_0x40bf12[_0x32ef('0x3c')];if(_0x37b954[_0x32ef('0x3e')][_0x32ef('0x49')]){_0x35b4e0[_0x32ef('0x4f')]=[{'all':!![]}];}_0x35b4e0=_[_0x32ef('0x50')]({},_0x35b4e0,_0x37b954[_0x32ef('0x48')]);return db[_0x32ef('0x39')][_0x32ef('0x33')](_0x35b4e0)[_0x32ef('0x26')](handleEntityNotFound(_0x241f82,null))[_0x32ef('0x26')](respondWithResult(_0x241f82,null))[_0x32ef('0x4b')](handleError(_0x241f82,null));};exports[_0x32ef('0x35')]=function(_0x2c1b44,_0x4e0d6b){return db['VoiceExtension'][_0x32ef('0x33')]({'where':{'id':_0x2c1b44[_0x32ef('0x4d')]['id']}})[_0x32ef('0x26')](handleEntityNotFound(_0x4e0d6b,null))[_0x32ef('0x26')](removeEntity(_0x4e0d6b,null))[_0x32ef('0x4b')](handleError(_0x4e0d6b,null));};exports[_0x32ef('0x51')]=function(_0x1572d9,_0x1f105a){if(_0x1572d9[_0x32ef('0x52')][_0x32ef('0x32')]===_0x32ef('0x2a')&&!_['startsWith'](_0x1572d9[_0x32ef('0x52')][_0x32ef('0x53')],'_')){_0x1572d9[_0x32ef('0x52')][_0x32ef('0x53')]='_'[_0x32ef('0x54')](_0x1572d9[_0x32ef('0x52')]['exten']);}return db[_0x32ef('0x39')][_0x32ef('0x51')](_0x1572d9[_0x32ef('0x52')],{'raw':![]})['then'](function(_0x1b0faa){var _0x52692a=_0x1572d9[_0x32ef('0x55')][_0x32ef('0x56')]({'plain':!![]});if(!_0x52692a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52692a[_0x32ef('0x57')]==='user'){var _0x13f5db=_0x1b0faa[_0x32ef('0x56')]({'plain':!![]});var _0x2bff39=[{'name':_0x32ef('0x27'),'value':_0x32ef('0x28')},{'name':_0x32ef('0x29'),'value':_0x32ef('0x2a')},{'name':'InternalRoutes','value':'internal'}];var _0xdfa103=_['find'](_0x2bff39,['value',_0x13f5db[_0x32ef('0x32')]])[_0x32ef('0x34')];return db[_0x32ef('0x58')][_0x32ef('0x33')]({'where':{'name':_0xdfa103,'userProfileId':_0x52692a[_0x32ef('0x59')]},'raw':!![]})[_0x32ef('0x26')](function(_0x316547){if(_0x316547&&_0x316547[_0x32ef('0x5a')]===0x0){return db[_0x32ef('0x5b')][_0x32ef('0x51')]({'name':_0x13f5db['name'],'resourceId':_0x13f5db['id'],'type':_0x316547['name'],'sectionId':_0x316547['id']},{})[_0x32ef('0x26')](function(){return _0x1b0faa;});}else{return _0x1b0faa;}})[_0x32ef('0x4b')](function(_0x5549b4){logger[_0x32ef('0x5c')](_0x32ef('0x5d'),_0x5549b4);throw _0x5549b4;});}return _0x1b0faa;})[_0x32ef('0x26')](respondWithResult(_0x1f105a,0xc9))['catch'](handleError(_0x1f105a,null));};exports[_0x32ef('0x5e')]=function(_0x3c31d0,_0x20dcc5){if(_0x3c31d0['body']['id']){delete _0x3c31d0['body']['id'];}return db[_0x32ef('0x39')]['find']({'where':{'id':_0x3c31d0[_0x32ef('0x4d')]['id']}})['then'](handleEntityNotFound(_0x20dcc5,null))['then'](function(_0x24cf09){if(_0x24cf09){return db[_0x32ef('0x39')][_0x32ef('0x5e')](_['pick'](_0x3c31d0[_0x32ef('0x52')],[_0x32ef('0x53'),_0x32ef('0x5f'),'description',_0x32ef('0x60'),_0x32ef('0x61'),'mandatoryDisposition']),{'where':{'context':_0x24cf09['context'],'exten':_0x24cf09[_0x32ef('0x53')]},'individualHooks':!![]})[_0x32ef('0x26')](function(_0x2518a0){return _0x2518a0;});}return null;})[_0x32ef('0x26')](respondWithStatusCode(_0x20dcc5,null))[_0x32ef('0x4b')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x62')]=function(_0x4c89e8,_0x285330,_0x63b65){return db[_0x32ef('0x39')][_0x32ef('0x63')]({'where':{'id':_0x4c89e8[_0x32ef('0x4d')]['id']}})[_0x32ef('0x26')](handleEntityNotFound(_0x285330,null))[_0x32ef('0x26')](function(_0x3ff282){if(_0x3ff282){return db[_0x32ef('0x64')]['transaction'](function(_0x1d7898){return db[_0x32ef('0x39')][_0x32ef('0x35')]({'where':{'VoiceExtensionId':_0x4c89e8[_0x32ef('0x4d')]['id']},'transaction':_0x1d7898})[_0x32ef('0x26')](function(_0x5ad75c){var _0x47c0ed=_[_0x32ef('0x2f')](_0x4c89e8[_0x32ef('0x52')],function(_0x366903){_0x366903[_0x32ef('0x65')]=_0x4c89e8[_0x32ef('0x4d')]['id'];return _0x366903;});return db['VoiceExtension'][_0x32ef('0x66')](_0x47c0ed,{'transaction':_0x1d7898});});})['then'](function(){return db[_0x32ef('0x39')][_0x32ef('0x67')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4c89e8['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x32ef('0x26')](respondWithResult(_0x285330,null))[_0x32ef('0x4b')](handleError(_0x285330,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e8f5690..ac81e69 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 _0x95be=['VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x357dc4,_0x4ca350){var _0x20ca7b=function(_0xc8674a){while(--_0xc8674a){_0x357dc4['push'](_0x357dc4['shift']());}};_0x20ca7b(++_0x4ca350);}(_0x95be,0x10c));var _0xe95b=function(_0x34db51,_0x21227e){_0x34db51=_0x34db51-0x0;var _0x565fb8=_0x95be[_0x34db51];return _0x565fb8;};'use strict';var EventEmitter=require(_0xe95b('0x0'));var VoiceExtension=require(_0xe95b('0x1'))['db'][_0xe95b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe95b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe95b('0x4'),'afterDestroy':_0xe95b('0x5')};function emitEvent(_0xd5116c){return function(_0x218e8b,_0xc6a4af,_0x59a538){VoiceExtensionEvents[_0xe95b('0x6')](_0xd5116c+':'+_0x218e8b['id'],_0x218e8b);VoiceExtensionEvents[_0xe95b('0x6')](_0xd5116c,_0x218e8b);_0x59a538(null);};}for(var e in events){if(events[_0xe95b('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xe95b('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x92af=['VoiceExtension','setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x2d2ccc,_0x30f2fe){var _0x54dc55=function(_0x378643){while(--_0x378643){_0x2d2ccc['push'](_0x2d2ccc['shift']());}};_0x54dc55(++_0x30f2fe);}(_0x92af,0xee));var _0xf92a=function(_0x38314c,_0xc7487f){_0x38314c=_0x38314c-0x0;var _0x4d0d62=_0x92af[_0x38314c];return _0x4d0d62;};'use strict';var EventEmitter=require(_0xf92a('0x0'));var VoiceExtension=require(_0xf92a('0x1'))['db'][_0xf92a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf92a('0x3')](0x0);var events={'afterCreate':_0xf92a('0x4'),'afterUpdate':_0xf92a('0x5'),'afterDestroy':'remove'};function emitEvent(_0xacb462){return function(_0x4240e1,_0x2b4c41,_0x9a9e43){VoiceExtensionEvents[_0xf92a('0x6')](_0xacb462+':'+_0x4240e1['id'],_0x4240e1);VoiceExtensionEvents[_0xf92a('0x6')](_0xacb462,_0x4240e1);_0x9a9e43(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xf92a('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fbc9429..a994180 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 _0x5f66=['request-promise','path','../../config/environment','exports','VoiceExtension','voice_extensions','util','api','moment','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceExtension.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x455cad,_0x14897e){var _0x56ab87=function(_0x12cbbc){while(--_0x12cbbc){_0x455cad['push'](_0x455cad['shift']());}};_0x56ab87(++_0x14897e);}(_0xdb28,0x106));var _0x8db2=function(_0x2f2c10,_0x4e5134){_0x2f2c10=_0x2f2c10-0x0;var _0x4ed542=_0xdb28[_0x2f2c10];return _0x4ed542;};'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('./voiceExtension.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 594cf91..2b751c1 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 _0xbea4=['util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceExtension','lodash'];(function(_0x3d5437,_0x4647ce){var _0x5ae5ab=function(_0x1ea100){while(--_0x1ea100){_0x3d5437['push'](_0x3d5437['shift']());}};_0x5ae5ab(++_0x4647ce);}(_0xbea4,0x1ac));var _0x4bea=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xbea4[_0x279d37];return _0x530173;};'use strict';var _=require(_0x4bea('0x0'));var util=require(_0x4bea('0x1'));var moment=require('moment');var BPromise=require(_0x4bea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4bea('0x3'))(_0x4bea('0x4'));var config=require(_0x4bea('0x5'));var jayson=require(_0x4bea('0x6'));var client=jayson[_0x4bea('0x7')][_0x4bea('0x8')]({'port':0x232a});config['redis']=_[_0x4bea('0x9')](config[_0x4bea('0xa')],{'host':_0x4bea('0xb'),'port':0x18eb});var socket=require(_0x4bea('0xc'))(new Redis(config[_0x4bea('0xa')]));require(_0x4bea('0xd'))[_0x4bea('0xe')](socket);function respondWithRpcPromise(_0x1a3b1e,_0x3016f6,_0x4186e7){return new BPromise(function(_0x542b3c,_0x52f59f){return client[_0x4bea('0xf')](_0x1a3b1e,_0x4186e7)[_0x4bea('0x10')](function(_0x3dbb54){logger[_0x4bea('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x3016f6,_0x4bea('0x12'));logger[_0x4bea('0x13')](_0x4bea('0x14'),_0x3016f6,_0x4bea('0x12'),JSON[_0x4bea('0x15')](_0x3dbb54));if(_0x3dbb54['error']){if(_0x3dbb54[_0x4bea('0x16')][_0x4bea('0x17')]===0x1f4){logger[_0x4bea('0x16')](_0x4bea('0x18'),_0x3016f6,_0x3dbb54['error']['message']);return _0x52f59f(_0x3dbb54['error'][_0x4bea('0x19')]);}logger[_0x4bea('0x16')](_0x4bea('0x18'),_0x3016f6,_0x3dbb54['error']['message']);return _0x542b3c(_0x3dbb54[_0x4bea('0x16')][_0x4bea('0x19')]);}else{logger[_0x4bea('0x11')](_0x4bea('0x18'),_0x3016f6,_0x4bea('0x12'));_0x542b3c(_0x3dbb54[_0x4bea('0x1a')]['message']);}})[_0x4bea('0x1b')](function(_0x52769a){logger['error'](_0x4bea('0x18'),_0x3016f6,_0x52769a);_0x52f59f(_0x52769a);});});}exports['GetVoiceExtension']=function(_0x388e6d){var _0x4fe7f4=this;return new Promise(function(_0x3741e0,_0x470f6f){return db[_0x4bea('0x1c')][_0x4bea('0x1d')]({'raw':_0x388e6d[_0x4bea('0x1e')]?_0x388e6d['options'][_0x4bea('0x1f')]===undefined?!![]:![]:!![],'where':_0x388e6d['options']?_0x388e6d[_0x4bea('0x1e')][_0x4bea('0x20')]||null:null,'attributes':_0x388e6d[_0x4bea('0x1e')]?_0x388e6d['options'][_0x4bea('0x21')]||null:null,'limit':_0x388e6d[_0x4bea('0x1e')]?_0x388e6d[_0x4bea('0x1e')][_0x4bea('0x22')]||null:null,'include':_0x388e6d['options']?_0x388e6d[_0x4bea('0x1e')][_0x4bea('0x23')]?_['map'](_0x388e6d[_0x4bea('0x1e')]['include'],function(_0x3f52bc){return{'model':db[_0x3f52bc['model']],'as':_0x3f52bc['as'],'attributes':_0x3f52bc[_0x4bea('0x21')],'include':_0x3f52bc['include']?_['map'](_0x3f52bc[_0x4bea('0x23')],function(_0x1b934a){return{'model':db[_0x1b934a[_0x4bea('0x24')]],'as':_0x1b934a['as'],'attributes':_0x1b934a[_0x4bea('0x21')],'include':_0x1b934a['include']?_[_0x4bea('0x25')](_0x1b934a[_0x4bea('0x23')],function(_0x4e2360){return{'model':db[_0x4e2360[_0x4bea('0x24')]],'as':_0x4e2360['as'],'attributes':_0x4e2360[_0x4bea('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4bea('0x10')](function(_0x4f270c){logger[_0x4bea('0x11')](_0x4bea('0x26'),_0x388e6d);logger[_0x4bea('0x13')](_0x4bea('0x26'),_0x388e6d,JSON[_0x4bea('0x15')](_0x4f270c));_0x3741e0(_0x4f270c);})[_0x4bea('0x1b')](function(_0x496716){logger['error'](_0x4bea('0x26'),_0x496716[_0x4bea('0x19')],_0x388e6d);_0x470f6f(_0x4fe7f4[_0x4bea('0x16')](0x1f4,_0x496716['message']));});});}; \ No newline at end of file +var _0x0f6f=['redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','raw','options','where','attributes','limit','include','map','model','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x597c3c,_0x4271a6){var _0xd77240=function(_0x4ddc10){while(--_0x4ddc10){_0x597c3c['push'](_0x597c3c['shift']());}};_0xd77240(++_0x4271a6);}(_0x0f6f,0x6d));var _0xf0f6=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x0f6f[_0x4cfc1d];return _0x1c01a0;};'use strict';var _=require('lodash');var util=require(_0xf0f6('0x0'));var moment=require(_0xf0f6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f6('0x2'));var db=require(_0xf0f6('0x3'))['db'];var utils=require(_0xf0f6('0x4'));var logger=require(_0xf0f6('0x5'))(_0xf0f6('0x6'));var config=require(_0xf0f6('0x7'));var jayson=require(_0xf0f6('0x8'));var client=jayson[_0xf0f6('0x9')][_0xf0f6('0xa')]({'port':0x232a});config[_0xf0f6('0xb')]=_[_0xf0f6('0xc')](config[_0xf0f6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0f6('0xd'))(new Redis(config[_0xf0f6('0xb')]));require(_0xf0f6('0xe'))[_0xf0f6('0xf')](socket);function respondWithRpcPromise(_0x46c398,_0x128827,_0x11aa29){return new BPromise(function(_0x5ac279,_0x213f70){return client[_0xf0f6('0x10')](_0x46c398,_0x11aa29)[_0xf0f6('0x11')](function(_0x43466f){logger[_0xf0f6('0x12')](_0xf0f6('0x13'),_0x128827,_0xf0f6('0x14'));logger[_0xf0f6('0x15')](_0xf0f6('0x16'),_0x128827,_0xf0f6('0x14'),JSON[_0xf0f6('0x17')](_0x43466f));if(_0x43466f['error']){if(_0x43466f[_0xf0f6('0x18')][_0xf0f6('0x19')]===0x1f4){logger[_0xf0f6('0x18')](_0xf0f6('0x13'),_0x128827,_0x43466f[_0xf0f6('0x18')][_0xf0f6('0x1a')]);return _0x213f70(_0x43466f[_0xf0f6('0x18')][_0xf0f6('0x1a')]);}logger['error'](_0xf0f6('0x13'),_0x128827,_0x43466f[_0xf0f6('0x18')][_0xf0f6('0x1a')]);return _0x5ac279(_0x43466f['error'][_0xf0f6('0x1a')]);}else{logger[_0xf0f6('0x12')](_0xf0f6('0x13'),_0x128827,'request\x20sent');_0x5ac279(_0x43466f[_0xf0f6('0x1b')][_0xf0f6('0x1a')]);}})[_0xf0f6('0x1c')](function(_0xf14b1b){logger[_0xf0f6('0x18')](_0xf0f6('0x13'),_0x128827,_0xf14b1b);_0x213f70(_0xf14b1b);});});}exports[_0xf0f6('0x1d')]=function(_0x38137b){var _0x189e99=this;return new Promise(function(_0x5602de,_0x57ff5b){return db[_0xf0f6('0x1e')][_0xf0f6('0x1f')]({'raw':_0x38137b['options']?_0x38137b['options'][_0xf0f6('0x20')]===undefined?!![]:![]:!![],'where':_0x38137b['options']?_0x38137b[_0xf0f6('0x21')][_0xf0f6('0x22')]||null:null,'attributes':_0x38137b[_0xf0f6('0x21')]?_0x38137b[_0xf0f6('0x21')][_0xf0f6('0x23')]||null:null,'limit':_0x38137b[_0xf0f6('0x21')]?_0x38137b[_0xf0f6('0x21')][_0xf0f6('0x24')]||null:null,'include':_0x38137b[_0xf0f6('0x21')]?_0x38137b[_0xf0f6('0x21')][_0xf0f6('0x25')]?_[_0xf0f6('0x26')](_0x38137b[_0xf0f6('0x21')][_0xf0f6('0x25')],function(_0x5d92c4){return{'model':db[_0x5d92c4[_0xf0f6('0x27')]],'as':_0x5d92c4['as'],'attributes':_0x5d92c4['attributes'],'include':_0x5d92c4[_0xf0f6('0x25')]?_['map'](_0x5d92c4['include'],function(_0x4da4c6){return{'model':db[_0x4da4c6[_0xf0f6('0x27')]],'as':_0x4da4c6['as'],'attributes':_0x4da4c6['attributes'],'include':_0x4da4c6[_0xf0f6('0x25')]?_[_0xf0f6('0x26')](_0x4da4c6[_0xf0f6('0x25')],function(_0xae928d){return{'model':db[_0xae928d['model']],'as':_0xae928d['as'],'attributes':_0xae928d[_0xf0f6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf0f6('0x11')](function(_0x51038b){logger[_0xf0f6('0x12')](_0xf0f6('0x1d'),_0x38137b);logger[_0xf0f6('0x15')](_0xf0f6('0x1d'),_0x38137b,JSON[_0xf0f6('0x17')](_0x51038b));_0x5602de(_0x51038b);})[_0xf0f6('0x1c')](function(_0x4af713){logger[_0xf0f6('0x18')]('GetVoiceExtension',_0x4af713[_0xf0f6('0x1a')],_0x38137b);_0x57ff5b(_0x189e99[_0xf0f6('0x18')](0x1f4,_0x4af713[_0xf0f6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8298a63..e6c768e 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 _0xbf07=['save','update','emit','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x654e84,_0x431ca2){var _0xc77c75=function(_0x5c6e48){while(--_0x5c6e48){_0x654e84['push'](_0x654e84['shift']());}};_0xc77c75(++_0x431ca2);}(_0xbf07,0xa7));var _0x7bf0=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xbf07[_0x4aa4e6];return _0x322588;};'use strict';var VoiceExtensionEvents=require(_0x7bf0('0x0'));var events=[_0x7bf0('0x1'),'remove',_0x7bf0('0x2')];function createListener(_0x55b22c,_0x51c268){return function(_0x52066c){_0x51c268[_0x7bf0('0x3')](_0x55b22c,_0x52066c);};}function removeListener(_0x272b3a,_0x6d42e3){return function(){VoiceExtensionEvents['removeListener'](_0x272b3a,_0x6d42e3);};}exports[_0x7bf0('0x4')]=function(_0x274aa2){for(var _0x5e3f8e=0x0,_0x20843a=events[_0x7bf0('0x5')];_0x5e3f8e<_0x20843a;_0x5e3f8e++){var _0x5bc825=events[_0x5e3f8e];var _0x51cea9=createListener(_0x7bf0('0x6')+_0x5bc825,_0x274aa2);VoiceExtensionEvents['on'](_0x5bc825,_0x51cea9);}}; \ No newline at end of file +var _0xc93f=['save','remove','update','emit','register','length','voiceExtension:'];(function(_0x2e812d,_0x5c69fa){var _0x173ec0=function(_0x16808d){while(--_0x16808d){_0x2e812d['push'](_0x2e812d['shift']());}};_0x173ec0(++_0x5c69fa);}(_0xc93f,0xfc));var _0xfc93=function(_0xafa965,_0x14309a){_0xafa965=_0xafa965-0x0;var _0x4858da=_0xc93f[_0xafa965];return _0x4858da;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0xfc93('0x0'),_0xfc93('0x1'),_0xfc93('0x2')];function createListener(_0x3e96b1,_0x526c39){return function(_0xbaf18b){_0x526c39[_0xfc93('0x3')](_0x3e96b1,_0xbaf18b);};}function removeListener(_0x59387b,_0x472415){return function(){VoiceExtensionEvents['removeListener'](_0x59387b,_0x472415);};}exports[_0xfc93('0x4')]=function(_0x4844c0){for(var _0x37594c=0x0,_0x191218=events[_0xfc93('0x5')];_0x37594c<_0x191218;_0x37594c++){var _0x23f541=events[_0x37594c];var _0x223517=createListener(_0xfc93('0x6')+_0x23f541,_0x4844c0);VoiceExtensionEvents['on'](_0x23f541,_0x223517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index afa6f96..315a8c5 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 _0xf2a1=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','post','put','update'];(function(_0x256560,_0x9f23ba){var _0x27fd19=function(_0x13267c){while(--_0x13267c){_0x256560['push'](_0x256560['shift']());}};_0x27fd19(++_0x9f23ba);}(_0xf2a1,0x1dd));var _0x1f2a=function(_0x5c5219,_0x496157){_0x5c5219=_0x5c5219-0x0;var _0x4d56db=_0xf2a1[_0x5c5219];return _0x4d56db;};'use strict';var multer=require(_0x1f2a('0x0'));var util=require(_0x1f2a('0x1'));var path=require(_0x1f2a('0x2'));var timeout=require(_0x1f2a('0x3'));var express=require(_0x1f2a('0x4'));var router=express[_0x1f2a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1f2a('0x6'));var config=require(_0x1f2a('0x7'));var controller=require('./voiceMail.controller');router[_0x1f2a('0x8')]('/',auth[_0x1f2a('0x9')](),controller[_0x1f2a('0xa')]);router[_0x1f2a('0x8')](_0x1f2a('0xb'),auth[_0x1f2a('0x9')](),controller[_0x1f2a('0xc')]);router[_0x1f2a('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1f2a('0xd')]);router[_0x1f2a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f2a('0xf')](_0x1f2a('0xb'),auth['isAuthenticated'](),controller[_0x1f2a('0x10')]);router[_0x1f2a('0x11')]('/:id',auth[_0x1f2a('0x9')](),controller['destroy']);module[_0x1f2a('0x12')]=router; \ No newline at end of file +var _0x5f37=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5f37,0x12b));var _0x75f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5f37[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x75f3('0x0'));var util=require(_0x75f3('0x1'));var path=require(_0x75f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x75f3('0x3'));var router=express[_0x75f3('0x4')]();var auth=require(_0x75f3('0x5'));var interaction=require(_0x75f3('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x75f3('0x7')]('/',auth[_0x75f3('0x8')](),controller[_0x75f3('0x9')]);router['get'](_0x75f3('0xa'),auth[_0x75f3('0x8')](),controller['show']);router[_0x75f3('0x7')](_0x75f3('0xb'),auth[_0x75f3('0x8')](),controller[_0x75f3('0xc')]);router[_0x75f3('0xd')]('/',auth['isAuthenticated'](),controller[_0x75f3('0xe')]);router[_0x75f3('0xf')](_0x75f3('0xa'),auth[_0x75f3('0x8')](),controller['update']);router['delete'](_0x75f3('0xa'),auth[_0x75f3('0x8')](),controller['destroy']);module[_0x75f3('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e3cda07..2ec90f9 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['sequelize','STRING','from-voicemail','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x457e65,_0x57dde0){var _0x2c71dd=function(_0x69429c){while(--_0x69429c){_0x457e65['push'](_0x457e65['shift']());}};_0x2c71dd(++_0x57dde0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb7e7[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x7b7e('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x7b7e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x7b7e('0x1')]},'fullname':{'type':Sequelize[_0x7b7e('0x1')]},'email':{'type':Sequelize[_0x7b7e('0x1')],'validate':{'isEmail':!![]},'set':function(_0x52047f){this['setDataValue'](_0x7b7e('0x3'),typeof _0x52047f===_0x7b7e('0x4')&&_0x52047f[_0x7b7e('0x5')]()?_0x52047f['trim']():null);}},'pager':{'type':Sequelize[_0x7b7e('0x1')]},'tz':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0x6')},'attach':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7b7e('0x7')]('yes','no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7b7e('0x1')]},'callback':{'type':Sequelize[_0x7b7e('0x1')]},'review':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7b7e('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7b7e('0x7')](_0x7b7e('0x8'),'no'),'defaultValue':_0x7b7e('0x8'),'allowNull':![]},'stamp':{'type':_0x7b7e('0xa')},'emailsubject':{'type':Sequelize[_0x7b7e('0x1')]},'emailbody':{'type':Sequelize[_0x7b7e('0x1')]},'maxsecs':{'type':Sequelize[_0x7b7e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7b7e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7b7e('0xc')],'get':function(){return this[_0x7b7e('0xd')](_0x7b7e('0xe'))+_0x7b7e('0xf')+this[_0x7b7e('0xd')](_0x7b7e('0x10'));}}}; \ No newline at end of file +var _0xac4a=['contest_mailbox','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x27edba,_0x49741b){var _0x22ab78=function(_0x3cc42){while(--_0x3cc42){_0x27edba['push'](_0x27edba['shift']());}};_0x22ab78(++_0x49741b);}(_0xac4a,0x13f));var _0xaac4=function(_0x3d5a0a,_0x4a985e){_0x3d5a0a=_0x3d5a0a-0x0;var _0x5569de=_0xac4a[_0x3d5a0a];return _0x5569de;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'customer_id':{'type':Sequelize[_0xaac4('0x2')]},'context':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x3'),'unique':_0xaac4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xaac4('0x2')]},'fullname':{'type':Sequelize[_0xaac4('0x2')]},'email':{'type':Sequelize[_0xaac4('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58ae95){this[_0xaac4('0x5')]('email',typeof _0x58ae95===_0xaac4('0x6')&&_0x58ae95['trim']()?_0x58ae95[_0xaac4('0x7')]():null);}},'pager':{'type':Sequelize[_0xaac4('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xaac4('0x2')]},'callback':{'type':Sequelize[_0xaac4('0x2')]},'review':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xaac4('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'stamp':{'type':_0xaac4('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xaac4('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xaac4('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xaac4('0xd')](_0xaac4('0xe'))+_0xaac4('0xf')+this[_0xaac4('0xd')](_0xaac4('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index a63214e..d86a3be 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 _0x31bb=['fields','attributes','limit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','length','hasOwnProperty','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','set','apply','save','then','destroy','get','error','stack','name','map','VoiceMail','fieldName','type','key','model','query','keys','intersection'];(function(_0x2b2c3f,_0x31bda9){var _0x1a75cd=function(_0x2b7772){while(--_0x2b7772){_0x2b2c3f['push'](_0x2b2c3f['shift']());}};_0x1a75cd(++_0x31bda9);}(_0x31bb,0x76));var _0xb31b=function(_0x5cd579,_0x470d2f){_0x5cd579=_0x5cd579-0x0;var _0x4a082f=_0x31bb[_0x5cd579];return _0x4a082f;};'use strict';var pdf=require(_0xb31b('0x0'));var emlformat=require(_0xb31b('0x1'));var rimraf=require(_0xb31b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb31b('0x3'));var rp=require('request-promise');var moment=require(_0xb31b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb31b('0x5'));var util=require(_0xb31b('0x6'));var path=require(_0xb31b('0x7'));var sox=require('sox');var csv=require(_0xb31b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb31b('0x9'));var squel=require(_0xb31b('0xa'));var crypto=require(_0xb31b('0xb'));var jsforce=require(_0xb31b('0xc'));var deskjs=require(_0xb31b('0xd'));var toCsv=require(_0xb31b('0x8'));var querystring=require(_0xb31b('0xe'));var Papa=require(_0xb31b('0xf'));var Redis=require(_0xb31b('0x10'));var authService=require(_0xb31b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb31b('0x12'));var hardwareService=require(_0xb31b('0x13'));var logger=require(_0xb31b('0x14'))(_0xb31b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2970cc,_0x69b1a1){_0x69b1a1=_0x69b1a1||0xcc;return function(_0x3296cc){if(_0x3296cc){return _0x2970cc[_0xb31b('0x16')](_0x69b1a1);}return _0x2970cc[_0xb31b('0x17')](_0x69b1a1)[_0xb31b('0x18')]();};}function respondWithResult(_0xefc303,_0x2c48a3){_0x2c48a3=_0x2c48a3||0xc8;return function(_0x2a605a){if(_0x2a605a){return _0xefc303[_0xb31b('0x17')](_0x2c48a3)[_0xb31b('0x19')](_0x2a605a);}};}function respondWithFilteredResult(_0x569421,_0x152daa){return function(_0x4f2afe){if(_0x4f2afe){var _0x15bad9=_0x4f2afe[_0xb31b('0x1a')],_0x178c89=_0x152daa[_0xb31b('0x1b')],_0x4d9bd9=_0x152daa[_0xb31b('0x1b')]+_0x152daa['limit'],_0x1c24ee;if(_0x4d9bd9>=_0x15bad9){_0x4d9bd9=_0x15bad9;_0x1c24ee=0xc8;}else{_0x1c24ee=0xce;}_0x569421[_0xb31b('0x17')](_0x1c24ee);return _0x569421[_0xb31b('0x1c')]('Content-Range',_0x178c89+'-'+_0x4d9bd9+'/'+_0x15bad9)[_0xb31b('0x19')](_0x4f2afe);}return null;};}function patchUpdates(_0x3ac825){return function(_0x44bb81){try{jsonpatch[_0xb31b('0x1d')](_0x44bb81,_0x3ac825,!![]);}catch(_0x422d8b){return BPromise['reject'](_0x422d8b);}return _0x44bb81[_0xb31b('0x1e')]();};}function saveUpdates(_0x3aa2b8,_0x41a0c7){return function(_0x4c65b3){if(_0x4c65b3){return _0x4c65b3['update'](_0x3aa2b8)[_0xb31b('0x1f')](function(_0x4e4a96){return _0x4e4a96;});}return null;};}function removeEntity(_0x4676b,_0x327dc7){return function(_0x147ba5){if(_0x147ba5){return _0x147ba5[_0xb31b('0x20')]()['then'](function(){var _0x436143=_0x147ba5[_0xb31b('0x21')]({'plain':!![]});var _0x158f24='Voicemails';return db['UserProfileResource'][_0xb31b('0x20')]({'where':{'type':_0x158f24,'resourceId':_0x436143['id']}})['then'](function(){return _0x147ba5;});})['then'](function(){_0x4676b[_0xb31b('0x17')](0xcc)[_0xb31b('0x18')]();});}};}function handleEntityNotFound(_0x33c8cd,_0x4f0358){return function(_0x4843c8){if(!_0x4843c8){_0x33c8cd['sendStatus'](0x194);}return _0x4843c8;};}function handleError(_0x591ad9,_0x1abdb2){_0x1abdb2=_0x1abdb2||0x1f4;return function(_0x1877a5){logger[_0xb31b('0x22')](_0x1877a5[_0xb31b('0x23')]);if(_0x1877a5[_0xb31b('0x24')]){delete _0x1877a5[_0xb31b('0x24')];}_0x591ad9[_0xb31b('0x17')](_0x1abdb2)['send'](_0x1877a5);};}exports['index']=function(_0x5a198a,_0xb5f6a5){var _0x5e489e={},_0x39c85c={},_0x11955f={'count':0x0,'rows':[]};var _0x28b20f=_[_0xb31b('0x25')](db[_0xb31b('0x26')]['rawAttributes'],function(_0x343a19){return{'name':_0x343a19[_0xb31b('0x27')],'type':_0x343a19[_0xb31b('0x28')][_0xb31b('0x29')]};});_0x39c85c[_0xb31b('0x2a')]=_[_0xb31b('0x25')](_0x28b20f,_0xb31b('0x24'));_0x39c85c[_0xb31b('0x2b')]=_[_0xb31b('0x2c')](_0x5a198a['query']);_0x39c85c['filters']=_[_0xb31b('0x2d')](_0x39c85c['model'],_0x39c85c[_0xb31b('0x2b')]);_0x5e489e['attributes']=_['intersection'](_0x39c85c[_0xb31b('0x2a')],qs['fields'](_0x5a198a['query'][_0xb31b('0x2e')]));_0x5e489e[_0xb31b('0x2f')]=_0x5e489e[_0xb31b('0x2f')]['length']?_0x5e489e[_0xb31b('0x2f')]:_0x39c85c[_0xb31b('0x2a')];if(!_0x5a198a[_0xb31b('0x2b')]['hasOwnProperty']('nolimit')){_0x5e489e[_0xb31b('0x30')]=qs[_0xb31b('0x30')](_0x5a198a[_0xb31b('0x2b')][_0xb31b('0x30')]);_0x5e489e[_0xb31b('0x1b')]=qs[_0xb31b('0x1b')](_0x5a198a[_0xb31b('0x2b')]['offset']);}_0x5e489e['order']=qs[_0xb31b('0x31')](_0x5a198a[_0xb31b('0x2b')][_0xb31b('0x31')]);_0x5e489e[_0xb31b('0x32')]=qs[_0xb31b('0x33')](_[_0xb31b('0x34')](_0x5a198a[_0xb31b('0x2b')],_0x39c85c[_0xb31b('0x33')]),_0x28b20f);if(_0x5a198a['query'][_0xb31b('0x35')]){_0x5e489e[_0xb31b('0x32')]=_['merge'](_0x5e489e['where'],{'$or':_[_0xb31b('0x25')](_0x28b20f,function(_0x2017e4){if(_0x2017e4['type']!==_0xb31b('0x36')){var _0x10543c={};_0x10543c[_0x2017e4['name']]={'$like':'%'+_0x5a198a[_0xb31b('0x2b')][_0xb31b('0x35')]+'%'};return _0x10543c;}})});}_0x5e489e=_[_0xb31b('0x37')]({},_0x5e489e,_0x5a198a['options']);var _0x1f20ee={'where':_0x5e489e[_0xb31b('0x32')]};return db['VoiceMail']['count'](_0x1f20ee)['then'](function(_0x234743){_0x11955f[_0xb31b('0x1a')]=_0x234743;if(_0x5a198a[_0xb31b('0x2b')][_0xb31b('0x38')]){_0x5e489e[_0xb31b('0x39')]=[{'all':!![]}];}return db[_0xb31b('0x26')][_0xb31b('0x3a')](_0x5e489e);})[_0xb31b('0x1f')](function(_0x26e904){_0x11955f[_0xb31b('0x3b')]=_0x26e904;return _0x11955f;})[_0xb31b('0x1f')](respondWithFilteredResult(_0xb5f6a5,_0x5e489e))[_0xb31b('0x3c')](handleError(_0xb5f6a5,null));};exports[_0xb31b('0x3d')]=function(_0x55807e,_0x396bc0){var _0x1b7aad={'raw':!![],'where':{'id':_0x55807e[_0xb31b('0x3e')]['id']}},_0x43836b={};_0x43836b[_0xb31b('0x2a')]=_['keys'](db[_0xb31b('0x26')][_0xb31b('0x3f')]);_0x43836b['query']=_[_0xb31b('0x2c')](_0x55807e['query']);_0x43836b['filters']=_[_0xb31b('0x2d')](_0x43836b[_0xb31b('0x2a')],_0x43836b[_0xb31b('0x2b')]);_0x1b7aad['attributes']=_[_0xb31b('0x2d')](_0x43836b[_0xb31b('0x2a')],qs[_0xb31b('0x2e')](_0x55807e[_0xb31b('0x2b')]['fields']));_0x1b7aad[_0xb31b('0x2f')]=_0x1b7aad[_0xb31b('0x2f')]['length']?_0x1b7aad[_0xb31b('0x2f')]:_0x43836b[_0xb31b('0x2a')];if(_0x55807e[_0xb31b('0x2b')][_0xb31b('0x38')]){_0x1b7aad[_0xb31b('0x39')]=[{'all':!![]}];}_0x1b7aad=_[_0xb31b('0x37')]({},_0x1b7aad,_0x55807e[_0xb31b('0x40')]);return db['VoiceMail'][_0xb31b('0x41')](_0x1b7aad)[_0xb31b('0x1f')](handleEntityNotFound(_0x396bc0,null))['then'](respondWithResult(_0x396bc0,null))[_0xb31b('0x3c')](handleError(_0x396bc0,null));};exports[_0xb31b('0x42')]=function(_0x5df5f2,_0x1a6436){return db[_0xb31b('0x26')]['create'](_0x5df5f2[_0xb31b('0x43')],{})[_0xb31b('0x1f')](function(_0x291748){var _0x5089e7=_0x5df5f2[_0xb31b('0x44')]['get']({'plain':!![]});if(!_0x5089e7)throw new Error(_0xb31b('0x45'));if(_0x5089e7[_0xb31b('0x46')]===_0xb31b('0x44')){var _0x3e20ba=_0x291748[_0xb31b('0x21')]({'plain':!![]});var _0x2677d2='Voicemails';return db['UserProfileSection'][_0xb31b('0x41')]({'where':{'name':_0x2677d2,'userProfileId':_0x5089e7[_0xb31b('0x47')]},'raw':!![]})[_0xb31b('0x1f')](function(_0x4e4e40){if(_0x4e4e40&&_0x4e4e40[_0xb31b('0x48')]===0x0){return db[_0xb31b('0x49')][_0xb31b('0x42')]({'name':_0x3e20ba[_0xb31b('0x24')],'resourceId':_0x3e20ba['id'],'type':_0x4e4e40[_0xb31b('0x24')],'sectionId':_0x4e4e40['id']},{})[_0xb31b('0x1f')](function(){return _0x291748;});}else{return _0x291748;}})[_0xb31b('0x3c')](function(_0x1cfcde){logger[_0xb31b('0x22')](_0xb31b('0x4a'),_0x1cfcde);throw _0x1cfcde;});}return _0x291748;})[_0xb31b('0x1f')](respondWithResult(_0x1a6436,0xc9))[_0xb31b('0x3c')](handleError(_0x1a6436,null));};exports['update']=function(_0x2c80c2,_0x108d28){if(_0x2c80c2['body']['id']){delete _0x2c80c2[_0xb31b('0x43')]['id'];}return db[_0xb31b('0x26')][_0xb31b('0x41')]({'where':{'id':_0x2c80c2[_0xb31b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x108d28,null))[_0xb31b('0x1f')](saveUpdates(_0x2c80c2[_0xb31b('0x43')],null))[_0xb31b('0x1f')](respondWithResult(_0x108d28,null))[_0xb31b('0x3c')](handleError(_0x108d28,null));};exports[_0xb31b('0x20')]=function(_0x2b2968,_0x2ea80d){return db[_0xb31b('0x26')][_0xb31b('0x41')]({'where':{'id':_0x2b2968[_0xb31b('0x3e')]['id']}})[_0xb31b('0x1f')](handleEntityNotFound(_0x2ea80d,null))[_0xb31b('0x1f')](removeEntity(_0x2ea80d,null))['catch'](handleError(_0x2ea80d,null));};exports[_0xb31b('0x4b')]=function(_0x3caddc,_0x51f426,_0x488746){return db[_0xb31b('0x26')][_0xb31b('0x4c')]({'where':{'id':_0x3caddc['params']['id']}})[_0xb31b('0x1f')](handleEntityNotFound(_0x51f426,null))[_0xb31b('0x1f')](function(_0x4f7253){var _0x3352e2;var _0x38bd44={},_0x5427b7={};_0x5427b7[_0xb31b('0x2a')]=_['keys'](db[_0xb31b('0x4d')][_0xb31b('0x3f')]);_0x5427b7['query']=_[_0xb31b('0x2c')](_0x3caddc['query']);_0x5427b7[_0xb31b('0x33')]=_['intersection'](_0x5427b7['model'],_0x5427b7[_0xb31b('0x2b')]);_0x38bd44[_0xb31b('0x2f')]=_[_0xb31b('0x2d')](_0x5427b7['model'],qs[_0xb31b('0x2e')](_0x3caddc[_0xb31b('0x2b')][_0xb31b('0x2e')]));_0x38bd44[_0xb31b('0x2f')]=_0x38bd44[_0xb31b('0x2f')][_0xb31b('0x4e')]?_0x38bd44[_0xb31b('0x2f')]:_0x5427b7[_0xb31b('0x2a')];if(!_0x3caddc['query'][_0xb31b('0x4f')]('nolimit')){_0x38bd44['limit']=qs['limit'](_0x3caddc[_0xb31b('0x2b')][_0xb31b('0x30')]);_0x38bd44['offset']=qs[_0xb31b('0x1b')](_0x3caddc[_0xb31b('0x2b')][_0xb31b('0x1b')]);}_0x38bd44['order']=qs[_0xb31b('0x31')](_0x3caddc[_0xb31b('0x2b')][_0xb31b('0x31')]);_0x38bd44[_0xb31b('0x32')]=qs[_0xb31b('0x33')](_[_0xb31b('0x34')](_0x3caddc['query'],_0x5427b7['filters']));if(_0x3caddc[_0xb31b('0x2b')][_0xb31b('0x35')]){_0x38bd44[_0xb31b('0x32')]=_[_0xb31b('0x37')](_0x38bd44[_0xb31b('0x32')],{'$or':_[_0xb31b('0x25')](_0x38bd44['attributes'],function(_0x1733a8){var _0x19f7ae={};_0x19f7ae[_0x1733a8]={'$like':'%'+_0x3caddc[_0xb31b('0x2b')][_0xb31b('0x35')]+'%'};return _0x19f7ae;})});}_0x38bd44[_0xb31b('0x32')]=_[_0xb31b('0x37')](_0x38bd44[_0xb31b('0x32')],{'mailboxuser':_0x4f7253[_0xb31b('0x50')]});_0x38bd44=_['merge']({},_0x38bd44,_0x3caddc[_0xb31b('0x40')]);return db[_0xb31b('0x4d')][_0xb31b('0x51')](_0x38bd44)['then'](respondWithFilteredResult(_0x51f426,_0x38bd44));})[_0xb31b('0x3c')](handleError(_0x51f426,null));}; \ No newline at end of file +var _0x4dd0=['filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoiceMail','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where'];(function(_0x20427d,_0x45b9b8){var _0x4ee19c=function(_0x229551){while(--_0x229551){_0x20427d['push'](_0x20427d['shift']());}};_0x4ee19c(++_0x45b9b8);}(_0x4dd0,0x6b));var _0x04dd=function(_0x5447c9,_0x32dea5){_0x5447c9=_0x5447c9-0x0;var _0x4165d0=_0x4dd0[_0x5447c9];return _0x4165d0;};'use strict';var pdf=require(_0x04dd('0x0'));var emlformat=require(_0x04dd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x04dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04dd('0x3'));var moment=require(_0x04dd('0x4'));var BPromise=require(_0x04dd('0x5'));var Mustache=require(_0x04dd('0x6'));var util=require(_0x04dd('0x7'));var path=require('path');var sox=require(_0x04dd('0x8'));var csv=require(_0x04dd('0x9'));var ejs=require(_0x04dd('0xa'));var fs=require('fs');var _=require(_0x04dd('0xb'));var squel=require(_0x04dd('0xc'));var crypto=require(_0x04dd('0xd'));var jsforce=require(_0x04dd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x04dd('0x9'));var querystring=require('querystring');var Papa=require(_0x04dd('0xf'));var Redis=require(_0x04dd('0x10'));var authService=require(_0x04dd('0x11'));var qs=require(_0x04dd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04dd('0x13'));var logger=require(_0x04dd('0x14'))(_0x04dd('0x15'));var utils=require(_0x04dd('0x16'));var config=require('../../config/environment');var db=require(_0x04dd('0x17'))['db'];function respondWithStatusCode(_0x120bb5,_0x367c78){_0x367c78=_0x367c78||0xcc;return function(_0x3bafae){if(_0x3bafae){return _0x120bb5['sendStatus'](_0x367c78);}return _0x120bb5[_0x04dd('0x18')](_0x367c78)['end']();};}function respondWithResult(_0x527e10,_0x3f51e5){_0x3f51e5=_0x3f51e5||0xc8;return function(_0x5ecefc){if(_0x5ecefc){return _0x527e10[_0x04dd('0x18')](_0x3f51e5)[_0x04dd('0x19')](_0x5ecefc);}};}function respondWithFilteredResult(_0x2873c7,_0x13bcda){return function(_0x1b9831){if(_0x1b9831){var _0x4c9628=_0x1b9831['count'],_0x44a6ab=_0x13bcda[_0x04dd('0x1a')],_0x30821b=_0x13bcda[_0x04dd('0x1a')]+_0x13bcda[_0x04dd('0x1b')],_0x3da187;if(_0x30821b>=_0x4c9628){_0x30821b=_0x4c9628;_0x3da187=0xc8;}else{_0x3da187=0xce;}_0x2873c7[_0x04dd('0x18')](_0x3da187);return _0x2873c7[_0x04dd('0x1c')](_0x04dd('0x1d'),_0x44a6ab+'-'+_0x30821b+'/'+_0x4c9628)['json'](_0x1b9831);}return null;};}function patchUpdates(_0xaecb8f){return function(_0xf4fd57){try{jsonpatch[_0x04dd('0x1e')](_0xf4fd57,_0xaecb8f,!![]);}catch(_0x4ad602){return BPromise[_0x04dd('0x1f')](_0x4ad602);}return _0xf4fd57['save']();};}function saveUpdates(_0x3068c9,_0x4d0bbe){return function(_0x19237b){if(_0x19237b){return _0x19237b[_0x04dd('0x20')](_0x3068c9)['then'](function(_0x2bad51){return _0x2bad51;});}return null;};}function removeEntity(_0x21df97,_0x5045c3){return function(_0x34a952){if(_0x34a952){return _0x34a952[_0x04dd('0x21')]()[_0x04dd('0x22')](function(){var _0x2b736a=_0x34a952['get']({'plain':!![]});var _0x457550='Voicemails';return db[_0x04dd('0x23')][_0x04dd('0x21')]({'where':{'type':_0x457550,'resourceId':_0x2b736a['id']}})[_0x04dd('0x22')](function(){return _0x34a952;});})['then'](function(){_0x21df97[_0x04dd('0x18')](0xcc)[_0x04dd('0x24')]();});}};}function handleEntityNotFound(_0x3ec4cd,_0x35867b){return function(_0x5818cd){if(!_0x5818cd){_0x3ec4cd[_0x04dd('0x25')](0x194);}return _0x5818cd;};}function handleError(_0x16af90,_0x28e485){_0x28e485=_0x28e485||0x1f4;return function(_0x18ba04){logger[_0x04dd('0x26')](_0x18ba04[_0x04dd('0x27')]);if(_0x18ba04[_0x04dd('0x28')]){delete _0x18ba04[_0x04dd('0x28')];}_0x16af90['status'](_0x28e485)['send'](_0x18ba04);};}exports[_0x04dd('0x29')]=function(_0x309b74,_0x4dbcd1){var _0x34cb83={},_0xcad59e={},_0x499647={'count':0x0,'rows':[]};var _0x533f24=_[_0x04dd('0x2a')](db[_0x04dd('0x2b')]['rawAttributes'],function(_0x362e6b){return{'name':_0x362e6b['fieldName'],'type':_0x362e6b[_0x04dd('0x2c')]['key']};});_0xcad59e[_0x04dd('0x2d')]=_[_0x04dd('0x2a')](_0x533f24,_0x04dd('0x28'));_0xcad59e[_0x04dd('0x2e')]=_[_0x04dd('0x2f')](_0x309b74[_0x04dd('0x2e')]);_0xcad59e[_0x04dd('0x30')]=_[_0x04dd('0x31')](_0xcad59e[_0x04dd('0x2d')],_0xcad59e[_0x04dd('0x2e')]);_0x34cb83['attributes']=_[_0x04dd('0x31')](_0xcad59e[_0x04dd('0x2d')],qs['fields'](_0x309b74['query'][_0x04dd('0x32')]));_0x34cb83[_0x04dd('0x33')]=_0x34cb83['attributes'][_0x04dd('0x34')]?_0x34cb83[_0x04dd('0x33')]:_0xcad59e[_0x04dd('0x2d')];if(!_0x309b74[_0x04dd('0x2e')]['hasOwnProperty'](_0x04dd('0x35'))){_0x34cb83[_0x04dd('0x1b')]=qs[_0x04dd('0x1b')](_0x309b74[_0x04dd('0x2e')]['limit']);_0x34cb83['offset']=qs[_0x04dd('0x1a')](_0x309b74[_0x04dd('0x2e')][_0x04dd('0x1a')]);}_0x34cb83[_0x04dd('0x36')]=qs[_0x04dd('0x37')](_0x309b74['query'][_0x04dd('0x37')]);_0x34cb83[_0x04dd('0x38')]=qs[_0x04dd('0x30')](_['pick'](_0x309b74[_0x04dd('0x2e')],_0xcad59e['filters']),_0x533f24);if(_0x309b74[_0x04dd('0x2e')][_0x04dd('0x39')]){_0x34cb83[_0x04dd('0x38')]=_['merge'](_0x34cb83['where'],{'$or':_[_0x04dd('0x2a')](_0x533f24,function(_0x30ab83){if(_0x30ab83['type']!==_0x04dd('0x3a')){var _0x30962e={};_0x30962e[_0x30ab83['name']]={'$like':'%'+_0x309b74[_0x04dd('0x2e')][_0x04dd('0x39')]+'%'};return _0x30962e;}})});}_0x34cb83=_[_0x04dd('0x3b')]({},_0x34cb83,_0x309b74[_0x04dd('0x3c')]);var _0x395a4d={'where':_0x34cb83[_0x04dd('0x38')]};return db[_0x04dd('0x2b')][_0x04dd('0x3d')](_0x395a4d)['then'](function(_0x2dfc54){_0x499647[_0x04dd('0x3d')]=_0x2dfc54;if(_0x309b74[_0x04dd('0x2e')][_0x04dd('0x3e')]){_0x34cb83[_0x04dd('0x3f')]=[{'all':!![]}];}return db[_0x04dd('0x2b')][_0x04dd('0x40')](_0x34cb83);})[_0x04dd('0x22')](function(_0x4a9a59){_0x499647[_0x04dd('0x41')]=_0x4a9a59;return _0x499647;})[_0x04dd('0x22')](respondWithFilteredResult(_0x4dbcd1,_0x34cb83))['catch'](handleError(_0x4dbcd1,null));};exports[_0x04dd('0x42')]=function(_0x1ae07d,_0x1c04bf){var _0x326d72={'raw':!![],'where':{'id':_0x1ae07d[_0x04dd('0x43')]['id']}},_0x29a590={};_0x29a590[_0x04dd('0x2d')]=_['keys'](db[_0x04dd('0x2b')]['rawAttributes']);_0x29a590[_0x04dd('0x2e')]=_[_0x04dd('0x2f')](_0x1ae07d[_0x04dd('0x2e')]);_0x29a590[_0x04dd('0x30')]=_[_0x04dd('0x31')](_0x29a590[_0x04dd('0x2d')],_0x29a590[_0x04dd('0x2e')]);_0x326d72[_0x04dd('0x33')]=_[_0x04dd('0x31')](_0x29a590[_0x04dd('0x2d')],qs['fields'](_0x1ae07d['query'][_0x04dd('0x32')]));_0x326d72['attributes']=_0x326d72['attributes'][_0x04dd('0x34')]?_0x326d72[_0x04dd('0x33')]:_0x29a590['model'];if(_0x1ae07d[_0x04dd('0x2e')][_0x04dd('0x3e')]){_0x326d72['include']=[{'all':!![]}];}_0x326d72=_[_0x04dd('0x3b')]({},_0x326d72,_0x1ae07d['options']);return db[_0x04dd('0x2b')][_0x04dd('0x44')](_0x326d72)[_0x04dd('0x22')](handleEntityNotFound(_0x1c04bf,null))[_0x04dd('0x22')](respondWithResult(_0x1c04bf,null))[_0x04dd('0x45')](handleError(_0x1c04bf,null));};exports[_0x04dd('0x46')]=function(_0x176cd6,_0x22ed79){return db['VoiceMail']['create'](_0x176cd6[_0x04dd('0x47')],{})[_0x04dd('0x22')](function(_0x220959){var _0x2cabf9=_0x176cd6[_0x04dd('0x48')][_0x04dd('0x49')]({'plain':!![]});if(!_0x2cabf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cabf9['role']===_0x04dd('0x48')){var _0x5d1ec1=_0x220959[_0x04dd('0x49')]({'plain':!![]});var _0x3c55ea='Voicemails';return db['UserProfileSection'][_0x04dd('0x44')]({'where':{'name':_0x3c55ea,'userProfileId':_0x2cabf9[_0x04dd('0x4a')]},'raw':!![]})['then'](function(_0x215691){if(_0x215691&&_0x215691[_0x04dd('0x4b')]===0x0){return db[_0x04dd('0x23')]['create']({'name':_0x5d1ec1[_0x04dd('0x28')],'resourceId':_0x5d1ec1['id'],'type':_0x215691[_0x04dd('0x28')],'sectionId':_0x215691['id']},{})[_0x04dd('0x22')](function(){return _0x220959;});}else{return _0x220959;}})['catch'](function(_0x53803e){logger[_0x04dd('0x26')](_0x04dd('0x4c'),_0x53803e);throw _0x53803e;});}return _0x220959;})[_0x04dd('0x22')](respondWithResult(_0x22ed79,0xc9))['catch'](handleError(_0x22ed79,null));};exports[_0x04dd('0x20')]=function(_0x4770e8,_0x1ced17){if(_0x4770e8[_0x04dd('0x47')]['id']){delete _0x4770e8[_0x04dd('0x47')]['id'];}return db['VoiceMail'][_0x04dd('0x44')]({'where':{'id':_0x4770e8[_0x04dd('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ced17,null))[_0x04dd('0x22')](saveUpdates(_0x4770e8[_0x04dd('0x47')],null))['then'](respondWithResult(_0x1ced17,null))['catch'](handleError(_0x1ced17,null));};exports[_0x04dd('0x21')]=function(_0x5be524,_0x14cc07){return db[_0x04dd('0x2b')]['find']({'where':{'id':_0x5be524['params']['id']}})[_0x04dd('0x22')](handleEntityNotFound(_0x14cc07,null))[_0x04dd('0x22')](removeEntity(_0x14cc07,null))[_0x04dd('0x45')](handleError(_0x14cc07,null));};exports['getMessages']=function(_0x52ba63,_0x160043,_0x348c60){return db[_0x04dd('0x2b')][_0x04dd('0x4d')]({'where':{'id':_0x52ba63['params']['id']}})[_0x04dd('0x22')](handleEntityNotFound(_0x160043,null))['then'](function(_0xc95897){var _0x12cb6b;var _0x2febdb={},_0x131370={};_0x131370[_0x04dd('0x2d')]=_['keys'](db[_0x04dd('0x4e')]['rawAttributes']);_0x131370[_0x04dd('0x2e')]=_[_0x04dd('0x2f')](_0x52ba63[_0x04dd('0x2e')]);_0x131370[_0x04dd('0x30')]=_[_0x04dd('0x31')](_0x131370[_0x04dd('0x2d')],_0x131370[_0x04dd('0x2e')]);_0x2febdb[_0x04dd('0x33')]=_[_0x04dd('0x31')](_0x131370[_0x04dd('0x2d')],qs[_0x04dd('0x32')](_0x52ba63[_0x04dd('0x2e')][_0x04dd('0x32')]));_0x2febdb[_0x04dd('0x33')]=_0x2febdb[_0x04dd('0x33')][_0x04dd('0x34')]?_0x2febdb[_0x04dd('0x33')]:_0x131370[_0x04dd('0x2d')];if(!_0x52ba63['query'][_0x04dd('0x4f')](_0x04dd('0x35'))){_0x2febdb['limit']=qs[_0x04dd('0x1b')](_0x52ba63[_0x04dd('0x2e')][_0x04dd('0x1b')]);_0x2febdb[_0x04dd('0x1a')]=qs[_0x04dd('0x1a')](_0x52ba63[_0x04dd('0x2e')][_0x04dd('0x1a')]);}_0x2febdb[_0x04dd('0x36')]=qs[_0x04dd('0x37')](_0x52ba63[_0x04dd('0x2e')][_0x04dd('0x37')]);_0x2febdb[_0x04dd('0x38')]=qs[_0x04dd('0x30')](_['pick'](_0x52ba63[_0x04dd('0x2e')],_0x131370[_0x04dd('0x30')]));if(_0x52ba63[_0x04dd('0x2e')][_0x04dd('0x39')]){_0x2febdb[_0x04dd('0x38')]=_[_0x04dd('0x3b')](_0x2febdb[_0x04dd('0x38')],{'$or':_['map'](_0x2febdb[_0x04dd('0x33')],function(_0x4e03dc){var _0x2b2297={};_0x2b2297[_0x4e03dc]={'$like':'%'+_0x52ba63[_0x04dd('0x2e')]['filter']+'%'};return _0x2b2297;})});}_0x2febdb[_0x04dd('0x38')]=_['merge'](_0x2febdb['where'],{'mailboxuser':_0xc95897[_0x04dd('0x50')]});_0x2febdb=_[_0x04dd('0x3b')]({},_0x2febdb,_0x52ba63['options']);return db[_0x04dd('0x4e')][_0x04dd('0x51')](_0x2febdb)['then'](respondWithFilteredResult(_0x160043,_0x2febdb));})[_0x04dd('0x45')](handleError(_0x160043,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4ccfee7..7ace224 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 _0xab18=['voice_voicemail','mailbox_context','mailbox','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x283b55,_0x279bee){var _0x192e58=function(_0x535c7c){while(--_0x535c7c){_0x283b55['push'](_0x283b55['shift']());}};_0x192e58(++_0x279bee);}(_0xab18,0x153));var _0x8ab1=function(_0xe521b0,_0x25e2d9){_0xe521b0=_0xe521b0-0x0;var _0x16c725=_0xab18[_0xe521b0];return _0x16c725;};'use strict';var _=require('lodash');var util=require(_0x8ab1('0x0'));var logger=require(_0x8ab1('0x1'))('api');var moment=require(_0x8ab1('0x2'));var BPromise=require(_0x8ab1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ab1('0x4'));var rimraf=require(_0x8ab1('0x5'));var config=require(_0x8ab1('0x6'));var attributes=require(_0x8ab1('0x7'));module[_0x8ab1('0x8')]=function(_0x2d0ff6,_0x499ab5){return _0x2d0ff6[_0x8ab1('0x9')](_0x8ab1('0xa'),attributes,{'tableName':_0x8ab1('0xb'),'paranoid':![],'indexes':[{'name':_0x8ab1('0xc'),'fields':[_0x8ab1('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ad5=['mailbox','context','lodash','util','../../config/logger','api','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context'];(function(_0x3ccd7e,_0x38d03f){var _0x592d09=function(_0x408919){while(--_0x408919){_0x3ccd7e['push'](_0x3ccd7e['shift']());}};_0x592d09(++_0x38d03f);}(_0x0ad5,0x1a2));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 logger=require(_0x50ad('0x2'))(_0x50ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50ad('0x4'));var config=require(_0x50ad('0x5'));var attributes=require(_0x50ad('0x6'));module[_0x50ad('0x7')]=function(_0x51dae4,_0x412323){return _0x51dae4[_0x50ad('0x8')]('VoiceMail',attributes,{'tableName':_0x50ad('0x9'),'paranoid':![],'indexes':[{'name':_0x50ad('0xa'),'fields':[_0x50ad('0xb'),_0x50ad('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 6d0cc1a..bb0d9d1 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 _0x91a4=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x91a4,0x96));var _0x491a=function(_0x2bb01a,_0x264484){_0x2bb01a=_0x2bb01a-0x0;var _0x3757d8=_0x91a4[_0x2bb01a];return _0x3757d8;};'use strict';var _=require(_0x491a('0x0'));var util=require(_0x491a('0x1'));var moment=require(_0x491a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x491a('0x3'))['db'];var utils=require(_0x491a('0x4'));var logger=require(_0x491a('0x5'))(_0x491a('0x6'));var config=require(_0x491a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x491a('0x8')][_0x491a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1425fb,_0x43d719,_0x51f2de){return new BPromise(function(_0x4def97,_0x54bf07){return client['request'](_0x1425fb,_0x51f2de)[_0x491a('0xa')](function(_0x32e231){logger[_0x491a('0xb')]('VoiceMail,\x20%s,\x20%s',_0x43d719,_0x491a('0xc'));logger['debug'](_0x491a('0xd'),_0x43d719,_0x491a('0xc'),JSON[_0x491a('0xe')](_0x32e231));if(_0x32e231[_0x491a('0xf')]){if(_0x32e231[_0x491a('0xf')][_0x491a('0x10')]===0x1f4){logger[_0x491a('0xf')](_0x491a('0x11'),_0x43d719,_0x32e231[_0x491a('0xf')][_0x491a('0x12')]);return _0x54bf07(_0x32e231[_0x491a('0xf')][_0x491a('0x12')]);}logger[_0x491a('0xf')](_0x491a('0x11'),_0x43d719,_0x32e231['error']['message']);return _0x4def97(_0x32e231[_0x491a('0xf')][_0x491a('0x12')]);}else{logger[_0x491a('0xb')](_0x491a('0x11'),_0x43d719,_0x491a('0xc'));_0x4def97(_0x32e231[_0x491a('0x13')][_0x491a('0x12')]);}})[_0x491a('0x14')](function(_0x3c40a7){logger['error'](_0x491a('0x11'),_0x43d719,_0x3c40a7);_0x54bf07(_0x3c40a7);});});} \ No newline at end of file +var _0xe2b9=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','http','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','VoiceMail,\x20%s,\x20%s','result','catch'];(function(_0x30161e,_0x4d4e59){var _0x1f606a=function(_0x4419bd){while(--_0x4419bd){_0x30161e['push'](_0x30161e['shift']());}};_0x1f606a(++_0x4d4e59);}(_0xe2b9,0x140));var _0x9e2b=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xe2b9[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0x9e2b('0x0'));var util=require('util');var moment=require(_0x9e2b('0x1'));var BPromise=require(_0x9e2b('0x2'));var rs=require(_0x9e2b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e2b('0x4'))['db'];var utils=require(_0x9e2b('0x5'));var logger=require(_0x9e2b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9e2b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x451c94,_0x4c4a34,_0x315438){return new BPromise(function(_0x31d322,_0xafb2fa){return client[_0x9e2b('0x8')](_0x451c94,_0x315438)[_0x9e2b('0x9')](function(_0x2d7bd4){logger['info']('VoiceMail,\x20%s,\x20%s',_0x4c4a34,_0x9e2b('0xa'));logger[_0x9e2b('0xb')](_0x9e2b('0xc'),_0x4c4a34,_0x9e2b('0xa'),JSON[_0x9e2b('0xd')](_0x2d7bd4));if(_0x2d7bd4[_0x9e2b('0xe')]){if(_0x2d7bd4[_0x9e2b('0xe')]['code']===0x1f4){logger[_0x9e2b('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4c4a34,_0x2d7bd4['error'][_0x9e2b('0xf')]);return _0xafb2fa(_0x2d7bd4['error'][_0x9e2b('0xf')]);}logger[_0x9e2b('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4c4a34,_0x2d7bd4[_0x9e2b('0xe')]['message']);return _0x31d322(_0x2d7bd4[_0x9e2b('0xe')]['message']);}else{logger[_0x9e2b('0x10')](_0x9e2b('0x11'),_0x4c4a34,_0x9e2b('0xa'));_0x31d322(_0x2d7bd4[_0x9e2b('0x12')]['message']);}})[_0x9e2b('0x13')](function(_0x4897bc){logger[_0x9e2b('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4c4a34,_0x4897bc);_0xafb2fa(_0x4897bc);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e3adc5c..9fd44d6 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 _0xba34=['express','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x389b98,_0x58b439){var _0x65b7c6=function(_0x2af015){while(--_0x2af015){_0x389b98['push'](_0x389b98['shift']());}};_0x65b7c6(++_0x58b439);}(_0xba34,0x119));var _0x4ba3=function(_0x374aff,_0x36bbc8){_0x374aff=_0x374aff-0x0;var _0x3afa43=_0xba34[_0x374aff];return _0x3afa43;};'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('0x7')](_0x4ba3('0xc'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['update']);router[_0x4ba3('0x11')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3f8a=['download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x2c3692,_0x20fdbf){var _0x2104b4=function(_0x2bcb36){while(--_0x2bcb36){_0x2c3692['push'](_0x2c3692['shift']());}};_0x2104b4(++_0x20fdbf);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x420121,_0x200600){_0x420121=_0x420121-0x0;var _0x48c12d=_0x3f8a[_0x420121];return _0x48c12d;};'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('0x9')](_0xa3f8('0xe'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')]('/',auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['update']);router[_0xa3f8('0x13')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x14')]);module[_0xa3f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d7c31c0..1a9e118 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 _0xa80b=['STRING','BLOB','TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x2c4d31,_0x21f3a8){var _0x3a9785=function(_0x1fb5b8){while(--_0x1fb5b8){_0x2c4d31['push'](_0x2c4d31['shift']());}};_0x3a9785(++_0x21f3a8);}(_0xa80b,0x1df));var _0xba80=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0xa80b[_0xd13a88];return _0x1c993c;};'use strict';var Sequelize=require('sequelize');module[_0xba80('0x0')]={'name':{'type':Sequelize[_0xba80('0x1')],'get':function(_0x302574){return this[_0xba80('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xba80('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xba80('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xba80('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xba80('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xba80('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xba80('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xba80('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xba80('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xba80('0x4')],'defaultValue':''},'stamp':{'type':_0xba80('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0xbd96=['STRING','BLOB','long','TIMESTAMP','VIRTUAL','getDataValue','INTEGER'];(function(_0x24027b,_0x4dbcc3){var _0x551755=function(_0x308809){while(--_0x308809){_0x24027b['push'](_0x24027b['shift']());}};_0x551755(++_0x4dbcc3);}(_0xbd96,0x1bd));var _0x6bd9=function(_0xc6e22,_0x434614){_0xc6e22=_0xc6e22-0x0;var _0x27f7f0=_0xbd96[_0xc6e22];return _0x27f7f0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6bd9('0x0')],'get':function(_0x291ca7){return this[_0x6bd9('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x6bd9('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6bd9('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6bd9('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6bd9('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x6bd9('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6bd9('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6bd9('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x6bd9('0x4')](_0x6bd9('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x6bd9('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x6bd9('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a64dffc..0b10769 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 _0x4058=['offset','limit','status','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','catch','params','find','create','body','destroy','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','json','count'];(function(_0x58773f,_0x1cefa1){var _0x1b7a8b=function(_0x40813b){while(--_0x40813b){_0x58773f['push'](_0x58773f['shift']());}};_0x1b7a8b(++_0x1cefa1);}(_0x4058,0x129));var _0x8405=function(_0x4b9ce5,_0x4a51b8){_0x4b9ce5=_0x4b9ce5-0x0;var _0x25276f=_0x4058[_0x4b9ce5];return _0x25276f;};'use strict';var pdf=require(_0x8405('0x0'));var emlformat=require(_0x8405('0x1'));var rimraf=require(_0x8405('0x2'));var zipdir=require(_0x8405('0x3'));var jsonpatch=require(_0x8405('0x4'));var rp=require(_0x8405('0x5'));var moment=require(_0x8405('0x6'));var BPromise=require(_0x8405('0x7'));var Mustache=require(_0x8405('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8405('0x9'));var ejs=require(_0x8405('0xa'));var fs=require('fs');var _=require(_0x8405('0xb'));var squel=require(_0x8405('0xc'));var crypto=require(_0x8405('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8405('0xe'));var toCsv=require(_0x8405('0x9'));var querystring=require(_0x8405('0xf'));var Papa=require('papaparse');var Redis=require(_0x8405('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8405('0x11'));var as=require(_0x8405('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8405('0x13'))(_0x8405('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e5124,_0x262d32){_0x262d32=_0x262d32||0xcc;return function(_0x575fcb){if(_0x575fcb){return _0x4e5124['sendStatus'](_0x262d32);}return _0x4e5124['status'](_0x262d32)['end']();};}function respondWithResult(_0x548c94,_0x1321d3){_0x1321d3=_0x1321d3||0xc8;return function(_0x238633){if(_0x238633){return _0x548c94['status'](_0x1321d3)[_0x8405('0x15')](_0x238633);}};}function respondWithFilteredResult(_0xa60bb4,_0x221cf8){return function(_0x422822){if(_0x422822){var _0x58eb66=_0x422822[_0x8405('0x16')],_0x218fe7=_0x221cf8[_0x8405('0x17')],_0x2d7601=_0x221cf8[_0x8405('0x17')]+_0x221cf8[_0x8405('0x18')],_0x8ef1fb;if(_0x2d7601>=_0x58eb66){_0x2d7601=_0x58eb66;_0x8ef1fb=0xc8;}else{_0x8ef1fb=0xce;}_0xa60bb4[_0x8405('0x19')](_0x8ef1fb);return _0xa60bb4[_0x8405('0x1a')](_0x8405('0x1b'),_0x218fe7+'-'+_0x2d7601+'/'+_0x58eb66)[_0x8405('0x15')](_0x422822);}return null;};}function patchUpdates(_0x21376d){return function(_0x131857){try{jsonpatch[_0x8405('0x1c')](_0x131857,_0x21376d,!![]);}catch(_0x3c0352){return BPromise[_0x8405('0x1d')](_0x3c0352);}return _0x131857[_0x8405('0x1e')]();};}function saveUpdates(_0x14bc3e,_0x2483ab){return function(_0x1f42e5){if(_0x1f42e5){return _0x1f42e5[_0x8405('0x1f')](_0x14bc3e)[_0x8405('0x20')](function(_0x42b34d){return _0x42b34d;});}return null;};}function removeEntity(_0x361034,_0x1ceff7){return function(_0x1e8d08){if(_0x1e8d08){return _0x1e8d08['destroy']()['then'](function(){_0x361034[_0x8405('0x19')](0xcc)[_0x8405('0x21')]();});}};}function handleEntityNotFound(_0x14436a,_0x4b1c6b){return function(_0x5e3849){if(!_0x5e3849){_0x14436a['sendStatus'](0x194);}return _0x5e3849;};}function handleError(_0x48c5ea,_0x480ad2){_0x480ad2=_0x480ad2||0x1f4;return function(_0x2c448b){logger[_0x8405('0x22')](_0x2c448b[_0x8405('0x23')]);if(_0x2c448b[_0x8405('0x24')]){delete _0x2c448b[_0x8405('0x24')];}_0x48c5ea[_0x8405('0x19')](_0x480ad2)[_0x8405('0x25')](_0x2c448b);};}exports[_0x8405('0x26')]=function(_0x44b495,_0x24b88d){var _0x1eb4f6={},_0x293789={},_0x53bb61={'count':0x0,'rows':[]};var _0x132c0f=_['map'](db['VoiceMailMessage'][_0x8405('0x27')],function(_0x41f06a){return{'name':_0x41f06a[_0x8405('0x28')],'type':_0x41f06a[_0x8405('0x29')][_0x8405('0x2a')]};});_0x293789[_0x8405('0x2b')]=_[_0x8405('0x2c')](_[_0x8405('0x2d')](_0x132c0f,_0x8405('0x24')),[_0x8405('0x24')]);_0x293789[_0x8405('0x2e')]=_[_0x8405('0x2f')](_0x44b495[_0x8405('0x2e')]);_0x293789['filters']=_[_0x8405('0x30')](_0x293789[_0x8405('0x2b')],_0x293789['query']);_0x1eb4f6[_0x8405('0x31')]=_[_0x8405('0x30')](_0x293789[_0x8405('0x2b')],qs['fields'](_0x44b495[_0x8405('0x2e')][_0x8405('0x32')]));_0x1eb4f6[_0x8405('0x31')]=_0x1eb4f6['attributes'][_0x8405('0x33')]?_0x1eb4f6[_0x8405('0x31')]:_0x293789['model'];if(!_0x44b495[_0x8405('0x2e')]['hasOwnProperty'](_0x8405('0x34'))){_0x1eb4f6[_0x8405('0x18')]=qs[_0x8405('0x18')](_0x44b495[_0x8405('0x2e')][_0x8405('0x18')]);_0x1eb4f6[_0x8405('0x17')]=qs[_0x8405('0x17')](_0x44b495[_0x8405('0x2e')][_0x8405('0x17')]);}_0x1eb4f6[_0x8405('0x35')]=qs[_0x8405('0x36')](_0x44b495[_0x8405('0x2e')]['sort']);_0x1eb4f6[_0x8405('0x37')]=qs['filters'](_['pick'](_0x44b495[_0x8405('0x2e')],_0x293789[_0x8405('0x38')]),_0x132c0f);if(_0x44b495['query'][_0x8405('0x39')]){_0x1eb4f6[_0x8405('0x37')]=_[_0x8405('0x3a')](_0x1eb4f6[_0x8405('0x37')],{'$or':_[_0x8405('0x2d')](_0x132c0f,function(_0x565324){if(_0x565324[_0x8405('0x29')]!==_0x8405('0x3b')){var _0x177600={};_0x177600[_0x565324[_0x8405('0x24')]]={'$like':'%'+_0x44b495[_0x8405('0x2e')]['filter']+'%'};return _0x177600;}})});}_0x1eb4f6=_[_0x8405('0x3a')]({},_0x1eb4f6,_0x44b495[_0x8405('0x3c')]);var _0xac5f4b={'where':_0x1eb4f6[_0x8405('0x37')]};return db[_0x8405('0x3d')][_0x8405('0x16')](_0xac5f4b)['then'](function(_0xfe699c){_0x53bb61[_0x8405('0x16')]=_0xfe699c;if(_0x44b495[_0x8405('0x2e')][_0x8405('0x3e')]){_0x1eb4f6[_0x8405('0x3f')]=[{'all':!![]}];}return db[_0x8405('0x3d')][_0x8405('0x40')](_0x1eb4f6);})['then'](function(_0x2c2b49){_0x53bb61['rows']=_0x2c2b49;return _0x53bb61;})[_0x8405('0x20')](respondWithFilteredResult(_0x24b88d,_0x1eb4f6))[_0x8405('0x41')](handleError(_0x24b88d,null));};exports['show']=function(_0x4a13f7,_0x46ac76){var _0x43b909={'raw':!![],'where':{'id':_0x4a13f7[_0x8405('0x42')]['id']}},_0xaf6465={};_0xaf6465[_0x8405('0x2b')]=_[_0x8405('0x2f')](db[_0x8405('0x3d')][_0x8405('0x27')]);_0xaf6465[_0x8405('0x2e')]=_['keys'](_0x4a13f7['query']);_0xaf6465[_0x8405('0x38')]=_['intersection'](_0xaf6465[_0x8405('0x2b')],_0xaf6465[_0x8405('0x2e')]);_0x43b909[_0x8405('0x31')]=_['intersection'](_0xaf6465[_0x8405('0x2b')],qs[_0x8405('0x32')](_0x4a13f7['query'][_0x8405('0x32')]));_0x43b909[_0x8405('0x31')]=_0x43b909[_0x8405('0x31')][_0x8405('0x33')]?_0x43b909[_0x8405('0x31')]:_0xaf6465[_0x8405('0x2b')];if(_0x4a13f7[_0x8405('0x2e')]['includeAll']){_0x43b909['include']=[{'all':!![]}];}_0x43b909=_['merge']({},_0x43b909,_0x4a13f7[_0x8405('0x3c')]);return db[_0x8405('0x3d')][_0x8405('0x43')](_0x43b909)[_0x8405('0x20')](handleEntityNotFound(_0x46ac76,null))['then'](respondWithResult(_0x46ac76,null))['catch'](handleError(_0x46ac76,null));};exports[_0x8405('0x44')]=function(_0x2a3345,_0x2dec05){return db[_0x8405('0x3d')][_0x8405('0x44')](_0x2a3345[_0x8405('0x45')],{})[_0x8405('0x20')](respondWithResult(_0x2dec05,0xc9))[_0x8405('0x41')](handleError(_0x2dec05,null));};exports['update']=function(_0x19c6c8,_0x4e9c9e){if(_0x19c6c8[_0x8405('0x45')]['id']){delete _0x19c6c8[_0x8405('0x45')]['id'];}return db[_0x8405('0x3d')][_0x8405('0x43')]({'where':{'id':_0x19c6c8[_0x8405('0x42')]['id']}})[_0x8405('0x20')](handleEntityNotFound(_0x4e9c9e,null))[_0x8405('0x20')](saveUpdates(_0x19c6c8[_0x8405('0x45')],null))['then'](respondWithResult(_0x4e9c9e,null))[_0x8405('0x41')](handleError(_0x4e9c9e,null));};exports[_0x8405('0x46')]=function(_0x39b5b3,_0x3e4473){return db['VoiceMailMessage']['find']({'where':{'id':_0x39b5b3[_0x8405('0x42')]['id']}})[_0x8405('0x20')](handleEntityNotFound(_0x3e4473,null))[_0x8405('0x20')](removeEntity(_0x3e4473,null))[_0x8405('0x41')](handleError(_0x3e4473,null));};exports[_0x8405('0x47')]=function(_0xf79cd8,_0x342ebc,_0x4899df){return db['VoiceMailMessage'][_0x8405('0x43')]({'where':{'id':_0xf79cd8['params']['id']},'attributes':['id',_0x8405('0x48'),_0x8405('0x49')]})[_0x8405('0x20')](handleEntityNotFound(_0x342ebc,null))['then'](function(_0x5b8a93){if(_0x5b8a93){if(!_0x5b8a93[_0x8405('0x48')]){throw new db['Sequelize'][(_0x8405('0x4a'))](_0x8405('0x4b'));}var _0x2a323e={'Content-Type':_0x8405('0x4c'),'Content-Disposition':_0x8405('0x4d')};if(_0x5b8a93[_0x8405('0x49')]){_0x2a323e[_0x8405('0x4e')]=_0x8405('0x4f')+_0x5b8a93[_0x8405('0x49')]+'.wav\x22';}_0x342ebc[_0x8405('0x1a')](_0x2a323e);return _0x342ebc[_0x8405('0x25')](new Buffer(_0x5b8a93[_0x8405('0x48')]));}})[_0x8405('0x41')](handleError(_0x342ebc,null));}; \ No newline at end of file +var _0x180f=['fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','include','find','catch','create','body','params','destroy','download','recording','msg_id','ValidationError','Content-Disposition','.wav\x22','html-pdf','eml-format','zip-dir'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0x180f,0xf3));var _0xf180=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0x180f[_0x45ce08];return _0x23dff2;};'use strict';var pdf=require(_0xf180('0x0'));var emlformat=require(_0xf180('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf180('0x2'));var jsonpatch=require(_0xf180('0x3'));var rp=require('request-promise');var moment=require(_0xf180('0x4'));var BPromise=require(_0xf180('0x5'));var Mustache=require(_0xf180('0x6'));var util=require(_0xf180('0x7'));var path=require(_0xf180('0x8'));var sox=require('sox');var csv=require(_0xf180('0x9'));var ejs=require(_0xf180('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf180('0xb'));var jsforce=require(_0xf180('0xc'));var deskjs=require(_0xf180('0xd'));var toCsv=require(_0xf180('0x9'));var querystring=require(_0xf180('0xe'));var Papa=require(_0xf180('0xf'));var Redis=require(_0xf180('0x10'));var authService=require(_0xf180('0x11'));var qs=require(_0xf180('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf180('0x13'));var logger=require(_0xf180('0x14'))(_0xf180('0x15'));var utils=require(_0xf180('0x16'));var config=require(_0xf180('0x17'));var db=require(_0xf180('0x18'))['db'];function respondWithStatusCode(_0x422e7e,_0x2122a0){_0x2122a0=_0x2122a0||0xcc;return function(_0x171513){if(_0x171513){return _0x422e7e[_0xf180('0x19')](_0x2122a0);}return _0x422e7e[_0xf180('0x1a')](_0x2122a0)['end']();};}function respondWithResult(_0x24356b,_0x22d179){_0x22d179=_0x22d179||0xc8;return function(_0x1eb0a2){if(_0x1eb0a2){return _0x24356b[_0xf180('0x1a')](_0x22d179)['json'](_0x1eb0a2);}};}function respondWithFilteredResult(_0x43add2,_0x3d3f48){return function(_0x1dbdcf){if(_0x1dbdcf){var _0x4ee79b=_0x1dbdcf[_0xf180('0x1b')],_0x105c6a=_0x3d3f48[_0xf180('0x1c')],_0x726be6=_0x3d3f48['offset']+_0x3d3f48[_0xf180('0x1d')],_0x496e65;if(_0x726be6>=_0x4ee79b){_0x726be6=_0x4ee79b;_0x496e65=0xc8;}else{_0x496e65=0xce;}_0x43add2[_0xf180('0x1a')](_0x496e65);return _0x43add2[_0xf180('0x1e')](_0xf180('0x1f'),_0x105c6a+'-'+_0x726be6+'/'+_0x4ee79b)[_0xf180('0x20')](_0x1dbdcf);}return null;};}function patchUpdates(_0x204e6d){return function(_0x1da1d){try{jsonpatch[_0xf180('0x21')](_0x1da1d,_0x204e6d,!![]);}catch(_0x26c9c0){return BPromise[_0xf180('0x22')](_0x26c9c0);}return _0x1da1d[_0xf180('0x23')]();};}function saveUpdates(_0x373926,_0x180c0a){return function(_0x5c8e98){if(_0x5c8e98){return _0x5c8e98[_0xf180('0x24')](_0x373926)[_0xf180('0x25')](function(_0x50f3b0){return _0x50f3b0;});}return null;};}function removeEntity(_0x466d1d,_0x538bac){return function(_0x36aeee){if(_0x36aeee){return _0x36aeee['destroy']()[_0xf180('0x25')](function(){_0x466d1d[_0xf180('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48925e,_0x1b28d6){return function(_0x932e29){if(!_0x932e29){_0x48925e['sendStatus'](0x194);}return _0x932e29;};}function handleError(_0x50cda8,_0x41772a){_0x41772a=_0x41772a||0x1f4;return function(_0x3d67cf){logger[_0xf180('0x26')](_0x3d67cf[_0xf180('0x27')]);if(_0x3d67cf[_0xf180('0x28')]){delete _0x3d67cf[_0xf180('0x28')];}_0x50cda8[_0xf180('0x1a')](_0x41772a)[_0xf180('0x29')](_0x3d67cf);};}exports[_0xf180('0x2a')]=function(_0x4ff4f9,_0x3cda7b){var _0x158d1a={},_0x151b90={},_0x113478={'count':0x0,'rows':[]};var _0x37379c=_[_0xf180('0x2b')](db[_0xf180('0x2c')][_0xf180('0x2d')],function(_0x2ac6d2){return{'name':_0x2ac6d2[_0xf180('0x2e')],'type':_0x2ac6d2['type'][_0xf180('0x2f')]};});_0x151b90[_0xf180('0x30')]=_[_0xf180('0x31')](_[_0xf180('0x2b')](_0x37379c,_0xf180('0x28')),[_0xf180('0x28')]);_0x151b90[_0xf180('0x32')]=_[_0xf180('0x33')](_0x4ff4f9[_0xf180('0x32')]);_0x151b90[_0xf180('0x34')]=_[_0xf180('0x35')](_0x151b90[_0xf180('0x30')],_0x151b90[_0xf180('0x32')]);_0x158d1a[_0xf180('0x36')]=_['intersection'](_0x151b90[_0xf180('0x30')],qs[_0xf180('0x37')](_0x4ff4f9['query'][_0xf180('0x37')]));_0x158d1a['attributes']=_0x158d1a[_0xf180('0x36')][_0xf180('0x38')]?_0x158d1a[_0xf180('0x36')]:_0x151b90['model'];if(!_0x4ff4f9[_0xf180('0x32')][_0xf180('0x39')](_0xf180('0x3a'))){_0x158d1a[_0xf180('0x1d')]=qs['limit'](_0x4ff4f9[_0xf180('0x32')][_0xf180('0x1d')]);_0x158d1a[_0xf180('0x1c')]=qs[_0xf180('0x1c')](_0x4ff4f9[_0xf180('0x32')][_0xf180('0x1c')]);}_0x158d1a[_0xf180('0x3b')]=qs[_0xf180('0x3c')](_0x4ff4f9[_0xf180('0x32')][_0xf180('0x3c')]);_0x158d1a['where']=qs[_0xf180('0x34')](_['pick'](_0x4ff4f9['query'],_0x151b90[_0xf180('0x34')]),_0x37379c);if(_0x4ff4f9['query']['filter']){_0x158d1a[_0xf180('0x3d')]=_[_0xf180('0x3e')](_0x158d1a[_0xf180('0x3d')],{'$or':_[_0xf180('0x2b')](_0x37379c,function(_0x588c19){if(_0x588c19['type']!==_0xf180('0x3f')){var _0x57dead={};_0x57dead[_0x588c19[_0xf180('0x28')]]={'$like':'%'+_0x4ff4f9['query'][_0xf180('0x40')]+'%'};return _0x57dead;}})});}_0x158d1a=_[_0xf180('0x3e')]({},_0x158d1a,_0x4ff4f9[_0xf180('0x41')]);var _0x1d0978={'where':_0x158d1a[_0xf180('0x3d')]};return db[_0xf180('0x2c')][_0xf180('0x1b')](_0x1d0978)[_0xf180('0x25')](function(_0x40d5f9){_0x113478['count']=_0x40d5f9;if(_0x4ff4f9[_0xf180('0x32')][_0xf180('0x42')]){_0x158d1a['include']=[{'all':!![]}];}return db[_0xf180('0x2c')][_0xf180('0x43')](_0x158d1a);})[_0xf180('0x25')](function(_0x268e34){_0x113478['rows']=_0x268e34;return _0x113478;})[_0xf180('0x25')](respondWithFilteredResult(_0x3cda7b,_0x158d1a))['catch'](handleError(_0x3cda7b,null));};exports[_0xf180('0x44')]=function(_0xaa961,_0x22bdd1){var _0x21ac7={'raw':!![],'where':{'id':_0xaa961['params']['id']}},_0x5e0701={};_0x5e0701[_0xf180('0x30')]=_[_0xf180('0x33')](db[_0xf180('0x2c')][_0xf180('0x2d')]);_0x5e0701[_0xf180('0x32')]=_[_0xf180('0x33')](_0xaa961[_0xf180('0x32')]);_0x5e0701[_0xf180('0x34')]=_[_0xf180('0x35')](_0x5e0701[_0xf180('0x30')],_0x5e0701['query']);_0x21ac7[_0xf180('0x36')]=_['intersection'](_0x5e0701[_0xf180('0x30')],qs[_0xf180('0x37')](_0xaa961[_0xf180('0x32')]['fields']));_0x21ac7[_0xf180('0x36')]=_0x21ac7[_0xf180('0x36')]['length']?_0x21ac7[_0xf180('0x36')]:_0x5e0701[_0xf180('0x30')];if(_0xaa961[_0xf180('0x32')][_0xf180('0x42')]){_0x21ac7[_0xf180('0x45')]=[{'all':!![]}];}_0x21ac7=_[_0xf180('0x3e')]({},_0x21ac7,_0xaa961[_0xf180('0x41')]);return db[_0xf180('0x2c')][_0xf180('0x46')](_0x21ac7)[_0xf180('0x25')](handleEntityNotFound(_0x22bdd1,null))[_0xf180('0x25')](respondWithResult(_0x22bdd1,null))[_0xf180('0x47')](handleError(_0x22bdd1,null));};exports[_0xf180('0x48')]=function(_0x1bd35d,_0x115567){return db[_0xf180('0x2c')][_0xf180('0x48')](_0x1bd35d[_0xf180('0x49')],{})[_0xf180('0x25')](respondWithResult(_0x115567,0xc9))[_0xf180('0x47')](handleError(_0x115567,null));};exports['update']=function(_0x4c66d7,_0x2c692e){if(_0x4c66d7[_0xf180('0x49')]['id']){delete _0x4c66d7[_0xf180('0x49')]['id'];}return db[_0xf180('0x2c')][_0xf180('0x46')]({'where':{'id':_0x4c66d7[_0xf180('0x4a')]['id']}})[_0xf180('0x25')](handleEntityNotFound(_0x2c692e,null))[_0xf180('0x25')](saveUpdates(_0x4c66d7[_0xf180('0x49')],null))[_0xf180('0x25')](respondWithResult(_0x2c692e,null))[_0xf180('0x47')](handleError(_0x2c692e,null));};exports[_0xf180('0x4b')]=function(_0x31b79f,_0x2a1acf){return db[_0xf180('0x2c')]['find']({'where':{'id':_0x31b79f[_0xf180('0x4a')]['id']}})[_0xf180('0x25')](handleEntityNotFound(_0x2a1acf,null))['then'](removeEntity(_0x2a1acf,null))[_0xf180('0x47')](handleError(_0x2a1acf,null));};exports[_0xf180('0x4c')]=function(_0x4379af,_0x3603ca,_0x248b01){return db[_0xf180('0x2c')][_0xf180('0x46')]({'where':{'id':_0x4379af[_0xf180('0x4a')]['id']},'attributes':['id',_0xf180('0x4d'),_0xf180('0x4e')]})[_0xf180('0x25')](handleEntityNotFound(_0x3603ca,null))[_0xf180('0x25')](function(_0x581626){if(_0x581626){if(!_0x581626[_0xf180('0x4d')]){throw new db['Sequelize'][(_0xf180('0x4f'))]('VoiceMailMessage\x20not\x20found');}var _0x47ac1e={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x581626[_0xf180('0x4e')]){_0x47ac1e[_0xf180('0x50')]='attachment;\x20filename=\x22'+_0x581626[_0xf180('0x4e')]+_0xf180('0x51');}_0x3603ca['set'](_0x47ac1e);return _0x3603ca[_0xf180('0x29')](new Buffer(_0x581626['recording']));}})['catch'](handleError(_0x3603ca,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0ec11dd..4fd9e70 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 _0xaf6e=['exports','voice_voicemail_messages','dir','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x86342e,_0x3d3414){var _0x106ade=function(_0x287621){while(--_0x287621){_0x86342e['push'](_0x86342e['shift']());}};_0x106ade(++_0x3d3414);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x124be1,_0xbb7add){_0x124be1=_0x124be1-0x0;var _0x257ab5=_0xaf6e[_0x124be1];return _0x257ab5;};'use strict';var _=require(_0xeaf6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeaf6('0x1'));var moment=require(_0xeaf6('0x2'));var BPromise=require(_0xeaf6('0x3'));var rp=require(_0xeaf6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeaf6('0x5'));var config=require(_0xeaf6('0x6'));var attributes=require(_0xeaf6('0x7'));module[_0xeaf6('0x8')]=function(_0x284ffc,_0x4c8814){return _0x284ffc['define']('VoiceMailMessage',attributes,{'tableName':_0xeaf6('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xeaf6('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xfd6f=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfd6f,0x19d));var _0xffd6=function(_0x56ae10,_0x13dd12){_0x56ae10=_0x56ae10-0x0;var _0x453fa0=_0xfd6f[_0x56ae10];return _0x453fa0;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var logger=require(_0xffd6('0x2'))(_0xffd6('0x3'));var moment=require(_0xffd6('0x4'));var BPromise=require('bluebird');var rp=require(_0xffd6('0x5'));var fs=require('fs');var path=require(_0xffd6('0x6'));var rimraf=require(_0xffd6('0x7'));var config=require(_0xffd6('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xffd6('0x9')]=function(_0x380073,_0x3f3cd8){return _0x380073[_0xffd6('0xa')]('VoiceMailMessage',attributes,{'tableName':_0xffd6('0xb'),'paranoid':![],'indexes':[{'name':_0xffd6('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index fee84c2..81a4116 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x5cf8ac,_0x3d45c8){var _0x200e85=function(_0x1e7f24){while(--_0x1e7f24){_0x5cf8ac['push'](_0x5cf8ac['shift']());}};_0x200e85(++_0x3d45c8);}(_0x1a85,0x178));var _0x51a8=function(_0x29cf89,_0x10ce1f){_0x29cf89=_0x29cf89-0x0;var _0x34ac61=_0x1a85[_0x29cf89];return _0x34ac61;};'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')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x7a54=['info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x587f76,_0x1d1269){_0x587f76=_0x587f76-0x0;var _0x1d8ea2=_0x7a54[_0x587f76];return _0x1d8ea2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5003fb9..1697455 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 _0x76dd=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/sounds','put','update','delete','destroy','/:id/sounds/:id2','exports','util'];(function(_0x277925,_0x5d2ef2){var _0x4363dd=function(_0x8b655e){while(--_0x8b655e){_0x277925['push'](_0x277925['shift']());}};_0x4363dd(++_0x5d2ef2);}(_0x76dd,0x164));var _0xd76d=function(_0x305b53,_0x24896e){_0x305b53=_0x305b53-0x0;var _0x2d5747=_0x76dd[_0x305b53];return _0x2d5747;};'use strict';var multer=require('multer');var util=require(_0xd76d('0x0'));var path=require(_0xd76d('0x1'));var timeout=require(_0xd76d('0x2'));var express=require('express');var router=express[_0xd76d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd76d('0x4'));var config=require(_0xd76d('0x5'));var controller=require(_0xd76d('0x6'));router[_0xd76d('0x7')]('/',auth[_0xd76d('0x8')](),controller[_0xd76d('0x9')]);router[_0xd76d('0x7')](_0xd76d('0xa'),auth[_0xd76d('0x8')](),controller[_0xd76d('0xb')]);router[_0xd76d('0x7')]('/:id/sounds',auth['isAuthenticated'](),controller['getSounds']);router[_0xd76d('0xc')]('/',auth['isAuthenticated'](),controller[_0xd76d('0xd')]);router[_0xd76d('0xc')](_0xd76d('0xe'),auth[_0xd76d('0x8')](),controller['addSound']);router[_0xd76d('0xf')](_0xd76d('0xa'),auth[_0xd76d('0x8')](),controller[_0xd76d('0x10')]);router[_0xd76d('0x11')](_0xd76d('0xa'),auth[_0xd76d('0x8')](),controller[_0xd76d('0x12')]);router[_0xd76d('0x11')](_0xd76d('0x13'),auth[_0xd76d('0x8')](),controller['removeSound']);module[_0xd76d('0x14')]=router; \ No newline at end of file +var _0x98dc=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','index','isAuthenticated','/:id/sounds','getSounds','create','post','delete','/:id','/:id/sounds/:id2','removeSound','exports','path'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x98dc,0x19d));var _0xc98d=function(_0x5c999a,_0x4f48c5){_0x5c999a=_0x5c999a-0x0;var _0x21e4ad=_0x98dc[_0x5c999a];return _0x21e4ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc98d('0x0'));var timeout=require(_0xc98d('0x1'));var express=require(_0xc98d('0x2'));var router=express['Router']();var auth=require(_0xc98d('0x3'));var interaction=require(_0xc98d('0x4'));var config=require('../../config/environment');var controller=require(_0xc98d('0x5'));router[_0xc98d('0x6')]('/',auth['isAuthenticated'](),controller[_0xc98d('0x7')]);router['get']('/:id',auth[_0xc98d('0x8')](),controller['show']);router[_0xc98d('0x6')](_0xc98d('0x9'),auth[_0xc98d('0x8')](),controller[_0xc98d('0xa')]);router['post']('/',auth[_0xc98d('0x8')](),controller[_0xc98d('0xb')]);router[_0xc98d('0xc')](_0xc98d('0x9'),auth[_0xc98d('0x8')](),controller['addSound']);router['put']('/:id',auth[_0xc98d('0x8')](),controller['update']);router[_0xc98d('0xd')](_0xc98d('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xc98d('0xd')](_0xc98d('0xf'),auth[_0xc98d('0x8')](),controller[_0xc98d('0x10')]);module[_0xc98d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 00ff324..df1441c 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 _0x8b19=['files','quietmp3','mp3','TIMESTAMP','BOOLEAN','exports','STRING','ENUM','custom'];(function(_0x2ddf7d,_0x5ee0a8){var _0x5b9099=function(_0x15816c){while(--_0x15816c){_0x2ddf7d['push'](_0x2ddf7d['shift']());}};_0x5b9099(++_0x5ee0a8);}(_0x8b19,0xf8));var _0x98b1=function(_0x2c4cfc,_0xf85cd7){_0x2c4cfc=_0x2c4cfc-0x0;var _0xec103b=_0x8b19[_0x2c4cfc];return _0xec103b;};'use strict';var Sequelize=require('sequelize');module[_0x98b1('0x0')]={'name':{'type':Sequelize[_0x98b1('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x98b1('0x2')](_0x98b1('0x3'),_0x98b1('0x4'),'mp3nb','quietmp3nb',_0x98b1('0x5'),_0x98b1('0x6')),'allowNull':!![],'defaultValue':_0x98b1('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x98b1('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x98b1('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x98b1('0x1')],'allowNull':!![]},'stamp':{'type':_0x98b1('0x7')},'defaultEntry':{'type':Sequelize[_0x98b1('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9285=['files','STRING','TIMESTAMP','BOOLEAN','name','custom','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x21ec19,_0x2deac2){var _0x20a0e8=function(_0x15b148){while(--_0x15b148){_0x21ec19['push'](_0x21ec19['shift']());}};_0x20a0e8(++_0x2deac2);}(_0x9285,0x158));var _0x5928=function(_0x52bcb3,_0x571c85){_0x52bcb3=_0x52bcb3-0x0;var _0x24861d=_0x9285[_0x52bcb3];return _0x24861d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5928('0x0')},'mode':{'type':Sequelize['ENUM'](_0x5928('0x1'),'files',_0x5928('0x2'),_0x5928('0x3'),_0x5928('0x4'),_0x5928('0x5')),'allowNull':!![],'defaultValue':_0x5928('0x6')},'directory':{'type':Sequelize[_0x5928('0x7')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x5928('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5928('0x7')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x5928('0x8')},'defaultEntry':{'type':Sequelize[_0x5928('0x9')],'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 a036870..e57e48c 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 _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(_0x494bc0,_0x21b6f1){var _0x324004=function(_0x31d535){while(--_0x31d535){_0x494bc0['push'](_0x494bc0['shift']());}};_0x324004(++_0x21b6f1);}(_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 +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(_0x12ae9e,_0x58f7da){var _0x59fd32=function(_0x570c5d){while(--_0x570c5d){_0x12ae9e['push'](_0x12ae9e['shift']());}};_0x59fd32(++_0x58f7da);}(_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(){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 30553c4..8354f1e 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 _0x9e62=['define','VoiceMusicOnHold','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x9e62,0x157));var _0x29e6=function(_0x114dbf,_0x3dd101){_0x114dbf=_0x114dbf-0x0;var _0x5953c9=_0x9e62[_0x114dbf];return _0x5953c9;};'use strict';var _=require(_0x29e6('0x0'));var util=require(_0x29e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x29e6('0x2'));var BPromise=require(_0x29e6('0x3'));var rp=require(_0x29e6('0x4'));var fs=require('fs');var path=require(_0x29e6('0x5'));var rimraf=require(_0x29e6('0x6'));var config=require(_0x29e6('0x7'));var attributes=require(_0x29e6('0x8'));module['exports']=function(_0x4d736c,_0x3619bb){return _0x4d736c[_0x29e6('0x9')](_0x29e6('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6145=['bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','moment'];(function(_0x353847,_0x5c84de){var _0x40d8a6=function(_0x221958){while(--_0x221958){_0x353847['push'](_0x353847['shift']());}};_0x40d8a6(++_0x5c84de);}(_0x6145,0x77));var _0x5614=function(_0x258a7c,_0x55f3c8){_0x258a7c=_0x258a7c-0x0;var _0x573070=_0x6145[_0x258a7c];return _0x573070;};'use strict';var _=require(_0x5614('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5614('0x1'));var BPromise=require(_0x5614('0x2'));var rp=require(_0x5614('0x3'));var fs=require('fs');var path=require(_0x5614('0x4'));var rimraf=require('rimraf');var config=require(_0x5614('0x5'));var attributes=require(_0x5614('0x6'));module[_0x5614('0x7')]=function(_0x3706df,_0x30dd60){return _0x3706df[_0x5614('0x8')](_0x5614('0x9'),attributes,{'tableName':_0x5614('0xa'),'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 c33ae32..57e9dac 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 _0xd7de=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent'];(function(_0x255ca9,_0x53f0f2){var _0x6b3159=function(_0x5bd8c9){while(--_0x5bd8c9){_0x255ca9['push'](_0x255ca9['shift']());}};_0x6b3159(++_0x53f0f2);}(_0xd7de,0x1e9));var _0xed7d=function(_0x49cc38,_0x41a97e){_0x49cc38=_0x49cc38-0x0;var _0x40031f=_0xd7de[_0x49cc38];return _0x40031f;};'use strict';var _=require(_0xed7d('0x0'));var util=require(_0xed7d('0x1'));var moment=require(_0xed7d('0x2'));var BPromise=require(_0xed7d('0x3'));var rs=require(_0xed7d('0x4'));var fs=require('fs');var Redis=require(_0xed7d('0x5'));var db=require(_0xed7d('0x6'))['db'];var utils=require(_0xed7d('0x7'));var logger=require('../../config/logger')(_0xed7d('0x8'));var config=require(_0xed7d('0x9'));var jayson=require(_0xed7d('0xa'));var client=jayson[_0xed7d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b1296,_0xee634d,_0x1fb2e1){return new BPromise(function(_0x478fa4,_0x4b1087){return client[_0xed7d('0xc')](_0x1b1296,_0x1fb2e1)[_0xed7d('0xd')](function(_0xbb51c1){logger[_0xed7d('0xe')](_0xed7d('0xf'),_0xee634d,_0xed7d('0x10'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xee634d,_0xed7d('0x10'),JSON[_0xed7d('0x11')](_0xbb51c1));if(_0xbb51c1['error']){if(_0xbb51c1[_0xed7d('0x12')][_0xed7d('0x13')]===0x1f4){logger[_0xed7d('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xee634d,_0xbb51c1[_0xed7d('0x12')][_0xed7d('0x14')]);return _0x4b1087(_0xbb51c1[_0xed7d('0x12')][_0xed7d('0x14')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0xee634d,_0xbb51c1['error'][_0xed7d('0x14')]);return _0x478fa4(_0xbb51c1['error'][_0xed7d('0x14')]);}else{logger[_0xed7d('0xe')](_0xed7d('0xf'),_0xee634d,_0xed7d('0x10'));_0x478fa4(_0xbb51c1['result'][_0xed7d('0x14')]);}})[_0xed7d('0x15')](function(_0x49265){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0xee634d,_0x49265);_0x4b1087(_0x49265);});});} \ No newline at end of file +var _0x3fc8=['stringify','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x1ab785,_0xabbd47){var _0x2403ad=function(_0x204099){while(--_0x204099){_0x1ab785['push'](_0x1ab785['shift']());}};_0x2403ad(++_0xabbd47);}(_0x3fc8,0x10c));var _0x83fc=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x3fc8[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x83fc('0x0'));var util=require('util');var moment=require(_0x83fc('0x1'));var BPromise=require(_0x83fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83fc('0x3'));var db=require(_0x83fc('0x4'))['db'];var utils=require(_0x83fc('0x5'));var logger=require('../../config/logger')(_0x83fc('0x6'));var config=require(_0x83fc('0x7'));var jayson=require(_0x83fc('0x8'));var client=jayson[_0x83fc('0x9')][_0x83fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8eb4fc,_0x251f11,_0x42da4e){return new BPromise(function(_0x400ce0,_0x175e62){return client[_0x83fc('0xb')](_0x8eb4fc,_0x42da4e)[_0x83fc('0xc')](function(_0x51c699){logger[_0x83fc('0xd')](_0x83fc('0xe'),_0x251f11,_0x83fc('0xf'));logger[_0x83fc('0x10')](_0x83fc('0x11'),_0x251f11,_0x83fc('0xf'),JSON[_0x83fc('0x12')](_0x51c699));if(_0x51c699[_0x83fc('0x13')]){if(_0x51c699['error']['code']===0x1f4){logger[_0x83fc('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x251f11,_0x51c699[_0x83fc('0x13')][_0x83fc('0x14')]);return _0x175e62(_0x51c699['error'][_0x83fc('0x14')]);}logger[_0x83fc('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x251f11,_0x51c699['error']['message']);return _0x400ce0(_0x51c699['error'][_0x83fc('0x14')]);}else{logger[_0x83fc('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x251f11,_0x83fc('0xf'));_0x400ce0(_0x51c699['result'][_0x83fc('0x14')]);}})[_0x83fc('0x15')](function(_0x4c1c27){logger[_0x83fc('0x13')](_0x83fc('0xe'),_0x251f11,_0x4c1c27);_0x175e62(_0x4c1c27);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a245d83..d819a05 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 _0x898d=['/describe','isAuthenticated','describe','/:id','/:id/users','post','addAgents','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x475a79,_0x1b4c4c){var _0x219a8c=function(_0x594c83){while(--_0x594c83){_0x475a79['push'](_0x475a79['shift']());}};_0x219a8c(++_0x1b4c4c);}(_0x898d,0x11d));var _0xd898=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0x898d[_0x1073ad];return _0x528474;};'use strict';var multer=require('multer');var util=require(_0xd898('0x0'));var path=require(_0xd898('0x1'));var timeout=require(_0xd898('0x2'));var express=require(_0xd898('0x3'));var router=express[_0xd898('0x4')]();var auth=require(_0xd898('0x5'));var interaction=require(_0xd898('0x6'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0xd898('0x7')]('/',auth['isAuthenticated'](),controller[_0xd898('0x8')]);router[_0xd898('0x7')](_0xd898('0x9'),auth[_0xd898('0xa')](),controller[_0xd898('0xb')]);router[_0xd898('0x7')](_0xd898('0xc'),auth[_0xd898('0xa')](),controller['show']);router[_0xd898('0x7')](_0xd898('0xd'),auth[_0xd898('0xa')](),controller['getAgents']);router['post']('/',auth[_0xd898('0xa')](),controller['create']);router[_0xd898('0xe')](_0xd898('0xd'),auth[_0xd898('0xa')](),controller[_0xd898('0xf')]);router[_0xd898('0x10')]('/:id',auth[_0xd898('0xa')](),controller[_0xd898('0x11')]);router[_0xd898('0x12')](_0xd898('0xc'),auth[_0xd898('0xa')](),controller[_0xd898('0x13')]);router[_0xd898('0x12')](_0xd898('0xd'),auth[_0xd898('0xa')](),controller['removeAgents']);module[_0xd898('0x14')]=router; \ No newline at end of file +var _0x0e2a=['destroy','delete','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update'];(function(_0x5a3074,_0x4760f0){var _0x24b468=function(_0x306444){while(--_0x306444){_0x5a3074['push'](_0x5a3074['shift']());}};_0x24b468(++_0x4760f0);}(_0x0e2a,0x7c));var _0xa0e2=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0x0e2a[_0x308374];return _0x1f71e0;};'use strict';var multer=require('multer');var util=require(_0xa0e2('0x0'));var path=require(_0xa0e2('0x1'));var timeout=require(_0xa0e2('0x2'));var express=require(_0xa0e2('0x3'));var router=express[_0xa0e2('0x4')]();var auth=require(_0xa0e2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa0e2('0x6'));router[_0xa0e2('0x7')]('/',auth[_0xa0e2('0x8')](),controller[_0xa0e2('0x9')]);router[_0xa0e2('0x7')](_0xa0e2('0xa'),auth[_0xa0e2('0x8')](),controller['describe']);router['get'](_0xa0e2('0xb'),auth[_0xa0e2('0x8')](),controller[_0xa0e2('0xc')]);router[_0xa0e2('0x7')](_0xa0e2('0xd'),auth[_0xa0e2('0x8')](),controller[_0xa0e2('0xe')]);router[_0xa0e2('0xf')]('/',auth['isAuthenticated'](),controller[_0xa0e2('0x10')]);router['post'](_0xa0e2('0xd'),auth[_0xa0e2('0x8')](),controller[_0xa0e2('0x11')]);router[_0xa0e2('0x12')]('/:id',auth[_0xa0e2('0x8')](),controller[_0xa0e2('0x13')]);router['delete'](_0xa0e2('0xb'),auth[_0xa0e2('0x8')](),controller[_0xa0e2('0x14')]);router[_0xa0e2('0x15')]('/:id/users',auth[_0xa0e2('0x8')](),controller[_0xa0e2('0x16')]);module[_0xa0e2('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 622b3d2..c08ca2d 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 _0x7028=['getDataValue','STRING','name'];(function(_0x582972,_0xdbabc9){var _0x111cf1=function(_0x2a90e5){while(--_0x2a90e5){_0x582972['push'](_0x582972['shift']());}};_0x111cf1(++_0xdbabc9);}(_0x7028,0x157));var _0x8702=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x7028[_0x238671];return _0x474844;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8702('0x0')],'allowNull':![],'unique':_0x8702('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0xf40be){return'system-'+this[_0x8702('0x2')](_0x8702('0x1'))+'-';}},'description':{'type':Sequelize[_0x8702('0x0')]},'callerIdAll':{'type':Sequelize[_0x8702('0x0')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x69e6=['exports','STRING','name','VIRTUAL','getDataValue','INTEGER'];(function(_0xd6ca50,_0x428697){var _0x579b2d=function(_0x305f4b){while(--_0x305f4b){_0xd6ca50['push'](_0xd6ca50['shift']());}};_0x579b2d(++_0x428697);}(_0x69e6,0x1e0));var _0x669e=function(_0x4ff784,_0x31f2e3){_0x4ff784=_0x4ff784-0x0;var _0x5231ec=_0x69e6[_0x4ff784];return _0x5231ec;};'use strict';var Sequelize=require('sequelize');module[_0x669e('0x0')]={'name':{'type':Sequelize[_0x669e('0x1')],'allowNull':![],'unique':_0x669e('0x2')},'prefix':{'type':Sequelize[_0x669e('0x3')],'get':function(_0x75b8aa){return'system-'+this[_0x669e('0x4')](_0x669e('0x2'))+'-';}},'description':{'type':Sequelize[_0x669e('0x1')]},'callerIdAll':{'type':Sequelize[_0x669e('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x669e('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c3956f0..31e0c2b 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 _0x8e27=['redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','VoicePrefix','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','appdata','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','callerIdAll','push','PREFIX-CALLERIDALL=','NoOp','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x2cd8e3,_0x2f8c14){var _0x5bec8f=function(_0x3c9de3){while(--_0x3c9de3){_0x2cd8e3['push'](_0x2cd8e3['shift']());}};_0x5bec8f(++_0x2f8c14);}(_0x8e27,0xde));var _0x78e2=function(_0x3dda0f,_0x5b9902){_0x3dda0f=_0x3dda0f-0x0;var _0x1b0488=_0x8e27[_0x3dda0f];return _0x1b0488;};'use strict';var pdf=require(_0x78e2('0x0'));var emlformat=require(_0x78e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x78e2('0x2'));var jsonpatch=require(_0x78e2('0x3'));var rp=require('request-promise');var moment=require(_0x78e2('0x4'));var BPromise=require(_0x78e2('0x5'));var Mustache=require(_0x78e2('0x6'));var util=require(_0x78e2('0x7'));var path=require(_0x78e2('0x8'));var sox=require(_0x78e2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x78e2('0xa'));var crypto=require(_0x78e2('0xb'));var jsforce=require(_0x78e2('0xc'));var deskjs=require(_0x78e2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x78e2('0xe'));var Redis=require(_0x78e2('0xf'));var authService=require(_0x78e2('0x10'));var qs=require(_0x78e2('0x11'));var as=require(_0x78e2('0x12'));var hardwareService=require(_0x78e2('0x13'));var logger=require(_0x78e2('0x14'))(_0x78e2('0x15'));var utils=require('../../config/utils');var config=require(_0x78e2('0x16'));var db=require(_0x78e2('0x17'))['db'];config[_0x78e2('0x18')]=_[_0x78e2('0x19')](config[_0x78e2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x78e2('0x1a'))(new Redis(config[_0x78e2('0x18')]));require(_0x78e2('0x1b'))['register'](socket);function respondWithStatusCode(_0x39a025,_0x147236){_0x147236=_0x147236||0xcc;return function(_0x40cdfd){if(_0x40cdfd){return _0x39a025[_0x78e2('0x1c')](_0x147236);}return _0x39a025['status'](_0x147236)[_0x78e2('0x1d')]();};}function respondWithResult(_0x47b92a,_0x5ae721){_0x5ae721=_0x5ae721||0xc8;return function(_0x48339e){if(_0x48339e){return _0x47b92a[_0x78e2('0x1e')](_0x5ae721)[_0x78e2('0x1f')](_0x48339e);}};}function respondWithFilteredResult(_0x5cc165,_0x544c73){return function(_0x22625c){if(_0x22625c){var _0xd1de7f=_0x22625c[_0x78e2('0x20')],_0x21564f=_0x544c73[_0x78e2('0x21')],_0x4b8031=_0x544c73['offset']+_0x544c73[_0x78e2('0x22')],_0x5d1b00;if(_0x4b8031>=_0xd1de7f){_0x4b8031=_0xd1de7f;_0x5d1b00=0xc8;}else{_0x5d1b00=0xce;}_0x5cc165[_0x78e2('0x1e')](_0x5d1b00);return _0x5cc165[_0x78e2('0x23')](_0x78e2('0x24'),_0x21564f+'-'+_0x4b8031+'/'+_0xd1de7f)['json'](_0x22625c);}return null;};}function patchUpdates(_0x42ec76){return function(_0x145dbf){try{jsonpatch['apply'](_0x145dbf,_0x42ec76,!![]);}catch(_0x4bb9b1){return BPromise[_0x78e2('0x25')](_0x4bb9b1);}return _0x145dbf[_0x78e2('0x26')]();};}function saveUpdates(_0x19b986,_0x2c92be){return function(_0x2cecb1){if(_0x2cecb1){return _0x2cecb1[_0x78e2('0x27')](_0x19b986)[_0x78e2('0x28')](function(_0x2acd1c){return _0x2acd1c;});}return null;};}function removeEntity(_0x1b538f,_0x2e80f4){return function(_0xa99699){if(_0xa99699){return _0xa99699[_0x78e2('0x29')]()[_0x78e2('0x28')](function(){var _0x2e233e=_0xa99699[_0x78e2('0x2a')]({'plain':!![]});var _0x365ea5='VoicePrefixes';return db[_0x78e2('0x2b')]['destroy']({'where':{'type':_0x365ea5,'resourceId':_0x2e233e['id']}})[_0x78e2('0x28')](function(){return _0xa99699;});})[_0x78e2('0x28')](function(){_0x1b538f[_0x78e2('0x1e')](0xcc)[_0x78e2('0x1d')]();});}};}function handleEntityNotFound(_0x118d63,_0x44ed0f){return function(_0x7e4a62){if(!_0x7e4a62){_0x118d63[_0x78e2('0x1c')](0x194);}return _0x7e4a62;};}function handleError(_0x79e37f,_0xde9c79){_0xde9c79=_0xde9c79||0x1f4;return function(_0x538f7e){logger[_0x78e2('0x2c')](_0x538f7e['stack']);if(_0x538f7e[_0x78e2('0x2d')]){delete _0x538f7e[_0x78e2('0x2d')];}_0x79e37f['status'](_0xde9c79)[_0x78e2('0x2e')](_0x538f7e);};}exports[_0x78e2('0x2f')]=function(_0xf6196d,_0xf47317){var _0x431f7a={},_0x3a9597={},_0x519eba={'count':0x0,'rows':[]};var _0x1eda47=_['map'](db[_0x78e2('0x30')][_0x78e2('0x31')],function(_0x34d89f){return{'name':_0x34d89f[_0x78e2('0x32')],'type':_0x34d89f[_0x78e2('0x33')]['key']};});_0x3a9597[_0x78e2('0x34')]=_[_0x78e2('0x35')](_0x1eda47,_0x78e2('0x2d'));_0x3a9597[_0x78e2('0x36')]=_[_0x78e2('0x37')](_0xf6196d['query']);_0x3a9597['filters']=_[_0x78e2('0x38')](_0x3a9597['model'],_0x3a9597[_0x78e2('0x36')]);_0x431f7a[_0x78e2('0x39')]=_[_0x78e2('0x38')](_0x3a9597[_0x78e2('0x34')],qs[_0x78e2('0x3a')](_0xf6196d['query'][_0x78e2('0x3a')]));_0x431f7a[_0x78e2('0x39')]=_0x431f7a[_0x78e2('0x39')][_0x78e2('0x3b')]?_0x431f7a[_0x78e2('0x39')]:_0x3a9597['model'];if(!_0xf6196d[_0x78e2('0x36')][_0x78e2('0x3c')](_0x78e2('0x3d'))){_0x431f7a[_0x78e2('0x22')]=qs[_0x78e2('0x22')](_0xf6196d[_0x78e2('0x36')][_0x78e2('0x22')]);_0x431f7a['offset']=qs[_0x78e2('0x21')](_0xf6196d['query'][_0x78e2('0x21')]);}_0x431f7a[_0x78e2('0x3e')]=qs[_0x78e2('0x3f')](_0xf6196d[_0x78e2('0x36')][_0x78e2('0x3f')]);_0x431f7a['where']=qs[_0x78e2('0x40')](_[_0x78e2('0x41')](_0xf6196d[_0x78e2('0x36')],_0x3a9597[_0x78e2('0x40')]),_0x1eda47);if(_0xf6196d[_0x78e2('0x36')][_0x78e2('0x42')]){_0x431f7a[_0x78e2('0x43')]=_[_0x78e2('0x44')](_0x431f7a[_0x78e2('0x43')],{'$or':_[_0x78e2('0x35')](_0x1eda47,function(_0x14f95d){if(_0x14f95d['type']!==_0x78e2('0x45')){var _0x9136b0={};_0x9136b0[_0x14f95d[_0x78e2('0x2d')]]={'$like':'%'+_0xf6196d['query']['filter']+'%'};return _0x9136b0;}})});}_0x431f7a=_[_0x78e2('0x44')]({},_0x431f7a,_0xf6196d[_0x78e2('0x46')]);var _0x5c82c5={'where':_0x431f7a[_0x78e2('0x43')]};return db[_0x78e2('0x30')][_0x78e2('0x20')](_0x5c82c5)[_0x78e2('0x28')](function(_0x4552fa){_0x519eba[_0x78e2('0x20')]=_0x4552fa;if(_0xf6196d['query'][_0x78e2('0x47')]){_0x431f7a['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x78e2('0x48')](_0x431f7a);})[_0x78e2('0x28')](function(_0x208040){_0x519eba[_0x78e2('0x49')]=_0x208040;return _0x519eba;})[_0x78e2('0x28')](respondWithFilteredResult(_0xf47317,_0x431f7a))[_0x78e2('0x4a')](handleError(_0xf47317,null));};exports[_0x78e2('0x4b')]=function(_0x2a9374,_0x28781b){var _0x4e8265={'raw':![],'where':{'id':_0x2a9374[_0x78e2('0x4c')]['id']}},_0x584f13={};_0x584f13['model']=_[_0x78e2('0x37')](db[_0x78e2('0x30')]['rawAttributes']);_0x584f13[_0x78e2('0x36')]=_[_0x78e2('0x37')](_0x2a9374[_0x78e2('0x36')]);_0x584f13[_0x78e2('0x40')]=_[_0x78e2('0x38')](_0x584f13[_0x78e2('0x34')],_0x584f13[_0x78e2('0x36')]);_0x4e8265[_0x78e2('0x39')]=_[_0x78e2('0x38')](_0x584f13[_0x78e2('0x34')],qs[_0x78e2('0x3a')](_0x2a9374[_0x78e2('0x36')][_0x78e2('0x3a')]));_0x4e8265[_0x78e2('0x39')]=_0x4e8265[_0x78e2('0x39')]['length']?_0x4e8265['attributes']:_0x584f13[_0x78e2('0x34')];if(_0x2a9374[_0x78e2('0x36')][_0x78e2('0x47')]){_0x4e8265['include']=[{'all':!![]}];}_0x4e8265=_['merge']({},_0x4e8265,_0x2a9374[_0x78e2('0x46')]);return db[_0x78e2('0x30')][_0x78e2('0x4d')](_0x4e8265)[_0x78e2('0x28')](handleEntityNotFound(_0x28781b,null))['then'](respondWithResult(_0x28781b,null))['catch'](handleError(_0x28781b,null));};exports['destroy']=function(_0x11a18e,_0xb6803a){return db[_0x78e2('0x30')][_0x78e2('0x4d')]({'where':{'id':_0x11a18e['params']['id']}})[_0x78e2('0x28')](handleEntityNotFound(_0xb6803a,null))['then'](removeEntity(_0xb6803a,null))[_0x78e2('0x4a')](handleError(_0xb6803a,null));};exports[_0x78e2('0x4e')]=function(_0x263fea,_0x2aca64){return db[_0x78e2('0x30')][_0x78e2('0x4e')]()[_0x78e2('0x28')](respondWithResult(_0x2aca64,null))[_0x78e2('0x4a')](handleError(_0x2aca64,null));};exports[_0x78e2('0x4f')]=function(_0x1d4211,_0x2739eb){var _0x702549;return db[_0x78e2('0x50')][_0x78e2('0x51')](function(_0x12229c){return db[_0x78e2('0x30')][_0x78e2('0x4f')](_0x1d4211[_0x78e2('0x52')],{'transaction':_0x12229c})[_0x78e2('0x28')](function(_0x136dd1){_0x702549=_0x136dd1[_0x78e2('0x2a')]({'plain':!![]});return db['VoiceExtension'][_0x78e2('0x4d')]({'where':{'id':_0x702549[_0x78e2('0x53')]},'raw':!![]})['then'](function(_0x58b672){return createVoicePrefixExtensions(_0x702549,_0x58b672,_0x12229c);});});})['then'](function(){var _0x38846c=_0x1d4211[_0x78e2('0x54')][_0x78e2('0x2a')]({'plain':!![]});if(!_0x38846c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38846c['role']===_0x78e2('0x54')){var _0xcf8435=_0x702549;return db[_0x78e2('0x55')]['find']({'where':{'name':_0x78e2('0x56'),'userProfileId':_0x38846c[_0x78e2('0x57')]},'raw':!![]})[_0x78e2('0x28')](function(_0x5df749){if(_0x5df749&&_0x5df749[_0x78e2('0x58')]===0x0){return db[_0x78e2('0x2b')][_0x78e2('0x4f')]({'name':_0xcf8435[_0x78e2('0x2d')],'resourceId':_0xcf8435['id'],'type':_0x5df749['name'],'sectionId':_0x5df749['id']},{})['then'](function(){return _0x702549;});}else{return _0x702549;}})[_0x78e2('0x4a')](function(_0x425947){logger['error'](_0x78e2('0x59'),_0x425947);throw _0x425947;});}return _0x702549;})[_0x78e2('0x28')](respondWithResult(_0x2739eb,null))[_0x78e2('0x4a')](handleError(_0x2739eb,null));};function Extension(_0x2cb536,_0xeb3e4b,_0x1cb82d,_0x2bbe63){this[_0x78e2('0x5a')]=_0x78e2('0x5b');this[_0x78e2('0x5c')]=_0x2cb536;this[_0x78e2('0x5d')]=_0x1cb82d;this[_0x78e2('0x33')]=_0x78e2('0x5e');this['description']=_0x78e2('0x5f');this['priority']=_0xeb3e4b;this[_0x78e2('0x60')]=_0x2bbe63;}function createVoicePrefixExtensions(_0x2ae231,_0x2508ba,_0x40c734){return new BPromise(function(_0x299935,_0x11f0c7){var _0xace1af=new Extension(formatPrefixName(_0x2ae231['prefix']),0x1,'NoOp',_0x78e2('0x61'));_0xace1af['VoicePrefixId']=_0x2ae231['id'];return db[_0x78e2('0x62')]['create'](_0xace1af,{'transaction':_0x40c734})[_0x78e2('0x28')](function(_0x7267f7){var _0x21e6b3=_0x7267f7[_0x78e2('0x2a')]({'plain':!![]});var _0x3af26e=_[_0x78e2('0x35')](addVoicePrefixExtensions(_0x2ae231,_0x2508ba),function(_0x5da6c6){_0x5da6c6[_0x78e2('0x53')]=_0x21e6b3['id'];_0x5da6c6[_0x78e2('0x63')]=_0x2ae231['id'];return _0x5da6c6;});return db[_0x78e2('0x62')][_0x78e2('0x64')](_0x3af26e,{'transaction':_0x40c734})[_0x78e2('0x28')](function(_0x3986e0){if(!_0x3986e0){return _0x11f0c7(_0x78e2('0x65'));}else{return _0x299935(_0x3986e0);}})[_0x78e2('0x4a')](function(_0x166b07){return _0x11f0c7(_0x166b07);});});;});};function addVoicePrefixExtensions(_0x3e13c0,_0x4fd80c){var _0xb8bd1e=[];var _0x1d9b1f=formatPrefixName(_0x3e13c0[_0x78e2('0x66')]);_0xb8bd1e['push'](new Extension(_0x1d9b1f,0x2,_0x78e2('0x67'),'CDR(prefix)='+_0x3e13c0[_0x78e2('0x2d')]));if(_0x3e13c0[_0x78e2('0x68')]){_0xb8bd1e[_0x78e2('0x69')](new Extension(_0x1d9b1f,0x3,_0x78e2('0x67'),_0x78e2('0x6a')+_0x3e13c0['callerIdAll']));}else{_0xb8bd1e['push'](new Extension(_0x1d9b1f,0x3,_0x78e2('0x6b'),'No\x20callerid\x20available'));}_0xb8bd1e[_0x78e2('0x69')](new Extension(_0x1d9b1f,0x4,'goto',_0x4fd80c['context']+','+_0x78e2('0x6c')+(0x8+_0x3e13c0[_0x78e2('0x2d')][_0x78e2('0x3b')])+'}'+','+0x1));return _0xb8bd1e;}function formatPrefixName(_0x257418){var _0x18252d='_';for(var _0x5d8132=0x0;_0x5d8132<_0x257418[_0x78e2('0x3b')];_0x5d8132++){if(_0x257418[_0x78e2('0x6d')](_0x5d8132)=='-'){_0x18252d+=_0x257418[_0x78e2('0x6d')](_0x5d8132);}else{_0x18252d+='['+_0x257418[_0x78e2('0x6d')](_0x5d8132)+']';}}_0x18252d+='.';return _0x18252d;}exports[_0x78e2('0x27')]=function(_0x247066,_0x29ac7c,_0x3149da){var _0x3fa0f4=_0x247066[_0x78e2('0x52')];_0x3fa0f4['prefix']=_0x78e2('0x6e')+_0x3fa0f4[_0x78e2('0x2d')]+'-';return db[_0x78e2('0x50')][_0x78e2('0x51')](function(_0x1bce69){return db[_0x78e2('0x30')][_0x78e2('0x27')](_0x3fa0f4,{'where':{'id':_0x3fa0f4['id']},'transaction':_0x1bce69})[_0x78e2('0x28')](function(){return db[_0x78e2('0x62')][_0x78e2('0x29')]({'where':{'VoicePrefixId':_0x3fa0f4['id']},'transaction':_0x1bce69})[_0x78e2('0x28')](function(){return db[_0x78e2('0x62')][_0x78e2('0x4d')]({'where':{'id':_0x3fa0f4[_0x78e2('0x53')]},'raw':!![]})[_0x78e2('0x28')](function(_0x5836b9){return createVoicePrefixExtensions(_0x3fa0f4,_0x5836b9,_0x1bce69);});});});})['then'](function(){return db[_0x78e2('0x30')][_0x78e2('0x6f')](_0x3fa0f4['id']);})[_0x78e2('0x28')](respondWithResult(_0x29ac7c,null))[_0x78e2('0x4a')](handleError(_0x29ac7c,null));};exports['addAgents']=function(_0x193d25,_0x57bcb2,_0x535cfa){return db['VoicePrefix'][_0x78e2('0x4d')]({'where':{'id':_0x193d25[_0x78e2('0x4c')]['id']}})[_0x78e2('0x28')](handleEntityNotFound(_0x57bcb2,null))[_0x78e2('0x28')](function(_0x5cbb90){if(_0x5cbb90){return _0x5cbb90[_0x78e2('0x70')](_0x193d25[_0x78e2('0x52')][_0x78e2('0x71')],_[_0x78e2('0x72')](_0x193d25[_0x78e2('0x52')],['ids','id'])||{})[_0x78e2('0x73')](function(_0xda86ad){for(var _0x379d0e=0x0;_0x379d0e<_0x193d25[_0x78e2('0x52')][_0x78e2('0x71')][_0x78e2('0x3b')];_0x379d0e+=0x1){socket[_0x78e2('0x74')]('userVoicePrefix:save',{'UserId':_0x193d25['body'][_0x78e2('0x71')][_0x379d0e],'VoicePrefixId':_0x193d25['params']['id']});}return _0xda86ad;});}})[_0x78e2('0x28')](respondWithResult(_0x57bcb2,null))[_0x78e2('0x4a')](handleError(_0x57bcb2,null));};exports[_0x78e2('0x75')]=function(_0xbb3c7,_0x3748aa,_0x6d41bd){return db[_0x78e2('0x30')][_0x78e2('0x4d')]({'where':{'id':_0xbb3c7[_0x78e2('0x4c')]['id']}})[_0x78e2('0x28')](handleEntityNotFound(_0x3748aa,null))[_0x78e2('0x28')](function(_0x59f5b1){if(_0x59f5b1){return _0x59f5b1[_0x78e2('0x75')](_0xbb3c7[_0x78e2('0x36')][_0x78e2('0x71')])['then'](function(){if(_[_0x78e2('0x76')](_0xbb3c7['query']['ids'])){for(var _0x2bf2ba=0x0;_0x2bf2ba<_0xbb3c7['query'][_0x78e2('0x71')][_0x78e2('0x3b')];_0x2bf2ba+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0xbb3c7[_0x78e2('0x36')][_0x78e2('0x71')][_0x2bf2ba]),'VoicePrefixId':Number(_0xbb3c7['params']['id'])});}}else{socket['emit'](_0x78e2('0x77'),{'UserId':Number(_0xbb3c7['query'][_0x78e2('0x71')]),'VoicePrefixId':Number(_0xbb3c7['params']['id'])});}});}})[_0x78e2('0x28')](respondWithStatusCode(_0x3748aa,null))['catch'](handleError(_0x3748aa,null));};exports[_0x78e2('0x78')]=function(_0x5db861,_0x1bc702,_0x40a8ca){var _0x479bae={};var _0xfbcd24={};var _0x5bbd38;var _0x155c2f;return db[_0x78e2('0x30')][_0x78e2('0x79')]({'where':{'id':_0x5db861['params']['id']}})[_0x78e2('0x28')](handleEntityNotFound(_0x1bc702,null))[_0x78e2('0x28')](function(_0x45277d){if(_0x45277d){_0x5bbd38=_0x45277d;_0xfbcd24[_0x78e2('0x34')]=_[_0x78e2('0x37')](db[_0x78e2('0x7a')][_0x78e2('0x31')]);_0xfbcd24[_0x78e2('0x36')]=_[_0x78e2('0x37')](_0x5db861[_0x78e2('0x36')]);_0xfbcd24[_0x78e2('0x40')]=_[_0x78e2('0x38')](_0xfbcd24[_0x78e2('0x34')],_0xfbcd24[_0x78e2('0x36')]);_0x479bae[_0x78e2('0x39')]=_[_0x78e2('0x38')](_0xfbcd24['model'],qs['fields'](_0x5db861['query'][_0x78e2('0x3a')]));_0x479bae[_0x78e2('0x39')]=_0x479bae[_0x78e2('0x39')]['length']?_0x479bae['attributes']:_0xfbcd24[_0x78e2('0x34')];_0x479bae['order']=qs[_0x78e2('0x3f')](_0x5db861[_0x78e2('0x36')][_0x78e2('0x3f')]);_0x479bae[_0x78e2('0x43')]=qs[_0x78e2('0x40')](_[_0x78e2('0x41')](_0x5db861[_0x78e2('0x36')],_0xfbcd24[_0x78e2('0x40')]));if(_0x5db861[_0x78e2('0x36')][_0x78e2('0x42')]){_0x479bae[_0x78e2('0x43')]=_[_0x78e2('0x44')](_0x479bae[_0x78e2('0x43')],{'$or':_['map'](_0x479bae[_0x78e2('0x39')],function(_0x4b1d03){var _0x56a196={};_0x56a196[_0x4b1d03]={'$like':'%'+_0x5db861[_0x78e2('0x36')][_0x78e2('0x42')]+'%'};return _0x56a196;})});}_0x479bae=_[_0x78e2('0x44')]({},_0x479bae,_0x5db861['options']);return _0x5bbd38[_0x78e2('0x78')](_0x479bae);}})['then'](function(_0x46cdab){if(_0x46cdab){_0x155c2f=_0x46cdab[_0x78e2('0x3b')];if(!_0x5db861[_0x78e2('0x36')][_0x78e2('0x3c')]('nolimit')){_0x479bae[_0x78e2('0x22')]=qs[_0x78e2('0x22')](_0x5db861[_0x78e2('0x36')][_0x78e2('0x22')]);_0x479bae['offset']=qs['offset'](_0x5db861['query']['offset']);}return _0x5bbd38[_0x78e2('0x78')](_0x479bae);}})[_0x78e2('0x28')](function(_0xd29505){if(_0xd29505){return _0xd29505?{'count':_0x155c2f,'rows':_0xd29505}:null;}})[_0x78e2('0x28')](respondWithResult(_0x1bc702,null))[_0x78e2('0x4a')](handleError(_0x1bc702,null));}; \ No newline at end of file +var _0xcbd8=['No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','key','query','intersection','attributes','model','fields','length','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','keys','include','find','catch','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','system','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL='];(function(_0x4690e5,_0x3e670c){var _0x333cec=function(_0x2707f2){while(--_0x2707f2){_0x4690e5['push'](_0x4690e5['shift']());}};_0x333cec(++_0x3e670c);}(_0xcbd8,0x10e));var _0x8cbd=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcbd8[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x8cbd('0x0'));var emlformat=require(_0x8cbd('0x1'));var rimraf=require(_0x8cbd('0x2'));var zipdir=require(_0x8cbd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cbd('0x4'));var moment=require(_0x8cbd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8cbd('0x6'));var util=require('util');var path=require(_0x8cbd('0x7'));var sox=require(_0x8cbd('0x8'));var csv=require(_0x8cbd('0x9'));var ejs=require(_0x8cbd('0xa'));var fs=require('fs');var _=require(_0x8cbd('0xb'));var squel=require(_0x8cbd('0xc'));var crypto=require('crypto');var jsforce=require(_0x8cbd('0xd'));var deskjs=require(_0x8cbd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8cbd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cbd('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cbd('0x11'));var logger=require(_0x8cbd('0x12'))(_0x8cbd('0x13'));var utils=require('../../config/utils');var config=require(_0x8cbd('0x14'));var db=require(_0x8cbd('0x15'))['db'];config['redis']=_[_0x8cbd('0x16')](config['redis'],{'host':_0x8cbd('0x17'),'port':0x18eb});var socket=require(_0x8cbd('0x18'))(new Redis(config[_0x8cbd('0x19')]));require(_0x8cbd('0x1a'))[_0x8cbd('0x1b')](socket);function respondWithStatusCode(_0x10ff8e,_0x5ec91a){_0x5ec91a=_0x5ec91a||0xcc;return function(_0x587b0c){if(_0x587b0c){return _0x10ff8e[_0x8cbd('0x1c')](_0x5ec91a);}return _0x10ff8e[_0x8cbd('0x1d')](_0x5ec91a)[_0x8cbd('0x1e')]();};}function respondWithResult(_0x46bcb7,_0x514d3a){_0x514d3a=_0x514d3a||0xc8;return function(_0x29ea5c){if(_0x29ea5c){return _0x46bcb7['status'](_0x514d3a)[_0x8cbd('0x1f')](_0x29ea5c);}};}function respondWithFilteredResult(_0x1c4754,_0x59b0fa){return function(_0x4e16c4){if(_0x4e16c4){var _0x19db4a=_0x4e16c4[_0x8cbd('0x20')],_0x394f45=_0x59b0fa[_0x8cbd('0x21')],_0x19c3f6=_0x59b0fa[_0x8cbd('0x21')]+_0x59b0fa['limit'],_0xdd3c6e;if(_0x19c3f6>=_0x19db4a){_0x19c3f6=_0x19db4a;_0xdd3c6e=0xc8;}else{_0xdd3c6e=0xce;}_0x1c4754[_0x8cbd('0x1d')](_0xdd3c6e);return _0x1c4754[_0x8cbd('0x22')](_0x8cbd('0x23'),_0x394f45+'-'+_0x19c3f6+'/'+_0x19db4a)[_0x8cbd('0x1f')](_0x4e16c4);}return null;};}function patchUpdates(_0x22e6a3){return function(_0x2a604f){try{jsonpatch['apply'](_0x2a604f,_0x22e6a3,!![]);}catch(_0x1983d7){return BPromise['reject'](_0x1983d7);}return _0x2a604f['save']();};}function saveUpdates(_0x26bf3c,_0x5302f0){return function(_0x5d864d){if(_0x5d864d){return _0x5d864d[_0x8cbd('0x24')](_0x26bf3c)[_0x8cbd('0x25')](function(_0x30aad9){return _0x30aad9;});}return null;};}function removeEntity(_0x5f0f02,_0x5b67ff){return function(_0x877b3f){if(_0x877b3f){return _0x877b3f[_0x8cbd('0x26')]()[_0x8cbd('0x25')](function(){var _0x184548=_0x877b3f[_0x8cbd('0x27')]({'plain':!![]});var _0x3aa60c=_0x8cbd('0x28');return db[_0x8cbd('0x29')][_0x8cbd('0x26')]({'where':{'type':_0x3aa60c,'resourceId':_0x184548['id']}})[_0x8cbd('0x25')](function(){return _0x877b3f;});})[_0x8cbd('0x25')](function(){_0x5f0f02[_0x8cbd('0x1d')](0xcc)[_0x8cbd('0x1e')]();});}};}function handleEntityNotFound(_0x3eea7d,_0x3e7dfc){return function(_0x6ef4db){if(!_0x6ef4db){_0x3eea7d['sendStatus'](0x194);}return _0x6ef4db;};}function handleError(_0x3889cd,_0x5a80fc){_0x5a80fc=_0x5a80fc||0x1f4;return function(_0x598f93){logger[_0x8cbd('0x2a')](_0x598f93[_0x8cbd('0x2b')]);if(_0x598f93[_0x8cbd('0x2c')]){delete _0x598f93[_0x8cbd('0x2c')];}_0x3889cd[_0x8cbd('0x1d')](_0x5a80fc)[_0x8cbd('0x2d')](_0x598f93);};}exports[_0x8cbd('0x2e')]=function(_0x3c385a,_0x5923d1){var _0x13538c={},_0x3d9a31={},_0x48ee5d={'count':0x0,'rows':[]};var _0x39aede=_[_0x8cbd('0x2f')](db[_0x8cbd('0x30')][_0x8cbd('0x31')],function(_0x1ae7d9){return{'name':_0x1ae7d9[_0x8cbd('0x32')],'type':_0x1ae7d9['type'][_0x8cbd('0x33')]};});_0x3d9a31['model']=_[_0x8cbd('0x2f')](_0x39aede,_0x8cbd('0x2c'));_0x3d9a31[_0x8cbd('0x34')]=_['keys'](_0x3c385a[_0x8cbd('0x34')]);_0x3d9a31['filters']=_[_0x8cbd('0x35')](_0x3d9a31['model'],_0x3d9a31['query']);_0x13538c[_0x8cbd('0x36')]=_[_0x8cbd('0x35')](_0x3d9a31[_0x8cbd('0x37')],qs[_0x8cbd('0x38')](_0x3c385a[_0x8cbd('0x34')]['fields']));_0x13538c['attributes']=_0x13538c[_0x8cbd('0x36')][_0x8cbd('0x39')]?_0x13538c['attributes']:_0x3d9a31[_0x8cbd('0x37')];if(!_0x3c385a[_0x8cbd('0x34')]['hasOwnProperty']('nolimit')){_0x13538c[_0x8cbd('0x3a')]=qs[_0x8cbd('0x3a')](_0x3c385a['query'][_0x8cbd('0x3a')]);_0x13538c['offset']=qs[_0x8cbd('0x21')](_0x3c385a['query'][_0x8cbd('0x21')]);}_0x13538c[_0x8cbd('0x3b')]=qs[_0x8cbd('0x3c')](_0x3c385a[_0x8cbd('0x34')][_0x8cbd('0x3c')]);_0x13538c[_0x8cbd('0x3d')]=qs[_0x8cbd('0x3e')](_[_0x8cbd('0x3f')](_0x3c385a[_0x8cbd('0x34')],_0x3d9a31['filters']),_0x39aede);if(_0x3c385a[_0x8cbd('0x34')][_0x8cbd('0x40')]){_0x13538c[_0x8cbd('0x3d')]=_[_0x8cbd('0x41')](_0x13538c['where'],{'$or':_[_0x8cbd('0x2f')](_0x39aede,function(_0xf0721e){if(_0xf0721e[_0x8cbd('0x42')]!==_0x8cbd('0x43')){var _0x46e29a={};_0x46e29a[_0xf0721e[_0x8cbd('0x2c')]]={'$like':'%'+_0x3c385a[_0x8cbd('0x34')][_0x8cbd('0x40')]+'%'};return _0x46e29a;}})});}_0x13538c=_[_0x8cbd('0x41')]({},_0x13538c,_0x3c385a['options']);var _0x5c322c={'where':_0x13538c[_0x8cbd('0x3d')]};return db[_0x8cbd('0x30')][_0x8cbd('0x20')](_0x5c322c)[_0x8cbd('0x25')](function(_0x29037f){_0x48ee5d[_0x8cbd('0x20')]=_0x29037f;if(_0x3c385a[_0x8cbd('0x34')][_0x8cbd('0x44')]){_0x13538c['include']=[{'all':!![]}];}return db[_0x8cbd('0x30')][_0x8cbd('0x45')](_0x13538c);})[_0x8cbd('0x25')](function(_0x1af9ef){_0x48ee5d[_0x8cbd('0x46')]=_0x1af9ef;return _0x48ee5d;})[_0x8cbd('0x25')](respondWithFilteredResult(_0x5923d1,_0x13538c))['catch'](handleError(_0x5923d1,null));};exports[_0x8cbd('0x47')]=function(_0x153cfd,_0x4b725f){var _0x390c89={'raw':![],'where':{'id':_0x153cfd[_0x8cbd('0x48')]['id']}},_0xc9eb81={};_0xc9eb81[_0x8cbd('0x37')]=_[_0x8cbd('0x49')](db['VoicePrefix'][_0x8cbd('0x31')]);_0xc9eb81[_0x8cbd('0x34')]=_[_0x8cbd('0x49')](_0x153cfd[_0x8cbd('0x34')]);_0xc9eb81['filters']=_['intersection'](_0xc9eb81[_0x8cbd('0x37')],_0xc9eb81[_0x8cbd('0x34')]);_0x390c89['attributes']=_[_0x8cbd('0x35')](_0xc9eb81[_0x8cbd('0x37')],qs['fields'](_0x153cfd['query'][_0x8cbd('0x38')]));_0x390c89[_0x8cbd('0x36')]=_0x390c89['attributes'][_0x8cbd('0x39')]?_0x390c89[_0x8cbd('0x36')]:_0xc9eb81[_0x8cbd('0x37')];if(_0x153cfd['query'][_0x8cbd('0x44')]){_0x390c89[_0x8cbd('0x4a')]=[{'all':!![]}];}_0x390c89=_['merge']({},_0x390c89,_0x153cfd['options']);return db['VoicePrefix'][_0x8cbd('0x4b')](_0x390c89)[_0x8cbd('0x25')](handleEntityNotFound(_0x4b725f,null))[_0x8cbd('0x25')](respondWithResult(_0x4b725f,null))[_0x8cbd('0x4c')](handleError(_0x4b725f,null));};exports[_0x8cbd('0x26')]=function(_0x1ce43d,_0x1a1f3e){return db[_0x8cbd('0x30')][_0x8cbd('0x4b')]({'where':{'id':_0x1ce43d[_0x8cbd('0x48')]['id']}})[_0x8cbd('0x25')](handleEntityNotFound(_0x1a1f3e,null))[_0x8cbd('0x25')](removeEntity(_0x1a1f3e,null))[_0x8cbd('0x4c')](handleError(_0x1a1f3e,null));};exports['describe']=function(_0x53fa0e,_0x41f85c){return db[_0x8cbd('0x30')]['describe']()[_0x8cbd('0x25')](respondWithResult(_0x41f85c,null))[_0x8cbd('0x4c')](handleError(_0x41f85c,null));};exports[_0x8cbd('0x4d')]=function(_0x4dff37,_0x6ca496){var _0x583c8b;return db[_0x8cbd('0x4e')][_0x8cbd('0x4f')](function(_0x56637f){return db[_0x8cbd('0x30')][_0x8cbd('0x4d')](_0x4dff37[_0x8cbd('0x50')],{'transaction':_0x56637f})['then'](function(_0x4f90b3){_0x583c8b=_0x4f90b3['get']({'plain':!![]});return db[_0x8cbd('0x51')][_0x8cbd('0x4b')]({'where':{'id':_0x583c8b[_0x8cbd('0x52')]},'raw':!![]})[_0x8cbd('0x25')](function(_0x4b72e2){return createVoicePrefixExtensions(_0x583c8b,_0x4b72e2,_0x56637f);});});})['then'](function(){var _0x160ef8=_0x4dff37[_0x8cbd('0x53')][_0x8cbd('0x27')]({'plain':!![]});if(!_0x160ef8)throw new Error(_0x8cbd('0x54'));if(_0x160ef8[_0x8cbd('0x55')]===_0x8cbd('0x53')){var _0x1c1e73=_0x583c8b;return db[_0x8cbd('0x56')]['find']({'where':{'name':_0x8cbd('0x28'),'userProfileId':_0x160ef8[_0x8cbd('0x57')]},'raw':!![]})[_0x8cbd('0x25')](function(_0x2e842a){if(_0x2e842a&&_0x2e842a[_0x8cbd('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x1c1e73[_0x8cbd('0x2c')],'resourceId':_0x1c1e73['id'],'type':_0x2e842a['name'],'sectionId':_0x2e842a['id']},{})[_0x8cbd('0x25')](function(){return _0x583c8b;});}else{return _0x583c8b;}})[_0x8cbd('0x4c')](function(_0x3383fd){logger[_0x8cbd('0x2a')](_0x8cbd('0x59'),_0x3383fd);throw _0x3383fd;});}return _0x583c8b;})['then'](respondWithResult(_0x6ca496,null))[_0x8cbd('0x4c')](handleError(_0x6ca496,null));};function Extension(_0x231ee0,_0x5d29b6,_0xafc387,_0x2d3e75){this['context']='from-sip';this[_0x8cbd('0x5a')]=_0x231ee0;this['app']=_0xafc387;this[_0x8cbd('0x42')]=_0x8cbd('0x5b');this['description']=_0x8cbd('0x5c');this[_0x8cbd('0x5d')]=_0x5d29b6;this['appdata']=_0x2d3e75;}function createVoicePrefixExtensions(_0x3ae518,_0x41fc12,_0xa681db){return new BPromise(function(_0xab910a,_0x56e48e){var _0x1f2981=new Extension(formatPrefixName(_0x3ae518['prefix']),0x1,_0x8cbd('0x5e'),_0x8cbd('0x5f'));_0x1f2981[_0x8cbd('0x60')]=_0x3ae518['id'];return db[_0x8cbd('0x51')][_0x8cbd('0x4d')](_0x1f2981,{'transaction':_0xa681db})[_0x8cbd('0x25')](function(_0x1007e3){var _0x408a6d=_0x1007e3[_0x8cbd('0x27')]({'plain':!![]});var _0x25b6bf=_['map'](addVoicePrefixExtensions(_0x3ae518,_0x41fc12),function(_0x457666){_0x457666[_0x8cbd('0x52')]=_0x408a6d['id'];_0x457666['VoicePrefixId']=_0x3ae518['id'];return _0x457666;});return db[_0x8cbd('0x51')][_0x8cbd('0x61')](_0x25b6bf,{'transaction':_0xa681db})[_0x8cbd('0x25')](function(_0x32b7ce){if(!_0x32b7ce){return _0x56e48e(_0x8cbd('0x62'));}else{return _0xab910a(_0x32b7ce);}})['catch'](function(_0x3c34ce){return _0x56e48e(_0x3c34ce);});});;});};function addVoicePrefixExtensions(_0x4c1c57,_0x281788){var _0x777805=[];var _0x35f3c4=formatPrefixName(_0x4c1c57[_0x8cbd('0x63')]);_0x777805['push'](new Extension(_0x35f3c4,0x2,_0x8cbd('0x64'),_0x8cbd('0x65')+_0x4c1c57['name']));if(_0x4c1c57[_0x8cbd('0x66')]){_0x777805[_0x8cbd('0x67')](new Extension(_0x35f3c4,0x3,'Set',_0x8cbd('0x68')+_0x4c1c57['callerIdAll']));}else{_0x777805['push'](new Extension(_0x35f3c4,0x3,'NoOp',_0x8cbd('0x69')));}_0x777805[_0x8cbd('0x67')](new Extension(_0x35f3c4,0x4,_0x8cbd('0x6a'),_0x281788[_0x8cbd('0x6b')]+','+_0x8cbd('0x6c')+(0x8+_0x4c1c57['name']['length'])+'}'+','+0x1));return _0x777805;}function formatPrefixName(_0x502fe7){var _0x451a58='_';for(var _0x897885=0x0;_0x897885<_0x502fe7[_0x8cbd('0x39')];_0x897885++){if(_0x502fe7['charAt'](_0x897885)=='-'){_0x451a58+=_0x502fe7[_0x8cbd('0x6d')](_0x897885);}else{_0x451a58+='['+_0x502fe7[_0x8cbd('0x6d')](_0x897885)+']';}}_0x451a58+='.';return _0x451a58;}exports[_0x8cbd('0x24')]=function(_0x2f0377,_0x13f3eb,_0x4a2b37){var _0x3d12f1=_0x2f0377[_0x8cbd('0x50')];_0x3d12f1['prefix']=_0x8cbd('0x6e')+_0x3d12f1['name']+'-';return db[_0x8cbd('0x4e')][_0x8cbd('0x4f')](function(_0x29d0ac){return db[_0x8cbd('0x30')][_0x8cbd('0x24')](_0x3d12f1,{'where':{'id':_0x3d12f1['id']},'transaction':_0x29d0ac})[_0x8cbd('0x25')](function(){return db[_0x8cbd('0x51')]['destroy']({'where':{'VoicePrefixId':_0x3d12f1['id']},'transaction':_0x29d0ac})[_0x8cbd('0x25')](function(){return db[_0x8cbd('0x51')][_0x8cbd('0x4b')]({'where':{'id':_0x3d12f1['VoiceExtensionId']},'raw':!![]})['then'](function(_0x1edba4){return createVoicePrefixExtensions(_0x3d12f1,_0x1edba4,_0x29d0ac);});});});})[_0x8cbd('0x25')](function(){return db['VoicePrefix'][_0x8cbd('0x6f')](_0x3d12f1['id']);})['then'](respondWithResult(_0x13f3eb,null))[_0x8cbd('0x4c')](handleError(_0x13f3eb,null));};exports[_0x8cbd('0x70')]=function(_0x2b41b8,_0x73f8f,_0x4ee4db){return db[_0x8cbd('0x30')][_0x8cbd('0x4b')]({'where':{'id':_0x2b41b8['params']['id']}})[_0x8cbd('0x25')](handleEntityNotFound(_0x73f8f,null))[_0x8cbd('0x25')](function(_0x5aadb8){if(_0x5aadb8){return _0x5aadb8['addAgents'](_0x2b41b8[_0x8cbd('0x50')][_0x8cbd('0x71')],_[_0x8cbd('0x72')](_0x2b41b8[_0x8cbd('0x50')],[_0x8cbd('0x71'),'id'])||{})[_0x8cbd('0x73')](function(_0x3c1c6e){for(var _0x449e6b=0x0;_0x449e6b<_0x2b41b8[_0x8cbd('0x50')][_0x8cbd('0x71')][_0x8cbd('0x39')];_0x449e6b+=0x1){socket[_0x8cbd('0x74')]('userVoicePrefix:save',{'UserId':_0x2b41b8[_0x8cbd('0x50')]['ids'][_0x449e6b],'VoicePrefixId':_0x2b41b8['params']['id']});}return _0x3c1c6e;});}})[_0x8cbd('0x25')](respondWithResult(_0x73f8f,null))['catch'](handleError(_0x73f8f,null));};exports['removeAgents']=function(_0x2b482d,_0x39d455,_0x364f77){return db['VoicePrefix'][_0x8cbd('0x4b')]({'where':{'id':_0x2b482d[_0x8cbd('0x48')]['id']}})['then'](handleEntityNotFound(_0x39d455,null))[_0x8cbd('0x25')](function(_0x180f63){if(_0x180f63){return _0x180f63[_0x8cbd('0x75')](_0x2b482d['query'][_0x8cbd('0x71')])[_0x8cbd('0x25')](function(){if(_[_0x8cbd('0x76')](_0x2b482d[_0x8cbd('0x34')][_0x8cbd('0x71')])){for(var _0x47b7e1=0x0;_0x47b7e1<_0x2b482d[_0x8cbd('0x34')]['ids'][_0x8cbd('0x39')];_0x47b7e1+=0x1){socket[_0x8cbd('0x74')](_0x8cbd('0x77'),{'UserId':Number(_0x2b482d['query'][_0x8cbd('0x71')][_0x47b7e1]),'VoicePrefixId':Number(_0x2b482d[_0x8cbd('0x48')]['id'])});}}else{socket['emit'](_0x8cbd('0x77'),{'UserId':Number(_0x2b482d[_0x8cbd('0x34')][_0x8cbd('0x71')]),'VoicePrefixId':Number(_0x2b482d[_0x8cbd('0x48')]['id'])});}});}})[_0x8cbd('0x25')](respondWithStatusCode(_0x39d455,null))['catch'](handleError(_0x39d455,null));};exports[_0x8cbd('0x78')]=function(_0x212e63,_0x46e3d4,_0x452585){var _0x8764de={};var _0x5e32a9={};var _0x4827fc;var _0x3ff7b1;return db['VoicePrefix'][_0x8cbd('0x79')]({'where':{'id':_0x212e63['params']['id']}})[_0x8cbd('0x25')](handleEntityNotFound(_0x46e3d4,null))[_0x8cbd('0x25')](function(_0xcd82b9){if(_0xcd82b9){_0x4827fc=_0xcd82b9;_0x5e32a9[_0x8cbd('0x37')]=_['keys'](db[_0x8cbd('0x7a')][_0x8cbd('0x31')]);_0x5e32a9[_0x8cbd('0x34')]=_[_0x8cbd('0x49')](_0x212e63[_0x8cbd('0x34')]);_0x5e32a9['filters']=_[_0x8cbd('0x35')](_0x5e32a9['model'],_0x5e32a9[_0x8cbd('0x34')]);_0x8764de[_0x8cbd('0x36')]=_[_0x8cbd('0x35')](_0x5e32a9[_0x8cbd('0x37')],qs[_0x8cbd('0x38')](_0x212e63[_0x8cbd('0x34')][_0x8cbd('0x38')]));_0x8764de['attributes']=_0x8764de[_0x8cbd('0x36')][_0x8cbd('0x39')]?_0x8764de[_0x8cbd('0x36')]:_0x5e32a9[_0x8cbd('0x37')];_0x8764de[_0x8cbd('0x3b')]=qs[_0x8cbd('0x3c')](_0x212e63[_0x8cbd('0x34')][_0x8cbd('0x3c')]);_0x8764de[_0x8cbd('0x3d')]=qs[_0x8cbd('0x3e')](_[_0x8cbd('0x3f')](_0x212e63[_0x8cbd('0x34')],_0x5e32a9[_0x8cbd('0x3e')]));if(_0x212e63[_0x8cbd('0x34')][_0x8cbd('0x40')]){_0x8764de[_0x8cbd('0x3d')]=_[_0x8cbd('0x41')](_0x8764de[_0x8cbd('0x3d')],{'$or':_[_0x8cbd('0x2f')](_0x8764de['attributes'],function(_0x2b6564){var _0x40e693={};_0x40e693[_0x2b6564]={'$like':'%'+_0x212e63[_0x8cbd('0x34')][_0x8cbd('0x40')]+'%'};return _0x40e693;})});}_0x8764de=_[_0x8cbd('0x41')]({},_0x8764de,_0x212e63['options']);return _0x4827fc[_0x8cbd('0x78')](_0x8764de);}})[_0x8cbd('0x25')](function(_0xee2a37){if(_0xee2a37){_0x3ff7b1=_0xee2a37[_0x8cbd('0x39')];if(!_0x212e63[_0x8cbd('0x34')][_0x8cbd('0x7b')](_0x8cbd('0x7c'))){_0x8764de[_0x8cbd('0x3a')]=qs[_0x8cbd('0x3a')](_0x212e63[_0x8cbd('0x34')][_0x8cbd('0x3a')]);_0x8764de[_0x8cbd('0x21')]=qs['offset'](_0x212e63[_0x8cbd('0x34')]['offset']);}return _0x4827fc[_0x8cbd('0x78')](_0x8764de);}})[_0x8cbd('0x25')](function(_0x307465){if(_0x307465){return _0x307465?{'count':_0x3ff7b1,'rows':_0x307465}:null;}})[_0x8cbd('0x25')](respondWithResult(_0x46e3d4,null))[_0x8cbd('0x4c')](handleError(_0x46e3d4,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6279487..53ca92e 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x34e8,0x12c));var _0x834e=function(_0x30648d,_0xadf5bc){_0x30648d=_0x30648d-0x0;var _0x126604=_0x34e8[_0x30648d];return _0x126604;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x257544,_0x524c55){var _0x589d7d=function(_0x120396){while(--_0x120396){_0x257544['push'](_0x257544['shift']());}};_0x589d7d(++_0x524c55);}(_0x70e0,0x17b));var _0x070e=function(_0x2b4030,_0x3d69e3){_0x2b4030=_0x2b4030-0x0;var _0x218e34=_0x70e0[_0x2b4030];return _0x218e34;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 951d6b4..aaedbce 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 _0xa87e=['exports','define','voice_prefixes','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voicePrefix.attributes'];(function(_0x4e2719,_0x5d1bcc){var _0x595ded=function(_0x1c5c28){while(--_0x1c5c28){_0x4e2719['push'](_0x4e2719['shift']());}};_0x595ded(++_0x5d1bcc);}(_0xa87e,0x1bf));var _0xea87=function(_0xeef37f,_0x28a6b8){_0xeef37f=_0xeef37f-0x0;var _0x5d666a=_0xa87e[_0xeef37f];return _0x5d666a;};'use strict';var _=require(_0xea87('0x0'));var util=require('util');var logger=require(_0xea87('0x1'))(_0xea87('0x2'));var moment=require(_0xea87('0x3'));var BPromise=require(_0xea87('0x4'));var rp=require(_0xea87('0x5'));var fs=require('fs');var path=require(_0xea87('0x6'));var rimraf=require(_0xea87('0x7'));var config=require('../../config/environment');var attributes=require(_0xea87('0x8'));module[_0xea87('0x9')]=function(_0x2a8f8f,_0x264a3d){return _0x2a8f8f[_0xea87('0xa')]('VoicePrefix',attributes,{'tableName':_0xea87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1eb3=['request-promise','path','rimraf','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x1eb3,0x1ca));var _0x31eb=function(_0x30b915,_0x50dc22){_0x30b915=_0x30b915-0x0;var _0x2cd1c9=_0x1eb3[_0x30b915];return _0x2cd1c9;};'use strict';var _=require(_0x31eb('0x0'));var util=require(_0x31eb('0x1'));var logger=require(_0x31eb('0x2'))('api');var moment=require(_0x31eb('0x3'));var BPromise=require('bluebird');var rp=require(_0x31eb('0x4'));var fs=require('fs');var path=require(_0x31eb('0x5'));var rimraf=require(_0x31eb('0x6'));var config=require('../../config/environment');var attributes=require(_0x31eb('0x7'));module[_0x31eb('0x8')]=function(_0x3db4c7,_0x1d462e){return _0x3db4c7['define'](_0x31eb('0x9'),attributes,{'tableName':_0x31eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index d42ac50..7aa7d35 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 _0x7cbc=['defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x37cd56,_0x49d747){var _0x497e08=function(_0x2deb2d){while(--_0x2deb2d){_0x37cd56['push'](_0x37cd56['shift']());}};_0x497e08(++_0x49d747);}(_0x7cbc,0xa4));var _0xc7cb=function(_0x283704,_0x522138){_0x283704=_0x283704-0x0;var _0x5f3b30=_0x7cbc[_0x283704];return _0x5f3b30;};'use strict';var _=require(_0xc7cb('0x0'));var util=require(_0xc7cb('0x1'));var moment=require(_0xc7cb('0x2'));var BPromise=require(_0xc7cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7cb('0x5'));var logger=require(_0xc7cb('0x6'))(_0xc7cb('0x7'));var config=require(_0xc7cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7cb('0x9')]['http']({'port':0x232a});config[_0xc7cb('0xa')]=_[_0xc7cb('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc7cb('0xc'))(new Redis(config[_0xc7cb('0xa')]));require(_0xc7cb('0xd'))[_0xc7cb('0xe')](socket);function respondWithRpcPromise(_0x3aa449,_0xbad7b4,_0x227a0e){return new BPromise(function(_0x10bd25,_0x87af64){return client[_0xc7cb('0xf')](_0x3aa449,_0x227a0e)[_0xc7cb('0x10')](function(_0x106c53){logger[_0xc7cb('0x11')](_0xc7cb('0x12'),_0xbad7b4,_0xc7cb('0x13'));logger[_0xc7cb('0x14')](_0xc7cb('0x15'),_0xbad7b4,_0xc7cb('0x13'),JSON['stringify'](_0x106c53));if(_0x106c53[_0xc7cb('0x16')]){if(_0x106c53[_0xc7cb('0x16')][_0xc7cb('0x17')]===0x1f4){logger[_0xc7cb('0x16')](_0xc7cb('0x12'),_0xbad7b4,_0x106c53[_0xc7cb('0x16')][_0xc7cb('0x18')]);return _0x87af64(_0x106c53[_0xc7cb('0x16')]['message']);}logger[_0xc7cb('0x16')](_0xc7cb('0x12'),_0xbad7b4,_0x106c53[_0xc7cb('0x16')][_0xc7cb('0x18')]);return _0x10bd25(_0x106c53[_0xc7cb('0x16')][_0xc7cb('0x18')]);}else{logger[_0xc7cb('0x11')]('VoicePrefix,\x20%s,\x20%s',_0xbad7b4,_0xc7cb('0x13'));_0x10bd25(_0x106c53['result'][_0xc7cb('0x18')]);}})['catch'](function(_0x2f8aec){logger[_0xc7cb('0x16')](_0xc7cb('0x12'),_0xbad7b4,_0x2f8aec);_0x87af64(_0x2f8aec);});});} \ No newline at end of file +var _0x16c1=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x185e11,_0x115fd9){var _0x49ea27=function(_0x58aa58){while(--_0x58aa58){_0x185e11['push'](_0x185e11['shift']());}};_0x49ea27(++_0x115fd9);}(_0x16c1,0x109));var _0x116c=function(_0x184901,_0x5a5dba){_0x184901=_0x184901-0x0;var _0x45f8a2=_0x16c1[_0x184901];return _0x45f8a2;};'use strict';var _=require(_0x116c('0x0'));var util=require(_0x116c('0x1'));var moment=require('moment');var BPromise=require(_0x116c('0x2'));var rs=require(_0x116c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x116c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x116c('0x5'));var jayson=require(_0x116c('0x6'));var client=jayson[_0x116c('0x7')][_0x116c('0x8')]({'port':0x232a});config[_0x116c('0x9')]=_[_0x116c('0xa')](config[_0x116c('0x9')],{'host':_0x116c('0xb'),'port':0x18eb});var socket=require(_0x116c('0xc'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x116c('0xd')](socket);function respondWithRpcPromise(_0x42d1ae,_0x59fa72,_0x4cf34c){return new BPromise(function(_0x510eb4,_0x5bd34d){return client[_0x116c('0xe')](_0x42d1ae,_0x4cf34c)[_0x116c('0xf')](function(_0x25a367){logger['info'](_0x116c('0x10'),_0x59fa72,_0x116c('0x11'));logger[_0x116c('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x59fa72,_0x116c('0x11'),JSON[_0x116c('0x13')](_0x25a367));if(_0x25a367[_0x116c('0x14')]){if(_0x25a367[_0x116c('0x14')]['code']===0x1f4){logger[_0x116c('0x14')](_0x116c('0x10'),_0x59fa72,_0x25a367[_0x116c('0x14')][_0x116c('0x15')]);return _0x5bd34d(_0x25a367[_0x116c('0x14')][_0x116c('0x15')]);}logger['error'](_0x116c('0x10'),_0x59fa72,_0x25a367[_0x116c('0x14')]['message']);return _0x510eb4(_0x25a367[_0x116c('0x14')][_0x116c('0x15')]);}else{logger['info'](_0x116c('0x10'),_0x59fa72,_0x116c('0x11'));_0x510eb4(_0x25a367[_0x116c('0x16')][_0x116c('0x15')]);}})[_0x116c('0x17')](function(_0x4acb10){logger[_0x116c('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x59fa72,_0x4acb10);_0x5bd34d(_0x4acb10);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 01de5f7..9abc9bc 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 _0xb935=['remove','update','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x625a73,_0x50ae08){var _0x3eceb5=function(_0x9e9500){while(--_0x9e9500){_0x625a73['push'](_0x625a73['shift']());}};_0x3eceb5(++_0x50ae08);}(_0xb935,0x16e));var _0x5b93=function(_0x35e834,_0x2c2a20){_0x35e834=_0x35e834-0x0;var _0x2f6d8a=_0xb935[_0x35e834];return _0x2f6d8a;};'use strict';var VoicePrefixEvents=require(_0x5b93('0x0'));var events=[_0x5b93('0x1'),_0x5b93('0x2'),_0x5b93('0x3')];function createListener(_0x4de0b2,_0x57e4fa){return function(_0x23873b){_0x57e4fa['emit'](_0x4de0b2,_0x23873b);};}function removeListener(_0x3c9880,_0x15631b){return function(){VoicePrefixEvents[_0x5b93('0x4')](_0x3c9880,_0x15631b);};}exports[_0x5b93('0x5')]=function(_0x352e2d){for(var _0x44518a=0x0,_0x91c521=events[_0x5b93('0x6')];_0x44518a<_0x91c521;_0x44518a++){var _0x295504=events[_0x44518a];var _0xe7698=createListener(_0x5b93('0x7')+_0x295504,_0x352e2d);VoicePrefixEvents['on'](_0x295504,_0xe7698);}}; \ No newline at end of file +var _0xca3f=['removeListener','register','length','voicePrefix:','./voicePrefix.events','update','emit'];(function(_0xded0ea,_0x50b8f3){var _0xe85630=function(_0x4da760){while(--_0x4da760){_0xded0ea['push'](_0xded0ea['shift']());}};_0xe85630(++_0x50b8f3);}(_0xca3f,0x123));var _0xfca3=function(_0x458837,_0x5ca8af){_0x458837=_0x458837-0x0;var _0x2d4c57=_0xca3f[_0x458837];return _0x2d4c57;};'use strict';var VoicePrefixEvents=require(_0xfca3('0x0'));var events=['save','remove',_0xfca3('0x1')];function createListener(_0x4856b5,_0x5536b3){return function(_0x278cb6){_0x5536b3[_0xfca3('0x2')](_0x4856b5,_0x278cb6);};}function removeListener(_0x318663,_0x2d4cdc){return function(){VoicePrefixEvents[_0xfca3('0x3')](_0x318663,_0x2d4cdc);};}exports[_0xfca3('0x4')]=function(_0x10ae94){for(var _0x3cd495=0x0,_0x486f30=events[_0xfca3('0x5')];_0x3cd495<_0x486f30;_0x3cd495++){var _0x322f3e=events[_0x3cd495];var _0x4d99c1=createListener(_0xfca3('0x6')+_0x322f3e,_0x10ae94);VoicePrefixEvents['on'](_0x322f3e,_0x4d99c1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f69f941..6662db7 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 _0x19f9=['/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','/:id/blacklists','addBlackLists','update','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x19f9,0x9f));var _0x919f=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x19f9[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x919f('0x0'));var util=require(_0x919f('0x1'));var path=require(_0x919f('0x2'));var timeout=require(_0x919f('0x3'));var express=require(_0x919f('0x4'));var router=express[_0x919f('0x5')]();var auth=require(_0x919f('0x6'));var interaction=require(_0x919f('0x7'));var config=require('../../config/environment');var controller=require(_0x919f('0x8'));router['get']('/',auth[_0x919f('0x9')](),controller[_0x919f('0xa')]);router[_0x919f('0xb')](_0x919f('0xc'),auth[_0x919f('0x9')](),controller[_0x919f('0xd')]);router[_0x919f('0xb')](_0x919f('0xe'),auth['isAuthenticated'](),controller[_0x919f('0xf')]);router[_0x919f('0xb')](_0x919f('0x10'),auth[_0x919f('0x9')](),controller['getHopperHistories']);router[_0x919f('0xb')](_0x919f('0x11'),auth[_0x919f('0x9')](),controller[_0x919f('0x12')]);router[_0x919f('0xb')]('/:id/hopper_black',auth[_0x919f('0x9')](),controller[_0x919f('0x13')]);router[_0x919f('0xb')](_0x919f('0x14'),auth[_0x919f('0x9')](),controller[_0x919f('0x15')]);router[_0x919f('0xb')](_0x919f('0x16'),auth[_0x919f('0x9')](),controller[_0x919f('0x17')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x919f('0x18')]);router['get'](_0x919f('0x19'),auth['isAuthenticated'](),controller[_0x919f('0x1a')]);router[_0x919f('0xb')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x919f('0x1b')]);router[_0x919f('0x1c')]('/',auth[_0x919f('0x9')](),controller[_0x919f('0x1d')]);router[_0x919f('0x1c')](_0x919f('0x1e'),auth[_0x919f('0x9')](),controller[_0x919f('0x1f')]);router[_0x919f('0x1c')](_0x919f('0x14'),auth['isAuthenticated'](),controller[_0x919f('0x20')]);router['post']('/:id/users',auth[_0x919f('0x9')](),controller[_0x919f('0x21')]);router['post'](_0x919f('0x19'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0x919f('0x22'),auth[_0x919f('0x9')](),controller[_0x919f('0x23')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x919f('0x24')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x919f('0x25')]);router[_0x919f('0x26')]('/:id/teams',auth[_0x919f('0x9')](),controller[_0x919f('0x27')]);router[_0x919f('0x26')](_0x919f('0x16'),auth[_0x919f('0x9')](),controller[_0x919f('0x28')]);router[_0x919f('0x26')](_0x919f('0x19'),auth[_0x919f('0x9')](),controller[_0x919f('0x29')]);router[_0x919f('0x26')](_0x919f('0x22'),auth[_0x919f('0x9')](),controller[_0x919f('0x2a')]);module[_0x919f('0x2b')]=router; \ No newline at end of file +var _0x3ef0=['../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','/:id/users','/:id/lists','addLists','addBlackLists','put','update','delete','/:id','destroy','removeTeams','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x38302e,_0x312a11){var _0x17a195=function(_0x1a5f1d){while(--_0x1a5f1d){_0x38302e['push'](_0x38302e['shift']());}};_0x17a195(++_0x312a11);}(_0x3ef0,0x1d2));var _0x03ef=function(_0x53f06a,_0x5eebe8){_0x53f06a=_0x53f06a-0x0;var _0x33d4eb=_0x3ef0[_0x53f06a];return _0x33d4eb;};'use strict';var multer=require(_0x03ef('0x0'));var util=require(_0x03ef('0x1'));var path=require(_0x03ef('0x2'));var timeout=require(_0x03ef('0x3'));var express=require('express');var router=express[_0x03ef('0x4')]();var auth=require(_0x03ef('0x5'));var interaction=require(_0x03ef('0x6'));var config=require(_0x03ef('0x7'));var controller=require(_0x03ef('0x8'));router[_0x03ef('0x9')]('/',auth[_0x03ef('0xa')](),controller[_0x03ef('0xb')]);router[_0x03ef('0x9')]('/:id',auth[_0x03ef('0xa')](),controller[_0x03ef('0xc')]);router[_0x03ef('0x9')](_0x03ef('0xd'),auth[_0x03ef('0xa')](),controller['getHoppers']);router[_0x03ef('0x9')](_0x03ef('0xe'),auth[_0x03ef('0xa')](),controller[_0x03ef('0xf')]);router['get'](_0x03ef('0x10'),auth[_0x03ef('0xa')](),controller[_0x03ef('0x11')]);router[_0x03ef('0x9')](_0x03ef('0x12'),auth['isAuthenticated'](),controller[_0x03ef('0x13')]);router[_0x03ef('0x9')](_0x03ef('0x14'),auth[_0x03ef('0xa')](),controller[_0x03ef('0x15')]);router[_0x03ef('0x9')]('/:id/users',auth[_0x03ef('0xa')](),controller[_0x03ef('0x16')]);router[_0x03ef('0x9')]('/:id/members',auth[_0x03ef('0xa')](),controller['getMembers']);router['get']('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x03ef('0x9')](_0x03ef('0x17'),auth['isAuthenticated'](),controller[_0x03ef('0x18')]);router[_0x03ef('0x19')]('/',auth[_0x03ef('0xa')](),controller[_0x03ef('0x1a')]);router[_0x03ef('0x19')](_0x03ef('0x1b'),auth['isAuthenticated'](),controller[_0x03ef('0x1c')]);router[_0x03ef('0x19')](_0x03ef('0x14'),auth[_0x03ef('0xa')](),controller[_0x03ef('0x1d')]);router[_0x03ef('0x19')](_0x03ef('0x1e'),auth[_0x03ef('0xa')](),controller['addAgents']);router[_0x03ef('0x19')](_0x03ef('0x1f'),auth[_0x03ef('0xa')](),controller[_0x03ef('0x20')]);router[_0x03ef('0x19')](_0x03ef('0x17'),auth[_0x03ef('0xa')](),controller[_0x03ef('0x21')]);router[_0x03ef('0x22')]('/:id',auth[_0x03ef('0xa')](),controller[_0x03ef('0x23')]);router[_0x03ef('0x24')](_0x03ef('0x25'),auth[_0x03ef('0xa')](),controller[_0x03ef('0x26')]);router['delete'](_0x03ef('0x14'),auth['isAuthenticated'](),controller[_0x03ef('0x27')]);router[_0x03ef('0x24')](_0x03ef('0x1e'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x03ef('0x24')](_0x03ef('0x1f'),auth[_0x03ef('0xa')](),controller[_0x03ef('0x28')]);router[_0x03ef('0x24')](_0x03ef('0x17'),auth[_0x03ef('0xa')](),controller[_0x03ef('0x29')]);module[_0x03ef('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b33a215..46eca05 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(_0x179314,_0x32d3a2){var _0x3556f7=function(_0x16244e){while(--_0x16244e){_0x179314['push'](_0x179314['shift']());}};_0x3556f7(++_0x32d3a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0xf10ab2,_0x4139fa){var _0x4c6629=function(_0x1be701){while(--_0x1be701){_0xf10ab2['push'](_0xf10ab2['shift']());}};_0x4c6629(++_0x4139fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 209e945..c5da39e 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 _0xcc89=['ListId','select','scheduledAt','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','into','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','get','outbound','map','includes','type','find','value','name','UserProfileResource','destroy','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','inbound','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','omit','createdAt','updatedAt','CmHopper','VoiceQueueId','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','online','voicePause','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','interface','userVoiceQueue:save','removeTeams','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','isEmpty','addAgents','spread','emit','isNil','SIP/%s','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ContactId'];(function(_0x201c29,_0x40bb8b){var _0x3d587f=function(_0x5f4f16){while(--_0x5f4f16){_0x201c29['push'](_0x201c29['shift']());}};_0x3d587f(++_0x40bb8b);}(_0xcc89,0x17b));var _0x9cc8=function(_0x4f208b,_0x3c3f19){_0x4f208b=_0x4f208b-0x0;var _0x2b0d40=_0xcc89[_0x4f208b];return _0x2b0d40;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9cc8('0x0'));var rimraf=require(_0x9cc8('0x1'));var zipdir=require(_0x9cc8('0x2'));var jsonpatch=require(_0x9cc8('0x3'));var rp=require(_0x9cc8('0x4'));var moment=require(_0x9cc8('0x5'));var BPromise=require(_0x9cc8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9cc8('0x7'));var csv=require(_0x9cc8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cc8('0x9'));var squel=require(_0x9cc8('0xa'));var crypto=require(_0x9cc8('0xb'));var jsforce=require(_0x9cc8('0xc'));var deskjs=require(_0x9cc8('0xd'));var toCsv=require(_0x9cc8('0x8'));var querystring=require(_0x9cc8('0xe'));var Papa=require(_0x9cc8('0xf'));var Redis=require(_0x9cc8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9cc8('0x11'));var as=require(_0x9cc8('0x12'));var hardwareService=require(_0x9cc8('0x13'));var logger=require(_0x9cc8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9cc8('0x15'));var db=require('../../mysqldb')['db'];config[_0x9cc8('0x16')]=_[_0x9cc8('0x17')](config[_0x9cc8('0x16')],{'host':_0x9cc8('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9cc8('0x19'))[_0x9cc8('0x1a')](socket);function respondWithStatusCode(_0x44a6fe,_0x4effc7){_0x4effc7=_0x4effc7||0xcc;return function(_0x23072b){if(_0x23072b){return _0x44a6fe[_0x9cc8('0x1b')](_0x4effc7);}return _0x44a6fe[_0x9cc8('0x1c')](_0x4effc7)[_0x9cc8('0x1d')]();};}function respondWithResult(_0x44506d,_0x1e6f99){_0x1e6f99=_0x1e6f99||0xc8;return function(_0x59e742){if(_0x59e742){return _0x44506d[_0x9cc8('0x1c')](_0x1e6f99)[_0x9cc8('0x1e')](_0x59e742);}};}function respondWithFilteredResult(_0x37e0da,_0x238086){return function(_0x3a0e6d){if(_0x3a0e6d){var _0x4b6e9c=_0x3a0e6d[_0x9cc8('0x1f')],_0x4d7927=_0x238086[_0x9cc8('0x20')],_0x3e1fc0=_0x238086[_0x9cc8('0x20')]+_0x238086[_0x9cc8('0x21')],_0x979e89;if(_0x3e1fc0>=_0x4b6e9c){_0x3e1fc0=_0x4b6e9c;_0x979e89=0xc8;}else{_0x979e89=0xce;}_0x37e0da[_0x9cc8('0x1c')](_0x979e89);return _0x37e0da['set'](_0x9cc8('0x22'),_0x4d7927+'-'+_0x3e1fc0+'/'+_0x4b6e9c)[_0x9cc8('0x1e')](_0x3a0e6d);}return null;};}function patchUpdates(_0x4da9ff){return function(_0x55ef37){try{jsonpatch[_0x9cc8('0x23')](_0x55ef37,_0x4da9ff,!![]);}catch(_0x36579d){return BPromise[_0x9cc8('0x24')](_0x36579d);}return _0x55ef37['save']();};}function saveUpdates(_0x3b2aee,_0x5139b){return function(_0xa5384a){if(_0xa5384a){return _0xa5384a[_0x9cc8('0x25')](_0x3b2aee)['then'](function(_0x3cea56){return _0x3cea56;});}return null;};}function removeEntity(_0x264363,_0x5cacb0){return function(_0x29c607){if(_0x29c607){return _0x29c607['destroy']()[_0x9cc8('0x26')](function(){var _0x1043c4=_0x29c607[_0x9cc8('0x27')]({'plain':!![]});var _0x372b81=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x9cc8('0x28'),'ignore':![]}];var _0x2bacf5=_(_0x372b81)['filter']('ignore')[_0x9cc8('0x29')]('value')['value']();if(_[_0x9cc8('0x2a')](_0x2bacf5,_0x1043c4[_0x9cc8('0x2b')])){return;}var _0x1c578c=_[_0x9cc8('0x2c')](_0x372b81,[_0x9cc8('0x2d'),_0x1043c4[_0x9cc8('0x2b')]])[_0x9cc8('0x2e')];return db[_0x9cc8('0x2f')][_0x9cc8('0x30')]({'where':{'type':_0x1c578c,'resourceId':_0x1043c4['id']}})[_0x9cc8('0x26')](function(){return _0x29c607;});})['then'](function(){_0x264363[_0x9cc8('0x1c')](0xcc)[_0x9cc8('0x1d')]();});}};}function handleEntityNotFound(_0x2e10a9,_0x5d7be7){return function(_0x5a9218){if(!_0x5a9218){_0x2e10a9['sendStatus'](0x194);}return _0x5a9218;};}function handleError(_0x38b801,_0x4eda8b){_0x4eda8b=_0x4eda8b||0x1f4;return function(_0x208c79){logger[_0x9cc8('0x31')](_0x208c79[_0x9cc8('0x32')]);if(_0x208c79[_0x9cc8('0x2e')]){delete _0x208c79[_0x9cc8('0x2e')];}_0x38b801[_0x9cc8('0x1c')](_0x4eda8b)[_0x9cc8('0x33')](_0x208c79);};}exports[_0x9cc8('0x34')]=function(_0x3a9557,_0x13e2f9){var _0x4adbb3={},_0x23a778={},_0x587cb0={'count':0x0,'rows':[]};var _0x3090ec=_[_0x9cc8('0x29')](db[_0x9cc8('0x35')][_0x9cc8('0x36')],function(_0x3a45ca){return{'name':_0x3a45ca[_0x9cc8('0x37')],'type':_0x3a45ca[_0x9cc8('0x2b')][_0x9cc8('0x38')]};});_0x23a778['model']=_[_0x9cc8('0x29')](_0x3090ec,_0x9cc8('0x2e'));_0x23a778[_0x9cc8('0x39')]=_[_0x9cc8('0x3a')](_0x3a9557['query']);_0x23a778[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x23a778['model'],_0x23a778[_0x9cc8('0x39')]);_0x4adbb3['attributes']=_[_0x9cc8('0x3c')](_0x23a778[_0x9cc8('0x3d')],qs['fields'](_0x3a9557[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0x4adbb3[_0x9cc8('0x3f')]=_0x4adbb3[_0x9cc8('0x3f')][_0x9cc8('0x40')]?_0x4adbb3['attributes']:_0x23a778[_0x9cc8('0x3d')];if(!_0x3a9557[_0x9cc8('0x39')][_0x9cc8('0x41')](_0x9cc8('0x42'))){_0x4adbb3[_0x9cc8('0x21')]=qs[_0x9cc8('0x21')](_0x3a9557[_0x9cc8('0x39')]['limit']);_0x4adbb3[_0x9cc8('0x20')]=qs[_0x9cc8('0x20')](_0x3a9557['query'][_0x9cc8('0x20')]);}_0x4adbb3[_0x9cc8('0x43')]=qs['sort'](_0x3a9557[_0x9cc8('0x39')][_0x9cc8('0x44')]);_0x4adbb3[_0x9cc8('0x45')]=qs[_0x9cc8('0x3b')](_[_0x9cc8('0x46')](_0x3a9557['query'],_0x23a778['filters']),_0x3090ec);if(_0x3a9557[_0x9cc8('0x39')][_0x9cc8('0x47')]){_0x4adbb3['where']=_[_0x9cc8('0x48')](_0x4adbb3[_0x9cc8('0x45')],{'$or':_[_0x9cc8('0x29')](_0x3090ec,function(_0x192954){if(_0x192954['type']!==_0x9cc8('0x49')){var _0x1cf2dc={};_0x1cf2dc[_0x192954[_0x9cc8('0x2e')]]={'$like':'%'+_0x3a9557['query'][_0x9cc8('0x47')]+'%'};return _0x1cf2dc;}})});}_0x4adbb3=_[_0x9cc8('0x48')]({},_0x4adbb3,_0x3a9557[_0x9cc8('0x4a')]);var _0x5df91b={'where':_0x4adbb3[_0x9cc8('0x45')]};return db['VoiceQueue']['count'](_0x5df91b)['then'](function(_0xacb8d0){_0x587cb0[_0x9cc8('0x1f')]=_0xacb8d0;if(_0x3a9557[_0x9cc8('0x39')][_0x9cc8('0x4b')]){_0x4adbb3['include']=[{'all':!![]}];}return db[_0x9cc8('0x35')][_0x9cc8('0x4c')](_0x4adbb3);})[_0x9cc8('0x26')](function(_0x169059){_0x587cb0[_0x9cc8('0x4d')]=_0x169059;return _0x587cb0;})[_0x9cc8('0x26')](respondWithFilteredResult(_0x13e2f9,_0x4adbb3))[_0x9cc8('0x4e')](handleError(_0x13e2f9,null));};exports[_0x9cc8('0x4f')]=function(_0x1a32cf,_0x9d5ac7){var _0x165a70={'raw':![],'where':{'id':_0x1a32cf['params']['id']}},_0x536ea6={};_0x536ea6[_0x9cc8('0x3d')]=_[_0x9cc8('0x3a')](db[_0x9cc8('0x35')][_0x9cc8('0x36')]);_0x536ea6['query']=_[_0x9cc8('0x3a')](_0x1a32cf[_0x9cc8('0x39')]);_0x536ea6[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x536ea6[_0x9cc8('0x3d')],_0x536ea6[_0x9cc8('0x39')]);_0x165a70['attributes']=_[_0x9cc8('0x3c')](_0x536ea6[_0x9cc8('0x3d')],qs['fields'](_0x1a32cf[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0x165a70[_0x9cc8('0x3f')]=_0x165a70[_0x9cc8('0x3f')][_0x9cc8('0x40')]?_0x165a70[_0x9cc8('0x3f')]:_0x536ea6[_0x9cc8('0x3d')];if(_0x1a32cf['query']['includeAll']){_0x165a70['include']=[{'all':!![]}];}_0x165a70=_[_0x9cc8('0x48')]({},_0x165a70,_0x1a32cf[_0x9cc8('0x4a')]);return db[_0x9cc8('0x35')]['find'](_0x165a70)[_0x9cc8('0x26')](handleEntityNotFound(_0x9d5ac7,null))[_0x9cc8('0x26')](respondWithResult(_0x9d5ac7,null))[_0x9cc8('0x4e')](handleError(_0x9d5ac7,null));};exports[_0x9cc8('0x50')]=function(_0x37c253,_0x5a3aed){return db[_0x9cc8('0x35')][_0x9cc8('0x50')](_0x37c253[_0x9cc8('0x51')],{})[_0x9cc8('0x26')](function(_0x2e9777){var _0x556b74=_0x37c253[_0x9cc8('0x52')][_0x9cc8('0x27')]({'plain':!![]});if(!_0x556b74)throw new Error(_0x9cc8('0x53'));if(_0x556b74[_0x9cc8('0x54')]==='user'){var _0x594e3c=_0x2e9777[_0x9cc8('0x27')]({'plain':!![]});var _0x46c27e=[{'name':_0x9cc8('0x55'),'value':_0x9cc8('0x56')},{'name':_0x9cc8('0x57'),'value':'outbound'}];var _0x435f91=_[_0x9cc8('0x2c')](_0x46c27e,[_0x9cc8('0x2d'),_0x594e3c['type']])[_0x9cc8('0x2e')];return db[_0x9cc8('0x58')][_0x9cc8('0x2c')]({'where':{'name':_0x435f91,'userProfileId':_0x556b74[_0x9cc8('0x59')]},'raw':!![]})[_0x9cc8('0x26')](function(_0x496043){if(_0x496043&&_0x496043[_0x9cc8('0x5a')]===0x0){return db['UserProfileResource'][_0x9cc8('0x50')]({'name':_0x594e3c[_0x9cc8('0x2e')],'resourceId':_0x594e3c['id'],'type':_0x496043['name'],'sectionId':_0x496043['id']},{})[_0x9cc8('0x26')](function(){return _0x2e9777;});}else{return _0x2e9777;}})[_0x9cc8('0x4e')](function(_0x56c3e1){logger[_0x9cc8('0x31')](_0x9cc8('0x5b'),_0x56c3e1);throw _0x56c3e1;});}return _0x2e9777;})['then'](respondWithResult(_0x5a3aed,0xc9))[_0x9cc8('0x4e')](handleError(_0x5a3aed,null));};exports[_0x9cc8('0x5c')]=function(_0x1c0473,_0x2a0d93){var _0xb1851f={'where':{'id':_0x1c0473[_0x9cc8('0x5d')]['id']}},_0x514fdd={};_0x514fdd[_0x9cc8('0x3d')]=_[_0x9cc8('0x3a')](db[_0x9cc8('0x35')][_0x9cc8('0x36')]);_0xb1851f[_0x9cc8('0x3f')]=_['intersection'](_0x514fdd[_0x9cc8('0x3d')],qs[_0x9cc8('0x3e')](_0x1c0473[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0xb1851f[_0x9cc8('0x3f')]=_0xb1851f[_0x9cc8('0x3f')]['length']?_0xb1851f[_0x9cc8('0x3f')]:_0x514fdd[_0x9cc8('0x3d')];if(_0x1c0473[_0x9cc8('0x39')][_0x9cc8('0x4b')]){_0xb1851f[_0x9cc8('0x5e')]=[{'all':!![]}];}_0xb1851f=_['merge']({},_0xb1851f,_0x1c0473[_0x9cc8('0x4a')]);return db[_0x9cc8('0x35')][_0x9cc8('0x2c')](_0xb1851f)[_0x9cc8('0x26')](handleEntityNotFound(_0x2a0d93,null))[_0x9cc8('0x26')](function(_0x5e4526){if(_0x5e4526){var _0x52c672=_0x5e4526[_0x9cc8('0x27')]({'plain':!![]});_0x52c672=qs[_0x9cc8('0x5f')](_0x52c672,['id',_0x9cc8('0x60'),_0x9cc8('0x61')]);_0x1c0473[_0x9cc8('0x51')]=_['omit'](_0x1c0473[_0x9cc8('0x51')],['id',_0x9cc8('0x60'),_0x9cc8('0x61')]);return db[_0x9cc8('0x35')][_0x9cc8('0x50')](_[_0x9cc8('0x48')](_0x52c672,_0x1c0473[_0x9cc8('0x51')]),{'include':_0x1c0473[_0x9cc8('0x39')][_0x9cc8('0x4b')]?[{'all':!![]}]:undefined})[_0x9cc8('0x26')](function(_0x1f9a07){var _0x2aae2c=_0x1c0473['user'][_0x9cc8('0x27')]({'plain':!![]});if(!_0x2aae2c)throw new Error(_0x9cc8('0x53'));if(_0x2aae2c['role']===_0x9cc8('0x52')){var _0x723d10=_0x1f9a07[_0x9cc8('0x27')]({'plain':!![]});var _0x4a109e=[{'name':_0x9cc8('0x55'),'value':_0x9cc8('0x56')},{'name':_0x9cc8('0x57'),'value':_0x9cc8('0x28')}];var _0x26f204=_[_0x9cc8('0x2c')](_0x4a109e,['value',_0x723d10[_0x9cc8('0x2b')]])[_0x9cc8('0x2e')];return db['UserProfileSection'][_0x9cc8('0x2c')]({'where':{'name':_0x26f204,'userProfileId':_0x2aae2c[_0x9cc8('0x59')]},'raw':!![]})[_0x9cc8('0x26')](function(_0x1a6aa1){if(_0x1a6aa1&&_0x1a6aa1[_0x9cc8('0x5a')]===0x0){return db['UserProfileResource'][_0x9cc8('0x50')]({'name':_0x723d10['name'],'resourceId':_0x723d10['id'],'type':_0x1a6aa1[_0x9cc8('0x2e')],'sectionId':_0x1a6aa1['id']},{})[_0x9cc8('0x26')](function(){return _0x1f9a07;});}else{return _0x1f9a07;}})[_0x9cc8('0x4e')](function(_0x59db93){logger[_0x9cc8('0x31')](_0x9cc8('0x5b'),_0x59db93);throw _0x59db93;});}return _0x1f9a07;});}})[_0x9cc8('0x26')](respondWithResult(_0x2a0d93,0xc9))[_0x9cc8('0x4e')](handleError(_0x2a0d93,null));};exports['update']=function(_0xf4b9cd,_0x52c0e4){if(_0xf4b9cd[_0x9cc8('0x51')]['id']){delete _0xf4b9cd[_0x9cc8('0x51')]['id'];}return db[_0x9cc8('0x35')]['find']({'where':{'id':_0xf4b9cd[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x52c0e4,null))[_0x9cc8('0x26')](saveUpdates(_0xf4b9cd['body'],null))[_0x9cc8('0x26')](respondWithResult(_0x52c0e4,null))[_0x9cc8('0x4e')](handleError(_0x52c0e4,null));};exports['destroy']=function(_0x11b2a8,_0x21b0d9){return db[_0x9cc8('0x35')]['find']({'where':{'id':_0x11b2a8[_0x9cc8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x21b0d9,null))[_0x9cc8('0x26')](removeEntity(_0x21b0d9,null))[_0x9cc8('0x4e')](handleError(_0x21b0d9,null));};exports['getHoppers']=function(_0x16ae90,_0x3555d7,_0x344b9a){var _0x554913={'raw':![],'where':{}};var _0x40845b={};var _0x24e772={'count':0x0,'rows':[]};return db[_0x9cc8('0x35')]['findOne']({'where':{'id':_0x16ae90[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x3555d7,null))['then'](function(_0x24dd10){if(_0x24dd10){_0x40845b[_0x9cc8('0x3d')]=_['keys'](db[_0x9cc8('0x62')]['rawAttributes']);_0x40845b[_0x9cc8('0x39')]=_[_0x9cc8('0x3a')](_0x16ae90[_0x9cc8('0x39')]);_0x40845b[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x40845b['model'],_0x40845b['query']);_0x554913[_0x9cc8('0x3f')]=_[_0x9cc8('0x3c')](_0x40845b[_0x9cc8('0x3d')],qs['fields'](_0x16ae90['query'][_0x9cc8('0x3e')]));_0x554913['attributes']=_0x554913[_0x9cc8('0x3f')][_0x9cc8('0x40')]?_0x554913['attributes']:_0x40845b['model'];if(!_0x16ae90[_0x9cc8('0x39')]['hasOwnProperty'](_0x9cc8('0x42'))){_0x554913[_0x9cc8('0x21')]=qs[_0x9cc8('0x21')](_0x16ae90[_0x9cc8('0x39')][_0x9cc8('0x21')]);_0x554913[_0x9cc8('0x20')]=qs['offset'](_0x16ae90[_0x9cc8('0x39')][_0x9cc8('0x20')]);}_0x554913[_0x9cc8('0x43')]=qs[_0x9cc8('0x44')](_0x16ae90[_0x9cc8('0x39')][_0x9cc8('0x44')]);_0x554913[_0x9cc8('0x45')]=qs[_0x9cc8('0x3b')](_[_0x9cc8('0x46')](_0x16ae90[_0x9cc8('0x39')],_0x40845b['filters']));_0x554913[_0x9cc8('0x45')][_0x9cc8('0x63')]=_0x24dd10['id'];if(_0x16ae90['query'][_0x9cc8('0x47')]){_0x554913[_0x9cc8('0x45')]=_[_0x9cc8('0x48')](_0x554913['where'],{'$or':_[_0x9cc8('0x29')](_0x554913['attributes'],function(_0x1d88ee){var _0x164ae2={};_0x164ae2[_0x1d88ee]={'$like':'%'+_0x16ae90[_0x9cc8('0x39')][_0x9cc8('0x47')]+'%'};return _0x164ae2;})});}_0x554913=_[_0x9cc8('0x48')]({},_0x554913,_0x16ae90[_0x9cc8('0x4a')]);return db[_0x9cc8('0x62')][_0x9cc8('0x1f')]({'where':_0x554913[_0x9cc8('0x45')]})[_0x9cc8('0x26')](function(_0x4a4075){_0x24e772[_0x9cc8('0x1f')]=_0x4a4075;if(_0x16ae90[_0x9cc8('0x39')]['includeAll']){_0x554913[_0x9cc8('0x5e')]=[{'all':!![]}];}return db[_0x9cc8('0x62')]['findAll'](_0x554913);})[_0x9cc8('0x26')](function(_0x2d4a1b){_0x24e772[_0x9cc8('0x4d')]=_0x2d4a1b;return _0x24e772;});}})[_0x9cc8('0x26')](respondWithFilteredResult(_0x3555d7,_0x554913))[_0x9cc8('0x4e')](handleError(_0x3555d7,null));};exports['getHopperHistories']=function(_0x2b01bb,_0x247191,_0x3a9498){var _0xb7865f={'raw':!![],'where':{}};var _0x5872d8={};var _0x7d946e={'count':0x0,'rows':[]};return db[_0x9cc8('0x35')][_0x9cc8('0x64')]({'where':{'id':_0x2b01bb[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x247191,null))[_0x9cc8('0x26')](function(_0x14bddd){if(_0x14bddd){_0x5872d8['model']=_[_0x9cc8('0x3a')](db[_0x9cc8('0x65')][_0x9cc8('0x36')]);_0x5872d8['query']=_[_0x9cc8('0x3a')](_0x2b01bb[_0x9cc8('0x39')]);_0x5872d8[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x5872d8[_0x9cc8('0x3d')],_0x5872d8[_0x9cc8('0x39')]);_0xb7865f[_0x9cc8('0x3f')]=_[_0x9cc8('0x3c')](_0x5872d8['model'],qs[_0x9cc8('0x3e')](_0x2b01bb[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0xb7865f['attributes']=_0xb7865f['attributes']['length']?_0xb7865f[_0x9cc8('0x3f')]:_0x5872d8[_0x9cc8('0x3d')];if(!_0x2b01bb[_0x9cc8('0x39')][_0x9cc8('0x41')]('nolimit')){_0xb7865f['limit']=qs[_0x9cc8('0x21')](_0x2b01bb['query'][_0x9cc8('0x21')]);_0xb7865f[_0x9cc8('0x20')]=qs['offset'](_0x2b01bb['query'][_0x9cc8('0x20')]);}_0xb7865f[_0x9cc8('0x43')]=qs[_0x9cc8('0x44')](_0x2b01bb[_0x9cc8('0x39')][_0x9cc8('0x44')]);_0xb7865f['where']=qs[_0x9cc8('0x3b')](_['pick'](_0x2b01bb[_0x9cc8('0x39')],_0x5872d8['filters']));_0xb7865f['where']['VoiceQueueId']=_0x14bddd['id'];if(_0x2b01bb['query'][_0x9cc8('0x47')]){_0xb7865f[_0x9cc8('0x45')]=_[_0x9cc8('0x48')](_0xb7865f[_0x9cc8('0x45')],{'$or':_[_0x9cc8('0x29')](_0xb7865f[_0x9cc8('0x3f')],function(_0x32710d){var _0x21083d={};_0x21083d[_0x32710d]={'$like':'%'+_0x2b01bb['query'][_0x9cc8('0x47')]+'%'};return _0x21083d;})});}_0xb7865f=_[_0x9cc8('0x48')]({},_0xb7865f,_0x2b01bb[_0x9cc8('0x4a')]);return db['CmHopperHistory'][_0x9cc8('0x1f')]({'where':_0xb7865f[_0x9cc8('0x45')]})[_0x9cc8('0x26')](function(_0x30c77a){_0x7d946e[_0x9cc8('0x1f')]=_0x30c77a;if(_0x2b01bb[_0x9cc8('0x39')][_0x9cc8('0x4b')]){_0xb7865f[_0x9cc8('0x5e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x9cc8('0x4c')](_0xb7865f);})[_0x9cc8('0x26')](function(_0x2a99a3){_0x7d946e[_0x9cc8('0x4d')]=_0x2a99a3;return _0x7d946e;});}})[_0x9cc8('0x26')](respondWithFilteredResult(_0x247191,_0xb7865f))[_0x9cc8('0x4e')](handleError(_0x247191,null));};exports[_0x9cc8('0x66')]=function(_0x31dcb2,_0x49079e,_0x3f8201){var _0x51a587={'raw':!![],'where':{}};var _0x1f9713={};var _0x1fb530={'count':0x0,'rows':[]};return db[_0x9cc8('0x35')][_0x9cc8('0x64')]({'where':{'id':_0x31dcb2[_0x9cc8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x49079e,null))[_0x9cc8('0x26')](function(_0x566b6e){if(_0x566b6e){_0x1f9713[_0x9cc8('0x3d')]=_['keys'](db[_0x9cc8('0x67')][_0x9cc8('0x36')]);_0x1f9713[_0x9cc8('0x39')]=_[_0x9cc8('0x3a')](_0x31dcb2[_0x9cc8('0x39')]);_0x1f9713[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x1f9713[_0x9cc8('0x3d')],_0x1f9713[_0x9cc8('0x39')]);_0x51a587[_0x9cc8('0x3f')]=_['intersection'](_0x1f9713[_0x9cc8('0x3d')],qs[_0x9cc8('0x3e')](_0x31dcb2[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0x51a587[_0x9cc8('0x3f')]=_0x51a587['attributes'][_0x9cc8('0x40')]?_0x51a587[_0x9cc8('0x3f')]:_0x1f9713['model'];if(!_0x31dcb2[_0x9cc8('0x39')][_0x9cc8('0x41')](_0x9cc8('0x42'))){_0x51a587[_0x9cc8('0x21')]=qs[_0x9cc8('0x21')](_0x31dcb2[_0x9cc8('0x39')][_0x9cc8('0x21')]);_0x51a587['offset']=qs['offset'](_0x31dcb2[_0x9cc8('0x39')]['offset']);}_0x51a587['order']=qs[_0x9cc8('0x44')](_0x31dcb2['query'][_0x9cc8('0x44')]);_0x51a587[_0x9cc8('0x45')]=qs[_0x9cc8('0x3b')](_[_0x9cc8('0x46')](_0x31dcb2[_0x9cc8('0x39')],_0x1f9713['filters']));_0x51a587[_0x9cc8('0x45')][_0x9cc8('0x63')]=_0x566b6e['id'];if(_0x31dcb2[_0x9cc8('0x39')]['filter']){_0x51a587[_0x9cc8('0x45')]=_['merge'](_0x51a587[_0x9cc8('0x45')],{'$or':_[_0x9cc8('0x29')](_0x51a587[_0x9cc8('0x3f')],function(_0x303585){var _0x2656bf={};_0x2656bf[_0x303585]={'$like':'%'+_0x31dcb2['query']['filter']+'%'};return _0x2656bf;})});}_0x51a587=_[_0x9cc8('0x48')]({},_0x51a587,_0x31dcb2['options']);return db[_0x9cc8('0x67')][_0x9cc8('0x1f')]({'where':_0x51a587['where']})[_0x9cc8('0x26')](function(_0x3a44d7){_0x1fb530[_0x9cc8('0x1f')]=_0x3a44d7;if(_0x31dcb2[_0x9cc8('0x39')][_0x9cc8('0x4b')]){_0x51a587[_0x9cc8('0x5e')]=[{'all':!![]}];}return db[_0x9cc8('0x67')][_0x9cc8('0x4c')](_0x51a587);})['then'](function(_0x482b31){_0x1fb530[_0x9cc8('0x4d')]=_0x482b31;return _0x1fb530;});}})[_0x9cc8('0x26')](respondWithFilteredResult(_0x49079e,_0x51a587))[_0x9cc8('0x4e')](handleError(_0x49079e,null));};exports['getHopperBlacks']=function(_0x403cfe,_0x4ba0ac,_0x486f60){var _0xee2c00={'raw':!![],'where':{}};var _0x10ec90={};var _0x382e42={'count':0x0,'rows':[]};return db[_0x9cc8('0x35')][_0x9cc8('0x64')]({'where':{'id':_0x403cfe[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x4ba0ac,null))['then'](function(_0x47ddab){if(_0x47ddab){_0x10ec90['model']=_[_0x9cc8('0x3a')](db[_0x9cc8('0x68')]['rawAttributes']);_0x10ec90[_0x9cc8('0x39')]=_[_0x9cc8('0x3a')](_0x403cfe[_0x9cc8('0x39')]);_0x10ec90[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x10ec90[_0x9cc8('0x3d')],_0x10ec90[_0x9cc8('0x39')]);_0xee2c00[_0x9cc8('0x3f')]=_[_0x9cc8('0x3c')](_0x10ec90['model'],qs[_0x9cc8('0x3e')](_0x403cfe[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0xee2c00[_0x9cc8('0x3f')]=_0xee2c00[_0x9cc8('0x3f')][_0x9cc8('0x40')]?_0xee2c00[_0x9cc8('0x3f')]:_0x10ec90[_0x9cc8('0x3d')];if(!_0x403cfe[_0x9cc8('0x39')][_0x9cc8('0x41')]('nolimit')){_0xee2c00[_0x9cc8('0x21')]=qs['limit'](_0x403cfe[_0x9cc8('0x39')][_0x9cc8('0x21')]);_0xee2c00[_0x9cc8('0x20')]=qs[_0x9cc8('0x20')](_0x403cfe['query']['offset']);}_0xee2c00[_0x9cc8('0x43')]=qs['sort'](_0x403cfe[_0x9cc8('0x39')][_0x9cc8('0x44')]);_0xee2c00[_0x9cc8('0x45')]=qs['filters'](_[_0x9cc8('0x46')](_0x403cfe[_0x9cc8('0x39')],_0x10ec90['filters']));_0xee2c00[_0x9cc8('0x45')][_0x9cc8('0x63')]=_0x47ddab['id'];if(_0x403cfe[_0x9cc8('0x39')][_0x9cc8('0x47')]){_0xee2c00[_0x9cc8('0x45')]=_[_0x9cc8('0x48')](_0xee2c00[_0x9cc8('0x45')],{'$or':_[_0x9cc8('0x29')](_0xee2c00[_0x9cc8('0x3f')],function(_0x2c6461){var _0x488aa7={};_0x488aa7[_0x2c6461]={'$like':'%'+_0x403cfe[_0x9cc8('0x39')][_0x9cc8('0x47')]+'%'};return _0x488aa7;})});}_0xee2c00=_[_0x9cc8('0x48')]({},_0xee2c00,_0x403cfe[_0x9cc8('0x4a')]);return db[_0x9cc8('0x68')][_0x9cc8('0x1f')]({'where':_0xee2c00[_0x9cc8('0x45')]})[_0x9cc8('0x26')](function(_0x5040e5){_0x382e42['count']=_0x5040e5;if(_0x403cfe['query']['includeAll']){_0xee2c00[_0x9cc8('0x5e')]=[{'all':!![]}];}return db[_0x9cc8('0x68')]['findAll'](_0xee2c00);})['then'](function(_0x254397){_0x382e42[_0x9cc8('0x4d')]=_0x254397;return _0x382e42;});}})['then'](respondWithFilteredResult(_0x4ba0ac,_0xee2c00))['catch'](handleError(_0x4ba0ac,null));};exports[_0x9cc8('0x69')]=function(_0x1d3173,_0x452444,_0x249d64){var _0x191a1c={};var _0x4e97d2={};var _0x35b937;var _0x13fbb3;return db[_0x9cc8('0x35')][_0x9cc8('0x64')]({'where':{'id':_0x1d3173['params']['id']}})['then'](handleEntityNotFound(_0x452444,null))['then'](function(_0x269e03){if(_0x269e03){_0x35b937=_0x269e03;_0x4e97d2[_0x9cc8('0x3d')]=_[_0x9cc8('0x3a')](db[_0x9cc8('0x6a')][_0x9cc8('0x36')]);_0x4e97d2['query']=_[_0x9cc8('0x3a')](_0x1d3173[_0x9cc8('0x39')]);_0x4e97d2[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x4e97d2[_0x9cc8('0x3d')],_0x4e97d2[_0x9cc8('0x39')]);_0x191a1c['attributes']=_[_0x9cc8('0x3c')](_0x4e97d2[_0x9cc8('0x3d')],qs[_0x9cc8('0x3e')](_0x1d3173[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0x191a1c['attributes']=_0x191a1c[_0x9cc8('0x3f')][_0x9cc8('0x40')]?_0x191a1c[_0x9cc8('0x3f')]:_0x4e97d2['model'];_0x191a1c[_0x9cc8('0x43')]=qs[_0x9cc8('0x44')](_0x1d3173[_0x9cc8('0x39')]['sort']);_0x191a1c[_0x9cc8('0x45')]=qs[_0x9cc8('0x3b')](_[_0x9cc8('0x46')](_0x1d3173[_0x9cc8('0x39')],_0x4e97d2[_0x9cc8('0x3b')]));if(_0x1d3173[_0x9cc8('0x39')][_0x9cc8('0x47')]){_0x191a1c[_0x9cc8('0x45')]=_[_0x9cc8('0x48')](_0x191a1c[_0x9cc8('0x45')],{'$or':_[_0x9cc8('0x29')](_0x191a1c[_0x9cc8('0x3f')],function(_0x9c3b86){var _0x6b50b9={};_0x6b50b9[_0x9c3b86]={'$like':'%'+_0x1d3173['query']['filter']+'%'};return _0x6b50b9;})});}_0x191a1c=_[_0x9cc8('0x48')]({},_0x191a1c,_0x1d3173[_0x9cc8('0x4a')]);return _0x35b937[_0x9cc8('0x69')](_0x191a1c);}})[_0x9cc8('0x26')](function(_0x1d379d){if(_0x1d379d){_0x13fbb3=_0x1d379d[_0x9cc8('0x40')];if(!_0x1d3173[_0x9cc8('0x39')][_0x9cc8('0x41')](_0x9cc8('0x42'))){_0x191a1c[_0x9cc8('0x21')]=qs[_0x9cc8('0x21')](_0x1d3173[_0x9cc8('0x39')][_0x9cc8('0x21')]);_0x191a1c[_0x9cc8('0x20')]=qs[_0x9cc8('0x20')](_0x1d3173[_0x9cc8('0x39')][_0x9cc8('0x20')]);}return _0x35b937[_0x9cc8('0x69')](_0x191a1c);}})[_0x9cc8('0x26')](function(_0x4bfc37){if(_0x4bfc37){return _0x4bfc37?{'count':_0x13fbb3,'rows':_0x4bfc37}:null;}})[_0x9cc8('0x26')](respondWithResult(_0x452444,null))[_0x9cc8('0x4e')](handleError(_0x452444,null));};exports['addTeams']=function(_0x3a87bb,_0x37564b,_0x15e707){var _0xa8c0d4=_0x3a87bb[_0x9cc8('0x51')][_0x9cc8('0x6b')];var _0x46fa6c=_[_0x9cc8('0x29')](_0xa8c0d4,'id');return db[_0x9cc8('0x6a')]['findAll']({'where':{'id':_0x46fa6c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x9cc8('0x2e'),_0x9cc8('0x6c'),_0x9cc8('0x6d'),'interface'],'raw':!![]}]})[_0x9cc8('0x26')](function(_0x14b786){if(_0x14b786){var _0x2833b3=_[_0x9cc8('0x6e')](_0x14b786,function(_0x52949a){var _0x4751fd=_0x52949a[_0x9cc8('0x27')]({'plain':!![]});_0x4751fd[_0x9cc8('0x6f')][_0x9cc8('0x70')](function(_0x3c9a2b){_0x3c9a2b[_0x9cc8('0x71')]=_['find'](_0xa8c0d4,{'id':_0x4751fd['id']})['penalty'];});return _0x4751fd[_0x9cc8('0x6f')];});return db['VoiceQueue']['find']({'where':{'id':_0x3a87bb[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](function(_0x39d8e5){return db[_0x9cc8('0x72')][_0x9cc8('0x73')](function(_0x2717be){return _0x39d8e5[_0x9cc8('0x74')](_0x46fa6c,{'transaction':_0x2717be})['then'](function(){return BPromise[_0x9cc8('0x75')](_0x2833b3,function(_0x28f11d){return db[_0x9cc8('0x76')][_0x9cc8('0x77')]({'where':{'UserId':_0x28f11d['id'],'VoiceQueueId':_0x3a87bb[_0x9cc8('0x5d')]['id']},'defaults':{'penalty':_0x28f11d[_0x9cc8('0x71')]},'transaction':_0x2717be});});})[_0x9cc8('0x26')](function(){return BPromise[_0x9cc8('0x75')](_[_0x9cc8('0x47')](_0x2833b3,{'online':!![]}),function(_0x30fc26){return db[_0x9cc8('0x78')][_0x9cc8('0x79')]({'membername':_0x30fc26['name'],'UserId':_0x30fc26['id'],'queue_name':_0x39d8e5[_0x9cc8('0x2e')],'VoiceQueueId':_0x39d8e5['id'],'interface':_['isNil'](_0x30fc26['interface'])?util[_0x9cc8('0x7a')]('SIP/%s',_0x30fc26[_0x9cc8('0x2e')]):_0x30fc26[_0x9cc8('0x7b')],'paused':_0x30fc26[_0x9cc8('0x6d')]||![],'penalty':_0x30fc26[_0x9cc8('0x71')]},{'transaction':_0x2717be});});})['then'](function(){_0x2833b3[_0x9cc8('0x70')](function(_0x5e5eeb){socket['emit'](_0x9cc8('0x7c'),{'UserId':_0x5e5eeb['id'],'VoiceQueueId':_0x39d8e5['id']});});});});});}})[_0x9cc8('0x26')](respondWithStatusCode(_0x37564b,null))[_0x9cc8('0x4e')](handleError(_0x37564b,null));};exports[_0x9cc8('0x7d')]=function(_0x551ebf,_0x65f3fb,_0x5cb024){return db[_0x9cc8('0x6a')][_0x9cc8('0x4c')]({'where':{'id':_0x551ebf['query'][_0x9cc8('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x9cc8('0x7f')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x65f3fb,null))[_0x9cc8('0x26')](function(_0x112a98){var _0x37cae6=_[_0x9cc8('0x29')](_0x112a98,'id');var _0x1b96fc=[];var _0x39b20f=[];var _0x19653b=squel['select']();_0x19653b[_0x9cc8('0x80')](_0x9cc8('0x81'))[_0x9cc8('0x82')](_0x9cc8('0x83'),'tq')[_0x9cc8('0x84')](_0x9cc8('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9cc8('0x45')](_0x9cc8('0x86'),_0x551ebf[_0x9cc8('0x5d')]['id']);for(var _0x1c27fd=0x0;_0x1c27fd<_0x112a98[_0x9cc8('0x40')];_0x1c27fd+=0x1){let _0x44867e=_0x112a98[_0x1c27fd];for(var _0x161c78=0x0;_0x161c78<_0x44867e[_0x9cc8('0x6f')][_0x9cc8('0x40')];_0x161c78+=0x1){let _0xa59aa4=_0x44867e[_0x9cc8('0x6f')][_0x161c78];var _0x37c051=_0x19653b[_0x9cc8('0x5c')]();_0x37c051[_0x9cc8('0x45')](_0x9cc8('0x87'),_0xa59aa4['id']);_0x39b20f[_0x9cc8('0x88')](db['sequelize'][_0x9cc8('0x39')](_0x37c051[_0x9cc8('0x89')](),{'type':db[_0x9cc8('0x72')]['QueryTypes'][_0x9cc8('0x8a')]})[_0x9cc8('0x26')](function(_0x162377){if(_0x162377['length']===0x1){return _0xa59aa4['id'];}else{var _0x3eb56d=_[_0x9cc8('0x8b')](_[_0x9cc8('0x29')](_0x162377,_0x9cc8('0x8c')),function(_0x337c09){return _[_0x9cc8('0x2a')](_0x37cae6,_0x337c09);});if(_0x3eb56d){return _0xa59aa4['id'];}}}));}}return BPromise[_0x9cc8('0x8d')](_0x39b20f)[_0x9cc8('0x26')](function(_0x417827){_0x1b96fc=_(_0x1b96fc)[_0x9cc8('0x8e')](_0x417827)['compact']()['value']();return db[_0x9cc8('0x35')][_0x9cc8('0x2c')]({'where':{'id':_0x551ebf['params']['id']}})[_0x9cc8('0x26')](function(_0x5e6eef){return db[_0x9cc8('0x72')][_0x9cc8('0x73')](function(_0x24bec8){return _0x5e6eef['removeTeams'](_0x551ebf[_0x9cc8('0x39')]['ids'],{'transaction':_0x24bec8})[_0x9cc8('0x26')](function(){if(!_[_0x9cc8('0x8f')](_0x1b96fc)){return _0x5e6eef['removeAgents'](_0x1b96fc,{'transaction':_0x24bec8})['then'](function(){return db[_0x9cc8('0x78')][_0x9cc8('0x30')]({'where':{'VoiceQueueId':_0x551ebf[_0x9cc8('0x5d')]['id'],'UserId':_0x1b96fc},'transaction':_0x24bec8});});}})[_0x9cc8('0x26')](function(){_0x1b96fc[_0x9cc8('0x70')](function(_0x59a47f){socket['emit']('userVoiceQueue:remove',{'UserId':_0x59a47f,'VoiceQueueId':_0x5e6eef['id']});});});});});});})[_0x9cc8('0x26')](respondWithStatusCode(_0x65f3fb,null))[_0x9cc8('0x4e')](handleError(_0x65f3fb,null));};exports[_0x9cc8('0x90')]=function(_0x2e9412,_0x7b6bc2,_0x48c92){var _0x404d53,_0x1eaede;return db['VoiceQueue'][_0x9cc8('0x2c')]({'where':{'id':_0x2e9412['params']['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x7b6bc2,null))[_0x9cc8('0x26')](function(_0x5dadb0){if(_0x5dadb0){_0x1eaede=_0x5dadb0;return _0x5dadb0[_0x9cc8('0x90')](_0x2e9412[_0x9cc8('0x51')]['ids'],_[_0x9cc8('0x5f')](_0x2e9412['body'],[_0x9cc8('0x7e'),'id'])||{})[_0x9cc8('0x91')](function(_0x4f9266){for(var _0x3dae2b=0x0;_0x3dae2b<_0x2e9412[_0x9cc8('0x51')][_0x9cc8('0x7e')][_0x9cc8('0x40')];_0x3dae2b+=0x1){socket[_0x9cc8('0x92')](_0x9cc8('0x7c'),{'UserId':_0x2e9412[_0x9cc8('0x51')][_0x9cc8('0x7e')][_0x3dae2b],'VoiceQueueId':_0x2e9412[_0x9cc8('0x5d')]['id']});}return _0x4f9266;});}})[_0x9cc8('0x26')](function(_0x274930){_0x404d53=_0x274930||[];if(_0x1eaede){return db['User'][_0x9cc8('0x4c')]({'where':{'id':_0x2e9412[_0x9cc8('0x51')]['ids']},'attributes':['id',_0x9cc8('0x2e'),_0x9cc8('0x6c'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0x536de5){if(!_[_0x9cc8('0x8f')](_0x536de5)){var _0x3176f2=[];for(var _0x296f0f=0x0;_0x296f0f<_0x536de5[_0x9cc8('0x40')];_0x296f0f++){if(_0x536de5[_0x296f0f][_0x9cc8('0x6c')]){_0x3176f2[_0x9cc8('0x88')](db['UserVoiceQueueRt'][_0x9cc8('0x79')]({'membername':_0x536de5[_0x296f0f][_0x9cc8('0x2e')],'UserId':_0x536de5[_0x296f0f]['id'],'queue_name':_0x1eaede[_0x9cc8('0x2e')],'VoiceQueueId':_0x1eaede['id'],'interface':_[_0x9cc8('0x93')](_0x536de5[_0x296f0f][_0x9cc8('0x7b')])?util[_0x9cc8('0x7a')](_0x9cc8('0x94'),_0x536de5[_0x296f0f]['name']):_0x536de5[_0x296f0f]['interface'],'paused':_0x536de5[_0x296f0f][_0x9cc8('0x6d')]||![],'penalty':_0x2e9412[_0x9cc8('0x51')][_0x9cc8('0x71')]||0x0}));}}return BPromise[_0x9cc8('0x8d')](_0x3176f2);}})[_0x9cc8('0x26')](function(){return _0x404d53;})[_0x9cc8('0x26')](respondWithResult(_0x7b6bc2,null))[_0x9cc8('0x4e')](handleError(_0x7b6bc2,null));};exports[_0x9cc8('0x95')]=function(_0x245eff,_0x281d98,_0x57e182){return db['VoiceQueue']['find']({'where':{'id':_0x245eff[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x281d98,null))[_0x9cc8('0x26')](function(_0x5860c9){if(_0x5860c9){return _0x5860c9[_0x9cc8('0x95')](_0x245eff[_0x9cc8('0x39')][_0x9cc8('0x7e')])[_0x9cc8('0x26')](function(){if(_[_0x9cc8('0x96')](_0x245eff[_0x9cc8('0x39')][_0x9cc8('0x7e')])){for(var _0x156eec=0x0;_0x156eec<_0x245eff[_0x9cc8('0x39')][_0x9cc8('0x7e')][_0x9cc8('0x40')];_0x156eec+=0x1){socket[_0x9cc8('0x92')](_0x9cc8('0x97'),{'UserId':Number(_0x245eff[_0x9cc8('0x39')]['ids'][_0x156eec]),'VoiceQueueId':Number(_0x245eff[_0x9cc8('0x5d')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x245eff[_0x9cc8('0x39')][_0x9cc8('0x7e')]),'VoiceQueueId':Number(_0x245eff[_0x9cc8('0x5d')]['id'])});}});}})[_0x9cc8('0x26')](function(_0x3aea45){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x245eff['params']['id'],'UserId':_0x245eff[_0x9cc8('0x39')][_0x9cc8('0x7e')]}})['then'](function(){return _0x3aea45;});})[_0x9cc8('0x26')](respondWithStatusCode(_0x281d98,null))[_0x9cc8('0x4e')](handleError(_0x281d98,null));};exports['getAgents']=function(_0xe7fef1,_0x40e872,_0x947e0a){var _0x54930b={};var _0xa891cb={};var _0x3d6c5a;var _0x3b5b87;return db['VoiceQueue'][_0x9cc8('0x64')]({'where':{'id':_0xe7fef1[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x40e872,null))[_0x9cc8('0x26')](function(_0x3bd164){if(_0x3bd164){_0x3d6c5a=_0x3bd164;_0xa891cb[_0x9cc8('0x3d')]=_[_0x9cc8('0x3a')](db['User'][_0x9cc8('0x36')]);_0xa891cb['query']=_['keys'](_0xe7fef1['query']);_0xa891cb[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0xa891cb[_0x9cc8('0x3d')],_0xa891cb['query']);_0x54930b['attributes']=_[_0x9cc8('0x3c')](_0xa891cb['model'],qs['fields'](_0xe7fef1[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0x54930b['attributes']=_0x54930b[_0x9cc8('0x3f')][_0x9cc8('0x40')]?_0x54930b[_0x9cc8('0x3f')]:_0xa891cb[_0x9cc8('0x3d')];_0x54930b[_0x9cc8('0x43')]=qs[_0x9cc8('0x44')](_0xe7fef1[_0x9cc8('0x39')]['sort']);_0x54930b[_0x9cc8('0x45')]=qs[_0x9cc8('0x3b')](_['pick'](_0xe7fef1['query'],_0xa891cb[_0x9cc8('0x3b')]));if(_0xe7fef1[_0x9cc8('0x39')][_0x9cc8('0x47')]){_0x54930b[_0x9cc8('0x45')]=_[_0x9cc8('0x48')](_0x54930b[_0x9cc8('0x45')],{'$or':_[_0x9cc8('0x29')](_0x54930b[_0x9cc8('0x3f')],function(_0x594dde){var _0x334a04={};_0x334a04[_0x594dde]={'$like':'%'+_0xe7fef1['query'][_0x9cc8('0x47')]+'%'};return _0x334a04;})});}_0x54930b=_['merge']({},_0x54930b,_0xe7fef1[_0x9cc8('0x4a')]);return _0x3d6c5a[_0x9cc8('0x98')](_0x54930b);}})[_0x9cc8('0x26')](function(_0x3f00e1){if(_0x3f00e1){_0x3b5b87=_0x3f00e1[_0x9cc8('0x40')];if(!_0xe7fef1['query'][_0x9cc8('0x41')](_0x9cc8('0x42'))){_0x54930b[_0x9cc8('0x21')]=qs[_0x9cc8('0x21')](_0xe7fef1[_0x9cc8('0x39')][_0x9cc8('0x21')]);_0x54930b[_0x9cc8('0x20')]=qs['offset'](_0xe7fef1[_0x9cc8('0x39')]['offset']);}return _0x3d6c5a[_0x9cc8('0x98')](_0x54930b);}})[_0x9cc8('0x26')](function(_0x3812fa){if(_0x3812fa){return _0x3812fa?{'count':_0x3b5b87,'rows':_0x3812fa}:null;}})['then'](respondWithResult(_0x40e872,null))[_0x9cc8('0x4e')](handleError(_0x40e872,null));};exports[_0x9cc8('0x99')]=function(_0x357101,_0x2f4540,_0x31974a){var _0x32aa9d={};var _0x1c93a5={};var _0x54197e;var _0x4c432c;return db[_0x9cc8('0x35')]['findOne']({'where':{'id':_0x357101[_0x9cc8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2f4540,null))['then'](function(_0xd5e83){if(_0xd5e83){_0x54197e=_0xd5e83;_0x1c93a5[_0x9cc8('0x3d')]=_[_0x9cc8('0x3a')](db[_0x9cc8('0x78')][_0x9cc8('0x36')]);_0x1c93a5['query']=_[_0x9cc8('0x3a')](_0x357101[_0x9cc8('0x39')]);_0x1c93a5[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x1c93a5['model'],_0x1c93a5['query']);_0x32aa9d[_0x9cc8('0x3f')]=_[_0x9cc8('0x3c')](_0x1c93a5['model'],qs[_0x9cc8('0x3e')](_0x357101[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0x32aa9d[_0x9cc8('0x3f')]=_0x32aa9d[_0x9cc8('0x3f')][_0x9cc8('0x40')]?_0x32aa9d[_0x9cc8('0x3f')]:_0x1c93a5[_0x9cc8('0x3d')];_0x32aa9d[_0x9cc8('0x43')]=qs[_0x9cc8('0x44')](_0x357101[_0x9cc8('0x39')][_0x9cc8('0x44')]);_0x32aa9d[_0x9cc8('0x45')]=qs[_0x9cc8('0x3b')](_[_0x9cc8('0x46')](_0x357101[_0x9cc8('0x39')],_0x1c93a5['filters']));if(_0x357101[_0x9cc8('0x39')][_0x9cc8('0x47')]){_0x32aa9d[_0x9cc8('0x45')]=_['merge'](_0x32aa9d[_0x9cc8('0x45')],{'$or':_[_0x9cc8('0x29')](_0x32aa9d[_0x9cc8('0x3f')],function(_0x10174c){var _0x328ac2={};_0x328ac2[_0x10174c]={'$like':'%'+_0x357101['query'][_0x9cc8('0x47')]+'%'};return _0x328ac2;})});}_0x32aa9d=_[_0x9cc8('0x48')]({},_0x32aa9d,_0x357101[_0x9cc8('0x4a')]);return _0x54197e[_0x9cc8('0x99')](_0x32aa9d);}})['then'](function(_0x9e2c51){if(_0x9e2c51){_0x4c432c=_0x9e2c51[_0x9cc8('0x40')];if(!_0x357101['query'][_0x9cc8('0x41')]('nolimit')){_0x32aa9d[_0x9cc8('0x21')]=qs[_0x9cc8('0x21')](_0x357101[_0x9cc8('0x39')][_0x9cc8('0x21')]);_0x32aa9d[_0x9cc8('0x20')]=qs[_0x9cc8('0x20')](_0x357101[_0x9cc8('0x39')][_0x9cc8('0x20')]);}return _0x54197e[_0x9cc8('0x99')](_0x32aa9d);}})['then'](function(_0x19d9bd){return _0x19d9bd?{'count':_0x4c432c,'rows':_0x19d9bd}:null;})[_0x9cc8('0x26')](respondWithResult(_0x2f4540,null))[_0x9cc8('0x4e')](handleError(_0x2f4540,null));};exports['getLists']=function(_0x144928,_0x273eac,_0x8f2251){var _0x27a269={};var _0x19e101={};var _0x1479fd;var _0x37deb8;return db[_0x9cc8('0x35')][_0x9cc8('0x64')]({'where':{'id':_0x144928[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x273eac,null))[_0x9cc8('0x26')](function(_0x22d856){if(_0x22d856){_0x1479fd=_0x22d856;_0x19e101[_0x9cc8('0x3d')]=_['keys'](db[_0x9cc8('0x9a')][_0x9cc8('0x36')]);_0x19e101[_0x9cc8('0x39')]=_[_0x9cc8('0x3a')](_0x144928[_0x9cc8('0x39')]);_0x19e101[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x19e101[_0x9cc8('0x3d')],_0x19e101['query']);_0x27a269[_0x9cc8('0x3f')]=_[_0x9cc8('0x3c')](_0x19e101[_0x9cc8('0x3d')],qs[_0x9cc8('0x3e')](_0x144928['query'][_0x9cc8('0x3e')]));_0x27a269[_0x9cc8('0x3f')]=_0x27a269['attributes'][_0x9cc8('0x40')]?_0x27a269[_0x9cc8('0x3f')]:_0x19e101[_0x9cc8('0x3d')];_0x27a269[_0x9cc8('0x43')]=qs[_0x9cc8('0x44')](_0x144928[_0x9cc8('0x39')][_0x9cc8('0x44')]);_0x27a269[_0x9cc8('0x45')]=qs[_0x9cc8('0x3b')](_['pick'](_0x144928[_0x9cc8('0x39')],_0x19e101['filters']));if(_0x144928[_0x9cc8('0x39')]['filter']){_0x27a269[_0x9cc8('0x45')]=_[_0x9cc8('0x48')](_0x27a269['where'],{'$or':_[_0x9cc8('0x29')](_0x27a269['attributes'],function(_0x4a3735){var _0x2a7e4b={};_0x2a7e4b[_0x4a3735]={'$like':'%'+_0x144928[_0x9cc8('0x39')]['filter']+'%'};return _0x2a7e4b;})});}_0x27a269=_[_0x9cc8('0x48')]({},_0x27a269,_0x144928['options']);return _0x1479fd[_0x9cc8('0x9b')](_0x27a269);}})[_0x9cc8('0x26')](function(_0x5c9b13){if(_0x5c9b13){_0x37deb8=_0x5c9b13[_0x9cc8('0x40')];if(!_0x144928[_0x9cc8('0x39')][_0x9cc8('0x41')]('nolimit')){_0x27a269[_0x9cc8('0x21')]=qs[_0x9cc8('0x21')](_0x144928['query'][_0x9cc8('0x21')]);_0x27a269['offset']=qs[_0x9cc8('0x20')](_0x144928[_0x9cc8('0x39')][_0x9cc8('0x20')]);}return _0x1479fd[_0x9cc8('0x9b')](_0x27a269);}})[_0x9cc8('0x26')](function(_0x699902){if(_0x699902){return _0x699902?{'count':_0x37deb8,'rows':_0x699902}:null;}})[_0x9cc8('0x26')](respondWithResult(_0x273eac,null))['catch'](handleError(_0x273eac,null));};exports[_0x9cc8('0x9c')]=function(_0x191669,_0x2a8cd1,_0x3f176a){var _0x532133,_0x416dc2;return db['VoiceQueue'][_0x9cc8('0x2c')]({'where':{'id':_0x191669[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x2a8cd1,null))[_0x9cc8('0x26')](function(_0x4c4688){if(_0x4c4688){_0x416dc2=_0x4c4688;return _0x4c4688[_0x9cc8('0x9c')](_0x191669[_0x9cc8('0x51')]['ids'],_[_0x9cc8('0x5f')](_0x191669[_0x9cc8('0x51')],['ids','id'])||{});}return null;})[_0x9cc8('0x91')](function(_0x37a3e6){var _0x256ba8;_0x532133=_0x37a3e6||[];var _0x242809=[];if(_0x37a3e6){for(var _0x2c0f63=0x0;_0x2c0f63<_0x37a3e6[_0x9cc8('0x40')];_0x2c0f63+=0x1){var _0x19e5de=_0x37a3e6[_0x2c0f63][_0x9cc8('0x27')]({'plain':!![]});_0x416dc2[_0x9cc8('0x9d')]=_0x191669['body'][_0x9cc8('0x9d')]?_0x191669['body'][_0x9cc8('0x9d')]:_0x416dc2[_0x9cc8('0x9d')];switch(_0x416dc2[_0x9cc8('0x9d')]){case _0x9cc8('0x9e'):_0x256ba8=squel[_0x9cc8('0x9f')]()['into'](_0x9cc8('0xa0'))[_0x9cc8('0xa1')]([_0x9cc8('0xa2'),'scheduledAt',_0x9cc8('0xa3'),_0x9cc8('0xa4'),_0x9cc8('0x63'),_0x9cc8('0x60'),'updatedAt'],squel[_0x9cc8('0xa5')]()[_0x9cc8('0x80')]('phone',_0x9cc8('0xa2'))['field']('NOW()',_0x9cc8('0xa6'))[_0x9cc8('0x80')]('id','ContactId')[_0x9cc8('0x80')](_0x19e5de[_0x9cc8('0xa7')]['toString'](),_0x9cc8('0xa4'))[_0x9cc8('0x80')](_0x191669[_0x9cc8('0x5d')]['id'][_0x9cc8('0x89')](),_0x9cc8('0x63'))[_0x9cc8('0x80')](_0x9cc8('0xa8'),_0x9cc8('0x60'))[_0x9cc8('0x80')]('NOW()',_0x9cc8('0x61'))[_0x9cc8('0x82')](_0x9cc8('0xa9'))[_0x9cc8('0x45')](_0x9cc8('0xaa'))[_0x9cc8('0x45')](_0x9cc8('0xab'),_0x19e5de[_0x9cc8('0xa7')][_0x9cc8('0x89')]())['where'](_0x9cc8('0xac'))[_0x9cc8('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9cc8('0xa5')]()[_0x9cc8('0x80')](_0x9cc8('0xad'))[_0x9cc8('0x82')](_0x9cc8('0xae'))['where'](_0x9cc8('0x86'),_0x191669[_0x9cc8('0x5d')]['id']['toString']()))[_0x9cc8('0x45')](_0x9cc8('0xaf'),squel[_0x9cc8('0xa5')]()[_0x9cc8('0x80')]('COALESCE(phone,\x27\x27)')[_0x9cc8('0x82')](_0x9cc8('0xa0'))[_0x9cc8('0x45')]('VoiceQueueId\x20=\x20?',_0x191669[_0x9cc8('0x5d')]['id']['toString']())))[_0x9cc8('0x89')]();break;case'onlyIfOpen':_0x256ba8=squel[_0x9cc8('0x9f')]()[_0x9cc8('0xb0')](_0x9cc8('0xa0'))[_0x9cc8('0xa1')]([_0x9cc8('0xa2'),_0x9cc8('0xa6'),_0x9cc8('0xa3'),'ListId',_0x9cc8('0x63'),_0x9cc8('0x60'),_0x9cc8('0x61')],squel[_0x9cc8('0xa5')]()[_0x9cc8('0x80')](_0x9cc8('0xa2'),'phone')['field'](_0x9cc8('0xa8'),_0x9cc8('0xa6'))[_0x9cc8('0x80')]('id',_0x9cc8('0xa3'))[_0x9cc8('0x80')](_0x19e5de[_0x9cc8('0xa7')][_0x9cc8('0x89')](),_0x9cc8('0xa4'))[_0x9cc8('0x80')](_0x191669[_0x9cc8('0x5d')]['id']['toString'](),_0x9cc8('0x63'))[_0x9cc8('0x80')](_0x9cc8('0xa8'),_0x9cc8('0x60'))['field']('NOW()',_0x9cc8('0x61'))[_0x9cc8('0x82')](_0x9cc8('0xa9'))[_0x9cc8('0x45')](_0x9cc8('0xaa'))[_0x9cc8('0x45')](_0x9cc8('0xab'),_0x19e5de[_0x9cc8('0xa7')]['toString']())['where'](_0x9cc8('0xac'))['where'](_0x9cc8('0xaf'),squel[_0x9cc8('0xa5')]()[_0x9cc8('0x80')](_0x9cc8('0xb1'))['from']('cm_hopper')[_0x9cc8('0x45')](_0x9cc8('0x86'),_0x191669[_0x9cc8('0x5d')]['id']['toString']())))[_0x9cc8('0x89')]();break;default:_0x256ba8=squel['insert']()[_0x9cc8('0xb0')](_0x9cc8('0xa0'))['fromQuery'](['phone','scheduledAt',_0x9cc8('0xa3'),'ListId',_0x9cc8('0x63'),'createdAt','updatedAt'],squel[_0x9cc8('0xa5')]()[_0x9cc8('0x80')](_0x9cc8('0xa2'),'phone')['field'](_0x9cc8('0xa8'),_0x9cc8('0xa6'))[_0x9cc8('0x80')]('id',_0x9cc8('0xa3'))[_0x9cc8('0x80')](_0x19e5de[_0x9cc8('0xa7')][_0x9cc8('0x89')](),_0x9cc8('0xa4'))[_0x9cc8('0x80')](_0x191669[_0x9cc8('0x5d')]['id'][_0x9cc8('0x89')](),'VoiceQueueId')['field']('NOW()',_0x9cc8('0x60'))[_0x9cc8('0x80')]('NOW()',_0x9cc8('0x61'))['from'](_0x9cc8('0xa9'))[_0x9cc8('0x45')](_0x9cc8('0xaa'))['where'](_0x9cc8('0xab'),_0x19e5de[_0x9cc8('0xa7')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x9cc8('0x89')]();}_0x242809[_0x9cc8('0x88')](db['sequelize']['query'](_0x256ba8));}return BPromise[_0x9cc8('0x8d')](_0x242809);}})[_0x9cc8('0x26')](function(){return _0x532133;})[_0x9cc8('0x26')](respondWithResult(_0x2a8cd1,null))[_0x9cc8('0x4e')](handleError(_0x2a8cd1,null));};exports[_0x9cc8('0xb2')]=function(_0x49353a,_0x388373,_0x1497d9){return db[_0x9cc8('0x35')][_0x9cc8('0x2c')]({'where':{'id':_0x49353a['params']['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x388373,null))[_0x9cc8('0x26')](function(_0x276b42){if(_0x276b42){return _0x276b42[_0x9cc8('0xb2')](_0x49353a[_0x9cc8('0x39')][_0x9cc8('0x7e')]);}})[_0x9cc8('0x26')](function(_0x1d5329){if(_0x1d5329){return db[_0x9cc8('0x62')][_0x9cc8('0x30')]({'where':{'ListId':_0x49353a['query'][_0x9cc8('0x7e')],'VoiceQueueId':_0x49353a[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](function(){return _0x1d5329;});}})[_0x9cc8('0x26')](respondWithStatusCode(_0x388373,null))[_0x9cc8('0x4e')](handleError(_0x388373,null));};exports[_0x9cc8('0xb3')]=function(_0x4ba4d4,_0x80314d,_0x33ab5a){var _0x237e5f={};var _0x26f430={};var _0x390584;var _0x3fabfc;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba4d4[_0x9cc8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x80314d,null))['then'](function(_0xd4c67a){if(_0xd4c67a){_0x390584=_0xd4c67a;_0x26f430[_0x9cc8('0x3d')]=_[_0x9cc8('0x3a')](db[_0x9cc8('0x9a')][_0x9cc8('0x36')]);_0x26f430[_0x9cc8('0x39')]=_[_0x9cc8('0x3a')](_0x4ba4d4['query']);_0x26f430[_0x9cc8('0x3b')]=_[_0x9cc8('0x3c')](_0x26f430[_0x9cc8('0x3d')],_0x26f430[_0x9cc8('0x39')]);_0x237e5f[_0x9cc8('0x3f')]=_['intersection'](_0x26f430[_0x9cc8('0x3d')],qs[_0x9cc8('0x3e')](_0x4ba4d4[_0x9cc8('0x39')][_0x9cc8('0x3e')]));_0x237e5f['attributes']=_0x237e5f[_0x9cc8('0x3f')][_0x9cc8('0x40')]?_0x237e5f[_0x9cc8('0x3f')]:_0x26f430[_0x9cc8('0x3d')];_0x237e5f[_0x9cc8('0x43')]=qs[_0x9cc8('0x44')](_0x4ba4d4[_0x9cc8('0x39')][_0x9cc8('0x44')]);_0x237e5f[_0x9cc8('0x45')]=qs[_0x9cc8('0x3b')](_[_0x9cc8('0x46')](_0x4ba4d4['query'],_0x26f430['filters']));if(_0x4ba4d4[_0x9cc8('0x39')][_0x9cc8('0x47')]){_0x237e5f[_0x9cc8('0x45')]=_[_0x9cc8('0x48')](_0x237e5f[_0x9cc8('0x45')],{'$or':_['map'](_0x237e5f['attributes'],function(_0x5bbf5c){var _0x4cd931={};_0x4cd931[_0x5bbf5c]={'$like':'%'+_0x4ba4d4[_0x9cc8('0x39')][_0x9cc8('0x47')]+'%'};return _0x4cd931;})});}_0x237e5f=_[_0x9cc8('0x48')]({},_0x237e5f,_0x4ba4d4[_0x9cc8('0x4a')]);return _0x390584[_0x9cc8('0xb3')](_0x237e5f);}})[_0x9cc8('0x26')](function(_0x5f436f){if(_0x5f436f){_0x3fabfc=_0x5f436f[_0x9cc8('0x40')];if(!_0x4ba4d4[_0x9cc8('0x39')]['hasOwnProperty'](_0x9cc8('0x42'))){_0x237e5f[_0x9cc8('0x21')]=qs[_0x9cc8('0x21')](_0x4ba4d4[_0x9cc8('0x39')][_0x9cc8('0x21')]);_0x237e5f[_0x9cc8('0x20')]=qs['offset'](_0x4ba4d4[_0x9cc8('0x39')][_0x9cc8('0x20')]);}return _0x390584[_0x9cc8('0xb3')](_0x237e5f);}})[_0x9cc8('0x26')](function(_0x4f1e64){if(_0x4f1e64){return _0x4f1e64?{'count':_0x3fabfc,'rows':_0x4f1e64}:null;}})[_0x9cc8('0x26')](respondWithResult(_0x80314d,null))[_0x9cc8('0x4e')](handleError(_0x80314d,null));};exports['addBlackLists']=function(_0x273145,_0x288918,_0x5d2172){var _0x5d412e,_0x3173a6;return db[_0x9cc8('0x35')][_0x9cc8('0x2c')]({'where':{'id':_0x273145[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x288918,null))[_0x9cc8('0x26')](function(_0x2e8c66){if(_0x2e8c66){_0x3173a6=_0x2e8c66;return _0x2e8c66['addBlackLists'](_0x273145[_0x9cc8('0x51')]['ids'],_[_0x9cc8('0x5f')](_0x273145['body'],[_0x9cc8('0x7e'),'id'])||{});}return null;})[_0x9cc8('0x91')](function(_0x349f96){var _0x111fc3;_0x5d412e=_0x349f96||[];var _0x5b4e39=[];if(_0x349f96){for(var _0x372b78=0x0;_0x372b78<_0x349f96['length'];_0x372b78+=0x1){var _0xd2d185=_0x349f96[_0x372b78]['get']({'plain':!![]});_0x111fc3=squel[_0x9cc8('0x9f')]()[_0x9cc8('0xb0')]('cm_hopper_black')[_0x9cc8('0xa1')](['phone',_0x9cc8('0xa3'),_0x9cc8('0xa4'),_0x9cc8('0x63'),'createdAt','updatedAt'],squel[_0x9cc8('0xa5')]()[_0x9cc8('0x80')]('phone',_0x9cc8('0xa2'))[_0x9cc8('0x80')]('id',_0x9cc8('0xa3'))[_0x9cc8('0x80')](_0xd2d185['CmListId'][_0x9cc8('0x89')](),'ListId')['field'](_0x273145['params']['id']['toString'](),_0x9cc8('0x63'))[_0x9cc8('0x80')](_0x9cc8('0xa8'),_0x9cc8('0x60'))[_0x9cc8('0x80')](_0x9cc8('0xa8'),_0x9cc8('0x61'))[_0x9cc8('0x82')]('cm_contacts')[_0x9cc8('0x45')](_0x9cc8('0xaa'))[_0x9cc8('0x45')](_0x9cc8('0xab'),_0xd2d185['CmListId']['toString']())[_0x9cc8('0x45')](_0x9cc8('0xac')))[_0x9cc8('0x89')]();_0x5b4e39[_0x9cc8('0x88')](db[_0x9cc8('0x72')][_0x9cc8('0x39')](_0x111fc3));}return BPromise['all'](_0x5b4e39);}})[_0x9cc8('0x26')](function(){return _0x5d412e;})[_0x9cc8('0x26')](respondWithResult(_0x288918,null))[_0x9cc8('0x4e')](handleError(_0x288918,null));};exports[_0x9cc8('0xb4')]=function(_0x3c2ff6,_0x2c9591,_0x5e55fa){return db[_0x9cc8('0x35')][_0x9cc8('0x2c')]({'where':{'id':_0x3c2ff6[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](handleEntityNotFound(_0x2c9591,null))['then'](function(_0x9197d3){if(_0x9197d3){return _0x9197d3[_0x9cc8('0xb4')](_0x3c2ff6[_0x9cc8('0x39')][_0x9cc8('0x7e')]);}})[_0x9cc8('0x26')](function(_0xbcf12a){if(_0xbcf12a){return db[_0x9cc8('0x68')][_0x9cc8('0x30')]({'where':{'ListId':_0x3c2ff6[_0x9cc8('0x39')][_0x9cc8('0x7e')],'VoiceQueueId':_0x3c2ff6[_0x9cc8('0x5d')]['id']}})[_0x9cc8('0x26')](function(){return _0xbcf12a;});}})[_0x9cc8('0x26')](respondWithStatusCode(_0x2c9591,null))[_0x9cc8('0x4e')](handleError(_0x2c9591,null));}; \ No newline at end of file +var _0x8d8e=['role','UserProfileSection','destroy','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','Agents','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','voicePause','emit','userVoiceQueue:save','ids','User','select','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','spread','online','isNil','removeAgents','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','json','count','offset','limit','set','apply','save','update','then','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','end','sendStatus','error','stack','send','index','VoiceQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt'];(function(_0x24dbad,_0x38302c){var _0x8624ac=function(_0x532198){while(--_0x532198){_0x24dbad['push'](_0x24dbad['shift']());}};_0x8624ac(++_0x38302c);}(_0x8d8e,0x112));var _0xe8d8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8d8e[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0xe8d8('0x0'));var emlformat=require(_0xe8d8('0x1'));var rimraf=require(_0xe8d8('0x2'));var zipdir=require(_0xe8d8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe8d8('0x4'));var BPromise=require(_0xe8d8('0x5'));var Mustache=require(_0xe8d8('0x6'));var util=require(_0xe8d8('0x7'));var path=require(_0xe8d8('0x8'));var sox=require(_0xe8d8('0x9'));var csv=require(_0xe8d8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe8d8('0xb'));var squel=require(_0xe8d8('0xc'));var crypto=require(_0xe8d8('0xd'));var jsforce=require(_0xe8d8('0xe'));var deskjs=require(_0xe8d8('0xf'));var toCsv=require(_0xe8d8('0xa'));var querystring=require(_0xe8d8('0x10'));var Papa=require(_0xe8d8('0x11'));var Redis=require(_0xe8d8('0x12'));var authService=require(_0xe8d8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe8d8('0x14'));var hardwareService=require(_0xe8d8('0x15'));var logger=require(_0xe8d8('0x16'))(_0xe8d8('0x17'));var utils=require('../../config/utils');var config=require(_0xe8d8('0x18'));var db=require(_0xe8d8('0x19'))['db'];config[_0xe8d8('0x1a')]=_['defaults'](config[_0xe8d8('0x1a')],{'host':_0xe8d8('0x1b'),'port':0x18eb});var socket=require(_0xe8d8('0x1c'))(new Redis(config[_0xe8d8('0x1a')]));require(_0xe8d8('0x1d'))[_0xe8d8('0x1e')](socket);function respondWithStatusCode(_0x572595,_0x581a00){_0x581a00=_0x581a00||0xcc;return function(_0x2e3b64){if(_0x2e3b64){return _0x572595['sendStatus'](_0x581a00);}return _0x572595[_0xe8d8('0x1f')](_0x581a00)['end']();};}function respondWithResult(_0x5d7881,_0x522e5e){_0x522e5e=_0x522e5e||0xc8;return function(_0x1b6f62){if(_0x1b6f62){return _0x5d7881['status'](_0x522e5e)[_0xe8d8('0x20')](_0x1b6f62);}};}function respondWithFilteredResult(_0x2a5195,_0x23b4ce){return function(_0x5a6cf2){if(_0x5a6cf2){var _0x3a372b=_0x5a6cf2[_0xe8d8('0x21')],_0x4f9408=_0x23b4ce['offset'],_0x249e5c=_0x23b4ce[_0xe8d8('0x22')]+_0x23b4ce[_0xe8d8('0x23')],_0x520507;if(_0x249e5c>=_0x3a372b){_0x249e5c=_0x3a372b;_0x520507=0xc8;}else{_0x520507=0xce;}_0x2a5195['status'](_0x520507);return _0x2a5195[_0xe8d8('0x24')]('Content-Range',_0x4f9408+'-'+_0x249e5c+'/'+_0x3a372b)['json'](_0x5a6cf2);}return null;};}function patchUpdates(_0x2e805a){return function(_0xdc24c8){try{jsonpatch[_0xe8d8('0x25')](_0xdc24c8,_0x2e805a,!![]);}catch(_0x550bd9){return BPromise['reject'](_0x550bd9);}return _0xdc24c8[_0xe8d8('0x26')]();};}function saveUpdates(_0x362042,_0x554a7f){return function(_0x57e3ec){if(_0x57e3ec){return _0x57e3ec[_0xe8d8('0x27')](_0x362042)[_0xe8d8('0x28')](function(_0x883feb){return _0x883feb;});}return null;};}function removeEntity(_0x43cdf7,_0x576144){return function(_0x1b213f){if(_0x1b213f){return _0x1b213f['destroy']()[_0xe8d8('0x28')](function(){var _0x2453cb=_0x1b213f['get']({'plain':!![]});var _0x1a54c6=[{'name':_0xe8d8('0x29'),'value':_0xe8d8('0x2a'),'ignore':![]},{'name':_0xe8d8('0x2b'),'value':'outbound','ignore':![]}];var _0x1c4388=_(_0x1a54c6)[_0xe8d8('0x2c')]('ignore')[_0xe8d8('0x2d')](_0xe8d8('0x2e'))[_0xe8d8('0x2e')]();if(_[_0xe8d8('0x2f')](_0x1c4388,_0x2453cb[_0xe8d8('0x30')])){return;}var _0x47a276=_[_0xe8d8('0x31')](_0x1a54c6,[_0xe8d8('0x2e'),_0x2453cb[_0xe8d8('0x30')]])[_0xe8d8('0x32')];return db[_0xe8d8('0x33')]['destroy']({'where':{'type':_0x47a276,'resourceId':_0x2453cb['id']}})['then'](function(){return _0x1b213f;});})['then'](function(){_0x43cdf7[_0xe8d8('0x1f')](0xcc)[_0xe8d8('0x34')]();});}};}function handleEntityNotFound(_0x51322d,_0x4796e5){return function(_0x2cefd3){if(!_0x2cefd3){_0x51322d[_0xe8d8('0x35')](0x194);}return _0x2cefd3;};}function handleError(_0x37a235,_0x43eff0){_0x43eff0=_0x43eff0||0x1f4;return function(_0x4e456f){logger[_0xe8d8('0x36')](_0x4e456f[_0xe8d8('0x37')]);if(_0x4e456f['name']){delete _0x4e456f[_0xe8d8('0x32')];}_0x37a235[_0xe8d8('0x1f')](_0x43eff0)[_0xe8d8('0x38')](_0x4e456f);};}exports[_0xe8d8('0x39')]=function(_0x17f829,_0x5a3a5b){var _0x30e951={},_0x11892a={},_0x371084={'count':0x0,'rows':[]};var _0x25fa3a=_[_0xe8d8('0x2d')](db[_0xe8d8('0x3a')]['rawAttributes'],function(_0x30d69a){return{'name':_0x30d69a[_0xe8d8('0x3b')],'type':_0x30d69a[_0xe8d8('0x30')][_0xe8d8('0x3c')]};});_0x11892a[_0xe8d8('0x3d')]=_[_0xe8d8('0x2d')](_0x25fa3a,_0xe8d8('0x32'));_0x11892a[_0xe8d8('0x3e')]=_['keys'](_0x17f829[_0xe8d8('0x3e')]);_0x11892a[_0xe8d8('0x3f')]=_[_0xe8d8('0x40')](_0x11892a[_0xe8d8('0x3d')],_0x11892a[_0xe8d8('0x3e')]);_0x30e951[_0xe8d8('0x41')]=_[_0xe8d8('0x40')](_0x11892a[_0xe8d8('0x3d')],qs[_0xe8d8('0x42')](_0x17f829[_0xe8d8('0x3e')][_0xe8d8('0x42')]));_0x30e951[_0xe8d8('0x41')]=_0x30e951[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x30e951[_0xe8d8('0x41')]:_0x11892a[_0xe8d8('0x3d')];if(!_0x17f829['query']['hasOwnProperty']('nolimit')){_0x30e951['limit']=qs['limit'](_0x17f829[_0xe8d8('0x3e')][_0xe8d8('0x23')]);_0x30e951[_0xe8d8('0x22')]=qs['offset'](_0x17f829[_0xe8d8('0x3e')][_0xe8d8('0x22')]);}_0x30e951[_0xe8d8('0x44')]=qs[_0xe8d8('0x45')](_0x17f829[_0xe8d8('0x3e')][_0xe8d8('0x45')]);_0x30e951['where']=qs[_0xe8d8('0x3f')](_[_0xe8d8('0x46')](_0x17f829[_0xe8d8('0x3e')],_0x11892a[_0xe8d8('0x3f')]),_0x25fa3a);if(_0x17f829['query'][_0xe8d8('0x2c')]){_0x30e951[_0xe8d8('0x47')]=_[_0xe8d8('0x48')](_0x30e951['where'],{'$or':_[_0xe8d8('0x2d')](_0x25fa3a,function(_0x1b2c8b){if(_0x1b2c8b['type']!==_0xe8d8('0x49')){var _0x22db5e={};_0x22db5e[_0x1b2c8b[_0xe8d8('0x32')]]={'$like':'%'+_0x17f829[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0x22db5e;}})});}_0x30e951=_[_0xe8d8('0x48')]({},_0x30e951,_0x17f829[_0xe8d8('0x4a')]);var _0x1079d8={'where':_0x30e951['where']};return db[_0xe8d8('0x3a')]['count'](_0x1079d8)[_0xe8d8('0x28')](function(_0x14d88b){_0x371084[_0xe8d8('0x21')]=_0x14d88b;if(_0x17f829[_0xe8d8('0x3e')][_0xe8d8('0x4b')]){_0x30e951['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xe8d8('0x4c')](_0x30e951);})[_0xe8d8('0x28')](function(_0x2caa68){_0x371084[_0xe8d8('0x4d')]=_0x2caa68;return _0x371084;})[_0xe8d8('0x28')](respondWithFilteredResult(_0x5a3a5b,_0x30e951))[_0xe8d8('0x4e')](handleError(_0x5a3a5b,null));};exports[_0xe8d8('0x4f')]=function(_0x32e1b9,_0x245688){var _0xd17162={'raw':![],'where':{'id':_0x32e1b9[_0xe8d8('0x50')]['id']}},_0x226d8a={};_0x226d8a[_0xe8d8('0x3d')]=_[_0xe8d8('0x51')](db['VoiceQueue'][_0xe8d8('0x52')]);_0x226d8a[_0xe8d8('0x3e')]=_[_0xe8d8('0x51')](_0x32e1b9[_0xe8d8('0x3e')]);_0x226d8a['filters']=_[_0xe8d8('0x40')](_0x226d8a[_0xe8d8('0x3d')],_0x226d8a[_0xe8d8('0x3e')]);_0xd17162[_0xe8d8('0x41')]=_[_0xe8d8('0x40')](_0x226d8a[_0xe8d8('0x3d')],qs[_0xe8d8('0x42')](_0x32e1b9['query'][_0xe8d8('0x42')]));_0xd17162[_0xe8d8('0x41')]=_0xd17162[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0xd17162[_0xe8d8('0x41')]:_0x226d8a[_0xe8d8('0x3d')];if(_0x32e1b9['query'][_0xe8d8('0x4b')]){_0xd17162[_0xe8d8('0x53')]=[{'all':!![]}];}_0xd17162=_[_0xe8d8('0x48')]({},_0xd17162,_0x32e1b9[_0xe8d8('0x4a')]);return db[_0xe8d8('0x3a')][_0xe8d8('0x31')](_0xd17162)['then'](handleEntityNotFound(_0x245688,null))[_0xe8d8('0x28')](respondWithResult(_0x245688,null))[_0xe8d8('0x4e')](handleError(_0x245688,null));};exports[_0xe8d8('0x54')]=function(_0x44508d,_0x584120){return db[_0xe8d8('0x3a')][_0xe8d8('0x54')](_0x44508d[_0xe8d8('0x55')],{})[_0xe8d8('0x28')](function(_0x50d723){var _0x513055=_0x44508d['user'][_0xe8d8('0x56')]({'plain':!![]});if(!_0x513055)throw new Error(_0xe8d8('0x57'));if(_0x513055['role']===_0xe8d8('0x58')){var _0x119969=_0x50d723[_0xe8d8('0x56')]({'plain':!![]});var _0xb3073f=[{'name':_0xe8d8('0x29'),'value':'inbound'},{'name':_0xe8d8('0x2b'),'value':_0xe8d8('0x59')}];var _0x32c68c=_[_0xe8d8('0x31')](_0xb3073f,[_0xe8d8('0x2e'),_0x119969['type']])[_0xe8d8('0x32')];return db['UserProfileSection']['find']({'where':{'name':_0x32c68c,'userProfileId':_0x513055[_0xe8d8('0x5a')]},'raw':!![]})[_0xe8d8('0x28')](function(_0x70c1ce){if(_0x70c1ce&&_0x70c1ce[_0xe8d8('0x5b')]===0x0){return db[_0xe8d8('0x33')][_0xe8d8('0x54')]({'name':_0x119969['name'],'resourceId':_0x119969['id'],'type':_0x70c1ce[_0xe8d8('0x32')],'sectionId':_0x70c1ce['id']},{})[_0xe8d8('0x28')](function(){return _0x50d723;});}else{return _0x50d723;}})[_0xe8d8('0x4e')](function(_0x34fe0c){logger['error'](_0xe8d8('0x5c'),_0x34fe0c);throw _0x34fe0c;});}return _0x50d723;})['then'](respondWithResult(_0x584120,0xc9))[_0xe8d8('0x4e')](handleError(_0x584120,null));};exports['clone']=function(_0x40e884,_0x1faa46){var _0x22af19={'where':{'id':_0x40e884['params']['id']}},_0xbdface={};_0xbdface[_0xe8d8('0x3d')]=_[_0xe8d8('0x51')](db['VoiceQueue'][_0xe8d8('0x52')]);_0x22af19['attributes']=_['intersection'](_0xbdface[_0xe8d8('0x3d')],qs[_0xe8d8('0x42')](_0x40e884['query'][_0xe8d8('0x42')]));_0x22af19[_0xe8d8('0x41')]=_0x22af19[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x22af19[_0xe8d8('0x41')]:_0xbdface[_0xe8d8('0x3d')];if(_0x40e884[_0xe8d8('0x3e')][_0xe8d8('0x4b')]){_0x22af19[_0xe8d8('0x53')]=[{'all':!![]}];}_0x22af19=_[_0xe8d8('0x48')]({},_0x22af19,_0x40e884[_0xe8d8('0x4a')]);return db[_0xe8d8('0x3a')][_0xe8d8('0x31')](_0x22af19)[_0xe8d8('0x28')](handleEntityNotFound(_0x1faa46,null))['then'](function(_0x2ee2c2){if(_0x2ee2c2){var _0x577ef5=_0x2ee2c2[_0xe8d8('0x56')]({'plain':!![]});_0x577ef5=qs[_0xe8d8('0x5d')](_0x577ef5,['id',_0xe8d8('0x5e'),_0xe8d8('0x5f')]);_0x40e884['body']=_['omit'](_0x40e884[_0xe8d8('0x55')],['id',_0xe8d8('0x5e'),_0xe8d8('0x5f')]);return db[_0xe8d8('0x3a')][_0xe8d8('0x54')](_[_0xe8d8('0x48')](_0x577ef5,_0x40e884[_0xe8d8('0x55')]),{'include':_0x40e884[_0xe8d8('0x3e')][_0xe8d8('0x4b')]?[{'all':!![]}]:undefined})[_0xe8d8('0x28')](function(_0x22c4a2){var _0x262623=_0x40e884[_0xe8d8('0x58')][_0xe8d8('0x56')]({'plain':!![]});if(!_0x262623)throw new Error(_0xe8d8('0x57'));if(_0x262623[_0xe8d8('0x60')]===_0xe8d8('0x58')){var _0x2843ca=_0x22c4a2['get']({'plain':!![]});var _0x1227f4=[{'name':_0xe8d8('0x29'),'value':_0xe8d8('0x2a')},{'name':_0xe8d8('0x2b'),'value':_0xe8d8('0x59')}];var _0x41c8c7=_[_0xe8d8('0x31')](_0x1227f4,[_0xe8d8('0x2e'),_0x2843ca[_0xe8d8('0x30')]])['name'];return db[_0xe8d8('0x61')][_0xe8d8('0x31')]({'where':{'name':_0x41c8c7,'userProfileId':_0x262623[_0xe8d8('0x5a')]},'raw':!![]})[_0xe8d8('0x28')](function(_0x37e246){if(_0x37e246&&_0x37e246[_0xe8d8('0x5b')]===0x0){return db['UserProfileResource'][_0xe8d8('0x54')]({'name':_0x2843ca[_0xe8d8('0x32')],'resourceId':_0x2843ca['id'],'type':_0x37e246[_0xe8d8('0x32')],'sectionId':_0x37e246['id']},{})[_0xe8d8('0x28')](function(){return _0x22c4a2;});}else{return _0x22c4a2;}})[_0xe8d8('0x4e')](function(_0xc07a17){logger[_0xe8d8('0x36')](_0xe8d8('0x5c'),_0xc07a17);throw _0xc07a17;});}return _0x22c4a2;});}})['then'](respondWithResult(_0x1faa46,0xc9))['catch'](handleError(_0x1faa46,null));};exports[_0xe8d8('0x27')]=function(_0x3be4c5,_0x10970c){if(_0x3be4c5['body']['id']){delete _0x3be4c5['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x3be4c5['params']['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x10970c,null))[_0xe8d8('0x28')](saveUpdates(_0x3be4c5[_0xe8d8('0x55')],null))[_0xe8d8('0x28')](respondWithResult(_0x10970c,null))['catch'](handleError(_0x10970c,null));};exports[_0xe8d8('0x62')]=function(_0x3821a6,_0x465f68){return db[_0xe8d8('0x3a')][_0xe8d8('0x31')]({'where':{'id':_0x3821a6[_0xe8d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x465f68,null))['then'](removeEntity(_0x465f68,null))[_0xe8d8('0x4e')](handleError(_0x465f68,null));};exports[_0xe8d8('0x63')]=function(_0x3c6223,_0x345454,_0xc875d0){var _0x59ab1a={'raw':![],'where':{}};var _0x5ccb71={};var _0x4a7c07={'count':0x0,'rows':[]};return db[_0xe8d8('0x3a')][_0xe8d8('0x64')]({'where':{'id':_0x3c6223[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x345454,null))[_0xe8d8('0x28')](function(_0x53d5d1){if(_0x53d5d1){_0x5ccb71[_0xe8d8('0x3d')]=_[_0xe8d8('0x51')](db[_0xe8d8('0x65')][_0xe8d8('0x52')]);_0x5ccb71[_0xe8d8('0x3e')]=_[_0xe8d8('0x51')](_0x3c6223[_0xe8d8('0x3e')]);_0x5ccb71[_0xe8d8('0x3f')]=_['intersection'](_0x5ccb71[_0xe8d8('0x3d')],_0x5ccb71[_0xe8d8('0x3e')]);_0x59ab1a[_0xe8d8('0x41')]=_['intersection'](_0x5ccb71[_0xe8d8('0x3d')],qs[_0xe8d8('0x42')](_0x3c6223['query'][_0xe8d8('0x42')]));_0x59ab1a[_0xe8d8('0x41')]=_0x59ab1a[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x59ab1a[_0xe8d8('0x41')]:_0x5ccb71[_0xe8d8('0x3d')];if(!_0x3c6223[_0xe8d8('0x3e')]['hasOwnProperty'](_0xe8d8('0x66'))){_0x59ab1a[_0xe8d8('0x23')]=qs['limit'](_0x3c6223[_0xe8d8('0x3e')][_0xe8d8('0x23')]);_0x59ab1a[_0xe8d8('0x22')]=qs[_0xe8d8('0x22')](_0x3c6223[_0xe8d8('0x3e')][_0xe8d8('0x22')]);}_0x59ab1a[_0xe8d8('0x44')]=qs[_0xe8d8('0x45')](_0x3c6223[_0xe8d8('0x3e')][_0xe8d8('0x45')]);_0x59ab1a[_0xe8d8('0x47')]=qs['filters'](_[_0xe8d8('0x46')](_0x3c6223[_0xe8d8('0x3e')],_0x5ccb71['filters']));_0x59ab1a[_0xe8d8('0x47')][_0xe8d8('0x67')]=_0x53d5d1['id'];if(_0x3c6223['query']['filter']){_0x59ab1a[_0xe8d8('0x47')]=_[_0xe8d8('0x48')](_0x59ab1a['where'],{'$or':_[_0xe8d8('0x2d')](_0x59ab1a['attributes'],function(_0x1cbf5c){var _0x4bb974={};_0x4bb974[_0x1cbf5c]={'$like':'%'+_0x3c6223[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0x4bb974;})});}_0x59ab1a=_[_0xe8d8('0x48')]({},_0x59ab1a,_0x3c6223['options']);return db['CmHopper'][_0xe8d8('0x21')]({'where':_0x59ab1a['where']})['then'](function(_0x44cbc3){_0x4a7c07[_0xe8d8('0x21')]=_0x44cbc3;if(_0x3c6223[_0xe8d8('0x3e')][_0xe8d8('0x4b')]){_0x59ab1a[_0xe8d8('0x53')]=[{'all':!![]}];}return db[_0xe8d8('0x65')][_0xe8d8('0x4c')](_0x59ab1a);})[_0xe8d8('0x28')](function(_0x160768){_0x4a7c07['rows']=_0x160768;return _0x4a7c07;});}})['then'](respondWithFilteredResult(_0x345454,_0x59ab1a))[_0xe8d8('0x4e')](handleError(_0x345454,null));};exports[_0xe8d8('0x68')]=function(_0x2d59b1,_0x42edc4,_0x4f9367){var _0x29b63f={'raw':!![],'where':{}};var _0x28a1d3={};var _0x4915c6={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe8d8('0x64')]({'where':{'id':_0x2d59b1['params']['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x42edc4,null))['then'](function(_0x2e901a){if(_0x2e901a){_0x28a1d3['model']=_[_0xe8d8('0x51')](db[_0xe8d8('0x69')][_0xe8d8('0x52')]);_0x28a1d3[_0xe8d8('0x3e')]=_[_0xe8d8('0x51')](_0x2d59b1[_0xe8d8('0x3e')]);_0x28a1d3['filters']=_['intersection'](_0x28a1d3[_0xe8d8('0x3d')],_0x28a1d3['query']);_0x29b63f['attributes']=_[_0xe8d8('0x40')](_0x28a1d3['model'],qs['fields'](_0x2d59b1[_0xe8d8('0x3e')]['fields']));_0x29b63f[_0xe8d8('0x41')]=_0x29b63f['attributes'][_0xe8d8('0x43')]?_0x29b63f[_0xe8d8('0x41')]:_0x28a1d3[_0xe8d8('0x3d')];if(!_0x2d59b1[_0xe8d8('0x3e')][_0xe8d8('0x6a')](_0xe8d8('0x66'))){_0x29b63f[_0xe8d8('0x23')]=qs['limit'](_0x2d59b1[_0xe8d8('0x3e')][_0xe8d8('0x23')]);_0x29b63f[_0xe8d8('0x22')]=qs[_0xe8d8('0x22')](_0x2d59b1[_0xe8d8('0x3e')][_0xe8d8('0x22')]);}_0x29b63f[_0xe8d8('0x44')]=qs[_0xe8d8('0x45')](_0x2d59b1['query'][_0xe8d8('0x45')]);_0x29b63f[_0xe8d8('0x47')]=qs[_0xe8d8('0x3f')](_[_0xe8d8('0x46')](_0x2d59b1[_0xe8d8('0x3e')],_0x28a1d3[_0xe8d8('0x3f')]));_0x29b63f[_0xe8d8('0x47')][_0xe8d8('0x67')]=_0x2e901a['id'];if(_0x2d59b1[_0xe8d8('0x3e')]['filter']){_0x29b63f['where']=_[_0xe8d8('0x48')](_0x29b63f[_0xe8d8('0x47')],{'$or':_[_0xe8d8('0x2d')](_0x29b63f[_0xe8d8('0x41')],function(_0x4d4e99){var _0xa89dc5={};_0xa89dc5[_0x4d4e99]={'$like':'%'+_0x2d59b1[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0xa89dc5;})});}_0x29b63f=_[_0xe8d8('0x48')]({},_0x29b63f,_0x2d59b1[_0xe8d8('0x4a')]);return db[_0xe8d8('0x69')][_0xe8d8('0x21')]({'where':_0x29b63f[_0xe8d8('0x47')]})[_0xe8d8('0x28')](function(_0x522e45){_0x4915c6[_0xe8d8('0x21')]=_0x522e45;if(_0x2d59b1[_0xe8d8('0x3e')]['includeAll']){_0x29b63f[_0xe8d8('0x53')]=[{'all':!![]}];}return db[_0xe8d8('0x69')][_0xe8d8('0x4c')](_0x29b63f);})[_0xe8d8('0x28')](function(_0x4b431b){_0x4915c6[_0xe8d8('0x4d')]=_0x4b431b;return _0x4915c6;});}})[_0xe8d8('0x28')](respondWithFilteredResult(_0x42edc4,_0x29b63f))[_0xe8d8('0x4e')](handleError(_0x42edc4,null));};exports[_0xe8d8('0x6b')]=function(_0x801700,_0x4ea801,_0x55fa45){var _0x3b4284={'raw':!![],'where':{}};var _0x57224a={};var _0xacd01b={'count':0x0,'rows':[]};return db[_0xe8d8('0x3a')][_0xe8d8('0x64')]({'where':{'id':_0x801700[_0xe8d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x4ea801,null))[_0xe8d8('0x28')](function(_0x1130da){if(_0x1130da){_0x57224a[_0xe8d8('0x3d')]=_['keys'](db['CmHopperFinal'][_0xe8d8('0x52')]);_0x57224a[_0xe8d8('0x3e')]=_[_0xe8d8('0x51')](_0x801700[_0xe8d8('0x3e')]);_0x57224a[_0xe8d8('0x3f')]=_[_0xe8d8('0x40')](_0x57224a['model'],_0x57224a[_0xe8d8('0x3e')]);_0x3b4284[_0xe8d8('0x41')]=_['intersection'](_0x57224a[_0xe8d8('0x3d')],qs['fields'](_0x801700[_0xe8d8('0x3e')][_0xe8d8('0x42')]));_0x3b4284['attributes']=_0x3b4284[_0xe8d8('0x41')]['length']?_0x3b4284['attributes']:_0x57224a[_0xe8d8('0x3d')];if(!_0x801700['query'][_0xe8d8('0x6a')](_0xe8d8('0x66'))){_0x3b4284[_0xe8d8('0x23')]=qs[_0xe8d8('0x23')](_0x801700[_0xe8d8('0x3e')][_0xe8d8('0x23')]);_0x3b4284[_0xe8d8('0x22')]=qs[_0xe8d8('0x22')](_0x801700['query'][_0xe8d8('0x22')]);}_0x3b4284[_0xe8d8('0x44')]=qs[_0xe8d8('0x45')](_0x801700[_0xe8d8('0x3e')]['sort']);_0x3b4284[_0xe8d8('0x47')]=qs['filters'](_[_0xe8d8('0x46')](_0x801700[_0xe8d8('0x3e')],_0x57224a['filters']));_0x3b4284['where']['VoiceQueueId']=_0x1130da['id'];if(_0x801700[_0xe8d8('0x3e')][_0xe8d8('0x2c')]){_0x3b4284[_0xe8d8('0x47')]=_[_0xe8d8('0x48')](_0x3b4284[_0xe8d8('0x47')],{'$or':_[_0xe8d8('0x2d')](_0x3b4284[_0xe8d8('0x41')],function(_0x349760){var _0x26d259={};_0x26d259[_0x349760]={'$like':'%'+_0x801700[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0x26d259;})});}_0x3b4284=_[_0xe8d8('0x48')]({},_0x3b4284,_0x801700['options']);return db[_0xe8d8('0x6c')][_0xe8d8('0x21')]({'where':_0x3b4284[_0xe8d8('0x47')]})[_0xe8d8('0x28')](function(_0x594e3a){_0xacd01b['count']=_0x594e3a;if(_0x801700[_0xe8d8('0x3e')]['includeAll']){_0x3b4284[_0xe8d8('0x53')]=[{'all':!![]}];}return db[_0xe8d8('0x6c')][_0xe8d8('0x4c')](_0x3b4284);})[_0xe8d8('0x28')](function(_0x42db20){_0xacd01b[_0xe8d8('0x4d')]=_0x42db20;return _0xacd01b;});}})[_0xe8d8('0x28')](respondWithFilteredResult(_0x4ea801,_0x3b4284))[_0xe8d8('0x4e')](handleError(_0x4ea801,null));};exports[_0xe8d8('0x6d')]=function(_0x403dea,_0x123ff1,_0x263e77){var _0x34d616={'raw':!![],'where':{}};var _0x4e4628={};var _0x11e70e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe8d8('0x64')]({'where':{'id':_0x403dea[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x123ff1,null))['then'](function(_0x12081c){if(_0x12081c){_0x4e4628[_0xe8d8('0x3d')]=_[_0xe8d8('0x51')](db['CmHopperBlack'][_0xe8d8('0x52')]);_0x4e4628['query']=_[_0xe8d8('0x51')](_0x403dea[_0xe8d8('0x3e')]);_0x4e4628[_0xe8d8('0x3f')]=_[_0xe8d8('0x40')](_0x4e4628[_0xe8d8('0x3d')],_0x4e4628['query']);_0x34d616['attributes']=_[_0xe8d8('0x40')](_0x4e4628[_0xe8d8('0x3d')],qs[_0xe8d8('0x42')](_0x403dea['query']['fields']));_0x34d616[_0xe8d8('0x41')]=_0x34d616[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x34d616['attributes']:_0x4e4628[_0xe8d8('0x3d')];if(!_0x403dea['query'][_0xe8d8('0x6a')](_0xe8d8('0x66'))){_0x34d616[_0xe8d8('0x23')]=qs[_0xe8d8('0x23')](_0x403dea[_0xe8d8('0x3e')][_0xe8d8('0x23')]);_0x34d616[_0xe8d8('0x22')]=qs[_0xe8d8('0x22')](_0x403dea[_0xe8d8('0x3e')][_0xe8d8('0x22')]);}_0x34d616[_0xe8d8('0x44')]=qs[_0xe8d8('0x45')](_0x403dea[_0xe8d8('0x3e')]['sort']);_0x34d616[_0xe8d8('0x47')]=qs[_0xe8d8('0x3f')](_[_0xe8d8('0x46')](_0x403dea[_0xe8d8('0x3e')],_0x4e4628['filters']));_0x34d616['where'][_0xe8d8('0x67')]=_0x12081c['id'];if(_0x403dea['query'][_0xe8d8('0x2c')]){_0x34d616[_0xe8d8('0x47')]=_[_0xe8d8('0x48')](_0x34d616[_0xe8d8('0x47')],{'$or':_[_0xe8d8('0x2d')](_0x34d616['attributes'],function(_0x27bf6){var _0x435995={};_0x435995[_0x27bf6]={'$like':'%'+_0x403dea[_0xe8d8('0x3e')]['filter']+'%'};return _0x435995;})});}_0x34d616=_[_0xe8d8('0x48')]({},_0x34d616,_0x403dea[_0xe8d8('0x4a')]);return db[_0xe8d8('0x6e')]['count']({'where':_0x34d616[_0xe8d8('0x47')]})[_0xe8d8('0x28')](function(_0x43bcbb){_0x11e70e[_0xe8d8('0x21')]=_0x43bcbb;if(_0x403dea['query'][_0xe8d8('0x4b')]){_0x34d616[_0xe8d8('0x53')]=[{'all':!![]}];}return db[_0xe8d8('0x6e')]['findAll'](_0x34d616);})[_0xe8d8('0x28')](function(_0x221ee7){_0x11e70e[_0xe8d8('0x4d')]=_0x221ee7;return _0x11e70e;});}})[_0xe8d8('0x28')](respondWithFilteredResult(_0x123ff1,_0x34d616))['catch'](handleError(_0x123ff1,null));};exports['getTeams']=function(_0x4f4326,_0x84a425,_0x5b7557){var _0x233446={};var _0x18a4ef={};var _0x49a308;var _0x3a737c;return db['VoiceQueue']['findOne']({'where':{'id':_0x4f4326['params']['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x84a425,null))[_0xe8d8('0x28')](function(_0x4c9469){if(_0x4c9469){_0x49a308=_0x4c9469;_0x18a4ef[_0xe8d8('0x3d')]=_[_0xe8d8('0x51')](db[_0xe8d8('0x6f')]['rawAttributes']);_0x18a4ef['query']=_[_0xe8d8('0x51')](_0x4f4326[_0xe8d8('0x3e')]);_0x18a4ef[_0xe8d8('0x3f')]=_[_0xe8d8('0x40')](_0x18a4ef['model'],_0x18a4ef['query']);_0x233446[_0xe8d8('0x41')]=_[_0xe8d8('0x40')](_0x18a4ef[_0xe8d8('0x3d')],qs[_0xe8d8('0x42')](_0x4f4326['query']['fields']));_0x233446['attributes']=_0x233446[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x233446[_0xe8d8('0x41')]:_0x18a4ef[_0xe8d8('0x3d')];_0x233446[_0xe8d8('0x44')]=qs[_0xe8d8('0x45')](_0x4f4326['query'][_0xe8d8('0x45')]);_0x233446[_0xe8d8('0x47')]=qs[_0xe8d8('0x3f')](_['pick'](_0x4f4326[_0xe8d8('0x3e')],_0x18a4ef[_0xe8d8('0x3f')]));if(_0x4f4326['query'][_0xe8d8('0x2c')]){_0x233446[_0xe8d8('0x47')]=_[_0xe8d8('0x48')](_0x233446[_0xe8d8('0x47')],{'$or':_[_0xe8d8('0x2d')](_0x233446[_0xe8d8('0x41')],function(_0x577191){var _0x15db25={};_0x15db25[_0x577191]={'$like':'%'+_0x4f4326[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0x15db25;})});}_0x233446=_[_0xe8d8('0x48')]({},_0x233446,_0x4f4326[_0xe8d8('0x4a')]);return _0x49a308[_0xe8d8('0x70')](_0x233446);}})[_0xe8d8('0x28')](function(_0x44a823){if(_0x44a823){_0x3a737c=_0x44a823[_0xe8d8('0x43')];if(!_0x4f4326[_0xe8d8('0x3e')][_0xe8d8('0x6a')](_0xe8d8('0x66'))){_0x233446[_0xe8d8('0x23')]=qs['limit'](_0x4f4326[_0xe8d8('0x3e')]['limit']);_0x233446[_0xe8d8('0x22')]=qs['offset'](_0x4f4326[_0xe8d8('0x3e')][_0xe8d8('0x22')]);}return _0x49a308['getTeams'](_0x233446);}})['then'](function(_0x173dbd){if(_0x173dbd){return _0x173dbd?{'count':_0x3a737c,'rows':_0x173dbd}:null;}})[_0xe8d8('0x28')](respondWithResult(_0x84a425,null))[_0xe8d8('0x4e')](handleError(_0x84a425,null));};exports[_0xe8d8('0x71')]=function(_0x12de28,_0x13e156,_0x348f04){var _0x121a46=_0x12de28[_0xe8d8('0x55')]['teams'];var _0x1fb6a5=_[_0xe8d8('0x2d')](_0x121a46,'id');return db[_0xe8d8('0x6f')][_0xe8d8('0x4c')]({'where':{'id':_0x1fb6a5},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe8d8('0x72'),'attributes':['id',_0xe8d8('0x32'),'online','voicePause',_0xe8d8('0x73')],'raw':!![]}]})['then'](function(_0x149b3b){if(_0x149b3b){var _0x1efa65=_[_0xe8d8('0x74')](_0x149b3b,function(_0x587f12){var _0x2b6e28=_0x587f12[_0xe8d8('0x56')]({'plain':!![]});_0x2b6e28[_0xe8d8('0x72')][_0xe8d8('0x75')](function(_0x504ad9){_0x504ad9[_0xe8d8('0x76')]=_[_0xe8d8('0x31')](_0x121a46,{'id':_0x2b6e28['id']})[_0xe8d8('0x76')];});return _0x2b6e28[_0xe8d8('0x72')];});return db[_0xe8d8('0x3a')]['find']({'where':{'id':_0x12de28[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](function(_0x49beae){return db[_0xe8d8('0x77')][_0xe8d8('0x78')](function(_0x485937){return _0x49beae[_0xe8d8('0x71')](_0x1fb6a5,{'transaction':_0x485937})[_0xe8d8('0x28')](function(){return BPromise[_0xe8d8('0x79')](_0x1efa65,function(_0x101064){return db[_0xe8d8('0x7a')][_0xe8d8('0x7b')]({'where':{'UserId':_0x101064['id'],'VoiceQueueId':_0x12de28[_0xe8d8('0x50')]['id']},'defaults':{'penalty':_0x101064['penalty']},'transaction':_0x485937});});})[_0xe8d8('0x28')](function(){return BPromise[_0xe8d8('0x79')](_[_0xe8d8('0x2c')](_0x1efa65,{'online':!![]}),function(_0x28f289){return db[_0xe8d8('0x7c')][_0xe8d8('0x7d')]({'membername':_0x28f289['name'],'UserId':_0x28f289['id'],'queue_name':_0x49beae['name'],'VoiceQueueId':_0x49beae['id'],'interface':_['isNil'](_0x28f289[_0xe8d8('0x73')])?util[_0xe8d8('0x7e')]('SIP/%s',_0x28f289[_0xe8d8('0x32')]):_0x28f289[_0xe8d8('0x73')],'paused':_0x28f289[_0xe8d8('0x7f')]||![],'penalty':_0x28f289['penalty']},{'transaction':_0x485937});});})[_0xe8d8('0x28')](function(){_0x1efa65[_0xe8d8('0x75')](function(_0x13adf7){socket[_0xe8d8('0x80')](_0xe8d8('0x81'),{'UserId':_0x13adf7['id'],'VoiceQueueId':_0x49beae['id']});});});});});}})[_0xe8d8('0x28')](respondWithStatusCode(_0x13e156,null))['catch'](handleError(_0x13e156,null));};exports['removeTeams']=function(_0x143768,_0x4e3e3d,_0x4b8af5){return db[_0xe8d8('0x6f')][_0xe8d8('0x4c')]({'where':{'id':_0x143768[_0xe8d8('0x3e')][_0xe8d8('0x82')]},'attributes':['id'],'include':[{'model':db[_0xe8d8('0x83')],'as':_0xe8d8('0x72'),'attributes':['id'],'raw':!![]}]})[_0xe8d8('0x28')](handleEntityNotFound(_0x4e3e3d,null))[_0xe8d8('0x28')](function(_0x32373f){var _0x392d25=_[_0xe8d8('0x2d')](_0x32373f,'id');var _0x15ecd6=[];var _0x96aff8=[];var _0x2a43d9=squel[_0xe8d8('0x84')]();_0x2a43d9['field']('tq.TeamId')['from']('team_has_voice_queues','tq')[_0xe8d8('0x85')]('user_has_teams','ut',_0xe8d8('0x86'))[_0xe8d8('0x47')](_0xe8d8('0x87'),_0x143768['params']['id']);for(var _0x1beb7d=0x0;_0x1beb7d<_0x32373f[_0xe8d8('0x43')];_0x1beb7d+=0x1){let _0x101e81=_0x32373f[_0x1beb7d];for(var _0x2c84d8=0x0;_0x2c84d8<_0x101e81[_0xe8d8('0x72')]['length'];_0x2c84d8+=0x1){let _0x109830=_0x101e81[_0xe8d8('0x72')][_0x2c84d8];var _0x455b9a=_0x2a43d9[_0xe8d8('0x88')]();_0x455b9a[_0xe8d8('0x47')](_0xe8d8('0x89'),_0x109830['id']);_0x96aff8[_0xe8d8('0x8a')](db[_0xe8d8('0x77')][_0xe8d8('0x3e')](_0x455b9a[_0xe8d8('0x8b')](),{'type':db[_0xe8d8('0x77')][_0xe8d8('0x8c')]['SELECT']})[_0xe8d8('0x28')](function(_0x49300a){if(_0x49300a['length']===0x1){return _0x109830['id'];}else{var _0x1862fd=_[_0xe8d8('0x8d')](_[_0xe8d8('0x2d')](_0x49300a,'TeamId'),function(_0x101561){return _['includes'](_0x392d25,_0x101561);});if(_0x1862fd){return _0x109830['id'];}}}));}}return BPromise[_0xe8d8('0x8e')](_0x96aff8)[_0xe8d8('0x28')](function(_0x304d03){_0x15ecd6=_(_0x15ecd6)[_0xe8d8('0x8f')](_0x304d03)[_0xe8d8('0x90')]()['value']();return db[_0xe8d8('0x3a')][_0xe8d8('0x31')]({'where':{'id':_0x143768[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](function(_0x5b3e6f){return db[_0xe8d8('0x77')][_0xe8d8('0x78')](function(_0x23bc19){return _0x5b3e6f[_0xe8d8('0x91')](_0x143768['query'][_0xe8d8('0x82')],{'transaction':_0x23bc19})[_0xe8d8('0x28')](function(){if(!_[_0xe8d8('0x92')](_0x15ecd6)){return _0x5b3e6f['removeAgents'](_0x15ecd6,{'transaction':_0x23bc19})['then'](function(){return db[_0xe8d8('0x7c')][_0xe8d8('0x62')]({'where':{'VoiceQueueId':_0x143768[_0xe8d8('0x50')]['id'],'UserId':_0x15ecd6},'transaction':_0x23bc19});});}})[_0xe8d8('0x28')](function(){_0x15ecd6[_0xe8d8('0x75')](function(_0x22ab5e){socket['emit'](_0xe8d8('0x93'),{'UserId':_0x22ab5e,'VoiceQueueId':_0x5b3e6f['id']});});});});});});})[_0xe8d8('0x28')](respondWithStatusCode(_0x4e3e3d,null))[_0xe8d8('0x4e')](handleError(_0x4e3e3d,null));};exports[_0xe8d8('0x94')]=function(_0x3ca0f2,_0x33e8b1,_0xd70626){var _0x3bd347,_0x856bbc;return db['VoiceQueue'][_0xe8d8('0x31')]({'where':{'id':_0x3ca0f2[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x33e8b1,null))[_0xe8d8('0x28')](function(_0x442e1d){if(_0x442e1d){_0x856bbc=_0x442e1d;return _0x442e1d[_0xe8d8('0x94')](_0x3ca0f2[_0xe8d8('0x55')][_0xe8d8('0x82')],_[_0xe8d8('0x5d')](_0x3ca0f2[_0xe8d8('0x55')],[_0xe8d8('0x82'),'id'])||{})[_0xe8d8('0x95')](function(_0x1ed1ff){for(var _0x3cb9d5=0x0;_0x3cb9d5<_0x3ca0f2[_0xe8d8('0x55')]['ids'][_0xe8d8('0x43')];_0x3cb9d5+=0x1){socket['emit'](_0xe8d8('0x81'),{'UserId':_0x3ca0f2['body'][_0xe8d8('0x82')][_0x3cb9d5],'VoiceQueueId':_0x3ca0f2[_0xe8d8('0x50')]['id']});}return _0x1ed1ff;});}})[_0xe8d8('0x28')](function(_0x355212){_0x3bd347=_0x355212||[];if(_0x856bbc){return db[_0xe8d8('0x83')][_0xe8d8('0x4c')]({'where':{'id':_0x3ca0f2[_0xe8d8('0x55')][_0xe8d8('0x82')]},'attributes':['id',_0xe8d8('0x32'),_0xe8d8('0x96'),_0xe8d8('0x7f'),_0xe8d8('0x73')],'raw':!![]});}})[_0xe8d8('0x28')](function(_0x16d616){if(!_[_0xe8d8('0x92')](_0x16d616)){var _0x13545c=[];for(var _0x2969bb=0x0;_0x2969bb<_0x16d616['length'];_0x2969bb++){if(_0x16d616[_0x2969bb][_0xe8d8('0x96')]){_0x13545c[_0xe8d8('0x8a')](db[_0xe8d8('0x7c')]['upsert']({'membername':_0x16d616[_0x2969bb]['name'],'UserId':_0x16d616[_0x2969bb]['id'],'queue_name':_0x856bbc[_0xe8d8('0x32')],'VoiceQueueId':_0x856bbc['id'],'interface':_[_0xe8d8('0x97')](_0x16d616[_0x2969bb][_0xe8d8('0x73')])?util[_0xe8d8('0x7e')]('SIP/%s',_0x16d616[_0x2969bb]['name']):_0x16d616[_0x2969bb][_0xe8d8('0x73')],'paused':_0x16d616[_0x2969bb][_0xe8d8('0x7f')]||![],'penalty':_0x3ca0f2['body'][_0xe8d8('0x76')]||0x0}));}}return BPromise[_0xe8d8('0x8e')](_0x13545c);}})[_0xe8d8('0x28')](function(){return _0x3bd347;})[_0xe8d8('0x28')](respondWithResult(_0x33e8b1,null))[_0xe8d8('0x4e')](handleError(_0x33e8b1,null));};exports[_0xe8d8('0x98')]=function(_0x2d5e7f,_0x188d4b,_0x5173ff){return db[_0xe8d8('0x3a')][_0xe8d8('0x31')]({'where':{'id':_0x2d5e7f['params']['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x188d4b,null))['then'](function(_0x1523fb){if(_0x1523fb){return _0x1523fb[_0xe8d8('0x98')](_0x2d5e7f[_0xe8d8('0x3e')][_0xe8d8('0x82')])[_0xe8d8('0x28')](function(){if(_['isArray'](_0x2d5e7f[_0xe8d8('0x3e')][_0xe8d8('0x82')])){for(var _0x2f73cc=0x0;_0x2f73cc<_0x2d5e7f[_0xe8d8('0x3e')][_0xe8d8('0x82')][_0xe8d8('0x43')];_0x2f73cc+=0x1){socket[_0xe8d8('0x80')](_0xe8d8('0x93'),{'UserId':Number(_0x2d5e7f[_0xe8d8('0x3e')][_0xe8d8('0x82')][_0x2f73cc]),'VoiceQueueId':Number(_0x2d5e7f['params']['id'])});}}else{socket['emit'](_0xe8d8('0x93'),{'UserId':Number(_0x2d5e7f['query'][_0xe8d8('0x82')]),'VoiceQueueId':Number(_0x2d5e7f[_0xe8d8('0x50')]['id'])});}});}})[_0xe8d8('0x28')](function(_0x26e10d){return db[_0xe8d8('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x2d5e7f[_0xe8d8('0x50')]['id'],'UserId':_0x2d5e7f[_0xe8d8('0x3e')]['ids']}})[_0xe8d8('0x28')](function(){return _0x26e10d;});})[_0xe8d8('0x28')](respondWithStatusCode(_0x188d4b,null))['catch'](handleError(_0x188d4b,null));};exports[_0xe8d8('0x99')]=function(_0x10c3f2,_0x48fec5,_0x4ac5e8){var _0x540650={};var _0x144326={};var _0x3973cf;var _0x41743e;return db[_0xe8d8('0x3a')][_0xe8d8('0x64')]({'where':{'id':_0x10c3f2[_0xe8d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x48fec5,null))[_0xe8d8('0x28')](function(_0x592f59){if(_0x592f59){_0x3973cf=_0x592f59;_0x144326['model']=_[_0xe8d8('0x51')](db[_0xe8d8('0x83')]['rawAttributes']);_0x144326['query']=_[_0xe8d8('0x51')](_0x10c3f2['query']);_0x144326[_0xe8d8('0x3f')]=_[_0xe8d8('0x40')](_0x144326['model'],_0x144326[_0xe8d8('0x3e')]);_0x540650['attributes']=_[_0xe8d8('0x40')](_0x144326[_0xe8d8('0x3d')],qs[_0xe8d8('0x42')](_0x10c3f2[_0xe8d8('0x3e')][_0xe8d8('0x42')]));_0x540650['attributes']=_0x540650[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x540650[_0xe8d8('0x41')]:_0x144326['model'];_0x540650[_0xe8d8('0x44')]=qs[_0xe8d8('0x45')](_0x10c3f2[_0xe8d8('0x3e')][_0xe8d8('0x45')]);_0x540650[_0xe8d8('0x47')]=qs[_0xe8d8('0x3f')](_['pick'](_0x10c3f2[_0xe8d8('0x3e')],_0x144326[_0xe8d8('0x3f')]));if(_0x10c3f2[_0xe8d8('0x3e')]['filter']){_0x540650[_0xe8d8('0x47')]=_[_0xe8d8('0x48')](_0x540650['where'],{'$or':_['map'](_0x540650[_0xe8d8('0x41')],function(_0x4a9629){var _0x2bebd1={};_0x2bebd1[_0x4a9629]={'$like':'%'+_0x10c3f2[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0x2bebd1;})});}_0x540650=_['merge']({},_0x540650,_0x10c3f2['options']);return _0x3973cf[_0xe8d8('0x99')](_0x540650);}})[_0xe8d8('0x28')](function(_0x2d3e7e){if(_0x2d3e7e){_0x41743e=_0x2d3e7e[_0xe8d8('0x43')];if(!_0x10c3f2['query'][_0xe8d8('0x6a')]('nolimit')){_0x540650[_0xe8d8('0x23')]=qs[_0xe8d8('0x23')](_0x10c3f2[_0xe8d8('0x3e')][_0xe8d8('0x23')]);_0x540650[_0xe8d8('0x22')]=qs[_0xe8d8('0x22')](_0x10c3f2['query']['offset']);}return _0x3973cf[_0xe8d8('0x99')](_0x540650);}})['then'](function(_0x43a136){if(_0x43a136){return _0x43a136?{'count':_0x41743e,'rows':_0x43a136}:null;}})[_0xe8d8('0x28')](respondWithResult(_0x48fec5,null))[_0xe8d8('0x4e')](handleError(_0x48fec5,null));};exports[_0xe8d8('0x9a')]=function(_0x431929,_0x423e0f,_0x111c09){var _0x1e45be={};var _0xa7da80={};var _0x3f81b4;var _0x15b2d5;return db[_0xe8d8('0x3a')][_0xe8d8('0x64')]({'where':{'id':_0x431929[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x423e0f,null))['then'](function(_0x1cb60d){if(_0x1cb60d){_0x3f81b4=_0x1cb60d;_0xa7da80['model']=_['keys'](db[_0xe8d8('0x7c')][_0xe8d8('0x52')]);_0xa7da80[_0xe8d8('0x3e')]=_[_0xe8d8('0x51')](_0x431929['query']);_0xa7da80[_0xe8d8('0x3f')]=_[_0xe8d8('0x40')](_0xa7da80[_0xe8d8('0x3d')],_0xa7da80[_0xe8d8('0x3e')]);_0x1e45be[_0xe8d8('0x41')]=_[_0xe8d8('0x40')](_0xa7da80[_0xe8d8('0x3d')],qs[_0xe8d8('0x42')](_0x431929['query'][_0xe8d8('0x42')]));_0x1e45be[_0xe8d8('0x41')]=_0x1e45be[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x1e45be[_0xe8d8('0x41')]:_0xa7da80[_0xe8d8('0x3d')];_0x1e45be[_0xe8d8('0x44')]=qs['sort'](_0x431929[_0xe8d8('0x3e')][_0xe8d8('0x45')]);_0x1e45be[_0xe8d8('0x47')]=qs[_0xe8d8('0x3f')](_[_0xe8d8('0x46')](_0x431929[_0xe8d8('0x3e')],_0xa7da80['filters']));if(_0x431929[_0xe8d8('0x3e')][_0xe8d8('0x2c')]){_0x1e45be[_0xe8d8('0x47')]=_['merge'](_0x1e45be['where'],{'$or':_[_0xe8d8('0x2d')](_0x1e45be[_0xe8d8('0x41')],function(_0x54c5a1){var _0x53af61={};_0x53af61[_0x54c5a1]={'$like':'%'+_0x431929[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0x53af61;})});}_0x1e45be=_['merge']({},_0x1e45be,_0x431929[_0xe8d8('0x4a')]);return _0x3f81b4[_0xe8d8('0x9a')](_0x1e45be);}})[_0xe8d8('0x28')](function(_0x37eb67){if(_0x37eb67){_0x15b2d5=_0x37eb67['length'];if(!_0x431929[_0xe8d8('0x3e')][_0xe8d8('0x6a')](_0xe8d8('0x66'))){_0x1e45be['limit']=qs[_0xe8d8('0x23')](_0x431929[_0xe8d8('0x3e')][_0xe8d8('0x23')]);_0x1e45be[_0xe8d8('0x22')]=qs[_0xe8d8('0x22')](_0x431929[_0xe8d8('0x3e')][_0xe8d8('0x22')]);}return _0x3f81b4[_0xe8d8('0x9a')](_0x1e45be);}})[_0xe8d8('0x28')](function(_0xa1c867){return _0xa1c867?{'count':_0x15b2d5,'rows':_0xa1c867}:null;})[_0xe8d8('0x28')](respondWithResult(_0x423e0f,null))[_0xe8d8('0x4e')](handleError(_0x423e0f,null));};exports[_0xe8d8('0x9b')]=function(_0x6d9254,_0xacf33a,_0x3a0687){var _0x64d90c={};var _0x571360={};var _0x3fa25e;var _0x33e26b;return db[_0xe8d8('0x3a')]['findOne']({'where':{'id':_0x6d9254['params']['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0xacf33a,null))['then'](function(_0x36d5cc){if(_0x36d5cc){_0x3fa25e=_0x36d5cc;_0x571360[_0xe8d8('0x3d')]=_['keys'](db['CmList']['rawAttributes']);_0x571360[_0xe8d8('0x3e')]=_[_0xe8d8('0x51')](_0x6d9254['query']);_0x571360[_0xe8d8('0x3f')]=_[_0xe8d8('0x40')](_0x571360[_0xe8d8('0x3d')],_0x571360['query']);_0x64d90c['attributes']=_[_0xe8d8('0x40')](_0x571360['model'],qs[_0xe8d8('0x42')](_0x6d9254[_0xe8d8('0x3e')][_0xe8d8('0x42')]));_0x64d90c[_0xe8d8('0x41')]=_0x64d90c[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x64d90c['attributes']:_0x571360['model'];_0x64d90c[_0xe8d8('0x44')]=qs[_0xe8d8('0x45')](_0x6d9254[_0xe8d8('0x3e')][_0xe8d8('0x45')]);_0x64d90c['where']=qs['filters'](_['pick'](_0x6d9254[_0xe8d8('0x3e')],_0x571360[_0xe8d8('0x3f')]));if(_0x6d9254['query'][_0xe8d8('0x2c')]){_0x64d90c[_0xe8d8('0x47')]=_[_0xe8d8('0x48')](_0x64d90c['where'],{'$or':_[_0xe8d8('0x2d')](_0x64d90c[_0xe8d8('0x41')],function(_0x3e376c){var _0x43e6f5={};_0x43e6f5[_0x3e376c]={'$like':'%'+_0x6d9254[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0x43e6f5;})});}_0x64d90c=_[_0xe8d8('0x48')]({},_0x64d90c,_0x6d9254[_0xe8d8('0x4a')]);return _0x3fa25e[_0xe8d8('0x9b')](_0x64d90c);}})[_0xe8d8('0x28')](function(_0x172551){if(_0x172551){_0x33e26b=_0x172551[_0xe8d8('0x43')];if(!_0x6d9254[_0xe8d8('0x3e')][_0xe8d8('0x6a')](_0xe8d8('0x66'))){_0x64d90c[_0xe8d8('0x23')]=qs[_0xe8d8('0x23')](_0x6d9254[_0xe8d8('0x3e')]['limit']);_0x64d90c['offset']=qs[_0xe8d8('0x22')](_0x6d9254[_0xe8d8('0x3e')]['offset']);}return _0x3fa25e['getLists'](_0x64d90c);}})[_0xe8d8('0x28')](function(_0x3d45b9){if(_0x3d45b9){return _0x3d45b9?{'count':_0x33e26b,'rows':_0x3d45b9}:null;}})[_0xe8d8('0x28')](respondWithResult(_0xacf33a,null))['catch'](handleError(_0xacf33a,null));};exports[_0xe8d8('0x9c')]=function(_0x1b034a,_0x3651d7,_0x388324){var _0x3b7926,_0x79a74b;return db[_0xe8d8('0x3a')]['find']({'where':{'id':_0x1b034a[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x3651d7,null))[_0xe8d8('0x28')](function(_0x59ebba){if(_0x59ebba){_0x79a74b=_0x59ebba;return _0x59ebba['addLists'](_0x1b034a[_0xe8d8('0x55')][_0xe8d8('0x82')],_[_0xe8d8('0x5d')](_0x1b034a['body'],[_0xe8d8('0x82'),'id'])||{});}return null;})[_0xe8d8('0x95')](function(_0x530ded){var _0x1daff3;_0x3b7926=_0x530ded||[];var _0x1a827e=[];if(_0x530ded){for(var _0xcf535c=0x0;_0xcf535c<_0x530ded['length'];_0xcf535c+=0x1){var _0x535e52=_0x530ded[_0xcf535c][_0xe8d8('0x56')]({'plain':!![]});_0x79a74b[_0xe8d8('0x9d')]=_0x1b034a[_0xe8d8('0x55')][_0xe8d8('0x9d')]?_0x1b034a[_0xe8d8('0x55')]['dialCheckDuplicateType']:_0x79a74b['dialCheckDuplicateType'];switch(_0x79a74b[_0xe8d8('0x9d')]){case'always':_0x1daff3=squel[_0xe8d8('0x9e')]()[_0xe8d8('0x9f')](_0xe8d8('0xa0'))[_0xe8d8('0xa1')]([_0xe8d8('0xa2'),_0xe8d8('0xa3'),_0xe8d8('0xa4'),_0xe8d8('0xa5'),_0xe8d8('0x67'),'createdAt','updatedAt'],squel[_0xe8d8('0x84')]()[_0xe8d8('0xa6')](_0xe8d8('0xa2'),_0xe8d8('0xa2'))[_0xe8d8('0xa6')](_0xe8d8('0xa7'),_0xe8d8('0xa3'))[_0xe8d8('0xa6')]('id',_0xe8d8('0xa4'))[_0xe8d8('0xa6')](_0x535e52[_0xe8d8('0xa8')][_0xe8d8('0x8b')](),_0xe8d8('0xa5'))[_0xe8d8('0xa6')](_0x1b034a[_0xe8d8('0x50')]['id'][_0xe8d8('0x8b')](),_0xe8d8('0x67'))['field'](_0xe8d8('0xa7'),_0xe8d8('0x5e'))[_0xe8d8('0xa6')](_0xe8d8('0xa7'),_0xe8d8('0x5f'))[_0xe8d8('0xa9')](_0xe8d8('0xaa'))['where'](_0xe8d8('0xab'))['where'](_0xe8d8('0xac'),_0x535e52[_0xe8d8('0xa8')]['toString']())['where'](_0xe8d8('0xad'))[_0xe8d8('0x47')](_0xe8d8('0xae'),squel[_0xe8d8('0x84')]()['field'](_0xe8d8('0xaf'))[_0xe8d8('0xa9')](_0xe8d8('0xb0'))['where']('VoiceQueueId\x20=\x20?',_0x1b034a['params']['id']['toString']()))['where'](_0xe8d8('0xae'),squel[_0xe8d8('0x84')]()[_0xe8d8('0xa6')](_0xe8d8('0xb1'))[_0xe8d8('0xa9')](_0xe8d8('0xa0'))[_0xe8d8('0x47')](_0xe8d8('0x87'),_0x1b034a[_0xe8d8('0x50')]['id'][_0xe8d8('0x8b')]())))[_0xe8d8('0x8b')]();break;case _0xe8d8('0xb2'):_0x1daff3=squel[_0xe8d8('0x9e')]()[_0xe8d8('0x9f')](_0xe8d8('0xa0'))[_0xe8d8('0xa1')](['phone',_0xe8d8('0xa3'),'ContactId',_0xe8d8('0xa5'),_0xe8d8('0x67'),'createdAt',_0xe8d8('0x5f')],squel[_0xe8d8('0x84')]()[_0xe8d8('0xa6')](_0xe8d8('0xa2'),'phone')[_0xe8d8('0xa6')]('NOW()',_0xe8d8('0xa3'))[_0xe8d8('0xa6')]('id',_0xe8d8('0xa4'))[_0xe8d8('0xa6')](_0x535e52[_0xe8d8('0xa8')][_0xe8d8('0x8b')](),_0xe8d8('0xa5'))[_0xe8d8('0xa6')](_0x1b034a[_0xe8d8('0x50')]['id'][_0xe8d8('0x8b')](),'VoiceQueueId')[_0xe8d8('0xa6')](_0xe8d8('0xa7'),_0xe8d8('0x5e'))[_0xe8d8('0xa6')](_0xe8d8('0xa7'),'updatedAt')[_0xe8d8('0xa9')](_0xe8d8('0xaa'))[_0xe8d8('0x47')](_0xe8d8('0xab'))[_0xe8d8('0x47')](_0xe8d8('0xac'),_0x535e52[_0xe8d8('0xa8')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe8d8('0x47')](_0xe8d8('0xae'),squel['select']()[_0xe8d8('0xa6')](_0xe8d8('0xb1'))['from']('cm_hopper')[_0xe8d8('0x47')](_0xe8d8('0x87'),_0x1b034a[_0xe8d8('0x50')]['id']['toString']())))[_0xe8d8('0x8b')]();break;default:_0x1daff3=squel['insert']()[_0xe8d8('0x9f')]('cm_hopper')[_0xe8d8('0xa1')]([_0xe8d8('0xa2'),_0xe8d8('0xa3'),_0xe8d8('0xa4'),_0xe8d8('0xa5'),_0xe8d8('0x67'),_0xe8d8('0x5e'),_0xe8d8('0x5f')],squel[_0xe8d8('0x84')]()[_0xe8d8('0xa6')](_0xe8d8('0xa2'),_0xe8d8('0xa2'))[_0xe8d8('0xa6')](_0xe8d8('0xa7'),'scheduledAt')[_0xe8d8('0xa6')]('id',_0xe8d8('0xa4'))[_0xe8d8('0xa6')](_0x535e52[_0xe8d8('0xa8')][_0xe8d8('0x8b')](),_0xe8d8('0xa5'))['field'](_0x1b034a['params']['id']['toString'](),_0xe8d8('0x67'))['field']('NOW()',_0xe8d8('0x5e'))['field']('NOW()',_0xe8d8('0x5f'))['from'](_0xe8d8('0xaa'))[_0xe8d8('0x47')](_0xe8d8('0xab'))['where'](_0xe8d8('0xac'),_0x535e52['CmListId'][_0xe8d8('0x8b')]())[_0xe8d8('0x47')](_0xe8d8('0xad')))[_0xe8d8('0x8b')]();}_0x1a827e['push'](db[_0xe8d8('0x77')]['query'](_0x1daff3));}return BPromise[_0xe8d8('0x8e')](_0x1a827e);}})['then'](function(){return _0x3b7926;})[_0xe8d8('0x28')](respondWithResult(_0x3651d7,null))[_0xe8d8('0x4e')](handleError(_0x3651d7,null));};exports['removeLists']=function(_0x14be64,_0xbcaf58,_0x23c330){return db['VoiceQueue']['find']({'where':{'id':_0x14be64[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0xbcaf58,null))[_0xe8d8('0x28')](function(_0x509aef){if(_0x509aef){return _0x509aef[_0xe8d8('0xb3')](_0x14be64[_0xe8d8('0x3e')]['ids']);}})[_0xe8d8('0x28')](function(_0x98ca32){if(_0x98ca32){return db[_0xe8d8('0x65')][_0xe8d8('0x62')]({'where':{'ListId':_0x14be64['query'][_0xe8d8('0x82')],'VoiceQueueId':_0x14be64[_0xe8d8('0x50')]['id']}})['then'](function(){return _0x98ca32;});}})[_0xe8d8('0x28')](respondWithStatusCode(_0xbcaf58,null))[_0xe8d8('0x4e')](handleError(_0xbcaf58,null));};exports['getBlackLists']=function(_0x897df7,_0xd9febf,_0x4633f1){var _0x367c60={};var _0x2b9142={};var _0x2adc6d;var _0x232379;return db[_0xe8d8('0x3a')][_0xe8d8('0x64')]({'where':{'id':_0x897df7[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0xd9febf,null))['then'](function(_0x19ddf2){if(_0x19ddf2){_0x2adc6d=_0x19ddf2;_0x2b9142[_0xe8d8('0x3d')]=_[_0xe8d8('0x51')](db[_0xe8d8('0xb4')][_0xe8d8('0x52')]);_0x2b9142[_0xe8d8('0x3e')]=_[_0xe8d8('0x51')](_0x897df7[_0xe8d8('0x3e')]);_0x2b9142['filters']=_[_0xe8d8('0x40')](_0x2b9142[_0xe8d8('0x3d')],_0x2b9142[_0xe8d8('0x3e')]);_0x367c60[_0xe8d8('0x41')]=_[_0xe8d8('0x40')](_0x2b9142['model'],qs[_0xe8d8('0x42')](_0x897df7[_0xe8d8('0x3e')][_0xe8d8('0x42')]));_0x367c60[_0xe8d8('0x41')]=_0x367c60[_0xe8d8('0x41')][_0xe8d8('0x43')]?_0x367c60[_0xe8d8('0x41')]:_0x2b9142[_0xe8d8('0x3d')];_0x367c60[_0xe8d8('0x44')]=qs['sort'](_0x897df7[_0xe8d8('0x3e')][_0xe8d8('0x45')]);_0x367c60['where']=qs[_0xe8d8('0x3f')](_[_0xe8d8('0x46')](_0x897df7['query'],_0x2b9142['filters']));if(_0x897df7[_0xe8d8('0x3e')][_0xe8d8('0x2c')]){_0x367c60[_0xe8d8('0x47')]=_[_0xe8d8('0x48')](_0x367c60[_0xe8d8('0x47')],{'$or':_[_0xe8d8('0x2d')](_0x367c60[_0xe8d8('0x41')],function(_0x5046ed){var _0x39af00={};_0x39af00[_0x5046ed]={'$like':'%'+_0x897df7[_0xe8d8('0x3e')][_0xe8d8('0x2c')]+'%'};return _0x39af00;})});}_0x367c60=_[_0xe8d8('0x48')]({},_0x367c60,_0x897df7[_0xe8d8('0x4a')]);return _0x2adc6d[_0xe8d8('0xb5')](_0x367c60);}})['then'](function(_0x51afea){if(_0x51afea){_0x232379=_0x51afea[_0xe8d8('0x43')];if(!_0x897df7[_0xe8d8('0x3e')]['hasOwnProperty'](_0xe8d8('0x66'))){_0x367c60['limit']=qs[_0xe8d8('0x23')](_0x897df7[_0xe8d8('0x3e')][_0xe8d8('0x23')]);_0x367c60[_0xe8d8('0x22')]=qs[_0xe8d8('0x22')](_0x897df7[_0xe8d8('0x3e')][_0xe8d8('0x22')]);}return _0x2adc6d['getBlackLists'](_0x367c60);}})[_0xe8d8('0x28')](function(_0x3d53b3){if(_0x3d53b3){return _0x3d53b3?{'count':_0x232379,'rows':_0x3d53b3}:null;}})[_0xe8d8('0x28')](respondWithResult(_0xd9febf,null))[_0xe8d8('0x4e')](handleError(_0xd9febf,null));};exports[_0xe8d8('0xb6')]=function(_0x1ad650,_0x51c948,_0x31dc30){var _0x2f3ef9,_0x5c60c0;return db[_0xe8d8('0x3a')][_0xe8d8('0x31')]({'where':{'id':_0x1ad650[_0xe8d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x51c948,null))['then'](function(_0x45aa59){if(_0x45aa59){_0x5c60c0=_0x45aa59;return _0x45aa59[_0xe8d8('0xb6')](_0x1ad650[_0xe8d8('0x55')][_0xe8d8('0x82')],_[_0xe8d8('0x5d')](_0x1ad650['body'],[_0xe8d8('0x82'),'id'])||{});}return null;})[_0xe8d8('0x95')](function(_0x2b9039){var _0x3dd67b;_0x2f3ef9=_0x2b9039||[];var _0xf1654b=[];if(_0x2b9039){for(var _0x387b81=0x0;_0x387b81<_0x2b9039[_0xe8d8('0x43')];_0x387b81+=0x1){var _0x475017=_0x2b9039[_0x387b81]['get']({'plain':!![]});_0x3dd67b=squel[_0xe8d8('0x9e')]()['into'](_0xe8d8('0xb7'))[_0xe8d8('0xa1')]([_0xe8d8('0xa2'),_0xe8d8('0xa4'),'ListId',_0xe8d8('0x67'),_0xe8d8('0x5e'),_0xe8d8('0x5f')],squel[_0xe8d8('0x84')]()['field'](_0xe8d8('0xa2'),_0xe8d8('0xa2'))[_0xe8d8('0xa6')]('id',_0xe8d8('0xa4'))['field'](_0x475017[_0xe8d8('0xa8')][_0xe8d8('0x8b')](),_0xe8d8('0xa5'))['field'](_0x1ad650[_0xe8d8('0x50')]['id'][_0xe8d8('0x8b')](),_0xe8d8('0x67'))[_0xe8d8('0xa6')](_0xe8d8('0xa7'),'createdAt')[_0xe8d8('0xa6')]('NOW()','updatedAt')[_0xe8d8('0xa9')](_0xe8d8('0xaa'))[_0xe8d8('0x47')]('deletedAt\x20IS\x20NULL')[_0xe8d8('0x47')](_0xe8d8('0xac'),_0x475017[_0xe8d8('0xa8')][_0xe8d8('0x8b')]())[_0xe8d8('0x47')](_0xe8d8('0xad')))[_0xe8d8('0x8b')]();_0xf1654b[_0xe8d8('0x8a')](db['sequelize'][_0xe8d8('0x3e')](_0x3dd67b));}return BPromise[_0xe8d8('0x8e')](_0xf1654b);}})[_0xe8d8('0x28')](function(){return _0x2f3ef9;})['then'](respondWithResult(_0x51c948,null))[_0xe8d8('0x4e')](handleError(_0x51c948,null));};exports[_0xe8d8('0xb8')]=function(_0x546a46,_0x272174,_0x68e359){return db['VoiceQueue'][_0xe8d8('0x31')]({'where':{'id':_0x546a46['params']['id']}})[_0xe8d8('0x28')](handleEntityNotFound(_0x272174,null))['then'](function(_0xda94a7){if(_0xda94a7){return _0xda94a7[_0xe8d8('0xb8')](_0x546a46[_0xe8d8('0x3e')][_0xe8d8('0x82')]);}})[_0xe8d8('0x28')](function(_0xf86f62){if(_0xf86f62){return db[_0xe8d8('0x6e')][_0xe8d8('0x62')]({'where':{'ListId':_0x546a46[_0xe8d8('0x3e')]['ids'],'VoiceQueueId':_0x546a46[_0xe8d8('0x50')]['id']}})[_0xe8d8('0x28')](function(){return _0xf86f62;});}})[_0xe8d8('0x28')](respondWithStatusCode(_0x272174,null))[_0xe8d8('0x4e')](handleError(_0x272174,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 9da904e..db21137 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 _0xd2d2=['setMaxListeners','save','remove','emit','exports','../../mysqldb','VoiceQueue'];(function(_0x26e789,_0x26223d){var _0x39160d=function(_0x3a3ac0){while(--_0x3a3ac0){_0x26e789['push'](_0x26e789['shift']());}};_0x39160d(++_0x26223d);}(_0xd2d2,0x1b7));var _0x2d2d=function(_0x13688e,_0x212358){_0x13688e=_0x13688e-0x0;var _0x13b543=_0xd2d2[_0x13688e];return _0x13b543;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x2d2d('0x0'))['db'][_0x2d2d('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2d2d('0x2')](0x0);var events={'afterCreate':_0x2d2d('0x3'),'afterUpdate':'update','afterDestroy':_0x2d2d('0x4')};function emitEvent(_0x1a78ca){return function(_0x21859a,_0x34db15,_0x49598e){VoiceQueueEvents[_0x2d2d('0x5')](_0x1a78ca+':'+_0x21859a['id'],_0x21859a);VoiceQueueEvents[_0x2d2d('0x5')](_0x1a78ca,_0x21859a);_0x49598e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x2d2d('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x7075=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x2ffdbf,_0x20c63e){var _0x51550f=function(_0x499cdc){while(--_0x499cdc){_0x2ffdbf['push'](_0x2ffdbf['shift']());}};_0x51550f(++_0x20c63e);}(_0x7075,0x108));var _0x5707=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7075[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x5707('0x0'));var VoiceQueue=require(_0x5707('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5707('0x2')](0x0);var events={'afterCreate':_0x5707('0x3'),'afterUpdate':_0x5707('0x4'),'afterDestroy':'remove'};function emitEvent(_0x149725){return function(_0x1c80f8,_0x5d3c9d,_0x4023b0){VoiceQueueEvents[_0x5707('0x5')](_0x149725+':'+_0x1c80f8['id'],_0x1c80f8);VoiceQueueEvents[_0x5707('0x5')](_0x149725,_0x1c80f8);_0x4023b0(null);};}for(var e in events){if(events[_0x5707('0x6')](e)){var event=events[e];VoiceQueue[_0x5707('0x7')](e,emitEvent(event));}}module[_0x5707('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 66272f2..942941d 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 _0x8a68=['bluebird','request-promise','rimraf','exports','define','VoiceQueue','voice_queues','lodash','util','api'];(function(_0x2d2431,_0x316860){var _0x284bb1=function(_0x5105c3){while(--_0x5105c3){_0x2d2431['push'](_0x2d2431['shift']());}};_0x284bb1(++_0x316860);}(_0x8a68,0x183));var _0x88a6=function(_0x407ed4,_0x10c270){_0x407ed4=_0x407ed4-0x0;var _0x137908=_0x8a68[_0x407ed4];return _0x137908;};'use strict';var _=require(_0x88a6('0x0'));var util=require(_0x88a6('0x1'));var logger=require('../../config/logger')(_0x88a6('0x2'));var moment=require('moment');var BPromise=require(_0x88a6('0x3'));var rp=require(_0x88a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x88a6('0x5'));var config=require('../../config/environment');var attributes=require('./voiceQueue.attributes');module[_0x88a6('0x6')]=function(_0x4df36a,_0x5d83eb){return _0x4df36a[_0x88a6('0x7')](_0x88a6('0x8'),attributes,{'tableName':_0x88a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x875f=['api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceQueue','lodash','util','../../config/logger'];(function(_0x36952d,_0x2f4779){var _0x3fbff5=function(_0x21aa09){while(--_0x21aa09){_0x36952d['push'](_0x36952d['shift']());}};_0x3fbff5(++_0x2f4779);}(_0x875f,0x81));var _0xf875=function(_0x3173e0,_0x3a36a3){_0x3173e0=_0x3173e0-0x0;var _0x3a0aa6=_0x875f[_0x3173e0];return _0x3a0aa6;};'use strict';var _=require(_0xf875('0x0'));var util=require(_0xf875('0x1'));var logger=require(_0xf875('0x2'))(_0xf875('0x3'));var moment=require(_0xf875('0x4'));var BPromise=require(_0xf875('0x5'));var rp=require(_0xf875('0x6'));var fs=require('fs');var path=require(_0xf875('0x7'));var rimraf=require(_0xf875('0x8'));var config=require('../../config/environment');var attributes=require('./voiceQueue.attributes');module[_0xf875('0x9')]=function(_0x31579b,_0x1a86ea){return _0x31579b[_0xf875('0xa')](_0xf875('0xb'),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 eee36a5..1d5f919 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 _0x545e=['client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetVoiceQueue','findAll','options','where','model','map','include','attributes','ShowVoiceQueue','VoiceQueue','find','raw','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x13b1f5,_0x133264){var _0xe3e1cd=function(_0x2d0a80){while(--_0x2d0a80){_0x13b1f5['push'](_0x13b1f5['shift']());}};_0xe3e1cd(++_0x133264);}(_0x545e,0xfc));var _0xe545=function(_0x54b139,_0x25ccaf){_0x54b139=_0x54b139-0x0;var _0x1ad073=_0x545e[_0x54b139];return _0x1ad073;};'use strict';var _=require(_0xe545('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe545('0x1'));var db=require(_0xe545('0x2'))['db'];var utils=require(_0xe545('0x3'));var logger=require(_0xe545('0x4'))('rpc');var config=require(_0xe545('0x5'));var jayson=require(_0xe545('0x6'));var client=jayson[_0xe545('0x7')][_0xe545('0x8')]({'port':0x232a});config[_0xe545('0x9')]=_['defaults'](config[_0xe545('0x9')],{'host':_0xe545('0xa'),'port':0x18eb});var socket=require(_0xe545('0xb'))(new Redis(config[_0xe545('0x9')]));require(_0xe545('0xc'))[_0xe545('0xd')](socket);function respondWithRpcPromise(_0x4a3597,_0x42f83e,_0xb6ccb7){return new BPromise(function(_0x167342,_0x2b6f92){return client[_0xe545('0xe')](_0x4a3597,_0xb6ccb7)[_0xe545('0xf')](function(_0x3e0c67){logger['info'](_0xe545('0x10'),_0x42f83e,_0xe545('0x11'));logger[_0xe545('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x42f83e,_0xe545('0x11'),JSON[_0xe545('0x13')](_0x3e0c67));if(_0x3e0c67['error']){if(_0x3e0c67[_0xe545('0x14')]['code']===0x1f4){logger[_0xe545('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x42f83e,_0x3e0c67['error'][_0xe545('0x15')]);return _0x2b6f92(_0x3e0c67[_0xe545('0x14')]['message']);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x42f83e,_0x3e0c67[_0xe545('0x14')][_0xe545('0x15')]);return _0x167342(_0x3e0c67[_0xe545('0x14')][_0xe545('0x15')]);}else{logger[_0xe545('0x16')](_0xe545('0x10'),_0x42f83e,_0xe545('0x11'));_0x167342(_0x3e0c67[_0xe545('0x17')][_0xe545('0x15')]);}})[_0xe545('0x18')](function(_0x5109ee){logger[_0xe545('0x14')](_0xe545('0x10'),_0x42f83e,_0x5109ee);_0x2b6f92(_0x5109ee);});});}exports[_0xe545('0x19')]=function(_0x2f7a74){var _0x5cb22d=this;return new Promise(function(_0xe55bc,_0xb9f2e2){return db['VoiceQueue'][_0xe545('0x1a')]({'raw':_0x2f7a74[_0xe545('0x1b')]?_0x2f7a74[_0xe545('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2f7a74[_0xe545('0x1b')]?_0x2f7a74[_0xe545('0x1b')][_0xe545('0x1c')]||null:null,'attributes':_0x2f7a74[_0xe545('0x1b')]?_0x2f7a74[_0xe545('0x1b')]['attributes']||null:null,'limit':_0x2f7a74[_0xe545('0x1b')]?_0x2f7a74['options']['limit']||null:null,'include':_0x2f7a74[_0xe545('0x1b')]?_0x2f7a74['options']['include']?_['map'](_0x2f7a74[_0xe545('0x1b')]['include'],function(_0x453702){return{'model':db[_0x453702[_0xe545('0x1d')]],'as':_0x453702['as'],'attributes':_0x453702['attributes'],'include':_0x453702['include']?_[_0xe545('0x1e')](_0x453702[_0xe545('0x1f')],function(_0x46ed40){return{'model':db[_0x46ed40[_0xe545('0x1d')]],'as':_0x46ed40['as'],'attributes':_0x46ed40[_0xe545('0x20')],'include':_0x46ed40[_0xe545('0x1f')]?_[_0xe545('0x1e')](_0x46ed40[_0xe545('0x1f')],function(_0x28f2fe){return{'model':db[_0x28f2fe[_0xe545('0x1d')]],'as':_0x28f2fe['as'],'attributes':_0x28f2fe[_0xe545('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c9f10){logger[_0xe545('0x16')]('GetVoiceQueue',_0x2f7a74);logger[_0xe545('0x12')](_0xe545('0x19'),_0x2f7a74,JSON['stringify'](_0x3c9f10));_0xe55bc(_0x3c9f10);})[_0xe545('0x18')](function(_0x4f73d8){logger[_0xe545('0x14')](_0xe545('0x19'),_0x4f73d8[_0xe545('0x15')],_0x2f7a74);_0xb9f2e2(_0x5cb22d[_0xe545('0x14')](0x1f4,_0x4f73d8[_0xe545('0x15')]));});});};exports[_0xe545('0x21')]=function(_0x3d92ee){var _0x427312=this;return new Promise(function(_0x288b7b,_0x4d74b0){return db[_0xe545('0x22')][_0xe545('0x23')]({'raw':_0x3d92ee[_0xe545('0x1b')]?_0x3d92ee[_0xe545('0x1b')][_0xe545('0x24')]===undefined?!![]:![]:!![],'where':_0x3d92ee[_0xe545('0x1b')]?_0x3d92ee[_0xe545('0x1b')]['where']||null:null,'attributes':_0x3d92ee[_0xe545('0x1b')]?_0x3d92ee['options'][_0xe545('0x20')]||null:null,'include':_0x3d92ee[_0xe545('0x1b')]?_0x3d92ee[_0xe545('0x1b')]['include']?_[_0xe545('0x1e')](_0x3d92ee[_0xe545('0x1b')]['include'],function(_0x288c1b){return{'model':db[_0x288c1b[_0xe545('0x1d')]],'as':_0x288c1b['as'],'attributes':_0x288c1b[_0xe545('0x20')],'include':_0x288c1b[_0xe545('0x1f')]?_[_0xe545('0x1e')](_0x288c1b['include'],function(_0x1ac20c){return{'model':db[_0x1ac20c['model']],'as':_0x1ac20c['as'],'attributes':_0x1ac20c['attributes'],'include':_0x1ac20c[_0xe545('0x1f')]?_[_0xe545('0x1e')](_0x1ac20c[_0xe545('0x1f')],function(_0x474e83){return{'model':db[_0x474e83['model']],'as':_0x474e83['as'],'attributes':_0x474e83['attributes']};}):[]};}):[]};}):[]:[]})[_0xe545('0xf')](function(_0x5e505b){logger['info']('ShowVoiceQueue',_0x3d92ee);logger['debug'](_0xe545('0x21'),_0x3d92ee,JSON[_0xe545('0x13')](_0x5e505b));_0x288b7b(_0x5e505b);})['catch'](function(_0x5494d9){logger[_0xe545('0x14')](_0xe545('0x21'),_0x5494d9[_0xe545('0x15')],_0x3d92ee);_0x4d74b0(_0x427312['error'](0x1f4,_0x5494d9[_0xe545('0x15')]));});});}; \ No newline at end of file +var _0xe0be=['then','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueue','stringify','ShowVoiceQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x8e4cd2,_0x1080e5){var _0x37a4aa=function(_0x34baf1){while(--_0x34baf1){_0x8e4cd2['push'](_0x8e4cd2['shift']());}};_0x37a4aa(++_0x1080e5);}(_0xe0be,0x167));var _0xee0b=function(_0x76481e,_0x1b3af8){_0x76481e=_0x76481e-0x0;var _0x11b839=_0xe0be[_0x76481e];return _0x11b839;};'use strict';var _=require(_0xee0b('0x0'));var util=require(_0xee0b('0x1'));var moment=require(_0xee0b('0x2'));var BPromise=require(_0xee0b('0x3'));var rs=require(_0xee0b('0x4'));var fs=require('fs');var Redis=require(_0xee0b('0x5'));var db=require(_0xee0b('0x6'))['db'];var utils=require(_0xee0b('0x7'));var logger=require(_0xee0b('0x8'))(_0xee0b('0x9'));var config=require(_0xee0b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xee0b('0xb')][_0xee0b('0xc')]({'port':0x232a});config[_0xee0b('0xd')]=_[_0xee0b('0xe')](config[_0xee0b('0xd')],{'host':_0xee0b('0xf'),'port':0x18eb});var socket=require(_0xee0b('0x10'))(new Redis(config[_0xee0b('0xd')]));require(_0xee0b('0x11'))[_0xee0b('0x12')](socket);function respondWithRpcPromise(_0x198ade,_0x1a7464,_0x5d4e4c){return new BPromise(function(_0x26ea2d,_0x37d3b5){return client['request'](_0x198ade,_0x5d4e4c)[_0xee0b('0x13')](function(_0x1e9003){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x1a7464,_0xee0b('0x14'));logger[_0xee0b('0x15')](_0xee0b('0x16'),_0x1a7464,_0xee0b('0x14'),JSON['stringify'](_0x1e9003));if(_0x1e9003['error']){if(_0x1e9003[_0xee0b('0x17')]['code']===0x1f4){logger[_0xee0b('0x17')](_0xee0b('0x18'),_0x1a7464,_0x1e9003[_0xee0b('0x17')]['message']);return _0x37d3b5(_0x1e9003[_0xee0b('0x17')]['message']);}logger['error'](_0xee0b('0x18'),_0x1a7464,_0x1e9003[_0xee0b('0x17')]['message']);return _0x26ea2d(_0x1e9003[_0xee0b('0x17')][_0xee0b('0x19')]);}else{logger[_0xee0b('0x1a')](_0xee0b('0x18'),_0x1a7464,'request\x20sent');_0x26ea2d(_0x1e9003[_0xee0b('0x1b')][_0xee0b('0x19')]);}})[_0xee0b('0x1c')](function(_0x1889ed){logger[_0xee0b('0x17')](_0xee0b('0x18'),_0x1a7464,_0x1889ed);_0x37d3b5(_0x1889ed);});});}exports['GetVoiceQueue']=function(_0x3ac25a){var _0x5143c1=this;return new Promise(function(_0x585aec,_0x487e3c){return db[_0xee0b('0x1d')][_0xee0b('0x1e')]({'raw':_0x3ac25a[_0xee0b('0x1f')]?_0x3ac25a[_0xee0b('0x1f')][_0xee0b('0x20')]===undefined?!![]:![]:!![],'where':_0x3ac25a[_0xee0b('0x1f')]?_0x3ac25a['options']['where']||null:null,'attributes':_0x3ac25a[_0xee0b('0x1f')]?_0x3ac25a['options'][_0xee0b('0x21')]||null:null,'limit':_0x3ac25a[_0xee0b('0x1f')]?_0x3ac25a[_0xee0b('0x1f')][_0xee0b('0x22')]||null:null,'include':_0x3ac25a[_0xee0b('0x1f')]?_0x3ac25a[_0xee0b('0x1f')][_0xee0b('0x23')]?_[_0xee0b('0x24')](_0x3ac25a[_0xee0b('0x1f')][_0xee0b('0x23')],function(_0x30cc84){return{'model':db[_0x30cc84['model']],'as':_0x30cc84['as'],'attributes':_0x30cc84['attributes'],'include':_0x30cc84['include']?_[_0xee0b('0x24')](_0x30cc84[_0xee0b('0x23')],function(_0x12c240){return{'model':db[_0x12c240[_0xee0b('0x25')]],'as':_0x12c240['as'],'attributes':_0x12c240[_0xee0b('0x21')],'include':_0x12c240[_0xee0b('0x23')]?_[_0xee0b('0x24')](_0x12c240[_0xee0b('0x23')],function(_0x79dc50){return{'model':db[_0x79dc50['model']],'as':_0x79dc50['as'],'attributes':_0x79dc50[_0xee0b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35deee){logger[_0xee0b('0x1a')]('GetVoiceQueue',_0x3ac25a);logger[_0xee0b('0x15')](_0xee0b('0x26'),_0x3ac25a,JSON[_0xee0b('0x27')](_0x35deee));_0x585aec(_0x35deee);})[_0xee0b('0x1c')](function(_0x768021){logger['error'](_0xee0b('0x26'),_0x768021[_0xee0b('0x19')],_0x3ac25a);_0x487e3c(_0x5143c1[_0xee0b('0x17')](0x1f4,_0x768021[_0xee0b('0x19')]));});});};exports[_0xee0b('0x28')]=function(_0x3c5787){var _0x1a290d=this;return new Promise(function(_0x17f756,_0x56fca8){return db[_0xee0b('0x1d')]['find']({'raw':_0x3c5787[_0xee0b('0x1f')]?_0x3c5787[_0xee0b('0x1f')][_0xee0b('0x20')]===undefined?!![]:![]:!![],'where':_0x3c5787[_0xee0b('0x1f')]?_0x3c5787[_0xee0b('0x1f')][_0xee0b('0x29')]||null:null,'attributes':_0x3c5787[_0xee0b('0x1f')]?_0x3c5787['options'][_0xee0b('0x21')]||null:null,'include':_0x3c5787[_0xee0b('0x1f')]?_0x3c5787[_0xee0b('0x1f')][_0xee0b('0x23')]?_[_0xee0b('0x24')](_0x3c5787[_0xee0b('0x1f')][_0xee0b('0x23')],function(_0x3be47b){return{'model':db[_0x3be47b[_0xee0b('0x25')]],'as':_0x3be47b['as'],'attributes':_0x3be47b['attributes'],'include':_0x3be47b['include']?_[_0xee0b('0x24')](_0x3be47b[_0xee0b('0x23')],function(_0x6f2119){return{'model':db[_0x6f2119[_0xee0b('0x25')]],'as':_0x6f2119['as'],'attributes':_0x6f2119[_0xee0b('0x21')],'include':_0x6f2119[_0xee0b('0x23')]?_[_0xee0b('0x24')](_0x6f2119[_0xee0b('0x23')],function(_0x4d8eb6){return{'model':db[_0x4d8eb6[_0xee0b('0x25')]],'as':_0x4d8eb6['as'],'attributes':_0x4d8eb6[_0xee0b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e627a){logger['info'](_0xee0b('0x28'),_0x3c5787);logger[_0xee0b('0x15')](_0xee0b('0x28'),_0x3c5787,JSON[_0xee0b('0x27')](_0x3e627a));_0x17f756(_0x3e627a);})['catch'](function(_0x15544d){logger[_0xee0b('0x17')](_0xee0b('0x28'),_0x15544d['message'],_0x3c5787);_0x56fca8(_0x1a290d[_0xee0b('0x17')](0x1f4,_0x15544d[_0xee0b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a9c14ae..e4c64d3 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 _0xf538=['remove','emit','removeListener','length','voiceQueue:','save'];(function(_0x5e6e58,_0x199b7f){var _0xa1451d=function(_0x3174fd){while(--_0x3174fd){_0x5e6e58['push'](_0x5e6e58['shift']());}};_0xa1451d(++_0x199b7f);}(_0xf538,0x65));var _0x8f53=function(_0x3f5022,_0xe79120){_0x3f5022=_0x3f5022-0x0;var _0x3aa9f2=_0xf538[_0x3f5022];return _0x3aa9f2;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x8f53('0x0'),_0x8f53('0x1'),'update'];function createListener(_0x58641a,_0x2abda9){return function(_0x5f571e){_0x2abda9[_0x8f53('0x2')](_0x58641a,_0x5f571e);};}function removeListener(_0x446620,_0x1b4594){return function(){VoiceQueueEvents[_0x8f53('0x3')](_0x446620,_0x1b4594);};}exports['register']=function(_0x423085){for(var _0x3e46c4=0x0,_0x30f11c=events[_0x8f53('0x4')];_0x3e46c4<_0x30f11c;_0x3e46c4++){var _0x29dd6e=events[_0x3e46c4];var _0x508413=createListener(_0x8f53('0x5')+_0x29dd6e,_0x423085);VoiceQueueEvents['on'](_0x29dd6e,_0x508413);}}; \ No newline at end of file +var _0x2227=['voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2227,0x143));var _0x7222=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x2227[_0x60df74];return _0x5ee872;};'use strict';var VoiceQueueEvents=require(_0x7222('0x0'));var events=['save',_0x7222('0x1'),_0x7222('0x2')];function createListener(_0x202646,_0x5d258e){return function(_0x1b3c1e){_0x5d258e[_0x7222('0x3')](_0x202646,_0x1b3c1e);};}function removeListener(_0x1e522c,_0x44f908){return function(){VoiceQueueEvents[_0x7222('0x4')](_0x1e522c,_0x44f908);};}exports['register']=function(_0x2cdd4b){for(var _0x3e62d3=0x0,_0x7ef191=events[_0x7222('0x5')];_0x3e62d3<_0x7ef191;_0x3e62d3++){var _0x5542f3=events[_0x3e62d3];var _0x3cb446=createListener(_0x7222('0x6')+_0x5542f3,_0x2cdd4b);VoiceQueueEvents['on'](_0x5542f3,_0x3cb446);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 541869f..777c8c7 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 _0xaa3f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/index','/:id','post','create','put','delete','destroy','exports','multer','util'];(function(_0xdd8d43,_0x26147b){var _0x2abf27=function(_0x1c16a9){while(--_0x1c16a9){_0xdd8d43['push'](_0xdd8d43['shift']());}};_0x2abf27(++_0x26147b);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x34677a,_0xc29ca8){_0x34677a=_0x34677a-0x0;var _0x3bb373=_0xaa3f[_0x34677a];return _0x3bb373;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var auth=require(_0xfaa3('0x6'));var interaction=require(_0xfaa3('0x7'));var config=require(_0xfaa3('0x8'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xfaa3('0x9')](),controller['index']);router[_0xfaa3('0xa')](_0xfaa3('0xb'),auth[_0xfaa3('0x9')](),controller[_0xfaa3('0xc')]);router[_0xfaa3('0xa')](_0xfaa3('0xd'),auth[_0xfaa3('0x9')](),controller['getVoiceQueuesReport']);router[_0xfaa3('0xa')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xfaa3('0xf')]('/',auth[_0xfaa3('0x9')](),controller[_0xfaa3('0x10')]);router[_0xfaa3('0x11')](_0xfaa3('0xe'),auth[_0xfaa3('0x9')](),controller['update']);router[_0xfaa3('0x12')]('/:id',auth[_0xfaa3('0x9')](),controller[_0xfaa3('0x13')]);module[_0xfaa3('0x14')]=router; \ No newline at end of file +var _0x2b29=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update'];(function(_0x158ab3,_0x4b5908){var _0x302830=function(_0x19fa14){while(--_0x19fa14){_0x158ab3['push'](_0x158ab3['shift']());}};_0x302830(++_0x4b5908);}(_0x2b29,0x163));var _0x92b2=function(_0x54c871,_0x52439d){_0x54c871=_0x54c871-0x0;var _0x1bcac3=_0x2b29[_0x54c871];return _0x1bcac3;};'use strict';var multer=require('multer');var util=require(_0x92b2('0x0'));var path=require(_0x92b2('0x1'));var timeout=require(_0x92b2('0x2'));var express=require(_0x92b2('0x3'));var router=express['Router']();var auth=require(_0x92b2('0x4'));var interaction=require(_0x92b2('0x5'));var config=require(_0x92b2('0x6'));var controller=require(_0x92b2('0x7'));router[_0x92b2('0x8')]('/',auth[_0x92b2('0x9')](),controller['index']);router[_0x92b2('0x8')]('/describe',auth[_0x92b2('0x9')](),controller[_0x92b2('0xa')]);router['get'](_0x92b2('0xb'),auth[_0x92b2('0x9')](),controller[_0x92b2('0xc')]);router[_0x92b2('0x8')]('/:id',auth[_0x92b2('0x9')](),controller[_0x92b2('0xd')]);router[_0x92b2('0xe')]('/',auth[_0x92b2('0x9')](),controller[_0x92b2('0xf')]);router[_0x92b2('0x10')](_0x92b2('0x11'),auth['isAuthenticated'](),controller[_0x92b2('0x12')]);router[_0x92b2('0x13')](_0x92b2('0x11'),auth['isAuthenticated'](),controller[_0x92b2('0x14')]);module[_0x92b2('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e3f6138..f2ce519 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 _0xe5ee=['sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3c013a,_0x3ee6ab){var _0x373dca=function(_0x1ccff5){while(--_0x1ccff5){_0x3c013a['push'](_0x3c013a['shift']());}};_0x373dca(++_0x3ee6ab);}(_0xe5ee,0xd8));var _0xee5e=function(_0x4503ad,_0x265ec2){_0x4503ad=_0x4503ad-0x0;var _0x58a497=_0xe5ee[_0x4503ad];return _0x58a497;};'use strict';var Sequelize=require(_0xee5e('0x0'));var moment=require(_0xee5e('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xee5e('0x2')]},'calleridnum':{'type':Sequelize[_0xee5e('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xee5e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xee5e('0x3')],'set':function(_0x5554f3){var _0x70b068=moment(_0x5554f3);var _0x1ada80=moment(this[_0xee5e('0x4')](_0xee5e('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x433a4b=_0x70b068['diff'](_0x1ada80,'seconds');this[_0xee5e('0x6')](_0xee5e('0x7'),_0x5554f3);this[_0xee5e('0x6')]('holdtime',_0x433a4b||null);}},'position':{'type':Sequelize[_0xee5e('0x8')]},'count':{'type':Sequelize[_0xee5e('0x8')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xee5e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xee5e('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xee5e('0x3')]},'queuecallerexit':{'type':Sequelize[_0xee5e('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xee5e('0x2')],'comment':_0xee5e('0xa')},'originalposition':{'type':Sequelize[_0xee5e('0x8')]},'channel':{'type':Sequelize[_0xee5e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xee5e('0x2')]},'context':{'type':Sequelize[_0xee5e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xee5e('0x8')]},'mohtime':{'type':Sequelize[_0xee5e('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xee5e('0x2')]},'transfer':{'type':Sequelize[_0xee5e('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xee5e('0x2')],'comment':_0xee5e('0xb')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c54=['STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x3c54,0x14d));var _0x43c5=function(_0x4925b5,_0x2f8ac2){_0x4925b5=_0x4925b5-0x0;var _0x412b8b=_0x3c54[_0x4925b5];return _0x412b8b;};'use strict';var Sequelize=require(_0x43c5('0x0'));var moment=require(_0x43c5('0x1'));module[_0x43c5('0x2')]={'type':{'type':Sequelize[_0x43c5('0x3')]},'uniqueid':{'type':Sequelize[_0x43c5('0x3')]},'calleridnum':{'type':Sequelize[_0x43c5('0x3')]},'calleridname':{'type':Sequelize[_0x43c5('0x3')]},'queue':{'type':Sequelize[_0x43c5('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x43c5('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x564843){var _0x1ff20a=moment(_0x564843);var _0x50aa67=moment(this[_0x43c5('0x5')]('queuecallerjoinAt'))['format'](_0x43c5('0x6'));var _0x4c0594=_0x1ff20a['diff'](_0x50aa67,_0x43c5('0x7'));this[_0x43c5('0x8')](_0x43c5('0x9'),_0x564843);this[_0x43c5('0x8')](_0x43c5('0xa'),_0x4c0594||null);}},'position':{'type':Sequelize[_0x43c5('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x43c5('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x43c5('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x43c5('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x43c5('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x43c5('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x43c5('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x43c5('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43c5('0x3')]},'accountcode':{'type':Sequelize[_0x43c5('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x43c5('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x43c5('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x43c5('0x3')]},'transfer':{'type':Sequelize[_0x43c5('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x43c5('0x3')],'comment':_0x43c5('0xd')},'transferexten':{'type':Sequelize[_0x43c5('0x3')]},'transferuniqueid':{'type':Sequelize[_0x43c5('0x3')]},'disposition':{'type':Sequelize[_0x43c5('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 94b973a..086c1d8 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(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_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('./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(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x7a54,0x106));var _0x47a5=function(_0x49996c,_0x32682f){_0x49996c=_0x49996c-0x0;var _0x5681c2=_0x7a54[_0x49996c];return _0x5681c2;};'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 d769d0a..7c6f285 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 _0x5446=['hasOwnProperty','hook','exports','events','VoiceQueueReport','setMaxListeners','save','emit'];(function(_0x8cdd88,_0x3deacb){var _0x28d8c0=function(_0x30ba55){while(--_0x30ba55){_0x8cdd88['push'](_0x8cdd88['shift']());}};_0x28d8c0(++_0x3deacb);}(_0x5446,0xab));var _0x6544=function(_0x164e90,_0xd685e1){_0x164e90=_0x164e90-0x0;var _0x3a04c0=_0x5446[_0x164e90];return _0x3a04c0;};'use strict';var EventEmitter=require(_0x6544('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x6544('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6544('0x2')](0x0);var events={'afterCreate':_0x6544('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xbf177b){return function(_0x5484da,_0x4652cc,_0xe69c2a){VoiceQueueReportEvents[_0x6544('0x4')](_0xbf177b+':'+_0x5484da['id'],_0x5484da);VoiceQueueReportEvents[_0x6544('0x4')](_0xbf177b,_0x5484da);_0xe69c2a(null);};}for(var e in events){if(events[_0x6544('0x5')](e)){var event=events[e];VoiceQueueReport[_0x6544('0x6')](e,emitEvent(event));}}module[_0x6544('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc85d=['hook','exports','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x53e209,_0x1d2dad){var _0x58b7c7=function(_0x2befba){while(--_0x2befba){_0x53e209['push'](_0x53e209['shift']());}};_0x58b7c7(++_0x1d2dad);}(_0xc85d,0x19a));var _0xdc85=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xc85d[_0xd0a847];return _0x2536ec;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xdc85('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xdc85('0x1')](0x0);var events={'afterCreate':_0xdc85('0x2'),'afterUpdate':'update','afterDestroy':_0xdc85('0x3')};function emitEvent(_0x266ee4){return function(_0x10c61e,_0x24a64a,_0x3a802c){VoiceQueueReportEvents[_0xdc85('0x4')](_0x266ee4+':'+_0x10c61e['id'],_0x10c61e);VoiceQueueReportEvents['emit'](_0x266ee4,_0x10c61e);_0x3a802c(null);};}for(var e in events){if(events[_0xdc85('0x5')](e)){var event=events[e];VoiceQueueReport[_0xdc85('0x6')](e,emitEvent(event));}}module[_0xdc85('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9d30eda..4e895c2 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 _0x7ef8=['../../config/environment','exports','define','report_queue','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0x7ef8,0x1bf));var _0x87ef=function(_0x14eafa,_0x1f47c7){_0x14eafa=_0x14eafa-0x0;var _0x20cbd3=_0x7ef8[_0x14eafa];return _0x20cbd3;};'use strict';var _=require(_0x87ef('0x0'));var util=require(_0x87ef('0x1'));var logger=require(_0x87ef('0x2'))('api');var moment=require(_0x87ef('0x3'));var BPromise=require(_0x87ef('0x4'));var rp=require(_0x87ef('0x5'));var fs=require('fs');var path=require(_0x87ef('0x6'));var rimraf=require(_0x87ef('0x7'));var config=require(_0x87ef('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x87ef('0x9')]=function(_0x2b63c1,_0x40583f){return _0x2b63c1[_0x87ef('0xa')]('VoiceQueueReport',attributes,{'tableName':_0x87ef('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x87ef('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69b8=['VoiceQueueReport','calleridnum','lodash','util','api','moment','bluebird','exports'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x69b8,0x17a));var _0x869b=function(_0x44263c,_0x1df29a){_0x44263c=_0x44263c-0x0;var _0x243629=_0x69b8[_0x44263c];return _0x243629;};'use strict';var _=require(_0x869b('0x0'));var util=require(_0x869b('0x1'));var logger=require('../../config/logger')(_0x869b('0x2'));var moment=require(_0x869b('0x3'));var BPromise=require(_0x869b('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('./voiceQueueReport.attributes');module[_0x869b('0x5')]=function(_0x58f528,_0x5e6c36){return _0x58f528['define'](_0x869b('0x6'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x869b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3a22652..94142ff 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 _0x11ea=['message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','map','include','model','debug','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport','update','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x43b22b,_0xea722c){var _0xd4e124=function(_0x271814){while(--_0x271814){_0x43b22b['push'](_0x43b22b['shift']());}};_0xd4e124(++_0xea722c);}(_0x11ea,0x132));var _0xa11e=function(_0x3df853,_0x28a02c){_0x3df853=_0x3df853-0x0;var _0x101de3=_0x11ea[_0x3df853];return _0x101de3;};'use strict';var _=require('lodash');var util=require(_0xa11e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa11e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa11e('0x2'));var logger=require(_0xa11e('0x3'))(_0xa11e('0x4'));var config=require(_0xa11e('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa11e('0x6')]({'port':0x232a});config[_0xa11e('0x7')]=_['defaults'](config[_0xa11e('0x7')],{'host':_0xa11e('0x8'),'port':0x18eb});var socket=require(_0xa11e('0x9'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x41821b,_0xa14320,_0x17d300){return new BPromise(function(_0xec744c,_0x394853){return client['request'](_0x41821b,_0x17d300)[_0xa11e('0xa')](function(_0x458b7c){logger[_0xa11e('0xb')](_0xa11e('0xc'),_0xa14320,_0xa11e('0xd'));logger['debug'](_0xa11e('0xe'),_0xa14320,_0xa11e('0xd'),JSON[_0xa11e('0xf')](_0x458b7c));if(_0x458b7c[_0xa11e('0x10')]){if(_0x458b7c['error'][_0xa11e('0x11')]===0x1f4){logger[_0xa11e('0x10')](_0xa11e('0xc'),_0xa14320,_0x458b7c[_0xa11e('0x10')][_0xa11e('0x12')]);return _0x394853(_0x458b7c[_0xa11e('0x10')][_0xa11e('0x12')]);}logger[_0xa11e('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0xa14320,_0x458b7c[_0xa11e('0x10')][_0xa11e('0x12')]);return _0xec744c(_0x458b7c[_0xa11e('0x10')]['message']);}else{logger[_0xa11e('0xb')](_0xa11e('0xc'),_0xa14320,_0xa11e('0xd'));_0xec744c(_0x458b7c['result']['message']);}})[_0xa11e('0x13')](function(_0x2ae480){logger[_0xa11e('0x10')](_0xa11e('0xc'),_0xa14320,_0x2ae480);_0x394853(_0x2ae480);});});}exports[_0xa11e('0x14')]=function(_0x1b6c37){var _0x12f33d=this;return new Promise(function(_0x2fe467,_0x1d1a23){return db[_0xa11e('0x15')][_0xa11e('0x16')]({'raw':_0x1b6c37[_0xa11e('0x17')]?_0x1b6c37['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b6c37[_0xa11e('0x17')]?_0x1b6c37[_0xa11e('0x17')][_0xa11e('0x18')]||null:null,'attributes':_0x1b6c37[_0xa11e('0x17')]?_0x1b6c37[_0xa11e('0x17')][_0xa11e('0x19')]||null:null,'limit':_0x1b6c37[_0xa11e('0x17')]?_0x1b6c37[_0xa11e('0x17')][_0xa11e('0x1a')]||null:null,'include':_0x1b6c37[_0xa11e('0x17')]?_0x1b6c37['options']['include']?_[_0xa11e('0x1b')](_0x1b6c37[_0xa11e('0x17')][_0xa11e('0x1c')],function(_0x1296a7){return{'model':db[_0x1296a7[_0xa11e('0x1d')]],'as':_0x1296a7['as'],'attributes':_0x1296a7[_0xa11e('0x19')],'include':_0x1296a7[_0xa11e('0x1c')]?_[_0xa11e('0x1b')](_0x1296a7['include'],function(_0x14ed24){return{'model':db[_0x14ed24['model']],'as':_0x14ed24['as'],'attributes':_0x14ed24[_0xa11e('0x19')],'include':_0x14ed24[_0xa11e('0x1c')]?_[_0xa11e('0x1b')](_0x14ed24[_0xa11e('0x1c')],function(_0x405e3e){return{'model':db[_0x405e3e[_0xa11e('0x1d')]],'as':_0x405e3e['as'],'attributes':_0x405e3e[_0xa11e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa11e('0xa')](function(_0x23d50a){logger['info']('GetVoiceQueueReport',_0x1b6c37);logger[_0xa11e('0x1e')](_0xa11e('0x14'),_0x1b6c37,JSON[_0xa11e('0xf')](_0x23d50a));_0x2fe467(_0x23d50a);})['catch'](function(_0x48dd9c){logger['error'](_0xa11e('0x14'),_0x48dd9c[_0xa11e('0x12')],_0x1b6c37);_0x1d1a23(_0x12f33d[_0xa11e('0x10')](0x1f4,_0x48dd9c[_0xa11e('0x12')]));});});};exports[_0xa11e('0x1f')]=function(_0xc85aa4){var _0x263c97=this;return new Promise(function(_0x3120c3,_0x2f97ed){return db[_0xa11e('0x15')]['create'](_0xc85aa4[_0xa11e('0x20')],{'raw':_0xc85aa4[_0xa11e('0x17')]?_0xc85aa4['options'][_0xa11e('0x21')]===undefined?!![]:![]:!![]})[_0xa11e('0xa')](function(_0x108458){logger[_0xa11e('0xb')]('CreateVoiceQueueReport',_0xc85aa4);logger[_0xa11e('0x1e')](_0xa11e('0x1f'),_0xc85aa4,JSON['stringify'](_0x108458));_0x3120c3(_0x108458);})[_0xa11e('0x13')](function(_0x297d7e){logger[_0xa11e('0x10')](_0xa11e('0x1f'),_0x297d7e[_0xa11e('0x12')],_0xc85aa4);_0x2f97ed(_0x263c97[_0xa11e('0x10')](0x1f4,_0x297d7e[_0xa11e('0x12')]));});});};exports[_0xa11e('0x22')]=function(_0x49fae5){var _0x373de8=this;return new Promise(function(_0x5076d4,_0x44eabf){return db['VoiceQueueReport'][_0xa11e('0x23')](_0x49fae5[_0xa11e('0x20')],{'raw':_0x49fae5[_0xa11e('0x17')]?_0x49fae5['options'][_0xa11e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49fae5[_0xa11e('0x17')]?_0x49fae5[_0xa11e('0x17')][_0xa11e('0x18')]||null:null,'attributes':_0x49fae5['options']?_0x49fae5[_0xa11e('0x17')][_0xa11e('0x19')]||null:null,'limit':_0x49fae5[_0xa11e('0x17')]?_0x49fae5[_0xa11e('0x17')][_0xa11e('0x1a')]||null:null})[_0xa11e('0xa')](function(_0x5a1fd5){logger[_0xa11e('0xb')](_0xa11e('0x22'),_0x49fae5);logger[_0xa11e('0x1e')]('UpdateVoiceQueueReport',_0x49fae5,JSON['stringify'](_0x5a1fd5));_0x5076d4(_0x5a1fd5);})[_0xa11e('0x13')](function(_0x1e89ed){logger[_0xa11e('0x10')](_0xa11e('0x22'),_0x1e89ed[_0xa11e('0x12')],_0x49fae5);_0x44eabf(_0x373de8['error'](0x1f4,_0x1e89ed[_0xa11e('0x12')]));});});}; \ No newline at end of file +var _0x7924=['catch','CreateVoiceQueueReport','body','update','limit','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','then'];(function(_0x16eb11,_0x1a2251){var _0x3ae7ef=function(_0x575a01){while(--_0x575a01){_0x16eb11['push'](_0x16eb11['shift']());}};_0x3ae7ef(++_0x1a2251);}(_0x7924,0x90));var _0x4792=function(_0x55ff21,_0x1540f0){_0x55ff21=_0x55ff21-0x0;var _0x4baf37=_0x7924[_0x55ff21];return _0x4baf37;};'use strict';var _=require(_0x4792('0x0'));var util=require(_0x4792('0x1'));var moment=require('moment');var BPromise=require(_0x4792('0x2'));var rs=require(_0x4792('0x3'));var fs=require('fs');var Redis=require(_0x4792('0x4'));var db=require(_0x4792('0x5'))['db'];var utils=require(_0x4792('0x6'));var logger=require(_0x4792('0x7'))(_0x4792('0x8'));var config=require(_0x4792('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4792('0xa')][_0x4792('0xb')]({'port':0x232a});config[_0x4792('0xc')]=_[_0x4792('0xd')](config[_0x4792('0xc')],{'host':_0x4792('0xe'),'port':0x18eb});var socket=require(_0x4792('0xf'))(new Redis(config[_0x4792('0xc')]));require(_0x4792('0x10'))[_0x4792('0x11')](socket);function respondWithRpcPromise(_0xdefa47,_0x488148,_0x45e371){return new BPromise(function(_0x10b29f,_0x424434){return client[_0x4792('0x12')](_0xdefa47,_0x45e371)['then'](function(_0x4e7aa4){logger[_0x4792('0x13')](_0x4792('0x14'),_0x488148,'request\x20sent');logger[_0x4792('0x15')](_0x4792('0x16'),_0x488148,_0x4792('0x17'),JSON[_0x4792('0x18')](_0x4e7aa4));if(_0x4e7aa4[_0x4792('0x19')]){if(_0x4e7aa4[_0x4792('0x19')][_0x4792('0x1a')]===0x1f4){logger[_0x4792('0x19')](_0x4792('0x14'),_0x488148,_0x4e7aa4[_0x4792('0x19')][_0x4792('0x1b')]);return _0x424434(_0x4e7aa4[_0x4792('0x19')]['message']);}logger[_0x4792('0x19')](_0x4792('0x14'),_0x488148,_0x4e7aa4[_0x4792('0x19')][_0x4792('0x1b')]);return _0x10b29f(_0x4e7aa4[_0x4792('0x19')][_0x4792('0x1b')]);}else{logger['info'](_0x4792('0x14'),_0x488148,_0x4792('0x17'));_0x10b29f(_0x4e7aa4[_0x4792('0x1c')]['message']);}})['catch'](function(_0x208692){logger[_0x4792('0x19')](_0x4792('0x14'),_0x488148,_0x208692);_0x424434(_0x208692);});});}exports[_0x4792('0x1d')]=function(_0x2f1fab){var _0x259a52=this;return new Promise(function(_0x44c596,_0x1ed447){return db[_0x4792('0x1e')][_0x4792('0x1f')]({'raw':_0x2f1fab['options']?_0x2f1fab[_0x4792('0x20')][_0x4792('0x21')]===undefined?!![]:![]:!![],'where':_0x2f1fab[_0x4792('0x20')]?_0x2f1fab[_0x4792('0x20')][_0x4792('0x22')]||null:null,'attributes':_0x2f1fab[_0x4792('0x20')]?_0x2f1fab[_0x4792('0x20')][_0x4792('0x23')]||null:null,'limit':_0x2f1fab['options']?_0x2f1fab[_0x4792('0x20')]['limit']||null:null,'include':_0x2f1fab['options']?_0x2f1fab[_0x4792('0x20')][_0x4792('0x24')]?_['map'](_0x2f1fab[_0x4792('0x20')][_0x4792('0x24')],function(_0x1ee6dd){return{'model':db[_0x1ee6dd['model']],'as':_0x1ee6dd['as'],'attributes':_0x1ee6dd[_0x4792('0x23')],'include':_0x1ee6dd[_0x4792('0x24')]?_[_0x4792('0x25')](_0x1ee6dd[_0x4792('0x24')],function(_0x5c8c67){return{'model':db[_0x5c8c67[_0x4792('0x26')]],'as':_0x5c8c67['as'],'attributes':_0x5c8c67[_0x4792('0x23')],'include':_0x5c8c67[_0x4792('0x24')]?_[_0x4792('0x25')](_0x5c8c67['include'],function(_0x4978e8){return{'model':db[_0x4978e8[_0x4792('0x26')]],'as':_0x4978e8['as'],'attributes':_0x4978e8[_0x4792('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4792('0x27')](function(_0x3880ad){logger[_0x4792('0x13')](_0x4792('0x1d'),_0x2f1fab);logger[_0x4792('0x15')](_0x4792('0x1d'),_0x2f1fab,JSON[_0x4792('0x18')](_0x3880ad));_0x44c596(_0x3880ad);})[_0x4792('0x28')](function(_0x15c245){logger[_0x4792('0x19')]('GetVoiceQueueReport',_0x15c245['message'],_0x2f1fab);_0x1ed447(_0x259a52[_0x4792('0x19')](0x1f4,_0x15c245[_0x4792('0x1b')]));});});};exports[_0x4792('0x29')]=function(_0x3d9445){var _0x3cc5a9=this;return new Promise(function(_0x185d5b,_0x4d52fb){return db[_0x4792('0x1e')]['create'](_0x3d9445[_0x4792('0x2a')],{'raw':_0x3d9445[_0x4792('0x20')]?_0x3d9445['options'][_0x4792('0x21')]===undefined?!![]:![]:!![]})[_0x4792('0x27')](function(_0x1777e3){logger['info'](_0x4792('0x29'),_0x3d9445);logger['debug']('CreateVoiceQueueReport',_0x3d9445,JSON[_0x4792('0x18')](_0x1777e3));_0x185d5b(_0x1777e3);})[_0x4792('0x28')](function(_0x1cd2b5){logger['error'](_0x4792('0x29'),_0x1cd2b5[_0x4792('0x1b')],_0x3d9445);_0x4d52fb(_0x3cc5a9[_0x4792('0x19')](0x1f4,_0x1cd2b5['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x55d3c8){var _0x56810e=this;return new Promise(function(_0x435c22,_0x142636){return db[_0x4792('0x1e')][_0x4792('0x2b')](_0x55d3c8['body'],{'raw':_0x55d3c8[_0x4792('0x20')]?_0x55d3c8[_0x4792('0x20')][_0x4792('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55d3c8[_0x4792('0x20')]?_0x55d3c8[_0x4792('0x20')][_0x4792('0x22')]||null:null,'attributes':_0x55d3c8[_0x4792('0x20')]?_0x55d3c8['options']['attributes']||null:null,'limit':_0x55d3c8[_0x4792('0x20')]?_0x55d3c8[_0x4792('0x20')][_0x4792('0x2c')]||null:null})[_0x4792('0x27')](function(_0x44e03b){logger[_0x4792('0x13')](_0x4792('0x2d'),_0x55d3c8);logger[_0x4792('0x15')](_0x4792('0x2d'),_0x55d3c8,JSON[_0x4792('0x18')](_0x44e03b));_0x435c22(_0x44e03b);})[_0x4792('0x28')](function(_0x1f3afe){logger[_0x4792('0x19')](_0x4792('0x2d'),_0x1f3afe[_0x4792('0x1b')],_0x55d3c8);_0x142636(_0x56810e[_0x4792('0x19')](0x1f4,_0x1f3afe['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index e7c5593..331fa14 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 _0x9454=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit','removeListener','register'];(function(_0x5e6546,_0x175dc7){var _0xe3e205=function(_0x57b20e){while(--_0x57b20e){_0x5e6546['push'](_0x5e6546['shift']());}};_0xe3e205(++_0x175dc7);}(_0x9454,0x1e2));var _0x4945=function(_0x30e4e3,_0x3d854a){_0x30e4e3=_0x30e4e3-0x0;var _0x37e107=_0x9454[_0x30e4e3];return _0x37e107;};'use strict';var VoiceQueueReportEvents=require(_0x4945('0x0'));var events=[_0x4945('0x1'),'remove',_0x4945('0x2')];function createListener(_0x92a130,_0x55722f){return function(_0x69dbd5){_0x55722f[_0x4945('0x3')](_0x92a130,_0x69dbd5);};}function removeListener(_0x59713a,_0x4132e6){return function(){VoiceQueueReportEvents[_0x4945('0x4')](_0x59713a,_0x4132e6);};}exports[_0x4945('0x5')]=function(_0x520460){for(var _0x5431ba=0x0,_0x474aa8=events[_0x4945('0x6')];_0x5431ba<_0x474aa8;_0x5431ba++){var _0x5d8cf2=events[_0x5431ba];var _0x4b8271=createListener(_0x4945('0x7')+_0x5d8cf2,_0x520460);VoiceQueueReportEvents['on'](_0x5d8cf2,_0x4b8271);}}; \ No newline at end of file +var _0x8461=['register','length','voiceQueueReport:','save','update','emit'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0x8461,0x13b));var _0x1846=function(_0x11136e,_0x413e0a){_0x11136e=_0x11136e-0x0;var _0x5c2ae0=_0x8461[_0x11136e];return _0x5c2ae0;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x1846('0x0'),'remove',_0x1846('0x1')];function createListener(_0x56dc79,_0x54f47f){return function(_0x1a98c2){_0x54f47f[_0x1846('0x2')](_0x56dc79,_0x1a98c2);};}function removeListener(_0x3334ce,_0x325c5f){return function(){VoiceQueueReportEvents['removeListener'](_0x3334ce,_0x325c5f);};}exports[_0x1846('0x3')]=function(_0x51ef00){for(var _0x2f4442=0x0,_0x2bbb52=events[_0x1846('0x4')];_0x2f4442<_0x2bbb52;_0x2f4442++){var _0x290361=events[_0x2f4442];var _0x20c776=createListener(_0x1846('0x5')+_0x290361,_0x51ef00);VoiceQueueReportEvents['on'](_0x290361,_0x20c776);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a1dcfbd..ccb30c1 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 _0x6422=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','util','connect-timeout','express','../../components/interaction/service'];(function(_0x21d242,_0x21e56c){var _0x1e89a6=function(_0x3b54fa){while(--_0x3b54fa){_0x21d242['push'](_0x21d242['shift']());}};_0x1e89a6(++_0x21e56c);}(_0x6422,0x168));var _0x2642=function(_0x5ac113,_0x9a7358){_0x5ac113=_0x5ac113-0x0;var _0x577665=_0x6422[_0x5ac113];return _0x577665;};'use strict';var multer=require('multer');var util=require(_0x2642('0x0'));var path=require('path');var timeout=require(_0x2642('0x1'));var express=require(_0x2642('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2642('0x3'));var config=require(_0x2642('0x4'));var controller=require(_0x2642('0x5'));router[_0x2642('0x6')]('/',auth[_0x2642('0x7')](),controller['index']);router[_0x2642('0x6')](_0x2642('0x8'),auth[_0x2642('0x7')](),controller[_0x2642('0x9')]);router['post']('/',auth[_0x2642('0x7')](),controller[_0x2642('0xa')]);router['put'](_0x2642('0x8'),auth[_0x2642('0x7')](),controller[_0x2642('0xb')]);router[_0x2642('0xc')](_0x2642('0x8'),auth['isAuthenticated'](),controller[_0x2642('0xd')]);module['exports']=router; \ No newline at end of file +var _0xd4ba=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x3e2c31,_0x5ce49e){var _0x4814d9=function(_0x586ac0){while(--_0x586ac0){_0x3e2c31['push'](_0x3e2c31['shift']());}};_0x4814d9(++_0x5ce49e);}(_0xd4ba,0x7c));var _0xad4b=function(_0x177c9f,_0x440050){_0x177c9f=_0x177c9f-0x0;var _0x1ec116=_0xd4ba[_0x177c9f];return _0x1ec116;};'use strict';var multer=require(_0xad4b('0x0'));var util=require(_0xad4b('0x1'));var path=require(_0xad4b('0x2'));var timeout=require(_0xad4b('0x3'));var express=require(_0xad4b('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xad4b('0x5'));var config=require(_0xad4b('0x6'));var controller=require(_0xad4b('0x7'));router[_0xad4b('0x8')]('/',auth[_0xad4b('0x9')](),controller[_0xad4b('0xa')]);router[_0xad4b('0x8')](_0xad4b('0xb'),auth['isAuthenticated'](),controller[_0xad4b('0xc')]);router[_0xad4b('0xd')]('/',auth[_0xad4b('0x9')](),controller[_0xad4b('0xe')]);router[_0xad4b('0xf')](_0xad4b('0xb'),auth[_0xad4b('0x9')](),controller[_0xad4b('0x10')]);router[_0xad4b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xad4b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c49abc1..a193840 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 _0x0519=['STRING','DATE','format','exports'];(function(_0x218dcf,_0x3d3161){var _0x1141f1=function(_0x4ea8c8){while(--_0x4ea8c8){_0x218dcf['push'](_0x218dcf['shift']());}};_0x1141f1(++_0x3d3161);}(_0x0519,0x113));var _0x9051=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0x0519[_0x4d7379];return _0x46d7cf;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x9051('0x0')]={'time':{'type':Sequelize[_0x9051('0x1')]},'callid':{'type':Sequelize[_0x9051('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9051('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9051('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9051('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9051('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9051('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9051('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x9051('0x2')],'allowNull':![],'defaultValue':moment()[_0x9051('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xf2b4=['exports','STRING','format','moment'];(function(_0x3c87f0,_0x2181d8){var _0x5213bb=function(_0x1870b6){while(--_0x1870b6){_0x3c87f0['push'](_0x3c87f0['shift']());}};_0x5213bb(++_0x2181d8);}(_0xf2b4,0x19f));var _0x4f2b=function(_0x5d81e0,_0x152a1b){_0x5d81e0=_0x5d81e0-0x0;var _0x2cd7fe=_0xf2b4[_0x5d81e0];return _0x2cd7fe;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4f2b('0x0'));module[_0x4f2b('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4f2b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x4f2b('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 478c52c..0043146 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 _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(_0x277ab1,_0x3f27c4){var _0x1ae29a=function(_0x2f1b14){while(--_0x2f1b14){_0x277ab1['push'](_0x277ab1['shift']());}};_0x1ae29a(++_0x3f27c4);}(_0xb10b,0x12a));var _0xbb10=function(_0x12995e,_0x573c6d){_0x12995e=_0x12995e-0x0;var _0x321a35=_0xb10b[_0x12995e];return _0x321a35;};'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 +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(_0x1e39d2,_0x43887d){var _0x1f7369=function(_0xb8ff01){while(--_0xb8ff01){_0x1e39d2['push'](_0x1e39d2['shift']());}};_0x1f7369(++_0x43887d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a49d084..6a15804 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 _0xdc97=['event_dtm','event','dtm','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x2cc60e,_0x1ba500){var _0x3cf238=function(_0x350ecc){while(--_0x350ecc){_0x2cc60e['push'](_0x2cc60e['shift']());}};_0x3cf238(++_0x1ba500);}(_0xdc97,0x13b));var _0x7dc9=function(_0x29a7e7,_0x87ef4d){_0x29a7e7=_0x29a7e7-0x0;var _0x467c7a=_0xdc97[_0x29a7e7];return _0x467c7a;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x7dc9('0xa'),'fields':[_0x7dc9('0xb'),_0x7dc9('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x277c=['dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','voice_queues_log','event_dtm'];(function(_0x5e980d,_0x316987){var _0x347477=function(_0x5566a8){while(--_0x5566a8){_0x5e980d['push'](_0x5e980d['shift']());}};_0x347477(++_0x316987);}(_0x277c,0x153));var _0xc277=function(_0x192900,_0x368955){_0x192900=_0x192900-0x0;var _0x4db314=_0x277c[_0x192900];return _0x4db314;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require(_0xc277('0x4'));var rp=require(_0xc277('0x5'));var fs=require('fs');var path=require(_0xc277('0x6'));var rimraf=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x1a6582,_0x5a4f03){return _0x1a6582[_0xc277('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0xc277('0xa'),'paranoid':![],'indexes':[{'name':_0xc277('0xb'),'fields':['event',_0xc277('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8c7cc9a..e5b9434 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 _0x6b24=['client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x6b24,0x1ce));var _0x46b2=function(_0x144c0c,_0x113cfe){_0x144c0c=_0x144c0c-0x0;var _0x436221=_0x6b24[_0x144c0c];return _0x436221;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var moment=require(_0x46b2('0x1'));var BPromise=require(_0x46b2('0x2'));var rs=require(_0x46b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46b2('0x4'))('rpc');var config=require(_0x46b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x46b2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512905,_0x326eb7,_0x233ccf){return new BPromise(function(_0x1f81b8,_0x1531c){return client[_0x46b2('0x7')](_0x512905,_0x233ccf)[_0x46b2('0x8')](function(_0x3144df){logger[_0x46b2('0x9')](_0x46b2('0xa'),_0x326eb7,'request\x20sent');logger['debug'](_0x46b2('0xb'),_0x326eb7,_0x46b2('0xc'),JSON[_0x46b2('0xd')](_0x3144df));if(_0x3144df['error']){if(_0x3144df[_0x46b2('0xe')][_0x46b2('0xf')]===0x1f4){logger[_0x46b2('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x326eb7,_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);return _0x1531c(_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);}logger[_0x46b2('0xe')](_0x46b2('0xa'),_0x326eb7,_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);return _0x1f81b8(_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);}else{logger['info'](_0x46b2('0xa'),_0x326eb7,_0x46b2('0xc'));_0x1f81b8(_0x3144df['result'][_0x46b2('0x10')]);}})[_0x46b2('0x11')](function(_0xe3d3d9){logger[_0x46b2('0xe')](_0x46b2('0xa'),_0x326eb7,_0xe3d3d9);_0x1531c(_0xe3d3d9);});});} \ No newline at end of file +var _0x5eb1=['../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x5eb1,0x7c));var _0x15eb=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x5eb1[_0x46d0c9];return _0x174506;};'use strict';var _=require('lodash');var util=require(_0x15eb('0x0'));var moment=require(_0x15eb('0x1'));var BPromise=require(_0x15eb('0x2'));var rs=require(_0x15eb('0x3'));var fs=require('fs');var Redis=require(_0x15eb('0x4'));var db=require(_0x15eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15eb('0x6'))(_0x15eb('0x7'));var config=require(_0x15eb('0x8'));var jayson=require(_0x15eb('0x9'));var client=jayson['client'][_0x15eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212692,_0x594f54,_0xe4d8ce){return new BPromise(function(_0x160879,_0x730b12){return client[_0x15eb('0xb')](_0x212692,_0xe4d8ce)[_0x15eb('0xc')](function(_0x2ad2c1){logger[_0x15eb('0xd')](_0x15eb('0xe'),_0x594f54,_0x15eb('0xf'));logger[_0x15eb('0x10')](_0x15eb('0x11'),_0x594f54,_0x15eb('0xf'),JSON[_0x15eb('0x12')](_0x2ad2c1));if(_0x2ad2c1['error']){if(_0x2ad2c1[_0x15eb('0x13')]['code']===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x594f54,_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);return _0x730b12(_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);}logger['error'](_0x15eb('0xe'),_0x594f54,_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);return _0x160879(_0x2ad2c1[_0x15eb('0x13')]['message']);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x594f54,'request\x20sent');_0x160879(_0x2ad2c1[_0x15eb('0x15')]['message']);}})['catch'](function(_0x3a78e9){logger['error'](_0x15eb('0xe'),_0x594f54,_0x3a78e9);_0x730b12(_0x3a78e9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 5af18cc..5e96e24 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(_0x551b1c,_0x3584f9){var _0x131273=function(_0x553185){while(--_0x553185){_0x551b1c['push'](_0x551b1c['shift']());}};_0x131273(++_0x3584f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x82a677,_0x113919){var _0x5e8914=function(_0x21522f){while(--_0x21522f){_0x82a677['push'](_0x82a677['shift']());}};_0x5e8914(++_0x113919);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 57589a4..873dcca 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 _0x587c=['extname','value','STRING','channel','setDataValue','membername','split','TEXT','NEW','FLOAT','MM-DD-YYYY\x20HH:mm','toString','format','sequelize','moment','path','exports','VIRTUAL','getDataValue'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x587c,0xf1));var _0xc587=function(_0x3becdb,_0x367f32){_0x3becdb=_0x3becdb-0x0;var _0x2b2a80=_0x587c[_0x3becdb];return _0x2b2a80;};'use strict';var Sequelize=require(_0xc587('0x0'));var moment=require(_0xc587('0x1'));var path=require(_0xc587('0x2'));module[_0xc587('0x3')]={'format':{'type':Sequelize[_0xc587('0x4')],'get':function(){return this[_0xc587('0x5')]('value')?path[_0xc587('0x6')](this[_0xc587('0x5')](_0xc587('0x7'))):undefined;}},'uniqueid':{'type':Sequelize[_0xc587('0x8')]},'channel':{'type':Sequelize[_0xc587('0x8')],'set':function(_0x675dc1){if(_0x675dc1){this['setDataValue'](_0xc587('0x9'),_0x675dc1);this[_0xc587('0xa')](_0xc587('0xb'),_0x675dc1[_0xc587('0xc')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xc587('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc587('0x8')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc587('0x8')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc587('0x8')]},'value':{'type':Sequelize[_0xc587('0x8')]},'type':{'type':Sequelize[_0xc587('0x8')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xc587('0x8')]},'userDisposition':{'type':Sequelize[_0xc587('0x8')]},'location':{'type':Sequelize[_0xc587('0xd')]},'transcribeName':{'type':Sequelize[_0xc587('0x8')]},'transcribeStatus':{'type':Sequelize[_0xc587('0x8')],'defaultValue':_0xc587('0xe')},'fileUri':{'type':Sequelize[_0xc587('0xd')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xc587('0x8')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0xc587('0xf')]},'sNeutral':{'type':Sequelize[_0xc587('0xf')]},'sMixed':{'type':Sequelize[_0xc587('0xf')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc587('0x5')]('createdAt'))['format'](_0xc587('0x10'))[_0xc587('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc587('0x5')]('updatedAt'))[_0xc587('0x12')](_0xc587('0x10'))[_0xc587('0x11')]();}}}; \ No newline at end of file +var _0x063e=['exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','sequelize','moment','path'];(function(_0x3686b4,_0xb1d112){var _0x3ce853=function(_0x253b90){while(--_0x253b90){_0x3686b4['push'](_0x3686b4['shift']());}};_0x3ce853(++_0xb1d112);}(_0x063e,0x111));var _0xe063=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x063e[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0xe063('0x0'));var moment=require(_0xe063('0x1'));var path=require(_0xe063('0x2'));module[_0xe063('0x3')]={'format':{'type':Sequelize[_0xe063('0x4')],'get':function(){return this[_0xe063('0x5')](_0xe063('0x6'))?path[_0xe063('0x7')](this[_0xe063('0x5')](_0xe063('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0xe063('0x8')]},'channel':{'type':Sequelize[_0xe063('0x8')],'set':function(_0x4cc570){if(_0x4cc570){this['setDataValue']('channel',_0x4cc570);this[_0xe063('0x9')](_0xe063('0xa'),_0x4cc570[_0xe063('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe063('0x8')]},'calleridname':{'type':Sequelize[_0xe063('0x8')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe063('0x8')]},'exten':{'type':Sequelize[_0xe063('0x8')]},'value':{'type':Sequelize[_0xe063('0x8')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xe063('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xe063('0x8')]},'userDisposition':{'type':Sequelize[_0xe063('0x8')]},'location':{'type':Sequelize[_0xe063('0xd')]},'transcribeName':{'type':Sequelize[_0xe063('0x8')]},'transcribeStatus':{'type':Sequelize[_0xe063('0x8')],'defaultValue':_0xe063('0xe')},'fileUri':{'type':Sequelize[_0xe063('0xd')]},'fileText':{'type':Sequelize[_0xe063('0xd')]},'failureReason':{'type':Sequelize[_0xe063('0xd')]},'sentiment':{'type':Sequelize[_0xe063('0x8')]},'sPositive':{'type':Sequelize[_0xe063('0xf')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0xe063('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe063('0x5')](_0xe063('0x11')))[_0xe063('0x12')](_0xe063('0x13'))[_0xe063('0x14')]();}},'updatedAt':{'type':Sequelize[_0xe063('0x15')],'get':function(){return moment(this[_0xe063('0x5')](_0xe063('0x16')))[_0xe063('0x12')]('MM-DD-YYYY\x20HH:mm')[_0xe063('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 21d57b1..bcd5ae3 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 _0x16e1=['Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','send','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','name','options','findAll','rows','catch','show','params','keys','fields','includeAll','merge','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','sequelize','MD5','token','$and','push','format','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider'];(function(_0x1c65a7,_0x457b46){var _0x504003=function(_0x198c5f){while(--_0x198c5f){_0x1c65a7['push'](_0x1c65a7['shift']());}};_0x504003(++_0x457b46);}(_0x16e1,0x1de));var _0x116e=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x16e1[_0x3ce2c4];return _0x4047c1;};'use strict';var pdf=require(_0x116e('0x0'));var emlformat=require(_0x116e('0x1'));var rimraf=require(_0x116e('0x2'));var zipdir=require(_0x116e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x116e('0x4'));var moment=require(_0x116e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x116e('0x6'));var util=require(_0x116e('0x7'));var path=require(_0x116e('0x8'));var sox=require(_0x116e('0x9'));var csv=require(_0x116e('0xa'));var ejs=require(_0x116e('0xb'));var fs=require('fs');var _=require(_0x116e('0xc'));var squel=require(_0x116e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x116e('0xe'));var toCsv=require(_0x116e('0xa'));var querystring=require(_0x116e('0xf'));var Papa=require('papaparse');var AWS=require(_0x116e('0x10'));var uuidv4=require(_0x116e('0x11'));var Redis=require(_0x116e('0x12'));var authService=require(_0x116e('0x13'));var qs=require(_0x116e('0x14'));var as=require(_0x116e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x116e('0x16'))(_0x116e('0x17'));var utils=require('../../config/utils');var config=require(_0x116e('0x18'));var db=require(_0x116e('0x19'))['db'];function respondWithStatusCode(_0x593bd2,_0x400e50){_0x400e50=_0x400e50||0xcc;return function(_0xa9fb22){if(_0xa9fb22){return _0x593bd2[_0x116e('0x1a')](_0x400e50);}return _0x593bd2['status'](_0x400e50)[_0x116e('0x1b')]();};}function respondWithResult(_0xf191d9,_0x30e823){_0x30e823=_0x30e823||0xc8;return function(_0x28a080){if(_0x28a080){return _0xf191d9[_0x116e('0x1c')](_0x30e823)[_0x116e('0x1d')](_0x28a080);}};}function respondWithFilteredResult(_0x230b89,_0x449ed9){return function(_0x58ba2d){if(_0x58ba2d){var _0x20915e=_0x58ba2d[_0x116e('0x1e')],_0x1f4db5=_0x449ed9[_0x116e('0x1f')],_0x432b45=_0x449ed9[_0x116e('0x1f')]+_0x449ed9[_0x116e('0x20')],_0xf8a2f5;if(_0x432b45>=_0x20915e){_0x432b45=_0x20915e;_0xf8a2f5=0xc8;}else{_0xf8a2f5=0xce;}_0x230b89[_0x116e('0x1c')](_0xf8a2f5);return _0x230b89[_0x116e('0x21')](_0x116e('0x22'),_0x1f4db5+'-'+_0x432b45+'/'+_0x20915e)[_0x116e('0x1d')](_0x58ba2d);}return null;};}function patchUpdates(_0x4888c3){return function(_0x40c1cd){try{jsonpatch['apply'](_0x40c1cd,_0x4888c3,!![]);}catch(_0x43c5d0){return BPromise[_0x116e('0x23')](_0x43c5d0);}return _0x40c1cd[_0x116e('0x24')]();};}function saveUpdates(_0x451096,_0x216a8c){return function(_0x4433a0){if(_0x4433a0){return _0x4433a0[_0x116e('0x25')](_0x451096)[_0x116e('0x26')](function(_0x2fd0b6){return _0x2fd0b6;});}return null;};}function removeEntity(_0x37bb98,_0xfe4293){return function(_0x4b88fb){if(_0x4b88fb){return _0x4b88fb['destroy']()[_0x116e('0x26')](function(){_0x37bb98['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22e162,_0x41f8d8){return function(_0x4aa65e){if(!_0x4aa65e){_0x22e162[_0x116e('0x1a')](0x194);}return _0x4aa65e;};}function handleError(_0x48ae61,_0x27ffac){_0x27ffac=_0x27ffac||0x1f4;return function(_0x349c49){logger[_0x116e('0x27')](_0x349c49[_0x116e('0x28')]);if(_0x349c49['name']){delete _0x349c49['name'];}_0x48ae61[_0x116e('0x1c')](_0x27ffac)[_0x116e('0x29')](_0x349c49);};}exports[_0x116e('0x2a')]=function(_0x486381,_0x2b6af7){var _0x4efaa2={},_0x5d67da={},_0x498298={'count':0x0,'rows':[]};var _0x1142ec=_[_0x116e('0x2b')](db[_0x116e('0x2c')][_0x116e('0x2d')],function(_0x361ac8){return{'name':_0x361ac8['fieldName'],'type':_0x361ac8[_0x116e('0x2e')][_0x116e('0x2f')]};});_0x5d67da[_0x116e('0x30')]=_[_0x116e('0x31')](_[_0x116e('0x2b')](_0x1142ec,'name'),['format']);_0x5d67da['query']=_['keys'](_0x486381[_0x116e('0x32')]);_0x5d67da[_0x116e('0x33')]=_[_0x116e('0x34')](_0x5d67da[_0x116e('0x30')],_0x5d67da[_0x116e('0x32')]);_0x4efaa2['attributes']=_[_0x116e('0x34')](_0x5d67da[_0x116e('0x30')],qs['fields'](_0x486381['query']['fields']));_0x4efaa2[_0x116e('0x35')]=_0x4efaa2[_0x116e('0x35')]['length']?_0x4efaa2[_0x116e('0x35')]:_0x5d67da[_0x116e('0x30')];if(!_0x486381[_0x116e('0x32')][_0x116e('0x36')](_0x116e('0x37'))){_0x4efaa2[_0x116e('0x20')]=qs[_0x116e('0x20')](_0x486381[_0x116e('0x32')][_0x116e('0x20')]);_0x4efaa2['offset']=qs[_0x116e('0x1f')](_0x486381['query'][_0x116e('0x1f')]);}_0x4efaa2[_0x116e('0x38')]=qs[_0x116e('0x39')](_0x486381[_0x116e('0x32')]['sort']);_0x4efaa2['where']=qs['filters'](_[_0x116e('0x3a')](_0x486381['query'],_0x5d67da[_0x116e('0x33')]),_0x1142ec);if(_0x486381['query'][_0x116e('0x3b')]){_0x4efaa2[_0x116e('0x3c')]=_['merge'](_0x4efaa2['where'],{'$or':_[_0x116e('0x2b')](_0x1142ec,function(_0x130aad){if(_0x130aad[_0x116e('0x2e')]!==_0x116e('0x3d')){var _0x4e15c7={};_0x4e15c7[_0x130aad[_0x116e('0x3e')]]={'$like':'%'+_0x486381[_0x116e('0x32')]['filter']+'%'};return _0x4e15c7;}})});}_0x4efaa2=_['merge']({},_0x4efaa2,_0x486381[_0x116e('0x3f')]);var _0x531dfb={'where':_0x4efaa2[_0x116e('0x3c')]};return db[_0x116e('0x2c')]['count'](_0x531dfb)[_0x116e('0x26')](function(_0x11db2b){_0x498298[_0x116e('0x1e')]=_0x11db2b;if(_0x486381[_0x116e('0x32')]['includeAll']){_0x4efaa2['include']=[{'all':!![]}];}return db[_0x116e('0x2c')][_0x116e('0x40')](_0x4efaa2);})['then'](function(_0x42c0f0){_0x498298[_0x116e('0x41')]=_0x42c0f0;return _0x498298;})['then'](respondWithFilteredResult(_0x2b6af7,_0x4efaa2))[_0x116e('0x42')](handleError(_0x2b6af7,null));};exports[_0x116e('0x43')]=function(_0x22a27c,_0x3a9b23){var _0x4fda8f={'raw':![],'where':{'id':_0x22a27c[_0x116e('0x44')]['id']}},_0x217358={};_0x217358[_0x116e('0x30')]=_['keys'](db[_0x116e('0x2c')][_0x116e('0x2d')]);_0x217358['query']=_[_0x116e('0x45')](_0x22a27c[_0x116e('0x32')]);_0x217358['filters']=_[_0x116e('0x34')](_0x217358[_0x116e('0x30')],_0x217358['query']);_0x4fda8f[_0x116e('0x35')]=_[_0x116e('0x34')](_0x217358[_0x116e('0x30')],qs[_0x116e('0x46')](_0x22a27c[_0x116e('0x32')][_0x116e('0x46')]));_0x4fda8f[_0x116e('0x35')]=_0x4fda8f[_0x116e('0x35')]['length']?_0x4fda8f['attributes']:_0x217358[_0x116e('0x30')];if(_0x22a27c[_0x116e('0x32')][_0x116e('0x47')]){_0x4fda8f['include']=[{'all':!![]}];}_0x4fda8f=_[_0x116e('0x48')]({},_0x4fda8f,_0x22a27c['options']);return db[_0x116e('0x2c')][_0x116e('0x49')](_0x4fda8f)[_0x116e('0x26')](handleEntityNotFound(_0x3a9b23,null))[_0x116e('0x26')](respondWithResult(_0x3a9b23,null))['catch'](handleError(_0x3a9b23,null));};exports[_0x116e('0x4a')]=function(_0x226df9,_0x34dc4a){return db[_0x116e('0x2c')]['create'](_0x226df9[_0x116e('0x4b')],{})['then'](respondWithResult(_0x34dc4a,0xc9))['catch'](handleError(_0x34dc4a,null));};exports['update']=function(_0x348367,_0x466900){if(_0x348367[_0x116e('0x4b')]['id']){delete _0x348367[_0x116e('0x4b')]['id'];}return db[_0x116e('0x2c')][_0x116e('0x49')]({'where':{'id':_0x348367[_0x116e('0x44')]['id']}})[_0x116e('0x26')](handleEntityNotFound(_0x466900,null))[_0x116e('0x26')](saveUpdates(_0x348367[_0x116e('0x4b')],null))['then'](respondWithResult(_0x466900,null))[_0x116e('0x42')](handleError(_0x466900,null));};exports[_0x116e('0x4c')]=function(_0x7a954a,_0x1c3a1c){return db[_0x116e('0x2c')][_0x116e('0x4c')]()[_0x116e('0x26')](respondWithResult(_0x1c3a1c,null))[_0x116e('0x42')](handleError(_0x1c3a1c,null));};exports[_0x116e('0x4d')]=function(_0x14ca3e,_0x3e876a,_0x444449){var _0x11a29a=require(_0x116e('0x4e'));var _0x21f089=![];var _0x4dcf8d={};if(_0x14ca3e[_0x116e('0x32')]['type']&&_0x14ca3e[_0x116e('0x32')]['type']===_0x116e('0x4f')){_0x4dcf8d[_0x116e('0x4f')]=_0x14ca3e['params']['id'];}else{_0x4dcf8d['id']=_0x14ca3e[_0x116e('0x44')]['id'];}return db[_0x116e('0x2c')][_0x116e('0x49')]({'where':_0x4dcf8d,'attributes':['id',_0x116e('0x50')],'raw':!![]})[_0x116e('0x26')](handleEntityNotFound(_0x3e876a,null))[_0x116e('0x26')](function(_0x5b7953){if(_0x5b7953){var _0x520772=_0x5b7953[_0x116e('0x50')];var _0x582c7d=util['format'](_0x116e('0x51'),_0x520772);if(fs[_0x116e('0x52')](_0x582c7d)){_0x21f089=!![];return _0x11a29a[_0x116e('0x53')](_0x582c7d,_0x520772,config[_0x116e('0x54')][_0x116e('0x55')])[_0x116e('0x26')](function(){return _0x5b7953;});}return _0x5b7953;}})[_0x116e('0x26')](function(_0x443ae8){if(_0x443ae8){var _0x4a931b=_0x443ae8[_0x116e('0x50')];if(!fs[_0x116e('0x52')](_0x4a931b)){throw new db[(_0x116e('0x56'))][(_0x116e('0x57'))](_0x116e('0x58'));}if(_0x443ae8[_0x116e('0x59')]){return _0x3e876a[_0x116e('0x4d')](_0x4a931b,_0x443ae8[_0x116e('0x59')]+path['extname'](_0x4a931b),function(){if(_0x21f089){fs[_0x116e('0x5a')](_0x4a931b);}});}else{return _0x3e876a[_0x116e('0x4d')](_0x4a931b,function(_0x1bd74b){if(_0x21f089){fs[_0x116e('0x5a')](_0x4a931b);}});}}})[_0x116e('0x42')](function(_0x3e78c7){if(_0x3e78c7[_0x116e('0x5b')]===_0x116e('0x58')){_0x3e876a[_0x116e('0x1c')](0x194)[_0x116e('0x29')]('Not\x20found');}else{return handleError(_0x3e876a,null);}});};exports['downloads']=function(_0x18d2e1,_0x5168a8,_0x168264){var _0x45d8fb=require(_0x116e('0x4e'));var _0x341289=![];var _0x4be80e={'$and':[db[_0x116e('0x5c')][_0x116e('0x3c')](db[_0x116e('0x5c')]['fn'](_0x116e('0x5d'),db[_0x116e('0x5c')]['col'](_0x116e('0x4f'))),_0x18d2e1['query'][_0x116e('0x5e')])]};if(_0x18d2e1['query'][_0x116e('0x2e')]&&_0x18d2e1['query'][_0x116e('0x2e')]==='uniqueid'){_0x4be80e[_0x116e('0x5f')][_0x116e('0x60')]({'uniqueid':_0x18d2e1[_0x116e('0x44')]['id']});}else{_0x4be80e[_0x116e('0x5f')]['push']({'id':_0x18d2e1[_0x116e('0x44')]['id']});}return db[_0x116e('0x2c')][_0x116e('0x49')]({'where':_0x4be80e,'attributes':['id',_0x116e('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x5168a8,null))[_0x116e('0x26')](function(_0x53c798){if(_0x53c798){var _0x20a16c=util[_0x116e('0x61')](_0x116e('0x51'),_0x53c798[_0x116e('0x50')]);if(fs[_0x116e('0x52')](_0x20a16c)){_0x341289=!![];return _0x45d8fb[_0x116e('0x53')](_0x20a16c,_0x53c798[_0x116e('0x50')],config[_0x116e('0x54')][_0x116e('0x55')])[_0x116e('0x26')](function(){return _0x53c798;});}return _0x53c798;}})[_0x116e('0x26')](function(_0xa18342){if(_0xa18342){if(!fs[_0x116e('0x52')](_0xa18342['value'])){throw new db[(_0x116e('0x56'))][(_0x116e('0x57'))](_0x116e('0x58'));}if(_0xa18342[_0x116e('0x59')]){return _0x5168a8[_0x116e('0x4d')](_0xa18342[_0x116e('0x50')],_0xa18342[_0x116e('0x59')]+path['extname'](_0xa18342[_0x116e('0x50')]),function(){if(_0x341289){fs[_0x116e('0x5a')](_0xa18342['value']);}});}else{return _0x5168a8['download'](_0xa18342[_0x116e('0x50')],function(_0x2e7514){if(_0x341289){fs[_0x116e('0x5a')](_0xa18342[_0x116e('0x50')]);}});}}})[_0x116e('0x42')](handleError(_0x5168a8,null));};exports[_0x116e('0x62')]=function(_0x2d904c,_0x5adaae){return db[_0x116e('0x2c')][_0x116e('0x49')]({'where':{'id':_0x2d904c['params']['id']}})[_0x116e('0x26')](function(_0x5a8da3){if(!_0x5a8da3)throw new ReferenceError(_0x116e('0x63'));return _0x5a8da3;})[_0x116e('0x26')](function(_0x1e5b5a){var _0x2041f1=_0x1e5b5a[_0x116e('0x50')];logger[_0x116e('0x64')](_0x116e('0x65'),_0x2041f1);if(!_['isNil'](_0x1e5b5a['value'])&&fs['existsSync'](_0x2041f1)){logger[_0x116e('0x64')](_0x116e('0x66')+_0x2041f1+_0x116e('0x67'));fs[_0x116e('0x68')](_0x2041f1);}_0x2041f1=_0x2041f1+_0x116e('0x69');if(!_[_0x116e('0x6a')](_0x1e5b5a[_0x116e('0x50')])&&fs[_0x116e('0x52')](_0x2041f1)){logger['info'](_0x116e('0x66')+_0x2041f1+_0x116e('0x67'));fs['unlinkSync'](_0x2041f1);}return _0x1e5b5a;})[_0x116e('0x26')](function(_0x971ac8){if(!_0x971ac8)throw new InternalError();return _0x971ac8[_0x116e('0x62')]();})[_0x116e('0x26')](function(){_0x5adaae[_0x116e('0x1c')](0xcc)[_0x116e('0x1b')]();})[_0x116e('0x42')](handleError(_0x5adaae,null));};function getBucketslist(_0x16737c,_0x5b4883,_0xdd8848){return new Promise(function(_0x53058d,_0xa0b42f){var _0x510bae=new AWS['S3']({'accessKeyId':_0x5b4883,'secretAccessKey':_0x16737c,'region':_0xdd8848});_0x510bae[_0x116e('0x6b')]({},function(_0x3638fc,_0x27f94f){if(_0x3638fc){return _0xa0b42f(_0x3638fc);}else{return _0x53058d(_0x27f94f);}});});}function createBucket(_0x273956,_0x3548ec,_0x45138b,_0x2da669){return new Promise(function(_0x1cb063,_0x5c1ab1){var _0x1434d6=new AWS['S3']({'accessKeyId':_0x3548ec,'secretAccessKey':_0x273956,'region':_0x45138b});_0x1434d6[_0x116e('0x6c')]({'Bucket':_0x2da669},function(_0x47a97b,_0x588f66){if(_0x47a97b){return _0x5c1ab1(_0x47a97b);}else{return _0x1cb063(_0x588f66);}});});}function uploadFile(_0x89dc82,_0x5bef52,_0x42fb44,_0x21ba15,_0x3e8a03,_0x53a4fa){return new Promise(function(_0xc5f6b,_0x44d33c){var _0x24d67a=new AWS['S3']({'accessKeyId':_0x5bef52,'secretAccessKey':_0x89dc82,'region':_0x42fb44});_0x24d67a[_0x116e('0x6d')]({'Bucket':_0x21ba15,'Key':_0x3e8a03,'Body':_0x53a4fa},function(_0x3f1a40,_0x1250e3){if(_0x3f1a40){return _0x44d33c(_0x3f1a40);}else{return _0xc5f6b(_0x1250e3);}});});}function startTranscribe(_0x4ecdf0,_0x3c0c69,_0xcbb015,_0x4fd1fd,_0xd43dd7,_0x12dd58){return new Promise(function(_0x94aa1e,_0x4bcaf3){var _0x4d7cb3=new AWS[(_0x116e('0x6e'))]({'accessKeyId':_0x3c0c69,'secretAccessKey':_0x4ecdf0,'region':_0xcbb015});_0x4d7cb3[_0x116e('0x6f')]({'TranscriptionJobName':_0x4fd1fd,'LanguageCode':_0xd43dd7,'Media':{'MediaFileUri':_0x12dd58}},function(_0x52a5fe,_0x149932){if(_0x52a5fe){return _0x4bcaf3(_0x52a5fe);}else{return _0x94aa1e(_0x149932);}});});}function transcribe(_0x7ceae7,_0xe931f7,_0xcd428b,_0x3b3f20,_0xb77a57,_0x18ae10,_0x4fd8e8){return new Promise(function(_0x3590cb,_0x45baf3){var _0x8b5241={};logger[_0x116e('0x64')](util[_0x116e('0x61')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x7ceae7,_0xb77a57));return uploadFile(_0xe931f7,_0xcd428b,_0x3b3f20,_0xb77a57,path[_0x116e('0x70')](_0x18ae10),fs[_0x116e('0x71')](_0x18ae10))['then'](function(_0x351461){logger[_0x116e('0x64')](util[_0x116e('0x61')](_0x116e('0x72'),_0x7ceae7,_0xb77a57,_0x351461[_0x116e('0x73')]));_0x8b5241[_0x116e('0x74')]=_0x351461[_0x116e('0x75')];_0x8b5241[_0x116e('0x76')]=_0x351461[_0x116e('0x73')];logger[_0x116e('0x64')](util[_0x116e('0x61')](_0x116e('0x77'),_0x7ceae7));return startTranscribe(_0xe931f7,_0xcd428b,_0x3b3f20,uuidv4(),_0x4fd8e8,_0x351461['Location']);})[_0x116e('0x26')](function(_0x3491df){logger['info'](util['format'](_0x116e('0x78'),_0x7ceae7,_0x3491df[_0x116e('0x79')][_0x116e('0x7a')]));_0x8b5241[_0x116e('0x7b')]=_0x3491df['TranscriptionJob']['TranscriptionJobName'];_0x8b5241[_0x116e('0x7c')]=_0x3491df[_0x116e('0x79')][_0x116e('0x7d')];return _0x3590cb(_0x8b5241);})[_0x116e('0x42')](function(_0x25a2e6){return _0x45baf3(_0x25a2e6);});});}exports[_0x116e('0x7e')]=function(_0x5c3e3b,_0x4da453,_0x53df6d){var _0x39fa0b;var _0x4038fd;var _0x2e1e5c;var _0x3d77e0=require(_0x116e('0x4e'));return db[_0x116e('0x2c')][_0x116e('0x7f')]({'where':{'id':_0x5c3e3b[_0x116e('0x44')]['id']}})[_0x116e('0x26')](function(_0x15dc63){if(_0x15dc63){var _0x9535a9=util[_0x116e('0x61')](_0x116e('0x51'),_0x15dc63['value']);if(fs[_0x116e('0x52')](_0x9535a9)){cypher=!![];return _0x3d77e0[_0x116e('0x53')](_0x9535a9,_0x15dc63[_0x116e('0x50')],config[_0x116e('0x54')][_0x116e('0x55')])['then'](function(){return _0x15dc63;});}return _0x15dc63;}})[_0x116e('0x26')](function(_0x760e1f){if(!_0x760e1f){throw new db['Sequelize'][(_0x116e('0x57'))](_0x116e('0x80'));}_0x4038fd=_0x760e1f;return db[_0x116e('0x81')]['findOne']({'where':{'id':0x1}});})[_0x116e('0x26')](handleEntityNotFound(_0x4da453,null))[_0x116e('0x26')](function(_0x2d25b8){if(_0x2d25b8){_0x39fa0b=_0x2d25b8;if(!_0x39fa0b[_0x116e('0x82')]||!_0x39fa0b[_0x116e('0x83')]||!_0x39fa0b[_0x116e('0x84')]||!_0x39fa0b[_0x116e('0x85')]||!_0x39fa0b[_0x116e('0x74')]){throw new db[(_0x116e('0x56'))][(_0x116e('0x57'))](_0x116e('0x86'));}if(_0x5c3e3b['body'][_0x116e('0x87')]&&(!_0x39fa0b['sentiment']||!_0x39fa0b['sentimentAccountId']||!_0x39fa0b['sentimentRegion']||!_0x39fa0b[_0x116e('0x85')]||!_0x39fa0b[_0x116e('0x74')])){throw new db[(_0x116e('0x56'))][(_0x116e('0x57'))](_0x116e('0x88'));}return db[_0x116e('0x89')][_0x116e('0x7f')]({'where':{'id':_0x39fa0b[_0x116e('0x83')]}});}})['then'](function(_0x27dab5){if(!_0x27dab5){throw new db['Sequelize'][(_0x116e('0x57'))](_0x116e('0x8a'));}if(!_0x27dab5['data1']||!_0x27dab5['data2']){throw new db[(_0x116e('0x56'))][(_0x116e('0x57'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e1e5c=_0x27dab5;return getBucketslist(_0x2e1e5c[_0x116e('0x8b')],_0x2e1e5c[_0x116e('0x8c')],_0x39fa0b[_0x116e('0x84')]);})['then'](function(_0x4f57f6){if(_0x4f57f6&&_0x4f57f6['Buckets']){var _0x3b6380=_[_0x116e('0x49')](_0x4f57f6[_0x116e('0x8d')],function(_0x3a51eb){return _0x3a51eb[_0x116e('0x8e')]===_0x39fa0b[_0x116e('0x74')];});if(!_0x3b6380){logger[_0x116e('0x64')](util[_0x116e('0x61')](_0x116e('0x8f'),_0x5c3e3b[_0x116e('0x44')]['id'],_0x39fa0b[_0x116e('0x74')]));return createBucket(_0x2e1e5c[_0x116e('0x8b')],_0x2e1e5c[_0x116e('0x8c')],_0x39fa0b[_0x116e('0x84')],_0x39fa0b[_0x116e('0x74')]);}logger[_0x116e('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5c3e3b['params']['id'],_0x39fa0b[_0x116e('0x74')]));return;}})['then'](function(_0x4bd2b7){if(_0x4038fd[_0x116e('0x7c')]==='NEW'){return transcribe(_0x5c3e3b[_0x116e('0x44')]['id'],_0x2e1e5c['data1'],_0x2e1e5c[_0x116e('0x8c')],_0x39fa0b[_0x116e('0x84')],_0x39fa0b[_0x116e('0x74')],_0x4038fd[_0x116e('0x50')],_0x39fa0b[_0x116e('0x85')]);}else{logger[_0x116e('0x64')](util[_0x116e('0x61')](_0x116e('0x90'),_0x5c3e3b[_0x116e('0x44')]['id']));return{'transcribeStatus':_0x116e('0x91')};}})[_0x116e('0x26')](function(_0x394fe2){if(_0x394fe2){_0x394fe2[_0x116e('0x92')]=_0x5c3e3b[_0x116e('0x4b')][_0x116e('0x87')];return _0x4038fd[_0x116e('0x93')](_0x394fe2);}})['then'](respondWithResult(_0x4da453,null))[_0x116e('0x42')](handleError(_0x4da453,null));};function writeFile(_0x428574,_0xc58ec2){return new Promise(function(_0x3d338e,_0x55af00){fs[_0x116e('0x94')](_0xc58ec2,_0x428574,function(_0x593e4b,_0x3d3046){if(_0x593e4b){return _0x55af00(_0x593e4b);}else{return _0x3d338e(_0x3d3046);}});});}exports[_0x116e('0x95')]=function(_0x2f8866,_0x488ce4,_0x5a2512){return db[_0x116e('0x2c')][_0x116e('0x7f')]({'where':{'id':_0x2f8866[_0x116e('0x44')]['id']}})[_0x116e('0x26')](handleEntityNotFound(_0x488ce4))[_0x116e('0x26')](function(_0x1b45a3){if(_0x1b45a3&&_0x1b45a3['fileText']){var _0x5f2296=_0x1b45a3['fileText'];var _0x5cc656=config[_0x116e('0x96')]+_0x116e('0x97')+_0x1b45a3['id']+_0x116e('0x98');if(fs[_0x116e('0x52')](_0x5cc656)){return _0x5cc656;}return writeFile(_0x5f2296,_0x5cc656)['then'](function(){return _0x5cc656;});}else{throw new db[(_0x116e('0x56'))][(_0x116e('0x57'))](_0x116e('0x99'));}})[_0x116e('0x26')](function(_0x335942){return _0x488ce4['download'](_0x335942);})[_0x116e('0x42')](handleError(_0x488ce4));}; \ No newline at end of file +var _0x0374=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','sendStatus','stack','name','send','VoiceRecording','rawAttributes','key','model','map','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','VoiceRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','sequelize','MD5','token','$and','push','decryptFile','recording','Sequelize','ValidationError','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','data1','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1f703f,_0x266ba9){var _0x3ad2ec=function(_0x306f81){while(--_0x306f81){_0x1f703f['push'](_0x1f703f['shift']());}};_0x3ad2ec(++_0x266ba9);}(_0x0374,0x7f));var _0x4037=function(_0x3393eb,_0x33d440){_0x3393eb=_0x3393eb-0x0;var _0x38be55=_0x0374[_0x3393eb];return _0x38be55;};'use strict';var pdf=require(_0x4037('0x0'));var emlformat=require(_0x4037('0x1'));var rimraf=require(_0x4037('0x2'));var zipdir=require(_0x4037('0x3'));var jsonpatch=require(_0x4037('0x4'));var rp=require(_0x4037('0x5'));var moment=require(_0x4037('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4037('0x7'));var util=require(_0x4037('0x8'));var path=require(_0x4037('0x9'));var sox=require(_0x4037('0xa'));var csv=require('to-csv');var ejs=require(_0x4037('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4037('0xc'));var crypto=require(_0x4037('0xd'));var jsforce=require(_0x4037('0xe'));var deskjs=require(_0x4037('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4037('0x10'));var Papa=require(_0x4037('0x11'));var AWS=require(_0x4037('0x12'));var uuidv4=require(_0x4037('0x13'));var Redis=require(_0x4037('0x14'));var authService=require(_0x4037('0x15'));var qs=require(_0x4037('0x16'));var as=require(_0x4037('0x17'));var hardwareService=require(_0x4037('0x18'));var logger=require(_0x4037('0x19'))('api');var utils=require(_0x4037('0x1a'));var config=require(_0x4037('0x1b'));var db=require(_0x4037('0x1c'))['db'];function respondWithStatusCode(_0x46ef2b,_0x4276b3){_0x4276b3=_0x4276b3||0xcc;return function(_0x5c2151){if(_0x5c2151){return _0x46ef2b['sendStatus'](_0x4276b3);}return _0x46ef2b[_0x4037('0x1d')](_0x4276b3)[_0x4037('0x1e')]();};}function respondWithResult(_0x355172,_0x26471c){_0x26471c=_0x26471c||0xc8;return function(_0x27c975){if(_0x27c975){return _0x355172[_0x4037('0x1d')](_0x26471c)[_0x4037('0x1f')](_0x27c975);}};}function respondWithFilteredResult(_0x8d217d,_0x53012b){return function(_0xd77e77){if(_0xd77e77){var _0x47551f=_0xd77e77[_0x4037('0x20')],_0x47c5d3=_0x53012b[_0x4037('0x21')],_0x4e86bb=_0x53012b[_0x4037('0x21')]+_0x53012b[_0x4037('0x22')],_0x3d462f;if(_0x4e86bb>=_0x47551f){_0x4e86bb=_0x47551f;_0x3d462f=0xc8;}else{_0x3d462f=0xce;}_0x8d217d['status'](_0x3d462f);return _0x8d217d[_0x4037('0x23')]('Content-Range',_0x47c5d3+'-'+_0x4e86bb+'/'+_0x47551f)['json'](_0xd77e77);}return null;};}function patchUpdates(_0x689d4){return function(_0x2955d9){try{jsonpatch['apply'](_0x2955d9,_0x689d4,!![]);}catch(_0x555195){return BPromise[_0x4037('0x24')](_0x555195);}return _0x2955d9[_0x4037('0x25')]();};}function saveUpdates(_0x527576,_0x291e66){return function(_0x17b735){if(_0x17b735){return _0x17b735[_0x4037('0x26')](_0x527576)[_0x4037('0x27')](function(_0x268b2f){return _0x268b2f;});}return null;};}function removeEntity(_0x12a152,_0x38c1b2){return function(_0x57f51c){if(_0x57f51c){return _0x57f51c[_0x4037('0x28')]()[_0x4037('0x27')](function(){_0x12a152[_0x4037('0x1d')](0xcc)[_0x4037('0x1e')]();});}};}function handleEntityNotFound(_0x46955c,_0x3b1c51){return function(_0x1ffaa8){if(!_0x1ffaa8){_0x46955c[_0x4037('0x29')](0x194);}return _0x1ffaa8;};}function handleError(_0x1804ac,_0x3b642f){_0x3b642f=_0x3b642f||0x1f4;return function(_0xce6e0e){logger['error'](_0xce6e0e[_0x4037('0x2a')]);if(_0xce6e0e[_0x4037('0x2b')]){delete _0xce6e0e[_0x4037('0x2b')];}_0x1804ac['status'](_0x3b642f)[_0x4037('0x2c')](_0xce6e0e);};}exports['index']=function(_0x5acfb0,_0x59d3dc){var _0x5593fd={},_0x4c4880={},_0x545132={'count':0x0,'rows':[]};var _0x1f8b89=_['map'](db[_0x4037('0x2d')][_0x4037('0x2e')],function(_0x2fa0d4){return{'name':_0x2fa0d4['fieldName'],'type':_0x2fa0d4['type'][_0x4037('0x2f')]};});_0x4c4880[_0x4037('0x30')]=_['differenceBy'](_[_0x4037('0x31')](_0x1f8b89,'name'),[_0x4037('0x32')]);_0x4c4880[_0x4037('0x33')]=_['keys'](_0x5acfb0[_0x4037('0x33')]);_0x4c4880[_0x4037('0x34')]=_[_0x4037('0x35')](_0x4c4880[_0x4037('0x30')],_0x4c4880['query']);_0x5593fd[_0x4037('0x36')]=_['intersection'](_0x4c4880[_0x4037('0x30')],qs[_0x4037('0x37')](_0x5acfb0[_0x4037('0x33')][_0x4037('0x37')]));_0x5593fd[_0x4037('0x36')]=_0x5593fd[_0x4037('0x36')][_0x4037('0x38')]?_0x5593fd[_0x4037('0x36')]:_0x4c4880['model'];if(!_0x5acfb0[_0x4037('0x33')][_0x4037('0x39')]('nolimit')){_0x5593fd['limit']=qs['limit'](_0x5acfb0[_0x4037('0x33')][_0x4037('0x22')]);_0x5593fd[_0x4037('0x21')]=qs[_0x4037('0x21')](_0x5acfb0[_0x4037('0x33')][_0x4037('0x21')]);}_0x5593fd[_0x4037('0x3a')]=qs[_0x4037('0x3b')](_0x5acfb0[_0x4037('0x33')]['sort']);_0x5593fd[_0x4037('0x3c')]=qs['filters'](_[_0x4037('0x3d')](_0x5acfb0['query'],_0x4c4880[_0x4037('0x34')]),_0x1f8b89);if(_0x5acfb0[_0x4037('0x33')]['filter']){_0x5593fd[_0x4037('0x3c')]=_['merge'](_0x5593fd['where'],{'$or':_['map'](_0x1f8b89,function(_0x3e2519){if(_0x3e2519[_0x4037('0x3e')]!==_0x4037('0x3f')){var _0x4225fb={};_0x4225fb[_0x3e2519[_0x4037('0x2b')]]={'$like':'%'+_0x5acfb0[_0x4037('0x33')]['filter']+'%'};return _0x4225fb;}})});}_0x5593fd=_[_0x4037('0x40')]({},_0x5593fd,_0x5acfb0[_0x4037('0x41')]);var _0x3f72e4={'where':_0x5593fd[_0x4037('0x3c')]};return db[_0x4037('0x2d')][_0x4037('0x20')](_0x3f72e4)['then'](function(_0x33402b){_0x545132[_0x4037('0x20')]=_0x33402b;if(_0x5acfb0[_0x4037('0x33')][_0x4037('0x42')]){_0x5593fd[_0x4037('0x43')]=[{'all':!![]}];}return db[_0x4037('0x2d')][_0x4037('0x44')](_0x5593fd);})[_0x4037('0x27')](function(_0x1a75ce){_0x545132['rows']=_0x1a75ce;return _0x545132;})[_0x4037('0x27')](respondWithFilteredResult(_0x59d3dc,_0x5593fd))[_0x4037('0x45')](handleError(_0x59d3dc,null));};exports[_0x4037('0x46')]=function(_0x1ed3fa,_0x2a11e1){var _0x4d2a1d={'raw':![],'where':{'id':_0x1ed3fa[_0x4037('0x47')]['id']}},_0x3ad747={};_0x3ad747[_0x4037('0x30')]=_['keys'](db[_0x4037('0x2d')][_0x4037('0x2e')]);_0x3ad747['query']=_[_0x4037('0x48')](_0x1ed3fa[_0x4037('0x33')]);_0x3ad747['filters']=_[_0x4037('0x35')](_0x3ad747[_0x4037('0x30')],_0x3ad747[_0x4037('0x33')]);_0x4d2a1d['attributes']=_[_0x4037('0x35')](_0x3ad747[_0x4037('0x30')],qs['fields'](_0x1ed3fa[_0x4037('0x33')]['fields']));_0x4d2a1d['attributes']=_0x4d2a1d[_0x4037('0x36')][_0x4037('0x38')]?_0x4d2a1d['attributes']:_0x3ad747['model'];if(_0x1ed3fa['query'][_0x4037('0x42')]){_0x4d2a1d['include']=[{'all':!![]}];}_0x4d2a1d=_['merge']({},_0x4d2a1d,_0x1ed3fa[_0x4037('0x41')]);return db[_0x4037('0x2d')][_0x4037('0x49')](_0x4d2a1d)['then'](handleEntityNotFound(_0x2a11e1,null))[_0x4037('0x27')](respondWithResult(_0x2a11e1,null))[_0x4037('0x45')](handleError(_0x2a11e1,null));};exports[_0x4037('0x4a')]=function(_0x2bfe55,_0x4a2e1e){return db[_0x4037('0x2d')][_0x4037('0x4a')](_0x2bfe55['body'],{})[_0x4037('0x27')](respondWithResult(_0x4a2e1e,0xc9))['catch'](handleError(_0x4a2e1e,null));};exports[_0x4037('0x26')]=function(_0x10c0b4,_0x2f8e53){if(_0x10c0b4[_0x4037('0x4b')]['id']){delete _0x10c0b4[_0x4037('0x4b')]['id'];}return db[_0x4037('0x2d')][_0x4037('0x49')]({'where':{'id':_0x10c0b4[_0x4037('0x47')]['id']}})[_0x4037('0x27')](handleEntityNotFound(_0x2f8e53,null))[_0x4037('0x27')](saveUpdates(_0x10c0b4['body'],null))[_0x4037('0x27')](respondWithResult(_0x2f8e53,null))[_0x4037('0x45')](handleError(_0x2f8e53,null));};exports[_0x4037('0x4c')]=function(_0x7421f0,_0x49ee5f){return db[_0x4037('0x2d')][_0x4037('0x4c')]()[_0x4037('0x27')](respondWithResult(_0x49ee5f,null))[_0x4037('0x45')](handleError(_0x49ee5f,null));};exports['download']=function(_0xf32578,_0x2f38c0,_0x28117d){var _0xbdbc2d=require(_0x4037('0x4d'));var _0x42f2f3=![];var _0xcfd0d6={};if(_0xf32578[_0x4037('0x33')][_0x4037('0x3e')]&&_0xf32578[_0x4037('0x33')][_0x4037('0x3e')]===_0x4037('0x4e')){_0xcfd0d6[_0x4037('0x4e')]=_0xf32578[_0x4037('0x47')]['id'];}else{_0xcfd0d6['id']=_0xf32578['params']['id'];}return db[_0x4037('0x2d')][_0x4037('0x49')]({'where':_0xcfd0d6,'attributes':['id',_0x4037('0x4f')],'raw':!![]})[_0x4037('0x27')](handleEntityNotFound(_0x2f38c0,null))[_0x4037('0x27')](function(_0x570da0){if(_0x570da0){var _0x14d0dd=_0x570da0[_0x4037('0x4f')];var _0x44577a=util[_0x4037('0x32')](_0x4037('0x50'),_0x14d0dd);if(fs[_0x4037('0x51')](_0x44577a)){_0x42f2f3=!![];return _0xbdbc2d['decryptFile'](_0x44577a,_0x14d0dd,config[_0x4037('0x52')]['recording'])[_0x4037('0x27')](function(){return _0x570da0;});}return _0x570da0;}})['then'](function(_0x1f4612){if(_0x1f4612){var _0x434dc3=_0x1f4612[_0x4037('0x4f')];if(!fs[_0x4037('0x51')](_0x434dc3)){throw new db['Sequelize']['ValidationError'](_0x4037('0x53'));}if(_0x1f4612[_0x4037('0x54')]){return _0x2f38c0[_0x4037('0x55')](_0x434dc3,_0x1f4612[_0x4037('0x54')]+path['extname'](_0x434dc3),function(){if(_0x42f2f3){fs[_0x4037('0x56')](_0x434dc3);}});}else{return _0x2f38c0[_0x4037('0x55')](_0x434dc3,function(_0x173ca5){if(_0x42f2f3){fs[_0x4037('0x56')](_0x434dc3);}});}}})[_0x4037('0x45')](function(_0x4ddcdd){if(_0x4ddcdd[_0x4037('0x57')]==='VoiceRecording\x20not\x20found'){_0x2f38c0['status'](0x194)['send'](_0x4037('0x58'));}else{return handleError(_0x2f38c0,null);}});};exports['downloads']=function(_0x6db94,_0x3b1ba4,_0x5bafcd){var _0xcc0171=require('../../components/encryptor');var _0x5bf1d0=![];var _0x51c77d={'$and':[db['sequelize'][_0x4037('0x3c')](db[_0x4037('0x59')]['fn'](_0x4037('0x5a'),db[_0x4037('0x59')]['col'](_0x4037('0x4e'))),_0x6db94[_0x4037('0x33')][_0x4037('0x5b')])]};if(_0x6db94[_0x4037('0x33')][_0x4037('0x3e')]&&_0x6db94[_0x4037('0x33')][_0x4037('0x3e')]===_0x4037('0x4e')){_0x51c77d[_0x4037('0x5c')][_0x4037('0x5d')]({'uniqueid':_0x6db94['params']['id']});}else{_0x51c77d[_0x4037('0x5c')][_0x4037('0x5d')]({'id':_0x6db94['params']['id']});}return db[_0x4037('0x2d')][_0x4037('0x49')]({'where':_0x51c77d,'attributes':['id',_0x4037('0x4f')],'raw':!![]})[_0x4037('0x27')](handleEntityNotFound(_0x3b1ba4,null))[_0x4037('0x27')](function(_0x52fc15){if(_0x52fc15){var _0xc27bee=util[_0x4037('0x32')](_0x4037('0x50'),_0x52fc15[_0x4037('0x4f')]);if(fs[_0x4037('0x51')](_0xc27bee)){_0x5bf1d0=!![];return _0xcc0171[_0x4037('0x5e')](_0xc27bee,_0x52fc15[_0x4037('0x4f')],config['secrets'][_0x4037('0x5f')])[_0x4037('0x27')](function(){return _0x52fc15;});}return _0x52fc15;}})[_0x4037('0x27')](function(_0x5b8fe3){if(_0x5b8fe3){if(!fs[_0x4037('0x51')](_0x5b8fe3[_0x4037('0x4f')])){throw new db[(_0x4037('0x60'))][(_0x4037('0x61'))](_0x4037('0x53'));}if(_0x5b8fe3[_0x4037('0x54')]){return _0x3b1ba4[_0x4037('0x55')](_0x5b8fe3['value'],_0x5b8fe3['filename']+path['extname'](_0x5b8fe3['value']),function(){if(_0x5bf1d0){fs[_0x4037('0x56')](_0x5b8fe3[_0x4037('0x4f')]);}});}else{return _0x3b1ba4[_0x4037('0x55')](_0x5b8fe3['value'],function(_0x5957df){if(_0x5bf1d0){fs[_0x4037('0x56')](_0x5b8fe3[_0x4037('0x4f')]);}});}}})[_0x4037('0x45')](handleError(_0x3b1ba4,null));};exports[_0x4037('0x28')]=function(_0x317155,_0x1093a7){return db[_0x4037('0x2d')][_0x4037('0x49')]({'where':{'id':_0x317155[_0x4037('0x47')]['id']}})['then'](function(_0x550172){if(!_0x550172)throw new ReferenceError('Entity\x20not\x20found');return _0x550172;})[_0x4037('0x27')](function(_0x3586cf){var _0x3de382=_0x3586cf[_0x4037('0x4f')];logger[_0x4037('0x62')](_0x4037('0x63'),_0x3de382);if(!_[_0x4037('0x64')](_0x3586cf[_0x4037('0x4f')])&&fs[_0x4037('0x51')](_0x3de382)){logger[_0x4037('0x62')](_0x4037('0x65')+_0x3de382+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4037('0x66')](_0x3de382);}_0x3de382=_0x3de382+_0x4037('0x67');if(!_['isNil'](_0x3586cf[_0x4037('0x4f')])&&fs[_0x4037('0x51')](_0x3de382)){logger[_0x4037('0x62')]('File:\x20\x22'+_0x3de382+_0x4037('0x68'));fs[_0x4037('0x66')](_0x3de382);}return _0x3586cf;})[_0x4037('0x27')](function(_0xd802c7){if(!_0xd802c7)throw new InternalError();return _0xd802c7[_0x4037('0x28')]();})[_0x4037('0x27')](function(){_0x1093a7[_0x4037('0x1d')](0xcc)[_0x4037('0x1e')]();})[_0x4037('0x45')](handleError(_0x1093a7,null));};function getBucketslist(_0x3f46b4,_0x49b980,_0x273b38){return new Promise(function(_0x117287,_0x4e8b66){var _0xd07563=new AWS['S3']({'accessKeyId':_0x49b980,'secretAccessKey':_0x3f46b4,'region':_0x273b38});_0xd07563['listBuckets']({},function(_0x286187,_0x237288){if(_0x286187){return _0x4e8b66(_0x286187);}else{return _0x117287(_0x237288);}});});}function createBucket(_0x45acbb,_0x210b3b,_0x322863,_0x25346a){return new Promise(function(_0xeab839,_0x21836e){var _0x25ecfd=new AWS['S3']({'accessKeyId':_0x210b3b,'secretAccessKey':_0x45acbb,'region':_0x322863});_0x25ecfd[_0x4037('0x69')]({'Bucket':_0x25346a},function(_0x2e89bd,_0x2c723d){if(_0x2e89bd){return _0x21836e(_0x2e89bd);}else{return _0xeab839(_0x2c723d);}});});}function uploadFile(_0x6f41c9,_0xda751a,_0x57d801,_0x44f714,_0x2ddf03,_0x593eb2){return new Promise(function(_0x357f5b,_0x57652e){var _0x2dcce8=new AWS['S3']({'accessKeyId':_0xda751a,'secretAccessKey':_0x6f41c9,'region':_0x57d801});_0x2dcce8[_0x4037('0x6a')]({'Bucket':_0x44f714,'Key':_0x2ddf03,'Body':_0x593eb2},function(_0x12cf43,_0x1027aa){if(_0x12cf43){return _0x57652e(_0x12cf43);}else{return _0x357f5b(_0x1027aa);}});});}function startTranscribe(_0x505185,_0x533871,_0x8ff7d1,_0x58de40,_0x441015,_0x1d60d7){return new Promise(function(_0x1c240e,_0x44e6c9){var _0x51c8d5=new AWS[(_0x4037('0x6b'))]({'accessKeyId':_0x533871,'secretAccessKey':_0x505185,'region':_0x8ff7d1});_0x51c8d5[_0x4037('0x6c')]({'TranscriptionJobName':_0x58de40,'LanguageCode':_0x441015,'Media':{'MediaFileUri':_0x1d60d7}},function(_0x38399d,_0x34e5c5){if(_0x38399d){return _0x44e6c9(_0x38399d);}else{return _0x1c240e(_0x34e5c5);}});});}function transcribe(_0x2653ba,_0x4c491f,_0x102290,_0x1d8c24,_0x1aeeb7,_0x1d697c,_0x18830d){return new Promise(function(_0x44d8c2,_0x49d8e4){var _0x1f96ff={};logger[_0x4037('0x62')](util[_0x4037('0x32')](_0x4037('0x6d'),_0x2653ba,_0x1aeeb7));return uploadFile(_0x4c491f,_0x102290,_0x1d8c24,_0x1aeeb7,path[_0x4037('0x6e')](_0x1d697c),fs[_0x4037('0x6f')](_0x1d697c))[_0x4037('0x27')](function(_0x3568de){logger[_0x4037('0x62')](util[_0x4037('0x32')](_0x4037('0x70'),_0x2653ba,_0x1aeeb7,_0x3568de[_0x4037('0x71')]));_0x1f96ff[_0x4037('0x72')]=_0x3568de['Bucket'];_0x1f96ff[_0x4037('0x73')]=_0x3568de[_0x4037('0x71')];logger['info'](util['format'](_0x4037('0x74'),_0x2653ba));return startTranscribe(_0x4c491f,_0x102290,_0x1d8c24,uuidv4(),_0x18830d,_0x3568de['Location']);})['then'](function(_0x47a840){logger[_0x4037('0x62')](util[_0x4037('0x32')](_0x4037('0x75'),_0x2653ba,_0x47a840[_0x4037('0x76')][_0x4037('0x77')]));_0x1f96ff[_0x4037('0x78')]=_0x47a840[_0x4037('0x76')][_0x4037('0x77')];_0x1f96ff['transcribeStatus']=_0x47a840[_0x4037('0x76')]['TranscriptionJobStatus'];return _0x44d8c2(_0x1f96ff);})[_0x4037('0x45')](function(_0x2a6c74){return _0x49d8e4(_0x2a6c74);});});}exports['runTranscribe']=function(_0x14810c,_0x4a8123,_0x25e45f){var _0xa2df92;var _0xbab2ec;var _0x1625ab;var _0x1269d3=require(_0x4037('0x4d'));return db[_0x4037('0x2d')][_0x4037('0x79')]({'where':{'id':_0x14810c['params']['id']}})['then'](function(_0x490a0f){if(_0x490a0f){var _0x2cba2a=util[_0x4037('0x32')](_0x4037('0x50'),_0x490a0f[_0x4037('0x4f')]);if(fs[_0x4037('0x51')](_0x2cba2a)){cypher=!![];return _0x1269d3[_0x4037('0x5e')](_0x2cba2a,_0x490a0f['value'],config[_0x4037('0x52')]['recording'])[_0x4037('0x27')](function(){return _0x490a0f;});}return _0x490a0f;}})[_0x4037('0x27')](function(_0x3e5357){if(!_0x3e5357){throw new db[(_0x4037('0x60'))]['ValidationError'](_0x4037('0x7a'));}_0xbab2ec=_0x3e5357;return db[_0x4037('0x7b')][_0x4037('0x79')]({'where':{'id':0x1}});})[_0x4037('0x27')](handleEntityNotFound(_0x4a8123,null))[_0x4037('0x27')](function(_0x5a0cb6){if(_0x5a0cb6){_0xa2df92=_0x5a0cb6;if(!_0xa2df92[_0x4037('0x7c')]||!_0xa2df92[_0x4037('0x7d')]||!_0xa2df92['transcribeRegion']||!_0xa2df92['language']||!_0xa2df92[_0x4037('0x72')]){throw new db[(_0x4037('0x60'))][(_0x4037('0x61'))](_0x4037('0x7e'));}if(_0x14810c['body'][_0x4037('0x7f')]&&(!_0xa2df92['sentiment']||!_0xa2df92[_0x4037('0x80')]||!_0xa2df92[_0x4037('0x81')]||!_0xa2df92[_0x4037('0x82')]||!_0xa2df92[_0x4037('0x72')])){throw new db[(_0x4037('0x60'))]['ValidationError'](_0x4037('0x83'));}return db[_0x4037('0x84')]['findOne']({'where':{'id':_0xa2df92[_0x4037('0x7d')]}});}})[_0x4037('0x27')](function(_0x16df27){if(!_0x16df27){throw new db[(_0x4037('0x60'))]['ValidationError'](_0x4037('0x85'));}if(!_0x16df27['data1']||!_0x16df27[_0x4037('0x86')]){throw new db['Sequelize'][(_0x4037('0x61'))]('Cloud\x20Provider\x20not\x20configured');}_0x1625ab=_0x16df27;return getBucketslist(_0x1625ab[_0x4037('0x87')],_0x1625ab[_0x4037('0x86')],_0xa2df92[_0x4037('0x88')]);})[_0x4037('0x27')](function(_0x289cf6){if(_0x289cf6&&_0x289cf6[_0x4037('0x89')]){var _0x40287e=_[_0x4037('0x49')](_0x289cf6['Buckets'],function(_0x1045da){return _0x1045da['Name']===_0xa2df92['bucket'];});if(!_0x40287e){logger[_0x4037('0x62')](util['format'](_0x4037('0x8a'),_0x14810c['params']['id'],_0xa2df92['bucket']));return createBucket(_0x1625ab[_0x4037('0x87')],_0x1625ab[_0x4037('0x86')],_0xa2df92[_0x4037('0x88')],_0xa2df92[_0x4037('0x72')]);}logger[_0x4037('0x62')](util[_0x4037('0x32')](_0x4037('0x8b'),_0x14810c[_0x4037('0x47')]['id'],_0xa2df92[_0x4037('0x72')]));return;}})[_0x4037('0x27')](function(_0xe75a70){if(_0xbab2ec[_0x4037('0x8c')]==='NEW'){return transcribe(_0x14810c[_0x4037('0x47')]['id'],_0x1625ab[_0x4037('0x87')],_0x1625ab[_0x4037('0x86')],_0xa2df92[_0x4037('0x88')],_0xa2df92[_0x4037('0x72')],_0xbab2ec[_0x4037('0x4f')],_0xa2df92[_0x4037('0x82')]);}else{logger[_0x4037('0x62')](util[_0x4037('0x32')](_0x4037('0x8d'),_0x14810c[_0x4037('0x47')]['id']));return{'transcribeStatus':_0x4037('0x8e')};}})[_0x4037('0x27')](function(_0x5b1595){if(_0x5b1595){_0x5b1595[_0x4037('0x8f')]=_0x14810c['body'][_0x4037('0x7f')];return _0xbab2ec[_0x4037('0x90')](_0x5b1595);}})['then'](respondWithResult(_0x4a8123,null))['catch'](handleError(_0x4a8123,null));};function writeFile(_0x32b56a,_0x47ffd1){return new Promise(function(_0x22e216,_0x30efdd){fs[_0x4037('0x91')](_0x47ffd1,_0x32b56a,function(_0x458e45,_0x196632){if(_0x458e45){return _0x30efdd(_0x458e45);}else{return _0x22e216(_0x196632);}});});}exports[_0x4037('0x92')]=function(_0x16645a,_0x10034a,_0x49a9cb){return db[_0x4037('0x2d')][_0x4037('0x79')]({'where':{'id':_0x16645a['params']['id']}})[_0x4037('0x27')](handleEntityNotFound(_0x10034a))[_0x4037('0x27')](function(_0x49f263){if(_0x49f263&&_0x49f263[_0x4037('0x93')]){var _0x3cb498=_0x49f263[_0x4037('0x93')];var _0x2cdb20=config['root']+_0x4037('0x94')+_0x49f263['id']+'.txt';if(fs['existsSync'](_0x2cdb20)){return _0x2cdb20;}return writeFile(_0x3cb498,_0x2cdb20)[_0x4037('0x27')](function(){return _0x2cdb20;});}else{throw new db[(_0x4037('0x60'))][(_0x4037('0x61'))](_0x4037('0x95'));}})[_0x4037('0x27')](function(_0x3cf0a8){return _0x10034a['download'](_0x3cf0a8);})[_0x4037('0x45')](handleError(_0x10034a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 400eb45..903b97f 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 _0xd8fb=['exports','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','path','rimraf','./voiceRecording.attributes'];(function(_0x35951e,_0x51c45e){var _0x4c5f13=function(_0x46e6fd){while(--_0x46e6fd){_0x35951e['push'](_0x35951e['shift']());}};_0x4c5f13(++_0x51c45e);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1ad172,_0x176234){_0x1ad172=_0x1ad172-0x0;var _0x3c9236=_0xd8fb[_0x1ad172];return _0x3c9236;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6363=['../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x240035,_0x2a0a1c){var _0x34748b=function(_0x3621d9){while(--_0x3621d9){_0x240035['push'](_0x240035['shift']());}};_0x34748b(++_0x2a0a1c);}(_0x6363,0x13a));var _0x3636=function(_0x29a186,_0x1fc951){_0x29a186=_0x29a186-0x0;var _0x5ab930=_0x6363[_0x29a186];return _0x5ab930;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var logger=require(_0x3636('0x1'))(_0x3636('0x2'));var moment=require(_0x3636('0x3'));var BPromise=require(_0x3636('0x4'));var rp=require(_0x3636('0x5'));var fs=require('fs');var path=require(_0x3636('0x6'));var rimraf=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var attributes=require(_0x3636('0x9'));module[_0x3636('0xa')]=function(_0x15728f,_0x1f94ef){return _0x15728f[_0x3636('0xb')](_0x3636('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x3636('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 14c9bfe..ddb7f75 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(_0x419715,_0x221336){var _0x274fbd=function(_0x5119b0){while(--_0x5119b0){_0x419715['push'](_0x419715['shift']());}};_0x274fbd(++_0x221336);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x25cb87,_0xc2d352){var _0x3a7537=function(_0x53516a){while(--_0x53516a){_0x25cb87['push'](_0x25cb87['shift']());}};_0x3a7537(++_0xc2d352);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 5f5a793..6f361ef 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 _0x31f0=['../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x31f0,0xb7));var _0x031f=function(_0x5967ff,_0x1b1aa6){_0x5967ff=_0x5967ff-0x0;var _0x219538=_0x31f0[_0x5967ff];return _0x219538;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0xa')]('/',auth[_0x031f('0xb')](),controller[_0x031f('0xc')]);router['put'](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file +var _0x5fab=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x2acbc6,_0x502cdb){var _0x41ac1c=function(_0x47afe6){while(--_0x47afe6){_0x2acbc6['push'](_0x2acbc6['shift']());}};_0x41ac1c(++_0x502cdb);}(_0x5fab,0x177));var _0xb5fa=function(_0x3e274d,_0x35f95f){_0x3e274d=_0x3e274d-0x0;var _0x352bf9=_0x5fab[_0x3e274d];return _0x352bf9;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')]('/',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xb')]);router['get']('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0xd')]('/',auth['isAuthenticated'](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0xf')](_0xb5fa('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xb5fa('0x11')](_0xb5fa('0x10'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x12')]);module[_0xb5fa('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index bac9b7c..295ef8e 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 _0xff66=['ENUM','Yes','moment','exports','blind','attended','STRING'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xff66,0x167));var _0x6ff6=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xff66[_0x3861f7];return _0x50879f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6ff6('0x0'));module[_0x6ff6('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6ff6('0x2'),_0x6ff6('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x6ff6('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x6ff6('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6ff6('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x6ff6('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x6ff6('0x4')]},'transferercontext':{'type':Sequelize[_0x6ff6('0x4')]},'transfererexten':{'type':Sequelize[_0x6ff6('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x6ff6('0x4')]},'transfereechannel':{'type':Sequelize[_0x6ff6('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x6ff6('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x6ff6('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6ff6('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6ff6('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x6ff6('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x6ff6('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x6ff6('0x4')]},'isexternal':{'type':Sequelize[_0x6ff6('0x5')](_0x6ff6('0x6'),'No')},'context':{'type':Sequelize[_0x6ff6('0x4')]},'extension':{'type':Sequelize[_0x6ff6('0x4')]}}; \ No newline at end of file +var _0x877a=['blind','STRING','Yes','sequelize','moment','ENUM'];(function(_0x4da90d,_0x115e5f){var _0x20c344=function(_0x3ec973){while(--_0x3ec973){_0x4da90d['push'](_0x4da90d['shift']());}};_0x20c344(++_0x115e5f);}(_0x877a,0xed));var _0xa877=function(_0x50041c,_0x4c7d3c){_0x50041c=_0x50041c-0x0;var _0x77770b=_0x877a[_0x50041c];return _0x77770b;};'use strict';var Sequelize=require(_0xa877('0x0'));var moment=require(_0xa877('0x1'));module['exports']={'type':{'type':Sequelize[_0xa877('0x2')](_0xa877('0x3'),'attended')},'result':{'type':Sequelize[_0xa877('0x4')]},'transfererchannel':{'type':Sequelize[_0xa877('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xa877('0x4')]},'transferercalleridname':{'type':Sequelize[_0xa877('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xa877('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xa877('0x4')]},'transfererexten':{'type':Sequelize[_0xa877('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xa877('0x4')]},'transfereechannel':{'type':Sequelize[_0xa877('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xa877('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xa877('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xa877('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xa877('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xa877('0x2')](_0xa877('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0744095..e103e43 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 _0xcc52=['ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv'];(function(_0x59168d,_0xb1ad40){var _0x145e2d=function(_0x1d6fed){while(--_0x1d6fed){_0x59168d['push'](_0x59168d['shift']());}};_0x145e2d(++_0xb1ad40);}(_0xcc52,0x1b2));var _0x2cc5=function(_0x27c637,_0x1dbd6d){_0x27c637=_0x27c637-0x0;var _0x578900=_0xcc52[_0x27c637];return _0x578900;};'use strict';var pdf=require(_0x2cc5('0x0'));var emlformat=require(_0x2cc5('0x1'));var rimraf=require(_0x2cc5('0x2'));var zipdir=require(_0x2cc5('0x3'));var jsonpatch=require(_0x2cc5('0x4'));var rp=require('request-promise');var moment=require(_0x2cc5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2cc5('0x6'));var util=require(_0x2cc5('0x7'));var path=require('path');var sox=require(_0x2cc5('0x8'));var csv=require(_0x2cc5('0x9'));var ejs=require(_0x2cc5('0xa'));var fs=require('fs');var _=require(_0x2cc5('0xb'));var squel=require(_0x2cc5('0xc'));var crypto=require(_0x2cc5('0xd'));var jsforce=require(_0x2cc5('0xe'));var deskjs=require(_0x2cc5('0xf'));var toCsv=require(_0x2cc5('0x9'));var querystring=require('querystring');var Papa=require(_0x2cc5('0x10'));var Redis=require(_0x2cc5('0x11'));var authService=require(_0x2cc5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2cc5('0x13'));var hardwareService=require(_0x2cc5('0x14'));var logger=require(_0x2cc5('0x15'))(_0x2cc5('0x16'));var utils=require('../../config/utils');var config=require(_0x2cc5('0x17'));var db=require(_0x2cc5('0x18'))['db'];function respondWithStatusCode(_0x1e14d9,_0x5c496c){_0x5c496c=_0x5c496c||0xcc;return function(_0x425b86){if(_0x425b86){return _0x1e14d9['sendStatus'](_0x5c496c);}return _0x1e14d9[_0x2cc5('0x19')](_0x5c496c)[_0x2cc5('0x1a')]();};}function respondWithResult(_0x168fb1,_0x4efe9d){_0x4efe9d=_0x4efe9d||0xc8;return function(_0x40b08d){if(_0x40b08d){return _0x168fb1[_0x2cc5('0x19')](_0x4efe9d)[_0x2cc5('0x1b')](_0x40b08d);}};}function respondWithFilteredResult(_0x4e6d36,_0x175782){return function(_0x477977){if(_0x477977){var _0x53bd2c=_0x477977[_0x2cc5('0x1c')],_0x5efa24=_0x175782[_0x2cc5('0x1d')],_0x22ccc4=_0x175782[_0x2cc5('0x1d')]+_0x175782[_0x2cc5('0x1e')],_0x43afb9;if(_0x22ccc4>=_0x53bd2c){_0x22ccc4=_0x53bd2c;_0x43afb9=0xc8;}else{_0x43afb9=0xce;}_0x4e6d36[_0x2cc5('0x19')](_0x43afb9);return _0x4e6d36['set'](_0x2cc5('0x1f'),_0x5efa24+'-'+_0x22ccc4+'/'+_0x53bd2c)[_0x2cc5('0x1b')](_0x477977);}return null;};}function patchUpdates(_0x24d8d8){return function(_0x47ffd6){try{jsonpatch[_0x2cc5('0x20')](_0x47ffd6,_0x24d8d8,!![]);}catch(_0x52b450){return BPromise[_0x2cc5('0x21')](_0x52b450);}return _0x47ffd6[_0x2cc5('0x22')]();};}function saveUpdates(_0x1348a2,_0x4d0228){return function(_0x1fbc8f){if(_0x1fbc8f){return _0x1fbc8f[_0x2cc5('0x23')](_0x1348a2)[_0x2cc5('0x24')](function(_0x348ab5){return _0x348ab5;});}return null;};}function removeEntity(_0x3ca6dd,_0x4d5a7c){return function(_0x21d771){if(_0x21d771){return _0x21d771['destroy']()[_0x2cc5('0x24')](function(){_0x3ca6dd[_0x2cc5('0x19')](0xcc)[_0x2cc5('0x1a')]();});}};}function handleEntityNotFound(_0x3ac09a,_0x1af8fc){return function(_0x59e7b9){if(!_0x59e7b9){_0x3ac09a[_0x2cc5('0x25')](0x194);}return _0x59e7b9;};}function handleError(_0x27452c,_0x49ed9e){_0x49ed9e=_0x49ed9e||0x1f4;return function(_0xbac69b){logger['error'](_0xbac69b[_0x2cc5('0x26')]);if(_0xbac69b[_0x2cc5('0x27')]){delete _0xbac69b[_0x2cc5('0x27')];}_0x27452c[_0x2cc5('0x19')](_0x49ed9e)[_0x2cc5('0x28')](_0xbac69b);};}exports[_0x2cc5('0x29')]=function(_0x1a22ec,_0x4b48e1){var _0x1dd6e7={},_0x576e5a={},_0x403c36={'count':0x0,'rows':[]};var _0x5f1721=_['map'](db['VoiceTransferReport']['rawAttributes'],function(_0x5e33fb){return{'name':_0x5e33fb[_0x2cc5('0x2a')],'type':_0x5e33fb[_0x2cc5('0x2b')][_0x2cc5('0x2c')]};});_0x576e5a[_0x2cc5('0x2d')]=_[_0x2cc5('0x2e')](_0x5f1721,_0x2cc5('0x27'));_0x576e5a[_0x2cc5('0x2f')]=_[_0x2cc5('0x30')](_0x1a22ec['query']);_0x576e5a[_0x2cc5('0x31')]=_[_0x2cc5('0x32')](_0x576e5a[_0x2cc5('0x2d')],_0x576e5a['query']);_0x1dd6e7['attributes']=_[_0x2cc5('0x32')](_0x576e5a[_0x2cc5('0x2d')],qs[_0x2cc5('0x33')](_0x1a22ec['query'][_0x2cc5('0x33')]));_0x1dd6e7['attributes']=_0x1dd6e7[_0x2cc5('0x34')][_0x2cc5('0x35')]?_0x1dd6e7['attributes']:_0x576e5a[_0x2cc5('0x2d')];if(!_0x1a22ec[_0x2cc5('0x2f')][_0x2cc5('0x36')](_0x2cc5('0x37'))){_0x1dd6e7[_0x2cc5('0x1e')]=qs[_0x2cc5('0x1e')](_0x1a22ec['query'][_0x2cc5('0x1e')]);_0x1dd6e7['offset']=qs[_0x2cc5('0x1d')](_0x1a22ec[_0x2cc5('0x2f')][_0x2cc5('0x1d')]);}_0x1dd6e7['order']=qs[_0x2cc5('0x38')](_0x1a22ec['query'][_0x2cc5('0x38')]);_0x1dd6e7[_0x2cc5('0x39')]=qs['filters'](_['pick'](_0x1a22ec['query'],_0x576e5a[_0x2cc5('0x31')]),_0x5f1721);if(_0x1a22ec[_0x2cc5('0x2f')][_0x2cc5('0x3a')]){_0x1dd6e7[_0x2cc5('0x39')]=_[_0x2cc5('0x3b')](_0x1dd6e7[_0x2cc5('0x39')],{'$or':_['map'](_0x5f1721,function(_0x5bf451){if(_0x5bf451[_0x2cc5('0x2b')]!==_0x2cc5('0x3c')){var _0x1ff88f={};_0x1ff88f[_0x5bf451[_0x2cc5('0x27')]]={'$like':'%'+_0x1a22ec[_0x2cc5('0x2f')][_0x2cc5('0x3a')]+'%'};return _0x1ff88f;}})});}_0x1dd6e7=_['merge']({},_0x1dd6e7,_0x1a22ec[_0x2cc5('0x3d')]);var _0x1ac082={'where':_0x1dd6e7[_0x2cc5('0x39')]};return db[_0x2cc5('0x3e')]['count'](_0x1ac082)[_0x2cc5('0x24')](function(_0x2db1ac){_0x403c36['count']=_0x2db1ac;if(_0x1a22ec[_0x2cc5('0x2f')][_0x2cc5('0x3f')]){_0x1dd6e7['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x2cc5('0x40')](_0x1dd6e7);})[_0x2cc5('0x24')](function(_0x384b96){_0x403c36[_0x2cc5('0x41')]=_0x384b96;return _0x403c36;})[_0x2cc5('0x24')](respondWithFilteredResult(_0x4b48e1,_0x1dd6e7))[_0x2cc5('0x42')](handleError(_0x4b48e1,null));};exports[_0x2cc5('0x43')]=function(_0x31c602,_0x41f8ee){var _0x1eff0d={'raw':!![],'where':{'id':_0x31c602[_0x2cc5('0x44')]['id']}},_0x3a2b42={};_0x3a2b42[_0x2cc5('0x2d')]=_[_0x2cc5('0x30')](db[_0x2cc5('0x3e')]['rawAttributes']);_0x3a2b42[_0x2cc5('0x2f')]=_[_0x2cc5('0x30')](_0x31c602['query']);_0x3a2b42[_0x2cc5('0x31')]=_['intersection'](_0x3a2b42[_0x2cc5('0x2d')],_0x3a2b42[_0x2cc5('0x2f')]);_0x1eff0d[_0x2cc5('0x34')]=_[_0x2cc5('0x32')](_0x3a2b42['model'],qs[_0x2cc5('0x33')](_0x31c602['query'][_0x2cc5('0x33')]));_0x1eff0d[_0x2cc5('0x34')]=_0x1eff0d['attributes']['length']?_0x1eff0d[_0x2cc5('0x34')]:_0x3a2b42[_0x2cc5('0x2d')];if(_0x31c602[_0x2cc5('0x2f')][_0x2cc5('0x3f')]){_0x1eff0d[_0x2cc5('0x45')]=[{'all':!![]}];}_0x1eff0d=_[_0x2cc5('0x3b')]({},_0x1eff0d,_0x31c602[_0x2cc5('0x3d')]);return db[_0x2cc5('0x3e')][_0x2cc5('0x46')](_0x1eff0d)['then'](handleEntityNotFound(_0x41f8ee,null))[_0x2cc5('0x24')](respondWithResult(_0x41f8ee,null))[_0x2cc5('0x42')](handleError(_0x41f8ee,null));};exports[_0x2cc5('0x47')]=function(_0xe99a1e,_0x56e93b){return db[_0x2cc5('0x3e')][_0x2cc5('0x47')](_0xe99a1e[_0x2cc5('0x48')],{})[_0x2cc5('0x24')](respondWithResult(_0x56e93b,0xc9))['catch'](handleError(_0x56e93b,null));};exports[_0x2cc5('0x23')]=function(_0x3bb022,_0x5dd6f7){if(_0x3bb022['body']['id']){delete _0x3bb022['body']['id'];}return db['VoiceTransferReport'][_0x2cc5('0x46')]({'where':{'id':_0x3bb022[_0x2cc5('0x44')]['id']}})['then'](handleEntityNotFound(_0x5dd6f7,null))[_0x2cc5('0x24')](saveUpdates(_0x3bb022['body'],null))[_0x2cc5('0x24')](respondWithResult(_0x5dd6f7,null))[_0x2cc5('0x42')](handleError(_0x5dd6f7,null));};exports[_0x2cc5('0x49')]=function(_0x5a2981,_0x24fc0c){return db[_0x2cc5('0x3e')][_0x2cc5('0x46')]({'where':{'id':_0x5a2981['params']['id']}})['then'](handleEntityNotFound(_0x24fc0c,null))[_0x2cc5('0x24')](removeEntity(_0x24fc0c,null))[_0x2cc5('0x42')](handleError(_0x24fc0c,null));}; \ No newline at end of file +var _0x89a4=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceTransferReport','include','findAll','rows','params','includeAll','find','catch','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','sendStatus'];(function(_0x454017,_0x4c2948){var _0x22d946=function(_0x3b9da6){while(--_0x3b9da6){_0x454017['push'](_0x454017['shift']());}};_0x22d946(++_0x4c2948);}(_0x89a4,0x157));var _0x489a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89a4[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x489a('0x0'));var emlformat=require(_0x489a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x489a('0x2'));var jsonpatch=require(_0x489a('0x3'));var rp=require('request-promise');var moment=require(_0x489a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x489a('0x5'));var util=require(_0x489a('0x6'));var path=require(_0x489a('0x7'));var sox=require(_0x489a('0x8'));var csv=require(_0x489a('0x9'));var ejs=require(_0x489a('0xa'));var fs=require('fs');var _=require(_0x489a('0xb'));var squel=require(_0x489a('0xc'));var crypto=require(_0x489a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x489a('0x9'));var querystring=require(_0x489a('0xe'));var Papa=require(_0x489a('0xf'));var Redis=require(_0x489a('0x10'));var authService=require(_0x489a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x489a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x489a('0x13'))(_0x489a('0x14'));var utils=require(_0x489a('0x15'));var config=require(_0x489a('0x16'));var db=require(_0x489a('0x17'))['db'];function respondWithStatusCode(_0x1f39c9,_0x24c195){_0x24c195=_0x24c195||0xcc;return function(_0x2af587){if(_0x2af587){return _0x1f39c9['sendStatus'](_0x24c195);}return _0x1f39c9[_0x489a('0x18')](_0x24c195)['end']();};}function respondWithResult(_0x450c79,_0x333b64){_0x333b64=_0x333b64||0xc8;return function(_0x37b0ea){if(_0x37b0ea){return _0x450c79[_0x489a('0x18')](_0x333b64)[_0x489a('0x19')](_0x37b0ea);}};}function respondWithFilteredResult(_0xac2813,_0x5f368f){return function(_0x57e469){if(_0x57e469){var _0x10bf35=_0x57e469[_0x489a('0x1a')],_0x26c806=_0x5f368f['offset'],_0x7a4a6c=_0x5f368f[_0x489a('0x1b')]+_0x5f368f[_0x489a('0x1c')],_0x54f94c;if(_0x7a4a6c>=_0x10bf35){_0x7a4a6c=_0x10bf35;_0x54f94c=0xc8;}else{_0x54f94c=0xce;}_0xac2813[_0x489a('0x18')](_0x54f94c);return _0xac2813['set'](_0x489a('0x1d'),_0x26c806+'-'+_0x7a4a6c+'/'+_0x10bf35)[_0x489a('0x19')](_0x57e469);}return null;};}function patchUpdates(_0x517ec2){return function(_0x196a1b){try{jsonpatch[_0x489a('0x1e')](_0x196a1b,_0x517ec2,!![]);}catch(_0x4020ec){return BPromise[_0x489a('0x1f')](_0x4020ec);}return _0x196a1b[_0x489a('0x20')]();};}function saveUpdates(_0x59ca42,_0x48b816){return function(_0x175490){if(_0x175490){return _0x175490['update'](_0x59ca42)[_0x489a('0x21')](function(_0x4f1978){return _0x4f1978;});}return null;};}function removeEntity(_0x3189d6,_0x3b1062){return function(_0x4d51e7){if(_0x4d51e7){return _0x4d51e7[_0x489a('0x22')]()[_0x489a('0x21')](function(){_0x3189d6['status'](0xcc)[_0x489a('0x23')]();});}};}function handleEntityNotFound(_0xa8d66c,_0x30f9d2){return function(_0x3211c2){if(!_0x3211c2){_0xa8d66c[_0x489a('0x24')](0x194);}return _0x3211c2;};}function handleError(_0x321834,_0x141e98){_0x141e98=_0x141e98||0x1f4;return function(_0x30e043){logger[_0x489a('0x25')](_0x30e043[_0x489a('0x26')]);if(_0x30e043[_0x489a('0x27')]){delete _0x30e043[_0x489a('0x27')];}_0x321834[_0x489a('0x18')](_0x141e98)[_0x489a('0x28')](_0x30e043);};}exports[_0x489a('0x29')]=function(_0x1170bc,_0x5eaac1){var _0x3e4c15={},_0x15f332={},_0x49d191={'count':0x0,'rows':[]};var _0x499afd=_[_0x489a('0x2a')](db['VoiceTransferReport'][_0x489a('0x2b')],function(_0x104ebd){return{'name':_0x104ebd[_0x489a('0x2c')],'type':_0x104ebd[_0x489a('0x2d')][_0x489a('0x2e')]};});_0x15f332[_0x489a('0x2f')]=_[_0x489a('0x2a')](_0x499afd,_0x489a('0x27'));_0x15f332[_0x489a('0x30')]=_[_0x489a('0x31')](_0x1170bc[_0x489a('0x30')]);_0x15f332[_0x489a('0x32')]=_[_0x489a('0x33')](_0x15f332[_0x489a('0x2f')],_0x15f332[_0x489a('0x30')]);_0x3e4c15['attributes']=_[_0x489a('0x33')](_0x15f332[_0x489a('0x2f')],qs[_0x489a('0x34')](_0x1170bc[_0x489a('0x30')][_0x489a('0x34')]));_0x3e4c15[_0x489a('0x35')]=_0x3e4c15[_0x489a('0x35')][_0x489a('0x36')]?_0x3e4c15[_0x489a('0x35')]:_0x15f332[_0x489a('0x2f')];if(!_0x1170bc[_0x489a('0x30')][_0x489a('0x37')](_0x489a('0x38'))){_0x3e4c15[_0x489a('0x1c')]=qs[_0x489a('0x1c')](_0x1170bc[_0x489a('0x30')][_0x489a('0x1c')]);_0x3e4c15[_0x489a('0x1b')]=qs[_0x489a('0x1b')](_0x1170bc[_0x489a('0x30')][_0x489a('0x1b')]);}_0x3e4c15[_0x489a('0x39')]=qs['sort'](_0x1170bc['query'][_0x489a('0x3a')]);_0x3e4c15['where']=qs[_0x489a('0x32')](_[_0x489a('0x3b')](_0x1170bc['query'],_0x15f332['filters']),_0x499afd);if(_0x1170bc['query'][_0x489a('0x3c')]){_0x3e4c15[_0x489a('0x3d')]=_[_0x489a('0x3e')](_0x3e4c15[_0x489a('0x3d')],{'$or':_[_0x489a('0x2a')](_0x499afd,function(_0x2e378e){if(_0x2e378e[_0x489a('0x2d')]!==_0x489a('0x3f')){var _0xce6e3e={};_0xce6e3e[_0x2e378e[_0x489a('0x27')]]={'$like':'%'+_0x1170bc[_0x489a('0x30')][_0x489a('0x3c')]+'%'};return _0xce6e3e;}})});}_0x3e4c15=_['merge']({},_0x3e4c15,_0x1170bc[_0x489a('0x40')]);var _0x4a15c5={'where':_0x3e4c15[_0x489a('0x3d')]};return db[_0x489a('0x41')][_0x489a('0x1a')](_0x4a15c5)[_0x489a('0x21')](function(_0x4b56c5){_0x49d191['count']=_0x4b56c5;if(_0x1170bc[_0x489a('0x30')]['includeAll']){_0x3e4c15[_0x489a('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x489a('0x43')](_0x3e4c15);})['then'](function(_0x26f9e9){_0x49d191[_0x489a('0x44')]=_0x26f9e9;return _0x49d191;})[_0x489a('0x21')](respondWithFilteredResult(_0x5eaac1,_0x3e4c15))['catch'](handleError(_0x5eaac1,null));};exports['show']=function(_0x5386e3,_0xcd0625){var _0x82f18={'raw':!![],'where':{'id':_0x5386e3[_0x489a('0x45')]['id']}},_0x1654ff={};_0x1654ff[_0x489a('0x2f')]=_['keys'](db['VoiceTransferReport'][_0x489a('0x2b')]);_0x1654ff[_0x489a('0x30')]=_['keys'](_0x5386e3['query']);_0x1654ff[_0x489a('0x32')]=_[_0x489a('0x33')](_0x1654ff['model'],_0x1654ff[_0x489a('0x30')]);_0x82f18[_0x489a('0x35')]=_[_0x489a('0x33')](_0x1654ff[_0x489a('0x2f')],qs[_0x489a('0x34')](_0x5386e3[_0x489a('0x30')]['fields']));_0x82f18[_0x489a('0x35')]=_0x82f18[_0x489a('0x35')]['length']?_0x82f18[_0x489a('0x35')]:_0x1654ff[_0x489a('0x2f')];if(_0x5386e3[_0x489a('0x30')][_0x489a('0x46')]){_0x82f18[_0x489a('0x42')]=[{'all':!![]}];}_0x82f18=_[_0x489a('0x3e')]({},_0x82f18,_0x5386e3[_0x489a('0x40')]);return db[_0x489a('0x41')][_0x489a('0x47')](_0x82f18)[_0x489a('0x21')](handleEntityNotFound(_0xcd0625,null))[_0x489a('0x21')](respondWithResult(_0xcd0625,null))[_0x489a('0x48')](handleError(_0xcd0625,null));};exports[_0x489a('0x49')]=function(_0xc131a3,_0x2d4c2a){return db[_0x489a('0x41')]['create'](_0xc131a3[_0x489a('0x4a')],{})[_0x489a('0x21')](respondWithResult(_0x2d4c2a,0xc9))[_0x489a('0x48')](handleError(_0x2d4c2a,null));};exports[_0x489a('0x4b')]=function(_0x4fadd3,_0x60b12){if(_0x4fadd3[_0x489a('0x4a')]['id']){delete _0x4fadd3['body']['id'];}return db[_0x489a('0x41')][_0x489a('0x47')]({'where':{'id':_0x4fadd3[_0x489a('0x45')]['id']}})[_0x489a('0x21')](handleEntityNotFound(_0x60b12,null))[_0x489a('0x21')](saveUpdates(_0x4fadd3[_0x489a('0x4a')],null))[_0x489a('0x21')](respondWithResult(_0x60b12,null))[_0x489a('0x48')](handleError(_0x60b12,null));};exports[_0x489a('0x22')]=function(_0x589a33,_0xdfa8bf){return db[_0x489a('0x41')][_0x489a('0x47')]({'where':{'id':_0x589a33[_0x489a('0x45')]['id']}})['then'](handleEntityNotFound(_0xdfa8bf,null))[_0x489a('0x21')](removeEntity(_0xdfa8bf,null))['catch'](handleError(_0xdfa8bf,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 35b9712..0f4bd88 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 _0x13c2=['bluebird','request-promise','path','rimraf','../../config/environment','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x306274,_0x50f688){var _0x4bb6e4=function(_0x3a9cdc){while(--_0x3a9cdc){_0x306274['push'](_0x306274['shift']());}};_0x4bb6e4(++_0x50f688);}(_0x13c2,0x103));var _0x213c=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x13c2[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x213c('0x0'));var util=require(_0x213c('0x1'));var logger=require(_0x213c('0x2'))(_0x213c('0x3'));var moment=require(_0x213c('0x4'));var BPromise=require(_0x213c('0x5'));var rp=require(_0x213c('0x6'));var fs=require('fs');var path=require(_0x213c('0x7'));var rimraf=require(_0x213c('0x8'));var config=require(_0x213c('0x9'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x316c26,_0x2487a1){return _0x316c26['define'](_0x213c('0xa'),attributes,{'tableName':_0x213c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc834=['report_call_transfer','lodash','util','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','define','VoiceTransferReport'];(function(_0x627b1b,_0x462114){var _0x2fd022=function(_0x2059c5){while(--_0x2059c5){_0x627b1b['push'](_0x627b1b['shift']());}};_0x2fd022(++_0x462114);}(_0xc834,0x65));var _0x4c83=function(_0xd6c300,_0xef8607){_0xd6c300=_0xd6c300-0x0;var _0x5ef4e9=_0xc834[_0xd6c300];return _0x5ef4e9;};'use strict';var _=require(_0x4c83('0x0'));var util=require(_0x4c83('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4c83('0x2'));var rp=require(_0x4c83('0x3'));var fs=require('fs');var path=require(_0x4c83('0x4'));var rimraf=require(_0x4c83('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c83('0x6'));module['exports']=function(_0x86b1b5,_0x39996e){return _0x86b1b5[_0x4c83('0x7')](_0x4c83('0x8'),attributes,{'tableName':_0x4c83('0x9'),'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 ea5b097..34d1d06 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 _0xa658=['info','result','CreateVoiceTransferReport','options','raw','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message'];(function(_0x11314c,_0x2ca8d7){var _0x12cb4a=function(_0x5e7ddc){while(--_0x5e7ddc){_0x11314c['push'](_0x11314c['shift']());}};_0x12cb4a(++_0x2ca8d7);}(_0xa658,0xe8));var _0x8a65=function(_0x134a60,_0x27131e){_0x134a60=_0x134a60-0x0;var _0x5868be=_0xa658[_0x134a60];return _0x5868be;};'use strict';var _=require(_0x8a65('0x0'));var util=require('util');var moment=require(_0x8a65('0x1'));var BPromise=require(_0x8a65('0x2'));var rs=require(_0x8a65('0x3'));var fs=require('fs');var Redis=require(_0x8a65('0x4'));var db=require(_0x8a65('0x5'))['db'];var utils=require(_0x8a65('0x6'));var logger=require(_0x8a65('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a65('0x8'));var client=jayson['client'][_0x8a65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5290d2,_0x8b63bd,_0x2d8f5f){return new BPromise(function(_0x3b91c2,_0x4d93c7){return client['request'](_0x5290d2,_0x2d8f5f)[_0x8a65('0xa')](function(_0x47cb8f){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x8b63bd,_0x8a65('0xb'));logger[_0x8a65('0xc')](_0x8a65('0xd'),_0x8b63bd,_0x8a65('0xb'),JSON['stringify'](_0x47cb8f));if(_0x47cb8f['error']){if(_0x47cb8f[_0x8a65('0xe')][_0x8a65('0xf')]===0x1f4){logger[_0x8a65('0xe')](_0x8a65('0x10'),_0x8b63bd,_0x47cb8f[_0x8a65('0xe')]['message']);return _0x4d93c7(_0x47cb8f[_0x8a65('0xe')]['message']);}logger[_0x8a65('0xe')](_0x8a65('0x10'),_0x8b63bd,_0x47cb8f[_0x8a65('0xe')][_0x8a65('0x11')]);return _0x3b91c2(_0x47cb8f[_0x8a65('0xe')][_0x8a65('0x11')]);}else{logger[_0x8a65('0x12')](_0x8a65('0x10'),_0x8b63bd,_0x8a65('0xb'));_0x3b91c2(_0x47cb8f[_0x8a65('0x13')]['message']);}})['catch'](function(_0x4eb36a){logger[_0x8a65('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x8b63bd,_0x4eb36a);_0x4d93c7(_0x4eb36a);});});}exports[_0x8a65('0x14')]=function(_0x37d97a){var _0x305d2a=this;return new Promise(function(_0x55148f,_0x441699){return db['VoiceTransferReport']['create'](_0x37d97a['body'],{'raw':_0x37d97a['options']?_0x37d97a[_0x8a65('0x15')][_0x8a65('0x16')]===undefined?!![]:![]:!![]})[_0x8a65('0xa')](function(_0x509123){logger[_0x8a65('0x12')]('CreateVoiceTransferReport',_0x37d97a);logger[_0x8a65('0xc')](_0x8a65('0x14'),_0x37d97a,JSON[_0x8a65('0x17')](_0x509123));_0x55148f(_0x509123);})[_0x8a65('0x18')](function(_0x4e15da){logger[_0x8a65('0xe')](_0x8a65('0x14'),_0x4e15da[_0x8a65('0x11')],_0x37d97a);_0x441699(_0x305d2a['error'](0x1f4,_0x4e15da[_0x8a65('0x11')]));});});}; \ No newline at end of file +var _0x0b4c=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','moment','bluebird','ioredis'];(function(_0x2a0444,_0x243b7b){var _0x2ffd90=function(_0x562429){while(--_0x562429){_0x2a0444['push'](_0x2a0444['shift']());}};_0x2ffd90(++_0x243b7b);}(_0x0b4c,0xe3));var _0xc0b4=function(_0x12cde2,_0xb0aa32){_0x12cde2=_0x12cde2-0x0;var _0x32cfc=_0x0b4c[_0x12cde2];return _0x32cfc;};'use strict';var _=require(_0xc0b4('0x0'));var util=require(_0xc0b4('0x1'));var moment=require(_0xc0b4('0x2'));var BPromise=require(_0xc0b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0b4('0x4'));var db=require(_0xc0b4('0x5'))['db'];var utils=require(_0xc0b4('0x6'));var logger=require(_0xc0b4('0x7'))('rpc');var config=require(_0xc0b4('0x8'));var jayson=require(_0xc0b4('0x9'));var client=jayson[_0xc0b4('0xa')][_0xc0b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x462477,_0x15af04,_0x5dfb6f){return new BPromise(function(_0x873802,_0x21ee7c){return client['request'](_0x462477,_0x5dfb6f)[_0xc0b4('0xc')](function(_0x17eb03){logger[_0xc0b4('0xd')](_0xc0b4('0xe'),_0x15af04,_0xc0b4('0xf'));logger[_0xc0b4('0x10')](_0xc0b4('0x11'),_0x15af04,_0xc0b4('0xf'),JSON[_0xc0b4('0x12')](_0x17eb03));if(_0x17eb03[_0xc0b4('0x13')]){if(_0x17eb03[_0xc0b4('0x13')][_0xc0b4('0x14')]===0x1f4){logger['error'](_0xc0b4('0xe'),_0x15af04,_0x17eb03['error'][_0xc0b4('0x15')]);return _0x21ee7c(_0x17eb03[_0xc0b4('0x13')][_0xc0b4('0x15')]);}logger[_0xc0b4('0x13')](_0xc0b4('0xe'),_0x15af04,_0x17eb03[_0xc0b4('0x13')]['message']);return _0x873802(_0x17eb03[_0xc0b4('0x13')][_0xc0b4('0x15')]);}else{logger[_0xc0b4('0xd')](_0xc0b4('0xe'),_0x15af04,_0xc0b4('0xf'));_0x873802(_0x17eb03[_0xc0b4('0x16')][_0xc0b4('0x15')]);}})[_0xc0b4('0x17')](function(_0x585a9b){logger[_0xc0b4('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x15af04,_0x585a9b);_0x21ee7c(_0x585a9b);});});}exports[_0xc0b4('0x18')]=function(_0x33cedb){var _0x34d2bc=this;return new Promise(function(_0x525ae8,_0x4627a0){return db[_0xc0b4('0x19')][_0xc0b4('0x1a')](_0x33cedb[_0xc0b4('0x1b')],{'raw':_0x33cedb[_0xc0b4('0x1c')]?_0x33cedb[_0xc0b4('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc0b4('0xc')](function(_0x2bba00){logger[_0xc0b4('0xd')]('CreateVoiceTransferReport',_0x33cedb);logger[_0xc0b4('0x10')](_0xc0b4('0x18'),_0x33cedb,JSON['stringify'](_0x2bba00));_0x525ae8(_0x2bba00);})['catch'](function(_0xd845a9){logger[_0xc0b4('0x13')](_0xc0b4('0x18'),_0xd845a9['message'],_0x33cedb);_0x4627a0(_0x34d2bc['error'](0x1f4,_0xd845a9['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index bf4fcf3..2f896d2 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 _0xbe45=['transfer','exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer','/hold','/calls','calls'];(function(_0x36c312,_0x4d764e){var _0xa84276=function(_0x145de3){while(--_0x145de3){_0x36c312['push'](_0x36c312['shift']());}};_0xa84276(++_0x4d764e);}(_0xbe45,0xf0));var _0x5be4=function(_0x2d59cd,_0x3efc0c){_0x2d59cd=_0x2d59cd-0x0;var _0x23a973=_0xbe45[_0x2d59cd];return _0x23a973;};'use strict';var express=require(_0x5be4('0x0'));var router=express[_0x5be4('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5be4('0x2'));router[_0x5be4('0x3')](_0x5be4('0x4'),auth[_0x5be4('0x5')](),auth[_0x5be4('0x6')](),controller[_0x5be4('0x7')]);router['post'](_0x5be4('0x8'),auth[_0x5be4('0x5')](),auth[_0x5be4('0x6')](),controller[_0x5be4('0x9')]);router[_0x5be4('0x3')](_0x5be4('0xa'),auth[_0x5be4('0x5')](),auth[_0x5be4('0x6')](),controller[_0x5be4('0xb')]);router[_0x5be4('0x3')](_0x5be4('0xc'),auth[_0x5be4('0x5')](),auth[_0x5be4('0x6')](),controller['hold']);router[_0x5be4('0x3')]('/unhold',auth['isAuthenticated'](),auth[_0x5be4('0x6')](),controller['unhold']);router[_0x5be4('0x3')](_0x5be4('0xd'),auth['isAuthenticated'](),auth[_0x5be4('0x6')](),controller[_0x5be4('0xe')]);router[_0x5be4('0x3')]('/transfer',auth[_0x5be4('0x5')](),auth['canUpdate'](),controller[_0x5be4('0xf')]);module[_0x5be4('0x10')]=router; \ No newline at end of file +var _0x9099=['/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post'];(function(_0x545dd8,_0x404f75){var _0x44cd80=function(_0xec3ca3){while(--_0xec3ca3){_0x545dd8['push'](_0x545dd8['shift']());}};_0x44cd80(++_0x404f75);}(_0x9099,0x1ac));var _0x9909=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x9099[_0x7275e9];return _0x17b99d;};'use strict';var express=require(_0x9909('0x0'));var router=express['Router']();var auth=require(_0x9909('0x1'));var controller=require(_0x9909('0x2'));router[_0x9909('0x3')](_0x9909('0x4'),auth[_0x9909('0x5')](),auth[_0x9909('0x6')](),controller[_0x9909('0x7')]);router[_0x9909('0x3')](_0x9909('0x8'),auth[_0x9909('0x5')](),auth[_0x9909('0x6')](),controller[_0x9909('0x9')]);router[_0x9909('0x3')](_0x9909('0xa'),auth['isAuthenticated'](),auth[_0x9909('0x6')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x9909('0x6')](),controller['hold']);router[_0x9909('0x3')](_0x9909('0xb'),auth[_0x9909('0x5')](),auth['canUpdate'](),controller[_0x9909('0xc')]);router['post'](_0x9909('0xd'),auth[_0x9909('0x5')](),auth[_0x9909('0x6')](),controller[_0x9909('0xe')]);router[_0x9909('0x3')](_0x9909('0xf'),auth[_0x9909('0x5')](),auth[_0x9909('0x6')](),controller[_0x9909('0x10')]);module[_0x9909('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 556ce46..b2ef9fc 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 _0x684d=['stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','json','userId','callNumber','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','bluebird','client','http','../../config/logger','ioredis','defaults','localhost','socket.io-emitter','redis','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x684d,0x174));var _0xd684=function(_0x3ad010,_0x122000){_0x3ad010=_0x3ad010-0x0;var _0x44a500=_0x684d[_0x3ad010];return _0x44a500;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xd684('0x0'));var db=require(_0xd684('0x1'))['db'];var config=require(_0xd684('0x2'));var util=require('util');var BPromise=require(_0xd684('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd684('0x4')][_0xd684('0x5')]({'port':0x232a});var logger=require(_0xd684('0x6'))('webbarapi');var Redis=require(_0xd684('0x7'));config['redis']=_[_0xd684('0x8')](config['redis'],{'host':_0xd684('0x9'),'port':0x18eb});var io=require(_0xd684('0xa'))(new Redis(config[_0xd684('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xd684('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xd684('0xd'),'required':[!![],_0xd684('0xe')]},'callerId':{'type':_0xd684('0xd')},'callbackUrl':{'type':_0xd684('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xd684('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd684('0xc'),'required':[!![],_0xd684('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd684('0xf')]},'sessionId':{'type':_0xd684('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xd684('0xd'),'required':[!![],_0xd684('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xd684('0xc'),'required':[!![],_0xd684('0xf')]},'sessionId':{'type':_0xd684('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd684('0xc'),'required':[!![],_0xd684('0xf')]},'sessionId':{'type':_0xd684('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd684('0xc'),'required':[!![],_0xd684('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd684('0xf')]}});function emit(_0x5b1d43,_0x47622c,_0x57f660){logger[_0xd684('0x11')](_0x5b1d43,_0x47622c,JSON[_0xd684('0x12')](_0x57f660));io['to'](_0x5b1d43)[_0xd684('0x13')](_0x47622c,_0x57f660);}function handleError(_0x1f8f3f){return function(_0xf27ff7){console[_0xd684('0x14')](_0xd684('0x15'),_0xf27ff7,_0xf27ff7 instanceof RangeError);logger[_0xd684('0x16')](_0xf27ff7[_0xd684('0x17')]);if(_0xf27ff7 instanceof RangeError){if(_0xf27ff7[_0xd684('0x18')]){delete _0xf27ff7[_0xd684('0x18')];}_0x1f8f3f[_0xd684('0x19')](0x194)[_0xd684('0x1a')](_0xf27ff7);}else{if(_0xf27ff7[_0xd684('0x18')]){delete _0xf27ff7[_0xd684('0x18')];}_0x1f8f3f['status'](0x1f4)['send'](_0xf27ff7);}};}function checkError(){return function(_0x379be1){if(!_0x379be1){throw new RangeError(_0xd684('0x1b'));}return _0x379be1;};}function respondWithRpcPromise(_0x41e109,_0x2d3b8c){return new BPromise(function(_0x454a51,_0x2d935a){var _0x1413a5=amiClient;return _0x1413a5[_0xd684('0x1c')](_0x41e109,_0x2d3b8c)['then'](function(_0x5382c4){if(_0x5382c4[_0xd684('0x16')]){if(_0x5382c4[_0xd684('0x16')]['code']===0x1f4){return _0x2d935a(_0x5382c4['error'][_0xd684('0x1d')]);}return _0x454a51(_0x5382c4[_0xd684('0x16')][_0xd684('0x1d')]);}else{_0x454a51(_0x5382c4[_0xd684('0x1e')]);}})[_0xd684('0x1f')](function(_0x4b08cd){_0x2d935a(_0x4b08cd);});});}function getAgent(_0x94c706){return db[_0xd684('0x20')][_0xd684('0x21')]({'where':{'id':_0x94c706,'role':_0xd684('0x22')}})[_0xd684('0x23')](checkError());}function getAgentCheckSession(_0x57ec90,_0x38b902){return new BPromise(function(_0x5e2ef3,_0x130681){var _0xd269fb=respondWithRpcPromise(_0xd684('0x24'));var _0x37eab0=getAgent(_0x57ec90);Promise[_0xd684('0x25')]([_0xd269fb,_0x37eab0])['then'](function(_0x10e84f){var _0x44789b=_0x10e84f[0x0];var _0x563198=_0x10e84f[0x1];var _0x2779b2=_[_0xd684('0x26')](_0x44789b[_0xd684('0x27')],function(_0x385c5c){return _0x385c5c[_0xd684('0x28')]==_0x563198['id']&&_0x385c5c[_0xd684('0x29')]==_0x38b902;});if(_0x2779b2[_0xd684('0x2a')]==0x1){_0x5e2ef3(_0x563198);}else{_0x130681(new RangeError(_0xd684('0x2b')+_0x38b902+_0xd684('0x2c')));}});});}exports['originate']=function(_0x2df7d2,_0x386d61){logger[_0xd684('0x11')](_0xd684('0x2d'),_0x2df7d2[_0xd684('0x2e')]);var _0x118460=originateValidation[_0xd684('0x2f')](_0x2df7d2['body']);if(_0x118460[_0xd684('0x2a')]>0x0){return _0x386d61[_0xd684('0x19')](0x190)[_0xd684('0x30')](_0x118460);}var _0x462a8e=_0x2df7d2[_0xd684('0x2e')][_0xd684('0x31')];var _0xb85ac5=_0x2df7d2['body'][_0xd684('0x32')];var _0x2ca7f0=_0x2df7d2[_0xd684('0x2e')]['callerId'];var _0xa8b0b0=_0x2df7d2[_0xd684('0x2e')]['callbackUrl'];return getAgent(_0x462a8e)[_0xd684('0x23')](function(_0x67e893){logger[_0xd684('0x11')](_0xd684('0x33'),_0x67e893[_0xd684('0x18')]);emit(util[_0xd684('0x34')](_0xd684('0x35'),_0x67e893[_0xd684('0x18')]),_0xd684('0x36'),{'callNumber':_0xb85ac5,'callerId':_0x2ca7f0,'callbackUrl':_0xa8b0b0});return _0x386d61[_0xd684('0x19')](0xc8)[_0xd684('0x30')]({'error':![],'message':_0xd684('0x37')});})[_0xd684('0x1f')](handleError(_0x386d61));};exports['hangup']=function(_0x3b0043,_0x2b742f){logger[_0xd684('0x11')](_0xd684('0x38'),_0x3b0043[_0xd684('0x2e')]);var _0x238c50=hangupValidation[_0xd684('0x2f')](_0x3b0043[_0xd684('0x2e')]);if(_0x238c50[_0xd684('0x2a')]>0x0){return _0x2b742f[_0xd684('0x19')](0x190)[_0xd684('0x30')](_0x238c50);}var _0x4aaaee=_0x3b0043['body']['userId'];var _0x28a774=_0x3b0043[_0xd684('0x2e')][_0xd684('0x29')];return getAgent(_0x4aaaee)[_0xd684('0x23')](function(_0x1460a6){logger[_0xd684('0x11')](_0xd684('0x33'),_0x1460a6[_0xd684('0x18')]);emit(util[_0xd684('0x34')]('user:%s',_0x1460a6[_0xd684('0x18')]),_0xd684('0x39'),{'sessionId':_0x28a774});return _0x2b742f[_0xd684('0x19')](0xc8)[_0xd684('0x30')]({'error':![],'message':_0xd684('0x3a')});})['catch'](handleError(_0x2b742f));};exports[_0xd684('0x3b')]=function(_0x1bdcb3,_0x79bcef){logger['info']('answer\x20fired:',_0x1bdcb3[_0xd684('0x2e')]);var _0x157b90=answerValidation[_0xd684('0x2f')](_0x1bdcb3[_0xd684('0x2e')]);if(_0x157b90[_0xd684('0x2a')]>0x0){return _0x79bcef[_0xd684('0x19')](0x190)['json'](_0x157b90);}var _0x2b1c93=_0x1bdcb3[_0xd684('0x2e')][_0xd684('0x31')];var _0x574605=_0x1bdcb3[_0xd684('0x2e')][_0xd684('0x29')];return getAgent(_0x2b1c93)[_0xd684('0x23')](function(_0x585dc7){logger['info'](_0xd684('0x33'),_0x585dc7['name']);emit(util[_0xd684('0x34')](_0xd684('0x35'),_0x585dc7[_0xd684('0x18')]),_0xd684('0x3c'),{'sessionId':_0x574605});return _0x79bcef[_0xd684('0x19')](0xc8)['json']({'error':![],'message':_0xd684('0x3d')});})[_0xd684('0x1f')](handleError(_0x79bcef));};exports[_0xd684('0x3e')]=function(_0x4f2732,_0x5a0e11){logger['info'](_0xd684('0x3f'),_0x4f2732[_0xd684('0x2e')]);var _0x556b21=holdValidation['validate'](_0x4f2732[_0xd684('0x2e')]);if(_0x556b21[_0xd684('0x2a')]>0x0){return _0x5a0e11[_0xd684('0x19')](0x190)[_0xd684('0x30')](_0x556b21);}var _0x1cf5b0=_0x4f2732[_0xd684('0x2e')]['userId'];var _0x585bff=_0x4f2732[_0xd684('0x2e')]['sessionId'];return getAgent(_0x1cf5b0)['then'](function(_0x2bb60d){logger[_0xd684('0x11')](_0xd684('0x33'),_0x2bb60d[_0xd684('0x18')]);emit(util[_0xd684('0x34')](_0xd684('0x35'),_0x2bb60d[_0xd684('0x18')]),'webbar:hold',{'sessionId':_0x585bff});return _0x5a0e11[_0xd684('0x19')](0xc8)['json']({'error':![],'message':_0xd684('0x40')});})[_0xd684('0x1f')](handleError(_0x5a0e11));};exports[_0xd684('0x41')]=function(_0x2db16d,_0x5009f2){logger[_0xd684('0x11')]('unhold\x20fired:',_0x2db16d[_0xd684('0x2e')]);var _0x34718b=unholdValidation[_0xd684('0x2f')](_0x2db16d[_0xd684('0x2e')]);if(_0x34718b['length']>0x0){return _0x5009f2[_0xd684('0x19')](0x190)['json'](_0x34718b);}var _0x3c11ed=_0x2db16d['body']['userId'];var _0x504a2d=_0x2db16d[_0xd684('0x2e')][_0xd684('0x29')];return getAgent(_0x3c11ed)[_0xd684('0x23')](function(_0x55a117){logger[_0xd684('0x11')](_0xd684('0x33'),_0x55a117[_0xd684('0x18')]);emit(util[_0xd684('0x34')](_0xd684('0x35'),_0x55a117[_0xd684('0x18')]),_0xd684('0x42'),{'sessionId':_0x504a2d});return _0x5009f2['status'](0xc8)[_0xd684('0x30')]({'error':![],'message':_0xd684('0x43')});})[_0xd684('0x1f')](handleError(_0x5009f2));};exports[_0xd684('0x44')]=function(_0x46c85d,_0x3faafc){logger[_0xd684('0x11')](_0xd684('0x45'),_0x3faafc['body']);var _0x3b7d85=callsValidation[_0xd684('0x2f')](_0x46c85d[_0xd684('0x2e')]);if(_0x3b7d85[_0xd684('0x2a')]>0x0){return _0x3faafc[_0xd684('0x19')](0x190)['json'](_0x3b7d85);}var _0x125d08=_0x46c85d[_0xd684('0x2e')][_0xd684('0x31')];var _0x42be5a=respondWithRpcPromise(_0xd684('0x24'));var _0x16e8a6=getAgent(_0x125d08);return Promise[_0xd684('0x25')]([_0x42be5a,_0x16e8a6])[_0xd684('0x23')](function(_0x487970){var _0x427738=_0x487970[0x0];var _0x248c68=_0x487970[0x1];var _0x16ae04=_['filter'](_0x427738[_0xd684('0x27')],function(_0x27d016){return _0x27d016[_0xd684('0x28')]==_0x248c68['id'];});return _0x3faafc[_0xd684('0x19')](0xc8)[_0xd684('0x30')]({'count':_0x16ae04['length'],'rows':_0x16ae04});})[_0xd684('0x1f')](handleError(_0x3faafc));};exports[_0xd684('0x46')]=function(_0x3630da,_0x32e215){logger['info']('conference\x20fired:',_0x3630da[_0xd684('0x2e')]);var _0x393a3a=conferenceValidation[_0xd684('0x2f')](_0x3630da[_0xd684('0x2e')]);if(_0x393a3a[_0xd684('0x2a')]>0x0){return _0x32e215[_0xd684('0x19')](0x190)['json'](_0x393a3a);}var _0x3f2b9e=_0x3630da[_0xd684('0x2e')]['userId'];return getAgent(_0x3f2b9e)['then'](function(_0x10c6a6){logger[_0xd684('0x11')](_0xd684('0x33'),_0x10c6a6[_0xd684('0x18')]);emit(util['format']('user:%s',_0x10c6a6[_0xd684('0x18')]),_0xd684('0x47'));return _0x32e215['status'](0xc8)[_0xd684('0x30')]({'error':![],'message':_0xd684('0x48')});})[_0xd684('0x1f')](handleError(_0x32e215));};exports[_0xd684('0x49')]=function(_0x10067e,_0x5b7b68){logger['info'](_0xd684('0x4a'),_0x10067e[_0xd684('0x2e')]);var _0x1be082=transferValidation[_0xd684('0x2f')](_0x10067e['body']);if(_0x1be082[_0xd684('0x2a')]>0x0){return _0x5b7b68['status'](0x190)[_0xd684('0x30')](_0x1be082);}var _0x2bba17=_0x10067e[_0xd684('0x2e')][_0xd684('0x31')];var _0x89460e=_0x10067e[_0xd684('0x2e')][_0xd684('0x29')];var _0x14d29c=_0x10067e[_0xd684('0x2e')][_0xd684('0x4b')];return getAgent(_0x2bba17)[_0xd684('0x23')](function(_0x1eea1a){logger[_0xd684('0x11')]('entityFound:',_0x1eea1a[_0xd684('0x18')]);emit(util[_0xd684('0x34')]('user:%s',_0x1eea1a[_0xd684('0x18')]),_0xd684('0x4c'),{'sessionId':_0x89460e,'transferNumber':_0x14d29c});return _0x5b7b68[_0xd684('0x19')](0xc8)[_0xd684('0x30')]({'error':![],'message':_0xd684('0x4d')});})[_0xd684('0x1f')](handleError(_0x5b7b68));}; \ No newline at end of file +var _0x4a81=['userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','jayson/promise','http','../../config/logger','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','json','body'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x4a81,0x1b7));var _0x14a8=function(_0x46619f,_0x2a5dd5){_0x46619f=_0x46619f-0x0;var _0x42e23c=_0x4a81[_0x46619f];return _0x42e23c;};'use strict';var path=require(_0x14a8('0x0'));var fs=require('fs');var _=require(_0x14a8('0x1'));var db=require(_0x14a8('0x2'))['db'];var config=require(_0x14a8('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x14a8('0x4'));var amiClient=jayson['client'][_0x14a8('0x5')]({'port':0x232a});var logger=require(_0x14a8('0x6'))('webbarapi');var Redis=require('ioredis');config[_0x14a8('0x7')]=_['defaults'](config[_0x14a8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x14a8('0x8'))(new Redis(config[_0x14a8('0x7')]));var Schema=require(_0x14a8('0x9'));var originateValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x14a8('0xc')},'callbackUrl':{'type':_0x14a8('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x14a8('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]},'sessionId':{'type':_0x14a8('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]},'sessionId':{'type':_0x14a8('0xc'),'required':[!![],_0x14a8('0xd')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x14a8('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]}});function emit(_0x3a7152,_0x4dac6b,_0x356cf0){logger[_0x14a8('0xe')](_0x3a7152,_0x4dac6b,JSON['stringify'](_0x356cf0));io['to'](_0x3a7152)[_0x14a8('0xf')](_0x4dac6b,_0x356cf0);}function handleError(_0x524e35){return function(_0x98e1d5){console[_0x14a8('0x10')](_0x14a8('0x11'),_0x98e1d5,_0x98e1d5 instanceof RangeError);logger[_0x14a8('0x12')](_0x98e1d5[_0x14a8('0x13')]);if(_0x98e1d5 instanceof RangeError){if(_0x98e1d5[_0x14a8('0x14')]){delete _0x98e1d5['name'];}_0x524e35[_0x14a8('0x15')](0x194)[_0x14a8('0x16')](_0x98e1d5);}else{if(_0x98e1d5['name']){delete _0x98e1d5['name'];}_0x524e35[_0x14a8('0x15')](0x1f4)['send'](_0x98e1d5);}};}function checkError(){return function(_0x452c6c){if(!_0x452c6c){throw new RangeError('NotFound');}return _0x452c6c;};}function respondWithRpcPromise(_0x207e9f,_0x53f402){return new BPromise(function(_0x190189,_0x3afd58){var _0x182f2b=amiClient;return _0x182f2b[_0x14a8('0x17')](_0x207e9f,_0x53f402)['then'](function(_0x3d8cd1){if(_0x3d8cd1['error']){if(_0x3d8cd1[_0x14a8('0x12')][_0x14a8('0x18')]===0x1f4){return _0x3afd58(_0x3d8cd1[_0x14a8('0x12')][_0x14a8('0x19')]);}return _0x190189(_0x3d8cd1[_0x14a8('0x12')][_0x14a8('0x19')]);}else{_0x190189(_0x3d8cd1[_0x14a8('0x1a')]);}})[_0x14a8('0x1b')](function(_0x505655){_0x3afd58(_0x505655);});});}function getAgent(_0x2505d9){return db[_0x14a8('0x1c')][_0x14a8('0x1d')]({'where':{'id':_0x2505d9,'role':_0x14a8('0x1e')}})[_0x14a8('0x1f')](checkError());}function getAgentCheckSession(_0x42bdea,_0x3ae40c){return new BPromise(function(_0x37a780,_0x35b1c8){var _0x28d25c=respondWithRpcPromise(_0x14a8('0x20'));var _0x1c378a=getAgent(_0x42bdea);Promise[_0x14a8('0x21')]([_0x28d25c,_0x1c378a])['then'](function(_0x380e9a){var _0x2fdaed=_0x380e9a[0x0];var _0x4d71a1=_0x380e9a[0x1];var _0x3c3268=_[_0x14a8('0x22')](_0x2fdaed[_0x14a8('0x23')],function(_0x486f3f){return _0x486f3f[_0x14a8('0x24')]==_0x4d71a1['id']&&_0x486f3f[_0x14a8('0x25')]==_0x3ae40c;});if(_0x3c3268[_0x14a8('0x26')]==0x1){_0x37a780(_0x4d71a1);}else{_0x35b1c8(new RangeError(_0x14a8('0x27')+_0x3ae40c+_0x14a8('0x28')));}});});}exports[_0x14a8('0x29')]=function(_0x2a3fbc,_0x4f98a0){logger[_0x14a8('0xe')]('originate\x20fired:',_0x2a3fbc['body']);var _0xd74489=originateValidation['validate'](_0x2a3fbc['body']);if(_0xd74489[_0x14a8('0x26')]>0x0){return _0x4f98a0[_0x14a8('0x15')](0x190)[_0x14a8('0x2a')](_0xd74489);}var _0x50f50c=_0x2a3fbc[_0x14a8('0x2b')][_0x14a8('0x2c')];var _0x40e38b=_0x2a3fbc['body'][_0x14a8('0x2d')];var _0x2f9fc0=_0x2a3fbc[_0x14a8('0x2b')][_0x14a8('0x2e')];var _0x2a4c0c=_0x2a3fbc['body']['callbackUrl'];return getAgent(_0x50f50c)[_0x14a8('0x1f')](function(_0x3c96f5){logger[_0x14a8('0xe')](_0x14a8('0x2f'),_0x3c96f5[_0x14a8('0x14')]);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0x3c96f5['name']),_0x14a8('0x32'),{'callNumber':_0x40e38b,'callerId':_0x2f9fc0,'callbackUrl':_0x2a4c0c});return _0x4f98a0[_0x14a8('0x15')](0xc8)['json']({'error':![],'message':_0x14a8('0x33')});})['catch'](handleError(_0x4f98a0));};exports['hangup']=function(_0x5d77e3,_0x2da3a1){logger['info']('hangup\x20fired:',_0x5d77e3[_0x14a8('0x2b')]);var _0x334b9e=hangupValidation[_0x14a8('0x9')](_0x5d77e3[_0x14a8('0x2b')]);if(_0x334b9e[_0x14a8('0x26')]>0x0){return _0x2da3a1['status'](0x190)[_0x14a8('0x2a')](_0x334b9e);}var _0x57545b=_0x5d77e3['body'][_0x14a8('0x2c')];var _0x32a3d9=_0x5d77e3[_0x14a8('0x2b')]['sessionId'];return getAgent(_0x57545b)[_0x14a8('0x1f')](function(_0x268a1a){logger[_0x14a8('0xe')](_0x14a8('0x2f'),_0x268a1a['name']);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0x268a1a['name']),_0x14a8('0x34'),{'sessionId':_0x32a3d9});return _0x2da3a1[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'error':![],'message':_0x14a8('0x35')});})[_0x14a8('0x1b')](handleError(_0x2da3a1));};exports[_0x14a8('0x36')]=function(_0x3a8323,_0x56372f){logger[_0x14a8('0xe')](_0x14a8('0x37'),_0x3a8323['body']);var _0x1c28a1=answerValidation[_0x14a8('0x9')](_0x3a8323['body']);if(_0x1c28a1[_0x14a8('0x26')]>0x0){return _0x56372f[_0x14a8('0x15')](0x190)[_0x14a8('0x2a')](_0x1c28a1);}var _0x2b279f=_0x3a8323[_0x14a8('0x2b')][_0x14a8('0x2c')];var _0x4ad341=_0x3a8323[_0x14a8('0x2b')]['sessionId'];return getAgent(_0x2b279f)[_0x14a8('0x1f')](function(_0x9c0a28){logger[_0x14a8('0xe')](_0x14a8('0x2f'),_0x9c0a28[_0x14a8('0x14')]);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0x9c0a28['name']),_0x14a8('0x38'),{'sessionId':_0x4ad341});return _0x56372f[_0x14a8('0x15')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x14a8('0x1b')](handleError(_0x56372f));};exports['hold']=function(_0x976e04,_0x4f559a){logger[_0x14a8('0xe')](_0x14a8('0x39'),_0x976e04[_0x14a8('0x2b')]);var _0x3433af=holdValidation[_0x14a8('0x9')](_0x976e04[_0x14a8('0x2b')]);if(_0x3433af['length']>0x0){return _0x4f559a['status'](0x190)['json'](_0x3433af);}var _0x14138c=_0x976e04[_0x14a8('0x2b')][_0x14a8('0x2c')];var _0x21df3d=_0x976e04['body'][_0x14a8('0x25')];return getAgent(_0x14138c)[_0x14a8('0x1f')](function(_0xb3a3a0){logger[_0x14a8('0xe')]('entityFound:',_0xb3a3a0['name']);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0xb3a3a0[_0x14a8('0x14')]),_0x14a8('0x3a'),{'sessionId':_0x21df3d});return _0x4f559a['status'](0xc8)[_0x14a8('0x2a')]({'error':![],'message':_0x14a8('0x3b')});})[_0x14a8('0x1b')](handleError(_0x4f559a));};exports[_0x14a8('0x3c')]=function(_0x33b86f,_0x1053db){logger[_0x14a8('0xe')](_0x14a8('0x3d'),_0x33b86f[_0x14a8('0x2b')]);var _0x20e54c=unholdValidation[_0x14a8('0x9')](_0x33b86f[_0x14a8('0x2b')]);if(_0x20e54c[_0x14a8('0x26')]>0x0){return _0x1053db[_0x14a8('0x15')](0x190)['json'](_0x20e54c);}var _0x295484=_0x33b86f[_0x14a8('0x2b')][_0x14a8('0x2c')];var _0xfb197b=_0x33b86f['body'][_0x14a8('0x25')];return getAgent(_0x295484)['then'](function(_0x3a373f){logger[_0x14a8('0xe')]('entityFound:',_0x3a373f['name']);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0x3a373f[_0x14a8('0x14')]),'webbar:unhold',{'sessionId':_0xfb197b});return _0x1053db[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x1053db));};exports[_0x14a8('0x3e')]=function(_0x60f310,_0x49dfea){logger['info']('calls\x20fired:',_0x49dfea['body']);var _0x192d6c=callsValidation[_0x14a8('0x9')](_0x60f310['body']);if(_0x192d6c[_0x14a8('0x26')]>0x0){return _0x49dfea['status'](0x190)['json'](_0x192d6c);}var _0x3830f8=_0x60f310[_0x14a8('0x2b')]['userId'];var _0x17b945=respondWithRpcPromise(_0x14a8('0x20'));var _0xa1dd0e=getAgent(_0x3830f8);return Promise[_0x14a8('0x21')]([_0x17b945,_0xa1dd0e])[_0x14a8('0x1f')](function(_0x2ef13f){var _0x226ff7=_0x2ef13f[0x0];var _0x5e4de0=_0x2ef13f[0x1];var _0xb4e58d=_[_0x14a8('0x22')](_0x226ff7['rows'],function(_0x27dab7){return _0x27dab7[_0x14a8('0x24')]==_0x5e4de0['id'];});return _0x49dfea[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'count':_0xb4e58d['length'],'rows':_0xb4e58d});})[_0x14a8('0x1b')](handleError(_0x49dfea));};exports[_0x14a8('0x3f')]=function(_0x4ec75c,_0x545a33){logger[_0x14a8('0xe')]('conference\x20fired:',_0x4ec75c['body']);var _0x448afd=conferenceValidation[_0x14a8('0x9')](_0x4ec75c[_0x14a8('0x2b')]);if(_0x448afd['length']>0x0){return _0x545a33['status'](0x190)[_0x14a8('0x2a')](_0x448afd);}var _0x4b88e7=_0x4ec75c['body']['userId'];return getAgent(_0x4b88e7)['then'](function(_0x119b22){logger['info'](_0x14a8('0x2f'),_0x119b22[_0x14a8('0x14')]);emit(util['format'](_0x14a8('0x31'),_0x119b22[_0x14a8('0x14')]),_0x14a8('0x40'));return _0x545a33[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'error':![],'message':_0x14a8('0x41')});})[_0x14a8('0x1b')](handleError(_0x545a33));};exports['transfer']=function(_0x2c12ee,_0x4d3de9){logger[_0x14a8('0xe')](_0x14a8('0x42'),_0x2c12ee[_0x14a8('0x2b')]);var _0x3f898e=transferValidation['validate'](_0x2c12ee[_0x14a8('0x2b')]);if(_0x3f898e['length']>0x0){return _0x4d3de9['status'](0x190)[_0x14a8('0x2a')](_0x3f898e);}var _0x17fd52=_0x2c12ee[_0x14a8('0x2b')]['userId'];var _0x3ba685=_0x2c12ee['body'][_0x14a8('0x25')];var _0x3f2ae2=_0x2c12ee[_0x14a8('0x2b')][_0x14a8('0x43')];return getAgent(_0x17fd52)[_0x14a8('0x1f')](function(_0x386a03){logger[_0x14a8('0xe')](_0x14a8('0x2f'),_0x386a03['name']);emit(util['format']('user:%s',_0x386a03[_0x14a8('0x14')]),_0x14a8('0x44'),{'sessionId':_0x3ba685,'transferNumber':_0x3f2ae2});return _0x4d3de9[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0x14a8('0x1b')](handleError(_0x4d3de9));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 6f2385f..fac1091 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 _0xa988=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addAnswer','addAgents','addApplications','notify','/:id/send','send','update','destroy','delete','removeAnswers','removeAgents','exports','util'];(function(_0x39038a,_0x4e8677){var _0x5751bc=function(_0x5df779){while(--_0x5df779){_0x39038a['push'](_0x39038a['shift']());}};_0x5751bc(++_0x4e8677);}(_0xa988,0x19f));var _0x8a98=function(_0x36a7c3,_0x1c0348){_0x36a7c3=_0x36a7c3-0x0;var _0x31d6d4=_0xa988[_0x36a7c3];return _0x31d6d4;};'use strict';var multer=require('multer');var util=require(_0x8a98('0x0'));var path=require(_0x8a98('0x1'));var timeout=require(_0x8a98('0x2'));var express=require(_0x8a98('0x3'));var router=express[_0x8a98('0x4')]();var auth=require(_0x8a98('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8a98('0x6'));var controller=require('./whatsappAccount.controller');router[_0x8a98('0x7')]('/',auth[_0x8a98('0x8')](),controller[_0x8a98('0x9')]);router[_0x8a98('0x7')]('/describe',auth[_0x8a98('0x8')](),controller['describe']);router[_0x8a98('0x7')](_0x8a98('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8a98('0x7')]('/:id/dispositions',auth[_0x8a98('0x8')](),controller[_0x8a98('0xb')]);router[_0x8a98('0x7')](_0x8a98('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x8a98('0x7')](_0x8a98('0xd'),auth['isAuthenticated'](),controller[_0x8a98('0xe')]);router[_0x8a98('0x7')](_0x8a98('0xf'),auth['isAuthenticated'](),controller[_0x8a98('0x10')]);router[_0x8a98('0x11')]('/',auth[_0x8a98('0x8')](),controller[_0x8a98('0x12')]);router[_0x8a98('0x11')](_0x8a98('0x13'),auth[_0x8a98('0x8')](),controller['addDisposition']);router[_0x8a98('0x11')](_0x8a98('0xc'),auth[_0x8a98('0x8')](),controller[_0x8a98('0x14')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x8a98('0x15')]);router[_0x8a98('0x11')](_0x8a98('0xf'),auth[_0x8a98('0x8')](),controller[_0x8a98('0x16')]);router[_0x8a98('0x11')]('/:id/notify',controller[_0x8a98('0x17')]);router[_0x8a98('0x11')](_0x8a98('0x18'),auth[_0x8a98('0x8')](),controller[_0x8a98('0x19')]);router['put'](_0x8a98('0xa'),auth[_0x8a98('0x8')](),controller[_0x8a98('0x1a')]);router['delete'](_0x8a98('0xa'),auth[_0x8a98('0x8')](),controller[_0x8a98('0x1b')]);router['delete']('/:id/dispositions',auth[_0x8a98('0x8')](),controller['removeDispositions']);router[_0x8a98('0x1c')](_0x8a98('0xc'),auth['isAuthenticated'](),controller[_0x8a98('0x1d')]);router[_0x8a98('0x1c')]('/:id/users',auth[_0x8a98('0x8')](),controller[_0x8a98('0x1e')]);module[_0x8a98('0x1f')]=router; \ No newline at end of file +var _0xb0e8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router'];(function(_0x139701,_0x171296){var _0x2289c0=function(_0x5bbf96){while(--_0x5bbf96){_0x139701['push'](_0x139701['shift']());}};_0x2289c0(++_0x171296);}(_0xb0e8,0x19d));var _0x8b0e=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0xb0e8[_0x256422];return _0x55dddc;};'use strict';var multer=require(_0x8b0e('0x0'));var util=require('util');var path=require(_0x8b0e('0x1'));var timeout=require(_0x8b0e('0x2'));var express=require(_0x8b0e('0x3'));var router=express[_0x8b0e('0x4')]();var auth=require(_0x8b0e('0x5'));var interaction=require(_0x8b0e('0x6'));var config=require(_0x8b0e('0x7'));var controller=require(_0x8b0e('0x8'));router[_0x8b0e('0x9')]('/',auth[_0x8b0e('0xa')](),controller[_0x8b0e('0xb')]);router[_0x8b0e('0x9')](_0x8b0e('0xc'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0xd')]);router['get'](_0x8b0e('0xe'),auth['isAuthenticated'](),controller[_0x8b0e('0xf')]);router['get']('/:id/dispositions',auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x10')]);router[_0x8b0e('0x9')](_0x8b0e('0x11'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x12')]);router[_0x8b0e('0x9')](_0x8b0e('0x13'),auth[_0x8b0e('0xa')](),controller['getAgents']);router[_0x8b0e('0x9')](_0x8b0e('0x14'),auth['isAuthenticated'](),controller[_0x8b0e('0x15')]);router[_0x8b0e('0x16')]('/',auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x17')]);router[_0x8b0e('0x16')](_0x8b0e('0x18'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x19')]);router[_0x8b0e('0x16')](_0x8b0e('0x11'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x1a')]);router[_0x8b0e('0x16')](_0x8b0e('0x13'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x1b')]);router[_0x8b0e('0x16')]('/:id/applications',auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x1c')]);router[_0x8b0e('0x16')](_0x8b0e('0x1d'),controller['notify']);router[_0x8b0e('0x16')](_0x8b0e('0x1e'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x1f')]);router['put']('/:id',auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x20')]);router[_0x8b0e('0x21')](_0x8b0e('0xe'),auth['isAuthenticated'](),controller[_0x8b0e('0x22')]);router[_0x8b0e('0x21')](_0x8b0e('0x18'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x23')]);router[_0x8b0e('0x21')](_0x8b0e('0x11'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x24')]);router[_0x8b0e('0x21')](_0x8b0e('0x13'),auth[_0x8b0e('0xa')](),controller[_0x8b0e('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 48cab66..f9352ae 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 _0x8dc2=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','TEXT'];(function(_0x53d0f2,_0x461fff){var _0x4039fe=function(_0x1da59f){while(--_0x1da59f){_0x53d0f2['push'](_0x53d0f2['shift']());}};_0x4039fe(++_0x461fff);}(_0x8dc2,0xd8));var _0x28dc=function(_0x2c2a8e,_0x1dfe39){_0x2c2a8e=_0x2c2a8e-0x0;var _0x3b9e38=_0x8dc2[_0x2c2a8e];return _0x3b9e38;};'use strict';var Sequelize=require(_0x28dc('0x0'));var rs=require(_0x28dc('0x1'));module[_0x28dc('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x28dc('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x28dc('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x28dc('0x5')](_0x28dc('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x28dc('0x4')]},'notificationTemplate':{'type':Sequelize[_0x28dc('0x7')],'defaultValue':function(){return _0x28dc('0x8');}},'notificationSound':{'type':Sequelize[_0x28dc('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x28dc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x28dc('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x28dc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x28dc('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x28dc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x28dc('0xa')],'comment':_0x28dc('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x28dc('0x9')],'defaultValue':![],'comment':_0x28dc('0xc'),'set':function(_0x4b8c4e){if(!_0x4b8c4e){this['setDataValue'](_0x28dc('0xd'),null);}this[_0x28dc('0xe')](_0x28dc('0xf'),_0x4b8c4e);}},'description':{'type':Sequelize[_0x28dc('0x4')]}}; \ No newline at end of file +var _0xb68e=['twilio','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0xb68e,0xb0));var _0xeb68=function(_0x3397cb,_0x9743cb){_0x3397cb=_0x3397cb-0x0;var _0x119eb1=_0xb68e[_0x3397cb];return _0x119eb1;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xeb68('0x0')]={'name':{'type':Sequelize[_0xeb68('0x1')],'unique':_0xeb68('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xeb68('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xeb68('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xeb68('0x1')],'defaultValue':function(){return rs[_0xeb68('0x3')]();}},'phone':{'type':Sequelize[_0xeb68('0x1')]},'type':{'type':Sequelize['ENUM'](_0xeb68('0x4'))},'accountSid':{'type':Sequelize[_0xeb68('0x1')]},'authToken':{'type':Sequelize[_0xeb68('0x1')]},'notificationTemplate':{'type':Sequelize[_0xeb68('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xeb68('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xeb68('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeb68('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeb68('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeb68('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeb68('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xeb68('0x6')],'defaultValue':![],'comment':_0xeb68('0x8'),'set':function(_0x18c16e){if(!_0x18c16e){this[_0xeb68('0x9')](_0xeb68('0xa'),null);}this[_0xeb68('0x9')](_0xeb68('0xb'),_0x18c16e);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 867cfe8..5378029 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 _0xd64b=['waitForTheAssignedAgent','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','test','ValidationError','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','status','json','count','offset','limit','apply','save','update','then','destroy','get','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','length','find','create','body','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','emit','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','getApplications','notify','whatsapp','Applications','account','applications','priority','asc','CmContact','difference','createdAt','updatedAt','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','from\x20is\x20mandatory','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','agent'];(function(_0x13d320,_0x65adc9){var _0x18111f=function(_0x5e7713){while(--_0x5e7713){_0x13d320['push'](_0x13d320['shift']());}};_0x18111f(++_0x65adc9);}(_0xd64b,0xc1));var _0xbd64=function(_0x398fbb,_0x43220d){_0x398fbb=_0x398fbb-0x0;var _0x132e5c=_0xd64b[_0x398fbb];return _0x132e5c;};'use strict';var pdf=require(_0xbd64('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd64('0x2'));var rp=require(_0xbd64('0x3'));var moment=require(_0xbd64('0x4'));var BPromise=require(_0xbd64('0x5'));var Mustache=require(_0xbd64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd64('0x7'));var fs=require('fs');var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var db=require(_0xbd64('0x15'))['db'];config['redis']=_[_0xbd64('0x16')](config[_0xbd64('0x17')],{'host':_0xbd64('0x18'),'port':0x18eb});var socket=require(_0xbd64('0x19'))(new Redis(config[_0xbd64('0x17')]));require(_0xbd64('0x1a'))[_0xbd64('0x1b')](socket);var jayson=require(_0xbd64('0x1c'));var client=jayson[_0xbd64('0x1d')]['http']({'port':0x232c});function checkPasswordPattern(_0x2d1159,_0x13e7a4,_0x3ff550){if(_0x3ff550){var _0x32fd34=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32fd34[_0xbd64('0x1e')](_0x13e7a4)){return _0x2d1159;}else{throw new db['Sequelize'][(_0xbd64('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 _0x2d1159;}}function respondWithRpcPromise(_0xccb0d5,_0x1432a6,_0x3aef70,_0x1d7a14){return new BPromise(function(_0x17d015,_0x2f4554){var _0xa5491d=_0x1d7a14||client;return _0xa5491d[_0xbd64('0x20')](_0xccb0d5,_0x3aef70)['then'](function(_0x305545){logger[_0xbd64('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x1432a6,'request\x20sent');logger[_0xbd64('0x22')](_0xbd64('0x23'),_0x1432a6,_0xbd64('0x24'),JSON[_0xbd64('0x25')](_0x305545));if(_0x305545[_0xbd64('0x26')]){if(_0x305545[_0xbd64('0x26')]['code']===0x1f4){logger['error'](_0xbd64('0x27'),_0x1432a6,_0x305545[_0xbd64('0x26')][_0xbd64('0x28')]);return _0x2f4554(_0x305545[_0xbd64('0x26')]['message']);}logger['error'](_0xbd64('0x27'),_0x1432a6,_0x305545['error'][_0xbd64('0x28')]);return _0x17d015(_0x305545['error'][_0xbd64('0x28')]);}else{logger[_0xbd64('0x21')](_0xbd64('0x27'),_0x1432a6,_0xbd64('0x24'));_0x17d015(_0x305545['result'][_0xbd64('0x28')]);}})[_0xbd64('0x29')](function(_0x13f527){logger[_0xbd64('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1432a6,_0x13f527);_0x2f4554(_0x13f527);});});}function respondWithStatusCode(_0x4e8719,_0x29c9c8){_0x29c9c8=_0x29c9c8||0xcc;return function(_0x49eac5){if(_0x49eac5){return _0x4e8719['sendStatus'](_0x29c9c8);}return _0x4e8719[_0xbd64('0x2a')](_0x29c9c8)['end']();};}function respondWithResult(_0x3cf5b7,_0x5300e8){_0x5300e8=_0x5300e8||0xc8;return function(_0x28199c){if(_0x28199c){return _0x3cf5b7['status'](_0x5300e8)[_0xbd64('0x2b')](_0x28199c);}};}function respondWithFilteredResult(_0x3c0eaf,_0x3be63a){return function(_0x210fff){if(_0x210fff){var _0x306f19=_0x210fff[_0xbd64('0x2c')],_0x207ffc=_0x3be63a[_0xbd64('0x2d')],_0x4ed44a=_0x3be63a[_0xbd64('0x2d')]+_0x3be63a[_0xbd64('0x2e')],_0x35bdd5;if(_0x4ed44a>=_0x306f19){_0x4ed44a=_0x306f19;_0x35bdd5=0xc8;}else{_0x35bdd5=0xce;}_0x3c0eaf[_0xbd64('0x2a')](_0x35bdd5);return _0x3c0eaf['set']('Content-Range',_0x207ffc+'-'+_0x4ed44a+'/'+_0x306f19)[_0xbd64('0x2b')](_0x210fff);}return null;};}function patchUpdates(_0x576604){return function(_0xebed78){try{jsonpatch[_0xbd64('0x2f')](_0xebed78,_0x576604,!![]);}catch(_0x54459f){return BPromise['reject'](_0x54459f);}return _0xebed78[_0xbd64('0x30')]();};}function saveUpdates(_0x4e1834,_0x5b6948){return function(_0x1867af){if(_0x1867af){return _0x1867af[_0xbd64('0x31')](_0x4e1834)[_0xbd64('0x32')](function(_0x50c58e){return _0x50c58e;});}return null;};}function removeEntity(_0x231c37,_0x569cb6){return function(_0x1fc9cf){if(_0x1fc9cf){return _0x1fc9cf[_0xbd64('0x33')]()[_0xbd64('0x32')](function(){var _0x243588=_0x1fc9cf[_0xbd64('0x34')]({'plain':!![]});var _0x429aec='WhatsappAccounts';return db['UserProfileResource'][_0xbd64('0x33')]({'where':{'type':_0x429aec,'resourceId':_0x243588['id']}})[_0xbd64('0x32')](function(){return _0x1fc9cf;});})[_0xbd64('0x32')](function(){_0x231c37[_0xbd64('0x2a')](0xcc)[_0xbd64('0x35')]();});}};}function handleEntityNotFound(_0x3b245e,_0x54784f){return function(_0x5a74a9){if(!_0x5a74a9){_0x3b245e[_0xbd64('0x36')](0x194);}return _0x5a74a9;};}function handleError(_0x1bcd4c,_0x21f518){_0x21f518=_0x21f518||0x1f4;return function(_0x4df52a){logger['error'](_0x4df52a[_0xbd64('0x37')]);if(_0x4df52a['name']){delete _0x4df52a[_0xbd64('0x38')];}_0x1bcd4c['status'](_0x21f518)[_0xbd64('0x39')](_0x4df52a);};}exports[_0xbd64('0x3a')]=function(_0x550221,_0x107da1){var _0x51ae42={'include':[{'model':db[_0xbd64('0x3b')],'as':_0xbd64('0x3c')}]},_0x534091={},_0x380f32={'count':0x0,'rows':[]};var _0x52f401=_['map'](db['WhatsappAccount'][_0xbd64('0x3d')],function(_0xbfd402){return{'name':_0xbfd402['fieldName'],'type':_0xbfd402[_0xbd64('0x3e')][_0xbd64('0x3f')]};});_0x534091[_0xbd64('0x40')]=_[_0xbd64('0x41')](_0x52f401,'name');_0x534091['query']=_[_0xbd64('0x42')](_0x550221['query']);_0x534091['filters']=_[_0xbd64('0x43')](_0x534091[_0xbd64('0x40')],_0x534091[_0xbd64('0x44')]);_0x51ae42[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x534091[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x550221[_0xbd64('0x44')]['fields']));_0x51ae42[_0xbd64('0x45')]=_0x51ae42[_0xbd64('0x45')]['length']?_0x51ae42[_0xbd64('0x45')]:_0x534091[_0xbd64('0x40')];if(!_0x550221[_0xbd64('0x44')][_0xbd64('0x47')](_0xbd64('0x48'))){_0x51ae42[_0xbd64('0x2e')]=qs[_0xbd64('0x2e')](_0x550221['query'][_0xbd64('0x2e')]);_0x51ae42['offset']=qs[_0xbd64('0x2d')](_0x550221['query'][_0xbd64('0x2d')]);}_0x51ae42[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x550221['query'][_0xbd64('0x4a')]);_0x51ae42['where']=qs['filters'](_['pick'](_0x550221[_0xbd64('0x44')],_0x534091[_0xbd64('0x4b')]),_0x52f401);if(_0x550221[_0xbd64('0x44')][_0xbd64('0x4c')]){_0x51ae42[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x51ae42[_0xbd64('0x4d')],{'$or':_['map'](_0x52f401,function(_0x59ac2d){if(_0x59ac2d[_0xbd64('0x3e')]!==_0xbd64('0x4f')){var _0x4e5efe={};_0x4e5efe[_0x59ac2d[_0xbd64('0x38')]]={'$like':'%'+_0x550221[_0xbd64('0x44')][_0xbd64('0x4c')]+'%'};return _0x4e5efe;}})});}_0x51ae42=_[_0xbd64('0x4e')]({},_0x51ae42,_0x550221[_0xbd64('0x50')]);var _0x5a6b5e={'where':_0x51ae42[_0xbd64('0x4d')]};return db[_0xbd64('0x51')][_0xbd64('0x2c')](_0x5a6b5e)[_0xbd64('0x32')](function(_0x485cd1){_0x380f32['count']=_0x485cd1;if(_0x550221[_0xbd64('0x44')][_0xbd64('0x52')]){_0x51ae42[_0xbd64('0x53')]=[{'all':!![]}];}return db[_0xbd64('0x51')][_0xbd64('0x54')](_0x51ae42);})[_0xbd64('0x32')](function(_0x49cd2f){_0x380f32[_0xbd64('0x55')]=_0x49cd2f;return _0x380f32;})[_0xbd64('0x32')](respondWithFilteredResult(_0x107da1,_0x51ae42))[_0xbd64('0x29')](handleError(_0x107da1,null));};exports[_0xbd64('0x56')]=function(_0x3027bb,_0x3f81d8){var _0x152816={'raw':![],'where':{'id':_0x3027bb['params']['id']},'include':[{'model':db[_0xbd64('0x3b')],'as':'mandatoryDispositionPause'}]},_0x5dd6b6={};_0x5dd6b6['model']=_['keys'](db['WhatsappAccount'][_0xbd64('0x3d')]);_0x5dd6b6[_0xbd64('0x44')]=_['keys'](_0x3027bb[_0xbd64('0x44')]);_0x5dd6b6[_0xbd64('0x4b')]=_[_0xbd64('0x43')](_0x5dd6b6['model'],_0x5dd6b6[_0xbd64('0x44')]);_0x152816[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x5dd6b6[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x3027bb[_0xbd64('0x44')]['fields']));_0x152816['attributes']=_0x152816['attributes'][_0xbd64('0x57')]?_0x152816[_0xbd64('0x45')]:_0x5dd6b6[_0xbd64('0x40')];if(_0x3027bb[_0xbd64('0x44')]['includeAll']){_0x152816[_0xbd64('0x53')]=[{'all':!![]}];}_0x152816=_[_0xbd64('0x4e')]({},_0x152816,_0x3027bb[_0xbd64('0x50')]);return db[_0xbd64('0x51')][_0xbd64('0x58')](_0x152816)[_0xbd64('0x32')](handleEntityNotFound(_0x3f81d8,null))['then'](respondWithResult(_0x3f81d8,null))[_0xbd64('0x29')](handleError(_0x3f81d8,null));};exports[_0xbd64('0x59')]=function(_0x15f1fc,_0x1fe3e5){return db[_0xbd64('0x51')][_0xbd64('0x59')](_0x15f1fc[_0xbd64('0x5a')],{})[_0xbd64('0x32')](function(_0x430566){var _0x1e8e1c=_0x15f1fc[_0xbd64('0x5b')][_0xbd64('0x34')]({'plain':!![]});if(!_0x1e8e1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e8e1c['role']===_0xbd64('0x5b')){var _0x2bcf68=_0x430566['get']({'plain':!![]});var _0x550f5f=_0xbd64('0x5c');return db[_0xbd64('0x5d')]['find']({'where':{'name':_0x550f5f,'userProfileId':_0x1e8e1c[_0xbd64('0x5e')]},'raw':!![]})[_0xbd64('0x32')](function(_0x45573c){if(_0x45573c&&_0x45573c[_0xbd64('0x5f')]===0x0){return db[_0xbd64('0x60')][_0xbd64('0x59')]({'name':_0x2bcf68[_0xbd64('0x38')],'resourceId':_0x2bcf68['id'],'type':_0x45573c[_0xbd64('0x38')],'sectionId':_0x45573c['id']},{})[_0xbd64('0x32')](function(){return _0x430566;});}else{return _0x430566;}})['catch'](function(_0x358ba8){logger[_0xbd64('0x26')](_0xbd64('0x61'),_0x358ba8);throw _0x358ba8;});}return _0x430566;})['then'](respondWithResult(_0x1fe3e5,0xc9))[_0xbd64('0x29')](handleError(_0x1fe3e5,null));};exports[_0xbd64('0x31')]=function(_0x4aa83e,_0x4423d9){if(_0x4aa83e[_0xbd64('0x5a')]['id']){delete _0x4aa83e[_0xbd64('0x5a')]['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x4aa83e[_0xbd64('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0xbd64('0x3c')}]})[_0xbd64('0x32')](handleEntityNotFound(_0x4423d9,null))[_0xbd64('0x32')](saveUpdates(_0x4aa83e[_0xbd64('0x5a')],null))['then'](respondWithResult(_0x4423d9,null))[_0xbd64('0x29')](handleError(_0x4423d9,null));};exports[_0xbd64('0x33')]=function(_0x502d84,_0x78d88){return db['WhatsappAccount'][_0xbd64('0x58')]({'where':{'id':_0x502d84[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x78d88,null))[_0xbd64('0x32')](removeEntity(_0x78d88,null))['catch'](handleError(_0x78d88,null));};exports[_0xbd64('0x63')]=function(_0x54a3b1,_0x30bdef){return db[_0xbd64('0x51')][_0xbd64('0x63')]()[_0xbd64('0x32')](respondWithResult(_0x30bdef,null))['catch'](handleError(_0x30bdef,null));};exports['addDisposition']=function(_0x5616bc,_0x36f3a8,_0xd1b21f){if(_0x5616bc[_0xbd64('0x5a')]['id']){delete _0x5616bc[_0xbd64('0x5a')]['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x5616bc['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x36f3a8,null))[_0xbd64('0x32')](function(_0x305ffc){if(_0x305ffc){_0x5616bc[_0xbd64('0x5a')][_0xbd64('0x64')]=_0x305ffc['id'];return db[_0xbd64('0x65')][_0xbd64('0x59')](_0x5616bc[_0xbd64('0x5a')]);}})[_0xbd64('0x32')](respondWithResult(_0x36f3a8,null))[_0xbd64('0x29')](handleError(_0x36f3a8,null));};exports[_0xbd64('0x66')]=function(_0x582c85,_0x48f1a5,_0x5f16fd){var _0x7e5c1c={'raw':![],'where':{}};var _0x363da8={};var _0x2ec631={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbd64('0x67')]({'where':{'id':_0x582c85['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x48f1a5,null))[_0xbd64('0x32')](function(_0x1c2930){if(_0x1c2930){_0x363da8[_0xbd64('0x40')]=_['keys'](db[_0xbd64('0x65')]['rawAttributes']);_0x363da8[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x582c85[_0xbd64('0x44')]);_0x363da8[_0xbd64('0x4b')]=_[_0xbd64('0x43')](_0x363da8['model'],_0x363da8[_0xbd64('0x44')]);_0x7e5c1c[_0xbd64('0x45')]=_['intersection'](_0x363da8[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x582c85[_0xbd64('0x44')][_0xbd64('0x46')]));_0x7e5c1c['attributes']=_0x7e5c1c[_0xbd64('0x45')]['length']?_0x7e5c1c[_0xbd64('0x45')]:_0x363da8[_0xbd64('0x40')];if(!_0x582c85[_0xbd64('0x44')]['hasOwnProperty']('nolimit')){_0x7e5c1c['limit']=qs['limit'](_0x582c85[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x7e5c1c[_0xbd64('0x2d')]=qs[_0xbd64('0x2d')](_0x582c85[_0xbd64('0x44')]['offset']);}_0x7e5c1c[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x582c85[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x7e5c1c[_0xbd64('0x4d')]=qs['filters'](_[_0xbd64('0x68')](_0x582c85[_0xbd64('0x44')],_0x363da8[_0xbd64('0x4b')]));_0x7e5c1c[_0xbd64('0x4d')]['WhatsappAccountId']=_0x1c2930['id'];if(_0x582c85['query'][_0xbd64('0x4c')]){_0x7e5c1c[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x7e5c1c[_0xbd64('0x4d')],{'$or':_[_0xbd64('0x41')](_0x7e5c1c[_0xbd64('0x45')],function(_0x86124){var _0x344285={};_0x344285[_0x86124]={'$like':'%'+_0x582c85['query'][_0xbd64('0x4c')]+'%'};return _0x344285;})});}_0x7e5c1c=_['merge']({},_0x7e5c1c,_0x582c85[_0xbd64('0x50')]);return db[_0xbd64('0x65')][_0xbd64('0x2c')]({'where':_0x7e5c1c['where']})[_0xbd64('0x32')](function(_0x5c30f9){_0x2ec631['count']=_0x5c30f9;if(_0x582c85[_0xbd64('0x44')][_0xbd64('0x52')]){_0x7e5c1c[_0xbd64('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xbd64('0x54')](_0x7e5c1c);})[_0xbd64('0x32')](function(_0x8150bb){_0x2ec631[_0xbd64('0x55')]=_0x8150bb;return _0x2ec631;});}})['then'](respondWithFilteredResult(_0x48f1a5,_0x7e5c1c))[_0xbd64('0x29')](handleError(_0x48f1a5,null));};exports[_0xbd64('0x69')]=function(_0x355b87,_0x1964f9,_0x339e52){return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x355b87[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x1964f9,null))[_0xbd64('0x32')](function(_0x3f49f3){if(_0x3f49f3){return _0x3f49f3[_0xbd64('0x69')](_0x355b87[_0xbd64('0x44')][_0xbd64('0x6a')]);}})['then'](respondWithStatusCode(_0x1964f9,null))['catch'](handleError(_0x1964f9,null));};exports[_0xbd64('0x6b')]=function(_0x322093,_0x155b41,_0x586056){if(_0x322093[_0xbd64('0x5a')]['id']){delete _0x322093['body']['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x322093[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x155b41,null))['then'](function(_0x44ecf9){if(_0x44ecf9){_0x322093[_0xbd64('0x5a')]['WhatsappAccountId']=_0x44ecf9['id'];return db[_0xbd64('0x6c')]['create'](_0x322093[_0xbd64('0x5a')]);}})[_0xbd64('0x32')](respondWithResult(_0x155b41,null))[_0xbd64('0x29')](handleError(_0x155b41,null));};exports[_0xbd64('0x6d')]=function(_0x30b3a1,_0x38b974,_0x53717e){var _0x4190a3={'raw':![],'where':{}};var _0x588452={};var _0x366672={'count':0x0,'rows':[]};return db[_0xbd64('0x51')]['findOne']({'where':{'id':_0x30b3a1[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x38b974,null))[_0xbd64('0x32')](function(_0x2ac722){if(_0x2ac722){_0x588452[_0xbd64('0x40')]=_['keys'](db[_0xbd64('0x6c')][_0xbd64('0x3d')]);_0x588452[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x30b3a1[_0xbd64('0x44')]);_0x588452['filters']=_['intersection'](_0x588452[_0xbd64('0x40')],_0x588452[_0xbd64('0x44')]);_0x4190a3[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x588452[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x46')]));_0x4190a3[_0xbd64('0x45')]=_0x4190a3[_0xbd64('0x45')][_0xbd64('0x57')]?_0x4190a3[_0xbd64('0x45')]:_0x588452[_0xbd64('0x40')];if(!_0x30b3a1['query'][_0xbd64('0x47')](_0xbd64('0x48'))){_0x4190a3['limit']=qs[_0xbd64('0x2e')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x4190a3[_0xbd64('0x2d')]=qs['offset'](_0x30b3a1['query'][_0xbd64('0x2d')]);}_0x4190a3[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x4190a3[_0xbd64('0x4d')]=qs[_0xbd64('0x4b')](_[_0xbd64('0x68')](_0x30b3a1[_0xbd64('0x44')],_0x588452[_0xbd64('0x4b')]));_0x4190a3[_0xbd64('0x4d')][_0xbd64('0x64')]=_0x2ac722['id'];if(_0x30b3a1['query'][_0xbd64('0x4c')]){_0x4190a3[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x4190a3['where'],{'$or':_['map'](_0x4190a3[_0xbd64('0x45')],function(_0x2dbbd4){var _0x5d9b13={};_0x5d9b13[_0x2dbbd4]={'$like':'%'+_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x4c')]+'%'};return _0x5d9b13;})});}_0x4190a3=_[_0xbd64('0x4e')]({},_0x4190a3,_0x30b3a1[_0xbd64('0x50')]);return db[_0xbd64('0x6c')][_0xbd64('0x2c')]({'where':_0x4190a3[_0xbd64('0x4d')]})[_0xbd64('0x32')](function(_0x2686fe){_0x366672[_0xbd64('0x2c')]=_0x2686fe;if(_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x52')]){_0x4190a3['include']=[{'all':!![]}];}return db[_0xbd64('0x6c')]['findAll'](_0x4190a3);})[_0xbd64('0x32')](function(_0x25d8d8){_0x366672[_0xbd64('0x55')]=_0x25d8d8;return _0x366672;});}})[_0xbd64('0x32')](respondWithFilteredResult(_0x38b974,_0x4190a3))[_0xbd64('0x29')](handleError(_0x38b974,null));};exports['removeAnswers']=function(_0x219149,_0x357ac2,_0x72185e){return db[_0xbd64('0x51')]['find']({'where':{'id':_0x219149[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x357ac2,null))[_0xbd64('0x32')](function(_0x993847){if(_0x993847){return _0x993847[_0xbd64('0x6e')](_0x219149[_0xbd64('0x44')][_0xbd64('0x6a')]);}})[_0xbd64('0x32')](respondWithStatusCode(_0x357ac2,null))[_0xbd64('0x29')](handleError(_0x357ac2,null));};exports['addAgents']=function(_0x2824dc,_0x2c640e,_0x33cfc8){return db[_0xbd64('0x51')]['find']({'where':{'id':_0x2824dc[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x2c640e,null))[_0xbd64('0x32')](function(_0x19a780){if(_0x19a780){return _0x19a780[_0xbd64('0x6f')](_0x2824dc[_0xbd64('0x5a')][_0xbd64('0x6a')],_['omit'](_0x2824dc[_0xbd64('0x5a')],['ids','id'])||{})[_0xbd64('0x70')](function(_0x59cc30){for(var _0x4a7220=0x0;_0x4a7220<_0x2824dc[_0xbd64('0x5a')][_0xbd64('0x6a')][_0xbd64('0x57')];_0x4a7220+=0x1){socket['emit'](_0xbd64('0x71'),{'UserId':_0x2824dc['body'][_0xbd64('0x6a')][_0x4a7220],'WhatsappAccountId':_0x2824dc['params']['id']});}return _0x59cc30;});}})['then'](respondWithResult(_0x2c640e,null))[_0xbd64('0x29')](handleError(_0x2c640e,null));};exports[_0xbd64('0x72')]=function(_0x30a8b4,_0x310ee4,_0x34c941){return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x30a8b4[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x310ee4,null))['then'](function(_0xd7e9dd){if(_0xd7e9dd){return _0xd7e9dd['removeAgents'](_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')])[_0xbd64('0x32')](function(){if(_['isArray'](_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')])){for(var _0x5f4e47=0x0;_0x5f4e47<_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')]['length'];_0x5f4e47+=0x1){socket['emit'](_0xbd64('0x73'),{'UserId':Number(_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')][_0x5f4e47]),'WhatsappAccountId':Number(_0x30a8b4[_0xbd64('0x62')]['id'])});}}else{socket[_0xbd64('0x74')](_0xbd64('0x73'),{'UserId':Number(_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')]),'WhatsappAccountId':Number(_0x30a8b4[_0xbd64('0x62')]['id'])});}});}})[_0xbd64('0x32')](respondWithStatusCode(_0x310ee4,null))[_0xbd64('0x29')](handleError(_0x310ee4,null));};exports[_0xbd64('0x75')]=function(_0x1f630b,_0x2d1f0c,_0x2419b7){var _0x5568cd={};var _0x2a6b2f={};var _0x4dda62;var _0x2a59da;return db[_0xbd64('0x51')]['findOne']({'where':{'id':_0x1f630b[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x2d1f0c,null))[_0xbd64('0x32')](function(_0x1fb323){if(_0x1fb323){_0x4dda62=_0x1fb323;_0x2a6b2f[_0xbd64('0x40')]=_[_0xbd64('0x42')](db['User'][_0xbd64('0x3d')]);_0x2a6b2f[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x1f630b[_0xbd64('0x44')]);_0x2a6b2f['filters']=_['intersection'](_0x2a6b2f[_0xbd64('0x40')],_0x2a6b2f[_0xbd64('0x44')]);_0x5568cd[_0xbd64('0x45')]=_['intersection'](_0x2a6b2f[_0xbd64('0x40')],qs['fields'](_0x1f630b[_0xbd64('0x44')][_0xbd64('0x46')]));_0x5568cd[_0xbd64('0x45')]=_0x5568cd[_0xbd64('0x45')][_0xbd64('0x57')]?_0x5568cd['attributes']:_0x2a6b2f['model'];_0x5568cd[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x1f630b[_0xbd64('0x44')]['sort']);_0x5568cd[_0xbd64('0x4d')]=qs['filters'](_[_0xbd64('0x68')](_0x1f630b[_0xbd64('0x44')],_0x2a6b2f[_0xbd64('0x4b')]));if(_0x1f630b['query'][_0xbd64('0x4c')]){_0x5568cd[_0xbd64('0x4d')]=_['merge'](_0x5568cd['where'],{'$or':_[_0xbd64('0x41')](_0x5568cd['attributes'],function(_0x4d1a95){var _0x1442ee={};_0x1442ee[_0x4d1a95]={'$like':'%'+_0x1f630b[_0xbd64('0x44')]['filter']+'%'};return _0x1442ee;})});}_0x5568cd=_[_0xbd64('0x4e')]({},_0x5568cd,_0x1f630b['options']);return _0x4dda62[_0xbd64('0x75')](_0x5568cd);}})[_0xbd64('0x32')](function(_0x38795c){if(_0x38795c){_0x2a59da=_0x38795c['length'];if(!_0x1f630b[_0xbd64('0x44')]['hasOwnProperty']('nolimit')){_0x5568cd['limit']=qs[_0xbd64('0x2e')](_0x1f630b[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x5568cd['offset']=qs[_0xbd64('0x2d')](_0x1f630b['query'][_0xbd64('0x2d')]);}return _0x4dda62['getAgents'](_0x5568cd);}})['then'](function(_0x5415ed){if(_0x5415ed){return _0x5415ed?{'count':_0x2a59da,'rows':_0x5415ed}:null;}})[_0xbd64('0x32')](respondWithResult(_0x2d1f0c,null))[_0xbd64('0x29')](handleError(_0x2d1f0c,null));};exports[_0xbd64('0x76')]=function(_0x2ccf8d,_0x4d6781,_0x4094b8){return db[_0xbd64('0x51')][_0xbd64('0x67')]({'where':{'id':_0x2ccf8d['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x4d6781,null))['then'](function(_0x142436){if(_0x142436){return db[_0xbd64('0x77')][_0xbd64('0x78')](function(_0x27ae4b){return db[_0xbd64('0x79')][_0xbd64('0x33')]({'where':{'WhatsappAccountId':_0x2ccf8d[_0xbd64('0x62')]['id']},'transaction':_0x27ae4b})[_0xbd64('0x32')](function(_0x3bc73d){var _0x871906=_[_0xbd64('0x41')](_0x2ccf8d[_0xbd64('0x5a')],function(_0x103561){_0x103561['WhatsappAccountId']=_0x2ccf8d['params']['id'];return _0x103561;});return db[_0xbd64('0x79')][_0xbd64('0x7a')](_0x871906,{'transaction':_0x27ae4b});});})[_0xbd64('0x32')](function(){return db[_0xbd64('0x79')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2ccf8d[_0xbd64('0x62')]['id']},'order':'priority'});});}})[_0xbd64('0x32')](respondWithResult(_0x4d6781,null))['catch'](handleError(_0x4d6781,null));};exports['getApplications']=function(_0x421cd3,_0x762409,_0x58c849){var _0x2058c5={};var _0x494908={};var _0x40ff49;var _0x592e2c;return db[_0xbd64('0x51')][_0xbd64('0x67')]({'where':{'id':_0x421cd3[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x762409,null))[_0xbd64('0x32')](function(_0x287a9a){if(_0x287a9a){_0x40ff49=_0x287a9a;_0x494908[_0xbd64('0x40')]=_[_0xbd64('0x42')](db[_0xbd64('0x79')][_0xbd64('0x3d')]);_0x494908[_0xbd64('0x44')]=_['keys'](_0x421cd3[_0xbd64('0x44')]);_0x494908[_0xbd64('0x4b')]=_['intersection'](_0x494908['model'],_0x494908['query']);_0x2058c5[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x494908[_0xbd64('0x40')],qs['fields'](_0x421cd3[_0xbd64('0x44')]['fields']));_0x2058c5[_0xbd64('0x45')]=_0x2058c5['attributes'][_0xbd64('0x57')]?_0x2058c5[_0xbd64('0x45')]:_0x494908[_0xbd64('0x40')];_0x2058c5[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x421cd3[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x2058c5[_0xbd64('0x4d')]=qs[_0xbd64('0x4b')](_[_0xbd64('0x68')](_0x421cd3[_0xbd64('0x44')],_0x494908['filters']));if(_0x421cd3[_0xbd64('0x44')][_0xbd64('0x4c')]){_0x2058c5[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x2058c5[_0xbd64('0x4d')],{'$or':_[_0xbd64('0x41')](_0x2058c5[_0xbd64('0x45')],function(_0x27eb30){var _0x2f97b5={};_0x2f97b5[_0x27eb30]={'$like':'%'+_0x421cd3['query']['filter']+'%'};return _0x2f97b5;})});}_0x2058c5=_[_0xbd64('0x4e')]({},_0x2058c5,_0x421cd3[_0xbd64('0x50')]);return _0x40ff49['getApplications'](_0x2058c5);}})[_0xbd64('0x32')](function(_0x2b78b4){if(_0x2b78b4){_0x592e2c=_0x2b78b4['length'];if(!_0x421cd3[_0xbd64('0x44')]['hasOwnProperty'](_0xbd64('0x48'))){_0x2058c5[_0xbd64('0x2e')]=qs[_0xbd64('0x2e')](_0x421cd3[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x2058c5['offset']=qs['offset'](_0x421cd3['query']['offset']);}return _0x40ff49[_0xbd64('0x7b')](_0x2058c5);}})['then'](function(_0x3cf54a){if(_0x3cf54a){return _0x3cf54a?{'count':_0x592e2c,'rows':_0x3cf54a}:null;}})['then'](respondWithResult(_0x762409,null))['catch'](handleError(_0x762409,null));};exports[_0xbd64('0x7c')]=function(_0x1bcc1c,_0x45cbb6,_0x302596){var _0x24f5c0={'channel':_0xbd64('0x7d')};var _0x13fae5=[];var _0xf95ff=[];var _0x14bb25={};return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x1bcc1c[_0xbd64('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xbd64('0x7e')}]})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))[_0xbd64('0x32')](function(_0x3d2e6a){_0x24f5c0[_0xbd64('0x7f')]=_0x3d2e6a;_0x24f5c0[_0xbd64('0x80')]=_['orderBy'](_0x3d2e6a[_0xbd64('0x7e')],[_0xbd64('0x81')],[_0xbd64('0x82')]);if(_0x24f5c0[_0xbd64('0x7f')]['Applications']){delete _0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x7e')];}return db[_0xbd64('0x83')][_0xbd64('0x63')]();})['then'](function(_0x3ac365){if(!_0x3ac365){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x13fae5=_[_0xbd64('0x84')](_[_0xbd64('0x42')](_0x3ac365),['createdAt','updatedAt']);_0xf95ff=_[_0xbd64('0x84')](_[_0xbd64('0x42')](_0x3ac365),[_0xbd64('0x85'),_0xbd64('0x86'),'CompanyId','ListId']);_0x24f5c0[_0xbd64('0x5a')]={'mapKey':'mobile'};if(_0x24f5c0[_0xbd64('0x7f')]['type']&&_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x3e')]===_0xbd64('0x87')){_0x24f5c0[_0xbd64('0x5a')]['from']=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x88')][_0xbd64('0x89')](_0xbd64('0x8a'),'');_0x24f5c0['body'][_0xbd64('0x5a')]=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x8b')];_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8c')]=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x8d')];}if(_0x24f5c0[_0xbd64('0x5a')]['id']){delete _0x24f5c0[_0xbd64('0x5a')]['id'];}if(_['isNil'](_0x24f5c0['body'][_0xbd64('0x8e')])){throw new db['Sequelize'][(_0xbd64('0x1f'))](_0xbd64('0x8f'));}if(_[_0xbd64('0x90')](_0x24f5c0['body']['body'])||_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x5a')]===''){throw new db[(_0xbd64('0x91'))][(_0xbd64('0x1f'))](_0xbd64('0x92'));}if(_[_0xbd64('0x90')](_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x93')])){throw new db[(_0xbd64('0x91'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf95ff);}if(!_[_0xbd64('0x94')](_0xf95ff,_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x93')])){throw new db[(_0xbd64('0x91'))]['ValidationError'](_0xbd64('0x95')+_0xf95ff);}_0x14bb25[_0x24f5c0['body'][_0xbd64('0x93')]]=_0x24f5c0['body'][_0xbd64('0x8e')];return db['CmList'][_0xbd64('0x58')]({'where':{'id':_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x96')]},'include':[{'model':db[_0xbd64('0x83')],'as':_0xbd64('0x97'),'where':_0x14bb25,'limit':0x1,'order':[[_0xbd64('0x86'),'DESC']]}]});})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))['then'](function(_0x2b3440){if(_0x2b3440){_0x24f5c0['list']=_['omit'](_0x2b3440,[_0xbd64('0x97')]);if(_0x2b3440[_0xbd64('0x97')][_0xbd64('0x57')]){return _0x2b3440['Contacts'][0x0];}var _0x4680fb=_[_0xbd64('0x16')](_0x24f5c0[_0xbd64('0x5a')],{'firstName':_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8e')],'ListId':_0x2b3440['id']});_0x4680fb[_0x24f5c0['body'][_0xbd64('0x93')]]=_0x24f5c0['body']['from'];return db[_0xbd64('0x83')][_0xbd64('0x59')](_0x4680fb,{'fields':_0x13fae5,'raw':!![]});}})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))[_0xbd64('0x32')](function(_0x291a3e){if(_0x291a3e){_0x24f5c0[_0xbd64('0x98')]=_0x291a3e;var _0x18acee={'ContactId':_0x291a3e['id'],'phone':_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8e')],'WhatsappAccountId':_0x1bcc1c[_0xbd64('0x62')]['id']};var _0x46e995={'ContactId':_0x291a3e['id'],'WhatsappAccountId':_0x1bcc1c['params']['id'],'closed':![]};return db[_0xbd64('0x99')][_0xbd64('0x58')]({'where':_0x46e995})[_0xbd64('0x32')](function(_0xeca842){if(_0xeca842){return[_0xeca842,![]];}return db['WhatsappInteraction'][_0xbd64('0x59')](_0x18acee)[_0xbd64('0x32')](function(_0x4a6ea9){return[_0x4a6ea9,!![]];});});}})['spread'](function(_0x34e543,_0x19ccdb){_0x24f5c0[_0xbd64('0x9a')]=_0x34e543[_0xbd64('0x34')]({'plain':!![]});_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0x9b')]=![];if(_0x19ccdb){if(_0x24f5c0['account'][_0xbd64('0x9c')]){_0x24f5c0[_0xbd64('0x80')][_0xbd64('0x9d')]({'id':0x0,'priority':_0x24f5c0[_0xbd64('0x80')]['length']+0x1,'app':_0xbd64('0x9e'),'appdata':'unmanaged','interval':_0xbd64('0x9f')});}_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0x9b')]=!![];}return db[_0xbd64('0xa0')]['create']({'phone':_0x24f5c0[_0xbd64('0x5a')]['from'],'messageId':_0x24f5c0[_0xbd64('0x5a')]['messageId'],'body':_0x24f5c0[_0xbd64('0x5a')]['body'],'WhatsappAccountId':_0x1bcc1c[_0xbd64('0x62')]['id'],'WhatsappInteractionId':_0x34e543['id'],'direction':'in','ContactId':_0x34e543[_0xbd64('0xa1')],'AttachmentId':_0x24f5c0['body'][_0xbd64('0xa2')]});})[_0xbd64('0x32')](function(_0x530305){_0x24f5c0[_0xbd64('0x28')]=_0x530305;if(_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0xa3')]){return db['User'][_0xbd64('0x58')]({'attributes':['id',_0xbd64('0x38')],'where':{'id':_0x24f5c0[_0xbd64('0x9a')]['UserId']}})[_0xbd64('0x32')](function(_0x46f980){if(_0x46f980){_0x24f5c0['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xbd64('0xa4'),'appdata':_0x46f980['name']+','+(_0x24f5c0['account'][_0xbd64('0xa5')]||0xa),'interval':_0xbd64('0x9f')});}return respondWithRpcPromise(_0xbd64('0xa6'),'startRouting',_0x24f5c0);});}return respondWithRpcPromise(_0xbd64('0xa6'),'startRouting',_0x24f5c0);})[_0xbd64('0x32')](function(_0x4f6ace){if(_0x4f6ace){var _0x45f692=0xc8;var _0x1a899a='receiveMessage';logger[_0xbd64('0x21')](_0xbd64('0x23'),_0x1a899a,_0x45f692,_0xbd64('0xa7'));logger[_0xbd64('0x22')](_0xbd64('0xa8'),_0x1a899a,_0x45f692,_0xbd64('0xa7'),JSON['stringify'](_0x4f6ace));if(_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x3e')]===_0xbd64('0x87')){return _0x45cbb6[_0xbd64('0x2a')](_0x45f692)[_0xbd64('0xa9')](_0xbd64('0xaa'),'text/xml')['send'](_0xbd64('0xab'));}else{return _0x45cbb6[_0xbd64('0x2a')](_0x45f692)[_0xbd64('0x2b')](_0x4f6ace);}}})['catch'](handleError(_0x45cbb6,null));};exports[_0xbd64('0x39')]=function(_0x2ab4d7,_0x3067fa,_0x3a35ad){var _0xa573d0,_0x46c4a4,_0x5a0256;if(_['isNil'](_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')])||_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd64('0x90')](_0x2ab4d7['body']['to'])){throw new db[(_0xbd64('0x91'))][(_0xbd64('0x1f'))](_0xbd64('0xac'));}_0xa573d0=_0x2ab4d7['body']['to'];return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x2ab4d7[_0xbd64('0x62')]['id']},'include':[{'model':db[_0xbd64('0xad')],'as':_0xbd64('0xae'),'include':[{'model':db[_0xbd64('0x83')],'as':_0xbd64('0x97'),'where':{'mobile':_0xa573d0},'limit':0x1,'order':[[_0xbd64('0x86'),_0xbd64('0xaf')]]}]}]})[_0xbd64('0x32')](handleEntityNotFound(_0x3067fa,null))[_0xbd64('0x32')](function(_0x3dc17f){if(_0x3dc17f&&_0x3dc17f[_0xbd64('0xae')]){_0x46c4a4=_0x3dc17f['get']({'plain':!![]});if(_0x46c4a4[_0xbd64('0xae')]&&_0x46c4a4['List'][_0xbd64('0x97')][_0xbd64('0x57')]){return _0x46c4a4[_0xbd64('0xae')][_0xbd64('0x97')][0x0];}return db[_0xbd64('0x83')][_0xbd64('0x59')](_['defaults'](_0x2ab4d7['body'],{'firstName':_0xa573d0,'mobile':_0xa573d0,'phone':_0xa573d0,'ListId':_0x46c4a4['ListId']}));}})['then'](handleEntityNotFound(_0x3067fa,null))[_0xbd64('0x32')](function(_0x82132a){if(_0x82132a){_0x5a0256=_0x82132a;return db[_0xbd64('0x99')][_0xbd64('0x58')]({'where':{'ContactId':_0x5a0256['id'],'closed':![],'WhatsappAccountId':_0x46c4a4['id']}})[_0xbd64('0x32')](function(_0x35d11f){if(_0x35d11f){return[_0x35d11f,![]];}return db[_0xbd64('0x99')][_0xbd64('0x59')]({'UserId':_0x2ab4d7['user']['id'],'ContactId':_0x5a0256['id'],'WhatsappAccountId':_0x46c4a4['id'],'phone':_0xa573d0,'firstMsgDirection':_0xbd64('0xb0'),'Messages':[_[_0xbd64('0x4e')](_0x2ab4d7['body'],{'read':![],'body':_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')],'phone':_0xa573d0,'WhatsappAccountId':_0x46c4a4['id'],'UserId':_0x2ab4d7[_0xbd64('0x5b')]['id'],'ContactId':_0x5a0256['id']})]},{'include':[{'model':db[_0xbd64('0xa0')],'as':_0xbd64('0xb1')}]})[_0xbd64('0x32')](function(_0x1981f6){return[_0x1981f6,!![]];});});}})[_0xbd64('0x70')](function(_0x2635a9,_0x42ef5f){if(_0x42ef5f){return _0x2635a9;}return db[_0xbd64('0xa0')]['create'](_[_0xbd64('0x4e')](_0x2ab4d7[_0xbd64('0x5a')],{'read':![],'body':_0x2ab4d7[_0xbd64('0x5a')]['body'],'phone':_0xa573d0,'WhatsappAccountId':_0x46c4a4['id'],'WhatsappInteractionId':_0x2635a9['id'],'UserId':_0x2ab4d7[_0xbd64('0x5b')]['id'],'ContactId':_0x5a0256['id']}))['then'](function(_0x35505f){_0x2635a9[_0xbd64('0xb2')][_0xbd64('0xb1')]=[];_0x2635a9['dataValues']['Messages'][_0xbd64('0x9d')](_0x35505f[_0xbd64('0xb2')]);return _0x2635a9;});})['then'](respondWithResult(_0x3067fa,null))[_0xbd64('0x29')](handleError(_0x3067fa,null));}; \ No newline at end of file +var _0xdb94=['path','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','defaults','socket.io-emitter','redis','register','jayson/promise','client','http','Sequelize','ValidationError','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','save','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x59fd28,_0x52e204){var _0x1136c9=function(_0x552d98){while(--_0x552d98){_0x59fd28['push'](_0x59fd28['shift']());}};_0x1136c9(++_0x52e204);}(_0xdb94,0xab));var _0x4db9=function(_0x4323c6,_0x2dbf03){_0x4323c6=_0x4323c6-0x0;var _0x2a7740=_0xdb94[_0x4323c6];return _0x2a7740;};'use strict';var pdf=require(_0x4db9('0x0'));var emlformat=require(_0x4db9('0x1'));var rimraf=require(_0x4db9('0x2'));var zipdir=require(_0x4db9('0x3'));var jsonpatch=require(_0x4db9('0x4'));var rp=require('request-promise');var moment=require(_0x4db9('0x5'));var BPromise=require(_0x4db9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4db9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4db9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4db9('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4db9('0x18'))(new Redis(config[_0x4db9('0x19')]));require('./whatsappAccount.socket')[_0x4db9('0x1a')](socket);var jayson=require(_0x4db9('0x1b'));var client=jayson[_0x4db9('0x1c')][_0x4db9('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x51d024,_0x5e04ab,_0x102274){if(_0x102274){var _0x34de1a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34de1a['test'](_0x5e04ab)){return _0x51d024;}else{throw new db[(_0x4db9('0x1e'))][(_0x4db9('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 _0x51d024;}}function respondWithRpcPromise(_0x5a85c4,_0x250a80,_0x143b88,_0x462af3){return new BPromise(function(_0xa693c4,_0x1d3c33){var _0x55494a=_0x462af3||client;return _0x55494a[_0x4db9('0x20')](_0x5a85c4,_0x143b88)[_0x4db9('0x21')](function(_0x11012e){logger['info'](_0x4db9('0x22'),_0x250a80,_0x4db9('0x23'));logger[_0x4db9('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x250a80,_0x4db9('0x23'),JSON[_0x4db9('0x25')](_0x11012e));if(_0x11012e[_0x4db9('0x26')]){if(_0x11012e[_0x4db9('0x26')][_0x4db9('0x27')]===0x1f4){logger[_0x4db9('0x26')](_0x4db9('0x22'),_0x250a80,_0x11012e['error'][_0x4db9('0x28')]);return _0x1d3c33(_0x11012e[_0x4db9('0x26')][_0x4db9('0x28')]);}logger[_0x4db9('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x250a80,_0x11012e[_0x4db9('0x26')][_0x4db9('0x28')]);return _0xa693c4(_0x11012e['error'][_0x4db9('0x28')]);}else{logger[_0x4db9('0x29')](_0x4db9('0x22'),_0x250a80,'request\x20sent');_0xa693c4(_0x11012e[_0x4db9('0x2a')][_0x4db9('0x28')]);}})[_0x4db9('0x2b')](function(_0x2d330e){logger[_0x4db9('0x26')](_0x4db9('0x22'),_0x250a80,_0x2d330e);_0x1d3c33(_0x2d330e);});});}function respondWithStatusCode(_0x385400,_0x2a56b8){_0x2a56b8=_0x2a56b8||0xcc;return function(_0x3d0f12){if(_0x3d0f12){return _0x385400[_0x4db9('0x2c')](_0x2a56b8);}return _0x385400[_0x4db9('0x2d')](_0x2a56b8)[_0x4db9('0x2e')]();};}function respondWithResult(_0x2d646d,_0x20f133){_0x20f133=_0x20f133||0xc8;return function(_0x583861){if(_0x583861){return _0x2d646d['status'](_0x20f133)[_0x4db9('0x2f')](_0x583861);}};}function respondWithFilteredResult(_0x331279,_0x119371){return function(_0x207f2c){if(_0x207f2c){var _0x2af884=_0x207f2c['count'],_0x459131=_0x119371[_0x4db9('0x30')],_0x4dc946=_0x119371[_0x4db9('0x30')]+_0x119371[_0x4db9('0x31')],_0x375834;if(_0x4dc946>=_0x2af884){_0x4dc946=_0x2af884;_0x375834=0xc8;}else{_0x375834=0xce;}_0x331279[_0x4db9('0x2d')](_0x375834);return _0x331279[_0x4db9('0x32')]('Content-Range',_0x459131+'-'+_0x4dc946+'/'+_0x2af884)['json'](_0x207f2c);}return null;};}function patchUpdates(_0x2940cd){return function(_0x49776b){try{jsonpatch[_0x4db9('0x33')](_0x49776b,_0x2940cd,!![]);}catch(_0xddc8b1){return BPromise['reject'](_0xddc8b1);}return _0x49776b[_0x4db9('0x34')]();};}function saveUpdates(_0x3131ba,_0x32c12d){return function(_0x4f396f){if(_0x4f396f){return _0x4f396f[_0x4db9('0x35')](_0x3131ba)['then'](function(_0x40226c){return _0x40226c;});}return null;};}function removeEntity(_0xb4d4fa,_0x1f4959){return function(_0x4dbcd3){if(_0x4dbcd3){return _0x4dbcd3['destroy']()[_0x4db9('0x21')](function(){var _0x1494bc=_0x4dbcd3[_0x4db9('0x36')]({'plain':!![]});var _0x3aec38=_0x4db9('0x37');return db[_0x4db9('0x38')][_0x4db9('0x39')]({'where':{'type':_0x3aec38,'resourceId':_0x1494bc['id']}})[_0x4db9('0x21')](function(){return _0x4dbcd3;});})[_0x4db9('0x21')](function(){_0xb4d4fa['status'](0xcc)[_0x4db9('0x2e')]();});}};}function handleEntityNotFound(_0x94536b,_0x2623ab){return function(_0x2acc28){if(!_0x2acc28){_0x94536b['sendStatus'](0x194);}return _0x2acc28;};}function handleError(_0x2e6425,_0x22fa73){_0x22fa73=_0x22fa73||0x1f4;return function(_0x326a92){logger['error'](_0x326a92[_0x4db9('0x3a')]);if(_0x326a92[_0x4db9('0x3b')]){delete _0x326a92[_0x4db9('0x3b')];}_0x2e6425[_0x4db9('0x2d')](_0x22fa73)['send'](_0x326a92);};}exports['index']=function(_0x41da52,_0x163077){var _0x32e62b={'include':[{'model':db['Pause'],'as':_0x4db9('0x3c')}]},_0x8bc540={},_0x345443={'count':0x0,'rows':[]};var _0x43b0d9=_[_0x4db9('0x3d')](db[_0x4db9('0x3e')][_0x4db9('0x3f')],function(_0x4c3ac6){return{'name':_0x4c3ac6[_0x4db9('0x40')],'type':_0x4c3ac6[_0x4db9('0x41')][_0x4db9('0x42')]};});_0x8bc540['model']=_[_0x4db9('0x3d')](_0x43b0d9,_0x4db9('0x3b'));_0x8bc540[_0x4db9('0x43')]=_[_0x4db9('0x44')](_0x41da52[_0x4db9('0x43')]);_0x8bc540[_0x4db9('0x45')]=_[_0x4db9('0x46')](_0x8bc540[_0x4db9('0x47')],_0x8bc540[_0x4db9('0x43')]);_0x32e62b[_0x4db9('0x48')]=_['intersection'](_0x8bc540['model'],qs['fields'](_0x41da52[_0x4db9('0x43')][_0x4db9('0x49')]));_0x32e62b['attributes']=_0x32e62b[_0x4db9('0x48')][_0x4db9('0x4a')]?_0x32e62b['attributes']:_0x8bc540['model'];if(!_0x41da52[_0x4db9('0x43')]['hasOwnProperty'](_0x4db9('0x4b'))){_0x32e62b[_0x4db9('0x31')]=qs['limit'](_0x41da52[_0x4db9('0x43')][_0x4db9('0x31')]);_0x32e62b['offset']=qs[_0x4db9('0x30')](_0x41da52[_0x4db9('0x43')][_0x4db9('0x30')]);}_0x32e62b['order']=qs['sort'](_0x41da52[_0x4db9('0x43')][_0x4db9('0x4c')]);_0x32e62b[_0x4db9('0x4d')]=qs[_0x4db9('0x45')](_[_0x4db9('0x4e')](_0x41da52[_0x4db9('0x43')],_0x8bc540[_0x4db9('0x45')]),_0x43b0d9);if(_0x41da52[_0x4db9('0x43')][_0x4db9('0x4f')]){_0x32e62b[_0x4db9('0x4d')]=_[_0x4db9('0x50')](_0x32e62b[_0x4db9('0x4d')],{'$or':_[_0x4db9('0x3d')](_0x43b0d9,function(_0x54bbd4){if(_0x54bbd4[_0x4db9('0x41')]!==_0x4db9('0x51')){var _0x3852f0={};_0x3852f0[_0x54bbd4[_0x4db9('0x3b')]]={'$like':'%'+_0x41da52[_0x4db9('0x43')][_0x4db9('0x4f')]+'%'};return _0x3852f0;}})});}_0x32e62b=_[_0x4db9('0x50')]({},_0x32e62b,_0x41da52[_0x4db9('0x52')]);var _0x4016d8={'where':_0x32e62b[_0x4db9('0x4d')]};return db[_0x4db9('0x3e')]['count'](_0x4016d8)['then'](function(_0x36cd58){_0x345443[_0x4db9('0x53')]=_0x36cd58;if(_0x41da52[_0x4db9('0x43')][_0x4db9('0x54')]){_0x32e62b[_0x4db9('0x55')]=[{'all':!![]}];}return db[_0x4db9('0x3e')][_0x4db9('0x56')](_0x32e62b);})[_0x4db9('0x21')](function(_0x4f1e36){_0x345443[_0x4db9('0x57')]=_0x4f1e36;return _0x345443;})[_0x4db9('0x21')](respondWithFilteredResult(_0x163077,_0x32e62b))[_0x4db9('0x2b')](handleError(_0x163077,null));};exports[_0x4db9('0x58')]=function(_0x3c1ad2,_0x2552f9){var _0x1226ea={'raw':![],'where':{'id':_0x3c1ad2['params']['id']},'include':[{'model':db[_0x4db9('0x59')],'as':_0x4db9('0x3c')}]},_0x3db087={};_0x3db087[_0x4db9('0x47')]=_[_0x4db9('0x44')](db[_0x4db9('0x3e')][_0x4db9('0x3f')]);_0x3db087['query']=_[_0x4db9('0x44')](_0x3c1ad2['query']);_0x3db087[_0x4db9('0x45')]=_['intersection'](_0x3db087['model'],_0x3db087[_0x4db9('0x43')]);_0x1226ea['attributes']=_[_0x4db9('0x46')](_0x3db087[_0x4db9('0x47')],qs[_0x4db9('0x49')](_0x3c1ad2[_0x4db9('0x43')]['fields']));_0x1226ea[_0x4db9('0x48')]=_0x1226ea['attributes'][_0x4db9('0x4a')]?_0x1226ea[_0x4db9('0x48')]:_0x3db087['model'];if(_0x3c1ad2[_0x4db9('0x43')]['includeAll']){_0x1226ea[_0x4db9('0x55')]=[{'all':!![]}];}_0x1226ea=_[_0x4db9('0x50')]({},_0x1226ea,_0x3c1ad2[_0x4db9('0x52')]);return db[_0x4db9('0x3e')][_0x4db9('0x5a')](_0x1226ea)[_0x4db9('0x21')](handleEntityNotFound(_0x2552f9,null))[_0x4db9('0x21')](respondWithResult(_0x2552f9,null))[_0x4db9('0x2b')](handleError(_0x2552f9,null));};exports[_0x4db9('0x5b')]=function(_0x14251f,_0x19649c){return db[_0x4db9('0x3e')][_0x4db9('0x5b')](_0x14251f[_0x4db9('0x5c')],{})[_0x4db9('0x21')](function(_0x5b2d83){var _0x225382=_0x14251f[_0x4db9('0x5d')]['get']({'plain':!![]});if(!_0x225382)throw new Error(_0x4db9('0x5e'));if(_0x225382[_0x4db9('0x5f')]===_0x4db9('0x5d')){var _0x200e6d=_0x5b2d83[_0x4db9('0x36')]({'plain':!![]});var _0x2b74c6=_0x4db9('0x37');return db[_0x4db9('0x60')][_0x4db9('0x5a')]({'where':{'name':_0x2b74c6,'userProfileId':_0x225382['userProfileId']},'raw':!![]})['then'](function(_0x8ede64){if(_0x8ede64&&_0x8ede64[_0x4db9('0x61')]===0x0){return db[_0x4db9('0x38')][_0x4db9('0x5b')]({'name':_0x200e6d[_0x4db9('0x3b')],'resourceId':_0x200e6d['id'],'type':_0x8ede64[_0x4db9('0x3b')],'sectionId':_0x8ede64['id']},{})[_0x4db9('0x21')](function(){return _0x5b2d83;});}else{return _0x5b2d83;}})[_0x4db9('0x2b')](function(_0x3ac041){logger[_0x4db9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ac041);throw _0x3ac041;});}return _0x5b2d83;})[_0x4db9('0x21')](respondWithResult(_0x19649c,0xc9))['catch'](handleError(_0x19649c,null));};exports['update']=function(_0x5f009c,_0x4dd2aa){if(_0x5f009c[_0x4db9('0x5c')]['id']){delete _0x5f009c['body']['id'];}return db['WhatsappAccount'][_0x4db9('0x5a')]({'where':{'id':_0x5f009c[_0x4db9('0x62')]['id']},'include':[{'model':db[_0x4db9('0x59')],'as':_0x4db9('0x3c')}]})[_0x4db9('0x21')](handleEntityNotFound(_0x4dd2aa,null))[_0x4db9('0x21')](saveUpdates(_0x5f009c[_0x4db9('0x5c')],null))[_0x4db9('0x21')](respondWithResult(_0x4dd2aa,null))[_0x4db9('0x2b')](handleError(_0x4dd2aa,null));};exports[_0x4db9('0x39')]=function(_0xd018bb,_0x3c5777){return db[_0x4db9('0x3e')][_0x4db9('0x5a')]({'where':{'id':_0xd018bb[_0x4db9('0x62')]['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x3c5777,null))['then'](removeEntity(_0x3c5777,null))['catch'](handleError(_0x3c5777,null));};exports['describe']=function(_0x154666,_0x4de478){return db[_0x4db9('0x3e')][_0x4db9('0x63')]()[_0x4db9('0x21')](respondWithResult(_0x4de478,null))['catch'](handleError(_0x4de478,null));};exports['addDisposition']=function(_0x2124c3,_0x564bcc,_0x2f3746){if(_0x2124c3[_0x4db9('0x5c')]['id']){delete _0x2124c3[_0x4db9('0x5c')]['id'];}return db[_0x4db9('0x3e')][_0x4db9('0x5a')]({'where':{'id':_0x2124c3['params']['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x564bcc,null))['then'](function(_0x2abc4d){if(_0x2abc4d){_0x2124c3[_0x4db9('0x5c')][_0x4db9('0x64')]=_0x2abc4d['id'];return db[_0x4db9('0x65')][_0x4db9('0x5b')](_0x2124c3['body']);}})['then'](respondWithResult(_0x564bcc,null))[_0x4db9('0x2b')](handleError(_0x564bcc,null));};exports[_0x4db9('0x66')]=function(_0x4d1f4a,_0x55bcbd,_0x3a96d7){var _0x598fc8={'raw':![],'where':{}};var _0x3f8009={};var _0x4d95a0={'count':0x0,'rows':[]};return db[_0x4db9('0x3e')][_0x4db9('0x67')]({'where':{'id':_0x4d1f4a['params']['id']}})['then'](handleEntityNotFound(_0x55bcbd,null))[_0x4db9('0x21')](function(_0x15266e){if(_0x15266e){_0x3f8009[_0x4db9('0x47')]=_[_0x4db9('0x44')](db[_0x4db9('0x65')]['rawAttributes']);_0x3f8009['query']=_['keys'](_0x4d1f4a['query']);_0x3f8009[_0x4db9('0x45')]=_[_0x4db9('0x46')](_0x3f8009[_0x4db9('0x47')],_0x3f8009[_0x4db9('0x43')]);_0x598fc8['attributes']=_[_0x4db9('0x46')](_0x3f8009['model'],qs[_0x4db9('0x49')](_0x4d1f4a[_0x4db9('0x43')][_0x4db9('0x49')]));_0x598fc8[_0x4db9('0x48')]=_0x598fc8[_0x4db9('0x48')][_0x4db9('0x4a')]?_0x598fc8[_0x4db9('0x48')]:_0x3f8009['model'];if(!_0x4d1f4a[_0x4db9('0x43')][_0x4db9('0x68')](_0x4db9('0x4b'))){_0x598fc8['limit']=qs[_0x4db9('0x31')](_0x4d1f4a[_0x4db9('0x43')]['limit']);_0x598fc8['offset']=qs[_0x4db9('0x30')](_0x4d1f4a['query']['offset']);}_0x598fc8[_0x4db9('0x69')]=qs[_0x4db9('0x4c')](_0x4d1f4a[_0x4db9('0x43')]['sort']);_0x598fc8['where']=qs['filters'](_['pick'](_0x4d1f4a['query'],_0x3f8009[_0x4db9('0x45')]));_0x598fc8[_0x4db9('0x4d')][_0x4db9('0x64')]=_0x15266e['id'];if(_0x4d1f4a[_0x4db9('0x43')][_0x4db9('0x4f')]){_0x598fc8[_0x4db9('0x4d')]=_[_0x4db9('0x50')](_0x598fc8[_0x4db9('0x4d')],{'$or':_['map'](_0x598fc8[_0x4db9('0x48')],function(_0x427434){var _0x3b4839={};_0x3b4839[_0x427434]={'$like':'%'+_0x4d1f4a[_0x4db9('0x43')][_0x4db9('0x4f')]+'%'};return _0x3b4839;})});}_0x598fc8=_[_0x4db9('0x50')]({},_0x598fc8,_0x4d1f4a[_0x4db9('0x52')]);return db[_0x4db9('0x65')]['count']({'where':_0x598fc8[_0x4db9('0x4d')]})['then'](function(_0x17bbcb){_0x4d95a0[_0x4db9('0x53')]=_0x17bbcb;if(_0x4d1f4a[_0x4db9('0x43')][_0x4db9('0x54')]){_0x598fc8['include']=[{'all':!![]}];}return db['Disposition'][_0x4db9('0x56')](_0x598fc8);})['then'](function(_0x450ee1){_0x4d95a0[_0x4db9('0x57')]=_0x450ee1;return _0x4d95a0;});}})[_0x4db9('0x21')](respondWithFilteredResult(_0x55bcbd,_0x598fc8))[_0x4db9('0x2b')](handleError(_0x55bcbd,null));};exports[_0x4db9('0x6a')]=function(_0x31f55f,_0x421537,_0xdd8823){return db['WhatsappAccount'][_0x4db9('0x5a')]({'where':{'id':_0x31f55f[_0x4db9('0x62')]['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x421537,null))[_0x4db9('0x21')](function(_0x4c1c51){if(_0x4c1c51){return _0x4c1c51[_0x4db9('0x6a')](_0x31f55f[_0x4db9('0x43')]['ids']);}})[_0x4db9('0x21')](respondWithStatusCode(_0x421537,null))[_0x4db9('0x2b')](handleError(_0x421537,null));};exports[_0x4db9('0x6b')]=function(_0x561f4b,_0x5b40a4,_0x168d05){if(_0x561f4b[_0x4db9('0x5c')]['id']){delete _0x561f4b['body']['id'];}return db['WhatsappAccount'][_0x4db9('0x5a')]({'where':{'id':_0x561f4b[_0x4db9('0x62')]['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x5b40a4,null))[_0x4db9('0x21')](function(_0x34c0e9){if(_0x34c0e9){_0x561f4b[_0x4db9('0x5c')][_0x4db9('0x64')]=_0x34c0e9['id'];return db[_0x4db9('0x6c')][_0x4db9('0x5b')](_0x561f4b[_0x4db9('0x5c')]);}})[_0x4db9('0x21')](respondWithResult(_0x5b40a4,null))[_0x4db9('0x2b')](handleError(_0x5b40a4,null));};exports[_0x4db9('0x6d')]=function(_0x24ee49,_0x1c31fe,_0x51f7b4){var _0x766d10={'raw':![],'where':{}};var _0x541687={};var _0x1efd51={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x4db9('0x67')]({'where':{'id':_0x24ee49[_0x4db9('0x62')]['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x1c31fe,null))[_0x4db9('0x21')](function(_0xed6d75){if(_0xed6d75){_0x541687[_0x4db9('0x47')]=_[_0x4db9('0x44')](db[_0x4db9('0x6c')][_0x4db9('0x3f')]);_0x541687[_0x4db9('0x43')]=_[_0x4db9('0x44')](_0x24ee49[_0x4db9('0x43')]);_0x541687['filters']=_[_0x4db9('0x46')](_0x541687[_0x4db9('0x47')],_0x541687['query']);_0x766d10[_0x4db9('0x48')]=_[_0x4db9('0x46')](_0x541687[_0x4db9('0x47')],qs[_0x4db9('0x49')](_0x24ee49['query']['fields']));_0x766d10[_0x4db9('0x48')]=_0x766d10['attributes'][_0x4db9('0x4a')]?_0x766d10[_0x4db9('0x48')]:_0x541687[_0x4db9('0x47')];if(!_0x24ee49[_0x4db9('0x43')][_0x4db9('0x68')](_0x4db9('0x4b'))){_0x766d10['limit']=qs[_0x4db9('0x31')](_0x24ee49[_0x4db9('0x43')][_0x4db9('0x31')]);_0x766d10[_0x4db9('0x30')]=qs[_0x4db9('0x30')](_0x24ee49[_0x4db9('0x43')][_0x4db9('0x30')]);}_0x766d10['order']=qs[_0x4db9('0x4c')](_0x24ee49[_0x4db9('0x43')][_0x4db9('0x4c')]);_0x766d10[_0x4db9('0x4d')]=qs['filters'](_['pick'](_0x24ee49['query'],_0x541687[_0x4db9('0x45')]));_0x766d10[_0x4db9('0x4d')][_0x4db9('0x64')]=_0xed6d75['id'];if(_0x24ee49['query']['filter']){_0x766d10[_0x4db9('0x4d')]=_[_0x4db9('0x50')](_0x766d10['where'],{'$or':_['map'](_0x766d10[_0x4db9('0x48')],function(_0x187df4){var _0x48a88b={};_0x48a88b[_0x187df4]={'$like':'%'+_0x24ee49['query'][_0x4db9('0x4f')]+'%'};return _0x48a88b;})});}_0x766d10=_['merge']({},_0x766d10,_0x24ee49['options']);return db[_0x4db9('0x6c')][_0x4db9('0x53')]({'where':_0x766d10[_0x4db9('0x4d')]})['then'](function(_0x21975d){_0x1efd51['count']=_0x21975d;if(_0x24ee49[_0x4db9('0x43')]['includeAll']){_0x766d10[_0x4db9('0x55')]=[{'all':!![]}];}return db[_0x4db9('0x6c')][_0x4db9('0x56')](_0x766d10);})[_0x4db9('0x21')](function(_0x2075cf){_0x1efd51[_0x4db9('0x57')]=_0x2075cf;return _0x1efd51;});}})[_0x4db9('0x21')](respondWithFilteredResult(_0x1c31fe,_0x766d10))['catch'](handleError(_0x1c31fe,null));};exports['removeAnswers']=function(_0x5b6abf,_0x5dc771,_0x1de02e){return db['WhatsappAccount'][_0x4db9('0x5a')]({'where':{'id':_0x5b6abf['params']['id']}})['then'](handleEntityNotFound(_0x5dc771,null))[_0x4db9('0x21')](function(_0x4f2055){if(_0x4f2055){return _0x4f2055[_0x4db9('0x6e')](_0x5b6abf[_0x4db9('0x43')][_0x4db9('0x6f')]);}})[_0x4db9('0x21')](respondWithStatusCode(_0x5dc771,null))[_0x4db9('0x2b')](handleError(_0x5dc771,null));};exports[_0x4db9('0x70')]=function(_0x179e48,_0x23fd10,_0x416552){return db[_0x4db9('0x3e')][_0x4db9('0x5a')]({'where':{'id':_0x179e48[_0x4db9('0x62')]['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x23fd10,null))[_0x4db9('0x21')](function(_0x2f1200){if(_0x2f1200){return _0x2f1200['addAgents'](_0x179e48[_0x4db9('0x5c')][_0x4db9('0x6f')],_[_0x4db9('0x71')](_0x179e48[_0x4db9('0x5c')],[_0x4db9('0x6f'),'id'])||{})[_0x4db9('0x72')](function(_0x16f72f){for(var _0x5dc000=0x0;_0x5dc000<_0x179e48[_0x4db9('0x5c')][_0x4db9('0x6f')]['length'];_0x5dc000+=0x1){socket[_0x4db9('0x73')](_0x4db9('0x74'),{'UserId':_0x179e48[_0x4db9('0x5c')]['ids'][_0x5dc000],'WhatsappAccountId':_0x179e48['params']['id']});}return _0x16f72f;});}})[_0x4db9('0x21')](respondWithResult(_0x23fd10,null))[_0x4db9('0x2b')](handleError(_0x23fd10,null));};exports[_0x4db9('0x75')]=function(_0x2dd342,_0x546b70,_0x11de91){return db[_0x4db9('0x3e')][_0x4db9('0x5a')]({'where':{'id':_0x2dd342[_0x4db9('0x62')]['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x546b70,null))['then'](function(_0x28851e){if(_0x28851e){return _0x28851e[_0x4db9('0x75')](_0x2dd342[_0x4db9('0x43')]['ids'])[_0x4db9('0x21')](function(){if(_['isArray'](_0x2dd342['query'][_0x4db9('0x6f')])){for(var _0x22d686=0x0;_0x22d686<_0x2dd342[_0x4db9('0x43')][_0x4db9('0x6f')][_0x4db9('0x4a')];_0x22d686+=0x1){socket[_0x4db9('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x2dd342[_0x4db9('0x43')][_0x4db9('0x6f')][_0x22d686]),'WhatsappAccountId':Number(_0x2dd342['params']['id'])});}}else{socket[_0x4db9('0x73')](_0x4db9('0x76'),{'UserId':Number(_0x2dd342[_0x4db9('0x43')]['ids']),'WhatsappAccountId':Number(_0x2dd342[_0x4db9('0x62')]['id'])});}});}})[_0x4db9('0x21')](respondWithStatusCode(_0x546b70,null))[_0x4db9('0x2b')](handleError(_0x546b70,null));};exports[_0x4db9('0x77')]=function(_0x18c5ad,_0x3c3d2a,_0x463100){var _0x5cbda0={};var _0x167ebb={};var _0xf74a65;var _0x48f481;return db[_0x4db9('0x3e')][_0x4db9('0x67')]({'where':{'id':_0x18c5ad[_0x4db9('0x62')]['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x3c3d2a,null))[_0x4db9('0x21')](function(_0x15056e){if(_0x15056e){_0xf74a65=_0x15056e;_0x167ebb['model']=_['keys'](db[_0x4db9('0x78')][_0x4db9('0x3f')]);_0x167ebb[_0x4db9('0x43')]=_[_0x4db9('0x44')](_0x18c5ad[_0x4db9('0x43')]);_0x167ebb['filters']=_[_0x4db9('0x46')](_0x167ebb[_0x4db9('0x47')],_0x167ebb[_0x4db9('0x43')]);_0x5cbda0['attributes']=_[_0x4db9('0x46')](_0x167ebb[_0x4db9('0x47')],qs['fields'](_0x18c5ad[_0x4db9('0x43')][_0x4db9('0x49')]));_0x5cbda0['attributes']=_0x5cbda0[_0x4db9('0x48')][_0x4db9('0x4a')]?_0x5cbda0[_0x4db9('0x48')]:_0x167ebb['model'];_0x5cbda0['order']=qs['sort'](_0x18c5ad[_0x4db9('0x43')][_0x4db9('0x4c')]);_0x5cbda0['where']=qs[_0x4db9('0x45')](_[_0x4db9('0x4e')](_0x18c5ad[_0x4db9('0x43')],_0x167ebb[_0x4db9('0x45')]));if(_0x18c5ad[_0x4db9('0x43')][_0x4db9('0x4f')]){_0x5cbda0[_0x4db9('0x4d')]=_['merge'](_0x5cbda0[_0x4db9('0x4d')],{'$or':_['map'](_0x5cbda0['attributes'],function(_0x1f2d3f){var _0x509b91={};_0x509b91[_0x1f2d3f]={'$like':'%'+_0x18c5ad[_0x4db9('0x43')]['filter']+'%'};return _0x509b91;})});}_0x5cbda0=_['merge']({},_0x5cbda0,_0x18c5ad['options']);return _0xf74a65['getAgents'](_0x5cbda0);}})[_0x4db9('0x21')](function(_0x11f240){if(_0x11f240){_0x48f481=_0x11f240[_0x4db9('0x4a')];if(!_0x18c5ad[_0x4db9('0x43')]['hasOwnProperty'](_0x4db9('0x4b'))){_0x5cbda0[_0x4db9('0x31')]=qs['limit'](_0x18c5ad[_0x4db9('0x43')][_0x4db9('0x31')]);_0x5cbda0[_0x4db9('0x30')]=qs[_0x4db9('0x30')](_0x18c5ad[_0x4db9('0x43')][_0x4db9('0x30')]);}return _0xf74a65['getAgents'](_0x5cbda0);}})[_0x4db9('0x21')](function(_0xab4d8b){if(_0xab4d8b){return _0xab4d8b?{'count':_0x48f481,'rows':_0xab4d8b}:null;}})['then'](respondWithResult(_0x3c3d2a,null))[_0x4db9('0x2b')](handleError(_0x3c3d2a,null));};exports[_0x4db9('0x79')]=function(_0x2e89cb,_0x19e6be,_0x37aec1){return db[_0x4db9('0x3e')][_0x4db9('0x67')]({'where':{'id':_0x2e89cb['params']['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0x19e6be,null))[_0x4db9('0x21')](function(_0x26e344){if(_0x26e344){return db['sequelize'][_0x4db9('0x7a')](function(_0x51dbf9){return db[_0x4db9('0x7b')][_0x4db9('0x39')]({'where':{'WhatsappAccountId':_0x2e89cb[_0x4db9('0x62')]['id']},'transaction':_0x51dbf9})[_0x4db9('0x21')](function(_0x28f774){var _0x5b63fe=_[_0x4db9('0x3d')](_0x2e89cb[_0x4db9('0x5c')],function(_0x5bdb27){_0x5bdb27[_0x4db9('0x64')]=_0x2e89cb['params']['id'];return _0x5bdb27;});return db['WhatsappApplication'][_0x4db9('0x7c')](_0x5b63fe,{'transaction':_0x51dbf9});});})[_0x4db9('0x21')](function(){return db[_0x4db9('0x7b')][_0x4db9('0x7d')]({'where':{'WhatsappAccountId':_0x2e89cb[_0x4db9('0x62')]['id']},'order':_0x4db9('0x7e')});});}})[_0x4db9('0x21')](respondWithResult(_0x19e6be,null))[_0x4db9('0x2b')](handleError(_0x19e6be,null));};exports['getApplications']=function(_0x197857,_0xb9fc93,_0x37b157){var _0x970efa={};var _0x33c785={};var _0x4bfe67;var _0x538a24;return db['WhatsappAccount'][_0x4db9('0x67')]({'where':{'id':_0x197857['params']['id']}})[_0x4db9('0x21')](handleEntityNotFound(_0xb9fc93,null))[_0x4db9('0x21')](function(_0x3b7bdf){if(_0x3b7bdf){_0x4bfe67=_0x3b7bdf;_0x33c785['model']=_[_0x4db9('0x44')](db['WhatsappApplication'][_0x4db9('0x3f')]);_0x33c785[_0x4db9('0x43')]=_['keys'](_0x197857[_0x4db9('0x43')]);_0x33c785['filters']=_[_0x4db9('0x46')](_0x33c785[_0x4db9('0x47')],_0x33c785[_0x4db9('0x43')]);_0x970efa[_0x4db9('0x48')]=_[_0x4db9('0x46')](_0x33c785['model'],qs['fields'](_0x197857['query'][_0x4db9('0x49')]));_0x970efa[_0x4db9('0x48')]=_0x970efa[_0x4db9('0x48')][_0x4db9('0x4a')]?_0x970efa[_0x4db9('0x48')]:_0x33c785[_0x4db9('0x47')];_0x970efa[_0x4db9('0x69')]=qs[_0x4db9('0x4c')](_0x197857[_0x4db9('0x43')][_0x4db9('0x4c')]);_0x970efa[_0x4db9('0x4d')]=qs[_0x4db9('0x45')](_[_0x4db9('0x4e')](_0x197857[_0x4db9('0x43')],_0x33c785[_0x4db9('0x45')]));if(_0x197857[_0x4db9('0x43')][_0x4db9('0x4f')]){_0x970efa[_0x4db9('0x4d')]=_[_0x4db9('0x50')](_0x970efa[_0x4db9('0x4d')],{'$or':_[_0x4db9('0x3d')](_0x970efa['attributes'],function(_0x2630c0){var _0x5f13dc={};_0x5f13dc[_0x2630c0]={'$like':'%'+_0x197857[_0x4db9('0x43')]['filter']+'%'};return _0x5f13dc;})});}_0x970efa=_[_0x4db9('0x50')]({},_0x970efa,_0x197857[_0x4db9('0x52')]);return _0x4bfe67[_0x4db9('0x7f')](_0x970efa);}})[_0x4db9('0x21')](function(_0x49de94){if(_0x49de94){_0x538a24=_0x49de94[_0x4db9('0x4a')];if(!_0x197857[_0x4db9('0x43')]['hasOwnProperty']('nolimit')){_0x970efa[_0x4db9('0x31')]=qs[_0x4db9('0x31')](_0x197857[_0x4db9('0x43')][_0x4db9('0x31')]);_0x970efa[_0x4db9('0x30')]=qs[_0x4db9('0x30')](_0x197857['query'][_0x4db9('0x30')]);}return _0x4bfe67[_0x4db9('0x7f')](_0x970efa);}})[_0x4db9('0x21')](function(_0x53f24f){if(_0x53f24f){return _0x53f24f?{'count':_0x538a24,'rows':_0x53f24f}:null;}})[_0x4db9('0x21')](respondWithResult(_0xb9fc93,null))['catch'](handleError(_0xb9fc93,null));};exports[_0x4db9('0x80')]=function(_0x1f222c,_0x1a6eb7,_0x16bee2){var _0x15551c={'channel':_0x4db9('0x81')};var _0x17a236=[];var _0x2e0717=[];var _0x18ffad={};return db[_0x4db9('0x3e')]['find']({'where':{'id':_0x1f222c[_0x4db9('0x62')]['id']},'include':[{'model':db[_0x4db9('0x7b')],'as':_0x4db9('0x82')}]})[_0x4db9('0x21')](handleEntityNotFound(_0x1a6eb7,null))[_0x4db9('0x21')](function(_0x23d989){_0x15551c[_0x4db9('0x83')]=_0x23d989;_0x15551c[_0x4db9('0x84')]=_['orderBy'](_0x23d989['Applications'],['priority'],['asc']);if(_0x15551c[_0x4db9('0x83')]['Applications']){delete _0x15551c[_0x4db9('0x83')][_0x4db9('0x82')];}return db[_0x4db9('0x85')][_0x4db9('0x63')]();})[_0x4db9('0x21')](function(_0x252c9e){if(!_0x252c9e){throw new db[(_0x4db9('0x1e'))][(_0x4db9('0x1f'))](_0x4db9('0x86'));}_0x17a236=_['difference'](_['keys'](_0x252c9e),[_0x4db9('0x87'),_0x4db9('0x88')]);_0x2e0717=_[_0x4db9('0x89')](_[_0x4db9('0x44')](_0x252c9e),[_0x4db9('0x87'),_0x4db9('0x88'),_0x4db9('0x8a'),_0x4db9('0x8b')]);_0x15551c[_0x4db9('0x5c')]={'mapKey':_0x4db9('0x8c')};if(_0x15551c[_0x4db9('0x83')][_0x4db9('0x41')]&&_0x15551c['account'][_0x4db9('0x41')]===_0x4db9('0x8d')){_0x15551c[_0x4db9('0x5c')][_0x4db9('0x8e')]=_0x1f222c['body']['From'][_0x4db9('0x8f')](_0x4db9('0x90'),'');_0x15551c[_0x4db9('0x5c')]['body']=_0x1f222c[_0x4db9('0x5c')][_0x4db9('0x91')];_0x15551c['body'][_0x4db9('0x92')]=_0x1f222c[_0x4db9('0x5c')]['MessageSid'];}if(_0x15551c[_0x4db9('0x5c')]['id']){delete _0x15551c['body']['id'];}if(_['isNil'](_0x15551c['body']['from'])){throw new db[(_0x4db9('0x1e'))][(_0x4db9('0x1f'))](_0x4db9('0x93'));}if(_[_0x4db9('0x94')](_0x15551c[_0x4db9('0x5c')][_0x4db9('0x5c')])||_0x15551c[_0x4db9('0x5c')][_0x4db9('0x5c')]===''){throw new db[(_0x4db9('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4db9('0x94')](_0x15551c['body'][_0x4db9('0x95')])){throw new db[(_0x4db9('0x1e'))][(_0x4db9('0x1f'))](_0x4db9('0x96')+_0x2e0717);}if(!_['includes'](_0x2e0717,_0x15551c[_0x4db9('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0x4db9('0x1f'))](_0x4db9('0x97')+_0x2e0717);}_0x18ffad[_0x15551c[_0x4db9('0x5c')][_0x4db9('0x95')]]=_0x15551c[_0x4db9('0x5c')]['from'];return db['CmList']['find']({'where':{'id':_0x15551c[_0x4db9('0x83')][_0x4db9('0x8b')]},'include':[{'model':db[_0x4db9('0x85')],'as':_0x4db9('0x98'),'where':_0x18ffad,'limit':0x1,'order':[[_0x4db9('0x88'),'DESC']]}]});})[_0x4db9('0x21')](handleEntityNotFound(_0x1a6eb7,null))[_0x4db9('0x21')](function(_0xd697ae){if(_0xd697ae){_0x15551c[_0x4db9('0x99')]=_[_0x4db9('0x71')](_0xd697ae,[_0x4db9('0x98')]);if(_0xd697ae[_0x4db9('0x98')][_0x4db9('0x4a')]){return _0xd697ae[_0x4db9('0x98')][0x0];}var _0x169c44=_['defaults'](_0x15551c[_0x4db9('0x5c')],{'firstName':_0x15551c[_0x4db9('0x5c')][_0x4db9('0x8e')],'ListId':_0xd697ae['id']});_0x169c44[_0x15551c[_0x4db9('0x5c')]['mapKey']]=_0x15551c[_0x4db9('0x5c')][_0x4db9('0x8e')];return db[_0x4db9('0x85')][_0x4db9('0x5b')](_0x169c44,{'fields':_0x17a236,'raw':!![]});}})[_0x4db9('0x21')](handleEntityNotFound(_0x1a6eb7,null))[_0x4db9('0x21')](function(_0x5af502){if(_0x5af502){_0x15551c['contact']=_0x5af502;var _0x529ec0={'ContactId':_0x5af502['id'],'phone':_0x15551c[_0x4db9('0x5c')][_0x4db9('0x8e')],'WhatsappAccountId':_0x1f222c[_0x4db9('0x62')]['id']};var _0x426bb4={'ContactId':_0x5af502['id'],'WhatsappAccountId':_0x1f222c['params']['id'],'closed':![]};return db[_0x4db9('0x9a')][_0x4db9('0x5a')]({'where':_0x426bb4})['then'](function(_0x42841d){if(_0x42841d){return[_0x42841d,![]];}return db[_0x4db9('0x9a')][_0x4db9('0x5b')](_0x529ec0)[_0x4db9('0x21')](function(_0x47df55){return[_0x47df55,!![]];});});}})[_0x4db9('0x72')](function(_0x5113a8,_0x428e08){_0x15551c[_0x4db9('0x9b')]=_0x5113a8[_0x4db9('0x36')]({'plain':!![]});_0x15551c[_0x4db9('0x9b')][_0x4db9('0x9c')]=![];if(_0x428e08){if(_0x15551c[_0x4db9('0x83')][_0x4db9('0x9d')]){_0x15551c[_0x4db9('0x84')][_0x4db9('0x9e')]({'id':0x0,'priority':_0x15551c['applications'][_0x4db9('0x4a')]+0x1,'app':_0x4db9('0x9f'),'appdata':_0x4db9('0xa0'),'interval':_0x4db9('0xa1')});}_0x15551c[_0x4db9('0x9b')][_0x4db9('0x9c')]=!![];}return db[_0x4db9('0xa2')][_0x4db9('0x5b')]({'phone':_0x15551c[_0x4db9('0x5c')][_0x4db9('0x8e')],'messageId':_0x15551c['body'][_0x4db9('0x92')],'body':_0x15551c['body']['body'],'WhatsappAccountId':_0x1f222c['params']['id'],'WhatsappInteractionId':_0x5113a8['id'],'direction':'in','ContactId':_0x5113a8[_0x4db9('0xa3')],'AttachmentId':_0x15551c[_0x4db9('0x5c')]['AttachmentId']});})[_0x4db9('0x21')](function(_0x35c15a){_0x15551c['message']=_0x35c15a;if(_0x15551c[_0x4db9('0x9b')][_0x4db9('0xa4')]){return db[_0x4db9('0x78')][_0x4db9('0x5a')]({'attributes':['id',_0x4db9('0x3b')],'where':{'id':_0x15551c[_0x4db9('0x9b')]['UserId']}})[_0x4db9('0x21')](function(_0x5984db){if(_0x5984db){_0x15551c[_0x4db9('0x84')][_0x4db9('0xa5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5984db['name']+','+(_0x15551c['account']['waitForTheAssignedAgent']||0xa),'interval':_0x4db9('0xa1')});}return respondWithRpcPromise(_0x4db9('0xa6'),_0x4db9('0xa7'),_0x15551c);});}return respondWithRpcPromise(_0x4db9('0xa6'),_0x4db9('0xa7'),_0x15551c);})['then'](function(_0x3d1704){if(_0x3d1704){var _0x56e247=0xc8;var _0x4321b6='receiveMessage';logger['info'](_0x4db9('0xa8'),_0x4321b6,_0x56e247,_0x4db9('0xa9'));logger[_0x4db9('0x24')](_0x4db9('0xaa'),_0x4321b6,_0x56e247,_0x4db9('0xa9'),JSON['stringify'](_0x3d1704));if(_0x15551c['account'][_0x4db9('0x41')]===_0x4db9('0x8d')){return _0x1a6eb7['status'](_0x56e247)['set']('Content-Type',_0x4db9('0xab'))['send'](_0x4db9('0xac'));}else{return _0x1a6eb7[_0x4db9('0x2d')](_0x56e247)[_0x4db9('0x2f')](_0x3d1704);}}})['catch'](handleError(_0x1a6eb7,null));};exports['send']=function(_0x224693,_0x2a3477,_0x3c1e3c){var _0x41046c,_0x210852,_0x751df4;if(_[_0x4db9('0x94')](_0x224693['body'][_0x4db9('0x5c')])||_0x224693['body'][_0x4db9('0x5c')]===''){throw new db[(_0x4db9('0x1e'))][(_0x4db9('0x1f'))](_0x4db9('0xad'));}if(_[_0x4db9('0x94')](_0x224693['body']['to'])){throw new db['Sequelize'][(_0x4db9('0x1f'))]('to\x20is\x20mandatory');}_0x41046c=_0x224693[_0x4db9('0x5c')]['to'];return db[_0x4db9('0x3e')][_0x4db9('0x5a')]({'where':{'id':_0x224693['params']['id']},'include':[{'model':db[_0x4db9('0xae')],'as':_0x4db9('0xaf'),'include':[{'model':db[_0x4db9('0x85')],'as':_0x4db9('0x98'),'where':{'mobile':_0x41046c},'limit':0x1,'order':[[_0x4db9('0x88'),'DESC']]}]}]})[_0x4db9('0x21')](handleEntityNotFound(_0x2a3477,null))[_0x4db9('0x21')](function(_0x193891){if(_0x193891&&_0x193891[_0x4db9('0xaf')]){_0x210852=_0x193891[_0x4db9('0x36')]({'plain':!![]});if(_0x210852[_0x4db9('0xaf')]&&_0x210852['List'][_0x4db9('0x98')]['length']){return _0x210852[_0x4db9('0xaf')][_0x4db9('0x98')][0x0];}return db[_0x4db9('0x85')]['create'](_[_0x4db9('0x17')](_0x224693[_0x4db9('0x5c')],{'firstName':_0x41046c,'mobile':_0x41046c,'phone':_0x41046c,'ListId':_0x210852[_0x4db9('0x8b')]}));}})[_0x4db9('0x21')](handleEntityNotFound(_0x2a3477,null))[_0x4db9('0x21')](function(_0x963fb5){if(_0x963fb5){_0x751df4=_0x963fb5;return db[_0x4db9('0x9a')][_0x4db9('0x5a')]({'where':{'ContactId':_0x751df4['id'],'closed':![],'WhatsappAccountId':_0x210852['id']}})['then'](function(_0x4856fb){if(_0x4856fb){return[_0x4856fb,![]];}return db[_0x4db9('0x9a')][_0x4db9('0x5b')]({'UserId':_0x224693[_0x4db9('0x5d')]['id'],'ContactId':_0x751df4['id'],'WhatsappAccountId':_0x210852['id'],'phone':_0x41046c,'firstMsgDirection':'out','Messages':[_['merge'](_0x224693['body'],{'read':![],'body':_0x224693[_0x4db9('0x5c')]['body'],'phone':_0x41046c,'WhatsappAccountId':_0x210852['id'],'UserId':_0x224693['user']['id'],'ContactId':_0x751df4['id']})]},{'include':[{'model':db[_0x4db9('0xa2')],'as':_0x4db9('0xb0')}]})[_0x4db9('0x21')](function(_0x19fbba){return[_0x19fbba,!![]];});});}})[_0x4db9('0x72')](function(_0x531de4,_0x7489d5){if(_0x7489d5){return _0x531de4;}return db[_0x4db9('0xa2')][_0x4db9('0x5b')](_[_0x4db9('0x50')](_0x224693[_0x4db9('0x5c')],{'read':![],'body':_0x224693[_0x4db9('0x5c')]['body'],'phone':_0x41046c,'WhatsappAccountId':_0x210852['id'],'WhatsappInteractionId':_0x531de4['id'],'UserId':_0x224693['user']['id'],'ContactId':_0x751df4['id']}))['then'](function(_0x3a6bde){_0x531de4[_0x4db9('0xb1')][_0x4db9('0xb0')]=[];_0x531de4[_0x4db9('0xb1')][_0x4db9('0xb0')][_0x4db9('0x9e')](_0x3a6bde[_0x4db9('0xb1')]);return _0x531de4;});})[_0x4db9('0x21')](respondWithResult(_0x2a3477,null))[_0x4db9('0x2b')](handleError(_0x2a3477,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f13a446..3d3306a 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 _0xdfa0=['exports','events','WhatsappAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x57e8df,_0x4a9cea){var _0x6bbf55=function(_0x549be){while(--_0x549be){_0x57e8df['push'](_0x57e8df['shift']());}};_0x6bbf55(++_0x4a9cea);}(_0xdfa0,0x69));var _0x0dfa=function(_0x156503,_0x59f4c3){_0x156503=_0x156503-0x0;var _0x2d46c4=_0xdfa0[_0x156503];return _0x2d46c4;};'use strict';var EventEmitter=require(_0x0dfa('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x0dfa('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0dfa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0dfa('0x3'),'afterDestroy':_0x0dfa('0x4')};function emitEvent(_0x3691a7){return function(_0x4dbbab,_0x373c4e,_0x50b91e){WhatsappAccountEvents[_0x0dfa('0x5')](_0x3691a7+':'+_0x4dbbab['id'],_0x4dbbab);WhatsappAccountEvents[_0x0dfa('0x5')](_0x3691a7,_0x4dbbab);_0x50b91e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x0dfa('0x6')](e,emitEvent(event));}}module[_0x0dfa('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xe61c=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','WhatsappAccount'];(function(_0x1c3890,_0x108d1c){var _0x322a40=function(_0x3b1474){while(--_0x3b1474){_0x1c3890['push'](_0x1c3890['shift']());}};_0x322a40(++_0x108d1c);}(_0xe61c,0xee));var _0xce61=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0xe61c[_0x38ce4c];return _0x5d4544;};'use strict';var EventEmitter=require(_0xce61('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xce61('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xce61('0x2')](0x0);var events={'afterCreate':_0xce61('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x265c61){return function(_0x549866,_0x322876,_0xefb221){WhatsappAccountEvents[_0xce61('0x4')](_0x265c61+':'+_0x549866['id'],_0x549866);WhatsappAccountEvents[_0xce61('0x4')](_0x265c61,_0x549866);_0xefb221(null);};}for(var e in events){if(events[_0xce61('0x5')](e)){var event=events[e];WhatsappAccount[_0xce61('0x6')](e,emitEvent(event));}}module[_0xce61('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index ea74499..1f4ea39 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 _0x699a=['bluebird','path','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x699a,0x127));var _0xa699=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x699a[_0x212a37];return _0x5d0bf9;};'use strict';var _=require(_0xa699('0x0'));var util=require(_0xa699('0x1'));var logger=require(_0xa699('0x2'))(_0xa699('0x3'));var moment=require(_0xa699('0x4'));var BPromise=require(_0xa699('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa699('0x6'));var rimraf=require('rimraf');var config=require(_0xa699('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xa699('0x8')]=function(_0x42962d,_0x12d6a1){return _0x42962d[_0xa699('0x9')](_0xa699('0xa'),attributes,{'tableName':_0xa699('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfef2=['exports','define','whatsapp_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes'];(function(_0x348442,_0x31b5b4){var _0x545d5a=function(_0x156f6b){while(--_0x156f6b){_0x348442['push'](_0x348442['shift']());}};_0x545d5a(++_0x31b5b4);}(_0xfef2,0x14d));var _0x2fef=function(_0x3c5272,_0x1ea873){_0x3c5272=_0x3c5272-0x0;var _0x31a12a=_0xfef2[_0x3c5272];return _0x31a12a;};'use strict';var _=require('lodash');var util=require(_0x2fef('0x0'));var logger=require(_0x2fef('0x1'))('api');var moment=require(_0x2fef('0x2'));var BPromise=require(_0x2fef('0x3'));var rp=require(_0x2fef('0x4'));var fs=require('fs');var path=require(_0x2fef('0x5'));var rimraf=require(_0x2fef('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fef('0x7'));module[_0x2fef('0x8')]=function(_0x12b7c1,_0x46ece9){return _0x12b7c1[_0x2fef('0x9')]('WhatsappAccount',attributes,{'tableName':_0x2fef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 4a2e636..18c3eff 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 _0xb49e=['./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','options','raw','map','include','model','attributes','ShowWhatsappAccount','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb49e,0x84));var _0xeb49=function(_0x5dd726,_0x106778){_0x5dd726=_0x5dd726-0x0;var _0x456bbe=_0xb49e[_0x5dd726];return _0x456bbe;};'use strict';var _=require(_0xeb49('0x0'));var util=require(_0xeb49('0x1'));var moment=require(_0xeb49('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb49('0x3'));var fs=require('fs');var Redis=require(_0xeb49('0x4'));var db=require(_0xeb49('0x5'))['db'];var utils=require(_0xeb49('0x6'));var logger=require(_0xeb49('0x7'))(_0xeb49('0x8'));var config=require(_0xeb49('0x9'));var jayson=require(_0xeb49('0xa'));var client=jayson[_0xeb49('0xb')][_0xeb49('0xc')]({'port':0x232a});config[_0xeb49('0xd')]=_[_0xeb49('0xe')](config[_0xeb49('0xd')],{'host':_0xeb49('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb49('0xd')]));require(_0xeb49('0x10'))[_0xeb49('0x11')](socket);function respondWithRpcPromise(_0x1cfb2c,_0x383293,_0x29114e){return new BPromise(function(_0x339113,_0x215aad){return client[_0xeb49('0x12')](_0x1cfb2c,_0x29114e)[_0xeb49('0x13')](function(_0x1f2e84){logger[_0xeb49('0x14')](_0xeb49('0x15'),_0x383293,_0xeb49('0x16'));logger[_0xeb49('0x17')](_0xeb49('0x18'),_0x383293,_0xeb49('0x16'),JSON['stringify'](_0x1f2e84));if(_0x1f2e84[_0xeb49('0x19')]){if(_0x1f2e84[_0xeb49('0x19')]['code']===0x1f4){logger['error'](_0xeb49('0x15'),_0x383293,_0x1f2e84[_0xeb49('0x19')][_0xeb49('0x1a')]);return _0x215aad(_0x1f2e84[_0xeb49('0x19')][_0xeb49('0x1a')]);}logger[_0xeb49('0x19')](_0xeb49('0x15'),_0x383293,_0x1f2e84['error'][_0xeb49('0x1a')]);return _0x339113(_0x1f2e84[_0xeb49('0x19')][_0xeb49('0x1a')]);}else{logger['info'](_0xeb49('0x15'),_0x383293,_0xeb49('0x16'));_0x339113(_0x1f2e84[_0xeb49('0x1b')][_0xeb49('0x1a')]);}})[_0xeb49('0x1c')](function(_0x1bff6d){logger[_0xeb49('0x19')](_0xeb49('0x15'),_0x383293,_0x1bff6d);_0x215aad(_0x1bff6d);});});}exports['ShowWhatsappAccount']=function(_0x1baafa){var _0x46f8d9=this;return new Promise(function(_0x515b5a,_0x17514e){return db['WhatsappAccount']['find']({'raw':_0x1baafa[_0xeb49('0x1d')]?_0x1baafa['options'][_0xeb49('0x1e')]===undefined?!![]:![]:!![],'where':_0x1baafa[_0xeb49('0x1d')]?_0x1baafa[_0xeb49('0x1d')]['where']||null:null,'attributes':_0x1baafa[_0xeb49('0x1d')]?_0x1baafa[_0xeb49('0x1d')]['attributes']||null:null,'include':_0x1baafa[_0xeb49('0x1d')]?_0x1baafa[_0xeb49('0x1d')]['include']?_[_0xeb49('0x1f')](_0x1baafa[_0xeb49('0x1d')][_0xeb49('0x20')],function(_0x55a567){return{'model':db[_0x55a567[_0xeb49('0x21')]],'as':_0x55a567['as'],'attributes':_0x55a567[_0xeb49('0x22')],'include':_0x55a567[_0xeb49('0x20')]?_[_0xeb49('0x1f')](_0x55a567[_0xeb49('0x20')],function(_0xe994d1){return{'model':db[_0xe994d1['model']],'as':_0xe994d1['as'],'attributes':_0xe994d1['attributes'],'include':_0xe994d1[_0xeb49('0x20')]?_[_0xeb49('0x1f')](_0xe994d1[_0xeb49('0x20')],function(_0x42c73b){return{'model':db[_0x42c73b[_0xeb49('0x21')]],'as':_0x42c73b['as'],'attributes':_0x42c73b[_0xeb49('0x22')]};}):[]};}):[]};}):[]:[]})[_0xeb49('0x13')](function(_0x3135e9){logger[_0xeb49('0x14')](_0xeb49('0x23'),_0x1baafa);logger[_0xeb49('0x17')](_0xeb49('0x23'),_0x1baafa,JSON[_0xeb49('0x24')](_0x3135e9));_0x515b5a(_0x3135e9);})['catch'](function(_0x18d897){logger[_0xeb49('0x19')](_0xeb49('0x23'),_0x18d897[_0xeb49('0x1a')],_0x1baafa);_0x17514e(_0x46f8d9['error'](0x1f4,_0x18d897['message']));});});}; \ No newline at end of file +var _0x659b=['find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0x659b,0x7a));var _0xb659=function(_0x1df255,_0x4b6118){_0x1df255=_0x1df255-0x0;var _0x7024c6=_0x659b[_0x1df255];return _0x7024c6;};'use strict';var _=require(_0xb659('0x0'));var util=require(_0xb659('0x1'));var moment=require(_0xb659('0x2'));var BPromise=require(_0xb659('0x3'));var rs=require(_0xb659('0x4'));var fs=require('fs');var Redis=require(_0xb659('0x5'));var db=require(_0xb659('0x6'))['db'];var utils=require(_0xb659('0x7'));var logger=require('../../config/logger')(_0xb659('0x8'));var config=require(_0xb659('0x9'));var jayson=require(_0xb659('0xa'));var client=jayson[_0xb659('0xb')]['http']({'port':0x232a});config[_0xb659('0xc')]=_['defaults'](config[_0xb659('0xc')],{'host':_0xb659('0xd'),'port':0x18eb});var socket=require(_0xb659('0xe'))(new Redis(config[_0xb659('0xc')]));require(_0xb659('0xf'))[_0xb659('0x10')](socket);function respondWithRpcPromise(_0x13e67a,_0x14bec3,_0xddd554){return new BPromise(function(_0x5d4619,_0x7992b){return client['request'](_0x13e67a,_0xddd554)[_0xb659('0x11')](function(_0x447723){logger[_0xb659('0x12')](_0xb659('0x13'),_0x14bec3,_0xb659('0x14'));logger[_0xb659('0x15')](_0xb659('0x16'),_0x14bec3,_0xb659('0x14'),JSON[_0xb659('0x17')](_0x447723));if(_0x447723[_0xb659('0x18')]){if(_0x447723[_0xb659('0x18')][_0xb659('0x19')]===0x1f4){logger[_0xb659('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x14bec3,_0x447723[_0xb659('0x18')][_0xb659('0x1a')]);return _0x7992b(_0x447723[_0xb659('0x18')][_0xb659('0x1a')]);}logger[_0xb659('0x18')](_0xb659('0x13'),_0x14bec3,_0x447723[_0xb659('0x18')][_0xb659('0x1a')]);return _0x5d4619(_0x447723[_0xb659('0x18')]['message']);}else{logger[_0xb659('0x12')](_0xb659('0x13'),_0x14bec3,_0xb659('0x14'));_0x5d4619(_0x447723[_0xb659('0x1b')][_0xb659('0x1a')]);}})[_0xb659('0x1c')](function(_0xb17e69){logger[_0xb659('0x18')](_0xb659('0x13'),_0x14bec3,_0xb17e69);_0x7992b(_0xb17e69);});});}exports[_0xb659('0x1d')]=function(_0x4f0896){var _0x451c91=this;return new Promise(function(_0x14bee6,_0x4d60d9){return db['WhatsappAccount'][_0xb659('0x1e')]({'raw':_0x4f0896['options']?_0x4f0896['options'][_0xb659('0x1f')]===undefined?!![]:![]:!![],'where':_0x4f0896[_0xb659('0x20')]?_0x4f0896[_0xb659('0x20')][_0xb659('0x21')]||null:null,'attributes':_0x4f0896['options']?_0x4f0896[_0xb659('0x20')][_0xb659('0x22')]||null:null,'include':_0x4f0896[_0xb659('0x20')]?_0x4f0896[_0xb659('0x20')][_0xb659('0x23')]?_[_0xb659('0x24')](_0x4f0896[_0xb659('0x20')][_0xb659('0x23')],function(_0x3fcf4e){return{'model':db[_0x3fcf4e[_0xb659('0x25')]],'as':_0x3fcf4e['as'],'attributes':_0x3fcf4e[_0xb659('0x22')],'include':_0x3fcf4e['include']?_['map'](_0x3fcf4e[_0xb659('0x23')],function(_0x183463){return{'model':db[_0x183463[_0xb659('0x25')]],'as':_0x183463['as'],'attributes':_0x183463[_0xb659('0x22')],'include':_0x183463['include']?_[_0xb659('0x24')](_0x183463['include'],function(_0x1d7539){return{'model':db[_0x1d7539[_0xb659('0x25')]],'as':_0x1d7539['as'],'attributes':_0x1d7539[_0xb659('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb659('0x11')](function(_0x10c5ba){logger[_0xb659('0x12')](_0xb659('0x1d'),_0x4f0896);logger[_0xb659('0x15')](_0xb659('0x1d'),_0x4f0896,JSON[_0xb659('0x17')](_0x10c5ba));_0x14bee6(_0x10c5ba);})['catch'](function(_0x1b4d2e){logger[_0xb659('0x18')]('ShowWhatsappAccount',_0x1b4d2e[_0xb659('0x1a')],_0x4f0896);_0x4d60d9(_0x451c91[_0xb659('0x18')](0x1f4,_0x1b4d2e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e9bb7e3..6856971 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 _0x1546=['whatsappAccount:','save','update','emit','length'];(function(_0x13cb72,_0x390a50){var _0x3c7452=function(_0x83d91d){while(--_0x83d91d){_0x13cb72['push'](_0x13cb72['shift']());}};_0x3c7452(++_0x390a50);}(_0x1546,0x92));var _0x6154=function(_0x4cf798,_0x2ffa8a){_0x4cf798=_0x4cf798-0x0;var _0x2d9a48=_0x1546[_0x4cf798];return _0x2d9a48;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x6154('0x0'),'remove',_0x6154('0x1')];function createListener(_0x44d3b9,_0x37ea7a){return function(_0xe46cd6){_0x37ea7a[_0x6154('0x2')](_0x44d3b9,_0xe46cd6);};}function removeListener(_0xaeb370,_0x6c46b4){return function(){WhatsappAccountEvents['removeListener'](_0xaeb370,_0x6c46b4);};}exports['register']=function(_0x5e33c2){for(var _0x583b8e=0x0,_0x20cac1=events[_0x6154('0x3')];_0x583b8e<_0x20cac1;_0x583b8e++){var _0x5217e3=events[_0x583b8e];var _0x53c70b=createListener(_0x6154('0x4')+_0x5217e3,_0x5e33c2);WhatsappAccountEvents['on'](_0x5217e3,_0x53c70b);}}; \ No newline at end of file +var _0x3bd2=['update','emit','removeListener','register','length','./whatsappAccount.events','save','remove'];(function(_0x1b106d,_0x43b124){var _0x2c4a21=function(_0x26ac72){while(--_0x26ac72){_0x1b106d['push'](_0x1b106d['shift']());}};_0x2c4a21(++_0x43b124);}(_0x3bd2,0x1b5));var _0x23bd=function(_0x56d4f4,_0x4a7172){_0x56d4f4=_0x56d4f4-0x0;var _0x30dfcf=_0x3bd2[_0x56d4f4];return _0x30dfcf;};'use strict';var WhatsappAccountEvents=require(_0x23bd('0x0'));var events=[_0x23bd('0x1'),_0x23bd('0x2'),_0x23bd('0x3')];function createListener(_0x312822,_0x56194b){return function(_0x45710e){_0x56194b[_0x23bd('0x4')](_0x312822,_0x45710e);};}function removeListener(_0x468649,_0x3d8dfd){return function(){WhatsappAccountEvents[_0x23bd('0x5')](_0x468649,_0x3d8dfd);};}exports[_0x23bd('0x6')]=function(_0x1c48e1){for(var _0xa89c08=0x0,_0x1257a4=events[_0x23bd('0x7')];_0xa89c08<_0x1257a4;_0xa89c08++){var _0x306e32=events[_0xa89c08];var _0x1e44ac=createListener('whatsappAccount:'+_0x306e32,_0x1c48e1);WhatsappAccountEvents['on'](_0x306e32,_0x1e44ac);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 314d319..a9a6189 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 _0x2fa7=['multer','util','connect-timeout','express','../../components/auth/service','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports'];(function(_0x503fa1,_0x3d839e){var _0x21fa41=function(_0xa9a5e6){while(--_0xa9a5e6){_0x503fa1['push'](_0x503fa1['shift']());}};_0x21fa41(++_0x3d839e);}(_0x2fa7,0xc4));var _0x72fa=function(_0x308a05,_0x2d4d9a){_0x308a05=_0x308a05-0x0;var _0x537408=_0x2fa7[_0x308a05];return _0x537408;};'use strict';var multer=require(_0x72fa('0x0'));var util=require(_0x72fa('0x1'));var path=require('path');var timeout=require(_0x72fa('0x2'));var express=require(_0x72fa('0x3'));var router=express['Router']();var auth=require(_0x72fa('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x72fa('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x72fa('0x5')](_0x72fa('0x6'),auth[_0x72fa('0x7')](),controller['show']);router[_0x72fa('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x72fa('0x9')](_0x72fa('0x6'),auth['isAuthenticated'](),controller[_0x72fa('0xa')]);router[_0x72fa('0xb')]('/:id',auth[_0x72fa('0x7')](),controller[_0x72fa('0xc')]);module[_0x72fa('0xd')]=router; \ No newline at end of file +var _0x1afa=['delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x59c576,_0x4a1c8f){var _0x148dfe=function(_0x220317){while(--_0x220317){_0x59c576['push'](_0x59c576['shift']());}};_0x148dfe(++_0x4a1c8f);}(_0x1afa,0xf0));var _0xa1af=function(_0x34e65c,_0x595e2b){_0x34e65c=_0x34e65c-0x0;var _0x2e100f=_0x1afa[_0x34e65c];return _0x2e100f;};'use strict';var multer=require(_0xa1af('0x0'));var util=require(_0xa1af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa1af('0x2'));var router=express[_0xa1af('0x3')]();var auth=require(_0xa1af('0x4'));var interaction=require(_0xa1af('0x5'));var config=require(_0xa1af('0x6'));var controller=require('./whatsappApplication.controller');router[_0xa1af('0x7')]('/',auth[_0xa1af('0x8')](),controller[_0xa1af('0x9')]);router[_0xa1af('0x7')](_0xa1af('0xa'),auth['isAuthenticated'](),controller[_0xa1af('0xb')]);router[_0xa1af('0xc')]('/',auth[_0xa1af('0x8')](),controller['create']);router[_0xa1af('0xd')]('/:id',auth[_0xa1af('0x8')](),controller[_0xa1af('0xe')]);router[_0xa1af('0xf')]('/:id',auth[_0xa1af('0x8')](),controller['destroy']);module[_0xa1af('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index c6ab49e..904dffa 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 _0x36e3=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0xc4e092,_0x5059f7){var _0xa4f542=function(_0x302769){while(--_0x302769){_0xc4e092['push'](_0xc4e092['shift']());}};_0xa4f542(++_0x5059f7);}(_0x36e3,0xf7));var _0x336e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x36e3[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x336e('0x0'));module[_0x336e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x336e('0x2')],'allowNull':![],'defaultValue':_0x336e('0x3')},'appdata':{'type':Sequelize[_0x336e('0x4')]()},'description':{'type':Sequelize[_0x336e('0x2')]},'interval':{'type':Sequelize[_0x336e('0x2')],'defaultValue':_0x336e('0x5')}}; \ No newline at end of file +var _0xb50d=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x3f73c0,_0x56deaa){var _0xe16258=function(_0x3b6477){while(--_0x3b6477){_0x3f73c0['push'](_0x3f73c0['shift']());}};_0xe16258(++_0x56deaa);}(_0xb50d,0xef));var _0xdb50=function(_0x2e17e4,_0x2b2c72){_0x2e17e4=_0x2e17e4-0x0;var _0x326563=_0xb50d[_0x2e17e4];return _0x326563;};'use strict';var Sequelize=require(_0xdb50('0x0'));module[_0xdb50('0x1')]={'priority':{'type':Sequelize[_0xdb50('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb50('0x3')},'appdata':{'type':Sequelize[_0xdb50('0x4')]()},'description':{'type':Sequelize[_0xdb50('0x5')]},'interval':{'type':Sequelize[_0xdb50('0x5')],'defaultValue':_0xdb50('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index f1db991..eae9921 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 _0x5fd3=['then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','WhatsappApplication','includeAll','include','rows','catch','show','params','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','update','destroy'];(function(_0x319fa0,_0x31377a){var _0x464fee=function(_0x503a37){while(--_0x503a37){_0x319fa0['push'](_0x319fa0['shift']());}};_0x464fee(++_0x31377a);}(_0x5fd3,0x146));var _0x35fd=function(_0x56229f,_0x58fe45){_0x56229f=_0x56229f-0x0;var _0x2528e3=_0x5fd3[_0x56229f];return _0x2528e3;};'use strict';var pdf=require(_0x35fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x35fd('0x1'));var zipdir=require(_0x35fd('0x2'));var jsonpatch=require(_0x35fd('0x3'));var rp=require(_0x35fd('0x4'));var moment=require(_0x35fd('0x5'));var BPromise=require(_0x35fd('0x6'));var Mustache=require(_0x35fd('0x7'));var util=require(_0x35fd('0x8'));var path=require(_0x35fd('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x35fd('0xa'));var fs=require('fs');var _=require(_0x35fd('0xb'));var squel=require(_0x35fd('0xc'));var crypto=require(_0x35fd('0xd'));var jsforce=require(_0x35fd('0xe'));var deskjs=require(_0x35fd('0xf'));var toCsv=require(_0x35fd('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35fd('0x11'));var qs=require(_0x35fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35fd('0x13'));var logger=require('../../config/logger')(_0x35fd('0x14'));var utils=require(_0x35fd('0x15'));var config=require(_0x35fd('0x16'));var db=require(_0x35fd('0x17'))['db'];function respondWithStatusCode(_0x4c1229,_0x49e0da){_0x49e0da=_0x49e0da||0xcc;return function(_0x446068){if(_0x446068){return _0x4c1229[_0x35fd('0x18')](_0x49e0da);}return _0x4c1229['status'](_0x49e0da)[_0x35fd('0x19')]();};}function respondWithResult(_0x9f425a,_0x1f81a8){_0x1f81a8=_0x1f81a8||0xc8;return function(_0x26f722){if(_0x26f722){return _0x9f425a[_0x35fd('0x1a')](_0x1f81a8)[_0x35fd('0x1b')](_0x26f722);}};}function respondWithFilteredResult(_0x515808,_0x5c9938){return function(_0x4aac43){if(_0x4aac43){var _0x35b0e6=_0x4aac43[_0x35fd('0x1c')],_0x2917ee=_0x5c9938[_0x35fd('0x1d')],_0x216550=_0x5c9938[_0x35fd('0x1d')]+_0x5c9938['limit'],_0xd0aff6;if(_0x216550>=_0x35b0e6){_0x216550=_0x35b0e6;_0xd0aff6=0xc8;}else{_0xd0aff6=0xce;}_0x515808[_0x35fd('0x1a')](_0xd0aff6);return _0x515808[_0x35fd('0x1e')](_0x35fd('0x1f'),_0x2917ee+'-'+_0x216550+'/'+_0x35b0e6)[_0x35fd('0x1b')](_0x4aac43);}return null;};}function patchUpdates(_0x4467c9){return function(_0x3a9173){try{jsonpatch['apply'](_0x3a9173,_0x4467c9,!![]);}catch(_0x389d0a){return BPromise['reject'](_0x389d0a);}return _0x3a9173['save']();};}function saveUpdates(_0x72352a,_0x4562f7){return function(_0x3de452){if(_0x3de452){return _0x3de452[_0x35fd('0x20')](_0x72352a)['then'](function(_0x2219f8){return _0x2219f8;});}return null;};}function removeEntity(_0x5017a,_0x181cdc){return function(_0x14e667){if(_0x14e667){return _0x14e667[_0x35fd('0x21')]()[_0x35fd('0x22')](function(){_0x5017a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x315984,_0x207f20){return function(_0x1d2523){if(!_0x1d2523){_0x315984['sendStatus'](0x194);}return _0x1d2523;};}function handleError(_0x2cfdf0,_0x5bf6f1){_0x5bf6f1=_0x5bf6f1||0x1f4;return function(_0x58da6e){logger[_0x35fd('0x23')](_0x58da6e['stack']);if(_0x58da6e[_0x35fd('0x24')]){delete _0x58da6e[_0x35fd('0x24')];}_0x2cfdf0[_0x35fd('0x1a')](_0x5bf6f1)[_0x35fd('0x25')](_0x58da6e);};}exports[_0x35fd('0x26')]=function(_0x230f8f,_0x12c4df){var _0x3eb2e3={},_0x127be5={},_0x5aec91={'count':0x0,'rows':[]};var _0x126976=_[_0x35fd('0x27')](db['WhatsappApplication'][_0x35fd('0x28')],function(_0x2f5eba){return{'name':_0x2f5eba[_0x35fd('0x29')],'type':_0x2f5eba[_0x35fd('0x2a')][_0x35fd('0x2b')]};});_0x127be5[_0x35fd('0x2c')]=_['map'](_0x126976,'name');_0x127be5[_0x35fd('0x2d')]=_[_0x35fd('0x2e')](_0x230f8f['query']);_0x127be5[_0x35fd('0x2f')]=_['intersection'](_0x127be5[_0x35fd('0x2c')],_0x127be5[_0x35fd('0x2d')]);_0x3eb2e3[_0x35fd('0x30')]=_[_0x35fd('0x31')](_0x127be5[_0x35fd('0x2c')],qs[_0x35fd('0x32')](_0x230f8f[_0x35fd('0x2d')][_0x35fd('0x32')]));_0x3eb2e3[_0x35fd('0x30')]=_0x3eb2e3[_0x35fd('0x30')][_0x35fd('0x33')]?_0x3eb2e3[_0x35fd('0x30')]:_0x127be5[_0x35fd('0x2c')];if(!_0x230f8f[_0x35fd('0x2d')]['hasOwnProperty'](_0x35fd('0x34'))){_0x3eb2e3[_0x35fd('0x35')]=qs[_0x35fd('0x35')](_0x230f8f['query'][_0x35fd('0x35')]);_0x3eb2e3['offset']=qs[_0x35fd('0x1d')](_0x230f8f[_0x35fd('0x2d')][_0x35fd('0x1d')]);}_0x3eb2e3[_0x35fd('0x36')]=qs[_0x35fd('0x37')](_0x230f8f[_0x35fd('0x2d')][_0x35fd('0x37')]);_0x3eb2e3[_0x35fd('0x38')]=qs[_0x35fd('0x2f')](_[_0x35fd('0x39')](_0x230f8f[_0x35fd('0x2d')],_0x127be5[_0x35fd('0x2f')]),_0x126976);if(_0x230f8f[_0x35fd('0x2d')]['filter']){_0x3eb2e3[_0x35fd('0x38')]=_[_0x35fd('0x3a')](_0x3eb2e3[_0x35fd('0x38')],{'$or':_[_0x35fd('0x27')](_0x126976,function(_0x289d45){if(_0x289d45[_0x35fd('0x2a')]!==_0x35fd('0x3b')){var _0x49c878={};_0x49c878[_0x289d45[_0x35fd('0x24')]]={'$like':'%'+_0x230f8f[_0x35fd('0x2d')][_0x35fd('0x3c')]+'%'};return _0x49c878;}})});}_0x3eb2e3=_['merge']({},_0x3eb2e3,_0x230f8f['options']);var _0x335a27={'where':_0x3eb2e3['where']};return db[_0x35fd('0x3d')][_0x35fd('0x1c')](_0x335a27)[_0x35fd('0x22')](function(_0x2c3f1c){_0x5aec91[_0x35fd('0x1c')]=_0x2c3f1c;if(_0x230f8f[_0x35fd('0x2d')][_0x35fd('0x3e')]){_0x3eb2e3[_0x35fd('0x3f')]=[{'all':!![]}];}return db[_0x35fd('0x3d')]['findAll'](_0x3eb2e3);})[_0x35fd('0x22')](function(_0x5b695f){_0x5aec91[_0x35fd('0x40')]=_0x5b695f;return _0x5aec91;})[_0x35fd('0x22')](respondWithFilteredResult(_0x12c4df,_0x3eb2e3))[_0x35fd('0x41')](handleError(_0x12c4df,null));};exports[_0x35fd('0x42')]=function(_0x456ab1,_0x1cc2f3){var _0x170239={'raw':!![],'where':{'id':_0x456ab1[_0x35fd('0x43')]['id']}},_0x12f774={};_0x12f774[_0x35fd('0x2c')]=_[_0x35fd('0x2e')](db[_0x35fd('0x3d')][_0x35fd('0x28')]);_0x12f774['query']=_[_0x35fd('0x2e')](_0x456ab1[_0x35fd('0x2d')]);_0x12f774[_0x35fd('0x2f')]=_[_0x35fd('0x31')](_0x12f774[_0x35fd('0x2c')],_0x12f774[_0x35fd('0x2d')]);_0x170239[_0x35fd('0x30')]=_['intersection'](_0x12f774[_0x35fd('0x2c')],qs[_0x35fd('0x32')](_0x456ab1[_0x35fd('0x2d')][_0x35fd('0x32')]));_0x170239['attributes']=_0x170239[_0x35fd('0x30')]['length']?_0x170239[_0x35fd('0x30')]:_0x12f774[_0x35fd('0x2c')];if(_0x456ab1[_0x35fd('0x2d')][_0x35fd('0x3e')]){_0x170239['include']=[{'all':!![]}];}_0x170239=_[_0x35fd('0x3a')]({},_0x170239,_0x456ab1[_0x35fd('0x44')]);return db['WhatsappApplication'][_0x35fd('0x45')](_0x170239)[_0x35fd('0x22')](handleEntityNotFound(_0x1cc2f3,null))['then'](respondWithResult(_0x1cc2f3,null))[_0x35fd('0x41')](handleError(_0x1cc2f3,null));};exports[_0x35fd('0x46')]=function(_0x395195,_0x31bd9d){return db['WhatsappApplication'][_0x35fd('0x46')](_0x395195[_0x35fd('0x47')],{})['then'](respondWithResult(_0x31bd9d,0xc9))[_0x35fd('0x41')](handleError(_0x31bd9d,null));};exports[_0x35fd('0x20')]=function(_0x259ba4,_0x4b5f71){if(_0x259ba4[_0x35fd('0x47')]['id']){delete _0x259ba4[_0x35fd('0x47')]['id'];}return db[_0x35fd('0x3d')][_0x35fd('0x45')]({'where':{'id':_0x259ba4['params']['id']}})[_0x35fd('0x22')](handleEntityNotFound(_0x4b5f71,null))[_0x35fd('0x22')](saveUpdates(_0x259ba4[_0x35fd('0x47')],null))['then'](respondWithResult(_0x4b5f71,null))['catch'](handleError(_0x4b5f71,null));};exports[_0x35fd('0x21')]=function(_0x4bc715,_0x404eb2){return db[_0x35fd('0x3d')]['find']({'where':{'id':_0x4bc715['params']['id']}})[_0x35fd('0x22')](handleEntityNotFound(_0x404eb2,null))[_0x35fd('0x22')](removeEntity(_0x404eb2,null))[_0x35fd('0x41')](handleError(_0x404eb2,null));}; \ No newline at end of file +var _0x719a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','model','keys','query','filters','attributes','fields','length','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','intersection','find','catch','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x541732,_0x4e70c3){var _0x12cb33=function(_0xb7bee1){while(--_0xb7bee1){_0x541732['push'](_0x541732['shift']());}};_0x12cb33(++_0x4e70c3);}(_0x719a,0x151));var _0xa719=function(_0x55195b,_0xbaae4c){_0x55195b=_0x55195b-0x0;var _0x3cdf53=_0x719a[_0x55195b];return _0x3cdf53;};'use strict';var pdf=require(_0xa719('0x0'));var emlformat=require(_0xa719('0x1'));var rimraf=require(_0xa719('0x2'));var zipdir=require(_0xa719('0x3'));var jsonpatch=require(_0xa719('0x4'));var rp=require(_0xa719('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa719('0x6'));var csv=require(_0xa719('0x7'));var ejs=require(_0xa719('0x8'));var fs=require('fs');var _=require(_0xa719('0x9'));var squel=require(_0xa719('0xa'));var crypto=require(_0xa719('0xb'));var jsforce=require(_0xa719('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa719('0x7'));var querystring=require(_0xa719('0xd'));var Papa=require(_0xa719('0xe'));var Redis=require(_0xa719('0xf'));var authService=require(_0xa719('0x10'));var qs=require(_0xa719('0x11'));var as=require(_0xa719('0x12'));var hardwareService=require(_0xa719('0x13'));var logger=require(_0xa719('0x14'))('api');var utils=require(_0xa719('0x15'));var config=require(_0xa719('0x16'));var db=require(_0xa719('0x17'))['db'];function respondWithStatusCode(_0x22ce76,_0x37a7f8){_0x37a7f8=_0x37a7f8||0xcc;return function(_0x5739d8){if(_0x5739d8){return _0x22ce76['sendStatus'](_0x37a7f8);}return _0x22ce76[_0xa719('0x18')](_0x37a7f8)[_0xa719('0x19')]();};}function respondWithResult(_0x93e41a,_0x2cb813){_0x2cb813=_0x2cb813||0xc8;return function(_0xc871){if(_0xc871){return _0x93e41a[_0xa719('0x18')](_0x2cb813)['json'](_0xc871);}};}function respondWithFilteredResult(_0x44d1fc,_0x2d3fcd){return function(_0x2626e6){if(_0x2626e6){var _0x573215=_0x2626e6[_0xa719('0x1a')],_0x29f3fa=_0x2d3fcd['offset'],_0x608db6=_0x2d3fcd[_0xa719('0x1b')]+_0x2d3fcd[_0xa719('0x1c')],_0x21c014;if(_0x608db6>=_0x573215){_0x608db6=_0x573215;_0x21c014=0xc8;}else{_0x21c014=0xce;}_0x44d1fc[_0xa719('0x18')](_0x21c014);return _0x44d1fc[_0xa719('0x1d')](_0xa719('0x1e'),_0x29f3fa+'-'+_0x608db6+'/'+_0x573215)[_0xa719('0x1f')](_0x2626e6);}return null;};}function patchUpdates(_0x832736){return function(_0x585701){try{jsonpatch[_0xa719('0x20')](_0x585701,_0x832736,!![]);}catch(_0x46e9e3){return BPromise['reject'](_0x46e9e3);}return _0x585701[_0xa719('0x21')]();};}function saveUpdates(_0xbcc509,_0x431fb3){return function(_0x50656b){if(_0x50656b){return _0x50656b[_0xa719('0x22')](_0xbcc509)[_0xa719('0x23')](function(_0x5109a7){return _0x5109a7;});}return null;};}function removeEntity(_0x3273f7,_0x482a98){return function(_0x5deff7){if(_0x5deff7){return _0x5deff7['destroy']()[_0xa719('0x23')](function(){_0x3273f7[_0xa719('0x18')](0xcc)[_0xa719('0x19')]();});}};}function handleEntityNotFound(_0x4ef9f6,_0x170a4b){return function(_0x2405d8){if(!_0x2405d8){_0x4ef9f6[_0xa719('0x24')](0x194);}return _0x2405d8;};}function handleError(_0x3d7a54,_0x180de5){_0x180de5=_0x180de5||0x1f4;return function(_0x377eac){logger[_0xa719('0x25')](_0x377eac[_0xa719('0x26')]);if(_0x377eac[_0xa719('0x27')]){delete _0x377eac['name'];}_0x3d7a54[_0xa719('0x18')](_0x180de5)['send'](_0x377eac);};}exports[_0xa719('0x28')]=function(_0x3ea2cd,_0x3e1ae6){var _0x5a8407={},_0x319713={},_0x322811={'count':0x0,'rows':[]};var _0x4354ab=_[_0xa719('0x29')](db[_0xa719('0x2a')][_0xa719('0x2b')],function(_0x12fcd9){return{'name':_0x12fcd9[_0xa719('0x2c')],'type':_0x12fcd9['type']['key']};});_0x319713[_0xa719('0x2d')]=_[_0xa719('0x29')](_0x4354ab,_0xa719('0x27'));_0x319713['query']=_[_0xa719('0x2e')](_0x3ea2cd[_0xa719('0x2f')]);_0x319713[_0xa719('0x30')]=_['intersection'](_0x319713[_0xa719('0x2d')],_0x319713['query']);_0x5a8407[_0xa719('0x31')]=_['intersection'](_0x319713[_0xa719('0x2d')],qs[_0xa719('0x32')](_0x3ea2cd['query'][_0xa719('0x32')]));_0x5a8407[_0xa719('0x31')]=_0x5a8407[_0xa719('0x31')][_0xa719('0x33')]?_0x5a8407[_0xa719('0x31')]:_0x319713[_0xa719('0x2d')];if(!_0x3ea2cd[_0xa719('0x2f')]['hasOwnProperty'](_0xa719('0x34'))){_0x5a8407[_0xa719('0x1c')]=qs['limit'](_0x3ea2cd['query'][_0xa719('0x1c')]);_0x5a8407['offset']=qs[_0xa719('0x1b')](_0x3ea2cd['query'][_0xa719('0x1b')]);}_0x5a8407['order']=qs[_0xa719('0x35')](_0x3ea2cd[_0xa719('0x2f')][_0xa719('0x35')]);_0x5a8407['where']=qs[_0xa719('0x30')](_[_0xa719('0x36')](_0x3ea2cd[_0xa719('0x2f')],_0x319713['filters']),_0x4354ab);if(_0x3ea2cd['query'][_0xa719('0x37')]){_0x5a8407['where']=_[_0xa719('0x38')](_0x5a8407[_0xa719('0x39')],{'$or':_['map'](_0x4354ab,function(_0x31c632){if(_0x31c632[_0xa719('0x3a')]!==_0xa719('0x3b')){var _0x42fcca={};_0x42fcca[_0x31c632[_0xa719('0x27')]]={'$like':'%'+_0x3ea2cd[_0xa719('0x2f')][_0xa719('0x37')]+'%'};return _0x42fcca;}})});}_0x5a8407=_[_0xa719('0x38')]({},_0x5a8407,_0x3ea2cd[_0xa719('0x3c')]);var _0x45dae8={'where':_0x5a8407[_0xa719('0x39')]};return db['WhatsappApplication'][_0xa719('0x1a')](_0x45dae8)[_0xa719('0x23')](function(_0x8b8059){_0x322811[_0xa719('0x1a')]=_0x8b8059;if(_0x3ea2cd['query'][_0xa719('0x3d')]){_0x5a8407[_0xa719('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xa719('0x3f')](_0x5a8407);})['then'](function(_0x56cf9c){_0x322811[_0xa719('0x40')]=_0x56cf9c;return _0x322811;})[_0xa719('0x23')](respondWithFilteredResult(_0x3e1ae6,_0x5a8407))['catch'](handleError(_0x3e1ae6,null));};exports['show']=function(_0x2f2d29,_0x1864fa){var _0x31501b={'raw':!![],'where':{'id':_0x2f2d29[_0xa719('0x41')]['id']}},_0x2ad96a={};_0x2ad96a[_0xa719('0x2d')]=_['keys'](db['WhatsappApplication'][_0xa719('0x2b')]);_0x2ad96a['query']=_[_0xa719('0x2e')](_0x2f2d29[_0xa719('0x2f')]);_0x2ad96a[_0xa719('0x30')]=_[_0xa719('0x42')](_0x2ad96a[_0xa719('0x2d')],_0x2ad96a[_0xa719('0x2f')]);_0x31501b[_0xa719('0x31')]=_['intersection'](_0x2ad96a[_0xa719('0x2d')],qs[_0xa719('0x32')](_0x2f2d29[_0xa719('0x2f')][_0xa719('0x32')]));_0x31501b[_0xa719('0x31')]=_0x31501b[_0xa719('0x31')][_0xa719('0x33')]?_0x31501b[_0xa719('0x31')]:_0x2ad96a[_0xa719('0x2d')];if(_0x2f2d29[_0xa719('0x2f')][_0xa719('0x3d')]){_0x31501b[_0xa719('0x3e')]=[{'all':!![]}];}_0x31501b=_[_0xa719('0x38')]({},_0x31501b,_0x2f2d29[_0xa719('0x3c')]);return db[_0xa719('0x2a')][_0xa719('0x43')](_0x31501b)[_0xa719('0x23')](handleEntityNotFound(_0x1864fa,null))[_0xa719('0x23')](respondWithResult(_0x1864fa,null))[_0xa719('0x44')](handleError(_0x1864fa,null));};exports['create']=function(_0x1aa83e,_0x2af8cb){return db[_0xa719('0x2a')]['create'](_0x1aa83e[_0xa719('0x45')],{})[_0xa719('0x23')](respondWithResult(_0x2af8cb,0xc9))[_0xa719('0x44')](handleError(_0x2af8cb,null));};exports[_0xa719('0x22')]=function(_0x3cef6e,_0x255c3b){if(_0x3cef6e[_0xa719('0x45')]['id']){delete _0x3cef6e[_0xa719('0x45')]['id'];}return db[_0xa719('0x2a')][_0xa719('0x43')]({'where':{'id':_0x3cef6e[_0xa719('0x41')]['id']}})[_0xa719('0x23')](handleEntityNotFound(_0x255c3b,null))[_0xa719('0x23')](saveUpdates(_0x3cef6e[_0xa719('0x45')],null))['then'](respondWithResult(_0x255c3b,null))[_0xa719('0x44')](handleError(_0x255c3b,null));};exports[_0xa719('0x46')]=function(_0x452651,_0x5c4fe6){return db[_0xa719('0x2a')]['find']({'where':{'id':_0x452651['params']['id']}})[_0xa719('0x23')](handleEntityNotFound(_0x5c4fe6,null))[_0xa719('0x23')](removeEntity(_0x5c4fe6,null))[_0xa719('0x44')](handleError(_0x5c4fe6,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 79d22be..f2c5ffd 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 _0x9a2a=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x16ce60,_0x1fb180){_0x16ce60=_0x16ce60-0x0;var _0x2c7947=_0x9a2a[_0x16ce60];return _0x2c7947;};'use strict';var _=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var logger=require(_0xa9a2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa9a2('0x3'));var fs=require('fs');var path=require(_0xa9a2('0x4'));var rimraf=require(_0xa9a2('0x5'));var config=require(_0xa9a2('0x6'));var attributes=require(_0xa9a2('0x7'));module[_0xa9a2('0x8')]=function(_0x4d5f04,_0x5c5e56){return _0x4d5f04[_0xa9a2('0x9')](_0xa9a2('0xa'),attributes,{'tableName':_0xa9a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa9a2('0xc'),'collate':_0xa9a2('0xd')});}; \ No newline at end of file +var _0x205d=['../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1bfdf2,_0x492061){var _0x52a4d5=function(_0x5f4b08){while(--_0x5f4b08){_0x1bfdf2['push'](_0x1bfdf2['shift']());}};_0x52a4d5(++_0x492061);}(_0x205d,0xf6));var _0xd205=function(_0x52ce3e,_0x25abc7){_0x52ce3e=_0x52ce3e-0x0;var _0x49f0ef=_0x205d[_0x52ce3e];return _0x49f0ef;};'use strict';var _=require(_0xd205('0x0'));var util=require(_0xd205('0x1'));var logger=require(_0xd205('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd205('0x3'));var rp=require(_0xd205('0x4'));var fs=require('fs');var path=require(_0xd205('0x5'));var rimraf=require('rimraf');var config=require(_0xd205('0x6'));var attributes=require(_0xd205('0x7'));module[_0xd205('0x8')]=function(_0x45a533,_0x4c078b){return _0x45a533[_0xd205('0x9')](_0xd205('0xa'),attributes,{'tableName':_0xd205('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd205('0xc'),'collate':_0xd205('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9fc77cf..361b428 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 _0x7b27=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0x7b27,0x186));var _0x77b2=function(_0x20f083,_0x3760c7){_0x20f083=_0x20f083-0x0;var _0x2e3cf1=_0x7b27[_0x20f083];return _0x2e3cf1;};'use strict';var _=require(_0x77b2('0x0'));var util=require('util');var moment=require(_0x77b2('0x1'));var BPromise=require(_0x77b2('0x2'));var rs=require(_0x77b2('0x3'));var fs=require('fs');var Redis=require(_0x77b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x77b2('0x5'));var logger=require(_0x77b2('0x6'))('rpc');var config=require(_0x77b2('0x7'));var jayson=require(_0x77b2('0x8'));var client=jayson[_0x77b2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22bdcf,_0x2a97d8,_0x2f01a2){return new BPromise(function(_0x1308f7,_0x5139eb){return client[_0x77b2('0xa')](_0x22bdcf,_0x2f01a2)[_0x77b2('0xb')](function(_0x734122){logger[_0x77b2('0xc')](_0x77b2('0xd'),_0x2a97d8,_0x77b2('0xe'));logger[_0x77b2('0xf')](_0x77b2('0x10'),_0x2a97d8,'request\x20sent',JSON[_0x77b2('0x11')](_0x734122));if(_0x734122[_0x77b2('0x12')]){if(_0x734122['error'][_0x77b2('0x13')]===0x1f4){logger['error'](_0x77b2('0xd'),_0x2a97d8,_0x734122[_0x77b2('0x12')]['message']);return _0x5139eb(_0x734122[_0x77b2('0x12')]['message']);}logger[_0x77b2('0x12')](_0x77b2('0xd'),_0x2a97d8,_0x734122[_0x77b2('0x12')][_0x77b2('0x14')]);return _0x1308f7(_0x734122[_0x77b2('0x12')][_0x77b2('0x14')]);}else{logger[_0x77b2('0xc')](_0x77b2('0xd'),_0x2a97d8,_0x77b2('0xe'));_0x1308f7(_0x734122['result']['message']);}})[_0x77b2('0x15')](function(_0x2a85a3){logger[_0x77b2('0x12')](_0x77b2('0xd'),_0x2a97d8,_0x2a85a3);_0x5139eb(_0x2a85a3);});});} \ No newline at end of file +var _0x8958=['client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x8958,0x93));var _0x8895=function(_0x3123c3,_0x3c1c2d){_0x3123c3=_0x3123c3-0x0;var _0x31095d=_0x8958[_0x3123c3];return _0x31095d;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){return client[_0x8895('0x7')](_0x124e1e,_0x33013a)[_0x8895('0x8')](function(_0x24fe49){logger[_0x8895('0x9')](_0x8895('0xa'),_0x40cec6,_0x8895('0xb'));logger[_0x8895('0xc')](_0x8895('0xd'),_0x40cec6,_0x8895('0xb'),JSON['stringify'](_0x24fe49));if(_0x24fe49[_0x8895('0xe')]){if(_0x24fe49[_0x8895('0xe')][_0x8895('0xf')]===0x1f4){logger[_0x8895('0xe')](_0x8895('0xa'),_0x40cec6,_0x24fe49[_0x8895('0xe')]['message']);return _0xe018b8(_0x24fe49[_0x8895('0xe')][_0x8895('0x10')]);}logger[_0x8895('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x40cec6,_0x24fe49['error'][_0x8895('0x10')]);return _0x51376b(_0x24fe49['error'][_0x8895('0x10')]);}else{logger[_0x8895('0x9')](_0x8895('0xa'),_0x40cec6,_0x8895('0xb'));_0x51376b(_0x24fe49[_0x8895('0x11')]['message']);}})[_0x8895('0x12')](function(_0x100fc8){logger[_0x8895('0xe')](_0x8895('0xa'),_0x40cec6,_0x100fc8);_0xe018b8(_0x100fc8);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2c17e8e..b7f38ea 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 _0xf37f=['get','describe','show','/:id/messages','/:id/download','download','create','post','addMessage','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index'];(function(_0x45c08e,_0x3b16c9){var _0x3b15ab=function(_0x26cce2){while(--_0x26cce2){_0x45c08e['push'](_0x45c08e['shift']());}};_0x3b15ab(++_0x3b16c9);}(_0xf37f,0x11a));var _0xff37=function(_0x1c3b6f,_0x5138a3){_0x1c3b6f=_0x1c3b6f-0x0;var _0x5a15ab=_0xf37f[_0x1c3b6f];return _0x5a15ab;};'use strict';var multer=require('multer');var util=require(_0xff37('0x0'));var path=require('path');var timeout=require(_0xff37('0x1'));var express=require(_0xff37('0x2'));var router=express['Router']();var auth=require(_0xff37('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xff37('0x4'));var controller=require(_0xff37('0x5'));router['get']('/',auth[_0xff37('0x6')](),controller[_0xff37('0x7')]);router[_0xff37('0x8')]('/describe',auth[_0xff37('0x6')](),controller[_0xff37('0x9')]);router[_0xff37('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xff37('0xa')]);router[_0xff37('0x8')](_0xff37('0xb'),auth[_0xff37('0x6')](),controller['getMessages']);router[_0xff37('0x8')](_0xff37('0xc'),auth[_0xff37('0x6')](),controller[_0xff37('0xd')]);router['post']('/',auth[_0xff37('0x6')](),controller[_0xff37('0xe')]);router[_0xff37('0xf')]('/:id/messages',auth[_0xff37('0x6')](),controller[_0xff37('0x10')]);router[_0xff37('0xf')]('/:id/tags',auth[_0xff37('0x6')](),interaction[_0xff37('0x11')](_0xff37('0x12'),'whatsappinteraction:addtags'),controller[_0xff37('0x13')]);router[_0xff37('0x14')](_0xff37('0x15'),auth[_0xff37('0x6')](),interaction[_0xff37('0x11')](_0xff37('0x12'),_0xff37('0x16')),controller[_0xff37('0x17')]);router[_0xff37('0x18')](_0xff37('0x15'),auth['isAuthenticated'](),interaction[_0xff37('0x11')](_0xff37('0x12'),'whatsappinteraction:destroy'),controller[_0xff37('0x19')]);router[_0xff37('0x18')](_0xff37('0x1a'),auth['isAuthenticated'](),controller[_0xff37('0x1b')]);module[_0xff37('0x1c')]=router; \ No newline at end of file +var _0xc7c6=['/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','get','index'];(function(_0x39a04c,_0x2b4002){var _0x580cb0=function(_0x138902){while(--_0x138902){_0x39a04c['push'](_0x39a04c['shift']());}};_0x580cb0(++_0x2b4002);}(_0xc7c6,0x14a));var _0x6c7c=function(_0xfba02c,_0x4c50cf){_0xfba02c=_0xfba02c-0x0;var _0x3f9831=_0xc7c6[_0xfba02c];return _0x3f9831;};'use strict';var multer=require(_0x6c7c('0x0'));var util=require(_0x6c7c('0x1'));var path=require(_0x6c7c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c7c('0x3'));var router=express[_0x6c7c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c7c('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x6c7c('0x6')]('/',auth['isAuthenticated'](),controller[_0x6c7c('0x7')]);router['get'](_0x6c7c('0x8'),auth[_0x6c7c('0x9')](),controller[_0x6c7c('0xa')]);router['get'](_0x6c7c('0xb'),auth[_0x6c7c('0x9')](),controller['show']);router[_0x6c7c('0x6')](_0x6c7c('0xc'),auth[_0x6c7c('0x9')](),controller[_0x6c7c('0xd')]);router['get'](_0x6c7c('0xe'),auth[_0x6c7c('0x9')](),controller[_0x6c7c('0xf')]);router[_0x6c7c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6c7c('0x10')]('/:id/messages',auth[_0x6c7c('0x9')](),controller[_0x6c7c('0x11')]);router[_0x6c7c('0x10')]('/:id/tags',auth[_0x6c7c('0x9')](),interaction[_0x6c7c('0x12')](_0x6c7c('0x13'),_0x6c7c('0x14')),controller['addTags']);router[_0x6c7c('0x15')](_0x6c7c('0xb'),auth[_0x6c7c('0x9')](),interaction[_0x6c7c('0x12')](_0x6c7c('0x13'),_0x6c7c('0x16')),controller['update']);router[_0x6c7c('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x6c7c('0x12')](_0x6c7c('0x13'),'whatsappinteraction:destroy'),controller[_0x6c7c('0x18')]);router[_0x6c7c('0x17')]('/:id/tags',auth[_0x6c7c('0x9')](),controller['removeTags']);module[_0x6c7c('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index bbdbd78..f23e693 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 _0xbbe8=['ENUM','sequelize','moment','exports','DATE','STRING'];(function(_0x541a78,_0x219591){var _0x3107f3=function(_0x153053){while(--_0x153053){_0x541a78['push'](_0x541a78['shift']());}};_0x3107f3(++_0x219591);}(_0xbbe8,0x127));var _0x8bbe=function(_0x3e6b90,_0x4ee101){_0x3e6b90=_0x3e6b90-0x0;var _0x33d282=_0xbbe8[_0x3e6b90];return _0x33d282;};'use strict';var Sequelize=require(_0x8bbe('0x0'));var moment=require(_0x8bbe('0x1'));module[_0x8bbe('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8bbe('0x3')]},'disposition':{'type':Sequelize[_0x8bbe('0x4')]},'note':{'type':Sequelize[_0x8bbe('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8bbe('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8bbe('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8bbe('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xf61e=['moment','DATE','STRING','out','ENUM','sequelize'];(function(_0x2bea38,_0x44e15f){var _0x24185f=function(_0x271dd4){while(--_0x271dd4){_0x2bea38['push'](_0x2bea38['shift']());}};_0x24185f(++_0x44e15f);}(_0xf61e,0xbf));var _0xef61=function(_0x559fe0,_0x5af2ba){_0x559fe0=_0x559fe0-0x0;var _0x4d0296=_0xf61e[_0x559fe0];return _0x4d0296;};'use strict';var Sequelize=require(_0xef61('0x0'));var moment=require(_0xef61('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xef61('0x2')]},'disposition':{'type':Sequelize[_0xef61('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xef61('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xef61('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xef61('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xef61('0x5')]('in',_0xef61('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 0c417c1..548c085 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x16e27e,_0x4783c5){var _0x525c9e=function(_0x3e0d96){while(--_0x3e0d96){_0x16e27e['push'](_0x16e27e['shift']());}};_0x525c9e(++_0x4783c5);}(_0xadb5,0xad));var _0x5adb=function(_0x521345,_0x3ae495){_0x521345=_0x521345-0x0;var _0x11a98e=_0xadb5[_0x521345];return _0x11a98e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,null));}; \ No newline at end of file +var _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(_0x416f9a,_0x1a218f){var _0x478542=function(_0x94220b){while(--_0x94220b){_0x416f9a['push'](_0x416f9a['shift']());}};_0x478542(++_0x1a218f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 782a505..ba64fe9 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 _0x808b=['Users','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','then','setDataValue'];(function(_0x2a93f0,_0x1f8fb7){var _0x439217=function(_0xe07912){while(--_0xe07912){_0x2a93f0['push'](_0x2a93f0['shift']());}};_0x439217(++_0x1f8fb7);}(_0x808b,0x124));var _0xb808=function(_0x488196,_0x41150d){_0x488196=_0x488196-0x0;var _0x41a014=_0x808b[_0x488196];return _0x41a014;};'use strict';var EventEmitter=require(_0xb808('0x0'));var WhatsappInteraction=require(_0xb808('0x1'))['db'][_0xb808('0x2')];var WhatsappMessage=require(_0xb808('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb808('0x3')](0x0);var events={'afterCreate':_0xb808('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xe3b00f){return function(_0x15db31,_0x2ef8ab,_0x4cff18){_0x15db31['getUsers']({'attributes':['id'],'raw':!![]})[_0xb808('0x5')](function(_0x13be00){_0x15db31[_0xb808('0x6')](_0xb808('0x7'),_0x13be00['map'](function(_0x34a85b){return{'id':_0x34a85b['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x15db31['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb808('0x5')](function(_0x1fb9a8){_0x15db31['setDataValue'](_0xb808('0x8'),_0x1fb9a8[_0xb808('0x9')]);WhatsappInteractionEvents[_0xb808('0xa')](_0xe3b00f+':'+_0x15db31['id'],_0x15db31);WhatsappInteractionEvents[_0xb808('0xa')](_0xe3b00f,_0x15db31);_0x4cff18(null);})['catch'](_0x4cff18(null));};}for(var e in events){if(events[_0xb808('0xb')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xb808('0xc')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xb045=['WhatsappInteraction','WhatsappMessage','save','update','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x592fc1,_0x2f0227){var _0x8471e=function(_0x557bd5){while(--_0x557bd5){_0x592fc1['push'](_0x592fc1['shift']());}};_0x8471e(++_0x2f0227);}(_0xb045,0x1c9));var _0x5b04=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0xb045[_0x23b57c];return _0x4c3b1d;};'use strict';var EventEmitter=require(_0x5b04('0x0'));var WhatsappInteraction=require(_0x5b04('0x1'))['db'][_0x5b04('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x5b04('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b04('0x4'),'afterUpdate':_0x5b04('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46164b){return function(_0x3e8b49,_0x349287,_0x1cf5a5){_0x3e8b49['getUsers']({'attributes':['id'],'raw':!![]})[_0x5b04('0x6')](function(_0x2d29d6){_0x3e8b49[_0x5b04('0x7')](_0x5b04('0x8'),_0x2d29d6[_0x5b04('0x9')](function(_0x44c1ad){return{'id':_0x44c1ad['id']};}));return WhatsappMessage[_0x5b04('0xa')]({'where':{'WhatsappInteractionId':_0x3e8b49['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5b04('0x6')](function(_0x496ed5){_0x3e8b49[_0x5b04('0x7')]('unreadMessages',_0x496ed5[_0x5b04('0xb')]);WhatsappInteractionEvents[_0x5b04('0xc')](_0x46164b+':'+_0x3e8b49['id'],_0x3e8b49);WhatsappInteractionEvents[_0x5b04('0xc')](_0x46164b,_0x3e8b49);_0x1cf5a5(null);})[_0x5b04('0xd')](_0x1cf5a5(null));};}for(var e in events){if(events[_0x5b04('0xe')](e)){var event=events[e];WhatsappInteraction[_0x5b04('0xf')](e,emitEvent(event));}}module[_0x5b04('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 1d4650e..cd4ae92 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(_0x350914,_0x2ebb43){var _0x5a72d8=function(_0x561657){while(--_0x561657){_0x350914['push'](_0x350914['shift']());}};_0x5a72d8(++_0x2ebb43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x481dba,_0x44c386){var _0x59e836=function(_0x1d892e){while(--_0x1d892e){_0x481dba['push'](_0x481dba['shift']());}};_0x59e836(++_0x44c386);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d975b50..841f8bd 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 _0x12a0=['localhost','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','stringify','AddTagsToWhatsappInteraction','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x58bb02,_0x304f62){var _0x2e203d=function(_0x5b791c){while(--_0x5b791c){_0x58bb02['push'](_0x58bb02['shift']());}};_0x2e203d(++_0x304f62);}(_0x12a0,0x1a0));var _0x012a=function(_0x2ce135,_0x4af268){_0x2ce135=_0x2ce135-0x0;var _0x4af36b=_0x12a0[_0x2ce135];return _0x4af36b;};'use strict';var _=require('lodash');var util=require(_0x012a('0x0'));var moment=require('moment');var BPromise=require(_0x012a('0x1'));var rs=require(_0x012a('0x2'));var fs=require('fs');var Redis=require(_0x012a('0x3'));var db=require(_0x012a('0x4'))['db'];var utils=require(_0x012a('0x5'));var logger=require('../../config/logger')(_0x012a('0x6'));var config=require(_0x012a('0x7'));var jayson=require(_0x012a('0x8'));var client=jayson[_0x012a('0x9')][_0x012a('0xa')]({'port':0x232a});config[_0x012a('0xb')]=_[_0x012a('0xc')](config[_0x012a('0xb')],{'host':_0x012a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x012a('0xe'))[_0x012a('0xf')](socket);function respondWithRpcPromise(_0x205b38,_0x565845,_0x51999f){return new BPromise(function(_0x330771,_0x35add5){return client['request'](_0x205b38,_0x51999f)[_0x012a('0x10')](function(_0xb674a3){logger[_0x012a('0x11')](_0x012a('0x12'),_0x565845,_0x012a('0x13'));logger[_0x012a('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x565845,_0x012a('0x13'),JSON['stringify'](_0xb674a3));if(_0xb674a3['error']){if(_0xb674a3[_0x012a('0x15')][_0x012a('0x16')]===0x1f4){logger[_0x012a('0x15')](_0x012a('0x12'),_0x565845,_0xb674a3[_0x012a('0x15')][_0x012a('0x17')]);return _0x35add5(_0xb674a3[_0x012a('0x15')][_0x012a('0x17')]);}logger[_0x012a('0x15')](_0x012a('0x12'),_0x565845,_0xb674a3[_0x012a('0x15')]['message']);return _0x330771(_0xb674a3[_0x012a('0x15')][_0x012a('0x17')]);}else{logger[_0x012a('0x11')](_0x012a('0x12'),_0x565845,_0x012a('0x13'));_0x330771(_0xb674a3['result']['message']);}})[_0x012a('0x18')](function(_0x4c331c){logger[_0x012a('0x15')](_0x012a('0x12'),_0x565845,_0x4c331c);_0x35add5(_0x4c331c);});});}exports[_0x012a('0x19')]=function(_0x1dae5f){var _0x2a98c3=this;return new Promise(function(_0x3da5ee,_0x1efa10){return db[_0x012a('0x1a')][_0x012a('0x1b')](_0x1dae5f[_0x012a('0x1c')],{'raw':_0x1dae5f[_0x012a('0x1d')]?_0x1dae5f[_0x012a('0x1d')][_0x012a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dae5f[_0x012a('0x1d')]?_0x1dae5f[_0x012a('0x1d')][_0x012a('0x1f')]||null:null,'attributes':_0x1dae5f[_0x012a('0x1d')]?_0x1dae5f[_0x012a('0x1d')]['attributes']||null:null,'limit':_0x1dae5f[_0x012a('0x1d')]?_0x1dae5f[_0x012a('0x1d')][_0x012a('0x20')]||null:null})[_0x012a('0x10')](function(_0x77e188){logger['info'](_0x012a('0x19'),_0x1dae5f);logger[_0x012a('0x14')](_0x012a('0x19'),_0x1dae5f,JSON[_0x012a('0x21')](_0x77e188));_0x3da5ee(_0x77e188);})[_0x012a('0x18')](function(_0x943f34){logger['error'](_0x012a('0x19'),_0x943f34[_0x012a('0x17')],_0x1dae5f);_0x1efa10(_0x2a98c3[_0x012a('0x15')](0x1f4,_0x943f34['message']));});});};exports[_0x012a('0x22')]=function(_0x2601e7){return new Promise(function(_0x15837e,_0x19ae82){return db[_0x012a('0x1a')]['find']({'where':_0x2601e7[_0x012a('0x1d')]?_0x2601e7[_0x012a('0x1d')][_0x012a('0x1f')]||null:null})[_0x012a('0x10')](function(_0xb3bdbc){if(_0xb3bdbc){return _0xb3bdbc['addTags'](_0x2601e7[_0x012a('0x1c')][_0x012a('0x23')],_[_0x012a('0x24')](_0x2601e7['body'],[_0x012a('0x23'),'id'])||{});}})[_0x012a('0x25')](function(_0x452f7e){logger['info'](_0x012a('0x26'),_0x2601e7);logger['debug'](_0x012a('0x26'),_0x2601e7,JSON[_0x012a('0x21')](_0x452f7e));_0x15837e(_0x452f7e);})[_0x012a('0x18')](function(_0x2fc661){logger['error'](_0x012a('0x26'),_0x2fc661[_0x012a('0x17')],_0x2601e7);_0x19ae82(_this['error'](0x1f4,_0x2fc661[_0x012a('0x17')]));});});}; \ No newline at end of file +var _0x9470=['find','addTags','ids','omit','AddTags','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','WhatsappInteraction,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','catch','AddTagsToWhatsappInteraction','WhatsappInteraction'];(function(_0x598216,_0x265d25){var _0x658a57=function(_0x11be65){while(--_0x11be65){_0x598216['push'](_0x598216['shift']());}};_0x658a57(++_0x265d25);}(_0x9470,0x125));var _0x0947=function(_0xf61c79,_0x43c6fa){_0xf61c79=_0xf61c79-0x0;var _0x127d26=_0x9470[_0xf61c79];return _0x127d26;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0947('0x0'));var BPromise=require('bluebird');var rs=require(_0x0947('0x1'));var fs=require('fs');var Redis=require(_0x0947('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0947('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x0947('0x4'));var jayson=require(_0x0947('0x5'));var client=jayson[_0x0947('0x6')]['http']({'port':0x232a});config[_0x0947('0x7')]=_[_0x0947('0x8')](config[_0x0947('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0947('0x9'))(new Redis(config[_0x0947('0x7')]));require('./whatsappInteraction.socket')[_0x0947('0xa')](socket);function respondWithRpcPromise(_0x7faf5c,_0x3c98b6,_0x91b70c){return new BPromise(function(_0x20b6ed,_0x4685d7){return client[_0x0947('0xb')](_0x7faf5c,_0x91b70c)[_0x0947('0xc')](function(_0x8938b6){logger['info'](_0x0947('0xd'),_0x3c98b6,'request\x20sent');logger[_0x0947('0xe')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3c98b6,'request\x20sent',JSON[_0x0947('0xf')](_0x8938b6));if(_0x8938b6[_0x0947('0x10')]){if(_0x8938b6[_0x0947('0x10')]['code']===0x1f4){logger[_0x0947('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c98b6,_0x8938b6[_0x0947('0x10')][_0x0947('0x11')]);return _0x4685d7(_0x8938b6['error'][_0x0947('0x11')]);}logger[_0x0947('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c98b6,_0x8938b6[_0x0947('0x10')][_0x0947('0x11')]);return _0x20b6ed(_0x8938b6[_0x0947('0x10')][_0x0947('0x11')]);}else{logger[_0x0947('0x12')](_0x0947('0xd'),_0x3c98b6,_0x0947('0x13'));_0x20b6ed(_0x8938b6[_0x0947('0x14')][_0x0947('0x11')]);}})['catch'](function(_0x594d50){logger[_0x0947('0x10')](_0x0947('0xd'),_0x3c98b6,_0x594d50);_0x4685d7(_0x594d50);});});}exports[_0x0947('0x15')]=function(_0x29384f){var _0x9c1d26=this;return new Promise(function(_0x69b96c,_0x27f84c){return db['WhatsappInteraction'][_0x0947('0x16')](_0x29384f[_0x0947('0x17')],{'raw':_0x29384f[_0x0947('0x18')]?_0x29384f[_0x0947('0x18')][_0x0947('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29384f[_0x0947('0x18')]?_0x29384f[_0x0947('0x18')][_0x0947('0x1a')]||null:null,'attributes':_0x29384f[_0x0947('0x18')]?_0x29384f[_0x0947('0x18')][_0x0947('0x1b')]||null:null,'limit':_0x29384f['options']?_0x29384f[_0x0947('0x18')]['limit']||null:null})['then'](function(_0x15b80e){logger[_0x0947('0x12')]('UpdateWhatsappInteraction',_0x29384f);logger[_0x0947('0xe')](_0x0947('0x15'),_0x29384f,JSON[_0x0947('0xf')](_0x15b80e));_0x69b96c(_0x15b80e);})[_0x0947('0x1c')](function(_0xc87b8b){logger[_0x0947('0x10')](_0x0947('0x15'),_0xc87b8b['message'],_0x29384f);_0x27f84c(_0x9c1d26[_0x0947('0x10')](0x1f4,_0xc87b8b[_0x0947('0x11')]));});});};exports[_0x0947('0x1d')]=function(_0x6bcb21){return new Promise(function(_0xaf547c,_0x274e8a){return db[_0x0947('0x1e')][_0x0947('0x1f')]({'where':_0x6bcb21[_0x0947('0x18')]?_0x6bcb21[_0x0947('0x18')][_0x0947('0x1a')]||null:null})[_0x0947('0xc')](function(_0x470067){if(_0x470067){return _0x470067[_0x0947('0x20')](_0x6bcb21[_0x0947('0x17')][_0x0947('0x21')],_[_0x0947('0x22')](_0x6bcb21[_0x0947('0x17')],[_0x0947('0x21'),'id'])||{});}})['spread'](function(_0x4c865b){logger[_0x0947('0x12')](_0x0947('0x23'),_0x6bcb21);logger[_0x0947('0xe')](_0x0947('0x23'),_0x6bcb21,JSON[_0x0947('0xf')](_0x4c865b));_0xaf547c(_0x4c865b);})[_0x0947('0x1c')](function(_0x1fb682){logger[_0x0947('0x10')](_0x0947('0x23'),_0x1fb682[_0x0947('0x11')],_0x6bcb21);_0x274e8a(_this['error'](0x1f4,_0x1fb682[_0x0947('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index c31547c..856a1c2 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 _0xbcd2=['length','whatsappInteraction:','save','remove','update','removeListener','register'];(function(_0x280bef,_0x5e1bd3){var _0x56dc85=function(_0x533dfe){while(--_0x533dfe){_0x280bef['push'](_0x280bef['shift']());}};_0x56dc85(++_0x5e1bd3);}(_0xbcd2,0x80));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x2bcd('0x0'),_0x2bcd('0x1'),_0x2bcd('0x2')];function createListener(_0xb1b10c,_0x8128a6){return function(_0x364b6f){_0x8128a6['emit'](_0xb1b10c,_0x364b6f);};}function removeListener(_0xce2456,_0xc64344){return function(){WhatsappInteractionEvents[_0x2bcd('0x3')](_0xce2456,_0xc64344);};}exports[_0x2bcd('0x4')]=function(_0x37086c){for(var _0x321526=0x0,_0x55f882=events[_0x2bcd('0x5')];_0x321526<_0x55f882;_0x321526++){var _0x2e51da=events[_0x321526];var _0x511556=createListener(_0x2bcd('0x6')+_0x2e51da,_0x37086c);WhatsappInteractionEvents['on'](_0x2e51da,_0x511556);}}; \ No newline at end of file +var _0x62b7=['emit','removeListener','register','length','whatsappInteraction:','save'];(function(_0x25897a,_0x3d75de){var _0x481613=function(_0x24ca1f){while(--_0x24ca1f){_0x25897a['push'](_0x25897a['shift']());}};_0x481613(++_0x3d75de);}(_0x62b7,0x8f));var _0x762b=function(_0x3ebd65,_0xb16996){_0x3ebd65=_0x3ebd65-0x0;var _0x31eed1=_0x62b7[_0x3ebd65];return _0x31eed1;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x762b('0x0'),'remove','update'];function createListener(_0x565dbd,_0x964530){return function(_0x58fce8){_0x964530[_0x762b('0x1')](_0x565dbd,_0x58fce8);};}function removeListener(_0x4b87e1,_0xc8537){return function(){WhatsappInteractionEvents[_0x762b('0x2')](_0x4b87e1,_0xc8537);};}exports[_0x762b('0x3')]=function(_0x57fe72){for(var _0x29877a=0x0,_0x4c2d4f=events[_0x762b('0x4')];_0x29877a<_0x4c2d4f;_0x29877a++){var _0x12ddb2=events[_0x29877a];var _0x4151eb=createListener(_0x762b('0x5')+_0x12ddb2,_0x57fe72);WhatsappInteractionEvents['on'](_0x12ddb2,_0x4151eb);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 62cdac2..812596a 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 _0x0555=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','/describe','show','post','tracked','whatsappmessage:create','/:id/status','status','put','/:id','update','accept','reject','delete','destroy','exports','multer','util','path'];(function(_0x2002aa,_0x5c3cc2){var _0x53d679=function(_0x2de5be){while(--_0x2de5be){_0x2002aa['push'](_0x2002aa['shift']());}};_0x53d679(++_0x5c3cc2);}(_0x0555,0x65));var _0x5055=function(_0x3c4037,_0x4c341e){_0x3c4037=_0x3c4037-0x0;var _0x48cfce=_0x0555[_0x3c4037];return _0x48cfce;};'use strict';var multer=require(_0x5055('0x0'));var util=require(_0x5055('0x1'));var path=require(_0x5055('0x2'));var timeout=require(_0x5055('0x3'));var express=require(_0x5055('0x4'));var router=express[_0x5055('0x5')]();var auth=require(_0x5055('0x6'));var interaction=require(_0x5055('0x7'));var config=require('../../config/environment');var controller=require(_0x5055('0x8'));router[_0x5055('0x9')]('/',auth[_0x5055('0xa')](),controller['index']);router[_0x5055('0x9')](_0x5055('0xb'),auth[_0x5055('0xa')](),controller['describe']);router[_0x5055('0x9')]('/:id',auth[_0x5055('0xa')](),controller[_0x5055('0xc')]);router[_0x5055('0xd')]('/',auth[_0x5055('0xa')](),interaction[_0x5055('0xe')]('whatsapp',_0x5055('0xf')),controller['create']);router['post'](_0x5055('0x10'),controller[_0x5055('0x11')]);router[_0x5055('0x12')](_0x5055('0x13'),auth[_0x5055('0xa')](),controller[_0x5055('0x14')]);router[_0x5055('0x12')]('/:id/accept',auth[_0x5055('0xa')](),controller[_0x5055('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x5055('0x16')]);router[_0x5055('0x17')](_0x5055('0x13'),auth[_0x5055('0xa')](),controller[_0x5055('0x18')]);module[_0x5055('0x19')]=router; \ No newline at end of file +var _0x5757=['/:id/reject','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','/:id/accept','accept'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5757,0x12b));var _0x7575=function(_0x4238e9,_0x4ae092){_0x4238e9=_0x4238e9-0x0;var _0x4108c3=_0x5757[_0x4238e9];return _0x4108c3;};'use strict';var multer=require(_0x7575('0x0'));var util=require(_0x7575('0x1'));var path=require(_0x7575('0x2'));var timeout=require(_0x7575('0x3'));var express=require(_0x7575('0x4'));var router=express['Router']();var auth=require(_0x7575('0x5'));var interaction=require(_0x7575('0x6'));var config=require(_0x7575('0x7'));var controller=require(_0x7575('0x8'));router['get']('/',auth[_0x7575('0x9')](),controller[_0x7575('0xa')]);router[_0x7575('0xb')](_0x7575('0xc'),auth[_0x7575('0x9')](),controller[_0x7575('0xd')]);router[_0x7575('0xb')](_0x7575('0xe'),auth[_0x7575('0x9')](),controller[_0x7575('0xf')]);router[_0x7575('0x10')]('/',auth['isAuthenticated'](),interaction[_0x7575('0x11')](_0x7575('0x12'),'whatsappmessage:create'),controller[_0x7575('0x13')]);router[_0x7575('0x10')](_0x7575('0x14'),controller[_0x7575('0x15')]);router[_0x7575('0x16')](_0x7575('0xe'),auth[_0x7575('0x9')](),controller['update']);router[_0x7575('0x16')](_0x7575('0x17'),auth[_0x7575('0x9')](),controller[_0x7575('0x18')]);router['put'](_0x7575('0x19'),auth[_0x7575('0x9')](),controller['reject']);router['delete'](_0x7575('0xe'),auth[_0x7575('0x9')](),controller['destroy']);module[_0x7575('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9dba7af..600c681 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 _0x06a0=['BOOLEAN','sequelize','TEXT','ENUM','out','DATE'];(function(_0x4e0587,_0x409e3a){var _0x39a2c6=function(_0x5aa883){while(--_0x5aa883){_0x4e0587['push'](_0x4e0587['shift']());}};_0x39a2c6(++_0x409e3a);}(_0x06a0,0x1e1));var _0x006a=function(_0x38382f,_0x51183d){_0x38382f=_0x38382f-0x0;var _0x152e8b=_0x06a0[_0x38382f];return _0x152e8b;};'use strict';var Sequelize=require(_0x006a('0x0'));module['exports']={'body':{'type':Sequelize[_0x006a('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x006a('0x2')]('in',_0x006a('0x3')),'defaultValue':_0x006a('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x006a('0x4')]},'secret':{'type':Sequelize[_0x006a('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x90ae=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x51e166,_0x17b403){var _0x5c068c=function(_0x590a0f){while(--_0x590a0f){_0x51e166['push'](_0x51e166['shift']());}};_0x5c068c(++_0x17b403);}(_0x90ae,0x195));var _0xe90a=function(_0x53dbf7,_0x4953cc){_0x53dbf7=_0x53dbf7-0x0;var _0x543510=_0x90ae[_0x53dbf7];return _0x543510;};'use strict';var Sequelize=require(_0xe90a('0x0'));module[_0xe90a('0x1')]={'body':{'type':Sequelize[_0xe90a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe90a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe90a('0x4')]('in',_0xe90a('0x5')),'defaultValue':_0xe90a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe90a('0x6')](0xbe)},'phone':{'type':Sequelize[_0xe90a('0x6')]},'readAt':{'type':Sequelize[_0xe90a('0x7')]},'secret':{'type':Sequelize[_0xe90a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9995dff..d12c865 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 _0xa533=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','hasOwnProperty','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','intersection','fields','length','find','create','body','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','get','stringify','null','acceptMessage','interface','SIP/%s','channel','event','EventManager','whatsapp-interactions','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','zip-dir','moment','bluebird','mustache','to-csv','ejs'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa533,0x7b));var _0x3a53=function(_0x36baa9,_0x2068fa){_0x36baa9=_0x36baa9-0x0;var _0x4d4cf1=_0xa533[_0x36baa9];return _0x4d4cf1;};'use strict';var pdf=require(_0x3a53('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3a53('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3a53('0x2'));var BPromise=require(_0x3a53('0x3'));var Mustache=require(_0x3a53('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3a53('0x5'));var ejs=require(_0x3a53('0x6'));var fs=require('fs');var _=require(_0x3a53('0x7'));var squel=require('squel');var crypto=require(_0x3a53('0x8'));var jsforce=require(_0x3a53('0x9'));var deskjs=require(_0x3a53('0xa'));var toCsv=require(_0x3a53('0x5'));var querystring=require(_0x3a53('0xb'));var Papa=require(_0x3a53('0xc'));var Redis=require('ioredis');var authService=require(_0x3a53('0xd'));var qs=require(_0x3a53('0xe'));var as=require(_0x3a53('0xf'));var hardwareService=require(_0x3a53('0x10'));var logger=require(_0x3a53('0x11'))(_0x3a53('0x12'));var utils=require(_0x3a53('0x13'));var config=require(_0x3a53('0x14'));var db=require(_0x3a53('0x15'))['db'];config[_0x3a53('0x16')]=_[_0x3a53('0x17')](config['redis'],{'host':_0x3a53('0x18'),'port':0x18eb});var socket=require(_0x3a53('0x19'))(new Redis(config['redis']));require(_0x3a53('0x1a'))[_0x3a53('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3a53('0x1c')][_0x3a53('0x1d')]({'port':0x232c});var client9002=jayson[_0x3a53('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x5cbb4c,_0x12ee9d,_0x545bd4){if(_0x545bd4){var _0x59cac6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59cac6[_0x3a53('0x1e')](_0x12ee9d)){return _0x5cbb4c;}else{throw new db[(_0x3a53('0x1f'))]['ValidationError'](_0x3a53('0x20'));}}else{return _0x5cbb4c;}}function respondWithRpcPromise(_0xb81f,_0x15af9c,_0x15e6df,_0xd8259c){return new BPromise(function(_0x468ecc,_0x1363b5){var _0x454452=_0xd8259c||client;return _0x454452[_0x3a53('0x21')](_0xb81f,_0x15e6df)[_0x3a53('0x22')](function(_0x5c1c71){logger['info'](_0x3a53('0x23'),_0x15af9c,'request\x20sent');logger[_0x3a53('0x24')](_0x3a53('0x25'),_0x15af9c,_0x3a53('0x26'),JSON['stringify'](_0x5c1c71));if(_0x5c1c71[_0x3a53('0x27')]){if(_0x5c1c71[_0x3a53('0x27')][_0x3a53('0x28')]===0x1f4){logger[_0x3a53('0x27')](_0x3a53('0x23'),_0x15af9c,_0x5c1c71['error'][_0x3a53('0x29')]);return _0x1363b5(_0x5c1c71[_0x3a53('0x27')]['message']);}logger[_0x3a53('0x27')](_0x3a53('0x23'),_0x15af9c,_0x5c1c71['error'][_0x3a53('0x29')]);return _0x468ecc(_0x5c1c71[_0x3a53('0x27')]['message']);}else{logger[_0x3a53('0x2a')](_0x3a53('0x23'),_0x15af9c,_0x3a53('0x26'));_0x468ecc(_0x5c1c71[_0x3a53('0x2b')]['message']);}})['catch'](function(_0x535665){logger[_0x3a53('0x27')](_0x3a53('0x23'),_0x15af9c,_0x535665);_0x1363b5(_0x535665);});});}function respondWithStatusCode(_0x3cba32,_0xe45915){_0xe45915=_0xe45915||0xcc;return function(_0x153cfe){if(_0x153cfe){return _0x3cba32[_0x3a53('0x2c')](_0xe45915);}return _0x3cba32[_0x3a53('0x2d')](_0xe45915)[_0x3a53('0x2e')]();};}function respondWithResult(_0x274b1a,_0x3a231b){_0x3a231b=_0x3a231b||0xc8;return function(_0x425603){if(_0x425603){return _0x274b1a['status'](_0x3a231b)[_0x3a53('0x2f')](_0x425603);}};}function respondWithFilteredResult(_0xa15ad3,_0x566921){return function(_0x5ce11b){if(_0x5ce11b){var _0x43b3a5=_0x5ce11b[_0x3a53('0x30')],_0x19b33a=_0x566921[_0x3a53('0x31')],_0x3d89b8=_0x566921[_0x3a53('0x31')]+_0x566921['limit'],_0x967219;if(_0x3d89b8>=_0x43b3a5){_0x3d89b8=_0x43b3a5;_0x967219=0xc8;}else{_0x967219=0xce;}_0xa15ad3['status'](_0x967219);return _0xa15ad3[_0x3a53('0x32')](_0x3a53('0x33'),_0x19b33a+'-'+_0x3d89b8+'/'+_0x43b3a5)[_0x3a53('0x2f')](_0x5ce11b);}return null;};}function patchUpdates(_0x4af924){return function(_0x505419){try{jsonpatch['apply'](_0x505419,_0x4af924,!![]);}catch(_0x283490){return BPromise[_0x3a53('0x34')](_0x283490);}return _0x505419[_0x3a53('0x35')]();};}function saveUpdates(_0x129332,_0x26aec5){return function(_0x40c61d){if(_0x40c61d){return _0x40c61d[_0x3a53('0x36')](_0x129332)[_0x3a53('0x22')](function(_0x4eee33){return _0x4eee33;});}return null;};}function removeEntity(_0x1de8c6,_0x7956a1){return function(_0x243982){if(_0x243982){return _0x243982[_0x3a53('0x37')]()[_0x3a53('0x22')](function(){_0x1de8c6[_0x3a53('0x2d')](0xcc)[_0x3a53('0x2e')]();});}};}function handleEntityNotFound(_0x4c7abc,_0x147023){return function(_0x53600c){if(!_0x53600c){_0x4c7abc[_0x3a53('0x2c')](0x194);}return _0x53600c;};}function handleError(_0x18162a,_0x4a39b3){_0x4a39b3=_0x4a39b3||0x1f4;return function(_0x47944c){logger['error'](_0x47944c[_0x3a53('0x38')]);if(_0x47944c[_0x3a53('0x39')]){delete _0x47944c['name'];}_0x18162a['status'](_0x4a39b3)[_0x3a53('0x3a')](_0x47944c);};}exports[_0x3a53('0x3b')]=function(_0x22d5d9,_0x2f9d92){var _0x3319f8={},_0xb3c7a7={},_0x46a6cb={'count':0x0,'rows':[]};var _0x1ee086=_['map'](db[_0x3a53('0x3c')][_0x3a53('0x3d')],function(_0x37ee06){return{'name':_0x37ee06[_0x3a53('0x3e')],'type':_0x37ee06[_0x3a53('0x3f')][_0x3a53('0x40')]};});_0xb3c7a7[_0x3a53('0x41')]=_[_0x3a53('0x42')](_0x1ee086,_0x3a53('0x39'));_0xb3c7a7[_0x3a53('0x43')]=_[_0x3a53('0x44')](_0x22d5d9['query']);_0xb3c7a7[_0x3a53('0x45')]=_['intersection'](_0xb3c7a7['model'],_0xb3c7a7[_0x3a53('0x43')]);_0x3319f8['attributes']=_['intersection'](_0xb3c7a7['model'],qs['fields'](_0x22d5d9[_0x3a53('0x43')]['fields']));_0x3319f8['attributes']=_0x3319f8[_0x3a53('0x46')]['length']?_0x3319f8['attributes']:_0xb3c7a7[_0x3a53('0x41')];if(!_0x22d5d9['query'][_0x3a53('0x47')]('nolimit')){_0x3319f8[_0x3a53('0x48')]=qs['limit'](_0x22d5d9['query'][_0x3a53('0x48')]);_0x3319f8[_0x3a53('0x31')]=qs['offset'](_0x22d5d9[_0x3a53('0x43')][_0x3a53('0x31')]);}_0x3319f8[_0x3a53('0x49')]=qs['sort'](_0x22d5d9[_0x3a53('0x43')]['sort']);_0x3319f8[_0x3a53('0x4a')]=qs[_0x3a53('0x45')](_[_0x3a53('0x4b')](_0x22d5d9[_0x3a53('0x43')],_0xb3c7a7[_0x3a53('0x45')]),_0x1ee086);if(_0x22d5d9[_0x3a53('0x43')][_0x3a53('0x4c')]){_0x3319f8['where']=_[_0x3a53('0x4d')](_0x3319f8['where'],{'$or':_[_0x3a53('0x42')](_0x1ee086,function(_0x128a6a){if(_0x128a6a[_0x3a53('0x3f')]!==_0x3a53('0x4e')){var _0x12d967={};_0x12d967[_0x128a6a[_0x3a53('0x39')]]={'$like':'%'+_0x22d5d9[_0x3a53('0x43')][_0x3a53('0x4c')]+'%'};return _0x12d967;}})});}_0x3319f8=_[_0x3a53('0x4d')]({},_0x3319f8,_0x22d5d9[_0x3a53('0x4f')]);var _0x4f33cb={'where':_0x3319f8[_0x3a53('0x4a')]};return db[_0x3a53('0x3c')][_0x3a53('0x30')](_0x4f33cb)['then'](function(_0xb5fd32){_0x46a6cb[_0x3a53('0x30')]=_0xb5fd32;if(_0x22d5d9['query'][_0x3a53('0x50')]){_0x3319f8[_0x3a53('0x51')]=[{'all':!![]}];}return db[_0x3a53('0x3c')]['findAll'](_0x3319f8);})[_0x3a53('0x22')](function(_0x2eb8d0){_0x46a6cb['rows']=_0x2eb8d0;return _0x46a6cb;})['then'](respondWithFilteredResult(_0x2f9d92,_0x3319f8))[_0x3a53('0x52')](handleError(_0x2f9d92,null));};exports[_0x3a53('0x53')]=function(_0x21fd26,_0x9ec53f){var _0x479b53={'raw':!![],'where':{'id':_0x21fd26[_0x3a53('0x54')]['id']}},_0x31a5ea={};_0x31a5ea[_0x3a53('0x41')]=_[_0x3a53('0x44')](db[_0x3a53('0x3c')][_0x3a53('0x3d')]);_0x31a5ea[_0x3a53('0x43')]=_['keys'](_0x21fd26['query']);_0x31a5ea[_0x3a53('0x45')]=_[_0x3a53('0x55')](_0x31a5ea[_0x3a53('0x41')],_0x31a5ea[_0x3a53('0x43')]);_0x479b53[_0x3a53('0x46')]=_[_0x3a53('0x55')](_0x31a5ea[_0x3a53('0x41')],qs['fields'](_0x21fd26[_0x3a53('0x43')][_0x3a53('0x56')]));_0x479b53[_0x3a53('0x46')]=_0x479b53['attributes'][_0x3a53('0x57')]?_0x479b53[_0x3a53('0x46')]:_0x31a5ea[_0x3a53('0x41')];if(_0x21fd26['query'][_0x3a53('0x50')]){_0x479b53[_0x3a53('0x51')]=[{'all':!![]}];}_0x479b53=_['merge']({},_0x479b53,_0x21fd26[_0x3a53('0x4f')]);return db[_0x3a53('0x3c')][_0x3a53('0x58')](_0x479b53)[_0x3a53('0x22')](handleEntityNotFound(_0x9ec53f,null))[_0x3a53('0x22')](respondWithResult(_0x9ec53f,null))['catch'](handleError(_0x9ec53f,null));};exports[_0x3a53('0x59')]=function(_0x378559,_0x5dc964){return db[_0x3a53('0x3c')][_0x3a53('0x59')](_0x378559[_0x3a53('0x5a')],{})['then'](respondWithResult(_0x5dc964,0xc9))[_0x3a53('0x52')](handleError(_0x5dc964,null));};exports[_0x3a53('0x36')]=function(_0x57ae82,_0x25d6e1){if(_0x57ae82[_0x3a53('0x5a')]['id']){delete _0x57ae82['body']['id'];}return db['WhatsappMessage'][_0x3a53('0x58')]({'where':{'id':_0x57ae82[_0x3a53('0x54')]['id']}})[_0x3a53('0x22')](handleEntityNotFound(_0x25d6e1,null))[_0x3a53('0x22')](saveUpdates(_0x57ae82[_0x3a53('0x5a')],null))[_0x3a53('0x22')](respondWithResult(_0x25d6e1,null))['catch'](handleError(_0x25d6e1,null));};exports[_0x3a53('0x37')]=function(_0x52f253,_0x9da1ec){return db[_0x3a53('0x3c')][_0x3a53('0x58')]({'where':{'id':_0x52f253['params']['id']}})[_0x3a53('0x22')](handleEntityNotFound(_0x9da1ec,null))[_0x3a53('0x22')](removeEntity(_0x9da1ec,null))[_0x3a53('0x52')](handleError(_0x9da1ec,null));};exports[_0x3a53('0x5b')]=function(_0x597f59,_0x558d37){return db[_0x3a53('0x3c')]['describe']()['then'](respondWithResult(_0x558d37,null))[_0x3a53('0x52')](handleError(_0x558d37,null));};var interaction_log=require(_0x3a53('0x11'))('whatsapp-interactions');exports['accept']=function(_0x363c22,_0x210203,_0x15188e){var _0x7bf0b9={'channel':_0x3a53('0x5c')};if(_0x363c22[_0x3a53('0x5a')]['id']){delete _0x363c22[_0x3a53('0x5a')]['id'];}_0x363c22[_0x3a53('0x5a')][_0x3a53('0x5d')]=!![];_0x363c22[_0x3a53('0x5a')][_0x3a53('0x5e')]=moment()[_0x3a53('0x5f')](_0x3a53('0x60'));_0x363c22[_0x3a53('0x5a')][_0x3a53('0x61')]=_0x363c22[_0x3a53('0x5a')][_0x3a53('0x61')]||_0x363c22[_0x3a53('0x62')]['id'];return db[_0x3a53('0x3c')][_0x3a53('0x58')]({'where':{'id':_0x363c22[_0x3a53('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x3a53('0x63')}]})[_0x3a53('0x22')](handleEntityNotFound(_0x210203,null))['then'](saveUpdates(_0x363c22[_0x3a53('0x5a')],null))[_0x3a53('0x22')](function(_0x1f5c29){if(_0x1f5c29){_0x7bf0b9[_0x3a53('0x29')]=_0x1f5c29['get']({'plain':!![]});return db[_0x3a53('0x64')][_0x3a53('0x58')]({'where':{'id':_0x1f5c29[_0x3a53('0x65')]}});}return null;})[_0x3a53('0x22')](handleEntityNotFound(_0x210203,null))[_0x3a53('0x22')](function(_0x1ad276){if(_0x1ad276){return _0x1ad276[_0x3a53('0x36')]({'UserId':_0x363c22['body'][_0x3a53('0x61')],'read1stAt':_['isNil'](_0x1ad276[_0x3a53('0x66')])?moment()[_0x3a53('0x5f')](_0x3a53('0x60')):undefined});}return null;})[_0x3a53('0x22')](function(_0x57af20){if(_0x57af20){_0x7bf0b9[_0x3a53('0x67')]=_0x57af20[_0x3a53('0x68')]({'plain':!![]});interaction_log[_0x3a53('0x2a')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x363c22['user']['id'],_0x363c22['user'][_0x3a53('0x39')],_0x363c22[_0x3a53('0x62')]['role'],_0x7bf0b9[_0x3a53('0x67')]['id'],_0x363c22[_0x3a53('0x5a')]?JSON[_0x3a53('0x69')](_0x363c22[_0x3a53('0x5a')]):_0x3a53('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x3a53('0x6b'),_0x7bf0b9);}return null;})[_0x3a53('0x22')](function(_0xb088c6){if(_0xb088c6){if(_0x363c22[_0x3a53('0x5a')]['manual']){_0x7bf0b9[_0x3a53('0x29')][_0x3a53('0x6c')]=util['format'](_0x3a53('0x6d'),_0x363c22[_0x3a53('0x62')][_0x3a53('0x39')]);_0x7bf0b9[_0x3a53('0x29')]['channel']=_0x7bf0b9[_0x3a53('0x6e')];_0x7bf0b9[_0x3a53('0x29')][_0x3a53('0x6f')]='accept';return respondWithRpcPromise(_0x3a53('0x70'),_0x3a53('0x70'),{'event':'acceptmessage','message':_0x7bf0b9[_0x3a53('0x29')]},client9002)['then'](function(){return _0x7bf0b9;});}return _0x7bf0b9;}return null;})[_0x3a53('0x22')](respondWithResult(_0x210203,null))[_0x3a53('0x52')](handleError(_0x210203,null));};var interaction_log=require(_0x3a53('0x11'))(_0x3a53('0x71'));exports['reject']=function(_0x515c0d,_0xfb436d,_0x168605){var _0x2689b4={'agent':{},'channel':_0x3a53('0x5c')};if(_0x515c0d['body']['id']){delete _0x515c0d['body']['id'];}_0x515c0d[_0x3a53('0x5a')][_0x3a53('0x61')]=_0x515c0d['body'][_0x3a53('0x61')]||_0x515c0d[_0x3a53('0x62')]['id'];_0x2689b4[_0x3a53('0x72')]['id']=_0x515c0d[_0x3a53('0x5a')]['UserId'];return db[_0x3a53('0x3c')][_0x3a53('0x58')]({'where':{'id':_0x515c0d[_0x3a53('0x54')]['id'],'UserId':null}})[_0x3a53('0x22')](handleEntityNotFound(_0xfb436d,null))['then'](function(_0x383908){if(_0x383908){_0x2689b4[_0x3a53('0x29')]=_0x383908['get']({'plain':!![]});return db[_0x3a53('0x64')][_0x3a53('0x58')]({'where':{'id':_0x383908['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xfb436d,null))['then'](function(_0x1d330a){if(_0x1d330a){_0x2689b4[_0x3a53('0x67')]=_0x1d330a[_0x3a53('0x68')]({'plain':!![]});interaction_log[_0x3a53('0x2a')](_0x3a53('0x73'),_0x515c0d[_0x3a53('0x62')]['id'],_0x515c0d[_0x3a53('0x62')][_0x3a53('0x39')],_0x515c0d[_0x3a53('0x62')][_0x3a53('0x74')],_0x2689b4[_0x3a53('0x67')]['id'],_0x515c0d[_0x3a53('0x5a')]?JSON[_0x3a53('0x69')](_0x515c0d[_0x3a53('0x5a')]):_0x3a53('0x6a'));return respondWithRpcPromise(_0x3a53('0x75'),_0x3a53('0x76'),_0x2689b4);}return null;})[_0x3a53('0x22')](function(_0x286055){if(_0x286055){_0x286055[_0x3a53('0x29')][_0x3a53('0x6c')]=util[_0x3a53('0x5f')](_0x3a53('0x6d'),_0x515c0d[_0x3a53('0x62')][_0x3a53('0x39')]);_0x286055[_0x3a53('0x29')][_0x3a53('0x6e')]=_0x2689b4['channel'];_0x286055['message']['event']=_0x3a53('0x34');respondWithRpcPromise('EventManager',_0x3a53('0x70'),{'event':_0x3a53('0x77'),'message':_0x286055[_0x3a53('0x29')]},client9002);return _0x2689b4;}return null;})[_0x3a53('0x22')](respondWithResult(_0xfb436d,null))[_0x3a53('0x52')](handleError(_0xfb436d,null));};exports['status']=function(_0x10c509,_0x2c81be,_0x3e20e4){if(_0x10c509[_0x3a53('0x5a')]['id']){delete _0x10c509['body']['id'];}var _0x2e5bf1;return db[_0x3a53('0x3c')][_0x3a53('0x58')]({'where':{'id':_0x10c509[_0x3a53('0x54')]['id']}})[_0x3a53('0x22')](handleEntityNotFound(_0x2c81be,null))[_0x3a53('0x22')](function(_0x80041b){if(_0x80041b){_0x2e5bf1=_0x80041b;return db[_0x3a53('0x78')]['find']({'where':{'id':_0x80041b[_0x3a53('0x79')]}});}})[_0x3a53('0x22')](handleEntityNotFound(_0x2c81be,null))[_0x3a53('0x22')](function(_0x8e00bc){if(_0x8e00bc){logger[_0x3a53('0x24')](_0x3a53('0x7a'),_0x3a53('0x2d'),_0x3a53('0x7b'),_0x8e00bc[_0x3a53('0x3f')],util['inspect'](_0x10c509['body'],{'showHidden':![],'depth':null}));switch(_0x8e00bc[_0x3a53('0x3f')]){case _0x3a53('0x7c'):if(_0x10c509[_0x3a53('0x5a')][_0x3a53('0x7d')]&&_0x10c509[_0x3a53('0x5a')]['MessageSid']===_0x2e5bf1[_0x3a53('0x7e')]&&_0x10c509[_0x3a53('0x5a')]['MessageStatus']&&_0x10c509['body'][_0x3a53('0x7f')]==='read'){return _0x2e5bf1[_0x3a53('0x36')]({'read':!![]});}else{logger[_0x3a53('0x27')](_0x3a53('0x80'),_0x3a53('0x2d'),_0x3a53('0x7c'),util[_0x3a53('0x81')](_0x10c509[_0x3a53('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2e5bf1;}})[_0x3a53('0x22')](respondWithResult(_0x2c81be,null))[_0x3a53('0x52')](handleError(_0x2c81be,null));}; \ No newline at end of file +var _0xddf5=['html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','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','socket.io-emitter','./whatsappMessage.socket','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','stack','name','send','index','WhatsappMessage','fieldName','map','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','params','length','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','acceptmessage','null','RejectMessage','rejectMessage','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5e706d,_0x2bf99f){var _0x583c53=function(_0xb98df3){while(--_0xb98df3){_0x5e706d['push'](_0x5e706d['shift']());}};_0x583c53(++_0x2bf99f);}(_0xddf5,0x10a));var _0x5ddf=function(_0x3ca523,_0x2db4a2){_0x3ca523=_0x3ca523-0x0;var _0x20ee1a=_0xddf5[_0x3ca523];return _0x20ee1a;};'use strict';var pdf=require(_0x5ddf('0x0'));var emlformat=require(_0x5ddf('0x1'));var rimraf=require(_0x5ddf('0x2'));var zipdir=require(_0x5ddf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ddf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5ddf('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5ddf('0x6'));var csv=require(_0x5ddf('0x7'));var ejs=require(_0x5ddf('0x8'));var fs=require('fs');var _=require(_0x5ddf('0x9'));var squel=require(_0x5ddf('0xa'));var crypto=require(_0x5ddf('0xb'));var jsforce=require(_0x5ddf('0xc'));var deskjs=require(_0x5ddf('0xd'));var toCsv=require(_0x5ddf('0x7'));var querystring=require(_0x5ddf('0xe'));var Papa=require(_0x5ddf('0xf'));var Redis=require(_0x5ddf('0x10'));var authService=require(_0x5ddf('0x11'));var qs=require(_0x5ddf('0x12'));var as=require(_0x5ddf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ddf('0x14'))(_0x5ddf('0x15'));var utils=require(_0x5ddf('0x16'));var config=require(_0x5ddf('0x17'));var db=require(_0x5ddf('0x18'))['db'];config[_0x5ddf('0x19')]=_[_0x5ddf('0x1a')](config[_0x5ddf('0x19')],{'host':_0x5ddf('0x1b'),'port':0x18eb});var socket=require(_0x5ddf('0x1c'))(new Redis(config[_0x5ddf('0x19')]));require(_0x5ddf('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5ddf('0x1e')][_0x5ddf('0x1f')]({'port':0x232c});var client9002=jayson[_0x5ddf('0x1e')][_0x5ddf('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x462df3,_0x23242a,_0x294cad){if(_0x294cad){var _0x42d609=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42d609[_0x5ddf('0x20')](_0x23242a)){return _0x462df3;}else{throw new db['Sequelize'][(_0x5ddf('0x21'))](_0x5ddf('0x22'));}}else{return _0x462df3;}}function respondWithRpcPromise(_0x521a84,_0x4464d0,_0x14b64d,_0x4f540a){return new BPromise(function(_0x159114,_0xa3f8d4){var _0x16bec1=_0x4f540a||client;return _0x16bec1[_0x5ddf('0x23')](_0x521a84,_0x14b64d)['then'](function(_0x249573){logger[_0x5ddf('0x24')](_0x5ddf('0x25'),_0x4464d0,'request\x20sent');logger[_0x5ddf('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4464d0,_0x5ddf('0x27'),JSON[_0x5ddf('0x28')](_0x249573));if(_0x249573[_0x5ddf('0x29')]){if(_0x249573[_0x5ddf('0x29')][_0x5ddf('0x2a')]===0x1f4){logger[_0x5ddf('0x29')](_0x5ddf('0x25'),_0x4464d0,_0x249573[_0x5ddf('0x29')][_0x5ddf('0x2b')]);return _0xa3f8d4(_0x249573[_0x5ddf('0x29')][_0x5ddf('0x2b')]);}logger[_0x5ddf('0x29')](_0x5ddf('0x25'),_0x4464d0,_0x249573[_0x5ddf('0x29')][_0x5ddf('0x2b')]);return _0x159114(_0x249573[_0x5ddf('0x29')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4464d0,_0x5ddf('0x27'));_0x159114(_0x249573[_0x5ddf('0x2c')]['message']);}})[_0x5ddf('0x2d')](function(_0x52eff7){logger[_0x5ddf('0x29')](_0x5ddf('0x25'),_0x4464d0,_0x52eff7);_0xa3f8d4(_0x52eff7);});});}function respondWithStatusCode(_0x30bbee,_0x41e33e){_0x41e33e=_0x41e33e||0xcc;return function(_0x27bacc){if(_0x27bacc){return _0x30bbee[_0x5ddf('0x2e')](_0x41e33e);}return _0x30bbee[_0x5ddf('0x2f')](_0x41e33e)[_0x5ddf('0x30')]();};}function respondWithResult(_0xb4aa04,_0x3d4dc9){_0x3d4dc9=_0x3d4dc9||0xc8;return function(_0x1fc165){if(_0x1fc165){return _0xb4aa04[_0x5ddf('0x2f')](_0x3d4dc9)['json'](_0x1fc165);}};}function respondWithFilteredResult(_0x2b5039,_0x4fa13b){return function(_0x26ff8a){if(_0x26ff8a){var _0x1b8d48=_0x26ff8a[_0x5ddf('0x31')],_0x135ba0=_0x4fa13b[_0x5ddf('0x32')],_0x4320f5=_0x4fa13b[_0x5ddf('0x32')]+_0x4fa13b[_0x5ddf('0x33')],_0x5a9fe9;if(_0x4320f5>=_0x1b8d48){_0x4320f5=_0x1b8d48;_0x5a9fe9=0xc8;}else{_0x5a9fe9=0xce;}_0x2b5039[_0x5ddf('0x2f')](_0x5a9fe9);return _0x2b5039[_0x5ddf('0x34')]('Content-Range',_0x135ba0+'-'+_0x4320f5+'/'+_0x1b8d48)[_0x5ddf('0x35')](_0x26ff8a);}return null;};}function patchUpdates(_0x4defcb){return function(_0x877c94){try{jsonpatch[_0x5ddf('0x36')](_0x877c94,_0x4defcb,!![]);}catch(_0x279aef){return BPromise[_0x5ddf('0x37')](_0x279aef);}return _0x877c94[_0x5ddf('0x38')]();};}function saveUpdates(_0x4003a7,_0x177acd){return function(_0x2537c4){if(_0x2537c4){return _0x2537c4[_0x5ddf('0x39')](_0x4003a7)['then'](function(_0xe1e459){return _0xe1e459;});}return null;};}function removeEntity(_0x16b105,_0x291390){return function(_0x17980f){if(_0x17980f){return _0x17980f[_0x5ddf('0x3a')]()['then'](function(){_0x16b105['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x260fb6,_0x424918){return function(_0x47b889){if(!_0x47b889){_0x260fb6[_0x5ddf('0x2e')](0x194);}return _0x47b889;};}function handleError(_0x42a10e,_0x4e76b3){_0x4e76b3=_0x4e76b3||0x1f4;return function(_0xf5ce1c){logger[_0x5ddf('0x29')](_0xf5ce1c[_0x5ddf('0x3b')]);if(_0xf5ce1c[_0x5ddf('0x3c')]){delete _0xf5ce1c[_0x5ddf('0x3c')];}_0x42a10e[_0x5ddf('0x2f')](_0x4e76b3)[_0x5ddf('0x3d')](_0xf5ce1c);};}exports[_0x5ddf('0x3e')]=function(_0x447fb2,_0xdcee38){var _0x24fa15={},_0x19bc8c={},_0x408191={'count':0x0,'rows':[]};var _0x35899a=_['map'](db[_0x5ddf('0x3f')]['rawAttributes'],function(_0xeb0e1a){return{'name':_0xeb0e1a[_0x5ddf('0x40')],'type':_0xeb0e1a['type']['key']};});_0x19bc8c['model']=_[_0x5ddf('0x41')](_0x35899a,_0x5ddf('0x3c'));_0x19bc8c[_0x5ddf('0x42')]=_[_0x5ddf('0x43')](_0x447fb2['query']);_0x19bc8c[_0x5ddf('0x44')]=_['intersection'](_0x19bc8c[_0x5ddf('0x45')],_0x19bc8c[_0x5ddf('0x42')]);_0x24fa15['attributes']=_[_0x5ddf('0x46')](_0x19bc8c['model'],qs[_0x5ddf('0x47')](_0x447fb2[_0x5ddf('0x42')][_0x5ddf('0x47')]));_0x24fa15['attributes']=_0x24fa15['attributes']['length']?_0x24fa15[_0x5ddf('0x48')]:_0x19bc8c['model'];if(!_0x447fb2[_0x5ddf('0x42')][_0x5ddf('0x49')]('nolimit')){_0x24fa15['limit']=qs[_0x5ddf('0x33')](_0x447fb2[_0x5ddf('0x42')][_0x5ddf('0x33')]);_0x24fa15[_0x5ddf('0x32')]=qs[_0x5ddf('0x32')](_0x447fb2[_0x5ddf('0x42')]['offset']);}_0x24fa15[_0x5ddf('0x4a')]=qs[_0x5ddf('0x4b')](_0x447fb2[_0x5ddf('0x42')][_0x5ddf('0x4b')]);_0x24fa15['where']=qs['filters'](_['pick'](_0x447fb2['query'],_0x19bc8c[_0x5ddf('0x44')]),_0x35899a);if(_0x447fb2[_0x5ddf('0x42')][_0x5ddf('0x4c')]){_0x24fa15[_0x5ddf('0x4d')]=_['merge'](_0x24fa15[_0x5ddf('0x4d')],{'$or':_['map'](_0x35899a,function(_0x315cc3){if(_0x315cc3[_0x5ddf('0x4e')]!==_0x5ddf('0x4f')){var _0x2bced2={};_0x2bced2[_0x315cc3['name']]={'$like':'%'+_0x447fb2[_0x5ddf('0x42')][_0x5ddf('0x4c')]+'%'};return _0x2bced2;}})});}_0x24fa15=_[_0x5ddf('0x50')]({},_0x24fa15,_0x447fb2[_0x5ddf('0x51')]);var _0x46ef32={'where':_0x24fa15['where']};return db['WhatsappMessage'][_0x5ddf('0x31')](_0x46ef32)[_0x5ddf('0x52')](function(_0x4f0476){_0x408191[_0x5ddf('0x31')]=_0x4f0476;if(_0x447fb2[_0x5ddf('0x42')][_0x5ddf('0x53')]){_0x24fa15[_0x5ddf('0x54')]=[{'all':!![]}];}return db[_0x5ddf('0x3f')][_0x5ddf('0x55')](_0x24fa15);})['then'](function(_0x40ea9e){_0x408191[_0x5ddf('0x56')]=_0x40ea9e;return _0x408191;})[_0x5ddf('0x52')](respondWithFilteredResult(_0xdcee38,_0x24fa15))[_0x5ddf('0x2d')](handleError(_0xdcee38,null));};exports['show']=function(_0x418fc9,_0x1dfdb1){var _0xecc02e={'raw':!![],'where':{'id':_0x418fc9[_0x5ddf('0x57')]['id']}},_0x1c2bd7={};_0x1c2bd7['model']=_['keys'](db[_0x5ddf('0x3f')]['rawAttributes']);_0x1c2bd7['query']=_[_0x5ddf('0x43')](_0x418fc9['query']);_0x1c2bd7[_0x5ddf('0x44')]=_[_0x5ddf('0x46')](_0x1c2bd7['model'],_0x1c2bd7[_0x5ddf('0x42')]);_0xecc02e[_0x5ddf('0x48')]=_[_0x5ddf('0x46')](_0x1c2bd7['model'],qs[_0x5ddf('0x47')](_0x418fc9[_0x5ddf('0x42')][_0x5ddf('0x47')]));_0xecc02e[_0x5ddf('0x48')]=_0xecc02e[_0x5ddf('0x48')][_0x5ddf('0x58')]?_0xecc02e[_0x5ddf('0x48')]:_0x1c2bd7[_0x5ddf('0x45')];if(_0x418fc9['query'][_0x5ddf('0x53')]){_0xecc02e[_0x5ddf('0x54')]=[{'all':!![]}];}_0xecc02e=_[_0x5ddf('0x50')]({},_0xecc02e,_0x418fc9[_0x5ddf('0x51')]);return db[_0x5ddf('0x3f')][_0x5ddf('0x59')](_0xecc02e)['then'](handleEntityNotFound(_0x1dfdb1,null))[_0x5ddf('0x52')](respondWithResult(_0x1dfdb1,null))[_0x5ddf('0x2d')](handleError(_0x1dfdb1,null));};exports['create']=function(_0xfa14f5,_0x25aa97){return db[_0x5ddf('0x3f')][_0x5ddf('0x5a')](_0xfa14f5['body'],{})['then'](respondWithResult(_0x25aa97,0xc9))[_0x5ddf('0x2d')](handleError(_0x25aa97,null));};exports[_0x5ddf('0x39')]=function(_0x88ddfb,_0x137e2e){if(_0x88ddfb[_0x5ddf('0x5b')]['id']){delete _0x88ddfb['body']['id'];}return db['WhatsappMessage'][_0x5ddf('0x59')]({'where':{'id':_0x88ddfb[_0x5ddf('0x57')]['id']}})[_0x5ddf('0x52')](handleEntityNotFound(_0x137e2e,null))[_0x5ddf('0x52')](saveUpdates(_0x88ddfb[_0x5ddf('0x5b')],null))[_0x5ddf('0x52')](respondWithResult(_0x137e2e,null))['catch'](handleError(_0x137e2e,null));};exports[_0x5ddf('0x3a')]=function(_0x369580,_0x5c1710){return db[_0x5ddf('0x3f')]['find']({'where':{'id':_0x369580[_0x5ddf('0x57')]['id']}})[_0x5ddf('0x52')](handleEntityNotFound(_0x5c1710,null))[_0x5ddf('0x52')](removeEntity(_0x5c1710,null))[_0x5ddf('0x2d')](handleError(_0x5c1710,null));};exports['describe']=function(_0x3887e8,_0x1c9c6c){return db[_0x5ddf('0x3f')][_0x5ddf('0x5c')]()['then'](respondWithResult(_0x1c9c6c,null))['catch'](handleError(_0x1c9c6c,null));};var interaction_log=require(_0x5ddf('0x14'))(_0x5ddf('0x5d'));exports[_0x5ddf('0x5e')]=function(_0x21adab,_0x34a7e3,_0x24928c){var _0x370063={'channel':_0x5ddf('0x5f')};if(_0x21adab[_0x5ddf('0x5b')]['id']){delete _0x21adab[_0x5ddf('0x5b')]['id'];}_0x21adab[_0x5ddf('0x5b')][_0x5ddf('0x60')]=!![];_0x21adab['body']['readAt']=moment()[_0x5ddf('0x61')](_0x5ddf('0x62'));_0x21adab[_0x5ddf('0x5b')][_0x5ddf('0x63')]=_0x21adab[_0x5ddf('0x5b')][_0x5ddf('0x63')]||_0x21adab[_0x5ddf('0x64')]['id'];return db[_0x5ddf('0x3f')]['find']({'where':{'id':_0x21adab[_0x5ddf('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x5ddf('0x65')],'as':_0x5ddf('0x66')}]})[_0x5ddf('0x52')](handleEntityNotFound(_0x34a7e3,null))[_0x5ddf('0x52')](saveUpdates(_0x21adab[_0x5ddf('0x5b')],null))[_0x5ddf('0x52')](function(_0x3e9d23){if(_0x3e9d23){_0x370063['message']=_0x3e9d23[_0x5ddf('0x67')]({'plain':!![]});return db[_0x5ddf('0x68')][_0x5ddf('0x59')]({'where':{'id':_0x3e9d23[_0x5ddf('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x34a7e3,null))['then'](function(_0x493596){if(_0x493596){return _0x493596['update']({'UserId':_0x21adab[_0x5ddf('0x5b')][_0x5ddf('0x63')],'read1stAt':_[_0x5ddf('0x6a')](_0x493596[_0x5ddf('0x6b')])?moment()[_0x5ddf('0x61')](_0x5ddf('0x62')):undefined});}return null;})[_0x5ddf('0x52')](function(_0x192c08){if(_0x192c08){_0x370063[_0x5ddf('0x6c')]=_0x192c08[_0x5ddf('0x67')]({'plain':!![]});interaction_log[_0x5ddf('0x24')](_0x5ddf('0x6d'),_0x21adab[_0x5ddf('0x64')]['id'],_0x21adab['user'][_0x5ddf('0x3c')],_0x21adab['user'][_0x5ddf('0x6e')],_0x370063[_0x5ddf('0x6c')]['id'],_0x21adab['body']?JSON[_0x5ddf('0x28')](_0x21adab[_0x5ddf('0x5b')]):'null');return respondWithRpcPromise(_0x5ddf('0x6f'),_0x5ddf('0x70'),_0x370063);}return null;})[_0x5ddf('0x52')](function(_0x395c94){if(_0x395c94){if(_0x21adab[_0x5ddf('0x5b')][_0x5ddf('0x71')]){_0x370063[_0x5ddf('0x2b')][_0x5ddf('0x72')]=util['format'](_0x5ddf('0x73'),_0x21adab[_0x5ddf('0x64')][_0x5ddf('0x3c')]);_0x370063['message'][_0x5ddf('0x74')]=_0x370063[_0x5ddf('0x74')];_0x370063['message'][_0x5ddf('0x75')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x5ddf('0x76'),'message':_0x370063[_0x5ddf('0x2b')]},client9002)[_0x5ddf('0x52')](function(){return _0x370063;});}return _0x370063;}return null;})[_0x5ddf('0x52')](respondWithResult(_0x34a7e3,null))[_0x5ddf('0x2d')](handleError(_0x34a7e3,null));};var interaction_log=require(_0x5ddf('0x14'))(_0x5ddf('0x5d'));exports['reject']=function(_0x29d851,_0x1a07b3,_0x22b017){var _0xeac68b={'agent':{},'channel':_0x5ddf('0x5f')};if(_0x29d851['body']['id']){delete _0x29d851[_0x5ddf('0x5b')]['id'];}_0x29d851['body']['UserId']=_0x29d851['body'][_0x5ddf('0x63')]||_0x29d851[_0x5ddf('0x64')]['id'];_0xeac68b['agent']['id']=_0x29d851['body'][_0x5ddf('0x63')];return db[_0x5ddf('0x3f')][_0x5ddf('0x59')]({'where':{'id':_0x29d851[_0x5ddf('0x57')]['id'],'UserId':null}})[_0x5ddf('0x52')](handleEntityNotFound(_0x1a07b3,null))[_0x5ddf('0x52')](function(_0x530c85){if(_0x530c85){_0xeac68b[_0x5ddf('0x2b')]=_0x530c85['get']({'plain':!![]});return db['WhatsappInteraction'][_0x5ddf('0x59')]({'where':{'id':_0x530c85['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1a07b3,null))[_0x5ddf('0x52')](function(_0x2e1959){if(_0x2e1959){_0xeac68b[_0x5ddf('0x6c')]=_0x2e1959[_0x5ddf('0x67')]({'plain':!![]});interaction_log[_0x5ddf('0x24')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x29d851['user']['id'],_0x29d851[_0x5ddf('0x64')][_0x5ddf('0x3c')],_0x29d851[_0x5ddf('0x64')][_0x5ddf('0x6e')],_0xeac68b[_0x5ddf('0x6c')]['id'],_0x29d851['body']?JSON['stringify'](_0x29d851[_0x5ddf('0x5b')]):_0x5ddf('0x77'));return respondWithRpcPromise(_0x5ddf('0x78'),_0x5ddf('0x79'),_0xeac68b);}return null;})[_0x5ddf('0x52')](function(_0xfc2698){if(_0xfc2698){_0xfc2698['message']['interface']=util[_0x5ddf('0x61')](_0x5ddf('0x73'),_0x29d851[_0x5ddf('0x64')][_0x5ddf('0x3c')]);_0xfc2698[_0x5ddf('0x2b')][_0x5ddf('0x74')]=_0xeac68b['channel'];_0xfc2698['message'][_0x5ddf('0x75')]=_0x5ddf('0x37');respondWithRpcPromise(_0x5ddf('0x7a'),_0x5ddf('0x7a'),{'event':_0x5ddf('0x7b'),'message':_0xfc2698[_0x5ddf('0x2b')]},client9002);return _0xeac68b;}return null;})[_0x5ddf('0x52')](respondWithResult(_0x1a07b3,null))[_0x5ddf('0x2d')](handleError(_0x1a07b3,null));};exports[_0x5ddf('0x2f')]=function(_0x1addf7,_0x16d1eb,_0x1d939d){if(_0x1addf7[_0x5ddf('0x5b')]['id']){delete _0x1addf7[_0x5ddf('0x5b')]['id'];}var _0xbe00eb;return db[_0x5ddf('0x3f')][_0x5ddf('0x59')]({'where':{'id':_0x1addf7[_0x5ddf('0x57')]['id']}})[_0x5ddf('0x52')](handleEntityNotFound(_0x16d1eb,null))[_0x5ddf('0x52')](function(_0x5af00f){if(_0x5af00f){_0xbe00eb=_0x5af00f;return db[_0x5ddf('0x7c')][_0x5ddf('0x59')]({'where':{'id':_0x5af00f[_0x5ddf('0x7d')]}});}})[_0x5ddf('0x52')](handleEntityNotFound(_0x16d1eb,null))['then'](function(_0x5cf2e3){if(_0x5cf2e3){logger[_0x5ddf('0x26')](_0x5ddf('0x7e'),_0x5ddf('0x2f'),_0x5ddf('0x7f'),_0x5cf2e3[_0x5ddf('0x4e')],util[_0x5ddf('0x80')](_0x1addf7[_0x5ddf('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5cf2e3[_0x5ddf('0x4e')]){case _0x5ddf('0x81'):if(_0x1addf7[_0x5ddf('0x5b')]['MessageSid']&&_0x1addf7[_0x5ddf('0x5b')]['MessageSid']===_0xbe00eb[_0x5ddf('0x82')]&&_0x1addf7[_0x5ddf('0x5b')][_0x5ddf('0x83')]&&_0x1addf7[_0x5ddf('0x5b')][_0x5ddf('0x83')]===_0x5ddf('0x60')){return _0xbe00eb[_0x5ddf('0x39')]({'read':!![]});}else{logger[_0x5ddf('0x29')](_0x5ddf('0x84'),'status',_0x5ddf('0x81'),util['inspect'](_0x1addf7[_0x5ddf('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0xbe00eb;}})[_0x5ddf('0x52')](respondWithResult(_0x16d1eb,null))[_0x5ddf('0x2d')](handleError(_0x16d1eb,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 421aee2..c57b691 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x4b25f6,_0x944000){var _0x14a49c=function(_0x2e163d){while(--_0x2e163d){_0x4b25f6['push'](_0x4b25f6['shift']());}};_0x14a49c(++_0x944000);}(_0x5f2f,0x73));var _0xf5f2=function(_0x85fc7a,_0x214672){_0x85fc7a=_0x85fc7a-0x0;var _0xf5c832=_0x5f2f[_0x85fc7a];return _0xf5c832;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x1a0f4c,_0xf66275){var _0x599c9d=function(_0x22e11c){while(--_0x22e11c){_0x1a0f4c['push'](_0x1a0f4c['shift']());}};_0x599c9d(++_0xf66275);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0xb10b[_0x1f7201];return _0x289fd2;};'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 ae9365f..889f840 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 _0xecab=['WhatsappAccount','type','twilio','accountSid','phone','authToken','messages','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','findOne','WhatsappInteractionId','then','update','createdAt','catch','error'];(function(_0x1b205d,_0x131d07){var _0x26c181=function(_0x11ba1c){while(--_0x11ba1c){_0x1b205d['push'](_0x1b205d['shift']());}};_0x26c181(++_0x131d07);}(_0xecab,0xc3));var _0xbeca=function(_0x43df5e,_0x2d3e04){_0x43df5e=_0x43df5e-0x0;var _0x51f00b=_0xecab[_0x43df5e];return _0x51f00b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbeca('0x0'))(_0xbeca('0x1'));var moment=require(_0xbeca('0x2'));var BPromise=require(_0xbeca('0x3'));var rp=require(_0xbeca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbeca('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xbeca('0x6')]=function(_0x2d0f49,_0x5618f4){return _0x2d0f49[_0xbeca('0x7')](_0xbeca('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xbeca('0x9')]},{'name':_0xbeca('0xa'),'fields':['body'],'type':_0xbeca('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x554a76,_0x51b088,_0xe02a39){var _0x35f2e9=_0x2d0f49['models'];var _0x47a884=_0x554a76[_0xbeca('0xc')]({'plain':!![]});if(_0x47a884['direction'][_0xbeca('0xd')]()==='in'||_0x47a884[_0xbeca('0xe')]['toLowerCase']()===_0xbeca('0xf')&&!_0x47a884[_0xbeca('0x10')]&&!_[_0xbeca('0x11')](_0x47a884['UserId'])){_0x35f2e9['WhatsappInteraction'][_0xbeca('0x12')]({'where':{'id':_0x47a884[_0xbeca('0x13')]}})[_0xbeca('0x14')](function(_0x601b65){if(_0x601b65){_0x601b65[_0xbeca('0x15')]({'lastMsgAt':_0x47a884[_0xbeca('0x16')],'lastMsgDirection':_0x47a884[_0xbeca('0xe')]['toLowerCase']()});}})[_0xbeca('0x17')](function(_0x4ad560){console[_0xbeca('0x18')](_0x4ad560);});}if(_0x47a884[_0xbeca('0xe')]===_0xbeca('0xf')&&!_0x47a884[_0xbeca('0x10')]){var _0x1b1e48;_0x35f2e9[_0xbeca('0x19')]['find']({'where':{'id':_0x47a884['WhatsappAccountId']},'raw':!![]})[_0xbeca('0x14')](function(_0x35e8b9){_0x1b1e48=_0x35e8b9;if(_0x1b1e48&&_0x1b1e48[_0xbeca('0x1a')]){switch(_0x1b1e48[_0xbeca('0x1a')]){case _0xbeca('0x1b'):var _0x4c2d36=require(_0xbeca('0x1b'));if(_0x1b1e48[_0xbeca('0x1c')]&&_0x1b1e48['authToken']&&_0x1b1e48[_0xbeca('0x1d')]){var _0x404027=new _0x4c2d36(_0x1b1e48[_0xbeca('0x1c')],_0x1b1e48[_0xbeca('0x1e')]);_0x404027[_0xbeca('0x1f')]['create']({'body':_0x47a884[_0xbeca('0x20')],'to':_0xbeca('0x21')+_0x47a884[_0xbeca('0x1d')],'from':'whatsapp:'+_0x1b1e48['phone'],'statusCallback':_0x1b1e48[_0xbeca('0x22')]+_0xbeca('0x23')+_0x47a884['id']+_0xbeca('0x24')+_0x1b1e48[_0xbeca('0x25')]})[_0xbeca('0x14')](function(_0x10148a){if(_0x10148a['sid']){return _0x554a76[_0xbeca('0x15')]({'messageId':_0x10148a['sid']});}})[_0xbeca('0x17')](function(_0x402ef1){logger[_0xbeca('0x18')](_0xbeca('0x26'),'afterCreate',_0xbeca('0x1b'),util[_0xbeca('0x27')](_0x402ef1,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xbeca('0x28'),'twilio',_0xbeca('0x29'));}break;}}})[_0xbeca('0x2a')](function(){_0xe02a39();});}else{_0xe02a39();}}},'charset':_0xbeca('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xffec=['token','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','./whatsappMessage.attributes','exports','define','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','out','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','accountSid','create','whatsapp:','phone','remote','/api/whatsapp/messages/'];(function(_0x4b4fb4,_0x432234){var _0x27fd2f=function(_0x46aabb){while(--_0x46aabb){_0x4b4fb4['push'](_0x4b4fb4['shift']());}};_0x27fd2f(++_0x432234);}(_0xffec,0x88));var _0xcffe=function(_0x35cf6d,_0x2ad75a){_0x35cf6d=_0x35cf6d-0x0;var _0x855c00=_0xffec[_0x35cf6d];return _0x855c00;};'use strict';var _=require(_0xcffe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcffe('0x1'));var moment=require('moment');var BPromise=require(_0xcffe('0x2'));var rp=require(_0xcffe('0x3'));var fs=require('fs');var path=require(_0xcffe('0x4'));var rimraf=require(_0xcffe('0x5'));var config=require('../../config/environment');var attributes=require(_0xcffe('0x6'));module[_0xcffe('0x7')]=function(_0x44271d,_0x351588){return _0x44271d[_0xcffe('0x8')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xcffe('0x9'),'fields':[_0xcffe('0x9')]},{'name':_0xcffe('0xa'),'fields':[_0xcffe('0xb')],'type':_0xcffe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e757c,_0x46b0ad,_0x4b45d0){var _0x1982f2=_0x44271d['models'];var _0x1fcfa3=_0x2e757c['get']({'plain':!![]});if(_0x1fcfa3[_0xcffe('0xd')][_0xcffe('0xe')]()==='in'||_0x1fcfa3['direction'][_0xcffe('0xe')]()===_0xcffe('0xf')&&!_0x1fcfa3['secret']&&!_['isNil'](_0x1fcfa3[_0xcffe('0x10')])){_0x1982f2[_0xcffe('0x11')][_0xcffe('0x12')]({'where':{'id':_0x1fcfa3['WhatsappInteractionId']}})[_0xcffe('0x13')](function(_0x4d8299){if(_0x4d8299){_0x4d8299[_0xcffe('0x14')]({'lastMsgAt':_0x1fcfa3[_0xcffe('0x15')],'lastMsgDirection':_0x1fcfa3[_0xcffe('0xd')][_0xcffe('0xe')]()});}})[_0xcffe('0x16')](function(_0x127bea){console[_0xcffe('0x17')](_0x127bea);});}if(_0x1fcfa3['direction']===_0xcffe('0xf')&&!_0x1fcfa3['secret']){var _0x4f0cba;_0x1982f2[_0xcffe('0x18')][_0xcffe('0x19')]({'where':{'id':_0x1fcfa3[_0xcffe('0x1a')]},'raw':!![]})['then'](function(_0x4d5039){_0x4f0cba=_0x4d5039;if(_0x4f0cba&&_0x4f0cba[_0xcffe('0x1b')]){switch(_0x4f0cba[_0xcffe('0x1b')]){case _0xcffe('0x1c'):var _0x5b3597=require(_0xcffe('0x1c'));if(_0x4f0cba['accountSid']&&_0x4f0cba[_0xcffe('0x1d')]&&_0x4f0cba['phone']){var _0x10f9ce=new _0x5b3597(_0x4f0cba[_0xcffe('0x1e')],_0x4f0cba[_0xcffe('0x1d')]);_0x10f9ce['messages'][_0xcffe('0x1f')]({'body':_0x1fcfa3[_0xcffe('0xb')],'to':_0xcffe('0x20')+_0x1fcfa3[_0xcffe('0x21')],'from':_0xcffe('0x20')+_0x4f0cba[_0xcffe('0x21')],'statusCallback':_0x4f0cba[_0xcffe('0x22')]+_0xcffe('0x23')+_0x1fcfa3['id']+'/status?token='+_0x4f0cba[_0xcffe('0x24')]})[_0xcffe('0x13')](function(_0x527e93){if(_0x527e93['sid']){return _0x2e757c[_0xcffe('0x14')]({'messageId':_0x527e93['sid']});}})[_0xcffe('0x16')](function(_0x119fc4){logger[_0xcffe('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xcffe('0x25'),_0xcffe('0x1c'),util[_0xcffe('0x26')](_0x119fc4,{'showHidden':![],'depth':null}));});}else{logger[_0xcffe('0x17')](_0xcffe('0x27'),'afterCreate',_0xcffe('0x1c'),_0xcffe('0x28'));}break;}}})[_0xcffe('0x29')](function(){_0x4b45d0();});}else{_0x4b45d0();}}},'charset':'utf8mb4','collate':_0xcffe('0x2a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 5c89be4..8d17512 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 _0x622a=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateWhatsappMessage','create','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x25bf36,_0x3d5f07){var _0x4e5078=function(_0xc4984f){while(--_0xc4984f){_0x25bf36['push'](_0x25bf36['shift']());}};_0x4e5078(++_0x3d5f07);}(_0x622a,0x79));var _0xa622=function(_0x264ff3,_0x5b7be8){_0x264ff3=_0x264ff3-0x0;var _0x2673af=_0x622a[_0x264ff3];return _0x2673af;};'use strict';var _=require(_0xa622('0x0'));var util=require(_0xa622('0x1'));var moment=require('moment');var BPromise=require(_0xa622('0x2'));var rs=require(_0xa622('0x3'));var fs=require('fs');var Redis=require(_0xa622('0x4'));var db=require(_0xa622('0x5'))['db'];var utils=require(_0xa622('0x6'));var logger=require(_0xa622('0x7'))(_0xa622('0x8'));var config=require(_0xa622('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa622('0xa')][_0xa622('0xb')]({'port':0x232a});config[_0xa622('0xc')]=_[_0xa622('0xd')](config[_0xa622('0xc')],{'host':_0xa622('0xe'),'port':0x18eb});var socket=require(_0xa622('0xf'))(new Redis(config[_0xa622('0xc')]));require(_0xa622('0x10'))[_0xa622('0x11')](socket);function respondWithRpcPromise(_0x3d4323,_0x4ea98a,_0x298c79){return new BPromise(function(_0x4f08f3,_0x4a42d0){return client['request'](_0x3d4323,_0x298c79)[_0xa622('0x12')](function(_0x21e318){logger['info'](_0xa622('0x13'),_0x4ea98a,_0xa622('0x14'));logger[_0xa622('0x15')](_0xa622('0x16'),_0x4ea98a,'request\x20sent',JSON['stringify'](_0x21e318));if(_0x21e318[_0xa622('0x17')]){if(_0x21e318[_0xa622('0x17')][_0xa622('0x18')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4ea98a,_0x21e318['error']['message']);return _0x4a42d0(_0x21e318['error'][_0xa622('0x19')]);}logger['error'](_0xa622('0x13'),_0x4ea98a,_0x21e318[_0xa622('0x17')]['message']);return _0x4f08f3(_0x21e318['error'][_0xa622('0x19')]);}else{logger[_0xa622('0x1a')](_0xa622('0x13'),_0x4ea98a,_0xa622('0x14'));_0x4f08f3(_0x21e318[_0xa622('0x1b')][_0xa622('0x19')]);}})[_0xa622('0x1c')](function(_0x22b7a2){logger['error'](_0xa622('0x13'),_0x4ea98a,_0x22b7a2);_0x4a42d0(_0x22b7a2);});});}exports[_0xa622('0x1d')]=function(_0x158f17){var _0x308d1a=this;return new Promise(function(_0x416b39,_0x3dd7eb){return db['WhatsappMessage'][_0xa622('0x1e')](_0x158f17['body'],{'raw':_0x158f17[_0xa622('0x1f')]?_0x158f17[_0xa622('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xa622('0x12')](function(_0x497373){logger[_0xa622('0x1a')](_0xa622('0x1d'),_0x158f17);logger['debug'](_0xa622('0x1d'),_0x158f17,JSON['stringify'](_0x497373));_0x416b39(_0x497373);})[_0xa622('0x1c')](function(_0x482387){logger[_0xa622('0x17')]('CreateWhatsappMessage',_0x482387[_0xa622('0x19')],_0x158f17);_0x3dd7eb(_0x308d1a[_0xa622('0x17')](0x1f4,_0x482387[_0xa622('0x19')]));});});}; \ No newline at end of file +var _0xfe20=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','WhatsappMessage','options','raw','CreateWhatsappMessage'];(function(_0x3a80c3,_0x32f5fe){var _0x3bdb79=function(_0x1536b7){while(--_0x1536b7){_0x3a80c3['push'](_0x3a80c3['shift']());}};_0x3bdb79(++_0x32f5fe);}(_0xfe20,0x1c0));var _0x0fe2=function(_0x4c02ce,_0x1cc41e){_0x4c02ce=_0x4c02ce-0x0;var _0x246b95=_0xfe20[_0x4c02ce];return _0x246b95;};'use strict';var _=require(_0x0fe2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0fe2('0x1'));var rs=require(_0x0fe2('0x2'));var fs=require('fs');var Redis=require(_0x0fe2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fe2('0x4'));var logger=require(_0x0fe2('0x5'))('rpc');var config=require(_0x0fe2('0x6'));var jayson=require(_0x0fe2('0x7'));var client=jayson['client'][_0x0fe2('0x8')]({'port':0x232a});config[_0x0fe2('0x9')]=_[_0x0fe2('0xa')](config[_0x0fe2('0x9')],{'host':_0x0fe2('0xb'),'port':0x18eb});var socket=require(_0x0fe2('0xc'))(new Redis(config['redis']));require(_0x0fe2('0xd'))[_0x0fe2('0xe')](socket);function respondWithRpcPromise(_0x172fff,_0x3c5083,_0x5210c6){return new BPromise(function(_0x351518,_0x2f4f68){return client[_0x0fe2('0xf')](_0x172fff,_0x5210c6)[_0x0fe2('0x10')](function(_0x495f7b){logger[_0x0fe2('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x3c5083,_0x0fe2('0x12'));logger[_0x0fe2('0x13')](_0x0fe2('0x14'),_0x3c5083,_0x0fe2('0x12'),JSON[_0x0fe2('0x15')](_0x495f7b));if(_0x495f7b[_0x0fe2('0x16')]){if(_0x495f7b[_0x0fe2('0x16')][_0x0fe2('0x17')]===0x1f4){logger[_0x0fe2('0x16')](_0x0fe2('0x18'),_0x3c5083,_0x495f7b['error'][_0x0fe2('0x19')]);return _0x2f4f68(_0x495f7b[_0x0fe2('0x16')][_0x0fe2('0x19')]);}logger['error'](_0x0fe2('0x18'),_0x3c5083,_0x495f7b['error'][_0x0fe2('0x19')]);return _0x351518(_0x495f7b[_0x0fe2('0x16')][_0x0fe2('0x19')]);}else{logger['info'](_0x0fe2('0x18'),_0x3c5083,_0x0fe2('0x12'));_0x351518(_0x495f7b[_0x0fe2('0x1a')][_0x0fe2('0x19')]);}})[_0x0fe2('0x1b')](function(_0xcd9387){logger[_0x0fe2('0x16')](_0x0fe2('0x18'),_0x3c5083,_0xcd9387);_0x2f4f68(_0xcd9387);});});}exports['CreateWhatsappMessage']=function(_0x45f54a){var _0x25c401=this;return new Promise(function(_0x49f487,_0x40f02f){return db[_0x0fe2('0x1c')]['create'](_0x45f54a['body'],{'raw':_0x45f54a[_0x0fe2('0x1d')]?_0x45f54a[_0x0fe2('0x1d')][_0x0fe2('0x1e')]===undefined?!![]:![]:!![]})[_0x0fe2('0x10')](function(_0x46e415){logger[_0x0fe2('0x11')]('CreateWhatsappMessage',_0x45f54a);logger['debug'](_0x0fe2('0x1f'),_0x45f54a,JSON['stringify'](_0x46e415));_0x49f487(_0x46e415);})[_0x0fe2('0x1b')](function(_0x4355fe){logger['error'](_0x0fe2('0x1f'),_0x4355fe[_0x0fe2('0x19')],_0x45f54a);_0x40f02f(_0x25c401[_0x0fe2('0x16')](0x1f4,_0x4355fe[_0x0fe2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 66fb8f1..8496514 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 _0xeedb=['length','whatsappMessage:','./whatsappMessage.events','save','update','removeListener','register'];(function(_0x5459c1,_0x36f6f0){var _0x3f99b5=function(_0x512bea){while(--_0x512bea){_0x5459c1['push'](_0x5459c1['shift']());}};_0x3f99b5(++_0x36f6f0);}(_0xeedb,0xc6));var _0xbeed=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xeedb[_0x3054be];return _0x3df150;};'use strict';var WhatsappMessageEvents=require(_0xbeed('0x0'));var events=[_0xbeed('0x1'),'remove',_0xbeed('0x2')];function createListener(_0x29ad00,_0x5b2160){return function(_0x11b96c){_0x5b2160['emit'](_0x29ad00,_0x11b96c);};}function removeListener(_0x4f6b5d,_0x63ae9d){return function(){WhatsappMessageEvents[_0xbeed('0x3')](_0x4f6b5d,_0x63ae9d);};}exports[_0xbeed('0x4')]=function(_0x1c342b){for(var _0x40edf7=0x0,_0x4baa2b=events[_0xbeed('0x5')];_0x40edf7<_0x4baa2b;_0x40edf7++){var _0x551704=events[_0x40edf7];var _0x286565=createListener(_0xbeed('0x6')+_0x551704,_0x1c342b);WhatsappMessageEvents['on'](_0x551704,_0x286565);}}; \ No newline at end of file +var _0x1629=['update','length','./whatsappMessage.events','save','remove'];(function(_0x27ccb6,_0x103913){var _0x412043=function(_0x3c1624){while(--_0x3c1624){_0x27ccb6['push'](_0x27ccb6['shift']());}};_0x412043(++_0x103913);}(_0x1629,0x1d8));var _0x9162=function(_0x19d5c6,_0x1092bc){_0x19d5c6=_0x19d5c6-0x0;var _0x21877f=_0x1629[_0x19d5c6];return _0x21877f;};'use strict';var WhatsappMessageEvents=require(_0x9162('0x0'));var events=[_0x9162('0x1'),_0x9162('0x2'),_0x9162('0x3')];function createListener(_0x5045a6,_0x31e5fc){return function(_0x567431){_0x31e5fc['emit'](_0x5045a6,_0x567431);};}function removeListener(_0x16bc88,_0x2a8dc1){return function(){WhatsappMessageEvents['removeListener'](_0x16bc88,_0x2a8dc1);};}exports['register']=function(_0x13368a){for(var _0x1defdd=0x0,_0x4b432e=events[_0x9162('0x4')];_0x1defdd<_0x4b432e;_0x1defdd++){var _0x11d90b=events[_0x1defdd];var _0x168267=createListener('whatsappMessage:'+_0x11d90b,_0x13368a);WhatsappMessageEvents['on'](_0x11d90b,_0x168267);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index b02a5f2..aecee4f 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 _0x444c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/describe','isAuthenticated','describe','get','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','put','update','destroy','delete','removeTeams','removeAgents','path','connect-timeout','express'];(function(_0x33a964,_0x2e021d){var _0x3cee4d=function(_0x47d12b){while(--_0x47d12b){_0x33a964['push'](_0x33a964['shift']());}};_0x3cee4d(++_0x2e021d);}(_0x444c,0xde));var _0xc444=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x444c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc444('0x0'));var timeout=require(_0xc444('0x1'));var express=require(_0xc444('0x2'));var router=express[_0xc444('0x3')]();var auth=require(_0xc444('0x4'));var interaction=require(_0xc444('0x5'));var config=require(_0xc444('0x6'));var controller=require('./whatsappQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc444('0x7'),auth[_0xc444('0x8')](),controller[_0xc444('0x9')]);router[_0xc444('0xa')](_0xc444('0xb'),auth[_0xc444('0x8')](),controller[_0xc444('0xc')]);router[_0xc444('0xa')]('/:id/members',auth[_0xc444('0x8')](),controller[_0xc444('0xd')]);router[_0xc444('0xa')](_0xc444('0xe'),auth[_0xc444('0x8')](),controller['getTeams']);router[_0xc444('0xa')](_0xc444('0xf'),auth['isAuthenticated'](),controller[_0xc444('0x10')]);router[_0xc444('0x11')]('/',auth[_0xc444('0x8')](),controller['create']);router[_0xc444('0x11')]('/:id/teams',auth[_0xc444('0x8')](),controller[_0xc444('0x12')]);router['post'](_0xc444('0xf'),auth[_0xc444('0x8')](),controller['addAgents']);router[_0xc444('0x13')]('/:id',auth[_0xc444('0x8')](),controller[_0xc444('0x14')]);router['delete'](_0xc444('0xb'),auth[_0xc444('0x8')](),controller[_0xc444('0x15')]);router[_0xc444('0x16')](_0xc444('0xe'),auth[_0xc444('0x8')](),controller[_0xc444('0x17')]);router[_0xc444('0x16')]('/:id/users',auth[_0xc444('0x8')](),controller[_0xc444('0x18')]);module['exports']=router; \ No newline at end of file +var _0x3a48=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router'];(function(_0x22a6f6,_0x5d6ea9){var _0x464440=function(_0x147c88){while(--_0x147c88){_0x22a6f6['push'](_0x22a6f6['shift']());}};_0x464440(++_0x5d6ea9);}(_0x3a48,0xe5));var _0x83a4=function(_0x31dd4c,_0x1ec56b){_0x31dd4c=_0x31dd4c-0x0;var _0x45e2fc=_0x3a48[_0x31dd4c];return _0x45e2fc;};'use strict';var multer=require(_0x83a4('0x0'));var util=require(_0x83a4('0x1'));var path=require(_0x83a4('0x2'));var timeout=require(_0x83a4('0x3'));var express=require('express');var router=express[_0x83a4('0x4')]();var auth=require(_0x83a4('0x5'));var interaction=require(_0x83a4('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x83a4('0x7')]('/',auth[_0x83a4('0x8')](),controller['index']);router['get']('/describe',auth[_0x83a4('0x8')](),controller[_0x83a4('0x9')]);router[_0x83a4('0x7')]('/:id',auth[_0x83a4('0x8')](),controller['show']);router[_0x83a4('0x7')](_0x83a4('0xa'),auth[_0x83a4('0x8')](),controller['getMembers']);router[_0x83a4('0x7')](_0x83a4('0xb'),auth[_0x83a4('0x8')](),controller[_0x83a4('0xc')]);router[_0x83a4('0x7')](_0x83a4('0xd'),auth['isAuthenticated'](),controller[_0x83a4('0xe')]);router['post']('/',auth[_0x83a4('0x8')](),controller[_0x83a4('0xf')]);router[_0x83a4('0x10')]('/:id/teams',auth[_0x83a4('0x8')](),controller[_0x83a4('0x11')]);router['post'](_0x83a4('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0x83a4('0x12')](_0x83a4('0x13'),auth['isAuthenticated'](),controller[_0x83a4('0x14')]);router[_0x83a4('0x15')](_0x83a4('0x13'),auth[_0x83a4('0x8')](),controller[_0x83a4('0x16')]);router['delete'](_0x83a4('0xb'),auth['isAuthenticated'](),controller[_0x83a4('0x17')]);router['delete'](_0x83a4('0xd'),auth[_0x83a4('0x8')](),controller[_0x83a4('0x18')]);module[_0x83a4('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 40191ad..2db804b 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 _0x9025=['sequelize','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3a7ee6,_0x59bf43){var _0x4ba597=function(_0x22656f){while(--_0x22656f){_0x3a7ee6['push'](_0x3a7ee6['shift']());}};_0x4ba597(++_0x59bf43);}(_0x9025,0x1ce));var _0x5902=function(_0x1a7fd9,_0x93973d){_0x1a7fd9=_0x1a7fd9-0x0;var _0x4193d5=_0x9025[_0x1a7fd9];return _0x4193d5;};'use strict';var Sequelize=require(_0x5902('0x0'));module['exports']={'name':{'type':Sequelize[_0x5902('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5902('0x2')](_0x5902('0x3'),_0x5902('0x4'),_0x5902('0x5'))},'description':{'type':Sequelize[_0x5902('0x1')]}}; \ No newline at end of file +var _0xf7ae=['roundrobin','exports','STRING','name','ENUM','rrmemory'];(function(_0x5385ed,_0x411c7b){var _0x1c1357=function(_0x251c77){while(--_0x251c77){_0x5385ed['push'](_0x5385ed['shift']());}};_0x1c1357(++_0x411c7b);}(_0xf7ae,0xf7));var _0xef7a=function(_0x5418c9,_0x4799bc){_0x5418c9=_0x5418c9-0x0;var _0x20bd40=_0xf7ae[_0x5418c9];return _0x20bd40;};'use strict';var Sequelize=require('sequelize');module[_0xef7a('0x0')]={'name':{'type':Sequelize[_0xef7a('0x1')],'unique':_0xef7a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xef7a('0x3')](_0xef7a('0x4'),'beepall',_0xef7a('0x5'))},'description':{'type':Sequelize[_0xef7a('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 2d0ee86..b49565d 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 _0xe19c=['request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','end','count','limit','status','set','Content-Range','json','reject','save','update','destroy','then','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserWhatsappQueue','order','pick','WhatsappQueueId','User','findAndCountAll','whatsappPause','createdAt','format','%s/%s','updatedAt','options','addTeams','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe19c,0x1a3));var _0xce19=function(_0x4c3a36,_0xdba60f){_0x4c3a36=_0x4c3a36-0x0;var _0x40f945=_0xe19c[_0x4c3a36];return _0x40f945;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xce19('0x0'));var rimraf=require(_0xce19('0x1'));var zipdir=require(_0xce19('0x2'));var jsonpatch=require(_0xce19('0x3'));var rp=require(_0xce19('0x4'));var moment=require(_0xce19('0x5'));var BPromise=require(_0xce19('0x6'));var Mustache=require('mustache');var util=require(_0xce19('0x7'));var path=require(_0xce19('0x8'));var sox=require(_0xce19('0x9'));var csv=require('to-csv');var ejs=require(_0xce19('0xa'));var fs=require('fs');var _=require(_0xce19('0xb'));var squel=require(_0xce19('0xc'));var crypto=require('crypto');var jsforce=require(_0xce19('0xd'));var deskjs=require(_0xce19('0xe'));var toCsv=require(_0xce19('0xf'));var querystring=require(_0xce19('0x10'));var Papa=require(_0xce19('0x11'));var Redis=require('ioredis');var authService=require(_0xce19('0x12'));var qs=require(_0xce19('0x13'));var as=require(_0xce19('0x14'));var hardwareService=require(_0xce19('0x15'));var logger=require('../../config/logger')(_0xce19('0x16'));var utils=require(_0xce19('0x17'));var config=require(_0xce19('0x18'));var db=require(_0xce19('0x19'))['db'];config['redis']=_['defaults'](config[_0xce19('0x1a')],{'host':_0xce19('0x1b'),'port':0x18eb});var socket=require(_0xce19('0x1c'))(new Redis(config[_0xce19('0x1a')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x5aa05a,_0x4ace3c){_0x4ace3c=_0x4ace3c||0xcc;return function(_0x4bc71c){if(_0x4bc71c){return _0x5aa05a[_0xce19('0x1d')](_0x4ace3c);}return _0x5aa05a['status'](_0x4ace3c)[_0xce19('0x1e')]();};}function respondWithResult(_0xa63ea7,_0x59be49){_0x59be49=_0x59be49||0xc8;return function(_0x1250f2){if(_0x1250f2){return _0xa63ea7['status'](_0x59be49)['json'](_0x1250f2);}};}function respondWithFilteredResult(_0x378833,_0x42383f){return function(_0x872b04){if(_0x872b04){var _0x1297de=_0x872b04[_0xce19('0x1f')],_0x594991=_0x42383f['offset'],_0x119691=_0x42383f['offset']+_0x42383f[_0xce19('0x20')],_0x4a5dc9;if(_0x119691>=_0x1297de){_0x119691=_0x1297de;_0x4a5dc9=0xc8;}else{_0x4a5dc9=0xce;}_0x378833[_0xce19('0x21')](_0x4a5dc9);return _0x378833[_0xce19('0x22')](_0xce19('0x23'),_0x594991+'-'+_0x119691+'/'+_0x1297de)[_0xce19('0x24')](_0x872b04);}return null;};}function patchUpdates(_0x76ade8){return function(_0x4851cd){try{jsonpatch['apply'](_0x4851cd,_0x76ade8,!![]);}catch(_0x42a05b){return BPromise[_0xce19('0x25')](_0x42a05b);}return _0x4851cd[_0xce19('0x26')]();};}function saveUpdates(_0x4a2b6a,_0xea5429){return function(_0x781f3){if(_0x781f3){return _0x781f3[_0xce19('0x27')](_0x4a2b6a)['then'](function(_0x1b3928){return _0x1b3928;});}return null;};}function removeEntity(_0x3bc393,_0x3fb1bc){return function(_0x20ee86){if(_0x20ee86){return _0x20ee86[_0xce19('0x28')]()[_0xce19('0x29')](function(){var _0x1436ef=_0x20ee86['get']({'plain':!![]});var _0x4abbe0=_0xce19('0x2a');return db[_0xce19('0x2b')][_0xce19('0x28')]({'where':{'type':_0x4abbe0,'resourceId':_0x1436ef['id']}})['then'](function(){return _0x20ee86;});})[_0xce19('0x29')](function(){_0x3bc393['status'](0xcc)[_0xce19('0x1e')]();});}};}function handleEntityNotFound(_0x31eb74,_0x13c83f){return function(_0x3944c7){if(!_0x3944c7){_0x31eb74[_0xce19('0x1d')](0x194);}return _0x3944c7;};}function handleError(_0x20cf06,_0x43a898){_0x43a898=_0x43a898||0x1f4;return function(_0x3da9c9){logger[_0xce19('0x2c')](_0x3da9c9[_0xce19('0x2d')]);if(_0x3da9c9[_0xce19('0x2e')]){delete _0x3da9c9[_0xce19('0x2e')];}_0x20cf06[_0xce19('0x21')](_0x43a898)[_0xce19('0x2f')](_0x3da9c9);};}exports[_0xce19('0x30')]=function(_0x151af9,_0x3a5503){var _0x2a1777={},_0x52ff6c={},_0x13c9a7={'count':0x0,'rows':[]};var _0x188d30=_[_0xce19('0x31')](db[_0xce19('0x32')]['rawAttributes'],function(_0x2823da){return{'name':_0x2823da[_0xce19('0x33')],'type':_0x2823da['type']['key']};});_0x52ff6c[_0xce19('0x34')]=_[_0xce19('0x31')](_0x188d30,'name');_0x52ff6c[_0xce19('0x35')]=_[_0xce19('0x36')](_0x151af9[_0xce19('0x35')]);_0x52ff6c[_0xce19('0x37')]=_[_0xce19('0x38')](_0x52ff6c[_0xce19('0x34')],_0x52ff6c[_0xce19('0x35')]);_0x2a1777[_0xce19('0x39')]=_[_0xce19('0x38')](_0x52ff6c[_0xce19('0x34')],qs[_0xce19('0x3a')](_0x151af9[_0xce19('0x35')]['fields']));_0x2a1777[_0xce19('0x39')]=_0x2a1777[_0xce19('0x39')]['length']?_0x2a1777['attributes']:_0x52ff6c[_0xce19('0x34')];if(!_0x151af9[_0xce19('0x35')][_0xce19('0x3b')](_0xce19('0x3c'))){_0x2a1777[_0xce19('0x20')]=qs[_0xce19('0x20')](_0x151af9[_0xce19('0x35')][_0xce19('0x20')]);_0x2a1777[_0xce19('0x3d')]=qs['offset'](_0x151af9[_0xce19('0x35')]['offset']);}_0x2a1777['order']=qs[_0xce19('0x3e')](_0x151af9[_0xce19('0x35')][_0xce19('0x3e')]);_0x2a1777[_0xce19('0x3f')]=qs[_0xce19('0x37')](_['pick'](_0x151af9[_0xce19('0x35')],_0x52ff6c['filters']),_0x188d30);if(_0x151af9['query'][_0xce19('0x40')]){_0x2a1777[_0xce19('0x3f')]=_[_0xce19('0x41')](_0x2a1777['where'],{'$or':_[_0xce19('0x31')](_0x188d30,function(_0x50aefa){if(_0x50aefa[_0xce19('0x42')]!==_0xce19('0x43')){var _0xa0dc6b={};_0xa0dc6b[_0x50aefa[_0xce19('0x2e')]]={'$like':'%'+_0x151af9[_0xce19('0x35')][_0xce19('0x40')]+'%'};return _0xa0dc6b;}})});}_0x2a1777=_['merge']({},_0x2a1777,_0x151af9['options']);var _0x259dde={'where':_0x2a1777[_0xce19('0x3f')]};return db[_0xce19('0x32')][_0xce19('0x1f')](_0x259dde)[_0xce19('0x29')](function(_0x29dfdf){_0x13c9a7['count']=_0x29dfdf;if(_0x151af9[_0xce19('0x35')][_0xce19('0x44')]){_0x2a1777[_0xce19('0x45')]=[{'all':!![]}];}return db[_0xce19('0x32')][_0xce19('0x46')](_0x2a1777);})['then'](function(_0x469623){_0x13c9a7[_0xce19('0x47')]=_0x469623;return _0x13c9a7;})[_0xce19('0x29')](respondWithFilteredResult(_0x3a5503,_0x2a1777))[_0xce19('0x48')](handleError(_0x3a5503,null));};exports['show']=function(_0x21be00,_0xb8658b){var _0x56e974={'raw':!![],'where':{'id':_0x21be00[_0xce19('0x49')]['id']}},_0x6282a8={};_0x6282a8[_0xce19('0x34')]=_[_0xce19('0x36')](db[_0xce19('0x32')][_0xce19('0x4a')]);_0x6282a8['query']=_[_0xce19('0x36')](_0x21be00[_0xce19('0x35')]);_0x6282a8[_0xce19('0x37')]=_[_0xce19('0x38')](_0x6282a8[_0xce19('0x34')],_0x6282a8[_0xce19('0x35')]);_0x56e974[_0xce19('0x39')]=_[_0xce19('0x38')](_0x6282a8['model'],qs[_0xce19('0x3a')](_0x21be00[_0xce19('0x35')][_0xce19('0x3a')]));_0x56e974['attributes']=_0x56e974['attributes'][_0xce19('0x4b')]?_0x56e974[_0xce19('0x39')]:_0x6282a8[_0xce19('0x34')];if(_0x21be00['query']['includeAll']){_0x56e974['include']=[{'all':!![]}];}_0x56e974=_[_0xce19('0x41')]({},_0x56e974,_0x21be00['options']);return db[_0xce19('0x32')][_0xce19('0x4c')](_0x56e974)[_0xce19('0x29')](handleEntityNotFound(_0xb8658b,null))[_0xce19('0x29')](respondWithResult(_0xb8658b,null))[_0xce19('0x48')](handleError(_0xb8658b,null));};exports['create']=function(_0x5a0fe6,_0x2b1a03){return db[_0xce19('0x32')][_0xce19('0x4d')](_0x5a0fe6[_0xce19('0x4e')],{})[_0xce19('0x29')](function(_0x330035){var _0x2f4c0b=_0x5a0fe6['user']['get']({'plain':!![]});if(!_0x2f4c0b)throw new Error(_0xce19('0x4f'));if(_0x2f4c0b[_0xce19('0x50')]===_0xce19('0x51')){var _0x3678d8=_0x330035[_0xce19('0x52')]({'plain':!![]});var _0x2f79fb=_0xce19('0x2a');return db[_0xce19('0x53')][_0xce19('0x4c')]({'where':{'name':_0x2f79fb,'userProfileId':_0x2f4c0b[_0xce19('0x54')]},'raw':!![]})[_0xce19('0x29')](function(_0x27f9aa){if(_0x27f9aa&&_0x27f9aa[_0xce19('0x55')]===0x0){return db['UserProfileResource'][_0xce19('0x4d')]({'name':_0x3678d8[_0xce19('0x2e')],'resourceId':_0x3678d8['id'],'type':_0x27f9aa[_0xce19('0x2e')],'sectionId':_0x27f9aa['id']},{})[_0xce19('0x29')](function(){return _0x330035;});}else{return _0x330035;}})[_0xce19('0x48')](function(_0xb0c708){logger[_0xce19('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb0c708);throw _0xb0c708;});}return _0x330035;})[_0xce19('0x29')](respondWithResult(_0x2b1a03,0xc9))['catch'](handleError(_0x2b1a03,null));};exports['update']=function(_0x40823d,_0x559094){if(_0x40823d['body']['id']){delete _0x40823d['body']['id'];}return db[_0xce19('0x32')][_0xce19('0x4c')]({'where':{'id':_0x40823d[_0xce19('0x49')]['id']}})[_0xce19('0x29')](handleEntityNotFound(_0x559094,null))[_0xce19('0x29')](saveUpdates(_0x40823d[_0xce19('0x4e')],null))[_0xce19('0x29')](respondWithResult(_0x559094,null))['catch'](handleError(_0x559094,null));};exports[_0xce19('0x28')]=function(_0x2196b0,_0xdf7a1c){return db['WhatsappQueue']['find']({'where':{'id':_0x2196b0[_0xce19('0x49')]['id']}})['then'](handleEntityNotFound(_0xdf7a1c,null))['then'](removeEntity(_0xdf7a1c,null))[_0xce19('0x48')](handleError(_0xdf7a1c,null));};exports['describe']=function(_0x317ad8,_0x2c39d7){return db['WhatsappQueue'][_0xce19('0x56')]()['then'](respondWithResult(_0x2c39d7,null))[_0xce19('0x48')](handleError(_0x2c39d7,null));};exports[_0xce19('0x57')]=function(_0x496425,_0xd6eca6,_0x1a1ff5){var _0x1c0f93={'raw':!![],'where':{}},_0x3a89f9={},_0x3a4ad3;return db[_0xce19('0x32')][_0xce19('0x58')]({'where':{'id':_0x496425[_0xce19('0x49')]['id']}})[_0xce19('0x29')](handleEntityNotFound(_0xd6eca6,null))[_0xce19('0x29')](function(_0xbcb938){if(_0xbcb938){_0x3a4ad3=_0xbcb938[_0xce19('0x52')]({'plain':!![]});_0x3a89f9['model']=_[_0xce19('0x36')](db[_0xce19('0x59')]['rawAttributes']);_0x3a89f9[_0xce19('0x35')]=_[_0xce19('0x36')](_0x496425[_0xce19('0x35')]);_0x3a89f9[_0xce19('0x37')]=_[_0xce19('0x38')](_0x3a89f9['model'],_0x3a89f9['query']);_0x1c0f93[_0xce19('0x39')]=_[_0xce19('0x38')](_0x3a89f9[_0xce19('0x34')],qs[_0xce19('0x3a')](_0x496425['query']['fields']));_0x1c0f93[_0xce19('0x39')]=_0x1c0f93['attributes'][_0xce19('0x4b')]?_0x1c0f93[_0xce19('0x39')]:_0x3a89f9[_0xce19('0x34')];if(!_0x496425[_0xce19('0x35')][_0xce19('0x3b')]('nolimit')){_0x1c0f93['limit']=qs[_0xce19('0x20')](_0x496425[_0xce19('0x35')][_0xce19('0x20')]);_0x1c0f93[_0xce19('0x3d')]=qs[_0xce19('0x3d')](_0x496425[_0xce19('0x35')][_0xce19('0x3d')]);}_0x1c0f93[_0xce19('0x5a')]=qs[_0xce19('0x3e')](_0x496425[_0xce19('0x35')]['sort']);_0x1c0f93['where']=qs['filters'](_[_0xce19('0x5b')](_0x496425['query'],_0x3a89f9[_0xce19('0x37')]));_0x1c0f93[_0xce19('0x3f')][_0xce19('0x5c')]=_0xbcb938['id'];if(_0x496425[_0xce19('0x35')][_0xce19('0x40')]){_0x1c0f93[_0xce19('0x3f')]=_[_0xce19('0x41')](_0x1c0f93[_0xce19('0x3f')],{'$or':_['map'](_0x1c0f93[_0xce19('0x39')],function(_0x4aa4b6){var _0x3c8a7a={};_0x3c8a7a[_0x4aa4b6]={'$like':'%'+_0x496425[_0xce19('0x35')]['filter']+'%'};return _0x3c8a7a;})});}_0x1c0f93=_['merge']({},_0x1c0f93,_0x496425['options']);return db[_0xce19('0x59')]['findAll'](_0x1c0f93);}})[_0xce19('0x29')](function(_0x431132){if(_0x431132){return db[_0xce19('0x5d')][_0xce19('0x5e')]({'where':{'id':_[_0xce19('0x31')](_0x431132,'UserId'),'role':'agent'},'attributes':['id',_0xce19('0x2e'),_0xce19('0x5f'),'updatedAt',_0xce19('0x60')]});}})[_0xce19('0x29')](function(_0x5d449c){if(_0x5d449c){return{'count':_0x5d449c['count'],'rows':_[_0xce19('0x31')](_0x5d449c[_0xce19('0x47')],function(_0x15bdef){return{'membername':_0x15bdef['name'],'UserId':_0x15bdef['id'],'queue_name':_0x3a4ad3['name'],'WhatsappQueueId':_0x3a4ad3['id'],'interface':util[_0xce19('0x61')](_0xce19('0x62'),'SIP',_0x15bdef[_0xce19('0x2e')]),'penalty':0x0,'paused':_0x15bdef[_0xce19('0x5f')],'createdAt':_0x15bdef[_0xce19('0x60')],'updatedAt':_0x15bdef[_0xce19('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xce19('0x29')](respondWithFilteredResult(_0xd6eca6,_0x1c0f93))[_0xce19('0x48')](handleError(_0xd6eca6,null));};exports['getTeams']=function(_0x1f773a,_0xe3322f,_0x359f1e){var _0x1e84c0={};var _0x42b96e={};var _0x2fcbe5;var _0x2be78a;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1f773a[_0xce19('0x49')]['id']}})[_0xce19('0x29')](handleEntityNotFound(_0xe3322f,null))['then'](function(_0x7dbd8){if(_0x7dbd8){_0x2fcbe5=_0x7dbd8;_0x42b96e['model']=_[_0xce19('0x36')](db['Team'][_0xce19('0x4a')]);_0x42b96e[_0xce19('0x35')]=_[_0xce19('0x36')](_0x1f773a[_0xce19('0x35')]);_0x42b96e[_0xce19('0x37')]=_[_0xce19('0x38')](_0x42b96e[_0xce19('0x34')],_0x42b96e['query']);_0x1e84c0[_0xce19('0x39')]=_['intersection'](_0x42b96e[_0xce19('0x34')],qs['fields'](_0x1f773a[_0xce19('0x35')][_0xce19('0x3a')]));_0x1e84c0['attributes']=_0x1e84c0[_0xce19('0x39')][_0xce19('0x4b')]?_0x1e84c0[_0xce19('0x39')]:_0x42b96e[_0xce19('0x34')];_0x1e84c0['order']=qs['sort'](_0x1f773a[_0xce19('0x35')][_0xce19('0x3e')]);_0x1e84c0[_0xce19('0x3f')]=qs[_0xce19('0x37')](_['pick'](_0x1f773a[_0xce19('0x35')],_0x42b96e[_0xce19('0x37')]));if(_0x1f773a[_0xce19('0x35')][_0xce19('0x40')]){_0x1e84c0[_0xce19('0x3f')]=_[_0xce19('0x41')](_0x1e84c0['where'],{'$or':_['map'](_0x1e84c0[_0xce19('0x39')],function(_0x3feead){var _0x4edd63={};_0x4edd63[_0x3feead]={'$like':'%'+_0x1f773a[_0xce19('0x35')][_0xce19('0x40')]+'%'};return _0x4edd63;})});}_0x1e84c0=_[_0xce19('0x41')]({},_0x1e84c0,_0x1f773a[_0xce19('0x64')]);return _0x2fcbe5['getTeams'](_0x1e84c0);}})[_0xce19('0x29')](function(_0x33e616){if(_0x33e616){_0x2be78a=_0x33e616[_0xce19('0x4b')];if(!_0x1f773a[_0xce19('0x35')][_0xce19('0x3b')](_0xce19('0x3c'))){_0x1e84c0[_0xce19('0x20')]=qs[_0xce19('0x20')](_0x1f773a[_0xce19('0x35')][_0xce19('0x20')]);_0x1e84c0[_0xce19('0x3d')]=qs[_0xce19('0x3d')](_0x1f773a['query'][_0xce19('0x3d')]);}return _0x2fcbe5['getTeams'](_0x1e84c0);}})['then'](function(_0x4de4a9){if(_0x4de4a9){return _0x4de4a9?{'count':_0x2be78a,'rows':_0x4de4a9}:null;}})[_0xce19('0x29')](respondWithResult(_0xe3322f,null))['catch'](handleError(_0xe3322f,null));};exports[_0xce19('0x65')]=function(_0x55d05b,_0x252b95,_0x55f5f8){var _0x3c0fbc=_0x55d05b[_0xce19('0x4e')]['ids'];return db['Team'][_0xce19('0x46')]({'where':{'id':_0x3c0fbc},'attributes':['id'],'include':[{'model':db[_0xce19('0x5d')],'as':_0xce19('0x66'),'attributes':['id',_0xce19('0x2e'),_0xce19('0x67'),'voicePause',_0xce19('0x68')],'raw':!![]}]})[_0xce19('0x29')](function(_0x474764){if(_0x474764){var _0x44be5c=_[_0xce19('0x69')](_0x474764,function(_0x2c44cf){var _0xa500b6=_0x2c44cf[_0xce19('0x52')]({'plain':!![]});return _0xa500b6[_0xce19('0x66')];});return db[_0xce19('0x32')][_0xce19('0x4c')]({'where':{'id':_0x55d05b[_0xce19('0x49')]['id']}})[_0xce19('0x29')](function(_0x10c79f){return db[_0xce19('0x6a')]['transaction'](function(_0x545c18){return _0x10c79f[_0xce19('0x65')](_0x3c0fbc,{'transaction':_0x545c18})[_0xce19('0x29')](function(){return BPromise[_0xce19('0x6b')](_0x44be5c,function(_0x2036c2){return db['UserWhatsappQueue'][_0xce19('0x6c')]({'where':{'UserId':_0x2036c2['id'],'WhatsappQueueId':_0x55d05b[_0xce19('0x49')]['id']},'transaction':_0x545c18});});})[_0xce19('0x29')](function(){_0x44be5c[_0xce19('0x6d')](function(_0x3b8ec5){socket[_0xce19('0x6e')]('userWhatsappQueue:save',{'UserId':_0x3b8ec5['id'],'WhatsappQueueId':_0x10c79f['id']});});});});});}})[_0xce19('0x29')](respondWithStatusCode(_0x252b95,null))['catch'](handleError(_0x252b95,null));};exports[_0xce19('0x6f')]=function(_0xf79808,_0x1297a0,_0x3a1b41){return db['Team'][_0xce19('0x46')]({'where':{'id':_0xf79808['query'][_0xce19('0x70')]},'attributes':['id'],'include':[{'model':db[_0xce19('0x5d')],'as':_0xce19('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1297a0,null))['then'](function(_0x5adabd){var _0x5ca552=_['map'](_0x5adabd,'id');var _0x3b2de7=[];var _0x262f4c=[];var _0x501c62=squel[_0xce19('0x71')]();_0x501c62[_0xce19('0x72')](_0xce19('0x73'))[_0xce19('0x74')](_0xce19('0x75'),'tq')['join'](_0xce19('0x76'),'ut',_0xce19('0x77'))['where'](_0xce19('0x78'),_0xf79808[_0xce19('0x49')]['id']);for(var _0x34e34c=0x0;_0x34e34c<_0x5adabd[_0xce19('0x4b')];_0x34e34c+=0x1){let _0x123fcf=_0x5adabd[_0x34e34c];for(var _0x26606b=0x0;_0x26606b<_0x123fcf[_0xce19('0x66')][_0xce19('0x4b')];_0x26606b+=0x1){let _0x2ef8ba=_0x123fcf[_0xce19('0x66')][_0x26606b];var _0x2527b5=_0x501c62[_0xce19('0x79')]();_0x2527b5[_0xce19('0x3f')]('ut.UserId\x20=\x20?',_0x2ef8ba['id']);_0x262f4c[_0xce19('0x7a')](db['sequelize']['query'](_0x2527b5[_0xce19('0x7b')](),{'type':db[_0xce19('0x6a')][_0xce19('0x7c')][_0xce19('0x7d')]})['then'](function(_0x4d64ca){if(_0x4d64ca[_0xce19('0x4b')]===0x1){return _0x2ef8ba['id'];}else{var _0x337056=_[_0xce19('0x7e')](_[_0xce19('0x31')](_0x4d64ca,_0xce19('0x7f')),function(_0x245aa4){return _[_0xce19('0x80')](_0x5ca552,_0x245aa4);});if(_0x337056){return _0x2ef8ba['id'];}}}));}}return BPromise[_0xce19('0x81')](_0x262f4c)[_0xce19('0x29')](function(_0x502193){_0x3b2de7=_(_0x3b2de7)[_0xce19('0x82')](_0x502193)[_0xce19('0x83')]()[_0xce19('0x84')]();return db[_0xce19('0x32')][_0xce19('0x4c')]({'where':{'id':_0xf79808[_0xce19('0x49')]['id']}})[_0xce19('0x29')](function(_0xb405e9){return db[_0xce19('0x6a')]['transaction'](function(_0x398a1d){return _0xb405e9[_0xce19('0x6f')](_0xf79808['query'][_0xce19('0x70')],{'transaction':_0x398a1d})[_0xce19('0x29')](function(){if(!_[_0xce19('0x85')](_0x3b2de7)){return _0xb405e9[_0xce19('0x86')](_0x3b2de7,{'transaction':_0x398a1d});}})[_0xce19('0x29')](function(){_0x3b2de7[_0xce19('0x6d')](function(_0x21eec1){socket[_0xce19('0x6e')]('userWhatsappQueue:remove',{'UserId':_0x21eec1,'WhatsappQueueId':_0xb405e9['id']});});});});});});})[_0xce19('0x29')](respondWithStatusCode(_0x1297a0,null))['catch'](handleError(_0x1297a0,null));};exports[_0xce19('0x87')]=function(_0x328a7e,_0x5a00fd,_0x266d9b){return db['WhatsappQueue'][_0xce19('0x4c')]({'where':{'id':_0x328a7e['params']['id']}})[_0xce19('0x29')](handleEntityNotFound(_0x5a00fd,null))[_0xce19('0x29')](function(_0x543d70){if(_0x543d70){return _0x543d70[_0xce19('0x87')](_0x328a7e[_0xce19('0x4e')][_0xce19('0x70')],_['omit'](_0x328a7e['body'],[_0xce19('0x70'),'id'])||{})[_0xce19('0x88')](function(_0x4937d9){for(var _0x3dfb0c=0x0;_0x3dfb0c<_0x328a7e['body'][_0xce19('0x70')][_0xce19('0x4b')];_0x3dfb0c+=0x1){socket[_0xce19('0x6e')](_0xce19('0x89'),{'UserId':_0x328a7e[_0xce19('0x4e')][_0xce19('0x70')][_0x3dfb0c],'WhatsappQueueId':_0x328a7e[_0xce19('0x49')]['id']});}return _0x4937d9;});}})[_0xce19('0x29')](respondWithResult(_0x5a00fd,null))[_0xce19('0x48')](handleError(_0x5a00fd,null));};exports[_0xce19('0x86')]=function(_0xbc1fbf,_0x1ffb96,_0xf19329){return db[_0xce19('0x32')][_0xce19('0x4c')]({'where':{'id':_0xbc1fbf[_0xce19('0x49')]['id']}})[_0xce19('0x29')](handleEntityNotFound(_0x1ffb96,null))['then'](function(_0xfd45ca){if(_0xfd45ca){return _0xfd45ca[_0xce19('0x86')](_0xbc1fbf[_0xce19('0x35')]['ids'])[_0xce19('0x29')](function(){if(_[_0xce19('0x8a')](_0xbc1fbf[_0xce19('0x35')][_0xce19('0x70')])){for(var _0x4f7d1e=0x0;_0x4f7d1e<_0xbc1fbf[_0xce19('0x35')][_0xce19('0x70')]['length'];_0x4f7d1e+=0x1){socket[_0xce19('0x6e')](_0xce19('0x8b'),{'UserId':Number(_0xbc1fbf[_0xce19('0x35')][_0xce19('0x70')][_0x4f7d1e]),'WhatsappQueueId':Number(_0xbc1fbf[_0xce19('0x49')]['id'])});}}else{socket[_0xce19('0x6e')]('userWhatsappQueue:remove',{'UserId':Number(_0xbc1fbf[_0xce19('0x35')][_0xce19('0x70')]),'WhatsappQueueId':Number(_0xbc1fbf[_0xce19('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ffb96,null))['catch'](handleError(_0x1ffb96,null));};exports['getAgents']=function(_0x21dda4,_0x5a96ba,_0x4c3cc0){var _0x1b69c5={};var _0x38f38c={};var _0x3133d5;var _0x397683;return db['WhatsappQueue']['findOne']({'where':{'id':_0x21dda4['params']['id']}})[_0xce19('0x29')](handleEntityNotFound(_0x5a96ba,null))[_0xce19('0x29')](function(_0x319f03){if(_0x319f03){_0x3133d5=_0x319f03;_0x38f38c[_0xce19('0x34')]=_[_0xce19('0x36')](db[_0xce19('0x5d')][_0xce19('0x4a')]);_0x38f38c[_0xce19('0x35')]=_[_0xce19('0x36')](_0x21dda4[_0xce19('0x35')]);_0x38f38c[_0xce19('0x37')]=_['intersection'](_0x38f38c[_0xce19('0x34')],_0x38f38c[_0xce19('0x35')]);_0x1b69c5['attributes']=_[_0xce19('0x38')](_0x38f38c[_0xce19('0x34')],qs[_0xce19('0x3a')](_0x21dda4[_0xce19('0x35')][_0xce19('0x3a')]));_0x1b69c5[_0xce19('0x39')]=_0x1b69c5[_0xce19('0x39')][_0xce19('0x4b')]?_0x1b69c5[_0xce19('0x39')]:_0x38f38c[_0xce19('0x34')];_0x1b69c5[_0xce19('0x5a')]=qs[_0xce19('0x3e')](_0x21dda4[_0xce19('0x35')][_0xce19('0x3e')]);_0x1b69c5[_0xce19('0x3f')]=qs[_0xce19('0x37')](_[_0xce19('0x5b')](_0x21dda4['query'],_0x38f38c[_0xce19('0x37')]));if(_0x21dda4[_0xce19('0x35')][_0xce19('0x40')]){_0x1b69c5[_0xce19('0x3f')]=_[_0xce19('0x41')](_0x1b69c5[_0xce19('0x3f')],{'$or':_['map'](_0x1b69c5[_0xce19('0x39')],function(_0x29fff7){var _0x2ab942={};_0x2ab942[_0x29fff7]={'$like':'%'+_0x21dda4[_0xce19('0x35')]['filter']+'%'};return _0x2ab942;})});}_0x1b69c5=_[_0xce19('0x41')]({},_0x1b69c5,_0x21dda4[_0xce19('0x64')]);return _0x3133d5[_0xce19('0x8c')](_0x1b69c5);}})['then'](function(_0x2561f8){if(_0x2561f8){_0x397683=_0x2561f8[_0xce19('0x4b')];if(!_0x21dda4['query'][_0xce19('0x3b')](_0xce19('0x3c'))){_0x1b69c5[_0xce19('0x20')]=qs[_0xce19('0x20')](_0x21dda4[_0xce19('0x35')][_0xce19('0x20')]);_0x1b69c5[_0xce19('0x3d')]=qs['offset'](_0x21dda4[_0xce19('0x35')][_0xce19('0x3d')]);}return _0x3133d5[_0xce19('0x8c')](_0x1b69c5);}})['then'](function(_0x23972a){if(_0x23972a){return _0x23972a?{'count':_0x397683,'rows':_0x23972a}:null;}})[_0xce19('0x29')](respondWithResult(_0x5a96ba,null))[_0xce19('0x48')](handleError(_0x5a96ba,null));}; \ No newline at end of file +var _0x8de5=['set','Content-Range','json','apply','reject','save','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','WhatsappQueue','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','User','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','every','TeamId','includes','all','union','removeAgents','forEach','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','./whatsappQueue.socket','sendStatus','status','end','count','offset','limit'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x8de5,0x179));var _0x58de=function(_0x4b08e5,_0x2d2fdc){_0x4b08e5=_0x4b08e5-0x0;var _0x399c3d=_0x8de5[_0x4b08e5];return _0x399c3d;};'use strict';var pdf=require(_0x58de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x58de('0x1'));var zipdir=require(_0x58de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x58de('0x3'));var moment=require(_0x58de('0x4'));var BPromise=require(_0x58de('0x5'));var Mustache=require(_0x58de('0x6'));var util=require(_0x58de('0x7'));var path=require(_0x58de('0x8'));var sox=require('sox');var csv=require(_0x58de('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x58de('0xa'));var squel=require(_0x58de('0xb'));var crypto=require(_0x58de('0xc'));var jsforce=require(_0x58de('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x58de('0xe'));var Papa=require(_0x58de('0xf'));var Redis=require('ioredis');var authService=require(_0x58de('0x10'));var qs=require(_0x58de('0x11'));var as=require(_0x58de('0x12'));var hardwareService=require(_0x58de('0x13'));var logger=require('../../config/logger')(_0x58de('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x58de('0x15'))['db'];config[_0x58de('0x16')]=_[_0x58de('0x17')](config[_0x58de('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58de('0x16')]));require(_0x58de('0x18'))['register'](socket);function respondWithStatusCode(_0x43a2c7,_0x5db5d8){_0x5db5d8=_0x5db5d8||0xcc;return function(_0x11d542){if(_0x11d542){return _0x43a2c7[_0x58de('0x19')](_0x5db5d8);}return _0x43a2c7[_0x58de('0x1a')](_0x5db5d8)[_0x58de('0x1b')]();};}function respondWithResult(_0x459974,_0x2fe0a3){_0x2fe0a3=_0x2fe0a3||0xc8;return function(_0xb3bc23){if(_0xb3bc23){return _0x459974['status'](_0x2fe0a3)['json'](_0xb3bc23);}};}function respondWithFilteredResult(_0x47315f,_0x481280){return function(_0x3378df){if(_0x3378df){var _0x3c35e5=_0x3378df[_0x58de('0x1c')],_0x27e3b1=_0x481280[_0x58de('0x1d')],_0x12eea2=_0x481280[_0x58de('0x1d')]+_0x481280[_0x58de('0x1e')],_0x11805b;if(_0x12eea2>=_0x3c35e5){_0x12eea2=_0x3c35e5;_0x11805b=0xc8;}else{_0x11805b=0xce;}_0x47315f[_0x58de('0x1a')](_0x11805b);return _0x47315f[_0x58de('0x1f')](_0x58de('0x20'),_0x27e3b1+'-'+_0x12eea2+'/'+_0x3c35e5)[_0x58de('0x21')](_0x3378df);}return null;};}function patchUpdates(_0x19a91e){return function(_0x9d33db){try{jsonpatch[_0x58de('0x22')](_0x9d33db,_0x19a91e,!![]);}catch(_0xb02d6f){return BPromise[_0x58de('0x23')](_0xb02d6f);}return _0x9d33db[_0x58de('0x24')]();};}function saveUpdates(_0x5bae6d,_0x2e0bda){return function(_0x2d13e2){if(_0x2d13e2){return _0x2d13e2['update'](_0x5bae6d)[_0x58de('0x25')](function(_0x5e8ae2){return _0x5e8ae2;});}return null;};}function removeEntity(_0x15649f,_0x3aea4c){return function(_0x452bf9){if(_0x452bf9){return _0x452bf9['destroy']()[_0x58de('0x25')](function(){var _0x5b1c6c=_0x452bf9[_0x58de('0x26')]({'plain':!![]});var _0x1fb417=_0x58de('0x27');return db[_0x58de('0x28')][_0x58de('0x29')]({'where':{'type':_0x1fb417,'resourceId':_0x5b1c6c['id']}})[_0x58de('0x25')](function(){return _0x452bf9;});})[_0x58de('0x25')](function(){_0x15649f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5964aa,_0x667c9){return function(_0x1fd0b4){if(!_0x1fd0b4){_0x5964aa[_0x58de('0x19')](0x194);}return _0x1fd0b4;};}function handleError(_0x31f5d0,_0x211dca){_0x211dca=_0x211dca||0x1f4;return function(_0x2051ed){logger[_0x58de('0x2a')](_0x2051ed[_0x58de('0x2b')]);if(_0x2051ed[_0x58de('0x2c')]){delete _0x2051ed[_0x58de('0x2c')];}_0x31f5d0['status'](_0x211dca)[_0x58de('0x2d')](_0x2051ed);};}exports[_0x58de('0x2e')]=function(_0x27bd1f,_0x2c47ef){var _0x1c66e0={},_0x1be09a={},_0x463ae1={'count':0x0,'rows':[]};var _0x2ad22d=_[_0x58de('0x2f')](db['WhatsappQueue'][_0x58de('0x30')],function(_0x17aa7d){return{'name':_0x17aa7d[_0x58de('0x31')],'type':_0x17aa7d[_0x58de('0x32')][_0x58de('0x33')]};});_0x1be09a[_0x58de('0x34')]=_[_0x58de('0x2f')](_0x2ad22d,'name');_0x1be09a[_0x58de('0x35')]=_['keys'](_0x27bd1f[_0x58de('0x35')]);_0x1be09a[_0x58de('0x36')]=_[_0x58de('0x37')](_0x1be09a[_0x58de('0x34')],_0x1be09a[_0x58de('0x35')]);_0x1c66e0[_0x58de('0x38')]=_[_0x58de('0x37')](_0x1be09a['model'],qs[_0x58de('0x39')](_0x27bd1f['query']['fields']));_0x1c66e0['attributes']=_0x1c66e0[_0x58de('0x38')][_0x58de('0x3a')]?_0x1c66e0[_0x58de('0x38')]:_0x1be09a[_0x58de('0x34')];if(!_0x27bd1f[_0x58de('0x35')][_0x58de('0x3b')](_0x58de('0x3c'))){_0x1c66e0['limit']=qs[_0x58de('0x1e')](_0x27bd1f[_0x58de('0x35')][_0x58de('0x1e')]);_0x1c66e0[_0x58de('0x1d')]=qs[_0x58de('0x1d')](_0x27bd1f[_0x58de('0x35')]['offset']);}_0x1c66e0[_0x58de('0x3d')]=qs[_0x58de('0x3e')](_0x27bd1f[_0x58de('0x35')]['sort']);_0x1c66e0[_0x58de('0x3f')]=qs['filters'](_[_0x58de('0x40')](_0x27bd1f[_0x58de('0x35')],_0x1be09a['filters']),_0x2ad22d);if(_0x27bd1f[_0x58de('0x35')][_0x58de('0x41')]){_0x1c66e0[_0x58de('0x3f')]=_['merge'](_0x1c66e0[_0x58de('0x3f')],{'$or':_[_0x58de('0x2f')](_0x2ad22d,function(_0x5c55ea){if(_0x5c55ea[_0x58de('0x32')]!==_0x58de('0x42')){var _0x61da81={};_0x61da81[_0x5c55ea[_0x58de('0x2c')]]={'$like':'%'+_0x27bd1f['query']['filter']+'%'};return _0x61da81;}})});}_0x1c66e0=_[_0x58de('0x43')]({},_0x1c66e0,_0x27bd1f['options']);var _0x431aa5={'where':_0x1c66e0[_0x58de('0x3f')]};return db['WhatsappQueue'][_0x58de('0x1c')](_0x431aa5)[_0x58de('0x25')](function(_0x183f84){_0x463ae1[_0x58de('0x1c')]=_0x183f84;if(_0x27bd1f[_0x58de('0x35')][_0x58de('0x44')]){_0x1c66e0[_0x58de('0x45')]=[{'all':!![]}];}return db[_0x58de('0x46')][_0x58de('0x47')](_0x1c66e0);})[_0x58de('0x25')](function(_0x38c303){_0x463ae1[_0x58de('0x48')]=_0x38c303;return _0x463ae1;})[_0x58de('0x25')](respondWithFilteredResult(_0x2c47ef,_0x1c66e0))[_0x58de('0x49')](handleError(_0x2c47ef,null));};exports[_0x58de('0x4a')]=function(_0x2cfa16,_0x3029ec){var _0x3af797={'raw':!![],'where':{'id':_0x2cfa16[_0x58de('0x4b')]['id']}},_0x313f9e={};_0x313f9e[_0x58de('0x34')]=_[_0x58de('0x4c')](db[_0x58de('0x46')][_0x58de('0x30')]);_0x313f9e[_0x58de('0x35')]=_[_0x58de('0x4c')](_0x2cfa16['query']);_0x313f9e[_0x58de('0x36')]=_['intersection'](_0x313f9e[_0x58de('0x34')],_0x313f9e[_0x58de('0x35')]);_0x3af797[_0x58de('0x38')]=_[_0x58de('0x37')](_0x313f9e[_0x58de('0x34')],qs[_0x58de('0x39')](_0x2cfa16['query'][_0x58de('0x39')]));_0x3af797[_0x58de('0x38')]=_0x3af797[_0x58de('0x38')][_0x58de('0x3a')]?_0x3af797[_0x58de('0x38')]:_0x313f9e['model'];if(_0x2cfa16[_0x58de('0x35')]['includeAll']){_0x3af797[_0x58de('0x45')]=[{'all':!![]}];}_0x3af797=_[_0x58de('0x43')]({},_0x3af797,_0x2cfa16[_0x58de('0x4d')]);return db[_0x58de('0x46')][_0x58de('0x4e')](_0x3af797)[_0x58de('0x25')](handleEntityNotFound(_0x3029ec,null))[_0x58de('0x25')](respondWithResult(_0x3029ec,null))[_0x58de('0x49')](handleError(_0x3029ec,null));};exports[_0x58de('0x4f')]=function(_0x42693c,_0x705267){return db[_0x58de('0x46')][_0x58de('0x4f')](_0x42693c[_0x58de('0x50')],{})[_0x58de('0x25')](function(_0x283ffb){var _0xc3dd56=_0x42693c[_0x58de('0x51')][_0x58de('0x26')]({'plain':!![]});if(!_0xc3dd56)throw new Error(_0x58de('0x52'));if(_0xc3dd56[_0x58de('0x53')]===_0x58de('0x51')){var _0x1075ff=_0x283ffb[_0x58de('0x26')]({'plain':!![]});var _0x16911c=_0x58de('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x16911c,'userProfileId':_0xc3dd56['userProfileId']},'raw':!![]})[_0x58de('0x25')](function(_0xe34cd7){if(_0xe34cd7&&_0xe34cd7[_0x58de('0x54')]===0x0){return db[_0x58de('0x28')][_0x58de('0x4f')]({'name':_0x1075ff['name'],'resourceId':_0x1075ff['id'],'type':_0xe34cd7[_0x58de('0x2c')],'sectionId':_0xe34cd7['id']},{})[_0x58de('0x25')](function(){return _0x283ffb;});}else{return _0x283ffb;}})[_0x58de('0x49')](function(_0x3b9ed5){logger[_0x58de('0x2a')](_0x58de('0x55'),_0x3b9ed5);throw _0x3b9ed5;});}return _0x283ffb;})['then'](respondWithResult(_0x705267,0xc9))[_0x58de('0x49')](handleError(_0x705267,null));};exports[_0x58de('0x56')]=function(_0x48a9f,_0x53df57){if(_0x48a9f['body']['id']){delete _0x48a9f['body']['id'];}return db[_0x58de('0x46')]['find']({'where':{'id':_0x48a9f[_0x58de('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53df57,null))[_0x58de('0x25')](saveUpdates(_0x48a9f[_0x58de('0x50')],null))[_0x58de('0x25')](respondWithResult(_0x53df57,null))[_0x58de('0x49')](handleError(_0x53df57,null));};exports[_0x58de('0x29')]=function(_0x19f3ad,_0x3a4c29){return db[_0x58de('0x46')][_0x58de('0x4e')]({'where':{'id':_0x19f3ad[_0x58de('0x4b')]['id']}})[_0x58de('0x25')](handleEntityNotFound(_0x3a4c29,null))[_0x58de('0x25')](removeEntity(_0x3a4c29,null))[_0x58de('0x49')](handleError(_0x3a4c29,null));};exports[_0x58de('0x57')]=function(_0x340065,_0x296f01){return db[_0x58de('0x46')][_0x58de('0x57')]()['then'](respondWithResult(_0x296f01,null))[_0x58de('0x49')](handleError(_0x296f01,null));};exports[_0x58de('0x58')]=function(_0x39faae,_0x4ea2bf,_0x1cec26){var _0x4c405c={'raw':!![],'where':{}},_0x55c1da={},_0x11a44f;return db['WhatsappQueue'][_0x58de('0x59')]({'where':{'id':_0x39faae[_0x58de('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ea2bf,null))['then'](function(_0x1fb1f6){if(_0x1fb1f6){_0x11a44f=_0x1fb1f6['get']({'plain':!![]});_0x55c1da['model']=_[_0x58de('0x4c')](db[_0x58de('0x5a')]['rawAttributes']);_0x55c1da[_0x58de('0x35')]=_[_0x58de('0x4c')](_0x39faae['query']);_0x55c1da[_0x58de('0x36')]=_[_0x58de('0x37')](_0x55c1da[_0x58de('0x34')],_0x55c1da[_0x58de('0x35')]);_0x4c405c[_0x58de('0x38')]=_[_0x58de('0x37')](_0x55c1da[_0x58de('0x34')],qs[_0x58de('0x39')](_0x39faae['query'][_0x58de('0x39')]));_0x4c405c['attributes']=_0x4c405c[_0x58de('0x38')][_0x58de('0x3a')]?_0x4c405c[_0x58de('0x38')]:_0x55c1da[_0x58de('0x34')];if(!_0x39faae[_0x58de('0x35')][_0x58de('0x3b')](_0x58de('0x3c'))){_0x4c405c['limit']=qs[_0x58de('0x1e')](_0x39faae[_0x58de('0x35')][_0x58de('0x1e')]);_0x4c405c[_0x58de('0x1d')]=qs[_0x58de('0x1d')](_0x39faae['query']['offset']);}_0x4c405c['order']=qs[_0x58de('0x3e')](_0x39faae[_0x58de('0x35')][_0x58de('0x3e')]);_0x4c405c[_0x58de('0x3f')]=qs['filters'](_[_0x58de('0x40')](_0x39faae[_0x58de('0x35')],_0x55c1da[_0x58de('0x36')]));_0x4c405c[_0x58de('0x3f')]['WhatsappQueueId']=_0x1fb1f6['id'];if(_0x39faae[_0x58de('0x35')][_0x58de('0x41')]){_0x4c405c[_0x58de('0x3f')]=_['merge'](_0x4c405c['where'],{'$or':_[_0x58de('0x2f')](_0x4c405c['attributes'],function(_0x750d2){var _0x3d9c4b={};_0x3d9c4b[_0x750d2]={'$like':'%'+_0x39faae[_0x58de('0x35')][_0x58de('0x41')]+'%'};return _0x3d9c4b;})});}_0x4c405c=_['merge']({},_0x4c405c,_0x39faae[_0x58de('0x4d')]);return db['UserWhatsappQueue'][_0x58de('0x47')](_0x4c405c);}})['then'](function(_0x1e9e88){if(_0x1e9e88){return db[_0x58de('0x5b')]['findAndCountAll']({'where':{'id':_[_0x58de('0x2f')](_0x1e9e88,'UserId'),'role':'agent'},'attributes':['id',_0x58de('0x2c'),_0x58de('0x5c'),'updatedAt',_0x58de('0x5d')]});}})[_0x58de('0x25')](function(_0x9afdf1){if(_0x9afdf1){return{'count':_0x9afdf1['count'],'rows':_[_0x58de('0x2f')](_0x9afdf1['rows'],function(_0x1e7fee){return{'membername':_0x1e7fee[_0x58de('0x2c')],'UserId':_0x1e7fee['id'],'queue_name':_0x11a44f[_0x58de('0x2c')],'WhatsappQueueId':_0x11a44f['id'],'interface':util[_0x58de('0x5e')](_0x58de('0x5f'),_0x58de('0x60'),_0x1e7fee[_0x58de('0x2c')]),'penalty':0x0,'paused':_0x1e7fee[_0x58de('0x5c')],'createdAt':_0x1e7fee[_0x58de('0x5d')],'updatedAt':_0x1e7fee[_0x58de('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x58de('0x25')](respondWithFilteredResult(_0x4ea2bf,_0x4c405c))['catch'](handleError(_0x4ea2bf,null));};exports[_0x58de('0x62')]=function(_0x117fb9,_0x38746b,_0x4d3ce2){var _0x4504cf={};var _0x3d3bd6={};var _0x26f086;var _0xa67336;return db['WhatsappQueue'][_0x58de('0x59')]({'where':{'id':_0x117fb9[_0x58de('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38746b,null))['then'](function(_0x2b1a3b){if(_0x2b1a3b){_0x26f086=_0x2b1a3b;_0x3d3bd6[_0x58de('0x34')]=_[_0x58de('0x4c')](db[_0x58de('0x63')][_0x58de('0x30')]);_0x3d3bd6[_0x58de('0x35')]=_[_0x58de('0x4c')](_0x117fb9['query']);_0x3d3bd6['filters']=_['intersection'](_0x3d3bd6[_0x58de('0x34')],_0x3d3bd6[_0x58de('0x35')]);_0x4504cf['attributes']=_[_0x58de('0x37')](_0x3d3bd6[_0x58de('0x34')],qs[_0x58de('0x39')](_0x117fb9[_0x58de('0x35')][_0x58de('0x39')]));_0x4504cf['attributes']=_0x4504cf[_0x58de('0x38')][_0x58de('0x3a')]?_0x4504cf['attributes']:_0x3d3bd6[_0x58de('0x34')];_0x4504cf[_0x58de('0x3d')]=qs['sort'](_0x117fb9[_0x58de('0x35')][_0x58de('0x3e')]);_0x4504cf[_0x58de('0x3f')]=qs[_0x58de('0x36')](_[_0x58de('0x40')](_0x117fb9['query'],_0x3d3bd6[_0x58de('0x36')]));if(_0x117fb9['query'][_0x58de('0x41')]){_0x4504cf[_0x58de('0x3f')]=_[_0x58de('0x43')](_0x4504cf[_0x58de('0x3f')],{'$or':_[_0x58de('0x2f')](_0x4504cf['attributes'],function(_0x4412ff){var _0x3df38b={};_0x3df38b[_0x4412ff]={'$like':'%'+_0x117fb9['query'][_0x58de('0x41')]+'%'};return _0x3df38b;})});}_0x4504cf=_[_0x58de('0x43')]({},_0x4504cf,_0x117fb9[_0x58de('0x4d')]);return _0x26f086[_0x58de('0x62')](_0x4504cf);}})[_0x58de('0x25')](function(_0x546a10){if(_0x546a10){_0xa67336=_0x546a10[_0x58de('0x3a')];if(!_0x117fb9[_0x58de('0x35')]['hasOwnProperty'](_0x58de('0x3c'))){_0x4504cf['limit']=qs[_0x58de('0x1e')](_0x117fb9[_0x58de('0x35')]['limit']);_0x4504cf[_0x58de('0x1d')]=qs[_0x58de('0x1d')](_0x117fb9[_0x58de('0x35')][_0x58de('0x1d')]);}return _0x26f086['getTeams'](_0x4504cf);}})[_0x58de('0x25')](function(_0x39ca04){if(_0x39ca04){return _0x39ca04?{'count':_0xa67336,'rows':_0x39ca04}:null;}})['then'](respondWithResult(_0x38746b,null))[_0x58de('0x49')](handleError(_0x38746b,null));};exports[_0x58de('0x64')]=function(_0x10ec33,_0x53e293,_0x4a5e51){var _0x41e356=_0x10ec33[_0x58de('0x50')][_0x58de('0x65')];return db[_0x58de('0x63')][_0x58de('0x47')]({'where':{'id':_0x41e356},'attributes':['id'],'include':[{'model':db[_0x58de('0x5b')],'as':_0x58de('0x66'),'attributes':['id','name','online',_0x58de('0x67'),_0x58de('0x68')],'raw':!![]}]})['then'](function(_0x5a34a2){if(_0x5a34a2){var _0x235299=_[_0x58de('0x69')](_0x5a34a2,function(_0x29bfc9){var _0x1dd581=_0x29bfc9['get']({'plain':!![]});return _0x1dd581['Agents'];});return db[_0x58de('0x46')][_0x58de('0x4e')]({'where':{'id':_0x10ec33[_0x58de('0x4b')]['id']}})[_0x58de('0x25')](function(_0x188b37){return db[_0x58de('0x6a')][_0x58de('0x6b')](function(_0x479cc8){return _0x188b37[_0x58de('0x64')](_0x41e356,{'transaction':_0x479cc8})[_0x58de('0x25')](function(){return BPromise[_0x58de('0x6c')](_0x235299,function(_0x527290){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x527290['id'],'WhatsappQueueId':_0x10ec33[_0x58de('0x4b')]['id']},'transaction':_0x479cc8});});})[_0x58de('0x25')](function(){_0x235299['forEach'](function(_0x354d38){socket[_0x58de('0x6d')](_0x58de('0x6e'),{'UserId':_0x354d38['id'],'WhatsappQueueId':_0x188b37['id']});});});});});}})['then'](respondWithStatusCode(_0x53e293,null))['catch'](handleError(_0x53e293,null));};exports[_0x58de('0x6f')]=function(_0x38dd9b,_0x5a2316,_0x5bee81){return db[_0x58de('0x63')][_0x58de('0x47')]({'where':{'id':_0x38dd9b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x58de('0x5b')],'as':_0x58de('0x66'),'attributes':['id'],'raw':!![]}]})[_0x58de('0x25')](handleEntityNotFound(_0x5a2316,null))[_0x58de('0x25')](function(_0x2d24eb){var _0x596055=_[_0x58de('0x2f')](_0x2d24eb,'id');var _0x34a952=[];var _0x2cb02b=[];var _0x424ee8=squel[_0x58de('0x70')]();_0x424ee8[_0x58de('0x71')](_0x58de('0x72'))[_0x58de('0x73')](_0x58de('0x74'),'tq')[_0x58de('0x75')](_0x58de('0x76'),'ut',_0x58de('0x77'))['where']('WhatsappQueueId\x20=\x20?',_0x38dd9b['params']['id']);for(var _0x4d6ca8=0x0;_0x4d6ca8<_0x2d24eb[_0x58de('0x3a')];_0x4d6ca8+=0x1){let _0x22ba74=_0x2d24eb[_0x4d6ca8];for(var _0x570e72=0x0;_0x570e72<_0x22ba74['Agents'][_0x58de('0x3a')];_0x570e72+=0x1){let _0x14216f=_0x22ba74[_0x58de('0x66')][_0x570e72];var _0x4d2a62=_0x424ee8[_0x58de('0x78')]();_0x4d2a62['where']('ut.UserId\x20=\x20?',_0x14216f['id']);_0x2cb02b[_0x58de('0x79')](db['sequelize'][_0x58de('0x35')](_0x4d2a62['toString'](),{'type':db[_0x58de('0x6a')][_0x58de('0x7a')][_0x58de('0x7b')]})[_0x58de('0x25')](function(_0x21c78e){if(_0x21c78e[_0x58de('0x3a')]===0x1){return _0x14216f['id'];}else{var _0x544c22=_[_0x58de('0x7c')](_['map'](_0x21c78e,_0x58de('0x7d')),function(_0x296d70){return _[_0x58de('0x7e')](_0x596055,_0x296d70);});if(_0x544c22){return _0x14216f['id'];}}}));}}return BPromise[_0x58de('0x7f')](_0x2cb02b)[_0x58de('0x25')](function(_0x5d4ef5){_0x34a952=_(_0x34a952)[_0x58de('0x80')](_0x5d4ef5)['compact']()['value']();return db[_0x58de('0x46')][_0x58de('0x4e')]({'where':{'id':_0x38dd9b['params']['id']}})[_0x58de('0x25')](function(_0x43b3c6){return db['sequelize'][_0x58de('0x6b')](function(_0x251d89){return _0x43b3c6[_0x58de('0x6f')](_0x38dd9b[_0x58de('0x35')]['ids'],{'transaction':_0x251d89})[_0x58de('0x25')](function(){if(!_['isEmpty'](_0x34a952)){return _0x43b3c6[_0x58de('0x81')](_0x34a952,{'transaction':_0x251d89});}})[_0x58de('0x25')](function(){_0x34a952[_0x58de('0x82')](function(_0x6f5f02){socket[_0x58de('0x6d')](_0x58de('0x83'),{'UserId':_0x6f5f02,'WhatsappQueueId':_0x43b3c6['id']});});});});});});})['then'](respondWithStatusCode(_0x5a2316,null))['catch'](handleError(_0x5a2316,null));};exports[_0x58de('0x84')]=function(_0x2b9a04,_0x2f8a4c,_0x1abe69){return db[_0x58de('0x46')][_0x58de('0x4e')]({'where':{'id':_0x2b9a04[_0x58de('0x4b')]['id']}})[_0x58de('0x25')](handleEntityNotFound(_0x2f8a4c,null))['then'](function(_0x48c248){if(_0x48c248){return _0x48c248[_0x58de('0x84')](_0x2b9a04[_0x58de('0x50')][_0x58de('0x65')],_['omit'](_0x2b9a04['body'],[_0x58de('0x65'),'id'])||{})[_0x58de('0x85')](function(_0x1a23b9){for(var _0xce1221=0x0;_0xce1221<_0x2b9a04[_0x58de('0x50')][_0x58de('0x65')]['length'];_0xce1221+=0x1){socket[_0x58de('0x6d')](_0x58de('0x6e'),{'UserId':_0x2b9a04[_0x58de('0x50')][_0x58de('0x65')][_0xce1221],'WhatsappQueueId':_0x2b9a04[_0x58de('0x4b')]['id']});}return _0x1a23b9;});}})['then'](respondWithResult(_0x2f8a4c,null))[_0x58de('0x49')](handleError(_0x2f8a4c,null));};exports[_0x58de('0x81')]=function(_0x296949,_0x1722da,_0x3abc4a){return db['WhatsappQueue']['find']({'where':{'id':_0x296949[_0x58de('0x4b')]['id']}})[_0x58de('0x25')](handleEntityNotFound(_0x1722da,null))[_0x58de('0x25')](function(_0x45648b){if(_0x45648b){return _0x45648b[_0x58de('0x81')](_0x296949['query'][_0x58de('0x65')])[_0x58de('0x25')](function(){if(_[_0x58de('0x86')](_0x296949['query'][_0x58de('0x65')])){for(var _0x199946=0x0;_0x199946<_0x296949[_0x58de('0x35')][_0x58de('0x65')][_0x58de('0x3a')];_0x199946+=0x1){socket['emit'](_0x58de('0x83'),{'UserId':Number(_0x296949[_0x58de('0x35')][_0x58de('0x65')][_0x199946]),'WhatsappQueueId':Number(_0x296949[_0x58de('0x4b')]['id'])});}}else{socket[_0x58de('0x6d')](_0x58de('0x83'),{'UserId':Number(_0x296949[_0x58de('0x35')][_0x58de('0x65')]),'WhatsappQueueId':Number(_0x296949[_0x58de('0x4b')]['id'])});}});}})[_0x58de('0x25')](respondWithStatusCode(_0x1722da,null))[_0x58de('0x49')](handleError(_0x1722da,null));};exports[_0x58de('0x87')]=function(_0x1b9619,_0x3f532a,_0x325f49){var _0x2a89e4={};var _0x37320e={};var _0x1f5754;var _0x1bc7e7;return db[_0x58de('0x46')][_0x58de('0x59')]({'where':{'id':_0x1b9619[_0x58de('0x4b')]['id']}})[_0x58de('0x25')](handleEntityNotFound(_0x3f532a,null))['then'](function(_0x3dd17a){if(_0x3dd17a){_0x1f5754=_0x3dd17a;_0x37320e[_0x58de('0x34')]=_[_0x58de('0x4c')](db[_0x58de('0x5b')][_0x58de('0x30')]);_0x37320e[_0x58de('0x35')]=_[_0x58de('0x4c')](_0x1b9619['query']);_0x37320e[_0x58de('0x36')]=_[_0x58de('0x37')](_0x37320e[_0x58de('0x34')],_0x37320e[_0x58de('0x35')]);_0x2a89e4[_0x58de('0x38')]=_['intersection'](_0x37320e[_0x58de('0x34')],qs[_0x58de('0x39')](_0x1b9619[_0x58de('0x35')][_0x58de('0x39')]));_0x2a89e4[_0x58de('0x38')]=_0x2a89e4[_0x58de('0x38')][_0x58de('0x3a')]?_0x2a89e4[_0x58de('0x38')]:_0x37320e[_0x58de('0x34')];_0x2a89e4[_0x58de('0x3d')]=qs[_0x58de('0x3e')](_0x1b9619[_0x58de('0x35')][_0x58de('0x3e')]);_0x2a89e4[_0x58de('0x3f')]=qs[_0x58de('0x36')](_['pick'](_0x1b9619[_0x58de('0x35')],_0x37320e[_0x58de('0x36')]));if(_0x1b9619[_0x58de('0x35')][_0x58de('0x41')]){_0x2a89e4['where']=_['merge'](_0x2a89e4['where'],{'$or':_['map'](_0x2a89e4[_0x58de('0x38')],function(_0x566e09){var _0x57d34e={};_0x57d34e[_0x566e09]={'$like':'%'+_0x1b9619[_0x58de('0x35')][_0x58de('0x41')]+'%'};return _0x57d34e;})});}_0x2a89e4=_[_0x58de('0x43')]({},_0x2a89e4,_0x1b9619[_0x58de('0x4d')]);return _0x1f5754['getAgents'](_0x2a89e4);}})[_0x58de('0x25')](function(_0x35e801){if(_0x35e801){_0x1bc7e7=_0x35e801['length'];if(!_0x1b9619['query'][_0x58de('0x3b')](_0x58de('0x3c'))){_0x2a89e4[_0x58de('0x1e')]=qs[_0x58de('0x1e')](_0x1b9619['query'][_0x58de('0x1e')]);_0x2a89e4[_0x58de('0x1d')]=qs['offset'](_0x1b9619['query'][_0x58de('0x1d')]);}return _0x1f5754['getAgents'](_0x2a89e4);}})[_0x58de('0x25')](function(_0x5bc3e9){if(_0x5bc3e9){return _0x5bc3e9?{'count':_0x1bc7e7,'rows':_0x5bc3e9}:null;}})[_0x58de('0x25')](respondWithResult(_0x3f532a,null))[_0x58de('0x49')](handleError(_0x3f532a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 7d7fa70..d8e72a7 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 _0xb4d9=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3b1e62,_0x34292f){var _0x122b3a=function(_0x22505f){while(--_0x22505f){_0x3b1e62['push'](_0x3b1e62['shift']());}};_0x122b3a(++_0x34292f);}(_0xb4d9,0xc8));var _0x9b4d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb4d9[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x9b4d('0x0'));var WhatsappQueue=require(_0x9b4d('0x1'))['db'][_0x9b4d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9b4d('0x3')](0x0);var events={'afterCreate':_0x9b4d('0x4'),'afterUpdate':_0x9b4d('0x5'),'afterDestroy':_0x9b4d('0x6')};function emitEvent(_0x16921b){return function(_0x4d4131,_0x4f85dd,_0x41721c){WhatsappQueueEvents[_0x9b4d('0x7')](_0x16921b+':'+_0x4d4131['id'],_0x4d4131);WhatsappQueueEvents['emit'](_0x16921b,_0x4d4131);_0x41721c(null);};}for(var e in events){if(events[_0x9b4d('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x9b4d('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xbe1e=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','WhatsappQueue'];(function(_0x552fb8,_0x4ed24b){var _0x2a741a=function(_0x15b7a1){while(--_0x15b7a1){_0x552fb8['push'](_0x552fb8['shift']());}};_0x2a741a(++_0x4ed24b);}(_0xbe1e,0xb6));var _0xebe1=function(_0x5c85c8,_0x16110b){_0x5c85c8=_0x5c85c8-0x0;var _0x42d66f=_0xbe1e[_0x5c85c8];return _0x42d66f;};'use strict';var EventEmitter=require(_0xebe1('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xebe1('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xebe1('0x2')](0x0);var events={'afterCreate':_0xebe1('0x3'),'afterUpdate':_0xebe1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x200676){return function(_0x569d49,_0x3a8a4,_0x3da14b){WhatsappQueueEvents[_0xebe1('0x5')](_0x200676+':'+_0x569d49['id'],_0x569d49);WhatsappQueueEvents['emit'](_0x200676,_0x569d49);_0x3da14b(null);};}for(var e in events){if(events[_0xebe1('0x6')](e)){var event=events[e];WhatsappQueue[_0xebe1('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 d854580..d6269be 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 _0x76d6=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util'];(function(_0x41d40f,_0x2b9ac4){var _0x3438ad=function(_0x1195b8){while(--_0x1195b8){_0x41d40f['push'](_0x41d40f['shift']());}};_0x3438ad(++_0x2b9ac4);}(_0x76d6,0x13e));var _0x676d=function(_0x21d700,_0x495e40){_0x21d700=_0x21d700-0x0;var _0x4aa8c2=_0x76d6[_0x21d700];return _0x4aa8c2;};'use strict';var _=require('lodash');var util=require(_0x676d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x676d('0x1'));var BPromise=require(_0x676d('0x2'));var rp=require(_0x676d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x676d('0x4'));var config=require(_0x676d('0x5'));var attributes=require(_0x676d('0x6'));module[_0x676d('0x7')]=function(_0x4b85a9,_0x269697){return _0x4b85a9[_0x676d('0x8')](_0x676d('0x9'),attributes,{'tableName':_0x676d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5bb=['WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x3e829f,_0x5d9381){var _0x41313e=function(_0x16fb4b){while(--_0x16fb4b){_0x3e829f['push'](_0x3e829f['shift']());}};_0x41313e(++_0x5d9381);}(_0xb5bb,0x1d0));var _0xbb5b=function(_0x2b3489,_0x484936){_0x2b3489=_0x2b3489-0x0;var _0x16d9eb=_0xb5bb[_0x2b3489];return _0x16d9eb;};'use strict';var _=require(_0xbb5b('0x0'));var util=require('util');var logger=require(_0xbb5b('0x1'))(_0xbb5b('0x2'));var moment=require(_0xbb5b('0x3'));var BPromise=require(_0xbb5b('0x4'));var rp=require(_0xbb5b('0x5'));var fs=require('fs');var path=require(_0xbb5b('0x6'));var rimraf=require(_0xbb5b('0x7'));var config=require(_0xbb5b('0x8'));var attributes=require(_0xbb5b('0x9'));module[_0xbb5b('0xa')]=function(_0x4a65b8,_0xa402e6){return _0x4a65b8[_0xbb5b('0xb')](_0xbb5b('0xc'),attributes,{'tableName':_0xbb5b('0xd'),'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 c372118..fb0f3a4 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 _0xc24d=['map','model','GetWhatsappQueue','ShowWhatsappQueue','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','WhatsappQueue','options','raw','attributes','include'];(function(_0x4a9c73,_0x5dd532){var _0x21568f=function(_0x335c16){while(--_0x335c16){_0x4a9c73['push'](_0x4a9c73['shift']());}};_0x21568f(++_0x5dd532);}(_0xc24d,0x1c2));var _0xdc24=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xc24d[_0x648163];return _0x199d4d;};'use strict';var _=require(_0xdc24('0x0'));var util=require(_0xdc24('0x1'));var moment=require(_0xdc24('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc24('0x3'));var fs=require('fs');var Redis=require(_0xdc24('0x4'));var db=require(_0xdc24('0x5'))['db'];var utils=require(_0xdc24('0x6'));var logger=require(_0xdc24('0x7'))(_0xdc24('0x8'));var config=require('../../config/environment');var jayson=require(_0xdc24('0x9'));var client=jayson[_0xdc24('0xa')][_0xdc24('0xb')]({'port':0x232a});config[_0xdc24('0xc')]=_[_0xdc24('0xd')](config['redis'],{'host':_0xdc24('0xe'),'port':0x18eb});var socket=require(_0xdc24('0xf'))(new Redis(config[_0xdc24('0xc')]));require(_0xdc24('0x10'))['register'](socket);function respondWithRpcPromise(_0x317ee7,_0x327e58,_0x5bde53){return new BPromise(function(_0x580936,_0x2c35e7){return client[_0xdc24('0x11')](_0x317ee7,_0x5bde53)[_0xdc24('0x12')](function(_0x2dd285){logger['info'](_0xdc24('0x13'),_0x327e58,_0xdc24('0x14'));logger[_0xdc24('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x327e58,'request\x20sent',JSON[_0xdc24('0x16')](_0x2dd285));if(_0x2dd285['error']){if(_0x2dd285[_0xdc24('0x17')]['code']===0x1f4){logger[_0xdc24('0x17')](_0xdc24('0x13'),_0x327e58,_0x2dd285[_0xdc24('0x17')][_0xdc24('0x18')]);return _0x2c35e7(_0x2dd285[_0xdc24('0x17')][_0xdc24('0x18')]);}logger[_0xdc24('0x17')](_0xdc24('0x13'),_0x327e58,_0x2dd285[_0xdc24('0x17')]['message']);return _0x580936(_0x2dd285[_0xdc24('0x17')][_0xdc24('0x18')]);}else{logger['info'](_0xdc24('0x13'),_0x327e58,_0xdc24('0x14'));_0x580936(_0x2dd285['result'][_0xdc24('0x18')]);}})[_0xdc24('0x19')](function(_0x6ec602){logger[_0xdc24('0x17')](_0xdc24('0x13'),_0x327e58,_0x6ec602);_0x2c35e7(_0x6ec602);});});}exports['GetWhatsappQueue']=function(_0x284b43){var _0x461ee5=this;return new Promise(function(_0x1d8ce8,_0x314197){return db[_0xdc24('0x1a')]['findAll']({'raw':_0x284b43[_0xdc24('0x1b')]?_0x284b43['options'][_0xdc24('0x1c')]===undefined?!![]:![]:!![],'where':_0x284b43['options']?_0x284b43[_0xdc24('0x1b')]['where']||null:null,'attributes':_0x284b43[_0xdc24('0x1b')]?_0x284b43[_0xdc24('0x1b')][_0xdc24('0x1d')]||null:null,'limit':_0x284b43[_0xdc24('0x1b')]?_0x284b43[_0xdc24('0x1b')]['limit']||null:null,'include':_0x284b43[_0xdc24('0x1b')]?_0x284b43[_0xdc24('0x1b')][_0xdc24('0x1e')]?_[_0xdc24('0x1f')](_0x284b43['options'][_0xdc24('0x1e')],function(_0x1c0cdc){return{'model':db[_0x1c0cdc[_0xdc24('0x20')]],'as':_0x1c0cdc['as'],'attributes':_0x1c0cdc['attributes'],'include':_0x1c0cdc['include']?_[_0xdc24('0x1f')](_0x1c0cdc['include'],function(_0x3f12de){return{'model':db[_0x3f12de['model']],'as':_0x3f12de['as'],'attributes':_0x3f12de['attributes'],'include':_0x3f12de[_0xdc24('0x1e')]?_[_0xdc24('0x1f')](_0x3f12de[_0xdc24('0x1e')],function(_0x1a1e8e){return{'model':db[_0x1a1e8e[_0xdc24('0x20')]],'as':_0x1a1e8e['as'],'attributes':_0x1a1e8e[_0xdc24('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc24('0x12')](function(_0xc895e){logger['info'](_0xdc24('0x21'),_0x284b43);logger['debug']('GetWhatsappQueue',_0x284b43,JSON['stringify'](_0xc895e));_0x1d8ce8(_0xc895e);})[_0xdc24('0x19')](function(_0x19ad9a){logger[_0xdc24('0x17')](_0xdc24('0x21'),_0x19ad9a[_0xdc24('0x18')],_0x284b43);_0x314197(_0x461ee5['error'](0x1f4,_0x19ad9a['message']));});});};exports[_0xdc24('0x22')]=function(_0x37249){var _0x57cf79=this;return new Promise(function(_0x79f2be,_0x55c48a){return db[_0xdc24('0x1a')][_0xdc24('0x23')]({'raw':_0x37249[_0xdc24('0x1b')]?_0x37249[_0xdc24('0x1b')][_0xdc24('0x1c')]===undefined?!![]:![]:!![],'where':_0x37249['options']?_0x37249['options'][_0xdc24('0x24')]||null:null,'attributes':_0x37249[_0xdc24('0x1b')]?_0x37249[_0xdc24('0x1b')][_0xdc24('0x1d')]||null:null,'include':_0x37249[_0xdc24('0x1b')]?_0x37249[_0xdc24('0x1b')][_0xdc24('0x1e')]?_['map'](_0x37249['options']['include'],function(_0x487590){return{'model':db[_0x487590[_0xdc24('0x20')]],'as':_0x487590['as'],'attributes':_0x487590[_0xdc24('0x1d')],'include':_0x487590['include']?_[_0xdc24('0x1f')](_0x487590[_0xdc24('0x1e')],function(_0x589690){return{'model':db[_0x589690[_0xdc24('0x20')]],'as':_0x589690['as'],'attributes':_0x589690['attributes'],'include':_0x589690[_0xdc24('0x1e')]?_[_0xdc24('0x1f')](_0x589690[_0xdc24('0x1e')],function(_0x1fbe84){return{'model':db[_0x1fbe84[_0xdc24('0x20')]],'as':_0x1fbe84['as'],'attributes':_0x1fbe84[_0xdc24('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc24('0x12')](function(_0x8d5ef1){logger['info'](_0xdc24('0x22'),_0x37249);logger[_0xdc24('0x15')](_0xdc24('0x22'),_0x37249,JSON[_0xdc24('0x16')](_0x8d5ef1));_0x79f2be(_0x8d5ef1);})[_0xdc24('0x19')](function(_0x19f428){logger[_0xdc24('0x17')](_0xdc24('0x22'),_0x19f428[_0xdc24('0x18')],_0x37249);_0x55c48a(_0x57cf79[_0xdc24('0x17')](0x1f4,_0x19f428[_0xdc24('0x18')]));});});}; \ No newline at end of file +var _0xbadf=['localhost','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowWhatsappQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xbadf,0x152));var _0xfbad=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0xbadf[_0x2ef8c1];return _0x288305;};'use strict';var _=require(_0xfbad('0x0'));var util=require(_0xfbad('0x1'));var moment=require(_0xfbad('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbad('0x3'));var fs=require('fs');var Redis=require(_0xfbad('0x4'));var db=require(_0xfbad('0x5'))['db'];var utils=require(_0xfbad('0x6'));var logger=require(_0xfbad('0x7'))(_0xfbad('0x8'));var config=require('../../config/environment');var jayson=require(_0xfbad('0x9'));var client=jayson[_0xfbad('0xa')]['http']({'port':0x232a});config[_0xfbad('0xb')]=_[_0xfbad('0xc')](config[_0xfbad('0xb')],{'host':_0xfbad('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbad('0xb')]));require(_0xfbad('0xe'))[_0xfbad('0xf')](socket);function respondWithRpcPromise(_0x5d34f0,_0x4cf894,_0x2f9664){return new BPromise(function(_0x53cbdd,_0x2d64b2){return client['request'](_0x5d34f0,_0x2f9664)[_0xfbad('0x10')](function(_0x85b0fd){logger[_0xfbad('0x11')](_0xfbad('0x12'),_0x4cf894,'request\x20sent');logger[_0xfbad('0x13')](_0xfbad('0x14'),_0x4cf894,_0xfbad('0x15'),JSON['stringify'](_0x85b0fd));if(_0x85b0fd['error']){if(_0x85b0fd[_0xfbad('0x16')][_0xfbad('0x17')]===0x1f4){logger[_0xfbad('0x16')](_0xfbad('0x12'),_0x4cf894,_0x85b0fd[_0xfbad('0x16')][_0xfbad('0x18')]);return _0x2d64b2(_0x85b0fd[_0xfbad('0x16')]['message']);}logger[_0xfbad('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x4cf894,_0x85b0fd[_0xfbad('0x16')][_0xfbad('0x18')]);return _0x53cbdd(_0x85b0fd['error'][_0xfbad('0x18')]);}else{logger[_0xfbad('0x11')](_0xfbad('0x12'),_0x4cf894,_0xfbad('0x15'));_0x53cbdd(_0x85b0fd['result'][_0xfbad('0x18')]);}})[_0xfbad('0x19')](function(_0x2cf9f6){logger[_0xfbad('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x4cf894,_0x2cf9f6);_0x2d64b2(_0x2cf9f6);});});}exports[_0xfbad('0x1a')]=function(_0x492dd6){var _0x501b3c=this;return new Promise(function(_0x2f2da5,_0x5f303f){return db[_0xfbad('0x1b')]['findAll']({'raw':_0x492dd6['options']?_0x492dd6[_0xfbad('0x1c')][_0xfbad('0x1d')]===undefined?!![]:![]:!![],'where':_0x492dd6[_0xfbad('0x1c')]?_0x492dd6[_0xfbad('0x1c')][_0xfbad('0x1e')]||null:null,'attributes':_0x492dd6[_0xfbad('0x1c')]?_0x492dd6[_0xfbad('0x1c')][_0xfbad('0x1f')]||null:null,'limit':_0x492dd6[_0xfbad('0x1c')]?_0x492dd6[_0xfbad('0x1c')][_0xfbad('0x20')]||null:null,'include':_0x492dd6['options']?_0x492dd6[_0xfbad('0x1c')][_0xfbad('0x21')]?_[_0xfbad('0x22')](_0x492dd6[_0xfbad('0x1c')][_0xfbad('0x21')],function(_0x130686){return{'model':db[_0x130686[_0xfbad('0x23')]],'as':_0x130686['as'],'attributes':_0x130686[_0xfbad('0x1f')],'include':_0x130686[_0xfbad('0x21')]?_[_0xfbad('0x22')](_0x130686[_0xfbad('0x21')],function(_0x51e4cf){return{'model':db[_0x51e4cf[_0xfbad('0x23')]],'as':_0x51e4cf['as'],'attributes':_0x51e4cf[_0xfbad('0x1f')],'include':_0x51e4cf[_0xfbad('0x21')]?_[_0xfbad('0x22')](_0x51e4cf['include'],function(_0x1c51b8){return{'model':db[_0x1c51b8['model']],'as':_0x1c51b8['as'],'attributes':_0x1c51b8[_0xfbad('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfbad('0x10')](function(_0x1e5066){logger[_0xfbad('0x11')](_0xfbad('0x1a'),_0x492dd6);logger['debug'](_0xfbad('0x1a'),_0x492dd6,JSON[_0xfbad('0x24')](_0x1e5066));_0x2f2da5(_0x1e5066);})[_0xfbad('0x19')](function(_0x2ce782){logger[_0xfbad('0x16')]('GetWhatsappQueue',_0x2ce782['message'],_0x492dd6);_0x5f303f(_0x501b3c['error'](0x1f4,_0x2ce782[_0xfbad('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x42483d){var _0x487b5a=this;return new Promise(function(_0x4cac5c,_0x16533d){return db['WhatsappQueue'][_0xfbad('0x25')]({'raw':_0x42483d[_0xfbad('0x1c')]?_0x42483d[_0xfbad('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x42483d[_0xfbad('0x1c')]?_0x42483d[_0xfbad('0x1c')]['where']||null:null,'attributes':_0x42483d[_0xfbad('0x1c')]?_0x42483d['options']['attributes']||null:null,'include':_0x42483d[_0xfbad('0x1c')]?_0x42483d[_0xfbad('0x1c')][_0xfbad('0x21')]?_[_0xfbad('0x22')](_0x42483d[_0xfbad('0x1c')][_0xfbad('0x21')],function(_0x3c49a3){return{'model':db[_0x3c49a3[_0xfbad('0x23')]],'as':_0x3c49a3['as'],'attributes':_0x3c49a3[_0xfbad('0x1f')],'include':_0x3c49a3['include']?_[_0xfbad('0x22')](_0x3c49a3['include'],function(_0x288e86){return{'model':db[_0x288e86[_0xfbad('0x23')]],'as':_0x288e86['as'],'attributes':_0x288e86[_0xfbad('0x1f')],'include':_0x288e86['include']?_[_0xfbad('0x22')](_0x288e86[_0xfbad('0x21')],function(_0x4fe7f5){return{'model':db[_0x4fe7f5['model']],'as':_0x4fe7f5['as'],'attributes':_0x4fe7f5[_0xfbad('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfbad('0x10')](function(_0x54cc89){logger['info']('ShowWhatsappQueue',_0x42483d);logger[_0xfbad('0x13')]('ShowWhatsappQueue',_0x42483d,JSON[_0xfbad('0x24')](_0x54cc89));_0x4cac5c(_0x54cc89);})['catch'](function(_0x3d6355){logger[_0xfbad('0x16')](_0xfbad('0x26'),_0x3d6355[_0xfbad('0x18')],_0x42483d);_0x16533d(_0x487b5a[_0xfbad('0x16')](0x1f4,_0x3d6355['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9b628b9..5f0667a 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 _0x2952=['./whatsappQueue.events','save','remove','update','emit','register','length','whatsappQueue:'];(function(_0x44f09d,_0x2e71c2){var _0x32cc18=function(_0x23e0f9){while(--_0x23e0f9){_0x44f09d['push'](_0x44f09d['shift']());}};_0x32cc18(++_0x2e71c2);}(_0x2952,0xb8));var _0x2295=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x2952[_0x25e7cb];return _0x375d92;};'use strict';var WhatsappQueueEvents=require(_0x2295('0x0'));var events=[_0x2295('0x1'),_0x2295('0x2'),_0x2295('0x3')];function createListener(_0x15e056,_0x53c05b){return function(_0x1dc1c0){_0x53c05b[_0x2295('0x4')](_0x15e056,_0x1dc1c0);};}function removeListener(_0x34bf09,_0x267cb5){return function(){WhatsappQueueEvents['removeListener'](_0x34bf09,_0x267cb5);};}exports[_0x2295('0x5')]=function(_0x2e795a){for(var _0x51052a=0x0,_0xcd1380=events[_0x2295('0x6')];_0x51052a<_0xcd1380;_0x51052a++){var _0xd840ef=events[_0x51052a];var _0x5043d2=createListener(_0x2295('0x7')+_0xd840ef,_0x2e795a);WhatsappQueueEvents['on'](_0xd840ef,_0x5043d2);}}; \ No newline at end of file +var _0x5f7d=['save','remove','update','removeListener','whatsappQueue:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f7d,0x1bd));var _0xd5f7=function(_0x444e37,_0x4d013c){_0x444e37=_0x444e37-0x0;var _0x515b63=_0x5f7d[_0x444e37];return _0x515b63;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xd5f7('0x0'),_0xd5f7('0x1'),_0xd5f7('0x2')];function createListener(_0xc67ca0,_0xb50da2){return function(_0x2cb8fd){_0xb50da2['emit'](_0xc67ca0,_0x2cb8fd);};}function removeListener(_0x38a48f,_0x3c929e){return function(){WhatsappQueueEvents[_0xd5f7('0x3')](_0x38a48f,_0x3c929e);};}exports['register']=function(_0x5edabb){for(var _0x39d204=0x0,_0x627ed5=events['length'];_0x39d204<_0x627ed5;_0x39d204++){var _0x51143e=events[_0x39d204];var _0x17b872=createListener(_0xd5f7('0x4')+_0x51143e,_0x5edabb);WhatsappQueueEvents['on'](_0x51143e,_0x17b872);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b3fd7ee..64d232a 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 _0x14c5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x5212bf,_0x51d007){var _0x1c426c=function(_0x1dc20d){while(--_0x1dc20d){_0x5212bf['push'](_0x5212bf['shift']());}};_0x1c426c(++_0x51d007);}(_0x14c5,0x1de));var _0x514c=function(_0x4dc468,_0x3a5173){_0x4dc468=_0x4dc468-0x0;var _0x522157=_0x14c5[_0x4dc468];return _0x522157;};'use strict';var multer=require(_0x514c('0x0'));var util=require(_0x514c('0x1'));var path=require(_0x514c('0x2'));var timeout=require('connect-timeout');var express=require(_0x514c('0x3'));var router=express[_0x514c('0x4')]();var auth=require(_0x514c('0x5'));var interaction=require(_0x514c('0x6'));var config=require(_0x514c('0x7'));var controller=require(_0x514c('0x8'));router[_0x514c('0x9')]('/',auth[_0x514c('0xa')](),controller[_0x514c('0xb')]);router['get'](_0x514c('0xc'),auth[_0x514c('0xa')](),controller[_0x514c('0xd')]);router[_0x514c('0x9')](_0x514c('0xe'),auth[_0x514c('0xa')](),controller[_0x514c('0xf')]);router[_0x514c('0x10')]('/',auth['isAuthenticated'](),controller[_0x514c('0x11')]);router[_0x514c('0x12')](_0x514c('0xe'),auth[_0x514c('0xa')](),controller[_0x514c('0x13')]);router[_0x514c('0x14')](_0x514c('0xe'),auth[_0x514c('0xa')](),controller[_0x514c('0x15')]);module[_0x514c('0x16')]=router; \ No newline at end of file +var _0x7b77=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x7b77,0x179));var _0x77b7=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x7b77[_0x31991b];return _0x307304;};'use strict';var multer=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var path=require(_0x77b7('0x2'));var timeout=require(_0x77b7('0x3'));var express=require('express');var router=express[_0x77b7('0x4')]();var auth=require(_0x77b7('0x5'));var interaction=require(_0x77b7('0x6'));var config=require('../../config/environment');var controller=require(_0x77b7('0x7'));router[_0x77b7('0x8')]('/',auth[_0x77b7('0x9')](),controller[_0x77b7('0xa')]);router[_0x77b7('0x8')](_0x77b7('0xb'),auth['isAuthenticated'](),controller[_0x77b7('0xc')]);router[_0x77b7('0x8')](_0x77b7('0xd'),auth['isAuthenticated'](),controller[_0x77b7('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x77b7('0xf')](_0x77b7('0xd'),auth['isAuthenticated'](),controller[_0x77b7('0x10')]);router[_0x77b7('0x11')](_0x77b7('0xd'),auth[_0x77b7('0x9')](),controller[_0x77b7('0x12')]);module[_0x77b7('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0cd143d..a4ff1e2 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 _0xe14b=['sequelize','exports','DATE'];(function(_0x850430,_0x531da9){var _0x5f07f5=function(_0x18733e){while(--_0x18733e){_0x850430['push'](_0x850430['shift']());}};_0x5f07f5(++_0x531da9);}(_0xe14b,0x93));var _0xbe14=function(_0x3014b9,_0x497512){_0x3014b9=_0x3014b9-0x0;var _0x7f225c=_0xe14b[_0x3014b9];return _0x7f225c;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbe14('0x2')]},'leaveAt':{'type':Sequelize[_0xbe14('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbe14('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x28252a,_0x4c4325){var _0x289281=function(_0x3cc463){while(--_0x3cc463){_0x28252a['push'](_0x28252a['shift']());}};_0x289281(++_0x4c4325);}(_0x34e8,0x12c));var _0x834e=function(_0x35cb33,_0x33c4d2){_0x35cb33=_0x35cb33-0x0;var _0x107106=_0x34e8[_0x35cb33];return _0x107106;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 0e16f8a..73de030 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 _0xa994=['order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa994,0x150));var _0x4a99=function(_0x5f4a60,_0x438fac){_0x5f4a60=_0x5f4a60-0x0;var _0x34d847=_0xa994[_0x5f4a60];return _0x34d847;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4a99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a99('0x1'));var jsonpatch=require(_0x4a99('0x2'));var rp=require(_0x4a99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4a99('0x4'));var util=require(_0x4a99('0x5'));var path=require(_0x4a99('0x6'));var sox=require(_0x4a99('0x7'));var csv=require(_0x4a99('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a99('0x9'));var squel=require(_0x4a99('0xa'));var crypto=require(_0x4a99('0xb'));var jsforce=require(_0x4a99('0xc'));var deskjs=require(_0x4a99('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4a99('0xe'));var Papa=require(_0x4a99('0xf'));var Redis=require('ioredis');var authService=require(_0x4a99('0x10'));var qs=require(_0x4a99('0x11'));var as=require(_0x4a99('0x12'));var hardwareService=require(_0x4a99('0x13'));var logger=require(_0x4a99('0x14'))(_0x4a99('0x15'));var utils=require(_0x4a99('0x16'));var config=require(_0x4a99('0x17'));var db=require(_0x4a99('0x18'))['db'];function respondWithStatusCode(_0x2df341,_0x440024){_0x440024=_0x440024||0xcc;return function(_0x1d3d65){if(_0x1d3d65){return _0x2df341[_0x4a99('0x19')](_0x440024);}return _0x2df341[_0x4a99('0x1a')](_0x440024)[_0x4a99('0x1b')]();};}function respondWithResult(_0x23b803,_0x450525){_0x450525=_0x450525||0xc8;return function(_0x83eed8){if(_0x83eed8){return _0x23b803[_0x4a99('0x1a')](_0x450525)[_0x4a99('0x1c')](_0x83eed8);}};}function respondWithFilteredResult(_0x225f5a,_0x6c53da){return function(_0x1d7861){if(_0x1d7861){var _0x257df7=_0x1d7861['count'],_0x816ef6=_0x6c53da[_0x4a99('0x1d')],_0x5f02ab=_0x6c53da[_0x4a99('0x1d')]+_0x6c53da[_0x4a99('0x1e')],_0x445733;if(_0x5f02ab>=_0x257df7){_0x5f02ab=_0x257df7;_0x445733=0xc8;}else{_0x445733=0xce;}_0x225f5a[_0x4a99('0x1a')](_0x445733);return _0x225f5a[_0x4a99('0x1f')](_0x4a99('0x20'),_0x816ef6+'-'+_0x5f02ab+'/'+_0x257df7)[_0x4a99('0x1c')](_0x1d7861);}return null;};}function patchUpdates(_0x201bcd){return function(_0x464c01){try{jsonpatch[_0x4a99('0x21')](_0x464c01,_0x201bcd,!![]);}catch(_0x4e46fb){return BPromise[_0x4a99('0x22')](_0x4e46fb);}return _0x464c01[_0x4a99('0x23')]();};}function saveUpdates(_0xed960b,_0x114c0b){return function(_0x496007){if(_0x496007){return _0x496007[_0x4a99('0x24')](_0xed960b)[_0x4a99('0x25')](function(_0xeac44f){return _0xeac44f;});}return null;};}function removeEntity(_0x59380f,_0x23513c){return function(_0x4ef9bc){if(_0x4ef9bc){return _0x4ef9bc[_0x4a99('0x26')]()[_0x4a99('0x25')](function(){_0x59380f[_0x4a99('0x1a')](0xcc)[_0x4a99('0x1b')]();});}};}function handleEntityNotFound(_0x5c678e,_0x34e89b){return function(_0x77be4d){if(!_0x77be4d){_0x5c678e[_0x4a99('0x19')](0x194);}return _0x77be4d;};}function handleError(_0x16bb62,_0x221757){_0x221757=_0x221757||0x1f4;return function(_0x450cb1){logger['error'](_0x450cb1[_0x4a99('0x27')]);if(_0x450cb1[_0x4a99('0x28')]){delete _0x450cb1[_0x4a99('0x28')];}_0x16bb62[_0x4a99('0x1a')](_0x221757)[_0x4a99('0x29')](_0x450cb1);};}exports[_0x4a99('0x2a')]=function(_0x60c181,_0x50c93e){var _0x47c499={},_0x5161cd={},_0x3522ee={'count':0x0,'rows':[]};var _0x13fe40=_[_0x4a99('0x2b')](db[_0x4a99('0x2c')][_0x4a99('0x2d')],function(_0x35a67e){return{'name':_0x35a67e[_0x4a99('0x2e')],'type':_0x35a67e[_0x4a99('0x2f')][_0x4a99('0x30')]};});_0x5161cd['model']=_[_0x4a99('0x2b')](_0x13fe40,_0x4a99('0x28'));_0x5161cd[_0x4a99('0x31')]=_[_0x4a99('0x32')](_0x60c181[_0x4a99('0x31')]);_0x5161cd[_0x4a99('0x33')]=_['intersection'](_0x5161cd[_0x4a99('0x34')],_0x5161cd[_0x4a99('0x31')]);_0x47c499[_0x4a99('0x35')]=_[_0x4a99('0x36')](_0x5161cd['model'],qs[_0x4a99('0x37')](_0x60c181[_0x4a99('0x31')]['fields']));_0x47c499[_0x4a99('0x35')]=_0x47c499[_0x4a99('0x35')][_0x4a99('0x38')]?_0x47c499['attributes']:_0x5161cd[_0x4a99('0x34')];if(!_0x60c181[_0x4a99('0x31')][_0x4a99('0x39')](_0x4a99('0x3a'))){_0x47c499[_0x4a99('0x1e')]=qs[_0x4a99('0x1e')](_0x60c181[_0x4a99('0x31')]['limit']);_0x47c499['offset']=qs[_0x4a99('0x1d')](_0x60c181['query'][_0x4a99('0x1d')]);}_0x47c499[_0x4a99('0x3b')]=qs[_0x4a99('0x3c')](_0x60c181[_0x4a99('0x31')]['sort']);_0x47c499['where']=qs[_0x4a99('0x33')](_[_0x4a99('0x3d')](_0x60c181[_0x4a99('0x31')],_0x5161cd[_0x4a99('0x33')]),_0x13fe40);if(_0x60c181[_0x4a99('0x31')][_0x4a99('0x3e')]){_0x47c499['where']=_[_0x4a99('0x3f')](_0x47c499[_0x4a99('0x40')],{'$or':_[_0x4a99('0x2b')](_0x13fe40,function(_0x28bd1f){if(_0x28bd1f[_0x4a99('0x2f')]!==_0x4a99('0x41')){var _0x790fd8={};_0x790fd8[_0x28bd1f[_0x4a99('0x28')]]={'$like':'%'+_0x60c181[_0x4a99('0x31')][_0x4a99('0x3e')]+'%'};return _0x790fd8;}})});}_0x47c499=_['merge']({},_0x47c499,_0x60c181[_0x4a99('0x42')]);var _0x2fb18f={'where':_0x47c499['where']};return db[_0x4a99('0x2c')][_0x4a99('0x43')](_0x2fb18f)[_0x4a99('0x25')](function(_0x3c7ce6){_0x3522ee[_0x4a99('0x43')]=_0x3c7ce6;if(_0x60c181[_0x4a99('0x31')][_0x4a99('0x44')]){_0x47c499[_0x4a99('0x45')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x4a99('0x46')](_0x47c499);})[_0x4a99('0x25')](function(_0x4fdecd){_0x3522ee[_0x4a99('0x47')]=_0x4fdecd;return _0x3522ee;})[_0x4a99('0x25')](respondWithFilteredResult(_0x50c93e,_0x47c499))[_0x4a99('0x48')](handleError(_0x50c93e,null));};exports[_0x4a99('0x49')]=function(_0xc81c0,_0xcfe864){var _0x1bfe13={'raw':!![],'where':{'id':_0xc81c0[_0x4a99('0x4a')]['id']}},_0x1f162c={};_0x1f162c[_0x4a99('0x34')]=_['keys'](db[_0x4a99('0x2c')][_0x4a99('0x2d')]);_0x1f162c['query']=_['keys'](_0xc81c0[_0x4a99('0x31')]);_0x1f162c[_0x4a99('0x33')]=_[_0x4a99('0x36')](_0x1f162c[_0x4a99('0x34')],_0x1f162c[_0x4a99('0x31')]);_0x1bfe13[_0x4a99('0x35')]=_[_0x4a99('0x36')](_0x1f162c['model'],qs[_0x4a99('0x37')](_0xc81c0['query'][_0x4a99('0x37')]));_0x1bfe13['attributes']=_0x1bfe13[_0x4a99('0x35')][_0x4a99('0x38')]?_0x1bfe13[_0x4a99('0x35')]:_0x1f162c[_0x4a99('0x34')];if(_0xc81c0[_0x4a99('0x31')][_0x4a99('0x44')]){_0x1bfe13[_0x4a99('0x45')]=[{'all':!![]}];}_0x1bfe13=_[_0x4a99('0x3f')]({},_0x1bfe13,_0xc81c0[_0x4a99('0x42')]);return db[_0x4a99('0x2c')]['find'](_0x1bfe13)[_0x4a99('0x25')](handleEntityNotFound(_0xcfe864,null))['then'](respondWithResult(_0xcfe864,null))[_0x4a99('0x48')](handleError(_0xcfe864,null));};exports[_0x4a99('0x4b')]=function(_0x41dd1f,_0x2e3f53){return db['WhatsappQueueReport'][_0x4a99('0x4b')](_0x41dd1f['body'],{})[_0x4a99('0x25')](respondWithResult(_0x2e3f53,0xc9))[_0x4a99('0x48')](handleError(_0x2e3f53,null));};exports[_0x4a99('0x24')]=function(_0x12a4f8,_0x149b34){if(_0x12a4f8[_0x4a99('0x4c')]['id']){delete _0x12a4f8[_0x4a99('0x4c')]['id'];}return db[_0x4a99('0x2c')][_0x4a99('0x4d')]({'where':{'id':_0x12a4f8['params']['id']}})['then'](handleEntityNotFound(_0x149b34,null))[_0x4a99('0x25')](saveUpdates(_0x12a4f8[_0x4a99('0x4c')],null))[_0x4a99('0x25')](respondWithResult(_0x149b34,null))['catch'](handleError(_0x149b34,null));};exports[_0x4a99('0x26')]=function(_0x193efb,_0x1cafe9){return db[_0x4a99('0x2c')]['find']({'where':{'id':_0x193efb[_0x4a99('0x4a')]['id']}})[_0x4a99('0x25')](handleEntityNotFound(_0x1cafe9,null))[_0x4a99('0x25')](removeEntity(_0x1cafe9,null))[_0x4a99('0x48')](handleError(_0x1cafe9,null));};exports['describe']=function(_0x1d06c5,_0x2eab63){return db[_0x4a99('0x2c')][_0x4a99('0x4e')]()[_0x4a99('0x25')](respondWithResult(_0x2eab63,null))[_0x4a99('0x48')](handleError(_0x2eab63,null));}; \ No newline at end of file +var _0x6a6e=['request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','describe','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x48882e,_0x4b5f44){var _0x54f700=function(_0x32f0a0){while(--_0x32f0a0){_0x48882e['push'](_0x48882e['shift']());}};_0x54f700(++_0x4b5f44);}(_0x6a6e,0xe3));var _0xe6a6=function(_0x1b00f1,_0x15ffa8){_0x1b00f1=_0x1b00f1-0x0;var _0x5c3dad=_0x6a6e[_0x1b00f1];return _0x5c3dad;};'use strict';var pdf=require(_0xe6a6('0x0'));var emlformat=require(_0xe6a6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe6a6('0x2'));var jsonpatch=require(_0xe6a6('0x3'));var rp=require(_0xe6a6('0x4'));var moment=require(_0xe6a6('0x5'));var BPromise=require(_0xe6a6('0x6'));var Mustache=require(_0xe6a6('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe6a6('0x8'));var csv=require(_0xe6a6('0x9'));var ejs=require(_0xe6a6('0xa'));var fs=require('fs');var _=require(_0xe6a6('0xb'));var squel=require(_0xe6a6('0xc'));var crypto=require(_0xe6a6('0xd'));var jsforce=require(_0xe6a6('0xe'));var deskjs=require(_0xe6a6('0xf'));var toCsv=require(_0xe6a6('0x9'));var querystring=require(_0xe6a6('0x10'));var Papa=require(_0xe6a6('0x11'));var Redis=require(_0xe6a6('0x12'));var authService=require(_0xe6a6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe6a6('0x14'));var hardwareService=require(_0xe6a6('0x15'));var logger=require(_0xe6a6('0x16'))(_0xe6a6('0x17'));var utils=require(_0xe6a6('0x18'));var config=require(_0xe6a6('0x19'));var db=require(_0xe6a6('0x1a'))['db'];function respondWithStatusCode(_0x22dda5,_0xd6f9b4){_0xd6f9b4=_0xd6f9b4||0xcc;return function(_0x5b32cc){if(_0x5b32cc){return _0x22dda5['sendStatus'](_0xd6f9b4);}return _0x22dda5[_0xe6a6('0x1b')](_0xd6f9b4)[_0xe6a6('0x1c')]();};}function respondWithResult(_0x4379fc,_0x179414){_0x179414=_0x179414||0xc8;return function(_0x443940){if(_0x443940){return _0x4379fc['status'](_0x179414)['json'](_0x443940);}};}function respondWithFilteredResult(_0x11e531,_0x402b85){return function(_0x44c86b){if(_0x44c86b){var _0x2202bc=_0x44c86b[_0xe6a6('0x1d')],_0x537aee=_0x402b85[_0xe6a6('0x1e')],_0x56b5ed=_0x402b85['offset']+_0x402b85[_0xe6a6('0x1f')],_0x2eb146;if(_0x56b5ed>=_0x2202bc){_0x56b5ed=_0x2202bc;_0x2eb146=0xc8;}else{_0x2eb146=0xce;}_0x11e531[_0xe6a6('0x1b')](_0x2eb146);return _0x11e531[_0xe6a6('0x20')](_0xe6a6('0x21'),_0x537aee+'-'+_0x56b5ed+'/'+_0x2202bc)['json'](_0x44c86b);}return null;};}function patchUpdates(_0x3355d1){return function(_0x5ac1ed){try{jsonpatch[_0xe6a6('0x22')](_0x5ac1ed,_0x3355d1,!![]);}catch(_0x572427){return BPromise[_0xe6a6('0x23')](_0x572427);}return _0x5ac1ed['save']();};}function saveUpdates(_0x269842,_0x155ab0){return function(_0x315d3b){if(_0x315d3b){return _0x315d3b[_0xe6a6('0x24')](_0x269842)[_0xe6a6('0x25')](function(_0x538441){return _0x538441;});}return null;};}function removeEntity(_0x5e653f,_0x12f755){return function(_0x21b019){if(_0x21b019){return _0x21b019[_0xe6a6('0x26')]()[_0xe6a6('0x25')](function(){_0x5e653f[_0xe6a6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18412d,_0x99a41f){return function(_0xc1e9fe){if(!_0xc1e9fe){_0x18412d[_0xe6a6('0x27')](0x194);}return _0xc1e9fe;};}function handleError(_0x15f2e3,_0x1db065){_0x1db065=_0x1db065||0x1f4;return function(_0x5c2996){logger['error'](_0x5c2996[_0xe6a6('0x28')]);if(_0x5c2996[_0xe6a6('0x29')]){delete _0x5c2996[_0xe6a6('0x29')];}_0x15f2e3['status'](_0x1db065)[_0xe6a6('0x2a')](_0x5c2996);};}exports[_0xe6a6('0x2b')]=function(_0x4b8478,_0x199b0c){var _0x5e2cac={},_0x3b8fd7={},_0x393080={'count':0x0,'rows':[]};var _0xd9e392=_['map'](db[_0xe6a6('0x2c')][_0xe6a6('0x2d')],function(_0x5c1130){return{'name':_0x5c1130[_0xe6a6('0x2e')],'type':_0x5c1130['type'][_0xe6a6('0x2f')]};});_0x3b8fd7[_0xe6a6('0x30')]=_[_0xe6a6('0x31')](_0xd9e392,_0xe6a6('0x29'));_0x3b8fd7[_0xe6a6('0x32')]=_[_0xe6a6('0x33')](_0x4b8478['query']);_0x3b8fd7[_0xe6a6('0x34')]=_['intersection'](_0x3b8fd7[_0xe6a6('0x30')],_0x3b8fd7[_0xe6a6('0x32')]);_0x5e2cac[_0xe6a6('0x35')]=_[_0xe6a6('0x36')](_0x3b8fd7[_0xe6a6('0x30')],qs['fields'](_0x4b8478[_0xe6a6('0x32')][_0xe6a6('0x37')]));_0x5e2cac[_0xe6a6('0x35')]=_0x5e2cac[_0xe6a6('0x35')]['length']?_0x5e2cac['attributes']:_0x3b8fd7[_0xe6a6('0x30')];if(!_0x4b8478[_0xe6a6('0x32')][_0xe6a6('0x38')]('nolimit')){_0x5e2cac[_0xe6a6('0x1f')]=qs[_0xe6a6('0x1f')](_0x4b8478[_0xe6a6('0x32')]['limit']);_0x5e2cac[_0xe6a6('0x1e')]=qs[_0xe6a6('0x1e')](_0x4b8478[_0xe6a6('0x32')][_0xe6a6('0x1e')]);}_0x5e2cac['order']=qs[_0xe6a6('0x39')](_0x4b8478['query'][_0xe6a6('0x39')]);_0x5e2cac[_0xe6a6('0x3a')]=qs[_0xe6a6('0x34')](_[_0xe6a6('0x3b')](_0x4b8478[_0xe6a6('0x32')],_0x3b8fd7[_0xe6a6('0x34')]),_0xd9e392);if(_0x4b8478[_0xe6a6('0x32')][_0xe6a6('0x3c')]){_0x5e2cac[_0xe6a6('0x3a')]=_['merge'](_0x5e2cac[_0xe6a6('0x3a')],{'$or':_['map'](_0xd9e392,function(_0x3d4f71){if(_0x3d4f71[_0xe6a6('0x3d')]!==_0xe6a6('0x3e')){var _0x129239={};_0x129239[_0x3d4f71['name']]={'$like':'%'+_0x4b8478[_0xe6a6('0x32')]['filter']+'%'};return _0x129239;}})});}_0x5e2cac=_[_0xe6a6('0x3f')]({},_0x5e2cac,_0x4b8478[_0xe6a6('0x40')]);var _0x51a340={'where':_0x5e2cac[_0xe6a6('0x3a')]};return db[_0xe6a6('0x2c')][_0xe6a6('0x1d')](_0x51a340)['then'](function(_0x955b81){_0x393080['count']=_0x955b81;if(_0x4b8478[_0xe6a6('0x32')][_0xe6a6('0x41')]){_0x5e2cac[_0xe6a6('0x42')]=[{'all':!![]}];}return db[_0xe6a6('0x2c')][_0xe6a6('0x43')](_0x5e2cac);})[_0xe6a6('0x25')](function(_0x8e142f){_0x393080[_0xe6a6('0x44')]=_0x8e142f;return _0x393080;})['then'](respondWithFilteredResult(_0x199b0c,_0x5e2cac))['catch'](handleError(_0x199b0c,null));};exports[_0xe6a6('0x45')]=function(_0x5a89c8,_0x474a2b){var _0x1bf04d={'raw':!![],'where':{'id':_0x5a89c8[_0xe6a6('0x46')]['id']}},_0x291763={};_0x291763[_0xe6a6('0x30')]=_[_0xe6a6('0x33')](db[_0xe6a6('0x2c')][_0xe6a6('0x2d')]);_0x291763[_0xe6a6('0x32')]=_[_0xe6a6('0x33')](_0x5a89c8['query']);_0x291763[_0xe6a6('0x34')]=_[_0xe6a6('0x36')](_0x291763['model'],_0x291763['query']);_0x1bf04d[_0xe6a6('0x35')]=_[_0xe6a6('0x36')](_0x291763['model'],qs[_0xe6a6('0x37')](_0x5a89c8[_0xe6a6('0x32')][_0xe6a6('0x37')]));_0x1bf04d['attributes']=_0x1bf04d['attributes'][_0xe6a6('0x47')]?_0x1bf04d[_0xe6a6('0x35')]:_0x291763[_0xe6a6('0x30')];if(_0x5a89c8[_0xe6a6('0x32')][_0xe6a6('0x41')]){_0x1bf04d[_0xe6a6('0x42')]=[{'all':!![]}];}_0x1bf04d=_[_0xe6a6('0x3f')]({},_0x1bf04d,_0x5a89c8[_0xe6a6('0x40')]);return db[_0xe6a6('0x2c')][_0xe6a6('0x48')](_0x1bf04d)[_0xe6a6('0x25')](handleEntityNotFound(_0x474a2b,null))[_0xe6a6('0x25')](respondWithResult(_0x474a2b,null))['catch'](handleError(_0x474a2b,null));};exports[_0xe6a6('0x49')]=function(_0x14c5fe,_0xdd787c){return db[_0xe6a6('0x2c')][_0xe6a6('0x49')](_0x14c5fe[_0xe6a6('0x4a')],{})[_0xe6a6('0x25')](respondWithResult(_0xdd787c,0xc9))['catch'](handleError(_0xdd787c,null));};exports[_0xe6a6('0x24')]=function(_0x22d172,_0x4f1089){if(_0x22d172[_0xe6a6('0x4a')]['id']){delete _0x22d172[_0xe6a6('0x4a')]['id'];}return db[_0xe6a6('0x2c')][_0xe6a6('0x48')]({'where':{'id':_0x22d172[_0xe6a6('0x46')]['id']}})[_0xe6a6('0x25')](handleEntityNotFound(_0x4f1089,null))[_0xe6a6('0x25')](saveUpdates(_0x22d172[_0xe6a6('0x4a')],null))['then'](respondWithResult(_0x4f1089,null))[_0xe6a6('0x4b')](handleError(_0x4f1089,null));};exports['destroy']=function(_0x129549,_0x5f35df){return db['WhatsappQueueReport'][_0xe6a6('0x48')]({'where':{'id':_0x129549[_0xe6a6('0x46')]['id']}})[_0xe6a6('0x25')](handleEntityNotFound(_0x5f35df,null))[_0xe6a6('0x25')](removeEntity(_0x5f35df,null))['catch'](handleError(_0x5f35df,null));};exports[_0xe6a6('0x4c')]=function(_0x1ded01,_0x922632){return db[_0xe6a6('0x2c')][_0xe6a6('0x4c')]()[_0xe6a6('0x25')](respondWithResult(_0x922632,null))[_0xe6a6('0x4b')](handleError(_0x922632,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3f55c52..630483a 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 _0x6811=['bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6811,0x121));var _0x1681=function(_0x27c08f,_0x23e0d7){_0x27c08f=_0x27c08f-0x0;var _0x4b3def=_0x6811[_0x27c08f];return _0x4b3def;};'use strict';var _=require(_0x1681('0x0'));var util=require(_0x1681('0x1'));var logger=require(_0x1681('0x2'))(_0x1681('0x3'));var moment=require(_0x1681('0x4'));var BPromise=require(_0x1681('0x5'));var rp=require(_0x1681('0x6'));var fs=require('fs');var path=require(_0x1681('0x7'));var rimraf=require(_0x1681('0x8'));var config=require(_0x1681('0x9'));var attributes=require('./whatsappQueueReport.attributes');module[_0x1681('0xa')]=function(_0x50018d,_0x2db0b8){return _0x50018d['define'](_0x1681('0xb'),attributes,{'tableName':_0x1681('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1681('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d81=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid'];(function(_0x2cd02e,_0xaa73d){var _0x123a49=function(_0x464c2d){while(--_0x464c2d){_0x2cd02e['push'](_0x2cd02e['shift']());}};_0x123a49(++_0xaa73d);}(_0x7d81,0xc3));var _0x17d8=function(_0x1db0aa,_0x45dbff){_0x1db0aa=_0x1db0aa-0x0;var _0x171c0e=_0x7d81[_0x1db0aa];return _0x171c0e;};'use strict';var _=require(_0x17d8('0x0'));var util=require(_0x17d8('0x1'));var logger=require(_0x17d8('0x2'))('api');var moment=require(_0x17d8('0x3'));var BPromise=require(_0x17d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17d8('0x5'));var rimraf=require(_0x17d8('0x6'));var config=require(_0x17d8('0x7'));var attributes=require(_0x17d8('0x8'));module[_0x17d8('0x9')]=function(_0x571508,_0x5a9d39){return _0x571508[_0x17d8('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x17d8('0xb'),'paranoid':![],'indexes':[{'name':_0x17d8('0xc'),'fields':[_0x17d8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index e489b76..01c1142 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 _0x7012=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','where','limit','UpdateWhatsappQueueReport','lodash','util'];(function(_0x5652e3,_0xcc6587){var _0x487e3d=function(_0x2ac30f){while(--_0x2ac30f){_0x5652e3['push'](_0x5652e3['shift']());}};_0x487e3d(++_0xcc6587);}(_0x7012,0xc9));var _0x2701=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x7012[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x2701('0x0'));var util=require(_0x2701('0x1'));var moment=require('moment');var BPromise=require(_0x2701('0x2'));var rs=require(_0x2701('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2701('0x4'));var logger=require(_0x2701('0x5'))('rpc');var config=require(_0x2701('0x6'));var jayson=require(_0x2701('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc15aca,_0x546f6c,_0x2865cb){return new BPromise(function(_0x1b77c8,_0x217eff){return client[_0x2701('0x8')](_0xc15aca,_0x2865cb)[_0x2701('0x9')](function(_0x22e04a){logger[_0x2701('0xa')]('WhatsappQueueReport,\x20%s,\x20%s',_0x546f6c,_0x2701('0xb'));logger[_0x2701('0xc')](_0x2701('0xd'),_0x546f6c,_0x2701('0xb'),JSON[_0x2701('0xe')](_0x22e04a));if(_0x22e04a[_0x2701('0xf')]){if(_0x22e04a[_0x2701('0xf')][_0x2701('0x10')]===0x1f4){logger[_0x2701('0xf')](_0x2701('0x11'),_0x546f6c,_0x22e04a['error'][_0x2701('0x12')]);return _0x217eff(_0x22e04a[_0x2701('0xf')][_0x2701('0x12')]);}logger[_0x2701('0xf')](_0x2701('0x11'),_0x546f6c,_0x22e04a['error'][_0x2701('0x12')]);return _0x1b77c8(_0x22e04a[_0x2701('0xf')][_0x2701('0x12')]);}else{logger[_0x2701('0xa')](_0x2701('0x11'),_0x546f6c,'request\x20sent');_0x1b77c8(_0x22e04a[_0x2701('0x13')]['message']);}})[_0x2701('0x14')](function(_0x16cef0){logger[_0x2701('0xf')](_0x2701('0x11'),_0x546f6c,_0x16cef0);_0x217eff(_0x16cef0);});});}exports[_0x2701('0x15')]=function(_0x321bc4){var _0x355b03=this;return new Promise(function(_0x2481fc,_0x1767a7){return db[_0x2701('0x16')]['create'](_0x321bc4[_0x2701('0x17')],{'raw':_0x321bc4[_0x2701('0x18')]?_0x321bc4['options']['raw']===undefined?!![]:![]:!![]})[_0x2701('0x9')](function(_0x43d91f){logger[_0x2701('0xa')]('CreateWhatsappQueueReport',_0x321bc4);logger[_0x2701('0xc')](_0x2701('0x15'),_0x321bc4,JSON['stringify'](_0x43d91f));_0x2481fc(_0x43d91f);})[_0x2701('0x14')](function(_0x45263a){logger[_0x2701('0xf')]('CreateWhatsappQueueReport',_0x45263a['message'],_0x321bc4);_0x1767a7(_0x355b03[_0x2701('0xf')](0x1f4,_0x45263a[_0x2701('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x393264){var _0x997680=this;return new Promise(function(_0x4ef943,_0x551da2){return db['WhatsappQueueReport']['update'](_0x393264[_0x2701('0x17')],{'raw':_0x393264[_0x2701('0x18')]?_0x393264[_0x2701('0x18')][_0x2701('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x393264['options']?_0x393264[_0x2701('0x18')][_0x2701('0x1a')]||null:null,'attributes':_0x393264['options']?_0x393264['options']['attributes']||null:null,'limit':_0x393264[_0x2701('0x18')]?_0x393264['options'][_0x2701('0x1b')]||null:null})[_0x2701('0x9')](function(_0x3db11f){logger[_0x2701('0xa')](_0x2701('0x1c'),_0x393264);logger[_0x2701('0xc')]('UpdateWhatsappQueueReport',_0x393264,JSON[_0x2701('0xe')](_0x3db11f));_0x4ef943(_0x3db11f);})[_0x2701('0x14')](function(_0x190122){logger['error']('UpdateWhatsappQueueReport',_0x190122[_0x2701('0x12')],_0x393264);_0x551da2(_0x997680[_0x2701('0xf')](0x1f4,_0x190122['message']));});});}; \ No newline at end of file +var _0xb48f=['WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateWhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','where','attributes','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','then','info'];(function(_0x36b355,_0x168752){var _0x1510d8=function(_0x58e943){while(--_0x58e943){_0x36b355['push'](_0x36b355['shift']());}};_0x1510d8(++_0x168752);}(_0xb48f,0x1e4));var _0xfb48=function(_0x262734,_0x6a7eb2){_0x262734=_0x262734-0x0;var _0x52c6c8=_0xb48f[_0x262734];return _0x52c6c8;};'use strict';var _=require('lodash');var util=require(_0xfb48('0x0'));var moment=require(_0xfb48('0x1'));var BPromise=require(_0xfb48('0x2'));var rs=require(_0xfb48('0x3'));var fs=require('fs');var Redis=require(_0xfb48('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfb48('0x5'))(_0xfb48('0x6'));var config=require(_0xfb48('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e9596,_0x3c60f5,_0xe001ad){return new BPromise(function(_0x457624,_0x3ce3db){return client['request'](_0x3e9596,_0xe001ad)[_0xfb48('0x8')](function(_0x25e663){logger[_0xfb48('0x9')](_0xfb48('0xa'),_0x3c60f5,_0xfb48('0xb'));logger[_0xfb48('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3c60f5,_0xfb48('0xb'),JSON[_0xfb48('0xd')](_0x25e663));if(_0x25e663[_0xfb48('0xe')]){if(_0x25e663[_0xfb48('0xe')]['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3c60f5,_0x25e663['error'][_0xfb48('0xf')]);return _0x3ce3db(_0x25e663[_0xfb48('0xe')][_0xfb48('0xf')]);}logger['error'](_0xfb48('0xa'),_0x3c60f5,_0x25e663['error'][_0xfb48('0xf')]);return _0x457624(_0x25e663[_0xfb48('0xe')][_0xfb48('0xf')]);}else{logger[_0xfb48('0x9')](_0xfb48('0xa'),_0x3c60f5,_0xfb48('0xb'));_0x457624(_0x25e663[_0xfb48('0x10')]['message']);}})[_0xfb48('0x11')](function(_0x555b3f){logger['error'](_0xfb48('0xa'),_0x3c60f5,_0x555b3f);_0x3ce3db(_0x555b3f);});});}exports[_0xfb48('0x12')]=function(_0x2a8fce){var _0x243a16=this;return new Promise(function(_0x1f19d8,_0x2a33ea){return db['WhatsappQueueReport']['create'](_0x2a8fce[_0xfb48('0x13')],{'raw':_0x2a8fce[_0xfb48('0x14')]?_0x2a8fce[_0xfb48('0x14')][_0xfb48('0x15')]===undefined?!![]:![]:!![]})[_0xfb48('0x8')](function(_0xbab24a){logger[_0xfb48('0x9')](_0xfb48('0x12'),_0x2a8fce);logger[_0xfb48('0xc')](_0xfb48('0x12'),_0x2a8fce,JSON['stringify'](_0xbab24a));_0x1f19d8(_0xbab24a);})[_0xfb48('0x11')](function(_0x3ccfc0){logger[_0xfb48('0xe')](_0xfb48('0x12'),_0x3ccfc0[_0xfb48('0xf')],_0x2a8fce);_0x2a33ea(_0x243a16['error'](0x1f4,_0x3ccfc0[_0xfb48('0xf')]));});});};exports[_0xfb48('0x16')]=function(_0x158c30){var _0xdba0c=this;return new Promise(function(_0x2d14d6,_0xf64ded){return db[_0xfb48('0x17')]['update'](_0x158c30[_0xfb48('0x13')],{'raw':_0x158c30[_0xfb48('0x14')]?_0x158c30[_0xfb48('0x14')][_0xfb48('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x158c30[_0xfb48('0x14')]?_0x158c30['options'][_0xfb48('0x18')]||null:null,'attributes':_0x158c30[_0xfb48('0x14')]?_0x158c30[_0xfb48('0x14')][_0xfb48('0x19')]||null:null,'limit':_0x158c30[_0xfb48('0x14')]?_0x158c30['options']['limit']||null:null})['then'](function(_0x3561ce){logger[_0xfb48('0x9')](_0xfb48('0x16'),_0x158c30);logger[_0xfb48('0xc')](_0xfb48('0x16'),_0x158c30,JSON[_0xfb48('0xd')](_0x3561ce));_0x2d14d6(_0x3561ce);})[_0xfb48('0x11')](function(_0x3e1efc){logger[_0xfb48('0xe')](_0xfb48('0x16'),_0x3e1efc[_0xfb48('0xf')],_0x158c30);_0xf64ded(_0xdba0c[_0xfb48('0xe')](0x1f4,_0x3e1efc[_0xfb48('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 890c26f..c99744a 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 _0xd3c8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xd3c8,0x161));var _0x8d3c=function(_0x4b0b79,_0x5bc5f9){_0x4b0b79=_0x4b0b79-0x0;var _0xcce5c3=_0xd3c8[_0x4b0b79];return _0xcce5c3;};'use strict';var multer=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var path=require(_0x8d3c('0x2'));var timeout=require(_0x8d3c('0x3'));var express=require(_0x8d3c('0x4'));var router=express['Router']();var auth=require(_0x8d3c('0x5'));var interaction=require(_0x8d3c('0x6'));var config=require(_0x8d3c('0x7'));var controller=require(_0x8d3c('0x8'));router['get']('/',auth[_0x8d3c('0x9')](),controller[_0x8d3c('0xa')]);router[_0x8d3c('0xb')](_0x8d3c('0xc'),auth[_0x8d3c('0x9')](),controller[_0x8d3c('0xd')]);router[_0x8d3c('0xb')](_0x8d3c('0xe'),auth[_0x8d3c('0x9')](),controller[_0x8d3c('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8d3c('0x10')](_0x8d3c('0xe'),auth[_0x8d3c('0x9')](),controller[_0x8d3c('0x11')]);router[_0x8d3c('0x12')](_0x8d3c('0xe'),auth[_0x8d3c('0x9')](),controller[_0x8d3c('0x13')]);module[_0x8d3c('0x14')]=router; \ No newline at end of file +var _0xdbcd=['exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','destroy'];(function(_0x17d32b,_0x7dfd60){var _0x2a40cf=function(_0x11bcfb){while(--_0x11bcfb){_0x17d32b['push'](_0x17d32b['shift']());}};_0x2a40cf(++_0x7dfd60);}(_0xdbcd,0x67));var _0xddbc=function(_0x323f57,_0x4f68f5){_0x323f57=_0x323f57-0x0;var _0x1813eb=_0xdbcd[_0x323f57];return _0x1813eb;};'use strict';var multer=require('multer');var util=require(_0xddbc('0x0'));var path=require(_0xddbc('0x1'));var timeout=require(_0xddbc('0x2'));var express=require('express');var router=express[_0xddbc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xddbc('0x4'));var config=require(_0xddbc('0x5'));var controller=require(_0xddbc('0x6'));router[_0xddbc('0x7')]('/',auth[_0xddbc('0x8')](),controller[_0xddbc('0x9')]);router['get'](_0xddbc('0xa'),auth[_0xddbc('0x8')](),controller['describe']);router[_0xddbc('0x7')](_0xddbc('0xb'),auth[_0xddbc('0x8')](),controller[_0xddbc('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xddbc('0xd')]);router['put'](_0xddbc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xddbc('0xe')](_0xddbc('0xb'),auth['isAuthenticated'](),controller[_0xddbc('0xf')]);module[_0xddbc('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index f16e0c1..0bad5f3 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0b0e,0x187));var _0xe0b0=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x0b0e[_0x594e11];return _0x5418ad;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file +var _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x3d7a61,_0xe8d0ec){var _0x58e78e=function(_0x27a2e5){while(--_0x27a2e5){_0x3d7a61['push'](_0x3d7a61['shift']());}};_0x58e78e(++_0xe8d0ec);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index e41ec5e..b6e40ea 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 _0x1202=['limit','order','sort','pick','filter','where','merge','options','WhatsappTransferReport','includeAll','include','rows','catch','show','keys','length','find','create','body','destroy','params','describe','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','count','offset','save','update','then','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x1dd6bc,_0x5c582e){var _0x145309=function(_0x3d50e4){while(--_0x3d50e4){_0x1dd6bc['push'](_0x1dd6bc['shift']());}};_0x145309(++_0x5c582e);}(_0x1202,0x15b));var _0x2120=function(_0xded542,_0x26e749){_0xded542=_0xded542-0x0;var _0x3a0416=_0x1202[_0xded542];return _0x3a0416;};'use strict';var pdf=require(_0x2120('0x0'));var emlformat=require(_0x2120('0x1'));var rimraf=require(_0x2120('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2120('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2120('0x4'));var util=require(_0x2120('0x5'));var path=require(_0x2120('0x6'));var sox=require('sox');var csv=require(_0x2120('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2120('0x8'));var squel=require(_0x2120('0x9'));var crypto=require('crypto');var jsforce=require(_0x2120('0xa'));var deskjs=require(_0x2120('0xb'));var toCsv=require(_0x2120('0x7'));var querystring=require(_0x2120('0xc'));var Papa=require(_0x2120('0xd'));var Redis=require(_0x2120('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2120('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2120('0x10'));var logger=require('../../config/logger')(_0x2120('0x11'));var utils=require(_0x2120('0x12'));var config=require(_0x2120('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c9e59,_0xe1aa98){_0xe1aa98=_0xe1aa98||0xcc;return function(_0x3309b6){if(_0x3309b6){return _0x4c9e59['sendStatus'](_0xe1aa98);}return _0x4c9e59[_0x2120('0x14')](_0xe1aa98)[_0x2120('0x15')]();};}function respondWithResult(_0x1526a6,_0x450b4a){_0x450b4a=_0x450b4a||0xc8;return function(_0x5011be){if(_0x5011be){return _0x1526a6['status'](_0x450b4a)[_0x2120('0x16')](_0x5011be);}};}function respondWithFilteredResult(_0x42f6e3,_0x3d33e7){return function(_0x3bf5c8){if(_0x3bf5c8){var _0xb81532=_0x3bf5c8[_0x2120('0x17')],_0x4bab49=_0x3d33e7[_0x2120('0x18')],_0x44eb9f=_0x3d33e7[_0x2120('0x18')]+_0x3d33e7['limit'],_0xfd688d;if(_0x44eb9f>=_0xb81532){_0x44eb9f=_0xb81532;_0xfd688d=0xc8;}else{_0xfd688d=0xce;}_0x42f6e3[_0x2120('0x14')](_0xfd688d);return _0x42f6e3['set']('Content-Range',_0x4bab49+'-'+_0x44eb9f+'/'+_0xb81532)[_0x2120('0x16')](_0x3bf5c8);}return null;};}function patchUpdates(_0x5739b6){return function(_0x258fe5){try{jsonpatch['apply'](_0x258fe5,_0x5739b6,!![]);}catch(_0x2e4871){return BPromise['reject'](_0x2e4871);}return _0x258fe5[_0x2120('0x19')]();};}function saveUpdates(_0x148d92,_0x483f0f){return function(_0x2b5987){if(_0x2b5987){return _0x2b5987[_0x2120('0x1a')](_0x148d92)[_0x2120('0x1b')](function(_0x445284){return _0x445284;});}return null;};}function removeEntity(_0x5a7945,_0x28a74e){return function(_0x5b5ceb){if(_0x5b5ceb){return _0x5b5ceb['destroy']()[_0x2120('0x1b')](function(){_0x5a7945[_0x2120('0x14')](0xcc)[_0x2120('0x15')]();});}};}function handleEntityNotFound(_0x58e92c,_0x17f574){return function(_0x56ee92){if(!_0x56ee92){_0x58e92c['sendStatus'](0x194);}return _0x56ee92;};}function handleError(_0x32c95c,_0x288451){_0x288451=_0x288451||0x1f4;return function(_0x38d6be){logger['error'](_0x38d6be[_0x2120('0x1c')]);if(_0x38d6be[_0x2120('0x1d')]){delete _0x38d6be[_0x2120('0x1d')];}_0x32c95c[_0x2120('0x14')](_0x288451)['send'](_0x38d6be);};}exports[_0x2120('0x1e')]=function(_0x183699,_0x4d40d4){var _0x3c36d3={},_0x276193={},_0x3bbf3e={'count':0x0,'rows':[]};var _0x56495a=_[_0x2120('0x1f')](db['WhatsappTransferReport'][_0x2120('0x20')],function(_0x1e3985){return{'name':_0x1e3985[_0x2120('0x21')],'type':_0x1e3985[_0x2120('0x22')]['key']};});_0x276193[_0x2120('0x23')]=_[_0x2120('0x1f')](_0x56495a,_0x2120('0x1d'));_0x276193[_0x2120('0x24')]=_['keys'](_0x183699[_0x2120('0x24')]);_0x276193[_0x2120('0x25')]=_[_0x2120('0x26')](_0x276193[_0x2120('0x23')],_0x276193[_0x2120('0x24')]);_0x3c36d3[_0x2120('0x27')]=_[_0x2120('0x26')](_0x276193[_0x2120('0x23')],qs[_0x2120('0x28')](_0x183699['query'][_0x2120('0x28')]));_0x3c36d3[_0x2120('0x27')]=_0x3c36d3[_0x2120('0x27')]['length']?_0x3c36d3['attributes']:_0x276193[_0x2120('0x23')];if(!_0x183699[_0x2120('0x24')][_0x2120('0x29')](_0x2120('0x2a'))){_0x3c36d3[_0x2120('0x2b')]=qs[_0x2120('0x2b')](_0x183699[_0x2120('0x24')][_0x2120('0x2b')]);_0x3c36d3['offset']=qs['offset'](_0x183699['query'][_0x2120('0x18')]);}_0x3c36d3[_0x2120('0x2c')]=qs[_0x2120('0x2d')](_0x183699[_0x2120('0x24')]['sort']);_0x3c36d3['where']=qs[_0x2120('0x25')](_[_0x2120('0x2e')](_0x183699[_0x2120('0x24')],_0x276193['filters']),_0x56495a);if(_0x183699['query'][_0x2120('0x2f')]){_0x3c36d3[_0x2120('0x30')]=_[_0x2120('0x31')](_0x3c36d3[_0x2120('0x30')],{'$or':_[_0x2120('0x1f')](_0x56495a,function(_0x2c8fed){if(_0x2c8fed[_0x2120('0x22')]!=='VIRTUAL'){var _0x47ee7a={};_0x47ee7a[_0x2c8fed[_0x2120('0x1d')]]={'$like':'%'+_0x183699['query'][_0x2120('0x2f')]+'%'};return _0x47ee7a;}})});}_0x3c36d3=_[_0x2120('0x31')]({},_0x3c36d3,_0x183699[_0x2120('0x32')]);var _0x4f8fb4={'where':_0x3c36d3[_0x2120('0x30')]};return db[_0x2120('0x33')][_0x2120('0x17')](_0x4f8fb4)[_0x2120('0x1b')](function(_0x5201e6){_0x3bbf3e[_0x2120('0x17')]=_0x5201e6;if(_0x183699[_0x2120('0x24')][_0x2120('0x34')]){_0x3c36d3[_0x2120('0x35')]=[{'all':!![]}];}return db[_0x2120('0x33')]['findAll'](_0x3c36d3);})[_0x2120('0x1b')](function(_0x5c2177){_0x3bbf3e[_0x2120('0x36')]=_0x5c2177;return _0x3bbf3e;})['then'](respondWithFilteredResult(_0x4d40d4,_0x3c36d3))[_0x2120('0x37')](handleError(_0x4d40d4,null));};exports[_0x2120('0x38')]=function(_0x3d2298,_0x307087){var _0x3f4076={'raw':!![],'where':{'id':_0x3d2298['params']['id']}},_0x2ee741={};_0x2ee741[_0x2120('0x23')]=_[_0x2120('0x39')](db[_0x2120('0x33')][_0x2120('0x20')]);_0x2ee741[_0x2120('0x24')]=_[_0x2120('0x39')](_0x3d2298[_0x2120('0x24')]);_0x2ee741[_0x2120('0x25')]=_['intersection'](_0x2ee741['model'],_0x2ee741['query']);_0x3f4076[_0x2120('0x27')]=_[_0x2120('0x26')](_0x2ee741['model'],qs[_0x2120('0x28')](_0x3d2298[_0x2120('0x24')][_0x2120('0x28')]));_0x3f4076[_0x2120('0x27')]=_0x3f4076[_0x2120('0x27')][_0x2120('0x3a')]?_0x3f4076['attributes']:_0x2ee741['model'];if(_0x3d2298[_0x2120('0x24')][_0x2120('0x34')]){_0x3f4076['include']=[{'all':!![]}];}_0x3f4076=_[_0x2120('0x31')]({},_0x3f4076,_0x3d2298[_0x2120('0x32')]);return db[_0x2120('0x33')][_0x2120('0x3b')](_0x3f4076)[_0x2120('0x1b')](handleEntityNotFound(_0x307087,null))['then'](respondWithResult(_0x307087,null))[_0x2120('0x37')](handleError(_0x307087,null));};exports[_0x2120('0x3c')]=function(_0x270c82,_0x42c2c1){return db['WhatsappTransferReport'][_0x2120('0x3c')](_0x270c82['body'],{})['then'](respondWithResult(_0x42c2c1,0xc9))['catch'](handleError(_0x42c2c1,null));};exports[_0x2120('0x1a')]=function(_0x46e281,_0x160031){if(_0x46e281[_0x2120('0x3d')]['id']){delete _0x46e281[_0x2120('0x3d')]['id'];}return db[_0x2120('0x33')][_0x2120('0x3b')]({'where':{'id':_0x46e281['params']['id']}})[_0x2120('0x1b')](handleEntityNotFound(_0x160031,null))[_0x2120('0x1b')](saveUpdates(_0x46e281['body'],null))[_0x2120('0x1b')](respondWithResult(_0x160031,null))[_0x2120('0x37')](handleError(_0x160031,null));};exports[_0x2120('0x3e')]=function(_0x40bff6,_0x5380bd){return db[_0x2120('0x33')]['find']({'where':{'id':_0x40bff6[_0x2120('0x3f')]['id']}})[_0x2120('0x1b')](handleEntityNotFound(_0x5380bd,null))['then'](removeEntity(_0x5380bd,null))[_0x2120('0x37')](handleError(_0x5380bd,null));};exports[_0x2120('0x40')]=function(_0x33f7a4,_0x57bfc8){return db[_0x2120('0x33')][_0x2120('0x40')]()[_0x2120('0x1b')](respondWithResult(_0x57bfc8,null))[_0x2120('0x37')](handleError(_0x57bfc8,null));}; \ No newline at end of file +var _0x9ee8=['end','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','WhatsappTransferReport','find','create','update','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x396e61,_0x39d668){var _0x379151=function(_0x296c5f){while(--_0x296c5f){_0x396e61['push'](_0x396e61['shift']());}};_0x379151(++_0x39d668);}(_0x9ee8,0x100));var _0x89ee=function(_0x39b3b2,_0x32c265){_0x39b3b2=_0x39b3b2-0x0;var _0x1e0c72=_0x9ee8[_0x39b3b2];return _0x1e0c72;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x89ee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89ee('0x1'));var rp=require(_0x89ee('0x2'));var moment=require(_0x89ee('0x3'));var BPromise=require(_0x89ee('0x4'));var Mustache=require('mustache');var util=require(_0x89ee('0x5'));var path=require(_0x89ee('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x89ee('0x7'));var fs=require('fs');var _=require(_0x89ee('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x89ee('0x9'));var deskjs=require(_0x89ee('0xa'));var toCsv=require(_0x89ee('0xb'));var querystring=require(_0x89ee('0xc'));var Papa=require(_0x89ee('0xd'));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(_0x89ee('0xe'))(_0x89ee('0xf'));var utils=require(_0x89ee('0x10'));var config=require(_0x89ee('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3563e9,_0x1ad6b3){_0x1ad6b3=_0x1ad6b3||0xcc;return function(_0xd6f8ed){if(_0xd6f8ed){return _0x3563e9[_0x89ee('0x12')](_0x1ad6b3);}return _0x3563e9[_0x89ee('0x13')](_0x1ad6b3)[_0x89ee('0x14')]();};}function respondWithResult(_0x32b4ad,_0x25641a){_0x25641a=_0x25641a||0xc8;return function(_0x2b5a9c){if(_0x2b5a9c){return _0x32b4ad['status'](_0x25641a)['json'](_0x2b5a9c);}};}function respondWithFilteredResult(_0x5eb186,_0x501699){return function(_0x543683){if(_0x543683){var _0x175ca8=_0x543683[_0x89ee('0x15')],_0x16bac3=_0x501699[_0x89ee('0x16')],_0x1b7e26=_0x501699[_0x89ee('0x16')]+_0x501699[_0x89ee('0x17')],_0x2b01d7;if(_0x1b7e26>=_0x175ca8){_0x1b7e26=_0x175ca8;_0x2b01d7=0xc8;}else{_0x2b01d7=0xce;}_0x5eb186[_0x89ee('0x13')](_0x2b01d7);return _0x5eb186[_0x89ee('0x18')](_0x89ee('0x19'),_0x16bac3+'-'+_0x1b7e26+'/'+_0x175ca8)['json'](_0x543683);}return null;};}function patchUpdates(_0x2f21a6){return function(_0x208c3e){try{jsonpatch[_0x89ee('0x1a')](_0x208c3e,_0x2f21a6,!![]);}catch(_0x863719){return BPromise[_0x89ee('0x1b')](_0x863719);}return _0x208c3e[_0x89ee('0x1c')]();};}function saveUpdates(_0x110f54,_0x206131){return function(_0x23ff50){if(_0x23ff50){return _0x23ff50['update'](_0x110f54)[_0x89ee('0x1d')](function(_0x1f59b9){return _0x1f59b9;});}return null;};}function removeEntity(_0x4179cf,_0x5a27cd){return function(_0x572644){if(_0x572644){return _0x572644['destroy']()[_0x89ee('0x1d')](function(){_0x4179cf[_0x89ee('0x13')](0xcc)[_0x89ee('0x14')]();});}};}function handleEntityNotFound(_0x375787,_0x5943d3){return function(_0x2a54ae){if(!_0x2a54ae){_0x375787['sendStatus'](0x194);}return _0x2a54ae;};}function handleError(_0x5584d5,_0x294d36){_0x294d36=_0x294d36||0x1f4;return function(_0x5228f7){logger[_0x89ee('0x1e')](_0x5228f7[_0x89ee('0x1f')]);if(_0x5228f7[_0x89ee('0x20')]){delete _0x5228f7[_0x89ee('0x20')];}_0x5584d5[_0x89ee('0x13')](_0x294d36)[_0x89ee('0x21')](_0x5228f7);};}exports[_0x89ee('0x22')]=function(_0x51044f,_0x42c99d){var _0x3d2658={},_0xbb8fc9={},_0x1a1d7c={'count':0x0,'rows':[]};var _0x53f980=_[_0x89ee('0x23')](db['WhatsappTransferReport'][_0x89ee('0x24')],function(_0x2b85d9){return{'name':_0x2b85d9[_0x89ee('0x25')],'type':_0x2b85d9[_0x89ee('0x26')]['key']};});_0xbb8fc9[_0x89ee('0x27')]=_[_0x89ee('0x23')](_0x53f980,_0x89ee('0x20'));_0xbb8fc9['query']=_[_0x89ee('0x28')](_0x51044f[_0x89ee('0x29')]);_0xbb8fc9['filters']=_[_0x89ee('0x2a')](_0xbb8fc9[_0x89ee('0x27')],_0xbb8fc9['query']);_0x3d2658['attributes']=_['intersection'](_0xbb8fc9[_0x89ee('0x27')],qs[_0x89ee('0x2b')](_0x51044f[_0x89ee('0x29')][_0x89ee('0x2b')]));_0x3d2658[_0x89ee('0x2c')]=_0x3d2658[_0x89ee('0x2c')][_0x89ee('0x2d')]?_0x3d2658['attributes']:_0xbb8fc9[_0x89ee('0x27')];if(!_0x51044f[_0x89ee('0x29')][_0x89ee('0x2e')](_0x89ee('0x2f'))){_0x3d2658[_0x89ee('0x17')]=qs[_0x89ee('0x17')](_0x51044f[_0x89ee('0x29')][_0x89ee('0x17')]);_0x3d2658['offset']=qs['offset'](_0x51044f['query'][_0x89ee('0x16')]);}_0x3d2658[_0x89ee('0x30')]=qs[_0x89ee('0x31')](_0x51044f[_0x89ee('0x29')][_0x89ee('0x31')]);_0x3d2658[_0x89ee('0x32')]=qs[_0x89ee('0x33')](_[_0x89ee('0x34')](_0x51044f[_0x89ee('0x29')],_0xbb8fc9[_0x89ee('0x33')]),_0x53f980);if(_0x51044f[_0x89ee('0x29')][_0x89ee('0x35')]){_0x3d2658[_0x89ee('0x32')]=_[_0x89ee('0x36')](_0x3d2658['where'],{'$or':_[_0x89ee('0x23')](_0x53f980,function(_0x391104){if(_0x391104[_0x89ee('0x26')]!==_0x89ee('0x37')){var _0xb42dfd={};_0xb42dfd[_0x391104['name']]={'$like':'%'+_0x51044f[_0x89ee('0x29')]['filter']+'%'};return _0xb42dfd;}})});}_0x3d2658=_[_0x89ee('0x36')]({},_0x3d2658,_0x51044f[_0x89ee('0x38')]);var _0x3f9ac8={'where':_0x3d2658[_0x89ee('0x32')]};return db['WhatsappTransferReport'][_0x89ee('0x15')](_0x3f9ac8)[_0x89ee('0x1d')](function(_0x28e738){_0x1a1d7c[_0x89ee('0x15')]=_0x28e738;if(_0x51044f[_0x89ee('0x29')][_0x89ee('0x39')]){_0x3d2658[_0x89ee('0x3a')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x89ee('0x3b')](_0x3d2658);})[_0x89ee('0x1d')](function(_0x35dda8){_0x1a1d7c['rows']=_0x35dda8;return _0x1a1d7c;})[_0x89ee('0x1d')](respondWithFilteredResult(_0x42c99d,_0x3d2658))[_0x89ee('0x3c')](handleError(_0x42c99d,null));};exports['show']=function(_0x2700c9,_0x4b3a79){var _0xc5defb={'raw':!![],'where':{'id':_0x2700c9[_0x89ee('0x3d')]['id']}},_0x59fb07={};_0x59fb07[_0x89ee('0x27')]=_[_0x89ee('0x28')](db[_0x89ee('0x3e')][_0x89ee('0x24')]);_0x59fb07[_0x89ee('0x29')]=_[_0x89ee('0x28')](_0x2700c9[_0x89ee('0x29')]);_0x59fb07[_0x89ee('0x33')]=_[_0x89ee('0x2a')](_0x59fb07[_0x89ee('0x27')],_0x59fb07[_0x89ee('0x29')]);_0xc5defb['attributes']=_[_0x89ee('0x2a')](_0x59fb07['model'],qs[_0x89ee('0x2b')](_0x2700c9[_0x89ee('0x29')][_0x89ee('0x2b')]));_0xc5defb[_0x89ee('0x2c')]=_0xc5defb['attributes'][_0x89ee('0x2d')]?_0xc5defb[_0x89ee('0x2c')]:_0x59fb07[_0x89ee('0x27')];if(_0x2700c9[_0x89ee('0x29')][_0x89ee('0x39')]){_0xc5defb['include']=[{'all':!![]}];}_0xc5defb=_[_0x89ee('0x36')]({},_0xc5defb,_0x2700c9['options']);return db['WhatsappTransferReport'][_0x89ee('0x3f')](_0xc5defb)['then'](handleEntityNotFound(_0x4b3a79,null))['then'](respondWithResult(_0x4b3a79,null))['catch'](handleError(_0x4b3a79,null));};exports[_0x89ee('0x40')]=function(_0x476aa5,_0x39500f){return db['WhatsappTransferReport'][_0x89ee('0x40')](_0x476aa5['body'],{})[_0x89ee('0x1d')](respondWithResult(_0x39500f,0xc9))[_0x89ee('0x3c')](handleError(_0x39500f,null));};exports[_0x89ee('0x41')]=function(_0x2d5cc4,_0x594b06){if(_0x2d5cc4[_0x89ee('0x42')]['id']){delete _0x2d5cc4[_0x89ee('0x42')]['id'];}return db['WhatsappTransferReport'][_0x89ee('0x3f')]({'where':{'id':_0x2d5cc4[_0x89ee('0x3d')]['id']}})[_0x89ee('0x1d')](handleEntityNotFound(_0x594b06,null))[_0x89ee('0x1d')](saveUpdates(_0x2d5cc4[_0x89ee('0x42')],null))['then'](respondWithResult(_0x594b06,null))[_0x89ee('0x3c')](handleError(_0x594b06,null));};exports[_0x89ee('0x43')]=function(_0x4cbbc7,_0x17e836){return db['WhatsappTransferReport']['find']({'where':{'id':_0x4cbbc7[_0x89ee('0x3d')]['id']}})[_0x89ee('0x1d')](handleEntityNotFound(_0x17e836,null))[_0x89ee('0x1d')](removeEntity(_0x17e836,null))['catch'](handleError(_0x17e836,null));};exports[_0x89ee('0x44')]=function(_0x2169c9,_0x175cac){return db[_0x89ee('0x3e')][_0x89ee('0x44')]()['then'](respondWithResult(_0x175cac,null))[_0x89ee('0x3c')](handleError(_0x175cac,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a90e852..85923e6 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 _0x859c=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','../../config/logger','moment','bluebird','request-promise'];(function(_0x180fcb,_0x208b94){var _0x515f0d=function(_0x1be895){while(--_0x1be895){_0x180fcb['push'](_0x180fcb['shift']());}};_0x515f0d(++_0x208b94);}(_0x859c,0x1dc));var _0xc859=function(_0xfa4c9f,_0x1f4089){_0xfa4c9f=_0xfa4c9f-0x0;var _0x332662=_0x859c[_0xfa4c9f];return _0x332662;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc859('0x0'))('api');var moment=require(_0xc859('0x1'));var BPromise=require(_0xc859('0x2'));var rp=require(_0xc859('0x3'));var fs=require('fs');var path=require(_0xc859('0x4'));var rimraf=require(_0xc859('0x5'));var config=require(_0xc859('0x6'));var attributes=require(_0xc859('0x7'));module[_0xc859('0x8')]=function(_0xcb0a3a,_0x10b3f5){return _0xcb0a3a['define'](_0xc859('0x9'),attributes,{'tableName':_0xc859('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc859('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee15=['report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x434c21,_0x3d9d73){var _0x3e7db2=function(_0x4d08ee){while(--_0x4d08ee){_0x434c21['push'](_0x434c21['shift']());}};_0x3e7db2(++_0x3d9d73);}(_0xee15,0xfe));var _0x5ee1=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xee15[_0x209ec9];return _0x129b1b;};'use strict';var _=require('lodash');var util=require(_0x5ee1('0x0'));var logger=require(_0x5ee1('0x1'))(_0x5ee1('0x2'));var moment=require(_0x5ee1('0x3'));var BPromise=require(_0x5ee1('0x4'));var rp=require(_0x5ee1('0x5'));var fs=require('fs');var path=require(_0x5ee1('0x6'));var rimraf=require('rimraf');var config=require(_0x5ee1('0x7'));var attributes=require(_0x5ee1('0x8'));module[_0x5ee1('0x9')]=function(_0x42fb31,_0x5029bb){return _0x42fb31[_0x5ee1('0xa')](_0x5ee1('0xb'),attributes,{'tableName':_0x5ee1('0xc'),'paranoid':![],'indexes':[{'name':_0x5ee1('0xd'),'fields':[_0x5ee1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 9b98506..fc8e612 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(_0x434785,_0x47bad6){var _0x5b0a58=function(_0x436b56){while(--_0x436b56){_0x434785['push'](_0x434785['shift']());}};_0x5b0a58(++_0x47bad6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x5795b3,_0x281fcc){var _0x62d2d3=function(_0x5b673d){while(--_0x5b673d){_0x5795b3['push'](_0x5795b3['shift']());}};_0x62d2d3(++_0x281fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 4a60be4..b67f668 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bbc=['map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','./config/seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4bbc,0x1a2));var _0xc4bb=function(_0x36d416,_0x28beef){_0x36d416=_0x36d416-0x0;var _0x50d40d=_0x4bbc[_0x36d416];return _0x50d40d;};'use strict';var _=require(_0xc4bb('0x0'));var mysqldb=require(_0xc4bb('0x1'));var rpc=require(_0xc4bb('0x2'));var config=require(_0xc4bb('0x3'));var logger=require('./config/logger')(_0xc4bb('0x4'));var pm2=require(_0xc4bb('0x5'));var pm2Config=require(_0xc4bb('0x6'));var schedule=require(_0xc4bb('0x7'));var chat=require(_0xc4bb('0x8'));var transcribe=require(_0xc4bb('0x9'));function main(){return mysqldb['db']['sequelize'][_0xc4bb('0xa')]()[_0xc4bb('0xb')](function(){return rpc[_0xc4bb('0xc')]();})[_0xc4bb('0xb')](function(_0x30b867){logger[_0xc4bb('0xd')](_0x30b867);return chat['start']();})[_0xc4bb('0xb')](function(){return schedule[_0xc4bb('0xe')]();})[_0xc4bb('0xb')](function(){return transcribe['start']();})[_0xc4bb('0xb')](function(_0x1e7a63){logger[_0xc4bb('0xd')](_0x1e7a63);return pm2[_0xc4bb('0xe')](pm2Config);})['then'](function(_0x3f60f0){logger[_0xc4bb('0xd')](_0xc4bb('0xf'),_[_0xc4bb('0x10')](_[_0xc4bb('0x11')](_0x3f60f0,{'status':_0xc4bb('0x12')}),_0xc4bb('0x13'))[_0xc4bb('0x14')]());logger[_0xc4bb('0xd')](_0xc4bb('0x15'),_[_0xc4bb('0x10')](_[_0xc4bb('0x11')](_0x3f60f0,function(_0x3f6262){return _0x3f6262[_0xc4bb('0x16')]!=='online';}),'name')['join']()||_0xc4bb('0x17'));config[_0xc4bb('0x18')]&&require(_0xc4bb('0x19'))[_0xc4bb('0x1a')]();require(_0xc4bb('0x1b'))['default']();})['catch'](function(_0x510804){logger[_0xc4bb('0x1c')](_0xc4bb('0x1d'),_0x510804);process[_0xc4bb('0x1e')](0x1);});}main(); \ No newline at end of file +var _0xc19f=['./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','./config/seedDB','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb'];(function(_0x26f308,_0x1c833b){var _0x5af3e3=function(_0x89c274){while(--_0x89c274){_0x26f308['push'](_0x26f308['shift']());}};_0x5af3e3(++_0x1c833b);}(_0xc19f,0x194));var _0xfc19=function(_0x1b8d78,_0x8606df){_0x1b8d78=_0x1b8d78-0x0;var _0x44a515=_0xc19f[_0x1b8d78];return _0x44a515;};'use strict';var _=require(_0xfc19('0x0'));var mysqldb=require(_0xfc19('0x1'));var rpc=require('./rpc');var config=require(_0xfc19('0x2'));var logger=require('./config/logger')(_0xfc19('0x3'));var pm2=require(_0xfc19('0x4'));var pm2Config=require(_0xfc19('0x5'));var schedule=require(_0xfc19('0x6'));var chat=require(_0xfc19('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xfc19('0x8')][_0xfc19('0x9')]()[_0xfc19('0xa')](function(){return rpc[_0xfc19('0xb')]();})['then'](function(_0xd2f840){logger[_0xfc19('0xc')](_0xd2f840);return chat[_0xfc19('0xd')]();})[_0xfc19('0xa')](function(){return schedule['start']();})[_0xfc19('0xa')](function(){return transcribe[_0xfc19('0xd')]();})['then'](function(_0x10dfa3){logger['info'](_0x10dfa3);return pm2[_0xfc19('0xd')](pm2Config);})[_0xfc19('0xa')](function(_0x24a06f){logger['info'](_0xfc19('0xe'),_[_0xfc19('0xf')](_[_0xfc19('0x10')](_0x24a06f,{'status':_0xfc19('0x11')}),_0xfc19('0x12'))[_0xfc19('0x13')]());logger[_0xfc19('0xc')](_0xfc19('0x14'),_['map'](_[_0xfc19('0x10')](_0x24a06f,function(_0x51cd0d){return _0x51cd0d[_0xfc19('0x15')]!==_0xfc19('0x11');}),_0xfc19('0x12'))[_0xfc19('0x13')]()||_0xfc19('0x16'));config[_0xfc19('0x17')]&&require(_0xfc19('0x18'))['default']();require('./config/license')[_0xfc19('0x19')]();})['catch'](function(_0x49ce21){logger[_0xfc19('0x1a')](_0xfc19('0x1b'),_0x49ce21);process[_0xfc19('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 6a4dcf1..9b94a74 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 _0xe848=['motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','secret','payload','options','promisify','randomBytes','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','email','permissions','md5secret','voicePause','chatPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','closed','disposition','then','status','json','unmanaged','Unmanaged.','Forbidden.','catch','use','authorization','startsWith','headers','Basic','User','name','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','find','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xe848,0x132));var _0x8e84=function(_0x5e24f0,_0x183c97){_0x5e24f0=_0x5e24f0-0x0;var _0x5f1c74=_0xe848[_0x5e24f0];return _0x5f1c74;};'use strict';var db=require(_0x8e84('0x0'))['db'];var config=require(_0x8e84('0x1'));var hardwareConf=require(_0x8e84('0x2'));var _=require(_0x8e84('0x3'));var jwt=require(_0x8e84('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x8e84('0x5'));var basicAuth=require(_0x8e84('0x6'));var crypto=require(_0x8e84('0x7'));var BPromise=require(_0x8e84('0x8'));var validateJwt=expressJwt({'secret':config[_0x8e84('0x9')][_0x8e84('0xa')]});var userAttributes=['id',_0x8e84('0xb'),_0x8e84('0xc'),'name','internal',_0x8e84('0xd'),'userpic',_0x8e84('0xe'),_0x8e84('0xf'),_0x8e84('0x10'),_0x8e84('0x11'),'mailPause','faxPause','smsPause',_0x8e84('0x12'),'pauseType','showWebBar',_0x8e84('0x13'),_0x8e84('0x14'),_0x8e84('0x15'),_0x8e84('0x16'),_0x8e84('0x17'),'alias',_0x8e84('0x18'),_0x8e84('0x19'),_0x8e84('0x1a'),_0x8e84('0x1b'),_0x8e84('0x1c'),_0x8e84('0x1d'),_0x8e84('0x1e'),_0x8e84('0x1f'),'phoneBarRemoteControl',_0x8e84('0x20'),_0x8e84('0x21'),_0x8e84('0x22'),'userProfileId'];exports[_0x8e84('0x23')]=function(){return this[_0x8e84('0x24')](!![])['use'](function(_0x32115a,_0x2e288e,_0x2a4ec7){if(_0x32115a[_0x8e84('0x25')]){_0x2a4ec7();}else{return db[_0x8e84('0x26')]['findOne']({'where':{'id':_0x32115a[_0x8e84('0x27')]['id']},'attributes':['id',_0x8e84('0x28'),_0x8e84('0x29')],'raw':!![]})[_0x8e84('0x2a')](function(_0x5c7e52){if(_0x5c7e52&&_0x5c7e52[_0x8e84('0x28')]){return _0x2e288e[_0x8e84('0x2b')](_0x5c7e52[_0x8e84('0x29')]==='unmanaged'?0x195:0x193)[_0x8e84('0x2c')]({'message':_0x5c7e52[_0x8e84('0x29')]===_0x8e84('0x2d')?_0x8e84('0x2e'):_0x8e84('0x2f')});}else{_0x2a4ec7();}})[_0x8e84('0x30')](function(_0x5ed422){_0x2a4ec7(_0x5ed422);});}});};exports[_0x8e84('0x24')]=function isAuthenticated(_0x36dd29){return compose()[_0x8e84('0x31')](function(_0x23f7d3,_0x50f799,_0x38c5f1){if(_0x23f7d3['headers'][_0x8e84('0x32')]){if(_[_0x8e84('0x33')](_0x23f7d3[_0x8e84('0x34')][_0x8e84('0x32')],_0x8e84('0x35'))){var _0x766378=basicAuth(_0x23f7d3);db[_0x8e84('0x36')]['find']({'where':{'name':_0x766378[_0x8e84('0x37')]}})[_0x8e84('0x2a')](function(_0x2f7c4f){if(!_0x2f7c4f||!_0x2f7c4f[_0x8e84('0x38')](_0x766378[_0x8e84('0x39')])){return _0x50f799[_0x8e84('0x2b')](0x191)[_0x8e84('0x2c')]({'message':_0x8e84('0x3a')});}_0x23f7d3['user']={'id':_0x2f7c4f['id']};_0x38c5f1();})['catch'](function(_0x58376c){_0x38c5f1(_0x58376c);});}else if(_[_0x8e84('0x33')](_0x23f7d3[_0x8e84('0x34')][_0x8e84('0x32')],_0x8e84('0x3b'))){validateJwt(_0x23f7d3,_0x50f799,_0x38c5f1);}else{if(_0x36dd29){_0x38c5f1();}else{return _0x50f799['status'](0x193)[_0x8e84('0x2c')]({'message':_0x8e84('0x3c')});}}}else if(_0x23f7d3['query']['apikey']){try{var _0xcc9b5={'audience':hardwareConf[_0x8e84('0x3d')](),'issuer':hardwareConf[_0x8e84('0x3d')]()};verifyJwt(_0x23f7d3[_0x8e84('0x3e')][_0x8e84('0x3f')],_0xcc9b5)[_0x8e84('0x2a')](function(_0x110765){return db[_0x8e84('0x36')][_0x8e84('0x40')]({'where':{'id':_0x110765['sub']}})['then'](function(_0x2cc8e6){if(!_0x2cc8e6||!_['isEqual'](_0x2cc8e6[_0x8e84('0x41')],_0x110765['nonce'])){return _0x50f799[_0x8e84('0x2b')](0x191)[_0x8e84('0x2c')]({'message':_0x8e84('0x42')});}_0x23f7d3['user']={'id':_0x2cc8e6['id']};_0x38c5f1();});})[_0x8e84('0x30')](function(){return _0x50f799['status'](0x191)[_0x8e84('0x2c')]({'message':_0x8e84('0x43')});});}catch(_0x1c9d45){_0x38c5f1(_0x1c9d45);}}else if(_0x36dd29){_0x38c5f1();}else{return _0x50f799[_0x8e84('0x2b')](0x193)[_0x8e84('0x2c')]({'message':_0x8e84('0x3c')});}})[_0x8e84('0x31')](function(_0x4c27fd,_0x470568,_0x109e1e){if(_0x4c27fd['user']){db['User'][_0x8e84('0x40')]({'where':{'id':_0x4c27fd[_0x8e84('0x25')]['id']},'attributes':userAttributes})[_0x8e84('0x2a')](function(_0x371297){if(!_0x371297){return _0x470568[_0x8e84('0x2b')](0x194)[_0x8e84('0x2c')]({'message':_0x8e84('0x44')});}_0x4c27fd['user']=_0x371297;_0x109e1e();})[_0x8e84('0x30')](function(_0x228632){_0x109e1e(_0x228632);});}else if(_0x36dd29){_0x109e1e();}else{return _0x470568[_0x8e84('0x2b')](0x194)[_0x8e84('0x2c')]({'message':_0x8e84('0x45')});}});};exports[_0x8e84('0x46')]=function canUpdate(){return compose()[_0x8e84('0x31')](function(_0x32d94b,_0xec1e26,_0x21b063){return require(_0x8e84('0x47'))[_0x8e84('0x48')]()['then'](function(_0x247d59){if(_0x247d59[_0x8e84('0x49')]){_0x21b063();}else{return _0xec1e26[_0x8e84('0x2b')](0x193)[_0x8e84('0x2c')]({'message':_0x8e84('0x4a')});}})['catch'](function(_0x161324){_0x21b063(_0x161324);});});};exports[_0x8e84('0x4b')]=function(_0x1a343d,_0x590608,_0x280ab1){_0x1a343d[_0x8e84('0x4b')]=!![];return _0x280ab1();};exports['signToken']=function signToken(_0x23827c){return signJwt(_0x23827c);};exports['setTokenCookie']=function(_0x5de9de,_0x305aaa){if(!_0x5de9de[_0x8e84('0x25')]){return _0x305aaa[_0x8e84('0x2b')](0x194)['json']({'message':_0x8e84('0x4c')});}var _0x2a6f59={'payload':{'id':_0x5de9de[_0x8e84('0x25')]['id'],'role':_0x5de9de[_0x8e84('0x25')][_0x8e84('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2a6f59)[_0x8e84('0x2a')](function(_0x4905f4){_0x305aaa[_0x8e84('0x4d')](_0x8e84('0x4e'),_0x4905f4);_0x305aaa['redirect'](_0x8e84('0x4f'));})[_0x8e84('0x30')](function(_0x2772db){return _0x305aaa[_0x8e84('0x2b')](0x1f4)[_0x8e84('0x50')](_0x2772db);});};exports[_0x8e84('0x51')]=function(_0x535cbc){if(_[_0x8e84('0x52')](_0x535cbc['apiKeyNonce'])||_[_0x8e84('0x52')](_0x535cbc[_0x8e84('0x53')])){return null;}else{return createJwt(_0x535cbc);}};exports[_0x8e84('0x54')]=function(_0x3c233b){_0x3c233b[_0x8e84('0x41')]=generateNonce();_0x3c233b[_0x8e84('0x53')]=generateIssuedAt();return createJwt(_0x3c233b);};exports[_0x8e84('0x55')]=function(_0xe429ed,_0x49a5c9){var _0x193314=_0xe429ed[_0x8e84('0x3e')]['apikey'];if(_0x193314){var _0x2eef32={'nonce':_0x49a5c9[_0x8e84('0x41')],'iat':_0x49a5c9[_0x8e84('0x53')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x193314,_0x2eef32)['then'](function(){return generateApiKey(_0x49a5c9);});}else{throw{'message':_0x8e84('0x56')};}};function signJwt(_0xc27e72){var _0x5d2dea=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x5b8377=_0xc27e72[_0x8e84('0x57')]||config[_0x8e84('0x9')]['session'];return new BPromise(function(_0x45a1d4,_0x1bec8b){_0x5d2dea(_0xc27e72[_0x8e84('0x58')],_0x5b8377,_0xc27e72[_0x8e84('0x59')])[_0x8e84('0x2a')](function(_0x1f5f80){_0x45a1d4(_0x1f5f80);})[_0x8e84('0x30')](function(_0x274a6a){_0x1bec8b(_0x274a6a);});});}function verifyJwt(_0x19d785,_0x5e8e35,_0x4f550b){var _0xa00521=BPromise[_0x8e84('0x5a')](jwt['verify'],{'context':jwt});var _0xf8595f=_0x4f550b||config[_0x8e84('0x9')][_0x8e84('0xa')];return new BPromise(function(_0x7b5355,_0xfbe4c){_0xa00521(_0x19d785,_0xf8595f,_0x5e8e35)['then'](function(_0x1b4181){_0x7b5355(_0x1b4181);})['catch'](function(_0x39f9e0){_0xfbe4c(_0x39f9e0);});});}function generateNonce(){return crypto[_0x8e84('0x5b')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x8e84('0x5c')](Date[_0x8e84('0x5d')]()/0x3e8)[_0x8e84('0x5e')]();}function createJwt(_0x121a75){var _0x523332={'payload':{'iat':_0x121a75[_0x8e84('0x53')],'nonce':_0x121a75['apiKeyNonce']},'options':{'algorithm':_0x8e84('0x5f'),'subject':_0x121a75['id'][_0x8e84('0x5e')](),'issuer':hardwareConf[_0x8e84('0x3d')](),'audience':hardwareConf[_0x8e84('0x3d')]()}};return signJwt(_0x523332)[_0x8e84('0x2a')](function(_0x2b8acf){return{'iat':_0x121a75[_0x8e84('0x53')],'nonce':_0x121a75[_0x8e84('0x41')],'token':_0x2b8acf};});} \ No newline at end of file +var _0xf21a=['hotdesk','userProfileId','isAuthenticated','user','ChatInteraction','params','disposition','then','closed','status','unmanaged','Unmanaged.','catch','headers','startsWith','authorization','Basic','User','find','authenticate','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','use','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','basic-auth','bluebird','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort'];(function(_0x240dc5,_0x59d09f){var _0x75f0b1=function(_0x26777e){while(--_0x26777e){_0x240dc5['push'](_0x240dc5['shift']());}};_0x75f0b1(++_0x59d09f);}(_0xf21a,0xa0));var _0xaf21=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf21a[_0x19950b];return _0x3c6b41;};'use strict';var db=require(_0xaf21('0x0'))['db'];var config=require(_0xaf21('0x1'));var hardwareConf=require(_0xaf21('0x2'));var _=require(_0xaf21('0x3'));var jwt=require(_0xaf21('0x4'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xaf21('0x5'));var crypto=require('crypto');var BPromise=require(_0xaf21('0x6'));var validateJwt=expressJwt({'secret':config[_0xaf21('0x7')][_0xaf21('0x8')]});var userAttributes=['id',_0xaf21('0x9'),_0xaf21('0xa'),_0xaf21('0xb'),_0xaf21('0xc'),_0xaf21('0xd'),_0xaf21('0xe'),_0xaf21('0xf'),_0xaf21('0x10'),_0xaf21('0x11'),'chatPause',_0xaf21('0x12'),_0xaf21('0x13'),_0xaf21('0x14'),_0xaf21('0x15'),_0xaf21('0x16'),'showWebBar',_0xaf21('0x17'),_0xaf21('0x18'),_0xaf21('0x19'),_0xaf21('0x1a'),_0xaf21('0x1b'),_0xaf21('0x1c'),'phoneBarAutoAnswer',_0xaf21('0x1d'),_0xaf21('0x1e'),_0xaf21('0x1f'),_0xaf21('0x20'),_0xaf21('0x21'),_0xaf21('0x22'),_0xaf21('0x23'),_0xaf21('0x24'),_0xaf21('0x25'),_0xaf21('0x26'),'interface',_0xaf21('0x27')];exports['isChatInteractionAuthorized']=function(){return this[_0xaf21('0x28')](!![])['use'](function(_0x1c371a,_0x5caffc,_0x59e7c2){if(_0x1c371a[_0xaf21('0x29')]){_0x59e7c2();}else{return db[_0xaf21('0x2a')]['findOne']({'where':{'id':_0x1c371a[_0xaf21('0x2b')]['id']},'attributes':['id','closed',_0xaf21('0x2c')],'raw':!![]})[_0xaf21('0x2d')](function(_0x505fa0){if(_0x505fa0&&_0x505fa0[_0xaf21('0x2e')]){return _0x5caffc[_0xaf21('0x2f')](_0x505fa0['disposition']===_0xaf21('0x30')?0x195:0x193)['json']({'message':_0x505fa0['disposition']===_0xaf21('0x30')?_0xaf21('0x31'):'Forbidden.'});}else{_0x59e7c2();}})[_0xaf21('0x32')](function(_0x2eaadf){_0x59e7c2(_0x2eaadf);});}});};exports[_0xaf21('0x28')]=function isAuthenticated(_0x3d8b66){return compose()['use'](function(_0x9a145d,_0x573e71,_0x51aff1){if(_0x9a145d[_0xaf21('0x33')]['authorization']){if(_[_0xaf21('0x34')](_0x9a145d[_0xaf21('0x33')][_0xaf21('0x35')],_0xaf21('0x36'))){var _0x4ac546=basicAuth(_0x9a145d);db[_0xaf21('0x37')][_0xaf21('0x38')]({'where':{'name':_0x4ac546['name']}})[_0xaf21('0x2d')](function(_0x341985){if(!_0x341985||!_0x341985[_0xaf21('0x39')](_0x4ac546['pass'])){return _0x573e71[_0xaf21('0x2f')](0x191)[_0xaf21('0x3a')]({'message':_0xaf21('0x3b')});}_0x9a145d[_0xaf21('0x29')]={'id':_0x341985['id']};_0x51aff1();})[_0xaf21('0x32')](function(_0x382d04){_0x51aff1(_0x382d04);});}else if(_['startsWith'](_0x9a145d[_0xaf21('0x33')][_0xaf21('0x35')],_0xaf21('0x3c'))){validateJwt(_0x9a145d,_0x573e71,_0x51aff1);}else{if(_0x3d8b66){_0x51aff1();}else{return _0x573e71[_0xaf21('0x2f')](0x193)[_0xaf21('0x3a')]({'message':_0xaf21('0x3d')});}}}else if(_0x9a145d[_0xaf21('0x3e')][_0xaf21('0x3f')]){try{var _0x3337e8={'audience':hardwareConf[_0xaf21('0x40')](),'issuer':hardwareConf[_0xaf21('0x40')]()};verifyJwt(_0x9a145d[_0xaf21('0x3e')][_0xaf21('0x3f')],_0x3337e8)[_0xaf21('0x2d')](function(_0x4a745b){return db[_0xaf21('0x37')][_0xaf21('0x38')]({'where':{'id':_0x4a745b[_0xaf21('0x41')]}})[_0xaf21('0x2d')](function(_0x1c4a5f){if(!_0x1c4a5f||!_[_0xaf21('0x42')](_0x1c4a5f[_0xaf21('0x43')],_0x4a745b['nonce'])){return _0x573e71[_0xaf21('0x2f')](0x191)[_0xaf21('0x3a')]({'message':_0xaf21('0x44')});}_0x9a145d[_0xaf21('0x29')]={'id':_0x1c4a5f['id']};_0x51aff1();});})[_0xaf21('0x32')](function(){return _0x573e71[_0xaf21('0x2f')](0x191)[_0xaf21('0x3a')]({'message':_0xaf21('0x45')});});}catch(_0x341f2a){_0x51aff1(_0x341f2a);}}else if(_0x3d8b66){_0x51aff1();}else{return _0x573e71[_0xaf21('0x2f')](0x193)[_0xaf21('0x3a')]({'message':_0xaf21('0x3d')});}})[_0xaf21('0x46')](function(_0x53e259,_0x46326b,_0x2cf39){if(_0x53e259['user']){db[_0xaf21('0x37')]['find']({'where':{'id':_0x53e259['user']['id']},'attributes':userAttributes})[_0xaf21('0x2d')](function(_0x158423){if(!_0x158423){return _0x46326b['status'](0x194)[_0xaf21('0x3a')]({'message':'User\x20not\x20found.'});}_0x53e259['user']=_0x158423;_0x2cf39();})[_0xaf21('0x32')](function(_0x27125a){_0x2cf39(_0x27125a);});}else if(_0x3d8b66){_0x2cf39();}else{return _0x46326b[_0xaf21('0x2f')](0x194)[_0xaf21('0x3a')]({'message':_0xaf21('0x47')});}});};exports[_0xaf21('0x48')]=function canUpdate(){return compose()[_0xaf21('0x46')](function(_0x198015,_0x9c2f6b,_0x397230){return require('../../config/license/util')[_0xaf21('0x49')]()['then'](function(_0x23462c){if(_0x23462c['update']){_0x397230();}else{return _0x9c2f6b['status'](0x193)[_0xaf21('0x3a')]({'message':_0xaf21('0x4a')});}})['catch'](function(_0x2dbec4){_0x397230(_0x2dbec4);});});};exports['isMiddleware']=function(_0x21a8f0,_0x403151,_0x4b8837){_0x21a8f0[_0xaf21('0x4b')]=!![];return _0x4b8837();};exports[_0xaf21('0x4c')]=function signToken(_0x2a270b){return signJwt(_0x2a270b);};exports['setTokenCookie']=function(_0x204e22,_0x52bc96){if(!_0x204e22[_0xaf21('0x29')]){return _0x52bc96['status'](0x194)[_0xaf21('0x3a')]({'message':_0xaf21('0x4d')});}var _0x1c612f={'payload':{'id':_0x204e22['user']['id'],'role':_0x204e22[_0xaf21('0x29')][_0xaf21('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1c612f)['then'](function(_0x229c46){_0x52bc96[_0xaf21('0x4e')](_0xaf21('0x4f'),_0x229c46);_0x52bc96[_0xaf21('0x50')](_0xaf21('0x51'));})[_0xaf21('0x32')](function(_0x51fb44){return _0x52bc96[_0xaf21('0x2f')](0x1f4)[_0xaf21('0x52')](_0x51fb44);});};exports[_0xaf21('0x53')]=function(_0x95a708){if(_[_0xaf21('0x54')](_0x95a708[_0xaf21('0x43')])||_[_0xaf21('0x54')](_0x95a708[_0xaf21('0x55')])){return null;}else{return createJwt(_0x95a708);}};exports[_0xaf21('0x56')]=function(_0x48610d){_0x48610d[_0xaf21('0x43')]=generateNonce();_0x48610d[_0xaf21('0x55')]=generateIssuedAt();return createJwt(_0x48610d);};exports['regenerateApiKey']=function(_0x2bf0b7,_0x548c4c){var _0x595470=_0x2bf0b7[_0xaf21('0x3e')][_0xaf21('0x3f')];if(_0x595470){var _0x3ce994={'nonce':_0x548c4c[_0xaf21('0x43')],'iat':_0x548c4c[_0xaf21('0x55')],'audience':hardwareConf[_0xaf21('0x40')](),'issuer':hardwareConf[_0xaf21('0x40')]()};return verifyJwt(_0x595470,_0x3ce994)[_0xaf21('0x2d')](function(){return generateApiKey(_0x548c4c);});}else{throw{'message':_0xaf21('0x57')};}};function signJwt(_0x35e2d1){var _0x2d8e46=BPromise[_0xaf21('0x58')](jwt[_0xaf21('0x59')],{'context':jwt});var _0x350eed=_0x35e2d1[_0xaf21('0x5a')]||config[_0xaf21('0x7')][_0xaf21('0x8')];return new BPromise(function(_0x4ba0b0,_0x417b6f){_0x2d8e46(_0x35e2d1['payload'],_0x350eed,_0x35e2d1[_0xaf21('0x5b')])[_0xaf21('0x2d')](function(_0x4884a3){_0x4ba0b0(_0x4884a3);})['catch'](function(_0xded77e){_0x417b6f(_0xded77e);});});}function verifyJwt(_0x402c13,_0x50c316,_0x16bee5){var _0x458fef=BPromise[_0xaf21('0x58')](jwt[_0xaf21('0x5c')],{'context':jwt});var _0x192acb=_0x16bee5||config[_0xaf21('0x7')]['session'];return new BPromise(function(_0x4d3160,_0x39c4c6){_0x458fef(_0x402c13,_0x192acb,_0x50c316)['then'](function(_0x3cfdaa){_0x4d3160(_0x3cfdaa);})['catch'](function(_0x56da32){_0x39c4c6(_0x56da32);});});}function generateNonce(){return crypto[_0xaf21('0x5d')](0x10)[_0xaf21('0x5e')](_0xaf21('0x5f'));}function generateIssuedAt(){return Math[_0xaf21('0x60')](Date[_0xaf21('0x61')]()/0x3e8)['toString']();}function createJwt(_0x195bca){var _0x58791c={'payload':{'iat':_0x195bca['apiKeyIat'],'nonce':_0x195bca[_0xaf21('0x43')]},'options':{'algorithm':_0xaf21('0x62'),'subject':_0x195bca['id']['toString'](),'issuer':hardwareConf[_0xaf21('0x40')](),'audience':hardwareConf[_0xaf21('0x40')]()}};return signJwt(_0x58791c)[_0xaf21('0x2d')](function(_0x51023e){return{'iat':_0x195bca[_0xaf21('0x55')],'nonce':_0x195bca[_0xaf21('0x43')],'token':_0x51023e};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index af6f657..652a4a6 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(_0x532efe,_0x335c04){var _0x4bdcdd=function(_0x5a0e3b){while(--_0x5a0e3b){_0x532efe['push'](_0x532efe['shift']());}};_0x4bdcdd(++_0x335c04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 _0x70e0=['createDecipher','algorithm','data','close','unlink','crypto','bluebird','aes192','hasOwnProperty','createReadStream','createWriteStream','createCipher','update','binary','write','end','final'];(function(_0xcec8bd,_0x3d8a50){var _0x53e555=function(_0x1d0cab){while(--_0x1d0cab){_0xcec8bd['push'](_0xcec8bd['shift']());}};_0x53e555(++_0x3d8a50);}(_0x70e0,0x17b));var _0x070e=function(_0x566b8d,_0x233ea9){_0x566b8d=_0x566b8d-0x0;var _0x860aa1=_0x70e0[_0x566b8d];return _0x860aa1;};'use strict';var crypto=require(_0x070e('0x0'));var fs=require('fs');var BPromise=require(_0x070e('0x1'));var defaultOptions={'algorithm':_0x070e('0x2')};function combineOptions(_0x4d95bb){var _0x579b83={};for(var _0x16e651 in defaultOptions){if(defaultOptions[_0x070e('0x3')](_0x16e651)){_0x579b83[_0x16e651]=defaultOptions[_0x16e651];}}if(_0x4d95bb){for(var _0x277d32 in _0x4d95bb){if(_0x4d95bb[_0x070e('0x3')](_0x277d32)){_0x579b83[_0x277d32]=_0x4d95bb[_0x277d32];}}}return _0x579b83;}exports['encryptFile']=function(_0x7bce9b,_0x579a6b,_0x46fe68,_0x4b041d){return new BPromise(function(_0x56e420,_0x5032e5){_0x4b041d=combineOptions(_0x4b041d);var _0x35ab0c=new Buffer(_0x46fe68);var _0x1e11f0=fs[_0x070e('0x4')](_0x7bce9b);var _0x2611e6=fs[_0x070e('0x5')](_0x579a6b);var _0x68a09e=crypto[_0x070e('0x6')](_0x4b041d['algorithm'],_0x35ab0c);_0x1e11f0['on']('data',function(_0x50f4eb){var _0x2e3e5e=new Buffer(_0x68a09e[_0x070e('0x7')](_0x50f4eb),_0x070e('0x8'));_0x2611e6[_0x070e('0x9')](_0x2e3e5e);});_0x1e11f0['on'](_0x070e('0xa'),function(){try{var _0x25cfe1=new Buffer(_0x68a09e[_0x070e('0xb')](_0x070e('0x8')),_0x070e('0x8'));_0x2611e6[_0x070e('0x9')](_0x25cfe1);_0x2611e6['end']();_0x2611e6['on']('close',function(){return _0x56e420(_0x579a6b);});}catch(_0x24baba){fs['unlink'](_0x579a6b);return _0x5032e5(_0x24baba);}});});};exports['decryptFile']=function(_0x5bae0f,_0x11d2ce,_0x14c3fd,_0x51d14d){return new BPromise(function(_0x5d3a38,_0x373d86){_0x51d14d=combineOptions(_0x51d14d);var _0xeae1a5=new Buffer(_0x14c3fd);var _0x180897=fs[_0x070e('0x4')](_0x5bae0f);var _0x5bc71e=fs['createWriteStream'](_0x11d2ce);var _0x17e2e4=crypto[_0x070e('0xc')](_0x51d14d[_0x070e('0xd')],_0xeae1a5);_0x180897['on'](_0x070e('0xe'),function(_0x364b3f){var _0x5037eb=new Buffer(_0x17e2e4[_0x070e('0x7')](_0x364b3f),_0x070e('0x8'));_0x5bc71e[_0x070e('0x9')](_0x5037eb);});_0x180897['on'](_0x070e('0xa'),function(){try{var _0x259893=new Buffer(_0x17e2e4['final']('binary'),'binary');_0x5bc71e[_0x070e('0x9')](_0x259893);_0x5bc71e[_0x070e('0xa')]();_0x5bc71e['on'](_0x070e('0xf'),function(){return _0x5d3a38(_0x11d2ce);});}catch(_0x4be0d7){fs[_0x070e('0x10')](_0x11d2ce);return _0x373d86(_0x4be0d7);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b0a7ad2..0febf48 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 _0x750a=['%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync','join','mkdirSync','each','length','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Setting','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty'];(function(_0x5185c6,_0x4e7c65){var _0x1a9c19=function(_0x4b882b){while(--_0x4b882b){_0x5185c6['push'](_0x5185c6['shift']());}};_0x1a9c19(++_0x4e7c65);}(_0x750a,0x140));var _0xa750=function(_0x1b4eac,_0x4a878b){_0x1b4eac=_0x1b4eac-0x0;var _0x42955e=_0x750a[_0x1b4eac];return _0x42955e;};'use strict';var util=require('util');var path=require(_0xa750('0x0'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa750('0x1'));var zipdir=require(_0xa750('0x2'));var rimraf=require(_0xa750('0x3'));var db=require(_0xa750('0x4'))['db'];var dbH=require(_0xa750('0x4'))[_0xa750('0x5')];var logger=require(_0xa750('0x6'))(_0xa750('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xa750('0x8')][0x2]);var QUERY=process[_0xa750('0x8')][0x3];var PATH=process[_0xa750('0x8')][0x4];function analyticExtractedReport(_0x1ae455,_0x3d7c43){var _0x47a4dd={'status':_0x1ae455};var _0x53f2cb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d7c43){_0x47a4dd[_0xa750('0x9')]=_0x3d7c43;}return db['AnalyticExtractedReport'][_0xa750('0xa')](_0x47a4dd,_0x53f2cb);}function main(){var _0x1760f5=0x1388;var _0x51f594;logger[_0xa750('0xb')](util[_0xa750('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xa750('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa750('0xe'),_0xa750('0xf')]})['then'](function(_0x24ec62){if(_0x24ec62){_0x51f594=_0x24ec62;_0x1760f5=_0x51f594[_0xa750('0xf')]||0x1388;}})[_0xa750('0x10')](function(){return dbH['sequelize'][_0xa750('0x11')](util[_0xa750('0xc')](_0xa750('0x12'),QUERY),{'type':dbH[_0xa750('0x13')][_0xa750('0x14')][_0xa750('0x15')]});})['then'](function(_0x3ae2a1){if(!_0x3ae2a1[0x0][_0xa750('0x16')]){return analyticExtractedReport(_0xa750('0x17'));}var _0x49fe3b=[];var _0x337095=0x0;var _0x29480c=!![];if(_0x3ae2a1&&_0x3ae2a1['length']){var _0x4afb05=_0x3ae2a1[0x0][_0xa750('0x16')]%(_0x337095+_0x1760f5);if(_0x51f594['split']){for(;_0x29480c;_0x337095+=_0x1760f5,_0x4afb05=_0x3ae2a1[0x0][_0xa750('0x16')]%(_0x337095+_0x1760f5)){if(_0x4afb05==0x0||_0x4afb05==_0x3ae2a1[0x0][_0xa750('0x16')]){_0x29480c=![];}_0x49fe3b['push'](dbH[_0xa750('0x13')]['query'](util['format'](_0xa750('0x18'),QUERY,_0x1760f5,_0x337095),{'type':dbH['sequelize'][_0xa750('0x14')]['SELECT']}));}}else{_0x49fe3b[_0xa750('0x19')](dbH['sequelize'][_0xa750('0x11')](QUERY,{'type':dbH['sequelize'][_0xa750('0x14')]['SELECT']}));}}var _0x52f166=path[_0xa750('0x1a')](PATH);var _0x52da84=path[_0xa750('0x1b')](PATH,'.csv');var _0x5c7203=_0x51f594['split']&&_0x49fe3b['length']>0x1;var _0x15d72f=[];if(!fs[_0xa750('0x1c')](path[_0xa750('0x1d')](_0x52f166,_0x52da84))&&_0x5c7203){fs[_0xa750('0x1e')](path[_0xa750('0x1d')](_0x52f166,_0x52da84));}return BPromise[_0xa750('0x1f')](_0x49fe3b,function(_0x3001bc){_0x15d72f[_0xa750('0x19')](_0x3001bc);})[_0xa750('0x10')](function(){for(var _0x94697a=0x0;_0x94697a<_0x15d72f[_0xa750('0x20')];_0x94697a+=0x1){var _0x27a5eb;var _0x31ea63=_0x15d72f[_0x94697a];if(_0x5c7203){_0x27a5eb=path[_0xa750('0x1d')](_0x52f166,_0x52da84,util[_0xa750('0xc')]('%s%d.%s',_0x52da84,_0x94697a,_0xa750('0x21')));}else{_0x27a5eb=path[_0xa750('0x1d')](_0x52f166,util[_0xa750('0xc')]('%s.%s',_0x52da84,_0xa750('0x21')));}fs[_0xa750('0x22')](_0x27a5eb,csv(_0x31ea63));}})[_0xa750('0x10')](function(){if(_0x5c7203){zipdir(path[_0xa750('0x1d')](_0x52f166,_0x52da84),{'saveTo':path['join'](_0x52f166,util[_0xa750('0xc')](_0xa750('0x23'),_0x52da84,_0xa750('0x24')))},function(_0x2aef3a,_0x2c5253){});rimraf(path['join'](_0x52f166,_0x52da84),function(){});}})[_0xa750('0x10')](function(){logger['info'](util[_0xa750('0xc')](_0xa750('0x25'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xa750('0x26'),_0x5c7203?util[_0xa750('0xc')](_0xa750('0x23'),_0x52da84,_0x5c7203?_0xa750('0x24'):_0xa750('0x21')):null);});})[_0xa750('0x27')](function(_0x31066b){logger[_0xa750('0xb')](util['format'](_0xa750('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0xa750('0x29')](_0x31066b,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa750('0x2a'));});}main(); \ No newline at end of file +var _0xaa88=['join','each','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','query','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','dirname','basename','existsSync','mkdirSync'];(function(_0x3237d5,_0xe45965){var _0x38e1a5=function(_0x586a8f){while(--_0x586a8f){_0x3237d5['push'](_0x3237d5['shift']());}};_0x38e1a5(++_0xe45965);}(_0xaa88,0x137));var _0x8aa8=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xaa88[_0x369151];return _0x4292d5;};'use strict';var util=require(_0x8aa8('0x0'));var path=require(_0x8aa8('0x1'));var _=require(_0x8aa8('0x2'));var csv=require(_0x8aa8('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8aa8('0x4'));var rimraf=require(_0x8aa8('0x5'));var db=require(_0x8aa8('0x6'))['db'];var dbH=require(_0x8aa8('0x6'))[_0x8aa8('0x7')];var logger=require(_0x8aa8('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8aa8('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x449d2d,_0x1ed84d){var _0x27c08d={'status':_0x449d2d};var _0x40826f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ed84d){_0x27c08d['savename']=_0x1ed84d;}return db[_0x8aa8('0xa')][_0x8aa8('0xb')](_0x27c08d,_0x40826f);}function main(){var _0x224f25=0x1388;var _0x5c94d4;logger[_0x8aa8('0xc')](util[_0x8aa8('0xd')](_0x8aa8('0xe'),EXTRACTED_REPORT_ID,_0x8aa8('0xf')));return db['Setting'][_0x8aa8('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8aa8('0x11'),'splitSizeCsv']})[_0x8aa8('0x12')](function(_0xa691d6){if(_0xa691d6){_0x5c94d4=_0xa691d6;_0x224f25=_0x5c94d4[_0x8aa8('0x13')]||0x1388;}})['then'](function(){return dbH[_0x8aa8('0x14')][_0x8aa8('0x15')](util[_0x8aa8('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x8aa8('0x14')]['QueryTypes']['SELECT']});})[_0x8aa8('0x12')](function(_0x200662){if(!_0x200662[0x0][_0x8aa8('0x16')]){return analyticExtractedReport(_0x8aa8('0x17'));}var _0x42a6a4=[];var _0x3778f4=0x0;var _0x1bdd39=!![];if(_0x200662&&_0x200662[_0x8aa8('0x18')]){var _0x20d303=_0x200662[0x0]['num']%(_0x3778f4+_0x224f25);if(_0x5c94d4['split']){for(;_0x1bdd39;_0x3778f4+=_0x224f25,_0x20d303=_0x200662[0x0][_0x8aa8('0x16')]%(_0x3778f4+_0x224f25)){if(_0x20d303==0x0||_0x20d303==_0x200662[0x0]['num']){_0x1bdd39=![];}_0x42a6a4['push'](dbH[_0x8aa8('0x14')]['query'](util[_0x8aa8('0xd')](_0x8aa8('0x19'),QUERY,_0x224f25,_0x3778f4),{'type':dbH[_0x8aa8('0x14')][_0x8aa8('0x1a')]['SELECT']}));}}else{_0x42a6a4[_0x8aa8('0x1b')](dbH[_0x8aa8('0x14')][_0x8aa8('0x15')](QUERY,{'type':dbH[_0x8aa8('0x14')][_0x8aa8('0x1a')][_0x8aa8('0x1c')]}));}}var _0x5d9b62=path[_0x8aa8('0x1d')](PATH);var _0x4cc455=path[_0x8aa8('0x1e')](PATH,'.csv');var _0x2c1828=_0x5c94d4['split']&&_0x42a6a4[_0x8aa8('0x18')]>0x1;var _0x40adb5=[];if(!fs[_0x8aa8('0x1f')](path['join'](_0x5d9b62,_0x4cc455))&&_0x2c1828){fs[_0x8aa8('0x20')](path[_0x8aa8('0x21')](_0x5d9b62,_0x4cc455));}return BPromise[_0x8aa8('0x22')](_0x42a6a4,function(_0x547a7b){_0x40adb5['push'](_0x547a7b);})[_0x8aa8('0x12')](function(){for(var _0x44e2d8=0x0;_0x44e2d8<_0x40adb5[_0x8aa8('0x18')];_0x44e2d8+=0x1){var _0x3a3c7a;var _0x24143e=_0x40adb5[_0x44e2d8];if(_0x2c1828){_0x3a3c7a=path['join'](_0x5d9b62,_0x4cc455,util[_0x8aa8('0xd')]('%s%d.%s',_0x4cc455,_0x44e2d8,_0x8aa8('0x23')));}else{_0x3a3c7a=path[_0x8aa8('0x21')](_0x5d9b62,util[_0x8aa8('0xd')]('%s.%s',_0x4cc455,'csv'));}fs[_0x8aa8('0x24')](_0x3a3c7a,csv(_0x24143e));}})['then'](function(){if(_0x2c1828){zipdir(path[_0x8aa8('0x21')](_0x5d9b62,_0x4cc455),{'saveTo':path[_0x8aa8('0x21')](_0x5d9b62,util[_0x8aa8('0xd')](_0x8aa8('0x25'),_0x4cc455,_0x8aa8('0x26')))},function(_0x4d5c2e,_0x267f4c){});rimraf(path[_0x8aa8('0x21')](_0x5d9b62,_0x4cc455),function(){});}})['then'](function(){logger[_0x8aa8('0xc')](util[_0x8aa8('0xd')](_0x8aa8('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x8aa8('0x28'),_0x2c1828?util[_0x8aa8('0xd')](_0x8aa8('0x25'),_0x4cc455,_0x2c1828?_0x8aa8('0x26'):_0x8aa8('0x23')):null);});})[_0x8aa8('0x29')](function(_0x370401){logger[_0x8aa8('0xc')](util[_0x8aa8('0xd')](_0x8aa8('0x2a'),EXTRACTED_REPORT_ID,_0x8aa8('0xf')),util['inspect'](_0x370401,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e933dbc..69a3066 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 _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x3130e3,_0x52d2e1){var _0x12fe62=function(_0x24d25c){while(--_0x24d25c){_0x3130e3['push'](_0x3130e3['shift']());}};_0x12fe62(++_0x52d2e1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29539d,_0x25c623){_0x29539d=_0x29539d-0x0;var _0x18e169=_0x5f2f[_0x29539d];return _0x18e169;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x4e8cad,_0x4e8c9c){var _0x1bf7b6=function(_0x3ae71d){while(--_0x3ae71d){_0x4e8cad['push'](_0x4e8cad['shift']());}};_0x1bf7b6(++_0x4e8c9c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4821b8a..fd4844e 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 _0x5d95=['update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','split','length','push','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','then','xlsx','%s.%s','writeFileSync','binary','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv'];(function(_0x149392,_0x371bb7){var _0x151c35=function(_0x56d39f){while(--_0x56d39f){_0x149392['push'](_0x149392['shift']());}};_0x151c35(++_0x371bb7);}(_0x5d95,0x184));var _0x55d9=function(_0x32e0d8,_0x335f4a){_0x32e0d8=_0x32e0d8-0x0;var _0x1a3f65=_0x5d95[_0x32e0d8];return _0x1a3f65;};'use strict';var util=require('util');var path=require('path');var _=require(_0x55d9('0x0'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x55d9('0x1'));var zipdir=require(_0x55d9('0x2'));var rimraf=require(_0x55d9('0x3'));var db=require(_0x55d9('0x4'))['db'];var dbH=require(_0x55d9('0x4'))[_0x55d9('0x5')];var logger=require('../../config/logger')(_0x55d9('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x55d9('0x7')][0x3];var PATH=process[_0x55d9('0x7')][0x4];function analyticExtractedReport(_0x3d7929,_0x46b27e){var _0x43ef1f={'status':_0x3d7929};var _0x5a1dde={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x46b27e){_0x43ef1f['savename']=_0x46b27e;}return db['AnalyticExtractedReport'][_0x55d9('0x8')](_0x43ef1f,_0x5a1dde);}function main(){var _0x2c90ba=0x1388;var _0x206b96;logger['info'](util[_0x55d9('0x9')](_0x55d9('0xa'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x55d9('0xb')][_0x55d9('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x55d9('0xd')]})['then'](function(_0x3131a9){if(_0x3131a9){_0x206b96=_0x3131a9;_0x2c90ba=_0x206b96[_0x55d9('0xd')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x55d9('0xe')](util[_0x55d9('0x9')](_0x55d9('0xf'),QUERY),{'type':dbH[_0x55d9('0x10')][_0x55d9('0x11')]['SELECT']});})['then'](function(_0x4fe106){if(!_0x4fe106[0x0][_0x55d9('0x12')]){return analyticExtractedReport(_0x55d9('0x13'));}var _0x8dab84=[];var _0x12fa95=0x0;var _0x8df32c=!![];if(_0x206b96[_0x55d9('0x14')]){if(_0x4fe106&&_0x4fe106[_0x55d9('0x15')]){var _0x597957=_0x4fe106[0x0]['num']%(_0x12fa95+_0x2c90ba);for(;_0x8df32c;_0x12fa95+=_0x2c90ba,_0x597957=_0x4fe106[0x0][_0x55d9('0x12')]%(_0x12fa95+_0x2c90ba)){if(_0x597957==0x0||_0x597957==_0x4fe106[0x0][_0x55d9('0x12')]){_0x8df32c=![];}_0x8dab84[_0x55d9('0x16')](dbH[_0x55d9('0x10')][_0x55d9('0xe')](util[_0x55d9('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2c90ba,_0x12fa95),{'type':dbH[_0x55d9('0x10')][_0x55d9('0x11')][_0x55d9('0x17')]}));}}}else{_0x8dab84['push'](dbH[_0x55d9('0x10')][_0x55d9('0xe')](QUERY,{'type':dbH[_0x55d9('0x10')]['QueryTypes'][_0x55d9('0x17')]}));}var _0x3e7361=path[_0x55d9('0x18')](PATH);var _0x1b5676=path[_0x55d9('0x19')](PATH,_0x55d9('0x1a'));var _0x1c28ff=_0x206b96['split']&&_0x8dab84['length']>0x1;var _0x5e6143=[];if(!fs[_0x55d9('0x1b')](path[_0x55d9('0x1c')](_0x3e7361,_0x1b5676))&&_0x1c28ff){fs[_0x55d9('0x1d')](path[_0x55d9('0x1c')](_0x3e7361,_0x1b5676));}return BPromise[_0x55d9('0x1e')](_0x8dab84,function(_0x280643){_0x5e6143[_0x55d9('0x16')](_0x280643);})[_0x55d9('0x1f')](function(){for(var _0x2b7166=0x0;_0x2b7166<_0x5e6143['length'];_0x2b7166+=0x1){var _0x41ac43;var _0x440eda=_0x5e6143[_0x2b7166];if(_0x1c28ff){_0x41ac43=path[_0x55d9('0x1c')](_0x3e7361,_0x1b5676,util[_0x55d9('0x9')]('%s%d.%s',_0x1b5676,_0x2b7166,_0x55d9('0x20')));}else{_0x41ac43=path[_0x55d9('0x1c')](_0x3e7361,util[_0x55d9('0x9')](_0x55d9('0x21'),_0x1b5676,_0x55d9('0x20')));}fs[_0x55d9('0x22')](_0x41ac43,json2xls(_0x440eda),_0x55d9('0x23'));}})['then'](function(){if(_0x1c28ff){zipdir(path['join'](_0x3e7361,_0x1b5676),{'saveTo':path[_0x55d9('0x1c')](_0x3e7361,util[_0x55d9('0x9')]('%s.%s',_0x1b5676,'zip'))},function(_0x55008b,_0x53c42e){});rimraf(path['join'](_0x3e7361,_0x1b5676),function(){});}})['then'](function(){logger[_0x55d9('0x24')](util[_0x55d9('0x9')](_0x55d9('0x25'),EXTRACTED_REPORT_ID,_0x55d9('0x26')));return analyticExtractedReport('Completed',_0x1c28ff?util[_0x55d9('0x9')](_0x55d9('0x21'),_0x1b5676,_0x1c28ff?_0x55d9('0x27'):_0x55d9('0x20')):null);});})[_0x55d9('0x28')](function(_0xb7cf1){logger[_0x55d9('0x24')](util['format'](_0x55d9('0x29'),EXTRACTED_REPORT_ID,_0x55d9('0x26')),util[_0x55d9('0x2a')](_0xb7cf1,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x55d9('0x2b'));});}main(); \ No newline at end of file +var _0x58d5=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT','num','length','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x58d5,0x107));var _0x558d=function(_0x37e796,_0x24784e){_0x37e796=_0x37e796-0x0;var _0x287054=_0x58d5[_0x37e796];return _0x287054;};'use strict';var util=require(_0x558d('0x0'));var path=require(_0x558d('0x1'));var _=require(_0x558d('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x558d('0x3'));var zipdir=require(_0x558d('0x4'));var rimraf=require(_0x558d('0x5'));var db=require(_0x558d('0x6'))['db'];var dbH=require('../../mysqldb')[_0x558d('0x7')];var logger=require(_0x558d('0x8'))(_0x558d('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x8498a8,_0x4946de){var _0x4e478e={'status':_0x8498a8};var _0x14b004={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4946de){_0x4e478e['savename']=_0x4946de;}return db[_0x558d('0xa')][_0x558d('0xb')](_0x4e478e,_0x14b004);}function main(){var _0x5d9b38=0x1388;var _0x38abb5;logger[_0x558d('0xc')](util['format'](_0x558d('0xd'),EXTRACTED_REPORT_ID,_0x558d('0xe')));return db['Setting'][_0x558d('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x558d('0x10'),'splitSizeXlsx']})['then'](function(_0x28164c){if(_0x28164c){_0x38abb5=_0x28164c;_0x5d9b38=_0x38abb5[_0x558d('0x11')]||0x1388;}})[_0x558d('0x12')](function(){return dbH['sequelize'][_0x558d('0x13')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x558d('0x14')][_0x558d('0x15')][_0x558d('0x16')]});})[_0x558d('0x12')](function(_0x263ccc){if(!_0x263ccc[0x0][_0x558d('0x17')]){return analyticExtractedReport('Empty');}var _0x4f35da=[];var _0x1dc524=0x0;var _0x29dacd=!![];if(_0x38abb5[_0x558d('0x10')]){if(_0x263ccc&&_0x263ccc[_0x558d('0x18')]){var _0x455f35=_0x263ccc[0x0][_0x558d('0x17')]%(_0x1dc524+_0x5d9b38);for(;_0x29dacd;_0x1dc524+=_0x5d9b38,_0x455f35=_0x263ccc[0x0][_0x558d('0x17')]%(_0x1dc524+_0x5d9b38)){if(_0x455f35==0x0||_0x455f35==_0x263ccc[0x0][_0x558d('0x17')]){_0x29dacd=![];}_0x4f35da[_0x558d('0x19')](dbH[_0x558d('0x14')]['query'](util[_0x558d('0x1a')](_0x558d('0x1b'),QUERY,_0x5d9b38,_0x1dc524),{'type':dbH['sequelize'][_0x558d('0x15')]['SELECT']}));}}}else{_0x4f35da['push'](dbH[_0x558d('0x14')][_0x558d('0x13')](QUERY,{'type':dbH['sequelize'][_0x558d('0x15')][_0x558d('0x16')]}));}var _0x443b0a=path[_0x558d('0x1c')](PATH);var _0x50b3ad=path['basename'](PATH,_0x558d('0x1d'));var _0x40788c=_0x38abb5[_0x558d('0x10')]&&_0x4f35da['length']>0x1;var _0x854cfa=[];if(!fs[_0x558d('0x1e')](path[_0x558d('0x1f')](_0x443b0a,_0x50b3ad))&&_0x40788c){fs[_0x558d('0x20')](path[_0x558d('0x1f')](_0x443b0a,_0x50b3ad));}return BPromise[_0x558d('0x21')](_0x4f35da,function(_0x9f1f63){_0x854cfa['push'](_0x9f1f63);})[_0x558d('0x12')](function(){for(var _0x3f7dd7=0x0;_0x3f7dd7<_0x854cfa[_0x558d('0x18')];_0x3f7dd7+=0x1){var _0x5255ac;var _0x1c8a42=_0x854cfa[_0x3f7dd7];if(_0x40788c){_0x5255ac=path['join'](_0x443b0a,_0x50b3ad,util[_0x558d('0x1a')](_0x558d('0x22'),_0x50b3ad,_0x3f7dd7,'xlsx'));}else{_0x5255ac=path['join'](_0x443b0a,util[_0x558d('0x1a')](_0x558d('0x23'),_0x50b3ad,_0x558d('0x24')));}fs[_0x558d('0x25')](_0x5255ac,json2xls(_0x1c8a42),'binary');}})[_0x558d('0x12')](function(){if(_0x40788c){zipdir(path['join'](_0x443b0a,_0x50b3ad),{'saveTo':path[_0x558d('0x1f')](_0x443b0a,util['format']('%s.%s',_0x50b3ad,'zip'))},function(_0x3f5366,_0x7c9110){});rimraf(path[_0x558d('0x1f')](_0x443b0a,_0x50b3ad),function(){});}})[_0x558d('0x12')](function(){logger[_0x558d('0xc')](util['format'](_0x558d('0x26'),EXTRACTED_REPORT_ID,_0x558d('0xe')));return analyticExtractedReport(_0x558d('0x27'),_0x40788c?util['format'](_0x558d('0x23'),_0x50b3ad,_0x40788c?_0x558d('0x28'):_0x558d('0x24')):null);});})['catch'](function(_0x1a5d06){logger[_0x558d('0xc')](util['format'](_0x558d('0x29'),EXTRACTED_REPORT_ID,_0x558d('0xe')),util['inspect'](_0x1a5d06,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x558d('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 1421673..7d19173 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 _0x35fc=['priority','push','Set','format','CDR(type)=%s','type','VoiceExtensionId','extensions','CDR(destination)=','extension','cutdigits','${EXTEN:','context','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','sortBy','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','filter','groupBy','exten','queue','playback','hasOwnProperty'];(function(_0x5b4021,_0xacd23c){var _0x36eee5=function(_0x4ae2bb){while(--_0x4ae2bb){_0x5b4021['push'](_0x5b4021['shift']());}};_0x36eee5(++_0xacd23c);}(_0x35fc,0x7f));var _0xc35f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x35fc[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc35f('0x0'));var util=require(_0xc35f('0x1'));function rewrite(_0x5c500e,_0x251306){var _0x2cf060=this;return _0x5c500e[_0xc35f('0x2')][_0xc35f('0x3')][_0xc35f('0x4')]({'raw':!![]})[_0xc35f('0x5')](function(_0x3a3479){_0x2cf060[_0xc35f('0x6')]=_0x3a3479;return _0x5c500e[_0xc35f('0x2')][_0xc35f('0x7')][_0xc35f('0x4')]({'where':{'IntervalId':_0x251306['IntervalId']},'raw':!![]});})['then'](function(_0x17a26d){return _0x5c500e[_0xc35f('0x2')][_0xc35f('0x7')][_0xc35f('0x4')]({'where':{'exten':{'$in':_[_0xc35f('0x8')](_['map'](_0x17a26d,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xc35f('0x5')](function(_0x58332b){var _0x538d7b=_[_0xc35f('0x9')](_0x58332b,{'priority':'1'});var _0x54e65a=_['filter'](_0x58332b,{'isApp':0x1});var _0x9de20c=_[_0xc35f('0xa')](_0x54e65a,_0xc35f('0xb'));var _0x1a7e04=[_0xc35f('0xc'),_0xc35f('0xd')];var _0x4d769d=[];var _0x258278=[];for(var _0x286983 in _0x9de20c){if(_0x9de20c[_0xc35f('0xe')](_0x286983)){_0x2cf060[_0xc35f('0xf')]=0x2;_0x2cf060['extensions']=[];_0x2cf060['extension']=_['find'](_0x538d7b,{'exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')]});_0x2cf060['extensions'][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0]['type'],'app':_0xc35f('0x11'),'appdata':util[_0xc35f('0x12')](_0xc35f('0x13'),_0x9de20c[_0x286983][0x0][_0xc35f('0x14')]),'context':_0x9de20c[_0x286983][0x0]['context'],'exten':_0x9de20c[_0x286983][0x0]['exten'],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});if(_0x9de20c[_0x286983][0x0][_0xc35f('0x14')]==='outbound'){if(_0x2cf060['extension']){_0x2cf060[_0xc35f('0x16')][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':'Set','appdata':_0xc35f('0x17')+(_0x2cf060[_0xc35f('0x18')][_0xc35f('0x19')]?_0xc35f('0x1a')+_0x2cf060[_0xc35f('0x18')][_0xc35f('0x19')]+'}':'${EXTEN}'),'context':_0x9de20c[_0x286983][0x0][_0xc35f('0x1b')],'exten':_0x9de20c[_0x286983][0x0]['exten'],'priority':_0x2cf060['priority']++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0]['VoiceExtensionId']});}_0x2cf060[_0xc35f('0x16')][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':_0xc35f('0x11'),'appdata':_0xc35f('0x1c')+_0x9de20c[_0x286983][0x0]['VoiceExtensionId'],'context':_0x9de20c[_0x286983][0x0]['context'],'exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});var _0x452fe5=_0x2cf060['priority']++;_0x2cf060['extensions'][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':_0xc35f('0x1d'),'appdata':_0xc35f('0x1e')+(_0x452fe5+0x2)+_0xc35f('0x1f')+(_0x452fe5+0x1)+')','context':_0x9de20c[_0x286983][0x0][_0xc35f('0x1b')],'exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')],'priority':_0x452fe5,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});if(_0x2cf060['extension']){_0x2cf060['extensions'][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':_0xc35f('0x11'),'appdata':_0x2cf060[_0xc35f('0x18')][_0xc35f('0x19')]?'CDR(prefix)=${EXTEN:0:'+_0x2cf060['extension']['cutdigits']+'}':_0xc35f('0x20'),'context':_0x9de20c[_0x286983][0x0]['context'],'exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});}_0x2cf060[_0xc35f('0x16')][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':_0xc35f('0x11'),'appdata':_0xc35f('0x21')+_0x9de20c[_0x286983][0x0][_0xc35f('0x15')],'context':_0x9de20c[_0x286983][0x0][_0xc35f('0x1b')],'exten':_0x9de20c[_0x286983][0x0]['exten'],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});if(_0x2cf060[_0xc35f('0x18')]&&_0x2cf060[_0xc35f('0x18')][_0xc35f('0xe')](_0xc35f('0x22'))&&_0x2cf060['extension']['recordingFormat']!==_0xc35f('0x23')){_0x2cf060[_0xc35f('0x16')][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0]['type'],'app':'Set','appdata':_0xc35f('0x24'),'context':_0x9de20c[_0x286983][0x0][_0xc35f('0x1b')],'exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});_0x2cf060[_0xc35f('0x16')][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':_0xc35f('0x11'),'appdata':_0xc35f('0x25')+_0x2cf060[_0xc35f('0x18')][_0xc35f('0x22')]||_0xc35f('0x26'),'context':_0x9de20c[_0x286983][0x0][_0xc35f('0x1b')],'exten':_0x9de20c[_0x286983][0x0]['exten'],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0]['VoiceExtensionId']});}}_0x2cf060[_0xc35f('0x16')][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':_0xc35f('0x11'),'appdata':_0xc35f('0x27'),'context':_0x9de20c[_0x286983][0x0]['context'],'exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});_0x2cf060['extensions']['push']({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':_0xc35f('0x11'),'appdata':_0xc35f('0x28'),'context':_0x9de20c[_0x286983][0x0][_0xc35f('0x1b')],'exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0]['VoiceExtensionId']});_0x2cf060[_0xc35f('0x16')][_0xc35f('0x10')]({'type':_0x9de20c[_0x286983][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x9de20c[_0x286983][0x0][_0xc35f('0x1b')],'exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')],'priority':_0x2cf060[_0xc35f('0xf')]++,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});for(var _0x23ce74=0x0,_0x27528c=0x0;_0x23ce74<_0x9de20c[_0x286983][_0xc35f('0x29')];_0x23ce74+=0x1,_0x27528c=0x0){var _0xb66a73=_0x9de20c[_0x286983][_0x23ce74];if(_0xb66a73[_0xc35f('0x14')]){_0xb66a73['type']=_0xb66a73[_0xc35f('0x14')]['toLowerCase']();}var _0x11fda7=[];var _0x358c98=[];delete _0xb66a73['id'];delete _0xb66a73[_0xc35f('0x2a')];delete _0xb66a73[_0xc35f('0x2b')];var _0x43a1b1=_0xb66a73[_0xc35f('0x2c')]!==_0xc35f('0x2d')?[_0xb66a73[_0xc35f('0x2c')]]:_0xb66a73[_0xc35f('0x2e')]?_[_0xc35f('0x2f')](_['filter'](_0x2cf060[_0xc35f('0x6')],{'IntervalId':_0xb66a73[_0xc35f('0x2e')]}),_0xc35f('0x2c')):[];if(_0xb66a73[_0xc35f('0xe')]('tag')){if(_0xb66a73[_0xc35f('0x30')]&&_0xb66a73[_0xc35f('0x30')]!=='--'){_0x11fda7['push']({'type':_0xb66a73['type'],'app':'Set','appdata':_0xc35f('0x31')+_0xb66a73['tag'],'context':_0xb66a73[_0xc35f('0x1b')],'exten':_0xb66a73[_0xc35f('0xb')],'priority':_0x43a1b1['length']+_0x2cf060[_0xc35f('0xf')]+_0x27528c++,'VoiceExtensionId':_0xb66a73[_0xc35f('0x15')]});}}if(_0xb66a73[_0xc35f('0x14')]===_0xc35f('0x32')&&_0xb66a73[_0xc35f('0xe')](_0xc35f('0x33'))){if(_0xb66a73[_0xc35f('0x33')]){_0x11fda7['push']({'type':_0xb66a73[_0xc35f('0x14')],'app':'ExecIf','appdata':_0xc35f('0x34')+_0xb66a73[_0xc35f('0x33')]+')','context':_0xb66a73['context'],'exten':_0xb66a73[_0xc35f('0xb')],'priority':_0x43a1b1[_0xc35f('0x29')]+_0x2cf060[_0xc35f('0xf')]+_0x27528c++,'VoiceExtensionId':_0xb66a73[_0xc35f('0x15')]});}else{_0x11fda7[_0xc35f('0x10')]({'type':_0xb66a73[_0xc35f('0x14')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xb66a73[_0xc35f('0x1b')],'exten':_0xb66a73[_0xc35f('0xb')],'priority':_0x43a1b1['length']+_0x2cf060[_0xc35f('0xf')]+_0x27528c++,'VoiceExtensionId':_0xb66a73['VoiceExtensionId']});}}if(_0xb66a73[_0xc35f('0xe')](_0xc35f('0x35'))){if(_0x1a7e04[_0xc35f('0x36')](_0xb66a73[_0xc35f('0x37')][_0xc35f('0x38')]())>=0x0&&_0xb66a73[_0xc35f('0x39')]!==_0xc35f('0x3a')){if(_0xb66a73[_0xc35f('0x35')]){_0x11fda7[_0xc35f('0x10')]({'type':_0xb66a73['type'],'app':_0xc35f('0x1d'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xb66a73[_0xc35f('0x1b')],'exten':_0xb66a73[_0xc35f('0xb')],'priority':_0x43a1b1[_0xc35f('0x29')]+_0x2cf060[_0xc35f('0xf')]+_0x27528c++,'VoiceExtensionId':_0xb66a73[_0xc35f('0x15')]});_0x11fda7[_0xc35f('0x10')]({'type':_0xb66a73[_0xc35f('0x14')],'app':'Set','appdata':_0xc35f('0x3b'),'context':_0xb66a73['context'],'exten':_0xb66a73[_0xc35f('0xb')],'priority':_0x43a1b1[_0xc35f('0x29')]+_0x2cf060[_0xc35f('0xf')]+_0x27528c++,'VoiceExtensionId':_0xb66a73['VoiceExtensionId']});}else{_0x11fda7[_0xc35f('0x10')]({'type':_0xb66a73[_0xc35f('0x14')],'app':_0xc35f('0x1d'),'appdata':_0xc35f('0x3c'),'context':_0xb66a73[_0xc35f('0x1b')],'exten':_0xb66a73['exten'],'priority':_0x43a1b1['length']+_0x2cf060[_0xc35f('0xf')]+_0x27528c++,'VoiceExtensionId':_0xb66a73[_0xc35f('0x15')]});_0x11fda7[_0xc35f('0x10')]({'type':_0xb66a73[_0xc35f('0x14')],'app':'Set','appdata':_0xc35f('0x3d'),'context':_0xb66a73[_0xc35f('0x1b')],'exten':_0xb66a73[_0xc35f('0xb')],'priority':_0x43a1b1[_0xc35f('0x29')]+_0x2cf060[_0xc35f('0xf')]+_0x27528c++,'VoiceExtensionId':_0xb66a73['VoiceExtensionId']});}}}for(var _0x17203d=0x0;_0x17203d<_0x43a1b1[_0xc35f('0x29')];_0x17203d+=0x1){var _0xd6a451=_0x2cf060[_0xc35f('0xf')]+_0x43a1b1[_0xc35f('0x29')];var _0x16b8b4=_0x17203d===_0x43a1b1[_0xc35f('0x29')]-0x1?_0x2cf060[_0xc35f('0xf')]+_0x11fda7[_0xc35f('0x29')]+_0x358c98[_0xc35f('0x29')]+0x2:_0x2cf060[_0xc35f('0xf')]+_0x17203d+0x1;_0x11fda7[_0xc35f('0x3e')](_0x17203d,0x0,{'type':_0xb66a73['type'],'app':_0xc35f('0x3f'),'appdata':_0x43a1b1[_0x17203d]+'?'+_0xb66a73[_0xc35f('0x1b')]+_0xc35f('0x40')+_0xd6a451+':'+_0xb66a73[_0xc35f('0x1b')]+_0xc35f('0x40')+_0x16b8b4,'exten':_0xb66a73[_0xc35f('0xb')],'context':_0xb66a73[_0xc35f('0x1b')],'priority':_0x2cf060[_0xc35f('0xf')]+_0x17203d,'VoiceExtensionId':_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]});}_0xb66a73['priority']=_0x11fda7[_0xc35f('0x29')]?_[_0xc35f('0x41')](_0x11fda7)[_0xc35f('0xf')]+0x1:_0x2cf060[_0xc35f('0xf')];_0x2cf060[_0xc35f('0xf')]=(_0x358c98['length']?_[_0xc35f('0x41')](_0x358c98)[_0xc35f('0xf')]:_0xb66a73[_0xc35f('0xf')])+0x1;_0x2cf060[_0xc35f('0x16')]=_[_0xc35f('0x42')](_0x2cf060[_0xc35f('0x16')],_0x11fda7,[_0xb66a73],_0x358c98);}_0x2cf060[_0xc35f('0x16')]['push']({'type':_0x9de20c[_0x286983][0x0][_0xc35f('0x14')],'app':'Hangup','exten':_0x9de20c[_0x286983][0x0][_0xc35f('0xb')],'context':_0x9de20c[_0x286983][0x0][_0xc35f('0x1b')],'priority':_0x2cf060['priority'],'VoiceExtensionId':_0x9de20c[_0x286983][0x0]['VoiceExtensionId']});_0x4d769d[_0xc35f('0x10')](_0x9de20c[_0x286983][0x0][_0xc35f('0x15')]);_0x258278=_[_0xc35f('0x42')](_0x258278,_0x2cf060[_0xc35f('0x16')]);}}return _0x5c500e[_0xc35f('0x43')](function(_0x416246){return _0x5c500e[_0xc35f('0x2')][_0xc35f('0x7')][_0xc35f('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x4d769d}},'transaction':_0x416246})[_0xc35f('0x5')](function(_0x1598ba){return _0x5c500e['models']['VoiceExtension']['bulkCreate'](_[_0xc35f('0x45')](_0x258278,_0xc35f('0xf')),{'transaction':_0x416246});});});})['catch'](function(_0x31400f){console['error'](_0x31400f);});}exports[_0xc35f('0x46')]=rewrite; \ No newline at end of file +var _0x0d98=['VoiceExtensionId','outbound','push','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','map','intervals','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','VoiceExtension','destroy','bulkCreate','error','rewrite','lodash','util','Interval','findAll','then','models','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','priority','extension','find','exten','extensions','type','Set','format','CDR(type)=%s','context'];(function(_0x1593af,_0x1fec40){var _0x3b8361=function(_0x3911f7){while(--_0x3911f7){_0x1593af['push'](_0x1593af['shift']());}};_0x3b8361(++_0x1fec40);}(_0x0d98,0x149));var _0x80d9=function(_0x10567b,_0x31d474){_0x10567b=_0x10567b-0x0;var _0x36ad35=_0x0d98[_0x10567b];return _0x36ad35;};'use strict';var _=require(_0x80d9('0x0'));var util=require(_0x80d9('0x1'));function rewrite(_0x3d9289,_0x5f4122){var _0x4dffe3=this;return _0x3d9289['models'][_0x80d9('0x2')][_0x80d9('0x3')]({'raw':!![]})[_0x80d9('0x4')](function(_0x459acd){_0x4dffe3['intervals']=_0x459acd;return _0x3d9289[_0x80d9('0x5')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x5f4122['IntervalId']},'raw':!![]});})[_0x80d9('0x4')](function(_0xb8d05){return _0x3d9289['models']['VoiceExtension'][_0x80d9('0x3')]({'where':{'exten':{'$in':_[_0x80d9('0x6')](_['map'](_0xb8d05,'exten'))}},'order':[{'raw':_0x80d9('0x7')}],'raw':!![]});})[_0x80d9('0x4')](function(_0x5d1f65){var _0x306de8=_[_0x80d9('0x8')](_0x5d1f65,{'priority':'1'});var _0x2e86bd=_[_0x80d9('0x8')](_0x5d1f65,{'isApp':0x1});var _0x429ca6=_[_0x80d9('0x9')](_0x2e86bd,'exten');var _0x18d8ae=[_0x80d9('0xa'),'playback'];var _0x1de228=[];var _0xe47790=[];for(var _0x38dda2 in _0x429ca6){if(_0x429ca6['hasOwnProperty'](_0x38dda2)){_0x4dffe3[_0x80d9('0xb')]=0x2;_0x4dffe3['extensions']=[];_0x4dffe3[_0x80d9('0xc')]=_[_0x80d9('0xd')](_0x306de8,{'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')]});_0x4dffe3[_0x80d9('0xf')]['push']({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':_0x80d9('0x11'),'appdata':util[_0x80d9('0x12')](_0x80d9('0x13'),_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')]),'context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});if(_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')]===_0x80d9('0x16')){if(_0x4dffe3[_0x80d9('0xc')]){_0x4dffe3[_0x80d9('0xf')][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':'Set','appdata':'CDR(destination)='+(_0x4dffe3[_0x80d9('0xc')]['cutdigits']?'${EXTEN:'+_0x4dffe3[_0x80d9('0xc')]['cutdigits']+'}':_0x80d9('0x18')),'context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});}_0x4dffe3['extensions'][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0]['type'],'app':_0x80d9('0x11'),'appdata':_0x80d9('0x19')+_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')],'context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'priority':_0x4dffe3['priority']++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});var _0x2d32fa=_0x4dffe3[_0x80d9('0xb')]++;_0x4dffe3['extensions'][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':_0x80d9('0x1a'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2d32fa+0x2)+_0x80d9('0x1b')+(_0x2d32fa+0x1)+')','context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'priority':_0x2d32fa,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});if(_0x4dffe3['extension']){_0x4dffe3['extensions'][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':_0x80d9('0x11'),'appdata':_0x4dffe3['extension'][_0x80d9('0x1c')]?_0x80d9('0x1d')+_0x4dffe3[_0x80d9('0xc')][_0x80d9('0x1c')]+'}':_0x80d9('0x1e'),'context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});}_0x4dffe3[_0x80d9('0xf')][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':_0x80d9('0x11'),'appdata':'outboundrouteid='+_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')],'context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'exten':_0x429ca6[_0x38dda2][0x0]['exten'],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});if(_0x4dffe3[_0x80d9('0xc')]&&_0x4dffe3[_0x80d9('0xc')][_0x80d9('0x1f')](_0x80d9('0x20'))&&_0x4dffe3['extension']['recordingFormat']!==_0x80d9('0x21')){_0x4dffe3[_0x80d9('0xf')][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0]['type'],'app':_0x80d9('0x11'),'appdata':_0x80d9('0x22'),'context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'exten':_0x429ca6[_0x38dda2][0x0]['exten'],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});_0x4dffe3[_0x80d9('0xf')][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':'Set','appdata':_0x80d9('0x23')+_0x4dffe3['extension'][_0x80d9('0x20')]||_0x80d9('0x24'),'context':_0x429ca6[_0x38dda2][0x0]['context'],'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});}}_0x4dffe3[_0x80d9('0xf')][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x429ca6[_0x38dda2][0x0]['context'],'exten':_0x429ca6[_0x38dda2][0x0]['exten'],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});_0x4dffe3['extensions'][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':_0x80d9('0x11'),'appdata':_0x80d9('0x25'),'context':_0x429ca6[_0x38dda2][0x0]['context'],'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});_0x4dffe3['extensions'][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0]['type'],'app':_0x80d9('0x11'),'appdata':'MONITOR_OPTIONS=ab','context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'priority':_0x4dffe3[_0x80d9('0xb')]++,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});for(var _0x2c8587=0x0,_0xa84bd5=0x0;_0x2c8587<_0x429ca6[_0x38dda2]['length'];_0x2c8587+=0x1,_0xa84bd5=0x0){var _0x5326b7=_0x429ca6[_0x38dda2][_0x2c8587];if(_0x5326b7['type']){_0x5326b7[_0x80d9('0x10')]=_0x5326b7[_0x80d9('0x10')][_0x80d9('0x26')]();}var _0x3abf3f=[];var _0x2ab544=[];delete _0x5326b7['id'];delete _0x5326b7[_0x80d9('0x27')];delete _0x5326b7[_0x80d9('0x28')];var _0x2d40a4=_0x5326b7['interval']!==_0x80d9('0x29')?[_0x5326b7[_0x80d9('0x2a')]]:_0x5326b7['IntervalId']?_[_0x80d9('0x2b')](_[_0x80d9('0x8')](_0x4dffe3[_0x80d9('0x2c')],{'IntervalId':_0x5326b7[_0x80d9('0x2d')]}),_0x80d9('0x2a')):[];if(_0x5326b7['hasOwnProperty'](_0x80d9('0x2e'))){if(_0x5326b7[_0x80d9('0x2e')]&&_0x5326b7[_0x80d9('0x2e')]!=='--'){_0x3abf3f['push']({'type':_0x5326b7[_0x80d9('0x10')],'app':'Set','appdata':_0x80d9('0x2f')+_0x5326b7[_0x80d9('0x2e')],'context':_0x5326b7[_0x80d9('0x14')],'exten':_0x5326b7[_0x80d9('0xe')],'priority':_0x2d40a4['length']+_0x4dffe3[_0x80d9('0xb')]+_0xa84bd5++,'VoiceExtensionId':_0x5326b7['VoiceExtensionId']});}}if(_0x5326b7[_0x80d9('0x10')]===_0x80d9('0x16')&&_0x5326b7[_0x80d9('0x1f')](_0x80d9('0x30'))){if(_0x5326b7['callerID']){_0x3abf3f[_0x80d9('0x17')]({'type':_0x5326b7['type'],'app':_0x80d9('0x1a'),'appdata':_0x80d9('0x31')+_0x5326b7['callerID']+')','context':_0x5326b7[_0x80d9('0x14')],'exten':_0x5326b7[_0x80d9('0xe')],'priority':_0x2d40a4[_0x80d9('0x32')]+_0x4dffe3[_0x80d9('0xb')]+_0xa84bd5++,'VoiceExtensionId':_0x5326b7['VoiceExtensionId']});}else{_0x3abf3f[_0x80d9('0x17')]({'type':_0x5326b7[_0x80d9('0x10')],'app':_0x80d9('0x1a'),'appdata':_0x80d9('0x33'),'context':_0x5326b7[_0x80d9('0x14')],'exten':_0x5326b7['exten'],'priority':_0x2d40a4['length']+_0x4dffe3[_0x80d9('0xb')]+_0xa84bd5++,'VoiceExtensionId':_0x5326b7[_0x80d9('0x15')]});}}if(_0x5326b7[_0x80d9('0x1f')]('answer')){if(_0x18d8ae[_0x80d9('0x34')](_0x5326b7['app']['toLowerCase']())>=0x0&&_0x5326b7[_0x80d9('0x35')]!==_0x80d9('0x36')){if(_0x5326b7[_0x80d9('0x37')]){_0x3abf3f[_0x80d9('0x17')]({'type':_0x5326b7[_0x80d9('0x10')],'app':_0x80d9('0x1a'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5326b7[_0x80d9('0x14')],'exten':_0x5326b7[_0x80d9('0xe')],'priority':_0x2d40a4[_0x80d9('0x32')]+_0x4dffe3[_0x80d9('0xb')]+_0xa84bd5++,'VoiceExtensionId':_0x5326b7[_0x80d9('0x15')]});_0x3abf3f[_0x80d9('0x17')]({'type':_0x5326b7[_0x80d9('0x10')],'app':_0x80d9('0x11'),'appdata':_0x80d9('0x38'),'context':_0x5326b7[_0x80d9('0x14')],'exten':_0x5326b7['exten'],'priority':_0x2d40a4[_0x80d9('0x32')]+_0x4dffe3[_0x80d9('0xb')]+_0xa84bd5++,'VoiceExtensionId':_0x5326b7[_0x80d9('0x15')]});}else{_0x3abf3f[_0x80d9('0x17')]({'type':_0x5326b7[_0x80d9('0x10')],'app':_0x80d9('0x1a'),'appdata':_0x80d9('0x39'),'context':_0x5326b7['context'],'exten':_0x5326b7[_0x80d9('0xe')],'priority':_0x2d40a4[_0x80d9('0x32')]+_0x4dffe3['priority']+_0xa84bd5++,'VoiceExtensionId':_0x5326b7[_0x80d9('0x15')]});_0x3abf3f[_0x80d9('0x17')]({'type':_0x5326b7['type'],'app':_0x80d9('0x11'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5326b7[_0x80d9('0x14')],'exten':_0x5326b7[_0x80d9('0xe')],'priority':_0x2d40a4[_0x80d9('0x32')]+_0x4dffe3[_0x80d9('0xb')]+_0xa84bd5++,'VoiceExtensionId':_0x5326b7[_0x80d9('0x15')]});}}}for(var _0x37cb4d=0x0;_0x37cb4d<_0x2d40a4['length'];_0x37cb4d+=0x1){var _0x2ceaa1=_0x4dffe3[_0x80d9('0xb')]+_0x2d40a4[_0x80d9('0x32')];var _0x64eaae=_0x37cb4d===_0x2d40a4[_0x80d9('0x32')]-0x1?_0x4dffe3[_0x80d9('0xb')]+_0x3abf3f['length']+_0x2ab544[_0x80d9('0x32')]+0x2:_0x4dffe3['priority']+_0x37cb4d+0x1;_0x3abf3f[_0x80d9('0x3a')](_0x37cb4d,0x0,{'type':_0x5326b7['type'],'app':_0x80d9('0x3b'),'appdata':_0x2d40a4[_0x37cb4d]+'?'+_0x5326b7[_0x80d9('0x14')]+_0x80d9('0x3c')+_0x2ceaa1+':'+_0x5326b7[_0x80d9('0x14')]+_0x80d9('0x3c')+_0x64eaae,'exten':_0x5326b7['exten'],'context':_0x5326b7[_0x80d9('0x14')],'priority':_0x4dffe3[_0x80d9('0xb')]+_0x37cb4d,'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});}_0x5326b7[_0x80d9('0xb')]=_0x3abf3f[_0x80d9('0x32')]?_[_0x80d9('0x3d')](_0x3abf3f)['priority']+0x1:_0x4dffe3[_0x80d9('0xb')];_0x4dffe3[_0x80d9('0xb')]=(_0x2ab544['length']?_['last'](_0x2ab544)[_0x80d9('0xb')]:_0x5326b7['priority'])+0x1;_0x4dffe3[_0x80d9('0xf')]=_[_0x80d9('0x3e')](_0x4dffe3['extensions'],_0x3abf3f,[_0x5326b7],_0x2ab544);}_0x4dffe3[_0x80d9('0xf')][_0x80d9('0x17')]({'type':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x10')],'app':_0x80d9('0x3f'),'exten':_0x429ca6[_0x38dda2][0x0][_0x80d9('0xe')],'context':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x14')],'priority':_0x4dffe3[_0x80d9('0xb')],'VoiceExtensionId':_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]});_0x1de228[_0x80d9('0x17')](_0x429ca6[_0x38dda2][0x0][_0x80d9('0x15')]);_0xe47790=_[_0x80d9('0x3e')](_0xe47790,_0x4dffe3[_0x80d9('0xf')]);}}return _0x3d9289[_0x80d9('0x40')](function(_0x1badee){return _0x3d9289[_0x80d9('0x5')][_0x80d9('0x41')][_0x80d9('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x1de228}},'transaction':_0x1badee})[_0x80d9('0x4')](function(_0x55616c){return _0x3d9289[_0x80d9('0x5')][_0x80d9('0x41')][_0x80d9('0x43')](_['sortBy'](_0xe47790,_0x80d9('0xb')),{'transaction':_0x1badee});});});})['catch'](function(_0x394882){console[_0x80d9('0x44')](_0x394882);});}exports[_0x80d9('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 271f9dc..a287015 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 _0xe706=['toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','insert','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','split','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','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!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()'];(function(_0x26642d,_0x189b66){var _0x4584a5=function(_0x3e2669){while(--_0x3e2669){_0x26642d['push'](_0x26642d['shift']());}};_0x4584a5(++_0x189b66);}(_0xe706,0xa3));var _0x6e70=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xe706[_0x836465];return _0x2150ea;};'use strict';var BPromise=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var socket=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));require(_0x6e70('0xd'))[_0x6e70('0xe')](socket);try{if(!process[_0x6e70('0xf')][0x2]||process[_0x6e70('0xf')][0x2]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x2]===_0x6e70('0x11')){throw new Error(_0x6e70('0x12'));}var FILEPATH=process[_0x6e70('0xf')][0x2];if(!process[_0x6e70('0xf')][0x3]||process[_0x6e70('0xf')][0x3]===_0x6e70('0x10')||process['argv'][0x3]==='null'||!process[_0x6e70('0xf')][0x4]||process[_0x6e70('0xf')][0x4]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x4]===_0x6e70('0x11')){throw new Error(_0x6e70('0x13'));}var FIELDS=_[_0x6e70('0x14')](process[_0x6e70('0xf')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x6e70('0xf')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6e70('0xf')][0x5]===_0x6e70('0x11')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6e70('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6e70('0xf')][0x6]!==_0x6e70('0x10')&&process['argv'][0x6]!=='null'?process[_0x6e70('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x6e70('0xf')][0x7]!==_0x6e70('0x10')&&process['argv'][0x7]!=='null'?process[_0x6e70('0xf')][0x7]:null;if(!process[_0x6e70('0xf')][0x8]||process[_0x6e70('0xf')][0x8]===_0x6e70('0x10')||process[_0x6e70('0xf')][0x8]===_0x6e70('0x11')){throw new Error(_0x6e70('0x15'));}var SOCKET_TIMESTAMP=process[_0x6e70('0xf')][0x8];}catch(_0x29326f){logger[_0x6e70('0x16')](_0x29326f);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(_0x4a0cfe,_0x228350,_0x344b65,_0x27b294){var _0x502b2d={'message':_0x228350};_0x502b2d[_0x4a0cfe]=!![];if(_0x344b65){_0x502b2d[_0x6e70('0x17')]=_0x344b65;}if(_0x27b294){_0x502b2d[_0x6e70('0x18')]=_0x27b294;}return _0x502b2d;}function isEmail(_0x3337a6){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'](_0x3337a6);}function checkRow(_0x10fc91,_0x538b9c,_0x50aec2){return new BPromise(function(_0x4e97c7,_0x41e352){if(_[_0x6e70('0x19')](_0x10fc91)){return _0x41e352(handleCheckRowError('error',_0x6e70('0x1a'),null,_0x50aec2));}if(_0x10fc91[_0x6e70('0x1b')]&&_0x10fc91['errors'][_0x6e70('0x1c')]){var _0x67fb43=_[_0x6e70('0x1d')](_0x10fc91['errors'],'message')[_0x6e70('0x1e')](';');return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x67fb43,null,_0x50aec2));}var _0x83c836={};for(var _0x114344 in FIELDS){if(FIELDS[_0x6e70('0x1f')](_0x114344)&&FIELDS[_0x114344]){_0x83c836[_0x114344]=_0x10fc91['data'][0x0][FIELDS[_0x114344]]||_0x10fc91[_0x6e70('0x20')][0x0]['\ufeff'+FIELDS[_0x114344]];}}if(!_0x83c836[_0x6e70('0x21')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x22'),null,_0x50aec2));}if(!_0x83c836[_0x6e70('0x23')]){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x24'),null,_0x50aec2));}if(_0x83c836[_0x6e70('0x25')]){var _0x3a0821=moment(_0x83c836[_0x6e70('0x25')],'YYYY-MM-DD');if(!_0x3a0821[_0x6e70('0x26')]()){return _0x41e352(handleCheckRowError('error',_0x6e70('0x27'),null,_0x50aec2));}}if(_0x83c836['email']){if(!isEmail(_0x83c836[_0x6e70('0x28')])){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x29'),null,_0x50aec2));}}_0x83c836['ListId']=LISTID;_0x83c836[_0x6e70('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){var _0x5780a1={};for(var _0x13d673=0x0,_0x154925=DUPLICATES['length'];_0x13d673<_0x154925;_0x13d673+=0x1){_0x5780a1[DUPLICATES[_0x13d673]]=_0x83c836[DUPLICATES[_0x13d673]];}var _0x10d8f6=_[_0x6e70('0x2b')](_0x538b9c,_0x5780a1);if(_0x10d8f6){return _0x41e352(handleCheckRowError(_0x6e70('0x2c'),_0x6e70('0x2d'),_0x10d8f6,_0x50aec2));}}return db[_0x6e70('0x2e')][_0x6e70('0x2f')](_0x83c836,{'raw':!![],'hooks':![],'fields':_[_0x6e70('0x30')](_0x83c836)})[_0x6e70('0x31')](function(_0xf146fd){if(DUPLICATES&&DUPLICATES[_0x6e70('0x1c')]&&_0x538b9c){_0x538b9c['push'](_[_0x6e70('0x32')](_0x83c836,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf146fd['id'];return _0x4e97c7();})['catch'](function(_0x23cd1a){return _0x41e352(handleCheckRowError(_0x6e70('0x16'),_0x6e70('0x33')+(_0x23cd1a[_0x6e70('0x34')]||JSON[_0x6e70('0x35')](_0x23cd1a)),null,_0x50aec2));});});}function checkHopper(){function _0x989b80(){return function(_0x2440be){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x6e70('0x37'),util[_0x6e70('0x38')](_0x2440be,{'showHidden':![],'depth':null}));};}var _0x23d5e2=function(_0x5594d3,_0x501b53){var _0x5446a2=squel['insert']()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),'ListId',_0x501b53,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x5594d3['id'][_0x6e70('0x43')](),_0x501b53)['field']('NOW()','createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6e70('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x501b53+'\x20=\x20?',_0x5594d3['id'][_0x6e70('0x43')]())))[_0x6e70('0x43')]();return _0x5446a2;};var _0x2dafb5=function(_0x3478e2,_0x5bbc3a){var _0x291de6=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3c'),'ContactId',_0x6e70('0x44'),_0x5bbc3a,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))['field'](_0x6e70('0x42'),'scheduledAt')[_0x6e70('0x41')]('id',_0x6e70('0x3d'))['field'](LISTID['toString'](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x3478e2['id'][_0x6e70('0x43')](),_0x5bbc3a)['field']('NOW()',_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where'](_0x6e70('0x47'))[_0x6e70('0x48')](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b'))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()['field'](_0x6e70('0x4d'))[_0x6e70('0x45')](_0x6e70('0x4e'))[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']()))[_0x6e70('0x48')](_0x6e70('0x4c'),squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'))[_0x6e70('0x45')]('cm_hopper')[_0x6e70('0x48')](_0x5bbc3a+_0x6e70('0x4f'),_0x3478e2['id']['toString']())))[_0x6e70('0x43')]();return _0x291de6;};function _0xebe5f7(_0x54efdf,_0x3cfaa9){var _0xb3f06c=squel[_0x6e70('0x4a')]()[_0x6e70('0x39')](_0x6e70('0x3a'))['fromQuery']([_0x6e70('0x23'),_0x6e70('0x3c'),_0x6e70('0x3d'),_0x6e70('0x44'),_0x3cfaa9,_0x6e70('0x3e'),_0x6e70('0x3f')],squel[_0x6e70('0x40')]()[_0x6e70('0x41')](_0x6e70('0x23'),_0x6e70('0x23'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3c'))[_0x6e70('0x41')]('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x54efdf['id'][_0x6e70('0x43')](),_0x3cfaa9)['field'](_0x6e70('0x42'),_0x6e70('0x3e'))[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')]('cm_contacts')[_0x6e70('0x48')](_0x6e70('0x47'))['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0xb3f06c;}function _0x41a861(_0x10d299,_0x739946){var _0x30cd88=squel['insert']()['into'](_0x6e70('0x50'))[_0x6e70('0x3b')]([_0x6e70('0x23'),_0x6e70('0x3d'),'ListId',_0x739946,'createdAt',_0x6e70('0x3f')],squel[_0x6e70('0x40')]()['field']('phone',_0x6e70('0x23'))['field']('id',_0x6e70('0x3d'))[_0x6e70('0x41')](LISTID[_0x6e70('0x43')](),_0x6e70('0x44'))[_0x6e70('0x41')](_0x10d299['id'][_0x6e70('0x43')](),_0x739946)[_0x6e70('0x41')](_0x6e70('0x42'),'createdAt')[_0x6e70('0x41')](_0x6e70('0x42'),_0x6e70('0x3f'))[_0x6e70('0x45')](_0x6e70('0x46'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x6e70('0x49'),LISTID[_0x6e70('0x43')]())[_0x6e70('0x48')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6e70('0x48')](_0x6e70('0x4b')))[_0x6e70('0x43')]();return _0x30cd88;}return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x55'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x82a9a){var _0x515c0c=[];if(_0x82a9a){var _0xce964b;for(var _0x531097=0x0,_0x5b4046;_0x531097<_0x82a9a[_0x6e70('0x1c')];_0x531097+=0x1){_0x5b4046=_0x82a9a[_0x531097][_0x6e70('0x56')]({'plain':!![]});switch(_0x5b4046[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')]['query'](_0x2dafb5(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x515c0c[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x5b4046,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));break;default:_0x515c0c['push'](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x5b4046,_0x6e70('0x5b')))['then'](function(){})['catch'](_0x989b80()));}}}return _0x515c0c;})[_0x6e70('0x5f')]()[_0x6e70('0x31')](function(){return db[_0x6e70('0x51')][_0x6e70('0x52')]({'where':{'type':_0x6e70('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x241a21){var _0x56d4d9=[];if(_0x241a21){var _0x58666a;for(var _0x1c7c5f=0x0,_0xf7a034;_0x1c7c5f<_0x241a21[_0x6e70('0x1c')];_0x1c7c5f+=0x1){_0xf7a034=_0x241a21[_0x1c7c5f][_0x6e70('0x56')]({'plain':!![]});_0x56d4d9[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x41a861(_0xf7a034,_0x6e70('0x5b')))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}return _0x56d4d9;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6e70('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x4b2d40){var _0x5b5471=[];if(_0x4b2d40){for(var _0x402f6f=0x0,_0x48e04b;_0x402f6f<_0x4b2d40['length'];_0x402f6f+=0x1){_0x48e04b=_0x4b2d40[_0x402f6f][_0x6e70('0x56')]({'plain':!![]});switch(_0x48e04b[_0x6e70('0x57')]){case _0x6e70('0x58'):_0x5b5471['push'](db['sequelize']['query'](_0x2dafb5(_0x48e04b,_0x6e70('0x61')))['then'](function(){})[_0x6e70('0x5c')](_0x989b80()));break;case _0x6e70('0x5d'):_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0x23d5e2(_0x48e04b,_0x6e70('0x61')))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));break;default:_0x5b5471[_0x6e70('0x59')](db[_0x6e70('0x5a')][_0x6e70('0x5e')](_0xebe5f7(_0x48e04b,'CampaignId'))[_0x6e70('0x31')](function(){})[_0x6e70('0x5c')](_0x989b80()));}}}return _0x5b5471;})[_0x6e70('0x5f')]();})[_0x6e70('0x31')](function(){return db[_0x6e70('0x60')][_0x6e70('0x52')]({'attributes':['id'],'include':[{'model':db[_0x6e70('0x54')],'as':_0x6e70('0x62'),'where':{'id':LISTID}}]})[_0x6e70('0x31')](function(_0x48f6fd){var _0x463eed=[];if(_0x48f6fd){for(var _0x39e6db=0x0,_0x53acc8;_0x39e6db<_0x48f6fd[_0x6e70('0x1c')];_0x39e6db+=0x1){_0x53acc8=_0x48f6fd[_0x39e6db][_0x6e70('0x56')]({'plain':!![]});_0x463eed['push'](db['sequelize'][_0x6e70('0x5e')](_0x41a861(_0x53acc8,'CampaignId'))[_0x6e70('0x31')](function(){})['catch'](_0x989b80()));}}return _0x463eed;})[_0x6e70('0x5f')]();})[_0x6e70('0x5c')](function(_0x106f32){logger[_0x6e70('0x16')](_0x6e70('0x63'),_0x6e70('0x64'),_0x106f32[_0x6e70('0x34')]);});}var processPromises=function(_0x5afbf5){return BPromise['all'](promises)[_0x6e70('0x31')](function(_0x4bf451){})[_0x6e70('0x5c')](function(_0xa2a4d5){logger[_0x6e70('0x16')](_0x6e70('0x65'),JSON['stringify'](_0xa2a4d5));})[_0x6e70('0x66')](function(){socket['emit'](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5afbf5){return _0x5afbf5[_0x6e70('0x68')]();}});};var endCsv=function(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x6e70('0x31')](function(){socket[_0x6e70('0x6a')](_0x6e70('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1d6acf){logger['error'](_0x6e70('0x6b'),JSON['stringify'](_0x1d6acf));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x6e70('0x6c')](_0x6e70('0x6d'));endCsv();});function main(){return BPromise[_0x6e70('0x69')]()[_0x6e70('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6e70('0x6e')](',');return db['CmContact'][_0x6e70('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6e70('0x31')](function(_0x48c30c){var _0x3c2d33=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6e70('0x6f')](_0x3c2d33,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d0585,_0x4a87e2){total+=0x1;var _0x25f60c=total;promises[_0x6e70('0x59')](checkRow(_0x5d0585,_0x48c30c,_0x25f60c)[_0x6e70('0x31')](function(){success+=0x1;})[_0x6e70('0x5c')](function(_0x3e6661){if(_0x3e6661[_0x6e70('0x16')]){errors+=0x1;delete _0x3e6661[_0x6e70('0x16')];}else if(_0x3e6661['duplicate']){duplicates+=0x1;delete _0x3e6661[_0x6e70('0x2c')];}rows['push'](_0x3e6661);}));if(total%0xc8===0x0){_0x4a87e2[_0x6e70('0x70')]();return processPromises(_0x4a87e2);}},'complete':function(){return processPromises()[_0x6e70('0x31')](function(){logger[_0x6e70('0x6c')](_0x6e70('0x71'));endCsv();});},'error':function(_0x4764d5,_0x41b7de){logger[_0x6e70('0x6c')]('CSV\x20parse\x20error',JSON[_0x6e70('0x35')](_0x4764d5));endCsv();}});})['catch'](function(_0x27bdf2){logger[_0x6e70('0x16')](_0x6e70('0x72'),JSON[_0x6e70('0x35')](_0x27bdf2));});}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(_0x3e2447,_0xf1ecce){var _0x444a27=function(_0x26a658){while(--_0x26a658){_0x3e2447['push'](_0x3e2447['shift']());}};_0x444a27(++_0xf1ecce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 2b46204..4c5c601 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0xb43146,_0x51e1a8){var _0x596a8f=function(_0x33986e){while(--_0x33986e){_0xb43146['push'](_0xb43146['shift']());}};_0x596a8f(++_0x51e1a8);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _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(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x7a54,0x106));var _0x47a5=function(_0x368c2f,_0x2eb034){_0x368c2f=_0x368c2f-0x0;var _0x390d01=_0x7a54[_0x368c2f];return _0x390d01;};'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 diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index f57a447..bb8fbf0 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 _0xf0c3=['replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','../../../mysqldb','../../../config/environment','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','length','isNil','push','all','then','catch','AdditionalPhones','split','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','ContactId','priority','UserId','fields','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','insert','cm_hopper_black','createdAt','updatedAt','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','ListId','CompanyId','into','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','sequelize','spread','main','send','start','binding','clone','socket_timestamp','root','body','findAll','name','header','writeFileSync','data','hasOwnProperty','trim'];(function(_0x1e5522,_0x6b8484){var _0x588c24=function(_0x3e6f7b){while(--_0x3e6f7b){_0x1e5522['push'](_0x1e5522['shift']());}};_0x588c24(++_0x6b8484);}(_0xf0c3,0x1e1));var _0x3f0c=function(_0x194ce1,_0x1d2f54){_0x194ce1=_0x194ce1-0x0;var _0x279ec6=_0xf0c3[_0x194ce1];return _0x279ec6;};'use strict';var fs=require('fs');var path=require(_0x3f0c('0x0'));var _=require(_0x3f0c('0x1'));var Papa=require('papaparse');var util=require(_0x3f0c('0x2'));var BPromise=require(_0x3f0c('0x3'));var moment=require(_0x3f0c('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x3f0c('0x5'))['db'];var config=require(_0x3f0c('0x6'));var logger=require('../../../config/logger')('import');config[_0x3f0c('0x7')]=_[_0x3f0c('0x8')](config[_0x3f0c('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f0c('0x9'))(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()[_0x3f0c('0xa')](_0x3f0c('0xb'));var tempTableName=_0x3f0c('0xc')+moment()[_0x3f0c('0xa')](_0x3f0c('0xd'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x5c6ba7){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))*$/[_0x3f0c('0xe')](_0x5c6ba7);}function selectNotIn(_0x5d5e3e,_0x2adbbd,_0x241701,_0x3da0d9,_0x23b41d){return squel[_0x3f0c('0xf')]()[_0x3f0c('0x10')](_0x3f0c('0x11'))[_0x3f0c('0x12')](_0x3da0d9)[_0x3f0c('0x13')](_0x2adbbd,null,_0x2adbbd+_0x3f0c('0x14')+_0x3da0d9+'.'+_0x241701)['where'](_0x3da0d9+'.'+_0x241701+_0x3f0c('0x15')+_0x5d5e3e+'.'+_0x241701)[_0x3f0c('0x16')](_0x2adbbd+_0x3f0c('0x17')+_0x23b41d[_0x3f0c('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3f05c6,_0xa7cb5e){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x3f0c('0x18')](_0x3f0c('0x19')+tempTableName)['spread'](function(_0x2abeff){if(_0x2abeff!==null){var _0x3e01e0=[];for(var _0x14411c=0x0;_0x14411c<_0x2abeff[_0x3f0c('0x1a')];_0x14411c++){var _0x4acedb=_0x2abeff[_0x14411c];if(!_[_0x3f0c('0x1b')](_0x4acedb['phone'])){if(!_[_0x3f0c('0x1b')](_0x4acedb['AdditionalPhones']))_0x3e01e0[_0x3f0c('0x1c')](insertAdditionalPhones(_0x4acedb));promisesContact[_0x3f0c('0x1c')]({'contact':_0x4acedb});}}}Promise[_0x3f0c('0x1d')](_0x3e01e0)[_0x3f0c('0x1e')](function(){_0x3f05c6({'val':0x1});});})[_0x3f0c('0x1f')](function(_0x494909){logger['error'](_0x494909['message']);});});}function insertAdditionalPhones(_0x595d12){return new Promise(function(_0x192a81,_0x43bd40){var _0x1ad831=_0x595d12[_0x3f0c('0x20')];if(_[_0x3f0c('0x1b')](_0x1ad831))_0x43bd40({'val':0x0});else{var _0x4e351f=_0x1ad831[_0x3f0c('0x21')](';');var _0x23518d=[];orderBy=0x0;for(var _0x3aa1b2=0x0;_0x3aa1b2<_0x4e351f[_0x3f0c('0x1a')];_0x3aa1b2++){_0x23518d[_0x3f0c('0x1c')](splitAdditionalPhone(_0x595d12['id'],_0x4e351f[_0x3aa1b2]));}Promise['all'](_0x23518d)[_0x3f0c('0x1e')](function(){_0x192a81({'val':_0x4e351f[_0x3f0c('0x1a')]});});}});}function splitAdditionalPhone(_0x4cc2ff,_0x2a807a){return new Promise(function(_0x578d73,_0x28d550){var _0x3f408b=_0x2a807a[_0x3f0c('0x21')](':');var _0x4cd566=_0x3f408b[0x0];var _0x36db89=_0x3f408b[0x1];if(_0x36db89!==''){var _0x5b6d42=_0x36db89[_0x3f0c('0x21')]('|');var _0x22476f=[];for(var _0x2ed901=0x0;_0x2ed901<_0x5b6d42[_0x3f0c('0x1a')];_0x2ed901++){if(_0x5b6d42[_0x2ed901]!==''){var _0x446b65=_[_0x3f0c('0x22')](promisesAdditionalPhones,{'contactId':_0x4cc2ff,'phone':_0x5b6d42[_0x2ed901]});if(_0x446b65[_0x3f0c('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x4cc2ff,'contactTypeId':_0x4cd566,'phone':_0x5b6d42[_0x2ed901],'orderBy':orderBy});}}}_0x578d73({'ok':0x1});}else _0x578d73({'res':0x0});});}function createAdditionalPhone(_0x209e24,_0x1f95ea,_0x1b258b,_0x3c0dc0){return new Promise(function(_0x562831,_0x54763e){return db['CmContactHasItem'][_0x3f0c('0x23')]({'where':{'CmContactId':_0x209e24,'item':_0x1b258b}})[_0x3f0c('0x1e')](function(_0x41c9ea){if(_0x41c9ea){return db[_0x3f0c('0x24')][_0x3f0c('0x25')]({'ItemTypeId':_0x1f95ea,'OrderBy':_0x3c0dc0},{'where':{'CmContactId':_0x209e24,'item':_0x1b258b}})[_0x3f0c('0x1e')](function(_0x2daed2){_0x562831({'res':_0x3f0c('0x26')});});}else{return db[_0x3f0c('0x24')][_0x3f0c('0x27')]({'CmContactId':_0x209e24,'item':_0x1b258b,'ItemTypeId':_0x1f95ea,'OrderBy':_0x3c0dc0,'ItemClass':_0x3f0c('0x28')})[_0x3f0c('0x1e')](function(_0x1717fe){_0x562831({'res':_0x3f0c('0x29')});});}});});}function updateContact(_0x4dc64e){return new Promise(function(_0x4ac429,_0x46bb4a){var _0x8f3e9d=_0x4dc64e['id'];delete _0x4dc64e['id'];return db['CmContact'][_0x3f0c('0x25')](_0x4dc64e,{'where':{'id':_0x8f3e9d}})[_0x3f0c('0x1e')](function(_0x5beeed){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x4dc64e[_0x3f0c('0x11')]},{'where':{'ContactId':_0x8f3e9d}})[_0x3f0c('0x1e')](function(_0x477ac5){_0x4ac429({'ret':'OK'});});});});}function insertCmHopper(_0x11d00b,_0x27a790,_0x222d48,_0x145ba4,_0x56208f){var _0xe92a0f=['cm_contacts.phone',_0x3f0c('0x2a'),_0x3f0c('0x2b'),_0x3f0c('0x2c'),_0x27a790+'.'+_0x145ba4,'cm_contacts.createdAt',_0x3f0c('0x2d'),_0x3f0c('0x2e'),_0x3f0c('0x2f'),'\x22'+_0x56208f+'\x22'];return squel['insert']()['into'](_0x3f0c('0x30'))[_0x3f0c('0x31')](['phone','scheduledat',_0x3f0c('0x32'),'ListId',_0x145ba4,'createdAt','updatedAt',_0x3f0c('0x33'),_0x3f0c('0x34'),'recallme'],squel['select']()[_0x3f0c('0x35')](_0xe92a0f)[_0x3f0c('0x12')](_0x27a790)[_0x3f0c('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x27a790+_0x3f0c('0x36'))['join'](_0x222d48,null,_0x222d48+_0x3f0c('0x14')+_0x27a790+'.'+_0x145ba4)[_0x3f0c('0x16')](_0x27a790+_0x3f0c('0x37'),_0x11d00b)['where'](_0x3f0c('0x38'),NOW)[_0x3f0c('0x16')](_0x3f0c('0x39'),selectNotIn(_0x27a790,_0x222d48,_0x145ba4,_0x3f0c('0x30'),[_0x3f0c('0x3a'),_0x3f0c('0x3b')]))[_0x3f0c('0x16')](_0x3f0c('0x39'),selectNotIn(_0x27a790,_0x222d48,_0x145ba4,'cm_hopper',[_0x3f0c('0x3a')])))[_0x3f0c('0x3c')]();}function insertCmHopperBlack(_0x3d0a55,_0x27f74e,_0x2d122e,_0x242865){var _0x3bc820=[_0x3f0c('0x3d'),_0x3f0c('0x2b'),_0x3f0c('0x2c'),_0x27f74e+'.'+_0x242865,'cm_contacts.createdAt',_0x3f0c('0x2d')];return squel[_0x3f0c('0x3e')]()['into'](_0x3f0c('0x3f'))['fromQuery']([_0x3f0c('0x11'),_0x3f0c('0x32'),'ListId',_0x242865,_0x3f0c('0x40'),_0x3f0c('0x41')],squel['select']()[_0x3f0c('0x35')](_0x3bc820)['from'](_0x27f74e)[_0x3f0c('0x13')]('cm_contacts',null,_0x3f0c('0x42')+_0x27f74e+_0x3f0c('0x36'))[_0x3f0c('0x13')](_0x2d122e,null,_0x2d122e+_0x3f0c('0x14')+_0x27f74e+'.'+_0x242865)[_0x3f0c('0x16')](_0x27f74e+_0x3f0c('0x37'),_0x3d0a55)[_0x3f0c('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x3f0c('0x39'),squel[_0x3f0c('0xf')]()['field']('phone')['from']('cm_hopper_black')[_0x3f0c('0x16')](_0x3f0c('0x43'),_0x3d0a55)['where'](_0x242865+'\x20=\x20?',_0x27f74e+'.'+_0x242865)))['toString']();}function insertCmHopperAdditionalPhones(_0x412c7f){var _0x8d622=[_0x3f0c('0x44'),_0x3f0c('0x45'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x3f0c('0x46')];return squel[_0x3f0c('0x3e')]()['into']('cm_hopper_additional_phones')[_0x3f0c('0x31')]([_0x3f0c('0x47'),_0x3f0c('0x11'),_0x3f0c('0x48'),'createdAt','updatedAt'],squel[_0x3f0c('0xf')]()['fields'](_0x8d622)[_0x3f0c('0x12')](_0x3f0c('0x30'))[_0x3f0c('0x13')](_0x3f0c('0x49'),null,_0x3f0c('0x4a'))[_0x3f0c('0x13')]('cm_contact_has_items',null,_0x3f0c('0x4b'))['where']('cm_hopper.ListId\x20=\x20?',_0x412c7f)['where'](_0x3f0c('0x38'),NOW))[_0x3f0c('0x3c')]();}function insertCmContact(_0x5d2efe,_0x3818d6,_0x3c2ad5,_0x3b4e20){var _0x5318d5=_[_0x3f0c('0x4c')](_[_0x3f0c('0x4d')](_0x3b4e20),[_0x3f0c('0x4e'),_0x3f0c('0x4f'),_0x3f0c('0x40'),'updatedAt']);return squel[_0x3f0c('0x3e')]()[_0x3f0c('0x50')](_0x3f0c('0x49'))['fromQuery'](_0x5318d5,squel[_0x3f0c('0xf')]()[_0x3f0c('0x35')](_0x5318d5)[_0x3f0c('0x12')](_0x3818d6)[_0x3f0c('0x16')]('('+_0x3c2ad5[_0x3f0c('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x3f0c('0xf')]()[_0x3f0c('0x35')](_0x3c2ad5)['from'](_0x3f0c('0x49'))['where'](_0x3f0c('0x43'),_0x5d2efe))[_0x3f0c('0x16')]('id\x20IN\x20?',squel['select']()['field'](_0x3f0c('0x51'),_0x3f0c('0x52'))[_0x3f0c('0x12')](_0x3818d6)[_0x3f0c('0x53')](_0x3c2ad5['join'](','))))['toString']();}function handleStop(){logger[_0x3f0c('0x54')](_0x3f0c('0x55'));stopped=!![];}function handleUncaughtException(_0x2efb37){logger[_0x3f0c('0x56')](_0x2efb37[_0x3f0c('0x57')]);process[_0x3f0c('0x58')](0x1);}function handleError(_0x5b45c8,_0x9538f3){stats[_0x3f0c('0x59')][_0x3f0c('0x1c')]({'name':_0x9538f3['code'],'message':_0x9538f3[_0x3f0c('0x57')],'row':_0x5b45c8});}function handleQuery(_0x56d005){logger[_0x3f0c('0x54')](_0x56d005);return db[_0x3f0c('0x5a')][_0x3f0c('0x18')](_0x56d005)[_0x3f0c('0x5b')](function(_0x55f555){results[_0x3f0c('0x1c')](_0x55f555);})[_0x3f0c('0x1f')](function(_0x405efb){logger['error'](_0x405efb[_0x3f0c('0x57')]);});}function main(_0x3b6f38,_0x14e216,_0x5ae23d,_0x18f628){logger[_0x3f0c('0x54')](_0x3f0c('0x5c'),_0x3b6f38,JSON['stringify'](_0x14e216));process[_0x3f0c('0x5d')](_0x3f0c('0x5e'));var _0x5aaf08=_0x14e216[_0x3f0c('0x5f')];var _0x5cc033=_[_0x3f0c('0x60')](_0x5aaf08);var _0x3245c9=_0x14e216[_0x3f0c('0x61')];var _0x5c1625=path['join'](config[_0x3f0c('0x62')],'server/files/tmp',_0x3245c9+'.csv');logger[_0x3f0c('0x54')](_0x3f0c('0x63'),_0x14e216);db['ContactItemType'][_0x3f0c('0x64')]({'raw':!![],'attributes':['id',_0x3f0c('0x65')]})[_0x3f0c('0x1e')](function(_0x4cc27e){for(var _0x3057e6=0x0;_0x3057e6<_0x4cc27e[_0x3f0c('0x1a')];_0x3057e6++){if(_0x4cc27e[_0x3057e6][_0x3f0c('0x65')]in _0x5aaf08){contactItemTypes[_0x3f0c('0x1c')](_0x4cc27e[_0x3057e6]);delete _0x5cc033[_0x4cc27e[_0x3057e6][_0x3f0c('0x65')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x5cc033[_0x3f0c('0x20')]='';var _0x11f2ae=_[_0x3f0c('0x4d')](_0x5cc033)[_0x3f0c('0x13')]();logger[_0x3f0c('0x54')](_0x3f0c('0x66'),_0x11f2ae);fs[_0x3f0c('0x67')](_0x5c1625,_0x11f2ae+'\x0a');Papa['parse'](fs['createReadStream'](_0x3b6f38),{'header':!![],'skipEmptyLines':!![],'step':function(_0x46799d,_0x5a498b){try{for(var _0x54cec2=0x0,_0x100756=[];_0x54cec2<_0x46799d[_0x3f0c('0x68')]['length'];_0x54cec2++){stats['rows']+=0x1;if(_0x46799d['errors'][_0x54cec2]){handleError(_0x46799d[_0x3f0c('0x68')][_0x54cec2],_0x46799d[_0x3f0c('0x59')][_0x54cec2]);}else{var _0x299e31=[];var _0x2e9afb=[];for(var _0xbd721b in _0x5aaf08){let _0x2d4d55=contactItemTypes['find'](_0x34dd95=>_0x34dd95['name']===_0xbd721b);if(_[_0x3f0c('0x1b')](_0x2d4d55)){if(_0x5aaf08[_0x3f0c('0x69')](_0xbd721b)){if(_0x46799d['data'][_0x54cec2][_0x5aaf08[_0xbd721b]]){var _0x58f4c6=_[_0x3f0c('0x6a')](_0x46799d[_0x3f0c('0x68')][_0x54cec2][_0x5aaf08[_0xbd721b]][_0x3f0c('0x6b')](/"/g,'\x27'));switch(_0xbd721b){case _0x3f0c('0x6c'):var _0x3c36a0=moment(_0x58f4c6,_0x3f0c('0xb'),!![]);if(_0x3c36a0[_0x3f0c('0x6d')]()){_0x100756[_0x3f0c('0x1c')]('\x22'+_0x58f4c6+'\x22');}else{_0x299e31[_0x3f0c('0x1c')](_0x3f0c('0x6e'));}break;case _0x3f0c('0x33'):var _0x94962d=parseInt(_0x58f4c6);_0x58f4c6=_[_0x3f0c('0x6f')](_0x94962d)||_0x94962d<0x0||_0x94962d>0x4?_0x18f628?0x3:0x2:_0x94962d;_0x100756['push']('\x22'+_0x58f4c6+'\x22');break;case _0x3f0c('0x34'):var _0x130028=parseInt(_0x58f4c6);if(_['isNumber'](_0x130028)&&_['includes'](_0x5ae23d,_0x130028)){_0x100756[_0x3f0c('0x1c')]('\x22'+_0x130028+'\x22');}else{_0x299e31['push'](_0x3f0c('0x70'));}break;case _0x3f0c('0x71'):if(isEmail(_0x58f4c6)){_0x100756[_0x3f0c('0x1c')]('\x22'+_0x58f4c6+'\x22');}else{_0x299e31[_0x3f0c('0x1c')](_0x3f0c('0x72'));}break;case _0x3f0c('0x73'):var _0x1ff431=moment(_0x58f4c6,_0x3f0c('0x74'),!![]);if(_0x1ff431['isValid']()){_0x100756[_0x3f0c('0x1c')]('\x22'+_0x58f4c6+'\x22');}else{_0x299e31['push'](_0x3f0c('0x75'));}break;default:_0x100756[_0x3f0c('0x1c')]('\x22'+_0x58f4c6+'\x22');}}else{switch(_0xbd721b){case _0x3f0c('0x76'):case _0x3f0c('0x11'):_0x299e31[_0x3f0c('0x1c')](_0xbd721b+_0x3f0c('0x77'));break;default:_0x100756['push']('\x22\x22');}}}}else{var _0x3d4eb4='';for(var _0x1dd2bf=0x0;_0x1dd2bf<_0x5aaf08[_0xbd721b][_0x3f0c('0x1a')];_0x1dd2bf++){var _0x58f4c6=_[_0x3f0c('0x6a')](_0x46799d[_0x3f0c('0x68')][_0x54cec2][_0x5aaf08[_0xbd721b][_0x1dd2bf]][_0x3f0c('0x6b')](/"/g,'\x27'));if(_0x3d4eb4=='')_0x3d4eb4=_0x58f4c6;else _0x3d4eb4+='|'+_0x58f4c6;}_0x2e9afb[_0x3f0c('0x1c')](_0x2d4d55['id']+':'+_0x3d4eb4);}}if(hasAdditionalPhones){_0x100756[_0x3f0c('0x1c')]('\x22'+_0x2e9afb[_0x3f0c('0x13')](';')+'\x22');}if(_0x299e31[_0x3f0c('0x1a')]){handleError(_0x46799d[_0x3f0c('0x68')][_0x54cec2],{'code':_0x3f0c('0x78'),'message':_0x299e31[_0x3f0c('0x13')]()});}else{fs['appendFileSync'](_0x5c1625,_0x100756[_0x3f0c('0x13')]()+'\x0a');}_0x100756=[];}if(!(stats[_0x3f0c('0x79')]%0xc8)){socket[_0x3f0c('0x7a')](_0x3f0c('0x7b')+_0x3245c9,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x3f0c('0x7c'));_0x5a498b[_0x3f0c('0x7d')]();}}catch(_0x3d3717){handleError(_0x46799d['data'][_0x54cec2],{'code':_0x3f0c('0x7e'),'message':_0x3d3717[_0x3f0c('0x57')]});logger['error']('step',_0x3d3717[_0x3f0c('0x57')]);}},'complete':function(){try{var _0x1b0c05=[];var _0x4f59b1=tempTableName;_0x1b0c05['push'](_0x3f0c('0x7f')+_0x4f59b1+_0x3f0c('0x80'));logger[_0x3f0c('0x54')](_0x3f0c('0x81'),contactItemTypes[_0x3f0c('0x1a')]);var _0xc0049f=util[_0x3f0c('0xa')](_0x3f0c('0x82'),_0x5c1625,_0x4f59b1,_0x11f2ae,_0x14e216[_0x3f0c('0x4e')],_0x14e216[_0x3f0c('0x4f')]||null,NOW,NOW);if(_['isNil'](_0x5aaf08['scheduledat'])){_0xc0049f+=',\x20scheduledAt\x20=\x20NOW()';}_0x1b0c05[_0x3f0c('0x1c')](_0xc0049f);BPromise[_0x3f0c('0x83')](_0x1b0c05,handleQuery)[_0x3f0c('0x1e')](function(_0x2d1b13){BPromise[_0x3f0c('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x1b0c05=[];for(var _0x2eeef2=0x0;_0x2eeef2_0x49213b[_0x39be('0x64')]===_0xb542cd);if(_[_0x39be('0x1a')](_0x2e6964)){if(_0x95ba88['hasOwnProperty'](_0xb542cd)){if(_0x41cee6[_0x39be('0x68')][_0x58e464][_0x95ba88[_0xb542cd]]){var _0x1002b5=_[_0x39be('0x6b')](_0x41cee6['data'][_0x58e464][_0x95ba88[_0xb542cd]][_0x39be('0x6c')](/"/g,'\x27'));switch(_0xb542cd){case _0x39be('0x6d'):var _0x146aca=moment(_0x1002b5,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x146aca[_0x39be('0x6e')]()){_0x3d464b[_0x39be('0x1c')]('\x22'+_0x1002b5+'\x22');}else{_0x9a1732[_0x39be('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x39be('0x37'):var _0x3a88bc=parseInt(_0x1002b5);_0x1002b5=_[_0x39be('0x6f')](_0x3a88bc)||_0x3a88bc<0x0||_0x3a88bc>0x4?_0x41f65b?0x3:0x2:_0x3a88bc;_0x3d464b['push']('\x22'+_0x1002b5+'\x22');break;case _0x39be('0x38'):var _0x4e0958=parseInt(_0x1002b5);if(_[_0x39be('0x70')](_0x4e0958)&&_[_0x39be('0x71')](_0x1d073e,_0x4e0958)){_0x3d464b[_0x39be('0x1c')]('\x22'+_0x4e0958+'\x22');}else{_0x9a1732[_0x39be('0x1c')](_0x39be('0x72'));}break;case'email':if(isEmail(_0x1002b5)){_0x3d464b[_0x39be('0x1c')]('\x22'+_0x1002b5+'\x22');}else{_0x9a1732[_0x39be('0x1c')](_0x39be('0x73'));}break;case _0x39be('0x74'):var _0x48eb6c=moment(_0x1002b5,_0x39be('0x75'),!![]);if(_0x48eb6c[_0x39be('0x6e')]()){_0x3d464b[_0x39be('0x1c')]('\x22'+_0x1002b5+'\x22');}else{_0x9a1732[_0x39be('0x1c')](_0x39be('0x76'));}break;default:_0x3d464b[_0x39be('0x1c')]('\x22'+_0x1002b5+'\x22');}}else{switch(_0xb542cd){case _0x39be('0x77'):case _0x39be('0x2c'):_0x9a1732[_0x39be('0x1c')](_0xb542cd+_0x39be('0x78'));break;default:_0x3d464b[_0x39be('0x1c')]('\x22\x22');}}}}else{var _0x15e81b='';for(var _0xf03b35=0x0;_0xf03b35<_0x95ba88[_0xb542cd][_0x39be('0x21')];_0xf03b35++){var _0x1002b5=_[_0x39be('0x6b')](_0x41cee6[_0x39be('0x68')][_0x58e464][_0x95ba88[_0xb542cd][_0xf03b35]]['replace'](/"/g,'\x27'));if(_0x15e81b=='')_0x15e81b=_0x1002b5;else _0x15e81b+='|'+_0x1002b5;}_0x3a202e['push'](_0x2e6964['id']+':'+_0x15e81b);}}if(hasAdditionalPhones){_0x3d464b[_0x39be('0x1c')]('\x22'+_0x3a202e[_0x39be('0x11')](';')+'\x22');}if(_0x9a1732[_0x39be('0x21')]){handleError(_0x41cee6[_0x39be('0x68')][_0x58e464],{'code':_0x39be('0x79'),'message':_0x9a1732[_0x39be('0x11')]()});}else{fs[_0x39be('0x7a')](_0x4af0fc,_0x3d464b['join']()+'\x0a');}_0x3d464b=[];}if(!(stats[_0x39be('0x69')]%0xc8)){socket[_0x39be('0x7b')](_0x39be('0x7c')+_0x36e46e,stats);stats[_0x39be('0x56')]=[];}}if(stopped){logger[_0x39be('0x58')](_0x39be('0x7d'));_0x403c86[_0x39be('0x7e')]();}}catch(_0x4452af){handleError(_0x41cee6[_0x39be('0x68')][_0x58e464],{'code':'SystemError','message':_0x4452af[_0x39be('0x20')]});logger[_0x39be('0x1f')](_0x39be('0x7f'),_0x4452af[_0x39be('0x20')]);}},'complete':function(){try{var _0x2e2a5a=[];var _0x3b8c86=tempTableName;_0x2e2a5a['push'](_0x39be('0x80')+_0x3b8c86+_0x39be('0x81'));logger['info']('CIS\x20len',contactItemTypes['length']);var _0xf612e9=util['format'](_0x39be('0x82'),_0x4af0fc,_0x3b8c86,_0x257f82,_0x14978b[_0x39be('0x34')],_0x14978b[_0x39be('0x50')]||null,NOW,NOW);if(_[_0x39be('0x1a')](_0x95ba88['scheduledat'])){_0xf612e9+=_0x39be('0x83');}_0x2e2a5a[_0x39be('0x1c')](_0xf612e9);BPromise[_0x39be('0x84')](_0x2e2a5a,handleQuery)[_0x39be('0x1d')](function(_0x546e26){BPromise[_0x39be('0x22')]([handleAdditionalPhones()])['then'](function(){_0x2e2a5a=[];for(var _0x49fa85=0x0;_0x49fa85\x20\x20');}var _0x198a53=path[_0x39be('0x11')](config['root'],_0x39be('0x5f'),process[_0x39be('0x8b')][0x2]);if(!fs[_0x39be('0x8c')](_0x198a53)){throw new Error(_0x39be('0x8d'));}var _0x1e1f9c={};try{_0x1e1f9c=JSON['parse'](process['argv'][0x3]);if(!_0x1e1f9c[_0x39be('0x5b')]){throw new Error(_0x39be('0x8e'));}var _0xec8bdd=0x0;if(_0x1e1f9c[_0x39be('0x5b')][_0x39be('0x38')]){_0xec8bdd=0x1;}if(!_0x1e1f9c[_0x39be('0x34')]){throw new Error(_0x39be('0x8f'));}}catch(_0x115d19){throw new Error('body\x20id\x20mandatory');}var _0x28bc28=[];try{_0x28bc28=_[_0x39be('0x90')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x3e0cdf){logger['info'](_0x39be('0x91'));}main(_0x198a53,_0x1e1f9c,_0x28bc28,_0xec8bdd);}validate();process['on'](_0x39be('0x92'),handleStop);process['on'](_0x39be('0x93'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index bed8a95..6dd59c2 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb59=['Date','agentcalledAt','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','membername','starttime','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','destexten','Queue','UniqueId','uniqueid'];(function(_0x21125f,_0x8079f8){var _0x2f421d=function(_0x231299){while(--_0x231299){_0x21125f['push'](_0x21125f['shift']());}};_0x2f421d(++_0x8079f8);}(_0xbb59,0xec));var _0x9bb5=function(_0x250b94,_0x9359f9){_0x250b94=_0x250b94-0x0;var _0x57778c=_0xbb59[_0x250b94];return _0x57778c;};'use strict';exports[_0x9bb5('0x0')]=function(_0x98f149,_0xc97996){var _0x4ef2af=[{'type':'string','content':_0x9bb5('0x1'),'variableName':null}];switch(_0x98f149[_0x9bb5('0x2')]()){case _0x9bb5('0x3'):switch(_0xc97996[_0x9bb5('0x2')]()){case _0x9bb5('0x4'):_0x4ef2af['push']({'type':_0x9bb5('0x5'),'content':'','variableName':_0x9bb5('0x6')});_0x4ef2af[_0x9bb5('0x7')]({'type':_0x9bb5('0x5'),'content':'','variableName':_0x9bb5('0x8')});break;case _0x9bb5('0x9'):_0x4ef2af[_0x9bb5('0x7')]({'type':_0x9bb5('0xa'),'content':_0x9bb5('0xb'),'variableName':null});_0x4ef2af[_0x9bb5('0x7')]({'type':_0x9bb5('0x5'),'content':'','variableName':_0x9bb5('0xc')});break;}}return _0x4ef2af;};exports[_0x9bb5('0xd')]=function(_0x52c501,_0x3e00d0){var _0x2bb647=[];switch(_0x52c501[_0x9bb5('0x2')]()){case _0x9bb5('0x3'):switch(_0x3e00d0[_0x9bb5('0x2')]()){case _0x9bb5('0x4'):_0x2bb647=[{'type':_0x9bb5('0xa'),'content':_0x9bb5('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x10'),'keyType':_0x9bb5('0x5'),'variableName':_0x9bb5('0x8')},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x11'),'keyType':'variable','variableName':'calleridname'},{'type':_0x9bb5('0xf'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0x9bb5('0x12')},{'type':'keyValue','content':'','key':_0x9bb5('0x13'),'keyType':_0x9bb5('0x5'),'variableName':_0x9bb5('0x6')},{'type':'keyValue','content':'','key':_0x9bb5('0x14'),'keyType':_0x9bb5('0x5'),'variableName':_0x9bb5('0x15')},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x16'),'keyType':_0x9bb5('0x5'),'variableName':_0x9bb5('0x17')},{'type':_0x9bb5('0xa'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x9bb5('0x18'),'keyType':_0x9bb5('0x5'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0x9bb5('0x19'),'keyType':_0x9bb5('0x5'),'variableName':_0x9bb5('0xc')},{'type':'string','content':_0x9bb5('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x1b'),'keyType':_0x9bb5('0x5'),'variableName':'agentcalledAt'},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x1c'),'keyType':'variable','variableName':_0x9bb5('0x1d')},{'type':'keyValue','content':'','key':_0x9bb5('0x1e'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x1f'),'keyType':'variable','variableName':_0x9bb5('0x20')},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x21'),'keyType':'variable','variableName':'talktime'}];break;case _0x9bb5('0x9'):_0x2bb647=[{'type':_0x9bb5('0xa'),'content':_0x9bb5('0xe'),'variableName':null},{'type':'keyValue','content':'','key':_0x9bb5('0x22'),'keyType':_0x9bb5('0x5'),'keyContent':'','variableName':_0x9bb5('0xc')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x9bb5('0x23')},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x14'),'keyType':_0x9bb5('0x5'),'keyContent':'','variableName':_0x9bb5('0x15')},{'type':'keyValue','content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0x9bb5('0x24')},{'type':_0x9bb5('0xa'),'content':_0x9bb5('0x1a')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x9bb5('0x25')},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x26'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x9bb5('0xf'),'content':'','key':_0x9bb5('0x27'),'keyType':_0x9bb5('0x5'),'keyContent':'','variableName':_0x9bb5('0x28')},{'type':'keyValue','content':'','key':_0x9bb5('0x29'),'keyType':_0x9bb5('0x5'),'keyContent':'','variableName':_0x9bb5('0x2a')}];break;}}return _0x2bb647;}; \ No newline at end of file +var _0x1775=['uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';exports['getSubjects']=function(_0xb5c9b1,_0x26ce12){var _0x6abfb8=[{'type':_0x5177('0x0'),'content':_0x5177('0x1'),'variableName':null}];switch(_0xb5c9b1[_0x5177('0x2')]()){case _0x5177('0x3'):switch(_0x26ce12[_0x5177('0x2')]()){case _0x5177('0x4'):_0x6abfb8[_0x5177('0x5')]({'type':_0x5177('0x6'),'content':'','variableName':_0x5177('0x7')});_0x6abfb8[_0x5177('0x5')]({'type':_0x5177('0x6'),'content':'','variableName':_0x5177('0x8')});break;case _0x5177('0x9'):_0x6abfb8[_0x5177('0x5')]({'type':_0x5177('0x0'),'content':_0x5177('0xa'),'variableName':null});_0x6abfb8[_0x5177('0x5')]({'type':_0x5177('0x6'),'content':'','variableName':_0x5177('0xb')});break;}}return _0x6abfb8;};exports['getDescriptions']=function(_0x4ae3d2,_0x13c7f6){var _0x1d7116=[];switch(_0x4ae3d2[_0x5177('0x2')]()){case _0x5177('0x3'):switch(_0x13c7f6[_0x5177('0x2')]()){case'inbound':_0x1d7116=[{'type':_0x5177('0x0'),'content':_0x5177('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0xe'),'keyType':_0x5177('0x6'),'variableName':_0x5177('0x8')},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0xf'),'keyType':_0x5177('0x6'),'variableName':_0x5177('0x10')},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x11'),'keyType':_0x5177('0x6'),'variableName':_0x5177('0x12')},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x13'),'keyType':_0x5177('0x6'),'variableName':_0x5177('0x7')},{'type':_0x5177('0xd'),'content':'','key':'UniqueId','keyType':_0x5177('0x6'),'variableName':_0x5177('0x14')},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x15'),'keyType':'variable','variableName':_0x5177('0x16')},{'type':_0x5177('0x0'),'content':_0x5177('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5177('0x18'),'keyType':'variable','variableName':_0x5177('0x19')},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x1a'),'keyType':_0x5177('0x6'),'variableName':_0x5177('0xb')},{'type':_0x5177('0x0'),'content':_0x5177('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x1c'),'keyType':_0x5177('0x6'),'variableName':_0x5177('0x16')},{'type':_0x5177('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0x5177('0x6'),'variableName':'agentconnectAt'},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x1d'),'keyType':_0x5177('0x6'),'variableName':_0x5177('0x1e')},{'type':'keyValue','content':'','key':_0x5177('0x1f'),'keyType':'variable','variableName':'holdtime'},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x20'),'keyType':'variable','variableName':_0x5177('0x21')}];break;case'outbound':_0x1d7116=[{'type':_0x5177('0x0'),'content':_0x5177('0xc'),'variableName':null},{'type':'keyValue','content':'','key':_0x5177('0x22'),'keyType':_0x5177('0x6'),'keyContent':'','variableName':_0x5177('0xb')},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x23'),'keyType':_0x5177('0x6'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0x5177('0x24'),'keyType':_0x5177('0x6'),'keyContent':'','variableName':_0x5177('0x14')},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x15'),'keyType':_0x5177('0x6'),'keyContent':'','variableName':_0x5177('0x25')},{'type':_0x5177('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x26'),'keyType':'variable','keyContent':'','variableName':_0x5177('0x27')},{'type':'keyValue','content':'','key':_0x5177('0x28'),'keyType':_0x5177('0x6'),'keyContent':'','variableName':_0x5177('0x29')},{'type':'keyValue','content':'','key':'Duration','keyType':_0x5177('0x6'),'keyContent':'','variableName':_0x5177('0x2a')},{'type':_0x5177('0xd'),'content':'','key':_0x5177('0x2b'),'keyType':_0x5177('0x6'),'keyContent':'','variableName':_0x5177('0x2c')}];break;}}return _0x1d7116;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 0a472b6..d74df85 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1134=['upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','then','info','catch','error','tracked','user','query','clone','body','omit','phone','fax','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions'];(function(_0xb3275c,_0x2623c3){var _0x58e50b=function(_0x2303a3){while(--_0x2303a3){_0xb3275c['push'](_0xb3275c['shift']());}};_0x58e50b(++_0x2623c3);}(_0x1134,0x19c));var _0x4113=function(_0x126a1a,_0x127dad){_0x126a1a=_0x126a1a-0x0;var _0x497cb8=_0x1134[_0x126a1a];return _0x497cb8;};'use strict';var _=require(_0x4113('0x0'));var db=require(_0x4113('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x4113('0x2')),'mail':require(_0x4113('0x3'))('mail-interactions'),'fax':require(_0x4113('0x3'))(_0x4113('0x4')),'sms':require('../../config/logger')(_0x4113('0x5')),'chat':require('../../config/logger')(_0x4113('0x6')),'whatsapp':require('../../config/logger')(_0x4113('0x7'))};function getInteractionId(_0x493b42,_0xb1cea2,_0x28520f){if(_0x493b42&&_0x493b42[_[_0x4113('0x8')](_0x28520f)+_0x4113('0x9')]){return _0x493b42[_[_0x4113('0x8')](_0x28520f)+_0x4113('0x9')];}else if(_0x493b42&&_0x493b42['id']){return _0x493b42['id'];}else if(_0xb1cea2&&_0xb1cea2['id']){return _0xb1cea2['id'];}else{return _0x4113('0xa');}}function log(_0x19b6f2,_0x5e635c,_0x85a9dd,_0x207442,_0x29c7f9,_0x1d7575){loggers[_0x29c7f9[_0x4113('0xb')]()][_0x19b6f2](_0x4113('0xc'),_0x1d7575[_0x4113('0xd')](),_0x5e635c?_0x5e635c['id']:null,_0x5e635c?_0x5e635c[_0x4113('0xe')]:null,_0x5e635c?_0x5e635c[_0x4113('0xf')]:null,getInteractionId(_0x85a9dd,_0x207442,_0x29c7f9),_0x85a9dd?JSON[_0x4113('0x10')](_0x85a9dd):'null');}function updateUser(_0x48b14c,_0x5eac36,_0x203503,_0x1d4690,_0x4ba7ce){db[_['upperFirst'](_0x1d4690)+_0x4113('0x11')]['findOne']({'where':{'id':getInteractionId(_0x5eac36,_0x203503,_0x1d4690)}})[_0x4113('0x12')](function(_0x5ab2a7){if(_0x5ab2a7){return _0x5ab2a7['update']({'UserId':_0x48b14c?_0x48b14c['id']:null});}})[_0x4113('0x12')](function(_0xe88992){if(_0xe88992){log(_0x4113('0x13'),_0x48b14c,_0x5eac36,_0x203503,_0x1d4690,_0x4ba7ce);}})[_0x4113('0x14')](function(){log(_0x4113('0x15'),_0x48b14c,_0x5eac36,_0x203503,_0x1d4690,_0x4ba7ce);});}exports[_0x4113('0x16')]=function(_0x405849,_0xa7f33d){return function(_0x1051d4,_0x1cd9ae,_0x59b821){var _0x41d58b=_0x1051d4[_0x4113('0x17')];var _0x328c8f={};var _0x1d40ba=_0x1051d4[_0x4113('0x18')];if(_0x328c8f){_0x328c8f=_[_0x4113('0x19')](_0x1051d4[_0x4113('0x1a')]);_0x328c8f=_[_0x4113('0x1b')](_0x328c8f,[_0x4113('0x1a'),'html',_0x4113('0x1c'),_0x4113('0x1d'),'mobile']);}updateUser(_0x41d58b,_0x328c8f,_0x1d40ba,_0x405849,_0xa7f33d);_0x59b821(null);};}; \ No newline at end of file +var _0xc5b4=['openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger'];(function(_0x595c11,_0x3af7d4){var _0x1cf5ef=function(_0x892003){while(--_0x892003){_0x595c11['push'](_0x595c11['shift']());}};_0x1cf5ef(++_0x3af7d4);}(_0xc5b4,0x1cb));var _0x4c5b=function(_0x351993,_0x328f4b){_0x351993=_0x351993-0x0;var _0x480003=_0xc5b4[_0x351993];return _0x480003;};'use strict';var _=require(_0x4c5b('0x0'));var db=require(_0x4c5b('0x1'))['db'];var loggers={'openchannel':require(_0x4c5b('0x2'))(_0x4c5b('0x3')),'mail':require('../../config/logger')(_0x4c5b('0x4')),'fax':require('../../config/logger')(_0x4c5b('0x5')),'sms':require('../../config/logger')(_0x4c5b('0x6')),'chat':require(_0x4c5b('0x2'))(_0x4c5b('0x7')),'whatsapp':require(_0x4c5b('0x2'))('whatsapp-interactions')};function getInteractionId(_0x4ada7a,_0x386e51,_0x233674){if(_0x4ada7a&&_0x4ada7a[_[_0x4c5b('0x8')](_0x233674)+_0x4c5b('0x9')]){return _0x4ada7a[_[_0x4c5b('0x8')](_0x233674)+_0x4c5b('0x9')];}else if(_0x4ada7a&&_0x4ada7a['id']){return _0x4ada7a['id'];}else if(_0x386e51&&_0x386e51['id']){return _0x386e51['id'];}else{return _0x4c5b('0xa');}}function log(_0x58c8fd,_0x2cd10d,_0x446733,_0x31d1d6,_0x152ebc,_0x8f6ef4){loggers[_0x152ebc['toLowerCase']()][_0x58c8fd](_0x4c5b('0xb'),_0x8f6ef4[_0x4c5b('0xc')](),_0x2cd10d?_0x2cd10d['id']:null,_0x2cd10d?_0x2cd10d[_0x4c5b('0xd')]:null,_0x2cd10d?_0x2cd10d[_0x4c5b('0xe')]:null,getInteractionId(_0x446733,_0x31d1d6,_0x152ebc),_0x446733?JSON[_0x4c5b('0xf')](_0x446733):_0x4c5b('0x10'));}function updateUser(_0x11e44b,_0x41a35a,_0x42740e,_0x56d428,_0x21a4ae){db[_[_0x4c5b('0x8')](_0x56d428)+_0x4c5b('0x11')][_0x4c5b('0x12')]({'where':{'id':getInteractionId(_0x41a35a,_0x42740e,_0x56d428)}})[_0x4c5b('0x13')](function(_0x5bdfa4){if(_0x5bdfa4){return _0x5bdfa4[_0x4c5b('0x14')]({'UserId':_0x11e44b?_0x11e44b['id']:null});}})[_0x4c5b('0x13')](function(_0x76d7bc){if(_0x76d7bc){log(_0x4c5b('0x15'),_0x11e44b,_0x41a35a,_0x42740e,_0x56d428,_0x21a4ae);}})[_0x4c5b('0x16')](function(){log(_0x4c5b('0x17'),_0x11e44b,_0x41a35a,_0x42740e,_0x56d428,_0x21a4ae);});}exports[_0x4c5b('0x18')]=function(_0x52465d,_0x8ba823){return function(_0x20c23d,_0x3afe9e,_0x3557a0){var _0xf0d210=_0x20c23d[_0x4c5b('0x19')];var _0x242a0f={};var _0x131336=_0x20c23d[_0x4c5b('0x1a')];if(_0x242a0f){_0x242a0f=_[_0x4c5b('0x1b')](_0x20c23d[_0x4c5b('0x1c')]);_0x242a0f=_[_0x4c5b('0x1d')](_0x242a0f,[_0x4c5b('0x1c'),_0x4c5b('0x1e'),_0x4c5b('0x1f'),'fax',_0x4c5b('0x20')]);}updateUser(_0xf0d210,_0x242a0f,_0x131336,_0x52465d,_0x8ba823);_0x3557a0(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 80f30dd..596d3a7 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ff6=['hasOwnProperty','License','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8ff6,0x1d8));var _0x68ff=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x8ff6[_0xc6be3a];return _0x56a310;};'use strict';var crypto=require('crypto');var util=require(_0x68ff('0x0'));var compose=require(_0x68ff('0x1'));var db=require(_0x68ff('0x2'))['db'];var config=require(_0x68ff('0x3'));function getValueFromLicense(_0x49f1d2,_0x3d3696){if(_0x49f1d2&&_0x3d3696){if(_0x3d3696[_0x68ff('0x4')]&&_0x3d3696[_0x68ff('0x5')]){var _0x3cf081=_0x3d3696[_0x68ff('0x4')];var _0x3ecf07=_0x3d3696['license'];var _0x17785c=_0x3cf081['split']('-')[0x4];var _0x2479f6=_0x3cf081[_0x68ff('0x6')]('-')[0x0];var _0x20db58=crypto[_0x68ff('0x7')](_0x68ff('0x8'),util[_0x68ff('0x9')](_0x68ff('0xa'),_0x17785c,_0x3cf081,_0x2479f6));var _0x16ba25=_0x20db58['update'](_0x3ecf07,_0x68ff('0xb'),'utf8');_0x16ba25+=_0x20db58['final']('utf8');var _0x4be9c7=JSON['parse'](_0x16ba25);return _0x4be9c7[_0x68ff('0xc')](_0x49f1d2)?_0x4be9c7[_0x49f1d2]:null;}}return null;}function isLimit(_0x5cf027,_0xcd74f9,_0x1a0d99,_0x11cd63){var _0x3bbed4=_0xcd74f9;return compose()['use'](function(_0x487fe2,_0x139cf4,_0x551755){return db[_0x68ff('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1c29cd){var _0x5b4028=getValueFromLicense(_0x5cf027,_0x1c29cd);return _0x5b4028?_0x5b4028:_0x3bbed4;})[_0x68ff('0xe')](function(_0x4d7754){_0x3bbed4=_0x4d7754;return _0x1a0d99[_0x68ff('0xf')](_0x11cd63);})[_0x68ff('0xe')](function(_0x468fdf){if(_0x468fdf>=_0x3bbed4){return _0x139cf4[_0x68ff('0x10')](0x193)['json']({'message':util[_0x68ff('0x9')](_0x68ff('0x11'),_0x5cf027)});}_0x551755();})['catch'](function(_0x17b317){_0x551755(_0x17b317);});});}function isUserLimit(){return isLimit(_0x68ff('0x12'),0x1,db[_0x68ff('0x13')],{'where':{'$or':[{'role':_0x68ff('0x14')},{'role':_0x68ff('0x15')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x302c=['../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x302c,0x89));var _0xc302=function(_0x1776e2,_0x23502e){_0x1776e2=_0x1776e2-0x0;var _0x412f4a=_0x302c[_0x1776e2];return _0x412f4a;};'use strict';var crypto=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var compose=require(_0xc302('0x2'));var db=require(_0xc302('0x3'))['db'];var config=require(_0xc302('0x4'));function getValueFromLicense(_0x59aaa5,_0x4618d0){if(_0x59aaa5&&_0x4618d0){if(_0x4618d0[_0xc302('0x5')]&&_0x4618d0[_0xc302('0x6')]){var _0x4d0026=_0x4618d0[_0xc302('0x5')];var _0x243dfb=_0x4618d0[_0xc302('0x6')];var _0x28d9de=_0x4d0026[_0xc302('0x7')]('-')[0x4];var _0x55846c=_0x4d0026[_0xc302('0x7')]('-')[0x0];var _0x568682=crypto[_0xc302('0x8')](_0xc302('0x9'),util[_0xc302('0xa')](_0xc302('0xb'),_0x28d9de,_0x4d0026,_0x55846c));var _0x1f8db9=_0x568682['update'](_0x243dfb,'base64',_0xc302('0xc'));_0x1f8db9+=_0x568682['final'](_0xc302('0xc'));var _0x4ff3fb=JSON['parse'](_0x1f8db9);return _0x4ff3fb[_0xc302('0xd')](_0x59aaa5)?_0x4ff3fb[_0x59aaa5]:null;}}return null;}function isLimit(_0x11f086,_0x853cd9,_0x470f96,_0x1d3fb3){var _0x349441=_0x853cd9;return compose()[_0xc302('0xe')](function(_0x7cd9a8,_0x41c2f7,_0x1975c5){return db[_0xc302('0xf')][_0xc302('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x191623){var _0x316dec=getValueFromLicense(_0x11f086,_0x191623);return _0x316dec?_0x316dec:_0x349441;})[_0xc302('0x11')](function(_0x4ab1a8){_0x349441=_0x4ab1a8;return _0x470f96[_0xc302('0x12')](_0x1d3fb3);})[_0xc302('0x11')](function(_0xa28104){if(_0xa28104>=_0x349441){return _0x41c2f7[_0xc302('0x13')](0x193)[_0xc302('0x14')]({'message':util[_0xc302('0xa')](_0xc302('0x15'),_0x11f086)});}_0x1975c5();})[_0xc302('0x16')](function(_0x98f96d){_0x1975c5(_0x98f96d);});});}function isUserLimit(){return isLimit(_0xc302('0x17'),0x1,db[_0xc302('0x18')],{'where':{'$or':[{'role':_0xc302('0x19')},{'role':_0xc302('0x1a')}]}});}exports[_0xc302('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8a2a0bb..02cf5d1 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 _0xe6fb=['$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','add','hours','minutes','seconds','moment','parseSearch','[$or]','split','slice','forEach','shift','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','includes','$notIn','\x20OR\x20','$in','IN\x20?','$eq','=\x20?','$ne','<>\x20?','$substring'];(function(_0x983dc2,_0x5cca11){var _0x4b0315=function(_0x1042f9){while(--_0x1042f9){_0x983dc2['push'](_0x983dc2['shift']());}};_0x4b0315(++_0x5cca11);}(_0xe6fb,0x1e3));var _0xbe6f=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0xe6fb[_0x135704];return _0x24e9fd;};'use strict';var _=require('lodash');var moment=require(_0xbe6f('0x0'));exports[_0xbe6f('0x1')]=function(_0x580125){var _0x10d0e4={'conditions':[]};_0x10d0e4['sqlOperator']=_['startsWith'](_0x580125,_0xbe6f('0x2'))?'or':'and';var _0x450b40=_0x580125['replace']('[$and]','')['replace'](_0xbe6f('0x2'),'')['split']('||');for(var _0x4fd232=0x0;_0x4fd232<_0x450b40['length'];_0x4fd232++){var _0x3da326=_0x450b40[_0x4fd232][_0xbe6f('0x3')](':=');var _0x63d045=_0x3da326[0x0];var _0x21970=_0x3da326[_0xbe6f('0x4')](0x1);_0x21970[_0xbe6f('0x5')](function(_0x35e987){var _0x1dce4c=_0x35e987['split']('[')[_0xbe6f('0x6')]();var _0x5b0635=_0x35e987['match'](/\[(.*?)\]/g);_0x5b0635[_0xbe6f('0x5')](function(_0x115b49){var _0x555990=_0x115b49['split']('[')[_0xbe6f('0x7')](function(_0x4aecfa){return _0x4aecfa[_0xbe6f('0x8')](']')>-0x1;})[_0xbe6f('0x9')](function(_0x1c2620){return _0x1c2620[_0xbe6f('0x3')](']')[0x0];})[0x0];_0x10d0e4[_0xbe6f('0xa')][_0xbe6f('0xb')]({'field':_0x63d045,'operator':_0x1dce4c,'value':_0x555990});});});}return _0x10d0e4;};exports[_0xbe6f('0xc')]=function(_0x5332e9,_0x370f62,_0x245691){var _0x265478={};if(_0x370f62===_0xbe6f('0xd')){if(_0x245691[_0xbe6f('0xe')]==='$eq'){_0x245691['operator']=_0xbe6f('0xf');_0x245691[_0xbe6f('0x10')]+=','+_0x245691[_0xbe6f('0x10')];}else if(_['includes']([_0xbe6f('0x11'),_0xbe6f('0x12')],_0x245691[_0xbe6f('0xe')])){_0x245691[_0xbe6f('0x10')]=moment(_0x245691[_0xbe6f('0x10')])['add'](0x1,_0xbe6f('0x13'))[_0xbe6f('0x14')](_0xbe6f('0x15'));}}if(_0x245691[_0xbe6f('0x16')]){_0x370f62=_0x245691[_0xbe6f('0x16')];_0x265478['text']=_0xbe6f('0x17')+_0x5332e9+'.'+_0x245691[_0xbe6f('0x18')]+_0xbe6f('0x19')+_0x245691[_0xbe6f('0x16')]+')\x20'+parseOperator(_0x245691[_0xbe6f('0xe')]);}else{_0x265478[_0xbe6f('0x1a')]=_0x5332e9+'.'+_0x245691[_0xbe6f('0x18')]+'\x20'+parseOperator(_0x245691[_0xbe6f('0xe')]);}if(_[_0xbe6f('0x1b')](['$ne',_0xbe6f('0x1c')],_0x245691[_0xbe6f('0xe')]))_0x265478[_0xbe6f('0x1a')]='('+_0x265478['text']+_0xbe6f('0x1d')+_0x5332e9+'.'+_0x245691[_0xbe6f('0x18')]+'\x20IS\x20NULL)';_0x265478['value']=parseValue(_0x370f62,_0x245691[_0xbe6f('0xe')],_0x245691[_0xbe6f('0x10')]);return _0x265478;};function parseOperator(_0x4b903e){var _0x510db8;switch(_0x4b903e){case _0xbe6f('0x1e'):_0x510db8=_0xbe6f('0x1f');break;case _0xbe6f('0x1c'):_0x510db8='NOT\x20IN\x20?';break;case _0xbe6f('0x20'):_0x510db8=_0xbe6f('0x21');break;case _0xbe6f('0x22'):_0x510db8=_0xbe6f('0x23');break;case _0xbe6f('0x24'):case _0xbe6f('0x25'):case _0xbe6f('0x26'):_0x510db8=_0xbe6f('0x27');break;case _0xbe6f('0x28'):_0x510db8=_0xbe6f('0x29');break;case _0xbe6f('0x11'):_0x510db8=_0xbe6f('0x2a');break;case _0xbe6f('0x12'):_0x510db8='<=\x20?';break;case _0xbe6f('0x2b'):_0x510db8=_0xbe6f('0x2c');break;case _0xbe6f('0xf'):_0x510db8=_0xbe6f('0x2d');break;}return _0x510db8;}function parseValue(_0xfa4032,_0x21026c,_0xdaf3ed){var _0x22ee72={'start':undefined,'end':undefined};switch(_0x21026c){case _0xbe6f('0x1e'):case _0xbe6f('0x1c'):_0x22ee72['start']=_0xdaf3ed[_0xbe6f('0x3')](',');break;case _0xbe6f('0x24'):_0x22ee72[_0xbe6f('0x2e')]='%'+_0xdaf3ed+'%';break;case _0xbe6f('0x25'):_0x22ee72['start']=_0xdaf3ed+'%';break;case _0xbe6f('0x26'):_0x22ee72['start']='%'+_0xdaf3ed;break;case _0xbe6f('0xf'):var _0x3d3e96=_0xdaf3ed['split'](',');var _0xdaf3ed=_0x3d3e96[_0xbe6f('0x6')]();var _0x1af011=_0x3d3e96['pop']();if(_0xfa4032===_0xbe6f('0xd')){_0xdaf3ed=moment(_0xdaf3ed)[_0xbe6f('0x2f')](0x0,!![])[_0xbe6f('0x14')]();_0x1af011=moment(_0x1af011)[_0xbe6f('0x2f')](0x0,!![])[_0xbe6f('0x30')](0x17,_0xbe6f('0x31'))['add'](0x3b,_0xbe6f('0x32'))[_0xbe6f('0x30')](0x3b,_0xbe6f('0x33'))[_0xbe6f('0x14')]();}_0x22ee72={'start':_0xdaf3ed,'end':_0x1af011};break;default:_0x22ee72['start']=_0xdaf3ed;break;}return _0x22ee72;} \ No newline at end of file +var _0x27ba=['operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','includes','$ne','$notIn','field','\x20IS\x20NULL)','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','[$and]','replace','[$or]','split','length','slice','shift','match','filter','indexOf','map','push','buildExpression','DATE'];(function(_0x1ce7d5,_0x5198eb){var _0x586b82=function(_0x49cb85){while(--_0x49cb85){_0x1ce7d5['push'](_0x1ce7d5['shift']());}};_0x586b82(++_0x5198eb);}(_0x27ba,0x97));var _0xa27b=function(_0x23c9e0,_0x46f2e1){_0x23c9e0=_0x23c9e0-0x0;var _0x1238bb=_0x27ba[_0x23c9e0];return _0x1238bb;};'use strict';var _=require(_0xa27b('0x0'));var moment=require(_0xa27b('0x1'));exports[_0xa27b('0x2')]=function(_0x215551){var _0x1c6a1e={'conditions':[]};_0x1c6a1e[_0xa27b('0x3')]=_[_0xa27b('0x4')](_0x215551,'[$or]')?'or':_0xa27b('0x5');var _0x5011df=_0x215551['replace'](_0xa27b('0x6'),'')[_0xa27b('0x7')](_0xa27b('0x8'),'')[_0xa27b('0x9')]('||');for(var _0x42a253=0x0;_0x42a253<_0x5011df[_0xa27b('0xa')];_0x42a253++){var _0x50fd44=_0x5011df[_0x42a253][_0xa27b('0x9')](':=');var _0x3f32be=_0x50fd44[0x0];var _0x5aa359=_0x50fd44[_0xa27b('0xb')](0x1);_0x5aa359['forEach'](function(_0x449c63){var _0x110d38=_0x449c63[_0xa27b('0x9')]('[')[_0xa27b('0xc')]();var _0x38e4c5=_0x449c63[_0xa27b('0xd')](/\[(.*?)\]/g);_0x38e4c5['forEach'](function(_0x242a0f){var _0x190fd1=_0x242a0f['split']('[')[_0xa27b('0xe')](function(_0x17b517){return _0x17b517[_0xa27b('0xf')](']')>-0x1;})[_0xa27b('0x10')](function(_0x1bdadc){return _0x1bdadc[_0xa27b('0x9')](']')[0x0];})[0x0];_0x1c6a1e['conditions'][_0xa27b('0x11')]({'field':_0x3f32be,'operator':_0x110d38,'value':_0x190fd1});});});}return _0x1c6a1e;};exports[_0xa27b('0x12')]=function(_0x3fbf32,_0x4ac1e3,_0x4325d3){var _0xa5506d={};if(_0x4ac1e3===_0xa27b('0x13')){if(_0x4325d3[_0xa27b('0x14')]==='$eq'){_0x4325d3[_0xa27b('0x14')]=_0xa27b('0x15');_0x4325d3[_0xa27b('0x16')]+=','+_0x4325d3[_0xa27b('0x16')];}else if(_['includes']([_0xa27b('0x17'),_0xa27b('0x18')],_0x4325d3[_0xa27b('0x14')])){_0x4325d3['value']=moment(_0x4325d3[_0xa27b('0x16')])[_0xa27b('0x19')](0x1,_0xa27b('0x1a'))[_0xa27b('0x1b')](_0xa27b('0x1c'));}}if(_0x4325d3[_0xa27b('0x1d')]){_0x4ac1e3=_0x4325d3[_0xa27b('0x1d')];_0xa5506d[_0xa27b('0x1e')]=_0xa27b('0x1f')+_0x3fbf32+'.'+_0x4325d3['field']+_0xa27b('0x20')+_0x4325d3[_0xa27b('0x1d')]+')\x20'+parseOperator(_0x4325d3['operator']);}else{_0xa5506d[_0xa27b('0x1e')]=_0x3fbf32+'.'+_0x4325d3['field']+'\x20'+parseOperator(_0x4325d3[_0xa27b('0x14')]);}if(_[_0xa27b('0x21')]([_0xa27b('0x22'),_0xa27b('0x23')],_0x4325d3[_0xa27b('0x14')]))_0xa5506d[_0xa27b('0x1e')]='('+_0xa5506d[_0xa27b('0x1e')]+'\x20OR\x20'+_0x3fbf32+'.'+_0x4325d3[_0xa27b('0x24')]+_0xa27b('0x25');_0xa5506d[_0xa27b('0x16')]=parseValue(_0x4ac1e3,_0x4325d3['operator'],_0x4325d3[_0xa27b('0x16')]);return _0xa5506d;};function parseOperator(_0x3dac1c){var _0x22459d;switch(_0x3dac1c){case'$in':_0x22459d='IN\x20?';break;case _0xa27b('0x23'):_0x22459d=_0xa27b('0x26');break;case _0xa27b('0x27'):_0x22459d=_0xa27b('0x28');break;case _0xa27b('0x22'):_0x22459d='<>\x20?';break;case _0xa27b('0x29'):case _0xa27b('0x2a'):case _0xa27b('0x2b'):_0x22459d=_0xa27b('0x2c');break;case _0xa27b('0x2d'):_0x22459d=_0xa27b('0x2e');break;case'$gt':_0x22459d='>\x20?';break;case'$lte':_0x22459d=_0xa27b('0x2f');break;case _0xa27b('0x30'):_0x22459d=_0xa27b('0x31');break;case _0xa27b('0x15'):_0x22459d=_0xa27b('0x32');break;}return _0x22459d;}function parseValue(_0x557620,_0xdd38bf,_0x11fecb){var _0x37ffb6={'start':undefined,'end':undefined};switch(_0xdd38bf){case _0xa27b('0x33'):case _0xa27b('0x23'):_0x37ffb6[_0xa27b('0x34')]=_0x11fecb[_0xa27b('0x9')](',');break;case'$substring':_0x37ffb6[_0xa27b('0x34')]='%'+_0x11fecb+'%';break;case'$startsWith':_0x37ffb6['start']=_0x11fecb+'%';break;case'$endsWith':_0x37ffb6[_0xa27b('0x34')]='%'+_0x11fecb;break;case _0xa27b('0x15'):var _0x567335=_0x11fecb[_0xa27b('0x9')](',');var _0x11fecb=_0x567335['shift']();var _0x4f7567=_0x567335['pop']();if(_0x557620===_0xa27b('0x13')){_0x11fecb=moment(_0x11fecb)[_0xa27b('0x35')](0x0,!![])[_0xa27b('0x1b')]();_0x4f7567=moment(_0x4f7567)[_0xa27b('0x35')](0x0,!![])[_0xa27b('0x19')](0x17,_0xa27b('0x36'))['add'](0x3b,_0xa27b('0x37'))[_0xa27b('0x19')](0x3b,_0xa27b('0x38'))[_0xa27b('0x1b')]();}_0x37ffb6={'start':_0x11fecb,'end':_0x4f7567};break;default:_0x37ffb6['start']=_0x11fecb;break;}return _0x37ffb6;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e387694..f3648ae 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 _0x562b=['sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','^[0-9]*$','isEmail','match','getFullTextValue','push','toString','join','lodash','moment','split','forOwn','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','subtract','isArray','limit','offset'];(function(_0x3bd9a4,_0x3e36be){var _0x13f704=function(_0x867931){while(--_0x867931){_0x3bd9a4['push'](_0x3bd9a4['shift']());}};_0x13f704(++_0x3e36be);}(_0x562b,0x1ad));var _0xb562=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x562b[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xb562('0x0'));var sequelize=require('sequelize');var moment=require(_0xb562('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x2d2755){var _0x5622f0=null;if(_0x2d2755){_0x5622f0=_0x2d2755[_0xb562('0x2')](',');}return _0x5622f0;};exports['filters']=function(_0x35881a,_0x139185){var _0x1b5c89={};if(!_['isEmpty'](_0x35881a)){_[_0xb562('0x3')](_0x35881a,function(_0x43a9fd,_0x48a43c){try{if(_0x139185){var _0x1eca48=_['find'](_0x139185,{'name':_0x48a43c})||{};if(_0x1eca48[_0xb562('0x4')]==='DATE'&&_[_0xb562('0x5')](_0x43a9fd)){var _0x4adc72=JSON[_0xb562('0x6')](_0x43a9fd);var _0x4a19f7={'$gte':moment(moment(_0x4adc72[_0xb562('0x7')])[_0xb562('0x8')](_0xb562('0x9')))['utc']()[_0xb562('0x8')](),'$lte':moment(moment(_0x4adc72['$lte'])[_0xb562('0x8')]('YYYY-MM-DD'))[_0xb562('0xa')]()[_0xb562('0xb')](0x1,'s')[_0xb562('0x8')]()};_0x1b5c89[_0x48a43c]=_0x4a19f7;}else{_0x1b5c89[_0x48a43c]=_[_0xb562('0xc')](_0x43a9fd)?_0x43a9fd:JSON[_0xb562('0x6')](_0x43a9fd);}}else{_0x1b5c89[_0x48a43c]=_[_0xb562('0xc')](_0x43a9fd)?_0x43a9fd:JSON['parse'](_0x43a9fd);}}catch(_0x186fc2){_0x1b5c89[_0x48a43c]=_0x43a9fd[_0xb562('0x2')](',');}});}return _0x1b5c89;};exports[_0xb562('0xd')]=function(_0x213642){_0x213642=parseInt(_0x213642,0xa);if(!_0x213642||_0x213642<0x0){_0x213642=LIMIT_VALUE;}return _0x213642;};exports[_0xb562('0xe')]=function(_0x3f725b){_0x3f725b=parseInt(_0x3f725b,0xa);if(!_0x3f725b||_0x3f725b<0x0){_0x3f725b=0x0;}return _0x3f725b;};exports[_0xb562('0xf')]=function(_0x469d76){var _0x13b3c7,_0x3ecd58=null;if(_0x469d76){_0x13b3c7=_0x469d76['split'](',');_0x3ecd58=_[_0xb562('0x10')](_0x13b3c7,function(_0x5c3860){if(_0x5c3860[_0xb562('0x11')]('-')===0x0){return[_0x5c3860===_0xb562('0x12')?sequelize[_0xb562('0x13')](sequelize[_0xb562('0x14')](_0xb562('0x12')),_0xb562('0x15')):_0x5c3860['substr'](0x1),_0xb562('0x16')];}else{return[_0x5c3860===_0xb562('0x12')?sequelize[_0xb562('0x13')](sequelize[_0xb562('0x14')](_0xb562('0x12')),_0xb562('0x15')):_0x5c3860,_0xb562('0x17')];}});}return _0x3ecd58;};exports[_0xb562('0x18')]=function(_0x456031,_0x14bdbb){if(_['isEmpty'](_0x456031)){return _0x456031;}if(_[_0xb562('0xc')](_0x456031)){for(var _0x18547e=0x0;_0x18547e<_0x456031[_0xb562('0x19')];_0x18547e+=0x1){_0x456031[_0x18547e]=this['omit'](_0x456031[_0x18547e],_0x14bdbb);}return _0x456031;}if(!_[_0xb562('0x1a')](_0x456031)){return _0x456031;}if(_[_0xb562('0x1b')](_0x14bdbb)){_0x14bdbb=[_0x14bdbb];}if(!_['isArray'](_0x14bdbb)){return _0x456031;}for(var _0x33e950=0x0;_0x33e950<_0x14bdbb[_0xb562('0x19')];_0x33e950+=0x1){_['unset'](_0x456031,_0x14bdbb[_0x33e950]);}for(var _0x5e6dc6 in _0x456031){if(_0x456031[_0xb562('0x1c')](_0x5e6dc6)){_0x456031[_0x5e6dc6]=this[_0xb562('0x18')](_0x456031[_0x5e6dc6],_0x14bdbb);}}return _0x456031;};exports[_0xb562('0x1d')]=function(_0x315216){return _0x315216['match'](RegExp(_0xb562('0x1e')))?!![]:![];};exports[_0xb562('0x1f')]=function(_0x59a034){return _0x59a034[_0xb562('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xb562('0x21')]=function(_0x23b63a){var _0x5ac42b=[];_0x23b63a[_0xb562('0x2')]('\x20')['forEach'](function(_0x807edb){_0x5ac42b[_0xb562('0x22')]('+'+_0x807edb[_0xb562('0x23')]()+'*');});return _0x5ac42b[_0xb562('0x24')]('\x20');}; \ No newline at end of file +var _0x41b7=['match','isEmail','forEach','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','map','indexOf','priority','cast','col','unsigned','DESC','ASC','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric'];(function(_0x3911a4,_0x3ab9cc){var _0x56dc8d=function(_0x281271){while(--_0x281271){_0x3911a4['push'](_0x3911a4['shift']());}};_0x56dc8d(++_0x3ab9cc);}(_0x41b7,0x1bc));var _0x741b=function(_0x2fc3b2,_0x1acf79){_0x2fc3b2=_0x2fc3b2-0x0;var _0x35dd1c=_0x41b7[_0x2fc3b2];return _0x35dd1c;};'use strict';var _=require(_0x741b('0x0'));var sequelize=require(_0x741b('0x1'));var moment=require(_0x741b('0x2'));var LIMIT_VALUE=0xfa;exports[_0x741b('0x3')]=function(_0x471d15){var _0x1fb401=null;if(_0x471d15){_0x1fb401=_0x471d15[_0x741b('0x4')](',');}return _0x1fb401;};exports[_0x741b('0x5')]=function(_0x58f416,_0x1d60cf){var _0x36deed={};if(!_[_0x741b('0x6')](_0x58f416)){_[_0x741b('0x7')](_0x58f416,function(_0x354e8b,_0x13f210){try{if(_0x1d60cf){var _0x2f5077=_[_0x741b('0x8')](_0x1d60cf,{'name':_0x13f210})||{};if(_0x2f5077['type']===_0x741b('0x9')&&_[_0x741b('0xa')](_0x354e8b)){var _0x26dbb8=JSON[_0x741b('0xb')](_0x354e8b);var _0x38a7fa={'$gte':moment(moment(_0x26dbb8[_0x741b('0xc')])[_0x741b('0xd')](_0x741b('0xe')))[_0x741b('0xf')]()['format'](),'$lte':moment(moment(_0x26dbb8[_0x741b('0x10')])[_0x741b('0xd')](_0x741b('0xe')))['utc']()[_0x741b('0x11')](0x1,'s')['format']()};_0x36deed[_0x13f210]=_0x38a7fa;}else{_0x36deed[_0x13f210]=_[_0x741b('0x12')](_0x354e8b)?_0x354e8b:JSON[_0x741b('0xb')](_0x354e8b);}}else{_0x36deed[_0x13f210]=_[_0x741b('0x12')](_0x354e8b)?_0x354e8b:JSON[_0x741b('0xb')](_0x354e8b);}}catch(_0x5eb29d){_0x36deed[_0x13f210]=_0x354e8b[_0x741b('0x4')](',');}});}return _0x36deed;};exports[_0x741b('0x13')]=function(_0x4b8fc6){_0x4b8fc6=parseInt(_0x4b8fc6,0xa);if(!_0x4b8fc6||_0x4b8fc6<0x0){_0x4b8fc6=LIMIT_VALUE;}return _0x4b8fc6;};exports[_0x741b('0x14')]=function(_0x44fe67){_0x44fe67=parseInt(_0x44fe67,0xa);if(!_0x44fe67||_0x44fe67<0x0){_0x44fe67=0x0;}return _0x44fe67;};exports['sort']=function(_0x1a6906){var _0x4f20f0,_0x5812d0=null;if(_0x1a6906){_0x4f20f0=_0x1a6906[_0x741b('0x4')](',');_0x5812d0=_[_0x741b('0x15')](_0x4f20f0,function(_0x179e1c){if(_0x179e1c[_0x741b('0x16')]('-')===0x0){return[_0x179e1c===_0x741b('0x17')?sequelize[_0x741b('0x18')](sequelize[_0x741b('0x19')](_0x741b('0x17')),_0x741b('0x1a')):_0x179e1c['substr'](0x1),_0x741b('0x1b')];}else{return[_0x179e1c===_0x741b('0x17')?sequelize['cast'](sequelize[_0x741b('0x19')](_0x741b('0x17')),_0x741b('0x1a')):_0x179e1c,_0x741b('0x1c')];}});}return _0x5812d0;};exports['omit']=function(_0x5f54b9,_0x4f7fb7){if(_['isEmpty'](_0x5f54b9)){return _0x5f54b9;}if(_['isArray'](_0x5f54b9)){for(var _0x52d578=0x0;_0x52d578<_0x5f54b9[_0x741b('0x1d')];_0x52d578+=0x1){_0x5f54b9[_0x52d578]=this[_0x741b('0x1e')](_0x5f54b9[_0x52d578],_0x4f7fb7);}return _0x5f54b9;}if(!_[_0x741b('0x1f')](_0x5f54b9)){return _0x5f54b9;}if(_[_0x741b('0x20')](_0x4f7fb7)){_0x4f7fb7=[_0x4f7fb7];}if(!_['isArray'](_0x4f7fb7)){return _0x5f54b9;}for(var _0x157534=0x0;_0x157534<_0x4f7fb7['length'];_0x157534+=0x1){_[_0x741b('0x21')](_0x5f54b9,_0x4f7fb7[_0x157534]);}for(var _0x3c14d9 in _0x5f54b9){if(_0x5f54b9[_0x741b('0x22')](_0x3c14d9)){_0x5f54b9[_0x3c14d9]=this[_0x741b('0x1e')](_0x5f54b9[_0x3c14d9],_0x4f7fb7);}}return _0x5f54b9;};exports[_0x741b('0x23')]=function(_0x399007){return _0x399007[_0x741b('0x24')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x741b('0x25')]=function(_0xec3f64){return _0xec3f64[_0x741b('0x24')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x5e16b1){var _0x3ccae9=[];_0x5e16b1['split']('\x20')[_0x741b('0x26')](function(_0x22e4cd){_0x3ccae9['push']('+'+_0x22e4cd['toString']()+'*');});return _0x3ccae9[_0x741b('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/environment/development.js b/server/config/environment/development.js index e86a0b9..9493618 100644 --- a/server/config/environment/development.js +++ b/server/config/environment/development.js @@ -13,7 +13,7 @@ module.exports = { username: 'xcall', password: 'xC@LL1234', options: { - host: '127.0.0.1', + host: '192.168.1.204', port: 3306, dialect: 'mysql', dialectOptions: { @@ -32,7 +32,7 @@ module.exports = { username: 'xcall', password: 'xC@LL1234', options: { - host: '127.0.0.1', + host: '192.168.1.204', port: 3306, dialect: 'mysql', dialectOptions: { @@ -47,7 +47,7 @@ module.exports = { } }, asterisk: { - ip: '127.0.0.1', + ip: '192.168.1.204', port: '5038', username: 'xcall', password: 'xcall1234' @@ -58,11 +58,11 @@ module.exports = { }, rpc: { port: process.env.RPCPORT || 9001, - ip: process.env.RPCIP || '127.0.0.1', + ip: process.env.RPCIP || '192.168.1.204', }, agi: { port: process.env.AGIPORT || 4573, - ip: process.env.AGIIP || '127.0.0.1', + ip: process.env.AGIIP || '192.168.1.204', }, // Seed database on startup seedDB: false, diff --git a/server/config/express.js b/server/config/express.js index 8469ec9..6bf13be 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8257=['view\x20engine','html','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','moment','../mysqldb','default','production','appPath','join','root','public','development','test','client','use','set','json\x20replacer','split','static','get','views','/server/views','engine','ejs','renderFile'];(function(_0x11d080,_0x5a0c30){var _0xd90e25=function(_0xcc674e){while(--_0xcc674e){_0x11d080['push'](_0x11d080['shift']());}};_0xd90e25(++_0x5a0c30);}(_0x8257,0x89));var _0x7825=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x8257[_0x1fafa5];return _0xcf08c9;};'use strict';var express=require(_0x7825('0x0'));var favicon=require(_0x7825('0x1'));var bodyParser=require(_0x7825('0x2'));var methodOverride=require(_0x7825('0x3'));var cookieParser=require(_0x7825('0x4'));var errorHandler=require(_0x7825('0x5'));var path=require('path');var passport=require('passport');var cors=require('cors');var moment=require(_0x7825('0x6'));var config=require('./environment');var db=require(_0x7825('0x7'))['db'];exports[_0x7825('0x8')]=function(_0x2a0075){var _0x5bc420=_0x2a0075['get']('env');if(_0x5bc420===_0x7825('0x9')){_0x2a0075['set'](_0x7825('0xa'),path[_0x7825('0xb')](config[_0x7825('0xc')],_0x7825('0xd')));}if(_0x5bc420===_0x7825('0xe')||_0x5bc420===_0x7825('0xf')){_0x2a0075['set']('appPath',path[_0x7825('0xb')](config[_0x7825('0xc')],_0x7825('0x10')));_0x2a0075[_0x7825('0x11')](errorHandler());}_0x2a0075[_0x7825('0x12')](_0x7825('0x13'),function(_0xdbd424,_0xcd65b0){if(this[_0xdbd424]instanceof Date){_0xcd65b0=this[_0xdbd424]['toISOString']()[_0x7825('0x14')]('.')[0x0]+'Z';}return _0xcd65b0;});_0x2a0075[_0x7825('0x11')](express[_0x7825('0x15')](_0x2a0075[_0x7825('0x16')](_0x7825('0xa'))));_0x2a0075[_0x7825('0x12')](_0x7825('0x17'),config[_0x7825('0xc')]+_0x7825('0x18'));_0x2a0075[_0x7825('0x19')]('html',require(_0x7825('0x1a'))[_0x7825('0x1b')]);_0x2a0075[_0x7825('0x12')](_0x7825('0x1c'),_0x7825('0x1d'));_0x2a0075[_0x7825('0x11')](bodyParser['urlencoded']({'limit':_0x7825('0x1e'),'extended':!![]}));_0x2a0075['use'](bodyParser[_0x7825('0x1f')]({'limit':_0x7825('0x1e')}));_0x2a0075[_0x7825('0x11')](cors());_0x2a0075[_0x7825('0x11')](methodOverride());_0x2a0075['use'](cookieParser());_0x2a0075[_0x7825('0x11')](passport[_0x7825('0x20')]());}; \ No newline at end of file +var _0x58f2=['production','set','appPath','root','client','use','json\x20replacer','toISOString','split','/server/views','engine','ejs','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','passport','cors','moment','./environment','../mysqldb','default','get'];(function(_0x96844e,_0x2bb145){var _0x4f9d58=function(_0x444047){while(--_0x444047){_0x96844e['push'](_0x96844e['shift']());}};_0x4f9d58(++_0x2bb145);}(_0x58f2,0x149));var _0x258f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x58f2[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x258f('0x0'));var favicon=require(_0x258f('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x258f('0x2'));var cookieParser=require(_0x258f('0x3'));var errorHandler=require(_0x258f('0x4'));var path=require('path');var passport=require(_0x258f('0x5'));var cors=require(_0x258f('0x6'));var moment=require(_0x258f('0x7'));var config=require(_0x258f('0x8'));var db=require(_0x258f('0x9'))['db'];exports[_0x258f('0xa')]=function(_0x2bb5c6){var _0x753bbc=_0x2bb5c6[_0x258f('0xb')]('env');if(_0x753bbc===_0x258f('0xc')){_0x2bb5c6[_0x258f('0xd')](_0x258f('0xe'),path['join'](config[_0x258f('0xf')],'public'));}if(_0x753bbc==='development'||_0x753bbc==='test'){_0x2bb5c6[_0x258f('0xd')](_0x258f('0xe'),path['join'](config['root'],_0x258f('0x10')));_0x2bb5c6[_0x258f('0x11')](errorHandler());}_0x2bb5c6[_0x258f('0xd')](_0x258f('0x12'),function(_0x51d969,_0x5e8a49){if(this[_0x51d969]instanceof Date){_0x5e8a49=this[_0x51d969][_0x258f('0x13')]()[_0x258f('0x14')]('.')[0x0]+'Z';}return _0x5e8a49;});_0x2bb5c6[_0x258f('0x11')](express['static'](_0x2bb5c6[_0x258f('0xb')](_0x258f('0xe'))));_0x2bb5c6['set']('views',config[_0x258f('0xf')]+_0x258f('0x15'));_0x2bb5c6[_0x258f('0x16')]('html',require(_0x258f('0x17'))[_0x258f('0x18')]);_0x2bb5c6['set'](_0x258f('0x19'),_0x258f('0x1a'));_0x2bb5c6['use'](bodyParser[_0x258f('0x1b')]({'limit':_0x258f('0x1c'),'extended':!![]}));_0x2bb5c6[_0x258f('0x11')](bodyParser[_0x258f('0x1d')]({'limit':'50mb'}));_0x2bb5c6[_0x258f('0x11')](cors());_0x2bb5c6[_0x258f('0x11')](methodOverride());_0x2bb5c6['use'](cookieParser());_0x2bb5c6[_0x258f('0x11')](passport[_0x258f('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e68b523..e347853 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 _0x9a5a=['mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','md5','update','digest','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','filter','family','IPv4','head'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9a5a,0x194));var _0xa9a5=function(_0x560eb7,_0x271378){_0x560eb7=_0x560eb7-0x0;var _0x12e3e7=_0x9a5a[_0x560eb7];return _0x12e3e7;};'use strict';var _=require(_0xa9a5('0x0'));var os=require('os');var crypto=require(_0xa9a5('0x1'));var machine=require(_0xa9a5('0x2'));var exec=require(_0xa9a5('0x3'))[_0xa9a5('0x4')];function getInterfaces(){var _0x500287=[];var _0x28e2b3=os[_0xa9a5('0x5')]();var _0x230710=_[_0xa9a5('0x6')](_[_0xa9a5('0x7')](_0x28e2b3));for(var _0x1ae623=0x0;_0x1ae623<_0x230710['length'];_0x1ae623++){var _0xb0ccd9=_0x28e2b3[_0x230710[_0x1ae623]][_0xa9a5('0x8')](function(_0x20bbe8){return _0x20bbe8[_0xa9a5('0x9')]===_0xa9a5('0xa')&&_0x20bbe8['internal']===![];});_0x500287=_0x500287['concat'](_0xb0ccd9);}return _0x500287;}function getFirstInterface(){var _0x57d90b=_[_0xa9a5('0xb')](getInterfaces());return{'macAddress':_0x57d90b&&_0x57d90b[_0xa9a5('0xc')]?_0x57d90b[_0xa9a5('0xc')]:_0xa9a5('0xd'),'ipAddress':_0x57d90b&&_0x57d90b[_0xa9a5('0xe')]?_0x57d90b[_0xa9a5('0xe')]:_0xa9a5('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x54b0b4=_['orderBy'](os[_0xa9a5('0x10')]()[_0xa9a5('0x11')](function(_0x3a5084){return _0x3a5084[_0xa9a5('0x12')];}))[_0xa9a5('0x13')](':');return crypto['createHash'](_0xa9a5('0x14'))[_0xa9a5('0x15')](_0x54b0b4)[_0xa9a5('0x16')](_0xa9a5('0x17'));}exports[_0xa9a5('0x18')]=function(){switch(os[_0xa9a5('0x19')]()){case'win32':return exec(_0xa9a5('0x1a'),{'encoding':_0xa9a5('0x1b')})[_0xa9a5('0x1c')]('\x0d\x0a','');default:var _0x1b5d78=getFirstInterface();var _0x5bbfeb=getCPUhash();var _0x3353ca=_0x5bbfeb+'|'+os[_0xa9a5('0x1d')]()+'|'+_0x1b5d78[_0xa9a5('0x1e')]+'|'+_0x1b5d78['ipAddress'];var _0x3c505b=crypto['createHash']('md5')[_0xa9a5('0x15')](_0x3353ca)[_0xa9a5('0x16')]('hex');return _0x3c505b[_0xa9a5('0x1f')](0x0,0x8)+'-'+_0x3c505b['substring'](0x8,0xc)+'-'+_0x3c505b[_0xa9a5('0x1f')](0xc,0x10)+'-'+_0x3c505b[_0xa9a5('0x1f')](0x10,0x14)+'-'+_0x3c505b[_0xa9a5('0x1f')](0x14);}}; \ No newline at end of file +var _0x10af=['update','digest','hex','platform','utf8','replace','macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','family','IPv4','internal','mac','00:00:00:00:00:00','127.0.0.1','map','model','join','createHash','md5'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0x10af,0xfc));var _0xf10a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x10af[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xf10a('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xf10a('0x1'));var exec=require(_0xf10a('0x2'))[_0xf10a('0x3')];function getInterfaces(){var _0x211890=[];var _0x453e1a=os[_0xf10a('0x4')]();var _0xbffc71=_[_0xf10a('0x5')](_['keys'](_0x453e1a));for(var _0x32060a=0x0;_0x32060a<_0xbffc71[_0xf10a('0x6')];_0x32060a++){var _0x5c9a4c=_0x453e1a[_0xbffc71[_0x32060a]]['filter'](function(_0x8c9add){return _0x8c9add[_0xf10a('0x7')]===_0xf10a('0x8')&&_0x8c9add[_0xf10a('0x9')]===![];});_0x211890=_0x211890['concat'](_0x5c9a4c);}return _0x211890;}function getFirstInterface(){var _0x2045aa=_['head'](getInterfaces());return{'macAddress':_0x2045aa&&_0x2045aa[_0xf10a('0xa')]?_0x2045aa['mac']:_0xf10a('0xb'),'ipAddress':_0x2045aa&&_0x2045aa['address']?_0x2045aa['address']:_0xf10a('0xc')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3558c6=_[_0xf10a('0x5')](os['cpus']()[_0xf10a('0xd')](function(_0x24632c){return _0x24632c[_0xf10a('0xe')];}))[_0xf10a('0xf')](':');return crypto[_0xf10a('0x10')](_0xf10a('0x11'))[_0xf10a('0x12')](_0x3558c6)[_0xf10a('0x13')](_0xf10a('0x14'));}exports['getUuid']=function(){switch(os[_0xf10a('0x15')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf10a('0x16')})[_0xf10a('0x17')]('\x0d\x0a','');default:var _0x484c3a=getFirstInterface();var _0x10fa6f=getCPUhash();var _0x18cb80=_0x10fa6f+'|'+os['hostname']()+'|'+_0x484c3a[_0xf10a('0x18')]+'|'+_0x484c3a[_0xf10a('0x19')];var _0x6f2520=crypto[_0xf10a('0x10')](_0xf10a('0x11'))[_0xf10a('0x12')](_0x18cb80)[_0xf10a('0x13')](_0xf10a('0x14'));return _0x6f2520[_0xf10a('0x1a')](0x0,0x8)+'-'+_0x6f2520[_0xf10a('0x1a')](0x8,0xc)+'-'+_0x6f2520[_0xf10a('0x1a')](0xc,0x10)+'-'+_0x6f2520['substring'](0x10,0x14)+'-'+_0x6f2520[_0xf10a('0x1a')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 35b6969..c94e71b 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 _0xc5df=['NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','error','message','finally','getUuid','findOrCreate','spread','default','moment','request-promise','version','../../mysqldb','../environment','./hardware','../logger','../../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','catch','createCipher','aes-256-ctr','session','update','base64','final','secrets','utf8','User','email','|uuid|','|machineUuid|','|name|','fullname','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0xb1dd54,_0x2aaade){var _0x1ae74b=function(_0xebb64c){while(--_0xebb64c){_0xb1dd54['push'](_0xb1dd54['shift']());}};_0x1ae74b(++_0x2aaade);}(_0xc5df,0x80));var _0xfc5d=function(_0x31b5a3,_0x3c77d4){_0x31b5a3=_0x31b5a3-0x0;var _0x40ffcb=_0xc5df[_0x31b5a3];return _0x40ffcb;};'use strict';var util=require('util');var crypto=require('crypto');var moment=require(_0xfc5d('0x0'));var rp=require(_0xfc5d('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xfc5d('0x2'));var db=require(_0xfc5d('0x3'))['db'];var config=require(_0xfc5d('0x4'));var hardware=require(_0xfc5d('0x5'));var logger=require(_0xfc5d('0x6'))('license');var jira=require(_0xfc5d('0x7'));var HOST=_0xfc5d('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x1b8b10){return new BPromise(function(_0x535aa7,_0x2a38ce){var _0x240ba0=util['format'](_0xfc5d('0x9'),HOST,_0x1b8b10,module[_0xfc5d('0xa')]['version']);if(oldToken){_0x240ba0=util[_0xfc5d('0xb')](_0xfc5d('0xc'),HOST,_0x1b8b10,module['exports'][_0xfc5d('0x2')],oldToken);}var _0x30f2a2={'uri':_0x240ba0,'method':_0xfc5d('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x30f2a2)[_0xfc5d('0xe')](function(_0x4e8ead){_0x535aa7(_0x4e8ead);})[_0xfc5d('0xf')](function(_0x376aff){_0x2a38ce(_0x376aff);});});}function encryptDate(_0xa2421d){var _0x4f364c=crypto[_0xfc5d('0x10')](_0xfc5d('0x11'),config['secrets'][_0xfc5d('0x12')]);var _0x57581b=_0x4f364c[_0xfc5d('0x13')](_0xa2421d,'utf8',_0xfc5d('0x14'));_0x57581b+=_0x4f364c[_0xfc5d('0x15')](_0xfc5d('0x14'));return _0x57581b;}function decryptDate(_0x105bea){var _0x1271c1=crypto['createDecipher'](_0xfc5d('0x11'),config[_0xfc5d('0x16')]['session']);var _0x26f84a=_0x1271c1['update'](_0x105bea,_0xfc5d('0x14'),'utf8');_0x26f84a+=_0x1271c1[_0xfc5d('0x15')](_0xfc5d('0x17'));return _0x26f84a;}function sendJiraAlert(_0x1b8c0d,_0x1bcee2,_0x396de4){var _0x4e6aa6='||FIELD||VALUE||\x0a';return db[_0xfc5d('0x18')]['findOne']({'where':{'role':'admin'},'attributes':['fullname',_0xfc5d('0x19')],'raw':!![]})['then'](function(_0x146a2a){ADMIN=_0x146a2a;_0x4e6aa6+='|reason|'+_0x396de4+'|\x0a';_0x4e6aa6+=_0xfc5d('0x1a')+_0x1b8c0d+'|\x0a';_0x4e6aa6+=_0xfc5d('0x1b')+_0x1bcee2+'|\x0a';_0x4e6aa6+=_0xfc5d('0x1c')+ADMIN[_0xfc5d('0x1d')]+'|\x0a';_0x4e6aa6+='|email|'+ADMIN['email']+'|\x0a';return _0x4e6aa6;})['then'](function(_0x469e4){var _0x8c2b1b=hardware[_0xfc5d('0x1e')]()['ipAddress'];return jira[_0xfc5d('0x1f')]({'key':_0xfc5d('0x20'),'summary':_0xfc5d('0x21'),'description':_0x469e4,'issuetype':_0xfc5d('0x22'),'oldToken':_0x1b8c0d,'newToken':_0x1bcee2,'email':ADMIN[_0xfc5d('0x19')],'name':ADMIN[_0xfc5d('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x8c2b1b});});}function manageLicense(_0x64cf33,_0x5c2392){var _0x533d18=_0x5c2392[_0xfc5d('0x23')]({'plain':!![]});httpRequest(_0x64cf33)['then'](function(_0x581519){if(oldToken){oldToken=undefined;}if(_0x581519[_0xfc5d('0x24')]){if(!_0x533d18['license']&&_0x533d18[_0xfc5d('0x25')]!=_0x581519[_0xfc5d('0x25')]||_0x533d18['license']&&_0x533d18[_0xfc5d('0x26')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x533d18[_0xfc5d('0x25')]&&!_0x533d18[_0xfc5d('0x26')]&&_0x533d18[_0xfc5d('0x25')]!=_0x581519[_0xfc5d('0x25')]){logger[_0xfc5d('0x27')](_0xfc5d('0x28'));}if(_0x533d18[_0xfc5d('0x25')]&&!_0x533d18['data2']&&_0x533d18[_0xfc5d('0x25')]==_0x581519['license']){return _0x5c2392;}return _0x5c2392[_0xfc5d('0x13')]({'data1':_0x64cf33,'data2':null,'license':_0x581519[_0xfc5d('0x25')]});}else{if(_0x581519['license']||_0x533d18[_0xfc5d('0x25')]){if(!_0x533d18[_0xfc5d('0x26')]){if(_0x533d18[_0xfc5d('0x29')]==_0x64cf33){GRAY_PERIOD_REASON='Disabled';logger[_0xfc5d('0x27')](_0xfc5d('0x2a'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x533d18[_0xfc5d('0x29')];logger['info'](_0xfc5d('0x2b'),_0x533d18[_0xfc5d('0x29')],_0x64cf33);}sendJiraAlert(_0x533d18[_0xfc5d('0x29')],_0x581519[_0xfc5d('0x2c')],GRAY_PERIOD_REASON);logger[_0xfc5d('0x27')](_0xfc5d('0x2d'),GRAY_PERIOD_REASON[_0xfc5d('0x2e')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5c2392['update']({'data2':encryptDate(moment()['format'](_0xfc5d('0x2f')))});}else{if(moment()[_0xfc5d('0x30')](decryptDate(_0x533d18[_0xfc5d('0x26')]),_0xfc5d('0x31'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xfc5d('0xb')](_0xfc5d('0x2f')));return _0x5c2392[_0xfc5d('0x13')]({'data1':_0x64cf33,'data2':null,'license':null});}}}else{if(_0x533d18[_0xfc5d('0x29')]!=_0x64cf33){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x533d18[_0xfc5d('0x29')],_0x64cf33);return _0x5c2392[_0xfc5d('0x13')]({'data1':_0x64cf33,'data2':null,'license':null});}}}return _0x5c2392;})[_0xfc5d('0xe')](function(_0x101dc2){_0x5c2392=_0x101dc2;})[_0xfc5d('0xf')](function(_0x3a3203){logger[_0xfc5d('0x32')](_0x3a3203[_0xfc5d('0x33')]);})[_0xfc5d('0x34')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5c2392);},TIME);});}function defaultLicense(){var _0x11ff09=hardware[_0xfc5d('0x35')]();if(_0x11ff09){return db['License'][_0xfc5d('0x36')]({'where':{'id':0x1},'defaults':{'data1':_0x11ff09}})[_0xfc5d('0x37')](function(_0x4db127,_0x579fab){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x11ff09);manageLicense(_0x11ff09,_0x4db127);})['catch'](function(_0x158c7f){logger['error'](_0x158c7f[_0xfc5d('0x33')]);});}}exports[_0xfc5d('0x38')]=defaultLicense; \ No newline at end of file +var _0x082a=['base64','createDecipher','aes-256-ctr','||FIELD||VALUE||\x0a','findOne','admin','email','|reason|','|machineUuid|','fullname','|email|','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','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','diff','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','error','default','crypto','moment','request-promise','pkginfo','version','../../mysqldb','../environment','./hardware','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','createCipher','secrets','session','update','utf8'];(function(_0x322cbd,_0x36095c){var _0x8db788=function(_0x124ce1){while(--_0x124ce1){_0x322cbd['push'](_0x322cbd['shift']());}};_0x8db788(++_0x36095c);}(_0x082a,0x154));var _0xa082=function(_0x24597e,_0x4dd50b){_0x24597e=_0x24597e-0x0;var _0x31312c=_0x082a[_0x24597e];return _0x31312c;};'use strict';var util=require('util');var crypto=require(_0xa082('0x0'));var moment=require(_0xa082('0x1'));var rp=require(_0xa082('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xa082('0x3'))(module,_0xa082('0x4'));var db=require(_0xa082('0x5'))['db'];var config=require(_0xa082('0x6'));var hardware=require(_0xa082('0x7'));var logger=require('../logger')(_0xa082('0x8'));var jira=require('../../api/jira/jira.controller');var HOST=_0xa082('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x41030c){return new BPromise(function(_0x5ae561,_0x31c98d){var _0x193550=util[_0xa082('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x41030c,module[_0xa082('0xb')][_0xa082('0x4')]);if(oldToken){_0x193550=util[_0xa082('0xa')](_0xa082('0xc'),HOST,_0x41030c,module[_0xa082('0xb')]['version'],oldToken);}var _0x1fcf69={'uri':_0x193550,'method':_0xa082('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x1fcf69)[_0xa082('0xe')](function(_0x5798dc){_0x5ae561(_0x5798dc);})['catch'](function(_0x21cf44){_0x31c98d(_0x21cf44);});});}function encryptDate(_0x18d742){var _0x473b1d=crypto[_0xa082('0xf')]('aes-256-ctr',config[_0xa082('0x10')][_0xa082('0x11')]);var _0xe0276=_0x473b1d[_0xa082('0x12')](_0x18d742,_0xa082('0x13'),_0xa082('0x14'));_0xe0276+=_0x473b1d['final'](_0xa082('0x14'));return _0xe0276;}function decryptDate(_0x1eb38a){var _0x5cce12=crypto[_0xa082('0x15')](_0xa082('0x16'),config[_0xa082('0x10')][_0xa082('0x11')]);var _0x507d9c=_0x5cce12['update'](_0x1eb38a,_0xa082('0x14'),_0xa082('0x13'));_0x507d9c+=_0x5cce12['final'](_0xa082('0x13'));return _0x507d9c;}function sendJiraAlert(_0x536ffa,_0xeaa1ce,_0x284376){var _0x127b29=_0xa082('0x17');return db['User'][_0xa082('0x18')]({'where':{'role':_0xa082('0x19')},'attributes':['fullname',_0xa082('0x1a')],'raw':!![]})[_0xa082('0xe')](function(_0x417943){ADMIN=_0x417943;_0x127b29+=_0xa082('0x1b')+_0x284376+'|\x0a';_0x127b29+='|uuid|'+_0x536ffa+'|\x0a';_0x127b29+=_0xa082('0x1c')+_0xeaa1ce+'|\x0a';_0x127b29+='|name|'+ADMIN[_0xa082('0x1d')]+'|\x0a';_0x127b29+=_0xa082('0x1e')+ADMIN['email']+'|\x0a';return _0x127b29;})[_0xa082('0xe')](function(_0x1c1575){var _0x4fdc57=hardware['getFirstInterface']()[_0xa082('0x1f')];return jira[_0xa082('0x20')]({'key':_0xa082('0x21'),'summary':_0xa082('0x22'),'description':_0x1c1575,'issuetype':_0xa082('0x23'),'oldToken':_0x536ffa,'newToken':_0xeaa1ce,'email':ADMIN[_0xa082('0x1a')],'name':ADMIN[_0xa082('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x4fdc57});});}function manageLicense(_0x457ca9,_0x273812){var _0x388b1e=_0x273812[_0xa082('0x24')]({'plain':!![]});httpRequest(_0x457ca9)[_0xa082('0xe')](function(_0x3032d2){if(oldToken){oldToken=undefined;}if(_0x3032d2[_0xa082('0x25')]){if(!_0x388b1e[_0xa082('0x8')]&&_0x388b1e[_0xa082('0x8')]!=_0x3032d2[_0xa082('0x8')]||_0x388b1e[_0xa082('0x8')]&&_0x388b1e[_0xa082('0x26')]){logger[_0xa082('0x27')](_0xa082('0x28'));}if(_0x388b1e[_0xa082('0x8')]&&!_0x388b1e[_0xa082('0x26')]&&_0x388b1e[_0xa082('0x8')]!=_0x3032d2[_0xa082('0x8')]){logger[_0xa082('0x27')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x388b1e[_0xa082('0x8')]&&!_0x388b1e[_0xa082('0x26')]&&_0x388b1e[_0xa082('0x8')]==_0x3032d2[_0xa082('0x8')]){return _0x273812;}return _0x273812[_0xa082('0x12')]({'data1':_0x457ca9,'data2':null,'license':_0x3032d2['license']});}else{if(_0x3032d2[_0xa082('0x8')]||_0x388b1e[_0xa082('0x8')]){if(!_0x388b1e['data2']){if(_0x388b1e['data1']==_0x457ca9){GRAY_PERIOD_REASON='Disabled';logger[_0xa082('0x27')](_0xa082('0x29'));}else{GRAY_PERIOD_REASON=_0xa082('0x2a');oldToken=_0x388b1e[_0xa082('0x2b')];logger[_0xa082('0x27')](_0xa082('0x2c'),_0x388b1e[_0xa082('0x2b')],_0x457ca9);}sendJiraAlert(_0x388b1e[_0xa082('0x2b')],_0x3032d2[_0xa082('0x2d')],GRAY_PERIOD_REASON);logger[_0xa082('0x27')](_0xa082('0x2e'),GRAY_PERIOD_REASON[_0xa082('0x2f')](),moment()[_0xa082('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x273812['update']({'data2':encryptDate(moment()['format'](_0xa082('0x30')))});}else{if(moment()[_0xa082('0x31')](decryptDate(_0x388b1e[_0xa082('0x26')]),'days')>DAYS){logger['info'](_0xa082('0x32'),moment()[_0xa082('0xa')](_0xa082('0x30')));return _0x273812['update']({'data1':_0x457ca9,'data2':null,'license':null});}}}else{if(_0x388b1e[_0xa082('0x2b')]!=_0x457ca9){logger['info'](_0xa082('0x2c'),_0x388b1e[_0xa082('0x2b')],_0x457ca9);return _0x273812['update']({'data1':_0x457ca9,'data2':null,'license':null});}}}return _0x273812;})[_0xa082('0xe')](function(_0x2e3c3c){_0x273812=_0x2e3c3c;})['catch'](function(_0xa14d14){logger['error'](_0xa14d14[_0xa082('0x33')]);})[_0xa082('0x34')](function(){setTimeout(function(){manageLicense(hardware[_0xa082('0x35')](),_0x273812);},TIME);});}function defaultLicense(){var _0x3fbfdd=hardware[_0xa082('0x35')]();if(_0x3fbfdd){return db[_0xa082('0x36')][_0xa082('0x37')]({'where':{'id':0x1},'defaults':{'data1':_0x3fbfdd}})['spread'](function(_0xa942c9,_0x182f82){logger[_0xa082('0x27')](_0xa082('0x38'),_0x3fbfdd);manageLicense(_0x3fbfdd,_0xa942c9);})[_0xa082('0x39')](function(_0x1a2286){logger[_0xa082('0x3a')](_0x1a2286['message']);});}}exports[_0xa082('0x3b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ec8f788..f2cdbd2 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 _0xffc1=['find','defaults','then','checkLicense','crypto','lodash','moment','./hardware','../environment','../../mysqldb','license','License\x20key\x20value\x20not\x20found','data1','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','demo','uuid','machineUuid','session','deadline','days','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License'];(function(_0x4e5e44,_0x4d5edd){var _0x3da510=function(_0xd72595){while(--_0xd72595){_0x4e5e44['push'](_0x4e5e44['shift']());}};_0x3da510(++_0x4d5edd);}(_0xffc1,0x1b4));var _0x1ffc=function(_0x2ce7bb,_0x559369){_0x2ce7bb=_0x2ce7bb-0x0;var _0x15eed5=_0xffc1[_0x2ce7bb];return _0x15eed5;};'use strict';var crypto=require(_0x1ffc('0x0'));var util=require('util');var _=require(_0x1ffc('0x1'));var moment=require(_0x1ffc('0x2'));var hardware=require(_0x1ffc('0x3'));var config=require(_0x1ffc('0x4'));var db=require(_0x1ffc('0x5'))['db'];function checkLicense(_0x56dd3d,_0x51af89){if(_0x56dd3d){try{var _0x19c8fa=_0x51af89||_0x56dd3d[_0x1ffc('0x6')];if(_['isEmpty'](_0x19c8fa)){throw new Error(_0x1ffc('0x7'));}var _0x12168b=_0x56dd3d[_0x1ffc('0x8')];var _0x4156d2=_0x56dd3d['data2'];var _0x2e6c1b=_0x12168b[_0x1ffc('0x9')]('-')[0x4];var _0x1f0a10=_0x12168b[_0x1ffc('0x9')]('-')[0x0];var _0x5b9cf3=crypto[_0x1ffc('0xa')](_0x1ffc('0xb'),util[_0x1ffc('0xc')]('%s:%s:%s',_0x2e6c1b,_0x12168b,_0x1f0a10));var _0xb02043=_0x5b9cf3[_0x1ffc('0xd')](_0x19c8fa,_0x1ffc('0xe'),_0x1ffc('0xf'));_0xb02043+=_0x5b9cf3[_0x1ffc('0x10')]('utf8');var _0x2e367c=JSON[_0x1ffc('0x11')](_0xb02043);_0x2e367c[_0x1ffc('0x12')]=![];_0x2e367c[_0x1ffc('0x13')]=_0x12168b;_0x2e367c[_0x1ffc('0x14')]=hardware['getUuid']();if(_0x4156d2){var _0x827033=crypto[_0x1ffc('0xa')](_0x1ffc('0xb'),config['secrets'][_0x1ffc('0x15')]);var _0x265daa=_0x827033[_0x1ffc('0xd')](_0x4156d2,_0x1ffc('0xe'),_0x1ffc('0xf'));_0x265daa+=_0x827033[_0x1ffc('0x10')]('utf8');_0x2e367c['gray']=_0x265daa;_0x2e367c[_0x1ffc('0x16')]=moment(_0x265daa)['add'](0x7,_0x1ffc('0x17'))[_0x1ffc('0xc')]();_0x2e367c['grayReason']=_0x2e367c[_0x1ffc('0x13')]!=_0x2e367c[_0x1ffc('0x14')]?_0x1ffc('0x18'):_0x1ffc('0x19');}return _0x2e367c;}catch(_0x3071da){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1ffc('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1ffc('0x1b'),'uuid':_0x56dd3d['data1'],'machineUuid':hardware['getUuid'](),'message':_0x3071da[_0x1ffc('0x1c')],'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':_0x1ffc('0x1d'),'uuid':_0x56dd3d[_0x1ffc('0x8')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x1ffc('0x1e')]=function(_0x286cdd){return db[_0x1ffc('0x1f')][_0x1ffc('0x20')](_[_0x1ffc('0x21')](_0x286cdd,{'raw':!![],'where':{'id':0x1}}))[_0x1ffc('0x22')](function(_0x161207){return checkLicense(_0x161207,null);});};exports[_0x1ffc('0x23')]=checkLicense; \ No newline at end of file +var _0x970d=['base64','final','utf8','demo','uuid','machineUuid','getUuid','secrets','session','gray','add','days','grayReason','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','License','find','then','checkLicense','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','format','%s:%s:%s','update'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x970d,0x14e));var _0xd970=function(_0xf66a25,_0x527689){_0xf66a25=_0xf66a25-0x0;var _0x231422=_0x970d[_0xf66a25];return _0x231422;};'use strict';var crypto=require(_0xd970('0x0'));var util=require(_0xd970('0x1'));var _=require(_0xd970('0x2'));var moment=require(_0xd970('0x3'));var hardware=require(_0xd970('0x4'));var config=require(_0xd970('0x5'));var db=require(_0xd970('0x6'))['db'];function checkLicense(_0x469e97,_0x42f35d){if(_0x469e97){try{var _0x4dad70=_0x42f35d||_0x469e97[_0xd970('0x7')];if(_[_0xd970('0x8')](_0x4dad70)){throw new Error(_0xd970('0x9'));}var _0x220b73=_0x469e97[_0xd970('0xa')];var _0x5e4d09=_0x469e97[_0xd970('0xb')];var _0x3f529a=_0x220b73[_0xd970('0xc')]('-')[0x4];var _0x58ccf7=_0x220b73[_0xd970('0xc')]('-')[0x0];var _0x34317e=crypto['createDecipher'](_0xd970('0xd'),util[_0xd970('0xe')](_0xd970('0xf'),_0x3f529a,_0x220b73,_0x58ccf7));var _0x3b176a=_0x34317e[_0xd970('0x10')](_0x4dad70,_0xd970('0x11'),'utf8');_0x3b176a+=_0x34317e[_0xd970('0x12')](_0xd970('0x13'));var _0x2534f4=JSON['parse'](_0x3b176a);_0x2534f4[_0xd970('0x14')]=![];_0x2534f4[_0xd970('0x15')]=_0x220b73;_0x2534f4[_0xd970('0x16')]=hardware[_0xd970('0x17')]();if(_0x5e4d09){var _0x4fcccf=crypto['createDecipher'](_0xd970('0xd'),config[_0xd970('0x18')][_0xd970('0x19')]);var _0xaca945=_0x4fcccf[_0xd970('0x10')](_0x5e4d09,_0xd970('0x11'),_0xd970('0x13'));_0xaca945+=_0x4fcccf[_0xd970('0x12')]('utf8');_0x2534f4[_0xd970('0x1a')]=_0xaca945;_0x2534f4['deadline']=moment(_0xaca945)[_0xd970('0x1b')](0x7,_0xd970('0x1c'))['format']();_0x2534f4[_0xd970('0x1d')]=_0x2534f4[_0xd970('0x15')]!=_0x2534f4[_0xd970('0x16')]?'changed':_0xd970('0x1e');}return _0x2534f4;}catch(_0x32f52e){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd970('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd970('0x20'),'uuid':_0x469e97[_0xd970('0xa')],'machineUuid':hardware['getUuid'](),'message':_0x32f52e[_0xd970('0x21')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd970('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd970('0x22'),'uuid':_0x469e97['data1'],'machineUuid':hardware[_0xd970('0x17')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x5c32a7){return db[_0xd970('0x23')][_0xd970('0x24')](_['defaults'](_0x5c32a7,{'raw':!![],'where':{'id':0x1}}))[_0xd970('0x25')](function(_0x5fce43){return checkLicense(_0x5fce43,null);});};exports[_0xd970('0x26')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 4526e8d..507a7d6 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 _0x8f41=['http://localhost:9000','app-id','secret','exports'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0x8f41,0x1c3));var _0x18f4=function(_0xec192d,_0x289873){_0xec192d=_0xec192d-0x0;var _0x510e5b=_0x8f41[_0xec192d];return _0x510e5b;};'use strict';module[_0x18f4('0x0')]={'DOMAIN':_0x18f4('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x18f4('0x2'),'GOOGLE_SECRET':_0x18f4('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x41ee=['http://localhost:9000','app-id','exports'];(function(_0x194262,_0x54eb5c){var _0x5eaf44=function(_0x454013){while(--_0x454013){_0x194262['push'](_0x194262['shift']());}};_0x5eaf44(++_0x54eb5c);}(_0x41ee,0x9b));var _0xe41e=function(_0x34298b,_0x3e5e07){_0x34298b=_0x34298b-0x0;var _0x28a747=_0x41ee[_0x34298b];return _0x28a747;};'use strict';module[_0xe41e('0x0')]={'DOMAIN':_0xe41e('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xe41e('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 38cd765..c251c6a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9de4=['xcally','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','Logger','transports','%s-%s','error','info','env','debugLevel','moment','winston','util','path','INFO','log'];(function(_0x22d2ff,_0x56a793){var _0x4a50b6=function(_0x54512c){while(--_0x54512c){_0x22d2ff['push'](_0x22d2ff['shift']());}};_0x4a50b6(++_0x56a793);}(_0x9de4,0x6c));var _0x49de=function(_0x404a0e,_0x3ef091){_0x404a0e=_0x404a0e-0x0;var _0x43b331=_0x9de4[_0x404a0e];return _0x43b331;};'use strict';var moment=require(_0x49de('0x0'));var winston=require(_0x49de('0x1'));var util=require(_0x49de('0x2'));var path=require(_0x49de('0x3'));var debugLevel=_0x49de('0x4');function filename(_0x3db435,_0x2e3a0a){return path['join']('/var',_0x49de('0x5'),_0x49de('0x6'),util[_0x49de('0x7')]('%s-%s.log',_0x3db435,_0x2e3a0a));}function formatter(_0xbb2ce,_0x2a7e01){return util[_0x49de('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x49de('0x7')](_0x49de('0x8')),_0x2a7e01[_0x49de('0x9')][_0x49de('0xa')](),_0xbb2ce,_0x2a7e01[_0x49de('0xb')]);}module['exports']=function(_0x3fae8c){return new winston[(_0x49de('0xc'))]({'transports':[new winston[(_0x49de('0xd'))]['File']({'name':util[_0x49de('0x7')](_0x49de('0xe'),_0x3fae8c,'error'),'filename':filename(_0x3fae8c,_0x49de('0xf')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2fe81d){return formatter(_0x3fae8c,_0x2fe81d);}}),new winston['transports']['File']({'name':util[_0x49de('0x7')](_0x49de('0xe'),_0x3fae8c,_0x49de('0x10')),'filename':filename(_0x3fae8c,'info'),'level':_0x49de('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4bc652){return formatter(_0x3fae8c,_0x4bc652);}}),new winston[(_0x49de('0xd'))]['Console']({'level':process[_0x49de('0x11')][_0x49de('0x12')]||debugLevel,'json':![],'formatter':function(_0x2057ac){return formatter(_0x3fae8c,_0x2057ac);}})]});}; \ No newline at end of file +var _0x7707=['Console','env','moment','winston','INFO','join','log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','message','transports','File','%s-%s','error','info'];(function(_0x52b15d,_0x111cb9){var _0x3f4bce=function(_0x3e528f){while(--_0x3e528f){_0x52b15d['push'](_0x52b15d['shift']());}};_0x3f4bce(++_0x111cb9);}(_0x7707,0x9b));var _0x7770=function(_0x269a72,_0x2ba574){_0x269a72=_0x269a72-0x0;var _0xa8f9b0=_0x7707[_0x269a72];return _0xa8f9b0;};'use strict';var moment=require(_0x7770('0x0'));var winston=require(_0x7770('0x1'));var util=require('util');var path=require('path');var debugLevel=_0x7770('0x2');function filename(_0x16ae44,_0x4e9735){return path[_0x7770('0x3')]('/var',_0x7770('0x4'),'xcally',util['format']('%s-%s.log',_0x16ae44,_0x4e9735));}function formatter(_0x404500,_0x16eda4){return util[_0x7770('0x5')](_0x7770('0x6'),moment()[_0x7770('0x5')](_0x7770('0x7')),_0x16eda4[_0x7770('0x8')]['toUpperCase'](),_0x404500,_0x16eda4[_0x7770('0x9')]);}module['exports']=function(_0x598e62){return new winston['Logger']({'transports':[new winston[(_0x7770('0xa'))][(_0x7770('0xb'))]({'name':util[_0x7770('0x5')](_0x7770('0xc'),_0x598e62,_0x7770('0xd')),'filename':filename(_0x598e62,_0x7770('0xd')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1dbdd4){return formatter(_0x598e62,_0x1dbdd4);}}),new winston['transports'][(_0x7770('0xb'))]({'name':util[_0x7770('0x5')](_0x7770('0xc'),_0x598e62,_0x7770('0xe')),'filename':filename(_0x598e62,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1c07cb){return formatter(_0x598e62,_0x1c07cb);}}),new winston[(_0x7770('0xa'))][(_0x7770('0xf'))]({'level':process[_0x7770('0x10')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x239d49){return formatter(_0x598e62,_0x239d49);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 87fbbbd..404a7ff 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 _0x2763=['../../services/express/index.js','../../services/ami/index.js','agi','join','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x2763,0x98));var _0x3276=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2763[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0x3276('0x0'));var os=require('os');var config={'apps':[{'name':_0x3276('0x1'),'script':path['join'](__dirname,_0x3276('0x2'))},{'name':'ami','script':path['join'](__dirname,_0x3276('0x3'))},{'name':_0x3276('0x4'),'script':path[_0x3276('0x5')](__dirname,_0x3276('0x6'))},{'name':_0x3276('0x7'),'script':path[_0x3276('0x5')](__dirname,_0x3276('0x8'))},{'name':_0x3276('0x9'),'script':path['join'](__dirname,_0x3276('0xa'))},{'name':_0x3276('0xb'),'script':path[_0x3276('0x5')](__dirname,_0x3276('0xc'))}]};module[_0x3276('0xd')]=config; \ No newline at end of file +var _0x2e2b=['ami','join','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','../../services/express/index.js'];(function(_0x3287a6,_0x35e598){var _0x9c6449=function(_0x407e41){while(--_0x407e41){_0x3287a6['push'](_0x3287a6['shift']());}};_0x9c6449(++_0x35e598);}(_0x2e2b,0xc9));var _0xb2e2=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x2e2b[_0x8a969d];return _0x1d8dc7;};'use strict';var path=require(_0xb2e2('0x0'));var os=require('os');var config={'apps':[{'name':_0xb2e2('0x1'),'script':path['join'](__dirname,_0xb2e2('0x2'))},{'name':_0xb2e2('0x3'),'script':path[_0xb2e2('0x4')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0xb2e2('0x4')](__dirname,_0xb2e2('0x5'))},{'name':_0xb2e2('0x6'),'script':path[_0xb2e2('0x4')](__dirname,_0xb2e2('0x7'))},{'name':_0xb2e2('0x8'),'script':path[_0xb2e2('0x4')](__dirname,_0xb2e2('0x9'))},{'name':'xdr','script':path[_0xb2e2('0x4')](__dirname,_0xb2e2('0xa'))}]};module[_0xb2e2('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f694a68..f0d2e95 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 _0x2ac4=['disconnect','stop','restart','list','describe','delete','dump','saved','bluebird','connect','connected','then'];(function(_0x46b0ed,_0x18118c){var _0xbe4c89=function(_0x1d3934){while(--_0x1d3934){_0x46b0ed['push'](_0x46b0ed['shift']());}};_0xbe4c89(++_0x18118c);}(_0x2ac4,0x68));var _0x42ac=function(_0x28c4db,_0x2ccd05){_0x28c4db=_0x28c4db-0x0;var _0x5907ed=_0x2ac4[_0x28c4db];return _0x5907ed;};'use strict';var pm2=require('pm2');var BPromise=require(_0x42ac('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x23058f,_0x39e3a3){return pm2[_0x42ac('0x1')](function(_0x3877b4){if(_0x3877b4){return _0x39e3a3(_0x3877b4);}return _0x23058f(_0x42ac('0x2'));});});};exports['start']=function(_0x13431f){return connect()[_0x42ac('0x3')](function(){return new BPromise(function(_0x4d0f9a,_0x101e11){return pm2['start'](_0x13431f,function(_0x24d253,_0x501938){if(_0x24d253){return _0x101e11(_0x24d253);}pm2[_0x42ac('0x4')]();return _0x4d0f9a(_0x501938);});});});};exports[_0x42ac('0x5')]=function(_0x2634e4){return connect()[_0x42ac('0x3')](function(){return new BPromise(function(_0xf31869,_0x578d01){return pm2[_0x42ac('0x5')](_0x2634e4,function(_0xf2ff24,_0x52134d){if(_0xf2ff24){return _0x578d01(_0xf2ff24);}pm2[_0x42ac('0x4')]();return _0xf31869(_0x52134d);});});});};exports[_0x42ac('0x6')]=function(_0x43085b){return connect()['then'](function(){return new BPromise(function(_0x955de7,_0x46b649){return pm2['restart'](_0x43085b,function(_0x56c040,_0x2e7cc6){if(_0x56c040){return _0x46b649(_0x56c040);}pm2[_0x42ac('0x4')]();return _0x955de7(_0x2e7cc6);});});});};exports[_0x42ac('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2df301,_0x3db1d0){return pm2[_0x42ac('0x7')](function(_0x391481,_0x1a2f9d){if(_0x391481){return _0x3db1d0(_0x391481);}pm2[_0x42ac('0x4')]();return _0x2df301(_0x1a2f9d);});});});};exports[_0x42ac('0x8')]=function(_0x4c4d6c){return connect()['then'](function(){return new BPromise(function(_0xcdddc,_0x59b8b5){return pm2[_0x42ac('0x8')](_0x4c4d6c,function(_0x2ba163,_0x1c9981){if(_0x2ba163){return _0x59b8b5(_0x2ba163);}pm2[_0x42ac('0x4')]();return _0xcdddc(_0x1c9981);});});});};exports[_0x42ac('0x9')]=function(_0x28a280){return connect()['then'](function(){return new BPromise(function(_0x3ef474,_0x4764c2){return pm2[_0x42ac('0x9')](_0x28a280,function(_0x42f384,_0x3a8317){if(_0x42f384){return _0x4764c2(_0x42f384);}pm2['disconnect']();return _0x3ef474(_0x3a8317);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x5a91bf,_0x97a24f){return pm2[_0x42ac('0xa')](function(_0x331ee5){if(_0x331ee5){return _0x97a24f(_0x331ee5);}return _0x5a91bf(_0x42ac('0xb'));});});});}; \ No newline at end of file +var _0xdd50=['list','disconnect','describe','delete','dump','saved','bluebird','./config','connect','start','stop','then','restart'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xdd50,0x172));var _0x0dd5=function(_0x3c957d,_0x40d8f3){_0x3c957d=_0x3c957d-0x0;var _0x46ab64=_0xdd50[_0x3c957d];return _0x46ab64;};'use strict';var pm2=require('pm2');var BPromise=require(_0x0dd5('0x0'));var config=require(_0x0dd5('0x1'));function connect(){return new BPromise(function(_0x47f2dd,_0x36ae3d){return pm2[_0x0dd5('0x2')](function(_0x12af99){if(_0x12af99){return _0x36ae3d(_0x12af99);}return _0x47f2dd('connected');});});};exports['start']=function(_0x4a14ab){return connect()['then'](function(){return new BPromise(function(_0x27ea09,_0x4f6b13){return pm2[_0x0dd5('0x3')](_0x4a14ab,function(_0xcc1ca,_0x91b1a){if(_0xcc1ca){return _0x4f6b13(_0xcc1ca);}pm2['disconnect']();return _0x27ea09(_0x91b1a);});});});};exports[_0x0dd5('0x4')]=function(_0x27611e){return connect()[_0x0dd5('0x5')](function(){return new BPromise(function(_0x5e1f20,_0x54f9a8){return pm2[_0x0dd5('0x4')](_0x27611e,function(_0x22419f,_0x20b37b){if(_0x22419f){return _0x54f9a8(_0x22419f);}pm2['disconnect']();return _0x5e1f20(_0x20b37b);});});});};exports['restart']=function(_0x194b50){return connect()[_0x0dd5('0x5')](function(){return new BPromise(function(_0x51b19a,_0x49c5e0){return pm2[_0x0dd5('0x6')](_0x194b50,function(_0x320b20,_0x355924){if(_0x320b20){return _0x49c5e0(_0x320b20);}pm2['disconnect']();return _0x51b19a(_0x355924);});});});};exports[_0x0dd5('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x165175,_0x55dce4){return pm2[_0x0dd5('0x7')](function(_0x6d8748,_0x17b0b5){if(_0x6d8748){return _0x55dce4(_0x6d8748);}pm2[_0x0dd5('0x8')]();return _0x165175(_0x17b0b5);});});});};exports[_0x0dd5('0x9')]=function(_0x259654){return connect()['then'](function(){return new BPromise(function(_0x1f2c8e,_0x44b112){return pm2[_0x0dd5('0x9')](_0x259654,function(_0x27b603,_0x4b7336){if(_0x27b603){return _0x44b112(_0x27b603);}pm2[_0x0dd5('0x8')]();return _0x1f2c8e(_0x4b7336);});});});};exports[_0x0dd5('0xa')]=function(_0x320c77){return connect()['then'](function(){return new BPromise(function(_0x23123c,_0x375093){return pm2[_0x0dd5('0xa')](_0x320c77,function(_0x2cba7e,_0x2f9c88){if(_0x2cba7e){return _0x375093(_0x2cba7e);}pm2[_0x0dd5('0x8')]();return _0x23123c(_0x2f9c88);});});});};exports[_0x0dd5('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x323f9b,_0x2cf354){return pm2['dump'](function(_0xb632de){if(_0xb632de){return _0x2cf354(_0xb632de);}return _0x323f9b(_0x0dd5('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e054beb..437a475 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 _0x28cb=['ioredis','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','findAll','lastMsgAt','subtract','minutes','ChatInteraction','update','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','error','start','lodash','moment'];(function(_0x18cf19,_0x3b7f14){var _0x2c80c8=function(_0x4c560f){while(--_0x4c560f){_0x18cf19['push'](_0x18cf19['shift']());}};_0x2c80c8(++_0x3b7f14);}(_0x28cb,0x80));var _0xb28c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x28cb[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb28c('0x0'));var moment=require(_0xb28c('0x1'));var Redis=require(_0xb28c('0x2'));var db=require(_0xb28c('0x3'))['db'];var config=require(_0xb28c('0x4'));config[_0xb28c('0x5')]=_['defaults'](config[_0xb28c('0x5')],{'host':_0xb28c('0x6'),'port':0x18eb});var io=require(_0xb28c('0x7'))(new Redis(config[_0xb28c('0x5')]));function closeInteractions(){var _0x2b59fb=0x0;var _0x2486af=[];return db[_0xb28c('0x8')][_0xb28c('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xb28c('0xa')](function(_0x4fbb7c){_0x2b59fb=_0x4fbb7c[_0xb28c('0xb')];if(_0x2b59fb){return db['ChatInteraction'][_0xb28c('0xc')]({'raw':!![],'attributes':['id',_0xb28c('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb28c('0xe')](_0x4fbb7c[_0xb28c('0xb')],_0xb28c('0xf'))}}});}else{return[];}})[_0xb28c('0xa')](function(_0x169af9){_0x2486af=_0x169af9;if(_0x2b59fb){return db[_0xb28c('0x10')][_0xb28c('0x11')]({'closeReason':'system','disposition':_0xb28c('0x12'),'closed':!![],'closedAt':moment()['format'](_0xb28c('0x13'))},{'where':{'id':_[_0xb28c('0x14')](_0x2486af||[],'id')}});}})['then'](function(_0x4c29a5){for(var _0x356736=0x0;_0x356736<_0x2486af[_0xb28c('0x15')];_0x356736++){io[_0xb28c('0x16')](_0xb28c('0x17'),{'id':_0x2486af[_0x356736]['id'],'closed':!![]});}})['catch'](function(_0x68dd06){console[_0xb28c('0x18')](_0x68dd06);});}exports[_0xb28c('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9035=['ChatInteraction','system','timeout','map','emit','chatInteraction:update','catch','error','lodash','moment','../../mysqldb','../../config/environment','redis','defaults','localhost','find','chatTimeout','then','findAll','subtract','minutes'];(function(_0x301ba4,_0x5d6c25){var _0x581a9d=function(_0x50fae3){while(--_0x50fae3){_0x301ba4['push'](_0x301ba4['shift']());}};_0x581a9d(++_0x5d6c25);}(_0x9035,0x158));var _0x5903=function(_0x32e978,_0x593361){_0x32e978=_0x32e978-0x0;var _0x220f5e=_0x9035[_0x32e978];return _0x220f5e;};'use strict';var _=require(_0x5903('0x0'));var moment=require(_0x5903('0x1'));var Redis=require('ioredis');var db=require(_0x5903('0x2'))['db'];var config=require(_0x5903('0x3'));config[_0x5903('0x4')]=_[_0x5903('0x5')](config['redis'],{'host':_0x5903('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x54d629=0x0;var _0x4c43e1=[];return db['Setting'][_0x5903('0x7')]({'raw':!![],'attributes':['id',_0x5903('0x8')],'where':{'id':0x1}})[_0x5903('0x9')](function(_0x286b2b){_0x54d629=_0x286b2b[_0x5903('0x8')];if(_0x54d629){return db['ChatInteraction'][_0x5903('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5903('0xb')](_0x286b2b[_0x5903('0x8')],_0x5903('0xc'))}}});}else{return[];}})[_0x5903('0x9')](function(_0x4e01ad){_0x4c43e1=_0x4e01ad;if(_0x54d629){return db[_0x5903('0xd')]['update']({'closeReason':_0x5903('0xe'),'disposition':_0x5903('0xf'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x5903('0x10')](_0x4c43e1||[],'id')}});}})[_0x5903('0x9')](function(_0x27c22f){for(var _0x4e9221=0x0;_0x4e9221<_0x4c43e1['length'];_0x4e9221++){io[_0x5903('0x11')](_0x5903('0x12'),{'id':_0x4c43e1[_0x4e9221]['id'],'closed':!![]});}})[_0x5903('0x13')](function(_0xd709ff){console[_0x5903('0x14')](_0xd709ff);});}exports['start']=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 6f70bd5..75abbb2 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 _0x49cf=['secure','auth','user','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','../../files/reports','savename','%s.%s','basename','extname','zip','join','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','then','catch','exec\x20custom\x20report\x20id:%s','runReport','CustomReportId','Schedule','findAll','MailServerOut','map','toString','difference','length','exists','stop','deleteJob','toRun','index','my\x20id','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','host','port'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x49cf,0x13d));var _0xf49c=function(_0x46d32d,_0x597f92){_0x46d32d=_0x46d32d-0x0;var _0x2f7fee=_0x49cf[_0x46d32d];return _0x2f7fee;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xf49c('0x0'));var _=require(_0xf49c('0x1'));var moment=require(_0xf49c('0x2'));var CronJobManager=require(_0xf49c('0x3'));var jayson=require(_0xf49c('0x4'));var BPromise=require('bluebird');var logger=require(_0xf49c('0x5'))(_0xf49c('0x6'));var db=require(_0xf49c('0x7'))['db'];var analyticCustomReportController=require(_0xf49c('0x8'));var analyticDefaultReportController=require(_0xf49c('0x9'));var client=jayson[_0xf49c('0xa')][_0xf49c('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x41bdd8,_0x343f2c){return function(){logger[_0xf49c('0xc')](_0xf49c('0xd'),_0x41bdd8[_0xf49c('0xe')]);var _0xc5839b=!![];var _0x1420f7={'tls':{'rejectUnauthorized':![]}};if(_0x41bdd8[_0xf49c('0xf')]['Smtp']['service']){_0x1420f7['service']=_0x41bdd8[_0xf49c('0xf')][_0xf49c('0x10')]['service'];}else{_0x1420f7['host']=_0x41bdd8[_0xf49c('0xf')][_0xf49c('0x10')][_0xf49c('0x11')];_0x1420f7[_0xf49c('0x12')]=_0x41bdd8[_0xf49c('0xf')][_0xf49c('0x10')][_0xf49c('0x12')];_0x1420f7[_0xf49c('0x13')]=_0x41bdd8[_0xf49c('0xf')][_0xf49c('0x10')][_0xf49c('0x13')];}if(_0x41bdd8['MailAccount'][_0xf49c('0x10')]['authentication']){_0x1420f7[_0xf49c('0x14')]={'user':_0x41bdd8[_0xf49c('0xf')][_0xf49c('0x10')][_0xf49c('0x15')],'pass':_0x41bdd8[_0xf49c('0xf')][_0xf49c('0x10')]['pass']};}var _0x2aad64={'account':_0x1420f7,'message':{'from':util[_0xf49c('0x16')]('\x22%s\x22\x20<%s>',_0x41bdd8[_0xf49c('0xf')][_0xf49c('0x17')],_0x41bdd8[_0xf49c('0xf')][_0xf49c('0xe')]||_0x41bdd8['MailAccount'][_0xf49c('0x10')][_0xf49c('0x15')]),'to':_0x41bdd8['email'],'cc':_0x41bdd8['cc'],'bcc':_0x41bdd8[_0xf49c('0x18')],'subject':util[_0xf49c('0x16')](_0xf49c('0x19'),_0x343f2c[_0xf49c('0x17')],_0x41bdd8[_0xf49c('0x1a')],_0x41bdd8['subtractUnit'])}};var _0x16c618=path['join'](__dirname,_0xf49c('0x1b'));var _0x50568c=_0x343f2c[_0xf49c('0x1c')];var _0x2d1858=util[_0xf49c('0x16')](_0xf49c('0x1d'),path[_0xf49c('0x1e')](_0x343f2c['savename'],path[_0xf49c('0x1f')](_0x343f2c[_0xf49c('0x1c')])),_0xf49c('0x20'));var _0x4c45f1=path[_0xf49c('0x21')](_0x16c618,_0x50568c);var _0x1fd649=path[_0xf49c('0x21')](_0x16c618,_0x2d1858);if(fs['existsSync'](_0x4c45f1)){_0x343f2c['status']=_0xf49c('0x22');_0x2aad64[_0xf49c('0x23')]['attachments']=[{'filename':_0x50568c,'path':_0x4c45f1}];_0x2aad64[_0xf49c('0x23')]['text']=util['format'](_0xf49c('0x24'),JSON[_0xf49c('0x25')](_0x343f2c,null,0x2));}else if(fs[_0xf49c('0x26')](_0x1fd649)){_0x343f2c['status']=_0xf49c('0x22');_0x2aad64[_0xf49c('0x23')]['attachments']=[{'filename':_0x2d1858,'path':_0x1fd649}];}else{_0x2aad64['message'][_0xf49c('0x27')]=_0xf49c('0x28');if(!_0x41bdd8[_0xf49c('0x29')]){_0xc5839b=![];logger[_0xf49c('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0xc5839b){return client['request']('SendMail',_0x2aad64)['then'](function(_0x5b00b5){if(_0x5b00b5[_0xf49c('0x2a')]){return logger[_0xf49c('0x2a')](_0xf49c('0x2b'),JSON[_0xf49c('0x25')](_0x5b00b5));}return logger[_0xf49c('0xc')]('email\x20sent');})['catch'](function(_0x545e94){return logger[_0xf49c('0x2a')](_0xf49c('0x2b'),JSON[_0xf49c('0x25')](_0x545e94));});}};}function handleError(){return function(_0x75b9ab){return logger[_0xf49c('0x2a')](JSON[_0xf49c('0x25')](_0x75b9ab));};}function handleResult(_0x3f4d2a){return function(_0x4a1378){logger[_0xf49c('0xc')](_0xf49c('0x2c'),JSON[_0xf49c('0x25')](_0x4a1378));if(_0x3f4d2a['MailAccount']&&_0x3f4d2a[_0xf49c('0xf')][_0xf49c('0x10')]&&!_[_0xf49c('0x2d')](_0x3f4d2a[_0xf49c('0xe')])){setTimeout(handleSendEmail(_0x3f4d2a,_0x4a1378),0x3c*0x3e8);}};}function handleJob(_0x45b3b6){return function(){try{if(_[_0xf49c('0x2d')](_0x45b3b6[_0xf49c('0x1a')])){return logger[_0xf49c('0xc')](_0xf49c('0x2e'));}if(_[_0xf49c('0x2d')](_0x45b3b6['subtractUnit'])){return logger[_0xf49c('0xc')](_0xf49c('0x2f'));}var _0x579a30={'startDate':moment()['subtract'](_0x45b3b6[_0xf49c('0x1a')],_0x45b3b6[_0xf49c('0x30')])['format'](_0xf49c('0x31')),'endDate':moment()['format'](_0xf49c('0x31')),'type':_0xf49c('0x32'),'output':_0x45b3b6[_0xf49c('0x33')],'name':_0x45b3b6['name']};if(!_[_0xf49c('0x2d')](_0x45b3b6['DefaultReportId'])){logger['info'](_0xf49c('0x34'),_0x45b3b6[_0xf49c('0x35')]);return analyticDefaultReportController['runReport']({'id':_0x45b3b6[_0xf49c('0x35')]},_0x579a30)[_0xf49c('0x36')](handleResult(_0x45b3b6))[_0xf49c('0x37')](handleError());}if(!_[_0xf49c('0x2d')](_0x45b3b6['CustomReportId'])){logger[_0xf49c('0xc')](_0xf49c('0x38'),_0x45b3b6['CustomReportId']);return analyticCustomReportController[_0xf49c('0x39')]({'id':_0x45b3b6[_0xf49c('0x3a')]},_0x579a30)[_0xf49c('0x36')](handleResult(_0x45b3b6))[_0xf49c('0x37')](handleError());}}catch(_0x2d8732){logger[_0xf49c('0x2a')](JSON['stringify'](_0x2d8732));}return logger[_0xf49c('0xc')]('no\x20report\x20id');};}function getJobs(_0x1bca6d){var _0x20f884={};if(_0x1bca6d){_0x20f884['id']=_0x1bca6d;}return db[_0xf49c('0x3b')][_0xf49c('0x3c')]({'where':_0x20f884,'include':[{'model':db[_0xf49c('0xf')],'attributes':['id',_0xf49c('0x17'),_0xf49c('0xe')],'include':[{'model':db[_0xf49c('0x3d')],'as':_0xf49c('0x10')}]}]})[_0xf49c('0x36')](function(_0x346230){var _0x40520a=_['keys'](manager['jobs']);var _0x42641f=_[_0xf49c('0x3e')](_0x346230,function(_0x359650){return _0x359650['id'][_0xf49c('0x3f')]();});var _0x4b166c=_['keyBy'](_0x346230,function(_0xf2d7d){return _0xf2d7d['id'][_0xf49c('0x3f')]();});var _0x1617a0=_0x1bca6d?_0x42641f:_[_0xf49c('0x40')](_0x42641f,_0x40520a);var _0x2d7711=_['intersection'](_0x42641f,_0x40520a);var _0xb7a1e1=_[_0xf49c('0x40')](_0x40520a,_0x42641f);var _0xc4e3ba;var _0x4852bd;for(_0xc4e3ba=0x0;_0xc4e3ba<_0xb7a1e1[_0xf49c('0x41')]&&!_0x1bca6d;_0xc4e3ba+=0x1){_0x4852bd=_0xb7a1e1[_0xc4e3ba][_0xf49c('0x3f')]();if(manager[_0xf49c('0x42')](_0x4852bd)){manager[_0xf49c('0x43')](_0x4852bd);manager[_0xf49c('0x44')](_0x4852bd);logger[_0xf49c('0xc')]('delete\x20cron',_0x4852bd);}}logger[_0xf49c('0xc')](_0xf49c('0x45'),JSON['stringify'](_0x1617a0));for(_0xc4e3ba=0x0;_0xc4e3ba<_0x1617a0[_0xf49c('0x41')];_0xc4e3ba+=0x1){_0x4852bd=_0x1617a0[_0xc4e3ba][_0xf49c('0x3f')]();logger['info'](_0xf49c('0x46'),_0x4852bd);if(_0x1bca6d){logger[_0xf49c('0xc')](_0xf49c('0x47'),_0x1bca6d);logger[_0xf49c('0xc')](JSON[_0xf49c('0x25')](_0x4b166c[_0x4852bd]));BPromise['resolve']()['then'](handleJob(_0x4b166c[_0x4852bd]));logger[_0xf49c('0xc')](_0xf49c('0x48'),_0x4b166c[_0x4852bd][_0xf49c('0x17')],_0x4b166c[_0x4852bd][_0xf49c('0x49')]);}else if(_0x4b166c[_0x4852bd][_0xf49c('0x49')]&&_0x4b166c[_0x4852bd][_0xf49c('0x4a')]&&moment()['isBetween'](_0x4b166c[_0x4852bd][_0xf49c('0x4b')],_0x4b166c[_0x4852bd][_0xf49c('0x4c')])){manager[_0xf49c('0x4d')](_0x4852bd,_0x4b166c[_0x4852bd][_0xf49c('0x49')],handleJob(_0x4b166c[_0x4852bd]));manager[_0xf49c('0x4e')](_0x4852bd);logger[_0xf49c('0xc')](_0xf49c('0x4f'),_0x4b166c[_0x4852bd][_0xf49c('0x17')],_0x4b166c[_0x4852bd]['cron']);}else if(manager[_0xf49c('0x42')](_0x4852bd)){manager['stop'](_0x4852bd);manager['deleteJob'](_0x4852bd);logger[_0xf49c('0xc')](_0xf49c('0x50'),_0x4b166c[_0x4852bd][_0xf49c('0x17')],_0x4b166c[_0x4852bd][_0xf49c('0x49')]);}}for(_0xc4e3ba=0x0,_0x4852bd;_0xc4e3ba<_0x2d7711['length']&&!_0x1bca6d;_0xc4e3ba+=0x1){_0x4852bd=_0x2d7711[_0xc4e3ba]['toString']();if(manager['exists'](_0x4852bd)){if(_0x4b166c[_0x4852bd][_0xf49c('0x49')]&&_0x4b166c[_0x4852bd][_0xf49c('0x4a')]&&moment()['isBetween'](_0x4b166c[_0x4852bd][_0xf49c('0x4b')],_0x4b166c[_0x4852bd][_0xf49c('0x4c')])){manager[_0xf49c('0x51')](_0x4852bd,_0x4b166c[_0x4852bd][_0xf49c('0x49')],handleJob(_0x4b166c[_0x4852bd]));logger[_0xf49c('0xc')](_0xf49c('0x52'),_0x4b166c[_0x4852bd][_0xf49c('0x17')],_0x4b166c[_0x4852bd]['cron']);}else{manager[_0xf49c('0x43')](_0x4852bd);manager[_0xf49c('0x44')](_0x4852bd);logger[_0xf49c('0xc')]('stop\x20cron',_0x4b166c[_0x4852bd][_0xf49c('0x17')],_0x4b166c[_0x4852bd]['cron']);}}}})[_0xf49c('0x37')](function(_0x3179ef){logger[_0xf49c('0x2a')](JSON['stringify'](_0x3179ef));});}exports[_0xf49c('0x53')]=function(_0x57dd93){return getJobs(_0x57dd93);};exports[_0xf49c('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x12fb=['stringify','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','update\x20cron','stop\x20cron','run','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','\x22%s\x22\x20<%s>','name','email','bcc','format','subtractNumber','savename','%s.%s','basename','extname','zip','join','existsSync','Sent','attachments','message','status','text','info','SendMail','then','error','error\x20mail','email\x20sent','catch'];(function(_0x57c1f0,_0x391dd3){var _0x56545b=function(_0x564fc2){while(--_0x564fc2){_0x57c1f0['push'](_0x57c1f0['shift']());}};_0x56545b(++_0x391dd3);}(_0x12fb,0xd2));var _0xb12f=function(_0x5e9c63,_0x74027f){_0x5e9c63=_0x5e9c63-0x0;var _0x2afc55=_0x12fb[_0x5e9c63];return _0x2afc55;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xb12f('0x0'));var _=require(_0xb12f('0x1'));var moment=require('moment');var CronJobManager=require(_0xb12f('0x2'));var jayson=require(_0xb12f('0x3'));var BPromise=require(_0xb12f('0x4'));var logger=require(_0xb12f('0x5'))(_0xb12f('0x6'));var db=require(_0xb12f('0x7'))['db'];var analyticCustomReportController=require(_0xb12f('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xb12f('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5b2e70,_0x44763a){return function(){logger['info'](_0xb12f('0xa'),_0x5b2e70['email']);var _0x2754ec=!![];var _0x59145a={'tls':{'rejectUnauthorized':![]}};if(_0x5b2e70[_0xb12f('0xb')][_0xb12f('0xc')][_0xb12f('0xd')]){_0x59145a[_0xb12f('0xd')]=_0x5b2e70['MailAccount'][_0xb12f('0xc')]['service'];}else{_0x59145a[_0xb12f('0xe')]=_0x5b2e70['MailAccount']['Smtp'][_0xb12f('0xe')];_0x59145a[_0xb12f('0xf')]=_0x5b2e70[_0xb12f('0xb')][_0xb12f('0xc')]['port'];_0x59145a[_0xb12f('0x10')]=_0x5b2e70['MailAccount'][_0xb12f('0xc')][_0xb12f('0x10')];}if(_0x5b2e70[_0xb12f('0xb')][_0xb12f('0xc')][_0xb12f('0x11')]){_0x59145a[_0xb12f('0x12')]={'user':_0x5b2e70[_0xb12f('0xb')][_0xb12f('0xc')][_0xb12f('0x13')],'pass':_0x5b2e70[_0xb12f('0xb')][_0xb12f('0xc')]['pass']};}var _0x25f7d2={'account':_0x59145a,'message':{'from':util['format'](_0xb12f('0x14'),_0x5b2e70[_0xb12f('0xb')][_0xb12f('0x15')],_0x5b2e70[_0xb12f('0xb')][_0xb12f('0x16')]||_0x5b2e70[_0xb12f('0xb')][_0xb12f('0xc')][_0xb12f('0x13')]),'to':_0x5b2e70[_0xb12f('0x16')],'cc':_0x5b2e70['cc'],'bcc':_0x5b2e70[_0xb12f('0x17')],'subject':util[_0xb12f('0x18')]('Report\x20%s\x20last\x20%s\x20%s',_0x44763a[_0xb12f('0x15')],_0x5b2e70[_0xb12f('0x19')],_0x5b2e70['subtractUnit'])}};var _0x3f56c8=path['join'](__dirname,'../../files/reports');var _0x30a3a2=_0x44763a[_0xb12f('0x1a')];var _0x7a25e4=util[_0xb12f('0x18')](_0xb12f('0x1b'),path[_0xb12f('0x1c')](_0x44763a[_0xb12f('0x1a')],path[_0xb12f('0x1d')](_0x44763a['savename'])),_0xb12f('0x1e'));var _0x4e25f0=path['join'](_0x3f56c8,_0x30a3a2);var _0xce8e79=path[_0xb12f('0x1f')](_0x3f56c8,_0x7a25e4);if(fs[_0xb12f('0x20')](_0x4e25f0)){_0x44763a['status']=_0xb12f('0x21');_0x25f7d2['message'][_0xb12f('0x22')]=[{'filename':_0x30a3a2,'path':_0x4e25f0}];_0x25f7d2[_0xb12f('0x23')]['text']=util[_0xb12f('0x18')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x44763a,null,0x2));}else if(fs[_0xb12f('0x20')](_0xce8e79)){_0x44763a[_0xb12f('0x24')]='Sent';_0x25f7d2[_0xb12f('0x23')]['attachments']=[{'filename':_0x7a25e4,'path':_0xce8e79}];}else{_0x25f7d2[_0xb12f('0x23')][_0xb12f('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5b2e70['sendIfEmpty']){_0x2754ec=![];logger[_0xb12f('0x26')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x2754ec){return client['request'](_0xb12f('0x27'),_0x25f7d2)[_0xb12f('0x28')](function(_0xcf76c6){if(_0xcf76c6['error']){return logger[_0xb12f('0x29')](_0xb12f('0x2a'),JSON['stringify'](_0xcf76c6));}return logger[_0xb12f('0x26')](_0xb12f('0x2b'));})[_0xb12f('0x2c')](function(_0x50a189){return logger[_0xb12f('0x29')](_0xb12f('0x2a'),JSON[_0xb12f('0x2d')](_0x50a189));});}};}function handleError(){return function(_0x3dd863){return logger['error'](JSON[_0xb12f('0x2d')](_0x3dd863));};}function handleResult(_0xb95fa){return function(_0x54fc03){logger[_0xb12f('0x26')]('data',JSON[_0xb12f('0x2d')](_0x54fc03));if(_0xb95fa[_0xb12f('0xb')]&&_0xb95fa[_0xb12f('0xb')][_0xb12f('0xc')]&&!_[_0xb12f('0x2e')](_0xb95fa[_0xb12f('0x16')])){setTimeout(handleSendEmail(_0xb95fa,_0x54fc03),0x3c*0x3e8);}};}function handleJob(_0x575f8d){return function(){try{if(_[_0xb12f('0x2e')](_0x575f8d[_0xb12f('0x19')])){return logger[_0xb12f('0x26')](_0xb12f('0x2f'));}if(_['isNil'](_0x575f8d['subtractUnit'])){return logger[_0xb12f('0x26')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3a9cf5={'startDate':moment()[_0xb12f('0x30')](_0x575f8d[_0xb12f('0x19')],_0x575f8d[_0xb12f('0x31')])[_0xb12f('0x18')](_0xb12f('0x32')),'endDate':moment()[_0xb12f('0x18')](_0xb12f('0x32')),'type':_0xb12f('0x33'),'output':_0x575f8d[_0xb12f('0x34')],'name':_0x575f8d[_0xb12f('0x15')]};if(!_[_0xb12f('0x2e')](_0x575f8d[_0xb12f('0x35')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x575f8d['DefaultReportId']);return analyticDefaultReportController[_0xb12f('0x36')]({'id':_0x575f8d[_0xb12f('0x35')]},_0x3a9cf5)[_0xb12f('0x28')](handleResult(_0x575f8d))[_0xb12f('0x2c')](handleError());}if(!_[_0xb12f('0x2e')](_0x575f8d['CustomReportId'])){logger['info'](_0xb12f('0x37'),_0x575f8d[_0xb12f('0x38')]);return analyticCustomReportController[_0xb12f('0x36')]({'id':_0x575f8d[_0xb12f('0x38')]},_0x3a9cf5)['then'](handleResult(_0x575f8d))[_0xb12f('0x2c')](handleError());}}catch(_0x19944f){logger[_0xb12f('0x29')](JSON[_0xb12f('0x2d')](_0x19944f));}return logger[_0xb12f('0x26')](_0xb12f('0x39'));};}function getJobs(_0x83b33){var _0x15708e={};if(_0x83b33){_0x15708e['id']=_0x83b33;}return db['Schedule'][_0xb12f('0x3a')]({'where':_0x15708e,'include':[{'model':db[_0xb12f('0xb')],'attributes':['id',_0xb12f('0x15'),_0xb12f('0x16')],'include':[{'model':db[_0xb12f('0x3b')],'as':_0xb12f('0xc')}]}]})[_0xb12f('0x28')](function(_0x193942){var _0x2fa724=_[_0xb12f('0x3c')](manager[_0xb12f('0x3d')]);var _0x2d8802=_['map'](_0x193942,function(_0x126c72){return _0x126c72['id'][_0xb12f('0x3e')]();});var _0x6bbe0a=_[_0xb12f('0x3f')](_0x193942,function(_0x131514){return _0x131514['id'][_0xb12f('0x3e')]();});var _0x53baad=_0x83b33?_0x2d8802:_[_0xb12f('0x40')](_0x2d8802,_0x2fa724);var _0x19d8fa=_[_0xb12f('0x41')](_0x2d8802,_0x2fa724);var _0x2b422d=_[_0xb12f('0x40')](_0x2fa724,_0x2d8802);var _0x3dc561;var _0x4496ee;for(_0x3dc561=0x0;_0x3dc561<_0x2b422d[_0xb12f('0x42')]&&!_0x83b33;_0x3dc561+=0x1){_0x4496ee=_0x2b422d[_0x3dc561][_0xb12f('0x3e')]();if(manager[_0xb12f('0x43')](_0x4496ee)){manager[_0xb12f('0x44')](_0x4496ee);manager[_0xb12f('0x45')](_0x4496ee);logger['info'](_0xb12f('0x46'),_0x4496ee);}}logger[_0xb12f('0x26')](_0xb12f('0x47'),JSON[_0xb12f('0x2d')](_0x53baad));for(_0x3dc561=0x0;_0x3dc561<_0x53baad[_0xb12f('0x42')];_0x3dc561+=0x1){_0x4496ee=_0x53baad[_0x3dc561][_0xb12f('0x3e')]();logger[_0xb12f('0x26')](_0xb12f('0x48'),_0x4496ee);if(_0x83b33){logger[_0xb12f('0x26')](_0xb12f('0x49'),_0x83b33);logger[_0xb12f('0x26')](JSON[_0xb12f('0x2d')](_0x6bbe0a[_0x4496ee]));BPromise[_0xb12f('0x4a')]()[_0xb12f('0x28')](handleJob(_0x6bbe0a[_0x4496ee]));logger['info']('run\x20job',_0x6bbe0a[_0x4496ee][_0xb12f('0x15')],_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')]);}else if(_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')]&&_0x6bbe0a[_0x4496ee][_0xb12f('0x4c')]&&moment()[_0xb12f('0x4d')](_0x6bbe0a[_0x4496ee][_0xb12f('0x4e')],_0x6bbe0a[_0x4496ee][_0xb12f('0x4f')])){manager[_0xb12f('0x50')](_0x4496ee,_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')],handleJob(_0x6bbe0a[_0x4496ee]));manager[_0xb12f('0x51')](_0x4496ee);logger[_0xb12f('0x26')]('add\x20cron',_0x6bbe0a[_0x4496ee]['name'],_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')]);}else if(manager[_0xb12f('0x43')](_0x4496ee)){manager['stop'](_0x4496ee);manager[_0xb12f('0x45')](_0x4496ee);logger[_0xb12f('0x26')]('stop\x20cron',_0x6bbe0a[_0x4496ee][_0xb12f('0x15')],_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')]);}}for(_0x3dc561=0x0,_0x4496ee;_0x3dc561<_0x19d8fa[_0xb12f('0x42')]&&!_0x83b33;_0x3dc561+=0x1){_0x4496ee=_0x19d8fa[_0x3dc561][_0xb12f('0x3e')]();if(manager['exists'](_0x4496ee)){if(_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')]&&_0x6bbe0a[_0x4496ee][_0xb12f('0x4c')]&&moment()[_0xb12f('0x4d')](_0x6bbe0a[_0x4496ee][_0xb12f('0x4e')],_0x6bbe0a[_0x4496ee][_0xb12f('0x4f')])){manager['update'](_0x4496ee,_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')],handleJob(_0x6bbe0a[_0x4496ee]));logger[_0xb12f('0x26')](_0xb12f('0x52'),_0x6bbe0a[_0x4496ee][_0xb12f('0x15')],_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')]);}else{manager[_0xb12f('0x44')](_0x4496ee);manager['deleteJob'](_0x4496ee);logger[_0xb12f('0x26')](_0xb12f('0x53'),_0x6bbe0a[_0x4496ee][_0xb12f('0x15')],_0x6bbe0a[_0x4496ee][_0xb12f('0x4b')]);}}}})[_0xb12f('0x2c')](function(_0xa621bc){logger['error'](JSON[_0xb12f('0x2d')](_0xa621bc));});}exports[_0xb12f('0x54')]=function(_0x249646){return getJobs(_0x249646);};exports[_0xb12f('0x51')]=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 35dccb8..3f8a751 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 _0x8e48=['catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','inspect','start','lodash','aws-sdk','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','Neutral','FAILED','FailureReason','resolve','sentiment','Positive','Negative'];(function(_0x4c2778,_0x7f862c){var _0x5ce6d1=function(_0x36fc50){while(--_0x36fc50){_0x4c2778['push'](_0x4c2778['shift']());}};_0x5ce6d1(++_0x7f862c);}(_0x8e48,0x162));var _0x88e4=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x8e48[_0x6131cd];return _0x47e916;};var _=require(_0x88e4('0x0'));var AWS=require(_0x88e4('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0x88e4('0x2'));var db=require(_0x88e4('0x3'))['db'];var logger=require('../../config/logger')(_0x88e4('0x4'));function getTranscriptionJob(_0x4271a9,_0x80a20b,_0x58bc08,_0x420150){return new Promise(function(_0x4f23a3,_0x272222){var _0x3ee2fa=new AWS[(_0x88e4('0x5'))]({'accessKeyId':_0x80a20b,'secretAccessKey':_0x4271a9,'region':_0x58bc08});_0x3ee2fa[_0x88e4('0x6')]({'TranscriptionJobName':_0x420150},function(_0x2a9419,_0x57940a){if(_0x2a9419){return _0x272222(_0x2a9419);}else{return _0x4f23a3(_0x57940a);}});});}function sentiment(_0x3c96e1,_0x42aab2,_0x2f54cc,_0x2c9df7,_0xfe448b){return new Promise(function(_0x37eb83,_0x565d6a){var _0x541752=new AWS['Comprehend']({'accessKeyId':_0x42aab2,'secretAccessKey':_0x3c96e1,'region':_0x2f54cc});_0x541752['detectSentiment']({'Text':_0x2c9df7,'LanguageCode':_0xfe448b[_0x88e4('0x7')](0x0,0x2)},function(_0x3724db,_0x35afd8){if(_0x3724db){return _0x565d6a(_0x3724db);}else{return _0x37eb83(_0x35afd8);}});});}function checkTranscribeJob(_0x26191d,_0x5ed00c,_0x401429){var _0xb30b0d;return new BPromise(function(_0x10197f,_0x182c72){logger[_0x88e4('0x8')](util['format'](_0x88e4('0x9'),_0x26191d['id'],_0x26191d[_0x88e4('0xa')]));return getTranscriptionJob(_0x401429[_0x88e4('0xb')],_0x401429['data2'],_0x5ed00c[_0x88e4('0xc')],_0x26191d['transcribeName'])[_0x88e4('0xd')](function(_0x501ed6){logger[_0x88e4('0x8')](util[_0x88e4('0xe')](_0x88e4('0xf'),_0x26191d['id'],_0x26191d[_0x88e4('0xa')],_0x501ed6['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x26191d[_0x88e4('0x10')]){switch(_0x501ed6[_0x88e4('0x11')]['TranscriptionJobStatus']){case _0x88e4('0x12'):var _0x340129={'transcribeStatus':_0x501ed6['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x501ed6[_0x88e4('0x11')][_0x88e4('0x13')][_0x88e4('0x14')]};logger[_0x88e4('0x8')](util[_0x88e4('0xe')](_0x88e4('0x15'),_0x26191d['id']));return rp({'uri':_0x501ed6[_0x88e4('0x11')][_0x88e4('0x13')][_0x88e4('0x14')],'json':!![]})[_0x88e4('0xd')](function(_0x34a9ff){logger[_0x88e4('0x8')](util[_0x88e4('0xe')](_0x88e4('0x16'),_0x26191d['id']));if(_0x34a9ff&&_0x34a9ff[_0x88e4('0x17')]&&_0x34a9ff[_0x88e4('0x17')][_0x88e4('0x18')]&&_0x34a9ff[_0x88e4('0x17')]['transcripts'][_0x88e4('0x19')]){_0x340129['fileText']='';for(var _0x1693bf=0x0;_0x1693bf<_0x34a9ff[_0x88e4('0x17')][_0x88e4('0x18')][_0x88e4('0x19')];_0x1693bf++){_0x340129[_0x88e4('0x10')]+=_0x34a9ff[_0x88e4('0x17')]['transcripts'][_0x1693bf][_0x88e4('0x1a')]+'';}}return _0x26191d[_0x88e4('0x1b')](_0x340129);})[_0x88e4('0xd')](function(){logger[_0x88e4('0x8')](util[_0x88e4('0xe')](_0x88e4('0x1c'),_0x26191d['id']));if(!_0x26191d[_0x88e4('0x1d')]){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))](_0x88e4('0x20'));}if(!_0x5ed00c['sentiment']||!_0x5ed00c[_0x88e4('0x21')]||!_0x5ed00c[_0x88e4('0x22')]||!_0x5ed00c[_0x88e4('0x23')]||!_0x5ed00c[_0x88e4('0x24')]){throw new db['Sequelize'][(_0x88e4('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x340129['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5ed00c[_0x88e4('0x21')]===_0x401429['id']){return _0x401429;}else{return db[_0x88e4('0x25')][_0x88e4('0x26')]({'where':{'id':_settings[_0x88e4('0x21')]}});}})[_0x88e4('0xd')](function(_0x13f67e){if(!_0x13f67e){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))](_0x88e4('0x27'));}if(!_0x13f67e[_0x88e4('0xb')]||!_0x13f67e[_0x88e4('0x28')]){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))](_0x88e4('0x29'));}_0xb30b0d=_0x13f67e;logger['info'](util[_0x88e4('0xe')](_0x88e4('0x2a'),_0x26191d['id']));return sentiment(_0xb30b0d[_0x88e4('0xb')],_0xb30b0d[_0x88e4('0x28')],_0x5ed00c[_0x88e4('0x22')],_0x340129[_0x88e4('0x10')],_0x5ed00c['language']);})['then'](function(_0x53e3c2){logger['info'](util['format'](_0x88e4('0x2b'),_0x26191d['id']));return _0x26191d[_0x88e4('0x1b')]({'sentiment':_0x53e3c2[_0x88e4('0x2c')],'sPositive':_0x53e3c2[_0x88e4('0x2d')]['Positive'],'sNegative':_0x53e3c2[_0x88e4('0x2d')]['Negative'],'sMixed':_0x53e3c2[_0x88e4('0x2d')][_0x88e4('0x2e')],'sNeutral':_0x53e3c2[_0x88e4('0x2d')][_0x88e4('0x2f')]});})['then'](function(){logger[_0x88e4('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x26191d['id']));_0x10197f();});case _0x88e4('0x30'):return _0x26191d[_0x88e4('0x1b')]({'transcribeStatus':_0x88e4('0x30'),'failureReason':_0x501ed6[_0x88e4('0x11')][_0x88e4('0x31')]})[_0x88e4('0xd')](function(){logger[_0x88e4('0x8')](util[_0x88e4('0xe')](_0x88e4('0x1c'),_0x26191d['id']));_0x10197f();});default:logger[_0x88e4('0x8')](util[_0x88e4('0xe')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x26191d['id']));break;}}else{return BPromise[_0x88e4('0x32')]()[_0x88e4('0xd')](function(){if(!_0x26191d[_0x88e4('0x1d')]){throw new db['Sequelize'][(_0x88e4('0x1f'))](_0x88e4('0x20'));}if(!_0x5ed00c[_0x88e4('0x33')]||!_0x5ed00c['sentimentAccountId']||!_0x5ed00c[_0x88e4('0x22')]||!_0x5ed00c[_0x88e4('0x23')]||!_0x5ed00c[_0x88e4('0x24')]){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x26191d[_0x88e4('0x10')]){throw new Error('Transcript\x20not\x20available');}if(_0x5ed00c[_0x88e4('0x21')]===_0x401429['id']){return _0x401429;}else{return db[_0x88e4('0x25')][_0x88e4('0x26')]({'where':{'id':_settings[_0x88e4('0x21')]}});}})[_0x88e4('0xd')](function(_0x143417){if(!_0x143417){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))](_0x88e4('0x27'));}if(!_0x143417[_0x88e4('0xb')]||!_0x143417[_0x88e4('0x28')]){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0xb30b0d=_0x143417;logger[_0x88e4('0x8')](util[_0x88e4('0xe')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x26191d['id']));return sentiment(_0xb30b0d[_0x88e4('0xb')],_0xb30b0d[_0x88e4('0x28')],_0x5ed00c[_0x88e4('0x22')],_0x26191d[_0x88e4('0x10')],_0x5ed00c['language']);})['then'](function(_0x3c59e1){logger[_0x88e4('0x8')](util[_0x88e4('0xe')](_0x88e4('0x2b'),_0x26191d['id']));return _0x26191d['update']({'sentiment':_0x3c59e1[_0x88e4('0x2c')],'sPositive':_0x3c59e1[_0x88e4('0x2d')][_0x88e4('0x34')],'sNegative':_0x3c59e1[_0x88e4('0x2d')][_0x88e4('0x35')],'sMixed':_0x3c59e1[_0x88e4('0x2d')][_0x88e4('0x2e')],'sNeutral':_0x3c59e1[_0x88e4('0x2d')][_0x88e4('0x2f')],'transcribeStatus':_0x88e4('0x12')});})[_0x88e4('0xd')](function(){logger[_0x88e4('0x8')](util[_0x88e4('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x26191d['id']));_0x10197f();});}})[_0x88e4('0x36')](function(_0x2af0a0){if(_0x2af0a0){if(!_0x2af0a0[_0x88e4('0x37')]||_0x2af0a0['name']!==_0x88e4('0x38')){logger[_0x88e4('0x39')](util[_0x88e4('0xe')](_0x88e4('0x3a'),_0x26191d['id']),util['inspect'](_0x2af0a0,{'showHidden':![],'depth':null}));}}_0x10197f();});});}function checkTranscribe(){var _0x6202c9;var _0x5b8046;var _0x4034df;return db[_0x88e4('0x3b')][_0x88e4('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3722ee){if(!_0x3722ee||!_0x3722ee['length']){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))](_0x88e4('0x3d'));}_0x6202c9=_0x3722ee;return db['Setting'][_0x88e4('0x26')]({'where':{'id':0x1}});})[_0x88e4('0xd')](function(_0xa3e40e){if(!_0xa3e40e){throw new db['Sequelize'][(_0x88e4('0x1f'))]('Settings\x20not\x20available');}_0x5b8046=_0xa3e40e;if(!_0x5b8046[_0x88e4('0x4')]||!_0x5b8046[_0x88e4('0x3e')]||!_0x5b8046[_0x88e4('0xc')]||!_0x5b8046[_0x88e4('0x23')]||!_0x5b8046[_0x88e4('0x24')]){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))](_0x88e4('0x3f'));}return db[_0x88e4('0x25')][_0x88e4('0x26')]({'where':{'id':_0x5b8046[_0x88e4('0x3e')]}});})[_0x88e4('0xd')](function(_0x53a926){if(!_0x53a926){throw new db[(_0x88e4('0x1e'))][(_0x88e4('0x1f'))](_0x88e4('0x27'));}if(!_0x53a926[_0x88e4('0xb')]||!_0x53a926[_0x88e4('0x28')]){throw new db[(_0x88e4('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4034df=_0x53a926;var _0x44fb91=[];_0x6202c9[_0x88e4('0x40')](function(_0x30ff27){_0x44fb91['push'](checkTranscribeJob(_0x30ff27,_0x5b8046,_0x4034df));});return BPromise[_0x88e4('0x41')](_0x44fb91);})[_0x88e4('0x36')](function(_0x3346cf){if(_0x3346cf){if(!_0x3346cf[_0x88e4('0x37')]||_0x3346cf[_0x88e4('0x37')]!=='SequelizeValidationError'){logger[_0x88e4('0x39')](util[_0x88e4('0x42')](_0x3346cf,{'showHidden':![],'depth':null}));}}});}exports[_0x88e4('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x21ab=['bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x21ab,0x65));var _0xb21a=function(_0xe05ae6,_0x2b82a7){_0xe05ae6=_0xe05ae6-0x0;var _0x4f3030=_0x21ab[_0xe05ae6];return _0x4f3030;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xb21a('0x0'));var util=require('util');var BPromise=require(_0xb21a('0x1'));var db=require(_0xb21a('0x2'))['db'];var logger=require(_0xb21a('0x3'))(_0xb21a('0x4'));function getTranscriptionJob(_0x213397,_0x23392b,_0xb33ff6,_0x10261c){return new Promise(function(_0x2fab15,_0x3d1831){var _0x40bc6d=new AWS['TranscribeService']({'accessKeyId':_0x23392b,'secretAccessKey':_0x213397,'region':_0xb33ff6});_0x40bc6d[_0xb21a('0x5')]({'TranscriptionJobName':_0x10261c},function(_0x193af7,_0xe146d8){if(_0x193af7){return _0x3d1831(_0x193af7);}else{return _0x2fab15(_0xe146d8);}});});}function sentiment(_0x39dded,_0x2316c6,_0x3629ba,_0x474990,_0x133258){return new Promise(function(_0x49dab9,_0x3c2d07){var _0x268fe4=new AWS[(_0xb21a('0x6'))]({'accessKeyId':_0x2316c6,'secretAccessKey':_0x39dded,'region':_0x3629ba});_0x268fe4[_0xb21a('0x7')]({'Text':_0x474990,'LanguageCode':_0x133258['substring'](0x0,0x2)},function(_0x580197,_0x2e81a1){if(_0x580197){return _0x3c2d07(_0x580197);}else{return _0x49dab9(_0x2e81a1);}});});}function checkTranscribeJob(_0x45f5cb,_0x53738b,_0x51a41d){var _0x1886b5;return new BPromise(function(_0x4748fe,_0x1b8db6){logger['info'](util[_0xb21a('0x8')](_0xb21a('0x9'),_0x45f5cb['id'],_0x45f5cb[_0xb21a('0xa')]));return getTranscriptionJob(_0x51a41d[_0xb21a('0xb')],_0x51a41d[_0xb21a('0xc')],_0x53738b[_0xb21a('0xd')],_0x45f5cb[_0xb21a('0xa')])[_0xb21a('0xe')](function(_0x4e5c08){logger[_0xb21a('0xf')](util[_0xb21a('0x8')](_0xb21a('0x10'),_0x45f5cb['id'],_0x45f5cb[_0xb21a('0xa')],_0x4e5c08['TranscriptionJob'][_0xb21a('0x11')]));if(!_0x45f5cb[_0xb21a('0x12')]){switch(_0x4e5c08[_0xb21a('0x13')][_0xb21a('0x11')]){case _0xb21a('0x14'):var _0x3d06ab={'transcribeStatus':_0x4e5c08[_0xb21a('0x13')]['TranscriptionJobStatus'],'fileUri':_0x4e5c08['TranscriptionJob'][_0xb21a('0x15')][_0xb21a('0x16')]};logger[_0xb21a('0xf')](util[_0xb21a('0x8')](_0xb21a('0x17'),_0x45f5cb['id']));return rp({'uri':_0x4e5c08[_0xb21a('0x13')][_0xb21a('0x15')][_0xb21a('0x16')],'json':!![]})[_0xb21a('0xe')](function(_0x4be3a4){logger[_0xb21a('0xf')](util[_0xb21a('0x8')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x45f5cb['id']));if(_0x4be3a4&&_0x4be3a4[_0xb21a('0x18')]&&_0x4be3a4['results'][_0xb21a('0x19')]&&_0x4be3a4['results'][_0xb21a('0x19')][_0xb21a('0x1a')]){_0x3d06ab[_0xb21a('0x12')]='';for(var _0x25e9af=0x0;_0x25e9af<_0x4be3a4[_0xb21a('0x18')][_0xb21a('0x19')][_0xb21a('0x1a')];_0x25e9af++){_0x3d06ab['fileText']+=_0x4be3a4[_0xb21a('0x18')][_0xb21a('0x19')][_0x25e9af][_0xb21a('0x1b')]+'';}}return _0x45f5cb[_0xb21a('0x1c')](_0x3d06ab);})[_0xb21a('0xe')](function(){logger[_0xb21a('0xf')](util[_0xb21a('0x8')](_0xb21a('0x1d'),_0x45f5cb['id']));if(!_0x45f5cb[_0xb21a('0x1e')]){throw new db[(_0xb21a('0x1f'))][(_0xb21a('0x20'))](_0xb21a('0x21'));}if(!_0x53738b['sentiment']||!_0x53738b[_0xb21a('0x22')]||!_0x53738b[_0xb21a('0x23')]||!_0x53738b[_0xb21a('0x24')]||!_0x53738b[_0xb21a('0x25')]){throw new db['Sequelize'][(_0xb21a('0x20'))](_0xb21a('0x26'));}if(!_0x3d06ab[_0xb21a('0x12')]){throw new Error(_0xb21a('0x27'));}if(_0x53738b['sentimentAccountId']===_0x51a41d['id']){return _0x51a41d;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xb21a('0x22')]}});}})[_0xb21a('0xe')](function(_0x966f8f){if(!_0x966f8f){throw new db[(_0xb21a('0x1f'))][(_0xb21a('0x20'))](_0xb21a('0x28'));}if(!_0x966f8f[_0xb21a('0xb')]||!_0x966f8f[_0xb21a('0xc')]){throw new db[(_0xb21a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1886b5=_0x966f8f;logger[_0xb21a('0xf')](util['format'](_0xb21a('0x29'),_0x45f5cb['id']));return sentiment(_0x1886b5[_0xb21a('0xb')],_0x1886b5[_0xb21a('0xc')],_0x53738b['sentimentRegion'],_0x3d06ab[_0xb21a('0x12')],_0x53738b['language']);})[_0xb21a('0xe')](function(_0x186b01){logger[_0xb21a('0xf')](util[_0xb21a('0x8')](_0xb21a('0x2a'),_0x45f5cb['id']));return _0x45f5cb[_0xb21a('0x1c')]({'sentiment':_0x186b01['Sentiment'],'sPositive':_0x186b01[_0xb21a('0x2b')][_0xb21a('0x2c')],'sNegative':_0x186b01['SentimentScore'][_0xb21a('0x2d')],'sMixed':_0x186b01[_0xb21a('0x2b')][_0xb21a('0x2e')],'sNeutral':_0x186b01['SentimentScore'][_0xb21a('0x2f')]});})[_0xb21a('0xe')](function(){logger['info'](util[_0xb21a('0x8')](_0xb21a('0x1d'),_0x45f5cb['id']));_0x4748fe();});case _0xb21a('0x30'):return _0x45f5cb[_0xb21a('0x1c')]({'transcribeStatus':_0xb21a('0x30'),'failureReason':_0x4e5c08[_0xb21a('0x13')][_0xb21a('0x31')]})[_0xb21a('0xe')](function(){logger['info'](util[_0xb21a('0x8')](_0xb21a('0x1d'),_0x45f5cb['id']));_0x4748fe();});default:logger['info'](util['format'](_0xb21a('0x32'),_0x45f5cb['id']));break;}}else{return BPromise[_0xb21a('0x33')]()[_0xb21a('0xe')](function(){if(!_0x45f5cb['tempSentiment']){throw new db['Sequelize'][(_0xb21a('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x53738b[_0xb21a('0x34')]||!_0x53738b[_0xb21a('0x22')]||!_0x53738b[_0xb21a('0x23')]||!_0x53738b[_0xb21a('0x24')]||!_0x53738b['bucket']){throw new db[(_0xb21a('0x1f'))][(_0xb21a('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x45f5cb['fileText']){throw new Error(_0xb21a('0x27'));}if(_0x53738b[_0xb21a('0x22')]===_0x51a41d['id']){return _0x51a41d;}else{return db[_0xb21a('0x35')][_0xb21a('0x36')]({'where':{'id':_settings[_0xb21a('0x22')]}});}})[_0xb21a('0xe')](function(_0x1c6b76){if(!_0x1c6b76){throw new db[(_0xb21a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1c6b76['data1']||!_0x1c6b76[_0xb21a('0xc')]){throw new db[(_0xb21a('0x1f'))][(_0xb21a('0x20'))](_0xb21a('0x37'));}_0x1886b5=_0x1c6b76;logger[_0xb21a('0xf')](util[_0xb21a('0x8')](_0xb21a('0x29'),_0x45f5cb['id']));return sentiment(_0x1886b5[_0xb21a('0xb')],_0x1886b5[_0xb21a('0xc')],_0x53738b[_0xb21a('0x23')],_0x45f5cb[_0xb21a('0x12')],_0x53738b[_0xb21a('0x24')]);})[_0xb21a('0xe')](function(_0x5e8e1a){logger['info'](util['format'](_0xb21a('0x2a'),_0x45f5cb['id']));return _0x45f5cb['update']({'sentiment':_0x5e8e1a[_0xb21a('0x38')],'sPositive':_0x5e8e1a[_0xb21a('0x2b')]['Positive'],'sNegative':_0x5e8e1a['SentimentScore'][_0xb21a('0x2d')],'sMixed':_0x5e8e1a[_0xb21a('0x2b')][_0xb21a('0x2e')],'sNeutral':_0x5e8e1a[_0xb21a('0x2b')][_0xb21a('0x2f')],'transcribeStatus':'COMPLETED'});})[_0xb21a('0xe')](function(){logger['info'](util['format'](_0xb21a('0x1d'),_0x45f5cb['id']));_0x4748fe();});}})['catch'](function(_0x5adab4){if(_0x5adab4){if(!_0x5adab4[_0xb21a('0x39')]||_0x5adab4[_0xb21a('0x39')]!==_0xb21a('0x3a')){logger[_0xb21a('0x3b')](util[_0xb21a('0x8')](_0xb21a('0x3c'),_0x45f5cb['id']),util['inspect'](_0x5adab4,{'showHidden':![],'depth':null}));}}_0x4748fe();});});}function checkTranscribe(){var _0x220b89;var _0x456e37;var _0x214970;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xb21a('0xe')](function(_0x1a1334){if(!_0x1a1334||!_0x1a1334[_0xb21a('0x1a')]){throw new db[(_0xb21a('0x1f'))][(_0xb21a('0x20'))](_0xb21a('0x3d'));}_0x220b89=_0x1a1334;return db[_0xb21a('0x3e')][_0xb21a('0x36')]({'where':{'id':0x1}});})['then'](function(_0x534094){if(!_0x534094){throw new db[(_0xb21a('0x1f'))][(_0xb21a('0x20'))](_0xb21a('0x3f'));}_0x456e37=_0x534094;if(!_0x456e37[_0xb21a('0x4')]||!_0x456e37[_0xb21a('0x40')]||!_0x456e37['transcribeRegion']||!_0x456e37[_0xb21a('0x24')]||!_0x456e37[_0xb21a('0x25')]){throw new db[(_0xb21a('0x1f'))][(_0xb21a('0x20'))]('Transcribe\x20not\x20configured');}return db[_0xb21a('0x35')][_0xb21a('0x36')]({'where':{'id':_0x456e37['transcribeAccountId']}});})[_0xb21a('0xe')](function(_0x329329){if(!_0x329329){throw new db[(_0xb21a('0x1f'))]['ValidationError'](_0xb21a('0x28'));}if(!_0x329329[_0xb21a('0xb')]||!_0x329329['data2']){throw new db[(_0xb21a('0x1f'))]['ValidationError'](_0xb21a('0x37'));}_0x214970=_0x329329;var _0x2fa98f=[];_0x220b89[_0xb21a('0x41')](function(_0x16f226){_0x2fa98f[_0xb21a('0x42')](checkTranscribeJob(_0x16f226,_0x456e37,_0x214970));});return BPromise[_0xb21a('0x43')](_0x2fa98f);})['catch'](function(_0x414a1a){if(_0x414a1a){if(!_0x414a1a['name']||_0x414a1a[_0xb21a('0x39')]!=='SequelizeValidationError'){logger[_0xb21a('0x3b')](util['inspect'](_0x414a1a,{'showHidden':![],'depth':null}));}}});}exports[_0xb21a('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 3680eee..5e5dfac 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8004=['log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate'];(function(_0x190981,_0x4ae0a3){var _0x405163=function(_0x17ccab){while(--_0x17ccab){_0x190981['push'](_0x190981['shift']());}};_0x405163(++_0x4ae0a3);}(_0x8004,0xa8));var _0x4800=function(_0x5e8bfa,_0x2b21bf){_0x5e8bfa=_0x5e8bfa-0x0;var _0x3f3ec9=_0x8004[_0x5e8bfa];return _0x3f3ec9;};'use strict';var util=require(_0x4800('0x0'));var db=require(_0x4800('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4800('0x2')]({'id':i,'firstName':_0x4800('0x3')+i,'lastName':_0x4800('0x4')+i,'phone':0xf879fb460+i,'email':_0x4800('0x5')+i+_0x4800('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4800('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4800('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4800('0x7')](),'updatedAt':Date[_0x4800('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4800('0x2')]({'id':i,'firstName':_0x4800('0x3')+i,'lastName':_0x4800('0x4')+i,'phone':0xf879fb460+i,'email':_0x4800('0x5')+i+_0x4800('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4800('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4800('0x7')]()});}db[_0x4800('0x8')][_0x4800('0x9')]({'where':{}})[_0x4800('0xa')](function(){return db[_0x4800('0x8')][_0x4800('0xb')](contacts);})[_0x4800('0xa')](function(){console[_0x4800('0xc')]('finished\x20populating',_0x4800('0xd'));return db[_0x4800('0xe')][_0x4800('0x9')]({'where':{}});})['then'](function(){return db[_0x4800('0xe')]['bulkCreate'](hopper);})[_0x4800('0xa')](function(){console['log'](_0x4800('0xf'),_0x4800('0x10'));return db[_0x4800('0x8')][_0x4800('0xb')](contacts2);})[_0x4800('0xa')](function(){console['log']('finished\x20populating',_0x4800('0x11'));return db['CmHopper'][_0x4800('0xb')](hopper2);})[_0x4800('0xa')](function(){console['log'](_0x4800('0xf'),_0x4800('0x12'));})[_0x4800('0x13')](function(_0x3003e6){console[_0x4800('0xc')](_0x3003e6);}); \ No newline at end of file +var _0x6246=['CmHopper','then','finished\x20populating','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','destroy','CmContact','bulkCreate','log'];(function(_0x277a13,_0x29a2ab){var _0x25974b=function(_0x1a0ffb){while(--_0x1a0ffb){_0x277a13['push'](_0x277a13['shift']());}};_0x25974b(++_0x29a2ab);}(_0x6246,0x1e2));var _0x6624=function(_0x20d2a1,_0x39b3ca){_0x20d2a1=_0x20d2a1-0x0;var _0x331e7d=_0x6246[_0x20d2a1];return _0x331e7d;};'use strict';var util=require(_0x6624('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6624('0x1')]({'id':i,'firstName':_0x6624('0x2')+i,'lastName':_0x6624('0x3')+i,'phone':0xf879fb460+i,'email':_0x6624('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x6624('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6624('0x5')](),'updatedAt':Date[_0x6624('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6624('0x1')]({'id':i,'firstName':_0x6624('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6624('0x4')+i+_0x6624('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x6624('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6624('0x5')](),'updatedAt':Date[_0x6624('0x5')]()});}db['CmContact'][_0x6624('0x7')]({'where':{}})['then'](function(){return db[_0x6624('0x8')][_0x6624('0x9')](contacts);})['then'](function(){console[_0x6624('0xa')]('finished\x20populating','contacts1');return db[_0x6624('0xb')]['destroy']({'where':{}});})['then'](function(){return db[_0x6624('0xb')]['bulkCreate'](hopper);})[_0x6624('0xc')](function(){console[_0x6624('0xa')](_0x6624('0xd'),'hopper1');return db[_0x6624('0x8')][_0x6624('0x9')](contacts2);})[_0x6624('0xc')](function(){console[_0x6624('0xa')](_0x6624('0xd'),_0x6624('0xe'));return db[_0x6624('0xb')][_0x6624('0x9')](hopper2);})[_0x6624('0xc')](function(){console[_0x6624('0xa')]('finished\x20populating',_0x6624('0xf'));})[_0x6624('0x10')](function(_0x29a0a6){console[_0x6624('0xa')](_0x29a0a6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 27871fd..e11c20e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cce=['/etc/pki/tls/private/motion.key','actpass','User','add\x20user','catch','log','util','../mysqldb','push','format','%s%s','agent','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x23d0c7,_0x3626b3){var _0x7daace=function(_0x1dbce6){while(--_0x1dbce6){_0x23d0c7['push'](_0x23d0c7['shift']());}};_0x7daace(++_0x3626b3);}(_0x4cce,0x16f));var _0xe4cc=function(_0x50a320,_0x22dba5){_0x50a320=_0x50a320-0x0;var _0x4e5d7d=_0x4cce[_0x50a320];return _0x4e5d7d;};'use strict';var util=require(_0xe4cc('0x0'));var db=require(_0xe4cc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe4cc('0x2')]({'name':util[_0xe4cc('0x3')](_0xe4cc('0x4'),'agent',i),'fullname':util[_0xe4cc('0x3')]('%s%s','agent',i),'email':util[_0xe4cc('0x3')]('%s%s@xcally.com','agent',i),'role':_0xe4cc('0x5'),'password':_0xe4cc('0x6'),'internal':0xfa0+i,'type':_0xe4cc('0x7'),'transport':[_0xe4cc('0x8'),'ws',_0xe4cc('0x9')],'disallow':['all'],'allow':[_0xe4cc('0xa')],'defaultuser':util['format'](_0xe4cc('0x4'),_0xe4cc('0x5'),i),'encryption':_0xe4cc('0xb'),'avpf':_0xe4cc('0xb'),'force_avp':_0xe4cc('0xb'),'icesupport':'yes','dtlsenable':_0xe4cc('0xb'),'dtlsverify':'no','dtlscertfile':_0xe4cc('0xc'),'dtlsprivatekey':_0xe4cc('0xd'),'dtlssetup':_0xe4cc('0xe'),'callerid':util[_0xe4cc('0x3')]('\x22%s\x22\x20<%s>',util[_0xe4cc('0x3')](_0xe4cc('0x4'),'agent',i),0xfa0+i)});}db[_0xe4cc('0xf')]['bulkCreate'](users)['then'](function(){console['log'](_0xe4cc('0x10'));})[_0xe4cc('0x11')](function(_0x4bedc0){console[_0xe4cc('0x12')](_0x4bedc0);}); \ No newline at end of file +var _0x3b97=['friend','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0x3b97,0x1a8));var _0x73b9=function(_0x3de3b8,_0x172ec4){_0x3de3b8=_0x3de3b8-0x0;var _0x48c06c=_0x3b97[_0x3de3b8];return _0x48c06c;};'use strict';var util=require(_0x73b9('0x0'));var db=require(_0x73b9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x73b9('0x2')]({'name':util[_0x73b9('0x3')]('%s%s',_0x73b9('0x4'),i),'fullname':util[_0x73b9('0x3')](_0x73b9('0x5'),_0x73b9('0x4'),i),'email':util[_0x73b9('0x3')](_0x73b9('0x6'),_0x73b9('0x4'),i),'role':'agent','password':_0x73b9('0x7'),'internal':0xfa0+i,'type':_0x73b9('0x8'),'transport':['udp','ws','wss'],'disallow':[_0x73b9('0x9')],'allow':[_0x73b9('0xa')],'defaultuser':util[_0x73b9('0x3')](_0x73b9('0x5'),_0x73b9('0x4'),i),'encryption':_0x73b9('0xb'),'avpf':_0x73b9('0xb'),'force_avp':_0x73b9('0xb'),'icesupport':_0x73b9('0xb'),'dtlsenable':_0x73b9('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x73b9('0xc'),'callerid':util[_0x73b9('0x3')](_0x73b9('0xd'),util[_0x73b9('0x3')](_0x73b9('0x5'),_0x73b9('0x4'),i),0xfa0+i)});}db[_0x73b9('0xe')][_0x73b9('0xf')](users)['then'](function(){console[_0x73b9('0x10')]('add\x20user');})[_0x73b9('0x11')](function(_0x173e6b){console[_0x73b9('0x10')](_0x173e6b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b7bbeb3..cba29c2 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d85=['SmsQueues','OpenchannelQueues','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','CONNECTED','lodash','bluebird','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','then','autoAssociation','VoiceQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','ivr','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','FaxQueue'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x1d85,0xe9));var _0x51d8=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x1d85[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x51d8('0x0'));var util=require('util');var BPromise=require(_0x51d8('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x51d8('0x2'));var queryQueues={'attributes':['id',_0x51d8('0x3')],'include':[{'as':_0x51d8('0x4'),'model':db[_0x51d8('0x5')],'attributes':['id',_0x51d8('0x3'),_0x51d8('0x6')],'raw':!![],'where':{'role':_0x51d8('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x51d8('0x3')],'where':{'role':_0x51d8('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x51d8('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x51d8('0x3')],'where':{'role':_0x51d8('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x51d8('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x598ed1,_0x56092a,_0x48a745){return db[_0x51d8('0xa')]['findOne']({'where':{'name':_0x598ed1,'userProfileId':_0x56092a},'raw':!![]})[_0x51d8('0xb')](function(_0x369f30){if(_0x369f30){if(_0x369f30[_0x51d8('0xc')]){switch(_0x598ed1){case _0x51d8('0xd'):case'ChatQueues':case _0x51d8('0xe'):case'SmsQueues':case _0x51d8('0xf'):case'OpenchannelQueues':case _0x51d8('0x10'):return db[_0x48a745][_0x51d8('0x11')](queryQueues);case'Telephones':return db[_0x48a745][_0x51d8('0x11')](queryTelephones);case _0x51d8('0x12'):return db[_0x48a745][_0x51d8('0x11')](queryTrunks);case _0x51d8('0x13'):return db[_0x48a745][_0x51d8('0x11')](queryCampaigns);}}else{return db[_0x51d8('0x14')][_0x51d8('0x11')]({'attributes':[_0x51d8('0x15')],'where':{'sectionId':_0x369f30['id']},'raw':!![]})[_0x51d8('0xb')](function(_0x263ed2){if(_0x263ed2){var _0x5426f5={'where':{'id':_[_0x51d8('0x16')](_0x263ed2,_0x51d8('0x15'))},'raw':!![]};switch(_0x48a745){case _0x51d8('0x5'):_0x5426f5[_0x51d8('0x17')][_0x51d8('0x6')]=_0x51d8('0x8');break;case _0x51d8('0x18'):_0x5426f5[_0x51d8('0x17')][_0x51d8('0x9')]=_0x51d8('0x19');break;}return db[_0x48a745][_0x51d8('0x11')](_0x5426f5);}else{return[];}});}}else{return[];}})[_0x51d8('0xb')](function(_0xecc044){return _0xecc044;});}function joinOrLeaveQueues(_0x1e453e,_0x1939ab,_0x5651d6,_0x27985c){_0x1e453e[_0x1939ab](util[_0x51d8('0x1a')](_0x51d8('0x1b'),_0x5651d6,_0x27985c[_0x51d8('0x3')]));if(_0x27985c[_0x51d8('0x4')]){for(var _0x59ad79=0x0;_0x59ad79<_0x27985c['Agents'][_0x51d8('0x1c')];_0x59ad79+=0x1){_0x1e453e[_0x1939ab](util['format'](_0x51d8('0x1d'),_0x27985c[_0x51d8('0x4')][_0x59ad79][_0x51d8('0x3')]));}}}function joinOrLeave(_0x32a407,_0x597da7,_0x4d17c4){var _0x4f1914;if(_0x32a407[_0x51d8('0x1e')][_0x51d8('0x1f')]['id']){db[_0x51d8('0x5')][_0x51d8('0x20')]({'attributes':['id',_0x51d8('0x3'),_0x51d8('0x6'),_0x51d8('0x21')],'where':{'id':_0x32a407['handshake'][_0x51d8('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x51d8('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x51d8('0x23')],'as':_0x51d8('0x24'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x51d8('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x51d8('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x51d8('0x27')],'as':_0x51d8('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x51d8('0x29')],'as':_0x51d8('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x51d8('0xb')](function(_0x36a242){if(_0x36a242){_0x4f1914=_0x36a242;_0x32a407[_0x597da7](util['format'](_0x51d8('0x1d'),_0x36a242['name']));var _0x51ee6a=[];switch(_0x36a242[_0x51d8('0x6')]){case _0x51d8('0x2b'):_0x32a407[_0x597da7](_0x51d8('0x2c'));_0x32a407[_0x597da7](_0x51d8('0x2d'));if(queryQueues[_0x51d8('0x2e')](_0x51d8('0x2f'))){delete queryQueues[_0x51d8('0x2f')];}_0x51ee6a[_0x51d8('0x30')](db['VoiceQueue'][_0x51d8('0x11')](queryQueues));_0x51ee6a['push'](db[_0x51d8('0x31')][_0x51d8('0x11')](queryQueues));_0x51ee6a['push'](db['FaxQueue'][_0x51d8('0x11')](queryQueues));_0x51ee6a[_0x51d8('0x30')](db[_0x51d8('0x32')][_0x51d8('0x11')](queryQueues));_0x51ee6a['push'](db[_0x51d8('0x33')][_0x51d8('0x11')](queryQueues));_0x51ee6a[_0x51d8('0x30')](db[_0x51d8('0x34')][_0x51d8('0x11')](queryQueues));_0x51ee6a['push'](db[_0x51d8('0x35')][_0x51d8('0x11')](queryQueues));_0x51ee6a['push'](db[_0x51d8('0x5')][_0x51d8('0x11')](queryTelephones));_0x51ee6a[_0x51d8('0x30')](db[_0x51d8('0x36')][_0x51d8('0x11')](queryTrunks));_0x51ee6a[_0x51d8('0x30')](db['Campaign'][_0x51d8('0x11')](queryCampaigns));_0x51ee6a[_0x51d8('0x30')](db[_0x51d8('0x5')][_0x51d8('0x11')](queryAgents));break;case _0x51d8('0x37'):_0x32a407[_0x597da7]('voice:inbound');_0x32a407[_0x597da7](_0x51d8('0x2d'));_0x51ee6a[_0x51d8('0x30')](getAssociatedResources(_0x51d8('0xd'),_0x36a242[_0x51d8('0x21')],'VoiceQueue'));_0x51ee6a[_0x51d8('0x30')](getAssociatedResources(_0x51d8('0x38'),_0x36a242[_0x51d8('0x21')],_0x51d8('0x31')));_0x51ee6a[_0x51d8('0x30')](getAssociatedResources(_0x51d8('0xe'),_0x36a242[_0x51d8('0x21')],_0x51d8('0x39')));_0x51ee6a[_0x51d8('0x30')](getAssociatedResources(_0x51d8('0x3a'),_0x36a242[_0x51d8('0x21')],_0x51d8('0x32')));_0x51ee6a['push'](getAssociatedResources(_0x51d8('0xf'),_0x36a242[_0x51d8('0x21')],_0x51d8('0x33')));_0x51ee6a[_0x51d8('0x30')](getAssociatedResources(_0x51d8('0x3b'),_0x36a242[_0x51d8('0x21')],_0x51d8('0x34')));_0x51ee6a[_0x51d8('0x30')](getAssociatedResources('WhatsappQueues',_0x36a242[_0x51d8('0x21')],_0x51d8('0x35')));_0x51ee6a['push'](getAssociatedResources(_0x51d8('0x3c'),_0x36a242[_0x51d8('0x21')],_0x51d8('0x5')));_0x51ee6a['push'](getAssociatedResources(_0x51d8('0x12'),_0x36a242[_0x51d8('0x21')],_0x51d8('0x36')));_0x51ee6a[_0x51d8('0x30')](getAssociatedResources(_0x51d8('0x13'),_0x36a242[_0x51d8('0x21')],_0x51d8('0x18')));_0x51ee6a['push'](db['User'][_0x51d8('0x11')](queryAgents));break;case _0x51d8('0x7'):_0x32a407[_0x597da7]('voice:inbound');_0x32a407[_0x597da7](_0x51d8('0x2d'));_0x51ee6a[_0x51d8('0x30')](_0x36a242[_0x51d8('0x3d')]({'attributes':['id',_0x51d8('0x3')]}));_0x51ee6a[_0x51d8('0x30')](_0x36a242[_0x51d8('0x3e')]({'attributes':['id',_0x51d8('0x3')]}));_0x51ee6a['push'](_0x36a242[_0x51d8('0x3f')]({'attributes':['id',_0x51d8('0x3')]}));_0x51ee6a[_0x51d8('0x30')](_0x36a242[_0x51d8('0x40')]({'attributes':['id',_0x51d8('0x3')]}));_0x51ee6a['push'](_0x36a242['getMailQueues']({'attributes':['id',_0x51d8('0x3')]}));_0x51ee6a[_0x51d8('0x30')](_0x36a242[_0x51d8('0x41')]({'attributes':['id','name']}));_0x51ee6a['push'](_0x36a242[_0x51d8('0x42')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x51ee6a);}})[_0x51d8('0xb')](function(_0x3f02b9){if(_0x3f02b9&&_0x3f02b9[_0x51d8('0x1c')]){for(var _0x3b8b10=0x0;_0x3b8b10<_0x3f02b9[_0x51d8('0x1c')];_0x3b8b10+=0x1){for(var _0x3942c3=0x0;_0x3942c3<_0x3f02b9[_0x3b8b10][_0x51d8('0x1c')];_0x3942c3+=0x1){switch(_0x3b8b10){case 0x0:joinOrLeaveQueues(_0x32a407,_0x597da7,_0x51d8('0x43'),_0x3f02b9[_0x3b8b10][_0x3942c3]);break;case 0x1:joinOrLeaveQueues(_0x32a407,_0x597da7,_0x51d8('0x44'),_0x3f02b9[_0x3b8b10][_0x3942c3]);break;case 0x2:joinOrLeaveQueues(_0x32a407,_0x597da7,_0x51d8('0x45'),_0x3f02b9[_0x3b8b10][_0x3942c3]);break;case 0x3:joinOrLeaveQueues(_0x32a407,_0x597da7,'sms',_0x3f02b9[_0x3b8b10][_0x3942c3]);break;case 0x4:joinOrLeaveQueues(_0x32a407,_0x597da7,'mail',_0x3f02b9[_0x3b8b10][_0x3942c3]);break;case 0x5:joinOrLeaveQueues(_0x32a407,_0x597da7,'openchannel',_0x3f02b9[_0x3b8b10][_0x3942c3]);break;case 0x6:joinOrLeaveQueues(_0x32a407,_0x597da7,'whatsapp',_0x3f02b9[_0x3b8b10][_0x3942c3]);break;case 0x7:_0x32a407[_0x597da7](util['format'](_0x51d8('0x46'),_0x3f02b9[_0x3b8b10][_0x3942c3][_0x51d8('0x3')]));break;case 0x8:_0x32a407[_0x597da7](util[_0x51d8('0x1a')]('trunk:%s',_0x3f02b9[_0x3b8b10][_0x3942c3][_0x51d8('0x3')]));break;case 0x9:_0x32a407[_0x597da7](util['format'](_0x51d8('0x47'),_0x3f02b9[_0x3b8b10][_0x3942c3][_0x51d8('0x9')],_0x3f02b9[_0x3b8b10][_0x3942c3]['name']));break;case 0xa:_0x32a407[_0x597da7](util['format'](_0x51d8('0x1d'),_0x3f02b9[_0x3b8b10][_0x3942c3][_0x51d8('0x3')]));break;}}}}})[_0x51d8('0xb')](function(){if(_0x597da7===_0x51d8('0x48')){var _0x281cd4=_[_0x51d8('0x16')](_0x4f1914[_0x51d8('0x22')],'id');return _0x4f1914[_0x51d8('0x49')](_0x281cd4)[_0x51d8('0xb')](function(){for(var _0xcbf2d5=0x0;_0xcbf2d5<_0x281cd4[_0x51d8('0x1c')];_0xcbf2d5+=0x1){_0x4d17c4[_0x51d8('0x4a')](_0x51d8('0x4b'),{'ChatInteractionId':Number(_0x281cd4[_0xcbf2d5]),'UserId':Number(_0x4f1914['id'])});}});}})['then'](function(){if(_0x597da7==='leave'){var _0x39e142=_['map'](_0x4f1914[_0x51d8('0x24')],'id');return _0x4f1914[_0x51d8('0x4c')](_0x39e142)[_0x51d8('0xb')](function(){for(var _0x15aede=0x0;_0x15aede<_0x39e142[_0x51d8('0x1c')];_0x15aede+=0x1){_0x4d17c4[_0x51d8('0x4a')](_0x51d8('0x4d'),{'MailInteractionId':Number(_0x39e142[_0x15aede]),'UserId':Number(_0x4f1914['id'])});}});}})[_0x51d8('0xb')](function(){if(_0x597da7===_0x51d8('0x48')){var _0x154b43=_[_0x51d8('0x16')](_0x4f1914['FaxInteractions'],'id');return _0x4f1914[_0x51d8('0x4e')](_0x154b43)[_0x51d8('0xb')](function(){for(var _0x390260=0x0;_0x390260<_0x154b43[_0x51d8('0x1c')];_0x390260+=0x1){_0x4d17c4['emit'](_0x51d8('0x4f'),{'FaxInteractionId':Number(_0x154b43[_0x390260]),'UserId':Number(_0x4f1914['id'])});}});}})[_0x51d8('0xb')](function(){if(_0x597da7==='leave'){var _0x2f7d92=_[_0x51d8('0x16')](_0x4f1914['SmsInteractions'],'id');return _0x4f1914[_0x51d8('0x50')](_0x2f7d92)[_0x51d8('0xb')](function(){for(var _0x7c008a=0x0;_0x7c008a<_0x2f7d92[_0x51d8('0x1c')];_0x7c008a+=0x1){_0x4d17c4[_0x51d8('0x4a')](_0x51d8('0x51'),{'SmsInteractionId':Number(_0x2f7d92[_0x7c008a]),'UserId':Number(_0x4f1914['id'])});}});}})[_0x51d8('0xb')](function(){if(_0x597da7===_0x51d8('0x48')){var _0x3ceb92=_[_0x51d8('0x16')](_0x4f1914[_0x51d8('0x28')],'id');return _0x4f1914[_0x51d8('0x52')](_0x3ceb92)[_0x51d8('0xb')](function(){for(var _0x302bac=0x0;_0x302bac<_0x3ceb92[_0x51d8('0x1c')];_0x302bac+=0x1){_0x4d17c4[_0x51d8('0x4a')](_0x51d8('0x53'),{'OpenchannelInteractionId':Number(_0x3ceb92[_0x302bac]),'UserId':Number(_0x4f1914['id'])});}});}})[_0x51d8('0xb')](function(){if(_0x597da7===_0x51d8('0x48')){var _0x1d7f24=_['map'](_0x4f1914['WhatsappInteractions'],'id');return _0x4f1914['removeWhatsappInteractions'](_0x1d7f24)[_0x51d8('0xb')](function(){for(var _0x14096e=0x0;_0x14096e<_0x1d7f24[_0x51d8('0x1c')];_0x14096e+=0x1){_0x4d17c4[_0x51d8('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1d7f24[_0x14096e]),'UserId':Number(_0x4f1914['id'])});}});}})['catch'](function(_0x2160b6){_0x32a407[_0x51d8('0x54')](_0x2160b6);});}}function onDisconnect(_0x41068d,_0x512e68){joinOrLeave(_0x41068d,_0x51d8('0x48'),_0x512e68);}function onConnect(_0x4904ea){joinOrLeave(_0x4904ea,_0x51d8('0x55'));}exports[_0x51d8('0x56')]=function(_0x9ae9f5){_0x9ae9f5['on'](_0x51d8('0x57'),function(_0x1de14d){_0x1de14d[_0x51d8('0x58')](0x0);_0x1de14d[_0x51d8('0x59')]=_0x1de14d[_0x51d8('0x5a')][_0x51d8('0x57')][_0x51d8('0x5b')]+':'+_0x1de14d[_0x51d8('0x5a')][_0x51d8('0x57')][_0x51d8('0x5c')];_0x1de14d[_0x51d8('0x5d')]=new Date();_0x1de14d[_0x51d8('0x54')]=function(_0x3f7b32){console[_0x51d8('0x54')](_0x51d8('0x5e')+_0x1de14d[_0x51d8('0x5f')][_0x51d8('0x3')]+'['+_0x1de14d[_0x51d8('0x59')]+']',_0x3f7b32);};_0x1de14d['on']('disconnect',function(){onDisconnect(_0x1de14d,_0x9ae9f5);_0x1de14d[_0x51d8('0x54')]('DISCONNECTED');});onConnect(_0x1de14d);_0x1de14d['log'](_0x51d8('0x60'));});}; \ No newline at end of file +var _0x6bf8=['util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','ivr','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','OpenchannelQueue','Campaign','user','SmsQueues','SmsQueue','MailQueues','MailQueue','WhatsappQueue','getVoiceQueues','getChatQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','whatsapp','trunk:%s','leave','map','emit','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','connection','setMaxListeners','remoteAddress','connectedAt','log','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash'];(function(_0x55969f,_0x2cc83f){var _0x367e62=function(_0x10b2d3){while(--_0x10b2d3){_0x55969f['push'](_0x55969f['shift']());}};_0x367e62(++_0x2cc83f);}(_0x6bf8,0x183));var _0x86bf=function(_0x491fbc,_0x1a708a){_0x491fbc=_0x491fbc-0x0;var _0x2559d7=_0x6bf8[_0x491fbc];return _0x2559d7;};'use strict';var _=require(_0x86bf('0x0'));var util=require(_0x86bf('0x1'));var BPromise=require(_0x86bf('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x86bf('0x3'));var queryQueues={'attributes':['id',_0x86bf('0x4')],'include':[{'as':_0x86bf('0x5'),'model':db[_0x86bf('0x6')],'attributes':['id',_0x86bf('0x4'),_0x86bf('0x7')],'raw':!![],'where':{'role':_0x86bf('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x86bf('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x86bf('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x86bf('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x86bf('0x4'),_0x86bf('0xa')],'where':{'type':'ivr'}};function getAssociatedResources(_0x131708,_0x145f3d,_0x4f465e){return db[_0x86bf('0xb')][_0x86bf('0xc')]({'where':{'name':_0x131708,'userProfileId':_0x145f3d},'raw':!![]})[_0x86bf('0xd')](function(_0x53c243){if(_0x53c243){if(_0x53c243[_0x86bf('0xe')]){switch(_0x131708){case _0x86bf('0xf'):case _0x86bf('0x10'):case _0x86bf('0x11'):case'SmsQueues':case'MailQueues':case _0x86bf('0x12'):case _0x86bf('0x13'):return db[_0x4f465e]['findAll'](queryQueues);case _0x86bf('0x14'):return db[_0x4f465e][_0x86bf('0x15')](queryTelephones);case _0x86bf('0x16'):return db[_0x4f465e][_0x86bf('0x15')](queryTrunks);case _0x86bf('0x17'):return db[_0x4f465e][_0x86bf('0x15')](queryCampaigns);}}else{return db[_0x86bf('0x18')][_0x86bf('0x15')]({'attributes':[_0x86bf('0x19')],'where':{'sectionId':_0x53c243['id']},'raw':!![]})[_0x86bf('0xd')](function(_0x58bb41){if(_0x58bb41){var _0x17761f={'where':{'id':_['map'](_0x58bb41,_0x86bf('0x19'))},'raw':!![]};switch(_0x4f465e){case'User':_0x17761f[_0x86bf('0x1a')][_0x86bf('0x7')]='telephone';break;case'Campaign':_0x17761f[_0x86bf('0x1a')][_0x86bf('0xa')]=_0x86bf('0x1b');break;}return db[_0x4f465e][_0x86bf('0x15')](_0x17761f);}else{return[];}});}}else{return[];}})[_0x86bf('0xd')](function(_0x2eda9d){return _0x2eda9d;});}function joinOrLeaveQueues(_0x312403,_0x3892eb,_0x2494aa,_0xed4fdd){_0x312403[_0x3892eb](util['format']('%s:queue:%s',_0x2494aa,_0xed4fdd[_0x86bf('0x4')]));if(_0xed4fdd[_0x86bf('0x5')]){for(var _0x132a54=0x0;_0x132a54<_0xed4fdd[_0x86bf('0x5')][_0x86bf('0x1c')];_0x132a54+=0x1){_0x312403[_0x3892eb](util[_0x86bf('0x1d')](_0x86bf('0x1e'),_0xed4fdd[_0x86bf('0x5')][_0x132a54][_0x86bf('0x4')]));}}}function joinOrLeave(_0x1a3653,_0x5664eb,_0x5388cc){var _0x4c182;if(_0x1a3653[_0x86bf('0x1f')][_0x86bf('0x20')]['id']){db['User'][_0x86bf('0x21')]({'attributes':['id','name',_0x86bf('0x7'),_0x86bf('0x22')],'where':{'id':_0x1a3653['handshake'][_0x86bf('0x20')]['id']},'include':[{'model':db[_0x86bf('0x23')],'as':_0x86bf('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x86bf('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x86bf('0x26')],'as':_0x86bf('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x86bf('0x28')],'as':_0x86bf('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x86bf('0xd')](function(_0x58d28a){if(_0x58d28a){_0x4c182=_0x58d28a;_0x1a3653[_0x5664eb](util[_0x86bf('0x1d')](_0x86bf('0x1e'),_0x58d28a[_0x86bf('0x4')]));var _0x2c701f=[];switch(_0x58d28a[_0x86bf('0x7')]){case _0x86bf('0x2a'):_0x1a3653[_0x5664eb](_0x86bf('0x2b'));_0x1a3653[_0x5664eb](_0x86bf('0x2c'));if(queryQueues[_0x86bf('0x2d')](_0x86bf('0x2e'))){delete queryQueues[_0x86bf('0x2e')];}_0x2c701f['push'](db[_0x86bf('0x2f')][_0x86bf('0x15')](queryQueues));_0x2c701f[_0x86bf('0x30')](db[_0x86bf('0x31')]['findAll'](queryQueues));_0x2c701f['push'](db['FaxQueue'][_0x86bf('0x15')](queryQueues));_0x2c701f[_0x86bf('0x30')](db['SmsQueue'][_0x86bf('0x15')](queryQueues));_0x2c701f[_0x86bf('0x30')](db['MailQueue'][_0x86bf('0x15')](queryQueues));_0x2c701f[_0x86bf('0x30')](db[_0x86bf('0x32')][_0x86bf('0x15')](queryQueues));_0x2c701f[_0x86bf('0x30')](db['WhatsappQueue'][_0x86bf('0x15')](queryQueues));_0x2c701f['push'](db[_0x86bf('0x6')][_0x86bf('0x15')](queryTelephones));_0x2c701f[_0x86bf('0x30')](db['Trunk'][_0x86bf('0x15')](queryTrunks));_0x2c701f[_0x86bf('0x30')](db[_0x86bf('0x33')][_0x86bf('0x15')](queryCampaigns));_0x2c701f[_0x86bf('0x30')](db[_0x86bf('0x6')][_0x86bf('0x15')](queryAgents));break;case _0x86bf('0x34'):_0x1a3653[_0x5664eb](_0x86bf('0x2b'));_0x1a3653[_0x5664eb](_0x86bf('0x2c'));_0x2c701f[_0x86bf('0x30')](getAssociatedResources(_0x86bf('0xf'),_0x58d28a[_0x86bf('0x22')],_0x86bf('0x2f')));_0x2c701f[_0x86bf('0x30')](getAssociatedResources(_0x86bf('0x10'),_0x58d28a[_0x86bf('0x22')],_0x86bf('0x31')));_0x2c701f[_0x86bf('0x30')](getAssociatedResources('FaxQueues',_0x58d28a['userProfileId'],'FaxQueue'));_0x2c701f[_0x86bf('0x30')](getAssociatedResources(_0x86bf('0x35'),_0x58d28a[_0x86bf('0x22')],_0x86bf('0x36')));_0x2c701f['push'](getAssociatedResources(_0x86bf('0x37'),_0x58d28a[_0x86bf('0x22')],_0x86bf('0x38')));_0x2c701f[_0x86bf('0x30')](getAssociatedResources('OpenchannelQueues',_0x58d28a[_0x86bf('0x22')],_0x86bf('0x32')));_0x2c701f['push'](getAssociatedResources(_0x86bf('0x13'),_0x58d28a['userProfileId'],_0x86bf('0x39')));_0x2c701f[_0x86bf('0x30')](getAssociatedResources('Telephones',_0x58d28a[_0x86bf('0x22')],_0x86bf('0x6')));_0x2c701f[_0x86bf('0x30')](getAssociatedResources(_0x86bf('0x16'),_0x58d28a[_0x86bf('0x22')],'Trunk'));_0x2c701f[_0x86bf('0x30')](getAssociatedResources(_0x86bf('0x17'),_0x58d28a[_0x86bf('0x22')],_0x86bf('0x33')));_0x2c701f[_0x86bf('0x30')](db[_0x86bf('0x6')]['findAll'](queryAgents));break;case'agent':_0x1a3653[_0x5664eb](_0x86bf('0x2b'));_0x1a3653[_0x5664eb](_0x86bf('0x2c'));_0x2c701f[_0x86bf('0x30')](_0x58d28a[_0x86bf('0x3a')]({'attributes':['id',_0x86bf('0x4')]}));_0x2c701f[_0x86bf('0x30')](_0x58d28a[_0x86bf('0x3b')]({'attributes':['id',_0x86bf('0x4')]}));_0x2c701f['push'](_0x58d28a['getFaxQueues']({'attributes':['id',_0x86bf('0x4')]}));_0x2c701f[_0x86bf('0x30')](_0x58d28a['getSmsQueues']({'attributes':['id',_0x86bf('0x4')]}));_0x2c701f[_0x86bf('0x30')](_0x58d28a[_0x86bf('0x3c')]({'attributes':['id',_0x86bf('0x4')]}));_0x2c701f['push'](_0x58d28a['getOpenchannelQueues']({'attributes':['id',_0x86bf('0x4')]}));_0x2c701f[_0x86bf('0x30')](_0x58d28a[_0x86bf('0x3d')]({'attributes':['id',_0x86bf('0x4')]}));break;}return BPromise[_0x86bf('0x3e')](_0x2c701f);}})[_0x86bf('0xd')](function(_0x15cbcd){if(_0x15cbcd&&_0x15cbcd['length']){for(var _0xdb8082=0x0;_0xdb8082<_0x15cbcd[_0x86bf('0x1c')];_0xdb8082+=0x1){for(var _0x3679fd=0x0;_0x3679fd<_0x15cbcd[_0xdb8082][_0x86bf('0x1c')];_0x3679fd+=0x1){switch(_0xdb8082){case 0x0:joinOrLeaveQueues(_0x1a3653,_0x5664eb,_0x86bf('0x3f'),_0x15cbcd[_0xdb8082][_0x3679fd]);break;case 0x1:joinOrLeaveQueues(_0x1a3653,_0x5664eb,_0x86bf('0x40'),_0x15cbcd[_0xdb8082][_0x3679fd]);break;case 0x2:joinOrLeaveQueues(_0x1a3653,_0x5664eb,_0x86bf('0x41'),_0x15cbcd[_0xdb8082][_0x3679fd]);break;case 0x3:joinOrLeaveQueues(_0x1a3653,_0x5664eb,'sms',_0x15cbcd[_0xdb8082][_0x3679fd]);break;case 0x4:joinOrLeaveQueues(_0x1a3653,_0x5664eb,_0x86bf('0x42'),_0x15cbcd[_0xdb8082][_0x3679fd]);break;case 0x5:joinOrLeaveQueues(_0x1a3653,_0x5664eb,_0x86bf('0x43'),_0x15cbcd[_0xdb8082][_0x3679fd]);break;case 0x6:joinOrLeaveQueues(_0x1a3653,_0x5664eb,_0x86bf('0x44'),_0x15cbcd[_0xdb8082][_0x3679fd]);break;case 0x7:_0x1a3653[_0x5664eb](util[_0x86bf('0x1d')]('telephone:%s',_0x15cbcd[_0xdb8082][_0x3679fd][_0x86bf('0x4')]));break;case 0x8:_0x1a3653[_0x5664eb](util[_0x86bf('0x1d')](_0x86bf('0x45'),_0x15cbcd[_0xdb8082][_0x3679fd][_0x86bf('0x4')]));break;case 0x9:_0x1a3653[_0x5664eb](util[_0x86bf('0x1d')]('campaign:%s:%s',_0x15cbcd[_0xdb8082][_0x3679fd][_0x86bf('0xa')],_0x15cbcd[_0xdb8082][_0x3679fd][_0x86bf('0x4')]));break;case 0xa:_0x1a3653[_0x5664eb](util[_0x86bf('0x1d')]('user:%s',_0x15cbcd[_0xdb8082][_0x3679fd][_0x86bf('0x4')]));break;}}}}})[_0x86bf('0xd')](function(){if(_0x5664eb===_0x86bf('0x46')){var _0x53b10b=_[_0x86bf('0x47')](_0x4c182['ChatInteractions'],'id');return _0x4c182['removeChatInteractions'](_0x53b10b)[_0x86bf('0xd')](function(){for(var _0x33c649=0x0;_0x33c649<_0x53b10b[_0x86bf('0x1c')];_0x33c649+=0x1){_0x5388cc[_0x86bf('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x53b10b[_0x33c649]),'UserId':Number(_0x4c182['id'])});}});}})[_0x86bf('0xd')](function(){if(_0x5664eb==='leave'){var _0x124a4f=_[_0x86bf('0x47')](_0x4c182[_0x86bf('0x25')],'id');return _0x4c182[_0x86bf('0x49')](_0x124a4f)['then'](function(){for(var _0xb27e0c=0x0;_0xb27e0c<_0x124a4f[_0x86bf('0x1c')];_0xb27e0c+=0x1){_0x5388cc['emit'](_0x86bf('0x4a'),{'MailInteractionId':Number(_0x124a4f[_0xb27e0c]),'UserId':Number(_0x4c182['id'])});}});}})[_0x86bf('0xd')](function(){if(_0x5664eb===_0x86bf('0x46')){var _0x3af2cd=_[_0x86bf('0x47')](_0x4c182[_0x86bf('0x4b')],'id');return _0x4c182[_0x86bf('0x4c')](_0x3af2cd)[_0x86bf('0xd')](function(){for(var _0x312387=0x0;_0x312387<_0x3af2cd['length'];_0x312387+=0x1){_0x5388cc['emit'](_0x86bf('0x4d'),{'FaxInteractionId':Number(_0x3af2cd[_0x312387]),'UserId':Number(_0x4c182['id'])});}});}})[_0x86bf('0xd')](function(){if(_0x5664eb===_0x86bf('0x46')){var _0x27a1ec=_['map'](_0x4c182[_0x86bf('0x27')],'id');return _0x4c182[_0x86bf('0x4e')](_0x27a1ec)[_0x86bf('0xd')](function(){for(var _0x1e2077=0x0;_0x1e2077<_0x27a1ec[_0x86bf('0x1c')];_0x1e2077+=0x1){_0x5388cc['emit'](_0x86bf('0x4f'),{'SmsInteractionId':Number(_0x27a1ec[_0x1e2077]),'UserId':Number(_0x4c182['id'])});}});}})[_0x86bf('0xd')](function(){if(_0x5664eb===_0x86bf('0x46')){var _0x3c49d9=_[_0x86bf('0x47')](_0x4c182[_0x86bf('0x29')],'id');return _0x4c182[_0x86bf('0x50')](_0x3c49d9)[_0x86bf('0xd')](function(){for(var _0x5c2b0d=0x0;_0x5c2b0d<_0x3c49d9[_0x86bf('0x1c')];_0x5c2b0d+=0x1){_0x5388cc[_0x86bf('0x48')](_0x86bf('0x51'),{'OpenchannelInteractionId':Number(_0x3c49d9[_0x5c2b0d]),'UserId':Number(_0x4c182['id'])});}});}})['then'](function(){if(_0x5664eb==='leave'){var _0xcfa265=_[_0x86bf('0x47')](_0x4c182[_0x86bf('0x52')],'id');return _0x4c182[_0x86bf('0x53')](_0xcfa265)['then'](function(){for(var _0x5f2928=0x0;_0x5f2928<_0xcfa265[_0x86bf('0x1c')];_0x5f2928+=0x1){_0x5388cc[_0x86bf('0x48')](_0x86bf('0x54'),{'WhatsappInteractionId':Number(_0xcfa265[_0x5f2928]),'UserId':Number(_0x4c182['id'])});}});}})[_0x86bf('0x55')](function(_0x3be8d2){_0x1a3653['log'](_0x3be8d2);});}}function onDisconnect(_0x19d321,_0x2f49a3){joinOrLeave(_0x19d321,_0x86bf('0x46'),_0x2f49a3);}function onConnect(_0x3ab81c){joinOrLeave(_0x3ab81c,_0x86bf('0x56'));}exports['default']=function(_0x2d4936){_0x2d4936['on'](_0x86bf('0x57'),function(_0x4fa5e8){_0x4fa5e8[_0x86bf('0x58')](0x0);_0x4fa5e8['address']=_0x4fa5e8['request'][_0x86bf('0x57')][_0x86bf('0x59')]+':'+_0x4fa5e8['request'][_0x86bf('0x57')]['remotePort'];_0x4fa5e8[_0x86bf('0x5a')]=new Date();_0x4fa5e8['log']=function(_0x450769){console[_0x86bf('0x5b')]('SocketIO\x20'+_0x4fa5e8[_0x86bf('0x5c')][_0x86bf('0x4')]+'['+_0x4fa5e8[_0x86bf('0x5d')]+']',_0x450769);};_0x4fa5e8['on'](_0x86bf('0x5e'),function(){onDisconnect(_0x4fa5e8,_0x2d4936);_0x4fa5e8[_0x86bf('0x5b')](_0x86bf('0x5f'));});onConnect(_0x4fa5e8);_0x4fa5e8[_0x86bf('0x5b')](_0x86bf('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 144aaf9..ea1f9ae 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 _0x17b8=['Whatsapp','WhatsappMessage','newmessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','catch','direction','User','UserId','then','interface','format','SIP/%s','channel','incomingmessage','outgoingmessage','opened','changed','closed','event','name','default','length','hasOwnProperty','model','hook','toLowerCase','condition','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction'];(function(_0x3511c8,_0x41404b){var _0x47233e=function(_0x55b363){while(--_0x55b363){_0x3511c8['push'](_0x3511c8['shift']());}};_0x47233e(++_0x41404b);}(_0x17b8,0x146));var _0x817b=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x17b8[_0x323430];return _0x9eecd1;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x817b('0x0'));var logger=require(_0x817b('0x1'))(_0x817b('0x2'));var client=jayson[_0x817b('0x3')][_0x817b('0x4')]({'port':0x232a});var triggers=[{'channel':_0x817b('0x5'),'model':_0x817b('0x6'),'event':_0x817b('0x7'),'condition':_0x817b('0x8'),'callback':afterCreate},{'channel':_0x817b('0x5'),'model':_0x817b('0x6'),'event':_0x817b('0x9'),'condition':_0x817b('0xa'),'callback':afterUpdate},{'channel':_0x817b('0x5'),'model':_0x817b('0xb'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x817b('0xc'),'model':_0x817b('0xd'),'event':_0x817b('0x7'),'condition':_0x817b('0x8'),'callback':afterCreate},{'channel':_0x817b('0xc'),'model':_0x817b('0xd'),'event':_0x817b('0x9'),'condition':_0x817b('0xa'),'callback':afterUpdate},{'channel':_0x817b('0xc'),'model':_0x817b('0xe'),'event':_0x817b('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x817b('0xf'),'event':_0x817b('0x7'),'condition':_0x817b('0x8'),'callback':afterCreate},{'channel':_0x817b('0x10'),'model':_0x817b('0xf'),'event':_0x817b('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x817b('0x10'),'model':_0x817b('0x11'),'event':'afterCreate','condition':_0x817b('0x12'),'callback':afterCreateMessage},{'channel':_0x817b('0x13'),'model':_0x817b('0x14'),'event':_0x817b('0x7'),'condition':_0x817b('0x8'),'callback':afterCreate},{'channel':'Fax','model':_0x817b('0x14'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x817b('0x13'),'model':_0x817b('0x15'),'event':_0x817b('0x7'),'condition':_0x817b('0x12'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x817b('0x16'),'event':_0x817b('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x817b('0x17'),'model':'MailInteraction','event':_0x817b('0x9'),'condition':_0x817b('0xa'),'callback':afterUpdate},{'channel':_0x817b('0x17'),'model':_0x817b('0x18'),'event':_0x817b('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterCreate','condition':_0x817b('0x8'),'callback':afterCreate},{'channel':_0x817b('0x19'),'model':_0x817b('0x1a'),'event':_0x817b('0x9'),'condition':_0x817b('0xa'),'callback':afterUpdate},{'channel':_0x817b('0x19'),'model':_0x817b('0x1b'),'event':_0x817b('0x7'),'condition':_0x817b('0x12'),'callback':afterCreateMessage}];function request(_0x165f62){return client[_0x817b('0x1c')](_0x817b('0x1d'),_0x165f62)['then'](function(_0x3b7b54){logger[_0x817b('0x1e')](_0x817b('0x1f'),_0x817b('0x1d'),_0x3b7b54);if(_0x3b7b54[_0x817b('0x20')]){if(_0x3b7b54['error'][_0x817b('0x21')]===0x1f4){logger[_0x817b('0x20')](_0x817b('0x1f'),_0x817b('0x1d'),_0x3b7b54[_0x817b('0x20')]);}}})[_0x817b('0x22')](function(_0x3f2ed2){logger[_0x817b('0x20')](_0x817b('0x1f'),'EventManager',_0x3f2ed2);});}function afterCreateMessage(_0x23f9a7,_0x323906){return function(_0x135ec4,_0x2673c1){_0x135ec4=_0x135ec4['get']({'plain':!![]});_0x135ec4['channel']=_0x23f9a7;_0x135ec4['event']=_0x135ec4[_0x817b('0x23')];if(_0x135ec4['UserId']){return db[_0x817b('0x24')]['find']({'where':{'id':_0x135ec4[_0x817b('0x25')]},'attributes':['id','name'],'raw':!![]})[_0x817b('0x26')](function(_0x1e4212){_0x135ec4[_0x817b('0x27')]=util[_0x817b('0x28')](_0x817b('0x29'),_0x1e4212['name']);_0x135ec4[_0x817b('0x2a')]=_0x23f9a7;return request({'event':_0x817b('0x2b'),'message':_0x135ec4});})[_0x817b('0x22')](function(_0x374174){console[_0x817b('0x20')](_0x374174);});}else{return request({'event':_0x817b('0x2c'),'message':_0x135ec4});}};}function afterCreate(_0x45b651,_0x452c59){return function(_0x2ee76e,_0x2b57ce){_0x2ee76e=_0x2ee76e['get']({'plain':!![]});_0x2ee76e['channel']=_0x45b651;_0x2ee76e['event']=_0x817b('0x2d');return request({'event':_0x452c59,'message':_0x2ee76e});};}function afterUpdate(_0x918e7b,_0x5e0cf5){return function(_0x6a7fa5,_0x5eda91){if(_0x6a7fa5[_0x817b('0x2e')]('closed')&&_0x6a7fa5[_0x817b('0x2f')]){_0x6a7fa5=_0x6a7fa5['get']({'plain':!![]});_0x6a7fa5[_0x817b('0x2a')]=_0x918e7b;_0x6a7fa5[_0x817b('0x30')]='closed';if(_0x6a7fa5[_0x817b('0x25')]){return db[_0x817b('0x24')]['find']({'where':{'id':_0x6a7fa5[_0x817b('0x25')]},'attributes':['id',_0x817b('0x31')],'raw':!![]})['then'](function(_0x27462a){_0x6a7fa5[_0x817b('0x27')]=util['format'](_0x817b('0x29'),_0x27462a[_0x817b('0x31')]);return request({'event':_0x5e0cf5,'message':_0x6a7fa5});})[_0x817b('0x22')](function(_0x4756a2){console[_0x817b('0x20')](_0x4756a2);});}else{return request({'event':_0x5e0cf5,'message':_0x6a7fa5});}}};}exports[_0x817b('0x32')]=function(){for(var _0x534d76=0x0;_0x534d76=_0x14fb2c['agents']){throw Error(_0xcbd3('0x13'));}_0x32119e(_0x5a4e11);})[_0xcbd3('0x14')](function(_0x4ce8b6){_0x539be8(_0x4ce8b6);});});}; \ No newline at end of file +var _0x432f=['catch','lodash','bluebird','../mysqldb','voice','mail','chat','fax','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','then','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x17feef,_0x4db35d){var _0x36036f=function(_0x35eec4){while(--_0x35eec4){_0x17feef['push'](_0x17feef['shift']());}};_0x36036f(++_0x4db35d);}(_0x432f,0x14b));var _0xf432=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x432f[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xf432('0x0'));var BPromise=require(_0xf432('0x1'));var db=require(_0xf432('0x2'))['db'];var util=require('./license/util');var channels=[_0xf432('0x3'),_0xf432('0x4'),_0xf432('0x5'),_0xf432('0x6'),'sms','whatsapp',_0xf432('0x7')];exports[_0xf432('0x8')]=function(){return channels;};exports[_0xf432('0x9')]=function(_0x56bfa0){_0x56bfa0=_0x56bfa0[_0xf432('0xa')]();return _[_0xf432('0xb')](channels,_0x56bfa0);};exports['clearBlockUser']=function(_0xafd4bf,_0x4c4ed1,_0x356c42,_0x255d51){var _0x33a89d={'loginAttempts':_0x4c4ed1,'blocked':_0x356c42};if(!_[_0xf432('0xc')](_0x255d51)){_0x33a89d[_0xf432('0xd')]=_0x255d51;}return _0xafd4bf[_0xf432('0xe')](_0x33a89d);};exports[_0xf432('0xf')]=function(_0x1246ae){return new BPromise(function(_0x52b5dc,_0xc84b92){var _0x158200=0x0;if(_0x1246ae[_0xf432('0x10')]!==_0xf432('0x11')){_0x52b5dc(_0x1246ae);}db[_0xf432('0x12')]['count']({'where':{'role':_0xf432('0x11'),'online':!![],'id':{'$ne':_0x1246ae['id']}}})['then'](function(_0xec216c){_0x158200=_0xec216c;return util[_0xf432('0xf')]();})[_0xf432('0x13')](function(_0x1a1785){if(_0x1a1785&&_0x1a1785['agents']&&_0x158200>=_0x1a1785['agents']){throw Error(_0xf432('0x14'));}_0x52b5dc(_0x1246ae);})[_0xf432('0x15')](function(_0x336164){_0xc84b92(_0x336164);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 79d2e0b..660a914 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40b5=['404','status','render','exports'];(function(_0x5b710b,_0x103f64){var _0x40ccbe=function(_0x1b46d6){while(--_0x1b46d6){_0x5b710b['push'](_0x5b710b['shift']());}};_0x40ccbe(++_0x103f64);}(_0x40b5,0x1db));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x540b('0x0')][0x194]=function pageNotFound(_0x5443d8,_0x17f8e5){var _0xe5bbed=_0x540b('0x1');var _0x5c9587=0x194;var _0x26e516={'status':_0x5c9587};_0x17f8e5[_0x540b('0x2')](_0x26e516[_0x540b('0x2')]);_0x17f8e5[_0x540b('0x3')](_0xe5bbed,{},function(_0x284e65,_0x5416c8){if(_0x284e65){return _0x17f8e5[_0x540b('0x2')](_0x26e516['status'])['json'](_0x26e516);}_0x17f8e5['send'](_0x5416c8);});}; \ No newline at end of file +var _0x3eef=['render','json','send','exports','status'];(function(_0x244fdd,_0x1de564){var _0x51cd53=function(_0x3f75c3){while(--_0x3f75c3){_0x244fdd['push'](_0x244fdd['shift']());}};_0x51cd53(++_0x1de564);}(_0x3eef,0x19d));var _0xf3ee=function(_0x36ec2a,_0x4f1e02){_0x36ec2a=_0x36ec2a-0x0;var _0xbb2583=_0x3eef[_0x36ec2a];return _0xbb2583;};'use strict';module[_0xf3ee('0x0')][0x194]=function pageNotFound(_0x29a6d8,_0x271fbd){var _0x318748='404';var _0x3fd0d3=0x194;var _0x451a3b={'status':_0x3fd0d3};_0x271fbd[_0xf3ee('0x1')](_0x451a3b[_0xf3ee('0x1')]);_0x271fbd[_0xf3ee('0x2')](_0x318748,{},function(_0x5df701,_0x1c72e6){if(_0x5df701){return _0x271fbd[_0xf3ee('0x1')](_0x451a3b['status'])[_0xf3ee('0x3')](_0x451a3b);}_0x271fbd[_0xf3ee('0x4')](_0x1c72e6);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 49ceff2..50c45df 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b4e=['../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/tag/tag.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','Team','../api/team/team.model','License','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','belongsToMany','Groups','CmList','cm_user_has_lists','user_has_chat_interactions','user_has_sms_interactions','VoiceQueues','MailQueues','FaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefix','VoicePrefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_whatsapp_accounts','SquareProject','SpiedAgents','VoiceContext','Sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','ReportAgentPreview','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','CmContact','Contact','MailServerIn','MailAccountId','Imap','MailServerOut','Disposition','Dispositions','Answers','Interactions','Applications','List','ListId','Template','TemplateId','team_has_mail_queues','Account','ContactId','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachment','Attachments','Interaction','restrict','TagId','MailQueueReport','DashboardItem','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','CannedAnswer','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','openchannel_interaction_has_tags','OpenchannelMessage','OpenchannelInteractionId','OpenchannelQueueId','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','ChatGroup','chat_group_has_users','Website','Contacts','CompanyId','Company','cm_contact_has_tags','Campaign','CampaignId','OwnerId','Condition','All','OneAll','OneAny','Actions','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','SalesforceConfiguration','SubjectId','DescriptionId','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','Configurations','Subjects','Descriptions','FieldId','DeskAccount','int_desk_configuration_has_tags','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','ServicenowAccount','Dynamics365Field','FromId','ToId','SessionId','ProjectId','user_has_square_projects','user_has_teams','team_has_openchannel_queues','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToQueue','ToSmsAccountId','user_has_voice_prefixes','userProfileId','UserProfileSections','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','username','password','database','options','User','../api/user/user.model','VoiceChanSpy','VoiceExtension','import','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model'];(function(_0x5c2dbe,_0x358a82){var _0x1d2f9e=function(_0x3ee3cf){while(--_0x3ee3cf){_0x5c2dbe['push'](_0x5c2dbe['shift']());}};_0x1d2f9e(++_0x358a82);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x54ecd7,_0x1e22e4){_0x54ecd7=_0x54ecd7-0x0;var _0x459041=_0x6b4e[_0x54ecd7];return _0x459041;};'use strict';var path=require('path');var config=require(_0xe6b4('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require('jstz');var timezone=jstz['determine']();config[_0xe6b4('0x1')]=_[_0xe6b4('0x2')](config[_0xe6b4('0x1')],{'database':_0xe6b4('0x3'),'username':_0xe6b4('0x4'),'password':_0xe6b4('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe6b4('0x6'),'dialectOptions':{'charset':_0xe6b4('0x7')},'logging':![],'timezone':timezone[_0xe6b4('0x8')](),'define':{'charset':_0xe6b4('0x9'),'collate':_0xe6b4('0xa')}}});config[_0xe6b4('0xb')]=_[_0xe6b4('0x2')](config[_0xe6b4('0xb')],{'database':_0xe6b4('0x3'),'username':_0xe6b4('0x4'),'password':'xC@LL1234','options':{'host':_0xe6b4('0xc'),'port':0xcea,'dialect':_0xe6b4('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xe6b4('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe6b4('0x1')]['database'],config[_0xe6b4('0x1')][_0xe6b4('0xd')],config[_0xe6b4('0x1')][_0xe6b4('0xe')],config[_0xe6b4('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe6b4('0xb')][_0xe6b4('0xf')],config[_0xe6b4('0xb')][_0xe6b4('0xd')],config['sequelizeHistory'][_0xe6b4('0xe')],config[_0xe6b4('0xb')][_0xe6b4('0x10')])};db[_0xe6b4('0x11')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x12'));db[_0xe6b4('0x13')]=db[_0xe6b4('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0xe6b4('0x1')]['import']('../api/voiceContext/voiceContext.model');db[_0xe6b4('0x14')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x16'));db[_0xe6b4('0x17')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x18'));db[_0xe6b4('0x19')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x1a'));db['VoiceRecording']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x1b'));db[_0xe6b4('0x1c')]=db[_0xe6b4('0x1')]['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x1d'));db[_0xe6b4('0x1e')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe6b4('0x1f')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/voiceCallReport/voiceCallReport.model');db[_0xe6b4('0x20')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x21'));db['VoiceAgentReport']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x22'));db['VoiceQueueReport']=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x23'));db[_0xe6b4('0x24')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x25'));db[_0xe6b4('0x26')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xe6b4('0x27')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xe6b4('0x28')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x29'));db[_0xe6b4('0x2a')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0xe6b4('0x2b')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0xe6b4('0x2c')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x2d'));db[_0xe6b4('0x2e')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/userSmsQueue/userSmsQueue.model');db[_0xe6b4('0x2f')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xe6b4('0x30')]=db['sequelize'][_0xe6b4('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x31'));db['MailServerOut']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x32'));db[_0xe6b4('0x33')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x34'));db[_0xe6b4('0x35')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x36'));db['MailSubstatus']=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x37'));db[_0xe6b4('0x38')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x39'));db[_0xe6b4('0x3a')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x3b'));db[_0xe6b4('0x3c')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x3d'));db['MailQueueReport']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x3e'));db[_0xe6b4('0x3f')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x40'));db['DashboardItem']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x41'));db[_0xe6b4('0x42')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x43'));db[_0xe6b4('0x44')]=db['sequelize'][_0xe6b4('0x15')]('../api/faxApplication/faxApplication.model');db[_0xe6b4('0x45')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x46'));db[_0xe6b4('0x47')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x48'));db[_0xe6b4('0x49')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x4a'));db[_0xe6b4('0x4b')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x4c'));db[_0xe6b4('0x4d')]=db['sequelize']['import'](_0xe6b4('0x4e'));db[_0xe6b4('0x4f')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x50'));db[_0xe6b4('0x51')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x52'));db[_0xe6b4('0x53')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x54'));db[_0xe6b4('0x55')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x56'));db[_0xe6b4('0x57')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x58'));db[_0xe6b4('0x59')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x5a'));db[_0xe6b4('0x5b')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x5c'));db[_0xe6b4('0x5d')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x5e'));db[_0xe6b4('0x5f')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x60'));db[_0xe6b4('0x61')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x62'));db['ChatInteraction']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x63'));db[_0xe6b4('0x64')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x65'));db[_0xe6b4('0x66')]=db[_0xe6b4('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xe6b4('0x67')]=db['sequelize'][_0xe6b4('0x15')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x68'));db[_0xe6b4('0x69')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x6a'));db[_0xe6b4('0x6b')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xe6b4('0x1')]['import']('../api/cmContact/cmContact.model');db[_0xe6b4('0x6c')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x6d'));db[_0xe6b4('0x6e')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x6f'));db[_0xe6b4('0x70')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x71'));db[_0xe6b4('0x72')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x73'));db['ReportAgentPreview']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x74'));db['CmCustomField']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x75'));db[_0xe6b4('0x76')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x77'));db[_0xe6b4('0x78')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/automation/automation.model');db['CannedAnswer']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x79'));db['Disposition']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x7a'));db['Condition']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x7b'));db[_0xe6b4('0x7c')]=db['sequelize'][_0xe6b4('0x15')]('../api/interval/interval.model');db[_0xe6b4('0x7d')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x7e'));db['Cdr']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x7f'));db[_0xe6b4('0x80')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x81'));db['Schedule']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x82'));db[_0xe6b4('0x83')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/sound/sound.model');db['Tag']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x84'));db['Template']=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/template/template.model');db['Trigger']=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/trigger/trigger.model');db['Variable']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0x85'));db['Integration']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x86'));db[_0xe6b4('0x87')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x88'));db[_0xe6b4('0x89')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xe6b4('0x8a')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x8b'));db[_0xe6b4('0x8c')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x8d'));db[_0xe6b4('0x8e')]=db['sequelize'][_0xe6b4('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0xe6b4('0x8f')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x90'));db[_0xe6b4('0x91')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xe6b4('0x92')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x93'));db['SalesforceConfiguration']=db[_0xe6b4('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xe6b4('0x94')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0xe6b4('0x95')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x96'));db['SugarcrmConfiguration']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x97'));db[_0xe6b4('0x98')]=db['sequelize'][_0xe6b4('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x99'));db[_0xe6b4('0x9a')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x9b'));db[_0xe6b4('0x9c')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x9d'));db[_0xe6b4('0x9e')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0x9f'));db[_0xe6b4('0xa0')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xa1'));db[_0xe6b4('0xa2')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xa3'));db[_0xe6b4('0xa4')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xa5'));db['ZendeskConfiguration']=db[_0xe6b4('0x1')][_0xe6b4('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xa6'));db[_0xe6b4('0xa7')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xa8'));db['FreshdeskConfiguration']=db['sequelize']['import'](_0xe6b4('0xa9'));db['FreshdeskField']=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xaa'));db[_0xe6b4('0xab')]=db['sequelize'][_0xe6b4('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xac'));db[_0xe6b4('0xad')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xae'));db['ServicenowAccount']=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xaf'));db['ServicenowConfiguration']=db[_0xe6b4('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xe6b4('0xb0')]=db['sequelize']['import'](_0xe6b4('0xb1'));db[_0xe6b4('0xb2')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xb3'));db[_0xe6b4('0xb4')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xb5'));db['Dynamics365Field']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xb6'));db[_0xe6b4('0xb7')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xb8'));db[_0xe6b4('0xb9')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xba'));db[_0xe6b4('0xbb')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xbc'));db[_0xe6b4('0xbd')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0x86'));db[_0xe6b4('0xbe')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xbf'));db[_0xe6b4('0xc0')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xc1'));db['ChatInternalMessage']=db['sequelize']['import'](_0xe6b4('0xc2'));db[_0xe6b4('0xc3')]=db['sequelize']['import'](_0xe6b4('0xc4'));db[_0xe6b4('0xc5')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xc6'));db[_0xe6b4('0xc7')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xc8'));db[_0xe6b4('0xc9')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xca'));db[_0xe6b4('0xcb')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xcc'));db[_0xe6b4('0xcd')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xce'));db[_0xe6b4('0xcf')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xd0'));db[_0xe6b4('0xd1')]=db['sequelize'][_0xe6b4('0x15')]('../api/setting/setting.model');db[_0xe6b4('0xd2')]=db['sequelize']['import'](_0xe6b4('0xd3'));db['SquareProject']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xd4'));db['SquareRecording']=db['sequelize']['import']('../api/squareRecording/squareRecording.model');db['SquareMessage']=db['sequelize'][_0xe6b4('0x15')]('../api/squareMessage/squareMessage.model');db[_0xe6b4('0xd5')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xd6'));db[_0xe6b4('0xd7')]=db['sequelize'][_0xe6b4('0x15')]('../api/license/license.model');db['Campaign']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xd8'));db['Migration']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xd9'));db['Attachment']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xda'));db[_0xe6b4('0xdb')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xdc'));db['MailTransferReport']=db[_0xe6b4('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xdd'));db['FaxTransferReport']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xde'));db[_0xe6b4('0xdf')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xe0'));db[_0xe6b4('0xe1')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xe2'));db['CmList']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xe3'));db['VoicePrefix']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xe4'));db[_0xe6b4('0xe5')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xe6'));db[_0xe6b4('0xe7')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xe8'));db[_0xe6b4('0xe9')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xea'));db[_0xe6b4('0xeb')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xec'));db['WhatsappAccount']=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xed'));db['WhatsappApplication']=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xee'));db[_0xe6b4('0xef')]=db['sequelize'][_0xe6b4('0x15')](_0xe6b4('0xf0'));db[_0xe6b4('0xf1')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xf2'));db[_0xe6b4('0xf3')]=db['sequelize'][_0xe6b4('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xe6b4('0xf4')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xf5'));db[_0xe6b4('0xf6')]=db[_0xe6b4('0x1')][_0xe6b4('0x15')](_0xe6b4('0xf7'));db[_0xe6b4('0xf8')]=db[_0xe6b4('0x1')]['import'](_0xe6b4('0xf9'));db[_0xe6b4('0x11')][_0xe6b4('0xfa')](db[_0xe6b4('0xfb')],{'as':_0xe6b4('0xfb'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db['VoiceRecording'],{'as':_0xe6b4('0xff'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db['UserVoiceQueueRt'],{'as':_0xe6b4('0x100'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db[_0xe6b4('0x14')],{'as':_0xe6b4('0x101'),'onDelete':_0xe6b4('0xfc'),'hooks':!![]});db[_0xe6b4('0x11')]['hasMany'](db[_0xe6b4('0x70')],{'as':'HopperFinals','foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')]['hasMany'](db[_0xe6b4('0x59')],{'as':_0xe6b4('0x102'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db[_0xe6b4('0x103')],{'as':_0xe6b4('0x104'),'foreignKey':'UserId'});db[_0xe6b4('0x11')]['hasMany'](db['SmsInteraction'],{'as':_0xe6b4('0x105'),'foreignKey':_0xe6b4('0xfd')});db['User'][_0xe6b4('0xfe')](db[_0xe6b4('0x45')],{'as':_0xe6b4('0x106'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db['MailInteraction'],{'as':_0xe6b4('0x107'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db[_0xe6b4('0xef')],{'as':_0xe6b4('0x108'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x11')][_0xe6b4('0xfe')](db['Notification'],{'as':_0xe6b4('0x109'),'foreignKey':'SenderId'});db[_0xe6b4('0x11')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db['ChatGroup'],{'as':_0xe6b4('0x10b'),'through':'chat_group_has_users'});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db['CmContact'],{'as':'Contacts','through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0xe6b4('0x10c')],{'as':'Lists','through':_0xe6b4('0x10d')});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db['Team'],{'through':'user_has_teams'});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0x38')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0x103')],{'as':_0xe6b4('0x104'),'through':_0xe6b4('0x10e')});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0x45')],{'as':_0xe6b4('0x106'),'through':'user_has_fax_interactions'});db['User'][_0xe6b4('0x10a')](db[_0xe6b4('0x4f')],{'as':_0xe6b4('0x105'),'through':_0xe6b4('0x10f')});db['User'][_0xe6b4('0x10a')](db[_0xe6b4('0x59')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0xef')],{'as':_0xe6b4('0x108'),'through':'user_has_whatsapp_interactions'});db[_0xe6b4('0x11')]['belongsToMany'](db[_0xe6b4('0x19')],{'as':_0xe6b4('0x110'),'through':'UserVoiceQueue','required':![]});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db['MailQueue'],{'as':_0xe6b4('0x111'),'through':_0xe6b4('0x2b'),'required':![]});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0x67')],{'as':'ChatQueues','through':_0xe6b4('0x2a'),'required':![],'hooks':!![]});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0x112')],{'as':'FaxQueues','through':_0xe6b4('0x2c'),'required':![]});db['User']['belongsToMany'](db[_0xe6b4('0x53')],{'as':_0xe6b4('0x113'),'through':_0xe6b4('0x2e'),'required':![]});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0x5b')],{'as':_0xe6b4('0x114'),'through':_0xe6b4('0x2f'),'required':![]});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0xf6')],{'as':_0xe6b4('0x115'),'through':_0xe6b4('0x30'),'required':![]});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db['CmList'],{'through':'cm_user_has_lists'});db[_0xe6b4('0x11')]['belongsToMany'](db[_0xe6b4('0x116')],{'as':_0xe6b4('0x117'),'through':'user_has_voice_prefixes','required':![]});db['User'][_0xe6b4('0x10a')](db[_0xe6b4('0x5d')],{'as':_0xe6b4('0x118'),'through':_0xe6b4('0x119')});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db['FaxAccount'],{'as':_0xe6b4('0x11a'),'through':_0xe6b4('0x11b')});db['User'][_0xe6b4('0x10a')](db[_0xe6b4('0x33')],{'as':_0xe6b4('0x11c'),'through':_0xe6b4('0x11d')});db['User'][_0xe6b4('0x10a')](db[_0xe6b4('0x55')],{'as':_0xe6b4('0x11e'),'through':_0xe6b4('0x11f')});db['User'][_0xe6b4('0x10a')](db['SmsAccount'],{'as':_0xe6b4('0x120'),'through':'user_has_sms_accounts'});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xe6b4('0x121')});db[_0xe6b4('0x11')][_0xe6b4('0x10a')](db[_0xe6b4('0x122')],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0xe6b4('0x13')][_0xe6b4('0xfe')](db[_0xe6b4('0x14')],{'as':_0xe6b4('0x123'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0xe6b4('0x124')]['hasMany'](db[_0xe6b4('0x14')],{'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x14')][_0xe6b4('0xfe')](db[_0xe6b4('0x14')],{'as':'Applications','onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x17')][_0xe6b4('0x10a')](db[_0xe6b4('0x83')],{'as':_0xe6b4('0x125'),'through':'moh_has_sounds'});db[_0xe6b4('0x19')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xe6b4('0x126'),'foreignKey':_0xe6b4('0x127')});db[_0xe6b4('0x19')][_0xe6b4('0xfe')](db[_0xe6b4('0x6c')],{'as':_0xe6b4('0x128'),'foreignKey':_0xe6b4('0x127')});db[_0xe6b4('0x19')][_0xe6b4('0xfe')](db[_0xe6b4('0x70')],{'as':_0xe6b4('0x129'),'foreignKey':_0xe6b4('0x127')});db[_0xe6b4('0x19')][_0xe6b4('0xfe')](db[_0xe6b4('0x72')],{'as':_0xe6b4('0x12a'),'foreignKey':'VoiceQueueId'});db[_0xe6b4('0x19')][_0xe6b4('0xfe')](db['ReportAgentPreview'],{'as':_0xe6b4('0x12b'),'foreignKey':_0xe6b4('0x127')});db['VoiceQueue'][_0xe6b4('0xfe')](db['CmHopperBlack'],{'as':_0xe6b4('0x12c'),'foreignKey':_0xe6b4('0x127')});db[_0xe6b4('0x19')][_0xe6b4('0xfe')](db['JscriptySessionReport'],{'as':_0xe6b4('0x12d'),'foreignKey':_0xe6b4('0x127')});db[_0xe6b4('0x19')][_0xe6b4('0x12e')](db['Trunk'],{'as':_0xe6b4('0x26'),'foreignKey':_0xe6b4('0x12f')});db[_0xe6b4('0x19')][_0xe6b4('0x12e')](db[_0xe6b4('0x26')],{'as':'TrunkBackup','foreignKey':_0xe6b4('0x130')});db[_0xe6b4('0x19')][_0xe6b4('0x12e')](db[_0xe6b4('0x7c')],{'as':_0xe6b4('0x7c'),'foreignKey':_0xe6b4('0x131')});db[_0xe6b4('0x19')][_0xe6b4('0x12e')](db[_0xe6b4('0x7d')],{'as':_0xe6b4('0x132'),'foreignKey':_0xe6b4('0x133')});db[_0xe6b4('0x19')][_0xe6b4('0x10a')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x134'),'through':_0xe6b4('0x135')});db[_0xe6b4('0x19')][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x136'),'through':_0xe6b4('0x28')});db[_0xe6b4('0x19')]['belongsToMany'](db['Team'],{'as':_0xe6b4('0x137'),'through':_0xe6b4('0x138')});db[_0xe6b4('0x19')][_0xe6b4('0x10a')](db['CmList'],{'as':_0xe6b4('0x139'),'through':_0xe6b4('0x13a')});db[_0xe6b4('0x13b')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x11'),'foreignKey':'UserId'});db[_0xe6b4('0x1c')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':'User','foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0xfb')][_0xe6b4('0xfe')](db[_0xe6b4('0x1e')],{'as':_0xe6b4('0x13c'),'onDelete':'cascade','foreignKey':_0xe6b4('0x13d'),'sourceKey':_0xe6b4('0x13e')});db[_0xe6b4('0x1e')][_0xe6b4('0x12e')](db[_0xe6b4('0xfb')],{'foreignKey':_0xe6b4('0x13d'),'targetKey':_0xe6b4('0x13e')});db[_0xe6b4('0x1f')]['hasMany'](db['VoiceQueueReport'],{'as':_0xe6b4('0x13f'),'foreignKey':'uniqueid','constraints':![]});db[_0xe6b4('0x1f')][_0xe6b4('0xfe')](db[_0xe6b4('0x140')],{'as':_0xe6b4('0x141'),'foreignKey':_0xe6b4('0x142'),'constraints':![]});db['VoiceCallReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':'User','foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x1f')]['belongsTo'](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':'ContactId'});db[_0xe6b4('0x145')][_0xe6b4('0x12e')](db[_0xe6b4('0x33')],{'as':_0xe6b4('0x33'),'foreignKey':_0xe6b4('0x146')});db['MailServerOut'][_0xe6b4('0x12e')](db[_0xe6b4('0x33')],{'as':_0xe6b4('0x33'),'foreignKey':_0xe6b4('0x146')});db['MailAccount'][_0xe6b4('0xfa')](db[_0xe6b4('0x145')],{'as':_0xe6b4('0x147'),'onDelete':_0xe6b4('0xfc')});db['MailAccount']['hasOne'](db[_0xe6b4('0x148')],{'as':'Smtp','onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x33')][_0xe6b4('0xfe')](db[_0xe6b4('0x149')],{'as':_0xe6b4('0x14a'),'foreignKey':_0xe6b4('0x146')});db[_0xe6b4('0x33')]['hasMany'](db['CannedAnswer'],{'as':_0xe6b4('0x14b'),'foreignKey':_0xe6b4('0x146')});db['MailAccount'][_0xe6b4('0xfe')](db[_0xe6b4('0x3a')],{'as':_0xe6b4('0x13c'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xe6b4('0xfe')](db[_0xe6b4('0x38')],{'as':_0xe6b4('0x14c')});db[_0xe6b4('0x33')][_0xe6b4('0xfe')](db['MailApplication'],{'as':_0xe6b4('0x14d')});db['MailAccount'][_0xe6b4('0x12e')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0x33')][_0xe6b4('0x12e')](db[_0xe6b4('0x150')],{'as':'Template','foreignKey':_0xe6b4('0x151')});db[_0xe6b4('0x33')][_0xe6b4('0x12e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xe6b4('0x133')});db['MailAccount'][_0xe6b4('0x10a')](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':'Agents','through':'UserMailQueue'});db['MailQueue'][_0xe6b4('0x10a')](db[_0xe6b4('0xd5')],{'through':_0xe6b4('0x152'),'as':_0xe6b4('0x137')});db[_0xe6b4('0x38')]['hasMany'](db[_0xe6b4('0x3a')],{'as':_0xe6b4('0x13c'),'onDelete':_0xe6b4('0xfc'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0xe6b4('0x12e')](db[_0xe6b4('0x33')],{'as':_0xe6b4('0x153'),'foreignKey':'MailAccountId'});db[_0xe6b4('0x38')][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'as':'Contact','foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x38')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x155'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x38')]['belongsToMany'](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x157'),'as':_0xe6b4('0x158')});db[_0xe6b4('0x38')]['belongsToMany'](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x157'),'as':_0xe6b4('0x159')});db[_0xe6b4('0x38')][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x15a'),'through':_0xe6b4('0x15b'),'foreignKey':_0xe6b4('0x15c')});db[_0xe6b4('0x3a')][_0xe6b4('0xfe')](db[_0xe6b4('0x15d')],{'as':_0xe6b4('0x15e'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x3a')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x11')});db[_0xe6b4('0x3a')][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x144')});db[_0xe6b4('0x3a')][_0xe6b4('0x12e')](db[_0xe6b4('0x38')],{'as':_0xe6b4('0x15f'),'foreignKey':_0xe6b4('0x15c')});db['MailMessage'][_0xe6b4('0x12e')](db[_0xe6b4('0x33')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x146')});db[_0xe6b4('0x3c')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x3c')][_0xe6b4('0x12e')](db['MailQueue'],{'onDelete':'restrict'});db[_0xe6b4('0x3c')][_0xe6b4('0x12e')](db[_0xe6b4('0x33')],{'onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x3c')][_0xe6b4('0x12e')](db['Interval'],{'onDelete':_0xe6b4('0x160'),'foreignKey':'IntervalId'});db[_0xe6b4('0x3c')][_0xe6b4('0x12e')](db[_0xe6b4('0x156')],{'onDelete':'restrict','foreignKey':_0xe6b4('0x161')});db[_0xe6b4('0x162')][_0xe6b4('0x12e')](db[_0xe6b4('0x33')],{});db[_0xe6b4('0x162')]['belongsTo'](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0x162')][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x162')][_0xe6b4('0x12e')](db['MailInteraction'],{});db['MailQueueReport'][_0xe6b4('0x12e')](db['MailMessage'],{});db[_0xe6b4('0x162')]['belongsTo'](db[_0xe6b4('0x11')],{});db['MailQueueReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x35')],{});db[_0xe6b4('0x3f')][_0xe6b4('0xfe')](db[_0xe6b4('0x163')],{'as':_0xe6b4('0x164'),'onDelete':_0xe6b4('0xfc')});db['FaxAccount'][_0xe6b4('0xfe')](db[_0xe6b4('0x149')],{'as':'Dispositions','foreignKey':_0xe6b4('0x165')});db[_0xe6b4('0x42')][_0xe6b4('0xfe')](db['CannedAnswer'],{'as':_0xe6b4('0x14b'),'foreignKey':'FaxAccountId'});db[_0xe6b4('0x42')][_0xe6b4('0xfe')](db[_0xe6b4('0x45')],{'as':_0xe6b4('0x14c')});db[_0xe6b4('0x42')][_0xe6b4('0xfe')](db['FaxApplication'],{'as':'Applications'});db[_0xe6b4('0x42')][_0xe6b4('0xfe')](db['VoiceExtension'],{'as':_0xe6b4('0x166'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x42')][_0xe6b4('0xfe')](db['FaxMessage'],{'as':_0xe6b4('0x13c')});db[_0xe6b4('0x42')][_0xe6b4('0x12e')](db[_0xe6b4('0x26')],{'as':'Trunk'});db[_0xe6b4('0x42')]['belongsTo'](db[_0xe6b4('0x10c')],{'as':'List','foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0x42')][_0xe6b4('0x12e')](db['Pause'],{'as':_0xe6b4('0x132'),'foreignKey':_0xe6b4('0x133')});db[_0xe6b4('0x42')]['belongsToMany'](db[_0xe6b4('0x11')],{'as':'Agents','through':_0xe6b4('0x11b')});db['FaxApplication']['belongsTo'](db[_0xe6b4('0x11')],{'onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x44')]['belongsTo'](db['FaxQueue'],{'onDelete':_0xe6b4('0x160')});db['FaxApplication'][_0xe6b4('0x12e')](db[_0xe6b4('0x42')],{'onDelete':_0xe6b4('0x160')});db['FaxApplication'][_0xe6b4('0x12e')](db[_0xe6b4('0x156')],{'onDelete':_0xe6b4('0x160'),'foreignKey':_0xe6b4('0x161')});db[_0xe6b4('0x45')]['hasMany'](db[_0xe6b4('0x47')],{'as':_0xe6b4('0x13c'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x167')});db[_0xe6b4('0x45')][_0xe6b4('0x12e')](db[_0xe6b4('0x42')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x165')});db['FaxInteraction'][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':'ContactId'});db['FaxInteraction'][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x155'),'foreignKey':_0xe6b4('0xfd')});db[_0xe6b4('0x45')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x168'),'as':_0xe6b4('0x158')});db[_0xe6b4('0x45')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x168'),'as':'ThroughTags'});db[_0xe6b4('0x45')][_0xe6b4('0x10a')](db['User'],{'as':_0xe6b4('0x15a'),'through':_0xe6b4('0x169'),'foreignKey':_0xe6b4('0x167')});db[_0xe6b4('0x47')]['belongsTo'](db[_0xe6b4('0x11')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x11')});db[_0xe6b4('0x47')]['belongsTo'](db[_0xe6b4('0x45')],{'as':_0xe6b4('0x15f'),'foreignKey':_0xe6b4('0x167')});db['FaxMessage'][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'onDelete':_0xe6b4('0xfc'),'as':'Contact'});db[_0xe6b4('0x47')][_0xe6b4('0x12e')](db[_0xe6b4('0x15d')],{'as':_0xe6b4('0x15d'),'foreignKey':_0xe6b4('0x16a')});db['FaxMessage'][_0xe6b4('0x12e')](db['FaxAccount'],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x165')});db['FaxQueue'][_0xe6b4('0x10a')](db['User'],{'as':_0xe6b4('0x136'),'through':'UserFaxQueue'});db['FaxQueue']['belongsToMany'](db['Team'],{'through':_0xe6b4('0x16b'),'as':'Teams'});db[_0xe6b4('0x49')]['belongsTo'](db[_0xe6b4('0x42')],{});db[_0xe6b4('0x49')][_0xe6b4('0x12e')](db[_0xe6b4('0x10c')],{'as':'List','foreignKey':_0xe6b4('0x14f')});db['FaxQueueReport']['belongsTo'](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':'ContactId'});db[_0xe6b4('0x49')][_0xe6b4('0x12e')](db['FaxInteraction'],{});db['FaxQueueReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x47')],{});db[_0xe6b4('0x49')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{});db[_0xe6b4('0x49')][_0xe6b4('0x12e')](db['FaxQueue'],{});db[_0xe6b4('0x4b')][_0xe6b4('0xfe')](db[_0xe6b4('0x149')],{'as':_0xe6b4('0x14a'),'foreignKey':_0xe6b4('0x16c')});db['SmsAccount']['hasMany'](db[_0xe6b4('0x16d')],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0xe6b4('0xfe')](db[_0xe6b4('0x51')],{'as':_0xe6b4('0x13c'),'foreignKey':_0xe6b4('0x16c')});db[_0xe6b4('0x4b')][_0xe6b4('0xfe')](db[_0xe6b4('0x4f')],{'as':'Interactions'});db[_0xe6b4('0x4b')][_0xe6b4('0xfe')](db['SmsApplication'],{'as':_0xe6b4('0x14d')});db[_0xe6b4('0x4b')]['belongsTo'](db[_0xe6b4('0x10c')],{'as':'List','foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0x4b')][_0xe6b4('0x12e')](db[_0xe6b4('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe6b4('0x4b')][_0xe6b4('0x10a')](db['User'],{'as':_0xe6b4('0x136'),'through':_0xe6b4('0x16e')});db['SmsApplication']['belongsTo'](db[_0xe6b4('0x11')],{'onDelete':_0xe6b4('0x160')});db['SmsApplication'][_0xe6b4('0x12e')](db[_0xe6b4('0x53')],{'onDelete':'restrict'});db[_0xe6b4('0x4d')][_0xe6b4('0x12e')](db['SmsAccount'],{'onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x4d')][_0xe6b4('0x12e')](db[_0xe6b4('0x7c')],{'onDelete':_0xe6b4('0x160'),'foreignKey':_0xe6b4('0x131')});db[_0xe6b4('0x4d')][_0xe6b4('0x12e')](db[_0xe6b4('0x156')],{'onDelete':'restrict','foreignKey':_0xe6b4('0x161')});db[_0xe6b4('0x4f')][_0xe6b4('0xfe')](db['SmsMessage'],{'as':_0xe6b4('0x13c'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0xe6b4('0x12e')](db[_0xe6b4('0x4b')],{'as':'Account','foreignKey':_0xe6b4('0x16c')});db[_0xe6b4('0x4f')][_0xe6b4('0x12e')](db['CmContact'],{'as':'Contact','foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x4f')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x155'),'foreignKey':_0xe6b4('0xfd')});db['SmsInteraction'][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':'sms_interaction_has_tags','as':_0xe6b4('0x158')});db[_0xe6b4('0x4f')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x16f'),'as':_0xe6b4('0x159')});db[_0xe6b4('0x4f')][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x15a'),'through':_0xe6b4('0x10f'),'foreignKey':_0xe6b4('0x170')});db['SmsMessage'][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x11')});db['SmsMessage'][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'onDelete':'cascade','as':_0xe6b4('0x144')});db['SmsMessage'][_0xe6b4('0x12e')](db[_0xe6b4('0x4f')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x15f'),'foreignKey':'SmsInteractionId'});db[_0xe6b4('0x51')]['belongsTo'](db[_0xe6b4('0x4b')],{'as':'Account','foreignKey':_0xe6b4('0x16c')});db['SmsQueue']['belongsToMany'](db['User'],{'as':'Agents','through':_0xe6b4('0x2e'),'foreignKey':_0xe6b4('0x171')});db[_0xe6b4('0x53')][_0xe6b4('0x10a')](db[_0xe6b4('0xd5')],{'through':'team_has_sms_queues','as':_0xe6b4('0x137')});db[_0xe6b4('0x55')][_0xe6b4('0xfe')](db['Disposition'],{'as':_0xe6b4('0x14a'),'foreignKey':_0xe6b4('0x172')});db[_0xe6b4('0x55')][_0xe6b4('0xfe')](db['CannedAnswer'],{'as':_0xe6b4('0x14b'),'foreignKey':_0xe6b4('0x172')});db[_0xe6b4('0x55')][_0xe6b4('0xfe')](db[_0xe6b4('0x59')],{'as':'Interactions','foreignKey':_0xe6b4('0x172')});db[_0xe6b4('0x55')][_0xe6b4('0xfe')](db['OpenchannelMessage'],{'as':_0xe6b4('0x13c'),'foreignKey':_0xe6b4('0x172')});db[_0xe6b4('0x55')][_0xe6b4('0xfe')](db['OpenchannelApplication'],{'as':_0xe6b4('0x14d'),'foreignKey':'OpenchannelAccountId'});db[_0xe6b4('0x55')][_0xe6b4('0x12e')](db['CmList'],{'as':_0xe6b4('0x14e'),'foreignKey':'ListId'});db[_0xe6b4('0x55')][_0xe6b4('0x12e')](db[_0xe6b4('0x7d')],{'as':_0xe6b4('0x132'),'foreignKey':_0xe6b4('0x133')});db[_0xe6b4('0x55')][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x136'),'through':_0xe6b4('0x11f')});db[_0xe6b4('0x57')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x57')][_0xe6b4('0x12e')](db[_0xe6b4('0x5b')],{'onDelete':_0xe6b4('0x160'),'foreignKey':'OpenchannelQueueId'});db[_0xe6b4('0x57')]['belongsTo'](db[_0xe6b4('0x55')],{'onDelete':_0xe6b4('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0xe6b4('0x57')][_0xe6b4('0x12e')](db['Interval'],{'onDelete':_0xe6b4('0x160'),'foreignKey':'IntervalId'});db[_0xe6b4('0x57')][_0xe6b4('0x12e')](db[_0xe6b4('0x156')],{'onDelete':_0xe6b4('0x160'),'foreignKey':_0xe6b4('0x161')});db[_0xe6b4('0x59')][_0xe6b4('0xfe')](db['OpenchannelMessage'],{'as':_0xe6b4('0x13c'),'onDelete':_0xe6b4('0xfc'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0xe6b4('0x12e')](db[_0xe6b4('0x55')],{'as':'Account','foreignKey':_0xe6b4('0x172')});db[_0xe6b4('0x59')][_0xe6b4('0x12e')](db['CmContact'],{'as':_0xe6b4('0x144'),'foreignKey':'ContactId'});db[_0xe6b4('0x59')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x155'),'foreignKey':'UserId'});db[_0xe6b4('0x59')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x173'),'as':_0xe6b4('0x158')});db[_0xe6b4('0x59')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x173'),'as':'ThroughTags'});db[_0xe6b4('0x59')]['belongsToMany'](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x15a'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db['User'],{'onDelete':_0xe6b4('0xfc'),'as':'User'});db[_0xe6b4('0x174')]['belongsTo'](db[_0xe6b4('0x143')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x144')});db[_0xe6b4('0x174')][_0xe6b4('0x12e')](db[_0xe6b4('0x59')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x15f'),'foreignKey':_0xe6b4('0x175')});db[_0xe6b4('0x174')][_0xe6b4('0x12e')](db['Attachment'],{'as':_0xe6b4('0x15d'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0xe6b4('0x12e')](db['OpenchannelAccount'],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x172')});db['OpenchannelQueue'][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x136'),'through':_0xe6b4('0x2f'),'foreignKey':_0xe6b4('0x176')});db['OpenchannelQueue'][_0xe6b4('0x10a')](db[_0xe6b4('0xd5')],{'through':'team_has_openchannel_queues','as':_0xe6b4('0x137')});db[_0xe6b4('0x5d')]['hasMany'](db[_0xe6b4('0x149')],{'as':_0xe6b4('0x14a'),'foreignKey':_0xe6b4('0x177')});db[_0xe6b4('0x5d')][_0xe6b4('0xfe')](db[_0xe6b4('0x16d')],{'as':_0xe6b4('0x14b'),'foreignKey':_0xe6b4('0x177')});db[_0xe6b4('0x5d')]['hasMany'](db['ChatProactiveAction'],{'as':_0xe6b4('0x178')});db[_0xe6b4('0x5d')][_0xe6b4('0xfe')](db['ChatInteraction'],{'as':_0xe6b4('0x14c')});db[_0xe6b4('0x5d')][_0xe6b4('0xfe')](db[_0xe6b4('0x61')],{'as':_0xe6b4('0x14d')});db[_0xe6b4('0x5d')][_0xe6b4('0xfe')](db[_0xe6b4('0x64')],{'as':'Messages'});db[_0xe6b4('0x5d')][_0xe6b4('0x12e')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0x5d')][_0xe6b4('0x12e')](db[_0xe6b4('0x7c')],{'as':_0xe6b4('0x7c'),'foreignKey':_0xe6b4('0x131')});db[_0xe6b4('0x5d')]['belongsTo'](db[_0xe6b4('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe6b4('0x5d')][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x136'),'through':_0xe6b4('0x119')});db[_0xe6b4('0x5f')][_0xe6b4('0x12e')](db['OpenchannelAccount'],{});db[_0xe6b4('0x5f')][_0xe6b4('0x12e')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0x5f')][_0xe6b4('0x12e')](db['CmContact'],{'as':_0xe6b4('0x144'),'foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x5f')][_0xe6b4('0x12e')](db[_0xe6b4('0x59')],{});db[_0xe6b4('0x5f')][_0xe6b4('0x12e')](db[_0xe6b4('0x174')],{});db[_0xe6b4('0x5f')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{});db[_0xe6b4('0x5f')][_0xe6b4('0x12e')](db[_0xe6b4('0x5b')],{});db[_0xe6b4('0x61')]['belongsTo'](db['User'],{'as':_0xe6b4('0x179'),'foreignKey':'UserId','onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x61')][_0xe6b4('0x12e')](db['ChatQueue'],{'as':_0xe6b4('0x17a'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0xe6b4('0x61')][_0xe6b4('0x12e')](db[_0xe6b4('0x5d')],{'as':'Website','foreignKey':_0xe6b4('0x177'),'onDelete':_0xe6b4('0x160')});db['ChatApplication'][_0xe6b4('0x12e')](db[_0xe6b4('0x156')],{'onDelete':_0xe6b4('0x160'),'foreignKey':_0xe6b4('0x161')});db['ChatInteraction'][_0xe6b4('0xfe')](db[_0xe6b4('0x64')],{'as':_0xe6b4('0x13c'),'onDelete':'cascade','foreignKey':_0xe6b4('0x17b')});db[_0xe6b4('0x103')]['belongsTo'](db[_0xe6b4('0x5d')],{'as':_0xe6b4('0x153'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x103')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':'Owner','foreignKey':_0xe6b4('0xfd')});db['ChatInteraction'][_0xe6b4('0x10a')](db['Tag'],{'through':_0xe6b4('0x17c'),'as':'Tags'});db[_0xe6b4('0x103')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x17c'),'as':_0xe6b4('0x159')});db['ChatInteraction'][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x15a'),'through':_0xe6b4('0x10e'),'foreignKey':_0xe6b4('0x17b')});db['ChatMessage']['belongsTo'](db[_0xe6b4('0x11')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x11')});db['ChatMessage'][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x144'),'foreignKey':_0xe6b4('0x154')});db['ChatMessage'][_0xe6b4('0x12e')](db['ChatInteraction'],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x15f'),'foreignKey':_0xe6b4('0x17b')});db[_0xe6b4('0x64')][_0xe6b4('0x12e')](db['Attachment'],{'as':_0xe6b4('0x15d'),'foreignKey':'AttachmentId'});db[_0xe6b4('0x64')][_0xe6b4('0x12e')](db[_0xe6b4('0x5d')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x177')});db[_0xe6b4('0x66')][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x144'),'foreignKey':_0xe6b4('0x154')});db['ChatOfflineMessage'][_0xe6b4('0x12e')](db[_0xe6b4('0x5d')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x177')});db[_0xe6b4('0x67')][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x136'),'through':'UserChatQueue','hooks':!![]});db[_0xe6b4('0x67')][_0xe6b4('0x10a')](db[_0xe6b4('0xd5')],{'through':'team_has_chat_queues','as':_0xe6b4('0x137')});db['ChatGroup'][_0xe6b4('0xfe')](db[_0xe6b4('0x17d')],{'as':_0xe6b4('0x13c'),'foreignKey':_0xe6b4('0x17e'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x17f')][_0xe6b4('0x10a')](db['User'],{'as':_0xe6b4('0x126'),'through':_0xe6b4('0x180')});db[_0xe6b4('0x69')][_0xe6b4('0x12e')](db['ChatWebsite'],{'as':_0xe6b4('0x181'),'foreignKey':_0xe6b4('0x177')});db[_0xe6b4('0x6b')][_0xe6b4('0xfe')](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x182'),'foreignKey':_0xe6b4('0x183')});db[_0xe6b4('0x143')][_0xe6b4('0xfe')](db[_0xe6b4('0x6c')],{'as':_0xe6b4('0x128'),'foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x143')]['hasMany'](db[_0xe6b4('0x70')],{'as':_0xe6b4('0x129'),'foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x143')]['hasMany'](db[_0xe6b4('0x72')],{'as':_0xe6b4('0x12a'),'foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x143')]['hasMany'](db[_0xe6b4('0x12b')],{'as':'ReportAgentPreview','foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0x143')]['hasMany'](db[_0xe6b4('0xc7')],{'as':_0xe6b4('0x12d'),'foreignKey':'ContactId'});db[_0xe6b4('0x143')][_0xe6b4('0xfe')](db[_0xe6b4('0x59')],{'as':_0xe6b4('0x102'),'foreignKey':'ContactId','onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x143')][_0xe6b4('0xfe')](db['ChatInteraction'],{'as':_0xe6b4('0x104'),'foreignKey':_0xe6b4('0x154'),'onDelete':_0xe6b4('0x160')});db['CmContact'][_0xe6b4('0xfe')](db[_0xe6b4('0x4f')],{'as':'SmsInteractions','foreignKey':_0xe6b4('0x154'),'onDelete':_0xe6b4('0x160')});db['CmContact']['hasMany'](db[_0xe6b4('0x45')],{'as':_0xe6b4('0x106'),'foreignKey':'ContactId','onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x143')][_0xe6b4('0xfe')](db[_0xe6b4('0x38')],{'as':_0xe6b4('0x107'),'foreignKey':'ContactId','onDelete':_0xe6b4('0x160')});db['CmContact'][_0xe6b4('0x12e')](db[_0xe6b4('0x6b')],{'as':_0xe6b4('0x184'),'foreignKey':'CompanyId'});db['CmContact'][_0xe6b4('0x12e')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x143')][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':'Users','through':'cm_user_has_contacts'});db[_0xe6b4('0x143')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'as':_0xe6b4('0x158'),'through':_0xe6b4('0x185')});db[_0xe6b4('0x143')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x185'),'as':_0xe6b4('0x159')});db[_0xe6b4('0x6c')][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':_0xe6b4('0x154'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x6c')]['belongsTo'](db['CmList'],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f'),'onDelete':'cascade'});db[_0xe6b4('0x6c')]['belongsTo'](db['User'],{'as':_0xe6b4('0x179'),'foreignKey':'UserId'});db[_0xe6b4('0x6c')]['belongsTo'](db['VoiceQueue'],{'as':_0xe6b4('0x17a'),'foreignKey':_0xe6b4('0x127'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x6c')]['belongsTo'](db[_0xe6b4('0x186')],{'as':_0xe6b4('0x186'),'foreignKey':_0xe6b4('0x187'),'onDelete':_0xe6b4('0xfc')});db['CmHopper'][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':'Owner','foreignKey':_0xe6b4('0x188')});db['CmHopperBlack'][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'as':'Contact','foreignKey':_0xe6b4('0x154'),'onDelete':_0xe6b4('0xfc')});db['CmHopperBlack'][_0xe6b4('0x12e')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':'ListId','onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x6e')][_0xe6b4('0x12e')](db[_0xe6b4('0x19')],{'as':_0xe6b4('0x17a'),'foreignKey':_0xe6b4('0x127'),'onDelete':'cascade'});db[_0xe6b4('0x6e')][_0xe6b4('0x12e')](db[_0xe6b4('0x186')],{'as':_0xe6b4('0x186'),'foreignKey':_0xe6b4('0x187'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x78')][_0xe6b4('0xfe')](db[_0xe6b4('0x189')],{'as':{'plural':_0xe6b4('0x18a'),'singular':_0xe6b4('0x18b')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0xe6b4('0x78')][_0xe6b4('0xfe')](db[_0xe6b4('0x189')],{'as':{'plural':'Any','singular':_0xe6b4('0x18c')},'foreignKey':'AutomationAnyId','onDelete':_0xe6b4('0xfc'),'hooks':!![]});db[_0xe6b4('0x78')][_0xe6b4('0xfe')](db[_0xe6b4('0x76')],{'as':_0xe6b4('0x18d'),'foreignKey':'AutomationId','onDelete':_0xe6b4('0xfc'),'hooks':!![]});db[_0xe6b4('0x7c')][_0xe6b4('0xfe')](db['Interval'],{'as':_0xe6b4('0x18e'),'foreignKey':'IntervalId','onDelete':_0xe6b4('0xfc'),'hooks':!![],'required':![]});db[_0xe6b4('0x7c')][_0xe6b4('0xfe')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xe6b4('0x131'),'onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x7c')][_0xe6b4('0xfe')](db[_0xe6b4('0x3c')],{'as':_0xe6b4('0x18f'),'foreignKey':_0xe6b4('0x131')});db[_0xe6b4('0x7c')][_0xe6b4('0xfe')](db[_0xe6b4('0x61')],{'as':_0xe6b4('0x190'),'foreignKey':'IntervalId'});db[_0xe6b4('0x7c')][_0xe6b4('0xfe')](db['FaxApplication'],{'as':_0xe6b4('0x191'),'foreignKey':'IntervalId'});db[_0xe6b4('0x7c')]['hasMany'](db[_0xe6b4('0x4d')],{'as':_0xe6b4('0x192'),'foreignKey':'IntervalId'});db['Schedule'][_0xe6b4('0x12e')](db[_0xe6b4('0x33')],{});db[_0xe6b4('0x193')][_0xe6b4('0x12e')](db['AnalyticDefaultReport'],{'foreignKey':_0xe6b4('0x194')});db[_0xe6b4('0x193')][_0xe6b4('0x12e')](db[_0xe6b4('0x89')],{'foreignKey':_0xe6b4('0x195')});db[_0xe6b4('0x83')]['belongsToMany'](db[_0xe6b4('0x17')],{'as':_0xe6b4('0x196'),'through':_0xe6b4('0x197'),'onDelete':'restrict'});db[_0xe6b4('0x156')][_0xe6b4('0x10a')](db[_0xe6b4('0x143')],{'through':'cm_contact_has_tags'});db[_0xe6b4('0x156')]['belongsToMany'](db[_0xe6b4('0x103')],{'through':_0xe6b4('0x17c')});db[_0xe6b4('0x156')][_0xe6b4('0x10a')](db[_0xe6b4('0x38')],{'through':_0xe6b4('0x157')});db[_0xe6b4('0x156')][_0xe6b4('0x10a')](db[_0xe6b4('0x4f')],{'through':_0xe6b4('0x16f')});db[_0xe6b4('0x156')][_0xe6b4('0x10a')](db[_0xe6b4('0x45')],{'through':_0xe6b4('0x168')});db['Tag']['belongsToMany'](db[_0xe6b4('0x59')],{'through':_0xe6b4('0x173')});db[_0xe6b4('0x156')][_0xe6b4('0x10a')](db[_0xe6b4('0xef')],{'through':_0xe6b4('0x198')});db[_0xe6b4('0x199')]['hasMany'](db['Condition'],{'as':{'plural':_0xe6b4('0x19a'),'singular':_0xe6b4('0x19b')},'foreignKey':'TriggerAllId','onDelete':_0xe6b4('0xfc'),'hooks':!![]});db[_0xe6b4('0x199')][_0xe6b4('0xfe')](db[_0xe6b4('0x189')],{'as':{'plural':_0xe6b4('0x19c'),'singular':'AnyCondition'},'foreignKey':_0xe6b4('0x19d'),'onDelete':_0xe6b4('0xfc'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':_0xe6b4('0x18d'),'foreignKey':_0xe6b4('0x19e'),'onDelete':_0xe6b4('0xfc'),'hooks':!![]});db[_0xe6b4('0x89')][_0xe6b4('0xfe')](db['AnalyticFieldReport'],{'as':_0xe6b4('0x19f'),'onDelete':'cascade','foreignKey':_0xe6b4('0x195'),'hooks':!![]});db['AnalyticDefaultReport'][_0xe6b4('0xfe')](db['AnalyticFieldReport'],{'as':_0xe6b4('0x19f'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x194')});db[_0xe6b4('0x8e')][_0xe6b4('0xfe')](db[_0xe6b4('0x8f')],{'as':_0xe6b4('0x19f'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a0')});db[_0xe6b4('0x8f')][_0xe6b4('0x12e')](db['AnalyticMetric'],{'foreignKey':_0xe6b4('0x1a0')});db[_0xe6b4('0x92')][_0xe6b4('0xfe')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x1a2')][_0xe6b4('0xfe')](db[_0xe6b4('0x94')],{'as':'Subjects','onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0x1a2')][_0xe6b4('0xfe')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a4')});db['SalesforceConfiguration'][_0xe6b4('0xfe')](db[_0xe6b4('0x94')],{'as':'Fields','onDelete':_0xe6b4('0xfc'),'foreignKey':'FieldId'});db[_0xe6b4('0x1a2')][_0xe6b4('0x12e')](db[_0xe6b4('0x92')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x94')][_0xe6b4('0xfe')](db[_0xe6b4('0x94')],{'as':_0xe6b4('0x1a5'),'foreignKey':_0xe6b4('0x1a3')});db['SalesforceField'][_0xe6b4('0xfe')](db[_0xe6b4('0x94')],{'as':_0xe6b4('0x1a6'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0x94')]['hasMany'](db[_0xe6b4('0x94')],{'as':_0xe6b4('0x1a7'),'foreignKey':'FieldId'});db[_0xe6b4('0x94')][_0xe6b4('0x12e')](db['Variable'],{'as':_0xe6b4('0x1a8'),'foreignKey':_0xe6b4('0x1a9')});db[_0xe6b4('0x95')][_0xe6b4('0xfe')](db[_0xe6b4('0x1aa')],{'as':_0xe6b4('0x1ab'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x1aa')][_0xe6b4('0xfe')](db[_0xe6b4('0x98')],{'as':_0xe6b4('0x1ac'),'onDelete':'cascade','foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0x1aa')][_0xe6b4('0xfe')](db[_0xe6b4('0x98')],{'as':_0xe6b4('0x1ad'),'onDelete':_0xe6b4('0xfc'),'foreignKey':'DescriptionId'});db[_0xe6b4('0x1aa')][_0xe6b4('0xfe')](db['SugarcrmField'],{'as':_0xe6b4('0x19f'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0x1aa')][_0xe6b4('0x12e')](db['SugarcrmAccount'],{'as':_0xe6b4('0x153'),'foreignKey':'AccountId'});db[_0xe6b4('0x98')]['hasMany'](db[_0xe6b4('0x98')],{'as':_0xe6b4('0x1a5'),'foreignKey':_0xe6b4('0x1a3')});db['SugarcrmField'][_0xe6b4('0xfe')](db[_0xe6b4('0x98')],{'as':_0xe6b4('0x1a6'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0xe6b4('0xfe')](db[_0xe6b4('0x98')],{'as':'Field','foreignKey':'FieldId'});db[_0xe6b4('0x98')][_0xe6b4('0x12e')](db[_0xe6b4('0x1a8')],{'as':'Variable','foreignKey':'VariableId'});db['DeskAccount'][_0xe6b4('0xfe')](db[_0xe6b4('0x9a')],{'as':_0xe6b4('0x1ab'),'onDelete':'cascade','foreignKey':_0xe6b4('0x1a1')});db['DeskConfiguration'][_0xe6b4('0xfe')](db['DeskField'],{'as':_0xe6b4('0x1ac'),'onDelete':'cascade','foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0x9a')]['hasMany'](db[_0xe6b4('0x9c')],{'as':_0xe6b4('0x1ad'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0x9a')][_0xe6b4('0xfe')](db[_0xe6b4('0x9c')],{'as':'Fields','onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1ae')});db['DeskConfiguration'][_0xe6b4('0x12e')](db[_0xe6b4('0x1af')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x9a')][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x1b0')});db[_0xe6b4('0x9c')][_0xe6b4('0xfe')](db[_0xe6b4('0x9c')],{'as':_0xe6b4('0x1a5'),'foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0x9c')][_0xe6b4('0xfe')](db[_0xe6b4('0x9c')],{'as':_0xe6b4('0x1a6'),'foreignKey':'DescriptionId'});db[_0xe6b4('0x9c')][_0xe6b4('0xfe')](db[_0xe6b4('0x9c')],{'as':'Field','foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0x9c')][_0xe6b4('0x12e')](db[_0xe6b4('0x1a8')],{'as':_0xe6b4('0x1a8'),'foreignKey':_0xe6b4('0x1a9')});db['ZohoAccount'][_0xe6b4('0xfe')](db[_0xe6b4('0xa0')],{'as':'Configurations','onDelete':_0xe6b4('0xfc'),'foreignKey':'AccountId'});db[_0xe6b4('0xa0')]['hasMany'](db[_0xe6b4('0xa2')],{'as':_0xe6b4('0x1ac'),'onDelete':_0xe6b4('0xfc'),'foreignKey':'SubjectId'});db[_0xe6b4('0xa0')][_0xe6b4('0xfe')](db[_0xe6b4('0xa2')],{'as':_0xe6b4('0x1ad'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0xa0')][_0xe6b4('0xfe')](db[_0xe6b4('0xa2')],{'as':_0xe6b4('0x19f'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0xa0')][_0xe6b4('0x12e')](db[_0xe6b4('0x9e')],{'as':'Account','foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0xa2')][_0xe6b4('0xfe')](db['ZohoField'],{'as':_0xe6b4('0x1a5'),'foreignKey':'SubjectId'});db[_0xe6b4('0xa2')]['hasMany'](db[_0xe6b4('0xa2')],{'as':_0xe6b4('0x1a6'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0xa2')][_0xe6b4('0xfe')](db['ZohoField'],{'as':_0xe6b4('0x1a7'),'foreignKey':_0xe6b4('0x1ae')});db['ZohoField'][_0xe6b4('0x12e')](db[_0xe6b4('0x1a8')],{'as':_0xe6b4('0x1a8'),'foreignKey':_0xe6b4('0x1a9')});db[_0xe6b4('0xa4')][_0xe6b4('0xfe')](db['ZendeskConfiguration'],{'as':_0xe6b4('0x1ab'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x1b1')][_0xe6b4('0xfe')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0x1b1')][_0xe6b4('0xfe')](db['ZendeskField'],{'as':_0xe6b4('0x1ad'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0x1b1')]['hasMany'](db[_0xe6b4('0x1b2')],{'as':_0xe6b4('0x19f'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0x1b1')]['belongsTo'](db[_0xe6b4('0xa4')],{'as':'Account','foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x1b1')][_0xe6b4('0x10a')](db['Tag'],{'through':_0xe6b4('0x1b3')});db[_0xe6b4('0x1b2')]['hasMany'](db[_0xe6b4('0x1b2')],{'as':_0xe6b4('0x1a5'),'foreignKey':_0xe6b4('0x1a3')});db['ZendeskField'][_0xe6b4('0xfe')](db[_0xe6b4('0x1b2')],{'as':_0xe6b4('0x1a6'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0x1b2')]['hasMany'](db[_0xe6b4('0x1b2')],{'as':_0xe6b4('0x1a7'),'foreignKey':'FieldId'});db[_0xe6b4('0x1b2')][_0xe6b4('0x12e')](db[_0xe6b4('0x1a8')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe6b4('0xa7')]['hasMany'](db[_0xe6b4('0x1b4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x1b4')][_0xe6b4('0xfe')](db['FreshdeskField'],{'as':_0xe6b4('0x1ac'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0x1b4')]['hasMany'](db[_0xe6b4('0x1b5')],{'as':_0xe6b4('0x1ad'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0x1b4')]['hasMany'](db[_0xe6b4('0x1b5')],{'as':_0xe6b4('0x19f'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0x1b4')]['belongsTo'](db[_0xe6b4('0xa7')],{'as':'Account','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xe6b4('0x10a')](db[_0xe6b4('0x156')],{'through':_0xe6b4('0x1b6')});db[_0xe6b4('0x1b5')][_0xe6b4('0xfe')](db[_0xe6b4('0x1b5')],{'as':_0xe6b4('0x1a5'),'foreignKey':'SubjectId'});db[_0xe6b4('0x1b5')][_0xe6b4('0xfe')](db['FreshdeskField'],{'as':_0xe6b4('0x1a6'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0x1b5')][_0xe6b4('0xfe')](db['FreshdeskField'],{'as':_0xe6b4('0x1a7'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0x1b5')][_0xe6b4('0x12e')](db['Variable'],{'as':_0xe6b4('0x1a8'),'foreignKey':_0xe6b4('0x1a9')});db[_0xe6b4('0xab')]['hasMany'](db[_0xe6b4('0x1b7')],{'as':_0xe6b4('0x1ab'),'onDelete':'cascade','foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x1b7')][_0xe6b4('0xfe')](db[_0xe6b4('0xad')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xe6b4('0x1b7')][_0xe6b4('0xfe')](db[_0xe6b4('0xad')],{'as':_0xe6b4('0x1ad'),'foreignKey':_0xe6b4('0x1a4')});db['VtigerConfiguration'][_0xe6b4('0xfe')](db[_0xe6b4('0xad')],{'as':_0xe6b4('0x19f'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0x1b7')][_0xe6b4('0x12e')](db[_0xe6b4('0xab')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0xad')][_0xe6b4('0xfe')](db[_0xe6b4('0xad')],{'as':_0xe6b4('0x1a5'),'foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0xad')]['hasMany'](db['VtigerField'],{'as':_0xe6b4('0x1a6'),'foreignKey':'DescriptionId'});db['VtigerField'][_0xe6b4('0xfe')](db[_0xe6b4('0xad')],{'as':_0xe6b4('0x1a7'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0xad')][_0xe6b4('0x12e')](db[_0xe6b4('0x1a8')],{'as':_0xe6b4('0x1a8'),'foreignKey':_0xe6b4('0x1a9')});db['ServicenowAccount']['hasMany'](db[_0xe6b4('0x1b8')],{'as':_0xe6b4('0x1ab'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0x1b8')][_0xe6b4('0xfe')](db['ServicenowField'],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xe6b4('0xfe')](db[_0xe6b4('0xb0')],{'as':_0xe6b4('0x1ad'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0x1b8')][_0xe6b4('0xfe')](db['ServicenowField'],{'as':_0xe6b4('0x19f'),'foreignKey':'FieldId'});db[_0xe6b4('0x1b8')][_0xe6b4('0x12e')](db[_0xe6b4('0x1b9')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0xb0')][_0xe6b4('0xfe')](db[_0xe6b4('0xb0')],{'as':_0xe6b4('0x1a5'),'foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0xb0')][_0xe6b4('0xfe')](db[_0xe6b4('0xb0')],{'as':_0xe6b4('0x1a6'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0xb0')][_0xe6b4('0xfe')](db['ServicenowField'],{'as':_0xe6b4('0x1a7'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0xb0')][_0xe6b4('0x12e')](db['Variable'],{'as':_0xe6b4('0x1a8'),'foreignKey':_0xe6b4('0x1a9')});db[_0xe6b4('0xb2')]['hasMany'](db[_0xe6b4('0xb4')],{'as':_0xe6b4('0x1ab'),'onDelete':'cascade','foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0xb4')][_0xe6b4('0xfe')](db[_0xe6b4('0x1ba')],{'as':_0xe6b4('0x1ac'),'onDelete':'cascade','foreignKey':_0xe6b4('0x1a3')});db[_0xe6b4('0xb4')][_0xe6b4('0xfe')](db[_0xe6b4('0x1ba')],{'as':_0xe6b4('0x1ad'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xe6b4('0xb4')][_0xe6b4('0xfe')](db[_0xe6b4('0x1ba')],{'as':_0xe6b4('0x19f'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0xb4')][_0xe6b4('0x12e')](db[_0xe6b4('0xb2')],{'as':'Account','foreignKey':_0xe6b4('0x1a1')});db['Dynamics365Field'][_0xe6b4('0xfe')](db[_0xe6b4('0x1ba')],{'as':'Subject','foreignKey':_0xe6b4('0x1a3')});db['Dynamics365Field'][_0xe6b4('0xfe')](db['Dynamics365Field'],{'as':_0xe6b4('0x1a6'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0x1ba')][_0xe6b4('0xfe')](db[_0xe6b4('0x1ba')],{'as':'Field','foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0x1ba')][_0xe6b4('0x12e')](db['Variable'],{'as':_0xe6b4('0x1a8'),'foreignKey':_0xe6b4('0x1a9')});db['FreshsalesAccount'][_0xe6b4('0xfe')](db['FreshsalesConfiguration'],{'as':_0xe6b4('0x1ab'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1a1')});db[_0xe6b4('0xb9')][_0xe6b4('0xfe')](db[_0xe6b4('0xbb')],{'as':_0xe6b4('0x1ac'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xe6b4('0xfe')](db['FreshsalesField'],{'as':_0xe6b4('0x1ad'),'foreignKey':_0xe6b4('0x1a4')});db[_0xe6b4('0xb9')][_0xe6b4('0xfe')](db[_0xe6b4('0xbb')],{'as':_0xe6b4('0x19f'),'foreignKey':_0xe6b4('0x1ae')});db[_0xe6b4('0xb9')][_0xe6b4('0x12e')](db[_0xe6b4('0xb7')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x1a1')});db['FreshsalesField'][_0xe6b4('0xfe')](db[_0xe6b4('0xbb')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe6b4('0xbb')][_0xe6b4('0xfe')](db[_0xe6b4('0xbb')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField'][_0xe6b4('0xfe')](db[_0xe6b4('0xbb')],{'as':'Field','foreignKey':'FieldId'});db[_0xe6b4('0xbb')][_0xe6b4('0x12e')](db[_0xe6b4('0x1a8')],{'as':'Variable','foreignKey':_0xe6b4('0x1a9')});db[_0xe6b4('0xc0')][_0xe6b4('0x12e')](db[_0xe6b4('0x5d')],{});db[_0xe6b4('0xc0')]['belongsTo'](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0xc0')]['belongsTo'](db[_0xe6b4('0x143')],{'as':'Contact','foreignKey':_0xe6b4('0x154')});db['ChatQueueReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x103')],{});db[_0xe6b4('0xc0')][_0xe6b4('0x12e')](db[_0xe6b4('0x64')],{});db[_0xe6b4('0xc0')][_0xe6b4('0x12e')](db['User'],{});db[_0xe6b4('0xc0')]['belongsTo'](db['ChatQueue'],{});db['ChatInternalMessage'][_0xe6b4('0x12e')](db['User'],{'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1bb')});db[_0xe6b4('0x17d')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'onDelete':'cascade','foreignKey':_0xe6b4('0x1bc')});db['JscriptySessionReport'][_0xe6b4('0xfe')](db[_0xe6b4('0xc5')],{'foreignKey':'SessionId','onDelete':_0xe6b4('0xfc')});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xe6b4('0x1bd'),'onDelete':'cascade'});db[_0xe6b4('0xc9')][_0xe6b4('0x12e')](db[_0xe6b4('0x4b')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f')});db['SmsQueueReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0xc9')][_0xe6b4('0x12e')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x51')],{});db[_0xe6b4('0xc9')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{});db[_0xe6b4('0xc9')][_0xe6b4('0x12e')](db[_0xe6b4('0x53')],{});db['JscriptyProject'][_0xe6b4('0xfe')](db[_0xe6b4('0xc7')],{'foreignKey':_0xe6b4('0x1be')});db[_0xe6b4('0xcf')][_0xe6b4('0xfe')](db['JscriptyQuestionReport'],{'foreignKey':_0xe6b4('0x1be')});db[_0xe6b4('0xcf')]['hasMany'](db[_0xe6b4('0xc3')],{'foreignKey':_0xe6b4('0x1be')});db['SquareProject']['belongsToMany'](db[_0xe6b4('0x11')],{'as':'Users','through':_0xe6b4('0x1bf')});db['Team']['belongsToMany'](db[_0xe6b4('0x11')],{'as':'Agents','through':_0xe6b4('0x1c0')});db[_0xe6b4('0xd5')][_0xe6b4('0x10a')](db[_0xe6b4('0x19')],{'through':'team_has_voice_queues','as':'VoiceQueues'});db[_0xe6b4('0xd5')][_0xe6b4('0x10a')](db[_0xe6b4('0x35')],{'through':_0xe6b4('0x152'),'as':_0xe6b4('0x111')});db['Team']['belongsToMany'](db[_0xe6b4('0x67')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xe6b4('0xd5')][_0xe6b4('0x10a')](db[_0xe6b4('0x112')],{'through':_0xe6b4('0x16b'),'as':'FaxQueues'});db[_0xe6b4('0xd5')][_0xe6b4('0x10a')](db[_0xe6b4('0x53')],{'through':'team_has_sms_queues','as':_0xe6b4('0x113')});db[_0xe6b4('0xd5')][_0xe6b4('0x10a')](db[_0xe6b4('0x5b')],{'through':_0xe6b4('0x1c1'),'as':'OpenchannelQueues'});db[_0xe6b4('0xd5')][_0xe6b4('0x10a')](db[_0xe6b4('0xf6')],{'through':'team_has_whatsapp_queues','as':_0xe6b4('0x115')});db['Campaign'][_0xe6b4('0xfe')](db[_0xe6b4('0x6c')],{'as':_0xe6b4('0x128'),'foreignKey':_0xe6b4('0x187')});db[_0xe6b4('0x186')][_0xe6b4('0xfe')](db[_0xe6b4('0x70')],{'as':_0xe6b4('0x129'),'foreignKey':_0xe6b4('0x187')});db[_0xe6b4('0x186')][_0xe6b4('0xfe')](db[_0xe6b4('0x72')],{'as':_0xe6b4('0x12a'),'foreignKey':'CampaignId'});db['Campaign']['hasMany'](db[_0xe6b4('0x6e')],{'as':_0xe6b4('0x12c'),'foreignKey':_0xe6b4('0x187')});db['Campaign'][_0xe6b4('0x12e')](db[_0xe6b4('0x26')],{'as':_0xe6b4('0x26'),'foreignKey':_0xe6b4('0x12f')});db[_0xe6b4('0x186')]['belongsTo'](db[_0xe6b4('0x26')],{'as':'TrunkBackup','foreignKey':_0xe6b4('0x130')});db[_0xe6b4('0x186')][_0xe6b4('0x12e')](db[_0xe6b4('0x7c')],{'as':_0xe6b4('0x7c'),'foreignKey':'IntervalId'});db[_0xe6b4('0x186')][_0xe6b4('0x12e')](db['SquareProject'],{'as':_0xe6b4('0x122'),'foreignKey':'SquareProjectId'});db[_0xe6b4('0x186')][_0xe6b4('0x10a')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x134'),'through':'campaigns_has_cm_lists'});db[_0xe6b4('0x186')]['belongsToMany'](db[_0xe6b4('0x10c')],{'as':'BlackLists','through':_0xe6b4('0x1c2')});db[_0xe6b4('0x1c3')][_0xe6b4('0x12e')](db['MailMessage'],{});db[_0xe6b4('0x1c3')]['belongsTo'](db[_0xe6b4('0x38')],{});db[_0xe6b4('0x1c3')][_0xe6b4('0x12e')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xe6b4('0x1c4')});db['MailTransferReport'][_0xe6b4('0x12e')](db['User'],{'foreignKey':'FromUserId','as':_0xe6b4('0x1c5')});db[_0xe6b4('0x1c3')][_0xe6b4('0x12e')](db['User'],{'foreignKey':_0xe6b4('0x1c6'),'as':_0xe6b4('0x1c7')});db[_0xe6b4('0x1c3')][_0xe6b4('0x12e')](db[_0xe6b4('0x35')],{'foreignKey':_0xe6b4('0x1c8'),'as':'ToQueue'});db[_0xe6b4('0x1c3')]['belongsTo'](db[_0xe6b4('0x33')],{'foreignKey':_0xe6b4('0x1c9'),'as':_0xe6b4('0x1ca')});db[_0xe6b4('0x1cb')][_0xe6b4('0x12e')](db[_0xe6b4('0x64')],{});db[_0xe6b4('0x1cb')][_0xe6b4('0x12e')](db['ChatInteraction'],{});db[_0xe6b4('0x1cb')]['belongsTo'](db[_0xe6b4('0x5d')],{'foreignKey':_0xe6b4('0x1cc'),'as':_0xe6b4('0x1c4')});db[_0xe6b4('0x1cb')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'foreignKey':_0xe6b4('0x1cd'),'as':_0xe6b4('0x1c5')});db[_0xe6b4('0x1cb')][_0xe6b4('0x12e')](db['User'],{'foreignKey':_0xe6b4('0x1c6'),'as':_0xe6b4('0x1c7')});db[_0xe6b4('0x1cb')][_0xe6b4('0x12e')](db['ChatQueue'],{'foreignKey':_0xe6b4('0x1ce'),'as':'ToQueue'});db[_0xe6b4('0x1cb')][_0xe6b4('0x12e')](db['ChatWebsite'],{'foreignKey':_0xe6b4('0x1cf'),'as':_0xe6b4('0x1ca')});db[_0xe6b4('0x1d0')][_0xe6b4('0x12e')](db[_0xe6b4('0x47')],{});db[_0xe6b4('0x1d0')][_0xe6b4('0x12e')](db[_0xe6b4('0x45')],{});db[_0xe6b4('0x1d0')][_0xe6b4('0x12e')](db[_0xe6b4('0x42')],{'foreignKey':_0xe6b4('0x1d1'),'as':_0xe6b4('0x1c4')});db[_0xe6b4('0x1d0')]['belongsTo'](db['User'],{'foreignKey':_0xe6b4('0x1cd'),'as':_0xe6b4('0x1c5')});db['FaxTransferReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'foreignKey':_0xe6b4('0x1c6'),'as':'ToAgent'});db[_0xe6b4('0x1d0')][_0xe6b4('0x12e')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db['FaxTransferReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x42')],{'foreignKey':'ToFaxAccountId','as':_0xe6b4('0x1ca')});db[_0xe6b4('0xdf')][_0xe6b4('0x12e')](db[_0xe6b4('0x174')],{});db['OpenchannelTransferReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x59')],{});db[_0xe6b4('0xdf')][_0xe6b4('0x12e')](db['OpenchannelAccount'],{'foreignKey':_0xe6b4('0x1d2'),'as':_0xe6b4('0x1c4')});db[_0xe6b4('0xdf')]['belongsTo'](db[_0xe6b4('0x11')],{'foreignKey':'FromUserId','as':_0xe6b4('0x1c5')});db[_0xe6b4('0xdf')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'foreignKey':_0xe6b4('0x1c6'),'as':'ToAgent'});db[_0xe6b4('0xdf')][_0xe6b4('0x12e')](db[_0xe6b4('0x5b')],{'foreignKey':_0xe6b4('0x1d3'),'as':'ToQueue'});db[_0xe6b4('0xdf')][_0xe6b4('0x12e')](db[_0xe6b4('0x55')],{'foreignKey':_0xe6b4('0x1d4'),'as':'ToAccount'});db['SmsTransferReport'][_0xe6b4('0x12e')](db[_0xe6b4('0x51')],{});db[_0xe6b4('0xe1')][_0xe6b4('0x12e')](db[_0xe6b4('0x4f')],{});db[_0xe6b4('0xe1')][_0xe6b4('0x12e')](db[_0xe6b4('0x4b')],{'foreignKey':_0xe6b4('0x1d5'),'as':'FromAccount'});db[_0xe6b4('0xe1')]['belongsTo'](db[_0xe6b4('0x11')],{'foreignKey':'FromUserId','as':_0xe6b4('0x1c5')});db[_0xe6b4('0xe1')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'foreignKey':'ToUserId','as':_0xe6b4('0x1c7')});db[_0xe6b4('0xe1')][_0xe6b4('0x12e')](db[_0xe6b4('0x53')],{'foreignKey':'ToSmsQueueId','as':_0xe6b4('0x1d6')});db[_0xe6b4('0xe1')]['belongsTo'](db[_0xe6b4('0x4b')],{'foreignKey':_0xe6b4('0x1d7'),'as':_0xe6b4('0x1ca')});db['CmList']['hasMany'](db[_0xe6b4('0x149')],{'as':_0xe6b4('0x14a'),'foreignKey':'ListId'});db[_0xe6b4('0x10c')][_0xe6b4('0xfe')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0x10c')][_0xe6b4('0xfe')](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x182'),'onDelete':_0xe6b4('0xfc'),'foreignKey':'ListId'});db[_0xe6b4('0x10c')]['hasMany'](db[_0xe6b4('0x70')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0xe6b4('0xfe')](db[_0xe6b4('0x72')],{'as':'HopperHistory','foreignKey':_0xe6b4('0x14f')});db['CmList'][_0xe6b4('0xfe')](db[_0xe6b4('0x12b')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xe6b4('0x10c')][_0xe6b4('0x10a')](db[_0xe6b4('0x19')],{'as':'Queues','through':_0xe6b4('0x135')});db['CmList']['belongsToMany'](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x136'),'through':'cm_user_has_lists'});db[_0xe6b4('0x116')][_0xe6b4('0xfe')](db['VoiceExtension'],{'as':_0xe6b4('0x101'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x116')][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x136'),'through':_0xe6b4('0x1d8')});db[_0xe6b4('0xe5')][_0xe6b4('0xfe')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x15a'),'foreignKey':_0xe6b4('0x1d9')});db['UserProfile'][_0xe6b4('0xfe')](db[_0xe6b4('0xe7')],{'as':_0xe6b4('0x1da'),'foreignKey':'userProfileId','onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0xe7')][_0xe6b4('0xfe')](db[_0xe6b4('0xe9')],{'as':'Resources','foreignKey':_0xe6b4('0x1db'),'onDelete':_0xe6b4('0xfc')});db[_0xe6b4('0x1dc')][_0xe6b4('0xfe')](db[_0xe6b4('0x149')],{'as':_0xe6b4('0x14a'),'foreignKey':'WhatsappAccountId'});db[_0xe6b4('0x1dc')]['hasMany'](db[_0xe6b4('0x16d')],{'as':_0xe6b4('0x14b'),'foreignKey':_0xe6b4('0x1dd')});db[_0xe6b4('0x1dc')][_0xe6b4('0xfe')](db[_0xe6b4('0xf1')],{'as':_0xe6b4('0x13c'),'foreignKey':_0xe6b4('0x1dd')});db['WhatsappAccount'][_0xe6b4('0xfe')](db[_0xe6b4('0xef')],{'as':'Interactions'});db[_0xe6b4('0x1dc')]['hasMany'](db[_0xe6b4('0x1de')],{'as':_0xe6b4('0x14d')});db[_0xe6b4('0x1dc')][_0xe6b4('0x12e')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0x1dc')][_0xe6b4('0x12e')](db[_0xe6b4('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xe6b4('0x133')});db['WhatsappAccount'][_0xe6b4('0x10a')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x136'),'through':_0xe6b4('0x121')});db[_0xe6b4('0x1de')][_0xe6b4('0x12e')](db['User'],{'onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x1de')][_0xe6b4('0x12e')](db[_0xe6b4('0xf6')],{'onDelete':_0xe6b4('0x160')});db['WhatsappApplication'][_0xe6b4('0x12e')](db[_0xe6b4('0x1dc')],{'onDelete':_0xe6b4('0x160')});db[_0xe6b4('0x1de')]['belongsTo'](db['Interval'],{'onDelete':_0xe6b4('0x160'),'foreignKey':_0xe6b4('0x131')});db['WhatsappApplication'][_0xe6b4('0x12e')](db['Tag'],{'onDelete':_0xe6b4('0x160'),'foreignKey':_0xe6b4('0x161')});db[_0xe6b4('0xef')][_0xe6b4('0xfe')](db[_0xe6b4('0xf1')],{'as':_0xe6b4('0x13c'),'onDelete':_0xe6b4('0xfc'),'foreignKey':_0xe6b4('0x1df')});db[_0xe6b4('0xef')][_0xe6b4('0x12e')](db['WhatsappAccount'],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x1dd')});db['WhatsappInteraction'][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':_0xe6b4('0x154')});db[_0xe6b4('0xef')][_0xe6b4('0x12e')](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x155'),'foreignKey':_0xe6b4('0xfd')});db['WhatsappInteraction'][_0xe6b4('0x10a')](db['Tag'],{'through':_0xe6b4('0x198'),'as':'Tags'});db[_0xe6b4('0xef')][_0xe6b4('0x10a')](db['Tag'],{'through':_0xe6b4('0x198'),'as':_0xe6b4('0x159')});db[_0xe6b4('0xef')]['belongsToMany'](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x15a'),'through':_0xe6b4('0x1e0'),'foreignKey':_0xe6b4('0x1df')});db['WhatsappMessage']['belongsTo'](db[_0xe6b4('0x11')],{'as':_0xe6b4('0x11')});db[_0xe6b4('0xf1')][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'onDelete':_0xe6b4('0xfc'),'as':_0xe6b4('0x144')});db[_0xe6b4('0xf1')][_0xe6b4('0x12e')](db[_0xe6b4('0xef')],{'onDelete':'cascade','as':_0xe6b4('0x15f'),'foreignKey':_0xe6b4('0x1df')});db[_0xe6b4('0xf1')][_0xe6b4('0x12e')](db[_0xe6b4('0x1dc')],{'as':_0xe6b4('0x153'),'foreignKey':_0xe6b4('0x1dd')});db[_0xe6b4('0xf3')][_0xe6b4('0x12e')](db[_0xe6b4('0x1dc')],{});db[_0xe6b4('0xf3')][_0xe6b4('0x12e')](db[_0xe6b4('0x10c')],{'as':_0xe6b4('0x14e'),'foreignKey':_0xe6b4('0x14f')});db[_0xe6b4('0xf3')][_0xe6b4('0x12e')](db[_0xe6b4('0x143')],{'as':_0xe6b4('0x144'),'foreignKey':'ContactId'});db[_0xe6b4('0xf3')]['belongsTo'](db['WhatsappInteraction'],{});db[_0xe6b4('0xf3')][_0xe6b4('0x12e')](db[_0xe6b4('0xf6')],{});db[_0xe6b4('0xf3')]['belongsTo'](db[_0xe6b4('0xf1')],{});db[_0xe6b4('0xf3')]['belongsTo'](db['User'],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0xe6b4('0x12e')](db['WhatsappInteraction'],{});db[_0xe6b4('0xf4')][_0xe6b4('0x12e')](db[_0xe6b4('0x1dc')],{'foreignKey':_0xe6b4('0x1e1'),'as':'FromAccount'});db[_0xe6b4('0xf4')][_0xe6b4('0x12e')](db[_0xe6b4('0x1dc')],{'foreignKey':_0xe6b4('0x1e2'),'as':'ToAccount'});db[_0xe6b4('0xf4')][_0xe6b4('0x12e')](db['WhatsappQueue'],{'foreignKey':_0xe6b4('0x1e3'),'as':_0xe6b4('0x1d6')});db[_0xe6b4('0xf4')]['belongsTo'](db[_0xe6b4('0x11')],{'foreignKey':_0xe6b4('0x1cd'),'as':_0xe6b4('0x1c5')});db[_0xe6b4('0xf4')]['belongsTo'](db[_0xe6b4('0x11')],{'foreignKey':'ToUserId','as':_0xe6b4('0x1c7')});db['WhatsappQueue'][_0xe6b4('0x10a')](db['User'],{'as':_0xe6b4('0x136'),'through':_0xe6b4('0x30'),'foreignKey':_0xe6b4('0x1e4')});db[_0xe6b4('0xf6')][_0xe6b4('0x10a')](db[_0xe6b4('0xd5')],{'through':_0xe6b4('0x1e5'),'as':_0xe6b4('0x137')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb182=['ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareMessage/squareMessage.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../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','VoiceMail','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','cascade','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','ChatWebsites','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','Interval','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','Imap','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','restrict','Tag','TagId','ContactId','Items','Dispositions','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','SmsInteraction','SmsApplication','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','mandatoryDispositionPause','OpenchannelQueueId','IntervalId','openchannel_interaction_has_tags','AttachmentId','ChatWebsite','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessage','team_has_chat_queues','ChatInternalMessage','chat_group_has_users','Website','Company','CompanyId','cm_contact_has_tags','Queue','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','MailApplications','FaxApplications','SmsApplications','DefaultReportId','Schedule','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerId','Fields','CustomReportId','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','Subject','FieldId','VariableId','SugarcrmField','Description','DeskAccount','int_desk_configuration_has_tags','DescriptionId','Field','ZendeskConfiguration','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowConfiguration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToAgent','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','userProfileId','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','exports','../config/environment','sequelize','lodash','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','motion2','utf8_general_ci','username','options','database','password','User','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model'];(function(_0x4fa0f1,_0x46f90c){var _0xc09fef=function(_0x465032){while(--_0x465032){_0x4fa0f1['push'](_0x4fa0f1['shift']());}};_0xc09fef(++_0x46f90c);}(_0xb182,0x121));var _0x2b18=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0xb182[_0x24618a];return _0x2e3d64;};'use strict';var path=require('path');var config=require(_0x2b18('0x0'));var Sequelize=require(_0x2b18('0x1'));var _=require(_0x2b18('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x2b18('0x1')]=_[_0x2b18('0x3')](config[_0x2b18('0x1')],{'database':'motion2','username':_0x2b18('0x4'),'password':_0x2b18('0x5'),'options':{'host':_0x2b18('0x6'),'port':0xcea,'dialect':_0x2b18('0x7'),'dialectOptions':{'charset':_0x2b18('0x8')},'logging':![],'timezone':timezone[_0x2b18('0x9')](),'define':{'charset':_0x2b18('0xa'),'collate':'utf8_general_ci'}}});config[_0x2b18('0xb')]=_[_0x2b18('0x3')](config[_0x2b18('0xb')],{'database':_0x2b18('0xc'),'username':_0x2b18('0x4'),'password':_0x2b18('0x5'),'options':{'host':_0x2b18('0x6'),'port':0xcea,'dialect':_0x2b18('0x7'),'dialectOptions':{'charset':_0x2b18('0x8')},'logging':![],'timezone':timezone[_0x2b18('0x9')](),'define':{'charset':_0x2b18('0xa'),'collate':_0x2b18('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2b18('0x1')]['database'],config[_0x2b18('0x1')][_0x2b18('0xe')],config['sequelize']['password'],config[_0x2b18('0x1')][_0x2b18('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2b18('0xb')][_0x2b18('0x10')],config[_0x2b18('0xb')][_0x2b18('0xe')],config[_0x2b18('0xb')][_0x2b18('0x11')],config['sequelizeHistory'][_0x2b18('0xf')])};db[_0x2b18('0x12')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x13'));db['VoiceChanSpy']=db['sequelize']['import'](_0x2b18('0x14'));db[_0x2b18('0x15')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x17'));db[_0x2b18('0x18')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x19'));db[_0x2b18('0x1a')]=db['sequelize']['import'](_0x2b18('0x1b'));db[_0x2b18('0x1c')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x1d'));db[_0x2b18('0x1e')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x1f'));db['ScreenRecording']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x20'));db['VoiceMail']=db['sequelize']['import'](_0x2b18('0x21'));db[_0x2b18('0x22')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x23'));db[_0x2b18('0x24')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x25'));db[_0x2b18('0x26')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x27'));db[_0x2b18('0x28')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x29'));db[_0x2b18('0x2a')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x2b'));db[_0x2b18('0x2c')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x2d'));db[_0x2b18('0x2e')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x2f'));db[_0x2b18('0x30')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x2b18('0x31')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x32'));db['UserVoiceQueue']=db['sequelize']['import'](_0x2b18('0x33'));db[_0x2b18('0x34')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x35'));db[_0x2b18('0x36')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x37'));db[_0x2b18('0x38')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x39'));db[_0x2b18('0x3a')]=db['sequelize']['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x2b18('0x3b')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x3c'));db['UserWhatsappQueue']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x3d'));db[_0x2b18('0x3e')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x3f'));db[_0x2b18('0x40')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x41'));db[_0x2b18('0x42')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x43'));db[_0x2b18('0x44')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x45'));db[_0x2b18('0x46')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x47'));db[_0x2b18('0x48')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x49'));db[_0x2b18('0x4a')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x4b'));db[_0x2b18('0x4c')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x4d'));db[_0x2b18('0x4e')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x4f'));db[_0x2b18('0x50')]=db[_0x2b18('0x1')]['import']('../api/dashboard/dashboard.model');db[_0x2b18('0x51')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x52'));db[_0x2b18('0x53')]=db[_0x2b18('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0x2b18('0x54')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x55'));db[_0x2b18('0x56')]=db['sequelize']['import'](_0x2b18('0x57'));db[_0x2b18('0x58')]=db['sequelize']['import'](_0x2b18('0x59'));db[_0x2b18('0x5a')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x5b'));db[_0x2b18('0x5c')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/faxQueueReport/faxQueueReport.model');db[_0x2b18('0x5d')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x5e'));db['SmsApplication']=db['sequelize']['import'](_0x2b18('0x5f'));db['SmsInteraction']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x60'));db[_0x2b18('0x61')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x62'));db[_0x2b18('0x63')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x64'));db[_0x2b18('0x65')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x66'));db[_0x2b18('0x67')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/openchannelApplication/openchannelApplication.model');db[_0x2b18('0x68')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x69'));db['OpenchannelMessage']=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/openchannelMessage/openchannelMessage.model');db[_0x2b18('0x6a')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x6b'));db['ChatWebsite']=db[_0x2b18('0x1')]['import']('../api/chatWebsite/chatWebsite.model');db[_0x2b18('0x6c')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x6d'));db[_0x2b18('0x6e')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x6f'));db[_0x2b18('0x70')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x71'));db[_0x2b18('0x72')]=db['sequelize'][_0x2b18('0x16')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x2b18('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x2b18('0x73')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x74'));db[_0x2b18('0x75')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x76'));db[_0x2b18('0x77')]=db['sequelize'][_0x2b18('0x16')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x2b18('0x78')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x79'));db[_0x2b18('0x7a')]=db['sequelize'][_0x2b18('0x16')]('../api/cmContact/cmContact.model');db[_0x2b18('0x7b')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x7c'));db['CmHopperBlack']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x7d'));db[_0x2b18('0x7e')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x7f'));db['CmHopperHistory']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x80'));db[_0x2b18('0x81')]=db['sequelize']['import'](_0x2b18('0x82'));db[_0x2b18('0x83')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x84'));db[_0x2b18('0x85')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x86'));db[_0x2b18('0x87')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x88'));db[_0x2b18('0x89')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x8a'));db[_0x2b18('0x8b')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x8c'));db[_0x2b18('0x8d')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x8e'));db['Interval']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x8f'));db[_0x2b18('0x90')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x91'));db[_0x2b18('0x92')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x93'));db['VoiceQueuesLog']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x94'));db['Schedule']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x95'));db[_0x2b18('0x96')]=db[_0x2b18('0x1')]['import']('../api/sound/sound.model');db['Tag']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x97'));db[_0x2b18('0x98')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x99'));db[_0x2b18('0x9a')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x9b'));db[_0x2b18('0x9c')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x9d'));db[_0x2b18('0x9e')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x9f'));db[_0x2b18('0xa0')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xa1'));db[_0x2b18('0xa2')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xa3'));db[_0x2b18('0xa4')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xa5'));db[_0x2b18('0xa6')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xa7'));db['AnalyticMetric']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xa8'));db[_0x2b18('0xa9')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xaa'));db[_0x2b18('0xab')]=db[_0x2b18('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x2b18('0xac')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xad'));db['SalesforceConfiguration']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xae'));db['SalesforceField']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xaf'));db[_0x2b18('0xb0')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x2b18('0xb1')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xb2'));db['SugarcrmField']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xb3'));db['DeskAccount']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xb4'));db[_0x2b18('0xb5')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xb6'));db[_0x2b18('0xb7')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xb8'));db[_0x2b18('0xb9')]=db['sequelize']['import'](_0x2b18('0xba'));db[_0x2b18('0xbb')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x2b18('0xbc')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xbd'));db[_0x2b18('0xbe')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xbf'));db['ZendeskConfiguration']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xc0'));db[_0x2b18('0xc1')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/intZendeskField/intZendeskField.model');db[_0x2b18('0xc2')]=db['sequelize']['import'](_0x2b18('0xc3'));db['FreshdeskConfiguration']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xc4'));db[_0x2b18('0xc5')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xc6'));db[_0x2b18('0xc7')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xc8'));db['VtigerConfiguration']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xc9'));db['VtigerField']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xca'));db[_0x2b18('0xcb')]=db['sequelize'][_0x2b18('0x16')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xcc'));db[_0x2b18('0xcd')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xce'));db[_0x2b18('0xcf')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x2b18('0xd0')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xd1'));db[_0x2b18('0xd2')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xd3'));db[_0x2b18('0xd4')]=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x2b18('0xd5')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xd6'));db[_0x2b18('0xd7')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xd8'));db['Integration']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x9f'));db['Network']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xd9'));db[_0x2b18('0xda')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xdb'));db['ChatInternalMessage']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xdc'));db[_0x2b18('0xdd')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xde'));db[_0x2b18('0xdf')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xe0'));db[_0x2b18('0xe1')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xe2'));db['SmsQueueReport']=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/smsQueueReport/smsQueueReport.model');db[_0x2b18('0xe3')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xe4'));db['SquareDetailsReport']=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/squareReportDetail/squareReportDetail.model');db[_0x2b18('0xe5')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xe6'));db[_0x2b18('0xe7')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xe8'));db['SquareOdbc']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xe9'));db[_0x2b18('0xea')]=db['sequelize'][_0x2b18('0x16')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xeb'));db['Team']=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xec'));db[_0x2b18('0xed')]=db[_0x2b18('0x1')]['import']('../api/license/license.model');db[_0x2b18('0xee')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xef'));db['Migration']=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xf0'));db[_0x2b18('0xf1')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/attachment/attachment.model');db[_0x2b18('0xf2')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xf3'));db[_0x2b18('0xf4')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/mailTransferReport/mailTransferReport.model');db[_0x2b18('0xf5')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xf6'));db[_0x2b18('0xf7')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0xf8'));db[_0x2b18('0xf9')]=db['sequelize']['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/smsTransferReport/smsTransferReport.model');db[_0x2b18('0xfa')]=db[_0x2b18('0x1')]['import'](_0x2b18('0xfb'));db[_0x2b18('0xfc')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xfd'));db[_0x2b18('0xfe')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0xff'));db[_0x2b18('0x100')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x101'));db[_0x2b18('0x102')]=db[_0x2b18('0x1')][_0x2b18('0x16')]('../api/userProfileResource/userProfileResource.model');db[_0x2b18('0x103')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x104'));db[_0x2b18('0x105')]=db[_0x2b18('0x1')]['import'](_0x2b18('0x106'));db[_0x2b18('0x107')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x108'));db[_0x2b18('0x109')]=db['sequelize'][_0x2b18('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x2b18('0x10a')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x10b'));db[_0x2b18('0x10c')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x10d'));db[_0x2b18('0x10e')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x10f'));db[_0x2b18('0x110')]=db['sequelize'][_0x2b18('0x16')](_0x2b18('0x111'));db[_0x2b18('0x112')]=db[_0x2b18('0x1')][_0x2b18('0x16')](_0x2b18('0x113'));db['User'][_0x2b18('0x114')](db[_0x2b18('0x115')],{'as':_0x2b18('0x115'),'onDelete':'cascade','foreignKey':_0x2b18('0x116')});db[_0x2b18('0x12')][_0x2b18('0x117')](db[_0x2b18('0x1e')],{'as':_0x2b18('0x118'),'foreignKey':'UserId'});db['User'][_0x2b18('0x117')](db[_0x2b18('0x31')],{'as':_0x2b18('0x119'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x12')]['hasMany'](db['VoiceExtension'],{'as':_0x2b18('0x11a'),'onDelete':_0x2b18('0x11b'),'hooks':!![]});db[_0x2b18('0x12')][_0x2b18('0x117')](db[_0x2b18('0x7e')],{'as':_0x2b18('0x11c'),'foreignKey':'UserId'});db[_0x2b18('0x12')]['hasMany'](db[_0x2b18('0x11d')],{'as':_0x2b18('0x11e'),'foreignKey':'UserId'});db[_0x2b18('0x12')]['hasMany'](db[_0x2b18('0x81')],{'as':_0x2b18('0x81'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x12')][_0x2b18('0x117')](db[_0x2b18('0x68')],{'as':_0x2b18('0x11f'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x12')]['hasMany'](db['ChatInteraction'],{'as':_0x2b18('0x120'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x12')][_0x2b18('0x117')](db['SmsInteraction'],{'as':_0x2b18('0x121'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x12')][_0x2b18('0x117')](db[_0x2b18('0x56')],{'as':_0x2b18('0x122'),'foreignKey':_0x2b18('0x116')});db['User'][_0x2b18('0x117')](db[_0x2b18('0x48')],{'as':_0x2b18('0x123'),'foreignKey':'UserId'});db[_0x2b18('0x12')][_0x2b18('0x117')](db[_0x2b18('0x109')],{'as':_0x2b18('0x124'),'foreignKey':'UserId'});db[_0x2b18('0x12')][_0x2b18('0x117')](db[_0x2b18('0x103')],{'as':_0x2b18('0x125'),'foreignKey':_0x2b18('0x126')});db[_0x2b18('0x12')]['belongsTo'](db['UserProfile'],{'as':_0x2b18('0xfe'),'foreignKey':'userProfileId'});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0x75')],{'as':_0x2b18('0x128'),'through':'chat_group_has_users'});db[_0x2b18('0x12')][_0x2b18('0x127')](db['CmContact'],{'as':_0x2b18('0x129'),'through':_0x2b18('0x12a')});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0xfa')],{'as':_0x2b18('0x12b'),'through':_0x2b18('0x12c')});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0x12d')],{'through':_0x2b18('0x12e')});db['User']['belongsToMany'](db[_0x2b18('0x48')],{'as':'MailInteractions','through':_0x2b18('0x12f')});db['User'][_0x2b18('0x127')](db[_0x2b18('0x70')],{'as':'ChatInteractions','through':_0x2b18('0x130')});db[_0x2b18('0x12')]['belongsToMany'](db[_0x2b18('0x56')],{'as':_0x2b18('0x122'),'through':_0x2b18('0x131')});db[_0x2b18('0x12')][_0x2b18('0x127')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x2b18('0x132')});db[_0x2b18('0x12')][_0x2b18('0x127')](db['OpenchannelInteraction'],{'as':_0x2b18('0x11f'),'through':_0x2b18('0x133')});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0x109')],{'as':_0x2b18('0x124'),'through':_0x2b18('0x134')});db[_0x2b18('0x12')]['belongsToMany'](db[_0x2b18('0x1c')],{'as':_0x2b18('0x135'),'through':_0x2b18('0x136'),'required':![]});db[_0x2b18('0x12')][_0x2b18('0x127')](db['MailQueue'],{'as':_0x2b18('0x137'),'through':_0x2b18('0x36'),'required':![]});db['User'][_0x2b18('0x127')](db['ChatQueue'],{'as':_0x2b18('0x138'),'through':_0x2b18('0x34'),'required':![],'hooks':!![]});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0x5a')],{'as':_0x2b18('0x139'),'through':'UserFaxQueue','required':![]});db[_0x2b18('0x12')][_0x2b18('0x127')](db['SmsQueue'],{'as':_0x2b18('0x13a'),'through':_0x2b18('0x3a'),'required':![]});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0x6a')],{'as':_0x2b18('0x13b'),'through':_0x2b18('0x3b'),'required':![]});db['User'][_0x2b18('0x127')](db[_0x2b18('0x110')],{'as':_0x2b18('0x13c'),'through':'UserWhatsappQueue','required':![]});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0xfa')],{'through':'cm_user_has_lists'});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0xfc')],{'as':_0x2b18('0x13d'),'through':'user_has_voice_prefixes','required':![]});db['User'][_0x2b18('0x127')](db['ChatWebsite'],{'as':_0x2b18('0x13e'),'through':'user_has_chat_websites'});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0x53')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x2b18('0x12')]['belongsToMany'](db[_0x2b18('0x42')],{'as':_0x2b18('0x13f'),'through':'user_has_mail_accounts'});db[_0x2b18('0x12')][_0x2b18('0x127')](db[_0x2b18('0x65')],{'as':_0x2b18('0x140'),'through':_0x2b18('0x141')});db['User'][_0x2b18('0x127')](db['SmsAccount'],{'as':_0x2b18('0x142'),'through':'user_has_sms_accounts'});db[_0x2b18('0x12')][_0x2b18('0x127')](db['WhatsappAccount'],{'as':_0x2b18('0x143'),'through':_0x2b18('0x144')});db[_0x2b18('0x12')]['belongsToMany'](db[_0x2b18('0xea')],{'as':_0x2b18('0x145'),'through':_0x2b18('0x146')});db[_0x2b18('0x147')][_0x2b18('0x117')](db['VoiceExtension'],{'as':_0x2b18('0x148'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x149')});db[_0x2b18('0x15')][_0x2b18('0x117')](db['VoiceExtension'],{'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x18')]['hasMany'](db['VoiceExtension'],{'as':_0x2b18('0x14a'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x1a')][_0x2b18('0x127')](db[_0x2b18('0x96')],{'as':_0x2b18('0x14b'),'through':_0x2b18('0x14c')});db['VoiceQueue'][_0x2b18('0x117')](db['UserVoiceQueueRt'],{'as':_0x2b18('0x14d'),'foreignKey':_0x2b18('0x14e')});db[_0x2b18('0x1c')][_0x2b18('0x117')](db[_0x2b18('0x7b')],{'as':_0x2b18('0x14f'),'foreignKey':_0x2b18('0x14e')});db[_0x2b18('0x1c')][_0x2b18('0x117')](db[_0x2b18('0x7e')],{'as':_0x2b18('0x11c'),'foreignKey':'VoiceQueueId'});db[_0x2b18('0x1c')][_0x2b18('0x117')](db[_0x2b18('0x11d')],{'as':_0x2b18('0x150'),'foreignKey':_0x2b18('0x14e')});db[_0x2b18('0x1c')][_0x2b18('0x117')](db[_0x2b18('0x81')],{'as':'ReportAgentPreview','foreignKey':_0x2b18('0x14e')});db[_0x2b18('0x1c')][_0x2b18('0x117')](db[_0x2b18('0x151')],{'as':_0x2b18('0x152'),'foreignKey':_0x2b18('0x14e')});db[_0x2b18('0x1c')][_0x2b18('0x117')](db[_0x2b18('0xe1')],{'as':_0x2b18('0x153'),'foreignKey':_0x2b18('0x14e')});db[_0x2b18('0x1c')]['belongsTo'](db[_0x2b18('0x2e')],{'as':_0x2b18('0x2e'),'foreignKey':_0x2b18('0x154')});db[_0x2b18('0x1c')][_0x2b18('0x155')](db[_0x2b18('0x2e')],{'as':_0x2b18('0x156'),'foreignKey':_0x2b18('0x157')});db[_0x2b18('0x1c')][_0x2b18('0x155')](db['Interval'],{'as':_0x2b18('0x158'),'foreignKey':'IntervalId'});db[_0x2b18('0x1c')][_0x2b18('0x155')](db[_0x2b18('0x90')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x2b18('0x127')](db[_0x2b18('0xfa')],{'as':_0x2b18('0x12b'),'through':'voice_queues_has_cm_lists'});db[_0x2b18('0x1c')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':_0x2b18('0x136')});db[_0x2b18('0x1c')][_0x2b18('0x127')](db[_0x2b18('0x12d')],{'as':_0x2b18('0x15a'),'through':_0x2b18('0x15b')});db[_0x2b18('0x1c')][_0x2b18('0x127')](db['CmList'],{'as':'BlackLists','through':_0x2b18('0x15c')});db[_0x2b18('0x1e')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'as':_0x2b18('0x12'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x15d')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'as':'User','foreignKey':_0x2b18('0x116')});db[_0x2b18('0x115')][_0x2b18('0x117')](db[_0x2b18('0x22')],{'as':_0x2b18('0x15e'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x15f'),'sourceKey':_0x2b18('0x160')});db[_0x2b18('0x22')][_0x2b18('0x155')](db[_0x2b18('0x115')],{'foreignKey':'mailboxuser','targetKey':_0x2b18('0x160')});db[_0x2b18('0x24')][_0x2b18('0x117')](db[_0x2b18('0x2a')],{'as':_0x2b18('0x161'),'foreignKey':_0x2b18('0x162'),'constraints':![]});db[_0x2b18('0x24')][_0x2b18('0x117')](db['VoiceAgentReport'],{'as':_0x2b18('0x163'),'foreignKey':_0x2b18('0x162'),'constraints':![]});db[_0x2b18('0x24')][_0x2b18('0x155')](db['User'],{'as':_0x2b18('0x12'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x24')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':'ContactId'});db[_0x2b18('0x3e')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x2b18('0x165')});db['MailServerOut']['belongsTo'](db['MailAccount'],{'as':_0x2b18('0x42'),'foreignKey':_0x2b18('0x165')});db['MailAccount'][_0x2b18('0x114')](db['MailServerIn'],{'as':_0x2b18('0x166'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x42')][_0x2b18('0x114')](db[_0x2b18('0x40')],{'as':'Smtp','onDelete':_0x2b18('0x11b')});db['MailAccount']['hasMany'](db[_0x2b18('0x8b')],{'as':'Dispositions','foreignKey':_0x2b18('0x165')});db[_0x2b18('0x42')][_0x2b18('0x117')](db[_0x2b18('0x89')],{'as':_0x2b18('0x167'),'foreignKey':_0x2b18('0x165')});db['MailAccount'][_0x2b18('0x117')](db[_0x2b18('0x4a')],{'as':'Messages','foreignKey':_0x2b18('0x165')});db[_0x2b18('0x42')][_0x2b18('0x117')](db[_0x2b18('0x48')],{'as':_0x2b18('0x168')});db[_0x2b18('0x42')]['hasMany'](db[_0x2b18('0x4c')],{'as':_0x2b18('0x14a')});db[_0x2b18('0x42')][_0x2b18('0x155')](db['CmList'],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0x42')][_0x2b18('0x155')](db[_0x2b18('0x98')],{'as':'Template','foreignKey':_0x2b18('0x16b')});db[_0x2b18('0x42')][_0x2b18('0x155')](db[_0x2b18('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0x2b18('0x16c')});db['MailAccount'][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x2b18('0x44')][_0x2b18('0x127')](db['User'],{'as':_0x2b18('0x159'),'through':_0x2b18('0x36')});db['MailQueue']['belongsToMany'](db[_0x2b18('0x12d')],{'through':_0x2b18('0x16d'),'as':'Teams'});db['MailInteraction'][_0x2b18('0x117')](db[_0x2b18('0x4a')],{'as':'Messages','onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x16e')});db[_0x2b18('0x48')][_0x2b18('0x155')](db['MailAccount'],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x165')});db['MailInteraction'][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':'ContactId'});db['MailInteraction'][_0x2b18('0x155')](db[_0x2b18('0x12')],{'as':_0x2b18('0x170'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x48')][_0x2b18('0x127')](db['Tag'],{'through':_0x2b18('0x171'),'as':_0x2b18('0x172')});db['MailInteraction'][_0x2b18('0x127')](db['Tag'],{'through':_0x2b18('0x171'),'as':_0x2b18('0x173')});db[_0x2b18('0x48')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x174'),'through':'user_has_mail_interactions','foreignKey':_0x2b18('0x16e')});db[_0x2b18('0x4a')][_0x2b18('0x117')](db['Attachment'],{'as':_0x2b18('0x175'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x4a')]['belongsTo'](db['User'],{'as':'User'});db[_0x2b18('0x4a')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'onDelete':'cascade','as':'Contact'});db[_0x2b18('0x4a')]['belongsTo'](db[_0x2b18('0x48')],{'as':_0x2b18('0x176'),'foreignKey':'MailInteractionId'});db[_0x2b18('0x4a')][_0x2b18('0x155')](db[_0x2b18('0x42')],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x165')});db[_0x2b18('0x4c')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'onDelete':_0x2b18('0x177')});db[_0x2b18('0x4c')][_0x2b18('0x155')](db[_0x2b18('0x44')],{'onDelete':_0x2b18('0x177')});db[_0x2b18('0x4c')]['belongsTo'](db[_0x2b18('0x42')],{'onDelete':_0x2b18('0x177')});db[_0x2b18('0x4c')][_0x2b18('0x155')](db[_0x2b18('0x158')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x2b18('0x4c')][_0x2b18('0x155')](db[_0x2b18('0x178')],{'onDelete':_0x2b18('0x177'),'foreignKey':_0x2b18('0x179')});db[_0x2b18('0x4e')][_0x2b18('0x155')](db[_0x2b18('0x42')],{});db['MailQueueReport'][_0x2b18('0x155')](db['CmList'],{'as':'List','foreignKey':_0x2b18('0x16a')});db[_0x2b18('0x4e')]['belongsTo'](db[_0x2b18('0x7a')],{'as':'Contact','foreignKey':_0x2b18('0x17a')});db[_0x2b18('0x4e')][_0x2b18('0x155')](db[_0x2b18('0x48')],{});db['MailQueueReport'][_0x2b18('0x155')](db[_0x2b18('0x4a')],{});db['MailQueueReport'][_0x2b18('0x155')](db[_0x2b18('0x12')],{});db[_0x2b18('0x4e')]['belongsTo'](db[_0x2b18('0x44')],{});db['Dashboard']['hasMany'](db[_0x2b18('0x51')],{'as':_0x2b18('0x17b'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x53')][_0x2b18('0x117')](db[_0x2b18('0x8b')],{'as':_0x2b18('0x17c'),'foreignKey':_0x2b18('0x17d')});db[_0x2b18('0x53')][_0x2b18('0x117')](db[_0x2b18('0x89')],{'as':_0x2b18('0x167'),'foreignKey':_0x2b18('0x17d')});db[_0x2b18('0x53')][_0x2b18('0x117')](db[_0x2b18('0x56')],{'as':_0x2b18('0x168')});db[_0x2b18('0x53')][_0x2b18('0x117')](db['FaxApplication'],{'as':_0x2b18('0x14a')});db[_0x2b18('0x53')]['hasMany'](db['VoiceExtension'],{'as':_0x2b18('0x17e'),'onDelete':_0x2b18('0x11b')});db['FaxAccount'][_0x2b18('0x117')](db[_0x2b18('0x58')],{'as':_0x2b18('0x15e')});db[_0x2b18('0x53')][_0x2b18('0x155')](db[_0x2b18('0x2e')],{'as':_0x2b18('0x2e')});db['FaxAccount'][_0x2b18('0x155')](db[_0x2b18('0xfa')],{'as':'List','foreignKey':_0x2b18('0x16a')});db[_0x2b18('0x53')][_0x2b18('0x155')](db[_0x2b18('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0x2b18('0x16c')});db[_0x2b18('0x53')]['belongsToMany'](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':_0x2b18('0x17f')});db[_0x2b18('0x54')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'onDelete':'restrict'});db[_0x2b18('0x54')][_0x2b18('0x155')](db[_0x2b18('0x5a')],{'onDelete':_0x2b18('0x177')});db[_0x2b18('0x54')][_0x2b18('0x155')](db[_0x2b18('0x53')],{'onDelete':_0x2b18('0x177')});db[_0x2b18('0x54')][_0x2b18('0x155')](db[_0x2b18('0x178')],{'onDelete':_0x2b18('0x177'),'foreignKey':'TagId'});db[_0x2b18('0x56')][_0x2b18('0x117')](db[_0x2b18('0x58')],{'as':_0x2b18('0x15e'),'onDelete':'cascade','foreignKey':_0x2b18('0x180')});db['FaxInteraction'][_0x2b18('0x155')](db[_0x2b18('0x53')],{'as':'Account','foreignKey':_0x2b18('0x17d')});db[_0x2b18('0x56')][_0x2b18('0x155')](db['CmContact'],{'as':_0x2b18('0x164'),'foreignKey':_0x2b18('0x17a')});db[_0x2b18('0x56')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'as':_0x2b18('0x170'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x56')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x2b18('0x56')]['belongsToMany'](db['Tag'],{'through':_0x2b18('0x181'),'as':_0x2b18('0x173')});db[_0x2b18('0x56')][_0x2b18('0x127')](db['User'],{'as':_0x2b18('0x174'),'through':_0x2b18('0x131'),'foreignKey':_0x2b18('0x180')});db[_0x2b18('0x58')]['belongsTo'](db[_0x2b18('0x12')],{'onDelete':'cascade','as':_0x2b18('0x12')});db['FaxMessage'][_0x2b18('0x155')](db['FaxInteraction'],{'as':_0x2b18('0x176'),'foreignKey':_0x2b18('0x180')});db[_0x2b18('0x58')]['belongsTo'](db[_0x2b18('0x7a')],{'onDelete':_0x2b18('0x11b'),'as':_0x2b18('0x164')});db['FaxMessage'][_0x2b18('0x155')](db[_0x2b18('0xf1')],{'as':_0x2b18('0xf1'),'foreignKey':'AttachmentId'});db['FaxMessage']['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x2b18('0x17d')});db[_0x2b18('0x5a')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':_0x2b18('0x38')});db[_0x2b18('0x5a')][_0x2b18('0x127')](db[_0x2b18('0x12d')],{'through':_0x2b18('0x182'),'as':_0x2b18('0x15a')});db[_0x2b18('0x5c')][_0x2b18('0x155')](db[_0x2b18('0x53')],{});db[_0x2b18('0x5c')][_0x2b18('0x155')](db[_0x2b18('0xfa')],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0x5c')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x2b18('0x155')](db[_0x2b18('0x56')],{});db[_0x2b18('0x5c')]['belongsTo'](db[_0x2b18('0x58')],{});db[_0x2b18('0x5c')][_0x2b18('0x155')](db['User'],{});db['FaxQueueReport'][_0x2b18('0x155')](db[_0x2b18('0x5a')],{});db[_0x2b18('0x5d')]['hasMany'](db[_0x2b18('0x8b')],{'as':_0x2b18('0x17c'),'foreignKey':_0x2b18('0x183')});db['SmsAccount'][_0x2b18('0x117')](db[_0x2b18('0x89')],{'as':'Answers','foreignKey':_0x2b18('0x183')});db[_0x2b18('0x5d')][_0x2b18('0x117')](db['SmsMessage'],{'as':_0x2b18('0x15e'),'foreignKey':_0x2b18('0x183')});db[_0x2b18('0x5d')][_0x2b18('0x117')](db[_0x2b18('0x184')],{'as':_0x2b18('0x168')});db['SmsAccount'][_0x2b18('0x117')](db[_0x2b18('0x185')],{'as':_0x2b18('0x14a')});db['SmsAccount']['belongsTo'](db[_0x2b18('0xfa')],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0x5d')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x2b18('0x16c')});db[_0x2b18('0x5d')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':'Agents','through':_0x2b18('0x186')});db[_0x2b18('0x185')][_0x2b18('0x155')](db['User'],{'onDelete':_0x2b18('0x177')});db[_0x2b18('0x185')][_0x2b18('0x155')](db['SmsQueue'],{'onDelete':'restrict'});db[_0x2b18('0x185')]['belongsTo'](db[_0x2b18('0x5d')],{'onDelete':_0x2b18('0x177')});db[_0x2b18('0x185')][_0x2b18('0x155')](db['Interval'],{'onDelete':_0x2b18('0x177'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x2b18('0x155')](db[_0x2b18('0x178')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x2b18('0x184')][_0x2b18('0x117')](db[_0x2b18('0x61')],{'as':_0x2b18('0x15e'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x187')});db[_0x2b18('0x184')][_0x2b18('0x155')](db['SmsAccount'],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x183')});db['SmsInteraction'][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':_0x2b18('0x17a')});db[_0x2b18('0x184')]['belongsTo'](db['User'],{'as':_0x2b18('0x170'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x184')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':_0x2b18('0x188'),'as':_0x2b18('0x172')});db[_0x2b18('0x184')]['belongsToMany'](db[_0x2b18('0x178')],{'through':'sms_interaction_has_tags','as':_0x2b18('0x173')});db['SmsInteraction'][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':'Users','through':_0x2b18('0x132'),'foreignKey':_0x2b18('0x187')});db[_0x2b18('0x61')][_0x2b18('0x155')](db['User'],{'as':_0x2b18('0x12')});db[_0x2b18('0x61')][_0x2b18('0x155')](db['CmContact'],{'onDelete':_0x2b18('0x11b'),'as':_0x2b18('0x164')});db[_0x2b18('0x61')][_0x2b18('0x155')](db[_0x2b18('0x184')],{'onDelete':_0x2b18('0x11b'),'as':'Interaction','foreignKey':_0x2b18('0x187')});db[_0x2b18('0x61')]['belongsTo'](db[_0x2b18('0x5d')],{'as':_0x2b18('0x16f'),'foreignKey':'SmsAccountId'});db[_0x2b18('0x63')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':_0x2b18('0x3a'),'foreignKey':'SmsQueueId'});db[_0x2b18('0x63')]['belongsToMany'](db[_0x2b18('0x12d')],{'through':_0x2b18('0x189'),'as':_0x2b18('0x15a')});db['OpenchannelAccount'][_0x2b18('0x117')](db[_0x2b18('0x8b')],{'as':_0x2b18('0x17c'),'foreignKey':'OpenchannelAccountId'});db[_0x2b18('0x65')][_0x2b18('0x117')](db[_0x2b18('0x89')],{'as':'Answers','foreignKey':_0x2b18('0x18a')});db[_0x2b18('0x65')][_0x2b18('0x117')](db[_0x2b18('0x68')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x2b18('0x65')][_0x2b18('0x117')](db[_0x2b18('0x18b')],{'as':'Messages','foreignKey':_0x2b18('0x18a')});db[_0x2b18('0x65')]['hasMany'](db[_0x2b18('0x67')],{'as':_0x2b18('0x14a'),'foreignKey':_0x2b18('0x18a')});db[_0x2b18('0x65')][_0x2b18('0x155')](db[_0x2b18('0xfa')],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0x65')]['belongsTo'](db[_0x2b18('0x90')],{'as':_0x2b18('0x18c'),'foreignKey':_0x2b18('0x16c')});db[_0x2b18('0x65')]['belongsToMany'](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':_0x2b18('0x141')});db[_0x2b18('0x67')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'onDelete':_0x2b18('0x177')});db['OpenchannelApplication']['belongsTo'](db[_0x2b18('0x6a')],{'onDelete':_0x2b18('0x177'),'foreignKey':_0x2b18('0x18d')});db[_0x2b18('0x67')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x2b18('0x177'),'foreignKey':_0x2b18('0x18a')});db['OpenchannelApplication'][_0x2b18('0x155')](db['Interval'],{'onDelete':_0x2b18('0x177'),'foreignKey':_0x2b18('0x18e')});db[_0x2b18('0x67')][_0x2b18('0x155')](db['Tag'],{'onDelete':_0x2b18('0x177'),'foreignKey':_0x2b18('0x179')});db[_0x2b18('0x68')][_0x2b18('0x117')](db[_0x2b18('0x18b')],{'as':_0x2b18('0x15e'),'onDelete':_0x2b18('0x11b'),'foreignKey':'OpenchannelInteractionId'});db[_0x2b18('0x68')]['belongsTo'](db[_0x2b18('0x65')],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x18a')});db[_0x2b18('0x68')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':'ContactId'});db[_0x2b18('0x68')]['belongsTo'](db['User'],{'as':_0x2b18('0x170'),'foreignKey':'UserId'});db[_0x2b18('0x68')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':_0x2b18('0x18f'),'as':_0x2b18('0x172')});db[_0x2b18('0x68')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':_0x2b18('0x18f'),'as':_0x2b18('0x173')});db[_0x2b18('0x68')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x174'),'through':_0x2b18('0x133'),'foreignKey':'OpenchannelInteractionId'});db[_0x2b18('0x18b')][_0x2b18('0x155')](db['User'],{'onDelete':'cascade','as':_0x2b18('0x12')});db[_0x2b18('0x18b')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'onDelete':_0x2b18('0x11b'),'as':_0x2b18('0x164')});db[_0x2b18('0x18b')][_0x2b18('0x155')](db[_0x2b18('0x68')],{'onDelete':'cascade','as':_0x2b18('0x176'),'foreignKey':'OpenchannelInteractionId'});db[_0x2b18('0x18b')]['belongsTo'](db['Attachment'],{'as':_0x2b18('0xf1'),'foreignKey':_0x2b18('0x190')});db[_0x2b18('0x18b')][_0x2b18('0x155')](db[_0x2b18('0x65')],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x18a')});db[_0x2b18('0x6a')][_0x2b18('0x127')](db['User'],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db[_0x2b18('0x12d')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x2b18('0x191')]['hasMany'](db[_0x2b18('0x8b')],{'as':_0x2b18('0x17c'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db[_0x2b18('0x89')],{'as':_0x2b18('0x167'),'foreignKey':_0x2b18('0x192')});db[_0x2b18('0x191')]['hasMany'](db[_0x2b18('0x77')],{'as':_0x2b18('0x193')});db[_0x2b18('0x191')]['hasMany'](db['ChatInteraction'],{'as':'Interactions'});db[_0x2b18('0x191')]['hasMany'](db[_0x2b18('0x6e')],{'as':'Applications'});db[_0x2b18('0x191')][_0x2b18('0x117')](db[_0x2b18('0x72')],{'as':'Messages'});db['ChatWebsite'][_0x2b18('0x155')](db[_0x2b18('0xfa')],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0x191')][_0x2b18('0x155')](db[_0x2b18('0x158')],{'as':_0x2b18('0x158'),'foreignKey':_0x2b18('0x18e')});db[_0x2b18('0x191')]['belongsTo'](db[_0x2b18('0x90')],{'as':_0x2b18('0x18c'),'foreignKey':_0x2b18('0x16c')});db[_0x2b18('0x191')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':_0x2b18('0x194')});db[_0x2b18('0x6c')][_0x2b18('0x155')](db[_0x2b18('0x65')],{});db['OpenchannelQueueReport'][_0x2b18('0x155')](db['CmList'],{'as':_0x2b18('0x169'),'foreignKey':'ListId'});db[_0x2b18('0x6c')][_0x2b18('0x155')](db['CmContact'],{'as':'Contact','foreignKey':_0x2b18('0x17a')});db[_0x2b18('0x6c')]['belongsTo'](db[_0x2b18('0x68')],{});db[_0x2b18('0x6c')][_0x2b18('0x155')](db['OpenchannelMessage'],{});db[_0x2b18('0x6c')][_0x2b18('0x155')](db[_0x2b18('0x12')],{});db[_0x2b18('0x6c')]['belongsTo'](db[_0x2b18('0x6a')],{});db[_0x2b18('0x6e')][_0x2b18('0x155')](db['User'],{'as':_0x2b18('0x195'),'foreignKey':_0x2b18('0x116'),'onDelete':_0x2b18('0x177')});db['ChatApplication'][_0x2b18('0x155')](db[_0x2b18('0x73')],{'as':'Queue','foreignKey':_0x2b18('0x196'),'onDelete':_0x2b18('0x177')});db['ChatApplication'][_0x2b18('0x155')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x2b18('0x192'),'onDelete':_0x2b18('0x177')});db['ChatApplication']['belongsTo'](db[_0x2b18('0x178')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x2b18('0x70')][_0x2b18('0x117')](db[_0x2b18('0x72')],{'as':_0x2b18('0x15e'),'onDelete':_0x2b18('0x11b'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x2b18('0x155')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2b18('0x192')});db[_0x2b18('0x70')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':'ContactId'});db[_0x2b18('0x70')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'as':_0x2b18('0x170'),'foreignKey':'UserId'});db[_0x2b18('0x70')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':'chat_interaction_has_tags','as':'Tags'});db['ChatInteraction'][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':_0x2b18('0x197'),'as':'ThroughTags'});db[_0x2b18('0x70')][_0x2b18('0x127')](db['User'],{'as':_0x2b18('0x174'),'through':_0x2b18('0x130'),'foreignKey':_0x2b18('0x198')});db[_0x2b18('0x72')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'onDelete':'cascade','as':_0x2b18('0x12')});db[_0x2b18('0x72')]['belongsTo'](db[_0x2b18('0x7a')],{'onDelete':'cascade','as':_0x2b18('0x164'),'foreignKey':_0x2b18('0x17a')});db['ChatMessage'][_0x2b18('0x155')](db[_0x2b18('0x70')],{'onDelete':_0x2b18('0x11b'),'as':_0x2b18('0x176'),'foreignKey':_0x2b18('0x198')});db[_0x2b18('0x72')][_0x2b18('0x155')](db[_0x2b18('0xf1')],{'as':'Attachment','foreignKey':_0x2b18('0x190')});db[_0x2b18('0x72')][_0x2b18('0x155')](db[_0x2b18('0x191')],{'as':'Account','foreignKey':_0x2b18('0x192')});db[_0x2b18('0x199')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'onDelete':'cascade','as':_0x2b18('0x164'),'foreignKey':'ContactId'});db[_0x2b18('0x199')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2b18('0x192')});db[_0x2b18('0x73')]['belongsToMany'](db[_0x2b18('0x12')],{'as':'Agents','through':_0x2b18('0x34'),'hooks':!![]});db['ChatQueue'][_0x2b18('0x127')](db['Team'],{'through':_0x2b18('0x19a'),'as':_0x2b18('0x15a')});db[_0x2b18('0x75')][_0x2b18('0x117')](db[_0x2b18('0x19b')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x2b18('0x75')][_0x2b18('0x127')](db['User'],{'as':_0x2b18('0x14d'),'through':_0x2b18('0x19c')});db[_0x2b18('0x77')][_0x2b18('0x155')](db['ChatWebsite'],{'as':_0x2b18('0x19d'),'foreignKey':'ChatWebsiteId'});db[_0x2b18('0x78')][_0x2b18('0x117')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x129'),'foreignKey':'CompanyId'});db[_0x2b18('0x7a')][_0x2b18('0x117')](db[_0x2b18('0x7b')],{'as':'Hoppers','foreignKey':_0x2b18('0x17a')});db[_0x2b18('0x7a')][_0x2b18('0x117')](db[_0x2b18('0x7e')],{'as':'HopperFinals','foreignKey':_0x2b18('0x17a')});db[_0x2b18('0x7a')]['hasMany'](db['CmHopperHistory'],{'as':_0x2b18('0x150'),'foreignKey':_0x2b18('0x17a')});db[_0x2b18('0x7a')][_0x2b18('0x117')](db[_0x2b18('0x81')],{'as':_0x2b18('0x81'),'foreignKey':_0x2b18('0x17a')});db['CmContact']['hasMany'](db[_0x2b18('0xe1')],{'as':_0x2b18('0x153'),'foreignKey':'ContactId'});db[_0x2b18('0x7a')][_0x2b18('0x117')](db[_0x2b18('0x68')],{'as':_0x2b18('0x11f'),'foreignKey':_0x2b18('0x17a'),'onDelete':_0x2b18('0x177')});db[_0x2b18('0x7a')]['hasMany'](db[_0x2b18('0x70')],{'as':_0x2b18('0x120'),'foreignKey':'ContactId','onDelete':_0x2b18('0x177')});db['CmContact'][_0x2b18('0x117')](db['SmsInteraction'],{'as':_0x2b18('0x121'),'foreignKey':_0x2b18('0x17a'),'onDelete':_0x2b18('0x177')});db['CmContact'][_0x2b18('0x117')](db['FaxInteraction'],{'as':_0x2b18('0x122'),'foreignKey':_0x2b18('0x17a'),'onDelete':_0x2b18('0x177')});db[_0x2b18('0x7a')][_0x2b18('0x117')](db[_0x2b18('0x48')],{'as':'MailInteractions','foreignKey':_0x2b18('0x17a'),'onDelete':'restrict'});db[_0x2b18('0x7a')]['belongsTo'](db['CmCompany'],{'as':_0x2b18('0x19e'),'foreignKey':_0x2b18('0x19f')});db['CmContact']['belongsTo'](db[_0x2b18('0xfa')],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x7a')][_0x2b18('0x127')](db['User'],{'as':_0x2b18('0x174'),'through':_0x2b18('0x12a')});db[_0x2b18('0x7a')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x2b18('0x7a')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':_0x2b18('0x1a0'),'as':_0x2b18('0x173')});db['CmHopper'][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':_0x2b18('0x17a'),'onDelete':'cascade'});db['CmHopper'][_0x2b18('0x155')](db[_0x2b18('0xfa')],{'as':'List','foreignKey':'ListId','onDelete':_0x2b18('0x11b')});db[_0x2b18('0x7b')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'as':_0x2b18('0x195'),'foreignKey':_0x2b18('0x116')});db['CmHopper']['belongsTo'](db[_0x2b18('0x1c')],{'as':_0x2b18('0x1a1'),'foreignKey':_0x2b18('0x14e'),'onDelete':_0x2b18('0x11b')});db['CmHopper'][_0x2b18('0x155')](db[_0x2b18('0xee')],{'as':_0x2b18('0xee'),'foreignKey':_0x2b18('0x1a2'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x7b')][_0x2b18('0x155')](db['User'],{'as':_0x2b18('0x170'),'foreignKey':'OwnerId'});db[_0x2b18('0x151')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':_0x2b18('0x17a'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x151')]['belongsTo'](db['CmList'],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x151')]['belongsTo'](db['VoiceQueue'],{'as':_0x2b18('0x1a1'),'foreignKey':_0x2b18('0x14e'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x151')]['belongsTo'](db[_0x2b18('0xee')],{'as':_0x2b18('0xee'),'foreignKey':_0x2b18('0x1a2'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x87')][_0x2b18('0x117')](db[_0x2b18('0x8d')],{'as':{'plural':_0x2b18('0x1a3'),'singular':_0x2b18('0x1a4')},'foreignKey':_0x2b18('0x1a5'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x2b18('0x117')](db[_0x2b18('0x8d')],{'as':{'plural':_0x2b18('0x1a6'),'singular':_0x2b18('0x1a7')},'foreignKey':_0x2b18('0x1a8'),'onDelete':_0x2b18('0x11b'),'hooks':!![]});db['Automation']['hasMany'](db[_0x2b18('0x85')],{'as':_0x2b18('0x1a9'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db['Interval']['hasMany'](db['Interval'],{'as':'Intervals','foreignKey':_0x2b18('0x18e'),'onDelete':_0x2b18('0x11b'),'hooks':!![],'required':![]});db['Interval'][_0x2b18('0x117')](db[_0x2b18('0x18')],{'as':_0x2b18('0x11a'),'foreignKey':_0x2b18('0x18e'),'onDelete':_0x2b18('0x177')});db[_0x2b18('0x158')]['hasMany'](db[_0x2b18('0x4c')],{'as':_0x2b18('0x1aa'),'foreignKey':_0x2b18('0x18e')});db['Interval'][_0x2b18('0x117')](db[_0x2b18('0x6e')],{'as':'ChatApplications','foreignKey':_0x2b18('0x18e')});db[_0x2b18('0x158')]['hasMany'](db[_0x2b18('0x54')],{'as':_0x2b18('0x1ab'),'foreignKey':_0x2b18('0x18e')});db['Interval']['hasMany'](db[_0x2b18('0x185')],{'as':_0x2b18('0x1ac'),'foreignKey':_0x2b18('0x18e')});db['Schedule']['belongsTo'](db[_0x2b18('0x42')],{});db['Schedule'][_0x2b18('0x155')](db[_0x2b18('0xa4')],{'foreignKey':_0x2b18('0x1ad')});db[_0x2b18('0x1ae')]['belongsTo'](db[_0x2b18('0xa2')],{'foreignKey':'CustomReportId'});db[_0x2b18('0x96')][_0x2b18('0x127')](db[_0x2b18('0x1a')],{'as':_0x2b18('0x1af'),'through':_0x2b18('0x14c'),'onDelete':_0x2b18('0x177')});db[_0x2b18('0x178')]['belongsToMany'](db[_0x2b18('0x7a')],{'through':_0x2b18('0x1a0')});db[_0x2b18('0x178')][_0x2b18('0x127')](db[_0x2b18('0x70')],{'through':_0x2b18('0x197')});db[_0x2b18('0x178')][_0x2b18('0x127')](db[_0x2b18('0x48')],{'through':'mail_interaction_has_tags'});db[_0x2b18('0x178')][_0x2b18('0x127')](db['SmsInteraction'],{'through':_0x2b18('0x188')});db[_0x2b18('0x178')]['belongsToMany'](db[_0x2b18('0x56')],{'through':_0x2b18('0x181')});db[_0x2b18('0x178')][_0x2b18('0x127')](db[_0x2b18('0x68')],{'through':_0x2b18('0x18f')});db[_0x2b18('0x178')][_0x2b18('0x127')](db[_0x2b18('0x109')],{'through':_0x2b18('0x1b0')});db[_0x2b18('0x9a')][_0x2b18('0x117')](db[_0x2b18('0x8d')],{'as':{'plural':_0x2b18('0x1b1'),'singular':_0x2b18('0x1b2')},'foreignKey':_0x2b18('0x1b3'),'onDelete':_0x2b18('0x11b'),'hooks':!![]});db[_0x2b18('0x9a')][_0x2b18('0x117')](db[_0x2b18('0x8d')],{'as':{'plural':'AnyConditions','singular':_0x2b18('0x1b4')},'foreignKey':'TriggerAnyId','onDelete':_0x2b18('0x11b'),'hooks':!![]});db[_0x2b18('0x9a')][_0x2b18('0x117')](db[_0x2b18('0x85')],{'as':'Actions','foreignKey':_0x2b18('0x1b5'),'onDelete':_0x2b18('0x11b'),'hooks':!![]});db[_0x2b18('0xa2')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x2b18('0x1b6'),'onDelete':'cascade','foreignKey':_0x2b18('0x1b7'),'hooks':!![]});db['AnalyticDefaultReport'][_0x2b18('0x117')](db[_0x2b18('0xa9')],{'as':'Fields','onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1ad')});db[_0x2b18('0x1b8')][_0x2b18('0x117')](db[_0x2b18('0xa9')],{'as':_0x2b18('0x1b6'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1b9')});db[_0x2b18('0xa9')]['belongsTo'](db[_0x2b18('0x1b8')],{'foreignKey':_0x2b18('0x1b9')});db[_0x2b18('0xac')]['hasMany'](db[_0x2b18('0x1ba')],{'as':_0x2b18('0x1bb'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0x1ba')][_0x2b18('0x117')](db[_0x2b18('0x1bd')],{'as':_0x2b18('0x1be'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0x1ba')][_0x2b18('0x117')](db[_0x2b18('0x1bd')],{'as':_0x2b18('0x1c0'),'onDelete':_0x2b18('0x11b'),'foreignKey':'DescriptionId'});db[_0x2b18('0x1ba')][_0x2b18('0x117')](db[_0x2b18('0x1bd')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x2b18('0x1ba')][_0x2b18('0x155')](db[_0x2b18('0xac')],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0x1bd')]['hasMany'](db[_0x2b18('0x1bd')],{'as':_0x2b18('0x1c1'),'foreignKey':_0x2b18('0x1bf')});db['SalesforceField']['hasMany'](db[_0x2b18('0x1bd')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x2b18('0x1bd')][_0x2b18('0x117')](db['SalesforceField'],{'as':'Field','foreignKey':_0x2b18('0x1c2')});db['SalesforceField'][_0x2b18('0x155')](db[_0x2b18('0x9c')],{'as':'Variable','foreignKey':_0x2b18('0x1c3')});db['SugarcrmAccount'][_0x2b18('0x117')](db[_0x2b18('0xb1')],{'as':_0x2b18('0x1bb'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0xb1')]['hasMany'](db['SugarcrmField'],{'as':_0x2b18('0x1be'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x2b18('0xb1')][_0x2b18('0x117')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x2b18('0x11b'),'foreignKey':'DescriptionId'});db[_0x2b18('0xb1')][_0x2b18('0x117')](db[_0x2b18('0x1c4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2b18('0x1c2')});db['SugarcrmConfiguration'][_0x2b18('0x155')](db['SugarcrmAccount'],{'as':_0x2b18('0x16f'),'foreignKey':'AccountId'});db[_0x2b18('0x1c4')]['hasMany'](db[_0x2b18('0x1c4')],{'as':'Subject','foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0x1c4')][_0x2b18('0x117')](db['SugarcrmField'],{'as':_0x2b18('0x1c5'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0x2b18('0x117')](db[_0x2b18('0x1c4')],{'as':'Field','foreignKey':_0x2b18('0x1c2')});db['SugarcrmField'][_0x2b18('0x155')](db['Variable'],{'as':'Variable','foreignKey':_0x2b18('0x1c3')});db[_0x2b18('0x1c6')][_0x2b18('0x117')](db[_0x2b18('0xb5')],{'as':_0x2b18('0x1bb'),'onDelete':_0x2b18('0x11b'),'foreignKey':'AccountId'});db[_0x2b18('0xb5')][_0x2b18('0x117')](db[_0x2b18('0xb7')],{'as':_0x2b18('0x1be'),'onDelete':'cascade','foreignKey':_0x2b18('0x1bf')});db['DeskConfiguration'][_0x2b18('0x117')](db['DeskField'],{'as':'Descriptions','onDelete':_0x2b18('0x11b'),'foreignKey':'DescriptionId'});db[_0x2b18('0xb5')][_0x2b18('0x117')](db['DeskField'],{'as':_0x2b18('0x1b6'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1c2')});db['DeskConfiguration'][_0x2b18('0x155')](db[_0x2b18('0x1c6')],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0xb5')]['belongsToMany'](db['Tag'],{'through':_0x2b18('0x1c7')});db[_0x2b18('0xb7')]['hasMany'](db['DeskField'],{'as':_0x2b18('0x1c1'),'foreignKey':'SubjectId'});db[_0x2b18('0xb7')][_0x2b18('0x117')](db[_0x2b18('0xb7')],{'as':_0x2b18('0x1c5'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0xb7')]['hasMany'](db[_0x2b18('0xb7')],{'as':'Field','foreignKey':'FieldId'});db['DeskField'][_0x2b18('0x155')](db[_0x2b18('0x9c')],{'as':_0x2b18('0x9c'),'foreignKey':_0x2b18('0x1c3')});db[_0x2b18('0xb9')]['hasMany'](db[_0x2b18('0xbb')],{'as':_0x2b18('0x1bb'),'onDelete':'cascade','foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0xbb')][_0x2b18('0x117')](db['ZohoField'],{'as':_0x2b18('0x1be'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0xbb')][_0x2b18('0x117')](db[_0x2b18('0xbc')],{'as':_0x2b18('0x1c0'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1c8')});db['ZohoConfiguration'][_0x2b18('0x117')](db[_0x2b18('0xbc')],{'as':_0x2b18('0x1b6'),'onDelete':'cascade','foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0xbb')][_0x2b18('0x155')](db[_0x2b18('0xb9')],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0xbc')][_0x2b18('0x117')](db[_0x2b18('0xbc')],{'as':_0x2b18('0x1c1'),'foreignKey':'SubjectId'});db[_0x2b18('0xbc')]['hasMany'](db[_0x2b18('0xbc')],{'as':_0x2b18('0x1c5'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0xbc')]['hasMany'](db[_0x2b18('0xbc')],{'as':_0x2b18('0x1c9'),'foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0xbc')][_0x2b18('0x155')](db[_0x2b18('0x9c')],{'as':_0x2b18('0x9c'),'foreignKey':_0x2b18('0x1c3')});db['ZendeskAccount'][_0x2b18('0x117')](db[_0x2b18('0x1ca')],{'as':_0x2b18('0x1bb'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0x1ca')][_0x2b18('0x117')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0x1ca')]['hasMany'](db[_0x2b18('0xc1')],{'as':_0x2b18('0x1c0'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0x1ca')]['hasMany'](db[_0x2b18('0xc1')],{'as':'Fields','foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0x1ca')][_0x2b18('0x155')](db['ZendeskAccount'],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x1bc')});db['ZendeskConfiguration']['belongsToMany'](db[_0x2b18('0x178')],{'through':'int_zendesk_configuration_has_tags'});db[_0x2b18('0xc1')][_0x2b18('0x117')](db['ZendeskField'],{'as':_0x2b18('0x1c1'),'foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0xc1')]['hasMany'](db[_0x2b18('0xc1')],{'as':_0x2b18('0x1c5'),'foreignKey':_0x2b18('0x1c8')});db['ZendeskField']['hasMany'](db[_0x2b18('0xc1')],{'as':'Field','foreignKey':_0x2b18('0x1c2')});db['ZendeskField'][_0x2b18('0x155')](db[_0x2b18('0x9c')],{'as':'Variable','foreignKey':_0x2b18('0x1c3')});db[_0x2b18('0xc2')][_0x2b18('0x117')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0x1cb')][_0x2b18('0x117')](db['FreshdeskField'],{'as':_0x2b18('0x1be'),'onDelete':'cascade','foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0x1cb')][_0x2b18('0x117')](db['FreshdeskField'],{'as':_0x2b18('0x1c0'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0x1cb')]['hasMany'](db[_0x2b18('0xc5')],{'as':'Fields','onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0x1cb')][_0x2b18('0x155')](db[_0x2b18('0xc2')],{'as':_0x2b18('0x16f'),'foreignKey':'AccountId'});db[_0x2b18('0x1cb')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':_0x2b18('0x1cc')});db[_0x2b18('0xc5')][_0x2b18('0x117')](db[_0x2b18('0xc5')],{'as':'Subject','foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0xc5')][_0x2b18('0x117')](db['FreshdeskField'],{'as':_0x2b18('0x1c5'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0xc5')][_0x2b18('0x117')](db['FreshdeskField'],{'as':_0x2b18('0x1c9'),'foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0xc5')]['belongsTo'](db[_0x2b18('0x9c')],{'as':'Variable','foreignKey':_0x2b18('0x1c3')});db['VtigerAccount']['hasMany'](db[_0x2b18('0x1cd')],{'as':'Configurations','onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0x1cd')]['hasMany'](db[_0x2b18('0x1ce')],{'as':_0x2b18('0x1be'),'foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0x1cd')][_0x2b18('0x117')](db[_0x2b18('0x1ce')],{'as':_0x2b18('0x1c0'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0x1cd')][_0x2b18('0x117')](db[_0x2b18('0x1ce')],{'as':_0x2b18('0x1b6'),'foreignKey':_0x2b18('0x1c2')});db['VtigerConfiguration'][_0x2b18('0x155')](db['VtigerAccount'],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0x1ce')][_0x2b18('0x117')](db[_0x2b18('0x1ce')],{'as':_0x2b18('0x1c1'),'foreignKey':_0x2b18('0x1bf')});db['VtigerField'][_0x2b18('0x117')](db[_0x2b18('0x1ce')],{'as':_0x2b18('0x1c5'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0x1ce')]['hasMany'](db[_0x2b18('0x1ce')],{'as':_0x2b18('0x1c9'),'foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0x1ce')][_0x2b18('0x155')](db[_0x2b18('0x9c')],{'as':_0x2b18('0x9c'),'foreignKey':'VariableId'});db[_0x2b18('0xcb')][_0x2b18('0x117')](db[_0x2b18('0x1cf')],{'as':_0x2b18('0x1bb'),'onDelete':'cascade','foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0x1cf')]['hasMany'](db[_0x2b18('0xcd')],{'as':_0x2b18('0x1be'),'foreignKey':_0x2b18('0x1bf')});db['ServicenowConfiguration'][_0x2b18('0x117')](db[_0x2b18('0xcd')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x2b18('0x1cf')][_0x2b18('0x117')](db[_0x2b18('0xcd')],{'as':_0x2b18('0x1b6'),'foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0x1cf')][_0x2b18('0x155')](db['ServicenowAccount'],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0xcd')][_0x2b18('0x117')](db[_0x2b18('0xcd')],{'as':_0x2b18('0x1c1'),'foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0xcd')][_0x2b18('0x117')](db[_0x2b18('0xcd')],{'as':_0x2b18('0x1c5'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0xcd')][_0x2b18('0x117')](db[_0x2b18('0xcd')],{'as':_0x2b18('0x1c9'),'foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0xcd')][_0x2b18('0x155')](db[_0x2b18('0x9c')],{'as':_0x2b18('0x9c'),'foreignKey':'VariableId'});db[_0x2b18('0xcf')]['hasMany'](db[_0x2b18('0xd0')],{'as':_0x2b18('0x1bb'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1bc')});db[_0x2b18('0xd0')][_0x2b18('0x117')](db[_0x2b18('0xd2')],{'as':_0x2b18('0x1be'),'onDelete':_0x2b18('0x11b'),'foreignKey':'SubjectId'});db[_0x2b18('0xd0')][_0x2b18('0x117')](db[_0x2b18('0xd2')],{'as':_0x2b18('0x1c0'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0xd0')][_0x2b18('0x117')](db['Dynamics365Field'],{'as':_0x2b18('0x1b6'),'onDelete':'cascade','foreignKey':_0x2b18('0x1c2')});db[_0x2b18('0xd0')]['belongsTo'](db[_0x2b18('0xcf')],{'as':_0x2b18('0x16f'),'foreignKey':_0x2b18('0x1bc')});db['Dynamics365Field'][_0x2b18('0x117')](db['Dynamics365Field'],{'as':_0x2b18('0x1c1'),'foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0xd2')][_0x2b18('0x117')](db[_0x2b18('0xd2')],{'as':'Description','foreignKey':_0x2b18('0x1c8')});db[_0x2b18('0xd2')]['hasMany'](db[_0x2b18('0xd2')],{'as':_0x2b18('0x1c9'),'foreignKey':'FieldId'});db[_0x2b18('0xd2')][_0x2b18('0x155')](db[_0x2b18('0x9c')],{'as':_0x2b18('0x9c'),'foreignKey':_0x2b18('0x1c3')});db[_0x2b18('0xd4')][_0x2b18('0x117')](db[_0x2b18('0xd5')],{'as':_0x2b18('0x1bb'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2b18('0xd5')][_0x2b18('0x117')](db[_0x2b18('0xd7')],{'as':_0x2b18('0x1be'),'foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0xd5')][_0x2b18('0x117')](db['FreshsalesField'],{'as':_0x2b18('0x1c0'),'foreignKey':_0x2b18('0x1c8')});db['FreshsalesConfiguration'][_0x2b18('0x117')](db[_0x2b18('0xd7')],{'as':_0x2b18('0x1b6'),'foreignKey':'FieldId'});db[_0x2b18('0xd5')]['belongsTo'](db[_0x2b18('0xd4')],{'as':'Account','foreignKey':_0x2b18('0x1bc')});db['FreshsalesField'][_0x2b18('0x117')](db['FreshsalesField'],{'as':_0x2b18('0x1c1'),'foreignKey':_0x2b18('0x1bf')});db[_0x2b18('0xd7')][_0x2b18('0x117')](db[_0x2b18('0xd7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x2b18('0xd7')][_0x2b18('0x117')](db[_0x2b18('0xd7')],{'as':_0x2b18('0x1c9'),'foreignKey':'FieldId'});db[_0x2b18('0xd7')][_0x2b18('0x155')](db[_0x2b18('0x9c')],{'as':_0x2b18('0x9c'),'foreignKey':_0x2b18('0x1c3')});db[_0x2b18('0xda')][_0x2b18('0x155')](db[_0x2b18('0x191')],{});db[_0x2b18('0xda')]['belongsTo'](db[_0x2b18('0xfa')],{'as':'List','foreignKey':_0x2b18('0x16a')});db['ChatQueueReport'][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'as':_0x2b18('0x164'),'foreignKey':_0x2b18('0x17a')});db[_0x2b18('0xda')]['belongsTo'](db[_0x2b18('0x70')],{});db[_0x2b18('0xda')][_0x2b18('0x155')](db[_0x2b18('0x72')],{});db[_0x2b18('0xda')]['belongsTo'](db[_0x2b18('0x12')],{});db[_0x2b18('0xda')][_0x2b18('0x155')](db[_0x2b18('0x73')],{});db[_0x2b18('0x19b')]['belongsTo'](db[_0x2b18('0x12')],{'onDelete':'cascade','foreignKey':_0x2b18('0x1d0')});db['ChatInternalMessage'][_0x2b18('0x155')](db['User'],{'onDelete':'cascade','foreignKey':_0x2b18('0x1d1')});db['JscriptySessionReport'][_0x2b18('0x117')](db[_0x2b18('0xdf')],{'foreignKey':_0x2b18('0x1d2'),'onDelete':_0x2b18('0x11b')});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x2b18('0x1d2'),'onDelete':_0x2b18('0x11b')});db[_0x2b18('0x1d3')][_0x2b18('0x155')](db[_0x2b18('0x5d')],{});db[_0x2b18('0x1d3')]['belongsTo'](db[_0x2b18('0xfa')],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0x1d3')]['belongsTo'](db[_0x2b18('0x7a')],{'as':'Contact','foreignKey':_0x2b18('0x17a')});db[_0x2b18('0x1d3')][_0x2b18('0x155')](db[_0x2b18('0x184')],{});db[_0x2b18('0x1d3')][_0x2b18('0x155')](db['SmsMessage'],{});db['SmsQueueReport'][_0x2b18('0x155')](db[_0x2b18('0x12')],{});db[_0x2b18('0x1d3')][_0x2b18('0x155')](db[_0x2b18('0x63')],{});db[_0x2b18('0xe5')][_0x2b18('0x117')](db['JscriptySessionReport'],{'foreignKey':_0x2b18('0x1d4')});db[_0x2b18('0xe5')]['hasMany'](db[_0x2b18('0xdf')],{'foreignKey':_0x2b18('0x1d4')});db['JscriptyProject']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x2b18('0xea')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x174'),'through':_0x2b18('0x146')});db['Team'][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':'user_has_teams'});db[_0x2b18('0x12d')][_0x2b18('0x127')](db[_0x2b18('0x1c')],{'through':_0x2b18('0x15b'),'as':_0x2b18('0x135')});db[_0x2b18('0x12d')][_0x2b18('0x127')](db[_0x2b18('0x44')],{'through':_0x2b18('0x16d'),'as':_0x2b18('0x137')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0x2b18('0x19a'),'as':_0x2b18('0x138')});db[_0x2b18('0x12d')][_0x2b18('0x127')](db[_0x2b18('0x5a')],{'through':_0x2b18('0x182'),'as':_0x2b18('0x139')});db['Team'][_0x2b18('0x127')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0x2b18('0x13a')});db[_0x2b18('0x12d')]['belongsToMany'](db[_0x2b18('0x6a')],{'through':_0x2b18('0x1d5'),'as':_0x2b18('0x13b')});db[_0x2b18('0x12d')][_0x2b18('0x127')](db['WhatsappQueue'],{'through':_0x2b18('0x1d6'),'as':_0x2b18('0x13c')});db['Campaign'][_0x2b18('0x117')](db[_0x2b18('0x7b')],{'as':_0x2b18('0x14f'),'foreignKey':_0x2b18('0x1a2')});db['Campaign'][_0x2b18('0x117')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2b18('0x1a2')});db[_0x2b18('0xee')]['hasMany'](db[_0x2b18('0x11d')],{'as':_0x2b18('0x150'),'foreignKey':'CampaignId'});db[_0x2b18('0xee')]['hasMany'](db[_0x2b18('0x151')],{'as':_0x2b18('0x152'),'foreignKey':_0x2b18('0x1a2')});db[_0x2b18('0xee')]['belongsTo'](db[_0x2b18('0x2e')],{'as':_0x2b18('0x2e'),'foreignKey':_0x2b18('0x154')});db[_0x2b18('0xee')][_0x2b18('0x155')](db[_0x2b18('0x2e')],{'as':'TrunkBackup','foreignKey':_0x2b18('0x157')});db['Campaign']['belongsTo'](db[_0x2b18('0x158')],{'as':_0x2b18('0x158'),'foreignKey':'IntervalId'});db[_0x2b18('0xee')][_0x2b18('0x155')](db[_0x2b18('0xea')],{'as':_0x2b18('0xea'),'foreignKey':_0x2b18('0x1d7')});db[_0x2b18('0xee')][_0x2b18('0x127')](db[_0x2b18('0xfa')],{'as':_0x2b18('0x12b'),'through':_0x2b18('0x1d8')});db[_0x2b18('0xee')][_0x2b18('0x127')](db[_0x2b18('0xfa')],{'as':_0x2b18('0x1d9'),'through':'campaigns_has_cm_blacklists'});db[_0x2b18('0xf4')][_0x2b18('0x155')](db[_0x2b18('0x4a')],{});db['MailTransferReport']['belongsTo'](db[_0x2b18('0x48')],{});db[_0x2b18('0xf4')][_0x2b18('0x155')](db['MailAccount'],{'foreignKey':_0x2b18('0x1da'),'as':_0x2b18('0x1db')});db[_0x2b18('0xf4')]['belongsTo'](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dc'),'as':'FromAgent'});db[_0x2b18('0xf4')]['belongsTo'](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dd'),'as':'ToAgent'});db[_0x2b18('0xf4')][_0x2b18('0x155')](db[_0x2b18('0x44')],{'foreignKey':'ToMailQueueId','as':_0x2b18('0x1de')});db[_0x2b18('0xf4')][_0x2b18('0x155')](db['MailAccount'],{'foreignKey':_0x2b18('0x1df'),'as':_0x2b18('0x1e0')});db[_0x2b18('0xf5')][_0x2b18('0x155')](db[_0x2b18('0x72')],{});db[_0x2b18('0xf5')][_0x2b18('0x155')](db[_0x2b18('0x70')],{});db[_0x2b18('0xf5')][_0x2b18('0x155')](db[_0x2b18('0x191')],{'foreignKey':_0x2b18('0x1e1'),'as':'FromAccount'});db[_0x2b18('0xf5')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dc'),'as':_0x2b18('0x1e2')});db[_0x2b18('0xf5')]['belongsTo'](db['User'],{'foreignKey':_0x2b18('0x1dd'),'as':_0x2b18('0x1e3')});db[_0x2b18('0xf5')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x2b18('0x1e4'),'as':_0x2b18('0x1de')});db[_0x2b18('0xf5')]['belongsTo'](db[_0x2b18('0x191')],{'foreignKey':'ToChatWebsiteId','as':_0x2b18('0x1e0')});db[_0x2b18('0xf7')][_0x2b18('0x155')](db[_0x2b18('0x58')],{});db[_0x2b18('0xf7')][_0x2b18('0x155')](db[_0x2b18('0x56')],{});db['FaxTransferReport'][_0x2b18('0x155')](db[_0x2b18('0x53')],{'foreignKey':_0x2b18('0x1e5'),'as':_0x2b18('0x1db')});db[_0x2b18('0xf7')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dc'),'as':_0x2b18('0x1e2')});db[_0x2b18('0xf7')][_0x2b18('0x155')](db['User'],{'foreignKey':_0x2b18('0x1dd'),'as':_0x2b18('0x1e3')});db[_0x2b18('0xf7')]['belongsTo'](db[_0x2b18('0x5a')],{'foreignKey':_0x2b18('0x1e6'),'as':_0x2b18('0x1de')});db['FaxTransferReport'][_0x2b18('0x155')](db[_0x2b18('0x53')],{'foreignKey':_0x2b18('0x1e7'),'as':_0x2b18('0x1e0')});db['OpenchannelTransferReport']['belongsTo'](db[_0x2b18('0x18b')],{});db[_0x2b18('0xf9')]['belongsTo'](db[_0x2b18('0x68')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x2b18('0x65')],{'foreignKey':_0x2b18('0x1e8'),'as':'FromAccount'});db[_0x2b18('0xf9')]['belongsTo'](db[_0x2b18('0x12')],{'foreignKey':'FromUserId','as':_0x2b18('0x1e2')});db[_0x2b18('0xf9')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dd'),'as':_0x2b18('0x1e3')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x2b18('0x1e9'),'as':_0x2b18('0x1de')});db[_0x2b18('0xf9')][_0x2b18('0x155')](db[_0x2b18('0x65')],{'foreignKey':_0x2b18('0x1ea'),'as':_0x2b18('0x1e0')});db['SmsTransferReport'][_0x2b18('0x155')](db[_0x2b18('0x61')],{});db['SmsTransferReport'][_0x2b18('0x155')](db['SmsInteraction'],{});db[_0x2b18('0x1eb')][_0x2b18('0x155')](db[_0x2b18('0x5d')],{'foreignKey':_0x2b18('0x1ec'),'as':_0x2b18('0x1db')});db['SmsTransferReport']['belongsTo'](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dc'),'as':_0x2b18('0x1e2')});db[_0x2b18('0x1eb')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dd'),'as':'ToAgent'});db[_0x2b18('0x1eb')][_0x2b18('0x155')](db['SmsQueue'],{'foreignKey':_0x2b18('0x1ed'),'as':'ToQueue'});db[_0x2b18('0x1eb')][_0x2b18('0x155')](db[_0x2b18('0x5d')],{'foreignKey':_0x2b18('0x1ee'),'as':_0x2b18('0x1e0')});db['CmList'][_0x2b18('0x117')](db[_0x2b18('0x8b')],{'as':_0x2b18('0x17c'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0xfa')][_0x2b18('0x117')](db[_0x2b18('0x83')],{'as':_0x2b18('0x1ef'),'foreignKey':'ListId'});db['CmList'][_0x2b18('0x117')](db['CmContact'],{'as':_0x2b18('0x129'),'onDelete':_0x2b18('0x11b'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0xfa')][_0x2b18('0x117')](db[_0x2b18('0x7e')],{'as':_0x2b18('0x11c'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0xfa')][_0x2b18('0x117')](db['CmHopperHistory'],{'as':_0x2b18('0x11e'),'foreignKey':_0x2b18('0x16a')});db[_0x2b18('0xfa')][_0x2b18('0x117')](db[_0x2b18('0x81')],{'as':_0x2b18('0x81'),'foreignKey':'ListId'});db[_0x2b18('0xfa')][_0x2b18('0x127')](db[_0x2b18('0x1c')],{'as':_0x2b18('0x1f0'),'through':'voice_queues_has_cm_lists'});db[_0x2b18('0xfa')]['belongsToMany'](db[_0x2b18('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x2b18('0xfc')][_0x2b18('0x117')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0x2b18('0xfc')][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':_0x2b18('0x1f1')});db[_0x2b18('0xfe')][_0x2b18('0x117')](db[_0x2b18('0x12')],{'as':_0x2b18('0x174'),'foreignKey':_0x2b18('0x1f2')});db[_0x2b18('0xfe')][_0x2b18('0x117')](db[_0x2b18('0x100')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x2b18('0x11b')});db[_0x2b18('0x100')]['hasMany'](db[_0x2b18('0x102')],{'as':'Resources','foreignKey':_0x2b18('0x1f3'),'onDelete':'cascade'});db[_0x2b18('0x105')][_0x2b18('0x117')](db['Disposition'],{'as':_0x2b18('0x17c'),'foreignKey':_0x2b18('0x1f4')});db[_0x2b18('0x105')][_0x2b18('0x117')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x2b18('0x1f4')});db[_0x2b18('0x105')][_0x2b18('0x117')](db['WhatsappMessage'],{'as':_0x2b18('0x15e'),'foreignKey':_0x2b18('0x1f4')});db['WhatsappAccount']['hasMany'](db[_0x2b18('0x109')],{'as':_0x2b18('0x168')});db['WhatsappAccount']['hasMany'](db['WhatsappApplication'],{'as':_0x2b18('0x14a')});db[_0x2b18('0x105')][_0x2b18('0x155')](db[_0x2b18('0xfa')],{'as':'List','foreignKey':'ListId'});db[_0x2b18('0x105')]['belongsTo'](db[_0x2b18('0x90')],{'as':_0x2b18('0x18c'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount']['belongsToMany'](db[_0x2b18('0x12')],{'as':_0x2b18('0x159'),'through':'user_has_whatsapp_accounts'});db[_0x2b18('0x107')]['belongsTo'](db[_0x2b18('0x12')],{'onDelete':_0x2b18('0x177')});db['WhatsappApplication'][_0x2b18('0x155')](db[_0x2b18('0x110')],{'onDelete':_0x2b18('0x177')});db['WhatsappApplication'][_0x2b18('0x155')](db['WhatsappAccount'],{'onDelete':_0x2b18('0x177')});db[_0x2b18('0x107')]['belongsTo'](db[_0x2b18('0x158')],{'onDelete':_0x2b18('0x177'),'foreignKey':_0x2b18('0x18e')});db[_0x2b18('0x107')][_0x2b18('0x155')](db[_0x2b18('0x178')],{'onDelete':'restrict','foreignKey':_0x2b18('0x179')});db[_0x2b18('0x109')][_0x2b18('0x117')](db[_0x2b18('0x10a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2b18('0x1f5')});db[_0x2b18('0x109')][_0x2b18('0x155')](db[_0x2b18('0x105')],{'as':_0x2b18('0x16f'),'foreignKey':'WhatsappAccountId'});db[_0x2b18('0x109')][_0x2b18('0x155')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappInteraction']['belongsTo'](db[_0x2b18('0x12')],{'as':_0x2b18('0x170'),'foreignKey':_0x2b18('0x116')});db[_0x2b18('0x109')][_0x2b18('0x127')](db[_0x2b18('0x178')],{'through':_0x2b18('0x1b0'),'as':'Tags'});db[_0x2b18('0x109')][_0x2b18('0x127')](db['Tag'],{'through':_0x2b18('0x1b0'),'as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db['User'],{'as':_0x2b18('0x174'),'through':'user_has_whatsapp_interactions','foreignKey':_0x2b18('0x1f5')});db['WhatsappMessage'][_0x2b18('0x155')](db[_0x2b18('0x12')],{'as':_0x2b18('0x12')});db[_0x2b18('0x10a')][_0x2b18('0x155')](db[_0x2b18('0x7a')],{'onDelete':_0x2b18('0x11b'),'as':_0x2b18('0x164')});db['WhatsappMessage'][_0x2b18('0x155')](db['WhatsappInteraction'],{'onDelete':_0x2b18('0x11b'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0x2b18('0x10a')][_0x2b18('0x155')](db[_0x2b18('0x105')],{'as':'Account','foreignKey':_0x2b18('0x1f4')});db[_0x2b18('0x10c')][_0x2b18('0x155')](db[_0x2b18('0x105')],{});db[_0x2b18('0x10c')][_0x2b18('0x155')](db['CmList'],{'as':_0x2b18('0x169'),'foreignKey':_0x2b18('0x16a')});db['WhatsappQueueReport'][_0x2b18('0x155')](db['CmContact'],{'as':_0x2b18('0x164'),'foreignKey':'ContactId'});db[_0x2b18('0x10c')][_0x2b18('0x155')](db['WhatsappInteraction'],{});db[_0x2b18('0x10c')]['belongsTo'](db[_0x2b18('0x110')],{});db[_0x2b18('0x10c')][_0x2b18('0x155')](db[_0x2b18('0x10a')],{});db[_0x2b18('0x10c')][_0x2b18('0x155')](db[_0x2b18('0x12')],{});db[_0x2b18('0x10e')][_0x2b18('0x155')](db[_0x2b18('0x10a')],{});db['WhatsappTransferReport'][_0x2b18('0x155')](db[_0x2b18('0x109')],{});db[_0x2b18('0x10e')][_0x2b18('0x155')](db[_0x2b18('0x105')],{'foreignKey':_0x2b18('0x1f6'),'as':_0x2b18('0x1db')});db[_0x2b18('0x10e')][_0x2b18('0x155')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0x2b18('0x1e0')});db[_0x2b18('0x10e')][_0x2b18('0x155')](db['WhatsappQueue'],{'foreignKey':_0x2b18('0x1f7'),'as':'ToQueue'});db[_0x2b18('0x10e')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dc'),'as':_0x2b18('0x1e2')});db[_0x2b18('0x10e')][_0x2b18('0x155')](db[_0x2b18('0x12')],{'foreignKey':_0x2b18('0x1dd'),'as':_0x2b18('0x1e3')});db['WhatsappQueue'][_0x2b18('0x127')](db[_0x2b18('0x12')],{'as':'Agents','through':_0x2b18('0x1f8'),'foreignKey':_0x2b18('0x1f9')});db[_0x2b18('0x110')][_0x2b18('0x127')](db[_0x2b18('0x12d')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0x2b18('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ad10c87..052b2c6 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07fc=['path','express','./config/environment','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','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','agent_id','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/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/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','/api/teams','./api/team','/api/license','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/webbar','/apidoc','join','root','/www','static','/demo','1.0.16','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html'];(function(_0x5bdc04,_0x33545d){var _0x3308a4=function(_0x376a39){while(--_0x376a39){_0x5bdc04['push'](_0x5bdc04['shift']());}};_0x3308a4(++_0x33545d);}(_0x07fc,0x112));var _0xc07f=function(_0x286942,_0x1e2c3c){_0x286942=_0x286942-0x0;var _0x11bd82=_0x07fc[_0x286942];return _0x11bd82;};'use strict';var path=require(_0xc07f('0x0'));var express=require(_0xc07f('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require('./errors');var config=require(_0xc07f('0x2'));var logger=require(_0xc07f('0x3'))(_0xc07f('0x4'));var authLogger=require(_0xc07f('0x3'))(_0xc07f('0x5'));exports[_0xc07f('0x6')]=function(_0x434c54){_0x434c54[_0xc07f('0x7')](ewinston[_0xc07f('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x9bfa7f,_0x805571){return util[_0xc07f('0x9')](_0xc07f('0xa'),_0x9bfa7f[_0xc07f('0xb')],_0x9bfa7f[_0xc07f('0xc')][_0xc07f('0xd')]?_0x9bfa7f[_0xc07f('0xc')][_0xc07f('0xd')]:_0x9bfa7f[_0xc07f('0xe')][_0xc07f('0xf')]||_0x9bfa7f['ip'],_0x9bfa7f[_0xc07f('0x10')],_0x805571[_0xc07f('0x11')],_0x805571[_0xc07f('0x12')],_0x9bfa7f[_0xc07f('0x13')]?_0x9bfa7f[_0xc07f('0x13')]['id']:null,_0x9bfa7f['user']?_0x9bfa7f['user'][_0xc07f('0x14')]:null,_0x9bfa7f['user']?_0x9bfa7f[_0xc07f('0x13')][_0xc07f('0x15')]:null);}}));_0x434c54[_0xc07f('0x7')](ewinston[_0xc07f('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x24360d,_0x326400){var _0x4ab82=_0xc07f('0x16');if(_0x24360d[_0xc07f('0x17')]&&_0x24360d[_0xc07f('0x17')][_0xc07f('0x18')]&&_0x24360d[_0xc07f('0x17')][_0xc07f('0x19')]){_0x4ab82='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x4ab82,_0x24360d['method'],_0x24360d[_0xc07f('0xc')][_0xc07f('0xd')]?_0x24360d[_0xc07f('0xc')][_0xc07f('0xd')]:_0x24360d[_0xc07f('0xe')]['remoteAddress']||_0x24360d['ip'],_0x24360d[_0xc07f('0x10')],_0x326400['statusCode'],_0x326400[_0xc07f('0x12')],_0x24360d[_0xc07f('0x13')]?_0x24360d[_0xc07f('0x13')]['id']:null,_0x24360d[_0xc07f('0x13')]?_0x24360d[_0xc07f('0x13')][_0xc07f('0x14')]:null,_0x24360d[_0xc07f('0x13')]?_0x24360d['user']['role']:null,_0x24360d[_0xc07f('0x17')]&&_0x24360d[_0xc07f('0x17')][_0xc07f('0x18')]?_0x24360d[_0xc07f('0x17')][_0xc07f('0x18')]:_0xc07f('0x1a'),_0x24360d[_0xc07f('0x17')]&&_0x24360d['body'][_0xc07f('0x19')]?_0x24360d[_0xc07f('0x17')][_0xc07f('0x19')]:'',_0x24360d[_0xc07f('0x17')]&&_0x24360d[_0xc07f('0x17')][_0xc07f('0x1b')]?_0x24360d[_0xc07f('0x17')][_0xc07f('0x1b')]:'');},'ignoreRoute':function(_0x5584ae){var _0x40b3be=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x40b3be[_0xc07f('0x1c')](_0x5584ae[_0xc07f('0x10')]);}}));_0x434c54[_0xc07f('0x7')](_0xc07f('0x1d'),require(_0xc07f('0x1e')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x1f'),require(_0xc07f('0x20')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x21'),require(_0xc07f('0x22')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x23'),require(_0xc07f('0x24')));_0x434c54['use'](_0xc07f('0x25'),require(_0xc07f('0x26')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x27'),require(_0xc07f('0x28')));_0x434c54[_0xc07f('0x7')]('/api/voice/recordings',require('./api/voiceRecording'));_0x434c54[_0xc07f('0x7')]('/api/screen/recordings',require(_0xc07f('0x29')));_0x434c54[_0xc07f('0x7')]('/api/voice/mails',require(_0xc07f('0x2a')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x2b'),require(_0xc07f('0x2c')));_0x434c54[_0xc07f('0x7')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x2d'),require(_0xc07f('0x2e')));_0x434c54[_0xc07f('0x7')]('/api/voice/agents/reports',require(_0xc07f('0x2f')));_0x434c54[_0xc07f('0x7')]('/api/voice/queues/reports',require(_0xc07f('0x30')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x31'),require(_0xc07f('0x32')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x33'),require('./api/trunk'));_0x434c54[_0xc07f('0x7')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x34'),require(_0xc07f('0x35')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x36'),require('./api/mailAccount'));_0x434c54['use'](_0xc07f('0x37'),require(_0xc07f('0x38')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x39'),require(_0xc07f('0x3a')));_0x434c54['use']('/api/mail/interactions',require(_0xc07f('0x3b')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x3c'),require(_0xc07f('0x3d')));_0x434c54['use'](_0xc07f('0x3e'),require(_0xc07f('0x3f')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x40'),require('./api/mailQueueReport'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x41'),require('./api/dashboard'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x42'),require(_0xc07f('0x43')));_0x434c54['use']('/api/fax/accounts',require('./api/faxAccount'));_0x434c54[_0xc07f('0x7')]('/api/fax/applications',require(_0xc07f('0x44')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x45'),require(_0xc07f('0x46')));_0x434c54[_0xc07f('0x7')]('/api/fax/messages',require(_0xc07f('0x47')));_0x434c54[_0xc07f('0x7')]('/api/fax/queues',require(_0xc07f('0x48')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x49'),require(_0xc07f('0x4a')));_0x434c54['use'](_0xc07f('0x4b'),require(_0xc07f('0x4c')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x4d'),require(_0xc07f('0x4e')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x4f'),require(_0xc07f('0x50')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x51'),require(_0xc07f('0x52')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x53'),require(_0xc07f('0x54')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x55'),require(_0xc07f('0x56')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x57'),require(_0xc07f('0x58')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x59'),require(_0xc07f('0x5a')));_0x434c54['use'](_0xc07f('0x5b'),require(_0xc07f('0x5c')));_0x434c54['use']('/api/openchannel/queues',require(_0xc07f('0x5d')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x5e'),require(_0xc07f('0x5f')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x60'),require('./api/openchannelQueueReport'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x61'),require(_0xc07f('0x62')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x63'),require(_0xc07f('0x64')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x65'),require('./api/chatMessage'));_0x434c54[_0xc07f('0x7')]('/api/chat/offline_messages',require(_0xc07f('0x66')));_0x434c54['use'](_0xc07f('0x67'),require('./api/chatQueue'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x68'),require(_0xc07f('0x69')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x6a'),require(_0xc07f('0x6b')));_0x434c54[_0xc07f('0x7')]('/api/cm/companies',require(_0xc07f('0x6c')));_0x434c54['use'](_0xc07f('0x6d'),require(_0xc07f('0x6e')));_0x434c54[_0xc07f('0x7')]('/api/cm/hopper',require(_0xc07f('0x6f')));_0x434c54[_0xc07f('0x7')]('/api/cm/hopper_black',require(_0xc07f('0x70')));_0x434c54['use']('/api/cm/hopper_final',require(_0xc07f('0x71')));_0x434c54['use'](_0xc07f('0x72'),require(_0xc07f('0x73')));_0x434c54[_0xc07f('0x7')]('/api/cm/custom_fields',require(_0xc07f('0x74')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x75'),require(_0xc07f('0x76')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x77'),require(_0xc07f('0x78')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x79'),require('./api/cannedAnswer'));_0x434c54['use']('/api/dispositions',require('./api/disposition'));_0x434c54['use'](_0xc07f('0x7a'),require(_0xc07f('0x7b')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x7c'),require(_0xc07f('0x7d')));_0x434c54[_0xc07f('0x7')]('/api/pauses',require('./api/pause'));_0x434c54['use'](_0xc07f('0x7e'),require('./api/cdr'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x7f'),require(_0xc07f('0x80')));_0x434c54[_0xc07f('0x7')]('/api/schedules',require(_0xc07f('0x81')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x82'),require(_0xc07f('0x83')));_0x434c54[_0xc07f('0x7')]('/api/tags',require('./api/tag'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x84'),require(_0xc07f('0x85')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x86'),require(_0xc07f('0x87')));_0x434c54['use'](_0xc07f('0x88'),require('./api/variable'));_0x434c54[_0xc07f('0x7')]('/api/integrations',require('./api/integration'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x89'),require(_0xc07f('0x8a')));_0x434c54[_0xc07f('0x7')]('/api/analytics/custom_reports',require(_0xc07f('0x8b')));_0x434c54['use']('/api/analytics/default_reports',require(_0xc07f('0x8c')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x8d'),require(_0xc07f('0x8e')));_0x434c54['use'](_0xc07f('0x8f'),require('./api/analyticMetric'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x90'),require(_0xc07f('0x91')));_0x434c54['use'](_0xc07f('0x92'),require(_0xc07f('0x93')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x94'),require(_0xc07f('0x95')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x96'),require(_0xc07f('0x97')));_0x434c54['use'](_0xc07f('0x98'),require(_0xc07f('0x99')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x9a'),require(_0xc07f('0x9b')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x9c'),require(_0xc07f('0x9d')));_0x434c54[_0xc07f('0x7')]('/api/integrations/sugarcrm/fields',require(_0xc07f('0x9e')));_0x434c54[_0xc07f('0x7')]('/api/integrations/desk/accounts',require(_0xc07f('0x9f')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xa0'),require(_0xc07f('0xa1')));_0x434c54['use']('/api/integrations/desk/fields',require(_0xc07f('0xa2')));_0x434c54[_0xc07f('0x7')]('/api/integrations/zoho/accounts',require(_0xc07f('0xa3')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xa4'),require(_0xc07f('0xa5')));_0x434c54['use'](_0xc07f('0xa6'),require(_0xc07f('0xa7')));_0x434c54[_0xc07f('0x7')]('/api/integrations/zendesk/accounts',require(_0xc07f('0xa8')));_0x434c54[_0xc07f('0x7')]('/api/integrations/zendesk/configurations',require(_0xc07f('0xa9')));_0x434c54['use'](_0xc07f('0xaa'),require(_0xc07f('0xab')));_0x434c54['use'](_0xc07f('0xac'),require(_0xc07f('0xad')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xae'),require('./api/intFreshdeskConfiguration'));_0x434c54[_0xc07f('0x7')](_0xc07f('0xaf'),require(_0xc07f('0xb0')));_0x434c54[_0xc07f('0x7')]('/api/integrations/vtiger/accounts',require(_0xc07f('0xb1')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xb2'),require('./api/intVtigerConfiguration'));_0x434c54[_0xc07f('0x7')](_0xc07f('0xb3'),require(_0xc07f('0xb4')));_0x434c54[_0xc07f('0x7')]('/api/integrations/servicenow/accounts',require(_0xc07f('0xb5')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xb6'),require(_0xc07f('0xb7')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xb8'),require(_0xc07f('0xb9')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xba'),require('./api/intDynamics365Account'));_0x434c54[_0xc07f('0x7')](_0xc07f('0xbb'),require(_0xc07f('0xbc')));_0x434c54[_0xc07f('0x7')]('/api/integrations/dynamics365/fields',require(_0xc07f('0xbd')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xbe'),require(_0xc07f('0xbf')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xc0'),require('./api/intFreshsalesConfiguration'));_0x434c54['use'](_0xc07f('0xc1'),require(_0xc07f('0xc2')));_0x434c54['use'](_0xc07f('0xc3'),require('./api/network'));_0x434c54[_0xc07f('0x7')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x434c54['use']('/api/chat/internal/messages',require(_0xc07f('0xc4')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xc5'),require(_0xc07f('0xc6')));_0x434c54['use'](_0xc07f('0xc7'),require(_0xc07f('0xc8')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xc9'),require(_0xc07f('0xca')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xcb'),require(_0xc07f('0xcc')));_0x434c54['use']('/api/square/reports',require('./api/squareReport'));_0x434c54['use']('/api/square/details/reports',require(_0xc07f('0xcd')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xce'),require(_0xc07f('0xcf')));_0x434c54['use']('/api/settings',require(_0xc07f('0xd0')));_0x434c54['use'](_0xc07f('0xd1'),require(_0xc07f('0xd2')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xd3'),require('./api/squareProject'));_0x434c54[_0xc07f('0x7')](_0xc07f('0xd4'),require('./api/squareRecording'));_0x434c54[_0xc07f('0x7')](_0xc07f('0xd5'),require('./api/squareMessage'));_0x434c54['use'](_0xc07f('0xd6'),require(_0xc07f('0xd7')));_0x434c54['use'](_0xc07f('0xd8'),require('./api/license'));_0x434c54[_0xc07f('0x7')]('/api/campaigns',require('./api/campaign'));_0x434c54[_0xc07f('0x7')]('/api/migrations',require(_0xc07f('0xd9')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xda'),require(_0xc07f('0xdb')));_0x434c54[_0xc07f('0x7')]('/api/plugins',require(_0xc07f('0xdc')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xdd'),require(_0xc07f('0xde')));_0x434c54[_0xc07f('0x7')]('/api/chat/reports/transfer',require(_0xc07f('0xdf')));_0x434c54['use']('/api/fax/reports/transfer',require(_0xc07f('0xe0')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xe1'),require(_0xc07f('0xe2')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xe3'),require('./api/smsTransferReport'));_0x434c54['use'](_0xc07f('0xe4'),require(_0xc07f('0xe5')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xe6'),require(_0xc07f('0xe7')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xe8'),require(_0xc07f('0xe9')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xea'),require(_0xc07f('0xeb')));_0x434c54['use'](_0xc07f('0xec'),require(_0xc07f('0xed')));_0x434c54['use'](_0xc07f('0xee'),require(_0xc07f('0xef')));_0x434c54[_0xc07f('0x7')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x434c54['use'](_0xc07f('0xf0'),require(_0xc07f('0xf1')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xf2'),require(_0xc07f('0xf3')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xf4'),require('./api/whatsappMessage'));_0x434c54[_0xc07f('0x7')](_0xc07f('0xf5'),require('./api/whatsappQueueReport'));_0x434c54['use'](_0xc07f('0xf6'),require('./api/whatsappTransferReport'));_0x434c54[_0xc07f('0x7')]('/api/whatsapp/queues',require(_0xc07f('0xf7')));_0x434c54[_0xc07f('0x7')]('/api/cloudProviders',require(_0xc07f('0xf8')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xf9'),require(_0xc07f('0xfa')));_0x434c54[_0xc07f('0x7')]('/api/auth/google',require(_0xc07f('0xfb')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xfc'),require(_0xc07f('0xfd')));_0x434c54[_0xc07f('0x7')](_0xc07f('0xfe'),require(_0xc07f('0xff')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x100'),require(_0xc07f('0x101')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x102'),require('./api/system'));_0x434c54[_0xc07f('0x7')]('/api/pm2',require('./api/pm2'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x103'),require('./api/webbar'));_0x434c54[_0xc07f('0x7')](_0xc07f('0x104'),express['static'](path[_0xc07f('0x105')](config[_0xc07f('0x106')],'/apidoc')));_0x434c54[_0xc07f('0x7')](_0xc07f('0x107'),express[_0xc07f('0x108')](path['join'](config[_0xc07f('0x106')],_0xc07f('0x107'))));_0x434c54[_0xc07f('0x7')](_0xc07f('0x109'),express[_0xc07f('0x108')](path[_0xc07f('0x105')](config['root'],_0xc07f('0x109'))));_0x434c54['use']('/snippet',express['static'](path[_0xc07f('0x105')](config[_0xc07f('0x106')],'snippet',_0xc07f('0x10a'))));_0x434c54[_0xc07f('0x7')](_0xc07f('0x10b'),express['static'](path[_0xc07f('0x105')](config['root'],_0xc07f('0x10c'))));_0x434c54[_0xc07f('0x10d')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc07f('0x10e')](errors[0x194]);_0x434c54[_0xc07f('0x10d')]('/*')[_0xc07f('0x10e')](function(_0x41aeb5,_0x5ad12e){_0x5ad12e['sendFile'](path[_0xc07f('0x10f')](_0x434c54[_0xc07f('0x10e')](_0xc07f('0x110'))+_0xc07f('0x111')));});}; \ No newline at end of file +var _0x83ed=['./api/cdr','/api/schedules','./api/schedule','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/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/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/squareOdbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','1.0.16','/plugins','/server/files/plugins','get','sendFile','resolve','appPath','/index.html','express','util','./config/environment','./config/logger','api','default','use','logger','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','name','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr'];(function(_0x12f4af,_0x4a2bb9){var _0x4c4d50=function(_0x25a7f7){while(--_0x25a7f7){_0x12f4af['push'](_0x12f4af['shift']());}};_0x4c4d50(++_0x4a2bb9);}(_0x83ed,0x1b8));var _0xd83e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x83ed[_0x1facfa];return _0x9ec701;};'use strict';var path=require('path');var express=require(_0xd83e('0x0'));var ewinston=require('express-winston');var util=require(_0xd83e('0x1'));var errors=require('./errors');var config=require(_0xd83e('0x2'));var logger=require(_0xd83e('0x3'))(_0xd83e('0x4'));var authLogger=require(_0xd83e('0x3'))('auth');exports[_0xd83e('0x5')]=function(_0x125f19){_0x125f19[_0xd83e('0x6')](ewinston[_0xd83e('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x202b85,_0x3677a4){return util['format']('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x202b85['method'],_0x202b85[_0xd83e('0x8')][_0xd83e('0x9')]?_0x202b85[_0xd83e('0x8')][_0xd83e('0x9')]:_0x202b85['connection'][_0xd83e('0xa')]||_0x202b85['ip'],_0x202b85[_0xd83e('0xb')],_0x3677a4[_0xd83e('0xc')],_0x3677a4[_0xd83e('0xd')],_0x202b85['user']?_0x202b85[_0xd83e('0xe')]['id']:null,_0x202b85[_0xd83e('0xe')]?_0x202b85[_0xd83e('0xe')]['name']:null,_0x202b85[_0xd83e('0xe')]?_0x202b85[_0xd83e('0xe')][_0xd83e('0xf')]:null);}}));_0x125f19[_0xd83e('0x6')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x33975b,_0x17beff){var _0x514712=_0xd83e('0x10');if(_0x33975b[_0xd83e('0x11')]&&_0x33975b[_0xd83e('0x11')][_0xd83e('0x12')]&&_0x33975b[_0xd83e('0x11')][_0xd83e('0x13')]){_0x514712=_0xd83e('0x14');}return util[_0xd83e('0x15')](_0x514712,_0x33975b[_0xd83e('0x16')],_0x33975b[_0xd83e('0x8')][_0xd83e('0x9')]?_0x33975b[_0xd83e('0x8')][_0xd83e('0x9')]:_0x33975b['connection']['remoteAddress']||_0x33975b['ip'],_0x33975b['url'],_0x17beff[_0xd83e('0xc')],_0x17beff[_0xd83e('0xd')],_0x33975b['user']?_0x33975b[_0xd83e('0xe')]['id']:null,_0x33975b['user']?_0x33975b[_0xd83e('0xe')][_0xd83e('0x17')]:null,_0x33975b[_0xd83e('0xe')]?_0x33975b[_0xd83e('0xe')]['role']:null,_0x33975b[_0xd83e('0x11')]&&_0x33975b['body'][_0xd83e('0x12')]?_0x33975b[_0xd83e('0x11')][_0xd83e('0x12')]:_0xd83e('0x18'),_0x33975b[_0xd83e('0x11')]&&_0x33975b['body']['agent_id']?_0x33975b['body']['agent_id']:'',_0x33975b['body']&&_0x33975b[_0xd83e('0x11')]['agent_name']?_0x33975b[_0xd83e('0x11')][_0xd83e('0x19')]:'');},'ignoreRoute':function(_0x531822){var _0x2867ed=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2867ed[_0xd83e('0x1a')](_0x531822[_0xd83e('0xb')]);}}));_0x125f19[_0xd83e('0x6')](_0xd83e('0x1b'),require(_0xd83e('0x1c')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x1d'),require(_0xd83e('0x1e')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x1f'),require(_0xd83e('0x20')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x21'),require('./api/voiceExtension'));_0x125f19['use'](_0xd83e('0x22'),require('./api/voiceMusicOnHold'));_0x125f19[_0xd83e('0x6')]('/api/voice/queues',require('./api/voiceQueue'));_0x125f19['use'](_0xd83e('0x23'),require(_0xd83e('0x24')));_0x125f19[_0xd83e('0x6')]('/api/screen/recordings',require(_0xd83e('0x25')));_0x125f19[_0xd83e('0x6')]('/api/voice/mails',require(_0xd83e('0x26')));_0x125f19['use'](_0xd83e('0x27'),require(_0xd83e('0x28')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x29'),require(_0xd83e('0x2a')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x2b'),require(_0xd83e('0x2c')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x2d'),require(_0xd83e('0x2e')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x2f'),require('./api/voiceQueueReport'));_0x125f19[_0xd83e('0x6')]('/api/members/reports',require(_0xd83e('0x30')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x31'),require(_0xd83e('0x32')));_0x125f19[_0xd83e('0x6')]('/api/voice/transfers/reports',require(_0xd83e('0x33')));_0x125f19['use'](_0xd83e('0x34'),require('./api/mailServerOut'));_0x125f19[_0xd83e('0x6')](_0xd83e('0x35'),require(_0xd83e('0x36')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x37'),require('./api/mailQueue'));_0x125f19[_0xd83e('0x6')](_0xd83e('0x38'),require('./api/mailSubstatus'));_0x125f19[_0xd83e('0x6')](_0xd83e('0x39'),require(_0xd83e('0x3a')));_0x125f19['use'](_0xd83e('0x3b'),require(_0xd83e('0x3c')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x3d'),require(_0xd83e('0x3e')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x3f'),require(_0xd83e('0x40')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x41'),require(_0xd83e('0x42')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x43'),require(_0xd83e('0x44')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x45'),require(_0xd83e('0x46')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x47'),require(_0xd83e('0x48')));_0x125f19['use']('/api/fax/interactions',require(_0xd83e('0x49')));_0x125f19[_0xd83e('0x6')]('/api/fax/messages',require(_0xd83e('0x4a')));_0x125f19[_0xd83e('0x6')]('/api/fax/queues',require(_0xd83e('0x4b')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x4c'),require(_0xd83e('0x4d')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x4e'),require(_0xd83e('0x4f')));_0x125f19[_0xd83e('0x6')]('/api/sms/applications',require(_0xd83e('0x50')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x51'),require(_0xd83e('0x52')));_0x125f19['use'](_0xd83e('0x53'),require(_0xd83e('0x54')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x55'),require(_0xd83e('0x56')));_0x125f19['use']('/api/openchannel/accounts',require(_0xd83e('0x57')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x58'),require(_0xd83e('0x59')));_0x125f19[_0xd83e('0x6')]('/api/openchannel/interactions',require(_0xd83e('0x5a')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x5b'),require(_0xd83e('0x5c')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x5d'),require(_0xd83e('0x5e')));_0x125f19[_0xd83e('0x6')]('/api/chat/websites',require(_0xd83e('0x5f')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x60'),require('./api/openchannelQueueReport'));_0x125f19[_0xd83e('0x6')]('/api/chat/applications',require(_0xd83e('0x61')));_0x125f19['use'](_0xd83e('0x62'),require(_0xd83e('0x63')));_0x125f19[_0xd83e('0x6')]('/api/chat/messages',require(_0xd83e('0x64')));_0x125f19['use']('/api/chat/offline_messages',require(_0xd83e('0x65')));_0x125f19['use'](_0xd83e('0x66'),require(_0xd83e('0x67')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x68'),require(_0xd83e('0x69')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x6a'),require(_0xd83e('0x6b')));_0x125f19[_0xd83e('0x6')]('/api/cm/companies',require(_0xd83e('0x6c')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x6d'),require(_0xd83e('0x6e')));_0x125f19['use'](_0xd83e('0x6f'),require(_0xd83e('0x70')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x71'),require(_0xd83e('0x72')));_0x125f19[_0xd83e('0x6')]('/api/cm/hopper_final',require(_0xd83e('0x73')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x74'),require(_0xd83e('0x75')));_0x125f19[_0xd83e('0x6')]('/api/cm/custom_fields',require(_0xd83e('0x76')));_0x125f19['use']('/api/actions',require('./api/action'));_0x125f19['use'](_0xd83e('0x77'),require(_0xd83e('0x78')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x79'),require(_0xd83e('0x7a')));_0x125f19['use'](_0xd83e('0x7b'),require('./api/disposition'));_0x125f19['use']('/api/conditions',require(_0xd83e('0x7c')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x7d'),require(_0xd83e('0x7e')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x7f'),require(_0xd83e('0x80')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x81'),require(_0xd83e('0x82')));_0x125f19[_0xd83e('0x6')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x125f19[_0xd83e('0x6')](_0xd83e('0x83'),require(_0xd83e('0x84')));_0x125f19[_0xd83e('0x6')]('/api/sounds',require('./api/sound'));_0x125f19[_0xd83e('0x6')]('/api/tags',require(_0xd83e('0x85')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x86'),require(_0xd83e('0x87')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x88'),require('./api/trigger'));_0x125f19[_0xd83e('0x6')](_0xd83e('0x89'),require(_0xd83e('0x8a')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x8b'),require('./api/integration'));_0x125f19[_0xd83e('0x6')](_0xd83e('0x8c'),require(_0xd83e('0x8d')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x8e'),require(_0xd83e('0x8f')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x90'),require(_0xd83e('0x91')));_0x125f19[_0xd83e('0x6')]('/api/analytics/extracted_reports',require(_0xd83e('0x92')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x93'),require(_0xd83e('0x94')));_0x125f19['use'](_0xd83e('0x95'),require(_0xd83e('0x96')));_0x125f19['use'](_0xd83e('0x97'),require(_0xd83e('0x98')));_0x125f19['use'](_0xd83e('0x99'),require(_0xd83e('0x9a')));_0x125f19['use']('/api/integrations/salesforce/configurations',require(_0xd83e('0x9b')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x9c'),require(_0xd83e('0x9d')));_0x125f19['use'](_0xd83e('0x9e'),require(_0xd83e('0x9f')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xa0'),require('./api/intSugarcrmConfiguration'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xa1'),require(_0xd83e('0xa2')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xa3'),require(_0xd83e('0xa4')));_0x125f19[_0xd83e('0x6')]('/api/integrations/desk/configurations',require(_0xd83e('0xa5')));_0x125f19['use']('/api/integrations/desk/fields',require(_0xd83e('0xa6')));_0x125f19[_0xd83e('0x6')]('/api/integrations/zoho/accounts',require(_0xd83e('0xa7')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xa8'),require(_0xd83e('0xa9')));_0x125f19[_0xd83e('0x6')]('/api/integrations/zoho/fields',require(_0xd83e('0xaa')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xab'),require('./api/intZendeskAccount'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xac'),require(_0xd83e('0xad')));_0x125f19['use']('/api/integrations/zendesk/fields',require(_0xd83e('0xae')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xaf'),require(_0xd83e('0xb0')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xb1'),require('./api/intFreshdeskConfiguration'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xb2'),require('./api/intFreshdeskField'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xb3'),require(_0xd83e('0xb4')));_0x125f19[_0xd83e('0x6')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x125f19[_0xd83e('0x6')]('/api/integrations/vtiger/fields',require(_0xd83e('0xb5')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xb6'),require(_0xd83e('0xb7')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xb8'),require(_0xd83e('0xb9')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xba'),require(_0xd83e('0xbb')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xbc'),require(_0xd83e('0xbd')));_0x125f19[_0xd83e('0x6')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xbe'),require(_0xd83e('0xbf')));_0x125f19['use'](_0xd83e('0xc0'),require(_0xd83e('0xc1')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xc2'),require(_0xd83e('0xc3')));_0x125f19[_0xd83e('0x6')]('/api/integrations/freshsales/fields',require(_0xd83e('0xc4')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xc5'),require(_0xd83e('0xc6')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xc7'),require('./api/chatQueueReport'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xc8'),require('./api/chatInternalMessage'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xc9'),require(_0xd83e('0xca')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xcb'),require(_0xd83e('0xcc')));_0x125f19['use'](_0xd83e('0xcd'),require(_0xd83e('0xce')));_0x125f19['use'](_0xd83e('0xcf'),require(_0xd83e('0xd0')));_0x125f19['use'](_0xd83e('0xd1'),require('./api/squareReport'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xd2'),require('./api/squareReportDetail'));_0x125f19['use'](_0xd83e('0xd3'),require(_0xd83e('0xd4')));_0x125f19[_0xd83e('0x6')]('/api/settings',require('./api/setting'));_0x125f19[_0xd83e('0x6')]('/api/square/odbc',require(_0xd83e('0xd5')));_0x125f19[_0xd83e('0x6')]('/api/square/projects',require(_0xd83e('0xd6')));_0x125f19[_0xd83e('0x6')]('/api/square/recordings',require(_0xd83e('0xd7')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xd8'),require(_0xd83e('0xd9')));_0x125f19['use'](_0xd83e('0xda'),require(_0xd83e('0xdb')));_0x125f19['use'](_0xd83e('0xdc'),require('./api/license'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xdd'),require(_0xd83e('0xde')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xdf'),require(_0xd83e('0xe0')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xe1'),require(_0xd83e('0xe2')));_0x125f19['use']('/api/plugins',require(_0xd83e('0xe3')));_0x125f19[_0xd83e('0x6')]('/api/mail/reports/transfer',require(_0xd83e('0xe4')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xe5'),require(_0xd83e('0xe6')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xe7'),require('./api/faxTransferReport'));_0x125f19[_0xd83e('0x6')](_0xd83e('0xe8'),require(_0xd83e('0xe9')));_0x125f19[_0xd83e('0x6')]('/api/sms/reports/transfer',require(_0xd83e('0xea')));_0x125f19['use'](_0xd83e('0xeb'),require(_0xd83e('0xec')));_0x125f19[_0xd83e('0x6')]('/api/voice/prefixes',require(_0xd83e('0xed')));_0x125f19[_0xd83e('0x6')]('/api/userProfiles',require(_0xd83e('0xee')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xef'),require('./api/userProfileSection'));_0x125f19[_0xd83e('0x6')]('/api/userProfile/resources',require(_0xd83e('0xf0')));_0x125f19[_0xd83e('0x6')]('/api/notifications',require(_0xd83e('0xf1')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xf2'),require(_0xd83e('0xf3')));_0x125f19[_0xd83e('0x6')]('/api/whatsapp/applications',require(_0xd83e('0xf4')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xf5'),require(_0xd83e('0xf6')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xf7'),require('./api/whatsappMessage'));_0x125f19['use'](_0xd83e('0xf8'),require(_0xd83e('0xf9')));_0x125f19['use'](_0xd83e('0xfa'),require(_0xd83e('0xfb')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xfc'),require('./api/whatsappQueue'));_0x125f19['use'](_0xd83e('0xfd'),require(_0xd83e('0xfe')));_0x125f19[_0xd83e('0x6')](_0xd83e('0xff'),require(_0xd83e('0x100')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x101'),require(_0xd83e('0x102')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x103'),require(_0xd83e('0x104')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x105'),require(_0xd83e('0x106')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x107'),require(_0xd83e('0x108')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x109'),require(_0xd83e('0x10a')));_0x125f19['use'](_0xd83e('0x10b'),require(_0xd83e('0x10c')));_0x125f19['use']('/api/webbar',require(_0xd83e('0x10d')));_0x125f19[_0xd83e('0x6')](_0xd83e('0x10e'),express[_0xd83e('0x10f')](path[_0xd83e('0x110')](config[_0xd83e('0x111')],_0xd83e('0x10e'))));_0x125f19['use']('/www',express[_0xd83e('0x10f')](path['join'](config[_0xd83e('0x111')],_0xd83e('0x112'))));_0x125f19[_0xd83e('0x6')]('/demo',express[_0xd83e('0x10f')](path[_0xd83e('0x110')](config[_0xd83e('0x111')],_0xd83e('0x113'))));_0x125f19['use']('/snippet',express[_0xd83e('0x10f')](path[_0xd83e('0x110')](config['root'],_0xd83e('0x114'),_0xd83e('0x115'))));_0x125f19[_0xd83e('0x6')](_0xd83e('0x116'),express['static'](path[_0xd83e('0x110')](config[_0xd83e('0x111')],_0xd83e('0x117'))));_0x125f19['route']('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x125f19['route']('/*')[_0xd83e('0x118')](function(_0x48a72c,_0x43a9ac){_0x43a9ac[_0xd83e('0x119')](path[_0xd83e('0x11a')](_0x125f19[_0xd83e('0x118')](_0xd83e('0x11b'))+_0xd83e('0x11c')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3171017..964bb1c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99c2=['../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/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/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x99c2,0x1b0));var _0x299c=function(_0xbac553,_0xf379c6){_0xbac553=_0xbac553-0x0;var _0x1b63aa=_0x99c2[_0xbac553];return _0x1b63aa;};'use strict';var jayson=require(_0x299c('0x0'));var BPromise=require(_0x299c('0x1'));var _=require(_0x299c('0x2'));var config=require('../config/environment');exports[_0x299c('0x3')]=function(){return new BPromise(function(_0x341476,_0x1c9043){var _0x1564ed={};_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x5')));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0x6')));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0x7')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x8')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x9')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0xa')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0xb')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0xc')));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0xd')));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0xe')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/mailServerIn/mailServerIn.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0xf')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x10')));_0x1564ed=_['merge'](_0x1564ed,require('../api/mailInteraction/mailInteraction.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/mailMessage/mailMessage.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/mailApplication/mailApplication.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x11')));_0x1564ed=_['merge'](_0x1564ed,require('../api/faxAccount/faxAccount.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x12')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x13')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x14')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x15')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x16')));_0x1564ed=_['merge'](_0x1564ed,require('../api/smsAccount/smsAccount.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x17')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x18')));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0x19')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0x1a')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x1b')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/chatInteraction/chatInteraction.rpc'));_0x1564ed=_['merge'](_0x1564ed,require('../api/chatMessage/chatMessage.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x1c')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x1d')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x1e')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x1f')));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0x20')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x21')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x22')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x23')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x24')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x25')));_0x1564ed=_['merge'](_0x1564ed,require('../api/template/template.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x26')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x27')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x28')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x29')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x2a')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x2b')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x2c')));_0x1564ed=_['merge'](_0x1564ed,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x2d')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x2e')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0x2f')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x30')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x31')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x32')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/squareOdbc/squareOdbc.rpc'));_0x1564ed=_['merge'](_0x1564ed,require('../api/squareProject/squareProject.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x33')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x34')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x35')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x36')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require('../api/plugin/plugin.rpc'));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x37')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x38')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x39')));_0x1564ed=_[_0x299c('0x4')](_0x1564ed,require(_0x299c('0x3a')));_0x1564ed=_['merge'](_0x1564ed,require(_0x299c('0x3b')));var _0x386b7b=jayson[_0x299c('0x3c')](_0x1564ed)['http']();var _0x182d58=config['rpc'][_0x299c('0x3d')]||config[_0x299c('0x3d')]+0x1;var _0x56b8c6=config[_0x299c('0x3e')]['ip']||_0x299c('0x3f');_0x386b7b['on']('error',function(_0x4a0cc3){return _0x1c9043(_0x4a0cc3);});_0x386b7b[_0x299c('0x3')](_0x182d58,_0x56b8c6,function(){console[_0x299c('0x40')](_0x299c('0x41'),_0x56b8c6,_0x182d58);require(_0x299c('0x42'))[_0x299c('0x43')]();return _0x341476(_0x299c('0x44')+_0x56b8c6+':'+_0x182d58);});});}; \ No newline at end of file +var _0xbd41=['server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x4ba811,_0x4428f2){var _0x3b616f=function(_0x5cc7e1){while(--_0x5cc7e1){_0x4ba811['push'](_0x4ba811['shift']());}};_0x3b616f(++_0x4428f2);}(_0xbd41,0xca));var _0x1bd4=function(_0x11ad93,_0x49306a){_0x11ad93=_0x11ad93-0x0;var _0x50535e=_0xbd41[_0x11ad93];return _0x50535e;};'use strict';var jayson=require(_0x1bd4('0x0'));var BPromise=require('bluebird');var _=require(_0x1bd4('0x1'));var config=require(_0x1bd4('0x2'));exports[_0x1bd4('0x3')]=function(){return new BPromise(function(_0x35fa96,_0x12e9e5){var _0x3c1185={};_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/user/user.rpc'));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x5')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x6')));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x7')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x8')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x9')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0xa')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0xb')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0xc')));_0x3c1185=_['merge'](_0x3c1185,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0xd')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/mailServerIn/mailServerIn.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0xe')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0xf')));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x10')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x11')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x12')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x13')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x14')));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x15')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x16')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x17')));_0x3c1185=_['merge'](_0x3c1185,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x18')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x19')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x1a')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x1b')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x1c')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x1d')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x1e')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x1f')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x20')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/chatMessage/chatMessage.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/chatQueue/chatQueue.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x21')));_0x3c1185=_['merge'](_0x3c1185,require('../api/cmHopper/cmHopper.rpc'));_0x3c1185=_['merge'](_0x3c1185,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x22')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x23')));_0x3c1185=_['merge'](_0x3c1185,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/interval/interval.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/pause/pause.rpc'));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x24')));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x25')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x26')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x27')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x28')));_0x3c1185=_['merge'](_0x3c1185,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x29')));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x2a')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x2b')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x2c')));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x2d')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x3c1185=_['merge'](_0x3c1185,require(_0x1bd4('0x2e')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x2f')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x30')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x31')));_0x3c1185=_['merge'](_0x3c1185,require('../api/squareRecording/squareRecording.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/squareMessage/squareMessage.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x32')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/attachment/attachment.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x33')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x34')));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3c1185=_[_0x1bd4('0x4')](_0x3c1185,require(_0x1bd4('0x35')));var _0x1ecde0=jayson[_0x1bd4('0x36')](_0x3c1185)[_0x1bd4('0x37')]();var _0x4f9720=config[_0x1bd4('0x38')][_0x1bd4('0x39')]||config[_0x1bd4('0x39')]+0x1;var _0xec52e4=config[_0x1bd4('0x38')]['ip']||_0x1bd4('0x3a');_0x1ecde0['on'](_0x1bd4('0x3b'),function(_0x557c4c){return _0x12e9e5(_0x557c4c);});_0x1ecde0[_0x1bd4('0x3')](_0x4f9720,_0xec52e4,function(){console[_0x1bd4('0x3c')](_0x1bd4('0x3d'),_0xec52e4,_0x4f9720);require(_0x1bd4('0x3e'))['default']();return _0x35fa96(_0x1bd4('0x3f')+_0xec52e4+':'+_0x4f9720);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 1ca4bc6..c09278d 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 _0x34e8=['toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','inherits','sendRequest','prototype','answer','beep','format','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','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','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setEncoding','headers','emit','ready','line'];(function(_0x2bb6fe,_0x1d9f99){var _0x5b5905=function(_0x570a23){while(--_0x570a23){_0x2bb6fe['push'](_0x2bb6fe['shift']());}};_0x5b5905(++_0x1d9f99);}(_0x34e8,0x12c));var _0x834e=function(_0x45d690,_0x31990f){_0x45d690=_0x45d690-0x0;var _0xe85921=_0x34e8[_0x45d690];return _0xe85921;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x834e('0x4'));function AGIChannel(_0x21e2e0){var _0x472111=this,_0x31bf20=new AGIReply(),_0x289ef2=![],_0x19a3e0={};EventEmitter[_0x834e('0x5')](_0x472111);_0x21e2e0['setEncoding'](_0x834e('0x6'));_0x21e2e0['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x31bf20[_0x834e('0x7')](_0x834e('0x6'));_0x31bf20['on'](_0x834e('0x8'),function(_0x2e69e2){for(var _0x33ea05 in _0x2e69e2){_0x472111[_0x33ea05]=_0x2e69e2[_0x33ea05];}_0x472111[_0x834e('0x9')](_0x834e('0xa'));});_0x31bf20['on'](_0x834e('0xb'),function(_0x3bdda9){if(_0x3bdda9[_0x834e('0xc')]()==_0x834e('0xd')){_0x472111[_0x834e('0x9')](_0x834e('0xd'));return;}if(_0x3bdda9[_0x834e('0xe')](0x0,0xb)==_0x834e('0xf')){_0x289ef2=!![];}if(_0x289ef2){_0x19a3e0['rx']+=_0x3bdda9+'\x0a';if(_0x3bdda9[_0x834e('0x10')](_0x834e('0x11'))!=-0x1){_0x289ef2=![];}}else{_0x19a3e0['rx']=_0x3bdda9;}if(_0x289ef2){return;}if(typeof _0x19a3e0['cb']=='function'){var _0x5e5b6d=_0x19a3e0['rx'][_0x834e('0xe')](0x0,0x3),_0x6cd9b9=null,_0x58a27e=null;_0x5e5b6d=parseInt(_0x5e5b6d);if(isNaN(_0x5e5b6d)){_0x19a3e0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x834e('0x12')});return;}if(_0x5e5b6d!=0xc8){_0x19a3e0['cb'](null,{'code':_0x5e5b6d,'result':-0x1,'extra':'KO'});return;}_0x6cd9b9=_0x19a3e0['rx'][_0x834e('0xe')](0x4)[_0x834e('0x13')]('result=','');if(_0x6cd9b9[_0x834e('0x14')]('\x20')!=-0x1){_0x6cd9b9=_0x6cd9b9[_0x834e('0x15')](0x0,_0x6cd9b9['indexOf']('\x20'));}if(_[_0x834e('0x16')](_0x6cd9b9,'-1')){_0x6cd9b9=parseInt(_0x6cd9b9);}_0x58a27e=_0x19a3e0['rx']['split']('\x20');if(_0x58a27e[_0x834e('0x17')]==0x3){_0x58a27e=_0x58a27e[0x2][_0x834e('0xe')](0x1,_0x58a27e[0x2]['length']-0x1);}else if(_0x58a27e[_0x834e('0x17')]>0x3){var _0x22106e=/\((.+)\)/;var _0x370fb5=_0x19a3e0['rx']['match'](_0x22106e);if(_0x370fb5){_0x58a27e=_0x370fb5[0x1];}else{_0x58a27e=null;}}else{_0x58a27e=null;}_0x19a3e0['cb'](null,{'code':_0x5e5b6d,'result':_0x6cd9b9,'extra':_0x58a27e});}});_0x21e2e0['on'](_0x834e('0x18'),function(_0x211e9a){_0x472111[_0x834e('0x9')](_0x834e('0x18'),new AGIError(_0x834e('0x19'),_0x211e9a[_0x834e('0x1a')]));});_0x21e2e0['on'](_0x834e('0x1b'),function(){_0x472111['emit'](_0x834e('0x1b'),new AGIError(_0x834e('0x1c')));});_0x21e2e0['on'](_0x834e('0x1d'),function(){_0x472111[_0x834e('0x9')]('timeout',new AGIError(_0x834e('0x1e')));_0x21e2e0[_0x834e('0x1f')]();});_0x21e2e0['pipe'](_0x31bf20);this[_0x834e('0x20')]=function(_0x28d687,_0x8d406e){var _0x28d687=_0x28d687||'',_0x8d406e=typeof _0x8d406e==_0x834e('0x21')?_0x8d406e:new Function();_0x19a3e0={'tx':_0x28d687,'rx':'','cb':_0x8d406e};_0x21e2e0[_0x834e('0x22')](_0x28d687+'\x0a');},this['close']=function(){_0x21e2e0[_0x834e('0x1f')]();};}util[_0x834e('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x834e('0x24')]=function(_0x2e1983){return this[_0x834e('0x20')]['sync'](this,_0x2e1983);};AGIChannel[_0x834e('0x25')][_0x834e('0x26')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x834e('0x25')]['getData']=function(_0x2826ec,_0x3f1b0b,_0x3db026){_0x2826ec=_0x2826ec===undefined?_0x834e('0x27'):_0x2826ec;_0x3f1b0b=_0x3f1b0b===undefined?'5':_0x3f1b0b;_0x3db026=_0x3db026===undefined?'1':_0x3db026;return this[_0x834e('0x24')](util[_0x834e('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2826ec,_0x3f1b0b*0x3e8,_0x3db026));};AGIChannel['prototype']['noop']=function(_0x58c1d7){_0x58c1d7=_0x58c1d7||_0x834e('0x29');return this[_0x834e('0x24')](util[_0x834e('0x28')]('VERBOSE\x20\x22%s\x22',_0x58c1d7));};AGIChannel[_0x834e('0x25')][_0x834e('0x2a')]=function(_0x1f3671,_0x1e026a){if(_[_0x834e('0x2b')](_0x1e026a)){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x2c'),_0x1f3671,_0x1e026a[_0x834e('0x2d')](',')));}return this['sendRequest'](util[_0x834e('0x28')]('EXEC\x20%s\x20%s',_0x1f3671,_0x1e026a));};AGIChannel[_0x834e('0x25')][_0x834e('0x2e')]=function(_0x9ab921){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x2f'),_0x9ab921));};AGIChannel[_0x834e('0x25')][_0x834e('0x30')]=function(_0x358c31){return this[_0x834e('0x24')](util['format'](_0x834e('0x31'),_0x358c31));};AGIChannel[_0x834e('0x25')][_0x834e('0x32')]=function(_0xaf01f4){return this['sendRequest'](util[_0x834e('0x28')](_0x834e('0x33'),_0xaf01f4));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0x834e('0x34'));};AGIChannel[_0x834e('0x25')][_0x834e('0x35')]=function(_0x34fefb,_0x339e28){var _0x1b76dd=_['isBoolean'](_0x339e28)||_[_0x834e('0x36')](_0x339e28)?_0x339e28['toString']():_0x339e28;return this[_0x834e('0x24')](util[_0x834e('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x34fefb,_0x1b76dd?_0x1b76dd[_0x834e('0x37')]()[_0x834e('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x388711,_0xd0d43a){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x38'),_0x388711,_0xd0d43a));};AGIChannel['prototype'][_0x834e('0x39')]=function(_0x548d1d,_0x50c243){return this[_0x834e('0x24')](util['format'](_0x834e('0x3a'),_0x548d1d,_0x50c243));};AGIChannel[_0x834e('0x25')][_0x834e('0x3b')]=function(_0x3c59af,_0x2b7933){return this['sendRequest'](util[_0x834e('0x28')](_0x834e('0x3c'),_0x3c59af,_0x2b7933));};AGIChannel[_0x834e('0x25')]['continueAt']=function(_0x35380e,_0x16ac45,_0x57b89a){_0x16ac45=_0x16ac45||this[_0x834e('0x3d')];_0x57b89a=_0x57b89a||0x1;this['setContext'](_0x35380e);this[_0x834e('0x30')](_0x16ac45);this[_0x834e('0x32')](_0x57b89a);return this['noop'](util['format'](_0x834e('0x3e'),_0x35380e,_0x16ac45,_0x57b89a));};AGIChannel[_0x834e('0x25')][_0x834e('0x3f')]=function(_0xbc1571){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x40'),_0xbc1571));};AGIChannel['prototype'][_0x834e('0x41')]=function(_0x5abb7a,_0x321efa,_0x540685,_0x1df5b0,_0x5a5807,_0x361f60){_0x321efa=_0x321efa||_0x834e('0x42');_0x540685=_0x540685||'';_0x1df5b0=_0x1df5b0===undefined?-0x1:_0x1df5b0==='-1'?-0x1:_0x1df5b0*0x3e8;_0x5a5807=_0x5a5807===undefined?'':'s='+_0x5a5807;_0x361f60=_0x361f60?'BEEP':'';return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x43'),_0x5abb7a,_0x321efa,_0x540685,_0x1df5b0,_0x361f60,_0x5a5807));};AGIChannel[_0x834e('0x25')][_0x834e('0x44')]=function(_0x1a7149,_0xfa28da){_0xfa28da=_0xfa28da||'';return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x45'),_0x1a7149,_0xfa28da));};AGIChannel['prototype'][_0x834e('0x46')]=function(_0x6fff27){return this['exec'](_0x834e('0x47'),_0x6fff27);};AGIChannel[_0x834e('0x25')][_0x834e('0x48')]=function(_0x2112d5){return this[_0x834e('0x2a')](_0x834e('0x49'),_0x2112d5);};AGIChannel['prototype']['error']=function(_0x954d4b,_0x1a5444){this[_0x834e('0x4a')](util[_0x834e('0x28')](_0x834e('0x4b'),_0x954d4b['id'],_0x954d4b[_0x834e('0x4c')],_0x1a5444));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x834e('0x4d')]=AGIChannel; \ No newline at end of file +var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4f99838..0503ddb 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 _0x2141=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x5e9571,_0x561247){var _0xaf100d=function(_0x2c37ac){while(--_0x2c37ac){_0x5e9571['push'](_0x5e9571['shift']());}};_0xaf100d(++_0x561247);}(_0x2141,0x1ba));var _0x1214=function(_0x3d11e5,_0x509263){_0x3d11e5=_0x3d11e5-0x0;var _0x22ee87=_0x2141[_0x3d11e5];return _0x22ee87;};'use strict';var util=require(_0x1214('0x0'));var error={'E_AGI_UNDEFINED':_0x1214('0x1'),'E_AGI_ARGUMENT_PORT':_0x1214('0x2'),'E_AGI_SERVER_ERROR':_0x1214('0x3'),'E_AGI_SERVER_CLOSE':_0x1214('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x1214('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x1214('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x1214('0x7'),'E_AGI_COMMAND_EMPTY':_0x1214('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1214('0x9'),'E_AGI_IVR_ENTRY':_0x1214('0xa')};function AGIError(_0x2c8a69){var _0x2c8a69=_0x2c8a69||null,_0xcd7f4=_0xcd7f4||[],_0xa5c6dc=0x1,_0xdff9e9='';if(!error[_0x2c8a69]){_0x2c8a69=_0x1214('0xb');}_0xcd7f4[_0x1214('0xc')](error[_0x2c8a69]);while(arguments[_0xa5c6dc]){_0xcd7f4[_0x1214('0xc')](arguments[_0xa5c6dc]);_0xa5c6dc++;}_0xdff9e9=util[_0x1214('0xd')][_0x1214('0xe')](util,_0xcd7f4);this[_0x1214('0xf')]=_0xdff9e9;this[_0x1214('0x10')]=_0x2c8a69;}module[_0x1214('0x11')]=AGIError; \ No newline at end of file +var _0x956a=['message','name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x46e5b1,_0x2bba68){var _0x3d7143=function(_0x4640f8){while(--_0x4640f8){_0x46e5b1['push'](_0x46e5b1['shift']());}};_0x3d7143(++_0x2bba68);}(_0x956a,0xb6));var _0xa956=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x956a[_0x432682];return _0x463d05;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xa956('0x0'),'E_AGI_ARGUMENT_PORT':_0xa956('0x1'),'E_AGI_SERVER_ERROR':_0xa956('0x2'),'E_AGI_SERVER_CLOSE':_0xa956('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xa956('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xa956('0x5'),'E_AGI_SOCKET_ERROR':_0xa956('0x6'),'E_AGI_SOCKET_CLOSE':_0xa956('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa956('0x8'),'E_AGI_IVR_ENTRY':_0xa956('0x9')};function AGIError(_0x2ce2c8){var _0x2ce2c8=_0x2ce2c8||null,_0xdaa956=_0xdaa956||[],_0x1318ea=0x1,_0x1265dd='';if(!error[_0x2ce2c8]){_0x2ce2c8=_0xa956('0xa');}_0xdaa956[_0xa956('0xb')](error[_0x2ce2c8]);while(arguments[_0x1318ea]){_0xdaa956[_0xa956('0xb')](arguments[_0x1318ea]);_0x1318ea++;}_0x1265dd=util[_0xa956('0xc')]['apply'](util,_0xdaa956);this[_0xa956('0xd')]=_0x1265dd;this[_0xa956('0xe')]=_0x2ce2c8;}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 576042f..c70282f 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 _0x58a4=['condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','traverseBFS','info','stop\x20traverse','length','condition','split','vswitch','target','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes'];(function(_0x22491a,_0x488e18){var _0x378898=function(_0x2921f5){while(--_0x2921f5){_0x22491a['push'](_0x22491a['shift']());}};_0x378898(++_0x488e18);}(_0x58a4,0xbf));var _0x458a=function(_0x1b88fd,_0x3fc359){_0x1b88fd=_0x1b88fd-0x0;var _0x287cd1=_0x58a4[_0x1b88fd];return _0x287cd1;};'use strict';var _=require(_0x458a('0x0'));var logger=require(_0x458a('0x1'))(_0x458a('0x2'));var verticesWithRetry=[_0x458a('0x3'),_0x458a('0x4'),_0x458a('0x5')];var Graph=function(){this[_0x458a('0x6')]={};this[_0x458a('0x7')]={};this[_0x458a('0x8')]=0x0;};Graph[_0x458a('0x9')][_0x458a('0xa')]=function(_0x4443d1){this[_0x458a('0x6')][_0x4443d1['id']]=_0x4443d1;this['edges'][_0x4443d1['id']]=[];};Graph['prototype'][_0x458a('0xb')]=function(_0x11fcaa,_0x2029bc,_0x1e658e){this[_0x458a('0x7')][_0x11fcaa]['push']({'target':_0x2029bc,'condition':_0x1e658e});this['numberOfEdges']+=0x1;};Graph[_0x458a('0x9')][_0x458a('0xc')]=function(){return _[_0x458a('0xc')](this[_0x458a('0x6')]);};Graph[_0x458a('0x9')]['relations']=function(){return this[_0x458a('0x8')];};Graph[_0x458a('0x9')]['getVertex']=function(_0x183d9d){return this[_0x458a('0x6')][_0x183d9d];};Graph[_0x458a('0x9')][_0x458a('0xd')]=function(_0x2e788b,_0x5bd09e){if(!this['vertices'][_0x2e788b]){return logger[_0x458a('0xe')]('no\x20vertex\x20found');}var _0x2c7528=_0x5bd09e(this[_0x458a('0x6')][_0x2e788b]);if(!_0x2c7528){return logger[_0x458a('0xe')](_0x458a('0xf'));}if(this[_0x458a('0x7')][_0x2e788b][_0x458a('0x10')]===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0x5c7993=0x0,_0x2faf6a=[],_0x3fd6d4=![];_0x5c7993\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','addEdge','source','target','value','then','catch','createSquareReport','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','close','sync','production','SQUAREROOT','joinAt','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','code','response','isUndefined','result','toString','agicommand\x20not\x20found','finally','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/license/util','./rpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d'];(function(_0x4f0498,_0x17818f){var _0x252c70=function(_0x1ecea3){while(--_0x1ecea3){_0x4f0498['push'](_0x4f0498['shift']());}};_0x252c70(++_0x17818f);}(_0x9017,0x15b));var _0x7901=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9017[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x7901('0x0'));var _=require(_0x7901('0x1'));var syncho=require(_0x7901('0x2'));var util=require(_0x7901('0x3'));var moment=require(_0x7901('0x4'));var config=require(_0x7901('0x5'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x7901('0x6'));var rpc=require(_0x7901('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x7901('0x8'));var Vertices=require(_0x7901('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7901('0xa')]=_[_0x7901('0xb')](config['agi'],{'ip':_0x7901('0xc'),'port':0x11dd});function connectionHandler(_0x3bfd42){process[_0x7901('0xd')](function(){syncho(function(){try{setChannelVariables(_0x3bfd42);agiHandler(_0x3bfd42);}catch(_0x3fe1bb){logger[_0x7901('0xe')](_0x3fe1bb['stack']);}});});}function listeningHandler(){console[_0x7901('0xf')](_0x7901('0x10'),config['agi'][_0x7901('0x11')]);logger[_0x7901('0x12')](util[_0x7901('0x13')](_0x7901('0x14'),config['agi']['ip'],config['agi']['port']));}function errorHandler(_0x4dfa7a){if(_0x4dfa7a&&_0x4dfa7a['name']&&_0x4dfa7a[_0x7901('0x15')]){logger['error'](util['format'](_0x7901('0x16'),_0x4dfa7a[_0x7901('0x17')],_0x4dfa7a[_0x7901('0x15')]));}else{logger[_0x7901('0xe')](util[_0x7901('0x13')]('[ERROR]\x20%s',_0x4dfa7a[_0x7901('0x18')]));}}function closeHandler(){logger[_0x7901('0x12')](util[_0x7901('0x13')](_0x7901('0x19'),this[_0x7901('0x1a')],this[_0x7901('0x1b')],this['callerid'],this['dnid'],this[_0x7901('0x1c')]));try{createSquareReport(this);}catch(_0x2053fc){logger['error'](_0x2053fc[_0x7901('0x18')]);}}function timeoutHandler(){logger[_0x7901('0x12')](util[_0x7901('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7901('0x1a')],this['calleridname'],this['callerid'],this[_0x7901('0x1d')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x7901('0x13')](_0x7901('0x1e'),this[_0x7901('0x1a')],this[_0x7901('0x1b')],this['callerid'],this[_0x7901('0x1d')],this[_0x7901('0x1c')]));this[_0x7901('0x1f')]=!![];}function getRoot(_0x21bcb4){return parser[_0x7901('0x20')](_0x21bcb4,{'object':!![]})[_0x7901('0x21')][_0x7901('0x22')];}function addVertex(_0x24702e,_0x53d234,_0x48bd1b){_0x53d234[_0x7901('0x23')]=_0x48bd1b;if(_0x53d234[_0x7901('0x24')](_0x7901('0x25'))){_0x53d234[_0x7901('0x26')]=parseInt(_0x53d234[_0x7901('0x25')],0xa);}_0x24702e[_0x7901('0x27')](_['omit'](_0x53d234,_0x7901('0x28')));}function initGraph(_0x15f1e4,_0x377a0b){var _0x325b72=new Graph();for(var _0x364d93 in _0x15f1e4){if(_0x15f1e4[_0x7901('0x24')](_0x364d93)){if(_[_0x7901('0x29')](_0x15f1e4[_0x364d93])){for(var _0x231d7f=0x0;_0x231d7f<_0x15f1e4[_0x364d93][_0x7901('0x2a')];_0x231d7f+=0x1){addVertex(_0x325b72,_0x15f1e4[_0x364d93][_0x231d7f],_0x364d93);}}else{addVertex(_0x325b72,_0x15f1e4[_0x364d93],_0x364d93);}}}for(var _0x116017=0x0;_0x116017<_0x377a0b[_0x7901('0x2a')];_0x116017+=0x1){if(_0x377a0b[_0x116017]['source']&&_0x377a0b[_0x116017]['target']){_0x325b72[_0x7901('0x2b')](_0x377a0b[_0x116017][_0x7901('0x2c')],_0x377a0b[_0x116017][_0x7901('0x2d')],_0x377a0b[_0x116017][_0x7901('0x2e')]);}}return _0x325b72;}function getSquareProject(_0x4cca9e,_0x2aff44){rpc['getSquareProject'](_0x4cca9e)[_0x7901('0x2f')](function(_0x4d1672){_0x2aff44(null,_0x4d1672);})[_0x7901('0x30')](function(_0x563a4b){_0x2aff44(null,_0x563a4b);});}function createSquareReport(_0x19af84,_0xe17bf4){rpc[_0x7901('0x31')](_0x19af84)[_0x7901('0x2f')](function(_0x11dbb1){if(_0xe17bf4){_0xe17bf4(null,_0x11dbb1);}})[_0x7901('0x30')](function(_0x4ef6b9){if(_0xe17bf4){_0xe17bf4(null,_0x4ef6b9);}});}function setChannelVariables(_0x1f4de8){for(var _0x2274ae in _0x1f4de8){if(_0x1f4de8['hasOwnProperty'](_0x2274ae)){if(_0x2274ae[_0x7901('0x32')]('agi_')===0x0){_0x1f4de8[_0x2274ae[_0x7901('0x33')](0x4)]=_0x1f4de8[_0x2274ae];delete _0x1f4de8[_0x2274ae];}}}}function getLogFromObject(_0x4676f2){return util['inspect'](_0x4676f2,{'showHidden':![],'depth':null});}function agiHandler(_0x3330ba){var _0xac9fe3,_0x3ec8e0,_0x383815,_0x977007,_0x4fb947;logger[_0x7901('0x34')](_0x7901('0x35'),JSON[_0x7901('0x36')](_0x3330ba,null,0x2));logger['info'](util['format'](_0x7901('0x37'),_0x3330ba[_0x7901('0x1a')],_0x3330ba[_0x7901('0x1b')],_0x3330ba[_0x7901('0x38')],_0x3330ba['dnid'],_0x3330ba[_0x7901('0x1c')]));_0x3330ba['on'](_0x7901('0xe'),errorHandler);_0x3330ba['on'](_0x7901('0x39'),closeHandler);_0x3330ba['on']('timeout',timeoutHandler);_0x3330ba[_0x7901('0x1f')]=![];_0x3330ba['on']('hangup',hangupHandler);var _0x401b35=getSquareProject[_0x7901('0x3a')](null,_0x3330ba['arg_1']);if(_0x401b35){if(_0x401b35[_0x7901('0x3b')]){_0xac9fe3=getRoot(_0x401b35[_0x7901('0x3b')]);console['log'](_0x7901('0x3c'),_0xac9fe3);if(_0xac9fe3&&_0xac9fe3['start']){logger['debug'](_0x7901('0x22'),JSON['stringify'](_0xac9fe3,null,0x2));_0x3330ba[_0x7901('0x3d')]=moment()[_0x7901('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ec8e0=initGraph(_[_0x7901('0x3e')](_0xac9fe3,_0x7901('0x28')),_0xac9fe3['mxCell']);_0x383815=new Vertices(_0x3330ba,rpc,mailRpc);logger[_0x7901('0x12')](util['format'](_0x7901('0x3f'),_0x3330ba[_0x7901('0x1a')],_0x3330ba['calleridname'],_0x3330ba[_0x7901('0x38')],_0x3330ba[_0x7901('0x1d')],_0x3330ba[_0x7901('0x1c')]));_0x3ec8e0[_0x7901('0x40')](_0xac9fe3[_0x7901('0x41')]['id'],function(_0x3dd83e){try{_0x3dd83e=_0x383815['clear'](_0x3dd83e);logger[_0x7901('0x34')](_0x7901('0x42'),JSON[_0x7901('0x36')](_0x3dd83e,null,0x2));if(_0x3dd83e[_0x7901('0x23')]===_0x7901('0x43')){logger[_0x7901('0x12')](_0x7901('0x44'));_0x3330ba[_0x7901('0x45')]=_0x3dd83e['context']||_0x3330ba[_0x7901('0x45')];_0x3330ba['extension']=_0x3dd83e['extension'];_0x3330ba[_0x7901('0x46')]=_0x3dd83e[_0x7901('0x46')]?_0x3dd83e['priority']-0x1:0x1;return null;}else if(_0x3dd83e&&_0x383815[_0x3dd83e[_0x7901('0x23')]]){_0x4fb947=_0x383815[_0x3dd83e[_0x7901('0x23')]](_0x3dd83e);logger[_0x7901('0x12')]('response',JSON[_0x7901('0x36')](_0x4fb947,null,0x2));if(_0x4fb947&&_0x4fb947[_0x7901('0x47')]===AGI_CODE_SUCCESS&&_0x4fb947['result']!==AGI_RESULT_ERROR&&!_0x3330ba['evtHangup']){logger[_0x7901('0x34')](_0x7901('0x48'),getLogFromObject(_0x4fb947));return _[_0x7901('0x49')](_0x4fb947[_0x7901('0x4a')])?null:_0x4fb947['result'][_0x7901('0x4b')]();}else{logger[_0x7901('0xe')](_0x7901('0x48'),getLogFromObject(_0x4fb947));return null;}}else{logger[_0x7901('0xe')](_0x7901('0x4c'));return null;}}catch(_0x4ff7e8){logger[_0x7901('0xe')](_0x4ff7e8['stack']);return null;}});if(_0xac9fe3[_0x7901('0x4d')]){logger[_0x7901('0x12')](util[_0x7901('0x13')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3330ba[_0x7901('0x1a')],_0x3330ba[_0x7901('0x1b')],_0x3330ba[_0x7901('0x38')],_0x3330ba[_0x7901('0x1d')],_0x3330ba[_0x7901('0x1c')]));_0x3ec8e0[_0x7901('0x40')](_0xac9fe3[_0x7901('0x4d')]['id'],function(_0x2b2c77){try{_0x2b2c77=_0x383815[_0x7901('0x4e')](_0x2b2c77);logger[_0x7901('0x34')](_0x7901('0x42'),JSON[_0x7901('0x36')](_0x2b2c77,null,0x2));if(_0x2b2c77&&_0x383815[_0x2b2c77[_0x7901('0x23')]]){_0x4fb947=_0x383815[_0x2b2c77['agicommand']](_0x2b2c77);if(_0x4fb947){logger[_0x7901('0x34')]('response',getLogFromObject(_0x4fb947));return _[_0x7901('0x49')](_0x4fb947[_0x7901('0x4a')])?null:_0x4fb947[_0x7901('0x4a')][_0x7901('0x4b')]();}else{logger[_0x7901('0xe')](_0x7901('0x48'),getLogFromObject(_0x4fb947));return null;}}else{logger[_0x7901('0xe')](_0x7901('0x4c'));return null;}}catch(_0x4697e1){logger[_0x7901('0xe')](_0x4697e1[_0x7901('0x18')]);return null;}});}logger[_0x7901('0x12')](util[_0x7901('0x13')](_0x7901('0x4f'),_0x3330ba[_0x7901('0x1a')],_0x3330ba['calleridname'],_0x3330ba[_0x7901('0x38')],_0x3330ba['dnid'],_0x3330ba['uniqueid']));logger[_0x7901('0x12')](util[_0x7901('0x13')](_0x7901('0x50'),_0x3330ba['context'],_0x3330ba[_0x7901('0x51')],parseInt(_0x3330ba[_0x7901('0x46')],0xa)+0x1));_0x3330ba[_0x7901('0x52')](_0x3330ba[_0x7901('0x45')],_0x3330ba[_0x7901('0x51')],parseInt(_0x3330ba[_0x7901('0x46')],0xa)+0x1);_0x3330ba['close']();}}else{logger[_0x7901('0xe')](util[_0x7901('0x13')](_0x7901('0x53'),_0x3330ba[_0x7901('0x1a')]));_0x3330ba[_0x7901('0x52')](_0x3330ba[_0x7901('0x45')],_0x3330ba[_0x7901('0x51')],parseInt(_0x3330ba[_0x7901('0x46')],0xa)+0x1);_0x3330ba['close']();}}else{logger['error'](util[_0x7901('0x13')](_0x7901('0x54'),_0x3330ba[_0x7901('0x1a')]));_0x3330ba['continueAt'](_0x3330ba[_0x7901('0x45')],_0x3330ba[_0x7901('0x51')],parseInt(_0x3330ba['priority'],0xa)+0x1);_0x3330ba[_0x7901('0x39')]();}}function main(){var _0xa9418d;return utilLicense[_0x7901('0x55')]()[_0x7901('0x2f')](function(_0x480318){if(_0x480318){if(_0x480318['voice']){if(_0x480318[_0x7901('0x56')]&&_0x480318['callysquare']>0x0){logger[_0x7901('0x12')](util['format'](_0x7901('0x57'),_0x480318['callysquare']));_0xa9418d=_0x480318[_0x7901('0x56')];}else{logger[_0x7901('0x12')](_0x7901('0x58'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0xa9418d=-0x1;}}})['catch'](function(_0x4f7769){logger[_0x7901('0xe')](_0x7901('0x59'),_0x4f7769[_0x7901('0x18')]);})[_0x7901('0x4d')](function(){var _0x155421=require(_0x7901('0x5a'))(config[_0x7901('0xa')][_0x7901('0x11')],config[_0x7901('0xa')]['ip'],_0xa9418d);_0x155421['on']('error',errorHandler);_0x155421['on'](_0x7901('0x5b'),listeningHandler);_0x155421['on']('connection',connectionHandler);_0x155421['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x6888=['code','result','evtHangup','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','./mailRpc','./graph','./vertices','defaults','nextTick','error','stack','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','addEdge','getSquareProject','catch','createSquareReport','then','agi_','substring','inspect','stringify','close','timeout','hangup','production','log','SQUAREROOT','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','VERTEX','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response'];(function(_0x2c8d3e,_0x5cc741){var _0x104e8f=function(_0x4bd8e8){while(--_0x4bd8e8){_0x2c8d3e['push'](_0x2c8d3e['shift']());}};_0x104e8f(++_0x5cc741);}(_0x6888,0xd2));var _0x8688=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x6888[_0x565ed7];return _0x183ad7;};'use strict';var parser=require(_0x8688('0x0'));var _=require('lodash');var syncho=require(_0x8688('0x1'));var util=require(_0x8688('0x2'));var moment=require(_0x8688('0x3'));var config=require(_0x8688('0x4'));var logger=require(_0x8688('0x5'))(_0x8688('0x6'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0x8688('0x7'));var Graph=require(_0x8688('0x8'));var Vertices=require(_0x8688('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8688('0x6')]=_[_0x8688('0xa')](config[_0x8688('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x457991){process[_0x8688('0xb')](function(){syncho(function(){try{setChannelVariables(_0x457991);agiHandler(_0x457991);}catch(_0x24a82b){logger[_0x8688('0xc')](_0x24a82b[_0x8688('0xd')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x8688('0x6')][_0x8688('0xe')]);logger[_0x8688('0xf')](util[_0x8688('0x10')](_0x8688('0x11'),config[_0x8688('0x6')]['ip'],config[_0x8688('0x6')][_0x8688('0xe')]));}function errorHandler(_0x3addbe){if(_0x3addbe&&_0x3addbe['name']&&_0x3addbe[_0x8688('0x12')]){logger[_0x8688('0xc')](util[_0x8688('0x10')](_0x8688('0x13'),_0x3addbe[_0x8688('0x14')],_0x3addbe[_0x8688('0x12')]));}else{logger[_0x8688('0xc')](util[_0x8688('0x10')](_0x8688('0x15'),_0x3addbe[_0x8688('0xd')]));}}function closeHandler(){logger[_0x8688('0xf')](util[_0x8688('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x8688('0x16')],this[_0x8688('0x17')],this[_0x8688('0x18')],this[_0x8688('0x19')],this[_0x8688('0x1a')]));try{createSquareReport(this);}catch(_0x13ee31){logger[_0x8688('0xc')](_0x13ee31['stack']);}}function timeoutHandler(){logger['info'](util[_0x8688('0x10')](_0x8688('0x1b'),this['arg_1'],this['calleridname'],this[_0x8688('0x18')],this[_0x8688('0x19')],this[_0x8688('0x1a')]));}function hangupHandler(){logger[_0x8688('0xf')](util[_0x8688('0x10')](_0x8688('0x1c'),this[_0x8688('0x16')],this[_0x8688('0x17')],this[_0x8688('0x18')],this['dnid'],this[_0x8688('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x32d195){return parser[_0x8688('0x1d')](_0x32d195,{'object':!![]})['mxGraphModel'][_0x8688('0x1e')];}function addVertex(_0x4d80ca,_0x3ca828,_0x3e92cd){_0x3ca828[_0x8688('0x1f')]=_0x3e92cd;if(_0x3ca828[_0x8688('0x20')](_0x8688('0x21'))){_0x3ca828[_0x8688('0x22')]=parseInt(_0x3ca828[_0x8688('0x21')],0xa);}_0x4d80ca[_0x8688('0x23')](_['omit'](_0x3ca828,_0x8688('0x24')));}function initGraph(_0x1447d8,_0x196d50){var _0x2f2707=new Graph();for(var _0x4d4b9c in _0x1447d8){if(_0x1447d8[_0x8688('0x20')](_0x4d4b9c)){if(_[_0x8688('0x25')](_0x1447d8[_0x4d4b9c])){for(var _0xa73617=0x0;_0xa73617<_0x1447d8[_0x4d4b9c]['length'];_0xa73617+=0x1){addVertex(_0x2f2707,_0x1447d8[_0x4d4b9c][_0xa73617],_0x4d4b9c);}}else{addVertex(_0x2f2707,_0x1447d8[_0x4d4b9c],_0x4d4b9c);}}}for(var _0xb05d4a=0x0;_0xb05d4a<_0x196d50[_0x8688('0x26')];_0xb05d4a+=0x1){if(_0x196d50[_0xb05d4a][_0x8688('0x27')]&&_0x196d50[_0xb05d4a]['target']){_0x2f2707[_0x8688('0x28')](_0x196d50[_0xb05d4a]['source'],_0x196d50[_0xb05d4a]['target'],_0x196d50[_0xb05d4a]['value']);}}return _0x2f2707;}function getSquareProject(_0x21ee40,_0xb2d183){rpc[_0x8688('0x29')](_0x21ee40)['then'](function(_0x203814){_0xb2d183(null,_0x203814);})[_0x8688('0x2a')](function(_0xc3c53f){_0xb2d183(null,_0xc3c53f);});}function createSquareReport(_0x2fabfa,_0x1af3d5){rpc[_0x8688('0x2b')](_0x2fabfa)[_0x8688('0x2c')](function(_0x35f4a6){if(_0x1af3d5){_0x1af3d5(null,_0x35f4a6);}})[_0x8688('0x2a')](function(_0x11f071){if(_0x1af3d5){_0x1af3d5(null,_0x11f071);}});}function setChannelVariables(_0x1d6726){for(var _0x574925 in _0x1d6726){if(_0x1d6726[_0x8688('0x20')](_0x574925)){if(_0x574925['indexOf'](_0x8688('0x2d'))===0x0){_0x1d6726[_0x574925[_0x8688('0x2e')](0x4)]=_0x1d6726[_0x574925];delete _0x1d6726[_0x574925];}}}}function getLogFromObject(_0x49afeb){return util[_0x8688('0x2f')](_0x49afeb,{'showHidden':![],'depth':null});}function agiHandler(_0x2854fc){var _0x53b388,_0x52fb83,_0x3336ac,_0x15ceb6,_0x1ed2cf;logger['debug']('variables',JSON[_0x8688('0x30')](_0x2854fc,null,0x2));logger[_0x8688('0xf')](util[_0x8688('0x10')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2854fc['arg_1'],_0x2854fc[_0x8688('0x17')],_0x2854fc[_0x8688('0x18')],_0x2854fc[_0x8688('0x19')],_0x2854fc[_0x8688('0x1a')]));_0x2854fc['on'](_0x8688('0xc'),errorHandler);_0x2854fc['on'](_0x8688('0x31'),closeHandler);_0x2854fc['on'](_0x8688('0x32'),timeoutHandler);_0x2854fc['evtHangup']=![];_0x2854fc['on'](_0x8688('0x33'),hangupHandler);var _0xeb257d=getSquareProject['sync'](null,_0x2854fc[_0x8688('0x16')]);if(_0xeb257d){if(_0xeb257d[_0x8688('0x34')]){_0x53b388=getRoot(_0xeb257d[_0x8688('0x34')]);console[_0x8688('0x35')](_0x8688('0x36'),_0x53b388);if(_0x53b388&&_0x53b388[_0x8688('0x37')]){logger[_0x8688('0x38')](_0x8688('0x1e'),JSON['stringify'](_0x53b388,null,0x2));_0x2854fc[_0x8688('0x39')]=moment()['format'](_0x8688('0x3a'));_0x52fb83=initGraph(_['omit'](_0x53b388,_0x8688('0x24')),_0x53b388[_0x8688('0x24')]);_0x3336ac=new Vertices(_0x2854fc,rpc,mailRpc);console[_0x8688('0x35')](_0x8688('0x3b'),_0x3336ac);logger['info'](util[_0x8688('0x10')](_0x8688('0x3c'),_0x2854fc[_0x8688('0x16')],_0x2854fc['calleridname'],_0x2854fc[_0x8688('0x18')],_0x2854fc[_0x8688('0x19')],_0x2854fc[_0x8688('0x1a')]));console[_0x8688('0x35')](_0x8688('0x3d'));_0x52fb83[_0x8688('0x3e')](_0x53b388[_0x8688('0x37')]['id'],function(_0x3e593a){try{_0x3e593a=_0x3336ac[_0x8688('0x3f')](_0x3e593a);logger[_0x8688('0x38')]('vertex',JSON['stringify'](_0x3e593a,null,0x2));console['log'](_0x8688('0x40'),_0x3e593a);if(_0x3e593a[_0x8688('0x1f')]===_0x8688('0x41')){logger[_0x8688('0xf')](_0x8688('0x42'));_0x2854fc[_0x8688('0x43')]=_0x3e593a[_0x8688('0x43')]||_0x2854fc['context'];_0x2854fc[_0x8688('0x44')]=_0x3e593a[_0x8688('0x44')];_0x2854fc[_0x8688('0x45')]=_0x3e593a['priority']?_0x3e593a[_0x8688('0x45')]-0x1:0x1;return null;}else if(_0x3e593a&&_0x3336ac[_0x3e593a[_0x8688('0x1f')]]){_0x1ed2cf=_0x3336ac[_0x3e593a[_0x8688('0x1f')]](_0x3e593a);console[_0x8688('0x35')](_0x8688('0x46'),_0x1ed2cf);logger[_0x8688('0xf')](_0x8688('0x47'),JSON[_0x8688('0x30')](_0x1ed2cf,null,0x2));if(_0x1ed2cf&&_0x1ed2cf[_0x8688('0x48')]===AGI_CODE_SUCCESS&&_0x1ed2cf[_0x8688('0x49')]!==AGI_RESULT_ERROR&&!_0x2854fc[_0x8688('0x4a')]){logger[_0x8688('0x38')](_0x8688('0x47'),getLogFromObject(_0x1ed2cf));return _[_0x8688('0x4b')](_0x1ed2cf[_0x8688('0x49')])?null:_0x1ed2cf[_0x8688('0x49')][_0x8688('0x4c')]();}else{logger[_0x8688('0xc')]('response',getLogFromObject(_0x1ed2cf));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x2ea67c){logger[_0x8688('0xc')](_0x2ea67c['stack']);return null;}});if(_0x53b388[_0x8688('0x4d')]){logger['info'](util[_0x8688('0x10')](_0x8688('0x4e'),_0x2854fc[_0x8688('0x16')],_0x2854fc[_0x8688('0x17')],_0x2854fc[_0x8688('0x18')],_0x2854fc['dnid'],_0x2854fc['uniqueid']));_0x52fb83[_0x8688('0x3e')](_0x53b388[_0x8688('0x4d')]['id'],function(_0x42a41f){try{_0x42a41f=_0x3336ac[_0x8688('0x3f')](_0x42a41f);logger[_0x8688('0x38')](_0x8688('0x4f'),JSON['stringify'](_0x42a41f,null,0x2));if(_0x42a41f&&_0x3336ac[_0x42a41f[_0x8688('0x1f')]]){_0x1ed2cf=_0x3336ac[_0x42a41f['agicommand']](_0x42a41f);if(_0x1ed2cf){logger[_0x8688('0x38')](_0x8688('0x47'),getLogFromObject(_0x1ed2cf));return _['isUndefined'](_0x1ed2cf['result'])?null:_0x1ed2cf[_0x8688('0x49')]['toString']();}else{logger['error'](_0x8688('0x47'),getLogFromObject(_0x1ed2cf));return null;}}else{logger[_0x8688('0xc')](_0x8688('0x50'));return null;}}catch(_0x40b01b){logger[_0x8688('0xc')](_0x40b01b[_0x8688('0xd')]);return null;}});}logger[_0x8688('0xf')](util[_0x8688('0x10')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2854fc[_0x8688('0x16')],_0x2854fc[_0x8688('0x17')],_0x2854fc[_0x8688('0x18')],_0x2854fc[_0x8688('0x19')],_0x2854fc[_0x8688('0x1a')]));logger[_0x8688('0xf')](util[_0x8688('0x10')](_0x8688('0x51'),_0x2854fc[_0x8688('0x43')],_0x2854fc['extension'],parseInt(_0x2854fc[_0x8688('0x45')],0xa)+0x1));_0x2854fc[_0x8688('0x52')](_0x2854fc[_0x8688('0x43')],_0x2854fc[_0x8688('0x44')],parseInt(_0x2854fc[_0x8688('0x45')],0xa)+0x1);_0x2854fc[_0x8688('0x31')]();}}else{logger[_0x8688('0xc')](util[_0x8688('0x10')](_0x8688('0x53'),_0x2854fc[_0x8688('0x16')]));_0x2854fc[_0x8688('0x52')](_0x2854fc[_0x8688('0x43')],_0x2854fc[_0x8688('0x44')],parseInt(_0x2854fc[_0x8688('0x45')],0xa)+0x1);_0x2854fc[_0x8688('0x31')]();}}else{logger['error'](util[_0x8688('0x10')](_0x8688('0x54'),_0x2854fc[_0x8688('0x16')]));_0x2854fc[_0x8688('0x52')](_0x2854fc[_0x8688('0x43')],_0x2854fc[_0x8688('0x44')],parseInt(_0x2854fc[_0x8688('0x45')],0xa)+0x1);_0x2854fc[_0x8688('0x31')]();}}function main(){var _0xe31fd0;return utilLicense[_0x8688('0x55')]()[_0x8688('0x2c')](function(_0x245a04){if(_0x245a04){if(_0x245a04[_0x8688('0x56')]){if(_0x245a04[_0x8688('0x57')]&&_0x245a04[_0x8688('0x57')]>0x0){logger[_0x8688('0xf')](util['format'](_0x8688('0x58'),_0x245a04[_0x8688('0x57')]));_0xe31fd0=_0x245a04[_0x8688('0x57')];}else{logger['info'](_0x8688('0x59'));}}else{logger[_0x8688('0xf')](_0x8688('0x5a'));_0xe31fd0=-0x1;}}})['catch'](function(_0x46d70e){logger[_0x8688('0xc')]('[LICENSE]',_0x46d70e[_0x8688('0xd')]);})['finally'](function(){var _0x19dd45=require(_0x8688('0x5b'))(config['agi'][_0x8688('0xe')],config['agi']['ip'],_0xe31fd0);_0x19dd45['on']('error',errorHandler);_0x19dd45['on'](_0x8688('0x5c'),listeningHandler);_0x19dd45['on'](_0x8688('0x5d'),connectionHandler);_0x19dd45['on'](_0x8688('0x31'),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 578fc98..67e2cb2 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x4cbe64,_0x215c95){var _0x4f9e12=function(_0x47620c){while(--_0x47620c){_0x4cbe64['push'](_0x4cbe64['shift']());}};_0x4f9e12(++_0x215c95);}(_0x814b,0x1a2));var _0xb814=function(_0x5a585b,_0x3e0674){_0x5a585b=_0x5a585b-0x0;var _0x4cd398=_0x814b[_0x5a585b];return _0x4cd398;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x47f141,_0x56c535){var _0x35fb52=function(_0x1f4c0a){while(--_0x1f4c0a){_0x47f141['push'](_0x47f141['shift']());}};_0x35fb52(++_0x56c535);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 63b2302..a743c3a 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a7f3c,_0x74b703){_0x4a7f3c=_0x4a7f3c-0x0;var _0x89d3ae=_0xb10b[_0x4a7f3c];return _0x89d3ae;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _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(_0x5ea94c,_0x19937b){var _0xededd7=function(_0x27d10e){while(--_0x27d10e){_0x5ea94c['push'](_0x5ea94c['shift']());}};_0xededd7(++_0x19937b);}(_0xb10b,0x12a));var _0xbb10=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xb10b[_0x50a004];return _0x5e9992;};'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 d660dbb..b95a797 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 _0xc224=['arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','moment','lodash','util','client','http','request','error','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc224,0xe4));var _0x4c22=function(_0x32ed0,_0x6fac0b){_0x32ed0=_0x32ed0-0x0;var _0xd9484a=_0xc224[_0x32ed0];return _0xd9484a;};'use strict';var BPromise=require(_0x4c22('0x0'));var moment=require(_0x4c22('0x1'));var _=require(_0x4c22('0x2'));var util=require(_0x4c22('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x4c22('0x4')][_0x4c22('0x5')]({'port':0x2329});function request(_0x141143,_0x50e3c8){return new BPromise(function(_0x31a9a2,_0x57b38d){return client[_0x4c22('0x6')](_0x141143,_0x50e3c8)['then'](function(_0x4b2aa2){if(_0x4b2aa2[_0x4c22('0x7')]){return _0x57b38d(_0x4b2aa2[_0x4c22('0x7')][_0x4c22('0x8')]);}else{return _0x31a9a2(_0x4b2aa2['result']);}})[_0x4c22('0x9')](function(_0xa1eefd){return _0x57b38d(_0xa1eefd);});});}exports[_0x4c22('0xa')]=function(_0x1aadaa){return request(_0x4c22('0xb'),{'options':{'raw':![],'where':{'name':_0x1aadaa},'attributes':[_0x4c22('0xc')]}});};exports[_0x4c22('0xd')]=function(_0x563300){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x563300},'include':[{'model':_0x4c22('0xe'),'as':'Smtp'}],'attributes':['id',_0x4c22('0xf'),_0x4c22('0x10')]}});};exports[_0x4c22('0x11')]=function(_0x41aaee){return request(_0x4c22('0xb'),{'options':{'where':{'id':_0x41aaee},'attributes':[_0x4c22('0xf')]}});};exports[_0x4c22('0x12')]=function(_0x260be9){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x260be9},'attributes':[_0x4c22('0xf')]}});};exports[_0x4c22('0x13')]=function(_0x48cb4b){return request(_0x4c22('0x14'),{'options':{'where':{'id':_0x48cb4b},'attributes':['name']}});};exports[_0x4c22('0x15')]=function(_0x43eb7c){return request(_0x4c22('0x16'),{'options':{'where':{'id':_0x43eb7c},'attributes':['dsn']}});};exports[_0x4c22('0x17')]=function(_0x2f0a1c){return request(_0x4c22('0x18'),{'options':{'where':{'id':_0x2f0a1c},'attributes':[_0x4c22('0xf')]}});};exports[_0x4c22('0x19')]=function(_0x2718bf){return request(_0x4c22('0x1a'),{'options':{'where':{'id':_0x2718bf},'attributes':['name']}});};exports[_0x4c22('0x1b')]=function(_0x2ae2f6){return request('ShowSound',{'options':{'where':{'id':_0x2ae2f6},'attributes':[_0x4c22('0x1c')]}});};exports[_0x4c22('0x1d')]=function(_0x16a980){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x16a980},'include':[{'model':_0x4c22('0x1e'),'as':_0x4c22('0x1f')}]}});};exports[_0x4c22('0x20')]=function(_0x5e38cb){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5e38cb},'attributes':['id','name']}});};exports[_0x4c22('0x21')]=function(_0x20cdaa){return request('CreateSmsMessage',{'body':_0x20cdaa});};exports[_0x4c22('0x22')]=function(_0x43f89b){return request('CreateSquareDetailsReport',{'body':_0x43f89b});};exports[_0x4c22('0x23')]=function(_0x278650){return request(_0x4c22('0x24'),{'body':_['merge'](_0x278650,{'project_name':_0x278650[_0x4c22('0x25')],'prev_project_name':_0x278650[_0x4c22('0x26')]||'','is_subproject':_0x278650[_0x4c22('0x26')]?!![]:![],'leaveAt':moment()[_0x4c22('0x27')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x4c22('0x28')]=function(_0xe52132){return request(_0x4c22('0x29'),{'body':_0xe52132});};exports[_0x4c22('0x2a')]=function(_0x41df64){return request(_0x4c22('0x2b'),{'body':_0x41df64});};exports[_0x4c22('0x2c')]=function(_0x9292c6){return request(_0x4c22('0x2d'),{'options':{'raw':![],'where':{'phone':_0x9292c6[_0x4c22('0x2e')],'ListId':_0x9292c6['ListId']}}})['then'](function(_0x550035){if(_0x550035){return _0x550035;}return request('CreateCmContact',{'body':_0x9292c6});});};exports[_0x4c22('0x2f')]=function(_0x328284){return request(_0x4c22('0x30'),{'options':{'where':{'id':_0x328284},'attributes':[_0x4c22('0xf')]}});};exports['agentLogin']=function(_0x55eeb9,_0x51fb87){return request('LoginUser',{'body':{'interface':_0x51fb87},'options':{'where':_0x55eeb9}});};exports[_0x4c22('0x31')]=function(_0x27cb0b,_0x19b830,_0x366e40){return request(_0x4c22('0x32'),{'body':{'type':_0x19b830,'uniqueid':_0x366e40},'options':{'where':_0x27cb0b}});};exports[_0x4c22('0x33')]=function(_0x30486c){return request('UnpauseUser',{'body':{},'options':{'where':_0x30486c}});};exports[_0x4c22('0x34')]=function(_0x9f974e){return request('LogoutUser',{'body':{},'options':{'where':_0x9f974e}});}; \ No newline at end of file +var _0x31ec=['jayson/promise','client','error','result','getSquareProject','ShowSquareProject','production','ShowMailAccount','Smtp','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','LogoutUser','bluebird','moment','util'];(function(_0x30f87a,_0x2cce5a){var _0x3a8efc=function(_0x225d6b){while(--_0x225d6b){_0x30f87a['push'](_0x30f87a['shift']());}};_0x3a8efc(++_0x2cce5a);}(_0x31ec,0x110));var _0xc31e=function(_0x24c6df,_0x4f12b0){_0x24c6df=_0x24c6df-0x0;var _0x229765=_0x31ec[_0x24c6df];return _0x229765;};'use strict';var BPromise=require(_0xc31e('0x0'));var moment=require(_0xc31e('0x1'));var _=require('lodash');var util=require(_0xc31e('0x2'));var jayson=require(_0xc31e('0x3'));var client=jayson[_0xc31e('0x4')]['http']({'port':0x2329});function request(_0x2142b6,_0x231fd4){return new BPromise(function(_0x3ca301,_0x3b9b02){return client['request'](_0x2142b6,_0x231fd4)['then'](function(_0x392369){if(_0x392369['error']){return _0x3b9b02(_0x392369[_0xc31e('0x5')]['message']);}else{return _0x3ca301(_0x392369[_0xc31e('0x6')]);}})['catch'](function(_0x98f8f1){return _0x3b9b02(_0x98f8f1);});});}exports[_0xc31e('0x7')]=function(_0x459f47){return request(_0xc31e('0x8'),{'options':{'raw':![],'where':{'name':_0x459f47},'attributes':[_0xc31e('0x9')]}});};exports['getMailAccountById']=function(_0x294cd0){return request(_0xc31e('0xa'),{'options':{'raw':![],'where':{'id':_0x294cd0},'include':[{'model':'MailServerOut','as':_0xc31e('0xb')}],'attributes':['id','name',_0xc31e('0xc')]}});};exports[_0xc31e('0xd')]=function(_0x1e17dc){return request(_0xc31e('0x8'),{'options':{'where':{'id':_0x1e17dc},'attributes':['name']}});};exports[_0xc31e('0xe')]=function(_0x4c82c5){return request(_0xc31e('0xf'),{'options':{'where':{'id':_0x4c82c5},'attributes':[_0xc31e('0x10')]}});};exports[_0xc31e('0x11')]=function(_0x5e6233){return request(_0xc31e('0x12'),{'options':{'where':{'id':_0x5e6233},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x5344cd){return request(_0xc31e('0x13'),{'options':{'where':{'id':_0x5344cd},'attributes':[_0xc31e('0x14')]}});};exports['getUserById']=function(_0x50cfef){return request(_0xc31e('0x15'),{'options':{'where':{'id':_0x50cfef},'attributes':[_0xc31e('0x10')]}});};exports[_0xc31e('0x16')]=function(_0x5d4e93){return request(_0xc31e('0x17'),{'options':{'where':{'id':_0x5d4e93},'attributes':[_0xc31e('0x10')]}});};exports[_0xc31e('0x18')]=function(_0x5438a6){return request(_0xc31e('0x19'),{'options':{'where':{'id':_0x5438a6},'attributes':[_0xc31e('0x1a')]}});};exports[_0xc31e('0x1b')]=function(_0x3d48af){return request(_0xc31e('0x1c'),{'options':{'raw':![],'where':{'id':_0x3d48af},'include':[{'model':'Interval','as':_0xc31e('0x1d')}]}});};exports[_0xc31e('0x1e')]=function(_0x307e03){return request(_0xc31e('0x1f'),{'options':{'where':{'id':_0x307e03},'attributes':['id',_0xc31e('0x10')]}});};exports[_0xc31e('0x20')]=function(_0x5dd868){return request(_0xc31e('0x21'),{'body':_0x5dd868});};exports[_0xc31e('0x22')]=function(_0x45a1ac){return request(_0xc31e('0x23'),{'body':_0x45a1ac});};exports[_0xc31e('0x24')]=function(_0xc2999){return request('CreateSquareReport',{'body':_[_0xc31e('0x25')](_0xc2999,{'project_name':_0xc2999[_0xc31e('0x26')],'prev_project_name':_0xc2999[_0xc31e('0x27')]||'','is_subproject':_0xc2999['arg_2']?!![]:![],'leaveAt':moment()[_0xc31e('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xc31e('0x29')]=function(_0xc7ffb9){return request('CreateSquareRecording',{'body':_0xc7ffb9});};exports[_0xc31e('0x2a')]=function(_0x1e2dc4){return request(_0xc31e('0x2b'),{'body':_0x1e2dc4});};exports['createCmContact']=function(_0x36cfa9){return request(_0xc31e('0x2c'),{'options':{'raw':![],'where':{'phone':_0x36cfa9[_0xc31e('0x2d')],'ListId':_0x36cfa9[_0xc31e('0x2e')]}}})[_0xc31e('0x2f')](function(_0x3c2970){if(_0x3c2970){return _0x3c2970;}return request(_0xc31e('0x30'),{'body':_0x36cfa9});});};exports[_0xc31e('0x31')]=function(_0x3cc8f9){return request(_0xc31e('0x32'),{'options':{'where':{'id':_0x3cc8f9},'attributes':[_0xc31e('0x10')]}});};exports['agentLogin']=function(_0x3e7e10,_0x54ed9f){return request('LoginUser',{'body':{'interface':_0x54ed9f},'options':{'where':_0x3e7e10}});};exports[_0xc31e('0x33')]=function(_0x5226aa,_0x2f9a5d,_0x31804e){return request(_0xc31e('0x34'),{'body':{'type':_0x2f9a5d,'uniqueid':_0x31804e},'options':{'where':_0x5226aa}});};exports[_0xc31e('0x35')]=function(_0x554c3b){return request('UnpauseUser',{'body':{},'options':{'where':_0x554c3b}});};exports['agentLogout']=function(_0x19d727){return request(_0xc31e('0x36'),{'body':{},'options':{'where':_0x19d727}});}; \ 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 d80fc89..d0777b1 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 _0x7bae=['exports'];(function(_0x248be0,_0x189220){var _0x2cafb0=function(_0x4a3e98){while(--_0x4a3e98){_0x248be0['push'](_0x248be0['shift']());}};_0x2cafb0(++_0x189220);}(_0x7bae,0x13b));var _0xe7ba=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7bae[_0x15bc81];return _0x59440e;};var polly=require('./polly');var lex=require('./lex');module[_0xe7ba('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xbb53=['exports','./polly','./lex'];(function(_0x5a1d78,_0x14975c){var _0x36f850=function(_0x6b038c){while(--_0x6b038c){_0x5a1d78['push'](_0x5a1d78['shift']());}};_0x36f850(++_0x14975c);}(_0xbb53,0x121));var _0x3bb5=function(_0x2e057a,_0x399f37){_0x2e057a=_0x2e057a-0x0;var _0x10c9f3=_0xbb53[_0x2e057a];return _0x10c9f3;};var polly=require(_0x3bb5('0x0'));var lex=require(_0x3bb5('0x1'));module[_0x3bb5('0x2')]={'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 ad77c51..214dd7e 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 _0x34e8=['./lib/api','exports'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x34e8,0x12c));var _0x834e=function(_0xe8fd19,_0x6356f1){_0xe8fd19=_0xe8fd19-0x0;var _0x4d5f1f=_0x34e8[_0xe8fd19];return _0x4d5f1f;};'use strict';var lex=require(_0x834e('0x0'));module[_0x834e('0x1')]=function(_0x8b339,_0x35e6fb,_0x530939,_0x832422,_0x21e2e0,_0x472111){return lex(_0x8b339,_0x35e6fb,_0x530939,_0x832422,_0x21e2e0,_0x472111);}; \ No newline at end of file +var _0x07c3=['exports','./lib/api'];(function(_0x5c7fd7,_0x382a4f){var _0x13d55e=function(_0x4aeaf4){while(--_0x4aeaf4){_0x5c7fd7['push'](_0x5c7fd7['shift']());}};_0x13d55e(++_0x382a4f);}(_0x07c3,0x1bf));var _0x307c=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x07c3[_0x599e60];return _0x468e19;};'use strict';var lex=require(_0x307c('0x0'));module[_0x307c('0x1')]=function(_0x44b77c,_0xc54e42,_0x39fd38,_0x8b0b1c,_0x3b8f6e,_0x186b09){return lex(_0x44b77c,_0xc54e42,_0x39fd38,_0x8b0b1c,_0x3b8f6e,_0x186b09);}; \ 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 b02a4f8..4413c3a 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 _0x9679=['hasOwnProperty','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0xf870d9,_0x398c01){var _0x33b1f5=function(_0x4b9ddf){while(--_0x4b9ddf){_0xf870d9['push'](_0xf870d9['shift']());}};_0x33b1f5(++_0x398c01);}(_0x9679,0xb2));var _0x9967=function(_0x59c19c,_0x282536){_0x59c19c=_0x59c19c-0x0;var _0x4e7cf1=_0x9679[_0x59c19c];return _0x4e7cf1;};'use strict';var BPromise=require(_0x9967('0x0'));var AWS=require(_0x9967('0x1'));function lexResult(_0x3111f9,_0x2a375e){return new BPromise(function(_0x48412d,_0x55c797){_0x3111f9[_0x9967('0x2')](_0x2a375e,function(_0x186912,_0x496a60){if(_0x186912){_0x55c797(_0x186912);}if(_0x496a60['slots']){for(const _0x160981 in _0x496a60['slots']){if(_0x496a60[_0x9967('0x3')][_0x9967('0x4')](_0x160981)){var _0x1ebe49=_0x496a60[_0x9967('0x3')][_0x160981];_0x496a60['slot_'+_0x160981]=_0x1ebe49;}}}_0x48412d(_0x496a60);});});}module['exports']=function(_0x24235f,_0x24b9a3,_0x10046e,_0x315a46,_0x51fc0e,_0x2fad13){var _0x26d92c=new AWS[(_0x9967('0x5'))]({'accessKeyId':_0x24b9a3,'secretAccessKey':_0x10046e,'region':_0x315a46});var _0x545639={'botAlias':_0x9967('0x6'),'botName':_0x2fad13,'inputText':_0x51fc0e,'userId':_0x24235f};return lexResult(_0x26d92c,_0x545639);}; \ No newline at end of file +var _0xdc4b=['slots','hasOwnProperty','slot_','LexRuntime','$LATEST','aws-sdk','postText'];(function(_0x5af382,_0x5a4a63){var _0x1b3821=function(_0x3e9093){while(--_0x3e9093){_0x5af382['push'](_0x5af382['shift']());}};_0x1b3821(++_0x5a4a63);}(_0xdc4b,0xa6));var _0xbdc4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdc4b[_0x19950b];return _0x3c6b41;};'use strict';var BPromise=require('bluebird');var AWS=require(_0xbdc4('0x0'));function lexResult(_0x5abb0b,_0x36626e){return new BPromise(function(_0x2041e9,_0xd21b35){_0x5abb0b[_0xbdc4('0x1')](_0x36626e,function(_0xb8b17f,_0x390558){if(_0xb8b17f){_0xd21b35(_0xb8b17f);}if(_0x390558[_0xbdc4('0x2')]){for(const _0x503612 in _0x390558[_0xbdc4('0x2')]){if(_0x390558['slots'][_0xbdc4('0x3')](_0x503612)){var _0x2c9285=_0x390558[_0xbdc4('0x2')][_0x503612];_0x390558[_0xbdc4('0x4')+_0x503612]=_0x2c9285;}}}_0x2041e9(_0x390558);});});}module['exports']=function(_0x50bfe0,_0x4c8c00,_0x5388,_0x3a6f6b,_0x309215,_0x3288b6){var _0x20a12f=new AWS[(_0xbdc4('0x5'))]({'accessKeyId':_0x4c8c00,'secretAccessKey':_0x5388,'region':_0x3a6f6b});var _0x3ee180={'botAlias':_0xbdc4('0x6'),'botName':_0x3288b6,'inputText':_0x309215,'userId':_0x50bfe0};return lexResult(_0x20a12f,_0x3ee180);}; \ 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 00aee7f..9232257 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 _0x80d1=['./lib/api','exports'];(function(_0x3455ff,_0x27cc30){var _0x231fcc=function(_0x2ddafe){while(--_0x2ddafe){_0x3455ff['push'](_0x3455ff['shift']());}};_0x231fcc(++_0x27cc30);}(_0x80d1,0x1d0));var _0x180d=function(_0x4c7690,_0xe81f9e){_0x4c7690=_0x4c7690-0x0;var _0x41150c=_0x80d1[_0x4c7690];return _0x41150c;};'use strict';var polly=require(_0x180d('0x0'));module[_0x180d('0x1')]=function(_0x43f271,_0x5023d4,_0x2233af,_0x17bacf,_0x52a223,_0x4e931c,_0x161b5b){return polly(_0x43f271,_0x5023d4,_0x2233af,_0x17bacf,_0x52a223,_0x4e931c,_0x161b5b);}; \ No newline at end of file +var _0x9af5=['exports','./lib/api'];(function(_0xf46a82,_0x7002d6){var _0x5befba=function(_0x316463){while(--_0x316463){_0xf46a82['push'](_0xf46a82['shift']());}};_0x5befba(++_0x7002d6);}(_0x9af5,0xc9));var _0x59af=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9af5[_0x2641f9];return _0x585741;};'use strict';var polly=require(_0x59af('0x0'));module[_0x59af('0x1')]=function(_0x21bbaf,_0x58840f,_0x32fc37,_0x1d8ef0,_0x13b01d,_0x1806c1,_0x392fc6){return polly(_0x21bbaf,_0x58840f,_0x32fc37,_0x1d8ef0,_0x13b01d,_0x1806c1,_0x392fc6);}; \ 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 3304ffa..f716076 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 _0x1d0c=['text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x45eda2,_0x5e5d3d){var _0x244ab1=function(_0x24ad17){while(--_0x24ad17){_0x45eda2['push'](_0x45eda2['shift']());}};_0x244ab1(++_0x5e5d3d);}(_0x1d0c,0x173));var _0xc1d0=function(_0x55d48c,_0x4509f5){_0x55d48c=_0x55d48c-0x0;var _0x106352=_0x1d0c[_0x55d48c];return _0x106352;};'use strict';var fs=require('fs');var path=require(_0xc1d0('0x0'));var BPromise=require(_0xc1d0('0x1'));var rs=require(_0xc1d0('0x2'));var AWS=require(_0xc1d0('0x3'));function pollyResult(_0x7d6ca7,_0x2c6281,_0x1abeb5){return new BPromise(function(_0x4afc3c,_0x3cabd7){_0x7d6ca7[_0xc1d0('0x4')](_0x2c6281,function(_0x3364c3,_0x3ac96b){if(_0x3364c3){_0x3cabd7(_0x3364c3);}else if(_0x3ac96b){if(_0x3ac96b[_0xc1d0('0x5')]instanceof Buffer){fs[_0xc1d0('0x6')](_0x1abeb5,_0x3ac96b['AudioStream'],function(_0x46798e){if(_0x46798e){_0x3cabd7(_0x46798e);}else{_0x4afc3c();}});}else{_0x3cabd7(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3cabd7(new Error(_0xc1d0('0x7')));}});});}module['exports']=function(_0x18fd9b,_0x5c20f2,_0x313365,_0xf3552a,_0x5aafc6,_0x508d53,_0x2c31c0){var _0x30f736=new AWS[(_0xc1d0('0x8'))]({'accessKeyId':_0x18fd9b,'secretAccessKey':_0x5c20f2,'region':_0x313365});var _0x591957={'Text':_0x5aafc6,'TextType':_0x508d53||_0xc1d0('0x9'),'OutputFormat':'mp3','VoiceId':_0xf3552a};return pollyResult(_0x30f736,_0x591957,_0x2c31c0);}; \ No newline at end of file +var _0x1d93=['synthesizeSpeech','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x1b314c,_0x5d18f0){var _0x8d807b=function(_0x5c28ae){while(--_0x5c28ae){_0x1b314c['push'](_0x1b314c['shift']());}};_0x8d807b(++_0x5d18f0);}(_0x1d93,0x80));var _0x31d9=function(_0x28db16,_0x31b243){_0x28db16=_0x28db16-0x0;var _0x5524b5=_0x1d93[_0x28db16];return _0x5524b5;};'use strict';var fs=require('fs');var path=require(_0x31d9('0x0'));var BPromise=require(_0x31d9('0x1'));var rs=require(_0x31d9('0x2'));var AWS=require(_0x31d9('0x3'));function pollyResult(_0x4c8409,_0x4d5f0d,_0x569ce2){return new BPromise(function(_0x4100e1,_0x313a26){_0x4c8409[_0x31d9('0x4')](_0x4d5f0d,function(_0x23e969,_0x1603f8){if(_0x23e969){_0x313a26(_0x23e969);}else if(_0x1603f8){if(_0x1603f8['AudioStream']instanceof Buffer){fs[_0x31d9('0x5')](_0x569ce2,_0x1603f8['AudioStream'],function(_0x2b43fe){if(_0x2b43fe){_0x313a26(_0x2b43fe);}else{_0x4100e1();}});}else{_0x313a26(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x313a26(new Error(_0x31d9('0x6')));}});});}module[_0x31d9('0x7')]=function(_0x5d374c,_0xaf5c77,_0x3655ea,_0x102cbb,_0x2fae96,_0x2ca9b8,_0xc26cbb){var _0x19ec9f=new AWS[(_0x31d9('0x8'))]({'accessKeyId':_0x5d374c,'secretAccessKey':_0xaf5c77,'region':_0x3655ea});var _0x42d1b3={'Text':_0x2fae96,'TextType':_0x2ca9b8||_0x31d9('0x9'),'OutputFormat':_0x31d9('0xa'),'VoiceId':_0x102cbb};return pollyResult(_0x19ec9f,_0x42d1b3,_0xc26cbb);}; \ 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 1702449..1552099 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 _0x9e10=['exports'];(function(_0x328b24,_0x148f7b){var _0x37add1=function(_0x1b4edf){while(--_0x1b4edf){_0x328b24['push'](_0x328b24['shift']());}};_0x37add1(++_0x148f7b);}(_0x9e10,0x10e));var _0x09e1=function(_0xacc73c,_0x49139c){_0xacc73c=_0xacc73c-0x0;var _0x2a0de4=_0x9e10[_0xacc73c];return _0x2a0de4;};'use strict';var asr=require('./lib/api');module[_0x09e1('0x0')]=function(_0x522097,_0x11fcac,_0x4cb9d8,_0x516eab){return asr(_0x522097,_0x11fcac,_0x4cb9d8);}; \ No newline at end of file +var _0x33d5=['exports','./lib/api'];(function(_0x3bed2e,_0x2e85dd){var _0x422c4c=function(_0x3fc287){while(--_0x3fc287){_0x3bed2e['push'](_0x3bed2e['shift']());}};_0x422c4c(++_0x2e85dd);}(_0x33d5,0x7b));var _0x533d=function(_0x37ed96,_0x48a102){_0x37ed96=_0x37ed96-0x0;var _0x12f276=_0x33d5[_0x37ed96];return _0x12f276;};'use strict';var asr=require(_0x533d('0x0'));module[_0x533d('0x1')]=function(_0xb2befe,_0x578939,_0x2ed108,_0x2e7e91){return asr(_0xb2befe,_0x578939,_0x2ed108);}; \ 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 8be1ecd..2427ed8 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 _0xae1f=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x476fd7,_0x4da717){var _0x49dfe7=function(_0x15f078){while(--_0x15f078){_0x476fd7['push'](_0x476fd7['shift']());}};_0x49dfe7(++_0x4da717);}(_0xae1f,0x1ad));var _0xfae1=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xae1f[_0xd1d19a];return _0x52a79d;};'use strict';var url=require(_0xfae1('0x0'));var BPromise=require(_0xfae1('0x1'));var fs=require('fs');var host=_0xfae1('0x2');module['exports']=function(_0x4a1536,_0x2348f0,_0x1d097c){return new BPromise(function(_0x37a051,_0x3bc804){var _0x9d7b7;if(typeof _0x4a1536!==_0xfae1('0x3')||_0x4a1536[_0xfae1('0x4')]===0x0){return _0x3bc804(_0xfae1('0x5'));}if(typeof _0x2348f0!=='string'||_0x2348f0[_0xfae1('0x4')]===0x0){return _0x3bc804(_0xfae1('0x6'));}if(typeof _0x1d097c!==_0xfae1('0x7')&&(typeof _0x1d097c!=='string'||_0x1d097c['length']===0x0)){return _0x3bc804(_0xfae1('0x8'));}try{_0x9d7b7=fs[_0xfae1('0x9')](_0x4a1536)[_0xfae1('0xa')](_0xfae1('0xb'));}catch(_0x58a261){return _0x3bc804(_0x58a261);}return _0x37a051({'method':'POST','uri':host+_0xfae1('0xc')+_0x2348f0,'body':{'config':{'encoding':_0xfae1('0xd'),'sampleRateHertz':_0xfae1('0xe'),'languageCode':_0x1d097c},'audio':{'content':_0x9d7b7}},'json':!![]});});}; \ No newline at end of file +var _0x8562=['url','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x1ff9e2,_0x453ea1){var _0x2c6b81=function(_0x59e391){while(--_0x59e391){_0x1ff9e2['push'](_0x1ff9e2['shift']());}};_0x2c6b81(++_0x453ea1);}(_0x8562,0x186));var _0x2856=function(_0x4c04bd,_0x1e02f6){_0x4c04bd=_0x4c04bd-0x0;var _0x38e297=_0x8562[_0x4c04bd];return _0x38e297;};'use strict';var url=require(_0x2856('0x0'));var BPromise=require(_0x2856('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x40ddee,_0x21e860,_0x2ba489){return new BPromise(function(_0x144704,_0x40daff){var _0xa4805;if(typeof _0x40ddee!==_0x2856('0x2')||_0x40ddee[_0x2856('0x3')]===0x0){return _0x40daff(_0x2856('0x4'));}if(typeof _0x21e860!==_0x2856('0x2')||_0x21e860[_0x2856('0x3')]===0x0){return _0x40daff(_0x2856('0x5'));}if(typeof _0x2ba489!=='undefined'&&(typeof _0x2ba489!==_0x2856('0x2')||_0x2ba489['length']===0x0)){return _0x40daff('lang\x20should\x20be\x20a\x20string');}try{_0xa4805=fs[_0x2856('0x6')](_0x40ddee)[_0x2856('0x7')](_0x2856('0x8'));}catch(_0x20ca6e){return _0x40daff(_0x20ca6e);}return _0x144704({'method':_0x2856('0x9'),'uri':host+_0x2856('0xa')+_0x21e860,'body':{'config':{'encoding':_0x2856('0xb'),'sampleRateHertz':_0x2856('0xc'),'languageCode':_0x2ba489},'audio':{'content':_0xa4805}},'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 04ee0fe..b8a1241 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 _0x3a29=['./asr'];(function(_0x5b22b4,_0x156560){var _0x13c83a=function(_0x311dd1){while(--_0x311dd1){_0x5b22b4['push'](_0x5b22b4['shift']());}};_0x13c83a(++_0x156560);}(_0x3a29,0xe3));var _0x93a2=function(_0x15e0c0,_0xd55d40){_0x15e0c0=_0x15e0c0-0x0;var _0x405652=_0x3a29[_0x15e0c0];return _0x405652;};var asr=require(_0x93a2('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xc664=['exports','./asr'];(function(_0x55e4e1,_0x352a79){var _0x1644e8=function(_0x4a2446){while(--_0x4a2446){_0x55e4e1['push'](_0x55e4e1['shift']());}};_0x1644e8(++_0x352a79);}(_0xc664,0x1ad));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};var asr=require(_0x4c66('0x0'));module[_0x4c66('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 313a02c..22e4432 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 _0x38cd=['pipe','protocol','host','end','transcode','wav','error\x20convert','start','tmp','generate','.wav','writeFileSync','then','unlink','chmodSync','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','text:synthesize','resolve','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','metadata','isFallbackIntent','tildeASR','asr','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','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','Data','dirName','path','http','https','url','parse','bluebird','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','download\x20error'];(function(_0x3c0c92,_0x267969){var _0xe3859b=function(_0x4d38f2){while(--_0x4d38f2){_0x3c0c92['push'](_0x3c0c92['shift']());}};_0xe3859b(++_0x267969);}(_0x38cd,0xc2));var _0xd38c=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x38cd[_0x3207aa];return _0x51758f;};'use strict';var fs=require('fs');var path=require(_0xd38c('0x0'));var http=require(_0xd38c('0x1'));var https=require(_0xd38c('0x2'));var urlParse=require(_0xd38c('0x3'))[_0xd38c('0x4')];var BPromise=require(_0xd38c('0x5'));var rs=require('randomstring');var sox=require(_0xd38c('0x6'));var rp=require(_0xd38c('0x7'));var util=require(_0xd38c('0x8'));var querystring=require(_0xd38c('0x9'));var tts=require(_0xd38c('0xa'));var apiai=require(_0xd38c('0xb'));var md5=require(_0xd38c('0xc'));var google=require(_0xd38c('0xd'));var aws=require(_0xd38c('0xe'));var tilde=require(_0xd38c('0xf'));var sestek=require(_0xd38c('0x10'));var logger=require(_0xd38c('0x11'))('agi');var ISPEECH_API=_0xd38c('0x12');function downloadFile(_0x2505db,_0x19cfda){return new BPromise(function(_0x358ab5,_0x15ed11){var _0x35da8b=urlParse(_0x2505db);var _0x293e49=_0x35da8b['protocol']===_0xd38c('0x13')?https:http;var _0xefcb93={'host':_0x35da8b['host'],'path':_0x35da8b[_0xd38c('0x0')],'headers':{'user-agent':_0xd38c('0x14')}};_0x293e49[_0xd38c('0x15')](_0xefcb93,function(_0x4d5796){if(_0x4d5796[_0xd38c('0x16')]!==0xc8){logger[_0xd38c('0x17')](_0xd38c('0x18')+_0x2505db+_0xd38c('0x19')+_0x4d5796[_0xd38c('0x16')]+'\x20('+_0x4d5796[_0xd38c('0x1a')]+')');_0x15ed11(new Error(_0xd38c('0x18')+_0x2505db+_0xd38c('0x19')+_0x4d5796[_0xd38c('0x16')]+'\x20('+_0x4d5796[_0xd38c('0x1a')]+')'));return;}var _0x4237e7=fs['createWriteStream'](_0x19cfda);_0x4237e7['on'](_0xd38c('0x1b'),function(){logger[_0xd38c('0x1c')](_0xd38c('0x1d'));_0x4237e7[_0xd38c('0x1e')](_0x358ab5);});_0x4237e7['on'](_0xd38c('0x17'),function(_0x1302d7){fs['unlink'](_0x19cfda);logger[_0xd38c('0x17')](_0xd38c('0x1f'),_0x1302d7);_0x15ed11(_0x1302d7);});_0x4d5796[_0xd38c('0x20')](_0x4237e7);})['on'](_0xd38c('0x17'),function(_0x1d1319){logger[_0xd38c('0x17')](_0x1d1319);_0x15ed11(_0x1d1319);})['end']();});}function uploadFile(_0x3a2b2b){return new BPromise(function(_0x2fba2a,_0x167ae7){var _0x35203e=urlParse(_0x3a2b2b);var _0x1a2104=_0x35203e[_0xd38c('0x21')]===_0xd38c('0x13')?https:http;var _0x1ed82a={'host':_0x35203e[_0xd38c('0x22')],'path':_0x35203e['path'],'headers':{'user-agent':_0xd38c('0x14')}};_0x1a2104[_0xd38c('0x15')](_0x1ed82a,function(_0x49c27c){if(_0x49c27c['statusCode']!==0xc8){_0x167ae7(new Error(_0xd38c('0x18')+_0x3a2b2b+_0xd38c('0x19')+_0x49c27c[_0xd38c('0x16')]+'\x20('+_0x49c27c[_0xd38c('0x1a')]+')'));return;}var _0x1ac14c='';_0x49c27c['on']('data',function(_0x1ee85e){_0x1ac14c+=_0x1ee85e;});_0x49c27c['on'](_0xd38c('0x23'),function(){_0x2fba2a(_0x1ac14c);});})['on'](_0xd38c('0x17'),function(_0x501da8){_0x167ae7(_0x501da8);})[_0xd38c('0x23')]();});}function convertFile(_0x20732a,_0x90c14e){return new BPromise(function(_0x2a564c,_0x102723){var _0x55f132=sox[_0xd38c('0x24')](_0x20732a,_0x90c14e,{'sampleRate':0x1f40,'format':_0xd38c('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55f132['on'](_0xd38c('0x17'),function(_0x5bee0d){logger['error'](_0xd38c('0x26'),_0x5bee0d);_0x102723(_0x5bee0d);});_0x55f132['on'](_0xd38c('0x23'),function(){logger[_0xd38c('0x1c')]('finish\x20to\x20convert');_0x2a564c();});_0x55f132[_0xd38c('0x27')]();});}function base64Decode(_0x52078a,_0x25de51){var _0x502d53=path['resolve'](__dirname,_0xd38c('0x28'),rs[_0xd38c('0x29')](0x4)+_0xd38c('0x2a'));fs[_0xd38c('0x2b')](_0x502d53,_0x52078a,'base64');return convertFile(_0x502d53,_0x25de51)[_0xd38c('0x2c')](function(){try{fs[_0xd38c('0x2d')](_0x502d53);fs[_0xd38c('0x2e')](_0x25de51,'777');}catch(_0x9b2fe3){logger[_0xd38c('0x17')](_0x9b2fe3);}return _0x25de51[_0xd38c('0x2f')]('.')[0x0];});}function base64Encode(_0x3f157b){var _0x109e20=fs[_0xd38c('0x30')](_0x3f157b);return new Buffer(_0x109e20)[_0xd38c('0x31')](_0xd38c('0x32'));}exports[_0xd38c('0x33')]=function(_0x56bb78,_0x4fd865,_0x15f2d5,_0xd1fdfb,_0xbd6d57,_0x2e576b){var _0x14a65f,_0x42344d;var _0x57d9eb=_0xd38c('0x34');var _0x23d02d='?key='+_0x56bb78;var _0x472d78={};if(_0x4fd865===_0xd38c('0x35')){_0x472d78[_0xd38c('0x36')]={'ssml':_0x15f2d5};}else{_0x472d78[_0xd38c('0x36')]={'text':_0x15f2d5};};_0x472d78[_0xd38c('0x37')]={'languageCode':_0xd1fdfb,'ssmlGender':_0xbd6d57};_0x472d78['audioConfig']={'audioEncoding':_0xd38c('0x38'),'sampleRateHertz':0x1f40};var _0x2a5626={'url':_0x57d9eb+_0xd38c('0x39')+_0x23d02d,'method':'POST','json':!![],'body':_0x472d78};return rp(_0x2a5626)[_0xd38c('0x2c')](function(_0x135988){return new BPromise(function(_0x437985,_0x45bf73){_0x14a65f=path[_0xd38c('0x3a')](__dirname,'tmp',rs[_0xd38c('0x29')](0x4)+_0xd38c('0x3b'));var _0x18aed8=Buffer[_0xd38c('0x3c')](_0x135988[_0xd38c('0x3d')],'base64');return fs[_0xd38c('0x3e')](_0x14a65f,_0x18aed8,function(_0x5c4bd6){_0x45bf73(_0x5c4bd6);},function(_0x17b4d2){fs[_0xd38c('0x2e')](_0x14a65f,_0xd38c('0x3f'));_0x437985(_0x17b4d2);});});})[_0xd38c('0x2c')](function(_0x5d2c45){_0x42344d=path[_0xd38c('0x3a')](__dirname,_0xd38c('0x28'),rs[_0xd38c('0x29')](0x4)+_0xd38c('0x2a'));return convertFile(_0x14a65f,_0x42344d);})[_0xd38c('0x2c')](function(){try{fs['unlink'](_0x14a65f);fs[_0xd38c('0x2e')](_0x42344d,_0xd38c('0x3f'));}catch(_0x240748){logger['error'](_0x240748);}logger[_0xd38c('0x1c')](_0xd38c('0x40'),_0x42344d[_0xd38c('0x2f')]('.')[0x0]);return _0x42344d[_0xd38c('0x2f')]('.')[0x0];});};exports[_0xd38c('0x41')]=function(_0x1ba759,_0x39fbde){var _0x580c43,_0x45bd23;return tts(_0x1ba759,_0x39fbde||'en',0x1)['then'](function(_0x84d217){logger[_0xd38c('0x1c')](_0x84d217);_0x580c43=path['resolve'](__dirname,_0xd38c('0x28'),rs['generate'](0x4)+_0xd38c('0x3b'));return downloadFile(_0x84d217,_0x580c43);})[_0xd38c('0x2c')](function(){_0x45bd23=path[_0xd38c('0x3a')](__dirname,_0xd38c('0x28'),rs[_0xd38c('0x29')](0x4)+'.wav');return convertFile(_0x580c43,_0x45bd23);})['then'](function(){try{fs[_0xd38c('0x2d')](_0x580c43);fs[_0xd38c('0x2e')](_0x45bd23,_0xd38c('0x3f'));}catch(_0x4dd10f){logger[_0xd38c('0x17')](_0x4dd10f);}logger['info'](_0xd38c('0x42'),_0x45bd23[_0xd38c('0x2f')]('.')[0x0]);return _0x45bd23['split']('.')[0x0];});};exports['googleASR']=function(_0x24cbde,_0x1baf40,_0xced0fb){return google['asr'](_0x24cbde,_0x1baf40,_0xced0fb)['then'](function(_0x45717e){logger[_0xd38c('0x1c')](_0x45717e[_0xd38c('0x43')]);return rp(_0x45717e);})[_0xd38c('0x2c')](function(_0x3a2eab){var _0x5afb4c='';var _0x2eeb1d=0x0;try{fs[_0xd38c('0x2d')](_0x24cbde);}catch(_0x4c3436){logger[_0xd38c('0x17')](_0x4c3436);}if(_0x3a2eab&&_0x3a2eab[_0xd38c('0x44')]){_0x5afb4c=_0x3a2eab[_0xd38c('0x44')][_0xd38c('0x45')](function(_0x47fad0){return _0x47fad0&&_0x47fad0['alternatives'][0x0]&&_0x47fad0[_0xd38c('0x46')][0x0][_0xd38c('0x47')]?_0x47fad0['alternatives'][0x0][_0xd38c('0x47')]:'';})['join']('\x0a');_0x2eeb1d=_0x3a2eab['results'][_0xd38c('0x45')](function(_0x3d6ae6){return _0x3d6ae6&&_0x3d6ae6[_0xd38c('0x46')][0x0]&&_0x3d6ae6['alternatives'][0x0][_0xd38c('0x48')]?_0x3d6ae6[_0xd38c('0x46')][0x0][_0xd38c('0x48')]:0x0;})[_0xd38c('0x49')]('\x0a');}logger[_0xd38c('0x1c')](_0xd38c('0x4a'),_0x5afb4c);logger[_0xd38c('0x1c')](_0xd38c('0x4b'),_0x2eeb1d);return{'transcript':_0x5afb4c,'confidence':_0x2eeb1d};})[_0xd38c('0x4c')](function(_0x450374){logger['error'](_0xd38c('0x4d'),_0x450374['statusCode'],_0x450374[_0xd38c('0x4e')],_0x450374['message']);});};exports[_0xd38c('0x4f')]=function(_0x54e7d6,_0x4ea77d,_0x462c74,_0x3bac20){var _0x45e17d=apiai(_0x4ea77d,{'language':_0x3bac20||'en'});return _0x45e17d['textRequest'](_0x462c74,{'sessionId':md5(_0x54e7d6)})[_0xd38c('0x2c')](function(_0xcff287){logger[_0xd38c('0x1c')](JSON[_0xd38c('0x50')](_0xcff287));return{'source':_0xcff287[_0xd38c('0x51')][_0xd38c('0x52')],'resolvedQuery':_0xcff287[_0xd38c('0x51')][_0xd38c('0x53')],'action':_0xcff287['result']['action'],'actionIncomplete':_0xcff287['result'][_0xd38c('0x54')],'speech':_0xcff287[_0xd38c('0x51')][_0xd38c('0x55')][_0xd38c('0x56')],'score':_0xcff287[_0xd38c('0x51')]['score'],'statusCode':_0xcff287[_0xd38c('0x57')][_0xd38c('0x58')],'endConversation':_0xcff287[_0xd38c('0x51')][_0xd38c('0x59')]['endConversation']||![],'isFallbackIntent':_0xcff287[_0xd38c('0x51')][_0xd38c('0x59')][_0xd38c('0x5a')]};});};exports[_0xd38c('0x5b')]=function(_0x22ab90,_0x1080b8,_0x2d84ab,_0x1bfbdb){return tilde[_0xd38c('0x5c')](_0x22ab90,_0x1080b8,_0x2d84ab,_0x1bfbdb)[_0xd38c('0x2c')](function(_0xf29700){try{fs['unlink'](_0x22ab90);}catch(_0x40770b){logger[_0xd38c('0x17')](_0x40770b);}logger[_0xd38c('0x1c')](_0xd38c('0x5d'),_0xf29700[_0xd38c('0x47')]);logger[_0xd38c('0x1c')](_0xd38c('0x5e'),_0xf29700[_0xd38c('0x48')]);return _0xf29700;});};exports[_0xd38c('0x5f')]=function(_0x35bb82,_0x1b6c4a,_0x38d99e,_0x21910c,_0x355dcf,_0x3c4eb4){var _0x3b11bc=path[_0xd38c('0x3a')](__dirname,'tmp',rs[_0xd38c('0x29')](0x4)+_0xd38c('0x3b'));var _0x4bd030;return aws[_0xd38c('0x60')](_0x35bb82,_0x1b6c4a,_0x38d99e,_0x21910c,_0x355dcf,_0x3c4eb4,_0x3b11bc)[_0xd38c('0x2c')](function(){_0x4bd030=path[_0xd38c('0x3a')](__dirname,_0xd38c('0x28'),rs[_0xd38c('0x29')](0x4)+_0xd38c('0x2a'));return convertFile(_0x3b11bc,_0x4bd030);})[_0xd38c('0x2c')](function(){try{fs[_0xd38c('0x2d')](_0x3b11bc);fs['chmodSync'](_0x4bd030,_0xd38c('0x3f'));}catch(_0x51e5fa){logger['error'](_0x51e5fa);}return _0x4bd030[_0xd38c('0x2f')]('.')[0x0];});};exports[_0xd38c('0x61')]=function(_0x5309cd,_0xcee5c1,_0x28f406,_0x1f9138,_0x181f4b,_0x58ac1d){return aws[_0xd38c('0x62')](_0x5309cd,_0xcee5c1,_0x28f406,_0x1f9138,_0x181f4b,_0x58ac1d)[_0xd38c('0x2c')](function(_0x3b6a12){logger[_0xd38c('0x1c')](JSON[_0xd38c('0x50')](_0x3b6a12));return _0x3b6a12;});};exports[_0xd38c('0x63')]=function(_0x164fb6,_0x21678c,_0x287b78,_0x282502){var _0x5bffe4=util[_0xd38c('0x64')](_0xd38c('0x65'),ISPEECH_API,_0x164fb6,encodeURIComponent(_0x21678c),_0x287b78,_0x282502);var _0x1079b4=path[_0xd38c('0x3a')](__dirname,_0xd38c('0x28'),rs[_0xd38c('0x29')](0x4)+_0xd38c('0x3b'));var _0x508332;return downloadFile(_0x5bffe4,_0x1079b4)[_0xd38c('0x2c')](function(){_0x508332=path[_0xd38c('0x3a')](__dirname,_0xd38c('0x28'),rs[_0xd38c('0x29')](0x4)+_0xd38c('0x2a'));return convertFile(_0x1079b4,_0x508332);})[_0xd38c('0x2c')](function(){try{fs[_0xd38c('0x2d')](_0x1079b4);fs[_0xd38c('0x2e')](_0x508332,'777');}catch(_0x72bf1b){logger[_0xd38c('0x17')](_0x72bf1b);}return _0x508332[_0xd38c('0x2f')]('.')[0x0];});};exports[_0xd38c('0x66')]=function(_0xc2f615,_0x307e76,_0x3dbcef,_0x5e01bc){var _0x178389=util[_0xd38c('0x64')](_0xd38c('0x67'),ISPEECH_API,_0x307e76,_0x3dbcef,base64Encode(_0xc2f615),_0x5e01bc?util['format'](_0xd38c('0x68'),encodeURIComponent(_0x5e01bc)):_0xd38c('0x69'));return uploadFile(_0x178389)[_0xd38c('0x2c')](function(_0x12a58e){return querystring['parse'](_0x12a58e);});};exports['sestekNDA']=function(_0x14a888,_0x58f8c9){return sestek[_0xd38c('0x6a')](_0x14a888,_0x58f8c9)[_0xd38c('0x2c')](function(_0x24c983){logger[_0xd38c('0x1c')](JSON[_0xd38c('0x50')](_0x24c983));var _0x500404={'speech':_0x24c983[_0xd38c('0x6b')],'action':_0x24c983[_0xd38c('0x6c')]?_0x24c983['channelData'][_0xd38c('0x6d')]:undefined,'actiondata':_0x24c983[_0xd38c('0x6c')]?_0x24c983[_0xd38c('0x6c')][_0xd38c('0x6e')]:undefined};if(_0x24c983[_0xd38c('0x6c')]&&_0x24c983[_0xd38c('0x6c')]['AudioFromTts']){return base64Decode(_0x24c983[_0xd38c('0x6c')]['AudioFromTts'][_0xd38c('0x6f')],path[_0xd38c('0x3a')](__dirname,'tmp',rs[_0xd38c('0x29')](0x4)+_0xd38c('0x2a')))[_0xd38c('0x2c')](function(_0x35a0f8){_0x500404['audiofile']=_0x35a0f8;return _0x500404;});}return _0x500404;});};exports[_0xd38c('0x70')]=function(){return __dirname;}; \ No newline at end of file +var _0x8db7=['unlink','pipe','end','statusMessage','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','source','result','resolvedQuery','action','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','polly','awsLex','stringify','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','http','parse','bluebird','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','createWriteStream','finish','info','close'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8db7,0x196));var _0x78db=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8db7[_0x3e5086];return _0xfeb102;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0x78db('0x0'));var https=require('https');var urlParse=require('url')[_0x78db('0x1')];var BPromise=require(_0x78db('0x2'));var rs=require(_0x78db('0x3'));var sox=require(_0x78db('0x4'));var rp=require(_0x78db('0x5'));var util=require(_0x78db('0x6'));var querystring=require(_0x78db('0x7'));var tts=require(_0x78db('0x8'));var apiai=require(_0x78db('0x9'));var md5=require(_0x78db('0xa'));var google=require('./google');var aws=require(_0x78db('0xb'));var tilde=require('./tilde');var sestek=require(_0x78db('0xc'));var logger=require(_0x78db('0xd'))(_0x78db('0xe'));var ISPEECH_API=_0x78db('0xf');function downloadFile(_0xed0a1d,_0x26011c){return new BPromise(function(_0x11ce54,_0x4c248e){var _0x4349bf=urlParse(_0xed0a1d);var _0x1e7537=_0x4349bf[_0x78db('0x10')]===_0x78db('0x11')?https:http;var _0x2e25e8={'host':_0x4349bf[_0x78db('0x12')],'path':_0x4349bf[_0x78db('0x13')],'headers':{'user-agent':_0x78db('0x14')}};_0x1e7537[_0x78db('0x15')](_0x2e25e8,function(_0x501f6c){if(_0x501f6c['statusCode']!==0xc8){logger[_0x78db('0x16')](_0x78db('0x17')+_0xed0a1d+_0x78db('0x18')+_0x501f6c[_0x78db('0x19')]+'\x20('+_0x501f6c['statusMessage']+')');_0x4c248e(new Error(_0x78db('0x17')+_0xed0a1d+'\x20failed,\x20status\x20code\x20=\x20'+_0x501f6c['statusCode']+'\x20('+_0x501f6c['statusMessage']+')'));return;}var _0x3f4157=fs[_0x78db('0x1a')](_0x26011c);_0x3f4157['on'](_0x78db('0x1b'),function(){logger[_0x78db('0x1c')]('finish\x20download\x20file');_0x3f4157[_0x78db('0x1d')](_0x11ce54);});_0x3f4157['on'](_0x78db('0x16'),function(_0x59a6b7){fs[_0x78db('0x1e')](_0x26011c);logger[_0x78db('0x16')]('download\x20error',_0x59a6b7);_0x4c248e(_0x59a6b7);});_0x501f6c[_0x78db('0x1f')](_0x3f4157);})['on'](_0x78db('0x16'),function(_0x25fd7f){logger[_0x78db('0x16')](_0x25fd7f);_0x4c248e(_0x25fd7f);})[_0x78db('0x20')]();});}function uploadFile(_0x423b9a){return new BPromise(function(_0x1492d1,_0x33aead){var _0xba294e=urlParse(_0x423b9a);var _0x5d9364=_0xba294e[_0x78db('0x10')]==='https:'?https:http;var _0x59debe={'host':_0xba294e['host'],'path':_0xba294e[_0x78db('0x13')],'headers':{'user-agent':_0x78db('0x14')}};_0x5d9364[_0x78db('0x15')](_0x59debe,function(_0xe044fa){if(_0xe044fa[_0x78db('0x19')]!==0xc8){_0x33aead(new Error(_0x78db('0x17')+_0x423b9a+_0x78db('0x18')+_0xe044fa[_0x78db('0x19')]+'\x20('+_0xe044fa[_0x78db('0x21')]+')'));return;}var _0x57751b='';_0xe044fa['on'](_0x78db('0x22'),function(_0x543266){_0x57751b+=_0x543266;});_0xe044fa['on']('end',function(){_0x1492d1(_0x57751b);});})['on'](_0x78db('0x16'),function(_0x36fe37){_0x33aead(_0x36fe37);})[_0x78db('0x20')]();});}function convertFile(_0x526c15,_0x5cb133){return new BPromise(function(_0x285b48,_0xb5a04){var _0x3dcbc9=sox[_0x78db('0x23')](_0x526c15,_0x5cb133,{'sampleRate':0x1f40,'format':_0x78db('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3dcbc9['on']('error',function(_0xe5f345){logger[_0x78db('0x16')](_0x78db('0x25'),_0xe5f345);_0xb5a04(_0xe5f345);});_0x3dcbc9['on']('end',function(){logger[_0x78db('0x1c')](_0x78db('0x26'));_0x285b48();});_0x3dcbc9[_0x78db('0x27')]();});}function base64Decode(_0x122088,_0x4612de){var _0x411b7c=path['resolve'](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+_0x78db('0x2a'));fs[_0x78db('0x2b')](_0x411b7c,_0x122088,_0x78db('0x2c'));return convertFile(_0x411b7c,_0x4612de)[_0x78db('0x2d')](function(){try{fs['unlink'](_0x411b7c);fs[_0x78db('0x2e')](_0x4612de,_0x78db('0x2f'));}catch(_0x2fbcb1){logger[_0x78db('0x16')](_0x2fbcb1);}return _0x4612de[_0x78db('0x30')]('.')[0x0];});}function base64Encode(_0x393afb){var _0x4109af=fs['readFileSync'](_0x393afb);return new Buffer(_0x4109af)[_0x78db('0x31')]('base64');}exports['googleCloudTTS']=function(_0x4af48d,_0x9d8b4b,_0x1ca923,_0xfcaebc,_0xddc4cb,_0x5b7898){var _0x4f9dea,_0x3763f7;var _0x43206d='https://texttospeech.googleapis.com/v1/';var _0x487195='?key='+_0x4af48d;var _0x280f78={};if(_0x9d8b4b===_0x78db('0x32')){_0x280f78[_0x78db('0x33')]={'ssml':_0x1ca923};}else{_0x280f78[_0x78db('0x33')]={'text':_0x1ca923};};_0x280f78[_0x78db('0x34')]={'languageCode':_0xfcaebc,'ssmlGender':_0xddc4cb};_0x280f78[_0x78db('0x35')]={'audioEncoding':_0x78db('0x36'),'sampleRateHertz':0x1f40};var _0x4dacfd={'url':_0x43206d+_0x78db('0x37')+_0x487195,'method':_0x78db('0x38'),'json':!![],'body':_0x280f78};return rp(_0x4dacfd)['then'](function(_0x515de2){return new BPromise(function(_0xef99bf,_0x40f05c){_0x4f9dea=path[_0x78db('0x39')](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+_0x78db('0x3a'));var _0xf122ba=Buffer[_0x78db('0x3b')](_0x515de2[_0x78db('0x3c')],_0x78db('0x2c'));return fs[_0x78db('0x3d')](_0x4f9dea,_0xf122ba,function(_0x1d8b68){_0x40f05c(_0x1d8b68);},function(_0x23b8ef){fs['chmodSync'](_0x4f9dea,_0x78db('0x2f'));_0xef99bf(_0x23b8ef);});});})[_0x78db('0x2d')](function(_0x1238f5){_0x3763f7=path['resolve'](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+_0x78db('0x2a'));return convertFile(_0x4f9dea,_0x3763f7);})[_0x78db('0x2d')](function(){try{fs[_0x78db('0x1e')](_0x4f9dea);fs[_0x78db('0x2e')](_0x3763f7,_0x78db('0x2f'));}catch(_0x2ae423){logger['error'](_0x2ae423);}logger[_0x78db('0x1c')](_0x78db('0x3e'),_0x3763f7['split']('.')[0x0]);return _0x3763f7[_0x78db('0x30')]('.')[0x0];});};exports[_0x78db('0x3f')]=function(_0x626fb3,_0x362346){var _0x167d64,_0x511ec1;return tts(_0x626fb3,_0x362346||'en',0x1)[_0x78db('0x2d')](function(_0x3bf7f9){logger['info'](_0x3bf7f9);_0x167d64=path['resolve'](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+_0x78db('0x3a'));return downloadFile(_0x3bf7f9,_0x167d64);})['then'](function(){_0x511ec1=path[_0x78db('0x39')](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+_0x78db('0x2a'));return convertFile(_0x167d64,_0x511ec1);})[_0x78db('0x2d')](function(){try{fs['unlink'](_0x167d64);fs[_0x78db('0x2e')](_0x511ec1,_0x78db('0x2f'));}catch(_0x31efbd){logger[_0x78db('0x16')](_0x31efbd);}logger[_0x78db('0x1c')]('goggleTTS\x20path',_0x511ec1[_0x78db('0x30')]('.')[0x0]);return _0x511ec1[_0x78db('0x30')]('.')[0x0];});};exports[_0x78db('0x40')]=function(_0x47e461,_0x141e31,_0x26c0eb){return google[_0x78db('0x41')](_0x47e461,_0x141e31,_0x26c0eb)[_0x78db('0x2d')](function(_0x496459){logger['info'](_0x496459[_0x78db('0x42')]);return rp(_0x496459);})[_0x78db('0x2d')](function(_0x1da908){var _0x2dcff8='';var _0xb8140b=0x0;try{fs[_0x78db('0x1e')](_0x47e461);}catch(_0x29e9d9){logger['error'](_0x29e9d9);}if(_0x1da908&&_0x1da908['results']){_0x2dcff8=_0x1da908[_0x78db('0x43')]['map'](function(_0x40c00a){return _0x40c00a&&_0x40c00a['alternatives'][0x0]&&_0x40c00a[_0x78db('0x44')][0x0]['transcript']?_0x40c00a[_0x78db('0x44')][0x0][_0x78db('0x45')]:'';})[_0x78db('0x46')]('\x0a');_0xb8140b=_0x1da908[_0x78db('0x43')][_0x78db('0x47')](function(_0x233b17){return _0x233b17&&_0x233b17[_0x78db('0x44')][0x0]&&_0x233b17[_0x78db('0x44')][0x0][_0x78db('0x48')]?_0x233b17[_0x78db('0x44')][0x0][_0x78db('0x48')]:0x0;})[_0x78db('0x46')]('\x0a');}logger[_0x78db('0x1c')](_0x78db('0x49'),_0x2dcff8);logger[_0x78db('0x1c')](_0x78db('0x4a'),_0xb8140b);return{'transcript':_0x2dcff8,'confidence':_0xb8140b};})[_0x78db('0x4b')](function(_0x581a02){logger[_0x78db('0x16')]('[%s]\x20%s:%s',_0x581a02[_0x78db('0x19')],_0x581a02[_0x78db('0x4c')],_0x581a02[_0x78db('0x4d')]);});};exports['googleDialogflow']=function(_0x15c83a,_0x1db0f2,_0x2f92fa,_0x1920fa){var _0x4d845f=apiai(_0x1db0f2,{'language':_0x1920fa||'en'});return _0x4d845f['textRequest'](_0x2f92fa,{'sessionId':md5(_0x15c83a)})[_0x78db('0x2d')](function(_0x4834d6){logger[_0x78db('0x1c')](JSON['stringify'](_0x4834d6));return{'source':_0x4834d6['result'][_0x78db('0x4e')],'resolvedQuery':_0x4834d6[_0x78db('0x4f')][_0x78db('0x50')],'action':_0x4834d6['result'][_0x78db('0x51')],'actionIncomplete':_0x4834d6[_0x78db('0x4f')]['actionIncomplete'],'speech':_0x4834d6['result'][_0x78db('0x52')][_0x78db('0x53')],'score':_0x4834d6[_0x78db('0x4f')][_0x78db('0x54')],'statusCode':_0x4834d6[_0x78db('0x55')][_0x78db('0x56')],'endConversation':_0x4834d6[_0x78db('0x4f')][_0x78db('0x57')][_0x78db('0x58')]||![],'isFallbackIntent':_0x4834d6[_0x78db('0x4f')][_0x78db('0x57')][_0x78db('0x59')]};});};exports['tildeASR']=function(_0x5417cb,_0x4fae22,_0x263666,_0x4e1a85){return tilde[_0x78db('0x41')](_0x5417cb,_0x4fae22,_0x263666,_0x4e1a85)[_0x78db('0x2d')](function(_0x58be49){try{fs[_0x78db('0x1e')](_0x5417cb);}catch(_0x1c90e0){logger[_0x78db('0x16')](_0x1c90e0);}logger[_0x78db('0x1c')](_0x78db('0x5a'),_0x58be49[_0x78db('0x45')]);logger[_0x78db('0x1c')]('Tilde\x20ASR\x20confidence',_0x58be49[_0x78db('0x48')]);return _0x58be49;});};exports['awsPolly']=function(_0x192e8f,_0x42759a,_0x1aded9,_0x3c3de9,_0x3151a6,_0x347244){var _0x78540d=path[_0x78db('0x39')](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+_0x78db('0x3a'));var _0x7854a3;return aws[_0x78db('0x5b')](_0x192e8f,_0x42759a,_0x1aded9,_0x3c3de9,_0x3151a6,_0x347244,_0x78540d)[_0x78db('0x2d')](function(){_0x7854a3=path['resolve'](__dirname,'tmp',rs[_0x78db('0x29')](0x4)+_0x78db('0x2a'));return convertFile(_0x78540d,_0x7854a3);})[_0x78db('0x2d')](function(){try{fs['unlink'](_0x78540d);fs['chmodSync'](_0x7854a3,'777');}catch(_0x1a0fb7){logger[_0x78db('0x16')](_0x1a0fb7);}return _0x7854a3[_0x78db('0x30')]('.')[0x0];});};exports[_0x78db('0x5c')]=function(_0x52b83e,_0x9cebc1,_0x1e682d,_0x7c8700,_0x1d321b,_0x56198c){return aws['lex'](_0x52b83e,_0x9cebc1,_0x1e682d,_0x7c8700,_0x1d321b,_0x56198c)[_0x78db('0x2d')](function(_0x6c6d16){logger['info'](JSON[_0x78db('0x5d')](_0x6c6d16));return _0x6c6d16;});};exports[_0x78db('0x5e')]=function(_0x20f068,_0x256f73,_0x434764,_0x44dff8){var _0x8abc2f=util[_0x78db('0x5f')](_0x78db('0x60'),ISPEECH_API,_0x20f068,encodeURIComponent(_0x256f73),_0x434764,_0x44dff8);var _0x455e69=path[_0x78db('0x39')](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+'.mp3');var _0x3ed0a7;return downloadFile(_0x8abc2f,_0x455e69)[_0x78db('0x2d')](function(){_0x3ed0a7=path[_0x78db('0x39')](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+'.wav');return convertFile(_0x455e69,_0x3ed0a7);})[_0x78db('0x2d')](function(){try{fs[_0x78db('0x1e')](_0x455e69);fs[_0x78db('0x2e')](_0x3ed0a7,_0x78db('0x2f'));}catch(_0x5dd84c){logger[_0x78db('0x16')](_0x5dd84c);}return _0x3ed0a7['split']('.')[0x0];});};exports[_0x78db('0x61')]=function(_0x4bb7e0,_0x32083d,_0x84acd6,_0x4f571f){var _0xdf5b44=util[_0x78db('0x5f')](_0x78db('0x62'),ISPEECH_API,_0x32083d,_0x84acd6,base64Encode(_0x4bb7e0),_0x4f571f?util[_0x78db('0x5f')](_0x78db('0x63'),encodeURIComponent(_0x4f571f)):'freeform=3');return uploadFile(_0xdf5b44)['then'](function(_0x1bfe60){return querystring[_0x78db('0x1')](_0x1bfe60);});};exports[_0x78db('0x64')]=function(_0x24e758,_0x433490){return sestek['nda'](_0x24e758,_0x433490)['then'](function(_0x23556f){logger[_0x78db('0x1c')](JSON[_0x78db('0x5d')](_0x23556f));var _0xff80a2={'speech':_0x23556f[_0x78db('0x65')],'action':_0x23556f['channelData']?_0x23556f[_0x78db('0x66')][_0x78db('0x67')]:undefined,'actiondata':_0x23556f[_0x78db('0x66')]?_0x23556f['channelData'][_0x78db('0x68')]:undefined};if(_0x23556f['channelData']&&_0x23556f['channelData'][_0x78db('0x69')]){return base64Decode(_0x23556f[_0x78db('0x66')][_0x78db('0x69')][_0x78db('0x6a')],path[_0x78db('0x39')](__dirname,_0x78db('0x28'),rs[_0x78db('0x29')](0x4)+'.wav'))[_0x78db('0x2d')](function(_0x5ce59b){_0xff80a2[_0x78db('0x6b')]=_0x5ce59b;return _0xff80a2;});}return _0xff80a2;});};exports[_0x78db('0x6c')]=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 bbe5a82..1be46be 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 _0x3d74=['./nda','exports'];(function(_0x44a389,_0x3c98ad){var _0x54a47f=function(_0x3a7f0b){while(--_0x3a7f0b){_0x44a389['push'](_0x44a389['shift']());}};_0x54a47f(++_0x3c98ad);}(_0x3d74,0x6c));var _0x43d7=function(_0x3945ef,_0x4c942a){_0x3945ef=_0x3945ef-0x0;var _0xa91e57=_0x3d74[_0x3945ef];return _0xa91e57;};var nda=require(_0x43d7('0x0'));module[_0x43d7('0x1')]={'nda':nda}; \ No newline at end of file +var _0x64fc=['./nda','exports'];(function(_0x3abcfe,_0x4cd0ab){var _0x5f5cef=function(_0x47a9d8){while(--_0x47a9d8){_0x3abcfe['push'](_0x3abcfe['shift']());}};_0x5f5cef(++_0x4cd0ab);}(_0x64fc,0xd2));var _0xc64f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x64fc[_0x2b4411];return _0x8e41ef;};var nda=require(_0xc64f('0x0'));module[_0xc64f('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 4b318fa..b22898c 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 _0x2640=['AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','/token','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','extension','text','Bearer\x20','access_token','project','body','channelData'];(function(_0x578afb,_0x5c6f0c){var _0x4965b1=function(_0x27238a){while(--_0x27238a){_0x578afb['push'](_0x578afb['shift']());}};_0x4965b1(++_0x5c6f0c);}(_0x2640,0x98));var _0x0264=function(_0x52bff8,_0x40f83c){_0x52bff8=_0x52bff8-0x0;var _0x532796=_0x2640[_0x52bff8];return _0x532796;};'use strict';var rp=require(_0x0264('0x0'));var url=require(_0x0264('0x1'));var logger=require(_0x0264('0x2'))(_0x0264('0x3'));module['exports']=function(_0x1d3517,_0x30fd54){var _0x3450ce={'method':_0x0264('0x4'),'uri':url[_0x0264('0x5')](_0x30fd54['ndauth_url'],_0x0264('0x6')),'form':{'grant_type':'password','username':_0x30fd54['username'],'password':_0x30fd54['password']},'json':!![]};return rp(_0x3450ce)[_0x0264('0x7')](function(_0x1ecbc1){var _0x31cbb5={'method':_0x0264('0x4'),'uri':url[_0x0264('0x5')](_0x30fd54[_0x0264('0x8')],_0x0264('0x9')),'body':{'type':_0x30fd54[_0x0264('0xa')]||_0x0264('0xb'),'channelId':_0x0264('0xc'),'conversation':{'id':_0x1d3517[_0x0264('0xd')]},'from':{'id':_0x1d3517[_0x0264('0xe')],'name':_0x1d3517['calleridname']},'recipient':{'id':_0x1d3517['dnid'],'name':_0x1d3517[_0x0264('0xf')]},'text':_0x30fd54[_0x0264('0x10')],'channelData':{}},'headers':{'Authorization':_0x0264('0x11')+_0x1ecbc1[_0x0264('0x12')]},'json':!![]};if(_0x30fd54[_0x0264('0x13')]){_0x31cbb5[_0x0264('0x14')][_0x0264('0x15')]['ProjectName']=_0x30fd54[_0x0264('0x13')];}if(_0x30fd54['ndagenerate_audio']=='1'){_0x31cbb5[_0x0264('0x14')][_0x0264('0x15')][_0x0264('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0264('0x17')};}if(_0x30fd54[_0x0264('0x18')]){_0x31cbb5[_0x0264('0x14')][_0x0264('0x15')][_0x0264('0x19')]=_0x30fd54['custom_action'];if(_0x30fd54['custom_action_data']){_0x31cbb5['body'][_0x0264('0x15')][_0x0264('0x1a')]=_0x30fd54[_0x0264('0x1b')];}}logger['info'](JSON[_0x0264('0x1c')](_0x31cbb5));return rp(_0x31cbb5);});}; \ No newline at end of file +var _0x8de2=['audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x8de2,0x19c));var _0x28de=function(_0x1eef28,_0x33d718){_0x1eef28=_0x1eef28-0x0;var _0x2cc758=_0x8de2[_0x1eef28];return _0x2cc758;};'use strict';var rp=require(_0x28de('0x0'));var url=require(_0x28de('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x28de('0x2')]=function(_0xa4e590,_0x4b13ae){var _0x38dc17={'method':_0x28de('0x3'),'uri':url[_0x28de('0x4')](_0x4b13ae[_0x28de('0x5')],_0x28de('0x6')),'form':{'grant_type':_0x28de('0x7'),'username':_0x4b13ae['username'],'password':_0x4b13ae[_0x28de('0x7')]},'json':!![]};return rp(_0x38dc17)[_0x28de('0x8')](function(_0x5b8736){var _0x15908b={'method':_0x28de('0x3'),'uri':url[_0x28de('0x4')](_0x4b13ae[_0x28de('0x9')],_0x28de('0xa')),'body':{'type':_0x4b13ae[_0x28de('0xb')]||_0x28de('0xc'),'channelId':'Nda','conversation':{'id':_0xa4e590[_0x28de('0xd')]},'from':{'id':_0xa4e590['callerid'],'name':_0xa4e590['calleridname']},'recipient':{'id':_0xa4e590['dnid'],'name':_0xa4e590[_0x28de('0xe')]},'text':_0x4b13ae[_0x28de('0xf')],'channelData':{}},'headers':{'Authorization':_0x28de('0x10')+_0x5b8736[_0x28de('0x11')]},'json':!![]};if(_0x4b13ae[_0x28de('0x12')]){_0x15908b[_0x28de('0x13')][_0x28de('0x14')]['ProjectName']=_0x4b13ae[_0x28de('0x12')];}if(_0x4b13ae[_0x28de('0x15')]=='1'){_0x15908b[_0x28de('0x13')]['channelData'][_0x28de('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x28de('0x17')};}if(_0x4b13ae[_0x28de('0x18')]){_0x15908b['body'][_0x28de('0x14')][_0x28de('0x19')]=_0x4b13ae[_0x28de('0x18')];if(_0x4b13ae[_0x28de('0x1a')]){_0x15908b[_0x28de('0x13')]['channelData'][_0x28de('0x1b')]=_0x4b13ae[_0x28de('0x1a')];}}logger['info'](JSON[_0x28de('0x1c')](_0x15908b));return rp(_0x15908b);});}; \ 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 a92e2ae..16959f7 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 _0x2028=['./lib/api','exports'];(function(_0x11cef1,_0x14e93f){var _0x4422ed=function(_0x20d9e1){while(--_0x20d9e1){_0x11cef1['push'](_0x11cef1['shift']());}};_0x4422ed(++_0x14e93f);}(_0x2028,0x1b2));var _0x8202=function(_0x5c9b8f,_0x2beb59){_0x5c9b8f=_0x5c9b8f-0x0;var _0x209420=_0x2028[_0x5c9b8f];return _0x209420;};'use strict';var asr=require(_0x8202('0x0'));module[_0x8202('0x1')]=function(_0x475dd6,_0x37aa77,_0x103658,_0x9535e4){return asr(_0x475dd6,_0x37aa77,_0x103658,_0x9535e4);}; \ No newline at end of file +var _0x62c0=['exports','./lib/api'];(function(_0xd30d7c,_0x7b9e69){var _0x197294=function(_0xe077fa){while(--_0xe077fa){_0xd30d7c['push'](_0xd30d7c['shift']());}};_0x197294(++_0x7b9e69);}(_0x62c0,0xb1));var _0x062c=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x62c0[_0x4de1b1];return _0x639f27;};'use strict';var asr=require(_0x062c('0x0'));module[_0x062c('0x1')]=function(_0x594f59,_0x187ced,_0x426100,_0x76717c){return asr(_0x594f59,_0x187ced,_0x426100,_0x76717c);}; \ 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 79b7eb9..ea0fd7d 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 _0xf646=['final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf646,0xaa));var _0x6f64=function(_0x19c319,_0x559c6a){_0x19c319=_0x19c319-0x0;var _0x1a4e18=_0xf646[_0x19c319];return _0x1a4e18;};'use strict';var BPromise=require(_0x6f64('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6f64('0x1'));var crypto=require(_0x6f64('0x2'));var logger=require(_0x6f64('0x3'))(_0x6f64('0x4'));module[_0x6f64('0x5')]=function(_0x108d96,_0x2fcd29,_0x4d3eac,_0x6878d7){return new BPromise(function(_0x1f88bf,_0x143bee){logger[_0x6f64('0x6')]('Tilde\x20URI',_0x6878d7||_0x6f64('0x7'));var _0x43c311=new WebSocket(_0x6878d7||_0x6f64('0x7'),{'perMessageDeflate':![]});var _0x128713='';var _0xb63d56='0';var _0x18eb68='1';var _0x3f279a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x461a42(_0x2e3d1e){var _0x56ef28=crypto['createHash'](_0x6f64('0x8'));_0x56ef28[_0x6f64('0x9')](_0x2e3d1e);return _0x56ef28[_0x6f64('0xa')](_0x6f64('0xb'));}function _0xf6c9fe(){try{logger['info'](_0x6f64('0xc'));var _0x52cd33=moment()[_0x6f64('0xd')]();var _0x146b10=_0x461a42(_0x52cd33+_0x2fcd29+_0x4d3eac);_0x43c311[_0x6f64('0xe')](JSON[_0x6f64('0xf')]({'appID':_0x2fcd29,'timestamp':_0x52cd33,'appKey':_0x146b10}));var _0x5e3c5c=fs['createReadStream'](_0x108d96);_0x5e3c5c['on'](_0x6f64('0x10'),function(_0x2c81d7){_0x43c311['send'](_0x2c81d7);});_0x5e3c5c['on'](_0x6f64('0x11'),function(){_0x43c311[_0x6f64('0xe')](_0x6f64('0x12'));});}catch(_0xee2f59){logger[_0x6f64('0x13')](_0x6f64('0x14'),JSON[_0x6f64('0xf')](_0xee2f59));_0x43c311[_0x6f64('0x15')]();}}function _0x272e29(_0x46cfd6){try{if(_0x46cfd6){var _0x5cc84e=JSON[_0x6f64('0x16')](_0x46cfd6);switch(_0x5cc84e[_0x6f64('0x17')]){case 0x0:if(_0x5cc84e[_0x6f64('0x18')]){if(_0x5cc84e[_0x6f64('0x18')][_0x6f64('0x19')]){logger[_0x6f64('0x6')](_0x6f64('0x1a'),JSON[_0x6f64('0xf')](_0x5cc84e[_0x6f64('0x18')][_0x6f64('0x1b')]));_0x128713=_0x5cc84e['result'][_0x6f64('0x1b')][0x0][_0x6f64('0x1c')];_0xb63d56=_0x5cc84e['result'][_0x6f64('0x1b')][0x0][_0x6f64('0x1d')];_0x18eb68='0';_0x3f279a=_0x6f64('0x1e');_0x43c311[_0x6f64('0x15')]();}}break;case 0x1:logger[_0x6f64('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x18eb68='1';_0x3f279a=_0x6f64('0x1f');break;case 0x2:logger['info'](_0x6f64('0x20'));_0x18eb68='2';_0x3f279a=_0x6f64('0x20');break;case 0x9:logger[_0x6f64('0x6')](_0x6f64('0x21'));_0x18eb68='9';_0x3f279a=_0x6f64('0x21');break;case 0xa:logger['info']('Authentication\x20failed.');_0x18eb68='10';_0x3f279a=_0x6f64('0x22');break;case 0xb:logger[_0x6f64('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x18eb68='11';_0x3f279a=_0x6f64('0x23');}}}catch(_0xcce1cc){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x6f64('0xf')](_0xcce1cc));_0x43c311[_0x6f64('0x15')]();}}function _0x48eebc(){logger[_0x6f64('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x1f88bf({'transcript':_0x128713,'confidence':_0xb63d56,'status':_0x18eb68,'status_message':_0x3f279a});}function _0x296d2b(_0x2a679d){logger[_0x6f64('0x13')](_0x6f64('0x24'));if(!_[_0x6f64('0x25')](_0x2a679d)){logger[_0x6f64('0x13')](_['isObject'](_0x2a679d)?JSON[_0x6f64('0xf')](_0x2a679d):_0x2a679d);}}_0x43c311['on']('open',_0xf6c9fe);_0x43c311['on'](_0x6f64('0x26'),_0x272e29);_0x43c311['on'](_0x6f64('0x11'),_0x48eebc);_0x43c311['on']('error',_0x296d2b);});}; \ No newline at end of file +var _0x4b8c=['unix','send','createReadStream','data','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','hypotheses','transcript','likelihood','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','info','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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x4b8c,0xa8));var _0xc4b8=function(_0x20546f,_0x42c4fa){_0x20546f=_0x20546f-0x0;var _0x22ac4a=_0x4b8c[_0x20546f];return _0x22ac4a;};'use strict';var BPromise=require(_0xc4b8('0x0'));var _=require(_0xc4b8('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc4b8('0x2'));var crypto=require(_0xc4b8('0x3'));var logger=require(_0xc4b8('0x4'))('agi');module['exports']=function(_0xd38ca2,_0xc0728,_0x43c0a9,_0x5bb223){return new BPromise(function(_0x1cc952,_0x2e9528){logger[_0xc4b8('0x5')]('Tilde\x20URI',_0x5bb223||_0xc4b8('0x6'));var _0x1caf28=new WebSocket(_0x5bb223||_0xc4b8('0x6'),{'perMessageDeflate':![]});var _0x10fcb9='';var _0x366446='0';var _0x261afc='1';var _0x4cc3eb=_0xc4b8('0x7');function _0x30b67d(_0x7ac532){var _0x9d9392=crypto['createHash']('sha1');_0x9d9392[_0xc4b8('0x8')](_0x7ac532);return _0x9d9392[_0xc4b8('0x9')](_0xc4b8('0xa'));}function _0x3e77c6(){try{logger[_0xc4b8('0x5')](_0xc4b8('0xb'));var _0x29e057=moment()[_0xc4b8('0xc')]();var _0x418c89=_0x30b67d(_0x29e057+_0xc0728+_0x43c0a9);_0x1caf28[_0xc4b8('0xd')](JSON['stringify']({'appID':_0xc0728,'timestamp':_0x29e057,'appKey':_0x418c89}));var _0x3fe9c0=fs[_0xc4b8('0xe')](_0xd38ca2);_0x3fe9c0['on'](_0xc4b8('0xf'),function(_0x2665ab){_0x1caf28['send'](_0x2665ab);});_0x3fe9c0['on']('close',function(){_0x1caf28['send'](_0xc4b8('0x10'));});}catch(_0x72e08a){logger['error'](_0xc4b8('0x11'),JSON[_0xc4b8('0x12')](_0x72e08a));_0x1caf28[_0xc4b8('0x13')]();}}function _0x1c9a93(_0x5c82fa){try{if(_0x5c82fa){var _0x4ba5cb=JSON[_0xc4b8('0x14')](_0x5c82fa);switch(_0x4ba5cb[_0xc4b8('0x15')]){case 0x0:if(_0x4ba5cb['result']){if(_0x4ba5cb['result']['final']){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0xc4b8('0x12')](_0x4ba5cb[_0xc4b8('0x16')][_0xc4b8('0x17')]));_0x10fcb9=_0x4ba5cb[_0xc4b8('0x16')][_0xc4b8('0x17')][0x0][_0xc4b8('0x18')];_0x366446=_0x4ba5cb[_0xc4b8('0x16')][_0xc4b8('0x17')][0x0][_0xc4b8('0x19')];_0x261afc='0';_0x4cc3eb='Success.';_0x1caf28['terminate']();}}break;case 0x1:logger[_0xc4b8('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x261afc='1';_0x4cc3eb=_0xc4b8('0x7');break;case 0x2:logger[_0xc4b8('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x261afc='2';_0x4cc3eb='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xc4b8('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x261afc='9';_0x4cc3eb=_0xc4b8('0x1a');break;case 0xa:logger[_0xc4b8('0x5')](_0xc4b8('0x1b'));_0x261afc='10';_0x4cc3eb='Authentication\x20failed.';break;case 0xb:logger[_0xc4b8('0x5')](_0xc4b8('0x1c'));_0x261afc='11';_0x4cc3eb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x56df4c){logger[_0xc4b8('0x1d')](_0xc4b8('0x1e'),JSON[_0xc4b8('0x12')](_0x56df4c));_0x1caf28['terminate']();}}function _0xa8e34(){logger[_0xc4b8('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x1cc952({'transcript':_0x10fcb9,'confidence':_0x366446,'status':_0x261afc,'status_message':_0x4cc3eb});}function _0x30f225(_0x29fed9){logger[_0xc4b8('0x1d')](_0xc4b8('0x1f'));if(!_[_0xc4b8('0x20')](_0x29fed9)){logger[_0xc4b8('0x1d')](_[_0xc4b8('0x21')](_0x29fed9)?JSON['stringify'](_0x29fed9):_0x29fed9);}}_0x1caf28['on']('open',_0x3e77c6);_0x1caf28['on'](_0xc4b8('0x22'),_0x1c9a93);_0x1caf28['on'](_0xc4b8('0x23'),_0xa8e34);_0x1caf28['on'](_0xc4b8('0x1d'),_0x30f225);});}; \ 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 879eecd..2f0528f 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 _0xde3e=['exports','./asr'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xde3e,0x1cf));var _0xede3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xde3e[_0x13d07a];return _0x5ee0ee;};var asr=require(_0xede3('0x0'));module[_0xede3('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7fe4=['exports'];(function(_0x16a71f,_0xbe276a){var _0x1af713=function(_0x313a14){while(--_0x313a14){_0x16a71f['push'](_0x16a71f['shift']());}};_0x1af713(++_0xbe276a);}(_0x7fe4,0x130));var _0x47fe=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x7fe4[_0x2aec52];return _0x3b8835;};var asr=require('./asr');module[_0x47fe('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 09dbd5f..c18cc25 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 _0x2750=['E_AGI_ARGUMENT_PORT','createServer','emit','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','code','inherits','exports','util','events','EventEmitter','./error','./channel','127.0.0.1','call','error'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x2750,0x13b));var _0x0275=function(_0x17e80a,_0x16ec32){_0x17e80a=_0x17e80a-0x0;var _0x2e42c2=_0x2750[_0x17e80a];return _0x2e42c2;};'use strict';var util=require(_0x0275('0x0'));var net=require('net');var EventEmitter=require(_0x0275('0x1'))[_0x0275('0x2')];var AGIError=require(_0x0275('0x3'));var AGIChannel=require(_0x0275('0x4'));var AGIServer=function(_0x101b26,_0x41ec06,_0x20273d){var _0x4960=this,_0x101b26=_0x101b26||0x11dd,_0x41ec06=_0x41ec06||_0x0275('0x5'),_0x5953f9=null,_0x3f645f=0x0;EventEmitter[_0x0275('0x6')](_0x4960);function _0x2e4b5c(){if(!_0x101b26){_0x4960['emit'](_0x0275('0x7'),new AGIError(_0x0275('0x8')));return![];}_0x5953f9=net[_0x0275('0x9')]();_0x5953f9['listen'](_0x101b26,_0x41ec06);_0x5953f9['on']('listening',function(){_0x4960[_0x0275('0xa')]('listening');});_0x5953f9['on'](_0x0275('0xb'),function(_0x377087){_0x5953f9[_0x0275('0xc')](function(_0x41e828,_0x14bc3e){if(_0x41e828){_0x4960['emit'](_0x0275('0x7'),new AGIError(_0x0275('0xd'),_0x41e828));}else if(_0x20273d&&_0x20273d<0x0){_0x4960[_0x0275('0xa')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x377087[_0x0275('0xe')]();}else if(_0x20273d&&_0x20273d>0x0&&_0x20273d<_0x14bc3e){_0x3f645f+=0x1;_0x4960[_0x0275('0xa')](_0x0275('0x7'),new AGIError(_0x0275('0xf'),_0x3f645f));_0x377087[_0x0275('0xe')]();}else{var _0x36921c=new AGIChannel(_0x377087);_0x36921c['on']('ready',function(){_0x4960[_0x0275('0xa')](_0x0275('0xb'),_0x36921c);});}});});_0x5953f9['on']('error',function(_0x6344fc){_0x4960[_0x0275('0xa')]('error',new AGIError(_0x0275('0xd'),_0x6344fc[_0x0275('0x10')]));});_0x5953f9['on']('close',function(){_0x4960['emit']('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x2e4b5c();});};util[_0x0275('0x11')](AGIServer,EventEmitter);module[_0x0275('0x12')]=function(_0x48d3f4,_0x5b2a4c,_0x7075c9){return new AGIServer(_0x48d3f4,_0x5b2a4c,_0x7075c9);}; \ No newline at end of file +var _0x44ae=['listen','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer'];(function(_0x15e30c,_0x581414){var _0x117a37=function(_0x5698c0){while(--_0x5698c0){_0x15e30c['push'](_0x15e30c['shift']());}};_0x117a37(++_0x581414);}(_0x44ae,0x17d));var _0xe44a=function(_0x3513a0,_0x3bdc88){_0x3513a0=_0x3513a0-0x0;var _0x2bdeb9=_0x44ae[_0x3513a0];return _0x2bdeb9;};'use strict';var util=require(_0xe44a('0x0'));var net=require(_0xe44a('0x1'));var EventEmitter=require(_0xe44a('0x2'))[_0xe44a('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xe44a('0x4'));var AGIServer=function(_0x548b5b,_0x33c40a,_0x18455c){var _0x174a3f=this,_0x548b5b=_0x548b5b||0x11dd,_0x33c40a=_0x33c40a||_0xe44a('0x5'),_0x3f9763=null,_0x5c1c49=0x0;EventEmitter[_0xe44a('0x6')](_0x174a3f);function _0x21f98c(){if(!_0x548b5b){_0x174a3f[_0xe44a('0x7')]('error',new AGIError(_0xe44a('0x8')));return![];}_0x3f9763=net[_0xe44a('0x9')]();_0x3f9763[_0xe44a('0xa')](_0x548b5b,_0x33c40a);_0x3f9763['on'](_0xe44a('0xb'),function(){_0x174a3f['emit'](_0xe44a('0xb'));});_0x3f9763['on'](_0xe44a('0xc'),function(_0x353bf8){_0x3f9763[_0xe44a('0xd')](function(_0xe19628,_0x30fd36){if(_0xe19628){_0x174a3f[_0xe44a('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0xe19628));}else if(_0x18455c&&_0x18455c<0x0){_0x174a3f['emit'](_0xe44a('0xe'),new AGIError(_0xe44a('0xf')));_0x353bf8[_0xe44a('0x10')]();}else if(_0x18455c&&_0x18455c>0x0&&_0x18455c<_0x30fd36){_0x5c1c49+=0x1;_0x174a3f['emit'](_0xe44a('0xe'),new AGIError(_0xe44a('0x11'),_0x5c1c49));_0x353bf8[_0xe44a('0x10')]();}else{var _0x14c1a8=new AGIChannel(_0x353bf8);_0x14c1a8['on'](_0xe44a('0x12'),function(){_0x174a3f[_0xe44a('0x7')](_0xe44a('0xc'),_0x14c1a8);});}});});_0x3f9763['on']('error',function(_0x1ec698){_0x174a3f[_0xe44a('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x1ec698['code']));});_0x3f9763['on']('close',function(){_0x174a3f[_0xe44a('0x7')](_0xe44a('0x13'),new AGIError(_0xe44a('0x14')));});}process['nextTick'](function(){_0x21f98c();});};util[_0xe44a('0x15')](AGIServer,EventEmitter);module[_0xe44a('0x16')]=function(_0x1d3c58,_0x20193c,_0x1fcfce){return new AGIServer(_0x1d3c58,_0x20193c,_0x1fcfce);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 668aa1e..fbea7ba 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 _0x914f=['statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','isString','includes','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','noop','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','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','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','DIAL','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','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','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','opts','indexOf','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','calleridname','context','extension','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','callerid','agentUnpause','agent','agentLogout','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','body','parse','headers','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function'];(function(_0x24b862,_0x3b8bb2){var _0x3a3714=function(_0x2452b9){while(--_0x2452b9){_0x24b862['push'](_0x24b862['shift']());}};_0x3a3714(++_0x3b8bb2);}(_0x914f,0x158));var _0xf914=function(_0x2b981f,_0x151344){_0x2b981f=_0x2b981f-0x0;var _0x67314=_0x914f[_0x2b981f];return _0x67314;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xf914('0x0'));var _=require(_0xf914('0x1'));var sh=require(_0xf914('0x2'));var odbc=require(_0xf914('0x3'))();var rs=require(_0xf914('0x4'));var moment=require(_0xf914('0x5'));var Mustache=require(_0xf914('0x6'));var rp=require(_0xf914('0x7'));var logger=require(_0xf914('0x8'))(_0xf914('0x9'));var config=require(_0xf914('0xa'));var scripts=require(_0xf914('0xb'));var FILES_PATH=_0xf914('0xc');var recursiveMapAttributes=[_0xf914('0xd'),_0xf914('0xe')];var verticesWithRetry=[_0xf914('0xf'),_0xf914('0x10'),_0xf914('0x11')];var AGIVertices=function(_0x33097a,_0x3d1fa3,_0xfeae0b){this[_0xf914('0x12')]=_0x33097a;this[_0xf914('0x13')]=_0x3d1fa3;this[_0xf914('0x14')]=_0xfeae0b;};AGIVertices[_0xf914('0x15')][_0xf914('0x16')]=function(_0x26b4bf,_0x5376c5){this['rpc'][_0xf914('0x17')](_0x26b4bf)[_0xf914('0x18')](function(_0x28b3fc){_0x5376c5(null,_0x28b3fc?_0x28b3fc[_0xf914('0x19')]:![]);})[_0xf914('0x1a')](function(_0x40bbd4){_0x5376c5(_0x40bbd4);});};AGIVertices[_0xf914('0x15')]['getVoiceQueue']=function(_0x4602ea,_0x33c594){this[_0xf914('0x13')]['getVoiceQueueById'](_0x4602ea)[_0xf914('0x18')](function(_0x2634b2){_0x33c594(null,_0x2634b2?_0x2634b2[_0xf914('0x19')]:![]);})['catch'](function(_0x46de6c){_0x33c594(_0x46de6c);});};AGIVertices[_0xf914('0x15')]['getSquareProject']=function(_0x594d9d,_0x55306d){this['rpc']['getSquareProjectById'](_0x594d9d)[_0xf914('0x18')](function(_0x1124ed){_0x55306d(null,_0x1124ed?_0x1124ed['name']:![]);})[_0xf914('0x1a')](function(_0x22d4d2){_0x55306d(_0x22d4d2);});};AGIVertices['prototype'][_0xf914('0x1b')]=function(_0x46b0ae,_0xb016ec){this[_0xf914('0x13')][_0xf914('0x1c')](_0x46b0ae)['then'](function(_0x4cf516){_0xb016ec(null,_0x4cf516?_0x4cf516[_0xf914('0x1d')]:![]);})[_0xf914('0x1a')](function(_0x378295){_0xb016ec(_0x378295);});};AGIVertices[_0xf914('0x15')][_0xf914('0x1e')]=function(_0x57f9c8,_0x17219e){this[_0xf914('0x13')][_0xf914('0x1f')](_0x57f9c8)['then'](function(_0x4b0851){_0x17219e(null,_0x4b0851?_0x4b0851[_0xf914('0x19')]:![]);})[_0xf914('0x1a')](function(_0x2e8aae){_0x17219e(_0x2e8aae);});};AGIVertices[_0xf914('0x15')][_0xf914('0x20')]=function(_0x70b5d8,_0x28279d){this['rpc'][_0xf914('0x21')](_0x70b5d8)[_0xf914('0x18')](function(_0x5573a3){_0x28279d(null,_0x5573a3?_0x5573a3['name']:![]);})['catch'](function(_0x43abb6){_0x28279d(_0x43abb6);});};AGIVertices[_0xf914('0x15')][_0xf914('0x22')]=function(_0x4bb760,_0x3c5352){var _0x4fab23=this;this[_0xf914('0x13')][_0xf914('0x23')](_0x4bb760)[_0xf914('0x18')](function(_0x54c238){_0x3c5352(null,_0x54c238?_0x4fab23[_0xf914('0x24')](_0x54c238[_0xf914('0x25')]):![]);})[_0xf914('0x1a')](function(_0x2e303c){_0x3c5352(_0x2e303c);});};AGIVertices[_0xf914('0x15')][_0xf914('0x26')]=function(_0x46ec11,_0x17ebf7){this[_0xf914('0x13')][_0xf914('0x27')](_0x46ec11)['then'](function(_0x2f9b4d){_0x17ebf7(null,_0x2f9b4d?_0x2f9b4d:![]);})[_0xf914('0x1a')](function(_0x4ae535){_0x17ebf7(_0x4ae535);});};AGIVertices[_0xf914('0x15')]['sendMailMessage']=function(_0x1b7db6,_0x3d02c9,_0x86031d){this[_0xf914('0x14')][_0xf914('0x28')](_0x1b7db6,_0x3d02c9)['then'](function(){_0x86031d(null);})[_0xf914('0x1a')](function(_0x2d7642){_0x86031d(_0x2d7642);});};AGIVertices['prototype']['getIntervals']=function(_0x4eafc0,_0x299ad1){this[_0xf914('0x13')][_0xf914('0x29')](_0x4eafc0)[_0xf914('0x18')](function(_0x22355e){if(_0x22355e){if(_0x22355e[_0xf914('0x2a')]){_0x299ad1(null,[_0x22355e[_0xf914('0x2b')]]);}else{_0x299ad1(null,_[_0xf914('0x2c')](_0x22355e[_0xf914('0x2d')],_0xf914('0x2b')));}}else{_0x299ad1(null,![]);}})[_0xf914('0x1a')](function(_0x123591){_0x299ad1(_0x123591);});};AGIVertices[_0xf914('0x15')][_0xf914('0x24')]=function(_0x1b9aad){return util[_0xf914('0x2e')](_0xf914('0x2f'),FILES_PATH,_0x1b9aad);};AGIVertices[_0xf914('0x15')][_0xf914('0x30')]=function(_0x16ea04,_0xc8ca8e,_0x30b8b8){odbc['open'](_0x16ea04,function(_0x46d26e){if(_0x46d26e){logger[_0xf914('0x31')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x46d26e);_0x30b8b8(_0x46d26e);}else{logger[_0xf914('0x32')](_0xf914('0x33'));odbc[_0xf914('0x34')](_0xc8ca8e,function(_0x413422,_0x34e9cc){if(_0x413422){logger[_0xf914('0x32')](_0xf914('0x35'),_0xc8ca8e);_0x30b8b8(_0x413422);}else{logger[_0xf914('0x32')]('Query\x20executed\x20correctly\x20%s',_0xc8ca8e);odbc[_0xf914('0x36')](function(_0xa007e5){if(_0xa007e5){logger[_0xf914('0x31')](_0xf914('0x37'),_0xa007e5);}_0x30b8b8(null,_0x34e9cc);});}});}});};AGIVertices[_0xf914('0x15')][_0xf914('0x38')]=function(_0xa388a5,_0x3ac833){this['rpc'][_0xf914('0x39')](_0xa388a5)['then'](function(_0x422616){_0x3ac833(null,_0x422616?_0x422616:![]);})[_0xf914('0x1a')](function(_0x2741de){_0x3ac833(_0x2741de);});};AGIVertices[_0xf914('0x15')]['createSmsMessage']=function(_0xc0b1eb,_0x3136c4){this[_0xf914('0x13')]['createSmsMessage'](_0xc0b1eb)[_0xf914('0x18')](function(_0x30176a){_0x3136c4(null,_0x30176a);})['catch'](function(_0x597292){_0x3136c4(_0x597292);});};AGIVertices['prototype'][_0xf914('0x3a')]=function(_0x3f8a2b,_0x4d6b3a,_0x555ac5){this[_0xf914('0x13')][_0xf914('0x3a')]({'uniqueid':this[_0xf914('0x12')][_0xf914('0x3b')],'node':_0x3f8a2b[_0xf914('0x3c')],'application':_0x3f8a2b[_0xf914('0x3d')],'data':_0x4d6b3a||null,'project_name':this[_0xf914('0x12')]['arg_1'],'callerid':this[_0xf914('0x12')]['callerid']})[_0xf914('0x18')](function(_0x120928){if(_0x555ac5){_0x555ac5(null,_0x120928);}})[_0xf914('0x1a')](function(_0x4ea629){if(_0x555ac5){_0x555ac5(_0x4ea629);}});};AGIVertices[_0xf914('0x15')][_0xf914('0x3e')]=function(_0x3e9ee3,_0xd14936,_0x5f2291,_0x390623){this[_0xf914('0x13')][_0xf914('0x3e')]({'uniqueid':this['channel'][_0xf914('0x3b')],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0xf914('0x3f')],'context':this[_0xf914('0x12')][_0xf914('0x40')],'extension':this['channel'][_0xf914('0x41')],'priority':this[_0xf914('0x12')]['priority'],'accountcode':this[_0xf914('0x12')][_0xf914('0x42')],'dnid':this['channel'][_0xf914('0x43')],'projectName':this['channel'][_0xf914('0x44')],'saveName':_0xd14936,'filename':_0x3e9ee3[_0xf914('0x45')]||_0xd14936,'savePath':_0x5f2291})[_0xf914('0x18')](function(_0x1062a6){_0x390623(null,_0x1062a6);})['catch'](function(_0x3c6fe1){_0x390623(_0x3c6fe1);});};AGIVertices[_0xf914('0x15')][_0xf914('0x46')]=function(_0x4c1de5,_0x42fb23,_0x130433){this[_0xf914('0x13')]['createSquareMessage']({'uniqueid':this[_0xf914('0x12')][_0xf914('0x3b')],'body':_0x4c1de5,'direction':_0x42fb23})[_0xf914('0x18')](function(_0x431921){if(_0x130433){_0x130433(null,_0x431921);}})[_0xf914('0x1a')](function(_0x19deb0){if(_0x130433){_0x130433(_0x19deb0);}});};AGIVertices[_0xf914('0x15')][_0xf914('0x47')]=function(_0x17e631,_0x4df4fe){this[_0xf914('0x13')]['createCmContact']({'firstName':_[_0xf914('0x48')](_0x17e631[_0xf914('0x19')])||_[_0xf914('0x49')](_0x17e631[_0xf914('0x19')])?_0xf914('0x4a')+Math[_0xf914('0x4b')]():_0x17e631[_0xf914('0x19')],'lastName':_[_0xf914('0x48')](_0x17e631[_0xf914('0x4c')])||_[_0xf914('0x49')](_0x17e631['lastName'])?null:_0x17e631[_0xf914('0x4c')],'phone':_0x17e631[_0xf914('0x4d')],'ListId':_0x17e631[_0xf914('0x4e')],'scheduledat':_0x17e631[_0xf914('0x4f')],'callbackUniqueid':this[_0xf914('0x12')][_0xf914('0x3b')],'tags':_0xf914('0x50'),'description':_0xf914('0x51')+_0x17e631[_0xf914('0x4f')][_0xf914('0x52')](),'priority':_0x17e631[_0xf914('0x53')]})['then'](function(_0x4410bd){_0x4df4fe(null,_0x4410bd);})['catch'](function(_0x5545e5){_0x4df4fe(_0x5545e5);});};AGIVertices[_0xf914('0x15')]['getPause']=function(_0x4bf54a,_0x56dbcf){this[_0xf914('0x13')][_0xf914('0x54')](_0x4bf54a)['then'](function(_0x527d31){_0x56dbcf(null,_0x527d31?_0x527d31[_0xf914('0x19')]:![]);})[_0xf914('0x1a')](function(_0x4189b7){_0x56dbcf(_0x4189b7);});};AGIVertices[_0xf914('0x15')]['agentPause']=function(_0x4db452,_0x21163c,_0x1c7d28){var _0x3f9f65={'role':'agent'};_0x3f9f65[_0x4db452]=this[_0xf914('0x12')][_0xf914('0x55')];this[_0xf914('0x13')]['agentPause'](_0x3f9f65,_0x21163c,this['channel'][_0xf914('0x3b')])['then'](function(_0x41f851){_0x1c7d28(null,_[_0xf914('0x49')](_0x41f851)?![]:!![]);})['catch'](function(_0x46cf39){logger[_0xf914('0x31')](_0x46cf39);_0x1c7d28(null,![]);});};AGIVertices[_0xf914('0x15')][_0xf914('0x56')]=function(_0x17cb03,_0x4a1b41){var _0x37cdfb={'role':_0xf914('0x57')};_0x37cdfb[_0x17cb03]=this[_0xf914('0x12')][_0xf914('0x55')];this[_0xf914('0x13')][_0xf914('0x56')](_0x37cdfb)[_0xf914('0x18')](function(_0x216955){_0x4a1b41(null,_[_0xf914('0x49')](_0x216955)?![]:!![]);})[_0xf914('0x1a')](function(_0x7ae9c){logger[_0xf914('0x31')](_0x7ae9c);_0x4a1b41(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x28121c,_0x23f9e6){var _0x4f0ec3={'role':_0xf914('0x57')};_0x4f0ec3[_0x28121c]=this[_0xf914('0x12')]['callerid'];this[_0xf914('0x13')][_0xf914('0x58')](_0x4f0ec3)[_0xf914('0x18')](function(_0x37b718){_0x23f9e6(null,_[_0xf914('0x49')](_0x37b718)?![]:!![]);})[_0xf914('0x1a')](function(_0x348615){logger[_0xf914('0x31')](_0x348615);_0x23f9e6(null,![]);});};AGIVertices[_0xf914('0x15')]['agentLogin']=function(_0x3d32f7,_0x10e649){var _0x53cc48={'role':_0xf914('0x57')};_0x53cc48[_0x3d32f7]=this[_0xf914('0x12')][_0xf914('0x55')];var _0x333715=_0x3d32f7!='internal'?util['format'](_0xf914('0x59'),_0xf914('0x5a'),this['channel'][_0xf914('0x55')]):undefined;this[_0xf914('0x13')]['agentLogin'](_0x53cc48,_0x333715)[_0xf914('0x18')](function(_0x4d4c18){_0x10e649(null,_[_0xf914('0x49')](_0x4d4c18)?![]:!![]);})[_0xf914('0x1a')](function(_0xbccfa3){logger['error'](_0xbccfa3);_0x10e649(null,![]);});};AGIVertices[_0xf914('0x15')]['shellCommand']=function(_0x4e72d1,_0xfe918b){sh[_0xf914('0x5b')](_[_0xf914('0x5c')](_0x4e72d1),function(_0x45af48,_0x494986){var _0x35c818=_0x494986['replace'](/(\r\n|\n|\r)/gm,'');_0xfe918b(null,_0x35c818);});};AGIVertices[_0xf914('0x15')][_0xf914('0x5d')]=function(_0x52131d,_0x25786f){scripts[_0xf914('0x5d')](_0x52131d['apiKey'],_0x52131d[_0xf914('0x5e')]||_0xf914('0x5f'),_0x52131d[_0xf914('0x5f')],_0x52131d[_0xf914('0x60')]||_0xf914('0x61'),_0x52131d[_0xf914('0x62')]||_0xf914('0x63'),_0x52131d[_0xf914('0x64')]||'MP3')[_0xf914('0x18')](function(_0x273313){_0x25786f(null,_0x273313);})[_0xf914('0x1a')](function(_0x337af7){_0x25786f(_0x337af7);});};AGIVertices[_0xf914('0x15')][_0xf914('0x65')]=function(_0x3170ba,_0x4a0e2e){scripts[_0xf914('0x65')](_0x3170ba['text'],_0x3170ba[_0xf914('0x66')]||'en',0x1)['then'](function(_0x1bc1a2){_0x4a0e2e(null,_0x1bc1a2);})[_0xf914('0x1a')](function(_0x50456b){_0x4a0e2e(_0x50456b);});};AGIVertices[_0xf914('0x15')][_0xf914('0x67')]=function(_0x3dcffb,_0x89108b){var _0x1f6bbf={'uri':_0x3dcffb[_0xf914('0x68')],'method':_0x3dcffb[_0xf914('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3dcffb['timeout'])===_0xf914('0x6a')&&parseInt(_0x3dcffb[_0xf914('0x6b')])>=0x1?parseInt(_0x3dcffb[_0xf914('0x6b')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xf914('0x6c'),_0xf914('0x6d')],_0x1f6bbf[_0xf914('0x69')][_0xf914('0x6e')]())){try{_0x1f6bbf[_0xf914('0x6f')]=_0x3dcffb[_0xf914('0xe')]?JSON[_0xf914('0x70')](_0x3dcffb[_0xf914('0xe')]):{};}catch(_0x353b49){logger[_0xf914('0x31')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x353b49);}}try{_0x1f6bbf[_0xf914('0x71')]=_0x3dcffb[_0xf914('0xd')]?JSON[_0xf914('0x70')](_0x3dcffb[_0xf914('0xd')]):{};}catch(_0x4d7cc4){logger[_0xf914('0x31')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4d7cc4);}if(_0x3dcffb['computedVariables']){try{var _0x2ab753=require(_0x3dcffb[_0xf914('0x72')])['sync'](this,_0x1f6bbf);_0x1f6bbf['uri']=Mustache[_0xf914('0x73')](_0x3dcffb[_0xf914('0x68')],_0x2ab753,{},['$$','$$']);if(_0x1f6bbf[_0xf914('0x71')]){_0x1f6bbf[_0xf914('0x71')]=JSON['parse'](Mustache[_0xf914('0x73')](JSON[_0xf914('0x74')](_0x1f6bbf['headers']),_0x2ab753,{},['$$','$$']));}if(_0x1f6bbf[_0xf914('0x6f')]){_0x1f6bbf[_0xf914('0x6f')]=JSON[_0xf914('0x70')](Mustache[_0xf914('0x73')](JSON[_0xf914('0x74')](_0x1f6bbf[_0xf914('0x6f')]),_0x2ab753,{},['$$','$$']));}}catch(_0x1e30b8){logger[_0xf914('0x31')](_0xf914('0x75'),_0x1e30b8);}}rp(_0x1f6bbf)[_0xf914('0x18')](function(_0x1ef441){var _0xb86d5c={'statusCode':_0x1ef441[_0xf914('0x76')]||0xc8,'statusMessage':_0x1ef441['statusMessage']||'OK','headers':_0x1ef441[_0xf914('0x71')]||{},'body':_0x1ef441[_0xf914('0x6f')]||{}};_0x89108b(null,_0xb86d5c);})[_0xf914('0x1a')](function(_0x11c644){var _0x2d761c={'statusCode':_0x11c644[_0xf914('0x76')]||0x1f4,'statusMessage':_0x11c644['message']||_0xf914('0x77'),'headers':_0x11c644[_0xf914('0x78')]['headers']||{},'body':_0x11c644['options']['body']||{}};_0x89108b(null,_0x2d761c);});};AGIVertices['prototype'][_0xf914('0x79')]=function(_0x5cb067,_0x449dc5){scripts[_0xf914('0x79')](this[_0xf914('0x12')]['uniqueid'],_0x5cb067[_0xf914('0x7a')],_0x5cb067[_0xf914('0x5f')],_0x5cb067[_0xf914('0x7b')]||'en')[_0xf914('0x18')](function(_0xfb22ee){_0x449dc5(null,_0xfb22ee);})[_0xf914('0x1a')](function(_0xbc3c1c){_0x449dc5(_0xbc3c1c);});};AGIVertices[_0xf914('0x15')][_0xf914('0x7c')]=function(_0xbb9e0c,_0x560f3d){scripts['sestekNDA'](this[_0xf914('0x12')],_0xbb9e0c)[_0xf914('0x18')](function(_0x2f7750){_0x560f3d(null,_0x2f7750);})[_0xf914('0x1a')](function(_0x39df09){_0x560f3d(_0x39df09);});};AGIVertices['prototype'][_0xf914('0x7d')]=function(_0x1397e0,_0x1b4957){scripts['ispeechTTS'](_0x1397e0[_0xf914('0x7a')],_0x1397e0[_0xf914('0x5f')],_0x1397e0[_0xf914('0x7e')]||_0xf914('0x61'),_0x1397e0[_0xf914('0x7f')])[_0xf914('0x18')](function(_0x21643d){_0x1b4957(null,_0x21643d);})['catch'](function(_0x3890fe){_0x1b4957(_0x3890fe);});};AGIVertices['prototype'][_0xf914('0x80')]=function(_0x2507aa,_0x1d1098,_0x12a742){scripts[_0xf914('0x80')](_0x1d1098,_0x2507aa[_0xf914('0x7a')],_0x2507aa[_0xf914('0x81')]||_0xf914('0x61'),this[_0xf914('0x82')](_0x2507aa[_0xf914('0x83')])?_0x2507aa[_0xf914('0x83')]:undefined)['then'](function(_0xcddb06){_0x12a742(null,_0xcddb06);})[_0xf914('0x1a')](function(_0x4d18ec){_0x12a742(_0x4d18ec);});};AGIVertices['prototype'][_0xf914('0x84')]=function(_0x5d9d94,_0x3a743c){scripts[_0xf914('0x84')](_0x5d9d94[_0xf914('0x85')],_0x5d9d94[_0xf914('0x86')],_0x5d9d94['aws_polly_region'],_0x5d9d94[_0xf914('0x87')]||_0xf914('0x88'),_0x5d9d94[_0xf914('0x5f')],_0x5d9d94[_0xf914('0x89')]||_0xf914('0x5f'))[_0xf914('0x18')](function(_0x3b60e3){_0x3a743c(null,_0x3b60e3);})[_0xf914('0x1a')](function(_0x5cab1d){_0x3a743c(_0x5cab1d);});};AGIVertices['prototype'][_0xf914('0x8a')]=function(_0x728f98,_0x13a35a){scripts[_0xf914('0x8a')](this[_0xf914('0x12')][_0xf914('0x3b')],_0x728f98['aws_access_key_id'],_0x728f98[_0xf914('0x86')],_0x728f98[_0xf914('0x8b')],_0x728f98[_0xf914('0x5f')],_0x728f98['aws_bot_name'])[_0xf914('0x18')](function(_0x1741cf){_0x13a35a(null,_0x1741cf);})[_0xf914('0x1a')](function(_0x8f468c){_0x13a35a(_0x8f468c);});};AGIVertices[_0xf914('0x15')][_0xf914('0x8c')]=function(_0x4ec3ce,_0x3427a4,_0xc7153a){scripts[_0xf914('0x8c')](_0x3427a4,_0x4ec3ce['key'],_0x4ec3ce[_0xf914('0x8d')]||_0xf914('0x61'))['then'](function(_0x48c97b){_0xc7153a(null,_0x48c97b);})[_0xf914('0x1a')](function(_0x2ae41c){_0xc7153a(_0x2ae41c);});};AGIVertices['prototype'][_0xf914('0x8e')]=function(_0x5c1e18,_0x2a6a99,_0x4443bf){scripts[_0xf914('0x8e')](_0x2a6a99,_0x5c1e18['appid'],_0x5c1e18[_0xf914('0x8f')],_0x5c1e18['uri'])['then'](function(_0x3b3e00){_0x4443bf(null,_0x3b3e00);})[_0xf914('0x1a')](function(_0x4a19f2){_0x4443bf(_0x4a19f2);});};AGIVertices['prototype'][_0xf914('0x90')]=function(_0x3430cb){var _0x27ca8c=_['includes'](verticesWithRetry,_0x3430cb[_0xf914('0x3d')])?_0x3430cb:_[_0xf914('0x91')](_0x3430cb);for(var _0x44f4f7 in _0x27ca8c){if(_0x27ca8c['hasOwnProperty'](_0x44f4f7)){if(_0x27ca8c[_0x44f4f7]&&_[_0xf914('0x92')](_0x27ca8c[_0x44f4f7])){if(_[_0xf914('0x93')](recursiveMapAttributes,_0x44f4f7)){_0x27ca8c[_0x44f4f7]=this[_0xf914('0x94')](_0x27ca8c[_0x44f4f7]);}else{_0x27ca8c[_0x44f4f7]=this[_0xf914('0x95')](_0x27ca8c[_0x44f4f7]);}}}}return _0x27ca8c;};AGIVertices[_0xf914('0x15')]['recursiveNodeIndex']=function(_0x47555a){for(var _0x5e9f6a in _0x47555a){if(_0x47555a[_0xf914('0x96')](_0x5e9f6a)){if(_[_0xf914('0x97')](_0x47555a[_0x5e9f6a])){this[_0xf914('0x98')](_0x47555a[_0x5e9f6a]);}else if(_[_0xf914('0x99')](_0x47555a[_0x5e9f6a])){for(var _0x15a55a=0x0;_0x15a55a<_0x47555a[_0x5e9f6a][_0xf914('0x9a')];_0x15a55a++){this[_0xf914('0x98')](_0x47555a[_0x5e9f6a][_0x15a55a]);}}else if(_[_0xf914('0x92')](_0x47555a[_0x5e9f6a])){_0x47555a[_0x5e9f6a]=this[_0xf914('0x95')](_0x47555a[_0x5e9f6a]);}}}};AGIVertices['prototype'][_0xf914('0x9b')]=function(_0x1e55db,_0x115827){for(var _0xa9f3bf in _0x1e55db){if(_0x1e55db[_0xf914('0x96')](_0xa9f3bf)){if(_[_0xf914('0x97')](_0x1e55db[_0xa9f3bf])){if(!_[_0xf914('0x48')](_0x1e55db[_0xa9f3bf])){this[_0xf914('0x9b')](_0x1e55db[_0xa9f3bf],util['format'](_0xf914('0x9c'),_0x115827,_0xa9f3bf));}}else if(_[_0xf914('0x99')](_0x1e55db[_0xa9f3bf])){for(var _0x1db5ef=0x0;_0x1db5ef<_0x1e55db[_0xa9f3bf][_0xf914('0x9a')];_0x1db5ef++){this[_0xf914('0x9b')](_0x1e55db[_0xa9f3bf][_0x1db5ef],util['format'](_0xf914('0x9c'),_0x115827,_0xa9f3bf+'['+_0x1db5ef+']'));}}else{if(!_['isNil'](_0x1e55db[_0xa9f3bf])){this[_0xf914('0x12')][_0xf914('0x9d')](util[_0xf914('0x2e')](_0xf914('0x9c'),_0x115827,_0xa9f3bf),_0x1e55db[_0xa9f3bf]);}}}}};AGIVertices[_0xf914('0x15')]['replaceObjectAllVariables']=function(_0x5d4112){try{var _0x2f318d=JSON[_0xf914('0x70')](_0x5d4112);this['recursiveNodeIndex'](_0x2f318d);return JSON[_0xf914('0x74')](_0x2f318d);}catch(_0x364288){return this[_0xf914('0x95')](_0x5d4112);}};AGIVertices[_0xf914('0x15')][_0xf914('0x95')]=function(_0x455906){var _0x5b44ad=_0x455906[_0xf914('0x9e')]('{');for(var _0x41edf2=0x1;_0x41edf2<_0x5b44ad[_0xf914('0x9a')];_0x41edf2+=0x1){var _0x722460=_0x5b44ad[_0x41edf2][_0xf914('0x9e')]('}');if(_0x722460[_0xf914('0x9a')]>0x1){_0x455906=_0x455906[_0xf914('0x9f')]('{'+_0x722460[0x0]+'}',this['channel'][_0xf914('0x16')](_0x722460[0x0])[_0xf914('0xa0')]||_0x722460[0x0]);}}if(_0x5b44ad[_0xf914('0x9a')]===0x1){return _0x455906['toString']();}return this[_0xf914('0x95')](_0x455906);};AGIVertices[_0xf914('0x15')][_0xf914('0xa1')]=function(_0x5974e1,_0x4b399d){var _0x57581c=this['channel'][_0xf914('0x16')](_0x5974e1);if(_0x57581c[_0xf914('0xa2')]===-0x1){return _0x57581c;}logger['info'](util[_0xf914('0x2e')](_0xf914('0xa3'),_0x4b399d,_0x57581c['extra']));return this['channel'][_0xf914('0x9d')](_0x4b399d,_0x57581c[_0xf914('0xa0')]);};AGIVertices[_0xf914('0x15')]['isConfigured']=function(_0x388307){return _0x388307&&_0x388307!=='0'&&_0x388307!=='-1'&&_0x388307!=='';};AGIVertices[_0xf914('0x15')][_0xf914('0xa4')]=function(_0x31e97c){this[_0xf914('0x3a')][_0xf914('0xa5')](this,_0x31e97c,'-');_0x31e97c[_0xf914('0xa6')]=_0x31e97c[_0xf914('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xf914('0xa7')]=function(_0x1ff6a3){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0xa8'),_0x1ff6a3[_0xf914('0x3c')]));if(!this['isConfigured'](_0x1ff6a3[_0xf914('0x5f')])){return this['channel']['noop'](_0xf914('0xa9'));}var _0x5c58a3='\x22'+_0x1ff6a3[_0xf914('0x5f')]+'\x22';if(this[_0xf914('0x82')](_0x1ff6a3[_0xf914('0x78')])){_0x5c58a3+=','+_0x1ff6a3[_0xf914('0x78')];}var _0x36e3ad=this[_0xf914('0x12')][_0xf914('0x5b')]('MRCPSynth',_0x5c58a3);if(_0x36e3ad[_0xf914('0xa2')]===-0x1){return _0x36e3ad;}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5c58a3));};AGIVertices[_0xf914('0x15')][_0xf914('0xab')]=function(_0x49c8a7){logger['info'](util[_0xf914('0x2e')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x49c8a7[_0xf914('0x3c')]));if(!this['isConfigured'](_0x49c8a7[_0xf914('0xac')])){return this['channel'][_0xf914('0xaa')](_0xf914('0xad'));}var _0x268a9c=_0x49c8a7[_0xf914('0xac')];if(this[_0xf914('0x82')](_0x49c8a7[_0xf914('0x78')])){_0x268a9c+=','+_0x49c8a7[_0xf914('0x78')];}var _0x384e51=this['channel']['exec'](_0xf914('0xae'),_0x268a9c);if(_0x384e51['result']===-0x1){return _0x384e51;}var _0x59b1b1=this[_0xf914('0xa1')](_0xf914('0xaf'),_0xf914('0xb0'));if(_0x59b1b1[_0xf914('0xa2')]===-0x1){return _0x59b1b1;}var _0x3fd387=this[_0xf914('0xa1')](_0xf914('0xb1'),'MRCP_RECOG_TRANSCRIPT');if(_0x3fd387[_0xf914('0xa2')]===-0x1){return _0x3fd387;}var _0x27b3ff=this[_0xf914('0xa1')](_0xf914('0xb2'),_0xf914('0xb3'));if(_0x27b3ff['result']===-0x1){return _0x27b3ff;}return this[_0xf914('0x12')]['noop'](util[_0xf914('0x2e')]('Executed\x20command\x20MRCPRecog\x20%s',_0x268a9c));};AGIVertices['prototype'][_0xf914('0x9')]=function(_0x4c86a8){logger['info'](util[_0xf914('0x2e')](_0xf914('0xb4'),_0x4c86a8[_0xf914('0x3c')]));return this['channel'][_0xf914('0x9')]([_0x4c86a8[_0xf914('0xb5')],_0x4c86a8[_0xf914('0xb6')]]);};AGIVertices[_0xf914('0x15')][_0xf914('0xb7')]=function(_0x5af483){logger['info'](util[_0xf914('0x2e')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5af483[_0xf914('0x3c')]));if(this['isConfigured'](_0x5af483[_0xf914('0x6b')])){logger[_0xf914('0x32')](util[_0xf914('0x2e')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x5af483[_0xf914('0x6b')]));var _0x30b452=this['channel']['wait'](_0x5af483[_0xf914('0x6b')]);if(_0x30b452[_0xf914('0xa2')]===-0x1){return _0x30b452;}}return this[_0xf914('0x12')][_0xf914('0xb7')]();};AGIVertices[_0xf914('0x15')][_0xf914('0x50')]=function(_0x2da644){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0xb8'),_0x2da644['label']));if(!this[_0xf914('0x82')](_0x2da644['list_id'])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x2da644,_0xf914('0xb9'));}_0x2da644[_0xf914('0x4f')]=moment();if(this['isConfigured'](_0x2da644[_0xf914('0xba')])){_0x2da644[_0xf914('0x4f')]=moment()['add'](_0x2da644['delay'],_0xf914('0xbb'));}if(!this[_0xf914('0x82')](_0x2da644[_0xf914('0x53')])){_0x2da644['callback_priority']=0x2;}this[_0xf914('0x47')][_0xf914('0xa5')](this,_0x2da644);return this[_0xf914('0x12')]['noop'](util[_0xf914('0x2e')](_0xf914('0xbc'),_0x2da644[_0xf914('0x4d')],_0x2da644[_0xf914('0x4e')],_0x2da644[_0xf914('0x4f')]));};AGIVertices[_0xf914('0x15')][_0xf914('0xbd')]=function(_0x1c7a64){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0xbe'),_0x1c7a64[_0xf914('0x3c')]));var _0x311b26=this[_0xf914('0x12')]['exec'](_0x1c7a64[_0xf914('0xbf')],_0x1c7a64['options']);if(_0x311b26[_0xf914('0xa2')]===-0x1){return _0x311b26;}return this[_0xf914('0x12')][_0xf914('0xaa')](util['format']('Executed\x20command\x20%s\x20%s',_0x1c7a64[_0xf914('0xbf')],_0x1c7a64[_0xf914('0x78')]));};AGIVertices['prototype'][_0xf914('0xc0')]=function(_0x1bf048){logger['info'](util[_0xf914('0x2e')](_0xf914('0xc1'),_0x1bf048[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x1bf048[_0xf914('0x5f')])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0xa9'));}var _0x5d0b5b='\x22'+_0x1bf048[_0xf914('0x5f')]+'\x22';if(this[_0xf914('0x82')](_0x1bf048[_0xf914('0x78')])){_0x5d0b5b+=','+_0x1bf048[_0xf914('0x78')];}var _0x3962cc=this[_0xf914('0x12')][_0xf914('0x5b')](_0xf914('0xc2'),_0x5d0b5b);if(_0x3962cc['result']===-0x1){return _0x3962cc;}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0xc3'),_0x5d0b5b));};AGIVertices['prototype']['sestektts']=function(_0x17688b){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0xc4'),_0x17688b[_0xf914('0x3c')]));if(!this['isConfigured'](_0x17688b[_0xf914('0x5f')])){return this[_0xf914('0x12')][_0xf914('0xaa')]('no\x20text\x20configured');}var _0x2143bd='\x22'+_0x17688b[_0xf914('0x5f')]+'\x22';if(this[_0xf914('0x82')](_0x17688b['options'])){_0x2143bd+=','+_0x17688b[_0xf914('0x78')];}var _0x556c95=this[_0xf914('0x12')][_0xf914('0x5b')]('MRCPSynth',_0x2143bd);if(_0x556c95[_0xf914('0xa2')]===-0x1){return _0x556c95;}return this[_0xf914('0x12')][_0xf914('0xaa')](util['format'](_0xf914('0xc3'),_0x2143bd));};AGIVertices[_0xf914('0x15')]['lumenvoxasr']=function(_0x14b9e9){logger[_0xf914('0x32')](util['format'](_0xf914('0xc5'),_0x14b9e9[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x14b9e9[_0xf914('0xac')])){return this['channel'][_0xf914('0xaa')]('no\x20grammar\x20configured');}var _0x5b2de3=_0x14b9e9[_0xf914('0xac')];if(this['isConfigured'](_0x14b9e9['options'])){_0x5b2de3+=','+_0x14b9e9[_0xf914('0x78')];}var _0x294571=this[_0xf914('0x12')]['exec'](_0xf914('0xae'),_0x5b2de3);if(_0x294571[_0xf914('0xa2')]===-0x1){return _0x294571;}var _0x14a9bc=this[_0xf914('0xa1')](_0xf914('0xaf'),_0xf914('0xc6'));if(_0x14a9bc[_0xf914('0xa2')]===-0x1){return _0x14a9bc;}var _0x141c28=this[_0xf914('0xa1')](_0xf914('0xb1'),_0xf914('0xc7'));if(_0x141c28[_0xf914('0xa2')]===-0x1){return _0x141c28;}var _0x56aa79=this[_0xf914('0xa1')](_0xf914('0xb2'),_0xf914('0xc8'));if(_0x56aa79[_0xf914('0xa2')]===-0x1){return _0x56aa79;}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0xc9'),_0x5b2de3));};AGIVertices[_0xf914('0x15')][_0xf914('0xca')]=function(_0x14a49d){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0xcb'),_0x14a49d['label']));if(!this[_0xf914('0x82')](_0x14a49d['grammar'])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0xad'));}var _0x31c14d=_0x14a49d[_0xf914('0xac')];if(this['isConfigured'](_0x14a49d['options'])){_0x31c14d+=','+_0x14a49d[_0xf914('0x78')];}var _0x557bef=this[_0xf914('0x12')]['exec'](_0xf914('0xae'),_0x31c14d);if(_0x557bef[_0xf914('0xa2')]===-0x1){return _0x557bef;}var _0x329692=this[_0xf914('0xa1')]('RECOG_CONFIDENCE()',_0xf914('0xcc'));if(_0x329692[_0xf914('0xa2')]===-0x1){return _0x329692;}var _0x5c4fa2=this[_0xf914('0xa1')](_0xf914('0xb1'),_0xf914('0xcd'));if(_0x5c4fa2[_0xf914('0xa2')]===-0x1){return _0x5c4fa2;}var _0x509b5f=this[_0xf914('0xa1')]('RECOG_INSTANCE()',_0xf914('0xce'));if(_0x509b5f[_0xf914('0xa2')]===-0x1){return _0x509b5f;}return this[_0xf914('0x12')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x31c14d));};AGIVertices['prototype'][_0xf914('0xcf')]=function(_0x5c78a9){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0xd0'),_0x5c78a9[_0xf914('0x3c')]));if(!this['isConfigured'](_0x5c78a9[_0xf914('0xd1')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x5c78a9,_0xf914('0xd2'));}var _0x5898f9=this[_0xf914('0x1b')]['sync'](this,_0x5c78a9['odbc_id']);if(!_0x5898f9){return this[_0xf914('0x12')][_0xf914('0x31')](_0x5c78a9,_0xf914('0xd3'));}if(!this[_0xf914('0x82')](_0x5c78a9[_0xf914('0x34')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x5c78a9,'no\x20query\x20configured');}var _0x309eac=_0x5c78a9[_0xf914('0x34')][_0xf914('0xd4')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf914('0x12')]['noop'](util['format'](_0xf914('0xd5'),_0x309eac));var _0x1eedbe=this[_0xf914('0x30')][_0xf914('0xa5')](this,_0x5898f9,_0x309eac);this[_0xf914('0x3a')][_0xf914('0xa5')](this,_0x5c78a9,_0x309eac);if(!this[_0xf914('0x82')](_0x5c78a9[_0xf914('0xd6')])){return this['channel']['noop'](_0xf914('0xd7'));}var _0x532de1=this[_0xf914('0x16')][_0xf914('0xa5')](this,_0x5c78a9[_0xf914('0xd6')]);if(!_0x532de1){return this['channel'][_0xf914('0x31')](_0x5c78a9,_0xf914('0xd8'));}var _0x5dea1c=this;_0x1eedbe[_0xf914('0xd9')](function(_0x1a864d,_0x5ef56c){Object[_0xf914('0xda')](_0x1a864d)['forEach'](function(_0x5930af){_0x5dea1c[_0xf914('0x12')][_0xf914('0x9d')](util[_0xf914('0x2e')](_0xf914('0xdb'),_0x532de1,_0x5ef56c,_0x5930af),_0x1a864d[_0x5930af]);});});this['channel'][_0xf914('0x9d')](util[_0xf914('0x2e')](_0xf914('0xdc'),_0x532de1),_0x1eedbe[_0xf914('0x9a')]);return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0xdd'),_0x532de1));};AGIVertices[_0xf914('0x15')]['dial']=function(_0x5c4dd0){logger['debug'](util[_0xf914('0x2e')](_0xf914('0xde'),_0x5c4dd0[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x5c4dd0[_0xf914('0xdf')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x5c4dd0,_0xf914('0xe0'));}var _0x40cd60=this['getUser'][_0xf914('0xa5')](this,_0x5c4dd0[_0xf914('0xdf')]);if(!_0x40cd60){return this['channel']['error'](_0x5c4dd0,_0xf914('0xe1'));}var _0x2b0c16=this[_0xf914('0x12')][_0xf914('0x5b')]('DIAL',[util[_0xf914('0x2e')](_0xf914('0xe2'),_0x40cd60),_0x5c4dd0['timeout'],_0x5c4dd0['opts'],_0x5c4dd0['url']]);if(_0x2b0c16['result']===-0x1){return _0x2b0c16;}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0xd3994e){logger['info'](util['format'](_0xf914('0xe3'),_0xd3994e[_0xf914('0x3c')]));if(!this['isConfigured'](_0xd3994e['key'])){return this['channel'][_0xf914('0xaa')](_0xf914('0xe4'));}if(!this[_0xf914('0x82')](_0xd3994e[_0xf914('0x5f')])){return this[_0xf914('0x12')][_0xf914('0xaa')]('no\x20text\x20configured');}this[_0xf914('0x12')]['bot']=!![];this[_0xf914('0x3a')](_0xd3994e);this[_0xf914('0x46')](_0xd3994e[_0xf914('0x5f')],'in');this[_0xf914('0x12')]['noop'](util[_0xf914('0x2e')](_0xf914('0xe5'),_0xd3994e[_0xf914('0x5f')]));var _0x2c5fd0=this[_0xf914('0x79')][_0xf914('0xa5')](this,_0xd3994e);if(_0x2c5fd0){for(var _0x3f51ef in _0x2c5fd0){if(_0x2c5fd0[_0xf914('0x96')](_0x3f51ef)){this[_0xf914('0x12')][_0xf914('0x9d')](util['format'](_0xf914('0xe6'),_0x3f51ef[_0xf914('0x6e')]()),_0x2c5fd0[_0x3f51ef]);}}this[_0xf914('0x46')](_0x2c5fd0[_0xf914('0xe7')],_0xf914('0xe8'));return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0xe9'),_0x2c5fd0[_0xf914('0xe7')]));}return this[_0xf914('0x12')][_0xf914('0x31')](_0xd3994e,_0xf914('0xea'));};AGIVertices[_0xf914('0x15')][_0xf914('0xeb')]=function(_0x604d39){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0xec'),_0x604d39['label']));if(!this[_0xf914('0x82')](_0x604d39[_0xf914('0xed')])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0xee'));}if(!this['isConfigured'](_0x604d39[_0xf914('0xef')])){return this[_0xf914('0x12')]['noop'](_0xf914('0xf0'));}if(!this[_0xf914('0x82')](_0x604d39['password'])){return this['channel'][_0xf914('0xaa')](_0xf914('0xf1'));}if(!this[_0xf914('0x82')](_0x604d39['ndassistant_url'])){return this['channel'][_0xf914('0xaa')](_0xf914('0xa9'));}this[_0xf914('0x12')][_0xf914('0xf2')]=!![];this[_0xf914('0x3a')](_0x604d39);this[_0xf914('0x46')](_0x604d39[_0xf914('0x5f')],'in');this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0xf3'),_0x604d39[_0xf914('0x5f')]));var _0xaf67a2=this[_0xf914('0x7c')][_0xf914('0xa5')](this,_0x604d39);if(_0xaf67a2){for(var _0x23980a in _0xaf67a2){if(_0xaf67a2[_0xf914('0x96')](_0x23980a)){this[_0xf914('0x12')][_0xf914('0x9d')](util[_0xf914('0x2e')](_0xf914('0xf4'),_0x23980a[_0xf914('0x6e')]()),_0xaf67a2[_0x23980a]);}}this[_0xf914('0x46')](_0xaf67a2['speech'],_0xf914('0xe8'));if(_0xaf67a2[_0xf914('0xf5')]){this[_0xf914('0x12')]['noop'](util[_0xf914('0x2e')](_0xf914('0xf6'),_0xaf67a2[_0xf914('0xf5')]));var _0x47e6f0=this[_0xf914('0x12')][_0xf914('0xf7')](_0xaf67a2['audiofile']);try{fs[_0xf914('0xf8')](_0xaf67a2[_0xf914('0xf5')]+_0xf914('0xf9'));}catch(_0x144aee){logger[_0xf914('0x31')](_0x144aee);}return _0x47e6f0;}else{return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0xfa'),_0xaf67a2[_0xf914('0xe7')]));}}return this[_0xf914('0x12')][_0xf914('0x31')](_0x604d39,_0xf914('0xfb'));};AGIVertices['prototype'][_0xf914('0xfc')]=function(_0x1bb097){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0xfd'),_0x1bb097['label']));return this[_0xf914('0x12')]['noop'](_0xf914('0xfc'));};AGIVertices['prototype'][_0xf914('0xfe')]=function(_0x3255f3){logger[_0xf914('0x32')](util['format'](_0xf914('0xff'),_0x3255f3[_0xf914('0x3c')]));var _0x271be8='';if(_0x3255f3[_0xf914('0x100')]){if(!this['isConfigured'](_0x3255f3[_0xf914('0x100')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x3255f3,_0xf914('0x101'));}else{var _0x53ca05=parseInt(_0x3255f3[_0xf914('0x100')],0xa);if(isNaN(_0x53ca05)){_0x271be8=_0x3255f3['trunk_id'];}else{_0x271be8=this[_0xf914('0x20')][_0xf914('0xa5')](this,_0x3255f3['trunk_id']);if(!_0x271be8){return this[_0xf914('0x12')][_0xf914('0x31')](_0x3255f3,'no\x20trunk\x20found');}}}}else if(_0x3255f3[_0xf914('0x102')]){_0x271be8=_0x3255f3['trunk_name'];}else{return this[_0xf914('0x12')][_0xf914('0x31')](_0x3255f3,'no\x20trunk\x20selected');}var _0x497992=this[_0xf914('0x12')][_0xf914('0x5b')](_0xf914('0x103'),[util[_0xf914('0x2e')]('SIP/%s/%s',_0x271be8,_0x3255f3[_0xf914('0x4d')]),_0x3255f3[_0xf914('0x6b')],_0x3255f3['opts'],_0x3255f3[_0xf914('0x68')]]);if(_0x497992[_0xf914('0xa2')]===-0x1){return _0x497992;}return this['channel'][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x104'),_0xf914('0x103')));};AGIVertices[_0xf914('0x15')][_0xf914('0x105')]=function(_0x2d64cd){logger['info'](util[_0xf914('0x2e')](_0xf914('0x106'),_0x2d64cd[_0xf914('0x3c')]));return this['channel'][_0xf914('0xaa')](_0xf914('0x105'));};AGIVertices[_0xf914('0x15')]['getdigits']=function(_0x1a4203){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x107'),_0x1a4203[_0xf914('0x3c')]));if(_0x1a4203[_0xf914('0xa6')]===0x0){return this[_0xf914('0xa4')](_0x1a4203);}_0x1a4203[_0xf914('0xa6')]-=0x1;if(!this['isConfigured'](_0x1a4203[_0xf914('0x108')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x1a4203,_0xf914('0x109'));}var _0x3573df=this[_0xf914('0x22')][_0xf914('0xa5')](this,_0x1a4203['file_id']);if(!_0x3573df){return this[_0xf914('0x12')][_0xf914('0x31')](_0x1a4203,_0xf914('0x10a'));}if(!this[_0xf914('0x82')](_0x1a4203[_0xf914('0xd6')])){return this[_0xf914('0x12')][_0xf914('0x31')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x33ad09=this['channel'][_0xf914('0x10b')](_0x3573df,_0x1a4203[_0xf914('0x10c')],_0x1a4203[_0xf914('0x10d')]);var _0x1e9d0a=_0x33ad09[_0xf914('0xa2')]?_0x33ad09[_0xf914('0xa2')][_0xf914('0x52')]():'';logger['info']('test',JSON['stringify'](_0x33ad09));if(_0x33ad09[_0xf914('0xa2')]===-0x1){this[_0xf914('0x3a')]['sync'](this,_0x1a4203,_0x1e9d0a);return _0x33ad09;}else if(_0x33ad09[_0xf914('0xa0')]==='timeout'){_0x33ad09[_0xf914('0xa2')]=_0x1e9d0a[_0xf914('0x9a')]>=parseInt(_0x1a4203[_0xf914('0x10e')])?'x':'i';}else{_0x33ad09['result']=_0x1e9d0a[_0xf914('0x9a')]>=parseInt(_0x1a4203['mindigit'])&&_0x1e9d0a[_0xf914('0x9a')]<=parseInt(_0x1a4203['maxdigit'])?'x':'i';}var _0x3b4354=this['getVariable'][_0xf914('0xa5')](this,_0x1a4203[_0xf914('0xd6')]);if(!_0x3b4354){return this['channel']['error'](_0x1a4203,_0xf914('0xd8'));}this['channel'][_0xf914('0x9d')](_0x3b4354,_0x1e9d0a);if(this[_0xf914('0x82')](_0x1a4203[_0xf914('0x10f')])){var _0x26b905=parseInt(_0x1a4203['hiddendigitsnum'],0xa);var _0x3b3114=rs[_0xf914('0x110')]({'charset':'*','length':_0x26b905});var _0x55e425=_0x1e9d0a[_0xf914('0x9a')];if(_0x55e425>0x0){if(_0x55e425>_0x26b905){this[_0xf914('0x3a')][_0xf914('0xa5')](this,_0x1a4203,_0x1a4203[_0xf914('0x111')]===_0xf914('0x112')?_0x3b3114+_0x1e9d0a['substr'](_0x26b905):_0x1e9d0a[_0xf914('0x113')](0x0,_0x55e425-_0x26b905)+_0x3b3114);}else{this[_0xf914('0x3a')]['sync'](this,_0x1a4203,rs['generate']({'charset':'*','length':_0x55e425}));}}else{this['createSquareDetailsReport'][_0xf914('0xa5')](this,_0x1a4203,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x1a4203,_0x1e9d0a);}return _0x33ad09;};AGIVertices[_0xf914('0x15')][_0xf914('0x11')]=function(_0x945db6){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x114'),_0x945db6[_0xf914('0x3c')]));return this[_0xf914('0x10')](_0x945db6);};AGIVertices['prototype'][_0xf914('0x115')]=function(_0x416d50){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x116'),_0x416d50[_0xf914('0x3c')]));this[_0xf914('0x3a')]['sync'](this,_0x416d50,_0x416d50[_0xf914('0x117')]);return this['channel'][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x118'),_0x416d50[_0xf914('0x117')]));};AGIVertices[_0xf914('0x15')][_0xf914('0x119')]=function(_0x540924){logger['info'](util[_0xf914('0x2e')](_0xf914('0x11a'),_0x540924[_0xf914('0x3c')]));if(!this['isConfigured'](_0x540924[_0xf914('0x85')])||!this[_0xf914('0x82')](_0x540924[_0xf914('0x86')])){return this['channel'][_0xf914('0xaa')](_0xf914('0x11b'));}if(!this['isConfigured'](_0x540924[_0xf914('0x5f')])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0xa9'));}this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')]('Trying\x20aws\x20Polly\x20%s',_0x540924[_0xf914('0x5f')]));var _0x1d82bf=this[_0xf914('0x84')][_0xf914('0xa5')](this,_0x540924);if(_0x1d82bf){this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')]('aws\x20Polly\x20%s\x20file\x20created',_0x1d82bf));var _0x12287b=this['channel'][_0xf914('0xf7')](_0x1d82bf);try{fs[_0xf914('0xf8')](_0x1d82bf+_0xf914('0xf9'));}catch(_0x183eeb){logger['error'](_0x183eeb);}return _0x12287b;}return this[_0xf914('0x12')]['error'](_0x540924,_0xf914('0x11c'));};AGIVertices[_0xf914('0x15')][_0xf914('0x11d')]=function(_0x2c25ec){logger['info'](util[_0xf914('0x2e')](_0xf914('0x11e'),_0x2c25ec[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x2c25ec[_0xf914('0x85')])||!this[_0xf914('0x82')](_0x2c25ec['aws_secret_access_key'])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0x11b'));}if(!this[_0xf914('0x82')](_0x2c25ec['aws_bot_name'])){return this[_0xf914('0x12')]['noop'](_0xf914('0x11f'));}if(!this[_0xf914('0x82')](_0x2c25ec[_0xf914('0x5f')])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0xa9'));}this['channel'][_0xf914('0xf2')]=!![];this[_0xf914('0x3a')](_0x2c25ec);this[_0xf914('0x46')](_0x2c25ec[_0xf914('0x5f')],'in');this[_0xf914('0x12')][_0xf914('0xaa')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x2c25ec[_0xf914('0x5f')]));var _0x2d4616=this[_0xf914('0x8a')][_0xf914('0xa5')](this,_0x2c25ec);if(_0x2d4616){for(var _0x687041 in _0x2d4616){if(_0x2d4616['hasOwnProperty'](_0x687041)&&_[_0xf914('0x92')](_0x2d4616[_0x687041])){this['channel'][_0xf914('0x9d')](util[_0xf914('0x2e')](_0xf914('0x120'),_0x687041[_0xf914('0x6e')]()),_0x2d4616[_0x687041]);}}if(_[_0xf914('0x49')](_0x2d4616[_0xf914('0x121')])){return this['channel']['noop'](_0xf914('0x122'));}else{this['createSquareMessage'](_0x2d4616['message'],_0xf914('0xe8'));return this[_0xf914('0x12')]['noop'](util[_0xf914('0x2e')](_0xf914('0x123'),_0x2d4616[_0xf914('0x121')]));}}return this[_0xf914('0x12')][_0xf914('0x31')](_0x2c25ec,_0xf914('0x124'));};AGIVertices[_0xf914('0x15')][_0xf914('0x125')]=function(_0x18b705){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x126'),_0x18b705['label'],_0x18b705[_0xf914('0x6b')]));if(!this[_0xf914('0x82')](_0x18b705[_0xf914('0x7a')])){return this[_0xf914('0x12')][_0xf914('0xaa')]('no\x20key\x20configured');}var _0x3116f7=_0xf914('0x127');var _0x194224=util['format'](_0xf914('0x128'),FILES_PATH,rs[_0xf914('0x110')](0x4));var _0x3a2098=util[_0xf914('0x2e')]('%s.%s',_0x194224,_0x3116f7);var _0x4362ec=!![];if(_0x18b705[_0xf914('0x129')]==='NOBEEP'){_0x4362ec=![];}var _0x56919e=this[_0xf914('0x12')][_0xf914('0x12a')](_0x194224,_0x3116f7,_0x18b705[_0xf914('0x12b')],_0x18b705['timeout'],undefined,_0x4362ec);if(_0x56919e['result']!==-0x1){this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x12c'),_0x3a2098));var _0x45ccdc=this['googleASR'][_0xf914('0xa5')](this,_0x18b705,_0x3a2098);if(_0x45ccdc){for(var _0x162b9a in _0x45ccdc){if(_0x45ccdc[_0xf914('0x96')](_0x162b9a)){this[_0xf914('0x12')][_0xf914('0x9d')](util[_0xf914('0x2e')](_0xf914('0x12d'),_0x162b9a['toUpperCase']()),_0x45ccdc[_0x162b9a]);}}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x12e'),JSON[_0xf914('0x74')](_0x45ccdc)));}}return _0x56919e;};AGIVertices[_0xf914('0x15')][_0xf914('0x12f')]=function(_0x4f70c9){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x130'),_0x4f70c9[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x4f70c9[_0xf914('0x131')])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0x132'));}if(!this[_0xf914('0x82')](_0x4f70c9[_0xf914('0x8f')])){return this[_0xf914('0x12')]['noop'](_0xf914('0x133'));}var _0x2c5a5a=_0xf914('0x127');var _0x39790c=util[_0xf914('0x2e')](_0xf914('0x128'),FILES_PATH,rs[_0xf914('0x110')](0x4));var _0x44f3e1=util['format'](_0xf914('0x9c'),_0x39790c,_0x2c5a5a);var _0x32775d=!![];if(_0x4f70c9[_0xf914('0x129')]===_0xf914('0x134')){_0x32775d=![];}var _0x100868=this['channel'][_0xf914('0x12a')](_0x39790c,_0x2c5a5a,_0x4f70c9[_0xf914('0x12b')],_0x4f70c9['timeout'],undefined,_0x32775d);if(_0x100868['result']!==-0x1){this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x135'),_0x44f3e1));var _0x100f09=this['tildeASR'][_0xf914('0xa5')](this,_0x4f70c9,_0x44f3e1);if(_0x100f09){for(var _0x4a083e in _0x100f09){if(_0x100f09['hasOwnProperty'](_0x4a083e)){this['channel'][_0xf914('0x9d')](util[_0xf914('0x2e')](_0xf914('0x136'),_0x4a083e['toUpperCase']()),_0x100f09[_0x4a083e]);}}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x137'),JSON[_0xf914('0x74')](_0x100f09)));}}return _0x100868;};AGIVertices[_0xf914('0x15')][_0xf914('0x138')]=function(_0x1a9f32){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1a9f32['label']));return this[_0xf914('0x12')][_0xf914('0x139')](_0x1a9f32[_0xf914('0x40')],_0x1a9f32[_0xf914('0x41')],_0x1a9f32[_0xf914('0x13a')]);};AGIVertices[_0xf914('0x15')][_0xf914('0x13b')]=function(_0x783b38){logger['info'](util[_0xf914('0x2e')](_0xf914('0x13c'),_0x783b38['label']));if(!this[_0xf914('0x82')](_0x783b38[_0xf914('0x13d')])){return this[_0xf914('0x12')]['error'](_0x783b38,_0xf914('0x13e'));}try{var _0x270c29=eval(_0x783b38[_0xf914('0x13d')])?_0xf914('0x13f'):'false';this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x140'),_0x783b38[_0xf914('0x13d')],_0x270c29));return{'code':0xc8,'result':_0x270c29};}catch(_0x5670f8){return{'code':0xc8,'result':_0xf914('0x141')};}};AGIVertices[_0xf914('0x15')][_0xf914('0x142')]=function(_0x1e8563){logger[_0xf914('0x32')](util[_0xf914('0x2e')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1e8563[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x1e8563['interval_id'])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x1e8563,'no\x20interval\x20configured');}var _0x131e95=this[_0xf914('0x143')][_0xf914('0xa5')](this,_0x1e8563['interval_id']);if(!_0x131e95){return this[_0xf914('0x12')][_0xf914('0x31')](_0x1e8563,_0xf914('0x144'));}for(var _0x1fe931=0x0;_0x1fe931<_0x131e95['length'];_0x1fe931+=0x1){var _0x5125d4=this[_0xf914('0x12')][_0xf914('0x16')](util[_0xf914('0x2e')](_0xf914('0x145'),_0x131e95[_0x1fe931]));if(_0x5125d4[_0xf914('0xa2')]===-0x1){return _0x5125d4;}logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x146'),_0x131e95[_0x1fe931],_0x5125d4[_0xf914('0xa0')]));if(_0x5125d4[_0xf914('0xa0')]===_0xf914('0x13f')){logger[_0xf914('0x32')](util['format']('IFTIME\x20%s\x20%s',_0x131e95[_0x1fe931],'true'));this[_0xf914('0x12')][_0xf914('0xaa')](util['format'](_0xf914('0x146'),_0x131e95[_0x1fe931],_0xf914('0x13f')));return{'code':0xc8,'result':_0xf914('0x13f')};}else{logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x146'),_0x131e95[_0x1fe931],_0xf914('0x141')));this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')]('IFTIME\x20%s\x20%s',_0x131e95[_0x1fe931],_0xf914('0x141')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype']['hangup']=function(_0x2f2df9){logger[_0xf914('0x32')](util['format'](_0xf914('0x147'),_0x2f2df9[_0xf914('0x3c')]));return this[_0xf914('0x12')][_0xf914('0x148')]();};AGIVertices[_0xf914('0x15')][_0xf914('0x149')]=function(_0x4a36d6){logger[_0xf914('0x32')](util['format'](_0xf914('0x14a'),_0x4a36d6[_0xf914('0x3c')]));if(!this['isConfigured'](_0x4a36d6[_0xf914('0x7a')])){return this[_0xf914('0x12')]['noop']('no\x20key\x20configured');}var _0x3fed59=_0xf914('0x127');var _0x3785a5=util[_0xf914('0x2e')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x180c68=util[_0xf914('0x2e')](_0xf914('0x9c'),_0x3785a5,_0x3fed59);var _0x2f53be=!![];if(_0x4a36d6[_0xf914('0x129')]===_0xf914('0x134')){_0x2f53be=![];}var _0x331442=this[_0xf914('0x12')][_0xf914('0x12a')](_0x3785a5,_0x3fed59,_0x4a36d6[_0xf914('0x12b')],_0x4a36d6[_0xf914('0x6b')],undefined,_0x2f53be);if(_0x331442[_0xf914('0xa2')]!==-0x1){this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x14b'),_0x180c68));var _0x32b2b4=this['ispeechASR']['sync'](this,_0x4a36d6,_0x180c68);if(_0x32b2b4){for(var _0x2861cf in _0x32b2b4){if(_0x32b2b4[_0xf914('0x96')](_0x2861cf)){this[_0xf914('0x12')][_0xf914('0x9d')](util[_0xf914('0x2e')](_0xf914('0x14c'),_0x2861cf['toUpperCase']()),_0x32b2b4[_0x2861cf]);}}return this[_0xf914('0x12')]['noop'](util['format'](_0xf914('0x14d'),JSON['stringify'](_0x32b2b4)));}}return _0x331442;};AGIVertices[_0xf914('0x15')][_0xf914('0x14e')]=function(_0x30bb07){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x30bb07[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x30bb07[_0xf914('0x7a')])){return this['channel']['noop'](_0xf914('0xe4'));}if(!this[_0xf914('0x82')](_0x30bb07['text'])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0xa9'));}this[_0xf914('0x12')][_0xf914('0xaa')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x30bb07[_0xf914('0x5f')]));var _0x255165=this['ispeechTTS'][_0xf914('0xa5')](this,_0x30bb07);if(_0x255165){this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x14b'),_0x255165));var _0x254bb5=this['channel']['streamFile'](_0x255165,_0x30bb07['intKey']);try{fs[_0xf914('0xf8')](_0x255165+_0xf914('0xf9'));}catch(_0x2bd930){logger[_0xf914('0x31')](_0x2bd930);}return _0x254bb5;}return this[_0xf914('0x12')][_0xf914('0x31')](_0x30bb07,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xf914('0x15')][_0xf914('0x14f')]=function(_0x44beb3){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x150'),_0x44beb3[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x44beb3[_0xf914('0x151')])){return this['channel'][_0xf914('0x31')](_0x44beb3,_0xf914('0x152'));}logger['info'](util[_0xf914('0x2e')](_0xf914('0x153'),this[_0xf914('0x12')][_0xf914('0x55')],_0x44beb3[_0xf914('0x151')]));var _0x289fbf=this['agentLogin'][_0xf914('0xa5')](this,_0x44beb3[_0xf914('0x151')]);if(_0x289fbf){logger[_0xf914('0x32')](util['format'](_0xf914('0x154'),this[_0xf914('0x12')][_0xf914('0x55')],_0x44beb3['findBy']));this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x154'),this['channel'][_0xf914('0x55')],_0x44beb3[_0xf914('0x151')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0xf914('0x155'),this[_0xf914('0x12')][_0xf914('0x55')],_0x44beb3[_0xf914('0x151')]));this['channel']['noop'](util[_0xf914('0x2e')](_0xf914('0x155'),this[_0xf914('0x12')][_0xf914('0x55')],_0x44beb3[_0xf914('0x151')]));return{'code':0xc8,'result':_0xf914('0x156')};}};AGIVertices['prototype'][_0xf914('0x157')]=function(_0xabd705){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x158'),_0xabd705[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0xabd705['findBy'])){return this[_0xf914('0x12')][_0xf914('0x31')](_0xabd705,'no\x20find\x20by\x20configured');}logger['info'](util[_0xf914('0x2e')](_0xf914('0x153'),this[_0xf914('0x12')][_0xf914('0x55')],_0xabd705[_0xf914('0x151')]));var _0x5d02e8=this[_0xf914('0x58')]['sync'](this,_0xabd705[_0xf914('0x151')]);if(_0x5d02e8){logger[_0xf914('0x32')](util['format'](_0xf914('0x154'),this[_0xf914('0x12')][_0xf914('0x55')],_0xabd705[_0xf914('0x151')]));this[_0xf914('0x12')]['noop'](util[_0xf914('0x2e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf914('0x12')][_0xf914('0x55')],_0xabd705[_0xf914('0x151')]));return{'code':0xc8,'result':_0xf914('0x159')};}else{logger[_0xf914('0x32')](util[_0xf914('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf914('0x55')],_0xabd705[_0xf914('0x151')]));this[_0xf914('0x12')][_0xf914('0xaa')](util['format'](_0xf914('0x155'),this[_0xf914('0x12')][_0xf914('0x55')],_0xabd705['findBy']));return{'code':0xc8,'result':_0xf914('0x156')};}};AGIVertices[_0xf914('0x15')]['math']=function(_0x56cce9){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x15a'),_0x56cce9['label']));if(!this['isConfigured'](_0x56cce9[_0xf914('0x15b')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x56cce9,'no\x20operation\x20configured');}this['channel'][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x15c'),_0x56cce9[_0xf914('0x15b')]));var _0x27a64b=eval(_0x56cce9[_0xf914('0x15b')]);if(!this[_0xf914('0x82')](_0x56cce9[_0xf914('0xd6')])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0xd7'));}var _0x601071=this[_0xf914('0x16')][_0xf914('0xa5')](this,_0x56cce9[_0xf914('0xd6')]);if(!_0x601071){return this[_0xf914('0x12')][_0xf914('0x31')](_0x56cce9,_0xf914('0xd8'));}if(_[_0xf914('0x99')](_0x27a64b)){var _0x3a8b9a=this;_0x27a64b['forEach'](function(_0x306d01,_0x105b9e){_0x3a8b9a['channel']['setVariable'](util['format']('%s[%s]',_0x601071,_0x105b9e),_0x306d01);});return this[_0xf914('0x12')][_0xf914('0xaa')](util['format'](_0xf914('0x15d'),_0x601071));}else{return this[_0xf914('0x12')]['setVariable'](_0x601071,_0x27a64b);}};AGIVertices['prototype'][_0xf914('0xf')]=function(_0x132cfd){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x15e'),_0x132cfd[_0xf914('0x3c')]));if(_0x132cfd[_0xf914('0xa6')]===0x0){return this['maxRetry'](_0x132cfd);}_0x132cfd[_0xf914('0xa6')]-=0x1;if(!this['isConfigured'](_0x132cfd[_0xf914('0x108')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x132cfd,_0xf914('0x109'));}var _0x9512dd=this['getSound']['sync'](this,_0x132cfd[_0xf914('0x108')]);if(!_0x9512dd){return this[_0xf914('0x12')][_0xf914('0x31')](_0x132cfd,_0xf914('0x10a'));}var _0x142b4b=this[_0xf914('0x12')][_0xf914('0x10b')](_0x9512dd,_0x132cfd[_0xf914('0x10c')],_0x132cfd[_0xf914('0x15f')]);var _0x15983b=_0x142b4b[_0xf914('0xa2')];if(_0x142b4b[_0xf914('0xa2')]===-0x1){this[_0xf914('0x3a')][_0xf914('0xa5')](this,_0x132cfd,'-1');return _0x142b4b;}else if(_0x142b4b['extra']===_0xf914('0x6b')){_0x142b4b[_0xf914('0xa2')]=_0x142b4b['result'][_0xf914('0x9a')]>0x0?_0x142b4b['result']:'t';}else if(_['isEmpty'](_0x142b4b['result'])){_0x142b4b['result']='#';_0x15983b='#';}if(!this[_0xf914('0x82')](_0x132cfd[_0xf914('0xd6')])){this[_0xf914('0x12')][_0xf914('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2fc5ea=this[_0xf914('0x16')][_0xf914('0xa5')](this,_0x132cfd['variable_id']);if(!_0x2fc5ea){return this[_0xf914('0x12')][_0xf914('0x31')](_0x132cfd,_0xf914('0xd8'));}this[_0xf914('0x12')][_0xf914('0x9d')](_0x2fc5ea,_0x15983b);}this[_0xf914('0x3a')][_0xf914('0xa5')](this,_0x132cfd,_0x15983b);return _0x142b4b;};AGIVertices[_0xf914('0x15')]['noop']=function(_0x172ccd){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x160'),_0x172ccd['label']));return this[_0xf914('0x12')][_0xf914('0xaa')](_0x172ccd[_0xf914('0x161')]||_0x172ccd[_0xf914('0x3c')]);};AGIVertices[_0xf914('0x15')][_0xf914('0x162')]=function(_0x244acc){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x163'),_0x244acc['label']));if(!this[_0xf914('0x82')](_0x244acc[_0xf914('0x151')])){return this['channel'][_0xf914('0x31')](_0x244acc,_0xf914('0x152'));}logger['info'](util[_0xf914('0x2e')](_0xf914('0x153'),this[_0xf914('0x12')][_0xf914('0x55')],_0x244acc['findBy']));var _0x3903a5=this['getPause'][_0xf914('0xa5')](this,_0x244acc[_0xf914('0x164')]);var _0x519f6b=this[_0xf914('0x165')][_0xf914('0xa5')](this,_0x244acc[_0xf914('0x151')],_0x3903a5);if(_0x519f6b){logger['info'](util[_0xf914('0x2e')](_0xf914('0x154'),this['channel'][_0xf914('0x55')],_0x244acc[_0xf914('0x151')]));this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x154'),this[_0xf914('0x12')]['callerid'],_0x244acc['findBy']));return{'code':0xc8,'result':_0xf914('0x159')};}else{logger[_0xf914('0x32')](util[_0xf914('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf914('0x12')]['callerid'],_0x244acc[_0xf914('0x151')]));this['channel'][_0xf914('0xaa')](util['format'](_0xf914('0x154'),this['channel'][_0xf914('0x55')],_0x244acc['findBy']));return{'code':0xc8,'result':_0xf914('0x156')};}};AGIVertices['prototype'][_0xf914('0x166')]=function(_0x2279ba){logger['info'](util[_0xf914('0x2e')](_0xf914('0x167'),_0x2279ba[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x2279ba['file_id'])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x2279ba,_0xf914('0x109'));}var _0x47bb3d=this[_0xf914('0x22')][_0xf914('0xa5')](this,_0x2279ba[_0xf914('0x108')]);if(!_0x47bb3d){return this[_0xf914('0x12')][_0xf914('0x31')](_0x2279ba,_0xf914('0x10a'));}var _0x32d4e5=this[_0xf914('0x12')][_0xf914('0x5b')](_0xf914('0x168'),[_0x47bb3d,_0x2279ba['opts']]);if(_0x32d4e5['result']===-0x1){return _0x32d4e5;}return this[_0xf914('0x12')][_0xf914('0xaa')](util['format'](_0xf914('0x169'),_0xf914('0x168'),_0x47bb3d));};AGIVertices[_0xf914('0x15')][_0xf914('0x16a')]=function(_0x538971){logger[_0xf914('0x32')](util[_0xf914('0x2e')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x538971[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x538971[_0xf914('0x16b')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x538971,_0xf914('0x16c'));}var _0x4576a6='';var _0x38a287=parseInt(_0x538971['queue_id'],0xa);if(isNaN(_0x38a287)){_0x4576a6=_0x538971['queue_id'];}else{_0x4576a6=this[_0xf914('0x16d')]['sync'](this,_0x538971[_0xf914('0x16b')]);if(!_0x4576a6){return this[_0xf914('0x12')][_0xf914('0x31')](_0x538971,_0xf914('0x16e'));}}var _0x3a94ec='';if(this[_0xf914('0x82')](_0x538971['file_id'])){var _0x29ce43=this[_0xf914('0x22')]['sync'](this,_0x538971['file_id']);if(_0x29ce43){_0x3a94ec=_0x29ce43;}}this[_0xf914('0x3a')][_0xf914('0xa5')](this,_0x538971,_0x4576a6);if(_0x538971[_0xf914('0x16f')][_0xf914('0x170')]('x')<0x0){_0x538971[_0xf914('0x16f')]+='x';}if(_0x538971[_0xf914('0x16f')][_0xf914('0x170')]('X')<0x0){_0x538971[_0xf914('0x16f')]+='X';}this['channel'][_0xf914('0x9d')]('XMCS-QUEUE',_0x4576a6?_0x4576a6[_0xf914('0x171')]():'');var _0x14fdd3=this[_0xf914('0x12')][_0xf914('0x5b')](_0xf914('0x172'),[_0x4576a6,_0x538971['opts'],_0x538971['url'],_0x3a94ec,_0x538971['timeout'],_0x538971[_0xf914('0x9')],_0x538971[_0xf914('0x173')],_0x538971[_0xf914('0x174')],'',_0x538971[_0xf914('0x175')]]);if(_0x14fdd3[_0xf914('0xa2')]===-0x1){return _0x14fdd3;}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x169'),_0xf914('0x172'),_0x4576a6));};AGIVertices['prototype']['record']=function(_0x45274c){logger['info'](util[_0xf914('0x2e')](_0xf914('0x176'),_0x45274c[_0xf914('0x3c')]));var _0x1015b0=_0x45274c['recordingFormat']||_0xf914('0x127');var _0x3d30f5=util['format'](_0xf914('0x177'),this[_0xf914('0x12')]['uniqueid'],rs[_0xf914('0x110')](0x5));var _0x12a524=util['format'](_0xf914('0x178'),FILES_PATH,_0x3d30f5,_0x1015b0);var _0x3803e6=util[_0xf914('0x2e')](_0xf914('0x128'),FILES_PATH,_0x3d30f5);this[_0xf914('0x3e')][_0xf914('0xa5')](this,_0x45274c,_0x3d30f5,_0x12a524);this[_0xf914('0x12')][_0xf914('0x9d')]('RECORDING_SAVENAME',_0x3d30f5);logger[_0xf914('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x3803e6,_0x1015b0,_0x45274c[_0xf914('0x179')],_0x45274c['timeout']);return this[_0xf914('0x12')]['recordFile'](_0x3803e6,_0x1015b0,_0x45274c[_0xf914('0x179')],_0x45274c[_0xf914('0x6b')],undefined,!![]);};AGIVertices[_0xf914('0x15')][_0xf914('0x17a')]=function(_0x2e0522){logger['info'](util[_0xf914('0x2e')](_0xf914('0x17b'),_0x2e0522[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x2e0522[_0xf914('0x68')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x425235=this[_0xf914('0x67')]['sync'](this,_0x2e0522);logger[_0xf914('0x32')](util[_0xf914('0x2e')]('Response:',util['inspect'](_0x425235,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2e0522['variable_id'])){return this[_0xf914('0x12')][_0xf914('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2369bb=this['getVariable'][_0xf914('0xa5')](this,_0x2e0522[_0xf914('0xd6')]);if(!_0x2369bb){return this['channel'][_0xf914('0x31')](_0x2e0522,_0xf914('0xd8'));}this[_0xf914('0x12')]['setVariable'](util['format'](_0xf914('0x17c'),_0x2369bb),_0x425235[_0xf914('0x76')]?_0x425235[_0xf914('0x76')]:_0xf914('0x17d'));this[_0xf914('0x12')]['setVariable'](util[_0xf914('0x2e')](_0xf914('0x17e'),_0x2369bb),_0x425235[_0xf914('0x17f')]?_0x425235[_0xf914('0x17f')]:'OK');if(_0x425235['body']){try{this[_0xf914('0x9b')](_0x425235[_0xf914('0x6f')],_0x2369bb);}catch(_0x1eba8c){logger['error'](util[_0xf914('0x2e')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2369bb));}}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0xdd'),_0x2369bb));};AGIVertices[_0xf914('0x15')][_0xf914('0x180')]=function(_0x5da17b){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x181'),_0x5da17b['label']));return this['channel'][_0xf914('0x182')](_0x5da17b[_0xf914('0x183')][_0xf914('0xd4')](/\s+/g,''),_0x5da17b[_0xf914('0x179')]);};AGIVertices[_0xf914('0x15')]['saynumber']=function(_0x2be856){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x184'),_0x2be856[_0xf914('0x3c')]));return this[_0xf914('0x12')]['sayNumber'](_0x2be856[_0xf914('0x6a')]['replace'](/\s+/g,''),_0x2be856[_0xf914('0x179')]);};AGIVertices[_0xf914('0x15')]['sayphonetic']=function(_0x31c63d){logger['info'](util['format'](_0xf914('0x185'),_0x31c63d['label']));return this['channel'][_0xf914('0x186')](_0x31c63d['text'],_0x31c63d[_0xf914('0x179')]);};AGIVertices[_0xf914('0x15')]['sendMail']=function(_0xc73c2c){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x187'),_0xc73c2c[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0xc73c2c[_0xf914('0x188')])){return this[_0xf914('0x12')][_0xf914('0xaa')]('no\x20mail\x20account\x20configured');}var _0x471c82=this['getMailAccount']['sync'](this,_0xc73c2c['account_id']);if(!_0x471c82||!_0x471c82[_0xf914('0x189')]){return this[_0xf914('0x12')][_0xf914('0x31')](_0xc73c2c,_0xf914('0x18a'));}var _0x4b0ebc={'from':util[_0xf914('0x2e')](_0xf914('0x18b'),_0x471c82[_0xf914('0x19')],_0x471c82[_0xf914('0x18c')]||_0x471c82[_0xf914('0x189')][_0xf914('0x18d')]),'to':_0xc73c2c['to']||'','cc':_0xc73c2c['cc']||'','bcc':_0xc73c2c['bcc']||'','subject':_0xc73c2c[_0xf914('0x18e')],'html':_0xc73c2c[_0xf914('0x5f')],'text':_0xc73c2c[_0xf914('0x5f')]};var _0x487ca4={'tls':{'rejectUnauthorized':![]}};if(_0x471c82[_0xf914('0x189')][_0xf914('0x18f')]){_0x487ca4[_0xf914('0x18f')]=_0x471c82[_0xf914('0x189')][_0xf914('0x18f')];}else{_0x487ca4[_0xf914('0x190')]=_0x471c82['Smtp'][_0xf914('0x190')];_0x487ca4[_0xf914('0x191')]=_0x471c82['Smtp'][_0xf914('0x191')];_0x487ca4[_0xf914('0x192')]=_0x471c82[_0xf914('0x189')][_0xf914('0x192')];}if(_0x471c82[_0xf914('0x189')][_0xf914('0x193')]){_0x487ca4[_0xf914('0x194')]={'user':_0x471c82[_0xf914('0x189')]['user'],'pass':_0x471c82['Smtp'][_0xf914('0x195')]};}if(this['isConfigured'](_0xc73c2c[_0xf914('0x196')])){}logger[_0xf914('0x197')](_0xf914('0x198'),JSON['stringify'](_0x4b0ebc));this[_0xf914('0x3a')]['sync'](this,_0xc73c2c,_0xc73c2c['account_id']);this[_0xf914('0x12')]['noop'](util[_0xf914('0x2e')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x471c82[_0xf914('0x19')]));this[_0xf914('0x28')]['sync'](this,_0x487ca4,_0x4b0ebc);return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0x199'));};AGIVertices[_0xf914('0x15')][_0xf914('0x19a')]=function(_0x1b9026){logger['info'](util[_0xf914('0x2e')](_0xf914('0x19b'),_0x1b9026[_0xf914('0x3c')]));return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0x19c'));};AGIVertices[_0xf914('0x15')][_0xf914('0x19d')]=function(_0x142227){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x19e'),_0x142227[_0xf914('0x3c')]));if(!this['isConfigured'](_0x142227[_0xf914('0x19f')])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0x1a0'));}var _0xd22c77=this[_0xf914('0x38')][_0xf914('0xa5')](this,_0x142227[_0xf914('0x19f')]);if(!_0xd22c77){return this[_0xf914('0x12')][_0xf914('0x31')](_0x142227,'no\x20sms\x20account\x20found');}var _0x394251={'body':_0x142227[_0xf914('0x1a1')],'phone':_0x142227['to']||'','SmsAccountId':_0xd22c77['id']};logger[_0xf914('0x197')](_0xf914('0x1a2'),JSON[_0xf914('0x74')](_0x394251));this[_0xf914('0x3a')]['sync'](this,_0x142227,_0x142227[_0xf914('0x19f')]);this[_0xf914('0x12')]['noop'](util['format'](_0xf914('0x1a3'),_0xd22c77['name']));this[_0xf914('0x1a4')]['sync'](this,_0x394251);return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0x1a5'));};AGIVertices[_0xf914('0x15')][_0xf914('0x1a6')]=function(_0x532fc0){logger['info'](util[_0xf914('0x2e')](_0xf914('0x1a7'),_0x532fc0[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x532fc0[_0xf914('0xd6')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x532fc0,_0xf914('0x1a8'));}var _0x4d2343=this[_0xf914('0x16')]['sync'](this,_0x532fc0[_0xf914('0xd6')]);if(!_0x4d2343){return this[_0xf914('0x12')]['error'](_0x532fc0,_0xf914('0xd8'));}return this[_0xf914('0x12')][_0xf914('0x9d')](_0x4d2343,_0x532fc0[_0xf914('0x1a9')]);};AGIVertices[_0xf914('0x15')][_0xf914('0x1aa')]=function(_0x2cb72b){logger[_0xf914('0x32')](util['format'](_0xf914('0x1ab'),_0x2cb72b[_0xf914('0x3c')]));this[_0xf914('0x12')]['noop'](_0xf914('0x1ac'));if(_0x2cb72b[_0xf914('0xb7')]===_0xf914('0x1ad')){this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0x1ae'));return this['channel'][_0xf914('0xb7')]();}return this[_0xf914('0x12')]['noop']('Skipped\x20Answer');};AGIVertices[_0xf914('0x15')][_0xf914('0x1af')]=function(_0x154e3b){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x1b0'),_0x154e3b[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x154e3b[_0xf914('0x1b1')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x154e3b,'no\x20subproject\x20selected');}var _0xa9ce97=this[_0xf914('0x1b2')][_0xf914('0xa5')](this,_0x154e3b[_0xf914('0x1b1')]);if(!this[_0xf914('0x82')](_0xa9ce97)){return this[_0xf914('0x12')][_0xf914('0x31')](_0x154e3b,util[_0xf914('0x2e')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x154e3b[_0xf914('0x1b1')]));}if(_0xa9ce97===this[_0xf914('0x12')][_0xf914('0x44')]){return this[_0xf914('0x12')][_0xf914('0x31')](_0x154e3b,_0xf914('0x1b3'));}this[_0xf914('0x3a')][_0xf914('0xa5')](this,_0x154e3b,_0xa9ce97);var _0x40a8ae=this[_0xf914('0x12')][_0xf914('0x5b')](_0xf914('0x1b4'),util['format'](_0xf914('0x1b5'),config['agi'][_0xf914('0x190')]||_0xf914('0x1b6'),_0xa9ce97,this['channel'][_0xf914('0x44')]));if(_0x40a8ae[_0xf914('0xa2')]===-0x1){return _0x40a8ae;}return this['channel'][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x169'),_0xf914('0x1b4'),_0xa9ce97));};AGIVertices[_0xf914('0x15')][_0xf914('0x1b7')]=function(_0x35f695){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x1b8'),_0x35f695['label']));var _0x1d28e5=this[_0xf914('0x1b9')][_0xf914('0xa5')](this,_0x35f695[_0xf914('0xb5')]);this[_0xf914('0x3a')][_0xf914('0xa5')](this,_0x35f695,_0x35f695['command']);if(this[_0xf914('0x82')](_0x35f695[_0xf914('0xd6')])){var _0x547f3b=this[_0xf914('0x16')][_0xf914('0xa5')](this,_0x35f695['variable_id']);if(_0x547f3b){this[_0xf914('0x12')][_0xf914('0x9d')](_0x547f3b,_0x1d28e5);return this[_0xf914('0x12')]['noop'](util[_0xf914('0x2e')](_0xf914('0x1ba'),_0x35f695['command'],_0x547f3b));}}return this['channel']['noop'](util[_0xf914('0x2e')](_0xf914('0x1bb'),_0x35f695['command']));};AGIVertices[_0xf914('0x15')]['google_cloud_tts']=function(_0x4fb3e5){logger['info'](util[_0xf914('0x2e')](_0xf914('0x1bc'),_0x4fb3e5[_0xf914('0x3c')]));_0x4fb3e5[_0xf914('0x5f')]=_0x4fb3e5[_0xf914('0x5f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4fb3e5[_0xf914('0x1bd')])){return this[_0xf914('0x12')][_0xf914('0xaa')]('no\x20apiKey\x20configured');}if(!this[_0xf914('0x82')](_0x4fb3e5[_0xf914('0x5f')])){return this['channel'][_0xf914('0xaa')]('no\x20text\x20configured');}this['channel'][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x1be'),_0x4fb3e5[_0xf914('0x5f')]));var _0xce04e5=this['googleCloudTTS'][_0xf914('0xa5')](this,_0x4fb3e5);if(_0xce04e5){this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x1bf'),_0xce04e5));var _0x15a48d=this[_0xf914('0x12')]['streamFile'](_0xce04e5);try{fs[_0xf914('0xf8')](_0xce04e5+_0xf914('0xf9'));}catch(_0x91911){logger[_0xf914('0x31')](_0x91911);}return _0x15a48d;}return this[_0xf914('0x12')][_0xf914('0x31')](_0x4fb3e5,_0xf914('0x1c0'));};AGIVertices[_0xf914('0x15')][_0xf914('0x1c1')]=function(_0x1c2c1b){logger[_0xf914('0x32')](util['format'](_0xf914('0x1c2'),_0x1c2c1b['label']));_0x1c2c1b[_0xf914('0x5f')]=_0x1c2c1b[_0xf914('0x5f')][_0xf914('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf914('0x82')](_0x1c2c1b[_0xf914('0x5f')])){return this[_0xf914('0x12')][_0xf914('0xaa')](_0xf914('0xa9'));}this[_0xf914('0x12')][_0xf914('0xaa')](util['format'](_0xf914('0x1c3'),_0x1c2c1b[_0xf914('0x5f')]));var _0x152b70=this[_0xf914('0x65')][_0xf914('0xa5')](this,_0x1c2c1b);if(_0x152b70){this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')]('Google\x20TTS\x20%s\x20file\x20created',_0x152b70));var _0x4ea286=this[_0xf914('0x12')]['streamFile'](_0x152b70);try{fs[_0xf914('0xf8')](_0x152b70+_0xf914('0xf9'));}catch(_0x2a294d){logger[_0xf914('0x31')](_0x2a294d);}return _0x4ea286;}return this[_0xf914('0x12')][_0xf914('0x31')](_0x1c2c1b,_0xf914('0x1c4'));};AGIVertices[_0xf914('0x15')]['unpause']=function(_0x14b680){logger[_0xf914('0x32')](util['format'](_0xf914('0x1c5'),_0x14b680[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x14b680[_0xf914('0x151')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x14b680,_0xf914('0x152'));}logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x153'),this[_0xf914('0x12')][_0xf914('0x55')],_0x14b680['findBy']));var _0x2502d4=this[_0xf914('0x56')][_0xf914('0xa5')](this,_0x14b680[_0xf914('0x151')]);if(_0x2502d4){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x154'),this[_0xf914('0x12')][_0xf914('0x55')],_0x14b680['findBy']));this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf914('0x12')]['callerid'],_0x14b680['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xf914('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf914('0x55')],_0x14b680[_0xf914('0x151')]));this['channel'][_0xf914('0xaa')](util[_0xf914('0x2e')](_0xf914('0x155'),this[_0xf914('0x12')][_0xf914('0x55')],_0x14b680['findBy']));return{'code':0xc8,'result':_0xf914('0x156')};}};AGIVertices['prototype'][_0xf914('0x1c6')]=function(_0x1cca90){logger['info'](util[_0xf914('0x2e')](_0xf914('0x1c7'),_0x1cca90[_0xf914('0x3c')]));var _0x2cea63=this['channel']['exec'](_0xf914('0x1c8'),[_0x1cca90['mailbox'],_0x1cca90[_0xf914('0x78')]]);if(_0x2cea63[_0xf914('0xa2')]===-0x1){return _0x2cea63;}return this[_0xf914('0x12')][_0xf914('0xaa')](util[_0xf914('0x2e')]('Executed\x20command\x20%s\x20%s',_0xf914('0x1c8'),_0x1cca90[_0xf914('0x1c9')]));};AGIVertices[_0xf914('0x15')][_0xf914('0x1ca')]=function(_0x5ea24a){logger[_0xf914('0x32')](util[_0xf914('0x2e')](_0xf914('0x1cb'),_0x5ea24a[_0xf914('0x3c')]));if(!this[_0xf914('0x82')](_0x5ea24a[_0xf914('0xd6')])){return this[_0xf914('0x12')][_0xf914('0x31')](_0x5ea24a,_0xf914('0x1a8'));}var _0x1ebbe2=this[_0xf914('0x16')][_0xf914('0xa5')](this,_0x5ea24a[_0xf914('0xd6')]);if(!_0x1ebbe2){return this['channel'][_0xf914('0x31')](_0x5ea24a,'no\x20variable\x20found');}var _0x40dfda=this[_0xf914('0x12')]['getVariable'](_0x1ebbe2);return{'code':0xc8,'result':_0x40dfda[_0xf914('0xa0')]?_0x40dfda[_0xf914('0xa0')]:'-'};};String['prototype']['replaceAll']=function(_0x433912,_0x42af57){return this[_0xf914('0x9e')](_0x433912)[_0xf914('0x1cc')](_0x42af57);};module[_0xf914('0x1cd')]=AGIVertices; \ No newline at end of file +var _0x68cd=['application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','ndauth_url','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','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','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','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','getSound','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','authentication','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','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','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','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','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','./scripts','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariableById','then','catch','getVoiceQueue','name','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','calleridname','context','extension','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','toString','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','toUpperCase','rawBody','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','saveRestApiResult','isPlainObject','isArray','%s.%s','setVariable','replaceall\x20init','replaceAll','getVariable','extra','replaceall\x20end','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','logh','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block'];(function(_0x400da3,_0x55d4fa){var _0x1c7073=function(_0x3d2d90){while(--_0x3d2d90){_0x400da3['push'](_0x400da3['shift']());}};_0x1c7073(++_0x55d4fa);}(_0x68cd,0x10b));var _0xd68c=function(_0x25e625,_0x2a97e2){_0x25e625=_0x25e625-0x0;var _0x3312cb=_0x68cd[_0x25e625];return _0x3312cb;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0xd68c('0x0'));var sh=require(_0xd68c('0x1'));var odbc=require(_0xd68c('0x2'))();var rs=require(_0xd68c('0x3'));var moment=require('moment');var Mustache=require(_0xd68c('0x4'));var rp=require(_0xd68c('0x5'));var logger=require(_0xd68c('0x6'))(_0xd68c('0x7'));var config=require('../../config/environment');var scripts=require(_0xd68c('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xd68c('0x9'),'rawBody'];var verticesWithRetry=[_0xd68c('0xa'),_0xd68c('0xb'),_0xd68c('0xc')];var AGIVertices=function(_0x482ece,_0x321462,_0xe80596){this[_0xd68c('0xd')]=_0x482ece;this[_0xd68c('0xe')]=_0x321462;this['mailRpc']=_0xe80596;};AGIVertices[_0xd68c('0xf')]['getVariable']=function(_0x26f3c2,_0x256ff7){this[_0xd68c('0xe')][_0xd68c('0x10')](_0x26f3c2)[_0xd68c('0x11')](function(_0x3f643b){_0x256ff7(null,_0x3f643b?_0x3f643b['name']:![]);})[_0xd68c('0x12')](function(_0x3a840a){_0x256ff7(_0x3a840a);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x13')]=function(_0x103c9c,_0xfc953){this[_0xd68c('0xe')]['getVoiceQueueById'](_0x103c9c)[_0xd68c('0x11')](function(_0x458c35){_0xfc953(null,_0x458c35?_0x458c35[_0xd68c('0x14')]:![]);})[_0xd68c('0x12')](function(_0x500e39){_0xfc953(_0x500e39);});};AGIVertices['prototype'][_0xd68c('0x15')]=function(_0x2b4584,_0x4a5453){this['rpc'][_0xd68c('0x16')](_0x2b4584)['then'](function(_0xef7216){_0x4a5453(null,_0xef7216?_0xef7216[_0xd68c('0x14')]:![]);})[_0xd68c('0x12')](function(_0x67c630){_0x4a5453(_0x67c630);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x17')]=function(_0x425bd4,_0x421d13){this['rpc']['getSquareOdbcById'](_0x425bd4)[_0xd68c('0x11')](function(_0x54a133){_0x421d13(null,_0x54a133?_0x54a133[_0xd68c('0x18')]:![]);})['catch'](function(_0x44c947){_0x421d13(_0x44c947);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x19')]=function(_0x56df1b,_0x130add){this[_0xd68c('0xe')][_0xd68c('0x1a')](_0x56df1b)[_0xd68c('0x11')](function(_0xaa4698){_0x130add(null,_0xaa4698?_0xaa4698['name']:![]);})[_0xd68c('0x12')](function(_0x22615f){_0x130add(_0x22615f);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x1b')]=function(_0x4aa6d6,_0x1341bf){this[_0xd68c('0xe')][_0xd68c('0x1c')](_0x4aa6d6)[_0xd68c('0x11')](function(_0x3cdf91){_0x1341bf(null,_0x3cdf91?_0x3cdf91[_0xd68c('0x14')]:![]);})['catch'](function(_0xb6ea39){_0x1341bf(_0xb6ea39);});};AGIVertices['prototype']['getSound']=function(_0x43546c,_0x13bc6b){var _0x3538f5=this;this[_0xd68c('0xe')]['getSoundById'](_0x43546c)[_0xd68c('0x11')](function(_0x266d11){_0x13bc6b(null,_0x266d11?_0x3538f5[_0xd68c('0x1d')](_0x266d11[_0xd68c('0x1e')]):![]);})[_0xd68c('0x12')](function(_0x58da4a){_0x13bc6b(_0x58da4a);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x1f')]=function(_0x23b9e8,_0x4fa5af){this[_0xd68c('0xe')]['getMailAccountById'](_0x23b9e8)[_0xd68c('0x11')](function(_0x526da0){_0x4fa5af(null,_0x526da0?_0x526da0:![]);})['catch'](function(_0x332d4f){_0x4fa5af(_0x332d4f);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x20')]=function(_0x4e7c2e,_0x38dd44,_0x5dc150){this[_0xd68c('0x21')][_0xd68c('0x20')](_0x4e7c2e,_0x38dd44)['then'](function(){_0x5dc150(null);})[_0xd68c('0x12')](function(_0x2efec6){_0x5dc150(_0x2efec6);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x22')]=function(_0x2f7430,_0x532cf6){this[_0xd68c('0xe')][_0xd68c('0x23')](_0x2f7430)['then'](function(_0x5c75f2){if(_0x5c75f2){if(_0x5c75f2[_0xd68c('0x24')]){_0x532cf6(null,[_0x5c75f2[_0xd68c('0x25')]]);}else{_0x532cf6(null,_['map'](_0x5c75f2['Intervals'],'interval'));}}else{_0x532cf6(null,![]);}})[_0xd68c('0x12')](function(_0xda5443){_0x532cf6(_0xda5443);});};AGIVertices['prototype']['getSoundPath']=function(_0x4b6895){return util[_0xd68c('0x26')](_0xd68c('0x27'),FILES_PATH,_0x4b6895);};AGIVertices['prototype'][_0xd68c('0x28')]=function(_0x3eb71b,_0x5ca275,_0x3c0bdd){odbc[_0xd68c('0x29')](_0x3eb71b,function(_0x2d8858){if(_0x2d8858){logger[_0xd68c('0x2a')](_0xd68c('0x2b'),_0x2d8858);_0x3c0bdd(_0x2d8858);}else{logger[_0xd68c('0x2c')](_0xd68c('0x2d'));odbc[_0xd68c('0x2e')](_0x5ca275,function(_0x11643e,_0x2d3428){if(_0x11643e){logger[_0xd68c('0x2c')]('Error\x20executing\x20query\x20%s',_0x5ca275);_0x3c0bdd(_0x11643e);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x5ca275);odbc[_0xd68c('0x2f')](function(_0x28cfb1){if(_0x28cfb1){logger['error'](_0xd68c('0x30'),_0x28cfb1);}_0x3c0bdd(null,_0x2d3428);});}});}});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x31')]=function(_0x5c15af,_0x1e031a){this[_0xd68c('0xe')][_0xd68c('0x32')](_0x5c15af)[_0xd68c('0x11')](function(_0x1000f0){_0x1e031a(null,_0x1000f0?_0x1000f0:![]);})[_0xd68c('0x12')](function(_0x4d2f5d){_0x1e031a(_0x4d2f5d);});};AGIVertices['prototype'][_0xd68c('0x33')]=function(_0xc31c94,_0x1c8367){this[_0xd68c('0xe')][_0xd68c('0x33')](_0xc31c94)[_0xd68c('0x11')](function(_0x5eeaee){_0x1c8367(null,_0x5eeaee);})[_0xd68c('0x12')](function(_0xa31560){_0x1c8367(_0xa31560);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x3f1f04,_0x286c2,_0x2b0c07){this[_0xd68c('0xe')][_0xd68c('0x34')]({'uniqueid':this[_0xd68c('0xd')][_0xd68c('0x35')],'node':_0x3f1f04[_0xd68c('0x36')],'application':_0x3f1f04[_0xd68c('0x37')],'data':_0x286c2||null,'project_name':this[_0xd68c('0xd')]['arg_1'],'callerid':this[_0xd68c('0xd')][_0xd68c('0x38')]})[_0xd68c('0x11')](function(_0x35464a){if(_0x2b0c07){_0x2b0c07(null,_0x35464a);}})[_0xd68c('0x12')](function(_0x1feaf6){if(_0x2b0c07){_0x2b0c07(_0x1feaf6);}});};AGIVertices[_0xd68c('0xf')]['createSquareRecording']=function(_0x581eb4,_0x1c5399,_0x3b00a3,_0x1d9bb9){this[_0xd68c('0xe')]['createSquareRecording']({'uniqueid':this[_0xd68c('0xd')][_0xd68c('0x35')],'callerid':this[_0xd68c('0xd')][_0xd68c('0x38')],'calleridname':this['channel'][_0xd68c('0x39')],'context':this[_0xd68c('0xd')][_0xd68c('0x3a')],'extension':this[_0xd68c('0xd')][_0xd68c('0x3b')],'priority':this['channel'][_0xd68c('0x3c')],'accountcode':this[_0xd68c('0xd')][_0xd68c('0x3d')],'dnid':this[_0xd68c('0xd')][_0xd68c('0x3e')],'projectName':this[_0xd68c('0xd')][_0xd68c('0x3f')],'saveName':_0x1c5399,'filename':_0x581eb4['file']||_0x1c5399,'savePath':_0x3b00a3})['then'](function(_0x5db4f9){_0x1d9bb9(null,_0x5db4f9);})['catch'](function(_0x5f1964){_0x1d9bb9(_0x5f1964);});};AGIVertices['prototype'][_0xd68c('0x40')]=function(_0x34b6c1,_0x3354ab,_0x25cdb6){this['rpc'][_0xd68c('0x40')]({'uniqueid':this[_0xd68c('0xd')][_0xd68c('0x35')],'body':_0x34b6c1,'direction':_0x3354ab})['then'](function(_0x326cec){if(_0x25cdb6){_0x25cdb6(null,_0x326cec);}})['catch'](function(_0x14d7f4){if(_0x25cdb6){_0x25cdb6(_0x14d7f4);}});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x41')]=function(_0x9bf0ab,_0x25b5be){console[_0xd68c('0x42')](_0xd68c('0x43'),_0x9bf0ab);console['log'](_0xd68c('0x44'),_0x25b5be);this[_0xd68c('0xe')][_0xd68c('0x41')]({'firstName':_[_0xd68c('0x45')](_0x9bf0ab['name'])||_[_0xd68c('0x46')](_0x9bf0ab['name'])?_0xd68c('0x47')+Math[_0xd68c('0x48')]():_0x9bf0ab[_0xd68c('0x14')],'lastName':_[_0xd68c('0x45')](_0x9bf0ab[_0xd68c('0x49')])||_[_0xd68c('0x46')](_0x9bf0ab['lastName'])?null:_0x9bf0ab[_0xd68c('0x49')],'phone':_0x9bf0ab['phone'],'ListId':_0x9bf0ab[_0xd68c('0x4a')],'scheduledat':_0x9bf0ab[_0xd68c('0x4b')],'callbackUniqueid':this[_0xd68c('0xd')]['uniqueid'],'tags':_0xd68c('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x9bf0ab[_0xd68c('0x4b')][_0xd68c('0x4d')](),'priority':_0x9bf0ab['callback_priority']})[_0xd68c('0x11')](function(_0x5ec485){_0x25b5be(null,_0x5ec485);})[_0xd68c('0x12')](function(_0x1191a8){_0x25b5be(_0x1191a8);});};AGIVertices['prototype'][_0xd68c('0x4e')]=function(_0xbcc6e3,_0x5a9f07){this['rpc'][_0xd68c('0x4f')](_0xbcc6e3)[_0xd68c('0x11')](function(_0x5e1826){_0x5a9f07(null,_0x5e1826?_0x5e1826[_0xd68c('0x14')]:![]);})[_0xd68c('0x12')](function(_0x3a512f){_0x5a9f07(_0x3a512f);});};AGIVertices[_0xd68c('0xf')]['agentPause']=function(_0x5c3a77,_0x32ad61,_0x44f521){var _0x55fe2a={'role':_0xd68c('0x50')};_0x55fe2a[_0x5c3a77]=this[_0xd68c('0xd')][_0xd68c('0x38')];this[_0xd68c('0xe')][_0xd68c('0x51')](_0x55fe2a,_0x32ad61,this['channel'][_0xd68c('0x35')])['then'](function(_0x29133e){_0x44f521(null,_[_0xd68c('0x46')](_0x29133e)?![]:!![]);})[_0xd68c('0x12')](function(_0x58dc0f){logger['error'](_0x58dc0f);_0x44f521(null,![]);});};AGIVertices['prototype'][_0xd68c('0x52')]=function(_0x4c5f2a,_0x4639d0){var _0x4c1eb9={'role':'agent'};_0x4c1eb9[_0x4c5f2a]=this['channel'][_0xd68c('0x38')];this['rpc'][_0xd68c('0x52')](_0x4c1eb9)['then'](function(_0x560bc5){_0x4639d0(null,_[_0xd68c('0x46')](_0x560bc5)?![]:!![]);})[_0xd68c('0x12')](function(_0xa11fad){logger['error'](_0xa11fad);_0x4639d0(null,![]);});};AGIVertices[_0xd68c('0xf')]['agentLogout']=function(_0x341df1,_0x5cb1a7){var _0x3e8531={'role':_0xd68c('0x50')};_0x3e8531[_0x341df1]=this[_0xd68c('0xd')][_0xd68c('0x38')];this[_0xd68c('0xe')][_0xd68c('0x53')](_0x3e8531)[_0xd68c('0x11')](function(_0x1c35ee){_0x5cb1a7(null,_[_0xd68c('0x46')](_0x1c35ee)?![]:!![]);})[_0xd68c('0x12')](function(_0x533d81){logger['error'](_0x533d81);_0x5cb1a7(null,![]);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x54')]=function(_0x561c19,_0x37d27e){var _0x5218c2={'role':_0xd68c('0x50')};_0x5218c2[_0x561c19]=this['channel'][_0xd68c('0x38')];var _0x3d4d8b=_0x561c19!=_0xd68c('0x55')?util[_0xd68c('0x26')]('%s/%s@from-sip/n',_0xd68c('0x56'),this[_0xd68c('0xd')]['callerid']):undefined;this[_0xd68c('0xe')][_0xd68c('0x54')](_0x5218c2,_0x3d4d8b)[_0xd68c('0x11')](function(_0x3364d2){_0x37d27e(null,_[_0xd68c('0x46')](_0x3364d2)?![]:!![]);})[_0xd68c('0x12')](function(_0x13fbe7){logger[_0xd68c('0x2a')](_0x13fbe7);_0x37d27e(null,![]);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x57')]=function(_0x427b2d,_0x36f053){sh[_0xd68c('0x58')](_['trim'](_0x427b2d),function(_0x4efce2,_0x5dee38){var _0x5e1700=_0x5dee38[_0xd68c('0x59')](/(\r\n|\n|\r)/gm,'');_0x36f053(null,_0x5e1700);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x5a')]=function(_0x501dc5,_0x1c02af){scripts['googleCloudTTS'](_0x501dc5['apiKey'],_0x501dc5[_0xd68c('0x5b')]||'text',_0x501dc5[_0xd68c('0x5c')],_0x501dc5[_0xd68c('0x5d')]||_0xd68c('0x5e'),_0x501dc5[_0xd68c('0x5f')]||_0xd68c('0x60'),_0x501dc5[_0xd68c('0x61')]||_0xd68c('0x62'))[_0xd68c('0x11')](function(_0x173b73){_0x1c02af(null,_0x173b73);})[_0xd68c('0x12')](function(_0x29b4b6){_0x1c02af(_0x29b4b6);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x63')]=function(_0xd1e084,_0x3a7b8c){scripts[_0xd68c('0x63')](_0xd1e084[_0xd68c('0x5c')],_0xd1e084[_0xd68c('0x64')]||'en',0x1)[_0xd68c('0x11')](function(_0x2d7f20){_0x3a7b8c(null,_0x2d7f20);})[_0xd68c('0x12')](function(_0x4c7a1b){_0x3a7b8c(_0x4c7a1b);});};AGIVertices[_0xd68c('0xf')]['restAPI']=function(_0x2f109f,_0x1b5bf4){var _0x275867={'uri':_0x2f109f[_0xd68c('0x65')],'method':_0x2f109f[_0xd68c('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2f109f[_0xd68c('0x67')])===_0xd68c('0x68')&&parseInt(_0x2f109f[_0xd68c('0x67')])>=0x1?parseInt(_0x2f109f[_0xd68c('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xd68c('0x69')]([_0xd68c('0x6a'),_0xd68c('0x6b')],_0x275867[_0xd68c('0x66')][_0xd68c('0x6c')]())){try{_0x275867['body']=_0x2f109f[_0xd68c('0x6d')]?JSON[_0xd68c('0x6e')](_0x2f109f[_0xd68c('0x6d')]):{};}catch(_0x1e59a2){logger[_0xd68c('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1e59a2);}}try{_0x275867[_0xd68c('0x6f')]=_0x2f109f[_0xd68c('0x9')]?JSON[_0xd68c('0x6e')](_0x2f109f[_0xd68c('0x9')]):{};}catch(_0x385458){logger['error'](_0xd68c('0x70'),_0x385458);}if(_0x2f109f[_0xd68c('0x71')]){try{var _0x407e5a=require(_0x2f109f[_0xd68c('0x71')])['sync'](this,_0x275867);_0x275867[_0xd68c('0x72')]=Mustache[_0xd68c('0x73')](_0x2f109f[_0xd68c('0x65')],_0x407e5a,{},['$$','$$']);if(_0x275867[_0xd68c('0x6f')]){_0x275867['headers']=JSON[_0xd68c('0x6e')](Mustache[_0xd68c('0x73')](JSON[_0xd68c('0x74')](_0x275867[_0xd68c('0x6f')]),_0x407e5a,{},['$$','$$']));}if(_0x275867['body']){_0x275867[_0xd68c('0x75')]=JSON[_0xd68c('0x6e')](Mustache[_0xd68c('0x73')](JSON[_0xd68c('0x74')](_0x275867[_0xd68c('0x75')]),_0x407e5a,{},['$$','$$']));}}catch(_0x4c0e45){logger[_0xd68c('0x2a')](_0xd68c('0x76'),_0x4c0e45);}}rp(_0x275867)['then'](function(_0x225477){var _0xe17f7d={'statusCode':_0x225477['statusCode']||0xc8,'statusMessage':_0x225477[_0xd68c('0x77')]||'OK','headers':_0x225477[_0xd68c('0x6f')]||{},'body':_0x225477[_0xd68c('0x75')]||{}};_0x1b5bf4(null,_0xe17f7d);})['catch'](function(_0x462f26){var _0x2edcb5={'statusCode':_0x462f26[_0xd68c('0x78')]||0x1f4,'statusMessage':_0x462f26['message']||_0xd68c('0x79'),'headers':_0x462f26['options'][_0xd68c('0x6f')]||{},'body':_0x462f26[_0xd68c('0x7a')][_0xd68c('0x75')]||{}};_0x1b5bf4(null,_0x2edcb5);});};AGIVertices[_0xd68c('0xf')]['googleDialogflow']=function(_0x3afc16,_0x152841){scripts[_0xd68c('0x7b')](this[_0xd68c('0xd')][_0xd68c('0x35')],_0x3afc16['key'],_0x3afc16[_0xd68c('0x5c')],_0x3afc16[_0xd68c('0x7c')]||'en')['then'](function(_0x42a569){_0x152841(null,_0x42a569);})[_0xd68c('0x12')](function(_0x4d06b5){_0x152841(_0x4d06b5);});};AGIVertices['prototype'][_0xd68c('0x7d')]=function(_0x38c168,_0x3ce79e){scripts['sestekNDA'](this['channel'],_0x38c168)[_0xd68c('0x11')](function(_0x3c413b){_0x3ce79e(null,_0x3c413b);})['catch'](function(_0x5180e5){_0x3ce79e(_0x5180e5);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x7e')]=function(_0x226d1a,_0x9c0212){scripts[_0xd68c('0x7e')](_0x226d1a[_0xd68c('0x7f')],_0x226d1a[_0xd68c('0x5c')],_0x226d1a['ispeech_tts_language']||_0xd68c('0x5e'),_0x226d1a[_0xd68c('0x80')])['then'](function(_0x53ffcf){_0x9c0212(null,_0x53ffcf);})['catch'](function(_0x44d278){_0x9c0212(_0x44d278);});};AGIVertices[_0xd68c('0xf')]['ispeechASR']=function(_0x1213ed,_0x2788d7,_0x27166b){scripts[_0xd68c('0x81')](_0x2788d7,_0x1213ed['key'],_0x1213ed['ispeech_asr_language']||'en-US',this['isConfigured'](_0x1213ed[_0xd68c('0x82')])?_0x1213ed[_0xd68c('0x82')]:undefined)[_0xd68c('0x11')](function(_0x306be4){_0x27166b(null,_0x306be4);})[_0xd68c('0x12')](function(_0x232b75){_0x27166b(_0x232b75);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x83')]=function(_0x45930c,_0x55ba8e){scripts[_0xd68c('0x83')](_0x45930c[_0xd68c('0x84')],_0x45930c[_0xd68c('0x85')],_0x45930c[_0xd68c('0x86')],_0x45930c[_0xd68c('0x87')]||_0xd68c('0x88'),_0x45930c[_0xd68c('0x5c')],_0x45930c['aws_text_type']||'text')[_0xd68c('0x11')](function(_0x5cbedf){_0x55ba8e(null,_0x5cbedf);})[_0xd68c('0x12')](function(_0x5f25a5){_0x55ba8e(_0x5f25a5);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x89')]=function(_0x476bc1,_0x3bd5c3){scripts[_0xd68c('0x89')](this[_0xd68c('0xd')]['uniqueid'],_0x476bc1['aws_access_key_id'],_0x476bc1[_0xd68c('0x85')],_0x476bc1['aws_lex_region'],_0x476bc1[_0xd68c('0x5c')],_0x476bc1[_0xd68c('0x8a')])[_0xd68c('0x11')](function(_0x1b274d){_0x3bd5c3(null,_0x1b274d);})[_0xd68c('0x12')](function(_0x1e1aff){_0x3bd5c3(_0x1e1aff);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x8b')]=function(_0x4c4401,_0x1dafce,_0x3f6be4){scripts[_0xd68c('0x8b')](_0x1dafce,_0x4c4401[_0xd68c('0x7f')],_0x4c4401[_0xd68c('0x8c')]||'en-US')[_0xd68c('0x11')](function(_0xa9e6f7){_0x3f6be4(null,_0xa9e6f7);})[_0xd68c('0x12')](function(_0x397030){_0x3f6be4(_0x397030);});};AGIVertices['prototype'][_0xd68c('0x8d')]=function(_0x13e626,_0x18d883,_0x33fa59){scripts[_0xd68c('0x8d')](_0x18d883,_0x13e626[_0xd68c('0x8e')],_0x13e626[_0xd68c('0x8f')],_0x13e626[_0xd68c('0x72')])[_0xd68c('0x11')](function(_0x5c744e){_0x33fa59(null,_0x5c744e);})[_0xd68c('0x12')](function(_0x3c729d){_0x33fa59(_0x3c729d);});};AGIVertices[_0xd68c('0xf')][_0xd68c('0x90')]=function(_0x3955eb){var _0x26e807=_[_0xd68c('0x69')](verticesWithRetry,_0x3955eb[_0xd68c('0x37')])?_0x3955eb:_[_0xd68c('0x91')](_0x3955eb);for(var _0x30bf4b in _0x26e807){if(_0x26e807[_0xd68c('0x92')](_0x30bf4b)){if(_0x26e807[_0x30bf4b]&&_[_0xd68c('0x93')](_0x26e807[_0x30bf4b])){if(_[_0xd68c('0x69')](recursiveMapAttributes,_0x30bf4b)){_0x26e807[_0x30bf4b]=this[_0xd68c('0x94')](_0x26e807[_0x30bf4b]);}else{_0x26e807[_0x30bf4b]=this[_0xd68c('0x95')](_0x26e807[_0x30bf4b]);}}}}return _0x26e807;};AGIVertices[_0xd68c('0xf')][_0xd68c('0x96')]=function(_0x4381cb){for(var _0x5d1f00 in _0x4381cb){if(_0x4381cb[_0xd68c('0x92')](_0x5d1f00)){if(_['isPlainObject'](_0x4381cb[_0x5d1f00])){this['recursiveNodeIndex'](_0x4381cb[_0x5d1f00]);}else if(_['isArray'](_0x4381cb[_0x5d1f00])){for(var _0x4de8b7=0x0;_0x4de8b7<_0x4381cb[_0x5d1f00][_0xd68c('0x97')];_0x4de8b7++){this['recursiveNodeIndex'](_0x4381cb[_0x5d1f00][_0x4de8b7]);}}else if(_['isString'](_0x4381cb[_0x5d1f00])){_0x4381cb[_0x5d1f00]=this[_0xd68c('0x95')](_0x4381cb[_0x5d1f00]);}}}};AGIVertices[_0xd68c('0xf')][_0xd68c('0x98')]=function(_0x2b57e1,_0x3f1c8b){for(var _0xf93abe in _0x2b57e1){if(_0x2b57e1[_0xd68c('0x92')](_0xf93abe)){if(_[_0xd68c('0x99')](_0x2b57e1[_0xf93abe])){if(!_[_0xd68c('0x45')](_0x2b57e1[_0xf93abe])){this['saveRestApiResult'](_0x2b57e1[_0xf93abe],util[_0xd68c('0x26')]('%s.%s',_0x3f1c8b,_0xf93abe));}}else if(_[_0xd68c('0x9a')](_0x2b57e1[_0xf93abe])){for(var _0x22cadd=0x0;_0x22cadd<_0x2b57e1[_0xf93abe][_0xd68c('0x97')];_0x22cadd++){this[_0xd68c('0x98')](_0x2b57e1[_0xf93abe][_0x22cadd],util[_0xd68c('0x26')](_0xd68c('0x9b'),_0x3f1c8b,_0xf93abe+'['+_0x22cadd+']'));}}else{if(!_[_0xd68c('0x46')](_0x2b57e1[_0xf93abe])){this[_0xd68c('0xd')][_0xd68c('0x9c')](util[_0xd68c('0x26')](_0xd68c('0x9b'),_0x3f1c8b,_0xf93abe),_0x2b57e1[_0xf93abe]);}}}}};AGIVertices['prototype'][_0xd68c('0x94')]=function(_0x5257c1){try{var _0x5a3075=JSON['parse'](_0x5257c1);this[_0xd68c('0x96')](_0x5a3075);return JSON[_0xd68c('0x74')](_0x5a3075);}catch(_0x57e97e){return this[_0xd68c('0x95')](_0x5257c1);}};AGIVertices[_0xd68c('0xf')][_0xd68c('0x95')]=function(_0x248d50){console['log'](_0xd68c('0x9d'),_0x248d50);var _0x4f5ee0=_0x248d50['split']('{');for(var _0x515674=0x1;_0x515674<_0x4f5ee0[_0xd68c('0x97')];_0x515674+=0x1){var _0x1c6624=_0x4f5ee0[_0x515674]['split']('}');if(_0x1c6624['length']>0x1){_0x248d50=_0x248d50[_0xd68c('0x9e')]('{'+_0x1c6624[0x0]+'}',this[_0xd68c('0xd')][_0xd68c('0x9f')](_0x1c6624[0x0])[_0xd68c('0xa0')]||_0x1c6624[0x0]);}}if(_0x4f5ee0[_0xd68c('0x97')]===0x1){return _0x248d50[_0xd68c('0x4d')]();}console[_0xd68c('0x42')](_0xd68c('0xa1'),_0x248d50);return this[_0xd68c('0x95')](_0x248d50);};AGIVertices['prototype']['getAndSetVariable']=function(_0x411f20,_0xb8389b){var _0x20fedd=this[_0xd68c('0xd')]['getVariable'](_0x411f20);if(_0x20fedd['result']===-0x1){return _0x20fedd;}logger['info'](util[_0xd68c('0x26')](_0xd68c('0xa2'),_0xb8389b,_0x20fedd[_0xd68c('0xa0')]));return this['channel'][_0xd68c('0x9c')](_0xb8389b,_0x20fedd[_0xd68c('0xa0')]);};AGIVertices['prototype'][_0xd68c('0xa3')]=function(_0x5d9117){return _0x5d9117&&_0x5d9117!=='0'&&_0x5d9117!=='-1'&&_0x5d9117!=='';};AGIVertices[_0xd68c('0xf')][_0xd68c('0xa4')]=function(_0x2813d2){this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x2813d2,'-');_0x2813d2['retry']=_0x2813d2[_0xd68c('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd68c('0xf')][_0xd68c('0xa6')]=function(_0x2ca2a9){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0xa7'),_0x2ca2a9[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x2ca2a9[_0xd68c('0x5c')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xa9'));}var _0x1b5b59='\x22'+_0x2ca2a9[_0xd68c('0x5c')]+'\x22';if(this[_0xd68c('0xa3')](_0x2ca2a9[_0xd68c('0x7a')])){_0x1b5b59+=','+_0x2ca2a9['options'];}var _0x4e2164=this[_0xd68c('0xd')]['exec'](_0xd68c('0xaa'),_0x1b5b59);if(_0x4e2164[_0xd68c('0xab')]===-0x1){return _0x4e2164;}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util['format'](_0xd68c('0xac'),_0x1b5b59));};AGIVertices[_0xd68c('0xf')]['mrcprecog']=function(_0x31c802){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0xad'),_0x31c802[_0xd68c('0x36')]));if(!this['isConfigured'](_0x31c802[_0xd68c('0xae')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xaf'));}var _0x45272b=_0x31c802[_0xd68c('0xae')];if(this[_0xd68c('0xa3')](_0x31c802[_0xd68c('0x7a')])){_0x45272b+=','+_0x31c802[_0xd68c('0x7a')];}var _0x587949=this[_0xd68c('0xd')][_0xd68c('0x58')](_0xd68c('0xb0'),_0x45272b);if(_0x587949[_0xd68c('0xab')]===-0x1){return _0x587949;}var _0x59d986=this[_0xd68c('0xb1')](_0xd68c('0xb2'),_0xd68c('0xb3'));if(_0x59d986[_0xd68c('0xab')]===-0x1){return _0x59d986;}var _0x147667=this['getAndSetVariable'](_0xd68c('0xb4'),_0xd68c('0xb5'));if(_0x147667['result']===-0x1){return _0x147667;}var _0x4da594=this['getAndSetVariable']('RECOG_INSTANCE()',_0xd68c('0xb6'));if(_0x4da594['result']===-0x1){return _0x4da594;}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xb7'),_0x45272b));};AGIVertices['prototype'][_0xd68c('0x7')]=function(_0x33941a){logger['info'](util[_0xd68c('0x26')](_0xd68c('0xb8'),_0x33941a['label']));return this['channel']['agi']([_0x33941a['command'],_0x33941a['args']]);};AGIVertices['prototype'][_0xd68c('0xb9')]=function(_0x2b56e0){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0xba'),_0x2b56e0['label']));if(this[_0xd68c('0xa3')](_0x2b56e0[_0xd68c('0x67')])){logger[_0xd68c('0x2c')](util['format'](_0xd68c('0xbb'),_0x2b56e0[_0xd68c('0x67')]));var _0x51e6d8=this[_0xd68c('0xd')]['wait'](_0x2b56e0[_0xd68c('0x67')]);if(_0x51e6d8[_0xd68c('0xab')]===-0x1){return _0x51e6d8;}}return this['channel']['answer']();};AGIVertices['prototype']['callback']=function(_0x402110){console[_0xd68c('0xbc')](_0xd68c('0xbd'),_0x402110);logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0xbe'),_0x402110[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x402110['list_id'])){return this[_0xd68c('0xd')]['error'](_0x402110,_0xd68c('0xbf'));}_0x402110[_0xd68c('0x4b')]=moment();if(this[_0xd68c('0xa3')](_0x402110[_0xd68c('0xc0')])){_0x402110[_0xd68c('0x4b')]=moment()['add'](_0x402110[_0xd68c('0xc0')],'minutes');}if(!this[_0xd68c('0xa3')](_0x402110[_0xd68c('0xc1')])){_0x402110[_0xd68c('0xc1')]=0x2;}console['log']('before\x20createcmcontact',_0x402110);this[_0xd68c('0x41')]['sync'](this,_0x402110);return this['channel'][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xc2'),_0x402110[_0xd68c('0xc3')],_0x402110[_0xd68c('0x4a')],_0x402110['scheduledAt']));};AGIVertices[_0xd68c('0xf')][_0xd68c('0xc4')]=function(_0xcf980c){logger['info'](util[_0xd68c('0x26')](_0xd68c('0xc5'),_0xcf980c[_0xd68c('0x36')]));var _0xd6002a=this[_0xd68c('0xd')][_0xd68c('0x58')](_0xcf980c[_0xd68c('0xc6')],_0xcf980c['options']);if(_0xd6002a[_0xd68c('0xab')]===-0x1){return _0xd6002a;}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xc7'),_0xcf980c[_0xd68c('0xc6')],_0xcf980c[_0xd68c('0x7a')]));};AGIVertices[_0xd68c('0xf')][_0xd68c('0xc8')]=function(_0x16fc7f){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x16fc7f[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x16fc7f[_0xd68c('0x5c')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')]('no\x20text\x20configured');}var _0x59a187='\x22'+_0x16fc7f[_0xd68c('0x5c')]+'\x22';if(this[_0xd68c('0xa3')](_0x16fc7f[_0xd68c('0x7a')])){_0x59a187+=','+_0x16fc7f[_0xd68c('0x7a')];}var _0x5224aa=this[_0xd68c('0xd')][_0xd68c('0x58')]('MRCPSynth',_0x59a187);if(_0x5224aa[_0xd68c('0xab')]===-0x1){return _0x5224aa;}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util['format'](_0xd68c('0xac'),_0x59a187));};AGIVertices[_0xd68c('0xf')][_0xd68c('0xc9')]=function(_0x462029){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0xca'),_0x462029['label']));if(!this['isConfigured'](_0x462029['text'])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xa9'));}var _0x1ad619='\x22'+_0x462029[_0xd68c('0x5c')]+'\x22';if(this['isConfigured'](_0x462029[_0xd68c('0x7a')])){_0x1ad619+=','+_0x462029['options'];}var _0x254b48=this['channel'][_0xd68c('0x58')](_0xd68c('0xaa'),_0x1ad619);if(_0x254b48[_0xd68c('0xab')]===-0x1){return _0x254b48;}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xac'),_0x1ad619));};AGIVertices[_0xd68c('0xf')][_0xd68c('0xcb')]=function(_0x48008f){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x48008f[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x48008f[_0xd68c('0xae')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xaf'));}var _0x3435fb=_0x48008f[_0xd68c('0xae')];if(this[_0xd68c('0xa3')](_0x48008f[_0xd68c('0x7a')])){_0x3435fb+=','+_0x48008f[_0xd68c('0x7a')];}var _0x5a3bd9=this[_0xd68c('0xd')][_0xd68c('0x58')]('MRCPRecog',_0x3435fb);if(_0x5a3bd9['result']===-0x1){return _0x5a3bd9;}var _0x396d61=this[_0xd68c('0xb1')]('RECOG_CONFIDENCE()',_0xd68c('0xcc'));if(_0x396d61[_0xd68c('0xab')]===-0x1){return _0x396d61;}var _0x1bd14e=this['getAndSetVariable'](_0xd68c('0xb4'),_0xd68c('0xcd'));if(_0x1bd14e[_0xd68c('0xab')]===-0x1){return _0x1bd14e;}var _0x34aed3=this['getAndSetVariable'](_0xd68c('0xce'),_0xd68c('0xcf'));if(_0x34aed3[_0xd68c('0xab')]===-0x1){return _0x34aed3;}return this['channel']['noop'](util[_0xd68c('0x26')](_0xd68c('0xb7'),_0x3435fb));};AGIVertices[_0xd68c('0xf')]['sestekasr']=function(_0x5e7119){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0xd0'),_0x5e7119[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x5e7119[_0xd68c('0xae')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xaf'));}var _0x40c3ad=_0x5e7119[_0xd68c('0xae')];if(this['isConfigured'](_0x5e7119[_0xd68c('0x7a')])){_0x40c3ad+=','+_0x5e7119[_0xd68c('0x7a')];}var _0x31a863=this[_0xd68c('0xd')][_0xd68c('0x58')](_0xd68c('0xb0'),_0x40c3ad);if(_0x31a863[_0xd68c('0xab')]===-0x1){return _0x31a863;}var _0x26519a=this[_0xd68c('0xb1')](_0xd68c('0xb2'),_0xd68c('0xd1'));if(_0x26519a[_0xd68c('0xab')]===-0x1){return _0x26519a;}var _0x46e8df=this[_0xd68c('0xb1')](_0xd68c('0xb4'),_0xd68c('0xd2'));if(_0x46e8df['result']===-0x1){return _0x46e8df;}var _0x525cc7=this[_0xd68c('0xb1')](_0xd68c('0xce'),'SESTEK_ASR_INSTANCE');if(_0x525cc7[_0xd68c('0xab')]===-0x1){return _0x525cc7;}return this['channel'][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xb7'),_0x40c3ad));};AGIVertices[_0xd68c('0xf')][_0xd68c('0xd3')]=function(_0x4bb3cb){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0xd4'),_0x4bb3cb[_0xd68c('0x36')]));if(!this['isConfigured'](_0x4bb3cb['odbc_id'])){return this[_0xd68c('0xd')]['error'](_0x4bb3cb,'no\x20database\x20selected');}var _0x59cba9=this['getSquareOdbc']['sync'](this,_0x4bb3cb[_0xd68c('0xd5')]);if(!_0x59cba9){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x4bb3cb,_0xd68c('0xd6'));}if(!this[_0xd68c('0xa3')](_0x4bb3cb[_0xd68c('0x2e')])){return this['channel'][_0xd68c('0x2a')](_0x4bb3cb,'no\x20query\x20configured');}var _0x51c3a8=_0x4bb3cb[_0xd68c('0x2e')][_0xd68c('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xd7'),_0x51c3a8));var _0x40794f=this[_0xd68c('0x28')]['sync'](this,_0x59cba9,_0x51c3a8);this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x4bb3cb,_0x51c3a8);if(!this[_0xd68c('0xa3')](_0x4bb3cb[_0xd68c('0xd8')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x420383=this[_0xd68c('0x9f')][_0xd68c('0xa5')](this,_0x4bb3cb[_0xd68c('0xd8')]);if(!_0x420383){return this['channel'][_0xd68c('0x2a')](_0x4bb3cb,'no\x20variable\x20found');}var _0x4eba4a=this;_0x40794f[_0xd68c('0xd9')](function(_0x149b3a,_0x9cd787){Object[_0xd68c('0xda')](_0x149b3a)['forEach'](function(_0x1e3d03){_0x4eba4a[_0xd68c('0xd')][_0xd68c('0x9c')](util[_0xd68c('0x26')](_0xd68c('0xdb'),_0x420383,_0x9cd787,_0x1e3d03),_0x149b3a[_0x1e3d03]);});});this[_0xd68c('0xd')]['setVariable'](util[_0xd68c('0x26')](_0xd68c('0xdc'),_0x420383),_0x40794f[_0xd68c('0x97')]);return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')]('variable\x20%s\x20set',_0x420383));};AGIVertices[_0xd68c('0xf')]['dial']=function(_0x17793d){logger[_0xd68c('0xdd')](util[_0xd68c('0x26')](_0xd68c('0xde'),_0x17793d[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x17793d['sip_id'])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x17793d,_0xd68c('0xdf'));}var _0x456185=this[_0xd68c('0x19')][_0xd68c('0xa5')](this,_0x17793d[_0xd68c('0xe0')]);if(!_0x456185){return this['channel'][_0xd68c('0x2a')](_0x17793d,_0xd68c('0xe1'));}var _0x26bbd9=this[_0xd68c('0xd')]['exec'](_0xd68c('0xe2'),[util[_0xd68c('0x26')](_0xd68c('0xe3'),_0x456185),_0x17793d[_0xd68c('0x67')],_0x17793d['opts'],_0x17793d[_0xd68c('0x65')]]);if(_0x26bbd9[_0xd68c('0xab')]===-0x1){return _0x26bbd9;}return this['channel']['noop'](util[_0xd68c('0x26')]('Executed\x20command\x20%s',_0xd68c('0xe2')));};AGIVertices[_0xd68c('0xf')][_0xd68c('0xe4')]=function(_0x41ed5d){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x41ed5d['label']));if(!this['isConfigured'](_0x41ed5d[_0xd68c('0x7f')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xe5'));}if(!this[_0xd68c('0xa3')](_0x41ed5d[_0xd68c('0x5c')])){return this[_0xd68c('0xd')]['noop']('no\x20text\x20configured');}this[_0xd68c('0xd')][_0xd68c('0xe6')]=!![];this['createSquareDetailsReport'](_0x41ed5d);this['createSquareMessage'](_0x41ed5d[_0xd68c('0x5c')],'in');this[_0xd68c('0xd')]['noop'](util[_0xd68c('0x26')]('Trying\x20Dialogflow:\x20%s',_0x41ed5d[_0xd68c('0x5c')]));var _0x27fccd=this[_0xd68c('0x7b')][_0xd68c('0xa5')](this,_0x41ed5d);if(_0x27fccd){for(var _0x4b951e in _0x27fccd){if(_0x27fccd[_0xd68c('0x92')](_0x4b951e)){this[_0xd68c('0xd')][_0xd68c('0x9c')](util[_0xd68c('0x26')](_0xd68c('0xe7'),_0x4b951e[_0xd68c('0x6c')]()),_0x27fccd[_0x4b951e]);}}this[_0xd68c('0x40')](_0x27fccd[_0xd68c('0xe8')],_0xd68c('0xe9'));return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xea'),_0x27fccd[_0xd68c('0xe8')]));}return this[_0xd68c('0xd')]['error'](_0x41ed5d,_0xd68c('0xeb'));};AGIVertices[_0xd68c('0xf')]['sesteknda']=function(_0x255ee7){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x255ee7[_0xd68c('0x36')]));if(!this['isConfigured'](_0x255ee7[_0xd68c('0xec')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xed'));}if(!this[_0xd68c('0xa3')](_0x255ee7[_0xd68c('0xee')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xef'));}if(!this['isConfigured'](_0x255ee7[_0xd68c('0xf0')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')]('no\x20password\x20configured');}if(!this[_0xd68c('0xa3')](_0x255ee7[_0xd68c('0xf1')])){return this[_0xd68c('0xd')]['noop']('no\x20text\x20configured');}this[_0xd68c('0xd')][_0xd68c('0xe6')]=!![];this['createSquareDetailsReport'](_0x255ee7);this[_0xd68c('0x40')](_0x255ee7['text'],'in');this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xf2'),_0x255ee7[_0xd68c('0x5c')]));var _0x50bd43=this['sestekNDA'][_0xd68c('0xa5')](this,_0x255ee7);if(_0x50bd43){for(var _0x21ffc3 in _0x50bd43){if(_0x50bd43['hasOwnProperty'](_0x21ffc3)){this['channel'][_0xd68c('0x9c')](util[_0xd68c('0x26')](_0xd68c('0xf3'),_0x21ffc3[_0xd68c('0x6c')]()),_0x50bd43[_0x21ffc3]);}}this['createSquareMessage'](_0x50bd43[_0xd68c('0xe8')],'out');if(_0x50bd43[_0xd68c('0xf4')]){this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xf5'),_0x50bd43['audiofile']));var _0x36f426=this[_0xd68c('0xd')][_0xd68c('0xf6')](_0x50bd43['audiofile']);try{fs[_0xd68c('0xf7')](_0x50bd43[_0xd68c('0xf4')]+_0xd68c('0xf8'));}catch(_0x416f57){logger['error'](_0x416f57);}return _0x36f426;}else{return this[_0xd68c('0xd')][_0xd68c('0xa8')](util['format'](_0xd68c('0xf9'),_0x50bd43[_0xd68c('0xe8')]));}}return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x255ee7,_0xd68c('0xfa'));};AGIVertices[_0xd68c('0xf')][_0xd68c('0xfb')]=function(_0xf8d0d7){logger[_0xd68c('0x2c')](util['format'](_0xd68c('0xfc'),_0xf8d0d7['label']));return this['channel'][_0xd68c('0xa8')](_0xd68c('0xfb'));};AGIVertices[_0xd68c('0xf')][_0xd68c('0xfd')]=function(_0x3eedbe){logger['info'](util[_0xd68c('0x26')](_0xd68c('0xfe'),_0x3eedbe['label']));var _0x397587='';if(_0x3eedbe['trunk_id']){if(!this[_0xd68c('0xa3')](_0x3eedbe[_0xd68c('0xff')])){return this['channel'][_0xd68c('0x2a')](_0x3eedbe,'no\x20trunk\x20selected');}else{var _0x5c7bd2=parseInt(_0x3eedbe['trunk_id'],0xa);if(isNaN(_0x5c7bd2)){_0x397587=_0x3eedbe[_0xd68c('0xff')];}else{_0x397587=this[_0xd68c('0x1b')]['sync'](this,_0x3eedbe[_0xd68c('0xff')]);if(!_0x397587){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x3eedbe,_0xd68c('0x100'));}}}}else if(_0x3eedbe[_0xd68c('0x101')]){_0x397587=_0x3eedbe['trunk_name'];}else{return this['channel'][_0xd68c('0x2a')](_0x3eedbe,_0xd68c('0x102'));}var _0x237884=this[_0xd68c('0xd')][_0xd68c('0x58')](_0xd68c('0xe2'),[util[_0xd68c('0x26')](_0xd68c('0x103'),_0x397587,_0x3eedbe[_0xd68c('0xc3')]),_0x3eedbe[_0xd68c('0x67')],_0x3eedbe[_0xd68c('0x104')],_0x3eedbe[_0xd68c('0x65')]]);if(_0x237884[_0xd68c('0xab')]===-0x1){return _0x237884;}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x105'),_0xd68c('0xe2')));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x106')]=function(_0x2cb94f){logger['info'](util[_0xd68c('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2cb94f[_0xd68c('0x36')]));return this[_0xd68c('0xd')][_0xd68c('0xa8')]('finally');};AGIVertices[_0xd68c('0xf')]['getdigits']=function(_0x5a9e8d){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x107'),_0x5a9e8d['label']));if(_0x5a9e8d[_0xd68c('0x108')]===0x0){return this['maxRetry'](_0x5a9e8d);}_0x5a9e8d[_0xd68c('0x108')]-=0x1;if(!this[_0xd68c('0xa3')](_0x5a9e8d[_0xd68c('0x109')])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x5a9e8d,_0xd68c('0x10a'));}var _0x636b89=this['getSound']['sync'](this,_0x5a9e8d[_0xd68c('0x109')]);if(!_0x636b89){return this[_0xd68c('0xd')]['error'](_0x5a9e8d,'no\x20file\x20audio\x20found');}if(!this[_0xd68c('0xa3')](_0x5a9e8d[_0xd68c('0xd8')])){return this[_0xd68c('0xd')]['error'](_0xd68c('0x10b'));}var _0x5c0fb0=this[_0xd68c('0xd')][_0xd68c('0x10c')](_0x636b89,_0x5a9e8d[_0xd68c('0x10d')],_0x5a9e8d[_0xd68c('0x10e')]);var _0x3d46ca=_0x5c0fb0['result']?_0x5c0fb0['result']['toString']():'';logger[_0xd68c('0x2c')](_0xd68c('0x10f'),JSON[_0xd68c('0x74')](_0x5c0fb0));if(_0x5c0fb0[_0xd68c('0xab')]===-0x1){this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x5a9e8d,_0x3d46ca);return _0x5c0fb0;}else if(_0x5c0fb0['extra']===_0xd68c('0x67')){_0x5c0fb0['result']=_0x3d46ca['length']>=parseInt(_0x5a9e8d[_0xd68c('0x110')])?'x':'i';}else{_0x5c0fb0[_0xd68c('0xab')]=_0x3d46ca[_0xd68c('0x97')]>=parseInt(_0x5a9e8d[_0xd68c('0x110')])&&_0x3d46ca[_0xd68c('0x97')]<=parseInt(_0x5a9e8d[_0xd68c('0x10e')])?'x':'i';}var _0x453b3=this[_0xd68c('0x9f')][_0xd68c('0xa5')](this,_0x5a9e8d['variable_id']);if(!_0x453b3){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x5a9e8d,'no\x20variable\x20found');}this[_0xd68c('0xd')][_0xd68c('0x9c')](_0x453b3,_0x3d46ca);if(this['isConfigured'](_0x5a9e8d[_0xd68c('0x111')])){var _0x215393=parseInt(_0x5a9e8d[_0xd68c('0x111')],0xa);var _0x2325f5=rs['generate']({'charset':'*','length':_0x215393});var _0x531e3b=_0x3d46ca[_0xd68c('0x97')];if(_0x531e3b>0x0){if(_0x531e3b>_0x215393){this['createSquareDetailsReport']['sync'](this,_0x5a9e8d,_0x5a9e8d[_0xd68c('0x112')]===_0xd68c('0x113')?_0x2325f5+_0x3d46ca['substr'](_0x215393):_0x3d46ca[_0xd68c('0x114')](0x0,_0x531e3b-_0x215393)+_0x2325f5);}else{this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x5a9e8d,rs[_0xd68c('0x115')]({'charset':'*','length':_0x531e3b}));}}else{this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x5a9e8d,'');}}else{this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x5a9e8d,_0x3d46ca);}return _0x5c0fb0;};AGIVertices[_0xd68c('0xf')][_0xd68c('0xc')]=function(_0x4faead){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x116'),_0x4faead[_0xd68c('0x36')]));return this[_0xd68c('0xb')](_0x4faead);};AGIVertices[_0xd68c('0xf')][_0xd68c('0x117')]=function(_0x11075d){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x118'),_0x11075d['label']));this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x11075d,_0x11075d[_0xd68c('0x119')]);return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x11a'),_0x11075d[_0xd68c('0x119')]));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x11b')]=function(_0x585437){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x11c'),_0x585437['label']));if(!this[_0xd68c('0xa3')](_0x585437[_0xd68c('0x84')])||!this[_0xd68c('0xa3')](_0x585437[_0xd68c('0x85')])){return this[_0xd68c('0xd')]['noop'](_0xd68c('0x11d'));}if(!this[_0xd68c('0xa3')](_0x585437['text'])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xa9'));}this[_0xd68c('0xd')][_0xd68c('0xa8')](util['format'](_0xd68c('0x11e'),_0x585437[_0xd68c('0x5c')]));var _0xb7e8e6=this[_0xd68c('0x83')][_0xd68c('0xa5')](this,_0x585437);if(_0xb7e8e6){this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x11f'),_0xb7e8e6));var _0x2cf456=this[_0xd68c('0xd')][_0xd68c('0xf6')](_0xb7e8e6);try{fs[_0xd68c('0xf7')](_0xb7e8e6+_0xd68c('0xf8'));}catch(_0x141aef){logger['error'](_0x141aef);}return _0x2cf456;}return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x585437,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xd68c('0xf')]['awslex']=function(_0x120a62){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x120a62[_0xd68c('0x36')]));if(!this['isConfigured'](_0x120a62['aws_access_key_id'])||!this[_0xd68c('0xa3')](_0x120a62['aws_secret_access_key'])){return this['channel']['noop'](_0xd68c('0x11d'));}if(!this[_0xd68c('0xa3')](_0x120a62[_0xd68c('0x8a')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x120'));}if(!this[_0xd68c('0xa3')](_0x120a62[_0xd68c('0x5c')])){return this['channel'][_0xd68c('0xa8')](_0xd68c('0xa9'));}this[_0xd68c('0xd')][_0xd68c('0xe6')]=!![];this[_0xd68c('0x34')](_0x120a62);this['createSquareMessage'](_0x120a62['text'],'in');this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x121'),_0x120a62[_0xd68c('0x5c')]));var _0x599de2=this[_0xd68c('0x89')]['sync'](this,_0x120a62);if(_0x599de2){for(var _0x16d265 in _0x599de2){if(_0x599de2['hasOwnProperty'](_0x16d265)&&_[_0xd68c('0x93')](_0x599de2[_0x16d265])){this[_0xd68c('0xd')][_0xd68c('0x9c')](util[_0xd68c('0x26')](_0xd68c('0x122'),_0x16d265[_0xd68c('0x6c')]()),_0x599de2[_0x16d265]);}}if(_[_0xd68c('0x46')](_0x599de2[_0xd68c('0x123')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x124'));}else{this['createSquareMessage'](_0x599de2[_0xd68c('0x123')],_0xd68c('0xe9'));return this[_0xd68c('0xd')][_0xd68c('0xa8')](util['format'](_0xd68c('0x125'),_0x599de2[_0xd68c('0x123')]));}}return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x120a62,_0xd68c('0x126'));};AGIVertices['prototype'][_0xd68c('0x127')]=function(_0xb7b358){logger['info'](util[_0xd68c('0x26')](_0xd68c('0x128'),_0xb7b358[_0xd68c('0x36')],_0xb7b358[_0xd68c('0x67')]));if(!this[_0xd68c('0xa3')](_0xb7b358[_0xd68c('0x7f')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xe5'));}var _0x129a06=_0xd68c('0x129');var _0x32c93a=util[_0xd68c('0x26')](_0xd68c('0x12a'),FILES_PATH,rs[_0xd68c('0x115')](0x4));var _0x3055f9=util[_0xd68c('0x26')](_0xd68c('0x9b'),_0x32c93a,_0x129a06);var _0x6e0a26=!![];if(_0xb7b358[_0xd68c('0x12b')]==='NOBEEP'){_0x6e0a26=![];}var _0x1e8034=this[_0xd68c('0xd')][_0xd68c('0x12c')](_0x32c93a,_0x129a06,_0xb7b358[_0xd68c('0x12d')],_0xb7b358[_0xd68c('0x67')],undefined,_0x6e0a26);if(_0x1e8034['result']!==-0x1){this[_0xd68c('0xd')]['noop'](util[_0xd68c('0x26')](_0xd68c('0x12e'),_0x3055f9));var _0x5572cd=this['googleASR']['sync'](this,_0xb7b358,_0x3055f9);if(_0x5572cd){for(var _0x545592 in _0x5572cd){if(_0x5572cd[_0xd68c('0x92')](_0x545592)){this['channel'][_0xd68c('0x9c')](util[_0xd68c('0x26')](_0xd68c('0x12f'),_0x545592[_0xd68c('0x6c')]()),_0x5572cd[_0x545592]);}}return this['channel']['noop'](util[_0xd68c('0x26')](_0xd68c('0x130'),JSON[_0xd68c('0x74')](_0x5572cd)));}}return _0x1e8034;};AGIVertices[_0xd68c('0xf')][_0xd68c('0x131')]=function(_0x5263d5){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x132'),_0x5263d5['label']));if(!this[_0xd68c('0xa3')](_0x5263d5[_0xd68c('0x8e')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x133'));}if(!this['isConfigured'](_0x5263d5['appsecret'])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x134'));}var _0x4f2821=_0xd68c('0x129');var _0x80c603=util[_0xd68c('0x26')](_0xd68c('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x25c39e=util[_0xd68c('0x26')](_0xd68c('0x9b'),_0x80c603,_0x4f2821);var _0x3b433f=!![];if(_0x5263d5[_0xd68c('0x12b')]===_0xd68c('0x135')){_0x3b433f=![];}var _0x4167b9=this[_0xd68c('0xd')][_0xd68c('0x12c')](_0x80c603,_0x4f2821,_0x5263d5[_0xd68c('0x12d')],_0x5263d5['timeout'],undefined,_0x3b433f);if(_0x4167b9[_0xd68c('0xab')]!==-0x1){this['channel'][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x136'),_0x25c39e));var _0x616289=this[_0xd68c('0x8d')]['sync'](this,_0x5263d5,_0x25c39e);if(_0x616289){for(var _0x2556dd in _0x616289){if(_0x616289[_0xd68c('0x92')](_0x2556dd)){this[_0xd68c('0xd')]['setVariable'](util['format'](_0xd68c('0x137'),_0x2556dd['toUpperCase']()),_0x616289[_0x2556dd]);}}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x138'),JSON[_0xd68c('0x74')](_0x616289)));}}return _0x4167b9;};AGIVertices[_0xd68c('0xf')]['gotoc']=function(_0x842770){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x139'),_0x842770[_0xd68c('0x36')]));return this[_0xd68c('0xd')][_0xd68c('0x13a')](_0x842770[_0xd68c('0x3a')],_0x842770['extension'],_0x842770['priority']);};AGIVertices[_0xd68c('0xf')][_0xd68c('0x13b')]=function(_0x25406f){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x13c'),_0x25406f[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x25406f[_0xd68c('0x13d')])){return this[_0xd68c('0xd')]['error'](_0x25406f,'no\x20condition\x20configured');}try{var _0x187fbc=eval(_0x25406f[_0xd68c('0x13d')])?_0xd68c('0x13e'):_0xd68c('0x13f');this[_0xd68c('0xd')]['noop'](util[_0xd68c('0x26')](_0xd68c('0x140'),_0x25406f[_0xd68c('0x13d')],_0x187fbc));return{'code':0xc8,'result':_0x187fbc};}catch(_0xa8c34d){return{'code':0xc8,'result':_0xd68c('0x13f')};}};AGIVertices[_0xd68c('0xf')]['gotoiftime']=function(_0x3a27c7){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x141'),_0x3a27c7[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x3a27c7['interval_id'])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x3a27c7,'no\x20interval\x20configured');}var _0x2f5b75=this[_0xd68c('0x22')]['sync'](this,_0x3a27c7['interval_id']);if(!_0x2f5b75){return this['channel']['error'](_0x3a27c7,_0xd68c('0x142'));}for(var _0x5ee57f=0x0;_0x5ee57f<_0x2f5b75['length'];_0x5ee57f+=0x1){var _0x1f536f=this[_0xd68c('0xd')]['getVariable'](util[_0xd68c('0x26')](_0xd68c('0x143'),_0x2f5b75[_0x5ee57f]));if(_0x1f536f[_0xd68c('0xab')]===-0x1){return _0x1f536f;}logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x144'),_0x2f5b75[_0x5ee57f],_0x1f536f['extra']));if(_0x1f536f[_0xd68c('0xa0')]===_0xd68c('0x13e')){logger[_0xd68c('0x2c')](util['format'](_0xd68c('0x144'),_0x2f5b75[_0x5ee57f],_0xd68c('0x13e')));this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')]('IFTIME\x20%s\x20%s',_0x2f5b75[_0x5ee57f],_0xd68c('0x13e')));return{'code':0xc8,'result':_0xd68c('0x13e')};}else{logger[_0xd68c('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x2f5b75[_0x5ee57f],_0xd68c('0x13f')));this['channel'][_0xd68c('0xa8')](util['format'](_0xd68c('0x144'),_0x2f5b75[_0x5ee57f],'false'));}}return{'code':0xc8,'result':_0xd68c('0x13f')};};AGIVertices[_0xd68c('0xf')]['hangup']=function(_0x2b8605){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x145'),_0x2b8605['label']));return this[_0xd68c('0xd')]['hangup']();};AGIVertices[_0xd68c('0xf')]['ispeechasr']=function(_0x414634){logger['info'](util[_0xd68c('0x26')](_0xd68c('0x146'),_0x414634[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x414634['key'])){return this[_0xd68c('0xd')][_0xd68c('0xa8')]('no\x20key\x20configured');}var _0x9d9fb0=_0xd68c('0x129');var _0x55a88f=util[_0xd68c('0x26')](_0xd68c('0x12a'),FILES_PATH,rs[_0xd68c('0x115')](0x4));var _0x5343d0=util['format'](_0xd68c('0x9b'),_0x55a88f,_0x9d9fb0);var _0x4fd7b9=!![];if(_0x414634[_0xd68c('0x12b')]===_0xd68c('0x135')){_0x4fd7b9=![];}var _0x278d10=this[_0xd68c('0xd')]['recordFile'](_0x55a88f,_0x9d9fb0,_0x414634[_0xd68c('0x12d')],_0x414634[_0xd68c('0x67')],undefined,_0x4fd7b9);if(_0x278d10[_0xd68c('0xab')]!==-0x1){this[_0xd68c('0xd')]['noop'](util['format'](_0xd68c('0x147'),_0x5343d0));var _0x5f44a4=this[_0xd68c('0x81')][_0xd68c('0xa5')](this,_0x414634,_0x5343d0);if(_0x5f44a4){for(var _0x4ba2a6 in _0x5f44a4){if(_0x5f44a4[_0xd68c('0x92')](_0x4ba2a6)){this[_0xd68c('0xd')][_0xd68c('0x9c')](util['format'](_0xd68c('0x148'),_0x4ba2a6[_0xd68c('0x6c')]()),_0x5f44a4[_0x4ba2a6]);}}return this['channel'][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x149'),JSON['stringify'](_0x5f44a4)));}}return _0x278d10;};AGIVertices['prototype'][_0xd68c('0x14a')]=function(_0x503140){logger['info'](util['format'](_0xd68c('0x14b'),_0x503140[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x503140[_0xd68c('0x7f')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xe5'));}if(!this[_0xd68c('0xa3')](_0x503140[_0xd68c('0x5c')])){return this['channel'][_0xd68c('0xa8')](_0xd68c('0xa9'));}this['channel']['noop'](util[_0xd68c('0x26')](_0xd68c('0x14c'),_0x503140[_0xd68c('0x5c')]));var _0x504007=this[_0xd68c('0x7e')]['sync'](this,_0x503140);if(_0x504007){this[_0xd68c('0xd')][_0xd68c('0xa8')](util['format']('ispeech\x20%s\x20file\x20created',_0x504007));var _0x23a3c8=this[_0xd68c('0xd')][_0xd68c('0xf6')](_0x504007,_0x503140[_0xd68c('0x12d')]);try{fs[_0xd68c('0xf7')](_0x504007+_0xd68c('0xf8'));}catch(_0x5d6986){logger[_0xd68c('0x2a')](_0x5d6986);}return _0x23a3c8;}return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x503140,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd68c('0xf')][_0xd68c('0x14d')]=function(_0x349ba1){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x14e'),_0x349ba1['label']));if(!this[_0xd68c('0xa3')](_0x349ba1['findBy'])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x349ba1,_0xd68c('0x14f'));}logger['info'](util['format'](_0xd68c('0x150'),this[_0xd68c('0xd')]['callerid'],_0x349ba1[_0xd68c('0x151')]));var _0x3596ee=this['agentLogin']['sync'](this,_0x349ba1[_0xd68c('0x151')]);if(_0x3596ee){logger['info'](util[_0xd68c('0x26')](_0xd68c('0x152'),this['channel'][_0xd68c('0x38')],_0x349ba1['findBy']));this['channel'][_0xd68c('0xa8')](util[_0xd68c('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd68c('0xd')][_0xd68c('0x38')],_0x349ba1[_0xd68c('0x151')]));return{'code':0xc8,'result':_0xd68c('0x153')};}else{logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x154'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0x349ba1[_0xd68c('0x151')]));this[_0xd68c('0xd')]['noop'](util['format'](_0xd68c('0x154'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0x349ba1[_0xd68c('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd68c('0xf')]['logout']=function(_0x3156d7){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x155'),_0x3156d7[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x3156d7[_0xd68c('0x151')])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x3156d7,'no\x20find\x20by\x20configured');}logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x3156d7['findBy']));var _0x2b1576=this[_0xd68c('0x53')][_0xd68c('0xa5')](this,_0x3156d7['findBy']);if(_0x2b1576){logger['info'](util['format'](_0xd68c('0x152'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0x3156d7[_0xd68c('0x151')]));this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x152'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0x3156d7[_0xd68c('0x151')]));return{'code':0xc8,'result':_0xd68c('0x153')};}else{logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x154'),this['channel'][_0xd68c('0x38')],_0x3156d7['findBy']));this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x154'),this[_0xd68c('0xd')]['callerid'],_0x3156d7[_0xd68c('0x151')]));return{'code':0xc8,'result':_0xd68c('0x156')};}};AGIVertices[_0xd68c('0xf')]['math']=function(_0x192139){logger['info'](util[_0xd68c('0x26')](_0xd68c('0x157'),_0x192139[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x192139[_0xd68c('0x158')])){return this[_0xd68c('0xd')]['error'](_0x192139,_0xd68c('0x159'));}this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x15a'),_0x192139[_0xd68c('0x158')]));var _0x27755c=eval(_0x192139['operation']);if(!this['isConfigured'](_0x192139[_0xd68c('0xd8')])){return this[_0xd68c('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x19d7b6=this['getVariable'][_0xd68c('0xa5')](this,_0x192139[_0xd68c('0xd8')]);if(!_0x19d7b6){return this['channel'][_0xd68c('0x2a')](_0x192139,_0xd68c('0x15b'));}if(_[_0xd68c('0x9a')](_0x27755c)){var _0x5514a3=this;_0x27755c[_0xd68c('0xd9')](function(_0x2a3527,_0x50dedf){_0x5514a3[_0xd68c('0xd')][_0xd68c('0x9c')](util[_0xd68c('0x26')]('%s[%s]',_0x19d7b6,_0x50dedf),_0x2a3527);});return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x15c'),_0x19d7b6));}else{return this[_0xd68c('0xd')][_0xd68c('0x9c')](_0x19d7b6,_0x27755c);}};AGIVertices[_0xd68c('0xf')][_0xd68c('0xa')]=function(_0x2f9c30){logger[_0xd68c('0x2c')](util['format'](_0xd68c('0x15d'),_0x2f9c30['label']));if(_0x2f9c30[_0xd68c('0x108')]===0x0){return this[_0xd68c('0xa4')](_0x2f9c30);}_0x2f9c30['retry']-=0x1;if(!this[_0xd68c('0xa3')](_0x2f9c30[_0xd68c('0x109')])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x2f9c30,_0xd68c('0x10a'));}var _0x4daee6=this['getSound'][_0xd68c('0xa5')](this,_0x2f9c30[_0xd68c('0x109')]);if(!_0x4daee6){return this[_0xd68c('0xd')]['error'](_0x2f9c30,_0xd68c('0x15e'));}var _0x27eab1=this[_0xd68c('0xd')][_0xd68c('0x10c')](_0x4daee6,_0x2f9c30[_0xd68c('0x10d')],_0x2f9c30['digit']);var _0x593078=_0x27eab1[_0xd68c('0xab')];if(_0x27eab1[_0xd68c('0xab')]===-0x1){this[_0xd68c('0x34')]['sync'](this,_0x2f9c30,'-1');return _0x27eab1;}else if(_0x27eab1[_0xd68c('0xa0')]===_0xd68c('0x67')){_0x27eab1['result']=_0x27eab1['result'][_0xd68c('0x97')]>0x0?_0x27eab1[_0xd68c('0xab')]:'t';}else if(_[_0xd68c('0x45')](_0x27eab1[_0xd68c('0xab')])){_0x27eab1[_0xd68c('0xab')]='#';_0x593078='#';}if(!this[_0xd68c('0xa3')](_0x2f9c30[_0xd68c('0xd8')])){this[_0xd68c('0xd')][_0xd68c('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5ed581=this[_0xd68c('0x9f')][_0xd68c('0xa5')](this,_0x2f9c30[_0xd68c('0xd8')]);if(!_0x5ed581){return this[_0xd68c('0xd')]['error'](_0x2f9c30,_0xd68c('0x15b'));}this[_0xd68c('0xd')][_0xd68c('0x9c')](_0x5ed581,_0x593078);}this['createSquareDetailsReport']['sync'](this,_0x2f9c30,_0x593078);return _0x27eab1;};AGIVertices[_0xd68c('0xf')]['noop']=function(_0x2a31e1){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x15f'),_0x2a31e1[_0xd68c('0x36')]));return this[_0xd68c('0xd')]['noop'](_0x2a31e1[_0xd68c('0x160')]||_0x2a31e1[_0xd68c('0x36')]);};AGIVertices['prototype']['pause']=function(_0xa92f60){logger[_0xd68c('0x2c')](util['format'](_0xd68c('0x161'),_0xa92f60[_0xd68c('0x36')]));if(!this['isConfigured'](_0xa92f60[_0xd68c('0x151')])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0xa92f60,_0xd68c('0x14f'));}logger['info'](util[_0xd68c('0x26')](_0xd68c('0x150'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0xa92f60[_0xd68c('0x151')]));var _0x188647=this[_0xd68c('0x4e')][_0xd68c('0xa5')](this,_0xa92f60[_0xd68c('0x162')]);var _0xdd2441=this[_0xd68c('0x51')][_0xd68c('0xa5')](this,_0xa92f60[_0xd68c('0x151')],_0x188647);if(_0xdd2441){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x152'),this['channel'][_0xd68c('0x38')],_0xa92f60[_0xd68c('0x151')]));this[_0xd68c('0xd')]['noop'](util[_0xd68c('0x26')](_0xd68c('0x152'),this[_0xd68c('0xd')]['callerid'],_0xa92f60['findBy']));return{'code':0xc8,'result':_0xd68c('0x153')};}else{logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x154'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0xa92f60[_0xd68c('0x151')]));this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x152'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0xa92f60[_0xd68c('0x151')]));return{'code':0xc8,'result':_0xd68c('0x156')};}};AGIVertices['prototype'][_0xd68c('0x163')]=function(_0x45229b){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x164'),_0x45229b['label']));if(!this[_0xd68c('0xa3')](_0x45229b[_0xd68c('0x109')])){return this['channel'][_0xd68c('0x2a')](_0x45229b,_0xd68c('0x10a'));}var _0x3cd186=this[_0xd68c('0x165')][_0xd68c('0xa5')](this,_0x45229b[_0xd68c('0x109')]);if(!_0x3cd186){return this['channel'][_0xd68c('0x2a')](_0x45229b,_0xd68c('0x15e'));}var _0x2d7e03=this['channel']['exec'](_0xd68c('0x166'),[_0x3cd186,_0x45229b['opts']]);if(_0x2d7e03[_0xd68c('0xab')]===-0x1){return _0x2d7e03;}return this['channel'][_0xd68c('0xa8')](util[_0xd68c('0x26')]('Executed\x20command\x20%s\x20%s',_0xd68c('0x166'),_0x3cd186));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x167')]=function(_0xa8a77f){logger[_0xd68c('0x2c')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xa8a77f[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0xa8a77f[_0xd68c('0x168')])){return this['channel'][_0xd68c('0x2a')](_0xa8a77f,_0xd68c('0x169'));}var _0x3b9a0f='';var _0x2cba3b=parseInt(_0xa8a77f[_0xd68c('0x168')],0xa);if(isNaN(_0x2cba3b)){_0x3b9a0f=_0xa8a77f['queue_id'];}else{_0x3b9a0f=this['getVoiceQueue']['sync'](this,_0xa8a77f[_0xd68c('0x168')]);if(!_0x3b9a0f){return this['channel'][_0xd68c('0x2a')](_0xa8a77f,_0xd68c('0x16a'));}}var _0xaf2931='';if(this['isConfigured'](_0xa8a77f[_0xd68c('0x109')])){var _0x20a844=this[_0xd68c('0x165')][_0xd68c('0xa5')](this,_0xa8a77f[_0xd68c('0x109')]);if(_0x20a844){_0xaf2931=_0x20a844;}}this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0xa8a77f,_0x3b9a0f);if(_0xa8a77f['opts']['indexOf']('x')<0x0){_0xa8a77f[_0xd68c('0x104')]+='x';}if(_0xa8a77f[_0xd68c('0x104')][_0xd68c('0x16b')]('X')<0x0){_0xa8a77f[_0xd68c('0x104')]+='X';}this[_0xd68c('0xd')]['setVariable'](_0xd68c('0x16c'),_0x3b9a0f?_0x3b9a0f[_0xd68c('0x16d')]():'');var _0x11e134=this[_0xd68c('0xd')][_0xd68c('0x58')](_0xd68c('0x16e'),[_0x3b9a0f,_0xa8a77f[_0xd68c('0x104')],_0xa8a77f[_0xd68c('0x65')],_0xaf2931,_0xa8a77f[_0xd68c('0x67')],_0xa8a77f['agi'],_0xa8a77f[_0xd68c('0x16f')],_0xa8a77f[_0xd68c('0x170')],'',_0xa8a77f[_0xd68c('0x171')]]);if(_0x11e134['result']===-0x1){return _0x11e134;}return this[_0xd68c('0xd')]['noop'](util['format'](_0xd68c('0xc7'),'QUEUE',_0x3b9a0f));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x172')]=function(_0x32b37a){logger['info'](util[_0xd68c('0x26')](_0xd68c('0x173'),_0x32b37a[_0xd68c('0x36')]));var _0x44c380=_0x32b37a[_0xd68c('0x174')]||'wav';var _0x4260c2=util[_0xd68c('0x26')](_0xd68c('0x175'),this[_0xd68c('0xd')][_0xd68c('0x35')],rs['generate'](0x5));var _0x185cea=util[_0xd68c('0x26')](_0xd68c('0x176'),FILES_PATH,_0x4260c2,_0x44c380);var _0x1487ab=util['format'](_0xd68c('0x12a'),FILES_PATH,_0x4260c2);this[_0xd68c('0x177')][_0xd68c('0xa5')](this,_0x32b37a,_0x4260c2,_0x185cea);this[_0xd68c('0xd')][_0xd68c('0x9c')](_0xd68c('0x178'),_0x4260c2);logger[_0xd68c('0x2c')](_0xd68c('0x179'),_0x1487ab,_0x44c380,_0x32b37a[_0xd68c('0x17a')],_0x32b37a[_0xd68c('0x67')]);return this[_0xd68c('0xd')][_0xd68c('0x12c')](_0x1487ab,_0x44c380,_0x32b37a[_0xd68c('0x17a')],_0x32b37a[_0xd68c('0x67')],undefined,!![]);};AGIVertices[_0xd68c('0xf')][_0xd68c('0x17b')]=function(_0x51d876){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x17c'),_0x51d876[_0xd68c('0x36')]));if(!this['isConfigured'](_0x51d876[_0xd68c('0x65')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x17d'));}var _0x3b9b5f=this[_0xd68c('0x17e')][_0xd68c('0xa5')](this,_0x51d876);logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Response:',util[_0xd68c('0x17f')](_0x3b9b5f,{'showHidden':![],'depth':null})));if(!this[_0xd68c('0xa3')](_0x51d876[_0xd68c('0xd8')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x10d907=this[_0xd68c('0x9f')][_0xd68c('0xa5')](this,_0x51d876[_0xd68c('0xd8')]);if(!_0x10d907){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x51d876,_0xd68c('0x15b'));}this[_0xd68c('0xd')][_0xd68c('0x9c')](util[_0xd68c('0x26')](_0xd68c('0x180'),_0x10d907),_0x3b9b5f['statusCode']?_0x3b9b5f[_0xd68c('0x78')]:_0xd68c('0x181'));this[_0xd68c('0xd')][_0xd68c('0x9c')](util[_0xd68c('0x26')](_0xd68c('0x182'),_0x10d907),_0x3b9b5f['statusMessage']?_0x3b9b5f[_0xd68c('0x77')]:'OK');if(_0x3b9b5f[_0xd68c('0x75')]){try{this['saveRestApiResult'](_0x3b9b5f[_0xd68c('0x75')],_0x10d907);}catch(_0x5dae08){logger[_0xd68c('0x2a')](util[_0xd68c('0x26')](_0xd68c('0x183'),_0x10d907));}}return this[_0xd68c('0xd')]['noop'](util['format'](_0xd68c('0x184'),_0x10d907));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x185')]=function(_0x3cb144){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x186'),_0x3cb144['label']));return this[_0xd68c('0xd')][_0xd68c('0x187')](_0x3cb144[_0xd68c('0x188')][_0xd68c('0x59')](/\s+/g,''),_0x3cb144['escape_digits']);};AGIVertices['prototype'][_0xd68c('0x189')]=function(_0x322e6a){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x18a'),_0x322e6a['label']));return this['channel'][_0xd68c('0x18b')](_0x322e6a['number'][_0xd68c('0x59')](/\s+/g,''),_0x322e6a[_0xd68c('0x17a')]);};AGIVertices[_0xd68c('0xf')][_0xd68c('0x18c')]=function(_0x45a7a8){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x18d'),_0x45a7a8[_0xd68c('0x36')]));return this[_0xd68c('0xd')][_0xd68c('0x18e')](_0x45a7a8[_0xd68c('0x5c')],_0x45a7a8['escape_digits']);};AGIVertices[_0xd68c('0xf')]['sendMail']=function(_0x124754){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x124754[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x124754[_0xd68c('0x18f')])){return this[_0xd68c('0xd')]['noop'](_0xd68c('0x190'));}var _0x11dd1e=this['getMailAccount'][_0xd68c('0xa5')](this,_0x124754[_0xd68c('0x18f')]);if(!_0x11dd1e||!_0x11dd1e[_0xd68c('0x191')]){return this[_0xd68c('0xd')]['error'](_0x124754,_0xd68c('0x192'));}var _0x2c5c20={'from':util[_0xd68c('0x26')](_0xd68c('0x193'),_0x11dd1e['name'],_0x11dd1e[_0xd68c('0x194')]||_0x11dd1e[_0xd68c('0x191')][_0xd68c('0x195')]),'to':_0x124754['to']||'','cc':_0x124754['cc']||'','bcc':_0x124754[_0xd68c('0x196')]||'','subject':_0x124754[_0xd68c('0x197')],'html':_0x124754[_0xd68c('0x5c')],'text':_0x124754['text']};var _0xccf9c={'tls':{'rejectUnauthorized':![]}};if(_0x11dd1e['Smtp'][_0xd68c('0x198')]){_0xccf9c[_0xd68c('0x198')]=_0x11dd1e[_0xd68c('0x191')][_0xd68c('0x198')];}else{_0xccf9c[_0xd68c('0x199')]=_0x11dd1e[_0xd68c('0x191')][_0xd68c('0x199')];_0xccf9c[_0xd68c('0x19a')]=_0x11dd1e[_0xd68c('0x191')][_0xd68c('0x19a')];_0xccf9c['secure']=_0x11dd1e[_0xd68c('0x191')]['secure'];}if(_0x11dd1e[_0xd68c('0x191')][_0xd68c('0x19b')]){_0xccf9c['auth']={'user':_0x11dd1e[_0xd68c('0x191')][_0xd68c('0x195')],'pass':_0x11dd1e[_0xd68c('0x191')][_0xd68c('0x19c')]};}if(this[_0xd68c('0xa3')](_0x124754[_0xd68c('0x19d')])){}logger[_0xd68c('0xdd')]('sendMail\x20message',JSON[_0xd68c('0x74')](_0x2c5c20));this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x124754,_0x124754['account_id']);this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x19e'),_0x11dd1e[_0xd68c('0x14')]));this[_0xd68c('0x20')][_0xd68c('0xa5')](this,_0xccf9c,_0x2c5c20);return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x19f'));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x1a0')]=function(_0x572559){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x1a1'),_0x572559[_0xd68c('0x36')]));return this['channel'][_0xd68c('0xa8')](_0xd68c('0x1a2'));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x1a3')]=function(_0x3af1ce){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3af1ce[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x3af1ce[_0xd68c('0x1a4')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x1a5'));}var _0x27b019=this[_0xd68c('0x31')][_0xd68c('0xa5')](this,_0x3af1ce[_0xd68c('0x1a4')]);if(!_0x27b019){return this['channel'][_0xd68c('0x2a')](_0x3af1ce,_0xd68c('0x1a6'));}var _0x2ff669={'body':_0x3af1ce[_0xd68c('0x1a7')],'phone':_0x3af1ce['to']||'','SmsAccountId':_0x27b019['id']};logger[_0xd68c('0xdd')]('sendSMS\x20message',JSON[_0xd68c('0x74')](_0x2ff669));this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x3af1ce,_0x3af1ce['sms_account_id']);this['channel'][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x1a8'),_0x27b019['name']));this[_0xd68c('0x33')]['sync'](this,_0x2ff669);return this[_0xd68c('0xd')]['noop'](_0xd68c('0x1a9'));};AGIVertices['prototype'][_0xd68c('0x1aa')]=function(_0x11d609){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x1ab'),_0x11d609[_0xd68c('0x36')]));if(!this['isConfigured'](_0x11d609[_0xd68c('0xd8')])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x11d609,'no\x20variable\x20selected');}var _0x14c4f2=this[_0xd68c('0x9f')][_0xd68c('0xa5')](this,_0x11d609['variable_id']);if(!_0x14c4f2){return this['channel'][_0xd68c('0x2a')](_0x11d609,_0xd68c('0x15b'));}return this['channel'][_0xd68c('0x9c')](_0x14c4f2,_0x11d609[_0xd68c('0x1ac')]);};AGIVertices['prototype'][_0xd68c('0x1ad')]=function(_0x43fce8){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x1ae'),_0x43fce8[_0xd68c('0x36')]));this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x1af'));if(_0x43fce8[_0xd68c('0xb9')]===_0xd68c('0x1b0')){this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x1b1'));return this[_0xd68c('0xd')]['answer']();}return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0x1b2'));};AGIVertices['prototype'][_0xd68c('0x1b3')]=function(_0x3a3c82){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x1b4'),_0x3a3c82['label']));if(!this[_0xd68c('0xa3')](_0x3a3c82[_0xd68c('0x1b5')])){return this['channel'][_0xd68c('0x2a')](_0x3a3c82,_0xd68c('0x1b6'));}var _0x3dc56c=this['getSquareProject']['sync'](this,_0x3a3c82[_0xd68c('0x1b5')]);if(!this[_0xd68c('0xa3')](_0x3dc56c)){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x3a3c82,util[_0xd68c('0x26')](_0xd68c('0x1b7'),_0x3a3c82[_0xd68c('0x1b5')]));}if(_0x3dc56c===this['channel'][_0xd68c('0x3f')]){return this[_0xd68c('0xd')]['error'](_0x3a3c82,_0xd68c('0x1b8'));}this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x3a3c82,_0x3dc56c);var _0x1f0714=this[_0xd68c('0xd')][_0xd68c('0x58')](_0xd68c('0x1b9'),util[_0xd68c('0x26')](_0xd68c('0x1ba'),config[_0xd68c('0x7')][_0xd68c('0x199')]||_0xd68c('0x1bb'),_0x3dc56c,this['channel'][_0xd68c('0x3f')]));if(_0x1f0714['result']===-0x1){return _0x1f0714;}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util['format'](_0xd68c('0xc7'),_0xd68c('0x1b9'),_0x3dc56c));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x1bc')]=function(_0x34066b){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x1bd'),_0x34066b[_0xd68c('0x36')]));var _0x321a6d=this[_0xd68c('0x57')][_0xd68c('0xa5')](this,_0x34066b[_0xd68c('0x1be')]);this[_0xd68c('0x34')][_0xd68c('0xa5')](this,_0x34066b,_0x34066b['command']);if(this[_0xd68c('0xa3')](_0x34066b[_0xd68c('0xd8')])){var _0x1cec65=this[_0xd68c('0x9f')][_0xd68c('0xa5')](this,_0x34066b[_0xd68c('0xd8')]);if(_0x1cec65){this['channel']['setVariable'](_0x1cec65,_0x321a6d);return this['channel'][_0xd68c('0xa8')](util['format'](_0xd68c('0x1bf'),_0x34066b[_0xd68c('0x1be')],_0x1cec65));}}return this[_0xd68c('0xd')]['noop'](util['format'](_0xd68c('0x1c0'),_0x34066b[_0xd68c('0x1be')]));};AGIVertices['prototype'][_0xd68c('0x1c1')]=function(_0x3e345d){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x1c2'),_0x3e345d[_0xd68c('0x36')]));_0x3e345d[_0xd68c('0x5c')]=_0x3e345d[_0xd68c('0x5c')][_0xd68c('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd68c('0xa3')](_0x3e345d[_0xd68c('0x1c3')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')]('no\x20apiKey\x20configured');}if(!this[_0xd68c('0xa3')](_0x3e345d[_0xd68c('0x5c')])){return this['channel'][_0xd68c('0xa8')]('no\x20text\x20configured');}this[_0xd68c('0xd')]['noop'](util[_0xd68c('0x26')](_0xd68c('0x1c4'),_0x3e345d['text']));var _0x33e902=this[_0xd68c('0x5a')]['sync'](this,_0x3e345d);if(_0x33e902){this[_0xd68c('0xd')][_0xd68c('0xa8')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x33e902));var _0x554f30=this['channel'][_0xd68c('0xf6')](_0x33e902);try{fs[_0xd68c('0xf7')](_0x33e902+_0xd68c('0xf8'));}catch(_0x23a88f){logger['error'](_0x23a88f);}return _0x554f30;}return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x3e345d,_0xd68c('0x1c5'));};AGIVertices['prototype'][_0xd68c('0x1c6')]=function(_0x493b14){logger['info'](util[_0xd68c('0x26')](_0xd68c('0x1c7'),_0x493b14[_0xd68c('0x36')]));_0x493b14['text']=_0x493b14[_0xd68c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd68c('0xa3')](_0x493b14[_0xd68c('0x5c')])){return this[_0xd68c('0xd')][_0xd68c('0xa8')](_0xd68c('0xa9'));}this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')]('Trying\x20Google\x20TTS\x20%s',_0x493b14[_0xd68c('0x5c')]));var _0x96be97=this[_0xd68c('0x63')][_0xd68c('0xa5')](this,_0x493b14);if(_0x96be97){this[_0xd68c('0xd')]['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x96be97));var _0x46cf60=this[_0xd68c('0xd')][_0xd68c('0xf6')](_0x96be97);try{fs[_0xd68c('0xf7')](_0x96be97+_0xd68c('0xf8'));}catch(_0x570d5a){logger[_0xd68c('0x2a')](_0x570d5a);}return _0x46cf60;}return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x493b14,_0xd68c('0x1c8'));};AGIVertices[_0xd68c('0xf')][_0xd68c('0x1c9')]=function(_0x4da339){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x1ca'),_0x4da339[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x4da339[_0xd68c('0x151')])){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x4da339,_0xd68c('0x14f'));}logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x150'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0x4da339[_0xd68c('0x151')]));var _0x329b74=this[_0xd68c('0x52')][_0xd68c('0xa5')](this,_0x4da339[_0xd68c('0x151')]);if(_0x329b74){logger['info'](util[_0xd68c('0x26')](_0xd68c('0x152'),this['channel'][_0xd68c('0x38')],_0x4da339[_0xd68c('0x151')]));this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0x152'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0x4da339[_0xd68c('0x151')]));return{'code':0xc8,'result':_0xd68c('0x153')};}else{logger['info'](util[_0xd68c('0x26')](_0xd68c('0x154'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0x4da339['findBy']));this[_0xd68c('0xd')]['noop'](util[_0xd68c('0x26')](_0xd68c('0x154'),this[_0xd68c('0xd')][_0xd68c('0x38')],_0x4da339[_0xd68c('0x151')]));return{'code':0xc8,'result':_0xd68c('0x156')};}};AGIVertices['prototype'][_0xd68c('0x1cb')]=function(_0x1c4613){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')](_0xd68c('0x1cc'),_0x1c4613[_0xd68c('0x36')]));var _0x23e21f=this[_0xd68c('0xd')][_0xd68c('0x58')](_0xd68c('0x1cd'),[_0x1c4613[_0xd68c('0x1ce')],_0x1c4613[_0xd68c('0x7a')]]);if(_0x23e21f[_0xd68c('0xab')]===-0x1){return _0x23e21f;}return this[_0xd68c('0xd')][_0xd68c('0xa8')](util[_0xd68c('0x26')](_0xd68c('0xc7'),_0xd68c('0x1cd'),_0x1c4613['mailbox']));};AGIVertices['prototype'][_0xd68c('0x1cf')]=function(_0x4b44f5){logger[_0xd68c('0x2c')](util[_0xd68c('0x26')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4b44f5[_0xd68c('0x36')]));if(!this[_0xd68c('0xa3')](_0x4b44f5[_0xd68c('0xd8')])){return this[_0xd68c('0xd')]['error'](_0x4b44f5,'no\x20variable\x20selected');}var _0xe83686=this[_0xd68c('0x9f')][_0xd68c('0xa5')](this,_0x4b44f5[_0xd68c('0xd8')]);if(!_0xe83686){return this[_0xd68c('0xd')][_0xd68c('0x2a')](_0x4b44f5,_0xd68c('0x15b'));}var _0x5cc7d0=this[_0xd68c('0xd')][_0xd68c('0x9f')](_0xe83686);return{'code':0xc8,'result':_0x5cc7d0[_0xd68c('0xa0')]?_0x5cc7d0[_0xd68c('0xa0')]:'-'};};String[_0xd68c('0xf')]['replaceAll']=function(_0x44be84,_0x17c4bd){return this['split'](_0x44be84)[_0xd68c('0x1d0')](_0x17c4bd);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index cedc092..b737999 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 _0x7fbe=['transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','name','QueuePause','then','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','message','prototype','stopAcw','timer','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','attended','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]'];(function(_0xcd2975,_0x27d718){var _0x284074=function(_0x47a69d){while(--_0x47a69d){_0xcd2975['push'](_0xcd2975['shift']());}};_0x284074(++_0x27d718);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xfdf7a4,_0x37da46){_0xfdf7a4=_0xfdf7a4-0x0;var _0x59ec89=_0x7fbe[_0xfdf7a4];return _0x59ec89;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe7fb('0x0'));var ami=require(_0xe7fb('0x1'));var logger=require(_0xe7fb('0x2'))(_0xe7fb('0x3'));var RpcUser=require(_0xe7fb('0x4'));var RpcVoiceAgentReport=require(_0xe7fb('0x5'));function Acw(_0x11d2c4){this[_0xe7fb('0x6')]=_0x11d2c4[_0xe7fb('0x6')];this[_0xe7fb('0x7')]=_0x11d2c4[_0xe7fb('0x7')];this[_0xe7fb('0x8')]=_0x11d2c4[_0xe7fb('0x8')];this[_0xe7fb('0x9')]={};ami['on']('agentconnect',this[_0xe7fb('0xa')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0xc'),this[_0xe7fb('0xd')]['bind'](this));ami['on']('hangup',this[_0xe7fb('0xe')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0xf'),this[_0xe7fb('0x10')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x11'),this[_0xe7fb('0x12')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x13'),this[_0xe7fb('0x14')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x15'),this[_0xe7fb('0x16')][_0xe7fb('0xb')](this));}function getDiff(_0x7fe4d3){var _0x598729=moment()[_0xe7fb('0x17')](0x0);var _0x2225e5=moment(_0x7fe4d3)['milliseconds'](0x0);return _0x598729[_0xe7fb('0x18')](_0x2225e5,_0xe7fb('0x19'));}Acw['prototype'][_0xe7fb('0x1a')]=function(_0x559129){try{var _0x12fff6=this;var _0x18d23c=this[_0xe7fb('0x9')][_0x559129][_0xe7fb('0x1b')];var _0x562262=this[_0xe7fb('0x9')][_0x559129]['queue'];var _0x293a47=this['voiceQueues'][_0x562262];var _0x1e77fd=![];var _0x4708f7=_0xe7fb('0x1c');if(_0x293a47[_0xe7fb('0x1d')]){if(_0x293a47['mandatoryDispositionPause'][_0xe7fb('0x1e')]){_0x1e77fd=!![];_0x4708f7=_0x293a47['mandatoryDispositionPause'][_0xe7fb('0x1e')];}}ami['Action']({'action':_0xe7fb('0x1f'),'interface':_0x18d23c,'paused':!![],'reason':_0x4708f7})['then'](function(_0xa5af01){if(_0x12fff6[_0xe7fb('0x7')][_0x18d23c]){return RpcUser['getAgent'](_0x12fff6[_0xe7fb('0x7')][_0x18d23c]['id'])[_0xe7fb('0x20')](function(_0x3ae8f1){if(_0x3ae8f1&&!_0x3ae8f1['voicePause']){logger[_0xe7fb('0x21')](_0xe7fb('0x22'),_0x559129,_0x18d23c,_0x562262);var _0x5da3d9=_0x12fff6['channels'][_0x559129]['attended']&&_0x12fff6[_0xe7fb('0x9')][_0x559129]['destlinkedid']?_0x12fff6['channels'][_0x559129][_0xe7fb('0x23')]:_0x559129;return RpcUser[_0xe7fb('0x24')](_0x12fff6[_0xe7fb('0x7')][_0x18d23c],_0x4708f7,_0x5da3d9)['then'](function(_0x6c930){if(!_0x1e77fd){_0x12fff6[_0xe7fb('0x8')][_0x18d23c]={};logger[_0xe7fb('0x21')](_0xe7fb('0x25'),_0x559129,_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')],_0x18d23c,_0x562262);_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['timer']=setTimeout(_0x12fff6['stopAcw'][_0xe7fb('0xb')](_0x12fff6,_0x18d23c),_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')]*0x3e8);_0x12fff6['timers'][_0x18d23c][_0xe7fb('0x27')]=moment()[_0xe7fb('0x28')](_0xe7fb('0x29'));_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2a')]=_0x559129;_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2b')]=_0x562262;_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['updateAcw']=function(){var _0x3d1fb5=getDiff(_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x27')]);clearTimeout(_0x12fff6['timers'][_0x18d23c]['timer']);_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['timer']=![];RpcVoiceAgentReport[_0xe7fb('0x2c')]({'acwtime':_0x3d1fb5},_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2a')],_0x18d23c)[_0xe7fb('0x20')](function(_0x556368){logger[_0xe7fb('0x21')](_0xe7fb('0x2d'),_0x559129,_0x3d1fb5,_0x556368);})[_0xe7fb('0x2e')](function(_0x2f8818){logger[_0xe7fb('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x559129,_0x2f8818);});delete _0x12fff6[_0xe7fb('0x8')][_0x18d23c];};}});}else{logger[_0xe7fb('0x21')](_0xe7fb('0x30'),_0x559129,_0x18d23c,_0x562262);}});}})[_0xe7fb('0x2e')](function(_0x46f430){logger[_0xe7fb('0x2f')](_0xe7fb('0x25'),_0x559129,_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')],_0x18d23c,_0x562262);})['finally'](function(){delete _0x12fff6[_0xe7fb('0x9')][_0x559129];});}catch(_0x29ef52){logger[_0xe7fb('0x2f')]('[ACW][START]\x20%s',_0x29ef52[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x33')]=function(_0x1530b1){try{var _0x402ca3=this;if(_0x402ca3[_0xe7fb('0x8')][_0x1530b1]){_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x34')]=![];var _0x195c35=_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x2a')];var _0x3c4f4b=_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x2b')];var _0xeb7c29=_0x402ca3[_0xe7fb('0x6')][_0x3c4f4b][_0xe7fb('0x26')];logger[_0xe7fb('0x21')](_0xe7fb('0x35'),_0x1530b1);RpcUser['saveUnpause'](this[_0xe7fb('0x7')][_0x1530b1]);RpcVoiceAgentReport[_0xe7fb('0x2c')]({'acwtime':_0xeb7c29,'agentacw':!![]},_0x195c35,_0x1530b1)[_0xe7fb('0x20')](function(_0x444f98){logger['info'](_0xe7fb('0x2d'),_0x195c35,_0xeb7c29,_0x444f98);})[_0xe7fb('0x2e')](function(_0xd472d){logger[_0xe7fb('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x195c35,_0xd472d);});}else{logger[_0xe7fb('0x2f')](_0xe7fb('0x36'),_0x1530b1);if(_0x402ca3[_0xe7fb('0x8')]){logger[_0xe7fb('0x21')](_0xe7fb('0x37'),JSON[_0xe7fb('0x38')](_0x402ca3['timers']));}}}catch(_0x4362c2){logger[_0xe7fb('0x2f')](_0xe7fb('0x39'),_0x4362c2['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xa')]=function(_0x5d42ac){try{if(this['voiceQueues'][_0x5d42ac['queue']]&&(this['voiceQueues'][_0x5d42ac['queue']][_0xe7fb('0x3')]||this[_0xe7fb('0x6')][_0x5d42ac[_0xe7fb('0x2b')]]['mandatoryDisposition'])){if(this[_0xe7fb('0x7')][_0x5d42ac['interface']]){this[_0xe7fb('0x9')][_0x5d42ac[_0xe7fb('0x2a')]]={'queue':_0x5d42ac['queue'],'interface':_0x5d42ac[_0xe7fb('0x1b')],'destlinkedid':_0x5d42ac[_0xe7fb('0x23')]};}}}catch(_0x240efa){logger[_0xe7fb('0x2f')]('[ACW][syncAgentConnect]\x20%s',_0x240efa[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x16')]=function(_0x56a84f){try{if(this[_0xe7fb('0x6')][_0x56a84f[_0xe7fb('0x2b')]]&&(this[_0xe7fb('0x6')][_0x56a84f[_0xe7fb('0x2b')]][_0xe7fb('0x3')]||this['voiceQueues'][_0x56a84f[_0xe7fb('0x2b')]]['mandatoryDisposition'])){if(this[_0xe7fb('0x7')][_0x56a84f[_0xe7fb('0x1b')]]){this[_0xe7fb('0x9')][_0x56a84f[_0xe7fb('0x2a')]]={'queue':_0x56a84f[_0xe7fb('0x2b')],'interface':_0x56a84f['interface']};}}}catch(_0x364a0a){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x364a0a[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xd')]=function(_0x589555){try{if(this[_0xe7fb('0x9')][_0x589555[_0xe7fb('0x2a')]]&&_['isUndefined'](this['channels'][_0x589555[_0xe7fb('0x2a')]][_0xe7fb('0x3a')])){logger[_0xe7fb('0x21')](_0xe7fb('0x3b'),_0x589555[_0xe7fb('0x2a')]);this[_0xe7fb('0x1a')](_0x589555[_0xe7fb('0x2a')]);}else if(this[_0xe7fb('0x9')][_0x589555['linkedid']]&&_[_0xe7fb('0x3c')](this['channels'][_0x589555[_0xe7fb('0x3d')]][_0xe7fb('0x3a')])){logger['info'](_0xe7fb('0x3e'),_0x589555['linkedid']);this[_0xe7fb('0x1a')](_0x589555['linkedid']);}}catch(_0x68e723){logger['error'](_0xe7fb('0x3f'),_0x68e723['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xe')]=function(_0x41fcfb){try{if(this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x2a')]]&&this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x2a')]]['attended']){logger['info'](_0xe7fb('0x40'),_0x41fcfb['uniqueid']);this['startAcw'](_0x41fcfb['uniqueid']);}else if(this['channels'][_0x41fcfb['linkedid']]&&this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x3d')]][_0xe7fb('0x3a')]){logger[_0xe7fb('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x41fcfb[_0xe7fb('0x3d')]);this[_0xe7fb('0x1a')](_0x41fcfb[_0xe7fb('0x3d')]);}}catch(_0x4a9372){logger['error'](_0xe7fb('0x41'),_0x4a9372[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')]['syncAttendedTransfer']=function(_0x27f860){try{if(!_[_0xe7fb('0x42')](this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x43')]])){this['startAcw'](_0x27f860['transfereeuniqueid']);if(this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]]){this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]][_0xe7fb('0x3a')]=!![];this['channels'][_0x27f860[_0xe7fb('0x45')]]=this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]];delete this['channels'][_0x27f860['secondtransfereruniqueid']];}}else if(!_[_0xe7fb('0x42')](this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x45')]])){this[_0xe7fb('0x1a')](_0x27f860[_0xe7fb('0x45')]);if(this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']]){this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x46')]][_0xe7fb('0x3a')]=!![];this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x43')]]=this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']];delete this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']];}}}catch(_0x1eda1d){logger[_0xe7fb('0x2f')](_0xe7fb('0x47'),_0x1eda1d[_0xe7fb('0x31')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x2789a4){try{if(this[_0xe7fb('0x9')][_0x2789a4[_0xe7fb('0x48')]]){logger[_0xe7fb('0x21')](_0xe7fb('0x49'),JSON['stringify'](_0x2789a4[_0xe7fb('0x48')]));this['startAcw'](_0x2789a4[_0xe7fb('0x48')]);}else if(this['channels'][_0x2789a4['transfererlinkedid']]){logger[_0xe7fb('0x21')](_0xe7fb('0x4a'),JSON[_0xe7fb('0x38')](_0x2789a4['transfererlinkedid']));this[_0xe7fb('0x1a')](_0x2789a4[_0xe7fb('0x4b')]);}}catch(_0x3401e0){logger[_0xe7fb('0x2f')](_0xe7fb('0x4c'),_0x3401e0['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x10')]=function(_0x5151ec){try{if(this[_0xe7fb('0x6')][_0x5151ec[_0xe7fb('0x2b')]]&&this['voiceQueues'][_0x5151ec[_0xe7fb('0x2b')]]['autopause']===_0xe7fb('0x4d')){if(this[_0xe7fb('0x7')][_0x5151ec[_0xe7fb('0x1b')]]){logger['info'](_0xe7fb('0x4e'),_0x5151ec[_0xe7fb('0x2a')],_0x5151ec[_0xe7fb('0x1b')],_0x5151ec[_0xe7fb('0x2b')]);return RpcUser[_0xe7fb('0x24')](this[_0xe7fb('0x7')][_0x5151ec[_0xe7fb('0x1b')]],_0xe7fb('0x4f'),_0x5151ec['uniqueid']);}}}catch(_0x497998){logger[_0xe7fb('0x2f')](_0xe7fb('0x50'),_0x497998[_0xe7fb('0x31')]);}};module['exports']=Acw; \ No newline at end of file +var _0xb903=['attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','Auto-Pause','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','prototype','startAcw','channels','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x456ce4,_0x147b6){var _0x506003=function(_0x4361bd){while(--_0x4361bd){_0x456ce4['push'](_0x456ce4['shift']());}};_0x506003(++_0x147b6);}(_0xb903,0x185));var _0x3b90=function(_0x40846d,_0x5e82b6){_0x40846d=_0x40846d-0x0;var _0xe0fc33=_0xb903[_0x40846d];return _0xe0fc33;};'use strict';var util=require(_0x3b90('0x0'));var _=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var ami=require(_0x3b90('0x3'));var logger=require('../../../config/logger')(_0x3b90('0x4'));var RpcUser=require(_0x3b90('0x5'));var RpcVoiceAgentReport=require(_0x3b90('0x6'));function Acw(_0x1cd5d8){this[_0x3b90('0x7')]=_0x1cd5d8[_0x3b90('0x7')];this[_0x3b90('0x8')]=_0x1cd5d8['agents'];this[_0x3b90('0x9')]=_0x1cd5d8['timers'];this['channels']={};ami['on'](_0x3b90('0xa'),this[_0x3b90('0xb')][_0x3b90('0xc')](this));ami['on'](_0x3b90('0xd'),this['syncHangupRequest']['bind'](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x3b90('0xe')][_0x3b90('0xc')](this));ami['on']('attendedtransfer',this[_0x3b90('0xf')][_0x3b90('0xc')](this));ami['on']('blindtransfer',this[_0x3b90('0x10')][_0x3b90('0xc')](this));ami['on'](_0x3b90('0x11'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x58c4d1){var _0x542cb3=moment()['milliseconds'](0x0);var _0x3a0a55=moment(_0x58c4d1)[_0x3b90('0x12')](0x0);return _0x542cb3['diff'](_0x3a0a55,'seconds');}Acw[_0x3b90('0x13')][_0x3b90('0x14')]=function(_0x381a9e){try{var _0x1af265=this;var _0x1efe01=this['channels'][_0x381a9e]['interface'];var _0xd83280=this[_0x3b90('0x15')][_0x381a9e]['queue'];var _0x269488=this[_0x3b90('0x7')][_0xd83280];var _0x11ad7d=![];var _0x131f3f='ACW';if(_0x269488[_0x3b90('0x16')]){if(_0x269488['mandatoryDispositionPause'][_0x3b90('0x17')]){_0x11ad7d=!![];_0x131f3f=_0x269488[_0x3b90('0x18')]['name'];}}ami[_0x3b90('0x19')]({'action':_0x3b90('0x1a'),'interface':_0x1efe01,'paused':!![],'reason':_0x131f3f})[_0x3b90('0x1b')](function(_0x3ce411){if(_0x1af265[_0x3b90('0x8')][_0x1efe01]){return RpcUser[_0x3b90('0x1c')](_0x1af265[_0x3b90('0x8')][_0x1efe01]['id'])[_0x3b90('0x1b')](function(_0xa98414){if(_0xa98414&&!_0xa98414[_0x3b90('0x1d')]){logger['info'](_0x3b90('0x1e'),_0x381a9e,_0x1efe01,_0xd83280);var _0x36b93e=_0x1af265[_0x3b90('0x15')][_0x381a9e][_0x3b90('0x1f')]&&_0x1af265[_0x3b90('0x15')][_0x381a9e][_0x3b90('0x20')]?_0x1af265['channels'][_0x381a9e]['destlinkedid']:_0x381a9e;return RpcUser[_0x3b90('0x21')](_0x1af265[_0x3b90('0x8')][_0x1efe01],_0x131f3f,_0x36b93e)[_0x3b90('0x1b')](function(_0x2ffa1a){if(!_0x11ad7d){_0x1af265['timers'][_0x1efe01]={};logger[_0x3b90('0x22')](_0x3b90('0x23'),_0x381a9e,_0x1af265[_0x3b90('0x7')][_0xd83280]['acwTimeout'],_0x1efe01,_0xd83280);_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x24')]=setTimeout(_0x1af265[_0x3b90('0x25')][_0x3b90('0xc')](_0x1af265,_0x1efe01),_0x1af265[_0x3b90('0x7')][_0xd83280][_0x3b90('0x26')]*0x3e8);_0x1af265['timers'][_0x1efe01][_0x3b90('0x27')]=moment()['format'](_0x3b90('0x28'));_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x29')]=_0x381a9e;_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x2a')]=_0xd83280;_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x2b')]=function(){var _0x2430ec=getDiff(_0x1af265['timers'][_0x1efe01]['lastPauseAt']);clearTimeout(_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x24')]);_0x1af265[_0x3b90('0x9')][_0x1efe01][_0x3b90('0x24')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2430ec},_0x1af265['timers'][_0x1efe01][_0x3b90('0x29')],_0x1efe01)[_0x3b90('0x1b')](function(_0x24d5c9){logger['info'](_0x3b90('0x2c'),_0x381a9e,_0x2430ec,_0x24d5c9);})['catch'](function(_0x49b4d2){logger[_0x3b90('0x2d')](_0x3b90('0x2e'),_0x381a9e,_0x49b4d2);});delete _0x1af265['timers'][_0x1efe01];};}});}else{logger[_0x3b90('0x22')](_0x3b90('0x2f'),_0x381a9e,_0x1efe01,_0xd83280);}});}})[_0x3b90('0x30')](function(_0x562882){logger['error'](_0x3b90('0x23'),_0x381a9e,_0x1af265[_0x3b90('0x7')][_0xd83280][_0x3b90('0x26')],_0x1efe01,_0xd83280);})[_0x3b90('0x31')](function(){delete _0x1af265['channels'][_0x381a9e];});}catch(_0x5a97fe){logger[_0x3b90('0x2d')](_0x3b90('0x32'),_0x5a97fe['message']);}};Acw['prototype'][_0x3b90('0x25')]=function(_0x146bc7){try{var _0x20416d=this;if(_0x20416d[_0x3b90('0x9')][_0x146bc7]){_0x20416d['timers'][_0x146bc7][_0x3b90('0x24')]=![];var _0x583842=_0x20416d[_0x3b90('0x9')][_0x146bc7][_0x3b90('0x29')];var _0x2355bf=_0x20416d[_0x3b90('0x9')][_0x146bc7][_0x3b90('0x2a')];var _0x3bf148=_0x20416d[_0x3b90('0x7')][_0x2355bf]['acwTimeout'];logger[_0x3b90('0x22')](_0x3b90('0x33'),_0x146bc7);RpcUser[_0x3b90('0x34')](this[_0x3b90('0x8')][_0x146bc7]);RpcVoiceAgentReport[_0x3b90('0x35')]({'acwtime':_0x3bf148,'agentacw':!![]},_0x583842,_0x146bc7)[_0x3b90('0x1b')](function(_0x63c44e){logger[_0x3b90('0x22')](_0x3b90('0x2c'),_0x583842,_0x3bf148,_0x63c44e);})['catch'](function(_0x369d0d){logger[_0x3b90('0x2d')](_0x3b90('0x2e'),_0x583842,_0x369d0d);});}else{logger[_0x3b90('0x2d')](_0x3b90('0x36'),_0x146bc7);if(_0x20416d[_0x3b90('0x9')]){logger[_0x3b90('0x22')](_0x3b90('0x37'),JSON[_0x3b90('0x38')](_0x20416d[_0x3b90('0x9')]));}}}catch(_0x47592a){logger[_0x3b90('0x2d')](_0x3b90('0x39'),_0x47592a[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0xb')]=function(_0x3a27cf){try{if(this[_0x3b90('0x7')][_0x3a27cf[_0x3b90('0x2a')]]&&(this[_0x3b90('0x7')][_0x3a27cf[_0x3b90('0x2a')]]['acw']||this[_0x3b90('0x7')][_0x3a27cf[_0x3b90('0x2a')]][_0x3b90('0x16')])){if(this[_0x3b90('0x8')][_0x3a27cf['interface']]){this[_0x3b90('0x15')][_0x3a27cf['uniqueid']]={'queue':_0x3a27cf['queue'],'interface':_0x3a27cf[_0x3b90('0x3b')],'destlinkedid':_0x3a27cf[_0x3b90('0x20')]};}}}catch(_0x49187d){logger[_0x3b90('0x2d')](_0x3b90('0x3c'),_0x49187d[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0x3d')]=function(_0x3fd5a1){try{if(this[_0x3b90('0x7')][_0x3fd5a1[_0x3b90('0x2a')]]&&(this[_0x3b90('0x7')][_0x3fd5a1['queue']][_0x3b90('0x4')]||this[_0x3b90('0x7')][_0x3fd5a1['queue']][_0x3b90('0x16')])){if(this[_0x3b90('0x8')][_0x3fd5a1[_0x3b90('0x3b')]]){this[_0x3b90('0x15')][_0x3fd5a1[_0x3b90('0x29')]]={'queue':_0x3fd5a1['queue'],'interface':_0x3fd5a1['interface']};}}}catch(_0x4034a3){logger['error'](_0x3b90('0x3e'),_0x4034a3[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0x3f')]=function(_0x177234){try{if(this['channels'][_0x177234['uniqueid']]&&_[_0x3b90('0x40')](this[_0x3b90('0x15')][_0x177234[_0x3b90('0x29')]]['attended'])){logger[_0x3b90('0x22')](_0x3b90('0x41'),_0x177234[_0x3b90('0x29')]);this[_0x3b90('0x14')](_0x177234[_0x3b90('0x29')]);}else if(this[_0x3b90('0x15')][_0x177234[_0x3b90('0x42')]]&&_[_0x3b90('0x40')](this[_0x3b90('0x15')][_0x177234['linkedid']][_0x3b90('0x1f')])){logger[_0x3b90('0x22')](_0x3b90('0x43'),_0x177234['linkedid']);this[_0x3b90('0x14')](_0x177234['linkedid']);}}catch(_0x288fbb){logger[_0x3b90('0x2d')](_0x3b90('0x44'),_0x288fbb['message']);}};Acw[_0x3b90('0x13')][_0x3b90('0x45')]=function(_0x5334b5){try{if(this['channels'][_0x5334b5[_0x3b90('0x29')]]&&this[_0x3b90('0x15')][_0x5334b5[_0x3b90('0x29')]][_0x3b90('0x1f')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5334b5[_0x3b90('0x29')]);this[_0x3b90('0x14')](_0x5334b5[_0x3b90('0x29')]);}else if(this[_0x3b90('0x15')][_0x5334b5[_0x3b90('0x42')]]&&this[_0x3b90('0x15')][_0x5334b5[_0x3b90('0x42')]][_0x3b90('0x1f')]){logger[_0x3b90('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5334b5[_0x3b90('0x42')]);this[_0x3b90('0x14')](_0x5334b5['linkedid']);}}catch(_0x1d211a){logger[_0x3b90('0x2d')]('[ACW][syncHangup]\x20%s',_0x1d211a[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0xf')]=function(_0x1bada9){try{if(!_[_0x3b90('0x46')](this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x47')]])){this['startAcw'](_0x1bada9[_0x3b90('0x47')]);if(this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x48')]]){this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x48')]][_0x3b90('0x1f')]=!![];this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x49')]]=this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x48')]];delete this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x48')]];}}else if(!_[_0x3b90('0x46')](this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x49')]])){this['startAcw'](_0x1bada9[_0x3b90('0x49')]);if(this['channels'][_0x1bada9[_0x3b90('0x4a')]]){this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x4a')]][_0x3b90('0x1f')]=!![];this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x47')]]=this['channels'][_0x1bada9[_0x3b90('0x4a')]];delete this[_0x3b90('0x15')][_0x1bada9[_0x3b90('0x4a')]];}}}catch(_0x8e1229){logger[_0x3b90('0x2d')](_0x3b90('0x4b'),_0x8e1229['message']);}};Acw[_0x3b90('0x13')][_0x3b90('0x10')]=function(_0xb41920){try{if(this['channels'][_0xb41920[_0x3b90('0x4c')]]){logger[_0x3b90('0x22')](_0x3b90('0x4d'),JSON[_0x3b90('0x38')](_0xb41920[_0x3b90('0x4c')]));this[_0x3b90('0x14')](_0xb41920[_0x3b90('0x4c')]);}else if(this[_0x3b90('0x15')][_0xb41920[_0x3b90('0x4e')]]){logger['info'](_0x3b90('0x4f'),JSON['stringify'](_0xb41920['transfererlinkedid']));this[_0x3b90('0x14')](_0xb41920[_0x3b90('0x4e')]);}}catch(_0x52c099){logger[_0x3b90('0x2d')](_0x3b90('0x50'),_0x52c099[_0x3b90('0x3a')]);}};Acw[_0x3b90('0x13')][_0x3b90('0xe')]=function(_0x260de4){try{if(this[_0x3b90('0x7')][_0x260de4['queue']]&&this['voiceQueues'][_0x260de4[_0x3b90('0x2a')]]['autopause']===_0x3b90('0x51')){if(this['agents'][_0x260de4[_0x3b90('0x3b')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x260de4['uniqueid'],_0x260de4[_0x3b90('0x3b')],_0x260de4[_0x3b90('0x2a')]);return RpcUser[_0x3b90('0x21')](this[_0x3b90('0x8')][_0x260de4[_0x3b90('0x3b')]],_0x3b90('0x52'),_0x260de4[_0x3b90('0x29')]);}}}catch(_0x490fd1){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x490fd1[_0x3b90('0x3a')]);}};module[_0x3b90('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 40c126b..03ce729 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 _0xf70d=['asterisk','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','exports','lodash','ami','../../config/environment','port'];(function(_0x165289,_0x44552b){var _0x350773=function(_0x401b30){while(--_0x401b30){_0x165289['push'](_0x165289['shift']());}};_0x350773(++_0x44552b);}(_0xf70d,0x172));var _0xdf70=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xf70d[_0x2df507];return _0x1f7167;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require('moment');var util=require('util');var _=require(_0xdf70('0x0'));var logger=require('../../config/logger')(_0xdf70('0x1'));var config=require(_0xdf70('0x2'));var ami=new Manager(config['asterisk'][_0xdf70('0x3')],config[_0xdf70('0x4')]['ip'],config[_0xdf70('0x4')][_0xdf70('0x5')],config[_0xdf70('0x4')]['password'],!![]);ami[_0xdf70('0x6')]();ami[_0xdf70('0x7')]=BPromise[_0xdf70('0x8')](ami[_0xdf70('0x9')]);function error(_0x245fd4){logger[_0xdf70('0xa')](util[_0xdf70('0xb')](_0xdf70('0xc'),config[_0xdf70('0x4')][_0xdf70('0x5')],config[_0xdf70('0x4')]['ip'],config[_0xdf70('0x4')][_0xdf70('0x3')],util[_0xdf70('0xd')](_0x245fd4,![],null)));}function close(){logger[_0xdf70('0xa')](util[_0xdf70('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xdf70('0x4')][_0xdf70('0x5')],config[_0xdf70('0x4')]['ip'],config['asterisk']['port']));}ami[_0xdf70('0xe')]=function(){return function(){return ami[_0xdf70('0x7')]({'action':_0xdf70('0xf')});};};ami[_0xdf70('0x10')]=function(){return function(){return ami[_0xdf70('0x7')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xdf70('0x7')]({'action':'sippeerstatus'});};};ami[_0xdf70('0x11')]=function(){return function(){return ami[_0xdf70('0x7')]({'action':_0xdf70('0x12')});};};ami[_0xdf70('0x13')]=function(){return function(){return ami[_0xdf70('0x7')]({'action':_0xdf70('0x14')});};};function connect(_0x2e2ef9){logger[_0xdf70('0x15')](util[_0xdf70('0xb')](_0xdf70('0x16'),config[_0xdf70('0x4')][_0xdf70('0x5')],config[_0xdf70('0x4')]['ip'],config[_0xdf70('0x4')][_0xdf70('0x3')]));ami[_0xdf70('0x17')]('error',error);ami[_0xdf70('0x17')](_0xdf70('0x18'),close);}ami['on'](_0xdf70('0x19'),connect);ami['on'](_0xdf70('0x1a'),function(_0x2fa145){logger[_0xdf70('0x15')](util[_0xdf70('0xb')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0xdf70('0x4')]['ip'],config['asterisk']['port'],util['inspect'](_0x2fa145,![],null)));});ami['on'](_0xdf70('0x1b'),function(_0x59543d){logger[_0xdf70('0x15')](util['format'](_0xdf70('0x1c'),config['asterisk'][_0xdf70('0x5')],config['asterisk']['ip'],config[_0xdf70('0x4')][_0xdf70('0x3')]));return BPromise[_0xdf70('0x1d')]()['then'](ami[_0xdf70('0xe')]())[_0xdf70('0x1e')](ami[_0xdf70('0x10')]())[_0xdf70('0x1e')](ami[_0xdf70('0x1f')]())['then'](ami['actionQueueSummary']())[_0xdf70('0x1e')](ami[_0xdf70('0x13')]())[_0xdf70('0x20')](function(_0x5c4d1c){console['log'](_0x5c4d1c);});});ami[_0xdf70('0x17')](_0xdf70('0xa'),error);ami[_0xdf70('0x17')]('close',close);module[_0xdf70('0x21')]=ami; \ No newline at end of file +var _0xa01f=['actionSipPeerStatus','sippeerstatus','actionQueueSummary','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipShowRegistry','catch','exports','bluebird','moment','util','lodash','../../config/logger','../../config/environment','asterisk','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','error','port','sipshowregistry','actionDeviceStateList','devicestatelist'];(function(_0xbb33c8,_0x1527f3){var _0x559b75=function(_0xbdb532){while(--_0xbdb532){_0xbb33c8['push'](_0xbb33c8['shift']());}};_0x559b75(++_0x1527f3);}(_0xa01f,0x11e));var _0xfa01=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xa01f[_0xb0f7c3];return _0x28ea68;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xfa01('0x0'));var moment=require(_0xfa01('0x1'));var util=require(_0xfa01('0x2'));var _=require(_0xfa01('0x3'));var logger=require(_0xfa01('0x4'))('ami');var config=require(_0xfa01('0x5'));var ami=new Manager(config[_0xfa01('0x6')]['port'],config[_0xfa01('0x6')]['ip'],config['asterisk']['username'],config['asterisk']['password'],!![]);ami[_0xfa01('0x7')]();ami[_0xfa01('0x8')]=BPromise[_0xfa01('0x9')](ami[_0xfa01('0xa')]);function error(_0x47c762){logger['error'](util[_0xfa01('0xb')](_0xfa01('0xc'),config[_0xfa01('0x6')][_0xfa01('0xd')],config[_0xfa01('0x6')]['ip'],config[_0xfa01('0x6')]['port'],util[_0xfa01('0xe')](_0x47c762,![],null)));}function close(){logger[_0xfa01('0xf')](util[_0xfa01('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xfa01('0x6')][_0xfa01('0xd')],config['asterisk']['ip'],config[_0xfa01('0x6')][_0xfa01('0x10')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0xfa01('0x11')});};};ami[_0xfa01('0x12')]=function(){return function(){return ami[_0xfa01('0x8')]({'action':_0xfa01('0x13')});};};ami[_0xfa01('0x14')]=function(){return function(){return ami[_0xfa01('0x8')]({'action':_0xfa01('0x15')});};};ami[_0xfa01('0x16')]=function(){return function(){return ami[_0xfa01('0x8')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xfa01('0x8')]({'action':'coreshowchannels'});};};function connect(_0x27859e){logger[_0xfa01('0x17')](util[_0xfa01('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xfa01('0x6')][_0xfa01('0xd')],config[_0xfa01('0x6')]['ip'],config[_0xfa01('0x6')][_0xfa01('0x10')]));ami['once'](_0xfa01('0xf'),error);ami[_0xfa01('0x18')](_0xfa01('0x19'),close);}ami['on'](_0xfa01('0x1a'),connect);ami['on']('shutdown',function(_0x4fe67f){logger[_0xfa01('0x17')](util['format'](_0xfa01('0x1b'),config['asterisk'][_0xfa01('0xd')],config[_0xfa01('0x6')]['ip'],config[_0xfa01('0x6')][_0xfa01('0x10')],util[_0xfa01('0xe')](_0x4fe67f,![],null)));});ami['on'](_0xfa01('0x1c'),function(_0x1f3051){logger['info'](util[_0xfa01('0xb')](_0xfa01('0x1d'),config['asterisk'][_0xfa01('0xd')],config[_0xfa01('0x6')]['ip'],config[_0xfa01('0x6')][_0xfa01('0x10')]));return BPromise['resolve']()[_0xfa01('0x1e')](ami[_0xfa01('0x1f')]())[_0xfa01('0x1e')](ami[_0xfa01('0x12')]())[_0xfa01('0x1e')](ami[_0xfa01('0x14')]())[_0xfa01('0x1e')](ami['actionQueueSummary']())[_0xfa01('0x1e')](ami['actionCoreShowChannels']())[_0xfa01('0x20')](function(_0x33e1a3){console['log'](_0x33e1a3);});});ami[_0xfa01('0x18')]('error',error);ami['once'](_0xfa01('0x19'),close);module[_0xfa01('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 76e8985..a943fd2 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 _0xc16b=['ami','Request','request','rpc','memberReport','error','catch','jayson/promise','../../config/logger'];(function(_0x124463,_0x4fb255){var _0x23a8ec=function(_0x1ed6af){while(--_0x1ed6af){_0x124463['push'](_0x124463['shift']());}};_0x23a8ec(++_0x4fb255);}(_0xc16b,0xa0));var _0xbc16=function(_0x43da03,_0x90a9f){_0x43da03=_0x43da03-0x0;var _0x117de3=_0xc16b[_0x43da03];return _0x117de3;};'use strict';var jayson=require(_0xbc16('0x0'));var BPromise=require('bluebird');var logger=require(_0xbc16('0x1'))(_0xbc16('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0xbc16('0x3')]=function(_0x2b0037,_0x2410cf){return new BPromise(function(_0x4ce72f,_0xf102e8){return client[_0xbc16('0x4')](_0x2b0037,_0x2410cf)['then'](function(_0x105b60){logger['debug'](_0xbc16('0x5'),_0xbc16('0x6'),_0x2b0037,_0x2410cf,_0x105b60);if(_0x105b60['error']){logger[_0xbc16('0x7')]('rpc','memberReport',_0x2b0037,_0x105b60[_0xbc16('0x7')]['message'],_0x2410cf);return _0xf102e8(_0x105b60[_0xbc16('0x7')]['message']);}else{return _0x4ce72f(_0x105b60['result']);}})[_0xbc16('0x8')](function(_0x5e7ff9){logger[_0xbc16('0x7')]('rpc',_0xbc16('0x6'),_0x2b0037,_0x5e7ff9,_0x2410cf);return _0xf102e8(_0x5e7ff9);});});};module['exports']=client; \ No newline at end of file +var _0xc2b2=['error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','ami','http','request','then','debug','rpc','memberReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc2b2,0xd7));var _0x2c2b=function(_0x58c986,_0x54b83c){_0x58c986=_0x58c986-0x0;var _0x3dea02=_0xc2b2[_0x58c986];return _0x3dea02;};'use strict';var jayson=require(_0x2c2b('0x0'));var BPromise=require(_0x2c2b('0x1'));var logger=require(_0x2c2b('0x2'))(_0x2c2b('0x3'));var client=jayson['client'][_0x2c2b('0x4')]({'port':0x2329});client['Request']=function(_0x33fe3b,_0x566607){return new BPromise(function(_0x18657e,_0x34cab4){return client[_0x2c2b('0x5')](_0x33fe3b,_0x566607)[_0x2c2b('0x6')](function(_0x49788a){logger[_0x2c2b('0x7')](_0x2c2b('0x8'),_0x2c2b('0x9'),_0x33fe3b,_0x566607,_0x49788a);if(_0x49788a['error']){logger[_0x2c2b('0xa')](_0x2c2b('0x8'),'memberReport',_0x33fe3b,_0x49788a[_0x2c2b('0xa')][_0x2c2b('0xb')],_0x566607);return _0x34cab4(_0x49788a[_0x2c2b('0xa')][_0x2c2b('0xb')]);}else{return _0x18657e(_0x49788a[_0x2c2b('0xc')]);}})[_0x2c2b('0xd')](function(_0x34ccec){logger[_0x2c2b('0xa')](_0x2c2b('0x8'),_0x2c2b('0x9'),_0x33fe3b,_0x34ccec,_0x566607);return _0x34cab4(_0x34ccec);});});};module[_0x2c2b('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 64346b4..c279dbc 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 _0x4ded=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','\x22%s\x22\x20<%s>','substring','dialCutDigit','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout'];(function(_0x4a4d88,_0x2be95a){var _0x479329=function(_0x37bb8e){while(--_0x37bb8e){_0x4a4d88['push'](_0x4a4d88['shift']());}};_0x479329(++_0x2be95a);}(_0x4ded,0xf3));var _0xd4de=function(_0x218071,_0x7a9c21){_0x218071=_0x218071-0x0;var _0x560737=_0x4ded[_0x218071];return _0x560737;};'use strict';var util=require(_0xd4de('0x0'));var _=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));function checkNameSurname(_0x113629,_0x8f179f,_0x23f5ba){var _0x256a8c='';if(!_[_0xd4de('0x3')](_0x8f179f)&&_0xd4de('0x4')===typeof _0x8f179f){_0x256a8c+=_0x8f179f;}if(!_['isNil'](_0x23f5ba)&&_0xd4de('0x4')===typeof _0x23f5ba){_0x256a8c+='\x20'+_0x23f5ba;}if(_0x256a8c!==''){return _0x256a8c;}return _0x113629;}function Action(_0x28661a,_0x1b9510,_0x71865e){this[_0xd4de('0x5')]=_0x28661a;this['uniqueid']=_0x71865e||undefined;this[_0xd4de('0x6')]=checkNameSurname(_0x1b9510[_0xd4de('0x7')][_0xd4de('0x8')],_0x1b9510[_0xd4de('0x7')]['firstName'],_0x1b9510[_0xd4de('0x7')][_0xd4de('0x9')]);this[_0xd4de('0xa')]=_0x1b9510[_0xd4de('0x7')]['phone'];this[_0xd4de('0xb')]=_0x28661a[_0xd4de('0x6')];this[_0xd4de('0xc')]=_0x1b9510[_0xd4de('0xc')]||![];this[_0xd4de('0xd')]=_0x28661a[_0xd4de('0xd')];this[_0xd4de('0xe')]=_0x28661a[_0xd4de('0xe')]||0x3;this['scheduledat']=_0x1b9510[_0xd4de('0xf')];this[_0xd4de('0x10')]=_0x1b9510[_0xd4de('0x10')];this[_0xd4de('0x11')]=_0x1b9510[_0xd4de('0x11')];this[_0xd4de('0x12')]=_0x1b9510[_0xd4de('0x12')];this[_0xd4de('0x13')]=_0x1b9510['countnosuchnumberretry'];this['countdropretry']=_0x1b9510['countdropretry'];this[_0xd4de('0x14')]=_0x1b9510[_0xd4de('0x14')];this[_0xd4de('0x15')]=_0x1b9510['countmachineretry'];this['countagentrejectretry']=_0x1b9510[_0xd4de('0x16')];this[_0xd4de('0x17')]=_0x1b9510[_0xd4de('0x17')];this[_0xd4de('0x18')]=_0x1b9510[_0xd4de('0x18')];this[_0xd4de('0x19')]=_0x1b9510[_0xd4de('0x19')];this['VoiceQueueId']=_0x1b9510['VoiceQueueId'];this[_0xd4de('0x1a')]=_0x1b9510['CampaignId'];this['idHopper']=_0x1b9510['id'];this[_0xd4de('0x1b')]=_0x1b9510[_0xd4de('0x7')][_0xd4de('0x1c')]||'';this[_0xd4de('0x1d')]=moment()[_0xd4de('0x1e')](_0xd4de('0x1f'));this[_0xd4de('0x20')]=_0x1b9510['callback'];this[_0xd4de('0x21')]=_0x1b9510[_0xd4de('0x21')];this[_0xd4de('0x22')]=_0x1b9510[_0xd4de('0x22')];this['recallme']=_0x1b9510[_0xd4de('0x23')];this['originatecalleridnum']='';this[_0xd4de('0x24')]='';}Action['prototype']['getCaller']=function(){return util[_0xd4de('0x1e')](_0xd4de('0x25'),this[_0xd4de('0x6')],this[_0xd4de('0x5')]['dialCutDigit']>0x0?this['number'][_0xd4de('0x26')](this[_0xd4de('0x5')][_0xd4de('0x27')]):this[_0xd4de('0xa')]);};Action[_0xd4de('0x28')][_0xd4de('0x29')]=function(){return this['queue'];};module[_0xd4de('0x2a')]=Action; \ No newline at end of file +var _0x9f85=['originatecalleridname','prototype','substring','dialCutDigit','getQueue','util','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x50027a,_0x7f0218){var _0x3fab50=function(_0x5f5a38){while(--_0x5f5a38){_0x50027a['push'](_0x50027a['shift']());}};_0x3fab50(++_0x7f0218);}(_0x9f85,0xf5));var _0x59f8=function(_0x44d3a4,_0x70eb47){_0x44d3a4=_0x44d3a4-0x0;var _0x4daead=_0x9f85[_0x44d3a4];return _0x4daead;};'use strict';var util=require(_0x59f8('0x0'));var _=require('lodash');var moment=require(_0x59f8('0x1'));function checkNameSurname(_0x42ab47,_0x3e932e,_0x225e68){var _0x3fa33b='';if(!_[_0x59f8('0x2')](_0x3e932e)&&_0x59f8('0x3')===typeof _0x3e932e){_0x3fa33b+=_0x3e932e;}if(!_[_0x59f8('0x2')](_0x225e68)&&_0x59f8('0x3')===typeof _0x225e68){_0x3fa33b+='\x20'+_0x225e68;}if(_0x3fa33b!==''){return _0x3fa33b;}return _0x42ab47;}function Action(_0x39240e,_0x947153,_0x302e45){this[_0x59f8('0x4')]=_0x39240e;this['uniqueid']=_0x302e45||undefined;this[_0x59f8('0x5')]=checkNameSurname(_0x947153[_0x59f8('0x6')][_0x59f8('0x7')],_0x947153[_0x59f8('0x6')][_0x59f8('0x8')],_0x947153[_0x59f8('0x6')][_0x59f8('0x9')]);this[_0x59f8('0xa')]=_0x947153[_0x59f8('0x6')][_0x59f8('0x7')];this[_0x59f8('0xb')]=_0x39240e[_0x59f8('0x5')];this['active']=_0x947153[_0x59f8('0xc')]||![];this[_0x59f8('0xd')]=_0x39240e[_0x59f8('0xd')];this['dialQueueTimeout']=_0x39240e[_0x59f8('0xe')]||0x3;this[_0x59f8('0xf')]=_0x947153[_0x59f8('0xf')];this['countbusyretry']=_0x947153['countbusyretry'];this[_0x59f8('0x10')]=_0x947153[_0x59f8('0x10')];this[_0x59f8('0x11')]=_0x947153[_0x59f8('0x11')];this[_0x59f8('0x12')]=_0x947153[_0x59f8('0x12')];this['countdropretry']=_0x947153['countdropretry'];this['countabandonedretry']=_0x947153[_0x59f8('0x13')];this['countmachineretry']=_0x947153[_0x59f8('0x14')];this['countagentrejectretry']=_0x947153['countagentrejectretry'];this['ContactId']=_0x947153[_0x59f8('0x15')];this[_0x59f8('0x16')]=_0x947153[_0x59f8('0x16')];this['UserId']=_0x947153[_0x59f8('0x17')];this['VoiceQueueId']=_0x947153['VoiceQueueId'];this[_0x59f8('0x18')]=_0x947153[_0x59f8('0x18')];this[_0x59f8('0x19')]=_0x947153['id'];this[_0x59f8('0x1a')]=_0x947153['Contact']['firstName']||'';this[_0x59f8('0x1b')]=moment()[_0x59f8('0x1c')](_0x59f8('0x1d'));this[_0x59f8('0x1e')]=_0x947153[_0x59f8('0x1e')];this[_0x59f8('0x1f')]=_0x947153[_0x59f8('0x1f')];this[_0x59f8('0x20')]=_0x947153[_0x59f8('0x20')];this[_0x59f8('0x21')]=_0x947153[_0x59f8('0x21')];this[_0x59f8('0x22')]='';this[_0x59f8('0x23')]='';}Action[_0x59f8('0x24')]['getCaller']=function(){return util[_0x59f8('0x1c')]('\x22%s\x22\x20<%s>',this[_0x59f8('0x5')],this[_0x59f8('0x4')]['dialCutDigit']>0x0?this[_0x59f8('0xa')][_0x59f8('0x25')](this[_0x59f8('0x4')][_0x59f8('0x26')]):this[_0x59f8('0xa')]);};Action['prototype'][_0x59f8('0x27')]=function(){return this[_0x59f8('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 6175cdb..ec1a783 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 _0x2a53=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x3ac882,_0x346301){var _0x579ade=function(_0x4b9d4b){while(--_0x4b9d4b){_0x3ac882['push'](_0x3ac882['shift']());}};_0x579ade(++_0x346301);}(_0x2a53,0xdd));var _0x32a5=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x2a53[_0x2fdce0];return _0x36f07e;};'use strict';var util=require(_0x32a5('0x0'));var _=require(_0x32a5('0x1'));var moment=require(_0x32a5('0x2'));function getSeconds(_0x3b6da3,_0x1b8c83){var _0x54b59d=moment(_0x3b6da3)[_0x32a5('0x3')](0x0);var _0x3de678=moment(_0x1b8c83)[_0x32a5('0x3')](0x0);return _0x54b59d[_0x32a5('0x4')](_0x3de678,'seconds');}function AdditionalPhone(_0x2b1ac3){this[_0x32a5('0x5')]=_0x2b1ac3[_0x32a5('0x5')];this['scheduledat']=_0x2b1ac3['scheduledat']||undefined;this[_0x32a5('0x6')]=_0x2b1ac3['type'];this['campaigntype']=_0x2b1ac3[_0x32a5('0x6')]===_0x32a5('0x7')?'queue':_0x2b1ac3[_0x32a5('0x6')];this[_0x32a5('0x8')]=_0x2b1ac3[_0x32a5('0x8')];this[_0x32a5('0x9')]=_0x2b1ac3[_0x32a5('0x9')];this[_0x32a5('0xa')]=_0x2b1ac3[_0x32a5('0xa')];this[_0x32a5('0xb')]=_0x2b1ac3[_0x32a5('0x8')]+_0x2b1ac3[_0x32a5('0x9')]+_0x2b1ac3[_0x32a5('0xa')]+_0x2b1ac3[_0x32a5('0xc')]+_0x2b1ac3[_0x32a5('0xd')]+_0x2b1ac3[_0x32a5('0xe')]+_0x2b1ac3[_0x32a5('0xf')]+_0x2b1ac3[_0x32a5('0x10')];this[_0x32a5('0xc')]=_0x2b1ac3[_0x32a5('0xc')];this[_0x32a5('0xd')]=_0x2b1ac3[_0x32a5('0xd')];this[_0x32a5('0xe')]=_0x2b1ac3['countabandonedretry'];this[_0x32a5('0xf')]=_0x2b1ac3['countmachineretry'];this[_0x32a5('0x10')]=_0x2b1ac3[_0x32a5('0x10')];this[_0x32a5('0x11')]=_0x2b1ac3[_0x32a5('0x11')];this[_0x32a5('0x12')]=_0x2b1ac3[_0x32a5('0x13')];this['calleridnum']=_0x2b1ac3[_0x32a5('0x14')];this[_0x32a5('0x15')]=_0x2b1ac3[_0x32a5('0x15')];this[_0x32a5('0x16')]=_0x2b1ac3[_0x32a5('0x16')];this[_0x32a5('0x17')]=_0x2b1ac3[_0x32a5('0x16')];this['ringtime']=getSeconds(_0x2b1ac3[_0x32a5('0x16')],_0x2b1ac3[_0x32a5('0x15')]);this['holdtime']=0x0;this[_0x32a5('0x18')]=0x0;this[_0x32a5('0x19')]=_0x2b1ac3[_0x32a5('0x19')];this[_0x32a5('0x1a')]=_0x2b1ac3[_0x32a5('0x1a')];this[_0x32a5('0x1b')]=_0x2b1ac3[_0x32a5('0x1b')];this[_0x32a5('0x1c')]=_0x2b1ac3[_0x32a5('0x1c')];this[_0x32a5('0x1d')]=_0x2b1ac3[_0x32a5('0x1d')];this[_0x32a5('0x1e')]=_0x2b1ac3['ListId'];this[_0x32a5('0x1f')]=_0x2b1ac3['UserId'];this[_0x32a5('0x20')]=_0x2b1ac3[_0x32a5('0x20')];this[_0x32a5('0x21')]=_0x2b1ac3[_0x32a5('0x21')];this[_0x32a5('0x22')]=_0x2b1ac3['originatecalleridnum']||'';this[_0x32a5('0x23')]=_0x2b1ac3[_0x32a5('0x23')]||'';}module['exports']=History; \ No newline at end of file +var _0x8000=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId'];(function(_0x24af91,_0x2b3882){var _0x13f997=function(_0x5af363){while(--_0x5af363){_0x24af91['push'](_0x24af91['shift']());}};_0x13f997(++_0x2b3882);}(_0x8000,0x12c));var _0x0800=function(_0x2d2423,_0x5ef6c){_0x2d2423=_0x2d2423-0x0;var _0x538db4=_0x8000[_0x2d2423];return _0x538db4;};'use strict';var util=require(_0x0800('0x0'));var _=require(_0x0800('0x1'));var moment=require('moment');function getSeconds(_0x207319,_0x413426){var _0x4cdcf8=moment(_0x207319)[_0x0800('0x2')](0x0);var _0x47ddc8=moment(_0x413426)[_0x0800('0x2')](0x0);return _0x4cdcf8[_0x0800('0x3')](_0x47ddc8,_0x0800('0x4'));}function AdditionalPhone(_0x34561b){this[_0x0800('0x5')]=_0x34561b[_0x0800('0x5')];this[_0x0800('0x6')]=_0x34561b[_0x0800('0x6')]||undefined;this[_0x0800('0x7')]=_0x34561b[_0x0800('0x7')];this['campaigntype']=_0x34561b[_0x0800('0x7')]===_0x0800('0x8')?'queue':_0x34561b[_0x0800('0x7')];this['countbusyretry']=_0x34561b[_0x0800('0x9')];this['countcongestionretry']=_0x34561b[_0x0800('0xa')];this[_0x0800('0xb')]=_0x34561b[_0x0800('0xb')];this[_0x0800('0xc')]=_0x34561b[_0x0800('0x9')]+_0x34561b[_0x0800('0xa')]+_0x34561b[_0x0800('0xb')]+_0x34561b[_0x0800('0xd')]+_0x34561b['countdropretry']+_0x34561b['countabandonedretry']+_0x34561b[_0x0800('0xe')]+_0x34561b[_0x0800('0xf')];this[_0x0800('0xd')]=_0x34561b[_0x0800('0xd')];this['countdropretry']=_0x34561b[_0x0800('0x10')];this[_0x0800('0x11')]=_0x34561b['countabandonedretry'];this[_0x0800('0xe')]=_0x34561b[_0x0800('0xe')];this[_0x0800('0xf')]=_0x34561b[_0x0800('0xf')];this['queue']=_0x34561b['queue'];this['calleridname']=_0x34561b[_0x0800('0x12')];this[_0x0800('0x13')]=_0x34561b[_0x0800('0x14')];this[_0x0800('0x15')]=_0x34561b[_0x0800('0x15')];this[_0x0800('0x16')]=_0x34561b[_0x0800('0x16')];this[_0x0800('0x17')]=_0x34561b[_0x0800('0x16')];this['ringtime']=getSeconds(_0x34561b['responsetime'],_0x34561b['starttime']);this[_0x0800('0x18')]=0x0;this[_0x0800('0x19')]=0x0;this[_0x0800('0x1a')]=_0x34561b[_0x0800('0x1a')];this['callbackuniqueid']=_0x34561b[_0x0800('0x1b')];this['callbackat']=_0x34561b[_0x0800('0x1c')];this['recallme']=_0x34561b[_0x0800('0x1d')];this[_0x0800('0x1e')]=_0x34561b[_0x0800('0x1e')];this['ListId']=_0x34561b['ListId'];this['UserId']=_0x34561b[_0x0800('0x1f')];this['VoiceQueueId']=_0x34561b[_0x0800('0x20')];this[_0x0800('0x21')]=_0x34561b[_0x0800('0x21')];this[_0x0800('0x22')]=_0x34561b[_0x0800('0x22')]||'';this[_0x0800('0x23')]=_0x34561b['originatecalleridname']||'';}module[_0x0800('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ac90904..82b589f 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 _0x8bbf=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x8bbf,0x15a));var _0xf8bb=function(_0x5ed956,_0x1b01fe){_0x5ed956=_0x5ed956-0x0;var _0x3ea468=_0x8bbf[_0x5ed956];return _0x3ea468;};'use strict';var util=require('util');var _=require(_0xf8bb('0x0'));var moment=require(_0xf8bb('0x1'));function getSeconds(_0x25fc86,_0x418b6b){var _0x5cab0a=moment(_0x25fc86)[_0xf8bb('0x2')](0x0);var _0x59d726=moment(_0x418b6b)[_0xf8bb('0x2')](0x0);return _0x5cab0a[_0xf8bb('0x3')](_0x59d726,_0xf8bb('0x4'));}function AgentComplete(_0x44cfe1,_0x1e6251){this[_0xf8bb('0x5')]=0x4;this[_0xf8bb('0x6')]=_0xf8bb('0x7');this[_0xf8bb('0x8')]=_0x44cfe1[_0xf8bb('0x8')];this[_0xf8bb('0x9')]=_0x44cfe1[_0xf8bb('0x9')];this[_0xf8bb('0xa')]=_0x44cfe1[_0xf8bb('0x9')]===_0xf8bb('0xb')?_0xf8bb('0xc'):_0x44cfe1[_0xf8bb('0x9')];this[_0xf8bb('0xd')]=_0x44cfe1[_0xf8bb('0xd')];this['countcongestionretry']=_0x44cfe1[_0xf8bb('0xe')];this[_0xf8bb('0xf')]=_0x44cfe1[_0xf8bb('0xf')];this['countglobal']=_0x44cfe1[_0xf8bb('0xd')]+_0x44cfe1[_0xf8bb('0xe')]+_0x44cfe1['countnoanswerretry']+_0x44cfe1[_0xf8bb('0x10')]+_0x44cfe1[_0xf8bb('0x11')]+_0x44cfe1[_0xf8bb('0x12')]+_0x44cfe1[_0xf8bb('0x13')]+_0x44cfe1[_0xf8bb('0x14')];this[_0xf8bb('0x10')]=_0x44cfe1[_0xf8bb('0x10')];this[_0xf8bb('0x11')]=_0x44cfe1['countdropretry'];this[_0xf8bb('0x12')]=_0x44cfe1[_0xf8bb('0x12')];this[_0xf8bb('0x13')]=_0x44cfe1[_0xf8bb('0x13')];this['countagentrejectretry']=_0x44cfe1[_0xf8bb('0x14')];this[_0xf8bb('0x15')]=_0x1e6251[_0xf8bb('0x15')];this['calleridname']=_0x44cfe1[_0xf8bb('0x16')];this[_0xf8bb('0x17')]=_0x44cfe1[_0xf8bb('0x18')];this[_0xf8bb('0x19')]=_0x44cfe1['starttime'];this[_0xf8bb('0x1a')]=_0x44cfe1['responsetime'];this[_0xf8bb('0x1b')]=_0x44cfe1['answertime'];this[_0xf8bb('0x1c')]=moment()[_0xf8bb('0x1d')](_0xf8bb('0x1e'));this[_0xf8bb('0x1f')]=getSeconds(_0x44cfe1[_0xf8bb('0x1a')],_0x44cfe1[_0xf8bb('0x19')]);this[_0xf8bb('0x20')]=getSeconds(_0x44cfe1[_0xf8bb('0x1b')],_0x44cfe1[_0xf8bb('0x1a')]);this[_0xf8bb('0x21')]=getSeconds(this['endtime'],_0x44cfe1['answertime']);this[_0xf8bb('0xc')]=_0x1e6251['queue'];this[_0xf8bb('0x22')]=_0x1e6251[_0xf8bb('0x22')];this[_0xf8bb('0x23')]=_0x1e6251[_0xf8bb('0x23')];this[_0xf8bb('0x24')]=_0x44cfe1['callback'];this[_0xf8bb('0x25')]=_0x44cfe1[_0xf8bb('0x25')];this[_0xf8bb('0x26')]=_0x44cfe1[_0xf8bb('0x26')];this['recallme']=_0x44cfe1[_0xf8bb('0x27')];this[_0xf8bb('0x28')]=_0x44cfe1[_0xf8bb('0x28')];this[_0xf8bb('0x29')]=_0x44cfe1[_0xf8bb('0x29')];this['UserId']=_0x44cfe1['UserId'];this[_0xf8bb('0x2a')]=_0x44cfe1[_0xf8bb('0x2a')];this['CampaignId']=_0x44cfe1['CampaignId'];this[_0xf8bb('0x2b')]=_0x44cfe1[_0xf8bb('0x2b')]||'';this[_0xf8bb('0x2c')]=_0x44cfe1[_0xf8bb('0x2c')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x8975=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback'];(function(_0x4de54e,_0x575fb5){var _0x2dddf1=function(_0x4c847d){while(--_0x4c847d){_0x4de54e['push'](_0x4de54e['shift']());}};_0x2dddf1(++_0x575fb5);}(_0x8975,0xeb));var _0x5897=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8975[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require('util');var _=require(_0x5897('0x0'));var moment=require(_0x5897('0x1'));function getSeconds(_0x5c38ca,_0x59145e){var _0x185d89=moment(_0x5c38ca)[_0x5897('0x2')](0x0);var _0x2235e3=moment(_0x59145e)[_0x5897('0x2')](0x0);return _0x185d89[_0x5897('0x3')](_0x2235e3,_0x5897('0x4'));}function AgentComplete(_0x5492c7,_0x3a8315){this[_0x5897('0x5')]=0x4;this[_0x5897('0x6')]='Answer';this[_0x5897('0x7')]=_0x5492c7['scheduledat'];this[_0x5897('0x8')]=_0x5492c7['type'];this[_0x5897('0x9')]=_0x5492c7[_0x5897('0x8')]===_0x5897('0xa')?'queue':_0x5492c7[_0x5897('0x8')];this['countbusyretry']=_0x5492c7[_0x5897('0xb')];this[_0x5897('0xc')]=_0x5492c7[_0x5897('0xc')];this[_0x5897('0xd')]=_0x5492c7[_0x5897('0xd')];this[_0x5897('0xe')]=_0x5492c7['countbusyretry']+_0x5492c7['countcongestionretry']+_0x5492c7[_0x5897('0xd')]+_0x5492c7[_0x5897('0xf')]+_0x5492c7[_0x5897('0x10')]+_0x5492c7[_0x5897('0x11')]+_0x5492c7[_0x5897('0x12')]+_0x5492c7[_0x5897('0x13')];this['countnosuchnumberretry']=_0x5492c7[_0x5897('0xf')];this[_0x5897('0x10')]=_0x5492c7['countdropretry'];this[_0x5897('0x11')]=_0x5492c7['countabandonedretry'];this[_0x5897('0x12')]=_0x5492c7[_0x5897('0x12')];this[_0x5897('0x13')]=_0x5492c7['countagentrejectretry'];this[_0x5897('0x14')]=_0x3a8315[_0x5897('0x14')];this['calleridname']=_0x5492c7['name'];this[_0x5897('0x15')]=_0x5492c7['number'];this['starttime']=_0x5492c7[_0x5897('0x16')];this['responsetime']=_0x5492c7[_0x5897('0x17')];this[_0x5897('0x18')]=_0x5492c7[_0x5897('0x18')];this[_0x5897('0x19')]=moment()[_0x5897('0x1a')](_0x5897('0x1b'));this[_0x5897('0x1c')]=getSeconds(_0x5492c7[_0x5897('0x17')],_0x5492c7[_0x5897('0x16')]);this[_0x5897('0x1d')]=getSeconds(_0x5492c7[_0x5897('0x18')],_0x5492c7[_0x5897('0x17')]);this[_0x5897('0x1e')]=getSeconds(this[_0x5897('0x19')],_0x5492c7[_0x5897('0x18')]);this[_0x5897('0x1f')]=_0x3a8315[_0x5897('0x1f')];this[_0x5897('0x20')]=_0x3a8315[_0x5897('0x20')];this[_0x5897('0x21')]=_0x3a8315['reason'];this[_0x5897('0x22')]=_0x5492c7['callback'];this[_0x5897('0x23')]=_0x5492c7[_0x5897('0x23')];this['callbackat']=_0x5492c7[_0x5897('0x24')];this[_0x5897('0x25')]=_0x5492c7[_0x5897('0x25')];this[_0x5897('0x26')]=_0x5492c7['ContactId'];this[_0x5897('0x27')]=_0x5492c7['ListId'];this[_0x5897('0x28')]=_0x5492c7[_0x5897('0x28')];this[_0x5897('0x29')]=_0x5492c7[_0x5897('0x29')];this[_0x5897('0x2a')]=_0x5492c7[_0x5897('0x2a')];this[_0x5897('0x2b')]=_0x5492c7[_0x5897('0x2b')]||'';this[_0x5897('0x2c')]=_0x5492c7[_0x5897('0x2c')]||'';}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 b281918..731b660 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 _0x545d=['exports','milliseconds','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x3631fc,_0x1e759d){var _0x8672a4=function(_0x723443){while(--_0x723443){_0x3631fc['push'](_0x3631fc['shift']());}};_0x8672a4(++_0x1e759d);}(_0x545d,0x15f));var _0xd545=function(_0xf9a18e,_0x55a39a){_0xf9a18e=_0xf9a18e-0x0;var _0x31f985=_0x545d[_0xf9a18e];return _0x31f985;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x3d6679,_0x3f9dc2){var _0xe14a7a=moment(_0x3d6679)[_0xd545('0x0')](0x0);var _0x2c8d40=moment(_0x3f9dc2)[_0xd545('0x0')](0x0);return _0xe14a7a['diff'](_0x2c8d40,_0xd545('0x1'));}function Final(_0xbc83f){this['uniqueid']=_0xbc83f[_0xd545('0x2')];this['scheduledat']=_0xbc83f[_0xd545('0x3')];this[_0xd545('0x4')]=_0xbc83f['type'];this['campaigntype']=_0xbc83f[_0xd545('0x4')]===_0xd545('0x5')?'queue':_0xbc83f[_0xd545('0x4')];this['countbusyretry']=_0xbc83f[_0xd545('0x6')];this['countcongestionretry']=_0xbc83f[_0xd545('0x7')];this[_0xd545('0x8')]=_0xbc83f[_0xd545('0x8')];this[_0xd545('0x9')]=_0xbc83f[_0xd545('0x6')]+_0xbc83f['countcongestionretry']+_0xbc83f[_0xd545('0x8')]+_0xbc83f['countnosuchnumberretry']+_0xbc83f[_0xd545('0xa')]+_0xbc83f[_0xd545('0xb')]+_0xbc83f[_0xd545('0xc')]+_0xbc83f[_0xd545('0xd')];this[_0xd545('0xe')]=_0xbc83f['countnosuchnumberretry'];this[_0xd545('0xa')]=_0xbc83f[_0xd545('0xa')];this['countabandonedretry']=_0xbc83f['countabandonedretry'];this['countmachineretry']=_0xbc83f['countmachineretry'];this[_0xd545('0xd')]=_0xbc83f[_0xd545('0xd')];this[_0xd545('0xf')]=_0xbc83f[_0xd545('0xf')];this[_0xd545('0x10')]=_0xbc83f[_0xd545('0x10')];this[_0xd545('0x11')]=_0xbc83f[_0xd545('0x11')];this[_0xd545('0x12')]=_0xbc83f[_0xd545('0x12')];this[_0xd545('0x13')]=_0xbc83f[_0xd545('0x13')];this[_0xd545('0x14')]=_0xbc83f[_0xd545('0x13')];this[_0xd545('0x15')]=_0xbc83f[_0xd545('0x15')]||0x0;this[_0xd545('0x16')]=_0xbc83f[_0xd545('0x16')]||0x0;this[_0xd545('0x17')]=_0xbc83f['talktime']||0x0;this[_0xd545('0x18')]=_0xbc83f[_0xd545('0x18')];this[_0xd545('0x19')]=_0xbc83f['callbackuniqueid'];this[_0xd545('0x1a')]=_0xbc83f[_0xd545('0x1a')];this[_0xd545('0x1b')]=_0xbc83f[_0xd545('0x1b')];this['ContactId']=_0xbc83f['ContactId'];this[_0xd545('0x1c')]=_0xbc83f[_0xd545('0x1c')];this[_0xd545('0x1d')]=_0xbc83f['UserId'];this[_0xd545('0x1e')]=_0xbc83f[_0xd545('0x1e')];this['CampaignId']=_0xbc83f[_0xd545('0x1f')];this[_0xd545('0x20')]=_0xbc83f['originatecalleridnum']||'';this[_0xd545('0x21')]=_0xbc83f['originatecalleridname']||'';}module[_0xd545('0x22')]=Final; \ No newline at end of file +var _0xe90d=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xe90d,0x97));var _0xde90=function(_0x5350b0,_0x52f632){_0x5350b0=_0x5350b0-0x0;var _0x486c30=_0xe90d[_0x5350b0];return _0x486c30;};'use strict';var util=require(_0xde90('0x0'));var _=require(_0xde90('0x1'));var moment=require(_0xde90('0x2'));function getSeconds(_0x15f714,_0x146cae){var _0x5f8e58=moment(_0x15f714)[_0xde90('0x3')](0x0);var _0x3c95cd=moment(_0x146cae)[_0xde90('0x3')](0x0);return _0x5f8e58['diff'](_0x3c95cd,_0xde90('0x4'));}function Final(_0x1bba9d){this[_0xde90('0x5')]=_0x1bba9d[_0xde90('0x5')];this[_0xde90('0x6')]=_0x1bba9d[_0xde90('0x6')];this[_0xde90('0x7')]=_0x1bba9d['type'];this[_0xde90('0x8')]=_0x1bba9d[_0xde90('0x7')]===_0xde90('0x9')?'queue':_0x1bba9d[_0xde90('0x7')];this[_0xde90('0xa')]=_0x1bba9d[_0xde90('0xa')];this[_0xde90('0xb')]=_0x1bba9d[_0xde90('0xb')];this['countnoanswerretry']=_0x1bba9d[_0xde90('0xc')];this['countglobal']=_0x1bba9d[_0xde90('0xa')]+_0x1bba9d[_0xde90('0xb')]+_0x1bba9d[_0xde90('0xc')]+_0x1bba9d[_0xde90('0xd')]+_0x1bba9d[_0xde90('0xe')]+_0x1bba9d[_0xde90('0xf')]+_0x1bba9d['countmachineretry']+_0x1bba9d[_0xde90('0x10')];this[_0xde90('0xd')]=_0x1bba9d[_0xde90('0xd')];this[_0xde90('0xe')]=_0x1bba9d[_0xde90('0xe')];this['countabandonedretry']=_0x1bba9d['countabandonedretry'];this['countmachineretry']=_0x1bba9d[_0xde90('0x11')];this[_0xde90('0x10')]=_0x1bba9d['countagentrejectretry'];this[_0xde90('0x12')]=_0x1bba9d[_0xde90('0x12')];this['calleridname']=_0x1bba9d[_0xde90('0x13')];this[_0xde90('0x14')]=_0x1bba9d[_0xde90('0x14')];this['starttime']=_0x1bba9d['starttime'];this[_0xde90('0x15')]=_0x1bba9d['responsetime'];this['endtime']=_0x1bba9d[_0xde90('0x15')];this['ringtime']=_0x1bba9d[_0xde90('0x16')]||0x0;this[_0xde90('0x17')]=_0x1bba9d[_0xde90('0x17')]||0x0;this[_0xde90('0x18')]=_0x1bba9d[_0xde90('0x18')]||0x0;this[_0xde90('0x19')]=_0x1bba9d['callback'];this['callbackuniqueid']=_0x1bba9d[_0xde90('0x1a')];this['callbackat']=_0x1bba9d[_0xde90('0x1b')];this[_0xde90('0x1c')]=_0x1bba9d[_0xde90('0x1c')];this['ContactId']=_0x1bba9d[_0xde90('0x1d')];this[_0xde90('0x1e')]=_0x1bba9d[_0xde90('0x1e')];this[_0xde90('0x1f')]=_0x1bba9d[_0xde90('0x1f')];this[_0xde90('0x20')]=_0x1bba9d[_0xde90('0x20')];this[_0xde90('0x21')]=_0x1bba9d[_0xde90('0x21')];this[_0xde90('0x22')]=_0x1bba9d[_0xde90('0x22')]||'';this[_0xde90('0x23')]=_0x1bba9d['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 6f2ff5c..2886a53 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 _0x7563=['cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason'];(function(_0x940e2d,_0x119060){var _0x4e2acd=function(_0x4f3c07){while(--_0x4f3c07){_0x940e2d['push'](_0x940e2d['shift']());}};_0x4e2acd(++_0x119060);}(_0x7563,0x1ed));var _0x3756=function(_0x5d0354,_0x4cfec4){_0x5d0354=_0x5d0354-0x0;var _0x367575=_0x7563[_0x5d0354];return _0x367575;};'use strict';var util=require('util');var _=require(_0x3756('0x0'));var moment=require(_0x3756('0x1'));function getSeconds(_0x2e1cf1,_0x2dfeed){var _0x2f8199=moment(_0x2e1cf1)[_0x3756('0x2')](0x0);var _0x2ea24c=moment(_0x2dfeed)[_0x3756('0x2')](0x0);return _0x2f8199[_0x3756('0x3')](_0x2ea24c,_0x3756('0x4'));}function Hangup(_0xf5ae6e,_0x2a83a2){this[_0x3756('0x5')]=0x4;this[_0x3756('0x6')]='Answer';this[_0x3756('0x7')]=_0xf5ae6e[_0x3756('0x7')];this[_0x3756('0x8')]=_0xf5ae6e[_0x3756('0x8')];this['campaigntype']=_0xf5ae6e[_0x3756('0x8')]===_0x3756('0x9')?_0x3756('0xa'):_0xf5ae6e[_0x3756('0x8')];this[_0x3756('0xb')]=_0xf5ae6e[_0x3756('0xb')];this[_0x3756('0xc')]=_0xf5ae6e[_0x3756('0xc')];this[_0x3756('0xd')]=_0xf5ae6e[_0x3756('0xd')];this[_0x3756('0xe')]=_0xf5ae6e[_0x3756('0xb')]+_0xf5ae6e['countcongestionretry']+_0xf5ae6e[_0x3756('0xd')]+_0xf5ae6e[_0x3756('0xf')]+_0xf5ae6e[_0x3756('0x10')]+_0xf5ae6e[_0x3756('0x11')]+_0xf5ae6e[_0x3756('0x12')]+_0xf5ae6e[_0x3756('0x13')];this[_0x3756('0xf')]=_0xf5ae6e['countnosuchnumberretry'];this['countdropretry']=_0xf5ae6e['countdropretry'];this['countabandonedretry']=_0xf5ae6e[_0x3756('0x11')];this[_0x3756('0x12')]=_0xf5ae6e['countmachineretry'];this['countagentrejectretry']=_0xf5ae6e[_0x3756('0x13')];this[_0x3756('0x14')]=_0x2a83a2[_0x3756('0x14')];this[_0x3756('0x15')]=_0xf5ae6e[_0x3756('0x16')];this['calleridnum']=_0xf5ae6e[_0x3756('0x17')];this[_0x3756('0x18')]=_0xf5ae6e[_0x3756('0x18')];this[_0x3756('0x19')]=_0xf5ae6e[_0x3756('0x19')];this[_0x3756('0x1a')]=moment()[_0x3756('0x1b')](_0x3756('0x1c'));this[_0x3756('0x1d')]=getSeconds(_0xf5ae6e[_0x3756('0x19')],_0xf5ae6e[_0x3756('0x18')]);this[_0x3756('0x1e')]=0x0;this[_0x3756('0x1f')]=getSeconds(this[_0x3756('0x1a')],_0xf5ae6e[_0x3756('0x19')]);this['queue']=_0xf5ae6e[_0x3756('0xa')];this[_0x3756('0x20')]=_0x3756('0x21');this[_0x3756('0x22')]=_0x2a83a2[_0x3756('0x23')];this['callback']=_0xf5ae6e['callback'];this[_0x3756('0x24')]=_0xf5ae6e[_0x3756('0x24')];this[_0x3756('0x25')]=_0xf5ae6e[_0x3756('0x25')];this[_0x3756('0x26')]=_0xf5ae6e[_0x3756('0x26')];this[_0x3756('0x27')]=_0xf5ae6e['ContactId'];this[_0x3756('0x28')]=_0xf5ae6e[_0x3756('0x28')];this['UserId']=_0xf5ae6e[_0x3756('0x29')];this['VoiceQueueId']=_0xf5ae6e['VoiceQueueId'];this[_0x3756('0x2a')]=_0xf5ae6e['CampaignId'];}module[_0x3756('0x2b')]=Hangup; \ No newline at end of file +var _0x5472=['diff','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','CampaignId','lodash','moment','milliseconds'];(function(_0x2ae1ca,_0x23aa0b){var _0x1f82ad=function(_0x46474f){while(--_0x46474f){_0x2ae1ca['push'](_0x2ae1ca['shift']());}};_0x1f82ad(++_0x23aa0b);}(_0x5472,0x7b));var _0x2547=function(_0x708c47,_0x6eaa1f){_0x708c47=_0x708c47-0x0;var _0x52a470=_0x5472[_0x708c47];return _0x52a470;};'use strict';var util=require('util');var _=require(_0x2547('0x0'));var moment=require(_0x2547('0x1'));function getSeconds(_0x3650c4,_0x1ab408){var _0x5f5a81=moment(_0x3650c4)[_0x2547('0x2')](0x0);var _0x286916=moment(_0x1ab408)[_0x2547('0x2')](0x0);return _0x5f5a81[_0x2547('0x3')](_0x286916,'seconds');}function Hangup(_0x55c5b5,_0x442b57){this[_0x2547('0x4')]=0x4;this[_0x2547('0x5')]='Answer';this[_0x2547('0x6')]=_0x55c5b5[_0x2547('0x6')];this[_0x2547('0x7')]=_0x55c5b5[_0x2547('0x7')];this[_0x2547('0x8')]=_0x55c5b5['type']===_0x2547('0x9')?_0x2547('0xa'):_0x55c5b5[_0x2547('0x7')];this[_0x2547('0xb')]=_0x55c5b5[_0x2547('0xb')];this[_0x2547('0xc')]=_0x55c5b5[_0x2547('0xc')];this['countnoanswerretry']=_0x55c5b5[_0x2547('0xd')];this[_0x2547('0xe')]=_0x55c5b5['countbusyretry']+_0x55c5b5['countcongestionretry']+_0x55c5b5[_0x2547('0xd')]+_0x55c5b5['countnosuchnumberretry']+_0x55c5b5[_0x2547('0xf')]+_0x55c5b5[_0x2547('0x10')]+_0x55c5b5[_0x2547('0x11')]+_0x55c5b5['countagentrejectretry'];this[_0x2547('0x12')]=_0x55c5b5[_0x2547('0x12')];this[_0x2547('0xf')]=_0x55c5b5[_0x2547('0xf')];this[_0x2547('0x10')]=_0x55c5b5[_0x2547('0x10')];this[_0x2547('0x11')]=_0x55c5b5[_0x2547('0x11')];this[_0x2547('0x13')]=_0x55c5b5[_0x2547('0x13')];this['uniqueid']=_0x442b57[_0x2547('0x14')];this[_0x2547('0x15')]=_0x55c5b5[_0x2547('0x16')];this[_0x2547('0x17')]=_0x55c5b5[_0x2547('0x18')];this['starttime']=_0x55c5b5[_0x2547('0x19')];this[_0x2547('0x1a')]=_0x55c5b5['responsetime'];this['endtime']=moment()[_0x2547('0x1b')](_0x2547('0x1c'));this[_0x2547('0x1d')]=getSeconds(_0x55c5b5['responsetime'],_0x55c5b5[_0x2547('0x19')]);this[_0x2547('0x1e')]=0x0;this[_0x2547('0x1f')]=getSeconds(this['endtime'],_0x55c5b5['responsetime']);this[_0x2547('0xa')]=_0x55c5b5[_0x2547('0xa')];this[_0x2547('0x20')]=_0x2547('0x21');this[_0x2547('0x22')]=_0x442b57['cause-txt'];this[_0x2547('0x23')]=_0x55c5b5[_0x2547('0x23')];this[_0x2547('0x24')]=_0x55c5b5[_0x2547('0x24')];this['callbackat']=_0x55c5b5['callbackat'];this[_0x2547('0x25')]=_0x55c5b5['recallme'];this['ContactId']=_0x55c5b5[_0x2547('0x26')];this[_0x2547('0x27')]=_0x55c5b5['ListId'];this[_0x2547('0x28')]=_0x55c5b5[_0x2547('0x28')];this['VoiceQueueId']=_0x55c5b5['VoiceQueueId'];this[_0x2547('0x29')]=_0x55c5b5['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 2f7933d..125dcab 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 _0x5f1e=['originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x4c7d35,_0x7cb01c){var _0x3f1900=function(_0x4e163b){while(--_0x4e163b){_0x4c7d35['push'](_0x4c7d35['shift']());}};_0x3f1900(++_0x7cb01c);}(_0x5f1e,0x71));var _0xe5f1=function(_0x45f40c,_0x764558){_0x45f40c=_0x45f40c-0x0;var _0x8c6176=_0x5f1e[_0x45f40c];return _0x8c6176;};'use strict';var util=require('util');var _=require(_0xe5f1('0x0'));var moment=require(_0xe5f1('0x1'));function getSeconds(_0x4a2fa5,_0x4dbfb1){var _0x801782=moment(_0x4a2fa5)['milliseconds'](0x0);var _0x1b9f70=moment(_0x4dbfb1)[_0xe5f1('0x2')](0x0);return _0x801782[_0xe5f1('0x3')](_0x1b9f70,_0xe5f1('0x4'));}function History(_0xe57929){this['uniqueid']=_0xe57929['uniqueid'];this['scheduledat']=_0xe57929['scheduledat']||undefined;this[_0xe5f1('0x5')]=_0xe57929[_0xe5f1('0x5')];this[_0xe5f1('0x6')]=_0xe57929['type']===_0xe5f1('0x7')?_0xe5f1('0x8'):_0xe57929['type'];this['countbusyretry']=_0xe57929[_0xe5f1('0x9')];this[_0xe5f1('0xa')]=_0xe57929[_0xe5f1('0xa')];this[_0xe5f1('0xb')]=_0xe57929['countnoanswerretry'];this[_0xe5f1('0xc')]=_0xe57929[_0xe5f1('0x9')]+_0xe57929[_0xe5f1('0xa')]+_0xe57929[_0xe5f1('0xb')]+_0xe57929[_0xe5f1('0xd')]+_0xe57929[_0xe5f1('0xe')]+_0xe57929[_0xe5f1('0xf')]+_0xe57929[_0xe5f1('0x10')]+_0xe57929[_0xe5f1('0x11')];this[_0xe5f1('0xd')]=_0xe57929[_0xe5f1('0xd')];this['countdropretry']=_0xe57929['countdropretry'];this[_0xe5f1('0xf')]=_0xe57929['countabandonedretry'];this[_0xe5f1('0x10')]=_0xe57929[_0xe5f1('0x10')];this[_0xe5f1('0x11')]=_0xe57929[_0xe5f1('0x11')];this[_0xe5f1('0x8')]=_0xe57929[_0xe5f1('0x8')];this[_0xe5f1('0x12')]=_0xe57929[_0xe5f1('0x13')];this['calleridnum']=_0xe57929[_0xe5f1('0x14')];this['starttime']=_0xe57929['starttime'];this[_0xe5f1('0x15')]=_0xe57929[_0xe5f1('0x15')];this[_0xe5f1('0x16')]=_0xe57929[_0xe5f1('0x15')];this[_0xe5f1('0x17')]=getSeconds(_0xe57929[_0xe5f1('0x15')],_0xe57929['starttime']);this['holdtime']=0x0;this[_0xe5f1('0x18')]=0x0;this[_0xe5f1('0x19')]=_0xe57929[_0xe5f1('0x19')];this[_0xe5f1('0x1a')]=_0xe57929[_0xe5f1('0x1a')];this[_0xe5f1('0x1b')]=_0xe57929[_0xe5f1('0x1b')];this[_0xe5f1('0x1c')]=_0xe57929[_0xe5f1('0x1c')];this[_0xe5f1('0x1d')]=_0xe57929['ContactId'];this['ListId']=_0xe57929[_0xe5f1('0x1e')];this[_0xe5f1('0x1f')]=_0xe57929[_0xe5f1('0x1f')];this[_0xe5f1('0x20')]=_0xe57929[_0xe5f1('0x20')];this[_0xe5f1('0x21')]=_0xe57929[_0xe5f1('0x21')];this[_0xe5f1('0x22')]=_0xe57929[_0xe5f1('0x22')]||'';this['originatecalleridname']=_0xe57929[_0xe5f1('0x23')]||'';}module[_0xe5f1('0x24')]=History; \ No newline at end of file +var _0x78f4=['countmachineretry','calleridnum','number','responsetime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x78f4,0x193));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x478f('0x0'));function getSeconds(_0x4a4d67,_0x104b99){var _0x5ccd95=moment(_0x4a4d67)[_0x478f('0x1')](0x0);var _0x198b15=moment(_0x104b99)['milliseconds'](0x0);return _0x5ccd95['diff'](_0x198b15,_0x478f('0x2'));}function History(_0xd697b){this[_0x478f('0x3')]=_0xd697b[_0x478f('0x3')];this[_0x478f('0x4')]=_0xd697b[_0x478f('0x4')]||undefined;this['type']=_0xd697b[_0x478f('0x5')];this[_0x478f('0x6')]=_0xd697b['type']===_0x478f('0x7')?_0x478f('0x8'):_0xd697b['type'];this[_0x478f('0x9')]=_0xd697b[_0x478f('0x9')];this[_0x478f('0xa')]=_0xd697b[_0x478f('0xa')];this[_0x478f('0xb')]=_0xd697b[_0x478f('0xb')];this[_0x478f('0xc')]=_0xd697b[_0x478f('0x9')]+_0xd697b['countcongestionretry']+_0xd697b[_0x478f('0xb')]+_0xd697b[_0x478f('0xd')]+_0xd697b[_0x478f('0xe')]+_0xd697b[_0x478f('0xf')]+_0xd697b['countmachineretry']+_0xd697b[_0x478f('0x10')];this['countnosuchnumberretry']=_0xd697b[_0x478f('0xd')];this[_0x478f('0xe')]=_0xd697b[_0x478f('0xe')];this[_0x478f('0xf')]=_0xd697b[_0x478f('0xf')];this[_0x478f('0x11')]=_0xd697b[_0x478f('0x11')];this[_0x478f('0x10')]=_0xd697b[_0x478f('0x10')];this[_0x478f('0x8')]=_0xd697b['queue'];this['calleridname']=_0xd697b['name'];this[_0x478f('0x12')]=_0xd697b[_0x478f('0x13')];this['starttime']=_0xd697b['starttime'];this[_0x478f('0x14')]=_0xd697b[_0x478f('0x14')];this['endtime']=_0xd697b[_0x478f('0x14')];this['ringtime']=getSeconds(_0xd697b[_0x478f('0x14')],_0xd697b[_0x478f('0x15')]);this[_0x478f('0x16')]=0x0;this[_0x478f('0x17')]=0x0;this[_0x478f('0x18')]=_0xd697b[_0x478f('0x18')];this[_0x478f('0x19')]=_0xd697b[_0x478f('0x19')];this[_0x478f('0x1a')]=_0xd697b[_0x478f('0x1a')];this[_0x478f('0x1b')]=_0xd697b[_0x478f('0x1b')];this[_0x478f('0x1c')]=_0xd697b[_0x478f('0x1c')];this[_0x478f('0x1d')]=_0xd697b[_0x478f('0x1d')];this[_0x478f('0x1e')]=_0xd697b['UserId'];this['VoiceQueueId']=_0xd697b['VoiceQueueId'];this[_0x478f('0x1f')]=_0xd697b[_0x478f('0x1f')];this[_0x478f('0x20')]=_0xd697b[_0x478f('0x20')]||'';this[_0x478f('0x21')]=_0xd697b[_0x478f('0x21')]||'';}module[_0x478f('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 36bbc74..72f6335 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 _0xc69d=['inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','talking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','sendMessageOneNotActive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','prototype','clearZombieChannels','actions','[actions]','enqueue','status','channel','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','catch','[countReScheduled]\x20','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','updateOriginated','notFound','saveInDb','pick','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','unmonitored','syncVarSet','uniqueid','isNil','variable','exten','value','HANGUP','statedesc','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','[rescheduleContact][Machine]','dialAMDActive','HangupInAMD','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ContactId','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','finally','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','progressive','handlePower','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialMethod','dialActive','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','trim','dialCutDigit','substring','xcally-motion-dialer','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','preview','log','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RECALLFAILEDTIMEOUT','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','loggerHandler','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\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','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','agentconnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','type','answered','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','callerid','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc69d,0x18d));var _0xdc69=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0xc69d[_0x4b2251];return _0x5d22fb;};'use strict';var util=require(_0xdc69('0x0'));var _=require(_0xdc69('0x1'));var BPromise=require(_0xdc69('0x2'));var uuid=require(_0xdc69('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xdc69('0x4'));var Redis=require(_0xdc69('0x5'));var ut=require('../preview/util/util');var config=require(_0xdc69('0x6'));var logger=require(_0xdc69('0x7'))(_0xdc69('0x8'));var loggerBooked=require(_0xdc69('0x7'))(_0xdc69('0x9'));var loggerPredictive=require('../../../config/logger')(_0xdc69('0xa'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0xdc69('0x7'))(_0xdc69('0xb'));var ami=require(_0xdc69('0xc'));config[_0xdc69('0xd')]=_[_0xdc69('0xe')](config[_0xdc69('0xd')],{'host':_0xdc69('0xf'),'port':0x18eb});var io=require(_0xdc69('0x10'))(new Redis(config['redis']));var cmHopper=require(_0xdc69('0x11'));var cmHopperFinal=require(_0xdc69('0x12'));var cmHopperHistory=require(_0xdc69('0x13'));var cmHopperBlack=require(_0xdc69('0x14'));var voiceQueueRt=require(_0xdc69('0x15'));var Action=require(_0xdc69('0x16'));var History=require('./history');var Final=require(_0xdc69('0x17'));var AgentComplete=require(_0xdc69('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xdc69('0x19'));var ipAgi=process[_0xdc69('0x1a')][_0xdc69('0x1b')]||_0xdc69('0x1c');var strategy={'rrmemory':_0xdc69('0x1d'),'roundrobin':_0xdc69('0x1e')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x4829e2){this[_0xdc69('0x1f')]=this[_0xdc69('0x1f')]?this[_0xdc69('0x1f')]['finally'](_0x4829e2):_0x4829e2();};function Dialer(_0x3b89b1,_0x5647f2){this[_0xdc69('0x20')]=new Sequence();this['preview']=_0x5647f2;this[_0xdc69('0x21')]=_0x3b89b1[_0xdc69('0x21')];this[_0xdc69('0x22')]=_0x3b89b1['campaigns'];this[_0xdc69('0x23')]=_0x3b89b1[_0xdc69('0x23')];this[_0xdc69('0x24')]=_0x3b89b1[_0xdc69('0x24')];this[_0xdc69('0x25')]=config[_0xdc69('0x25')]||0x2;this[_0xdc69('0x26')]={};this['actions']={};this[_0xdc69('0x27')]={};this[_0xdc69('0x28')]={};this[_0xdc69('0x29')]={};this[_0xdc69('0x2a')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xdc69('0x2b')]={};this['queueBookedRR']={};ami['on'](_0xdc69('0x2c'),this['syncAgentConnect']['bind'](this));ami['on'](_0xdc69('0x2d'),this['syncQueueCallerAbandon'][_0xdc69('0x2e')](this));ami['on'](_0xdc69('0x2f'),this[_0xdc69('0x30')]['bind'](this));ami['on']('agentcomplete',this[_0xdc69('0x31')][_0xdc69('0x2e')](this));ami['on'](_0xdc69('0x32'),this[_0xdc69('0xb')]['bind'](this));ami['on'](_0xdc69('0x33'),this[_0xdc69('0x34')][_0xdc69('0x2e')](this));ami['on'](_0xdc69('0x35'),this[_0xdc69('0x36')][_0xdc69('0x2e')](this));ami['on'](_0xdc69('0x37'),this['syncVarSet'][_0xdc69('0x2e')](this));ami['on'](_0xdc69('0x38'),this[_0xdc69('0x39')][_0xdc69('0x2e')](this));ami['on'](_0xdc69('0x3a'),this[_0xdc69('0x3b')][_0xdc69('0x2e')](this));this[_0xdc69('0x3c')]();this[_0xdc69('0x3d')]();}function isNotNull(_0x16e3b8){return _0x16e3b8!==null&&!_['isUndefined'](_0x16e3b8);}function checkIsLoggedIn(_0x58b27b,_0x2bb629){return function(){if(_0x2bb629<=0x0){_0x58b27b['message']=_0xdc69('0x3e');throw _0x58b27b[_0xdc69('0x3f')]+_0xdc69('0x40');}};}function isActive(_0x266af5){return _0x266af5;}function checkIsActive(_0xe9c0ae,_0x411178){return function(){if(!isActive(_0x411178)){_0xe9c0ae[_0xdc69('0x41')]=_0xdc69('0x42');throw _0xe9c0ae[_0xdc69('0x3f')]+_0xdc69('0x43');}};}function checkInterval(_0x4f256b){return function(){if(!isNotNull(_0x4f256b['Interval'])){_0x4f256b[_0xdc69('0x41')]=_0xdc69('0x44');throw _0x4f256b['name']+_0xdc69('0x45');}if(!isNotNull(_0x4f256b[_0xdc69('0x46')]['Intervals'])){_0x4f256b['message']=_0xdc69('0x44');throw _0x4f256b[_0xdc69('0x3f')]+_0xdc69('0x45');}if(!isNotNull(_[_0xdc69('0x47')](_0x4f256b[_0xdc69('0x46')][_0xdc69('0x48')]))){_0x4f256b['message']='INTERVAL_IS_NULL';throw _0x4f256b[_0xdc69('0x3f')]+_0xdc69('0x45');}};}function msgResponse(_0x3433a1,_0x59c32a,_0xb1eccc){return{'action':_0x3433a1,'response':_0x59c32a,'message':_0xb1eccc,'stack':_0xb1eccc};}function myreject(_0x1a1b95){return function(_0x138f12){return _0x1a1b95(msgResponse(_0xdc69('0x49'),_0xdc69('0x4a'),JSON[_0xdc69('0x4b')](_0x138f12)));};}function getSeconds(_0x4bc89d,_0x51b5d7){var _0x4acf45=moment(_0x4bc89d)[_0xdc69('0x4c')](0x0);var _0x55ad38=moment(_0x51b5d7)[_0xdc69('0x4c')](0x0);return _0x4acf45[_0xdc69('0x4d')](_0x55ad38,'seconds');}function emit(_0x2d68bb,_0x340ab0,_0x5ea128){io['to'](_0x2d68bb)['emit'](_0x340ab0,_0x5ea128);}function emitVoiceQueueSummary(_0x2621df){if(_0x2621df[_0xdc69('0x4e')]==='outbound'){var _0x73f4bc={'id':_0x2621df['id'],'name':_0x2621df[_0xdc69('0x3f')],'strategy':_0x2621df['strategy'],'answered':_0x2621df[_0xdc69('0x4f')],'available':_0x2621df['available'],'loggedIn':_0x2621df[_0xdc69('0x50')],'pTalking':_0x2621df[_0xdc69('0x51')],'sumBillable':_0x2621df['sumBillable'],'sumDuration':_0x2621df[_0xdc69('0x52')],'sumHoldTime':_0x2621df[_0xdc69('0x53')]||0x0,'talking':_0x2621df['talking'],'total':_0x2621df[_0xdc69('0x54')],'type':_0x2621df[_0xdc69('0x4e')],'unmanaged':_0x2621df[_0xdc69('0x55')],'abandoned':_0x2621df[_0xdc69('0x56')],'waiting':_0x2621df['waiting'],'loggedInDb':_0x2621df[_0xdc69('0x57')],'dialActive':_0x2621df['dialActive'],'dialMethod':_0x2621df['dialMethod'],'dialOriginateCallerIdName':_0x2621df['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2621df[_0xdc69('0x58')],'dialOriginateTimeout':_0x2621df[_0xdc69('0x59')],'dialPrefix':_0x2621df['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2621df[_0xdc69('0x5a')],'outboundAnswerCallsDay':_0x2621df[_0xdc69('0x5b')],'outboundBlacklistCallsDay':_0x2621df[_0xdc69('0x5c')],'outboundBusyCallsDay':_0x2621df['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2621df['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2621df[_0xdc69('0x5d')],'outboundDropCallsDayCallersExit':_0x2621df[_0xdc69('0x5e')],'outboundDropCallsDayTimeout':_0x2621df[_0xdc69('0x5f')],'outboundNoAnswerCallsDay':_0x2621df[_0xdc69('0x60')],'outboundNoSuchCallsDay':_0x2621df[_0xdc69('0x61')],'outboundOriginateFailureCallsDay':_0x2621df[_0xdc69('0x62')],'outboundReCallsDay':_0x2621df['outboundReCallsDay'],'outboundRejectCallsDay':_0x2621df['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2621df[_0xdc69('0x63')],'predictiveIntervalAnsweredCalls':_0x2621df[_0xdc69('0x64')],'predictiveIntervalAvgHoldtime':_0x2621df[_0xdc69('0x65')],'predictiveIntervalAvgTalktime':_0x2621df[_0xdc69('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x2621df[_0xdc69('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x2621df[_0xdc69('0x68')],'predictiveIntervalErlangCalls':_0x2621df['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2621df['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2621df[_0xdc69('0x69')],'predictiveIntervalMultiplicativeFactor':_0x2621df[_0xdc69('0x6a')],'predictiveIntervalPauses':_0x2621df[_0xdc69('0x6b')],'predictiveIntervalAvailable':_0x2621df[_0xdc69('0x6c')],'predictiveIntervalTotalCalls':_0x2621df[_0xdc69('0x6d')],'message':_0x2621df[_0xdc69('0x41')],'originated':_0x2621df[_0xdc69('0x6e')],'erlangCalls':_0x2621df[_0xdc69('0x6f')],'erlangCallToSecond':_0x2621df[_0xdc69('0x70')],'erlangAbandonmentRate':_0x2621df[_0xdc69('0x71')],'erlangBusyFactor':_0x2621df['erlangBusyFactor'],'startPredictive':_0x2621df[_0xdc69('0x2a')],'startProgressive':_0x2621df[_0xdc69('0x72')]};if(_0x2621df[_0xdc69('0x73')]){_0x73f4bc[_0xdc69('0x73')]={'id':_0x2621df[_0xdc69('0x73')]['id'],'name':_0x2621df[_0xdc69('0x73')][_0xdc69('0x3f')],'active':_0x2621df[_0xdc69('0x73')]['active'],'callerid':_0x2621df[_0xdc69('0x73')][_0xdc69('0x74')]};}if(_0x2621df['Interval']){_0x73f4bc[_0xdc69('0x46')]={'id':_0x2621df['Interval']['id'],'name':_0x2621df[_0xdc69('0x46')]['name']};}var _0x887009=md5(JSON[_0xdc69('0x4b')](_0x73f4bc));if(_0x2621df[_0xdc69('0x4')]!==_0x887009){_0x2621df[_0xdc69('0x4')]=_0x887009;emit(util['format']('voice:queue:%s',_0x73f4bc['name']),'voice_queue:save',_0x73f4bc);}}}function emitCampaignSummary(_0x21c3be){if(_0x21c3be[_0xdc69('0x4e')]===_0xdc69('0x75')){emit(util['format'](_0xdc69('0x76'),_0x21c3be[_0xdc69('0x3f')]),_0xdc69('0x77'),_0x21c3be);}}function checkGetDataPredictive(_0x1ee0ef){if(isNotNull(_0x1ee0ef)){if(!_[_0xdc69('0x47')](_0x1ee0ef)){loggerPredictive[_0xdc69('0x78')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0xdc69('0x79'),_0x1ee0ef[_0xdc69('0x6d')]);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x7a'),_0x1ee0ef['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x7b'),_0x1ee0ef[_0xdc69('0x68')]);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x7c'),_0x1ee0ef[_0xdc69('0x67')]);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x7d'),_0x1ee0ef[_0xdc69('0x65')]);loggerPredictive[_0xdc69('0x78')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1ee0ef['predictiveIntervalAvgTalktime']);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x7e'));if(_0x1ee0ef[_0xdc69('0x6d')]>0x0){if(!_[_0xdc69('0x7f')](_0x1ee0ef[_0xdc69('0x66')])&&_0x1ee0ef[_0xdc69('0x66')]>0x0){return!![];}else{loggerPredictive['info'](_0xdc69('0x80'));}if(!_[_0xdc69('0x7f')](_0x1ee0ef[_0xdc69('0x65')])&&_0x1ee0ef['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0xdc69('0x78')](_0xdc69('0x81'));}}else{loggerPredictive['info'](_0xdc69('0x82'));}}else{loggerPredictive['info'](_0xdc69('0x83'));}}else{loggerPredictive[_0xdc69('0x78')](_0xdc69('0x83'));}return![];}function mergeDataErlangB(_0x3333eb){return function(_0x407cdf){loggerPredictive[_0xdc69('0x78')](_0xdc69('0x84'));loggerPredictive[_0xdc69('0x78')](_0xdc69('0x85'),_0x407cdf['erlangCalls']);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x86'),_0x407cdf[_0xdc69('0x70')]);loggerPredictive[_0xdc69('0x78')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x407cdf[_0xdc69('0x71')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x407cdf['erlangBusyFactor']);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x87'),_0x407cdf[_0xdc69('0x71')]);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x7e'));_[_0xdc69('0x88')](_0x3333eb,_0x407cdf);};}function getDiff(_0x44f5e8){var _0x3f4078=moment()[_0xdc69('0x4c')](0x0);var _0x4537ba=moment(_0x44f5e8)[_0xdc69('0x4c')](0x0);return _0x3f4078[_0xdc69('0x4d')](_0x4537ba,_0xdc69('0x89'));}function ifInterval(_0x3b6b31,_0x1c8dc0){if(_[_0xdc69('0x7f')](_0x1c8dc0)){return![];}if(getDiff(_0x1c8dc0)<_0x3b6b31*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x5a2481){if(isNotNull(_0x5a2481)){if(!_[_0xdc69('0x7f')](_0x5a2481[_0xdc69('0x72')])){_0x5a2481[_0xdc69('0x72')]=undefined;loggerPredictive[_0xdc69('0x78')](_0x5a2481[_0xdc69('0x3f')],_0xdc69('0x8a'));}if(!_[_0xdc69('0x7f')](_0x5a2481[_0xdc69('0x2a')])){_0x5a2481['startPredictive']=undefined;loggerPredictive['info'](_0x5a2481[_0xdc69('0x3f')],_0xdc69('0x8b'));}if(!_[_0xdc69('0x7f')](_0x5a2481['handlePredictive'])){clearInterval(_0x5a2481[_0xdc69('0x8c')]);_0x5a2481[_0xdc69('0x8c')]=undefined;loggerPredictive[_0xdc69('0x78')](_0x5a2481['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4596f6,_0x1b3900){if(_0x1b3900===0x0){return 0x0;}var _0x5d9d8f=0x1;for(var _0x3d80ea=0x1;_0x3d80ea<=_0x1b3900;_0x3d80ea+=0x1){_0x5d9d8f=0x1+_0x5d9d8f*_0x3d80ea/_0x4596f6;}return 0x1/_0x5d9d8f;}function isVoiceQueueOutbound(_0x4a3fec){return _0x4a3fec==='outbound';}function isNotPreview(_0x5a3312){return _0x5a3312!=='preview';}function isCampaignIvr(_0x54047a){return _0x54047a===_0xdc69('0x75');}function getCallerId(_0x118a21,_0x780443,_0x519b6f){if(!_['isUndefined'](_0x519b6f)&&'string'===typeof _0x519b6f&&!_['isEmpty'](_0x519b6f)){if(!_[_0xdc69('0x7f')](_0x780443)&&_0xdc69('0x8d')===typeof _0x780443&&!_[_0xdc69('0x47')](_0x780443)){return util['format'](_0xdc69('0x8e'),_0x780443,_0x519b6f);}return util[_0xdc69('0x8f')](_0xdc69('0x8e'),_0x519b6f,_0x519b6f);}if(!_[_0xdc69('0x7f')](_0x118a21)&&_0xdc69('0x8d')===typeof _0x118a21&&!_[_0xdc69('0x47')](_0x118a21)){return _0x118a21;}return _0xdc69('0x90');}function loggerCatchQueueSummary(_0x540abe,_0x4fce04){return function(_0x1d6984){freeVariablesPredictive(_0x4fce04);emitVoiceQueueSummary(_0x4fce04);emitCampaignSummary(_0x4fce04);loggerSyncQueueSummary[_0xdc69('0x91')](_0x540abe,util[_0xdc69('0x92')](_0x1d6984,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x212dd5,_0x4f080c){return function(_0x1f7254){loggerPredictive[_0xdc69('0x91')](_0x4f080c[_0xdc69('0x3f')],_0x212dd5);loggerPredictive[_0xdc69('0x91')](_0x1f7254['stack']);freeVariablesPredictive(_0x4f080c);};}function loggerCatch(_0x47d864){return function(_0x2737a5){logger[_0xdc69('0x91')](_0x47d864,util[_0xdc69('0x92')](_0x2737a5,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x33febd){return _0x33febd&&!_[_0xdc69('0x7f')](_0x33febd)&&_0x33febd[_0xdc69('0x93')]>0x0;}function decremetOriginate(_0x302f30){if(!_[_0xdc69('0x7f')](_0x302f30)&&_0x302f30!==null){if(_0x302f30[_0xdc69('0x94')](_0xdc69('0x6e'))){if(_0x302f30[_0xdc69('0x6e')]>0x0){_0x302f30[_0xdc69('0x6e')]-=0x1;}else{logger[_0xdc69('0x91')](_0xdc69('0x95'));}}}else{logger[_0xdc69('0x91')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x381114,_0x950480,_0xcfad53){if(_0x950480>_0xcfad53){for(var _0x5aca53=0x0;_0x5aca53<_0x950480-_0xcfad53;_0x5aca53+=0x1){decremetOriginate(_0x381114);}}}function loggerGetContactDialer(_0x7f4c3c,_0x4be0f6,_0x5203d5){return function(_0x38e8f1){checkContactLowerLimitOriginate(_0x4be0f6,_0x5203d5,0x0);logger[_0xdc69('0x91')](_0x7f4c3c,util[_0xdc69('0x92')](_0x38e8f1,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5253c6){return function(_0x1eb6e9){if(isNotNull(_0x1eb6e9)&&isNotNull(_0x1eb6e9[0x0])){if(_0x1eb6e9[0x0]['contactsRescheduled']>0x0){_0x5253c6[_0xdc69('0x41')]=_0xdc69('0x96');logger[_0xdc69('0x78')](_0xdc69('0x97')+_0x5253c6[_0xdc69('0x3f')],_0x1eb6e9[0x0]['contactsRescheduled'],_0xdc69('0x98'));}else{_0x5253c6['message']=_0xdc69('0x99');logger['info'](_0xdc69('0x9a')+_0x5253c6[_0xdc69('0x3f')]);}}};}function notSendMessagesQueue(_0x49fd79){if(_0x49fd79['sendMessageOneNotActive']){freeVariablesPredictive(_0x49fd79);if(_0x49fd79[_0xdc69('0x6e')]===0x0&&_0x49fd79[_0xdc69('0x9b')]===0x0&&_0x49fd79['waiting']===0x0&&(_0x49fd79[_0xdc69('0x51')]||0x0)===0x0){_0x49fd79['sendMessageOneNotActive']=![];_0x49fd79[_0xdc69('0x9c')]=0x0;_0x49fd79[_0xdc69('0x41')]=_0xdc69('0x42');loggerSyncQueueSummary['error'](_0xdc69('0x9d'),_0x49fd79[_0xdc69('0x3f')],_0xdc69('0x9e'));}else{_0x49fd79[_0xdc69('0x41')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xdc69('0x91')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x49fd79[_0xdc69('0x3f')],_0xdc69('0x9f'));}emitVoiceQueueSummary(_0x49fd79);}}function notSendMessagesCampaign(_0xbb38e2){if(_0xbb38e2['sendMessageOneNotActive']){if(_0xbb38e2[_0xdc69('0x6e')]===0x0){_0xbb38e2[_0xdc69('0xa0')]=![];_0xbb38e2[_0xdc69('0x41')]=_0xdc69('0x42');loggerSyncQueueSummary[_0xdc69('0x91')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xbb38e2[_0xdc69('0x3f')],_0xdc69('0x9e'));}else{_0xbb38e2[_0xdc69('0x41')]=_0xdc69('0xa1');loggerSyncQueueSummary['error'](_0xdc69('0xa2'),_0xbb38e2['name'],_0xdc69('0x9f'));}emitCampaignSummary(_0xbb38e2);}}function createObjHistory(_0x2ceac0,_0x3bb17f,_0x76cbd1,_0x24a088,_0x5e9510){_0x2ceac0[_0xdc69('0x41')]=_0x76cbd1;var _0x3cfeaa=new Action(_0x2ceac0,_0x3bb17f);var _0x3e18f7=new History(_0x3cfeaa);_0x3e18f7[_0xdc69('0xa3')]=_0x24a088;_0x3e18f7['statedesc']=_0x5e9510;_0x3e18f7[_0xdc69('0xa4')]=_0x3cfeaa[_0xdc69('0xa5')];return _0x3e18f7;}Dialer[_0xdc69('0xa6')][_0xdc69('0x3d')]=function(){var _0x38cf6a=this;setInterval(function(){_0x38cf6a[_0xdc69('0xa7')](_0x38cf6a[_0xdc69('0x28')],'[uniqueid]');_0x38cf6a[_0xdc69('0xa7')](_0x38cf6a[_0xdc69('0xa8')],_0xdc69('0xa9'));},0x32c8);};Dialer[_0xdc69('0xa6')][_0xdc69('0xa7')]=function(_0x10b57a,_0x3afb95){var _0x4d4871=this;for(var _0x4ce3a6 in _0x10b57a){if(_0x10b57a['hasOwnProperty'](_0x4ce3a6)){this[_0xdc69('0x20')][_0xdc69('0xaa')](function(){if(!_['isNil'](_0x10b57a[_0x4ce3a6])){return ami['Action']({'action':_0xdc69('0xab'),'channel':_0x10b57a[_0x4ce3a6][_0xdc69('0xac')]})['catch'](function(_0x460bd8){if(_0x460bd8['message']===_0xdc69('0xad')){setTimeout(function(){if(_0x10b57a[_0x4ce3a6]&&_0x10b57a[_0x4ce3a6][_0xdc69('0x4e')]!==_0xdc69('0x75')){_0x4d4871['updateOriginated'](_0x4d4871[_0xdc69('0x21')][_0x10b57a[_0x4ce3a6][_0xdc69('0xae')]]);logger['error'](_0xdc69('0xaf'),_0x3afb95,_0x4ce3a6,_0x10b57a[_0x4ce3a6]['queue']);delete _0x10b57a[_0x4ce3a6];}if(_0x10b57a[_0x4ce3a6]&&_0x10b57a[_0x4ce3a6][_0xdc69('0x4e')]==='ivr'){_0x4d4871['updateOriginated'](_0x4d4871['campaigns'][_0x10b57a[_0x4ce3a6][_0xdc69('0xae')]]);logger[_0xdc69('0x91')](_0xdc69('0xb0'),_0x3afb95,_0x4ce3a6,_0x10b57a[_0x4ce3a6][_0xdc69('0xae')]);delete _0x10b57a[_0x4ce3a6];}},0x2328);}});}});}}};Dialer[_0xdc69('0xa6')]['countReScheduled']=function(_0x8f23d1){return BPromise['resolve']()['then'](cmHopper[_0xdc69('0xb1')](_0x8f23d1))[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xb3')));};Dialer['prototype']['checkIsBlackList']=function(_0x4c4c30){return BPromise[_0xdc69('0xb4')]()[_0xdc69('0xb5')](cmHopperBlack[_0xdc69('0xb6')](_0x4c4c30))[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xb7')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x5572d4){return BPromise['resolve']()[_0xdc69('0xb5')](cmHopperBlack['checkIsBlackListIvr'](_0x5572d4))[_0xdc69('0xb2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xdc69('0xa6')]['averageHandleTime']=function(_0x1e68f2){return BPromise['resolve']()[_0xdc69('0xb5')](cmHopperHistory['avgHandleTime'](_0x1e68f2))['catch'](loggerCatch(_0xdc69('0xb8')));};Dialer[_0xdc69('0xa6')][_0xdc69('0xb9')]=function(_0x44e9dc){return BPromise['resolve']()[_0xdc69('0xb5')](cmHopper[_0xdc69('0xb9')](_0x44e9dc))[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xba')));};Dialer[_0xdc69('0xa6')][_0xdc69('0xbb')]=function(_0x1ac9fa,_0x282ad9,_0x173024){return BPromise[_0xdc69('0xb4')]()[_0xdc69('0xb5')](cmHopper[_0xdc69('0xbb')](_0x1ac9fa,_0x282ad9,_0x173024))[_0xdc69('0xb2')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xdc69('0xa6')]['getContactDialer']=function(_0x2fd488,_0x13bb47,_0x2c7c9e,_0x10941f){return BPromise[_0xdc69('0xb4')]()[_0xdc69('0xb5')](cmHopper[_0xdc69('0xbc')](_0x2fd488,_0x13bb47,_0x2c7c9e,_0x10941f))[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xbd')));};Dialer[_0xdc69('0xa6')]['getContactDialerIvr']=function(_0x73d9f8,_0x558618,_0x42b6e0){return BPromise[_0xdc69('0xb4')]()['then'](cmHopper[_0xdc69('0xbe')](_0x73d9f8,_0x558618,_0x42b6e0))['catch'](loggerCatch(_0xdc69('0xbd')));};Dialer[_0xdc69('0xa6')]['getVoiceQueueRtPauses']=function(_0x459603){return BPromise[_0xdc69('0xb4')]()[_0xdc69('0xb5')](voiceQueueRt[_0xdc69('0xbf')](_0x459603))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xdc69('0xa6')][_0xdc69('0xc0')]=function(_0x14e032){return BPromise['resolve']()[_0xdc69('0xb5')](cmHopper[_0xdc69('0xc0')](_0x14e032))[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xc1')));};Dialer[_0xdc69('0xa6')][_0xdc69('0xc2')]=function(_0x406789){return BPromise[_0xdc69('0xb4')]()['then'](cmHopperHistory[_0xdc69('0xc2')](_0x406789))[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xc3')));};Dialer[_0xdc69('0xa6')]['updateOriginated']=function(_0x150c5a){if(!_[_0xdc69('0x7f')](_0x150c5a)&&_0x150c5a!==null){if(_0x150c5a['hasOwnProperty'](_0xdc69('0x6e'))){if(_0x150c5a[_0xdc69('0x6e')]>0x0){_0x150c5a['originated']-=0x1;}else{logger['error'](_0xdc69('0xc4'));}}}else{logger[_0xdc69('0x91')](_0xdc69('0xc5'));}};Dialer[_0xdc69('0xa6')]['loggerHandler']=function(_0x3eca53,_0x376df9){var _0x26ffc7=this;return function(_0x1e8de4){_0x26ffc7[_0xdc69('0xc6')](_0x376df9);logger[_0xdc69('0x91')](_0x3eca53,util[_0xdc69('0x92')](_0x1e8de4,{'showHidden':![],'depth':null}));};};Dialer[_0xdc69('0xa6')]['emptyContact']=function(_0x2ed984,_0xe0e416,_0x478db9){var _0x45af27={'state':0x19,'statedesc':_0xdc69('0xc7')};this[_0xdc69('0xc6')](_0xe0e416);this[_0xdc69('0xc8')](_[_0xdc69('0x88')](_0x45af27,_[_0xdc69('0xc9')](_0x478db9,['ContactId',_0xdc69('0xca'),'UserId',_0xdc69('0xcb'),_0xdc69('0xcc')])),_0xdc69('0xcd'),_0xdc69('0xce'));logger[_0xdc69('0x91')](_0x2ed984);};Dialer[_0xdc69('0xa6')][_0xdc69('0xcf')]=function(_0x23f770){return _0x23f770===_0xdc69('0xd0');};Dialer['prototype'][_0xdc69('0xd1')]=function(_0x25a1b6){return!_[_0xdc69('0x7f')](_0x25a1b6)&&_0x25a1b6&&!_[_0xdc69('0x7f')](_0x25a1b6['name'])&&!_['isUndefined'](_0x25a1b6[_0xdc69('0xd2')])&&_0x25a1b6[_0xdc69('0xd2')]&&(this[_0xdc69('0x24')][util[_0xdc69('0x8f')](_0xdc69('0xd3'),_0x25a1b6[_0xdc69('0x3f')])][_0xdc69('0xab')]==='reachable'||this['trunks'][util[_0xdc69('0x8f')](_0xdc69('0xd3'),_0x25a1b6[_0xdc69('0x3f')])]['status']===_0xdc69('0xd4'));};Dialer[_0xdc69('0xa6')][_0xdc69('0xc8')]=function(_0x1f4e04,_0x5a3c02,_0x59ec42){this['createHistory'](_0x1f4e04)[_0xdc69('0xb2')](loggerCatch(_0x5a3c02));this[_0xdc69('0xc0')](_0x1f4e04)[_0xdc69('0xb2')](loggerCatch(_0x59ec42));};Dialer[_0xdc69('0xa6')][_0xdc69('0xd5')]=function(_0x10da23){var _0x551005=this[_0xdc69('0x28')][_0x10da23[_0xdc69('0xd6')]];var _0x539704;if(!_[_0xdc69('0xd7')](_0x10da23)&&!_[_0xdc69('0xd7')](_0x10da23[_0xdc69('0xd8')])&&!_[_0xdc69('0xd7')](_0x10da23[_0xdc69('0xd8')]['amdstatus'])&&_0x10da23[_0xdc69('0xd9')]==='xcally-motion-dialer'&&_0x551005){if(_0x551005[_0xdc69('0x4e')]!==_0xdc69('0x75')&&this['voiceQueues'][_0x551005[_0xdc69('0xae')]]['dialAMDActive']&&_0x10da23[_0xdc69('0xda')]===_0xdc69('0xdb')){delete this[_0xdc69('0x28')][_0x10da23[_0xdc69('0xd6')]];this[_0xdc69('0xc6')](this[_0xdc69('0x21')][_0x551005['queue']]);this['voiceQueues'][_0x551005[_0xdc69('0xae')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x551005['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x539704=new Hangup(_0x551005,_0x10da23);_0x539704[_0xdc69('0xa3')]=0x12;_0x539704[_0xdc69('0xdc')]='HangupInAMD';_0x539704[_0xdc69('0xdd')]='AMD';this[_0xdc69('0xc8')](_0x539704,_0xdc69('0xde'),_0xdc69('0xdf'));}if(_0x551005[_0xdc69('0x4e')]!=='ivr'&&this[_0xdc69('0x21')][_0x551005['queue']]['dialAMDActive']&&_0x10da23[_0xdc69('0xda')]===_0xdc69('0xe0')){var _0x1129ec=this;return new BPromise(function(_0x20e7ff,_0x4340a9){delete _0x1129ec[_0xdc69('0x28')][_0x10da23[_0xdc69('0xd6')]];_0x1129ec['updateOriginated'](_0x1129ec[_0xdc69('0x21')][_0x551005[_0xdc69('0xae')]]);_0x1129ec[_0xdc69('0x21')][_0x551005[_0xdc69('0xae')]][_0xdc69('0x5b')]+=0x1;_0x1129ec[_0xdc69('0x21')][_0x551005[_0xdc69('0xae')]][_0xdc69('0x5a')]+=0x1;var _0x4ddac5=_0x1129ec['voiceQueues'][_0x551005['queue']];var _0x4ce7b0=new Hangup(_0x551005,_0x10da23);_0x4ce7b0[_0xdc69('0xa3')]=0x13;_0x4ce7b0[_0xdc69('0xdc')]=_0xdc69('0xe1');_0x4ce7b0[_0xdc69('0xdd')]='AMD';_0x4ce7b0[_0xdc69('0xe2')]+=0x1;_0x4ce7b0[_0xdc69('0xe3')]+=0x1;_0x4ce7b0[_0xdc69('0xe4')]=!![];_0x1129ec[_0xdc69('0xc2')](_0x4ce7b0)['catch'](loggerCatch(_0xdc69('0xe5')));if(_0x4ce7b0['countbusyretry']+_0x4ce7b0[_0xdc69('0xe6')]+_0x4ce7b0[_0xdc69('0xe7')]+_0x4ce7b0[_0xdc69('0xe8')]+_0x4ce7b0[_0xdc69('0xe9')]+_0x4ce7b0['countabandonedretry']+_0x4ce7b0[_0xdc69('0xe2')]+_0x4ce7b0[_0xdc69('0xea')]>=_0x4ddac5['dialGlobalMaxRetry']){_0x1129ec[_0xdc69('0xeb')](_0x4ce7b0,_0x20e7ff,_0x4340a9,_0xdc69('0xec'));}else{if(_0x4ce7b0[_0xdc69('0xe2')]>=_0x4ddac5[_0xdc69('0xed')]){_0x1129ec[_0xdc69('0xee')](_0x4ce7b0,_0x20e7ff,_0x4340a9,_0xdc69('0xef'));}else{_0x1129ec[_0xdc69('0xb9')]({'active':![],'countmachineretry':_0x4ce7b0[_0xdc69('0xe2')],'scheduledat':moment()[_0xdc69('0xf0')](_0x4ddac5['dialMachineRetryFrequency'],_0xdc69('0xf1'))[_0xdc69('0x8f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ce7b0['ContactId'],'ListId':_0x4ce7b0[_0xdc69('0xca')],'VoiceQueueId':_0x4ce7b0[_0xdc69('0xcb')]||undefined,'CampaignId':_0x4ce7b0[_0xdc69('0xcc')]||undefined})[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xf2')));_0x20e7ff({'reschedule':0x1});}}});}if(_0x551005[_0xdc69('0x4e')]===_0xdc69('0x75')&&this[_0xdc69('0x22')][_0x551005[_0xdc69('0xae')]][_0xdc69('0xf3')]&&_0x10da23[_0xdc69('0xda')]===_0xdc69('0xdb')){delete this[_0xdc69('0x28')][_0x10da23[_0xdc69('0xd6')]];this[_0xdc69('0xc6')](this[_0xdc69('0x22')][_0x551005[_0xdc69('0xae')]]);_0x539704=new Hangup(_0x551005,_0x10da23);_0x539704[_0xdc69('0xa3')]=0x12;_0x539704['statedesc']=_0xdc69('0xf4');_0x539704[_0xdc69('0xdd')]=_0xdc69('0xf5');this[_0xdc69('0xc8')](_0x539704,_0xdc69('0xf6'),_0xdc69('0xf7'));}if(_0x551005[_0xdc69('0x4e')]===_0xdc69('0x75')&&this[_0xdc69('0x22')][_0x551005['queue']][_0xdc69('0xf3')]&&_0x10da23[_0xdc69('0xda')]===_0xdc69('0xe0')){var _0x1129ec=this;return new BPromise(function(_0x4db0f0,_0x346db9){delete _0x1129ec[_0xdc69('0x28')][_0x10da23[_0xdc69('0xd6')]];_0x1129ec[_0xdc69('0xc6')](_0x1129ec['campaigns'][_0x551005[_0xdc69('0xae')]]);_0x1129ec['campaigns'][_0x551005[_0xdc69('0xae')]][_0xdc69('0x5b')]+=0x1;_0x1129ec[_0xdc69('0x22')][_0x551005['queue']][_0xdc69('0x5a')]+=0x1;var _0x219824=_0x1129ec[_0xdc69('0x22')][_0x551005[_0xdc69('0xae')]];var _0x3abb91=new Hangup(_0x551005,_0x10da23);_0x3abb91['state']=0x13;_0x3abb91[_0xdc69('0xdc')]=_0xdc69('0xe1');_0x3abb91[_0xdc69('0xdd')]=_0xdc69('0xf5');_0x3abb91[_0xdc69('0xe2')]+=0x1;_0x3abb91[_0xdc69('0xe3')]+=0x1;_0x3abb91[_0xdc69('0xe4')]=!![];_0x1129ec[_0xdc69('0xc2')](_0x3abb91)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xe5')));if(_0x3abb91['countbusyretry']+_0x3abb91[_0xdc69('0xe6')]+_0x3abb91[_0xdc69('0xe7')]+_0x3abb91[_0xdc69('0xe8')]+_0x3abb91[_0xdc69('0xe9')]+_0x3abb91['countabandonedretry']+_0x3abb91[_0xdc69('0xe2')]+_0x3abb91[_0xdc69('0xea')]>=_0x219824[_0xdc69('0xf8')]){_0x1129ec[_0xdc69('0xeb')](_0x3abb91,_0x4db0f0,_0x346db9,_0xdc69('0xec'));}else{if(_0x3abb91[_0xdc69('0xe2')]>=_0x219824['dialMachineMaxRetry']){_0x1129ec['createStateFinal'](_0x3abb91,_0x4db0f0,_0x346db9,_0xdc69('0xef'));}else{_0x1129ec[_0xdc69('0xb9')]({'active':![],'countmachineretry':_0x3abb91[_0xdc69('0xe2')],'scheduledat':moment()[_0xdc69('0xf0')](_0x219824[_0xdc69('0xf9')],_0xdc69('0xf1'))[_0xdc69('0x8f')](_0xdc69('0xfa')),'ContactId':_0x3abb91[_0xdc69('0xfb')],'ListId':_0x3abb91[_0xdc69('0xca')],'VoiceQueueId':_0x3abb91[_0xdc69('0xcb')]||undefined,'CampaignId':_0x3abb91[_0xdc69('0xcc')]||undefined})[_0xdc69('0xb2')](loggerCatch('[rescheduleContact][Machine]'));_0x4db0f0({'reschedule':0x1});}}});}}};Dialer[_0xdc69('0xa6')][_0xdc69('0x34')]=function(_0x1b5e80){var _0x53f500=this['uniqueId'][_0x1b5e80[_0xdc69('0xd6')]];var _0xca0c52=this;var _0x3cf8ad;if(_0x53f500&&_0x53f500['type']===_0xdc69('0x75')){delete this[_0xdc69('0x28')][_0x1b5e80[_0xdc69('0xd6')]];this['updateOriginated'](this[_0xdc69('0x22')][_0x53f500[_0xdc69('0xae')]]);this[_0xdc69('0x22')][_0x53f500['queue']][_0xdc69('0xfc')]+=0x1;_0x3cf8ad=new Hangup(_0x53f500,_0x1b5e80);this[_0xdc69('0xc2')](_0x3cf8ad)[_0xdc69('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xdc69('0xc0')](_0x3cf8ad)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xfd')));}if(_0x53f500&&_0x53f500[_0xdc69('0x4e')]!=='ivr'&&isNotNull(this[_0xdc69('0x21')][_0x53f500[_0xdc69('0xae')]][_0xdc69('0xfe')])){delete this[_0xdc69('0x28')][_0x1b5e80['uniqueid']];this['updateOriginated'](this[_0xdc69('0x21')][_0x53f500['queue']]);this[_0xdc69('0x21')][_0x53f500['queue']][_0xdc69('0x5b')]+=0x1;this[_0xdc69('0x21')][_0x53f500['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x3cf8ad=new Hangup(_0x53f500,_0x1b5e80);_0x3cf8ad[_0xdc69('0xa3')]=0x10;_0x3cf8ad['statedesc']=_0xdc69('0xff');_0x3cf8ad[_0xdc69('0xdd')]='AGI';this['createHistory'](_0x3cf8ad)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x100')));this[_0xdc69('0xc0')](_0x3cf8ad)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xfd')));}if(_0x53f500&&_0x53f500[_0xdc69('0x4e')]!=='ivr'&&!isNotNull(this[_0xdc69('0x21')][_0x53f500[_0xdc69('0xae')]][_0xdc69('0xfe')])){delete this[_0xdc69('0x28')][_0x1b5e80[_0xdc69('0xd6')]];this[_0xdc69('0xc6')](this[_0xdc69('0x21')][_0x53f500[_0xdc69('0xae')]]);this[_0xdc69('0x21')][_0x53f500[_0xdc69('0xae')]][_0xdc69('0x63')]+=0x1;_0x3cf8ad=new Hangup(_0x53f500,_0x1b5e80);_0x3cf8ad['state']=0xc;_0x3cf8ad[_0xdc69('0xdc')]=_0x1b5e80[_0xdc69('0x101')];_0x3cf8ad[_0xdc69('0xdd')]=_0xdc69('0x102');this[_0xdc69('0xc2')](_0x3cf8ad)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x100')));this[_0xdc69('0xc0')](_0x3cf8ad)[_0xdc69('0xb2')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xdc69('0xa6')]['syncAgentComplete']=function(_0x43b790){var _0x46f689=this['uniqueId'][_0x43b790[_0xdc69('0xd6')]];var _0x4648be=this;if(this[_0xdc69('0x21')][_0x43b790[_0xdc69('0xae')]]){if(_0x46f689&&_0x46f689[_0xdc69('0x4e')]!==_0xdc69('0x75')){delete this[_0xdc69('0x28')][_0x43b790[_0xdc69('0xd6')]];this[_0xdc69('0x21')][_0x43b790['queue']][_0xdc69('0x5b')]+=0x1;var _0x2f196a=new AgentComplete(_0x46f689,_0x43b790);if(_0x43b790[_0xdc69('0x103')]===_0xdc69('0x104')){_0x2f196a[_0xdc69('0x105')]=this[_0xdc69('0x21')][_0x43b790[_0xdc69('0xae')]][_0xdc69('0x106')]&&this[_0xdc69('0x21')][_0x43b790[_0xdc69('0xae')]][_0xdc69('0x107')]?moment()[_0xdc69('0x8f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xdc69('0xc2')](_0x2f196a)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x108')));this[_0xdc69('0xc0')](_0x2f196a)[_0xdc69('0xb2')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xdc69('0xa6')][_0xdc69('0x109')]=function(_0xbb873f){if(this[_0xdc69('0x21')][_0xbb873f['queue']]){if(this[_0xdc69('0x28')][_0xbb873f['uniqueid']]&&this['uniqueId'][_0xbb873f[_0xdc69('0xd6')]][_0xdc69('0x4e')]!=='ivr'){this['updateOriginated'](this[_0xdc69('0x21')][_0xbb873f[_0xdc69('0xae')]]);this[_0xdc69('0x28')][_0xbb873f[_0xdc69('0xd6')]][_0xdc69('0x10a')]=moment()[_0xdc69('0x8f')](_0xdc69('0xfa'));}}};Dialer['prototype'][_0xdc69('0x10b')]=function(_0x4fe808){this['createHistory'](_0x4fe808)[_0xdc69('0xb2')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xdc69('0xc0')](_0x4fe808)['catch'](loggerCatch(_0xdc69('0x10c')));};Dialer[_0xdc69('0xa6')][_0xdc69('0x10d')]=function(_0x47edaf){var _0x1a72a3=this[_0xdc69('0x28')][_0x47edaf[_0xdc69('0xd6')]];var _0x2d37c2=this;if(this[_0xdc69('0x21')][_0x47edaf['queue']]){if(_0x1a72a3&&_0x1a72a3[_0xdc69('0x4e')]!=='ivr'){delete this[_0xdc69('0x28')][_0x47edaf[_0xdc69('0xd6')]];this['updateOriginated'](this[_0xdc69('0x21')][_0x47edaf[_0xdc69('0xae')]]);_0x1a72a3[_0xdc69('0x10e')]=moment()[_0xdc69('0x8f')](_0xdc69('0xfa'));var _0x413168=new QueueCallerAbandon(_0x1a72a3,_0x47edaf);if(getSeconds(_0x1a72a3[_0xdc69('0x10e')],_0x1a72a3[_0xdc69('0x10f')])>=_0x1a72a3['dialQueueTimeout']){this[_0xdc69('0x21')][_0x47edaf[_0xdc69('0xae')]][_0xdc69('0x68')]+=0x1;this[_0xdc69('0x21')][_0x47edaf[_0xdc69('0xae')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xdc69('0x21')][_0x47edaf[_0xdc69('0xae')]][_0xdc69('0x110')]+=0x1;_0x413168['state']=0xa;_0x413168['statedesc']=_0xdc69('0x111');_0x413168[_0xdc69('0x112')]='TIMEOUT';_0x413168['agiafterat']=this['voiceQueues'][_0x47edaf[_0xdc69('0xae')]][_0xdc69('0x106')]?moment()[_0xdc69('0x8f')](_0xdc69('0xfa')):undefined;_0x413168[_0xdc69('0xe9')]+=0x1;_0x413168[_0xdc69('0xe3')]+=0x1;if(_0x413168['countdropretry']>=this[_0xdc69('0x21')][_0x47edaf[_0xdc69('0xae')]]['dialDropMaxRetry']){this[_0xdc69('0x10b')](_0x413168);}else{this[_0xdc69('0xb9')]({'active':![],'countdropretry':_0x413168[_0xdc69('0xe9')],'scheduledat':moment()[_0xdc69('0xf0')](this[_0xdc69('0x21')][_0x47edaf[_0xdc69('0xae')]]['dialDropRetryFrequency'],_0xdc69('0xf1'))['format'](_0xdc69('0xfa')),'ContactId':_0x1a72a3[_0xdc69('0xfb')],'ListId':_0x1a72a3[_0xdc69('0xca')],'VoiceQueueId':_0x1a72a3[_0xdc69('0xcb')]||undefined,'CampaignId':_0x1a72a3[_0xdc69('0xcc')]||undefined})[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x113')));var _0x40f730=new History(_0x413168);_0x40f730[_0xdc69('0xa3')]=0xa;_0x40f730[_0xdc69('0xdc')]=_0xdc69('0x111');_0x40f730[_0xdc69('0xa5')]=moment()[_0xdc69('0x8f')](_0xdc69('0xfa'));_0x40f730['endtime']=_0x40f730[_0xdc69('0xa5')];_0x40f730[_0xdc69('0x114')]=_0x413168[_0xdc69('0x114')];_0x40f730[_0xdc69('0x115')]=_0x413168[_0xdc69('0x115')];this[_0xdc69('0xc2')](_0x40f730)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x116')));}}else{this[_0xdc69('0x21')][_0x47edaf['queue']][_0xdc69('0x67')]+=0x1;this['voiceQueues'][_0x47edaf[_0xdc69('0xae')]][_0xdc69('0x5e')]+=0x1;_0x413168['state']=0xb;_0x413168['statedesc']=_0xdc69('0x117');_0x413168[_0xdc69('0x112')]='CALLEREXIT';_0x413168[_0xdc69('0x118')]+=0x1;_0x413168[_0xdc69('0xe3')]+=0x1;if(_0x413168['countabandonedretry']>=this['voiceQueues'][_0x47edaf[_0xdc69('0xae')]][_0xdc69('0x119')]){this[_0xdc69('0x10b')](_0x413168);}else{this[_0xdc69('0xb9')]({'active':![],'countabandonedretry':_0x413168[_0xdc69('0x118')],'scheduledat':moment()[_0xdc69('0xf0')](this[_0xdc69('0x21')][_0x47edaf[_0xdc69('0xae')]][_0xdc69('0x11a')],'minutes')[_0xdc69('0x8f')](_0xdc69('0xfa')),'ContactId':_0x1a72a3[_0xdc69('0xfb')],'ListId':_0x1a72a3[_0xdc69('0xca')],'VoiceQueueId':_0x1a72a3[_0xdc69('0xcb')]||undefined,'CampaignId':_0x1a72a3['CampaignId']||undefined})[_0xdc69('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x40f730=new History(_0x413168);_0x40f730['state']=0xb;_0x40f730[_0xdc69('0xdc')]=_0xdc69('0x117');_0x40f730[_0xdc69('0xa5')]=moment()[_0xdc69('0x8f')](_0xdc69('0xfa'));_0x40f730[_0xdc69('0xa4')]=_0x40f730[_0xdc69('0xa5')];_0x40f730[_0xdc69('0x114')]=_0x413168[_0xdc69('0x114')];_0x40f730[_0xdc69('0x115')]=_0x413168[_0xdc69('0x115')];this['createHistory'](_0x40f730)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x11b')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x1165cb){if(this[_0xdc69('0xa8')][_0x1165cb[_0xdc69('0xd6')]]){this[_0xdc69('0xa8')][_0x1165cb['uniqueid']][_0xdc69('0xac')]=_0x1165cb[_0xdc69('0xac')];}if(this[_0xdc69('0x28')][_0x1165cb[_0xdc69('0xd6')]]){this[_0xdc69('0x28')][_0x1165cb[_0xdc69('0xd6')]]['channel']=_0x1165cb['channel'];}};Dialer[_0xdc69('0xa6')][_0xdc69('0x39')]=function(_0x5bc446){if(strategy[this[_0xdc69('0x21')][this[_0xdc69('0xa8')][_0x5bc446[_0xdc69('0x11c')]][_0xdc69('0xae')]][_0xdc69('0x11d')]]===_0xdc69('0x1e')){if(this[_0xdc69('0xa8')][_0x5bc446[_0xdc69('0x11c')]]&&_[_0xdc69('0xd7')](this[_0xdc69('0xa8')][_0x5bc446['actionid']][_0xdc69('0x11e')])&&_0x5bc446['status']==='1'&&_0x5bc446['paused']==='0'){if(this[_0xdc69('0x23')][_0x5bc446[_0xdc69('0x11f')]]){if(!this[_0xdc69('0x23')][_0x5bc446[_0xdc69('0x11f')]][_0xdc69('0x11e')]){this['agents'][_0x5bc446[_0xdc69('0x11f')]][_0xdc69('0x11e')]=!![];this[_0xdc69('0xa8')][_0x5bc446[_0xdc69('0x11c')]][_0xdc69('0x11e')]=!![];this[_0xdc69('0xa8')][_0x5bc446[_0xdc69('0x11c')]][_0xdc69('0x11f')]=_0x5bc446[_0xdc69('0x11f')];}}}}else if((strategy[this[_0xdc69('0x21')][this[_0xdc69('0xa8')][_0x5bc446['actionid']][_0xdc69('0xae')]][_0xdc69('0x11d')]]||'rrmemory')===_0xdc69('0x1d')){if(this[_0xdc69('0xa8')][_0x5bc446[_0xdc69('0x11c')]]){if(this['agents'][_0x5bc446[_0xdc69('0x11f')]]){this['actions'][_0x5bc446[_0xdc69('0x11c')]][_0xdc69('0x11f')]=_0x5bc446[_0xdc69('0x11f')];if(_[_0xdc69('0xd7')](this[_0xdc69('0x2b')][this['actions'][_0x5bc446[_0xdc69('0x11c')]][_0xdc69('0xae')]])){this['queueBooked'][this['actions'][_0x5bc446[_0xdc69('0x11c')]]['queue']]=[];}this[_0xdc69('0x2b')][this['actions'][_0x5bc446[_0xdc69('0x11c')]][_0xdc69('0xae')]][_0xdc69('0x120')](_[_0xdc69('0x88')](_[_0xdc69('0xc9')](this[_0xdc69('0xa8')][_0x5bc446[_0xdc69('0x11c')]],[_0xdc69('0x121'),_0xdc69('0x11f')]),{'status':_0x5bc446['status'],'paused':_0x5bc446[_0xdc69('0x122')]}));}}}};function unlockQueueStatus(_0x33509c,_0x37d81e){setTimeout(function(){if(_['isUndefined'](_0x33509c[_0xdc69('0x123')])){loggerBooked[_0xdc69('0x91')](_0xdc69('0x124'),_0x37d81e);}_0x33509c[_0xdc69('0x123')]=!![];loggerBooked[_0xdc69('0x78')](_0xdc69('0x125'),_0x37d81e,JSON[_0xdc69('0x4b')](_[_0xdc69('0xc9')](_0x33509c,[_0xdc69('0x3f'),_0xdc69('0x123')])));},0x1f3);}Dialer[_0xdc69('0xa6')]['syncQueueStatusComplete']=function(_0x49aa9e){var _0x3cb20e=this;var _0x280186=_0x3cb20e[_0xdc69('0x21')][_0x3cb20e['actions'][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]];if(strategy[this['voiceQueues'][this[_0xdc69('0xa8')][_0x49aa9e['actionid']][_0xdc69('0xae')]][_0xdc69('0x11d')]]===_0xdc69('0x1e')){if(this['actions'][_0x49aa9e[_0xdc69('0x11c')]]&&this['actions'][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0x11f')]){this['preview']['run'](this['actions'][_0x49aa9e['actionid']]['idHopper'],this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0x11f')])['catch'](function(_0x3058a3){logger[_0xdc69('0x91')](_0xdc69('0x126'),util[_0xdc69('0x92')](_0x3058a3,{'showHidden':![],'depth':null}));})[_0xdc69('0x127')](function(){_0x3cb20e[_0xdc69('0xc6')](_0x3cb20e[_0xdc69('0x21')][_0x3cb20e[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]]);_0x3cb20e[_0xdc69('0x23')][_0x3cb20e[_0xdc69('0xa8')][_0x49aa9e['actionid']]['stateinterface']]['locked']=![];delete _0x3cb20e[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]];unlockQueueStatus(_0x280186);});}else{this['updateOriginated'](this[_0xdc69('0x21')][this['actions'][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xfb')],'ListId':this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xca')],'VoiceQueueId':this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xcb')]||undefined,'CampaignId':this[_0xdc69('0xa8')][_0x49aa9e['actionid']][_0xdc69('0xcc')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x49aa9e[_0xdc69('0x11c')]];unlockQueueStatus(_0x280186);}}else if((strategy[this[_0xdc69('0x21')][this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]]['strategy']]||'rrmemory')==='rrmemory'){var _0x54809c;if(this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]]&&!_['isEmpty'](this[_0xdc69('0x2b')][this[_0xdc69('0xa8')][_0x49aa9e['actionid']][_0xdc69('0xae')]])){if(this['queueBookedRR'][_0x3cb20e[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]]){this[_0xdc69('0x128')][_0x3cb20e[_0xdc69('0xa8')][_0x49aa9e['actionid']][_0xdc69('0xae')]]=this['queueBookedRR'][this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]]?this['queueBookedRR'][this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]]:this[_0xdc69('0x2b')][this['actions'][_0x49aa9e['actionid']][_0xdc69('0xae')]]?this[_0xdc69('0x2b')][this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]][_0xdc69('0x129')]||0x0:0x0;}this['queueBooked'][this[_0xdc69('0xa8')][_0x49aa9e[_0xdc69('0x11c')]][_0xdc69('0xae')]][_0xdc69('0x129')]=this[_0xdc69('0x128')][this['actions'][_0x49aa9e[_0xdc69('0x11c')]]['queue']];for(var _0x29480e=0x0;_0x29480e=0x0?!![]:![];})['catch'](myreject(_0x21f5a6)));}}else{_0x849abb[_0xdc69('0x120')](ami[_0xdc69('0x143')]({'action':_0xdc69('0x144'),'command':util[_0xdc69('0x8f')](_0xdc69('0x145'),_0x40f935,!_[_0xdc69('0x7f')](config[_0xdc69('0x140')][_0x42ba3a])?_0x42ba3a:'')})['then'](function(_0x3b9193){return _0x3b9193[_0xdc69('0x147')]['indexOf'](_0xdc69('0x149'))>=0x0?!![]:![];})[_0xdc69('0xb2')](myreject(_0x21f5a6)));}BPromise[_0xdc69('0x14a')](_0x849abb)['then'](function(_0x28fc8){var _0x3c9100=_[_0xdc69('0x14b')](_0x28fc8);if(_0x3c9100){return _0xea5f84(_0x3c9100);}else{_0x219e7c[_0xdc69('0x41')]=_0x5171c6?_0xdc69('0x14c'):_0xdc69('0x14d');return _0x21f5a6(msgResponse(_0xdc69('0x14e'),_0xdc69('0x13c'),_0xdc69('0x14f')+_0x5171c6+'\x20'+_0x312df0+_0xdc69('0x150')+util[_0xdc69('0x92')](_0x40f935,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x42ba3a));}})[_0xdc69('0xb2')](function(_0x23a014){return _0x21f5a6(msgResponse('ifTime',_0xdc69('0x13c'),JSON[_0xdc69('0x4b')](_0x23a014)));});});};Dialer['prototype']['checkDialMethod']=function(_0x1e9175){var _0x50ec61=this;return function(){switch(_0x1e9175['dialMethod']){case _0xdc69('0x151'):freeVariablesPredictive(_0x1e9175);_0x50ec61[_0xdc69('0x152')](_0x1e9175,0x1);break;case'power':freeVariablesPredictive(_0x1e9175);_0x50ec61[_0xdc69('0x152')](_0x1e9175,_0x1e9175['dialPowerLevel']);break;case _0xdc69('0xa'):_0x50ec61[_0xdc69('0xa')](_0x1e9175);break;case _0xdc69('0x9'):freeVariablesPredictive(_0x1e9175);_0x50ec61['handlePower'](_0x1e9175,0x1);break;default:freeVariablesPredictive(_0x1e9175);logger['error']('Queue',_0x1e9175[_0xdc69('0x3f')],_0xdc69('0x153'));}};};Dialer[_0xdc69('0xa6')][_0xdc69('0x154')]=function(_0xdec3c4){var _0x4e8435=this;return function(){_0x4e8435[_0xdc69('0x155')](_0xdec3c4);};};Dialer[_0xdc69('0xa6')][_0xdc69('0xb')]=function(_0x3c4393){var _0x446866=this;if(isNotPreview(_0x3c4393[_0xdc69('0x156')])){if(isVoiceQueueOutbound(_0x3c4393[_0xdc69('0x4e')])&&isActive(_0x3c4393[_0xdc69('0x157')])){_0x3c4393['sendMessageOneNotActive']=!![];BPromise[_0xdc69('0xb4')]()['then'](checkIsLoggedIn(_0x3c4393,_0x3c4393['loggedIn']))[_0xdc69('0xb5')](checkIsActive(_0x3c4393,_0x3c4393[_0xdc69('0x157')]))[_0xdc69('0xb5')](checkInterval(_0x3c4393))['then'](_0x446866[_0xdc69('0x136')](_0x3c4393))['then'](_0x446866[_0xdc69('0x13a')](_0x3c4393[_0xdc69('0x158')],_0x3c4393[_0xdc69('0x159')],_0x3c4393['name'],_0x3c4393))[_0xdc69('0xb5')](_0x446866[_0xdc69('0x15a')](_0x3c4393[_0xdc69('0x46')],_0x3c4393[_0xdc69('0x159')],_0x3c4393[_0xdc69('0x3f')],_0x3c4393))[_0xdc69('0xb5')](_0x446866['checkDialMethod'](_0x3c4393))[_0xdc69('0xb2')](loggerCatchQueueSummary('[syncQueueSummary]',_0x3c4393));}else{notSendMessagesQueue(_0x3c4393);}}else{freeVariablesPredictive(_0x3c4393);}};Dialer[_0xdc69('0xa6')]['syncCampaigns']=function(){var _0x3022a9=this;var _0x4949be;for(var _0x388b29 in this[_0xdc69('0x22')]){if(this['campaigns'][_0xdc69('0x94')](_0x388b29)){_0x4949be=this[_0xdc69('0x22')][_0x388b29];if(isCampaignIvr(_0x4949be['type'])&&isActive(_0x4949be[_0xdc69('0xd2')])){_0x4949be[_0xdc69('0xa0')]=!![];BPromise[_0xdc69('0xb4')]()['then'](checkIsActive(_0x4949be,_0x4949be[_0xdc69('0xd2')]))[_0xdc69('0xb5')](checkInterval(_0x4949be))[_0xdc69('0xb5')](_0x3022a9[_0xdc69('0x136')](_0x4949be))[_0xdc69('0xb5')](_0x3022a9['checkIfTime'](_0x4949be['dialGlobalInterval'],_0x4949be[_0xdc69('0x159')],_0x4949be[_0xdc69('0x3f')],_0x4949be))['then'](_0x3022a9[_0xdc69('0x15a')](_0x4949be[_0xdc69('0x46')],_0x4949be[_0xdc69('0x159')],_0x4949be[_0xdc69('0x3f')],_0x4949be))[_0xdc69('0xb5')](_0x3022a9['launchHandleIvr'](_0x4949be))[_0xdc69('0xb2')](loggerCatchQueueSummary('[syncCampaigns]',_0x4949be));}else{notSendMessagesCampaign(_0x4949be);}}}};function getCallerIdRandom(_0xd3fa63,_0x4540fd){var _0x19c53e,_0x4830f5,_0x5441d8;if(_0x4540fd<=0x0){_0x4540fd=0x1;}_0x19c53e=new RegExp(_0xdc69('0x15b')+_0x4540fd+'}$');_0x4830f5=Math[_0xdc69('0x15c')](0xa,_0x4540fd-0x1);_0x5441d8=Math[_0xdc69('0x15c')](0xa,_0x4540fd)-0x1;return util[_0xdc69('0x8f')]('%s',_[_0xdc69('0x15d')](_0xd3fa63,_0x19c53e,_[_0xdc69('0x15e')](_0x4830f5,_0x5441d8)));}function extractCalleridName(_0x1f8611){var _0x46c5f5=_0x1f8611[_0xdc69('0x15f')](/"(.*?)"/);return _0x46c5f5?_0x46c5f5[0x1]:_0x1f8611;}function extractCalleridNumber(_0x5e495f){var _0x48c64e=_0x5e495f[_0xdc69('0x15f')](/<(.*?)>/);return _0x48c64e?_0x48c64e[0x1]:_0x5e495f;}Dialer[_0xdc69('0xa6')][_0xdc69('0x160')]=function(_0x40843c,_0x328bed){var _0x28b1b1=this;var _0xe283c4=uuid['v4']();this[_0xdc69('0xa8')][_0xe283c4]=new Action(_0x40843c,_0x328bed,_0xe283c4);return new BPromise(function(_0x4f2177,_0x2274c2){if(_[_0xdc69('0x7f')](_0x40843c)&&_0xdc69('0x161')!==typeof _0x40843c){return _0x2274c2(msgResponse('originate',_0xdc69('0x13c'),_0xdc69('0x162')));}if(_['isUndefined'](_0x328bed[_0xdc69('0x163')][_0xdc69('0x164')])||_0x328bed[_0xdc69('0x163')][_0xdc69('0x164')]===null){return _0x2274c2(msgResponse(_0xdc69('0x165'),'Failure','contact\x20is\x20undefine'));}var _0x12a2bc={'XMD-CALLERID':_0x28b1b1[_0xdc69('0xa8')][_0xe283c4][_0xdc69('0x166')](),'XMD-AGI':_0x40843c[_0xdc69('0xfe')]?util[_0xdc69('0x8f')](_0xdc69('0x167'),ipAgi,_0x40843c['dialQueueProject']):_0xdc69('0x168'),'XMD-AGIAFTER':_0x40843c['dialQueueProject2']?util['format'](_0xdc69('0x167'),ipAgi,_0x40843c[_0xdc69('0x106')]):_0xdc69('0x168'),'XMD-QUEUE':_0x40843c[_0xdc69('0x4e')]===_0xdc69('0x169')?util[_0xdc69('0x8f')](_0xdc69('0x16a'),_0x40843c[_0xdc69('0x3f')],_0x40843c[_0xdc69('0x16b')]||'',_0x40843c[_0xdc69('0x107')]?'c':'',_0x40843c[_0xdc69('0x16c')]||0x3):'NONE','XMD-CONTACTID':_0x328bed[_0xdc69('0xfb')],'XMD-CDRTYPE':_0xdc69('0x8'),'CALLERID(all)':_0x28b1b1[_0xdc69('0xa8')][_0xe283c4][_0xdc69('0x166')](),'XMD-AMD':_0x40843c[_0xdc69('0xf3')]?_0xdc69('0x16d'):_0xdc69('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x40843c[_0xdc69('0xf3')]){_0x12a2bc[_0xdc69('0x16e')]=_0x40843c['dialAMDInitialSilence']||0x9c4;_0x12a2bc['XMD-AMDGREETING']=_0x40843c[_0xdc69('0x16f')]||0x5dc;_0x12a2bc[_0xdc69('0x170')]=_0x40843c[_0xdc69('0x171')]||0x320;_0x12a2bc['XMD-AMDTOTALANALYSISTIME']=_0x40843c[_0xdc69('0x172')]||0x1388;_0x12a2bc[_0xdc69('0x173')]=_0x40843c['dialAMDMinWordLength']||0x64;_0x12a2bc[_0xdc69('0x174')]=_0x40843c[_0xdc69('0x175')]||0x32;_0x12a2bc[_0xdc69('0x176')]=_0x40843c[_0xdc69('0x177')]||0x3;_0x12a2bc[_0xdc69('0x178')]=_0x40843c[_0xdc69('0x179')]||0x100;_0x12a2bc[_0xdc69('0x17a')]=_0x40843c[_0xdc69('0x17b')]||0x1388;}if(_0x40843c[_0xdc69('0x4e')]==='outbound'){_0x12a2bc[_0xdc69('0x17c')]=_0x328bed[_0xdc69('0xcb')];}else{_0x12a2bc[_0xdc69('0x17d')]=_0x328bed['CampaignId'];}for(var _0x21adcc in _0x328bed[_0xdc69('0x163')]){if(_0x328bed[_0xdc69('0x163')][_0xdc69('0x94')](_0x21adcc)){if(isNotNull(_0x328bed[_0xdc69('0x163')][_0x21adcc])&&_0x21adcc!=='id'&&_0x21adcc!==_0xdc69('0x17e')&&_0x21adcc!==_0xdc69('0x17f')&&_0x21adcc!==_0xdc69('0x180')){_0x12a2bc[util['format'](_0xdc69('0x181'),'XMD-',_[_0xdc69('0x182')](_0x21adcc))]=_0x328bed['Contact'][_0x21adcc];}}}var _0x2cc277=_0x28b1b1[_0xdc69('0xd1')](_0x40843c[_0xdc69('0x73')])?getCallerId(_0x40843c[_0xdc69('0x73')][_0xdc69('0x74')],_0x40843c[_0xdc69('0x183')],_0x40843c[_0xdc69('0x184')]>0x0?getCallerIdRandom(_0x40843c[_0xdc69('0x58')],_0x40843c[_0xdc69('0x184')]):_0x40843c[_0xdc69('0x58')]):getCallerId(_[_0xdc69('0xd7')](_0x40843c[_0xdc69('0x137')])?_0x40843c[_0xdc69('0x73')]['callerid']:_0x40843c[_0xdc69('0x137')]['callerid'],_0x40843c[_0xdc69('0x183')],_0x40843c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x40843c[_0xdc69('0x58')],_0x40843c['dialRandomLastDigitCallerIdNumber']):_0x40843c[_0xdc69('0x58')]);if(_0x2cc277){_0x12a2bc[_0xdc69('0x185')]=_0x28b1b1[_0xdc69('0xa8')][_0xe283c4][_0xdc69('0x186')]=extractCalleridName(_0x2cc277);_0x12a2bc[_0xdc69('0x187')]=_0x28b1b1[_0xdc69('0xa8')][_0xe283c4][_0xdc69('0x188')]=extractCalleridNumber(_0x2cc277);}return ami['Action']({'actionid':_0xe283c4,'action':_0xdc69('0x165'),'channel':_0x28b1b1['isTrunkReachable'](_0x40843c['Trunk'])?util[_0xdc69('0x8f')]('SIP/%s/%s%s',_0x40843c[_0xdc69('0x73')][_0xdc69('0x3f')],isNotNull(_0x40843c[_0xdc69('0x189')])?_0x40843c[_0xdc69('0x189')][_0xdc69('0x18a')]()||'':'',_0x40843c[_0xdc69('0x18b')]>0x0?_0x328bed[_0xdc69('0x163')][_0xdc69('0x164')][_0xdc69('0x18c')](_0x40843c['dialCutDigit']):_0x328bed[_0xdc69('0x163')][_0xdc69('0x164')]):util[_0xdc69('0x8f')]('SIP/%s/%s%s',_[_0xdc69('0xd7')](_0x40843c['TrunkBackup'])?_0x40843c[_0xdc69('0x73')][_0xdc69('0x3f')]:_0x40843c[_0xdc69('0x137')]['name'],isNotNull(_0x40843c[_0xdc69('0x189')])?_0x40843c[_0xdc69('0x189')][_0xdc69('0x18a')]()||'':'',_0x40843c[_0xdc69('0x18b')]>0x0?_0x328bed[_0xdc69('0x163')]['phone'][_0xdc69('0x18c')](_0x40843c['dialCutDigit']):_0x328bed[_0xdc69('0x163')][_0xdc69('0x164')]),'callerid':_0x2cc277,'Exten':_0xdc69('0x18d'),'Context':_0xdc69('0x18e'),'Priority':'1','variable':_0x12a2bc,'timeout':(_0x40843c[_0xdc69('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0xe283c4})[_0xdc69('0xb5')](function(_0x122627){return _0x4f2177(_0x122627);})[_0xdc69('0xb2')](function(_0x271efd){_0x40843c[_0xdc69('0x62')]+=0x1;var _0x93170c=new History(_0x28b1b1[_0xdc69('0xa8')][_0xe283c4]);logger[_0xdc69('0x91')](util[_0xdc69('0x8f')](_0xdc69('0x18f'),JSON['stringify'](_0x271efd)));_0x93170c[_0xdc69('0xa3')]=0xe;_0x93170c['statedesc']=_0xdc69('0x190');_0x93170c['starttime']=moment()[_0xdc69('0x8f')](_0xdc69('0xfa'));_0x93170c['endtime']=_0x93170c[_0xdc69('0xa5')];_0x28b1b1[_0xdc69('0xc2')](_0x93170c)['catch'](loggerCatch(_0xdc69('0x191')));_0x28b1b1[_0xdc69('0xc0')](_0x93170c)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x191')))['finally'](function(){delete _0x28b1b1[_0xdc69('0xa8')][_0xe283c4];return _0x2274c2(msgResponse(_0xdc69('0x165'),_0xdc69('0x4a'),'originate\x20action\x20Error'));});});});};Dialer[_0xdc69('0xa6')][_0xdc69('0x30')]=function(_0x1fc113){var _0x5b601b=this[_0xdc69('0xa8')][_0x1fc113['actionid']];var _0x14e43b=this;if(_0x5b601b){delete this[_0xdc69('0xa8')][_0x1fc113[_0xdc69('0x11c')]];_0x5b601b[_0xdc69('0x10f')]=moment()[_0xdc69('0x8f')](_0xdc69('0xfa'));var _0x18613a=_0x5b601b[_0xdc69('0x4e')]===_0xdc69('0x75')?this[_0xdc69('0x22')][_0x5b601b[_0xdc69('0xae')]]:this[_0xdc69('0x21')][_0x5b601b['getQueue']()];if(!this['isSuccess'](_0x1fc113[_0xdc69('0x192')])){this[_0xdc69('0xc6')](_0x18613a);return this[_0xdc69('0x193')](_0x5b601b,_0x18613a,_0x1fc113)['then'](function(_0x1c254c){})['catch'](loggerCatch(_0xdc69('0x194')));}else{this[_0xdc69('0x28')][_0x1fc113[_0xdc69('0xd6')]]=_0x5b601b;}}};Dialer[_0xdc69('0xa6')][_0xdc69('0x195')]=function(_0x3741f2,_0x4e8cb4,_0x5a6023){var _0x348caa=new History(_0x4e8cb4);if(_0x348caa[_0xdc69('0x196')]+_0x348caa['countcongestionretry']+_0x348caa[_0xdc69('0xe7')]+_0x348caa[_0xdc69('0xe8')]+_0x348caa[_0xdc69('0xe9')]+_0x348caa['countabandonedretry']+_0x348caa[_0xdc69('0xe2')]+_0x348caa['countagentrejectretry']>=_0x5a6023[_0xdc69('0xf8')]-0x1){return!![];}switch(_0x3741f2){case 0x3:if(_0x348caa[_0xdc69('0xe7')]>=_0x5a6023['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0xdc69('0xb9')]({'active':![],'countnoanswerretry':_0x348caa[_0xdc69('0xe7')]+=0x1,'scheduledat':moment()['add'](_0x5a6023[_0xdc69('0x197')],_0xdc69('0xf1'))[_0xdc69('0x8f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x348caa[_0xdc69('0xfb')],'ListId':_0x348caa[_0xdc69('0xca')],'VoiceQueueId':_0x348caa[_0xdc69('0xcb')]||undefined,'CampaignId':_0x348caa[_0xdc69('0xcc')]||undefined})[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x198')));}break;case 0x5:if(_0x348caa[_0xdc69('0x196')]>=_0x5a6023[_0xdc69('0x199')]-0x1){return!![];}else{this[_0xdc69('0xb9')]({'active':![],'countbusyretry':_0x348caa[_0xdc69('0x196')]+=0x1,'scheduledat':moment()[_0xdc69('0xf0')](_0x5a6023[_0xdc69('0x19a')],_0xdc69('0xf1'))['format'](_0xdc69('0xfa')),'ContactId':_0x348caa['ContactId'],'ListId':_0x348caa[_0xdc69('0xca')],'VoiceQueueId':_0x348caa[_0xdc69('0xcb')]||undefined,'CampaignId':_0x348caa['CampaignId']||undefined})[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x19b')));}break;case 0x8:if(_0x348caa[_0xdc69('0xe6')]>=_0x5a6023[_0xdc69('0x19c')]-0x1){return!![];}else{this[_0xdc69('0xb9')]({'active':![],'countcongestionretry':_0x348caa['countcongestionretry']+=0x1,'scheduledat':moment()[_0xdc69('0xf0')](_0x5a6023[_0xdc69('0x19d')],'minutes')[_0xdc69('0x8f')](_0xdc69('0xfa')),'ContactId':_0x348caa[_0xdc69('0xfb')],'ListId':_0x348caa[_0xdc69('0xca')],'VoiceQueueId':_0x348caa[_0xdc69('0xcb')]||undefined,'CampaignId':_0x348caa[_0xdc69('0xcc')]||undefined})['catch'](loggerCatch(_0xdc69('0x19e')));}break;case 0x0:if(_0x348caa[_0xdc69('0xe8')]>=_0x5a6023[_0xdc69('0x19f')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x348caa[_0xdc69('0xe8')]+=0x1,'scheduledat':moment()['add'](_0x5a6023[_0xdc69('0x1a0')],_0xdc69('0xf1'))[_0xdc69('0x8f')](_0xdc69('0xfa')),'ContactId':_0x348caa[_0xdc69('0xfb')],'ListId':_0x348caa[_0xdc69('0xca')],'VoiceQueueId':_0x348caa[_0xdc69('0xcb')]||undefined,'CampaignId':_0x348caa[_0xdc69('0xcc')]||undefined})[_0xdc69('0xb2')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x348caa[_0xdc69('0xe9')]>=_0x5a6023[_0xdc69('0x1a1')]-0x1){return!![];}else{this[_0xdc69('0xb9')]({'active':![],'countdropretry':_0x348caa[_0xdc69('0xe9')]+=0x1,'scheduledat':moment()[_0xdc69('0xf0')](_0x5a6023['dialDropRetryFrequency'],_0xdc69('0xf1'))[_0xdc69('0x8f')](_0xdc69('0xfa')),'ContactId':_0x348caa[_0xdc69('0xfb')],'ListId':_0x348caa[_0xdc69('0xca')],'VoiceQueueId':_0x348caa[_0xdc69('0xcb')]||undefined,'CampaignId':_0x348caa['CampaignId']||undefined})[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x113')));}break;case 0xb:if(_0x348caa[_0xdc69('0x118')]>=_0x5a6023['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0xdc69('0xb9')]({'active':![],'countabandonedretry':_0x348caa[_0xdc69('0x118')]+=0x1,'scheduledat':moment()['add'](_0x5a6023[_0xdc69('0x11a')],'minutes')[_0xdc69('0x8f')](_0xdc69('0xfa')),'ContactId':_0x348caa['ContactId'],'ListId':_0x348caa['ListId'],'VoiceQueueId':_0x348caa[_0xdc69('0xcb')]||undefined,'CampaignId':_0x348caa[_0xdc69('0xcc')]||undefined})[_0xdc69('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x348caa[_0xdc69('0xe2')]>=_0x5a6023[_0xdc69('0xed')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x348caa[_0xdc69('0xe2')]+=0x1,'scheduledat':moment()[_0xdc69('0xf0')](_0x5a6023[_0xdc69('0xf9')],'minutes')['format'](_0xdc69('0xfa')),'ContactId':_0x348caa[_0xdc69('0xfb')],'ListId':_0x348caa[_0xdc69('0xca')],'VoiceQueueId':_0x348caa[_0xdc69('0xcb')]||undefined,'CampaignId':_0x348caa[_0xdc69('0xcc')]||undefined})['catch'](loggerCatch(_0xdc69('0xf2')));}break;case 0x14:if(_0x348caa[_0xdc69('0xea')]>=_0x5a6023[_0xdc69('0x1a2')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x348caa[_0xdc69('0xea')]+=0x1,'scheduledat':moment()[_0xdc69('0xf0')](_0x5a6023[_0xdc69('0x1a3')],'minutes')[_0xdc69('0x8f')](_0xdc69('0xfa')),'ContactId':_0x348caa['ContactId'],'ListId':_0x348caa['ListId'],'VoiceQueueId':_0x348caa['VoiceQueueId']||undefined,'CampaignId':_0x348caa[_0xdc69('0xcc')]||undefined})[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x1a4')));}break;default:return!![];}};Dialer[_0xdc69('0xa6')][_0xdc69('0x193')]=function(_0x17e602,_0x54c063,_0xff70a0){var _0x10f729=this;var _0x1171e3=new History(_0x17e602);return new BPromise(function(_0x29bb76,_0x504bf2){if(_[_0xdc69('0x7f')](_0x54c063)&&_0xdc69('0x161')!==typeof _0x54c063){return _0x504bf2(msgResponse(_0xdc69('0x1a5'),_0xdc69('0x13c'),_0xdc69('0x1a6')));}if(_[_0xdc69('0x7f')](_0xff70a0)&&_0xdc69('0x161')!==typeof _0xff70a0){return _0x504bf2(msgResponse(_0xdc69('0x1a5'),_0xdc69('0x13c'),_0xdc69('0x1a7')));}switch(_0xff70a0[_0xdc69('0x103')]){case'0':_0x54c063['outboundNoSuchCallsDay']+=0x1;_0x1171e3[_0xdc69('0xa3')]=0x0;_0x1171e3[_0xdc69('0xdc')]=_0xdc69('0x1a8');_0x1171e3[_0xdc69('0xe8')]+=0x1;_0x1171e3[_0xdc69('0xe3')]+=0x1;ami[_0xdc69('0x1a9')](_0xdc69('0x1aa'),ut[_0xdc69('0x1ab')](_0x17e602,_0xdc69('0x1ac')));_0x10f729[_0xdc69('0xc2')](_0x1171e3)[_0xdc69('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x10f729['checkRetriveMax'](0x0,_0x17e602,_0x54c063)){if(_0x1171e3[_0xdc69('0xe8')]>=_0x54c063[_0xdc69('0x19f')]){_0x10f729[_0xdc69('0xee')](_0x1171e3,_0x29bb76,_0x504bf2,'reason\x200\x20no\x20such\x20number....');}else{_0x10f729['stateGlobal'](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1ad'));}}break;case'3':_0x54c063[_0xdc69('0x60')]+=0x1;_0x1171e3['state']=0x3;_0x1171e3[_0xdc69('0xdc')]='NoAnswer';_0x1171e3[_0xdc69('0xe7')]+=0x1;_0x1171e3['countglobal']+=0x1;ami[_0xdc69('0x1a9')](_0xdc69('0x1ae'),ut['buildObj'](_0x17e602,_0xdc69('0x1af')));_0x10f729[_0xdc69('0xc2')](_0x1171e3)[_0xdc69('0xb2')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x10f729[_0xdc69('0x195')](0x3,_0x17e602,_0x54c063)){if(_0x1171e3['countnoanswerretry']>=_0x54c063[_0xdc69('0x1b0')]){_0x10f729[_0xdc69('0xee')](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1b1'));}else{_0x10f729[_0xdc69('0xeb')](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1b1'));}}break;case'5':_0x54c063[_0xdc69('0x1b2')]+=0x1;_0x1171e3[_0xdc69('0xa3')]=0x5;_0x1171e3[_0xdc69('0xdc')]='Busy';_0x1171e3['countbusyretry']+=0x1;_0x1171e3['countglobal']+=0x1;ami['emit'](_0xdc69('0x1b3'),ut[_0xdc69('0x1ab')](_0x17e602,_0xdc69('0x1b4')));_0x10f729[_0xdc69('0xc2')](_0x1171e3)['catch'](loggerCatch(_0xdc69('0x1b5')));if(_0x10f729[_0xdc69('0x195')](0x5,_0x17e602,_0x54c063)){if(_0x1171e3[_0xdc69('0x196')]>=_0x54c063[_0xdc69('0x199')]){_0x10f729[_0xdc69('0xee')](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1b6'));}else{_0x10f729[_0xdc69('0xeb')](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1b6'));}}break;case'8':_0x54c063[_0xdc69('0x1b7')]+=0x1;_0x1171e3[_0xdc69('0xa3')]=0x8;_0x1171e3['statedesc']=_0xdc69('0x1b8');_0x1171e3['countcongestionretry']+=0x1;_0x1171e3[_0xdc69('0xe3')]+=0x1;ami[_0xdc69('0x1a9')](_0xdc69('0x1b9'),ut[_0xdc69('0x1ab')](_0x17e602,'congestion'));_0x10f729[_0xdc69('0xc2')](_0x1171e3)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x10f729[_0xdc69('0x195')](0x8,_0x17e602,_0x54c063)){if(_0x1171e3[_0xdc69('0xe6')]>=_0x54c063[_0xdc69('0x19c')]){_0x10f729[_0xdc69('0xee')](_0x1171e3,_0x29bb76,_0x504bf2,'reason\x208\x20congestion');}else{_0x10f729['stateGlobal'](_0x1171e3,_0x29bb76,_0x504bf2,'reason\x208\x20congestion');}}break;case'11':_0x54c063['outboundAbandonedCallsDay']+=0x1;_0x1171e3[_0xdc69('0xa3')]=0xb;_0x1171e3['statedesc']='Abandoned';_0x1171e3[_0xdc69('0x118')]+=0x1;_0x1171e3[_0xdc69('0xe3')]+=0x1;_0x10f729[_0xdc69('0xc2')](_0x1171e3)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x11b')));if(_0x10f729[_0xdc69('0x195')](0xb,_0x17e602,_0x54c063)){if(_0x1171e3[_0xdc69('0x118')]>=_0x54c063['dialAbandonedMaxRetry']){_0x10f729[_0xdc69('0xee')](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1ba'));}else{_0x10f729[_0xdc69('0xeb')](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1ba'));}}break;case'20':_0x54c063[_0xdc69('0x1bb')]+=0x1;_0x1171e3[_0xdc69('0xa3')]=0x14;_0x1171e3['statedesc']=_0xdc69('0x1bc');_0x1171e3[_0xdc69('0xea')]+=0x1;_0x1171e3[_0xdc69('0xe3')]+=0x1;ami[_0xdc69('0x1a9')](_0xdc69('0x1bd'),ut[_0xdc69('0x1ab')](_0x17e602,'agentreject'));_0x10f729['createHistory'](_0x1171e3)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x1be')));if(_0x10f729[_0xdc69('0x195')](0x14,_0x17e602,_0x54c063)){if(_0x1171e3[_0xdc69('0xea')]>=_0x54c063['dialAgentRejectMaxRetry']){_0x10f729[_0xdc69('0xee')](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1bf'));}else{_0x10f729[_0xdc69('0xeb')](_0x1171e3,_0x29bb76,_0x504bf2,_0xdc69('0x1bf'));}}break;default:_0x54c063[_0xdc69('0x63')]+=0x1;_0x1171e3['state']=0xc;_0x1171e3[_0xdc69('0xdc')]=_0xff70a0['reason'];_0x10f729[_0xdc69('0xc2')](_0x1171e3)[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x1c0')));if(_0x10f729['checkRetriveMax'](_0xff70a0['reason'],_0x17e602,_0x54c063)){if(_0x1171e3['countbusyretry']+_0x1171e3[_0xdc69('0xe6')]+_0x1171e3['countnoanswerretry']+_0x1171e3[_0xdc69('0xe8')]+_0x1171e3[_0xdc69('0xe9')]+_0x1171e3['countabandonedretry']+_0x1171e3['countmachineretry']+_0x1171e3[_0xdc69('0xea')]>=_0x54c063[_0xdc69('0xf8')]){_0x10f729[_0xdc69('0xeb')](_0x1171e3,_0x29bb76,_0x504bf2,_0xff70a0['reason']);}else{_0x10f729[_0xdc69('0xee')](_0x1171e3,_0x29bb76,_0x504bf2,_0xff70a0['reason']);}}}});};Dialer[_0xdc69('0xa6')][_0xdc69('0xeb')]=function(_0x3ad094,_0x153809,_0x2d7e34,_0x500e03){var _0x5b238a=new Final(_0x3ad094);_0x5b238a[_0xdc69('0xa3')]=0xf;_0x5b238a[_0xdc69('0xdc')]=_0xdc69('0x1c1');this[_0xdc69('0xee')](_0x5b238a,_0x153809,_0x2d7e34,_0x500e03);};Dialer['prototype'][_0xdc69('0xee')]=function(_0x12b288,_0x195869,_0x4b52c2,_0x137bcc){this[_0xdc69('0xc0')](_0x12b288)[_0xdc69('0xb5')](function(_0x3b70a8){return _0x195869(msgResponse(_0xdc69('0x1a5'),'Success',_0x137bcc));})[_0xdc69('0xb2')](function(_0x10df79){return _0x4b52c2(msgResponse(_0xdc69('0x1c2'),_0xdc69('0x13c'),'contact\x20not\x20moved'));});};Dialer[_0xdc69('0xa6')][_0xdc69('0xa')]=function(_0x46a5ba){var _0x329914=this;var _0x1f46da=_0x46a5ba[_0xdc69('0x1c3')]/0x64;var _0xeaf610=_0x46a5ba[_0xdc69('0x5f')]/(_0x46a5ba[_0xdc69('0x5f')]+_0x46a5ba[_0xdc69('0x5b')]);var _0x42e827=Math[_0xdc69('0x1c4')](_0x46a5ba[_0xdc69('0x6c')]*(_0x46a5ba[_0xdc69('0x1c5')]/0x64));var _0xa0a1cc=Math[_0xdc69('0x1c4')](_0x46a5ba[_0xdc69('0x6c')]*(_0x46a5ba[_0xdc69('0x1c6')]/0x64));var _0x38e51e=_0x46a5ba[_0xdc69('0x9c')]+_0x46a5ba[_0xdc69('0x9b')];var _0x1d5a8d=Math[_0xdc69('0x1c7')](_0x46a5ba[_0xdc69('0x6f')]*_0x46a5ba[_0xdc69('0x71')]*_0x46a5ba[_0xdc69('0x69')]*_0x46a5ba[_0xdc69('0x6a')]);if(_[_0xdc69('0x7f')](_0x46a5ba[_0xdc69('0x72')])){if(!_[_0xdc69('0x7f')](_0x46a5ba[_0xdc69('0x2a')])){_0x46a5ba[_0xdc69('0x2a')]=undefined;loggerPredictive['error'](_0xdc69('0x1c8'),_0xdc69('0x1c9'));}if(!_[_0xdc69('0x7f')](_0x46a5ba['handlePredictive'])){loggerPredictive[_0xdc69('0x91')](_0xdc69('0x1c8'),_0xdc69('0x1ca'));clearInterval(_0x46a5ba[_0xdc69('0x8c')]);_0x46a5ba[_0xdc69('0x8c')]=undefined;}_0x46a5ba['startProgressive']=moment()[_0xdc69('0x8f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x46a5ba['name'],_0xdc69('0x1cb'),_0x46a5ba[_0xdc69('0x72')]);this[_0xdc69('0x152')](_0x46a5ba,0x1);}else if(ifInterval(_0x46a5ba[_0xdc69('0x1cc')],_0x46a5ba[_0xdc69('0x72')])){this['handlePower'](_0x46a5ba,0x1);loggerPredictiveCalls[_0xdc69('0x78')](_0xdc69('0x1cd'),_0x46a5ba[_0xdc69('0x72')],_0x46a5ba[_0xdc69('0x3f')]);_0x46a5ba[_0xdc69('0x6f')]=0x0;_0x46a5ba[_0xdc69('0x110')]=0x0;}else if(_0x1f46da<_0xeaf610&&_0x46a5ba[_0xdc69('0x1ce')]===_0xdc69('0x1cf')){freeVariablesPredictive(_0x46a5ba);loggerPredictive['info'](_0xdc69('0x1d0'),_0xdc69('0x1d1'),_0xeaf610,_0xdc69('0x72'),_0x46a5ba['name']);}else if(_0x1d5a8d<_0x46a5ba[_0xdc69('0x110')]&&_0x46a5ba[_0xdc69('0x1ce')]===_0xdc69('0x1cf')){freeVariablesPredictive(_0x46a5ba);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x1d2'),'Max\x20Drop\x20',_0x1d5a8d,'Drop\x20in\x20this\x20interval',_0x46a5ba[_0xdc69('0x110')],_0xdc69('0x72'),_0x46a5ba[_0xdc69('0x3f')]);}else if(!ifInterval(_0x46a5ba[_0xdc69('0x1cc')],_0x46a5ba[_0xdc69('0x72')])&&_[_0xdc69('0x7f')](_0x46a5ba[_0xdc69('0x2a')])&&!_['isUndefined'](_0x46a5ba['startProgressive'])){_0x46a5ba[_0xdc69('0x2a')]=moment()[_0xdc69('0x8f')](_0xdc69('0xfa'));loggerPredictive[_0xdc69('0x78')](_0x46a5ba[_0xdc69('0x3f')],_0xdc69('0x1d3'),_0x46a5ba[_0xdc69('0x2a')]);this[_0xdc69('0x1d4')](_0x46a5ba['dialPredictiveInterval'])[_0xdc69('0xb5')](this[_0xdc69('0x1d5')](_0x46a5ba))[_0xdc69('0xb5')](mergeDataErlangB(_0x46a5ba))[_0xdc69('0xb5')](this[_0xdc69('0x1d6')](_0x46a5ba))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x46a5ba));}else if(!ifInterval(_0x46a5ba['dialPredictiveInterval'],_0x46a5ba[_0xdc69('0x2a')])){_0x46a5ba[_0xdc69('0x110')]=0x0;_0x46a5ba[_0xdc69('0x2a')]=moment()[_0xdc69('0x8f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xdc69('0x78')](_0x46a5ba['name'],_0xdc69('0x1d7'),_0x46a5ba[_0xdc69('0x2a')]);clearInterval(_0x46a5ba[_0xdc69('0x8c')]);_0x46a5ba[_0xdc69('0x8c')]=undefined;this['averageHandleTime'](_0x46a5ba[_0xdc69('0x1cc')])[_0xdc69('0xb5')](this[_0xdc69('0x1d5')](_0x46a5ba))[_0xdc69('0xb5')](mergeDataErlangB(_0x46a5ba))[_0xdc69('0xb5')](this['startMethodPredictive'](_0x46a5ba))[_0xdc69('0xb2')](loggerCatchPredictive(_0xdc69('0x1d8'),_0x46a5ba));}else if(_0x46a5ba[_0xdc69('0x6c')]&&_0x38e51e<_0x46a5ba[_0xdc69('0x6c')]-_0xa0a1cc){freeVariablesPredictive(_0x46a5ba);loggerPredictive['info'](_0x46a5ba[_0xdc69('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x38e51e,_0xdc69('0x1d9'),_0x46a5ba[_0xdc69('0x6c')],'-',_0xa0a1cc,'=',_0x46a5ba[_0xdc69('0x6c')]-_0xa0a1cc,')');}else if(_0x46a5ba[_0xdc69('0x6c')]&&_0x38e51e>_0x46a5ba['predictiveIntervalAvailable']+_0x42e827){freeVariablesPredictive(_0x46a5ba);loggerPredictive[_0xdc69('0x78')](_0x46a5ba['name'],_0xdc69('0x1da'),_0x38e51e,_0xdc69('0x1db'),_0x46a5ba['predictiveIntervalAvailable'],'+',_0x42e827,'=',_0x46a5ba['predictiveIntervalAvailable']+_0x42e827,')');}};Dialer[_0xdc69('0xa6')][_0xdc69('0x1d5')]=function(_0x5e945c){var _0x53843b=this;return function(_0x592429){return new BPromise(function(_0x3042c7,_0x3eee07){_[_0xdc69('0x88')](_0x5e945c,_0x592429[0x0]);if(checkGetDataPredictive(_0x592429[0x0])){var _0x97a748=_0x5e945c[_0xdc69('0x6c')]=_0x5e945c[_0xdc69('0x9b')]+_0x5e945c[_0xdc69('0x9c')];var _0x3e4520=_0x5e945c[_0xdc69('0x1cc')]*0x3c;var _0xd3e2f=_0x592429[0x0][_0xdc69('0x66')]+_0x592429[0x0][_0xdc69('0x65')];var _0x4c9cea=(_0x592429[0x0][_0xdc69('0x64')]+_0x592429[0x0][_0xdc69('0x68')]+_0x592429[0x0][_0xdc69('0x67')])/_0x592429[0x0][_0xdc69('0x6d')];_0x5e945c[_0xdc69('0x69')]=_0x4c9cea>0x0?_0x4c9cea:0x1;switch(_0x5e945c['dialPredictiveOptimization']){case'dropRate':var _0x243d19=_0x5e945c[_0xdc69('0x1c3')]/0x64;return _0x53843b['abandonmentRate'](_0x97a748,_0x3e4520,_0xd3e2f,_0x4c9cea,_0x243d19)['then'](function(_0x4bfd05){return _0x3042c7(_0x4bfd05);});case _0xdc69('0x1dc'):var _0x16cd0d=_0x5e945c['dialPredictiveOptimizationPercentage']/0x64;return _0x53843b[_0xdc69('0x1dd')](_0x97a748,_0x3e4520,_0xd3e2f,_0x4c9cea,_0x16cd0d)[_0xdc69('0xb5')](function(_0x19bf03){return _0x3042c7(_0x19bf03);});default:return _0x3eee07(msgResponse(_0xdc69('0x1de'),'Failure',_0xdc69('0x1df')));}}else{return _0x3eee07(msgResponse(_0xdc69('0x1de'),_0xdc69('0x13c'),_0xdc69('0x1e0')));}});};};Dialer['prototype'][_0xdc69('0x1e1')]=function(_0x2b7899){var _0x3aa839=this;return function(_0x34e3f7){return new BPromise(function(_0x195d87,_0x2b46f8){_['merge'](_0x2b7899,_0x34e3f7[0x0]);if(checkGetDataPredictive(_0x34e3f7[0x0])){loggerPredictive['info'](JSON[_0xdc69('0x4b')](_0x34e3f7[0x0]));if(_0x2b7899['dialPredictiveOptimization']===_0xdc69('0x1cf')){return _0x3aa839['getVoiceQueueRtPauses'](_0x2b7899['id'])[_0xdc69('0xb5')](function(_0x59d5fb){var _0x38a0b6=_0x2b7899[_0xdc69('0x50')]-_0x59d5fb[0x0]['outboundQueuePauses'];var _0x5db3f7=_0x2b7899[_0xdc69('0x1cc')]*0x3c;var _0x2e0dc7=_0x34e3f7[0x0][_0xdc69('0x66')]+_0x34e3f7[0x0]['predictiveIntervalAvgHoldtime'];var _0xe9fc5a=(_0x34e3f7[0x0]['predictiveIntervalAnsweredCalls']+_0x34e3f7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x34e3f7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x34e3f7[0x0][_0xdc69('0x6d')];var _0x33fd05=_0x2b7899[_0xdc69('0x1c3')]/0x64;_0x2b7899[_0xdc69('0x6b')]=_0x59d5fb[0x0][_0xdc69('0x1e2')]||0x0;_0x2b7899[_0xdc69('0x69')]=_0xe9fc5a>0x0?_0xe9fc5a:0x1;return _0x3aa839[_0xdc69('0x1e3')](_0x38a0b6,_0x5db3f7,_0x2e0dc7,_0xe9fc5a,_0x33fd05);})[_0xdc69('0xb5')](function(_0x57491a){return _0x195d87(_0x57491a);})['catch'](function(_0x32f664){return _0x2b46f8(msgResponse(_0xdc69('0x1e4'),_0xdc69('0x13c'),JSON[_0xdc69('0x4b')](_0x32f664)));});}if(_0x2b7899['dialPredictiveOptimization']===_0xdc69('0x1dc')){return _0x3aa839['getVoiceQueueRtPauses'](_0x2b7899['id'])['then'](function(_0x47b4d9){var _0x489157=_0x2b7899[_0xdc69('0x50')]-_0x47b4d9[0x0][_0xdc69('0x1e2')];var _0x5d0210=_0x2b7899['dialPredictiveInterval']*0x3c;var _0x547a25=_0x34e3f7[0x0][_0xdc69('0x66')]+_0x34e3f7[0x0][_0xdc69('0x65')];var _0x393f29=(_0x34e3f7[0x0]['predictiveIntervalAnsweredCalls']+_0x34e3f7[0x0][_0xdc69('0x68')]+_0x34e3f7[0x0][_0xdc69('0x67')])/_0x34e3f7[0x0][_0xdc69('0x6d')];var _0x9f21db=_0x2b7899[_0xdc69('0x1c3')]/0x64;_0x2b7899[_0xdc69('0x6b')]=_0x47b4d9[0x0][_0xdc69('0x1e2')]||0x0;_0x2b7899[_0xdc69('0x69')]=_0x393f29>0x0?_0x393f29:0x1;return _0x3aa839['busyFactor'](_0x489157,_0x5d0210,_0x547a25,_0x393f29,_0x9f21db);})[_0xdc69('0xb5')](function(_0x32d484){return _0x195d87(_0x32d484);})['catch'](function(_0x1c48e7){return _0x2b46f8(msgResponse(_0xdc69('0x1e4'),'Failure',JSON['stringify'](_0x1c48e7)));});}}else{return _0x2b46f8(msgResponse('[getDataPredictive]',_0xdc69('0x13c'),_0xdc69('0x1e0')));}});};};Dialer['prototype'][_0xdc69('0x1d6')]=function(_0x55561f){var _0x4b9eda=this;return function(){var _0x2dbc24=0x0;var _0x69cbba=Math[_0xdc69('0x1c7')](_0x55561f[_0xdc69('0x70')]*0x3e8);if(_0x69cbba>0x0){_0x69cbba=_0x69cbba<0x64?0x64:_0x69cbba;loggerPredictive[_0xdc69('0x78')](_0x55561f['name'],_0xdc69('0x1e5'),_0x69cbba,_0xdc69('0x4c'));_0x55561f[_0xdc69('0x8c')]=setInterval(function(){_0x4b9eda[_0xdc69('0x8c')](_0x55561f);loggerPredictiveCalls[_0xdc69('0x78')](_0xdc69('0x1e6'),_0x2dbc24+=0x1);},_0x69cbba);}else{loggerPredictive['info'](_0x55561f[_0xdc69('0x3f')],_0xdc69('0x1e7'));}};};Dialer[_0xdc69('0xa6')][_0xdc69('0x1e8')]=function(_0x119599,_0x3c234a){var _0x22e23c=this;return function(_0x1e794d){if(_[_0xdc69('0x47')](_0x1e794d)){if(_['isNil'](_0x3c234a[_0xdc69('0x1e9')])||!_0x3c234a['recallme']){if(_0x119599[_0xdc69('0x156')]===_0xdc69('0x9')){_0x119599[_0xdc69('0x123')]=_['isUndefined'](_0x119599[_0xdc69('0x123')])?!![]:_0x119599['queueStatusComplete'];var _0x4d505d=uuid['v4']();_0x22e23c[_0xdc69('0xa8')][_0x4d505d]=new Action(_0x119599,_0x3c234a,_0x4d505d);loggerBooked[_0xdc69('0x78')]('[booked][checkContactBlack]',_0x4d505d,_0xdc69('0x1ea'),JSON[_0xdc69('0x4b')](_0x119599[_0xdc69('0x123')]),_0xdc69('0x1eb'),_0x119599[_0xdc69('0x3f')]);if(_0x119599[_0xdc69('0x123')]){_0x119599[_0xdc69('0x123')]=![];_0x22e23c['queueBooked'][_0x22e23c[_0xdc69('0xa8')][_0x4d505d][_0xdc69('0xae')]]=[];ami[_0xdc69('0x143')]({'actionid':_0x4d505d,'action':_0xdc69('0x1ec'),'queue':_0x119599['name']})['catch'](function(_0x3bea69){_0x22e23c['updateOriginated'](_0x119599);_0x22e23c[_0xdc69('0xb9')]({'active':![],'ContactId':_0x22e23c[_0xdc69('0xa8')][_0x4d505d]['ContactId'],'ListId':_0x22e23c[_0xdc69('0xa8')][_0x4d505d][_0xdc69('0xca')],'VoiceQueueId':_0x22e23c[_0xdc69('0xa8')][_0x4d505d][_0xdc69('0xcb')]||undefined,'CampaignId':_0x22e23c[_0xdc69('0xa8')][_0x4d505d]['CampaignId']||undefined})[_0xdc69('0xb2')](loggerCatch(_0xdc69('0x1ed')));delete _0x22e23c['actions'][_0x4d505d];});}else{loggerBooked[_0xdc69('0x78')](_0xdc69('0x1ee'),JSON['stringify'](_0x119599[_0xdc69('0x123')]),_0xdc69('0x1eb'),_0x119599[_0xdc69('0x3f')]);_0x22e23c[_0xdc69('0xc6')](_0x119599);_0x22e23c[_0xdc69('0xb9')]({'active':![],'ContactId':_0x22e23c['actions'][_0x4d505d]['ContactId'],'ListId':_0x22e23c[_0xdc69('0xa8')][_0x4d505d][_0xdc69('0xca')],'VoiceQueueId':_0x22e23c[_0xdc69('0xa8')][_0x4d505d][_0xdc69('0xcb')]||undefined,'CampaignId':_0x22e23c[_0xdc69('0xa8')][_0x4d505d][_0xdc69('0xcc')]||undefined})['catch'](loggerCatch(_0xdc69('0x1ed')));delete _0x22e23c[_0xdc69('0xa8')][_0x4d505d];}}else{return _0x22e23c['actionOriginate'](_0x119599,_0x3c234a);}}else{if(getDiff(_0x3c234a[_0xdc69('0x1ef')])<_0x119599[_0xdc69('0x1f0')]*0x3c){if(_0x3c234a['Agent']&&!_0x3c234a[_0xdc69('0x1f1')][_0xdc69('0x1f2')]){_0x22e23c[_0xdc69('0x1f3')]['run'](_0x3c234a['id'])[_0xdc69('0x127')](function(){_0x22e23c[_0xdc69('0xc6')](_0x119599);});}else{_0x22e23c[_0xdc69('0xbb')]({'active':![]},_0x3c234a['id'],0x1)[_0xdc69('0x127')](function(){console[_0xdc69('0x1f4')]('Contact\x20updated');_0x22e23c[_0xdc69('0xc6')](_0x119599);});}}else{_0x119599[_0xdc69('0x1f5')]+=0x1;_0x22e23c[_0xdc69('0xc6')](_0x119599);if(_0x119599[_0xdc69('0x1f6')]){_0x22e23c[_0xdc69('0xb9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c234a[_0xdc69('0xfb')],'ListId':_0x3c234a[_0xdc69('0xca')],'VoiceQueueId':_0x3c234a[_0xdc69('0xcb')]||undefined,'CampaignId':_0x3c234a[_0xdc69('0xcc')]||undefined})['catch'](loggerCatch(_0xdc69('0x1f7')));_0x22e23c[_0xdc69('0xc2')](createObjHistory(_0x119599,_0x3c234a,_0xdc69('0x1f8'),0x17,'RecallInQueue'))[_0xdc69('0xb2')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x22e23c['saveInDb'](createObjHistory(_0x119599,_0x3c234a,_0xdc69('0x1f9'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x119599['outboundBlacklistCallsDay']+=0x1;_0x22e23c['saveInDb'](createObjHistory(_0x119599,_0x3c234a,'BLACKLIST',0xd,_0xdc69('0x1fa')),_0xdc69('0x1fb'),_0xdc69('0x1fc'));throw _0xdc69('0x1fd');}};};Dialer[_0xdc69('0xa6')][_0xdc69('0x155')]=function(_0x12d468){var _0x4d2401=this;var _0x3e227e=[];var _0x55d76f=_0x12d468['limitCalls']-_0x12d468[_0xdc69('0x6e')]-_0x12d468[_0xdc69('0x1fe')];emitCampaignSummary(_0x12d468);if(_0x55d76f>0x0){if(_0x55d76f>this[_0xdc69('0x25')]){_0x55d76f=this['maxNumberOriginate'];}_0x12d468[_0xdc69('0x1fe')]+=_0x55d76f;this[_0xdc69('0xbe')](_0x12d468['id'],_0x55d76f,_0x12d468[_0xdc69('0x1ff')])['then'](function(_0x1c5090){_0x12d468[_0xdc69('0x1fe')]-=_0x55d76f;_0x12d468[_0xdc69('0x1fe')]=_0x12d468[_0xdc69('0x1fe')]>0x0?_0x12d468[_0xdc69('0x1fe')]:0x0;if(!checkContactEmpty(_0x1c5090)){_0x12d468['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xdc69('0x200')+_0x12d468[_0xdc69('0x3f')]);}else{_0x12d468[_0xdc69('0x6e')]+=_0x1c5090['length'];_0x12d468['message']='RUNNING';for(var _0x1491fe=0x0;_0x1491fe<_0x1c5090[_0xdc69('0x93')];_0x1491fe+=0x1){_0x12d468['ivrTotalCallsDays']+=0x1;if(_[_0xdc69('0xd7')](_0x1c5090[_0x1491fe])||_[_0xdc69('0xd7')](_0x1c5090[_0x1491fe]['Contact'])||_[_0xdc69('0xd7')](_0x1c5090[_0x1491fe][_0xdc69('0x163')]['phone'])){_0x4d2401[_0xdc69('0x201')](_0xdc69('0x202'),_0x12d468,_0x1c5090[_0x1491fe]);}else{_0x4d2401[_0xdc69('0x203')](_['pick'](_0x1c5090[_0x1491fe],[_0xdc69('0xcc'),_0xdc69('0x204')]))[_0xdc69('0xb5')](_0x4d2401[_0xdc69('0x1e8')](_0x12d468,_0x1c5090[_0x1491fe]))['catch'](_0x4d2401[_0xdc69('0x205')]('[actionOriginateIvr]\x20',_0x12d468));}}}})[_0xdc69('0xb2')](loggerGetContactDialer(_0xdc69('0x206'),_0x12d468,_0x55d76f));}};Dialer['prototype'][_0xdc69('0x152')]=function(_0x4af2d6,_0x321dcf){var _0x55e4cc=this;var _0x54757a=[];var _0x83206c=_0x321dcf>=0x1?_0x321dcf:0x1;var _0x36aca3=[];if(_0x4af2d6[_0xdc69('0x156')]==='booked'){_0x83206c=0x1;}var _0x557c8d=Math['floor'](_0x4af2d6[_0xdc69('0x9c')]*_0x83206c)-_0x4af2d6[_0xdc69('0x6e')]-_0x4af2d6[_0xdc69('0x1fe')];emitVoiceQueueSummary(_0x4af2d6);if(_0x4af2d6[_0xdc69('0x207')]>0x0){var _0x4dc93c=_0x4af2d6[_0xdc69('0x207')]-_0x4af2d6[_0xdc69('0x6e')]-_0x4af2d6[_0xdc69('0x9b')]-_0x4af2d6[_0xdc69('0x1fe')]-_0x4af2d6[_0xdc69('0x51')];if(_0x557c8d>_0x4dc93c){_0x557c8d=_0x4dc93c;}}if(_0x557c8d>0x0){if(_0x4af2d6[_0xdc69('0x156')]===_0xdc69('0x9')){_0x557c8d=0x1;}if(_0x557c8d>this['maxNumberOriginate']){_0x557c8d=this[_0xdc69('0x25')];}_0x4af2d6[_0xdc69('0x1fe')]+=_0x557c8d;for(var _0x398314 in this[_0xdc69('0x23')]){if(this['agents'][_0xdc69('0x94')](_0x398314)){if(this[_0xdc69('0x23')][_0x398314]['state']===_0xdc69('0x208')&&this['agents'][_0x398314]['status']===_0xdc69('0x209')){_0x54757a[_0xdc69('0x120')](this[_0xdc69('0x23')][_0x398314]['id']);}}}this[_0xdc69('0xbc')](_0x4af2d6['id'],_0x54757a,_0x557c8d,_0x4af2d6[_0xdc69('0x1ff')])[_0xdc69('0xb5')](function(_0x4c6594){_0x4af2d6['temp']-=_0x557c8d;_0x4af2d6[_0xdc69('0x1fe')]=_0x4af2d6['temp']>0x0?_0x4af2d6['temp']:0x0;if(!checkContactEmpty(_0x4c6594)){_0x55e4cc['countReScheduled'](_0x4af2d6)[_0xdc69('0xb5')](sendMessageReschedule(_0x4af2d6))[_0xdc69('0xb2')](loggerCatch(_0xdc69('0xb3')));}else{_0x4af2d6[_0xdc69('0x6e')]+=_0x4c6594['length'];_0x4af2d6[_0xdc69('0x41')]=_0x4af2d6[_0xdc69('0x156')]==='booked'?_0xdc69('0x16d'):_0xdc69('0x20a');for(var _0x1c863a=0x0;_0x1c863a<_0x4c6594[_0xdc69('0x93')];_0x1c863a+=0x1){if(_[_0xdc69('0xd7')](_0x4c6594[_0x1c863a])||_[_0xdc69('0xd7')](_0x4c6594[_0x1c863a][_0xdc69('0x163')])||_[_0xdc69('0xd7')](_0x4c6594[_0x1c863a][_0xdc69('0x163')][_0xdc69('0x164')])){_0x55e4cc[_0xdc69('0x201')](_0xdc69('0x202'),_0x4af2d6,_0x4c6594[_0x1c863a]);}else{_0x55e4cc[_0xdc69('0xb6')](_[_0xdc69('0xc9')](_0x4c6594[_0x1c863a],[_0xdc69('0xcb'),_0xdc69('0x204')]))[_0xdc69('0xb5')](_0x55e4cc[_0xdc69('0x1e8')](_0x4af2d6,_0x4c6594[_0x1c863a]))['catch'](_0x55e4cc[_0xdc69('0x205')]('[actionOriginate]\x20',_0x4af2d6));}}}})[_0xdc69('0xb2')](loggerGetContactDialer(_0xdc69('0x20b'),_0x4af2d6,_0x557c8d));}};Dialer[_0xdc69('0xa6')]['handlePredictive']=function(_0x38847e){var _0x12ce9a=this;if(_0x38847e[_0xdc69('0x207')]>0x0){var _0x5f134f=_0x38847e[_0xdc69('0x207')]-_0x38847e['originated']-_0x38847e[_0xdc69('0x9b')];if(_0x5f134f>0x0){this[_0xdc69('0x20c')](_0x38847e);}else{loggerPredictiveCalls['info'](_0xdc69('0x20d'));}}else{this[_0xdc69('0x20c')](_0x38847e);}};Dialer[_0xdc69('0xa6')][_0xdc69('0x20c')]=function(_0x4a997c){var _0xe6fb0a=this;var _0x5b4adc=[];_0x4a997c['originated']+=0x1;for(var _0x467529 in this[_0xdc69('0x23')]){if(this[_0xdc69('0x23')][_0xdc69('0x94')](_0x467529)){if(this['agents'][_0x467529]['state']===_0xdc69('0x208')&&this[_0xdc69('0x23')][_0x467529][_0xdc69('0xab')]===_0xdc69('0x209')){_0x5b4adc[_0xdc69('0x120')](this[_0xdc69('0x23')][_0x467529]['id']);}}}this[_0xdc69('0xbc')](_0x4a997c['id'],_0x5b4adc,0x1,_0x4a997c[_0xdc69('0x1ff')])[_0xdc69('0xb5')](function(_0x50ab26){if(!checkContactEmpty(_0x50ab26)){checkContactLowerLimitOriginate(_0x4a997c,0x1,0x0);_0xe6fb0a[_0xdc69('0xb1')](_0x4a997c)['then'](sendMessageReschedule(_0x4a997c))[_0xdc69('0xb2')](loggerCatch('[countReScheduled]\x20'));}else{_0x4a997c[_0xdc69('0x41')]=_0xdc69('0x20a');if(_['isNil'](_0x50ab26[0x0])||_[_0xdc69('0xd7')](_0x50ab26[0x0][_0xdc69('0x163')])||_[_0xdc69('0xd7')](_0x50ab26[0x0]['Contact'][_0xdc69('0x164')])){_0xe6fb0a[_0xdc69('0x201')](_0xdc69('0x202'),_0x4a997c,_0x50ab26[0x0]);}else{_0xe6fb0a[_0xdc69('0xb6')](_[_0xdc69('0xc9')](_0x50ab26[0x0],['VoiceQueueId',_0xdc69('0x204')]))['then'](_0xe6fb0a[_0xdc69('0x1e8')](_0x4a997c,_0x50ab26[0x0]))[_0xdc69('0xb2')](_0xe6fb0a[_0xdc69('0x205')](_0xdc69('0x20e'),_0x4a997c));}}})['catch'](loggerGetContactDialer(_0xdc69('0x20f'),_0x4a997c,0x1));emitVoiceQueueSummary(_0x4a997c);};Dialer[_0xdc69('0xa6')][_0xdc69('0x1e3')]=function(_0x32cca0,_0x30ce34,_0x40af77,_0x2409ed,_0x53b7c1,_0x5cadb9){loggerPredictive[_0xdc69('0x78')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xdc69('0x78')](_0xdc69('0x210'),_0x32cca0);loggerPredictive[_0xdc69('0x78')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30ce34);loggerPredictive[_0xdc69('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',_0x40af77);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x211'),_0x2409ed);loggerPredictive['info'](_0xdc69('0x212'),_0x53b7c1);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x7e'));return new BPromise(function(_0xd9078c,_0x3ad91b){if(_0x32cca0<=0x0||isNaN(_0x32cca0)){return _0x3ad91b(msgResponse(_0xdc69('0x213'),_0xdc69('0x4a'),_0xdc69('0x214')+_0x32cca0));}if(_0x40af77<=0x0||isNaN(_0x40af77)){return _0x3ad91b(msgResponse(_0xdc69('0x213'),_0xdc69('0x4a'),_0xdc69('0x215')+_0x40af77));}if(_0x2409ed<=0x0||isNaN(_0x2409ed)){return _0x3ad91b(msgResponse(_0xdc69('0x213'),_0xdc69('0x4a'),_0xdc69('0x216')+_0x2409ed));}if(_0x30ce34<=0x0||isNaN(_0x30ce34)){return _0x3ad91b(msgResponse('[abandonmentRate]',_0xdc69('0x4a'),_0xdc69('0x217')+_0x30ce34));}if(_0x53b7c1<=0x0||isNaN(_0x53b7c1)){return _0x3ad91b(msgResponse('[abandonmentRate]','Error',_0xdc69('0x218')+_0x53b7c1));}_0x5cadb9=_0x5cadb9||0x0;var _0x3bcede=0x1/_0x40af77;var _0xfd9551=0x0;var _0x474e10=0x0;var _0x576869=0x0;var _0x5a212e=0x0;for(var _0xa91365=0x0;_0x576869<_0x53b7c1;_0xa91365+=0x1){_0x474e10=_0xa91365/_0x30ce34;_0xfd9551=(_0x2409ed*_0x474e10+_0x5cadb9)/_0x3bcede;_0x576869=erlangb(_0xfd9551,_0x32cca0);_0x5a212e=_0xfd9551/_0x32cca0*(0x1-erlangb(_0xfd9551,_0x32cca0));}return _0xd9078c({'erlangCalls':_0xa91365,'erlangCallToSecond':_0x30ce34/_0xa91365,'erlangAbandonmentRate':_0x576869,'erlangBusyFactor':_0x5a212e});});};Dialer[_0xdc69('0xa6')][_0xdc69('0x1dd')]=function(_0x88f01d,_0x2f89f1,_0x440337,_0x35e92f,_0x12352c,_0x3190a5){loggerPredictive[_0xdc69('0x78')](_0xdc69('0x219'));loggerPredictive[_0xdc69('0x78')](_0xdc69('0x210'),_0x88f01d);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x21a'),_0x2f89f1);loggerPredictive['info']('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',_0x440337);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x211'),_0x35e92f);loggerPredictive['info'](_0xdc69('0x21b'),_0x12352c);loggerPredictive[_0xdc69('0x78')](_0xdc69('0x7e'));return new BPromise(function(_0x41f2cb,_0x39a196){if(_0x88f01d<=0x0||isNaN(_0x88f01d)){return _0x39a196(msgResponse('[busyFactor]','Error',_0xdc69('0x214')+_0x88f01d));}if(_0x440337<=0x0||isNaN(_0x440337)){return _0x39a196(msgResponse('[busyFactor]',_0xdc69('0x4a'),_0xdc69('0x215')+_0x440337));}if(_0x35e92f<=0x0||isNaN(_0x35e92f)){return _0x39a196(msgResponse(_0xdc69('0x21c'),'Error',_0xdc69('0x216')+_0x35e92f));}if(_0x2f89f1<=0x0||isNaN(_0x2f89f1)){return _0x39a196(msgResponse(_0xdc69('0x21c'),_0xdc69('0x4a'),_0xdc69('0x217')+_0x2f89f1));}if(_0x12352c<=0x0||isNaN(_0x12352c)){return _0x39a196(msgResponse(_0xdc69('0x21c'),_0xdc69('0x4a'),_0xdc69('0x21d')+_0x12352c));}_0x3190a5=_0x3190a5||0x0;var _0x5a5a81=0x1/_0x440337;var _0x49f882=0x0;var _0x54ff18=0x0;var _0x358316=0x0;var _0x42917e=0x0;for(var _0x5d22a1=0x0;_0x42917e<_0x12352c;_0x5d22a1+=0x1){_0x54ff18=_0x5d22a1/_0x2f89f1;_0x49f882=(_0x35e92f*_0x54ff18+_0x3190a5)/_0x5a5a81;_0x358316=erlangb(_0x49f882,_0x88f01d);_0x42917e=_0x49f882/_0x88f01d*(0x1-erlangb(_0x49f882,_0x88f01d));}return _0x41f2cb({'erlangCalls':_0x5d22a1,'erlangCallToSecond':_0x2f89f1/_0x5d22a1,'erlangAbandonmentRate':_0x358316,'erlangBusyFactor':_0x42917e});});};module[_0xdc69('0x21e')]=Dialer; \ No newline at end of file +var _0xdf88=['AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','waiting','pTalking','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','inspect','emptyContact','merge','pick','ContactId','UserId','VoiceQueueId','[emptyContact][createHistory]','Success','SIP/%s','reachable','status','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ListId','CampaignId','[syncHangupInAMDIvr][createHistory]','countbusyretry','countnosuchnumberretry','reason19\x20machine....','reason\x2019\x20machine....','minutes','[rescheduleContact][Machine]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','stateinterface','locked','push','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','run','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','paused','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Intervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','iftime\x20%s,%s','indexOf','command','content','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIfTime','dialTimezone','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','isSuccess','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','buildObj','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','RUNNING','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/logger','predictive','syncQueueSummary','../ami','redis','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\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','isUndefined','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts'];(function(_0x2142a0,_0xd5220){var _0xed9a6e=function(_0x30c060){while(--_0x30c060){_0x2142a0['push'](_0x2142a0['shift']());}};_0xed9a6e(++_0xd5220);}(_0xdf88,0x17c));var _0x8df8=function(_0x4026c0,_0x5045e6){_0x4026c0=_0x4026c0-0x0;var _0x59c7dc=_0xdf88[_0x4026c0];return _0x59c7dc;};'use strict';var util=require(_0x8df8('0x0'));var _=require(_0x8df8('0x1'));var BPromise=require(_0x8df8('0x2'));var uuid=require(_0x8df8('0x3'));var moment=require(_0x8df8('0x4'));var rr=require('rr');var md5=require(_0x8df8('0x5'));var Redis=require('ioredis');var ut=require(_0x8df8('0x6'));var config=require('../../../config/environment/');var logger=require(_0x8df8('0x7'))('dialer');var loggerBooked=require(_0x8df8('0x7'))('booked');var loggerPredictive=require(_0x8df8('0x7'))(_0x8df8('0x8'));var loggerPredictiveCalls=require(_0x8df8('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x8df8('0x7'))(_0x8df8('0x9'));var ami=require(_0x8df8('0xa'));config['redis']=_['defaults'](config[_0x8df8('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8df8('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x8df8('0xc'));var cmHopperHistory=require(_0x8df8('0xd'));var cmHopperBlack=require(_0x8df8('0xe'));var voiceQueueRt=require(_0x8df8('0xf'));var Action=require('./action');var History=require(_0x8df8('0x10'));var Final=require(_0x8df8('0x11'));var AgentComplete=require(_0x8df8('0x12'));var QueueCallerAbandon=require(_0x8df8('0x13'));var Hangup=require(_0x8df8('0x14'));var ipAgi=process[_0x8df8('0x15')][_0x8df8('0x16')]||'127.0.0.1';var strategy={'rrmemory':_0x8df8('0x17'),'roundrobin':_0x8df8('0x18')};var Sequence=function(){};Sequence[_0x8df8('0x19')][_0x8df8('0x1a')]=function(_0xb648c5){this[_0x8df8('0x1b')]=this['tail']?this[_0x8df8('0x1b')][_0x8df8('0x1c')](_0xb648c5):_0xb648c5();};function Dialer(_0xacf4f,_0x3b9579){this[_0x8df8('0x1d')]=new Sequence();this[_0x8df8('0x1e')]=_0x3b9579;this['voiceQueues']=_0xacf4f[_0x8df8('0x1f')];this[_0x8df8('0x20')]=_0xacf4f[_0x8df8('0x20')];this['agents']=_0xacf4f[_0x8df8('0x21')];this[_0x8df8('0x22')]=_0xacf4f[_0x8df8('0x22')];this[_0x8df8('0x23')]=config[_0x8df8('0x23')]||0x2;this[_0x8df8('0x24')]={};this[_0x8df8('0x25')]={};this[_0x8df8('0x26')]={};this[_0x8df8('0x27')]={};this[_0x8df8('0x28')]={};this[_0x8df8('0x29')]={};this[_0x8df8('0x2a')]={};this[_0x8df8('0x2b')]={};this[_0x8df8('0x2c')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x8df8('0x2d')][_0x8df8('0x2e')](this));ami['on']('queuecallerabandon',this[_0x8df8('0x2f')][_0x8df8('0x2e')](this));ami['on']('originateresponse',this[_0x8df8('0x30')][_0x8df8('0x2e')](this));ami['on'](_0x8df8('0x31'),this[_0x8df8('0x32')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0x8df8('0x33'),this[_0x8df8('0x34')]['bind'](this));ami['on'](_0x8df8('0x35'),this[_0x8df8('0x36')][_0x8df8('0x2e')](this));ami['on'](_0x8df8('0x37'),this[_0x8df8('0x38')][_0x8df8('0x2e')](this));ami['on']('queuemember',this[_0x8df8('0x39')][_0x8df8('0x2e')](this));ami['on'](_0x8df8('0x3a'),this[_0x8df8('0x3b')]['bind'](this));this[_0x8df8('0x3c')]();this[_0x8df8('0x3d')]();}function isNotNull(_0x1a0c9a){return _0x1a0c9a!==null&&!_['isUndefined'](_0x1a0c9a);}function checkIsLoggedIn(_0x17aa31,_0x41aa5a){return function(){if(_0x41aa5a<=0x0){_0x17aa31[_0x8df8('0x3e')]='AGENTS_NOT_LOGGED';throw _0x17aa31[_0x8df8('0x3f')]+_0x8df8('0x40');}};}function isActive(_0x1395f5){return _0x1395f5;}function checkIsActive(_0xafd88a,_0x2f59f4){return function(){if(!isActive(_0x2f59f4)){_0xafd88a['message']=_0x8df8('0x41');throw _0xafd88a['name']+_0x8df8('0x42');}};}function checkInterval(_0x23b590){return function(){if(!isNotNull(_0x23b590[_0x8df8('0x43')])){_0x23b590[_0x8df8('0x3e')]='INTERVAL_IS_NULL';throw _0x23b590[_0x8df8('0x3f')]+_0x8df8('0x44');}if(!isNotNull(_0x23b590[_0x8df8('0x43')]['Intervals'])){_0x23b590['message']='INTERVAL_IS_NULL';throw _0x23b590['name']+_0x8df8('0x44');}if(!isNotNull(_[_0x8df8('0x45')](_0x23b590[_0x8df8('0x43')]['Intervals']))){_0x23b590[_0x8df8('0x3e')]=_0x8df8('0x46');throw _0x23b590[_0x8df8('0x3f')]+_0x8df8('0x44');}};}function msgResponse(_0x226b8f,_0x4d1c21,_0x10a0cb){return{'action':_0x226b8f,'response':_0x4d1c21,'message':_0x10a0cb,'stack':_0x10a0cb};}function myreject(_0x41018c){return function(_0x4b8cd9){return _0x41018c(msgResponse(_0x8df8('0x47'),_0x8df8('0x48'),JSON['stringify'](_0x4b8cd9)));};}function getSeconds(_0x558223,_0x43f153){var _0x381328=moment(_0x558223)['milliseconds'](0x0);var _0x24aebb=moment(_0x43f153)[_0x8df8('0x49')](0x0);return _0x381328[_0x8df8('0x4a')](_0x24aebb,_0x8df8('0x4b'));}function emit(_0x18b08e,_0x100f1e,_0x5cade6){io['to'](_0x18b08e)[_0x8df8('0x4c')](_0x100f1e,_0x5cade6);}function emitVoiceQueueSummary(_0x4cb0ee){if(_0x4cb0ee[_0x8df8('0x4d')]===_0x8df8('0x4e')){var _0x1d5918={'id':_0x4cb0ee['id'],'name':_0x4cb0ee[_0x8df8('0x3f')],'strategy':_0x4cb0ee[_0x8df8('0x4f')],'answered':_0x4cb0ee[_0x8df8('0x50')],'available':_0x4cb0ee[_0x8df8('0x51')],'loggedIn':_0x4cb0ee[_0x8df8('0x52')],'pTalking':_0x4cb0ee['pTalking'],'sumBillable':_0x4cb0ee[_0x8df8('0x53')],'sumDuration':_0x4cb0ee[_0x8df8('0x54')],'sumHoldTime':_0x4cb0ee[_0x8df8('0x55')]||0x0,'talking':_0x4cb0ee['talking'],'total':_0x4cb0ee[_0x8df8('0x56')],'type':_0x4cb0ee[_0x8df8('0x4d')],'unmanaged':_0x4cb0ee[_0x8df8('0x57')],'abandoned':_0x4cb0ee[_0x8df8('0x58')],'waiting':_0x4cb0ee['waiting'],'loggedInDb':_0x4cb0ee[_0x8df8('0x59')],'dialActive':_0x4cb0ee[_0x8df8('0x5a')],'dialMethod':_0x4cb0ee[_0x8df8('0x5b')],'dialOriginateCallerIdName':_0x4cb0ee[_0x8df8('0x5c')],'dialOriginateCallerIdNumber':_0x4cb0ee[_0x8df8('0x5d')],'dialOriginateTimeout':_0x4cb0ee[_0x8df8('0x5e')],'dialPrefix':_0x4cb0ee['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4cb0ee[_0x8df8('0x5f')],'outboundAnswerCallsDay':_0x4cb0ee[_0x8df8('0x60')],'outboundBlacklistCallsDay':_0x4cb0ee[_0x8df8('0x61')],'outboundBusyCallsDay':_0x4cb0ee[_0x8df8('0x62')],'outboundCongestionCallsDay':_0x4cb0ee['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4cb0ee[_0x8df8('0x63')],'outboundDropCallsDayCallersExit':_0x4cb0ee[_0x8df8('0x64')],'outboundDropCallsDayTimeout':_0x4cb0ee[_0x8df8('0x65')],'outboundNoAnswerCallsDay':_0x4cb0ee['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4cb0ee[_0x8df8('0x66')],'outboundOriginateFailureCallsDay':_0x4cb0ee[_0x8df8('0x67')],'outboundReCallsDay':_0x4cb0ee['outboundReCallsDay'],'outboundRejectCallsDay':_0x4cb0ee[_0x8df8('0x68')],'outboundUnknownCallsDay':_0x4cb0ee[_0x8df8('0x69')],'predictiveIntervalAnsweredCalls':_0x4cb0ee[_0x8df8('0x6a')],'predictiveIntervalAvgHoldtime':_0x4cb0ee[_0x8df8('0x6b')],'predictiveIntervalAvgTalktime':_0x4cb0ee[_0x8df8('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x4cb0ee[_0x8df8('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x4cb0ee[_0x8df8('0x6e')],'predictiveIntervalErlangCalls':_0x4cb0ee[_0x8df8('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x4cb0ee[_0x8df8('0x70')],'predictiveIntervalHitRate':_0x4cb0ee[_0x8df8('0x71')],'predictiveIntervalMultiplicativeFactor':_0x4cb0ee['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4cb0ee[_0x8df8('0x72')],'predictiveIntervalAvailable':_0x4cb0ee['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4cb0ee[_0x8df8('0x73')],'message':_0x4cb0ee['message'],'originated':_0x4cb0ee[_0x8df8('0x74')],'erlangCalls':_0x4cb0ee[_0x8df8('0x75')],'erlangCallToSecond':_0x4cb0ee[_0x8df8('0x76')],'erlangAbandonmentRate':_0x4cb0ee[_0x8df8('0x77')],'erlangBusyFactor':_0x4cb0ee[_0x8df8('0x78')],'startPredictive':_0x4cb0ee[_0x8df8('0x29')],'startProgressive':_0x4cb0ee['startProgressive']};if(_0x4cb0ee[_0x8df8('0x79')]){_0x1d5918[_0x8df8('0x79')]={'id':_0x4cb0ee['Trunk']['id'],'name':_0x4cb0ee[_0x8df8('0x79')][_0x8df8('0x3f')],'active':_0x4cb0ee['Trunk'][_0x8df8('0x7a')],'callerid':_0x4cb0ee[_0x8df8('0x79')][_0x8df8('0x7b')]};}if(_0x4cb0ee[_0x8df8('0x43')]){_0x1d5918['Interval']={'id':_0x4cb0ee[_0x8df8('0x43')]['id'],'name':_0x4cb0ee[_0x8df8('0x43')]['name']};}var _0xd64b16=md5(JSON[_0x8df8('0x7c')](_0x1d5918));if(_0x4cb0ee[_0x8df8('0x5')]!==_0xd64b16){_0x4cb0ee[_0x8df8('0x5')]=_0xd64b16;emit(util[_0x8df8('0x7d')](_0x8df8('0x7e'),_0x1d5918['name']),_0x8df8('0x7f'),_0x1d5918);}}}function emitCampaignSummary(_0xf87022){if(_0xf87022[_0x8df8('0x4d')]===_0x8df8('0x80')){emit(util[_0x8df8('0x7d')](_0x8df8('0x81'),_0xf87022[_0x8df8('0x3f')]),_0x8df8('0x82'),_0xf87022);}}function checkGetDataPredictive(_0x6aa4cd){if(isNotNull(_0x6aa4cd)){if(!_['isEmpty'](_0x6aa4cd)){loggerPredictive['info'](_0x8df8('0x83'));loggerPredictive[_0x8df8('0x84')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6aa4cd[_0x8df8('0x73')]);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x85'),_0x6aa4cd[_0x8df8('0x6a')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6aa4cd[_0x8df8('0x6e')]);loggerPredictive[_0x8df8('0x84')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6aa4cd[_0x8df8('0x6d')]);loggerPredictive[_0x8df8('0x84')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6aa4cd['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x8df8('0x84')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6aa4cd['predictiveIntervalAvgTalktime']);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x86'));if(_0x6aa4cd[_0x8df8('0x73')]>0x0){if(!_['isUndefined'](_0x6aa4cd[_0x8df8('0x6c')])&&_0x6aa4cd[_0x8df8('0x6c')]>0x0){return!![];}else{loggerPredictive[_0x8df8('0x84')](_0x8df8('0x87'));}if(!_['isUndefined'](_0x6aa4cd[_0x8df8('0x6b')])&&_0x6aa4cd[_0x8df8('0x6b')]>0x0){return!![];}else{loggerPredictive[_0x8df8('0x84')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x8df8('0x88'));}}else{loggerPredictive[_0x8df8('0x84')](_0x8df8('0x89'));}}else{loggerPredictive[_0x8df8('0x84')](_0x8df8('0x89'));}return![];}function mergeDataErlangB(_0x17384d){return function(_0x229548){loggerPredictive[_0x8df8('0x84')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x8df8('0x84')](_0x8df8('0x8a'),_0x229548['erlangCalls']);loggerPredictive[_0x8df8('0x84')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x229548[_0x8df8('0x76')]);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x8b'),_0x229548[_0x8df8('0x77')]);loggerPredictive['info'](_0x8df8('0x8c'),_0x229548[_0x8df8('0x78')]);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x8b'),_0x229548['erlangAbandonmentRate']);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x86'));_['merge'](_0x17384d,_0x229548);};}function getDiff(_0x5b9856){var _0x3d4084=moment()[_0x8df8('0x49')](0x0);var _0xec31f4=moment(_0x5b9856)[_0x8df8('0x49')](0x0);return _0x3d4084[_0x8df8('0x4a')](_0xec31f4,'seconds');}function ifInterval(_0x4e5e60,_0x396f63){if(_[_0x8df8('0x8d')](_0x396f63)){return![];}if(getDiff(_0x396f63)<_0x4e5e60*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x27d9b2){if(isNotNull(_0x27d9b2)){if(!_[_0x8df8('0x8d')](_0x27d9b2['startProgressive'])){_0x27d9b2[_0x8df8('0x2a')]=undefined;loggerPredictive[_0x8df8('0x84')](_0x27d9b2[_0x8df8('0x3f')],_0x8df8('0x8e'));}if(!_[_0x8df8('0x8d')](_0x27d9b2[_0x8df8('0x29')])){_0x27d9b2[_0x8df8('0x29')]=undefined;loggerPredictive[_0x8df8('0x84')](_0x27d9b2['name'],_0x8df8('0x8f'));}if(!_['isUndefined'](_0x27d9b2[_0x8df8('0x90')])){clearInterval(_0x27d9b2[_0x8df8('0x90')]);_0x27d9b2[_0x8df8('0x90')]=undefined;loggerPredictive['info'](_0x27d9b2[_0x8df8('0x3f')],_0x8df8('0x91'));}}}function erlangb(_0x46a375,_0x550d59){if(_0x550d59===0x0){return 0x0;}var _0x5d5017=0x1;for(var _0x4fd4de=0x1;_0x4fd4de<=_0x550d59;_0x4fd4de+=0x1){_0x5d5017=0x1+_0x5d5017*_0x4fd4de/_0x46a375;}return 0x1/_0x5d5017;}function isVoiceQueueOutbound(_0x5b4258){return _0x5b4258==='outbound';}function isNotPreview(_0x136961){return _0x136961!==_0x8df8('0x1e');}function isCampaignIvr(_0x2397b2){return _0x2397b2===_0x8df8('0x80');}function getCallerId(_0x442e94,_0x2b79ba,_0x326bb6){if(!_[_0x8df8('0x8d')](_0x326bb6)&&_0x8df8('0x92')===typeof _0x326bb6&&!_[_0x8df8('0x45')](_0x326bb6)){if(!_[_0x8df8('0x8d')](_0x2b79ba)&&_0x8df8('0x92')===typeof _0x2b79ba&&!_['isEmpty'](_0x2b79ba)){return util[_0x8df8('0x7d')](_0x8df8('0x93'),_0x2b79ba,_0x326bb6);}return util[_0x8df8('0x7d')]('\x22%s\x22\x20<%s>',_0x326bb6,_0x326bb6);}if(!_['isUndefined'](_0x442e94)&&_0x8df8('0x92')===typeof _0x442e94&&!_['isEmpty'](_0x442e94)){return _0x442e94;}return _0x8df8('0x94');}function loggerCatchQueueSummary(_0x337914,_0x4b3b52){return function(_0x477271){freeVariablesPredictive(_0x4b3b52);emitVoiceQueueSummary(_0x4b3b52);emitCampaignSummary(_0x4b3b52);loggerSyncQueueSummary[_0x8df8('0x95')](_0x337914,util['inspect'](_0x477271,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2f6ca4,_0x86c5c){return function(_0x539347){loggerPredictive[_0x8df8('0x95')](_0x86c5c[_0x8df8('0x3f')],_0x2f6ca4);loggerPredictive['error'](_0x539347[_0x8df8('0x96')]);freeVariablesPredictive(_0x86c5c);};}function loggerCatch(_0x2970c4){return function(_0x3b91dd){logger[_0x8df8('0x95')](_0x2970c4,util['inspect'](_0x3b91dd,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2bd03e){return _0x2bd03e&&!_[_0x8df8('0x8d')](_0x2bd03e)&&_0x2bd03e['length']>0x0;}function decremetOriginate(_0x3a241d){if(!_[_0x8df8('0x8d')](_0x3a241d)&&_0x3a241d!==null){if(_0x3a241d[_0x8df8('0x97')](_0x8df8('0x74'))){if(_0x3a241d['originated']>0x0){_0x3a241d['originated']-=0x1;}else{logger[_0x8df8('0x95')](_0x8df8('0x98'));}}}else{logger[_0x8df8('0x95')](_0x8df8('0x99'));}}function checkContactLowerLimitOriginate(_0x4af6e3,_0x3ec0ea,_0x7ef848){if(_0x3ec0ea>_0x7ef848){for(var _0x316c39=0x0;_0x316c39<_0x3ec0ea-_0x7ef848;_0x316c39+=0x1){decremetOriginate(_0x4af6e3);}}}function loggerGetContactDialer(_0x46bbed,_0x5d912e,_0x301892){return function(_0x16d607){checkContactLowerLimitOriginate(_0x5d912e,_0x301892,0x0);logger[_0x8df8('0x95')](_0x46bbed,util['inspect'](_0x16d607,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x152c7f){return function(_0x4ab973){if(isNotNull(_0x4ab973)&&isNotNull(_0x4ab973[0x0])){if(_0x4ab973[0x0]['contactsRescheduled']>0x0){_0x152c7f[_0x8df8('0x3e')]=_0x8df8('0x9a');logger['info'](_0x8df8('0x9b')+_0x152c7f[_0x8df8('0x3f')],_0x4ab973[0x0][_0x8df8('0x9c')],_0x8df8('0x9d'));}else{_0x152c7f[_0x8df8('0x3e')]=_0x8df8('0x9e');logger[_0x8df8('0x84')](_0x8df8('0x9f')+_0x152c7f['name']);}}};}function notSendMessagesQueue(_0xcfc519){if(_0xcfc519[_0x8df8('0xa0')]){freeVariablesPredictive(_0xcfc519);if(_0xcfc519[_0x8df8('0x74')]===0x0&&_0xcfc519[_0x8df8('0xa1')]===0x0&&_0xcfc519[_0x8df8('0xa2')]===0x0&&(_0xcfc519[_0x8df8('0xa3')]||0x0)===0x0){_0xcfc519[_0x8df8('0xa0')]=![];_0xcfc519[_0x8df8('0x51')]=0x0;_0xcfc519[_0x8df8('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x8df8('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xcfc519[_0x8df8('0x3f')],'is\x20not\x20active');}else{_0xcfc519[_0x8df8('0x3e')]=_0x8df8('0xa4');loggerSyncQueueSummary['error'](_0x8df8('0xa5'),_0xcfc519[_0x8df8('0x3f')],_0x8df8('0xa6'));}emitVoiceQueueSummary(_0xcfc519);}}function notSendMessagesCampaign(_0x352f4f){if(_0x352f4f[_0x8df8('0xa0')]){if(_0x352f4f[_0x8df8('0x74')]===0x0){_0x352f4f[_0x8df8('0xa0')]=![];_0x352f4f[_0x8df8('0x3e')]=_0x8df8('0x41');loggerSyncQueueSummary[_0x8df8('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x352f4f[_0x8df8('0x3f')],_0x8df8('0xa7'));}else{_0x352f4f[_0x8df8('0x3e')]=_0x8df8('0xa4');loggerSyncQueueSummary[_0x8df8('0x95')](_0x8df8('0xa8'),_0x352f4f['name'],_0x8df8('0xa6'));}emitCampaignSummary(_0x352f4f);}}function createObjHistory(_0x59f58f,_0x556f9e,_0x4505fa,_0x781b47,_0x19e4f1){_0x59f58f['message']=_0x4505fa;var _0x27c699=new Action(_0x59f58f,_0x556f9e);var _0x32a741=new History(_0x27c699);_0x32a741[_0x8df8('0xa9')]=_0x781b47;_0x32a741[_0x8df8('0xaa')]=_0x19e4f1;_0x32a741[_0x8df8('0xab')]=_0x27c699[_0x8df8('0xac')];return _0x32a741;}Dialer[_0x8df8('0x19')]['loopClearZombieChannels']=function(){var _0x3ab24f=this;setInterval(function(){_0x3ab24f[_0x8df8('0xad')](_0x3ab24f[_0x8df8('0x27')],_0x8df8('0xae'));_0x3ab24f[_0x8df8('0xad')](_0x3ab24f[_0x8df8('0x25')],_0x8df8('0xaf'));},0x32c8);};Dialer[_0x8df8('0x19')]['clearZombieChannels']=function(_0xa12423,_0x5aa8b6){var _0x47592e=this;for(var _0x5db167 in _0xa12423){if(_0xa12423[_0x8df8('0x97')](_0x5db167)){this[_0x8df8('0x1d')]['enqueue'](function(){if(!_[_0x8df8('0xb0')](_0xa12423[_0x5db167])){return ami[_0x8df8('0xb1')]({'action':'status','channel':_0xa12423[_0x5db167][_0x8df8('0xb2')]})[_0x8df8('0xb3')](function(_0x296aec){if(_0x296aec['message']===_0x8df8('0xb4')){setTimeout(function(){if(_0xa12423[_0x5db167]&&_0xa12423[_0x5db167][_0x8df8('0x4d')]!==_0x8df8('0x80')){_0x47592e[_0x8df8('0xb5')](_0x47592e['voiceQueues'][_0xa12423[_0x5db167]['queue']]);logger[_0x8df8('0x95')](_0x8df8('0xb6'),_0x5aa8b6,_0x5db167,_0xa12423[_0x5db167][_0x8df8('0xb7')]);delete _0xa12423[_0x5db167];}if(_0xa12423[_0x5db167]&&_0xa12423[_0x5db167][_0x8df8('0x4d')]===_0x8df8('0x80')){_0x47592e[_0x8df8('0xb5')](_0x47592e[_0x8df8('0x20')][_0xa12423[_0x5db167][_0x8df8('0xb7')]]);logger[_0x8df8('0x95')](_0x8df8('0xb8'),_0x5aa8b6,_0x5db167,_0xa12423[_0x5db167][_0x8df8('0xb7')]);delete _0xa12423[_0x5db167];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x34605b){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](cmHopper[_0x8df8('0xbb')](_0x34605b))[_0x8df8('0xb3')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x8df8('0x19')][_0x8df8('0xbc')]=function(_0x19b3f2){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](cmHopperBlack[_0x8df8('0xbc')](_0x19b3f2))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xbd')));};Dialer[_0x8df8('0x19')][_0x8df8('0xbe')]=function(_0x492169){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](cmHopperBlack[_0x8df8('0xbe')](_0x492169))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xbf')));};Dialer[_0x8df8('0x19')][_0x8df8('0xc0')]=function(_0x5eab20){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](cmHopperHistory[_0x8df8('0xc1')](_0x5eab20))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xc2')));};Dialer['prototype'][_0x8df8('0xc3')]=function(_0x1c8e33){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](cmHopper['rescheduleContact'](_0x1c8e33))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xc4')));};Dialer[_0x8df8('0x19')][_0x8df8('0xc5')]=function(_0x302a67,_0x5df000,_0x5b2030){return BPromise[_0x8df8('0xb9')]()['then'](cmHopper[_0x8df8('0xc5')](_0x302a67,_0x5df000,_0x5b2030))[_0x8df8('0xb3')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x8df8('0x19')]['getContactDialer']=function(_0x42693a,_0x3647e6,_0x4693bf,_0x3136a5){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](cmHopper[_0x8df8('0xc6')](_0x42693a,_0x3647e6,_0x4693bf,_0x3136a5))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xc7')));};Dialer[_0x8df8('0x19')]['getContactDialerIvr']=function(_0x11a878,_0x3ebf23,_0x2ee388){return BPromise[_0x8df8('0xb9')]()['then'](cmHopper[_0x8df8('0xc8')](_0x11a878,_0x3ebf23,_0x2ee388))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xc7')));};Dialer[_0x8df8('0x19')]['getVoiceQueueRtPauses']=function(_0x197273){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](voiceQueueRt[_0x8df8('0xc9')](_0x197273))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x8df8('0x19')]['moveContactManagedDialer']=function(_0x1c86d5){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](cmHopper[_0x8df8('0xca')](_0x1c86d5))[_0x8df8('0xb3')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0x8df8('0xcb')]=function(_0x8250d3){return BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](cmHopperHistory[_0x8df8('0xcb')](_0x8250d3))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xcc')));};Dialer[_0x8df8('0x19')][_0x8df8('0xb5')]=function(_0x133c81){if(!_[_0x8df8('0x8d')](_0x133c81)&&_0x133c81!==null){if(_0x133c81[_0x8df8('0x97')](_0x8df8('0x74'))){if(_0x133c81['originated']>0x0){_0x133c81[_0x8df8('0x74')]-=0x1;}else{logger[_0x8df8('0x95')](_0x8df8('0xcd'));}}}else{logger['error'](_0x8df8('0xce'));}};Dialer[_0x8df8('0x19')][_0x8df8('0xcf')]=function(_0x3791df,_0x3e0689){var _0x7d824=this;return function(_0x3ba8f6){_0x7d824['updateOriginated'](_0x3e0689);logger[_0x8df8('0x95')](_0x3791df,util[_0x8df8('0xd0')](_0x3ba8f6,{'showHidden':![],'depth':null}));};};Dialer[_0x8df8('0x19')][_0x8df8('0xd1')]=function(_0x3bc3d4,_0x236226,_0xb77c01){var _0x2e776c={'state':0x19,'statedesc':'notFound'};this[_0x8df8('0xb5')](_0x236226);this['saveInDb'](_[_0x8df8('0xd2')](_0x2e776c,_[_0x8df8('0xd3')](_0xb77c01,[_0x8df8('0xd4'),'ListId',_0x8df8('0xd5'),_0x8df8('0xd6'),'CampaignId'])),_0x8df8('0xd7'),'[emptyContact]');logger[_0x8df8('0x95')](_0x3bc3d4);};Dialer[_0x8df8('0x19')]['isSuccess']=function(_0x10ef12){return _0x10ef12===_0x8df8('0xd8');};Dialer[_0x8df8('0x19')]['isTrunkReachable']=function(_0x3c15ac){return!_['isUndefined'](_0x3c15ac)&&_0x3c15ac&&!_[_0x8df8('0x8d')](_0x3c15ac[_0x8df8('0x3f')])&&!_[_0x8df8('0x8d')](_0x3c15ac[_0x8df8('0x7a')])&&_0x3c15ac[_0x8df8('0x7a')]&&(this[_0x8df8('0x22')][util[_0x8df8('0x7d')](_0x8df8('0xd9'),_0x3c15ac[_0x8df8('0x3f')])]['status']===_0x8df8('0xda')||this['trunks'][util[_0x8df8('0x7d')](_0x8df8('0xd9'),_0x3c15ac['name'])][_0x8df8('0xdb')]===_0x8df8('0xdc'));};Dialer['prototype'][_0x8df8('0xdd')]=function(_0x269c78,_0xd35d11,_0x34445e){this[_0x8df8('0xcb')](_0x269c78)['catch'](loggerCatch(_0xd35d11));this[_0x8df8('0xca')](_0x269c78)[_0x8df8('0xb3')](loggerCatch(_0x34445e));};Dialer[_0x8df8('0x19')][_0x8df8('0x38')]=function(_0x53d3a3){var _0x320cba=this[_0x8df8('0x27')][_0x53d3a3[_0x8df8('0xde')]];var _0x5a20bb;if(!_[_0x8df8('0xb0')](_0x53d3a3)&&!_['isNil'](_0x53d3a3[_0x8df8('0xdf')])&&!_[_0x8df8('0xb0')](_0x53d3a3[_0x8df8('0xdf')][_0x8df8('0xe0')])&&_0x53d3a3[_0x8df8('0xe1')]===_0x8df8('0xe2')&&_0x320cba){if(_0x320cba[_0x8df8('0x4d')]!==_0x8df8('0x80')&&this['voiceQueues'][_0x320cba['queue']][_0x8df8('0xe3')]&&_0x53d3a3[_0x8df8('0xe4')]===_0x8df8('0xe5')){delete this[_0x8df8('0x27')][_0x53d3a3[_0x8df8('0xde')]];this[_0x8df8('0xb5')](this['voiceQueues'][_0x320cba[_0x8df8('0xb7')]]);this[_0x8df8('0x1f')][_0x320cba['queue']][_0x8df8('0x60')]+=0x1;this['voiceQueues'][_0x320cba[_0x8df8('0xb7')]][_0x8df8('0x5f')]+=0x1;_0x5a20bb=new Hangup(_0x320cba,_0x53d3a3);_0x5a20bb[_0x8df8('0xa9')]=0x12;_0x5a20bb[_0x8df8('0xaa')]=_0x8df8('0xe6');_0x5a20bb[_0x8df8('0xe7')]=_0x8df8('0xe8');this['saveInDb'](_0x5a20bb,'[syncHangupInAMD][createHistory]',_0x8df8('0xe9'));}if(_0x320cba[_0x8df8('0x4d')]!=='ivr'&&this['voiceQueues'][_0x320cba[_0x8df8('0xb7')]][_0x8df8('0xe3')]&&_0x53d3a3['value']===_0x8df8('0xea')){var _0x39fd02=this;return new BPromise(function(_0x59fbfc,_0x6e86eb){delete _0x39fd02[_0x8df8('0x27')][_0x53d3a3['uniqueid']];_0x39fd02[_0x8df8('0xb5')](_0x39fd02[_0x8df8('0x1f')][_0x320cba[_0x8df8('0xb7')]]);_0x39fd02['voiceQueues'][_0x320cba['queue']]['outboundAnswerCallsDay']+=0x1;_0x39fd02[_0x8df8('0x1f')][_0x320cba[_0x8df8('0xb7')]][_0x8df8('0x5f')]+=0x1;var _0x654eb7=_0x39fd02[_0x8df8('0x1f')][_0x320cba[_0x8df8('0xb7')]];var _0x77818a=new Hangup(_0x320cba,_0x53d3a3);_0x77818a[_0x8df8('0xa9')]=0x13;_0x77818a[_0x8df8('0xaa')]=_0x8df8('0xeb');_0x77818a['membername']=_0x8df8('0xe8');_0x77818a[_0x8df8('0xec')]+=0x1;_0x77818a[_0x8df8('0xed')]+=0x1;_0x77818a[_0x8df8('0xee')]=!![];_0x39fd02[_0x8df8('0xcb')](_0x77818a)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xef')));if(_0x77818a['countbusyretry']+_0x77818a[_0x8df8('0xf0')]+_0x77818a[_0x8df8('0xf1')]+_0x77818a['countnosuchnumberretry']+_0x77818a[_0x8df8('0xf2')]+_0x77818a[_0x8df8('0xf3')]+_0x77818a[_0x8df8('0xec')]+_0x77818a[_0x8df8('0xf4')]>=_0x654eb7[_0x8df8('0xf5')]){_0x39fd02[_0x8df8('0xf6')](_0x77818a,_0x59fbfc,_0x6e86eb,'reason19\x20machine....');}else{if(_0x77818a[_0x8df8('0xec')]>=_0x654eb7[_0x8df8('0xf7')]){_0x39fd02['createStateFinal'](_0x77818a,_0x59fbfc,_0x6e86eb,'reason\x2019\x20machine....');}else{_0x39fd02[_0x8df8('0xc3')]({'active':![],'countmachineretry':_0x77818a['countmachineretry'],'scheduledat':moment()[_0x8df8('0xf8')](_0x654eb7[_0x8df8('0xf9')],'minutes')['format'](_0x8df8('0xfa')),'ContactId':_0x77818a['ContactId'],'ListId':_0x77818a[_0x8df8('0xfb')],'VoiceQueueId':_0x77818a['VoiceQueueId']||undefined,'CampaignId':_0x77818a[_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch('[rescheduleContact][Machine]'));_0x59fbfc({'reschedule':0x1});}}});}if(_0x320cba['type']===_0x8df8('0x80')&&this['campaigns'][_0x320cba[_0x8df8('0xb7')]][_0x8df8('0xe3')]&&_0x53d3a3['value']===_0x8df8('0xe5')){delete this['uniqueId'][_0x53d3a3[_0x8df8('0xde')]];this[_0x8df8('0xb5')](this[_0x8df8('0x20')][_0x320cba[_0x8df8('0xb7')]]);_0x5a20bb=new Hangup(_0x320cba,_0x53d3a3);_0x5a20bb[_0x8df8('0xa9')]=0x12;_0x5a20bb[_0x8df8('0xaa')]=_0x8df8('0xe6');_0x5a20bb[_0x8df8('0xe7')]=_0x8df8('0xe8');this[_0x8df8('0xdd')](_0x5a20bb,_0x8df8('0xfd'),'[syncHangupInAMDIvr]');}if(_0x320cba[_0x8df8('0x4d')]==='ivr'&&this['campaigns'][_0x320cba[_0x8df8('0xb7')]][_0x8df8('0xe3')]&&_0x53d3a3[_0x8df8('0xe4')]==='MACHINE'){var _0x39fd02=this;return new BPromise(function(_0xd3476e,_0x573790){delete _0x39fd02[_0x8df8('0x27')][_0x53d3a3[_0x8df8('0xde')]];_0x39fd02[_0x8df8('0xb5')](_0x39fd02['campaigns'][_0x320cba[_0x8df8('0xb7')]]);_0x39fd02[_0x8df8('0x20')][_0x320cba['queue']][_0x8df8('0x60')]+=0x1;_0x39fd02['campaigns'][_0x320cba[_0x8df8('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1d302a=_0x39fd02[_0x8df8('0x20')][_0x320cba[_0x8df8('0xb7')]];var _0x2db0ae=new Hangup(_0x320cba,_0x53d3a3);_0x2db0ae[_0x8df8('0xa9')]=0x13;_0x2db0ae[_0x8df8('0xaa')]=_0x8df8('0xeb');_0x2db0ae[_0x8df8('0xe7')]=_0x8df8('0xe8');_0x2db0ae[_0x8df8('0xec')]+=0x1;_0x2db0ae['countglobal']+=0x1;_0x2db0ae[_0x8df8('0xee')]=!![];_0x39fd02[_0x8df8('0xcb')](_0x2db0ae)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xef')));if(_0x2db0ae[_0x8df8('0xfe')]+_0x2db0ae['countcongestionretry']+_0x2db0ae[_0x8df8('0xf1')]+_0x2db0ae[_0x8df8('0xff')]+_0x2db0ae[_0x8df8('0xf2')]+_0x2db0ae[_0x8df8('0xf3')]+_0x2db0ae['countmachineretry']+_0x2db0ae['countagentrejectretry']>=_0x1d302a[_0x8df8('0xf5')]){_0x39fd02[_0x8df8('0xf6')](_0x2db0ae,_0xd3476e,_0x573790,_0x8df8('0x100'));}else{if(_0x2db0ae[_0x8df8('0xec')]>=_0x1d302a['dialMachineMaxRetry']){_0x39fd02['createStateFinal'](_0x2db0ae,_0xd3476e,_0x573790,_0x8df8('0x101'));}else{_0x39fd02[_0x8df8('0xc3')]({'active':![],'countmachineretry':_0x2db0ae[_0x8df8('0xec')],'scheduledat':moment()[_0x8df8('0xf8')](_0x1d302a[_0x8df8('0xf9')],_0x8df8('0x102'))['format'](_0x8df8('0xfa')),'ContactId':_0x2db0ae[_0x8df8('0xd4')],'ListId':_0x2db0ae['ListId'],'VoiceQueueId':_0x2db0ae['VoiceQueueId']||undefined,'CampaignId':_0x2db0ae[_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x103')));_0xd3476e({'reschedule':0x1});}}});}}};Dialer[_0x8df8('0x19')]['syncHangup']=function(_0x150f49){var _0x2b9065=this[_0x8df8('0x27')][_0x150f49[_0x8df8('0xde')]];var _0x44bb4b=this;var _0xdef52;if(_0x2b9065&&_0x2b9065[_0x8df8('0x4d')]===_0x8df8('0x80')){delete this[_0x8df8('0x27')][_0x150f49[_0x8df8('0xde')]];this[_0x8df8('0xb5')](this['campaigns'][_0x2b9065['queue']]);this[_0x8df8('0x20')][_0x2b9065[_0x8df8('0xb7')]]['ivrAnswerCallsDay']+=0x1;_0xdef52=new Hangup(_0x2b9065,_0x150f49);this[_0x8df8('0xcb')](_0xdef52)[_0x8df8('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8df8('0xca')](_0xdef52)[_0x8df8('0xb3')](loggerCatch('[syncHangupIvr]'));}if(_0x2b9065&&_0x2b9065['type']!==_0x8df8('0x80')&&isNotNull(this[_0x8df8('0x1f')][_0x2b9065[_0x8df8('0xb7')]][_0x8df8('0x104')])){delete this['uniqueId'][_0x150f49['uniqueid']];this[_0x8df8('0xb5')](this['voiceQueues'][_0x2b9065[_0x8df8('0xb7')]]);this[_0x8df8('0x1f')][_0x2b9065[_0x8df8('0xb7')]][_0x8df8('0x60')]+=0x1;this[_0x8df8('0x1f')][_0x2b9065[_0x8df8('0xb7')]][_0x8df8('0x5f')]+=0x1;_0xdef52=new Hangup(_0x2b9065,_0x150f49);_0xdef52[_0x8df8('0xa9')]=0x10;_0xdef52[_0x8df8('0xaa')]=_0x8df8('0x105');_0xdef52[_0x8df8('0xe7')]=_0x8df8('0x106');this[_0x8df8('0xcb')](_0xdef52)['catch'](loggerCatch(_0x8df8('0x107')));this[_0x8df8('0xca')](_0xdef52)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x108')));}if(_0x2b9065&&_0x2b9065[_0x8df8('0x4d')]!==_0x8df8('0x80')&&!isNotNull(this[_0x8df8('0x1f')][_0x2b9065['queue']]['dialQueueProject'])){delete this[_0x8df8('0x27')][_0x150f49['uniqueid']];this[_0x8df8('0xb5')](this[_0x8df8('0x1f')][_0x2b9065[_0x8df8('0xb7')]]);this['voiceQueues'][_0x2b9065[_0x8df8('0xb7')]][_0x8df8('0x69')]+=0x1;_0xdef52=new Hangup(_0x2b9065,_0x150f49);_0xdef52[_0x8df8('0xa9')]=0xc;_0xdef52['statedesc']=_0x150f49[_0x8df8('0x109')];_0xdef52[_0x8df8('0xe7')]=_0x8df8('0x10a');this[_0x8df8('0xcb')](_0xdef52)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8df8('0xca')](_0xdef52)[_0x8df8('0xb3')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x8df8('0x19')]['syncAgentComplete']=function(_0x360dd5){var _0x212cd8=this[_0x8df8('0x27')][_0x360dd5['uniqueid']];var _0x58df53=this;if(this['voiceQueues'][_0x360dd5[_0x8df8('0xb7')]]){if(_0x212cd8&&_0x212cd8[_0x8df8('0x4d')]!==_0x8df8('0x80')){delete this[_0x8df8('0x27')][_0x360dd5['uniqueid']];this[_0x8df8('0x1f')][_0x360dd5[_0x8df8('0xb7')]][_0x8df8('0x60')]+=0x1;var _0x50ffc2=new AgentComplete(_0x212cd8,_0x360dd5);if(_0x360dd5[_0x8df8('0x10b')]===_0x8df8('0x10c')){_0x50ffc2[_0x8df8('0x10d')]=this[_0x8df8('0x1f')][_0x360dd5[_0x8df8('0xb7')]][_0x8df8('0x10e')]&&this[_0x8df8('0x1f')][_0x360dd5[_0x8df8('0xb7')]][_0x8df8('0x10f')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x8df8('0xcb')](_0x50ffc2)[_0x8df8('0xb3')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x8df8('0xca')](_0x50ffc2)['catch'](loggerCatch(_0x8df8('0x110')));}}};Dialer[_0x8df8('0x19')][_0x8df8('0x2d')]=function(_0x39df3f){if(this[_0x8df8('0x1f')][_0x39df3f['queue']]){if(this[_0x8df8('0x27')][_0x39df3f[_0x8df8('0xde')]]&&this[_0x8df8('0x27')][_0x39df3f[_0x8df8('0xde')]][_0x8df8('0x4d')]!=='ivr'){this['updateOriginated'](this[_0x8df8('0x1f')][_0x39df3f[_0x8df8('0xb7')]]);this[_0x8df8('0x27')][_0x39df3f[_0x8df8('0xde')]][_0x8df8('0x111')]=moment()[_0x8df8('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x8df8('0x19')][_0x8df8('0x112')]=function(_0x435126){this[_0x8df8('0xcb')](_0x435126)['catch'](loggerCatch(_0x8df8('0x113')));this[_0x8df8('0xca')](_0x435126)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x114')));};Dialer[_0x8df8('0x19')]['syncQueueCallerAbandon']=function(_0x2f6ab3){var _0x5a1298=this[_0x8df8('0x27')][_0x2f6ab3[_0x8df8('0xde')]];var _0x34a7c9=this;if(this[_0x8df8('0x1f')][_0x2f6ab3[_0x8df8('0xb7')]]){if(_0x5a1298&&_0x5a1298[_0x8df8('0x4d')]!==_0x8df8('0x80')){delete this[_0x8df8('0x27')][_0x2f6ab3[_0x8df8('0xde')]];this['updateOriginated'](this['voiceQueues'][_0x2f6ab3[_0x8df8('0xb7')]]);_0x5a1298['droptime']=moment()[_0x8df8('0x7d')](_0x8df8('0xfa'));var _0x3b5af0=new QueueCallerAbandon(_0x5a1298,_0x2f6ab3);if(getSeconds(_0x5a1298[_0x8df8('0x115')],_0x5a1298[_0x8df8('0x116')])>=_0x5a1298[_0x8df8('0x117')]){this[_0x8df8('0x1f')][_0x2f6ab3[_0x8df8('0xb7')]][_0x8df8('0x6e')]+=0x1;this['voiceQueues'][_0x2f6ab3['queue']][_0x8df8('0x65')]+=0x1;this[_0x8df8('0x1f')][_0x2f6ab3[_0x8df8('0xb7')]][_0x8df8('0x70')]+=0x1;_0x3b5af0[_0x8df8('0xa9')]=0xa;_0x3b5af0[_0x8df8('0xaa')]=_0x8df8('0x118');_0x3b5af0[_0x8df8('0x119')]=_0x8df8('0x11a');_0x3b5af0[_0x8df8('0x10d')]=this[_0x8df8('0x1f')][_0x2f6ab3[_0x8df8('0xb7')]][_0x8df8('0x10e')]?moment()[_0x8df8('0x7d')](_0x8df8('0xfa')):undefined;_0x3b5af0[_0x8df8('0xf2')]+=0x1;_0x3b5af0['countglobal']+=0x1;if(_0x3b5af0[_0x8df8('0xf2')]>=this[_0x8df8('0x1f')][_0x2f6ab3['queue']]['dialDropMaxRetry']){this['queueCallerAbandonCreateState'](_0x3b5af0);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x3b5af0['countdropretry'],'scheduledat':moment()[_0x8df8('0xf8')](this[_0x8df8('0x1f')][_0x2f6ab3[_0x8df8('0xb7')]][_0x8df8('0x11b')],_0x8df8('0x102'))['format'](_0x8df8('0xfa')),'ContactId':_0x5a1298[_0x8df8('0xd4')],'ListId':_0x5a1298[_0x8df8('0xfb')],'VoiceQueueId':_0x5a1298[_0x8df8('0xd6')]||undefined,'CampaignId':_0x5a1298['CampaignId']||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x11c')));var _0x2eeda8=new History(_0x3b5af0);_0x2eeda8['state']=0xa;_0x2eeda8[_0x8df8('0xaa')]='Drop';_0x2eeda8[_0x8df8('0xac')]=moment()[_0x8df8('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2eeda8['endtime']=_0x2eeda8[_0x8df8('0xac')];_0x2eeda8[_0x8df8('0x11d')]=_0x3b5af0[_0x8df8('0x11d')];_0x2eeda8[_0x8df8('0x11e')]=_0x3b5af0[_0x8df8('0x11e')];this[_0x8df8('0xcb')](_0x2eeda8)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x11f')));}}else{this[_0x8df8('0x1f')][_0x2f6ab3[_0x8df8('0xb7')]][_0x8df8('0x6d')]+=0x1;this[_0x8df8('0x1f')][_0x2f6ab3['queue']][_0x8df8('0x64')]+=0x1;_0x3b5af0[_0x8df8('0xa9')]=0xb;_0x3b5af0['statedesc']=_0x8df8('0x120');_0x3b5af0['dropreason']=_0x8df8('0x121');_0x3b5af0['countabandonedretry']+=0x1;_0x3b5af0[_0x8df8('0xed')]+=0x1;if(_0x3b5af0[_0x8df8('0xf3')]>=this[_0x8df8('0x1f')][_0x2f6ab3[_0x8df8('0xb7')]]['dialAbandonedMaxRetry']){this[_0x8df8('0x112')](_0x3b5af0);}else{this[_0x8df8('0xc3')]({'active':![],'countabandonedretry':_0x3b5af0['countabandonedretry'],'scheduledat':moment()[_0x8df8('0xf8')](this[_0x8df8('0x1f')][_0x2f6ab3[_0x8df8('0xb7')]][_0x8df8('0x122')],_0x8df8('0x102'))['format'](_0x8df8('0xfa')),'ContactId':_0x5a1298[_0x8df8('0xd4')],'ListId':_0x5a1298[_0x8df8('0xfb')],'VoiceQueueId':_0x5a1298[_0x8df8('0xd6')]||undefined,'CampaignId':_0x5a1298[_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x2eeda8=new History(_0x3b5af0);_0x2eeda8['state']=0xb;_0x2eeda8[_0x8df8('0xaa')]='Abandoned';_0x2eeda8[_0x8df8('0xac')]=moment()['format'](_0x8df8('0xfa'));_0x2eeda8[_0x8df8('0xab')]=_0x2eeda8[_0x8df8('0xac')];_0x2eeda8[_0x8df8('0x11d')]=_0x3b5af0[_0x8df8('0x11d')];_0x2eeda8[_0x8df8('0x11e')]=_0x3b5af0[_0x8df8('0x11e')];this['createHistory'](_0x2eeda8)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x123')));}}}}};Dialer[_0x8df8('0x19')][_0x8df8('0x36')]=function(_0x2710bc){if(this[_0x8df8('0x25')][_0x2710bc[_0x8df8('0xde')]]){this[_0x8df8('0x25')][_0x2710bc[_0x8df8('0xde')]][_0x8df8('0xb2')]=_0x2710bc[_0x8df8('0xb2')];}if(this[_0x8df8('0x27')][_0x2710bc[_0x8df8('0xde')]]){this[_0x8df8('0x27')][_0x2710bc[_0x8df8('0xde')]][_0x8df8('0xb2')]=_0x2710bc[_0x8df8('0xb2')];}};Dialer['prototype'][_0x8df8('0x39')]=function(_0x27817d){if(strategy[this[_0x8df8('0x1f')][this['actions'][_0x27817d[_0x8df8('0x124')]][_0x8df8('0xb7')]][_0x8df8('0x4f')]]===_0x8df8('0x18')){if(this[_0x8df8('0x25')][_0x27817d[_0x8df8('0x124')]]&&_[_0x8df8('0xb0')](this[_0x8df8('0x25')][_0x27817d[_0x8df8('0x124')]]['locked'])&&_0x27817d[_0x8df8('0xdb')]==='1'&&_0x27817d['paused']==='0'){if(this[_0x8df8('0x21')][_0x27817d[_0x8df8('0x125')]]){if(!this[_0x8df8('0x21')][_0x27817d[_0x8df8('0x125')]][_0x8df8('0x126')]){this[_0x8df8('0x21')][_0x27817d[_0x8df8('0x125')]]['locked']=!![];this[_0x8df8('0x25')][_0x27817d[_0x8df8('0x124')]][_0x8df8('0x126')]=!![];this[_0x8df8('0x25')][_0x27817d[_0x8df8('0x124')]]['stateinterface']=_0x27817d[_0x8df8('0x125')];}}}}else if((strategy[this[_0x8df8('0x1f')][this['actions'][_0x27817d['actionid']][_0x8df8('0xb7')]]['strategy']]||_0x8df8('0x17'))==='rrmemory'){if(this[_0x8df8('0x25')][_0x27817d['actionid']]){if(this[_0x8df8('0x21')][_0x27817d[_0x8df8('0x125')]]){this[_0x8df8('0x25')][_0x27817d[_0x8df8('0x124')]][_0x8df8('0x125')]=_0x27817d[_0x8df8('0x125')];if(_[_0x8df8('0xb0')](this[_0x8df8('0x2c')][this[_0x8df8('0x25')][_0x27817d[_0x8df8('0x124')]][_0x8df8('0xb7')]])){this[_0x8df8('0x2c')][this[_0x8df8('0x25')][_0x27817d['actionid']][_0x8df8('0xb7')]]=[];}this[_0x8df8('0x2c')][this[_0x8df8('0x25')][_0x27817d[_0x8df8('0x124')]][_0x8df8('0xb7')]][_0x8df8('0x127')](_[_0x8df8('0xd2')](_[_0x8df8('0xd3')](this[_0x8df8('0x25')][_0x27817d[_0x8df8('0x124')]],[_0x8df8('0x128'),_0x8df8('0x125')]),{'status':_0x27817d['status'],'paused':_0x27817d['paused']}));}}}};function unlockQueueStatus(_0x3dfd43,_0x13eed3){setTimeout(function(){if(_[_0x8df8('0x8d')](_0x3dfd43['queueStatusComplete'])){loggerBooked[_0x8df8('0x95')](_0x8df8('0x129'),_0x13eed3);}_0x3dfd43['queueStatusComplete']=!![];loggerBooked[_0x8df8('0x84')](_0x8df8('0x12a'),_0x13eed3,JSON['stringify'](_[_0x8df8('0xd3')](_0x3dfd43,[_0x8df8('0x3f'),_0x8df8('0x12b')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x526ab5){var _0x1b83bb=this;var _0x34603=_0x1b83bb[_0x8df8('0x1f')][_0x1b83bb[_0x8df8('0x25')][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]];if(strategy[this[_0x8df8('0x1f')][this[_0x8df8('0x25')][_0x526ab5['actionid']][_0x8df8('0xb7')]][_0x8df8('0x4f')]]===_0x8df8('0x18')){if(this[_0x8df8('0x25')][_0x526ab5['actionid']]&&this['actions'][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0x125')]){this[_0x8df8('0x1e')][_0x8df8('0x12c')](this[_0x8df8('0x25')][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0x128')],this[_0x8df8('0x25')][_0x526ab5['actionid']][_0x8df8('0x125')])[_0x8df8('0xb3')](function(_0x4677e6){logger[_0x8df8('0x95')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x8df8('0xd0')](_0x4677e6,{'showHidden':![],'depth':null}));})['finally'](function(){_0x1b83bb['updateOriginated'](_0x1b83bb[_0x8df8('0x1f')][_0x1b83bb[_0x8df8('0x25')][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]]);_0x1b83bb[_0x8df8('0x21')][_0x1b83bb['actions'][_0x526ab5['actionid']]['stateinterface']][_0x8df8('0x126')]=![];delete _0x1b83bb[_0x8df8('0x25')][_0x526ab5[_0x8df8('0x124')]];unlockQueueStatus(_0x34603);});}else{this[_0x8df8('0xb5')](this[_0x8df8('0x1f')][this['actions'][_0x526ab5['actionid']][_0x8df8('0xb7')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x8df8('0x25')][_0x526ab5['actionid']]['ContactId'],'ListId':this[_0x8df8('0x25')][_0x526ab5['actionid']][_0x8df8('0xfb')],'VoiceQueueId':this['actions'][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xd6')]||undefined,'CampaignId':this['actions'][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x12d')));delete this[_0x8df8('0x25')][_0x526ab5[_0x8df8('0x124')]];unlockQueueStatus(_0x34603);}}else if((strategy[this['voiceQueues'][this[_0x8df8('0x25')][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]][_0x8df8('0x4f')]]||_0x8df8('0x17'))===_0x8df8('0x17')){var _0x2dc5d8;if(this[_0x8df8('0x25')][_0x526ab5['actionid']]&&!_[_0x8df8('0x45')](this[_0x8df8('0x2c')][this[_0x8df8('0x25')][_0x526ab5[_0x8df8('0x124')]]['queue']])){if(this[_0x8df8('0x12e')][_0x1b83bb[_0x8df8('0x25')][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]]){this[_0x8df8('0x12e')][_0x1b83bb['actions'][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]]=this[_0x8df8('0x12e')][this[_0x8df8('0x25')][_0x526ab5['actionid']][_0x8df8('0xb7')]]?this[_0x8df8('0x12e')][this['actions'][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]]:this['queueBooked'][this['actions'][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]]?this['queueBooked'][this['actions'][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]][_0x8df8('0x12f')]||0x0:0x0;}this[_0x8df8('0x2c')][this[_0x8df8('0x25')][_0x526ab5['actionid']][_0x8df8('0xb7')]][_0x8df8('0x12f')]=this['queueBookedRR'][this['actions'][_0x526ab5[_0x8df8('0x124')]][_0x8df8('0xb7')]];for(var _0x3ef1d3=0x0;_0x3ef1d3=0x0?!![]:![];})['catch'](myreject(_0x584bc8)));}}else{_0x4b3627[_0x8df8('0x127')](ami[_0x8df8('0xb1')]({'action':_0x8df8('0x149'),'command':util[_0x8df8('0x7d')](_0x8df8('0x147'),_0x522802,!_[_0x8df8('0x8d')](config[_0x8df8('0x145')][_0x53c08b])?_0x53c08b:'')})['then'](function(_0x266824){return _0x266824[_0x8df8('0x14a')][_0x8df8('0x148')](_0x8df8('0x14b'))>=0x0?!![]:![];})[_0x8df8('0xb3')](myreject(_0x584bc8)));}BPromise[_0x8df8('0x14c')](_0x4b3627)[_0x8df8('0xba')](function(_0x386581){var _0x1dd869=_[_0x8df8('0x14d')](_0x386581);if(_0x1dd869){return _0x353be3(_0x1dd869);}else{_0x18ccb8['message']=_0x52cca4?_0x8df8('0x14e'):_0x8df8('0x14f');return _0x584bc8(msgResponse(_0x8df8('0x150'),_0x8df8('0x142'),'Global:\x20'+_0x52cca4+'\x20'+_0x4326d4+'\x20Interval\x20is\x20overtime:\x20'+util[_0x8df8('0xd0')](_0x522802,{'showHidden':![],'depth':null})+_0x8df8('0x151')+_0x53c08b));}})['catch'](function(_0xbbc0fa){return _0x584bc8(msgResponse('ifTime','Failure',JSON[_0x8df8('0x7c')](_0xbbc0fa)));});});};Dialer['prototype'][_0x8df8('0x152')]=function(_0x7ae4ce){var _0xab25bd=this;return function(){switch(_0x7ae4ce[_0x8df8('0x5b')]){case _0x8df8('0x153'):freeVariablesPredictive(_0x7ae4ce);_0xab25bd[_0x8df8('0x154')](_0x7ae4ce,0x1);break;case _0x8df8('0x155'):freeVariablesPredictive(_0x7ae4ce);_0xab25bd[_0x8df8('0x154')](_0x7ae4ce,_0x7ae4ce[_0x8df8('0x156')]);break;case _0x8df8('0x8'):_0xab25bd['predictive'](_0x7ae4ce);break;case _0x8df8('0x157'):freeVariablesPredictive(_0x7ae4ce);_0xab25bd[_0x8df8('0x154')](_0x7ae4ce,0x1);break;default:freeVariablesPredictive(_0x7ae4ce);logger[_0x8df8('0x95')](_0x8df8('0x158'),_0x7ae4ce[_0x8df8('0x3f')],_0x8df8('0x159'));}};};Dialer[_0x8df8('0x19')][_0x8df8('0x15a')]=function(_0x385bea){var _0x2beaa0=this;return function(){_0x2beaa0[_0x8df8('0x15b')](_0x385bea);};};Dialer[_0x8df8('0x19')][_0x8df8('0x9')]=function(_0x4ac83e){var _0xc5ad76=this;if(isNotPreview(_0x4ac83e['dialMethod'])){if(isVoiceQueueOutbound(_0x4ac83e[_0x8df8('0x4d')])&&isActive(_0x4ac83e[_0x8df8('0x5a')])){_0x4ac83e[_0x8df8('0xa0')]=!![];BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](checkIsLoggedIn(_0x4ac83e,_0x4ac83e[_0x8df8('0x52')]))[_0x8df8('0xba')](checkIsActive(_0x4ac83e,_0x4ac83e[_0x8df8('0x5a')]))['then'](checkInterval(_0x4ac83e))[_0x8df8('0xba')](_0xc5ad76[_0x8df8('0x13b')](_0x4ac83e))['then'](_0xc5ad76[_0x8df8('0x15c')](_0x4ac83e['dialGlobalInterval'],_0x4ac83e[_0x8df8('0x15d')],_0x4ac83e[_0x8df8('0x3f')],_0x4ac83e))[_0x8df8('0xba')](_0xc5ad76[_0x8df8('0x140')](_0x4ac83e['Interval'],_0x4ac83e['dialTimezone'],_0x4ac83e['name'],_0x4ac83e))[_0x8df8('0xba')](_0xc5ad76[_0x8df8('0x152')](_0x4ac83e))[_0x8df8('0xb3')](loggerCatchQueueSummary(_0x8df8('0x15e'),_0x4ac83e));}else{notSendMessagesQueue(_0x4ac83e);}}else{freeVariablesPredictive(_0x4ac83e);}};Dialer[_0x8df8('0x19')][_0x8df8('0x13a')]=function(){var _0x4c1b3a=this;var _0x230cc6;for(var _0x439a19 in this[_0x8df8('0x20')]){if(this[_0x8df8('0x20')][_0x8df8('0x97')](_0x439a19)){_0x230cc6=this[_0x8df8('0x20')][_0x439a19];if(isCampaignIvr(_0x230cc6[_0x8df8('0x4d')])&&isActive(_0x230cc6[_0x8df8('0x7a')])){_0x230cc6[_0x8df8('0xa0')]=!![];BPromise[_0x8df8('0xb9')]()[_0x8df8('0xba')](checkIsActive(_0x230cc6,_0x230cc6[_0x8df8('0x7a')]))[_0x8df8('0xba')](checkInterval(_0x230cc6))['then'](_0x4c1b3a[_0x8df8('0x13b')](_0x230cc6))[_0x8df8('0xba')](_0x4c1b3a['checkIfTime'](_0x230cc6[_0x8df8('0x15f')],_0x230cc6[_0x8df8('0x15d')],_0x230cc6[_0x8df8('0x3f')],_0x230cc6))[_0x8df8('0xba')](_0x4c1b3a[_0x8df8('0x140')](_0x230cc6[_0x8df8('0x43')],_0x230cc6[_0x8df8('0x15d')],_0x230cc6[_0x8df8('0x3f')],_0x230cc6))[_0x8df8('0xba')](_0x4c1b3a['launchHandleIvr'](_0x230cc6))[_0x8df8('0xb3')](loggerCatchQueueSummary(_0x8df8('0x160'),_0x230cc6));}else{notSendMessagesCampaign(_0x230cc6);}}}};function getCallerIdRandom(_0x594098,_0x1f8463){var _0x17fcf5,_0x28f632,_0x3a65ea;if(_0x1f8463<=0x0){_0x1f8463=0x1;}_0x17fcf5=new RegExp(_0x8df8('0x161')+_0x1f8463+'}$');_0x28f632=Math[_0x8df8('0x162')](0xa,_0x1f8463-0x1);_0x3a65ea=Math[_0x8df8('0x162')](0xa,_0x1f8463)-0x1;return util['format']('%s',_[_0x8df8('0x163')](_0x594098,_0x17fcf5,_[_0x8df8('0x164')](_0x28f632,_0x3a65ea)));}function extractCalleridName(_0xe625fc){var _0x3c73a8=_0xe625fc['match'](/"(.*?)"/);return _0x3c73a8?_0x3c73a8[0x1]:_0xe625fc;}function extractCalleridNumber(_0x564fbb){var _0x43440a=_0x564fbb[_0x8df8('0x165')](/<(.*?)>/);return _0x43440a?_0x43440a[0x1]:_0x564fbb;}Dialer['prototype'][_0x8df8('0x166')]=function(_0x454435,_0x5c36fd){var _0x140249=this;var _0x135087=uuid['v4']();this[_0x8df8('0x25')][_0x135087]=new Action(_0x454435,_0x5c36fd,_0x135087);return new BPromise(function(_0x14e77f,_0x53ccd7){if(_[_0x8df8('0x8d')](_0x454435)&&_0x8df8('0x167')!==typeof _0x454435){return _0x53ccd7(msgResponse('originate',_0x8df8('0x142'),'voiceQueue\x20is\x20undefine'));}if(_[_0x8df8('0x8d')](_0x5c36fd[_0x8df8('0x168')][_0x8df8('0x169')])||_0x5c36fd[_0x8df8('0x168')]['phone']===null){return _0x53ccd7(msgResponse(_0x8df8('0x16a'),_0x8df8('0x142'),_0x8df8('0x16b')));}var _0x34e736={'XMD-CALLERID':_0x140249[_0x8df8('0x25')][_0x135087][_0x8df8('0x16c')](),'XMD-AGI':_0x454435['dialQueueProject']?util[_0x8df8('0x7d')](_0x8df8('0x16d'),ipAgi,_0x454435[_0x8df8('0x104')]):_0x8df8('0x16e'),'XMD-AGIAFTER':_0x454435[_0x8df8('0x10e')]?util[_0x8df8('0x7d')](_0x8df8('0x16d'),ipAgi,_0x454435[_0x8df8('0x10e')]):_0x8df8('0x16e'),'XMD-QUEUE':_0x454435[_0x8df8('0x4d')]==='outbound'?util['format'](_0x8df8('0x16f'),_0x454435['name'],_0x454435[_0x8df8('0x170')]||'',_0x454435[_0x8df8('0x10f')]?'c':'',_0x454435[_0x8df8('0x117')]||0x3):_0x8df8('0x16e'),'XMD-CONTACTID':_0x5c36fd[_0x8df8('0xd4')],'XMD-CDRTYPE':_0x8df8('0x171'),'CALLERID(all)':_0x140249[_0x8df8('0x25')][_0x135087][_0x8df8('0x16c')](),'XMD-AMD':_0x454435[_0x8df8('0xe3')]?_0x8df8('0x172'):'NONE','XMD-DESTINATION':_0x8df8('0xe2')};if(_0x454435[_0x8df8('0xe3')]){_0x34e736[_0x8df8('0x173')]=_0x454435[_0x8df8('0x174')]||0x9c4;_0x34e736['XMD-AMDGREETING']=_0x454435['dialAMDGreeting']||0x5dc;_0x34e736[_0x8df8('0x175')]=_0x454435[_0x8df8('0x176')]||0x320;_0x34e736[_0x8df8('0x177')]=_0x454435[_0x8df8('0x178')]||0x1388;_0x34e736['XMD-AMDMINWORDLENGTH']=_0x454435[_0x8df8('0x179')]||0x64;_0x34e736[_0x8df8('0x17a')]=_0x454435[_0x8df8('0x17b')]||0x32;_0x34e736[_0x8df8('0x17c')]=_0x454435[_0x8df8('0x17d')]||0x3;_0x34e736[_0x8df8('0x17e')]=_0x454435[_0x8df8('0x17f')]||0x100;_0x34e736[_0x8df8('0x180')]=_0x454435[_0x8df8('0x181')]||0x1388;}if(_0x454435[_0x8df8('0x4d')]==='outbound'){_0x34e736[_0x8df8('0x182')]=_0x5c36fd[_0x8df8('0xd6')];}else{_0x34e736[_0x8df8('0x183')]=_0x5c36fd[_0x8df8('0xfc')];}for(var _0x96e4ba in _0x5c36fd[_0x8df8('0x168')]){if(_0x5c36fd['Contact']['hasOwnProperty'](_0x96e4ba)){if(isNotNull(_0x5c36fd[_0x8df8('0x168')][_0x96e4ba])&&_0x96e4ba!=='id'&&_0x96e4ba!==_0x8df8('0x184')&&_0x96e4ba!==_0x8df8('0x185')&&_0x96e4ba!==_0x8df8('0x186')){_0x34e736[util['format'](_0x8df8('0x187'),_0x8df8('0x188'),_[_0x8df8('0x189')](_0x96e4ba))]=_0x5c36fd[_0x8df8('0x168')][_0x96e4ba];}}}var _0x1f933c=_0x140249[_0x8df8('0x13c')](_0x454435[_0x8df8('0x79')])?getCallerId(_0x454435[_0x8df8('0x79')]['callerid'],_0x454435[_0x8df8('0x5c')],_0x454435[_0x8df8('0x18a')]>0x0?getCallerIdRandom(_0x454435['dialOriginateCallerIdNumber'],_0x454435[_0x8df8('0x18a')]):_0x454435[_0x8df8('0x5d')]):getCallerId(_['isNil'](_0x454435[_0x8df8('0x18b')])?_0x454435[_0x8df8('0x79')][_0x8df8('0x7b')]:_0x454435[_0x8df8('0x18b')][_0x8df8('0x7b')],_0x454435[_0x8df8('0x5c')],_0x454435[_0x8df8('0x18a')]>0x0?getCallerIdRandom(_0x454435['dialOriginateCallerIdNumber'],_0x454435[_0x8df8('0x18a')]):_0x454435['dialOriginateCallerIdNumber']);if(_0x1f933c){_0x34e736[_0x8df8('0x18c')]=_0x140249['actions'][_0x135087][_0x8df8('0x18d')]=extractCalleridName(_0x1f933c);_0x34e736[_0x8df8('0x18e')]=_0x140249['actions'][_0x135087]['originatecalleridnum']=extractCalleridNumber(_0x1f933c);}return ami[_0x8df8('0xb1')]({'actionid':_0x135087,'action':_0x8df8('0x16a'),'channel':_0x140249[_0x8df8('0x13c')](_0x454435[_0x8df8('0x79')])?util['format'](_0x8df8('0x18f'),_0x454435['Trunk'][_0x8df8('0x3f')],isNotNull(_0x454435[_0x8df8('0x190')])?_0x454435[_0x8df8('0x190')][_0x8df8('0x191')]()||'':'',_0x454435[_0x8df8('0x192')]>0x0?_0x5c36fd[_0x8df8('0x168')][_0x8df8('0x169')][_0x8df8('0x193')](_0x454435[_0x8df8('0x192')]):_0x5c36fd[_0x8df8('0x168')][_0x8df8('0x169')]):util['format'](_0x8df8('0x18f'),_[_0x8df8('0xb0')](_0x454435[_0x8df8('0x18b')])?_0x454435[_0x8df8('0x79')][_0x8df8('0x3f')]:_0x454435[_0x8df8('0x18b')][_0x8df8('0x3f')],isNotNull(_0x454435['dialPrefix'])?_0x454435['dialPrefix'][_0x8df8('0x191')]()||'':'',_0x454435['dialCutDigit']>0x0?_0x5c36fd[_0x8df8('0x168')]['phone']['substring'](_0x454435['dialCutDigit']):_0x5c36fd['Contact'][_0x8df8('0x169')]),'callerid':_0x1f933c,'Exten':_0x8df8('0xe2'),'Context':'from-sip','Priority':'1','variable':_0x34e736,'timeout':(_0x454435[_0x8df8('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x135087})['then'](function(_0x68676d){return _0x14e77f(_0x68676d);})[_0x8df8('0xb3')](function(_0xbd054a){_0x454435['outboundOriginateFailureCallsDay']+=0x1;var _0x92f0bf=new History(_0x140249[_0x8df8('0x25')][_0x135087]);logger['error'](util[_0x8df8('0x7d')](_0x8df8('0x194'),JSON[_0x8df8('0x7c')](_0xbd054a)));_0x92f0bf['state']=0xe;_0x92f0bf[_0x8df8('0xaa')]=_0x8df8('0x195');_0x92f0bf[_0x8df8('0xac')]=moment()['format'](_0x8df8('0xfa'));_0x92f0bf[_0x8df8('0xab')]=_0x92f0bf[_0x8df8('0xac')];_0x140249[_0x8df8('0xcb')](_0x92f0bf)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x196')));_0x140249['moveContactManagedDialer'](_0x92f0bf)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x196')))[_0x8df8('0x1c')](function(){delete _0x140249[_0x8df8('0x25')][_0x135087];return _0x53ccd7(msgResponse(_0x8df8('0x16a'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x8df8('0x19')][_0x8df8('0x30')]=function(_0x14a455){var _0x440baa=this[_0x8df8('0x25')][_0x14a455[_0x8df8('0x124')]];var _0x16df4b=this;if(_0x440baa){delete this['actions'][_0x14a455[_0x8df8('0x124')]];_0x440baa[_0x8df8('0x116')]=moment()[_0x8df8('0x7d')](_0x8df8('0xfa'));var _0x501eb6=_0x440baa[_0x8df8('0x4d')]==='ivr'?this[_0x8df8('0x20')][_0x440baa[_0x8df8('0xb7')]]:this[_0x8df8('0x1f')][_0x440baa['getQueue']()];if(!this[_0x8df8('0x197')](_0x14a455[_0x8df8('0x198')])){this['updateOriginated'](_0x501eb6);return this['callProgressDetecting'](_0x440baa,_0x501eb6,_0x14a455)[_0x8df8('0xba')](function(_0x468adb){})['catch'](loggerCatch(_0x8df8('0x199')));}else{this[_0x8df8('0x27')][_0x14a455['uniqueid']]=_0x440baa;}}};Dialer['prototype'][_0x8df8('0x19a')]=function(_0x19deb8,_0x35893a,_0x29d437){var _0x420c7b=new History(_0x35893a);if(_0x420c7b[_0x8df8('0xfe')]+_0x420c7b['countcongestionretry']+_0x420c7b[_0x8df8('0xf1')]+_0x420c7b[_0x8df8('0xff')]+_0x420c7b[_0x8df8('0xf2')]+_0x420c7b[_0x8df8('0xf3')]+_0x420c7b['countmachineretry']+_0x420c7b[_0x8df8('0xf4')]>=_0x29d437[_0x8df8('0xf5')]-0x1){return!![];}switch(_0x19deb8){case 0x3:if(_0x420c7b['countnoanswerretry']>=_0x29d437['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x8df8('0xc3')]({'active':![],'countnoanswerretry':_0x420c7b[_0x8df8('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x29d437[_0x8df8('0x19b')],_0x8df8('0x102'))[_0x8df8('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x420c7b[_0x8df8('0xd4')],'ListId':_0x420c7b[_0x8df8('0xfb')],'VoiceQueueId':_0x420c7b[_0x8df8('0xd6')]||undefined,'CampaignId':_0x420c7b['CampaignId']||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x19c')));}break;case 0x5:if(_0x420c7b[_0x8df8('0xfe')]>=_0x29d437['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x8df8('0xc3')]({'active':![],'countbusyretry':_0x420c7b['countbusyretry']+=0x1,'scheduledat':moment()[_0x8df8('0xf8')](_0x29d437[_0x8df8('0x19d')],_0x8df8('0x102'))[_0x8df8('0x7d')](_0x8df8('0xfa')),'ContactId':_0x420c7b['ContactId'],'ListId':_0x420c7b['ListId'],'VoiceQueueId':_0x420c7b[_0x8df8('0xd6')]||undefined,'CampaignId':_0x420c7b[_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x19e')));}break;case 0x8:if(_0x420c7b['countcongestionretry']>=_0x29d437[_0x8df8('0x19f')]-0x1){return!![];}else{this[_0x8df8('0xc3')]({'active':![],'countcongestionretry':_0x420c7b[_0x8df8('0xf0')]+=0x1,'scheduledat':moment()[_0x8df8('0xf8')](_0x29d437[_0x8df8('0x1a0')],_0x8df8('0x102'))[_0x8df8('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x420c7b[_0x8df8('0xd4')],'ListId':_0x420c7b[_0x8df8('0xfb')],'VoiceQueueId':_0x420c7b['VoiceQueueId']||undefined,'CampaignId':_0x420c7b[_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x420c7b[_0x8df8('0xff')]>=_0x29d437[_0x8df8('0x1a1')]-0x1){return!![];}else{this[_0x8df8('0xc3')]({'active':![],'countnosuchnumberretry':_0x420c7b['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x8df8('0xf8')](_0x29d437[_0x8df8('0x1a2')],_0x8df8('0x102'))[_0x8df8('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x420c7b[_0x8df8('0xd4')],'ListId':_0x420c7b[_0x8df8('0xfb')],'VoiceQueueId':_0x420c7b['VoiceQueueId']||undefined,'CampaignId':_0x420c7b[_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x1a3')));}break;case 0xa:if(_0x420c7b['countdropretry']>=_0x29d437[_0x8df8('0x1a4')]-0x1){return!![];}else{this[_0x8df8('0xc3')]({'active':![],'countdropretry':_0x420c7b[_0x8df8('0xf2')]+=0x1,'scheduledat':moment()[_0x8df8('0xf8')](_0x29d437[_0x8df8('0x11b')],_0x8df8('0x102'))[_0x8df8('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x420c7b[_0x8df8('0xd4')],'ListId':_0x420c7b[_0x8df8('0xfb')],'VoiceQueueId':_0x420c7b[_0x8df8('0xd6')]||undefined,'CampaignId':_0x420c7b['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x420c7b[_0x8df8('0xf3')]>=_0x29d437[_0x8df8('0x1a5')]-0x1){return!![];}else{this[_0x8df8('0xc3')]({'active':![],'countabandonedretry':_0x420c7b[_0x8df8('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x29d437[_0x8df8('0x122')],_0x8df8('0x102'))[_0x8df8('0x7d')](_0x8df8('0xfa')),'ContactId':_0x420c7b[_0x8df8('0xd4')],'ListId':_0x420c7b[_0x8df8('0xfb')],'VoiceQueueId':_0x420c7b[_0x8df8('0xd6')]||undefined,'CampaignId':_0x420c7b['CampaignId']||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x1a6')));}break;case 0x13:if(_0x420c7b[_0x8df8('0xec')]>=_0x29d437[_0x8df8('0xf7')]-0x1){return!![];}else{this[_0x8df8('0xc3')]({'active':![],'countmachineretry':_0x420c7b['countmachineretry']+=0x1,'scheduledat':moment()[_0x8df8('0xf8')](_0x29d437[_0x8df8('0xf9')],'minutes')[_0x8df8('0x7d')](_0x8df8('0xfa')),'ContactId':_0x420c7b[_0x8df8('0xd4')],'ListId':_0x420c7b[_0x8df8('0xfb')],'VoiceQueueId':_0x420c7b[_0x8df8('0xd6')]||undefined,'CampaignId':_0x420c7b[_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x103')));}break;case 0x14:if(_0x420c7b[_0x8df8('0xf4')]>=_0x29d437[_0x8df8('0x1a7')]-0x1){return!![];}else{this[_0x8df8('0xc3')]({'active':![],'countagentrejectretry':_0x420c7b['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x8df8('0xf8')](_0x29d437[_0x8df8('0x1a8')],_0x8df8('0x102'))[_0x8df8('0x7d')](_0x8df8('0xfa')),'ContactId':_0x420c7b['ContactId'],'ListId':_0x420c7b[_0x8df8('0xfb')],'VoiceQueueId':_0x420c7b[_0x8df8('0xd6')]||undefined,'CampaignId':_0x420c7b['CampaignId']||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x1a9')));}break;default:return!![];}};Dialer[_0x8df8('0x19')][_0x8df8('0x1aa')]=function(_0x4ee873,_0x37bcee,_0x3361a5){var _0x555231=this;var _0x24fbb5=new History(_0x4ee873);return new BPromise(function(_0x589424,_0x532d12){if(_[_0x8df8('0x8d')](_0x37bcee)&&_0x8df8('0x167')!==typeof _0x37bcee){return _0x532d12(msgResponse('[callProgressDetecting]',_0x8df8('0x142'),_0x8df8('0x1ab')));}if(_[_0x8df8('0x8d')](_0x3361a5)&&_0x8df8('0x167')!==typeof _0x3361a5){return _0x532d12(msgResponse(_0x8df8('0x1ac'),_0x8df8('0x142'),_0x8df8('0x1ad')));}switch(_0x3361a5[_0x8df8('0x10b')]){case'0':_0x37bcee['outboundNoSuchCallsDay']+=0x1;_0x24fbb5[_0x8df8('0xa9')]=0x0;_0x24fbb5[_0x8df8('0xaa')]=_0x8df8('0x1ae');_0x24fbb5[_0x8df8('0xff')]+=0x1;_0x24fbb5[_0x8df8('0xed')]+=0x1;ami[_0x8df8('0x4c')](_0x8df8('0x1af'),ut['buildObj'](_0x4ee873,_0x8df8('0x1b0')));_0x555231[_0x8df8('0xcb')](_0x24fbb5)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0xef')));if(_0x555231[_0x8df8('0x19a')](0x0,_0x4ee873,_0x37bcee)){if(_0x24fbb5[_0x8df8('0xff')]>=_0x37bcee[_0x8df8('0x1a1')]){_0x555231[_0x8df8('0x1b1')](_0x24fbb5,_0x589424,_0x532d12,_0x8df8('0x1b2'));}else{_0x555231[_0x8df8('0xf6')](_0x24fbb5,_0x589424,_0x532d12,_0x8df8('0x1b2'));}}break;case'3':_0x37bcee[_0x8df8('0x1b3')]+=0x1;_0x24fbb5[_0x8df8('0xa9')]=0x3;_0x24fbb5[_0x8df8('0xaa')]=_0x8df8('0x1b4');_0x24fbb5[_0x8df8('0xf1')]+=0x1;_0x24fbb5[_0x8df8('0xed')]+=0x1;ami[_0x8df8('0x4c')](_0x8df8('0x1b5'),ut[_0x8df8('0x1b6')](_0x4ee873,'noanswer'));_0x555231[_0x8df8('0xcb')](_0x24fbb5)[_0x8df8('0xb3')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x555231[_0x8df8('0x19a')](0x3,_0x4ee873,_0x37bcee)){if(_0x24fbb5[_0x8df8('0xf1')]>=_0x37bcee[_0x8df8('0x1b7')]){_0x555231[_0x8df8('0x1b1')](_0x24fbb5,_0x589424,_0x532d12,'reason\x203\x20ringing\x20no\x20answer');}else{_0x555231[_0x8df8('0xf6')](_0x24fbb5,_0x589424,_0x532d12,_0x8df8('0x1b8'));}}break;case'5':_0x37bcee['outboundBusyCallsDay']+=0x1;_0x24fbb5['state']=0x5;_0x24fbb5[_0x8df8('0xaa')]='Busy';_0x24fbb5['countbusyretry']+=0x1;_0x24fbb5[_0x8df8('0xed')]+=0x1;ami['emit'](_0x8df8('0x1b9'),ut[_0x8df8('0x1b6')](_0x4ee873,'busy'));_0x555231['createHistory'](_0x24fbb5)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x555231[_0x8df8('0x19a')](0x5,_0x4ee873,_0x37bcee)){if(_0x24fbb5[_0x8df8('0xfe')]>=_0x37bcee[_0x8df8('0x1ba')]){_0x555231['createStateFinal'](_0x24fbb5,_0x589424,_0x532d12,'reason\x205\x20busy');}else{_0x555231['stateGlobal'](_0x24fbb5,_0x589424,_0x532d12,_0x8df8('0x1bb'));}}break;case'8':_0x37bcee[_0x8df8('0x1bc')]+=0x1;_0x24fbb5[_0x8df8('0xa9')]=0x8;_0x24fbb5['statedesc']=_0x8df8('0x1bd');_0x24fbb5[_0x8df8('0xf0')]+=0x1;_0x24fbb5['countglobal']+=0x1;ami[_0x8df8('0x4c')](_0x8df8('0x1be'),ut[_0x8df8('0x1b6')](_0x4ee873,'congestion'));_0x555231['createHistory'](_0x24fbb5)['catch'](loggerCatch(_0x8df8('0x1bf')));if(_0x555231[_0x8df8('0x19a')](0x8,_0x4ee873,_0x37bcee)){if(_0x24fbb5[_0x8df8('0xf0')]>=_0x37bcee['dialCongestionMaxRetry']){_0x555231[_0x8df8('0x1b1')](_0x24fbb5,_0x589424,_0x532d12,'reason\x208\x20congestion');}else{_0x555231[_0x8df8('0xf6')](_0x24fbb5,_0x589424,_0x532d12,_0x8df8('0x1c0'));}}break;case'11':_0x37bcee['outboundAbandonedCallsDay']+=0x1;_0x24fbb5[_0x8df8('0xa9')]=0xb;_0x24fbb5[_0x8df8('0xaa')]=_0x8df8('0x120');_0x24fbb5[_0x8df8('0xf3')]+=0x1;_0x24fbb5['countglobal']+=0x1;_0x555231[_0x8df8('0xcb')](_0x24fbb5)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x123')));if(_0x555231[_0x8df8('0x19a')](0xb,_0x4ee873,_0x37bcee)){if(_0x24fbb5[_0x8df8('0xf3')]>=_0x37bcee['dialAbandonedMaxRetry']){_0x555231[_0x8df8('0x1b1')](_0x24fbb5,_0x589424,_0x532d12,_0x8df8('0x1c1'));}else{_0x555231['stateGlobal'](_0x24fbb5,_0x589424,_0x532d12,_0x8df8('0x1c1'));}}break;case'20':_0x37bcee[_0x8df8('0x68')]+=0x1;_0x24fbb5[_0x8df8('0xa9')]=0x14;_0x24fbb5[_0x8df8('0xaa')]=_0x8df8('0x1c2');_0x24fbb5[_0x8df8('0xf4')]+=0x1;_0x24fbb5[_0x8df8('0xed')]+=0x1;ami[_0x8df8('0x4c')](_0x8df8('0x1c3'),ut['buildObj'](_0x4ee873,_0x8df8('0x1c4')));_0x555231[_0x8df8('0xcb')](_0x24fbb5)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x1c5')));if(_0x555231[_0x8df8('0x19a')](0x14,_0x4ee873,_0x37bcee)){if(_0x24fbb5[_0x8df8('0xf4')]>=_0x37bcee[_0x8df8('0x1a7')]){_0x555231[_0x8df8('0x1b1')](_0x24fbb5,_0x589424,_0x532d12,_0x8df8('0x1c6'));}else{_0x555231['stateGlobal'](_0x24fbb5,_0x589424,_0x532d12,'reason\x2020\x20agentreject');}}break;default:_0x37bcee[_0x8df8('0x69')]+=0x1;_0x24fbb5[_0x8df8('0xa9')]=0xc;_0x24fbb5[_0x8df8('0xaa')]=_0x3361a5[_0x8df8('0x10b')];_0x555231[_0x8df8('0xcb')](_0x24fbb5)[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x1c7')));if(_0x555231[_0x8df8('0x19a')](_0x3361a5[_0x8df8('0x10b')],_0x4ee873,_0x37bcee)){if(_0x24fbb5[_0x8df8('0xfe')]+_0x24fbb5['countcongestionretry']+_0x24fbb5[_0x8df8('0xf1')]+_0x24fbb5[_0x8df8('0xff')]+_0x24fbb5[_0x8df8('0xf2')]+_0x24fbb5[_0x8df8('0xf3')]+_0x24fbb5[_0x8df8('0xec')]+_0x24fbb5['countagentrejectretry']>=_0x37bcee[_0x8df8('0xf5')]){_0x555231[_0x8df8('0xf6')](_0x24fbb5,_0x589424,_0x532d12,_0x3361a5[_0x8df8('0x10b')]);}else{_0x555231[_0x8df8('0x1b1')](_0x24fbb5,_0x589424,_0x532d12,_0x3361a5[_0x8df8('0x10b')]);}}}});};Dialer[_0x8df8('0x19')][_0x8df8('0xf6')]=function(_0x1d65dd,_0x3ac23b,_0x25e832,_0x3af22f){var _0x1a41ec=new Final(_0x1d65dd);_0x1a41ec[_0x8df8('0xa9')]=0xf;_0x1a41ec[_0x8df8('0xaa')]='Global';this['createStateFinal'](_0x1a41ec,_0x3ac23b,_0x25e832,_0x3af22f);};Dialer[_0x8df8('0x19')]['createStateFinal']=function(_0x34b281,_0x40cb51,_0x13405d,_0x396f16){this[_0x8df8('0xca')](_0x34b281)[_0x8df8('0xba')](function(_0x51bdd8){return _0x40cb51(msgResponse('[callProgressDetecting]',_0x8df8('0xd8'),_0x396f16));})[_0x8df8('0xb3')](function(_0x3e9712){return _0x13405d(msgResponse(_0x8df8('0x1c8'),_0x8df8('0x142'),'contact\x20not\x20moved'));});};Dialer[_0x8df8('0x19')][_0x8df8('0x8')]=function(_0x286d30){var _0x25a8af=this;var _0x362acc=_0x286d30[_0x8df8('0x1c9')]/0x64;var _0x5ae6d7=_0x286d30[_0x8df8('0x65')]/(_0x286d30['outboundDropCallsDayTimeout']+_0x286d30['outboundAnswerCallsDay']);var _0x504c79=Math['round'](_0x286d30[_0x8df8('0x1ca')]*(_0x286d30[_0x8df8('0x1cb')]/0x64));var _0x197a33=Math[_0x8df8('0x1cc')](_0x286d30[_0x8df8('0x1ca')]*(_0x286d30[_0x8df8('0x1cd')]/0x64));var _0x579ca6=_0x286d30[_0x8df8('0x51')]+_0x286d30[_0x8df8('0xa1')];var _0x1e4364=Math[_0x8df8('0x1ce')](_0x286d30[_0x8df8('0x75')]*_0x286d30[_0x8df8('0x77')]*_0x286d30[_0x8df8('0x71')]*_0x286d30[_0x8df8('0x1cf')]);if(_[_0x8df8('0x8d')](_0x286d30[_0x8df8('0x2a')])){if(!_['isUndefined'](_0x286d30[_0x8df8('0x29')])){_0x286d30['startPredictive']=undefined;loggerPredictive[_0x8df8('0x95')](_0x8df8('0x1d0'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x286d30[_0x8df8('0x90')])){loggerPredictive[_0x8df8('0x95')](_0x8df8('0x1d0'),_0x8df8('0x1d1'));clearInterval(_0x286d30[_0x8df8('0x90')]);_0x286d30[_0x8df8('0x90')]=undefined;}_0x286d30['startProgressive']=moment()[_0x8df8('0x7d')](_0x8df8('0xfa'));loggerPredictive[_0x8df8('0x84')](_0x286d30[_0x8df8('0x3f')],_0x8df8('0x1d2'),_0x286d30[_0x8df8('0x2a')]);this['handlePower'](_0x286d30,0x1);}else if(ifInterval(_0x286d30[_0x8df8('0x1d3')],_0x286d30[_0x8df8('0x2a')])){this[_0x8df8('0x154')](_0x286d30,0x1);loggerPredictiveCalls[_0x8df8('0x84')](_0x8df8('0x1d4'),_0x286d30[_0x8df8('0x2a')],_0x286d30['name']);_0x286d30[_0x8df8('0x75')]=0x0;_0x286d30['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x362acc<_0x5ae6d7&&_0x286d30['dialPredictiveOptimization']===_0x8df8('0x1d5')){freeVariablesPredictive(_0x286d30);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x1d6'),'Dropped\x20calls\x20day',_0x5ae6d7,_0x8df8('0x2a'),_0x286d30[_0x8df8('0x3f')]);}else if(_0x1e4364<_0x286d30[_0x8df8('0x70')]&&_0x286d30[_0x8df8('0x1d7')]===_0x8df8('0x1d5')){freeVariablesPredictive(_0x286d30);loggerPredictive[_0x8df8('0x84')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x1e4364,_0x8df8('0x1d8'),_0x286d30['predictiveIntervalErlangCallsDroppedCalls'],_0x8df8('0x2a'),_0x286d30[_0x8df8('0x3f')]);}else if(!ifInterval(_0x286d30[_0x8df8('0x1d3')],_0x286d30[_0x8df8('0x2a')])&&_[_0x8df8('0x8d')](_0x286d30[_0x8df8('0x29')])&&!_[_0x8df8('0x8d')](_0x286d30[_0x8df8('0x2a')])){_0x286d30[_0x8df8('0x29')]=moment()[_0x8df8('0x7d')](_0x8df8('0xfa'));loggerPredictive[_0x8df8('0x84')](_0x286d30[_0x8df8('0x3f')],_0x8df8('0x1d9'),_0x286d30[_0x8df8('0x29')]);this[_0x8df8('0xc0')](_0x286d30['dialPredictiveInterval'])[_0x8df8('0xba')](this[_0x8df8('0x1da')](_0x286d30))[_0x8df8('0xba')](mergeDataErlangB(_0x286d30))[_0x8df8('0xba')](this[_0x8df8('0x1db')](_0x286d30))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x286d30));}else if(!ifInterval(_0x286d30[_0x8df8('0x1d3')],_0x286d30[_0x8df8('0x29')])){_0x286d30[_0x8df8('0x70')]=0x0;_0x286d30[_0x8df8('0x29')]=moment()[_0x8df8('0x7d')](_0x8df8('0xfa'));loggerPredictive[_0x8df8('0x84')](_0x286d30[_0x8df8('0x3f')],_0x8df8('0x1dc'),_0x286d30[_0x8df8('0x29')]);clearInterval(_0x286d30['handlePredictive']);_0x286d30['handlePredictive']=undefined;this[_0x8df8('0xc0')](_0x286d30[_0x8df8('0x1d3')])[_0x8df8('0xba')](this[_0x8df8('0x1da')](_0x286d30))[_0x8df8('0xba')](mergeDataErlangB(_0x286d30))[_0x8df8('0xba')](this[_0x8df8('0x1db')](_0x286d30))[_0x8df8('0xb3')](loggerCatchPredictive(_0x8df8('0x1dd'),_0x286d30));}else if(_0x286d30[_0x8df8('0x1ca')]&&_0x579ca6<_0x286d30[_0x8df8('0x1ca')]-_0x197a33){freeVariablesPredictive(_0x286d30);loggerPredictive[_0x8df8('0x84')](_0x286d30['name'],_0x8df8('0x1de'),_0x579ca6,')\x20are\x20less\x20than\x20threshold\x20(',_0x286d30[_0x8df8('0x1ca')],'-',_0x197a33,'=',_0x286d30['predictiveIntervalAvailable']-_0x197a33,')');}else if(_0x286d30['predictiveIntervalAvailable']&&_0x579ca6>_0x286d30['predictiveIntervalAvailable']+_0x504c79){freeVariablesPredictive(_0x286d30);loggerPredictive[_0x8df8('0x84')](_0x286d30[_0x8df8('0x3f')],_0x8df8('0x1de'),_0x579ca6,_0x8df8('0x1df'),_0x286d30[_0x8df8('0x1ca')],'+',_0x504c79,'=',_0x286d30[_0x8df8('0x1ca')]+_0x504c79,')');}};Dialer[_0x8df8('0x19')][_0x8df8('0x1da')]=function(_0x56e799){var _0x50d1e8=this;return function(_0xe728e4){return new BPromise(function(_0x39133d,_0x52a5c5){_['merge'](_0x56e799,_0xe728e4[0x0]);if(checkGetDataPredictive(_0xe728e4[0x0])){var _0x375d91=_0x56e799[_0x8df8('0x1ca')]=_0x56e799[_0x8df8('0xa1')]+_0x56e799['available'];var _0x201396=_0x56e799[_0x8df8('0x1d3')]*0x3c;var _0x2d0173=_0xe728e4[0x0][_0x8df8('0x6c')]+_0xe728e4[0x0]['predictiveIntervalAvgHoldtime'];var _0x3d03b3=(_0xe728e4[0x0]['predictiveIntervalAnsweredCalls']+_0xe728e4[0x0][_0x8df8('0x6e')]+_0xe728e4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xe728e4[0x0][_0x8df8('0x73')];_0x56e799[_0x8df8('0x71')]=_0x3d03b3>0x0?_0x3d03b3:0x1;switch(_0x56e799[_0x8df8('0x1d7')]){case'dropRate':var _0x2ce69f=_0x56e799[_0x8df8('0x1c9')]/0x64;return _0x50d1e8['abandonmentRate'](_0x375d91,_0x201396,_0x2d0173,_0x3d03b3,_0x2ce69f)['then'](function(_0x18ec3e){return _0x39133d(_0x18ec3e);});case _0x8df8('0x1e0'):var _0x1d394c=_0x56e799['dialPredictiveOptimizationPercentage']/0x64;return _0x50d1e8[_0x8df8('0x1e1')](_0x375d91,_0x201396,_0x2d0173,_0x3d03b3,_0x1d394c)[_0x8df8('0xba')](function(_0x5a8600){return _0x39133d(_0x5a8600);});default:return _0x52a5c5(msgResponse(_0x8df8('0x1e2'),_0x8df8('0x142'),_0x8df8('0x1e3')));}}else{return _0x52a5c5(msgResponse(_0x8df8('0x1e2'),_0x8df8('0x142'),_0x8df8('0x1e4')));}});};};Dialer['prototype'][_0x8df8('0x1e5')]=function(_0x3101f4){var _0x35be3b=this;return function(_0x3fceaf){return new BPromise(function(_0x2effb5,_0x342a41){_[_0x8df8('0xd2')](_0x3101f4,_0x3fceaf[0x0]);if(checkGetDataPredictive(_0x3fceaf[0x0])){loggerPredictive[_0x8df8('0x84')](JSON[_0x8df8('0x7c')](_0x3fceaf[0x0]));if(_0x3101f4[_0x8df8('0x1d7')]===_0x8df8('0x1d5')){return _0x35be3b[_0x8df8('0xc9')](_0x3101f4['id'])[_0x8df8('0xba')](function(_0x3f8aef){var _0x4f76d8=_0x3101f4['loggedIn']-_0x3f8aef[0x0][_0x8df8('0x1e6')];var _0x50dd54=_0x3101f4[_0x8df8('0x1d3')]*0x3c;var _0x3149ce=_0x3fceaf[0x0][_0x8df8('0x6c')]+_0x3fceaf[0x0][_0x8df8('0x6b')];var _0x31fe17=(_0x3fceaf[0x0][_0x8df8('0x6a')]+_0x3fceaf[0x0][_0x8df8('0x6e')]+_0x3fceaf[0x0][_0x8df8('0x6d')])/_0x3fceaf[0x0][_0x8df8('0x73')];var _0x45ff4f=_0x3101f4[_0x8df8('0x1c9')]/0x64;_0x3101f4[_0x8df8('0x72')]=_0x3f8aef[0x0]['outboundQueuePauses']||0x0;_0x3101f4[_0x8df8('0x71')]=_0x31fe17>0x0?_0x31fe17:0x1;return _0x35be3b[_0x8df8('0x1e7')](_0x4f76d8,_0x50dd54,_0x3149ce,_0x31fe17,_0x45ff4f);})[_0x8df8('0xba')](function(_0x5d91a0){return _0x2effb5(_0x5d91a0);})[_0x8df8('0xb3')](function(_0x51f1fa){return _0x342a41(msgResponse(_0x8df8('0x1e8'),'Failure',JSON['stringify'](_0x51f1fa)));});}if(_0x3101f4['dialPredictiveOptimization']===_0x8df8('0x1e0')){return _0x35be3b[_0x8df8('0xc9')](_0x3101f4['id'])['then'](function(_0x51db3e){var _0x3bec0a=_0x3101f4[_0x8df8('0x52')]-_0x51db3e[0x0]['outboundQueuePauses'];var _0x13e434=_0x3101f4['dialPredictiveInterval']*0x3c;var _0xb83ebe=_0x3fceaf[0x0][_0x8df8('0x6c')]+_0x3fceaf[0x0][_0x8df8('0x6b')];var _0x51a62e=(_0x3fceaf[0x0][_0x8df8('0x6a')]+_0x3fceaf[0x0][_0x8df8('0x6e')]+_0x3fceaf[0x0][_0x8df8('0x6d')])/_0x3fceaf[0x0][_0x8df8('0x73')];var _0xc9ff5b=_0x3101f4[_0x8df8('0x1c9')]/0x64;_0x3101f4[_0x8df8('0x72')]=_0x51db3e[0x0][_0x8df8('0x1e6')]||0x0;_0x3101f4[_0x8df8('0x71')]=_0x51a62e>0x0?_0x51a62e:0x1;return _0x35be3b['busyFactor'](_0x3bec0a,_0x13e434,_0xb83ebe,_0x51a62e,_0xc9ff5b);})[_0x8df8('0xba')](function(_0x5abb21){return _0x2effb5(_0x5abb21);})['catch'](function(_0x22c170){return _0x342a41(msgResponse('[CatchErlangB]',_0x8df8('0x142'),JSON['stringify'](_0x22c170)));});}}else{return _0x342a41(msgResponse(_0x8df8('0x1e2'),_0x8df8('0x142'),_0x8df8('0x1e4')));}});};};Dialer[_0x8df8('0x19')][_0x8df8('0x1db')]=function(_0x2da3be){var _0x2be95b=this;return function(){var _0x3a15d3=0x0;var _0x26f464=Math[_0x8df8('0x1ce')](_0x2da3be[_0x8df8('0x76')]*0x3e8);if(_0x26f464>0x0){_0x26f464=_0x26f464<0x64?0x64:_0x26f464;loggerPredictive[_0x8df8('0x84')](_0x2da3be['name'],_0x8df8('0x1e9'),_0x26f464,'milliseconds');_0x2da3be[_0x8df8('0x90')]=setInterval(function(){_0x2be95b[_0x8df8('0x90')](_0x2da3be);loggerPredictiveCalls['info'](_0x8df8('0x1ea'),_0x3a15d3+=0x1);},_0x26f464);}else{loggerPredictive[_0x8df8('0x84')](_0x2da3be['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x8df8('0x1eb')]=function(_0x1dc3aa,_0x47a7e5){var _0x32bf79=this;return function(_0x3c7acf){if(_[_0x8df8('0x45')](_0x3c7acf)){if(_[_0x8df8('0xb0')](_0x47a7e5[_0x8df8('0xd5')])||!_0x47a7e5[_0x8df8('0x1ec')]){if(_0x1dc3aa['dialMethod']===_0x8df8('0x157')){_0x1dc3aa[_0x8df8('0x12b')]=_[_0x8df8('0x8d')](_0x1dc3aa[_0x8df8('0x12b')])?!![]:_0x1dc3aa[_0x8df8('0x12b')];var _0x136eb8=uuid['v4']();_0x32bf79[_0x8df8('0x25')][_0x136eb8]=new Action(_0x1dc3aa,_0x47a7e5,_0x136eb8);loggerBooked[_0x8df8('0x84')]('[booked][checkContactBlack]',_0x136eb8,_0x8df8('0x1ed'),JSON[_0x8df8('0x7c')](_0x1dc3aa[_0x8df8('0x12b')]),_0x8df8('0x1ee'),_0x1dc3aa[_0x8df8('0x3f')]);if(_0x1dc3aa[_0x8df8('0x12b')]){_0x1dc3aa['queueStatusComplete']=![];_0x32bf79['queueBooked'][_0x32bf79[_0x8df8('0x25')][_0x136eb8]['queue']]=[];ami['Action']({'actionid':_0x136eb8,'action':'queuestatus','queue':_0x1dc3aa[_0x8df8('0x3f')]})[_0x8df8('0xb3')](function(_0x11725c){_0x32bf79[_0x8df8('0xb5')](_0x1dc3aa);_0x32bf79[_0x8df8('0xc3')]({'active':![],'ContactId':_0x32bf79[_0x8df8('0x25')][_0x136eb8][_0x8df8('0xd4')],'ListId':_0x32bf79[_0x8df8('0x25')][_0x136eb8][_0x8df8('0xfb')],'VoiceQueueId':_0x32bf79[_0x8df8('0x25')][_0x136eb8][_0x8df8('0xd6')]||undefined,'CampaignId':_0x32bf79[_0x8df8('0x25')][_0x136eb8][_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x1ef')));delete _0x32bf79[_0x8df8('0x25')][_0x136eb8];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x8df8('0x7c')](_0x1dc3aa[_0x8df8('0x12b')]),'Queue:\x20',_0x1dc3aa['name']);_0x32bf79[_0x8df8('0xb5')](_0x1dc3aa);_0x32bf79[_0x8df8('0xc3')]({'active':![],'ContactId':_0x32bf79['actions'][_0x136eb8][_0x8df8('0xd4')],'ListId':_0x32bf79['actions'][_0x136eb8][_0x8df8('0xfb')],'VoiceQueueId':_0x32bf79[_0x8df8('0x25')][_0x136eb8][_0x8df8('0xd6')]||undefined,'CampaignId':_0x32bf79['actions'][_0x136eb8][_0x8df8('0xfc')]||undefined})[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x1ef')));delete _0x32bf79[_0x8df8('0x25')][_0x136eb8];}}else{return _0x32bf79[_0x8df8('0x166')](_0x1dc3aa,_0x47a7e5);}}else{if(getDiff(_0x47a7e5[_0x8df8('0x1f0')])<_0x1dc3aa['dialRecallMeTimeout']*0x3c){if(_0x47a7e5[_0x8df8('0x1f1')]&&!_0x47a7e5[_0x8df8('0x1f1')][_0x8df8('0x1f2')]){_0x32bf79[_0x8df8('0x1e')][_0x8df8('0x12c')](_0x47a7e5['id'])[_0x8df8('0x1c')](function(){_0x32bf79['updateOriginated'](_0x1dc3aa);});}else{_0x32bf79[_0x8df8('0xc5')]({'active':![]},_0x47a7e5['id'],0x1)[_0x8df8('0x1c')](function(){console['log']('Contact\x20updated');_0x32bf79[_0x8df8('0xb5')](_0x1dc3aa);});}}else{_0x1dc3aa[_0x8df8('0x1f3')]+=0x1;_0x32bf79['updateOriginated'](_0x1dc3aa);if(_0x1dc3aa[_0x8df8('0x1f4')]){_0x32bf79[_0x8df8('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x47a7e5['ContactId'],'ListId':_0x47a7e5[_0x8df8('0xfb')],'VoiceQueueId':_0x47a7e5['VoiceQueueId']||undefined,'CampaignId':_0x47a7e5['CampaignId']||undefined})['catch'](loggerCatch(_0x8df8('0x1f5')));_0x32bf79['createHistory'](createObjHistory(_0x1dc3aa,_0x47a7e5,_0x8df8('0x1f6'),0x17,'RecallInQueue'))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x1f7')));}else{_0x32bf79[_0x8df8('0xdd')](createObjHistory(_0x1dc3aa,_0x47a7e5,'RECALLFAILEDTIMEOUT',0x16,_0x8df8('0x1f8')),'[Originate][HistoryRecallClose][historyCatch]',_0x8df8('0x1f9'));}}}}else{_0x1dc3aa['outboundBlacklistCallsDay']+=0x1;_0x32bf79[_0x8df8('0xdd')](createObjHistory(_0x1dc3aa,_0x47a7e5,_0x8df8('0x1fa'),0xd,_0x8df8('0x1fb')),_0x8df8('0x1fc'),_0x8df8('0x1fd'));throw _0x8df8('0x1fe');}};};Dialer['prototype']['handleIvr']=function(_0x5aadde){var _0x20ee57=this;var _0x29f695=[];var _0x18cf87=_0x5aadde[_0x8df8('0x1ff')]-_0x5aadde[_0x8df8('0x74')]-_0x5aadde[_0x8df8('0x200')];emitCampaignSummary(_0x5aadde);if(_0x18cf87>0x0){if(_0x18cf87>this[_0x8df8('0x23')]){_0x18cf87=this[_0x8df8('0x23')];}_0x5aadde[_0x8df8('0x200')]+=_0x18cf87;this[_0x8df8('0xc8')](_0x5aadde['id'],_0x18cf87,_0x5aadde[_0x8df8('0x201')])['then'](function(_0x356a83){_0x5aadde[_0x8df8('0x200')]-=_0x18cf87;_0x5aadde[_0x8df8('0x200')]=_0x5aadde[_0x8df8('0x200')]>0x0?_0x5aadde['temp']:0x0;if(!checkContactEmpty(_0x356a83)){_0x5aadde[_0x8df8('0x3e')]=_0x8df8('0x9e');logger['info'](_0x8df8('0x202')+_0x5aadde[_0x8df8('0x3f')]);}else{_0x5aadde['originated']+=_0x356a83[_0x8df8('0x130')];_0x5aadde[_0x8df8('0x3e')]='RUNNING';for(var _0x20304e=0x0;_0x20304e<_0x356a83[_0x8df8('0x130')];_0x20304e+=0x1){_0x5aadde['ivrTotalCallsDays']+=0x1;if(_[_0x8df8('0xb0')](_0x356a83[_0x20304e])||_[_0x8df8('0xb0')](_0x356a83[_0x20304e][_0x8df8('0x168')])||_[_0x8df8('0xb0')](_0x356a83[_0x20304e]['Contact'][_0x8df8('0x169')])){_0x20ee57[_0x8df8('0xd1')](_0x8df8('0x203'),_0x5aadde,_0x356a83[_0x20304e]);}else{_0x20ee57[_0x8df8('0xbe')](_[_0x8df8('0xd3')](_0x356a83[_0x20304e],[_0x8df8('0xfc'),_0x8df8('0x204')]))[_0x8df8('0xba')](_0x20ee57[_0x8df8('0x1eb')](_0x5aadde,_0x356a83[_0x20304e]))['catch'](_0x20ee57[_0x8df8('0xcf')]('[actionOriginateIvr]\x20',_0x5aadde));}}}})[_0x8df8('0xb3')](loggerGetContactDialer(_0x8df8('0x205'),_0x5aadde,_0x18cf87));}};Dialer[_0x8df8('0x19')]['handlePower']=function(_0xe63ac,_0x12cba0){var _0x3e915b=this;var _0x33a3a6=[];var _0x194fd8=_0x12cba0>=0x1?_0x12cba0:0x1;var _0x1388d2=[];if(_0xe63ac['dialMethod']===_0x8df8('0x157')){_0x194fd8=0x1;}var _0x5ac1d8=Math[_0x8df8('0x1ce')](_0xe63ac[_0x8df8('0x51')]*_0x194fd8)-_0xe63ac[_0x8df8('0x74')]-_0xe63ac[_0x8df8('0x200')];emitVoiceQueueSummary(_0xe63ac);if(_0xe63ac['dialLimitQueue']>0x0){var _0x1480c4=_0xe63ac[_0x8df8('0x206')]-_0xe63ac[_0x8df8('0x74')]-_0xe63ac[_0x8df8('0xa1')]-_0xe63ac[_0x8df8('0x200')]-_0xe63ac[_0x8df8('0xa3')];if(_0x5ac1d8>_0x1480c4){_0x5ac1d8=_0x1480c4;}}if(_0x5ac1d8>0x0){if(_0xe63ac['dialMethod']==='booked'){_0x5ac1d8=0x1;}if(_0x5ac1d8>this[_0x8df8('0x23')]){_0x5ac1d8=this[_0x8df8('0x23')];}_0xe63ac[_0x8df8('0x200')]+=_0x5ac1d8;for(var _0x4c683c in this['agents']){if(this[_0x8df8('0x21')][_0x8df8('0x97')](_0x4c683c)){if(this[_0x8df8('0x21')][_0x4c683c][_0x8df8('0xa9')]===_0x8df8('0x207')&&this[_0x8df8('0x21')][_0x4c683c][_0x8df8('0xdb')]===_0x8df8('0xda')){_0x33a3a6[_0x8df8('0x127')](this[_0x8df8('0x21')][_0x4c683c]['id']);}}}this['getContactDialer'](_0xe63ac['id'],_0x33a3a6,_0x5ac1d8,_0xe63ac[_0x8df8('0x201')])[_0x8df8('0xba')](function(_0x305601){_0xe63ac[_0x8df8('0x200')]-=_0x5ac1d8;_0xe63ac['temp']=_0xe63ac['temp']>0x0?_0xe63ac[_0x8df8('0x200')]:0x0;if(!checkContactEmpty(_0x305601)){_0x3e915b[_0x8df8('0xbb')](_0xe63ac)[_0x8df8('0xba')](sendMessageReschedule(_0xe63ac))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x208')));}else{_0xe63ac['originated']+=_0x305601['length'];_0xe63ac[_0x8df8('0x3e')]=_0xe63ac[_0x8df8('0x5b')]===_0x8df8('0x157')?_0x8df8('0x172'):_0x8df8('0x209');for(var _0x31cd46=0x0;_0x31cd46<_0x305601[_0x8df8('0x130')];_0x31cd46+=0x1){if(_['isNil'](_0x305601[_0x31cd46])||_[_0x8df8('0xb0')](_0x305601[_0x31cd46][_0x8df8('0x168')])||_['isNil'](_0x305601[_0x31cd46][_0x8df8('0x168')][_0x8df8('0x169')])){_0x3e915b[_0x8df8('0xd1')]('[actionOriginate]\x20',_0xe63ac,_0x305601[_0x31cd46]);}else{_0x3e915b[_0x8df8('0xbc')](_[_0x8df8('0xd3')](_0x305601[_0x31cd46],[_0x8df8('0xd6'),_0x8df8('0x204')]))[_0x8df8('0xba')](_0x3e915b['checkContactBlack'](_0xe63ac,_0x305601[_0x31cd46]))[_0x8df8('0xb3')](_0x3e915b[_0x8df8('0xcf')](_0x8df8('0x203'),_0xe63ac));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0xe63ac,_0x5ac1d8));}};Dialer[_0x8df8('0x19')][_0x8df8('0x90')]=function(_0x26280d){var _0x4e5e53=this;if(_0x26280d[_0x8df8('0x206')]>0x0){var _0x2a2bea=_0x26280d[_0x8df8('0x206')]-_0x26280d['originated']-_0x26280d[_0x8df8('0xa1')];if(_0x2a2bea>0x0){this[_0x8df8('0x20a')](_0x26280d);}else{loggerPredictiveCalls[_0x8df8('0x84')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x26280d);}};Dialer[_0x8df8('0x19')]['tryOriginatePredictive']=function(_0x3dd3a5){var _0x1dddd3=this;var _0x1bac4e=[];_0x3dd3a5[_0x8df8('0x74')]+=0x1;for(var _0x2d7ff8 in this[_0x8df8('0x21')]){if(this['agents'][_0x8df8('0x97')](_0x2d7ff8)){if(this[_0x8df8('0x21')][_0x2d7ff8][_0x8df8('0xa9')]===_0x8df8('0x207')&&this['agents'][_0x2d7ff8]['status']===_0x8df8('0xda')){_0x1bac4e[_0x8df8('0x127')](this[_0x8df8('0x21')][_0x2d7ff8]['id']);}}}this[_0x8df8('0xc6')](_0x3dd3a5['id'],_0x1bac4e,0x1,_0x3dd3a5[_0x8df8('0x201')])[_0x8df8('0xba')](function(_0x3ef80d){if(!checkContactEmpty(_0x3ef80d)){checkContactLowerLimitOriginate(_0x3dd3a5,0x1,0x0);_0x1dddd3[_0x8df8('0xbb')](_0x3dd3a5)[_0x8df8('0xba')](sendMessageReschedule(_0x3dd3a5))[_0x8df8('0xb3')](loggerCatch(_0x8df8('0x208')));}else{_0x3dd3a5[_0x8df8('0x3e')]=_0x8df8('0x209');if(_[_0x8df8('0xb0')](_0x3ef80d[0x0])||_[_0x8df8('0xb0')](_0x3ef80d[0x0]['Contact'])||_[_0x8df8('0xb0')](_0x3ef80d[0x0][_0x8df8('0x168')]['phone'])){_0x1dddd3['emptyContact']('[actionOriginate]\x20',_0x3dd3a5,_0x3ef80d[0x0]);}else{_0x1dddd3[_0x8df8('0xbc')](_[_0x8df8('0xd3')](_0x3ef80d[0x0],[_0x8df8('0xd6'),_0x8df8('0x204')]))[_0x8df8('0xba')](_0x1dddd3['checkContactBlack'](_0x3dd3a5,_0x3ef80d[0x0]))[_0x8df8('0xb3')](_0x1dddd3['loggerHandler'](_0x8df8('0x20b'),_0x3dd3a5));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x3dd3a5,0x1));emitVoiceQueueSummary(_0x3dd3a5);};Dialer[_0x8df8('0x19')]['abandonmentRate']=function(_0x4e4bc9,_0x4e2219,_0x2b8c3e,_0xa7eda,_0x3f12b4,_0x229759){loggerPredictive['info'](_0x8df8('0x20c'));loggerPredictive[_0x8df8('0x84')]('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',_0x4e4bc9);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x20d'),_0x4e2219);loggerPredictive[_0x8df8('0x84')]('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',_0x2b8c3e);loggerPredictive[_0x8df8('0x84')]('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',_0xa7eda);loggerPredictive['info'](_0x8df8('0x20e'),_0x3f12b4);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x86'));return new BPromise(function(_0x6bc691,_0x1358ea){if(_0x4e4bc9<=0x0||isNaN(_0x4e4bc9)){return _0x1358ea(msgResponse('[abandonmentRate]',_0x8df8('0x48'),_0x8df8('0x20f')+_0x4e4bc9));}if(_0x2b8c3e<=0x0||isNaN(_0x2b8c3e)){return _0x1358ea(msgResponse(_0x8df8('0x210'),_0x8df8('0x48'),_0x8df8('0x211')+_0x2b8c3e));}if(_0xa7eda<=0x0||isNaN(_0xa7eda)){return _0x1358ea(msgResponse(_0x8df8('0x210'),_0x8df8('0x48'),_0x8df8('0x212')+_0xa7eda));}if(_0x4e2219<=0x0||isNaN(_0x4e2219)){return _0x1358ea(msgResponse(_0x8df8('0x210'),_0x8df8('0x48'),_0x8df8('0x213')+_0x4e2219));}if(_0x3f12b4<=0x0||isNaN(_0x3f12b4)){return _0x1358ea(msgResponse(_0x8df8('0x210'),_0x8df8('0x48'),_0x8df8('0x214')+_0x3f12b4));}_0x229759=_0x229759||0x0;var _0x4935d6=0x1/_0x2b8c3e;var _0x22de21=0x0;var _0x2aeea0=0x0;var _0x24c0c7=0x0;var _0x2e8ee2=0x0;for(var _0x4d2bab=0x0;_0x24c0c7<_0x3f12b4;_0x4d2bab+=0x1){_0x2aeea0=_0x4d2bab/_0x4e2219;_0x22de21=(_0xa7eda*_0x2aeea0+_0x229759)/_0x4935d6;_0x24c0c7=erlangb(_0x22de21,_0x4e4bc9);_0x2e8ee2=_0x22de21/_0x4e4bc9*(0x1-erlangb(_0x22de21,_0x4e4bc9));}return _0x6bc691({'erlangCalls':_0x4d2bab,'erlangCallToSecond':_0x4e2219/_0x4d2bab,'erlangAbandonmentRate':_0x24c0c7,'erlangBusyFactor':_0x2e8ee2});});};Dialer[_0x8df8('0x19')]['busyFactor']=function(_0x309e55,_0x4d72b3,_0x56cf1b,_0x25f35d,_0xa0df56,_0x4a7d1b){loggerPredictive[_0x8df8('0x84')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x8df8('0x84')]('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',_0x309e55);loggerPredictive['info'](_0x8df8('0x20d'),_0x4d72b3);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x215'),_0x56cf1b);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x216'),_0x25f35d);loggerPredictive[_0x8df8('0x84')](_0x8df8('0x217'),_0xa0df56);loggerPredictive[_0x8df8('0x84')]('---------------------------');return new BPromise(function(_0x3f3ddd,_0x16b767){if(_0x309e55<=0x0||isNaN(_0x309e55)){return _0x16b767(msgResponse('[busyFactor]',_0x8df8('0x48'),_0x8df8('0x20f')+_0x309e55));}if(_0x56cf1b<=0x0||isNaN(_0x56cf1b)){return _0x16b767(msgResponse(_0x8df8('0x218'),'Error',_0x8df8('0x211')+_0x56cf1b));}if(_0x25f35d<=0x0||isNaN(_0x25f35d)){return _0x16b767(msgResponse(_0x8df8('0x218'),'Error',_0x8df8('0x212')+_0x25f35d));}if(_0x4d72b3<=0x0||isNaN(_0x4d72b3)){return _0x16b767(msgResponse('[busyFactor]',_0x8df8('0x48'),_0x8df8('0x213')+_0x4d72b3));}if(_0xa0df56<=0x0||isNaN(_0xa0df56)){return _0x16b767(msgResponse('[busyFactor]',_0x8df8('0x48'),'Umin\x20=\x20'+_0xa0df56));}_0x4a7d1b=_0x4a7d1b||0x0;var _0xb00325=0x1/_0x56cf1b;var _0x22de31=0x0;var _0xe1026a=0x0;var _0x22b465=0x0;var _0x39359e=0x0;for(var _0xc5ccac=0x0;_0x39359e<_0xa0df56;_0xc5ccac+=0x1){_0xe1026a=_0xc5ccac/_0x4d72b3;_0x22de31=(_0x25f35d*_0xe1026a+_0x4a7d1b)/_0xb00325;_0x22b465=erlangb(_0x22de31,_0x309e55);_0x39359e=_0x22de31/_0x309e55*(0x1-erlangb(_0x22de31,_0x309e55));}return _0x3f3ddd({'erlangCalls':_0xc5ccac,'erlangCallToSecond':_0x4d72b3/_0xc5ccac,'erlangAbandonmentRate':_0x22b465,'erlangBusyFactor':_0x39359e});});};module[_0x8df8('0x219')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4587207..4ded52b 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 _0x3042=['responsetime','endtime','droptime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','milliseconds','diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime'];(function(_0x11060a,_0x2e0cbe){var _0x3917b9=function(_0x6e6a1a){while(--_0x6e6a1a){_0x11060a['push'](_0x11060a['shift']());}};_0x3917b9(++_0x2e0cbe);}(_0x3042,0x114));var _0x2304=function(_0x4cb095,_0x58da07){_0x4cb095=_0x4cb095-0x0;var _0x2b565d=_0x3042[_0x4cb095];return _0x2b565d;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x3a6448,_0x11b376){var _0x471dd9=moment(_0x3a6448)[_0x2304('0x0')](0x0);var _0x4f9d78=moment(_0x11b376)[_0x2304('0x0')](0x0);return _0x471dd9[_0x2304('0x1')](_0x4f9d78,_0x2304('0x2'));}function QueueCallerAbandon(_0x2f9418,_0x1baf45){this[_0x2304('0x3')]=_0x2f9418[_0x2304('0x3')];this[_0x2304('0x4')]=_0x2f9418[_0x2304('0x4')];this['campaigntype']=_0x2f9418['type']==='outbound'?_0x2304('0x5'):_0x2f9418[_0x2304('0x4')];this[_0x2304('0x6')]=_0x2f9418[_0x2304('0x6')];this[_0x2304('0x7')]=_0x2f9418['countcongestionretry'];this['countnoanswerretry']=_0x2f9418['countnoanswerretry'];this[_0x2304('0x8')]=_0x2f9418[_0x2304('0x6')]+_0x2f9418[_0x2304('0x7')]+_0x2f9418[_0x2304('0x9')]+_0x2f9418['countnosuchnumberretry']+_0x2f9418[_0x2304('0xa')]+_0x2f9418['countabandonedretry']+_0x2f9418[_0x2304('0xb')]+_0x2f9418[_0x2304('0xc')];this[_0x2304('0xd')]=_0x2f9418[_0x2304('0xd')];this[_0x2304('0xa')]=_0x2f9418[_0x2304('0xa')];this[_0x2304('0xe')]=_0x2f9418[_0x2304('0xe')];this[_0x2304('0xb')]=_0x2f9418[_0x2304('0xb')];this[_0x2304('0xc')]=_0x2f9418['countagentrejectretry'];this[_0x2304('0xf')]=_0x1baf45['uniqueid'];this['calleridname']=_0x2f9418[_0x2304('0x10')];this[_0x2304('0x11')]=_0x2f9418[_0x2304('0x12')];this[_0x2304('0x13')]=_0x2f9418['starttime'];this[_0x2304('0x14')]=_0x2f9418[_0x2304('0x14')];this['droptime']=_0x2f9418['droptime'];this[_0x2304('0x15')]=this[_0x2304('0x16')];this['ringtime']=getSeconds(_0x2f9418['responsetime'],_0x2f9418[_0x2304('0x13')]);this['holdtime']=getSeconds(this['droptime'],_0x2f9418[_0x2304('0x14')]);this['talktime']=0x0;this[_0x2304('0x5')]=_0x1baf45['queue'];this[_0x2304('0x17')]=_0x1baf45[_0x2304('0x18')];this[_0x2304('0x19')]=_0x1baf45[_0x2304('0x19')];this['callback']=_0x2f9418[_0x2304('0x1a')];this[_0x2304('0x1b')]=_0x2f9418[_0x2304('0x1b')];this[_0x2304('0x1c')]=_0x2f9418['callbackat'];this[_0x2304('0x1d')]=_0x2f9418[_0x2304('0x1d')];this[_0x2304('0x1e')]=_0x2f9418[_0x2304('0x1e')];this[_0x2304('0x1f')]=_0x2f9418[_0x2304('0x1f')];this[_0x2304('0x20')]=_0x2f9418[_0x2304('0x20')];this[_0x2304('0x21')]=_0x2f9418[_0x2304('0x21')];this[_0x2304('0x22')]=_0x2f9418['CampaignId'];this[_0x2304('0x23')]=_0x2f9418[_0x2304('0x23')]||'';this[_0x2304('0x24')]=_0x2f9418[_0x2304('0x24')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xb091=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','callback'];(function(_0x335402,_0x58b053){var _0x17d784=function(_0x496c38){while(--_0x496c38){_0x335402['push'](_0x335402['shift']());}};_0x17d784(++_0x58b053);}(_0xb091,0xd8));var _0x1b09=function(_0x18f2f2,_0x2608b3){_0x18f2f2=_0x18f2f2-0x0;var _0x4444a0=_0xb091[_0x18f2f2];return _0x4444a0;};'use strict';var util=require(_0x1b09('0x0'));var _=require('lodash');var moment=require(_0x1b09('0x1'));function getSeconds(_0x5e2983,_0x52073d){var _0x46caa=moment(_0x5e2983)['milliseconds'](0x0);var _0x5ae76f=moment(_0x52073d)[_0x1b09('0x2')](0x0);return _0x46caa['diff'](_0x5ae76f,'seconds');}function QueueCallerAbandon(_0x3ffaaa,_0xda5697){this[_0x1b09('0x3')]=_0x3ffaaa['scheduledat'];this['type']=_0x3ffaaa['type'];this[_0x1b09('0x4')]=_0x3ffaaa[_0x1b09('0x5')]===_0x1b09('0x6')?_0x1b09('0x7'):_0x3ffaaa[_0x1b09('0x5')];this[_0x1b09('0x8')]=_0x3ffaaa[_0x1b09('0x8')];this[_0x1b09('0x9')]=_0x3ffaaa[_0x1b09('0x9')];this[_0x1b09('0xa')]=_0x3ffaaa[_0x1b09('0xa')];this[_0x1b09('0xb')]=_0x3ffaaa['countbusyretry']+_0x3ffaaa['countcongestionretry']+_0x3ffaaa['countnoanswerretry']+_0x3ffaaa[_0x1b09('0xc')]+_0x3ffaaa[_0x1b09('0xd')]+_0x3ffaaa['countabandonedretry']+_0x3ffaaa[_0x1b09('0xe')]+_0x3ffaaa[_0x1b09('0xf')];this[_0x1b09('0xc')]=_0x3ffaaa['countnosuchnumberretry'];this[_0x1b09('0xd')]=_0x3ffaaa['countdropretry'];this['countabandonedretry']=_0x3ffaaa[_0x1b09('0x10')];this[_0x1b09('0xe')]=_0x3ffaaa[_0x1b09('0xe')];this[_0x1b09('0xf')]=_0x3ffaaa[_0x1b09('0xf')];this[_0x1b09('0x11')]=_0xda5697[_0x1b09('0x11')];this[_0x1b09('0x12')]=_0x3ffaaa['name'];this[_0x1b09('0x13')]=_0x3ffaaa[_0x1b09('0x14')];this[_0x1b09('0x15')]=_0x3ffaaa[_0x1b09('0x15')];this[_0x1b09('0x16')]=_0x3ffaaa[_0x1b09('0x16')];this[_0x1b09('0x17')]=_0x3ffaaa[_0x1b09('0x17')];this['endtime']=this['droptime'];this[_0x1b09('0x18')]=getSeconds(_0x3ffaaa[_0x1b09('0x16')],_0x3ffaaa['starttime']);this[_0x1b09('0x19')]=getSeconds(this['droptime'],_0x3ffaaa[_0x1b09('0x16')]);this[_0x1b09('0x1a')]=0x0;this[_0x1b09('0x7')]=_0xda5697[_0x1b09('0x7')];this[_0x1b09('0x1b')]=_0xda5697[_0x1b09('0x1c')];this['reason']=_0xda5697['reason'];this['callback']=_0x3ffaaa[_0x1b09('0x1d')];this[_0x1b09('0x1e')]=_0x3ffaaa[_0x1b09('0x1e')];this[_0x1b09('0x1f')]=_0x3ffaaa[_0x1b09('0x1f')];this[_0x1b09('0x20')]=_0x3ffaaa[_0x1b09('0x20')];this['ContactId']=_0x3ffaaa[_0x1b09('0x21')];this[_0x1b09('0x22')]=_0x3ffaaa[_0x1b09('0x22')];this[_0x1b09('0x23')]=_0x3ffaaa['UserId'];this[_0x1b09('0x24')]=_0x3ffaaa['VoiceQueueId'];this[_0x1b09('0x25')]=_0x3ffaaa['CampaignId'];this[_0x1b09('0x26')]=_0x3ffaaa['originatecalleridnum']||'';this[_0x1b09('0x27')]=_0x3ffaaa['originatecalleridname']||'';}module[_0x1b09('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1e31412..f236b68 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 _0x4494=['uniqueid','format','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment'];(function(_0x10f648,_0x486893){var _0x2590f2=function(_0x3d6a44){while(--_0x3d6a44){_0x10f648['push'](_0x10f648['shift']());}};_0x2590f2(++_0x486893);}(_0x4494,0x13f));var _0x4449=function(_0x16dd5d,_0x236bf4){_0x16dd5d=_0x16dd5d-0x0;var _0x57479b=_0x4494[_0x16dd5d];return _0x57479b;};'use strict';var util=require(_0x4449('0x0'));var _=require(_0x4449('0x1'));var moment=require(_0x4449('0x2'));function Action(_0x12b8cb,_0x900c95,_0x22a11f){this[_0x4449('0x3')]=_0x12b8cb||undefined;this['channel']=util[_0x4449('0x4')]('%s/%s/%s',_0x900c95[_0x4449('0x5')],_0x900c95[_0x4449('0x6')][_0x4449('0x7')],_0x22a11f[_0x4449('0x8')]);this['localstationid']=_0x900c95[_0x4449('0x9')];this['headerinfo']=_0x900c95[_0x4449('0xa')];this[_0x4449('0xb')]=_0x22a11f['path'];this[_0x4449('0xc')]=_0x22a11f[_0x4449('0xc')];}module[_0x4449('0xd')]=Action; \ No newline at end of file +var _0x5155=['exports','util','lodash','uniqueid','channel','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0xfa8b0,_0x2c4f21){var _0x584007=function(_0xef8e23){while(--_0xef8e23){_0xfa8b0['push'](_0xfa8b0['shift']());}};_0x584007(++_0x2c4f21);}(_0x5155,0xb5));var _0x5515=function(_0x5d2110,_0x1e1200){_0x5d2110=_0x5d2110-0x0;var _0x211a6f=_0x5155[_0x5d2110];return _0x211a6f;};'use strict';var util=require(_0x5515('0x0'));var _=require(_0x5515('0x1'));var moment=require('moment');function Action(_0xd17161,_0x4b761b,_0x1e7a29){this[_0x5515('0x2')]=_0xd17161||undefined;this[_0x5515('0x3')]=util['format']('%s/%s/%s',_0x4b761b['tech'],_0x4b761b[_0x5515('0x4')][_0x5515('0x5')],_0x1e7a29[_0x5515('0x6')]);this[_0x5515('0x7')]=_0x4b761b['localstationid'];this[_0x5515('0x8')]=_0x4b761b[_0x5515('0x8')];this[_0x5515('0x9')]=_0x1e7a29['path'];this[_0x5515('0xa')]=_0x1e7a29[_0x5515('0xa')];}module[_0x5515('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index c58b47b..f503b5f 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 _0xae2e=['[Fax][Message][Updated]','finally','syncHangup','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','then','notify','calleridnum','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus'];(function(_0x25a3c0,_0x117544){var _0x18916c=function(_0x17933c){while(--_0x17933c){_0x25a3c0['push'](_0x25a3c0['shift']());}};_0x18916c(++_0x117544);}(_0xae2e,0x17e));var _0xeae2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xae2e[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xeae2('0x0'));var _=require(_0xeae2('0x1'));var BPromise=require(_0xeae2('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xeae2('0x3'));var tiff2pdf=require(_0xeae2('0x4'));var gs=require('./util/gs');var logger=require(_0xeae2('0x5'))(_0xeae2('0x6'));var ami=require(_0xeae2('0x7'));var rpcDb=require(_0xeae2('0x8'));var Channel=require('./channel');var ut=require(_0xeae2('0x9'));var Action=require(_0xeae2('0xa'));var faxAccount=require(_0xeae2('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xeae2('0xc'));function Fax(_0x2328c2){this['channels']={};this[_0xeae2('0xd')]=_0x2328c2['faxAccounts'];this[_0xeae2('0xe')]=_0x2328c2[_0xeae2('0xe')];this[_0xeae2('0xf')]={};ami['on'](_0xeae2('0x10'),this[_0xeae2('0x11')][_0xeae2('0x12')](this));ami['on'](_0xeae2('0x13'),this[_0xeae2('0x14')]['bind'](this));ami['on'](_0xeae2('0x15'),this[_0xeae2('0x16')][_0xeae2('0x12')](this));ami['on'](_0xeae2('0x17'),this[_0xeae2('0x18')][_0xeae2('0x12')](this));ami['on'](_0xeae2('0x19'),this[_0xeae2('0x1a')]['bind'](this));ami['on']('receivefax',this[_0xeae2('0x1b')][_0xeae2('0x12')](this));ami['on'](_0xeae2('0x1c'),this['syncHangup']['bind'](this));ami['on']('originateresponse',this[_0xeae2('0x1d')][_0xeae2('0x12')](this));}Fax[_0xeae2('0x1e')]['syncNewchannel']=function(_0x5482a6){if(_0x5482a6['context']===_0xeae2('0x1f')){for(var _0x5ebb74 in this[_0xeae2('0xd')]){if(this[_0xeae2('0xd')][_0xeae2('0x20')](_0x5ebb74)){if(_0x5482a6['exten']===this['faxAccounts'][_0x5ebb74][_0xeae2('0x21')]){this['channels'][_0x5482a6[_0xeae2('0x22')]]={};this[_0xeae2('0x23')][_0x5482a6['uniqueid']][_0xeae2('0x24')]=_0x5482a6[_0xeae2('0x24')];this[_0xeae2('0x23')][_0x5482a6[_0xeae2('0x22')]]['id']=this[_0xeae2('0xd')][_0x5ebb74]['id'];this[_0xeae2('0x23')][_0x5482a6['uniqueid']][_0xeae2('0x25')]=this[_0xeae2('0xd')][_0x5ebb74][_0xeae2('0x25')];logger[_0xeae2('0x26')](_0x5482a6['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x5482a6[_0xeae2('0x22')]]){this['channels'][_0x5482a6[_0xeae2('0x22')]]={};this[_0xeae2('0x23')][_0x5482a6[_0xeae2('0x22')]][_0xeae2('0x24')]=_0x5482a6[_0xeae2('0x24')];logger[_0xeae2('0x26')](_0x5482a6[_0xeae2('0x22')],_0xeae2('0x27'));}};Fax[_0xeae2('0x1e')]['syncVarSet']=function(_0x40d9d2){if(this[_0xeae2('0x23')][_0x40d9d2['uniqueid']]){for(var _0xc569a1 in _0x40d9d2[_0xeae2('0x28')]){if(_0x40d9d2[_0xeae2('0x28')][_0xeae2('0x20')](_0xc569a1)){this[_0xeae2('0x23')][_0x40d9d2[_0xeae2('0x22')]][_0xc569a1]=_0x40d9d2['value'];}}}};Fax[_0xeae2('0x1e')][_0xeae2('0x16')]=function(_0x4e99de){if(this[_0xeae2('0x23')][_0x4e99de[_0xeae2('0x22')]]){this[_0xeae2('0x23')][_0x4e99de[_0xeae2('0x22')]][_0xeae2('0x29')]=_0x4e99de[_0xeae2('0x29')];this['channels'][_0x4e99de['uniqueid']][_0xeae2('0x2a')]=_0x4e99de[_0xeae2('0x2a')];}};Fax['prototype'][_0xeae2('0x18')]=function(_0x3c6981){if(this[_0xeae2('0x23')][_0x3c6981[_0xeae2('0x22')]]){for(var _0x29b5d9 in _0x3c6981[_0xeae2('0x28')]){if(_0x3c6981[_0xeae2('0x28')][_0xeae2('0x20')](_0x29b5d9)){this[_0xeae2('0x23')][_0x3c6981[_0xeae2('0x22')]][_0x29b5d9]=_0x3c6981[_0xeae2('0x2b')];}}}};Fax[_0xeae2('0x1e')]['syncFaxStatus']=function(_0x430fc4){if(this[_0xeae2('0x23')][_0x430fc4[_0xeae2('0x22')]]){this[_0xeae2('0x23')][_0x430fc4['uniqueid']][_0xeae2('0x2c')]=_0x430fc4[_0xeae2('0x2c')];this[_0xeae2('0x23')][_0x430fc4[_0xeae2('0x22')]][_0xeae2('0x2d')]=_0x430fc4[_0xeae2('0x2d')];this[_0xeae2('0x23')][_0x430fc4[_0xeae2('0x22')]][_0xeae2('0x21')]=_0x430fc4['localstationid'];this[_0xeae2('0x23')][_0x430fc4['uniqueid']][_0xeae2('0x2e')]=_0x430fc4[_0xeae2('0x2e')];logger[_0xeae2('0x26')](_0x430fc4[_0xeae2('0x22')],_0xeae2('0x2f'));}};Fax['prototype']['syncReceiveFax']=function(_0x3f1459){var _0x2ed97c=this;if(this[_0xeae2('0x23')][_0x3f1459[_0xeae2('0x22')]]){var _0x7954a2=this['channels'][_0x3f1459['uniqueid']]['id'];this[_0xeae2('0x23')][_0x3f1459[_0xeae2('0x22')]][_0xeae2('0x30')]=_0x3f1459[_0xeae2('0x30')];this[_0xeae2('0x23')][_0x3f1459[_0xeae2('0x22')]][_0xeae2('0x31')]=_0x3f1459['pagestransferred'];this[_0xeae2('0x23')][_0x3f1459[_0xeae2('0x22')]][_0xeae2('0x21')]=_0x3f1459['localstationid'];this[_0xeae2('0x23')][_0x3f1459['uniqueid']]['resolution']=_0x3f1459[_0xeae2('0x32')];this[_0xeae2('0x23')][_0x3f1459['uniqueid']][_0xeae2('0x33')]=_0x3f1459[_0xeae2('0x33')];this[_0xeae2('0x23')][_0x3f1459[_0xeae2('0x22')]]['filename']=_0x3f1459['filename'];this[_0xeae2('0x23')][_0x3f1459[_0xeae2('0x22')]]['calleridnum']=_0x3f1459['calleridnum'];if(this[_0xeae2('0x23')][_0x3f1459[_0xeae2('0x22')]][_0xeae2('0x31')]>0x0){tiff2pdf(_0x3f1459[_0xeae2('0x2e')],_0xeae2('0x34'),function(_0x567961){logger['info'](_0x3f1459[_0xeae2('0x22')],'\x20result\x20conversion\x20file\x20',_0x567961[_0xeae2('0x35')]);attachment['create']({'name':path['parse'](_0x3f1459[_0xeae2('0x2e')])[_0xeae2('0x25')],'basename':path[_0xeae2('0x36')](_0x3f1459['filename'])['name']+_0xeae2('0x37'),'type':_0xeae2('0x38')})[_0xeae2('0x39')](function(_0x2d3441){faxAccount[_0xeae2('0x3a')](_0x7954a2,{'from':_0x3f1459[_0xeae2('0x3b')],'mapKey':_0xeae2('0x6'),'body':path['parse'](_0x3f1459[_0xeae2('0x2e')])[_0xeae2('0x25')]+_0xeae2('0x37'),'AttachmentId':_0x2d3441['id']})[_0xeae2('0x3c')](function(_0x27331b){logger[_0xeae2('0x3d')](_0x3f1459[_0xeae2('0x22')],'\x20notify\x20',JSON[_0xeae2('0x3e')](_0x27331b));});})[_0xeae2('0x3c')](function(_0x4ec67c){logger[_0xeae2('0x3d')](_0x3f1459[_0xeae2('0x22')],_0xeae2('0x3f'),JSON[_0xeae2('0x3e')](_0x4ec67c));});});}logger[_0xeae2('0x26')](_0x3f1459[_0xeae2('0x22')],_0xeae2('0x3f'));}};Fax[_0xeae2('0x1e')][_0xeae2('0x1d')]=function(_0x1b321b){if(this[_0xeae2('0xf')][_0x1b321b[_0xeae2('0x22')]]){_[_0xeae2('0x40')](this['channels'][_0x1b321b[_0xeae2('0x22')]],_[_0xeae2('0x41')](_0x1b321b,[_0xeae2('0x42'),_0xeae2('0x43')]));}};function updateStatus(_0x53dbb7){if(_0x53dbb7[_0xeae2('0x44')]){faxMessage['update'](_0x53dbb7['AttachmentId'],{'failMessage':_0xeae2('0x45')})[_0xeae2('0x39')](function(_0x41aeb0){ut[_0xeae2('0x46')]('[Fax][Message][Error][Updated]',_0x41aeb0);})[_0xeae2('0x3c')](function(_0x6d336f){ut[_0xeae2('0x46')](_0xeae2('0x47'),_0x6d336f);});}else{ut['logger'](_0xeae2('0x48'));}}Fax[_0xeae2('0x1e')][_0xeae2('0x49')]=function(_0x17500a,_0x57c0fb,_0x3b1d40){var _0x1f21ad=this;var _0x3e4681={};if(_0x57c0fb){_0x3e4681={'read':_0x57c0fb};}else{_0x3e4681={'failMessage':_0x3b1d40};}if(this[_0xeae2('0xf')][_0x17500a]['AttachmentId']){faxMessage['update'](this['actions'][_0x17500a][_0xeae2('0x44')],_0x3e4681)[_0xeae2('0x39')](function(_0x3de59c){ut[_0xeae2('0x46')](_0xeae2('0x4a'),_0x3de59c);})['catch'](function(_0x759cea){ut[_0xeae2('0x46')]('[Fax][Message][NoUpdate1]',_0x759cea);})[_0xeae2('0x4b')](function(){delete _0x1f21ad[_0xeae2('0x23')][_0x17500a];delete _0x1f21ad[_0xeae2('0xf')][_0x17500a];});}else{ut[_0xeae2('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0xeae2('0x23')][_0x17500a];delete this[_0xeae2('0xf')][_0x17500a];}};Fax[_0xeae2('0x1e')][_0xeae2('0x4c')]=function(_0x4b74bd){var _0x1a077a=this;if(this['channels'][_0x4b74bd['uniqueid']]){if(this['actions'][_0x4b74bd['uniqueid']]){this[_0xeae2('0x23')][_0x4b74bd[_0xeae2('0x22')]]['id']=this[_0xeae2('0xf')][_0x4b74bd[_0xeae2('0x22')]]['id'];this[_0xeae2('0x23')][_0x4b74bd['uniqueid']]['name']=this[_0xeae2('0xf')][_0x4b74bd['uniqueid']][_0xeae2('0x25')];}logger[_0xeae2('0x26')](_0x4b74bd[_0xeae2('0x22')],this['actions'][_0x4b74bd[_0xeae2('0x22')]]?'\x20hangup\x20sendFile\x20':_0xeae2('0x4d'),JSON[_0xeae2('0x3e')](this['channels'][_0x4b74bd[_0xeae2('0x22')]]));if(this[_0xeae2('0xf')][_0x4b74bd['uniqueid']]){if(this[_0xeae2('0x23')][_0x4b74bd[_0xeae2('0x22')]]['faxpages']>0x0&&this['channels'][_0x4b74bd[_0xeae2('0x22')]][_0xeae2('0x19')]===_0xeae2('0x4e')){this[_0xeae2('0x49')](_0x4b74bd['uniqueid'],!![]);}else{this['updateStatus'](_0x4b74bd[_0xeae2('0x22')],![],this['channels'][_0x4b74bd['uniqueid']][_0xeae2('0x4f')]?_0xeae2('0x50')+this[_0xeae2('0x23')][_0x4b74bd[_0xeae2('0x22')]][_0xeae2('0x4f')]:_0xeae2('0x51'));}}}};Fax['prototype'][_0xeae2('0x52')]=function(_0x4e19b0){var _0x185984=this;return new BPromise(function(_0x16d8df,_0xebe4d6){_0x185984[_0xeae2('0x53')](_0x4e19b0,_0x185984[_0xeae2('0xd')][_0x4e19b0[_0xeae2('0x54')]])['then'](function(_0x1f2ea9){ut['logger'](_0xeae2('0x55'),_0x1f2ea9);_0x16d8df(ut['message'](_0xeae2('0x56')));})[_0xeae2('0x3c')](function(_0x28e664){ut['logger'](_0xeae2('0x57'),_0x28e664);updateStatus(_0x4e19b0);_0xebe4d6(ut['message']('Fax\x20failed'));});});};Fax['prototype'][_0xeae2('0x58')]=function(_0xfba046){var _0x5a197a=this;return new BPromise(function(_0x4409ea,_0x1871f4){var _0x4245f7=_0x5a197a[_0xeae2('0x59')](_0x5a197a[_0xeae2('0xd')][_0xfba046[_0xeae2('0x54')]][_0xeae2('0x5a')],_0xfba046);if(_0x4245f7[_0xeae2('0x5b')]){_0x4409ea(ut[_0xeae2('0x35')](_0xeae2('0x5c')));}else{_0x1871f4(ut[_0xeae2('0x35')](_0x4245f7[_0xeae2('0x35')]));}});};function originate(_0x36c640,_0x30942e,_0x2eeb1a){return new BPromise(function(_0x32d4a7,_0x1bce93){if(_0x2eeb1a){var _0x52e86b=util[_0xeae2('0x5d')](_0xeae2('0x5e'),path[_0xeae2('0x36')](_0x36c640[_0xeae2('0x3')])['name'],_0x36c640['path']);gs['execute'](_0x52e86b)[_0xeae2('0x39')](function(){_0x36c640[_0xeae2('0x3')]=util[_0xeae2('0x5d')](_0xeae2('0x5f'),path[_0xeae2('0x36')](_0x36c640[_0xeae2('0x3')])[_0xeae2('0x60')],path[_0xeae2('0x36')](_0x36c640['path'])['name']);_0x30942e[_0xeae2('0x61')]=_0x36c640['path'];ut['logger'](_0xeae2('0x62'),'');ami['Action'](ut[_0xeae2('0x63')](_0x36c640,_0x30942e))[_0xeae2('0x39')](function(_0x2a32bf){_0x32d4a7(_0x2a32bf);})[_0xeae2('0x3c')](function(_0x3a5488){_0x1bce93(_0x3a5488);});})['catch'](function(_0x433284){_0x1bce93(_0x433284);});}else{ami[_0xeae2('0x64')](ut[_0xeae2('0x63')](_0x36c640,_0x30942e))[_0xeae2('0x39')](function(_0x124af7){_0x32d4a7(_0x124af7);})['catch'](function(_0x4e9348){_0x1bce93(_0x4e9348);});}});}Fax[_0xeae2('0x1e')]['execOriginate']=function(_0xe4aff,_0x23671e){var _0x17d575=this;return new BPromise(function(_0x45ebc3,_0x4d386d){var _0x2b00c=uuid['v4']();var _0x54b13e=ut['addVariables'](_0xe4aff,_0x23671e);_0x17d575[_0xeae2('0xf')][_0x2b00c]=new Action(_0x2b00c,_0x23671e,_0xe4aff);var _0x5f0ca2=_0x17d575[_0xeae2('0xf')][_0x2b00c];if(path[_0xeae2('0x36')](_0xe4aff['path'])['ext']==='.pdf'){originate(_0x5f0ca2,_0x54b13e,!![])[_0xeae2('0x39')](function(_0x2daa32){_0x45ebc3(_0x2daa32);})[_0xeae2('0x3c')](function(_0x38af09){_0x4d386d(_0x38af09);});}else{originate(_0x5f0ca2,_0x54b13e,![])[_0xeae2('0x39')](function(_0x31aed7){_0x45ebc3(_0x31aed7);})[_0xeae2('0x3c')](function(_0x4627f3){_0x4d386d(_0x4627f3);});}});};Fax['prototype']['isTrunkReachable']=function(_0x1b3aad){return!_[_0xeae2('0x65')](_0x1b3aad)&&!_['isNil'](_0x1b3aad[_0xeae2('0x25')])&&!_[_0xeae2('0x65')](_0x1b3aad[_0xeae2('0x66')])&&_0x1b3aad['active']&&!_[_0xeae2('0x65')](this['trunks'][util[_0xeae2('0x5d')](_0xeae2('0x67'),_0x1b3aad['name'])])&&!_[_0xeae2('0x65')](this['trunks'][util[_0xeae2('0x5d')]('SIP/%s',_0x1b3aad[_0xeae2('0x25')])]['status'])&&(this[_0xeae2('0xe')][util[_0xeae2('0x5d')]('SIP/%s',_0x1b3aad['name'])][_0xeae2('0x2d')]===_0xeae2('0x68')||this[_0xeae2('0xe')][util['format'](_0xeae2('0x67'),_0x1b3aad[_0xeae2('0x25')])]['status']===_0xeae2('0x69'));};Fax[_0xeae2('0x1e')][_0xeae2('0x59')]=function(_0x591bdf,_0x1f68cd){if(!this[_0xeae2('0x6a')](_0x591bdf)){ut[_0xeae2('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xeae2('0x65')](_0x591bdf)?'':_0x591bdf[_0xeae2('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xeae2('0x6b')};}if(_[_0xeae2('0x65')](_0x1f68cd['fax'])){ut[_0xeae2('0x46')](_0xeae2('0x6c'),JSON[_0xeae2('0x3e')](_0x1f68cd));return{'isValid':![],'message':_0xeae2('0x6d')};}if(_[_0xeae2('0x65')](_0x1f68cd[_0xeae2('0x3')])){ut[_0xeae2('0x46')](_0xeae2('0x6e'),JSON['stringify'](_0x1f68cd));return{'isValid':![],'message':_0xeae2('0x6f')};}return{'isValid':!![],'message':_0xeae2('0x70')};};module[_0xeae2('0x71')]=Fax; \ No newline at end of file +var _0xfd6c=['Is\x20Valid','util','lodash','bluebird','uuid','path','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','then','notify','.pdf','catch','\x20notify\x20','error','stringify','\x20receiveFax\x20','pick','response','AttachmentId','update','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfd6c,0x1c9));var _0xcfd6=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xfd6c[_0x118653];return _0xc11fa6;};'use strict';var util=require(_0xcfd6('0x0'));var _=require(_0xcfd6('0x1'));var BPromise=require(_0xcfd6('0x2'));var uuid=require(_0xcfd6('0x3'));var moment=require('moment');var path=require(_0xcfd6('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xcfd6('0x5'));var logger=require('../../../config/logger')(_0xcfd6('0x6'));var ami=require(_0xcfd6('0x7'));var rpcDb=require(_0xcfd6('0x8'));var Channel=require(_0xcfd6('0x9'));var ut=require(_0xcfd6('0xa'));var Action=require(_0xcfd6('0xb'));var faxAccount=require(_0xcfd6('0xc'));var attachment=require(_0xcfd6('0xd'));var faxMessage=require(_0xcfd6('0xe'));function Fax(_0x140e91){this['channels']={};this['faxAccounts']=_0x140e91[_0xcfd6('0xf')];this[_0xcfd6('0x10')]=_0x140e91[_0xcfd6('0x10')];this['actions']={};ami['on']('newchannel',this[_0xcfd6('0x11')][_0xcfd6('0x12')](this));ami['on'](_0xcfd6('0x13'),this[_0xcfd6('0x14')][_0xcfd6('0x12')](this));ami['on'](_0xcfd6('0x15'),this[_0xcfd6('0x16')][_0xcfd6('0x12')](this));ami['on'](_0xcfd6('0x17'),this[_0xcfd6('0x18')][_0xcfd6('0x12')](this));ami['on'](_0xcfd6('0x19'),this[_0xcfd6('0x1a')][_0xcfd6('0x12')](this));ami['on'](_0xcfd6('0x1b'),this[_0xcfd6('0x1c')][_0xcfd6('0x12')](this));ami['on'](_0xcfd6('0x1d'),this[_0xcfd6('0x1e')][_0xcfd6('0x12')](this));ami['on'](_0xcfd6('0x1f'),this[_0xcfd6('0x20')][_0xcfd6('0x12')](this));}Fax[_0xcfd6('0x21')][_0xcfd6('0x11')]=function(_0x41a693){if(_0x41a693[_0xcfd6('0x22')]==='from-voip-provider'){for(var _0x5b4728 in this[_0xcfd6('0xf')]){if(this['faxAccounts'][_0xcfd6('0x23')](_0x5b4728)){if(_0x41a693[_0xcfd6('0x24')]===this[_0xcfd6('0xf')][_0x5b4728]['localstationid']){this[_0xcfd6('0x25')][_0x41a693['uniqueid']]={};this[_0xcfd6('0x25')][_0x41a693[_0xcfd6('0x26')]][_0xcfd6('0x27')]=_0x41a693[_0xcfd6('0x27')];this[_0xcfd6('0x25')][_0x41a693[_0xcfd6('0x26')]]['id']=this[_0xcfd6('0xf')][_0x5b4728]['id'];this['channels'][_0x41a693[_0xcfd6('0x26')]][_0xcfd6('0x28')]=this['faxAccounts'][_0x5b4728][_0xcfd6('0x28')];logger[_0xcfd6('0x29')](_0x41a693[_0xcfd6('0x26')],_0xcfd6('0x2a'));}}}}if(this[_0xcfd6('0x2b')][_0x41a693[_0xcfd6('0x26')]]){this['channels'][_0x41a693[_0xcfd6('0x26')]]={};this[_0xcfd6('0x25')][_0x41a693[_0xcfd6('0x26')]]['channel']=_0x41a693[_0xcfd6('0x27')];logger[_0xcfd6('0x29')](_0x41a693[_0xcfd6('0x26')],_0xcfd6('0x2a'));}};Fax[_0xcfd6('0x21')][_0xcfd6('0x14')]=function(_0x39a146){if(this[_0xcfd6('0x25')][_0x39a146[_0xcfd6('0x26')]]){for(var _0xc9ece1 in _0x39a146[_0xcfd6('0x2c')]){if(_0x39a146['variable'][_0xcfd6('0x23')](_0xc9ece1)){this['channels'][_0x39a146[_0xcfd6('0x26')]][_0xc9ece1]=_0x39a146[_0xcfd6('0x2d')];}}}};Fax[_0xcfd6('0x21')][_0xcfd6('0x16')]=function(_0x472add){if(this['channels'][_0x472add['uniqueid']]){this[_0xcfd6('0x25')][_0x472add['uniqueid']]['channelstate']=_0x472add['channelstate'];this[_0xcfd6('0x25')][_0x472add['uniqueid']]['channelstatedesc']=_0x472add[_0xcfd6('0x2e')];}};Fax[_0xcfd6('0x21')][_0xcfd6('0x18')]=function(_0x358c1c){if(this[_0xcfd6('0x25')][_0x358c1c['uniqueid']]){for(var _0x876a75 in _0x358c1c[_0xcfd6('0x2c')]){if(_0x358c1c['variable']['hasOwnProperty'](_0x876a75)){this[_0xcfd6('0x25')][_0x358c1c['uniqueid']][_0x876a75]=_0x358c1c[_0xcfd6('0x2d')];}}}};Fax[_0xcfd6('0x21')][_0xcfd6('0x1a')]=function(_0x54739f){if(this[_0xcfd6('0x25')][_0x54739f[_0xcfd6('0x26')]]){this[_0xcfd6('0x25')][_0x54739f['uniqueid']][_0xcfd6('0x2f')]=_0x54739f[_0xcfd6('0x2f')];this['channels'][_0x54739f[_0xcfd6('0x26')]][_0xcfd6('0x30')]=_0x54739f[_0xcfd6('0x30')];this[_0xcfd6('0x25')][_0x54739f[_0xcfd6('0x26')]]['localstationid']=_0x54739f[_0xcfd6('0x31')];this[_0xcfd6('0x25')][_0x54739f['uniqueid']][_0xcfd6('0x32')]=_0x54739f['filename'];logger[_0xcfd6('0x29')](_0x54739f[_0xcfd6('0x26')],_0xcfd6('0x33'));}};Fax['prototype'][_0xcfd6('0x1c')]=function(_0x10693c){var _0x1f2d8d=this;if(this[_0xcfd6('0x25')][_0x10693c[_0xcfd6('0x26')]]){var _0x40aacf=this['channels'][_0x10693c[_0xcfd6('0x26')]]['id'];this[_0xcfd6('0x25')][_0x10693c[_0xcfd6('0x26')]][_0xcfd6('0x34')]=_0x10693c['remotestationid'];this['channels'][_0x10693c[_0xcfd6('0x26')]][_0xcfd6('0x35')]=_0x10693c[_0xcfd6('0x35')];this[_0xcfd6('0x25')][_0x10693c[_0xcfd6('0x26')]][_0xcfd6('0x31')]=_0x10693c[_0xcfd6('0x31')];this[_0xcfd6('0x25')][_0x10693c['uniqueid']][_0xcfd6('0x36')]=_0x10693c[_0xcfd6('0x36')];this[_0xcfd6('0x25')][_0x10693c['uniqueid']][_0xcfd6('0x37')]=_0x10693c['transferrate'];this[_0xcfd6('0x25')][_0x10693c[_0xcfd6('0x26')]][_0xcfd6('0x32')]=_0x10693c[_0xcfd6('0x32')];this['channels'][_0x10693c[_0xcfd6('0x26')]][_0xcfd6('0x38')]=_0x10693c[_0xcfd6('0x38')];if(this['channels'][_0x10693c[_0xcfd6('0x26')]][_0xcfd6('0x35')]>0x0){tiff2pdf(_0x10693c[_0xcfd6('0x32')],_0xcfd6('0x39'),function(_0x12243c){logger['info'](_0x10693c[_0xcfd6('0x26')],'\x20result\x20conversion\x20file\x20',_0x12243c['message']);attachment[_0xcfd6('0x3a')]({'name':path['parse'](_0x10693c[_0xcfd6('0x32')])[_0xcfd6('0x28')],'basename':path[_0xcfd6('0x3b')](_0x10693c[_0xcfd6('0x32')])[_0xcfd6('0x28')]+'.pdf','type':'application/pdf'})[_0xcfd6('0x3c')](function(_0x46ea99){faxAccount[_0xcfd6('0x3d')](_0x40aacf,{'from':_0x10693c[_0xcfd6('0x38')],'mapKey':_0xcfd6('0x6'),'body':path[_0xcfd6('0x3b')](_0x10693c[_0xcfd6('0x32')])[_0xcfd6('0x28')]+_0xcfd6('0x3e'),'AttachmentId':_0x46ea99['id']})[_0xcfd6('0x3f')](function(_0xf0a0a1){logger['error'](_0x10693c['uniqueid'],_0xcfd6('0x40'),JSON['stringify'](_0xf0a0a1));});})[_0xcfd6('0x3f')](function(_0xd56602){logger[_0xcfd6('0x41')](_0x10693c[_0xcfd6('0x26')],'\x20receiveFax\x20',JSON[_0xcfd6('0x42')](_0xd56602));});});}logger['info'](_0x10693c[_0xcfd6('0x26')],_0xcfd6('0x43'));}};Fax['prototype'][_0xcfd6('0x20')]=function(_0x527edf){if(this[_0xcfd6('0x2b')][_0x527edf[_0xcfd6('0x26')]]){_['merge'](this[_0xcfd6('0x25')][_0x527edf[_0xcfd6('0x26')]],_[_0xcfd6('0x44')](_0x527edf,[_0xcfd6('0x45'),'reason']));}};function updateStatus(_0xf46390){if(_0xf46390[_0xcfd6('0x46')]){faxMessage[_0xcfd6('0x47')](_0xf46390['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0xcfd6('0x3c')](function(_0x328448){ut['logger'](_0xcfd6('0x48'),_0x328448);})['catch'](function(_0x4418b7){ut[_0xcfd6('0x49')]('[Fax][Message][Error][NoUpdate1]',_0x4418b7);});}else{ut[_0xcfd6('0x49')](_0xcfd6('0x4a'));}}Fax[_0xcfd6('0x21')][_0xcfd6('0x4b')]=function(_0x1efc32,_0x452811,_0x21cd99){var _0x1b4382=this;var _0x39b1dc={};if(_0x452811){_0x39b1dc={'read':_0x452811};}else{_0x39b1dc={'failMessage':_0x21cd99};}if(this[_0xcfd6('0x2b')][_0x1efc32][_0xcfd6('0x46')]){faxMessage['update'](this['actions'][_0x1efc32]['AttachmentId'],_0x39b1dc)['then'](function(_0x472e45){ut[_0xcfd6('0x49')]('[Fax][Message][Updated]',_0x472e45);})['catch'](function(_0x2a6240){ut[_0xcfd6('0x49')](_0xcfd6('0x4c'),_0x2a6240);})['finally'](function(){delete _0x1b4382[_0xcfd6('0x25')][_0x1efc32];delete _0x1b4382[_0xcfd6('0x2b')][_0x1efc32];});}else{ut[_0xcfd6('0x49')](_0xcfd6('0x4d'));delete this[_0xcfd6('0x25')][_0x1efc32];delete this[_0xcfd6('0x2b')][_0x1efc32];}};Fax[_0xcfd6('0x21')][_0xcfd6('0x1e')]=function(_0x389aff){var _0x36d14a=this;if(this[_0xcfd6('0x25')][_0x389aff['uniqueid']]){if(this[_0xcfd6('0x2b')][_0x389aff[_0xcfd6('0x26')]]){this[_0xcfd6('0x25')][_0x389aff[_0xcfd6('0x26')]]['id']=this[_0xcfd6('0x2b')][_0x389aff[_0xcfd6('0x26')]]['id'];this[_0xcfd6('0x25')][_0x389aff[_0xcfd6('0x26')]]['name']=this[_0xcfd6('0x2b')][_0x389aff[_0xcfd6('0x26')]][_0xcfd6('0x28')];}logger['info'](_0x389aff[_0xcfd6('0x26')],this['actions'][_0x389aff[_0xcfd6('0x26')]]?'\x20hangup\x20sendFile\x20':_0xcfd6('0x4e'),JSON[_0xcfd6('0x42')](this[_0xcfd6('0x25')][_0x389aff[_0xcfd6('0x26')]]));if(this[_0xcfd6('0x2b')][_0x389aff[_0xcfd6('0x26')]]){if(this[_0xcfd6('0x25')][_0x389aff[_0xcfd6('0x26')]][_0xcfd6('0x4f')]>0x0&&this[_0xcfd6('0x25')][_0x389aff[_0xcfd6('0x26')]]['faxstatus']==='SUCCESS'){this[_0xcfd6('0x4b')](_0x389aff[_0xcfd6('0x26')],!![]);}else{this['updateStatus'](_0x389aff[_0xcfd6('0x26')],![],this[_0xcfd6('0x25')][_0x389aff['uniqueid']][_0xcfd6('0x50')]?_0xcfd6('0x51')+this[_0xcfd6('0x25')][_0x389aff['uniqueid']][_0xcfd6('0x50')]:_0xcfd6('0x52'));}}}};Fax[_0xcfd6('0x21')][_0xcfd6('0x53')]=function(_0x5021d5){var _0x14b796=this;return new BPromise(function(_0x6f454a,_0x2a3e8e){_0x14b796[_0xcfd6('0x54')](_0x5021d5,_0x14b796[_0xcfd6('0xf')][_0x5021d5[_0xcfd6('0x55')]])[_0xcfd6('0x3c')](function(_0xbf3d0){ut[_0xcfd6('0x49')](_0xcfd6('0x56'),_0xbf3d0);_0x6f454a(ut[_0xcfd6('0x57')](_0xcfd6('0x58')));})[_0xcfd6('0x3f')](function(_0x41b361){ut['logger'](_0xcfd6('0x59'),_0x41b361);updateStatus(_0x5021d5);_0x2a3e8e(ut[_0xcfd6('0x57')]('Fax\x20failed'));});});};Fax[_0xcfd6('0x21')][_0xcfd6('0x5a')]=function(_0x115950){var _0x820c88=this;return new BPromise(function(_0x42ec2e,_0x419a41){var _0xe7de6c=_0x820c88[_0xcfd6('0x5b')](_0x820c88[_0xcfd6('0xf')][_0x115950[_0xcfd6('0x55')]]['Trunk'],_0x115950);if(_0xe7de6c[_0xcfd6('0x5c')]){_0x42ec2e(ut[_0xcfd6('0x57')](_0xcfd6('0x5d')));}else{_0x419a41(ut[_0xcfd6('0x57')](_0xe7de6c[_0xcfd6('0x57')]));}});};function originate(_0x364eb1,_0xecd7fa,_0xf6ceae){return new BPromise(function(_0x44c037,_0x28aa82){if(_0xf6ceae){var _0x233efb=util[_0xcfd6('0x5e')](_0xcfd6('0x5f'),path[_0xcfd6('0x3b')](_0x364eb1['path'])[_0xcfd6('0x28')],_0x364eb1[_0xcfd6('0x4')]);gs[_0xcfd6('0x60')](_0x233efb)[_0xcfd6('0x3c')](function(){_0x364eb1[_0xcfd6('0x4')]=util[_0xcfd6('0x5e')](_0xcfd6('0x61'),path['parse'](_0x364eb1[_0xcfd6('0x4')])['dir'],path[_0xcfd6('0x3b')](_0x364eb1[_0xcfd6('0x4')])[_0xcfd6('0x28')]);_0xecd7fa[_0xcfd6('0x62')]=_0x364eb1[_0xcfd6('0x4')];ut[_0xcfd6('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xcfd6('0x63')](ut[_0xcfd6('0x64')](_0x364eb1,_0xecd7fa))[_0xcfd6('0x3c')](function(_0x2bad53){_0x44c037(_0x2bad53);})[_0xcfd6('0x3f')](function(_0x12aaac){_0x28aa82(_0x12aaac);});})[_0xcfd6('0x3f')](function(_0x216a3b){_0x28aa82(_0x216a3b);});}else{ami[_0xcfd6('0x63')](ut[_0xcfd6('0x64')](_0x364eb1,_0xecd7fa))[_0xcfd6('0x3c')](function(_0x1af396){_0x44c037(_0x1af396);})[_0xcfd6('0x3f')](function(_0x217769){_0x28aa82(_0x217769);});}});}Fax['prototype'][_0xcfd6('0x54')]=function(_0x524435,_0x383732){var _0x340f59=this;return new BPromise(function(_0x4116a0,_0x49b9a1){var _0x13a30e=uuid['v4']();var _0x514d2d=ut['addVariables'](_0x524435,_0x383732);_0x340f59['actions'][_0x13a30e]=new Action(_0x13a30e,_0x383732,_0x524435);var _0x3b3053=_0x340f59[_0xcfd6('0x2b')][_0x13a30e];if(path[_0xcfd6('0x3b')](_0x524435[_0xcfd6('0x4')])[_0xcfd6('0x65')]===_0xcfd6('0x3e')){originate(_0x3b3053,_0x514d2d,!![])[_0xcfd6('0x3c')](function(_0x5b4fde){_0x4116a0(_0x5b4fde);})[_0xcfd6('0x3f')](function(_0x22a26c){_0x49b9a1(_0x22a26c);});}else{originate(_0x3b3053,_0x514d2d,![])['then'](function(_0x29f26b){_0x4116a0(_0x29f26b);})[_0xcfd6('0x3f')](function(_0x2424a2){_0x49b9a1(_0x2424a2);});}});};Fax[_0xcfd6('0x21')][_0xcfd6('0x66')]=function(_0x17f9f6){return!_['isNil'](_0x17f9f6)&&!_[_0xcfd6('0x67')](_0x17f9f6[_0xcfd6('0x28')])&&!_[_0xcfd6('0x67')](_0x17f9f6[_0xcfd6('0x68')])&&_0x17f9f6[_0xcfd6('0x68')]&&!_['isNil'](this[_0xcfd6('0x10')][util[_0xcfd6('0x5e')](_0xcfd6('0x69'),_0x17f9f6[_0xcfd6('0x28')])])&&!_[_0xcfd6('0x67')](this['trunks'][util[_0xcfd6('0x5e')](_0xcfd6('0x69'),_0x17f9f6['name'])][_0xcfd6('0x30')])&&(this[_0xcfd6('0x10')][util['format']('SIP/%s',_0x17f9f6[_0xcfd6('0x28')])][_0xcfd6('0x30')]===_0xcfd6('0x6a')||this[_0xcfd6('0x10')][util[_0xcfd6('0x5e')](_0xcfd6('0x69'),_0x17f9f6[_0xcfd6('0x28')])][_0xcfd6('0x30')]===_0xcfd6('0x6b'));};Fax[_0xcfd6('0x21')][_0xcfd6('0x5b')]=function(_0x362fd0,_0x4c7927){if(!this['isTrunkReachable'](_0x362fd0)){ut[_0xcfd6('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xcfd6('0x67')](_0x362fd0)?'':_0x362fd0['name']+_0xcfd6('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xcfd6('0x67')](_0x4c7927[_0xcfd6('0x6')])){ut[_0xcfd6('0x49')](_0xcfd6('0x6d'),JSON[_0xcfd6('0x42')](_0x4c7927));return{'isValid':![],'message':_0xcfd6('0x6e')};}if(_['isNil'](_0x4c7927['path'])){ut[_0xcfd6('0x49')](_0xcfd6('0x6f'),JSON['stringify'](_0x4c7927));return{'isValid':![],'message':_0xcfd6('0x70')};}return{'isValid':!![],'message':_0xcfd6('0x71')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 856094b..34539b1 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 _0x050e=['bluebird','../../../config/logger','preview','lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x147340,_0x58c888){var _0x70e8=function(_0x1d2abe){while(--_0x1d2abe){_0x147340['push'](_0x147340['shift']());}};_0x70e8(++_0x58c888);}(_0x050e,0xe3));var _0xe050=function(_0x7dfbe8,_0x430dd9){_0x7dfbe8=_0x7dfbe8-0x0;var _0x39c50c=_0x050e[_0x7dfbe8];return _0x39c50c;};'use strict';var util=require(_0xe050('0x0'));var BPromise=require(_0xe050('0x1'));var logger=require(_0xe050('0x2'))(_0xe050('0x3'));var _=require(_0xe050('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x3acddb){return function(_0x293522){logger[_0xe050('0x5')](_0x3acddb,util[_0xe050('0x6')](_0x293522,{'showHidden':![],'depth':null}));};}exports[_0xe050('0x7')]=function(_0x319e85,_0x1ea3a2){return BPromise[_0xe050('0x8')]()[_0xe050('0x9')](faxAccount['notify'](_0x319e85,_0x1ea3a2))[_0xe050('0xa')](loggerCatch(_0xe050('0xb')));}; \ No newline at end of file +var _0x3f5e=['then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash','error','inspect','notify'];(function(_0x55e2bc,_0x49bffb){var _0x195837=function(_0x3e32fc){while(--_0x3e32fc){_0x55e2bc['push'](_0x55e2bc['shift']());}};_0x195837(++_0x49bffb);}(_0x3f5e,0x189));var _0xe3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe3f5('0x0'));var BPromise=require('bluebird');var logger=require(_0xe3f5('0x1'))(_0xe3f5('0x2'));var _=require(_0xe3f5('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2d72dc){return function(_0x40a403){logger[_0xe3f5('0x4')](_0x2d72dc,util[_0xe3f5('0x5')](_0x40a403,{'showHidden':![],'depth':null}));};}exports[_0xe3f5('0x6')]=function(_0x1f1958,_0x1c2efa){return BPromise['resolve']()[_0xe3f5('0x7')](faxAccount[_0xe3f5('0x6')](_0x1f1958,_0x1c2efa))[_0xe3f5('0x8')](loggerCatch(_0xe3f5('0x9')));}; \ 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 40a6268..5501440 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 _0x271b=['info','Exec\x20gs','util','child_process','exec','execute'];(function(_0x57b7f6,_0x5d6061){var _0x135fed=function(_0x14f057){while(--_0x14f057){_0x57b7f6['push'](_0x57b7f6['shift']());}};_0x135fed(++_0x5d6061);}(_0x271b,0x1ca));var _0xb271=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x271b[_0x24237f];return _0x48298e;};'use strict';var util=require(_0xb271('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require('bluebird');var exec=require(_0xb271('0x1'))[_0xb271('0x2')];exports[_0xb271('0x3')]=function(_0x2bb49e){return new BPromise(function(_0x58fee8,_0xb5243b){exec(_0x2bb49e,function(_0x57813a,_0x2ffd21,_0x37adc7){logger[_0xb271('0x4')](_0xb271('0x5'),_0x2ffd21);if(_0x57813a){logger[_0xb271('0x4')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x57813a,{'showHidden':![],'depth':null}),_0x2ffd21,_0x37adc7);_0xb5243b(_0x57813a);}_0x58fee8(_0x2ffd21);});});}; \ No newline at end of file +var _0x500f=['child_process','exec','info','\x20Error\x20:','inspect','util'];(function(_0x39bbbc,_0x10aab4){var _0xf946c2=function(_0x572b9e){while(--_0x572b9e){_0x39bbbc['push'](_0x39bbbc['shift']());}};_0xf946c2(++_0x10aab4);}(_0x500f,0x1b5));var _0xf500=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0x500f[_0x5948dd];return _0xb1f8be;};'use strict';var util=require(_0xf500('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require('bluebird');var exec=require(_0xf500('0x1'))[_0xf500('0x2')];exports['execute']=function(_0x394992){return new BPromise(function(_0x36cfed,_0x40937e){exec(_0x394992,function(_0x437d6f,_0x3a0bd5,_0x278844){logger['info']('Exec\x20gs',_0x3a0bd5);if(_0x437d6f){logger[_0xf500('0x3')]('Exec\x20gs',_0xf500('0x4'),util[_0xf500('0x5')](_0x437d6f,{'showHidden':![],'depth':null}),_0x3a0bd5,_0x278844);_0x40937e(_0x437d6f);}_0x36cfed(_0x3a0bd5);});});}; \ 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 eb60654..066dde1 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 _0xc368=['from-sip','\x22%s\x22\x20<%s>','localstationid','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc368,0x7b));var _0x8c36=function(_0x3873d6,_0x4ada70){_0x3873d6=_0x3873d6-0x0;var _0x1c2f0f=_0xc368[_0x3873d6];return _0x1c2f0f;};'use strict';var util=require('util');var _=require(_0x8c36('0x0'));var moment=require('moment');var logger=require(_0x8c36('0x1'))(_0x8c36('0x2'));exports[_0x8c36('0x3')]=function(_0x2640c5){return{'message':_0x2640c5};};exports[_0x8c36('0x4')]=function(_0x5d3b27,_0x3e9034){logger[_0x8c36('0x5')](_0x5d3b27,util[_0x8c36('0x6')](_0x3e9034,{'showHidden':![],'depth':null}));};exports[_0x8c36('0x7')]=function(_0x5ebfc1,_0x554022){var _0x8ed437={'XMF-ECM':_0x554022[_0x8c36('0x8')],'XMF-HEADERINFO':_0x554022[_0x8c36('0x9')],'XMF-MINRATE':_0x554022[_0x8c36('0xa')],'XMF-MAXRATE':_0x554022[_0x8c36('0xb')],'XMF-MODEM':util[_0x8c36('0xc')]('\x22%s\x22',_0x554022['modem']),'XMF-GATEWAY':_0x554022['gateway'],'XMF-FAXDETECT':_0x554022[_0x8c36('0xd')],'XMF-T38TIMEOUT':_0x554022[_0x8c36('0xe')],'XMF-LOCALSTATIONID':_0x554022['localstationid'],'XMF-PATH':_0x5ebfc1[_0x8c36('0xf')]};return _0x8ed437;};exports[_0x8c36('0x10')]=function(_0x1d5c61,_0xe7857e){return{'actionid':_0x1d5c61[_0x8c36('0x11')],'action':_0x8c36('0x12'),'channel':_0x1d5c61[_0x8c36('0x13')],'Exten':_0x8c36('0x14'),'Context':_0x8c36('0x15'),'Priority':'1','callerid':util[_0x8c36('0xc')](_0x8c36('0x16'),_0x1d5c61[_0x8c36('0x9')]?_0x1d5c61[_0x8c36('0x9')]:'',_0x1d5c61[_0x8c36('0x17')]),'variable':_0xe7857e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d5c61['uniqueid']};}; \ No newline at end of file +var _0xf109=['t38timeout','localstationid','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','faxdetect'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xf109,0xce));var _0x9f10=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xf109[_0x32f7d7];return _0x133d09;};'use strict';var util=require(_0x9f10('0x0'));var _=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x3659ce){return{'message':_0x3659ce};};exports[_0x9f10('0x3')]=function(_0x74d0ee,_0x26f01c){logger[_0x9f10('0x4')](_0x74d0ee,util[_0x9f10('0x5')](_0x26f01c,{'showHidden':![],'depth':null}));};exports[_0x9f10('0x6')]=function(_0xd3137b,_0x227a29){var _0x2a877e={'XMF-ECM':_0x227a29[_0x9f10('0x7')],'XMF-HEADERINFO':_0x227a29['headerinfo'],'XMF-MINRATE':_0x227a29[_0x9f10('0x8')],'XMF-MAXRATE':_0x227a29[_0x9f10('0x9')],'XMF-MODEM':util[_0x9f10('0xa')](_0x9f10('0xb'),_0x227a29[_0x9f10('0xc')]),'XMF-GATEWAY':_0x227a29['gateway'],'XMF-FAXDETECT':_0x227a29[_0x9f10('0xd')],'XMF-T38TIMEOUT':_0x227a29[_0x9f10('0xe')],'XMF-LOCALSTATIONID':_0x227a29[_0x9f10('0xf')],'XMF-PATH':_0xd3137b['path']};return _0x2a877e;};exports['variablesAction']=function(_0x3fac2b,_0x311935){return{'actionid':_0x3fac2b[_0x9f10('0x10')],'action':'originate','channel':_0x3fac2b[_0x9f10('0x11')],'Exten':_0x9f10('0x12'),'Context':_0x9f10('0x13'),'Priority':'1','callerid':util['format'](_0x9f10('0x14'),_0x3fac2b[_0x9f10('0x15')]?_0x3fac2b['headerinfo']:'',_0x3fac2b[_0x9f10('0xf')]),'variable':_0x311935,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3fac2b[_0x9f10('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ffaf3be..2e15748 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 _0x0616=['./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger'];(function(_0x3c5c8c,_0x5ba657){var _0x445625=function(_0x54bea4){while(--_0x54bea4){_0x3c5c8c['push'](_0x3c5c8c['shift']());}};_0x445625(++_0x5ba657);}(_0x0616,0x19e));var _0x6061=function(_0x29c2bb,_0x1bde54){_0x29c2bb=_0x29c2bb-0x0;var _0x5446f1=_0x0616[_0x29c2bb];return _0x5446f1;};'use strict';var BPromise=require(_0x6061('0x0'));var util=require(_0x6061('0x1'));var moment=require(_0x6061('0x2'));var server=require(_0x6061('0x3'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x6061('0x4'));var Dialer=require(_0x6061('0x5'));var Preview=require(_0x6061('0x6'));var Fax=require('./fax');var user=require(_0x6061('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x6061('0x8'));var voiceCallReport=require(_0x6061('0x9'));var trunk=require(_0x6061('0xa'));var trigger=require(_0x6061('0xb'));var template=require(_0x6061('0xc'));var cmHopperHistory=require(_0x6061('0xd'));var campaign=require(_0x6061('0xe'));var voiceExtension=require(_0x6061('0xf'));var faxAccount=require(_0x6061('0x10'));var zendesk=require(_0x6061('0x11'));var salesforce=require(_0x6061('0x12'));var sugarcrm=require(_0x6061('0x13'));var freshdesk=require(_0x6061('0x14'));var desk=require(_0x6061('0x15'));var zoho=require(_0x6061('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x6061('0x17'));var servicenow=require(_0x6061('0x18'));var dynamics365=require(_0x6061('0x19'));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()[_0x6061('0x1a')](_0x6061('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x6061('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6061('0x1c')]()[_0x6061('0x1d')](user[_0x6061('0x1e')]())[_0x6061('0x1d')](realtime['initAgents']())['then'](user[_0x6061('0x1f')]())[_0x6061('0x1d')](realtime[_0x6061('0x20')]())[_0x6061('0x1d')](trunk[_0x6061('0x21')]())['then'](realtime[_0x6061('0x22')]())['then'](voiceQueue[_0x6061('0x23')]())['then'](realtime[_0x6061('0x24')]())[_0x6061('0x1d')](trigger[_0x6061('0x25')]())['then'](realtime[_0x6061('0x26')]())[_0x6061('0x1d')](template[_0x6061('0x27')]())[_0x6061('0x1d')](realtime[_0x6061('0x28')]())[_0x6061('0x1d')](zendesk[_0x6061('0x29')]())[_0x6061('0x1d')](realtime['initZendeskAccounts']())[_0x6061('0x1d')](salesforce[_0x6061('0x2a')]())[_0x6061('0x1d')](realtime[_0x6061('0x2b')]())[_0x6061('0x1d')](sugarcrm[_0x6061('0x2c')]())[_0x6061('0x1d')](realtime[_0x6061('0x2d')]())[_0x6061('0x1d')](freshdesk[_0x6061('0x2e')]())[_0x6061('0x1d')](realtime[_0x6061('0x2f')]())[_0x6061('0x1d')](desk['getDeskAccounts']())[_0x6061('0x1d')](realtime['initDeskAccounts']())[_0x6061('0x1d')](zoho['getZohoAccounts']())[_0x6061('0x1d')](realtime[_0x6061('0x30')]())[_0x6061('0x1d')](vtiger[_0x6061('0x31')]())[_0x6061('0x1d')](realtime[_0x6061('0x32')]())[_0x6061('0x1d')](freshsales['getFreshsalesAccounts']())[_0x6061('0x1d')](realtime[_0x6061('0x33')]())[_0x6061('0x1d')](servicenow[_0x6061('0x34')]())[_0x6061('0x1d')](realtime[_0x6061('0x35')]())[_0x6061('0x1d')](dynamics365[_0x6061('0x36')]())[_0x6061('0x1d')](realtime['initDynamics365Accounts']())[_0x6061('0x1d')](campaign[_0x6061('0x37')]())[_0x6061('0x1d')](realtime[_0x6061('0x38')]())[_0x6061('0x1d')](voiceExtension[_0x6061('0x39')]())['then'](realtime[_0x6061('0x3a')]())[_0x6061('0x1d')](faxAccount[_0x6061('0x3b')]())[_0x6061('0x1d')](realtime[_0x6061('0x3c')]())[_0x6061('0x1d')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x6061('0x3d')]())['then'](realtime['initVoiceQueueReports']())[_0x6061('0x1d')](cmHopperHistory[_0x6061('0x3e')]())[_0x6061('0x1d')](realtime[_0x6061('0x3f')]())[_0x6061('0x1d')](cmHopperHistory[_0x6061('0x40')]())[_0x6061('0x1d')](realtime[_0x6061('0x41')]())[_0x6061('0x1d')](voiceCallReport[_0x6061('0x42')]())['then'](realtime['initVoiceCallReports']())[_0x6061('0x1d')](function(_0x33bab8){})[_0x6061('0x43')](function(_0x1144f8){console[_0x6061('0x44')](_0x1144f8);});}function main(){return server[_0x6061('0x45')](realtime,preview,fax)[_0x6061('0x1d')](function(_0x332d44){return initRealtime();})[_0x6061('0x1d')](function(){return initParams();})[_0x6061('0x1d')](function(){report[_0x6061('0x46')]();setInterval(initRealtime,0x1388);})[_0x6061('0x43')](function(_0x3ecb82){console[_0x6061('0x44')](_0x3ecb82);});}main(); \ No newline at end of file +var _0xb862=['log','listen','sync','bluebird','util','moment','./realtime','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch'];(function(_0x38f522,_0x33bd57){var _0x39bec5=function(_0x5b7c63){while(--_0x5b7c63){_0x38f522['push'](_0x38f522['shift']());}};_0x39bec5(++_0x33bd57);}(_0xb862,0x1d8));var _0x2b86=function(_0x494c3c,_0x54367a){_0x494c3c=_0x494c3c-0x0;var _0x431e00=_0xb862[_0x494c3c];return _0x431e00;};'use strict';var BPromise=require(_0x2b86('0x0'));var util=require(_0x2b86('0x1'));var moment=require(_0x2b86('0x2'));var server=require('./server');var Realtime=require(_0x2b86('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x2b86('0x4'));var Preview=require(_0x2b86('0x5'));var Fax=require('./fax');var user=require(_0x2b86('0x6'));var voiceQueue=require(_0x2b86('0x7'));var voiceQueueReport=require(_0x2b86('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x2b86('0x9'));var trigger=require('./rpc/trigger');var template=require(_0x2b86('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x2b86('0xb'));var faxAccount=require(_0x2b86('0xc'));var zendesk=require(_0x2b86('0xd'));var salesforce=require(_0x2b86('0xe'));var sugarcrm=require(_0x2b86('0xf'));var freshdesk=require(_0x2b86('0x10'));var desk=require(_0x2b86('0x11'));var zoho=require(_0x2b86('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x2b86('0x13'));var servicenow=require(_0x2b86('0x14'));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()[_0x2b86('0x15')](_0x2b86('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2b86('0x15')](_0x2b86('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2b86('0x17')]()[_0x2b86('0x18')](user[_0x2b86('0x19')]())[_0x2b86('0x18')](realtime[_0x2b86('0x1a')]())['then'](user['getTelephones']())[_0x2b86('0x18')](realtime[_0x2b86('0x1b')]())[_0x2b86('0x18')](trunk[_0x2b86('0x1c')]())[_0x2b86('0x18')](realtime['initTrunks']())[_0x2b86('0x18')](voiceQueue[_0x2b86('0x1d')]())[_0x2b86('0x18')](realtime[_0x2b86('0x1e')]())['then'](trigger[_0x2b86('0x1f')]())[_0x2b86('0x18')](realtime[_0x2b86('0x20')]())[_0x2b86('0x18')](template[_0x2b86('0x21')]())[_0x2b86('0x18')](realtime['initTemplates']())['then'](zendesk[_0x2b86('0x22')]())[_0x2b86('0x18')](realtime['initZendeskAccounts']())[_0x2b86('0x18')](salesforce[_0x2b86('0x23')]())[_0x2b86('0x18')](realtime[_0x2b86('0x24')]())[_0x2b86('0x18')](sugarcrm[_0x2b86('0x25')]())[_0x2b86('0x18')](realtime[_0x2b86('0x26')]())[_0x2b86('0x18')](freshdesk[_0x2b86('0x27')]())[_0x2b86('0x18')](realtime[_0x2b86('0x28')]())['then'](desk[_0x2b86('0x29')]())[_0x2b86('0x18')](realtime[_0x2b86('0x2a')]())[_0x2b86('0x18')](zoho[_0x2b86('0x2b')]())['then'](realtime[_0x2b86('0x2c')]())['then'](vtiger[_0x2b86('0x2d')]())[_0x2b86('0x18')](realtime['initVtigerAccounts']())[_0x2b86('0x18')](freshsales[_0x2b86('0x2e')]())[_0x2b86('0x18')](realtime[_0x2b86('0x2f')]())[_0x2b86('0x18')](servicenow[_0x2b86('0x30')]())[_0x2b86('0x18')](realtime[_0x2b86('0x31')]())['then'](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x2b86('0x32')]())[_0x2b86('0x18')](campaign[_0x2b86('0x33')]())['then'](realtime[_0x2b86('0x34')]())[_0x2b86('0x18')](voiceExtension[_0x2b86('0x35')]())[_0x2b86('0x18')](realtime['initVoiceExtensions']())[_0x2b86('0x18')](faxAccount[_0x2b86('0x36')]())[_0x2b86('0x18')](realtime[_0x2b86('0x37')]())[_0x2b86('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x2b86('0x17')]()[_0x2b86('0x18')](voiceQueueReport['getVoiceQueueReports']())[_0x2b86('0x18')](realtime[_0x2b86('0x38')]())[_0x2b86('0x18')](cmHopperHistory[_0x2b86('0x39')]())[_0x2b86('0x18')](realtime[_0x2b86('0x3a')]())[_0x2b86('0x18')](cmHopperHistory[_0x2b86('0x3b')]())[_0x2b86('0x18')](realtime[_0x2b86('0x3c')]())['then'](voiceCallReport[_0x2b86('0x3d')]())[_0x2b86('0x18')](realtime[_0x2b86('0x3e')]())[_0x2b86('0x18')](function(_0x5638d3){})[_0x2b86('0x3f')](function(_0x5a68dd){console[_0x2b86('0x40')](_0x5a68dd);});}function main(){return server[_0x2b86('0x41')](realtime,preview,fax)[_0x2b86('0x18')](function(_0x4f1e5a){return initRealtime();})[_0x2b86('0x18')](function(){return initParams();})['then'](function(){report[_0x2b86('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x220d8e){console[_0x2b86('0x40')](_0x220d8e);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index ca58ee0..9c115cc 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 _0x6296=['accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','statePause','format','onhold','stringify','user:%s','emit','user:save','util','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','email'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6296,0x66));var _0x6629=function(_0x30348a,_0x19a17d){_0x30348a=_0x30348a-0x0;var _0x2048d6=_0x6296[_0x30348a];return _0x2048d6;};'use strict';var _=require('lodash');var util=require(_0x6629('0x0'));var moment=require('moment');var md5=require(_0x6629('0x1'));var Redis=require(_0x6629('0x2'));var config=require(_0x6629('0x3'));config['redis']=_[_0x6629('0x4')](config[_0x6629('0x5')],{'host':_0x6629('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6629('0x5')]));function Agent(_0x53641d){this['id']=_0x53641d['id']||0x0;this[_0x6629('0x7')]=_0x53641d['name']||'';this[_0x6629('0x8')]=_0x53641d['email']||'';this[_0x6629('0x9')]=_0x53641d['accountcode']||'';this['fullname']=_0x53641d[_0x6629('0xa')]||'';this[_0x6629('0xb')]=_0x6629('0xc');this[_0x6629('0xd')]=0x0;this[_0x6629('0xe')]=_0x6629('0xc');this[_0x6629('0xf')]='';this[_0x6629('0x10')]='';this[_0x6629('0x11')]='';this[_0x6629('0x12')]='';this['online']=_0x53641d[_0x6629('0x13')]||![];this[_0x6629('0x14')]=_0x6629('0xc');this['voiceStatusTime']=0x0;this[_0x6629('0x15')]='';this[_0x6629('0x16')]='';this['onhold']=![];this[_0x6629('0x17')]=![];this[_0x6629('0x1')]='';}Agent[_0x6629('0x18')][_0x6629('0x19')]=function(_0x3c7b1b){var _0xc9c1d5;if(_0x3c7b1b&&_0x3c7b1b[_0x6629('0xb')]){_0xc9c1d5=_0x3c7b1b['state'][_0x6629('0x1a')]();switch(_0xc9c1d5){case'not_inuse':_0xc9c1d5=_0x6629('0x1b');break;case _0x6629('0x1c'):_0xc9c1d5=_0x6629('0x1d');break;}}if(_0xc9c1d5&&this[_0x6629('0x14')]!==_0xc9c1d5||_0x3c7b1b[_0x6629('0x1e')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x6629('0x1f')]('x'));}if(_0xc9c1d5){this['voiceStatus']=_0xc9c1d5;}var _0x45c4ea={'id':this['id'],'name':this[_0x6629('0x7')],'email':this[_0x6629('0x8')],'accountcode':this[_0x6629('0x9')],'fullname':this[_0x6629('0xa')],'state':this[_0x6629('0xb')],'stateTime':this[_0x6629('0xd')],'status':this['status'],'address':this[_0x6629('0xf')],'online':this[_0x6629('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6629('0x16')],'interface':this[_0x6629('0x12')],'onhold':this[_0x6629('0x20')]};var _0x540b93=md5(JSON[_0x6629('0x21')](_0x45c4ea));if(this['md5']!==_0x540b93){this[_0x6629('0x1')]=_0x540b93;io['to'](util[_0x6629('0x1f')](_0x6629('0x22'),_0x45c4ea[_0x6629('0x7')]))[_0x6629('0x23')](_0x6629('0x24'),_0x45c4ea);}};module['exports']=Agent; \ No newline at end of file +var _0xc182=['idle','talking','statePause','format','voiceStatusCallerIdNumber','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse'];(function(_0x179391,_0x4eb9b6){var _0x2f2208=function(_0x3b2211){while(--_0x3b2211){_0x179391['push'](_0x179391['shift']());}};_0x2f2208(++_0x4eb9b6);}(_0xc182,0x7e));var _0x2c18=function(_0x13f0cd,_0x56c55d){_0x13f0cd=_0x13f0cd-0x0;var _0x354f4e=_0xc182[_0x13f0cd];return _0x354f4e;};'use strict';var _=require(_0x2c18('0x0'));var util=require(_0x2c18('0x1'));var moment=require(_0x2c18('0x2'));var md5=require(_0x2c18('0x3'));var Redis=require(_0x2c18('0x4'));var config=require('../../../config/environment');config[_0x2c18('0x5')]=_['defaults'](config[_0x2c18('0x5')],{'host':_0x2c18('0x6'),'port':0x18eb});var io=require(_0x2c18('0x7'))(new Redis(config[_0x2c18('0x5')]));function Agent(_0x8abb8d){this['id']=_0x8abb8d['id']||0x0;this['name']=_0x8abb8d[_0x2c18('0x8')]||'';this[_0x2c18('0x9')]=_0x8abb8d[_0x2c18('0x9')]||'';this[_0x2c18('0xa')]=_0x8abb8d['accountcode']||'';this[_0x2c18('0xb')]=_0x8abb8d['fullname']||'';this[_0x2c18('0xc')]='unknown';this[_0x2c18('0xd')]=0x0;this[_0x2c18('0xe')]=_0x2c18('0xf');this[_0x2c18('0x10')]='';this[_0x2c18('0x11')]='';this[_0x2c18('0x12')]='';this[_0x2c18('0x13')]='';this[_0x2c18('0x14')]=_0x8abb8d[_0x2c18('0x14')]||![];this[_0x2c18('0x15')]=_0x2c18('0xf');this[_0x2c18('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x2c18('0x17')]='';this[_0x2c18('0x18')]=![];this[_0x2c18('0x19')]=![];this[_0x2c18('0x3')]='';}Agent[_0x2c18('0x1a')][_0x2c18('0x1b')]=function(_0x131b86){var _0x4f933c;if(_0x131b86&&_0x131b86[_0x2c18('0xc')]){_0x4f933c=_0x131b86[_0x2c18('0xc')][_0x2c18('0x1c')]();switch(_0x4f933c){case _0x2c18('0x1d'):_0x4f933c=_0x2c18('0x1e');break;case'inuse':_0x4f933c=_0x2c18('0x1f');break;}}if(_0x4f933c&&this[_0x2c18('0x15')]!==_0x4f933c||_0x131b86[_0x2c18('0x20')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x2c18('0x21')]('x'));}if(_0x4f933c){this['voiceStatus']=_0x4f933c;}var _0x1ffa8b={'id':this['id'],'name':this[_0x2c18('0x8')],'email':this[_0x2c18('0x9')],'accountcode':this[_0x2c18('0xa')],'fullname':this[_0x2c18('0xb')],'state':this[_0x2c18('0xc')],'stateTime':this[_0x2c18('0xd')],'status':this[_0x2c18('0xe')],'address':this[_0x2c18('0x10')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x2c18('0x16')],'voiceStatusCallerIdNumber':this[_0x2c18('0x22')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this['onhold']};var _0x38778f=md5(JSON['stringify'](_0x1ffa8b));if(this[_0x2c18('0x3')]!==_0x38778f){this['md5']=_0x38778f;io['to'](util[_0x2c18('0x21')](_0x2c18('0x23'),_0x1ffa8b[_0x2c18('0x8')]))[_0x2c18('0x24')](_0x2c18('0x25'),_0x1ffa8b);}};module[_0x2c18('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index df3b12d..00b2306 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 _0x125f=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x12ba3d,_0x5eae0d){var _0x178544=function(_0x9f0d46){while(--_0x9f0d46){_0x12ba3d['push'](_0x12ba3d['shift']());}};_0x178544(++_0x5eae0d);}(_0x125f,0x1e4));var _0xf125=function(_0x29db8a,_0x27424f){_0x29db8a=_0x29db8a-0x0;var _0x27ae25=_0x125f[_0x29db8a];return _0x27ae25;};'use strict';function Campaign(_0x39f1ac){this['id']=_0x39f1ac['id']||0x0;this['name']=_0x39f1ac['name']||'';this[_0xf125('0x0')]=_0x39f1ac['type']||'campaign';this[_0xf125('0x1')]=0x0;this[_0xf125('0x2')]=0x0;this[_0xf125('0x3')]=0x0;this[_0xf125('0x4')]=0x0;this[_0xf125('0x5')]='';this[_0xf125('0x6')]=!![];this['active']=_0x39f1ac[_0xf125('0x7')];this[_0xf125('0x8')]=_0x39f1ac[_0xf125('0x8')];this['dialTimezone']=_0x39f1ac[_0xf125('0x9')]||null;this[_0xf125('0xa')]=_0x39f1ac[_0xf125('0xa')]?_0x39f1ac[_0xf125('0xa')]:null;this[_0xf125('0xb')]=_0x39f1ac[_0xf125('0xb')];this[_0xf125('0xc')]=_0x39f1ac[_0xf125('0xc')];this[_0xf125('0xd')]=_0x39f1ac[_0xf125('0xd')]||0x1e;this[_0xf125('0xe')]=_0x39f1ac['dialCongestionMaxRetry'];this[_0xf125('0xf')]=_0x39f1ac[_0xf125('0xf')];this[_0xf125('0x10')]=_0x39f1ac[_0xf125('0x10')];this['dialBusyRetryFrequency']=_0x39f1ac[_0xf125('0x11')];this[_0xf125('0x12')]=_0x39f1ac[_0xf125('0x12')];this[_0xf125('0x13')]=_0x39f1ac[_0xf125('0x13')];this['dialGlobalMaxRetry']=_0x39f1ac['dialGlobalMaxRetry'];this[_0xf125('0x14')]=_0x39f1ac['dialNoSuchNumberMaxRetry']||0x3;this[_0xf125('0x15')]=_0x39f1ac[_0xf125('0x15')]||0x96;this[_0xf125('0x16')]=_0x39f1ac['dialDropMaxRetry']||0x3;this[_0xf125('0x17')]=_0x39f1ac[_0xf125('0x17')]||0x96;this[_0xf125('0x18')]=_0x39f1ac[_0xf125('0x18')]||0x3;this[_0xf125('0x19')]=_0x39f1ac[_0xf125('0x19')]||0x96;this[_0xf125('0x1a')]=_0x39f1ac[_0xf125('0x1a')]||0x3;this[_0xf125('0x1b')]=_0x39f1ac[_0xf125('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x39f1ac['dialAgentRejectMaxRetry']||0x3;this[_0xf125('0x1c')]=_0x39f1ac[_0xf125('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x39f1ac[_0xf125('0x1d')]||_0xf125('0x1e');this['dialPrefix']=_0x39f1ac[_0xf125('0x1f')]||undefined;this[_0xf125('0x20')]=_0x39f1ac['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf125('0x21')]=_0x39f1ac['dialCutDigit']||undefined;this[_0xf125('0x22')]=_0x39f1ac['TrunkBackup']?_0x39f1ac[_0xf125('0x22')]:undefined;this[_0xf125('0x23')]=_0x39f1ac[_0xf125('0x23')]?_0x39f1ac[_0xf125('0x23')]:undefined;this[_0xf125('0x24')]=_0x39f1ac[_0xf125('0x24')]?_0x39f1ac[_0xf125('0x24')]:undefined;this[_0xf125('0x25')]=_0x39f1ac['SquareProject']?_0x39f1ac[_0xf125('0x25')]:undefined;this[_0xf125('0x26')]=_0x39f1ac[_0xf125('0x25')]?_0x39f1ac[_0xf125('0x25')][_0xf125('0x27')]:undefined;this['dialAMDActive']=_0x39f1ac[_0xf125('0x28')]||![];this[_0xf125('0x29')]=_0x39f1ac[_0xf125('0x29')];this[_0xf125('0x2a')]=_0x39f1ac[_0xf125('0x2a')];this[_0xf125('0x2b')]=_0x39f1ac['dialAMDAfterGreetingSilence'];this[_0xf125('0x2c')]=_0x39f1ac[_0xf125('0x2c')];this[_0xf125('0x2d')]=_0x39f1ac['dialAMDMinWordLength'];this[_0xf125('0x2e')]=_0x39f1ac[_0xf125('0x2e')];this[_0xf125('0x2f')]=_0x39f1ac[_0xf125('0x2f')];this['dialAMDSilenceThreshold']=_0x39f1ac[_0xf125('0x30')];this[_0xf125('0x31')]=_0x39f1ac[_0xf125('0x31')];}module[_0xf125('0x32')]=Campaign; \ No newline at end of file +var _0x6868=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x3b6f58,_0x5870de){var _0x987c61=function(_0x3a9281){while(--_0x3a9281){_0x3b6f58['push'](_0x3b6f58['shift']());}};_0x987c61(++_0x5870de);}(_0x6868,0xdd));var _0x8686=function(_0x47a537,_0x3bf6a9){_0x47a537=_0x47a537-0x0;var _0x394fb1=_0x6868[_0x47a537];return _0x394fb1;};'use strict';function Campaign(_0x4f32cf){this['id']=_0x4f32cf['id']||0x0;this['name']=_0x4f32cf[_0x8686('0x0')]||'';this[_0x8686('0x1')]=_0x4f32cf['type']||_0x8686('0x2');this[_0x8686('0x3')]=0x0;this['temp']=0x0;this[_0x8686('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x8686('0x5')]='';this[_0x8686('0x6')]=!![];this[_0x8686('0x7')]=_0x4f32cf[_0x8686('0x7')];this[_0x8686('0x8')]=_0x4f32cf[_0x8686('0x8')];this[_0x8686('0x9')]=_0x4f32cf[_0x8686('0x9')]||null;this[_0x8686('0xa')]=_0x4f32cf[_0x8686('0xa')]?_0x4f32cf[_0x8686('0xa')]:null;this['dialOriginateCallerIdName']=_0x4f32cf['dialOriginateCallerIdName'];this[_0x8686('0xb')]=_0x4f32cf['dialOriginateCallerIdNumber'];this[_0x8686('0xc')]=_0x4f32cf[_0x8686('0xc')]||0x1e;this[_0x8686('0xd')]=_0x4f32cf[_0x8686('0xd')];this[_0x8686('0xe')]=_0x4f32cf[_0x8686('0xe')];this[_0x8686('0xf')]=_0x4f32cf['dialBusyMaxRetry'];this[_0x8686('0x10')]=_0x4f32cf[_0x8686('0x10')];this[_0x8686('0x11')]=_0x4f32cf[_0x8686('0x11')];this['dialNoAnswerRetryFrequency']=_0x4f32cf[_0x8686('0x12')];this['dialGlobalMaxRetry']=_0x4f32cf[_0x8686('0x13')];this['dialNoSuchNumberMaxRetry']=_0x4f32cf[_0x8686('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4f32cf['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4f32cf[_0x8686('0x15')]||0x3;this[_0x8686('0x16')]=_0x4f32cf[_0x8686('0x16')]||0x96;this[_0x8686('0x17')]=_0x4f32cf[_0x8686('0x17')]||0x3;this[_0x8686('0x18')]=_0x4f32cf[_0x8686('0x18')]||0x96;this['dialMachineMaxRetry']=_0x4f32cf['dialMachineMaxRetry']||0x3;this[_0x8686('0x19')]=_0x4f32cf[_0x8686('0x19')]||0x96;this[_0x8686('0x1a')]=_0x4f32cf[_0x8686('0x1a')]||0x3;this[_0x8686('0x1b')]=_0x4f32cf[_0x8686('0x1b')]||0x96;this[_0x8686('0x1c')]=_0x4f32cf[_0x8686('0x1c')]||'DESC';this[_0x8686('0x1d')]=_0x4f32cf['dialPrefix']||undefined;this[_0x8686('0x1e')]=_0x4f32cf[_0x8686('0x1e')]||undefined;this[_0x8686('0x1f')]=_0x4f32cf[_0x8686('0x1f')]||undefined;this[_0x8686('0x20')]=_0x4f32cf['TrunkBackup']?_0x4f32cf['TrunkBackup']:undefined;this['Trunk']=_0x4f32cf[_0x8686('0x21')]?_0x4f32cf[_0x8686('0x21')]:undefined;this[_0x8686('0x22')]=_0x4f32cf['Interval']?_0x4f32cf[_0x8686('0x22')]:undefined;this[_0x8686('0x23')]=_0x4f32cf['SquareProject']?_0x4f32cf[_0x8686('0x23')]:undefined;this[_0x8686('0x24')]=_0x4f32cf[_0x8686('0x23')]?_0x4f32cf[_0x8686('0x23')][_0x8686('0x0')]:undefined;this[_0x8686('0x25')]=_0x4f32cf['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x4f32cf[_0x8686('0x26')];this[_0x8686('0x27')]=_0x4f32cf[_0x8686('0x27')];this[_0x8686('0x28')]=_0x4f32cf[_0x8686('0x28')];this[_0x8686('0x29')]=_0x4f32cf['dialAMDTotalAnalysisTime'];this[_0x8686('0x2a')]=_0x4f32cf['dialAMDMinWordLength'];this[_0x8686('0x2b')]=_0x4f32cf['dialAMDBetweenWordsSilence'];this[_0x8686('0x2c')]=_0x4f32cf[_0x8686('0x2c')];this[_0x8686('0x2d')]=_0x4f32cf[_0x8686('0x2d')];this[_0x8686('0x2e')]=_0x4f32cf['dialAMDMaximumWordLength'];}module[_0x8686('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index ad3cb4b..4df1225 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 _0x1324=['accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','lastapplication','duration','billableseconds','type','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x3ebef3,_0x440b62){var _0x25ef01=function(_0x550009){while(--_0x550009){_0x3ebef3['push'](_0x3ebef3['shift']());}};_0x25ef01(++_0x440b62);}(_0x1324,0x1c3));var _0x4132=function(_0x469b9f,_0xb7f2af){_0x469b9f=_0x469b9f-0x0;var _0x374be9=_0x1324[_0x469b9f];return _0x374be9;};'use strict';function Channel(){this[_0x4132('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x4132('0x1')]=0x0;this[_0x4132('0x2')]='';this[_0x4132('0x3')]=undefined;this[_0x4132('0x4')]=undefined;this[_0x4132('0x5')]=0x0;this['context']='';this[_0x4132('0x6')]=0x0;this[_0x4132('0x7')]=0x0;this[_0x4132('0x8')]=0x0;this[_0x4132('0x9')]=![];this[_0x4132('0xa')]=null;this[_0x4132('0xb')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x4132('0xc')]='';this['lastdata']='';this[_0x4132('0xd')]=0x0;this[_0x4132('0xe')]=0x0;this['holdtime']=0x0;this[_0x4132('0xf')]=null;this['tag']=null;this[_0x4132('0x10')]=null;this[_0x4132('0x11')]=![];this['monitorFilename']=null;this[_0x4132('0x12')]=null;this[_0x4132('0x13')]=[];this[_0x4132('0x14')]=undefined;this[_0x4132('0x15')]=undefined;this[_0x4132('0x16')]=0x0;}module[_0x4132('0x17')]=Channel; \ No newline at end of file +var _0x4325=['answertime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','tag','monitor','monitorFilename','queue','monitors','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','context','uniqueid','linkedid','answered'];(function(_0x23db26,_0x5083b0){var _0x7d47a9=function(_0x443e16){while(--_0x443e16){_0x23db26['push'](_0x23db26['shift']());}};_0x7d47a9(++_0x5083b0);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';function Channel(){this[_0x5432('0x0')]=null;this[_0x5432('0x1')]='';this['destinationchannel']='';this[_0x5432('0x2')]=0x0;this[_0x5432('0x3')]='';this[_0x5432('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x5432('0x5')]='';this[_0x5432('0x6')]=0x0;this[_0x5432('0x7')]=0x0;this['exten']=0x0;this[_0x5432('0x8')]=![];this[_0x5432('0x9')]=null;this['endtime']=null;this[_0x5432('0xa')]=![];this['abandoned']=![];this[_0x5432('0xb')]='';this[_0x5432('0xc')]='';this[_0x5432('0xd')]=0x0;this[_0x5432('0xe')]=0x0;this[_0x5432('0xf')]=0x0;this['type']=null;this[_0x5432('0x10')]=null;this['disposition']=null;this[_0x5432('0x11')]=![];this[_0x5432('0x12')]=null;this[_0x5432('0x13')]=null;this[_0x5432('0x14')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x5432('0x15')]=0x0;}module[_0x5432('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ea24780..6d2ebff 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 _0xa74a=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x5bcfc7,_0x297acb){var _0x4f021c=function(_0x5e07f2){while(--_0x5e07f2){_0x5bcfc7['push'](_0x5bcfc7['shift']());}};_0x4f021c(++_0x297acb);}(_0xa74a,0x66));var _0xaa74=function(_0x519a1f,_0x1edf9d){_0x519a1f=_0x519a1f-0x0;var _0x57fd70=_0xa74a[_0x519a1f];return _0x57fd70;};'use strict';function DeskAccount(_0x3b26e9){this['id']=_0x3b26e9['id']||0x0;this[_0xaa74('0x0')]=_0x3b26e9[_0xaa74('0x0')]||'';this[_0xaa74('0x1')]=_0x3b26e9[_0xaa74('0x1')]||'';this[_0xaa74('0x2')]=_0x3b26e9['remoteUri']||'';this[_0xaa74('0x3')]=_0x3b26e9[_0xaa74('0x3')]||'';this[_0xaa74('0x4')]=_0x3b26e9['password']||'';this['consumerKey']=_0x3b26e9[_0xaa74('0x5')]||'';this[_0xaa74('0x6')]=_0x3b26e9[_0xaa74('0x6')]||'';this[_0xaa74('0x7')]=_0x3b26e9[_0xaa74('0x7')]||'';this['tokenSecret']=_0x3b26e9[_0xaa74('0x8')]||'';this['type']=_0x3b26e9[_0xaa74('0x9')]||'';this['serverUrl']=_0x3b26e9[_0xaa74('0xa')]||'';this[_0xaa74('0xb')]=_0x3b26e9['Configurations']||{};}module[_0xaa74('0xc')]=DeskAccount; \ No newline at end of file +var _0x03db=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x4bd11d,_0xee69b8){var _0x328238=function(_0x42bec7){while(--_0x42bec7){_0x4bd11d['push'](_0x4bd11d['shift']());}};_0x328238(++_0xee69b8);}(_0x03db,0x156));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';function DeskAccount(_0x956be5){this['id']=_0x956be5['id']||0x0;this[_0xb03d('0x0')]=_0x956be5[_0xb03d('0x0')]||'';this[_0xb03d('0x1')]=_0x956be5['username']||'';this[_0xb03d('0x2')]=_0x956be5[_0xb03d('0x2')]||'';this[_0xb03d('0x3')]=_0x956be5[_0xb03d('0x3')]||'';this[_0xb03d('0x4')]=_0x956be5['password']||'';this[_0xb03d('0x5')]=_0x956be5[_0xb03d('0x5')]||'';this[_0xb03d('0x6')]=_0x956be5['consumerSecret']||'';this[_0xb03d('0x7')]=_0x956be5['token']||'';this[_0xb03d('0x8')]=_0x956be5[_0xb03d('0x8')]||'';this[_0xb03d('0x9')]=_0x956be5[_0xb03d('0x9')]||'';this[_0xb03d('0xa')]=_0x956be5[_0xb03d('0xa')]||'';this[_0xb03d('0xb')]=_0x956be5['Configurations']||{};}module[_0xb03d('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 9e1469e..3e8a461 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 _0x5562=['serverUrl','exports','name','username','password','remoteUri','clientId','clientSecret'];(function(_0x1c2431,_0x2ea33c){var _0x2e3326=function(_0x2e5bf0){while(--_0x2e5bf0){_0x1c2431['push'](_0x1c2431['shift']());}};_0x2e3326(++_0x2ea33c);}(_0x5562,0xda));var _0x2556=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x5562[_0x574617];return _0x29de90;};'use strict';function Dynamics365Account(_0x2d7afe){this['id']=_0x2d7afe['id']||0x0;this[_0x2556('0x0')]=_0x2d7afe[_0x2556('0x0')]||'';this[_0x2556('0x1')]=_0x2d7afe[_0x2556('0x1')]||'';this['password']=_0x2d7afe[_0x2556('0x2')]||'';this[_0x2556('0x3')]=_0x2d7afe[_0x2556('0x3')]||'';this['tenantId']=_0x2d7afe['tenantId']||'';this[_0x2556('0x4')]=_0x2d7afe[_0x2556('0x4')]||'';this[_0x2556('0x5')]=_0x2d7afe[_0x2556('0x5')]||{};this[_0x2556('0x6')]=_0x2d7afe[_0x2556('0x6')]||'';this['Configurations']=_0x2d7afe['Configurations']||{};}module[_0x2556('0x7')]=Dynamics365Account; \ No newline at end of file +var _0xeb63=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0xce37a1,_0x5c3a7a){var _0x69649d=function(_0x3c2aa9){while(--_0x3c2aa9){_0xce37a1['push'](_0xce37a1['shift']());}};_0x69649d(++_0x5c3a7a);}(_0xeb63,0x105));var _0x3eb6=function(_0x4e630a,_0x3c006b){_0x4e630a=_0x4e630a-0x0;var _0x2cc905=_0xeb63[_0x4e630a];return _0x2cc905;};'use strict';function Dynamics365Account(_0x4fe67b){this['id']=_0x4fe67b['id']||0x0;this[_0x3eb6('0x0')]=_0x4fe67b['name']||'';this[_0x3eb6('0x1')]=_0x4fe67b[_0x3eb6('0x1')]||'';this['password']=_0x4fe67b[_0x3eb6('0x2')]||'';this['remoteUri']=_0x4fe67b[_0x3eb6('0x3')]||'';this[_0x3eb6('0x4')]=_0x4fe67b[_0x3eb6('0x4')]||'';this[_0x3eb6('0x5')]=_0x4fe67b['clientId']||'';this[_0x3eb6('0x6')]=_0x4fe67b[_0x3eb6('0x6')]||{};this[_0x3eb6('0x7')]=_0x4fe67b[_0x3eb6('0x7')]||'';this[_0x3eb6('0x8')]=_0x4fe67b[_0x3eb6('0x8')]||{};}module[_0x3eb6('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 01230d6..a50587c 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 _0xa168=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','description'];(function(_0x146f94,_0x49852f){var _0x361d7c=function(_0x5884c7){while(--_0x5884c7){_0x146f94['push'](_0x146f94['shift']());}};_0x361d7c(++_0x49852f);}(_0xa168,0x95));var _0x8a16=function(_0x506a86,_0x41e1c9){_0x506a86=_0x506a86-0x0;var _0x5e1960=_0xa168[_0x506a86];return _0x5e1960;};'use strict';function FaxAccount(_0x4684e2){this['id']=_0x4684e2['id']||0x0;this['name']=_0x4684e2['name']||'';this[_0x8a16('0x0')]=_0x4684e2[_0x8a16('0x0')];this['ecm']=_0x4684e2['ecm'];this[_0x8a16('0x1')]=_0x4684e2[_0x8a16('0x1')];this[_0x8a16('0x2')]=_0x4684e2['localstationid'];this['minrate']=_0x4684e2[_0x8a16('0x3')]||0x960;this[_0x8a16('0x4')]=_0x4684e2['maxrate']||0x3840;this[_0x8a16('0x5')]=_0x4684e2[_0x8a16('0x5')]||_0x8a16('0x6');this[_0x8a16('0x7')]=_0x4684e2[_0x8a16('0x7')]||'no';this[_0x8a16('0x8')]=_0x4684e2['faxdetect']||'no';this[_0x8a16('0x9')]=_0x4684e2['t38timeout']||0x1388;this['tech']=_0x4684e2['tech']||_0x8a16('0xa');this[_0x8a16('0xb')]=_0x4684e2[_0x8a16('0xb')]?_0x4684e2[_0x8a16('0xb')]:undefined;this[_0x8a16('0xc')]=_0x4684e2['ListId'];this[_0x8a16('0xd')]=_0x4684e2[_0x8a16('0xd')];}module[_0x8a16('0xe')]=FaxAccount; \ No newline at end of file +var _0x996f=['ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description'];(function(_0x47b4d6,_0x28a641){var _0x76e8b0=function(_0x4a17b6){while(--_0x4a17b6){_0x47b4d6['push'](_0x47b4d6['shift']());}};_0x76e8b0(++_0x28a641);}(_0x996f,0x97));var _0xf996=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x996f[_0x4d8ed9];return _0x1e2140;};'use strict';function FaxAccount(_0x375a85){this['id']=_0x375a85['id']||0x0;this[_0xf996('0x0')]=_0x375a85[_0xf996('0x0')]||'';this['description']=_0x375a85[_0xf996('0x1')];this[_0xf996('0x2')]=_0x375a85[_0xf996('0x2')];this['headerinfo']=_0x375a85['headerinfo'];this[_0xf996('0x3')]=_0x375a85['localstationid'];this[_0xf996('0x4')]=_0x375a85[_0xf996('0x4')]||0x960;this[_0xf996('0x5')]=_0x375a85['maxrate']||0x3840;this[_0xf996('0x6')]=_0x375a85['modem']||_0xf996('0x7');this[_0xf996('0x8')]=_0x375a85[_0xf996('0x8')]||'no';this[_0xf996('0x9')]=_0x375a85[_0xf996('0x9')]||'no';this[_0xf996('0xa')]=_0x375a85[_0xf996('0xa')]||0x1388;this[_0xf996('0xb')]=_0x375a85[_0xf996('0xb')]||_0xf996('0xc');this[_0xf996('0xd')]=_0x375a85[_0xf996('0xd')]?_0x375a85[_0xf996('0xd')]:undefined;this[_0xf996('0xe')]=_0x375a85[_0xf996('0xe')];this[_0xf996('0xf')]=_0x375a85[_0xf996('0xf')];}module[_0xf996('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 1e1f108..2b71b51 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 _0x6bec=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x230036,_0x47d9a1){var _0x35d7ab=function(_0x165a0a){while(--_0x165a0a){_0x230036['push'](_0x230036['shift']());}};_0x35d7ab(++_0x47d9a1);}(_0x6bec,0x124));var _0xc6be=function(_0x17363b,_0x1c31e0){_0x17363b=_0x17363b-0x0;var _0x4498ee=_0x6bec[_0x17363b];return _0x4498ee;};'use strict';function FreshdeskAccount(_0x4674d7){this['id']=_0x4674d7['id']||0x0;this[_0xc6be('0x0')]=_0x4674d7[_0xc6be('0x0')]||'';this[_0xc6be('0x1')]=_0x4674d7[_0xc6be('0x1')]||'';this[_0xc6be('0x2')]=_0x4674d7[_0xc6be('0x3')]||'';this[_0xc6be('0x4')]=_0x4674d7[_0xc6be('0x4')]||'';this[_0xc6be('0x5')]=_0x4674d7[_0xc6be('0x5')]||'';this[_0xc6be('0x6')]=_0x4674d7[_0xc6be('0x6')]||{};}module[_0xc6be('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x26a4=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x26a4,0x74));var _0x426a=function(_0x250638,_0xd1cfe){_0x250638=_0x250638-0x0;var _0x99b713=_0x26a4[_0x250638];return _0x99b713;};'use strict';function FreshdeskAccount(_0x207091){this['id']=_0x207091['id']||0x0;this[_0x426a('0x0')]=_0x207091[_0x426a('0x0')]||'';this[_0x426a('0x1')]=_0x207091[_0x426a('0x1')]||'';this[_0x426a('0x2')]=_0x207091[_0x426a('0x3')]||'';this['remoteUri']=_0x207091[_0x426a('0x4')]||'';this[_0x426a('0x5')]=_0x207091[_0x426a('0x5')]||'';this[_0x426a('0x6')]=_0x207091['Configurations']||{};}module[_0x426a('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 05e7e57..e0d8223 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 _0x569f=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2a63fb,_0x55cdd7){var _0x4d1695=function(_0x2e7b1a){while(--_0x2e7b1a){_0x2a63fb['push'](_0x2a63fb['shift']());}};_0x4d1695(++_0x55cdd7);}(_0x569f,0xef));var _0xf569=function(_0x3f47dc,_0x450bae){_0x3f47dc=_0x3f47dc-0x0;var _0x291362=_0x569f[_0x3f47dc];return _0x291362;};'use strict';function FreshsalesAccount(_0x4ebc6a){this['id']=_0x4ebc6a['id']||0x0;this[_0xf569('0x0')]=_0x4ebc6a[_0xf569('0x0')]||'';this[_0xf569('0x1')]=_0x4ebc6a[_0xf569('0x1')]||'';this[_0xf569('0x2')]=_0x4ebc6a[_0xf569('0x3')]||'';this[_0xf569('0x4')]=_0x4ebc6a[_0xf569('0x4')]||'';this['serverUrl']=_0x4ebc6a[_0xf569('0x5')]||'';this[_0xf569('0x6')]=_0x4ebc6a[_0xf569('0x6')]||{};}module[_0xf569('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x83e4=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x456cbb,_0x547275){var _0x9c3a70=function(_0x1c8686){while(--_0x1c8686){_0x456cbb['push'](_0x456cbb['shift']());}};_0x9c3a70(++_0x547275);}(_0x83e4,0x137));var _0x483e=function(_0x51ad6f,_0x1e64b6){_0x51ad6f=_0x51ad6f-0x0;var _0x273ff8=_0x83e4[_0x51ad6f];return _0x273ff8;};'use strict';function FreshsalesAccount(_0x167a82){this['id']=_0x167a82['id']||0x0;this[_0x483e('0x0')]=_0x167a82['name']||'';this[_0x483e('0x1')]=_0x167a82[_0x483e('0x1')]||'';this[_0x483e('0x2')]=_0x167a82[_0x483e('0x3')]||'';this[_0x483e('0x4')]=_0x167a82['remoteUri']||'';this[_0x483e('0x5')]=_0x167a82[_0x483e('0x5')]||'';this['Configurations']=_0x167a82[_0x483e('0x6')]||{};}module[_0x483e('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 d8d103e..aea2a39 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 _0x5c1e=['queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','mohtime','exports','type','inbound','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x2f0d56,_0xb3ae26){var _0x4d593f=function(_0x1271ee){while(--_0x1271ee){_0x2f0d56['push'](_0x2f0d56['shift']());}};_0x4d593f(++_0xb3ae26);}(_0x5c1e,0x121));var _0xe5c1=function(_0x66d927,_0xbf9de5){_0x66d927=_0x66d927-0x0;var _0x5e0221=_0x5c1e[_0x66d927];return _0x5e0221;};'use strict';function QueueReport(){this[_0xe5c1('0x0')]=_0xe5c1('0x1');this['uniqueid']='';this[_0xe5c1('0x2')]='';this[_0xe5c1('0x3')]='';this[_0xe5c1('0x4')]='';this['queuecallerjoinAt']=null;this[_0xe5c1('0x5')]=null;this[_0xe5c1('0x6')]=0x1;this[_0xe5c1('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xe5c1('0x8')]=null;this[_0xe5c1('0x9')]=![];this[_0xe5c1('0xa')]=null;this[_0xe5c1('0xb')]=![];this[_0xe5c1('0xc')]=null;this[_0xe5c1('0xd')]=0x1;this[_0xe5c1('0xe')]='';this[_0xe5c1('0xf')]='';this[_0xe5c1('0x10')]='';this[_0xe5c1('0x11')]='';this[_0xe5c1('0x12')]='';this[_0xe5c1('0x13')]='';this[_0xe5c1('0x14')]='';this['holdtime']=0x0;this[_0xe5c1('0x15')]=![];this[_0xe5c1('0x16')]='';this[_0xe5c1('0x17')]=0x0;this['variables']={};}module[_0xe5c1('0x18')]=QueueReport; \ No newline at end of file +var _0x775e=['priority','holdtime','assigned','variables','exports','type','inbound','uniqueid','calleridnum','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallercomplete','queuecallercompleteAt','connectedlinenum','connectedlinename','accountcode','context','exten'];(function(_0x54ce4a,_0x502cba){var _0x279dce=function(_0x217ed8){while(--_0x217ed8){_0x54ce4a['push'](_0x54ce4a['shift']());}};_0x279dce(++_0x502cba);}(_0x775e,0x181));var _0xe775=function(_0x14958d,_0x3d070e){_0x14958d=_0x14958d-0x0;var _0x437911=_0x775e[_0x14958d];return _0x437911;};'use strict';function QueueReport(){this[_0xe775('0x0')]=_0xe775('0x1');this[_0xe775('0x2')]='';this[_0xe775('0x3')]='';this['calleridname']='';this['queue']='';this[_0xe775('0x4')]=null;this[_0xe775('0x5')]=null;this[_0xe775('0x6')]=0x1;this[_0xe775('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xe775('0x8')]=![];this[_0xe775('0x9')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0xe775('0xa')]='';this[_0xe775('0xb')]='';this[_0xe775('0xc')]='';this[_0xe775('0xd')]='';this[_0xe775('0xe')]='';this[_0xe775('0xf')]='';this[_0xe775('0x10')]=0x0;this[_0xe775('0x11')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0xe775('0x12')]={};}module[_0xe775('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 637cef7..b6d844a 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 _0xef61=['exports','name','remoteUri','password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x559da0,_0x371559){var _0x284239=function(_0xee9b8c){while(--_0xee9b8c){_0x559da0['push'](_0x559da0['shift']());}};_0x284239(++_0x371559);}(_0xef61,0x1a5));var _0x1ef6=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0xef61[_0x413aac];return _0x569b11;};'use strict';function SalesforceAccount(_0x3caa05){this['id']=_0x3caa05['id']||0x0;this['name']=_0x3caa05[_0x1ef6('0x0')]||'';this['username']=_0x3caa05['username']||'';this['remoteUri']=_0x3caa05[_0x1ef6('0x1')]||'';this[_0x1ef6('0x2')]=_0x3caa05[_0x1ef6('0x2')]||'';this['clientId']=_0x3caa05['clientId']||'';this['clientSecret']=_0x3caa05[_0x1ef6('0x3')]||'';this[_0x1ef6('0x4')]=_0x3caa05[_0x1ef6('0x4')]||'';this[_0x1ef6('0x5')]=_0x3caa05[_0x1ef6('0x5')]||_0x1ef6('0x6');this[_0x1ef6('0x7')]=_0x3caa05['serverUrl']||'';this[_0x1ef6('0x8')]=_0x3caa05['Configurations']||{};}module[_0x1ef6('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xf63e=['integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientSecret','securityToken','type'];(function(_0x2d987c,_0x584b28){var _0x1bb7ae=function(_0x4b1637){while(--_0x4b1637){_0x2d987c['push'](_0x2d987c['shift']());}};_0x1bb7ae(++_0x584b28);}(_0xf63e,0xa3));var _0xef63=function(_0x376c8b,_0xc2e49a){_0x376c8b=_0x376c8b-0x0;var _0x5e81f1=_0xf63e[_0x376c8b];return _0x5e81f1;};'use strict';function SalesforceAccount(_0x49ce17){this['id']=_0x49ce17['id']||0x0;this[_0xef63('0x0')]=_0x49ce17['name']||'';this['username']=_0x49ce17[_0xef63('0x1')]||'';this[_0xef63('0x2')]=_0x49ce17[_0xef63('0x2')]||'';this['password']=_0x49ce17[_0xef63('0x3')]||'';this['clientId']=_0x49ce17['clientId']||'';this['clientSecret']=_0x49ce17[_0xef63('0x4')]||'';this['securityToken']=_0x49ce17[_0xef63('0x5')]||'';this[_0xef63('0x6')]=_0x49ce17['type']||_0xef63('0x7');this['serverUrl']=_0x49ce17[_0xef63('0x8')]||'';this[_0xef63('0x9')]=_0x49ce17[_0xef63('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 433bff0..5ff4b4e 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 _0xd093=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x258391,_0x54b4d3){var _0x15f268=function(_0x192b3f){while(--_0x192b3f){_0x258391['push'](_0x258391['shift']());}};_0x15f268(++_0x54b4d3);}(_0xd093,0x10a));var _0x3d09=function(_0x23963f,_0x2211ea){_0x23963f=_0x23963f-0x0;var _0x2d4eec=_0xd093[_0x23963f];return _0x2d4eec;};'use strict';function ServicenowAccount(_0x2962b9){this['id']=_0x2962b9['id']||0x0;this['name']=_0x2962b9[_0x3d09('0x0')]||'';this[_0x3d09('0x1')]=_0x2962b9['username']||'';this[_0x3d09('0x2')]=_0x2962b9['password']||'';this[_0x3d09('0x3')]=_0x2962b9[_0x3d09('0x3')]||'';this['serverUrl']=_0x2962b9[_0x3d09('0x4')]||'';this[_0x3d09('0x5')]=_0x2962b9[_0x3d09('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x0ab8=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x1be833,_0x1a9d40){var _0x19dfda=function(_0x2c9396){while(--_0x2c9396){_0x1be833['push'](_0x1be833['shift']());}};_0x19dfda(++_0x1a9d40);}(_0x0ab8,0x1df));var _0x80ab=function(_0x4972ed,_0x29d03e){_0x4972ed=_0x4972ed-0x0;var _0x31c973=_0x0ab8[_0x4972ed];return _0x31c973;};'use strict';function ServicenowAccount(_0x2f7564){this['id']=_0x2f7564['id']||0x0;this['name']=_0x2f7564[_0x80ab('0x0')]||'';this[_0x80ab('0x1')]=_0x2f7564[_0x80ab('0x1')]||'';this['password']=_0x2f7564[_0x80ab('0x2')]||'';this[_0x80ab('0x3')]=_0x2f7564[_0x80ab('0x3')]||'';this[_0x80ab('0x4')]=_0x2f7564['serverUrl']||'';this[_0x80ab('0x5')]=_0x2f7564[_0x80ab('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 6985d73..1002e84 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 _0xbabc=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x44784c,_0x4498c1){var _0x4bbfb1=function(_0x5d5ef7){while(--_0x5d5ef7){_0x44784c['push'](_0x44784c['shift']());}};_0x4bbfb1(++_0x4498c1);}(_0xbabc,0x77));var _0xcbab=function(_0x548c4a,_0x478311){_0x548c4a=_0x548c4a-0x0;var _0x56c7a6=_0xbabc[_0x548c4a];return _0x56c7a6;};'use strict';function SugarcrmAccount(_0x5da28f){this['id']=_0x5da28f['id']||0x0;this[_0xcbab('0x0')]=_0x5da28f[_0xcbab('0x0')]||'';this[_0xcbab('0x1')]=_0x5da28f['username']||'';this['password']=_0x5da28f[_0xcbab('0x2')]||'';this[_0xcbab('0x3')]=_0x5da28f[_0xcbab('0x3')]||'';this['serverUrl']=_0x5da28f[_0xcbab('0x4')]||'';this['Configurations']=_0x5da28f[_0xcbab('0x5')]||{};}module[_0xcbab('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xb5d1=['Configurations','name','username','remoteUri','serverUrl'];(function(_0xa21e0,_0x16728f){var _0x37a584=function(_0x42610a){while(--_0x42610a){_0xa21e0['push'](_0xa21e0['shift']());}};_0x37a584(++_0x16728f);}(_0xb5d1,0x10a));var _0x1b5d=function(_0x3e0558,_0x4818a4){_0x3e0558=_0x3e0558-0x0;var _0xfa1387=_0xb5d1[_0x3e0558];return _0xfa1387;};'use strict';function SugarcrmAccount(_0x3207a1){this['id']=_0x3207a1['id']||0x0;this[_0x1b5d('0x0')]=_0x3207a1[_0x1b5d('0x0')]||'';this[_0x1b5d('0x1')]=_0x3207a1[_0x1b5d('0x1')]||'';this['password']=_0x3207a1['password']||'';this[_0x1b5d('0x2')]=_0x3207a1['remoteUri']||'';this['serverUrl']=_0x3207a1[_0x1b5d('0x3')]||'';this[_0x1b5d('0x4')]=_0x3207a1[_0x1b5d('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 58cb00d..ce7fc70 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 _0x33cc=['unknown','stateTime','address','exports','accountcode'];(function(_0x5fb8ea,_0x45ce2e){var _0xa2bab8=function(_0x3e9073){while(--_0x3e9073){_0x5fb8ea['push'](_0x5fb8ea['shift']());}};_0xa2bab8(++_0x45ce2e);}(_0x33cc,0xe5));var _0xc33c=function(_0x59d0ab,_0x62cd0d){_0x59d0ab=_0x59d0ab-0x0;var _0x2d5ea3=_0x33cc[_0x59d0ab];return _0x2d5ea3;};'use strict';function Telephone(_0x4f96bc){this['id']=_0x4f96bc['id']||0x0;this['name']=_0x4f96bc['name']||'';this[_0xc33c('0x0')]=_0x4f96bc[_0xc33c('0x0')]||'';this['state']=_0xc33c('0x1');this[_0xc33c('0x2')]=0x0;this['status']='unknown';this[_0xc33c('0x3')]='';}module[_0xc33c('0x4')]=Telephone; \ No newline at end of file +var _0xad19=['name','accountcode','state','stateTime','unknown','address'];(function(_0x48aba0,_0x42eda9){var _0x25546a=function(_0x4ae745){while(--_0x4ae745){_0x48aba0['push'](_0x48aba0['shift']());}};_0x25546a(++_0x42eda9);}(_0xad19,0x66));var _0x9ad1=function(_0x179c9a,_0x36cac5){_0x179c9a=_0x179c9a-0x0;var _0x2f2f4a=_0xad19[_0x179c9a];return _0x2f2f4a;};'use strict';function Telephone(_0x44ef5d){this['id']=_0x44ef5d['id']||0x0;this[_0x9ad1('0x0')]=_0x44ef5d[_0x9ad1('0x0')]||'';this[_0x9ad1('0x1')]=_0x44ef5d[_0x9ad1('0x1')]||'';this[_0x9ad1('0x2')]='unknown';this[_0x9ad1('0x3')]=0x0;this['status']=_0x9ad1('0x4');this[_0x9ad1('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 10da42c..11bc48f 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 _0x64f0=['html','exports'];(function(_0x59a719,_0x111c04){var _0x37bf5a=function(_0x12789e){while(--_0x12789e){_0x59a719['push'](_0x59a719['shift']());}};_0x37bf5a(++_0x111c04);}(_0x64f0,0x1a0));var _0x064f=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x64f0[_0x5dc03e];return _0x466a07;};'use strict';function template(_0x1c3016){this['id']=_0x1c3016['id']||0x0;this['name']=_0x1c3016['name']||'';this[_0x064f('0x0')]=_0x1c3016[_0x064f('0x0')]||'';}module[_0x064f('0x1')]=template; \ No newline at end of file +var _0x30ff=['name','html','exports'];(function(_0x5ccbbb,_0x3067c9){var _0x5732b2=function(_0x25d6ae){while(--_0x25d6ae){_0x5ccbbb['push'](_0x5ccbbb['shift']());}};_0x5732b2(++_0x3067c9);}(_0x30ff,0x13e));var _0xf30f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x30ff[_0x502c7d];return _0x30b7ed;};'use strict';function template(_0x310e86){this['id']=_0x310e86['id']||0x0;this[_0xf30f('0x0')]=_0x310e86[_0xf30f('0x0')]||'';this[_0xf30f('0x1')]=_0x310e86['html']||'';}module[_0xf30f('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 5750743..8461759 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 _0x55ca=['name','voice','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x55ca,0x126));var _0xa55c=function(_0x426de2,_0x24acaf){_0x426de2=_0x426de2-0x0;var _0x1dbafc=_0x55ca[_0x426de2];return _0x1dbafc;};'use strict';function Trigger(_0x53d0d7){this['id']=_0x53d0d7['id']||0x0;this[_0xa55c('0x0')]=_0x53d0d7['name']||'';this['channel']=_0x53d0d7['channel']||_0xa55c('0x1');this[_0xa55c('0x2')]=_0x53d0d7['status']||![];this[_0xa55c('0x3')]=_0x53d0d7[_0xa55c('0x3')]||[];this[_0xa55c('0x4')]=_0x53d0d7[_0xa55c('0x4')]||[];this[_0xa55c('0x5')]=_0x53d0d7[_0xa55c('0x5')]||[];}module[_0xa55c('0x6')]=Trigger; \ No newline at end of file +var _0x9bde=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0xbea429,_0x3bc7b1){var _0x5b355a=function(_0x59c73d){while(--_0x59c73d){_0xbea429['push'](_0xbea429['shift']());}};_0x5b355a(++_0x3bc7b1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x25fb8e,_0x5c2e60){_0x25fb8e=_0x25fb8e-0x0;var _0x110b46=_0x9bde[_0x25fb8e];return _0x110b46;};'use strict';function Trigger(_0x284147){this['id']=_0x284147['id']||0x0;this[_0xe9bd('0x0')]=_0x284147['name']||'';this[_0xe9bd('0x1')]=_0x284147['channel']||_0xe9bd('0x2');this[_0xe9bd('0x3')]=_0x284147[_0xe9bd('0x3')]||![];this[_0xe9bd('0x4')]=_0x284147[_0xe9bd('0x4')]||[];this[_0xe9bd('0x5')]=_0x284147[_0xe9bd('0x5')]||[];this['Actions']=_0x284147[_0xe9bd('0x6')]||[];}module[_0xe9bd('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 0013e4d..4c2f1a6 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 _0x20da=['indexOf','split','host','domainport','stateRegistry','registrationtime','address','active','name','state','status','unknown','registry'];(function(_0x20b6a8,_0x3a6c49){var _0x28bc66=function(_0x5505bb){while(--_0x5505bb){_0x20b6a8['push'](_0x20b6a8['shift']());}};_0x28bc66(++_0x3a6c49);}(_0x20da,0x7c));var _0xa20d=function(_0x7c5d44,_0x2cfe6b){_0x7c5d44=_0x7c5d44-0x0;var _0x4f0ec3=_0x20da[_0x7c5d44];return _0x4f0ec3;};'use strict';function Trunk(_0x406d0a){this['id']=_0x406d0a['id']||0x0;this['active']=_0x406d0a[_0xa20d('0x0')]||![];this[_0xa20d('0x1')]=_0x406d0a['name']||'';this[_0xa20d('0x2')]='unknown';this['stateTime']=0x0;this[_0xa20d('0x3')]=_0xa20d('0x4');this[_0xa20d('0x5')]=_0x406d0a['registry']&&_0x406d0a['registry'][_0xa20d('0x6')](':')?_0x406d0a['registry'][_0xa20d('0x7')](':')[0x0]:'';this[_0xa20d('0x8')]='';this['port']='';this['domain']='';this[_0xa20d('0x9')]='';this['refresh']='';this[_0xa20d('0xa')]='unknown';this[_0xa20d('0xb')]='';this[_0xa20d('0xc')]='';}module['exports']=Trunk; \ No newline at end of file +var _0x9232=['refresh','stateRegistry','registrationtime','address','exports','active','name','unknown','status','registry','indexOf','split','host','port','domain','domainport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9232,0x75));var _0x2923=function(_0x57fc59,_0x19f1fc){_0x57fc59=_0x57fc59-0x0;var _0x448c1e=_0x9232[_0x57fc59];return _0x448c1e;};'use strict';function Trunk(_0x3e6ba4){this['id']=_0x3e6ba4['id']||0x0;this[_0x2923('0x0')]=_0x3e6ba4['active']||![];this[_0x2923('0x1')]=_0x3e6ba4[_0x2923('0x1')]||'';this['state']=_0x2923('0x2');this['stateTime']=0x0;this[_0x2923('0x3')]=_0x2923('0x2');this['registry']=_0x3e6ba4[_0x2923('0x4')]&&_0x3e6ba4[_0x2923('0x4')][_0x2923('0x5')](':')?_0x3e6ba4['registry'][_0x2923('0x6')](':')[0x0]:'';this[_0x2923('0x7')]='';this[_0x2923('0x8')]='';this[_0x2923('0x9')]='';this[_0x2923('0xa')]='';this[_0x2923('0xb')]='';this[_0x2923('0xc')]=_0x2923('0x2');this[_0x2923('0xd')]='';this[_0x2923('0xe')]='';}module[_0x2923('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 99f6d74..1d2ddb0 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 _0x24e6=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x4905fa,_0x5bc608){var _0x37bcb2=function(_0x5e391d){while(--_0x5e391d){_0x4905fa['push'](_0x4905fa['shift']());}};_0x37bcb2(++_0x5bc608);}(_0x24e6,0x129));var _0x624e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x24e6[_0x501510];return _0x1e6ee5;};'use strict';function voiceExtension(_0x53fcaa){this['id']=_0x53fcaa['id']||0x0;this[_0x624e('0x0')]=_0x53fcaa['exten']||'';this['recordingFormat']=_0x53fcaa[_0x624e('0x1')]||_0x624e('0x2');this[_0x624e('0x3')]=_0x53fcaa[_0x624e('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xe883=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4eee0a,_0x2e55ac){var _0x183661=function(_0x314bd3){while(--_0x314bd3){_0x4eee0a['push'](_0x4eee0a['shift']());}};_0x183661(++_0x2e55ac);}(_0xe883,0x76));var _0x3e88=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xe883[_0x56916d];return _0x2b7f1f;};'use strict';function voiceExtension(_0x486a4c){this['id']=_0x486a4c['id']||0x0;this['exten']=_0x486a4c[_0x3e88('0x0')]||'';this['recordingFormat']=_0x486a4c[_0x3e88('0x1')]||_0x3e88('0x2');this[_0x3e88('0x3')]=_0x486a4c[_0x3e88('0x3')]||![];}module[_0x3e88('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 231de7b..aaf6797 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 _0xbfe2=['dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0xbfe2,0x17f));var _0x2bfe=function(_0x2436e0,_0x585522){_0x2436e0=_0x2436e0-0x0;var _0x522116=_0xbfe2[_0x2436e0];return _0x522116;};'use strict';var statusDesc=['unknown',_0x2bfe('0x0'),_0x2bfe('0x1'),_0x2bfe('0x2'),'invalid',_0x2bfe('0x3'),_0x2bfe('0x4'),_0x2bfe('0x5'),_0x2bfe('0x6')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0x2bfe('0x7')};function VoiceQueue(_0x29d151){this['id']=_0x29d151['id']||0x0;this['name']=_0x29d151[_0x2bfe('0x8')]||'';this[_0x2bfe('0x9')]=_0x29d151['monitor_format']||'';this[_0x2bfe('0xa')]=_0x29d151[_0x2bfe('0xa')]||_0x2bfe('0xb');this['waiting']=0x0;this[_0x2bfe('0xc')]=0x0;this[_0x2bfe('0xd')]=0x0;this[_0x2bfe('0xe')]=0x0;this[_0x2bfe('0xf')]=0x0;this[_0x2bfe('0x10')]=0x0;this[_0x2bfe('0x11')]=0x0;this[_0x2bfe('0x12')]=0x0;this['abandoned']=0x0;this[_0x2bfe('0x13')]=0x0;this[_0x2bfe('0x14')]=0x0;this[_0x2bfe('0x15')]=_0x29d151[_0x2bfe('0x15')]||![];this[_0x2bfe('0x16')]=_0x29d151[_0x2bfe('0x16')]||0xa;this[_0x2bfe('0x17')]=_0x29d151[_0x2bfe('0x17')]||'no';this[_0x2bfe('0x18')]=!![];this[_0x2bfe('0x19')]='';this[_0x2bfe('0x1a')]=0x0;this[_0x2bfe('0x1b')]=0x0;this['dialTimezone']=_0x29d151['dialTimezone']||null;this[_0x2bfe('0x1c')]=_0x29d151[_0x2bfe('0x1c')]?_0x29d151['dialGlobalInterval']:null;this[_0x2bfe('0x1d')]=_0x29d151[_0x2bfe('0x1d')];this[_0x2bfe('0x1e')]=_0x29d151[_0x2bfe('0x1e')]||_0x2bfe('0x1f');this[_0x2bfe('0x20')]=_0x29d151[_0x2bfe('0x20')]||0x0;this['dialLimitQueue']=_0x29d151['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x29d151[_0x2bfe('0x21')]||0x1;this['dialPredictiveOptimization']=_0x29d151['dialPredictiveOptimization']||_0x2bfe('0x22');this['dialPredictiveOptimizationPercentage']=_0x29d151['dialPredictiveOptimizationPercentage']||0.03;this[_0x2bfe('0x23')]=_0x29d151[_0x2bfe('0x23')]||0x258;this[_0x2bfe('0x24')]=_0x29d151[_0x2bfe('0x24')]||_0x2bfe('0x25');this[_0x2bfe('0x26')]=_0x29d151[_0x2bfe('0x26')]||_0x2bfe('0x25');this[_0x2bfe('0x27')]=_0x29d151[_0x2bfe('0x27')]||0x1e;this['dialQueueOptions']=_0x29d151[_0x2bfe('0x28')]||'tTxX';this[_0x2bfe('0x29')]=_0x29d151[_0x2bfe('0x29')]||0x3;this[_0x2bfe('0x2a')]=_0x29d151[_0x2bfe('0x2a')]||undefined;this[_0x2bfe('0x2b')]=_0x29d151[_0x2bfe('0x2b')]||0x3;this[_0x2bfe('0x2c')]=_0x29d151[_0x2bfe('0x2c')]||0x96;this[_0x2bfe('0x2d')]=_0x29d151[_0x2bfe('0x2d')]||0x3;this[_0x2bfe('0x2e')]=_0x29d151[_0x2bfe('0x2e')]||0x96;this[_0x2bfe('0x2f')]=_0x29d151[_0x2bfe('0x2f')]||0x3;this[_0x2bfe('0x30')]=_0x29d151[_0x2bfe('0x30')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x29d151[_0x2bfe('0x31')]||0x3;this[_0x2bfe('0x32')]=_0x29d151[_0x2bfe('0x32')]||0x96;this['dialDropMaxRetry']=_0x29d151[_0x2bfe('0x33')]||0x3;this[_0x2bfe('0x34')]=_0x29d151[_0x2bfe('0x34')]||0x96;this[_0x2bfe('0x35')]=_0x29d151[_0x2bfe('0x35')]||0x3;this[_0x2bfe('0x36')]=_0x29d151['dialAbandonedRetryFrequency']||0x96;this[_0x2bfe('0x37')]=_0x29d151[_0x2bfe('0x37')]||0x3;this[_0x2bfe('0x38')]=_0x29d151['dialMachineRetryFrequency']||0x96;this[_0x2bfe('0x39')]=_0x29d151[_0x2bfe('0x39')]||0x3;this[_0x2bfe('0x3a')]=_0x29d151[_0x2bfe('0x3a')]||0x96;this[_0x2bfe('0x3b')]=_0x29d151[_0x2bfe('0x3b')]||0x4;this[_0x2bfe('0x3c')]=_0x29d151['Trunk']?_0x29d151['Trunk']:undefined;this['TrunkBackup']=_0x29d151['TrunkBackup']?_0x29d151[_0x2bfe('0x3d')]:undefined;this[_0x2bfe('0x3e')]=_0x29d151[_0x2bfe('0x3e')]||undefined;this[_0x2bfe('0x3f')]=_0x29d151['Interval']?_0x29d151[_0x2bfe('0x3f')]:undefined;this[_0x2bfe('0x40')]=_0x29d151[_0x2bfe('0x40')]||'DESC';this[_0x2bfe('0x41')]=_0x29d151[_0x2bfe('0x41')]||undefined;this[_0x2bfe('0x42')]=_0x29d151['dialCutDigit']||undefined;this[_0x2bfe('0x43')]=strategy[_0x29d151['strategy']]||_0x2bfe('0x44');this[_0x2bfe('0x45')]=!![];this[_0x2bfe('0x46')]=_0x29d151[_0x2bfe('0x46')]||![];this[_0x2bfe('0x47')]=_0x29d151[_0x2bfe('0x47')];this[_0x2bfe('0x48')]=_0x29d151[_0x2bfe('0x48')];this[_0x2bfe('0x49')]=_0x29d151['dialAMDAfterGreetingSilence'];this[_0x2bfe('0x4a')]=_0x29d151[_0x2bfe('0x4a')];this['dialAMDMinWordLength']=_0x29d151[_0x2bfe('0x4b')];this[_0x2bfe('0x4c')]=_0x29d151[_0x2bfe('0x4c')];this[_0x2bfe('0x4d')]=_0x29d151['dialAMDMaximumNumberOfWords'];this[_0x2bfe('0x4e')]=_0x29d151[_0x2bfe('0x4e')];this[_0x2bfe('0x4f')]=_0x29d151['dialAMDMaximumWordLength'];this[_0x2bfe('0x50')]=0x0;this[_0x2bfe('0x51')]=0x0;this['timeout']=_0x29d151['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x2bfe('0x52')]=0x0;this[_0x2bfe('0x53')]=0x0;this[_0x2bfe('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x2bfe('0x55')]=0x0;this[_0x2bfe('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x2bfe('0x57')]=0x0;this[_0x2bfe('0x58')]=0x0;this[_0x2bfe('0x59')]=0x0;this[_0x2bfe('0x5a')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x2bfe('0x5b')]=undefined;this[_0x2bfe('0x5c')]=undefined;this['handlePredictive']=undefined;this[_0x2bfe('0x5d')]=1.05;this[_0x2bfe('0x5e')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x2bfe('0x5f')]=0x0;this[_0x2bfe('0x60')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x2bfe('0x61')]=0x0;this[_0x2bfe('0x62')]=_0x29d151[_0x2bfe('0x63')]||0x14;this['predictiveIntervalMinThreshold']=_0x29d151[_0x2bfe('0x63')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x2bfe('0x64')]=0x1;this[_0x2bfe('0x65')]=0x0;this[_0x2bfe('0x66')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x2bfe('0x67')]=0x0;this[_0x2bfe('0x68')]=_0x29d151['dialRecallMeTimeout']||0x1e;this[_0x2bfe('0x69')]=_0x29d151[_0x2bfe('0x69')]||![];this[_0x2bfe('0x6a')]=_0x29d151['dialQueueProject2']||undefined;this[_0x2bfe('0x6b')]=_0x29d151[_0x2bfe('0x6b')]||![];this[_0x2bfe('0x6c')]=_0x29d151[_0x2bfe('0x6c')]||![];this[_0x2bfe('0x9')]=monitorFormat[_0x29d151[_0x2bfe('0x9')]]?monitorFormat[_0x29d151['monitor_format']]:undefined;this['mandatoryDisposition']=_0x29d151[_0x2bfe('0x6d')]||![];this[_0x2bfe('0x6e')]=_0x29d151[_0x2bfe('0x6e')]?_0x29d151[_0x2bfe('0x6e')]:undefined;}module[_0x2bfe('0x6f')]=VoiceQueue; \ No newline at end of file +var _0x824a=['wav','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','sumDuration','unmanaged','abandoned','loggedIn','acw','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringinuse'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x824a,0xe0));var _0xa824=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x824a[_0xfae23b];return _0x200640;};'use strict';var statusDesc=[_0xa824('0x0'),_0xa824('0x1'),_0xa824('0x2'),_0xa824('0x3'),'invalid',_0xa824('0x4'),'ringing',_0xa824('0x5'),'onhold'];var monitorFormat={'wav':_0xa824('0x6'),'wav49':'wav49','gsm':_0xa824('0x7')};var strategy={'rrmemory':_0xa824('0x8'),'roundrobin':_0xa824('0x9')};function VoiceQueue(_0xed067d){this['id']=_0xed067d['id']||0x0;this[_0xa824('0xa')]=_0xed067d[_0xa824('0xa')]||'';this['monitor_format']=_0xed067d[_0xa824('0xb')]||'';this[_0xa824('0xc')]=_0xed067d[_0xa824('0xc')]||'inbound';this[_0xa824('0xd')]=0x0;this[_0xa824('0xe')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xa824('0xf')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0xa824('0x10')]=0x0;this[_0xa824('0x11')]=0x0;this[_0xa824('0x12')]=0x0;this['available']=0x0;this[_0xa824('0x13')]=_0xed067d['acw']||![];this['acwTimeout']=_0xed067d['acwTimeout']||0xa;this['autopause']=_0xed067d['autopause']||'no';this[_0xa824('0x14')]=!![];this[_0xa824('0x15')]='';this[_0xa824('0x16')]=0x0;this[_0xa824('0x17')]=0x0;this[_0xa824('0x18')]=_0xed067d[_0xa824('0x18')]||null;this[_0xa824('0x19')]=_0xed067d[_0xa824('0x19')]?_0xed067d['dialGlobalInterval']:null;this[_0xa824('0x1a')]=_0xed067d['dialActive'];this[_0xa824('0x1b')]=_0xed067d[_0xa824('0x1b')]||_0xa824('0x1c');this[_0xa824('0x1d')]=_0xed067d['dialLimitChannel']||0x0;this[_0xa824('0x1e')]=_0xed067d[_0xa824('0x1e')]||0x0;this[_0xa824('0x1f')]=_0xed067d[_0xa824('0x1f')]||0x1;this['dialPredictiveOptimization']=_0xed067d['dialPredictiveOptimization']||_0xa824('0x20');this[_0xa824('0x21')]=_0xed067d[_0xa824('0x21')]||0.03;this[_0xa824('0x22')]=_0xed067d[_0xa824('0x22')]||0x258;this[_0xa824('0x23')]=_0xed067d[_0xa824('0x23')]||_0xa824('0x24');this[_0xa824('0x25')]=_0xed067d['dialOriginateCallerIdNumber']||_0xa824('0x24');this[_0xa824('0x26')]=_0xed067d[_0xa824('0x26')]||0x1e;this['dialQueueOptions']=_0xed067d[_0xa824('0x27')]||_0xa824('0x28');this['dialQueueTimeout']=_0xed067d['dialQueueTimeout']||0x3;this[_0xa824('0x29')]=_0xed067d[_0xa824('0x29')]||undefined;this[_0xa824('0x2a')]=_0xed067d['dialCongestionMaxRetry']||0x3;this[_0xa824('0x2b')]=_0xed067d[_0xa824('0x2b')]||0x96;this[_0xa824('0x2c')]=_0xed067d[_0xa824('0x2c')]||0x3;this[_0xa824('0x2d')]=_0xed067d[_0xa824('0x2d')]||0x96;this[_0xa824('0x2e')]=_0xed067d[_0xa824('0x2e')]||0x3;this['dialNoAnswerRetryFrequency']=_0xed067d[_0xa824('0x2f')]||0x96;this[_0xa824('0x30')]=_0xed067d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xed067d[_0xa824('0x31')]||0x96;this[_0xa824('0x32')]=_0xed067d[_0xa824('0x32')]||0x3;this[_0xa824('0x33')]=_0xed067d[_0xa824('0x33')]||0x96;this[_0xa824('0x34')]=_0xed067d[_0xa824('0x34')]||0x3;this['dialAbandonedRetryFrequency']=_0xed067d['dialAbandonedRetryFrequency']||0x96;this[_0xa824('0x35')]=_0xed067d['dialMachineMaxRetry']||0x3;this[_0xa824('0x36')]=_0xed067d['dialMachineRetryFrequency']||0x96;this[_0xa824('0x37')]=_0xed067d['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0xed067d[_0xa824('0x38')]||0x96;this[_0xa824('0x39')]=_0xed067d[_0xa824('0x39')]||0x4;this[_0xa824('0x3a')]=_0xed067d[_0xa824('0x3a')]?_0xed067d['Trunk']:undefined;this['TrunkBackup']=_0xed067d[_0xa824('0x3b')]?_0xed067d[_0xa824('0x3b')]:undefined;this[_0xa824('0x3c')]=_0xed067d[_0xa824('0x3c')]||undefined;this['Interval']=_0xed067d[_0xa824('0x3d')]?_0xed067d['Interval']:undefined;this[_0xa824('0x3e')]=_0xed067d['dialOrderByScheduledAt']||'DESC';this[_0xa824('0x3f')]=_0xed067d[_0xa824('0x3f')]||undefined;this[_0xa824('0x40')]=_0xed067d[_0xa824('0x40')]||undefined;this[_0xa824('0x41')]=strategy[_0xed067d[_0xa824('0x41')]]||_0xa824('0x8');this[_0xa824('0x42')]=!![];this[_0xa824('0x43')]=_0xed067d[_0xa824('0x43')]||![];this[_0xa824('0x44')]=_0xed067d[_0xa824('0x44')];this[_0xa824('0x45')]=_0xed067d[_0xa824('0x45')];this[_0xa824('0x46')]=_0xed067d[_0xa824('0x46')];this[_0xa824('0x47')]=_0xed067d[_0xa824('0x47')];this[_0xa824('0x48')]=_0xed067d[_0xa824('0x48')];this[_0xa824('0x49')]=_0xed067d[_0xa824('0x49')];this[_0xa824('0x4a')]=_0xed067d['dialAMDMaximumNumberOfWords'];this[_0xa824('0x4b')]=_0xed067d['dialAMDSilenceThreshold'];this[_0xa824('0x4c')]=_0xed067d[_0xa824('0x4c')];this['outboundRejectCallsDay']=0x0;this[_0xa824('0x4d')]=0x0;this[_0xa824('0x4e')]=_0xed067d[_0xa824('0x4e')];this['outboundAnswerCallsDay']=0x0;this[_0xa824('0x4f')]=0x0;this[_0xa824('0x50')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xa824('0x51')]=0x0;this[_0xa824('0x52')]=0x0;this[_0xa824('0x53')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa824('0x54')]=0x0;this[_0xa824('0x55')]=0x0;this[_0xa824('0x56')]=0x0;this[_0xa824('0x57')]=0x0;this[_0xa824('0x58')]=0x0;this[_0xa824('0x59')]=0x0;this['startProgressive']=undefined;this[_0xa824('0x5a')]=undefined;this[_0xa824('0x5b')]=undefined;this[_0xa824('0x5c')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xa824('0x5d')]=0x0;this[_0xa824('0x5e')]=0x0;this[_0xa824('0x5f')]=0x0;this[_0xa824('0x60')]=0x0;this[_0xa824('0x61')]=0x0;this[_0xa824('0x62')]=0x0;this[_0xa824('0x63')]=0x0;this[_0xa824('0x64')]=_0xed067d[_0xa824('0x65')]||0x14;this[_0xa824('0x66')]=_0xed067d[_0xa824('0x65')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xa824('0x67')]=0x0;this[_0xa824('0x68')]=0x1;this['erlangCalls']=0x0;this[_0xa824('0x69')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xa824('0x6a')]=0x0;this['dialRecallMeTimeout']=_0xed067d[_0xa824('0x6b')]||0x1e;this[_0xa824('0x6c')]=_0xed067d['dialRecallInQueue']||![];this[_0xa824('0x6d')]=_0xed067d[_0xa824('0x6d')]||undefined;this[_0xa824('0x6e')]=_0xed067d[_0xa824('0x6e')]||![];this[_0xa824('0x6f')]=_0xed067d[_0xa824('0x6f')]||![];this[_0xa824('0xb')]=monitorFormat[_0xed067d[_0xa824('0xb')]]?monitorFormat[_0xed067d['monitor_format']]:undefined;this[_0xa824('0x70')]=_0xed067d['mandatoryDisposition']||![];this[_0xa824('0x71')]=_0xed067d[_0xa824('0x71')]?_0xed067d[_0xa824('0x71')]:undefined;}module[_0xa824('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3389e96..18a1e88 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 _0x0473=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x0473,0x70));var _0x3047=function(_0x160af8,_0xaa32a3){_0x160af8=_0x160af8-0x0;var _0x3baef8=_0x0473[_0x160af8];return _0x3baef8;};'use strict';function VtigerAccount(_0x44e673){this['id']=_0x44e673['id']||0x0;this[_0x3047('0x0')]=_0x44e673[_0x3047('0x0')]||'';this[_0x3047('0x1')]=_0x44e673['username']||'';this['accessKey']=_0x44e673[_0x3047('0x2')]||'';this['remoteUri']=_0x44e673[_0x3047('0x3')]||'';this[_0x3047('0x4')]=_0x44e673['serverUrl']||'';this[_0x3047('0x5')]=_0x44e673[_0x3047('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x9850=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0xa35b12,_0x4f4b9b){var _0x4a9246=function(_0x5db3ff){while(--_0x5db3ff){_0xa35b12['push'](_0xa35b12['shift']());}};_0x4a9246(++_0x4f4b9b);}(_0x9850,0xba));var _0x0985=function(_0x215336,_0x56430f){_0x215336=_0x215336-0x0;var _0x1790c9=_0x9850[_0x215336];return _0x1790c9;};'use strict';function VtigerAccount(_0x29faf3){this['id']=_0x29faf3['id']||0x0;this[_0x0985('0x0')]=_0x29faf3[_0x0985('0x0')]||'';this[_0x0985('0x1')]=_0x29faf3['username']||'';this[_0x0985('0x2')]=_0x29faf3[_0x0985('0x2')]||'';this[_0x0985('0x3')]=_0x29faf3[_0x0985('0x3')]||'';this[_0x0985('0x4')]=_0x29faf3['serverUrl']||'';this[_0x0985('0x5')]=_0x29faf3['Configurations']||{};}module[_0x0985('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index de10a2c..f0719d2 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 _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0xb2b251,_0x1d3c78){_0xb2b251=_0xb2b251-0x0;var _0x238053=_0x7a54[_0xb2b251];return _0x238053;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0x0b0e,0x187));var _0xe0b0=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x0b0e[_0x22e9fe];return _0x47cd19;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ecc841c..f571edb 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 _0xdacc=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xdacc,0x14f));var _0xcdac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdacc[_0x2dafbe];return _0x58a45a;};'use strict';function ZohoAccount(_0x57a253){this['id']=_0x57a253['id']||0x0;this[_0xcdac('0x0')]=_0x57a253[_0xcdac('0x0')]||'';this[_0xcdac('0x1')]=_0x57a253[_0xcdac('0x1')]||'';this[_0xcdac('0x2')]=_0x57a253[_0xcdac('0x2')]||'';this[_0xcdac('0x3')]=_0x57a253['zone']||'';this[_0xcdac('0x4')]=_0x57a253[_0xcdac('0x4')]||'';this[_0xcdac('0x5')]=_0x57a253[_0xcdac('0x5')]||'';this[_0xcdac('0x6')]=_0x57a253[_0xcdac('0x6')]||'';this[_0xcdac('0x7')]=_0x57a253[_0xcdac('0x7')]||'';this[_0xcdac('0x8')]=_0x57a253[_0xcdac('0x8')]||'';this[_0xcdac('0x9')]=_0x57a253[_0xcdac('0x9')]||{};}module[_0xcdac('0xa')]=ZohoAccount; \ No newline at end of file +var _0xb19a=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','description','host'];(function(_0x48837d,_0x5a94de){var _0x1a34b7=function(_0x40dccf){while(--_0x40dccf){_0x48837d['push'](_0x48837d['shift']());}};_0x1a34b7(++_0x5a94de);}(_0xb19a,0xd0));var _0xab19=function(_0x47769f,_0x4fd2dd){_0x47769f=_0x47769f-0x0;var _0xdb050a=_0xb19a[_0x47769f];return _0xdb050a;};'use strict';function ZohoAccount(_0x358609){this['id']=_0x358609['id']||0x0;this['name']=_0x358609['name']||'';this[_0xab19('0x0')]=_0x358609['description']||'';this['host']=_0x358609[_0xab19('0x1')]||'';this[_0xab19('0x2')]=_0x358609[_0xab19('0x2')]||'';this[_0xab19('0x3')]=_0x358609[_0xab19('0x3')]||'';this[_0xab19('0x4')]=_0x358609[_0xab19('0x4')]||'';this['serverUrl']=_0x358609[_0xab19('0x5')]||'';this[_0xab19('0x6')]=_0x358609['code']||'';this[_0xab19('0x7')]=_0x358609['refreshToken']||'';this[_0xab19('0x8')]=_0x358609[_0xab19('0x8')]||{};}module[_0xab19('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 14e5120..5c0b919 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 _0x0fb2=['Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname'];(function(_0x2be8ef,_0x329f58){var _0x3e6c53=function(_0x3d4833){while(--_0x3d4833){_0x2be8ef['push'](_0x2be8ef['shift']());}};_0x3e6c53(++_0x329f58);}(_0x0fb2,0x1c9));var _0x20fb=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x0fb2[_0x1646fa];return _0x5a47a5;};'use strict';var util=require(_0x20fb('0x0'));var _=require('lodash');var moment=require(_0x20fb('0x1'));function checkNameSurname(_0x1b7bf5,_0x18be79,_0x13df53){var _0x1ddf7d='';if(!_[_0x20fb('0x2')](_0x18be79)&&_0x20fb('0x3')===typeof _0x18be79){_0x1ddf7d+=_0x18be79;}if(!_[_0x20fb('0x2')](_0x13df53)&&'string'===typeof _0x13df53){_0x1ddf7d+='\x20'+_0x13df53;}if(_0x1ddf7d!==''){return _0x1ddf7d;}return _0x1b7bf5;}function Action(_0x2a797f,_0x4cc3c4,_0x1aa0e2,_0x325306,_0x1b4cef){this[_0x20fb('0x4')]=_0x1aa0e2||undefined;this[_0x20fb('0x5')]=_0x2a797f['id'];this[_0x20fb('0x6')]=_0x4cc3c4[_0x20fb('0x7')];this[_0x20fb('0x8')]=_0x4cc3c4[_0x20fb('0x8')];this[_0x20fb('0x9')]=_0x20fb('0x6');this[_0x20fb('0xa')]=![];this[_0x20fb('0xb')]=_[_0x20fb('0x2')](_0x2a797f[_0x20fb('0xc')])?undefined:_0x2a797f[_0x20fb('0xc')][_0x20fb('0x7')];this['channelAgent']=this[_0x20fb('0xb')]?util[_0x20fb('0xd')](_0x20fb('0xe'),this[_0x20fb('0xb')]):_0x325306||undefined;this[_0x20fb('0xf')]=checkNameSurname(_0x2a797f[_0x20fb('0x10')][_0x20fb('0x11')],_0x2a797f['Contact'][_0x20fb('0x12')],_0x2a797f[_0x20fb('0x10')]['lastName']);this[_0x20fb('0x13')]=_0x2a797f[_0x20fb('0x13')]||![];this[_0x20fb('0x14')]=_0x2a797f[_0x20fb('0x10')][_0x20fb('0x11')];this[_0x20fb('0x15')]=_0x2a797f[_0x20fb('0x15')];this[_0x20fb('0x16')]=_0x2a797f[_0x20fb('0x16')]||0x0;this[_0x20fb('0x17')]=_0x2a797f[_0x20fb('0x17')]||0x0;this[_0x20fb('0x18')]=_0x2a797f[_0x20fb('0x18')]||0x0;this[_0x20fb('0x19')]=(_0x2a797f[_0x20fb('0x16')]||0x0)+(_0x2a797f[_0x20fb('0x17')]||0x0)+(_0x2a797f[_0x20fb('0x18')]||0x0)+(_0x2a797f[_0x20fb('0x1a')]||0x0)+(_0x2a797f[_0x20fb('0x1b')]||0x0)+(_0x2a797f[_0x20fb('0x1c')]||0x0)+(_0x2a797f[_0x20fb('0x1d')]||0x0)+(_0x2a797f[_0x20fb('0x1e')]||0x0);this[_0x20fb('0x1a')]=_0x2a797f[_0x20fb('0x1a')]||0x0;this[_0x20fb('0x1b')]=_0x2a797f['countdropretry']||0x0;this[_0x20fb('0x1c')]=_0x2a797f[_0x20fb('0x1c')]||0x0;this['countmachineretry']=_0x2a797f[_0x20fb('0x1d')]||0x0;this['countagentrejectretry']=_0x2a797f[_0x20fb('0x1e')]||0x0;this[_0x20fb('0x1f')]=_0x2a797f[_0x20fb('0x1f')];this[_0x20fb('0x20')]=_0x2a797f[_0x20fb('0x20')];this['callbackat']=_0x2a797f['callbackat'];this[_0x20fb('0x21')]=_0x2a797f[_0x20fb('0x21')];this['ContactId']=_0x2a797f[_0x20fb('0x22')];this[_0x20fb('0x23')]=_0x2a797f['ListId'];this['UserId']=_[_0x20fb('0x2')](_0x2a797f[_0x20fb('0xc')])?_0x2a797f[_0x20fb('0x24')]:_0x2a797f[_0x20fb('0xc')]['id'];this[_0x20fb('0x25')]=_0x2a797f[_0x20fb('0x25')];this['originatecalleridnum']='';this[_0x20fb('0x26')]='';}Action[_0x20fb('0x27')]['getCaller']=function(){return util[_0x20fb('0xd')](_0x20fb('0x28'),this[_0x20fb('0xf')],this[_0x20fb('0x29')]);};module[_0x20fb('0x2a')]=Action; \ No newline at end of file +var _0x0793=['dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','phone','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','number','exports','util','moment','isNil','string','queue','type','campaigntype'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0793,0x193));var _0x3079=function(_0x5a7f65,_0x3a6f0a){_0x5a7f65=_0x5a7f65-0x0;var _0x5bea13=_0x0793[_0x5a7f65];return _0x5bea13;};'use strict';var util=require(_0x3079('0x0'));var _=require('lodash');var moment=require(_0x3079('0x1'));function checkNameSurname(_0x46554f,_0x41a474,_0x5907f9){var _0x10d00b='';if(!_[_0x3079('0x2')](_0x41a474)&&_0x3079('0x3')===typeof _0x41a474){_0x10d00b+=_0x41a474;}if(!_[_0x3079('0x2')](_0x5907f9)&&'string'===typeof _0x5907f9){_0x10d00b+='\x20'+_0x5907f9;}if(_0x10d00b!==''){return _0x10d00b;}return _0x46554f;}function Action(_0x3b418e,_0x55e528,_0x491dba,_0x4e933c,_0x112a42){this['uniqueid']=_0x491dba||undefined;this['idContact']=_0x3b418e['id'];this[_0x3079('0x4')]=_0x55e528['name'];this['type']=_0x55e528[_0x3079('0x5')];this[_0x3079('0x6')]=_0x3079('0x4');this[_0x3079('0x7')]=![];this[_0x3079('0x8')]=_[_0x3079('0x2')](_0x3b418e[_0x3079('0x9')])?undefined:_0x3b418e[_0x3079('0x9')][_0x3079('0xa')];this[_0x3079('0xb')]=this['membername']?util[_0x3079('0xc')](_0x3079('0xd'),this['membername']):_0x4e933c||undefined;this[_0x3079('0xe')]=checkNameSurname(_0x3b418e['Contact'][_0x3079('0xf')],_0x3b418e['Contact']['firstName'],_0x3b418e[_0x3079('0x10')][_0x3079('0x11')]);this[_0x3079('0x12')]=_0x3b418e[_0x3079('0x12')]||![];this[_0x3079('0x13')]=_0x3b418e[_0x3079('0x10')][_0x3079('0xf')];this[_0x3079('0x14')]=_0x3b418e[_0x3079('0x14')];this[_0x3079('0x15')]=_0x3b418e['countbusyretry']||0x0;this[_0x3079('0x16')]=_0x3b418e[_0x3079('0x16')]||0x0;this['countnoanswerretry']=_0x3b418e[_0x3079('0x17')]||0x0;this['countglobal']=(_0x3b418e[_0x3079('0x15')]||0x0)+(_0x3b418e[_0x3079('0x16')]||0x0)+(_0x3b418e[_0x3079('0x17')]||0x0)+(_0x3b418e[_0x3079('0x18')]||0x0)+(_0x3b418e['countdropretry']||0x0)+(_0x3b418e[_0x3079('0x19')]||0x0)+(_0x3b418e[_0x3079('0x1a')]||0x0)+(_0x3b418e['countagentrejectretry']||0x0);this[_0x3079('0x18')]=_0x3b418e[_0x3079('0x18')]||0x0;this[_0x3079('0x1b')]=_0x3b418e[_0x3079('0x1b')]||0x0;this[_0x3079('0x19')]=_0x3b418e[_0x3079('0x19')]||0x0;this[_0x3079('0x1a')]=_0x3b418e['countmachineretry']||0x0;this[_0x3079('0x1c')]=_0x3b418e[_0x3079('0x1c')]||0x0;this['callback']=_0x3b418e[_0x3079('0x1d')];this[_0x3079('0x1e')]=_0x3b418e[_0x3079('0x1e')];this['callbackat']=_0x3b418e[_0x3079('0x1f')];this['recallme']=_0x3b418e[_0x3079('0x20')];this[_0x3079('0x21')]=_0x3b418e[_0x3079('0x21')];this[_0x3079('0x22')]=_0x3b418e['ListId'];this[_0x3079('0x23')]=_[_0x3079('0x2')](_0x3b418e[_0x3079('0x9')])?_0x3b418e[_0x3079('0x23')]:_0x3b418e[_0x3079('0x9')]['id'];this[_0x3079('0x24')]=_0x3b418e[_0x3079('0x24')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x3079('0x25')][_0x3079('0x26')]=function(){return util[_0x3079('0xc')]('\x22%s\x22\x20<%s>',this[_0x3079('0xe')],this[_0x3079('0x27')]);};module[_0x3079('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index d49aef6..9bf6b51 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 _0x93af=['keys','variable','addVariable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','buildAcw','custom:agentcomplete','complete','total','answered','countglobal','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','createCustomerHistory','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','scheduledAt','outboundCongestionCallsDay','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','countagentrejectretry','AgentReject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','trim','substring','dialCutDigit','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','merge','toLowerVariables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','isFailure','response','custom:agentringnoanswer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','reason','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','variables','filterKey'];(function(_0x5de379,_0x561402){var _0x53a468=function(_0x533555){while(--_0x533555){_0x5de379['push'](_0x5de379['shift']());}};_0x53a468(++_0x561402);}(_0x93af,0x152));var _0xf93a=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0x93af[_0x1e393b];return _0x3d0bfe;};'use strict';var util=require(_0xf93a('0x0'));var _=require(_0xf93a('0x1'));var BPromise=require(_0xf93a('0x2'));var uuid=require(_0xf93a('0x3'));var moment=require(_0xf93a('0x4'));var md5=require(_0xf93a('0x5'));var Redis=require(_0xf93a('0x6'));var config=require(_0xf93a('0x7'));var logger=require(_0xf93a('0x8'))(_0xf93a('0x9'));var loggerAction=require(_0xf93a('0x8'))(_0xf93a('0xa'));var ami=require('../ami');var rpcDb=require(_0xf93a('0xb'));var Action=require(_0xf93a('0xc'));var ut=require(_0xf93a('0xd'));config[_0xf93a('0xe')]=_[_0xf93a('0xf')](config[_0xf93a('0xe')],{'host':_0xf93a('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf93a('0xe')]));var Sequence=function(){};Sequence[_0xf93a('0x11')]['enqueue']=function(_0x22941c){this[_0xf93a('0x12')]=this[_0xf93a('0x12')]?this[_0xf93a('0x12')][_0xf93a('0x13')](_0x22941c):_0x22941c();};function Preview(_0x305c20){this[_0xf93a('0x14')]=new Sequence();this[_0xf93a('0x15')]=_0x305c20['voiceQueues'];this[_0xf93a('0x16')]=_0x305c20[_0xf93a('0x16')];this[_0xf93a('0x17')]={};this[_0xf93a('0x18')]=_0x305c20[_0xf93a('0x18')];this[_0xf93a('0x19')]=0x0;ami['on'](_0xf93a('0x1a'),this[_0xf93a('0x1b')][_0xf93a('0x1c')](this));ami['on'](_0xf93a('0x1d'),this[_0xf93a('0x1e')]['bind'](this));ami['on'](_0xf93a('0x1f'),this[_0xf93a('0x20')]['bind'](this));ami['on'](_0xf93a('0x21'),this['syncDialEnd'][_0xf93a('0x1c')](this));ami['on'](_0xf93a('0x22'),this[_0xf93a('0x23')][_0xf93a('0x1c')](this));ami['on']('varset',this[_0xf93a('0x24')]['bind'](this));ami['on'](_0xf93a('0x25'),this[_0xf93a('0x26')][_0xf93a('0x1c')](this));ami['on']('blindtransfer',this[_0xf93a('0x27')][_0xf93a('0x1c')](this));this[_0xf93a('0x28')](this[_0xf93a('0x15')]);}function emit(_0x289b0a,_0x51ff2f,_0x4c3709){io['to'](_0x289b0a)[_0xf93a('0x29')](_0x51ff2f,_0x4c3709);}function emitCampaignPreview(_0x5c48a6){if(_0x5c48a6[_0xf93a('0x2a')]===_0xf93a('0x2b')){var _0x4e1321={'id':_0x5c48a6['id'],'name':_0x5c48a6[_0xf93a('0x2c')],'strategy':_0x5c48a6[_0xf93a('0x2d')],'answered':_0x5c48a6['answered'],'available':_0x5c48a6['available'],'loggedIn':_0x5c48a6[_0xf93a('0x2e')],'pTalking':_0x5c48a6[_0xf93a('0x2f')],'sumBillable':_0x5c48a6[_0xf93a('0x30')],'sumDuration':_0x5c48a6[_0xf93a('0x31')],'sumHoldTime':_0x5c48a6[_0xf93a('0x32')]||0x0,'talking':_0x5c48a6[_0xf93a('0x33')],'total':_0x5c48a6['total'],'type':_0x5c48a6[_0xf93a('0x2a')],'unmanaged':_0x5c48a6[_0xf93a('0x34')],'abandoned':_0x5c48a6['abandoned'],'waiting':_0x5c48a6['waiting'],'loggedInDb':_0x5c48a6[_0xf93a('0x35')],'dialActive':_0x5c48a6[_0xf93a('0x36')],'dialMethod':_0x5c48a6[_0xf93a('0x37')],'dialOriginateCallerIdName':_0x5c48a6[_0xf93a('0x38')],'dialOriginateCallerIdNumber':_0x5c48a6[_0xf93a('0x39')],'dialOriginateTimeout':_0x5c48a6[_0xf93a('0x3a')],'dialPrefix':_0x5c48a6[_0xf93a('0x3b')],'outboundAnswerAgiCallsDay':_0x5c48a6[_0xf93a('0x3c')],'outboundAnswerCallsDay':_0x5c48a6[_0xf93a('0x3d')],'outboundBlacklistCallsDay':_0x5c48a6[_0xf93a('0x3e')],'outboundBusyCallsDay':_0x5c48a6[_0xf93a('0x3f')],'outboundCongestionCallsDay':_0x5c48a6['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5c48a6[_0xf93a('0x40')],'outboundDropCallsDayCallersExit':_0x5c48a6[_0xf93a('0x41')],'outboundDropCallsDayTimeout':_0x5c48a6[_0xf93a('0x42')],'outboundNoAnswerCallsDay':_0x5c48a6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5c48a6[_0xf93a('0x43')],'outboundOriginateFailureCallsDay':_0x5c48a6['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5c48a6[_0xf93a('0x44')],'outboundRejectCallsDay':_0x5c48a6[_0xf93a('0x45')],'outboundUnknownCallsDay':_0x5c48a6[_0xf93a('0x46')],'outboundAbandonedCallsDay':_0x5c48a6[_0xf93a('0x47')],'predictiveIntervalAnsweredCalls':_0x5c48a6[_0xf93a('0x48')],'predictiveIntervalAvgHoldtime':_0x5c48a6['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5c48a6[_0xf93a('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x5c48a6[_0xf93a('0x4a')],'predictiveIntervalDroppedCallsTimeout':_0x5c48a6[_0xf93a('0x4b')],'predictiveIntervalErlangCalls':_0x5c48a6['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5c48a6['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5c48a6[_0xf93a('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x5c48a6['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5c48a6[_0xf93a('0x4d')],'predictiveIntervalAvailable':_0x5c48a6['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5c48a6[_0xf93a('0x4e')],'message':_0x5c48a6[_0xf93a('0x4f')],'originated':_0x5c48a6[_0xf93a('0x50')],'erlangCalls':_0x5c48a6[_0xf93a('0x51')],'erlangCallToSecond':_0x5c48a6[_0xf93a('0x52')],'erlangAbandonmentRate':_0x5c48a6[_0xf93a('0x53')],'erlangBusyFactor':_0x5c48a6[_0xf93a('0x54')],'startPredictive':_0x5c48a6[_0xf93a('0x55')],'startProgressive':_0x5c48a6[_0xf93a('0x56')]};if(_0x5c48a6[_0xf93a('0x57')]){_0x4e1321[_0xf93a('0x57')]={'id':_0x5c48a6['Trunk']['id'],'name':_0x5c48a6[_0xf93a('0x57')][_0xf93a('0x2c')],'active':_0x5c48a6[_0xf93a('0x57')][_0xf93a('0x58')],'callerid':_0x5c48a6[_0xf93a('0x57')][_0xf93a('0x59')]};}if(_0x5c48a6['Interval']){_0x4e1321[_0xf93a('0x5a')]={'id':_0x5c48a6[_0xf93a('0x5a')]['id'],'name':_0x5c48a6[_0xf93a('0x5a')][_0xf93a('0x2c')]};}var _0x23771a=md5(JSON[_0xf93a('0x5b')](_0x4e1321));if(_0x5c48a6[_0xf93a('0x5')]!==_0x23771a){_0x5c48a6['md5']=_0x23771a;emit(util[_0xf93a('0x5c')]('voice:queue:%s',_0x4e1321[_0xf93a('0x2c')]),_0xf93a('0x5d'),_0x4e1321);}}}function emitVoiceQueueChannelRemove(_0x3a935f){logger[_0xf93a('0x5e')](_0xf93a('0x5f'),JSON[_0xf93a('0x5b')](_0x3a935f));emit(util['format'](_0xf93a('0x60'),_0x3a935f['name']),_0xf93a('0x61'),_0x3a935f);}function notSendMessagesQueue(_0x339493){if(_0x339493[_0xf93a('0x62')]){if(_0x339493[_0xf93a('0x50')]===0x0&&_0x339493[_0xf93a('0x2f')]===0x0){_0x339493[_0xf93a('0x62')]=![];_0x339493[_0xf93a('0x63')]=0x0;_0x339493[_0xf93a('0x64')]=0x0;_0x339493[_0xf93a('0x4f')]='NOT_ACTIVE';ut[_0xf93a('0x65')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x339493[_0xf93a('0x2c')]+_0xf93a('0x66'));}else{_0x339493[_0xf93a('0x4f')]=_0xf93a('0x67');ut[_0xf93a('0x65')](_0xf93a('0x68'),_0x339493[_0xf93a('0x2c')]+_0xf93a('0x69'));}emitCampaignPreview(_0x339493);}}Preview['prototype'][_0xf93a('0x28')]=function(){var _0x47214a=this;setInterval(function(){_0x47214a[_0xf93a('0x6a')]();},0x7cf);};Preview[_0xf93a('0x11')][_0xf93a('0x6a')]=function(){var _0x532f57=this[_0xf93a('0x15')];this[_0xf93a('0x19')]+=0x1;for(var _0x394bc7 in _0x532f57){if(_0x532f57[_0xf93a('0x6b')](_0x394bc7)&&(_0x532f57[_0x394bc7][_0xf93a('0x37')]==='preview'||_0x532f57[_0x394bc7][_0xf93a('0x37')]===_0xf93a('0x6c'))&&_0x532f57[_0x394bc7][_0xf93a('0x2a')]===_0xf93a('0x2b')){if(this['clockClearZombieChannels']>0x7){this[_0xf93a('0x19')]=0x0;this[_0xf93a('0x6d')]();}}if(_0x532f57[_0xf93a('0x6b')](_0x394bc7)&&_0x532f57[_0x394bc7][_0xf93a('0x37')]==='preview'&&_0x532f57[_0x394bc7][_0xf93a('0x2a')]===_0xf93a('0x2b')){if(_0x532f57[_0x394bc7][_0xf93a('0x36')]){this[_0xf93a('0x6e')](_0x532f57[_0x394bc7]);this[_0xf93a('0x6f')](_0x532f57[_0x394bc7]);}else{notSendMessagesQueue(_0x532f57[_0x394bc7]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x2b1d51){var _0x493b23=this;this['sequence']['enqueue'](function(){if(!_[_0xf93a('0x70')](_0x493b23[_0xf93a('0x17')][_0x2b1d51])){loggerAction[_0xf93a('0x5e')](_0xf93a('0x71'),_0x2b1d51,_0xf93a('0x72'),_0x493b23[_0xf93a('0x17')][_0x2b1d51]['queue'],_0xf93a('0x73'),JSON[_0xf93a('0x5b')](_0x493b23[_0xf93a('0x15')][_0x493b23[_0xf93a('0x17')][_0x2b1d51]['queue']]['originated']),_0xf93a('0x74'),JSON[_0xf93a('0x5b')](_0x493b23['campaignsPreview'][_0x493b23[_0xf93a('0x17')][_0x2b1d51][_0xf93a('0x75')]][_0xf93a('0x2f')]),JSON[_0xf93a('0x5b')](_0x493b23['actions'][_0x2b1d51][_0xf93a('0x76')]),JSON[_0xf93a('0x5b')](_[_0xf93a('0x77')](_0x493b23[_0xf93a('0x17')][_0x2b1d51],[_0xf93a('0x78'),_0xf93a('0x79'),_0xf93a('0x7a'),_0xf93a('0x7b')])));return ami[_0xf93a('0x7c')]({'action':_0xf93a('0x7d'),'channel':_0x493b23[_0xf93a('0x17')][_0x2b1d51][_0xf93a('0x7e')]})[_0xf93a('0x7f')](function(_0x3e85af){if(_0x3e85af[_0xf93a('0x4f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x493b23[_0xf93a('0x17')][_0x2b1d51]){ut[_0xf93a('0x80')](_0x493b23['campaignsPreview'][_0x493b23[_0xf93a('0x17')][_0x2b1d51][_0xf93a('0x75')]],'[clearZombieChannel]');if(_0x493b23[_0xf93a('0x17')][_0x2b1d51][_0xf93a('0x76')]===!![]){ut[_0xf93a('0x81')](_0x493b23['campaignsPreview'][_0x493b23[_0xf93a('0x17')][_0x2b1d51][_0xf93a('0x75')]],'[clearZombieChannel]');ut[_0xf93a('0x82')](_0xf93a('0x83')+_0x2b1d51,_0x493b23[_0xf93a('0x17')][_0x2b1d51][_0xf93a('0x75')]);}ut[_0xf93a('0x82')](_0xf93a('0x84')+_0x2b1d51,_0x493b23[_0xf93a('0x17')][_0x2b1d51]['queue']);delete _0x493b23[_0xf93a('0x17')][_0x2b1d51];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x2b2a09=this;loggerAction[_0xf93a('0x5e')](_0xf93a('0x85'),_[_0xf93a('0x86')](this['actions']));for(var _0x522e71 in this[_0xf93a('0x17')]){if(_0x2b2a09['actions'][_0xf93a('0x6b')](_0x522e71)){_0x2b2a09[_0xf93a('0x87')](_0x522e71);}}};Preview[_0xf93a('0x11')][_0xf93a('0x6f')]=function(_0x9d3e03){var _0x2b4975=this;rpcDb[_0xf93a('0x88')](_0x9d3e03['id'],ut[_0xf93a('0x89')](this[_0xf93a('0x18')]))[_0xf93a('0x8a')](function(_0x2385f4){if(!_[_0xf93a('0x70')](_0x2385f4)){for(var _0x2287a8=0x0;_0x2287a8<_0x2385f4[_0xf93a('0x8b')];_0x2287a8+=0x1){if(ut[_0xf93a('0x8c')](_0x2385f4[_0x2287a8][_0xf93a('0x8d')])<_0x9d3e03[_0xf93a('0x8e')]*0x3c){if(_0x2385f4[_0x2287a8][_0xf93a('0x8f')]&&!_0x2385f4[_0x2287a8][_0xf93a('0x8f')][_0xf93a('0x90')]){_0x2b4975[_0xf93a('0x91')](_0x2385f4[_0x2287a8]['id'])[_0xf93a('0x8a')](ut['logger2'](_0xf93a('0x92')))[_0xf93a('0x7f')](ut[_0xf93a('0x93')](_0xf93a('0x92')));}else{rpcDb[_0xf93a('0x94')](_0x2385f4[_0x2287a8]['id']);}}else{var _0x887e49=new Action(_0x2385f4[_0x2287a8],_0x9d3e03);_0x887e49[_0xf93a('0x95')]=moment()[_0xf93a('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x9d3e03[_0xf93a('0x44')]+=0x1;ut[_0xf93a('0x96')](_0x887e49,0x17,_0xf93a('0x97'));if(_0x9d3e03[_0xf93a('0x98')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x2385f4[_0x2287a8]));rpcDb['createCustomerHistory'](_0x887e49,_0xf93a('0x99'));}else{ut[_0xf93a('0x96')](_0x887e49,0x16,_0xf93a('0x9a'));rpcDb['createCustomerHistory'](_0x887e49,_0xf93a('0x9b'));rpcDb[_0xf93a('0x9c')](_0x887e49,_0xf93a('0x9b'));}}}}})['catch'](ut[_0xf93a('0x93')](_0xf93a('0x9d')));};Preview[_0xf93a('0x11')]['setMessage']=function(_0x343b8f){_0x343b8f['sendMessageOneNotActive']=!![];if(ut[_0xf93a('0x9e')](_0x343b8f[_0xf93a('0x2e')])){_0x343b8f['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0xf93a('0x9f')](_0x343b8f[_0xf93a('0x36')])){_0x343b8f[_0xf93a('0x4f')]='NOT_ACTIVE';}else if(!this[_0xf93a('0xa0')](_0x343b8f[_0xf93a('0x57')])){if(!this[_0xf93a('0xa0')](_0x343b8f['TrunkBackup'])){_0x343b8f['message']=_0xf93a('0xa1');}else{_0x343b8f[_0xf93a('0x4f')]=_0xf93a('0xa2');}}else{_0x343b8f[_0xf93a('0x4f')]='ACTIVE';}emitCampaignPreview(_0x343b8f);};Preview['prototype'][_0xf93a('0xa3')]=function(_0x2d3c22,_0x253ce7,_0x3ec7de){var _0x54a785=this;var _0x25b77e=this[_0xf93a('0x17')][_0x253ce7];var _0x504ff0=this[_0xf93a('0x15')][_0x25b77e['queue']];var _0x23a66e;if(_0x504ff0){switch(_0x3ec7de){case'1':_0x504ff0[_0xf93a('0x43')]+=0x1;_0x25b77e[_0xf93a('0xa4')]+=0x1;_0x25b77e['countglobal']=ut[_0xf93a('0xa5')](_0x25b77e);ut[_0xf93a('0x96')](_0x25b77e,0x0,_0xf93a('0xa6'));ami[_0xf93a('0x29')](_0xf93a('0xa7'),ut[_0xf93a('0xa8')](_0x25b77e,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x25b77e,_0xf93a('0xa9'));if(ut[_0xf93a('0xa5')](_0x25b77e)>=_0x504ff0['dialGlobalMaxRetry']){_0x23a66e=ut[_0xf93a('0xaa')](_0x25b77e,0xf,_0xf93a('0xab'));rpcDb[_0xf93a('0x9c')](_0x23a66e,_0xf93a('0xac'));}else{if(_0x25b77e[_0xf93a('0xa4')]>=_0x504ff0['dialNoSuchNumberMaxRetry']){rpcDb[_0xf93a('0x9c')](_0x25b77e,_0xf93a('0xac'));}else{rpcDb[_0xf93a('0xad')](ut['scheduledAt'](_0x25b77e,_0xf93a('0xa4'),_0x504ff0[_0xf93a('0xae')]),_0x25b77e[_0xf93a('0xaf')],_0x25b77e[_0xf93a('0xb0')]);}}delete this[_0xf93a('0x17')][_0x2d3c22[_0xf93a('0xb1')]];break;case'ANSWER':var _0x45a107=moment()[_0xf93a('0x5c')](_0xf93a('0xb2'));_0x25b77e[_0xf93a('0xb3')]=_0x45a107;_0x25b77e[_0xf93a('0xb4')]=_0x45a107;_0x25b77e['dialAnswer']=!![];_0x504ff0[_0xf93a('0x2f')]+=0x1;logger[_0xf93a('0x5e')](_0xf93a('0xb5'),_0x25b77e[_0xf93a('0xb6')],_0xf93a('0xb7'),_0x504ff0['name'],_0xf93a('0x74'),_0x504ff0[_0xf93a('0x2f')]);ami[_0xf93a('0x29')](_0xf93a('0xb8'),ut[_0xf93a('0xa8')](_0x25b77e,'connect'));if(_0x504ff0[_0xf93a('0xb9')]){ami[_0xf93a('0x29')]('custom:agentConnectPreview',ut[_0xf93a('0xba')](_0x25b77e));}break;case'16':ami[_0xf93a('0x29')](_0xf93a('0xbb'),ut[_0xf93a('0xa8')](_0x25b77e,_0xf93a('0xbc')));emitVoiceQueueChannelRemove(ut[_0xf93a('0xa8')](_0x25b77e,_0xf93a('0xbc')));_0x504ff0[_0xf93a('0x3d')]+=0x1;_0x504ff0[_0xf93a('0xbd')]+=0x1;_0x504ff0[_0xf93a('0xbe')]+=0x1;ut['decrementTalkink'](_0x504ff0,'[16]');_0x25b77e[_0xf93a('0xbf')]=ut['totalGlobal'](_0x25b77e);ut[_0xf93a('0x96')](_0x25b77e,0x4,_0xf93a('0xc0'));rpcDb['createCustomerHistory'](_0x25b77e,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xf93a('0x9c')](_0x25b77e,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xf93a('0xc1')](_0x25b77e);_0x504ff0[_0xf93a('0x31')]+=_0x25b77e['talktime'];_0x504ff0[_0xf93a('0x30')]+=_0x25b77e[_0xf93a('0xc2')];logger[_0xf93a('0x5e')](_0xf93a('0xc3'),_0x25b77e[_0xf93a('0xb6')],_0xf93a('0xb7'),_0x504ff0['name'],_0xf93a('0x74'),_0x504ff0[_0xf93a('0x2f')]);delete this['actions'][_0x2d3c22[_0xf93a('0xb1')]];break;case'BUSY':_0x504ff0[_0xf93a('0x3f')]+=0x1;_0x25b77e[_0xf93a('0xc4')]+=0x1;_0x25b77e[_0xf93a('0xbf')]=ut[_0xf93a('0xa5')](_0x25b77e);ut[_0xf93a('0x96')](_0x25b77e,0x5,_0xf93a('0xc5'));ami[_0xf93a('0x29')](_0xf93a('0xc6'),ut[_0xf93a('0xa8')](_0x25b77e,_0xf93a('0xc7')));rpcDb[_0xf93a('0xc8')](_0x25b77e,_0xf93a('0xc9'));if(ut['totalGlobal'](_0x25b77e)>=_0x504ff0['dialGlobalMaxRetry']){_0x23a66e=ut[_0xf93a('0xaa')](_0x25b77e,0xf,_0xf93a('0xab'));rpcDb['createCustomerFinal'](_0x23a66e,_0xf93a('0xca'));}else{if(_0x25b77e[_0xf93a('0xc4')]>=_0x504ff0[_0xf93a('0xcb')]){rpcDb[_0xf93a('0x9c')](_0x25b77e,_0xf93a('0xc9'));}else{rpcDb[_0xf93a('0xad')](ut['scheduledAt'](_0x25b77e,_0xf93a('0xc4'),_0x504ff0[_0xf93a('0xcc')]),_0x25b77e['unlockAgent'],_0x25b77e[_0xf93a('0xb0')]);}}break;case _0xf93a('0xcd'):_0x504ff0[_0xf93a('0xce')]+=0x1;_0x25b77e[_0xf93a('0xcf')]+=0x1;_0x25b77e[_0xf93a('0xbf')]=ut['totalGlobal'](_0x25b77e);ut[_0xf93a('0x96')](_0x25b77e,0x3,_0xf93a('0xd0'));ami[_0xf93a('0x29')](_0xf93a('0xd1'),ut[_0xf93a('0xa8')](_0x25b77e,_0xf93a('0xd2')));rpcDb[_0xf93a('0xc8')](_0x25b77e,_0xf93a('0xd3'));if(ut['totalGlobal'](_0x25b77e)>=_0x504ff0[_0xf93a('0xd4')]){_0x23a66e=ut[_0xf93a('0xaa')](_0x25b77e,0xf,_0xf93a('0xab'));rpcDb['createCustomerFinal'](_0x23a66e,_0xf93a('0xd5'));}else{if(_0x25b77e[_0xf93a('0xcf')]>=_0x504ff0[_0xf93a('0xd6')]){rpcDb['createCustomerFinal'](_0x25b77e,_0xf93a('0xd3'));}else{rpcDb['rescheduleContact'](ut[_0xf93a('0xd7')](_0x25b77e,'countnoanswerretry',_0x504ff0['dialNoAnswerRetryFrequency']),_0x25b77e[_0xf93a('0xaf')],_0x25b77e[_0xf93a('0xb0')]);}}break;case'CONGESTION':_0x504ff0[_0xf93a('0xd8')]+=0x1;_0x25b77e['countcongestionretry']+=0x1;_0x25b77e[_0xf93a('0xbf')]=ut[_0xf93a('0xa5')](_0x25b77e);ut[_0xf93a('0x96')](_0x25b77e,0x8,'Congestion');ami[_0xf93a('0x29')]('custom:agentcongestion',ut[_0xf93a('0xa8')](_0x25b77e,_0xf93a('0xd9')));rpcDb[_0xf93a('0xc8')](_0x25b77e,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xf93a('0xa5')](_0x25b77e)>=_0x504ff0[_0xf93a('0xd4')]){_0x23a66e=ut[_0xf93a('0xaa')](_0x25b77e,0xf,'Global');rpcDb[_0xf93a('0x9c')](_0x23a66e,_0xf93a('0xda'));}else{if(_0x25b77e['countcongestionretry']>=_0x504ff0[_0xf93a('0xdb')]){rpcDb[_0xf93a('0x9c')](_0x25b77e,_0xf93a('0xdc'));}else{rpcDb[_0xf93a('0xad')](ut[_0xf93a('0xd7')](_0x25b77e,'countcongestionretry',_0x504ff0['dialBusyRetryFrequency']),_0x25b77e[_0xf93a('0xaf')],_0x25b77e[_0xf93a('0xb0')]);}}break;case'CANCEL':_0x504ff0['outboundRejectCallsDay']+=0x1;_0x25b77e[_0xf93a('0xdd')]+=0x1;_0x25b77e[_0xf93a('0xbf')]=ut[_0xf93a('0xa5')](_0x25b77e);ut['logCustomer'](_0x25b77e,0x14,_0xf93a('0xde'));ami[_0xf93a('0x29')]('custom:agentreject',ut['buildObj'](_0x25b77e,_0xf93a('0xdf')));rpcDb['createCustomerHistory'](_0x25b77e,'[syncHangupRequest][logAgentReject]');if(ut[_0xf93a('0xa5')](_0x25b77e)>=_0x504ff0[_0xf93a('0xd4')]){_0x23a66e=ut[_0xf93a('0xaa')](_0x25b77e,0x14,_0xf93a('0xde'));rpcDb['createCustomerFinal'](_0x23a66e,_0xf93a('0xe0'));}else{if(_0x25b77e['countagentrejectretry']>=_0x504ff0['dialAgentRejectMaxRetry']){rpcDb[_0xf93a('0x9c')](_0x25b77e,_0xf93a('0xe0'));}else{rpcDb[_0xf93a('0xad')](ut['scheduledAt'](_0x25b77e,_0xf93a('0xdd'),_0x504ff0[_0xf93a('0xe1')]),_0x25b77e[_0xf93a('0xaf')],_0x25b77e[_0xf93a('0xb0')]);}}break;case _0xf93a('0xe2'):_0x504ff0[_0xf93a('0x47')]+=0x1;_0x25b77e['countabandonedretry']+=0x1;_0x25b77e['countglobal']=ut[_0xf93a('0xa5')](_0x25b77e);ut[_0xf93a('0x96')](_0x25b77e,0xb,_0xf93a('0xe3'));rpcDb['createCustomerHistory'](_0x25b77e,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xf93a('0xa5')](_0x25b77e)>=_0x504ff0[_0xf93a('0xd4')]){_0x23a66e=ut[_0xf93a('0xaa')](_0x25b77e,0xf,_0xf93a('0xab'));rpcDb[_0xf93a('0x9c')](_0x23a66e,_0xf93a('0xe4'));}else{if(_0x25b77e[_0xf93a('0xe5')]>=_0x504ff0[_0xf93a('0xe6')]){rpcDb['createCustomerFinal'](_0x25b77e,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xf93a('0xd7')](_0x25b77e,_0xf93a('0xe7'),_0x504ff0[_0xf93a('0xe8')]),_0x25b77e['unlockAgent'],_0x25b77e[_0xf93a('0xb0')]);}}break;default:if(_0x25b77e[_0xf93a('0x76')]){ut[_0xf93a('0x81')](_0x504ff0,'[default]');ut[_0xf93a('0x82')](_0xf93a('0xe9')+_0x504ff0['name'],_0x2d3c22);}_0x504ff0[_0xf93a('0x46')]+=0x1;_0x25b77e[_0xf93a('0xbf')]=ut[_0xf93a('0xa5')](_0x25b77e);ut[_0xf93a('0x96')](_0x25b77e,0xc,_0x2d3c22[_0xf93a('0xea')]||_0x2d3c22['dialstatus']);rpcDb[_0xf93a('0xc8')](_0x25b77e,_0xf93a('0xeb'));if(ut['totalGlobal'](_0x25b77e)>=_0x504ff0[_0xf93a('0xd4')]){_0x23a66e=ut['cloneAction'](_0x25b77e,0xf,_0xf93a('0xab'));rpcDb['createCustomerFinal'](_0x23a66e,_0xf93a('0xec'));}else{rpcDb[_0xf93a('0x9c')](_0x25b77e,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x2d3c22[_0xf93a('0xb1')]];}if(!(_0x25b77e[_0xf93a('0x76')]&&_0x3ec7de==='16')){ut[_0xf93a('0x80')](_0x504ff0,_0xf93a('0xed'));logger[_0xf93a('0x5e')]('[originated][decrement][callProgressDetectingCustomer]',_0x25b77e[_0xf93a('0xb6')],'\x20Queue',_0x504ff0[_0xf93a('0x2c')],_0xf93a('0x73'),_0x504ff0['originated']);}if(_0x3ec7de!==_0xf93a('0xee')){delete this['actions'][_0x2d3c22[_0xf93a('0xb1')]];delete this[_0xf93a('0x17')][_0x2d3c22['destlinkedid']];}}};Preview[_0xf93a('0x11')][_0xf93a('0xef')]=function(_0x1b5a99,_0x1671ed,_0xcfdd19){if(_[_0xf93a('0xf0')](_0x1671ed)&&_0xf93a('0xf1')!==typeof _0x1671ed){return;}if(_[_0xf93a('0xf0')](_0xcfdd19)&&_0xf93a('0xf1')!==typeof _0xcfdd19){return;}switch(_0xcfdd19['reason']){case'0':ut[_0xf93a('0xf2')](_0x1b5a99,0x0,_0xf93a('0xa6'));rpcDb['createAgentHistory'](_0x1b5a99,_0xf93a('0xf3'));break;case'3':ut[_0xf93a('0xf2')](_0x1b5a99,0x3,_0xf93a('0xd0'));rpcDb[_0xf93a('0xf4')](_0x1b5a99,_0xf93a('0xf5'));break;case'5':ut['logAgent'](_0x1b5a99,0x5,'Busy');rpcDb[_0xf93a('0xf4')](_0x1b5a99,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xf93a('0xf2')](_0x1b5a99,0x8,'Congestion');rpcDb[_0xf93a('0xf4')](_0x1b5a99,_0xf93a('0xf6'));break;case'22':ut[_0xf93a('0xf2')](_0x1b5a99,0x16,_0xf93a('0xf7'));rpcDb[_0xf93a('0xf4')](_0x1b5a99,_0xf93a('0xf8'));break;default:ut[_0xf93a('0xf2')](_0x1b5a99,0xc,_0xcfdd19['reason']);rpcDb[_0xf93a('0xf4')](_0x1b5a99,'[callProgressDetectingAgent][logCongestion]');}ut[_0xf93a('0x80')](_0x1671ed,_0xf93a('0xf9'));logger[_0xf93a('0x5e')](_0xf93a('0xfa'),_0x1b5a99[_0xf93a('0xb6')],_0xf93a('0xb7'),_0x1671ed[_0xf93a('0x2c')],'originated:\x20',_0x1671ed[_0xf93a('0x50')]);delete this[_0xf93a('0x17')][_0x1b5a99[_0xf93a('0xb6')]];};Preview[_0xf93a('0x11')][_0xf93a('0xfb')]=function(_0x1489a6,_0x4cfbaa,_0x328375,_0x4f42bc,_0x1eb29b){var _0x761b1e=this;return new BPromise(function(_0x49a5f2,_0x1d1c53){if(_[_0xf93a('0x70')](_0x4cfbaa)||_[_0xf93a('0x70')](_0x4cfbaa[_0xf93a('0xfc')])||_[_0xf93a('0x70')](_0x4cfbaa[_0xf93a('0xfc')][_0xf93a('0xfd')])||_[_0xf93a('0x70')](_0x4cfbaa['VoiceQueueId'])){_0x1d1c53(ut[_0xf93a('0x4f')]('Contact\x20is\x20undefined',_0x4f42bc,_0x1eb29b));return;}var _0x4be67f=uuid['v4']();var _0x4746af=_0x761b1e[_0xf93a('0x15')][_0x4cfbaa[_0xf93a('0x72')]['name']];var _0x25f7fc=_0x328375?_0x761b1e['agents'][_0x328375]['id']:undefined;_0x761b1e['actions'][_0x4be67f]=new Action(_0x4cfbaa,_0x4746af,_0x4be67f,_0x328375,_0x25f7fc);var _0xbee0db=_0x761b1e[_0xf93a('0x17')][_0x4be67f];_0xbee0db[_0xf93a('0xaf')]=_0x4f42bc;_0xbee0db['activeContact']=_0x1eb29b;_0xbee0db[_0xf93a('0xfe')]=_0x328375;if(_[_0xf93a('0xff')](_0x1489a6)){_0x761b1e[_0xf93a('0x100')](_0xbee0db,_0x4746af,_0x4cfbaa,_0x328375)[_0xf93a('0x8a')](function(_0x2fbaff){logger[_0xf93a('0x5e')]('[Preview][execCall][success]',_0xf93a('0x101')+_0xbee0db[_0xf93a('0x75')]+_0xf93a('0x102')+_0xbee0db[_0xf93a('0x103')],JSON[_0xf93a('0x5b')](_0x2fbaff));ami['emit']('custom:agentcalled',ut['buildObj'](_0xbee0db,'called'));_0x49a5f2(ut[_0xf93a('0x4f')](_0xf93a('0x104')));})['catch'](function(_0x54ecef){ut['logger']('[Preview][execCall][failure]',_0x54ecef);_0x1d1c53(ut[_0xf93a('0x4f')](_0xf93a('0x105'),_0x4f42bc,_0x1eb29b));});}else{_0x4746af[_0xf93a('0x3e')]+=0x1;ut[_0xf93a('0x106')](_0xbee0db);rpcDb['createHistory'](_0xbee0db,_0xf93a('0x107'));delete _0x761b1e['actions'][_0x4be67f];_0x1d1c53(ut['message'](_0xf93a('0x108'),_0x4f42bc,_0x1eb29b));}});};Preview[_0xf93a('0x11')]['isTrunkReachable']=function(_0x4ab189){return!_[_0xf93a('0x70')](_0x4ab189)&&!_[_0xf93a('0x70')](_0x4ab189[_0xf93a('0x2c')])&&!_[_0xf93a('0x70')](_0x4ab189[_0xf93a('0x58')])&&_0x4ab189['active']&&!_['isNil'](this['trunks'][util[_0xf93a('0x5c')]('SIP/%s',_0x4ab189['name'])])&&!_[_0xf93a('0x70')](this[_0xf93a('0x16')][util[_0xf93a('0x5c')]('SIP/%s',_0x4ab189['name'])][_0xf93a('0x7d')])&&(this[_0xf93a('0x16')][util['format'](_0xf93a('0x109'),_0x4ab189[_0xf93a('0x2c')])]['status']===_0xf93a('0x10a')||this[_0xf93a('0x16')][util['format']('SIP/%s',_0x4ab189[_0xf93a('0x2c')])][_0xf93a('0x7d')]==='unmonitored');};Preview[_0xf93a('0x11')]['run']=function(_0x231248,_0x21ff67){var _0x77317b=this;return new BPromise(function(_0x42a13f,_0x412184){_0x77317b[_0xf93a('0x10b')](_0x231248,_0x21ff67)['then'](function(_0x2a7ee8){_0x42a13f(_[_0xf93a('0x77')](_0x2a7ee8,[_0xf93a('0x4f')]));})[_0xf93a('0x7f')](function(_0x21f644){if(_0x21f644[_0xf93a('0x10c')]){rpcDb[_0xf93a('0x10d')](_0x231248);}if(_0x21f644[_0xf93a('0x58')]){rpcDb[_0xf93a('0x94')](_0x231248);}_0x412184(_[_0xf93a('0x77')](_0x21f644,['message']));});});};Preview[_0xf93a('0x11')]['execRun']=function(_0x29aee3,_0x38da9b){var _0x2d0dff=this;return new BPromise(function(_0x5e78c9,_0x26dbfa){var _0x39d1e6,_0x3c4258;rpcDb[_0xf93a('0x10e')](_0x29aee3)['then'](function(_0x539ee2){if(!_[_0xf93a('0x70')](_0x539ee2[0x0])){_0x3c4258=_0x539ee2[0x0][_0xf93a('0x10f')]?![]:!![];_0x39d1e6=_0x539ee2[0x0][_0xf93a('0x10f')]?!![]:![];_0x39d1e6=_0x38da9b?!![]:_0x39d1e6;}var _0x1291f9=_0x2d0dff['validateContact'](_0x539ee2);if(_0x1291f9[_0xf93a('0x110')]){rpcDb[_0xf93a('0x111')](_[_0xf93a('0x77')](_0x539ee2[0x0],['VoiceQueueId',_0xf93a('0x112')]))[_0xf93a('0x8a')](function(_0x7fe057){_0x2d0dff[_0xf93a('0xfb')](_0x7fe057,_0x539ee2[0x0],_0x38da9b,_0x3c4258,_0x39d1e6)[_0xf93a('0x8a')](function(_0x564bc0){_0x5e78c9(_0x564bc0);})[_0xf93a('0x7f')](function(_0x14d38d){_0x26dbfa(_0x14d38d);});})['catch'](function(_0x3d1b8f){ut['logger'](_0xf93a('0x113'),_0x3d1b8f);_0x26dbfa(ut[_0xf93a('0x4f')](_0xf93a('0x114'),_0x3c4258,_0x39d1e6));});}else{_0x26dbfa(ut[_0xf93a('0x4f')](_0x1291f9['message'],_0x3c4258,_0x39d1e6));}})[_0xf93a('0x7f')](function(_0x15ad00){ut[_0xf93a('0x65')](_0xf93a('0x115'),_0x15ad00);_0x26dbfa(ut['message'](_0xf93a('0x114'),![],!![]));});});};Preview[_0xf93a('0x11')]['validateContact']=function(_0x1f80db){if(_['isNil'](_0x1f80db)||_['isEmpty'](_0x1f80db)||!_[_0xf93a('0x70')](_0x1f80db[0x0]['Agent'])&&_[_0xf93a('0x70')](_0x1f80db[0x0][_0xf93a('0x8f')]['name'])){ut[_0xf93a('0x65')](_0xf93a('0x116'),_0x1f80db);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x58e3de=this['campaignsPreview'][_0x1f80db[0x0][_0xf93a('0x72')]['name']];_0x58e3de[_0xf93a('0x4f')]='ACTIVE';if(_['isNil'](_0x58e3de)){ut[_0xf93a('0x65')](_0xf93a('0x117'),_0x58e3de);return{'isValid':![],'message':_0xf93a('0x118')};}if(!this['isTrunkReachable'](_0x58e3de[_0xf93a('0x57')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x58e3de[_0xf93a('0x2c')]+_0xf93a('0x119'));if(!this[_0xf93a('0xa0')](_0x58e3de[_0xf93a('0x11a')])){ut[_0xf93a('0x65')](_0xf93a('0x11b'),_0x58e3de['name']+_0xf93a('0x11c'));return{'isValid':![],'message':_0xf93a('0x11d')};}}if(!ut[_0xf93a('0x9f')](_0x58e3de[_0xf93a('0x36')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x58e3de['name']+_0xf93a('0x11e'));return{'isValid':![],'message':_0xf93a('0x11f')+_0x58e3de['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xf93a('0x11')][_0xf93a('0x100')]=function(_0x4363d6,_0x593501,_0x3ad4e8,_0x2014e6){var _0x1d66e1=this;return new BPromise(function(_0x240c4d,_0x3188bd){var _0x4378c4=_0x4363d6['uniqueid'];var _0x3b41a1=_0x1d66e1[_0xf93a('0xa0')](_0x593501[_0xf93a('0x57')])?util[_0xf93a('0x5c')](_0xf93a('0x120'),_0x593501[_0xf93a('0x57')][_0xf93a('0x2c')],_[_0xf93a('0x70')](_0x593501[_0xf93a('0x3b')])?'':_0x593501[_0xf93a('0x3b')][_0xf93a('0x121')]()||'',_0x593501['dialCutDigit']>0x0?_0x3ad4e8[_0xf93a('0xfc')][_0xf93a('0xfd')][_0xf93a('0x122')](_0x593501[_0xf93a('0x123')]):_0x3ad4e8[_0xf93a('0xfc')][_0xf93a('0xfd')]):util[_0xf93a('0x5c')](_0xf93a('0x120'),_[_0xf93a('0x70')](_0x593501['TrunkBackup'])?_0x593501[_0xf93a('0x57')][_0xf93a('0x2c')]:_0x593501[_0xf93a('0x11a')][_0xf93a('0x2c')],_[_0xf93a('0x70')](_0x593501['dialPrefix'])?'':_0x593501[_0xf93a('0x3b')][_0xf93a('0x121')]()||'',_0x593501[_0xf93a('0x123')]>0x0?_0x3ad4e8['Contact'][_0xf93a('0xfd')][_0xf93a('0x122')](_0x593501['dialCutDigit']):_0x3ad4e8[_0xf93a('0xfc')][_0xf93a('0xfd')]);var _0x516c08=_0x1d66e1[_0xf93a('0xa0')](_0x593501[_0xf93a('0x57')])?ut[_0xf93a('0x124')](_0x593501[_0xf93a('0x57')][_0xf93a('0x59')],_0x593501['dialOriginateCallerIdName'],_0x593501['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xf93a('0x125')](_0x593501[_0xf93a('0x39')],_0x593501[_0xf93a('0x126')]):_0x593501[_0xf93a('0x39')]):ut[_0xf93a('0x124')](_[_0xf93a('0x70')](_0x593501[_0xf93a('0x11a')])?_0x593501['Trunk'][_0xf93a('0x59')]:_0x593501[_0xf93a('0x11a')][_0xf93a('0x59')],_0x593501[_0xf93a('0x38')],_0x593501[_0xf93a('0x126')]>0x0?ut[_0xf93a('0x125')](_0x593501[_0xf93a('0x39')],_0x593501['dialRandomLastDigitCallerIdNumber']):_0x593501[_0xf93a('0x39')]);if(_0x516c08){_0x4363d6[_0xf93a('0x127')]=ut[_0xf93a('0x128')](_0x516c08);_0x4363d6[_0xf93a('0x129')]=ut['extractCalleridNumber'](_0x516c08);}var _0x183238=ut['addVariables'](_0x593501,_0x3ad4e8,_0x3b41a1,_0x516c08,_0x4378c4,_0x4363d6);_[_0xf93a('0x12a')](_0x4363d6,ut[_0xf93a('0x12b')](_0x183238));_0x4363d6[_0xf93a('0x95')]=moment()[_0xf93a('0x5c')](_0xf93a('0xb2'));ami[_0xf93a('0x7c')](ut[_0xf93a('0x12c')](_0x4363d6,_0x593501,_0x183238,_0x4363d6[_0xf93a('0xb0')],_0x2014e6))[_0xf93a('0x8a')](function(_0x136e6f){_0x593501[_0xf93a('0x50')]+=0x1;logger[_0xf93a('0x5e')](_0xf93a('0x12d'),_0x4378c4,_0xf93a('0xb7'),_0x593501['name'],_0xf93a('0x73'),_0x593501[_0xf93a('0x50')]);_0x240c4d(_0x136e6f);})[_0xf93a('0x7f')](function(_0x47a75c){ut[_0xf93a('0xf2')](_0x4363d6,0xe,'OriginateError');rpcDb[_0xf93a('0xf4')](_0x4363d6,_0xf93a('0x12e'));_0x3188bd(_0x47a75c);});});};Preview[_0xf93a('0x11')][_0xf93a('0x23')]=function(_0x1ae4fb){if(this[_0xf93a('0x17')][_0x1ae4fb[_0xf93a('0xb1')]]){this['actions'][_0x1ae4fb[_0xf93a('0xb1')]][_0xf93a('0x7e')]=_0x1ae4fb[_0xf93a('0x7e')];}};Preview['prototype'][_0xf93a('0x1b')]=function(_0xf609bf){var _0x44df03=this;var _0x5a4e5c=this[_0xf93a('0x17')][_0xf609bf['actionid']];if(_0x5a4e5c){if(_0x5a4e5c[_0xf93a('0xfe')]&&this[_0xf93a('0x18')][_0x5a4e5c[_0xf93a('0xfe')]]){ut['logLookAgent'](_0x5a4e5c,this['agents'][_0x5a4e5c[_0xf93a('0xfe')]][_0xf93a('0x2c')],this[_0xf93a('0x18')][_0x5a4e5c[_0xf93a('0xfe')]]['id']);}var _0x1097cf=_['clone'](_0x5a4e5c);_0x1097cf[_0xf93a('0xb3')]=moment()[_0xf93a('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x30ac8e=_0x44df03['campaignsPreview'][_0x5a4e5c[_0xf93a('0x75')]];if(ut[_0xf93a('0x12f')](_0xf609bf[_0xf93a('0x130')])){if(_0x5a4e5c[_0xf93a('0xaf')]){rpcDb[_0xf93a('0x10d')](_0x5a4e5c['idContact']);}if(_0x5a4e5c[_0xf93a('0xb0')]){rpcDb[_0xf93a('0x94')](_0x5a4e5c['idContact']);}ami[_0xf93a('0x29')](_0xf93a('0x131'),ut[_0xf93a('0xa8')](_0x5a4e5c,'rejected'));this['callProgressDetectingAgent'](_0x1097cf,_0x30ac8e,_0xf609bf);}else{_0x5a4e5c[_0xf93a('0x95')]=moment()[_0xf93a('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xf93a('0xf2')](_0x1097cf,0x4,'Answer');rpcDb[_0xf93a('0xf4')](_0x1097cf,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xf93a('0x11')][_0xf93a('0x1e')]=function(_0x3899ac){var _0x12b981=this;var _0x1940fb=this[_0xf93a('0x17')][_0x3899ac[_0xf93a('0xb1')]];var _0x214bf8;if(_0x1940fb){_0x214bf8=this[_0xf93a('0x15')][_0x1940fb['queue']];logger[_0xf93a('0x5e')](_0xf93a('0x132'),_0x3899ac['linkedid'],_0xf93a('0xb7'),_0x214bf8[_0xf93a('0x2c')],_0xf93a('0x74'),_0x214bf8[_0xf93a('0x2f')]);}if(this[_0xf93a('0x17')][_0x3899ac[_0xf93a('0xb1')]]&&_0x3899ac['linkedid']!==_0x3899ac[_0xf93a('0xb6')]){if(_0x3899ac[_0xf93a('0x133')]==='16'&&this[_0xf93a('0x17')][_0x3899ac[_0xf93a('0xb1')]]['dialAnswer']){this[_0xf93a('0xa3')](_0x3899ac,_0x3899ac[_0xf93a('0xb1')],_0x3899ac[_0xf93a('0x133')]);}else if(this[_0xf93a('0x17')][_0x3899ac['linkedid']][_0xf93a('0x76')]){logger[_0xf93a('0x5e')](_0xf93a('0x134'),_0x3899ac[_0xf93a('0xb1')],_0x3899ac['cause'],_0xf93a('0xb7'),_0x214bf8['name'],'pTalking:\x20',_0x214bf8[_0xf93a('0x2f')]);this['callProgressDetectingCustomer'](_0x3899ac,_0x3899ac[_0xf93a('0xb1')],_0x3899ac[_0xf93a('0x133')]);}}else if(_0x1940fb&&_[_0xf93a('0x70')](_0x1940fb[_0xf93a('0x135')])&&_0x214bf8[_0xf93a('0x136')]&&_0x3899ac[_0xf93a('0xb1')]===_0x3899ac[_0xf93a('0xb6')]&&_[_0xf93a('0x70')](_0x3899ac[_0xf93a('0x137')])&&_0x3899ac['cause']==='16'&&_0x3899ac[_0xf93a('0x138')]==='6'&&_[_0xf93a('0xf0')](_0x1940fb[_0xf93a('0x139')])){if(_0x1940fb[_0xf93a('0xaf')]){rpcDb[_0xf93a('0x10d')](_0x1940fb[_0xf93a('0x103')]);}if(_0x1940fb[_0xf93a('0xb0')]){rpcDb[_0xf93a('0x94')](_0x1940fb[_0xf93a('0x103')]);}_0x3899ac['reason']='22';this['callProgressDetectingAgent'](_0x1940fb,_0x214bf8,_0x3899ac);}else if(_0x1940fb&&_0x1940fb['transfer']){if(_0x3899ac[_0xf93a('0x133')]==='16'&&this['actions'][_0x3899ac[_0xf93a('0xb1')]][_0xf93a('0x76')]){logger[_0xf93a('0x5e')](_0xf93a('0x13a'),_0x3899ac[_0xf93a('0xb1')],_0x3899ac[_0xf93a('0x133')],'\x20Queue',_0x214bf8['name'],_0xf93a('0x74'),_0x214bf8[_0xf93a('0x2f')]);this[_0xf93a('0xa3')](_0x3899ac,_0x3899ac['linkedid'],_0x3899ac[_0xf93a('0x133')]);}else if(this[_0xf93a('0x17')][_0x3899ac['linkedid']]['dialAnswer']){logger['info'](_0xf93a('0x134'),_0x3899ac['linkedid'],_0x3899ac['cause'],_0xf93a('0xb7'),_0x214bf8[_0xf93a('0x2c')],_0xf93a('0x74'),_0x214bf8[_0xf93a('0x2f')]);this[_0xf93a('0xa3')](_0x3899ac,_0x3899ac['linkedid'],_0x3899ac[_0xf93a('0x133')]);}}};Preview[_0xf93a('0x11')][_0xf93a('0x13b')]=function(_0x293042){if(this[_0xf93a('0x17')][_0x293042[_0xf93a('0x13c')]]&&_0x293042['destlinkedid']!==_0x293042[_0xf93a('0x13d')]){this[_0xf93a('0xa3')](_0x293042,_0x293042['destlinkedid'],_0x293042['dialstatus']);}};Preview[_0xf93a('0x11')]['syncHangupRequest']=function(_0x2e6e25){if(this['actions'][_0x2e6e25['linkedid']]&&_0x2e6e25[_0xf93a('0xb1')]!==_0x2e6e25[_0xf93a('0xb6')]&&!this[_0xf93a('0x17')][_0x2e6e25[_0xf93a('0xb1')]][_0xf93a('0x76')]){if(_0x2e6e25['cause']==='1'){this[_0xf93a('0xa3')](_0x2e6e25,_0x2e6e25['linkedid'],_0x2e6e25['cause']);}}};Preview['prototype']['addVariable']=function(_0x1064b9,_0x50d766,_0x398239){if(this[_0xf93a('0x17')][_0x1064b9]){if(_[_0xf93a('0x70')](this[_0xf93a('0x17')][_0x1064b9][_0xf93a('0x13e')])){this[_0xf93a('0x17')][_0x1064b9][_0xf93a('0x13e')]={};}this['actions'][_0x1064b9][_0xf93a('0x13e')][_0x50d766]=_0x398239;}};Preview[_0xf93a('0x11')]['syncVarSet']=function(_0x4a7eb1){try{if(!_[_0xf93a('0x70')](_0x4a7eb1)){if(ut[_0xf93a('0x13f')](_[_0xf93a('0x140')](_0x4a7eb1[_0xf93a('0x141')])[0x0])){this[_0xf93a('0x142')](_0x4a7eb1[_0xf93a('0xb6')],_[_0xf93a('0x140')](_0x4a7eb1[_0xf93a('0x141')])[0x0],_0x4a7eb1[_0xf93a('0x143')]);}}}catch(_0x137257){logger[_0xf93a('0x144')](_0xf93a('0x145'),util['inspect'](_0x137257,{'showHidden':![],'depth':null}));}};Preview[_0xf93a('0x11')]['syncAttendedTransfer']=function(_0x1f67ae){if(_0x1f67ae){if(this['actions'][_0x1f67ae[_0xf93a('0x146')]]){this[_0xf93a('0x17')][_0x1f67ae[_0xf93a('0x146')]][_0xf93a('0x139')]=!![];}}};Preview['prototype'][_0xf93a('0x27')]=function(_0x13355e){if(_0x13355e){if(this['actions'][_0x13355e['transfererlinkedid']]){this['actions'][_0x13355e[_0xf93a('0x147')]]['transfer']=!![];}}};module[_0xf93a('0x148')]=Preview; \ No newline at end of file +var _0x70e8=['unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedretry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','called','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlockContact','active','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','substring','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','isFailure','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','preview','actionPreview','../ami','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','originated','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','then','isNil','getDiff','scheduledat','Agent','voicePause','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','responsetime','answertime','uniqueid','connect','custom:agentConnectPreview','buildAcw','complete','total','answered','[16]','totalGlobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','countbusyretry','dialBusyMaxRetry'];(function(_0x2129d8,_0x162523){var _0x44e139=function(_0x85a27a){while(--_0x85a27a){_0x2129d8['push'](_0x2129d8['shift']());}};_0x44e139(++_0x162523);}(_0x70e8,0x1d9));var _0x870e=function(_0xa5a889,_0x47f48a){_0xa5a889=_0xa5a889-0x0;var _0x4c0ead=_0x70e8[_0xa5a889];return _0x4c0ead;};'use strict';var util=require(_0x870e('0x0'));var _=require(_0x870e('0x1'));var BPromise=require('bluebird');var uuid=require(_0x870e('0x2'));var moment=require(_0x870e('0x3'));var md5=require(_0x870e('0x4'));var Redis=require(_0x870e('0x5'));var config=require(_0x870e('0x6'));var logger=require('../../../config/logger')(_0x870e('0x7'));var loggerAction=require('../../../config/logger')(_0x870e('0x8'));var ami=require(_0x870e('0x9'));var rpcDb=require(_0x870e('0xa'));var Action=require(_0x870e('0xb'));var ut=require(_0x870e('0xc'));config['redis']=_[_0x870e('0xd')](config[_0x870e('0xe')],{'host':_0x870e('0xf'),'port':0x18eb});var io=require(_0x870e('0x10'))(new Redis(config[_0x870e('0xe')]));var Sequence=function(){};Sequence[_0x870e('0x11')][_0x870e('0x12')]=function(_0x41c12a){this[_0x870e('0x13')]=this[_0x870e('0x13')]?this['tail'][_0x870e('0x14')](_0x41c12a):_0x41c12a();};function Preview(_0x64a4ac){this[_0x870e('0x15')]=new Sequence();this[_0x870e('0x16')]=_0x64a4ac[_0x870e('0x17')];this['trunks']=_0x64a4ac[_0x870e('0x18')];this[_0x870e('0x19')]={};this[_0x870e('0x1a')]=_0x64a4ac[_0x870e('0x1a')];this[_0x870e('0x1b')]=0x0;ami['on']('originateresponse',this[_0x870e('0x1c')][_0x870e('0x1d')](this));ami['on'](_0x870e('0x1e'),this['syncHangup'][_0x870e('0x1d')](this));ami['on'](_0x870e('0x1f'),this[_0x870e('0x20')][_0x870e('0x1d')](this));ami['on']('dialend',this[_0x870e('0x21')][_0x870e('0x1d')](this));ami['on'](_0x870e('0x22'),this[_0x870e('0x23')]['bind'](this));ami['on'](_0x870e('0x24'),this[_0x870e('0x25')][_0x870e('0x1d')](this));ami['on'](_0x870e('0x26'),this[_0x870e('0x27')][_0x870e('0x1d')](this));ami['on']('blindtransfer',this[_0x870e('0x28')]['bind'](this));this[_0x870e('0x29')](this[_0x870e('0x16')]);}function emit(_0x359b92,_0x220289,_0x4bc444){io['to'](_0x359b92)['emit'](_0x220289,_0x4bc444);}function emitCampaignPreview(_0x525301){if(_0x525301[_0x870e('0x2a')]===_0x870e('0x2b')){var _0x1d46eb={'id':_0x525301['id'],'name':_0x525301[_0x870e('0x2c')],'strategy':_0x525301[_0x870e('0x2d')],'answered':_0x525301['answered'],'available':_0x525301['available'],'loggedIn':_0x525301[_0x870e('0x2e')],'pTalking':_0x525301[_0x870e('0x2f')],'sumBillable':_0x525301[_0x870e('0x30')],'sumDuration':_0x525301[_0x870e('0x31')],'sumHoldTime':_0x525301[_0x870e('0x32')]||0x0,'talking':_0x525301[_0x870e('0x33')],'total':_0x525301['total'],'type':_0x525301['type'],'unmanaged':_0x525301[_0x870e('0x34')],'abandoned':_0x525301[_0x870e('0x35')],'waiting':_0x525301[_0x870e('0x36')],'loggedInDb':_0x525301['loggedInDb'],'dialActive':_0x525301[_0x870e('0x37')],'dialMethod':_0x525301[_0x870e('0x38')],'dialOriginateCallerIdName':_0x525301[_0x870e('0x39')],'dialOriginateCallerIdNumber':_0x525301[_0x870e('0x3a')],'dialOriginateTimeout':_0x525301['dialOriginateTimeout'],'dialPrefix':_0x525301[_0x870e('0x3b')],'outboundAnswerAgiCallsDay':_0x525301[_0x870e('0x3c')],'outboundAnswerCallsDay':_0x525301[_0x870e('0x3d')],'outboundBlacklistCallsDay':_0x525301[_0x870e('0x3e')],'outboundBusyCallsDay':_0x525301[_0x870e('0x3f')],'outboundCongestionCallsDay':_0x525301[_0x870e('0x40')],'outboundDropCallsDayACS':_0x525301[_0x870e('0x41')],'outboundDropCallsDayCallersExit':_0x525301[_0x870e('0x42')],'outboundDropCallsDayTimeout':_0x525301[_0x870e('0x43')],'outboundNoAnswerCallsDay':_0x525301[_0x870e('0x44')],'outboundNoSuchCallsDay':_0x525301[_0x870e('0x45')],'outboundOriginateFailureCallsDay':_0x525301[_0x870e('0x46')],'outboundReCallsDay':_0x525301[_0x870e('0x47')],'outboundRejectCallsDay':_0x525301[_0x870e('0x48')],'outboundUnknownCallsDay':_0x525301['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x525301[_0x870e('0x49')],'predictiveIntervalAnsweredCalls':_0x525301[_0x870e('0x4a')],'predictiveIntervalAvgHoldtime':_0x525301[_0x870e('0x4b')],'predictiveIntervalAvgTalktime':_0x525301[_0x870e('0x4c')],'predictiveIntervalDroppedCallsCallersExit':_0x525301['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x525301[_0x870e('0x4d')],'predictiveIntervalErlangCalls':_0x525301[_0x870e('0x4e')],'predictiveIntervalErlangCallsDroppedCalls':_0x525301[_0x870e('0x4f')],'predictiveIntervalHitRate':_0x525301[_0x870e('0x50')],'predictiveIntervalMultiplicativeFactor':_0x525301['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x525301['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x525301[_0x870e('0x51')],'predictiveIntervalTotalCalls':_0x525301[_0x870e('0x52')],'message':_0x525301[_0x870e('0x53')],'originated':_0x525301['originated'],'erlangCalls':_0x525301[_0x870e('0x54')],'erlangCallToSecond':_0x525301['erlangCallToSecond'],'erlangAbandonmentRate':_0x525301[_0x870e('0x55')],'erlangBusyFactor':_0x525301[_0x870e('0x56')],'startPredictive':_0x525301[_0x870e('0x57')],'startProgressive':_0x525301[_0x870e('0x58')]};if(_0x525301[_0x870e('0x59')]){_0x1d46eb[_0x870e('0x59')]={'id':_0x525301[_0x870e('0x59')]['id'],'name':_0x525301[_0x870e('0x59')]['name'],'active':_0x525301[_0x870e('0x59')]['active'],'callerid':_0x525301[_0x870e('0x59')][_0x870e('0x5a')]};}if(_0x525301[_0x870e('0x5b')]){_0x1d46eb[_0x870e('0x5b')]={'id':_0x525301['Interval']['id'],'name':_0x525301[_0x870e('0x5b')][_0x870e('0x2c')]};}var _0x1c5f40=md5(JSON['stringify'](_0x1d46eb));if(_0x525301[_0x870e('0x4')]!==_0x1c5f40){_0x525301['md5']=_0x1c5f40;emit(util[_0x870e('0x5c')](_0x870e('0x5d'),_0x1d46eb[_0x870e('0x2c')]),'voice_queue:save',_0x1d46eb);}}}function emitVoiceQueueChannelRemove(_0x4b0a45){logger[_0x870e('0x5e')](_0x870e('0x5f'),JSON[_0x870e('0x60')](_0x4b0a45));emit(util[_0x870e('0x5c')]('voice:queue:%s',_0x4b0a45[_0x870e('0x2c')]),_0x870e('0x61'),_0x4b0a45);}function notSendMessagesQueue(_0x1d6621){if(_0x1d6621['sendMessageOneNotActive']){if(_0x1d6621[_0x870e('0x62')]===0x0&&_0x1d6621[_0x870e('0x2f')]===0x0){_0x1d6621['sendMessageOneNotActive']=![];_0x1d6621[_0x870e('0x63')]=0x0;_0x1d6621[_0x870e('0x64')]=0x0;_0x1d6621['message']=_0x870e('0x65');ut[_0x870e('0x66')](_0x870e('0x67'),_0x1d6621[_0x870e('0x2c')]+_0x870e('0x68'));}else{_0x1d6621[_0x870e('0x53')]=_0x870e('0x69');ut[_0x870e('0x66')](_0x870e('0x67'),_0x1d6621[_0x870e('0x2c')]+_0x870e('0x6a'));}emitCampaignPreview(_0x1d6621);}}Preview[_0x870e('0x11')][_0x870e('0x29')]=function(){var _0x51a3ad=this;setInterval(function(){_0x51a3ad[_0x870e('0x6b')]();},0x7cf);};Preview['prototype'][_0x870e('0x6b')]=function(){var _0x25d1cc=this[_0x870e('0x16')];this[_0x870e('0x1b')]+=0x1;for(var _0x2f3c96 in _0x25d1cc){if(_0x25d1cc[_0x870e('0x6c')](_0x2f3c96)&&(_0x25d1cc[_0x2f3c96]['dialMethod']===_0x870e('0x7')||_0x25d1cc[_0x2f3c96][_0x870e('0x38')]===_0x870e('0x6d'))&&_0x25d1cc[_0x2f3c96][_0x870e('0x2a')]===_0x870e('0x2b')){if(this[_0x870e('0x1b')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x25d1cc['hasOwnProperty'](_0x2f3c96)&&_0x25d1cc[_0x2f3c96][_0x870e('0x38')]==='preview'&&_0x25d1cc[_0x2f3c96][_0x870e('0x2a')]===_0x870e('0x2b')){if(_0x25d1cc[_0x2f3c96][_0x870e('0x37')]){this[_0x870e('0x6e')](_0x25d1cc[_0x2f3c96]);this[_0x870e('0x6f')](_0x25d1cc[_0x2f3c96]);}else{notSendMessagesQueue(_0x25d1cc[_0x2f3c96]);}}}};Preview[_0x870e('0x11')][_0x870e('0x70')]=function(_0xdb23e2){var _0x1043bc=this;this[_0x870e('0x15')][_0x870e('0x12')](function(){if(!_['isNil'](_0x1043bc[_0x870e('0x19')][_0xdb23e2])){loggerAction[_0x870e('0x5e')](_0x870e('0x71'),_0xdb23e2,_0x870e('0x72'),_0x1043bc[_0x870e('0x19')][_0xdb23e2]['queue'],_0x870e('0x73'),JSON['stringify'](_0x1043bc['campaignsPreview'][_0x1043bc[_0x870e('0x19')][_0xdb23e2][_0x870e('0x74')]][_0x870e('0x62')]),_0x870e('0x75'),JSON['stringify'](_0x1043bc[_0x870e('0x16')][_0x1043bc['actions'][_0xdb23e2][_0x870e('0x74')]]['pTalking']),JSON[_0x870e('0x60')](_0x1043bc[_0x870e('0x19')][_0xdb23e2][_0x870e('0x76')]),JSON[_0x870e('0x60')](_[_0x870e('0x77')](_0x1043bc['actions'][_0xdb23e2],[_0x870e('0x78'),'UserId',_0x870e('0x79'),_0x870e('0x7a')])));return ami['Action']({'action':_0x870e('0x7b'),'channel':_0x1043bc['actions'][_0xdb23e2]['channel']})['catch'](function(_0x311989){if(_0x311989[_0x870e('0x53')]===_0x870e('0x7c')){setTimeout(function(){if(_0x1043bc[_0x870e('0x19')][_0xdb23e2]){ut['updateOriginated'](_0x1043bc[_0x870e('0x16')][_0x1043bc[_0x870e('0x19')][_0xdb23e2][_0x870e('0x74')]],_0x870e('0x7d'));if(_0x1043bc[_0x870e('0x19')][_0xdb23e2][_0x870e('0x76')]===!![]){ut[_0x870e('0x7e')](_0x1043bc['campaignsPreview'][_0x1043bc[_0x870e('0x19')][_0xdb23e2][_0x870e('0x74')]],_0x870e('0x7d'));ut[_0x870e('0x7f')](_0x870e('0x80')+_0xdb23e2,_0x1043bc[_0x870e('0x19')][_0xdb23e2][_0x870e('0x74')]);}ut['loggerError'](_0x870e('0x81')+_0xdb23e2,_0x1043bc['actions'][_0xdb23e2][_0x870e('0x74')]);delete _0x1043bc[_0x870e('0x19')][_0xdb23e2];}},0x2328);}});}});};Preview['prototype'][_0x870e('0x82')]=function(){var _0x416794=this;loggerAction[_0x870e('0x5e')](_0x870e('0x83'),_[_0x870e('0x84')](this['actions']));for(var _0x155143 in this[_0x870e('0x19')]){if(_0x416794[_0x870e('0x19')][_0x870e('0x6c')](_0x155143)){_0x416794[_0x870e('0x70')](_0x155143);}}};Preview[_0x870e('0x11')]['recallMe']=function(_0x34734d){var _0x363f26=this;rpcDb['getContactRecallMe'](_0x34734d['id'],ut['agentReadyId'](this[_0x870e('0x1a')]))[_0x870e('0x85')](function(_0xded23c){if(!_[_0x870e('0x86')](_0xded23c)){for(var _0x249e2d=0x0;_0x249e2d<_0xded23c['length'];_0x249e2d+=0x1){if(ut[_0x870e('0x87')](_0xded23c[_0x249e2d][_0x870e('0x88')])<_0x34734d['dialRecallMeTimeout']*0x3c){if(_0xded23c[_0x249e2d][_0x870e('0x89')]&&!_0xded23c[_0x249e2d][_0x870e('0x89')][_0x870e('0x8a')]){_0x363f26['run'](_0xded23c[_0x249e2d]['id'])[_0x870e('0x85')](ut[_0x870e('0x8b')](_0x870e('0x8c')))[_0x870e('0x8d')](ut[_0x870e('0x8b')](_0x870e('0x8c')));}else{rpcDb[_0x870e('0x8e')](_0xded23c[_0x249e2d]['id']);}}else{var _0x1093f0=new Action(_0xded23c[_0x249e2d],_0x34734d);_0x1093f0[_0x870e('0x8f')]=moment()['format'](_0x870e('0x90'));_0x34734d[_0x870e('0x47')]+=0x1;ut[_0x870e('0x91')](_0x1093f0,0x17,_0x870e('0x92'));if(_0x34734d[_0x870e('0x93')]){rpcDb[_0x870e('0x94')](ut['createBody'](_0xded23c[_0x249e2d]));rpcDb[_0x870e('0x95')](_0x1093f0,_0x870e('0x96'));}else{ut[_0x870e('0x91')](_0x1093f0,0x16,_0x870e('0x97'));rpcDb[_0x870e('0x95')](_0x1093f0,'[HistoryRecallClose]');rpcDb[_0x870e('0x98')](_0x1093f0,_0x870e('0x99'));}}}}})[_0x870e('0x8d')](ut[_0x870e('0x8b')](_0x870e('0x9a')));};Preview['prototype'][_0x870e('0x6e')]=function(_0x3ecb52){_0x3ecb52[_0x870e('0x9b')]=!![];if(ut[_0x870e('0x9c')](_0x3ecb52[_0x870e('0x2e')])){_0x3ecb52[_0x870e('0x53')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x870e('0x9d')](_0x3ecb52[_0x870e('0x37')])){_0x3ecb52[_0x870e('0x53')]=_0x870e('0x65');}else if(!this[_0x870e('0x9e')](_0x3ecb52[_0x870e('0x59')])){if(!this[_0x870e('0x9e')](_0x3ecb52[_0x870e('0x9f')])){_0x3ecb52[_0x870e('0x53')]=_0x870e('0xa0');}else{_0x3ecb52[_0x870e('0x53')]=_0x870e('0xa1');}}else{_0x3ecb52[_0x870e('0x53')]=_0x870e('0xa1');}emitCampaignPreview(_0x3ecb52);};Preview[_0x870e('0x11')][_0x870e('0xa2')]=function(_0x541a0d,_0x33c4a3,_0x5f5411){var _0x525c07=this;var _0x8f592f=this[_0x870e('0x19')][_0x33c4a3];var _0x43fe94=this[_0x870e('0x16')][_0x8f592f['queue']];var _0x5d77dc;if(_0x43fe94){switch(_0x5f5411){case'1':_0x43fe94[_0x870e('0x45')]+=0x1;_0x8f592f['countnosuchnumberretry']+=0x1;_0x8f592f[_0x870e('0xa3')]=ut['totalGlobal'](_0x8f592f);ut[_0x870e('0x91')](_0x8f592f,0x0,_0x870e('0xa4'));ami[_0x870e('0xa5')](_0x870e('0xa6'),ut[_0x870e('0xa7')](_0x8f592f,_0x870e('0xa8')));rpcDb[_0x870e('0x95')](_0x8f592f,_0x870e('0xa9'));if(ut['totalGlobal'](_0x8f592f)>=_0x43fe94[_0x870e('0xaa')]){_0x5d77dc=ut['cloneAction'](_0x8f592f,0xf,_0x870e('0xab'));rpcDb[_0x870e('0x98')](_0x5d77dc,_0x870e('0xac'));}else{if(_0x8f592f[_0x870e('0xad')]>=_0x43fe94['dialNoSuchNumberMaxRetry']){rpcDb[_0x870e('0x98')](_0x8f592f,_0x870e('0xac'));}else{rpcDb[_0x870e('0xae')](ut[_0x870e('0xaf')](_0x8f592f,_0x870e('0xad'),_0x43fe94[_0x870e('0xb0')]),_0x8f592f['unlockAgent'],_0x8f592f['activeContact']);}}delete this[_0x870e('0x19')][_0x541a0d[_0x870e('0xb1')]];break;case'ANSWER':var _0x570b8a=moment()[_0x870e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x8f592f[_0x870e('0xb2')]=_0x570b8a;_0x8f592f[_0x870e('0xb3')]=_0x570b8a;_0x8f592f[_0x870e('0x76')]=!![];_0x43fe94['pTalking']+=0x1;logger[_0x870e('0x5e')]('[syncHangup][talking][increment]',_0x8f592f[_0x870e('0xb4')],'\x20Queue',_0x43fe94[_0x870e('0x2c')],_0x870e('0x75'),_0x43fe94['pTalking']);ami['emit']('custom:agentconnect',ut['buildObj'](_0x8f592f,_0x870e('0xb5')));if(_0x43fe94['acw']){ami[_0x870e('0xa5')](_0x870e('0xb6'),ut[_0x870e('0xb7')](_0x8f592f));}break;case'16':ami[_0x870e('0xa5')]('custom:agentcomplete',ut[_0x870e('0xa7')](_0x8f592f,_0x870e('0xb8')));emitVoiceQueueChannelRemove(ut[_0x870e('0xa7')](_0x8f592f,_0x870e('0xb8')));_0x43fe94[_0x870e('0x3d')]+=0x1;_0x43fe94[_0x870e('0xb9')]+=0x1;_0x43fe94[_0x870e('0xba')]+=0x1;ut[_0x870e('0x7e')](_0x43fe94,_0x870e('0xbb'));_0x8f592f['countglobal']=ut[_0x870e('0xbc')](_0x8f592f);ut[_0x870e('0x91')](_0x8f592f,0x4,'Answer');rpcDb['createCustomerHistory'](_0x8f592f,_0x870e('0xbd'));rpcDb['createCustomerFinal'](_0x8f592f,_0x870e('0xbe'));rpcDb[_0x870e('0xbf')](_0x8f592f);_0x43fe94[_0x870e('0x31')]+=_0x8f592f[_0x870e('0xc0')];_0x43fe94[_0x870e('0x30')]+=_0x8f592f[_0x870e('0xc0')];logger['info'](_0x870e('0xc1'),_0x8f592f[_0x870e('0xb4')],_0x870e('0xc2'),_0x43fe94[_0x870e('0x2c')],_0x870e('0x75'),_0x43fe94['pTalking']);delete this['actions'][_0x541a0d[_0x870e('0xb1')]];break;case _0x870e('0xc3'):_0x43fe94[_0x870e('0x3f')]+=0x1;_0x8f592f['countbusyretry']+=0x1;_0x8f592f[_0x870e('0xa3')]=ut[_0x870e('0xbc')](_0x8f592f);ut[_0x870e('0x91')](_0x8f592f,0x5,_0x870e('0xc4'));ami[_0x870e('0xa5')](_0x870e('0xc5'),ut[_0x870e('0xa7')](_0x8f592f,_0x870e('0xc6')));rpcDb[_0x870e('0x95')](_0x8f592f,_0x870e('0xc7'));if(ut[_0x870e('0xbc')](_0x8f592f)>=_0x43fe94['dialGlobalMaxRetry']){_0x5d77dc=ut[_0x870e('0xc8')](_0x8f592f,0xf,_0x870e('0xab'));rpcDb[_0x870e('0x98')](_0x5d77dc,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x8f592f[_0x870e('0xc9')]>=_0x43fe94[_0x870e('0xca')]){rpcDb[_0x870e('0x98')](_0x8f592f,_0x870e('0xc7'));}else{rpcDb['rescheduleContact'](ut[_0x870e('0xaf')](_0x8f592f,'countbusyretry',_0x43fe94['dialBusyRetryFrequency']),_0x8f592f[_0x870e('0xcb')],_0x8f592f['activeContact']);}}break;case _0x870e('0xcc'):_0x43fe94['outboundNoAnswerCallsDay']+=0x1;_0x8f592f[_0x870e('0xcd')]+=0x1;_0x8f592f[_0x870e('0xa3')]=ut[_0x870e('0xbc')](_0x8f592f);ut[_0x870e('0x91')](_0x8f592f,0x3,_0x870e('0xce'));ami[_0x870e('0xa5')]('custom:agentnoanswer',ut[_0x870e('0xa7')](_0x8f592f,_0x870e('0xcf')));rpcDb[_0x870e('0x95')](_0x8f592f,_0x870e('0xd0'));if(ut[_0x870e('0xbc')](_0x8f592f)>=_0x43fe94[_0x870e('0xaa')]){_0x5d77dc=ut['cloneAction'](_0x8f592f,0xf,_0x870e('0xab'));rpcDb['createCustomerFinal'](_0x5d77dc,_0x870e('0xd1'));}else{if(_0x8f592f[_0x870e('0xcd')]>=_0x43fe94[_0x870e('0xd2')]){rpcDb['createCustomerFinal'](_0x8f592f,_0x870e('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0x870e('0xaf')](_0x8f592f,_0x870e('0xcd'),_0x43fe94[_0x870e('0xd3')]),_0x8f592f[_0x870e('0xcb')],_0x8f592f[_0x870e('0xd4')]);}}break;case _0x870e('0xd5'):_0x43fe94[_0x870e('0x40')]+=0x1;_0x8f592f[_0x870e('0xd6')]+=0x1;_0x8f592f['countglobal']=ut[_0x870e('0xbc')](_0x8f592f);ut[_0x870e('0x91')](_0x8f592f,0x8,'Congestion');ami['emit'](_0x870e('0xd7'),ut[_0x870e('0xa7')](_0x8f592f,_0x870e('0xd8')));rpcDb[_0x870e('0x95')](_0x8f592f,_0x870e('0xd9'));if(ut[_0x870e('0xbc')](_0x8f592f)>=_0x43fe94[_0x870e('0xaa')]){_0x5d77dc=ut[_0x870e('0xc8')](_0x8f592f,0xf,_0x870e('0xab'));rpcDb['createCustomerFinal'](_0x5d77dc,_0x870e('0xda'));}else{if(_0x8f592f[_0x870e('0xd6')]>=_0x43fe94['dialCongestionMaxRetry']){rpcDb[_0x870e('0x98')](_0x8f592f,_0x870e('0xd9'));}else{rpcDb[_0x870e('0xae')](ut[_0x870e('0xaf')](_0x8f592f,'countcongestionretry',_0x43fe94[_0x870e('0xdb')]),_0x8f592f[_0x870e('0xcb')],_0x8f592f[_0x870e('0xd4')]);}}break;case _0x870e('0xdc'):_0x43fe94['outboundRejectCallsDay']+=0x1;_0x8f592f['countagentrejectretry']+=0x1;_0x8f592f[_0x870e('0xa3')]=ut[_0x870e('0xbc')](_0x8f592f);ut[_0x870e('0x91')](_0x8f592f,0x14,_0x870e('0xdd'));ami[_0x870e('0xa5')](_0x870e('0xde'),ut[_0x870e('0xa7')](_0x8f592f,_0x870e('0xdf')));rpcDb['createCustomerHistory'](_0x8f592f,_0x870e('0xe0'));if(ut[_0x870e('0xbc')](_0x8f592f)>=_0x43fe94['dialGlobalMaxRetry']){_0x5d77dc=ut[_0x870e('0xc8')](_0x8f592f,0x14,'AgentReject');rpcDb[_0x870e('0x98')](_0x5d77dc,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x8f592f['countagentrejectretry']>=_0x43fe94['dialAgentRejectMaxRetry']){rpcDb[_0x870e('0x98')](_0x8f592f,_0x870e('0xe1'));}else{rpcDb[_0x870e('0xae')](ut['scheduledAt'](_0x8f592f,_0x870e('0xe2'),_0x43fe94['dialAgentRejectRetryFrequency']),_0x8f592f[_0x870e('0xcb')],_0x8f592f[_0x870e('0xd4')]);}}break;case _0x870e('0xe3'):_0x43fe94['outboundAbandonedCallsDay']+=0x1;_0x8f592f['countabandonedretry']+=0x1;_0x8f592f[_0x870e('0xa3')]=ut[_0x870e('0xbc')](_0x8f592f);ut[_0x870e('0x91')](_0x8f592f,0xb,_0x870e('0xe4'));rpcDb[_0x870e('0x95')](_0x8f592f,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x870e('0xbc')](_0x8f592f)>=_0x43fe94[_0x870e('0xaa')]){_0x5d77dc=ut['cloneAction'](_0x8f592f,0xf,_0x870e('0xab'));rpcDb[_0x870e('0x98')](_0x5d77dc,_0x870e('0xe5'));}else{if(_0x8f592f['countabandonedetry']>=_0x43fe94['dialAbandonedMaxRety']){rpcDb[_0x870e('0x98')](_0x8f592f,_0x870e('0xe5'));}else{rpcDb[_0x870e('0xae')](ut['scheduledAt'](_0x8f592f,_0x870e('0xe6'),_0x43fe94[_0x870e('0xe7')]),_0x8f592f[_0x870e('0xcb')],_0x8f592f[_0x870e('0xd4')]);}}break;default:if(_0x8f592f[_0x870e('0x76')]){ut[_0x870e('0x7e')](_0x43fe94,_0x870e('0xe8'));ut[_0x870e('0x7f')](_0x870e('0xe9')+_0x43fe94['name'],_0x541a0d);}_0x43fe94[_0x870e('0xea')]+=0x1;_0x8f592f[_0x870e('0xa3')]=ut[_0x870e('0xbc')](_0x8f592f);ut[_0x870e('0x91')](_0x8f592f,0xc,_0x541a0d['cause-txt']||_0x541a0d[_0x870e('0xeb')]);rpcDb['createCustomerHistory'](_0x8f592f,_0x870e('0xec'));if(ut[_0x870e('0xbc')](_0x8f592f)>=_0x43fe94['dialGlobalMaxRetry']){_0x5d77dc=ut[_0x870e('0xc8')](_0x8f592f,0xf,_0x870e('0xab'));rpcDb[_0x870e('0x98')](_0x5d77dc,_0x870e('0xed'));}else{rpcDb[_0x870e('0x98')](_0x8f592f,_0x870e('0xed'));}delete this['actions'][_0x541a0d['linkedid']];}if(!(_0x8f592f['dialAnswer']&&_0x5f5411==='16')){ut[_0x870e('0xee')](_0x43fe94,_0x870e('0xef'));logger['info'](_0x870e('0xf0'),_0x8f592f[_0x870e('0xb4')],_0x870e('0xc2'),_0x43fe94['name'],_0x870e('0x73'),_0x43fe94[_0x870e('0x62')]);}if(_0x5f5411!=='ANSWER'){delete this[_0x870e('0x19')][_0x541a0d[_0x870e('0xb1')]];delete this[_0x870e('0x19')][_0x541a0d[_0x870e('0xf1')]];}}};Preview[_0x870e('0x11')]['callProgressDetectingAgent']=function(_0x563fd3,_0x4efa84,_0xd43e2b){if(_[_0x870e('0xf2')](_0x4efa84)&&'object'!==typeof _0x4efa84){return;}if(_['isUndefined'](_0xd43e2b)&&_0x870e('0xf3')!==typeof _0xd43e2b){return;}switch(_0xd43e2b[_0x870e('0xf4')]){case'0':ut[_0x870e('0xf5')](_0x563fd3,0x0,_0x870e('0xa4'));rpcDb['createAgentHistory'](_0x563fd3,_0x870e('0xf6'));break;case'3':ut[_0x870e('0xf5')](_0x563fd3,0x3,_0x870e('0xce'));rpcDb[_0x870e('0xf7')](_0x563fd3,_0x870e('0xf8'));break;case'5':ut[_0x870e('0xf5')](_0x563fd3,0x5,'Busy');rpcDb[_0x870e('0xf7')](_0x563fd3,_0x870e('0xf9'));break;case'8':ut[_0x870e('0xf5')](_0x563fd3,0x8,_0x870e('0xfa'));rpcDb[_0x870e('0xf7')](_0x563fd3,_0x870e('0xfb'));break;case'22':ut['logAgent'](_0x563fd3,0x16,'AnswerAGI');rpcDb[_0x870e('0xf7')](_0x563fd3,_0x870e('0xfc'));break;default:ut[_0x870e('0xf5')](_0x563fd3,0xc,_0xd43e2b['reason']);rpcDb[_0x870e('0xf7')](_0x563fd3,_0x870e('0xfb'));}ut[_0x870e('0xee')](_0x4efa84,_0x870e('0xfd'));logger['info'](_0x870e('0xfe'),_0x563fd3['uniqueid'],_0x870e('0xc2'),_0x4efa84['name'],_0x870e('0x73'),_0x4efa84[_0x870e('0x62')]);delete this['actions'][_0x563fd3[_0x870e('0xb4')]];};Preview['prototype'][_0x870e('0xff')]=function(_0x50e343,_0x15fddc,_0x4411f0,_0x15b42e,_0x5e9b8c){var _0xb6ae58=this;return new BPromise(function(_0x329859,_0x2a7239){if(_[_0x870e('0x86')](_0x15fddc)||_['isNil'](_0x15fddc[_0x870e('0x100')])||_[_0x870e('0x86')](_0x15fddc[_0x870e('0x100')][_0x870e('0x101')])||_[_0x870e('0x86')](_0x15fddc[_0x870e('0x79')])){_0x2a7239(ut[_0x870e('0x53')](_0x870e('0x102'),_0x15b42e,_0x5e9b8c));return;}var _0x340f14=uuid['v4']();var _0x1b184b=_0xb6ae58['campaignsPreview'][_0x15fddc[_0x870e('0x72')][_0x870e('0x2c')]];var _0x2b22de=_0x4411f0?_0xb6ae58['agents'][_0x4411f0]['id']:undefined;_0xb6ae58['actions'][_0x340f14]=new Action(_0x15fddc,_0x1b184b,_0x340f14,_0x4411f0,_0x2b22de);var _0x1dceab=_0xb6ae58[_0x870e('0x19')][_0x340f14];_0x1dceab[_0x870e('0xcb')]=_0x15b42e;_0x1dceab[_0x870e('0xd4')]=_0x5e9b8c;_0x1dceab[_0x870e('0x103')]=_0x4411f0;if(_[_0x870e('0x104')](_0x50e343)){_0xb6ae58[_0x870e('0x105')](_0x1dceab,_0x1b184b,_0x15fddc,_0x4411f0)[_0x870e('0x85')](function(_0x493dd2){logger[_0x870e('0x5e')]('[Preview][execCall][success]',_0x870e('0x106')+_0x1dceab['queue']+_0x870e('0x107')+_0x1dceab[_0x870e('0x108')],JSON[_0x870e('0x60')](_0x493dd2));ami[_0x870e('0xa5')]('custom:agentcalled',ut['buildObj'](_0x1dceab,_0x870e('0x109')));_0x329859(ut[_0x870e('0x53')]('Calling'));})[_0x870e('0x8d')](function(_0x5caa70){ut['logger']('[Preview][execCall][failure]',_0x5caa70);_0x2a7239(ut[_0x870e('0x53')](_0x870e('0x10a'),_0x15b42e,_0x5e9b8c));});}else{_0x1b184b[_0x870e('0x3e')]+=0x1;ut[_0x870e('0x10b')](_0x1dceab);rpcDb[_0x870e('0x10c')](_0x1dceab,_0x870e('0x10d'));delete _0xb6ae58[_0x870e('0x19')][_0x340f14];_0x2a7239(ut[_0x870e('0x53')]('Contact\x20in\x20black\x20List',_0x15b42e,_0x5e9b8c));}});};Preview[_0x870e('0x11')][_0x870e('0x9e')]=function(_0x174189){return!_['isNil'](_0x174189)&&!_[_0x870e('0x86')](_0x174189[_0x870e('0x2c')])&&!_[_0x870e('0x86')](_0x174189['active'])&&_0x174189['active']&&!_['isNil'](this['trunks'][util[_0x870e('0x5c')](_0x870e('0x10e'),_0x174189[_0x870e('0x2c')])])&&!_['isNil'](this[_0x870e('0x18')][util['format'](_0x870e('0x10e'),_0x174189[_0x870e('0x2c')])][_0x870e('0x7b')])&&(this['trunks'][util['format'](_0x870e('0x10e'),_0x174189[_0x870e('0x2c')])][_0x870e('0x7b')]===_0x870e('0x10f')||this[_0x870e('0x18')][util[_0x870e('0x5c')](_0x870e('0x10e'),_0x174189['name'])]['status']===_0x870e('0x110'));};Preview[_0x870e('0x11')]['run']=function(_0x3bc81f,_0x21dbc7){var _0x3d3616=this;return new BPromise(function(_0x28c07f,_0x5d62ac){_0x3d3616[_0x870e('0x111')](_0x3bc81f,_0x21dbc7)[_0x870e('0x85')](function(_0x1ab77e){_0x28c07f(_['pick'](_0x1ab77e,[_0x870e('0x53')]));})['catch'](function(_0x49fbc3){if(_0x49fbc3['unlock']){rpcDb[_0x870e('0x112')](_0x3bc81f);}if(_0x49fbc3[_0x870e('0x113')]){rpcDb[_0x870e('0x8e')](_0x3bc81f);}_0x5d62ac(_[_0x870e('0x77')](_0x49fbc3,[_0x870e('0x53')]));});});};Preview[_0x870e('0x11')][_0x870e('0x111')]=function(_0x352446,_0x1c73f4){var _0x260513=this;return new BPromise(function(_0x255b8c,_0x47a895){var _0x4b91a1,_0x468f78;rpcDb[_0x870e('0x114')](_0x352446)['then'](function(_0x46ad22){if(!_[_0x870e('0x86')](_0x46ad22[0x0])){_0x468f78=_0x46ad22[0x0][_0x870e('0x115')]?![]:!![];_0x4b91a1=_0x46ad22[0x0]['recallme']?!![]:![];_0x4b91a1=_0x1c73f4?!![]:_0x4b91a1;}var _0xca6ace=_0x260513[_0x870e('0x116')](_0x46ad22);if(_0xca6ace['isValid']){rpcDb[_0x870e('0x117')](_[_0x870e('0x77')](_0x46ad22[0x0],[_0x870e('0x79'),_0x870e('0x118')]))[_0x870e('0x85')](function(_0x321499){_0x260513[_0x870e('0xff')](_0x321499,_0x46ad22[0x0],_0x1c73f4,_0x468f78,_0x4b91a1)['then'](function(_0x500064){_0x255b8c(_0x500064);})['catch'](function(_0x242e8a){_0x47a895(_0x242e8a);});})[_0x870e('0x8d')](function(_0x1919b6){ut[_0x870e('0x66')](_0x870e('0x119'),_0x1919b6);_0x47a895(ut[_0x870e('0x53')](_0x870e('0x11a'),_0x468f78,_0x4b91a1));});}else{_0x47a895(ut[_0x870e('0x53')](_0xca6ace['message'],_0x468f78,_0x4b91a1));}})[_0x870e('0x8d')](function(_0x1542d5){ut[_0x870e('0x66')](_0x870e('0x11b'),_0x1542d5);_0x47a895(ut[_0x870e('0x53')]('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0x870e('0x116')]=function(_0x4283da){if(_[_0x870e('0x86')](_0x4283da)||_[_0x870e('0x104')](_0x4283da)||!_[_0x870e('0x86')](_0x4283da[0x0][_0x870e('0x89')])&&_['isNil'](_0x4283da[0x0][_0x870e('0x89')][_0x870e('0x2c')])){ut[_0x870e('0x66')](_0x870e('0x11c'),_0x4283da);return{'isValid':![],'message':_0x870e('0x11d')};}var _0x5b4d97=this[_0x870e('0x16')][_0x4283da[0x0][_0x870e('0x72')][_0x870e('0x2c')]];_0x5b4d97[_0x870e('0x53')]='ACTIVE';if(_['isNil'](_0x5b4d97)){ut[_0x870e('0x66')](_0x870e('0x11e'),_0x5b4d97);return{'isValid':![],'message':_0x870e('0x11f')};}if(!this[_0x870e('0x9e')](_0x5b4d97[_0x870e('0x59')])){ut[_0x870e('0x66')](_0x870e('0x120'),_0x870e('0x121')+_0x5b4d97[_0x870e('0x2c')]+_0x870e('0x122'));if(!this[_0x870e('0x9e')](_0x5b4d97[_0x870e('0x9f')])){ut[_0x870e('0x66')](_0x870e('0x120'),_0x5b4d97[_0x870e('0x2c')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x870e('0x9d')](_0x5b4d97[_0x870e('0x37')])){ut[_0x870e('0x66')]('[Preview][validateContact][Campaign\x20Active]',_0x5b4d97['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0x870e('0x121')+_0x5b4d97[_0x870e('0x2c')]+_0x870e('0x123')};}return{'isValid':!![],'message':_0x870e('0x124')};};Preview[_0x870e('0x11')]['execCall']=function(_0x5a47fa,_0x307077,_0x3a0709,_0x2f50d4){var _0x5cf5cb=this;return new BPromise(function(_0x5ed83e,_0x2f33c0){var _0x12c283=_0x5a47fa[_0x870e('0xb4')];var _0x505002=_0x5cf5cb[_0x870e('0x9e')](_0x307077['Trunk'])?util[_0x870e('0x5c')](_0x870e('0x125'),_0x307077[_0x870e('0x59')][_0x870e('0x2c')],_[_0x870e('0x86')](_0x307077[_0x870e('0x3b')])?'':_0x307077['dialPrefix']['trim']()||'',_0x307077['dialCutDigit']>0x0?_0x3a0709[_0x870e('0x100')][_0x870e('0x101')][_0x870e('0x126')](_0x307077[_0x870e('0x127')]):_0x3a0709['Contact'][_0x870e('0x101')]):util[_0x870e('0x5c')](_0x870e('0x125'),_[_0x870e('0x86')](_0x307077[_0x870e('0x9f')])?_0x307077['Trunk']['name']:_0x307077[_0x870e('0x9f')][_0x870e('0x2c')],_['isNil'](_0x307077[_0x870e('0x3b')])?'':_0x307077[_0x870e('0x3b')]['trim']()||'',_0x307077[_0x870e('0x127')]>0x0?_0x3a0709[_0x870e('0x100')][_0x870e('0x101')][_0x870e('0x126')](_0x307077[_0x870e('0x127')]):_0x3a0709[_0x870e('0x100')][_0x870e('0x101')]);var _0xa04720=_0x5cf5cb['isTrunkReachable'](_0x307077[_0x870e('0x59')])?ut[_0x870e('0x128')](_0x307077[_0x870e('0x59')][_0x870e('0x5a')],_0x307077[_0x870e('0x39')],_0x307077[_0x870e('0x129')]>0x0?ut['getCallerIdRandom'](_0x307077[_0x870e('0x3a')],_0x307077[_0x870e('0x129')]):_0x307077[_0x870e('0x3a')]):ut[_0x870e('0x128')](_['isNil'](_0x307077[_0x870e('0x9f')])?_0x307077['Trunk'][_0x870e('0x5a')]:_0x307077['TrunkBackup'][_0x870e('0x5a')],_0x307077[_0x870e('0x39')],_0x307077[_0x870e('0x129')]>0x0?ut[_0x870e('0x12a')](_0x307077[_0x870e('0x3a')],_0x307077['dialRandomLastDigitCallerIdNumber']):_0x307077[_0x870e('0x3a')]);if(_0xa04720){_0x5a47fa['originatecalleridname']=ut[_0x870e('0x12b')](_0xa04720);_0x5a47fa['originatecalleridnum']=ut[_0x870e('0x12c')](_0xa04720);}var _0x58bb67=ut[_0x870e('0x12d')](_0x307077,_0x3a0709,_0x505002,_0xa04720,_0x12c283,_0x5a47fa);_[_0x870e('0x12e')](_0x5a47fa,ut[_0x870e('0x12f')](_0x58bb67));_0x5a47fa[_0x870e('0x8f')]=moment()[_0x870e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x870e('0x130')](ut[_0x870e('0x131')](_0x5a47fa,_0x307077,_0x58bb67,_0x5a47fa[_0x870e('0xd4')],_0x2f50d4))['then'](function(_0x127605){_0x307077[_0x870e('0x62')]+=0x1;logger[_0x870e('0x5e')](_0x870e('0x132'),_0x12c283,_0x870e('0xc2'),_0x307077['name'],_0x870e('0x73'),_0x307077[_0x870e('0x62')]);_0x5ed83e(_0x127605);})[_0x870e('0x8d')](function(_0x282070){ut[_0x870e('0xf5')](_0x5a47fa,0xe,_0x870e('0x133'));rpcDb[_0x870e('0xf7')](_0x5a47fa,_0x870e('0x134'));_0x2f33c0(_0x282070);});});};Preview['prototype'][_0x870e('0x23')]=function(_0x181bc0){if(this[_0x870e('0x19')][_0x181bc0[_0x870e('0xb1')]]){this[_0x870e('0x19')][_0x181bc0[_0x870e('0xb1')]][_0x870e('0x135')]=_0x181bc0[_0x870e('0x135')];}};Preview[_0x870e('0x11')]['syncOriginateResponse']=function(_0x280f56){var _0x5e7e65=this;var _0x2b9b5c=this[_0x870e('0x19')][_0x280f56[_0x870e('0x136')]];if(_0x2b9b5c){if(_0x2b9b5c[_0x870e('0x103')]&&this[_0x870e('0x1a')][_0x2b9b5c[_0x870e('0x103')]]){ut[_0x870e('0x137')](_0x2b9b5c,this[_0x870e('0x1a')][_0x2b9b5c[_0x870e('0x103')]][_0x870e('0x2c')],this[_0x870e('0x1a')][_0x2b9b5c[_0x870e('0x103')]]['id']);}var _0x5bb81a=_[_0x870e('0x138')](_0x2b9b5c);_0x5bb81a[_0x870e('0xb2')]=moment()['format'](_0x870e('0x90'));var _0x567cdb=_0x5e7e65[_0x870e('0x16')][_0x2b9b5c[_0x870e('0x74')]];if(ut[_0x870e('0x139')](_0x280f56['response'])){if(_0x2b9b5c['unlockAgent']){rpcDb['unlockContact'](_0x2b9b5c[_0x870e('0x108')]);}if(_0x2b9b5c[_0x870e('0xd4')]){rpcDb[_0x870e('0x8e')](_0x2b9b5c[_0x870e('0x108')]);}ami['emit']('custom:agentringnoanswer',ut[_0x870e('0xa7')](_0x2b9b5c,_0x870e('0x13a')));this[_0x870e('0x13b')](_0x5bb81a,_0x567cdb,_0x280f56);}else{_0x2b9b5c['starttime']=moment()[_0x870e('0x5c')](_0x870e('0x90'));ut[_0x870e('0xf5')](_0x5bb81a,0x4,'Answer');rpcDb[_0x870e('0xf7')](_0x5bb81a,_0x870e('0x13c'));}}};Preview[_0x870e('0x11')][_0x870e('0x13d')]=function(_0x31bc24){var _0x4ae266=this;var _0x2ecfcd=this[_0x870e('0x19')][_0x31bc24[_0x870e('0xb1')]];var _0x3eaea4;if(_0x2ecfcd){_0x3eaea4=this[_0x870e('0x16')][_0x2ecfcd['queue']];logger[_0x870e('0x5e')](_0x870e('0x13e'),_0x31bc24[_0x870e('0xb1')],_0x870e('0xc2'),_0x3eaea4['name'],'pTalking:\x20',_0x3eaea4[_0x870e('0x2f')]);}if(this[_0x870e('0x19')][_0x31bc24[_0x870e('0xb1')]]&&_0x31bc24['linkedid']!==_0x31bc24[_0x870e('0xb4')]){if(_0x31bc24[_0x870e('0x13f')]==='16'&&this[_0x870e('0x19')][_0x31bc24[_0x870e('0xb1')]][_0x870e('0x76')]){this[_0x870e('0xa2')](_0x31bc24,_0x31bc24[_0x870e('0xb1')],_0x31bc24[_0x870e('0x13f')]);}else if(this[_0x870e('0x19')][_0x31bc24['linkedid']][_0x870e('0x76')]){logger[_0x870e('0x5e')]('[syncHangup][talking][cause]',_0x31bc24[_0x870e('0xb1')],_0x31bc24[_0x870e('0x13f')],_0x870e('0xc2'),_0x3eaea4[_0x870e('0x2c')],_0x870e('0x75'),_0x3eaea4[_0x870e('0x2f')]);this[_0x870e('0xa2')](_0x31bc24,_0x31bc24[_0x870e('0xb1')],_0x31bc24['cause']);}}else if(_0x2ecfcd&&_[_0x870e('0x86')](_0x2ecfcd['statedesc'])&&_0x3eaea4[_0x870e('0x140')]&&_0x31bc24['linkedid']===_0x31bc24[_0x870e('0xb4')]&&_[_0x870e('0x86')](_0x31bc24['reason'])&&_0x31bc24[_0x870e('0x13f')]==='16'&&_0x31bc24[_0x870e('0x141')]==='6'&&_[_0x870e('0xf2')](_0x2ecfcd[_0x870e('0x142')])){if(_0x2ecfcd[_0x870e('0xcb')]){rpcDb['unlockContact'](_0x2ecfcd['idContact']);}if(_0x2ecfcd['activeContact']){rpcDb[_0x870e('0x8e')](_0x2ecfcd['idContact']);}_0x31bc24[_0x870e('0xf4')]='22';this[_0x870e('0x13b')](_0x2ecfcd,_0x3eaea4,_0x31bc24);}else if(_0x2ecfcd&&_0x2ecfcd[_0x870e('0x142')]){if(_0x31bc24['cause']==='16'&&this[_0x870e('0x19')][_0x31bc24[_0x870e('0xb1')]][_0x870e('0x76')]){logger[_0x870e('0x5e')](_0x870e('0x143'),_0x31bc24[_0x870e('0xb1')],_0x31bc24['cause'],_0x870e('0xc2'),_0x3eaea4[_0x870e('0x2c')],_0x870e('0x75'),_0x3eaea4[_0x870e('0x2f')]);this[_0x870e('0xa2')](_0x31bc24,_0x31bc24[_0x870e('0xb1')],_0x31bc24['cause']);}else if(this[_0x870e('0x19')][_0x31bc24[_0x870e('0xb1')]][_0x870e('0x76')]){logger[_0x870e('0x5e')](_0x870e('0x144'),_0x31bc24[_0x870e('0xb1')],_0x31bc24[_0x870e('0x13f')],_0x870e('0xc2'),_0x3eaea4[_0x870e('0x2c')],_0x870e('0x75'),_0x3eaea4[_0x870e('0x2f')]);this['callProgressDetectingCustomer'](_0x31bc24,_0x31bc24['linkedid'],_0x31bc24['cause']);}}};Preview[_0x870e('0x11')][_0x870e('0x21')]=function(_0x40e5b3){if(this[_0x870e('0x19')][_0x40e5b3[_0x870e('0xf1')]]&&_0x40e5b3[_0x870e('0xf1')]!==_0x40e5b3[_0x870e('0x145')]){this['callProgressDetectingCustomer'](_0x40e5b3,_0x40e5b3[_0x870e('0xf1')],_0x40e5b3['dialstatus']);}};Preview['prototype'][_0x870e('0x20')]=function(_0x3e495a){if(this[_0x870e('0x19')][_0x3e495a[_0x870e('0xb1')]]&&_0x3e495a[_0x870e('0xb1')]!==_0x3e495a[_0x870e('0xb4')]&&!this[_0x870e('0x19')][_0x3e495a['linkedid']][_0x870e('0x76')]){if(_0x3e495a[_0x870e('0x13f')]==='1'){this[_0x870e('0xa2')](_0x3e495a,_0x3e495a['linkedid'],_0x3e495a[_0x870e('0x13f')]);}}};Preview[_0x870e('0x11')][_0x870e('0x146')]=function(_0x111e6b,_0x3d6c5f,_0x560ca0){if(this[_0x870e('0x19')][_0x111e6b]){if(_[_0x870e('0x86')](this[_0x870e('0x19')][_0x111e6b][_0x870e('0x147')])){this[_0x870e('0x19')][_0x111e6b][_0x870e('0x147')]={};}this['actions'][_0x111e6b][_0x870e('0x147')][_0x3d6c5f]=_0x560ca0;}};Preview[_0x870e('0x11')][_0x870e('0x25')]=function(_0xeeffef){try{if(!_[_0x870e('0x86')](_0xeeffef)){if(ut[_0x870e('0x148')](_[_0x870e('0x149')](_0xeeffef['variable'])[0x0])){this[_0x870e('0x146')](_0xeeffef[_0x870e('0xb4')],_[_0x870e('0x149')](_0xeeffef[_0x870e('0x14a')])[0x0],_0xeeffef[_0x870e('0x14b')]);}}}catch(_0x899145){logger[_0x870e('0x14c')](_0x870e('0x14d'),util[_0x870e('0x14e')](_0x899145,{'showHidden':![],'depth':null}));}};Preview[_0x870e('0x11')][_0x870e('0x27')]=function(_0x14ecf2){if(_0x14ecf2){if(this[_0x870e('0x19')][_0x14ecf2[_0x870e('0x14f')]]){this[_0x870e('0x19')][_0x14ecf2[_0x870e('0x14f')]][_0x870e('0x142')]=!![];}}};Preview[_0x870e('0x11')][_0x870e('0x28')]=function(_0x241d3a){if(_0x241d3a){if(this[_0x870e('0x19')][_0x241d3a[_0x870e('0x150')]]){this[_0x870e('0x19')][_0x241d3a['transfererlinkedid']][_0x870e('0x142')]=!![];}}};module[_0x870e('0x151')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 5167492..7a4aa4c 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 _0xdc97=['util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x173fdf,_0x1ba573){var _0x147b6d=function(_0x5dc021){while(--_0x5dc021){_0x173fdf['push'](_0x173fdf['shift']());}};_0x147b6d(++_0x1ba573);}(_0xdc97,0x13b));var _0x7dc9=function(_0x405699,_0x3d6337){_0x405699=_0x405699-0x0;var _0x26ef72=_0xdc97[_0x405699];return _0x26ef72;};'use strict';var util=require(_0x7dc9('0x0'));var BPromise=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('preview');var _=require(_0x7dc9('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7dc9('0x4'));var cmHopperHistory=require(_0x7dc9('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7dc9('0x6'));var agentReportPreview=require(_0x7dc9('0x7'));var voiceQueueReport=require(_0x7dc9('0x8'));function loggerCatch(_0x3ba3ca){return function(_0x589f02){logger[_0x7dc9('0x9')](_0x3ba3ca,util['inspect'](_0x589f02,{'showHidden':![],'depth':null}));};}function create(_0x4b3229){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopperHistory[_0x7dc9('0xc')](_0x4b3229))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0xe')));}function createAgent(_0x5ca05b){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](agentReportPreview[_0x7dc9('0xc')](_0x5ca05b))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0xe')));}function moveContact(_0x3c2af5){return BPromise[_0x7dc9('0xa')]()['then'](cmHopper['moveContactManagedDialer'](_0x3c2af5,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x7dc9('0xf')]=function(_0x14e5db){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopperBlack[_0x7dc9('0xf')](_0x14e5db))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x10')));};exports[_0x7dc9('0x11')]=function(_0x11af93){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x11')](_0x11af93))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x12')));};exports[_0x7dc9('0xc')]=function(_0xbe0437,_0x45698c){create(_0xbe0437)[_0x7dc9('0xd')](loggerCatch(_0x45698c));moveContact(_0xbe0437)[_0x7dc9('0xd')](loggerCatch(_0x45698c));};exports['createAgentHistory']=function(_0x22577e,_0x4afb47){createAgent(_0x22577e)[_0x7dc9('0xd')](loggerCatch(_0x4afb47));};exports[_0x7dc9('0x13')]=function(_0x5d61d7,_0x41f66e){create(_0x5d61d7)[_0x7dc9('0xd')](loggerCatch(_0x41f66e));};exports[_0x7dc9('0x14')]=function(_0x4b2703,_0x43ec33){moveContact(_0x4b2703)[_0x7dc9('0xd')](loggerCatch(_0x43ec33));};exports[_0x7dc9('0x15')]=function(_0x2895f5,_0x155cc4,_0x2b38d6){if(_0x155cc4){_0x2895f5['UserId']=null;}if(_0x2b38d6){_0x2895f5['active']=![];}return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['rescheduleContact'](_0x2895f5))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x16')));};exports['countReScheduled']=function(_0xffc080){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['countReScheduled'](_0xffc080))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x17')));};exports[_0x7dc9('0x18')]=function(_0x55a482){return BPromise['resolve']()['then'](cmHopper[_0x7dc9('0x18')]({'UserId':null},_0x55a482,0x1))[_0x7dc9('0xd')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x47771b){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x18')]({'active':![]},_0x47771b,0x1))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x19')));};exports[_0x7dc9('0x1a')]=function(_0x450124){var _0x236d42={};_0x236d42[_0x7dc9('0x1b')]=_0x450124[_0x7dc9('0x1b')];_0x236d42[_0x7dc9('0x1c')]=_0x450124[_0x7dc9('0x1c')];_0x236d42[_0x7dc9('0x1d')]=_0x450124['calleridnum'];_0x236d42['calleridname']=_0x450124['calleridname'];_0x236d42['queue']=_0x450124['queue'];_0x236d42['queuecallerjoinAt']=_0x450124['answertime'];_0x236d42['queuecallerleaveAt']=_0x450124[_0x7dc9('0x1e')];_0x236d42[_0x7dc9('0x1f')]=0x1;_0x236d42[_0x7dc9('0x20')]=_0x450124[_0x7dc9('0x21')];_0x236d42[_0x7dc9('0x22')]=_0x450124[_0x7dc9('0x23')];_0x236d42['context']='from-sip';_0x236d42['exten']=_0x7dc9('0x24');_0x236d42['holdtime']=0x0;_0x236d42[_0x7dc9('0x25')]=0x1;_0x236d42[_0x7dc9('0x26')]=_0x450124[_0x7dc9('0x23')];_0x236d42[_0x7dc9('0x27')]=_0x7dc9('0x28');return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](voiceQueueReport[_0x7dc9('0x29')](_0x236d42))['catch'](loggerCatch(_0x7dc9('0x2a')));};exports['getContactRecallMe']=function(_0x421e1a,_0x16431a){return BPromise[_0x7dc9('0xa')]()[_0x7dc9('0xb')](cmHopper['getContactRecallMe'](_0x421e1a,_0x16431a))[_0x7dc9('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7dc9('0x2b')]=function(_0x4f47af){return BPromise['resolve']()[_0x7dc9('0xb')](cmHopper[_0x7dc9('0x15')](_0x4f47af,!![],!![]))[_0x7dc9('0xd')](loggerCatch(_0x7dc9('0x2c')));}; \ No newline at end of file +var _0x6aa7=['type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','xcally-motion-preview','assigned','membername','create','getContactRecallMe','[GetContactRecallMe]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','inspect','then','createHistory','catch','resolve','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20'];(function(_0x579c3a,_0x3f64e2){var _0x399969=function(_0x5f10bf){while(--_0x5f10bf){_0x579c3a['push'](_0x579c3a['shift']());}};_0x399969(++_0x3f64e2);}(_0x6aa7,0x178));var _0x76aa=function(_0x480a16,_0x45ca6e){_0x480a16=_0x480a16-0x0;var _0x31fdb4=_0x6aa7[_0x480a16];return _0x31fdb4;};'use strict';var util=require(_0x76aa('0x0'));var BPromise=require('bluebird');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var _=require(_0x76aa('0x3'));var cmHopper=require(_0x76aa('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x76aa('0x5'));var cmHopperBlack=require(_0x76aa('0x6'));var voiceQueueRt=require(_0x76aa('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1aceaa){return function(_0x4d53f6){logger[_0x76aa('0x8')](_0x1aceaa,util[_0x76aa('0x9')](_0x4d53f6,{'showHidden':![],'depth':null}));};}function create(_0xa9b695){return BPromise['resolve']()[_0x76aa('0xa')](cmHopperHistory[_0x76aa('0xb')](_0xa9b695))[_0x76aa('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0xcd99aa){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](agentReportPreview[_0x76aa('0xb')](_0xcd99aa))[_0x76aa('0xc')](loggerCatch(_0x76aa('0xe')));}function moveContact(_0x2c5075){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0xf')](_0x2c5075,!![]))['catch'](loggerCatch(_0x76aa('0x10')));}exports['checkIsBlackList']=function(_0x226536){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopperBlack[_0x76aa('0x11')](_0x226536))[_0x76aa('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x2b3b4f){return BPromise['resolve']()[_0x76aa('0xa')](cmHopper[_0x76aa('0x12')](_0x2b3b4f))['catch'](loggerCatch(_0x76aa('0x13')));};exports['createHistory']=function(_0x328381,_0x5181d2){create(_0x328381)[_0x76aa('0xc')](loggerCatch(_0x5181d2));moveContact(_0x328381)[_0x76aa('0xc')](loggerCatch(_0x5181d2));};exports[_0x76aa('0x14')]=function(_0x21c16d,_0xa1bc7){createAgent(_0x21c16d)[_0x76aa('0xc')](loggerCatch(_0xa1bc7));};exports['createCustomerHistory']=function(_0x5d6202,_0x256636){create(_0x5d6202)[_0x76aa('0xc')](loggerCatch(_0x256636));};exports[_0x76aa('0x15')]=function(_0x15b931,_0x15109b){moveContact(_0x15b931)[_0x76aa('0xc')](loggerCatch(_0x15109b));};exports[_0x76aa('0x16')]=function(_0x2eaf48,_0x385157,_0x5990c1){if(_0x385157){_0x2eaf48[_0x76aa('0x17')]=null;}if(_0x5990c1){_0x2eaf48[_0x76aa('0x18')]=![];}return BPromise[_0x76aa('0xd')]()['then'](cmHopper[_0x76aa('0x16')](_0x2eaf48))[_0x76aa('0xc')](loggerCatch(_0x76aa('0x19')));};exports[_0x76aa('0x1a')]=function(_0x29c50c){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0x1a')](_0x29c50c))[_0x76aa('0xc')](loggerCatch(_0x76aa('0x1b')));};exports[_0x76aa('0x1c')]=function(_0x26b75e){return BPromise[_0x76aa('0xd')]()['then'](cmHopper[_0x76aa('0x1c')]({'UserId':null},_0x26b75e,0x1))[_0x76aa('0xc')](loggerCatch(_0x76aa('0x1d')));};exports[_0x76aa('0x1e')]=function(_0xa1e6){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0x1c')]({'active':![]},_0xa1e6,0x1))[_0x76aa('0xc')](loggerCatch(_0x76aa('0x1f')));};exports['crateCustomerReportQueue']=function(_0x3fcb7f){var _0x5a8030={};_0x5a8030[_0x76aa('0x20')]=_0x3fcb7f[_0x76aa('0x20')];_0x5a8030[_0x76aa('0x21')]=_0x3fcb7f[_0x76aa('0x21')];_0x5a8030[_0x76aa('0x22')]=_0x3fcb7f[_0x76aa('0x22')];_0x5a8030[_0x76aa('0x23')]=_0x3fcb7f[_0x76aa('0x23')];_0x5a8030[_0x76aa('0x24')]=_0x3fcb7f[_0x76aa('0x24')];_0x5a8030['queuecallerjoinAt']=_0x3fcb7f[_0x76aa('0x25')];_0x5a8030[_0x76aa('0x26')]=_0x3fcb7f[_0x76aa('0x25')];_0x5a8030[_0x76aa('0x27')]=0x1;_0x5a8030[_0x76aa('0x28')]=_0x3fcb7f[_0x76aa('0x29')];_0x5a8030[_0x76aa('0x2a')]=_0x3fcb7f['membername'];_0x5a8030[_0x76aa('0x2b')]=_0x76aa('0x2c');_0x5a8030['exten']=_0x76aa('0x2d');_0x5a8030['holdtime']=0x0;_0x5a8030[_0x76aa('0x2e')]=0x1;_0x5a8030['lastAssignedTo']=_0x3fcb7f[_0x76aa('0x2f')];_0x5a8030['queuecallerexitreason']='COMPLETED';return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](voiceQueueReport[_0x76aa('0x30')](_0x5a8030))[_0x76aa('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0xdb18d3,_0x1c7b6f){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0x31')](_0xdb18d3,_0x1c7b6f))['catch'](loggerCatch(_0x76aa('0x32')));};exports['rescheduleContactInQueue']=function(_0x5086f5){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0x16')](_0x5086f5,!![],!![]))[_0x76aa('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 2901106..a5e95cc 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 _0x565e=['diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isActive','Queue','name','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','membername','ringtime','talktime','answertime','isFailure','Failure','calleridname','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','buildAcw','agentReadyId','status','push','getDiff','createBody','idContact','campaigntype','countglobal','callback','callbackat','recallme','UserId','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','127.0.0.1','milliseconds'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe565('0x0'));var _=require('lodash');var moment=require(_0xe565('0x1'));var logger=require(_0xe565('0x2'))(_0xe565('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xe565('0x4');function getSeconds(_0x33fd83,_0x14f472){var _0x1b6e64=moment(_0x33fd83)[_0xe565('0x5')](0x0);var _0x45ba66=moment(_0x14f472)[_0xe565('0x5')](0x0);return _0x1b6e64[_0xe565('0x6')](_0x45ba66,_0xe565('0x7'));}exports[_0xe565('0x8')]=function(_0x1204c8){return function(_0x14f3df){logger[_0xe565('0x9')](_0x1204c8,util[_0xe565('0xa')](_0x14f3df,{'showHidden':![],'depth':null}));};};exports[_0xe565('0xb')]=function(_0x41640f,_0x5b82c1){logger[_0xe565('0xc')](_0x41640f,util[_0xe565('0xa')](_0x5b82c1,{'showHidden':![],'depth':null}));};exports[_0xe565('0xd')]=function(_0x55f719,_0x434187){logger[_0xe565('0x9')](_0x55f719,util[_0xe565('0xa')](_0x434187,{'showHidden':![],'depth':null}));};exports[_0xe565('0xe')]=function(_0x590517){return function(_0x21a0bd){logger['info'](_0x590517,util[_0xe565('0xa')](_0x21a0bd,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x388a9a,_0x449750,_0x1cc388){return{'message':_0x388a9a,'unlock':_0x449750,'active':_0x1cc388};};exports['getCallerId']=function(_0x108be8,_0x177fbd,_0x127b29){if(!_[_0xe565('0xf')](_0x127b29)&&'string'===typeof _0x127b29&&!_[_0xe565('0x10')](_0x127b29)){if(!_[_0xe565('0xf')](_0x177fbd)&&_0xe565('0x11')===typeof _0x177fbd&&!_[_0xe565('0x10')](_0x177fbd)){return util[_0xe565('0x12')](_0xe565('0x13'),_0x177fbd,_0x127b29);}return util['format'](_0xe565('0x13'),_0x127b29,_0x127b29);}if(!_[_0xe565('0xf')](_0x108be8)&&_0xe565('0x11')===typeof _0x108be8&&!_[_0xe565('0x10')](_0x108be8)){return _0x108be8;}return'\x22\x22\x20<>';};exports[_0xe565('0x14')]=function(_0x41c80e){if(_['isNil'](_0x41c80e)){return![];}return _0x41c80e;};exports['addVariables']=function(_0x1251aa,_0x426072,_0x537734,_0x3efaa1,_0x43e075,_0x1e1b2e){var _0x4ad5df={'XMD-QUEUE':_0x426072['Queue']?_0x426072[_0xe565('0x15')][_0xe565('0x16')]:'','XMD-CALLERID':_0x3efaa1,'XMD-CALLERID-PREVIEW':_0x1e1b2e?util[_0xe565('0x12')](_0xe565('0x13'),_0x1e1b2e['calleridname'],_0x1e1b2e[_0xe565('0x17')]):_0x3efaa1,'XMD-DIALID':_0x43e075,'XMD-CONTACTID':_0x426072['ContactId'],'XMD-CDRTYPE':_0xe565('0x18'),'CALLERID(all)':_0x3efaa1,'XMD-VOICEQUEUEID':_0x426072[_0xe565('0x19')],'XMD-DIALCHANNEL':_0x537734,'XMD-DIALTIMEOUT':_0x1251aa[_0xe565('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xe565('0x1b'),_0x1251aa[_0xe565('0x1c')]?'g':'',_[_0xe565('0x10')](_0x1251aa[_0xe565('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1251aa[_0xe565('0x1e')]||'','XMD-AGI':_0x1251aa['dialQueueProject']?util[_0xe565('0x12')](_0xe565('0x1f'),ipAgi,_0x1251aa[_0xe565('0x20')]):'NONE','XMD-AGIAFTER':_0x1251aa[_0xe565('0x1c')]?util[_0xe565('0x12')](_0xe565('0x1f'),ipAgi,_0x1251aa[_0xe565('0x1c')]):_0xe565('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x1e1b2e?_0x1e1b2e[_0xe565('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x1e1b2e?_0x1e1b2e[_0xe565('0x23')]:'','XMD-DESTINATION':_0xe565('0x24')};if(!_['isEmpty'](_0x1251aa[_0xe565('0x1d')])){_0x4ad5df[util['format']('%s',_0xe565('0x25'))]=_0x1251aa['monitor_format'];_0x4ad5df[util['format']('%s',_0xe565('0x26'))]=_0x43e075;}if(_0x426072&&_0x426072['Contact']){for(var _0xc7307b in _0x426072[_0xe565('0x27')]){if(_0x426072[_0xe565('0x27')][_0xe565('0x28')](_0xc7307b)){if(!_[_0xe565('0x29')](_0x426072[_0xe565('0x27')][_0xc7307b])&&_0xc7307b!=='id'&&_0xc7307b!==_0xe565('0x2a')&&_0xc7307b!=='createdAt'&&_0xc7307b!=='updatedAt'){_0x4ad5df[util[_0xe565('0x12')](_0xe565('0x2b'),_0xe565('0x2c'),_[_0xe565('0x2d')](_0xc7307b))]=_0x426072['Contact'][_0xc7307b];}}}}return _0x4ad5df;};exports[_0xe565('0x2e')]=function(_0x228187){var _0x1af4e5={};for(var _0x10920a in _0x228187){if(_0x228187[_0xe565('0x28')](_0x10920a)){_0x1af4e5[util['format']('%s',_[_0xe565('0x2f')](_0x10920a))]=_0x228187[_0x10920a];}}return{'variables':_0x1af4e5};};exports[_0xe565('0x30')]=function(_0x222a56,_0x369bb3){if(!_['isNil'](_0x222a56)){if(_0x222a56[_0xe565('0x28')](_0xe565('0x31'))){if(_0x222a56[_0xe565('0x31')]>0x0){_0x222a56['originated']-=0x1;}else{logger[_0xe565('0x9')](_0xe565('0x32'),_0x369bb3);}}}else{logger['error'](_0xe565('0x33'),_0x369bb3);}};exports[_0xe565('0x34')]=function(_0x52d856){var _0x114ab2=moment()[_0xe565('0x12')](_0xe565('0x35'));_0x52d856[_0xe565('0x36')]=0xd;_0x52d856[_0xe565('0x37')]=_0xe565('0x38');_0x52d856[_0xe565('0x39')]=_0x114ab2;_0x52d856[_0xe565('0x3a')]=_0x114ab2;_0x52d856[_0xe565('0x3b')]=_0x114ab2;};exports[_0xe565('0x3c')]=function(_0x106488,_0x22fb8b,_0x7904d){var _0x526719=moment()[_0xe565('0x12')](_0xe565('0x35'));_0x106488[_0xe565('0x36')]=_0x22fb8b;_0x106488[_0xe565('0x37')]=_0x7904d;_0x106488['responsetime']=_0x526719;_0x106488['ringtime']=getSeconds(_0x106488[_0xe565('0x3a')],_0x106488['starttime']);};exports['logLookAgent']=function(_0x461499,_0x485cfc,_0x5c0c79){_0x461499[_0xe565('0x3d')]=_0x485cfc;_0x461499['UserId']=_0x5c0c79;};exports['logCustomer']=function(_0x27acb1,_0x2423c9,_0x17177e){var _0x3efcb8=moment()[_0xe565('0x12')](_0xe565('0x35'));_0x27acb1[_0xe565('0x36')]=_0x2423c9;_0x27acb1[_0xe565('0x37')]=_0x17177e;_0x27acb1[_0xe565('0x3a')]=_0x27acb1['responsetime']?_0x27acb1[_0xe565('0x3a')]:_0x3efcb8;_0x27acb1[_0xe565('0x3b')]=_0x27acb1[_0xe565('0x3b')]?_0x27acb1[_0xe565('0x3b')]:_0x3efcb8;_0x27acb1[_0xe565('0x3e')]=getSeconds(_0x27acb1[_0xe565('0x3a')]||0x0,_0x27acb1[_0xe565('0x39')]||0x0);_0x27acb1[_0xe565('0x3f')]=_0x27acb1['answertime']?getSeconds(_0x27acb1[_0xe565('0x3b')],_0x27acb1[_0xe565('0x40')]):0x0;};exports[_0xe565('0x41')]=function(_0x309ee4){return _0x309ee4===_0xe565('0x42');};exports['variablesAction']=function(_0x162d2f,_0x337761,_0x2cf8bf,_0x1c1d20,_0x3d779c){var _0x30d12f=_0x1c1d20?'RECALL':_0x162d2f[_0xe565('0x43')];_0x30d12f=_0x3d779c?'BOOKED':_0x30d12f;return{'actionid':_0x162d2f[_0xe565('0x44')],'action':_0xe565('0x45'),'channel':_0x162d2f[_0xe565('0x46')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x30d12f,_0x162d2f['calleridnum']),'Exten':_0xe565('0x24'),'Context':_0xe565('0x47'),'Priority':'1','variable':_0x2cf8bf,'timeout':(_0x337761[_0xe565('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x162d2f['uniqueid']};};exports[_0xe565('0x49')]=function(_0x575114){return _0x575114[_0xe565('0x4a')]+_0x575114['countcongestionretry']+_0x575114[_0xe565('0x4b')]+_0x575114[_0xe565('0x4c')]+_0x575114['countnosuchnumberretry'];};exports[_0xe565('0x4d')]=function(_0x5387a3){var _0x3495d1=_[_0xe565('0x4e')](_0x5387a3);_0x3495d1['state']=0xf;_0x3495d1[_0xe565('0x37')]=_0xe565('0x4f');return _0x3495d1;};exports[_0xe565('0x50')]=function(_0x3028f4,_0x10fa9b,_0x68ecf){var _0x4a6433={};_0x4a6433[_0x10fa9b]=_0x3028f4[_0x10fa9b];_0x4a6433[_0xe565('0x51')]=![];_0x4a6433[_0xe565('0x52')]=moment()['add'](_0x68ecf,_0xe565('0x53'))['format'](_0xe565('0x35'));_0x4a6433[_0xe565('0x54')]=_0x3028f4[_0xe565('0x54')];_0x4a6433[_0xe565('0x55')]=_0x3028f4['ListId'];_0x4a6433[_0xe565('0x19')]=_0x3028f4[_0xe565('0x19')]||undefined;return _0x4a6433;};exports[_0xe565('0x56')]=function(_0x2b80ed,_0x13b444){if(!_[_0xe565('0x29')](_0x2b80ed)){if(_0x2b80ed[_0xe565('0x57')]>0x0){_0x2b80ed[_0xe565('0x57')]-=0x1;}else{logger[_0xe565('0x9')](_0x13b444,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xe565('0x9')](_0x13b444,_0xe565('0x58'));}};exports[_0xe565('0x59')]=function(_0x6c222a){if(_0x6c222a<=0x0){return!![];}return![];};exports[_0xe565('0x5a')]=function(_0x397f75,_0x1df9c9){_0x397f75[_0xe565('0x5b')]=_0x1df9c9;_0x397f75[_0xe565('0x16')]=_0x397f75[_0xe565('0x5c')];_0x397f75['interface']=_0x397f75[_0xe565('0x46')];return _0x397f75;};exports[_0xe565('0x5d')]=function(_0x294792){var _0x12117c={};_0x12117c[_0xe565('0x5c')]=_0x294792[_0xe565('0x5c')];_0x12117c['interface']=_0x294792[_0xe565('0x46')];_0x12117c[_0xe565('0x44')]=_0x294792[_0xe565('0x44')];return _0x12117c;};exports[_0xe565('0x5e')]=function(_0x391d28){var _0x413a22=[];for(var _0x72426f in _0x391d28){if(_0x391d28[_0xe565('0x28')](_0x72426f)){if(!_['isNil'](_0x391d28[_0x72426f])&&_0x391d28[_0x72426f][_0xe565('0x36')]==='not_inuse'&&_0x391d28[_0x72426f][_0xe565('0x5f')]==='reachable'){_0x413a22[_0xe565('0x60')](_0x391d28[_0x72426f]['id']);}}}return _0x413a22;};exports[_0xe565('0x61')]=function(_0x1fafec){var _0x42316e=moment()[_0xe565('0x5')](0x0);var _0xbb9bb=moment(_0x1fafec)[_0xe565('0x5')](0x0);return _0x42316e[_0xe565('0x6')](_0xbb9bb,_0xe565('0x7'));};exports[_0xe565('0x62')]=function(_0x242dab){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x242dab[_0xe565('0x54')],'ListId':_0x242dab[_0xe565('0x55')],'VoiceQueueId':_0x242dab['VoiceQueueId']||undefined,'CampaignId':_0x242dab['CampaignId']||undefined};};exports['filterKey']=function(_0x374871){if(_0x374871===_0xe565('0x44')||_0x374871===_0xe565('0x63')||_0x374871==='queue'||_0x374871==='type'||_0x374871===_0xe565('0x64')||_0x374871==='dialAnswer'||_0x374871==='membername'||_0x374871==='channelAgent'||_0x374871===_0xe565('0x43')||_0x374871===_0xe565('0x51')||_0x374871===_0xe565('0x17')||_0x374871===_0xe565('0x52')||_0x374871===_0xe565('0x4a')||_0x374871==='countcongestionretry'||_0x374871===_0xe565('0x4b')||_0x374871===_0xe565('0x65')||_0x374871===_0xe565('0x66')||_0x374871==='callbackuniqueid'||_0x374871===_0xe565('0x67')||_0x374871===_0xe565('0x68')||_0x374871==='ContactId'||_0x374871===_0xe565('0x55')||_0x374871===_0xe565('0x69')||_0x374871===_0xe565('0x19')||_0x374871==='sipcallid'||_0x374871==='xmd-voicequeueid'||_0x374871===_0xe565('0x6a')||_0x374871==='xmd-phone'||_0x374871===_0xe565('0x6b')||_0x374871===_0xe565('0x6c')||_0x374871===_0xe565('0x6d')||_0x374871===_0xe565('0x6e')||_0x374871===_0xe565('0x6f')||_0x374871===_0xe565('0x70')||_0x374871===_0xe565('0x71')||_0x374871===_0xe565('0x72')||_0x374871===_0xe565('0x73')||_0x374871===_0xe565('0x74')||_0x374871===_0xe565('0x75')||_0x374871===_0xe565('0x76')||_0x374871===_0xe565('0x77')||_0x374871===_0xe565('0x78')||_0x374871===_0xe565('0x79')||_0x374871===_0xe565('0x7a')||_0x374871==='rtpaudioqoslossbridged'||_0x374871===_0xe565('0x7b')||_0x374871===_0xe565('0x7c')||_0x374871===_0xe565('0x76')||_0x374871==='rtpaudioqosbridged'||_0x374871===_0xe565('0x78')||_0x374871===_0xe565('0x79')||_0x374871===_0xe565('0x7a')||_0x374871==='rtpaudioqoslossbridged'||_0x374871===_0xe565('0x7b')||_0x374871==='rtpaudioqosrttbridged'||_0x374871===_0xe565('0x7d')||_0x374871===_0xe565('0x7e')||_0x374871==='state'||_0x374871===_0xe565('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x30ae28,_0xcb4de4){var _0x57f6ac,_0x11aa97,_0x3330d7;if(_0xcb4de4<=0x0){_0xcb4de4=0x1;}_0x57f6ac=new RegExp(_0xe565('0x7f')+_0xcb4de4+'}$');_0x11aa97=Math[_0xe565('0x80')](0xa,_0xcb4de4-0x1);_0x3330d7=Math[_0xe565('0x80')](0xa,_0xcb4de4)-0x1;return util[_0xe565('0x12')]('%s',_['replace'](_0x30ae28,_0x57f6ac,_[_0xe565('0x81')](_0x11aa97,_0x3330d7)));};exports[_0xe565('0x82')]=function(_0x4b6c28){var _0x51938e=_0x4b6c28[_0xe565('0x83')](/"(.*?)"/);return _0x51938e?_0x51938e[0x1]:_0x4b6c28;};exports[_0xe565('0x84')]=function(_0x55bfbc){var _0x28fa7a=_0x55bfbc[_0xe565('0x83')](/<(.*?)>/);return _0x28fa7a?_0x28fa7a[0x1]:_0x55bfbc;}; \ No newline at end of file +var _0x855f=['add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','buildAcw','not_inuse','reachable','push','createBody','filterKey','type','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','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','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat'];(function(_0x4a1514,_0x466bc7){var _0xbefbb2=function(_0x1fd2de){while(--_0x1fd2de){_0x4a1514['push'](_0x4a1514['shift']());}};_0xbefbb2(++_0x466bc7);}(_0x855f,0x145));var _0xf855=function(_0x1b3d68,_0x381dc9){_0x1b3d68=_0x1b3d68-0x0;var _0x33e126=_0x855f[_0x1b3d68];return _0x33e126;};'use strict';var util=require(_0xf855('0x0'));var _=require('lodash');var moment=require(_0xf855('0x1'));var logger=require(_0xf855('0x2'))(_0xf855('0x3'));var ipAgi=process[_0xf855('0x4')][_0xf855('0x5')]||'127.0.0.1';function getSeconds(_0x4620ba,_0x33ad4f){var _0x4887c0=moment(_0x4620ba)['milliseconds'](0x0);var _0x8d6830=moment(_0x33ad4f)[_0xf855('0x6')](0x0);return _0x4887c0[_0xf855('0x7')](_0x8d6830,_0xf855('0x8'));}exports[_0xf855('0x9')]=function(_0x3a9bda){return function(_0x23f738){logger['error'](_0x3a9bda,util[_0xf855('0xa')](_0x23f738,{'showHidden':![],'depth':null}));};};exports[_0xf855('0xb')]=function(_0x24aebb,_0xe34bb5){logger[_0xf855('0xc')](_0x24aebb,util[_0xf855('0xa')](_0xe34bb5,{'showHidden':![],'depth':null}));};exports[_0xf855('0xd')]=function(_0x53d217,_0x482030){logger[_0xf855('0xe')](_0x53d217,util[_0xf855('0xa')](_0x482030,{'showHidden':![],'depth':null}));};exports[_0xf855('0xf')]=function(_0x57eb2f){return function(_0x188ec1){logger[_0xf855('0xc')](_0x57eb2f,util[_0xf855('0xa')](_0x188ec1,{'showHidden':![],'depth':null}));};};exports[_0xf855('0x10')]=function(_0xb39e74,_0x312984,_0x5877b){return{'message':_0xb39e74,'unlock':_0x312984,'active':_0x5877b};};exports['getCallerId']=function(_0x42edd8,_0x2bdcc3,_0x39a0fe){if(!_[_0xf855('0x11')](_0x39a0fe)&&_0xf855('0x12')===typeof _0x39a0fe&&!_[_0xf855('0x13')](_0x39a0fe)){if(!_[_0xf855('0x11')](_0x2bdcc3)&&'string'===typeof _0x2bdcc3&&!_['isEmpty'](_0x2bdcc3)){return util[_0xf855('0x14')](_0xf855('0x15'),_0x2bdcc3,_0x39a0fe);}return util[_0xf855('0x14')]('\x22%s\x22\x20<%s>',_0x39a0fe,_0x39a0fe);}if(!_[_0xf855('0x11')](_0x42edd8)&&_0xf855('0x12')===typeof _0x42edd8&&!_['isEmpty'](_0x42edd8)){return _0x42edd8;}return'\x22\x22\x20<>';};exports[_0xf855('0x16')]=function(_0x43cbd0){if(_[_0xf855('0x17')](_0x43cbd0)){return![];}return _0x43cbd0;};exports[_0xf855('0x18')]=function(_0x81b60a,_0x24e3ad,_0x30f0e3,_0xdefc1c,_0x1995f7,_0x9ab34d){var _0x329687={'XMD-QUEUE':_0x24e3ad[_0xf855('0x19')]?_0x24e3ad[_0xf855('0x19')]['name']:'','XMD-CALLERID':_0xdefc1c,'XMD-CALLERID-PREVIEW':_0x9ab34d?util[_0xf855('0x14')](_0xf855('0x15'),_0x9ab34d[_0xf855('0x1a')],_0x9ab34d['calleridnum']):_0xdefc1c,'XMD-DIALID':_0x1995f7,'XMD-CONTACTID':_0x24e3ad[_0xf855('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xdefc1c,'XMD-VOICEQUEUEID':_0x24e3ad[_0xf855('0x1c')],'XMD-DIALCHANNEL':_0x30f0e3,'XMD-DIALTIMEOUT':_0x81b60a[_0xf855('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xf855('0x14')]('\x22rtTxX%s%s\x22',_0x81b60a[_0xf855('0x1e')]?'g':'',_[_0xf855('0x13')](_0x81b60a['monitor_format'])?'':_0xf855('0x1f')),'XMD-DIALURL':_0x81b60a[_0xf855('0x20')]||'','XMD-AGI':_0x81b60a[_0xf855('0x21')]?util[_0xf855('0x14')](_0xf855('0x22'),ipAgi,_0x81b60a['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x81b60a[_0xf855('0x1e')]?util[_0xf855('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x81b60a[_0xf855('0x1e')]):_0xf855('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x9ab34d?_0x9ab34d[_0xf855('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x9ab34d?_0x9ab34d[_0xf855('0x25')]:'','XMD-DESTINATION':_0xf855('0x26')};if(!_[_0xf855('0x13')](_0x81b60a[_0xf855('0x27')])){_0x329687[util[_0xf855('0x14')]('%s',_0xf855('0x28'))]=_0x81b60a[_0xf855('0x27')];_0x329687[util[_0xf855('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1995f7;}if(_0x24e3ad&&_0x24e3ad[_0xf855('0x29')]){for(var _0x574033 in _0x24e3ad['Contact']){if(_0x24e3ad['Contact'][_0xf855('0x2a')](_0x574033)){if(!_[_0xf855('0x17')](_0x24e3ad[_0xf855('0x29')][_0x574033])&&_0x574033!=='id'&&_0x574033!==_0xf855('0x2b')&&_0x574033!=='createdAt'&&_0x574033!==_0xf855('0x2c')){_0x329687[util[_0xf855('0x14')](_0xf855('0x2d'),_0xf855('0x2e'),_['toUpper'](_0x574033))]=_0x24e3ad[_0xf855('0x29')][_0x574033];}}}}return _0x329687;};exports[_0xf855('0x2f')]=function(_0x6d9206){var _0xbc9b0b={};for(var _0x529af5 in _0x6d9206){if(_0x6d9206['hasOwnProperty'](_0x529af5)){_0xbc9b0b[util[_0xf855('0x14')]('%s',_[_0xf855('0x30')](_0x529af5))]=_0x6d9206[_0x529af5];}}return{'variables':_0xbc9b0b};};exports['updateOriginated']=function(_0x1f77d5,_0x5ab5d6){if(!_[_0xf855('0x17')](_0x1f77d5)){if(_0x1f77d5[_0xf855('0x2a')](_0xf855('0x31'))){if(_0x1f77d5[_0xf855('0x31')]>0x0){_0x1f77d5[_0xf855('0x31')]-=0x1;}else{logger[_0xf855('0xe')](_0xf855('0x32'),_0x5ab5d6);}}}else{logger[_0xf855('0xe')](_0xf855('0x33'),_0x5ab5d6);}};exports[_0xf855('0x34')]=function(_0x98a68d){var _0x3a6f64=moment()[_0xf855('0x14')](_0xf855('0x35'));_0x98a68d[_0xf855('0x36')]=0xd;_0x98a68d[_0xf855('0x37')]=_0xf855('0x38');_0x98a68d[_0xf855('0x39')]=_0x3a6f64;_0x98a68d['responsetime']=_0x3a6f64;_0x98a68d[_0xf855('0x3a')]=_0x3a6f64;};exports[_0xf855('0x3b')]=function(_0x2f54ae,_0x4eb368,_0xd4916b){var _0xd2edc2=moment()[_0xf855('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f54ae[_0xf855('0x36')]=_0x4eb368;_0x2f54ae[_0xf855('0x37')]=_0xd4916b;_0x2f54ae[_0xf855('0x3c')]=_0xd2edc2;_0x2f54ae[_0xf855('0x3d')]=getSeconds(_0x2f54ae[_0xf855('0x3c')],_0x2f54ae[_0xf855('0x39')]);};exports[_0xf855('0x3e')]=function(_0x59a0a7,_0x385775,_0x214fec){_0x59a0a7[_0xf855('0x3f')]=_0x385775;_0x59a0a7[_0xf855('0x40')]=_0x214fec;};exports[_0xf855('0x41')]=function(_0x3ab673,_0x24f92b,_0x335949){var _0x243f25=moment()[_0xf855('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ab673[_0xf855('0x36')]=_0x24f92b;_0x3ab673[_0xf855('0x37')]=_0x335949;_0x3ab673[_0xf855('0x3c')]=_0x3ab673[_0xf855('0x3c')]?_0x3ab673[_0xf855('0x3c')]:_0x243f25;_0x3ab673[_0xf855('0x3a')]=_0x3ab673[_0xf855('0x3a')]?_0x3ab673['endtime']:_0x243f25;_0x3ab673[_0xf855('0x3d')]=getSeconds(_0x3ab673[_0xf855('0x3c')]||0x0,_0x3ab673[_0xf855('0x39')]||0x0);_0x3ab673[_0xf855('0x42')]=_0x3ab673[_0xf855('0x43')]?getSeconds(_0x3ab673['endtime'],_0x3ab673[_0xf855('0x43')]):0x0;};exports['isFailure']=function(_0x4dda78){return _0x4dda78===_0xf855('0x44');};exports['variablesAction']=function(_0xb9091b,_0x54c7a1,_0x425750,_0x4664b2,_0x510228){var _0x2a664a=_0x4664b2?_0xf855('0x45'):_0xb9091b[_0xf855('0x1a')];_0x2a664a=_0x510228?_0xf855('0x46'):_0x2a664a;return{'actionid':_0xb9091b[_0xf855('0x47')],'action':_0xf855('0x48'),'channel':_0xb9091b[_0xf855('0x49')],'callerid':util[_0xf855('0x14')](_0xf855('0x15'),_0x2a664a,_0xb9091b[_0xf855('0x4a')]),'Exten':_0xf855('0x26'),'Context':'from-sip','Priority':'1','variable':_0x425750,'timeout':(_0x54c7a1[_0xf855('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0xb9091b[_0xf855('0x47')]};};exports[_0xf855('0x4c')]=function(_0x30e776){return _0x30e776[_0xf855('0x4d')]+_0x30e776['countcongestionretry']+_0x30e776[_0xf855('0x4e')]+_0x30e776[_0xf855('0x4f')]+_0x30e776[_0xf855('0x50')];};exports[_0xf855('0x51')]=function(_0x31488b){var _0x1228ae=_[_0xf855('0x52')](_0x31488b);_0x1228ae[_0xf855('0x36')]=0xf;_0x1228ae[_0xf855('0x37')]=_0xf855('0x53');return _0x1228ae;};exports[_0xf855('0x54')]=function(_0xecf524,_0x384ae3,_0x698f27){var _0x459b3b={};_0x459b3b[_0x384ae3]=_0xecf524[_0x384ae3];_0x459b3b['active']=![];_0x459b3b[_0xf855('0x55')]=moment()[_0xf855('0x56')](_0x698f27,'minutes')[_0xf855('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x459b3b[_0xf855('0x1b')]=_0xecf524['ContactId'];_0x459b3b[_0xf855('0x57')]=_0xecf524[_0xf855('0x57')];_0x459b3b[_0xf855('0x1c')]=_0xecf524['VoiceQueueId']||undefined;return _0x459b3b;};exports[_0xf855('0x58')]=function(_0x5eaf60,_0x542a68){if(!_[_0xf855('0x17')](_0x5eaf60)){if(_0x5eaf60[_0xf855('0x59')]>0x0){_0x5eaf60['pTalking']-=0x1;}else{logger[_0xf855('0xe')](_0x542a68,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x542a68,_0xf855('0x5a'));}};exports[_0xf855('0x5b')]=function(_0x14b074){if(_0x14b074<=0x0){return!![];}return![];};exports[_0xf855('0x5c')]=function(_0x5433be,_0x142b53){_0x5433be[_0xf855('0x5d')]=_0x142b53;_0x5433be[_0xf855('0x5e')]=_0x5433be[_0xf855('0x5f')];_0x5433be[_0xf855('0x60')]=_0x5433be[_0xf855('0x49')];return _0x5433be;};exports[_0xf855('0x61')]=function(_0x3131f1){var _0x4ba97c={};_0x4ba97c['queue']=_0x3131f1[_0xf855('0x5f')];_0x4ba97c[_0xf855('0x60')]=_0x3131f1[_0xf855('0x49')];_0x4ba97c[_0xf855('0x47')]=_0x3131f1[_0xf855('0x47')];return _0x4ba97c;};exports['agentReadyId']=function(_0x2a09d1){var _0x468eb9=[];for(var _0x5cf401 in _0x2a09d1){if(_0x2a09d1[_0xf855('0x2a')](_0x5cf401)){if(!_[_0xf855('0x17')](_0x2a09d1[_0x5cf401])&&_0x2a09d1[_0x5cf401][_0xf855('0x36')]===_0xf855('0x62')&&_0x2a09d1[_0x5cf401]['status']===_0xf855('0x63')){_0x468eb9[_0xf855('0x64')](_0x2a09d1[_0x5cf401]['id']);}}}return _0x468eb9;};exports['getDiff']=function(_0xb7da8f){var _0x12aad6=moment()[_0xf855('0x6')](0x0);var _0x56036b=moment(_0xb7da8f)[_0xf855('0x6')](0x0);return _0x12aad6[_0xf855('0x7')](_0x56036b,_0xf855('0x8'));};exports[_0xf855('0x65')]=function(_0x4a67b1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4a67b1[_0xf855('0x1b')],'ListId':_0x4a67b1[_0xf855('0x57')],'VoiceQueueId':_0x4a67b1[_0xf855('0x1c')]||undefined,'CampaignId':_0x4a67b1['CampaignId']||undefined};};exports[_0xf855('0x66')]=function(_0x46ec2c){if(_0x46ec2c==='uniqueid'||_0x46ec2c==='idContact'||_0x46ec2c==='queue'||_0x46ec2c===_0xf855('0x67')||_0x46ec2c===_0xf855('0x68')||_0x46ec2c===_0xf855('0x69')||_0x46ec2c===_0xf855('0x3f')||_0x46ec2c===_0xf855('0x49')||_0x46ec2c==='calleridname'||_0x46ec2c===_0xf855('0x6a')||_0x46ec2c===_0xf855('0x4a')||_0x46ec2c===_0xf855('0x55')||_0x46ec2c===_0xf855('0x4d')||_0x46ec2c==='countcongestionretry'||_0x46ec2c===_0xf855('0x4e')||_0x46ec2c===_0xf855('0x6b')||_0x46ec2c===_0xf855('0x6c')||_0x46ec2c===_0xf855('0x6d')||_0x46ec2c==='callbackat'||_0x46ec2c===_0xf855('0x6e')||_0x46ec2c===_0xf855('0x1b')||_0x46ec2c===_0xf855('0x57')||_0x46ec2c===_0xf855('0x40')||_0x46ec2c==='VoiceQueueId'||_0x46ec2c==='sipcallid'||_0x46ec2c===_0xf855('0x6f')||_0x46ec2c===_0xf855('0x70')||_0x46ec2c===_0xf855('0x71')||_0x46ec2c===_0xf855('0x72')||_0x46ec2c===_0xf855('0x73')||_0x46ec2c==='xmd-dialtimeout'||_0x46ec2c==='xmd-dialoptions'||_0x46ec2c===_0xf855('0x74')||_0x46ec2c==='xmd-dialchannel'||_0x46ec2c===_0xf855('0x75')||_0x46ec2c===_0xf855('0x76')||_0x46ec2c===_0xf855('0x77')||_0x46ec2c===_0xf855('0x78')||_0x46ec2c===_0xf855('0x79')||_0x46ec2c==='rtpaudioqos'||_0x46ec2c===_0xf855('0x7a')||_0x46ec2c==='rtpaudioqosjitter'||_0x46ec2c===_0xf855('0x7b')||_0x46ec2c===_0xf855('0x7c')||_0x46ec2c===_0xf855('0x7d')||_0x46ec2c===_0xf855('0x7e')||_0x46ec2c===_0xf855('0x7f')||_0x46ec2c===_0xf855('0x80')||_0x46ec2c===_0xf855('0x7a')||_0x46ec2c==='rtpaudioqosjitter'||_0x46ec2c===_0xf855('0x7b')||_0x46ec2c==='rtpaudioqosloss'||_0x46ec2c===_0xf855('0x7d')||_0x46ec2c===_0xf855('0x7e')||_0x46ec2c===_0xf855('0x7f')||_0x46ec2c===_0xf855('0x81')||_0x46ec2c===_0xf855('0x82')||_0x46ec2c===_0xf855('0x36')||_0x46ec2c===_0xf855('0x37')){return![];}return!![];};exports[_0xf855('0x83')]=function(_0x3eb961,_0x5a8b5c){var _0x52b0f0,_0x54d069,_0x46b248;if(_0x5a8b5c<=0x0){_0x5a8b5c=0x1;}_0x52b0f0=new RegExp(_0xf855('0x84')+_0x5a8b5c+'}$');_0x54d069=Math['pow'](0xa,_0x5a8b5c-0x1);_0x46b248=Math[_0xf855('0x85')](0xa,_0x5a8b5c)-0x1;return util[_0xf855('0x14')]('%s',_['replace'](_0x3eb961,_0x52b0f0,_[_0xf855('0x86')](_0x54d069,_0x46b248)));};exports[_0xf855('0x87')]=function(_0x2294fd){var _0x20e273=_0x2294fd[_0xf855('0x88')](/"(.*?)"/);return _0x20e273?_0x20e273[0x1]:_0x2294fd;};exports['extractCalleridNumber']=function(_0x3eb368){var _0x48ccd3=_0x3eb368[_0xf855('0x88')](/<(.*?)>/);return _0x48ccd3?_0x48ccd3[0x1]:_0x3eb368;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 9907789..ff49c1d 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x2cf420,_0x96ad71){var _0x4ae92b=function(_0x388ec4){while(--_0x388ec4){_0x2cf420['push'](_0x2cf420['shift']());}};_0x4ae92b(++_0x96ad71);}(_0x5f2f,0x73));var _0xf5f2=function(_0x411b2f,_0x43d974){_0x411b2f=_0x411b2f-0x0;var _0x31978a=_0x5f2f[_0x411b2f];return _0x31978a;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x39e15c,_0x16361b){var _0x2a5879=function(_0x3436f2){while(--_0x3436f2){_0x39e15c['push'](_0x39e15c['shift']());}};_0x2a5879(++_0x16361b);}(_0x7a54,0x106));var _0x47a5=function(_0x56917e,_0x252166){_0x56917e=_0x56917e-0x0;var _0x2a3438=_0x7a54[_0x56917e];return _0x2a3438;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 9d63a3b..9fbdb94 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 _0x600e=['answered','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','merge','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','interface','name','total','sumHoldTime','sumDuration','sumBillable','isEmpty','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','initTelephones','isUndefined','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueReports','groupBy','queue','queuecallerexit','unmanaged','abandoned','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x600e,0x1b7));var _0xe600=function(_0x1b251b,_0x4c5a8e){_0x1b251b=_0x1b251b-0x0;var _0x569c56=_0x600e[_0x1b251b];return _0x569c56;};'use strict';var BPromise=require(_0xe600('0x0'));var util=require(_0xe600('0x1'));var _=require(_0xe600('0x2'));var moment=require(_0xe600('0x3'));var Agent=require(_0xe600('0x4'));var Telephone=require(_0xe600('0x5'));var Trunk=require(_0xe600('0x6'));var VoiceQueue=require(_0xe600('0x7'));var Trigger=require('../model/trigger');var Template=require(_0xe600('0x8'));var Campaign=require(_0xe600('0x9'));var VoiceExtension=require(_0xe600('0xa'));var ZendeskAccount=require(_0xe600('0xb'));var SalesforceAccount=require(_0xe600('0xc'));var FreshdeskAccount=require(_0xe600('0xd'));var SugarcrmAccount=require(_0xe600('0xe'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xe600('0xf'));var FreshsalesAccount=require(_0xe600('0x10'));var FaxAccount=require(_0xe600('0x11'));var Realtime=function(){this[_0xe600('0x12')]={};this[_0xe600('0x13')]={};this['trunks']={};this[_0xe600('0x14')]={};this[_0xe600('0x15')]={};this[_0xe600('0x16')]={};this['templates']={};this[_0xe600('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe600('0x18')]={};this[_0xe600('0x19')]={};this[_0xe600('0x1a')]={};this[_0xe600('0x1b')]={};this[_0xe600('0x1c')]={};this[_0xe600('0x1d')]={};this[_0xe600('0x1e')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xe600('0x1f')]={};this[_0xe600('0x20')]={};this[_0xe600('0x21')]={};this[_0xe600('0x22')]={};this[_0xe600('0x23')]={};this[_0xe600('0x24')]={};this[_0xe600('0x25')]={};};function freeIsNotKey(_0x469980,_0x4479a4,_0x3743f6){var _0x1ddb0c=_[_0xe600('0x26')](_0x469980,function(_0x1da416,_0x53393a){return _0x1da416[_0x3743f6];});for(var _0x59ce7f in _0x4479a4){if(_0x4479a4[_0xe600('0x27')](_0x59ce7f)){if(!_0x1ddb0c[_0x59ce7f]){delete _0x4479a4[_0x59ce7f];}}}}function freeIsNotKeySip(_0x3f1a86,_0x65885d){var _0x5af954=_[_0xe600('0x26')](_0x3f1a86,function(_0x12992e,_0x148c2f){return util[_0xe600('0x28')](_0xe600('0x29'),_0x12992e['name']);});for(var _0x361b5f in _0x65885d){if(_0x65885d[_0xe600('0x27')](_0x361b5f)){if(!_0x5af954[_0x361b5f]){delete _0x65885d[_0x361b5f];}}}}function freeIsNotKeyAgent(_0x4c1553,_0xfd79ec){var _0x4c672c=_[_0xe600('0x26')](_0x4c1553,function(_0x2948eb,_0xa1df5e){var _0x20077a=_[_0xe600('0x2a')](_0x2948eb[_0xe600('0x2b')])?util['format'](_0xe600('0x29'),_0x2948eb[_0xe600('0x2c')]):_0x2948eb[_0xe600('0x2b')];return _0x20077a;});for(var _0x47ec14 in _0xfd79ec){if(_0xfd79ec[_0xe600('0x27')](_0x47ec14)){if(!_0x4c672c[_0x47ec14]){delete _0xfd79ec[_0x47ec14];}}}}function clearVoiceCallReports(_0x3a962c){_0x3a962c[_0xe600('0x2d')]=0x0;_0x3a962c['answered']=0x0;_0x3a962c[_0xe600('0x2e')]=0x0;_0x3a962c[_0xe600('0x2f')]=0x0;_0x3a962c[_0xe600('0x30')]=0x0;}function clearCampaigns(_0x57568c){if(!_[_0xe600('0x31')](_0x57568c)){for(var _0x4041b3 in _0x57568c){if(_0x57568c['hasOwnProperty'](_0x4041b3)){_0x57568c[_0x4041b3]['ivrTotalCallsDays']=0x0;_0x57568c[_0x4041b3]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x244530){if(!_[_0xe600('0x31')](_0x244530)){for(var _0x5914e2 in _0x244530){if(_0x244530['hasOwnProperty'](_0x5914e2)){_0x244530[_0x5914e2]['total']=0x0;_0x244530[_0x5914e2]['answered']=0x0;_0x244530[_0x5914e2]['unmanaged']=0x0;_0x244530[_0x5914e2]['abandoned']=0x0;_0x244530[_0x5914e2]['sumHoldTime']=0x0;_0x244530[_0x5914e2][_0xe600('0x2f')]=0x0;_0x244530[_0x5914e2][_0xe600('0x30')]=0x0;_0x244530[_0x5914e2][_0xe600('0x32')]=0x0;_0x244530[_0x5914e2][_0xe600('0x33')]=0x0;_0x244530[_0x5914e2]['outboundBusyCallsDay']=0x0;_0x244530[_0x5914e2][_0xe600('0x34')]=0x0;_0x244530[_0x5914e2][_0xe600('0x35')]=0x0;_0x244530[_0x5914e2][_0xe600('0x36')]=0x0;_0x244530[_0x5914e2][_0xe600('0x37')]=0x0;_0x244530[_0x5914e2][_0xe600('0x38')]=0x0;_0x244530[_0x5914e2]['outboundBlacklistCallsDay']=0x0;_0x244530[_0x5914e2][_0xe600('0x39')]=0x0;_0x244530[_0x5914e2]['outboundRejectCallsDay']=0x0;_0x244530[_0x5914e2][_0xe600('0x3a')]=0x0;_0x244530[_0x5914e2][_0xe600('0x32')]=0x0;_0x244530[_0x5914e2][_0xe600('0x3b')]=0x0;_0x244530[_0x5914e2][_0xe600('0x3c')]=!![];}}}}Realtime[_0xe600('0x3d')][_0xe600('0x3e')]=function(_0x3fabc0,_0x41f450){for(var _0x2277f8 in _0x41f450){if(_0x3fabc0['hasOwnProperty'](_0x2277f8)){_0x3fabc0[_0x2277f8]=_0x41f450[_0x2277f8];}}};Realtime['prototype'][_0xe600('0x3f')]=function(){var _0x43e6a9=this;return function(_0x5dcf12){if(_0x5dcf12){freeIsNotKeyAgent(_0x5dcf12,_0x43e6a9[_0xe600('0x12')]);for(var _0x511023=0x0,_0x45e368={},_0x258464={};_0x511023<_0x5dcf12[_0xe600('0x40')];_0x511023+=0x1){_0x45e368=_0x5dcf12[_0x511023];var _0x2838ea=_['isNil'](_0x45e368[_0xe600('0x2b')])?util[_0xe600('0x28')](_0xe600('0x29'),_0x45e368[_0xe600('0x2c')]):_0x45e368[_0xe600('0x2b')];if(_['isUndefined'](_0x43e6a9['agents'][_0x2838ea])){_0x43e6a9[_0xe600('0x12')][_0x2838ea]=new Agent(_0x45e368);}else{_0x43e6a9['mergeFromDatabase'](_0x43e6a9[_0xe600('0x12')][_0x2838ea],_0x45e368);}}}return _0x43e6a9['agents'];};};Realtime[_0xe600('0x3d')][_0xe600('0x41')]=function(){var _0x3980a0=this;return function(_0x27ed25){if(_0x27ed25){freeIsNotKeySip(_0x27ed25,_0x3980a0['telephones']);for(var _0x41a13c=0x0,_0x3218c8={},_0x2e2a61={};_0x41a13c<_0x27ed25[_0xe600('0x40')];_0x41a13c+=0x1){_0x3218c8=_0x27ed25[_0x41a13c];if(_[_0xe600('0x42')](_0x3980a0[_0xe600('0x13')][util[_0xe600('0x28')](_0xe600('0x29'),_0x3218c8[_0xe600('0x2c')])])){_0x3980a0[_0xe600('0x13')][util['format'](_0xe600('0x29'),_0x3218c8[_0xe600('0x2c')])]=new Telephone(_0x3218c8);}else{_0x3980a0['mergeFromDatabase'](_0x3980a0['telephones'][util['format'](_0xe600('0x29'),_0x3218c8[_0xe600('0x2c')])],_0x3218c8);}}}return _0x3980a0[_0xe600('0x13')];};};Realtime[_0xe600('0x3d')][_0xe600('0x43')]=function(){var _0x53226c=this;return function(_0x44efa1){if(_0x44efa1){freeIsNotKeySip(_0x44efa1,_0x53226c[_0xe600('0x44')]);for(var _0x5e737e=0x0,_0x486269={},_0xdc2d89={};_0x5e737e<_0x44efa1['length'];_0x5e737e+=0x1){_0x486269=_0x44efa1[_0x5e737e];if(_['isUndefined'](_0x53226c[_0xe600('0x44')][util[_0xe600('0x28')](_0xe600('0x29'),_0x486269['name'])])){_0x53226c[_0xe600('0x44')][util[_0xe600('0x28')](_0xe600('0x29'),_0x486269[_0xe600('0x2c')])]=new Trunk(_0x486269);}else{_0x53226c[_0xe600('0x3e')](_0x53226c[_0xe600('0x44')][util[_0xe600('0x28')]('SIP/%s',_0x486269[_0xe600('0x2c')])],_0x486269);}}}return _0x53226c[_0xe600('0x44')];};};Realtime[_0xe600('0x3d')][_0xe600('0x45')]=function(){var _0x459af9=this;return function(_0x593650){if(_0x593650){freeIsNotKey(_0x593650,_0x459af9[_0xe600('0x14')],'name');for(var _0x41b045=0x0,_0x43104b={},_0x3a72df={};_0x41b045<_0x593650['length'];_0x41b045+=0x1){_0x43104b=_0x593650[_0x41b045];if(_['isUndefined'](_0x459af9[_0xe600('0x14')][_0x43104b[_0xe600('0x2c')]])){_0x459af9['voiceQueues'][_0x43104b[_0xe600('0x2c')]]=new VoiceQueue(_0x43104b);}else{_0x459af9[_0xe600('0x3e')](_0x459af9[_0xe600('0x14')][_0x43104b[_0xe600('0x2c')]],_0x43104b);}}}return _0x459af9['voiceQueues'];};};Realtime[_0xe600('0x3d')][_0xe600('0x46')]=function(){var _0x3508c5=this;return function(_0x34c2e4){if(_0x34c2e4){freeIsNotKey(_0x34c2e4,_0x3508c5[_0xe600('0x15')],'id');for(var _0x31d4a7=0x0,_0xcb8f21={},_0x4a01d9={};_0x31d4a7<_0x34c2e4[_0xe600('0x40')];_0x31d4a7+=0x1){_0xcb8f21=_0x34c2e4[_0x31d4a7];if(_[_0xe600('0x42')](_0x3508c5[_0xe600('0x15')][_0xcb8f21['id']])){_0x3508c5[_0xe600('0x15')][_0xcb8f21['id']]=new Trigger(_0xcb8f21);}else{_0x3508c5[_0xe600('0x3e')](_0x3508c5[_0xe600('0x15')][_0xcb8f21['id']],_0xcb8f21);}}}return _0x3508c5[_0xe600('0x15')];};};Realtime[_0xe600('0x3d')][_0xe600('0x47')]=function(){var _0x5210c3=this;return function(_0xe0d9ca){if(_0xe0d9ca){freeIsNotKey(_0xe0d9ca,_0x5210c3[_0xe600('0x48')],'id');for(var _0x2b520b=0x0,_0x3f24b4={},_0x173334={};_0x2b520b<_0xe0d9ca['length'];_0x2b520b+=0x1){_0x3f24b4=_0xe0d9ca[_0x2b520b];if(_[_0xe600('0x42')](_0x5210c3[_0xe600('0x48')][_0x3f24b4['id']])){_0x5210c3[_0xe600('0x48')][_0x3f24b4['id']]=new Template(_0x3f24b4);}else{_0x5210c3[_0xe600('0x3e')](_0x5210c3[_0xe600('0x48')][_0x3f24b4['id']],_0x3f24b4);}}}return _0x5210c3[_0xe600('0x48')];};};Realtime[_0xe600('0x3d')][_0xe600('0x49')]=function(){var _0x67c9f7=this;return function(_0x466389){if(_0x466389){freeIsNotKey(_0x466389,_0x67c9f7[_0xe600('0x1d')],'id');for(var _0x32e08a=0x0,_0x2bfd0d={},_0x5b4342={};_0x32e08a<_0x466389[_0xe600('0x40')];_0x32e08a+=0x1){_0x2bfd0d=_0x466389[_0x32e08a];if(_[_0xe600('0x42')](_0x67c9f7[_0xe600('0x1d')][_0x2bfd0d['id']])){_0x67c9f7[_0xe600('0x1d')][_0x2bfd0d['id']]=new ZendeskAccount(_0x2bfd0d);}else{_0x67c9f7[_0xe600('0x3e')](_0x67c9f7[_0xe600('0x1d')][_0x2bfd0d['id']],_0x2bfd0d);}}}return _0x67c9f7[_0xe600('0x1d')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x5f0cdf=this;return function(_0x147a89){if(_0x147a89){freeIsNotKey(_0x147a89,_0x5f0cdf['salesforceAccounts'],'id');for(var _0x473c84=0x0,_0x2c3879={},_0x631533={};_0x473c84<_0x147a89[_0xe600('0x40')];_0x473c84+=0x1){_0x2c3879=_0x147a89[_0x473c84];if(_[_0xe600('0x42')](_0x5f0cdf[_0xe600('0x1e')][_0x2c3879['id']])){_0x5f0cdf[_0xe600('0x1e')][_0x2c3879['id']]=new SalesforceAccount(_0x2c3879);}else{_0x5f0cdf[_0xe600('0x3e')](_0x5f0cdf['salesforceAccounts'][_0x2c3879['id']],_0x2c3879);}}}return _0x5f0cdf['salesforceAccounts'];};};Realtime['prototype'][_0xe600('0x4a')]=function(){var _0x1e27e6=this;return function(_0x55dd1f){if(_0x55dd1f){freeIsNotKey(_0x55dd1f,_0x1e27e6[_0xe600('0x4b')],'id');for(var _0x35d4cf=0x0,_0x8e020e={},_0x3f7d78={};_0x35d4cf<_0x55dd1f[_0xe600('0x40')];_0x35d4cf+=0x1){_0x8e020e=_0x55dd1f[_0x35d4cf];if(_[_0xe600('0x42')](_0x1e27e6[_0xe600('0x4b')][_0x8e020e['id']])){_0x1e27e6[_0xe600('0x4b')][_0x8e020e['id']]=new FreshdeskAccount(_0x8e020e);}else{_0x1e27e6['mergeFromDatabase'](_0x1e27e6[_0xe600('0x4b')][_0x8e020e['id']],_0x8e020e);}}}return _0x1e27e6['freshdeskAccounts'];};};Realtime[_0xe600('0x3d')][_0xe600('0x4c')]=function(){var _0x228596=this;return function(_0x230587){if(_0x230587){freeIsNotKey(_0x230587,_0x228596['zohoAccounts'],'id');for(var _0xd78c1a=0x0,_0x565ebc={},_0x46c710={};_0xd78c1a<_0x230587['length'];_0xd78c1a+=0x1){_0x565ebc=_0x230587[_0xd78c1a];if(_[_0xe600('0x42')](_0x228596['zohoAccounts'][_0x565ebc['id']])){_0x228596[_0xe600('0x1f')][_0x565ebc['id']]=new ZohoAccount(_0x565ebc);}else{_0x228596[_0xe600('0x3e')](_0x228596['zohoAccounts'][_0x565ebc['id']],_0x565ebc);}}}return _0x228596[_0xe600('0x1f')];};};Realtime[_0xe600('0x3d')][_0xe600('0x4d')]=function(){var _0x28ab90=this;return function(_0x221d35){if(_0x221d35){freeIsNotKey(_0x221d35,_0x28ab90[_0xe600('0x20')],'id');for(var _0x2c637b=0x0,_0x17f757={},_0x2c4152={};_0x2c637b<_0x221d35[_0xe600('0x40')];_0x2c637b+=0x1){_0x17f757=_0x221d35[_0x2c637b];if(_[_0xe600('0x42')](_0x28ab90[_0xe600('0x20')][_0x17f757['id']])){_0x28ab90['deskAccounts'][_0x17f757['id']]=new DeskAccount(_0x17f757);}else{_0x28ab90[_0xe600('0x3e')](_0x28ab90[_0xe600('0x20')][_0x17f757['id']],_0x17f757);}}}return _0x28ab90['deskAccounts'];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x50c75b=this;return function(_0xde74cb){if(_0xde74cb){freeIsNotKey(_0xde74cb,_0x50c75b[_0xe600('0x4e')],'id');for(var _0x449393=0x0,_0xfe524f={},_0x2afbc1={};_0x449393<_0xde74cb['length'];_0x449393+=0x1){_0xfe524f=_0xde74cb[_0x449393];if(_['isUndefined'](_0x50c75b[_0xe600('0x4e')][_0xfe524f['id']])){_0x50c75b[_0xe600('0x4e')][_0xfe524f['id']]=new SugarcrmAccount(_0xfe524f);}else{_0x50c75b[_0xe600('0x3e')](_0x50c75b['sugarcrmAccounts'][_0xfe524f['id']],_0xfe524f);}}}return _0x50c75b[_0xe600('0x4e')];};};Realtime[_0xe600('0x3d')][_0xe600('0x4f')]=function(){var _0x54c98b=this;return function(_0x1212b6){if(_0x1212b6){freeIsNotKey(_0x1212b6,_0x54c98b[_0xe600('0x21')],'id');for(var _0xcbe6ab=0x0,_0x5782d8={},_0x27cd98={};_0xcbe6ab<_0x1212b6[_0xe600('0x40')];_0xcbe6ab+=0x1){_0x5782d8=_0x1212b6[_0xcbe6ab];if(_[_0xe600('0x42')](_0x54c98b[_0xe600('0x21')][_0x5782d8['id']])){_0x54c98b[_0xe600('0x21')][_0x5782d8['id']]=new VtigerAccount(_0x5782d8);}else{_0x54c98b[_0xe600('0x3e')](_0x54c98b[_0xe600('0x21')][_0x5782d8['id']],_0x5782d8);}}}return _0x54c98b[_0xe600('0x21')];};};Realtime[_0xe600('0x3d')][_0xe600('0x50')]=function(){var _0x3c6234=this;return function(_0x37ef96){if(_0x37ef96){freeIsNotKey(_0x37ef96,_0x3c6234[_0xe600('0x22')],'id');for(var _0x3d8abd=0x0,_0x527334={},_0x35337a={};_0x3d8abd<_0x37ef96[_0xe600('0x40')];_0x3d8abd+=0x1){_0x527334=_0x37ef96[_0x3d8abd];if(_['isUndefined'](_0x3c6234[_0xe600('0x22')][_0x527334['id']])){_0x3c6234[_0xe600('0x22')][_0x527334['id']]=new ServicenowAccount(_0x527334);}else{_0x3c6234['mergeFromDatabase'](_0x3c6234[_0xe600('0x22')][_0x527334['id']],_0x527334);}}}return _0x3c6234[_0xe600('0x22')];};};Realtime['prototype'][_0xe600('0x51')]=function(){var _0xb27180=this;return function(_0x3fa3ba){if(_0x3fa3ba){freeIsNotKey(_0x3fa3ba,_0xb27180[_0xe600('0x23')],'id');for(var _0x1c3b52=0x0,_0x5ec81e={},_0x2dd3ce={};_0x1c3b52<_0x3fa3ba['length'];_0x1c3b52+=0x1){_0x5ec81e=_0x3fa3ba[_0x1c3b52];if(_[_0xe600('0x42')](_0xb27180[_0xe600('0x23')][_0x5ec81e['id']])){_0xb27180['dynamics365Accounts'][_0x5ec81e['id']]=new Dynamics365Account(_0x5ec81e);}else{_0xb27180[_0xe600('0x3e')](_0xb27180[_0xe600('0x23')][_0x5ec81e['id']],_0x5ec81e);}}}return _0xb27180['dynamics365Accounts'];};};Realtime[_0xe600('0x3d')][_0xe600('0x52')]=function(){var _0x28d464=this;return function(_0x10c376){if(_0x10c376){freeIsNotKey(_0x10c376,_0x28d464[_0xe600('0x24')],'id');for(var _0x2352cd=0x0,_0x37b0cc={},_0x5c2415={};_0x2352cd<_0x10c376[_0xe600('0x40')];_0x2352cd+=0x1){_0x37b0cc=_0x10c376[_0x2352cd];if(_['isUndefined'](_0x28d464[_0xe600('0x24')][_0x37b0cc['id']])){_0x28d464[_0xe600('0x24')][_0x37b0cc['id']]=new FreshsalesAccount(_0x37b0cc);}else{_0x28d464[_0xe600('0x3e')](_0x28d464[_0xe600('0x24')][_0x37b0cc['id']],_0x37b0cc);}}}return _0x28d464[_0xe600('0x24')];};};Realtime[_0xe600('0x3d')]['initVoiceQueueHopperHistory']=function(){var _0x16b9c2=this;return function(_0x33baf0){for(var _0x5082a8=0x0;_0x5082a8<_0x33baf0[_0xe600('0x40')];_0x5082a8+=0x1){_['merge'](_0x16b9c2[_0xe600('0x14')][_0x33baf0[_0x5082a8][_0xe600('0x2c')]],_0x33baf0[_0x5082a8]);}return _0x16b9c2[_0xe600('0x14')];};};Realtime[_0xe600('0x3d')][_0xe600('0x53')]=function(){var _0x1d7b68=this;return function(_0x1be451){clearVoiceQueues(_0x1d7b68[_0xe600('0x14')]);if(_0x1be451){_0x1be451=_[_0xe600('0x54')](_0x1be451,'uniqueid');for(var _0x11b136 in _0x1be451){if(_0x1be451[_0xe600('0x27')](_0x11b136)){var _0x3825e4={};for(var _0x32a20b=0x0;_0x32a20b<_0x1be451[_0x11b136][_0xe600('0x40')];_0x32a20b+=0x1){var _0x296007=_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x55')];if(_0x1d7b68[_0xe600('0x14')][_0x296007]){if(_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x56')]){_0x1d7b68[_0xe600('0x14')][_0x296007][_0xe600('0x57')]+=0x1;}if(_0x1be451[_0x11b136][_0x32a20b]['queuecallerabandon']){_0x1d7b68['voiceQueues'][_0x296007][_0xe600('0x58')]+=0x1;}_0x1d7b68['voiceQueues'][_0x296007][_0xe600('0x2e')]+=moment(_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x59')])['diff'](moment(_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x5a')]),_0xe600('0x5b'))||0x0;if(_0x32a20b===_0x1be451[_0x11b136][_0xe600('0x40')]-0x1){_0x1d7b68[_0xe600('0x14')][_0x296007][_0xe600('0x2f')]+=moment(_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x5c')]||_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x5d')]||_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x5e')])['diff'](moment(_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x5a')]),_0xe600('0x5b'))||0x0;_0x1d7b68['voiceQueues'][_0x296007][_0xe600('0x2d')]+=0x1;if(_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x5f')]){_0x1d7b68['voiceQueues'][_0x296007][_0xe600('0x60')]+=0x1;_0x1d7b68[_0xe600('0x14')][_0x296007][_0xe600('0x30')]+=moment(_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x5c')])['diff'](moment(_0x1be451[_0x11b136][_0x32a20b][_0xe600('0x59')]),'seconds')||0x0;}}else{_0x1d7b68[_0xe600('0x14')][_0x296007][_0xe600('0x2f')]+=_0x1d7b68['voiceQueues'][_0x296007][_0xe600('0x2e')]||0x0;}}}}}}return _0x1d7b68[_0xe600('0x14')];};};Realtime[_0xe600('0x3d')][_0xe600('0x61')]=function(){var _0x4bbabb=this;return function(_0xd2f6d9){clearVoiceCallReports(_0x4bbabb['outbound']);if(_0xd2f6d9){for(var _0x3e043c=0x0;_0x3e043c<_0xd2f6d9['length'];_0x3e043c+=0x1){_0x4bbabb['outbound']['total']+=0x1;_0x4bbabb['outbound'][_0xe600('0x2f')]+=_0xd2f6d9[_0x3e043c][_0xe600('0x62')];if(_0xd2f6d9[_0x3e043c][_0xe600('0x63')]==='ANSWERED'){_0x4bbabb['outbound'][_0xe600('0x60')]+=0x1;_0x4bbabb['outbound'][_0xe600('0x2e')]+=_0xd2f6d9[_0x3e043c]['duration']-_0xd2f6d9[_0x3e043c][_0xe600('0x64')]||0x0;_0x4bbabb['outbound']['sumBillable']+=_0xd2f6d9[_0x3e043c]['billableseconds'];}}}return _0x4bbabb[_0xe600('0x17')];};};Realtime['prototype'][_0xe600('0x65')]=function(){var _0x162b2f=this;return function(_0x1f4331){if(_0x1f4331){freeIsNotKey(_0x1f4331,_0x162b2f[_0xe600('0x16')],_0xe600('0x2c'));for(var _0x371857=0x0,_0x2727bf={};_0x371857<_0x1f4331[_0xe600('0x40')];_0x371857+=0x1){_0x2727bf=_0x1f4331[_0x371857];if(_['isUndefined'](_0x162b2f[_0xe600('0x16')][_0x2727bf[_0xe600('0x2c')]])){_0x162b2f['campaigns'][_0x2727bf[_0xe600('0x2c')]]=new Campaign(_0x2727bf);}else{_0x162b2f[_0xe600('0x3e')](_0x162b2f[_0xe600('0x16')][_0x2727bf[_0xe600('0x2c')]],_0x2727bf);_0x162b2f[_0xe600('0x16')][_0x2727bf['name']][_0xe600('0x66')]=_0x2727bf['SquareProject']?_0x2727bf[_0xe600('0x67')]['name']:undefined;}}}return _0x162b2f['campaigns'];};};Realtime[_0xe600('0x3d')]['initVoiceExtensions']=function(){var _0x5933db=this;return function(_0x3a91ea){if(_0x3a91ea){freeIsNotKey(_0x3a91ea,_0x5933db[_0xe600('0x18')],'id');for(var _0x2bd661=0x0,_0x4eee95={};_0x2bd661<_0x3a91ea[_0xe600('0x40')];_0x2bd661+=0x1){_0x4eee95=_0x3a91ea[_0x2bd661];if(_['isUndefined'](_0x5933db['voiceExtensions'][_0x4eee95['id']])){_0x5933db[_0xe600('0x18')][_0x4eee95['id']]=new VoiceExtension(_0x4eee95);}else{_0x5933db[_0xe600('0x3e')](_0x5933db[_0xe600('0x18')][_0x4eee95['id']],_0x4eee95);}}}return _0x5933db[_0xe600('0x18')];};};Realtime[_0xe600('0x3d')]['initCampaignHopperHistory']=function(){var _0x296b75=this;return function(_0x4a8b82){clearCampaigns(_0x296b75[_0xe600('0x16')]);for(var _0x5a45b9=0x0;_0x5a45b9<_0x4a8b82[_0xe600('0x40')];_0x5a45b9+=0x1){_[_0xe600('0x68')](_0x296b75[_0xe600('0x16')][_0x4a8b82[_0x5a45b9][_0xe600('0x2c')]],_0x4a8b82[_0x5a45b9]);}return _0x296b75[_0xe600('0x16')];};};Realtime['prototype'][_0xe600('0x69')]=function(){var _0x37b74b=this;return function(_0x1e1a82){if(_0x1e1a82){freeIsNotKey(_0x1e1a82,_0x37b74b[_0xe600('0x25')],'id');for(var _0xb72bd=0x0,_0x3502c4={},_0xbee41={};_0xb72bd<_0x1e1a82[_0xe600('0x40')];_0xb72bd+=0x1){_0x3502c4=_0x1e1a82[_0xb72bd];if(_[_0xe600('0x42')](_0x37b74b[_0xe600('0x25')][_0x3502c4['id']])){_0x37b74b[_0xe600('0x25')][_0x3502c4['id']]=new FaxAccount(_0x3502c4);}else{_0x37b74b[_0xe600('0x3e')](_0x37b74b[_0xe600('0x25')][_0x3502c4['id']],_0x3502c4);}}}return _0x37b74b[_0xe600('0x25')];};};module[_0xe600('0x6a')]=Realtime; \ No newline at end of file +var _0xdbad=['templates','outbound','channels','queueChannels','timers','zendeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','isNil','interface','SIP/%s','name','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','agents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','campaigns'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xdbad,0x18d));var _0xddba=function(_0x44cecc,_0xa22ba7){_0x44cecc=_0x44cecc-0x0;var _0x1b3e71=_0xdbad[_0x44cecc];return _0x1b3e71;};'use strict';var BPromise=require(_0xddba('0x0'));var util=require('util');var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0xddba('0x1'));var Trunk=require(_0xddba('0x2'));var VoiceQueue=require(_0xddba('0x3'));var Trigger=require(_0xddba('0x4'));var Template=require(_0xddba('0x5'));var Campaign=require(_0xddba('0x6'));var VoiceExtension=require(_0xddba('0x7'));var ZendeskAccount=require(_0xddba('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xddba('0x9'));var SugarcrmAccount=require(_0xddba('0xa'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xddba('0xb'));var Dynamics365Account=require(_0xddba('0xc'));var FreshsalesAccount=require(_0xddba('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0xddba('0xe')]={};this[_0xddba('0xf')]={};this[_0xddba('0x10')]={};this[_0xddba('0x11')]={};this[_0xddba('0x12')]={};this[_0xddba('0x13')]={};this[_0xddba('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xddba('0x15')]={};this[_0xddba('0x16')]={};this['outboundChannels']={};this[_0xddba('0x17')]={};this[_0xddba('0x18')]={};this['salesforceAccounts']={};this[_0xddba('0x19')]={};this['freshdeskAccounts']={};this[_0xddba('0x1a')]={};this[_0xddba('0x1b')]={};this[_0xddba('0x1c')]={};this[_0xddba('0x1d')]={};this[_0xddba('0x1e')]={};this['freshsalesAccounts']={};this[_0xddba('0x1f')]={};};function freeIsNotKey(_0x2b2a36,_0x136534,_0x24322d){var _0x5d0151=_[_0xddba('0x20')](_0x2b2a36,function(_0x27cfa1,_0x569841){return _0x27cfa1[_0x24322d];});for(var _0x31d482 in _0x136534){if(_0x136534[_0xddba('0x21')](_0x31d482)){if(!_0x5d0151[_0x31d482]){delete _0x136534[_0x31d482];}}}}function freeIsNotKeySip(_0x5e2007,_0x49c9d4){var _0xde4e1b=_[_0xddba('0x20')](_0x5e2007,function(_0x3854ee,_0x27302a){return util[_0xddba('0x22')]('SIP/%s',_0x3854ee['name']);});for(var _0x35e2cf in _0x49c9d4){if(_0x49c9d4['hasOwnProperty'](_0x35e2cf)){if(!_0xde4e1b[_0x35e2cf]){delete _0x49c9d4[_0x35e2cf];}}}}function freeIsNotKeyAgent(_0x5d4428,_0x243807){var _0x76e1eb=_['mapKeys'](_0x5d4428,function(_0x2f1397,_0x5d43ce){var _0x26c3e2=_[_0xddba('0x23')](_0x2f1397[_0xddba('0x24')])?util[_0xddba('0x22')](_0xddba('0x25'),_0x2f1397[_0xddba('0x26')]):_0x2f1397[_0xddba('0x24')];return _0x26c3e2;});for(var _0x5eaa72 in _0x243807){if(_0x243807[_0xddba('0x21')](_0x5eaa72)){if(!_0x76e1eb[_0x5eaa72]){delete _0x243807[_0x5eaa72];}}}}function clearVoiceCallReports(_0x5c0b83){_0x5c0b83[_0xddba('0x27')]=0x0;_0x5c0b83['answered']=0x0;_0x5c0b83[_0xddba('0x28')]=0x0;_0x5c0b83[_0xddba('0x29')]=0x0;_0x5c0b83[_0xddba('0x2a')]=0x0;}function clearCampaigns(_0x5031ca){if(!_[_0xddba('0x2b')](_0x5031ca)){for(var _0x498aac in _0x5031ca){if(_0x5031ca[_0xddba('0x21')](_0x498aac)){_0x5031ca[_0x498aac][_0xddba('0x2c')]=0x0;_0x5031ca[_0x498aac][_0xddba('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x309e56){if(!_[_0xddba('0x2b')](_0x309e56)){for(var _0x1578fc in _0x309e56){if(_0x309e56[_0xddba('0x21')](_0x1578fc)){_0x309e56[_0x1578fc]['total']=0x0;_0x309e56[_0x1578fc][_0xddba('0x2e')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x2f')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x30')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x28')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x29')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x2a')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x31')]=0x0;_0x309e56[_0x1578fc]['outboundNoAnswerCallsDay']=0x0;_0x309e56[_0x1578fc][_0xddba('0x32')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x33')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x34')]=0x0;_0x309e56[_0x1578fc]['outboundUnknownCallsDay']=0x0;_0x309e56[_0x1578fc][_0xddba('0x35')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x36')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x37')]=0x0;_0x309e56[_0x1578fc]['outboundOriginateFailureCallsDay']=0x0;_0x309e56[_0x1578fc]['outboundRejectCallsDay']=0x0;_0x309e56[_0x1578fc][_0xddba('0x38')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x31')]=0x0;_0x309e56[_0x1578fc][_0xddba('0x39')]=0x0;_0x309e56[_0x1578fc]['queueStatusComplete']=!![];}}}}Realtime[_0xddba('0x3a')][_0xddba('0x3b')]=function(_0x82f555,_0x49b27e){for(var _0x29b512 in _0x49b27e){if(_0x82f555[_0xddba('0x21')](_0x29b512)){_0x82f555[_0x29b512]=_0x49b27e[_0x29b512];}}};Realtime[_0xddba('0x3a')]['initAgents']=function(){var _0x4efbc8=this;return function(_0x34e20c){if(_0x34e20c){freeIsNotKeyAgent(_0x34e20c,_0x4efbc8[_0xddba('0x3c')]);for(var _0x5ef804=0x0,_0x51d2e={},_0x3064de={};_0x5ef804<_0x34e20c[_0xddba('0x3d')];_0x5ef804+=0x1){_0x51d2e=_0x34e20c[_0x5ef804];var _0x3ecc3=_[_0xddba('0x23')](_0x51d2e[_0xddba('0x24')])?util[_0xddba('0x22')](_0xddba('0x25'),_0x51d2e[_0xddba('0x26')]):_0x51d2e[_0xddba('0x24')];if(_[_0xddba('0x3e')](_0x4efbc8[_0xddba('0x3c')][_0x3ecc3])){_0x4efbc8[_0xddba('0x3c')][_0x3ecc3]=new Agent(_0x51d2e);}else{_0x4efbc8['mergeFromDatabase'](_0x4efbc8[_0xddba('0x3c')][_0x3ecc3],_0x51d2e);}}}return _0x4efbc8[_0xddba('0x3c')];};};Realtime[_0xddba('0x3a')][_0xddba('0x3f')]=function(){var _0xd40616=this;return function(_0x14d3f2){if(_0x14d3f2){freeIsNotKeySip(_0x14d3f2,_0xd40616['telephones']);for(var _0x4e71e5=0x0,_0x26ad09={},_0x438f18={};_0x4e71e5<_0x14d3f2['length'];_0x4e71e5+=0x1){_0x26ad09=_0x14d3f2[_0x4e71e5];if(_[_0xddba('0x3e')](_0xd40616['telephones'][util[_0xddba('0x22')](_0xddba('0x25'),_0x26ad09['name'])])){_0xd40616[_0xddba('0xe')][util[_0xddba('0x22')]('SIP/%s',_0x26ad09[_0xddba('0x26')])]=new Telephone(_0x26ad09);}else{_0xd40616[_0xddba('0x3b')](_0xd40616['telephones'][util['format'](_0xddba('0x25'),_0x26ad09['name'])],_0x26ad09);}}}return _0xd40616[_0xddba('0xe')];};};Realtime['prototype'][_0xddba('0x40')]=function(){var _0x324f0a=this;return function(_0x20b4c2){if(_0x20b4c2){freeIsNotKeySip(_0x20b4c2,_0x324f0a[_0xddba('0xf')]);for(var _0x45b807=0x0,_0xe7942b={},_0x4fca2a={};_0x45b807<_0x20b4c2[_0xddba('0x3d')];_0x45b807+=0x1){_0xe7942b=_0x20b4c2[_0x45b807];if(_['isUndefined'](_0x324f0a[_0xddba('0xf')][util[_0xddba('0x22')]('SIP/%s',_0xe7942b[_0xddba('0x26')])])){_0x324f0a['trunks'][util[_0xddba('0x22')](_0xddba('0x25'),_0xe7942b[_0xddba('0x26')])]=new Trunk(_0xe7942b);}else{_0x324f0a[_0xddba('0x3b')](_0x324f0a['trunks'][util[_0xddba('0x22')](_0xddba('0x25'),_0xe7942b[_0xddba('0x26')])],_0xe7942b);}}}return _0x324f0a[_0xddba('0xf')];};};Realtime['prototype'][_0xddba('0x41')]=function(){var _0xaa49a4=this;return function(_0x126d2d){if(_0x126d2d){freeIsNotKey(_0x126d2d,_0xaa49a4[_0xddba('0x10')],_0xddba('0x26'));for(var _0x5ded99=0x0,_0x38f5f9={},_0x16ac1b={};_0x5ded99<_0x126d2d[_0xddba('0x3d')];_0x5ded99+=0x1){_0x38f5f9=_0x126d2d[_0x5ded99];if(_[_0xddba('0x3e')](_0xaa49a4[_0xddba('0x10')][_0x38f5f9[_0xddba('0x26')]])){_0xaa49a4[_0xddba('0x10')][_0x38f5f9[_0xddba('0x26')]]=new VoiceQueue(_0x38f5f9);}else{_0xaa49a4['mergeFromDatabase'](_0xaa49a4[_0xddba('0x10')][_0x38f5f9[_0xddba('0x26')]],_0x38f5f9);}}}return _0xaa49a4['voiceQueues'];};};Realtime['prototype'][_0xddba('0x42')]=function(){var _0x289a22=this;return function(_0x163ddf){if(_0x163ddf){freeIsNotKey(_0x163ddf,_0x289a22[_0xddba('0x11')],'id');for(var _0x574f2e=0x0,_0x5692e7={},_0x27b3ed={};_0x574f2e<_0x163ddf['length'];_0x574f2e+=0x1){_0x5692e7=_0x163ddf[_0x574f2e];if(_[_0xddba('0x3e')](_0x289a22[_0xddba('0x11')][_0x5692e7['id']])){_0x289a22[_0xddba('0x11')][_0x5692e7['id']]=new Trigger(_0x5692e7);}else{_0x289a22['mergeFromDatabase'](_0x289a22[_0xddba('0x11')][_0x5692e7['id']],_0x5692e7);}}}return _0x289a22[_0xddba('0x11')];};};Realtime['prototype'][_0xddba('0x43')]=function(){var _0x717d8b=this;return function(_0xfb0215){if(_0xfb0215){freeIsNotKey(_0xfb0215,_0x717d8b[_0xddba('0x13')],'id');for(var _0x292377=0x0,_0x524ea0={},_0x393b17={};_0x292377<_0xfb0215[_0xddba('0x3d')];_0x292377+=0x1){_0x524ea0=_0xfb0215[_0x292377];if(_[_0xddba('0x3e')](_0x717d8b[_0xddba('0x13')][_0x524ea0['id']])){_0x717d8b['templates'][_0x524ea0['id']]=new Template(_0x524ea0);}else{_0x717d8b[_0xddba('0x3b')](_0x717d8b[_0xddba('0x13')][_0x524ea0['id']],_0x524ea0);}}}return _0x717d8b[_0xddba('0x13')];};};Realtime[_0xddba('0x3a')][_0xddba('0x44')]=function(){var _0xb5d4ec=this;return function(_0x392d6a){if(_0x392d6a){freeIsNotKey(_0x392d6a,_0xb5d4ec[_0xddba('0x18')],'id');for(var _0x38f0bc=0x0,_0x721fff={},_0x4b986c={};_0x38f0bc<_0x392d6a[_0xddba('0x3d')];_0x38f0bc+=0x1){_0x721fff=_0x392d6a[_0x38f0bc];if(_[_0xddba('0x3e')](_0xb5d4ec['zendeskAccounts'][_0x721fff['id']])){_0xb5d4ec[_0xddba('0x18')][_0x721fff['id']]=new ZendeskAccount(_0x721fff);}else{_0xb5d4ec[_0xddba('0x3b')](_0xb5d4ec['zendeskAccounts'][_0x721fff['id']],_0x721fff);}}}return _0xb5d4ec[_0xddba('0x18')];};};Realtime[_0xddba('0x3a')][_0xddba('0x45')]=function(){var _0x4135a6=this;return function(_0x5db630){if(_0x5db630){freeIsNotKey(_0x5db630,_0x4135a6[_0xddba('0x46')],'id');for(var _0x4e0f65=0x0,_0x2da85e={},_0xcd031c={};_0x4e0f65<_0x5db630[_0xddba('0x3d')];_0x4e0f65+=0x1){_0x2da85e=_0x5db630[_0x4e0f65];if(_[_0xddba('0x3e')](_0x4135a6[_0xddba('0x46')][_0x2da85e['id']])){_0x4135a6[_0xddba('0x46')][_0x2da85e['id']]=new SalesforceAccount(_0x2da85e);}else{_0x4135a6[_0xddba('0x3b')](_0x4135a6['salesforceAccounts'][_0x2da85e['id']],_0x2da85e);}}}return _0x4135a6['salesforceAccounts'];};};Realtime[_0xddba('0x3a')][_0xddba('0x47')]=function(){var _0x2ead06=this;return function(_0x424527){if(_0x424527){freeIsNotKey(_0x424527,_0x2ead06['freshdeskAccounts'],'id');for(var _0x47ac74=0x0,_0x3cdfad={},_0x45c962={};_0x47ac74<_0x424527[_0xddba('0x3d')];_0x47ac74+=0x1){_0x3cdfad=_0x424527[_0x47ac74];if(_[_0xddba('0x3e')](_0x2ead06[_0xddba('0x48')][_0x3cdfad['id']])){_0x2ead06[_0xddba('0x48')][_0x3cdfad['id']]=new FreshdeskAccount(_0x3cdfad);}else{_0x2ead06['mergeFromDatabase'](_0x2ead06[_0xddba('0x48')][_0x3cdfad['id']],_0x3cdfad);}}}return _0x2ead06[_0xddba('0x48')];};};Realtime[_0xddba('0x3a')][_0xddba('0x49')]=function(){var _0x4cfb55=this;return function(_0x4cf66d){if(_0x4cf66d){freeIsNotKey(_0x4cf66d,_0x4cfb55[_0xddba('0x1a')],'id');for(var _0x28cf03=0x0,_0x4af37e={},_0x1780e6={};_0x28cf03<_0x4cf66d[_0xddba('0x3d')];_0x28cf03+=0x1){_0x4af37e=_0x4cf66d[_0x28cf03];if(_[_0xddba('0x3e')](_0x4cfb55['zohoAccounts'][_0x4af37e['id']])){_0x4cfb55[_0xddba('0x1a')][_0x4af37e['id']]=new ZohoAccount(_0x4af37e);}else{_0x4cfb55[_0xddba('0x3b')](_0x4cfb55['zohoAccounts'][_0x4af37e['id']],_0x4af37e);}}}return _0x4cfb55[_0xddba('0x1a')];};};Realtime[_0xddba('0x3a')][_0xddba('0x4a')]=function(){var _0x47df9b=this;return function(_0x3516e6){if(_0x3516e6){freeIsNotKey(_0x3516e6,_0x47df9b['deskAccounts'],'id');for(var _0x9777f7=0x0,_0x5d175b={},_0x106a7b={};_0x9777f7<_0x3516e6[_0xddba('0x3d')];_0x9777f7+=0x1){_0x5d175b=_0x3516e6[_0x9777f7];if(_[_0xddba('0x3e')](_0x47df9b[_0xddba('0x1b')][_0x5d175b['id']])){_0x47df9b[_0xddba('0x1b')][_0x5d175b['id']]=new DeskAccount(_0x5d175b);}else{_0x47df9b['mergeFromDatabase'](_0x47df9b[_0xddba('0x1b')][_0x5d175b['id']],_0x5d175b);}}}return _0x47df9b[_0xddba('0x1b')];};};Realtime['prototype'][_0xddba('0x4b')]=function(){var _0x23f30e=this;return function(_0x49ccf7){if(_0x49ccf7){freeIsNotKey(_0x49ccf7,_0x23f30e[_0xddba('0x19')],'id');for(var _0x6f73b2=0x0,_0x4a1650={},_0x345e96={};_0x6f73b2<_0x49ccf7[_0xddba('0x3d')];_0x6f73b2+=0x1){_0x4a1650=_0x49ccf7[_0x6f73b2];if(_['isUndefined'](_0x23f30e['sugarcrmAccounts'][_0x4a1650['id']])){_0x23f30e[_0xddba('0x19')][_0x4a1650['id']]=new SugarcrmAccount(_0x4a1650);}else{_0x23f30e[_0xddba('0x3b')](_0x23f30e[_0xddba('0x19')][_0x4a1650['id']],_0x4a1650);}}}return _0x23f30e[_0xddba('0x19')];};};Realtime[_0xddba('0x3a')][_0xddba('0x4c')]=function(){var _0x40daec=this;return function(_0x17522e){if(_0x17522e){freeIsNotKey(_0x17522e,_0x40daec[_0xddba('0x1c')],'id');for(var _0x385e7c=0x0,_0x20da65={},_0x1be705={};_0x385e7c<_0x17522e[_0xddba('0x3d')];_0x385e7c+=0x1){_0x20da65=_0x17522e[_0x385e7c];if(_[_0xddba('0x3e')](_0x40daec[_0xddba('0x1c')][_0x20da65['id']])){_0x40daec[_0xddba('0x1c')][_0x20da65['id']]=new VtigerAccount(_0x20da65);}else{_0x40daec[_0xddba('0x3b')](_0x40daec[_0xddba('0x1c')][_0x20da65['id']],_0x20da65);}}}return _0x40daec['vtigerAccounts'];};};Realtime[_0xddba('0x3a')]['initServicenowAccounts']=function(){var _0x1930f8=this;return function(_0x2c32c3){if(_0x2c32c3){freeIsNotKey(_0x2c32c3,_0x1930f8[_0xddba('0x1d')],'id');for(var _0x2071fa=0x0,_0x2aaa7f={},_0x53204a={};_0x2071fa<_0x2c32c3[_0xddba('0x3d')];_0x2071fa+=0x1){_0x2aaa7f=_0x2c32c3[_0x2071fa];if(_[_0xddba('0x3e')](_0x1930f8['servicenowAccounts'][_0x2aaa7f['id']])){_0x1930f8[_0xddba('0x1d')][_0x2aaa7f['id']]=new ServicenowAccount(_0x2aaa7f);}else{_0x1930f8[_0xddba('0x3b')](_0x1930f8[_0xddba('0x1d')][_0x2aaa7f['id']],_0x2aaa7f);}}}return _0x1930f8[_0xddba('0x1d')];};};Realtime[_0xddba('0x3a')][_0xddba('0x4d')]=function(){var _0x2736c7=this;return function(_0x2606f4){if(_0x2606f4){freeIsNotKey(_0x2606f4,_0x2736c7[_0xddba('0x1e')],'id');for(var _0x3854a0=0x0,_0x40c02e={},_0x50d250={};_0x3854a0<_0x2606f4[_0xddba('0x3d')];_0x3854a0+=0x1){_0x40c02e=_0x2606f4[_0x3854a0];if(_[_0xddba('0x3e')](_0x2736c7[_0xddba('0x1e')][_0x40c02e['id']])){_0x2736c7['dynamics365Accounts'][_0x40c02e['id']]=new Dynamics365Account(_0x40c02e);}else{_0x2736c7['mergeFromDatabase'](_0x2736c7[_0xddba('0x1e')][_0x40c02e['id']],_0x40c02e);}}}return _0x2736c7[_0xddba('0x1e')];};};Realtime[_0xddba('0x3a')][_0xddba('0x4e')]=function(){var _0x4953b6=this;return function(_0x5cb27a){if(_0x5cb27a){freeIsNotKey(_0x5cb27a,_0x4953b6['freshsalesAccounts'],'id');for(var _0x2ed297=0x0,_0x3336b6={},_0x39bfe8={};_0x2ed297<_0x5cb27a[_0xddba('0x3d')];_0x2ed297+=0x1){_0x3336b6=_0x5cb27a[_0x2ed297];if(_[_0xddba('0x3e')](_0x4953b6['freshsalesAccounts'][_0x3336b6['id']])){_0x4953b6[_0xddba('0x4f')][_0x3336b6['id']]=new FreshsalesAccount(_0x3336b6);}else{_0x4953b6['mergeFromDatabase'](_0x4953b6['freshsalesAccounts'][_0x3336b6['id']],_0x3336b6);}}}return _0x4953b6[_0xddba('0x4f')];};};Realtime[_0xddba('0x3a')][_0xddba('0x50')]=function(){var _0x2d0c0b=this;return function(_0x38a1c2){for(var _0x5ba1b5=0x0;_0x5ba1b5<_0x38a1c2[_0xddba('0x3d')];_0x5ba1b5+=0x1){_[_0xddba('0x51')](_0x2d0c0b['voiceQueues'][_0x38a1c2[_0x5ba1b5][_0xddba('0x26')]],_0x38a1c2[_0x5ba1b5]);}return _0x2d0c0b[_0xddba('0x10')];};};Realtime[_0xddba('0x3a')][_0xddba('0x52')]=function(){var _0x573e1e=this;return function(_0x221de5){clearVoiceQueues(_0x573e1e[_0xddba('0x10')]);if(_0x221de5){_0x221de5=_['groupBy'](_0x221de5,'uniqueid');for(var _0xbc3c49 in _0x221de5){if(_0x221de5['hasOwnProperty'](_0xbc3c49)){var _0xb3f887={};for(var _0x787ad2=0x0;_0x787ad2<_0x221de5[_0xbc3c49][_0xddba('0x3d')];_0x787ad2+=0x1){var _0x31a47d=_0x221de5[_0xbc3c49][_0x787ad2][_0xddba('0x53')];if(_0x573e1e[_0xddba('0x10')][_0x31a47d]){if(_0x221de5[_0xbc3c49][_0x787ad2][_0xddba('0x54')]){_0x573e1e[_0xddba('0x10')][_0x31a47d][_0xddba('0x2f')]+=0x1;}if(_0x221de5[_0xbc3c49][_0x787ad2][_0xddba('0x55')]){_0x573e1e['voiceQueues'][_0x31a47d][_0xddba('0x30')]+=0x1;}_0x573e1e['voiceQueues'][_0x31a47d]['sumHoldTime']+=moment(_0x221de5[_0xbc3c49][_0x787ad2]['queuecallerleaveAt'])[_0xddba('0x56')](moment(_0x221de5[_0xbc3c49][_0x787ad2][_0xddba('0x57')]),_0xddba('0x58'))||0x0;if(_0x787ad2===_0x221de5[_0xbc3c49][_0xddba('0x3d')]-0x1){_0x573e1e[_0xddba('0x10')][_0x31a47d]['sumDuration']+=moment(_0x221de5[_0xbc3c49][_0x787ad2][_0xddba('0x59')]||_0x221de5[_0xbc3c49][_0x787ad2][_0xddba('0x5a')]||_0x221de5[_0xbc3c49][_0x787ad2]['queuecallerexitAt'])[_0xddba('0x56')](moment(_0x221de5[_0xbc3c49][_0x787ad2]['queuecallerjoinAt']),_0xddba('0x58'))||0x0;_0x573e1e[_0xddba('0x10')][_0x31a47d][_0xddba('0x27')]+=0x1;if(_0x221de5[_0xbc3c49][_0x787ad2][_0xddba('0x5b')]){_0x573e1e['voiceQueues'][_0x31a47d][_0xddba('0x2e')]+=0x1;_0x573e1e['voiceQueues'][_0x31a47d][_0xddba('0x2a')]+=moment(_0x221de5[_0xbc3c49][_0x787ad2][_0xddba('0x59')])[_0xddba('0x56')](moment(_0x221de5[_0xbc3c49][_0x787ad2]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x573e1e[_0xddba('0x10')][_0x31a47d][_0xddba('0x29')]+=_0x573e1e[_0xddba('0x10')][_0x31a47d]['sumHoldTime']||0x0;}}}}}}return _0x573e1e['voiceQueues'];};};Realtime[_0xddba('0x3a')][_0xddba('0x5c')]=function(){var _0x2befd7=this;return function(_0x181829){clearVoiceCallReports(_0x2befd7[_0xddba('0x14')]);if(_0x181829){for(var _0x401d1a=0x0;_0x401d1a<_0x181829[_0xddba('0x3d')];_0x401d1a+=0x1){_0x2befd7[_0xddba('0x14')]['total']+=0x1;_0x2befd7['outbound'][_0xddba('0x29')]+=_0x181829[_0x401d1a][_0xddba('0x5d')];if(_0x181829[_0x401d1a]['disposition']===_0xddba('0x5e')){_0x2befd7['outbound'][_0xddba('0x2e')]+=0x1;_0x2befd7['outbound']['sumHoldTime']+=_0x181829[_0x401d1a][_0xddba('0x5d')]-_0x181829[_0x401d1a]['billableseconds']||0x0;_0x2befd7['outbound'][_0xddba('0x2a')]+=_0x181829[_0x401d1a][_0xddba('0x5f')];}}}return _0x2befd7['outbound'];};};Realtime[_0xddba('0x3a')][_0xddba('0x60')]=function(){var _0x4c74c1=this;return function(_0x51a546){if(_0x51a546){freeIsNotKey(_0x51a546,_0x4c74c1['campaigns'],_0xddba('0x26'));for(var _0x576b78=0x0,_0x9595f6={};_0x576b78<_0x51a546[_0xddba('0x3d')];_0x576b78+=0x1){_0x9595f6=_0x51a546[_0x576b78];if(_[_0xddba('0x3e')](_0x4c74c1[_0xddba('0x12')][_0x9595f6[_0xddba('0x26')]])){_0x4c74c1[_0xddba('0x12')][_0x9595f6[_0xddba('0x26')]]=new Campaign(_0x9595f6);}else{_0x4c74c1[_0xddba('0x3b')](_0x4c74c1[_0xddba('0x12')][_0x9595f6[_0xddba('0x26')]],_0x9595f6);_0x4c74c1['campaigns'][_0x9595f6[_0xddba('0x26')]][_0xddba('0x61')]=_0x9595f6[_0xddba('0x62')]?_0x9595f6[_0xddba('0x62')][_0xddba('0x26')]:undefined;}}}return _0x4c74c1[_0xddba('0x12')];};};Realtime[_0xddba('0x3a')][_0xddba('0x63')]=function(){var _0x92fc0d=this;return function(_0x3822ca){if(_0x3822ca){freeIsNotKey(_0x3822ca,_0x92fc0d[_0xddba('0x64')],'id');for(var _0x85a327=0x0,_0x16e001={};_0x85a327<_0x3822ca[_0xddba('0x3d')];_0x85a327+=0x1){_0x16e001=_0x3822ca[_0x85a327];if(_[_0xddba('0x3e')](_0x92fc0d[_0xddba('0x64')][_0x16e001['id']])){_0x92fc0d['voiceExtensions'][_0x16e001['id']]=new VoiceExtension(_0x16e001);}else{_0x92fc0d[_0xddba('0x3b')](_0x92fc0d[_0xddba('0x64')][_0x16e001['id']],_0x16e001);}}}return _0x92fc0d['voiceExtensions'];};};Realtime['prototype'][_0xddba('0x65')]=function(){var _0x261bc4=this;return function(_0x83123){clearCampaigns(_0x261bc4[_0xddba('0x12')]);for(var _0x2cc8ae=0x0;_0x2cc8ae<_0x83123[_0xddba('0x3d')];_0x2cc8ae+=0x1){_[_0xddba('0x51')](_0x261bc4[_0xddba('0x12')][_0x83123[_0x2cc8ae]['name']],_0x83123[_0x2cc8ae]);}return _0x261bc4[_0xddba('0x12')];};};Realtime['prototype'][_0xddba('0x66')]=function(){var _0x182f63=this;return function(_0x3ba8e7){if(_0x3ba8e7){freeIsNotKey(_0x3ba8e7,_0x182f63['faxAccounts'],'id');for(var _0xec9594=0x0,_0x13941f={},_0x26a349={};_0xec9594<_0x3ba8e7[_0xddba('0x3d')];_0xec9594+=0x1){_0x13941f=_0x3ba8e7[_0xec9594];if(_[_0xddba('0x3e')](_0x182f63['faxAccounts'][_0x13941f['id']])){_0x182f63[_0xddba('0x1f')][_0x13941f['id']]=new FaxAccount(_0x13941f);}else{_0x182f63['mergeFromDatabase'](_0x182f63[_0xddba('0x1f')][_0x13941f['id']],_0x13941f);}}}return _0x182f63[_0xddba('0x1f')];};};module[_0xddba('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 026eb65..b603491 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 _0x399e=['callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitorFilename','filename','createdAt','monitors','xcally-motion-preview','calleridname','connectedlinename','membername','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','attendedTransfer','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','find','accountcode','isNil','name','interface','format','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','destination','exten','type','lastapplication','lastdata','queue','context','from-voip-provider'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x399e,0x118));var _0xe399=function(_0x580256,_0x3110ed){_0x580256=_0x580256-0x0;var _0x34e885=_0x399e[_0x580256];return _0x34e885;};'use strict';var BPromise=require('bluebird');var _=require(_0xe399('0x0'));var moment=require(_0xe399('0x1'));var util=require(_0xe399('0x2'));var config=require(_0xe399('0x3'));var logger=require(_0xe399('0x4'))('ami');var ami=require(_0xe399('0x5'));var RpcVoiceAgentReport=require(_0xe399('0x6'));var RpcVoiceCallReport=require(_0xe399('0x7'));var RpcVoiceDialReport=require(_0xe399('0x8'));var RpcMemberReport=require(_0xe399('0x9'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xe399('0xa'));var RpcVoiceTransferReport=require(_0xe399('0xb'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xe399('0xc'));var VoiceAgentReport=require(_0xe399('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x10c095){this[_0xe399('0xe')]=_0x10c095;this[_0xe399('0xf')]=_0x10c095[_0xe399('0xf')];this['telephones']=_0x10c095[_0xe399('0x10')];}Report[_0xe399('0x11')][_0xe399('0x12')]=function(_0x3f0ce5){var _0x1fe263=new VoiceQueueReport(this['realtime']);var _0x1f1746=new VoiceAgentReport(this['realtime']);var _0x472af6=new VoiceDialReport(this[_0xe399('0xe')]);var _0x23a6e9=new VoiceCallReport(this[_0xe399('0xe')]);var _0x481a22=new UserReport(this['realtime']);if(config[_0xe399('0x13')]&&config[_0xe399('0x13')][_0xe399('0x14')]){ami['on'](_0xe399('0x15'),this[_0xe399('0x16')][_0xe399('0x17')](this));ami['on']('custom:voiceCallReport',this[_0xe399('0x18')][_0xe399('0x17')](this));ami['on'](_0xe399('0x19'),this['voiceAgentReport']['bind'](this));ami['on'](_0xe399('0x1a'),this[_0xe399('0x1b')][_0xe399('0x17')](this));ami['on'](_0xe399('0x1c'),this['blindTransfer'][_0xe399('0x17')](this));ami['on'](_0xe399('0x1d'),this['attendedTransfer']['bind'](this));}};Report['prototype']['findAgent']=function(_0x5f0be3){var _0x120824=undefined;_0x120824=_[_0xe399('0x1e')](this[_0xe399('0xf')],function(_0x4c0230){return _0x4c0230[_0xe399('0x1f')]==_0x5f0be3||_0x4c0230['name']==_0x5f0be3;});if(_[_0xe399('0x20')](_0x120824)){var _0x4095de=_[_0xe399('0x1e')](this['telephones'],function(_0x322780){return _0x322780[_0xe399('0x1f')]==_0x5f0be3||_0x322780[_0xe399('0x21')]==_0x5f0be3;});if(_0x4095de){_0x120824=_[_0xe399('0x1e')](this[_0xe399('0xf')],function(_0x64cf61){return _0x64cf61[_0xe399('0x22')]==util[_0xe399('0x23')](_0xe399('0x24'),_0x4095de[_0xe399('0x21')]);});}}return _0x120824;};Report[_0xe399('0x11')][_0xe399('0x16')]=function(_0x252fb5){for(var _0x292744=0x0;_0x292744<_0x252fb5[_0xe399('0x25')];_0x292744+=0x1){var _0x4f3394=this[_0xe399('0x26')](_0x252fb5[_0x292744][_0xe399('0x27')]);if(_0x4f3394){_0x252fb5[_0x292744][_0xe399('0x1f')]=_0x4f3394[_0xe399('0x1f')];_0x252fb5[_0x292744][_0xe399('0x28')]=!![];_0x252fb5[_0x292744][_0xe399('0x29')]=_0x4f3394[_0xe399('0x21')];_0x252fb5[_0x292744][_0xe399('0x22')]=_['isNil'](_0x4f3394[_0xe399('0x22')])?util[_0xe399('0x23')]('SIP/%s',_0x4f3394['name']):_0x4f3394[_0xe399('0x22')];if(_0x252fb5[_0x292744][_0xe399('0x2a')]){_0x252fb5[_0x292744][_0xe399('0x2b')]=moment()[_0xe399('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x252fb5[_0x292744][_0xe399('0x2c')]){_0x252fb5[_0x292744][_0xe399('0x2d')]=moment()[_0xe399('0x23')](_0xe399('0x2e'));}RpcMemberReport[_0xe399('0x16')](_0x252fb5[_0x292744]);}RpcVoiceQueueReport[_0xe399('0x2f')](_0x252fb5[_0x292744]);}};function extractCalleridNumber(_0x598e1e){var _0x5162fd=_0x598e1e['match'](/<(.*?)>/);return _0x5162fd?_0x5162fd[0x1]:_0x598e1e;}Report[_0xe399('0x11')][_0xe399('0x18')]=function(_0x23ba18){_0x23ba18[_0xe399('0x30')]=_0x23ba18[_0xe399('0x30')]||_0x23ba18[_0xe399('0x31')];if(_0x23ba18[_0xe399('0x32')]=='dialer'){_0x23ba18[_0xe399('0x33')]='queue';_0x23ba18[_0xe399('0x34')]=_0x23ba18[_0xe399('0x35')];if(_0x23ba18[_0xe399('0x36')]==_0xe399('0x37')){_0x23ba18[_0xe399('0x1f')]='';_0x23ba18[_0xe399('0x30')]=extractCalleridNumber(_0x23ba18[_0xe399('0x38')]);}else if(_0x23ba18[_0xe399('0x36')]==_0xe399('0x39')){if(_0x23ba18[_0xe399('0x30')]=='xcally-motion-preview'){_0x23ba18[_0xe399('0x30')]=extractCalleridNumber(_0x23ba18[_0xe399('0x3a')]);_0x23ba18[_0xe399('0x3b')]=_0x23ba18[_0xe399('0x3c')];_0x23ba18['destinationchannel']=[_0x23ba18['channel'],_0x23ba18[_0xe399('0x3d')]=_0x23ba18[_0xe399('0x3e')]][0x0];_0x23ba18['callerid']=_0x23ba18['calleridpreview'];}else{_0x23ba18[_0xe399('0x30')]=_0x23ba18[_0xe399('0x3b')];_0x23ba18[_0xe399('0x3b')]=_0x23ba18[_0xe399('0x3c')];if(_0x23ba18[_0xe399('0x3f')]==_0xe399('0x40')){_0x23ba18[_0xe399('0x1f')]=_0x23ba18[_0xe399('0x27')];}else{_0x23ba18[_0xe399('0x1f')]='';}}}}else{_0x23ba18[_0xe399('0x38')]=util[_0xe399('0x23')](_0xe399('0x41'),_0x23ba18['calleridname'],_0x23ba18[_0xe399('0x3b')]);}RpcVoiceCallReport[_0xe399('0x2f')](_0x23ba18);if(_0x23ba18[_0xe399('0x42')]){for(var _0x289d36=0x0;_0x289d36<_0x23ba18['monitors'][_0xe399('0x25')];_0x289d36+=0x1){_0x23ba18[_0xe399('0x43')]=_0x23ba18['monitors'][_0x289d36][_0xe399('0x44')];_0x23ba18[_0xe399('0x45')]=_0x23ba18[_0xe399('0x46')][_0x289d36][_0xe399('0x45')];if(_0x23ba18[_0xe399('0x31')]==_0xe399('0x47')){_0x23ba18[_0xe399('0x3b')]=_0x23ba18['connectedlinenum'];_0x23ba18[_0xe399('0x48')]=_0x23ba18['connectedlinename'];_0x23ba18[_0xe399('0x27')]=_0x23ba18['accountcode'];_0x23ba18[_0xe399('0x49')]=_0x23ba18[_0xe399('0x4a')];_0x23ba18[_0xe399('0x31')]=_0x23ba18[_0xe399('0x3c')];}else if(_0x23ba18[_0xe399('0x31')]=='xcally-motion-dialer'){_0x23ba18[_0xe399('0x3b')]=_0x23ba18['destination'];_0x23ba18[_0xe399('0x31')]=_0x23ba18['originatecalleridnum'];}RpcVoiceRecording['create'](_0x23ba18);}}};Report[_0xe399('0x11')]['voiceAgentReport']=function(_0x2338fe){if(_['isArray'](_0x2338fe)){_0x2338fe[_0xe399('0x4b')](function(_0x2625af){RpcVoiceAgentReport[_0xe399('0x2f')](_0x2625af);});}else{RpcVoiceAgentReport['create'](_0x2338fe);}};Report[_0xe399('0x11')]['voiceDialReport']=function(_0x2254e1){RpcVoiceDialReport[_0xe399('0x2f')](_0x2254e1);var _0x53227b=undefined;var _0x10b4f0=_0x2254e1[_0xe399('0x3d')];if(_['startsWith'](_0x10b4f0,_0xe399('0x4c'))){var _0x1730bf=_0x10b4f0[_0xe399('0x4d')](_0x10b4f0['indexOf']('/')+0x1,_0x10b4f0[_0xe399('0x4e')]('@'));_0x53227b=_[_0xe399('0x1e')](this[_0xe399('0xf')],function(_0x49b791){return _0x49b791[_0xe399('0x4f')]==_0x1730bf||_0x49b791[_0xe399('0x50')]==_0x1730bf||_0x49b791[_0xe399('0x1f')]==_0x1730bf;});}else{var _0x1730bf=_0x10b4f0[_0xe399('0x4d')](_0x10b4f0['indexOf']('/')+0x1,_0x10b4f0[_0xe399('0x51')]('-'));_0x53227b=this[_0xe399('0x26')](_0x1730bf);}if(_0x53227b){_0x2254e1[_0xe399('0x22')]=_['isNil'](_0x53227b[_0xe399('0x22')])?util[_0xe399('0x23')](_0xe399('0x24'),_0x53227b[_0xe399('0x21')]):_0x53227b[_0xe399('0x22')];_0x2254e1['membername']=_0x53227b[_0xe399('0x21')];_0x2254e1['accountcode']=_0x53227b[_0xe399('0x1f')];RpcMemberReport[_0xe399('0x1b')](_0x2254e1);}};Report[_0xe399('0x11')]['blindTransfer']=function(_0x22d33c){RpcVoiceTransferReport[_0xe399('0x52')](_0x22d33c);};Report[_0xe399('0x11')]['attendedTransfer']=function(_0x6f2cd3){RpcVoiceTransferReport[_0xe399('0x53')](_0x6f2cd3);};module['exports']=Report; \ No newline at end of file +var _0xde46=['voiceQueueReport','custom:voiceCallReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','find','accountcode','name','telephones','interface','SIP/%s','assigned','isNil','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','dialer','lastapplication','queue','context','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','create','monitor','monitors','length','filename','createdAt','exten','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','phone','lastIndexOf','attendedTransfer','exports','lodash','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','disabled','custom:voiceQueueReport'];(function(_0x5aa27f,_0x2d93b8){var _0x531dc7=function(_0x27d694){while(--_0x27d694){_0x5aa27f['push'](_0x5aa27f['shift']());}};_0x531dc7(++_0x2d93b8);}(_0xde46,0x1cc));var _0x6de4=function(_0xb8fdc7,_0x3a98e8){_0xb8fdc7=_0xb8fdc7-0x0;var _0x5f5148=_0xde46[_0xb8fdc7];return _0x5f5148;};'use strict';var BPromise=require('bluebird');var _=require(_0x6de4('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x6de4('0x1'));var logger=require(_0x6de4('0x2'))(_0x6de4('0x3'));var ami=require(_0x6de4('0x4'));var RpcVoiceAgentReport=require(_0x6de4('0x5'));var RpcVoiceCallReport=require(_0x6de4('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x6de4('0x7'));var RpcVoiceTransferReport=require(_0x6de4('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x6de4('0x9'));var VoiceAgentReport=require(_0x6de4('0xa'));var VoiceDialReport=require(_0x6de4('0xb'));var UserReport=require(_0x6de4('0xc'));function Report(_0x2335d6){this[_0x6de4('0xd')]=_0x2335d6;this[_0x6de4('0xe')]=_0x2335d6[_0x6de4('0xe')];this['telephones']=_0x2335d6['telephones'];}Report[_0x6de4('0xf')][_0x6de4('0x10')]=function(_0x430d74){var _0x3013e0=new VoiceQueueReport(this[_0x6de4('0xd')]);var _0x34667b=new VoiceAgentReport(this[_0x6de4('0xd')]);var _0x2dc4e2=new VoiceDialReport(this[_0x6de4('0xd')]);var _0x32bc49=new VoiceCallReport(this['realtime']);var _0x34b776=new UserReport(this[_0x6de4('0xd')]);if(config[_0x6de4('0x11')]&&config[_0x6de4('0x11')][_0x6de4('0x12')]){ami['on'](_0x6de4('0x13'),this[_0x6de4('0x14')]['bind'](this));ami['on'](_0x6de4('0x15'),this['voiceCallReport'][_0x6de4('0x16')](this));ami['on']('custom:voiceAgentReport',this[_0x6de4('0x17')][_0x6de4('0x16')](this));ami['on']('custom:voiceDialReport',this[_0x6de4('0x18')]['bind'](this));ami['on'](_0x6de4('0x19'),this[_0x6de4('0x1a')]['bind'](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0x6de4('0xf')][_0x6de4('0x1b')]=function(_0x4045a8){var _0x106ec9=undefined;_0x106ec9=_[_0x6de4('0x1c')](this['agents'],function(_0x33d36d){return _0x33d36d[_0x6de4('0x1d')]==_0x4045a8||_0x33d36d[_0x6de4('0x1e')]==_0x4045a8;});if(_['isNil'](_0x106ec9)){var _0x7c5e9d=_['find'](this[_0x6de4('0x1f')],function(_0x5c1bd8){return _0x5c1bd8[_0x6de4('0x1d')]==_0x4045a8||_0x5c1bd8['name']==_0x4045a8;});if(_0x7c5e9d){_0x106ec9=_[_0x6de4('0x1c')](this[_0x6de4('0xe')],function(_0x23a564){return _0x23a564[_0x6de4('0x20')]==util['format'](_0x6de4('0x21'),_0x7c5e9d[_0x6de4('0x1e')]);});}}return _0x106ec9;};Report[_0x6de4('0xf')][_0x6de4('0x14')]=function(_0x1c353e){for(var _0x58acdf=0x0;_0x58acdf<_0x1c353e['length'];_0x58acdf+=0x1){var _0x56e15a=this[_0x6de4('0x1b')](_0x1c353e[_0x58acdf]['connectedlinenum']);if(_0x56e15a){_0x1c353e[_0x58acdf][_0x6de4('0x1d')]=_0x56e15a[_0x6de4('0x1d')];_0x1c353e[_0x58acdf][_0x6de4('0x22')]=!![];_0x1c353e[_0x58acdf]['lastAssignedTo']=_0x56e15a[_0x6de4('0x1e')];_0x1c353e[_0x58acdf][_0x6de4('0x20')]=_[_0x6de4('0x23')](_0x56e15a[_0x6de4('0x20')])?util[_0x6de4('0x24')](_0x6de4('0x21'),_0x56e15a['name']):_0x56e15a[_0x6de4('0x20')];if(_0x1c353e[_0x58acdf][_0x6de4('0x25')]){_0x1c353e[_0x58acdf][_0x6de4('0x26')]=moment()[_0x6de4('0x24')](_0x6de4('0x27'));}if(_0x1c353e[_0x58acdf][_0x6de4('0x28')]){_0x1c353e[_0x58acdf][_0x6de4('0x29')]=moment()[_0x6de4('0x24')](_0x6de4('0x27'));}RpcMemberReport[_0x6de4('0x14')](_0x1c353e[_0x58acdf]);}RpcVoiceQueueReport['create'](_0x1c353e[_0x58acdf]);}};function extractCalleridNumber(_0x720d52){var _0x29898a=_0x720d52[_0x6de4('0x2a')](/<(.*?)>/);return _0x29898a?_0x29898a[0x1]:_0x720d52;}Report['prototype']['voiceCallReport']=function(_0x14db4b){_0x14db4b['destination']=_0x14db4b[_0x6de4('0x2b')]||_0x14db4b['exten'];if(_0x14db4b['type']==_0x6de4('0x2c')){_0x14db4b[_0x6de4('0x2d')]=_0x6de4('0x2e');_0x14db4b['lastdata']=_0x14db4b[_0x6de4('0x2e')];if(_0x14db4b[_0x6de4('0x2f')]=='from-voip-provider'){_0x14db4b[_0x6de4('0x1d')]='';_0x14db4b[_0x6de4('0x2b')]=extractCalleridNumber(_0x14db4b['callerid']);}else if(_0x14db4b[_0x6de4('0x2f')]=='from-sip'){if(_0x14db4b['destination']=='xcally-motion-preview'){_0x14db4b[_0x6de4('0x2b')]=extractCalleridNumber(_0x14db4b[_0x6de4('0x30')]);_0x14db4b[_0x6de4('0x31')]=_0x14db4b[_0x6de4('0x32')];_0x14db4b[_0x6de4('0x33')]=[_0x14db4b[_0x6de4('0x34')],_0x14db4b['channel']=_0x14db4b[_0x6de4('0x33')]][0x0];_0x14db4b[_0x6de4('0x35')]=_0x14db4b['calleridpreview'];}else{_0x14db4b[_0x6de4('0x2b')]=_0x14db4b[_0x6de4('0x31')];_0x14db4b[_0x6de4('0x31')]=_0x14db4b['originatecalleridnum'];if(_0x14db4b[_0x6de4('0x36')]==_0x6de4('0x37')){_0x14db4b['accountcode']=_0x14db4b[_0x6de4('0x38')];}else{_0x14db4b[_0x6de4('0x1d')]='';}}}}else{_0x14db4b[_0x6de4('0x35')]=util['format'](_0x6de4('0x39'),_0x14db4b[_0x6de4('0x3a')],_0x14db4b['calleridnum']);}RpcVoiceCallReport[_0x6de4('0x3b')](_0x14db4b);if(_0x14db4b[_0x6de4('0x3c')]){for(var _0x278fe3=0x0;_0x278fe3<_0x14db4b[_0x6de4('0x3d')][_0x6de4('0x3e')];_0x278fe3+=0x1){_0x14db4b['monitorFilename']=_0x14db4b['monitors'][_0x278fe3][_0x6de4('0x3f')];_0x14db4b['createdAt']=_0x14db4b['monitors'][_0x278fe3][_0x6de4('0x40')];if(_0x14db4b[_0x6de4('0x41')]==_0x6de4('0x42')){_0x14db4b[_0x6de4('0x31')]=_0x14db4b['connectedlinenum'];_0x14db4b['calleridname']=_0x14db4b[_0x6de4('0x43')];_0x14db4b[_0x6de4('0x38')]=_0x14db4b[_0x6de4('0x1d')];_0x14db4b['connectedlinename']=_0x14db4b[_0x6de4('0x44')];_0x14db4b['exten']=_0x14db4b[_0x6de4('0x32')];}else if(_0x14db4b['exten']==_0x6de4('0x45')){_0x14db4b[_0x6de4('0x31')]=_0x14db4b[_0x6de4('0x2b')];_0x14db4b[_0x6de4('0x41')]=_0x14db4b['originatecalleridnum'];}RpcVoiceRecording[_0x6de4('0x3b')](_0x14db4b);}}};Report[_0x6de4('0xf')][_0x6de4('0x17')]=function(_0x13659d){if(_[_0x6de4('0x46')](_0x13659d)){_0x13659d[_0x6de4('0x47')](function(_0x3808b1){RpcVoiceAgentReport[_0x6de4('0x3b')](_0x3808b1);});}else{RpcVoiceAgentReport[_0x6de4('0x3b')](_0x13659d);}};Report['prototype'][_0x6de4('0x18')]=function(_0x1c2082){RpcVoiceDialReport[_0x6de4('0x3b')](_0x1c2082);var _0x8a8c37=undefined;var _0x661ad8=_0x1c2082['channel'];if(_[_0x6de4('0x48')](_0x661ad8,_0x6de4('0x49'))){var _0x46c135=_0x661ad8[_0x6de4('0x4a')](_0x661ad8[_0x6de4('0x4b')]('/')+0x1,_0x661ad8[_0x6de4('0x4b')]('@'));_0x8a8c37=_[_0x6de4('0x1c')](this['agents'],function(_0x1f6292){return _0x1f6292['mobile']==_0x46c135||_0x1f6292[_0x6de4('0x4c')]==_0x46c135||_0x1f6292[_0x6de4('0x1d')]==_0x46c135;});}else{var _0x46c135=_0x661ad8[_0x6de4('0x4a')](_0x661ad8[_0x6de4('0x4b')]('/')+0x1,_0x661ad8[_0x6de4('0x4d')]('-'));_0x8a8c37=this[_0x6de4('0x1b')](_0x46c135);}if(_0x8a8c37){_0x1c2082['interface']=_[_0x6de4('0x23')](_0x8a8c37[_0x6de4('0x20')])?util[_0x6de4('0x24')](_0x6de4('0x21'),_0x8a8c37[_0x6de4('0x1e')]):_0x8a8c37[_0x6de4('0x20')];_0x1c2082[_0x6de4('0x44')]=_0x8a8c37[_0x6de4('0x1e')];_0x1c2082[_0x6de4('0x1d')]=_0x8a8c37[_0x6de4('0x1d')];RpcMemberReport[_0x6de4('0x18')](_0x1c2082);}};Report[_0x6de4('0xf')][_0x6de4('0x1a')]=function(_0x5dcffc){RpcVoiceTransferReport[_0x6de4('0x1a')](_0x5dcffc);};Report[_0x6de4('0xf')][_0x6de4('0x4e')]=function(_0x29548b){RpcVoiceTransferReport[_0x6de4('0x4e')](_0x29548b);};module[_0x6de4('0x4f')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index a3e57fb..3c1e1b9 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 _0xdb7f=['syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','inspect','prototype','[loopSyncRealTimeShow]','isUndefined','emit','state','omit','event','username','format','trunk:%s','trunk:save','[syncRegistry][UserReport]','isNotNull','device','local','toLowerCase','inuse','toNumber','telephone:%s','name','telephone:save','stateTime','startsWith','Queue','Local','substring','indexOf','find','accountcode','error','peerstatus','peer','registered','status','address','updateStatusRealtime','exports','lodash','bluebird','../../../config/logger','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry'];(function(_0x221d4e,_0x4d1e7a){var _0x1b4c8b=function(_0x9b7673){while(--_0x9b7673){_0x221d4e['push'](_0x221d4e['shift']());}};_0x1b4c8b(++_0x4d1e7a);}(_0xdb7f,0xed));var _0xfdb7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xdb7f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xfdb7('0x0'));var moment=require('moment');var BPromise=require(_0xfdb7('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xfdb7('0x2'))('ami');var ami=require(_0xfdb7('0x3'));config[_0xfdb7('0x4')]=_[_0xfdb7('0x5')](config[_0xfdb7('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xfdb7('0x6'))(new Redis(config[_0xfdb7('0x4')]));function UserReport(_0x5220ca){this[_0xfdb7('0x7')]=_0x5220ca[_0xfdb7('0x7')];this['agents']=_0x5220ca[_0xfdb7('0x8')];this[_0xfdb7('0x9')]=_0x5220ca[_0xfdb7('0x9')];ami['on'](_0xfdb7('0xa'),this[_0xfdb7('0xb')][_0xfdb7('0xc')](this));ami['on'](_0xfdb7('0xd'),this['syncRegistry'][_0xfdb7('0xc')](this));ami['on'](_0xfdb7('0xe'),this[_0xfdb7('0xf')]['bind'](this));ami['on']('peerstatus',this[_0xfdb7('0x10')][_0xfdb7('0xc')](this));this[_0xfdb7('0x11')]();return BPromise[_0xfdb7('0x12')]()[_0xfdb7('0x13')](ami[_0xfdb7('0x14')]())[_0xfdb7('0x13')](ami[_0xfdb7('0x15')]())[_0xfdb7('0x13')](ami[_0xfdb7('0x16')]())[_0xfdb7('0x17')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x2108aa){return function(_0x4d810a){logger['error'](_0x2108aa,util[_0xfdb7('0x18')](_0x4d810a,{'showHidden':![],'depth':null}));};}UserReport[_0xfdb7('0x19')][_0xfdb7('0x11')]=function(){setInterval(function(){BPromise['resolve']()[_0xfdb7('0x13')](ami[_0xfdb7('0x14')]())[_0xfdb7('0x13')](ami[_0xfdb7('0x15')]())[_0xfdb7('0x13')](ami[_0xfdb7('0x16')]())[_0xfdb7('0x17')](loggerCatch(_0xfdb7('0x1a')));},0x32c8);};UserReport[_0xfdb7('0x19')]['isNotNull']=function(_0x5d3b69){return _0x5d3b69!==null&&!_[_0xfdb7('0x1b')](_0x5d3b69);};UserReport[_0xfdb7('0x19')][_0xfdb7('0x1c')]=function(_0x363ac5,_0x2c5a23,_0x2f0d6a){io['to'](_0x363ac5)['emit'](_0x2c5a23,_0x2f0d6a);};UserReport[_0xfdb7('0x19')][_0xfdb7('0xb')]=function(_0x46fa3e){try{if(this['isNotNull'](_0x46fa3e)){var _0x2cc750=_['find'](this['trunks'],{'registry':_0x46fa3e['username']});if(_0x2cc750){_0x46fa3e['stateRegistry']=_0x46fa3e[_0xfdb7('0x1d')];_['merge'](_0x2cc750,_[_0xfdb7('0x1e')](_0x46fa3e,[_0xfdb7('0x1f'),'actionid',_0xfdb7('0x20'),_0xfdb7('0x1d')]));this[_0xfdb7('0x1c')](util[_0xfdb7('0x21')](_0xfdb7('0x22'),_0x2cc750['name']),_0xfdb7('0x23'),_0x2cc750);}}}catch(_0x309ac7){logger['error'](_0xfdb7('0x24'),util[_0xfdb7('0x18')](_0x309ac7,{'showHidden':![],'depth':null}));}};UserReport[_0xfdb7('0x19')][_0xfdb7('0xf')]=function(_0x556677){try{if(this[_0xfdb7('0x25')](_0x556677)){if(this[_0xfdb7('0x8')][_0x556677[_0xfdb7('0x26')]]){if(!this[_0xfdb7('0x8')][_0x556677[_0xfdb7('0x26')]][_0xfdb7('0x27')]||_0x556677[_0xfdb7('0x1d')][_0xfdb7('0x28')]()==_0xfdb7('0x29')){this[_0xfdb7('0x8')][_0x556677['device']][_0xfdb7('0x27')]=![];if(this[_0xfdb7('0x8')][_0x556677[_0xfdb7('0x26')]]['state']!==_0x556677[_0xfdb7('0x1d')]['toLowerCase']()){this[_0xfdb7('0x8')][_0x556677[_0xfdb7('0x26')]]['stateTime']=_[_0xfdb7('0x2a')](moment()[_0xfdb7('0x21')]('x'));}this[_0xfdb7('0x8')][_0x556677[_0xfdb7('0x26')]][_0xfdb7('0x1d')]=_0x556677[_0xfdb7('0x1d')]['toLowerCase']();this[_0xfdb7('0x8')][_0x556677[_0xfdb7('0x26')]]['updateStatusRealtime'](_0x556677);}}else if(this['telephones'][_0x556677[_0xfdb7('0x26')]]){if(this[_0xfdb7('0x9')][_0x556677[_0xfdb7('0x26')]][_0xfdb7('0x1d')]!==_0x556677[_0xfdb7('0x1d')]['toLowerCase']()){this[_0xfdb7('0x9')][_0x556677[_0xfdb7('0x26')]]['stateTime']=_[_0xfdb7('0x2a')](moment()[_0xfdb7('0x21')]('x'));}this['telephones'][_0x556677[_0xfdb7('0x26')]][_0xfdb7('0x1d')]=_0x556677[_0xfdb7('0x1d')][_0xfdb7('0x28')]();this['emit'](util[_0xfdb7('0x21')](_0xfdb7('0x2b'),this['telephones'][_0x556677[_0xfdb7('0x26')]][_0xfdb7('0x2c')]),_0xfdb7('0x2d'),this[_0xfdb7('0x9')][_0x556677[_0xfdb7('0x26')]]);}else if(this[_0xfdb7('0x7')][_0x556677[_0xfdb7('0x26')]]){if(this['trunks'][_0x556677['device']][_0xfdb7('0x1d')]!==_0x556677['state'][_0xfdb7('0x28')]()){this['trunks'][_0x556677[_0xfdb7('0x26')]][_0xfdb7('0x2e')]=_[_0xfdb7('0x2a')](moment()[_0xfdb7('0x21')]('x'));}this[_0xfdb7('0x7')][_0x556677[_0xfdb7('0x26')]][_0xfdb7('0x1d')]=_0x556677[_0xfdb7('0x1d')][_0xfdb7('0x28')]();this['emit'](util[_0xfdb7('0x21')]('trunk:%s',this[_0xfdb7('0x7')][_0x556677[_0xfdb7('0x26')]][_0xfdb7('0x2c')]),_0xfdb7('0x23'),this[_0xfdb7('0x7')][_0x556677[_0xfdb7('0x26')]]);}else if(_[_0xfdb7('0x2f')](_0x556677[_0xfdb7('0x26')],_0xfdb7('0x30'))){}else if(_[_0xfdb7('0x2f')](_0x556677['device'],_0xfdb7('0x31'))){var _0xc86226=_0x556677[_0xfdb7('0x26')];var _0x16aaa1=_0xc86226[_0xfdb7('0x32')](_0xc86226[_0xfdb7('0x33')]('/')+0x1,_0xc86226[_0xfdb7('0x33')]('@'));var _0x5b53b7=_[_0xfdb7('0x34')](this[_0xfdb7('0x8')],function(_0x4c7984){return _0x4c7984['mobile']==_0x16aaa1||_0x4c7984['phone']==_0x16aaa1||_0x4c7984[_0xfdb7('0x35')]==_0x16aaa1;});if(_0x5b53b7){if(_0x5b53b7[_0xfdb7('0x1d')]!==_0x556677[_0xfdb7('0x1d')]['toLowerCase']()){_0x5b53b7[_0xfdb7('0x2e')]=_[_0xfdb7('0x2a')](moment()[_0xfdb7('0x21')]('x'));}_0x5b53b7[_0xfdb7('0x1d')]=_0x556677[_0xfdb7('0x1d')][_0xfdb7('0x28')]();_0x5b53b7[_0xfdb7('0x27')]=!![];_0x5b53b7['updateStatusRealtime'](_0x556677);}}else{}}}catch(_0x3fe681){logger[_0xfdb7('0x36')]('[syncDeviceState][UserReport]',util[_0xfdb7('0x18')](_0x3fe681,{'showHidden':![],'depth':null}));}};UserReport[_0xfdb7('0x19')]['syncPeerStatus']=function(_0x454727){try{if(this[_0xfdb7('0x25')](_0x454727)&&this[_0xfdb7('0x25')](_0x454727[_0xfdb7('0x37')])){if(this['agents'][_0x454727[_0xfdb7('0x38')]]){if(!this[_0xfdb7('0x8')][_0x454727[_0xfdb7('0x38')]]['local']||_0x454727[_0xfdb7('0x37')][_0xfdb7('0x28')]()==_0xfdb7('0x39')){this[_0xfdb7('0x8')][_0x454727[_0xfdb7('0x38')]][_0xfdb7('0x27')]=![];this[_0xfdb7('0x8')][_0x454727[_0xfdb7('0x38')]][_0xfdb7('0x3a')]=_0x454727[_0xfdb7('0x37')][_0xfdb7('0x28')]();this['agents'][_0x454727[_0xfdb7('0x38')]][_0xfdb7('0x3b')]=_0x454727['address'];this['agents'][_0x454727[_0xfdb7('0x38')]][_0xfdb7('0x3c')](_0x454727);}}else if(this[_0xfdb7('0x9')][_0x454727[_0xfdb7('0x38')]]){this[_0xfdb7('0x9')][_0x454727[_0xfdb7('0x38')]][_0xfdb7('0x3a')]=_0x454727[_0xfdb7('0x37')][_0xfdb7('0x28')]();this[_0xfdb7('0x9')][_0x454727[_0xfdb7('0x38')]][_0xfdb7('0x3b')]=_0x454727[_0xfdb7('0x3b')];this['emit'](util[_0xfdb7('0x21')](_0xfdb7('0x2b'),this[_0xfdb7('0x9')][_0x454727['peer']]['name']),_0xfdb7('0x2d'),this['telephones'][_0x454727['peer']]);}else if(this[_0xfdb7('0x7')][_0x454727[_0xfdb7('0x38')]]){this[_0xfdb7('0x7')][_0x454727['peer']][_0xfdb7('0x3a')]=_0x454727[_0xfdb7('0x37')][_0xfdb7('0x28')]();this['trunks'][_0x454727[_0xfdb7('0x38')]][_0xfdb7('0x3b')]=_0x454727[_0xfdb7('0x3b')];this[_0xfdb7('0x1c')](util[_0xfdb7('0x21')](_0xfdb7('0x22'),this[_0xfdb7('0x7')][_0x454727[_0xfdb7('0x38')]][_0xfdb7('0x2c')]),_0xfdb7('0x23'),this['trunks'][_0x454727['peer']]);}else{}}}catch(_0x38f1ca){logger['error']('[syncPeerStatus][UserReport]',util[_0xfdb7('0x18')](_0x38f1ca,{'showHidden':![],'depth':null}));}};module[_0xfdb7('0x3d')]=UserReport; \ No newline at end of file +var _0x3485=['format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','inspect','syncDeviceState','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus','catch','error','prototype','resolve','[loopSyncRealTimeShow]','isNotNull','emit','find','username','state','merge','actionid'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x3485,0x1f3));var _0x5348=function(_0x39c697,_0x139e0e){_0x39c697=_0x39c697-0x0;var _0x5ac429=_0x3485[_0x39c697];return _0x5ac429;};'use strict';var _=require(_0x5348('0x0'));var moment=require(_0x5348('0x1'));var BPromise=require('bluebird');var util=require(_0x5348('0x2'));var Redis=require(_0x5348('0x3'));var config=require(_0x5348('0x4'));var logger=require(_0x5348('0x5'))(_0x5348('0x6'));var ami=require(_0x5348('0x7'));config[_0x5348('0x8')]=_[_0x5348('0x9')](config[_0x5348('0x8')],{'host':_0x5348('0xa'),'port':0x18eb});var io=require(_0x5348('0xb'))(new Redis(config[_0x5348('0x8')]));function UserReport(_0x7f868b){this[_0x5348('0xc')]=_0x7f868b[_0x5348('0xc')];this[_0x5348('0xd')]=_0x7f868b[_0x5348('0xd')];this[_0x5348('0xe')]=_0x7f868b[_0x5348('0xe')];ami['on']('registryentry',this[_0x5348('0xf')][_0x5348('0x10')](this));ami['on']('registry',this[_0x5348('0xf')][_0x5348('0x10')](this));ami['on'](_0x5348('0x11'),this['syncDeviceState'][_0x5348('0x10')](this));ami['on'](_0x5348('0x12'),this[_0x5348('0x13')][_0x5348('0x10')](this));this[_0x5348('0x14')]();return BPromise['resolve']()['then'](ami[_0x5348('0x15')]())[_0x5348('0x16')](ami[_0x5348('0x17')]())[_0x5348('0x16')](ami[_0x5348('0x18')]())[_0x5348('0x19')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x511d07){return function(_0x5b990f){logger[_0x5348('0x1a')](_0x511d07,util['inspect'](_0x5b990f,{'showHidden':![],'depth':null}));};}UserReport[_0x5348('0x1b')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0x5348('0x1c')]()[_0x5348('0x16')](ami[_0x5348('0x15')]())[_0x5348('0x16')](ami['actionDeviceStateList']())[_0x5348('0x16')](ami['actionSipPeerStatus']())[_0x5348('0x19')](loggerCatch(_0x5348('0x1d')));},0x32c8);};UserReport[_0x5348('0x1b')][_0x5348('0x1e')]=function(_0x14450c){return _0x14450c!==null&&!_['isUndefined'](_0x14450c);};UserReport['prototype'][_0x5348('0x1f')]=function(_0x96062c,_0x126e9c,_0xe16676){io['to'](_0x96062c)[_0x5348('0x1f')](_0x126e9c,_0xe16676);};UserReport[_0x5348('0x1b')]['syncRegistry']=function(_0x4cd14d){try{if(this[_0x5348('0x1e')](_0x4cd14d)){var _0x1e91c5=_[_0x5348('0x20')](this[_0x5348('0xc')],{'registry':_0x4cd14d[_0x5348('0x21')]});if(_0x1e91c5){_0x4cd14d['stateRegistry']=_0x4cd14d[_0x5348('0x22')];_[_0x5348('0x23')](_0x1e91c5,_['omit'](_0x4cd14d,['event',_0x5348('0x24'),_0x5348('0x21'),_0x5348('0x22')]));this[_0x5348('0x1f')](util[_0x5348('0x25')](_0x5348('0x26'),_0x1e91c5[_0x5348('0x27')]),_0x5348('0x28'),_0x1e91c5);}}}catch(_0x3aad2a){logger['error'](_0x5348('0x29'),util[_0x5348('0x2a')](_0x3aad2a,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5348('0x2b')]=function(_0x44ac91){try{if(this[_0x5348('0x1e')](_0x44ac91)){if(this[_0x5348('0xd')][_0x44ac91[_0x5348('0x2c')]]){if(!this[_0x5348('0xd')][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x2d')]||_0x44ac91['state']['toLowerCase']()==_0x5348('0x2e')){this[_0x5348('0xd')][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x2d')]=![];if(this[_0x5348('0xd')][_0x44ac91['device']][_0x5348('0x22')]!==_0x44ac91[_0x5348('0x22')][_0x5348('0x2f')]()){this['agents'][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x30')]=_[_0x5348('0x31')](moment()[_0x5348('0x25')]('x'));}this['agents'][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x22')]=_0x44ac91[_0x5348('0x22')][_0x5348('0x2f')]();this['agents'][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x32')](_0x44ac91);}}else if(this['telephones'][_0x44ac91[_0x5348('0x2c')]]){if(this[_0x5348('0xe')][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x22')]!==_0x44ac91[_0x5348('0x22')][_0x5348('0x2f')]()){this[_0x5348('0xe')][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x30')]=_[_0x5348('0x31')](moment()[_0x5348('0x25')]('x'));}this[_0x5348('0xe')][_0x44ac91[_0x5348('0x2c')]]['state']=_0x44ac91[_0x5348('0x22')]['toLowerCase']();this[_0x5348('0x1f')](util[_0x5348('0x25')](_0x5348('0x33'),this['telephones'][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x27')]),_0x5348('0x34'),this[_0x5348('0xe')][_0x44ac91[_0x5348('0x2c')]]);}else if(this['trunks'][_0x44ac91[_0x5348('0x2c')]]){if(this[_0x5348('0xc')][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x22')]!==_0x44ac91[_0x5348('0x22')]['toLowerCase']()){this['trunks'][_0x44ac91['device']][_0x5348('0x30')]=_['toNumber'](moment()['format']('x'));}this[_0x5348('0xc')][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x22')]=_0x44ac91[_0x5348('0x22')][_0x5348('0x2f')]();this[_0x5348('0x1f')](util[_0x5348('0x25')](_0x5348('0x26'),this['trunks'][_0x44ac91[_0x5348('0x2c')]][_0x5348('0x27')]),_0x5348('0x28'),this[_0x5348('0xc')][_0x44ac91['device']]);}else if(_[_0x5348('0x35')](_0x44ac91[_0x5348('0x2c')],_0x5348('0x36'))){}else if(_['startsWith'](_0x44ac91[_0x5348('0x2c')],_0x5348('0x37'))){var _0x40d561=_0x44ac91[_0x5348('0x2c')];var _0x47b100=_0x40d561[_0x5348('0x38')](_0x40d561[_0x5348('0x39')]('/')+0x1,_0x40d561[_0x5348('0x39')]('@'));var _0x45ee1d=_['find'](this[_0x5348('0xd')],function(_0x2df978){return _0x2df978[_0x5348('0x3a')]==_0x47b100||_0x2df978[_0x5348('0x3b')]==_0x47b100||_0x2df978[_0x5348('0x3c')]==_0x47b100;});if(_0x45ee1d){if(_0x45ee1d[_0x5348('0x22')]!==_0x44ac91[_0x5348('0x22')][_0x5348('0x2f')]()){_0x45ee1d[_0x5348('0x30')]=_[_0x5348('0x31')](moment()[_0x5348('0x25')]('x'));}_0x45ee1d[_0x5348('0x22')]=_0x44ac91[_0x5348('0x22')][_0x5348('0x2f')]();_0x45ee1d['local']=!![];_0x45ee1d['updateStatusRealtime'](_0x44ac91);}}else{}}}catch(_0x4c0130){logger[_0x5348('0x1a')](_0x5348('0x3d'),util[_0x5348('0x2a')](_0x4c0130,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5348('0x13')]=function(_0x53414a){try{if(this[_0x5348('0x1e')](_0x53414a)&&this[_0x5348('0x1e')](_0x53414a['peerstatus'])){if(this[_0x5348('0xd')][_0x53414a[_0x5348('0x3e')]]){if(!this[_0x5348('0xd')][_0x53414a['peer']][_0x5348('0x2d')]||_0x53414a[_0x5348('0x12')][_0x5348('0x2f')]()==_0x5348('0x3f')){this[_0x5348('0xd')][_0x53414a[_0x5348('0x3e')]][_0x5348('0x2d')]=![];this[_0x5348('0xd')][_0x53414a[_0x5348('0x3e')]][_0x5348('0x40')]=_0x53414a[_0x5348('0x12')]['toLowerCase']();this[_0x5348('0xd')][_0x53414a[_0x5348('0x3e')]]['address']=_0x53414a[_0x5348('0x41')];this[_0x5348('0xd')][_0x53414a[_0x5348('0x3e')]][_0x5348('0x32')](_0x53414a);}}else if(this[_0x5348('0xe')][_0x53414a[_0x5348('0x3e')]]){this[_0x5348('0xe')][_0x53414a[_0x5348('0x3e')]][_0x5348('0x40')]=_0x53414a[_0x5348('0x12')][_0x5348('0x2f')]();this[_0x5348('0xe')][_0x53414a[_0x5348('0x3e')]][_0x5348('0x41')]=_0x53414a[_0x5348('0x41')];this['emit'](util['format'](_0x5348('0x33'),this[_0x5348('0xe')][_0x53414a[_0x5348('0x3e')]][_0x5348('0x27')]),_0x5348('0x34'),this[_0x5348('0xe')][_0x53414a[_0x5348('0x3e')]]);}else if(this[_0x5348('0xc')][_0x53414a[_0x5348('0x3e')]]){this[_0x5348('0xc')][_0x53414a[_0x5348('0x3e')]][_0x5348('0x40')]=_0x53414a['peerstatus']['toLowerCase']();this[_0x5348('0xc')][_0x53414a[_0x5348('0x3e')]][_0x5348('0x41')]=_0x53414a[_0x5348('0x41')];this['emit'](util[_0x5348('0x25')](_0x5348('0x26'),this[_0x5348('0xc')][_0x53414a[_0x5348('0x3e')]]['name']),'trunk:save',this[_0x5348('0xc')][_0x53414a['peer']]);}else{}}}catch(_0x37b91f){logger[_0x5348('0x1a')]('[syncPeerStatus][UserReport]',util[_0x5348('0x2a')](_0x37b91f,{'showHidden':![],'depth':null}));}};module[_0x5348('0x42')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index df1238d..5324743 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 _0xf93a=['acwTimeout','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','[syncBlindTransfer][VoiceAgentReport]','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','substring','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','agentconnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','variables','queue','type','inbound','omit','event','privilege','membername','user:called','syncAgentConnect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:%s','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','inspect','rejected','custom:agentringnoanswer','error','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','acw'];(function(_0x5bccbf,_0x547e42){var _0x2158c6=function(_0x40f28a){while(--_0x40f28a){_0x5bccbf['push'](_0x5bccbf['shift']());}};_0x2158c6(++_0x547e42);}(_0xf93a,0xa4));var _0xaf93=function(_0x21b584,_0x3174c4){_0x21b584=_0x21b584-0x0;var _0x59a75f=_0xf93a[_0x21b584];return _0x59a75f;};'use strict';var _=require(_0xaf93('0x0'));var moment=require('moment');var util=require(_0xaf93('0x1'));var Redis=require(_0xaf93('0x2'));var config=require(_0xaf93('0x3'));var logger=require(_0xaf93('0x4'))(_0xaf93('0x5'));var ami=require('../ami');config[_0xaf93('0x6')]=_[_0xaf93('0x7')](config[_0xaf93('0x6')],{'host':_0xaf93('0x8'),'port':0x18eb});var io=require(_0xaf93('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x471629){this[_0xaf93('0xa')]={};this['voiceQueues']=_0x471629[_0xaf93('0xb')];this[_0xaf93('0xc')]=_0x471629[_0xaf93('0xc')];this['variables']={};ami['on'](_0xaf93('0xd'),this[_0xaf93('0xe')]['bind'](this));ami['on'](_0xaf93('0xf'),this['syncAgentConnect'][_0xaf93('0x10')](this));ami['on'](_0xaf93('0x11'),this[_0xaf93('0x12')][_0xaf93('0x10')](this));ami['on'](_0xaf93('0x13'),this[_0xaf93('0x14')][_0xaf93('0x10')](this));ami['on'](_0xaf93('0x15'),this[_0xaf93('0x16')][_0xaf93('0x10')](this));ami['on'](_0xaf93('0x17'),this['syncVarSet'][_0xaf93('0x10')](this));ami['on'](_0xaf93('0x18'),this[_0xaf93('0x19')][_0xaf93('0x10')](this));ami['on']('musiconholdstart',this[_0xaf93('0x1a')][_0xaf93('0x10')](this));ami['on']('musiconholdstop',this[_0xaf93('0x1b')][_0xaf93('0x10')](this));ami['on'](_0xaf93('0x1c'),this[_0xaf93('0x1d')][_0xaf93('0x10')](this));ami['on'](_0xaf93('0x1e'),this[_0xaf93('0x1f')]['bind'](this));}VoiceAgentReport[_0xaf93('0x20')][_0xaf93('0x21')]=function(_0x3c603e,_0x271976,_0x5de23c){io['to'](_0x3c603e)[_0xaf93('0x21')](_0x271976,_0x5de23c);};VoiceAgentReport[_0xaf93('0x20')][_0xaf93('0x22')]=function(_0x12aaaa){return _0x12aaaa!==null&&!_[_0xaf93('0x23')](_0x12aaaa);};VoiceAgentReport[_0xaf93('0x20')][_0xaf93('0xe')]=function(_0x363065){try{if(this['isNotNull'](_0x363065)){if(_[_0xaf93('0x23')](this[_0xaf93('0xa')][_0x363065['uniqueid']])){this[_0xaf93('0xa')][_0x363065['uniqueid']]={};}if(_[_0xaf93('0x23')](this['channels'][_0x363065[_0xaf93('0x24')]][_0x363065[_0xaf93('0x25')]])){this[_0xaf93('0xa')][_0x363065[_0xaf93('0x24')]][_0x363065[_0xaf93('0x25')]]={'agentcalledAt':moment()[_0xaf93('0x26')](_0xaf93('0x27')),'lastevent':_0xaf93('0x28'),'variables':this[_0xaf93('0x29')][_0x363065['uniqueid']],'type':this[_0xaf93('0xb')][_0x363065[_0xaf93('0x2a')]]?this['voiceQueues'][_0x363065[_0xaf93('0x2a')]][_0xaf93('0x2b')]||_0xaf93('0x2c'):_0xaf93('0x2c')};}_['merge'](this['channels'][_0x363065[_0xaf93('0x24')]][_0x363065[_0xaf93('0x25')]],_[_0xaf93('0x2d')](_0x363065,[_0xaf93('0x2e'),_0xaf93('0x2f')]));ami[_0xaf93('0x21')]('custom:agentcalled',this[_0xaf93('0xa')][_0x363065['uniqueid']][_0x363065['destuniqueid']]);this[_0xaf93('0x21')](util[_0xaf93('0x26')]('user:%s',_0x363065[_0xaf93('0x30')]),_0xaf93('0x31'),this[_0xaf93('0xa')][_0x363065['uniqueid']][_0x363065[_0xaf93('0x25')]]);}}catch(_0x1f2f50){logger['error']('[syncAgentCalled][VoiceAgentReport]',util['inspect'](_0x1f2f50,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaf93('0x20')][_0xaf93('0x32')]=function(_0x348e66){try{if(this['isNotNull'](_0x348e66)){if(this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]]){for(var _0x474632 in this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]]){if(this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0xaf93('0x33')](_0x474632)){if(_0x348e66[_0xaf93('0x25')]===_0x474632){this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632][_0xaf93('0x34')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x348e66[_0xaf93('0x24')]][_0x474632][_0xaf93('0x35')]=_0xaf93('0x36');this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632]['holdtime']=_0x348e66[_0xaf93('0x37')];this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632]['connectedlinenum']=_0x348e66[_0xaf93('0x38')];this[_0xaf93('0xa')][_0x348e66['uniqueid']][_0x474632]['connectedlinename']=_0x348e66['connectedlinename'];this['channels'][_0x348e66['uniqueid']][_0x474632]['destchannelstate']=_0x348e66[_0xaf93('0x39')];this['channels'][_0x348e66[_0xaf93('0x24')]][_0x474632][_0xaf93('0x3a')]=_0x348e66[_0xaf93('0x3a')];_['merge'](this[_0xaf93('0xc')][_0x348e66[_0xaf93('0x3b')]],_[_0xaf93('0x3c')](_0x348e66,[_0xaf93('0x2a'),_0xaf93('0x3d')]));this['emit'](util[_0xaf93('0x26')](_0xaf93('0x3e'),_0x348e66[_0xaf93('0x30')]),_0xaf93('0x3f'),this['channels'][_0x348e66['uniqueid']][_0x348e66[_0xaf93('0x25')]]);ami[_0xaf93('0x21')]('custom:agentconnect',this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632]);}else if(!this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632]['agentringnoanswer']&&!this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632][_0xaf93('0x15')]){this[_0xaf93('0xa')][_0x348e66['uniqueid']][_0x474632][_0xaf93('0x11')]=!![];this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632][_0xaf93('0x40')]=moment()[_0xaf93('0x26')](_0xaf93('0x27'));this['channels'][_0x348e66['uniqueid']][_0x474632][_0xaf93('0x41')]=_0xaf93('0x42');this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632][_0xaf93('0x35')]='answered_elsewhere';this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632][_0xaf93('0x43')]=_0x348e66[_0xaf93('0x25')];this['channels'][_0x348e66[_0xaf93('0x24')]][_0x474632][_0xaf93('0x44')]=_0x348e66['membername'];ami[_0xaf93('0x21')](_0xaf93('0x45'),this[_0xaf93('0xa')][_0x348e66[_0xaf93('0x24')]][_0x474632]);}}}}}}catch(_0x10e6ba){logger['error']('[syncAgentConnect][VoiceAgentReport]',util[_0xaf93('0x46')](_0x10e6ba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaf93('0x20')][_0xaf93('0x12')]=function(_0x286112){try{if(this[_0xaf93('0x22')](_0x286112)){if(this[_0xaf93('0xa')][_0x286112['uniqueid']]&&this['channels'][_0x286112['uniqueid']][_0x286112[_0xaf93('0x25')]]){this[_0xaf93('0xa')][_0x286112[_0xaf93('0x24')]][_0x286112['destuniqueid']][_0xaf93('0x11')]=!![];this[_0xaf93('0xa')][_0x286112['uniqueid']][_0x286112[_0xaf93('0x25')]][_0xaf93('0x40')]=moment()[_0xaf93('0x26')](_0xaf93('0x27'));this[_0xaf93('0xa')][_0x286112['uniqueid']][_0x286112[_0xaf93('0x25')]][_0xaf93('0x41')]=_0xaf93('0x47');this[_0xaf93('0xa')][_0x286112[_0xaf93('0x24')]][_0x286112['destuniqueid']][_0xaf93('0x35')]='rejected';ami[_0xaf93('0x21')](_0xaf93('0x48'),this['channels'][_0x286112[_0xaf93('0x24')]][_0x286112[_0xaf93('0x25')]]);}}}catch(_0x2f7410){logger[_0xaf93('0x49')](_0xaf93('0x4a'),util[_0xaf93('0x46')](_0x2f7410,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xaf93('0x14')]=function(_0x251e2f){try{if(this['isNotNull'](_0x251e2f)){if(this['channels'][_0x251e2f[_0xaf93('0x24')]]){for(var _0x2c0a65 in this[_0xaf93('0xa')][_0x251e2f[_0xaf93('0x24')]]){if(this['channels'][_0x251e2f[_0xaf93('0x24')]]['hasOwnProperty'](_0x2c0a65)&&!this[_0xaf93('0xa')][_0x251e2f[_0xaf93('0x24')]][_0x2c0a65]['agentringnoanswer']&&!this[_0xaf93('0xa')][_0x251e2f[_0xaf93('0x24')]][_0x2c0a65][_0xaf93('0x15')]){this['channels'][_0x251e2f[_0xaf93('0x24')]][_0x2c0a65][_0xaf93('0x11')]=!![];this[_0xaf93('0xa')][_0x251e2f['uniqueid']][_0x2c0a65]['agentringnoanswerAt']=moment()[_0xaf93('0x26')](_0xaf93('0x27'));this[_0xaf93('0xa')][_0x251e2f['uniqueid']][_0x2c0a65][_0xaf93('0x41')]=_0xaf93('0x4b');this['channels'][_0x251e2f[_0xaf93('0x24')]][_0x2c0a65][_0xaf93('0x35')]=_0xaf93('0x4b');ami[_0xaf93('0x21')](_0xaf93('0x4c'),this['channels'][_0x251e2f['uniqueid']][_0x2c0a65]);}}}}}catch(_0x5bcabb){logger['error'](_0xaf93('0x4d'),util['inspect'](_0x5bcabb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaf93('0x20')]['syncAgentComplete']=function(_0x3644ee){try{if(this['isNotNull'](_0x3644ee)){if(this[_0xaf93('0xa')][_0x3644ee[_0xaf93('0x24')]]){for(var _0xa54a0d in this['channels'][_0x3644ee['uniqueid']]){if(this[_0xaf93('0xa')][_0x3644ee[_0xaf93('0x24')]][_0xaf93('0x33')](_0xa54a0d)){if(this['channels'][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d][_0xaf93('0x34')]&&!this['channels'][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d][_0xaf93('0x15')]){this[_0xaf93('0xa')][_0x3644ee['uniqueid']][_0xa54a0d][_0xaf93('0x15')]=!![];this['channels'][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d][_0xaf93('0x4e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xaf93('0xa')][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d]['lastevent']=_0xaf93('0x4f');this[_0xaf93('0xa')][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d][_0xaf93('0x50')]=_0x3644ee[_0xaf93('0x50')];this[_0xaf93('0xa')][_0x3644ee['uniqueid']][_0xa54a0d][_0xaf93('0x41')]=_0x3644ee[_0xaf93('0x41')]==_0xaf93('0x51')?_0xaf93('0x52'):_0x3644ee[_0xaf93('0x41')];if(this[_0xaf93('0xb')][_0x3644ee[_0xaf93('0x2a')]]&&this[_0xaf93('0xb')][_0x3644ee[_0xaf93('0x2a')]][_0xaf93('0x53')]){this[_0xaf93('0xa')][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d]['agentacw']=!![];this[_0xaf93('0xa')][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d]['acwtime']=this[_0xaf93('0xb')][_0x3644ee['queue']][_0xaf93('0x54')];}this[_0xaf93('0xc')][_0x3644ee[_0xaf93('0x3b')]]=_['omit'](this['agents'][_0x3644ee[_0xaf93('0x3b')]],['queue','destconnectedlinenum']);this[_0xaf93('0x21')](util['format'](_0xaf93('0x3e'),_0x3644ee['membername']),'user:agentcomplete',this['channels'][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d]);ami['emit']('custom:agentcomplete',this[_0xaf93('0xa')][_0x3644ee[_0xaf93('0x24')]][_0xa54a0d]);}}}}}}catch(_0x4afc71){logger[_0xaf93('0x49')](_0xaf93('0x55'),util[_0xaf93('0x46')](_0x4afc71,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaf93('0x20')][_0xaf93('0x56')]=function(_0x35cb6a){try{if(this[_0xaf93('0x22')](_0x35cb6a)){this[_0xaf93('0x57')](_0x35cb6a[_0xaf93('0x24')],_[_0xaf93('0x58')](_0x35cb6a[_0xaf93('0x59')])[0x0],_0x35cb6a[_0xaf93('0x5a')]);if(this['channels'][_0x35cb6a['uniqueid']]){for(var _0xd49e11 in this['channels'][_0x35cb6a[_0xaf93('0x24')]]){if(this['channels'][_0x35cb6a[_0xaf93('0x24')]]['hasOwnProperty'](_0xd49e11)){if(_[_0xaf93('0x23')](this['channels'][_0x35cb6a[_0xaf93('0x24')]][_0xd49e11][_0xaf93('0x29')])){this['channels'][_0x35cb6a['uniqueid']][_0xd49e11]['variables']={};}this[_0xaf93('0xa')][_0x35cb6a[_0xaf93('0x24')]][_0xd49e11][_0xaf93('0x29')]=this[_0xaf93('0x29')][_0x35cb6a[_0xaf93('0x24')]];}}}}}catch(_0x3757bb){logger[_0xaf93('0x49')](_0xaf93('0x5b'),util[_0xaf93('0x46')](_0x3757bb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xaf93('0x57')]=function(_0x33c877,_0x109140,_0xe4be2a){var _0x355596=[_0xaf93('0x5c'),_0xaf93('0x5d'),_0xaf93('0x5e'),_0xaf93('0x5f'),_0xaf93('0x60'),'rtpaudioqoslossbridged',_0xaf93('0x61'),_0xaf93('0x62'),_0xaf93('0x63'),'sipuri',_0xaf93('0x64'),'bridgepvtcallid',_0xaf93('0x65'),_0xaf93('0x66'),'memberinterface',_0xaf93('0x67'),_0xaf93('0x30'),_0xaf93('0x68'),_0xaf93('0x69')];if(!_[_0xaf93('0x6a')](_0x109140)&&!_[_0xaf93('0x6b')](_0x355596,_0x109140)){if(_[_0xaf93('0x23')](this[_0xaf93('0x29')][_0x33c877])){this[_0xaf93('0x29')][_0x33c877]={};}this['variables'][_0x33c877][_0x109140]=_0xe4be2a;}};VoiceAgentReport[_0xaf93('0x20')][_0xaf93('0x19')]=function(_0x91bcca){try{if(this['isNotNull'](_0x91bcca)){if(this[_0xaf93('0xa')][_0x91bcca[_0xaf93('0x24')]]){for(var _0x3e4b84 in this['channels'][_0x91bcca[_0xaf93('0x24')]]){if(this[_0xaf93('0xa')][_0x91bcca[_0xaf93('0x24')]][_0xaf93('0x33')](_0x3e4b84)){if(this['channels'][_0x91bcca[_0xaf93('0x24')]][_0x3e4b84][_0xaf93('0x41')]==_0xaf93('0x51')&&this[_0xaf93('0xa')][_0x91bcca[_0xaf93('0x24')]][_0x3e4b84][_0xaf93('0x15')]){this[_0xaf93('0xa')][_0x91bcca['uniqueid']][_0x3e4b84][_0xaf93('0x4e')]=moment()[_0xaf93('0x26')](_0xaf93('0x27'));}}}ami[_0xaf93('0x21')](_0xaf93('0x6c'),_[_0xaf93('0x6d')](this[_0xaf93('0xa')][_0x91bcca['uniqueid']]));delete this[_0xaf93('0xa')][_0x91bcca[_0xaf93('0x24')]];}if(this[_0xaf93('0x29')][_0x91bcca[_0xaf93('0x24')]]){delete this['variables'][_0x91bcca[_0xaf93('0x24')]];}}}catch(_0x4c161e){logger['error'](_0xaf93('0x6e'),util[_0xaf93('0x46')](_0x4c161e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xaf93('0x1d')]=function(_0x988220){try{if(this[_0xaf93('0x22')](_0x988220)){if(this[_0xaf93('0xa')][_0x988220['transfereeuniqueid']]){for(var _0x159f85 in this[_0xaf93('0xa')][_0x988220['transfereeuniqueid']]){if(this[_0xaf93('0xa')][_0x988220[_0xaf93('0x6f')]]['hasOwnProperty'](_0x159f85)){if(_0x988220[_0xaf93('0x70')]===_0x159f85){var _0x2154fa=moment();this[_0xaf93('0xa')][_0x988220[_0xaf93('0x6f')]][_0x159f85][_0xaf93('0x15')]=!![];this[_0xaf93('0xa')][_0x988220['transfereeuniqueid']][_0x159f85]['agentcompleteAt']=moment()[_0xaf93('0x26')](_0xaf93('0x27'));this[_0xaf93('0xa')][_0x988220[_0xaf93('0x6f')]][_0x159f85][_0xaf93('0x41')]=_0xaf93('0x51');this[_0xaf93('0xa')][_0x988220[_0xaf93('0x6f')]][_0x159f85][_0xaf93('0x35')]='complete';this[_0xaf93('0xa')][_0x988220['transfereeuniqueid']][_0x159f85][_0xaf93('0x50')]=_0x2154fa[_0xaf93('0x71')](this['channels'][_0x988220['transfereeuniqueid']][_0x159f85]['agentconnectAt'],_0xaf93('0x72'));}}}}if(this[_0xaf93('0xa')][_0x988220['secondtransfereruniqueid']]){var _0x195737=this[_0xaf93('0xa')][_0x988220[_0xaf93('0x73')]];this[_0xaf93('0xa')][_0x988220['secondtransfereruniqueid']]=this['channels'][_0x988220[_0xaf93('0x6f')]];this['channels'][_0x988220['transfereeuniqueid']]=_0x195737;}}}catch(_0x2f4588){logger['error'](_0xaf93('0x74'),util[_0xaf93('0x46')](_0x2f4588,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaf93('0x20')][_0xaf93('0x1f')]=function(_0x5e4774){try{if(this[_0xaf93('0x22')](_0x5e4774)){if(this[_0xaf93('0xa')][_0x5e4774[_0xaf93('0x6f')]]){for(var _0xcd3540 in this[_0xaf93('0xa')][_0x5e4774[_0xaf93('0x6f')]]){if(this[_0xaf93('0xa')][_0x5e4774['transfereeuniqueid']][_0xaf93('0x33')](_0xcd3540)){if(_0x5e4774['transfereruniqueid']===_0xcd3540){var _0x44e9aa=moment();this['channels'][_0x5e4774[_0xaf93('0x6f')]][_0xcd3540][_0xaf93('0x15')]=!![];this[_0xaf93('0xa')][_0x5e4774[_0xaf93('0x6f')]][_0xcd3540][_0xaf93('0x4e')]=_0x44e9aa;this['channels'][_0x5e4774[_0xaf93('0x6f')]][_0xcd3540]['reason']=_0xaf93('0x51');this[_0xaf93('0xa')][_0x5e4774[_0xaf93('0x6f')]][_0xcd3540][_0xaf93('0x35')]=_0xaf93('0x4f');this[_0xaf93('0xa')][_0x5e4774[_0xaf93('0x6f')]][_0xcd3540][_0xaf93('0x50')]=_0x44e9aa['diff'](this[_0xaf93('0xa')][_0x5e4774[_0xaf93('0x6f')]][_0xcd3540][_0xaf93('0x34')],_0xaf93('0x72'));}}}}}}catch(_0x45ad32){logger['error'](_0xaf93('0x75'),util[_0xaf93('0x46')](_0x45ad32,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x1eb9cd){var _0x4401db='';try{if(this[_0xaf93('0x22')](_0x1eb9cd)){if(_0x1eb9cd['channel']){_0x4401db=_0x1eb9cd[_0xaf93('0x76')]['substring'](0x0,_0x1eb9cd[_0xaf93('0x76')][_0xaf93('0x77')]('-'));if(this[_0xaf93('0xc')][_0x4401db]){this[_0xaf93('0xc')][_0x4401db][_0xaf93('0x78')]=!![];}}}}catch(_0x451ebb){logger[_0xaf93('0x49')](_0xaf93('0x79'),util[_0xaf93('0x46')](_0x451ebb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaf93('0x20')]['syncMusicOnHoldStop']=function(_0x29c775){var _0x2708ab='';try{if(this[_0xaf93('0x22')](_0x29c775)){if(_0x29c775[_0xaf93('0x76')]){_0x2708ab=_0x29c775[_0xaf93('0x76')][_0xaf93('0x7a')](0x0,_0x29c775[_0xaf93('0x76')]['lastIndexOf']('-'));if(this[_0xaf93('0xc')][_0x2708ab]){this['agents'][_0x2708ab][_0xaf93('0x78')]=![];}}}}catch(_0x4cb100){logger[_0xaf93('0x49')]('[syncMusicOnHoldStop][VoiceAgentReport]',util['inspect'](_0x4cb100,{'showHidden':![],'depth':null}));}};module[_0xaf93('0x7b')]=VoiceAgentReport; \ No newline at end of file +var _0x21aa=['syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','channels','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','queue','type','inbound','merge','event','privilege','custom:agentcalled','user:%s','membername','user:called','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','connectedlinenum','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','reason','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','syncAgentComplete','complete','talktime','transfer','agent','acw','acwtime','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceAgentReport]','exports','moment','util','ioredis','../../../config/logger','ami','redis','defaults','socket.io-emitter','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncVarSet','hangup'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0x21aa,0xe5));var _0xa21a=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x21aa[_0x15ca1a];return _0x507626;};'use strict';var _=require('lodash');var moment=require(_0xa21a('0x0'));var util=require(_0xa21a('0x1'));var Redis=require(_0xa21a('0x2'));var config=require('../../../config/environment');var logger=require(_0xa21a('0x3'))(_0xa21a('0x4'));var ami=require('../ami');config[_0xa21a('0x5')]=_[_0xa21a('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa21a('0x7'))(new Redis(config[_0xa21a('0x5')]));function VoiceAgentReport(_0x51189e){this['channels']={};this[_0xa21a('0x8')]=_0x51189e[_0xa21a('0x8')];this[_0xa21a('0x9')]=_0x51189e[_0xa21a('0x9')];this[_0xa21a('0xa')]={};ami['on'](_0xa21a('0xb'),this['syncAgentCalled'][_0xa21a('0xc')](this));ami['on'](_0xa21a('0xd'),this[_0xa21a('0xe')][_0xa21a('0xc')](this));ami['on'](_0xa21a('0xf'),this[_0xa21a('0x10')][_0xa21a('0xc')](this));ami['on'](_0xa21a('0x11'),this['syncQueueCallerAbandon'][_0xa21a('0xc')](this));ami['on'](_0xa21a('0x12'),this['syncAgentComplete'][_0xa21a('0xc')](this));ami['on']('varset',this[_0xa21a('0x13')][_0xa21a('0xc')](this));ami['on'](_0xa21a('0x14'),this[_0xa21a('0x15')][_0xa21a('0xc')](this));ami['on']('musiconholdstart',this[_0xa21a('0x16')]['bind'](this));ami['on'](_0xa21a('0x17'),this['syncMusicOnHoldStop'][_0xa21a('0xc')](this));ami['on'](_0xa21a('0x18'),this[_0xa21a('0x19')][_0xa21a('0xc')](this));ami['on'](_0xa21a('0x1a'),this[_0xa21a('0x1b')][_0xa21a('0xc')](this));}VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0x1d')]=function(_0x4789a3,_0x50d5ba,_0x4f5749){io['to'](_0x4789a3)[_0xa21a('0x1d')](_0x50d5ba,_0x4f5749);};VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0x1e')]=function(_0x4bad2a){return _0x4bad2a!==null&&!_[_0xa21a('0x1f')](_0x4bad2a);};VoiceAgentReport['prototype'][_0xa21a('0x20')]=function(_0x494825){try{if(this[_0xa21a('0x1e')](_0x494825)){if(_['isUndefined'](this[_0xa21a('0x21')][_0x494825[_0xa21a('0x22')]])){this[_0xa21a('0x21')][_0x494825['uniqueid']]={};}if(_[_0xa21a('0x1f')](this[_0xa21a('0x21')][_0x494825[_0xa21a('0x22')]][_0x494825['destuniqueid']])){this[_0xa21a('0x21')][_0x494825[_0xa21a('0x22')]][_0x494825[_0xa21a('0x23')]]={'agentcalledAt':moment()[_0xa21a('0x24')](_0xa21a('0x25')),'lastevent':'called','variables':this[_0xa21a('0xa')][_0x494825[_0xa21a('0x22')]],'type':this[_0xa21a('0x8')][_0x494825[_0xa21a('0x26')]]?this[_0xa21a('0x8')][_0x494825[_0xa21a('0x26')]][_0xa21a('0x27')]||_0xa21a('0x28'):_0xa21a('0x28')};}_[_0xa21a('0x29')](this[_0xa21a('0x21')][_0x494825[_0xa21a('0x22')]][_0x494825[_0xa21a('0x23')]],_['omit'](_0x494825,[_0xa21a('0x2a'),_0xa21a('0x2b')]));ami[_0xa21a('0x1d')](_0xa21a('0x2c'),this['channels'][_0x494825[_0xa21a('0x22')]][_0x494825[_0xa21a('0x23')]]);this[_0xa21a('0x1d')](util['format'](_0xa21a('0x2d'),_0x494825[_0xa21a('0x2e')]),_0xa21a('0x2f'),this[_0xa21a('0x21')][_0x494825[_0xa21a('0x22')]][_0x494825[_0xa21a('0x23')]]);}}catch(_0x391efe){logger['error'](_0xa21a('0x30'),util[_0xa21a('0x31')](_0x391efe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0xe')]=function(_0x24f068){try{if(this[_0xa21a('0x1e')](_0x24f068)){if(this[_0xa21a('0x21')][_0x24f068['uniqueid']]){for(var _0x58eee2 in this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]]){if(this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0xa21a('0x32')](_0x58eee2)){if(_0x24f068[_0xa21a('0x23')]===_0x58eee2){this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2][_0xa21a('0x33')]=moment()[_0xa21a('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa21a('0x21')][_0x24f068['uniqueid']][_0x58eee2][_0xa21a('0x34')]=_0xa21a('0x35');this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2]['holdtime']=_0x24f068['holdtime'];this['channels'][_0x24f068[_0xa21a('0x22')]][_0x58eee2][_0xa21a('0x36')]=_0x24f068[_0xa21a('0x36')];this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2]['connectedlinename']=_0x24f068['connectedlinename'];this['channels'][_0x24f068['uniqueid']][_0x58eee2]['destchannelstate']=_0x24f068[_0xa21a('0x37')];this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2][_0xa21a('0x38')]=_0x24f068[_0xa21a('0x38')];_[_0xa21a('0x29')](this[_0xa21a('0x9')][_0x24f068[_0xa21a('0x39')]],_[_0xa21a('0x3a')](_0x24f068,[_0xa21a('0x26'),_0xa21a('0x3b')]));this[_0xa21a('0x1d')](util['format'](_0xa21a('0x2d'),_0x24f068[_0xa21a('0x2e')]),_0xa21a('0x3c'),this['channels'][_0x24f068[_0xa21a('0x22')]][_0x24f068[_0xa21a('0x23')]]);ami[_0xa21a('0x1d')](_0xa21a('0x3d'),this['channels'][_0x24f068[_0xa21a('0x22')]][_0x58eee2]);}else if(!this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2][_0xa21a('0xf')]&&!this[_0xa21a('0x21')][_0x24f068['uniqueid']][_0x58eee2][_0xa21a('0x12')]){this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2]['agentringnoanswer']=!![];this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2][_0xa21a('0x3e')]=moment()[_0xa21a('0x24')](_0xa21a('0x25'));this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2]['reason']=_0xa21a('0x3f');this[_0xa21a('0x21')][_0x24f068['uniqueid']][_0x58eee2]['lastevent']=_0xa21a('0x3f');this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2][_0xa21a('0x40')]=_0x24f068[_0xa21a('0x23')];this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2][_0xa21a('0x41')]=_0x24f068[_0xa21a('0x2e')];ami[_0xa21a('0x1d')](_0xa21a('0x42'),this[_0xa21a('0x21')][_0x24f068[_0xa21a('0x22')]][_0x58eee2]);}}}}}}catch(_0x576410){logger[_0xa21a('0x43')](_0xa21a('0x44'),util[_0xa21a('0x31')](_0x576410,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa21a('0x1c')]['syncAgentRingNoAnswer']=function(_0x6eb19){try{if(this[_0xa21a('0x1e')](_0x6eb19)){if(this[_0xa21a('0x21')][_0x6eb19[_0xa21a('0x22')]]&&this['channels'][_0x6eb19[_0xa21a('0x22')]][_0x6eb19[_0xa21a('0x23')]]){this['channels'][_0x6eb19[_0xa21a('0x22')]][_0x6eb19[_0xa21a('0x23')]][_0xa21a('0xf')]=!![];this[_0xa21a('0x21')][_0x6eb19[_0xa21a('0x22')]][_0x6eb19['destuniqueid']][_0xa21a('0x3e')]=moment()[_0xa21a('0x24')](_0xa21a('0x25'));this[_0xa21a('0x21')][_0x6eb19['uniqueid']][_0x6eb19['destuniqueid']][_0xa21a('0x45')]=_0xa21a('0x46');this['channels'][_0x6eb19[_0xa21a('0x22')]][_0x6eb19['destuniqueid']][_0xa21a('0x34')]=_0xa21a('0x46');ami['emit'](_0xa21a('0x47'),this[_0xa21a('0x21')][_0x6eb19[_0xa21a('0x22')]][_0x6eb19[_0xa21a('0x23')]]);}}}catch(_0x4f1cf){logger[_0xa21a('0x43')](_0xa21a('0x48'),util[_0xa21a('0x31')](_0x4f1cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0x49')]=function(_0x381dfa){try{if(this[_0xa21a('0x1e')](_0x381dfa)){if(this[_0xa21a('0x21')][_0x381dfa[_0xa21a('0x22')]]){for(var _0x1e424b in this['channels'][_0x381dfa['uniqueid']]){if(this[_0xa21a('0x21')][_0x381dfa[_0xa21a('0x22')]]['hasOwnProperty'](_0x1e424b)&&!this[_0xa21a('0x21')][_0x381dfa[_0xa21a('0x22')]][_0x1e424b][_0xa21a('0xf')]&&!this[_0xa21a('0x21')][_0x381dfa['uniqueid']][_0x1e424b]['agentcomplete']){this[_0xa21a('0x21')][_0x381dfa[_0xa21a('0x22')]][_0x1e424b][_0xa21a('0xf')]=!![];this['channels'][_0x381dfa['uniqueid']][_0x1e424b][_0xa21a('0x3e')]=moment()[_0xa21a('0x24')](_0xa21a('0x25'));this['channels'][_0x381dfa[_0xa21a('0x22')]][_0x1e424b][_0xa21a('0x45')]=_0xa21a('0x4a');this[_0xa21a('0x21')][_0x381dfa[_0xa21a('0x22')]][_0x1e424b]['lastevent']=_0xa21a('0x4a');ami[_0xa21a('0x1d')](_0xa21a('0x4b'),this[_0xa21a('0x21')][_0x381dfa[_0xa21a('0x22')]][_0x1e424b]);}}}}}catch(_0x34bd43){logger['error']('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0x34bd43,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa21a('0x4c')]=function(_0x237266){try{if(this[_0xa21a('0x1e')](_0x237266)){if(this['channels'][_0x237266[_0xa21a('0x22')]]){for(var _0x22f2df in this['channels'][_0x237266[_0xa21a('0x22')]]){if(this[_0xa21a('0x21')][_0x237266[_0xa21a('0x22')]]['hasOwnProperty'](_0x22f2df)){if(this[_0xa21a('0x21')][_0x237266[_0xa21a('0x22')]][_0x22f2df][_0xa21a('0x33')]&&!this[_0xa21a('0x21')][_0x237266['uniqueid']][_0x22f2df]['agentcomplete']){this[_0xa21a('0x21')][_0x237266[_0xa21a('0x22')]][_0x22f2df][_0xa21a('0x12')]=!![];this['channels'][_0x237266[_0xa21a('0x22')]][_0x22f2df]['agentcompleteAt']=moment()[_0xa21a('0x24')](_0xa21a('0x25'));this[_0xa21a('0x21')][_0x237266['uniqueid']][_0x22f2df][_0xa21a('0x34')]=_0xa21a('0x4d');this[_0xa21a('0x21')][_0x237266[_0xa21a('0x22')]][_0x22f2df][_0xa21a('0x4e')]=_0x237266[_0xa21a('0x4e')];this['channels'][_0x237266[_0xa21a('0x22')]][_0x22f2df]['reason']=_0x237266[_0xa21a('0x45')]==_0xa21a('0x4f')?_0xa21a('0x50'):_0x237266[_0xa21a('0x45')];if(this['voiceQueues'][_0x237266['queue']]&&this[_0xa21a('0x8')][_0x237266[_0xa21a('0x26')]][_0xa21a('0x51')]){this[_0xa21a('0x21')][_0x237266['uniqueid']][_0x22f2df]['agentacw']=!![];this['channels'][_0x237266['uniqueid']][_0x22f2df][_0xa21a('0x52')]=this[_0xa21a('0x8')][_0x237266[_0xa21a('0x26')]]['acwTimeout'];}this[_0xa21a('0x9')][_0x237266[_0xa21a('0x39')]]=_[_0xa21a('0x53')](this[_0xa21a('0x9')][_0x237266['interface']],[_0xa21a('0x26'),'destconnectedlinenum']);this['emit'](util[_0xa21a('0x24')]('user:%s',_0x237266['membername']),_0xa21a('0x54'),this['channels'][_0x237266[_0xa21a('0x22')]][_0x22f2df]);ami[_0xa21a('0x1d')](_0xa21a('0x55'),this[_0xa21a('0x21')][_0x237266[_0xa21a('0x22')]][_0x22f2df]);}}}}}}catch(_0x30bf80){logger['error'](_0xa21a('0x56'),util[_0xa21a('0x31')](_0x30bf80,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0x13')]=function(_0x19fb39){try{if(this[_0xa21a('0x1e')](_0x19fb39)){this[_0xa21a('0x57')](_0x19fb39[_0xa21a('0x22')],_[_0xa21a('0x58')](_0x19fb39['variable'])[0x0],_0x19fb39[_0xa21a('0x59')]);if(this[_0xa21a('0x21')][_0x19fb39[_0xa21a('0x22')]]){for(var _0x241196 in this[_0xa21a('0x21')][_0x19fb39['uniqueid']]){if(this['channels'][_0x19fb39['uniqueid']][_0xa21a('0x32')](_0x241196)){if(_['isUndefined'](this[_0xa21a('0x21')][_0x19fb39['uniqueid']][_0x241196]['variables'])){this[_0xa21a('0x21')][_0x19fb39[_0xa21a('0x22')]][_0x241196]['variables']={};}this[_0xa21a('0x21')][_0x19fb39[_0xa21a('0x22')]][_0x241196][_0xa21a('0xa')]=this[_0xa21a('0xa')][_0x19fb39['uniqueid']];}}}}}catch(_0x14bccd){logger['error'](_0xa21a('0x5a'),util['inspect'](_0x14bccd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x246d44,_0x34f05f,_0x39a3cb){var _0x31368f=[_0xa21a('0x5b'),_0xa21a('0x5c'),_0xa21a('0x5d'),'rtpaudioqosjitterbridged',_0xa21a('0x5e'),_0xa21a('0x5f'),_0xa21a('0x60'),'rtpaudioqosrttbridged',_0xa21a('0x61'),'sipuri',_0xa21a('0x62'),_0xa21a('0x63'),'membercalls',_0xa21a('0x64'),_0xa21a('0x65'),_0xa21a('0x66'),_0xa21a('0x2e'),_0xa21a('0x67'),'memberrealtime'];if(!_[_0xa21a('0x68')](_0x34f05f)&&!_[_0xa21a('0x69')](_0x31368f,_0x34f05f)){if(_[_0xa21a('0x1f')](this[_0xa21a('0xa')][_0x246d44])){this[_0xa21a('0xa')][_0x246d44]={};}this[_0xa21a('0xa')][_0x246d44][_0x34f05f]=_0x39a3cb;}};VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0x15')]=function(_0x55a1d3){try{if(this[_0xa21a('0x1e')](_0x55a1d3)){if(this[_0xa21a('0x21')][_0x55a1d3[_0xa21a('0x22')]]){for(var _0xfa7ff2 in this[_0xa21a('0x21')][_0x55a1d3[_0xa21a('0x22')]]){if(this[_0xa21a('0x21')][_0x55a1d3[_0xa21a('0x22')]][_0xa21a('0x32')](_0xfa7ff2)){if(this[_0xa21a('0x21')][_0x55a1d3[_0xa21a('0x22')]][_0xfa7ff2][_0xa21a('0x45')]==_0xa21a('0x4f')&&this[_0xa21a('0x21')][_0x55a1d3[_0xa21a('0x22')]][_0xfa7ff2][_0xa21a('0x12')]){this[_0xa21a('0x21')][_0x55a1d3[_0xa21a('0x22')]][_0xfa7ff2]['agentcompleteAt']=moment()[_0xa21a('0x24')](_0xa21a('0x25'));}}}ami['emit'](_0xa21a('0x6a'),_['values'](this[_0xa21a('0x21')][_0x55a1d3[_0xa21a('0x22')]]));delete this['channels'][_0x55a1d3[_0xa21a('0x22')]];}if(this[_0xa21a('0xa')][_0x55a1d3[_0xa21a('0x22')]]){delete this[_0xa21a('0xa')][_0x55a1d3['uniqueid']];}}}catch(_0x2f7c9d){logger[_0xa21a('0x43')](_0xa21a('0x6b'),util[_0xa21a('0x31')](_0x2f7c9d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0x19')]=function(_0x478fcd){try{if(this[_0xa21a('0x1e')](_0x478fcd)){if(this['channels'][_0x478fcd['transfereeuniqueid']]){for(var _0x28c7b4 in this[_0xa21a('0x21')][_0x478fcd[_0xa21a('0x6c')]]){if(this[_0xa21a('0x21')][_0x478fcd['transfereeuniqueid']]['hasOwnProperty'](_0x28c7b4)){if(_0x478fcd[_0xa21a('0x6d')]===_0x28c7b4){var _0x1f4436=moment();this[_0xa21a('0x21')][_0x478fcd[_0xa21a('0x6c')]][_0x28c7b4][_0xa21a('0x12')]=!![];this['channels'][_0x478fcd['transfereeuniqueid']][_0x28c7b4][_0xa21a('0x6e')]=moment()[_0xa21a('0x24')](_0xa21a('0x25'));this[_0xa21a('0x21')][_0x478fcd['transfereeuniqueid']][_0x28c7b4][_0xa21a('0x45')]=_0xa21a('0x4f');this[_0xa21a('0x21')][_0x478fcd[_0xa21a('0x6c')]][_0x28c7b4][_0xa21a('0x34')]='complete';this[_0xa21a('0x21')][_0x478fcd['transfereeuniqueid']][_0x28c7b4]['talktime']=_0x1f4436[_0xa21a('0x6f')](this[_0xa21a('0x21')][_0x478fcd[_0xa21a('0x6c')]][_0x28c7b4][_0xa21a('0x33')],'seconds');}}}}if(this[_0xa21a('0x21')][_0x478fcd['secondtransfereruniqueid']]){var _0x5a6ee1=this[_0xa21a('0x21')][_0x478fcd[_0xa21a('0x70')]];this[_0xa21a('0x21')][_0x478fcd[_0xa21a('0x70')]]=this[_0xa21a('0x21')][_0x478fcd[_0xa21a('0x6c')]];this[_0xa21a('0x21')][_0x478fcd[_0xa21a('0x6c')]]=_0x5a6ee1;}}}catch(_0x45d707){logger['error'](_0xa21a('0x71'),util[_0xa21a('0x31')](_0x45d707,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0x1b')]=function(_0x25a587){try{if(this[_0xa21a('0x1e')](_0x25a587)){if(this[_0xa21a('0x21')][_0x25a587['transfereeuniqueid']]){for(var _0x2894c3 in this[_0xa21a('0x21')][_0x25a587['transfereeuniqueid']]){if(this[_0xa21a('0x21')][_0x25a587[_0xa21a('0x6c')]]['hasOwnProperty'](_0x2894c3)){if(_0x25a587[_0xa21a('0x72')]===_0x2894c3){var _0x1fe3cd=moment();this[_0xa21a('0x21')][_0x25a587[_0xa21a('0x6c')]][_0x2894c3][_0xa21a('0x12')]=!![];this['channels'][_0x25a587['transfereeuniqueid']][_0x2894c3][_0xa21a('0x6e')]=_0x1fe3cd;this[_0xa21a('0x21')][_0x25a587['transfereeuniqueid']][_0x2894c3][_0xa21a('0x45')]=_0xa21a('0x4f');this['channels'][_0x25a587[_0xa21a('0x6c')]][_0x2894c3][_0xa21a('0x34')]='complete';this[_0xa21a('0x21')][_0x25a587[_0xa21a('0x6c')]][_0x2894c3][_0xa21a('0x4e')]=_0x1fe3cd[_0xa21a('0x6f')](this[_0xa21a('0x21')][_0x25a587[_0xa21a('0x6c')]][_0x2894c3]['agentconnectAt'],_0xa21a('0x73'));}}}}}}catch(_0xfa5955){logger[_0xa21a('0x43')](_0xa21a('0x74'),util[_0xa21a('0x31')](_0xfa5955,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa21a('0x16')]=function(_0xe043b3){var _0x1a8593='';try{if(this[_0xa21a('0x1e')](_0xe043b3)){if(_0xe043b3[_0xa21a('0x75')]){_0x1a8593=_0xe043b3[_0xa21a('0x75')][_0xa21a('0x76')](0x0,_0xe043b3[_0xa21a('0x75')][_0xa21a('0x77')]('-'));if(this[_0xa21a('0x9')][_0x1a8593]){this[_0xa21a('0x9')][_0x1a8593][_0xa21a('0x78')]=!![];}}}}catch(_0x134928){logger[_0xa21a('0x43')](_0xa21a('0x79'),util[_0xa21a('0x31')](_0x134928,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa21a('0x1c')][_0xa21a('0x7a')]=function(_0x4acbf6){var _0x179a81='';try{if(this[_0xa21a('0x1e')](_0x4acbf6)){if(_0x4acbf6['channel']){_0x179a81=_0x4acbf6[_0xa21a('0x75')][_0xa21a('0x76')](0x0,_0x4acbf6[_0xa21a('0x75')]['lastIndexOf']('-'));if(this['agents'][_0x179a81]){this[_0xa21a('0x9')][_0x179a81][_0xa21a('0x78')]=![];}}}}catch(_0x2bd437){logger['error'](_0xa21a('0x7b'),util['inspect'](_0x2bd437,{'showHidden':![],'depth':null}));}};module[_0xa21a('0x7c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 2c74ee9..d459f8f 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 _0x74c7=['log','isNotNull','isUndefined','prototype','emit','linkedid','uniqueid','merge','pick','[syncNewCallerId][VoiceCallReport]','inspect','channel','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','keys','context','split','destconnectedlinenum','format','user:%s','user:agentconnect','accountcode','error','OutgoingSpoolFailed','toLowerCase','applicationdata','appdata','duration','subtract','seconds','disposition','application','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','UserId','membername','name','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','variable','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-originatecalleridnum','originatecalleridnum','xmd-callerid-preview','sipcallid','sipcalluniqueid','mixmonitor_filename','parse','endtime','holdtime','billableseconds','from-sip','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','transfertargetuniqueid','origtransferercalleridnum','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','moment','path','ioredis','../../../config/logger','ami','../ami','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch'];(function(_0x97343c,_0x4f6f75){var _0x58df50=function(_0x34158e){while(--_0x34158e){_0x97343c['push'](_0x97343c['shift']());}};_0x58df50(++_0x4f6f75);}(_0x74c7,0x194));var _0x774c=function(_0x3b582b,_0x1a45db){_0x3b582b=_0x3b582b-0x0;var _0x3c7f51=_0x74c7[_0x3b582b];return _0x3c7f51;};'use strict';var BPromise=require('bluebird');var _=require(_0x774c('0x0'));var moment=require(_0x774c('0x1'));var util=require('util');var path=require(_0x774c('0x2'));var Redis=require(_0x774c('0x3'));var config=require('../../../config/environment');var logger=require(_0x774c('0x4'))(_0x774c('0x5'));var ami=require(_0x774c('0x6'));var Channel=require('../model/channel');var statusDesc=[_0x774c('0x7'),_0x774c('0x8'),_0x774c('0x9'),'busy',_0x774c('0xa'),_0x774c('0xb'),_0x774c('0xc'),_0x774c('0xd'),_0x774c('0xe')];var applications=[_0x774c('0xf'),_0x774c('0x10'),_0x774c('0x11'),_0x774c('0x12'),_0x774c('0x13'),_0x774c('0x14')];var dispositions=[_0x774c('0x15'),_0x774c('0x16'),_0x774c('0x16'),_0x774c('0x15'),'NO\x20ANSWER',_0x774c('0x15'),'ANSWERED',_0x774c('0x17'),_0x774c('0x16'),_0x774c('0x16'),_0x774c('0x16')];var actions={};config[_0x774c('0x18')]=_[_0x774c('0x19')](config[_0x774c('0x18')],{'host':'localhost','port':0x18eb});var io=require(_0x774c('0x1a'))(new Redis(config['redis']));function VoiceCallReport(_0x29c88a){this[_0x774c('0x1b')]=_0x29c88a[_0x774c('0x1b')];this['agents']=_0x29c88a[_0x774c('0x1c')];ami['on'](_0x774c('0x1d'),this[_0x774c('0x1e')][_0x774c('0x1f')](this));ami['on'](_0x774c('0x20'),this[_0x774c('0x1e')][_0x774c('0x1f')](this));ami['on'](_0x774c('0x21'),this[_0x774c('0x22')][_0x774c('0x1f')](this));ami['on'](_0x774c('0x23'),this[_0x774c('0x24')][_0x774c('0x1f')](this));ami['on']('varset',this[_0x774c('0x25')][_0x774c('0x1f')](this));ami['on']('hangup',this[_0x774c('0x26')][_0x774c('0x1f')](this));ami['on']('newcallerid',this[_0x774c('0x27')][_0x774c('0x1f')](this));ami['on'](_0x774c('0x28'),this[_0x774c('0x29')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on'](_0x774c('0x2a'),this['syncMusicOnHoldStart'][_0x774c('0x1f')](this));ami['on'](_0x774c('0x2b'),this[_0x774c('0x2c')][_0x774c('0x1f')](this));return BPromise[_0x774c('0x2d')]()[_0x774c('0x2e')](ami[_0x774c('0x2f')]())[_0x774c('0x30')](function(_0x4ce849){console[_0x774c('0x31')](_0x4ce849);});}VoiceCallReport['prototype'][_0x774c('0x32')]=function(_0x2d853a){return _0x2d853a!==null&&!_[_0x774c('0x33')](_0x2d853a);};VoiceCallReport[_0x774c('0x34')][_0x774c('0x35')]=function(_0x521ef5,_0x53b0de,_0x58eed8){io['to'](_0x521ef5)[_0x774c('0x35')](_0x53b0de,_0x58eed8);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0xa17989){try{if(this[_0x774c('0x32')](_0xa17989)){if(_0xa17989['uniqueid']===_0xa17989[_0x774c('0x36')]){if(!_[_0x774c('0x33')](this['channels'][_0xa17989[_0x774c('0x37')]])){_[_0x774c('0x38')](this[_0x774c('0x1b')][_0xa17989[_0x774c('0x37')]],_[_0x774c('0x39')](_0xa17989,_['keys'](this[_0x774c('0x1b')][_0xa17989[_0x774c('0x37')]])));}}}}catch(_0x2dbc69){logger['error'](_0x774c('0x3a'),util[_0x774c('0x3b')](_0x2dbc69,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x774c('0x34')]['syncNewChannel']=function(_0x4045c1){try{if(this[_0x774c('0x32')](_0x4045c1)){if(_0x4045c1['uniqueid']===_0x4045c1['linkedid']&&_0x4045c1[_0x774c('0x3c')]!='OutgoingSpoolFailed'){if(_[_0x774c('0x33')](this[_0x774c('0x1b')][_0x4045c1[_0x774c('0x37')]])){this[_0x774c('0x1b')][_0x4045c1['uniqueid']]=new Channel();this[_0x774c('0x1b')][_0x4045c1['uniqueid']][_0x774c('0x3d')]=moment()['format'](_0x774c('0x3e'));this['channels'][_0x4045c1[_0x774c('0x37')]]['disposition']=dispositions[_[_0x774c('0x3f')](_0x4045c1[_0x774c('0x40')])];_[_0x774c('0x38')](this['channels'][_0x4045c1[_0x774c('0x37')]],_[_0x774c('0x39')](_0x4045c1,_[_0x774c('0x41')](this[_0x774c('0x1b')][_0x4045c1[_0x774c('0x37')]])));if(_0x4045c1[_0x774c('0x42')]==='from-sip'){if(this[_0x774c('0x1c')][_0x4045c1['channel'][_0x774c('0x43')]('-')[0x0]]){this[_0x774c('0x1c')][_0x4045c1[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]][_0x774c('0x44')]=_0x4045c1['exten'];this[_0x774c('0x35')](util[_0x774c('0x45')](_0x774c('0x46'),this['agents'][_0x4045c1[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]]['name']),_0x774c('0x47'),{'destaccountcode':this[_0x774c('0x1c')][_0x4045c1[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]][_0x774c('0x48')],'destconnectedlinenum':_0x4045c1['exten']});}}}}}}catch(_0x5d12c2){logger[_0x774c('0x49')]('[syncNewChannel][VoiceCallReport]',util[_0x774c('0x3b')](_0x5d12c2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x774c('0x34')]['syncNewExten']=function(_0x37e16c){try{if(this[_0x774c('0x32')](_0x37e16c)){if(_0x37e16c['uniqueid']===_0x37e16c[_0x774c('0x36')]&&_0x37e16c['exten']!='h'&&_0x37e16c[_0x774c('0x3c')]!=_0x774c('0x4a')){_0x37e16c['application']=_0x37e16c['application'][_0x774c('0x4b')]();_0x37e16c[_0x774c('0x4c')]=(_0x37e16c[_0x774c('0x4d')]||_0x37e16c['applicationdata'])[_0x774c('0x4b')]();if(_[_0x774c('0x33')](this[_0x774c('0x1b')][_0x37e16c['uniqueid']])){this[_0x774c('0x1b')][_0x37e16c['uniqueid']]=new Channel();this[_0x774c('0x1b')][_0x37e16c[_0x774c('0x37')]]['starttime']=_0x37e16c[_0x774c('0x4e')]?moment()[_0x774c('0x4f')](moment[_0x774c('0x4e')](_0x37e16c[_0x774c('0x4e')])[_0x774c('0x50')](),_0x774c('0x50'))[_0x774c('0x45')](_0x774c('0x3e')):moment()['format'](_0x774c('0x3e'));this['channels'][_0x37e16c['uniqueid']][_0x774c('0x51')]=_0x774c('0x15');}_['merge'](this[_0x774c('0x1b')][_0x37e16c[_0x774c('0x37')]],_[_0x774c('0x39')](_0x37e16c,_[_0x774c('0x41')](this[_0x774c('0x1b')][_0x37e16c[_0x774c('0x37')]])));if(_['includes'](applications,_0x37e16c[_0x774c('0x52')])){this[_0x774c('0x1b')][_0x37e16c[_0x774c('0x37')]][_0x774c('0x53')]=_0x37e16c['application'];this[_0x774c('0x1b')][_0x37e16c[_0x774c('0x37')]][_0x774c('0x54')]=_0x37e16c[_0x774c('0x4c')];if(_0x37e16c[_0x774c('0x52')]===_0x774c('0xf')&&_[_0x774c('0x55')](_0x37e16c[_0x774c('0x4c')],_0x774c('0x56'))){var _0x51a7e4=_0x37e16c[_0x774c('0x4c')][_0x774c('0x43')]('=');var _0x4e0273=_0x51a7e4[0x0][_0x774c('0x57')](/cdr\((.*)\)/);if(_0x4e0273){this[_0x774c('0x1b')][_0x37e16c[_0x774c('0x37')]][_0x4e0273[0x1]]=_0x51a7e4[0x1];}}else if(_0x37e16c[_0x774c('0x52')]==='queue'){this[_0x774c('0x1b')][_0x37e16c[_0x774c('0x37')]][_0x774c('0x10')]=_0x37e16c['applicationdata'][_0x774c('0x43')](',')[0x0];}}}}}catch(_0x59b839){logger[_0x774c('0x49')](_0x774c('0x58'),util[_0x774c('0x3b')](_0x59b839,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x774c('0x34')][_0x774c('0x24')]=function(_0x1d5fdb){try{if(this[_0x774c('0x32')](_0x1d5fdb)){if(_0x1d5fdb[_0x774c('0x37')]!==_0x1d5fdb['linkedid']){if(this['channels'][_0x1d5fdb[_0x774c('0x36')]]){if(_0x1d5fdb[_0x774c('0x40')]==='6'){if(!this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x36')]]['answered']){var _0x4913d5=moment();this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x36')]][_0x774c('0x59')]=!![];this['channels'][_0x1d5fdb[_0x774c('0x36')]][_0x774c('0x5a')]=_0x4913d5[_0x774c('0x45')](_0x774c('0x3e'));if(this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x36')]][_0x774c('0x3d')]){this['channels'][_0x1d5fdb['linkedid']]['holdtime']=_0x4913d5[_0x774c('0x5b')](this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x36')]]['starttime'],_0x774c('0x50'));}}this['channels'][_0x1d5fdb[_0x774c('0x36')]][_0x774c('0x36')]=_0x1d5fdb[_0x774c('0x37')];if(_0x1d5fdb[_0x774c('0x5c')]!==_0x774c('0x5d')){this['channels'][_0x1d5fdb[_0x774c('0x36')]][_0x774c('0x5e')]=_0x1d5fdb[_0x774c('0x5c')];}this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x36')]][_0x774c('0x5f')]=_0x1d5fdb[_0x774c('0x60')];this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x36')]]['destinationchannel']=_0x1d5fdb['channel'];this[_0x774c('0x1b')][_0x1d5fdb['linkedid']]['disposition']=dispositions[_['toNumber'](_0x1d5fdb['channelstate'])];if(this[_0x774c('0x1c')][_0x1d5fdb[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]]){this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x36')]][_0x774c('0x61')]=this[_0x774c('0x1c')][_0x1d5fdb[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]]['id'];this['channels'][_0x1d5fdb[_0x774c('0x36')]][_0x774c('0x62')]=this[_0x774c('0x1c')][_0x1d5fdb[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]][_0x774c('0x63')];}}}}else{if(this['channels'][_0x1d5fdb[_0x774c('0x37')]]){if(_0x1d5fdb['channelstate']==='6'){if(this[_0x774c('0x1c')][_0x1d5fdb[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]]){this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x37')]][_0x774c('0x61')]=this['agents'][_0x1d5fdb[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]]['id'];this[_0x774c('0x1b')][_0x1d5fdb[_0x774c('0x37')]][_0x774c('0x62')]=this[_0x774c('0x1c')][_0x1d5fdb['channel'][_0x774c('0x43')]('-')[0x0]]['name'];}}}}}}catch(_0x255617){logger[_0x774c('0x49')](_0x774c('0x64'),util[_0x774c('0x3b')](_0x255617,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x774c('0x34')][_0x774c('0x65')]=function(_0x15f044,_0x36c100){if(this[_0x774c('0x1b')][_0x15f044]){this[_0x774c('0x1b')][_0x15f044][_0x774c('0x66')]=!![];if(_[_0x774c('0x67')](_0x36c100,_0x774c('0x68'))){_0x36c100=_0x36c100[_0x774c('0x69')](_0x774c('0x68'),_0x774c('0x6a'));}this['channels'][_0x15f044][_0x774c('0x6b')]=_0x36c100;var _0x33dafd=_['find'](this[_0x774c('0x1b')][_0x15f044][_0x774c('0x6c')],{'filename':_0x36c100});if(_[_0x774c('0x6d')](_0x33dafd)){this[_0x774c('0x1b')][_0x15f044][_0x774c('0x6c')][_0x774c('0x6e')]({'filename':_0x36c100,'createdAt':moment()[_0x774c('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x774c('0x6f')});}}};VoiceCallReport[_0x774c('0x34')]['syncVarSet']=function(_0x1b59b9){try{if(this[_0x774c('0x32')](_0x1b59b9)){if(this[_0x774c('0x1b')][_0x1b59b9[_0x774c('0x37')]]&&_0x1b59b9[_0x774c('0x3c')]!=_0x774c('0x4a')){if(this[_0x774c('0x32')](_0x1b59b9[_0x774c('0x70')])){if(this['isNotNull'](_0x1b59b9[_0x774c('0x70')]['mixmonitor_filename'])){this[_0x774c('0x65')](_0x1b59b9['uniqueid'],_0x1b59b9[_0x774c('0x71')]);}else if(this['isNotNull'](_0x1b59b9[_0x774c('0x70')][_0x774c('0x72')])){this['channels'][_0x1b59b9[_0x774c('0x37')]]['calleridnum']=_0x1b59b9[_0x774c('0x71')];}else if(this[_0x774c('0x32')](_0x1b59b9[_0x774c('0x70')][_0x774c('0x73')])){this[_0x774c('0x1b')][_0x1b59b9[_0x774c('0x37')]][_0x774c('0x74')]=_0x1b59b9['value'];}else if(this[_0x774c('0x32')](_0x1b59b9['variable'][_0x774c('0x75')])){this['channels'][_0x1b59b9[_0x774c('0x37')]][_0x774c('0x76')]=_0x1b59b9[_0x774c('0x71')];}else if(this[_0x774c('0x32')](_0x1b59b9[_0x774c('0x70')]['xmd-queue'])){this[_0x774c('0x1b')][_0x1b59b9[_0x774c('0x37')]][_0x774c('0x10')]=_0x1b59b9[_0x774c('0x71')][_0x774c('0x43')](',')[0x0];}else if(this[_0x774c('0x32')](_0x1b59b9[_0x774c('0x70')][_0x774c('0x77')])){this[_0x774c('0x1b')][_0x1b59b9['uniqueid']][_0x774c('0x78')]=_0x1b59b9['value'];}else if(this[_0x774c('0x32')](_0x1b59b9[_0x774c('0x70')]['xmd-destination'])){this[_0x774c('0x1b')][_0x1b59b9['uniqueid']]['destination']=_0x1b59b9[_0x774c('0x71')];}else if(this[_0x774c('0x32')](_0x1b59b9[_0x774c('0x70')][_0x774c('0x79')])){this[_0x774c('0x1b')][_0x1b59b9[_0x774c('0x37')]]['calleridpreview']=_0x1b59b9[_0x774c('0x71')];}else if(this[_0x774c('0x32')](_0x1b59b9[_0x774c('0x70')]['xmcs-queue'])){this[_0x774c('0x1b')][_0x1b59b9[_0x774c('0x37')]][_0x774c('0x10')]=_0x1b59b9[_0x774c('0x71')];}else if(this['isNotNull'](_0x1b59b9['variable'][_0x774c('0x7a')])){this[_0x774c('0x1b')][_0x1b59b9['uniqueid']][_0x774c('0x7b')]=_0x1b59b9[_0x774c('0x71')];}}}else if(this[_0x774c('0x32')](_0x1b59b9['variable'][_0x774c('0x7c')])){if(_0x1b59b9[_0x774c('0x71')]){var _0x147b9c=path[_0x774c('0x7d')](_0x1b59b9[_0x774c('0x71')])['name'];this[_0x774c('0x65')](_0x147b9c,_0x1b59b9[_0x774c('0x71')]);}}else if(this[_0x774c('0x1b')][_0x1b59b9['linkedid']]){if(this[_0x774c('0x32')](_0x1b59b9['variable'])){if(this[_0x774c('0x32')](_0x1b59b9['variable'][_0x774c('0x7a')])){this[_0x774c('0x1b')][_0x1b59b9[_0x774c('0x36')]]['sipcalllinkedid']=_0x1b59b9[_0x774c('0x71')];}}}}}catch(_0x524e7f){logger[_0x774c('0x49')]('[syncVarSet][VoiceCallReport]',util[_0x774c('0x3b')](_0x524e7f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x774c('0x34')][_0x774c('0x26')]=function(_0x3e3e26){try{if(this[_0x774c('0x32')](_0x3e3e26)){if(this[_0x774c('0x1b')][_0x3e3e26[_0x774c('0x37')]]){var _0x27fa84=moment();this['channels'][_0x3e3e26[_0x774c('0x37')]][_0x774c('0x7e')]=_0x27fa84[_0x774c('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x774c('0x1b')][_0x3e3e26[_0x774c('0x37')]][_0x774c('0x4e')]=_0x27fa84[_0x774c('0x5b')](this[_0x774c('0x1b')][_0x3e3e26[_0x774c('0x37')]][_0x774c('0x3d')],_0x774c('0x50'));if(this[_0x774c('0x1b')][_0x3e3e26['uniqueid']]['answered']){this[_0x774c('0x1b')][_0x3e3e26[_0x774c('0x37')]]['billableseconds']=_0x27fa84[_0x774c('0x5b')](this[_0x774c('0x1b')][_0x3e3e26['uniqueid']][_0x774c('0x5a')],_0x774c('0x50'));this[_0x774c('0x1b')][_0x3e3e26['uniqueid']][_0x774c('0x7f')]=this[_0x774c('0x1b')][_0x3e3e26[_0x774c('0x37')]][_0x774c('0x4e')]-this['channels'][_0x3e3e26['uniqueid']][_0x774c('0x80')];}if(_0x3e3e26[_0x774c('0x42')]===_0x774c('0x81')){if(this[_0x774c('0x1c')][_0x3e3e26[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]]){this[_0x774c('0x1c')][_0x3e3e26[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]]=_[_0x774c('0x82')](this[_0x774c('0x1c')][_0x3e3e26[_0x774c('0x3c')]['split']('-')[0x0]],[_0x774c('0x44')]);this[_0x774c('0x35')](util['format'](_0x774c('0x46'),this[_0x774c('0x1c')][_0x3e3e26['channel'][_0x774c('0x43')]('-')[0x0]][_0x774c('0x63')]),_0x774c('0x83'),{'destaccountcode':this[_0x774c('0x1c')][_0x3e3e26[_0x774c('0x3c')][_0x774c('0x43')]('-')[0x0]][_0x774c('0x48')]});}}ami[_0x774c('0x35')](_0x774c('0x84'),this[_0x774c('0x1b')][_0x3e3e26[_0x774c('0x37')]]);delete this[_0x774c('0x1b')][_0x3e3e26[_0x774c('0x37')]];}}}catch(_0x294f2d){logger['error'](_0x774c('0x85'),util[_0x774c('0x3b')](_0x294f2d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x774c('0x29')]=function(_0xecd84f){try{if(this['isNotNull'](_0xecd84f)){if(this[_0x774c('0x1b')][_0xecd84f[_0x774c('0x86')]]){this[_0x774c('0x1b')][_0xecd84f['transfereeuniqueid']][_0x774c('0x87')]=_0xecd84f['origtransferercalleridnum'];this[_0x774c('0x1b')][_0xecd84f[_0x774c('0x86')]]['transferconnectedlinenum']=_0xecd84f[_0x774c('0x88')];if(this[_0x774c('0x1b')][_0xecd84f['secondtransfereruniqueid']]){var _0x29fb43=this['channels'][_0xecd84f['secondtransfereruniqueid']];this[_0x774c('0x1b')][_0xecd84f['secondtransfereruniqueid']]=this[_0x774c('0x1b')][_0xecd84f[_0x774c('0x86')]];this[_0x774c('0x1b')][_0xecd84f['transfereeuniqueid']]=_0x29fb43;}}else if(this[_0x774c('0x1b')][_0xecd84f[_0x774c('0x89')]]){this[_0x774c('0x1b')][_0xecd84f['transfertargetuniqueid']][_0x774c('0x87')]=_0xecd84f[_0x774c('0x8a')];this['channels'][_0xecd84f[_0x774c('0x89')]][_0x774c('0x8b')]=_0xecd84f[_0x774c('0x88')];if(this[_0x774c('0x1b')][_0xecd84f['origtransfereruniqueid']]){var _0x29fb43=this[_0x774c('0x1b')][_0xecd84f['origtransfereruniqueid']];this[_0x774c('0x1b')][_0xecd84f[_0x774c('0x8c')]]=this[_0x774c('0x1b')][_0xecd84f['transfertargetuniqueid']];this[_0x774c('0x1b')][_0xecd84f[_0x774c('0x89')]]=_0x29fb43;}}}}catch(_0x35e3c5){logger['error'](_0x774c('0x8d'),util[_0x774c('0x3b')](_0x35e3c5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x774c('0x34')]['syncBlindTransfer']=function(_0x3bc8c8){try{if(this[_0x774c('0x32')](_0x3bc8c8)){if(this[_0x774c('0x1b')][_0x3bc8c8[_0x774c('0x86')]]){this[_0x774c('0x1b')][_0x3bc8c8[_0x774c('0x86')]][_0x774c('0x87')]=_0x3bc8c8['transfereecalleridnum'];this[_0x774c('0x1b')][_0x3bc8c8[_0x774c('0x86')]][_0x774c('0x8b')]=_0x3bc8c8[_0x774c('0x8e')];this[_0x774c('0x26')]({'event':_0x774c('0x8f'),'uniqueid':_0x3bc8c8[_0x774c('0x86')],'context':_0x3bc8c8[_0x774c('0x42')],'channel':_0x3bc8c8['transfererchannel']});}}}catch(_0xd86002){logger['error'](_0x774c('0x90'),util[_0x774c('0x3b')](_0xd86002,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x774c('0x34')][_0x774c('0x91')]=function(_0x43df48){try{if(this[_0x774c('0x32')](_0x43df48)){if(this[_0x774c('0x1b')][_0x43df48[_0x774c('0x37')]]){if(!_[_0x774c('0x6d')](this[_0x774c('0x1b')][_0x43df48['uniqueid']][_0x774c('0x5a')])){this[_0x774c('0x1b')][_0x43df48[_0x774c('0x37')]][_0x774c('0x92')]=moment()[_0x774c('0x45')](_0x774c('0x3e'));}}}}catch(_0x1c2aee){logger[_0x774c('0x49')](_0x774c('0x93'),util[_0x774c('0x3b')](_0x1c2aee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x774c('0x34')][_0x774c('0x2c')]=function(_0x481084){try{if(this['isNotNull'](_0x481084)){if(this[_0x774c('0x1b')][_0x481084[_0x774c('0x37')]]){if(!_[_0x774c('0x6d')](this[_0x774c('0x1b')][_0x481084[_0x774c('0x37')]]['mohstarttime'])){this[_0x774c('0x1b')][_0x481084[_0x774c('0x37')]][_0x774c('0x94')]+=moment()['milliseconds'](0x0)['diff'](this[_0x774c('0x1b')][_0x481084[_0x774c('0x37')]][_0x774c('0x92')],_0x774c('0x50'));delete this['channels'][_0x481084[_0x774c('0x37')]][_0x774c('0x92')];}}}}catch(_0x40c083){logger[_0x774c('0x49')](_0x774c('0x95'),util[_0x774c('0x3b')](_0x40c083,{'showHidden':![],'depth':null}));}};module[_0x774c('0x96')]=VoiceCallReport; \ No newline at end of file +var _0xe8a4=['xmd-queue','queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','xmd-callerid-preview','xmcs-queue','sipcallid','sipcalluniqueid','mixmonitor_filename','parse','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','context','omit','destconnectedlinenum','user:agentcomplete','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereecalleridnum','extension','syncHangup','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','moment','path','ioredis','../../../config/environment','ami','../ami','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','then','actionCoreShowChannels','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','pick','keys','error','channel','OutgoingSpoolFailed','format','disposition','toNumber','from-sip','split','user:%s','name','user:agentconnect','exten','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','applicationdata','appdata','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','channelstate','answered','answertime','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','membername','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','replace','monitorFilename','find','monitors','isNil','push','rec','value','variable','xmd-callerid','callerid','xmd-cdrtype','type'];(function(_0x3e940b,_0x26da84){var _0x3d9a81=function(_0x56e9ba){while(--_0x56e9ba){_0x3e940b['push'](_0x3e940b['shift']());}};_0x3d9a81(++_0x26da84);}(_0xe8a4,0x158));var _0x4e8a=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xe8a4[_0x54d4a8];return _0x3b321b;};'use strict';var BPromise=require(_0x4e8a('0x0'));var _=require('lodash');var moment=require(_0x4e8a('0x1'));var util=require('util');var path=require(_0x4e8a('0x2'));var Redis=require(_0x4e8a('0x3'));var config=require(_0x4e8a('0x4'));var logger=require('../../../config/logger')(_0x4e8a('0x5'));var ami=require(_0x4e8a('0x6'));var Channel=require('../model/channel');var statusDesc=[_0x4e8a('0x7'),_0x4e8a('0x8'),_0x4e8a('0x9'),_0x4e8a('0xa'),_0x4e8a('0xb'),_0x4e8a('0xc'),_0x4e8a('0xd'),_0x4e8a('0xe'),_0x4e8a('0xf')];var applications=[_0x4e8a('0x10'),'queue',_0x4e8a('0x11'),_0x4e8a('0x12'),_0x4e8a('0x13'),_0x4e8a('0x14')];var dispositions=['NO\x20ANSWER',_0x4e8a('0x15'),_0x4e8a('0x15'),'NO\x20ANSWER',_0x4e8a('0x16'),_0x4e8a('0x16'),_0x4e8a('0x17'),_0x4e8a('0x18'),'FAILED',_0x4e8a('0x15'),'FAILED'];var actions={};config[_0x4e8a('0x19')]=_[_0x4e8a('0x1a')](config[_0x4e8a('0x19')],{'host':'localhost','port':0x18eb});var io=require(_0x4e8a('0x1b'))(new Redis(config['redis']));function VoiceCallReport(_0x3eaf56){this[_0x4e8a('0x1c')]=_0x3eaf56[_0x4e8a('0x1c')];this['agents']=_0x3eaf56[_0x4e8a('0x1d')];ami['on'](_0x4e8a('0x1e'),this[_0x4e8a('0x1f')][_0x4e8a('0x20')](this));ami['on']('newexten',this[_0x4e8a('0x1f')]['bind'](this));ami['on'](_0x4e8a('0x21'),this[_0x4e8a('0x22')][_0x4e8a('0x20')](this));ami['on'](_0x4e8a('0x23'),this[_0x4e8a('0x24')][_0x4e8a('0x20')](this));ami['on'](_0x4e8a('0x25'),this[_0x4e8a('0x26')][_0x4e8a('0x20')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x4e8a('0x27'),this[_0x4e8a('0x28')][_0x4e8a('0x20')](this));ami['on'](_0x4e8a('0x29'),this[_0x4e8a('0x2a')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on'](_0x4e8a('0x2b'),this[_0x4e8a('0x2c')][_0x4e8a('0x20')](this));ami['on']('musiconholdstop',this[_0x4e8a('0x2d')][_0x4e8a('0x20')](this));return BPromise['resolve']()[_0x4e8a('0x2e')](ami[_0x4e8a('0x2f')]())['catch'](function(_0x1c6598){console['log'](_0x1c6598);});}VoiceCallReport[_0x4e8a('0x30')][_0x4e8a('0x31')]=function(_0x3a9d32){return _0x3a9d32!==null&&!_[_0x4e8a('0x32')](_0x3a9d32);};VoiceCallReport['prototype']['emit']=function(_0x27a048,_0x31bbe1,_0x5a71e3){io['to'](_0x27a048)[_0x4e8a('0x33')](_0x31bbe1,_0x5a71e3);};VoiceCallReport['prototype'][_0x4e8a('0x28')]=function(_0x5766c5){try{if(this[_0x4e8a('0x31')](_0x5766c5)){if(_0x5766c5[_0x4e8a('0x34')]===_0x5766c5[_0x4e8a('0x35')]){if(!_[_0x4e8a('0x32')](this[_0x4e8a('0x1c')][_0x5766c5['uniqueid']])){_['merge'](this['channels'][_0x5766c5[_0x4e8a('0x34')]],_[_0x4e8a('0x36')](_0x5766c5,_[_0x4e8a('0x37')](this['channels'][_0x5766c5[_0x4e8a('0x34')]])));}}}}catch(_0x5a85a0){logger[_0x4e8a('0x38')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x5a85a0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x2be564){try{if(this[_0x4e8a('0x31')](_0x2be564)){if(_0x2be564[_0x4e8a('0x34')]===_0x2be564[_0x4e8a('0x35')]&&_0x2be564[_0x4e8a('0x39')]!=_0x4e8a('0x3a')){if(_[_0x4e8a('0x32')](this[_0x4e8a('0x1c')][_0x2be564['uniqueid']])){this[_0x4e8a('0x1c')][_0x2be564['uniqueid']]=new Channel();this[_0x4e8a('0x1c')][_0x2be564[_0x4e8a('0x34')]]['starttime']=moment()[_0x4e8a('0x3b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4e8a('0x1c')][_0x2be564[_0x4e8a('0x34')]][_0x4e8a('0x3c')]=dispositions[_[_0x4e8a('0x3d')](_0x2be564['channelstate'])];_['merge'](this['channels'][_0x2be564[_0x4e8a('0x34')]],_['pick'](_0x2be564,_[_0x4e8a('0x37')](this[_0x4e8a('0x1c')][_0x2be564[_0x4e8a('0x34')]])));if(_0x2be564['context']===_0x4e8a('0x3e')){if(this[_0x4e8a('0x1d')][_0x2be564[_0x4e8a('0x39')][_0x4e8a('0x3f')]('-')[0x0]]){this[_0x4e8a('0x1d')][_0x2be564[_0x4e8a('0x39')]['split']('-')[0x0]]['destconnectedlinenum']=_0x2be564['exten'];this[_0x4e8a('0x33')](util[_0x4e8a('0x3b')](_0x4e8a('0x40'),this[_0x4e8a('0x1d')][_0x2be564[_0x4e8a('0x39')][_0x4e8a('0x3f')]('-')[0x0]][_0x4e8a('0x41')]),_0x4e8a('0x42'),{'destaccountcode':this['agents'][_0x2be564['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2be564[_0x4e8a('0x43')]});}}}}}}catch(_0x4fe83b){logger[_0x4e8a('0x38')](_0x4e8a('0x44'),util[_0x4e8a('0x45')](_0x4fe83b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4e8a('0x1f')]=function(_0x41104e){try{if(this['isNotNull'](_0x41104e)){if(_0x41104e[_0x4e8a('0x34')]===_0x41104e[_0x4e8a('0x35')]&&_0x41104e['exten']!='h'&&_0x41104e['channel']!=_0x4e8a('0x3a')){_0x41104e[_0x4e8a('0x46')]=_0x41104e['application'][_0x4e8a('0x47')]();_0x41104e[_0x4e8a('0x48')]=(_0x41104e[_0x4e8a('0x49')]||_0x41104e[_0x4e8a('0x48')])[_0x4e8a('0x47')]();if(_[_0x4e8a('0x32')](this['channels'][_0x41104e[_0x4e8a('0x34')]])){this['channels'][_0x41104e[_0x4e8a('0x34')]]=new Channel();this[_0x4e8a('0x1c')][_0x41104e['uniqueid']][_0x4e8a('0x4a')]=_0x41104e[_0x4e8a('0x4b')]?moment()[_0x4e8a('0x4c')](moment[_0x4e8a('0x4b')](_0x41104e[_0x4e8a('0x4b')])[_0x4e8a('0x4d')](),_0x4e8a('0x4d'))['format'](_0x4e8a('0x4e')):moment()['format'](_0x4e8a('0x4e'));this['channels'][_0x41104e[_0x4e8a('0x34')]][_0x4e8a('0x3c')]=_0x4e8a('0x16');}_['merge'](this[_0x4e8a('0x1c')][_0x41104e['uniqueid']],_['pick'](_0x41104e,_[_0x4e8a('0x37')](this[_0x4e8a('0x1c')][_0x41104e['uniqueid']])));if(_['includes'](applications,_0x41104e['application'])){this[_0x4e8a('0x1c')][_0x41104e[_0x4e8a('0x34')]][_0x4e8a('0x4f')]=_0x41104e[_0x4e8a('0x46')];this[_0x4e8a('0x1c')][_0x41104e['uniqueid']][_0x4e8a('0x50')]=_0x41104e['applicationdata'];if(_0x41104e['application']===_0x4e8a('0x10')&&_[_0x4e8a('0x51')](_0x41104e[_0x4e8a('0x48')],_0x4e8a('0x52'))){var _0x20b0d2=_0x41104e[_0x4e8a('0x48')][_0x4e8a('0x3f')]('=');var _0x11eb98=_0x20b0d2[0x0][_0x4e8a('0x53')](/cdr\((.*)\)/);if(_0x11eb98){this[_0x4e8a('0x1c')][_0x41104e[_0x4e8a('0x34')]][_0x11eb98[0x1]]=_0x20b0d2[0x1];}}else if(_0x41104e[_0x4e8a('0x46')]==='queue'){this[_0x4e8a('0x1c')][_0x41104e[_0x4e8a('0x34')]]['queue']=_0x41104e[_0x4e8a('0x48')][_0x4e8a('0x3f')](',')[0x0];}}}}}catch(_0x434631){logger['error'](_0x4e8a('0x54'),util[_0x4e8a('0x45')](_0x434631,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4e8a('0x30')][_0x4e8a('0x24')]=function(_0xf92b28){try{if(this['isNotNull'](_0xf92b28)){if(_0xf92b28[_0x4e8a('0x34')]!==_0xf92b28[_0x4e8a('0x35')]){if(this[_0x4e8a('0x1c')][_0xf92b28[_0x4e8a('0x35')]]){if(_0xf92b28[_0x4e8a('0x55')]==='6'){if(!this[_0x4e8a('0x1c')][_0xf92b28['linkedid']][_0x4e8a('0x56')]){var _0x1d8719=moment();this[_0x4e8a('0x1c')][_0xf92b28['linkedid']][_0x4e8a('0x56')]=!![];this[_0x4e8a('0x1c')][_0xf92b28[_0x4e8a('0x35')]][_0x4e8a('0x57')]=_0x1d8719[_0x4e8a('0x3b')](_0x4e8a('0x4e'));if(this[_0x4e8a('0x1c')][_0xf92b28['linkedid']][_0x4e8a('0x4a')]){this[_0x4e8a('0x1c')][_0xf92b28[_0x4e8a('0x35')]]['holdtime']=_0x1d8719['diff'](this['channels'][_0xf92b28[_0x4e8a('0x35')]][_0x4e8a('0x4a')],_0x4e8a('0x4d'));}}this['channels'][_0xf92b28['linkedid']][_0x4e8a('0x35')]=_0xf92b28['uniqueid'];if(_0xf92b28['calleridnum']!==_0x4e8a('0x58')){this[_0x4e8a('0x1c')][_0xf92b28['linkedid']][_0x4e8a('0x59')]=_0xf92b28[_0x4e8a('0x5a')];}this[_0x4e8a('0x1c')][_0xf92b28[_0x4e8a('0x35')]][_0x4e8a('0x5b')]=_0xf92b28[_0x4e8a('0x5c')];this['channels'][_0xf92b28[_0x4e8a('0x35')]][_0x4e8a('0x5d')]=_0xf92b28[_0x4e8a('0x39')];this['channels'][_0xf92b28['linkedid']][_0x4e8a('0x3c')]=dispositions[_[_0x4e8a('0x3d')](_0xf92b28[_0x4e8a('0x55')])];if(this[_0x4e8a('0x1d')][_0xf92b28[_0x4e8a('0x39')][_0x4e8a('0x3f')]('-')[0x0]]){this['channels'][_0xf92b28[_0x4e8a('0x35')]]['UserId']=this[_0x4e8a('0x1d')][_0xf92b28[_0x4e8a('0x39')][_0x4e8a('0x3f')]('-')[0x0]]['id'];this['channels'][_0xf92b28['linkedid']][_0x4e8a('0x5e')]=this[_0x4e8a('0x1d')][_0xf92b28['channel'][_0x4e8a('0x3f')]('-')[0x0]][_0x4e8a('0x41')];}}}}else{if(this[_0x4e8a('0x1c')][_0xf92b28['uniqueid']]){if(_0xf92b28['channelstate']==='6'){if(this['agents'][_0xf92b28['channel']['split']('-')[0x0]]){this['channels'][_0xf92b28[_0x4e8a('0x34')]][_0x4e8a('0x5f')]=this[_0x4e8a('0x1d')][_0xf92b28[_0x4e8a('0x39')]['split']('-')[0x0]]['id'];this[_0x4e8a('0x1c')][_0xf92b28[_0x4e8a('0x34')]][_0x4e8a('0x5e')]=this[_0x4e8a('0x1d')][_0xf92b28[_0x4e8a('0x39')][_0x4e8a('0x3f')]('-')[0x0]][_0x4e8a('0x41')];}}}}}}catch(_0x182c57){logger['error'](_0x4e8a('0x60'),util[_0x4e8a('0x45')](_0x182c57,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4e8a('0x30')][_0x4e8a('0x61')]=function(_0x19c96f,_0x24e88e){if(this[_0x4e8a('0x1c')][_0x19c96f]){this['channels'][_0x19c96f][_0x4e8a('0x62')]=!![];if(_['endsWith'](_0x24e88e,'.wav49')){_0x24e88e=_0x24e88e[_0x4e8a('0x63')]('.wav49','.WAV');}this[_0x4e8a('0x1c')][_0x19c96f][_0x4e8a('0x64')]=_0x24e88e;var _0x3c34a3=_[_0x4e8a('0x65')](this[_0x4e8a('0x1c')][_0x19c96f][_0x4e8a('0x66')],{'filename':_0x24e88e});if(_[_0x4e8a('0x67')](_0x3c34a3)){this['channels'][_0x19c96f][_0x4e8a('0x66')][_0x4e8a('0x68')]({'filename':_0x24e88e,'createdAt':moment()[_0x4e8a('0x3b')](_0x4e8a('0x4e')),'mixmonitorid':'','status':_0x4e8a('0x69')});}}};VoiceCallReport[_0x4e8a('0x30')][_0x4e8a('0x26')]=function(_0x1134fa){try{if(this[_0x4e8a('0x31')](_0x1134fa)){if(this[_0x4e8a('0x1c')][_0x1134fa[_0x4e8a('0x34')]]&&_0x1134fa['channel']!=_0x4e8a('0x3a')){if(this['isNotNull'](_0x1134fa['variable'])){if(this[_0x4e8a('0x31')](_0x1134fa['variable']['mixmonitor_filename'])){this[_0x4e8a('0x61')](_0x1134fa[_0x4e8a('0x34')],_0x1134fa[_0x4e8a('0x6a')]);}else if(this['isNotNull'](_0x1134fa[_0x4e8a('0x6b')]['xmd-phone'])){this[_0x4e8a('0x1c')][_0x1134fa[_0x4e8a('0x34')]][_0x4e8a('0x5a')]=_0x1134fa['value'];}else if(this[_0x4e8a('0x31')](_0x1134fa[_0x4e8a('0x6b')][_0x4e8a('0x6c')])){this[_0x4e8a('0x1c')][_0x1134fa[_0x4e8a('0x34')]][_0x4e8a('0x6d')]=_0x1134fa[_0x4e8a('0x6a')];}else if(this['isNotNull'](_0x1134fa[_0x4e8a('0x6b')][_0x4e8a('0x6e')])){this[_0x4e8a('0x1c')][_0x1134fa[_0x4e8a('0x34')]][_0x4e8a('0x6f')]=_0x1134fa[_0x4e8a('0x6a')];}else if(this['isNotNull'](_0x1134fa['variable'][_0x4e8a('0x70')])){this['channels'][_0x1134fa[_0x4e8a('0x34')]][_0x4e8a('0x71')]=_0x1134fa[_0x4e8a('0x6a')][_0x4e8a('0x3f')](',')[0x0];}else if(this[_0x4e8a('0x31')](_0x1134fa['variable'][_0x4e8a('0x72')])){this[_0x4e8a('0x1c')][_0x1134fa[_0x4e8a('0x34')]][_0x4e8a('0x73')]=_0x1134fa[_0x4e8a('0x6a')];}else if(this[_0x4e8a('0x31')](_0x1134fa['variable'][_0x4e8a('0x74')])){this[_0x4e8a('0x1c')][_0x1134fa[_0x4e8a('0x34')]]['destination']=_0x1134fa[_0x4e8a('0x6a')];}else if(this[_0x4e8a('0x31')](_0x1134fa[_0x4e8a('0x6b')][_0x4e8a('0x75')])){this[_0x4e8a('0x1c')][_0x1134fa[_0x4e8a('0x34')]]['calleridpreview']=_0x1134fa[_0x4e8a('0x6a')];}else if(this[_0x4e8a('0x31')](_0x1134fa[_0x4e8a('0x6b')][_0x4e8a('0x76')])){this[_0x4e8a('0x1c')][_0x1134fa['uniqueid']][_0x4e8a('0x71')]=_0x1134fa['value'];}else if(this[_0x4e8a('0x31')](_0x1134fa[_0x4e8a('0x6b')][_0x4e8a('0x77')])){this[_0x4e8a('0x1c')][_0x1134fa['uniqueid']][_0x4e8a('0x78')]=_0x1134fa[_0x4e8a('0x6a')];}}}else if(this['isNotNull'](_0x1134fa[_0x4e8a('0x6b')][_0x4e8a('0x79')])){if(_0x1134fa['value']){var _0x1260b8=path[_0x4e8a('0x7a')](_0x1134fa['value'])[_0x4e8a('0x41')];this[_0x4e8a('0x61')](_0x1260b8,_0x1134fa[_0x4e8a('0x6a')]);}}else if(this[_0x4e8a('0x1c')][_0x1134fa[_0x4e8a('0x35')]]){if(this[_0x4e8a('0x31')](_0x1134fa[_0x4e8a('0x6b')])){if(this[_0x4e8a('0x31')](_0x1134fa['variable'][_0x4e8a('0x77')])){this['channels'][_0x1134fa['linkedid']]['sipcalllinkedid']=_0x1134fa['value'];}}}}}catch(_0x186c68){logger[_0x4e8a('0x38')](_0x4e8a('0x7b'),util[_0x4e8a('0x45')](_0x186c68,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4e8a('0x30')]['syncHangup']=function(_0x36a7ca){try{if(this[_0x4e8a('0x31')](_0x36a7ca)){if(this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]]){var _0x47a725=moment();this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]][_0x4e8a('0x7c')]=_0x47a725[_0x4e8a('0x3b')](_0x4e8a('0x4e'));this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]]['duration']=_0x47a725[_0x4e8a('0x7d')](this[_0x4e8a('0x1c')][_0x36a7ca['uniqueid']]['starttime'],_0x4e8a('0x4d'));if(this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]][_0x4e8a('0x56')]){this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]][_0x4e8a('0x7e')]=_0x47a725[_0x4e8a('0x7d')](this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]][_0x4e8a('0x57')],_0x4e8a('0x4d'));this[_0x4e8a('0x1c')][_0x36a7ca['uniqueid']]['holdtime']=this['channels'][_0x36a7ca['uniqueid']]['duration']-this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]][_0x4e8a('0x7e')];}if(_0x36a7ca[_0x4e8a('0x7f')]===_0x4e8a('0x3e')){if(this[_0x4e8a('0x1d')][_0x36a7ca[_0x4e8a('0x39')][_0x4e8a('0x3f')]('-')[0x0]]){this[_0x4e8a('0x1d')][_0x36a7ca['channel']['split']('-')[0x0]]=_[_0x4e8a('0x80')](this[_0x4e8a('0x1d')][_0x36a7ca[_0x4e8a('0x39')][_0x4e8a('0x3f')]('-')[0x0]],[_0x4e8a('0x81')]);this[_0x4e8a('0x33')](util[_0x4e8a('0x3b')](_0x4e8a('0x40'),this[_0x4e8a('0x1d')][_0x36a7ca['channel'][_0x4e8a('0x3f')]('-')[0x0]][_0x4e8a('0x41')]),_0x4e8a('0x82'),{'destaccountcode':this[_0x4e8a('0x1d')][_0x36a7ca[_0x4e8a('0x39')][_0x4e8a('0x3f')]('-')[0x0]][_0x4e8a('0x83')]});}}ami[_0x4e8a('0x33')](_0x4e8a('0x84'),this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]]);delete this[_0x4e8a('0x1c')][_0x36a7ca[_0x4e8a('0x34')]];}}}catch(_0x4f975a){logger[_0x4e8a('0x38')](_0x4e8a('0x85'),util[_0x4e8a('0x45')](_0x4f975a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4e8a('0x30')][_0x4e8a('0x2a')]=function(_0x59f31b){try{if(this['isNotNull'](_0x59f31b)){if(this[_0x4e8a('0x1c')][_0x59f31b[_0x4e8a('0x86')]]){this['channels'][_0x59f31b[_0x4e8a('0x86')]][_0x4e8a('0x87')]=_0x59f31b[_0x4e8a('0x88')];this[_0x4e8a('0x1c')][_0x59f31b[_0x4e8a('0x86')]][_0x4e8a('0x89')]=_0x59f31b[_0x4e8a('0x8a')];if(this['channels'][_0x59f31b['secondtransfereruniqueid']]){var _0x31f050=this[_0x4e8a('0x1c')][_0x59f31b['secondtransfereruniqueid']];this[_0x4e8a('0x1c')][_0x59f31b['secondtransfereruniqueid']]=this['channels'][_0x59f31b[_0x4e8a('0x86')]];this['channels'][_0x59f31b[_0x4e8a('0x86')]]=_0x31f050;}}else if(this['channels'][_0x59f31b[_0x4e8a('0x8b')]]){this['channels'][_0x59f31b[_0x4e8a('0x8b')]]['transfercalleridnum']=_0x59f31b[_0x4e8a('0x88')];this[_0x4e8a('0x1c')][_0x59f31b[_0x4e8a('0x8b')]][_0x4e8a('0x89')]=_0x59f31b[_0x4e8a('0x8a')];if(this[_0x4e8a('0x1c')][_0x59f31b[_0x4e8a('0x8c')]]){var _0x31f050=this[_0x4e8a('0x1c')][_0x59f31b[_0x4e8a('0x8c')]];this[_0x4e8a('0x1c')][_0x59f31b['origtransfereruniqueid']]=this[_0x4e8a('0x1c')][_0x59f31b[_0x4e8a('0x8b')]];this[_0x4e8a('0x1c')][_0x59f31b[_0x4e8a('0x8b')]]=_0x31f050;}}}}catch(_0x25df7c){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util[_0x4e8a('0x45')](_0x25df7c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4e8a('0x8d')]=function(_0x5253fe){try{if(this[_0x4e8a('0x31')](_0x5253fe)){if(this[_0x4e8a('0x1c')][_0x5253fe[_0x4e8a('0x86')]]){this[_0x4e8a('0x1c')][_0x5253fe[_0x4e8a('0x86')]][_0x4e8a('0x87')]=_0x5253fe[_0x4e8a('0x8e')];this[_0x4e8a('0x1c')][_0x5253fe[_0x4e8a('0x86')]][_0x4e8a('0x89')]=_0x5253fe[_0x4e8a('0x8f')];this[_0x4e8a('0x90')]({'event':_0x4e8a('0x91'),'uniqueid':_0x5253fe[_0x4e8a('0x86')],'context':_0x5253fe[_0x4e8a('0x7f')],'channel':_0x5253fe[_0x4e8a('0x92')]});}}}catch(_0x2f24a1){logger['error'](_0x4e8a('0x93'),util[_0x4e8a('0x45')](_0x2f24a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4e8a('0x30')]['syncMusicOnHoldStart']=function(_0x1627ef){try{if(this[_0x4e8a('0x31')](_0x1627ef)){if(this[_0x4e8a('0x1c')][_0x1627ef[_0x4e8a('0x34')]]){if(!_[_0x4e8a('0x67')](this[_0x4e8a('0x1c')][_0x1627ef[_0x4e8a('0x34')]][_0x4e8a('0x57')])){this['channels'][_0x1627ef['uniqueid']][_0x4e8a('0x94')]=moment()['format'](_0x4e8a('0x4e'));}}}}catch(_0x5c0245){logger[_0x4e8a('0x38')](_0x4e8a('0x95'),util[_0x4e8a('0x45')](_0x5c0245,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4e8a('0x30')][_0x4e8a('0x2d')]=function(_0x5ed29c){try{if(this[_0x4e8a('0x31')](_0x5ed29c)){if(this[_0x4e8a('0x1c')][_0x5ed29c['uniqueid']]){if(!_[_0x4e8a('0x67')](this[_0x4e8a('0x1c')][_0x5ed29c[_0x4e8a('0x34')]][_0x4e8a('0x94')])){this[_0x4e8a('0x1c')][_0x5ed29c[_0x4e8a('0x34')]]['mohtime']+=moment()[_0x4e8a('0x96')](0x0)['diff'](this['channels'][_0x5ed29c[_0x4e8a('0x34')]][_0x4e8a('0x94')],_0x4e8a('0x4d'));delete this[_0x4e8a('0x1c')][_0x5ed29c[_0x4e8a('0x34')]][_0x4e8a('0x94')];}}}}catch(_0x670c28){logger[_0x4e8a('0x38')](_0x4e8a('0x97'),util[_0x4e8a('0x45')](_0x670c28,{'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 9b91a44..8d1df9d 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 _0x92f0=['starttime','sumHoldTime','sumBillable','billableseconds','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','stringify','voice_outbound_channel:remove','moment','util','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','outbound','variables','syncDialBegin','dialend','syncDialEnd','bind','syncVarSet','hangup','syncHangup','isNotNull','prototype','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','voice:outbound','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','addVariable','keys','value','variable','outboundrouteid','isUndefined','voice_outbound_channel:save','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','endtime','duration','diff','seconds','complete','total','answertime','answered','holdtime'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x92f0,0x10d));var _0x092f=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0x92f0[_0x281e5e];return _0x5a22d2;};'use strict';var _=require('lodash');var moment=require(_0x092f('0x0'));var util=require(_0x092f('0x1'));var Redis=require('ioredis');var config=require(_0x092f('0x2'));var logger=require(_0x092f('0x3'))('ami');var ami=require('../ami');config[_0x092f('0x4')]=_[_0x092f('0x5')](config[_0x092f('0x4')],{'host':_0x092f('0x6'),'port':0x18eb});var io=require(_0x092f('0x7'))(new Redis(config[_0x092f('0x4')]));function VoiceDialReport(_0x5b5741){this[_0x092f('0x8')]=_0x5b5741['outboundChannels'];this[_0x092f('0x9')]=_0x5b5741['outbound'];this[_0x092f('0xa')]={};ami['on']('dialbegin',this[_0x092f('0xb')]['bind'](this));ami['on'](_0x092f('0xc'),this[_0x092f('0xd')][_0x092f('0xe')](this));ami['on']('varset',this[_0x092f('0xf')][_0x092f('0xe')](this));ami['on'](_0x092f('0x10'),this[_0x092f('0x11')][_0x092f('0xe')](this));}VoiceDialReport['prototype'][_0x092f('0x12')]=function(_0x3e9305){return _0x3e9305!==null&&!_['isUndefined'](_0x3e9305);};VoiceDialReport[_0x092f('0x13')][_0x092f('0x14')]=function(_0x33f761,_0x3df148,_0x954956){io['to'](_0x33f761)[_0x092f('0x14')](_0x3df148,_0x954956);};VoiceDialReport[_0x092f('0x13')][_0x092f('0xb')]=function(_0x4e4d0f){try{if(this[_0x092f('0x12')](_0x4e4d0f)){if(this[_0x092f('0x8')][_0x4e4d0f[_0x092f('0x15')]]){_[_0x092f('0x16')](this['channels'][_0x4e4d0f['uniqueid']],{'starttime':moment()[_0x092f('0x17')](_0x092f('0x18')),'lastevent':_0x092f('0x19'),'interface':_0x4e4d0f[_0x092f('0x1a')][_0x092f('0x1b')](0x0,_0x4e4d0f['channel']['lastIndexOf']('-')),'membername':_0x4e4d0f[_0x092f('0x1a')][_0x092f('0x1b')](_0x4e4d0f[_0x092f('0x1a')][_0x092f('0x1c')]('/')+0x1,_0x4e4d0f[_0x092f('0x1a')]['lastIndexOf']('-'))},_[_0x092f('0x1d')](_0x4e4d0f,['event','privilege']));this['emit'](_0x092f('0x1e'),'voice_outbound_channel:save',this['channels'][_0x4e4d0f[_0x092f('0x15')]]);ami[_0x092f('0x14')](_0x092f('0x1f'),this['channels'][_0x4e4d0f[_0x092f('0x15')]]);}}}catch(_0x5aa915){logger[_0x092f('0x20')](_0x092f('0x21'),util[_0x092f('0x22')](_0x5aa915,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x092f('0x13')][_0x092f('0xd')]=function(_0xc1eb8d){try{if(this[_0x092f('0x12')](_0xc1eb8d)){if(this[_0x092f('0x8')][_0xc1eb8d[_0x092f('0x15')]]){this[_0x092f('0x8')][_0xc1eb8d[_0x092f('0x15')]][_0x092f('0x23')]=_0xc1eb8d[_0x092f('0x23')];if(_0xc1eb8d[_0x092f('0x23')]==='ANSWER'){this[_0x092f('0x8')][_0xc1eb8d[_0x092f('0x15')]]['connectedlinenum']=_0xc1eb8d[_0x092f('0x24')];this['channels'][_0xc1eb8d['uniqueid']][_0x092f('0x25')]=_0xc1eb8d[_0x092f('0x25')];this[_0x092f('0x8')][_0xc1eb8d[_0x092f('0x15')]]['answertime']=moment()[_0x092f('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x092f('0x8')][_0xc1eb8d[_0x092f('0x15')]][_0x092f('0x26')]=_0x092f('0x27');ami[_0x092f('0x14')](_0x092f('0x28'),this['channels'][_0xc1eb8d['uniqueid']]);}this['emit'](_0x092f('0x1e'),'voice_outbound_channel:save',this[_0x092f('0x8')][_0xc1eb8d['uniqueid']]);}}}catch(_0x3466ef){logger[_0x092f('0x20')]('[syncDialEnd][VoiceDialReport]',util[_0x092f('0x22')](_0x3466ef,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x092f('0xf')]=function(_0xc6d2cf){try{if(this[_0x092f('0x12')](_0xc6d2cf)){this[_0x092f('0x29')](_0xc6d2cf[_0x092f('0x15')],_[_0x092f('0x2a')](_0xc6d2cf['variable'])[0x0],_0xc6d2cf[_0x092f('0x2b')]);if(this[_0x092f('0x12')](_0xc6d2cf[_0x092f('0x2c')])&&this[_0x092f('0x12')](_0xc6d2cf['variable'][_0x092f('0x2d')])){if(_[_0x092f('0x2e')](this[_0x092f('0x8')][_0xc6d2cf['uniqueid']])){this[_0x092f('0x8')][_0xc6d2cf[_0x092f('0x15')]]={'routeId':_0xc6d2cf[_0x092f('0x2b')],'variables':this[_0x092f('0xa')][_0xc6d2cf[_0x092f('0x15')]]};this[_0x092f('0x14')](_0x092f('0x1e'),_0x092f('0x2f'),this['channels'][_0xc6d2cf['uniqueid']]);}}}}catch(_0x312775){logger['error'](_0x092f('0x30'),util[_0x092f('0x22')](_0x312775,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x092f('0x13')][_0x092f('0x29')]=function(_0x109b29,_0x3eabb9,_0x496ade){var _0x17944a=[_0x092f('0x31'),_0x092f('0x32'),_0x092f('0x33'),_0x092f('0x34'),_0x092f('0x35'),_0x092f('0x36'),_0x092f('0x37'),_0x092f('0x38'),_0x092f('0x39'),'sipuri',_0x092f('0x3a'),'bridgepvtcallid','membercalls','memberdynamic',_0x092f('0x3b'),_0x092f('0x3c'),_0x092f('0x3d'),_0x092f('0x3e'),_0x092f('0x3f')];if(!_[_0x092f('0x40')](_0x3eabb9)&&!_[_0x092f('0x41')](_0x17944a,_0x3eabb9)){if(_['isUndefined'](this['variables'][_0x109b29])){this[_0x092f('0xa')][_0x109b29]={};}this['variables'][_0x109b29][_0x3eabb9]=_0x496ade;}};VoiceDialReport[_0x092f('0x13')][_0x092f('0x11')]=function(_0x4823e6){try{if(this[_0x092f('0x12')](_0x4823e6)){if(this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]]){this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]][_0x092f('0x42')]=moment()[_0x092f('0x17')](_0x092f('0x18'));this['channels'][_0x4823e6[_0x092f('0x15')]][_0x092f('0x43')]=moment(this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]][_0x092f('0x42')])[_0x092f('0x44')](this['channels'][_0x4823e6[_0x092f('0x15')]]['starttime'],_0x092f('0x45'));this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]][_0x092f('0x26')]=_0x092f('0x46');this['outbound'][_0x092f('0x47')]+=0x1;if(this['channels'][_0x4823e6[_0x092f('0x15')]][_0x092f('0x48')]){this[_0x092f('0x9')][_0x092f('0x49')]+=0x1;this['channels'][_0x4823e6['uniqueid']][_0x092f('0x4a')]=moment(this['channels'][_0x4823e6[_0x092f('0x15')]][_0x092f('0x48')])['diff'](this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]][_0x092f('0x4b')],_0x092f('0x45'));this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]]['billableseconds']=moment(this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]][_0x092f('0x42')])[_0x092f('0x44')](this[_0x092f('0x8')][_0x4823e6['uniqueid']]['answertime'],_0x092f('0x45'));this[_0x092f('0x9')][_0x092f('0x4c')]+=this['channels'][_0x4823e6[_0x092f('0x15')]][_0x092f('0x4a')]||0x0;this[_0x092f('0x9')][_0x092f('0x4d')]+=this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]][_0x092f('0x4e')];}this['outbound'][_0x092f('0x4f')]+=this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]][_0x092f('0x43')];ami[_0x092f('0x14')](_0x092f('0x50'),this[_0x092f('0x8')][_0x4823e6['uniqueid']]);ami[_0x092f('0x14')](_0x092f('0x51'),this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]]);this['emit'](_0x092f('0x1e'),_0x092f('0x52'),this['outbound']);logger[_0x092f('0x53')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x092f('0x54')](this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]]));this['emit']('voice:outbound',_0x092f('0x55'),this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]]);delete this[_0x092f('0x8')][_0x4823e6[_0x092f('0x15')]];}if(this[_0x092f('0xa')][_0x4823e6['uniqueid']]){delete this[_0x092f('0xa')][_0x4823e6[_0x092f('0x15')]];}}}catch(_0xbedced){logger['error']('[syncHangup][VoiceDialReport]',util[_0x092f('0x22')](_0xbedced,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xcb4f=['channel','lastIndexOf','omit','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','uniqueid','error','[syncDialBegin][VoiceDialReport]','inspect','isNotNull','dialstatus','connectedlinenum','connectedlinename','lastevent','custom:dialconnect','[syncDialEnd][VoiceDialReport]','keys','variable','value','outboundrouteid','isUndefined','[syncVarSet][VoiceDialReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','includes','endtime','duration','diff','starttime','total','answered','holdtime','answertime','seconds','billableseconds','sumHoldTime','sumBillable','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','emit','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring'];(function(_0x5d7722,_0x54eea4){var _0x495f29=function(_0x5b92e3){while(--_0x5b92e3){_0x5d7722['push'](_0x5d7722['shift']());}};_0x495f29(++_0x54eea4);}(_0xcb4f,0x147));var _0xfcb4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xcb4f[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xfcb4('0x0'));var moment=require(_0xfcb4('0x1'));var util=require('util');var Redis=require(_0xfcb4('0x2'));var config=require(_0xfcb4('0x3'));var logger=require(_0xfcb4('0x4'))(_0xfcb4('0x5'));var ami=require(_0xfcb4('0x6'));config['redis']=_[_0xfcb4('0x7')](config[_0xfcb4('0x8')],{'host':_0xfcb4('0x9'),'port':0x18eb});var io=require(_0xfcb4('0xa'))(new Redis(config[_0xfcb4('0x8')]));function VoiceDialReport(_0x2648b7){this[_0xfcb4('0xb')]=_0x2648b7['outboundChannels'];this[_0xfcb4('0xc')]=_0x2648b7['outbound'];this[_0xfcb4('0xd')]={};ami['on'](_0xfcb4('0xe'),this[_0xfcb4('0xf')][_0xfcb4('0x10')](this));ami['on'](_0xfcb4('0x11'),this[_0xfcb4('0x12')]['bind'](this));ami['on']('varset',this[_0xfcb4('0x13')][_0xfcb4('0x10')](this));ami['on'](_0xfcb4('0x14'),this[_0xfcb4('0x15')][_0xfcb4('0x10')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x7a31a1){return _0x7a31a1!==null&&!_['isUndefined'](_0x7a31a1);};VoiceDialReport[_0xfcb4('0x16')]['emit']=function(_0x7899e3,_0x60dbbe,_0x3caf19){io['to'](_0x7899e3)[_0xfcb4('0x17')](_0x60dbbe,_0x3caf19);};VoiceDialReport[_0xfcb4('0x16')]['syncDialBegin']=function(_0x514fc8){try{if(this['isNotNull'](_0x514fc8)){if(this[_0xfcb4('0xb')][_0x514fc8['uniqueid']]){_[_0xfcb4('0x18')](this['channels'][_0x514fc8['uniqueid']],{'starttime':moment()[_0xfcb4('0x19')](_0xfcb4('0x1a')),'lastevent':_0xfcb4('0x1b'),'interface':_0x514fc8['channel'][_0xfcb4('0x1c')](0x0,_0x514fc8[_0xfcb4('0x1d')][_0xfcb4('0x1e')]('-')),'membername':_0x514fc8[_0xfcb4('0x1d')][_0xfcb4('0x1c')](_0x514fc8['channel'][_0xfcb4('0x1e')]('/')+0x1,_0x514fc8['channel'][_0xfcb4('0x1e')]('-'))},_[_0xfcb4('0x1f')](_0x514fc8,['event',_0xfcb4('0x20')]));this['emit'](_0xfcb4('0x21'),_0xfcb4('0x22'),this['channels'][_0x514fc8['uniqueid']]);ami[_0xfcb4('0x17')](_0xfcb4('0x23'),this['channels'][_0x514fc8[_0xfcb4('0x24')]]);}}}catch(_0x54e352){logger[_0xfcb4('0x25')](_0xfcb4('0x26'),util[_0xfcb4('0x27')](_0x54e352,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfcb4('0x16')][_0xfcb4('0x12')]=function(_0x3a37e1){try{if(this[_0xfcb4('0x28')](_0x3a37e1)){if(this[_0xfcb4('0xb')][_0x3a37e1['uniqueid']]){this['channels'][_0x3a37e1[_0xfcb4('0x24')]][_0xfcb4('0x29')]=_0x3a37e1['dialstatus'];if(_0x3a37e1[_0xfcb4('0x29')]==='ANSWER'){this[_0xfcb4('0xb')][_0x3a37e1[_0xfcb4('0x24')]][_0xfcb4('0x2a')]=_0x3a37e1[_0xfcb4('0x2a')];this[_0xfcb4('0xb')][_0x3a37e1['uniqueid']][_0xfcb4('0x2b')]=_0x3a37e1[_0xfcb4('0x2b')];this['channels'][_0x3a37e1[_0xfcb4('0x24')]]['answertime']=moment()[_0xfcb4('0x19')](_0xfcb4('0x1a'));this[_0xfcb4('0xb')][_0x3a37e1[_0xfcb4('0x24')]][_0xfcb4('0x2c')]='connect';ami[_0xfcb4('0x17')](_0xfcb4('0x2d'),this[_0xfcb4('0xb')][_0x3a37e1[_0xfcb4('0x24')]]);}this['emit'](_0xfcb4('0x21'),_0xfcb4('0x22'),this[_0xfcb4('0xb')][_0x3a37e1['uniqueid']]);}}}catch(_0x1f08cf){logger[_0xfcb4('0x25')](_0xfcb4('0x2e'),util[_0xfcb4('0x27')](_0x1f08cf,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xfcb4('0x13')]=function(_0x5a1e81){try{if(this[_0xfcb4('0x28')](_0x5a1e81)){this['addVariable'](_0x5a1e81[_0xfcb4('0x24')],_[_0xfcb4('0x2f')](_0x5a1e81[_0xfcb4('0x30')])[0x0],_0x5a1e81[_0xfcb4('0x31')]);if(this[_0xfcb4('0x28')](_0x5a1e81[_0xfcb4('0x30')])&&this[_0xfcb4('0x28')](_0x5a1e81[_0xfcb4('0x30')][_0xfcb4('0x32')])){if(_[_0xfcb4('0x33')](this[_0xfcb4('0xb')][_0x5a1e81[_0xfcb4('0x24')]])){this['channels'][_0x5a1e81[_0xfcb4('0x24')]]={'routeId':_0x5a1e81['value'],'variables':this[_0xfcb4('0xd')][_0x5a1e81[_0xfcb4('0x24')]]};this[_0xfcb4('0x17')](_0xfcb4('0x21'),_0xfcb4('0x22'),this[_0xfcb4('0xb')][_0x5a1e81[_0xfcb4('0x24')]]);}}}}catch(_0xb62617){logger[_0xfcb4('0x25')](_0xfcb4('0x34'),util[_0xfcb4('0x27')](_0xb62617,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfcb4('0x16')][_0xfcb4('0x35')]=function(_0x27d3d3,_0x1a4a3f,_0x3b8f29){var _0x5234ff=[_0xfcb4('0x36'),_0xfcb4('0x37'),_0xfcb4('0x38'),_0xfcb4('0x39'),_0xfcb4('0x3a'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xfcb4('0x3b'),'sipcallid',_0xfcb4('0x3c'),_0xfcb4('0x3d'),_0xfcb4('0x3e'),_0xfcb4('0x3f'),_0xfcb4('0x40'),'memberinterface',_0xfcb4('0x41'),_0xfcb4('0x42'),_0xfcb4('0x43'),'memberrealtime'];if(!_['isNil'](_0x1a4a3f)&&!_[_0xfcb4('0x44')](_0x5234ff,_0x1a4a3f)){if(_[_0xfcb4('0x33')](this[_0xfcb4('0xd')][_0x27d3d3])){this[_0xfcb4('0xd')][_0x27d3d3]={};}this['variables'][_0x27d3d3][_0x1a4a3f]=_0x3b8f29;}};VoiceDialReport[_0xfcb4('0x16')]['syncHangup']=function(_0x295769){try{if(this[_0xfcb4('0x28')](_0x295769)){if(this[_0xfcb4('0xb')][_0x295769['uniqueid']]){this[_0xfcb4('0xb')][_0x295769['uniqueid']][_0xfcb4('0x45')]=moment()[_0xfcb4('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x46')]=moment(this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x45')])[_0xfcb4('0x47')](this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x48')],'seconds');this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x2c')]='complete';this['outbound'][_0xfcb4('0x49')]+=0x1;if(this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]]['answertime']){this['outbound'][_0xfcb4('0x4a')]+=0x1;this['channels'][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x4b')]=moment(this['channels'][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x4c')])['diff'](this['channels'][_0x295769['uniqueid']]['starttime'],_0xfcb4('0x4d'));this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x4e')]=moment(this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x45')])['diff'](this['channels'][_0x295769['uniqueid']]['answertime'],_0xfcb4('0x4d'));this[_0xfcb4('0xc')][_0xfcb4('0x4f')]+=this['channels'][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x4b')]||0x0;this[_0xfcb4('0xc')][_0xfcb4('0x50')]+=this['channels'][_0x295769[_0xfcb4('0x24')]][_0xfcb4('0x4e')];}this['outbound']['sumDuration']+=this['channels'][_0x295769['uniqueid']]['duration'];ami[_0xfcb4('0x17')](_0xfcb4('0x51'),this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]]);ami[_0xfcb4('0x17')](_0xfcb4('0x52'),this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]]);this[_0xfcb4('0x17')](_0xfcb4('0x21'),_0xfcb4('0x53'),this[_0xfcb4('0xc')]);logger[_0xfcb4('0x54')](_0xfcb4('0x55'),JSON[_0xfcb4('0x56')](this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]]));this[_0xfcb4('0x17')]('voice:outbound','voice_outbound_channel:remove',this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]]);delete this[_0xfcb4('0xb')][_0x295769[_0xfcb4('0x24')]];}if(this[_0xfcb4('0xd')][_0x295769[_0xfcb4('0x24')]]){delete this['variables'][_0x295769['uniqueid']];}}}catch(_0x4fc0ef){logger[_0xfcb4('0x25')](_0xfcb4('0x57'),util[_0xfcb4('0x27')](_0x4fc0ef,{'showHidden':![],'depth':null}));}};module[_0xfcb4('0x58')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index cab0d91..e4ba8d3 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 _0x5ab5=['ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','hangup','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','switch','isNil','status','channel','catch','message','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','emitVoiceQueueSummary','inbound','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','Trunk','Interval','voice_queue:save','isNotNull','loopQueueShow','Action','queues','[queues]','[queuesummary]','queue','countBy','toNumber','callers','loggedIn','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','last','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallercomplete','COMPLETEDBYAGENT','queuecallerabandonAt','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','local/','linkedid','seconds','transfertype','transferexten','destexten','transferuniqueid','COMPLETEDBY','reason','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','variable','queuestatus','value','TIMEOUT','lastevent','timeout','queuecallerabandon','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','length','diff','milliseconds','queuecallercompleteAt','custom:queuecallerunmanaged','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','extension','BlindTransfer','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','bluebird','util','md5'];(function(_0x2ce81c,_0x2bc52b){var _0x189af7=function(_0x23bfa2){while(--_0x23bfa2){_0x2ce81c['push'](_0x2ce81c['shift']());}};_0x189af7(++_0x2bc52b);}(_0x5ab5,0x18c));var _0x55ab=function(_0xa54fbe,_0x1633f6){_0xa54fbe=_0xa54fbe-0x0;var _0x120d39=_0x5ab5[_0xa54fbe];return _0x120d39;};'use strict';var _=require(_0x55ab('0x0'));var moment=require('moment');var BPromise=require(_0x55ab('0x1'));var util=require(_0x55ab('0x2'));var md5=require(_0x55ab('0x3'));var Redis=require(_0x55ab('0x4'));var config=require(_0x55ab('0x5'));var logger=require(_0x55ab('0x6'))(_0x55ab('0x7'));var ami=require(_0x55ab('0x8'));var QueueReport=require('../model/queueReport');config[_0x55ab('0x9')]=_['defaults'](config[_0x55ab('0x9')],{'host':_0x55ab('0xa'),'port':0x18eb});var io=require(_0x55ab('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x55ab('0xc')][_0x55ab('0xd')]=function(_0xc0c00){this['tail']=this[_0x55ab('0xe')]?this['tail'][_0x55ab('0xf')](_0xc0c00):_0xc0c00();};function VoiceQueueReport(_0x1d5f39){this[_0x55ab('0x10')]=new Sequence();this[_0x55ab('0x11')]={};this['agents']=_0x1d5f39[_0x55ab('0x12')];this[_0x55ab('0x13')]=_0x1d5f39[_0x55ab('0x14')];this['voiceQueues']=_0x1d5f39[_0x55ab('0x15')];this[_0x55ab('0x16')]=!![];this['campaigns']=_0x1d5f39[_0x55ab('0x17')];this[_0x55ab('0x18')]={};ami['on'](_0x55ab('0x19'),this[_0x55ab('0x1a')][_0x55ab('0x1b')](this));ami['on'](_0x55ab('0x1c'),this[_0x55ab('0x1d')][_0x55ab('0x1b')](this));ami['on']('queuecallerjoin',this[_0x55ab('0x1e')][_0x55ab('0x1b')](this));ami['on']('queuecallerabandon',this[_0x55ab('0x1f')]['bind'](this));ami['on'](_0x55ab('0x20'),this[_0x55ab('0x21')]['bind'](this));ami['on'](_0x55ab('0x22'),this[_0x55ab('0x23')]['bind'](this));ami['on']('agentconnect',this[_0x55ab('0x24')][_0x55ab('0x1b')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x55ab('0x25'),this[_0x55ab('0x26')][_0x55ab('0x1b')](this));ami['on']('fullybooted',this[_0x55ab('0x27')][_0x55ab('0x1b')](this));ami['on'](_0x55ab('0x28'),this[_0x55ab('0x29')][_0x55ab('0x1b')](this));ami['on'](_0x55ab('0x2a'),this[_0x55ab('0x2b')][_0x55ab('0x1b')](this));ami['on'](_0x55ab('0x2c'),this[_0x55ab('0x2d')][_0x55ab('0x1b')](this));ami['on'](_0x55ab('0x2e'),this[_0x55ab('0x2f')][_0x55ab('0x1b')](this));this[_0x55ab('0x30')]();this['loopQueueShow']();}function isNotNull(_0x1dbce8){return _0x1dbce8!==null&&!_[_0x55ab('0x31')](_0x1dbce8);}function clearChannels(_0x2d2809){if(!_[_0x55ab('0x32')](_0x2d2809)){for(var _0x2360b2 in _0x2d2809){if(_0x2d2809[_0x55ab('0x33')](_0x2360b2)){delete _0x2d2809[_0x2360b2];}}}}function clearCampaigns(_0x14a122){if(!_['isEmpty'](_0x14a122)){for(var _0x352444 in _0x14a122){if(_0x14a122[_0x55ab('0x33')](_0x352444)){_0x14a122[_0x352444][_0x55ab('0x34')]=0x0;}}}}function clearVoiceQueues(_0x2c8aa5){if(!_['isEmpty'](_0x2c8aa5)){for(var _0x2850d1 in _0x2c8aa5){if(_0x2c8aa5[_0x55ab('0x33')](_0x2850d1)){_0x2c8aa5[_0x2850d1][_0x55ab('0x34')]=0x0;_0x2c8aa5[_0x2850d1][_0x55ab('0x35')]=0x0;_0x2c8aa5[_0x2850d1][_0x55ab('0x36')]=0x0;_0x2c8aa5[_0x2850d1][_0x55ab('0x37')]=0x0;_0x2c8aa5[_0x2850d1]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x3bc74c){if(!_['isEmpty'](_0x3bc74c)){for(var _0x1750b9 in _0x3bc74c){if(_0x3bc74c[_0x55ab('0x33')](_0x1750b9)){_0x3bc74c[_0x1750b9][_0x55ab('0x38')]=!![];}}}}VoiceQueueReport[_0x55ab('0xc')]['clearZombieChannels']=function(){var _0x4b62ff=this;for(var _0x398383 in this[_0x55ab('0x13')]){if(this[_0x55ab('0x13')][_0x55ab('0x33')](_0x398383)&&!this['channels'][_0x398383][_0x55ab('0x39')]){this[_0x55ab('0x10')]['enqueue'](function(){if(!_[_0x55ab('0x3a')](_0x4b62ff[_0x55ab('0x13')][_0x398383])){return ami['Action']({'action':_0x55ab('0x3b'),'channel':_0x4b62ff[_0x55ab('0x13')][_0x398383][_0x55ab('0x3c')]})[_0x55ab('0x3d')](function(_0x493f70){if(_0x493f70[_0x55ab('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4b62ff[_0x55ab('0x13')][_0x398383]){delete _0x4b62ff['channels'][_0x398383];logger[_0x55ab('0x3f')](_0x55ab('0x40'),_0x398383);}if(_0x4b62ff[_0x55ab('0x11')][_0x398383]){delete _0x4b62ff[_0x55ab('0x11')][_0x398383];logger[_0x55ab('0x3f')](_0x55ab('0x41'),_0x398383);}if(_0x4b62ff[_0x55ab('0x18')][_0x398383]){delete _0x4b62ff[_0x55ab('0x18')][_0x398383];logger['error'](_0x55ab('0x42'),_0x398383);}},0x1f40);}});}});}}};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x27')]=function(){logger['error'](_0x55ab('0x43'));clearChannels(this[_0x55ab('0x13')]);this['clearQueueReport'](this[_0x55ab('0x11')]);clearAgentBooked(this[_0x55ab('0x12')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x55ab('0x17')]);};VoiceQueueReport[_0x55ab('0xc')]['clearQueueReport']=function(_0x5350ae){var _0x581138=this;if(!_[_0x55ab('0x32')](_0x5350ae)){for(var _0xda7db4 in _0x5350ae){if(_0x5350ae[_0x55ab('0x33')](_0xda7db4)){_0x581138[_0x55ab('0x44')](_0x5350ae[_0xda7db4]);delete _0x5350ae[_0xda7db4];}}}};function loggerCatch(_0x53a6b4){return function(_0x39cede){logger[_0x55ab('0x3f')](_0x53a6b4,util[_0x55ab('0x45')](_0x39cede,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x55ab('0xc')]['emit']=function(_0x25a464,_0x4590a1,_0x2ec2ae){io['to'](_0x25a464)[_0x55ab('0x46')](_0x4590a1,_0x2ec2ae);};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x47')]=function(_0x5971ec){this[_0x55ab('0x46')](util['format'](_0x55ab('0x48'),_0x5971ec[_0x55ab('0x49')]),_0x55ab('0x4a'),_0x5971ec);};VoiceQueueReport[_0x55ab('0xc')]['emitVoiceQueueChannelRemove']=function(_0x5045f4){logger[_0x55ab('0x4b')](_0x55ab('0x4c'),JSON[_0x55ab('0x4d')](_0x5045f4));this[_0x55ab('0x46')](util[_0x55ab('0x4e')]('voice:queue:%s',_0x5045f4['name']),_0x55ab('0x4f'),_0x5045f4);};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x50')]=function(_0x46de2d){if(_0x46de2d['type']===_0x55ab('0x51')){var _0x490e54={'id':_0x46de2d['id'],'name':_0x46de2d[_0x55ab('0x49')],'strategy':_0x46de2d[_0x55ab('0x52')],'answered':_0x46de2d[_0x55ab('0x53')],'available':_0x46de2d[_0x55ab('0x54')],'loggedIn':_0x46de2d['loggedIn'],'pTalking':_0x46de2d[_0x55ab('0x36')],'sumBillable':_0x46de2d[_0x55ab('0x55')],'sumDuration':_0x46de2d[_0x55ab('0x56')],'sumHoldTime':_0x46de2d[_0x55ab('0x57')]||0x0,'talking':_0x46de2d[_0x55ab('0x35')],'total':_0x46de2d[_0x55ab('0x58')],'type':_0x46de2d[_0x55ab('0x59')],'unmanaged':_0x46de2d[_0x55ab('0x5a')],'abandoned':_0x46de2d[_0x55ab('0x5b')],'waiting':_0x46de2d['waiting']};if(_0x46de2d[_0x55ab('0x5c')]){_0x490e54[_0x55ab('0x5c')]={'id':_0x46de2d[_0x55ab('0x5c')]['id'],'name':_0x46de2d[_0x55ab('0x5c')][_0x55ab('0x49')],'active':_0x46de2d['Trunk']['active'],'callerid':_0x46de2d[_0x55ab('0x5c')]['callerid']};}if(_0x46de2d[_0x55ab('0x5d')]){_0x490e54[_0x55ab('0x5d')]={'id':_0x46de2d['Interval']['id'],'name':_0x46de2d[_0x55ab('0x5d')][_0x55ab('0x49')]};}var _0xf24122=md5(JSON[_0x55ab('0x4d')](_0x490e54));if(_0x46de2d[_0x55ab('0x3')]!==_0xf24122){_0x46de2d[_0x55ab('0x3')]=_0xf24122;this[_0x55ab('0x46')](util['format'](_0x55ab('0x48'),_0x490e54[_0x55ab('0x49')]),_0x55ab('0x5e'),_0x490e54);}}};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x5f')]=function(_0x592a83){return _0x592a83!==null&&!_[_0x55ab('0x31')](_0x592a83);};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x60')]=function(){var _0xb23153=this;setInterval(function(){_0xb23153['clearZombieChannels']();ami[_0x55ab('0x61')]({'action':_0x55ab('0x62')})['catch'](loggerCatch(_0x55ab('0x63')));},0x2710);};VoiceQueueReport['prototype'][_0x55ab('0x30')]=function(){var _0x3d294e=this;setInterval(function(){if(_0x3d294e[_0x55ab('0x16')]){return ami[_0x55ab('0x61')]({'action':'queuesummary'})['then'](function(_0xded9f4){_0x3d294e['flagQueueSummary']=![];})[_0x55ab('0x3d')](loggerCatch(_0x55ab('0x64')));}},0x3e8);};VoiceQueueReport['prototype'][_0x55ab('0x1a')]=function(_0x1575cb){try{if(this[_0x55ab('0x5f')](_0x1575cb)&&this[_0x55ab('0x5f')](_0x1575cb[_0x55ab('0x65')])){if(this[_0x55ab('0x15')][_0x1575cb['queue']]){var _0xe72e40=_[_0x55ab('0x66')](this['channels'],_0x55ab('0x65'))[_0x1575cb[_0x55ab('0x65')]]||0x0;var _0x57c084=_0xe72e40-_0x1575cb['callers'];if(this[_0x55ab('0x15')][_0x1575cb['queue']][_0x55ab('0x37')]!==_[_0x55ab('0x67')](_0x1575cb[_0x55ab('0x68')])||this[_0x55ab('0x15')][_0x1575cb[_0x55ab('0x65')]][_0x55ab('0x69')]!==_[_0x55ab('0x67')](_0x1575cb[_0x55ab('0x6a')])||this[_0x55ab('0x15')][_0x1575cb[_0x55ab('0x65')]]['available']!==_[_0x55ab('0x67')](_0x1575cb[_0x55ab('0x54')])||this[_0x55ab('0x15')][_0x1575cb['queue']][_0x55ab('0x35')]!==_0x57c084){this[_0x55ab('0x15')][_0x1575cb[_0x55ab('0x65')]][_0x55ab('0x37')]=_[_0x55ab('0x67')](_0x1575cb[_0x55ab('0x68')]);this[_0x55ab('0x15')][_0x1575cb['queue']][_0x55ab('0x69')]=_[_0x55ab('0x67')](_0x1575cb['loggedin']);this['voiceQueues'][_0x1575cb['queue']][_0x55ab('0x54')]=_[_0x55ab('0x67')](_0x1575cb['available']);this[_0x55ab('0x15')][_0x1575cb['queue']][_0x55ab('0x35')]=_0x57c084>0x0?_0x57c084:0x0;this[_0x55ab('0x15')][_0x1575cb['queue']][_0x55ab('0x35')]=this[_0x55ab('0x15')][_0x1575cb[_0x55ab('0x65')]][_0x55ab('0x35')]>_[_0x55ab('0x67')](_0x1575cb[_0x55ab('0x6a')])?_[_0x55ab('0x67')](_0x1575cb['loggedin']):this[_0x55ab('0x15')][_0x1575cb[_0x55ab('0x65')]]['talking'];this[_0x55ab('0x50')](this[_0x55ab('0x15')][_0x1575cb[_0x55ab('0x65')]]);}ami[_0x55ab('0x46')](_0x55ab('0x6b'),this[_0x55ab('0x15')][_0x1575cb['queue']]);}}}catch(_0x206af4){logger[_0x55ab('0x3f')](_0x55ab('0x6c'),util[_0x55ab('0x45')](_0x206af4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x1d')]=function(_0x147c70){this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0x55ab('0x6d')]=function(_0x4d4b59){};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x1e')]=function(_0x4c178d){try{if(this['isNotNull'](_0x4c178d)){if(_[_0x55ab('0x31')](this[_0x55ab('0x11')][_0x4c178d[_0x55ab('0x6e')]])){this['queueReports'][_0x4c178d[_0x55ab('0x6e')]]=[];this['channels'][_0x4c178d['uniqueid']]={};}var _0x9041cc=new QueueReport();_0x9041cc[_0x55ab('0x49')]=_0x4c178d['queue'];_0x9041cc[_0x55ab('0x59')]=this['voiceQueues'][_0x9041cc[_0x55ab('0x49')]]&&this['voiceQueues'][_0x9041cc['name']][_0x55ab('0x59')]?this[_0x55ab('0x15')][_0x9041cc['name']]['type']||'inbound':_0x55ab('0x51');_0x9041cc[_0x55ab('0x65')]=_0x4c178d[_0x55ab('0x65')];_0x9041cc[_0x55ab('0x6f')]=moment()[_0x55ab('0x4e')](_0x55ab('0x70'));_0x9041cc[_0x55ab('0x71')]=_0x4c178d['position'];_0x9041cc[_0x55ab('0x72')]=_0x4c178d[_0x55ab('0x72')];_[_0x55ab('0x73')](_0x9041cc,_[_0x55ab('0x74')](_0x4c178d,_[_0x55ab('0x75')](_0x9041cc)));this[_0x55ab('0x11')][_0x4c178d[_0x55ab('0x6e')]][_0x55ab('0x76')](_0x9041cc);this[_0x55ab('0x13')][_0x4c178d[_0x55ab('0x6e')]]=_0x9041cc;this['emitVoiceQueueChannelSave'](_0x9041cc);}}catch(_0x47496){logger[_0x55ab('0x3f')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0x55ab('0x45')](_0x47496,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ab('0xc')]['syncQueueCallerAbandon']=function(_0x3879ae){try{if(this[_0x55ab('0x5f')](_0x3879ae)){if(this[_0x55ab('0x11')][_0x3879ae['uniqueid']]){var _0x1bf3ef=_[_0x55ab('0x77')](this[_0x55ab('0x11')][_0x3879ae[_0x55ab('0x6e')]]);_0x1bf3ef['queuecallercomplete']=![];_0x1bf3ef['queuecallercompleteAt']=null;_0x1bf3ef[_0x55ab('0x78')]=_0x3879ae[_0x55ab('0x78')];_0x1bf3ef[_0x55ab('0x79')]=_0x3879ae['originalposition'];_0x1bf3ef['queuecallerabandon']=!![];_0x1bf3ef['queuecallerabandonAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1bf3ef[_0x55ab('0x7a')]=_0x55ab('0x7b');_0x1bf3ef[_0x55ab('0x7c')]=null;this['channels'][_0x3879ae['uniqueid']]=_0x1bf3ef;this[_0x55ab('0x44')](_0x1bf3ef);}}}catch(_0x1ea970){logger[_0x55ab('0x3f')](_0x55ab('0x7d'),util['inspect'](_0x1ea970,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x55ab('0x21')]=function(_0x532f36){try{if(this['isNotNull'](_0x532f36)){if(this['queueReports'][_0x532f36[_0x55ab('0x6e')]]){var _0x485918=_[_0x55ab('0x77')](this['queueReports'][_0x532f36[_0x55ab('0x6e')]]);_0x485918[_0x55ab('0x7e')]=moment()[_0x55ab('0x4e')](_0x55ab('0x70'));_0x485918[_0x55ab('0x7f')]=_0x532f36[_0x55ab('0x7f')];_0x485918[_0x55ab('0x80')]=_0x532f36[_0x55ab('0x80')];this[_0x55ab('0x13')][_0x532f36[_0x55ab('0x6e')]]=_0x485918;this[_0x55ab('0x47')](_0x485918);}}}catch(_0xe8b51b){logger[_0x55ab('0x3f')](_0x55ab('0x81'),util[_0x55ab('0x45')](_0xe8b51b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x55ab('0x24')]=function(_0x17565f){try{if(this['isNotNull'](_0x17565f)){if(this['queueReports'][_0x17565f[_0x55ab('0x6e')]]){var _0x4aae02=_[_0x55ab('0x77')](this[_0x55ab('0x11')][_0x17565f[_0x55ab('0x6e')]]);_0x4aae02[_0x55ab('0x82')]=!![];_0x4aae02[_0x55ab('0x7a')]=_0x55ab('0x83');}}}catch(_0x4edb50){logger[_0x55ab('0x3f')]('[syncAgentConnect][VoiceQueueReport]',util[_0x55ab('0x45')](_0x4edb50,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ab('0xc')]['syncAgentComplete']=function(_0x1c824e){try{if(this[_0x55ab('0x5f')](_0x1c824e)){if(this[_0x55ab('0x11')][_0x1c824e[_0x55ab('0x6e')]]){var _0x498e37=_[_0x55ab('0x77')](this[_0x55ab('0x11')][_0x1c824e[_0x55ab('0x6e')]]);_0x498e37['queuecallerabandon']=![];_0x498e37[_0x55ab('0x84')]=null;_0x498e37[_0x55ab('0x85')]=!![];_0x498e37[_0x55ab('0x7c')]=_0x1c824e[_0x55ab('0x86')];_0x498e37['holdtime']=_0x1c824e[_0x55ab('0x78')];_0x498e37[_0x55ab('0x82')]=!![];_0x498e37[_0x55ab('0x87')]=![];_0x498e37[_0x55ab('0x88')]=null;if(!_0x498e37[_0x55ab('0x89')]){if(_0x1c824e['reason']=='transfer'){_0x498e37[_0x55ab('0x7a')]=_0x55ab('0x8a');}else{if(_['startsWith'](_0x1c824e['channel']['toLowerCase'](),_0x55ab('0x8b'))){if(this['queueReports'][_0x1c824e[_0x55ab('0x8c')]]){var _0x5f4481=_[_0x55ab('0x77')](this[_0x55ab('0x11')][_0x1c824e[_0x55ab('0x8c')]]);_0x5f4481[_0x55ab('0x82')]=![];_0x5f4481['queuecallerexit']=!![];_0x5f4481[_0x55ab('0x88')]=moment(_0x498e37[_0x55ab('0x6f')])['add'](_0x1c824e['holdtime'],_0x55ab('0x8d'))[_0x55ab('0x4e')](_0x55ab('0x70'));_0x5f4481[_0x55ab('0x7a')]='FORWARDTRANSFER';_0x5f4481[_0x55ab('0x89')]=!![];_0x5f4481[_0x55ab('0x8e')]='FORWARD';_0x5f4481[_0x55ab('0x8f')]=_0x1c824e[_0x55ab('0x90')];_0x5f4481[_0x55ab('0x91')]=_0x1c824e[_0x55ab('0x6e')];var _0xbabe81=this['queueReports'][_0x1c824e[_0x55ab('0x8c')]];this[_0x55ab('0x11')][_0x1c824e[_0x55ab('0x8c')]]=this[_0x55ab('0x11')][_0x1c824e['uniqueid']];this['queueReports'][_0x1c824e['uniqueid']]=_0xbabe81;}}else{_0x498e37[_0x55ab('0x7a')]=_0x55ab('0x92')+_0x1c824e[_0x55ab('0x93')][_0x55ab('0x94')]();}}}this[_0x55ab('0x13')][_0x1c824e[_0x55ab('0x6e')]]=_0x498e37;this[_0x55ab('0x44')](_0x498e37);}}}catch(_0x2250fe){logger['error'](_0x55ab('0x95'),util[_0x55ab('0x45')](_0x2250fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x96')]=function(_0x4638f0){try{if(this[_0x55ab('0x5f')](_0x4638f0)){this[_0x55ab('0x97')](_0x4638f0[_0x55ab('0x6e')],_[_0x55ab('0x75')](_0x4638f0[_0x55ab('0x98')])[0x0],_0x4638f0['value']);if(this[_0x55ab('0x11')][_0x4638f0[_0x55ab('0x6e')]]){var _0x8a737a=_[_0x55ab('0x77')](this[_0x55ab('0x11')][_0x4638f0[_0x55ab('0x6e')]]);if(_0x8a737a){if(this[_0x55ab('0x5f')](_0x4638f0['variable'])&&this[_0x55ab('0x5f')](_0x4638f0[_0x55ab('0x98')][_0x55ab('0x99')])){switch(_0x4638f0[_0x55ab('0x9a')]){case'CONTINUE':_0x8a737a[_0x55ab('0x87')]=![];_0x8a737a[_0x55ab('0x88')]=null;break;case _0x55ab('0x9b'):_0x8a737a[_0x55ab('0x9c')]=_0x55ab('0x9d');ami[_0x55ab('0x46')]('custom:timeout',_0x8a737a);break;default:_0x8a737a[_0x55ab('0x87')]=!![];_0x8a737a[_0x55ab('0x88')]=moment()[_0x55ab('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x8a737a[_0x55ab('0x7e')]=moment()[_0x55ab('0x4e')](_0x55ab('0x70'));}_0x8a737a[_0x55ab('0x9e')]=![];_0x8a737a[_0x55ab('0x84')]=null;_0x8a737a['queuecallerexitreason']=_0x4638f0[_0x55ab('0x9a')];this[_0x55ab('0x13')][_0x4638f0[_0x55ab('0x6e')]]=_0x8a737a;this[_0x55ab('0x44')](_0x8a737a);}else if(this['isNotNull'](_0x4638f0[_0x55ab('0x98')])&&this[_0x55ab('0x5f')](_0x4638f0[_0x55ab('0x98')][_0x55ab('0x9f')])){if(!_0x8a737a['queuecallerabandon']){_0x8a737a[_0x55ab('0x87')]=!![];_0x8a737a[_0x55ab('0x88')]=moment()['format'](_0x55ab('0x70'));_0x8a737a['queuecallerexitreason']=_0x55ab('0xa0');_0x8a737a[_0x55ab('0x7e')]=moment()[_0x55ab('0x4e')](_0x55ab('0x70'));this[_0x55ab('0x13')][_0x4638f0[_0x55ab('0x6e')]]=_0x8a737a;}}_0x8a737a['variables']=this[_0x55ab('0x18')][_0x4638f0[_0x55ab('0x6e')]];}}}}catch(_0x54b005){logger['error'](_0x55ab('0xa1'),util[_0x55ab('0x45')](_0x54b005,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x97')]=function(_0x2c83fb,_0x4cbc9f,_0x75812f){var _0x42b55c=[_0x55ab('0xa2'),_0x55ab('0xa3'),_0x55ab('0xa4'),_0x55ab('0xa5'),_0x55ab('0xa6'),_0x55ab('0xa7'),_0x55ab('0xa8'),'rtpaudioqosrttbridged',_0x55ab('0xa9'),_0x55ab('0xaa'),_0x55ab('0xab'),_0x55ab('0xac'),_0x55ab('0xad'),_0x55ab('0xae'),_0x55ab('0xaf'),_0x55ab('0xb0'),_0x55ab('0x86'),_0x55ab('0xb1'),_0x55ab('0xb2')];if(!_[_0x55ab('0x3a')](_0x4cbc9f)&&!_['includes'](_0x42b55c,_0x4cbc9f)){if(_[_0x55ab('0x31')](this[_0x55ab('0x18')][_0x2c83fb])){this[_0x55ab('0x18')][_0x2c83fb]={};}this['variables'][_0x2c83fb][_0x4cbc9f]=_0x75812f;}};VoiceQueueReport[_0x55ab('0xc')][_0x55ab('0x26')]=function(_0x4bdae0){try{if(this[_0x55ab('0x5f')](_0x4bdae0)){if(this['queueReports'][_0x4bdae0[_0x55ab('0x6e')]]){for(var _0x108900=0x0,_0x21491f={};_0x1089000x0?_0x2b6957:0x0;this[_0x7a2f('0x16')][_0x5bbe1b['queue']][_0x7a2f('0x35')]=this[_0x7a2f('0x16')][_0x5bbe1b[_0x7a2f('0x61')]]['talking']>_[_0x7a2f('0x64')](_0x5bbe1b['loggedin'])?_[_0x7a2f('0x64')](_0x5bbe1b[_0x7a2f('0x65')]):this['voiceQueues'][_0x5bbe1b[_0x7a2f('0x61')]][_0x7a2f('0x35')];this['emitVoiceQueueSummary'](this[_0x7a2f('0x16')][_0x5bbe1b['queue']]);}ami[_0x7a2f('0x46')](_0x7a2f('0x66'),this[_0x7a2f('0x16')][_0x5bbe1b[_0x7a2f('0x61')]]);}}}catch(_0x321905){logger[_0x7a2f('0x40')](_0x7a2f('0x67'),util[_0x7a2f('0x68')](_0x321905,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7a2f('0xf')]['syncQueueSummaryComplete']=function(_0xd9149){this[_0x7a2f('0x17')]=!![];};VoiceQueueReport[_0x7a2f('0xf')][_0x7a2f('0x69')]=function(_0x480223){};VoiceQueueReport[_0x7a2f('0xf')][_0x7a2f('0x1f')]=function(_0x494d89){try{if(this[_0x7a2f('0x5d')](_0x494d89)){if(_[_0x7a2f('0x31')](this[_0x7a2f('0x14')][_0x494d89[_0x7a2f('0x6a')]])){this[_0x7a2f('0x14')][_0x494d89[_0x7a2f('0x6a')]]=[];this['channels'][_0x494d89[_0x7a2f('0x6a')]]={};}var _0x3f72d4=new QueueReport();_0x3f72d4['name']=_0x494d89[_0x7a2f('0x61')];_0x3f72d4[_0x7a2f('0x4d')]=this[_0x7a2f('0x16')][_0x3f72d4[_0x7a2f('0x4a')]]&&this['voiceQueues'][_0x3f72d4[_0x7a2f('0x4a')]][_0x7a2f('0x4d')]?this['voiceQueues'][_0x3f72d4[_0x7a2f('0x4a')]]['type']||'inbound':_0x7a2f('0x4e');_0x3f72d4['queue']=_0x494d89[_0x7a2f('0x61')];_0x3f72d4[_0x7a2f('0x6b')]=moment()['format'](_0x7a2f('0x6c'));_0x3f72d4['position']=_0x494d89[_0x7a2f('0x6d')];_0x3f72d4[_0x7a2f('0x6e')]=_0x494d89['count'];_[_0x7a2f('0x6f')](_0x3f72d4,_['pick'](_0x494d89,_[_0x7a2f('0x70')](_0x3f72d4)));this['queueReports'][_0x494d89[_0x7a2f('0x6a')]]['push'](_0x3f72d4);this[_0x7a2f('0x3a')][_0x494d89[_0x7a2f('0x6a')]]=_0x3f72d4;this['emitVoiceQueueChannelSave'](_0x3f72d4);}}catch(_0x402cd5){logger[_0x7a2f('0x40')](_0x7a2f('0x71'),util[_0x7a2f('0x68')](_0x402cd5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7a2f('0xf')][_0x7a2f('0x21')]=function(_0x1fca22){try{if(this['isNotNull'](_0x1fca22)){if(this[_0x7a2f('0x14')][_0x1fca22['uniqueid']]){var _0x4d4298=_['last'](this[_0x7a2f('0x14')][_0x1fca22[_0x7a2f('0x6a')]]);_0x4d4298[_0x7a2f('0x72')]=![];_0x4d4298[_0x7a2f('0x73')]=null;_0x4d4298[_0x7a2f('0x74')]=_0x1fca22[_0x7a2f('0x74')];_0x4d4298[_0x7a2f('0x75')]=_0x1fca22[_0x7a2f('0x75')];_0x4d4298[_0x7a2f('0x20')]=!![];_0x4d4298['queuecallerabandonAt']=moment()[_0x7a2f('0x48')](_0x7a2f('0x6c'));_0x4d4298[_0x7a2f('0x76')]='ABANDONED';_0x4d4298[_0x7a2f('0x77')]=null;this[_0x7a2f('0x3a')][_0x1fca22['uniqueid']]=_0x4d4298;this[_0x7a2f('0x45')](_0x4d4298);}}}catch(_0x4ccd68){logger['error'](_0x7a2f('0x78'),util[_0x7a2f('0x68')](_0x4ccd68,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7a2f('0xf')][_0x7a2f('0x79')]=function(_0x51bdc7){try{if(this[_0x7a2f('0x5d')](_0x51bdc7)){if(this[_0x7a2f('0x14')][_0x51bdc7['uniqueid']]){var _0x198be2=_[_0x7a2f('0x7a')](this[_0x7a2f('0x14')][_0x51bdc7[_0x7a2f('0x6a')]]);_0x198be2[_0x7a2f('0x7b')]=moment()['format'](_0x7a2f('0x6c'));_0x198be2['connectedlinenum']=_0x51bdc7[_0x7a2f('0x7c')];_0x198be2[_0x7a2f('0x7d')]=_0x51bdc7[_0x7a2f('0x7d')];this[_0x7a2f('0x3a')][_0x51bdc7[_0x7a2f('0x6a')]]=_0x198be2;this[_0x7a2f('0x47')](_0x198be2);}}}catch(_0x41e4ae){logger[_0x7a2f('0x40')](_0x7a2f('0x7e'),util[_0x7a2f('0x68')](_0x41e4ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7a2f('0xf')]['syncAgentConnect']=function(_0x207678){try{if(this[_0x7a2f('0x5d')](_0x207678)){if(this['queueReports'][_0x207678[_0x7a2f('0x6a')]]){var _0x543aa0=_[_0x7a2f('0x7a')](this[_0x7a2f('0x14')][_0x207678[_0x7a2f('0x6a')]]);_0x543aa0[_0x7a2f('0x72')]=!![];_0x543aa0['queuecallerexitreason']=_0x7a2f('0x7f');}}}catch(_0x3934e2){logger[_0x7a2f('0x40')](_0x7a2f('0x80'),util[_0x7a2f('0x68')](_0x3934e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7a2f('0x81')]=function(_0x5bcac1){try{if(this[_0x7a2f('0x5d')](_0x5bcac1)){if(this[_0x7a2f('0x14')][_0x5bcac1[_0x7a2f('0x6a')]]){var _0x2f4c8b=_[_0x7a2f('0x7a')](this[_0x7a2f('0x14')][_0x5bcac1['uniqueid']]);_0x2f4c8b[_0x7a2f('0x20')]=![];_0x2f4c8b[_0x7a2f('0x82')]=null;_0x2f4c8b[_0x7a2f('0x83')]=!![];_0x2f4c8b['lastAssignedTo']=_0x5bcac1[_0x7a2f('0x84')];_0x2f4c8b[_0x7a2f('0x74')]=_0x5bcac1['holdtime'];_0x2f4c8b[_0x7a2f('0x72')]=!![];_0x2f4c8b[_0x7a2f('0x85')]=![];_0x2f4c8b[_0x7a2f('0x86')]=null;if(!_0x2f4c8b[_0x7a2f('0x87')]){if(_0x5bcac1[_0x7a2f('0x88')]=='transfer'){_0x2f4c8b['queuecallerexitreason']=_0x7a2f('0x89');}else{if(_[_0x7a2f('0x8a')](_0x5bcac1['channel'][_0x7a2f('0x8b')](),_0x7a2f('0x8c'))){if(this[_0x7a2f('0x14')][_0x5bcac1[_0x7a2f('0x8d')]]){var _0x555cc5=_[_0x7a2f('0x7a')](this[_0x7a2f('0x14')][_0x5bcac1['linkedid']]);_0x555cc5['queuecallercomplete']=![];_0x555cc5['queuecallerexit']=!![];_0x555cc5['queuecallerexitAt']=moment(_0x2f4c8b[_0x7a2f('0x6b')])['add'](_0x5bcac1[_0x7a2f('0x74')],_0x7a2f('0x8e'))['format'](_0x7a2f('0x6c'));_0x555cc5[_0x7a2f('0x76')]='FORWARDTRANSFER';_0x555cc5[_0x7a2f('0x87')]=!![];_0x555cc5[_0x7a2f('0x8f')]=_0x7a2f('0x90');_0x555cc5[_0x7a2f('0x91')]=_0x5bcac1[_0x7a2f('0x92')];_0x555cc5['transferuniqueid']=_0x5bcac1[_0x7a2f('0x6a')];var _0x47332a=this[_0x7a2f('0x14')][_0x5bcac1[_0x7a2f('0x8d')]];this['queueReports'][_0x5bcac1['linkedid']]=this[_0x7a2f('0x14')][_0x5bcac1['uniqueid']];this[_0x7a2f('0x14')][_0x5bcac1[_0x7a2f('0x6a')]]=_0x47332a;}}else{_0x2f4c8b['queuecallerexitreason']=_0x7a2f('0x93')+_0x5bcac1[_0x7a2f('0x88')][_0x7a2f('0x94')]();}}}this[_0x7a2f('0x3a')][_0x5bcac1[_0x7a2f('0x6a')]]=_0x2f4c8b;this[_0x7a2f('0x45')](_0x2f4c8b);}}}catch(_0x18094d){logger['error'](_0x7a2f('0x95'),util[_0x7a2f('0x68')](_0x18094d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7a2f('0xf')][_0x7a2f('0x96')]=function(_0x3ea269){try{if(this[_0x7a2f('0x5d')](_0x3ea269)){this[_0x7a2f('0x97')](_0x3ea269[_0x7a2f('0x6a')],_[_0x7a2f('0x70')](_0x3ea269[_0x7a2f('0x98')])[0x0],_0x3ea269[_0x7a2f('0x99')]);if(this[_0x7a2f('0x14')][_0x3ea269[_0x7a2f('0x6a')]]){var _0x393043=_[_0x7a2f('0x7a')](this[_0x7a2f('0x14')][_0x3ea269[_0x7a2f('0x6a')]]);if(_0x393043){if(this['isNotNull'](_0x3ea269[_0x7a2f('0x98')])&&this['isNotNull'](_0x3ea269[_0x7a2f('0x98')][_0x7a2f('0x9a')])){switch(_0x3ea269[_0x7a2f('0x99')]){case _0x7a2f('0x9b'):_0x393043['queuecallerexit']=![];_0x393043[_0x7a2f('0x86')]=null;break;case _0x7a2f('0x9c'):_0x393043[_0x7a2f('0x9d')]=_0x7a2f('0x9e');ami[_0x7a2f('0x46')](_0x7a2f('0x9f'),_0x393043);break;default:_0x393043[_0x7a2f('0x85')]=!![];_0x393043[_0x7a2f('0x86')]=moment()['format'](_0x7a2f('0x6c'));_0x393043['queuecallerleaveAt']=moment()[_0x7a2f('0x48')](_0x7a2f('0x6c'));}_0x393043['queuecallerabandon']=![];_0x393043['queuecallerabandonAt']=null;_0x393043['queuecallerexitreason']=_0x3ea269[_0x7a2f('0x99')];this[_0x7a2f('0x3a')][_0x3ea269[_0x7a2f('0x6a')]]=_0x393043;this[_0x7a2f('0x45')](_0x393043);}else if(this[_0x7a2f('0x5d')](_0x3ea269['variable'])&&this[_0x7a2f('0x5d')](_0x3ea269[_0x7a2f('0x98')][_0x7a2f('0xa0')])){if(!_0x393043[_0x7a2f('0x20')]){_0x393043[_0x7a2f('0x85')]=!![];_0x393043[_0x7a2f('0x86')]=moment()[_0x7a2f('0x48')](_0x7a2f('0x6c'));_0x393043[_0x7a2f('0x76')]='EXITWITHKEY';_0x393043[_0x7a2f('0x7b')]=moment()[_0x7a2f('0x48')](_0x7a2f('0x6c'));this['channels'][_0x3ea269[_0x7a2f('0x6a')]]=_0x393043;}}_0x393043['variables']=this[_0x7a2f('0x18')][_0x3ea269[_0x7a2f('0x6a')]];}}}}catch(_0xb79f9f){logger['error'](_0x7a2f('0xa1'),util[_0x7a2f('0x68')](_0xb79f9f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7a2f('0x97')]=function(_0x39fa7d,_0x2de20c,_0x1c3753){var _0x1f5114=[_0x7a2f('0xa2'),_0x7a2f('0xa3'),_0x7a2f('0xa4'),_0x7a2f('0xa5'),'rtpaudioqosloss',_0x7a2f('0xa6'),_0x7a2f('0xa7'),_0x7a2f('0xa8'),'sipcallid',_0x7a2f('0xa9'),'bridgepeer',_0x7a2f('0xaa'),_0x7a2f('0xab'),_0x7a2f('0xac'),_0x7a2f('0xad'),_0x7a2f('0xae'),'membername','memberpenalty',_0x7a2f('0xaf')];if(!_[_0x7a2f('0x3b')](_0x2de20c)&&!_['includes'](_0x1f5114,_0x2de20c)){if(_['isUndefined'](this['variables'][_0x39fa7d])){this[_0x7a2f('0x18')][_0x39fa7d]={};}this[_0x7a2f('0x18')][_0x39fa7d][_0x2de20c]=_0x1c3753;}};VoiceQueueReport[_0x7a2f('0xf')][_0x7a2f('0x27')]=function(_0x3c4fb4){try{if(this[_0x7a2f('0x5d')](_0x3c4fb4)){if(this[_0x7a2f('0x14')][_0x3c4fb4[_0x7a2f('0x6a')]]){for(var _0x440ec5=0x0,_0x7a9725={};_0x440ec5=0x0?moment(_0x13b981[_0x597f('0x15')])['diff'](_0x13b981[_0x597f('0x14')],'seconds'):null,'data1':_0x597f('0x17'),'data2':_0x13b981['accountcode'],'data3':_0x13b981[_0x597f('0xf')],'data4':_0x13b981[_0x597f('0x18')]||null,'role':_0x597f('0x19'),'internal':_0x13b981[_0x597f('0x11')]?_[_0x597f('0x12')](_0x13b981[_0x597f('0x11')]):undefined,'uniqueid':_0x13b981[_0x597f('0x1a')]},'log':_0x597f('0x5')});}; \ No newline at end of file +var _0x3c1f=['voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','seconds','outbound','exten','dialstring','lodash','util','../client'];(function(_0x3509d8,_0x5074b5){var _0x4dcedb=function(_0x164ac4){while(--_0x164ac4){_0x3509d8['push'](_0x3509d8['shift']());}};_0x4dcedb(++_0x5074b5);}(_0x3c1f,0x115));var _0xf3c1=function(_0x748f14,_0x5d14c9){_0x748f14=_0x748f14-0x0;var _0x47d104=_0x3c1f[_0x748f14];return _0x47d104;};'use strict';var moment=require('moment');var _=require(_0xf3c1('0x0'));var util=require(_0xf3c1('0x1'));var client=require(_0xf3c1('0x2'));exports[_0xf3c1('0x3')]=function(_0x5b6b85){var _0xa94e06=_0x5b6b85[_0xf3c1('0x4')]||_0x5b6b85[_0xf3c1('0x5')];return client[_0xf3c1('0x6')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x5b6b85[_0xf3c1('0x7')],'interface':_[_0xf3c1('0x8')](_0x5b6b85[_0xf3c1('0x9')])?util['format'](_0xf3c1('0xa'),_0x5b6b85[_0xf3c1('0x7')]):_0x5b6b85[_0xf3c1('0x9')],'type':_0xf3c1('0xb'),'enterAt':_0x5b6b85[_0xf3c1('0xc')],'exitAt':_0xa94e06,'duration':moment(_0xa94e06)[_0xf3c1('0xd')](_0x5b6b85[_0xf3c1('0xc')],'seconds'),'data1':_0xf3c1('0xe'),'data2':_0x5b6b85[_0xf3c1('0xf')],'data3':_0x5b6b85['exten'],'data4':null,'data5':_0x5b6b85['queue'],'role':_0xf3c1('0x10'),'internal':_0x5b6b85[_0xf3c1('0x11')]?_[_0xf3c1('0x12')](_0x5b6b85[_0xf3c1('0x11')]):undefined,'uniqueid':_0x5b6b85[_0xf3c1('0x13')]},'log':'CreateMemberReport'});};exports[_0xf3c1('0x14')]=function(_0x110ad5){return client[_0xf3c1('0x6')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x110ad5[_0xf3c1('0x15')],'interface':_0x110ad5[_0xf3c1('0x9')],'type':_0xf3c1('0xb'),'enterAt':_0x110ad5[_0xf3c1('0x16')],'exitAt':_0x110ad5[_0xf3c1('0x17')],'duration':moment(_0x110ad5['endtime'])[_0xf3c1('0xd')](_0x110ad5[_0xf3c1('0x16')],_0xf3c1('0x18'))>=0x0?moment(_0x110ad5['endtime'])[_0xf3c1('0xd')](_0x110ad5['starttime'],_0xf3c1('0x18')):null,'data1':_0xf3c1('0x19'),'data2':_0x110ad5[_0xf3c1('0x11')],'data3':_0x110ad5[_0xf3c1('0x1a')],'data4':_0x110ad5[_0xf3c1('0x1b')]||null,'role':_0xf3c1('0x10'),'internal':_0x110ad5[_0xf3c1('0x11')]?_[_0xf3c1('0x12')](_0x110ad5['accountcode']):undefined,'uniqueid':_0x110ad5['uniqueid']},'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 01cfb10..9b9c98d 100644 --- a/server/services/ami/rpc/template.js +++ b/server/services/ami/rpc/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9354=['getTemplates','Request','GetTemplate','name','html'];(function(_0x56cccb,_0x205a85){var _0x259719=function(_0x4eca46){while(--_0x4eca46){_0x56cccb['push'](_0x56cccb['shift']());}};_0x259719(++_0x205a85);}(_0x9354,0x96));var _0x4935=function(_0xd3348b,_0x288d47){_0xd3348b=_0xd3348b-0x0;var _0x583cdc=_0x9354[_0xd3348b];return _0x583cdc;};'use strict';var client=require('../client');exports[_0x4935('0x0')]=function(_0xc3c1f3){return function(_0x4896da){return client[_0x4935('0x1')](_0x4935('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4935('0x3'),_0x4935('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x8130=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x5e9ab7,_0x272d43){var _0x39cafc=function(_0x387c9a){while(--_0x387c9a){_0x5e9ab7['push'](_0x5e9ab7['shift']());}};_0x39cafc(++_0x272d43);}(_0x8130,0x146));var _0x0813=function(_0x5b14bb,_0x487661){_0x5b14bb=_0x5b14bb-0x0;var _0x31467f=_0x8130[_0x5b14bb];return _0x31467f;};'use strict';var client=require(_0x0813('0x0'));exports[_0x0813('0x1')]=function(_0x5038a7){return function(_0xb7d498){return client[_0x0813('0x2')](_0x0813('0x3'),{'options':{'raw':!![],'attributes':['id',_0x0813('0x4'),_0x0813('0x5')]},'log':_0x0813('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 798772b..4d2bca3 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 _0x36dc=['data7','../client','getTriggers','GetTrigger','name','channel','field','operator','Condition','AnyConditions','value','Action','Actions','action','data1','data2','data3','data5','data6'];(function(_0x476483,_0x1f3beb){var _0x3b199f=function(_0x280de2){while(--_0x280de2){_0x476483['push'](_0x476483['shift']());}};_0x3b199f(++_0x1f3beb);}(_0x36dc,0xd2));var _0xc36d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x36dc[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xc36d('0x0'));exports[_0xc36d('0x1')]=function(_0x403246){return function(_0x1e7bd3){return client['Request'](_0xc36d('0x2'),{'options':{'raw':![],'attributes':['id',_0xc36d('0x3'),_0xc36d('0x4'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xc36d('0x5'),_0xc36d('0x6'),'value']},{'model':_0xc36d('0x7'),'as':_0xc36d('0x8'),'attributes':['id',_0xc36d('0x5'),_0xc36d('0x6'),_0xc36d('0x9')]},{'model':_0xc36d('0xa'),'as':_0xc36d('0xb'),'attributes':['id',_0xc36d('0xc'),_0xc36d('0xd'),_0xc36d('0xe'),_0xc36d('0xf'),'data4',_0xc36d('0x10'),_0xc36d('0x11'),_0xc36d('0x12')]}]},'log':_0xc36d('0x2')});};}; \ No newline at end of file +var _0x2a04=['action','data1','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','value','AnyConditions','Action'];(function(_0x272eff,_0x27fba0){var _0x50b502=function(_0x39e228){while(--_0x39e228){_0x272eff['push'](_0x272eff['shift']());}};_0x50b502(++_0x27fba0);}(_0x2a04,0xc4));var _0x42a0=function(_0x1f5dbf,_0x84cde0){_0x1f5dbf=_0x1f5dbf-0x0;var _0x15be6e=_0x2a04[_0x1f5dbf];return _0x15be6e;};'use strict';var client=require(_0x42a0('0x0'));exports[_0x42a0('0x1')]=function(_0x4ab8d5){return function(_0x4e4711){return client[_0x42a0('0x2')](_0x42a0('0x3'),{'options':{'raw':![],'attributes':['id',_0x42a0('0x4'),_0x42a0('0x5'),_0x42a0('0x6')],'include':[{'model':_0x42a0('0x7'),'as':_0x42a0('0x8'),'attributes':['id',_0x42a0('0x9'),'operator',_0x42a0('0xa')]},{'model':_0x42a0('0x7'),'as':_0x42a0('0xb'),'attributes':['id',_0x42a0('0x9'),'operator','value']},{'model':_0x42a0('0xc'),'as':'Actions','attributes':['id',_0x42a0('0xd'),_0x42a0('0xe'),'data2',_0x42a0('0xf'),_0x42a0('0x10'),_0x42a0('0x11'),'data6',_0x42a0('0x12')]}]},'log':_0x42a0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 939fe5e..0067fe7 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 _0x5bf1=['Request','GetTrunk','getTrunks'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bf1,0x11f));var _0x15bf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5bf1[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x15bf('0x0')]=function(_0x28312f){return function(_0x1fa521){return client[_0x15bf('0x1')](_0x15bf('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry']},'log':_0x15bf('0x2')});};}; \ No newline at end of file +var _0xb420=['GetTrunk','name','registry','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb420,0x10c));var _0x0b42=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb420[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x0b42('0x0'));exports['getTrunks']=function(_0x19a59f){return function(_0x5cbc0c){return client[_0x0b42('0x1')](_0x0b42('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0b42('0x3'),_0x0b42('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 5b5ac24..5d492cd 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 _0x3fad=['mobile','interface','telephone','internal','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone'];(function(_0x25b854,_0x2e19ff){var _0x35bcd8=function(_0x368c59){while(--_0x368c59){_0x25b854['push'](_0x25b854['shift']());}};_0x35bcd8(++_0x2e19ff);}(_0x3fad,0xa1));var _0xd3fa=function(_0xbdd50b,_0xb7f133){_0xbdd50b=_0xbdd50b-0x0;var _0x2c20e5=_0x3fad[_0xbdd50b];return _0x2c20e5;};'use strict';var client=require(_0xd3fa('0x0'));exports[_0xd3fa('0x1')]=function(){return function(){return client[_0xd3fa('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0xd3fa('0x3')},'attributes':['id',_0xd3fa('0x4'),_0xd3fa('0x5'),_0xd3fa('0x6'),_0xd3fa('0x7'),_0xd3fa('0x8'),_0xd3fa('0x9'),_0xd3fa('0xa'),_0xd3fa('0xb'),_0xd3fa('0xc'),_0xd3fa('0xd'),_0xd3fa('0xe'),_0xd3fa('0xf')]},'log':_0xd3fa('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0xd3fa('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xd3fa('0x10')},'attributes':['id',_0xd3fa('0x4'),'accountcode',_0xd3fa('0x11')]},'log':_0xd3fa('0x12')});};};exports[_0xd3fa('0x13')]=function(_0x4250fe,_0x503350,_0x228250){return client[_0xd3fa('0x2')](_0xd3fa('0x14'),{'body':{'type':_0x503350,'uniqueid':_0x228250},'options':{'where':{'id':_0x4250fe['id']}},'log':_0xd3fa('0x13')});};exports[_0xd3fa('0x15')]=function(_0x51eba7){return client[_0xd3fa('0x2')](_0xd3fa('0x16'),{'body':{},'options':{'where':{'id':_0x51eba7['id']}},'log':_0xd3fa('0x13')});};exports[_0xd3fa('0x17')]=function(_0x341a4a){return client[_0xd3fa('0x2')](_0xd3fa('0x18'),{'options':{'raw':![],'where':{'role':_0xd3fa('0x3'),'id':_0x341a4a},'attributes':['id',_0xd3fa('0x4'),_0xd3fa('0x5'),_0xd3fa('0x6'),_0xd3fa('0x7'),'online',_0xd3fa('0x9'),_0xd3fa('0xa'),'lastPauseAt','voicePause',_0xd3fa('0xf')]},'log':_0xd3fa('0x17')});}; \ No newline at end of file +var _0x9b73=['ShowUser','name','lastPauseAt','../client','getAgents','GetUser','agent','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','interface','Request','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent'];(function(_0x5c0d6b,_0x3f8b79){var _0x5f1f35=function(_0x36ac53){while(--_0x36ac53){_0x5c0d6b['push'](_0x5c0d6b['shift']());}};_0x5f1f35(++_0x3f8b79);}(_0x9b73,0x123));var _0x39b7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9b73[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x39b7('0x0'));exports[_0x39b7('0x1')]=function(){return function(){return client['Request'](_0x39b7('0x2'),{'options':{'raw':![],'where':{'role':_0x39b7('0x3')},'attributes':['id','name',_0x39b7('0x4'),_0x39b7('0x5'),_0x39b7('0x6'),_0x39b7('0x7'),_0x39b7('0x8'),_0x39b7('0x9'),'lastPauseAt',_0x39b7('0xa'),_0x39b7('0xb'),_0x39b7('0xc'),_0x39b7('0xd')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0x39b7('0xe')](_0x39b7('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id','name',_0x39b7('0x5'),_0x39b7('0xf')]},'log':'getTelephones'});};};exports[_0x39b7('0x10')]=function(_0x2b8398,_0x30aa4e,_0x499f4e){return client[_0x39b7('0xe')](_0x39b7('0x11'),{'body':{'type':_0x30aa4e,'uniqueid':_0x499f4e},'options':{'where':{'id':_0x2b8398['id']}},'log':_0x39b7('0x10')});};exports[_0x39b7('0x12')]=function(_0x397f18){return client[_0x39b7('0xe')](_0x39b7('0x13'),{'body':{},'options':{'where':{'id':_0x397f18['id']}},'log':'savePause'});};exports[_0x39b7('0x14')]=function(_0x36010b){return client[_0x39b7('0xe')](_0x39b7('0x15'),{'options':{'raw':![],'where':{'role':'agent','id':_0x36010b},'attributes':['id',_0x39b7('0x16'),_0x39b7('0x4'),_0x39b7('0x5'),_0x39b7('0x6'),_0x39b7('0x7'),'lastLoginAt',_0x39b7('0x9'),_0x39b7('0x17'),'voicePause',_0x39b7('0xd')]},'log':_0x39b7('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 480789f..6dd51b0 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 _0x9fee=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x3e1990,_0x4670dc){var _0x41ad40=function(_0x652933){while(--_0x652933){_0x3e1990['push'](_0x3e1990['shift']());}};_0x41ad40(++_0x4670dc);}(_0x9fee,0xc5));var _0xe9fe=function(_0x35efc7,_0x9f485f){_0x35efc7=_0x35efc7-0x0;var _0x38d24c=_0x9fee[_0x35efc7];return _0x38d24c;};'use strict';var client=require('../client');exports[_0xe9fe('0x0')]=function(_0x197ca1){return client[_0xe9fe('0x1')]('CreateVoiceAgentReport',{'body':_0x197ca1,'log':_0xe9fe('0x2')});};exports[_0xe9fe('0x3')]=function(_0x41414b,_0x4c8761,_0x140886){return client[_0xe9fe('0x1')](_0xe9fe('0x4'),{'body':_0x41414b,'options':{'where':{'uniqueid':_0x4c8761,'interface':_0x140886,'agentcomplete':!![]}},'log':_0xe9fe('0x4')});}; \ No newline at end of file +var _0xb846=['update','../client','create','Request','CreateVoiceAgentReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb846,0x15a));var _0x6b84=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb846[_0x138adb];return _0x1b27f2;};'use strict';var client=require(_0x6b84('0x0'));exports[_0x6b84('0x1')]=function(_0x447934){return client[_0x6b84('0x2')](_0x6b84('0x3'),{'body':_0x447934,'log':_0x6b84('0x3')});};exports[_0x6b84('0x4')]=function(_0x3c9dad,_0x272787,_0x1d8aeb){return client['Request']('UpdateVoiceAgentReport',{'body':_0x3c9dad,'options':{'where':{'uniqueid':_0x272787,'interface':_0x1d8aeb,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3ccece4..d08e6be 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 _0xa926=['billableseconds','GetVoiceCallReports','moment','util','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','format','type','duration'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa926,0x92));var _0x6a92=function(_0x24bb2b,_0x112c46){_0x24bb2b=_0x24bb2b-0x0;var _0x2ca12d=_0xa926[_0x24bb2b];return _0x2ca12d;};'use strict';var moment=require(_0x6a92('0x0'));var util=require(_0x6a92('0x1'));var _=require('lodash');var client=require('../client');exports['create']=function(_0x2b1a36){return client[_0x6a92('0x2')](_0x6a92('0x3'),{'body':_[_0x6a92('0x4')](_0x2b1a36,{'source':_0x2b1a36[_0x6a92('0x5')],'destinationcontext':_0x2b1a36[_0x6a92('0x6')],'callerid':_0x2b1a36[_0x6a92('0x7')],'amaflags':_0x6a92('0x8')}),'log':_0x6a92('0x3')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x6a92('0x2')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x6a92('0x9')],'createdAt':{'$between':[moment()[_0x6a92('0xa')](_0x6a92('0xb'))['format'](_0x6a92('0xc')),moment()['endOf']('day')[_0x6a92('0xd')](_0x6a92('0xc'))]}},'attributes':[_0x6a92('0xe'),'disposition',_0x6a92('0xf'),_0x6a92('0x10')]},'log':_0x6a92('0x11')});};}; \ No newline at end of file +var _0x3f42=['util','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','moment'];(function(_0x47d11c,_0x4815d2){var _0x45b959=function(_0x238d55){while(--_0x238d55){_0x47d11c['push'](_0x47d11c['shift']());}};_0x45b959(++_0x4815d2);}(_0x3f42,0x84));var _0x23f4=function(_0x4cdcd0,_0x359529){_0x4cdcd0=_0x4cdcd0-0x0;var _0x5b4abf=_0x3f42[_0x4cdcd0];return _0x5b4abf;};'use strict';var moment=require(_0x23f4('0x0'));var util=require(_0x23f4('0x1'));var _=require('lodash');var client=require(_0x23f4('0x2'));exports['create']=function(_0x401af7){return client[_0x23f4('0x3')](_0x23f4('0x4'),{'body':_[_0x23f4('0x5')](_0x401af7,{'source':_0x401af7[_0x23f4('0x6')],'destinationcontext':_0x401af7[_0x23f4('0x7')],'callerid':_0x401af7[_0x23f4('0x8')],'amaflags':_0x23f4('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0x23f4('0xa')]=function(){return function(){return client[_0x23f4('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x23f4('0xb')],'createdAt':{'$between':[moment()[_0x23f4('0xc')]('day')[_0x23f4('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x23f4('0xe')]('day')[_0x23f4('0xd')](_0x23f4('0xf'))]}},'attributes':[_0x23f4('0x10'),_0x23f4('0x11'),'duration',_0x23f4('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5e5d8c2..b072e19 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 _0x7ee7=['../client','create','Request','CreateVoiceDialReport'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x7ee7,0x6c));var _0x77ee=function(_0x30044d,_0x5f23e3){_0x30044d=_0x30044d-0x0;var _0x33403a=_0x7ee7[_0x30044d];return _0x33403a;};'use strict';var client=require(_0x77ee('0x0'));exports[_0x77ee('0x1')]=function(_0x4f11f8){return client[_0x77ee('0x2')](_0x77ee('0x3'),{'body':_0x4f11f8,'log':_0x77ee('0x3')});}; \ No newline at end of file +var _0x5b2a=['CreateVoiceDialReport','../client','create'];(function(_0xac5ab,_0x25058b){var _0x360cd2=function(_0x59f9eb){while(--_0x59f9eb){_0xac5ab['push'](_0xac5ab['shift']());}};_0x360cd2(++_0x25058b);}(_0x5b2a,0x1d5));var _0xa5b2=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x5b2a[_0x186d17];return _0x5d4b89;};'use strict';var client=require(_0xa5b2('0x0'));exports[_0xa5b2('0x1')]=function(_0x21ed53){return client['Request'](_0xa5b2('0x2'),{'body':_0x21ed53,'log':_0xa5b2('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2bd4abe..146f8fc 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 _0x1730=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x4621c7,_0x24f171){var _0x2a83d6=function(_0x3a7008){while(--_0x3a7008){_0x4621c7['push'](_0x4621c7['shift']());}};_0x2a83d6(++_0x24f171);}(_0x1730,0xda));var _0x0173=function(_0x840c6,_0x2dbd10){_0x840c6=_0x840c6-0x0;var _0x3cc3a3=_0x1730[_0x840c6];return _0x3cc3a3;};'use strict';var client=require('../client');exports[_0x0173('0x0')]=function(){return function(){return client[_0x0173('0x1')](_0x0173('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0173('0x3'),_0x0173('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0173('0x0')});};}; \ No newline at end of file +var _0x41fa=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x41fa,0x1f1));var _0xa41f=function(_0x4360c4,_0x2f8209){_0x4360c4=_0x4360c4-0x0;var _0x3168c8=_0x41fa[_0x4360c4];return _0x3168c8;};'use strict';var client=require(_0xa41f('0x0'));exports[_0xa41f('0x1')]=function(){return function(){return client[_0xa41f('0x2')](_0xa41f('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa41f('0x4'),_0xa41f('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d5b5783..b45f116 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 _0x6462=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','name','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x1cdfbf,_0x202c71){var _0x37c916=function(_0x15e868){while(--_0x15e868){_0x1cdfbf['push'](_0x1cdfbf['shift']());}};_0x37c916(++_0x202c71);}(_0x6462,0x90));var _0x2646=function(_0x3ba753,_0x2f3216){_0x3ba753=_0x3ba753-0x0;var _0x2f469a=_0x6462[_0x3ba753];return _0x2f469a;};'use strict';var client=require(_0x2646('0x0'));exports[_0x2646('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2646('0x2'),_0x2646('0x3'),_0x2646('0x4'),'autopause',_0x2646('0x5'),'type',_0x2646('0x6'),_0x2646('0x7'),_0x2646('0x8'),'dialLimitQueue','dialPowerLevel',_0x2646('0x9'),_0x2646('0xa'),_0x2646('0xb'),_0x2646('0xc'),_0x2646('0xd'),_0x2646('0xe'),'dialQueueOptions','dialQueueTimeout',_0x2646('0xf'),_0x2646('0x10'),_0x2646('0x11'),_0x2646('0x12'),_0x2646('0x13'),_0x2646('0x14'),_0x2646('0x15'),'dialGlobalMaxRetry',_0x2646('0x16'),_0x2646('0x17'),'dialPrefix',_0x2646('0x18'),_0x2646('0x19'),_0x2646('0x1a'),'dialAMDGreeting',_0x2646('0x1b'),_0x2646('0x1c'),_0x2646('0x1d'),_0x2646('0x1e'),_0x2646('0x1f'),_0x2646('0x20'),_0x2646('0x21'),_0x2646('0x22'),_0x2646('0x23'),_0x2646('0x24'),'dialOrderByScheduledAt',_0x2646('0x25'),_0x2646('0x26'),_0x2646('0x27'),_0x2646('0x5'),'strategy','dialRandomLastDigitCallerIdNumber',_0x2646('0x28'),_0x2646('0x29'),_0x2646('0x2a'),_0x2646('0x2b'),'dialDropRetryFrequency',_0x2646('0x2c'),'dialAbandonedRetryFrequency',_0x2646('0x2d'),_0x2646('0x2e'),_0x2646('0x2f'),'dialAgentRejectRetryFrequency',_0x2646('0x30'),_0x2646('0x31'),_0x2646('0x32')],'include':[{'model':_0x2646('0x33'),'as':'Trunk','attributes':['id','name',_0x2646('0x34'),_0x2646('0x35')]},{'model':'Pause','as':_0x2646('0x36'),'attributes':['id',_0x2646('0x2')]},{'model':_0x2646('0x33'),'as':_0x2646('0x37'),'attributes':['id','name',_0x2646('0x34'),_0x2646('0x35')]},{'model':_0x2646('0x38'),'as':_0x2646('0x38'),'attributes':['id',_0x2646('0x2')],'include':[{'model':_0x2646('0x38'),'as':'Intervals','attributes':['id',_0x2646('0x2'),_0x2646('0x39')]}]}]},'log':_0x2646('0x1')});};}; \ No newline at end of file +var _0xb282=['dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout'];(function(_0x96379,_0x11e230){var _0x3e3a01=function(_0xe53937){while(--_0xe53937){_0x96379['push'](_0x96379['shift']());}};_0x3e3a01(++_0x11e230);}(_0xb282,0xa2));var _0x2b28=function(_0x429e7e,_0x5ae693){_0x429e7e=_0x429e7e-0x0;var _0x22c7d7=_0xb282[_0x429e7e];return _0x22c7d7;};'use strict';var client=require(_0x2b28('0x0'));exports[_0x2b28('0x1')]=function(){return function(){return client[_0x2b28('0x2')](_0x2b28('0x3'),{'options':{'raw':![],'attributes':['id',_0x2b28('0x4'),_0x2b28('0x5'),'acwTimeout','autopause',_0x2b28('0x6'),_0x2b28('0x7'),_0x2b28('0x8'),_0x2b28('0x9'),_0x2b28('0xa'),'dialLimitQueue',_0x2b28('0xb'),'dialPredictiveOptimization',_0x2b28('0xc'),_0x2b28('0xd'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x2b28('0xe'),'dialQueueOptions','dialQueueTimeout',_0x2b28('0xf'),'dialCongestionMaxRetry',_0x2b28('0x10'),_0x2b28('0x11'),'dialBusyRetryFrequency',_0x2b28('0x12'),_0x2b28('0x13'),'dialGlobalMaxRetry',_0x2b28('0x14'),_0x2b28('0x15'),'dialPrefix',_0x2b28('0x16'),_0x2b28('0x17'),'dialAMDInitialSilence',_0x2b28('0x18'),_0x2b28('0x19'),'dialAMDTotalAnalysisTime',_0x2b28('0x1a'),_0x2b28('0x1b'),_0x2b28('0x1c'),_0x2b28('0x1d'),_0x2b28('0x1e'),_0x2b28('0x1f'),_0x2b28('0x20'),_0x2b28('0x21'),'dialOrderByScheduledAt',_0x2b28('0x22'),_0x2b28('0x23'),_0x2b28('0x24'),_0x2b28('0x6'),_0x2b28('0x25'),'dialRandomLastDigitCallerIdNumber',_0x2b28('0x26'),_0x2b28('0x27'),_0x2b28('0x28'),_0x2b28('0x29'),_0x2b28('0x2a'),_0x2b28('0x2b'),_0x2b28('0x2c'),_0x2b28('0x2d'),_0x2b28('0x2e'),_0x2b28('0x2f'),_0x2b28('0x30'),_0x2b28('0x31'),'dialPredictiveIntervalMaxThreshold',_0x2b28('0x32')],'include':[{'model':'Trunk','as':_0x2b28('0x33'),'attributes':['id',_0x2b28('0x4'),_0x2b28('0x34'),_0x2b28('0x35')]},{'model':_0x2b28('0x36'),'as':_0x2b28('0x37'),'attributes':['id',_0x2b28('0x4')]},{'model':_0x2b28('0x33'),'as':_0x2b28('0x38'),'attributes':['id',_0x2b28('0x4'),'callerid',_0x2b28('0x35')]},{'model':_0x2b28('0x39'),'as':_0x2b28('0x39'),'attributes':['id',_0x2b28('0x4')],'include':[{'model':_0x2b28('0x39'),'as':'Intervals','attributes':['id',_0x2b28('0x4'),_0x2b28('0x3a')]}]}]},'log':_0x2b28('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7598762..1a24d4a 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 _0x2136=['CreateVoiceQueueReport','Request','startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports','moment','lodash','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2136,0xda));var _0x6213=function(_0x4be563,_0x371f7d){_0x4be563=_0x4be563-0x0;var _0xa7d890=_0x2136[_0x4be563];return _0xa7d890;};'use strict';var moment=require(_0x6213('0x0'));var _=require(_0x6213('0x1'));var client=require('../client');exports[_0x6213('0x2')]=function(_0x2371fb){return client['Request'](_0x6213('0x3'),{'body':_0x2371fb,'log':_0x6213('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x6213('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x6213('0x5')]('day')[_0x6213('0x6')](_0x6213('0x7')),moment()['endOf'](_0x6213('0x8'))[_0x6213('0x6')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid','queue',_0x6213('0x9'),_0x6213('0xa'),_0x6213('0xb'),_0x6213('0xc'),_0x6213('0xd'),_0x6213('0xe'),_0x6213('0xf'),'queuecallerabandonAt']},'log':_0x6213('0x10')});};}; \ No newline at end of file +var _0xa5d1=['uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0xa5d1,0x1c2));var _0x1a5d=function(_0x1b286a,_0x506a9d){_0x1b286a=_0x1b286a-0x0;var _0x312f1b=_0xa5d1[_0x1b286a];return _0x312f1b;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0x1a5d('0x0'));exports[_0x1a5d('0x1')]=function(_0x5ec899){return client[_0x1a5d('0x2')](_0x1a5d('0x3'),{'body':_0x5ec899,'log':_0x1a5d('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request'](_0x1a5d('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1a5d('0x5')](_0x1a5d('0x6'))[_0x1a5d('0x7')](_0x1a5d('0x8')),moment()[_0x1a5d('0x9')](_0x1a5d('0x6'))['format'](_0x1a5d('0x8'))]}},'attributes':[_0x1a5d('0xa'),_0x1a5d('0xb'),_0x1a5d('0xc'),_0x1a5d('0xd'),_0x1a5d('0xe'),_0x1a5d('0xf'),_0x1a5d('0x10'),'queuecallerexitAt',_0x1a5d('0x11'),_0x1a5d('0x12')]},'log':_0x1a5d('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 97775bd..7ceb30b 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 _0xb668=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x150ffe,_0x4c3b88){var _0x1715ff=function(_0x1916a3){while(--_0x1916a3){_0x150ffe['push'](_0x150ffe['shift']());}};_0x1715ff(++_0x4c3b88);}(_0xb668,0x1ec));var _0x8b66=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb668[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x8b66('0x0'));exports[_0x8b66('0x1')]=function(_0x73e669){return function(){return client[_0x8b66('0x2')](_0x8b66('0x3'),{'options':{'where':{'VoiceQueueId':_0x73e669,'paused':!![]},'raw':!![]},'log':_0x8b66('0x1')});};}; \ No newline at end of file +var _0x7364=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x5dfe9b,_0x318b85){var _0x3bb0f4=function(_0x9f12f3){while(--_0x9f12f3){_0x5dfe9b['push'](_0x5dfe9b['shift']());}};_0x3bb0f4(++_0x318b85);}(_0x7364,0x143));var _0x4736=function(_0x36af10,_0x287853){_0x36af10=_0x36af10-0x0;var _0x525d8b=_0x7364[_0x36af10];return _0x525d8b;};'use strict';var client=require(_0x4736('0x0'));exports[_0x4736('0x1')]=function(_0x152ca7){return function(){return client[_0x4736('0x2')](_0x4736('0x3'),{'options':{'where':{'VoiceQueueId':_0x152ca7,'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 c107395..d6a0101 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 _0xb545=['lodash','../client','create','Request','monitorFilename'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xb545,0x12c));var _0x5b54=function(_0x10984b,_0x532410){_0x10984b=_0x10984b-0x0;var _0x56f7e7=_0xb545[_0x10984b];return _0x56f7e7;};'use strict';var _=require(_0x5b54('0x0'));var client=require(_0x5b54('0x1'));exports[_0x5b54('0x2')]=function(_0x2f274d){return client[_0x5b54('0x3')]('CreateVoiceRecording',{'body':_['merge'](_0x2f274d,{'value':_0x2f274d[_0x5b54('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x2f35=['merge','monitorFilename','lodash','CreateVoiceRecording'];(function(_0x365b05,_0x29559a){var _0x4bcf28=function(_0x5eb571){while(--_0x5eb571){_0x365b05['push'](_0x365b05['shift']());}};_0x4bcf28(++_0x29559a);}(_0x2f35,0xa6));var _0x52f3=function(_0x5a8611,_0x515fba){_0x5a8611=_0x5a8611-0x0;var _0x325dcf=_0x2f35[_0x5a8611];return _0x325dcf;};'use strict';var _=require(_0x52f3('0x0'));var client=require('../client');exports['create']=function(_0x3dbeef){return client['Request'](_0x52f3('0x1'),{'body':_[_0x52f3('0x2')](_0x3dbeef,{'value':_0x3dbeef[_0x52f3('0x3')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 29da538..c38bf54 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 _0x0d4f=['transfertargetlinkedid','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x279452,_0xe2d191){var _0x4d2261=function(_0x48e0eb){while(--_0x48e0eb){_0x279452['push'](_0x279452['shift']());}};_0x4d2261(++_0xe2d191);}(_0x0d4f,0x1b2));var _0xf0d4=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x0d4f[_0x16de68];return _0x1c277e;};'use strict';var client=require(_0xf0d4('0x0'));exports[_0xf0d4('0x1')]=function(_0x3a2e41){return client[_0xf0d4('0x2')](_0xf0d4('0x3'),{'body':{'result':_0x3a2e41['result'],'transfererchannel':_0x3a2e41['transfererchannel'],'transferercalleridnum':_0x3a2e41[_0xf0d4('0x4')],'transferercalleridname':_0x3a2e41[_0xf0d4('0x5')],'transfererconnectedlinenum':_0x3a2e41[_0xf0d4('0x6')],'transfererconnectedlinename':_0x3a2e41[_0xf0d4('0x7')],'transfereraccountcode':_0x3a2e41[_0xf0d4('0x8')],'transferercontext':_0x3a2e41[_0xf0d4('0x9')],'transfererexten':_0x3a2e41[_0xf0d4('0xa')],'transfererlinkedid':_0x3a2e41['transfererlinkedid'],'transfereechannel':_0x3a2e41[_0xf0d4('0xb')],'transfereecalleridnum':_0x3a2e41[_0xf0d4('0xc')],'transfereecalleridname':_0x3a2e41[_0xf0d4('0xd')],'transfereeconnectedlinenum':_0x3a2e41['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3a2e41['transfereeconnectedlinename'],'transfereeaccountcode':_0x3a2e41[_0xf0d4('0xe')],'transfereecontext':_0x3a2e41['transfereecontext'],'transfereeexten':_0x3a2e41['transfereeexten'],'transfereelinkedid':_0x3a2e41['transfereelinkedid'],'isexternal':_0x3a2e41[_0xf0d4('0xf')],'context':_0x3a2e41[_0xf0d4('0x10')],'extension':_0x3a2e41[_0xf0d4('0x11')],'type':_0xf0d4('0x12')},'log':_0xf0d4('0x3')});};exports[_0xf0d4('0x13')]=function(_0x12002a){return client[_0xf0d4('0x2')](_0xf0d4('0x3'),{'body':{'result':_0x12002a[_0xf0d4('0x14')],'transfererchannel':_0x12002a[_0xf0d4('0x15')],'transferercalleridnum':_0x12002a[_0xf0d4('0x16')],'transferercalleridname':_0x12002a['origtransferercalleridname'],'transfererconnectedlinenum':_0x12002a[_0xf0d4('0x17')],'transfererconnectedlinename':_0x12002a[_0xf0d4('0x18')],'transfereraccountcode':_0x12002a[_0xf0d4('0x19')],'transferercontext':_0x12002a[_0xf0d4('0x1a')],'transfererexten':_0x12002a[_0xf0d4('0x1b')],'transfererlinkedid':_0x12002a[_0xf0d4('0x1c')],'transfereechannel':_0x12002a[_0xf0d4('0x1d')],'transfereecalleridnum':_0x12002a['transfertargetcalleridnum'],'transfereecalleridname':_0x12002a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x12002a[_0xf0d4('0x1e')],'transfereeconnectedlinename':_0x12002a['transfertargetconnectedlinename'],'transfereeaccountcode':_0x12002a[_0xf0d4('0x1f')],'transfereecontext':_0x12002a[_0xf0d4('0x20')],'transfereeexten':_0x12002a[_0xf0d4('0x21')],'transfereelinkedid':_0x12002a[_0xf0d4('0x22')],'isexternal':_0x12002a[_0xf0d4('0xf')],'context':_0x12002a['origtransferercontext'],'extension':_0x12002a['origtransfererexten'],'type':_0xf0d4('0x23')},'log':_0xf0d4('0x3')});}; \ No newline at end of file +var _0xc05d=['transfereelinkedid','isexternal','context','extension','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeexten'];(function(_0x31987e,_0x1003ff){var _0x38e4c7=function(_0x2a0b00){while(--_0x2a0b00){_0x31987e['push'](_0x31987e['shift']());}};_0x38e4c7(++_0x1003ff);}(_0xc05d,0x103));var _0xdc05=function(_0x5c9760,_0x3c6cbb){_0x5c9760=_0x5c9760-0x0;var _0x1ea4a2=_0xc05d[_0x5c9760];return _0x1ea4a2;};'use strict';var client=require(_0xdc05('0x0'));exports[_0xdc05('0x1')]=function(_0x2b3595){return client[_0xdc05('0x2')](_0xdc05('0x3'),{'body':{'result':_0x2b3595[_0xdc05('0x4')],'transfererchannel':_0x2b3595['transfererchannel'],'transferercalleridnum':_0x2b3595['transferercalleridnum'],'transferercalleridname':_0x2b3595['transferercalleridname'],'transfererconnectedlinenum':_0x2b3595['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2b3595[_0xdc05('0x5')],'transfereraccountcode':_0x2b3595[_0xdc05('0x6')],'transferercontext':_0x2b3595['transferercontext'],'transfererexten':_0x2b3595['transfererexten'],'transfererlinkedid':_0x2b3595[_0xdc05('0x7')],'transfereechannel':_0x2b3595[_0xdc05('0x8')],'transfereecalleridnum':_0x2b3595[_0xdc05('0x9')],'transfereecalleridname':_0x2b3595[_0xdc05('0xa')],'transfereeconnectedlinenum':_0x2b3595['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2b3595[_0xdc05('0xb')],'transfereeaccountcode':_0x2b3595['transfereeaccountcode'],'transfereecontext':_0x2b3595['transfereecontext'],'transfereeexten':_0x2b3595[_0xdc05('0xc')],'transfereelinkedid':_0x2b3595[_0xdc05('0xd')],'isexternal':_0x2b3595[_0xdc05('0xe')],'context':_0x2b3595[_0xdc05('0xf')],'extension':_0x2b3595[_0xdc05('0x10')],'type':'blind'},'log':_0xdc05('0x3')});};exports['attendedTransfer']=function(_0x4c2963){return client[_0xdc05('0x2')](_0xdc05('0x3'),{'body':{'result':_0x4c2963[_0xdc05('0x4')],'transfererchannel':_0x4c2963['origtransfererchannel'],'transferercalleridnum':_0x4c2963['origtransferercalleridnum'],'transferercalleridname':_0x4c2963[_0xdc05('0x11')],'transfererconnectedlinenum':_0x4c2963[_0xdc05('0x12')],'transfererconnectedlinename':_0x4c2963[_0xdc05('0x13')],'transfereraccountcode':_0x4c2963['origtransfereraccountcode'],'transferercontext':_0x4c2963[_0xdc05('0x14')],'transfererexten':_0x4c2963[_0xdc05('0x15')],'transfererlinkedid':_0x4c2963[_0xdc05('0x16')],'transfereechannel':_0x4c2963[_0xdc05('0x17')],'transfereecalleridnum':_0x4c2963[_0xdc05('0x18')],'transfereecalleridname':_0x4c2963[_0xdc05('0x19')],'transfereeconnectedlinenum':_0x4c2963[_0xdc05('0x1a')],'transfereeconnectedlinename':_0x4c2963[_0xdc05('0x1b')],'transfereeaccountcode':_0x4c2963[_0xdc05('0x1c')],'transfereecontext':_0x4c2963['transfertargetcontext'],'transfereeexten':_0x4c2963[_0xdc05('0x1d')],'transfereelinkedid':_0x4c2963[_0xdc05('0x1e')],'isexternal':_0x4c2963[_0xdc05('0xe')],'context':_0x4c2963[_0xdc05('0x1f')],'extension':_0x4c2963[_0xdc05('0x20')],'type':_0xdc05('0x21')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3291a33..e561d0b 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 _0xd74d=['run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateStatusRealtime','pause','isConnected','asterisk','username','ami\x20disconnected','join','module','action','then','message','catch','error','pick','Command','Action','content','voiceQueues','hasOwnProperty','answered','loggedIn','sumBillable','talking','total','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','values','channels','length','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','destinationchannel','StopMixMonitor','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','context','agents','trunks','outboundChannels','campaigns'];(function(_0x2f3f44,_0x2c82d0){var _0x4186ce=function(_0x1b566c){while(--_0x1b566c){_0x2f3f44['push'](_0x2f3f44['shift']());}};_0x4186ce(++_0x2c82d0);}(_0xd74d,0x10b));var _0xdd74=function(_0x495724,_0x565d94){_0x495724=_0x495724-0x0;var _0x941847=_0xd74d[_0x495724];return _0x941847;};'use strict';var _=require(_0xdd74('0x0'));var util=require(_0xdd74('0x1'));var jayson=require(_0xdd74('0x2'));var schema=require(_0xdd74('0x3'));var BPromise=require(_0xdd74('0x4'));var moment=require(_0xdd74('0x5'));var config=require('../../../config/environment');var properties=require(_0xdd74('0x6'));var ami=require('../ami');exports[_0xdd74('0x7')]=function(_0x746c54,_0x5e5358,_0x4c14b0){return new BPromise(function(_0x388403,_0x9921c6){var _0x4ebd80={'QueuePause':function(_0x537691){return new Promise(function(_0x296a94,_0x2ca186){var _0x2333e5=util[_0xdd74('0x8')](_0xdd74('0x9'),_0xdd74('0xa'),_0x537691[_0xdd74('0xb')]);if(_0x746c54[_0xdd74('0xc')]&&_0x746c54[_0xdd74('0xc')][_0x2333e5]&&_0x746c54['timers'][_0x2333e5][_0xdd74('0xd')]){_0x746c54[_0xdd74('0xc')][_0x2333e5]['updateAcw']();}if(_0x746c54['agents'][_0x2333e5]){_0x746c54['agents'][_0x2333e5][_0xdd74('0xe')]({'statePause':_0x537691[_0xdd74('0xf')]?!![]:![]});}_0x296a94({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0xd39619){var _0xdf79ac=this;return new Promise(function(_0x254129,_0x414fbd){if(ami[_0xdd74('0x10')]()==![]){return _0x414fbd(_0xdf79ac['error'](0x1f4,[config['asterisk']['ip'],config[_0xdd74('0x11')][_0xdd74('0x12')],_0xdd74('0x13')][_0xdd74('0x14')]('\x20')));}_0xd39619=_['pick'](_0xd39619,_['keys'](properties[_0xdd74('0x15')]));_0xd39619[_0xdd74('0x16')]='Reload';return ami['Action'](_0xd39619)[_0xdd74('0x17')](function(_0x26b743){_0x254129({'code':0xc8,'message':_0x26b743[_0xdd74('0x18')]});})[_0xdd74('0x19')](function(_0x1ce5df){_0x414fbd(_0xdf79ac[_0xdd74('0x1a')](0x1f5,_0x1ce5df[_0xdd74('0x18')]));});});},'Command':function(_0x5ed2fb){var _0x3575ff=this;return new Promise(function(_0x261d28,_0x176cdc){if(ami[_0xdd74('0x10')]()==![]){return _0x176cdc(_0x3575ff[_0xdd74('0x1a')](0x1f4,[config[_0xdd74('0x11')]['ip'],config[_0xdd74('0x11')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x5ed2fb=_[_0xdd74('0x1b')](_0x5ed2fb,'command');_0x5ed2fb[_0xdd74('0x16')]=_0xdd74('0x1c');return ami[_0xdd74('0x1d')](_0x5ed2fb)['then'](function(_0x246118){_0x261d28({'code':0xc8,'message':_0x246118[_0xdd74('0x1e')]});})[_0xdd74('0x19')](function(_0xf8b224){_0x176cdc(_0x3575ff[_0xdd74('0x1a')](0x1f5,_0xf8b224[_0xdd74('0x18')]));});});},'VoiceQueues':function(_0x34a375){return new Promise(function(_0x102e1e,_0x1778c8){var _0x109426=[];for(var _0x160ab6 in _0x746c54[_0xdd74('0x1f')]){if(_0x746c54['voiceQueues'][_0xdd74('0x20')](_0x160ab6)){var _0xa0cc05=_0x746c54[_0xdd74('0x1f')][_0x160ab6];var _0x2da0f2={'id':_0xa0cc05['id'],'name':_0xa0cc05[_0xdd74('0xb')],'strategy':_0xa0cc05['strategy'],'answered':_0xa0cc05[_0xdd74('0x21')],'available':_0xa0cc05['available'],'loggedIn':_0xa0cc05[_0xdd74('0x22')],'pTalking':_0xa0cc05['pTalking'],'sumBillable':_0xa0cc05[_0xdd74('0x23')],'sumDuration':_0xa0cc05['sumDuration'],'sumHoldTime':_0xa0cc05['sumHoldTime']||0x0,'talking':_0xa0cc05[_0xdd74('0x24')],'total':_0xa0cc05[_0xdd74('0x25')],'type':_0xa0cc05['type'],'unmanaged':_0xa0cc05['unmanaged'],'abandoned':_0xa0cc05['abandoned'],'waiting':_0xa0cc05['waiting'],'loggedInDb':_0xa0cc05['loggedInDb']};if(_0xa0cc05[_0xdd74('0x26')]===_0xdd74('0x27')){_0x2da0f2[_0xdd74('0x28')]=_0xa0cc05[_0xdd74('0x28')];_0x2da0f2['dialMethod']=_0xa0cc05[_0xdd74('0x29')];_0x2da0f2[_0xdd74('0x2a')]=_0xa0cc05[_0xdd74('0x2a')];_0x2da0f2['dialOriginateCallerIdNumber']=_0xa0cc05[_0xdd74('0x2b')];_0x2da0f2[_0xdd74('0x2c')]=_0xa0cc05[_0xdd74('0x2c')];_0x2da0f2[_0xdd74('0x2d')]=_0xa0cc05['dialPrefix'];_0x2da0f2[_0xdd74('0x2e')]=_0xa0cc05[_0xdd74('0x2e')];_0x2da0f2[_0xdd74('0x2f')]=_0xa0cc05[_0xdd74('0x2f')];_0x2da0f2[_0xdd74('0x30')]=_0xa0cc05['outboundBlacklistCallsDay'];_0x2da0f2['outboundBusyCallsDay']=_0xa0cc05['outboundBusyCallsDay'];_0x2da0f2[_0xdd74('0x31')]=_0xa0cc05['outboundCongestionCallsDay'];_0x2da0f2['outboundDropCallsDayACS']=_0xa0cc05[_0xdd74('0x32')];_0x2da0f2['outboundDropCallsDayCallersExit']=_0xa0cc05[_0xdd74('0x33')];_0x2da0f2['outboundDropCallsDayTimeout']=_0xa0cc05[_0xdd74('0x34')];_0x2da0f2[_0xdd74('0x35')]=_0xa0cc05['outboundNoAnswerCallsDay'];_0x2da0f2['outboundNoSuchCallsDay']=_0xa0cc05[_0xdd74('0x36')];_0x2da0f2[_0xdd74('0x37')]=_0xa0cc05['outboundOriginateFailureCallsDay'];_0x2da0f2[_0xdd74('0x38')]=_0xa0cc05['outboundReCallsDay'];_0x2da0f2[_0xdd74('0x39')]=_0xa0cc05[_0xdd74('0x39')];_0x2da0f2[_0xdd74('0x3a')]=_0xa0cc05['outboundUnknownCallsDay'];_0x2da0f2['predictiveIntervalAnsweredCalls']=_0xa0cc05['predictiveIntervalAnsweredCalls'];_0x2da0f2['predictiveIntervalAvgHoldtime']=_0xa0cc05['predictiveIntervalAvgHoldtime'];_0x2da0f2[_0xdd74('0x3b')]=_0xa0cc05[_0xdd74('0x3b')];_0x2da0f2[_0xdd74('0x3c')]=_0xa0cc05[_0xdd74('0x3c')];_0x2da0f2[_0xdd74('0x3d')]=_0xa0cc05[_0xdd74('0x3d')];_0x2da0f2['predictiveIntervalErlangCalls']=_0xa0cc05['predictiveIntervalErlangCalls'];_0x2da0f2[_0xdd74('0x3e')]=_0xa0cc05['predictiveIntervalErlangCallsDroppedCalls'];_0x2da0f2['predictiveIntervalHitRate']=_0xa0cc05['predictiveIntervalHitRate'];_0x2da0f2[_0xdd74('0x3f')]=_0xa0cc05[_0xdd74('0x3f')];_0x2da0f2['predictiveIntervalPauses']=_0xa0cc05[_0xdd74('0x40')];_0x2da0f2[_0xdd74('0x41')]=_0xa0cc05['predictiveIntervalAvailable'];_0x2da0f2[_0xdd74('0x42')]=_0xa0cc05['predictiveIntervalTotalCalls'];_0x2da0f2[_0xdd74('0x18')]=_0xa0cc05[_0xdd74('0x18')];_0x2da0f2[_0xdd74('0x43')]=_0xa0cc05[_0xdd74('0x43')];_0x2da0f2[_0xdd74('0x44')]=_0xa0cc05['erlangCalls'];_0x2da0f2[_0xdd74('0x45')]=_0xa0cc05[_0xdd74('0x45')];_0x2da0f2['erlangAbandonmentRate']=_0xa0cc05[_0xdd74('0x46')];_0x2da0f2[_0xdd74('0x47')]=_0xa0cc05[_0xdd74('0x47')];_0x2da0f2[_0xdd74('0x48')]=_0xa0cc05[_0xdd74('0x48')];_0x2da0f2[_0xdd74('0x49')]=_0xa0cc05[_0xdd74('0x49')];}if(_0xa0cc05[_0xdd74('0x4a')]){_0x2da0f2[_0xdd74('0x4a')]={'id':_0xa0cc05[_0xdd74('0x4a')]['id'],'name':_0xa0cc05[_0xdd74('0x4a')][_0xdd74('0xb')],'active':_0xa0cc05[_0xdd74('0x4a')][_0xdd74('0x4b')],'callerid':_0xa0cc05['Trunk'][_0xdd74('0x4c')]};}if(_0xa0cc05[_0xdd74('0x4d')]){_0x2da0f2[_0xdd74('0x4d')]={'id':_0xa0cc05[_0xdd74('0x4d')]['id'],'name':_0xa0cc05[_0xdd74('0x4d')][_0xdd74('0xb')]};}_0x109426[_0xdd74('0x4e')](_0x2da0f2);}}_0x102e1e({'count':_0x109426['length'],'rows':_0x109426});});},'VoiceChannels':function(_0x241b34){return new Promise(function(_0x7432bb,_0x56f7e1){var _0x5ab05d=_[_0xdd74('0x4f')](_0x746c54[_0xdd74('0x50')]);_0x7432bb({'count':_0x5ab05d[_0xdd74('0x51')],'rows':_0x5ab05d});});},'VoiceChannelMixMonitor':function(_0x1e4221){var _0x5a1a56=this;return new Promise(function(_0xb32d69,_0x546b52){if(ami['isConnected']()==![]){return _0x546b52(_0x5a1a56['error'](0x1f4,[config[_0xdd74('0x11')]['ip'],config[_0xdd74('0x11')][_0xdd74('0x12')],_0xdd74('0x13')]['join']('\x20')));}var _0x2682b6=schema(properties['voicechannel'])['validate'](_0x1e4221);if(_0x2682b6[_0xdd74('0x51')]>0x0){return _0x546b52(_0x5a1a56[_0xdd74('0x1a')](0x1f4,_[_0xdd74('0x52')](_0x2682b6,'message')[_0xdd74('0x14')](',\x20')));}var _0x258a13=_[_0xdd74('0x53')](_0x746c54[_0xdd74('0x50')],{'uniqueid':_0x1e4221[_0xdd74('0x54')]});if(_0x258a13&&_0x258a13[_0xdd74('0x55')]){var _0x202a2c=util[_0xdd74('0x8')](_0xdd74('0x56'),_0x1e4221[_0xdd74('0x57')]||_0x1e4221['uniqueid'],_0x1e4221[_0xdd74('0x8')]||_0xdd74('0x58'));return ami['Action']({'action':_0xdd74('0x59'),'channel':_0x258a13[_0xdd74('0x55')],'file':_0x202a2c,'options':'ai(mixmonitorid)'})[_0xdd74('0x17')](function(_0x1042d4){var _0xd34571=_[_0xdd74('0x53')](_0x258a13[_0xdd74('0x5a')],{'filename':_0xdd74('0x5b')+_0x202a2c[_0xdd74('0x5c')]()});if(_['isNil'](_0xd34571)){_0x258a13[_0xdd74('0x5a')]['push']({'filename':_0xdd74('0x5b')+_0x202a2c[_0xdd74('0x5c')](),'createdAt':moment()['format'](_0xdd74('0x5d')),'mixmonitorid':_0x1042d4[_0xdd74('0x5e')],'status':_0xdd74('0x5f')});}else{_0xd34571['mixmonitorid']=_0x1042d4[_0xdd74('0x5e')];_0xd34571['status']=_0xdd74('0x5f');}_0xb32d69({'code':0xc8,'message':[_0x1e4221[_0xdd74('0x54')],_0xdd74('0x60'),_0x1042d4[_0xdd74('0x5e')]][_0xdd74('0x14')]('\x20'),'mixmonitorid':_0x1042d4[_0xdd74('0x5e')]});})[_0xdd74('0x19')](function(_0x5dc123){_0x546b52(_0x5a1a56[_0xdd74('0x1a')](0x1f5,[_0x1e4221[_0xdd74('0x54')],_0x5dc123[_0xdd74('0x18')][_0xdd74('0x5c')]()][_0xdd74('0x14')]('\x20')));});}else{return _0x546b52(_0x5a1a56[_0xdd74('0x1a')](0x1f5,_0xdd74('0x61')));}});},'VoiceChannelStopMixMonitor':function(_0x58d0f5){var _0x21fb6f=this;return new Promise(function(_0x561b3d,_0x20df32){if(ami[_0xdd74('0x10')]()==![]){return _0x20df32(_0x21fb6f[_0xdd74('0x1a')](0x1f4,[config[_0xdd74('0x11')]['ip'],config[_0xdd74('0x11')][_0xdd74('0x12')],'ami\x20disconnected'][_0xdd74('0x14')]('\x20')));}var _0x3b1489=schema(properties[_0xdd74('0x62')])[_0xdd74('0x3')](_0x58d0f5);if(_0x3b1489[_0xdd74('0x51')]>0x0){return _0x20df32(_0x21fb6f[_0xdd74('0x1a')](0x1f4,_[_0xdd74('0x52')](_0x3b1489,'message')[_0xdd74('0x14')](',\x20')));}var _0x34d481=_[_0xdd74('0x53')](_0x746c54[_0xdd74('0x50')],{'uniqueid':_0x58d0f5[_0xdd74('0x54')]});if(_0x34d481){return BPromise['resolve']()[_0xdd74('0x17')](function(){if(_0x34d481[_0xdd74('0x55')]){return ami[_0xdd74('0x1d')]({'action':'StopMixMonitor','channel':_0x34d481[_0xdd74('0x55')],'mixmonitorid':_0x58d0f5[_0xdd74('0x5e')]})[_0xdd74('0x19')](function(_0x2f1b5c){});}})[_0xdd74('0x17')](function(){if(_0x34d481[_0xdd74('0x63')]){return ami[_0xdd74('0x1d')]({'action':_0xdd74('0x64'),'channel':_0x34d481[_0xdd74('0x63')],'mixmonitorid':_0x58d0f5[_0xdd74('0x5e')]})[_0xdd74('0x19')](function(_0x16c350){});}})[_0xdd74('0x17')](function(_0x4c9ae9){var _0x3f7463=_[_0xdd74('0x53')](_0x34d481['monitors'],{'mixmonitorid':_0x58d0f5[_0xdd74('0x5e')]});if(_0x3f7463){_0x3f7463[_0xdd74('0x65')]=_0xdd74('0x66');}})[_0xdd74('0x17')](function(){var _0x3cc566=util[_0xdd74('0x8')](_0xdd74('0x56'),_0x58d0f5[_0xdd74('0x57')]||_0x58d0f5[_0xdd74('0x54')],_0x58d0f5['format']||'wav');var _0x1645cc=_[_0xdd74('0x53')](_0x34d481['monitors'],{'filename':_0xdd74('0x5b')+_0x3cc566[_0xdd74('0x5c')]()});if(_0x1645cc){_0x1645cc['status']=_0xdd74('0x66');}})[_0xdd74('0x17')](function(){_0x561b3d({'code':0xc8,'message':[_0x58d0f5[_0xdd74('0x54')],_0xdd74('0x67')][_0xdd74('0x14')]('\x20')});})[_0xdd74('0x19')](function(_0x1a85dd){_0x20df32(_0x21fb6f[_0xdd74('0x1a')](0x1f5,[_0x58d0f5[_0xdd74('0x54')],_0x1a85dd['message'][_0xdd74('0x5c')]()][_0xdd74('0x14')]('\x20')));});}else{return _0x20df32(_0x21fb6f[_0xdd74('0x1a')](0x1f5,_0xdd74('0x61')));}});},'VoiceQueuesChannels':function(_0xac07e9){return new Promise(function(_0x4813df,_0x17d821){var _0x17acae=_[_0xdd74('0x4f')](_0x746c54[_0xdd74('0x68')]);_0x4813df({'count':_0x17acae['length'],'rows':_0x17acae});});},'VoiceQueuesChannel':function(_0x12689a){var _0x7627bc=this;return new Promise(function(_0x2f37e7,_0x1f88a6){var _0x509c68=schema(properties[_0xdd74('0x69')])['validate'](_0x12689a);if(_0x509c68[_0xdd74('0x51')]>0x0){return _0x1f88a6(_0x7627bc['error'](0x1f4,_[_0xdd74('0x52')](_0x509c68,_0xdd74('0x18'))['join'](',\x20')));}var _0x5e5cb4=_['find'](_0x746c54[_0xdd74('0x68')],{'uniqueid':_0x12689a['uniqueid']});if(_0x5e5cb4){_0x2f37e7(_0x5e5cb4);}else{return _0x1f88a6(_0x7627bc[_0xdd74('0x1a')](0x1f5,_0xdd74('0x61')));}});},'VoiceQueuesChannelHangup':function(_0xf01d65){var _0x417c4f=this;return new Promise(function(_0x1d1ecf,_0x4a713c){if(ami['isConnected']()==![]){return _0x4a713c(_0x417c4f[_0xdd74('0x1a')](0x1f4,[config[_0xdd74('0x11')]['ip'],config['asterisk'][_0xdd74('0x12')],'ami\x20disconnected'][_0xdd74('0x14')]('\x20')));}var _0x1cdb4d=schema(properties[_0xdd74('0x6a')])[_0xdd74('0x3')](_0xf01d65);if(_0x1cdb4d[_0xdd74('0x51')]>0x0){return _0x4a713c(_0x417c4f[_0xdd74('0x1a')](0x1f4,_['map'](_0x1cdb4d,_0xdd74('0x18'))[_0xdd74('0x14')](',\x20')));}var _0x4f9797=_[_0xdd74('0x53')](_0x746c54['queueChannels'],{'uniqueid':_0xf01d65[_0xdd74('0x54')]});if(_0x4f9797&&_0x4f9797[_0xdd74('0x55')]){return ami['Action']({'action':'Hangup','channel':_0x4f9797[_0xdd74('0x55')]})[_0xdd74('0x17')](function(_0x224ab7){_0x1d1ecf({'code':0xc8,'message':[_0xf01d65[_0xdd74('0x54')],_0x224ab7['message'][_0xdd74('0x5c')]()][_0xdd74('0x14')]('\x20')});})[_0xdd74('0x19')](function(_0x25c98e){_0x4a713c(_0x417c4f[_0xdd74('0x1a')](0x1f5,[_0xf01d65[_0xdd74('0x54')],_0x25c98e[_0xdd74('0x18')][_0xdd74('0x5c')]()]['join']('\x20')));});}else{return _0x4a713c(_0x417c4f[_0xdd74('0x1a')](0x1f5,_0xdd74('0x61')));}});},'VoiceQueuesChannelRedirect':function(_0x5ae5b9){var _0x5323fe=this;return new Promise(function(_0x441009,_0x1599f7){if(ami[_0xdd74('0x10')]()==![]){return _0x1599f7(_0x5323fe['error'](0x1f4,[config[_0xdd74('0x11')]['ip'],config[_0xdd74('0x11')][_0xdd74('0x12')],_0xdd74('0x13')][_0xdd74('0x14')]('\x20')));}var _0x343087=schema(properties[_0xdd74('0x6b')])['validate'](_0x5ae5b9);if(_0x343087[_0xdd74('0x51')]>0x0){return _0x1599f7(_0x5323fe['error'](0x1f4,_[_0xdd74('0x52')](_0x343087,_0xdd74('0x18'))[_0xdd74('0x14')](',\x20')));}var _0xefdb1=_['find'](_0x746c54['queueChannels'],{'uniqueid':_0x5ae5b9[_0xdd74('0x54')]});if(_0xefdb1&&_0xefdb1[_0xdd74('0x55')]){return ami[_0xdd74('0x1d')]({'action':_0xdd74('0x6c'),'channel':_0xefdb1[_0xdd74('0x55')],'exten':_0x5ae5b9['exten'],'context':_0x5ae5b9[_0xdd74('0x6d')]||_0xefdb1[_0xdd74('0x6d')],'priority':0x1})['then'](function(_0x554e35){_0x441009({'code':0xc8,'message':[_0x5ae5b9[_0xdd74('0x54')],_0x554e35[_0xdd74('0x18')][_0xdd74('0x5c')]()][_0xdd74('0x14')]('\x20')});})[_0xdd74('0x19')](function(_0x3b8514){_0x1599f7(_0x5323fe[_0xdd74('0x1a')](0x1f5,[_0x5ae5b9[_0xdd74('0x54')],_0x3b8514[_0xdd74('0x18')][_0xdd74('0x5c')]()][_0xdd74('0x14')]('\x20')));});}else{return _0x1599f7(_0x5323fe[_0xdd74('0x1a')](0x1f5,_0xdd74('0x61')));}});},'Agents':function(_0x4032e4){return new Promise(function(_0x25fb34,_0x4d8a1c){var _0x424e56=_[_0xdd74('0x4f')](_0x746c54[_0xdd74('0x6e')]);_0x25fb34({'count':_0x424e56['length'],'rows':_0x424e56});});},'Telephones':function(_0x32fab3){return new Promise(function(_0x2f4545,_0x215383){var _0x5e22bc=_[_0xdd74('0x4f')](_0x746c54['telephones']);_0x2f4545({'count':_0x5e22bc[_0xdd74('0x51')],'rows':_0x5e22bc});});},'Trunks':function(_0x36af4a){return new Promise(function(_0x1aa745,_0x3ece75){var _0x32462e=_[_0xdd74('0x4f')](_0x746c54[_0xdd74('0x6f')]);_0x1aa745({'count':_0x32462e[_0xdd74('0x51')],'rows':_0x32462e});});},'OutboundChannels':function(_0xc51b1){return new Promise(function(_0xc3cae6,_0x475ea0){var _0x4fa92b=_[_0xdd74('0x4f')](_0x746c54[_0xdd74('0x70')]);_0xc3cae6({'count':_0x4fa92b[_0xdd74('0x51')],'rows':_0x4fa92b});});},'Outbound':function(_0x6e1ac1){return new Promise(function(_0x2d0f16,_0x205cd0){_0x2d0f16(_0x746c54[_0xdd74('0x27')]);});},'Campaigns':function(_0x5e153){return new Promise(function(_0x51f69b,_0x28825b){var _0x3232dc=_[_0xdd74('0x4f')](_0x746c54[_0xdd74('0x71')]);_0x51f69b({'count':_0x3232dc[_0xdd74('0x51')],'rows':_0x3232dc});});},'VoiceQueuesPreview':function(_0xbbf979){var _0x3b8c50=this;return new Promise(function(_0x28370f,_0x527c24){_0x5e5358[_0xdd74('0x72')](_0xbbf979['id'])[_0xdd74('0x17')](function(_0x459def){_0x28370f({'code':0xc8,'message':_0x459def[_0xdd74('0x18')]});})[_0xdd74('0x19')](function(_0x2f75db){_0x527c24(_0x3b8c50[_0xdd74('0x1a')](0x1f4,_0x2f75db[_0xdd74('0x18')]));});});},'EventManager':function(_0x57d59d){var _0x38dbbc=this;return new Promise(function(_0x4e0f9a,_0x4d718d){if(!_0x57d59d[_0xdd74('0x73')]){return _0x4d718d(_0x38dbbc['error'](0x1f4,_0xdd74('0x74')));}ami[_0xdd74('0x75')](_0xdd74('0x76')+_0x57d59d[_0xdd74('0x73')],_0x57d59d[_0xdd74('0x18')]);_0x4e0f9a({'code':0xc8,'message':_0x57d59d});});},'FaxAccounts':function(_0x13141d){return new Promise(function(_0x1795d2,_0x159054){var _0x2ddd88=_[_0xdd74('0x4f')](_0x746c54[_0xdd74('0x77')]);_0x1795d2({'count':_0x2ddd88[_0xdd74('0x51')],'rows':_0x2ddd88});});},'SendFax':function(_0x17c724){var _0x176de3=this;return new Promise(function(_0x504f9e,_0x509150){_0x4c14b0[_0xdd74('0x78')](_0x17c724)['then'](function(_0x13651d){_0x504f9e({'code':0xc8,'message':_0x13651d['message']});})[_0xdd74('0x19')](function(_0x58b5ee){_0x509150(_0x176de3[_0xdd74('0x1a')](0x1f4,_0x58b5ee[_0xdd74('0x18')]));});});},'CheckAfterSend':function(_0x260b4d){var _0x162b60=this;return new Promise(function(_0x3e8e48,_0x2390ae){_0x4c14b0[_0xdd74('0x79')](_0x260b4d)['then'](function(_0x3964e1){_0x3e8e48({'code':0xc8,'message':_0x3964e1[_0xdd74('0x18')]});})[_0xdd74('0x19')](function(_0x2dbecd){_0x2390ae(_0x162b60['error'](0x1f4,_0x2dbecd['message']));});});}};var _0x399f5c=jayson[_0xdd74('0x7a')](_0x4ebd80)[_0xdd74('0x7b')]();_0x399f5c['on'](_0xdd74('0x1a'),function(_0x6925f7){return _0x9921c6(_0x6925f7);});_0x399f5c[_0xdd74('0x7')](0x232a,'127.0.0.1',function(){console[_0xdd74('0x7c')](_0xdd74('0x7d'),0x232a);return _0x388403(_0xdd74('0x7e')+0x232a);});});}; \ No newline at end of file +var _0x6a7a=['listen','%s/%s','SIP','timers','timer','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','Reload','catch','message','command','Command','then','voiceQueues','name','answered','available','loggedIn','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','channels','voicechannel','length','map','uniqueid','channel','filename','format','wav','MixMonitor','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','MixMonitor\x20Success','mixmonitorid','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','status','stop','%s.%s','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','trunks','outboundChannels','campaigns','run','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x6a7a,0x7d));var _0xa6a7=function(_0x342233,_0x4a66d9){_0x342233=_0x342233-0x0;var _0x50c1e6=_0x6a7a[_0x342233];return _0x50c1e6;};'use strict';var _=require(_0xa6a7('0x0'));var util=require(_0xa6a7('0x1'));var jayson=require(_0xa6a7('0x2'));var schema=require(_0xa6a7('0x3'));var BPromise=require(_0xa6a7('0x4'));var moment=require(_0xa6a7('0x5'));var config=require(_0xa6a7('0x6'));var properties=require(_0xa6a7('0x7'));var ami=require(_0xa6a7('0x8'));exports[_0xa6a7('0x9')]=function(_0xf662be,_0x2858cb,_0x5e7067){return new BPromise(function(_0x207c0b,_0x33beac){var _0x19a38f={'QueuePause':function(_0x564437){return new Promise(function(_0x107ad0,_0x4dcb17){var _0x1ff028=util['format'](_0xa6a7('0xa'),_0xa6a7('0xb'),_0x564437['name']);if(_0xf662be[_0xa6a7('0xc')]&&_0xf662be[_0xa6a7('0xc')][_0x1ff028]&&_0xf662be[_0xa6a7('0xc')][_0x1ff028][_0xa6a7('0xd')]){_0xf662be[_0xa6a7('0xc')][_0x1ff028]['updateAcw']();}if(_0xf662be[_0xa6a7('0xe')][_0x1ff028]){_0xf662be[_0xa6a7('0xe')][_0x1ff028][_0xa6a7('0xf')]({'statePause':_0x564437[_0xa6a7('0x10')]?!![]:![]});}_0x107ad0({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1ba212){var _0x7b79b1=this;return new Promise(function(_0x312b2a,_0x1f4491){if(ami[_0xa6a7('0x11')]()==![]){return _0x1f4491(_0x7b79b1[_0xa6a7('0x12')](0x1f4,[config[_0xa6a7('0x13')]['ip'],config[_0xa6a7('0x13')][_0xa6a7('0x14')],_0xa6a7('0x15')][_0xa6a7('0x16')]('\x20')));}_0x1ba212=_[_0xa6a7('0x17')](_0x1ba212,_[_0xa6a7('0x18')](properties[_0xa6a7('0x19')]));_0x1ba212['action']=_0xa6a7('0x1a');return ami['Action'](_0x1ba212)['then'](function(_0x47d9cb){_0x312b2a({'code':0xc8,'message':_0x47d9cb['message']});})[_0xa6a7('0x1b')](function(_0x527781){_0x1f4491(_0x7b79b1[_0xa6a7('0x12')](0x1f5,_0x527781[_0xa6a7('0x1c')]));});});},'Command':function(_0x3b3be2){var _0x21c088=this;return new Promise(function(_0x52079b,_0x56dd19){if(ami['isConnected']()==![]){return _0x56dd19(_0x21c088[_0xa6a7('0x12')](0x1f4,[config[_0xa6a7('0x13')]['ip'],config['asterisk'][_0xa6a7('0x14')],_0xa6a7('0x15')][_0xa6a7('0x16')]('\x20')));}_0x3b3be2=_[_0xa6a7('0x17')](_0x3b3be2,_0xa6a7('0x1d'));_0x3b3be2['action']=_0xa6a7('0x1e');return ami['Action'](_0x3b3be2)[_0xa6a7('0x1f')](function(_0x3770e7){_0x52079b({'code':0xc8,'message':_0x3770e7['content']});})[_0xa6a7('0x1b')](function(_0x5f35ab){_0x56dd19(_0x21c088[_0xa6a7('0x12')](0x1f5,_0x5f35ab['message']));});});},'VoiceQueues':function(_0x422c35){return new Promise(function(_0x119a1e,_0x10b4c1){var _0x49674b=[];for(var _0x413c54 in _0xf662be[_0xa6a7('0x20')]){if(_0xf662be[_0xa6a7('0x20')]['hasOwnProperty'](_0x413c54)){var _0x29e0f1=_0xf662be['voiceQueues'][_0x413c54];var _0x1d4bda={'id':_0x29e0f1['id'],'name':_0x29e0f1[_0xa6a7('0x21')],'strategy':_0x29e0f1['strategy'],'answered':_0x29e0f1[_0xa6a7('0x22')],'available':_0x29e0f1[_0xa6a7('0x23')],'loggedIn':_0x29e0f1[_0xa6a7('0x24')],'pTalking':_0x29e0f1['pTalking'],'sumBillable':_0x29e0f1['sumBillable'],'sumDuration':_0x29e0f1['sumDuration'],'sumHoldTime':_0x29e0f1[_0xa6a7('0x25')]||0x0,'talking':_0x29e0f1[_0xa6a7('0x26')],'total':_0x29e0f1[_0xa6a7('0x27')],'type':_0x29e0f1[_0xa6a7('0x28')],'unmanaged':_0x29e0f1[_0xa6a7('0x29')],'abandoned':_0x29e0f1[_0xa6a7('0x2a')],'waiting':_0x29e0f1['waiting'],'loggedInDb':_0x29e0f1[_0xa6a7('0x2b')]};if(_0x29e0f1['type']===_0xa6a7('0x2c')){_0x1d4bda['dialActive']=_0x29e0f1[_0xa6a7('0x2d')];_0x1d4bda[_0xa6a7('0x2e')]=_0x29e0f1['dialMethod'];_0x1d4bda[_0xa6a7('0x2f')]=_0x29e0f1[_0xa6a7('0x2f')];_0x1d4bda[_0xa6a7('0x30')]=_0x29e0f1[_0xa6a7('0x30')];_0x1d4bda[_0xa6a7('0x31')]=_0x29e0f1[_0xa6a7('0x31')];_0x1d4bda['dialPrefix']=_0x29e0f1[_0xa6a7('0x32')];_0x1d4bda['outboundAnswerAgiCallsDay']=_0x29e0f1[_0xa6a7('0x33')];_0x1d4bda[_0xa6a7('0x34')]=_0x29e0f1[_0xa6a7('0x34')];_0x1d4bda[_0xa6a7('0x35')]=_0x29e0f1[_0xa6a7('0x35')];_0x1d4bda[_0xa6a7('0x36')]=_0x29e0f1['outboundBusyCallsDay'];_0x1d4bda[_0xa6a7('0x37')]=_0x29e0f1[_0xa6a7('0x37')];_0x1d4bda[_0xa6a7('0x38')]=_0x29e0f1[_0xa6a7('0x38')];_0x1d4bda[_0xa6a7('0x39')]=_0x29e0f1[_0xa6a7('0x39')];_0x1d4bda['outboundDropCallsDayTimeout']=_0x29e0f1[_0xa6a7('0x3a')];_0x1d4bda[_0xa6a7('0x3b')]=_0x29e0f1['outboundNoAnswerCallsDay'];_0x1d4bda[_0xa6a7('0x3c')]=_0x29e0f1[_0xa6a7('0x3c')];_0x1d4bda['outboundOriginateFailureCallsDay']=_0x29e0f1[_0xa6a7('0x3d')];_0x1d4bda[_0xa6a7('0x3e')]=_0x29e0f1['outboundReCallsDay'];_0x1d4bda[_0xa6a7('0x3f')]=_0x29e0f1[_0xa6a7('0x3f')];_0x1d4bda['outboundUnknownCallsDay']=_0x29e0f1['outboundUnknownCallsDay'];_0x1d4bda['predictiveIntervalAnsweredCalls']=_0x29e0f1[_0xa6a7('0x40')];_0x1d4bda['predictiveIntervalAvgHoldtime']=_0x29e0f1[_0xa6a7('0x41')];_0x1d4bda[_0xa6a7('0x42')]=_0x29e0f1[_0xa6a7('0x42')];_0x1d4bda[_0xa6a7('0x43')]=_0x29e0f1[_0xa6a7('0x43')];_0x1d4bda[_0xa6a7('0x44')]=_0x29e0f1[_0xa6a7('0x44')];_0x1d4bda['predictiveIntervalErlangCalls']=_0x29e0f1['predictiveIntervalErlangCalls'];_0x1d4bda[_0xa6a7('0x45')]=_0x29e0f1[_0xa6a7('0x45')];_0x1d4bda['predictiveIntervalHitRate']=_0x29e0f1[_0xa6a7('0x46')];_0x1d4bda[_0xa6a7('0x47')]=_0x29e0f1['predictiveIntervalMultiplicativeFactor'];_0x1d4bda['predictiveIntervalPauses']=_0x29e0f1[_0xa6a7('0x48')];_0x1d4bda[_0xa6a7('0x49')]=_0x29e0f1[_0xa6a7('0x49')];_0x1d4bda['predictiveIntervalTotalCalls']=_0x29e0f1['predictiveIntervalTotalCalls'];_0x1d4bda[_0xa6a7('0x1c')]=_0x29e0f1[_0xa6a7('0x1c')];_0x1d4bda[_0xa6a7('0x4a')]=_0x29e0f1['originated'];_0x1d4bda['erlangCalls']=_0x29e0f1[_0xa6a7('0x4b')];_0x1d4bda['erlangCallToSecond']=_0x29e0f1[_0xa6a7('0x4c')];_0x1d4bda[_0xa6a7('0x4d')]=_0x29e0f1[_0xa6a7('0x4d')];_0x1d4bda['erlangBusyFactor']=_0x29e0f1[_0xa6a7('0x4e')];_0x1d4bda['startPredictive']=_0x29e0f1['startPredictive'];_0x1d4bda[_0xa6a7('0x4f')]=_0x29e0f1['startProgressive'];}if(_0x29e0f1[_0xa6a7('0x50')]){_0x1d4bda[_0xa6a7('0x50')]={'id':_0x29e0f1[_0xa6a7('0x50')]['id'],'name':_0x29e0f1['Trunk'][_0xa6a7('0x21')],'active':_0x29e0f1[_0xa6a7('0x50')][_0xa6a7('0x51')],'callerid':_0x29e0f1['Trunk'][_0xa6a7('0x52')]};}if(_0x29e0f1[_0xa6a7('0x53')]){_0x1d4bda[_0xa6a7('0x53')]={'id':_0x29e0f1[_0xa6a7('0x53')]['id'],'name':_0x29e0f1[_0xa6a7('0x53')][_0xa6a7('0x21')]};}_0x49674b['push'](_0x1d4bda);}}_0x119a1e({'count':_0x49674b['length'],'rows':_0x49674b});});},'VoiceChannels':function(_0x96f57d){return new Promise(function(_0x27b042,_0x132c01){var _0x5254fa=_['values'](_0xf662be[_0xa6a7('0x54')]);_0x27b042({'count':_0x5254fa['length'],'rows':_0x5254fa});});},'VoiceChannelMixMonitor':function(_0x4e534e){var _0x24a63e=this;return new Promise(function(_0x4be2b4,_0x199536){if(ami[_0xa6a7('0x11')]()==![]){return _0x199536(_0x24a63e[_0xa6a7('0x12')](0x1f4,[config[_0xa6a7('0x13')]['ip'],config[_0xa6a7('0x13')][_0xa6a7('0x14')],_0xa6a7('0x15')][_0xa6a7('0x16')]('\x20')));}var _0x2a9b58=schema(properties[_0xa6a7('0x55')])['validate'](_0x4e534e);if(_0x2a9b58[_0xa6a7('0x56')]>0x0){return _0x199536(_0x24a63e[_0xa6a7('0x12')](0x1f4,_[_0xa6a7('0x57')](_0x2a9b58,_0xa6a7('0x1c'))['join'](',\x20')));}var _0x4b07c5=_['find'](_0xf662be[_0xa6a7('0x54')],{'uniqueid':_0x4e534e[_0xa6a7('0x58')]});if(_0x4b07c5&&_0x4b07c5[_0xa6a7('0x59')]){var _0x258dcf=util['format']('%s.%s',_0x4e534e[_0xa6a7('0x5a')]||_0x4e534e[_0xa6a7('0x58')],_0x4e534e[_0xa6a7('0x5b')]||_0xa6a7('0x5c'));return ami['Action']({'action':_0xa6a7('0x5d'),'channel':_0x4b07c5[_0xa6a7('0x59')],'file':_0x258dcf,'options':_0xa6a7('0x5e')})[_0xa6a7('0x1f')](function(_0x3cda0c){var _0x274f06=_[_0xa6a7('0x5f')](_0x4b07c5[_0xa6a7('0x60')],{'filename':_0xa6a7('0x61')+_0x258dcf['toLowerCase']()});if(_[_0xa6a7('0x62')](_0x274f06)){_0x4b07c5[_0xa6a7('0x60')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0x258dcf[_0xa6a7('0x63')](),'createdAt':moment()['format'](_0xa6a7('0x64')),'mixmonitorid':_0x3cda0c['mixmonitorid'],'status':_0xa6a7('0x65')});}else{_0x274f06['mixmonitorid']=_0x3cda0c['mixmonitorid'];_0x274f06['status']='rec';}_0x4be2b4({'code':0xc8,'message':[_0x4e534e[_0xa6a7('0x58')],_0xa6a7('0x66'),_0x3cda0c['mixmonitorid']][_0xa6a7('0x16')]('\x20'),'mixmonitorid':_0x3cda0c[_0xa6a7('0x67')]});})[_0xa6a7('0x1b')](function(_0xdf62cb){_0x199536(_0x24a63e[_0xa6a7('0x12')](0x1f5,[_0x4e534e[_0xa6a7('0x58')],_0xdf62cb[_0xa6a7('0x1c')][_0xa6a7('0x63')]()][_0xa6a7('0x16')]('\x20')));});}else{return _0x199536(_0x24a63e['error'](0x1f5,_0xa6a7('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x5cdf36){var _0x1ceb8f=this;return new Promise(function(_0x3572b6,_0x578a90){if(ami[_0xa6a7('0x11')]()==![]){return _0x578a90(_0x1ceb8f[_0xa6a7('0x12')](0x1f4,[config[_0xa6a7('0x13')]['ip'],config[_0xa6a7('0x13')][_0xa6a7('0x14')],'ami\x20disconnected'][_0xa6a7('0x16')]('\x20')));}var _0x56efd0=schema(properties[_0xa6a7('0x55')])[_0xa6a7('0x3')](_0x5cdf36);if(_0x56efd0[_0xa6a7('0x56')]>0x0){return _0x578a90(_0x1ceb8f['error'](0x1f4,_['map'](_0x56efd0,_0xa6a7('0x1c'))['join'](',\x20')));}var _0x2101c3=_[_0xa6a7('0x5f')](_0xf662be[_0xa6a7('0x54')],{'uniqueid':_0x5cdf36[_0xa6a7('0x58')]});if(_0x2101c3){return BPromise['resolve']()[_0xa6a7('0x1f')](function(){if(_0x2101c3[_0xa6a7('0x59')]){return ami[_0xa6a7('0x69')]({'action':_0xa6a7('0x6a'),'channel':_0x2101c3[_0xa6a7('0x59')],'mixmonitorid':_0x5cdf36['mixmonitorid']})[_0xa6a7('0x1b')](function(_0x1edf6e){});}})[_0xa6a7('0x1f')](function(){if(_0x2101c3['destinationchannel']){return ami[_0xa6a7('0x69')]({'action':_0xa6a7('0x6a'),'channel':_0x2101c3[_0xa6a7('0x6b')],'mixmonitorid':_0x5cdf36[_0xa6a7('0x67')]})[_0xa6a7('0x1b')](function(_0x41950d){});}})[_0xa6a7('0x1f')](function(_0x485555){var _0x24e456=_['find'](_0x2101c3['monitors'],{'mixmonitorid':_0x5cdf36[_0xa6a7('0x67')]});if(_0x24e456){_0x24e456[_0xa6a7('0x6c')]=_0xa6a7('0x6d');}})[_0xa6a7('0x1f')](function(){var _0x3a9dcc=util[_0xa6a7('0x5b')](_0xa6a7('0x6e'),_0x5cdf36['filename']||_0x5cdf36[_0xa6a7('0x58')],_0x5cdf36[_0xa6a7('0x5b')]||_0xa6a7('0x5c'));var _0x375417=_[_0xa6a7('0x5f')](_0x2101c3[_0xa6a7('0x60')],{'filename':'/var/spool/asterisk/monitor/'+_0x3a9dcc[_0xa6a7('0x63')]()});if(_0x375417){_0x375417[_0xa6a7('0x6c')]=_0xa6a7('0x6d');}})['then'](function(){_0x3572b6({'code':0xc8,'message':[_0x5cdf36[_0xa6a7('0x58')],_0xa6a7('0x6f')][_0xa6a7('0x16')]('\x20')});})[_0xa6a7('0x1b')](function(_0x310387){_0x578a90(_0x1ceb8f[_0xa6a7('0x12')](0x1f5,[_0x5cdf36[_0xa6a7('0x58')],_0x310387['message'][_0xa6a7('0x63')]()]['join']('\x20')));});}else{return _0x578a90(_0x1ceb8f[_0xa6a7('0x12')](0x1f5,_0xa6a7('0x68')));}});},'VoiceQueuesChannels':function(_0x345fd8){return new Promise(function(_0x15f4ee,_0x26b868){var _0x1562b1=_[_0xa6a7('0x70')](_0xf662be[_0xa6a7('0x71')]);_0x15f4ee({'count':_0x1562b1[_0xa6a7('0x56')],'rows':_0x1562b1});});},'VoiceQueuesChannel':function(_0x4436f7){var _0xb07ef5=this;return new Promise(function(_0x5b9d8d,_0x3e0036){var _0x364a7d=schema(properties[_0xa6a7('0x72')])['validate'](_0x4436f7);if(_0x364a7d[_0xa6a7('0x56')]>0x0){return _0x3e0036(_0xb07ef5['error'](0x1f4,_[_0xa6a7('0x57')](_0x364a7d,_0xa6a7('0x1c'))[_0xa6a7('0x16')](',\x20')));}var _0x599376=_['find'](_0xf662be[_0xa6a7('0x71')],{'uniqueid':_0x4436f7['uniqueid']});if(_0x599376){_0x5b9d8d(_0x599376);}else{return _0x3e0036(_0xb07ef5['error'](0x1f5,_0xa6a7('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x122ce2){var _0x24263e=this;return new Promise(function(_0x17218e,_0x385a69){if(ami['isConnected']()==![]){return _0x385a69(_0x24263e[_0xa6a7('0x12')](0x1f4,[config[_0xa6a7('0x13')]['ip'],config[_0xa6a7('0x13')][_0xa6a7('0x14')],'ami\x20disconnected'][_0xa6a7('0x16')]('\x20')));}var _0x3684aa=schema(properties[_0xa6a7('0x73')])[_0xa6a7('0x3')](_0x122ce2);if(_0x3684aa[_0xa6a7('0x56')]>0x0){return _0x385a69(_0x24263e[_0xa6a7('0x12')](0x1f4,_['map'](_0x3684aa,_0xa6a7('0x1c'))[_0xa6a7('0x16')](',\x20')));}var _0x40b17e=_['find'](_0xf662be['queueChannels'],{'uniqueid':_0x122ce2['uniqueid']});if(_0x40b17e&&_0x40b17e[_0xa6a7('0x59')]){return ami[_0xa6a7('0x69')]({'action':_0xa6a7('0x74'),'channel':_0x40b17e[_0xa6a7('0x59')]})[_0xa6a7('0x1f')](function(_0x4c036b){_0x17218e({'code':0xc8,'message':[_0x122ce2[_0xa6a7('0x58')],_0x4c036b[_0xa6a7('0x1c')][_0xa6a7('0x63')]()]['join']('\x20')});})[_0xa6a7('0x1b')](function(_0x16137f){_0x385a69(_0x24263e[_0xa6a7('0x12')](0x1f5,[_0x122ce2[_0xa6a7('0x58')],_0x16137f[_0xa6a7('0x1c')][_0xa6a7('0x63')]()][_0xa6a7('0x16')]('\x20')));});}else{return _0x385a69(_0x24263e[_0xa6a7('0x12')](0x1f5,_0xa6a7('0x68')));}});},'VoiceQueuesChannelRedirect':function(_0x57d8c5){var _0x461c7b=this;return new Promise(function(_0xce87aa,_0xa2048a){if(ami['isConnected']()==![]){return _0xa2048a(_0x461c7b[_0xa6a7('0x12')](0x1f4,[config[_0xa6a7('0x13')]['ip'],config[_0xa6a7('0x13')][_0xa6a7('0x14')],_0xa6a7('0x15')][_0xa6a7('0x16')]('\x20')));}var _0x171896=schema(properties[_0xa6a7('0x75')])['validate'](_0x57d8c5);if(_0x171896[_0xa6a7('0x56')]>0x0){return _0xa2048a(_0x461c7b['error'](0x1f4,_[_0xa6a7('0x57')](_0x171896,_0xa6a7('0x1c'))[_0xa6a7('0x16')](',\x20')));}var _0x197734=_[_0xa6a7('0x5f')](_0xf662be['queueChannels'],{'uniqueid':_0x57d8c5['uniqueid']});if(_0x197734&&_0x197734[_0xa6a7('0x59')]){return ami[_0xa6a7('0x69')]({'action':_0xa6a7('0x76'),'channel':_0x197734[_0xa6a7('0x59')],'exten':_0x57d8c5[_0xa6a7('0x77')],'context':_0x57d8c5['context']||_0x197734['context'],'priority':0x1})[_0xa6a7('0x1f')](function(_0x5d15f9){_0xce87aa({'code':0xc8,'message':[_0x57d8c5['uniqueid'],_0x5d15f9[_0xa6a7('0x1c')][_0xa6a7('0x63')]()]['join']('\x20')});})[_0xa6a7('0x1b')](function(_0x7d57aa){_0xa2048a(_0x461c7b['error'](0x1f5,[_0x57d8c5[_0xa6a7('0x58')],_0x7d57aa[_0xa6a7('0x1c')][_0xa6a7('0x63')]()][_0xa6a7('0x16')]('\x20')));});}else{return _0xa2048a(_0x461c7b[_0xa6a7('0x12')](0x1f5,_0xa6a7('0x68')));}});},'Agents':function(_0x55c3e5){return new Promise(function(_0x4ecd07,_0x4635c6){var _0x158955=_[_0xa6a7('0x70')](_0xf662be[_0xa6a7('0xe')]);_0x4ecd07({'count':_0x158955[_0xa6a7('0x56')],'rows':_0x158955});});},'Telephones':function(_0x34f1b3){return new Promise(function(_0x5ce50e,_0x565739){var _0xf0e1b0=_[_0xa6a7('0x70')](_0xf662be[_0xa6a7('0x78')]);_0x5ce50e({'count':_0xf0e1b0[_0xa6a7('0x56')],'rows':_0xf0e1b0});});},'Trunks':function(_0x4137c8){return new Promise(function(_0x49c6c9,_0x3a6765){var _0x1e0817=_[_0xa6a7('0x70')](_0xf662be[_0xa6a7('0x79')]);_0x49c6c9({'count':_0x1e0817['length'],'rows':_0x1e0817});});},'OutboundChannels':function(_0xff1817){return new Promise(function(_0x829516,_0x3d78b8){var _0x23cdb3=_['values'](_0xf662be[_0xa6a7('0x7a')]);_0x829516({'count':_0x23cdb3[_0xa6a7('0x56')],'rows':_0x23cdb3});});},'Outbound':function(_0x2fce14){return new Promise(function(_0x3294c5,_0x592597){_0x3294c5(_0xf662be[_0xa6a7('0x2c')]);});},'Campaigns':function(_0x2f857b){return new Promise(function(_0x30f04f,_0x447531){var _0x46be0c=_['values'](_0xf662be[_0xa6a7('0x7b')]);_0x30f04f({'count':_0x46be0c[_0xa6a7('0x56')],'rows':_0x46be0c});});},'VoiceQueuesPreview':function(_0x4eb2a7){var _0x403b2e=this;return new Promise(function(_0x226ace,_0x543bbb){_0x2858cb[_0xa6a7('0x7c')](_0x4eb2a7['id'])['then'](function(_0x52f994){_0x226ace({'code':0xc8,'message':_0x52f994['message']});})['catch'](function(_0x1f77cf){_0x543bbb(_0x403b2e[_0xa6a7('0x12')](0x1f4,_0x1f77cf['message']));});});},'EventManager':function(_0xfc68be){var _0x38a444=this;return new Promise(function(_0x378487,_0x5a06df){if(!_0xfc68be[_0xa6a7('0x7d')]){return _0x5a06df(_0x38a444[_0xa6a7('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit']('custom:'+_0xfc68be['event'],_0xfc68be['message']);_0x378487({'code':0xc8,'message':_0xfc68be});});},'FaxAccounts':function(_0x530246){return new Promise(function(_0x403a3e,_0x1d6519){var _0x1365b0=_[_0xa6a7('0x70')](_0xf662be[_0xa6a7('0x7e')]);_0x403a3e({'count':_0x1365b0['length'],'rows':_0x1365b0});});},'SendFax':function(_0x2fb543){var _0xfadfa9=this;return new Promise(function(_0x4a308c,_0x2432c2){_0x5e7067[_0xa6a7('0x7f')](_0x2fb543)[_0xa6a7('0x1f')](function(_0x4ecc7f){_0x4a308c({'code':0xc8,'message':_0x4ecc7f['message']});})[_0xa6a7('0x1b')](function(_0x4154af){_0x2432c2(_0xfadfa9['error'](0x1f4,_0x4154af['message']));});});},'CheckAfterSend':function(_0x56da0c){var _0x20b4dc=this;return new Promise(function(_0x4afcfa,_0x4ab70f){_0x5e7067[_0xa6a7('0x80')](_0x56da0c)[_0xa6a7('0x1f')](function(_0x2ae4db){_0x4afcfa({'code':0xc8,'message':_0x2ae4db[_0xa6a7('0x1c')]});})[_0xa6a7('0x1b')](function(_0x35e587){_0x4ab70f(_0x20b4dc[_0xa6a7('0x12')](0x1f4,_0x35e587[_0xa6a7('0x1c')]));});});}};var _0x385447=jayson[_0xa6a7('0x81')](_0x19a38f)[_0xa6a7('0x82')]();_0x385447['on']('error',function(_0x443358){return _0x33beac(_0x443358);});_0x385447['listen'](0x232a,_0xa6a7('0x83'),function(){console[_0xa6a7('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x207c0b(_0xa6a7('0x85')+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 4d59ddc..d1b89a8 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 _0xea4e=['catch','error','[%s][%s]\x20Error\x20creating\x20contact','stringify','bluebird','../../../../config/environment','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','[%s][%s]','emit','exec','autoCreate','data2','data1','isNil','routeId','firstName','calleridname','','calleridnum','destcalleridname','destcalleridnum','uniqueid','phone','resolve','showContact','omit','then','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','user:%s','format','trigger:%s','action','toLowerCase','merge','info','[%s][%s]\x20Contact\x20not\x20found','createContact','name'];(function(_0x52b91f,_0x499757){var _0x15f8f5=function(_0x33fbf6){while(--_0x33fbf6){_0x52b91f['push'](_0x52b91f['shift']());}};_0x15f8f5(++_0x499757);}(_0xea4e,0x10c));var _0xeea4=function(_0x42f1e6,_0x372465){_0x42f1e6=_0x42f1e6-0x0;var _0xea2816=_0xea4e[_0x42f1e6];return _0xea2816;};'use strict';var BPromise=require(_0xeea4('0x0'));var util=require('util');var _=require('lodash');var Redis=require('ioredis');var config=require(_0xeea4('0x1'));var logger=require('../../../../config/logger')(_0xeea4('0x2'));var cmContactRpc=require(_0xeea4('0x3'));config['redis']=_[_0xeea4('0x4')](config[_0xeea4('0x5')],{'host':_0xeea4('0x6'),'port':0x18eb});var io=require(_0xeea4('0x7'))(new Redis(config[_0xeea4('0x5')]));function emit(_0x26d41b,_0x1bf7d2,_0x44113d,_0x227d33){logger['info'](_0xeea4('0x8'),_0x26d41b,'',_0x1bf7d2,_0x44113d,JSON['stringify'](_0x227d33));io['to'](_0x1bf7d2)[_0xeea4('0x9')](_0x44113d,_0x227d33);}exports[_0xeea4('0xa')]=function(_0x279b9,_0x367d41,_0x16a077){_0x16a077[_0xeea4('0xb')]=0x0;if(_0x367d41[_0xeea4('0xc')]&&parseInt(_0x367d41[_0xeea4('0xc')],0xa)){var _0x48a0db={'ListId':parseInt(_0x367d41[_0xeea4('0xd')],0xa),'phone':_0x16a077['calleridnum']};if(_[_0xeea4('0xe')](_0x16a077[_0xeea4('0xf')])){_0x48a0db[_0xeea4('0x10')]=_0x16a077[_0xeea4('0x11')]&&_0x16a077[_0xeea4('0x11')]!==_0xeea4('0x12')?_0x16a077[_0xeea4('0x11')]:_0x16a077[_0xeea4('0x13')]||_0x16a077['uniqueid'];}else{_0x48a0db[_0xeea4('0x10')]=_0x16a077[_0xeea4('0x14')]&&_0x16a077['destcalleridname']!==_0xeea4('0x12')?_0x16a077['destcalleridname']:_0x16a077[_0xeea4('0x15')]||_0x16a077[_0xeea4('0x16')];_0x48a0db[_0xeea4('0x17')]=_0x16a077[_0xeea4('0x14')]&&_0x16a077[_0xeea4('0x14')]!==_0xeea4('0x12')?_0x16a077[_0xeea4('0x14')]:_0x16a077[_0xeea4('0x15')]||_0x16a077[_0xeea4('0x16')];}BPromise[_0xeea4('0x18')]()['then'](cmContactRpc[_0xeea4('0x19')]({'where':_[_0xeea4('0x1a')](_0x48a0db,['firstName'])}))[_0xeea4('0x1b')](function(_0x472803){if(_0x472803){logger['info'](_0xeea4('0x1c'),_0x16a077['uniqueid'],'',_0x472803['id']);if(_0x279b9){_0x16a077[_0xeea4('0x1d')]=_0x472803['id'];emit(_0x16a077['uniqueid'],util['format'](_0xeea4('0x1e'),_0x279b9['name']),util[_0xeea4('0x1f')](_0xeea4('0x20'),_0x367d41[_0xeea4('0x21')][_0xeea4('0x22')]()),_[_0xeea4('0x23')](_0x16a077,{'ListId':parseInt(_0x367d41['data1'],0xa)}));}return;}else{logger[_0xeea4('0x24')](_0xeea4('0x25'),_0x16a077[_0xeea4('0x16')],'');return BPromise[_0xeea4('0x18')]()['then'](cmContactRpc[_0xeea4('0x26')](_0x48a0db));}})[_0xeea4('0x1b')](function(_0x455148){if(_0x455148){logger[_0xeea4('0x24')]('[%s][%s]\x20Contact\x20created:%s',_0x16a077['uniqueid'],'',_0x455148['id']);if(_0x279b9){_0x16a077[_0xeea4('0x1d')]=_0x455148['id'];emit(_0x16a077[_0xeea4('0x16')],util[_0xeea4('0x1f')](_0xeea4('0x1e'),_0x279b9[_0xeea4('0x27')]),util['format'](_0xeea4('0x20'),_0x367d41[_0xeea4('0x21')]['toLowerCase']()),_[_0xeea4('0x23')](_0x16a077,{'ListId':parseInt(_0x367d41['data1'],0xa)}));}}})[_0xeea4('0x28')](function(_0xb2acc2){logger[_0xeea4('0x29')](_0xeea4('0x2a'),_0x16a077[_0xeea4('0x16')],'',JSON[_0xeea4('0x2b')](_0xb2acc2));});}else{if(_0x279b9){logger[_0xeea4('0x24')]('[%s][%s]\x20Autocreate\x20disabled',_0x16a077[_0xeea4('0x16')],'');emit(_0x16a077[_0xeea4('0x16')],util['format']('user:%s',_0x279b9['name']),util[_0xeea4('0x1f')]('trigger:%s',_0x367d41[_0xeea4('0x21')][_0xeea4('0x22')]()),_[_0xeea4('0x23')]({'ListId':parseInt(_0x367d41[_0xeea4('0xd')],0xa)},_0x16a077));}}}; \ No newline at end of file +var _0x52c4=['user:%s','name','format','trigger:%s','action','toLowerCase','merge','resolve','[%s][%s]\x20Contact\x20created:%s','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','bluebird','util','lodash','ioredis','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','stringify','emit','exec','data2','data1','calleridnum','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','then','omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x52c4,0x1b1));var _0x452c=function(_0x7aa744,_0x450c0d){_0x7aa744=_0x7aa744-0x0;var _0x3ef3cb=_0x52c4[_0x7aa744];return _0x3ef3cb;};'use strict';var BPromise=require(_0x452c('0x0'));var util=require(_0x452c('0x1'));var _=require(_0x452c('0x2'));var Redis=require(_0x452c('0x3'));var config=require(_0x452c('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x452c('0x5'));config[_0x452c('0x6')]=_[_0x452c('0x7')](config['redis'],{'host':_0x452c('0x8'),'port':0x18eb});var io=require(_0x452c('0x9'))(new Redis(config['redis']));function emit(_0x3b4519,_0x5b752e,_0x1c683d,_0x12bac8){logger[_0x452c('0xa')](_0x452c('0xb'),_0x3b4519,'',_0x5b752e,_0x1c683d,JSON[_0x452c('0xc')](_0x12bac8));io['to'](_0x5b752e)[_0x452c('0xd')](_0x1c683d,_0x12bac8);}exports[_0x452c('0xe')]=function(_0xe1e6b4,_0x32f200,_0x1d6732){_0x1d6732['autoCreate']=0x0;if(_0x32f200[_0x452c('0xf')]&&parseInt(_0x32f200[_0x452c('0xf')],0xa)){var _0x170887={'ListId':parseInt(_0x32f200[_0x452c('0x10')],0xa),'phone':_0x1d6732[_0x452c('0x11')]};if(_['isNil'](_0x1d6732['routeId'])){_0x170887[_0x452c('0x12')]=_0x1d6732[_0x452c('0x13')]&&_0x1d6732['calleridname']!==_0x452c('0x14')?_0x1d6732[_0x452c('0x13')]:_0x1d6732['calleridnum']||_0x1d6732[_0x452c('0x15')];}else{_0x170887[_0x452c('0x12')]=_0x1d6732['destcalleridname']&&_0x1d6732[_0x452c('0x16')]!==''?_0x1d6732[_0x452c('0x16')]:_0x1d6732[_0x452c('0x17')]||_0x1d6732['uniqueid'];_0x170887[_0x452c('0x18')]=_0x1d6732[_0x452c('0x16')]&&_0x1d6732[_0x452c('0x16')]!==_0x452c('0x14')?_0x1d6732['destcalleridname']:_0x1d6732[_0x452c('0x17')]||_0x1d6732[_0x452c('0x15')];}BPromise['resolve']()[_0x452c('0x19')](cmContactRpc['showContact']({'where':_[_0x452c('0x1a')](_0x170887,[_0x452c('0x12')])}))[_0x452c('0x19')](function(_0x5fabb0){if(_0x5fabb0){logger['info'](_0x452c('0x1b'),_0x1d6732[_0x452c('0x15')],'',_0x5fabb0['id']);if(_0xe1e6b4){_0x1d6732[_0x452c('0x1c')]=_0x5fabb0['id'];emit(_0x1d6732[_0x452c('0x15')],util['format'](_0x452c('0x1d'),_0xe1e6b4[_0x452c('0x1e')]),util[_0x452c('0x1f')](_0x452c('0x20'),_0x32f200[_0x452c('0x21')][_0x452c('0x22')]()),_[_0x452c('0x23')](_0x1d6732,{'ListId':parseInt(_0x32f200[_0x452c('0x10')],0xa)}));}return;}else{logger[_0x452c('0xa')]('[%s][%s]\x20Contact\x20not\x20found',_0x1d6732['uniqueid'],'');return BPromise[_0x452c('0x24')]()[_0x452c('0x19')](cmContactRpc['createContact'](_0x170887));}})[_0x452c('0x19')](function(_0x3db0a3){if(_0x3db0a3){logger[_0x452c('0xa')](_0x452c('0x25'),_0x1d6732[_0x452c('0x15')],'',_0x3db0a3['id']);if(_0xe1e6b4){_0x1d6732[_0x452c('0x1c')]=_0x3db0a3['id'];emit(_0x1d6732[_0x452c('0x15')],util[_0x452c('0x1f')](_0x452c('0x1d'),_0xe1e6b4[_0x452c('0x1e')]),util['format'](_0x452c('0x20'),_0x32f200[_0x452c('0x21')]['toLowerCase']()),_['merge'](_0x1d6732,{'ListId':parseInt(_0x32f200['data1'],0xa)}));}}})[_0x452c('0x26')](function(_0x1b896f){logger[_0x452c('0x27')](_0x452c('0x28'),_0x1d6732[_0x452c('0x15')],'',JSON[_0x452c('0xc')](_0x1b896f));});}else{if(_0xe1e6b4){logger[_0x452c('0xa')](_0x452c('0x29'),_0x1d6732[_0x452c('0x15')],'');emit(_0x1d6732[_0x452c('0x15')],util[_0x452c('0x1f')](_0x452c('0x1d'),_0xe1e6b4[_0x452c('0x1e')]),util[_0x452c('0x1f')](_0x452c('0x20'),_0x32f200[_0x452c('0x21')]['toLowerCase']()),_[_0x452c('0x23')]({'ListId':parseInt(_0x32f200[_0x452c('0x10')],0xa)},_0x1d6732));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index aa31ddf..eb34d26 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 _0xd236=['render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','windowWidth','data5','800','data6','winArguments','format','name','trigger:%s:%s','jscripty','trigger:%s','user:%s','exec','integration','queue','urlforward','script','parse','query','search','replace','AllConditions','checkConditions','channel','AnyConditions','some','field','value','upperFirst','AccountId','operator','interaction','message','event','membername','lastevent','routeId','exports','lodash','url','mustache','./urlforward','./integration','./cmContact','../rpc/cmContact','../../../config/environment','../../../config/logger','../ami','redis','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','sugarcrmAccounts','custom:agentcalled','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','clone','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','length','action','toLowerCase','contactmanager','browser','data1','TemplateId','html','data2'];(function(_0x59cb71,_0x1e9382){var _0x45b529=function(_0x34b55c){while(--_0x34b55c){_0x59cb71['push'](_0x59cb71['shift']());}};_0x45b529(++_0x1e9382);}(_0xd236,0x1e5));var _0x6d23=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xd236[_0x173441];return _0x2423a8;};'use strict';var util=require('util');var _=require(_0x6d23('0x0'));var url=require(_0x6d23('0x1'));var Mustache=require(_0x6d23('0x2'));var Redis=require('ioredis');var urlforward=require(_0x6d23('0x3'));var integration=require(_0x6d23('0x4'));var cmContact=require(_0x6d23('0x5'));var script=require('./script');var cmContactRpc=require(_0x6d23('0x6'));var config=require(_0x6d23('0x7'));var logger=require(_0x6d23('0x8'))('trigger');var ami=require(_0x6d23('0x9'));config[_0x6d23('0xa')]=_['defaults'](config[_0x6d23('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x6d23('0xb'))(new Redis(config[_0x6d23('0xa')]));var operators={'equals':function(_0xfa6ac8,_0x125a5a){return _0xfa6ac8==_0x125a5a;},'not_equals':function(_0x3e0459,_0x2d75fe){return _0x3e0459!=_0x2d75fe;}};var barAndWebActions=[_0x6d23('0xc'),_0x6d23('0x1'),_0x6d23('0xd')];function Trigger(_0x15bd0b){this[_0x6d23('0xe')]=_0x15bd0b['triggers'];this[_0x6d23('0xf')]=_0x15bd0b[_0x6d23('0xf')];this[_0x6d23('0x10')]=_0x15bd0b[_0x6d23('0x10')];this[_0x6d23('0x11')]=_0x15bd0b[_0x6d23('0x11')];this[_0x6d23('0x12')]=_0x15bd0b[_0x6d23('0x12')];this[_0x6d23('0x13')]=_0x15bd0b[_0x6d23('0x13')];this[_0x6d23('0x14')]=_0x15bd0b[_0x6d23('0x14')];this[_0x6d23('0x15')]=_0x15bd0b[_0x6d23('0x15')];this['sugarcrmAccounts']=_0x15bd0b['sugarcrmAccounts'];this[_0x6d23('0x16')]=_0x15bd0b[_0x6d23('0x16')];this[_0x6d23('0x17')]=_0x15bd0b[_0x6d23('0x17')];this[_0x6d23('0x18')]=_0x15bd0b['vtigerAccounts'];this[_0x6d23('0x19')]=_0x15bd0b[_0x6d23('0x19')];this[_0x6d23('0x1a')]=_0x15bd0b[_0x6d23('0x1a')];this[_0x6d23('0x1b')]=_0x15bd0b[_0x6d23('0x1b')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x6d23('0x14')],'sugarcrm':this[_0x6d23('0x1c')],'zoho':this[_0x6d23('0x16')],'desk':this[_0x6d23('0x17')],'vtiger':this[_0x6d23('0x18')],'dynamics365':this[_0x6d23('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x6d23('0x19')]};ami['on'](_0x6d23('0x1d'),this['syncCustomEvent'][_0x6d23('0x1e')](this));ami['on']('custom:agentconnect',this[_0x6d23('0x1f')][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x20'),this['syncCustomEvent'][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x21'),this[_0x6d23('0x1f')][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x22'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentnoanswer',this[_0x6d23('0x1f')]['bind'](this));ami['on'](_0x6d23('0x23'),this[_0x6d23('0x1f')]['bind'](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x24'),this[_0x6d23('0x1f')]['bind'](this));ami['on'](_0x6d23('0x25'),this[_0x6d23('0x1f')][_0x6d23('0x1e')](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x26'),this[_0x6d23('0x27')][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x28'),this[_0x6d23('0x27')][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x29'),this['syncAgentDial'][_0x6d23('0x1e')](this));ami['on']('custom:newinteraction',this[_0x6d23('0x1f')][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x2a'),this[_0x6d23('0x1f')][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x2b'),this[_0x6d23('0x1f')][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x2c'),this[_0x6d23('0x1f')][_0x6d23('0x1e')](this));ami['on'](_0x6d23('0x2d'),this[_0x6d23('0x1f')]['bind'](this));ami['on'](_0x6d23('0x2e'),this[_0x6d23('0x1f')][_0x6d23('0x1e')](this));}Trigger[_0x6d23('0x2f')][_0x6d23('0x30')]=function(_0x5dfce1,_0x20b9a4,_0x517628){logger['info'](_0x5dfce1,_0x20b9a4,JSON['stringify'](_0x517628));io['to'](_0x5dfce1)[_0x6d23('0x30')](_0x20b9a4,_0x517628);};Trigger[_0x6d23('0x2f')][_0x6d23('0x1f')]=function(_0x3a2a8e){var _0x21b5f9=_[_0x6d23('0x31')](_0x3a2a8e);this[_0x6d23('0x32')](_0x21b5f9);};Trigger[_0x6d23('0x2f')][_0x6d23('0x27')]=function(_0x170202){if(this['agents'][_0x170202[_0x6d23('0x33')]]){this[_0x6d23('0x1f')](_0x170202);}};Trigger[_0x6d23('0x2f')][_0x6d23('0x32')]=function(_0x2ccb3a){var _0x58d0f4;for(var _0x32ef5e in this[_0x6d23('0xe')]){if(this[_0x6d23('0xe')][_0x6d23('0x34')](_0x32ef5e)){if(this[_0x6d23('0xe')][_0x32ef5e]['status']){_0x58d0f4=this[_0x6d23('0x35')](this[_0x6d23('0xe')][_0x32ef5e],_0x2ccb3a);if(_0x58d0f4){_[_0x6d23('0x36')](_0x2ccb3a,_0x2ccb3a[_0x6d23('0x37')]);for(var _0x49dac8=0x0,_0x58edb8,_0x309d64,_0x3b2dbb;_0x49dac80x0){_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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 ee2c924..c8bac0e 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 _0xae11=['[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','util','./util','md5','dynamics365','../../../../config/environment','redis','localhost','POST','remoteUri','username','password','clientSecret','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','email','length','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','catch','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','4.0','phonecall','phonecalls','queue','callDirection','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x8cc0e9,_0x3e2658){var _0x3071aa=function(_0x37a160){while(--_0x37a160){_0x8cc0e9['push'](_0x8cc0e9['shift']());}};_0x3071aa(++_0x3e2658);}(_0xae11,0x193));var _0x1ae1=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0xae11[_0x3f6c29];return _0x4af959;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x1ae1('0x0'));var util=require(_0x1ae1('0x1'));var intUtil=require(_0x1ae1('0x2'));var md5=require(_0x1ae1('0x3'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x1ae1('0x4'));var config=require(_0x1ae1('0x5'));config[_0x1ae1('0x6')]=_['defaults'](config[_0x1ae1('0x6')],{'host':_0x1ae1('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1ae1('0x6')]));function getAuthToken(_0x3a840e,_0x4c1d18,_0x4cc1e1){var _0x4c9b1d={'method':_0x1ae1('0x8'),'uri':_0x4c1d18,'form':{'client_id':_0x3a840e['clientId'],'resource':_0x3a840e[_0x1ae1('0x9')],'username':_0x3a840e[_0x1ae1('0xa')],'password':_0x3a840e[_0x1ae1('0xb')],'grant_type':_0x1ae1('0xb'),'client_secret':_0x3a840e[_0x1ae1('0xc')]},'json':!![]};return rp(_0x4c9b1d)['then'](function(_0x1b0fb){return _0x1b0fb['access_token'];})['catch'](function(_0x541e02){logger[_0x1ae1('0xd')]('['+[_0x4cc1e1['toUpperCase']()]+_0x1ae1('0xe'));return _0x541e02[_0x1ae1('0xf')];});}function getUser(_0x50d443,_0x2ca3b5,_0x93a8a0,_0x1d23db,_0x1ae360,_0x2d7a6e){return new BPromise(function(_0x306a1f,_0x2b0173){return getAuthToken(_0x2ca3b5,_0x1d23db,_0x2d7a6e)[_0x1ae1('0x10')](function(_0x64403c){var _0x5f1152={'method':_0x1ae1('0x11'),'uri':_0x1ae360+_0x1ae1('0x12'),'headers':{'Authorization':_0x1ae1('0x13')+_0x64403c,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f1152);})[_0x1ae1('0x10')](function(_0x56501f){var _0x3b267a=_0x56501f[_0x1ae1('0x14')];var _0xa2bdb1=![];var _0x351514=null;if(!_['isNil'](_0x93a8a0)){if(intUtil[_0x1ae1('0x15')](_0x93a8a0[_0x1ae1('0x16')])){_0x50d443['userEmail']=_0x93a8a0[_0x1ae1('0x16')];for(_0x351514=0x0;_0x351514<_0x3b267a[_0x1ae1('0x17')];_0x351514++){if(_0x3b267a[_0x351514]['internalemailaddress']===_0x93a8a0['email']&&!_0x3b267a[_0x351514][_0x1ae1('0x18')]){_0xa2bdb1=!![];logger[_0x1ae1('0x19')]('['+[_0x2d7a6e[_0x1ae1('0x1a')]()]+_0x1ae1('0x1b')+_0x3b267a[_0x351514][_0x1ae1('0x1c')]+'!');_0x50d443[_0x1ae1('0x1d')]=_0x3b267a[_0x351514][_0x1ae1('0x1c')];}}}}if(!_0xa2bdb1){logger['info']('['+[_0x2d7a6e[_0x1ae1('0x1a')]()]+_0x1ae1('0x1e'));_0x50d443[_0x1ae1('0x1f')]=_0x2ca3b5[_0x1ae1('0xa')];for(_0x351514=0x0;_0x351514<_0x3b267a[_0x1ae1('0x17')];_0x351514++){if(_0x3b267a[_0x351514][_0x1ae1('0x20')]===_0x2ca3b5['username']){_0x50d443[_0x1ae1('0x1d')]=_0x3b267a[_0x351514]['systemuserid'];}}}_0x306a1f(_0x50d443);})['catch'](function(_0x2d06ea){_0x2b0173(_0x2d06ea[_0x1ae1('0xf')]);});});}function createEndUser(_0xf55a89,_0x5e1d6b,_0x3269b5,_0x1b7b28,_0x504712,_0x2afeef){return new BPromise(function(_0x4cf002,_0x562e39){return getAuthToken(_0x5e1d6b,_0x3269b5,_0x2afeef)[_0x1ae1('0x10')](function(_0x293a52){var _0x513e35=_0x2afeef[_0x1ae1('0x21')]()===_0x1ae1('0x22')?_0x504712[_0x1ae1('0x23')]:_0x504712[_0x1ae1('0x24')];var _0x439cca={'method':_0x1ae1('0x8'),'uri':_0x1b7b28+'contacts','body':{'telephone1':_0x513e35,'fullname':_0x513e35,'firstname':_0x513e35,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1ae1('0x25')+_0xf55a89[_0x1ae1('0x1d')]+')'},'headers':{'Authorization':_0x1ae1('0x13')+_0x293a52,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x439cca);})['then'](function(_0x31f2a9){var _0x172df2=_0x31f2a9['headers'][_0x1ae1('0x26')];var _0x3d374e=_0x172df2[_0x1ae1('0x27')](_0x172df2['lastIndexOf']('(')+0x1,_0x172df2[_0x1ae1('0x28')](')'));_0xf55a89[_0x1ae1('0x29')]=_0x3d374e;_0x4cf002(_0xf55a89);})[_0x1ae1('0x2a')](function(_0x150b59){_0x562e39(_0x150b59[_0x1ae1('0xf')]);});});}function getEndUser(_0x10ad14,_0x39574b,_0x4eec2d,_0x3669ab,_0x11f8d1,_0x5f2633){return new BPromise(function(_0x288523,_0x3c2b39){return getAuthToken(_0x39574b,_0x4eec2d,_0x5f2633)[_0x1ae1('0x10')](function(_0x7bfd18){var _0x5728c9={'method':_0x1ae1('0x11'),'uri':_0x3669ab+_0x1ae1('0x2b'),'headers':{'Authorization':_0x1ae1('0x13')+_0x7bfd18,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5728c9);})['then'](function(_0x1ce657){var _0x1a993f=null;if(_0x1ce657){var _0x239234=_0x1ce657[_0x1ae1('0x14')];var _0x192c80=![];for(_0x1a993f=0x0;_0x1a993f<_0x239234[_0x1ae1('0x17')];_0x1a993f++){var _0x386172=_0x5f2633['toLowerCase']()==='outbound'?_0x11f8d1[_0x1ae1('0x23')]:_0x11f8d1[_0x1ae1('0x24')];if(_0x239234[_0x1a993f][_0x1ae1('0x2c')]===_0x386172){_0x192c80=!![];_0x10ad14[_0x1ae1('0x29')]=_0x239234[_0x1a993f][_0x1ae1('0x2d')];}}if(_0x192c80){_0x288523(_0x10ad14);}else{return createEndUser(_0x10ad14,_0x39574b,_0x4eec2d,_0x3669ab,_0x11f8d1,_0x5f2633)[_0x1ae1('0x10')](function(_0x2625f4){logger[_0x1ae1('0x19')]('['+[_0x5f2633[_0x1ae1('0x1a')]()]+_0x1ae1('0x2e'),_0x2625f4[_0x1ae1('0x29')]);_0x288523(_0x2625f4);});}}else{return createEndUser(_0x10ad14,_0x39574b,_0x4eec2d,_0x3669ab,_0x11f8d1,_0x5f2633)['then'](function(_0x218647){logger['info']('['+[_0x5f2633[_0x1ae1('0x1a')]()]+_0x1ae1('0x2f'),_0x218647[_0x1ae1('0x29')]);_0x288523(_0x218647);});}});});}function getCustomFields(_0x5e1290,_0x1b0c23,_0x70b1c7){var _0xb57939={};if(_0x5e1290[_0x1ae1('0x17')]>0x0){_[_0x1ae1('0x30')](_0x5e1290,function(_0x45a533){if(_0x45a533[_0x1ae1('0x31')]===_0x1ae1('0x32')&&_0x45a533['nameField']&&!_0x45a533[_0x1ae1('0x33')]){var _0x25c1df=_0x45a533[_0x1ae1('0x34')][_0x1ae1('0x21')]();var _0x37d5f6=_0x25c1df[_0x1ae1('0x27')](0x0,_0x25c1df[_0x1ae1('0x35')]('_'));var _0x6cdf66=_0x25c1df[_0x1ae1('0x27')](_0x25c1df[_0x1ae1('0x35')]('_')+0x1);if(_0x37d5f6===_0x70b1c7){_0xb57939[_0x6cdf66]=_0x45a533[_0x1ae1('0x36')];}}});}return _0xb57939;}function getTicket(_0x2b8364,_0x1eabac,_0x52de2c,_0x2ff0dc,_0x44334a,_0x4b81fb,_0x1ed94e){return new BPromise(function(_0x6ea19c,_0x1acf38){var _0x26e4dd;return getAuthToken(_0x1eabac,_0x52de2c,_0x1ed94e)[_0x1ae1('0x10')](function(_0x23a325){if(_0x4b81fb[_0x1ae1('0x37')]===_0x1ae1('0x38')){_0x26e4dd={'method':_0x1ae1('0x8'),'uri':_0x2ff0dc+_0x1ae1('0x39'),'body':Object[_0x1ae1('0x3a')]({},{'title':intUtil[_0x1ae1('0x3b')](_0x4b81fb[_0x1ae1('0x3c')],_0x44334a,'\x20'),'description':intUtil['getString'](_0x4b81fb[_0x1ae1('0x3d')],_0x44334a,'\x0a'),'customerid_contact@odata.bind':_0x1ae1('0x3e')+_0x2b8364[_0x1ae1('0x29')]+')','ownerid@odata.bind':_0x1ae1('0x25')+_0x2b8364[_0x1ae1('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x4b81fb[_0x1ae1('0x3f')],_0x44334a,_0x4b81fb[_0x1ae1('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x23a325,'OData-Version':_0x1ae1('0x40')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4b81fb['ticketType']===_0x1ae1('0x41')){_0x26e4dd={'method':_0x1ae1('0x8'),'uri':_0x2ff0dc+_0x1ae1('0x42'),'body':Object[_0x1ae1('0x3a')]({},{'subject':intUtil[_0x1ae1('0x3b')](_0x4b81fb[_0x1ae1('0x3c')],_0x44334a,'\x20'),'phonenumber':String(_0x44334a[_0x1ae1('0x24')]),'description':intUtil[_0x1ae1('0x3b')](_0x4b81fb[_0x1ae1('0x3d')],_0x44334a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1ae1('0x3e')+_0x2b8364[_0x1ae1('0x29')]+')','ownerid@odata.bind':_0x1ae1('0x25')+_0x2b8364[_0x1ae1('0x1d')]+')','directioncode':_0x2b8364['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1ae1('0x25')+_0x2b8364[_0x1ae1('0x1d')]+')','participationtypemask':_0x2b8364['callDirection']===_0x1ae1('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x1ae1('0x3e')+_0x2b8364[_0x1ae1('0x29')]+')','participationtypemask':_0x2b8364[_0x1ae1('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x4b81fb[_0x1ae1('0x3f')],_0x44334a,_0x4b81fb[_0x1ae1('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x23a325,'OData-Version':_0x1ae1('0x40')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x26e4dd);})[_0x1ae1('0x10')](function(_0x32136e){var _0x1db432=_0x32136e[_0x1ae1('0x45')]['odata-entityid'];var _0x430468=_0x1db432['substring'](_0x1db432['lastIndexOf']('(')+0x1,_0x1db432[_0x1ae1('0x28')](')'));_0x2b8364[_0x1ae1('0x46')]=_0x430468;_0x6ea19c(_0x2b8364);})[_0x1ae1('0x2a')](function(_0x4468d5){_0x1acf38(_0x4468d5['message']);});});}function emit(_0x48e943,_0x2d5b51,_0x41f934,_0x4dc6b0){var _0x23d0a5={'uri':util[_0x1ae1('0x47')](_0x1ae1('0x48'),_0x48e943,_0x41f934,_0x4dc6b0)};io['to'](util[_0x1ae1('0x47')](_0x1ae1('0x49'),_0x2d5b51))[_0x1ae1('0x4a')](_0x1ae1('0x4b'),_0x23d0a5);}exports['cs']=function(_0x250296,_0x33767c,_0x5d1bae,_0x4be63e,_0x1aaa56,_0x30d561,_0xb31814,_0x53c314){var _0x306c16={};_0x30d561['remoteUri']=intUtil['stripTrailingSlash'](_0x30d561[_0x1ae1('0x9')]);_0x30d561['serverUrl']=intUtil['stripTrailingSlash'](_0x30d561[_0x1ae1('0x4c')]);_0x306c16[_0x1ae1('0x44')]=_0x53c314===_0x1ae1('0x43')||_0x53c314===_0x1ae1('0x4d')?_0x1ae1('0x43'):'outbound';var _0x9f84b8=util[_0x1ae1('0x47')](_0x1ae1('0x4e'),_0x30d561[_0x1ae1('0x9')]);var _0x49b86e=util[_0x1ae1('0x47')](_0x1ae1('0x4f'),_0x30d561[_0x1ae1('0x50')]);var _0x235741=util[_0x1ae1('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30d561[_0x1ae1('0x4c')],_0x33767c['uniqueid'],md5(_0x33767c[_0x1ae1('0x51')]));if(_0x1aaa56&&_0x1aaa56[_0x1ae1('0x52')]){logger[_0x1ae1('0x19')](_0x1ae1('0x53'),_0x1ae1('0x54'));_0x33767c['recordingURL']=_0x235741;}else if(_0xb31814&&_0xb31814[_0x1ae1('0x55')]&&_0xb31814['recordingFormat']!==_0x1ae1('0x56')){logger[_0x1ae1('0x19')](_0x1ae1('0x57'),'Recording\x20is\x20enabled!');_0x33767c[_0x1ae1('0x58')]=_0x235741;}else{_0x33767c[_0x1ae1('0x58')]='';}return getUser(_0x306c16,_0x30d561,_0x4be63e,_0x49b86e,_0x9f84b8,_0x53c314)['then'](function(_0x289487){logger[_0x1ae1('0x19')]('['+_0x53c314['toUpperCase']()+_0x1ae1('0x59'),_0x289487[_0x1ae1('0x1d')]);logger[_0x1ae1('0x19')]('['+_0x53c314['toUpperCase']()+_0x1ae1('0x5a'),_0x289487['userEmail']);return getEndUser(_0x289487,_0x30d561,_0x49b86e,_0x9f84b8,_0x33767c,_0x53c314);})[_0x1ae1('0x10')](function(_0x405710){logger['info']('['+_0x53c314[_0x1ae1('0x1a')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x405710[_0x1ae1('0x29')]);logger['info']('['+_0x53c314[_0x1ae1('0x1a')]()+_0x1ae1('0x5b'),_0x33767c['calleridnum']);return getTicket(_0x405710,_0x30d561,_0x49b86e,_0x9f84b8,_0x33767c,_0x5d1bae,_0x53c314);})['then'](function(_0x50b38e){logger['info'](util[_0x1ae1('0x47')]('['+_0x53c314[_0x1ae1('0x1a')]()+_0x1ae1('0x5c'),_0x5d1bae[_0x1ae1('0x37')],_0x50b38e[_0x1ae1('0x46')]));logger[_0x1ae1('0x19')](util[_0x1ae1('0x47')]('['+_0x53c314[_0x1ae1('0x1a')]()+_0x1ae1('0x5d'),_0x53c314));if(_0x53c314!==_0x1ae1('0x4d')){logger[_0x1ae1('0x19')]('['+_0x53c314[_0x1ae1('0x1a')]()+']',_0x1ae1('0x5e'));emit(_0x30d561[_0x1ae1('0x9')],_0x4be63e[_0x1ae1('0x5f')],_0x5d1bae[_0x1ae1('0x37')],_0x50b38e[_0x1ae1('0x46')]);}})['catch'](function(_0xf5c7da){logger['error']('['+_0x53c314[_0x1ae1('0x1a')]()+_0x1ae1('0x60'),util[_0x1ae1('0x61')](_0xf5c7da,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5926=['enduserId','message','contacts?$select=telephone1','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!','forEach','string','nameField','customField','idField','substring','indexOf','content','ticketType','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','phonecall','phonecalls','callDirection','queue','Fields','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','%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','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','util','./util','md5','ioredis','../../../../config/environment','defaults','redis','POST','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info','userEmail','catch','toLowerCase','outbound','calleridnum','contacts','headers','lastIndexOf'];(function(_0x1aa9ac,_0x4c4c7d){var _0x705dfb=function(_0x187d9e){while(--_0x187d9e){_0x1aa9ac['push'](_0x1aa9ac['shift']());}};_0x705dfb(++_0x4c4c7d);}(_0x5926,0xf3));var _0x6592=function(_0x146167,_0x57b75d){_0x146167=_0x146167-0x0;var _0x51b95b=_0x5926[_0x146167];return _0x51b95b;};'use strict';var _=require('lodash');var BPromise=require(_0x6592('0x0'));var rp=require('request-promise');var util=require(_0x6592('0x1'));var intUtil=require(_0x6592('0x2'));var md5=require(_0x6592('0x3'));var Redis=require(_0x6592('0x4'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x6592('0x5'));config['redis']=_[_0x6592('0x6')](config[_0x6592('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6592('0x7')]));function getAuthToken(_0x25b528,_0x2bd265,_0x3cfe46){var _0x5988e6={'method':_0x6592('0x8'),'uri':_0x2bd265,'form':{'client_id':_0x25b528[_0x6592('0x9')],'resource':_0x25b528['remoteUri'],'username':_0x25b528[_0x6592('0xa')],'password':_0x25b528[_0x6592('0xb')],'grant_type':'password','client_secret':_0x25b528[_0x6592('0xc')]},'json':!![]};return rp(_0x5988e6)[_0x6592('0xd')](function(_0x393331){return _0x393331[_0x6592('0xe')];})['catch'](function(_0x5d6ac3){logger[_0x6592('0xf')]('['+[_0x3cfe46[_0x6592('0x10')]()]+_0x6592('0x11'));return _0x5d6ac3['message'];});}function getUser(_0xa2fa56,_0x324541,_0x389a37,_0x311c7c,_0x171308,_0x2544f9){return new BPromise(function(_0x4714eb,_0x188c11){return getAuthToken(_0x324541,_0x311c7c,_0x2544f9)[_0x6592('0xd')](function(_0x400f52){var _0x434297={'method':_0x6592('0x12'),'uri':_0x171308+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x6592('0x13')+_0x400f52,'OData-Version':_0x6592('0x14')},'json':!![]};return rp(_0x434297);})['then'](function(_0x842e65){var _0x17912f=_0x842e65[_0x6592('0x15')];var _0x3df4f9=![];var _0x42ac27=null;if(!_[_0x6592('0x16')](_0x389a37)){if(intUtil['validateEmail'](_0x389a37['email'])){_0xa2fa56['userEmail']=_0x389a37[_0x6592('0x17')];for(_0x42ac27=0x0;_0x42ac27<_0x17912f[_0x6592('0x18')];_0x42ac27++){if(_0x17912f[_0x42ac27][_0x6592('0x19')]===_0x389a37[_0x6592('0x17')]&&!_0x17912f[_0x42ac27][_0x6592('0x1a')]){_0x3df4f9=!![];logger['info']('['+[_0x2544f9[_0x6592('0x10')]()]+_0x6592('0x1b')+_0x17912f[_0x42ac27]['systemuserid']+'!');_0xa2fa56[_0x6592('0x1c')]=_0x17912f[_0x42ac27][_0x6592('0x1d')];}}}}if(!_0x3df4f9){logger[_0x6592('0x1e')]('['+[_0x2544f9['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xa2fa56[_0x6592('0x1f')]=_0x324541[_0x6592('0xa')];for(_0x42ac27=0x0;_0x42ac27<_0x17912f[_0x6592('0x18')];_0x42ac27++){if(_0x17912f[_0x42ac27][_0x6592('0x19')]===_0x324541[_0x6592('0xa')]){_0xa2fa56[_0x6592('0x1c')]=_0x17912f[_0x42ac27][_0x6592('0x1d')];}}}_0x4714eb(_0xa2fa56);})[_0x6592('0x20')](function(_0x12ae89){_0x188c11(_0x12ae89['message']);});});}function createEndUser(_0x38f599,_0x481c7e,_0x38ccdc,_0x5a9f80,_0x4d1c7d,_0x19cb10){return new BPromise(function(_0xfe8110,_0x39bd46){return getAuthToken(_0x481c7e,_0x38ccdc,_0x19cb10)[_0x6592('0xd')](function(_0x3ddcfe){var _0x376861=_0x19cb10[_0x6592('0x21')]()===_0x6592('0x22')?_0x4d1c7d['destcalleridnum']:_0x4d1c7d[_0x6592('0x23')];var _0x5e4f95={'method':_0x6592('0x8'),'uri':_0x5a9f80+_0x6592('0x24'),'body':{'telephone1':_0x376861,'fullname':_0x376861,'firstname':_0x376861,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x38f599[_0x6592('0x1c')]+')'},'headers':{'Authorization':_0x6592('0x13')+_0x3ddcfe,'OData-Version':_0x6592('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5e4f95);})['then'](function(_0x4d2f7c){var _0x2aa69d=_0x4d2f7c[_0x6592('0x25')]['odata-entityid'];var _0xdffdc2=_0x2aa69d['substring'](_0x2aa69d['lastIndexOf']('(')+0x1,_0x2aa69d[_0x6592('0x26')](')'));_0x38f599[_0x6592('0x27')]=_0xdffdc2;_0xfe8110(_0x38f599);})[_0x6592('0x20')](function(_0x3ad346){_0x39bd46(_0x3ad346[_0x6592('0x28')]);});});}function getEndUser(_0x5caf4d,_0x57db1c,_0x230f86,_0x1b59cb,_0x49cfc8,_0x281537){return new BPromise(function(_0x26e2ba,_0x5ab325){return getAuthToken(_0x57db1c,_0x230f86,_0x281537)['then'](function(_0x1fd050){var _0x11c916={'method':_0x6592('0x12'),'uri':_0x1b59cb+_0x6592('0x29'),'headers':{'Authorization':'Bearer\x20'+_0x1fd050,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x11c916);})[_0x6592('0xd')](function(_0x260633){var _0x3afe8b=null;if(_0x260633){var _0x480b83=_0x260633[_0x6592('0x15')];var _0x3de3c6=![];for(_0x3afe8b=0x0;_0x3afe8b<_0x480b83[_0x6592('0x18')];_0x3afe8b++){var _0x32239b=_0x281537[_0x6592('0x21')]()==='outbound'?_0x49cfc8[_0x6592('0x2a')]:_0x49cfc8[_0x6592('0x23')];if(_0x480b83[_0x3afe8b][_0x6592('0x2b')]===_0x32239b){_0x3de3c6=!![];_0x5caf4d['enduserId']=_0x480b83[_0x3afe8b][_0x6592('0x2c')];}}if(_0x3de3c6){_0x26e2ba(_0x5caf4d);}else{return createEndUser(_0x5caf4d,_0x57db1c,_0x230f86,_0x1b59cb,_0x49cfc8,_0x281537)[_0x6592('0xd')](function(_0xadc24a){logger['info']('['+[_0x281537[_0x6592('0x10')]()]+_0x6592('0x2d'),_0xadc24a['enduserId']);_0x26e2ba(_0xadc24a);});}}else{return createEndUser(_0x5caf4d,_0x57db1c,_0x230f86,_0x1b59cb,_0x49cfc8,_0x281537)['then'](function(_0x5923ef){logger['info']('['+[_0x281537[_0x6592('0x10')]()]+']\x20Enduser\x20Created!',_0x5923ef['enduserId']);_0x26e2ba(_0x5923ef);});}});});}function getCustomFields(_0x9940df,_0x1fee97,_0x4d60cb){var _0x1a7d6e={};if(_0x9940df[_0x6592('0x18')]>0x0){_[_0x6592('0x2e')](_0x9940df,function(_0x1db04c){if(_0x1db04c['type']===_0x6592('0x2f')&&_0x1db04c[_0x6592('0x30')]&&!_0x1db04c[_0x6592('0x31')]){var _0x1b5e08=_0x1db04c[_0x6592('0x32')][_0x6592('0x21')]();var _0x59f795=_0x1b5e08[_0x6592('0x33')](0x0,_0x1b5e08['indexOf']('_'));var _0x4e89c3=_0x1b5e08[_0x6592('0x33')](_0x1b5e08[_0x6592('0x34')]('_')+0x1);if(_0x59f795===_0x4d60cb){_0x1a7d6e[_0x4e89c3]=_0x1db04c[_0x6592('0x35')];}}});}return _0x1a7d6e;}function getTicket(_0x109b0b,_0x423efd,_0x206bb6,_0x45cd25,_0x5360f5,_0x4b0fac,_0x2349f2){return new BPromise(function(_0xbe9db1,_0x29d4c8){var _0x343ae3;return getAuthToken(_0x423efd,_0x206bb6,_0x2349f2)[_0x6592('0xd')](function(_0xfc7fd4){if(_0x4b0fac[_0x6592('0x36')]==='incident'){_0x343ae3={'method':_0x6592('0x8'),'uri':_0x45cd25+'incidents','body':Object[_0x6592('0x37')]({},{'title':intUtil[_0x6592('0x38')](_0x4b0fac[_0x6592('0x39')],_0x5360f5,'\x20'),'description':intUtil['getString'](_0x4b0fac[_0x6592('0x3a')],_0x5360f5,'\x0a'),'customerid_contact@odata.bind':_0x6592('0x3b')+_0x109b0b[_0x6592('0x27')]+')','ownerid@odata.bind':_0x6592('0x3c')+_0x109b0b['userId']+')','caseorigincode':'1'},getCustomFields(_0x4b0fac['Fields'],_0x5360f5,_0x4b0fac[_0x6592('0x36')])),'headers':{'Authorization':_0x6592('0x13')+_0xfc7fd4,'OData-Version':_0x6592('0x14')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4b0fac[_0x6592('0x36')]===_0x6592('0x3d')){_0x343ae3={'method':'POST','uri':_0x45cd25+_0x6592('0x3e'),'body':Object[_0x6592('0x37')]({},{'subject':intUtil[_0x6592('0x38')](_0x4b0fac['Subjects'],_0x5360f5,'\x20'),'phonenumber':String(_0x5360f5['calleridnum']),'description':intUtil[_0x6592('0x38')](_0x4b0fac[_0x6592('0x3a')],_0x5360f5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x6592('0x3b')+_0x109b0b[_0x6592('0x27')]+')','ownerid@odata.bind':_0x6592('0x3c')+_0x109b0b[_0x6592('0x1c')]+')','directioncode':_0x109b0b[_0x6592('0x3f')]===_0x6592('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x6592('0x3c')+_0x109b0b['userId']+')','participationtypemask':_0x109b0b['callDirection']===_0x6592('0x40')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x109b0b[_0x6592('0x27')]+')','participationtypemask':_0x109b0b[_0x6592('0x3f')]==='queue'?0x1:0x2}]},getCustomFields(_0x4b0fac[_0x6592('0x41')],_0x5360f5,_0x4b0fac[_0x6592('0x36')])),'headers':{'Authorization':'Bearer\x20'+_0xfc7fd4,'OData-Version':_0x6592('0x14')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x343ae3);})['then'](function(_0x184d97){var _0x4cf085=_0x184d97[_0x6592('0x25')][_0x6592('0x42')];var _0x323a73=_0x4cf085[_0x6592('0x33')](_0x4cf085[_0x6592('0x26')]('(')+0x1,_0x4cf085['lastIndexOf'](')'));_0x109b0b[_0x6592('0x43')]=_0x323a73;_0xbe9db1(_0x109b0b);})[_0x6592('0x20')](function(_0x5a724a){_0x29d4c8(_0x5a724a[_0x6592('0x28')]);});});}function emit(_0x54c1e1,_0x4deeba,_0x123b28,_0x37c1ef){var _0x14141c={'uri':util[_0x6592('0x44')](_0x6592('0x45'),_0x54c1e1,_0x123b28,_0x37c1ef)};io['to'](util[_0x6592('0x44')](_0x6592('0x46'),_0x4deeba))[_0x6592('0x47')](_0x6592('0x48'),_0x14141c);}exports['cs']=function(_0x3ec76b,_0x6fab4d,_0x5b17b9,_0x35de82,_0x4f8277,_0x314be4,_0x430c8c,_0x5e1127){var _0xd30173={};_0x314be4[_0x6592('0x49')]=intUtil['stripTrailingSlash'](_0x314be4['remoteUri']);_0x314be4[_0x6592('0x4a')]=intUtil[_0x6592('0x4b')](_0x314be4['serverUrl']);_0xd30173[_0x6592('0x3f')]=_0x5e1127===_0x6592('0x40')||_0x5e1127==='unmanaged'?'queue':_0x6592('0x22');var _0x4e81fe=util[_0x6592('0x44')](_0x6592('0x4c'),_0x314be4[_0x6592('0x49')]);var _0x41764f=util['format'](_0x6592('0x4d'),_0x314be4[_0x6592('0x4e')]);var _0x4b51e1=util[_0x6592('0x44')](_0x6592('0x4f'),_0x314be4[_0x6592('0x4a')],_0x6fab4d[_0x6592('0x50')],md5(_0x6fab4d['uniqueid']));if(_0x4f8277&&_0x4f8277[_0x6592('0x51')]){logger[_0x6592('0x1e')]('[QUEUE]',_0x6592('0x52'));_0x6fab4d[_0x6592('0x53')]=_0x4b51e1;}else if(_0x430c8c&&_0x430c8c[_0x6592('0x54')]&&_0x430c8c[_0x6592('0x54')]!=='none'){logger[_0x6592('0x1e')]('[OUTBOUND]',_0x6592('0x52'));_0x6fab4d[_0x6592('0x53')]=_0x4b51e1;}else{_0x6fab4d[_0x6592('0x53')]='';}return getUser(_0xd30173,_0x314be4,_0x35de82,_0x41764f,_0x4e81fe,_0x5e1127)['then'](function(_0x2b87e9){logger[_0x6592('0x1e')]('['+_0x5e1127[_0x6592('0x10')]()+_0x6592('0x55'),_0x2b87e9[_0x6592('0x1c')]);logger[_0x6592('0x1e')]('['+_0x5e1127[_0x6592('0x10')]()+_0x6592('0x56'),_0x2b87e9[_0x6592('0x1f')]);return getEndUser(_0x2b87e9,_0x314be4,_0x41764f,_0x4e81fe,_0x6fab4d,_0x5e1127);})['then'](function(_0x316206){logger[_0x6592('0x1e')]('['+_0x5e1127[_0x6592('0x10')]()+_0x6592('0x57'),_0x316206[_0x6592('0x27')]);logger['info']('['+_0x5e1127[_0x6592('0x10')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x6fab4d['calleridnum']);return getTicket(_0x316206,_0x314be4,_0x41764f,_0x4e81fe,_0x6fab4d,_0x5b17b9,_0x5e1127);})[_0x6592('0xd')](function(_0x51d06b){logger[_0x6592('0x1e')](util[_0x6592('0x44')]('['+_0x5e1127['toUpperCase']()+_0x6592('0x58'),_0x5b17b9[_0x6592('0x36')],_0x51d06b['ticketId']));logger[_0x6592('0x1e')](util['format']('['+_0x5e1127[_0x6592('0x10')]()+_0x6592('0x59'),_0x5e1127));if(_0x5e1127!==_0x6592('0x5a')){logger[_0x6592('0x1e')]('['+_0x5e1127[_0x6592('0x10')]()+']',_0x6592('0x5b'));emit(_0x314be4[_0x6592('0x49')],_0x35de82[_0x6592('0x5c')],_0x5b17b9[_0x6592('0x36')],_0x51d06b[_0x6592('0x43')]);}})['catch'](function(_0x4fce95){logger[_0x6592('0xf')]('['+_0x5e1127[_0x6592('0x10')]()+_0x6592('0x5d'),util['inspect'](_0x4fce95,{'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 e62263d..1dd5512 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 _0xdf3b=['./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','custom_fields','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','remoteUri','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','idField','push','variable','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Ticket\x20ID\x20is:','stringify','unmanaged','toUpperCase','lastevent','request-promise','md5','util','ioredis'];(function(_0x3ed920,_0x2e6d2a){var _0x4e08b0=function(_0x2339d2){while(--_0x2339d2){_0x3ed920['push'](_0x3ed920['shift']());}};_0x4e08b0(++_0x2e6d2a);}(_0xdf3b,0x113));var _0xbdf3=function(_0x5eff86,_0x2cdd22){_0x5eff86=_0x5eff86-0x0;var _0x4b3010=_0xdf3b[_0x5eff86];return _0x4b3010;};'use strict';var _=require('lodash');var rp=require(_0xbdf3('0x0'));var md5=require(_0xbdf3('0x1'));var util=require(_0xbdf3('0x2'));var Redis=require(_0xbdf3('0x3'));var intUtil=require(_0xbdf3('0x4'));var config=require(_0xbdf3('0x5'));var logger=require(_0xbdf3('0x6'))('freshdesk');config[_0xbdf3('0x7')]=_[_0xbdf3('0x8')](config[_0xbdf3('0x7')],{'host':_0xbdf3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbdf3('0x7')]));var headers={'Content-Type':'application/json','Accept':_0xbdf3('0xa')};function emit(_0x20909d,_0x53b6b7,_0x1ffd87){io['to'](_0x20909d)[_0xbdf3('0xb')](_0x53b6b7,_0x1ffd87);}function getTicket(_0x4c85b5,_0x23dc1c,_0x2b72f9,_0x26c135,_0x5820d8){logger[_0xbdf3('0xc')]('Creating\x20new\x20ticket...');var _0x38d9f1=_[_0xbdf3('0xd')]({'responder_id':_0x23dc1c['id'],'requester_id':_0x2b72f9['id'],'name':util[_0xbdf3('0xe')](_0xbdf3('0xf'),_0x5820d8[_0xbdf3('0x10')]),'phone':_0x5820d8[_0xbdf3('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xbdf3('0x12')](_0x26c135[_0xbdf3('0x13')],_0x5820d8,'\x20'),'description':intUtil[_0xbdf3('0x12')](_0x26c135['Descriptions'],_0x5820d8,_0xbdf3('0x14')),'tags':getTags(_0x26c135[_0xbdf3('0x15')],'name')},getCustomFields(_0x26c135['Fields'],_0x5820d8));_0x38d9f1[_0xbdf3('0x16')]=_['mapValues'](_[_0xbdf3('0x17')](_0x38d9f1[_0xbdf3('0x16')],'id'),_0xbdf3('0x18'));return request({'uri':util['format'](_0xbdf3('0x19'),_0x4c85b5['remoteUri']),'method':_0xbdf3('0x1a'),'body':_0x38d9f1})[_0xbdf3('0x1b')](function(_0x230548){logger[_0xbdf3('0xc')](_0xbdf3('0x1c'));return _0x230548;});}function getUser(_0x1274d3,_0x3117b9){if(intUtil[_0xbdf3('0x1d')](_0x3117b9)){return request({'uri':util[_0xbdf3('0xe')](_0xbdf3('0x1e'),_0x1274d3['remoteUri']),'qs':{'email':_0x3117b9}})[_0xbdf3('0x1b')](function(_0x50ca30){if(_0x50ca30[_0xbdf3('0x1f')]){logger[_0xbdf3('0xc')](_0xbdf3('0x20'));return _[_0xbdf3('0x21')](_0x50ca30,function(_0x2efb8d){return _0x2efb8d[_0xbdf3('0x22')][_0xbdf3('0x23')]===_0x3117b9;});}else{logger[_0xbdf3('0xc')](_0xbdf3('0x24'));return request({'uri':util['format'](_0xbdf3('0x25'),_0x1274d3['remoteUri'])})[_0xbdf3('0x1b')](function(_0x1c38e5){logger[_0xbdf3('0xc')]('Admin\x20account\x20selected.');return _0x1c38e5;});}});}else{logger[_0xbdf3('0xc')](_0xbdf3('0x26'));return request({'uri':util[_0xbdf3('0xe')](_0xbdf3('0x25'),_0x1274d3['remoteUri'])})['then'](function(_0x2aba08){logger[_0xbdf3('0xc')](_0xbdf3('0x27'));return _0x2aba08;});}}function getEndUser(_0x469830,_0x5cef48,_0xc37037){logger[_0xbdf3('0xc')](_0xbdf3('0x28'),_0xc37037);return request({'uri':util['format']('%s/api/v2/contacts',_0x469830[_0xbdf3('0x29')]),'qs':{'phone':_0xc37037}})[_0xbdf3('0x1b')](function(_0xfb9277){if(_0xfb9277[_0xbdf3('0x1f')]){logger[_0xbdf3('0xc')](_0xbdf3('0x2a'));return _[_0xbdf3('0x21')](_0xfb9277,{'phone':_0xc37037});}else{logger[_0xbdf3('0xc')](_0xbdf3('0x2b'));return request({'uri':util[_0xbdf3('0xe')](_0xbdf3('0x2c'),_0x469830[_0xbdf3('0x29')]),'method':'POST','body':{'name':_0x5cef48,'phone':_0xc37037}})[_0xbdf3('0x1b')](function(_0x9a80e3){logger[_0xbdf3('0xc')]('Enduser\x20created.');return _0x9a80e3;});}});}function getAuth(_0x588e62){return util[_0xbdf3('0xe')]('Basic\x20%s',new Buffer(_0x588e62[_0xbdf3('0x2d')]+':X')[_0xbdf3('0x2e')](_0xbdf3('0x2f')));}function request(_0x238129){logger[_0xbdf3('0x30')](_0xbdf3('0x31'),JSON['stringify'](_0x238129));return rp(_[_0xbdf3('0x8')](_0x238129,{'method':_0xbdf3('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x21dd7b,_0x5a47cc){var _0x151a8a=[];if(_0x21dd7b&&_0x21dd7b[_0xbdf3('0x1f')]>0x0){_0x151a8a=_[_0xbdf3('0x33')](_0x21dd7b,_0x5a47cc);}return _0x151a8a;}function getCustomFields(_0x111cea,_0x2b7bc1){var _0x40285c=[];var _0x28448e={'custom_fields':[]};if(_0x111cea[_0xbdf3('0x1f')]>0x0){_[_0xbdf3('0x34')](_0x111cea,function(_0x521da7){if(_0x521da7[_0xbdf3('0x35')]==='string'&&_0x521da7[_0xbdf3('0x36')]&&!_0x521da7[_0xbdf3('0x37')]){_0x28448e[_0x521da7[_0xbdf3('0x36')][_0xbdf3('0x38')]()]=_0x521da7[_0xbdf3('0x39')][_0xbdf3('0x2e')]();}else if(_0x521da7[_0xbdf3('0x35')]===_0xbdf3('0x3a')&&_0x521da7[_0xbdf3('0x3b')]&&_0x521da7[_0xbdf3('0x37')]){_0x28448e['custom_fields'][_0xbdf3('0x3c')]({'id':_0x521da7['idField'],'value':_0x521da7[_0xbdf3('0x39')][_0xbdf3('0x2e')]()});}else if(_0x521da7[_0xbdf3('0x35')]===_0xbdf3('0x3d')&&_0x521da7['variableName']&&_0x521da7[_0xbdf3('0x3b')]&&_0x521da7['customField']){_0x2b7bc1[_0x521da7['variableName']]&&_0x28448e['custom_fields']['push']({'id':_0x521da7[_0xbdf3('0x3b')],'value':_0x2b7bc1[_0x521da7[_0xbdf3('0x3e')]][_0xbdf3('0x2e')]()});}else if(_0x521da7['type']===_0xbdf3('0x3f')&&_0x521da7['Variable']&&_0x521da7[_0xbdf3('0x40')]['name']&&_0x521da7[_0xbdf3('0x3b')]&&_0x521da7[_0xbdf3('0x37')]){_0x2b7bc1[_0x521da7['Variable']['name']['toLowerCase']()]&&_0x28448e[_0xbdf3('0x16')][_0xbdf3('0x3c')]({'id':_0x521da7[_0xbdf3('0x3b')],'value':_0x2b7bc1[_0x521da7[_0xbdf3('0x40')][_0xbdf3('0x41')]['toLowerCase']()][_0xbdf3('0x2e')]()});}});}return _0x28448e;}exports[_0xbdf3('0x42')]=function(_0x2f30c3,_0x32094f,_0x2402d2,_0x1cf4f6,_0x4c0eed,_0x44b51e){var _0x58fa81,_0x506f0c;_0x44b51e[_0xbdf3('0x29')]=intUtil['stripTrailingSlash'](_0x44b51e[_0xbdf3('0x29')]);_0x44b51e[_0xbdf3('0x43')]=intUtil[_0xbdf3('0x44')](_0x44b51e[_0xbdf3('0x43')]);if(_0x4c0eed&&_0x4c0eed[_0xbdf3('0x45')]){logger[_0xbdf3('0xc')](_0xbdf3('0x46'),_0xbdf3('0x47'));_0x32094f[_0xbdf3('0x48')]=util[_0xbdf3('0xe')](_0xbdf3('0x49'),_0x44b51e[_0xbdf3('0x43')],_0x32094f[_0xbdf3('0x4a')],md5(_0x32094f['uniqueid']));}else{_0x32094f[_0xbdf3('0x48')]='';}headers[_0xbdf3('0x4b')]=getAuth(_0x44b51e);return getUser(_0x44b51e,_0x1cf4f6[_0xbdf3('0x23')])[_0xbdf3('0x1b')](function(_0x67dedf){_0x58fa81=_0x67dedf;logger['info']('The\x20User\x20ID\x20is:',_0x58fa81['id']);return getEndUser(_0x44b51e,_0x32094f[_0xbdf3('0x10')],_0x32094f[_0xbdf3('0x11')]);})[_0xbdf3('0x1b')](function(_0x453a01){_0x506f0c=_0x453a01;logger['info'](_0xbdf3('0x4c'),_0x506f0c['id']);return getTicket(_0x44b51e,_0x58fa81,_0x506f0c,_0x2402d2,_0x32094f);})[_0xbdf3('0x1b')](function(_0x864c5a){if(_0x864c5a&&_0x864c5a['id']){logger[_0xbdf3('0xc')](_0xbdf3('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x864c5a['id']);logger[_0xbdf3('0xc')](_0xbdf3('0x46'),_0xbdf3('0x4d'));emit(util[_0xbdf3('0xe')](_0xbdf3('0x4e'),_0x1cf4f6[_0xbdf3('0x41')]),_0xbdf3('0x4f'),{'uri':util[_0xbdf3('0xe')](_0xbdf3('0x50'),_0x44b51e[_0xbdf3('0x29')],_0x864c5a['id'])});}})[_0xbdf3('0x51')](function(_0x35cb99){logger[_0xbdf3('0x52')]('[QUEUE]',JSON['stringify'](_0x35cb99));});};exports[_0xbdf3('0x53')]=function(_0x4ff251,_0x3f1551,_0xf27a9e,_0x15029a,_0x59b1c6,_0x514324,_0x241407){var _0x170c1b,_0x517aef;_0x514324['remoteUri']=intUtil[_0xbdf3('0x44')](_0x514324[_0xbdf3('0x29')]);_0x514324['serverUrl']=intUtil[_0xbdf3('0x44')](_0x514324[_0xbdf3('0x43')]);if(_0x241407&&_0x241407[_0xbdf3('0x54')]&&_0x241407[_0xbdf3('0x54')]!=='none'){logger[_0xbdf3('0xc')](_0xbdf3('0x55'),'Recording\x20is\x20enabled!');_0x3f1551['recordingURL']=util[_0xbdf3('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x514324[_0xbdf3('0x43')],_0x3f1551[_0xbdf3('0x4a')],md5(_0x3f1551['uniqueid']));}headers['Authorization']=getAuth(_0x514324);return getUser(_0x514324,_0x15029a[_0xbdf3('0x23')])[_0xbdf3('0x1b')](function(_0x2bf9f1){_0x170c1b=_0x2bf9f1;logger[_0xbdf3('0xc')](_0xbdf3('0x56'),_0x170c1b['id']);return getEndUser(_0x514324,_0x3f1551[_0xbdf3('0x57')],_0x3f1551['destcalleridnum']);})['then'](function(_0x1c6021){_0x517aef=_0x1c6021;logger[_0xbdf3('0xc')](_0xbdf3('0x4c'),_0x517aef['id']);return getTicket(_0x514324,_0x170c1b,_0x517aef,_0xf27a9e,_0x3f1551);})['then'](function(_0x23ab63){if(_0x23ab63&&_0x23ab63['id']){logger[_0xbdf3('0xc')](_0xbdf3('0x1c'));logger[_0xbdf3('0xc')](_0xbdf3('0x58'),_0x23ab63['id']);logger[_0xbdf3('0xc')]('[OUTBOUND]',_0xbdf3('0x4d'));emit(util[_0xbdf3('0xe')](_0xbdf3('0x4e'),_0x15029a['name']),_0xbdf3('0x4f'),{'uri':util[_0xbdf3('0xe')](_0xbdf3('0x50'),_0x514324[_0xbdf3('0x29')],_0x23ab63['id'])});}})[_0xbdf3('0x51')](function(_0x2a5338){logger[_0xbdf3('0x52')](_0xbdf3('0x55'),JSON[_0xbdf3('0x59')](_0x2a5338));});};exports[_0xbdf3('0x5a')]=function(_0x1f57af,_0x182270,_0x3ae7ac,_0x590278,_0x5345c4,_0x14a958){var _0x515b8c,_0x32a445;_0x14a958['remoteUri']=intUtil[_0xbdf3('0x44')](_0x14a958['remoteUri']);_0x14a958['serverUrl']=intUtil['stripTrailingSlash'](_0x14a958[_0xbdf3('0x43')]);if(_0x5345c4&&_0x5345c4[_0xbdf3('0x45')]){logger['info']('['+_0x182270['lastevent'][_0xbdf3('0x5b')]()+']',_0xbdf3('0x47'));_0x182270[_0xbdf3('0x48')]=util[_0xbdf3('0xe')](_0xbdf3('0x49'),_0x14a958[_0xbdf3('0x43')],_0x182270[_0xbdf3('0x4a')],md5(_0x182270[_0xbdf3('0x4a')]));}else{_0x182270[_0xbdf3('0x48')]='';}headers['Authorization']=getAuth(_0x14a958);return getUser(_0x14a958,'')[_0xbdf3('0x1b')](function(_0x431a90){_0x515b8c=_0x431a90;logger[_0xbdf3('0xc')](_0xbdf3('0x56'),_0x515b8c['id']);return getEndUser(_0x14a958,_0x182270[_0xbdf3('0x10')],_0x182270[_0xbdf3('0x11')]);})['then'](function(_0x50cf9e){_0x32a445=_0x50cf9e;logger['info'](_0xbdf3('0x4c'),_0x32a445['id']);return getTicket(_0x14a958,_0x515b8c,_0x32a445,_0x3ae7ac,_0x182270);})[_0xbdf3('0x1b')](function(_0x109932){if(_0x109932){logger[_0xbdf3('0xc')]('Ticket\x20created!');logger[_0xbdf3('0xc')](_0xbdf3('0x58'),_0x109932['id']);}})[_0xbdf3('0x51')](function(_0x4bc1dd){logger[_0xbdf3('0x52')]('['+_0x182270[_0xbdf3('0x5c')][_0xbdf3('0x5b')]()+']',JSON['stringify'](_0x4bc1dd));});}; \ No newline at end of file +var _0x7cf7=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','catch','error','outbound','serverUrl','recordingFormat','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','md5','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','debug','[HTTP]','stringify','map','type','nameField','customField','toLowerCase','content','string','idField','push','variableName','toString','customVariable','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7cf7,0x11a));var _0x77cf=function(_0x2843d0,_0x3635fb){_0x2843d0=_0x2843d0-0x0;var _0x87965f=_0x7cf7[_0x2843d0];return _0x87965f;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x77cf('0x0'));var util=require('util');var Redis=require(_0x77cf('0x1'));var intUtil=require(_0x77cf('0x2'));var config=require(_0x77cf('0x3'));var logger=require('../../../../config/logger')(_0x77cf('0x4'));config[_0x77cf('0x5')]=_[_0x77cf('0x6')](config[_0x77cf('0x5')],{'host':_0x77cf('0x7'),'port':0x18eb});var io=require(_0x77cf('0x8'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x310690,_0x32ef1d,_0x4bc571){io['to'](_0x310690)[_0x77cf('0x9')](_0x32ef1d,_0x4bc571);}function getTicket(_0x3491d0,_0x30ebc6,_0x462d5,_0x5b0c85,_0x54ece5){logger[_0x77cf('0xa')](_0x77cf('0xb'));var _0x101ad2=_['merge']({'responder_id':_0x30ebc6['id'],'requester_id':_0x462d5['id'],'name':util[_0x77cf('0xc')](_0x77cf('0xd'),_0x54ece5[_0x77cf('0xe')]),'phone':_0x54ece5[_0x77cf('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5b0c85[_0x77cf('0x10')],_0x54ece5,'\x20'),'description':intUtil[_0x77cf('0x11')](_0x5b0c85[_0x77cf('0x12')],_0x54ece5,_0x77cf('0x13')),'tags':getTags(_0x5b0c85[_0x77cf('0x14')],_0x77cf('0x15'))},getCustomFields(_0x5b0c85[_0x77cf('0x16')],_0x54ece5));_0x101ad2['custom_fields']=_[_0x77cf('0x17')](_[_0x77cf('0x18')](_0x101ad2[_0x77cf('0x19')],'id'),_0x77cf('0x1a'));return request({'uri':util[_0x77cf('0xc')](_0x77cf('0x1b'),_0x3491d0[_0x77cf('0x1c')]),'method':'POST','body':_0x101ad2})[_0x77cf('0x1d')](function(_0x5b0817){logger[_0x77cf('0xa')](_0x77cf('0x1e'));return _0x5b0817;});}function getUser(_0x334ff5,_0x53864c){if(intUtil[_0x77cf('0x1f')](_0x53864c)){return request({'uri':util['format'](_0x77cf('0x20'),_0x334ff5[_0x77cf('0x1c')]),'qs':{'email':_0x53864c}})[_0x77cf('0x1d')](function(_0x204698){if(_0x204698[_0x77cf('0x21')]){logger[_0x77cf('0xa')]('Agent\x20found!');return _[_0x77cf('0x22')](_0x204698,function(_0x2afe67){return _0x2afe67['contact'][_0x77cf('0x23')]===_0x53864c;});}else{logger['info'](_0x77cf('0x24'));return request({'uri':util[_0x77cf('0xc')](_0x77cf('0x25'),_0x334ff5[_0x77cf('0x1c')])})['then'](function(_0x1e32e3){logger[_0x77cf('0xa')](_0x77cf('0x26'));return _0x1e32e3;});}});}else{logger[_0x77cf('0xa')](_0x77cf('0x27'));return request({'uri':util[_0x77cf('0xc')](_0x77cf('0x25'),_0x334ff5[_0x77cf('0x1c')])})['then'](function(_0x2a4499){logger[_0x77cf('0xa')](_0x77cf('0x26'));return _0x2a4499;});}}function getEndUser(_0x5e3021,_0x8e1ca8,_0x58c8f0){logger[_0x77cf('0xa')](_0x77cf('0x28'),_0x58c8f0);return request({'uri':util['format'](_0x77cf('0x29'),_0x5e3021['remoteUri']),'qs':{'phone':_0x58c8f0}})[_0x77cf('0x1d')](function(_0x268f64){if(_0x268f64[_0x77cf('0x21')]){logger[_0x77cf('0xa')](_0x77cf('0x2a'));return _[_0x77cf('0x22')](_0x268f64,{'phone':_0x58c8f0});}else{logger[_0x77cf('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x77cf('0xc')](_0x77cf('0x29'),_0x5e3021[_0x77cf('0x1c')]),'method':'POST','body':{'name':_0x8e1ca8,'phone':_0x58c8f0}})['then'](function(_0x3b4e5b){logger[_0x77cf('0xa')](_0x77cf('0x2b'));return _0x3b4e5b;});}});}function getAuth(_0x43efa0){return util['format'](_0x77cf('0x2c'),new Buffer(_0x43efa0[_0x77cf('0x2d')]+':X')['toString']('base64'));}function request(_0x2fc33c){logger[_0x77cf('0x2e')](_0x77cf('0x2f'),JSON[_0x77cf('0x30')](_0x2fc33c));return rp(_[_0x77cf('0x6')](_0x2fc33c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2bef32,_0x2cea3b){var _0x37bdf3=[];if(_0x2bef32&&_0x2bef32['length']>0x0){_0x37bdf3=_[_0x77cf('0x31')](_0x2bef32,_0x2cea3b);}return _0x37bdf3;}function getCustomFields(_0x3acee8,_0x5eb1fa){var _0x497041=[];var _0x10f8d4={'custom_fields':[]};if(_0x3acee8['length']>0x0){_['forEach'](_0x3acee8,function(_0x4d816e){if(_0x4d816e[_0x77cf('0x32')]==='string'&&_0x4d816e[_0x77cf('0x33')]&&!_0x4d816e[_0x77cf('0x34')]){_0x10f8d4[_0x4d816e[_0x77cf('0x33')][_0x77cf('0x35')]()]=_0x4d816e[_0x77cf('0x36')]['toString']();}else if(_0x4d816e[_0x77cf('0x32')]===_0x77cf('0x37')&&_0x4d816e[_0x77cf('0x38')]&&_0x4d816e[_0x77cf('0x34')]){_0x10f8d4['custom_fields'][_0x77cf('0x39')]({'id':_0x4d816e['idField'],'value':_0x4d816e[_0x77cf('0x36')]['toString']()});}else if(_0x4d816e[_0x77cf('0x32')]==='variable'&&_0x4d816e['variableName']&&_0x4d816e[_0x77cf('0x38')]&&_0x4d816e['customField']){_0x5eb1fa[_0x4d816e[_0x77cf('0x3a')]]&&_0x10f8d4[_0x77cf('0x19')]['push']({'id':_0x4d816e[_0x77cf('0x38')],'value':_0x5eb1fa[_0x4d816e[_0x77cf('0x3a')]][_0x77cf('0x3b')]()});}else if(_0x4d816e[_0x77cf('0x32')]===_0x77cf('0x3c')&&_0x4d816e[_0x77cf('0x3d')]&&_0x4d816e[_0x77cf('0x3d')][_0x77cf('0x15')]&&_0x4d816e['idField']&&_0x4d816e[_0x77cf('0x34')]){_0x5eb1fa[_0x4d816e['Variable'][_0x77cf('0x15')]['toLowerCase']()]&&_0x10f8d4['custom_fields'][_0x77cf('0x39')]({'id':_0x4d816e[_0x77cf('0x38')],'value':_0x5eb1fa[_0x4d816e[_0x77cf('0x3d')]['name']['toLowerCase']()][_0x77cf('0x3b')]()});}});}return _0x10f8d4;}exports[_0x77cf('0x3e')]=function(_0x18cf19,_0x19219c,_0x3555f3,_0xfc2516,_0x2ba390,_0x13793b){var _0x1b5d70,_0xa9a6ec;_0x13793b[_0x77cf('0x1c')]=intUtil['stripTrailingSlash'](_0x13793b[_0x77cf('0x1c')]);_0x13793b['serverUrl']=intUtil[_0x77cf('0x3f')](_0x13793b['serverUrl']);if(_0x2ba390&&_0x2ba390[_0x77cf('0x40')]){logger[_0x77cf('0xa')](_0x77cf('0x41'),_0x77cf('0x42'));_0x19219c[_0x77cf('0x43')]=util['format'](_0x77cf('0x44'),_0x13793b['serverUrl'],_0x19219c[_0x77cf('0x45')],md5(_0x19219c[_0x77cf('0x45')]));}else{_0x19219c[_0x77cf('0x43')]='';}headers[_0x77cf('0x46')]=getAuth(_0x13793b);return getUser(_0x13793b,_0xfc2516[_0x77cf('0x23')])[_0x77cf('0x1d')](function(_0x2cafe0){_0x1b5d70=_0x2cafe0;logger[_0x77cf('0xa')](_0x77cf('0x47'),_0x1b5d70['id']);return getEndUser(_0x13793b,_0x19219c['calleridname'],_0x19219c[_0x77cf('0xf')]);})[_0x77cf('0x1d')](function(_0x5d8855){_0xa9a6ec=_0x5d8855;logger[_0x77cf('0xa')](_0x77cf('0x48'),_0xa9a6ec['id']);return getTicket(_0x13793b,_0x1b5d70,_0xa9a6ec,_0x3555f3,_0x19219c);})[_0x77cf('0x1d')](function(_0x10051f){if(_0x10051f&&_0x10051f['id']){logger[_0x77cf('0xa')](_0x77cf('0x1e'));logger[_0x77cf('0xa')]('The\x20Ticket\x20ID\x20is:',_0x10051f['id']);logger['info'](_0x77cf('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x77cf('0xc')](_0x77cf('0x49'),_0xfc2516[_0x77cf('0x15')]),_0x77cf('0x4a'),{'uri':util[_0x77cf('0xc')]('%s/helpdesk/tickets/%d',_0x13793b['remoteUri'],_0x10051f['id'])});}})[_0x77cf('0x4b')](function(_0x3b818a){logger[_0x77cf('0x4c')]('[QUEUE]',JSON[_0x77cf('0x30')](_0x3b818a));});};exports[_0x77cf('0x4d')]=function(_0x393fed,_0x540ed9,_0x1a0e16,_0x3c7130,_0x5b5c90,_0x343ea4,_0x2592f5){var _0x241e55,_0x9031ae;_0x343ea4[_0x77cf('0x1c')]=intUtil[_0x77cf('0x3f')](_0x343ea4['remoteUri']);_0x343ea4['serverUrl']=intUtil['stripTrailingSlash'](_0x343ea4[_0x77cf('0x4e')]);if(_0x2592f5&&_0x2592f5[_0x77cf('0x4f')]&&_0x2592f5['recordingFormat']!=='none'){logger[_0x77cf('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x540ed9['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x343ea4['serverUrl'],_0x540ed9[_0x77cf('0x45')],md5(_0x540ed9['uniqueid']));}headers[_0x77cf('0x46')]=getAuth(_0x343ea4);return getUser(_0x343ea4,_0x3c7130[_0x77cf('0x23')])[_0x77cf('0x1d')](function(_0x2d46c2){_0x241e55=_0x2d46c2;logger['info'](_0x77cf('0x47'),_0x241e55['id']);return getEndUser(_0x343ea4,_0x540ed9['destcalleridname'],_0x540ed9['destcalleridnum']);})['then'](function(_0x14e0e5){_0x9031ae=_0x14e0e5;logger[_0x77cf('0xa')](_0x77cf('0x48'),_0x9031ae['id']);return getTicket(_0x343ea4,_0x241e55,_0x9031ae,_0x1a0e16,_0x540ed9);})[_0x77cf('0x1d')](function(_0x519f1f){if(_0x519f1f&&_0x519f1f['id']){logger['info']('Ticket\x20created!');logger[_0x77cf('0xa')](_0x77cf('0x50'),_0x519f1f['id']);logger[_0x77cf('0xa')](_0x77cf('0x51'),_0x77cf('0x52'));emit(util[_0x77cf('0xc')](_0x77cf('0x49'),_0x3c7130[_0x77cf('0x15')]),'trigger:browser:url',{'uri':util[_0x77cf('0xc')](_0x77cf('0x53'),_0x343ea4[_0x77cf('0x1c')],_0x519f1f['id'])});}})['catch'](function(_0x582418){logger[_0x77cf('0x4c')](_0x77cf('0x51'),JSON['stringify'](_0x582418));});};exports[_0x77cf('0x54')]=function(_0x59e0a3,_0x5e2ee3,_0x2ae61d,_0x5be2a0,_0x447f27,_0x36d14a){var _0x5c6f8a,_0x5c21eb;_0x36d14a['remoteUri']=intUtil['stripTrailingSlash'](_0x36d14a[_0x77cf('0x1c')]);_0x36d14a[_0x77cf('0x4e')]=intUtil[_0x77cf('0x3f')](_0x36d14a['serverUrl']);if(_0x447f27&&_0x447f27['monitor_format']){logger[_0x77cf('0xa')]('['+_0x5e2ee3[_0x77cf('0x55')][_0x77cf('0x56')]()+']',_0x77cf('0x42'));_0x5e2ee3[_0x77cf('0x43')]=util[_0x77cf('0xc')](_0x77cf('0x44'),_0x36d14a[_0x77cf('0x4e')],_0x5e2ee3[_0x77cf('0x45')],md5(_0x5e2ee3[_0x77cf('0x45')]));}else{_0x5e2ee3[_0x77cf('0x43')]='';}headers['Authorization']=getAuth(_0x36d14a);return getUser(_0x36d14a,'')[_0x77cf('0x1d')](function(_0x2325d6){_0x5c6f8a=_0x2325d6;logger[_0x77cf('0xa')]('The\x20User\x20ID\x20is:',_0x5c6f8a['id']);return getEndUser(_0x36d14a,_0x5e2ee3['calleridname'],_0x5e2ee3[_0x77cf('0xf')]);})[_0x77cf('0x1d')](function(_0xbd0e28){_0x5c21eb=_0xbd0e28;logger[_0x77cf('0xa')](_0x77cf('0x48'),_0x5c21eb['id']);return getTicket(_0x36d14a,_0x5c6f8a,_0x5c21eb,_0x2ae61d,_0x5e2ee3);})['then'](function(_0xa34627){if(_0xa34627){logger[_0x77cf('0xa')](_0x77cf('0x1e'));logger['info'](_0x77cf('0x50'),_0xa34627['id']);}})['catch'](function(_0x26d813){logger['error']('['+_0x5e2ee3[_0x77cf('0x55')][_0x77cf('0x56')]()+']',JSON[_0x77cf('0x30')](_0x26d813));});}; \ 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 2f0236a..ea72fc6 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 _0xa0e8=['Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','length','find','contacts','work_number','mobile_number','endUserId','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','error','toUpperCase','Getting\x20contacts\x20filter','filters','name','All\x20Contacts'];(function(_0x21fbe9,_0x11a9c2){var _0x311dbd=function(_0x5701b2){while(--_0x5701b2){_0x21fbe9['push'](_0x21fbe9['shift']());}};_0x311dbd(++_0x11a9c2);}(_0xa0e8,0x1e4));var _0x8a0e=function(_0x1cc799,_0x34af01){_0x1cc799=_0x1cc799-0x0;var _0x4b7925=_0xa0e8[_0x1cc799];return _0x4b7925;};'use strict';var _=require(_0x8a0e('0x0'));var rp=require(_0x8a0e('0x1'));var md5=require(_0x8a0e('0x2'));var util=require(_0x8a0e('0x3'));var moment=require(_0x8a0e('0x4'));var Promise=require(_0x8a0e('0x5'));var Redis=require('ioredis');var intUtil=require(_0x8a0e('0x6'));var config=require(_0x8a0e('0x7'));var logger=require('../../../../config/logger')(_0x8a0e('0x8'));config[_0x8a0e('0x9')]=_[_0x8a0e('0xa')](config[_0x8a0e('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x8a0e('0xb'))(new Redis(config['redis']));function getAdminId(_0x43fb76,_0x55ce23,_0x1a7fdb,_0x1716cc){return new Promise(function(_0x53b0d1,_0x5e095e){var _0x5e3fd7=![];var _0x16259d={'method':_0x8a0e('0xc'),'uri':_0x1716cc+_0x8a0e('0xd'),'json':!![]};_0x16259d[_0x8a0e('0xe')]=_0x1a7fdb;logger[_0x8a0e('0xf')](_0x8a0e('0x10'));return rp(_0x16259d)[_0x8a0e('0x11')](function(_0x3dcb66){if(_0x3dcb66){var _0xeac8af=_0x3dcb66['users'];var _0x6613b3=null;for(_0x6613b3=0x0;_0x6613b3<_0xeac8af['length'];_0x6613b3++){if(_0xeac8af[_0x6613b3][_0x8a0e('0x12')]===_0x43fb76[_0x8a0e('0x13')]){_0x43fb76[_0x8a0e('0x14')]=_0xeac8af[_0x6613b3]['id'];_0x5e3fd7=!![];}}if(_0x5e3fd7){logger[_0x8a0e('0xf')](_0x8a0e('0x15'),_0x43fb76[_0x8a0e('0x14')]);_0x53b0d1(_0x43fb76);}else{_0x5e095e({'statusCode':0x194,'message':_0x8a0e('0x16')});}}else{_0x5e095e({'statusCode':0x194,'message':_0x8a0e('0x16')});}})[_0x8a0e('0x17')](function(_0x2f42a4){logger['error']('['+[_0x55ce23['toUpperCase']()]+']',_0x2f42a4[_0x8a0e('0x18')]);_0x5e095e(_0x2f42a4);});});}function getUser(_0x3adcda,_0x2a896c,_0x12d428){return function(_0x2f5f09){return new Promise(function(_0x427ef3,_0x427fa6){var _0x4449c6={'method':_0x8a0e('0xc'),'uri':_0x12d428+_0x8a0e('0xd'),'json':!![]};_0x4449c6[_0x8a0e('0xe')]=_0x2a896c;logger[_0x8a0e('0xf')]('Getting\x20user\x20list');return rp(_0x4449c6)['then'](function(_0x37564a){if(_0x37564a){var _0x1822aa=_0x37564a[_0x8a0e('0x19')];var _0x23afb2=![];var _0x53d70d=null;if(_0x2f5f09[_0x8a0e('0x1a')]!==null){logger['info'](_0x8a0e('0x1b'),_0x2f5f09['agentEmail']);_0x2f5f09[_0x8a0e('0x1c')]=_0x2f5f09[_0x8a0e('0x1a')];for(_0x53d70d=0x0;_0x53d70d<_0x1822aa['length'];_0x53d70d++){if(_0x1822aa[_0x53d70d][_0x8a0e('0x12')]===_0x2f5f09[_0x8a0e('0x1a')]){_0x23afb2=!![];_0x2f5f09[_0x8a0e('0x1d')]=_0x1822aa[_0x53d70d]['id'];logger[_0x8a0e('0xf')](_0x8a0e('0x1e'),_0x2f5f09[_0x8a0e('0x1d')]);}}}if(!_0x23afb2){logger[_0x8a0e('0xf')](_0x8a0e('0x1f'));_0x2f5f09[_0x8a0e('0x1c')]=_0x2f5f09['adminEmail'];_0x2f5f09['userId']=_0x2f5f09[_0x8a0e('0x14')];_0x23afb2=!![];}if(_0x23afb2){_0x427ef3(_0x2f5f09);}else{_0x427fa6({'statusCode':0x194,'message':_0x8a0e('0x16')});}}else{_0x427fa6({'statusCode':0x194,'message':_0x8a0e('0x16')});}})[_0x8a0e('0x17')](function(_0x36c014){logger[_0x8a0e('0x20')]('['+[_0x3adcda[_0x8a0e('0x21')]()]+']',_0x36c014[_0x8a0e('0x18')]);_0x427fa6(_0x36c014);});});};}function getEndUser(_0x47de9b,_0x2d7c4f,_0x5c63fb){return function(_0x5e946d){return new Promise(function(_0x113e02,_0x4bb67b){var _0x130e18=0x0;var _0x4a7a49={'method':_0x8a0e('0xc'),'uri':_0x5c63fb+'/api/contacts/filters','json':!![]};_0x4a7a49[_0x8a0e('0xe')]=_0x2d7c4f;logger[_0x8a0e('0xf')](_0x8a0e('0x22'));return rp(_0x4a7a49)[_0x8a0e('0x11')](function(_0x134a97){_0x134a97[_0x8a0e('0x23')]['forEach'](function(_0x2c59bf){if(_0x2c59bf[_0x8a0e('0x24')]===_0x8a0e('0x25')){_0x130e18=_0x2c59bf['id'];}});})[_0x8a0e('0x11')](function(){logger[_0x8a0e('0xf')](_0x8a0e('0x26'));var _0x5762cf={'method':_0x8a0e('0xc'),'uri':_0x5c63fb+_0x8a0e('0x27')+_0x130e18,'json':!![]};_0x5762cf[_0x8a0e('0xe')]=_0x2d7c4f;return rp(_0x5762cf);})[_0x8a0e('0x11')](function(_0x3c4230){logger[_0x8a0e('0xf')](_0x8a0e('0x28'),_0x5e946d[_0x8a0e('0x29')]);if(_0x3c4230['contacts'][_0x8a0e('0x2a')]>0x0){var _0x2e78de=_[_0x8a0e('0x2b')](_0x3c4230[_0x8a0e('0x2c')],function(_0x120828){if(_0x120828[_0x8a0e('0x2d')]===_0x5e946d['contactNumber']||_0x120828[_0x8a0e('0x2e')]===_0x5e946d['contactNumber']){return _0x120828;}});if(_0x2e78de){_0x5e946d[_0x8a0e('0x2f')]=_0x2e78de['id'];logger['info']('Contact\x20found:',_0x5e946d['endUserId']);_0x113e02(_0x5e946d);}else{return createEndUser(_0x5e946d,_0x47de9b,_0x2d7c4f,_0x5c63fb)[_0x8a0e('0x11')](function(_0x316d0c){logger[_0x8a0e('0xf')](_0x8a0e('0x30'),_0x5e946d['endUserId']);_0x113e02(_0x316d0c);});}}else{return createEndUser(_0x5e946d,_0x47de9b,_0x2d7c4f,_0x5c63fb)[_0x8a0e('0x11')](function(_0x60b30c){logger[_0x8a0e('0xf')]('Contact\x20created:',_0x5e946d[_0x8a0e('0x2f')]);_0x113e02(_0x60b30c);});}})[_0x8a0e('0x17')](function(_0x235ca1){throw new Error(_0x235ca1[_0x8a0e('0x18')]);});});};}function createEndUser(_0x430ffd,_0x345898,_0x4c4e33,_0x2b4a2c){return new Promise(function(_0x1fa796,_0x92eb6){var _0xab2b19=moment();var _0x29039d={'method':'POST','uri':_0x2b4a2c+_0x8a0e('0x31'),'body':{'contact':{'last_name':_0x430ffd[_0x8a0e('0x29')],'work_number':_0x430ffd[_0x8a0e('0x29')],'mobile_number':_0x430ffd['contactNumber'],'owner_id':_0x430ffd[_0x8a0e('0x1d')],'created_at':_0xab2b19[_0x8a0e('0x32')](_0x8a0e('0x33'))}},'json':!![]};_0x29039d[_0x8a0e('0xe')]=_0x4c4e33;logger['info'](_0x8a0e('0x34'));return rp(_0x29039d)['then'](function(_0x59a01e){_0x430ffd['endUserId']=_0x59a01e[_0x8a0e('0x35')]['id'];_0x1fa796(_0x430ffd);})[_0x8a0e('0x17')](function(_0xb010ad){logger['error']('['+[_0x345898[_0x8a0e('0x21')]()]+']',_0xb010ad['message']);_0x92eb6(_0xb010ad[_0x8a0e('0x18')]);});});}function getTicket(_0x57a9f4,_0xd4dfd6,_0x4193cf,_0x58692f,_0x3b711f){return function(_0x474adf){logger[_0x8a0e('0xf')](_0x8a0e('0x36'));return new Promise(function(_0x2a8b82,_0x50157c){var _0x5a2479=moment();var _0x17f7c0={'method':_0x8a0e('0x37'),'uri':_0x4193cf+_0x8a0e('0x38'),'body':{'title':intUtil[_0x8a0e('0x39')](_0x58692f[_0x8a0e('0x3a')],_0x3b711f,'\x20'),'description':intUtil[_0x8a0e('0x39')](_0x58692f['Descriptions'],_0x3b711f,'\x0a'),'owner_id':_0x474adf['userId'],'creater_id':_0x474adf['adminId'],'targetable_id':_0x474adf['endUserId'],'targetable_type':'Contact','created_at':_0x5a2479['format'](_0x8a0e('0x33')),'due_date':_0x5a2479['add'](0x1e,'m')['format'](_0x8a0e('0x33'))},'json':!![]};_0x17f7c0['headers']=_0xd4dfd6;return rp(_0x17f7c0)[_0x8a0e('0x11')](function(_0x6a3843){_0x474adf[_0x8a0e('0x3b')]=_0x6a3843['task']['id'];logger[_0x8a0e('0xf')]('Task\x20created:',_0x474adf[_0x8a0e('0x3b')]);_0x2a8b82(_0x474adf);})[_0x8a0e('0x17')](function(_0x2993ee){logger['error']('['+[_0x57a9f4[_0x8a0e('0x21')]()]+']',_0x2993ee['message']);_0x50157c(_0x2993ee[_0x8a0e('0x18')]);});});};}function emit(_0x4aecf9,_0x2e5d75,_0xe58d3f){var _0x11c2f0={'uri':_0x4aecf9+_0x8a0e('0x3c')+_0xe58d3f};io['to'](util[_0x8a0e('0x32')](_0x8a0e('0x3d'),_0x2e5d75))[_0x8a0e('0x3e')](_0x8a0e('0x3f'),_0x11c2f0);}exports['cs']=function(_0x2a905e,_0x242694,_0x1f4961,_0x2ded3f,_0x32eab3,_0x579bd8,_0x2907c7,_0x5a6365){var _0x21ada1={};var _0x5c1dac={'Authorization':_0x8a0e('0x40')+_0x579bd8[_0x8a0e('0x41')]};_0x579bd8[_0x8a0e('0x42')]=intUtil[_0x8a0e('0x43')](_0x579bd8[_0x8a0e('0x42')]);_0x579bd8[_0x8a0e('0x44')]=intUtil[_0x8a0e('0x43')](_0x579bd8[_0x8a0e('0x44')]);var _0x2b9bbc=_0x579bd8['remoteUri'];_0x21ada1['adminEmail']=_0x579bd8[_0x8a0e('0x45')];_0x21ada1[_0x8a0e('0x29')]=_0x5a6365[_0x8a0e('0x46')]()===_0x8a0e('0x47')?_0x242694['destcalleridnum']:_0x242694[_0x8a0e('0x48')];_0x21ada1[_0x8a0e('0x49')]=_0x5a6365===_0x8a0e('0x4a')||_0x5a6365===_0x8a0e('0x4b')?_0x8a0e('0x4a'):_0x8a0e('0x47');if(_0x2ded3f){_0x21ada1['agentEmail']=_0x2ded3f[_0x8a0e('0x12')];}var _0x2db08d=util[_0x8a0e('0x32')](_0x8a0e('0x4c'),_0x579bd8[_0x8a0e('0x44')],_0x242694[_0x8a0e('0x4d')],md5(_0x242694[_0x8a0e('0x4d')]));if(_0x32eab3&&_0x32eab3[_0x8a0e('0x4e')]){logger[_0x8a0e('0xf')]('[QUEUE]',_0x8a0e('0x4f'));_0x242694[_0x8a0e('0x50')]=_0x2db08d;}else if(_0x2907c7&&_0x2907c7[_0x8a0e('0x51')]&&_0x2907c7[_0x8a0e('0x51')]!==_0x8a0e('0x52')){logger[_0x8a0e('0xf')]('[OUTBOUND]',_0x8a0e('0x4f'));_0x242694[_0x8a0e('0x50')]=_0x2db08d;}else{_0x242694[_0x8a0e('0x50')]='';}return getAdminId(_0x21ada1,_0x5a6365,_0x5c1dac,_0x2b9bbc)['then'](getUser(_0x5a6365,_0x5c1dac,_0x2b9bbc))['then'](getEndUser(_0x5a6365,_0x5c1dac,_0x2b9bbc))['then'](getTicket(_0x5a6365,_0x5c1dac,_0x2b9bbc,_0x1f4961,_0x242694))[_0x8a0e('0x11')](function(_0x43a7bc){logger[_0x8a0e('0xf')](util['format'](_0x8a0e('0x53'),_0x43a7bc[_0x8a0e('0x3b')]));if(_0x5a6365!==_0x8a0e('0x4b')){logger[_0x8a0e('0xf')]('['+[_0x5a6365[_0x8a0e('0x21')]()]+']',_0x8a0e('0x54'));emit(_0x2b9bbc,_0x2ded3f[_0x8a0e('0x24')],_0x43a7bc[_0x8a0e('0x2f')]);}})[_0x8a0e('0x17')](function(_0x58b66e){logger[_0x8a0e('0x20')]('['+[_0x5a6365[_0x8a0e('0x21')]()]+_0x8a0e('0x55'),util[_0x8a0e('0x56')](_0x58b66e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb3a9=['info','Getting\x20admin\x20information','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','userId','User\x20found:','userEmail','adminEmail','error','/api/contacts/filters','then','filters','forEach','name','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','mobile_number','contactNumber','Contact\x20found:','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','ticketId','task','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','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','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers'];(function(_0x312b38,_0x4ef56f){var _0x27a9ea=function(_0x318927){while(--_0x318927){_0x312b38['push'](_0x312b38['shift']());}};_0x27a9ea(++_0x4ef56f);}(_0xb3a9,0xa2));var _0x9b3a=function(_0x216175,_0x2e272d){_0x216175=_0x216175-0x0;var _0x21230a=_0xb3a9[_0x216175];return _0x21230a;};'use strict';var _=require(_0x9b3a('0x0'));var rp=require(_0x9b3a('0x1'));var md5=require(_0x9b3a('0x2'));var util=require(_0x9b3a('0x3'));var moment=require(_0x9b3a('0x4'));var Promise=require(_0x9b3a('0x5'));var Redis=require('ioredis');var intUtil=require(_0x9b3a('0x6'));var config=require(_0x9b3a('0x7'));var logger=require('../../../../config/logger')(_0x9b3a('0x8'));config[_0x9b3a('0x9')]=_[_0x9b3a('0xa')](config[_0x9b3a('0x9')],{'host':_0x9b3a('0xb'),'port':0x18eb});var io=require(_0x9b3a('0xc'))(new Redis(config[_0x9b3a('0x9')]));function getAdminId(_0x5d34b1,_0xd7cb7c,_0x5a9e15,_0x16a998){return new Promise(function(_0x27a73f,_0x4c2244){var _0x3cb1df=![];var _0x365b4c={'method':_0x9b3a('0xd'),'uri':_0x16a998+_0x9b3a('0xe'),'json':!![]};_0x365b4c[_0x9b3a('0xf')]=_0x5a9e15;logger[_0x9b3a('0x10')](_0x9b3a('0x11'));return rp(_0x365b4c)['then'](function(_0x53c6f7){if(_0x53c6f7){var _0x20404=_0x53c6f7[_0x9b3a('0x12')];var _0x34274c=null;for(_0x34274c=0x0;_0x34274c<_0x20404[_0x9b3a('0x13')];_0x34274c++){if(_0x20404[_0x34274c][_0x9b3a('0x14')]===_0x5d34b1['adminEmail']){_0x5d34b1[_0x9b3a('0x15')]=_0x20404[_0x34274c]['id'];_0x3cb1df=!![];}}if(_0x3cb1df){logger[_0x9b3a('0x10')](_0x9b3a('0x16'),_0x5d34b1[_0x9b3a('0x15')]);_0x27a73f(_0x5d34b1);}else{_0x4c2244({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4c2244({'statusCode':0x194,'message':_0x9b3a('0x17')});}})[_0x9b3a('0x18')](function(_0x46161c){logger['error']('['+[_0xd7cb7c[_0x9b3a('0x19')]()]+']',_0x46161c[_0x9b3a('0x1a')]);_0x4c2244(_0x46161c);});});}function getUser(_0x45b990,_0x1c8a05,_0x14f7c6){return function(_0xf406e9){return new Promise(function(_0x3cedbd,_0x2950a2){var _0x75a380={'method':_0x9b3a('0xd'),'uri':_0x14f7c6+'/api/selector/owners','json':!![]};_0x75a380[_0x9b3a('0xf')]=_0x1c8a05;logger[_0x9b3a('0x10')](_0x9b3a('0x1b'));return rp(_0x75a380)['then'](function(_0x68f6){if(_0x68f6){var _0xafcf6f=_0x68f6[_0x9b3a('0x12')];var _0x436ad0=![];var _0x26d4e0=null;if(_0xf406e9[_0x9b3a('0x1c')]!==null){logger[_0x9b3a('0x10')]('Getting\x20user\x20with\x20email',_0xf406e9[_0x9b3a('0x1c')]);_0xf406e9['userEmail']=_0xf406e9['agentEmail'];for(_0x26d4e0=0x0;_0x26d4e0<_0xafcf6f[_0x9b3a('0x13')];_0x26d4e0++){if(_0xafcf6f[_0x26d4e0][_0x9b3a('0x14')]===_0xf406e9['agentEmail']){_0x436ad0=!![];_0xf406e9[_0x9b3a('0x1d')]=_0xafcf6f[_0x26d4e0]['id'];logger['info'](_0x9b3a('0x1e'),_0xf406e9[_0x9b3a('0x1d')]);}}}if(!_0x436ad0){logger[_0x9b3a('0x10')]('Admin\x20selected');_0xf406e9[_0x9b3a('0x1f')]=_0xf406e9[_0x9b3a('0x20')];_0xf406e9[_0x9b3a('0x1d')]=_0xf406e9[_0x9b3a('0x15')];_0x436ad0=!![];}if(_0x436ad0){_0x3cedbd(_0xf406e9);}else{_0x2950a2({'statusCode':0x194,'message':_0x9b3a('0x17')});}}else{_0x2950a2({'statusCode':0x194,'message':_0x9b3a('0x17')});}})[_0x9b3a('0x18')](function(_0x182372){logger[_0x9b3a('0x21')]('['+[_0x45b990[_0x9b3a('0x19')]()]+']',_0x182372[_0x9b3a('0x1a')]);_0x2950a2(_0x182372);});});};}function getEndUser(_0x5591ad,_0x47d2bf,_0x244b76){return function(_0x4426d1){return new Promise(function(_0x59bf1b,_0x587a1a){var _0x12d3a4=0x0;var _0x4a8b79={'method':_0x9b3a('0xd'),'uri':_0x244b76+_0x9b3a('0x22'),'json':!![]};_0x4a8b79['headers']=_0x47d2bf;logger[_0x9b3a('0x10')]('Getting\x20contacts\x20filter');return rp(_0x4a8b79)[_0x9b3a('0x23')](function(_0x3a3fff){_0x3a3fff[_0x9b3a('0x24')][_0x9b3a('0x25')](function(_0xa81837){if(_0xa81837[_0x9b3a('0x26')]==='All\x20Contacts'){_0x12d3a4=_0xa81837['id'];}});})['then'](function(){logger[_0x9b3a('0x10')](_0x9b3a('0x27'));var _0x3259bd={'method':_0x9b3a('0xd'),'uri':_0x244b76+_0x9b3a('0x28')+_0x12d3a4,'json':!![]};_0x3259bd[_0x9b3a('0xf')]=_0x47d2bf;return rp(_0x3259bd);})['then'](function(_0x5bb09f){logger['info'](_0x9b3a('0x29'),_0x4426d1['contactNumber']);if(_0x5bb09f[_0x9b3a('0x2a')][_0x9b3a('0x13')]>0x0){var _0xb98c85=_[_0x9b3a('0x2b')](_0x5bb09f['contacts'],function(_0x2b502f){if(_0x2b502f[_0x9b3a('0x2c')]===_0x4426d1['contactNumber']||_0x2b502f[_0x9b3a('0x2d')]===_0x4426d1[_0x9b3a('0x2e')]){return _0x2b502f;}});if(_0xb98c85){_0x4426d1['endUserId']=_0xb98c85['id'];logger[_0x9b3a('0x10')](_0x9b3a('0x2f'),_0x4426d1[_0x9b3a('0x30')]);_0x59bf1b(_0x4426d1);}else{return createEndUser(_0x4426d1,_0x5591ad,_0x47d2bf,_0x244b76)[_0x9b3a('0x23')](function(_0x6a8720){logger[_0x9b3a('0x10')](_0x9b3a('0x31'),_0x4426d1[_0x9b3a('0x30')]);_0x59bf1b(_0x6a8720);});}}else{return createEndUser(_0x4426d1,_0x5591ad,_0x47d2bf,_0x244b76)['then'](function(_0x43538a){logger['info'](_0x9b3a('0x31'),_0x4426d1[_0x9b3a('0x30')]);_0x59bf1b(_0x43538a);});}})[_0x9b3a('0x18')](function(_0x43dc68){throw new Error(_0x43dc68[_0x9b3a('0x1a')]);});});};}function createEndUser(_0x20036c,_0x2c9b0e,_0x2f9bfa,_0x4f3ad5){return new Promise(function(_0x4da110,_0x31465a){var _0x235421=moment();var _0x52ce65={'method':_0x9b3a('0x32'),'uri':_0x4f3ad5+_0x9b3a('0x33'),'body':{'contact':{'last_name':_0x20036c['contactNumber'],'work_number':_0x20036c[_0x9b3a('0x2e')],'mobile_number':_0x20036c[_0x9b3a('0x2e')],'owner_id':_0x20036c['userId'],'created_at':_0x235421[_0x9b3a('0x34')](_0x9b3a('0x35'))}},'json':!![]};_0x52ce65[_0x9b3a('0xf')]=_0x2f9bfa;logger[_0x9b3a('0x10')](_0x9b3a('0x36'));return rp(_0x52ce65)[_0x9b3a('0x23')](function(_0x4f5b36){_0x20036c[_0x9b3a('0x30')]=_0x4f5b36['contact']['id'];_0x4da110(_0x20036c);})[_0x9b3a('0x18')](function(_0x5ea016){logger[_0x9b3a('0x21')]('['+[_0x2c9b0e[_0x9b3a('0x19')]()]+']',_0x5ea016['message']);_0x31465a(_0x5ea016['message']);});});}function getTicket(_0x1becc7,_0x1f4584,_0x3133ee,_0xe6ba9b,_0x16e3f8){return function(_0x5914d4){logger[_0x9b3a('0x10')](_0x9b3a('0x37'));return new Promise(function(_0x2e73a4,_0x3b1751){var _0x57cf89=moment();var _0x58a003={'method':_0x9b3a('0x32'),'uri':_0x3133ee+_0x9b3a('0x38'),'body':{'title':intUtil[_0x9b3a('0x39')](_0xe6ba9b[_0x9b3a('0x3a')],_0x16e3f8,'\x20'),'description':intUtil[_0x9b3a('0x39')](_0xe6ba9b[_0x9b3a('0x3b')],_0x16e3f8,'\x0a'),'owner_id':_0x5914d4['userId'],'creater_id':_0x5914d4[_0x9b3a('0x15')],'targetable_id':_0x5914d4[_0x9b3a('0x30')],'targetable_type':_0x9b3a('0x3c'),'created_at':_0x57cf89[_0x9b3a('0x34')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x57cf89['add'](0x1e,'m')[_0x9b3a('0x34')](_0x9b3a('0x35'))},'json':!![]};_0x58a003[_0x9b3a('0xf')]=_0x1f4584;return rp(_0x58a003)[_0x9b3a('0x23')](function(_0x4950d0){_0x5914d4[_0x9b3a('0x3d')]=_0x4950d0[_0x9b3a('0x3e')]['id'];logger[_0x9b3a('0x10')]('Task\x20created:',_0x5914d4[_0x9b3a('0x3d')]);_0x2e73a4(_0x5914d4);})[_0x9b3a('0x18')](function(_0x484791){logger[_0x9b3a('0x21')]('['+[_0x1becc7[_0x9b3a('0x19')]()]+']',_0x484791[_0x9b3a('0x1a')]);_0x3b1751(_0x484791[_0x9b3a('0x1a')]);});});};}function emit(_0x500594,_0x210c7d,_0x5c9110){var _0x46cf88={'uri':_0x500594+'/contacts/'+_0x5c9110};io['to'](util[_0x9b3a('0x34')]('user:%s',_0x210c7d))[_0x9b3a('0x3f')](_0x9b3a('0x40'),_0x46cf88);}exports['cs']=function(_0x228b3f,_0x3c6319,_0x40ee6b,_0x302a37,_0x1a955f,_0x33e69f,_0x363a34,_0x14b8a9){var _0x3ebcf0={};var _0x14ecc1={'Authorization':_0x9b3a('0x41')+_0x33e69f['apiKey']};_0x33e69f[_0x9b3a('0x42')]=intUtil[_0x9b3a('0x43')](_0x33e69f[_0x9b3a('0x42')]);_0x33e69f[_0x9b3a('0x44')]=intUtil[_0x9b3a('0x43')](_0x33e69f[_0x9b3a('0x44')]);var _0x2da6f7=_0x33e69f['remoteUri'];_0x3ebcf0[_0x9b3a('0x20')]=_0x33e69f['username'];_0x3ebcf0[_0x9b3a('0x2e')]=_0x14b8a9[_0x9b3a('0x45')]()===_0x9b3a('0x46')?_0x3c6319[_0x9b3a('0x47')]:_0x3c6319[_0x9b3a('0x48')];_0x3ebcf0[_0x9b3a('0x49')]=_0x14b8a9==='queue'||_0x14b8a9===_0x9b3a('0x4a')?_0x9b3a('0x4b'):_0x9b3a('0x46');if(_0x302a37){_0x3ebcf0[_0x9b3a('0x1c')]=_0x302a37[_0x9b3a('0x14')];}var _0x40d7e4=util[_0x9b3a('0x34')](_0x9b3a('0x4c'),_0x33e69f[_0x9b3a('0x44')],_0x3c6319[_0x9b3a('0x4d')],md5(_0x3c6319[_0x9b3a('0x4d')]));if(_0x1a955f&&_0x1a955f[_0x9b3a('0x4e')]){logger[_0x9b3a('0x10')](_0x9b3a('0x4f'),_0x9b3a('0x50'));_0x3c6319[_0x9b3a('0x51')]=_0x40d7e4;}else if(_0x363a34&&_0x363a34[_0x9b3a('0x52')]&&_0x363a34[_0x9b3a('0x52')]!==_0x9b3a('0x53')){logger[_0x9b3a('0x10')](_0x9b3a('0x54'),_0x9b3a('0x50'));_0x3c6319[_0x9b3a('0x51')]=_0x40d7e4;}else{_0x3c6319['recordingURL']='';}return getAdminId(_0x3ebcf0,_0x14b8a9,_0x14ecc1,_0x2da6f7)[_0x9b3a('0x23')](getUser(_0x14b8a9,_0x14ecc1,_0x2da6f7))[_0x9b3a('0x23')](getEndUser(_0x14b8a9,_0x14ecc1,_0x2da6f7))[_0x9b3a('0x23')](getTicket(_0x14b8a9,_0x14ecc1,_0x2da6f7,_0x40ee6b,_0x3c6319))[_0x9b3a('0x23')](function(_0x4f4b32){logger[_0x9b3a('0x10')](util[_0x9b3a('0x34')](_0x9b3a('0x55'),_0x4f4b32[_0x9b3a('0x3d')]));if(_0x14b8a9!=='unmanaged'){logger[_0x9b3a('0x10')]('['+[_0x14b8a9[_0x9b3a('0x19')]()]+']',_0x9b3a('0x56'));emit(_0x2da6f7,_0x302a37[_0x9b3a('0x26')],_0x4f4b32['endUserId']);}})[_0x9b3a('0x18')](function(_0x2689ec){logger[_0x9b3a('0x21')]('['+[_0x14b8a9[_0x9b3a('0x19')]()]+_0x9b3a('0x57'),util[_0x9b3a('0x58')](_0x2689ec,{'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 9d3afe8..8e5bf77 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 _0xe605=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','freshdesk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho'];(function(_0x3b5dc3,_0x4c6395){var _0x42357d=function(_0x44c2aa){while(--_0x44c2aa){_0x3b5dc3['push'](_0x3b5dc3['shift']());}};_0x42357d(++_0x4c6395);}(_0xe605,0x92));var _0x5e60=function(_0x2544f8,_0x571c4e){_0x2544f8=_0x2544f8-0x0;var _0x216bf8=_0xe605[_0x2544f8];return _0x216bf8;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x5e60('0x2'));var sugarcrm=require(_0x5e60('0x3'));var freshdesk=require(_0x5e60('0x4'));var zoho=require(_0x5e60('0x5'));var desk=require(_0x5e60('0x6'));var vtiger=require(_0x5e60('0x7'));var servicenow=require(_0x5e60('0x8'));var dynamics365=require(_0x5e60('0x9'));var freshsales=require(_0x5e60('0xa'));var integrations=[_0x5e60('0xb'),_0x5e60('0xc'),_0x5e60('0xd'),'freshdesk',_0x5e60('0xe'),'desk','vtiger','dynamics365',_0x5e60('0xf'),_0x5e60('0x10')];exports[_0x5e60('0x11')]=function(_0x2c5425,_0x331b3e,_0x2cbe4e,_0x56f05a,_0x6ab0ce,_0x527f7b){if(_0x2cbe4e){if(_[_0x5e60('0x12')](integrations,_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]())){try{var _0x51e7f6=null;var _0x371df7='';var _0x178782=_0x2cbe4e[_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]()];if(_0x178782){var _0x2874c4=_0x178782[_0x2c5425[_0x5e60('0x15')]];if(_0x2874c4){var _0x4fd10e=_[_0x5e60('0x16')](_0x2874c4[_0x5e60('0x17')],{'id':parseInt(_0x2c5425[_0x5e60('0x18')],0xa)});if(_0x4fd10e){if(_0x56f05a){if(_0x6ab0ce&&_0x331b3e[_0x5e60('0x19')]){_0x371df7='queue';}else if(_0x331b3e[_0x5e60('0x1a')]){_0x371df7='outbound';}else{console[_0x5e60('0x1b')](_0x5e60('0x1c'),_0x331b3e);}}else{_0x371df7='unmanaged';}switch(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]()){case _0x5e60('0xb'):zendesk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xc'):salesforce[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case'sugarcrm':sugarcrm[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0x1d'):freshdesk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xe'):zoho[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case'desk':desk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0x1e'):vtiger[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xf'):freshsales['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;case _0x5e60('0x10'):servicenow['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;case _0x5e60('0x1f'):dynamics365['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;default:console[_0x5e60('0x1b')](_0x5e60('0x20'));}}else{_0x51e7f6=require(_0x5e60('0x21'))(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]());_0x51e7f6[_0x5e60('0x22')](_0x5e60('0x23'),util['format'](_0x5e60('0x24'),_0x2c5425['data1'][_0x5e60('0x14')](),_0x2c5425[_0x5e60('0x18')]));}}else{_0x51e7f6=require(_0x5e60('0x21'))(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]());_0x51e7f6[_0x5e60('0x22')](_0x5e60('0x23'),util['format'](_0x5e60('0x25'),_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')](),_0x2c5425['data2']));}}else{}}catch(_0x45cb62){console[_0x5e60('0x22')](_0x45cb62);}}}}; \ No newline at end of file +var _0x8e3f=['%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','unmanaged','freshdesk','log','unknown\x20integration','../../../../config/logger','error','format'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var zendesk=require(_0xf8e3('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xf8e3('0x3'));var freshdesk=require(_0xf8e3('0x4'));var zoho=require(_0xf8e3('0x5'));var desk=require('./desk');var vtiger=require(_0xf8e3('0x6'));var servicenow=require(_0xf8e3('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf8e3('0x8'));var integrations=[_0xf8e3('0x9'),_0xf8e3('0xa'),_0xf8e3('0xb'),'freshdesk',_0xf8e3('0xc'),_0xf8e3('0xd'),_0xf8e3('0xe'),_0xf8e3('0xf'),_0xf8e3('0x10'),_0xf8e3('0x11')];exports[_0xf8e3('0x12')]=function(_0x2a3b59,_0x2d914d,_0x2bc3cd,_0x28f5f0,_0xe584cd,_0x5e4b87){if(_0x2bc3cd){if(_[_0xf8e3('0x13')](integrations,_0x2a3b59[_0xf8e3('0x14')][_0xf8e3('0x15')]())){try{var _0x4888eb=null;var _0x40ae02='';var _0x41f85e=_0x2bc3cd[_0x2a3b59[_0xf8e3('0x14')][_0xf8e3('0x15')]()];if(_0x41f85e){var _0x565c04=_0x41f85e[_0x2a3b59[_0xf8e3('0x16')]];if(_0x565c04){var _0xa856f5=_[_0xf8e3('0x17')](_0x565c04['Configurations'],{'id':parseInt(_0x2a3b59[_0xf8e3('0x18')],0xa)});if(_0xa856f5){if(_0x28f5f0){if(_0xe584cd&&_0x2d914d['queue']){_0x40ae02=_0xf8e3('0x19');}else if(_0x2d914d[_0xf8e3('0x1a')]){_0x40ae02=_0xf8e3('0x1b');}else{console['log']('EVENT\x20UNKNOWN',_0x2d914d);}}else{_0x40ae02=_0xf8e3('0x1c');}switch(_0x2a3b59[_0xf8e3('0x14')][_0xf8e3('0x15')]()){case _0xf8e3('0x9'):zendesk[_0x40ae02](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87);break;case _0xf8e3('0xa'):salesforce[_0x40ae02](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87);break;case _0xf8e3('0xb'):sugarcrm[_0x40ae02](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87);break;case _0xf8e3('0x1d'):freshdesk[_0x40ae02](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87);break;case _0xf8e3('0xc'):zoho[_0x40ae02](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87);break;case _0xf8e3('0xd'):desk[_0x40ae02](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87);break;case _0xf8e3('0xe'):vtiger[_0x40ae02](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87);break;case'freshsales':freshsales['cs'](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87,_0x40ae02);break;case _0xf8e3('0x11'):servicenow['cs'](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87,_0x40ae02);break;case _0xf8e3('0xf'):dynamics365['cs'](_0x2a3b59,_0x2d914d,_0xa856f5,_0x28f5f0,_0xe584cd,_0x565c04,_0x5e4b87,_0x40ae02);break;default:console[_0xf8e3('0x1e')](_0xf8e3('0x1f'));}}else{_0x4888eb=require(_0xf8e3('0x20'))(_0x2a3b59[_0xf8e3('0x14')][_0xf8e3('0x15')]());_0x4888eb[_0xf8e3('0x21')]('[EXEC]',util[_0xf8e3('0x22')](_0xf8e3('0x23'),_0x2a3b59[_0xf8e3('0x14')][_0xf8e3('0x15')](),_0x2a3b59['data3']));}}else{_0x4888eb=require(_0xf8e3('0x20'))(_0x2a3b59['data1'][_0xf8e3('0x15')]());_0x4888eb[_0xf8e3('0x21')](_0xf8e3('0x24'),util[_0xf8e3('0x22')](_0xf8e3('0x25'),_0x2a3b59[_0xf8e3('0x14')]['toLowerCase'](),_0x2a3b59[_0xf8e3('0x16')]));}}else{}}catch(_0x2fc674){console[_0xf8e3('0x21')](_0x2fc674);}}}}; \ 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 4e49855..f05786e 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 _0x2b73=['trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]','stringify','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','ticketType','utc','getString','Descriptions','WhoId','Case','assign','Subjects','ContactId','isNil','validateEmail','sobject','User','find','execute','then','length','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','lead','Lead','contact','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','create','type','string','idField','content','variable','variableName','customVariable','Variable','toLowerCase','name','toString','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','integrationTab','user:%s','trigger:salesforce:display','newTab'];(function(_0x3f0122,_0x1627ca){var _0x2039d7=function(_0x5631dd){while(--_0x5631dd){_0x3f0122['push'](_0x3f0122['shift']());}};_0x2039d7(++_0x1627ca);}(_0x2b73,0x158));var _0x32b7=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x2b73[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x32b7('0x0'));var rp=require(_0x32b7('0x1'));var moment=require(_0x32b7('0x2'));var BPromise=require(_0x32b7('0x3'));var md5=require(_0x32b7('0x4'));var jsforce=require(_0x32b7('0x5'));var util=require(_0x32b7('0x6'));var Redis=require(_0x32b7('0x7'));var intUtil=require(_0x32b7('0x8'));var config=require(_0x32b7('0x9'));var logger=require('../../../../config/logger')(_0x32b7('0xa'));config[_0x32b7('0xb')]=_[_0x32b7('0xc')](config[_0x32b7('0xb')],{'host':_0x32b7('0xd'),'port':0x18eb});var io=require(_0x32b7('0xe'))(new Redis(config['redis']));function emit(_0x3b2405,_0x5302b2,_0x9f7f31){io['to'](_0x3b2405)['emit'](_0x5302b2,_0x9f7f31);}function getTicket(_0x5986e0,_0x3251fd,_0x32188b,_0x406b09,_0x199c74,_0x1689f3,_0x52d508,_0x199cc1){var _0x5e822b={};if(_0x406b09[_0x32b7('0xf')]==='Task'){_0x5e822b=Object['assign']({},{'OwnerId':_0x3251fd['id'],'ActivityDate':moment[_0x32b7('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x32b7('0x11')](_0x406b09['Subjects'],_0x199c74,'\x20'),'Description':intUtil[_0x32b7('0x11')](_0x406b09[_0x32b7('0x12')],_0x199c74,'\x0a')},getCustomFields(_0x1689f3,_0x199c74));if(_0x32188b){_0x5e822b[_0x32b7('0x13')]=_0x32188b['id'];}}else if(_0x406b09['ticketType']===_0x32b7('0x14')){_0x5e822b=Object[_0x32b7('0x15')]({},{'OwnerId':_0x3251fd['id'],'Subject':intUtil[_0x32b7('0x11')](_0x406b09[_0x32b7('0x16')],_0x199c74,'\x20'),'Description':intUtil[_0x32b7('0x11')](_0x406b09['Descriptions'],_0x199c74,'\x0a')},getCustomFields(_0x1689f3,_0x199c74));if(_0x32188b){_0x5e822b[_0x32b7('0x17')]=_0x32188b['id'];}}return _0x52d508['sobject'](_0x406b09[_0x32b7('0xf')])['create'](_0x5e822b);}function getUser(_0x57ddca,_0x345947,_0x2bf429){if(!_[_0x32b7('0x18')](_0x345947)&&intUtil[_0x32b7('0x19')](_0x345947)){var _0x20efa2={'Email':_0x345947};var _0x10433d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2bf429[_0x32b7('0x1a')](_0x32b7('0x1b'))[_0x32b7('0x1c')](_0x20efa2,_0x10433d)[_0x32b7('0x1d')]()[_0x32b7('0x1e')](function(_0xadf98d){if(_0xadf98d[_0x32b7('0x1f')]){var _0xb6ab9c=_[_0x32b7('0x1c')](_0xadf98d,function(_0x772add){return _0x772add['Email']===_0x345947;});if(_0xb6ab9c){logger[_0x32b7('0x20')](_0x32b7('0x21'),_0x345947);return BPromise[_0x32b7('0x22')]({'id':_0xb6ab9c['Id'],'name':_0xb6ab9c[_0x32b7('0x23')]});}}else{logger[_0x32b7('0x20')](_0x32b7('0x24'),_0x345947);return _0x2bf429['identity']()[_0x32b7('0x1e')](function(_0x1e243f){return BPromise[_0x32b7('0x22')]({'id':_0x1e243f[_0x32b7('0x25')],'name':_0x1e243f['display_name']});});}});}else{logger[_0x32b7('0x20')](_0x32b7('0x24'),_0x345947);return _0x2bf429['identity']()[_0x32b7('0x1e')](function(_0x16c44f){return BPromise['resolve']({'id':_0x16c44f[_0x32b7('0x25')],'name':_0x16c44f['display_name']});});}}function getEndUser(_0xe195a3,_0x239f13,_0x5337e6,_0x3e6faf,_0x2eba40){var _0x22d305={'Phone':_0x3e6faf};var _0x343fd2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x32b7('0x22')]()[_0x32b7('0x1e')](function(){if(_0x239f13[_0x32b7('0xf')]===_0x32b7('0x26')){logger[_0x32b7('0x20')](_0x32b7('0x27'),_0x3e6faf,_0x239f13[_0x32b7('0x28')]);switch(_0x239f13[_0x32b7('0x28')]){case _0x32b7('0x29'):return _0x2eba40['sobject'](_0x32b7('0x2a'))[_0x32b7('0x1c')](_0x22d305,_0x343fd2)[_0x32b7('0x1d')]()[_0x32b7('0x1e')](function(_0x5467c3){if(_0x5467c3&&_0x5467c3[_0x32b7('0x1f')]){return _0x5467c3;}else{return _0x2eba40[_0x32b7('0x1a')]('Lead')[_0x32b7('0x1c')](_0x22d305,_0x343fd2);}});case'contact':return _0x2eba40[_0x32b7('0x1a')](_0x32b7('0x2a'))[_0x32b7('0x1c')](_0x22d305,_0x343fd2)[_0x32b7('0x1d')]();case _0x32b7('0x2b'):return _0x2eba40[_0x32b7('0x1a')](_0x32b7('0x2c'))[_0x32b7('0x1c')](_0x22d305,_0x343fd2);default:return null;}}else if(_0x239f13['ticketType']===_0x32b7('0x14')){logger[_0x32b7('0x20')](_0x32b7('0x27'),_0x3e6faf,_0x32b7('0x2d'));return _0x2eba40[_0x32b7('0x1a')](_0x32b7('0x2a'))[_0x32b7('0x1c')](_0x22d305,_0x343fd2)[_0x32b7('0x1d')]();}})[_0x32b7('0x1e')](function(_0xece6de){if(_0xece6de&&_0xece6de[_0x32b7('0x1f')]){var _0x395ea0=_[_0x32b7('0x1c')](_0xece6de,function(_0x57f268){return _0x57f268['Phone']===_0x3e6faf;});if(_0x395ea0){return BPromise[_0x32b7('0x22')]({'id':_0x395ea0['Id'],'name':_0x395ea0[_0x32b7('0x23')],'phone':_0x395ea0['Phone']});}}})[_0x32b7('0x1e')](function(_0x4167e5){if(_0x4167e5){logger[_0x32b7('0x20')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x3e6faf);return BPromise[_0x32b7('0x22')](_0x4167e5);}else{logger[_0x32b7('0x20')](_0x32b7('0x2e'),_0x3e6faf);var _0x4e5878={'LastName':_0x5337e6!==_0x32b7('0x2f')?_0x5337e6:util[_0x32b7('0x30')](_0x32b7('0x31'),_0x3e6faf),'Phone':_0x3e6faf};if(_0x239f13[_0x32b7('0x32')]){if(_0x239f13[_0x32b7('0x32')]===_0x32b7('0x2d')){logger[_0x32b7('0x20')](_0x32b7('0x33'),_0x3e6faf,_0x239f13['moduleCreate']);}else if(_0x239f13['moduleCreate']==='lead'&&_0x239f13[_0x32b7('0xf')]===_0x32b7('0x26')){logger[_0x32b7('0x20')](_0x32b7('0x33'),_0x3e6faf,_0x239f13[_0x32b7('0x32')]);_0x4e5878[_0x32b7('0x34')]=_0x32b7('0x35');}else{return null;}}return _0x2eba40[_0x32b7('0x1a')](_[_0x32b7('0x36')](_0x239f13[_0x32b7('0x32')]))[_0x32b7('0x37')](_0x4e5878);}});}function getCustomFields(_0x4a2958,_0x34483c){var _0x6c695b={};if(_0x4a2958['length']>0x0){_['forEach'](_0x4a2958,function(_0x545435){if(_0x545435[_0x32b7('0x38')]===_0x32b7('0x39')&&_0x545435[_0x32b7('0x3a')]){_0x6c695b[_0x545435[_0x32b7('0x3a')]]=_0x545435[_0x32b7('0x3b')]['toString']();}else if(_0x545435['type']===_0x32b7('0x3c')&&_0x545435['variableName']&&_0x545435[_0x32b7('0x3a')]){_0x34483c[_0x545435[_0x32b7('0x3d')]]&&(_0x6c695b[_0x545435[_0x32b7('0x3a')]]=_0x34483c[_0x545435[_0x32b7('0x3d')]]['toString']());}else if(_0x545435[_0x32b7('0x38')]===_0x32b7('0x3e')&&_0x545435['Variable']&&_0x545435[_0x32b7('0x3f')]['name']&&_0x545435[_0x32b7('0x3a')]){_0x34483c[_0x545435['Variable']['name'][_0x32b7('0x40')]()]&&(_0x6c695b[_0x545435[_0x32b7('0x3a')]]=_0x34483c[_0x545435[_0x32b7('0x3f')][_0x32b7('0x41')]['toLowerCase']()][_0x32b7('0x42')]());}});}return _0x6c695b;}function getConnection(_0xe3cc4b){var _0x2789bd=_0xe3cc4b['password'][_0x32b7('0x43')](_0xe3cc4b[_0x32b7('0x44')]);var _0x338019=new jsforce[(_0x32b7('0x45'))]({'oauth2':{'loginUrl':_0xe3cc4b[_0x32b7('0x46')]||_0x32b7('0x47'),'clientId':_0xe3cc4b[_0x32b7('0x48')],'clientSecret':_0xe3cc4b[_0x32b7('0x49')]}});return _0x338019[_0x32b7('0x4a')](_0xe3cc4b[_0x32b7('0x4b')],_0x2789bd)[_0x32b7('0x1e')](function(){logger['info'](_0x32b7('0x4c'));return _0x338019;});}exports['queue']=function(_0x5ce275,_0x1570fa,_0x2ecdac,_0x2cb472,_0x4beb58,_0x14f861){var _0x2214fd,_0x2715cd,_0x340e59,_0x59783b;_0x14f861['serverUrl']=intUtil[_0x32b7('0x4d')](_0x14f861[_0x32b7('0x4e')]);_0x14f861[_0x32b7('0x46')]=intUtil['stripTrailingSlash'](_0x14f861['remoteUri']);if(_0x4beb58&&_0x4beb58[_0x32b7('0x4f')]){logger[_0x32b7('0x20')](_0x32b7('0x50'),_0x32b7('0x51'));_0x1570fa[_0x32b7('0x52')]=util[_0x32b7('0x30')](_0x32b7('0x53'),_0x14f861[_0x32b7('0x4e')],_0x1570fa[_0x32b7('0x54')],md5(_0x1570fa[_0x32b7('0x54')]));}else{_0x1570fa['recordingURL']='';}return getConnection(_0x14f861)['then'](function(_0x892ade){_0x59783b=_0x892ade;return getUser(_0x14f861,_0x2cb472[_0x32b7('0x55')],_0x59783b);})[_0x32b7('0x1e')](function(_0x1e90ab){_0x2214fd=_0x1e90ab;return getEndUser(_0x14f861,_0x2ecdac,_0x1570fa[_0x32b7('0x56')],_0x1570fa[_0x32b7('0x57')],_0x59783b);})[_0x32b7('0x1e')](function(_0x489c5c){_0x2715cd=_0x489c5c;return getTicket(_0x14f861,_0x2214fd,_0x2715cd,_0x2ecdac,_0x1570fa,_0x2ecdac['Fields'],_0x59783b,'queue');})[_0x32b7('0x1e')](function(_0x468855){_0x340e59=_0x468855;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x340e59['id']);logger[_0x32b7('0x20')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x340e59['id'],_0x2cb472[_0x32b7('0x41')],_0x14f861[_0x32b7('0x38')]);switch(_0x14f861['type']){case _0x32b7('0x58'):emit(util[_0x32b7('0x30')](_0x32b7('0x59'),_0x2cb472[_0x32b7('0x41')]),_0x32b7('0x5a'),{'recordId':_0x340e59['id']});break;case _0x32b7('0x5b'):emit(util[_0x32b7('0x30')](_0x32b7('0x59'),_0x2cb472[_0x32b7('0x41')]),_0x32b7('0x5c'),{'uri':util['format'](_0x32b7('0x5d'),_0x59783b[_0x32b7('0x5e')],_0x340e59['id'])});break;default:logger[_0x32b7('0x5f')](_0x32b7('0x60'));}})[_0x32b7('0x61')](function(_0x2bfe81){logger[_0x32b7('0x5f')]('[QUEUE]',JSON['stringify'](_0x2bfe81));});};exports[_0x32b7('0x62')]=function(_0x445b3d,_0x468607,_0x2b3381,_0x31876c,_0x4856a4,_0x425062,_0x313ec6){var _0x6cfef9,_0x152ee1,_0x52623b,_0x41e024;_0x425062['serverUrl']=intUtil['stripTrailingSlash'](_0x425062[_0x32b7('0x4e')]);_0x425062[_0x32b7('0x46')]=intUtil[_0x32b7('0x4d')](_0x425062[_0x32b7('0x46')]);if(_0x313ec6&&_0x313ec6[_0x32b7('0x63')]&&_0x313ec6['recordingFormat']!==_0x32b7('0x64')){logger['info']('[OUTBOUND]',_0x32b7('0x51'));_0x468607['recordingURL']=util[_0x32b7('0x30')](_0x32b7('0x53'),_0x425062[_0x32b7('0x4e')],_0x468607['uniqueid'],md5(_0x468607[_0x32b7('0x54')]));}return getConnection(_0x425062)[_0x32b7('0x1e')](function(_0x13c20d){_0x41e024=_0x13c20d;return getUser(_0x425062,_0x31876c['email'],_0x41e024);})['then'](function(_0x2f2913){_0x6cfef9=_0x2f2913;return getEndUser(_0x425062,_0x2b3381,_0x468607['destcalleridname'],_0x468607[_0x32b7('0x65')],_0x41e024);})['then'](function(_0x25c67f){_0x152ee1=_0x25c67f;return getTicket(_0x425062,_0x6cfef9,_0x152ee1,_0x2b3381,_0x468607,_0x2b3381[_0x32b7('0x66')],_0x41e024,_0x32b7('0x62'));})['then'](function(_0x2a588e){_0x52623b=_0x2a588e;logger['info'](_0x32b7('0x67'),_0x52623b['id']);logger[_0x32b7('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x52623b['id'],_0x31876c[_0x32b7('0x41')],_0x425062[_0x32b7('0x38')]);switch(_0x425062[_0x32b7('0x38')]){case _0x32b7('0x58'):emit(util[_0x32b7('0x30')](_0x32b7('0x59'),_0x31876c[_0x32b7('0x41')]),_0x32b7('0x5a'),{'recordId':_0x52623b['id']});break;case'newTab':emit(util['format'](_0x32b7('0x59'),_0x31876c['name']),'trigger:browser:url',{'uri':util[_0x32b7('0x30')](_0x32b7('0x5d'),_0x41e024[_0x32b7('0x5e')],_0x52623b['id'])});break;default:logger[_0x32b7('0x5f')](_0x32b7('0x68'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x32b7('0x61')](function(_0x3d4594){logger[_0x32b7('0x5f')](_0x32b7('0x68'),JSON[_0x32b7('0x69')](_0x3d4594));});};exports['unmanaged']=function(_0x1abf00,_0x4026db,_0x105ae1,_0x21d140,_0x355bc0,_0x4cc4fc){var _0x2edd31,_0x1f31c1,_0x2d0081,_0x1bdf74;_0x4cc4fc[_0x32b7('0x4e')]=intUtil[_0x32b7('0x4d')](_0x4cc4fc[_0x32b7('0x4e')]);_0x4cc4fc[_0x32b7('0x46')]=intUtil[_0x32b7('0x4d')](_0x4cc4fc[_0x32b7('0x46')]);if(_0x355bc0&&_0x355bc0['monitor_format']){logger['info']('['+_0x4026db[_0x32b7('0x6a')][_0x32b7('0x6b')]()+']',_0x32b7('0x51'));_0x4026db[_0x32b7('0x52')]=util['format'](_0x32b7('0x53'),_0x4cc4fc['serverUrl'],_0x4026db[_0x32b7('0x54')],md5(_0x4026db['uniqueid']));}else{_0x4026db[_0x32b7('0x52')]='';}return getConnection(_0x4cc4fc)['then'](function(_0x26e660){_0x1bdf74=_0x26e660;if(!_[_0x32b7('0x18')](_0x21d140)){return getUser(_0x4cc4fc,_0x21d140[_0x32b7('0x41')],_0x1bdf74);}else{return getUser(_0x4cc4fc,null,_0x1bdf74);}})[_0x32b7('0x1e')](function(_0xfddc08){_0x2edd31=_0xfddc08;return getEndUser(_0x4cc4fc,_0x105ae1,_0x4026db['calleridname'],_0x4026db[_0x32b7('0x57')],_0x1bdf74);})[_0x32b7('0x1e')](function(_0x2f8825){_0x1f31c1=_0x2f8825;return getTicket(_0x4cc4fc,_0x2edd31,_0x1f31c1,_0x105ae1,_0x4026db,_0x105ae1[_0x32b7('0x66')],_0x1bdf74);})[_0x32b7('0x1e')](function(_0x1525b0){_0x2d0081=_0x1525b0;logger['info']('['+_0x4026db[_0x32b7('0x6a')][_0x32b7('0x6b')]()+']\x20Ticket\x20%s\x20created.',_0x2d0081['id']);logger[_0x32b7('0x20')]('['+_0x4026db[_0x32b7('0x6a')][_0x32b7('0x6b')]()+_0x32b7('0x6c'),_0x4cc4fc[_0x32b7('0x38')]);})[_0x32b7('0x61')](function(_0x1b4630){logger[_0x32b7('0x5f')]('['+_0x4026db[_0x32b7('0x6a')][_0x32b7('0x6b')]()+']',JSON[_0x32b7('0x69')](_0x1b4630));});}; \ No newline at end of file +var _0x5df0=['[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','ticketType','assign','utc','Subjects','getString','Descriptions','WhoId','Case','ContactId','isNil','validateEmail','sobject','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Lead','contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientSecret','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','format','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error'];(function(_0x37698f,_0x1f669d){var _0x53db3c=function(_0xa2190e){while(--_0xa2190e){_0x37698f['push'](_0x37698f['shift']());}};_0x53db3c(++_0x1f669d);}(_0x5df0,0x15c));var _0x05df=function(_0x17cb1b,_0x12ae1b){_0x17cb1b=_0x17cb1b-0x0;var _0x21a7fa=_0x5df0[_0x17cb1b];return _0x21a7fa;};'use strict';var _=require('lodash');var rp=require(_0x05df('0x0'));var moment=require(_0x05df('0x1'));var BPromise=require(_0x05df('0x2'));var md5=require(_0x05df('0x3'));var jsforce=require(_0x05df('0x4'));var util=require(_0x05df('0x5'));var Redis=require(_0x05df('0x6'));var intUtil=require('./util');var config=require(_0x05df('0x7'));var logger=require(_0x05df('0x8'))(_0x05df('0x9'));config[_0x05df('0xa')]=_['defaults'](config[_0x05df('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x05df('0xa')]));function emit(_0x5740f1,_0x331c56,_0xd518b8){io['to'](_0x5740f1)['emit'](_0x331c56,_0xd518b8);}function getTicket(_0x354173,_0x403d35,_0x1618e6,_0x2e7a10,_0x417d8a,_0x13724d,_0x59c5ee,_0x2f3fbc){var _0x25de78={};if(_0x2e7a10[_0x05df('0xb')]==='Task'){_0x25de78=Object[_0x05df('0xc')]({},{'OwnerId':_0x403d35['id'],'ActivityDate':moment[_0x05df('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x2e7a10[_0x05df('0xe')],_0x417d8a,'\x20'),'Description':intUtil[_0x05df('0xf')](_0x2e7a10[_0x05df('0x10')],_0x417d8a,'\x0a')},getCustomFields(_0x13724d,_0x417d8a));if(_0x1618e6){_0x25de78[_0x05df('0x11')]=_0x1618e6['id'];}}else if(_0x2e7a10[_0x05df('0xb')]===_0x05df('0x12')){_0x25de78=Object[_0x05df('0xc')]({},{'OwnerId':_0x403d35['id'],'Subject':intUtil['getString'](_0x2e7a10['Subjects'],_0x417d8a,'\x20'),'Description':intUtil['getString'](_0x2e7a10[_0x05df('0x10')],_0x417d8a,'\x0a')},getCustomFields(_0x13724d,_0x417d8a));if(_0x1618e6){_0x25de78[_0x05df('0x13')]=_0x1618e6['id'];}}return _0x59c5ee['sobject'](_0x2e7a10[_0x05df('0xb')])['create'](_0x25de78);}function getUser(_0x742c91,_0x1e7991,_0x162ab6){if(!_[_0x05df('0x14')](_0x1e7991)&&intUtil[_0x05df('0x15')](_0x1e7991)){var _0x1661ce={'Email':_0x1e7991};var _0x3c21a4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x162ab6[_0x05df('0x16')](_0x05df('0x17'))[_0x05df('0x18')](_0x1661ce,_0x3c21a4)[_0x05df('0x19')]()[_0x05df('0x1a')](function(_0x2403da){if(_0x2403da[_0x05df('0x1b')]){var _0x1b035d=_[_0x05df('0x18')](_0x2403da,function(_0x42fdcb){return _0x42fdcb[_0x05df('0x1c')]===_0x1e7991;});if(_0x1b035d){logger[_0x05df('0x1d')](_0x05df('0x1e'),_0x1e7991);return BPromise[_0x05df('0x1f')]({'id':_0x1b035d['Id'],'name':_0x1b035d[_0x05df('0x20')]});}}else{logger[_0x05df('0x1d')](_0x05df('0x21'),_0x1e7991);return _0x162ab6[_0x05df('0x22')]()['then'](function(_0x16435d){return BPromise[_0x05df('0x1f')]({'id':_0x16435d[_0x05df('0x23')],'name':_0x16435d[_0x05df('0x24')]});});}});}else{logger[_0x05df('0x1d')](_0x05df('0x21'),_0x1e7991);return _0x162ab6[_0x05df('0x22')]()[_0x05df('0x1a')](function(_0x547e7b){return BPromise['resolve']({'id':_0x547e7b[_0x05df('0x23')],'name':_0x547e7b['display_name']});});}}function getEndUser(_0xc4b9de,_0x53176d,_0x4298ac,_0x109e5f,_0x9bc072){var _0x5efb97={'Phone':_0x109e5f};var _0x6502ff={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x05df('0x1f')]()['then'](function(){if(_0x53176d['ticketType']===_0x05df('0x25')){logger[_0x05df('0x1d')](_0x05df('0x26'),_0x109e5f,_0x53176d[_0x05df('0x27')]);switch(_0x53176d[_0x05df('0x27')]){case _0x05df('0x28'):return _0x9bc072[_0x05df('0x16')]('Contact')['find'](_0x5efb97,_0x6502ff)[_0x05df('0x19')]()[_0x05df('0x1a')](function(_0x604b6f){if(_0x604b6f&&_0x604b6f[_0x05df('0x1b')]){return _0x604b6f;}else{return _0x9bc072['sobject'](_0x05df('0x29'))[_0x05df('0x18')](_0x5efb97,_0x6502ff);}});case _0x05df('0x2a'):return _0x9bc072[_0x05df('0x16')](_0x05df('0x2b'))[_0x05df('0x18')](_0x5efb97,_0x6502ff)['execute']();case _0x05df('0x2c'):return _0x9bc072[_0x05df('0x16')](_0x05df('0x29'))[_0x05df('0x18')](_0x5efb97,_0x6502ff);default:return null;}}else if(_0x53176d[_0x05df('0xb')]==='Case'){logger[_0x05df('0x1d')](_0x05df('0x26'),_0x109e5f,_0x05df('0x2a'));return _0x9bc072[_0x05df('0x16')](_0x05df('0x2b'))[_0x05df('0x18')](_0x5efb97,_0x6502ff)[_0x05df('0x19')]();}})[_0x05df('0x1a')](function(_0x365eaa){if(_0x365eaa&&_0x365eaa[_0x05df('0x1b')]){var _0x363a3e=_['find'](_0x365eaa,function(_0x102264){return _0x102264[_0x05df('0x2d')]===_0x109e5f;});if(_0x363a3e){return BPromise['resolve']({'id':_0x363a3e['Id'],'name':_0x363a3e[_0x05df('0x20')],'phone':_0x363a3e[_0x05df('0x2d')]});}}})['then'](function(_0x562e63){if(_0x562e63){logger[_0x05df('0x1d')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x109e5f);return BPromise['resolve'](_0x562e63);}else{logger[_0x05df('0x1d')](_0x05df('0x2e'),_0x109e5f);var _0x542686={'LastName':_0x4298ac!==_0x05df('0x2f')?_0x4298ac:util['format'](_0x05df('0x30'),_0x109e5f),'Phone':_0x109e5f};if(_0x53176d[_0x05df('0x31')]){if(_0x53176d[_0x05df('0x31')]===_0x05df('0x2a')){logger[_0x05df('0x1d')](_0x05df('0x32'),_0x109e5f,_0x53176d[_0x05df('0x31')]);}else if(_0x53176d['moduleCreate']===_0x05df('0x2c')&&_0x53176d['ticketType']===_0x05df('0x25')){logger[_0x05df('0x1d')](_0x05df('0x32'),_0x109e5f,_0x53176d[_0x05df('0x31')]);_0x542686[_0x05df('0x33')]=_0x05df('0x34');}else{return null;}}return _0x9bc072[_0x05df('0x16')](_[_0x05df('0x35')](_0x53176d[_0x05df('0x31')]))[_0x05df('0x36')](_0x542686);}});}function getCustomFields(_0x2a2a08,_0x43505d){var _0x125cca={};if(_0x2a2a08[_0x05df('0x1b')]>0x0){_[_0x05df('0x37')](_0x2a2a08,function(_0x223f90){if(_0x223f90[_0x05df('0x38')]===_0x05df('0x39')&&_0x223f90[_0x05df('0x3a')]){_0x125cca[_0x223f90['idField']]=_0x223f90[_0x05df('0x3b')][_0x05df('0x3c')]();}else if(_0x223f90[_0x05df('0x38')]===_0x05df('0x3d')&&_0x223f90['variableName']&&_0x223f90[_0x05df('0x3a')]){_0x43505d[_0x223f90[_0x05df('0x3e')]]&&(_0x125cca[_0x223f90[_0x05df('0x3a')]]=_0x43505d[_0x223f90[_0x05df('0x3e')]][_0x05df('0x3c')]());}else if(_0x223f90['type']===_0x05df('0x3f')&&_0x223f90['Variable']&&_0x223f90[_0x05df('0x40')][_0x05df('0x41')]&&_0x223f90[_0x05df('0x3a')]){_0x43505d[_0x223f90['Variable']['name'][_0x05df('0x42')]()]&&(_0x125cca[_0x223f90[_0x05df('0x3a')]]=_0x43505d[_0x223f90[_0x05df('0x40')][_0x05df('0x41')][_0x05df('0x42')]()][_0x05df('0x3c')]());}});}return _0x125cca;}function getConnection(_0x482e84){var _0x3ae4fd=_0x482e84[_0x05df('0x43')][_0x05df('0x44')](_0x482e84[_0x05df('0x45')]);var _0x108a58=new jsforce[(_0x05df('0x46'))]({'oauth2':{'loginUrl':_0x482e84[_0x05df('0x47')]||'https://login.salesforce.com','clientId':_0x482e84['clientId'],'clientSecret':_0x482e84[_0x05df('0x48')]}});return _0x108a58['login'](_0x482e84['username'],_0x3ae4fd)['then'](function(){logger[_0x05df('0x1d')]('Connection\x20established.');return _0x108a58;});}exports[_0x05df('0x49')]=function(_0x573b22,_0x23a436,_0x5de05f,_0x3e0ace,_0x2e6a9c,_0x2ee379){var _0x1917ee,_0x3061be,_0x1a1fe2,_0x277359;_0x2ee379[_0x05df('0x4a')]=intUtil[_0x05df('0x4b')](_0x2ee379[_0x05df('0x4a')]);_0x2ee379[_0x05df('0x47')]=intUtil['stripTrailingSlash'](_0x2ee379[_0x05df('0x47')]);if(_0x2e6a9c&&_0x2e6a9c[_0x05df('0x4c')]){logger[_0x05df('0x1d')](_0x05df('0x4d'),_0x05df('0x4e'));_0x23a436[_0x05df('0x4f')]=util['format'](_0x05df('0x50'),_0x2ee379['serverUrl'],_0x23a436[_0x05df('0x51')],md5(_0x23a436[_0x05df('0x51')]));}else{_0x23a436['recordingURL']='';}return getConnection(_0x2ee379)[_0x05df('0x1a')](function(_0x1f7c00){_0x277359=_0x1f7c00;return getUser(_0x2ee379,_0x3e0ace[_0x05df('0x52')],_0x277359);})[_0x05df('0x1a')](function(_0x5bf626){_0x1917ee=_0x5bf626;return getEndUser(_0x2ee379,_0x5de05f,_0x23a436['calleridname'],_0x23a436[_0x05df('0x53')],_0x277359);})[_0x05df('0x1a')](function(_0x238331){_0x3061be=_0x238331;return getTicket(_0x2ee379,_0x1917ee,_0x3061be,_0x5de05f,_0x23a436,_0x5de05f[_0x05df('0x54')],_0x277359,_0x05df('0x49'));})[_0x05df('0x1a')](function(_0x8d50bc){_0x1a1fe2=_0x8d50bc;logger[_0x05df('0x1d')](_0x05df('0x55'),_0x1a1fe2['id']);logger[_0x05df('0x1d')](_0x05df('0x56'),_0x1a1fe2['id'],_0x3e0ace[_0x05df('0x41')],_0x2ee379[_0x05df('0x38')]);switch(_0x2ee379[_0x05df('0x38')]){case _0x05df('0x57'):emit(util[_0x05df('0x58')](_0x05df('0x59'),_0x3e0ace[_0x05df('0x41')]),_0x05df('0x5a'),{'recordId':_0x1a1fe2['id']});break;case _0x05df('0x5b'):emit(util['format'](_0x05df('0x59'),_0x3e0ace['name']),_0x05df('0x5c'),{'uri':util[_0x05df('0x58')](_0x05df('0x5d'),_0x277359[_0x05df('0x5e')],_0x1a1fe2['id'])});break;default:logger[_0x05df('0x5f')](_0x05df('0x60'));}})[_0x05df('0x61')](function(_0x4e71b4){logger['error'](_0x05df('0x4d'),JSON['stringify'](_0x4e71b4));});};exports[_0x05df('0x62')]=function(_0xd59dad,_0x2cb32c,_0x44c04c,_0x389d04,_0x2a5212,_0x1178e0,_0x5d7381){var _0x3f95d0,_0x299c00,_0x584fe9,_0x391d0b;_0x1178e0[_0x05df('0x4a')]=intUtil[_0x05df('0x4b')](_0x1178e0[_0x05df('0x4a')]);_0x1178e0['remoteUri']=intUtil[_0x05df('0x4b')](_0x1178e0[_0x05df('0x47')]);if(_0x5d7381&&_0x5d7381['recordingFormat']&&_0x5d7381[_0x05df('0x63')]!==_0x05df('0x64')){logger[_0x05df('0x1d')](_0x05df('0x65'),_0x05df('0x4e'));_0x2cb32c[_0x05df('0x4f')]=util[_0x05df('0x58')](_0x05df('0x50'),_0x1178e0[_0x05df('0x4a')],_0x2cb32c[_0x05df('0x51')],md5(_0x2cb32c[_0x05df('0x51')]));}return getConnection(_0x1178e0)['then'](function(_0x6a2dc2){_0x391d0b=_0x6a2dc2;return getUser(_0x1178e0,_0x389d04[_0x05df('0x52')],_0x391d0b);})[_0x05df('0x1a')](function(_0x1f59bb){_0x3f95d0=_0x1f59bb;return getEndUser(_0x1178e0,_0x44c04c,_0x2cb32c['destcalleridname'],_0x2cb32c[_0x05df('0x66')],_0x391d0b);})['then'](function(_0x50d0c4){_0x299c00=_0x50d0c4;return getTicket(_0x1178e0,_0x3f95d0,_0x299c00,_0x44c04c,_0x2cb32c,_0x44c04c[_0x05df('0x54')],_0x391d0b,_0x05df('0x62'));})[_0x05df('0x1a')](function(_0x9ae369){_0x584fe9=_0x9ae369;logger[_0x05df('0x1d')](_0x05df('0x67'),_0x584fe9['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x584fe9['id'],_0x389d04['name'],_0x1178e0[_0x05df('0x38')]);switch(_0x1178e0[_0x05df('0x38')]){case _0x05df('0x57'):emit(util[_0x05df('0x58')](_0x05df('0x59'),_0x389d04[_0x05df('0x41')]),_0x05df('0x5a'),{'recordId':_0x584fe9['id']});break;case _0x05df('0x5b'):emit(util[_0x05df('0x58')]('user:%s',_0x389d04['name']),_0x05df('0x5c'),{'uri':util[_0x05df('0x58')](_0x05df('0x5d'),_0x391d0b[_0x05df('0x5e')],_0x584fe9['id'])});break;default:logger[_0x05df('0x5f')](_0x05df('0x65'),_0x05df('0x68'));}})[_0x05df('0x61')](function(_0x15bdd7){logger[_0x05df('0x5f')](_0x05df('0x65'),JSON[_0x05df('0x69')](_0x15bdd7));});};exports[_0x05df('0x6a')]=function(_0x2b16ed,_0x279fed,_0x3dbc58,_0x1495a9,_0x567f6a,_0x35e448){var _0x16afec,_0x5e7da5,_0x4c888e,_0x598a5a;_0x35e448['serverUrl']=intUtil[_0x05df('0x4b')](_0x35e448[_0x05df('0x4a')]);_0x35e448[_0x05df('0x47')]=intUtil['stripTrailingSlash'](_0x35e448[_0x05df('0x47')]);if(_0x567f6a&&_0x567f6a[_0x05df('0x4c')]){logger[_0x05df('0x1d')]('['+_0x279fed[_0x05df('0x6b')][_0x05df('0x6c')]()+']',_0x05df('0x4e'));_0x279fed[_0x05df('0x4f')]=util[_0x05df('0x58')](_0x05df('0x50'),_0x35e448[_0x05df('0x4a')],_0x279fed[_0x05df('0x51')],md5(_0x279fed[_0x05df('0x51')]));}else{_0x279fed['recordingURL']='';}return getConnection(_0x35e448)[_0x05df('0x1a')](function(_0x5d9a83){_0x598a5a=_0x5d9a83;if(!_[_0x05df('0x14')](_0x1495a9)){return getUser(_0x35e448,_0x1495a9['name'],_0x598a5a);}else{return getUser(_0x35e448,null,_0x598a5a);}})['then'](function(_0x23f969){_0x16afec=_0x23f969;return getEndUser(_0x35e448,_0x3dbc58,_0x279fed[_0x05df('0x6d')],_0x279fed['calleridnum'],_0x598a5a);})[_0x05df('0x1a')](function(_0x2019ed){_0x5e7da5=_0x2019ed;return getTicket(_0x35e448,_0x16afec,_0x5e7da5,_0x3dbc58,_0x279fed,_0x3dbc58[_0x05df('0x54')],_0x598a5a);})[_0x05df('0x1a')](function(_0x4f3f14){_0x4c888e=_0x4f3f14;logger['info']('['+_0x279fed['lastevent'][_0x05df('0x6c')]()+']\x20Ticket\x20%s\x20created.',_0x4c888e['id']);logger['info']('['+_0x279fed[_0x05df('0x6b')][_0x05df('0x6c')]()+_0x05df('0x6e'),_0x35e448['type']);})[_0x05df('0x61')](function(_0x1be491){logger[_0x05df('0x5f')]('['+_0x279fed[_0x05df('0x6b')]['toUpperCase']()+']',JSON[_0x05df('0x69')](_0x1be491));});}; \ 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 95fa751..8610601 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 _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x90135a,_0x2ee435){var _0xbbb484=function(_0x2429c3){while(--_0x2429c3){_0x90135a['push'](_0x90135a['shift']());}};_0xbbb484(++_0x2ee435);}(_0x2ef3,0xba));var _0x32ef=function(_0x1258f5,_0x4e4a45){_0x1258f5=_0x1258f5-0x0;var _0x4333bd=_0x2ef3[_0x1258f5];return _0x4333bd;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7a54=['getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%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','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x3b2f10,_0x34dc5f){var _0x563d79=function(_0x5ab05a){while(--_0x5ab05a){_0x3b2f10['push'](_0x3b2f10['shift']());}};_0x563d79(++_0x34dc5f);}(_0x7a54,0x106));var _0x47a5=function(_0x13baa1,_0x474eca){_0x13baa1=_0x13baa1-0x0;var _0x377f82=_0x7a54[_0x13baa1];return _0x377f82;};'use strict';var _=require(_0x47a5('0x0'));var Promise=require(_0x47a5('0x1'));var rp=require(_0x47a5('0x2'));var util=require('util');var md5=require(_0x47a5('0x3'));var Redis=require(_0x47a5('0x4'));var intUtil=require('./util');var config=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));function getAdminUser(_0x30e405,_0x506eda,_0x194fb0,_0x5077f3,_0x5d90b3,_0x582352){return new Promise(function(_0x2a0e98,_0x2baee7){var _0x5e31dd={'method':_0x47a5('0xb'),'uri':_0x5077f3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5d90b3+'&'+_0x582352,'auth':_0x506eda,'json':!![]};return rp(_0x5e31dd)['then'](function(_0x1f47f4){if(_0x1f47f4[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x194fb0[_0x47a5('0xe')]=_0x1f47f4[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}logger[_0x47a5('0x10')]('['+[_0x30e405['toUpperCase']()]+_0x47a5('0x11'),_0x194fb0);_0x2a0e98(_0x194fb0);})[_0x47a5('0x12')](function(_0x1cf309){logger[_0x47a5('0x13')]('['+[_0x30e405[_0x47a5('0x14')]()]+']',_0x1cf309[_0x47a5('0x15')]);_0x2baee7(_0x1cf309[_0x47a5('0x15')]);});});}function getUser(_0x190faa,_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return function(_0x2a2cbb){logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x2a2cbb);return new Promise(function(_0x138bc0,_0x4b966e){if(intUtil['validateEmail'](_0x2a2cbb[_0x47a5('0x16')])){var _0xaf70a6={'method':_0x47a5('0xb'),'uri':_0x362359+_0x47a5('0x17')+_0x2a2cbb[_0x47a5('0x16')]+'&'+_0x11faf5+'&'+_0x3b001e,'auth':_0x4e99a8,'json':!![]};logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x18'),_0xaf70a6);return rp(_0xaf70a6)[_0x47a5('0x19')](function(_0x4a9fcb){logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+'],\x20getUser\x20entity',_0x4a9fcb);if(_0x4a9fcb[_0x47a5('0xc')][_0x47a5('0xd')]>0x0&&String(_0x4a9fcb[_0x47a5('0xc')][0x0]['active'])===_0x47a5('0x1a')){_0x2a2cbb[_0x47a5('0x1b')]=_0x4a9fcb[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}else{_0x2a2cbb['userId']=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb['adminEmail'];}logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x1c'),_0x2a2cbb);_0x138bc0(_0x2a2cbb);})[_0x47a5('0x12')](function(_0x3abd6a){logger['error']('['+[_0x190faa['toUpperCase']()]+']',_0x3abd6a[_0x47a5('0x15')]);_0x4b966e(_0x3abd6a['message']);});}else{logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+_0x47a5('0x1d'));_0x2a2cbb[_0x47a5('0x1b')]=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb[_0x47a5('0x1e')];_0x138bc0(_0x2a2cbb);}});};}function createEndUser(_0x3ba0b7,_0x24b162,_0x136b14,_0x16631f,_0x361bfa){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+_0x47a5('0x1f'),_0x136b14);return new Promise(function(_0x528582,_0x243210){var _0x51833b={'method':_0x47a5('0x20'),'uri':_0x16631f+_0x47a5('0x21')+_0x361bfa,'body':{'user_name':_0x136b14[_0x47a5('0x22')],'roles':'user','first_name':_0x136b14[_0x47a5('0x22')],'active':_0x47a5('0x1a'),'date_format':_0x47a5('0x23'),'phone':_0x136b14[_0x47a5('0x22')]},'auth':_0x24b162,'json':!![]};return rp(_0x51833b)['then'](function(_0x50d875){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+'],\x20EndUser\x20schema',_0x50d875['result']);_0x136b14[_0x47a5('0x24')]=_0x50d875[_0x47a5('0xc')]['sys_id'];_0x528582(_0x136b14);})[_0x47a5('0x12')](function(_0x53119b){logger[_0x47a5('0x13')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+']',_0x53119b['message']);_0x243210(_0x53119b['message']);});});}function getEndUser(_0x274e34,_0x5910bb,_0x403028,_0x87e4c9,_0xf269a8){return function(_0x52749b){logger[_0x47a5('0x10')]('['+[_0x274e34['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x52749b);return new Promise(function(_0x65542e,_0x5a8a7c){var _0x25cce0={'method':'GET','uri':_0x403028+_0x47a5('0x25')+_0x52749b[_0x47a5('0x22')]+'&'+_0x87e4c9+'&'+_0xf269a8,'auth':_0x5910bb,'json':!![]};return rp(_0x25cce0)[_0x47a5('0x19')](function(_0x199698){if(_0x199698[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x52749b[_0x47a5('0x24')]=_0x199698[_0x47a5('0xc')][0x0][_0x47a5('0xf')];logger['info']('['+[_0x274e34[_0x47a5('0x14')]()]+_0x47a5('0x26'),_0x52749b);_0x65542e(_0x52749b);}else{return createEndUser(_0x274e34,_0x5910bb,_0x52749b,_0x403028,_0x87e4c9)['then'](function(_0x2c50d6){logger[_0x47a5('0x10')]('['+[_0x274e34[_0x47a5('0x14')]()]+'],\x20createEndUser\x20crm',_0x2c50d6);_0x65542e(_0x2c50d6);});}})[_0x47a5('0x12')](function(_0x10f660){logger['error']('['+[_0x274e34[_0x47a5('0x14')]()]+']',_0x10f660[_0x47a5('0x15')]);_0x5a8a7c(_0x10f660['message']);});});};}function getCustomFields(_0x55c5eb,_0x5ebd8c){var _0x12d9f2={};if(_0x55c5eb['length']>0x0){_[_0x47a5('0x27')](_0x55c5eb,function(_0x1f9631){if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2a')]&&!_0x1f9631[_0x47a5('0x2b')]){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2c')]&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631['type']===_0x47a5('0x30')&&_0x1f9631['variableName']&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631['idField'][_0x47a5('0x2d')]()]=_0x5ebd8c[_0x1f9631['variableName']][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x31')&&_0x1f9631['Variable']&&_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')]&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')]['toLowerCase']()]=_0x5ebd8c[_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')][_0x47a5('0x2d')]()][_0x47a5('0x2f')]();}});}return _0x12d9f2;}function getTicket(_0x34a9ae,_0xf0edbb,_0x434227,_0x17cc42,_0xac9c15,_0x162fa0){return function(_0x24ecb1){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+_0x47a5('0x34'),_0x24ecb1);return new Promise(function(_0x4e5e7,_0x3a2b38){var _0x512e65=_0x34a9ae[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x24ecb1['userId']:_0x24ecb1['endUserId'];var _0x3d0a88={'method':'POST','uri':_0x434227+_0x47a5('0x36')+'?'+_0x162fa0,'body':Object[_0x47a5('0x37')]({},{'active':'true','caller_id':_0x512e65,'assigned_to':_0x24ecb1['userId'],'short_description':intUtil[_0x47a5('0x38')](_0x17cc42['Subjects'],_0xac9c15,'\x20'),'description':intUtil[_0x47a5('0x38')](_0x17cc42[_0x47a5('0x39')],_0xac9c15,'\x0a')},getCustomFields(_0x17cc42[_0x47a5('0x3a')],_0xac9c15)),'auth':_0xf0edbb,'json':!![]};return rp(_0x3d0a88)[_0x47a5('0x19')](function(_0x44fe8a){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x44fe8a['result']);_0x24ecb1[_0x47a5('0x3b')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0xf')];_0x24ecb1[_0x47a5('0x3c')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0x3d')];logger[_0x47a5('0x10')]('['+[_0x34a9ae['toUpperCase']()]+_0x47a5('0x3e'),_0x24ecb1);_0x4e5e7(_0x24ecb1);})[_0x47a5('0x12')](function(_0x5f6a){logger['error']('['+[_0x34a9ae[_0x47a5('0x14')]()]+']',_0x5f6a['message']);_0x3a2b38(_0x5f6a[_0x47a5('0x15')]);});});};}function createRemoteTag(_0xe31817,_0x46e90b,_0xf03bd5,_0x588551){return new Promise(function(_0x3adf14,_0x1e6de3){var _0x2f66e9={'method':_0x47a5('0x20'),'uri':_0xf03bd5+_0x47a5('0x3f')+'?'+_0x588551,'body':{'short_description':_0xe31817,'global':!![],'active':!![],'name':_0xe31817},'auth':_0x46e90b,'json':!![]};return rp(_0x2f66e9)[_0x47a5('0x19')](function(_0x24e9f4){var _0x481089=_0x24e9f4[_0x47a5('0xc')][_0x47a5('0xf')];_0x3adf14(_0x481089);});});}function getRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf,_0x572233){return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581={'method':'GET','uri':_0x3329aa+_0x47a5('0x3f')+_0x47a5('0x40')+_0x187d7e+'&'+_0x1ab0bf,'auth':_0x8da9fb,'json':!![]};return rp(_0x1aa581)[_0x47a5('0x19')](function(_0x5d8d4a){if(_0x5d8d4a['result'][_0x47a5('0xd')]>0x0){var _0x376e1d=_0x5d8d4a['result'][0x0]['sys_id'];_0x1ad6a9(_0x376e1d);}else{return createRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf)[_0x47a5('0x19')](function(_0x4d6a82){_0x1ad6a9(_0x4d6a82);});}});});}function assignTagToIncident(_0x16bb8a,_0x5d383d,_0x482de6,_0x389ed9,_0x46d2d3){return new Promise(function(_0x53eedf,_0x1b958b){var _0x72fe={'method':'POST','uri':_0x482de6+'label_entry'+'?'+_0x46d2d3,'body':{'label':_0x16bb8a,'table':_0x47a5('0x36'),'id_type':_0x47a5('0x41'),'table_key':_0x389ed9[_0x47a5('0x3b')],'title':_0x47a5('0x42')+_0x389ed9['ticketNumber'],'id_display':_0x389ed9[_0x47a5('0x3c')]},'auth':_0x5d383d,'json':!![]};return rp(_0x72fe)[_0x47a5('0x19')](function(_0x1af800){_0x53eedf();})['catch'](function(){_0x53eedf();});});}function manageTags(_0x30ea7a,_0x4db625,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b,_0x3603b7){return new Promise(function(_0x4966af,_0x144af9){var _0x5d1550=[];_0x4db625['forEach'](function(_0x5eb150){_0x5d1550['push'](getRemoteTag(_0x5eb150,_0x485e3c,_0x470da6,_0x1c485b,_0x3603b7));});return Promise[_0x47a5('0x43')](_0x5d1550)[_0x47a5('0x19')](function(_0x1e2bb4){if(_0x1e2bb4['length']){logger['info']('['+[_0x30ea7a[_0x47a5('0x14')]()]+_0x47a5('0x44'),_0x1e2bb4);var _0x45d4b6=[];_0x1e2bb4[_0x47a5('0x27')](function(_0xc45e25){_0x45d4b6['push'](assignTagToIncident(_0xc45e25,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b));});return Promise[_0x47a5('0x43')](_0x45d4b6)['then'](function(){_0x4966af();})[_0x47a5('0x12')](function(){_0x4966af();});}else{_0x4966af();}});});}function getTags(_0x274d31,_0x4d545f,_0x32b4de,_0x345104,_0x132854,_0x3e8274){return function(_0x2d6494){return new Promise(function(_0x215634,_0x35cca8){var _0x3ac38c=[];var _0x57ed0a=_0x345104[_0x47a5('0x45')];if(_0x57ed0a&&_0x57ed0a[_0x47a5('0xd')]>0x0){_0x3ac38c=_[_0x47a5('0x46')](_0x57ed0a,_0x47a5('0x33'));}if(_0x3ac38c[_0x47a5('0xd')]>0x0){return manageTags(_0x274d31,_0x3ac38c,_0x4d545f,_0x32b4de,_0x2d6494,_0x132854,_0x3e8274)['then'](function(){_0x215634(_0x2d6494);});}else{_0x215634(_0x2d6494);}});};}function emit(_0xbec033,_0xdfcecc,_0x1224bc){var _0x144aaa=_0x47a5('0x47')+_0x47a5('0x48')+_0x47a5('0x49')+_0x47a5('0x4a');var _0x350af8={'uri':_0xbec033+_0x47a5('0x4b')+_0x1224bc+_0x144aaa};io['to'](util[_0x47a5('0x4c')](_0x47a5('0x4d'),_0xdfcecc))[_0x47a5('0x4e')](_0x47a5('0x4f'),_0x350af8);}exports['cs']=function(_0x3edd17,_0x5a6161,_0x42dd7d,_0x284fb8,_0x30504e,_0x4b42f3,_0x37ac59,_0x2e46af){var _0x36c67={};var _0x26f1ac={'user':_0x4b42f3['username'],'pass':_0x4b42f3[_0x47a5('0x50')]};var _0x522ccf=_0x47a5('0x51');var _0x487e21=_0x47a5('0x52');_0x4b42f3['remoteUri']=intUtil[_0x47a5('0x53')](_0x4b42f3[_0x47a5('0x54')]);_0x4b42f3[_0x47a5('0x55')]=intUtil['stripTrailingSlash'](_0x4b42f3['serverUrl']);var _0x4b8084=util[_0x47a5('0x4c')](_0x47a5('0x56'),_0x4b42f3[_0x47a5('0x54')]);_0x36c67[_0x47a5('0x16')]=!_['isNil'](_0x284fb8)?_0x284fb8[_0x47a5('0x57')]:null;_0x36c67[_0x47a5('0x1e')]=_0x4b42f3[_0x47a5('0x57')];_0x36c67[_0x47a5('0x22')]=_0x2e46af[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x5a6161[_0x47a5('0x58')]:_0x5a6161[_0x47a5('0x59')];_0x36c67[_0x47a5('0x5a')]=_0x2e46af===_0x47a5('0x5b')||_0x2e46af===_0x47a5('0x5c')?_0x47a5('0x5b'):'outbound';var _0x1e3212=util['format'](_0x47a5('0x5d'),_0x4b42f3[_0x47a5('0x55')],_0x5a6161[_0x47a5('0x5e')],md5(_0x5a6161[_0x47a5('0x5e')]));if(_0x30504e&&_0x30504e[_0x47a5('0x5f')]){logger[_0x47a5('0x10')](_0x47a5('0x60'),_0x47a5('0x61'));_0x5a6161[_0x47a5('0x62')]=_0x1e3212;}else if(_0x37ac59&&_0x37ac59[_0x47a5('0x63')]&&_0x37ac59[_0x47a5('0x63')]!==_0x47a5('0x64')){logger[_0x47a5('0x10')](_0x47a5('0x65'),_0x47a5('0x61'));_0x5a6161['recordingURL']=_0x1e3212;}else{_0x5a6161['recordingURL']='';}return getAdminUser(_0x2e46af,_0x26f1ac,_0x36c67,_0x4b8084,_0x487e21,_0x522ccf)['then'](getUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))['then'](getEndUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))[_0x47a5('0x19')](getTicket(_0x2e46af,_0x26f1ac,_0x4b8084,_0x42dd7d,_0x5a6161,_0x487e21))[_0x47a5('0x19')](function(_0x5d6916){logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x66'),_0x5d6916[_0x47a5('0x3b')]));logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x67'),_0x2e46af));if(_0x2e46af!==_0x47a5('0x5c')){logger[_0x47a5('0x10')]('['+[_0x2e46af[_0x47a5('0x14')]()]+']',_0x47a5('0x68'));emit(_0x4b42f3['remoteUri'],_0x284fb8[_0x47a5('0x33')],_0x5d6916[_0x47a5('0x3b')]);}})[_0x47a5('0x12')](function(_0x4f35ff){logger[_0x47a5('0x13')]('['+[_0x2e46af[_0x47a5('0x14')]()]+_0x47a5('0x69'),util['inspect'](_0x4f35ff,{'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 7b59246..c0b3d4b 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 _0x1b64=['sugarcrm','redis','localhost','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','variableName','JSON','stringify','Calls','format','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','content','idField','push','variable','custom_fields','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','unmanaged','Inbound','lastevent','toUpperCase','lodash','request-promise','md5','../../../../config/environment','../../../../config/logger'];(function(_0x1d6768,_0x45c63f){var _0x2b3383=function(_0x3de615){while(--_0x3de615){_0x1d6768['push'](_0x1d6768['shift']());}};_0x2b3383(++_0x45c63f);}(_0x1b64,0x76));var _0x41b6=function(_0x5188ed,_0x17ed3c){_0x5188ed=_0x5188ed-0x0;var _0x164a75=_0x1b64[_0x5188ed];return _0x164a75;};'use strict';var _=require(_0x41b6('0x0'));var rp=require(_0x41b6('0x1'));var BPromise=require('bluebird');var md5=require(_0x41b6('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x41b6('0x3'));var logger=require(_0x41b6('0x4'))(_0x41b6('0x5'));config[_0x41b6('0x6')]=_['defaults'](config[_0x41b6('0x6')],{'host':_0x41b6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x7763c3,_0x3cc6f8,_0x3c7ef4){io['to'](_0x7763c3)[_0x41b6('0x8')](_0x3cc6f8,_0x3c7ef4);}function getTicket(_0x477e12,_0x412dca,_0x4d66c5,_0x207a2f,_0x31b2b4,_0x274f27,_0x1e0256,_0x28c385){logger[_0x41b6('0x9')](_0x41b6('0xa'));var _0xd7866=new Date();var _0x179e37=[{'name':_0x41b6('0xb'),'value':intUtil[_0x41b6('0xc')](_0x207a2f[_0x41b6('0xd')],_0x31b2b4,'\x20')},{'name':'assigned_user_id','value':_0x412dca['id']},{'name':_0x41b6('0xe'),'value':_0x412dca['id']},{'name':_0x41b6('0xf'),'value':intUtil[_0x41b6('0xc')](_0x207a2f[_0x41b6('0x10')],_0x31b2b4,'\x0a')},{'name':'date_start','value':_0xd7866[_0x41b6('0x11')]()[_0x41b6('0x12')](0x0,0x13)[_0x41b6('0x13')]('T','\x20')},{'name':_0x41b6('0x14'),'value':'0'},{'name':_0x41b6('0x15'),'value':'15'},{'name':_0x41b6('0x16'),'value':_0x4d66c5['id']},{'name':_0x41b6('0x17'),'value':'Contacts'},{'name':_0x41b6('0x18'),'value':_0x4d66c5[_0x41b6('0xb')]},{'name':_0x41b6('0x19'),'value':_0x28c385}];if(_0x274f27[_0x41b6('0x1a')]){_[_0x41b6('0x1b')](_0x274f27,function(_0x47feb9){if(_0x31b2b4[_0x47feb9['variableName']]){_0x179e37['push']({'name':_0x47feb9['idField'],'value':_0x31b2b4[_0x47feb9[_0x41b6('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x41b6('0x1d'),'response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'session':_0x1e0256['id'],'module_name':_0x41b6('0x1f'),'name_value_list':_0x179e37})}});}function getAuth(_0x10c17c){return util[_0x41b6('0x20')]('Basic\x20%s',new Buffer(_0x10c17c['apiKey']+':X')[_0x41b6('0x21')]('base64'));}function getServerInfo(_0xb4596c){return request({'form':{'method':_0x41b6('0x22'),'input_type':_0x41b6('0x1d'),'response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'session':_0xb4596c['id']})}});}function getUser(_0x1c8e7a,_0x1fea00,_0x11cc02){if(!_[_0x41b6('0x23')](_0x1fea00)){logger[_0x41b6('0x9')](_0x41b6('0x24'),_0x1fea00);return request({'form':{'method':'get_entry_list','input_type':_0x41b6('0x1d'),'response_type':_0x41b6('0x1d'),'rest_data':JSON['stringify']({'session':_0x11cc02['id'],'module_name':_0x41b6('0x25'),'query':util[_0x41b6('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1fea00),'order_by':'','offset':'0','select_fields':['id',_0x41b6('0xb'),_0x41b6('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x41b6('0x27')](function(_0x5a9624){if(_0x5a9624[_0x41b6('0x28')]['length']){var _0x49142b=_['find'](_0x5a9624[_0x41b6('0x28')],function(_0x425c16){return _0x425c16['name_value_list'][_0x41b6('0x26')][_0x41b6('0x29')]===_0x1fea00;});if(_0x49142b){logger[_0x41b6('0x9')](_0x41b6('0x2a'));return BPromise[_0x41b6('0x2b')]({'id':_0x49142b['name_value_list']['id']['value'],'name':_0x49142b[_0x41b6('0x2c')][_0x41b6('0xb')][_0x41b6('0x29')]});}}logger['info'](_0x41b6('0x2d'));return BPromise[_0x41b6('0x2b')]({'id':_0x11cc02['name_value_list'][_0x41b6('0x2e')][_0x41b6('0x29')],'name':_0x11cc02[_0x41b6('0x2c')][_0x41b6('0x26')][_0x41b6('0x29')]});});}else{logger[_0x41b6('0x9')](_0x41b6('0x2f'));return BPromise['resolve']({'id':_0x11cc02[_0x41b6('0x2c')]['user_id']['value'],'name':_0x11cc02[_0x41b6('0x2c')]['user_name'][_0x41b6('0x29')]});}}function getEndUser(_0x84987a,_0x2762de,_0x435639,_0xc97805){logger[_0x41b6('0x9')](_0x41b6('0x30'),_0x435639);return request({'form':{'method':_0x41b6('0x31'),'input_type':'JSON','response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'session':_0xc97805['id'],'module_name':_0x41b6('0x32'),'query':util[_0x41b6('0x20')](_0x41b6('0x33'),_0x435639),'order_by':'','offset':'0','select_fields':['id',_0x41b6('0xb'),_0x41b6('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x69277a){if(_0x69277a['entry_list']['length']){var _0x34edfc=_[_0x41b6('0x35')](_0x69277a[_0x41b6('0x28')],function(_0x2de366){return _0x2de366[_0x41b6('0x2c')][_0x41b6('0x34')]['value']===_0x435639;});if(_0x34edfc){logger[_0x41b6('0x9')](_0x41b6('0x36'));return BPromise[_0x41b6('0x2b')]({'id':_0x34edfc[_0x41b6('0x2c')]['id'][_0x41b6('0x29')],'name':_0x34edfc[_0x41b6('0x2c')][_0x41b6('0xb')]['value'],'phone':_0x34edfc[_0x41b6('0x2c')][_0x41b6('0x34')][_0x41b6('0x29')]});}}else{logger[_0x41b6('0x9')](_0x41b6('0x37'));return request({'form':{'method':_0x41b6('0x38'),'input_type':_0x41b6('0x1d'),'response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'session':_0xc97805['id'],'module_name':_0x41b6('0x32'),'name_value_list':[{'name':_0x41b6('0x39'),'value':_0x2762de!==_0x41b6('0x3a')?_0x2762de:util['format'](_0x41b6('0x3b'),_0x435639)},{'name':_0x41b6('0x34'),'value':_0x435639}]})}})[_0x41b6('0x27')](function(_0x1bba10){logger[_0x41b6('0x9')](_0x41b6('0x3c'));return BPromise['resolve']({'id':_0x1bba10['id'],'name':_0x1bba10['entry_list'][_0x41b6('0x39')][_0x41b6('0x29')],'phone':_0x1bba10['entry_list']['phone_home'][_0x41b6('0x29')]});});}});}function request(_0x2e72ae){logger[_0x41b6('0x3d')]('[HTTP]',JSON['stringify'](_0x2e72ae));return rp(_[_0x41b6('0x3e')](def,_0x2e72ae));}function getTags(_0x4a81f2,_0x1c1da2){var _0xa8ae34=[];if(_0x4a81f2&&_0x4a81f2[_0x41b6('0x1a')]>0x0){_0xa8ae34=_[_0x41b6('0x3f')](_0x4a81f2,_0x1c1da2);}return _0xa8ae34;}function getCustomFields(_0x1d3f2f,_0x5b5599){var _0x29aae8=[];var _0x22103e={'custom_fields':[]};if(_0x1d3f2f[_0x41b6('0x1a')]>0x0){_[_0x41b6('0x1b')](_0x1d3f2f,function(_0x5f0e3b){if(_0x5f0e3b[_0x41b6('0x40')]===_0x41b6('0x41')&&_0x5f0e3b[_0x41b6('0x42')]&&!_0x5f0e3b[_0x41b6('0x43')]){_0x22103e[_0x5f0e3b[_0x41b6('0x42')][_0x41b6('0x44')]()]=_0x5f0e3b[_0x41b6('0x45')]['toString']();}else if(_0x5f0e3b[_0x41b6('0x40')]==='string'&&_0x5f0e3b[_0x41b6('0x46')]&&_0x5f0e3b[_0x41b6('0x43')]){_0x22103e['custom_fields'][_0x41b6('0x47')]({'id':_0x5f0e3b[_0x41b6('0x46')],'value':_0x5f0e3b['content'][_0x41b6('0x21')]()});}else if(_0x5f0e3b[_0x41b6('0x40')]===_0x41b6('0x48')&&_0x5f0e3b[_0x41b6('0x1c')]&&_0x5f0e3b[_0x41b6('0x46')]&&_0x5f0e3b['customField']){_0x5b5599[_0x5f0e3b[_0x41b6('0x1c')]]&&_0x22103e[_0x41b6('0x49')][_0x41b6('0x47')]({'id':_0x5f0e3b['idField'],'value':_0x5b5599[_0x5f0e3b[_0x41b6('0x1c')]][_0x41b6('0x21')]()});}else if(_0x5f0e3b[_0x41b6('0x40')]===_0x41b6('0x4a')&&_0x5f0e3b[_0x41b6('0x4b')]&&_0x5f0e3b[_0x41b6('0x4b')][_0x41b6('0xb')]&&_0x5f0e3b['idField']&&_0x5f0e3b['customField']){_0x5b5599[_0x5f0e3b[_0x41b6('0x4b')]['name']['toLowerCase']()]&&_0x22103e[_0x41b6('0x49')][_0x41b6('0x47')]({'id':_0x5f0e3b[_0x41b6('0x46')],'value':_0x5b5599[_0x5f0e3b[_0x41b6('0x4b')][_0x41b6('0xb')][_0x41b6('0x44')]()]['toString']()});}});}return _0x22103e;}function getConnection(_0x288798){return request({'method':'POST','form':{'method':_0x41b6('0x4c'),'input_type':'JSON','response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'user_auth':{'user_name':_0x288798['username'],'password':_0x288798[_0x41b6('0x4d')],'encryption':_0x41b6('0x4e')},'application':_0x41b6('0x4f')})}})[_0x41b6('0x27')](function(_0x36826d){var _0xa006c=_0x36826d;if(_0xa006c['id']){def[_0x41b6('0x50')]=_0xa006c['id'];return BPromise[_0x41b6('0x2b')](_0xa006c);}else{throw new Error(util[_0x41b6('0x20')](_0x41b6('0x51'),_0x288798['id']));}});}function setRelationship(_0x318910,_0x7d3cfd,_0x372a48,_0xb1a0e6){return request({'form':{'method':_0x41b6('0x52'),'input_type':_0x41b6('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x318910['id'],'module_name':'Calls','module_id':_0x372a48['id'],'link_field_name':_0xb1a0e6,'related_ids':[_0x7d3cfd['id']]})}});}exports[_0x41b6('0x53')]=function(_0x208dd9,_0x1d5dad,_0xfb97ec,_0x195e34,_0x226cda,_0x33438d){var _0x206833,_0xf49f85,_0x1b69e3,_0x4f918c;_0x33438d['remoteUri']=intUtil[_0x41b6('0x54')](_0x33438d[_0x41b6('0x55')]);_0x33438d[_0x41b6('0x56')]=intUtil[_0x41b6('0x54')](_0x33438d[_0x41b6('0x56')]);def[_0x41b6('0x57')]=util[_0x41b6('0x20')](_0x41b6('0x58'),_0x33438d[_0x41b6('0x55')]);if(_0x226cda&&_0x226cda[_0x41b6('0x59')]){logger[_0x41b6('0x9')](_0x41b6('0x5a'),'Recording\x20is\x20enabled!');_0x1d5dad[_0x41b6('0x5b')]=util[_0x41b6('0x20')](_0x41b6('0x5c'),_0x33438d[_0x41b6('0x56')],_0x1d5dad['uniqueid'],md5(_0x1d5dad['uniqueid']));}else{_0x1d5dad[_0x41b6('0x5b')]='';}return getConnection(_0x33438d)['then'](function(_0x5480cc){_0x4f918c=_0x5480cc;return getUser(_0x33438d,_0x195e34[_0x41b6('0xb')],_0x4f918c);})[_0x41b6('0x27')](function(_0xaca824){_0x206833=_0xaca824;logger[_0x41b6('0x9')](_0x41b6('0x5d'),_0x206833['id']);return getEndUser(_0x33438d,_0x1d5dad[_0x41b6('0x5e')],_0x1d5dad['calleridnum'],_0x4f918c);})[_0x41b6('0x27')](function(_0x3b6854){_0xf49f85=_0x3b6854;logger['info'](_0x41b6('0x5f'),_0xf49f85['id']);return getTicket(_0x33438d,_0x206833,_0xf49f85,_0xfb97ec,_0x1d5dad,_0xfb97ec[_0x41b6('0x60')],_0x4f918c,'Inbound');})[_0x41b6('0x27')](function(_0x2222f6){_0x1b69e3=_0x2222f6;logger[_0x41b6('0x9')](_0x41b6('0x61'));logger[_0x41b6('0x9')](_0x41b6('0x62'),_0x1b69e3['id']);return setRelationship(_0x4f918c,_0x206833,_0x1b69e3,_0x41b6('0x63'));})[_0x41b6('0x27')](function(){return setRelationship(_0x4f918c,_0xf49f85,_0x1b69e3,_0x41b6('0x64'));})[_0x41b6('0x27')](function(){return getServerInfo(_0x4f918c);})['then'](function(_0x6220e1){var _0x30427f=parseInt(_0x6220e1[_0x41b6('0x65')][_0x41b6('0x66')](0x0));var _0x1bd4a8=util[_0x41b6('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x33438d[_0x41b6('0x55')],_0x1b69e3['id']);if(_0x30427f>0x6){_0x1bd4a8=util[_0x41b6('0x20')](_0x41b6('0x67'),_0x33438d['remoteUri'],_0x1b69e3['id']);}logger['info'](_0x41b6('0x5a'),_0x41b6('0x68'));emit(util['format']('user:%s',_0x195e34[_0x41b6('0xb')]),'trigger:browser:url',{'uri':_0x1bd4a8});})[_0x41b6('0x69')](function(_0xfe58b4){logger[_0x41b6('0x6a')]('[QUEUE]',JSON[_0x41b6('0x1e')](_0xfe58b4));});};exports[_0x41b6('0x6b')]=function(_0x55fd14,_0x3fe947,_0x522403,_0x29863e,_0x11ae0e,_0x39eeeb,_0x2fe6db){var _0x2a7a85,_0x2740ad,_0x55013b,_0x51ba97;_0x39eeeb[_0x41b6('0x55')]=intUtil['stripTrailingSlash'](_0x39eeeb[_0x41b6('0x55')]);_0x39eeeb[_0x41b6('0x56')]=intUtil[_0x41b6('0x54')](_0x39eeeb[_0x41b6('0x56')]);def['uri']=util['format'](_0x41b6('0x58'),_0x39eeeb[_0x41b6('0x55')]);if(_0x2fe6db&&_0x2fe6db['recordingFormat']&&_0x2fe6db[_0x41b6('0x6c')]!==_0x41b6('0x6d')){logger['info'](_0x41b6('0x6e'),_0x41b6('0x6f'));_0x3fe947[_0x41b6('0x5b')]=util[_0x41b6('0x20')](_0x41b6('0x5c'),_0x39eeeb[_0x41b6('0x56')],_0x3fe947[_0x41b6('0x70')],md5(_0x3fe947['uniqueid']));}return getConnection(_0x39eeeb)[_0x41b6('0x27')](function(_0x2f21b5){_0x51ba97=_0x2f21b5;return getUser(_0x39eeeb,_0x29863e[_0x41b6('0xb')],_0x51ba97);})[_0x41b6('0x27')](function(_0x2c2bf2){_0x2a7a85=_0x2c2bf2;logger['info'](_0x41b6('0x5d'),_0x2a7a85['id']);return getEndUser(_0x39eeeb,_0x3fe947[_0x41b6('0x71')],_0x3fe947[_0x41b6('0x72')],_0x51ba97);})[_0x41b6('0x27')](function(_0x325fba){_0x2740ad=_0x325fba;logger[_0x41b6('0x9')](_0x41b6('0x5f'),_0x2740ad['id']);return getTicket(_0x39eeeb,_0x2a7a85,_0x2740ad,_0x522403,_0x3fe947,_0x522403[_0x41b6('0x60')],_0x51ba97,_0x41b6('0x73'));})[_0x41b6('0x27')](function(_0x139c80){_0x55013b=_0x139c80;logger[_0x41b6('0x9')](_0x41b6('0x61'));logger[_0x41b6('0x9')]('The\x20Ticket\x20ID\x20is:',_0x55013b['id']);return setRelationship(_0x51ba97,_0x2a7a85,_0x55013b,_0x41b6('0x63'));})[_0x41b6('0x27')](function(){return setRelationship(_0x51ba97,_0x2740ad,_0x55013b,'contacts');})[_0x41b6('0x27')](function(){return getServerInfo(_0x51ba97);})[_0x41b6('0x27')](function(_0x36aa49){var _0x4a702f=parseInt(_0x36aa49[_0x41b6('0x65')]['charAt'](0x0));var _0x19441a=util['format'](_0x41b6('0x74'),_0x39eeeb[_0x41b6('0x55')],_0x55013b['id']);if(_0x4a702f>0x6){_0x19441a=util[_0x41b6('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x39eeeb[_0x41b6('0x55')],_0x55013b['id']);}logger['info'](_0x41b6('0x6e'),_0x41b6('0x68'));emit(util['format'](_0x41b6('0x75'),_0x29863e[_0x41b6('0xb')]),_0x41b6('0x76'),{'uri':_0x19441a});})[_0x41b6('0x69')](function(_0x1d3d71){logger[_0x41b6('0x6a')]('[OUTBOUND]',JSON['stringify'](_0x1d3d71));});};exports[_0x41b6('0x77')]=function(_0x5ad34e,_0x4c866f,_0x10ca1b,_0x154369,_0x4c5a0f,_0x224e20){var _0x45f71d,_0x1d8d47,_0x43a714,_0x1a6d0a;_0x224e20['remoteUri']=intUtil['stripTrailingSlash'](_0x224e20[_0x41b6('0x55')]);_0x224e20[_0x41b6('0x56')]=intUtil[_0x41b6('0x54')](_0x224e20[_0x41b6('0x56')]);def['uri']=util['format'](_0x41b6('0x58'),_0x224e20[_0x41b6('0x55')]);if(_0x4c5a0f&&_0x4c5a0f[_0x41b6('0x59')]){logger[_0x41b6('0x9')]('['+_0x4c866f['lastevent']['toUpperCase']()+']',_0x41b6('0x6f'));_0x4c866f[_0x41b6('0x5b')]=util[_0x41b6('0x20')](_0x41b6('0x5c'),_0x224e20[_0x41b6('0x56')],_0x4c866f['uniqueid'],md5(_0x4c866f[_0x41b6('0x70')]));}else{_0x4c866f['recordingURL']='';}return getConnection(_0x224e20)[_0x41b6('0x27')](function(_0x16cfbf){_0x1a6d0a=_0x16cfbf;if(!_[_0x41b6('0x23')](_0x154369)){return getUser(_0x224e20,_0x154369['name'],_0x1a6d0a);}else{return getUser(_0x224e20,null,_0x1a6d0a);}})['then'](function(_0x18dfd3){_0x45f71d=_0x18dfd3;logger['info'](_0x41b6('0x5d'),_0x45f71d['id']);return getEndUser(_0x224e20,_0x4c866f[_0x41b6('0x5e')],_0x4c866f['calleridnum'],_0x1a6d0a);})[_0x41b6('0x27')](function(_0x3d213a){_0x1d8d47=_0x3d213a;logger[_0x41b6('0x9')](_0x41b6('0x5f'),_0x1d8d47['id']);return getTicket(_0x224e20,_0x45f71d,_0x1d8d47,_0x10ca1b,_0x4c866f,_0x10ca1b['Fields'],_0x1a6d0a,_0x41b6('0x78'));})[_0x41b6('0x27')](function(_0x26fc9c){_0x43a714=_0x26fc9c;logger[_0x41b6('0x9')](_0x41b6('0x61'));logger[_0x41b6('0x9')](_0x41b6('0x62'),_0x43a714['id']);return setRelationship(_0x1a6d0a,_0x45f71d,_0x43a714,'users');})[_0x41b6('0x27')](function(){return setRelationship(_0x1a6d0a,_0x1d8d47,_0x43a714,_0x41b6('0x64'));})[_0x41b6('0x27')](function(){return getServerInfo(_0x1a6d0a);})['catch'](function(_0x11858){logger['error']('['+_0x4c866f[_0x41b6('0x79')][_0x41b6('0x7a')]()+']',JSON[_0x41b6('0x1e')](_0x11858));});}; \ No newline at end of file +var _0x0760=['content','type','custom_fields','toString','variable','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','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:','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stripTrailingSlash','recordingFormat','none','destcalleridname','The\x20Enduser\x20ID\x20is:','Outbound','unmanaged','toUpperCase','isNil','calleridname','lastevent','lodash','bluebird','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','duration_hours','duration_minutes','parent_type','parent_name','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','forEach','nameField','customField','toLowerCase'];(function(_0x4aba0e,_0x3cca89){var _0x240301=function(_0x376410){while(--_0x376410){_0x4aba0e['push'](_0x4aba0e['shift']());}};_0x240301(++_0x3cca89);}(_0x0760,0xa9));var _0x0076=function(_0x8e259d,_0x55483e){_0x8e259d=_0x8e259d-0x0;var _0x466d6c=_0x0760[_0x8e259d];return _0x466d6c;};'use strict';var _=require(_0x0076('0x0'));var rp=require('request-promise');var BPromise=require(_0x0076('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0076('0x2'));var config=require(_0x0076('0x3'));var logger=require(_0x0076('0x4'))(_0x0076('0x5'));config[_0x0076('0x6')]=_['defaults'](config[_0x0076('0x6')],{'host':_0x0076('0x7'),'port':0x18eb});var io=require(_0x0076('0x8'))(new Redis(config[_0x0076('0x6')]));var def={'method':_0x0076('0x9'),'json':!![]};function emit(_0x5b4c91,_0x411b4b,_0x59ba96){io['to'](_0x5b4c91)[_0x0076('0xa')](_0x411b4b,_0x59ba96);}function getTicket(_0x31ad28,_0x5a5111,_0x359346,_0x907528,_0xaae553,_0xce7b7e,_0x83a68a,_0x2c2cea){logger['info'](_0x0076('0xb'));var _0x44eb53=new Date();var _0x43d174=[{'name':_0x0076('0xc'),'value':intUtil[_0x0076('0xd')](_0x907528[_0x0076('0xe')],_0xaae553,'\x20')},{'name':_0x0076('0xf'),'value':_0x5a5111['id']},{'name':_0x0076('0x10'),'value':_0x5a5111['id']},{'name':_0x0076('0x11'),'value':intUtil[_0x0076('0xd')](_0x907528[_0x0076('0x12')],_0xaae553,'\x0a')},{'name':'date_start','value':_0x44eb53[_0x0076('0x13')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x0076('0x14'),'value':'0'},{'name':_0x0076('0x15'),'value':'15'},{'name':'parent_id','value':_0x359346['id']},{'name':_0x0076('0x16'),'value':'Contacts'},{'name':_0x0076('0x17'),'value':_0x359346[_0x0076('0xc')]},{'name':'direction','value':_0x2c2cea}];if(_0xce7b7e['length']){_['forEach'](_0xce7b7e,function(_0xc0a663){if(_0xaae553[_0xc0a663[_0x0076('0x18')]]){_0x43d174[_0x0076('0x19')]({'name':_0xc0a663[_0x0076('0x1a')],'value':_0xaae553[_0xc0a663[_0x0076('0x18')]]});}});}return request({'form':{'method':_0x0076('0x1b'),'input_type':_0x0076('0x1c'),'response_type':_0x0076('0x1c'),'rest_data':JSON[_0x0076('0x1d')]({'session':_0x83a68a['id'],'module_name':_0x0076('0x1e'),'name_value_list':_0x43d174})}});}function getAuth(_0x274c52){return util[_0x0076('0x1f')](_0x0076('0x20'),new Buffer(_0x274c52[_0x0076('0x21')]+':X')['toString'](_0x0076('0x22')));}function getServerInfo(_0x2a5619){return request({'form':{'method':_0x0076('0x23'),'input_type':'JSON','response_type':_0x0076('0x1c'),'rest_data':JSON[_0x0076('0x1d')]({'session':_0x2a5619['id']})}});}function getUser(_0x2dd436,_0x39bb13,_0x250f57){if(!_['isNil'](_0x39bb13)){logger[_0x0076('0x24')](_0x0076('0x25'),_0x39bb13);return request({'form':{'method':_0x0076('0x26'),'input_type':_0x0076('0x1c'),'response_type':_0x0076('0x1c'),'rest_data':JSON[_0x0076('0x1d')]({'session':_0x250f57['id'],'module_name':'Employees','query':util[_0x0076('0x1f')](_0x0076('0x27'),_0x39bb13),'order_by':'','offset':'0','select_fields':['id',_0x0076('0xc'),_0x0076('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0076('0x29')](function(_0x5203a6){if(_0x5203a6[_0x0076('0x2a')][_0x0076('0x2b')]){var _0x1a8809=_[_0x0076('0x2c')](_0x5203a6[_0x0076('0x2a')],function(_0xd4009d){return _0xd4009d[_0x0076('0x2d')][_0x0076('0x28')][_0x0076('0x2e')]===_0x39bb13;});if(_0x1a8809){logger[_0x0076('0x24')]('Agent\x20found!');return BPromise[_0x0076('0x2f')]({'id':_0x1a8809[_0x0076('0x2d')]['id'][_0x0076('0x2e')],'name':_0x1a8809[_0x0076('0x2d')][_0x0076('0xc')]['value']});}}logger['info'](_0x0076('0x30'));return BPromise[_0x0076('0x2f')]({'id':_0x250f57[_0x0076('0x2d')][_0x0076('0x31')]['value'],'name':_0x250f57['name_value_list'][_0x0076('0x28')][_0x0076('0x2e')]});});}else{logger[_0x0076('0x24')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0076('0x2f')]({'id':_0x250f57[_0x0076('0x2d')][_0x0076('0x31')][_0x0076('0x2e')],'name':_0x250f57[_0x0076('0x2d')][_0x0076('0x28')][_0x0076('0x2e')]});}}function getEndUser(_0x700113,_0x15cdc8,_0x1dc13a,_0x393107){logger['info'](_0x0076('0x32'),_0x1dc13a);return request({'form':{'method':_0x0076('0x26'),'input_type':_0x0076('0x1c'),'response_type':_0x0076('0x1c'),'rest_data':JSON[_0x0076('0x1d')]({'session':_0x393107['id'],'module_name':_0x0076('0x33'),'query':util[_0x0076('0x1f')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x1dc13a),'order_by':'','offset':'0','select_fields':['id',_0x0076('0xc'),_0x0076('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0076('0x29')](function(_0x2c8958){if(_0x2c8958['entry_list'][_0x0076('0x2b')]){var _0x54aeb8=_[_0x0076('0x2c')](_0x2c8958[_0x0076('0x2a')],function(_0x4017e2){return _0x4017e2[_0x0076('0x2d')][_0x0076('0x34')][_0x0076('0x2e')]===_0x1dc13a;});if(_0x54aeb8){logger[_0x0076('0x24')](_0x0076('0x35'));return BPromise[_0x0076('0x2f')]({'id':_0x54aeb8[_0x0076('0x2d')]['id'][_0x0076('0x2e')],'name':_0x54aeb8[_0x0076('0x2d')][_0x0076('0xc')]['value'],'phone':_0x54aeb8[_0x0076('0x2d')][_0x0076('0x34')][_0x0076('0x2e')]});}}else{logger[_0x0076('0x24')](_0x0076('0x36'));return request({'form':{'method':_0x0076('0x1b'),'input_type':'JSON','response_type':_0x0076('0x1c'),'rest_data':JSON['stringify']({'session':_0x393107['id'],'module_name':_0x0076('0x33'),'name_value_list':[{'name':'first_name','value':_0x15cdc8!==_0x0076('0x37')?_0x15cdc8:util[_0x0076('0x1f')](_0x0076('0x38'),_0x1dc13a)},{'name':'phone_home','value':_0x1dc13a}]})}})[_0x0076('0x29')](function(_0x3868a4){logger['info'](_0x0076('0x39'));return BPromise[_0x0076('0x2f')]({'id':_0x3868a4['id'],'name':_0x3868a4[_0x0076('0x2a')][_0x0076('0x3a')][_0x0076('0x2e')],'phone':_0x3868a4[_0x0076('0x2a')][_0x0076('0x34')][_0x0076('0x2e')]});});}});}function request(_0x157d6f){logger[_0x0076('0x3b')](_0x0076('0x3c'),JSON[_0x0076('0x1d')](_0x157d6f));return rp(_[_0x0076('0x3d')](def,_0x157d6f));}function getTags(_0x311044,_0x2cd20b){var _0x547220=[];if(_0x311044&&_0x311044[_0x0076('0x2b')]>0x0){_0x547220=_[_0x0076('0x3e')](_0x311044,_0x2cd20b);}return _0x547220;}function getCustomFields(_0x4607ad,_0xe138e1){var _0x4d4a42=[];var _0x16200d={'custom_fields':[]};if(_0x4607ad[_0x0076('0x2b')]>0x0){_[_0x0076('0x3f')](_0x4607ad,function(_0x3accc0){if(_0x3accc0['type']==='string'&&_0x3accc0[_0x0076('0x40')]&&!_0x3accc0[_0x0076('0x41')]){_0x16200d[_0x3accc0['nameField'][_0x0076('0x42')]()]=_0x3accc0[_0x0076('0x43')]['toString']();}else if(_0x3accc0[_0x0076('0x44')]==='string'&&_0x3accc0[_0x0076('0x1a')]&&_0x3accc0[_0x0076('0x41')]){_0x16200d[_0x0076('0x45')][_0x0076('0x19')]({'id':_0x3accc0[_0x0076('0x1a')],'value':_0x3accc0['content'][_0x0076('0x46')]()});}else if(_0x3accc0[_0x0076('0x44')]===_0x0076('0x47')&&_0x3accc0[_0x0076('0x18')]&&_0x3accc0[_0x0076('0x1a')]&&_0x3accc0[_0x0076('0x41')]){_0xe138e1[_0x3accc0['variableName']]&&_0x16200d[_0x0076('0x45')]['push']({'id':_0x3accc0[_0x0076('0x1a')],'value':_0xe138e1[_0x3accc0['variableName']][_0x0076('0x46')]()});}else if(_0x3accc0[_0x0076('0x44')]===_0x0076('0x48')&&_0x3accc0['Variable']&&_0x3accc0[_0x0076('0x49')][_0x0076('0xc')]&&_0x3accc0[_0x0076('0x1a')]&&_0x3accc0['customField']){_0xe138e1[_0x3accc0[_0x0076('0x49')][_0x0076('0xc')]['toLowerCase']()]&&_0x16200d[_0x0076('0x45')][_0x0076('0x19')]({'id':_0x3accc0[_0x0076('0x1a')],'value':_0xe138e1[_0x3accc0[_0x0076('0x49')]['name'][_0x0076('0x42')]()][_0x0076('0x46')]()});}});}return _0x16200d;}function getConnection(_0x1ddb2a){return request({'method':_0x0076('0x9'),'form':{'method':_0x0076('0x4a'),'input_type':_0x0076('0x1c'),'response_type':'JSON','rest_data':JSON[_0x0076('0x1d')]({'user_auth':{'user_name':_0x1ddb2a[_0x0076('0x4b')],'password':_0x1ddb2a['password'],'encryption':_0x0076('0x4c')},'application':_0x0076('0x4d')})}})[_0x0076('0x29')](function(_0x28166b){var _0x526a1d=_0x28166b;if(_0x526a1d['id']){def[_0x0076('0x4e')]=_0x526a1d['id'];return BPromise[_0x0076('0x2f')](_0x526a1d);}else{throw new Error(util[_0x0076('0x1f')](_0x0076('0x4f'),_0x1ddb2a['id']));}});}function setRelationship(_0x45b7de,_0xd2306d,_0x164fdb,_0x110a7d){return request({'form':{'method':_0x0076('0x50'),'input_type':'JSON','response_type':_0x0076('0x1c'),'rest_data':JSON['stringify']({'session':_0x45b7de['id'],'module_name':_0x0076('0x1e'),'module_id':_0x164fdb['id'],'link_field_name':_0x110a7d,'related_ids':[_0xd2306d['id']]})}});}exports[_0x0076('0x51')]=function(_0x9482c7,_0xacf00d,_0x202f43,_0x306c9f,_0x473377,_0x714a4a){var _0xa26669,_0x104110,_0x2b2e5d,_0x4d4349;_0x714a4a[_0x0076('0x52')]=intUtil['stripTrailingSlash'](_0x714a4a['remoteUri']);_0x714a4a[_0x0076('0x53')]=intUtil['stripTrailingSlash'](_0x714a4a[_0x0076('0x53')]);def['uri']=util['format'](_0x0076('0x54'),_0x714a4a[_0x0076('0x52')]);if(_0x473377&&_0x473377[_0x0076('0x55')]){logger[_0x0076('0x24')](_0x0076('0x56'),_0x0076('0x57'));_0xacf00d[_0x0076('0x58')]=util['format'](_0x0076('0x59'),_0x714a4a[_0x0076('0x53')],_0xacf00d[_0x0076('0x5a')],md5(_0xacf00d['uniqueid']));}else{_0xacf00d[_0x0076('0x58')]='';}return getConnection(_0x714a4a)[_0x0076('0x29')](function(_0x50ef97){_0x4d4349=_0x50ef97;return getUser(_0x714a4a,_0x306c9f[_0x0076('0xc')],_0x4d4349);})[_0x0076('0x29')](function(_0x320898){_0xa26669=_0x320898;logger[_0x0076('0x24')](_0x0076('0x5b'),_0xa26669['id']);return getEndUser(_0x714a4a,_0xacf00d['calleridname'],_0xacf00d[_0x0076('0x5c')],_0x4d4349);})[_0x0076('0x29')](function(_0x2d4e35){_0x104110=_0x2d4e35;logger['info']('The\x20Enduser\x20ID\x20is:',_0x104110['id']);return getTicket(_0x714a4a,_0xa26669,_0x104110,_0x202f43,_0xacf00d,_0x202f43[_0x0076('0x5d')],_0x4d4349,_0x0076('0x5e'));})[_0x0076('0x29')](function(_0x2ad2f8){_0x2b2e5d=_0x2ad2f8;logger[_0x0076('0x24')](_0x0076('0x5f'));logger[_0x0076('0x24')](_0x0076('0x60'),_0x2b2e5d['id']);return setRelationship(_0x4d4349,_0xa26669,_0x2b2e5d,_0x0076('0x61'));})[_0x0076('0x29')](function(){return setRelationship(_0x4d4349,_0x104110,_0x2b2e5d,_0x0076('0x62'));})[_0x0076('0x29')](function(){return getServerInfo(_0x4d4349);})[_0x0076('0x29')](function(_0xc635ae){var _0x136880=parseInt(_0xc635ae[_0x0076('0x63')][_0x0076('0x64')](0x0));var _0x344b13=util[_0x0076('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x714a4a[_0x0076('0x52')],_0x2b2e5d['id']);if(_0x136880>0x6){_0x344b13=util[_0x0076('0x1f')](_0x0076('0x65'),_0x714a4a[_0x0076('0x52')],_0x2b2e5d['id']);}logger[_0x0076('0x24')](_0x0076('0x56'),_0x0076('0x66'));emit(util[_0x0076('0x1f')](_0x0076('0x67'),_0x306c9f[_0x0076('0xc')]),_0x0076('0x68'),{'uri':_0x344b13});})[_0x0076('0x69')](function(_0x1d6a60){logger[_0x0076('0x6a')]('[QUEUE]',JSON[_0x0076('0x1d')](_0x1d6a60));});};exports['outbound']=function(_0x3e170d,_0x3bac5e,_0xfec195,_0x44568d,_0x4482ce,_0x427983,_0x58962b){var _0x29ce5e,_0x4fb915,_0x3b2935,_0xbedd7a;_0x427983[_0x0076('0x52')]=intUtil[_0x0076('0x6b')](_0x427983[_0x0076('0x52')]);_0x427983['serverUrl']=intUtil[_0x0076('0x6b')](_0x427983[_0x0076('0x53')]);def['uri']=util[_0x0076('0x1f')](_0x0076('0x54'),_0x427983['remoteUri']);if(_0x58962b&&_0x58962b[_0x0076('0x6c')]&&_0x58962b[_0x0076('0x6c')]!==_0x0076('0x6d')){logger[_0x0076('0x24')]('[OUTBOUND]',_0x0076('0x57'));_0x3bac5e[_0x0076('0x58')]=util['format'](_0x0076('0x59'),_0x427983['serverUrl'],_0x3bac5e[_0x0076('0x5a')],md5(_0x3bac5e['uniqueid']));}return getConnection(_0x427983)['then'](function(_0x434046){_0xbedd7a=_0x434046;return getUser(_0x427983,_0x44568d[_0x0076('0xc')],_0xbedd7a);})[_0x0076('0x29')](function(_0x25733f){_0x29ce5e=_0x25733f;logger[_0x0076('0x24')]('The\x20User\x20ID\x20is:',_0x29ce5e['id']);return getEndUser(_0x427983,_0x3bac5e[_0x0076('0x6e')],_0x3bac5e['destcalleridnum'],_0xbedd7a);})[_0x0076('0x29')](function(_0x1a85f5){_0x4fb915=_0x1a85f5;logger['info'](_0x0076('0x6f'),_0x4fb915['id']);return getTicket(_0x427983,_0x29ce5e,_0x4fb915,_0xfec195,_0x3bac5e,_0xfec195[_0x0076('0x5d')],_0xbedd7a,_0x0076('0x70'));})[_0x0076('0x29')](function(_0x25e733){_0x3b2935=_0x25e733;logger[_0x0076('0x24')](_0x0076('0x5f'));logger[_0x0076('0x24')](_0x0076('0x60'),_0x3b2935['id']);return setRelationship(_0xbedd7a,_0x29ce5e,_0x3b2935,_0x0076('0x61'));})[_0x0076('0x29')](function(){return setRelationship(_0xbedd7a,_0x4fb915,_0x3b2935,_0x0076('0x62'));})[_0x0076('0x29')](function(){return getServerInfo(_0xbedd7a);})[_0x0076('0x29')](function(_0x4d17d6){var _0x46628c=parseInt(_0x4d17d6[_0x0076('0x63')][_0x0076('0x64')](0x0));var _0x371b21=util[_0x0076('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x427983['remoteUri'],_0x3b2935['id']);if(_0x46628c>0x6){_0x371b21=util[_0x0076('0x1f')](_0x0076('0x65'),_0x427983['remoteUri'],_0x3b2935['id']);}logger[_0x0076('0x24')]('[OUTBOUND]',_0x0076('0x66'));emit(util[_0x0076('0x1f')](_0x0076('0x67'),_0x44568d[_0x0076('0xc')]),_0x0076('0x68'),{'uri':_0x371b21});})[_0x0076('0x69')](function(_0x2b42d0){logger[_0x0076('0x6a')]('[OUTBOUND]',JSON['stringify'](_0x2b42d0));});};exports[_0x0076('0x71')]=function(_0x5d99d0,_0x1e356e,_0xeda4ec,_0x2e4a2d,_0x109bd5,_0x32ddfb){var _0x2c600e,_0x4e2f7e,_0x3bbb87,_0x2c618b;_0x32ddfb['remoteUri']=intUtil[_0x0076('0x6b')](_0x32ddfb[_0x0076('0x52')]);_0x32ddfb['serverUrl']=intUtil[_0x0076('0x6b')](_0x32ddfb[_0x0076('0x53')]);def['uri']=util[_0x0076('0x1f')](_0x0076('0x54'),_0x32ddfb[_0x0076('0x52')]);if(_0x109bd5&&_0x109bd5[_0x0076('0x55')]){logger[_0x0076('0x24')]('['+_0x1e356e['lastevent'][_0x0076('0x72')]()+']','Recording\x20is\x20enabled!');_0x1e356e[_0x0076('0x58')]=util[_0x0076('0x1f')](_0x0076('0x59'),_0x32ddfb[_0x0076('0x53')],_0x1e356e[_0x0076('0x5a')],md5(_0x1e356e['uniqueid']));}else{_0x1e356e['recordingURL']='';}return getConnection(_0x32ddfb)[_0x0076('0x29')](function(_0x442972){_0x2c618b=_0x442972;if(!_[_0x0076('0x73')](_0x2e4a2d)){return getUser(_0x32ddfb,_0x2e4a2d[_0x0076('0xc')],_0x2c618b);}else{return getUser(_0x32ddfb,null,_0x2c618b);}})[_0x0076('0x29')](function(_0x1599b7){_0x2c600e=_0x1599b7;logger['info']('The\x20User\x20ID\x20is:',_0x2c600e['id']);return getEndUser(_0x32ddfb,_0x1e356e[_0x0076('0x74')],_0x1e356e[_0x0076('0x5c')],_0x2c618b);})['then'](function(_0x1572b7){_0x4e2f7e=_0x1572b7;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4e2f7e['id']);return getTicket(_0x32ddfb,_0x2c600e,_0x4e2f7e,_0xeda4ec,_0x1e356e,_0xeda4ec[_0x0076('0x5d')],_0x2c618b,'Inbound');})[_0x0076('0x29')](function(_0x4ad13d){_0x3bbb87=_0x4ad13d;logger[_0x0076('0x24')](_0x0076('0x5f'));logger['info'](_0x0076('0x60'),_0x3bbb87['id']);return setRelationship(_0x2c618b,_0x2c600e,_0x3bbb87,_0x0076('0x61'));})[_0x0076('0x29')](function(){return setRelationship(_0x2c618b,_0x4e2f7e,_0x3bbb87,'contacts');})[_0x0076('0x29')](function(){return getServerInfo(_0x2c618b);})[_0x0076('0x69')](function(_0x476e49){logger[_0x0076('0x6a')]('['+_0x1e356e[_0x0076('0x75')][_0x0076('0x72')]()+']',JSON[_0x0076('0x1d')](_0x476e49));});}; \ 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 e18eb35..643215c 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 _0x06b6=['variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','slice','lastIndexOf','validateEmail','test','util','getString','length','sortBy','string','push','type'];(function(_0x51176b,_0x1e37c9){var _0x9bca44=function(_0x112f56){while(--_0x112f56){_0x51176b['push'](_0x51176b['shift']());}};_0x9bca44(++_0x1e37c9);}(_0x06b6,0x1c1));var _0x606b=function(_0xcaf6e3,_0x114666){_0xcaf6e3=_0xcaf6e3-0x0;var _0x340c20=_0x06b6[_0xcaf6e3];return _0x340c20;};'use strict';var _=require('lodash');var util=require(_0x606b('0x0'));exports[_0x606b('0x1')]=function(_0x399b56,_0x259d28,_0x30a20d){var _0x1a5237=[];if(_0x399b56[_0x606b('0x2')]>0x0){var _0x46951c=_[_0x606b('0x3')](_0x399b56,['id']);for(var _0x31eede=0x0;_0x31eede<_0x46951c[_0x606b('0x2')];_0x31eede++){var _0x544974=_0x46951c[_0x31eede];if(_0x544974['type']===_0x606b('0x4')){_0x1a5237[_0x606b('0x5')](_0x544974['content']);}else if(_0x544974[_0x606b('0x6')]===_0x606b('0x7')&&_0x544974['variableName']){_0x259d28[_0x544974[_0x606b('0x8')]]&&_0x1a5237[_0x606b('0x5')](_0x259d28[_0x544974[_0x606b('0x8')]][_0x606b('0x9')]());}else if(_0x544974[_0x606b('0x6')]===_0x606b('0xa')&&_0x544974['Variable']&&_0x544974['Variable']['name']){_0x259d28[_0x544974[_0x606b('0xb')][_0x606b('0xc')][_0x606b('0xd')]()]&&_0x1a5237['push'](_0x259d28[_0x544974[_0x606b('0xb')][_0x606b('0xc')]['toLowerCase']()][_0x606b('0x9')]());}else if(_0x544974['type']===_0x606b('0xe')){if(_0x544974[_0x606b('0xf')]==='string'&&_0x544974['key']){_0x1a5237[_0x606b('0x5')](util[_0x606b('0x10')](_0x606b('0x11'),_0x544974[_0x606b('0x12')],_0x544974[_0x606b('0x13')]));}else if(_0x544974['keyType']===_0x606b('0x7')&&_0x544974[_0x606b('0x8')]&&_0x544974['key']){_0x259d28[_0x544974['variableName']]&&_0x1a5237[_0x606b('0x5')](util['format']('%s:\x20%s',_0x544974[_0x606b('0x12')],_0x259d28[_0x544974[_0x606b('0x8')]]));}else if(_0x544974[_0x606b('0xf')]===_0x606b('0xa')&&_0x544974[_0x606b('0xb')]&&_0x544974[_0x606b('0xb')][_0x606b('0xc')]&&_0x544974[_0x606b('0x12')]){_0x259d28[_0x544974[_0x606b('0xb')][_0x606b('0xc')]['toLowerCase']()]&&_0x1a5237['push'](util[_0x606b('0x10')](_0x606b('0x11'),_0x544974['key'],_0x259d28[_0x544974[_0x606b('0xb')][_0x606b('0xc')]['toLowerCase']()]));}}}}return _0x1a5237['join'](_0x30a20d);};exports['stripTrailingSlash']=function(_0x15221e){var _0x599c2c=_0x15221e[_0x606b('0x14')](-0x1);if(_0x599c2c==='/'){_0x15221e=_0x15221e['substring'](0x0,_0x15221e[_0x606b('0x15')](_0x599c2c));}return _0x15221e;};exports[_0x606b('0x16')]=function(_0x5744fb){if(!_['isNil'](_0x5744fb)&&_0x5744fb!==''){var _0xa370ad=/^(([^<>()\[\]\\.,;:\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 _0xa370ad[_0x606b('0x17')](String(_0x5744fb)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xf4e0=['sortBy','type','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf4e0,0x1d8));var _0x0f4e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf4e0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x0f4e('0x0'));var util=require(_0x0f4e('0x1'));exports[_0x0f4e('0x2')]=function(_0x52d6b6,_0x3492b6,_0x37210e){var _0x36e21a=[];if(_0x52d6b6[_0x0f4e('0x3')]>0x0){var _0x52bf4a=_[_0x0f4e('0x4')](_0x52d6b6,['id']);for(var _0x1a3085=0x0;_0x1a3085<_0x52bf4a[_0x0f4e('0x3')];_0x1a3085++){var _0x11f12d=_0x52bf4a[_0x1a3085];if(_0x11f12d[_0x0f4e('0x5')]==='string'){_0x36e21a[_0x0f4e('0x6')](_0x11f12d[_0x0f4e('0x7')]);}else if(_0x11f12d[_0x0f4e('0x5')]==='variable'&&_0x11f12d[_0x0f4e('0x8')]){_0x3492b6[_0x11f12d[_0x0f4e('0x8')]]&&_0x36e21a[_0x0f4e('0x6')](_0x3492b6[_0x11f12d[_0x0f4e('0x8')]][_0x0f4e('0x9')]());}else if(_0x11f12d['type']===_0x0f4e('0xa')&&_0x11f12d[_0x0f4e('0xb')]&&_0x11f12d[_0x0f4e('0xb')][_0x0f4e('0xc')]){_0x3492b6[_0x11f12d[_0x0f4e('0xb')][_0x0f4e('0xc')][_0x0f4e('0xd')]()]&&_0x36e21a[_0x0f4e('0x6')](_0x3492b6[_0x11f12d['Variable']['name'][_0x0f4e('0xd')]()]['toString']());}else if(_0x11f12d['type']===_0x0f4e('0xe')){if(_0x11f12d[_0x0f4e('0xf')]==='string'&&_0x11f12d[_0x0f4e('0x10')]){_0x36e21a[_0x0f4e('0x6')](util[_0x0f4e('0x11')](_0x0f4e('0x12'),_0x11f12d[_0x0f4e('0x10')],_0x11f12d[_0x0f4e('0x13')]));}else if(_0x11f12d[_0x0f4e('0xf')]===_0x0f4e('0x14')&&_0x11f12d[_0x0f4e('0x8')]&&_0x11f12d[_0x0f4e('0x10')]){_0x3492b6[_0x11f12d[_0x0f4e('0x8')]]&&_0x36e21a[_0x0f4e('0x6')](util[_0x0f4e('0x11')](_0x0f4e('0x12'),_0x11f12d['key'],_0x3492b6[_0x11f12d[_0x0f4e('0x8')]]));}else if(_0x11f12d[_0x0f4e('0xf')]===_0x0f4e('0xa')&&_0x11f12d[_0x0f4e('0xb')]&&_0x11f12d[_0x0f4e('0xb')][_0x0f4e('0xc')]&&_0x11f12d[_0x0f4e('0x10')]){_0x3492b6[_0x11f12d[_0x0f4e('0xb')][_0x0f4e('0xc')][_0x0f4e('0xd')]()]&&_0x36e21a[_0x0f4e('0x6')](util[_0x0f4e('0x11')](_0x0f4e('0x12'),_0x11f12d[_0x0f4e('0x10')],_0x3492b6[_0x11f12d[_0x0f4e('0xb')][_0x0f4e('0xc')]['toLowerCase']()]));}}}}return _0x36e21a['join'](_0x37210e);};exports[_0x0f4e('0x15')]=function(_0x253229){var _0x30e454=_0x253229[_0x0f4e('0x16')](-0x1);if(_0x30e454==='/'){_0x253229=_0x253229[_0x0f4e('0x17')](0x0,_0x253229[_0x0f4e('0x18')](_0x30e454));}return _0x253229;};exports[_0x0f4e('0x19')]=function(_0x2e7d6a){if(!_[_0x0f4e('0x1a')](_0x2e7d6a)&&_0x2e7d6a!==''){var _0x4348df=/^(([^<>()\[\]\\.,;:\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 _0x4348df[_0x0f4e('0x1b')](String(_0x2e7d6a)[_0x0f4e('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 0268aa7..5e16f60 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 _0xc6a1=['serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','split','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','vTiger','redis','defaults','localhost','emit','length','forEach','type','string','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','getString','Subjects','Descriptions','POST','format','create','HelpDesk','stringify','then','success','resolve','result','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','%s/webservice.php','remoteUri','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','catch','Searching\x20end\x20user\x20with\x20phone','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','sessionName','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','GET','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x46af0e,_0x19bdc2){var _0x43b968=function(_0x97fc28){while(--_0x97fc28){_0x46af0e['push'](_0x46af0e['shift']());}};_0x43b968(++_0x19bdc2);}(_0xc6a1,0x15b));var _0x1c6a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc6a1[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var rp=require(_0x1c6a('0x0'));var BPromise=require(_0x1c6a('0x1'));var md5=require(_0x1c6a('0x2'));var util=require(_0x1c6a('0x3'));var Redis=require(_0x1c6a('0x4'));var intUtil=require(_0x1c6a('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x1c6a('0x6'));config[_0x1c6a('0x7')]=_[_0x1c6a('0x8')](config[_0x1c6a('0x7')],{'host':_0x1c6a('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x36a66a,_0x27f69f,_0x2dca0e){io['to'](_0x36a66a)[_0x1c6a('0xa')](_0x27f69f,_0x2dca0e);}function getCustomFields(_0x6afa8c,_0x54cf5c){var _0x45b06a={};if(_0x6afa8c[_0x1c6a('0xb')]>0x0){_[_0x1c6a('0xc')](_0x6afa8c,function(_0x5dbc80){if(_0x5dbc80[_0x1c6a('0xd')]===_0x1c6a('0xe')&&_0x5dbc80['idField']){_0x45b06a[_0x5dbc80['idField']]=_0x5dbc80[_0x1c6a('0xf')][_0x1c6a('0x10')]();}else if(_0x5dbc80['type']===_0x1c6a('0x11')&&_0x5dbc80[_0x1c6a('0x12')]&&_0x5dbc80[_0x1c6a('0x13')]&&_0x54cf5c[_0x5dbc80[_0x1c6a('0x12')]]){_0x45b06a[_0x5dbc80['idField']]=_0x54cf5c[_0x5dbc80[_0x1c6a('0x12')]][_0x1c6a('0x10')]();}else if(_0x5dbc80[_0x1c6a('0xd')]===_0x1c6a('0x14')&&_0x5dbc80[_0x1c6a('0x15')]&&_0x5dbc80[_0x1c6a('0x15')][_0x1c6a('0x16')]&&_0x5dbc80[_0x1c6a('0x13')]&&_0x54cf5c[_0x5dbc80[_0x1c6a('0x15')][_0x1c6a('0x16')][_0x1c6a('0x17')]()]){_0x45b06a[_0x5dbc80[_0x1c6a('0x13')]]=_0x54cf5c[_0x5dbc80[_0x1c6a('0x15')][_0x1c6a('0x16')][_0x1c6a('0x17')]()][_0x1c6a('0x10')]();}});}return _0x45b06a;}function createTicket(_0x13ed26,_0x28c7f1,_0xc0d23a,_0x3983e7,_0x479731,_0x8fa345,_0x27ce5e){logger[_0x1c6a('0x18')](_0x1c6a('0x19'));var _0x554fdb=_[_0x1c6a('0x1a')]({'parent_id':'','assigned_user_id':_0x28c7f1['id'],'ticketpriorities':'Normal','ticketstatus':_0x1c6a('0x1b'),'ticket_title':intUtil[_0x1c6a('0x1c')](_0x3983e7[_0x1c6a('0x1d')],_0x479731,'\x20'),'description':intUtil[_0x1c6a('0x1c')](_0x3983e7[_0x1c6a('0x1e')],_0x479731,'\x0a'),'contact_id':_0xc0d23a['id']},getCustomFields(_0x8fa345,_0x479731));var _0x4c8506={'method':_0x1c6a('0x1f'),'uri':util[_0x1c6a('0x20')]('%s/webservice.php',_0x13ed26['remoteUri']),'form':{'operation':_0x1c6a('0x21'),'username':_0x13ed26['username'],'sessionName':_0x27ce5e['sessionName'],'elementType':_0x1c6a('0x22'),'element':JSON[_0x1c6a('0x23')](_0x554fdb)},'json':!![]};return request(_0x4c8506)[_0x1c6a('0x24')](function(_0x5e5ab9){if(_0x5e5ab9[_0x1c6a('0x25')]){return BPromise[_0x1c6a('0x26')]({'id':_0x5e5ab9[_0x1c6a('0x27')]['id']});}else{throw new Error(util[_0x1c6a('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x1c6a('0x23')](_0x5e5ab9['error'])));}})['catch'](function(_0xc4ce63){var _0xc09054=_0xc4ce63[_0x1c6a('0x28')]||0x1f4;logger[_0x1c6a('0x29')](_0x1c6a('0x2a'),_0x1c6a('0x2b'),_0xc09054,JSON[_0x1c6a('0x23')](_0xc4ce63));});}function getUser(_0x37b7b8,_0x47b878,_0x400c02){if(intUtil[_0x1c6a('0x2c')](_0x47b878)){logger[_0x1c6a('0x18')](_0x1c6a('0x2d'),_0x47b878);return request({'method':'GET','uri':util[_0x1c6a('0x20')](_0x1c6a('0x2e'),_0x37b7b8[_0x1c6a('0x2f')]),'qs':{'operation':_0x1c6a('0x30'),'username':_0x37b7b8[_0x1c6a('0x31')],'sessionName':_0x400c02['sessionName'],'query':util[_0x1c6a('0x20')](_0x1c6a('0x32'),_0x47b878)},'json':!![]})[_0x1c6a('0x24')](function(_0x455c27){if(_0x455c27[_0x1c6a('0x25')]&&_0x455c27[_0x1c6a('0x27')]['length']){logger[_0x1c6a('0x18')](_0x1c6a('0x33'));return BPromise[_0x1c6a('0x26')]({'id':_0x455c27[_0x1c6a('0x27')][0x0]['id'],'email':_0x455c27[_0x1c6a('0x27')][0x0][_0x1c6a('0x34')],'name':_0x455c27[_0x1c6a('0x27')][0x0][_0x1c6a('0x35')]+'\x20'+_0x455c27['result'][_0x1c6a('0x36')]});}else{logger[_0x1c6a('0x18')](_0x1c6a('0x37'));return BPromise[_0x1c6a('0x26')]({'id':_0x400c02[_0x1c6a('0x38')],'email':_0x37b7b8[_0x1c6a('0x31')],'name':_0x1c6a('0x39')});}})[_0x1c6a('0x3a')](function(_0x221219){var _0x1da1fb=_0x221219[_0x1c6a('0x28')]||0x1f4;logger[_0x1c6a('0x29')](_0x1c6a('0x2a'),'getUser',_0x1da1fb,JSON['stringify'](_0x221219));});}else{logger[_0x1c6a('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1c6a('0x26')]({'id':_0x400c02[_0x1c6a('0x38')],'email':_0x37b7b8[_0x1c6a('0x31')],'name':_0x1c6a('0x39')})[_0x1c6a('0x3a')](function(_0x41c855){var _0x356b0a=_0x41c855[_0x1c6a('0x28')]||0x1f4;logger[_0x1c6a('0x29')](_0x1c6a('0x2a'),'getUser',_0x356b0a,JSON['stringify'](_0x41c855));});}}function getEndUser(_0x5e1320,_0x5a35e2,_0x3e2be4,_0x46ee40){logger[_0x1c6a('0x18')](_0x1c6a('0x3b'),_0x3e2be4);return request({'method':'GET','uri':util[_0x1c6a('0x20')](_0x1c6a('0x2e'),_0x5e1320[_0x1c6a('0x2f')]),'qs':{'operation':_0x1c6a('0x30'),'username':_0x5e1320[_0x1c6a('0x31')],'sessionName':_0x46ee40['sessionName'],'query':util[_0x1c6a('0x20')]('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;',_0x3e2be4,_0x3e2be4,_0x3e2be4,_0x3e2be4,_0x3e2be4)},'json':!![]})[_0x1c6a('0x24')](function(_0x971e1d){if(_0x971e1d['success']&&_0x971e1d[_0x1c6a('0x27')][_0x1c6a('0xb')]){logger[_0x1c6a('0x18')](_0x1c6a('0x3c'));return BPromise[_0x1c6a('0x26')]({'id':_0x971e1d[_0x1c6a('0x27')][0x0]['id'],'name':_0x971e1d['result'][0x0][_0x1c6a('0x3d')]+'\x20'+_0x971e1d['result'][0x0][_0x1c6a('0x3e')],'phone':_0x3e2be4});}else{logger[_0x1c6a('0x18')](_0x1c6a('0x3f'));return request({'method':_0x1c6a('0x1f'),'uri':util[_0x1c6a('0x20')]('%s/webservice.php',_0x5e1320[_0x1c6a('0x2f')]),'form':{'operation':_0x1c6a('0x21'),'sessionName':_0x46ee40[_0x1c6a('0x40')],'elementType':_0x1c6a('0x41'),'element':JSON[_0x1c6a('0x23')]({'lastname':_0x5a35e2,'phone':_0x3e2be4,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x552a02){logger['info'](_0x1c6a('0x42'));return BPromise['resolve']({'id':_0x552a02['result']['id'],'name':_0x552a02[_0x1c6a('0x27')][_0x1c6a('0x3e')],'phone':_0x552a02[_0x1c6a('0x27')][_0x1c6a('0x43')]});})[_0x1c6a('0x3a')](function(_0x40216f){var _0xf38242=_0x40216f['statusCode']||0x1f4;logger['error'](_0x1c6a('0x2a'),_0x1c6a('0x44'),_0xf38242,JSON[_0x1c6a('0x23')](_0x40216f));});}});}function getConnection(_0x2a90df){var _0x825716=_0x2a90df[_0x1c6a('0x31')];var _0x7f6914=_0x2a90df[_0x1c6a('0x45')];return request({'method':_0x1c6a('0x46'),'uri':util[_0x1c6a('0x20')](_0x1c6a('0x2e'),_0x2a90df['remoteUri']),'qs':{'operation':'getchallenge','username':_0x825716},'json':!![]})[_0x1c6a('0x24')](function(_0x48f759){if(_0x48f759[_0x1c6a('0x25')]){return request({'method':_0x1c6a('0x1f'),'uri':util[_0x1c6a('0x20')](_0x1c6a('0x2e'),_0x2a90df['remoteUri']),'form':{'operation':_0x1c6a('0x47'),'username':_0x825716,'accessKey':md5(_0x48f759[_0x1c6a('0x27')][_0x1c6a('0x48')]+_0x7f6914)},'json':!![]});}})[_0x1c6a('0x24')](function(_0x5d2836){if(_0x5d2836[_0x1c6a('0x25')]){return BPromise[_0x1c6a('0x26')](_0x5d2836[_0x1c6a('0x27')]);}else{throw new Error(util[_0x1c6a('0x20')](_0x1c6a('0x49'),_0x2a90df['id']));}})[_0x1c6a('0x3a')](function(_0x51fc37){var _0xd5d387=_0x51fc37[_0x1c6a('0x28')]||0x1f4;logger[_0x1c6a('0x29')](_0x1c6a('0x2a'),_0x1c6a('0x4a'),_0xd5d387,JSON[_0x1c6a('0x23')](_0x51fc37));});}function request(_0x25f0de){logger[_0x1c6a('0x18')](_0x1c6a('0x4b'),JSON[_0x1c6a('0x23')](_0x25f0de));return rp(_0x25f0de);}exports[_0x1c6a('0x4c')]=function(_0x4e8968,_0x1d3ccd,_0x1dc630,_0x338025,_0x28624b,_0x503c65){var _0xe8254e,_0x1cbab0,_0x187f2b,_0x5b9d0a;_0x503c65[_0x1c6a('0x2f')]=intUtil[_0x1c6a('0x4d')](_0x503c65[_0x1c6a('0x2f')]);if(_0x28624b&&_0x28624b['monitor_format']){logger[_0x1c6a('0x18')](_0x1c6a('0x4e'),'Recording\x20is\x20enabled!');_0x1d3ccd[_0x1c6a('0x4f')]=util['format'](_0x1c6a('0x50'),_0x503c65[_0x1c6a('0x51')],_0x1d3ccd['uniqueid'],md5(_0x1d3ccd[_0x1c6a('0x52')]));}else{_0x1d3ccd['recordingURL']='';}return getConnection(_0x503c65)[_0x1c6a('0x24')](function(_0x230dfa){_0x5b9d0a=_0x230dfa;return getUser(_0x503c65,_0x338025[_0x1c6a('0x53')],_0x5b9d0a);})['then'](function(_0x16765a){_0xe8254e=_0x16765a;logger[_0x1c6a('0x18')](_0x1c6a('0x54'),_0xe8254e['id']);return getEndUser(_0x503c65,_0x1d3ccd[_0x1c6a('0x55')],_0x1d3ccd[_0x1c6a('0x56')],_0x5b9d0a);})['then'](function(_0x244fcd){_0x1cbab0=_0x244fcd;logger[_0x1c6a('0x18')]('The\x20Enduser\x20ID\x20is:',_0x1cbab0['id']);return createTicket(_0x503c65,_0xe8254e,_0x1cbab0,_0x1dc630,_0x1d3ccd,_0x1dc630[_0x1c6a('0x57')],_0x5b9d0a);})[_0x1c6a('0x24')](function(_0x231e23){_0x187f2b=_0x231e23;logger['info']('Ticket\x20created!');logger[_0x1c6a('0x18')](_0x1c6a('0x58'),_0x187f2b['id']);var _0x19b235=util[_0x1c6a('0x20')](_0x1c6a('0x59'),_0x503c65[_0x1c6a('0x2f')],_['split'](_0x187f2b['id'],'x')[0x1]);logger[_0x1c6a('0x18')](_0x1c6a('0x4e'),_0x1c6a('0x5a'));emit(util['format'](_0x1c6a('0x5b'),_0x338025['name']),_0x1c6a('0x5c'),{'uri':_0x19b235});})[_0x1c6a('0x3a')](function(_0x1355a9){logger[_0x1c6a('0x29')]('[QUEUE]',JSON['stringify'](_0x1355a9));});};exports[_0x1c6a('0x5d')]=function(_0x3b3665,_0x127ea6,_0x655c78,_0x42676f,_0x4474dc,_0x11c384,_0x20cb7e){var _0x37f991,_0x53f260,_0x5e1e0b,_0x3ad00a;_0x11c384[_0x1c6a('0x2f')]=intUtil[_0x1c6a('0x4d')](_0x11c384[_0x1c6a('0x2f')]);_0x11c384[_0x1c6a('0x51')]=intUtil[_0x1c6a('0x4d')](_0x11c384['serverUrl']);if(_0x20cb7e&&_0x20cb7e[_0x1c6a('0x5e')]&&_0x20cb7e['recordingFormat']!==_0x1c6a('0x5f')){logger[_0x1c6a('0x18')](_0x1c6a('0x60'),_0x1c6a('0x61'));_0x127ea6[_0x1c6a('0x4f')]=util[_0x1c6a('0x20')](_0x1c6a('0x50'),_0x11c384[_0x1c6a('0x51')],_0x127ea6['uniqueid'],md5(_0x127ea6[_0x1c6a('0x52')]));}return getConnection(_0x11c384)[_0x1c6a('0x24')](function(_0x439a81){_0x3ad00a=_0x439a81;return getUser(_0x11c384,_0x42676f[_0x1c6a('0x53')],_0x3ad00a);})[_0x1c6a('0x24')](function(_0x1ecfb6){_0x37f991=_0x1ecfb6;logger[_0x1c6a('0x18')](_0x1c6a('0x54'),_0x37f991['id']);return getEndUser(_0x11c384,_0x127ea6[_0x1c6a('0x62')],_0x127ea6[_0x1c6a('0x63')],_0x3ad00a);})[_0x1c6a('0x24')](function(_0x1296f4){_0x53f260=_0x1296f4;logger[_0x1c6a('0x18')](_0x1c6a('0x64'),_0x53f260['id']);return createTicket(_0x11c384,_0x37f991,_0x53f260,_0x655c78,_0x127ea6,_0x655c78[_0x1c6a('0x57')],_0x3ad00a);})[_0x1c6a('0x24')](function(_0x81c80){_0x5e1e0b=_0x81c80;logger['info'](_0x1c6a('0x65'));logger[_0x1c6a('0x18')]('The\x20Ticket\x20ID\x20is:',_0x5e1e0b['id']);var _0x4062db=util['format'](_0x1c6a('0x59'),_0x11c384['remoteUri'],_[_0x1c6a('0x66')](_0x5e1e0b['id'],'x')[0x1]);logger[_0x1c6a('0x18')](_0x1c6a('0x60'),_0x1c6a('0x5a'));emit(util[_0x1c6a('0x20')](_0x1c6a('0x5b'),_0x42676f[_0x1c6a('0x16')]),_0x1c6a('0x5c'),{'uri':_0x4062db});})[_0x1c6a('0x3a')](function(_0x5d0230){logger[_0x1c6a('0x29')](_0x1c6a('0x60'),JSON[_0x1c6a('0x23')](_0x5d0230));});};exports[_0x1c6a('0x67')]=function(_0x122923,_0x5ebabb,_0x4a836b,_0xf9fe72,_0x4bd32,_0x1dc6cd){var _0x56357b,_0xbcab13,_0x20efe4,_0x188b1a;_0x1dc6cd[_0x1c6a('0x2f')]=intUtil[_0x1c6a('0x4d')](_0x1dc6cd[_0x1c6a('0x2f')]);_0x1dc6cd[_0x1c6a('0x51')]=intUtil[_0x1c6a('0x4d')](_0x1dc6cd[_0x1c6a('0x51')]);if(_0x4bd32&&_0x4bd32[_0x1c6a('0x68')]){logger['info']('['+_0x5ebabb[_0x1c6a('0x69')][_0x1c6a('0x6a')]()+']',_0x1c6a('0x61'));_0x5ebabb[_0x1c6a('0x4f')]=util[_0x1c6a('0x20')](_0x1c6a('0x50'),_0x1dc6cd['serverUrl'],_0x5ebabb['uniqueid'],md5(_0x5ebabb[_0x1c6a('0x52')]));}else{_0x5ebabb['recordingURL']='';}return getConnection(_0x1dc6cd)['then'](function(_0x5b94a7){_0x188b1a=_0x5b94a7;return getUser(_0x1dc6cd,'',_0x188b1a);})['then'](function(_0x2cc04b){_0x56357b=_0x2cc04b;logger[_0x1c6a('0x18')](_0x1c6a('0x54'),_0x56357b['id']);return getEndUser(_0x1dc6cd,_0x5ebabb[_0x1c6a('0x55')],_0x5ebabb[_0x1c6a('0x56')],_0x188b1a);})[_0x1c6a('0x24')](function(_0x49f468){_0xbcab13=_0x49f468;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbcab13['id']);return createTicket(_0x1dc6cd,_0x56357b,_0xbcab13,_0x4a836b,_0x5ebabb,_0x4a836b[_0x1c6a('0x57')],_0x188b1a);})[_0x1c6a('0x24')](function(_0x51350d){_0x20efe4=_0x51350d;logger[_0x1c6a('0x18')](_0x1c6a('0x65'));logger[_0x1c6a('0x18')](_0x1c6a('0x58'),_0x20efe4['id']);})['catch'](function(_0x18d89a){logger[_0x1c6a('0x29')]('['+_0x5ebabb[_0x1c6a('0x69')][_0x1c6a('0x6a')]()+']',JSON[_0x1c6a('0x23')](_0x18d89a));});}; \ No newline at end of file +var _0xd619=['Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','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','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','phone','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','lastevent','toUpperCase','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','defaults','localhost','socket.io-emitter','emit','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','getString','Descriptions','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','createTicket','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0xd619,0xfb));var _0x9d61=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xd619[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x9d61('0x0'));var rp=require(_0x9d61('0x1'));var BPromise=require(_0x9d61('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x9d61('0x3'));var intUtil=require(_0x9d61('0x4'));var config=require(_0x9d61('0x5'));var logger=require(_0x9d61('0x6'))(_0x9d61('0x7'));config['redis']=_[_0x9d61('0x8')](config['redis'],{'host':_0x9d61('0x9'),'port':0x18eb});var io=require(_0x9d61('0xa'))(new Redis(config['redis']));function emit(_0x5873a6,_0x1d831f,_0x2560b7){io['to'](_0x5873a6)[_0x9d61('0xb')](_0x1d831f,_0x2560b7);}function getCustomFields(_0x25ecea,_0x412276){var _0x57ba07={};if(_0x25ecea['length']>0x0){_[_0x9d61('0xc')](_0x25ecea,function(_0x2e9bed){if(_0x2e9bed[_0x9d61('0xd')]===_0x9d61('0xe')&&_0x2e9bed['idField']){_0x57ba07[_0x2e9bed[_0x9d61('0xf')]]=_0x2e9bed[_0x9d61('0x10')][_0x9d61('0x11')]();}else if(_0x2e9bed[_0x9d61('0xd')]===_0x9d61('0x12')&&_0x2e9bed['variableName']&&_0x2e9bed['idField']&&_0x412276[_0x2e9bed[_0x9d61('0x13')]]){_0x57ba07[_0x2e9bed[_0x9d61('0xf')]]=_0x412276[_0x2e9bed[_0x9d61('0x13')]][_0x9d61('0x11')]();}else if(_0x2e9bed['type']===_0x9d61('0x14')&&_0x2e9bed['Variable']&&_0x2e9bed[_0x9d61('0x15')][_0x9d61('0x16')]&&_0x2e9bed[_0x9d61('0xf')]&&_0x412276[_0x2e9bed['Variable']['name'][_0x9d61('0x17')]()]){_0x57ba07[_0x2e9bed[_0x9d61('0xf')]]=_0x412276[_0x2e9bed[_0x9d61('0x15')][_0x9d61('0x16')][_0x9d61('0x17')]()][_0x9d61('0x11')]();}});}return _0x57ba07;}function createTicket(_0x4ae495,_0x9089cd,_0x5f375b,_0x35ce63,_0x27e53e,_0x5a23ad,_0x5a35be){logger[_0x9d61('0x18')]('Creating\x20new\x20ticket...');var _0x507912=_[_0x9d61('0x19')]({'parent_id':'','assigned_user_id':_0x9089cd['id'],'ticketpriorities':_0x9d61('0x1a'),'ticketstatus':_0x9d61('0x1b'),'ticket_title':intUtil[_0x9d61('0x1c')](_0x35ce63['Subjects'],_0x27e53e,'\x20'),'description':intUtil[_0x9d61('0x1c')](_0x35ce63[_0x9d61('0x1d')],_0x27e53e,'\x0a'),'contact_id':_0x5f375b['id']},getCustomFields(_0x5a23ad,_0x27e53e));var _0x1ca20f={'method':_0x9d61('0x1e'),'uri':util[_0x9d61('0x1f')](_0x9d61('0x20'),_0x4ae495['remoteUri']),'form':{'operation':_0x9d61('0x21'),'username':_0x4ae495[_0x9d61('0x22')],'sessionName':_0x5a35be[_0x9d61('0x23')],'elementType':_0x9d61('0x24'),'element':JSON[_0x9d61('0x25')](_0x507912)},'json':!![]};return request(_0x1ca20f)[_0x9d61('0x26')](function(_0x198550){if(_0x198550[_0x9d61('0x27')]){return BPromise['resolve']({'id':_0x198550[_0x9d61('0x28')]['id']});}else{throw new Error(util['format'](_0x9d61('0x29'),JSON[_0x9d61('0x25')](_0x198550[_0x9d61('0x2a')])));}})[_0x9d61('0x2b')](function(_0x3bf2bc){var _0x741dfe=_0x3bf2bc[_0x9d61('0x2c')]||0x1f4;logger[_0x9d61('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x9d61('0x2d'),_0x741dfe,JSON[_0x9d61('0x25')](_0x3bf2bc));});}function getUser(_0x4438d3,_0x5468dc,_0x254d16){if(intUtil['validateEmail'](_0x5468dc)){logger['info'](_0x9d61('0x2e'),_0x5468dc);return request({'method':_0x9d61('0x2f'),'uri':util[_0x9d61('0x1f')](_0x9d61('0x20'),_0x4438d3[_0x9d61('0x30')]),'qs':{'operation':_0x9d61('0x31'),'username':_0x4438d3[_0x9d61('0x22')],'sessionName':_0x254d16[_0x9d61('0x23')],'query':util[_0x9d61('0x1f')](_0x9d61('0x32'),_0x5468dc)},'json':!![]})[_0x9d61('0x26')](function(_0x4803c5){if(_0x4803c5[_0x9d61('0x27')]&&_0x4803c5[_0x9d61('0x28')][_0x9d61('0x33')]){logger['info'](_0x9d61('0x34'));return BPromise['resolve']({'id':_0x4803c5[_0x9d61('0x28')][0x0]['id'],'email':_0x4803c5[_0x9d61('0x28')][0x0][_0x9d61('0x35')],'name':_0x4803c5[_0x9d61('0x28')][0x0][_0x9d61('0x36')]+'\x20'+_0x4803c5['result'][_0x9d61('0x37')]});}else{logger[_0x9d61('0x18')](_0x9d61('0x38'));return BPromise[_0x9d61('0x39')]({'id':_0x254d16[_0x9d61('0x3a')],'email':_0x4438d3['username'],'name':_0x9d61('0x3b')});}})[_0x9d61('0x2b')](function(_0x541823){var _0x1ad5c8=_0x541823[_0x9d61('0x2c')]||0x1f4;logger[_0x9d61('0x2a')](_0x9d61('0x3c'),'getUser',_0x1ad5c8,JSON[_0x9d61('0x25')](_0x541823));});}else{logger[_0x9d61('0x18')](_0x9d61('0x38'));return BPromise[_0x9d61('0x39')]({'id':_0x254d16[_0x9d61('0x3a')],'email':_0x4438d3[_0x9d61('0x22')],'name':'admin'})[_0x9d61('0x2b')](function(_0x8a8a4a){var _0x2bc116=_0x8a8a4a[_0x9d61('0x2c')]||0x1f4;logger[_0x9d61('0x2a')](_0x9d61('0x3c'),'getUser',_0x2bc116,JSON[_0x9d61('0x25')](_0x8a8a4a));});}}function getEndUser(_0x1aa86c,_0x259c88,_0x2745fa,_0x57f134){logger[_0x9d61('0x18')]('Searching\x20end\x20user\x20with\x20phone',_0x2745fa);return request({'method':_0x9d61('0x2f'),'uri':util['format'](_0x9d61('0x20'),_0x1aa86c['remoteUri']),'qs':{'operation':_0x9d61('0x31'),'username':_0x1aa86c[_0x9d61('0x22')],'sessionName':_0x57f134['sessionName'],'query':util[_0x9d61('0x1f')](_0x9d61('0x3d'),_0x2745fa,_0x2745fa,_0x2745fa,_0x2745fa,_0x2745fa)},'json':!![]})['then'](function(_0x190e35){if(_0x190e35['success']&&_0x190e35[_0x9d61('0x28')]['length']){logger[_0x9d61('0x18')](_0x9d61('0x3e'));return BPromise[_0x9d61('0x39')]({'id':_0x190e35[_0x9d61('0x28')][0x0]['id'],'name':_0x190e35[_0x9d61('0x28')][0x0]['firstname']+'\x20'+_0x190e35[_0x9d61('0x28')][0x0][_0x9d61('0x3f')],'phone':_0x2745fa});}else{logger[_0x9d61('0x18')](_0x9d61('0x40'));return request({'method':_0x9d61('0x1e'),'uri':util[_0x9d61('0x1f')](_0x9d61('0x20'),_0x1aa86c[_0x9d61('0x30')]),'form':{'operation':'create','sessionName':_0x57f134[_0x9d61('0x23')],'elementType':'Contacts','element':JSON[_0x9d61('0x25')]({'lastname':_0x259c88,'phone':_0x2745fa,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x3e7a77){logger['info'](_0x9d61('0x41'));return BPromise['resolve']({'id':_0x3e7a77[_0x9d61('0x28')]['id'],'name':_0x3e7a77[_0x9d61('0x28')][_0x9d61('0x3f')],'phone':_0x3e7a77[_0x9d61('0x28')][_0x9d61('0x42')]});})[_0x9d61('0x2b')](function(_0x4ee793){var _0x4c4af3=_0x4ee793['statusCode']||0x1f4;logger['error'](_0x9d61('0x3c'),'getEndUser',_0x4c4af3,JSON[_0x9d61('0x25')](_0x4ee793));});}});}function getConnection(_0x477c56){var _0x280453=_0x477c56[_0x9d61('0x22')];var _0xb5010b=_0x477c56[_0x9d61('0x43')];return request({'method':_0x9d61('0x2f'),'uri':util['format']('%s/webservice.php',_0x477c56[_0x9d61('0x30')]),'qs':{'operation':_0x9d61('0x44'),'username':_0x280453},'json':!![]})[_0x9d61('0x26')](function(_0x1bced1){if(_0x1bced1['success']){return request({'method':_0x9d61('0x1e'),'uri':util[_0x9d61('0x1f')](_0x9d61('0x20'),_0x477c56[_0x9d61('0x30')]),'form':{'operation':_0x9d61('0x45'),'username':_0x280453,'accessKey':md5(_0x1bced1['result'][_0x9d61('0x46')]+_0xb5010b)},'json':!![]});}})[_0x9d61('0x26')](function(_0x230bbf){if(_0x230bbf['success']){return BPromise[_0x9d61('0x39')](_0x230bbf[_0x9d61('0x28')]);}else{throw new Error(util[_0x9d61('0x1f')](_0x9d61('0x47'),_0x477c56['id']));}})['catch'](function(_0x26c174){var _0x5e4a33=_0x26c174['statusCode']||0x1f4;logger[_0x9d61('0x2a')](_0x9d61('0x3c'),_0x9d61('0x48'),_0x5e4a33,JSON[_0x9d61('0x25')](_0x26c174));});}function request(_0x22bc73){logger[_0x9d61('0x18')]('[HTTP]',JSON[_0x9d61('0x25')](_0x22bc73));return rp(_0x22bc73);}exports[_0x9d61('0x49')]=function(_0x511d82,_0x4df531,_0x2510b0,_0x575112,_0x4c2138,_0x31d864){var _0x38c2c9,_0x156997,_0x417a36,_0x25edfe;_0x31d864[_0x9d61('0x30')]=intUtil[_0x9d61('0x4a')](_0x31d864[_0x9d61('0x30')]);if(_0x4c2138&&_0x4c2138[_0x9d61('0x4b')]){logger[_0x9d61('0x18')](_0x9d61('0x4c'),_0x9d61('0x4d'));_0x4df531[_0x9d61('0x4e')]=util[_0x9d61('0x1f')](_0x9d61('0x4f'),_0x31d864[_0x9d61('0x50')],_0x4df531[_0x9d61('0x51')],md5(_0x4df531[_0x9d61('0x51')]));}else{_0x4df531['recordingURL']='';}return getConnection(_0x31d864)['then'](function(_0x2cb77d){_0x25edfe=_0x2cb77d;return getUser(_0x31d864,_0x575112[_0x9d61('0x52')],_0x25edfe);})[_0x9d61('0x26')](function(_0x4e18d0){_0x38c2c9=_0x4e18d0;logger[_0x9d61('0x18')](_0x9d61('0x53'),_0x38c2c9['id']);return getEndUser(_0x31d864,_0x4df531[_0x9d61('0x54')],_0x4df531[_0x9d61('0x55')],_0x25edfe);})[_0x9d61('0x26')](function(_0x441ab5){_0x156997=_0x441ab5;logger[_0x9d61('0x18')]('The\x20Enduser\x20ID\x20is:',_0x156997['id']);return createTicket(_0x31d864,_0x38c2c9,_0x156997,_0x2510b0,_0x4df531,_0x2510b0[_0x9d61('0x56')],_0x25edfe);})[_0x9d61('0x26')](function(_0x5e6c19){_0x417a36=_0x5e6c19;logger[_0x9d61('0x18')](_0x9d61('0x57'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x417a36['id']);var _0x55e890=util[_0x9d61('0x1f')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x31d864['remoteUri'],_[_0x9d61('0x58')](_0x417a36['id'],'x')[0x1]);logger[_0x9d61('0x18')](_0x9d61('0x4c'),_0x9d61('0x59'));emit(util[_0x9d61('0x1f')](_0x9d61('0x5a'),_0x575112[_0x9d61('0x16')]),'trigger:browser:url',{'uri':_0x55e890});})[_0x9d61('0x2b')](function(_0x40304e){logger[_0x9d61('0x2a')](_0x9d61('0x4c'),JSON[_0x9d61('0x25')](_0x40304e));});};exports[_0x9d61('0x5b')]=function(_0x12314d,_0x21cb52,_0xf07c62,_0x211571,_0x49b150,_0x17c84a,_0x3d98a4){var _0x53a20c,_0x5f0d69,_0x5ae808,_0x259733;_0x17c84a[_0x9d61('0x30')]=intUtil[_0x9d61('0x4a')](_0x17c84a[_0x9d61('0x30')]);_0x17c84a[_0x9d61('0x50')]=intUtil[_0x9d61('0x4a')](_0x17c84a[_0x9d61('0x50')]);if(_0x3d98a4&&_0x3d98a4[_0x9d61('0x5c')]&&_0x3d98a4['recordingFormat']!=='none'){logger[_0x9d61('0x18')](_0x9d61('0x5d'),_0x9d61('0x4d'));_0x21cb52['recordingURL']=util[_0x9d61('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17c84a['serverUrl'],_0x21cb52[_0x9d61('0x51')],md5(_0x21cb52[_0x9d61('0x51')]));}return getConnection(_0x17c84a)['then'](function(_0x31e3c2){_0x259733=_0x31e3c2;return getUser(_0x17c84a,_0x211571[_0x9d61('0x52')],_0x259733);})[_0x9d61('0x26')](function(_0x75ba89){_0x53a20c=_0x75ba89;logger[_0x9d61('0x18')](_0x9d61('0x53'),_0x53a20c['id']);return getEndUser(_0x17c84a,_0x21cb52[_0x9d61('0x5e')],_0x21cb52[_0x9d61('0x5f')],_0x259733);})['then'](function(_0x3db42d){_0x5f0d69=_0x3db42d;logger[_0x9d61('0x18')](_0x9d61('0x60'),_0x5f0d69['id']);return createTicket(_0x17c84a,_0x53a20c,_0x5f0d69,_0xf07c62,_0x21cb52,_0xf07c62[_0x9d61('0x56')],_0x259733);})[_0x9d61('0x26')](function(_0x502d41){_0x5ae808=_0x502d41;logger[_0x9d61('0x18')](_0x9d61('0x57'));logger[_0x9d61('0x18')](_0x9d61('0x61'),_0x5ae808['id']);var _0x557d05=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x17c84a[_0x9d61('0x30')],_[_0x9d61('0x58')](_0x5ae808['id'],'x')[0x1]);logger[_0x9d61('0x18')]('[OUTBOUND]',_0x9d61('0x59'));emit(util[_0x9d61('0x1f')](_0x9d61('0x5a'),_0x211571[_0x9d61('0x16')]),_0x9d61('0x62'),{'uri':_0x557d05});})[_0x9d61('0x2b')](function(_0x2bfe55){logger[_0x9d61('0x2a')]('[OUTBOUND]',JSON[_0x9d61('0x25')](_0x2bfe55));});};exports['unmanaged']=function(_0x19284d,_0x29ec20,_0x5c80b5,_0x1351c9,_0x20625e,_0x5b6625){var _0x18c2de,_0x5d3db5,_0x3c8b43,_0x248dc1;_0x5b6625[_0x9d61('0x30')]=intUtil['stripTrailingSlash'](_0x5b6625[_0x9d61('0x30')]);_0x5b6625['serverUrl']=intUtil['stripTrailingSlash'](_0x5b6625[_0x9d61('0x50')]);if(_0x20625e&&_0x20625e['monitor_format']){logger[_0x9d61('0x18')]('['+_0x29ec20[_0x9d61('0x63')][_0x9d61('0x64')]()+']','Recording\x20is\x20enabled!');_0x29ec20[_0x9d61('0x4e')]=util[_0x9d61('0x1f')](_0x9d61('0x4f'),_0x5b6625[_0x9d61('0x50')],_0x29ec20[_0x9d61('0x51')],md5(_0x29ec20[_0x9d61('0x51')]));}else{_0x29ec20['recordingURL']='';}return getConnection(_0x5b6625)[_0x9d61('0x26')](function(_0x357676){_0x248dc1=_0x357676;return getUser(_0x5b6625,'',_0x248dc1);})[_0x9d61('0x26')](function(_0x579ef1){_0x18c2de=_0x579ef1;logger[_0x9d61('0x18')](_0x9d61('0x53'),_0x18c2de['id']);return getEndUser(_0x5b6625,_0x29ec20[_0x9d61('0x54')],_0x29ec20['calleridnum'],_0x248dc1);})[_0x9d61('0x26')](function(_0x582729){_0x5d3db5=_0x582729;logger['info'](_0x9d61('0x60'),_0x5d3db5['id']);return createTicket(_0x5b6625,_0x18c2de,_0x5d3db5,_0x5c80b5,_0x29ec20,_0x5c80b5[_0x9d61('0x56')],_0x248dc1);})['then'](function(_0x243f03){_0x3c8b43=_0x243f03;logger[_0x9d61('0x18')](_0x9d61('0x57'));logger['info'](_0x9d61('0x61'),_0x3c8b43['id']);})[_0x9d61('0x2b')](function(_0x18cb61){logger['error']('['+_0x29ec20[_0x9d61('0x63')][_0x9d61('0x64')]()+']',JSON[_0x9d61('0x25')](_0x18cb61));});}; \ 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 d04766e..d0ed939 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 _0x5b02=['inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','newTab','error','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','../../../../config/environment','zendesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','username','password','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','toLowerCase','content','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x5b02,0xe9));var _0x25b0=function(_0x40596f,_0x383b1a){_0x40596f=_0x40596f-0x0;var _0x39c9bf=_0x5b02[_0x40596f];return _0x39c9bf;};'use strict';var _=require(_0x25b0('0x0'));var rp=require(_0x25b0('0x1'));var md5=require(_0x25b0('0x2'));var util=require(_0x25b0('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x25b0('0x4'));var logger=require('../../../../config/logger')(_0x25b0('0x5'));config[_0x25b0('0x6')]=_[_0x25b0('0x7')](config[_0x25b0('0x6')],{'host':_0x25b0('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25b0('0x6')]));function emit(_0xd8276d,_0x49ef3a,_0x412954){io['to'](_0xd8276d)['emit'](_0x49ef3a,_0x412954);}var headers={'Content-Type':'application/json','Accept':_0x25b0('0x9')};function getTicket(_0x45429b,_0x358af0,_0x575918,_0x11dd3c,_0x466612){logger[_0x25b0('0xa')](_0x25b0('0xb'));return request({'uri':util[_0x25b0('0xc')](_0x25b0('0xd'),_0x45429b[_0x25b0('0xe')]),'method':_0x25b0('0xf'),'body':{'ticket':_[_0x25b0('0x10')]({'requester_id':_0x575918['id'],'submitter_id':_0x358af0?_0x358af0['id']:undefined,'assignee_id':_0x358af0?_0x358af0['id']:undefined,'tags':getTags(_0x11dd3c[_0x25b0('0x11')],_0x25b0('0x12')),'subject':intUtil[_0x25b0('0x13')](_0x11dd3c[_0x25b0('0x14')],_0x466612,'\x20'),'description':intUtil[_0x25b0('0x13')](_0x11dd3c[_0x25b0('0x15')],_0x466612,'\x0a'),'comment':{'public':![],'body':intUtil[_0x25b0('0x13')](_0x11dd3c[_0x25b0('0x15')],_0x466612,'\x0a')}},getCustomFields(_0x11dd3c[_0x25b0('0x16')],_0x466612))}})[_0x25b0('0x17')](function(_0x3b89e7){logger[_0x25b0('0xa')]('Ticket\x20created!');return _0x3b89e7['ticket'];});}function getUser(_0xfe1ea6,_0x4b2357){if(intUtil[_0x25b0('0x18')](_0x4b2357)){logger[_0x25b0('0xa')](_0x25b0('0x19'),_0x4b2357);return request({'uri':util[_0x25b0('0xc')]('%s/search.json',_0xfe1ea6[_0x25b0('0xe')]),'qs':{'query':util[_0x25b0('0xc')](_0x25b0('0x1a'),_0x4b2357)}})[_0x25b0('0x17')](function(_0xe750bf){if(_0xe750bf[_0x25b0('0x1b')]){logger['info'](_0x25b0('0x1c'));return _[_0x25b0('0x1d')](_0xe750bf[_0x25b0('0x1e')],{'email':_0x4b2357,'role':_0x25b0('0x1f')});}else{logger[_0x25b0('0xa')](_0x25b0('0x20'));return request({'uri':util[_0x25b0('0xc')](_0x25b0('0x21'),_0xfe1ea6[_0x25b0('0xe')])})[_0x25b0('0x17')](function(_0x2b2eda){logger[_0x25b0('0xa')]('Admin\x20account\x20selected.');return _0x2b2eda[_0x25b0('0x22')];});}});}else{logger[_0x25b0('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x25b0('0xc')](_0x25b0('0x21'),_0xfe1ea6[_0x25b0('0xe')])})['then'](function(_0x4b87c9){logger['info'](_0x25b0('0x23'));return _0x4b87c9[_0x25b0('0x22')];});}}function getEndUser(_0x99bd3a,_0x24f847,_0xdbb459){logger[_0x25b0('0xa')](_0x25b0('0x24'),_0xdbb459);return request({'uri':util[_0x25b0('0xc')](_0x25b0('0x25'),_0x99bd3a['remoteUri']),'qs':{'query':util[_0x25b0('0xc')](_0x25b0('0x26'),_0xdbb459)}})['then'](function(_0x567775){var _0x5de43d;if(_0x567775[_0x25b0('0x1e')][_0x25b0('0x27')]){_0x567775[_0x25b0('0x1e')]=_[_0x25b0('0x28')](_0x567775[_0x25b0('0x1e')],{'suspended':![],'role':_0x25b0('0x29')});if(_0x567775[_0x25b0('0x1e')][_0x25b0('0x27')]){_0x5de43d=_[_0x25b0('0x2a')](_0x567775[_0x25b0('0x1e')]);}}if(_0x5de43d){logger[_0x25b0('0xa')](_0x25b0('0x2b'));return _0x5de43d;}else{logger[_0x25b0('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x25b0('0x2c'),_0x99bd3a['remoteUri']),'method':'POST','body':{'user':{'role':_0x25b0('0x29'),'name':util[_0x25b0('0xc')](_0x25b0('0x2d'),_0x24f847||_0xdbb459),'phone':_0xdbb459}}})[_0x25b0('0x17')](function(_0xb68653){logger['info'](_0x25b0('0x2e'));return _0xb68653[_0x25b0('0x22')];});}});}function getAuth(_0x4dad3a){var _0x13ce9;if(_0x4dad3a[_0x25b0('0x2f')]==='password'){_0x13ce9=util[_0x25b0('0xc')]('%s:%s',_0x4dad3a[_0x25b0('0x30')],_0x4dad3a[_0x25b0('0x31')]);}else if(_0x4dad3a[_0x25b0('0x2f')]===_0x25b0('0x32')){_0x13ce9=util[_0x25b0('0xc')](_0x25b0('0x33'),_0x4dad3a[_0x25b0('0x30')],_0x4dad3a[_0x25b0('0x32')]);}return util[_0x25b0('0xc')]('Basic\x20%s',new Buffer(_0x13ce9)[_0x25b0('0x34')](_0x25b0('0x35')));}function request(_0x3887e8){logger[_0x25b0('0x36')](_0x25b0('0x37'),JSON[_0x25b0('0x38')](_0x3887e8));return rp(_[_0x25b0('0x7')](_0x3887e8,{'method':_0x25b0('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x29e810,_0x2d798b){var _0x4c6a19=[];if(_0x29e810&&_0x29e810[_0x25b0('0x27')]>0x0){_0x4c6a19=_[_0x25b0('0x3a')](_0x29e810,_0x2d798b);}return _0x4c6a19;}function getCustomFields(_0x42a7af,_0x4834f6){var _0x20d98b=[];var _0x42a0ed={'custom_fields':[]};if(_0x42a7af[_0x25b0('0x27')]>0x0){_[_0x25b0('0x3b')](_0x42a7af,function(_0x17f67c){if(_0x17f67c[_0x25b0('0x3c')]===_0x25b0('0x3d')&&_0x17f67c[_0x25b0('0x3e')]&&!_0x17f67c['customField']){_0x42a0ed[_0x17f67c['nameField'][_0x25b0('0x3f')]()]=_0x17f67c[_0x25b0('0x40')][_0x25b0('0x34')]();}else if(_0x17f67c['type']===_0x25b0('0x3d')&&_0x17f67c['idField']&&_0x17f67c[_0x25b0('0x41')]){_0x42a0ed[_0x25b0('0x42')][_0x25b0('0x43')]({'id':_0x17f67c[_0x25b0('0x44')],'value':_0x17f67c[_0x25b0('0x40')]['toString']()});}else if(_0x17f67c[_0x25b0('0x3c')]===_0x25b0('0x45')&&_0x17f67c[_0x25b0('0x46')]&&_0x17f67c[_0x25b0('0x44')]&&_0x17f67c[_0x25b0('0x41')]){_0x4834f6[_0x17f67c['variableName']]&&_0x42a0ed[_0x25b0('0x42')][_0x25b0('0x43')]({'id':_0x17f67c[_0x25b0('0x44')],'value':_0x4834f6[_0x17f67c[_0x25b0('0x46')]][_0x25b0('0x34')]()});}else if(_0x17f67c[_0x25b0('0x3c')]===_0x25b0('0x47')&&_0x17f67c[_0x25b0('0x48')]&&_0x17f67c[_0x25b0('0x48')][_0x25b0('0x12')]&&_0x17f67c[_0x25b0('0x44')]&&_0x17f67c['customField']){_0x4834f6[_0x17f67c[_0x25b0('0x48')]['name'][_0x25b0('0x3f')]()]&&_0x42a0ed[_0x25b0('0x42')][_0x25b0('0x43')]({'id':_0x17f67c[_0x25b0('0x44')],'value':_0x4834f6[_0x17f67c['Variable'][_0x25b0('0x12')][_0x25b0('0x3f')]()][_0x25b0('0x34')]()});}});}return _0x42a0ed;}exports['queue']=function(_0x4734b1,_0x2f53c1,_0xfbe61d,_0x4434b1,_0x3b6679,_0x3c6ec1){var _0x28bdc4,_0x55ff4c;_0x3c6ec1[_0x25b0('0xe')]=intUtil[_0x25b0('0x49')](_0x3c6ec1[_0x25b0('0xe')]);_0x3c6ec1['serverUrl']=intUtil[_0x25b0('0x49')](_0x3c6ec1[_0x25b0('0x4a')]);if(_0x3b6679&&_0x3b6679[_0x25b0('0x4b')]){logger[_0x25b0('0xa')](_0x25b0('0x4c'),'Recording\x20is\x20enabled!');_0x2f53c1[_0x25b0('0x4d')]=util[_0x25b0('0xc')](_0x25b0('0x4e'),_0x3c6ec1['serverUrl'],_0x2f53c1[_0x25b0('0x4f')],md5(_0x2f53c1[_0x25b0('0x4f')]));}else{_0x2f53c1[_0x25b0('0x4d')]='';}headers[_0x25b0('0x50')]=getAuth(_0x3c6ec1);return getUser(_0x3c6ec1,_0x4434b1[_0x25b0('0x51')])[_0x25b0('0x17')](function(_0x5f19d6){_0x28bdc4=_0x5f19d6;logger['info']('The\x20User\x20ID\x20is:',_0x28bdc4['id']);return getEndUser(_0x3c6ec1,_0x2f53c1[_0x25b0('0x52')],_0x2f53c1['calleridnum']);})['then'](function(_0x2c5b9e){_0x55ff4c=_0x2c5b9e;logger['info'](_0x25b0('0x53'),_0x55ff4c['id']);return getTicket(_0x3c6ec1,_0x28bdc4,_0x55ff4c,_0xfbe61d,_0x2f53c1);})['then'](function(_0x4fc22d){if(_0x4fc22d){logger[_0x25b0('0xa')](_0x25b0('0x54'),_0x4fc22d['id']);switch(_0x3c6ec1[_0x25b0('0x3c')]){case _0x25b0('0x55'):logger[_0x25b0('0xa')](_0x25b0('0x4c'),_0x25b0('0x56'));return request({'uri':util[_0x25b0('0xc')](_0x25b0('0x57'),_0x3c6ec1[_0x25b0('0xe')],_0x28bdc4['id'],_0x4fc22d['id']),'method':'POST'});case'newTab':logger['info'](_0x25b0('0x4c'),_0x25b0('0x58'));emit(util[_0x25b0('0xc')](_0x25b0('0x59'),_0x4434b1[_0x25b0('0x12')]),_0x25b0('0x5a'),{'uri':util[_0x25b0('0xc')]('%s/agent/tickets/%s',_0x3c6ec1[_0x25b0('0xe')],_0x4fc22d['id'])});break;default:logger['error'](_0x25b0('0x4c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x403508){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x25b0('0x5b')](_0x403508,{'showHidden':!![],'depth':null}));});};exports[_0x25b0('0x5c')]=function(_0x38e958,_0x3c190e,_0xce704f,_0x367d57,_0x8bbdb3,_0x7a5a8e,_0x31e8d2){var _0xfd3b6c,_0x56bc21;_0x7a5a8e['remoteUri']=intUtil[_0x25b0('0x49')](_0x7a5a8e[_0x25b0('0xe')]);_0x7a5a8e['serverUrl']=intUtil[_0x25b0('0x49')](_0x7a5a8e[_0x25b0('0x4a')]);if(_0x31e8d2&&_0x31e8d2[_0x25b0('0x5d')]&&_0x31e8d2[_0x25b0('0x5d')]!==_0x25b0('0x5e')){logger['info'](_0x25b0('0x5f'),_0x25b0('0x60'));_0x3c190e[_0x25b0('0x4d')]=util['format'](_0x25b0('0x4e'),_0x7a5a8e[_0x25b0('0x4a')],_0x3c190e[_0x25b0('0x4f')],md5(_0x3c190e[_0x25b0('0x4f')]));}headers[_0x25b0('0x50')]=getAuth(_0x7a5a8e);return getUser(_0x7a5a8e,_0x367d57[_0x25b0('0x51')])[_0x25b0('0x17')](function(_0x2ccf0c){_0xfd3b6c=_0x2ccf0c;logger[_0x25b0('0xa')](_0x25b0('0x61'),_0xfd3b6c['id']);return getEndUser(_0x7a5a8e,_0x3c190e[_0x25b0('0x62')],_0x3c190e[_0x25b0('0x63')]);})[_0x25b0('0x17')](function(_0x2c5995){_0x56bc21=_0x2c5995;logger['info'](_0x25b0('0x53'),_0x56bc21['id']);return getTicket(_0x7a5a8e,_0xfd3b6c,_0x56bc21,_0xce704f,_0x3c190e);})[_0x25b0('0x17')](function(_0x5debfe){if(_0x5debfe){logger[_0x25b0('0xa')]('The\x20Ticket\x20ID\x20is:',_0x5debfe['id']);switch(_0x7a5a8e[_0x25b0('0x3c')]){case _0x25b0('0x55'):logger['info'](_0x25b0('0x5f'),_0x25b0('0x56'));return request({'uri':util[_0x25b0('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x7a5a8e[_0x25b0('0xe')],_0xfd3b6c['id'],_0x5debfe['id']),'method':'POST'});case _0x25b0('0x64'):logger[_0x25b0('0xa')]('[OUTBOUND]',_0x25b0('0x58'));emit(util[_0x25b0('0xc')]('user:%s',_0x367d57[_0x25b0('0x12')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x7a5a8e[_0x25b0('0xe')],_0x5debfe['id'])});break;default:logger[_0x25b0('0x65')](_0x25b0('0x5f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x25b0('0x66')](function(_0x431482){logger[_0x25b0('0x65')](_0x25b0('0x67'),util[_0x25b0('0x5b')](_0x431482,{'showHidden':!![],'depth':null}));});};exports[_0x25b0('0x68')]=function(_0x1568f4,_0x452f19,_0x15f56a,_0x330e6d,_0x1fb191,_0x280f61){var _0x17669b,_0x34da3a;_0x280f61[_0x25b0('0xe')]=intUtil[_0x25b0('0x49')](_0x280f61[_0x25b0('0xe')]);_0x280f61['serverUrl']=intUtil[_0x25b0('0x49')](_0x280f61['serverUrl']);if(_0x1fb191&&_0x1fb191[_0x25b0('0x4b')]){logger[_0x25b0('0xa')]('['+_0x452f19[_0x25b0('0x69')][_0x25b0('0x6a')]()+']','Recording\x20is\x20enabled!');_0x452f19[_0x25b0('0x4d')]=util[_0x25b0('0xc')](_0x25b0('0x4e'),_0x280f61[_0x25b0('0x4a')],_0x452f19[_0x25b0('0x4f')],md5(_0x452f19[_0x25b0('0x4f')]));}else{_0x452f19['recordingURL']='';}headers['Authorization']=getAuth(_0x280f61);return getUser(_0x280f61)[_0x25b0('0x17')](function(_0x5b8063){_0x17669b=_0x5b8063;logger[_0x25b0('0xa')](_0x25b0('0x61'),_0x17669b['id']);return getEndUser(_0x280f61,_0x452f19[_0x25b0('0x52')],_0x452f19['calleridnum']);})[_0x25b0('0x17')](function(_0x1259ad){_0x34da3a=_0x1259ad;logger[_0x25b0('0xa')](_0x25b0('0x53'),_0x34da3a['id']);return getTicket(_0x280f61,_0x17669b,_0x34da3a,_0x15f56a,_0x452f19);})['then'](function(_0x19347f){if(_0x19347f){logger[_0x25b0('0xa')](_0x25b0('0x54'),_0x19347f['id']);}})['catch'](function(_0x2508cf){logger[_0x25b0('0x65')]('['+_0x452f19[_0x25b0('0x69')][_0x25b0('0x6a')]()+']'+_0x25b0('0x6b'),util[_0x25b0('0x5b')](_0x2508cf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7072=['socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','Descriptions','getString','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','authType','token','%s/token:%s','username','Basic\x20%s','toString','debug','[HTTP]','GET','forEach','string','nameField','customField','toLowerCase','content','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','integrationTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','zendesk','defaults','redis','localhost'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7072,0x138));var _0x2707=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x7072[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var rp=require(_0x2707('0x0'));var md5=require(_0x2707('0x1'));var util=require(_0x2707('0x2'));var Redis=require(_0x2707('0x3'));var intUtil=require(_0x2707('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x2707('0x5'));config['redis']=_[_0x2707('0x6')](config[_0x2707('0x7')],{'host':_0x2707('0x8'),'port':0x18eb});var io=require(_0x2707('0x9'))(new Redis(config[_0x2707('0x7')]));function emit(_0x128205,_0x21b0a0,_0x745cfd){io['to'](_0x128205)[_0x2707('0xa')](_0x21b0a0,_0x745cfd);}var headers={'Content-Type':_0x2707('0xb'),'Accept':'application/json'};function getTicket(_0x597ff9,_0x380339,_0x179cef,_0x379ac5,_0x56406b){logger[_0x2707('0xc')](_0x2707('0xd'));return request({'uri':util[_0x2707('0xe')](_0x2707('0xf'),_0x597ff9[_0x2707('0x10')]),'method':_0x2707('0x11'),'body':{'ticket':_[_0x2707('0x12')]({'requester_id':_0x179cef['id'],'submitter_id':_0x380339?_0x380339['id']:undefined,'assignee_id':_0x380339?_0x380339['id']:undefined,'tags':getTags(_0x379ac5[_0x2707('0x13')],_0x2707('0x14')),'subject':intUtil['getString'](_0x379ac5[_0x2707('0x15')],_0x56406b,'\x20'),'description':intUtil['getString'](_0x379ac5[_0x2707('0x16')],_0x56406b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2707('0x17')](_0x379ac5[_0x2707('0x16')],_0x56406b,'\x0a')}},getCustomFields(_0x379ac5[_0x2707('0x18')],_0x56406b))}})[_0x2707('0x19')](function(_0x4e52a3){logger[_0x2707('0xc')](_0x2707('0x1a'));return _0x4e52a3[_0x2707('0x1b')];});}function getUser(_0x5d523f,_0x1153d7){if(intUtil[_0x2707('0x1c')](_0x1153d7)){logger[_0x2707('0xc')](_0x2707('0x1d'),_0x1153d7);return request({'uri':util[_0x2707('0xe')](_0x2707('0x1e'),_0x5d523f['remoteUri']),'qs':{'query':util[_0x2707('0xe')](_0x2707('0x1f'),_0x1153d7)}})[_0x2707('0x19')](function(_0x518262){if(_0x518262['count']){logger['info'](_0x2707('0x20'));return _[_0x2707('0x21')](_0x518262[_0x2707('0x22')],{'email':_0x1153d7,'role':_0x2707('0x23')});}else{logger[_0x2707('0xc')](_0x2707('0x24'));return request({'uri':util[_0x2707('0xe')](_0x2707('0x25'),_0x5d523f[_0x2707('0x10')])})[_0x2707('0x19')](function(_0x37c475){logger[_0x2707('0xc')](_0x2707('0x26'));return _0x37c475[_0x2707('0x27')];});}});}else{logger['info'](_0x2707('0x24'));return request({'uri':util[_0x2707('0xe')](_0x2707('0x25'),_0x5d523f[_0x2707('0x10')])})[_0x2707('0x19')](function(_0x3f6e8b){logger['info'](_0x2707('0x26'));return _0x3f6e8b[_0x2707('0x27')];});}}function getEndUser(_0x171add,_0x2ad386,_0x5b763f){logger['info'](_0x2707('0x28'),_0x5b763f);return request({'uri':util['format'](_0x2707('0x1e'),_0x171add[_0x2707('0x10')]),'qs':{'query':util[_0x2707('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x5b763f)}})[_0x2707('0x19')](function(_0x14daf8){var _0x2c7047;if(_0x14daf8['results'][_0x2707('0x29')]){_0x14daf8[_0x2707('0x22')]=_['filter'](_0x14daf8[_0x2707('0x22')],{'suspended':![],'role':'end-user'});if(_0x14daf8['results'][_0x2707('0x29')]){_0x2c7047=_['first'](_0x14daf8[_0x2707('0x22')]);}}if(_0x2c7047){logger[_0x2707('0xc')](_0x2707('0x2a'));return _0x2c7047;}else{logger[_0x2707('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2707('0xe')](_0x2707('0x2b'),_0x171add[_0x2707('0x10')]),'method':_0x2707('0x11'),'body':{'user':{'role':_0x2707('0x2c'),'name':util[_0x2707('0xe')](_0x2707('0x2d'),_0x2ad386||_0x5b763f),'phone':_0x5b763f}}})[_0x2707('0x19')](function(_0x2d2520){logger['info'](_0x2707('0x2e'));return _0x2d2520[_0x2707('0x27')];});}});}function getAuth(_0x5bcdef){var _0x47ce1c;if(_0x5bcdef['authType']==='password'){_0x47ce1c=util['format'](_0x2707('0x2f'),_0x5bcdef['username'],_0x5bcdef['password']);}else if(_0x5bcdef[_0x2707('0x30')]===_0x2707('0x31')){_0x47ce1c=util['format'](_0x2707('0x32'),_0x5bcdef[_0x2707('0x33')],_0x5bcdef['token']);}return util['format'](_0x2707('0x34'),new Buffer(_0x47ce1c)[_0x2707('0x35')]('base64'));}function request(_0x5d69cf){logger[_0x2707('0x36')](_0x2707('0x37'),JSON['stringify'](_0x5d69cf));return rp(_[_0x2707('0x6')](_0x5d69cf,{'method':_0x2707('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x1bd1c3,_0x2df9d5){var _0x9943e8=[];if(_0x1bd1c3&&_0x1bd1c3[_0x2707('0x29')]>0x0){_0x9943e8=_['map'](_0x1bd1c3,_0x2df9d5);}return _0x9943e8;}function getCustomFields(_0x15a953,_0x1836f7){var _0x37c39e=[];var _0x33612f={'custom_fields':[]};if(_0x15a953[_0x2707('0x29')]>0x0){_[_0x2707('0x39')](_0x15a953,function(_0x2700bf){if(_0x2700bf['type']===_0x2707('0x3a')&&_0x2700bf[_0x2707('0x3b')]&&!_0x2700bf[_0x2707('0x3c')]){_0x33612f[_0x2700bf[_0x2707('0x3b')][_0x2707('0x3d')]()]=_0x2700bf[_0x2707('0x3e')][_0x2707('0x35')]();}else if(_0x2700bf[_0x2707('0x3f')]===_0x2707('0x3a')&&_0x2700bf[_0x2707('0x40')]&&_0x2700bf[_0x2707('0x3c')]){_0x33612f[_0x2707('0x41')][_0x2707('0x42')]({'id':_0x2700bf[_0x2707('0x40')],'value':_0x2700bf[_0x2707('0x3e')][_0x2707('0x35')]()});}else if(_0x2700bf['type']===_0x2707('0x43')&&_0x2700bf[_0x2707('0x44')]&&_0x2700bf['idField']&&_0x2700bf[_0x2707('0x3c')]){_0x1836f7[_0x2700bf['variableName']]&&_0x33612f[_0x2707('0x41')][_0x2707('0x42')]({'id':_0x2700bf[_0x2707('0x40')],'value':_0x1836f7[_0x2700bf[_0x2707('0x44')]][_0x2707('0x35')]()});}else if(_0x2700bf[_0x2707('0x3f')]===_0x2707('0x45')&&_0x2700bf['Variable']&&_0x2700bf[_0x2707('0x46')][_0x2707('0x14')]&&_0x2700bf['idField']&&_0x2700bf[_0x2707('0x3c')]){_0x1836f7[_0x2700bf[_0x2707('0x46')][_0x2707('0x14')]['toLowerCase']()]&&_0x33612f['custom_fields'][_0x2707('0x42')]({'id':_0x2700bf[_0x2707('0x40')],'value':_0x1836f7[_0x2700bf['Variable'][_0x2707('0x14')]['toLowerCase']()][_0x2707('0x35')]()});}});}return _0x33612f;}exports[_0x2707('0x47')]=function(_0x323703,_0x6947fa,_0x4b110e,_0x16ede1,_0x420604,_0x3310e6){var _0x2befe9,_0x20a09c;_0x3310e6[_0x2707('0x10')]=intUtil[_0x2707('0x48')](_0x3310e6['remoteUri']);_0x3310e6[_0x2707('0x49')]=intUtil[_0x2707('0x48')](_0x3310e6[_0x2707('0x49')]);if(_0x420604&&_0x420604[_0x2707('0x4a')]){logger[_0x2707('0xc')]('[QUEUE]',_0x2707('0x4b'));_0x6947fa['recordingURL']=util[_0x2707('0xe')](_0x2707('0x4c'),_0x3310e6['serverUrl'],_0x6947fa[_0x2707('0x4d')],md5(_0x6947fa[_0x2707('0x4d')]));}else{_0x6947fa[_0x2707('0x4e')]='';}headers['Authorization']=getAuth(_0x3310e6);return getUser(_0x3310e6,_0x16ede1[_0x2707('0x4f')])['then'](function(_0xf3bfb8){_0x2befe9=_0xf3bfb8;logger[_0x2707('0xc')]('The\x20User\x20ID\x20is:',_0x2befe9['id']);return getEndUser(_0x3310e6,_0x6947fa[_0x2707('0x50')],_0x6947fa[_0x2707('0x51')]);})[_0x2707('0x19')](function(_0x5adec1){_0x20a09c=_0x5adec1;logger['info'](_0x2707('0x52'),_0x20a09c['id']);return getTicket(_0x3310e6,_0x2befe9,_0x20a09c,_0x4b110e,_0x6947fa);})[_0x2707('0x19')](function(_0x292b44){if(_0x292b44){logger[_0x2707('0xc')](_0x2707('0x53'),_0x292b44['id']);switch(_0x3310e6['type']){case'integrationTab':logger['info'](_0x2707('0x54'),_0x2707('0x55'));return request({'uri':util[_0x2707('0xe')](_0x2707('0x56'),_0x3310e6[_0x2707('0x10')],_0x2befe9['id'],_0x292b44['id']),'method':'POST'});case _0x2707('0x57'):logger[_0x2707('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2707('0xe')](_0x2707('0x58'),_0x16ede1[_0x2707('0x14')]),'trigger:browser:url',{'uri':util[_0x2707('0xe')](_0x2707('0x59'),_0x3310e6[_0x2707('0x10')],_0x292b44['id'])});break;default:logger[_0x2707('0x5a')]('[QUEUE]',_0x2707('0x5b'));}}})[_0x2707('0x5c')](function(_0x28a80e){logger[_0x2707('0x5a')](_0x2707('0x5d'),util[_0x2707('0x5e')](_0x28a80e,{'showHidden':!![],'depth':null}));});};exports[_0x2707('0x5f')]=function(_0x32befc,_0x2148b2,_0xe9512e,_0x4f2b54,_0x38acdd,_0x5316ee,_0x5d27ad){var _0x3029ce,_0x4b9451;_0x5316ee['remoteUri']=intUtil[_0x2707('0x48')](_0x5316ee[_0x2707('0x10')]);_0x5316ee[_0x2707('0x49')]=intUtil[_0x2707('0x48')](_0x5316ee[_0x2707('0x49')]);if(_0x5d27ad&&_0x5d27ad[_0x2707('0x60')]&&_0x5d27ad[_0x2707('0x60')]!==_0x2707('0x61')){logger[_0x2707('0xc')](_0x2707('0x62'),_0x2707('0x4b'));_0x2148b2['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5316ee[_0x2707('0x49')],_0x2148b2[_0x2707('0x4d')],md5(_0x2148b2[_0x2707('0x4d')]));}headers['Authorization']=getAuth(_0x5316ee);return getUser(_0x5316ee,_0x4f2b54['email'])[_0x2707('0x19')](function(_0x39c9b4){_0x3029ce=_0x39c9b4;logger[_0x2707('0xc')](_0x2707('0x63'),_0x3029ce['id']);return getEndUser(_0x5316ee,_0x2148b2[_0x2707('0x64')],_0x2148b2['destcalleridnum']);})['then'](function(_0x3c4c7b){_0x4b9451=_0x3c4c7b;logger[_0x2707('0xc')](_0x2707('0x52'),_0x4b9451['id']);return getTicket(_0x5316ee,_0x3029ce,_0x4b9451,_0xe9512e,_0x2148b2);})[_0x2707('0x19')](function(_0x19b87b){if(_0x19b87b){logger[_0x2707('0xc')](_0x2707('0x53'),_0x19b87b['id']);switch(_0x5316ee[_0x2707('0x3f')]){case _0x2707('0x65'):logger['info'](_0x2707('0x62'),_0x2707('0x55'));return request({'uri':util[_0x2707('0xe')](_0x2707('0x56'),_0x5316ee[_0x2707('0x10')],_0x3029ce['id'],_0x19b87b['id']),'method':_0x2707('0x11')});case'newTab':logger['info'](_0x2707('0x62'),_0x2707('0x66'));emit(util['format']('user:%s',_0x4f2b54['name']),'trigger:browser:url',{'uri':util[_0x2707('0xe')](_0x2707('0x59'),_0x5316ee['remoteUri'],_0x19b87b['id'])});break;default:logger[_0x2707('0x5a')](_0x2707('0x62'),_0x2707('0x5b'));}}})['catch'](function(_0x508265){logger[_0x2707('0x5a')](_0x2707('0x67'),util[_0x2707('0x5e')](_0x508265,{'showHidden':!![],'depth':null}));});};exports[_0x2707('0x68')]=function(_0x3001e5,_0xdb1de0,_0x3973a0,_0x4da6cf,_0x40b201,_0x3bedb2){var _0x319a1e,_0xe1074b;_0x3bedb2[_0x2707('0x10')]=intUtil[_0x2707('0x48')](_0x3bedb2['remoteUri']);_0x3bedb2[_0x2707('0x49')]=intUtil[_0x2707('0x48')](_0x3bedb2[_0x2707('0x49')]);if(_0x40b201&&_0x40b201[_0x2707('0x4a')]){logger[_0x2707('0xc')]('['+_0xdb1de0[_0x2707('0x69')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xdb1de0[_0x2707('0x4e')]=util[_0x2707('0xe')](_0x2707('0x4c'),_0x3bedb2[_0x2707('0x49')],_0xdb1de0[_0x2707('0x4d')],md5(_0xdb1de0[_0x2707('0x4d')]));}else{_0xdb1de0['recordingURL']='';}headers['Authorization']=getAuth(_0x3bedb2);return getUser(_0x3bedb2)[_0x2707('0x19')](function(_0x48a9af){_0x319a1e=_0x48a9af;logger[_0x2707('0xc')](_0x2707('0x63'),_0x319a1e['id']);return getEndUser(_0x3bedb2,_0xdb1de0[_0x2707('0x50')],_0xdb1de0[_0x2707('0x51')]);})[_0x2707('0x19')](function(_0x1783e1){_0xe1074b=_0x1783e1;logger['info'](_0x2707('0x52'),_0xe1074b['id']);return getTicket(_0x3bedb2,_0x319a1e,_0xe1074b,_0x3973a0,_0xdb1de0);})['then'](function(_0x7327da){if(_0x7327da){logger[_0x2707('0xc')]('The\x20Ticket\x20ID\x20is:',_0x7327da['id']);}})[_0x2707('0x5c')](function(_0x16dcac){logger[_0x2707('0x5a')]('['+_0xdb1de0[_0x2707('0x69')][_0x2707('0x6a')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x2707('0x5e')](_0x16dcac,{'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 dc34bab..6d63542 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 _0xd983=['/crm/v2/Calls','Call\x20created!','details','err','stack','queue','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','Outbound','The\x20Call\x20ID\x20is:','https://crm.','toUpperCase','com','calleridnum','lodash','request-promise','md5','util','./util','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','length','forEach','string','idField','content','type','variable','customVariable','Variable','name','toLowerCase','toString','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Administrator','profile','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','startCase','role','first_name','last_name','code','SUCCESS','moduleCreate','log','CREATE\x20ERROR','Zoho-oauthtoken\x20','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','administrator','Subject','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','Fields'];(function(_0xeb0ecf,_0x28b624){var _0x37e441=function(_0x3080cf){while(--_0x3080cf){_0xeb0ecf['push'](_0xeb0ecf['shift']());}};_0x37e441(++_0x28b624);}(_0xd983,0x1df));var _0x3d98=function(_0x3f7e3e,_0x2b2419){_0x3f7e3e=_0x3f7e3e-0x0;var _0x466292=_0xd983[_0x3f7e3e];return _0x466292;};'use strict';var _=require(_0x3d98('0x0'));var rp=require(_0x3d98('0x1'));var md5=require(_0x3d98('0x2'));var util=require(_0x3d98('0x3'));var intUtil=require(_0x3d98('0x4'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x3d98('0x5'));var config=require(_0x3d98('0x6'));var logger=require(_0x3d98('0x7'))(_0x3d98('0x8'));config[_0x3d98('0x9')]=_[_0x3d98('0xa')](config[_0x3d98('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x3d98('0xb'))(new Redis(config[_0x3d98('0x9')]));function emit(_0xd1051d,_0x216a00,_0x1a9f37){io['to'](_0xd1051d)[_0x3d98('0xc')](_0x216a00,_0x1a9f37);}function request(_0x274a9f){logger[_0x3d98('0xd')](_0x3d98('0xe'),JSON['stringify'](_0x274a9f));return rp(_0x274a9f);}function getCustomFields(_0x58e5bc,_0x120141){var _0x14e758={};if(_0x58e5bc[_0x3d98('0xf')]>0x0){_[_0x3d98('0x10')](_0x58e5bc,function(_0x546edd){if(_0x546edd['type']===_0x3d98('0x11')&&_0x546edd[_0x3d98('0x12')]){_0x14e758[_0x546edd[_0x3d98('0x12')]]=_0x546edd[_0x3d98('0x13')]['toString']();}else if(_0x546edd[_0x3d98('0x14')]===_0x3d98('0x15')&&_0x546edd['variableName']&&_0x546edd[_0x3d98('0x12')]&&_0x120141[_0x546edd['variableName']]){_0x14e758[_0x546edd[_0x3d98('0x12')]]=_0x120141[_0x546edd['variableName']]['toString']();}else if(_0x546edd[_0x3d98('0x14')]===_0x3d98('0x16')&&_0x546edd[_0x3d98('0x17')]&&_0x546edd['Variable'][_0x3d98('0x18')]&&_0x546edd[_0x3d98('0x12')]&&_0x120141[_0x546edd['Variable'][_0x3d98('0x18')][_0x3d98('0x19')]()]){_0x14e758[_0x546edd[_0x3d98('0x12')]]=_0x120141[_0x546edd[_0x3d98('0x17')][_0x3d98('0x18')][_0x3d98('0x19')]()][_0x3d98('0x1a')]();}});}return _0x14e758;}function getName(_0x33913a){if(_0x33913a['indexOf']('\x20')>0x0){var _0x3b6836=_0x33913a[_0x3d98('0x1b')](/ (.+)/);if(_0x3b6836[0x1]){return _0x3b6836;}}return[_0x33913a,_0x33913a];}var accountsTokens={};function getAccessToken(_0x355d9f){return new Promise(function(_0x35a40f,_0x5da20a){if(!_[_0x3d98('0x1c')](accountsTokens[_0x355d9f['id']])&&!_[_0x3d98('0x1c')](accountsTokens[_0x355d9f['id']][_0x3d98('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x355d9f['id']][_0x3d98('0x1e')])){_0x35a40f(accountsTokens[_0x355d9f['id']][_0x3d98('0x1d')]);}}var _0x54177e;switch(_0x355d9f['zone']){case'US':_0x54177e=_0x3d98('0x1f');break;case'AU':_0x54177e=_0x3d98('0x20');break;case'EU':_0x54177e=_0x3d98('0x21');break;case'IN':_0x54177e=_0x3d98('0x22');break;case'CN':_0x54177e=_0x3d98('0x23');break;default:_0x54177e=_0x3d98('0x21');break;}var _0x245ffa={'method':'POST','uri':_0x54177e+'/oauth/v2/token','qs':{'refresh_token':_0x355d9f['refreshToken'],'client_id':_0x355d9f[_0x3d98('0x24')],'client_secret':_0x355d9f['clientSecret'],'grant_type':_0x3d98('0x25')},'json':!![]};return rp(_0x245ffa)[_0x3d98('0x26')](function(_0x1d6673){accountsTokens[_0x355d9f['id']]={'access_token':_0x1d6673['access_token'],'expires_in':moment()[_0x3d98('0x27')](_0x1d6673[_0x3d98('0x1e')],_0x3d98('0x28'))};_0x35a40f(_0x1d6673[_0x3d98('0x1d')]);})[_0x3d98('0x29')](function(_0x489a9a){logger[_0x3d98('0x2a')](_0x3d98('0x2b'),_0x489a9a['stack']);_0x5da20a(_0x489a9a);});});}function getUser(_0x27b631,_0x2502c3,_0x1c7a19,_0x56f39c){logger[_0x3d98('0x2c')]('Search\x20user');return request({'method':_0x3d98('0x2d'),'uri':util[_0x3d98('0x2e')](_0x3d98('0x2f'),_0x2502c3),'qs':{'type':_0x3d98('0x30')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x27b631},'json':!![]})[_0x3d98('0x26')](function(_0x1b393e){if(_0x1b393e[_0x3d98('0x31')]){var _0xb7f4f5=-0x1;if(_[_0x3d98('0x32')](_0x1b393e[_0x3d98('0x31')])){if(!_[_0x3d98('0x1c')](_0x56f39c)){_0xb7f4f5=_[_0x3d98('0x33')](_0x1b393e['users'],function(_0x3e64bd){return _0x3e64bd[_0x3d98('0x34')]===_0x56f39c;});}if(_0xb7f4f5>=0x0){logger[_0x3d98('0x2c')](_0x3d98('0x35'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0xb7f4f5=_[_0x3d98('0x33')](_0x1b393e['users'],function(_0x20663e){return _0x20663e['profile']['name']===_0x3d98('0x36');});}return _0x1b393e[_0x3d98('0x31')][_0xb7f4f5];}else{if(_0x1b393e['user'][_0x3d98('0x37')][_0x3d98('0x18')]===_0x3d98('0x36')){logger[_0x3d98('0x2c')](_0x3d98('0x38'));user=_0x1b393e[_0x3d98('0x39')];return user;}else{logger[_0x3d98('0x2a')](_0x3d98('0x3a'),JSON[_0x3d98('0x3b')](_0x1b393e));throw new Error(_0x3d98('0x3c')+JSON['stringify'](_0x1b393e));}}}else{logger[_0x3d98('0x2a')](_0x3d98('0x3a'),JSON[_0x3d98('0x3b')](_0x1b393e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1b393e));}})[_0x3d98('0x29')](function(_0xffb2b7){console['error'](_0xffb2b7);});}function getZohoUser(_0x141e0d,_0x5375ef){return new BPromise(function(_0x5069b3,_0x1628fe){request(_0x141e0d)[_0x3d98('0x26')](function(_0x384f5b){var _0x3494a1=null;if(_0x384f5b){_0x3494a1=_0x384f5b[_0x3d98('0x3d')][0x0];_0x3494a1[_0x3d98('0x3e')]=_0x5375ef;}_0x5069b3(_0x3494a1);})[_0x3d98('0x29')](function(_0x26924b){_0x1628fe(_0x26924b);});});}function createEndUser(_0x260cb6,_0x24efe9,_0x1512ab,_0x55eb11,_0x3b67a6,_0x101e22){var _0x1512ab=getName(_0x1512ab);return request({'method':_0x3d98('0x3f'),'uri':_0x3d98('0x40')+_0x24efe9+'/crm/v2/'+_[_0x3d98('0x41')](_0x101e22['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1512ab[0x1],'First_Name':_0x1512ab[0x0],'Phone':_0x55eb11,'Owner':{'name':!_['isNil'](_0x3b67a6[_0x3d98('0x42')][_0x3d98('0x18')])?_0x3b67a6[_0x3d98('0x42')][_0x3d98('0x18')]:!_['isNil'](_0x3b67a6[_0x3d98('0x43')])?_0x3b67a6[_0x3d98('0x43')]+'\x20'+_0x3b67a6[_0x3d98('0x44')]:_0x3b67a6[_0x3d98('0x44')],'id':_0x3b67a6['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x260cb6},'json':!![]})['then'](function(_0x12c6f6){if(_0x12c6f6&&_0x12c6f6[_0x3d98('0x3d')][0x0][_0x3d98('0x45')]===_0x3d98('0x46')){var _0x4beb19=_0x12c6f6[_0x3d98('0x3d')][0x0]['details'];_0x4beb19[_0x3d98('0x3e')]=_[_0x3d98('0x41')](_0x101e22[_0x3d98('0x47')])+'s';return _0x4beb19;}logger[_0x3d98('0x2a')](_0x3d98('0x3a'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x3d98('0x3b')](data));})[_0x3d98('0x29')](function(_0x4a5ea6){console[_0x3d98('0x48')](_0x3d98('0x49'),_0x4a5ea6);});}function getEndUser(_0x4fc856,_0x42de9a,_0x300fd4,_0x9b2474,_0xce93f,_0x330bcf,_0x213f92){var _0x1fe3aa={'method':_0x3d98('0x2d'),'uri':'','headers':{'Authorization':_0x3d98('0x4a')+_0x4fc856},'json':!![]};switch(_0x213f92['moduleSearch']){case'contact_lead':_0x1fe3aa[_0x3d98('0x4b')]=_0x3d98('0x40')+_0x42de9a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xce93f+'))';return getZohoUser(_0x1fe3aa,_0x3d98('0x4c'))[_0x3d98('0x26')](function(_0x32bec4){if(_0x32bec4)return _0x32bec4;_0x1fe3aa[_0x3d98('0x4b')]='https://www.zohoapis.'+_0x42de9a+_0x3d98('0x4d')+_0xce93f+'))';return getZohoUser(_0x1fe3aa,_0x3d98('0x4e'))[_0x3d98('0x26')](function(_0x12d305){if(_0x12d305)return _0x12d305;if(_0x213f92[_0x3d98('0x47')]!=_0x3d98('0x4f')){return createEndUser(_0x4fc856,_0x42de9a,_0x9b2474,_0xce93f,_0x330bcf,_0x213f92);}else{return{};}});});break;case _0x3d98('0x50'):_0x1fe3aa[_0x3d98('0x4b')]=_0x3d98('0x40')+_0x42de9a+_0x3d98('0x51')+_0xce93f+'))';return getZohoUser(_0x1fe3aa,_0x3d98('0x4c'))[_0x3d98('0x26')](function(_0x5ad73a){if(_0x5ad73a)return _0x5ad73a;if(_0x213f92[_0x3d98('0x47')]!=_0x3d98('0x4f')){return createEndUser(_0x4fc856,_0x42de9a,_0x9b2474,_0xce93f,_0x330bcf,_0x213f92);}else{return{};}});break;case _0x3d98('0x52'):_0x1fe3aa[_0x3d98('0x4b')]=_0x3d98('0x40')+_0x42de9a+_0x3d98('0x4d')+_0xce93f+'))';return getZohoUser(_0x1fe3aa,'Leads')['then'](function(_0x592b44){if(_0x592b44)return _0x592b44;if(_0x213f92[_0x3d98('0x47')]!=_0x3d98('0x4f')){return createEndUser(_0x4fc856,_0x42de9a,_0x9b2474,_0xce93f,_0x330bcf,_0x213f92);}else{return{};}});break;}}function getCall(_0x57f827,_0x365442,_0x53fc6d,_0x1181b9,_0x53be9d,_0x3ea58c,_0x5e2af6,_0x530391){logger[_0x3d98('0x2c')](_0x3d98('0x53'));var _0x525168={};_0x525168['Owner']={'name':!_[_0x3d98('0x1c')](_0x1181b9['role'][_0x3d98('0x18')])&&!_[_0x3d98('0x1c')](_0x1181b9['profile'][_0x3d98('0x18')])&&_0x1181b9[_0x3d98('0x37')][_0x3d98('0x18')]===_0x3d98('0x54')?_0x1181b9[_0x3d98('0x42')][_0x3d98('0x18')]:!_[_0x3d98('0x1c')](_0x1181b9[_0x3d98('0x43')])?_0x1181b9[_0x3d98('0x43')]+'\x20'+_0x1181b9[_0x3d98('0x44')]:_0x1181b9['last_name'],'id':_0x1181b9['id']};_0x525168[_0x3d98('0x55')]=intUtil['getString'](_0x3ea58c[_0x3d98('0x56')],_0x5e2af6,'\x20');_0x525168['Description']=intUtil['getString'](_0x3ea58c[_0x3d98('0x57')],_0x5e2af6,'\x0a');if(_0x53be9d[_0x3d98('0x3e')]===_0x3d98('0x4c')){_0x525168[_0x3d98('0x58')]={'name':!_[_0x3d98('0x1c')](_0x53be9d[_0x3d98('0x59')])?_0x53be9d[_0x3d98('0x59')]:!_[_0x3d98('0x1c')](_0x53be9d[_0x3d98('0x5a')])?_0x53be9d['First_Name']+'\x20'+_0x53be9d[_0x3d98('0x5b')]:_0x53be9d[_0x3d98('0x5b')],'id':_0x53be9d['id']};}if(_0x53be9d[_0x3d98('0x3e')]===_0x3d98('0x4e')){_0x525168['What_Id']={'name':!_[_0x3d98('0x1c')](_0x53be9d[_0x3d98('0x59')])?_0x53be9d[_0x3d98('0x59')]:!_['isNil'](_0x53be9d['First_Name'])?_0x53be9d[_0x3d98('0x5a')]+'\x20'+_0x53be9d[_0x3d98('0x5b')]:_0x53be9d[_0x3d98('0x5b')],'id':_0x53be9d['id']};_0x525168['$se_module']=_[_0x3d98('0x41')](_0x53be9d['enduserType']);}if(_0x5e2af6[_0x3d98('0x5c')]){_0x525168[_0x3d98('0x5d')]=moment[_0x3d98('0x5e')](parseInt(_0x5e2af6[_0x3d98('0x5c')])*0x3e8)[_0x3d98('0x2e')](_0x3d98('0x5f'));}else if(_0x5e2af6['answertime']&&_0x5e2af6[_0x3d98('0x60')]){_0x525168[_0x3d98('0x5d')]=moment['utc'](moment(_0x5e2af6[_0x3d98('0x60')],_0x3d98('0x61'))[_0x3d98('0x62')](moment(_0x5e2af6[_0x3d98('0x63')],_0x3d98('0x61'))))[_0x3d98('0x2e')](_0x3d98('0x5f'));}switch(_0x5e2af6[_0x3d98('0x64')]){case _0x3d98('0x65'):_0x525168[_0x3d98('0x66')]=_0x3d98('0x67');break;case _0x3d98('0x68'):case _0x3d98('0x69'):_0x525168[_0x3d98('0x66')]=_0x3d98('0x6a');break;case _0x3d98('0x6b'):_0x525168[_0x3d98('0x66')]=_0x3d98('0x6c');break;case _0x3d98('0x6d'):_0x525168[_0x3d98('0x66')]=_0x3d98('0x6e');break;case _0x3d98('0x6f'):_0x525168['Call_Result']='Timeout';default:}_0x525168[_0x3d98('0x70')]=(_0x530391==='outbound'?moment(_0x5e2af6[_0x3d98('0x63')])[_0x3d98('0x2e')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x5e2af6[_0x3d98('0x71')])[_0x3d98('0x2e')](_0x3d98('0x61')))||moment()['format'](_0x3d98('0x61'));_0x525168[_0x3d98('0x72')]=_0x530391||_0x3d98('0x73');_0x525168=_['merge'](_0x525168,getCustomFields(_0x3ea58c[_0x3d98('0x74')],_0x5e2af6));return request({'method':_0x3d98('0x3f'),'uri':'https://www.zohoapis.'+_0x365442+_0x3d98('0x75'),'headers':{'Authorization':_0x3d98('0x4a')+_0x57f827},'body':{'data':[_0x525168]},'json':!![]})['then'](function(_0x5a5fbe){if(_0x5a5fbe&&_0x5a5fbe['data'][0x0]['code']==='SUCCESS'){logger[_0x3d98('0x2c')](_0x3d98('0x76'));return{'id':_0x5a5fbe[_0x3d98('0x3d')][0x0][_0x3d98('0x77')]['id']};}})[_0x3d98('0x29')](function(_0x645236){logger[_0x3d98('0x2c')](_0x3d98('0x78'),_0x645236[_0x3d98('0x79')]);console[_0x3d98('0x48')](_0x3d98('0x78'),_0x645236);});}exports[_0x3d98('0x7a')]=function(_0x589b01,_0x570796,_0x2c16eb,_0x5b1184,_0x361675,_0x4b833c){var _0x8d97b9,_0x576ea4,_0x14be0b;_0x4b833c[_0x3d98('0x7b')]=intUtil[_0x3d98('0x7c')](_0x4b833c['host']);_0x4b833c['serverUrl']=intUtil[_0x3d98('0x7c')](_0x4b833c['serverUrl']);if(_0x361675&&_0x361675[_0x3d98('0x7d')]){logger['info'](_0x3d98('0x7e'),_0x3d98('0x7f'));_0x570796[_0x3d98('0x80')]=_0x4b833c[_0x3d98('0x81')]+_0x3d98('0x82')+_0x570796['uniqueid']+_0x3d98('0x83')+md5(_0x570796[_0x3d98('0x84')]);}else{_0x570796[_0x3d98('0x80')]='';}var _0x3047a4=_0x4b833c[_0x3d98('0x7b')]===_0x3d98('0x85')?'eu':'com';return getAccessToken(_0x4b833c)[_0x3d98('0x26')](function(_0x25e594){_0x14be0b=_0x25e594;return getUser(_0x14be0b,_0x3047a4,_0x4b833c,_0x5b1184[_0x3d98('0x34')]);})[_0x3d98('0x26')](function(_0x55ebfb){_0x8d97b9=_0x55ebfb;logger[_0x3d98('0x2c')](_0x3d98('0x86'),_0x8d97b9['id']);return getEndUser(_0x14be0b,_0x3047a4,_0x4b833c,_0x570796[_0x3d98('0x87')],_0x570796['calleridnum'],_0x8d97b9,_0x2c16eb);})[_0x3d98('0x26')](function(_0x446db9){_0x576ea4=_0x446db9;return getCall(_0x14be0b,_0x3047a4,_0x4b833c,_0x8d97b9,_0x576ea4,_0x2c16eb,_0x570796,_0x3d98('0x73'));})[_0x3d98('0x26')](function(_0x167ac1){if(_0x167ac1){logger[_0x3d98('0x2c')]('The\x20Call\x20ID\x20is:',_0x167ac1['id']);logger[_0x3d98('0x2c')](_0x3d98('0x7e'),_0x3d98('0x88'));emit(util[_0x3d98('0x2e')]('user:%s',_0x5b1184[_0x3d98('0x18')]),_0x3d98('0x89'),{'uri':'https://crm.'+_0x4b833c[_0x3d98('0x7b')]+_0x3d98('0x8a')+_0x167ac1['id']});}})['catch'](function(_0x2ebbf9){logger[_0x3d98('0x2a')](_0x3d98('0x7e'),JSON[_0x3d98('0x3b')](_0x2ebbf9));});};exports[_0x3d98('0x8b')]=function(_0xe9c9d9,_0x3eafa3,_0x395201,_0x2bd160,_0x5d8c52,_0x251824,_0x75c4ec){var _0x285bae,_0x1f0741,_0x2d68f7;_0x251824['host']=intUtil[_0x3d98('0x7c')](_0x251824[_0x3d98('0x7b')]);_0x251824[_0x3d98('0x81')]=intUtil[_0x3d98('0x7c')](_0x251824[_0x3d98('0x81')]);if(_0x75c4ec&&_0x75c4ec['recordingFormat']&&_0x75c4ec[_0x3d98('0x8c')]!==_0x3d98('0x8d')){logger[_0x3d98('0x2c')](_0x3d98('0x8e'),_0x3d98('0x7f'));_0x3eafa3[_0x3d98('0x80')]=_0x251824[_0x3d98('0x81')]+_0x3d98('0x82')+_0x3eafa3['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x3eafa3['uniqueid']);}var _0x1935e5=_0x251824[_0x3d98('0x7b')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x251824)[_0x3d98('0x26')](function(_0x1b0a64){_0x2d68f7=_0x1b0a64;return getUser(_0x2d68f7,_0x1935e5,_0x251824,_0x2bd160[_0x3d98('0x34')]);})[_0x3d98('0x26')](function(_0x33d801){_0x285bae=_0x33d801;logger['info'](_0x3d98('0x86'),_0x285bae['id']);return getEndUser(_0x2d68f7,_0x1935e5,_0x251824,_0x3eafa3['destcalleridname'],_0x3eafa3['destcalleridnum'],_0x285bae,_0x395201);})[_0x3d98('0x26')](function(_0x53d2e2){_0x1f0741=_0x53d2e2;return getCall(_0x2d68f7,_0x1935e5,_0x251824,_0x285bae,_0x1f0741,_0x395201,_0x3eafa3,_0x3d98('0x8f'));})[_0x3d98('0x26')](function(_0x49ef96){if(_0x49ef96){logger[_0x3d98('0x2c')](_0x3d98('0x90'),_0x49ef96['id']);logger['info'](_0x3d98('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x2bd160['name']),'trigger:browser:url',{'uri':_0x3d98('0x91')+_0x251824[_0x3d98('0x7b')]+_0x3d98('0x8a')+_0x49ef96['id']});}})[_0x3d98('0x29')](function(_0x2aff9a){logger[_0x3d98('0x2a')](_0x3d98('0x8e'),JSON['stringify'](_0x2aff9a));});};exports['unmanaged']=function(_0x3c34af,_0xc589df,_0x3eb946,_0x48641d,_0x48119c,_0x2db0ed){var _0x5bf589,_0x79a430,_0x422db7;_0x2db0ed[_0x3d98('0x7b')]=intUtil['stripTrailingSlash'](_0x2db0ed[_0x3d98('0x7b')]);_0x2db0ed[_0x3d98('0x81')]=intUtil['stripTrailingSlash'](_0x2db0ed[_0x3d98('0x81')]);if(_0x48119c&&_0x48119c[_0x3d98('0x7d')]){logger[_0x3d98('0x2c')]('['+_0xc589df[_0x3d98('0x64')][_0x3d98('0x92')]()+']','Recording\x20is\x20enabled!');_0xc589df['recordingURL']=_0x2db0ed[_0x3d98('0x81')]+_0x3d98('0x82')+_0xc589df[_0x3d98('0x84')]+_0x3d98('0x83')+md5(_0xc589df['uniqueid']);}else{_0xc589df[_0x3d98('0x80')]='';}var _0x585617=_0x2db0ed[_0x3d98('0x7b')]==='zoho.eu'?'eu':_0x3d98('0x93');return getAccessToken(_0x2db0ed)[_0x3d98('0x26')](function(_0x1f68e9){_0x422db7=_0x1f68e9;return getUser(_0x422db7,_0x585617,_0x2db0ed);})[_0x3d98('0x26')](function(_0x9cb261){_0x5bf589=_0x9cb261;logger[_0x3d98('0x2c')]('The\x20User\x20ID\x20is:',_0x5bf589['id']);return getEndUser(_0x422db7,_0x585617,_0x2db0ed,_0xc589df[_0x3d98('0x87')],_0xc589df[_0x3d98('0x94')],_0x5bf589,_0x3eb946);})[_0x3d98('0x26')](function(_0x46b22b){_0x79a430=_0x46b22b;return getCall(_0x422db7,_0x585617,_0x2db0ed,_0x5bf589,_0x79a430,_0x3eb946,_0xc589df,_0x3d98('0x73'));})['then'](function(_0x1abd2e){if(_0x1abd2e){logger[_0x3d98('0x2c')](_0x3d98('0x90'),_0x1abd2e['id']);}})[_0x3d98('0x29')](function(_0x1f8e79){logger[_0x3d98('0x2a')]('['+_0xc589df['lastevent'][_0x3d98('0x92')]()+']',JSON['stringify'](_0x1f8e79));});}; \ No newline at end of file +var _0x1af1=['calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','emit','debug','[HTTP]','length','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','enduserType','startCase','moduleCreate','role','first_name','last_name','data','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Called','complete','Call_Result','Answered','rejected','Rejected','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','[OUTBOUND]','destcalleridname','trigger:browser:url','unmanaged','toUpperCase','/api/voice/recordings/'];(function(_0x320c61,_0x433cfe){var _0x228945=function(_0x152888){while(--_0x152888){_0x320c61['push'](_0x320c61['shift']());}};_0x228945(++_0x433cfe);}(_0x1af1,0x133));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var rp=require(_0x11af('0x1'));var md5=require(_0x11af('0x2'));var util=require(_0x11af('0x3'));var intUtil=require(_0x11af('0x4'));var moment=require(_0x11af('0x5'));var Redis=require(_0x11af('0x6'));var BPromise=require(_0x11af('0x7'));var config=require(_0x11af('0x8'));var logger=require(_0x11af('0x9'))('zoho');config[_0x11af('0xa')]=_['defaults'](config[_0x11af('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x11af('0xa')]));function emit(_0x590e7d,_0x364f87,_0x4c8bf1){io['to'](_0x590e7d)[_0x11af('0xb')](_0x364f87,_0x4c8bf1);}function request(_0x23b31a){logger[_0x11af('0xc')](_0x11af('0xd'),JSON['stringify'](_0x23b31a));return rp(_0x23b31a);}function getCustomFields(_0x4214bd,_0x25f505){var _0x21f4f1={};if(_0x4214bd[_0x11af('0xe')]>0x0){_[_0x11af('0xf')](_0x4214bd,function(_0x2936ee){if(_0x2936ee[_0x11af('0x10')]===_0x11af('0x11')&&_0x2936ee[_0x11af('0x12')]){_0x21f4f1[_0x2936ee[_0x11af('0x12')]]=_0x2936ee['content'][_0x11af('0x13')]();}else if(_0x2936ee[_0x11af('0x10')]===_0x11af('0x14')&&_0x2936ee['variableName']&&_0x2936ee[_0x11af('0x12')]&&_0x25f505[_0x2936ee[_0x11af('0x15')]]){_0x21f4f1[_0x2936ee['idField']]=_0x25f505[_0x2936ee[_0x11af('0x15')]][_0x11af('0x13')]();}else if(_0x2936ee[_0x11af('0x10')]===_0x11af('0x16')&&_0x2936ee[_0x11af('0x17')]&&_0x2936ee[_0x11af('0x17')][_0x11af('0x18')]&&_0x2936ee[_0x11af('0x12')]&&_0x25f505[_0x2936ee[_0x11af('0x17')][_0x11af('0x18')][_0x11af('0x19')]()]){_0x21f4f1[_0x2936ee[_0x11af('0x12')]]=_0x25f505[_0x2936ee[_0x11af('0x17')][_0x11af('0x18')][_0x11af('0x19')]()][_0x11af('0x13')]();}});}return _0x21f4f1;}function getName(_0x66ef3f){if(_0x66ef3f[_0x11af('0x1a')]('\x20')>0x0){var _0x2a1de1=_0x66ef3f[_0x11af('0x1b')](/ (.+)/);if(_0x2a1de1[0x1]){return _0x2a1de1;}}return[_0x66ef3f,_0x66ef3f];}var accountsTokens={};function getAccessToken(_0x55940a){return new Promise(function(_0x33e92f,_0x2e2bf5){if(!_['isNil'](accountsTokens[_0x55940a['id']])&&!_[_0x11af('0x1c')](accountsTokens[_0x55940a['id']][_0x11af('0x1d')])){if(moment()[_0x11af('0x1e')](accountsTokens[_0x55940a['id']][_0x11af('0x1f')])){_0x33e92f(accountsTokens[_0x55940a['id']]['access_token']);}}var _0x2f7ac8;switch(_0x55940a[_0x11af('0x20')]){case'US':_0x2f7ac8=_0x11af('0x21');break;case'AU':_0x2f7ac8=_0x11af('0x22');break;case'EU':_0x2f7ac8='https://accounts.zoho.eu';break;case'IN':_0x2f7ac8=_0x11af('0x23');break;case'CN':_0x2f7ac8=_0x11af('0x24');break;default:_0x2f7ac8=_0x11af('0x25');break;}var _0x54fca2={'method':_0x11af('0x26'),'uri':_0x2f7ac8+'/oauth/v2/token','qs':{'refresh_token':_0x55940a['refreshToken'],'client_id':_0x55940a['clientId'],'client_secret':_0x55940a[_0x11af('0x27')],'grant_type':_0x11af('0x28')},'json':!![]};return rp(_0x54fca2)[_0x11af('0x29')](function(_0x3c1068){accountsTokens[_0x55940a['id']]={'access_token':_0x3c1068[_0x11af('0x1d')],'expires_in':moment()[_0x11af('0x2a')](_0x3c1068[_0x11af('0x1f')],_0x11af('0x2b'))};_0x33e92f(_0x3c1068[_0x11af('0x1d')]);})[_0x11af('0x2c')](function(_0x152751){logger['error'](_0x11af('0x2d'),_0x152751[_0x11af('0x2e')]);_0x2e2bf5(_0x152751);});});}function getUser(_0x31e05e,_0x11eafc,_0xfc1d23,_0x4bdc20){logger[_0x11af('0x2f')]('Search\x20user');return request({'method':_0x11af('0x30'),'uri':util[_0x11af('0x31')](_0x11af('0x32'),_0x11eafc),'qs':{'type':_0x11af('0x33')},'headers':{'Authorization':_0x11af('0x34')+_0x31e05e},'json':!![]})[_0x11af('0x29')](function(_0x190df4){if(_0x190df4['users']){var _0x3bfbae=-0x1;if(_[_0x11af('0x35')](_0x190df4[_0x11af('0x36')])){if(!_[_0x11af('0x1c')](_0x4bdc20)){_0x3bfbae=_[_0x11af('0x37')](_0x190df4['users'],function(_0x216947){return _0x216947[_0x11af('0x38')]===_0x4bdc20;});}if(_0x3bfbae>=0x0){logger['info'](_0x11af('0x39'));}else{logger['info'](_0x11af('0x3a'));_0x3bfbae=_[_0x11af('0x37')](_0x190df4[_0x11af('0x36')],function(_0x30d952){return _0x30d952['profile'][_0x11af('0x18')]===_0x11af('0x3b');});}return _0x190df4[_0x11af('0x36')][_0x3bfbae];}else{if(_0x190df4['user']['profile']['name']===_0x11af('0x3b')){logger[_0x11af('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x190df4['user'];return user;}else{logger[_0x11af('0x3c')](_0x11af('0x3d'),JSON['stringify'](_0x190df4));throw new Error(_0x11af('0x3e')+JSON[_0x11af('0x3f')](_0x190df4));}}}else{logger[_0x11af('0x3c')](_0x11af('0x3d'),JSON['stringify'](_0x190df4));throw new Error(_0x11af('0x3e')+JSON[_0x11af('0x3f')](_0x190df4));}})[_0x11af('0x2c')](function(_0x1ff443){console['error'](_0x1ff443);});}function getZohoUser(_0x413858,_0x497633){return new BPromise(function(_0x22fb61,_0x5f07e6){request(_0x413858)[_0x11af('0x29')](function(_0x32fb5b){var _0x2f4c99=null;if(_0x32fb5b){_0x2f4c99=_0x32fb5b['data'][0x0];_0x2f4c99[_0x11af('0x40')]=_0x497633;}_0x22fb61(_0x2f4c99);})[_0x11af('0x2c')](function(_0x48329a){_0x5f07e6(_0x48329a);});});}function createEndUser(_0x479965,_0x2ae7d3,_0x5944b5,_0x4e89b7,_0x51318a,_0x3840d2){var _0x5944b5=getName(_0x5944b5);return request({'method':_0x11af('0x26'),'uri':'https://www.zohoapis.'+_0x2ae7d3+'/crm/v2/'+_[_0x11af('0x41')](_0x3840d2[_0x11af('0x42')])+'s','body':{'data':[{'Last_Name':_0x5944b5[0x1],'First_Name':_0x5944b5[0x0],'Phone':_0x4e89b7,'Owner':{'name':!_[_0x11af('0x1c')](_0x51318a[_0x11af('0x43')][_0x11af('0x18')])?_0x51318a[_0x11af('0x43')]['name']:!_[_0x11af('0x1c')](_0x51318a[_0x11af('0x44')])?_0x51318a[_0x11af('0x44')]+'\x20'+_0x51318a[_0x11af('0x45')]:_0x51318a[_0x11af('0x45')],'id':_0x51318a['id']}}]},'headers':{'Authorization':_0x11af('0x34')+_0x479965},'json':!![]})[_0x11af('0x29')](function(_0x436ac5){if(_0x436ac5&&_0x436ac5[_0x11af('0x46')][0x0][_0x11af('0x47')]==='SUCCESS'){var _0x5bf92e=_0x436ac5[_0x11af('0x46')][0x0][_0x11af('0x48')];_0x5bf92e['enduserType']=_['startCase'](_0x3840d2['moduleCreate'])+'s';return _0x5bf92e;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x11af('0x3f')](data));throw new Error(_0x11af('0x49')+JSON['stringify'](data));})[_0x11af('0x2c')](function(_0x2742f0){console[_0x11af('0x4a')](_0x11af('0x4b'),_0x2742f0);});}function getEndUser(_0x544dc1,_0x3daf00,_0x2ec67e,_0x5ef2f4,_0x13bec0,_0x2fa899,_0x5abcb6){var _0x338003={'method':_0x11af('0x30'),'uri':'','headers':{'Authorization':_0x11af('0x34')+_0x544dc1},'json':!![]};switch(_0x5abcb6[_0x11af('0x4c')]){case _0x11af('0x4d'):_0x338003[_0x11af('0x4e')]=_0x11af('0x4f')+_0x3daf00+_0x11af('0x50')+_0x13bec0+'))';return getZohoUser(_0x338003,_0x11af('0x51'))[_0x11af('0x29')](function(_0x32c532){if(_0x32c532)return _0x32c532;_0x338003['uri']=_0x11af('0x4f')+_0x3daf00+_0x11af('0x52')+_0x13bec0+'))';return getZohoUser(_0x338003,_0x11af('0x53'))[_0x11af('0x29')](function(_0x4818b5){if(_0x4818b5)return _0x4818b5;if(_0x5abcb6[_0x11af('0x42')]!=_0x11af('0x54')){return createEndUser(_0x544dc1,_0x3daf00,_0x5ef2f4,_0x13bec0,_0x2fa899,_0x5abcb6);}else{return{};}});});break;case _0x11af('0x55'):_0x338003[_0x11af('0x4e')]=_0x11af('0x4f')+_0x3daf00+_0x11af('0x50')+_0x13bec0+'))';return getZohoUser(_0x338003,'Contacts')[_0x11af('0x29')](function(_0x4c52de){if(_0x4c52de)return _0x4c52de;if(_0x5abcb6['moduleCreate']!=_0x11af('0x54')){return createEndUser(_0x544dc1,_0x3daf00,_0x5ef2f4,_0x13bec0,_0x2fa899,_0x5abcb6);}else{return{};}});break;case _0x11af('0x56'):_0x338003[_0x11af('0x4e')]=_0x11af('0x4f')+_0x3daf00+_0x11af('0x52')+_0x13bec0+'))';return getZohoUser(_0x338003,'Leads')['then'](function(_0x33dba3){if(_0x33dba3)return _0x33dba3;if(_0x5abcb6[_0x11af('0x42')]!=_0x11af('0x54')){return createEndUser(_0x544dc1,_0x3daf00,_0x5ef2f4,_0x13bec0,_0x2fa899,_0x5abcb6);}else{return{};}});break;}}function getCall(_0x516516,_0x11ab76,_0x149aa3,_0x4350cf,_0xf55813,_0x2120b4,_0x43d774,_0x2fe470){logger['info'](_0x11af('0x57'));var _0x4dd2e7={};_0x4dd2e7[_0x11af('0x58')]={'name':!_[_0x11af('0x1c')](_0x4350cf[_0x11af('0x43')][_0x11af('0x18')])&&!_[_0x11af('0x1c')](_0x4350cf[_0x11af('0x59')][_0x11af('0x18')])&&_0x4350cf['profile'][_0x11af('0x18')]===_0x11af('0x5a')?_0x4350cf[_0x11af('0x43')][_0x11af('0x18')]:!_[_0x11af('0x1c')](_0x4350cf[_0x11af('0x44')])?_0x4350cf['first_name']+'\x20'+_0x4350cf[_0x11af('0x45')]:_0x4350cf[_0x11af('0x45')],'id':_0x4350cf['id']};_0x4dd2e7[_0x11af('0x5b')]=intUtil[_0x11af('0x5c')](_0x2120b4['Subjects'],_0x43d774,'\x20');_0x4dd2e7[_0x11af('0x5d')]=intUtil['getString'](_0x2120b4[_0x11af('0x5e')],_0x43d774,'\x0a');if(_0xf55813[_0x11af('0x40')]===_0x11af('0x51')){_0x4dd2e7['Who_Id']={'name':!_[_0x11af('0x1c')](_0xf55813[_0x11af('0x5f')])?_0xf55813[_0x11af('0x5f')]:!_[_0x11af('0x1c')](_0xf55813[_0x11af('0x60')])?_0xf55813[_0x11af('0x60')]+'\x20'+_0xf55813[_0x11af('0x61')]:_0xf55813[_0x11af('0x61')],'id':_0xf55813['id']};}if(_0xf55813[_0x11af('0x40')]===_0x11af('0x53')){_0x4dd2e7[_0x11af('0x62')]={'name':!_['isNil'](_0xf55813[_0x11af('0x5f')])?_0xf55813[_0x11af('0x5f')]:!_['isNil'](_0xf55813[_0x11af('0x60')])?_0xf55813[_0x11af('0x60')]+'\x20'+_0xf55813[_0x11af('0x61')]:_0xf55813[_0x11af('0x61')],'id':_0xf55813['id']};_0x4dd2e7[_0x11af('0x63')]=_[_0x11af('0x41')](_0xf55813[_0x11af('0x40')]);}if(_0x43d774['talktime']){_0x4dd2e7[_0x11af('0x64')]=moment[_0x11af('0x65')](parseInt(_0x43d774[_0x11af('0x66')])*0x3e8)[_0x11af('0x31')](_0x11af('0x67'));}else if(_0x43d774[_0x11af('0x68')]&&_0x43d774['endtime']){_0x4dd2e7[_0x11af('0x64')]=moment[_0x11af('0x65')](moment(_0x43d774[_0x11af('0x69')],_0x11af('0x6a'))[_0x11af('0x6b')](moment(_0x43d774[_0x11af('0x6c')],_0x11af('0x6a'))))[_0x11af('0x31')](_0x11af('0x67'));}switch(_0x43d774['lastevent']){case _0x11af('0x6d'):_0x4dd2e7['Call_Result']=_0x11af('0x6e');break;case _0x11af('0x6f'):case'connect':_0x4dd2e7[_0x11af('0x70')]=_0x11af('0x71');break;case _0x11af('0x72'):_0x4dd2e7[_0x11af('0x70')]=_0x11af('0x73');break;case'abandoned':_0x4dd2e7[_0x11af('0x70')]=_0x11af('0x74');break;case'timeout':_0x4dd2e7['Call_Result']=_0x11af('0x75');default:}_0x4dd2e7[_0x11af('0x76')]=(_0x2fe470==='outbound'?moment(_0x43d774[_0x11af('0x6c')])['format'](_0x11af('0x6a')):moment(_0x43d774[_0x11af('0x77')])[_0x11af('0x31')](_0x11af('0x6a')))||moment()[_0x11af('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x4dd2e7[_0x11af('0x78')]=_0x2fe470||_0x11af('0x79');_0x4dd2e7=_[_0x11af('0x7a')](_0x4dd2e7,getCustomFields(_0x2120b4['Fields'],_0x43d774));return request({'method':_0x11af('0x26'),'uri':'https://www.zohoapis.'+_0x11ab76+_0x11af('0x7b'),'headers':{'Authorization':_0x11af('0x34')+_0x516516},'body':{'data':[_0x4dd2e7]},'json':!![]})[_0x11af('0x29')](function(_0xa050f7){if(_0xa050f7&&_0xa050f7[_0x11af('0x46')][0x0][_0x11af('0x47')]===_0x11af('0x7c')){logger[_0x11af('0x2f')](_0x11af('0x7d'));return{'id':_0xa050f7[_0x11af('0x46')][0x0][_0x11af('0x48')]['id']};}})[_0x11af('0x2c')](function(_0x5ced8a){logger['info'](_0x11af('0x7e'),_0x5ced8a[_0x11af('0x2e')]);console[_0x11af('0x4a')](_0x11af('0x7e'),_0x5ced8a);});}exports['queue']=function(_0x1a7cf6,_0x4eac0f,_0x1a8783,_0x402966,_0x1c83c1,_0x3783e9){var _0x40510d,_0x580d0e,_0x4c1c68;_0x3783e9[_0x11af('0x7f')]=intUtil[_0x11af('0x80')](_0x3783e9[_0x11af('0x7f')]);_0x3783e9['serverUrl']=intUtil[_0x11af('0x80')](_0x3783e9[_0x11af('0x81')]);if(_0x1c83c1&&_0x1c83c1[_0x11af('0x82')]){logger[_0x11af('0x2f')](_0x11af('0x83'),_0x11af('0x84'));_0x4eac0f[_0x11af('0x85')]=_0x3783e9[_0x11af('0x81')]+'/api/voice/recordings/'+_0x4eac0f[_0x11af('0x86')]+_0x11af('0x87')+md5(_0x4eac0f[_0x11af('0x86')]);}else{_0x4eac0f[_0x11af('0x85')]='';}var _0x4c2b17=_0x3783e9[_0x11af('0x7f')]===_0x11af('0x88')?'eu':_0x11af('0x89');return getAccessToken(_0x3783e9)[_0x11af('0x29')](function(_0x355e26){_0x4c1c68=_0x355e26;return getUser(_0x4c1c68,_0x4c2b17,_0x3783e9,_0x402966['email']);})[_0x11af('0x29')](function(_0x3941f1){_0x40510d=_0x3941f1;logger[_0x11af('0x2f')](_0x11af('0x8a'),_0x40510d['id']);return getEndUser(_0x4c1c68,_0x4c2b17,_0x3783e9,_0x4eac0f[_0x11af('0x8b')],_0x4eac0f['calleridnum'],_0x40510d,_0x1a8783);})['then'](function(_0xcda3a0){_0x580d0e=_0xcda3a0;return getCall(_0x4c1c68,_0x4c2b17,_0x3783e9,_0x40510d,_0x580d0e,_0x1a8783,_0x4eac0f,'Inbound');})[_0x11af('0x29')](function(_0x886887){if(_0x886887){logger[_0x11af('0x2f')](_0x11af('0x8c'),_0x886887['id']);logger[_0x11af('0x2f')](_0x11af('0x83'),_0x11af('0x8d'));emit(util[_0x11af('0x31')](_0x11af('0x8e'),_0x402966['name']),'trigger:browser:url',{'uri':_0x11af('0x8f')+_0x3783e9['host']+_0x11af('0x90')+_0x886887['id']});}})[_0x11af('0x2c')](function(_0x5a3520){logger[_0x11af('0x3c')](_0x11af('0x83'),JSON[_0x11af('0x3f')](_0x5a3520));});};exports[_0x11af('0x91')]=function(_0x402932,_0x5673b8,_0x1fc58a,_0x32fc04,_0x352abc,_0x244d1e,_0x2d8dc4){var _0x55af4d,_0x3537e3,_0x444add;_0x244d1e[_0x11af('0x7f')]=intUtil[_0x11af('0x80')](_0x244d1e[_0x11af('0x7f')]);_0x244d1e[_0x11af('0x81')]=intUtil[_0x11af('0x80')](_0x244d1e['serverUrl']);if(_0x2d8dc4&&_0x2d8dc4['recordingFormat']&&_0x2d8dc4['recordingFormat']!=='none'){logger['info'](_0x11af('0x92'),_0x11af('0x84'));_0x5673b8[_0x11af('0x85')]=_0x244d1e[_0x11af('0x81')]+'/api/voice/recordings/'+_0x5673b8[_0x11af('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x5673b8[_0x11af('0x86')]);}var _0x48f785=_0x244d1e[_0x11af('0x7f')]===_0x11af('0x88')?'eu':_0x11af('0x89');return getAccessToken(_0x244d1e)[_0x11af('0x29')](function(_0xfa6c59){_0x444add=_0xfa6c59;return getUser(_0x444add,_0x48f785,_0x244d1e,_0x32fc04['email']);})['then'](function(_0x2407a0){_0x55af4d=_0x2407a0;logger[_0x11af('0x2f')]('The\x20User\x20ID\x20is:',_0x55af4d['id']);return getEndUser(_0x444add,_0x48f785,_0x244d1e,_0x5673b8[_0x11af('0x93')],_0x5673b8['destcalleridnum'],_0x55af4d,_0x1fc58a);})[_0x11af('0x29')](function(_0xd10eda){_0x3537e3=_0xd10eda;return getCall(_0x444add,_0x48f785,_0x244d1e,_0x55af4d,_0x3537e3,_0x1fc58a,_0x5673b8,'Outbound');})[_0x11af('0x29')](function(_0x69b87a){if(_0x69b87a){logger[_0x11af('0x2f')](_0x11af('0x8c'),_0x69b87a['id']);logger[_0x11af('0x2f')](_0x11af('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x11af('0x8e'),_0x32fc04[_0x11af('0x18')]),_0x11af('0x94'),{'uri':_0x11af('0x8f')+_0x244d1e['host']+_0x11af('0x90')+_0x69b87a['id']});}})[_0x11af('0x2c')](function(_0x3dcea0){logger[_0x11af('0x3c')](_0x11af('0x92'),JSON[_0x11af('0x3f')](_0x3dcea0));});};exports[_0x11af('0x95')]=function(_0x1a802e,_0x2f3dd9,_0x423cbf,_0x5e672f,_0x4821b1,_0x4e20b0){var _0x55ebaf,_0x19ef1b,_0x2cc012;_0x4e20b0['host']=intUtil[_0x11af('0x80')](_0x4e20b0['host']);_0x4e20b0[_0x11af('0x81')]=intUtil[_0x11af('0x80')](_0x4e20b0[_0x11af('0x81')]);if(_0x4821b1&&_0x4821b1[_0x11af('0x82')]){logger['info']('['+_0x2f3dd9['lastevent'][_0x11af('0x96')]()+']','Recording\x20is\x20enabled!');_0x2f3dd9[_0x11af('0x85')]=_0x4e20b0[_0x11af('0x81')]+_0x11af('0x97')+_0x2f3dd9[_0x11af('0x86')]+_0x11af('0x87')+md5(_0x2f3dd9['uniqueid']);}else{_0x2f3dd9[_0x11af('0x85')]='';}var _0x3892f4=_0x4e20b0[_0x11af('0x7f')]===_0x11af('0x88')?'eu':_0x11af('0x89');return getAccessToken(_0x4e20b0)[_0x11af('0x29')](function(_0x45c005){_0x2cc012=_0x45c005;return getUser(_0x2cc012,_0x3892f4,_0x4e20b0);})['then'](function(_0x69065b){_0x55ebaf=_0x69065b;logger[_0x11af('0x2f')]('The\x20User\x20ID\x20is:',_0x55ebaf['id']);return getEndUser(_0x2cc012,_0x3892f4,_0x4e20b0,_0x2f3dd9[_0x11af('0x8b')],_0x2f3dd9[_0x11af('0x98')],_0x55ebaf,_0x423cbf);})[_0x11af('0x29')](function(_0x20f841){_0x19ef1b=_0x20f841;return getCall(_0x2cc012,_0x3892f4,_0x4e20b0,_0x55ebaf,_0x19ef1b,_0x423cbf,_0x2f3dd9,_0x11af('0x79'));})[_0x11af('0x29')](function(_0x513a2e){if(_0x513a2e){logger[_0x11af('0x2f')]('The\x20Call\x20ID\x20is:',_0x513a2e['id']);}})[_0x11af('0x2c')](function(_0x4b0254){logger[_0x11af('0x3c')]('['+_0x2f3dd9['lastevent'][_0x11af('0x96')]()+']',JSON[_0x11af('0x3f')](_0x4b0254));});}; \ 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 25b60a1..291341a 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(_0x52f1aa,_0x2115bf){var _0x309fa1=function(_0xfe7e4c){while(--_0xfe7e4c){_0x52f1aa['push'](_0x52f1aa['shift']());}};_0x309fa1(++_0x2115bf);}(_0x7a54,0x106));var _0x47a5=function(_0x2bba77,_0x1cf415){_0x2bba77=_0x2bba77-0x0;var _0x676351=_0x7a54[_0x2bba77];return _0x676351;};'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(_0x117ffd,_0x566ddf){var _0x3cc67b=function(_0x16c1db){while(--_0x16c1db){_0x117ffd['push'](_0x117ffd['shift']());}};_0x3cc67b(++_0x566ddf);}(_0x7a54,0x106));var _0x47a5=function(_0x595be4,_0x31da87){_0x595be4=_0x595be4-0x0;var _0x37bc55=_0x7a54[_0x595be4];return _0x37bc55;};'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 cd3080c..5b1b31c 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x43ba26,_0x74dd86){var _0x511481=function(_0x5f1aff){while(--_0x5f1aff){_0x43ba26['push'](_0x43ba26['shift']());}};_0x511481(++_0x74dd86);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4fb376,_0x204ff5){_0x4fb376=_0x4fb376-0x0;var _0x5e2563=_0x5f2f[_0x4fb376];return _0x5e2563;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x42cb39,_0x1c864e){var _0x39ef9d=function(_0x57a884){while(--_0x57a884){_0x42cb39['push'](_0x42cb39['shift']());}};_0x39ef9d(++_0x1c864e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d7505,_0x2acae8){_0x5d7505=_0x5d7505-0x0;var _0x398bb8=_0x5f2f[_0x5d7505];return _0x398bb8;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 3eeef4e..1b01c6c 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 _0x692c=['request','then','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x1f6988,_0x500b64){var _0x106b7c=function(_0x5e7e59){while(--_0x5e7e59){_0x1f6988['push'](_0x1f6988['shift']());}};_0x106b7c(++_0x500b64);}(_0x692c,0x6a));var _0xc692=function(_0x32169f,_0x14ee18){_0x32169f=_0x32169f-0x0;var _0x54858a=_0x692c[_0x32169f];return _0x54858a;};'use strict';var jayson=require(_0xc692('0x0'));var BPromise=require(_0xc692('0x1'));var logger=require(_0xc692('0x2'))(_0xc692('0x3'));var client=jayson[_0xc692('0x4')][_0xc692('0x5')]({'port':0x2329});client['Request']=function(_0x28de2e,_0x28614b){return new BPromise(function(_0xe1b63b,_0x2096b7){return client[_0xc692('0x6')](_0x28de2e,_0x28614b)[_0xc692('0x7')](function(_0x4f8759){logger['debug'](_0xc692('0x8'),_0xc692('0x3'),_0x28de2e,_0x28614b,_0x4f8759);if(_0x4f8759[_0xc692('0x9')]){logger[_0xc692('0x9')](_0xc692('0x8'),_0xc692('0x3'),_0x28de2e,_0x4f8759[_0xc692('0x9')]['message'],_0x28614b);return _0x2096b7(_0x4f8759[_0xc692('0x9')][_0xc692('0xa')]);}else{return _0xe1b63b(_0x4f8759[_0xc692('0xb')]);}})[_0xc692('0xc')](function(_0x2ed2fd){logger['error'](_0xc692('0x8'),_0xc692('0x3'),_0x28de2e,_0x2ed2fd,_0x28614b);return _0x2096b7(_0x2ed2fd);});});};module[_0xc692('0xd')]=client; \ No newline at end of file +var _0xbe02=['http','Request','request','then','error','rpc','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x459991,_0x86a7b5){var _0x594182=function(_0x1f3739){while(--_0x1f3739){_0x459991['push'](_0x459991['shift']());}};_0x594182(++_0x86a7b5);}(_0xbe02,0x146));var _0x2be0=function(_0xe01eee,_0x14610d){_0xe01eee=_0xe01eee-0x0;var _0x28957a=_0xbe02[_0xe01eee];return _0x28957a;};'use strict';var jayson=require(_0x2be0('0x0'));var BPromise=require(_0x2be0('0x1'));var logger=require(_0x2be0('0x2'))(_0x2be0('0x3'));var client=jayson['client'][_0x2be0('0x4')]({'port':0x2329});client[_0x2be0('0x5')]=function(_0x9eb980,_0x364c99){return new BPromise(function(_0x22ed11,_0x3b824){return client[_0x2be0('0x6')](_0x9eb980,_0x364c99)[_0x2be0('0x7')](function(_0x39a2ca){logger['debug']('rpc',_0x2be0('0x3'),_0x9eb980,_0x364c99,_0x39a2ca);if(_0x39a2ca[_0x2be0('0x8')]){logger[_0x2be0('0x8')](_0x2be0('0x9'),_0x2be0('0x3'),_0x9eb980,_0x39a2ca[_0x2be0('0x8')]['message'],_0x364c99);return _0x3b824(_0x39a2ca['error']['message']);}else{return _0x22ed11(_0x39a2ca['result']);}})['catch'](function(_0x4b4487){logger[_0x2be0('0x8')](_0x2be0('0x9'),'routing',_0x9eb980,_0x4b4487,_0x364c99);return _0x3b824(_0x4b4487);});});};module[_0x2be0('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5484903..3a98b36 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 _0x5900=['./server','./realtime','./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','refresh','listen','Setting','findOne','loginMailFrequency','catch','log'];(function(_0x173898,_0x540c35){var _0x436a4e=function(_0x376a06){while(--_0x376a06){_0x173898['push'](_0x173898['shift']());}};_0x436a4e(++_0x540c35);}(_0x5900,0xd2));var _0x0590=function(_0x3e0991,_0x4f7df4){_0x3e0991=_0x3e0991-0x0;var _0xea4798=_0x5900[_0x3e0991];return _0xea4798;};'use strict';var BPromise=require('bluebird');var server=require(_0x0590('0x0'));var Realtime=require(_0x0590('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x0590('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x0590('0x3'))['db'];function initRealtime(){return BPromise[_0x0590('0x4')]()['then'](mailAccount[_0x0590('0x5')]())[_0x0590('0x6')](realtime['initMailAccounts']())[_0x0590('0x6')](function(){email[_0x0590('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x0590('0x8')](realtime,email)[_0x0590('0x6')](function(_0x149322){return initRealtime();})[_0x0590('0x6')](function(_0x1eab42){return db[_0x0590('0x9')][_0x0590('0xa')]({'attributes':['id',_0x0590('0xb')],'raw':!![]});})[_0x0590('0x6')](function(_0x5cffbc){return setInterval(initRealtime,_0x5cffbc[_0x0590('0xb')]*0x3e8);})[_0x0590('0xc')](function(_0x4c9f77){console[_0x0590('0xd')](_0x4c9f77);});}main(); \ No newline at end of file +var _0xbc82=['then','initMailAccounts','mailAccounts','Setting','findOne','log','bluebird','./rpc/mailAccount'];(function(_0x8c5047,_0x3dd03c){var _0x48b051=function(_0x362cec){while(--_0x362cec){_0x8c5047['push'](_0x8c5047['shift']());}};_0x48b051(++_0x3dd03c);}(_0xbc82,0x13e));var _0x2bc8=function(_0x53d147,_0x259f9e){_0x53d147=_0x53d147-0x0;var _0x3bc064=_0xbc82[_0x53d147];return _0x3bc064;};'use strict';var BPromise=require(_0x2bc8('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x2bc8('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()[_0x2bc8('0x2')](mailAccount['getMailAccounts']())['then'](realtime[_0x2bc8('0x3')]())['then'](function(){email['refresh'](realtime[_0x2bc8('0x4')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x20a193){return initRealtime();})[_0x2bc8('0x2')](function(_0x10ea46){return db[_0x2bc8('0x5')][_0x2bc8('0x6')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0x2bc8('0x2')](function(_0x4cc479){return setInterval(initRealtime,_0x4cc479['loginMailFrequency']*0x3e8);})['catch'](function(_0x1252fb){console[_0x2bc8('0x7')](_0x1252fb);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 12d5d4f..1c11da6 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 _0x4168=['disabled','connected','name','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','handleImapEnd','handleImapError','sendMail','smtp','send','verifySmtp','Smtp','lastSync','verify','verified','catch','moment','bluebird','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','end','error','status'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x4168,0xf3));var _0x8416=function(_0x2fae7b,_0x43f218){_0x2fae7b=_0x2fae7b-0x0;var _0x1987c7=_0x4168[_0x2fae7b];return _0x1987c7;};'use strict';var _=require('lodash');var moment=require(_0x8416('0x0'));var BPromise=require(_0x8416('0x1'));var md5=require(_0x8416('0x2'));var Redis=require(_0x8416('0x3'));var config=require(_0x8416('0x4'));var logger=require('../../../config/logger')(_0x8416('0x5'));config['redis']=_[_0x8416('0x6')](config[_0x8416('0x7')],{'host':_0x8416('0x8'),'port':0x18eb});var io=require(_0x8416('0x9'))(new Redis(config[_0x8416('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x8416('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4c69a9){logger[_0x8416('0xb')](_0x8416('0xc'));this[_0x8416('0xd')]=_0x4c69a9[_0x8416('0xd')];this[_0x8416('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x8416('0xf')][_0x8416('0x10')]=function(_0xec724a){var _0x10693e=this[_0x8416('0xd')][_0xec724a];var _0x19cc10={'id':_0x10693e['id'],'name':_0x10693e['name'],'key':_0x10693e['key'],'active':_0x10693e[_0x8416('0x11')],'Imap':{'status':_0x10693e[_0x8416('0x12')]['status'],'messageStatus':_0x10693e[_0x8416('0x12')][_0x8416('0x13')],'total':_0x10693e[_0x8416('0x12')][_0x8416('0x14')]}};if(_[_0x8416('0x15')](md5Accounts[_0xec724a])){md5Accounts[_0xec724a]={};}var _0xe7f83d=md5(JSON[_0x8416('0x16')](_0x19cc10));if(md5Accounts[_0xec724a]['md5']!==_0xe7f83d){md5Accounts[_0xec724a][_0x8416('0x2')]=_0xe7f83d;io['emit'](_0x8416('0x17'),_0x19cc10);}};EmailChannel[_0x8416('0xf')][_0x8416('0x18')]=function(_0x2dacc9){for(var _0x2b9075 in _0x2dacc9){if(_0x2dacc9[_0x8416('0x19')](_0x2b9075)){if(_0x2dacc9[_0x2b9075][_0x8416('0x12')]&&_0x2dacc9[_0x2b9075][_0x8416('0x11')]){var _0x503353=_0x2dacc9[_0x2b9075][_0x8416('0x12')];if(!this[_0x8416('0xe')]['hasOwnProperty'](_0x503353['id'])){this[_0x8416('0xe')][_0x503353['id']]=new EmailImap(_0x503353,_0x2dacc9[_0x2b9075]['email']);this[_0x8416('0xe')][_0x503353['id']]['on'](_0x8416('0x1a'),this[_0x8416('0x1b')][_0x8416('0x1c')](this,_0x2b9075));this[_0x8416('0xe')][_0x503353['id']]['on'](_0x8416('0x5'),this['handleImapEmail'][_0x8416('0x1c')](this,_0x2b9075));this[_0x8416('0xe')][_0x503353['id']]['on'](_0x8416('0x1d'),this['handleImapEnd']['bind'](this,_0x2b9075));this['imapAccounts'][_0x503353['id']]['on'](_0x8416('0x1e'),this['handleImapError'][_0x8416('0x1c')](this,_0x2b9075));}}else{if(_[_0x8416('0x15')](this['mailAccounts'][_0x2b9075][_0x8416('0x12')])){this[_0x8416('0xd')][_0x2b9075]['Imap']={};}this[_0x8416('0xd')][_0x2b9075][_0x8416('0x12')][_0x8416('0x1f')]=_0x8416('0x20');this[_0x8416('0xd')][_0x2b9075][_0x8416('0x12')][_0x8416('0x13')]='';this[_0x8416('0x10')](_0x2b9075);}}}};EmailChannel[_0x8416('0xf')][_0x8416('0x1b')]=function(_0x86243c,_0x5a54c9){if(this[_0x8416('0xd')][_0x86243c]){this[_0x8416('0xd')][_0x86243c][_0x8416('0x12')]['status']=_0x8416('0x21');this[_0x8416('0xd')][_0x86243c][_0x8416('0x12')][_0x8416('0x13')]=_0x5a54c9[_0x8416('0x22')];if(_0x5a54c9[_0x8416('0x23')]){this[_0x8416('0xd')][_0x86243c]['Imap'][_0x8416('0x14')]=_0x5a54c9[_0x8416('0x23')][_0x8416('0x14')];}return this['emit'](_0x86243c);}};EmailChannel['prototype'][_0x8416('0x24')]=function(_0x1b3002,_0x2f2eb2){logger[_0x8416('0xb')](_0x8416('0x25'),_0x2f2eb2[_0x8416('0x26')],_0x2f2eb2[_0x8416('0x27')],_0x2f2eb2[_0x8416('0x28')],_0x1b3002);if(this['mailAccounts'][_0x1b3002]){return mailAccount[_0x8416('0x29')](_0x1b3002,_0x2f2eb2)[_0x8416('0x2a')](function(_0x32663e){if(_0x32663e){logger[_0x8416('0xb')](_0x8416('0x2b'));}})['catch'](function(_0x3b6d2c){logger[_0x8416('0x1e')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x8416('0x16')](_0x3b6d2c));});}};EmailChannel[_0x8416('0xf')][_0x8416('0x2c')]=function(_0x53154b){if(this[_0x8416('0xd')][_0x53154b]&&this[_0x8416('0xd')][_0x53154b][_0x8416('0x12')]){if(this[_0x8416('0xe')][this[_0x8416('0xd')][_0x53154b][_0x8416('0x12')]['id']]){delete this['imapAccounts'][this[_0x8416('0xd')][_0x53154b][_0x8416('0x12')]['id']];}this[_0x8416('0xd')][_0x53154b]['Imap']['lastSync']=moment();this[_0x8416('0x10')](_0x53154b);}};EmailChannel['prototype'][_0x8416('0x2d')]=function(_0x13f5ab,_0x40dd76){if(this['mailAccounts'][_0x13f5ab]){this['mailAccounts'][_0x13f5ab][_0x8416('0x12')][_0x8416('0x1f')]=_0x8416('0x1e');this[_0x8416('0xd')][_0x13f5ab][_0x8416('0x12')][_0x8416('0x13')]=_0x40dd76;return this[_0x8416('0x10')](_0x13f5ab);}};EmailChannel['prototype'][_0x8416('0x2e')]=function(_0x800b24,_0x46518f){return this[_0x8416('0x2f')][_0x8416('0x30')](_0x800b24,_0x46518f);};EmailChannel['prototype'][_0x8416('0x31')]=function(_0x324243){var _0x455586=this;if(this[_0x8416('0xd')][_0x324243['id']]){if(_[_0x8416('0x15')](this[_0x8416('0xd')][_0x324243['id']][_0x8416('0x32')])){this[_0x8416('0xd')][_0x324243['id']][_0x8416('0x32')]={};}this['mailAccounts'][_0x324243['id']][_0x8416('0x32')][_0x8416('0x33')]=moment();return new BPromise(function(_0x434eef,_0xb02319){return _0x455586[_0x8416('0x2f')][_0x8416('0x34')](_0x324243)[_0x8416('0x2a')](function(_0x592f5e){_0x455586[_0x8416('0xd')][_0x324243['id']][_0x8416('0x32')][_0x8416('0x1f')]=_0x8416('0x35');_0x455586[_0x8416('0xd')][_0x324243['id']]['Smtp'][_0x8416('0x13')]='';_0x455586['emit'](_0x324243['id']);_0x434eef(_0x592f5e);})[_0x8416('0x36')](function(_0x2661c2){_0x455586[_0x8416('0xd')][_0x324243['id']][_0x8416('0x32')][_0x8416('0x1f')]=_0x8416('0x1e');_0x455586[_0x8416('0xd')][_0x324243['id']][_0x8416('0x32')][_0x8416('0x13')]=_0x2661c2;_0x455586[_0x8416('0x10')](_0x324243['id']);_0xb02319(_0x2661c2);});});}return this[_0x8416('0x2f')]['verify'](_0x324243);};module['exports']=EmailChannel; \ No newline at end of file +var _0x3d5d=['from','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','isNil','Smtp','verify','exports','lodash','moment','bluebird','md5','../../../config/environment','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','total','mailAccount:update','hasOwnProperty','active','box','handleImapEnd','error','handleImapError','bind','disabled','handleImapBox','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName'];(function(_0x200a88,_0xe77d83){var _0x480a20=function(_0x5ebd21){while(--_0x5ebd21){_0x200a88['push'](_0x200a88['shift']());}};_0x480a20(++_0xe77d83);}(_0x3d5d,0xa7));var _0xd3d5=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x3d5d[_0x3bef2c];return _0x331503;};'use strict';var _=require(_0xd3d5('0x0'));var moment=require(_0xd3d5('0x1'));var BPromise=require(_0xd3d5('0x2'));var md5=require(_0xd3d5('0x3'));var Redis=require('ioredis');var config=require(_0xd3d5('0x4'));var logger=require('../../../config/logger')(_0xd3d5('0x5'));config[_0xd3d5('0x6')]=_[_0xd3d5('0x7')](config[_0xd3d5('0x6')],{'host':_0xd3d5('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd3d5('0x6')]));var EmailImap=require(_0xd3d5('0x9'));var EmailSmtp=require(_0xd3d5('0xa'));var mailAccount=require(_0xd3d5('0xb'));var md5Accounts={};function EmailChannel(_0x57eb16){logger[_0xd3d5('0xc')](_0xd3d5('0xd'));this['mailAccounts']=_0x57eb16[_0xd3d5('0xe')];this[_0xd3d5('0xf')]={};this[_0xd3d5('0x10')]=new EmailSmtp();}EmailChannel[_0xd3d5('0x11')][_0xd3d5('0x12')]=function(_0x493743){var _0x43b464=this[_0xd3d5('0xe')][_0x493743];var _0x829e0b={'id':_0x43b464['id'],'name':_0x43b464[_0xd3d5('0x13')],'key':_0x43b464[_0xd3d5('0x14')],'active':_0x43b464['active'],'Imap':{'status':_0x43b464[_0xd3d5('0x15')][_0xd3d5('0x16')],'messageStatus':_0x43b464[_0xd3d5('0x15')][_0xd3d5('0x17')],'total':_0x43b464['Imap'][_0xd3d5('0x18')]}};if(_['isNil'](md5Accounts[_0x493743])){md5Accounts[_0x493743]={};}var _0x77068e=md5(JSON['stringify'](_0x829e0b));if(md5Accounts[_0x493743][_0xd3d5('0x3')]!==_0x77068e){md5Accounts[_0x493743][_0xd3d5('0x3')]=_0x77068e;io[_0xd3d5('0x12')](_0xd3d5('0x19'),_0x829e0b);}};EmailChannel['prototype']['refresh']=function(_0x2b0119){for(var _0x196a0f in _0x2b0119){if(_0x2b0119[_0xd3d5('0x1a')](_0x196a0f)){if(_0x2b0119[_0x196a0f][_0xd3d5('0x15')]&&_0x2b0119[_0x196a0f][_0xd3d5('0x1b')]){var _0x282262=_0x2b0119[_0x196a0f][_0xd3d5('0x15')];if(!this[_0xd3d5('0xf')][_0xd3d5('0x1a')](_0x282262['id'])){this[_0xd3d5('0xf')][_0x282262['id']]=new EmailImap(_0x282262,_0x2b0119[_0x196a0f][_0xd3d5('0x5')]);this[_0xd3d5('0xf')][_0x282262['id']]['on'](_0xd3d5('0x1c'),this['handleImapBox']['bind'](this,_0x196a0f));this[_0xd3d5('0xf')][_0x282262['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x196a0f));this[_0xd3d5('0xf')][_0x282262['id']]['on']('end',this[_0xd3d5('0x1d')]['bind'](this,_0x196a0f));this[_0xd3d5('0xf')][_0x282262['id']]['on'](_0xd3d5('0x1e'),this[_0xd3d5('0x1f')][_0xd3d5('0x20')](this,_0x196a0f));}}else{if(_['isNil'](this[_0xd3d5('0xe')][_0x196a0f][_0xd3d5('0x15')])){this[_0xd3d5('0xe')][_0x196a0f][_0xd3d5('0x15')]={};}this['mailAccounts'][_0x196a0f][_0xd3d5('0x15')][_0xd3d5('0x16')]=_0xd3d5('0x21');this[_0xd3d5('0xe')][_0x196a0f][_0xd3d5('0x15')]['messageStatus']='';this[_0xd3d5('0x12')](_0x196a0f);}}}};EmailChannel[_0xd3d5('0x11')][_0xd3d5('0x22')]=function(_0xc467f8,_0x2035c6){if(this[_0xd3d5('0xe')][_0xc467f8]){this['mailAccounts'][_0xc467f8][_0xd3d5('0x15')][_0xd3d5('0x16')]=_0xd3d5('0x23');this['mailAccounts'][_0xc467f8][_0xd3d5('0x15')]['messageStatus']=_0x2035c6[_0xd3d5('0x13')];if(_0x2035c6[_0xd3d5('0x24')]){this['mailAccounts'][_0xc467f8][_0xd3d5('0x15')][_0xd3d5('0x18')]=_0x2035c6[_0xd3d5('0x24')]['total'];}return this[_0xd3d5('0x12')](_0xc467f8);}};EmailChannel[_0xd3d5('0x11')][_0xd3d5('0x25')]=function(_0x54158d,_0x390413){logger[_0xd3d5('0xc')](_0xd3d5('0x26'),_0x390413[_0xd3d5('0x27')],_0x390413[_0xd3d5('0x28')],_0x390413[_0xd3d5('0x29')],_0x54158d);if(this[_0xd3d5('0xe')][_0x54158d]){return mailAccount['notify'](_0x54158d,_0x390413)[_0xd3d5('0x2a')](function(_0x3ca07c){if(_0x3ca07c){logger[_0xd3d5('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0xd3d5('0x2b')](function(_0x1ce434){logger[_0xd3d5('0x1e')](_0xd3d5('0x2c'),JSON['stringify'](_0x1ce434));});}};EmailChannel[_0xd3d5('0x11')][_0xd3d5('0x1d')]=function(_0x286f64){if(this[_0xd3d5('0xe')][_0x286f64]&&this[_0xd3d5('0xe')][_0x286f64][_0xd3d5('0x15')]){if(this['imapAccounts'][this['mailAccounts'][_0x286f64][_0xd3d5('0x15')]['id']]){delete this[_0xd3d5('0xf')][this['mailAccounts'][_0x286f64][_0xd3d5('0x15')]['id']];}this[_0xd3d5('0xe')][_0x286f64]['Imap'][_0xd3d5('0x2d')]=moment();this['emit'](_0x286f64);}};EmailChannel['prototype'][_0xd3d5('0x1f')]=function(_0x4b5c7d,_0x201d38){if(this['mailAccounts'][_0x4b5c7d]){this[_0xd3d5('0xe')][_0x4b5c7d][_0xd3d5('0x15')][_0xd3d5('0x16')]='error';this[_0xd3d5('0xe')][_0x4b5c7d][_0xd3d5('0x15')][_0xd3d5('0x17')]=_0x201d38;return this[_0xd3d5('0x12')](_0x4b5c7d);}};EmailChannel['prototype'][_0xd3d5('0x2e')]=function(_0x24adcd,_0x1bdd74){return this[_0xd3d5('0x10')]['send'](_0x24adcd,_0x1bdd74);};EmailChannel[_0xd3d5('0x11')][_0xd3d5('0x2f')]=function(_0x4dcaa2){var _0x172161=this;if(this['mailAccounts'][_0x4dcaa2['id']]){if(_[_0xd3d5('0x30')](this[_0xd3d5('0xe')][_0x4dcaa2['id']]['Smtp'])){this[_0xd3d5('0xe')][_0x4dcaa2['id']][_0xd3d5('0x31')]={};}this[_0xd3d5('0xe')][_0x4dcaa2['id']][_0xd3d5('0x31')][_0xd3d5('0x2d')]=moment();return new BPromise(function(_0x11c73d,_0x52914d){return _0x172161[_0xd3d5('0x10')][_0xd3d5('0x32')](_0x4dcaa2)[_0xd3d5('0x2a')](function(_0x413ea3){_0x172161[_0xd3d5('0xe')][_0x4dcaa2['id']][_0xd3d5('0x31')][_0xd3d5('0x16')]='verified';_0x172161[_0xd3d5('0xe')][_0x4dcaa2['id']][_0xd3d5('0x31')][_0xd3d5('0x17')]='';_0x172161[_0xd3d5('0x12')](_0x4dcaa2['id']);_0x11c73d(_0x413ea3);})[_0xd3d5('0x2b')](function(_0x5d194c){_0x172161['mailAccounts'][_0x4dcaa2['id']][_0xd3d5('0x31')][_0xd3d5('0x16')]=_0xd3d5('0x1e');_0x172161[_0xd3d5('0xe')][_0x4dcaa2['id']][_0xd3d5('0x31')][_0xd3d5('0x17')]=_0x5d194c;_0x172161[_0xd3d5('0x12')](_0x4dcaa2['id']);_0x52914d(_0x5d194c);});});}return this[_0xd3d5('0x10')][_0xd3d5('0x32')](_0x4dcaa2);};module[_0xd3d5('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 8cf1ce7..fa2c53b 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 _0xad3a=['body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','handleFetchEnd','handleFetchError','handleEnd','stringify','textCode','upperFirst','exports','imap','lodash','mailparser','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','email','INBOX','once','ready','handleReady','bind','end','error','connect','prototype','getAccount','connTimeout','authTimeout','service','password','host','port','tls','user','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleError','length','fetch','message','handleFetchMessage','closeBox'];(function(_0x19d97c,_0x3b36a7){var _0xee8c=function(_0x2a9dc2){while(--_0x2a9dc2){_0x19d97c['push'](_0x19d97c['shift']());}};_0xee8c(++_0x3b36a7);}(_0xad3a,0xea));var _0xaad3=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xad3a[_0x4ae625];return _0x31accf;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xaad3('0x0'));var _=require(_0xaad3('0x1'));var rs=require('randomstring');var simpleParser=require(_0xaad3('0x2'))[_0xaad3('0x3')];var Iconv=require(_0xaad3('0x4'))[_0xaad3('0x5')];var EventEmitter=require('events')[_0xaad3('0x6')];var utils=require('./utils');var logger=require(_0xaad3('0x7'))(_0xaad3('0x8'));function EmailImap(_0x3195ac,_0x3699e5){this['mailbox']=_0xaad3('0x9');this['account']=this['getAccount'](_0x3195ac,_0x3699e5);this[_0xaad3('0x0')]=new Imap(this['account']);this['imap'][_0xaad3('0xa')](_0xaad3('0xb'),this[_0xaad3('0xc')][_0xaad3('0xd')](this));this[_0xaad3('0x0')]['once'](_0xaad3('0xe'),this['handleEnd'][_0xaad3('0xd')](this));this[_0xaad3('0x0')]['on'](_0xaad3('0xf'),this['handleError'][_0xaad3('0xd')](this));this[_0xaad3('0x0')][_0xaad3('0x10')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xaad3('0x11')][_0xaad3('0x12')]=function(_0x5afb6,_0x3e5164){var _0x6efab={'connTimeout':_0x5afb6['connTimeout']?_0x5afb6[_0xaad3('0x13')]*0x3e8:0x2710,'authTimeout':_0x5afb6[_0xaad3('0x14')]?_0x5afb6[_0xaad3('0x14')]*0x3e8:0x1388};if(_['isNil'](_0x5afb6[_0xaad3('0x15')])){if(_0x5afb6['authentication']){_0x6efab['user']=_0x5afb6['user'];_0x6efab[_0xaad3('0x16')]=_0x5afb6[_0xaad3('0x16')];}_0x6efab[_0xaad3('0x17')]=_0x5afb6[_0xaad3('0x17')];_0x6efab['port']=_0x5afb6[_0xaad3('0x18')]||0x3e1;if(_0x5afb6[_0xaad3('0x19')]){_0x6efab[_0xaad3('0x19')]=!![];}else{_0x6efab[_0xaad3('0x19')]=![];_0x6efab['autotls']='required';}}else{_0x6efab[_0xaad3('0x1a')]=_0x5afb6['user'];_0x6efab[_0xaad3('0x16')]=_0x5afb6['password'];_0x6efab[_0xaad3('0x17')]=utils[_0xaad3('0x1b')](_0x5afb6[_0xaad3('0x15')]);_0x6efab['port']=0x3e1;_0x6efab[_0xaad3('0x19')]=!![];}_0x6efab[_0xaad3('0x8')]=_0x3e5164||_0x5afb6['user']||_0xaad3('0x1c');return _0x6efab;};EmailImap[_0xaad3('0x11')]['handleReady']=function(){this[_0xaad3('0x0')][_0xaad3('0x1d')](this['mailbox'],![],this[_0xaad3('0x1e')]['bind'](this));};EmailImap['prototype'][_0xaad3('0x1e')]=function(_0x9ec8c,_0x3af6e8){if(_0x9ec8c){this['handleError'](_0x9ec8c,!![]);}else{this[_0xaad3('0x1f')](_0xaad3('0x20'),_0x3af6e8);this[_0xaad3('0x21')]();}};EmailImap[_0xaad3('0x11')][_0xaad3('0x22')]=function(_0x30acd5){if(_0x30acd5){this[_0xaad3('0x23')](_0x30acd5,!![]);}else{this['imap'][_0xaad3('0xe')]();}};EmailImap[_0xaad3('0x11')][_0xaad3('0x21')]=function(){this[_0xaad3('0x0')]['search'](['UNSEEN'],this['handleReadUnseen'][_0xaad3('0xd')](this));};EmailImap[_0xaad3('0x11')]['handleReadUnseen']=function(_0x54664d,_0xe125ac){if(_0x54664d){this[_0xaad3('0x23')](_0x54664d,!![]);}else{if(_0xe125ac[_0xaad3('0x24')]){try{var _0x1751db=this['imap'][_0xaad3('0x25')](_0xe125ac,{'bodies':'','markSeen':!![]});_0x1751db['on'](_0xaad3('0x26'),this[_0xaad3('0x27')][_0xaad3('0xd')](this));_0x1751db[_0xaad3('0xa')]('error',this['handleFetchError']['bind'](this));_0x1751db['once'](_0xaad3('0xe'),this['handleFetchEnd'][_0xaad3('0xd')](this));}catch(_0x1b848b){logger[_0xaad3('0xf')](_0x1b848b);}}else{this['imap'][_0xaad3('0x28')](!![],this[_0xaad3('0x22')][_0xaad3('0xd')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x507b91,_0x3bc7a7){_0x507b91['on'](_0xaad3('0x29'),this[_0xaad3('0x2a')][_0xaad3('0xd')](this));_0x507b91[_0xaad3('0xa')]('attributes',this[_0xaad3('0x2b')][_0xaad3('0xd')](this));_0x507b91[_0xaad3('0xa')](_0xaad3('0xe'),this[_0xaad3('0x2c')][_0xaad3('0xd')](this));};EmailImap[_0xaad3('0x11')][_0xaad3('0x2a')]=function(_0x37c8c1,_0xdde98e){simpleParser(_0x37c8c1,{'Iconv':Iconv},this['handleSimpleParser'][_0xaad3('0xd')](this));};EmailImap[_0xaad3('0x11')][_0xaad3('0x2b')]=function(_0x3fb186){};EmailImap[_0xaad3('0x11')]['handleMessageEnd']=function(){};EmailImap[_0xaad3('0x11')][_0xaad3('0x2d')]=function(_0x51675c,_0x4c88d7){if(_0x51675c){logger[_0xaad3('0xf')](_0x51675c);}else{var _0x38651c=this;utils[_0xaad3('0x2e')](this[_0xaad3('0x2f')],_0x4c88d7,function(_0x35997b){_0x38651c[_0xaad3('0x1f')](_0xaad3('0x8'),_0x35997b);});}};EmailImap[_0xaad3('0x11')][_0xaad3('0x30')]=function(){this['imap'][_0xaad3('0x28')](!![],this[_0xaad3('0x22')][_0xaad3('0xd')](this));};EmailImap['prototype'][_0xaad3('0x31')]=function(_0x574896){this[_0xaad3('0x23')](_0x574896);this[_0xaad3('0x0')][_0xaad3('0x28')](!![],this[_0xaad3('0x22')][_0xaad3('0xd')](this));};EmailImap[_0xaad3('0x11')][_0xaad3('0x32')]=function(){this[_0xaad3('0x1f')](_0xaad3('0xe'));};EmailImap['prototype'][_0xaad3('0x23')]=function(_0x3e3824,_0x1f6f2c){logger[_0xaad3('0xf')]('handleError',this[_0xaad3('0x2f')][_0xaad3('0x8')],JSON[_0xaad3('0x33')](_0x3e3824));var _0x46fb84='';if(_0x3e3824){if(_0x3e3824[_0xaad3('0x34')]){_0x46fb84=_0x3e3824['textCode'];}else{for(var _0x2f4587 in _0x3e3824){if(_0x3e3824['hasOwnProperty'](_0x2f4587)){_0x46fb84+=_[_0xaad3('0x35')](_0x2f4587)+':\x20'+_0x3e3824[_0x2f4587]+'\x0a';}}}}if(_0x1f6f2c){this[_0xaad3('0x0')][_0xaad3('0xe')]();}else{this[_0xaad3('0x1f')](_0xaad3('0xf'),_0x46fb84);this['emit'](_0xaad3('0xe'));}};module[_0xaad3('0x36')]=EmailImap; \ No newline at end of file +var _0xd6ae=['message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','attributes','handleMessageAttributes','handleMessageBody','handleMessageEnd','handleEnd','stringify','hasOwnProperty','upperFirst','path','util','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','./utils','account','once','handleReady','bind','connect','inherits','prototype','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','getHost','email','anonymous@xcally.com','openBox','handleOpenBox','emit','box','handleCloseBox','handleError','end','readUnseen','UNSEEN','handleReadUnseen','length'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xd6ae,0x15e));var _0xed6a=function(_0x1fb917,_0x19eea1){_0x1fb917=_0x1fb917-0x0;var _0xa08321=_0xd6ae[_0x1fb917];return _0xa08321;};'use strict';var fs=require('fs');var path=require(_0xed6a('0x0'));var util=require(_0xed6a('0x1'));var Imap=require(_0xed6a('0x2'));var _=require(_0xed6a('0x3'));var rs=require(_0xed6a('0x4'));var simpleParser=require(_0xed6a('0x5'))[_0xed6a('0x6')];var Iconv=require('iconv')[_0xed6a('0x7')];var EventEmitter=require(_0xed6a('0x8'))['EventEmitter'];var utils=require(_0xed6a('0x9'));var logger=require('../../../config/logger')('email');function EmailImap(_0x37bec3,_0x21b5a4){this['mailbox']='INBOX';this[_0xed6a('0xa')]=this['getAccount'](_0x37bec3,_0x21b5a4);this[_0xed6a('0x2')]=new Imap(this['account']);this[_0xed6a('0x2')][_0xed6a('0xb')]('ready',this[_0xed6a('0xc')]['bind'](this));this[_0xed6a('0x2')][_0xed6a('0xb')]('end',this['handleEnd']['bind'](this));this[_0xed6a('0x2')]['on']('error',this['handleError'][_0xed6a('0xd')](this));this[_0xed6a('0x2')][_0xed6a('0xe')]();}util[_0xed6a('0xf')](EmailImap,EventEmitter);EmailImap[_0xed6a('0x10')]['getAccount']=function(_0x17e42c,_0x4dc902){var _0xb8ef6e={'connTimeout':_0x17e42c[_0xed6a('0x11')]?_0x17e42c[_0xed6a('0x11')]*0x3e8:0x2710,'authTimeout':_0x17e42c[_0xed6a('0x12')]?_0x17e42c['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x17e42c[_0xed6a('0x13')])){if(_0x17e42c[_0xed6a('0x14')]){_0xb8ef6e[_0xed6a('0x15')]=_0x17e42c[_0xed6a('0x15')];_0xb8ef6e[_0xed6a('0x16')]=_0x17e42c[_0xed6a('0x16')];}_0xb8ef6e[_0xed6a('0x17')]=_0x17e42c['host'];_0xb8ef6e[_0xed6a('0x18')]=_0x17e42c[_0xed6a('0x18')]||0x3e1;if(_0x17e42c[_0xed6a('0x19')]){_0xb8ef6e[_0xed6a('0x19')]=!![];}else{_0xb8ef6e[_0xed6a('0x19')]=![];_0xb8ef6e[_0xed6a('0x1a')]=_0xed6a('0x1b');}}else{_0xb8ef6e[_0xed6a('0x15')]=_0x17e42c[_0xed6a('0x15')];_0xb8ef6e[_0xed6a('0x16')]=_0x17e42c[_0xed6a('0x16')];_0xb8ef6e[_0xed6a('0x17')]=utils[_0xed6a('0x1c')](_0x17e42c[_0xed6a('0x13')]);_0xb8ef6e[_0xed6a('0x18')]=0x3e1;_0xb8ef6e[_0xed6a('0x19')]=!![];}_0xb8ef6e[_0xed6a('0x1d')]=_0x4dc902||_0x17e42c[_0xed6a('0x15')]||_0xed6a('0x1e');return _0xb8ef6e;};EmailImap[_0xed6a('0x10')]['handleReady']=function(){this[_0xed6a('0x2')][_0xed6a('0x1f')](this['mailbox'],![],this[_0xed6a('0x20')][_0xed6a('0xd')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x38fb71,_0x2beb05){if(_0x38fb71){this['handleError'](_0x38fb71,!![]);}else{this[_0xed6a('0x21')](_0xed6a('0x22'),_0x2beb05);this['readUnseen']();}};EmailImap[_0xed6a('0x10')][_0xed6a('0x23')]=function(_0x35e970){if(_0x35e970){this[_0xed6a('0x24')](_0x35e970,!![]);}else{this[_0xed6a('0x2')][_0xed6a('0x25')]();}};EmailImap['prototype'][_0xed6a('0x26')]=function(){this[_0xed6a('0x2')]['search']([_0xed6a('0x27')],this[_0xed6a('0x28')][_0xed6a('0xd')](this));};EmailImap[_0xed6a('0x10')][_0xed6a('0x28')]=function(_0xa30d6d,_0x2fdbef){if(_0xa30d6d){this[_0xed6a('0x24')](_0xa30d6d,!![]);}else{if(_0x2fdbef[_0xed6a('0x29')]){try{var _0x4ca9e4=this[_0xed6a('0x2')]['fetch'](_0x2fdbef,{'bodies':'','markSeen':!![]});_0x4ca9e4['on'](_0xed6a('0x2a'),this[_0xed6a('0x2b')][_0xed6a('0xd')](this));_0x4ca9e4['once'](_0xed6a('0x2c'),this[_0xed6a('0x2d')]['bind'](this));_0x4ca9e4[_0xed6a('0xb')]('end',this[_0xed6a('0x2e')][_0xed6a('0xd')](this));}catch(_0x240524){logger['error'](_0x240524);}}else{this[_0xed6a('0x2')][_0xed6a('0x2f')](!![],this[_0xed6a('0x23')][_0xed6a('0xd')](this));}}};EmailImap[_0xed6a('0x10')]['handleFetchMessage']=function(_0x3e9a10,_0x1175d0){_0x3e9a10['on']('body',this['handleMessageBody']['bind'](this));_0x3e9a10[_0xed6a('0xb')](_0xed6a('0x30'),this[_0xed6a('0x31')][_0xed6a('0xd')](this));_0x3e9a10[_0xed6a('0xb')](_0xed6a('0x25'),this['handleMessageEnd'][_0xed6a('0xd')](this));};EmailImap[_0xed6a('0x10')][_0xed6a('0x32')]=function(_0x63aced,_0x104280){simpleParser(_0x63aced,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0xed6a('0x10')]['handleMessageAttributes']=function(_0x45115d){};EmailImap[_0xed6a('0x10')][_0xed6a('0x33')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x18c4c8,_0x4af55f){if(_0x18c4c8){logger['error'](_0x18c4c8);}else{var _0x59d0f3=this;utils['parser'](this[_0xed6a('0xa')],_0x4af55f,function(_0x2193df){_0x59d0f3[_0xed6a('0x21')](_0xed6a('0x1d'),_0x2193df);});}};EmailImap[_0xed6a('0x10')][_0xed6a('0x2e')]=function(){this[_0xed6a('0x2')][_0xed6a('0x2f')](!![],this[_0xed6a('0x23')][_0xed6a('0xd')](this));};EmailImap[_0xed6a('0x10')][_0xed6a('0x2d')]=function(_0x2dde85){this[_0xed6a('0x24')](_0x2dde85);this[_0xed6a('0x2')][_0xed6a('0x2f')](!![],this[_0xed6a('0x23')][_0xed6a('0xd')](this));};EmailImap[_0xed6a('0x10')][_0xed6a('0x34')]=function(){this[_0xed6a('0x21')](_0xed6a('0x25'));};EmailImap[_0xed6a('0x10')][_0xed6a('0x24')]=function(_0x4b6f61,_0x3fb3fd){logger[_0xed6a('0x2c')](_0xed6a('0x24'),this[_0xed6a('0xa')]['email'],JSON[_0xed6a('0x35')](_0x4b6f61));var _0x2c8926='';if(_0x4b6f61){if(_0x4b6f61['textCode']){_0x2c8926=_0x4b6f61['textCode'];}else{for(var _0x2da3ac in _0x4b6f61){if(_0x4b6f61[_0xed6a('0x36')](_0x2da3ac)){_0x2c8926+=_[_0xed6a('0x37')](_0x2da3ac)+':\x20'+_0x4b6f61[_0x2da3ac]+'\x0a';}}}}if(_0x3fb3fd){this[_0xed6a('0x2')][_0xed6a('0x25')]();}else{this['emit'](_0xed6a('0x2c'),_0x2c8926);this[_0xed6a('0x21')](_0xed6a('0x25'));}};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 ef939cc..68e026f 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 _0x2259=['nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','use','verify','createTransport','toString','Not\x20verifired','exports'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x2259,0x108));var _0x9225=function(_0x158c35,_0x47ab59){_0x158c35=_0x158c35-0x0;var _0x1e7ffe=_0x2259[_0x158c35];return _0x1e7ffe;};'use strict';var nodemailer=require(_0x9225('0x0'));var BPromise=require(_0x9225('0x1'));var inlineBase64=require(_0x9225('0x2'));function EmailSmtp(){}EmailSmtp[_0x9225('0x3')][_0x9225('0x4')]=function(_0x40cfc4,_0x365cc4){return new BPromise(function(_0x179d88,_0x5067b4){var _0x3c2c20=nodemailer['createTransport'](_0x40cfc4);_0x3c2c20[_0x9225('0x5')]('compile',inlineBase64());_0x3c2c20['sendMail'](_0x365cc4,function(_0x4f2af3,_0x39d1ff){if(_0x4f2af3){_0x5067b4(_0x4f2af3['toString']());}else{_0x179d88(_0x39d1ff);}});});};EmailSmtp[_0x9225('0x3')][_0x9225('0x6')]=function(_0x1de52c){return new BPromise(function(_0x148167,_0x53c190){var _0x5687f1=nodemailer[_0x9225('0x7')](_0x1de52c);_0x5687f1[_0x9225('0x6')](function(_0x3753ef,_0x1427a8){if(_0x3753ef){_0x53c190(_0x3753ef[_0x9225('0x8')]());}else{if(_0x1427a8){_0x148167(_0x1427a8);}else{_0x53c190(_0x9225('0x9'));}}});});};module[_0x9225('0xa')]=EmailSmtp; \ No newline at end of file +var _0x7021=['prototype','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','nodemailer'];(function(_0x4d4de0,_0x192e68){var _0x21602b=function(_0x3067ca){while(--_0x3067ca){_0x4d4de0['push'](_0x4d4de0['shift']());}};_0x21602b(++_0x192e68);}(_0x7021,0xce));var _0x1702=function(_0xcbb8db,_0x1f0a12){_0xcbb8db=_0xcbb8db-0x0;var _0x2fdcac=_0x7021[_0xcbb8db];return _0x2fdcac;};'use strict';var nodemailer=require(_0x1702('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x1702('0x1')]['send']=function(_0x1d79e6,_0x35b610){return new BPromise(function(_0x4508e8,_0x164581){var _0x30557d=nodemailer[_0x1702('0x2')](_0x1d79e6);_0x30557d[_0x1702('0x3')](_0x1702('0x4'),inlineBase64());_0x30557d[_0x1702('0x5')](_0x35b610,function(_0x412f0f,_0x158f00){if(_0x412f0f){_0x164581(_0x412f0f[_0x1702('0x6')]());}else{_0x4508e8(_0x158f00);}});});};EmailSmtp[_0x1702('0x1')][_0x1702('0x7')]=function(_0x12426e){return new BPromise(function(_0x2758f8,_0x200263){var _0x4bb81f=nodemailer[_0x1702('0x2')](_0x12426e);_0x4bb81f['verify'](function(_0x4239e8,_0x28cc3f){if(_0x4239e8){_0x200263(_0x4239e8['toString']());}else{if(_0x28cc3f){_0x2758f8(_0x28cc3f);}else{_0x200263(_0x1702('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 7aa17bf..0c7b4ad 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 _0x46a8=['Title','Data','

Empty\x20message

','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','path','util','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','split','length','slice','join','Anonymous','pop','isEmpty','html','replace','body','textAsHtml','0x1?_0x3c1331[_0x846a('0x13')]():'';}return'';}function getMails(_0x52660f,_0x54b492){var _0xb9691c='';for(var _0x53f628=0x0;_0x53f628<_0x54b492[_0x846a('0xc')][_0x846a('0xf')];_0x53f628+=0x1){if(_0x54b492[_0x846a('0xc')][_0x53f628][_0x846a('0x8')]!==_0x52660f){if(!_[_0x846a('0x14')](_0xb9691c)){_0xb9691c+=',';}_0xb9691c+=_0x54b492[_0x846a('0xc')][_0x53f628][_0x846a('0xd')]||_0x54b492[_0x846a('0xc')][_0x53f628]['address']||'';_0xb9691c+='\x20<';_0xb9691c+=_0x54b492[_0x846a('0xc')][_0x53f628][_0x846a('0x8')]?_0x54b492[_0x846a('0xc')][_0x53f628][_0x846a('0x8')]:'anonymous'+random[_0x846a('0xa')](0x6)+_0x846a('0xb');_0xb9691c+='>';}}return _0xb9691c;}function parseEmail(_0x44aa8f,_0x92912c,_0x3b90e1){if(_0x92912c[_0x846a('0x15')]){var _0x54e295=/)<[^<]*)*<\/script>/gi;while(_0x54e295['test'](_0x92912c['html'])){_0x92912c[_0x846a('0x15')]=_0x92912c[_0x846a('0x15')][_0x846a('0x16')](_0x54e295,'');}_0x3b90e1[_0x846a('0x17')]=_0x92912c['html'];}else{_0x3b90e1['body']=_0x92912c[_0x846a('0x18')];}if(_0x3b90e1[_0x846a('0x17')]){_0x3b90e1[_0x846a('0x17')]=_0x3b90e1[_0x846a('0x17')][_0x846a('0x16')](/Empty\x20message

';if(_0x77f62d[_0x846a('0x38')]){for(var _0x559364=0x0;_0x559364<_0x77f62d[_0x846a('0x38')][_0x846a('0xf')];_0x559364++){var _0x13d3d0=_0x77f62d[_0x846a('0x38')][_0x559364];_0x31f8f7['message'][_0x846a('0x20')][_0x846a('0x29')]({'filename':_0x13d3d0[_0x846a('0x39')],'content':new Buffer(_0x13d3d0[_0x846a('0x3a')])});}}}_0x1a2ce0(parseEmail(_0xe03d44,_0x559ce4,_0x31f8f7));});}else{_0x559ce4[_0x846a('0x15')]=_0x846a('0x3b');_0x1a2ce0(parseEmail(_0xe03d44,_0x559ce4,_0x31f8f7));}}else{_0x1a2ce0(parseEmail(_0xe03d44,_0x559ce4,_0x31f8f7));}};exports[_0x846a('0x3c')]=function(_0x293a43){switch(_0x293a43){case'gmail':return _0x846a('0x3d');case _0x846a('0x3e'):return _0x846a('0x3f');case _0x846a('0x40'):return _0x846a('0x41');case'outlook365':return _0x846a('0x42');}return _0x846a('0x43');}; \ No newline at end of file +var _0xbc46=['join','Anonymous','pop','isEmpty','generate','test','html','replace','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','length','slice'];(function(_0x26b308,_0x397dfc){var _0x59478d=function(_0x20b4c4){while(--_0x20b4c4){_0x26b308['push'](_0x26b308['shift']());}};_0x59478d(++_0x397dfc);}(_0xbc46,0x1b1));var _0x6bc4=function(_0x55b8f0,_0x4d0a1c){_0x55b8f0=_0x55b8f0-0x0;var _0x12ec10=_0xbc46[_0x55b8f0];return _0x12ec10;};'use strict';var _=require(_0x6bc4('0x0'));var moment=require(_0x6bc4('0x1'));var random=require(_0x6bc4('0x2'));var fs=require('fs');var path=require(_0x6bc4('0x3'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0x6bc4('0x4'))(_0x6bc4('0x5'));var config=require(_0x6bc4('0x6'));function getAddress(_0x56b6da){var _0x17d3e4=_[_0x6bc4('0x7')](_0x56b6da[_0x6bc4('0x8')]);return _0x17d3e4&&_0x17d3e4[_0x6bc4('0x9')]?_0x17d3e4[_0x6bc4('0x9')]:_0x6bc4('0xa')+random['generate'](0x6)+_0x6bc4('0xb');}function getFirstName(_0x4872d4){var _0x58b22a=_[_0x6bc4('0x7')](_0x4872d4[_0x6bc4('0x8')]);if(_0x58b22a&&_0x58b22a[_0x6bc4('0xc')]){var _0x24746a=_0x58b22a['name']['split'](/\s+/);return _0x24746a[_0x6bc4('0xd')]?_0x24746a[_0x6bc4('0xe')](0x0,-0x1)[_0x6bc4('0xf')]('\x20'):_0x58b22a[_0x6bc4('0xc')];}return _0x6bc4('0x10');}function getLastName(_0x5ed468){var _0x46236c=_[_0x6bc4('0x7')](_0x5ed468[_0x6bc4('0x8')]);if(_0x46236c&&_0x46236c['name']){var _0x3e434c=_0x46236c[_0x6bc4('0xc')]['split'](/\s+/);return _0x3e434c[_0x6bc4('0xd')]>0x1?_0x3e434c[_0x6bc4('0x11')]():'';}return'';}function getMails(_0x52d7f2,_0x474bf7){var _0x2c582c='';for(var _0x57d5b7=0x0;_0x57d5b7<_0x474bf7[_0x6bc4('0x8')][_0x6bc4('0xd')];_0x57d5b7+=0x1){if(_0x474bf7[_0x6bc4('0x8')][_0x57d5b7][_0x6bc4('0x9')]!==_0x52d7f2){if(!_[_0x6bc4('0x12')](_0x2c582c)){_0x2c582c+=',';}_0x2c582c+=_0x474bf7[_0x6bc4('0x8')][_0x57d5b7]['name']||_0x474bf7[_0x6bc4('0x8')][_0x57d5b7][_0x6bc4('0x9')]||'';_0x2c582c+='\x20<';_0x2c582c+=_0x474bf7[_0x6bc4('0x8')][_0x57d5b7]['address']?_0x474bf7[_0x6bc4('0x8')][_0x57d5b7]['address']:_0x6bc4('0xa')+random[_0x6bc4('0x13')](0x6)+_0x6bc4('0xb');_0x2c582c+='>';}}return _0x2c582c;}function parseEmail(_0x3c54d3,_0x31332a,_0x49acc8){if(_0x31332a['html']){var _0x24692a=/)<[^<]*)*<\/script>/gi;while(_0x24692a[_0x6bc4('0x14')](_0x31332a[_0x6bc4('0x15')])){_0x31332a[_0x6bc4('0x15')]=_0x31332a[_0x6bc4('0x15')][_0x6bc4('0x16')](_0x24692a,'');}_0x49acc8[_0x6bc4('0x17')]=_0x31332a[_0x6bc4('0x15')];}else{_0x49acc8[_0x6bc4('0x17')]=_0x31332a[_0x6bc4('0x18')];}if(_0x49acc8['body']){_0x49acc8[_0x6bc4('0x17')]=_0x49acc8['body'][_0x6bc4('0x16')](/0x0){if(this[_0xfbd173+_0xd205('0x26')]>0x0&&this[_0xfbd173+_0xd205('0x25')]>=this[_0xfbd173+_0xd205('0x26')]){return _0xd205('0x27');}else{return _0xd205('0x28');}}else{return _0xd205('0x29');}};Agent[_0xd205('0x23')][_0xd205('0x22')]=function(){var _0x1e7264=[_0xd205('0x2a'),_0xd205('0x2b'),_0xd205('0x2c'),_0xd205('0x2d'),_0xd205('0x2e'),_0xd205('0x2f')];for(var _0x481d6c=0x0;_0x481d6c<_0x1e7264[_0xd205('0x30')];_0x481d6c+=0x1){var _0x1c3609=this[_0xd205('0x24')](_0x1e7264[_0x481d6c]);if(this[_0x1e7264[_0x481d6c]+_0xd205('0x31')]!==_0x1c3609){this[_0x1e7264[_0x481d6c]+_0xd205('0x32')]=_[_0xd205('0x33')](moment()['format']('x'));}this[_0x1e7264[_0x481d6c]+'Status']=_0x1c3609;}var _0x51fe80={'id':this['id'],'name':this[_0xd205('0x6')],'online':this[_0xd205('0x7')],'voicePause':this[_0xd205('0x8')],'chatPause':this[_0xd205('0x9')],'mailPause':this[_0xd205('0xa')],'smsPause':this[_0xd205('0xc')],'faxPause':this[_0xd205('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xd205('0x34')],'chatStatusTime':this[_0xd205('0xf')],'chatCapacity':this[_0xd205('0x10')],'chatCurrentCapacity':this[_0xd205('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xd205('0x13')],'mailCurrentCapacity':this[_0xd205('0x14')],'faxStatus':this[_0xd205('0x35')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd205('0x16')],'faxCurrentCapacity':this[_0xd205('0x36')],'smsStatus':this[_0xd205('0x17')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd205('0x19')],'smsCurrentCapacity':this[_0xd205('0x1a')],'whatsappStatus':this[_0xd205('0x1b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xd205('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xd205('0x37')],'openchannelCapacity':this[_0xd205('0x20')],'openchannelCurrentCapacity':this[_0xd205('0x38')],'busy':this[_0xd205('0x21')],'busyQueue':this['busyQueue']};var _0x37fc1a=md5(JSON['stringify'](_0x51fe80));if(this[_0xd205('0x2')]!==_0x37fc1a){this[_0xd205('0x2')]=_0x37fc1a;io['emit'](_0xd205('0x39'),_0x51fe80);}};module['exports']=Agent; \ No newline at end of file +var _0xb4f8=['working','idle','prototype','mail','chat','openchannel','sms','toNumber','format','chatStatus','mailCurrentCapacity','whatsappStatusTime','busy','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','getChannelStatus','CurrentCapacity','Capacity','maxcapacity'];(function(_0x116984,_0x269134){var _0x569c13=function(_0x38b874){while(--_0x38b874){_0x116984['push'](_0x116984['shift']());}};_0x569c13(++_0x269134);}(_0xb4f8,0x83));var _0x8b4f=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0xb4f8[_0xaa6a4];return _0xdc31a4;};'use strict';var _=require('lodash');var moment=require(_0x8b4f('0x0'));var md5=require(_0x8b4f('0x1'));var Redis=require(_0x8b4f('0x2'));var config=require(_0x8b4f('0x3'));config[_0x8b4f('0x4')]=_[_0x8b4f('0x5')](config['redis'],{'host':_0x8b4f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8b4f('0x4')]));function Agent(_0x682d0b){this['id']=_0x682d0b['id']||0x0;this[_0x8b4f('0x7')]=_0x682d0b[_0x8b4f('0x7')]||'';this[_0x8b4f('0x8')]=_0x682d0b['online']||!![];this[_0x8b4f('0x9')]=_0x682d0b[_0x8b4f('0x9')]||![];this[_0x8b4f('0xa')]=_0x682d0b['chatPause']||![];this[_0x8b4f('0xb')]=_0x682d0b[_0x8b4f('0xb')]||![];this[_0x8b4f('0xc')]=_0x682d0b[_0x8b4f('0xc')]||![];this[_0x8b4f('0xd')]=_0x682d0b['smsPause']||![];this[_0x8b4f('0xe')]=_0x682d0b[_0x8b4f('0xe')]||![];this['chatStatus']=_0x8b4f('0xf');this[_0x8b4f('0x10')]=0x0;this['chatCapacity']=_0x682d0b[_0x8b4f('0x11')]||0x0;this[_0x8b4f('0x12')]=0x0;this['mailStatus']=_0x8b4f('0xf');this[_0x8b4f('0x13')]=0x0;this[_0x8b4f('0x14')]=_0x682d0b[_0x8b4f('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x8b4f('0x15')]=_0x8b4f('0xf');this[_0x8b4f('0x16')]=0x0;this[_0x8b4f('0x17')]=_0x682d0b[_0x8b4f('0x17')]||0x0;this[_0x8b4f('0x18')]=0x0;this['smsStatus']=_0x8b4f('0xf');this[_0x8b4f('0x19')]=0x0;this[_0x8b4f('0x1a')]=_0x682d0b[_0x8b4f('0x1a')]||0x0;this[_0x8b4f('0x1b')]=0x0;this[_0x8b4f('0x1c')]=_0x8b4f('0xf');this['whatsappStatusTime']=0x0;this[_0x8b4f('0x1d')]=_0x682d0b[_0x8b4f('0x1d')]||0x0;this[_0x8b4f('0x1e')]=0x0;this[_0x8b4f('0x1f')]='unknown';this[_0x8b4f('0x20')]=0x0;this['openchannelCapacity']=_0x682d0b[_0x8b4f('0x21')]||0x0;this[_0x8b4f('0x22')]=0x0;this['busy']=![];this[_0x8b4f('0x23')]=undefined;this['md5']='';this['updateRealtime']();}Agent['prototype'][_0x8b4f('0x24')]=function(_0x17d4c9){if(this[_0x17d4c9+_0x8b4f('0x25')]>0x0){if(this[_0x17d4c9+_0x8b4f('0x26')]>0x0&&this[_0x17d4c9+'CurrentCapacity']>=this[_0x17d4c9+_0x8b4f('0x26')]){return _0x8b4f('0x27');}else{return _0x8b4f('0x28');}}else{return _0x8b4f('0x29');}};Agent[_0x8b4f('0x2a')]['updateRealtime']=function(){var _0x470145=[_0x8b4f('0x2b'),_0x8b4f('0x2c'),_0x8b4f('0x2d'),'fax',_0x8b4f('0x2e'),'whatsapp'];for(var _0x56307d=0x0;_0x56307d<_0x470145['length'];_0x56307d+=0x1){var _0x559867=this['getChannelStatus'](_0x470145[_0x56307d]);if(this[_0x470145[_0x56307d]+'Status']!==_0x559867){this[_0x470145[_0x56307d]+'StatusTime']=_[_0x8b4f('0x2f')](moment()[_0x8b4f('0x30')]('x'));}this[_0x470145[_0x56307d]+'Status']=_0x559867;}var _0x4087d4={'id':this['id'],'name':this[_0x8b4f('0x7')],'online':this[_0x8b4f('0x8')],'voicePause':this[_0x8b4f('0x9')],'chatPause':this[_0x8b4f('0xa')],'mailPause':this[_0x8b4f('0xb')],'smsPause':this[_0x8b4f('0xd')],'faxPause':this[_0x8b4f('0xc')],'openchannelPause':this[_0x8b4f('0xe')],'chatStatus':this[_0x8b4f('0x31')],'chatStatusTime':this[_0x8b4f('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x8b4f('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x8b4f('0x14')],'mailCurrentCapacity':this[_0x8b4f('0x32')],'faxStatus':this[_0x8b4f('0x15')],'faxStatusTime':this[_0x8b4f('0x16')],'faxCapacity':this[_0x8b4f('0x17')],'faxCurrentCapacity':this[_0x8b4f('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x8b4f('0x19')],'smsCapacity':this[_0x8b4f('0x1a')],'smsCurrentCapacity':this[_0x8b4f('0x1b')],'whatsappStatus':this[_0x8b4f('0x1c')],'whatsappStatusTime':this[_0x8b4f('0x33')],'whatsappCapacity':this[_0x8b4f('0x1d')],'whatsappCurrentCapacity':this[_0x8b4f('0x1e')],'openchannelStatus':this[_0x8b4f('0x1f')],'openchannelStatusTime':this[_0x8b4f('0x20')],'openchannelCapacity':this[_0x8b4f('0x21')],'openchannelCurrentCapacity':this[_0x8b4f('0x22')],'busy':this[_0x8b4f('0x34')],'busyQueue':this[_0x8b4f('0x23')]};var _0x25c172=md5(JSON[_0x8b4f('0x35')](_0x4087d4));if(this[_0x8b4f('0x1')]!==_0x25c172){this[_0x8b4f('0x1')]=_0x25c172;io[_0x8b4f('0x36')](_0x8b4f('0x37'),_0x4087d4);}};module[_0x8b4f('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fc2d18e..583176f 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 _0x6110=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','chatPause','available','stringify','chat:queue:%s','chat_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x48c53a,_0x4ac8de){var _0x5156cf=function(_0x5a1161){while(--_0x5a1161){_0x48c53a['push'](_0x48c53a['shift']());}};_0x5156cf(++_0x4ac8de);}(_0x6110,0x165));var _0x0611=function(_0x2a0cea,_0x1bdea2){_0x2a0cea=_0x2a0cea-0x0;var _0x54f991=_0x6110[_0x2a0cea];return _0x54f991;};'use strict';var _=require('lodash');var md5=require(_0x0611('0x0'));var util=require(_0x0611('0x1'));var Redis=require(_0x0611('0x2'));var config=require(_0x0611('0x3'));config[_0x0611('0x4')]=_[_0x0611('0x5')](config['redis'],{'host':_0x0611('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0611('0x4')]));function ChatQueue(_0x4b82d0){this['id']=_0x4b82d0['id']||0x0;this['name']=_0x4b82d0[_0x0611('0x7')]||'';this[_0x0611('0x8')]=_0x4b82d0[_0x0611('0x8')]||0xa;this['strategy']=_0x4b82d0[_0x0611('0x9')]||_0x0611('0xa');this[_0x0611('0xb')]=_0x4b82d0[_0x0611('0xb')];this[_0x0611('0xc')]={};this[_0x0611('0xd')]=0x0;this[_0x0611('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x0611('0xe')][_0x0611('0xf')]=function(){var _0x3f5d6f=this[_0x0611('0xc')][_0x0611('0x10')];this[_0x0611('0xc')]=_['map'](this[_0x0611('0xb')],'id');this[_0x0611('0xc')][_0x0611('0x10')]=_0x3f5d6f;};ChatQueue['prototype'][_0x0611('0x11')]=function(){this[_0x0611('0x12')]=0x0;this[_0x0611('0x13')]=0x0;for(var _0x5dbe7d=0x0;_0x5dbe7d=0x0?this[_0x0611('0x16')]:0x0;var _0x59eb04={'id':this['id'],'available':this[_0x0611('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x0611('0x7')],'paused':this['paused'],'waiting':this[_0x0611('0xd')]};var _0xefda79=md5(JSON[_0x0611('0x17')](_0x59eb04));if(this[_0x0611('0x0')]!==_0xefda79){this[_0x0611('0x0')]=_0xefda79;io['to'](util['format'](_0x0611('0x18'),_0x59eb04['name']))['emit'](_0x0611('0x19'),_0x59eb04);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x2441=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall'];(function(_0x2584d7,_0xa83dd3){var _0xfbd503=function(_0x3cb78d){while(--_0x3cb78d){_0x2584d7['push'](_0x2584d7['shift']());}};_0xfbd503(++_0xa83dd3);}(_0x2441,0x1b6));var _0x1244=function(_0x4c5642,_0x377d55){_0x4c5642=_0x4c5642-0x0;var _0x5b65be=_0x2441[_0x4c5642];return _0x5b65be;};'use strict';var _=require('lodash');var md5=require(_0x1244('0x0'));var util=require(_0x1244('0x1'));var Redis=require(_0x1244('0x2'));var config=require('../../../config/environment');config[_0x1244('0x3')]=_[_0x1244('0x4')](config[_0x1244('0x3')],{'host':_0x1244('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1244('0x3')]));function ChatQueue(_0x6f0b3d){this['id']=_0x6f0b3d['id']||0x0;this[_0x1244('0x6')]=_0x6f0b3d[_0x1244('0x6')]||'';this[_0x1244('0x7')]=_0x6f0b3d['timeout']||0xa;this[_0x1244('0x8')]=_0x6f0b3d[_0x1244('0x8')]||_0x1244('0x9');this['Agents']=_0x6f0b3d[_0x1244('0xa')];this[_0x1244('0xb')]={};this[_0x1244('0xc')]=0x0;this['md5']='';this[_0x1244('0xd')]();this[_0x1244('0xe')]();}ChatQueue[_0x1244('0xf')]['updateRouting']=function(){var _0x7c70cf=this['mapAgentsId'][_0x1244('0x10')];this[_0x1244('0xb')]=_[_0x1244('0x11')](this['Agents'],'id');this[_0x1244('0xb')][_0x1244('0x10')]=_0x7c70cf;};ChatQueue[_0x1244('0xf')][_0x1244('0xe')]=function(){this[_0x1244('0x12')]=0x0;this[_0x1244('0x13')]=0x0;for(var _0x45feda=0x0;_0x45feda=0x0?this[_0x1244('0x17')]:0x0;var _0x599557={'id':this['id'],'available':this[_0x1244('0x17')],'loggedIn':this[_0x1244('0x12')],'name':this[_0x1244('0x6')],'paused':this[_0x1244('0x13')],'waiting':this[_0x1244('0xc')]};var _0x53b80b=md5(JSON[_0x1244('0x18')](_0x599557));if(this[_0x1244('0x0')]!==_0x53b80b){this[_0x1244('0x0')]=_0x53b80b;io['to'](util[_0x1244('0x19')]('chat:queue:%s',_0x599557[_0x1244('0x6')]))['emit'](_0x1244('0x1a'),_0x599557);}};module[_0x1244('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 594d3d2..6c5fa3b 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(_0x291466,_0x2e39b7){var _0x3f4e18=function(_0x53cd41){while(--_0x53cd41){_0x291466['push'](_0x291466['shift']());}};_0x3f4e18(++_0x2e39b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x7ca6b8,_0x306286){var _0x20e99d=function(_0x14fd2a){while(--_0x14fd2a){_0x7ca6b8['push'](_0x7ca6b8['shift']());}};_0x20e99d(++_0x306286);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 cecf5e5..a6123bb 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 _0x3b6a=['exports','name','Intervals'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3b6a,0x1c0));var _0xa3b6=function(_0x3abce4,_0x34e488){_0x3abce4=_0x3abce4-0x0;var _0x2c25db=_0x3b6a[_0x3abce4];return _0x2c25db;};'use strict';function Interval(_0x405cfc){this['id']=_0x405cfc['id']||0x0;this[_0xa3b6('0x0')]=_0x405cfc[_0xa3b6('0x0')]||'';this[_0xa3b6('0x1')]=_0x405cfc['Intervals']||{};}module[_0xa3b6('0x2')]=Interval; \ No newline at end of file +var _0xa17d=['exports','name','Intervals'];(function(_0x22ebb9,_0x11745a){var _0x496c2e=function(_0x51981c){while(--_0x51981c){_0x22ebb9['push'](_0x22ebb9['shift']());}};_0x496c2e(++_0x11745a);}(_0xa17d,0x79));var _0xda17=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0xa17d[_0x2fd0f0];return _0x57f71a;};'use strict';function Interval(_0x1cda6f){this['id']=_0x1cda6f['id']||0x0;this[_0xda17('0x0')]=_0x1cda6f[_0xda17('0x0')]||'';this[_0xda17('0x1')]=_0x1cda6f['Intervals']||{};}module[_0xda17('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 1891e24..d62de8b 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 _0x660e=['mail:queue:%s','emit','mail_queue:save','exports','lodash','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','available','format'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x660e,0xf7));var _0xe660=function(_0x13207d,_0x1b7196){_0x13207d=_0x13207d-0x0;var _0x343a10=_0x660e[_0x13207d];return _0x343a10;};'use strict';var _=require(_0xe660('0x0'));var md5=require('md5');var util=require(_0xe660('0x1'));var Redis=require('ioredis');var config=require(_0xe660('0x2'));config[_0xe660('0x3')]=_['defaults'](config['redis'],{'host':_0xe660('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe660('0x3')]));function MailQueue(_0x2b0a96){this['id']=_0x2b0a96['id']||0x0;this[_0xe660('0x5')]=_0x2b0a96[_0xe660('0x5')]||'';this[_0xe660('0x6')]=_0x2b0a96[_0xe660('0x6')]||0xa;this['strategy']=_0x2b0a96[_0xe660('0x7')]||_0xe660('0x8');this['Agents']=_0x2b0a96[_0xe660('0x9')];this[_0xe660('0xa')]={};this[_0xe660('0xb')]=0x0;this[_0xe660('0xc')]='';this['updateRouting']();this[_0xe660('0xd')]();}MailQueue[_0xe660('0xe')][_0xe660('0xf')]=function(){var _0xf389e9=this[_0xe660('0xa')][_0xe660('0x10')];this[_0xe660('0xa')]=_[_0xe660('0x11')](this[_0xe660('0x9')],'id');this[_0xe660('0xa')][_0xe660('0x10')]=_0xf389e9;};MailQueue[_0xe660('0xe')][_0xe660('0xd')]=function(){this[_0xe660('0x12')]=0x0;this[_0xe660('0x13')]=0x0;for(var _0x362b3d=0x0;_0x362b3d=0x0?this[_0xe660('0x15')]:0x0;var _0xdf3574={'id':this['id'],'available':this[_0xe660('0x15')],'loggedIn':this[_0xe660('0x12')],'name':this[_0xe660('0x5')],'paused':this[_0xe660('0x13')],'waiting':this[_0xe660('0xb')]};var _0x12e322=md5(JSON['stringify'](_0xdf3574));if(this['md5']!==_0x12e322){this[_0xe660('0xc')]=_0x12e322;io['to'](util[_0xe660('0x16')](_0xe660('0x17'),_0xdf3574[_0xe660('0x5')]))[_0xe660('0x18')](_0xe660('0x19'),_0xdf3574);}};module[_0xe660('0x1a')]=MailQueue; \ No newline at end of file +var _0xbd5b=['beepall','Agents','updateRouting','updateRealtime','mapAgentsId','map','loggedIn','online','available','paused','stringify','md5','mail:queue:%s','mail_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbd5b,0x1b8));var _0xbbd5=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0xbd5b[_0xf34895];return _0x143f44;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xbbd5('0x0'));var Redis=require(_0xbbd5('0x1'));var config=require(_0xbbd5('0x2'));config[_0xbbd5('0x3')]=_[_0xbbd5('0x4')](config['redis'],{'host':_0xbbd5('0x5'),'port':0x18eb});var io=require(_0xbbd5('0x6'))(new Redis(config[_0xbbd5('0x3')]));function MailQueue(_0x5b6701){this['id']=_0x5b6701['id']||0x0;this[_0xbbd5('0x7')]=_0x5b6701[_0xbbd5('0x7')]||'';this[_0xbbd5('0x8')]=_0x5b6701[_0xbbd5('0x8')]||0xa;this['strategy']=_0x5b6701[_0xbbd5('0x9')]||_0xbbd5('0xa');this[_0xbbd5('0xb')]=_0x5b6701[_0xbbd5('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0xbbd5('0xc')]();this[_0xbbd5('0xd')]();}MailQueue['prototype'][_0xbbd5('0xc')]=function(){var _0x5729f4=this['mapAgentsId']['_rr'];this[_0xbbd5('0xe')]=_[_0xbbd5('0xf')](this['Agents'],'id');this[_0xbbd5('0xe')]['_rr']=_0x5729f4;};MailQueue['prototype']['updateRealtime']=function(){this[_0xbbd5('0x10')]=0x0;this['paused']=0x0;for(var _0x582945=0x0;_0x582945=0x0?this[_0xbbd5('0x12')]:0x0;var _0x1162a8={'id':this['id'],'available':this[_0xbbd5('0x12')],'loggedIn':this['loggedIn'],'name':this[_0xbbd5('0x7')],'paused':this[_0xbbd5('0x13')],'waiting':this['waiting']};var _0x275dd5=md5(JSON[_0xbbd5('0x14')](_0x1162a8));if(this[_0xbbd5('0x15')]!==_0x275dd5){this[_0xbbd5('0x15')]=_0x275dd5;io['to'](util['format'](_0xbbd5('0x16'),_0x1162a8[_0xbbd5('0x7')]))['emit'](_0xbbd5('0x17'),_0x1162a8);}};module[_0xbbd5('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9f0953f..f2d0a30 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 _0xc897=['available','stringify','md5','format','openchannel:queue:%s','emit','exports','lodash','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','Agents','prototype','loggedIn','paused','length'];(function(_0xdce248,_0x36a3cf){var _0x366ad0=function(_0x495dea){while(--_0x495dea){_0xdce248['push'](_0xdce248['shift']());}};_0x366ad0(++_0x36a3cf);}(_0xc897,0x130));var _0x7c89=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xc897[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0x7c89('0x0'));var md5=require('md5');var util=require(_0x7c89('0x1'));var Redis=require('ioredis');var config=require(_0x7c89('0x2'));config[_0x7c89('0x3')]=_[_0x7c89('0x4')](config[_0x7c89('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x7c89('0x5'))(new Redis(config[_0x7c89('0x3')]));function OpenchannelQueue(_0x4a74c9){this['id']=_0x4a74c9['id']||0x0;this['name']=_0x4a74c9[_0x7c89('0x6')]||'';this[_0x7c89('0x7')]=_0x4a74c9['timeout']||0xa;this[_0x7c89('0x8')]=_0x4a74c9[_0x7c89('0x8')]||'beepall';this['Agents']=_0x4a74c9['Agents'];this[_0x7c89('0x9')]={};this[_0x7c89('0xa')]=0x0;this['md5']='';this[_0x7c89('0xb')]();this[_0x7c89('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x233a65=this[_0x7c89('0x9')][_0x7c89('0xd')];this[_0x7c89('0x9')]=_[_0x7c89('0xe')](this[_0x7c89('0xf')],'id');this[_0x7c89('0x9')]['_rr']=_0x233a65;};OpenchannelQueue[_0x7c89('0x10')][_0x7c89('0xc')]=function(){this[_0x7c89('0x11')]=0x0;this[_0x7c89('0x12')]=0x0;for(var _0x2c6560=0x0;_0x2c6560=0x0?this[_0x7c89('0x14')]:0x0;var _0x520064={'id':this['id'],'available':this[_0x7c89('0x14')],'loggedIn':this[_0x7c89('0x11')],'name':this[_0x7c89('0x6')],'paused':this[_0x7c89('0x12')],'waiting':this['waiting']};var _0x5b9d70=md5(JSON[_0x7c89('0x15')](_0x520064));if(this[_0x7c89('0x16')]!==_0x5b9d70){this['md5']=_0x5b9d70;io['to'](util[_0x7c89('0x17')](_0x7c89('0x18'),_0x520064[_0x7c89('0x6')]))[_0x7c89('0x19')]('openchannel_queue:save',_0x520064);}};module[_0x7c89('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0xd6f2=['updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','paused','available','emit','exports','lodash','util','../../../config/environment','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','md5'];(function(_0x2af777,_0x4ecf2c){var _0x49f350=function(_0x22cce7){while(--_0x22cce7){_0x2af777['push'](_0x2af777['shift']());}};_0x49f350(++_0x4ecf2c);}(_0xd6f2,0x18b));var _0x2d6f=function(_0x1a8b5b,_0x31be64){_0x1a8b5b=_0x1a8b5b-0x0;var _0x33d593=_0xd6f2[_0x1a8b5b];return _0x33d593;};'use strict';var _=require(_0x2d6f('0x0'));var md5=require('md5');var util=require(_0x2d6f('0x1'));var Redis=require('ioredis');var config=require(_0x2d6f('0x2'));config[_0x2d6f('0x3')]=_['defaults'](config[_0x2d6f('0x3')],{'host':_0x2d6f('0x4'),'port':0x18eb});var io=require(_0x2d6f('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x465a71){this['id']=_0x465a71['id']||0x0;this[_0x2d6f('0x6')]=_0x465a71[_0x2d6f('0x6')]||'';this['timeout']=_0x465a71['timeout']||0xa;this[_0x2d6f('0x7')]=_0x465a71['strategy']||_0x2d6f('0x8');this[_0x2d6f('0x9')]=_0x465a71['Agents'];this[_0x2d6f('0xa')]={};this[_0x2d6f('0xb')]=0x0;this[_0x2d6f('0xc')]='';this['updateRouting']();this[_0x2d6f('0xd')]();}OpenchannelQueue[_0x2d6f('0xe')][_0x2d6f('0xf')]=function(){var _0x1329b8=this['mapAgentsId'][_0x2d6f('0x10')];this[_0x2d6f('0xa')]=_[_0x2d6f('0x11')](this[_0x2d6f('0x9')],'id');this[_0x2d6f('0xa')][_0x2d6f('0x10')]=_0x1329b8;};OpenchannelQueue[_0x2d6f('0xe')][_0x2d6f('0xd')]=function(){this[_0x2d6f('0x12')]=0x0;this['paused']=0x0;for(var _0x5ac582=0x0;_0x5ac582=0x0?this[_0x2d6f('0x15')]:0x0;var _0x5a0318={'id':this['id'],'available':this[_0x2d6f('0x15')],'loggedIn':this[_0x2d6f('0x12')],'name':this[_0x2d6f('0x6')],'paused':this['paused'],'waiting':this[_0x2d6f('0xb')]};var _0x4726fe=md5(JSON['stringify'](_0x5a0318));if(this[_0x2d6f('0xc')]!==_0x4726fe){this['md5']=_0x4726fe;io['to'](util['format']('openchannel:queue:%s',_0x5a0318[_0x2d6f('0x6')]))[_0x2d6f('0x16')]('openchannel_queue:save',_0x5a0318);}};module[_0x2d6f('0x17')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a69cc77..9225ebe 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x2201fd,_0x408589){var _0x287fd5=function(_0xea961b){while(--_0xea961b){_0x2201fd['push'](_0x2201fd['shift']());}};_0x287fd5(++_0x408589);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _0xbaf0=['online','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var md5=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var Redis=require(_0x0baf('0x2'));var config=require(_0x0baf('0x3'));config[_0x0baf('0x4')]=_[_0x0baf('0x5')](config['redis'],{'host':_0x0baf('0x6'),'port':0x18eb});var io=require(_0x0baf('0x7'))(new Redis(config[_0x0baf('0x4')]));function SmsQueue(_0x39b8f3){this['id']=_0x39b8f3['id']||0x0;this[_0x0baf('0x8')]=_0x39b8f3[_0x0baf('0x8')]||'';this[_0x0baf('0x9')]=_0x39b8f3[_0x0baf('0x9')]||0xa;this[_0x0baf('0xa')]=_0x39b8f3['strategy']||_0x0baf('0xb');this['Agents']=_0x39b8f3[_0x0baf('0xc')];this[_0x0baf('0xd')]={};this[_0x0baf('0xe')]=0x0;this[_0x0baf('0x0')]='';this[_0x0baf('0xf')]();this[_0x0baf('0x10')]();}SmsQueue[_0x0baf('0x11')][_0x0baf('0xf')]=function(){var _0x1fc6b2=this[_0x0baf('0xd')][_0x0baf('0x12')];this['mapAgentsId']=_['map'](this[_0x0baf('0xc')],'id');this[_0x0baf('0xd')][_0x0baf('0x12')]=_0x1fc6b2;};SmsQueue[_0x0baf('0x11')]['updateRealtime']=function(){this[_0x0baf('0x13')]=0x0;this['paused']=0x0;for(var _0x1c76a8=0x0;_0x1c76a8=0x0?this['available']:0x0;var _0x63c820={'id':this['id'],'available':this[_0x0baf('0x17')],'loggedIn':this[_0x0baf('0x13')],'name':this[_0x0baf('0x8')],'paused':this[_0x0baf('0x16')],'waiting':this[_0x0baf('0xe')]};var _0x4ff793=md5(JSON['stringify'](_0x63c820));if(this[_0x0baf('0x0')]!==_0x4ff793){this[_0x0baf('0x0')]=_0x4ff793;io['to'](util[_0x0baf('0x18')](_0x0baf('0x19'),_0x63c820[_0x0baf('0x8')]))[_0x0baf('0x1a')](_0x0baf('0x1b'),_0x63c820);}};module[_0x0baf('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 0785d78..562b4d1 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 _0x13d5=['updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','name','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x91ee96,_0x5e1d82){var _0x301ad4=function(_0x32a643){while(--_0x32a643){_0x91ee96['push'](_0x91ee96['shift']());}};_0x301ad4(++_0x5e1d82);}(_0x13d5,0x9c));var _0x513d=function(_0x3f9bbb,_0x4425e9){_0x3f9bbb=_0x3f9bbb-0x0;var _0x46174f=_0x13d5[_0x3f9bbb];return _0x46174f;};'use strict';var _=require(_0x513d('0x0'));var md5=require(_0x513d('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x513d('0x2'));config[_0x513d('0x3')]=_['defaults'](config[_0x513d('0x3')],{'host':_0x513d('0x4'),'port':0x18eb});var io=require(_0x513d('0x5'))(new Redis(config[_0x513d('0x3')]));function WhatsappQueue(_0xe35119){this['id']=_0xe35119['id']||0x0;this['name']=_0xe35119['name']||'';this[_0x513d('0x6')]=_0xe35119[_0x513d('0x6')]||0xa;this['strategy']=_0xe35119[_0x513d('0x7')]||_0x513d('0x8');this[_0x513d('0x9')]=_0xe35119[_0x513d('0x9')];this[_0x513d('0xa')]={};this[_0x513d('0xb')]=0x0;this[_0x513d('0x1')]='';this[_0x513d('0xc')]();this[_0x513d('0xd')]();}WhatsappQueue[_0x513d('0xe')][_0x513d('0xc')]=function(){var _0x12be4=this[_0x513d('0xa')][_0x513d('0xf')];this['mapAgentsId']=_[_0x513d('0x10')](this[_0x513d('0x9')],'id');this[_0x513d('0xa')][_0x513d('0xf')]=_0x12be4;};WhatsappQueue[_0x513d('0xe')][_0x513d('0xd')]=function(){this['loggedIn']=0x0;this[_0x513d('0x11')]=0x0;for(var _0x3046fc=0x0;_0x3046fc=0x0?this[_0x513d('0x15')]:0x0;var _0x9d158b={'id':this['id'],'available':this[_0x513d('0x15')],'loggedIn':this[_0x513d('0x14')],'name':this[_0x513d('0x16')],'paused':this['paused'],'waiting':this['waiting']};var _0x1af5ea=md5(JSON[_0x513d('0x17')](_0x9d158b));if(this['md5']!==_0x1af5ea){this[_0x513d('0x1')]=_0x1af5ea;io['to'](util[_0x513d('0x18')](_0x513d('0x19'),_0x9d158b[_0x513d('0x16')]))[_0x513d('0x1a')](_0x513d('0x1b'),_0x9d158b);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x0023=['prototype','_rr','map','loggedIn','paused','whatsappPause','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1343ed,_0xdccf4e){var _0x23d789=function(_0x6750d5){while(--_0x6750d5){_0x1343ed['push'](_0x1343ed['shift']());}};_0x23d789(++_0xdccf4e);}(_0x0023,0x8e));var _0x3002=function(_0x3e6ac0,_0x1cb5f6){_0x3e6ac0=_0x3e6ac0-0x0;var _0x28f675=_0x0023[_0x3e6ac0];return _0x28f675;};'use strict';var _=require(_0x3002('0x0'));var md5=require(_0x3002('0x1'));var util=require(_0x3002('0x2'));var Redis=require('ioredis');var config=require(_0x3002('0x3'));config[_0x3002('0x4')]=_['defaults'](config[_0x3002('0x4')],{'host':_0x3002('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3002('0x4')]));function WhatsappQueue(_0x7da6e9){this['id']=_0x7da6e9['id']||0x0;this[_0x3002('0x6')]=_0x7da6e9[_0x3002('0x6')]||'';this[_0x3002('0x7')]=_0x7da6e9['timeout']||0xa;this[_0x3002('0x8')]=_0x7da6e9[_0x3002('0x8')]||_0x3002('0x9');this[_0x3002('0xa')]=_0x7da6e9[_0x3002('0xa')];this[_0x3002('0xb')]={};this[_0x3002('0xc')]=0x0;this[_0x3002('0x1')]='';this[_0x3002('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x3002('0xe')][_0x3002('0xd')]=function(){var _0x539ac5=this[_0x3002('0xb')][_0x3002('0xf')];this['mapAgentsId']=_[_0x3002('0x10')](this[_0x3002('0xa')],'id');this[_0x3002('0xb')]['_rr']=_0x539ac5;};WhatsappQueue[_0x3002('0xe')]['updateRealtime']=function(){this[_0x3002('0x11')]=0x0;this[_0x3002('0x12')]=0x0;for(var _0x208dad=0x0;_0x208dad=0x0?this[_0x3002('0x14')]:0x0;var _0x31509e={'id':this['id'],'available':this[_0x3002('0x14')],'loggedIn':this[_0x3002('0x11')],'name':this[_0x3002('0x6')],'paused':this[_0x3002('0x12')],'waiting':this[_0x3002('0xc')]};var _0x28f8c6=md5(JSON[_0x3002('0x15')](_0x31509e));if(this[_0x3002('0x1')]!==_0x28f8c6){this[_0x3002('0x1')]=_0x28f8c6;io['to'](util[_0x3002('0x16')]('whatsapp:queue:%s',_0x31509e[_0x3002('0x6')]))[_0x3002('0x17')](_0x3002('0x18'),_0x31509e);}};module[_0x3002('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 60f7b50..47f7a10 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 _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x5c956f,_0x2944db){var _0x5e24ad=function(_0x3b915b){while(--_0x3b915b){_0x5c956f['push'](_0x5c956f['shift']());}};_0x5e24ad(++_0x2944db);}(_0xa41a,0x6b));var _0xaa41=function(_0x57ce31,_0x43b975){_0x57ce31=_0x57ce31-0x0;var _0x2f2ead=_0xa41a[_0x57ce31];return _0x2f2ead;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file +var _0x8ef6=['mergeFromDatabase','initAgents','length','agents','intervals','isUndefined','updateRouting','initChatQueues','updateRealtime','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8ef6,0xf2));var _0x68ef=function(_0x7072ca,_0x3f8de7){_0x7072ca=_0x7072ca-0x0;var _0x5bfbd7=_0x8ef6[_0x7072ca];return _0x5bfbd7;};'use strict';var BPromise=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var moment=require(_0x68ef('0x3'));var Agent=require(_0x68ef('0x4'));var Interval=require(_0x68ef('0x5'));var OpenchannelQueue=require(_0x68ef('0x6'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0x68ef('0x7'));var MailQueue=require(_0x68ef('0x8'));var FaxQueue=require(_0x68ef('0x9'));var WhatsappQueue=require(_0x68ef('0xa'));var Realtime=function(){this['agents']={};this['intervals']={};this[_0x68ef('0xb')]={};this[_0x68ef('0xc')]={};this[_0x68ef('0xd')]={};this['mailQueues']={};this[_0x68ef('0xe')]={};this[_0x68ef('0xf')]={};this[_0x68ef('0x10')]={};this[_0x68ef('0x11')]={};this[_0x68ef('0x12')]={};this[_0x68ef('0x13')]={};this[_0x68ef('0x14')]={};this[_0x68ef('0x15')]={};};function freeIsNotKey(_0x1f6747,_0x255c85,_0x3afc1d){var _0xfa6763=_['mapKeys'](_0x1f6747,function(_0x1aa045,_0x46356f){return _0x1aa045[_0x3afc1d];});for(var _0x1e117a in _0x255c85){if(_0x255c85[_0x68ef('0x16')](_0x1e117a)){if(!_0xfa6763[_0x1e117a]){delete _0x255c85[_0x1e117a];}}}}Realtime[_0x68ef('0x17')][_0x68ef('0x18')]=function(_0x508671,_0x3b48dd){for(var _0xc50cce in _0x3b48dd){if(_0x508671[_0x68ef('0x16')](_0xc50cce)){_0x508671[_0xc50cce]=_0x3b48dd[_0xc50cce];}}};Realtime['prototype'][_0x68ef('0x19')]=function(){var _0x1764de=this;return function(_0x24682d){if(_0x24682d){freeIsNotKey(_0x24682d,_0x1764de['agents'],'id');for(var _0x35493d=0x0,_0x37c4cc={},_0x3d1e90={};_0x35493d<_0x24682d[_0x68ef('0x1a')];_0x35493d+=0x1){_0x37c4cc=_0x24682d[_0x35493d];if(_['isUndefined'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']])){_0x1764de['agents'][_0x37c4cc['id']]=new Agent(_0x37c4cc);}else{_0x1764de['mergeFromDatabase'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']],_0x37c4cc);}}}return _0x1764de[_0x68ef('0x1b')];};};Realtime['prototype']['initIntervals']=function(){var _0x3c4c1f=this;return function(_0x2cd92c){if(_0x2cd92c){freeIsNotKey(_0x2cd92c,_0x3c4c1f[_0x68ef('0x1c')],'id');for(var _0x4fad1c=0x0,_0x1dc49c={},_0x36a4cb={};_0x4fad1c<_0x2cd92c[_0x68ef('0x1a')];_0x4fad1c+=0x1){_0x1dc49c=_0x2cd92c[_0x4fad1c];if(_['isUndefined'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']])){_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']]=new Interval(_0x1dc49c);}else{_0x3c4c1f['mergeFromDatabase'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']],_0x1dc49c);}}}return _0x3c4c1f[_0x68ef('0x1c')];};};Realtime[_0x68ef('0x17')]['initOpenchannelQueues']=function(){var _0x59723c=this;return function(_0x59bebc){if(_0x59bebc){freeIsNotKey(_0x59bebc,_0x59723c[_0x68ef('0xb')],'id');for(var _0x2023f2=0x0,_0x312cc9={},_0x2e6e39={};_0x2023f2<_0x59bebc[_0x68ef('0x1a')];_0x2023f2+=0x1){_0x312cc9=_0x59bebc[_0x2023f2];if(_[_0x68ef('0x1d')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']])){_0x59723c[_0x68ef('0xb')][_0x312cc9['id']]=new OpenchannelQueue(_0x312cc9);}else{_0x59723c[_0x68ef('0x18')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']],_0x312cc9);}_0x59723c['openchannelQueues'][_0x312cc9['id']][_0x68ef('0x1e')]();_0x59723c['openchannelQueues'][_0x312cc9['id']]['updateRealtime']();}}return _0x59723c['openchannelQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x1f')]=function(){var _0x123041=this;return function(_0x29518e){if(_0x29518e){freeIsNotKey(_0x29518e,_0x123041['chatQueues'],'id');for(var _0x4a0550=0x0,_0x1cbe4f={},_0x28907a={};_0x4a0550<_0x29518e[_0x68ef('0x1a')];_0x4a0550+=0x1){_0x1cbe4f=_0x29518e[_0x4a0550];if(_[_0x68ef('0x1d')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']])){_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']]=new ChatQueue(_0x1cbe4f);}else{_0x123041[_0x68ef('0x18')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']],_0x1cbe4f);}_0x123041['chatQueues'][_0x1cbe4f['id']][_0x68ef('0x1e')]();_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']][_0x68ef('0x20')]();}}return _0x123041['chatQueues'];};};Realtime[_0x68ef('0x17')]['initSmsQueues']=function(){var _0x133788=this;return function(_0x17588a){if(_0x17588a){freeIsNotKey(_0x17588a,_0x133788['smsQueues'],'id');for(var _0x5e1e1b=0x0,_0x159395={},_0x5fa72a={};_0x5e1e1b<_0x17588a['length'];_0x5e1e1b+=0x1){_0x159395=_0x17588a[_0x5e1e1b];if(_[_0x68ef('0x1d')](_0x133788[_0x68ef('0xd')][_0x159395['id']])){_0x133788[_0x68ef('0xd')][_0x159395['id']]=new SmsQueue(_0x159395);}else{_0x133788[_0x68ef('0x18')](_0x133788['smsQueues'][_0x159395['id']],_0x159395);}_0x133788[_0x68ef('0xd')][_0x159395['id']][_0x68ef('0x1e')]();_0x133788['smsQueues'][_0x159395['id']][_0x68ef('0x20')]();}}return _0x133788['smsQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x21')]=function(){var _0x4973c2=this;return function(_0x24c2c9){if(_0x24c2c9){freeIsNotKey(_0x24c2c9,_0x4973c2['mailQueues'],'id');for(var _0x38c2f8=0x0,_0x575f43={},_0x2fbb0d={};_0x38c2f8<_0x24c2c9[_0x68ef('0x1a')];_0x38c2f8+=0x1){_0x575f43=_0x24c2c9[_0x38c2f8];if(_[_0x68ef('0x1d')](_0x4973c2['mailQueues'][_0x575f43['id']])){_0x4973c2[_0x68ef('0x22')][_0x575f43['id']]=new MailQueue(_0x575f43);}else{_0x4973c2['mergeFromDatabase'](_0x4973c2[_0x68ef('0x22')][_0x575f43['id']],_0x575f43);}_0x4973c2['mailQueues'][_0x575f43['id']][_0x68ef('0x1e')]();_0x4973c2[_0x68ef('0x22')][_0x575f43['id']][_0x68ef('0x20')]();}}return _0x4973c2[_0x68ef('0x22')];};};Realtime[_0x68ef('0x17')][_0x68ef('0x23')]=function(){var _0x51ba3d=this;return function(_0x294fba){if(_0x294fba){freeIsNotKey(_0x294fba,_0x51ba3d[_0x68ef('0xe')],'id');for(var _0x32074a=0x0,_0x52a8b9={},_0x32eddd={};_0x32074a<_0x294fba[_0x68ef('0x1a')];_0x32074a+=0x1){_0x52a8b9=_0x294fba[_0x32074a];if(_[_0x68ef('0x1d')](_0x51ba3d['faxQueues'][_0x52a8b9['id']])){_0x51ba3d['faxQueues'][_0x52a8b9['id']]=new FaxQueue(_0x52a8b9);}else{_0x51ba3d[_0x68ef('0x18')](_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']],_0x52a8b9);}_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x1e')]();_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x20')]();}}return _0x51ba3d[_0x68ef('0xe')];};};Realtime['prototype'][_0x68ef('0x24')]=function(){var _0xd7f9ca=this;return function(_0x2f6ee0){if(_0x2f6ee0){freeIsNotKey(_0x2f6ee0,_0xd7f9ca[_0x68ef('0xf')],'id');for(var _0x492b74=0x0,_0x3cb156={},_0x3a2f53={};_0x492b74<_0x2f6ee0[_0x68ef('0x1a')];_0x492b74+=0x1){_0x3cb156=_0x2f6ee0[_0x492b74];if(_[_0x68ef('0x1d')](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']])){_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']]=new WhatsappQueue(_0x3cb156);}else{_0xd7f9ca['mergeFromDatabase'](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']],_0x3cb156);}_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x1e')]();_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x20')]();}}return _0xd7f9ca[_0x68ef('0xf')];};};module[_0x68ef('0x25')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index cf14ce9..7be42eb 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 _0x43ea=['addTagsToChatInteraction','update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction'];(function(_0x4c84b8,_0x3b15d6){var _0x351f93=function(_0x35e0fe){while(--_0x35e0fe){_0x4c84b8['push'](_0x4c84b8['shift']());}};_0x351f93(++_0x3b15d6);}(_0x43ea,0x1d6));var _0xa43e=function(_0x13a2ea,_0xc02ea5){_0x13a2ea=_0x13a2ea-0x0;var _0x313f15=_0x43ea[_0x13a2ea];return _0x313f15;};'use strict';var client=require('../client');exports[_0xa43e('0x0')]=function(_0x506532,_0x2b01db){return client['Request'](_0xa43e('0x1'),{'body':_0x2b01db,'options':{'where':{'id':_0x506532}},'log':_0xa43e('0x2')});};exports[_0xa43e('0x3')]=function(_0x1715b3,_0x144579){return client[_0xa43e('0x4')](_0xa43e('0x5'),{'body':_0x144579,'options':{'where':{'id':_0x1715b3}},'log':_0xa43e('0x6')});}; \ No newline at end of file +var _0x24ca=['../client','update','Request','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x18b269,_0x4b9725){var _0x20807b=function(_0x259048){while(--_0x259048){_0x18b269['push'](_0x18b269['shift']());}};_0x20807b(++_0x4b9725);}(_0x24ca,0xcc));var _0xa24c=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0x24ca[_0x1196bd];return _0x26014f;};'use strict';var client=require(_0xa24c('0x0'));exports[_0xa24c('0x1')]=function(_0x3fa3c0,_0x18e209){return client[_0xa24c('0x2')]('UpdateChatInteraction',{'body':_0x18e209,'options':{'where':{'id':_0x3fa3c0}},'log':_0xa24c('0x3')});};exports['addTags']=function(_0x2c5628,_0x50dbeb){return client[_0xa24c('0x2')](_0xa24c('0x4'),{'body':_0x50dbeb,'options':{'where':{'id':_0x2c5628}},'log':_0xa24c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a61bc1c..7f5716a 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 _0x00a4=['create','CreateChatMessage','createChatMessage','../client'];(function(_0x48a1e3,_0x19207f){var _0x120ea3=function(_0x36d3d4){while(--_0x36d3d4){_0x48a1e3['push'](_0x48a1e3['shift']());}};_0x120ea3(++_0x19207f);}(_0x00a4,0xe7));var _0x400a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00a4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x400a('0x0'));exports[_0x400a('0x1')]=function(_0x5cf179){return client['Request'](_0x400a('0x2'),{'body':_0x5cf179,'log':_0x400a('0x3')});}; \ No newline at end of file +var _0x1283=['Request','CreateChatMessage','create'];(function(_0x36f66a,_0x766c17){var _0x3f0598=function(_0x178f7b){while(--_0x178f7b){_0x36f66a['push'](_0x36f66a['shift']());}};_0x3f0598(++_0x766c17);}(_0x1283,0x86));var _0x3128=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x1283[_0x3cb3ca];return _0x214366;};'use strict';var client=require('../client');exports[_0x3128('0x0')]=function(_0x42ad14){return client[_0x3128('0x1')](_0x3128('0x2'),{'body':_0x42ad14,'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 a216557..b130fc7 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 _0xaed9=['User','Agents','online','chatPause','../client','getChatQueues','name'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xaed9,0x154));var _0x9aed=function(_0x5410a5,_0x1a33fe){_0x5410a5=_0x5410a5-0x0;var _0x5dfb27=_0xaed9[_0x5410a5];return _0x5dfb27;};'use strict';var client=require(_0x9aed('0x0'));exports[_0x9aed('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x9aed('0x2'),'timeout','strategy'],'include':[{'model':_0x9aed('0x3'),'as':_0x9aed('0x4'),'attributes':['id',_0x9aed('0x2'),_0x9aed('0x5'),_0x9aed('0x6')]}]},'log':_0x9aed('0x1')});};}; \ No newline at end of file +var _0x4f69=['timeout','User','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name'];(function(_0xa8c7e9,_0x3da10b){var _0x4e1d45=function(_0x1f10e9){while(--_0x1f10e9){_0xa8c7e9['push'](_0xa8c7e9['shift']());}};_0x4e1d45(++_0x3da10b);}(_0x4f69,0x1d8));var _0x94f6=function(_0x5dd69b,_0x118e05){_0x5dd69b=_0x5dd69b-0x0;var _0x1bc678=_0x4f69[_0x5dd69b];return _0x1bc678;};'use strict';var client=require(_0x94f6('0x0'));exports[_0x94f6('0x1')]=function(){return function(){return client[_0x94f6('0x2')](_0x94f6('0x3'),{'options':{'raw':![],'attributes':['id',_0x94f6('0x4'),_0x94f6('0x5'),'strategy'],'include':[{'model':_0x94f6('0x6'),'as':'Agents','attributes':['id',_0x94f6('0x4'),_0x94f6('0x7'),_0x94f6('0x8')]}]},'log':_0x94f6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ccc1f62..3a19c43 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 _0x6ff1=['UpdateChatQueueReport','DESC','../client','create','Request','update'];(function(_0x1ecf00,_0x3361e6){var _0x251d0b=function(_0x9dbaa6){while(--_0x9dbaa6){_0x1ecf00['push'](_0x1ecf00['shift']());}};_0x251d0b(++_0x3361e6);}(_0x6ff1,0x10a));var _0x16ff=function(_0x2a460c,_0x58841c){_0x2a460c=_0x2a460c-0x0;var _0x484aab=_0x6ff1[_0x2a460c];return _0x484aab;};'use strict';var client=require(_0x16ff('0x0'));exports[_0x16ff('0x1')]=function(_0x3c9b86){return client[_0x16ff('0x2')]('CreateChatQueueReport',{'body':_0x3c9b86,'log':'CreateChatQueueReport'});};exports[_0x16ff('0x3')]=function(_0x5cca46,_0x1db386){return client[_0x16ff('0x2')](_0x16ff('0x4'),{'body':_0x1db386,'options':{'where':{'uniqueid':_0x5cca46},'order':[['id',_0x16ff('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xc1c4=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x443b67,_0xf706ce){var _0x21d236=function(_0x2b2cff){while(--_0x2b2cff){_0x443b67['push'](_0x443b67['shift']());}};_0x21d236(++_0xf706ce);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x2d5ea2,_0x1b319e){_0x2d5ea2=_0x2d5ea2-0x0;var _0x3e2ecb=_0xc1c4[_0x2d5ea2];return _0x3e2ecb;};'use strict';var client=require(_0x4c1c('0x0'));exports[_0x4c1c('0x1')]=function(_0x2fb284){return client[_0x4c1c('0x2')](_0x4c1c('0x3'),{'body':_0x2fb284,'log':_0x4c1c('0x3')});};exports[_0x4c1c('0x4')]=function(_0x5b8a39,_0x5c1e2c){return client[_0x4c1c('0x2')](_0x4c1c('0x5'),{'body':_0x5c1e2c,'options':{'where':{'uniqueid':_0x5b8a39},'order':[['id',_0x4c1c('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 53c5914..f39f82b 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 _0x7335=['UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request'];(function(_0x328d85,_0x5323cb){var _0x1205e7=function(_0x172ba4){while(--_0x172ba4){_0x328d85['push'](_0x328d85['shift']());}};_0x1205e7(++_0x5323cb);}(_0x7335,0x11d));var _0x5733=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x7335[_0xbd08b4];return _0x314f1e;};'use strict';var client=require(_0x5733('0x0'));exports[_0x5733('0x1')]=function(_0xa8ebf8,_0x4ca558){return client[_0x5733('0x2')](_0x5733('0x3'),{'body':_0x4ca558,'options':{'where':{'id':_0xa8ebf8}},'log':_0x5733('0x4')});};exports[_0x5733('0x5')]=function(_0x55e4ed,_0x352d59){return client['Request'](_0x5733('0x6'),{'body':_0x352d59,'options':{'where':{'id':_0x55e4ed}},'log':_0x5733('0x7')});}; \ No newline at end of file +var _0xca44=['update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x2baf27,_0x2d1037){var _0xf7935c=function(_0x25e7fc){while(--_0x25e7fc){_0x2baf27['push'](_0x2baf27['shift']());}};_0xf7935c(++_0x2d1037);}(_0xca44,0x16c));var _0x4ca4=function(_0x44f292,_0x14f823){_0x44f292=_0x44f292-0x0;var _0x25fc31=_0xca44[_0x44f292];return _0x25fc31;};'use strict';var client=require('../client');exports[_0x4ca4('0x0')]=function(_0xb5dca6,_0x4671b8){return client[_0x4ca4('0x1')](_0x4ca4('0x2'),{'body':_0x4671b8,'options':{'where':{'id':_0xb5dca6}},'log':_0x4ca4('0x3')});};exports[_0x4ca4('0x4')]=function(_0x1309e0,_0x5b4328){return client[_0x4ca4('0x1')](_0x4ca4('0x5'),{'body':_0x5b4328,'options':{'where':{'id':_0x1309e0}},'log':_0x4ca4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 1e937d6..694e04f 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 _0x6d47=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x2fe3b1,_0x2a4aa3){var _0x1a958f=function(_0x24f3ee){while(--_0x24f3ee){_0x2fe3b1['push'](_0x2fe3b1['shift']());}};_0x1a958f(++_0x2a4aa3);}(_0x6d47,0xca));var _0x76d4=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x6d47[_0x134c2e];return _0x2825db;};'use strict';var client=require(_0x76d4('0x0'));exports[_0x76d4('0x1')]=function(_0x37bbc7){return client[_0x76d4('0x2')](_0x76d4('0x3'),{'body':_0x37bbc7,'log':_0x76d4('0x4')});}; \ No newline at end of file +var _0x545a=['create','Request'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0x545a,0x116));var _0xa545=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x545a[_0xa148b7];return _0x51efd3;};'use strict';var client=require('../client');exports[_0xa545('0x0')]=function(_0x2c3f34){return client[_0xa545('0x1')]('CreateFaxMessage',{'body':_0x2c3f34,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 52f217e..702320d 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 _0xe8a6=['timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue','name'];(function(_0x234995,_0x94ca50){var _0x2e106e=function(_0x1de80f){while(--_0x1de80f){_0x234995['push'](_0x234995['shift']());}};_0x2e106e(++_0x94ca50);}(_0xe8a6,0x7e));var _0x6e8a=function(_0x18dcd1,_0x293ee7){_0x18dcd1=_0x18dcd1-0x0;var _0x7beb34=_0xe8a6[_0x18dcd1];return _0x7beb34;};'use strict';var client=require(_0x6e8a('0x0'));exports[_0x6e8a('0x1')]=function(){return function(){return client['Request'](_0x6e8a('0x2'),{'options':{'raw':![],'attributes':['id',_0x6e8a('0x3'),_0x6e8a('0x4'),_0x6e8a('0x5')],'include':[{'model':_0x6e8a('0x6'),'as':_0x6e8a('0x7'),'attributes':['id','name',_0x6e8a('0x8'),_0x6e8a('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x8292=['Request','GetFaxQueue','name','timeout','strategy','online','faxPause','../client'];(function(_0x52e7ee,_0x5b3e4d){var _0x2481f0=function(_0x3c9d53){while(--_0x3c9d53){_0x52e7ee['push'](_0x52e7ee['shift']());}};_0x2481f0(++_0x5b3e4d);}(_0x8292,0x1af));var _0x2829=function(_0x545a02,_0x2efaab){_0x545a02=_0x545a02-0x0;var _0x70e3e=_0x8292[_0x545a02];return _0x70e3e;};'use strict';var client=require(_0x2829('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x2829('0x1')](_0x2829('0x2'),{'options':{'raw':![],'attributes':['id',_0x2829('0x3'),_0x2829('0x4'),_0x2829('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x2829('0x6'),_0x2829('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 a2158d3..961e137 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 _0x6d16=['DESC','../client','CreateFaxQueueReport','Request','UpdateFaxQueueReport'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x6d16,0x169));var _0x66d1=function(_0x1f9553,_0x3cc10a){_0x1f9553=_0x1f9553-0x0;var _0x32948f=_0x6d16[_0x1f9553];return _0x32948f;};'use strict';var client=require(_0x66d1('0x0'));exports['create']=function(_0x3b78b6){return client['Request'](_0x66d1('0x1'),{'body':_0x3b78b6,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x34e373,_0x432618){return client[_0x66d1('0x2')](_0x66d1('0x3'),{'body':_0x432618,'options':{'where':{'uniqueid':_0x34e373},'order':[['id',_0x66d1('0x4')]],'limit':0x1},'log':_0x66d1('0x3')});}; \ No newline at end of file +var _0x769c=['../client','Request','update','DESC','UpdateFaxQueueReport'];(function(_0x394cd8,_0x2d656a){var _0x3153bc=function(_0x661312){while(--_0x661312){_0x394cd8['push'](_0x394cd8['shift']());}};_0x3153bc(++_0x2d656a);}(_0x769c,0x96));var _0xc769=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x769c[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0xc769('0x0'));exports['create']=function(_0x2bcf3f){return client[_0xc769('0x1')]('CreateFaxQueueReport',{'body':_0x2bcf3f,'log':'CreateFaxQueueReport'});};exports[_0xc769('0x2')]=function(_0x25dc31,_0x21f114){return client[_0xc769('0x1')]('UpdateFaxQueueReport',{'body':_0x21f114,'options':{'where':{'uniqueid':_0x25dc31},'order':[['id',_0xc769('0x3')]],'limit':0x1},'log':_0xc769('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 34e54f5..f6c1aa7 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 _0x3de3=['../client','Request','GetInterval','Interval','Intervals','name','interval'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x3de3,0x1ce));var _0x33de=function(_0x1fb478,_0x5f2774){_0x1fb478=_0x1fb478-0x0;var _0x1bf07f=_0x3de3[_0x1fb478];return _0x1bf07f;};'use strict';var client=require(_0x33de('0x0'));exports['getIntervals']=function(){return function(){return client[_0x33de('0x1')](_0x33de('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x33de('0x3'),'as':_0x33de('0x4'),'attributes':['id',_0x33de('0x5'),_0x33de('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xaa5e=['name','Interval','Intervals','../client','getIntervals','GetInterval'];(function(_0x22043a,_0x3970c5){var _0x4aed2c=function(_0x4ba7dd){while(--_0x4ba7dd){_0x22043a['push'](_0x22043a['shift']());}};_0x4aed2c(++_0x3970c5);}(_0xaa5e,0xa5));var _0xeaa5=function(_0xf942e5,_0x2bd191){_0xf942e5=_0xf942e5-0x0;var _0xa9b009=_0xaa5e[_0xf942e5];return _0xa9b009;};'use strict';var client=require(_0xeaa5('0x0'));exports[_0xeaa5('0x1')]=function(){return function(){return client['Request'](_0xeaa5('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeaa5('0x3')],'include':[{'model':_0xeaa5('0x4'),'as':_0xeaa5('0x5'),'attributes':['id',_0xeaa5('0x3'),'interval']}]},'log':_0xeaa5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 04fff1c..a7ed121 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 _0x9012=['addTags','AddTagsToMailInteraction','../client','UpdateMailInteraction'];(function(_0x201efd,_0x561cd2){var _0x328cdb=function(_0x539b7c){while(--_0x539b7c){_0x201efd['push'](_0x201efd['shift']());}};_0x328cdb(++_0x561cd2);}(_0x9012,0x102));var _0x2901=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x9012[_0x1d8119];return _0x3e30f6;};'use strict';var client=require(_0x2901('0x0'));exports['update']=function(_0x685937,_0x38e368){return client['Request'](_0x2901('0x1'),{'body':_0x38e368,'options':{'where':{'id':_0x685937}},'log':'updateMailInteraction'});};exports[_0x2901('0x2')]=function(_0x327335,_0x5620e6){return client['Request'](_0x2901('0x3'),{'body':_0x5620e6,'options':{'where':{'id':_0x327335}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4d71=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x5c6445,_0x103943){var _0x42cb45=function(_0x24662c){while(--_0x24662c){_0x5c6445['push'](_0x5c6445['shift']());}};_0x42cb45(++_0x103943);}(_0x4d71,0x84));var _0x14d7=function(_0x3dba51,_0x16fc4c){_0x3dba51=_0x3dba51-0x0;var _0x2d7352=_0x4d71[_0x3dba51];return _0x2d7352;};'use strict';var client=require(_0x14d7('0x0'));exports[_0x14d7('0x1')]=function(_0x4af114,_0x59a258){return client[_0x14d7('0x2')](_0x14d7('0x3'),{'body':_0x59a258,'options':{'where':{'id':_0x4af114}},'log':_0x14d7('0x4')});};exports[_0x14d7('0x5')]=function(_0x402f69,_0x29b369){return client[_0x14d7('0x2')](_0x14d7('0x6'),{'body':_0x29b369,'options':{'where':{'id':_0x402f69}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index fc6192b..81f4fb9 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 _0x4769=['create','CreateMailMessage','createMailMessage'];(function(_0x525a94,_0x5ed4da){var _0x589d42=function(_0x4cfb03){while(--_0x4cfb03){_0x525a94['push'](_0x525a94['shift']());}};_0x589d42(++_0x5ed4da);}(_0x4769,0x111));var _0x9476=function(_0xac5d5e,_0x3bf3cd){_0xac5d5e=_0xac5d5e-0x0;var _0x5f34e1=_0x4769[_0xac5d5e];return _0x5f34e1;};'use strict';var client=require('../client');exports[_0x9476('0x0')]=function(_0x250ac7){return client['Request'](_0x9476('0x1'),{'body':_0x250ac7,'log':_0x9476('0x2')});}; \ No newline at end of file +var _0x9a0c=['CreateMailMessage','create','Request'];(function(_0x46256b,_0x238610){var _0x1bc8bd=function(_0x3c8487){while(--_0x3c8487){_0x46256b['push'](_0x46256b['shift']());}};_0x1bc8bd(++_0x238610);}(_0x9a0c,0xfa));var _0xc9a0=function(_0x1793fa,_0xd3845f){_0x1793fa=_0x1793fa-0x0;var _0x5d66be=_0x9a0c[_0x1793fa];return _0x5d66be;};'use strict';var client=require('../client');exports[_0xc9a0('0x0')]=function(_0xcebb82){return client[_0xc9a0('0x1')](_0xc9a0('0x2'),{'body':_0xcebb82,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 34d8bd5..5513a3d 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 _0x7f12=['GetMailQueue','timeout','strategy','Agents','name','mailPause','../client','getMailQueues','Request'];(function(_0x16cbce,_0x87064a){var _0x10bd91=function(_0x1342c0){while(--_0x1342c0){_0x16cbce['push'](_0x16cbce['shift']());}};_0x10bd91(++_0x87064a);}(_0x7f12,0xf9));var _0x27f1=function(_0x1e2a2c,_0x4f3177){_0x1e2a2c=_0x1e2a2c-0x0;var _0x485248=_0x7f12[_0x1e2a2c];return _0x485248;};'use strict';var client=require(_0x27f1('0x0'));exports[_0x27f1('0x1')]=function(){return function(){return client[_0x27f1('0x2')](_0x27f1('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x27f1('0x4'),_0x27f1('0x5')],'include':[{'model':'User','as':_0x27f1('0x6'),'attributes':['id',_0x27f1('0x7'),'online',_0x27f1('0x8')]}]},'log':_0x27f1('0x1')});};}; \ No newline at end of file +var _0xd8ed=['name','strategy','User','online','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0x4ad344,_0x23e9d3){var _0x425112=function(_0x1886ac){while(--_0x1886ac){_0x4ad344['push'](_0x4ad344['shift']());}};_0x425112(++_0x23e9d3);}(_0xd8ed,0xb9));var _0xdd8e=function(_0x3288ff,_0x461839){_0x3288ff=_0x3288ff-0x0;var _0x4503e1=_0xd8ed[_0x3288ff];return _0x4503e1;};'use strict';var client=require(_0xdd8e('0x0'));exports[_0xdd8e('0x1')]=function(){return function(){return client[_0xdd8e('0x2')](_0xdd8e('0x3'),{'options':{'raw':![],'attributes':['id',_0xdd8e('0x4'),'timeout',_0xdd8e('0x5')],'include':[{'model':_0xdd8e('0x6'),'as':'Agents','attributes':['id',_0xdd8e('0x4'),_0xdd8e('0x7'),_0xdd8e('0x8')]}]},'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 94c653b..4ebf7f6 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 _0x677e=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x1200ff,_0x30d9c4){var _0x510343=function(_0x211c0e){while(--_0x211c0e){_0x1200ff['push'](_0x1200ff['shift']());}};_0x510343(++_0x30d9c4);}(_0x677e,0x177));var _0xe677=function(_0x38651d,_0x5ca1bc){_0x38651d=_0x38651d-0x0;var _0x3f4c9b=_0x677e[_0x38651d];return _0x3f4c9b;};'use strict';var client=require(_0xe677('0x0'));exports[_0xe677('0x1')]=function(_0x3e740a){return client[_0xe677('0x2')](_0xe677('0x3'),{'body':_0x3e740a,'log':_0xe677('0x3')});};exports[_0xe677('0x4')]=function(_0x346d89,_0x5a19c8){return client[_0xe677('0x2')](_0xe677('0x5'),{'body':_0x5a19c8,'options':{'where':{'uniqueid':_0x346d89},'order':[['id',_0xe677('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x10a9=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','Request'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x10a9,0x1f2));var _0x910a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x10a9[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x910a('0x0'));exports['create']=function(_0x10710e){return client[_0x910a('0x1')](_0x910a('0x2'),{'body':_0x10710e,'log':'CreateMailQueueReport'});};exports['update']=function(_0x1ba502,_0x4895b2){return client[_0x910a('0x1')](_0x910a('0x3'),{'body':_0x4895b2,'options':{'where':{'uniqueid':_0x1ba502},'order':[['id',_0x910a('0x4')]],'limit':0x1},'log':_0x910a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index cc0edd2..389c7ab 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 _0x855f=['updateOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x3fbf1c,_0x1856ad){var _0x260817=function(_0x32ea6a){while(--_0x32ea6a){_0x3fbf1c['push'](_0x3fbf1c['shift']());}};_0x260817(++_0x1856ad);}(_0x855f,0x7f));var _0xf855=function(_0x7acab0,_0x16b2ff){_0x7acab0=_0x7acab0-0x0;var _0x42f2aa=_0x855f[_0x7acab0];return _0x42f2aa;};'use strict';var client=require('../client');exports[_0xf855('0x0')]=function(_0x5a053a,_0x169d94){return client[_0xf855('0x1')](_0xf855('0x2'),{'body':_0x169d94,'options':{'where':{'id':_0x5a053a}},'log':_0xf855('0x3')});};exports['addTags']=function(_0x4b5c4f,_0x3cd46a){return client[_0xf855('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x3cd46a,'options':{'where':{'id':_0x4b5c4f}},'log':_0xf855('0x4')});}; \ No newline at end of file +var _0x20d9=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x5ba9f5,_0x3d274d){var _0x5e75a1=function(_0x305740){while(--_0x305740){_0x5ba9f5['push'](_0x5ba9f5['shift']());}};_0x5e75a1(++_0x3d274d);}(_0x20d9,0x1b7));var _0x920d=function(_0x38ca7e,_0x5ec085){_0x38ca7e=_0x38ca7e-0x0;var _0x120b40=_0x20d9[_0x38ca7e];return _0x120b40;};'use strict';var client=require('../client');exports[_0x920d('0x0')]=function(_0x39809a,_0x365276){return client[_0x920d('0x1')](_0x920d('0x2'),{'body':_0x365276,'options':{'where':{'id':_0x39809a}},'log':_0x920d('0x3')});};exports[_0x920d('0x4')]=function(_0x206ced,_0x30bd28){return client[_0x920d('0x1')](_0x920d('0x5'),{'body':_0x30bd28,'options':{'where':{'id':_0x206ced}},'log':_0x920d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ed87196..091ec8e 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 _0x9a19=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x4c0155,_0x5b20db){var _0x1276db=function(_0x3ff813){while(--_0x3ff813){_0x4c0155['push'](_0x4c0155['shift']());}};_0x1276db(++_0x5b20db);}(_0x9a19,0x114));var _0x99a1=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9a19[_0x1694f5];return _0x5b4321;};'use strict';var client=require(_0x99a1('0x0'));exports[_0x99a1('0x1')]=function(_0x3d860b){return client['Request'](_0x99a1('0x2'),{'body':_0x3d860b,'log':_0x99a1('0x3')});}; \ No newline at end of file +var _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x59203f,_0x17b940){var _0x59af68=function(_0x462208){while(--_0x462208){_0x59203f['push'](_0x59203f['shift']());}};_0x59af68(++_0x17b940);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4d69d1,_0x211712){_0x4d69d1=_0x4d69d1-0x0;var _0x4950ad=_0xbdb7[_0x4d69d1];return _0x4950ad;};'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 bd3db22..fe49d26 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 _0x60d4=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0x60d4,0x77));var _0x460d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60d4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x460d('0x0')]=function(){return function(){return client[_0x460d('0x1')](_0x460d('0x2'),{'options':{'raw':![],'attributes':['id',_0x460d('0x3'),_0x460d('0x4'),_0x460d('0x5')],'include':[{'model':_0x460d('0x6'),'as':_0x460d('0x7'),'attributes':['id',_0x460d('0x3'),_0x460d('0x8'),_0x460d('0x9')]}]},'log':_0x460d('0x0')});};}; \ No newline at end of file +var _0x1276=['online','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User','Agents'];(function(_0x3af4b2,_0x491b83){var _0x23d0c3=function(_0x3959a1){while(--_0x3959a1){_0x3af4b2['push'](_0x3af4b2['shift']());}};_0x23d0c3(++_0x491b83);}(_0x1276,0x179));var _0x6127=function(_0x1ecf9b,_0x374eef){_0x1ecf9b=_0x1ecf9b-0x0;var _0x4cb4ae=_0x1276[_0x1ecf9b];return _0x4cb4ae;};'use strict';var client=require('../client');exports[_0x6127('0x0')]=function(){return function(){return client['Request'](_0x6127('0x1'),{'options':{'raw':![],'attributes':['id',_0x6127('0x2'),_0x6127('0x3'),_0x6127('0x4')],'include':[{'model':_0x6127('0x5'),'as':_0x6127('0x6'),'attributes':['id',_0x6127('0x2'),_0x6127('0x7'),'openchannelPause']}]},'log':_0x6127('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3db2133..5a4d340 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 _0x06fd=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','../client','create'];(function(_0x1f0724,_0x3a58bf){var _0x253ffb=function(_0x3b4c72){while(--_0x3b4c72){_0x1f0724['push'](_0x1f0724['shift']());}};_0x253ffb(++_0x3a58bf);}(_0x06fd,0x82));var _0xd06f=function(_0x3b1582,_0x31a7ff){_0x3b1582=_0x3b1582-0x0;var _0x3f2d2f=_0x06fd[_0x3b1582];return _0x3f2d2f;};'use strict';var client=require(_0xd06f('0x0'));exports[_0xd06f('0x1')]=function(_0x4d1e85){return client['Request'](_0xd06f('0x2'),{'body':_0x4d1e85,'log':'CreateOpenchannelQueueReport'});};exports[_0xd06f('0x3')]=function(_0x1d4f8f,_0x27b7e9){return client[_0xd06f('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x27b7e9,'options':{'where':{'uniqueid':_0x1d4f8f},'order':[['id','DESC']],'limit':0x1},'log':_0xd06f('0x5')});}; \ No newline at end of file +var _0x2c47=['DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x2c47,0x80));var _0x72c4=function(_0x5e341b,_0x24318f){_0x5e341b=_0x5e341b-0x0;var _0x49766e=_0x2c47[_0x5e341b];return _0x49766e;};'use strict';var client=require(_0x72c4('0x0'));exports[_0x72c4('0x1')]=function(_0x2d299c){return client[_0x72c4('0x2')](_0x72c4('0x3'),{'body':_0x2d299c,'log':_0x72c4('0x3')});};exports[_0x72c4('0x4')]=function(_0x3c6f71,_0x2ddce1){return client[_0x72c4('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2ddce1,'options':{'where':{'uniqueid':_0x3c6f71},'order':[['id',_0x72c4('0x5')]],'limit':0x1},'log':_0x72c4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ac1ca2c..9bb3ede 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 _0x589e=['Request','AddTagsToSmsInteraction','update','UpdateSmsInteraction'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x589e,0x7e));var _0xe589=function(_0x3010cd,_0x23ee74){_0x3010cd=_0x3010cd-0x0;var _0x43b56a=_0x589e[_0x3010cd];return _0x43b56a;};'use strict';var client=require('../client');exports[_0xe589('0x0')]=function(_0x3d9472,_0x180e66){return client['Request'](_0xe589('0x1'),{'body':_0x180e66,'options':{'where':{'id':_0x3d9472}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x26485a,_0x239f6a){return client[_0xe589('0x2')](_0xe589('0x3'),{'body':_0x239f6a,'options':{'where':{'id':_0x26485a}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x9fee=['AddTagsToSmsInteraction','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9fee,0x1e7));var _0xe9fe=function(_0x34541c,_0x4fbeb8){_0x34541c=_0x34541c-0x0;var _0x54a856=_0x9fee[_0x34541c];return _0x54a856;};'use strict';var client=require('../client');exports[_0xe9fe('0x0')]=function(_0x428664,_0x498617){return client['Request'](_0xe9fe('0x1'),{'body':_0x498617,'options':{'where':{'id':_0x428664}},'log':_0xe9fe('0x2')});};exports[_0xe9fe('0x3')]=function(_0x31aae7,_0x16f9f5){return client[_0xe9fe('0x4')](_0xe9fe('0x5'),{'body':_0x16f9f5,'options':{'where':{'id':_0x31aae7}},'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 10d438f..e0f889e 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 _0xa25a=['../client','create','Request'];(function(_0x211eda,_0x51c2cc){var _0x81814e=function(_0x18ca93){while(--_0x18ca93){_0x211eda['push'](_0x211eda['shift']());}};_0x81814e(++_0x51c2cc);}(_0xa25a,0x153));var _0xaa25=function(_0x3d2458,_0x369ae4){_0x3d2458=_0x3d2458-0x0;var _0x497934=_0xa25a[_0x3d2458];return _0x497934;};'use strict';var client=require(_0xaa25('0x0'));exports[_0xaa25('0x1')]=function(_0x37a41c){return client[_0xaa25('0x2')]('CreateSmsMessage',{'body':_0x37a41c,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xfc9f=['Request','CreateSmsMessage','create'];(function(_0x151f72,_0x3117de){var _0x3ee71b=function(_0x92176f){while(--_0x92176f){_0x151f72['push'](_0x151f72['shift']());}};_0x3ee71b(++_0x3117de);}(_0xfc9f,0x1d6));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xffc9('0x0')]=function(_0x263ee8){return client[_0xffc9('0x1')](_0xffc9('0x2'),{'body':_0x263ee8,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 4d9b619..1dcd864 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 _0x6a8a=['name','timeout','strategy','User','online','smsPause','getSmsQueues','GetSmsQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6a8a,0x1e6));var _0xa6a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a8a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xa6a8('0x0')]=function(){return function(){return client['Request'](_0xa6a8('0x1'),{'options':{'raw':![],'attributes':['id',_0xa6a8('0x2'),_0xa6a8('0x3'),_0xa6a8('0x4')],'include':[{'model':_0xa6a8('0x5'),'as':'Agents','attributes':['id',_0xa6a8('0x2'),_0xa6a8('0x6'),_0xa6a8('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x00d9=['../client','getSmsQueues','Request','GetSmsQueue','name','timeout','User','Agents','online','smsPause'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x00d9,0x154));var _0x900d=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x00d9[_0x487b0c];return _0x1adbdc;};'use strict';var client=require(_0x900d('0x0'));exports[_0x900d('0x1')]=function(){return function(){return client[_0x900d('0x2')](_0x900d('0x3'),{'options':{'raw':![],'attributes':['id',_0x900d('0x4'),_0x900d('0x5'),'strategy'],'include':[{'model':_0x900d('0x6'),'as':_0x900d('0x7'),'attributes':['id',_0x900d('0x4'),_0x900d('0x8'),_0x900d('0x9')]}]},'log':_0x900d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6b3b716..b5acb69 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 _0x2472=['../client','create','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x1488fa,_0x49cdeb){var _0x18f241=function(_0x57a803){while(--_0x57a803){_0x1488fa['push'](_0x1488fa['shift']());}};_0x18f241(++_0x49cdeb);}(_0x2472,0xd8));var _0x2247=function(_0x4d0218,_0x112037){_0x4d0218=_0x4d0218-0x0;var _0x33d4e0=_0x2472[_0x4d0218];return _0x33d4e0;};'use strict';var client=require(_0x2247('0x0'));exports[_0x2247('0x1')]=function(_0x14b539){return client['Request']('CreateSmsQueueReport',{'body':_0x14b539,'log':'CreateSmsQueueReport'});};exports[_0x2247('0x2')]=function(_0x551ddd,_0xf34306){return client[_0x2247('0x3')](_0x2247('0x4'),{'body':_0xf34306,'options':{'where':{'uniqueid':_0x551ddd},'order':[['id',_0x2247('0x5')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x9b87=['UpdateSmsQueueReport','../client','create','CreateSmsQueueReport','Request','DESC'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9b87,0x7f));var _0x79b8=function(_0x593cdc,_0x57f466){_0x593cdc=_0x593cdc-0x0;var _0x523a20=_0x9b87[_0x593cdc];return _0x523a20;};'use strict';var client=require(_0x79b8('0x0'));exports[_0x79b8('0x1')]=function(_0x543300){return client['Request'](_0x79b8('0x2'),{'body':_0x543300,'log':_0x79b8('0x2')});};exports['update']=function(_0x57e533,_0x48a5a4){return client[_0x79b8('0x3')]('UpdateSmsQueueReport',{'body':_0x48a5a4,'options':{'where':{'uniqueid':_0x57e533},'order':[['id',_0x79b8('0x4')]],'limit':0x1},'log':_0x79b8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6662460..3e8b748 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 _0x8bee=['agent','pauseType','voicePause','chatPause','mailPause','faxPause','whatsappPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x8bee,0x11b));var _0xe8be=function(_0x275c17,_0x4fd8aa){_0x275c17=_0x275c17-0x0;var _0x22a6e6=_0x8bee[_0x275c17];return _0x22a6e6;};'use strict';var client=require(_0xe8be('0x0'));exports[_0xe8be('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0xe8be('0x2')},'attributes':['id','name','online',_0xe8be('0x3'),'lastPauseAt',_0xe8be('0x4'),_0xe8be('0x5'),_0xe8be('0x6'),_0xe8be('0x7'),'smsPause',_0xe8be('0x8'),'openchannelPause',_0xe8be('0x9'),_0xe8be('0xa'),_0xe8be('0xb'),_0xe8be('0xc'),_0xe8be('0xd'),_0xe8be('0xe')]},'log':_0xe8be('0x1')});};}; \ No newline at end of file +var _0x4ddc=['chatPause','faxPause','smsPause','whatsappPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','name','online','pauseType','lastPauseAt','voicePause'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x4ddc,0xf8));var _0xc4dd=function(_0x32546b,_0x231219){_0x32546b=_0x32546b-0x0;var _0x2035cc=_0x4ddc[_0x32546b];return _0x2035cc;};'use strict';var client=require(_0xc4dd('0x0'));exports[_0xc4dd('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xc4dd('0x2'),_0xc4dd('0x3'),_0xc4dd('0x4'),_0xc4dd('0x5'),_0xc4dd('0x6'),_0xc4dd('0x7'),'mailPause',_0xc4dd('0x8'),_0xc4dd('0x9'),_0xc4dd('0xa'),_0xc4dd('0xb'),'chatCapacity',_0xc4dd('0xc'),_0xc4dd('0xd'),_0xc4dd('0xe'),_0xc4dd('0xf'),_0xc4dd('0x10')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index d6da759..f756811 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 _0xd51f=['../client','update','Request','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction'];(function(_0x38721e,_0x18f4eb){var _0x177434=function(_0x276021){while(--_0x276021){_0x38721e['push'](_0x38721e['shift']());}};_0x177434(++_0x18f4eb);}(_0xd51f,0xf0));var _0xfd51=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd51f[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xfd51('0x0'));exports[_0xfd51('0x1')]=function(_0x487db5,_0x270095){return client[_0xfd51('0x2')]('UpdateWhatsappInteraction',{'body':_0x270095,'options':{'where':{'id':_0x487db5}},'log':_0xfd51('0x3')});};exports[_0xfd51('0x4')]=function(_0x49bb3e,_0x3efc9b){return client[_0xfd51('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x3efc9b,'options':{'where':{'id':_0x49bb3e}},'log':_0xfd51('0x5')});}; \ No newline at end of file +var _0x1da1=['../client','update','Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0x1da1,0x1a4));var _0x11da=function(_0x25b7f2,_0xf70626){_0x25b7f2=_0x25b7f2-0x0;var _0x584146=_0x1da1[_0x25b7f2];return _0x584146;};'use strict';var client=require(_0x11da('0x0'));exports[_0x11da('0x1')]=function(_0x1e305a,_0x38a3f0){return client[_0x11da('0x2')]('UpdateWhatsappInteraction',{'body':_0x38a3f0,'options':{'where':{'id':_0x1e305a}},'log':'updateWhatsappInteraction'});};exports[_0x11da('0x3')]=function(_0x1beca5,_0x3d6bd5){return client['Request'](_0x11da('0x4'),{'body':_0x3d6bd5,'options':{'where':{'id':_0x1beca5}},'log':_0x11da('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a1086f3..e2c6038 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 _0xb2ec=['CreateWhatsappMessage','createWhatsappMessage','../client','Request'];(function(_0x2ae0ba,_0x249851){var _0x4ee112=function(_0x4d53f0){while(--_0x4d53f0){_0x2ae0ba['push'](_0x2ae0ba['shift']());}};_0x4ee112(++_0x249851);}(_0xb2ec,0xce));var _0xcb2e=function(_0x19d034,_0x4df5e0){_0x19d034=_0x19d034-0x0;var _0x8435f9=_0xb2ec[_0x19d034];return _0x8435f9;};'use strict';var client=require(_0xcb2e('0x0'));exports['create']=function(_0x1a1e25){return client[_0xcb2e('0x1')](_0xcb2e('0x2'),{'body':_0x1a1e25,'log':_0xcb2e('0x3')});}; \ No newline at end of file +var _0x45f0=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x413bac,_0xf40cee){var _0x1b46bd=function(_0x454acf){while(--_0x454acf){_0x413bac['push'](_0x413bac['shift']());}};_0x1b46bd(++_0xf40cee);}(_0x45f0,0x1ab));var _0x045f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x45f0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x045f('0x0')]=function(_0xede266){return client[_0x045f('0x1')](_0x045f('0x2'),{'body':_0xede266,'log':_0x045f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index e76734f..c0909bd 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 _0x34b7=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause'];(function(_0x3cbf80,_0x5bf0d5){var _0x356e04=function(_0x3a74d7){while(--_0x3a74d7){_0x3cbf80['push'](_0x3cbf80['shift']());}};_0x356e04(++_0x5bf0d5);}(_0x34b7,0x196));var _0x734b=function(_0x4517cf,_0x3aaaca){_0x4517cf=_0x4517cf-0x0;var _0x408bf4=_0x34b7[_0x4517cf];return _0x408bf4;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x734b('0x0')](_0x734b('0x1'),{'options':{'raw':![],'attributes':['id',_0x734b('0x2'),_0x734b('0x3'),_0x734b('0x4')],'include':[{'model':_0x734b('0x5'),'as':'Agents','attributes':['id','name',_0x734b('0x6'),_0x734b('0x7')]}]},'log':_0x734b('0x8')});};}; \ No newline at end of file +var _0x2e54=['../client','GetWhatsappQueue','name','timeout','strategy','User','Agents','whatsappPause','getWhatsappQueues'];(function(_0x26a382,_0x3d54db){var _0x14f9c8=function(_0x1b69f6){while(--_0x1b69f6){_0x26a382['push'](_0x26a382['shift']());}};_0x14f9c8(++_0x3d54db);}(_0x2e54,0x1dd));var _0x42e5=function(_0x5c10b8,_0x5ef705){_0x5c10b8=_0x5c10b8-0x0;var _0xd968db=_0x2e54[_0x5c10b8];return _0xd968db;};'use strict';var client=require(_0x42e5('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x42e5('0x1'),{'options':{'raw':![],'attributes':['id',_0x42e5('0x2'),_0x42e5('0x3'),_0x42e5('0x4')],'include':[{'model':_0x42e5('0x5'),'as':_0x42e5('0x6'),'attributes':['id',_0x42e5('0x2'),'online',_0x42e5('0x7')]}]},'log':_0x42e5('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 355f6ce..8209e0d 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 _0xf5b0=['create','CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf5b0,0x1f3));var _0x0f5b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf5b0[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0x0f5b('0x0'));exports[_0x0f5b('0x1')]=function(_0x41baee){return client['Request']('CreateWhatsappQueueReport',{'body':_0x41baee,'log':_0x0f5b('0x2')});};exports['update']=function(_0x309f80,_0x595219){return client[_0x0f5b('0x3')](_0x0f5b('0x4'),{'body':_0x595219,'options':{'where':{'uniqueid':_0x309f80},'order':[['id','DESC']],'limit':0x1},'log':_0x0f5b('0x4')});}; \ No newline at end of file +var _0x2054=['Request','UpdateWhatsappQueueReport','DESC','create','CreateWhatsappQueueReport','update'];(function(_0x45e7d2,_0x209147){var _0x4b7a13=function(_0x40fbc8){while(--_0x40fbc8){_0x45e7d2['push'](_0x45e7d2['shift']());}};_0x4b7a13(++_0x209147);}(_0x2054,0x165));var _0x4205=function(_0x209413,_0x3e0a60){_0x209413=_0x209413-0x0;var _0x1c7ee4=_0x2054[_0x209413];return _0x1c7ee4;};'use strict';var client=require('../client');exports[_0x4205('0x0')]=function(_0x1bc026){return client['Request'](_0x4205('0x1'),{'body':_0x1bc026,'log':_0x4205('0x1')});};exports[_0x4205('0x2')]=function(_0xb47def,_0x5ebbbe){return client[_0x4205('0x3')](_0x4205('0x4'),{'body':_0x5ebbbe,'options':{'where':{'uniqueid':_0xb47def},'order':[['id',_0x4205('0x5')]],'limit':0x1},'log':_0x4205('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 720c2f5..c4ad1bd 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 _0x1b62=['toLowerCase','consequence','validate','error','[%s][AGENT]\x20%s','map','message','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','stop','log','[%s][QUEUE]\x20%s','stack','lodash','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1b62,0x1f4));var _0x21b6=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x1b62[_0xfd9b19];return _0x514918;};'use strict';var schema=require('validate');var _=require(_0x21b6('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x21b6('0x1'))('routing');var strategy=require(_0x21b6('0x2'));var queue=schema({'name':{'type':_0x21b6('0x3'),'required':!![],'message':_0x21b6('0x4')},'timeout':{'type':_0x21b6('0x5'),'message':_0x21b6('0x6')}});function writeLog(_0x37b111,_0x48fe7d,_0x3375ad){return logger[_0x21b6('0x7')](util[_0x21b6('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x37b111,_0x48fe7d['name'],_0x3375ad));}function handleFindAgent(_0x3ab284){return function(_0x5bd587){return _0x5bd587[_0x21b6('0x9')]['toLowerCase']()===_0x3ab284[_0x21b6('0xa')]();};}exports[_0x21b6('0xb')]=function(_0x2f4a81,_0x10b05f,_0x4ddf7a,_0x24226b){return function(_0x480250){try{var _0x5eff3e={'name':_0x10b05f[0x0],'timeout':_0x10b05f[0x1]};var _0x2c9f56=queue[_0x21b6('0xc')](_0x5eff3e,{'typecast':!![]});if(_0x2c9f56['length']){logger[_0x21b6('0xd')](_0x21b6('0xe'),_0x2f4a81,_[_0x21b6('0xf')](_0x2c9f56,_0x21b6('0x10'))['join'](',\x20'));_0x480250['stop']();}else{var _0x5a1fae=_[_0x21b6('0x11')](_0x4ddf7a['agents'],handleFindAgent(_0x5eff3e['name']));if(_0x5a1fae){var _0x6a70a4=(_0x5eff3e[_0x21b6('0x12')]||0xa)*0x3e8;var _0x3c6baf,_0x48dfa5;var _0x302718=seqqueue[_0x21b6('0x13')](_0x6a70a4);_0x302718['id']=_0x2f4a81;_0x302718[_0x21b6('0x14')]=_0x6a70a4;_0x302718[_0x21b6('0x15')]=_0x24226b['channel'];writeLog(_0x2f4a81,_0x5a1fae,util['format'](_0x21b6('0x16'),_0x6a70a4));_0x4ddf7a[_0x21b6('0x17')][_0x2f4a81]['on'](_0x21b6('0x18'),function(){logger[_0x21b6('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x2f4a81);clearTimeout(_0x48dfa5);_0x48dfa5=undefined;_0x302718[_0x21b6('0x19')]();if(_0x4ddf7a[_0x21b6('0x17')][_0x2f4a81]){delete _0x4ddf7a[_0x21b6('0x17')][_0x2f4a81];}_0x480250['stop']();});_0x4ddf7a['rules'][_0x2f4a81]['on'](_0x21b6('0x1a'),function(){if(_0x4ddf7a[_0x21b6('0x17')][_0x2f4a81]){delete _0x4ddf7a[_0x21b6('0x17')][_0x2f4a81];}});_0x48dfa5=setTimeout(function(){logger[_0x21b6('0x7')](_0x21b6('0x1b'),_0x2f4a81);clearTimeout(_0x48dfa5);_0x302718[_0x21b6('0x19')]();_0x480250[_0x21b6('0x1c')]();},_0x6a70a4);strategy[_0x21b6('0x1d')](_0x302718,_0x5a1fae,_0x4ddf7a,_0x24226b);}else{logger[_0x21b6('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x2f4a81,_0x5eff3e[_0x21b6('0x9')]);_0x480250[_0x21b6('0x1e')]();}}}catch(_0x238660){console[_0x21b6('0x1f')](_0x238660);logger[_0x21b6('0xd')](_0x21b6('0x20'),_0x2f4a81,_0x238660[_0x21b6('0x21')]);_0x480250[_0x21b6('0x1e')]();}};}; \ No newline at end of file +var _0x98f4=['[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end'];(function(_0x339029,_0x16c972){var _0xc8a4aa=function(_0x27c497){while(--_0x27c497){_0x339029['push'](_0x339029['shift']());}};_0xc8a4aa(++_0x16c972);}(_0x98f4,0x78));var _0x498f=function(_0x4454e7,_0x2e916a){_0x4454e7=_0x4454e7-0x0;var _0x4c2a56=_0x98f4[_0x4454e7];return _0x4c2a56;};'use strict';var schema=require(_0x498f('0x0'));var _=require(_0x498f('0x1'));var util=require(_0x498f('0x2'));var seqqueue=require(_0x498f('0x3'));var logger=require('../../../../config/logger')(_0x498f('0x4'));var strategy=require(_0x498f('0x5'));var queue=schema({'name':{'type':_0x498f('0x6'),'required':!![],'message':_0x498f('0x7')},'timeout':{'type':'number','message':_0x498f('0x8')}});function writeLog(_0x23996b,_0x168cdb,_0x38ab20){return logger[_0x498f('0x9')](util[_0x498f('0xa')](_0x498f('0xb'),_0x23996b,_0x168cdb[_0x498f('0xc')],_0x38ab20));}function handleFindAgent(_0x1698a0){return function(_0x57a1c8){return _0x57a1c8[_0x498f('0xc')]['toLowerCase']()===_0x1698a0[_0x498f('0xd')]();};}exports[_0x498f('0xe')]=function(_0x275eb3,_0x4f07f9,_0x13c5a0,_0x40ffba){return function(_0x299967){try{var _0x3107b3={'name':_0x4f07f9[0x0],'timeout':_0x4f07f9[0x1]};var _0x5687f7=queue['validate'](_0x3107b3,{'typecast':!![]});if(_0x5687f7[_0x498f('0xf')]){logger[_0x498f('0x10')]('[%s][AGENT]\x20%s',_0x275eb3,_['map'](_0x5687f7,_0x498f('0x11'))[_0x498f('0x12')](',\x20'));_0x299967[_0x498f('0x13')]();}else{var _0x5c3d93=_[_0x498f('0x14')](_0x13c5a0[_0x498f('0x15')],handleFindAgent(_0x3107b3[_0x498f('0xc')]));if(_0x5c3d93){var _0xbdaf84=(_0x3107b3[_0x498f('0x16')]||0xa)*0x3e8;var _0x250c76,_0x203e90;var _0x1d354c=seqqueue[_0x498f('0x17')](_0xbdaf84);_0x1d354c['id']=_0x275eb3;_0x1d354c[_0x498f('0x18')]=_0xbdaf84;_0x1d354c[_0x498f('0x19')]=_0x40ffba[_0x498f('0x19')];writeLog(_0x275eb3,_0x5c3d93,util[_0x498f('0xa')]('START:%s',_0xbdaf84));_0x13c5a0[_0x498f('0x1a')][_0x275eb3]['on'](_0x498f('0x1b'),function(){logger[_0x498f('0x9')](_0x498f('0x1c'),_0x275eb3);clearTimeout(_0x203e90);_0x203e90=undefined;_0x1d354c[_0x498f('0x1d')]();if(_0x13c5a0[_0x498f('0x1a')][_0x275eb3]){delete _0x13c5a0[_0x498f('0x1a')][_0x275eb3];}_0x299967[_0x498f('0x13')]();});_0x13c5a0[_0x498f('0x1a')][_0x275eb3]['on'](_0x498f('0x1e'),function(){if(_0x13c5a0[_0x498f('0x1a')][_0x275eb3]){delete _0x13c5a0[_0x498f('0x1a')][_0x275eb3];}});_0x203e90=setTimeout(function(){logger['info'](_0x498f('0x1f'),_0x275eb3);clearTimeout(_0x203e90);_0x1d354c['close']();_0x299967[_0x498f('0x20')]();},_0xbdaf84);strategy[_0x498f('0x21')](_0x1d354c,_0x5c3d93,_0x13c5a0,_0x40ffba);}else{logger[_0x498f('0x10')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x275eb3,_0x3107b3[_0x498f('0xc')]);_0x299967[_0x498f('0x13')]();}}}catch(_0x4c745a){console[_0x498f('0x22')](_0x4c745a);logger[_0x498f('0x10')](_0x498f('0x23'),_0x275eb3,_0x4c745a[_0x498f('0x24')]);_0x299967['stop']();}};}; \ 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 a525008..67e6d5e 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 _0x0295=['Message','create','then','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','message','dialogState','lodash','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst','interaction','created','isEmpty','body','getMustacheRender'];(function(_0x4e9182,_0x3b49b1){var _0x17aef7=function(_0x516e65){while(--_0x516e65){_0x4e9182['push'](_0x4e9182['shift']());}};_0x17aef7(++_0x3b49b1);}(_0x0295,0x1f0));var _0x5029=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x0295[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require(_0x5029('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x5029('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x5029('0x2')),'openchannelMessage':require(_0x5029('0x3')),'mailMessage':require(_0x5029('0x4')),'smsMessage':require(_0x5029('0x5')),'faxMessage':require(_0x5029('0x6')),'whatsappMessage':require(_0x5029('0x7'))};exports[_0x5029('0x8')]=function(_0x215955,_0x5b3cd){return function(_0x502a62){try{if(!_['isNil'](this['interaction'][_0x5029('0x9')])){logger['info'](_0x5029('0xa'),_0x215955,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x502a62[_0x5029('0xb')]();}var _0x520bc3={'ContactId':this[_0x5029('0xc')]['id'],'sentAt':moment()[_0x5029('0xd')](_0x5029('0xe')),'direction':'out'};var _0x3f4c48=this[_0x5029('0xf')];if(_0x3f4c48===_0x5029('0x10')){_0x520bc3['ChatWebsiteId']=this[_0x5029('0x11')]['id'];}else{_0x520bc3[_[_0x5029('0x12')](_0x3f4c48)+'AccountId']=this['account']['id'];}_0x520bc3[_['upperFirst'](_0x3f4c48)+'InteractionId']=this[_0x5029('0x13')]['id'];if(this[_0x5029('0x13')][_0x5029('0x14')]){var _0x434630=_0x5b3cd[0x4];if(!_[_0x5029('0x15')](_0x434630)){_0x520bc3[_0x5029('0x16')]=utils[_0x5029('0x17')](_0x434630,this);return rpc[_0x3f4c48+_0x5029('0x18')][_0x5029('0x19')](_0x520bc3)[_0x5029('0x1a')](function(_0x457c73){logger[_0x5029('0x1b')](_0x5029('0xa'),_0x215955,_0x520bc3[_0x5029('0x16')]);})[_0x5029('0x1c')](function(_0x4f7ab4){logger[_0x5029('0x1d')](_0x5029('0xa'),_0x215955,JSON[_0x5029('0x1e')](_0x4f7ab4));})[_0x5029('0x1f')](function(){logger[_0x5029('0x1b')](_0x5029('0x20'),_0x215955);_0x502a62[_0x5029('0x21')]();});}else{logger['info'](_0x5029('0x22'),_0x215955);_0x502a62['stop']();}}else{var _0x16485c=this;var _0x8a414c=new AWS[(_0x5029('0x23'))]({'accessKeyId':_0x5b3cd[0x0],'secretAccessKey':_0x5b3cd[0x1],'region':_0x5b3cd[0x2]});var _0x3cf0fb={'botAlias':'$LATEST','botName':_0x5b3cd[0x3],'inputText':this['message'][_0x5029('0x16')],'userId':this['channel']+':'+this[_0x5029('0x13')]['id'][_0x5029('0x24')]()};_0x8a414c[_0x5029('0x25')](_0x3cf0fb,function(_0x2bbbcb,_0x16bd22){if(_0x2bbbcb){logger[_0x5029('0x1d')](_0x5029('0xa'),_0x215955,_0x2bbbcb[_0x5029('0x26')]);_0x502a62[_0x5029('0xb')]();}else if(_0x16bd22&&_0x16bd22['message']){_0x16485c['body']['amazonlex']=_0x16bd22;_0x520bc3[_0x5029('0x16')]=_0x16bd22[_0x5029('0x26')];return rpc[_0x3f4c48+'Message']['create'](_0x520bc3)[_0x5029('0x1a')](function(_0x1e7e61){logger[_0x5029('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x215955,_0x520bc3[_0x5029('0x16')]);if(_0x16bd22[_0x5029('0x27')]=='Failed'){_0x502a62[_0x5029('0xb')]();}else{_0x502a62[_0x5029('0x21')]();}})[_0x5029('0x1c')](function(_0x4a24b9){logger[_0x5029('0x1d')](_0x5029('0xa'),_0x215955,JSON[_0x5029('0x1e')](_0x4a24b9));_0x502a62['next']();});}else{_0x502a62[_0x5029('0xb')]();}});}}catch(_0x2bb398){logger['error'](_0x5029('0xa'),_0x215955,JSON[_0x5029('0x1e')](_0x2bb398));_0x502a62[_0x5029('0x21')]();}};}; \ No newline at end of file +var _0x6d38=['out','chat','account','upperFirst','AccountId','InteractionId','interaction','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','amazonlex','Failed','next','moment','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','contact'];(function(_0xca3e67,_0x59f8cb){var _0x1e985f=function(_0x3a376b){while(--_0x3a376b){_0xca3e67['push'](_0xca3e67['shift']());}};_0x1e985f(++_0x59f8cb);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var moment=require(_0x86d3('0x0'));var AWS=require(_0x86d3('0x1'));var utils=require(_0x86d3('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x86d3('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x86d3('0x4')),'smsMessage':require(_0x86d3('0x5')),'faxMessage':require(_0x86d3('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x86d3('0x7')]=function(_0xfbbc15,_0x33d4aa){return function(_0x2eaa15){try{if(!_['isNil'](this['interaction'][_0x86d3('0x8')])){logger[_0x86d3('0x9')](_0x86d3('0xa'),_0xfbbc15,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2eaa15['next']();}var _0x3ed317={'ContactId':this[_0x86d3('0xb')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x86d3('0xc')};var _0x4dc834=this['channel'];if(_0x4dc834===_0x86d3('0xd')){_0x3ed317['ChatWebsiteId']=this[_0x86d3('0xe')]['id'];}else{_0x3ed317[_[_0x86d3('0xf')](_0x4dc834)+_0x86d3('0x10')]=this[_0x86d3('0xe')]['id'];}_0x3ed317[_[_0x86d3('0xf')](_0x4dc834)+_0x86d3('0x11')]=this[_0x86d3('0x12')]['id'];if(this[_0x86d3('0x12')]['created']){var _0x1c1ba8=_0x33d4aa[0x4];if(!_[_0x86d3('0x13')](_0x1c1ba8)){_0x3ed317[_0x86d3('0x14')]=utils[_0x86d3('0x15')](_0x1c1ba8,this);return rpc[_0x4dc834+_0x86d3('0x16')][_0x86d3('0x17')](_0x3ed317)[_0x86d3('0x18')](function(_0x44436d){logger['info'](_0x86d3('0xa'),_0xfbbc15,_0x3ed317[_0x86d3('0x14')]);})[_0x86d3('0x19')](function(_0xa26ea2){logger[_0x86d3('0x1a')](_0x86d3('0xa'),_0xfbbc15,JSON[_0x86d3('0x1b')](_0xa26ea2));})[_0x86d3('0x1c')](function(){logger[_0x86d3('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xfbbc15);_0x2eaa15[_0x86d3('0x1d')]();});}else{logger['info'](_0x86d3('0x1e'),_0xfbbc15);_0x2eaa15['stop']();}}else{var _0x52293e=this;var _0x41486a=new AWS[(_0x86d3('0x1f'))]({'accessKeyId':_0x33d4aa[0x0],'secretAccessKey':_0x33d4aa[0x1],'region':_0x33d4aa[0x2]});var _0x988066={'botAlias':_0x86d3('0x20'),'botName':_0x33d4aa[0x3],'inputText':this['message'][_0x86d3('0x14')],'userId':this['channel']+':'+this[_0x86d3('0x12')]['id'][_0x86d3('0x21')]()};_0x41486a[_0x86d3('0x22')](_0x988066,function(_0x5b990d,_0x39d819){if(_0x5b990d){logger[_0x86d3('0x1a')](_0x86d3('0xa'),_0xfbbc15,_0x5b990d['message']);_0x2eaa15['next']();}else if(_0x39d819&&_0x39d819[_0x86d3('0x23')]){_0x52293e['body'][_0x86d3('0x24')]=_0x39d819;_0x3ed317[_0x86d3('0x14')]=_0x39d819[_0x86d3('0x23')];return rpc[_0x4dc834+_0x86d3('0x16')]['create'](_0x3ed317)['then'](function(_0x3359e4){logger[_0x86d3('0x9')]('[%s][AMAZONLEX]\x20%s',_0xfbbc15,_0x3ed317[_0x86d3('0x14')]);if(_0x39d819['dialogState']==_0x86d3('0x25')){_0x2eaa15[_0x86d3('0x26')]();}else{_0x2eaa15[_0x86d3('0x1d')]();}})[_0x86d3('0x19')](function(_0x11a6fd){logger[_0x86d3('0x1a')](_0x86d3('0xa'),_0xfbbc15,JSON[_0x86d3('0x1b')](_0x11a6fd));_0x2eaa15[_0x86d3('0x26')]();});}else{_0x2eaa15[_0x86d3('0x26')]();}});}}catch(_0x206996){logger[_0x86d3('0x1a')](_0x86d3('0xa'),_0xfbbc15,JSON[_0x86d3('0x1b')](_0x206996));_0x2eaa15['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 21cabd1..8d032b7 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 _0x07c2=['Smtp','service','host','port','secure','user','inReplyTo','messageId','','replace','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','finally','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','next','channel','getMustacheRender','contact','format','out','message','from','phone','read','subject','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail'];(function(_0x22e250,_0x1aa5ab){var _0x40fb9a=function(_0x251fda){while(--_0x251fda){_0x22e250['push'](_0x22e250['shift']());}};_0x40fb9a(++_0x1aa5ab);}(_0x07c2,0xf1));var _0x207c=function(_0x37464d,_0x29bf11){_0x37464d=_0x37464d-0x0;var _0x4e7573=_0x07c2[_0x37464d];return _0x4e7573;};'use strict';var _=require(_0x207c('0x0'));var moment=require('moment');var utils=require(_0x207c('0x1'));var logger=require('../../../../config/logger')(_0x207c('0x2'));var rpc={'chatMessage':require(_0x207c('0x3')),'openchannelMessage':require(_0x207c('0x4')),'mailMessage':require(_0x207c('0x5')),'smsMessage':require(_0x207c('0x6')),'faxMessage':require(_0x207c('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x207c('0x8'));exports[_0x207c('0x9')]=function(_0x40db91,_0x397d0f){return function(_0x538561){try{if(_0x397d0f[0x0]==='1'&&(_[_0x207c('0xa')](this['interaction']['created'])||!this[_0x207c('0xb')][_0x207c('0xc')])){logger[_0x207c('0xd')](_0x207c('0xe'),_0x40db91,'Autoreply\x20already\x20sent');return _0x538561[_0x207c('0xf')]();}var _0x1403cf=this[_0x207c('0x10')];var _0x2807be={'body':utils[_0x207c('0x11')](_0x397d0f[0x1],this),'ContactId':this[_0x207c('0x12')]['id'],'sentAt':moment()[_0x207c('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x207c('0x14')};if(this['message']){_0x2807be['to']=this[_0x207c('0x15')]['from']||'';_0x2807be['cc']=this['message']['cc']||'';_0x2807be[_0x207c('0x16')]=this[_0x207c('0x15')]['to']||'';_0x2807be['phone']=this[_0x207c('0x15')][_0x207c('0x17')]||'';_0x2807be[_0x207c('0x18')]=!![];if(this[_0x207c('0x15')][_0x207c('0x19')]){_0x2807be['subject']='';_0x2807be[_0x207c('0x19')]+=_['startsWith'](this[_0x207c('0x15')][_0x207c('0x19')],'Re:')?'':'Re:\x20';_0x2807be[_0x207c('0x19')]+=this[_0x207c('0x15')]['subject'];}}if(this[_0x207c('0x10')]===_0x207c('0x1a')){_0x2807be[_0x207c('0x1b')]=this[_0x207c('0x1c')]['id'];}else{_0x2807be[_[_0x207c('0x1d')](this[_0x207c('0x10')])+_0x207c('0x1e')]=this['account']['id'];}_0x2807be[_[_0x207c('0x1d')](this[_0x207c('0x10')])+_0x207c('0x1f')]=this[_0x207c('0xb')]['id'];if(rpc[this[_0x207c('0x10')]+_0x207c('0x20')]){if(this[_0x207c('0x10')]===_0x207c('0x21')){var _0x30c1de={'tls':{'rejectUnauthorized':![]}};if(this[_0x207c('0x1c')][_0x207c('0x22')][_0x207c('0x23')]){_0x30c1de['service']=this['account'][_0x207c('0x22')]['service'];}else{_0x30c1de[_0x207c('0x24')]=this[_0x207c('0x1c')][_0x207c('0x22')][_0x207c('0x24')];_0x30c1de['port']=this[_0x207c('0x1c')][_0x207c('0x22')][_0x207c('0x25')];_0x30c1de[_0x207c('0x26')]=this[_0x207c('0x1c')][_0x207c('0x22')]['secure'];}if(this[_0x207c('0x1c')][_0x207c('0x22')]['authentication']){_0x30c1de['auth']={'user':this[_0x207c('0x1c')][_0x207c('0x22')][_0x207c('0x27')],'pass':this['account'][_0x207c('0x22')]['pass']};}_0x2807be[_0x207c('0x28')]=this[_0x207c('0x15')][_0x207c('0x29')];_0x2807be['html']=_0x207c('0x2a')+_[_0x207c('0x2b')](_0x2807be[_0x207c('0x2c')],_0x207c('0x2d'),'','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','create','[%s][AUTOREPLY]\x20%s','body','catch','error','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','AccountId','upperFirst','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','replace'];(function(_0x26d350,_0x28a857){var _0x2f9b67=function(_0x42df12){while(--_0x42df12){_0x26d350['push'](_0x26d350['shift']());}};_0x2f9b67(++_0x28a857);}(_0x13a4,0x89));var _0x413a=function(_0x2bc70c,_0x182f99){_0x2bc70c=_0x2bc70c-0x0;var _0x1bd019=_0x13a4[_0x2bc70c];return _0x1bd019;};'use strict';var _=require(_0x413a('0x0'));var moment=require(_0x413a('0x1'));var utils=require(_0x413a('0x2'));var logger=require(_0x413a('0x3'))(_0x413a('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x413a('0x5')),'mailMessage':require(_0x413a('0x6')),'smsMessage':require(_0x413a('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x413a('0x8'));exports[_0x413a('0x9')]=function(_0x528f54,_0x1336a2){return function(_0x1c9e34){try{if(_0x1336a2[0x0]==='1'&&(_[_0x413a('0xa')](this[_0x413a('0xb')][_0x413a('0xc')])||!this[_0x413a('0xb')][_0x413a('0xc')])){logger[_0x413a('0xd')]('[%s][AUTOREPLY]\x20%s',_0x528f54,_0x413a('0xe'));return _0x1c9e34[_0x413a('0xf')]();}var _0x41761e=this[_0x413a('0x10')];var _0x314560={'body':utils[_0x413a('0x11')](_0x1336a2[0x1],this),'ContactId':this[_0x413a('0x12')]['id'],'sentAt':moment()[_0x413a('0x13')](_0x413a('0x14')),'direction':_0x413a('0x15')};if(this[_0x413a('0x16')]){_0x314560['to']=this[_0x413a('0x16')]['from']||'';_0x314560['cc']=this[_0x413a('0x16')]['cc']||'';_0x314560['from']=this[_0x413a('0x16')]['to']||'';_0x314560[_0x413a('0x17')]=this[_0x413a('0x16')][_0x413a('0x17')]||'';_0x314560['read']=!![];if(this[_0x413a('0x16')][_0x413a('0x18')]){_0x314560['subject']='';_0x314560[_0x413a('0x18')]+=_[_0x413a('0x19')](this[_0x413a('0x16')][_0x413a('0x18')],_0x413a('0x1a'))?'':_0x413a('0x1b');_0x314560['subject']+=this[_0x413a('0x16')][_0x413a('0x18')];}}if(this[_0x413a('0x10')]==='chat'){_0x314560[_0x413a('0x1c')]=this[_0x413a('0x1d')]['id'];}else{_0x314560[_['upperFirst'](this[_0x413a('0x10')])+_0x413a('0x1e')]=this[_0x413a('0x1d')]['id'];}_0x314560[_[_0x413a('0x1f')](this[_0x413a('0x10')])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0x413a('0x20')]){if(this[_0x413a('0x10')]===_0x413a('0x21')){var _0x31ab74={'tls':{'rejectUnauthorized':![]}};if(this[_0x413a('0x1d')][_0x413a('0x22')][_0x413a('0x23')]){_0x31ab74['service']=this[_0x413a('0x1d')][_0x413a('0x22')]['service'];}else{_0x31ab74[_0x413a('0x24')]=this[_0x413a('0x1d')]['Smtp']['host'];_0x31ab74['port']=this[_0x413a('0x1d')][_0x413a('0x22')][_0x413a('0x25')];_0x31ab74[_0x413a('0x26')]=this[_0x413a('0x1d')][_0x413a('0x22')][_0x413a('0x26')];}if(this[_0x413a('0x1d')][_0x413a('0x22')][_0x413a('0x27')]){_0x31ab74[_0x413a('0x28')]={'user':this[_0x413a('0x1d')][_0x413a('0x22')][_0x413a('0x29')],'pass':this['account']['Smtp'][_0x413a('0x2a')]};}_0x314560[_0x413a('0x2b')]=this['message'][_0x413a('0x2c')];_0x314560['html']=''+_[_0x413a('0x2d')](_0x314560['body'],_0x413a('0x2e'),_0x413a('0x2f'))+_0x413a('0x30');return mailRpc[_0x413a('0x31')](_0x31ab74,_0x314560)[_0x413a('0x32')](function(_0x364391){logger[_0x413a('0xd')](_0x413a('0x33'),_0x528f54);_0x314560[_0x413a('0x2c')]=_0x364391[_0x413a('0x16')]['messageId'];return rpc[_0x41761e+_0x413a('0x20')]['create'](_0x314560);})[_0x413a('0x32')](function(_0x1d2891){logger[_0x413a('0xd')]('[%s][AUTOREPLY]\x20%s',_0x528f54,JSON[_0x413a('0x34')](_0x1d2891));})['catch'](function(_0x1787aa){logger['error'](_0x413a('0x35'),_0x528f54,JSON[_0x413a('0x34')](_0x1787aa));})[_0x413a('0x36')](function(){_0x1c9e34[_0x413a('0xf')]();});}else{return rpc[this[_0x413a('0x10')]+_0x413a('0x20')][_0x413a('0x37')](_0x314560)[_0x413a('0x32')](function(_0x435cb9){logger['info'](_0x413a('0x38'),_0x528f54,_0x314560[_0x413a('0x39')]);})[_0x413a('0x3a')](function(_0x243ce7){logger[_0x413a('0x3b')]('[%s][AUTOREPLY]\x20%s',_0x528f54,JSON['stringify'](_0x243ce7));})[_0x413a('0x36')](function(){_0x1c9e34['next']();});}}}catch(_0x4ffa41){logger[_0x413a('0x3b')](_0x413a('0x38'),_0x528f54,JSON[_0x413a('0x34')](_0x4ffa41));_0x1c9e34[_0x413a('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index b256b30..0c08d75 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7409=['info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7409,0x6e));var _0x9740=function(_0x54e81a,_0x4ba69d){_0x54e81a=_0x54e81a-0x0;var _0x937fe=_0x7409[_0x54e81a];return _0x937fe;};'use strict';var moment=require(_0x9740('0x0'));var logger=require(_0x9740('0x1'))('routing');var rpc={'chatInteraction':require(_0x9740('0x2')),'openchannelInteraction':require(_0x9740('0x3')),'smsInteraction':require(_0x9740('0x4')),'mailInteraction':require(_0x9740('0x5')),'faxInteraction':require(_0x9740('0x6')),'whatsappInteraction':require(_0x9740('0x7'))};exports[_0x9740('0x8')]=function(_0x2bb453,_0x235c09,_0x547490,_0x19865c){return function(_0x96d19c){try{logger[_0x9740('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x2bb453,_0x235c09[0x0]);var _0x279226={'closed':0x1,'closedAt':moment()[_0x9740('0xa')](_0x9740('0xb')),'closeReason':'system','disposition':_0x235c09[0x0]};if(rpc[_0x19865c[_0x9740('0xc')]+'Interaction']){rpc[_0x19865c[_0x9740('0xc')]+_0x9740('0xd')]['update'](_0x19865c['interaction']['id'],_0x279226)['then'](function(_0xee781d){logger[_0x9740('0x9')](_0x9740('0xe'),_0x2bb453,_0x19865c['interaction']['id']);})['catch'](function(_0x5263b3){logger['error']('[%s][CLOSE]\x20%s',_0x2bb453,JSON['stringify'](_0x5263b3));})['finally'](function(){_0x96d19c[_0x9740('0xf')]();});}}catch(_0x4d50ad){logger['error'](_0x9740('0x10'),_0x2bb453,JSON['stringify'](_0x4d50ad));_0x96d19c[_0x9740('0xf')]();}};}; \ No newline at end of file +var _0xb491=['catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb491,0x18c));var _0x1b49=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xb491[_0x3635ce];return _0x97ecd0;};'use strict';var moment=require(_0x1b49('0x0'));var logger=require(_0x1b49('0x1'))(_0x1b49('0x2'));var rpc={'chatInteraction':require(_0x1b49('0x3')),'openchannelInteraction':require(_0x1b49('0x4')),'smsInteraction':require(_0x1b49('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1b49('0x6')),'whatsappInteraction':require(_0x1b49('0x7'))};exports['consequence']=function(_0xa15129,_0x24cc0c,_0x22b7c1,_0x5d9945){return function(_0x212aee){try{logger['info'](_0x1b49('0x8'),_0xa15129,_0x24cc0c[0x0]);var _0x3d5da7={'closed':0x1,'closedAt':moment()[_0x1b49('0x9')](_0x1b49('0xa')),'closeReason':_0x1b49('0xb'),'disposition':_0x24cc0c[0x0]};if(rpc[_0x5d9945[_0x1b49('0xc')]+_0x1b49('0xd')]){rpc[_0x5d9945[_0x1b49('0xc')]+_0x1b49('0xd')][_0x1b49('0xe')](_0x5d9945[_0x1b49('0xf')]['id'],_0x3d5da7)[_0x1b49('0x10')](function(_0x3100c9){logger[_0x1b49('0x11')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xa15129,_0x5d9945['interaction']['id']);})[_0x1b49('0x12')](function(_0x1fccba){logger[_0x1b49('0x13')](_0x1b49('0x14'),_0xa15129,JSON[_0x1b49('0x15')](_0x1fccba));})['finally'](function(){_0x212aee[_0x1b49('0x16')]();});}}catch(_0x549141){logger[_0x1b49('0x13')](_0x1b49('0x14'),_0xa15129,JSON[_0x1b49('0x15')](_0x549141));_0x212aee[_0x1b49('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 487bd7f..815ea38 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7ea=['lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','metadata','endConversation','next','stringify'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0xf7ea,0xdc));var _0xaf7e=function(_0x2318db,_0x5b180c){_0x2318db=_0x2318db-0x0;var _0x41bbcd=_0xf7ea[_0x2318db];return _0x41bbcd;};'use strict';var _=require(_0xaf7e('0x0'));var moment=require(_0xaf7e('0x1'));var apiai=require('apiai-promise');var md5=require(_0xaf7e('0x2'));var utils=require(_0xaf7e('0x3'));var logger=require(_0xaf7e('0x4'))(_0xaf7e('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaf7e('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xaf7e('0x7')),'faxMessage':require(_0xaf7e('0x8')),'whatsappMessage':require(_0xaf7e('0x9'))};exports['consequence']=function(_0x3d5459,_0x251d89){return function(_0x4703a2){try{if(!_[_0xaf7e('0xa')](this[_0xaf7e('0xb')][_0xaf7e('0xc')])){logger[_0xaf7e('0xd')](_0xaf7e('0xe'),_0x3d5459,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4703a2['next']();}var _0x594486={'ContactId':this[_0xaf7e('0xf')]['id'],'sentAt':moment()[_0xaf7e('0x10')](_0xaf7e('0x11')),'direction':_0xaf7e('0x12')};var _0x50e451=this[_0xaf7e('0x13')];if(_0x50e451===_0xaf7e('0x14')){_0x594486['ChatWebsiteId']=this[_0xaf7e('0x15')]['id'];}else{_0x594486[_['upperFirst'](_0x50e451)+'AccountId']=this[_0xaf7e('0x15')]['id'];}_0x594486[_['upperFirst'](_0x50e451)+'InteractionId']=this[_0xaf7e('0xb')]['id'];if(this[_0xaf7e('0xb')]['created']){var _0x223a92=_0x251d89[0x2];if(!_[_0xaf7e('0x16')](_0x223a92)){_0x594486[_0xaf7e('0x17')]=utils[_0xaf7e('0x18')](_0x223a92,this);return rpc[_0x50e451+_0xaf7e('0x19')][_0xaf7e('0x1a')](_0x594486)[_0xaf7e('0x1b')](function(_0x4c6cf9){logger['info'](_0xaf7e('0xe'),_0x3d5459,_0x594486[_0xaf7e('0x17')]);})[_0xaf7e('0x1c')](function(_0x50ca64){logger[_0xaf7e('0x1d')](_0xaf7e('0xe'),_0x3d5459,JSON['stringify'](_0x50ca64));})[_0xaf7e('0x1e')](function(){logger['info'](_0xaf7e('0x1f'),_0x3d5459);_0x4703a2[_0xaf7e('0x20')]();});}else{logger[_0xaf7e('0xd')](_0xaf7e('0x21'),_0x3d5459);_0x4703a2[_0xaf7e('0x20')]();}}else{var _0x2002a4=this;var _0x502341=apiai(_0x251d89[0x0],{'language':_0x251d89[0x1]||'en'});return _0x502341[_0xaf7e('0x22')](this[_0xaf7e('0x23')]['body'],{'sessionId':md5(this[_0xaf7e('0xb')]['id'])})[_0xaf7e('0x1b')](function(_0x52f627){_0x2002a4['body'][_0xaf7e('0x24')]=_0x52f627;_0x594486['body']=_0x52f627[_0xaf7e('0x25')][_0xaf7e('0x26')][_0xaf7e('0x27')];return rpc[_0x50e451+'Message']['create'](_0x594486)[_0xaf7e('0x1b')](function(_0x3d9b3d){logger[_0xaf7e('0xd')](_0xaf7e('0xe'),_0x3d5459,_0x594486[_0xaf7e('0x17')]);if(_0x52f627[_0xaf7e('0x25')][_0xaf7e('0x28')][_0xaf7e('0x29')]){_0x4703a2[_0xaf7e('0x2a')]();}else{_0x4703a2[_0xaf7e('0x20')]();}})[_0xaf7e('0x1c')](function(_0x449f77){logger[_0xaf7e('0x1d')](_0xaf7e('0xe'),_0x3d5459,JSON['stringify'](_0x449f77));_0x4703a2[_0xaf7e('0x2a')]();});})[_0xaf7e('0x1c')](function(_0x3724fd){logger[_0xaf7e('0x1d')](_0xaf7e('0xe'),_0x3d5459,_0x3724fd[_0xaf7e('0x23')]);_0x4703a2[_0xaf7e('0x2a')]();});}}catch(_0x15fa37){logger[_0xaf7e('0x1d')](_0xaf7e('0xe'),_0x3d5459,JSON[_0xaf7e('0x2b')](_0x15fa37));_0x4703a2[_0xaf7e('0x20')]();}};}; \ No newline at end of file +var _0xa276=['speech','create','endConversation','next','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','created','body','Message','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result'];(function(_0x249642,_0x59cd95){var _0x34a8a0=function(_0x4350c9){while(--_0x4350c9){_0x249642['push'](_0x249642['shift']());}};_0x34a8a0(++_0x59cd95);}(_0xa276,0x11c));var _0x6a27=function(_0x31f3a3,_0x3be6f2){_0x31f3a3=_0x31f3a3-0x0;var _0x3b821e=_0xa276[_0x31f3a3];return _0x3b821e;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0x6a27('0x0'));var md5=require(_0x6a27('0x1'));var utils=require(_0x6a27('0x2'));var logger=require('../../../../config/logger')(_0x6a27('0x3'));var rpc={'chatMessage':require(_0x6a27('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6a27('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6a27('0x6')),'whatsappMessage':require(_0x6a27('0x7'))};exports[_0x6a27('0x8')]=function(_0x3ab789,_0x1d4201){return function(_0x4a2fd6){try{if(!_['isNil'](this[_0x6a27('0x9')][_0x6a27('0xa')])){logger[_0x6a27('0xb')](_0x6a27('0xc'),_0x3ab789,_0x6a27('0xd'));return _0x4a2fd6['next']();}var _0x4be329={'ContactId':this[_0x6a27('0xe')]['id'],'sentAt':moment()[_0x6a27('0xf')](_0x6a27('0x10')),'direction':_0x6a27('0x11')};var _0x1ef915=this[_0x6a27('0x12')];if(_0x1ef915===_0x6a27('0x13')){_0x4be329[_0x6a27('0x14')]=this[_0x6a27('0x15')]['id'];}else{_0x4be329[_['upperFirst'](_0x1ef915)+'AccountId']=this['account']['id'];}_0x4be329[_['upperFirst'](_0x1ef915)+'InteractionId']=this['interaction']['id'];if(this[_0x6a27('0x9')][_0x6a27('0x16')]){var _0x44917d=_0x1d4201[0x2];if(!_['isEmpty'](_0x44917d)){_0x4be329[_0x6a27('0x17')]=utils['getMustacheRender'](_0x44917d,this);return rpc[_0x1ef915+_0x6a27('0x18')]['create'](_0x4be329)[_0x6a27('0x19')](function(_0x2cba53){logger[_0x6a27('0xb')](_0x6a27('0xc'),_0x3ab789,_0x4be329[_0x6a27('0x17')]);})[_0x6a27('0x1a')](function(_0x1e1c59){logger[_0x6a27('0x1b')](_0x6a27('0xc'),_0x3ab789,JSON[_0x6a27('0x1c')](_0x1e1c59));})[_0x6a27('0x1d')](function(){logger[_0x6a27('0xb')](_0x6a27('0x1e'),_0x3ab789);_0x4a2fd6[_0x6a27('0x1f')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3ab789);_0x4a2fd6[_0x6a27('0x1f')]();}}else{var _0x366571=this;var _0xc9efea=apiai(_0x1d4201[0x0],{'language':_0x1d4201[0x1]||'en'});return _0xc9efea[_0x6a27('0x20')](this[_0x6a27('0x21')][_0x6a27('0x17')],{'sessionId':md5(this[_0x6a27('0x9')]['id'])})[_0x6a27('0x19')](function(_0x3f56c5){_0x366571['body'][_0x6a27('0x22')]=_0x3f56c5;_0x4be329[_0x6a27('0x17')]=_0x3f56c5[_0x6a27('0x23')]['fulfillment'][_0x6a27('0x24')];return rpc[_0x1ef915+_0x6a27('0x18')][_0x6a27('0x25')](_0x4be329)[_0x6a27('0x19')](function(_0x3268e2){logger[_0x6a27('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x3ab789,_0x4be329[_0x6a27('0x17')]);if(_0x3f56c5[_0x6a27('0x23')]['metadata'][_0x6a27('0x26')]){_0x4a2fd6[_0x6a27('0x27')]();}else{_0x4a2fd6['stop']();}})[_0x6a27('0x1a')](function(_0x3ac2cf){logger[_0x6a27('0x1b')](_0x6a27('0xc'),_0x3ab789,JSON[_0x6a27('0x1c')](_0x3ac2cf));_0x4a2fd6[_0x6a27('0x27')]();});})[_0x6a27('0x1a')](function(_0x286e75){logger[_0x6a27('0x1b')]('[%s][DIALOGFLOW]\x20%s',_0x3ab789,_0x286e75[_0x6a27('0x21')]);_0x4a2fd6['next']();});}}catch(_0x589a8c){logger[_0x6a27('0x1b')](_0x6a27('0xc'),_0x3ab789,JSON[_0x6a27('0x1c')](_0x589a8c));_0x4a2fd6[_0x6a27('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 6d28b36..de88aa8 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64cd=['lodash','html-to-text','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','map','message','join','stop','condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate'];(function(_0x20412f,_0x32b502){var _0x16d840=function(_0x538f15){while(--_0x538f15){_0x20412f['push'](_0x20412f['shift']());}};_0x16d840(++_0x32b502);}(_0x64cd,0x194));var _0xd64c=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x64cd[_0x1f5a63];return _0x30bb7a;};'use strict';var schema=require(_0xd64c('0x0'));var _=require(_0xd64c('0x1'));var htmlToText=require(_0xd64c('0x2'));var utils=require('./utils');var logger=require(_0xd64c('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xd64c('0x4'),'required':!![],'message':_0xd64c('0x5')},'priorityTrue':{'type':_0xd64c('0x6'),'message':_0xd64c('0x7')},'priorityFalse':{'type':_0xd64c('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xd64c('0x8')]=function(_0x327df7,_0x1a246a){return function(_0x1d9ef0){try{var _0x498bae={'condition':htmlToText[_0xd64c('0x9')](utils[_0xd64c('0xa')](_0x1a246a[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1a246a[0x1],'priorityFalse':_0x1a246a[0x2]};var _0x38b1cc=gotoif['validate'](_0x498bae,{'typecast':!![]});if(_0x38b1cc[_0xd64c('0xb')]){logger[_0xd64c('0xc')]('[%s][GOTOIF]\x20%s',_0x327df7,_[_0xd64c('0xd')](_0x38b1cc,_0xd64c('0xe'))[_0xd64c('0xf')](',\x20'));_0x1d9ef0[_0xd64c('0x10')]();}else{try{var _0x3dae7d=eval('('+_0x498bae[_0xd64c('0x11')]+')');var _0x225e36=_0x3dae7d?_0x498bae[_0xd64c('0x12')]:_0x498bae[_0xd64c('0x13')];logger[_0xd64c('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x327df7,_0x498bae[_0xd64c('0x11')],_0x3dae7d,_0x225e36||'next');if(_0x225e36){var _0x8df137=_[_0xd64c('0x15')](_0x1d9ef0[_0xd64c('0x16')](),{'p':_0x225e36});if(_0x8df137>=0x0){logger[_0xd64c('0x14')](_0xd64c('0x17'),_0x327df7,_0x225e36||_0xd64c('0x18'),_0x8df137);_0x1d9ef0[_0xd64c('0x18')](_0x8df137);}else{logger[_0xd64c('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x327df7,_0x225e36||'next');_0x1d9ef0[_0xd64c('0x10')]();}}else{_0x1d9ef0[_0xd64c('0x18')]();}}catch(_0x357321){logger[_0xd64c('0xc')](_0xd64c('0x19'),_0x327df7,_0x357321[_0xd64c('0xe')]);_0x1d9ef0[_0xd64c('0x10')]();}}}catch(_0x16919b){logger[_0xd64c('0xc')](_0xd64c('0x1a'),_0x327df7,JSON['stringify'](_0x16919b));_0x1d9ef0[_0xd64c('0x10')]();}};}; \ No newline at end of file +var _0xc767=['html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','lodash'];(function(_0x2020ad,_0x23beec){var _0x11ddd0=function(_0x143944){while(--_0x143944){_0x2020ad['push'](_0x2020ad['shift']());}};_0x11ddd0(++_0x23beec);}(_0xc767,0x149));var _0x7c76=function(_0xb08792,_0x298252){_0xb08792=_0xb08792-0x0;var _0x2d9992=_0xc767[_0xb08792];return _0x2d9992;};'use strict';var schema=require('validate');var _=require(_0x7c76('0x0'));var htmlToText=require(_0x7c76('0x1'));var utils=require(_0x7c76('0x2'));var logger=require('../../../../config/logger')(_0x7c76('0x3'));var gotoif=schema({'condition':{'type':_0x7c76('0x4'),'required':!![],'message':_0x7c76('0x5')},'priorityTrue':{'type':_0x7c76('0x6'),'message':_0x7c76('0x7')},'priorityFalse':{'type':_0x7c76('0x6'),'message':_0x7c76('0x8')}});exports[_0x7c76('0x9')]=function(_0x25d8d,_0x12c909){return function(_0x481fac){try{var _0x4010db={'condition':htmlToText[_0x7c76('0xa')](utils['getMustacheRender'](_0x12c909[0x0],this),{'wordwrap':![]})[_0x7c76('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x12c909[0x1],'priorityFalse':_0x12c909[0x2]};var _0xfe899f=gotoif[_0x7c76('0xc')](_0x4010db,{'typecast':!![]});if(_0xfe899f[_0x7c76('0xd')]){logger[_0x7c76('0xe')](_0x7c76('0xf'),_0x25d8d,_[_0x7c76('0x10')](_0xfe899f,'message')[_0x7c76('0x11')](',\x20'));_0x481fac[_0x7c76('0x12')]();}else{try{var _0x5acab3=eval('('+_0x4010db[_0x7c76('0x13')]+')');var _0x2af9ef=_0x5acab3?_0x4010db[_0x7c76('0x14')]:_0x4010db['priorityFalse'];logger[_0x7c76('0x15')](_0x7c76('0x16'),_0x25d8d,_0x4010db[_0x7c76('0x13')],_0x5acab3,_0x2af9ef||'next');if(_0x2af9ef){var _0x4a901f=_[_0x7c76('0x17')](_0x481fac[_0x7c76('0x18')](),{'p':_0x2af9ef});if(_0x4a901f>=0x0){logger[_0x7c76('0x15')](_0x7c76('0x19'),_0x25d8d,_0x2af9ef||_0x7c76('0x1a'),_0x4a901f);_0x481fac['next'](_0x4a901f);}else{logger[_0x7c76('0x15')](_0x7c76('0x1b'),_0x25d8d,_0x2af9ef||_0x7c76('0x1a'));_0x481fac[_0x7c76('0x12')]();}}else{_0x481fac['next']();}}catch(_0x1dcb98){logger[_0x7c76('0xe')](_0x7c76('0x1c'),_0x25d8d,_0x1dcb98[_0x7c76('0x1d')]);_0x481fac[_0x7c76('0x12')]();}}}catch(_0x4b197e){logger[_0x7c76('0xe')](_0x7c76('0xf'),_0x25d8d,JSON['stringify'](_0x4b197e));_0x481fac['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 26b1e7c..f965bf9 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 _0x347c=['../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0x1ecdf8,_0x1cc64){var _0x544124=function(_0xa631d8){while(--_0xa631d8){_0x1ecdf8['push'](_0x1ecdf8['shift']());}};_0x544124(++_0x1cc64);}(_0x347c,0x168));var _0xc347=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x347c[_0x1928c9];return _0x51b5fb;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xc347('0x0'))(_0xc347('0x1'));var gotop=schema({'priority':{'type':_0xc347('0x2'),'required':!![],'message':_0xc347('0x3')}});exports[_0xc347('0x4')]=function(_0x43da8a,_0x30a73b){return function(_0xb6bc24){try{var _0x39a3fb={'priority':_0x30a73b[0x0]};var _0x5d3dea=gotop[_0xc347('0x5')](_0x39a3fb,{'typecast':!![]});if(_0x5d3dea[_0xc347('0x6')]){logger[_0xc347('0x7')](_0xc347('0x8'),_0x43da8a,_['map'](_0x5d3dea,_0xc347('0x9'))[_0xc347('0xa')](',\x20'));_0xb6bc24[_0xc347('0xb')]();}else{logger[_0xc347('0xc')](_0xc347('0xd'),_0x43da8a,_0x39a3fb[_0xc347('0xe')]);if(_0x39a3fb[_0xc347('0xe')]){var _0x1d75a5=_[_0xc347('0xf')](_0xb6bc24[_0xc347('0x10')](),{'p':_0x39a3fb[_0xc347('0xe')]});if(_0x1d75a5>=0x0){logger[_0xc347('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x43da8a,_0x39a3fb[_0xc347('0xe')]||'next',_0x1d75a5);_0xb6bc24[_0xc347('0x11')](_0x1d75a5);}else{logger[_0xc347('0xc')](_0xc347('0x12'),_0x43da8a,_0x39a3fb[_0xc347('0xe')]||_0xc347('0x11'));_0xb6bc24['stop']();}}else{_0xb6bc24[_0xc347('0x11')]();}}}catch(_0x3fd36d){logger[_0xc347('0x7')](_0xc347('0x8'),_0x43da8a,JSON[_0xc347('0x13')](_0x3fd36d));_0xb6bc24['stop']();}};}; \ No newline at end of file +var _0x9c9a=['../../../../config/logger','number','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate'];(function(_0x245408,_0x4ed693){var _0x412b73=function(_0x1bbf70){while(--_0x1bbf70){_0x245408['push'](_0x245408['shift']());}};_0x412b73(++_0x4ed693);}(_0x9c9a,0x1ef));var _0xa9c9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9c9a[_0xa464c9];return _0x3d73c4;};'use strict';var schema=require(_0xa9c9('0x0'));var _=require('lodash');var logger=require(_0xa9c9('0x1'))('routing');var gotop=schema({'priority':{'type':_0xa9c9('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa9c9('0x3')]=function(_0x2c9532,_0x4b38da){return function(_0x29a96f){try{var _0x4e0405={'priority':_0x4b38da[0x0]};var _0x65d9b6=gotop[_0xa9c9('0x0')](_0x4e0405,{'typecast':!![]});if(_0x65d9b6[_0xa9c9('0x4')]){logger[_0xa9c9('0x5')](_0xa9c9('0x6'),_0x2c9532,_['map'](_0x65d9b6,_0xa9c9('0x7'))[_0xa9c9('0x8')](',\x20'));_0x29a96f[_0xa9c9('0x9')]();}else{logger[_0xa9c9('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x2c9532,_0x4e0405[_0xa9c9('0xb')]);if(_0x4e0405['priority']){var _0x40e8df=_['findIndex'](_0x29a96f[_0xa9c9('0xc')](),{'p':_0x4e0405[_0xa9c9('0xb')]});if(_0x40e8df>=0x0){logger[_0xa9c9('0xa')](_0xa9c9('0xd'),_0x2c9532,_0x4e0405[_0xa9c9('0xb')]||_0xa9c9('0xe'),_0x40e8df);_0x29a96f['next'](_0x40e8df);}else{logger[_0xa9c9('0xa')](_0xa9c9('0xf'),_0x2c9532,_0x4e0405[_0xa9c9('0xb')]||_0xa9c9('0xe'));_0x29a96f[_0xa9c9('0x9')]();}}else{_0x29a96f['next']();}}}catch(_0x2d1a44){logger[_0xa9c9('0x5')]('[%s][GOTOP]\x20%s',_0x2c9532,JSON['stringify'](_0x2d1a44));_0x29a96f[_0xa9c9('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 5455573..92a5848 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 _0x06ef=['upperFirst','channel','InteractionId','interaction','Message','then','[%s][MESSAGE]\x20%s','body','error','stringify','stop','../../../../config/logger','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','chat','ChatWebsiteId','account'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x06ef,0x185));var _0xf06e=function(_0x3bd497,_0x37d7a8){_0x3bd497=_0x3bd497-0x0;var _0x32f967=_0x06ef[_0x3bd497];return _0x32f967;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xf06e('0x0'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf06e('0x1')),'faxMessage':require(_0xf06e('0x2')),'whatsappMessage':require(_0xf06e('0x3'))};exports['consequence']=function(_0x1ddeff,_0x71a36){return function(_0x4be428){try{var _0x59b74b={'body':utils['getMustacheRender'](_0x71a36[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xf06e('0x4')){_0x59b74b[_0xf06e('0x5')]=this[_0xf06e('0x6')]['id'];}else{_0x59b74b[_[_0xf06e('0x7')](this[_0xf06e('0x8')])+'AccountId']=this[_0xf06e('0x6')]['id'];}_0x59b74b[_[_0xf06e('0x7')](this['channel'])+_0xf06e('0x9')]=this[_0xf06e('0xa')]['id'];if(rpc[this[_0xf06e('0x8')]+_0xf06e('0xb')]){return rpc[this[_0xf06e('0x8')]+_0xf06e('0xb')]['create'](_0x59b74b)[_0xf06e('0xc')](function(_0x2578e4){logger['info'](_0xf06e('0xd'),_0x1ddeff,_0x59b74b[_0xf06e('0xe')]);_0x4be428['next']();})['catch'](function(_0x5c862b){logger[_0xf06e('0xf')](_0xf06e('0xd'),_0x1ddeff,JSON[_0xf06e('0x10')](_0x5c862b));_0x4be428['stop']();});}}catch(_0x3fdacc){logger[_0xf06e('0xf')](_0xf06e('0xd'),_0x1ddeff,JSON[_0xf06e('0x10')](_0x3fdacc));_0x4be428[_0xf06e('0x11')]();}};}; \ No newline at end of file +var _0xe236=['stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','interaction','Message','create','then','info','body','error','[%s][MESSAGE]\x20%s'];(function(_0x2d4130,_0x3f4e70){var _0x5e4cc0=function(_0x3b5aa5){while(--_0x3b5aa5){_0x2d4130['push'](_0x2d4130['shift']());}};_0x5e4cc0(++_0x3f4e70);}(_0xe236,0x197));var _0x6e23=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xe236[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x6e23('0x0'));var utils=require(_0x6e23('0x1'));var logger=require(_0x6e23('0x2'))(_0x6e23('0x3'));var rpc={'chatMessage':require(_0x6e23('0x4')),'openchannelMessage':require(_0x6e23('0x5')),'mailMessage':require(_0x6e23('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6e23('0x7'))};exports[_0x6e23('0x8')]=function(_0x33c560,_0x3bb2db){return function(_0x3c7bfd){try{var _0x2ccb2a={'body':utils['getMustacheRender'](_0x3bb2db[0x0],this),'ContactId':this[_0x6e23('0x9')]['id']};if(this[_0x6e23('0xa')]===_0x6e23('0xb')){_0x2ccb2a[_0x6e23('0xc')]=this['account']['id'];}else{_0x2ccb2a[_['upperFirst'](this[_0x6e23('0xa')])+_0x6e23('0xd')]=this[_0x6e23('0xe')]['id'];}_0x2ccb2a[_[_0x6e23('0xf')](this[_0x6e23('0xa')])+_0x6e23('0x10')]=this[_0x6e23('0x11')]['id'];if(rpc[this[_0x6e23('0xa')]+_0x6e23('0x12')]){return rpc[this[_0x6e23('0xa')]+_0x6e23('0x12')][_0x6e23('0x13')](_0x2ccb2a)[_0x6e23('0x14')](function(_0x392b78){logger[_0x6e23('0x15')]('[%s][MESSAGE]\x20%s',_0x33c560,_0x2ccb2a[_0x6e23('0x16')]);_0x3c7bfd['next']();})['catch'](function(_0xa0858b){logger[_0x6e23('0x17')](_0x6e23('0x18'),_0x33c560,JSON['stringify'](_0xa0858b));_0x3c7bfd[_0x6e23('0x19')]();});}}catch(_0x42eea3){logger[_0x6e23('0x17')](_0x6e23('0x18'),_0x33c560,JSON[_0x6e23('0x1a')](_0x42eea3));_0x3c7bfd[_0x6e23('0x19')]();}};}; \ 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 22709a4..0cb47db 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 _0x369d=['routing','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils','../../../../config/logger'];(function(_0x2f7a1e,_0x19b674){var _0x309ddf=function(_0x32e081){while(--_0x32e081){_0x2f7a1e['push'](_0x2f7a1e['shift']());}};_0x309ddf(++_0x19b674);}(_0x369d,0x1de));var _0xd369=function(_0x259750,_0x139591){_0x259750=_0x259750-0x0;var _0xf3dc61=_0x369d[_0x259750];return _0xf3dc61;};'use strict';var utils=require(_0xd369('0x0'));var logger=require(_0xd369('0x1'))(_0xd369('0x2'));exports['consequence']=function(_0x370bdb,_0x2618fa){return function(_0x153950){try{logger['info'](_0xd369('0x3'),_0x370bdb,utils[_0xd369('0x4')](_0x2618fa[0x0],this));_0x153950[_0xd369('0x5')]();}catch(_0x41c4b6){logger[_0xd369('0x6')](_0xd369('0x3'),_0x370bdb,JSON[_0xd369('0x7')](_0x41c4b6));_0x153950['stop']();}};}; \ No newline at end of file +var _0x8529=['next','error','stop','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x463c53,_0x508ab0){var _0x27db21=function(_0x4f9d05){while(--_0x4f9d05){_0x463c53['push'](_0x463c53['shift']());}};_0x27db21(++_0x508ab0);}(_0x8529,0x73));var _0x9852=function(_0x5b167c,_0x43fce8){_0x5b167c=_0x5b167c-0x0;var _0x3c58c0=_0x8529[_0x5b167c];return _0x3c58c0;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x9852('0x0'));exports[_0x9852('0x1')]=function(_0x1b8058,_0x5dcd7f){return function(_0x49ae30){try{logger[_0x9852('0x2')](_0x9852('0x3'),_0x1b8058,utils[_0x9852('0x4')](_0x5dcd7f[0x0],this));_0x49ae30[_0x9852('0x5')]();}catch(_0x31c6dc){logger[_0x9852('0x6')]('[%s][NOOP]\x20%s',_0x1b8058,JSON['stringify'](_0x31c6dc));_0x49ae30[_0x9852('0x7')]();}};}; \ 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 02dee81..bfa0ce5 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 _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3981a9,_0x94e12c){var _0x1824b4=function(_0x29edc9){while(--_0x29edc9){_0x3981a9['push'](_0x3981a9['shift']());}};_0x1824b4(++_0x94e12c);}(_0x008c,0x188));var _0xc008=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x008c[_0x1cb18a];return _0x22442e;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x5eef93,_0x5f5b71){var _0x3ec053=function(_0x31b6d5){while(--_0x31b6d5){_0x5eef93['push'](_0x5eef93['shift']());}};_0x3ec053(++_0x5f5b71);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index a128a9c..2fdde25 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 _0xa767=['busyQueue','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','forcedOwnership','isAgentAvailable','agents'];(function(_0x302180,_0x18366e){var _0x45a0c2=function(_0x3d4e59){while(--_0x3d4e59){_0x302180['push'](_0x302180['shift']());}};_0x45a0c2(++_0x18366e);}(_0xa767,0x12a));var _0x7a76=function(_0x56cd22,_0xd4c827){_0x56cd22=_0x56cd22-0x0;var _0x57918f=_0xa767[_0x56cd22];return _0x57918f;};'use strict';var _=require('lodash');var uuid=require(_0x7a76('0x0'));var util=require(_0x7a76('0x1'));var logger=require(_0x7a76('0x2'))(_0x7a76('0x3'));var Agent=function(_0x4876b4,_0x21b43e,_0xf13668,_0xe0e5c0){this[_0x7a76('0x4')]=uuid['v4']();this['squeue']=_0x4876b4;this[_0x7a76('0x5')]=_0x21b43e;this[_0x7a76('0x6')]=_0xf13668;this[_0x7a76('0x3')]=_0xe0e5c0;this[_0x7a76('0x7')][_0x7a76('0x8')](this[_0x7a76('0x9')][_0x7a76('0xa')](this),this[_0x7a76('0xb')]['bind'](this));this['squeue']['on'](_0x7a76('0xc'),this[_0x7a76('0xb')][_0x7a76('0xa')](this));this['squeue']['on'](_0x7a76('0xd'),this['handleDrained'][_0x7a76('0xa')](this));};Agent[_0x7a76('0xe')]['push']=function(){this[_0x7a76('0x7')][_0x7a76('0x8')](this['handleRun']['bind'](this),this[_0x7a76('0xb')][_0x7a76('0xa')](this));};Agent[_0x7a76('0xe')][_0x7a76('0xf')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x7a76('0x9')]=function(_0x42e7de){logger[_0x7a76('0x10')](_0x7a76('0x11'),this[_0x7a76('0x7')]['id'],this['agent']['id']);if(_[_0x7a76('0x12')](this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']])){logger[_0x7a76('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x7a76('0xa')](this),0x3e8);}else{if(this['routing'][_0x7a76('0x13')]||util[_0x7a76('0x14')](this[_0x7a76('0x7')]['id'],this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']],this['squeue']['channel'],![])){this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']]['busy']=!![];this[_0x7a76('0x6')][_0x7a76('0x15')][this[_0x7a76('0x5')]['id']][_0x7a76('0x16')]=undefined;util[_0x7a76('0x17')](this[_0x7a76('0x4')],this['squeue']['id'],this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']],null,this['routing']);util[_0x7a76('0x18')](this[_0x7a76('0x7')]['id'],this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']],_0x7a76('0x19')+(this[_0x7a76('0x3')][_0x7a76('0x13')]?':FORCED':''));}else{logger[_0x7a76('0x10')](_0x7a76('0x1a'),this[_0x7a76('0x7')]['id'],this[_0x7a76('0x5')]['id']);setTimeout(this[_0x7a76('0x8')][_0x7a76('0xa')](this),0x3e8);}}};Agent[_0x7a76('0xe')][_0x7a76('0xb')]=function(_0x2f12b9){if(_[_0x7a76('0x12')](this[_0x7a76('0x6')][_0x7a76('0x15')][this[_0x7a76('0x5')]['id']])){return logger[_0x7a76('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7a76('0x7')]['id'],this['agent']['id']);}else{logger['info'](_0x7a76('0x1b'),this[_0x7a76('0x7')]['id'],this['agent']['id']);util[_0x7a76('0x1c')](this[_0x7a76('0x4')],this[_0x7a76('0x7')]['id'],this[_0x7a76('0x6')][_0x7a76('0x15')][this[_0x7a76('0x5')]['id']],null,this[_0x7a76('0x3')]);this[_0x7a76('0x6')][_0x7a76('0x15')][this['agent']['id']][_0x7a76('0x1d')]=![];this[_0x7a76('0x6')][_0x7a76('0x15')][this[_0x7a76('0x5')]['id']]['busyQueue']=undefined;util[_0x7a76('0x18')](this[_0x7a76('0x7')]['id'],this[_0x7a76('0x6')][_0x7a76('0x15')][this['agent']['id']],_0x2f12b9?'STOP':_0x7a76('0x1e'));}if(!_0x2f12b9){setTimeout(this[_0x7a76('0x8')]['bind'](this),0x3e8);}};function agent(_0x2b12be,_0x5e06af,_0x274bce,_0x25dcfb){return new Agent(_0x2b12be,_0x5e06af,_0x274bce,_0x25dcfb);}module[_0x7a76('0x1f')]=agent; \ No newline at end of file +var _0xadc1=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xadc1,0x80));var _0x1adc=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0xadc1[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require(_0x1adc('0x0'));var uuid=require('uuid');var util=require(_0x1adc('0x1'));var logger=require(_0x1adc('0x2'))(_0x1adc('0x3'));var Agent=function(_0x2d5df1,_0x4837c4,_0x3288d3,_0x57e89a){this[_0x1adc('0x4')]=uuid['v4']();this[_0x1adc('0x5')]=_0x2d5df1;this[_0x1adc('0x6')]=_0x4837c4;this[_0x1adc('0x7')]=_0x3288d3;this['routing']=_0x57e89a;this['squeue'][_0x1adc('0x8')](this[_0x1adc('0x9')]['bind'](this),this[_0x1adc('0xa')][_0x1adc('0xb')](this));this[_0x1adc('0x5')]['on'](_0x1adc('0xc'),this[_0x1adc('0xa')][_0x1adc('0xb')](this));this[_0x1adc('0x5')]['on'](_0x1adc('0xd'),this[_0x1adc('0xe')][_0x1adc('0xb')](this));};Agent[_0x1adc('0xf')][_0x1adc('0x8')]=function(){this[_0x1adc('0x5')][_0x1adc('0x8')](this[_0x1adc('0x9')][_0x1adc('0xb')](this),this[_0x1adc('0xa')][_0x1adc('0xb')](this));};Agent[_0x1adc('0xf')]['handleDrained']=function(){this[_0x1adc('0xa')](!![]);};Agent[_0x1adc('0xf')]['handleRun']=function(_0xac8a13){logger[_0x1adc('0x10')](_0x1adc('0x11'),this[_0x1adc('0x5')]['id'],this[_0x1adc('0x6')]['id']);if(_[_0x1adc('0x12')](this['realtime'][_0x1adc('0x13')][this['agent']['id']])){logger[_0x1adc('0x10')](_0x1adc('0x14'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x1adc('0xb')](this),0x3e8);}else{if(this[_0x1adc('0x3')][_0x1adc('0x15')]||util['isAgentAvailable'](this[_0x1adc('0x5')]['id'],this[_0x1adc('0x7')]['agents'][this[_0x1adc('0x6')]['id']],this[_0x1adc('0x5')][_0x1adc('0x16')],![])){this[_0x1adc('0x7')]['agents'][this[_0x1adc('0x6')]['id']][_0x1adc('0x17')]=!![];this[_0x1adc('0x7')][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']][_0x1adc('0x18')]=undefined;util[_0x1adc('0x19')](this['notificationId'],this[_0x1adc('0x5')]['id'],this[_0x1adc('0x7')][_0x1adc('0x13')][this['agent']['id']],null,this['routing']);util[_0x1adc('0x1a')](this[_0x1adc('0x5')]['id'],this[_0x1adc('0x7')]['agents'][this['agent']['id']],_0x1adc('0x1b')+(this[_0x1adc('0x3')][_0x1adc('0x15')]?':FORCED':''));}else{logger[_0x1adc('0x10')](_0x1adc('0x1c'),this['squeue']['id'],this[_0x1adc('0x6')]['id']);setTimeout(this['push'][_0x1adc('0xb')](this),0x3e8);}}};Agent[_0x1adc('0xf')][_0x1adc('0xa')]=function(_0x5b6cc1){if(_['isNil'](this['realtime'][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']])){return logger[_0x1adc('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x1adc('0x5')]['id'],this[_0x1adc('0x6')]['id']);}else{logger[_0x1adc('0x10')](_0x1adc('0x1d'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0x1adc('0x4')],this[_0x1adc('0x5')]['id'],this['realtime'][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']],null,this[_0x1adc('0x3')]);this['realtime'][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']]['busy']=![];this[_0x1adc('0x7')]['agents'][this[_0x1adc('0x6')]['id']][_0x1adc('0x18')]=undefined;util[_0x1adc('0x1a')](this[_0x1adc('0x5')]['id'],this[_0x1adc('0x7')][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']],_0x5b6cc1?'STOP':'TIMEOUT');}if(!_0x5b6cc1){setTimeout(this[_0x1adc('0x8')]['bind'](this),0x3e8);}};function agent(_0x37ffb2,_0x3359e1,_0xec452,_0x207cba){return new Agent(_0x37ffb2,_0x3359e1,_0xec452,_0x207cba);}module[_0x1adc('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index d3f63de..90406d5 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 _0x72f1=['prototype','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','name','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','info','STOP','busy','exports','lodash','uuid','routing','queue','realtime','squeue','handleRun','bind','handleTimeout','drained','handleDrained','push'];(function(_0x818b09,_0x14c01b){var _0x3d1ac9=function(_0xd11002){while(--_0xd11002){_0x818b09['push'](_0x818b09['shift']());}};_0x3d1ac9(++_0x14c01b);}(_0x72f1,0xf0));var _0x172f=function(_0x247aad,_0x325fe7){_0x247aad=_0x247aad-0x0;var _0x3c895f=_0x72f1[_0x247aad];return _0x3c895f;};'use strict';var _=require(_0x172f('0x0'));var uuid=require(_0x172f('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x172f('0x2'));var Beepall=function(_0x2630ea,_0x4f7e33,_0x1bcdc8,_0x1b463a){this['notificationId']=uuid['v4']();this['squeue']=_0x2630ea;this[_0x172f('0x3')]=_0x4f7e33;this[_0x172f('0x4')]=_0x1bcdc8;this[_0x172f('0x2')]=_0x1b463a;this[_0x172f('0x5')]['push'](this[_0x172f('0x6')][_0x172f('0x7')](this),this[_0x172f('0x8')]['bind'](this));this[_0x172f('0x5')]['on']('timeout',this['handleTimeout'][_0x172f('0x7')](this));this[_0x172f('0x5')]['on'](_0x172f('0x9'),this[_0x172f('0xa')][_0x172f('0x7')](this));};Beepall['prototype'][_0x172f('0xb')]=function(){this[_0x172f('0x5')][_0x172f('0xb')](this[_0x172f('0x6')][_0x172f('0x7')](this),this['handleTimeout'][_0x172f('0x7')](this));};Beepall[_0x172f('0xc')][_0x172f('0xa')]=function(_0x29daf6){this['handleTimeout'](!![]);};Beepall['prototype'][_0x172f('0x6')]=function(_0x184333){var _0xba525b=!![];if(!_['isNil'](this[_0x172f('0x3')])&&!_[_0x172f('0xd')](this['queue'][_0x172f('0xe')])&&this[_0x172f('0x3')][_0x172f('0xe')][_0x172f('0xf')]>0x0){for(var _0x1229ed=0x0,_0x14cb68;_0x1229ed0x0){for(var _0x2505f9=0x0,_0x430520;_0x2505f90x0&&_0x4fe3b8[_0x4d38b7+_0x9644('0x23')]>=_0x4fe3b8[_0x4d38b7+_0x9644('0x22')]){writeLog(_0x3df7aa,_0x4fe3b8,_0x4d38b7[_0x9644('0x24')]()+_0x9644('0x25'));return![];}}return!![];};exports[_0x9644('0x26')]=function(_0x2ebaeb,_0x28bee7,_0x264c30,_0x5767dd,_0x102720){return sendNotification(!![],_0x2ebaeb,_0x28bee7,_0x264c30,_0x5767dd,_0x102720);};exports[_0x9644('0x27')]=function(_0x42f1e9,_0x2dd4f2,_0x61f9,_0x5c484a,_0xaede1f){return sendNotification(![],_0x42f1e9,_0x2dd4f2,_0x61f9,_0x5c484a,_0xaede1f);};exports[_0x9644('0x28')]=writeLog; \ No newline at end of file +var _0x4eb5=['busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','CurrentCapacity','Capacity','showNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','isAgentAvailable'];(function(_0x1e8fc7,_0x231724){var _0x2940fb=function(_0x71a1e5){while(--_0x71a1e5){_0x1e8fc7['push'](_0x1e8fc7['shift']());}};_0x2940fb(++_0x231724);}(_0x4eb5,0x19a));var _0x54eb=function(_0x271416,_0x15b537){_0x271416=_0x271416-0x0;var _0x1f5faf=_0x4eb5[_0x271416];return _0x1f5faf;};'use strict';var _=require(_0x54eb('0x0'));var util=require(_0x54eb('0x1'));var utils=require('../utils');var Mustache=require(_0x54eb('0x2'));var Redis=require(_0x54eb('0x3'));var config=require(_0x54eb('0x4'));var logger=require(_0x54eb('0x5'))(_0x54eb('0x6'));config[_0x54eb('0x7')]=_[_0x54eb('0x8')](config['redis'],{'host':_0x54eb('0x9'),'port':0x18eb});var io=require(_0x54eb('0xa'))(new Redis(config[_0x54eb('0x7')]));function emit(_0x3536eb,_0x23115c,_0x3658c4){io['to'](_0x3536eb)[_0x54eb('0xb')](_0x23115c,_0x3658c4);}function sendNotification(_0x307533,_0x738145,_0x2543f3,_0x273a60,_0x1e9096,_0x740549){io['to'](util[_0x54eb('0xc')](_0x54eb('0xd'),_0x273a60[_0x54eb('0xe')]))[_0x54eb('0xb')](_0x54eb('0xf'),_0x273a60);var _0x57f672=_0x740549||{};var _0x3a36bf=_0x2543f3[_0x54eb('0x10')]('.');var _0x25cae7={'uniqueid':_0x738145,'channel':_0x3a36bf[0x0],'id':_0x3a36bf[0x1],'title':_0x3a36bf[0x0]+_0x54eb('0x11'),'interactionId':_0x3a36bf[0x2],'queue':_0x1e9096?_0x1e9096[_0x54eb('0xe')]:null,'sound':_0x57f672[_0x54eb('0x12')]['notificationSound'],'shake':_0x57f672[_0x54eb('0x12')][_0x54eb('0x13')]};try{if(!_0x57f672[_0x54eb('0x14')]){_0x57f672[_0x54eb('0x14')]={};}if(_0x1e9096){_0x57f672[_0x54eb('0x14')]['queue']=_0x1e9096;}else if(_0x57f672[_0x54eb('0x14')][_0x54eb('0x15')]){delete _0x57f672['body']['queue'];}_0x25cae7[_0x54eb('0x16')]=utils[_0x54eb('0x17')](_0x57f672['account'][_0x54eb('0x18')],_0x57f672);}catch(_0x5c9615){_0x25cae7[_0x54eb('0x16')]=_0x54eb('0x19');logger[_0x54eb('0x1a')](util['format'](_0x54eb('0x1b'),_0x738145,_0x5c9615[_0x54eb('0x1c')]));}io['to'](util[_0x54eb('0xc')](_0x54eb('0xd'),_0x273a60['name']))['emit'](util[_0x54eb('0xc')]('notification:%s',_0x307533?'save':'remove'),_0x25cae7);}function writeLog(_0x357b91,_0x34f998,_0x833d79){return logger['info'](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x357b91,_0x34f998[_0x54eb('0xe')],_0x833d79));}exports[_0x54eb('0x1d')]=function(_0x15164b,_0x441b30,_0x41274e,_0x45c2c8){if(_0x441b30[_0x54eb('0x1e')]){writeLog(_0x15164b,_0x441b30,_0x54eb('0x1f'));return![];}if(!_0x441b30[_0x54eb('0x20')]){writeLog(_0x15164b,_0x441b30,_0x54eb('0x21'));return![];}if(_0x441b30[_0x41274e+_0x54eb('0x22')]){writeLog(_0x15164b,_0x441b30,'PAUSE');return![];}if(_0x45c2c8&&_0x441b30[_0x54eb('0x23')](_0x41274e+'Capacity')&&_0x441b30[_0x54eb('0x23')](_0x41274e+_0x54eb('0x24'))){if(_0x441b30[_0x41274e+_0x54eb('0x25')]>0x0&&_0x441b30[_0x41274e+_0x54eb('0x24')]>=_0x441b30[_0x41274e+_0x54eb('0x25')]){writeLog(_0x15164b,_0x441b30,_0x41274e['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x54eb('0x26')]=function(_0x3689e8,_0x4393fe,_0x43f85b,_0x267f6d,_0x1e934d){return sendNotification(!![],_0x3689e8,_0x4393fe,_0x43f85b,_0x267f6d,_0x1e934d);};exports['hideNotification']=function(_0x18660c,_0x1a0548,_0x39fd1e,_0x279ce9,_0x1f13e8){return sendNotification(![],_0x18660c,_0x1a0548,_0x39fd1e,_0x279ce9,_0x1f13e8);};exports[_0x54eb('0x27')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 67ab10e..3e134b4 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 _0x81d8=['isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','info','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next'];(function(_0x444d2f,_0x2927b9){var _0x18ae46=function(_0x257e84){while(--_0x257e84){_0x444d2f['push'](_0x444d2f['shift']());}};_0x18ae46(++_0x2927b9);}(_0x81d8,0x1c4));var _0x881d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x81d8[_0x1facfa];return _0x9ec701;};'use strict';var schema=require(_0x881d('0x0'));var sh=require(_0x881d('0x1'));var _=require(_0x881d('0x2'));var utils=require(_0x881d('0x3'));var logger=require(_0x881d('0x4'))(_0x881d('0x5'));var system=schema({'command':{'type':_0x881d('0x6'),'required':!![],'message':_0x881d('0x7')}});exports['consequence']=function(_0x16d719,_0x50fbc7){return function(_0x530956){try{var _0x8c4dcf={'command':_0x50fbc7[0x0]};var _0x823655=system[_0x881d('0x0')](_0x8c4dcf,{'typecast':!![]});if(_0x823655['length']){logger[_0x881d('0x8')]('[%s][SYSTEM]\x20%s',_0x16d719,_[_0x881d('0x9')](_0x823655,_0x881d('0xa'))[_0x881d('0xb')](',\x20'));logger['info'](_0x881d('0xc'),_0x16d719);_0x530956['next']();}else{var _0x1b31d0=this;var _0x2b09da=utils['getMustacheRender'](_0x50fbc7[0x0],this);logger[_0x881d('0xd')](_0x881d('0xe'),_0x16d719,_0x2b09da);sh['exec'](_[_0x881d('0xf')](_0x2b09da),function(_0x534445,_0x54aa8c){logger[_0x881d('0xd')](_0x881d('0x10'),_0x16d719,_0x534445);if(_0x534445==0x0){var _0x3e3504=_0x54aa8c[_0x881d('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x881d('0x12')](_0x50fbc7[0x1])||_['isEmpty'](_0x50fbc7[0x1])){logger[_0x881d('0xd')](_0x881d('0x13'),_0x16d719);_0x1b31d0['body'][_0x50fbc7[0x1]]=_0x3e3504;}else{logger[_0x881d('0xd')](_0x881d('0x14'),_0x16d719,_0x50fbc7[0x1],_0x3e3504);_0x1b31d0[_0x881d('0x15')][_0x50fbc7[0x1]]=_0x3e3504;}}_0x530956[_0x881d('0x16')]();});}}catch(_0x4a42f8){logger[_0x881d('0x8')]('[%s][SYSTEM]\x20%s',_0x16d719,_[_0x881d('0x17')](_0x4a42f8)?JSON[_0x881d('0x18')](_0x4a42f8):_0x4a42f8);logger[_0x881d('0xd')](_0x881d('0xc'),_0x16d719);_0x530956['next']();}};}; \ No newline at end of file +var _0x5e5b=['[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x15c30e,_0x5ac7d1){var _0x15cf1b=function(_0x6c6d16){while(--_0x6c6d16){_0x15c30e['push'](_0x15c30e['shift']());}};_0x15cf1b(++_0x5ac7d1);}(_0x5e5b,0xb3));var _0xb5e5=function(_0x21a064,_0xe9e605){_0x21a064=_0x21a064-0x0;var _0x394523=_0x5e5b[_0x21a064];return _0x394523;};'use strict';var schema=require(_0xb5e5('0x0'));var sh=require(_0xb5e5('0x1'));var _=require(_0xb5e5('0x2'));var utils=require(_0xb5e5('0x3'));var logger=require(_0xb5e5('0x4'))(_0xb5e5('0x5'));var system=schema({'command':{'type':_0xb5e5('0x6'),'required':!![],'message':_0xb5e5('0x7')}});exports[_0xb5e5('0x8')]=function(_0x3383e7,_0x2b0a8c){return function(_0x25fa13){try{var _0x176015={'command':_0x2b0a8c[0x0]};var _0x32cccd=system[_0xb5e5('0x0')](_0x176015,{'typecast':!![]});if(_0x32cccd['length']){logger[_0xb5e5('0x9')](_0xb5e5('0xa'),_0x3383e7,_[_0xb5e5('0xb')](_0x32cccd,_0xb5e5('0xc'))[_0xb5e5('0xd')](',\x20'));logger[_0xb5e5('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3383e7);_0x25fa13[_0xb5e5('0xf')]();}else{var _0x39302a=this;var _0x4c5df7=utils[_0xb5e5('0x10')](_0x2b0a8c[0x0],this);logger[_0xb5e5('0xe')](_0xb5e5('0x11'),_0x3383e7,_0x4c5df7);sh[_0xb5e5('0x12')](_[_0xb5e5('0x13')](_0x4c5df7),function(_0x33287e,_0x5a64bc){logger[_0xb5e5('0xe')](_0xb5e5('0x14'),_0x3383e7,_0x33287e);if(_0x33287e==0x0){var _0x59caeb=_0x5a64bc[_0xb5e5('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0xb5e5('0x16')](_0x2b0a8c[0x1])||_[_0xb5e5('0x17')](_0x2b0a8c[0x1])){logger[_0xb5e5('0xe')](_0xb5e5('0x18'),_0x3383e7);_0x39302a['body'][_0x2b0a8c[0x1]]=_0x59caeb;}else{logger[_0xb5e5('0xe')](_0xb5e5('0x19'),_0x3383e7,_0x2b0a8c[0x1],_0x59caeb);_0x39302a[_0xb5e5('0x1a')][_0x2b0a8c[0x1]]=_0x59caeb;}}_0x25fa13[_0xb5e5('0xf')]();});}}catch(_0x2ed62a){logger[_0xb5e5('0x9')](_0xb5e5('0xa'),_0x3383e7,_[_0xb5e5('0x1b')](_0x2ed62a)?JSON['stringify'](_0x2ed62a):_0x2ed62a);logger[_0xb5e5('0xe')](_0xb5e5('0x1c'),_0x3383e7);_0x25fa13[_0xb5e5('0xf')]();}};}; \ 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 dffdafe..4dbecac 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 _0x2636=['error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length'];(function(_0x31336a,_0x1ae144){var _0x373a6c=function(_0x864376){while(--_0x864376){_0x31336a['push'](_0x31336a['shift']());}};_0x373a6c(++_0x1ae144);}(_0x2636,0x1cb));var _0x6263=function(_0x535fb7,_0x3934d5){_0x535fb7=_0x535fb7-0x0;var _0x46f049=_0x2636[_0x535fb7];return _0x46f049;};'use strict';var schema=require(_0x6263('0x0'));var _=require(_0x6263('0x1'));var rpc={'chatInteraction':require(_0x6263('0x2')),'openchannelInteraction':require(_0x6263('0x3')),'smsInteraction':require(_0x6263('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x6263('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x6263('0x6'),'required':!![],'message':_0x6263('0x7')}});exports['consequence']=function(_0x1d275c,_0x3ee373,_0xf5d562,_0x1a731a){return function(_0x1a9ea4){try{var _0x33d5cc={'tag':_0x3ee373[0x0]};var _0x2557d6=tag[_0x6263('0x0')](_0x33d5cc,{'typecast':!![]});if(_0x2557d6[_0x6263('0x8')]){logger[_0x6263('0x9')](_0x6263('0xa'),_0x1d275c,_[_0x6263('0xb')](_0x2557d6,_0x6263('0xc'))[_0x6263('0xd')](',\x20'));logger['info'](_0x6263('0xe'),_0x1d275c);_0x1a9ea4['next']();}else{var _0x1b1260={'ids':[_0x3ee373[0x0]]};if(rpc[_0x1a731a[_0x6263('0xf')]+_0x6263('0x10')]){rpc[_0x1a731a['channel']+_0x6263('0x10')][_0x6263('0x11')](_0x1a731a['interaction']['id'],_0x1b1260)[_0x6263('0x12')](function(_0x7ac196){logger[_0x6263('0x13')](_0x6263('0x14'),_0x1d275c,_0x3ee373[0x1],_0x1a731a[_0x6263('0xf')],_0x1a731a[_0x6263('0x15')]['id']);})[_0x6263('0x16')](function(_0x313e77){logger['error'](_0x6263('0xa'),_0x1d275c,JSON[_0x6263('0x17')](_0x313e77));logger[_0x6263('0x13')](_0x6263('0xe'),_0x1d275c);})[_0x6263('0x18')](function(){_0x1a9ea4[_0x6263('0x19')]();});}}}catch(_0x41db7e){logger[_0x6263('0x9')](_0x6263('0xa'),_0x1d275c,_['isObject'](_0x41db7e)?JSON[_0x6263('0x17')](_0x41db7e):_0x41db7e);logger[_0x6263('0x13')](_0x6263('0xe'),_0x1d275c);_0x1a9ea4[_0x6263('0x19')]();}};}; \ No newline at end of file +var _0x3928=['channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','error','[%s][TAG]\x20%s','finally','isObject','stringify','lodash','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3928,0xed));var _0x8392=function(_0xe43453,_0x4533dc){_0xe43453=_0xe43453-0x0;var _0xb420bc=_0x3928[_0xe43453];return _0xb420bc;};'use strict';var schema=require('validate');var _=require(_0x8392('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8392('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x8392('0x2')),'faxInteraction':require(_0x8392('0x3')),'whatsappInteraction':require(_0x8392('0x4'))};var logger=require('../../../../config/logger')(_0x8392('0x5'));var tag=schema({'tag':{'type':_0x8392('0x6'),'required':!![],'message':_0x8392('0x7')}});exports['consequence']=function(_0x3968b5,_0x2e20ed,_0x6cd78c,_0x3a7d50){return function(_0x464d09){try{var _0x556142={'tag':_0x2e20ed[0x0]};var _0x550444=tag['validate'](_0x556142,{'typecast':!![]});if(_0x550444['length']){logger['error']('[%s][TAG]\x20%s',_0x3968b5,_[_0x8392('0x8')](_0x550444,_0x8392('0x9'))['join'](',\x20'));logger[_0x8392('0xa')](_0x8392('0xb'),_0x3968b5);_0x464d09[_0x8392('0xc')]();}else{var _0x5025f5={'ids':[_0x2e20ed[0x0]]};if(rpc[_0x3a7d50[_0x8392('0xd')]+_0x8392('0xe')]){rpc[_0x3a7d50['channel']+'Interaction'][_0x8392('0xf')](_0x3a7d50['interaction']['id'],_0x5025f5)[_0x8392('0x10')](function(_0x28f5ba){logger['info'](_0x8392('0x11'),_0x3968b5,_0x2e20ed[0x1],_0x3a7d50[_0x8392('0xd')],_0x3a7d50[_0x8392('0x12')]['id']);})[_0x8392('0x13')](function(_0x22cfdc){logger[_0x8392('0x14')](_0x8392('0x15'),_0x3968b5,JSON['stringify'](_0x22cfdc));logger[_0x8392('0xa')](_0x8392('0xb'),_0x3968b5);})[_0x8392('0x16')](function(){_0x464d09[_0x8392('0xc')]();});}}}catch(_0x3fc5e6){logger[_0x8392('0x14')](_0x8392('0x15'),_0x3968b5,_[_0x8392('0x17')](_0x3fc5e6)?JSON[_0x8392('0x18')](_0x3fc5e6):_0x3fc5e6);logger[_0x8392('0xa')](_0x8392('0xb'),_0x3968b5);_0x464d09['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 5377507..ad16fee 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 _0xd404=['contact','message','account','interaction','list','mustache','lodash','merge','body'];(function(_0x29e3ff,_0xce3f1b){var _0x285eac=function(_0x59721e){while(--_0x59721e){_0x29e3ff['push'](_0x29e3ff['shift']());}};_0x285eac(++_0xce3f1b);}(_0xd404,0x15b));var _0x4d40=function(_0x3ef2d1,_0x1e9f91){_0x3ef2d1=_0x3ef2d1-0x0;var _0x3d5748=_0xd404[_0x3ef2d1];return _0x3d5748;};'use strict';var Mustache=require(_0x4d40('0x0'));var _=require(_0x4d40('0x1'));module['exports']={'getMustacheRender':function(_0xb6576c,_0x2322e5){return Mustache['render'](_0xb6576c,_[_0x4d40('0x2')](_0x2322e5[_0x4d40('0x3')],{'contact':_0x2322e5[_0x4d40('0x4')],'message':_0x2322e5[_0x4d40('0x5')],'account':_0x2322e5[_0x4d40('0x6')],'interaction':_0x2322e5[_0x4d40('0x7')],'list':_0x2322e5[_0x4d40('0x8')]}))||'';}}; \ No newline at end of file +var _0xed95=['body','contact','message','account','interaction','mustache','lodash','exports','render','merge'];(function(_0x41f6be,_0x103d4e){var _0x2fa0ec=function(_0xa68739){while(--_0xa68739){_0x41f6be['push'](_0x41f6be['shift']());}};_0x2fa0ec(++_0x103d4e);}(_0xed95,0xb9));var _0x5ed9=function(_0x2bbead,_0x25a89e){_0x2bbead=_0x2bbead-0x0;var _0x105801=_0xed95[_0x2bbead];return _0x105801;};'use strict';var Mustache=require(_0x5ed9('0x0'));var _=require(_0x5ed9('0x1'));module[_0x5ed9('0x2')]={'getMustacheRender':function(_0x1f8d72,_0x43e62c){return Mustache[_0x5ed9('0x3')](_0x1f8d72,_[_0x5ed9('0x4')](_0x43e62c[_0x5ed9('0x5')],{'contact':_0x43e62c[_0x5ed9('0x6')],'message':_0x43e62c[_0x5ed9('0x7')],'account':_0x43e62c[_0x5ed9('0x8')],'interaction':_0x43e62c[_0x5ed9('0x9')],'list':_0x43e62c['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 82aa406..2c60111 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 _0xff3f=['autoreply','appdata','split','push','slice','amazonlex','tag','TagId','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','interaction','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','uuid','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','map','interval','listen','rules','channel','message','applications','isArray','length','existsSync','join','app','.js','toLowerCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff3f,0xa3));var _0xfff3=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0xff3f[_0x48999d];return _0x1ad0d1;};'use strict';var _=require(_0xfff3('0x0'));var util=require(_0xfff3('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xfff3('0x2'));var uuid=require(_0xfff3('0x3'));var config=require('../../../config/environment');var logger=require(_0xfff3('0x4'))(_0xfff3('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xfff3('0x6')),'chatQueueReport':require(_0xfff3('0x7')),'smsQueueReport':require(_0xfff3('0x8')),'faxQueueReport':require(_0xfff3('0x9')),'whatsappQueueReport':require(_0xfff3('0xa'))};var RuleEngine=require(_0xfff3('0xb'));function getId(_0x586465,_0x225324,_0x26c86e){return util['format'](_0xfff3('0xc'),_0x586465,_0x225324||0x0,_0x26c86e||0x0);}function getIntervals(_0x1c8727,_0x19be36){var _0x5ba262=[];if(!_['isNil'](_0x19be36[_0xfff3('0xd')])&&!_[_0xfff3('0xe')](_0x1c8727[_0x19be36[_0xfff3('0xd')]])&&!_[_0xfff3('0xe')](_0x1c8727[_0x19be36[_0xfff3('0xd')]]['Intervals'])){_0x5ba262=_[_0xfff3('0xf')](_0x1c8727[_0x19be36[_0xfff3('0xd')]]['Intervals'],'interval');}else if(!_[_0xfff3('0xe')](_0x19be36['interval'])){_0x5ba262=[_0x19be36[_0xfff3('0x10')]];}return _0x5ba262;}exports[_0xfff3('0x11')]=function(_0xe9b1a0){_0xe9b1a0[_0xfff3('0x12')]={};return new BPromise(function(_0x3ac767,_0x5f4cbe){var _0x1b2456={'Start':function(_0x37b995){var _0x4a2067=this;return new Promise(function(_0x214ad2,_0x2a6e70){if(_0x37b995){try{var _0xafb133=[];var _0x3ac778=getId(_0x37b995[_0xfff3('0x13')],_0x37b995[_0xfff3('0x14')]?_0x37b995[_0xfff3('0x14')]['id']:0x0,_0x37b995['interaction']?_0x37b995['interaction']['id']:0x0);if(_0x37b995[_0xfff3('0x15')]&&_[_0xfff3('0x16')](_0x37b995[_0xfff3('0x15')])&&_0x37b995[_0xfff3('0x15')][_0xfff3('0x17')]){for(var _0x3cc56e=0x0;_0x3cc56e<_0x37b995[_0xfff3('0x15')]['length'];_0x3cc56e+=0x1){var _0x43f8e1=_0x37b995[_0xfff3('0x15')][_0x3cc56e];if(fs[_0xfff3('0x18')](path[_0xfff3('0x19')](__dirname,_0xfff3('0x15'),_0x43f8e1[_0xfff3('0x1a')]+_0xfff3('0x1b')))){var _0x47fc56=[];switch(_0x43f8e1[_0xfff3('0x1a')][_0xfff3('0x1c')]()){case _0xfff3('0x1d'):var _0x1f596c=_0x43f8e1[_0xfff3('0x1e')][_0xfff3('0x1f')](',');_0x47fc56[_0xfff3('0x20')](_0x1f596c[0x0]);_0x47fc56['push'](_0x1f596c[_0xfff3('0x21')](0x1,_0x1f596c[_0xfff3('0x17')])[_0xfff3('0x19')](','));break;case'dialogflow':var _0x43042d=_0x43f8e1[_0xfff3('0x1e')]['split'](',');_0x47fc56[_0xfff3('0x20')](_0x43042d[0x0]);_0x47fc56[_0xfff3('0x20')](_0x43042d[0x1]);_0x47fc56[_0xfff3('0x20')](_0x43042d['slice'](0x2,_0x43042d[_0xfff3('0x17')])[_0xfff3('0x19')](','));break;case _0xfff3('0x22'):var _0xb4a8df=_0x43f8e1['appdata'][_0xfff3('0x1f')](',');_0x47fc56[_0xfff3('0x20')](_0xb4a8df[0x0]);_0x47fc56[_0xfff3('0x20')](_0xb4a8df[0x1]);_0x47fc56['push'](_0xb4a8df[0x2]);_0x47fc56[_0xfff3('0x20')](_0xb4a8df[0x3]);_0x47fc56['push'](_0xb4a8df[_0xfff3('0x21')](0x4,_0xb4a8df[_0xfff3('0x17')])['join'](','));break;case'message':_0x47fc56[_0xfff3('0x20')](_0x43f8e1[_0xfff3('0x1e')]);break;case _0xfff3('0x23'):_0x47fc56[_0xfff3('0x20')](_0x43f8e1[_0xfff3('0x24')]);_0x47fc56[_0xfff3('0x20')](_0x43f8e1[_0xfff3('0x1e')]);break;default:_0x47fc56=_[_0xfff3('0xe')](_0x43f8e1[_0xfff3('0x1e')])?[]:_0x43f8e1[_0xfff3('0x1e')][_0xfff3('0x1f')](',');}var _0x2e8e07={'id':util[_0xfff3('0x25')](_0xfff3('0x26'),_0x3ac778,_0x43f8e1['id'],_0x43f8e1[_0xfff3('0x1a')]),'condition':require(_0xfff3('0x27'))[_0xfff3('0x28')](_0x3ac778,getIntervals(_0xe9b1a0[_0xfff3('0x29')],_0x43f8e1),_0xe9b1a0),'consequence':require(_0xfff3('0x2a')+_0x43f8e1['app'])[_0xfff3('0x2b')](_0x3ac778,_0x47fc56,_0xe9b1a0,_0x37b995),'p':_0x43f8e1['priority']||0x0};logger[_0xfff3('0x2c')](_0xfff3('0x2d'),_0x2e8e07['id'],_0xfff3('0x2e'),getIntervals(_0xe9b1a0['intervals'],_0x43f8e1)['join'](_0xfff3('0x2f')));_0xafb133[_0xfff3('0x20')](_0x2e8e07);}else{logger[_0xfff3('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xfff3('0x19')](__dirname,_0xfff3('0x15'),_0x43f8e1[_0xfff3('0x1a')]+_0xfff3('0x1b')));}}_0xe9b1a0[_0xfff3('0x12')][_0x3ac778]=new RuleEngine(_0xafb133);_0xe9b1a0[_0xfff3('0x12')][_0x3ac778][_0xfff3('0x31')](_0x37b995,function(_0x3d09ff){logger[_0xfff3('0x2c')](_0xfff3('0x32'),JSON[_0xfff3('0x33')](_0x3d09ff[_0xfff3('0x34')]));if(_0xe9b1a0[_0xfff3('0x12')][_0x3ac778]){_0xe9b1a0[_0xfff3('0x12')][_0x3ac778][_0xfff3('0x35')](_0xfff3('0x36'));}});return _0x214ad2({'code':0xc8,'message':_0x37b995});}else{logger['info'](_0xfff3('0x37'));return _0x214ad2({'code':0xc8,'message':_0x37b995});}}catch(_0x140650){logger[_0xfff3('0x30')](_0x140650[_0xfff3('0x38')]);return _0x2a6e70(_0x4a2067[_0xfff3('0x30')](0x1f4,_0x140650));}}return _0x2a6e70(_0xfff3('0x39'));});},'AcceptMessage':function(_0x322787){var _0x2e0fcc=this;return new Promise(function(_0x352250,_0x2a437e){if(_0x322787[_0xfff3('0x14')]&&_0x322787[_0xfff3('0x14')]['id']){try{var _0xdc743b=getId(_0x322787[_0xfff3('0x13')],_0x322787['message']?_0x322787[_0xfff3('0x14')]['id']:0x0,_0x322787[_0xfff3('0x3a')]?_0x322787[_0xfff3('0x3a')]['id']:0x0);if(_0xe9b1a0['rules'][_0xdc743b]){_0xe9b1a0[_0xfff3('0x12')][_0xdc743b][_0xfff3('0x35')](_0xfff3('0x3b'));if(rpc[_0x322787[_0xfff3('0x13')]+_0xfff3('0x3c')]){rpc[_0x322787[_0xfff3('0x13')]+_0xfff3('0x3c')][_0xfff3('0x3d')](_0xdc743b,{'UserId':_0x322787[_0xfff3('0x14')][_0xfff3('0x3e')]})[_0xfff3('0x3f')](function(_0x34ca6d){logger[_0xfff3('0x30')](_0xfff3('0x40'));});}}return _0x352250({'code':0xc8,'message':_0x322787});}catch(_0x2a6149){logger[_0xfff3('0x30')](_0x2a6149[_0xfff3('0x38')]);return _0x2a437e(_0x2e0fcc[_0xfff3('0x30')](0x1f4,_0x2a6149));}}logger[_0xfff3('0x30')](_0xfff3('0x41'));return _0x2a437e(_0x2e0fcc['error'](0x1f4,_0xfff3('0x41')));});},'RejectMessage':function(_0x5efa0e){var _0x4cce1d=this;return new Promise(function(_0x330a96,_0x3ea17b){if(_0x5efa0e[_0xfff3('0x42')]&&_0x5efa0e[_0xfff3('0x42')]['id']){try{if(_0xe9b1a0[_0xfff3('0x43')][_0x5efa0e[_0xfff3('0x42')]['id']]){_0xe9b1a0['agents'][_0x5efa0e[_0xfff3('0x42')]['id']][_0xfff3('0x44')]=![];_0xe9b1a0['agents'][_0x5efa0e['agent']['id']][_0xfff3('0x45')]=undefined;}return _0x330a96({'code':0xc8,'message':_0x5efa0e});}catch(_0x34acc6){logger['error'](_0x34acc6['stack']);return _0x3ea17b(_0x4cce1d[_0xfff3('0x30')](0x1f4,_0x34acc6));}}logger[_0xfff3('0x30')]('message\x20is\x20empty');return _0x3ea17b(_0x4cce1d[_0xfff3('0x30')](0x1f4,_0xfff3('0x41')));});},'AbandonInteraction':function(_0xe68fad){var _0x50559c=this;return new Promise(function(_0x44d7f6,_0x5ed990){if(_0xe68fad[_0xfff3('0x13')]&&_0xe68fad[_0xfff3('0x3a')]&&_0xe68fad['interaction']['id']){try{var _0x46e90c=getId(_0xe68fad[_0xfff3('0x13')],_0xe68fad[_0xfff3('0x14')]?_0xe68fad[_0xfff3('0x14')]['id']:0x0,_0xe68fad[_0xfff3('0x3a')]?_0xe68fad['interaction']['id']:0x0);if(_0xe9b1a0['rules'][_0x46e90c]){_0xe9b1a0[_0xfff3('0x12')][_0x46e90c][_0xfff3('0x35')](_0xfff3('0x3b'));}return _0x44d7f6({'code':0xc8,'message':_0xe68fad});}catch(_0x4edeb0){logger['error'](_0x4edeb0['stack']);return _0x5ed990(_0x50559c['error'](0x1f4,_0x4edeb0));}}logger[_0xfff3('0x30')](_0xfff3('0x41'));return _0x5ed990(_0x50559c[_0xfff3('0x30')](0x1f4,_0xfff3('0x41')));});},'AgentCapacity':function(_0x1f7cb6){var _0x438694=this;return new Promise(function(_0x52da61,_0x248424){if(_0xe9b1a0['agents'][_0xfff3('0x46')](_0x1f7cb6['id'])){for(var _0x486eb3 in _0x1f7cb6[_0xfff3('0x47')]){if(_0x1f7cb6[_0xfff3('0x47')][_0xfff3('0x46')](_0x486eb3)){if(_0xe9b1a0[_0xfff3('0x43')][_0x1f7cb6['id']][_0xfff3('0x46')](_0x486eb3+'CurrentCapacity')){_0xe9b1a0[_0xfff3('0x43')][_0x1f7cb6['id']][_0x486eb3+_0xfff3('0x48')]=parseInt(_0x1f7cb6[_0xfff3('0x47')][_0x486eb3],0xa);}}}_0xe9b1a0[_0xfff3('0x43')][_0x1f7cb6['id']][_0xfff3('0x49')]();return _0x52da61({'code':0xc8,'message':_0xe9b1a0[_0xfff3('0x43')][_0x1f7cb6['id']]});}else{return _0x248424(_0x438694[_0xfff3('0x30')](0x1f4,_0xfff3('0x4a')));}});},'Agents':function(_0x4f18b2){return new Promise(function(_0x5b6d85,_0x4f56e6){var _0x3cc7bf=_['values'](_0xe9b1a0[_0xfff3('0x43')]);_0x5b6d85({'count':_0x3cc7bf[_0xfff3('0x17')],'rows':_0x3cc7bf});});},'ChatQueues':function(_0x3e05a9){return new Promise(function(_0xd50299,_0x28a4df){var _0x57ebf5=[];for(var _0x154b03 in _0xe9b1a0[_0xfff3('0x4b')]){if(_0xe9b1a0[_0xfff3('0x4b')]['hasOwnProperty'](_0x154b03)){var _0x4c2c05=_0xe9b1a0[_0xfff3('0x4b')][_0x154b03];var _0x48f135={'id':_0x4c2c05['id'],'available':_0x4c2c05[_0xfff3('0x4c')],'loggedIn':_0x4c2c05[_0xfff3('0x4d')],'name':_0x4c2c05[_0xfff3('0x4e')],'paused':_0x4c2c05[_0xfff3('0x4f')],'waiting':_0x4c2c05[_0xfff3('0x50')]};_0x57ebf5[_0xfff3('0x20')](_0x48f135);}}_0xd50299({'count':_0x57ebf5[_0xfff3('0x17')],'rows':_0x57ebf5});});},'MailQueues':function(_0x29f908){return new Promise(function(_0x13f85a,_0x4cd636){var _0x2a94b4=[];for(var _0x375e9f in _0xe9b1a0[_0xfff3('0x51')]){if(_0xe9b1a0[_0xfff3('0x51')][_0xfff3('0x46')](_0x375e9f)){var _0x47ba46=_0xe9b1a0[_0xfff3('0x51')][_0x375e9f];var _0xf56e56={'id':_0x47ba46['id'],'available':_0x47ba46['available'],'loggedIn':_0x47ba46[_0xfff3('0x4d')],'name':_0x47ba46['name'],'paused':_0x47ba46[_0xfff3('0x4f')],'waiting':_0x47ba46['waiting']};_0x2a94b4[_0xfff3('0x20')](_0xf56e56);}}_0x13f85a({'count':_0x2a94b4['length'],'rows':_0x2a94b4});});},'OpenchannelQueues':function(_0xbb2aa1){return new Promise(function(_0xdfc42a,_0x52123e){var _0x51747e=[];for(var _0x4ec8a7 in _0xe9b1a0[_0xfff3('0x52')]){if(_0xe9b1a0[_0xfff3('0x52')][_0xfff3('0x46')](_0x4ec8a7)){var _0x2c8dc9=_0xe9b1a0['openchannelQueues'][_0x4ec8a7];var _0x22ccf={'id':_0x2c8dc9['id'],'available':_0x2c8dc9['available'],'loggedIn':_0x2c8dc9[_0xfff3('0x4d')],'name':_0x2c8dc9[_0xfff3('0x4e')],'paused':_0x2c8dc9[_0xfff3('0x4f')],'waiting':_0x2c8dc9['waiting']};_0x51747e[_0xfff3('0x20')](_0x22ccf);}}_0xdfc42a({'count':_0x51747e['length'],'rows':_0x51747e});});},'SmsQueues':function(_0x4332e5){return new Promise(function(_0x1c8943,_0x29c44c){var _0x3e7c2a=[];for(var _0x4ddc7c in _0xe9b1a0[_0xfff3('0x53')]){if(_0xe9b1a0['smsQueues'][_0xfff3('0x46')](_0x4ddc7c)){var _0x15c477=_0xe9b1a0['smsQueues'][_0x4ddc7c];var _0x2d63ad={'id':_0x15c477['id'],'available':_0x15c477[_0xfff3('0x4c')],'loggedIn':_0x15c477[_0xfff3('0x4d')],'name':_0x15c477['name'],'paused':_0x15c477['paused'],'waiting':_0x15c477[_0xfff3('0x50')]};_0x3e7c2a['push'](_0x2d63ad);}}_0x1c8943({'count':_0x3e7c2a[_0xfff3('0x17')],'rows':_0x3e7c2a});});},'FaxQueues':function(_0x17ad65){return new Promise(function(_0x2e28e9,_0xc597c){var _0x34a748=[];for(var _0x58d315 in _0xe9b1a0['faxQueues']){if(_0xe9b1a0[_0xfff3('0x54')][_0xfff3('0x46')](_0x58d315)){var _0x230f08=_0xe9b1a0[_0xfff3('0x54')][_0x58d315];var _0x1bf6d5={'id':_0x230f08['id'],'available':_0x230f08[_0xfff3('0x4c')],'loggedIn':_0x230f08['loggedIn'],'name':_0x230f08[_0xfff3('0x4e')],'paused':_0x230f08[_0xfff3('0x4f')],'waiting':_0x230f08['waiting']};_0x34a748[_0xfff3('0x20')](_0x1bf6d5);}}_0x2e28e9({'count':_0x34a748[_0xfff3('0x17')],'rows':_0x34a748});});},'WhatsappQueues':function(_0x2095bd){return new Promise(function(_0x44c93a,_0x34c2f1){var _0x1706c0=[];for(var _0x50cad4 in _0xe9b1a0[_0xfff3('0x55')]){if(_0xe9b1a0['whatsappQueues'][_0xfff3('0x46')](_0x50cad4)){var _0xb6d74a=_0xe9b1a0[_0xfff3('0x55')][_0x50cad4];var _0xb9c270={'id':_0xb6d74a['id'],'available':_0xb6d74a[_0xfff3('0x4c')],'loggedIn':_0xb6d74a['loggedIn'],'name':_0xb6d74a[_0xfff3('0x4e')],'paused':_0xb6d74a['paused'],'waiting':_0xb6d74a['waiting']};_0x1706c0[_0xfff3('0x20')](_0xb9c270);}}_0x44c93a({'count':_0x1706c0[_0xfff3('0x17')],'rows':_0x1706c0});});},'ChatQueuesWaitingInteractions':function(_0x46641c){return new Promise(function(_0x56bba2,_0x14103f){var _0x1a22d8=_['values'](_0xe9b1a0[_0xfff3('0x56')]);_0x56bba2({'count':_0x1a22d8[_0xfff3('0x17')],'rows':_0x1a22d8});});},'MailQueuesWaitingInteractions':function(_0x49739a){return new Promise(function(_0x5522b9,_0x49634e){var _0x284579=_[_0xfff3('0x57')](_0xe9b1a0[_0xfff3('0x58')]);_0x5522b9({'count':_0x284579['length'],'rows':_0x284579});});},'OpenchannelQueuesWaitingInteractions':function(_0x59b285){return new Promise(function(_0x1d3d61,_0x1d7a54){var _0x37f0b1=_[_0xfff3('0x57')](_0xe9b1a0[_0xfff3('0x59')]);_0x1d3d61({'count':_0x37f0b1[_0xfff3('0x17')],'rows':_0x37f0b1});});},'SmsQueuesWaitingInteractions':function(_0x15cd8c){return new Promise(function(_0x29b4da,_0x274fac){var _0x552c22=_['values'](_0xe9b1a0[_0xfff3('0x5a')]);_0x29b4da({'count':_0x552c22['length'],'rows':_0x552c22});});},'FaxQueuesWaitingInteractions':function(_0x47ee61){return new Promise(function(_0x42ef12,_0x35822c){var _0x1afbab=_[_0xfff3('0x57')](_0xe9b1a0[_0xfff3('0x5b')]);_0x42ef12({'count':_0x1afbab[_0xfff3('0x17')],'rows':_0x1afbab});});},'WhatsappQueuesWaitingInteractions':function(_0x4a3b41){return new Promise(function(_0x4cd608,_0x1122ae){var _0x78effa=_[_0xfff3('0x57')](_0xe9b1a0[_0xfff3('0x5c')]);_0x4cd608({'count':_0x78effa['length'],'rows':_0x78effa});});}};var _0x3dc1e6=jayson[_0xfff3('0x5d')](_0x1b2456)['http']();_0x3dc1e6['on'](_0xfff3('0x30'),function(_0x2fac1a){logger[_0xfff3('0x30')](JSON['stringify'](_0x2fac1a));return _0x5f4cbe(_0x2fac1a);});_0x3dc1e6[_0xfff3('0x11')](0x232c,'127.0.0.1',function(){console['log'](_0xfff3('0x5e'),0x232c);return _0x3ac767(_0xfff3('0x5f')+0x232c);});});}; \ No newline at end of file +var _0x1880=['agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','jayson/promise','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','split','push','appdata','amazonlex','slice','format','%s:%s:%s','./interval','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','channel','end','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime'];(function(_0x2ee8c8,_0x4b7518){var _0x5e6437=function(_0x4f1bcb){while(--_0x4f1bcb){_0x2ee8c8['push'](_0x2ee8c8['shift']());}};_0x5e6437(++_0x4b7518);}(_0x1880,0x1d5));var _0x0188=function(_0x2ba054,_0x4cfa79){_0x2ba054=_0x2ba054-0x0;var _0x5d2153=_0x1880[_0x2ba054];return _0x5d2153;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x0188('0x0'));var fs=require('fs');var jayson=require(_0x0188('0x1'));var BPromise=require(_0x0188('0x2'));var uuid=require(_0x0188('0x3'));var config=require(_0x0188('0x4'));var logger=require('../../../config/logger')(_0x0188('0x5'));var rpc={'openchannelQueueReport':require(_0x0188('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x0188('0x7')),'smsQueueReport':require(_0x0188('0x8')),'faxQueueReport':require(_0x0188('0x9')),'whatsappQueueReport':require(_0x0188('0xa'))};var RuleEngine=require(_0x0188('0xb'));function getId(_0x187793,_0x5a8406,_0x1cd82c){return util['format'](_0x0188('0xc'),_0x187793,_0x5a8406||0x0,_0x1cd82c||0x0);}function getIntervals(_0xfc652d,_0x5bb893){var _0x4f57a3=[];if(!_['isNil'](_0x5bb893[_0x0188('0xd')])&&!_[_0x0188('0xe')](_0xfc652d[_0x5bb893[_0x0188('0xd')]])&&!_[_0x0188('0xe')](_0xfc652d[_0x5bb893['IntervalId']][_0x0188('0xf')])){_0x4f57a3=_[_0x0188('0x10')](_0xfc652d[_0x5bb893['IntervalId']][_0x0188('0xf')],_0x0188('0x11'));}else if(!_[_0x0188('0xe')](_0x5bb893[_0x0188('0x11')])){_0x4f57a3=[_0x5bb893[_0x0188('0x11')]];}return _0x4f57a3;}exports[_0x0188('0x12')]=function(_0x5ec906){_0x5ec906[_0x0188('0x13')]={};return new BPromise(function(_0x57c952,_0x7a19e0){var _0x2107ad={'Start':function(_0x4bf37b){var _0x234613=this;return new Promise(function(_0x150832,_0x2f0a6e){if(_0x4bf37b){try{var _0x19350b=[];var _0x4ffca5=getId(_0x4bf37b['channel'],_0x4bf37b[_0x0188('0x14')]?_0x4bf37b['message']['id']:0x0,_0x4bf37b[_0x0188('0x15')]?_0x4bf37b[_0x0188('0x15')]['id']:0x0);if(_0x4bf37b['applications']&&_[_0x0188('0x16')](_0x4bf37b[_0x0188('0x17')])&&_0x4bf37b[_0x0188('0x17')][_0x0188('0x18')]){for(var _0x139728=0x0;_0x139728<_0x4bf37b[_0x0188('0x17')]['length'];_0x139728+=0x1){var _0x50f2e9=_0x4bf37b[_0x0188('0x17')][_0x139728];if(fs[_0x0188('0x19')](path[_0x0188('0x1a')](__dirname,'applications',_0x50f2e9[_0x0188('0x1b')]+_0x0188('0x1c')))){var _0xaed753=[];switch(_0x50f2e9[_0x0188('0x1b')][_0x0188('0x1d')]()){case _0x0188('0x1e'):var _0x3b1ccb=_0x50f2e9['appdata'][_0x0188('0x1f')](',');_0xaed753['push'](_0x3b1ccb[0x0]);_0xaed753[_0x0188('0x20')](_0x3b1ccb['slice'](0x1,_0x3b1ccb[_0x0188('0x18')])[_0x0188('0x1a')](','));break;case'dialogflow':var _0x1338a8=_0x50f2e9[_0x0188('0x21')][_0x0188('0x1f')](',');_0xaed753[_0x0188('0x20')](_0x1338a8[0x0]);_0xaed753[_0x0188('0x20')](_0x1338a8[0x1]);_0xaed753[_0x0188('0x20')](_0x1338a8['slice'](0x2,_0x1338a8[_0x0188('0x18')])[_0x0188('0x1a')](','));break;case _0x0188('0x22'):var _0xb2b239=_0x50f2e9[_0x0188('0x21')]['split'](',');_0xaed753['push'](_0xb2b239[0x0]);_0xaed753[_0x0188('0x20')](_0xb2b239[0x1]);_0xaed753[_0x0188('0x20')](_0xb2b239[0x2]);_0xaed753[_0x0188('0x20')](_0xb2b239[0x3]);_0xaed753[_0x0188('0x20')](_0xb2b239[_0x0188('0x23')](0x4,_0xb2b239['length'])[_0x0188('0x1a')](','));break;case _0x0188('0x14'):_0xaed753[_0x0188('0x20')](_0x50f2e9[_0x0188('0x21')]);break;case'tag':_0xaed753['push'](_0x50f2e9['TagId']);_0xaed753['push'](_0x50f2e9[_0x0188('0x21')]);break;default:_0xaed753=_[_0x0188('0xe')](_0x50f2e9[_0x0188('0x21')])?[]:_0x50f2e9[_0x0188('0x21')][_0x0188('0x1f')](',');}var _0xc13bb={'id':util[_0x0188('0x24')](_0x0188('0x25'),_0x4ffca5,_0x50f2e9['id'],_0x50f2e9[_0x0188('0x1b')]),'condition':require(_0x0188('0x26'))[_0x0188('0x27')](_0x4ffca5,getIntervals(_0x5ec906['intervals'],_0x50f2e9),_0x5ec906),'consequence':require(_0x0188('0x28')+_0x50f2e9['app'])['consequence'](_0x4ffca5,_0xaed753,_0x5ec906,_0x4bf37b),'p':_0x50f2e9[_0x0188('0x29')]||0x0};logger[_0x0188('0x2a')](_0x0188('0x2b'),_0xc13bb['id'],_0x0188('0x2c'),getIntervals(_0x5ec906[_0x0188('0x2d')],_0x50f2e9)[_0x0188('0x1a')](_0x0188('0x2e')));_0x19350b[_0x0188('0x20')](_0xc13bb);}else{logger[_0x0188('0x2f')](_0x0188('0x30'),path['join'](__dirname,_0x0188('0x17'),_0x50f2e9[_0x0188('0x1b')]+_0x0188('0x1c')));}}_0x5ec906[_0x0188('0x13')][_0x4ffca5]=new RuleEngine(_0x19350b);_0x5ec906[_0x0188('0x13')][_0x4ffca5][_0x0188('0x31')](_0x4bf37b,function(_0x3fa4a3){logger[_0x0188('0x2a')](_0x0188('0x32'),JSON[_0x0188('0x33')](_0x3fa4a3[_0x0188('0x34')]));if(_0x5ec906[_0x0188('0x13')][_0x4ffca5]){_0x5ec906[_0x0188('0x13')][_0x4ffca5][_0x0188('0x35')]('complete');}});return _0x150832({'code':0xc8,'message':_0x4bf37b});}else{logger[_0x0188('0x2a')](_0x0188('0x36'));return _0x150832({'code':0xc8,'message':_0x4bf37b});}}catch(_0x14861e){logger[_0x0188('0x2f')](_0x14861e[_0x0188('0x37')]);return _0x2f0a6e(_0x234613[_0x0188('0x2f')](0x1f4,_0x14861e));}}return _0x2f0a6e(_0x0188('0x38'));});},'AcceptMessage':function(_0x54d106){var _0x467e3a=this;return new Promise(function(_0x2ae445,_0x307045){if(_0x54d106[_0x0188('0x14')]&&_0x54d106['message']['id']){try{var _0x5e06ae=getId(_0x54d106[_0x0188('0x39')],_0x54d106[_0x0188('0x14')]?_0x54d106[_0x0188('0x14')]['id']:0x0,_0x54d106[_0x0188('0x15')]?_0x54d106['interaction']['id']:0x0);if(_0x5ec906[_0x0188('0x13')][_0x5e06ae]){_0x5ec906['rules'][_0x5e06ae][_0x0188('0x35')](_0x0188('0x3a'));if(rpc[_0x54d106[_0x0188('0x39')]+_0x0188('0x3b')]){rpc[_0x54d106['channel']+_0x0188('0x3b')]['update'](_0x5e06ae,{'UserId':_0x54d106['message']['UserId']})[_0x0188('0x3c')](function(_0x584750){logger['error'](_0x0188('0x3d'));});}}return _0x2ae445({'code':0xc8,'message':_0x54d106});}catch(_0x5bbfeb){logger[_0x0188('0x2f')](_0x5bbfeb['stack']);return _0x307045(_0x467e3a[_0x0188('0x2f')](0x1f4,_0x5bbfeb));}}logger[_0x0188('0x2f')](_0x0188('0x3e'));return _0x307045(_0x467e3a[_0x0188('0x2f')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2a39d4){var _0x5a2c88=this;return new Promise(function(_0x3ad22e,_0x504859){if(_0x2a39d4[_0x0188('0x3f')]&&_0x2a39d4[_0x0188('0x3f')]['id']){try{if(_0x5ec906[_0x0188('0x40')][_0x2a39d4['agent']['id']]){_0x5ec906[_0x0188('0x40')][_0x2a39d4['agent']['id']][_0x0188('0x41')]=![];_0x5ec906[_0x0188('0x40')][_0x2a39d4[_0x0188('0x3f')]['id']][_0x0188('0x42')]=undefined;}return _0x3ad22e({'code':0xc8,'message':_0x2a39d4});}catch(_0x28ad2b){logger[_0x0188('0x2f')](_0x28ad2b[_0x0188('0x37')]);return _0x504859(_0x5a2c88['error'](0x1f4,_0x28ad2b));}}logger[_0x0188('0x2f')](_0x0188('0x3e'));return _0x504859(_0x5a2c88[_0x0188('0x2f')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1258ce){var _0x2f29d1=this;return new Promise(function(_0x13e364,_0x525292){if(_0x1258ce[_0x0188('0x39')]&&_0x1258ce[_0x0188('0x15')]&&_0x1258ce['interaction']['id']){try{var _0x2ba7cd=getId(_0x1258ce[_0x0188('0x39')],_0x1258ce[_0x0188('0x14')]?_0x1258ce['message']['id']:0x0,_0x1258ce[_0x0188('0x15')]?_0x1258ce['interaction']['id']:0x0);if(_0x5ec906[_0x0188('0x13')][_0x2ba7cd]){_0x5ec906[_0x0188('0x13')][_0x2ba7cd]['emit'](_0x0188('0x3a'));}return _0x13e364({'code':0xc8,'message':_0x1258ce});}catch(_0x207ee3){logger[_0x0188('0x2f')](_0x207ee3[_0x0188('0x37')]);return _0x525292(_0x2f29d1[_0x0188('0x2f')](0x1f4,_0x207ee3));}}logger[_0x0188('0x2f')](_0x0188('0x3e'));return _0x525292(_0x2f29d1[_0x0188('0x2f')](0x1f4,_0x0188('0x3e')));});},'AgentCapacity':function(_0x59160d){var _0x5941c2=this;return new Promise(function(_0x35cd27,_0x1cd653){if(_0x5ec906[_0x0188('0x40')][_0x0188('0x43')](_0x59160d['id'])){for(var _0x396382 in _0x59160d['capacity']){if(_0x59160d[_0x0188('0x44')][_0x0188('0x43')](_0x396382)){if(_0x5ec906[_0x0188('0x40')][_0x59160d['id']][_0x0188('0x43')](_0x396382+_0x0188('0x45'))){_0x5ec906[_0x0188('0x40')][_0x59160d['id']][_0x396382+_0x0188('0x45')]=parseInt(_0x59160d[_0x0188('0x44')][_0x396382],0xa);}}}_0x5ec906[_0x0188('0x40')][_0x59160d['id']][_0x0188('0x46')]();return _0x35cd27({'code':0xc8,'message':_0x5ec906[_0x0188('0x40')][_0x59160d['id']]});}else{return _0x1cd653(_0x5941c2['error'](0x1f4,_0x0188('0x47')));}});},'Agents':function(_0xf2be91){return new Promise(function(_0xee07f,_0x367792){var _0x2690ab=_['values'](_0x5ec906[_0x0188('0x40')]);_0xee07f({'count':_0x2690ab[_0x0188('0x18')],'rows':_0x2690ab});});},'ChatQueues':function(_0x3be7ba){return new Promise(function(_0x1c7f59,_0x3eae38){var _0x5f2a73=[];for(var _0x29309c in _0x5ec906[_0x0188('0x48')]){if(_0x5ec906['chatQueues'][_0x0188('0x43')](_0x29309c)){var _0x9af6f4=_0x5ec906[_0x0188('0x48')][_0x29309c];var _0x4ca830={'id':_0x9af6f4['id'],'available':_0x9af6f4[_0x0188('0x49')],'loggedIn':_0x9af6f4[_0x0188('0x4a')],'name':_0x9af6f4[_0x0188('0x4b')],'paused':_0x9af6f4[_0x0188('0x4c')],'waiting':_0x9af6f4[_0x0188('0x4d')]};_0x5f2a73[_0x0188('0x20')](_0x4ca830);}}_0x1c7f59({'count':_0x5f2a73['length'],'rows':_0x5f2a73});});},'MailQueues':function(_0x115e0e){return new Promise(function(_0x1f9d44,_0x10a9b0){var _0x243abf=[];for(var _0x2da796 in _0x5ec906['mailQueues']){if(_0x5ec906[_0x0188('0x4e')][_0x0188('0x43')](_0x2da796)){var _0x2e1bec=_0x5ec906[_0x0188('0x4e')][_0x2da796];var _0x41551f={'id':_0x2e1bec['id'],'available':_0x2e1bec[_0x0188('0x49')],'loggedIn':_0x2e1bec[_0x0188('0x4a')],'name':_0x2e1bec[_0x0188('0x4b')],'paused':_0x2e1bec[_0x0188('0x4c')],'waiting':_0x2e1bec[_0x0188('0x4d')]};_0x243abf[_0x0188('0x20')](_0x41551f);}}_0x1f9d44({'count':_0x243abf[_0x0188('0x18')],'rows':_0x243abf});});},'OpenchannelQueues':function(_0x5cd809){return new Promise(function(_0xf25168,_0x15de3c){var _0x50ea81=[];for(var _0x3eea0f in _0x5ec906[_0x0188('0x4f')]){if(_0x5ec906[_0x0188('0x4f')]['hasOwnProperty'](_0x3eea0f)){var _0x4dd3cf=_0x5ec906['openchannelQueues'][_0x3eea0f];var _0x3adc00={'id':_0x4dd3cf['id'],'available':_0x4dd3cf['available'],'loggedIn':_0x4dd3cf[_0x0188('0x4a')],'name':_0x4dd3cf[_0x0188('0x4b')],'paused':_0x4dd3cf['paused'],'waiting':_0x4dd3cf[_0x0188('0x4d')]};_0x50ea81[_0x0188('0x20')](_0x3adc00);}}_0xf25168({'count':_0x50ea81[_0x0188('0x18')],'rows':_0x50ea81});});},'SmsQueues':function(_0xdfb14e){return new Promise(function(_0x25f795,_0x139bb4){var _0x478658=[];for(var _0x1025dd in _0x5ec906[_0x0188('0x50')]){if(_0x5ec906[_0x0188('0x50')]['hasOwnProperty'](_0x1025dd)){var _0x815efb=_0x5ec906[_0x0188('0x50')][_0x1025dd];var _0x3a7986={'id':_0x815efb['id'],'available':_0x815efb[_0x0188('0x49')],'loggedIn':_0x815efb['loggedIn'],'name':_0x815efb[_0x0188('0x4b')],'paused':_0x815efb[_0x0188('0x4c')],'waiting':_0x815efb[_0x0188('0x4d')]};_0x478658['push'](_0x3a7986);}}_0x25f795({'count':_0x478658[_0x0188('0x18')],'rows':_0x478658});});},'FaxQueues':function(_0x399ca4){return new Promise(function(_0xe7441a,_0x60e5d){var _0x13af7e=[];for(var _0x32c2bd in _0x5ec906[_0x0188('0x51')]){if(_0x5ec906['faxQueues'][_0x0188('0x43')](_0x32c2bd)){var _0xd2fd03=_0x5ec906[_0x0188('0x51')][_0x32c2bd];var _0x19cfe7={'id':_0xd2fd03['id'],'available':_0xd2fd03['available'],'loggedIn':_0xd2fd03[_0x0188('0x4a')],'name':_0xd2fd03[_0x0188('0x4b')],'paused':_0xd2fd03['paused'],'waiting':_0xd2fd03[_0x0188('0x4d')]};_0x13af7e[_0x0188('0x20')](_0x19cfe7);}}_0xe7441a({'count':_0x13af7e[_0x0188('0x18')],'rows':_0x13af7e});});},'WhatsappQueues':function(_0x1f0b98){return new Promise(function(_0x6a9e1c,_0x16c80a){var _0x1816da=[];for(var _0x4d32d5 in _0x5ec906['whatsappQueues']){if(_0x5ec906[_0x0188('0x52')][_0x0188('0x43')](_0x4d32d5)){var _0x3aa1be=_0x5ec906[_0x0188('0x52')][_0x4d32d5];var _0x10f8a2={'id':_0x3aa1be['id'],'available':_0x3aa1be[_0x0188('0x49')],'loggedIn':_0x3aa1be[_0x0188('0x4a')],'name':_0x3aa1be[_0x0188('0x4b')],'paused':_0x3aa1be[_0x0188('0x4c')],'waiting':_0x3aa1be[_0x0188('0x4d')]};_0x1816da[_0x0188('0x20')](_0x10f8a2);}}_0x6a9e1c({'count':_0x1816da[_0x0188('0x18')],'rows':_0x1816da});});},'ChatQueuesWaitingInteractions':function(_0x5853fe){return new Promise(function(_0x2b7104,_0x1b5ffc){var _0x3e5264=_[_0x0188('0x53')](_0x5ec906['chatQueuesWaitingInteractions']);_0x2b7104({'count':_0x3e5264[_0x0188('0x18')],'rows':_0x3e5264});});},'MailQueuesWaitingInteractions':function(_0x46bf9a){return new Promise(function(_0xae25c,_0x417f9e){var _0x3787ca=_[_0x0188('0x53')](_0x5ec906[_0x0188('0x54')]);_0xae25c({'count':_0x3787ca[_0x0188('0x18')],'rows':_0x3787ca});});},'OpenchannelQueuesWaitingInteractions':function(_0xa22684){return new Promise(function(_0x2b4cb5,_0x2aa0f5){var _0x1fa0ea=_['values'](_0x5ec906[_0x0188('0x55')]);_0x2b4cb5({'count':_0x1fa0ea[_0x0188('0x18')],'rows':_0x1fa0ea});});},'SmsQueuesWaitingInteractions':function(_0x300386){return new Promise(function(_0xe2296d,_0x32908b){var _0x1e2371=_[_0x0188('0x53')](_0x5ec906[_0x0188('0x56')]);_0xe2296d({'count':_0x1e2371[_0x0188('0x18')],'rows':_0x1e2371});});},'FaxQueuesWaitingInteractions':function(_0x7102e5){return new Promise(function(_0x56675c,_0x2297ce){var _0x17ad67=_[_0x0188('0x53')](_0x5ec906[_0x0188('0x57')]);_0x56675c({'count':_0x17ad67[_0x0188('0x18')],'rows':_0x17ad67});});},'WhatsappQueuesWaitingInteractions':function(_0x5c5c14){return new Promise(function(_0x1a8d58,_0x149fd1){var _0x102c01=_['values'](_0x5ec906['whatsappQueuesWaitingInteractions']);_0x1a8d58({'count':_0x102c01[_0x0188('0x18')],'rows':_0x102c01});});}};var _0x2bb141=jayson['server'](_0x2107ad)['http']();_0x2bb141['on'](_0x0188('0x2f'),function(_0x3fd62c){logger[_0x0188('0x2f')](JSON[_0x0188('0x33')](_0x3fd62c));return _0x7a19e0(_0x3fd62c);});_0x2bb141[_0x0188('0x12')](0x232c,_0x0188('0x58'),function(){console['log'](_0x0188('0x59'),0x232c);return _0x57c952('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 671261a..47dd318 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 _0x1f5d=['lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util','bluebird','jayson/promise'];(function(_0x2c8e0a,_0x1900eb){var _0x13ab60=function(_0x262227){while(--_0x262227){_0x2c8e0a['push'](_0x2c8e0a['shift']());}};_0x13ab60(++_0x1900eb);}(_0x1f5d,0x98));var _0xd1f5=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0x1f5d[_0x39a2d6];return _0x23af66;};'use strict';var util=require(_0xd1f5('0x0'));var BPromise=require(_0xd1f5('0x1'));var jayson=require(_0xd1f5('0x2'));var _=require(_0xd1f5('0x3'));var logger=require(_0xd1f5('0x4'))(_0xd1f5('0x5'));var client=jayson[_0xd1f5('0x6')][_0xd1f5('0x7')]({'port':0x232a});function request(_0x4ae5f8,_0x1f15fa){return new BPromise(function(_0x5c891a,_0x555047){return client[_0xd1f5('0x8')](_0x4ae5f8,_0x1f15fa)[_0xd1f5('0x9')](function(_0x2e5210){if(_0x2e5210[_0xd1f5('0xa')]){return _0x555047(_0x2e5210[_0xd1f5('0xa')][_0xd1f5('0xb')]);}else{return _0x5c891a(_0x2e5210[_0xd1f5('0xc')]);}})[_0xd1f5('0xd')](function(_0x3d3910){return _0x555047(_0x3d3910);});});}exports[_0xd1f5('0xe')]=function(_0x2e459f,_0x410a87,_0x3d3bf7){return function(_0x52db91){if(_0x3d3bf7[_0xd1f5('0xf')]&&!_0x3d3bf7[_0xd1f5('0xf')][_0x2e459f]){logger[_0xd1f5('0x10')](_0xd1f5('0x11'),_0x2e459f);return _0x52db91[_0xd1f5('0x12')]();}var _0x31d802=[];for(var _0x247b59=0x0;_0x247b59<_0x410a87[_0xd1f5('0x13')];_0x247b59+=0x1){_0x31d802[_0xd1f5('0x14')](request(_0xd1f5('0x15'),{'command':util['format'](_0xd1f5('0x16'),_0x410a87[_0x247b59])})[_0xd1f5('0x9')](function(_0x4c3d5a){return _0x4c3d5a&&_0x4c3d5a['message']&&_0x4c3d5a['message']['indexOf'](_0xd1f5('0x17'))>=0x0?!![]:![];})['catch'](function(_0x50a1a6){logger['error'](_0xd1f5('0x18'),_0x2e459f,_0x410a87[_0x247b59]);}));}BPromise[_0xd1f5('0x19')](_0x31d802)[_0xd1f5('0x9')](function(_0x1f27d6){var _0xf6f9b8=_['some'](_0x1f27d6);logger[_0xd1f5('0x10')](_0xd1f5('0x1a'),_0x2e459f,_0x410a87[_0xd1f5('0x1b')]('\x20|\x20'),_0xf6f9b8);_0x52db91[_0xd1f5('0x1c')](_0xf6f9b8);})[_0xd1f5('0xd')](function(_0x30d3e3){console['log'](_0x30d3e3);logger[_0xd1f5('0xa')](_0xd1f5('0x1a'),_0x2e459f,_0x410a87['join'](_0xd1f5('0x1d')),_0x30d3e3[_0xd1f5('0x1e')]);_0x52db91[_0xd1f5('0x12')]();});};}; \ No newline at end of file +var _0xf64b=['log','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0xd92bd7,_0x2616d3){var _0x31759e=function(_0x853d29){while(--_0x853d29){_0xd92bd7['push'](_0xd92bd7['shift']());}};_0x31759e(++_0x2616d3);}(_0xf64b,0x157));var _0xbf64=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xf64b[_0x166d93];return _0xba708;};'use strict';var util=require(_0xbf64('0x0'));var BPromise=require(_0xbf64('0x1'));var jayson=require('jayson/promise');var _=require(_0xbf64('0x2'));var logger=require(_0xbf64('0x3'))(_0xbf64('0x4'));var client=jayson[_0xbf64('0x5')][_0xbf64('0x6')]({'port':0x232a});function request(_0x2c9cf0,_0x5a8c0f){return new BPromise(function(_0x475fe9,_0x545ba1){return client[_0xbf64('0x7')](_0x2c9cf0,_0x5a8c0f)[_0xbf64('0x8')](function(_0x52749a){if(_0x52749a[_0xbf64('0x9')]){return _0x545ba1(_0x52749a[_0xbf64('0x9')][_0xbf64('0xa')]);}else{return _0x475fe9(_0x52749a[_0xbf64('0xb')]);}})[_0xbf64('0xc')](function(_0x352b99){return _0x545ba1(_0x352b99);});});}exports[_0xbf64('0xd')]=function(_0x5e1559,_0xe6a617,_0x2a4bdf){return function(_0x53f581){if(_0x2a4bdf[_0xbf64('0xe')]&&!_0x2a4bdf['rules'][_0x5e1559]){logger['info'](_0xbf64('0xf'),_0x5e1559);return _0x53f581[_0xbf64('0x10')]();}var _0x1daa6e=[];for(var _0x4b9f66=0x0;_0x4b9f66<_0xe6a617[_0xbf64('0x11')];_0x4b9f66+=0x1){_0x1daa6e[_0xbf64('0x12')](request(_0xbf64('0x13'),{'command':util[_0xbf64('0x14')](_0xbf64('0x15'),_0xe6a617[_0x4b9f66])})['then'](function(_0x2e382d){return _0x2e382d&&_0x2e382d['message']&&_0x2e382d['message']['indexOf']('true')>=0x0?!![]:![];})[_0xbf64('0xc')](function(_0x46ad5b){logger[_0xbf64('0x9')]('[%s][INTERVAL]\x20%s',_0x5e1559,_0xe6a617[_0x4b9f66]);}));}BPromise[_0xbf64('0x16')](_0x1daa6e)['then'](function(_0x53c9bf){var _0x3b74be=_[_0xbf64('0x17')](_0x53c9bf);logger[_0xbf64('0x18')](_0xbf64('0x19'),_0x5e1559,_0xe6a617[_0xbf64('0x1a')](_0xbf64('0x1b')),_0x3b74be);_0x53f581[_0xbf64('0x1c')](_0x3b74be);})[_0xbf64('0xc')](function(_0x32880c){console[_0xbf64('0x1d')](_0x32880c);logger[_0xbf64('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x5e1559,_0xe6a617[_0xbf64('0x1a')](_0xbf64('0x1b')),_0x32880c[_0xbf64('0x1e')]);_0x53f581[_0xbf64('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 434df1d..913dbf7 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 _0xd27a=['answeredelsewheremembername','membername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transferuniqueid','transfertargetuniqueid','cause','rejected','indexOf','agent','lodash','util','./utils','format','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','called','connectedlinename','error','stack','isNil','agentringnoanswerAt','timeout','reason','holdtime','talktime','push','queuecallerabandon','forIn','agentringnoanswer','abandoned','agentconnect','agentconnectAt','now','connect','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid'];(function(_0x5ee379,_0x3bc2fb){var _0x366e30=function(_0xfb79de){while(--_0xfb79de){_0x5ee379['push'](_0x5ee379['shift']());}};_0x366e30(++_0x3bc2fb);}(_0xd27a,0xfa));var _0xad27=function(_0x4813e1,_0x1958dd){_0x4813e1=_0x4813e1-0x0;var _0x1e44a3=_0xd27a[_0x4813e1];return _0x1e44a3;};'use strict';var _=require(_0xad27('0x0'));var util=require(_0xad27('0x1'));var utils=require(_0xad27('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x9f2606,_0x5c7eb8){utils['info'](util[_0xad27('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x9f2606[_0xad27('0x4')],_0x9f2606[_0xad27('0x5')],_0x9f2606['queue'],_0x9f2606['membername'],_0x9f2606[_0xad27('0x6')],_0x9f2606[_0xad27('0x7')],_0x9f2606[_0xad27('0x8')],_0x9f2606[_0xad27('0x9')]));if(_0x9f2606[_0xad27('0xa')]){utils[_0xad27('0xb')](_0x9f2606[_0xad27('0xa')])[_0xad27('0xc')](function(_0x40e99a){if(_0x40e99a){_0x9f2606[_0xad27('0xd')]=_0x40e99a[_0xad27('0xd')];_0x9f2606[_0xad27('0xe')]=_0x9f2606[_0xad27('0xf')]?_0x40e99a[_0xad27('0x10')]:![];_0x9f2606[_0xad27('0x11')]=_0x9f2606['agentacw']?_0x40e99a[_0xad27('0x12')]:0x0;}utils['request'](_0xad27('0x13'),_0x9f2606);});}else{utils[_0xad27('0x14')](_0xad27('0x13'),_0x9f2606);}if(_0x5c7eb8){delete transfers[_0x9f2606[_0xad27('0x4')]];}else{delete agents[_0x9f2606[_0xad27('0x15')]];}}exports[_0xad27('0x16')]=function(_0x4abdcb){try{agents[_0x4abdcb[_0xad27('0x15')]]=_0x4abdcb;agents[_0x4abdcb[_0xad27('0x15')]][_0xad27('0x17')]=utils['now']();agents[_0x4abdcb[_0xad27('0x15')]][_0xad27('0x9')]=_0xad27('0x18');agents[_0x4abdcb[_0xad27('0x15')]][_0xad27('0x8')]=null;agents[_0x4abdcb[_0xad27('0x15')]][_0xad27('0x19')]=null;}catch(_0x330359){utils[_0xad27('0x1a')](_0x330359[_0xad27('0x1b')]);}};exports['agentringnoanswer']=function(_0x3a705d){try{if(!_[_0xad27('0x1c')](agents[_0x3a705d['destuniqueid']])){agents[_0x3a705d[_0xad27('0x15')]]['agentringnoanswer']=!![];agents[_0x3a705d[_0xad27('0x15')]][_0xad27('0x1d')]=utils['now']();agents[_0x3a705d[_0xad27('0x15')]][_0xad27('0x9')]=_0xad27('0x1e');agents[_0x3a705d[_0xad27('0x15')]][_0xad27('0x1f')]=_0xad27('0x1e');agents[_0x3a705d[_0xad27('0x15')]][_0xad27('0x20')]=_0x3a705d['ringtime']?parseInt(_0x3a705d['ringtime'])/0x3e8:0x0;agents[_0x3a705d[_0xad27('0x15')]][_0xad27('0x21')]=0x0;unanswered[_0xad27('0x22')](_0x3a705d[_0xad27('0x15')]);}}catch(_0x24de8d){utils[_0xad27('0x1a')](_0x24de8d[_0xad27('0x1b')]);}};exports[_0xad27('0x23')]=function(_0x5a0a6c){try{_[_0xad27('0x24')](agents,function(_0x5d32f7,_0x472ee9){if(_0x5d32f7[_0xad27('0x4')]==_0x5a0a6c['uniqueid']&&!_['includes'](unanswered,_0x5d32f7[_0xad27('0x15')])){_0x5d32f7[_0xad27('0x25')]=!![];_0x5d32f7[_0xad27('0x1d')]=utils['now']();_0x5d32f7['lastevent']=_0xad27('0x26');_0x5d32f7[_0xad27('0x1f')]=_0xad27('0x26');_0x5d32f7[_0xad27('0x20')]=_0x5a0a6c[_0xad27('0x20')];_0x5d32f7[_0xad27('0x21')]=0x0;writeDB(_0x5d32f7);}});}catch(_0x25a1d6){utils['error'](_0x25a1d6[_0xad27('0x1b')]);}};exports[_0xad27('0x27')]=function(_0x165d86){try{if(agents[_0x165d86['destuniqueid']]){agents[_0x165d86['destuniqueid']][_0xad27('0x28')]=utils[_0xad27('0x29')]();agents[_0x165d86[_0xad27('0x15')]]['connectedlinenum']=_0x165d86[_0xad27('0x8')];agents[_0x165d86[_0xad27('0x15')]][_0xad27('0x19')]=_0x165d86[_0xad27('0x19')];agents[_0x165d86[_0xad27('0x15')]]['holdtime']=_0x165d86['ringtime'];agents[_0x165d86[_0xad27('0x15')]]['lastevent']=_0xad27('0x2a');_[_0xad27('0x24')](agents,function(_0x30a483,_0x2de7fc){if(_0x30a483[_0xad27('0x15')]!=_0x165d86[_0xad27('0x15')]&&_0x30a483[_0xad27('0x4')]==_0x165d86['uniqueid']){_0x30a483[_0xad27('0x21')]=0x0;_0x30a483[_0xad27('0x20')]=_0x165d86[_0xad27('0x2b')];_0x30a483[_0xad27('0x25')]=!![];_0x30a483[_0xad27('0x1d')]=utils[_0xad27('0x29')]();_0x30a483[_0xad27('0x9')]=_0xad27('0x2c');_0x30a483[_0xad27('0x1f')]=_0xad27('0x2c');_0x30a483[_0xad27('0x2d')]=_0x165d86['destuniqueid'];_0x30a483[_0xad27('0x2e')]=_0x165d86[_0xad27('0x2f')];writeDB(_0x30a483);}});}}catch(_0x336a70){utils[_0xad27('0x1a')](_0x336a70[_0xad27('0x1b')]);}};exports[_0xad27('0xf')]=function(_0x4c87d4){try{if(!_[_0xad27('0x1c')](agents[_0x4c87d4[_0xad27('0x15')]])){agents[_0x4c87d4[_0xad27('0x15')]][_0xad27('0xf')]=!![];agents[_0x4c87d4[_0xad27('0x15')]][_0xad27('0x30')]=utils[_0xad27('0x29')]();agents[_0x4c87d4['destuniqueid']]['talktime']=utils[_0xad27('0x31')](agents[_0x4c87d4[_0xad27('0x15')]][_0xad27('0x30')],agents[_0x4c87d4['destuniqueid']][_0xad27('0x28')]);agents[_0x4c87d4['destuniqueid']][_0xad27('0x1f')]=_0x4c87d4['reason'];agents[_0x4c87d4['destuniqueid']]['lastevent']=_0xad27('0x32');writeDB(agents[_0x4c87d4['destuniqueid']]);}}catch(_0x5a2cd1){utils[_0xad27('0x1a')](_0x5a2cd1['stack']);}};exports[_0xad27('0x33')]=function(_0x48f907){try{if(!_[_0xad27('0x1c')](agents[_0x48f907[_0xad27('0x34')]])){agents[_0x48f907[_0xad27('0x34')]][_0xad27('0x35')]=!![];agents[_0x48f907[_0xad27('0x34')]][_0xad27('0x36')]=_0xad27('0x37');agents[_0x48f907[_0xad27('0x34')]][_0xad27('0x38')]=_0x48f907[_0xad27('0x39')];agents[_0x48f907['transfereruniqueid']]['transferuniqueid']=agents[_0x48f907[_0xad27('0x34')]]['uniqueid'];}}catch(_0x26e4c6){utils[_0xad27('0x1a')](_0x26e4c6[_0xad27('0x1b')]);}};exports[_0xad27('0x3a')]=function(_0x5a62d8){try{if(_0x5a62d8[_0xad27('0x3b')]==_0x5a62d8['origtransfererlinkedid']){if(!_[_0xad27('0x1c')](agents[_0x5a62d8[_0xad27('0x3c')]])){agents[_0x5a62d8[_0xad27('0x3c')]][_0xad27('0x35')]=!![];agents[_0x5a62d8['secondtransfereruniqueid']][_0xad27('0x36')]='ATTENDED';agents[_0x5a62d8['secondtransfereruniqueid']]['transferexten']=_0x5a62d8['origtransfererexten'];agents[_0x5a62d8[_0xad27('0x3c')]]['transferuniqueid']=_0x5a62d8[_0xad27('0x3b')];}if(_0x5a62d8['transfereeuniqueid']&&agents[_0x5a62d8[_0xad27('0x3d')]]){agents[_0x5a62d8[_0xad27('0x3d')]]['agententerreason']=0x1;transfers[_0x5a62d8[_0xad27('0x3d')]]=_[_0xad27('0x3e')](agents[_0x5a62d8[_0xad27('0x3d')]]);transfers[_0x5a62d8[_0xad27('0x3d')]][_0xad27('0x7')]=agents[_0x5a62d8[_0xad27('0x3c')]][_0xad27('0x7')];transfers[_0x5a62d8[_0xad27('0x3d')]][_0xad27('0x3f')]=agents[_0x5a62d8[_0xad27('0x3c')]][_0xad27('0x3f')];transfers[_0x5a62d8[_0xad27('0x3d')]][_0xad27('0x17')]=utils[_0xad27('0x29')]();transfers[_0x5a62d8[_0xad27('0x3d')]]['agentconnectAt']=utils[_0xad27('0x29')]();transfers[_0x5a62d8[_0xad27('0x3d')]][_0xad27('0x20')]=0x0;transfers[_0x5a62d8[_0xad27('0x3d')]][_0xad27('0x40')]=0x2;}}else if(_0x5a62d8[_0xad27('0x3c')]==_0x5a62d8[_0xad27('0x41')]){if(!_['isNil'](agents[_0x5a62d8['origtransfereruniqueid']])){agents[_0x5a62d8[_0xad27('0x3b')]][_0xad27('0x35')]=!![];agents[_0x5a62d8[_0xad27('0x3b')]][_0xad27('0x36')]=_0xad27('0x42');agents[_0x5a62d8[_0xad27('0x3b')]][_0xad27('0x38')]=_0x5a62d8[_0xad27('0x43')];agents[_0x5a62d8['origtransfereruniqueid']][_0xad27('0x44')]=_0x5a62d8[_0xad27('0x3c')];}if(_0x5a62d8[_0xad27('0x45')]&&agents[_0x5a62d8[_0xad27('0x45')]]){agents[_0x5a62d8[_0xad27('0x45')]][_0xad27('0x40')]=0x1;transfers[_0x5a62d8[_0xad27('0x45')]]=_[_0xad27('0x3e')](agents[_0x5a62d8[_0xad27('0x45')]]);transfers[_0x5a62d8[_0xad27('0x45')]][_0xad27('0x7')]=agents[_0x5a62d8[_0xad27('0x3b')]][_0xad27('0x7')];transfers[_0x5a62d8[_0xad27('0x45')]][_0xad27('0x3f')]=agents[_0x5a62d8[_0xad27('0x3b')]][_0xad27('0x3f')];transfers[_0x5a62d8[_0xad27('0x45')]]['agentcalledAt']=utils['now']();transfers[_0x5a62d8['transfertargetuniqueid']][_0xad27('0x28')]=utils['now']();transfers[_0x5a62d8[_0xad27('0x45')]][_0xad27('0x20')]=0x0;transfers[_0x5a62d8['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x2032b7){utils[_0xad27('0x1a')](_0x2032b7[_0xad27('0x1b')]);}};exports['hangup']=function(_0x37d219){try{if(agents[_0x37d219[_0xad27('0x4')]]&&agents[_0x37d219[_0xad27('0x4')]]['reason']===_0xad27('0x1e')){if(_0x37d219[_0xad27('0x46')]==='21'){agents[_0x37d219['uniqueid']][_0xad27('0x1f')]=_0xad27('0x47');agents[_0x37d219['uniqueid']][_0xad27('0x9')]=_0xad27('0x47');}writeDB(agents[_0x37d219[_0xad27('0x4')]]);var _0x343bc2=unanswered[_0xad27('0x48')](_0x37d219[_0xad27('0x4')]);if(_0x343bc2>-0x1)unanswered['splice'](_0x343bc2,0x1);}if(transfers[_0x37d219[_0xad27('0x4')]]){transfers[_0x37d219[_0xad27('0x4')]][_0xad27('0xf')]=!![];transfers[_0x37d219[_0xad27('0x4')]][_0xad27('0x30')]=utils[_0xad27('0x29')]();transfers[_0x37d219[_0xad27('0x4')]][_0xad27('0x21')]=utils['diffTime'](transfers[_0x37d219['uniqueid']]['agentcompleteAt'],transfers[_0x37d219[_0xad27('0x4')]]['agentconnectAt']);transfers[_0x37d219[_0xad27('0x4')]][_0xad27('0x1f')]=_0xad27('0x49');transfers[_0x37d219[_0xad27('0x4')]][_0xad27('0x9')]=_0xad27('0x32');writeDB(transfers[_0x37d219[_0xad27('0x4')]],!![]);}if(agents[_0x37d219[_0xad27('0x4')]]&&agents[_0x37d219[_0xad27('0x4')]][_0xad27('0x28')]){agents[_0x37d219[_0xad27('0x4')]][_0xad27('0xf')]=!![];agents[_0x37d219['uniqueid']][_0xad27('0x30')]=utils[_0xad27('0x29')]();agents[_0x37d219[_0xad27('0x4')]][_0xad27('0x21')]=utils[_0xad27('0x31')](agents[_0x37d219[_0xad27('0x4')]][_0xad27('0x30')],agents[_0x37d219[_0xad27('0x4')]][_0xad27('0x28')]);agents[_0x37d219[_0xad27('0x4')]]['reason']=agents[_0x37d219[_0xad27('0x4')]]['transfer']?'transfer':_0xad27('0x49');agents[_0x37d219['uniqueid']][_0xad27('0x9')]='complete';writeDB(agents[_0x37d219['uniqueid']]);}}catch(_0x1f6779){utils[_0xad27('0x1a')](_0x1f6779[_0xad27('0x1b')]);}}; \ No newline at end of file +var _0xc310=['extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','agent','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','error','isNil','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','stack','forIn','includes','abandoned','reason','agentconnect','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten'];(function(_0x4f23ad,_0x3c946a){var _0xd2015b=function(_0x5d0d5b){while(--_0x5d0d5b){_0x4f23ad['push'](_0x4f23ad['shift']());}};_0xd2015b(++_0x3c946a);}(_0xc310,0x180));var _0x0c31=function(_0x1601ee,_0xbdfaa7){_0x1601ee=_0x1601ee-0x0;var _0x5bd1e1=_0xc310[_0x1601ee];return _0x5bd1e1;};'use strict';var _=require('lodash');var util=require(_0x0c31('0x0'));var utils=require(_0x0c31('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1cd0c2,_0x43c5c3){utils[_0x0c31('0x2')](util['format'](_0x0c31('0x3'),_0x1cd0c2[_0x0c31('0x4')],_0x1cd0c2[_0x0c31('0x5')],_0x1cd0c2[_0x0c31('0x6')],_0x1cd0c2[_0x0c31('0x7')],_0x1cd0c2[_0x0c31('0x8')],_0x1cd0c2[_0x0c31('0x9')],_0x1cd0c2[_0x0c31('0xa')],_0x1cd0c2[_0x0c31('0xb')]));if(_0x1cd0c2['queue']){utils[_0x0c31('0xc')](_0x1cd0c2[_0x0c31('0x6')])[_0x0c31('0xd')](function(_0x3de46d){if(_0x3de46d){_0x1cd0c2['type']=_0x3de46d[_0x0c31('0xe')];_0x1cd0c2['agentacw']=_0x1cd0c2[_0x0c31('0xf')]?_0x3de46d[_0x0c31('0x10')]:![];_0x1cd0c2[_0x0c31('0x11')]=_0x1cd0c2['agentacw']?_0x3de46d[_0x0c31('0x12')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x1cd0c2);});}else{utils[_0x0c31('0x13')](_0x0c31('0x14'),_0x1cd0c2);}if(_0x43c5c3){delete transfers[_0x1cd0c2[_0x0c31('0x4')]];}else{delete agents[_0x1cd0c2[_0x0c31('0x15')]];}}exports[_0x0c31('0x16')]=function(_0x1bb981){try{agents[_0x1bb981[_0x0c31('0x15')]]=_0x1bb981;agents[_0x1bb981[_0x0c31('0x15')]][_0x0c31('0x17')]=utils[_0x0c31('0x18')]();agents[_0x1bb981[_0x0c31('0x15')]][_0x0c31('0xb')]='called';agents[_0x1bb981['destuniqueid']][_0x0c31('0xa')]=null;agents[_0x1bb981[_0x0c31('0x15')]]['connectedlinename']=null;}catch(_0xe16db7){utils[_0x0c31('0x19')](_0xe16db7['stack']);}};exports['agentringnoanswer']=function(_0x24b031){try{if(!_[_0x0c31('0x1a')](agents[_0x24b031[_0x0c31('0x15')]])){agents[_0x24b031['destuniqueid']][_0x0c31('0x1b')]=!![];agents[_0x24b031[_0x0c31('0x15')]][_0x0c31('0x1c')]=utils[_0x0c31('0x18')]();agents[_0x24b031[_0x0c31('0x15')]][_0x0c31('0xb')]='timeout';agents[_0x24b031[_0x0c31('0x15')]]['reason']=_0x0c31('0x1d');agents[_0x24b031['destuniqueid']][_0x0c31('0x1e')]=_0x24b031[_0x0c31('0x1f')]?parseInt(_0x24b031[_0x0c31('0x1f')])/0x3e8:0x0;agents[_0x24b031[_0x0c31('0x15')]][_0x0c31('0x20')]=0x0;unanswered['push'](_0x24b031[_0x0c31('0x15')]);}}catch(_0x5f5aa7){utils['error'](_0x5f5aa7[_0x0c31('0x21')]);}};exports['queuecallerabandon']=function(_0x1f0e79){try{_[_0x0c31('0x22')](agents,function(_0xd55409,_0x33270a){if(_0xd55409['uniqueid']==_0x1f0e79['uniqueid']&&!_[_0x0c31('0x23')](unanswered,_0xd55409['destuniqueid'])){_0xd55409[_0x0c31('0x1b')]=!![];_0xd55409[_0x0c31('0x1c')]=utils[_0x0c31('0x18')]();_0xd55409[_0x0c31('0xb')]=_0x0c31('0x24');_0xd55409[_0x0c31('0x25')]=_0x0c31('0x24');_0xd55409[_0x0c31('0x1e')]=_0x1f0e79['holdtime'];_0xd55409[_0x0c31('0x20')]=0x0;writeDB(_0xd55409);}});}catch(_0x3ac7c9){utils[_0x0c31('0x19')](_0x3ac7c9[_0x0c31('0x21')]);}};exports[_0x0c31('0x26')]=function(_0x34a93a){try{if(agents[_0x34a93a[_0x0c31('0x15')]]){agents[_0x34a93a['destuniqueid']][_0x0c31('0x27')]=utils[_0x0c31('0x18')]();agents[_0x34a93a[_0x0c31('0x15')]][_0x0c31('0xa')]=_0x34a93a[_0x0c31('0xa')];agents[_0x34a93a[_0x0c31('0x15')]]['connectedlinename']=_0x34a93a[_0x0c31('0x28')];agents[_0x34a93a[_0x0c31('0x15')]][_0x0c31('0x1e')]=_0x34a93a['ringtime'];agents[_0x34a93a[_0x0c31('0x15')]]['lastevent']=_0x0c31('0x29');_[_0x0c31('0x22')](agents,function(_0x32bacf,_0x22a145){if(_0x32bacf[_0x0c31('0x15')]!=_0x34a93a[_0x0c31('0x15')]&&_0x32bacf[_0x0c31('0x4')]==_0x34a93a[_0x0c31('0x4')]){_0x32bacf[_0x0c31('0x20')]=0x0;_0x32bacf[_0x0c31('0x1e')]=_0x34a93a[_0x0c31('0x1f')];_0x32bacf[_0x0c31('0x1b')]=!![];_0x32bacf[_0x0c31('0x1c')]=utils[_0x0c31('0x18')]();_0x32bacf['lastevent']=_0x0c31('0x2a');_0x32bacf['reason']=_0x0c31('0x2a');_0x32bacf[_0x0c31('0x2b')]=_0x34a93a[_0x0c31('0x15')];_0x32bacf[_0x0c31('0x2c')]=_0x34a93a['membername'];writeDB(_0x32bacf);}});}}catch(_0x1996cf){utils[_0x0c31('0x19')](_0x1996cf[_0x0c31('0x21')]);}};exports[_0x0c31('0xf')]=function(_0x52b714){try{if(!_[_0x0c31('0x1a')](agents[_0x52b714[_0x0c31('0x15')]])){agents[_0x52b714[_0x0c31('0x15')]][_0x0c31('0xf')]=!![];agents[_0x52b714[_0x0c31('0x15')]][_0x0c31('0x2d')]=utils[_0x0c31('0x18')]();agents[_0x52b714[_0x0c31('0x15')]][_0x0c31('0x20')]=utils[_0x0c31('0x2e')](agents[_0x52b714[_0x0c31('0x15')]][_0x0c31('0x2d')],agents[_0x52b714[_0x0c31('0x15')]]['agentconnectAt']);agents[_0x52b714[_0x0c31('0x15')]][_0x0c31('0x25')]=_0x52b714['reason'];agents[_0x52b714['destuniqueid']][_0x0c31('0xb')]=_0x0c31('0x2f');writeDB(agents[_0x52b714[_0x0c31('0x15')]]);}}catch(_0x43b25c){utils[_0x0c31('0x19')](_0x43b25c[_0x0c31('0x21')]);}};exports[_0x0c31('0x30')]=function(_0x54468c){try{if(!_[_0x0c31('0x1a')](agents[_0x54468c[_0x0c31('0x31')]])){agents[_0x54468c[_0x0c31('0x31')]][_0x0c31('0x32')]=!![];agents[_0x54468c[_0x0c31('0x31')]][_0x0c31('0x33')]=_0x0c31('0x34');agents[_0x54468c[_0x0c31('0x31')]][_0x0c31('0x35')]=_0x54468c[_0x0c31('0x36')];agents[_0x54468c[_0x0c31('0x31')]][_0x0c31('0x37')]=agents[_0x54468c[_0x0c31('0x31')]][_0x0c31('0x4')];}}catch(_0x1aad83){utils[_0x0c31('0x19')](_0x1aad83[_0x0c31('0x21')]);}};exports[_0x0c31('0x38')]=function(_0x17957f){try{if(_0x17957f[_0x0c31('0x39')]==_0x17957f['origtransfererlinkedid']){if(!_[_0x0c31('0x1a')](agents[_0x17957f[_0x0c31('0x3a')]])){agents[_0x17957f[_0x0c31('0x3a')]][_0x0c31('0x32')]=!![];agents[_0x17957f[_0x0c31('0x3a')]]['transfertype']='ATTENDED';agents[_0x17957f[_0x0c31('0x3a')]][_0x0c31('0x35')]=_0x17957f['origtransfererexten'];agents[_0x17957f[_0x0c31('0x3a')]]['transferuniqueid']=_0x17957f[_0x0c31('0x39')];}if(_0x17957f[_0x0c31('0x3b')]&&agents[_0x17957f[_0x0c31('0x3b')]]){agents[_0x17957f[_0x0c31('0x3b')]][_0x0c31('0x3c')]=0x1;transfers[_0x17957f[_0x0c31('0x3b')]]=_[_0x0c31('0x3d')](agents[_0x17957f[_0x0c31('0x3b')]]);transfers[_0x17957f[_0x0c31('0x3b')]][_0x0c31('0x9')]=agents[_0x17957f[_0x0c31('0x3a')]][_0x0c31('0x9')];transfers[_0x17957f[_0x0c31('0x3b')]][_0x0c31('0x3e')]=agents[_0x17957f[_0x0c31('0x3a')]][_0x0c31('0x3e')];transfers[_0x17957f[_0x0c31('0x3b')]]['agentcalledAt']=utils[_0x0c31('0x18')]();transfers[_0x17957f[_0x0c31('0x3b')]]['agentconnectAt']=utils[_0x0c31('0x18')]();transfers[_0x17957f['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x17957f[_0x0c31('0x3b')]][_0x0c31('0x3c')]=0x2;}}else if(_0x17957f[_0x0c31('0x3a')]==_0x17957f[_0x0c31('0x3f')]){if(!_[_0x0c31('0x1a')](agents[_0x17957f['origtransfereruniqueid']])){agents[_0x17957f['origtransfereruniqueid']][_0x0c31('0x32')]=!![];agents[_0x17957f[_0x0c31('0x39')]][_0x0c31('0x33')]=_0x0c31('0x40');agents[_0x17957f['origtransfereruniqueid']][_0x0c31('0x35')]=_0x17957f[_0x0c31('0x41')];agents[_0x17957f[_0x0c31('0x39')]][_0x0c31('0x37')]=_0x17957f[_0x0c31('0x3a')];}if(_0x17957f[_0x0c31('0x42')]&&agents[_0x17957f['transfertargetuniqueid']]){agents[_0x17957f[_0x0c31('0x42')]][_0x0c31('0x3c')]=0x1;transfers[_0x17957f[_0x0c31('0x42')]]=_['clone'](agents[_0x17957f[_0x0c31('0x42')]]);transfers[_0x17957f[_0x0c31('0x42')]]['calleridnum']=agents[_0x17957f[_0x0c31('0x39')]][_0x0c31('0x9')];transfers[_0x17957f['transfertargetuniqueid']][_0x0c31('0x3e')]=agents[_0x17957f[_0x0c31('0x39')]][_0x0c31('0x3e')];transfers[_0x17957f[_0x0c31('0x42')]][_0x0c31('0x17')]=utils[_0x0c31('0x18')]();transfers[_0x17957f[_0x0c31('0x42')]][_0x0c31('0x27')]=utils[_0x0c31('0x18')]();transfers[_0x17957f[_0x0c31('0x42')]][_0x0c31('0x1e')]=0x0;transfers[_0x17957f[_0x0c31('0x42')]][_0x0c31('0x3c')]=0x2;}}}catch(_0x55f908){utils[_0x0c31('0x19')](_0x55f908[_0x0c31('0x21')]);}};exports[_0x0c31('0x43')]=function(_0x4a700e){try{if(agents[_0x4a700e[_0x0c31('0x4')]]&&agents[_0x4a700e[_0x0c31('0x4')]][_0x0c31('0x25')]===_0x0c31('0x1d')){if(_0x4a700e[_0x0c31('0x44')]==='21'){agents[_0x4a700e['uniqueid']]['reason']='rejected';agents[_0x4a700e[_0x0c31('0x4')]][_0x0c31('0xb')]=_0x0c31('0x45');}writeDB(agents[_0x4a700e[_0x0c31('0x4')]]);var _0x549703=unanswered[_0x0c31('0x46')](_0x4a700e['uniqueid']);if(_0x549703>-0x1)unanswered[_0x0c31('0x47')](_0x549703,0x1);}if(transfers[_0x4a700e['uniqueid']]){transfers[_0x4a700e[_0x0c31('0x4')]][_0x0c31('0xf')]=!![];transfers[_0x4a700e['uniqueid']]['agentcompleteAt']=utils[_0x0c31('0x18')]();transfers[_0x4a700e[_0x0c31('0x4')]]['talktime']=utils[_0x0c31('0x2e')](transfers[_0x4a700e[_0x0c31('0x4')]][_0x0c31('0x2d')],transfers[_0x4a700e['uniqueid']][_0x0c31('0x27')]);transfers[_0x4a700e['uniqueid']][_0x0c31('0x25')]=_0x0c31('0x48');transfers[_0x4a700e['uniqueid']][_0x0c31('0xb')]=_0x0c31('0x2f');writeDB(transfers[_0x4a700e[_0x0c31('0x4')]],!![]);}if(agents[_0x4a700e[_0x0c31('0x4')]]&&agents[_0x4a700e[_0x0c31('0x4')]]['agentconnectAt']){agents[_0x4a700e[_0x0c31('0x4')]]['agentcomplete']=!![];agents[_0x4a700e[_0x0c31('0x4')]]['agentcompleteAt']=utils[_0x0c31('0x18')]();agents[_0x4a700e[_0x0c31('0x4')]][_0x0c31('0x20')]=utils[_0x0c31('0x2e')](agents[_0x4a700e[_0x0c31('0x4')]]['agentcompleteAt'],agents[_0x4a700e['uniqueid']][_0x0c31('0x27')]);agents[_0x4a700e[_0x0c31('0x4')]][_0x0c31('0x25')]=agents[_0x4a700e[_0x0c31('0x4')]][_0x0c31('0x32')]?'transfer':_0x0c31('0x48');agents[_0x4a700e[_0x0c31('0x4')]][_0x0c31('0xb')]=_0x0c31('0x2f');writeDB(agents[_0x4a700e[_0x0c31('0x4')]]);}}catch(_0x185feb){utils['error'](_0x185feb[_0x0c31('0x21')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c9c8c5e..dd8e6be 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 _0x3b4a=['FAILED','ANSWERED','BUSY','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','UserId','request','CreateVoiceCallReport','uniqueid','linkedid','OutgoingSpoolFailed','calleridnum','exten','error','stack','newstate','isNil','channelstate','systemanswertime','now','context','transfer','answertime','calleridname','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','value','variable','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','ContactId','outboundrouteid','sipcallid','newexten','application','toLowerCase','set','startsWith','cdr','appdata','split','noop','lastapplication','util','./utils','NO\x20ANSWER'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x3b4a,0x121));var _0xa3b4=function(_0x3d6030,_0x20d669){_0x3d6030=_0x3d6030-0x0;var _0xa1f111=_0x3b4a[_0x3d6030];return _0xa1f111;};'use strict';var _=require('lodash');var util=require(_0xa3b4('0x0'));var utils=require(_0xa3b4('0x1'));var dispositions=[_0xa3b4('0x2'),_0xa3b4('0x3'),_0xa3b4('0x3'),_0xa3b4('0x2'),_0xa3b4('0x2'),_0xa3b4('0x2'),_0xa3b4('0x4'),_0xa3b4('0x5'),_0xa3b4('0x3'),'FAILED',_0xa3b4('0x3')];var channels={};function writeDB(_0x473791){utils[_0xa3b4('0x6')](util['format'](_0xa3b4('0x7'),_0x473791['uniqueid'],_0x473791[_0xa3b4('0x8')],_0x473791[_0xa3b4('0x9')],_0x473791[_0xa3b4('0xa')],_0x473791[_0xa3b4('0xb')],_0x473791[_0xa3b4('0xc')],_0x473791[_0xa3b4('0xd')],_0x473791[_0xa3b4('0xe')]));if(_0x473791[_0xa3b4('0xa')]){utils[_0xa3b4('0xf')](_0x473791['accountcode'])['then'](function(_0xbf3fe1){if(_0xbf3fe1){_0x473791[_0xa3b4('0x10')]=_0xbf3fe1['id'];}utils[_0xa3b4('0x11')](_0xa3b4('0x12'),_0x473791);});}else{utils[_0xa3b4('0x11')](_0xa3b4('0x12'),_0x473791);}if(channels[_0x473791[_0xa3b4('0x13')]]){delete channels[_0x473791['uniqueid']];}}exports['newchannel']=function(_0x4218a3){try{if(_0x4218a3['uniqueid']==_0x4218a3[_0xa3b4('0x14')]&&_0x4218a3[_0xa3b4('0x8')]!=_0xa3b4('0x15')){channels[_0x4218a3['uniqueid']]={'uniqueid':_0x4218a3[_0xa3b4('0x13')],'accountcode':_0x4218a3['accountcode'],'source':_0x4218a3[_0xa3b4('0x16')],'destination':_0x4218a3[_0xa3b4('0x17')],'destinationcontext':_0x4218a3['context'],'channel':_0x4218a3[_0xa3b4('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa3b4('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x54455d){utils[_0xa3b4('0x18')](_0x54455d[_0xa3b4('0x19')]);}};exports[_0xa3b4('0x1a')]=function(_0x3e53f3){try{if(!_[_0xa3b4('0x1b')](channels[_0x3e53f3['uniqueid']])&&_0x3e53f3[_0xa3b4('0x1c')]==0x6){if(_['isNil'](channels[_0x3e53f3['uniqueid']][_0xa3b4('0x1d')])){channels[_0x3e53f3[_0xa3b4('0x13')]][_0xa3b4('0x1d')]=utils[_0xa3b4('0x1e')]();}}else if(!_[_0xa3b4('0x1b')](channels[_0x3e53f3[_0xa3b4('0x14')]])&&_0x3e53f3['channelstate']==0x6&&_0x3e53f3[_0xa3b4('0x1f')]!=_0xa3b4('0x20')){channels[_0x3e53f3[_0xa3b4('0x14')]][_0xa3b4('0xa')]=_0x3e53f3[_0xa3b4('0xa')];channels[_0x3e53f3['linkedid']]['destinationchannel']=_0x3e53f3[_0xa3b4('0x8')];if(_['isNil'](channels[_0x3e53f3['linkedid']][_0xa3b4('0x21')])){channels[_0x3e53f3[_0xa3b4('0x14')]][_0xa3b4('0x21')]=utils[_0xa3b4('0x1e')]();}channels[_0x3e53f3[_0xa3b4('0x14')]][_0xa3b4('0xe')]=dispositions[_['toNumber'](_0x3e53f3[_0xa3b4('0x1c')])]||_0xa3b4('0x4');}}catch(_0x5db84b){utils['error'](_0x5db84b[_0xa3b4('0x19')]);}};exports['hangup']=function(_0x452665){try{if(!_[_0xa3b4('0x1b')](channels[_0x452665[_0xa3b4('0x13')]])){if(_[_0xa3b4('0x1b')](channels[_0x452665['uniqueid']][_0xa3b4('0xd')])){channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0xd')]=_0x452665[_0xa3b4('0x22')]+'\x20<'+_0x452665['calleridnum']+'>';}channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0x23')]=utils[_0xa3b4('0x1e')]();channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0x24')]=utils[_0xa3b4('0x25')](channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0x23')],channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0x26')]);channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0x27')]=channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0x21')]?utils['diffTime'](channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0x23')],channels[_0x452665[_0xa3b4('0x13')]][_0xa3b4('0x21')]):0x0;writeDB(channels[_0x452665[_0xa3b4('0x13')]]);}}catch(_0x1eda3d){utils[_0xa3b4('0x18')](_0x1eda3d[_0xa3b4('0x19')]);}};exports[_0xa3b4('0x28')]=function(_0x57c245){try{if(!_[_0xa3b4('0x1b')](channels[_0x57c245['localtwolinkedid']])){if(channels[_0x57c245[_0xa3b4('0x29')]][_0xa3b4('0x8')]==_0x57c245[_0xa3b4('0x2a')]){channels[_0x57c245[_0xa3b4('0x29')]]['destinationchannel']=_0x57c245[_0xa3b4('0x2b')];channels[_0x57c245[_0xa3b4('0x29')]][_0xa3b4('0x2c')]=_0xa3b4('0x2d');}else if(channels[_0x57c245['localtwolinkedid']][_0xa3b4('0x8')]=_0x57c245['transfertargetchannel']){channels[_0x57c245[_0xa3b4('0x29')]]['destinationchannel']=_0x57c245['origtransfererchannel'];channels[_0x57c245[_0xa3b4('0x29')]][_0xa3b4('0x2c')]=_0xa3b4('0x2d');}}}catch(_0x178070){utils[_0xa3b4('0x18')](_0x178070[_0xa3b4('0x19')]);}};exports[_0xa3b4('0x2e')]=function(_0xdaee97){try{if(!_[_0xa3b4('0x1b')](channels[_0xdaee97['uniqueid']])){channels[_0xdaee97['uniqueid']][_0xa3b4('0x2f')]=utils[_0xa3b4('0x1e')]();}}catch(_0x338112){utils[_0xa3b4('0x18')](_0x338112[_0xa3b4('0x19')]);}};exports[_0xa3b4('0x30')]=function(_0x264d0c){try{if(!_['isNil'](channels[_0x264d0c['uniqueid']])){if(!_[_0xa3b4('0x1b')](channels[_0x264d0c['uniqueid']][_0xa3b4('0x2f')])){channels[_0x264d0c['uniqueid']][_0xa3b4('0x31')]+=utils['diffTime'](utils['now'](),channels[_0x264d0c[_0xa3b4('0x13')]][_0xa3b4('0x2f')]);delete channels[_0x264d0c[_0xa3b4('0x13')]]['musiconholdstartAt'];}}}catch(_0x251b9c){utils[_0xa3b4('0x18')](_0x251b9c['stack']);}};exports[_0xa3b4('0x32')]=function(_0x565234){try{if(!_[_0xa3b4('0x1b')](channels[_0x565234[_0xa3b4('0x13')]])){if(!_[_0xa3b4('0x1b')](_0x565234['variable']['xmd-originatecalleridnum'])){channels[_0x565234['uniqueid']]['source']=_0x565234[_0xa3b4('0x33')];}if(!_[_0xa3b4('0x1b')](_0x565234[_0xa3b4('0x34')]['xmd-phone'])){channels[_0x565234[_0xa3b4('0x13')]][_0xa3b4('0xc')]=_0x565234[_0xa3b4('0x33')];channels[_0x565234['uniqueid']][_0xa3b4('0xd')]='\x22'+_0x565234[_0xa3b4('0x33')]+_0xa3b4('0x35')+_0x565234[_0xa3b4('0x33')]+'>';}if(!_[_0xa3b4('0x1b')](_0x565234[_0xa3b4('0x34')][_0xa3b4('0x36')])||!_[_0xa3b4('0x1b')](_0x565234[_0xa3b4('0x34')][_0xa3b4('0x37')])){channels[_0x565234[_0xa3b4('0x13')]]['callerid']=_0x565234[_0xa3b4('0x33')];}if(!_[_0xa3b4('0x1b')](_0x565234[_0xa3b4('0x34')][_0xa3b4('0x38')])||!_['isNil'](_0x565234[_0xa3b4('0x34')][_0xa3b4('0x39')])){channels[_0x565234[_0xa3b4('0x13')]]['lastapplication']=_0xa3b4('0x3a');channels[_0x565234[_0xa3b4('0x13')]][_0xa3b4('0x3b')]=_0x565234[_0xa3b4('0x33')];channels[_0x565234[_0xa3b4('0x13')]]['queue']=!![];}if(!_[_0xa3b4('0x1b')](_0x565234['variable']['xmd-contactid'])){channels[_0x565234[_0xa3b4('0x13')]][_0xa3b4('0x3c')]=_0x565234[_0xa3b4('0x33')];}if(!_[_0xa3b4('0x1b')](_0x565234[_0xa3b4('0x34')]['xmd-cdrtype'])){channels[_0x565234[_0xa3b4('0x13')]]['type']=_0x565234['value'];}if(!_[_0xa3b4('0x1b')](_0x565234[_0xa3b4('0x34')][_0xa3b4('0x3d')])){channels[_0x565234[_0xa3b4('0x13')]]['routeid']=_0x565234[_0xa3b4('0x33')];}if(!_[_0xa3b4('0x1b')](_0x565234['variable']['sipcallid'])){channels[_0x565234[_0xa3b4('0x13')]][_0xa3b4('0x3e')]=_0x565234[_0xa3b4('0x33')];}}}catch(_0x4c57ce){utils['error'](_0x4c57ce[_0xa3b4('0x19')]);}};exports[_0xa3b4('0x3f')]=function(_0x28ea81){try{if(!_['isNil'](channels[_0x28ea81[_0xa3b4('0x13')]])){if(_0x28ea81[_0xa3b4('0x40')][_0xa3b4('0x41')]()==_0xa3b4('0x42')&&_[_0xa3b4('0x43')](_0x28ea81['appdata'][_0xa3b4('0x41')](),_0xa3b4('0x44'))){var _0xff4a10=_0x28ea81[_0xa3b4('0x45')][_0xa3b4('0x46')]('=');var _0x10b9e5=_0xff4a10[0x0]['substring'](_0xff4a10[0x0]['lastIndexOf']('(')+0x1,_0xff4a10[0x0]['lastIndexOf'](')'));var _0x5cb042=_0xff4a10[0x1];channels[_0x28ea81[_0xa3b4('0x13')]][_0x10b9e5]=_0x5cb042;}if(!_['includes'](['hangup',_0xa3b4('0x47'),'execif',_0xa3b4('0x42'),'gotoif'],_0x28ea81[_0xa3b4('0x40')]['toLowerCase']())){channels[_0x28ea81['uniqueid']][_0xa3b4('0x48')]=_0x28ea81['application'];channels[_0x28ea81[_0xa3b4('0x13')]][_0xa3b4('0x3b')]=_0x28ea81[_0xa3b4('0x45')];}}}catch(_0x40ef54){utils[_0xa3b4('0x18')](_0x40ef54['stack']);}}; \ No newline at end of file +var _0xacf3=['destinationchannel','answertime','toNumber','ANSWERED','hangup','callerid','calleridname','diffTime','starttime','billableseconds','endtime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','Queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','toLowerCase','appdata','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','application','lastapplication','lastdata','lodash','NO\x20ANSWER','FAILED','BUSY','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','source','destination','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','calleridnum','exten','now','DOCUMENTATION','error','stack','isNil','systemanswertime','channelstate','transfer'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xacf3,0x1ce));var _0x3acf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xacf3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3acf('0x0'));var util=require('util');var utils=require('./utils');var dispositions=[_0x3acf('0x1'),_0x3acf('0x2'),'FAILED',_0x3acf('0x1'),_0x3acf('0x1'),_0x3acf('0x1'),'ANSWERED',_0x3acf('0x3'),_0x3acf('0x2'),_0x3acf('0x2'),_0x3acf('0x2')];var channels={};function writeDB(_0xdff22b){utils[_0x3acf('0x4')](util['format'](_0x3acf('0x5'),_0xdff22b[_0x3acf('0x6')],_0xdff22b[_0x3acf('0x7')],_0xdff22b[_0x3acf('0x8')],_0xdff22b[_0x3acf('0x9')],_0xdff22b[_0x3acf('0xa')],_0xdff22b[_0x3acf('0xb')],_0xdff22b['callerid'],_0xdff22b[_0x3acf('0xc')]));if(_0xdff22b[_0x3acf('0x9')]){utils[_0x3acf('0xd')](_0xdff22b['accountcode'])[_0x3acf('0xe')](function(_0x40cb27){if(_0x40cb27){_0xdff22b[_0x3acf('0xf')]=_0x40cb27['id'];}utils[_0x3acf('0x10')](_0x3acf('0x11'),_0xdff22b);});}else{utils[_0x3acf('0x10')](_0x3acf('0x11'),_0xdff22b);}if(channels[_0xdff22b[_0x3acf('0x6')]]){delete channels[_0xdff22b[_0x3acf('0x6')]];}}exports[_0x3acf('0x12')]=function(_0x46322f){try{if(_0x46322f[_0x3acf('0x6')]==_0x46322f[_0x3acf('0x13')]&&_0x46322f[_0x3acf('0x7')]!='OutgoingSpoolFailed'){channels[_0x46322f[_0x3acf('0x6')]]={'uniqueid':_0x46322f[_0x3acf('0x6')],'accountcode':_0x46322f[_0x3acf('0x9')],'source':_0x46322f[_0x3acf('0x14')],'destination':_0x46322f[_0x3acf('0x15')],'destinationcontext':_0x46322f['context'],'channel':_0x46322f[_0x3acf('0x7')],'starttime':utils[_0x3acf('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3acf('0x1'),'amaflags':_0x3acf('0x17')};}}catch(_0x37c9ed){utils[_0x3acf('0x18')](_0x37c9ed[_0x3acf('0x19')]);}};exports['newstate']=function(_0x4058e8){try{if(!_[_0x3acf('0x1a')](channels[_0x4058e8[_0x3acf('0x6')]])&&_0x4058e8['channelstate']==0x6){if(_[_0x3acf('0x1a')](channels[_0x4058e8[_0x3acf('0x6')]][_0x3acf('0x1b')])){channels[_0x4058e8['uniqueid']][_0x3acf('0x1b')]=utils[_0x3acf('0x16')]();}}else if(!_[_0x3acf('0x1a')](channels[_0x4058e8['linkedid']])&&_0x4058e8[_0x3acf('0x1c')]==0x6&&_0x4058e8['context']!=_0x3acf('0x1d')){channels[_0x4058e8[_0x3acf('0x13')]][_0x3acf('0x9')]=_0x4058e8[_0x3acf('0x9')];channels[_0x4058e8[_0x3acf('0x13')]][_0x3acf('0x1e')]=_0x4058e8[_0x3acf('0x7')];if(_['isNil'](channels[_0x4058e8['linkedid']]['answertime'])){channels[_0x4058e8['linkedid']][_0x3acf('0x1f')]=utils[_0x3acf('0x16')]();}channels[_0x4058e8['linkedid']][_0x3acf('0xc')]=dispositions[_[_0x3acf('0x20')](_0x4058e8[_0x3acf('0x1c')])]||_0x3acf('0x21');}}catch(_0x476c2a){utils[_0x3acf('0x18')](_0x476c2a['stack']);}};exports[_0x3acf('0x22')]=function(_0x3c048d){try{if(!_[_0x3acf('0x1a')](channels[_0x3c048d[_0x3acf('0x6')]])){if(_[_0x3acf('0x1a')](channels[_0x3c048d[_0x3acf('0x6')]][_0x3acf('0x23')])){channels[_0x3c048d[_0x3acf('0x6')]][_0x3acf('0x23')]=_0x3c048d[_0x3acf('0x24')]+'\x20<'+_0x3c048d[_0x3acf('0x14')]+'>';}channels[_0x3c048d[_0x3acf('0x6')]]['endtime']=utils[_0x3acf('0x16')]();channels[_0x3c048d[_0x3acf('0x6')]]['duration']=utils[_0x3acf('0x25')](channels[_0x3c048d[_0x3acf('0x6')]]['endtime'],channels[_0x3c048d[_0x3acf('0x6')]][_0x3acf('0x26')]);channels[_0x3c048d['uniqueid']][_0x3acf('0x27')]=channels[_0x3c048d['uniqueid']][_0x3acf('0x1f')]?utils[_0x3acf('0x25')](channels[_0x3c048d['uniqueid']][_0x3acf('0x28')],channels[_0x3c048d[_0x3acf('0x6')]][_0x3acf('0x1f')]):0x0;writeDB(channels[_0x3c048d[_0x3acf('0x6')]]);}}catch(_0x17982f){utils['error'](_0x17982f[_0x3acf('0x19')]);}};exports[_0x3acf('0x29')]=function(_0x41554f){try{if(!_[_0x3acf('0x1a')](channels[_0x41554f[_0x3acf('0x2a')]])){if(channels[_0x41554f[_0x3acf('0x2a')]][_0x3acf('0x7')]==_0x41554f[_0x3acf('0x2b')]){channels[_0x41554f[_0x3acf('0x2a')]]['destinationchannel']=_0x41554f[_0x3acf('0x2c')];channels[_0x41554f['localtwolinkedid']][_0x3acf('0x2d')]=_0x3acf('0x2e');}else if(channels[_0x41554f['localtwolinkedid']][_0x3acf('0x7')]=_0x41554f[_0x3acf('0x2f')]){channels[_0x41554f[_0x3acf('0x2a')]][_0x3acf('0x1e')]=_0x41554f[_0x3acf('0x30')];channels[_0x41554f['localtwolinkedid']][_0x3acf('0x2d')]='_attended';}}}catch(_0x2bd7c1){utils['error'](_0x2bd7c1[_0x3acf('0x19')]);}};exports['musiconholdstart']=function(_0x54c6d8){try{if(!_[_0x3acf('0x1a')](channels[_0x54c6d8[_0x3acf('0x6')]])){channels[_0x54c6d8[_0x3acf('0x6')]][_0x3acf('0x31')]=utils[_0x3acf('0x16')]();}}catch(_0x132d7b){utils[_0x3acf('0x18')](_0x132d7b['stack']);}};exports[_0x3acf('0x32')]=function(_0x1b1131){try{if(!_['isNil'](channels[_0x1b1131[_0x3acf('0x6')]])){if(!_[_0x3acf('0x1a')](channels[_0x1b1131[_0x3acf('0x6')]][_0x3acf('0x31')])){channels[_0x1b1131[_0x3acf('0x6')]][_0x3acf('0x33')]+=utils[_0x3acf('0x25')](utils['now'](),channels[_0x1b1131['uniqueid']][_0x3acf('0x31')]);delete channels[_0x1b1131[_0x3acf('0x6')]][_0x3acf('0x31')];}}}catch(_0x25b4ed){utils[_0x3acf('0x18')](_0x25b4ed[_0x3acf('0x19')]);}};exports[_0x3acf('0x34')]=function(_0x2c8b91){try{if(!_[_0x3acf('0x1a')](channels[_0x2c8b91['uniqueid']])){if(!_[_0x3acf('0x1a')](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x36')])){channels[_0x2c8b91[_0x3acf('0x6')]][_0x3acf('0xa')]=_0x2c8b91[_0x3acf('0x37')];}if(!_[_0x3acf('0x1a')](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x38')])){channels[_0x2c8b91['uniqueid']][_0x3acf('0xb')]=_0x2c8b91['value'];channels[_0x2c8b91['uniqueid']][_0x3acf('0x23')]='\x22'+_0x2c8b91[_0x3acf('0x37')]+_0x3acf('0x39')+_0x2c8b91[_0x3acf('0x37')]+'>';}if(!_[_0x3acf('0x1a')](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x3a')])||!_['isNil'](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x3b')])){channels[_0x2c8b91[_0x3acf('0x6')]][_0x3acf('0x23')]=_0x2c8b91['value'];}if(!_[_0x3acf('0x1a')](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x3c')])||!_['isNil'](_0x2c8b91['variable'][_0x3acf('0x3d')])){channels[_0x2c8b91[_0x3acf('0x6')]]['lastapplication']=_0x3acf('0x3e');channels[_0x2c8b91[_0x3acf('0x6')]]['lastdata']=_0x2c8b91['value'];channels[_0x2c8b91[_0x3acf('0x6')]]['queue']=!![];}if(!_[_0x3acf('0x1a')](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x3f')])){channels[_0x2c8b91['uniqueid']][_0x3acf('0x40')]=_0x2c8b91[_0x3acf('0x37')];}if(!_[_0x3acf('0x1a')](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x41')])){channels[_0x2c8b91['uniqueid']]['type']=_0x2c8b91['value'];}if(!_[_0x3acf('0x1a')](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x42')])){channels[_0x2c8b91[_0x3acf('0x6')]][_0x3acf('0x43')]=_0x2c8b91[_0x3acf('0x37')];}if(!_[_0x3acf('0x1a')](_0x2c8b91[_0x3acf('0x35')][_0x3acf('0x44')])){channels[_0x2c8b91[_0x3acf('0x6')]]['sipcallid']=_0x2c8b91[_0x3acf('0x37')];}}}catch(_0x314a89){utils[_0x3acf('0x18')](_0x314a89['stack']);}};exports[_0x3acf('0x45')]=function(_0x202023){try{if(!_[_0x3acf('0x1a')](channels[_0x202023[_0x3acf('0x6')]])){if(_0x202023['application'][_0x3acf('0x46')]()=='set'&&_['startsWith'](_0x202023[_0x3acf('0x47')]['toLowerCase'](),_0x3acf('0x48'))){var _0x310bde=_0x202023[_0x3acf('0x47')]['split']('=');var _0x376c6f=_0x310bde[0x0][_0x3acf('0x49')](_0x310bde[0x0][_0x3acf('0x4a')]('(')+0x1,_0x310bde[0x0]['lastIndexOf'](')'));var _0x389624=_0x310bde[0x1];channels[_0x202023[_0x3acf('0x6')]][_0x376c6f]=_0x389624;}if(!_[_0x3acf('0x4b')]([_0x3acf('0x22'),_0x3acf('0x4c'),_0x3acf('0x4d'),'set',_0x3acf('0x4e')],_0x202023[_0x3acf('0x4f')]['toLowerCase']())){channels[_0x202023['uniqueid']][_0x3acf('0x50')]=_0x202023[_0x3acf('0x4f')];channels[_0x202023[_0x3acf('0x6')]][_0x3acf('0x51')]=_0x202023[_0x3acf('0x47')];}}}catch(_0x26f3ed){utils[_0x3acf('0x18')](_0x26f3ed['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 812e652..0ed7816 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 _0x4819=['SHUTDOWN','fullybooted','FULLYBOOTED','CLOSE','managerevent','lodash','connect','info','CONNECTED','shutdown'];(function(_0x1762b4,_0x6bfe2e){var _0x34d857=function(_0x4d06b3){while(--_0x4d06b3){_0x1762b4['push'](_0x1762b4['shift']());}};_0x34d857(++_0x6bfe2e);}(_0x4819,0xcd));var _0x9481=function(_0x5178fb,_0x121e19){_0x5178fb=_0x5178fb-0x0;var _0x348183=_0x4819[_0x5178fb];return _0x348183;};'use strict';var utils=require('./utils');var _=require(_0x9481('0x0'));exports[_0x9481('0x1')]=function(){utils[_0x9481('0x2')](_0x9481('0x3'));};exports[_0x9481('0x4')]=function(){utils[_0x9481('0x2')](_0x9481('0x5'));};exports[_0x9481('0x6')]=function(){utils[_0x9481('0x2')](_0x9481('0x7'));};exports['error']=function(_0x4d9e3a){utils['error'](_0x4d9e3a);};exports['close']=function(){utils[_0x9481('0x2')](_0x9481('0x8'));};exports[_0x9481('0x9')]=function(_0x3278ff){}; \ No newline at end of file +var _0x4fb4=['lodash','connect','info','CONNECTED','shutdown','fullybooted','FULLYBOOTED','error','close','managerevent'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x4fb4,0x190));var _0x44fb=function(_0x311eea,_0x3cc61f){_0x311eea=_0x311eea-0x0;var _0x3f60e0=_0x4fb4[_0x311eea];return _0x3f60e0;};'use strict';var utils=require('./utils');var _=require(_0x44fb('0x0'));exports[_0x44fb('0x1')]=function(){utils[_0x44fb('0x2')](_0x44fb('0x3'));};exports[_0x44fb('0x4')]=function(){utils[_0x44fb('0x2')]('SHUTDOWN');};exports[_0x44fb('0x5')]=function(){utils[_0x44fb('0x2')](_0x44fb('0x6'));};exports[_0x44fb('0x7')]=function(_0x375d33){utils[_0x44fb('0x7')](_0x375d33);};exports[_0x44fb('0x8')]=function(){utils[_0x44fb('0x2')]('CLOSE');};exports[_0x44fb('0x9')]=function(_0xd4ead0){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 83d7311..2688eaf 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 _0x3fa0=['complete','duration','diffTime','endtime','util','./utils','info','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','application','toLowerCase','set','appdata','split','error','varset','isNil','outboundrouteid','value','dialbegin','assign','starttime','lastevent','called','stack','dialend','dialstatus','answertime','now','connect','hangup'];(function(_0x1e559b,_0x4f9f64){var _0xc63f7c=function(_0xaef0e3){while(--_0xaef0e3){_0x1e559b['push'](_0x1e559b['shift']());}};_0xc63f7c(++_0x4f9f64);}(_0x3fa0,0x100));var _0x03fa=function(_0x480271,_0x3586a8){_0x480271=_0x480271-0x0;var _0x144437=_0x3fa0[_0x480271];return _0x144437;};'use strict';var _=require('lodash');var util=require(_0x03fa('0x0'));var utils=require(_0x03fa('0x1'));var dials={};function writeDB(_0x14098b){utils[_0x03fa('0x2')](util['format']('DIAL|%s|%s|%s|%s|%s|%s',_0x14098b['uniqueid'],_0x14098b['channel'],_0x14098b[_0x03fa('0x3')],_0x14098b[_0x03fa('0x4')],_0x14098b[_0x03fa('0x5')],_0x14098b['dialstatus']));utils[_0x03fa('0x6')](_0x03fa('0x7'),_0x14098b);delete dials[_0x14098b[_0x03fa('0x8')]];}exports[_0x03fa('0x9')]=function(_0x347656){try{if(_0x347656[_0x03fa('0xa')][_0x03fa('0xb')]()==_0x03fa('0xc')&&_['startsWith'](_0x347656[_0x03fa('0xd')]['toLowerCase'](),'cdr(routeid)')){var _0x220c1e=_0x347656[_0x03fa('0xd')][_0x03fa('0xe')]('=');dials[_0x347656[_0x03fa('0x8')]]={'routeId':_0x220c1e[0x1]};}}catch(_0x1566c4){utils[_0x03fa('0xf')](_0x1566c4['stack']);}};exports[_0x03fa('0x10')]=function(_0x18c0ef){try{if(!_[_0x03fa('0x11')](_0x18c0ef['variable'][_0x03fa('0x12')])){dials[_0x18c0ef[_0x03fa('0x8')]]={'routeId':_0x18c0ef[_0x03fa('0x13')]};}}catch(_0x5bc4e1){utils[_0x03fa('0xf')](_0x5bc4e1['stack']);}};exports[_0x03fa('0x14')]=function(_0x191a7c){try{if(!_[_0x03fa('0x11')](dials[_0x191a7c[_0x03fa('0x8')]])){dials[_0x191a7c[_0x03fa('0x8')]]=_[_0x03fa('0x15')](dials[_0x191a7c[_0x03fa('0x8')]],_0x191a7c);dials[_0x191a7c[_0x03fa('0x8')]][_0x03fa('0x16')]=utils['now']();dials[_0x191a7c[_0x03fa('0x8')]][_0x03fa('0x17')]=_0x03fa('0x18');}}catch(_0x464290){utils[_0x03fa('0xf')](_0x464290[_0x03fa('0x19')]);}};exports[_0x03fa('0x1a')]=function(_0x155bd6){try{if(!_[_0x03fa('0x11')](dials[_0x155bd6['uniqueid']])){dials[_0x155bd6[_0x03fa('0x8')]][_0x03fa('0x1b')]=_0x155bd6['dialstatus'];if(_0x155bd6['dialstatus']=='ANSWER'){dials[_0x155bd6[_0x03fa('0x8')]]=_[_0x03fa('0x15')](dials[_0x155bd6[_0x03fa('0x8')]],_0x155bd6);dials[_0x155bd6[_0x03fa('0x8')]][_0x03fa('0x1c')]=utils[_0x03fa('0x1d')]();dials[_0x155bd6[_0x03fa('0x8')]]['lastevent']=_0x03fa('0x1e');}}}catch(_0x45feb0){utils[_0x03fa('0xf')](_0x45feb0[_0x03fa('0x19')]);}};exports[_0x03fa('0x1f')]=function(_0x34d5e2){try{if(!_['isNil'](dials[_0x34d5e2[_0x03fa('0x8')]])){dials[_0x34d5e2[_0x03fa('0x8')]]=_['assign'](dials[_0x34d5e2[_0x03fa('0x8')]],{'endtime':utils[_0x03fa('0x1d')](),'lastevent':_0x03fa('0x20')});dials[_0x34d5e2[_0x03fa('0x8')]][_0x03fa('0x21')]=utils[_0x03fa('0x22')](dials[_0x34d5e2[_0x03fa('0x8')]][_0x03fa('0x23')],dials[_0x34d5e2[_0x03fa('0x8')]][_0x03fa('0x16')]);dials[_0x34d5e2[_0x03fa('0x8')]]['holdtime']=utils[_0x03fa('0x22')](dials[_0x34d5e2[_0x03fa('0x8')]][_0x03fa('0x1c')]||dials[_0x34d5e2['uniqueid']]['endtime'],dials[_0x34d5e2[_0x03fa('0x8')]][_0x03fa('0x16')]);dials[_0x34d5e2[_0x03fa('0x8')]]['billableseconds']=dials[_0x34d5e2['uniqueid']]['answertime']?utils[_0x03fa('0x22')](dials[_0x34d5e2[_0x03fa('0x8')]]['endtime'],dials[_0x34d5e2[_0x03fa('0x8')]][_0x03fa('0x1c')]):0x0;writeDB(dials[_0x34d5e2[_0x03fa('0x8')]]);}}catch(_0x18b6cf){utils[_0x03fa('0xf')](_0x18b6cf[_0x03fa('0x19')]);}}; \ No newline at end of file +var _0xb218=['channel','calleridnum','dialstatus','CreateVoiceDialReport','newexten','application','startsWith','appdata','cdr(routeid)','split','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','dialend','ANSWER','answertime','connect','hangup','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','./utils','info','DIAL|%s|%s|%s|%s|%s|%s','uniqueid'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb218,0x192));var _0x8b21=function(_0x2f9e99,_0x297d59){_0x2f9e99=_0x2f9e99-0x0;var _0x3a9179=_0xb218[_0x2f9e99];return _0x3a9179;};'use strict';var _=require(_0x8b21('0x0'));var util=require('util');var utils=require(_0x8b21('0x1'));var dials={};function writeDB(_0x27347f){utils[_0x8b21('0x2')](util['format'](_0x8b21('0x3'),_0x27347f[_0x8b21('0x4')],_0x27347f[_0x8b21('0x5')],_0x27347f['dialstring'],_0x27347f[_0x8b21('0x6')],_0x27347f['connectedlinenum'],_0x27347f[_0x8b21('0x7')]));utils['request'](_0x8b21('0x8'),_0x27347f);delete dials[_0x27347f[_0x8b21('0x4')]];}exports[_0x8b21('0x9')]=function(_0x5b031d){try{if(_0x5b031d[_0x8b21('0xa')]['toLowerCase']()=='set'&&_[_0x8b21('0xb')](_0x5b031d[_0x8b21('0xc')]['toLowerCase'](),_0x8b21('0xd'))){var _0x5d4077=_0x5b031d['appdata'][_0x8b21('0xe')]('=');dials[_0x5b031d[_0x8b21('0x4')]]={'routeId':_0x5d4077[0x1]};}}catch(_0x3861a5){utils[_0x8b21('0xf')](_0x3861a5[_0x8b21('0x10')]);}};exports[_0x8b21('0x11')]=function(_0x2cc988){try{if(!_[_0x8b21('0x12')](_0x2cc988[_0x8b21('0x13')][_0x8b21('0x14')])){dials[_0x2cc988[_0x8b21('0x4')]]={'routeId':_0x2cc988[_0x8b21('0x15')]};}}catch(_0x1b4663){utils[_0x8b21('0xf')](_0x1b4663[_0x8b21('0x10')]);}};exports[_0x8b21('0x16')]=function(_0x489fd5){try{if(!_[_0x8b21('0x12')](dials[_0x489fd5[_0x8b21('0x4')]])){dials[_0x489fd5[_0x8b21('0x4')]]=_[_0x8b21('0x17')](dials[_0x489fd5[_0x8b21('0x4')]],_0x489fd5);dials[_0x489fd5[_0x8b21('0x4')]][_0x8b21('0x18')]=utils[_0x8b21('0x19')]();dials[_0x489fd5['uniqueid']]['lastevent']='called';}}catch(_0xa8e30e){utils[_0x8b21('0xf')](_0xa8e30e[_0x8b21('0x10')]);}};exports[_0x8b21('0x1a')]=function(_0x31af99){try{if(!_['isNil'](dials[_0x31af99['uniqueid']])){dials[_0x31af99[_0x8b21('0x4')]]['dialstatus']=_0x31af99[_0x8b21('0x7')];if(_0x31af99['dialstatus']==_0x8b21('0x1b')){dials[_0x31af99[_0x8b21('0x4')]]=_[_0x8b21('0x17')](dials[_0x31af99[_0x8b21('0x4')]],_0x31af99);dials[_0x31af99[_0x8b21('0x4')]][_0x8b21('0x1c')]=utils[_0x8b21('0x19')]();dials[_0x31af99['uniqueid']]['lastevent']=_0x8b21('0x1d');}}}catch(_0x5df7e7){utils['error'](_0x5df7e7[_0x8b21('0x10')]);}};exports[_0x8b21('0x1e')]=function(_0x2f7f45){try{if(!_['isNil'](dials[_0x2f7f45[_0x8b21('0x4')]])){dials[_0x2f7f45[_0x8b21('0x4')]]=_['assign'](dials[_0x2f7f45[_0x8b21('0x4')]],{'endtime':utils[_0x8b21('0x19')](),'lastevent':_0x8b21('0x1f')});dials[_0x2f7f45[_0x8b21('0x4')]][_0x8b21('0x20')]=utils[_0x8b21('0x21')](dials[_0x2f7f45[_0x8b21('0x4')]]['endtime'],dials[_0x2f7f45[_0x8b21('0x4')]]['starttime']);dials[_0x2f7f45['uniqueid']][_0x8b21('0x22')]=utils[_0x8b21('0x21')](dials[_0x2f7f45['uniqueid']][_0x8b21('0x1c')]||dials[_0x2f7f45[_0x8b21('0x4')]][_0x8b21('0x23')],dials[_0x2f7f45['uniqueid']][_0x8b21('0x18')]);dials[_0x2f7f45[_0x8b21('0x4')]][_0x8b21('0x24')]=dials[_0x2f7f45['uniqueid']]['answertime']?utils[_0x8b21('0x21')](dials[_0x2f7f45['uniqueid']][_0x8b21('0x23')],dials[_0x2f7f45[_0x8b21('0x4')]]['answertime']):0x0;writeDB(dials[_0x2f7f45[_0x8b21('0x4')]]);}}catch(_0x5c824e){utils['error'](_0x5c824e[_0x8b21('0x10')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ccdadf9..96b48b9 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 _0xa961=['./utils','asterisk','username','password','xdr','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager'];(function(_0x591d41,_0x171f7b){var _0x527850=function(_0x5777e2){while(--_0x5777e2){_0x591d41['push'](_0x591d41['shift']());}};_0x527850(++_0x171f7b);}(_0xa961,0x13f));var _0x1a96=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xa961[_0x513aa5];return _0x1a1a7c;};var AsteriskManager=require(_0x1a96('0x0'));var config=require('../../config/environment');var utils=require(_0x1a96('0x1'));var ami=new AsteriskManager(config['asterisk']['port'],config[_0x1a96('0x2')]['ip'],config[_0x1a96('0x2')][_0x1a96('0x3')],config[_0x1a96('0x2')][_0x1a96('0x4')],!![]);ami['keepConnected']();if(config[_0x1a96('0x5')]&&config['xdr']['disabled']){utils['info'](_0x1a96('0x6'));}else{var agents=require(_0x1a96('0x7'));var calls=require(_0x1a96('0x8'));var queues=require(_0x1a96('0x9'));var recordings=require(_0x1a96('0xa'));var members=require(_0x1a96('0xb'));var dials=require('./dials.controller');var transfers=require(_0x1a96('0xc'));var core=require(_0x1a96('0xd'));ami['on'](_0x1a96('0xe'),core[_0x1a96('0xe')]);ami['on'](_0x1a96('0xf'),core['shutdown']);ami['on'](_0x1a96('0x10'),core[_0x1a96('0x10')]);ami['on'](_0x1a96('0x11'),core[_0x1a96('0x11')]);ami['on'](_0x1a96('0x12'),core[_0x1a96('0x12')]);ami['on'](_0x1a96('0x13'),core[_0x1a96('0x13')]);ami['on'](_0x1a96('0x14'),function(_0x5a5bff){try{members['devicestatechange'](_0x5a5bff);}catch(_0x57e89f){utils[_0x1a96('0x11')](_0x57e89f);}});ami['on'](_0x1a96('0x15'),function(_0x5753ca){try{agents['agentcalled'](_0x5753ca);}catch(_0x3622fc){utils[_0x1a96('0x11')](_0x3622fc);}});ami['on'](_0x1a96('0x16'),function(_0x7a6cb1){try{agents['agentringnoanswer'](_0x7a6cb1);}catch(_0x2d7531){utils[_0x1a96('0x11')](_0x2d7531);}});ami['on'](_0x1a96('0x17'),function(_0xb23387){try{agents[_0x1a96('0x17')](_0xb23387);queues[_0x1a96('0x17')](_0xb23387);}catch(_0x371bd8){utils[_0x1a96('0x11')](_0x371bd8);}});ami['on']('agentcomplete',function(_0x280b38){try{agents[_0x1a96('0x18')](_0x280b38);queues['agentcomplete'](_0x280b38);members['agentcomplete'](_0x280b38);}catch(_0x231aba){utils[_0x1a96('0x11')](_0x231aba);}});ami['on'](_0x1a96('0x19'),function(_0x1b957c){try{agents[_0x1a96('0x19')](_0x1b957c);queues[_0x1a96('0x19')](_0x1b957c);}catch(_0x564d26){utils[_0x1a96('0x11')](_0x564d26);}});ami['on']('queuecallerjoin',function(_0x295c23){try{queues[_0x1a96('0x1a')](_0x295c23);recordings[_0x1a96('0x1a')](_0x295c23);}catch(_0x577f25){utils[_0x1a96('0x11')](_0x577f25);}});ami['on'](_0x1a96('0x1b'),function(_0x3fe939){try{queues[_0x1a96('0x1b')](_0x3fe939);}catch(_0x2532d7){utils['error'](_0x2532d7);}});ami['on'](_0x1a96('0x1c'),function(_0xaeac04){try{queues[_0x1a96('0x1c')](_0xaeac04);calls[_0x1a96('0x1c')](_0xaeac04);}catch(_0x5e2abf){utils[_0x1a96('0x11')](_0x5e2abf);}});ami['on'](_0x1a96('0x1d'),function(_0x5e3fe0){try{queues[_0x1a96('0x1d')](_0x5e3fe0);calls[_0x1a96('0x1d')](_0x5e3fe0);}catch(_0x7806b0){utils['error'](_0x7806b0);}});ami['on'](_0x1a96('0x1e'),function(_0x535b82){try{calls[_0x1a96('0x1e')](_0x535b82);recordings[_0x1a96('0x1e')](_0x535b82);}catch(_0x2bb820){utils[_0x1a96('0x11')](_0x2bb820);}});ami['on'](_0x1a96('0x1f'),function(_0x100f36){try{calls[_0x1a96('0x1f')](_0x100f36);recordings['hangup'](_0x100f36);dials['hangup'](_0x100f36);agents[_0x1a96('0x1f')](_0x100f36);queues[_0x1a96('0x1f')](_0x100f36);}catch(_0x9849a9){utils['error'](_0x9849a9);}});ami['on'](_0x1a96('0x20'),function(_0x248ea9){try{members[_0x1a96('0x20')](_0x248ea9);}catch(_0x36dc6f){utils[_0x1a96('0x11')](_0x36dc6f);}});ami['on'](_0x1a96('0x21'),function(_0xe45cd5){try{queues[_0x1a96('0x21')](_0xe45cd5);agents[_0x1a96('0x21')](_0xe45cd5);transfers['blindtransfer'](_0xe45cd5);}catch(_0x27d153){utils[_0x1a96('0x11')](_0x27d153);}});ami['on'](_0x1a96('0x22'),function(_0x3a9b18){try{queues['attendedtransfer'](_0x3a9b18);transfers[_0x1a96('0x22')](_0x3a9b18);agents[_0x1a96('0x22')](_0x3a9b18);calls[_0x1a96('0x22')](_0x3a9b18);}catch(_0x3ce67a){utils[_0x1a96('0x11')](_0x3ce67a);}});ami['on'](_0x1a96('0x23'),function(_0x12ed28){try{queues[_0x1a96('0x23')](_0x12ed28);recordings[_0x1a96('0x23')](_0x12ed28);calls['varset'](_0x12ed28);dials[_0x1a96('0x23')](_0x12ed28);}catch(_0x849850){utils[_0x1a96('0x11')](_0x849850);}});ami['on'](_0x1a96('0x24'),function(_0x35cf1c){try{calls[_0x1a96('0x24')](_0x35cf1c);recordings['newexten'](_0x35cf1c);dials[_0x1a96('0x24')](_0x35cf1c);}catch(_0x22253d){utils[_0x1a96('0x11')](_0x22253d);}});ami['on'](_0x1a96('0x25'),function(_0x1909a6){try{calls[_0x1a96('0x25')](_0x1909a6);recordings[_0x1a96('0x25')](_0x1909a6);}catch(_0x4f29dc){utils['error'](_0x4f29dc);}});ami['on'](_0x1a96('0x26'),function(_0x45c113){try{dials[_0x1a96('0x26')](_0x45c113);}catch(_0x5418aa){utils['error'](_0x5418aa);}});ami['on'](_0x1a96('0x27'),function(_0x33f059){try{dials[_0x1a96('0x27')](_0x33f059);}catch(_0x19e766){utils['error'](_0x19e766);}});} \ No newline at end of file +var _0x784a=['XDR\x20DISABLED','./agents.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','username','password','xdr','disabled','info'];(function(_0x27e232,_0x56bbcd){var _0x46a044=function(_0x4d7936){while(--_0x4d7936){_0x27e232['push'](_0x27e232['shift']());}};_0x46a044(++_0x56bbcd);}(_0x784a,0xe1));var _0xa784=function(_0x4565eb,_0x167f79){_0x4565eb=_0x4565eb-0x0;var _0x67832=_0x784a[_0x4565eb];return _0x67832;};var AsteriskManager=require(_0xa784('0x0'));var config=require(_0xa784('0x1'));var utils=require(_0xa784('0x2'));var ami=new AsteriskManager(config[_0xa784('0x3')]['port'],config[_0xa784('0x3')]['ip'],config[_0xa784('0x3')][_0xa784('0x4')],config[_0xa784('0x3')][_0xa784('0x5')],!![]);ami['keepConnected']();if(config[_0xa784('0x6')]&&config['xdr'][_0xa784('0x7')]){utils[_0xa784('0x8')](_0xa784('0x9'));}else{var agents=require(_0xa784('0xa'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xa784('0xb'));var transfers=require('./transfers.controller');var core=require(_0xa784('0xc'));ami['on'](_0xa784('0xd'),core['connect']);ami['on'](_0xa784('0xe'),core['shutdown']);ami['on']('fullybooted',core[_0xa784('0xf')]);ami['on'](_0xa784('0x10'),core[_0xa784('0x10')]);ami['on'](_0xa784('0x11'),core['close']);ami['on'](_0xa784('0x12'),core[_0xa784('0x12')]);ami['on'](_0xa784('0x13'),function(_0x5c5971){try{members[_0xa784('0x13')](_0x5c5971);}catch(_0x4c0fc1){utils[_0xa784('0x10')](_0x4c0fc1);}});ami['on'](_0xa784('0x14'),function(_0x89945c){try{agents['agentcalled'](_0x89945c);}catch(_0x4c6838){utils[_0xa784('0x10')](_0x4c6838);}});ami['on'](_0xa784('0x15'),function(_0x53e794){try{agents['agentringnoanswer'](_0x53e794);}catch(_0x1f512e){utils[_0xa784('0x10')](_0x1f512e);}});ami['on']('agentconnect',function(_0x18bfdb){try{agents[_0xa784('0x16')](_0x18bfdb);queues[_0xa784('0x16')](_0x18bfdb);}catch(_0x5b5ce2){utils['error'](_0x5b5ce2);}});ami['on'](_0xa784('0x17'),function(_0x35e2f8){try{agents[_0xa784('0x17')](_0x35e2f8);queues[_0xa784('0x17')](_0x35e2f8);members[_0xa784('0x17')](_0x35e2f8);}catch(_0x2bd540){utils[_0xa784('0x10')](_0x2bd540);}});ami['on'](_0xa784('0x18'),function(_0x233c42){try{agents[_0xa784('0x18')](_0x233c42);queues[_0xa784('0x18')](_0x233c42);}catch(_0x5bc821){utils[_0xa784('0x10')](_0x5bc821);}});ami['on']('queuecallerjoin',function(_0x9fedcb){try{queues[_0xa784('0x19')](_0x9fedcb);recordings['queuecallerjoin'](_0x9fedcb);}catch(_0x574fdf){utils[_0xa784('0x10')](_0x574fdf);}});ami['on'](_0xa784('0x1a'),function(_0x197bd9){try{queues[_0xa784('0x1a')](_0x197bd9);}catch(_0x320e31){utils[_0xa784('0x10')](_0x320e31);}});ami['on'](_0xa784('0x1b'),function(_0x4fcef8){try{queues[_0xa784('0x1b')](_0x4fcef8);calls[_0xa784('0x1b')](_0x4fcef8);}catch(_0x2c66cf){utils[_0xa784('0x10')](_0x2c66cf);}});ami['on'](_0xa784('0x1c'),function(_0xf8a46d){try{queues[_0xa784('0x1c')](_0xf8a46d);calls[_0xa784('0x1c')](_0xf8a46d);}catch(_0x210a7a){utils['error'](_0x210a7a);}});ami['on'](_0xa784('0x1d'),function(_0x3436be){try{calls['newstate'](_0x3436be);recordings[_0xa784('0x1d')](_0x3436be);}catch(_0x249e32){utils[_0xa784('0x10')](_0x249e32);}});ami['on'](_0xa784('0x1e'),function(_0x2beda8){try{calls[_0xa784('0x1e')](_0x2beda8);recordings[_0xa784('0x1e')](_0x2beda8);dials[_0xa784('0x1e')](_0x2beda8);agents[_0xa784('0x1e')](_0x2beda8);queues[_0xa784('0x1e')](_0x2beda8);}catch(_0x33cbfe){utils['error'](_0x33cbfe);}});ami['on'](_0xa784('0x1f'),function(_0x4d3c9d){try{members['cdr'](_0x4d3c9d);}catch(_0x4d5d45){utils[_0xa784('0x10')](_0x4d5d45);}});ami['on'](_0xa784('0x20'),function(_0x5dd8d5){try{queues[_0xa784('0x20')](_0x5dd8d5);agents['blindtransfer'](_0x5dd8d5);transfers[_0xa784('0x20')](_0x5dd8d5);}catch(_0x482f0d){utils[_0xa784('0x10')](_0x482f0d);}});ami['on'](_0xa784('0x21'),function(_0x292d5b){try{queues[_0xa784('0x21')](_0x292d5b);transfers[_0xa784('0x21')](_0x292d5b);agents['attendedtransfer'](_0x292d5b);calls['attendedtransfer'](_0x292d5b);}catch(_0x1230e1){utils['error'](_0x1230e1);}});ami['on'](_0xa784('0x22'),function(_0x38cfcf){try{queues[_0xa784('0x22')](_0x38cfcf);recordings[_0xa784('0x22')](_0x38cfcf);calls[_0xa784('0x22')](_0x38cfcf);dials[_0xa784('0x22')](_0x38cfcf);}catch(_0x257839){utils['error'](_0x257839);}});ami['on'](_0xa784('0x23'),function(_0x51fdbc){try{calls['newexten'](_0x51fdbc);recordings[_0xa784('0x23')](_0x51fdbc);dials[_0xa784('0x23')](_0x51fdbc);}catch(_0xa5dd3d){utils[_0xa784('0x10')](_0xa5dd3d);}});ami['on']('newchannel',function(_0xf1fe32){try{calls[_0xa784('0x24')](_0xf1fe32);recordings[_0xa784('0x24')](_0xf1fe32);}catch(_0x442cf8){utils[_0xa784('0x10')](_0x442cf8);}});ami['on'](_0xa784('0x25'),function(_0x386e71){try{dials['dialbegin'](_0x386e71);}catch(_0x288288){utils[_0xa784('0x10')](_0x288288);}});ami['on']('dialend',function(_0x132a51){try{dials[_0xa784('0x26')](_0x132a51);}catch(_0x3fd5f0){utils[_0xa784('0x10')](_0x3fd5f0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index fdd6844..b5c3bcc 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 _0xaff3=['lodash','util','./utils','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','startsWith','state','INUSE','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','cdr','assign','data1','source','destinationchannel','data3','destination'];(function(_0x5b7100,_0xd698d5){var _0x45dcba=function(_0x1905e2){while(--_0x1905e2){_0x5b7100['push'](_0x5b7100['shift']());}};_0x45dcba(++_0xd698d5);}(_0xaff3,0x134));var _0x3aff=function(_0x1e0b6e,_0x3f92bd){_0x1e0b6e=_0x1e0b6e-0x0;var _0x1c1eae=_0xaff3[_0x1e0b6e];return _0x1c1eae;};'use strict';var _=require(_0x3aff('0x0'));var util=require(_0x3aff('0x1'));var utils=require(_0x3aff('0x2'));var members={};var exclude=[_0x3aff('0x3'),_0x3aff('0x4')];function writeDB(_0x52da1b){utils[_0x3aff('0x5')](util['format'](_0x3aff('0x6'),_0x52da1b[_0x3aff('0x7')],_0x52da1b[_0x3aff('0x8')],_0x52da1b[_0x3aff('0x9')],_0x52da1b[_0x3aff('0xa')],_0x52da1b[_0x3aff('0xb')],_0x52da1b[_0x3aff('0xc')]));if(_0x52da1b[_0x3aff('0x8')]){utils['getUserByInterface'](_0x52da1b[_0x3aff('0x8')])[_0x3aff('0xd')](function(_0x423010){if(_0x423010){_0x52da1b[_0x3aff('0xb')]=_0x423010[_0x3aff('0xe')];_0x52da1b[_0x3aff('0xf')]=_0x423010['internal'];utils[_0x3aff('0x10')](_0x3aff('0x11'),_0x52da1b);}else{utils[_0x3aff('0x12')](_0x52da1b[_0x3aff('0x8')][_0x3aff('0x13')]('/')[0x1])[_0x3aff('0xd')](function(_0x4a5d02){if(_0x4a5d02){_0x52da1b[_0x3aff('0xb')]=_0x4a5d02[_0x3aff('0xe')];_0x52da1b[_0x3aff('0xf')]=_0x4a5d02[_0x3aff('0xf')];utils[_0x3aff('0x10')](_0x3aff('0x11'),_0x52da1b);}});}})[_0x3aff('0x14')](function(_0xcca1c7){utils['error'](_0xcca1c7);});}delete members[_0x52da1b[_0x3aff('0x8')]];}function startsWith(_0x321a44,_0x5dd229){return _['some'](_0x321a44,function(_0x28e34c){return _[_0x3aff('0x15')](_0x5dd229,_0x28e34c);});}exports['devicestatechange']=function(_0x86a45c){switch(_0x86a45c[_0x3aff('0x16')]){case _0x3aff('0x17'):case _0x3aff('0x18'):if(!startsWith(exclude,_0x86a45c['device'])){members[_0x86a45c[_0x3aff('0x19')]]={'channel':_0x3aff('0x1a'),'interface':_0x86a45c['device'],'type':_0x3aff('0x1b'),'enterAt':utils[_0x3aff('0x1c')](),'role':_0x3aff('0x1d')};}break;case _0x3aff('0x1e'):if(!_[_0x3aff('0x1f')](members[_0x86a45c['device']])){members[_0x86a45c[_0x3aff('0x19')]]['exitAt']=utils[_0x3aff('0x1c')]();members[_0x86a45c[_0x3aff('0x19')]][_0x3aff('0x20')]=utils[_0x3aff('0x21')](members[_0x86a45c[_0x3aff('0x19')]][_0x3aff('0x22')],members[_0x86a45c[_0x3aff('0x19')]][_0x3aff('0x23')]);if(members[_0x86a45c['device']][_0x3aff('0x7')]){writeDB(members[_0x86a45c['device']]);}}default:break;}};exports[_0x3aff('0x24')]=function(_0x2f3bdd){if(!_[_0x3aff('0x1f')](members[_0x2f3bdd[_0x3aff('0x8')]])){members[_0x2f3bdd['interface']]=_['assign'](members[_0x2f3bdd['interface']],{'data4':_0x2f3bdd['queue'],'uniqueid':_0x2f3bdd[_0x3aff('0x7')]});}};exports[_0x3aff('0x25')]=function(_0x1b63e1){if(_0x1b63e1[_0x3aff('0x9')]){var _0x571c4a=_0x1b63e1[_0x3aff('0x9')][_0x3aff('0x13')]('-')[0x0];if(!_[_0x3aff('0x1f')](members[_0x571c4a])){members[_0x571c4a]=_[_0x3aff('0x26')](members[_0x571c4a],{'data1':members[_0x571c4a][_0x3aff('0x27')]||_0x1b63e1[_0x3aff('0xc')],'data2':members[_0x571c4a][_0x3aff('0xa')]||_0x1b63e1[_0x3aff('0x28')],'data3':members[_0x571c4a]['data3']||_0x1b63e1['destination'],'uniqueid':members[_0x571c4a][_0x3aff('0x7')]||_0x1b63e1[_0x3aff('0x7')]});if(members[_0x571c4a][_0x3aff('0x22')]){writeDB(members[_0x571c4a]);}}}if(_0x1b63e1[_0x3aff('0x29')]){var _0x2a46e3=_0x1b63e1[_0x3aff('0x29')][_0x3aff('0x13')]('-')[0x0];if(!_[_0x3aff('0x1f')](members[_0x2a46e3])){members[_0x2a46e3]=_[_0x3aff('0x26')](members[_0x2a46e3],{'data1':members[_0x2a46e3][_0x3aff('0x27')]||_0x1b63e1[_0x3aff('0xc')],'data2':members[_0x2a46e3]['data2']||_0x1b63e1['source'],'data3':members[_0x2a46e3][_0x3aff('0x2a')]||_0x1b63e1[_0x3aff('0x2b')],'uniqueid':members[_0x2a46e3]['uniqueid']||_0x1b63e1[_0x3aff('0x7')]});if(members[_0x2a46e3][_0x3aff('0x22')]){writeDB(members[_0x2a46e3]);}}}}; \ No newline at end of file +var _0x0b27=['isNil','exitAt','now','duration','enterAt','agentcomplete','cdr','split','assign','data1','source','destination','destinationchannel','type','data3','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','channel','data2','interface','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','catch','error','startsWith','devicestatechange','state','INUSE','BUSY','device','voice','agent','NOT_INUSE'];(function(_0x12b40a,_0x2a06ae){var _0x4e549c=function(_0x1efd71){while(--_0x1efd71){_0x12b40a['push'](_0x12b40a['shift']());}};_0x4e549c(++_0x2a06ae);}(_0x0b27,0x1ad));var _0x70b2=function(_0x446f15,_0xffa7bf){_0x446f15=_0x446f15-0x0;var _0x2e9a23=_0x0b27[_0x446f15];return _0x2e9a23;};'use strict';var _=require(_0x70b2('0x0'));var util=require(_0x70b2('0x1'));var utils=require(_0x70b2('0x2'));var members={};var exclude=[_0x70b2('0x3'),_0x70b2('0x4')];function writeDB(_0x5ec74f){utils[_0x70b2('0x5')](util[_0x70b2('0x6')](_0x70b2('0x7'),_0x5ec74f[_0x70b2('0x8')],_0x5ec74f['interface'],_0x5ec74f[_0x70b2('0x9')],_0x5ec74f[_0x70b2('0xa')],_0x5ec74f['membername'],_0x5ec74f['type']));if(_0x5ec74f[_0x70b2('0xb')]){utils[_0x70b2('0xc')](_0x5ec74f[_0x70b2('0xb')])[_0x70b2('0xd')](function(_0x3c5046){if(_0x3c5046){_0x5ec74f[_0x70b2('0xe')]=_0x3c5046[_0x70b2('0xf')];_0x5ec74f[_0x70b2('0x10')]=_0x3c5046[_0x70b2('0x10')];utils[_0x70b2('0x11')](_0x70b2('0x12'),_0x5ec74f);}else{utils[_0x70b2('0x13')](_0x5ec74f[_0x70b2('0xb')]['split']('/')[0x1])['then'](function(_0x5e26c6){if(_0x5e26c6){_0x5ec74f['membername']=_0x5e26c6[_0x70b2('0xf')];_0x5ec74f[_0x70b2('0x10')]=_0x5e26c6[_0x70b2('0x10')];utils[_0x70b2('0x11')](_0x70b2('0x12'),_0x5ec74f);}});}})[_0x70b2('0x14')](function(_0x4e67d1){utils[_0x70b2('0x15')](_0x4e67d1);});}delete members[_0x5ec74f[_0x70b2('0xb')]];}function startsWith(_0x5a22c2,_0x1415e3){return _['some'](_0x5a22c2,function(_0x2e40b6){return _[_0x70b2('0x16')](_0x1415e3,_0x2e40b6);});}exports[_0x70b2('0x17')]=function(_0x57fc19){switch(_0x57fc19[_0x70b2('0x18')]){case _0x70b2('0x19'):case _0x70b2('0x1a'):if(!startsWith(exclude,_0x57fc19[_0x70b2('0x1b')])){members[_0x57fc19['device']]={'channel':_0x70b2('0x1c'),'interface':_0x57fc19[_0x70b2('0x1b')],'type':'TALKING','enterAt':utils['now'](),'role':_0x70b2('0x1d')};}break;case _0x70b2('0x1e'):if(!_[_0x70b2('0x1f')](members[_0x57fc19['device']])){members[_0x57fc19[_0x70b2('0x1b')]][_0x70b2('0x20')]=utils[_0x70b2('0x21')]();members[_0x57fc19['device']][_0x70b2('0x22')]=utils['diffTime'](members[_0x57fc19[_0x70b2('0x1b')]][_0x70b2('0x20')],members[_0x57fc19['device']][_0x70b2('0x23')]);if(members[_0x57fc19['device']][_0x70b2('0x8')]){writeDB(members[_0x57fc19['device']]);}}default:break;}};exports[_0x70b2('0x24')]=function(_0x580326){if(!_[_0x70b2('0x1f')](members[_0x580326['interface']])){members[_0x580326[_0x70b2('0xb')]]=_['assign'](members[_0x580326['interface']],{'data4':_0x580326['queue'],'uniqueid':_0x580326[_0x70b2('0x8')]});}};exports[_0x70b2('0x25')]=function(_0x22f511){if(_0x22f511[_0x70b2('0x9')]){var _0xe5fc6f=_0x22f511['channel'][_0x70b2('0x26')]('-')[0x0];if(!_[_0x70b2('0x1f')](members[_0xe5fc6f])){members[_0xe5fc6f]=_[_0x70b2('0x27')](members[_0xe5fc6f],{'data1':members[_0xe5fc6f][_0x70b2('0x28')]||_0x22f511['type'],'data2':members[_0xe5fc6f]['data2']||_0x22f511[_0x70b2('0x29')],'data3':members[_0xe5fc6f]['data3']||_0x22f511[_0x70b2('0x2a')],'uniqueid':members[_0xe5fc6f]['uniqueid']||_0x22f511[_0x70b2('0x8')]});if(members[_0xe5fc6f]['exitAt']){writeDB(members[_0xe5fc6f]);}}}if(_0x22f511['destinationchannel']){var _0x30c2ae=_0x22f511[_0x70b2('0x2b')][_0x70b2('0x26')]('-')[0x0];if(!_['isNil'](members[_0x30c2ae])){members[_0x30c2ae]=_[_0x70b2('0x27')](members[_0x30c2ae],{'data1':members[_0x30c2ae][_0x70b2('0x28')]||_0x22f511[_0x70b2('0x2c')],'data2':members[_0x30c2ae][_0x70b2('0xa')]||_0x22f511['source'],'data3':members[_0x30c2ae][_0x70b2('0x2d')]||_0x22f511[_0x70b2('0x2a')],'uniqueid':members[_0x30c2ae][_0x70b2('0x8')]||_0x22f511[_0x70b2('0x8')]});if(members[_0x30c2ae]['exitAt']){writeDB(members[_0x30c2ae]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 438a3ce..b8bd5ac 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 _0xe29c=['queuecallerexitreason','value','toUpperCase','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','count','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','membername','agentcomplete','reason','transfer','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','queuecallerjoinAt','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','util','./utils','info','format','channel','lastAssignedTo','calleridnum','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','position','now','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','varset','isNil','queuecallerabandonAt','queuecallerexitAt'];(function(_0xc556ac,_0x4a4ae1){var _0x2c7d01=function(_0x266fdc){while(--_0x266fdc){_0xc556ac['push'](_0xc556ac['shift']());}};_0x2c7d01(++_0x4a4ae1);}(_0xe29c,0x160));var _0xce29=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe29c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xce29('0x0'));var utils=require(_0xce29('0x1'));var queues={};function writeDB(_0x1fd91b){utils[_0xce29('0x2')](util[_0xce29('0x3')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x1fd91b['uniqueid'],_0x1fd91b[_0xce29('0x4')],_0x1fd91b['queue'],_0x1fd91b[_0xce29('0x5')],_0x1fd91b[_0xce29('0x6')],_0x1fd91b['accountcode'],_0x1fd91b['queuecallerexitreason']));if(_0x1fd91b[_0xce29('0x7')]){utils[_0xce29('0x8')](_0x1fd91b[_0xce29('0x7')])[_0xce29('0x9')](function(_0x5901da){if(_0x5901da){_0x1fd91b['type']=_0x5901da[_0xce29('0xa')];}utils['request'](_0xce29('0xb'),_0x1fd91b);});}else{utils[_0xce29('0xc')](_0xce29('0xb'),_0x1fd91b);}if(_0x1fd91b[_0xce29('0xd')]){delete queues[_0x1fd91b['transfereduniqueid']];}else{delete queues[_0x1fd91b[_0xce29('0xe')]];}}exports[_0xce29('0xf')]=function(_0x7b7d7c){queues[_0x7b7d7c[_0xce29('0xe')]]=_['assign'](_0x7b7d7c,{'originalposition':_0x7b7d7c[_0xce29('0x10')],'queuecallerjoinAt':utils[_0xce29('0x11')](),'mohtime':0x0});};exports['hangup']=function(_0x314aa9){if(!_['isNil'](queues[_0x314aa9[_0xce29('0xe')]])){if(queues[_0x314aa9[_0xce29('0xe')]][_0xce29('0x12')]){if(!queues[_0x314aa9[_0xce29('0xe')]][_0xce29('0x13')]&&!queues[_0x314aa9['uniqueid']][_0xce29('0x14')]){queues[_0x314aa9[_0xce29('0xe')]][_0xce29('0x15')]=!![];queues[_0x314aa9[_0xce29('0xe')]][_0xce29('0x16')]=utils[_0xce29('0x11')]();queues[_0x314aa9[_0xce29('0xe')]]['queuecallerexitreason']=_0xce29('0x17');}writeDB(queues[_0x314aa9['uniqueid']]);}else{if(queues[_0x314aa9[_0xce29('0xe')]][_0xce29('0xd')]){queues[queues[_0x314aa9['uniqueid']][_0xce29('0xd')]]=queues[_0x314aa9[_0xce29('0xe')]];queues[queues[_0x314aa9['uniqueid']][_0xce29('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x314aa9[_0xce29('0xe')]];}}}};exports[_0xce29('0x18')]=function(_0x3bb96c){if(!_['isNil'](_0x3bb96c['variable']['queuestatus'])&&_0x3bb96c['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0xce29('0x19')](queues[_0x3bb96c[_0xce29('0xe')]])){queues[_0x3bb96c[_0xce29('0xe')]][_0xce29('0x13')]=![];queues[_0x3bb96c[_0xce29('0xe')]][_0xce29('0x1a')]=null;queues[_0x3bb96c[_0xce29('0xe')]][_0xce29('0x14')]=!![];queues[_0x3bb96c[_0xce29('0xe')]][_0xce29('0x1b')]=utils[_0xce29('0x11')]();queues[_0x3bb96c[_0xce29('0xe')]][_0xce29('0x1c')]=_0x3bb96c[_0xce29('0x1d')][_0xce29('0x1e')]();writeDB(queues[_0x3bb96c[_0xce29('0xe')]]);}}else if(!_[_0xce29('0x19')](_0x3bb96c['variable'][_0xce29('0x1f')])){if(!_[_0xce29('0x19')](queues[_0x3bb96c['uniqueid']])&&!queues[_0x3bb96c[_0xce29('0xe')]]['queuecallerabandon']){queues[_0x3bb96c['uniqueid']][_0xce29('0x13')]=![];queues[_0x3bb96c[_0xce29('0xe')]][_0xce29('0x1a')]=null;queues[_0x3bb96c[_0xce29('0xe')]][_0xce29('0x14')]=!![];queues[_0x3bb96c[_0xce29('0xe')]]['queuecallerexitAt']=utils[_0xce29('0x11')]();queues[_0x3bb96c[_0xce29('0xe')]]['queuecallerexitreason']=_0xce29('0x20');}}};exports[_0xce29('0x13')]=function(_0x365ece){if(!_['isNil'](queues[_0x365ece[_0xce29('0xe')]])){queues[_0x365ece['uniqueid']]['queuecallerexit']=![];queues[_0x365ece['uniqueid']][_0xce29('0x1b')]=null;queues[_0x365ece[_0xce29('0xe')]][_0xce29('0x13')]=!![];queues[_0x365ece[_0xce29('0xe')]][_0xce29('0x1a')]=utils[_0xce29('0x11')]();queues[_0x365ece[_0xce29('0xe')]]['queuecallerexitreason']=_0xce29('0x21');}};exports[_0xce29('0x22')]=function(_0x2f31fa){if(!_[_0xce29('0x19')](queues[_0x2f31fa[_0xce29('0xe')]])){queues[_0x2f31fa[_0xce29('0xe')]][_0xce29('0x22')]=!![];queues[_0x2f31fa[_0xce29('0xe')]][_0xce29('0x12')]=utils[_0xce29('0x11')]();queues[_0x2f31fa['uniqueid']][_0xce29('0x23')]=utils[_0xce29('0x24')](queues[_0x2f31fa[_0xce29('0xe')]][_0xce29('0x12')],queues[_0x2f31fa[_0xce29('0xe')]]['queuecallerjoinAt']);queues[_0x2f31fa['uniqueid']]['position']=_0x2f31fa[_0xce29('0x10')];queues[_0x2f31fa['uniqueid']][_0xce29('0x25')]=_0x2f31fa[_0xce29('0x25')];queues[_0x2f31fa[_0xce29('0xe')]]['connectedlinenum']=_0x2f31fa[_0xce29('0x26')];queues[_0x2f31fa[_0xce29('0xe')]][_0xce29('0x27')]=_0x2f31fa[_0xce29('0x27')];}};exports[_0xce29('0x28')]=function(_0x581fb2){if(!_[_0xce29('0x19')](queues[_0x581fb2[_0xce29('0xe')]])){queues[_0x581fb2[_0xce29('0xe')]]['queuecallerabandon']=![];queues[_0x581fb2[_0xce29('0xe')]]['queuecallerabandon']=![];queues[_0x581fb2['uniqueid']][_0xce29('0x1a')]=null;queues[_0x581fb2[_0xce29('0xe')]][_0xce29('0x14')]=![];queues[_0x581fb2[_0xce29('0xe')]][_0xce29('0x1c')]=null;queues[_0x581fb2['uniqueid']][_0xce29('0x1b')]=null;queues[_0x581fb2[_0xce29('0xe')]][_0xce29('0x29')]=!![];queues[_0x581fb2[_0xce29('0xe')]][_0xce29('0x2a')]=_0x581fb2[_0xce29('0x2b')];queues[_0x581fb2[_0xce29('0xe')]][_0xce29('0x5')]=_0x581fb2[_0xce29('0x2c')];}};exports[_0xce29('0x2d')]=function(_0x3ef597){if(!_[_0xce29('0x19')](queues[_0x3ef597[_0xce29('0xe')]])){if(queues[_0x3ef597[_0xce29('0xe')]]['queuecallerleaveAt']){queues[_0x3ef597[_0xce29('0xe')]][_0xce29('0x13')]=![];queues[_0x3ef597[_0xce29('0xe')]][_0xce29('0x13')]=![];queues[_0x3ef597[_0xce29('0xe')]][_0xce29('0x1a')]=null;queues[_0x3ef597[_0xce29('0xe')]][_0xce29('0x14')]=![];queues[_0x3ef597['uniqueid']][_0xce29('0x1b')]=null;queues[_0x3ef597[_0xce29('0xe')]][_0xce29('0x29')]=!![];queues[_0x3ef597[_0xce29('0xe')]]['lastAssignedTo']=_0x3ef597[_0xce29('0x2c')];queues[_0x3ef597[_0xce29('0xe')]][_0xce29('0x15')]=!![];queues[_0x3ef597[_0xce29('0xe')]][_0xce29('0x16')]=utils['now']();if(_0x3ef597[_0xce29('0x2e')]==_0xce29('0x2f')){if(!queues[_0x3ef597[_0xce29('0xe')]][_0xce29('0x2f')]){queues[_0x3ef597['uniqueid']][_0xce29('0x1c')]='TRANSFER';}}else{queues[_0x3ef597['uniqueid']][_0xce29('0x1c')]='COMPLETEDBY'+_0x3ef597['reason']['toUpperCase']();}writeDB(queues[_0x3ef597[_0xce29('0xe')]]);}}};exports[_0xce29('0x30')]=function(_0x42dd24){if(!_['isNil'](queues[_0x42dd24[_0xce29('0x31')]])){queues[_0x42dd24['transfereeuniqueid']][_0xce29('0x2f')]=!![];queues[_0x42dd24['transfereeuniqueid']][_0xce29('0x32')]=_0xce29('0x33');queues[_0x42dd24[_0xce29('0x31')]][_0xce29('0x34')]=_0x42dd24[_0xce29('0x35')];queues[_0x42dd24[_0xce29('0x31')]][_0xce29('0x36')]=_0x42dd24[_0xce29('0x31')];queues[_0x42dd24[_0xce29('0x31')]][_0xce29('0x1c')]=_0xce29('0x37');}};exports['attendedtransfer']=function(_0x3c52e7){try{if(_0x3c52e7['origtransfereruniqueid']==_0x3c52e7[_0xce29('0x38')]){if(!_[_0xce29('0x19')](queues[_0x3c52e7[_0xce29('0x39')]])){queues[_0x3c52e7['secondtransfererlinkedid']]['transfer']=!![];queues[_0x3c52e7[_0xce29('0x39')]][_0xce29('0x32')]=_0xce29('0x3a');queues[_0x3c52e7[_0xce29('0x39')]]['transferexten']=_0x3c52e7[_0xce29('0x3b')];queues[_0x3c52e7[_0xce29('0x39')]][_0xce29('0x36')]=_0x3c52e7['origtransfereruniqueid'];queues[_0x3c52e7[_0xce29('0x39')]][_0xce29('0x1c')]=_0xce29('0x3c');}if(!_[_0xce29('0x19')](queues[_0x3c52e7['origtransfererlinkedid']])){if(_0x3c52e7['transfereelinkedid']&&queues[_0x3c52e7[_0xce29('0x3d')]]){queues[_0x3c52e7[_0xce29('0x3d')]][_0xce29('0x3e')]=0x1;queues[_0x3c52e7[_0xce29('0x31')]]=_[_0xce29('0x3f')](queues[_0x3c52e7[_0xce29('0x3d')]]);queues[_0x3c52e7['transfereeuniqueid']][_0xce29('0xd')]=_0x3c52e7['transfertargetuniqueid'];queues[_0x3c52e7[_0xce29('0x31')]][_0xce29('0x3e')]=0x2;queues[_0x3c52e7['transfereeuniqueid']]['calleridnum']=queues[_0x3c52e7[_0xce29('0x39')]][_0xce29('0x6')];queues[_0x3c52e7[_0xce29('0x31')]][_0xce29('0x40')]=queues[_0x3c52e7[_0xce29('0x39')]][_0xce29('0x40')];queues[_0x3c52e7[_0xce29('0x31')]][_0xce29('0x41')]=utils[_0xce29('0x11')]();queues[_0x3c52e7[_0xce29('0x31')]][_0xce29('0x12')]=utils['now']();queues[_0x3c52e7[_0xce29('0x31')]]['holdtime']=0x0;queues[_0x3c52e7[_0xce29('0x31')]][_0xce29('0x42')]=0x0;}else{queues[_0x3c52e7[_0xce29('0x38')]]['transfereduniqueid']=_0x3c52e7[_0xce29('0x39')];}}}else if(_0x3c52e7[_0xce29('0x43')]==_0x3c52e7['secondtransfererlinkedid']){if(!_[_0xce29('0x19')](queues[_0x3c52e7[_0xce29('0x38')]])){queues[_0x3c52e7[_0xce29('0x38')]][_0xce29('0x2f')]=!![];queues[_0x3c52e7[_0xce29('0x38')]][_0xce29('0x32')]=_0xce29('0x3a');queues[_0x3c52e7['origtransfererlinkedid']][_0xce29('0x34')]=_0x3c52e7[_0xce29('0x44')];queues[_0x3c52e7[_0xce29('0x38')]][_0xce29('0x36')]=_0x3c52e7[_0xce29('0x43')];queues[_0x3c52e7[_0xce29('0x38')]][_0xce29('0x1c')]=_0xce29('0x3c');}if(!_['isNil'](queues[_0x3c52e7[_0xce29('0x39')]])){if(_0x3c52e7[_0xce29('0x45')]&&queues[_0x3c52e7[_0xce29('0x45')]]){queues[_0x3c52e7[_0xce29('0x45')]][_0xce29('0x3e')]=0x1;queues[_0x3c52e7[_0xce29('0x46')]]=_['clone'](queues[_0x3c52e7[_0xce29('0x45')]]);queues[_0x3c52e7[_0xce29('0x46')]][_0xce29('0xd')]=_0x3c52e7[_0xce29('0x46')];queues[_0x3c52e7[_0xce29('0x46')]][_0xce29('0x3e')]=0x2;queues[_0x3c52e7[_0xce29('0x46')]][_0xce29('0x6')]=queues[_0x3c52e7['origtransfererlinkedid']][_0xce29('0x6')];queues[_0x3c52e7[_0xce29('0x46')]][_0xce29('0x40')]=queues[_0x3c52e7['origtransfererlinkedid']][_0xce29('0x40')];queues[_0x3c52e7['transfertargetuniqueid']][_0xce29('0x41')]=utils[_0xce29('0x11')]();queues[_0x3c52e7['transfertargetuniqueid']][_0xce29('0x12')]=utils[_0xce29('0x11')]();queues[_0x3c52e7[_0xce29('0x46')]][_0xce29('0x23')]=0x0;queues[_0x3c52e7[_0xce29('0x46')]][_0xce29('0x42')]=0x0;}else{queues[_0x3c52e7[_0xce29('0x39')]][_0xce29('0xd')]=_0x3c52e7[_0xce29('0x38')];}}}}catch(_0x37a154){utils[_0xce29('0x47')](_0x37a154[_0xce29('0x48')]);}};exports[_0xce29('0x49')]=function(_0x50bace){if(!_['isNil'](queues[_0x50bace['uniqueid']])){queues[_0x50bace[_0xce29('0xe')]][_0xce29('0x4a')]=utils[_0xce29('0x11')]();}};exports[_0xce29('0x4b')]=function(_0x19628b){if(!_[_0xce29('0x19')](queues[_0x19628b[_0xce29('0xe')]])){if(!_[_0xce29('0x19')](queues[_0x19628b[_0xce29('0xe')]][_0xce29('0x4a')])){queues[_0x19628b['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xce29('0x11')](),queues[_0x19628b['uniqueid']][_0xce29('0x4a')]);delete queues[_0x19628b['uniqueid']][_0xce29('0x4a')];}}}; \ No newline at end of file +var _0x3474=['queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queuecallerexitreason','queueposition','queuecallerabandon','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinename','agentconnect','assigned','destaccountcode','membername','agentcomplete','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','transfertargetlinkedid','stack','musiconholdstart','musiconholdstartAt','lodash','util','info','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','queuecallerjoin','assign','hangup','queuecallerexit','queuecallercomplete','now','transfereduniqueid','queuecallerenterreason','varset','isNil','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3474,0x10c));var _0x4347=function(_0x413674,_0x5050d8){_0x413674=_0x413674-0x0;var _0x26be80=_0x3474[_0x413674];return _0x26be80;};'use strict';var _=require(_0x4347('0x0'));var util=require(_0x4347('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x3dedcc){utils[_0x4347('0x2')](util['format']('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x3dedcc[_0x4347('0x3')],_0x3dedcc[_0x4347('0x4')],_0x3dedcc['queue'],_0x3dedcc[_0x4347('0x5')],_0x3dedcc[_0x4347('0x6')],_0x3dedcc[_0x4347('0x7')],_0x3dedcc['queuecallerexitreason']));if(_0x3dedcc[_0x4347('0x8')]){utils[_0x4347('0x9')](_0x3dedcc['queue'])['then'](function(_0xd757b6){if(_0xd757b6){_0x3dedcc[_0x4347('0xa')]=_0xd757b6[_0x4347('0xa')];}utils[_0x4347('0xb')](_0x4347('0xc'),_0x3dedcc);});}else{utils['request'](_0x4347('0xc'),_0x3dedcc);}if(_0x3dedcc['transfereduniqueid']){delete queues[_0x3dedcc['transfereduniqueid']];}else{delete queues[_0x3dedcc[_0x4347('0x3')]];}}exports[_0x4347('0xd')]=function(_0x3ee8d4){queues[_0x3ee8d4[_0x4347('0x3')]]=_[_0x4347('0xe')](_0x3ee8d4,{'originalposition':_0x3ee8d4['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0x4347('0xf')]=function(_0x5aecd8){if(!_['isNil'](queues[_0x5aecd8[_0x4347('0x3')]])){if(queues[_0x5aecd8[_0x4347('0x3')]]['queuecallerleaveAt']){if(!queues[_0x5aecd8[_0x4347('0x3')]]['queuecallerabandon']&&!queues[_0x5aecd8[_0x4347('0x3')]][_0x4347('0x10')]){queues[_0x5aecd8['uniqueid']][_0x4347('0x11')]=!![];queues[_0x5aecd8[_0x4347('0x3')]]['queuecallercompleteAt']=utils[_0x4347('0x12')]();queues[_0x5aecd8[_0x4347('0x3')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x5aecd8[_0x4347('0x3')]]);}else{if(queues[_0x5aecd8['uniqueid']][_0x4347('0x13')]){queues[queues[_0x5aecd8[_0x4347('0x3')]][_0x4347('0x13')]]=queues[_0x5aecd8[_0x4347('0x3')]];queues[queues[_0x5aecd8[_0x4347('0x3')]][_0x4347('0x13')]][_0x4347('0x14')]=0x2;delete queues[_0x5aecd8['uniqueid']];}}}};exports[_0x4347('0x15')]=function(_0xea35cb){if(!_[_0x4347('0x16')](_0xea35cb[_0x4347('0x17')][_0x4347('0x18')])&&_0xea35cb['value'][_0x4347('0x19')]()!==_0x4347('0x1a')){if(!_[_0x4347('0x16')](queues[_0xea35cb[_0x4347('0x3')]])){queues[_0xea35cb[_0x4347('0x3')]]['queuecallerabandon']=![];queues[_0xea35cb[_0x4347('0x3')]][_0x4347('0x1b')]=null;queues[_0xea35cb[_0x4347('0x3')]]['queuecallerexit']=!![];queues[_0xea35cb[_0x4347('0x3')]][_0x4347('0x1c')]=utils['now']();queues[_0xea35cb[_0x4347('0x3')]][_0x4347('0x1d')]=_0xea35cb['value'][_0x4347('0x19')]();writeDB(queues[_0xea35cb[_0x4347('0x3')]]);}}else if(!_[_0x4347('0x16')](_0xea35cb['variable'][_0x4347('0x1e')])){if(!_[_0x4347('0x16')](queues[_0xea35cb[_0x4347('0x3')]])&&!queues[_0xea35cb[_0x4347('0x3')]][_0x4347('0x1f')]){queues[_0xea35cb['uniqueid']][_0x4347('0x1f')]=![];queues[_0xea35cb[_0x4347('0x3')]][_0x4347('0x1b')]=null;queues[_0xea35cb[_0x4347('0x3')]]['queuecallerexit']=!![];queues[_0xea35cb['uniqueid']][_0x4347('0x1c')]=utils[_0x4347('0x12')]();queues[_0xea35cb[_0x4347('0x3')]]['queuecallerexitreason']=_0x4347('0x20');}}};exports[_0x4347('0x1f')]=function(_0x216c6b){if(!_[_0x4347('0x16')](queues[_0x216c6b[_0x4347('0x3')]])){queues[_0x216c6b[_0x4347('0x3')]][_0x4347('0x10')]=![];queues[_0x216c6b[_0x4347('0x3')]][_0x4347('0x1c')]=null;queues[_0x216c6b[_0x4347('0x3')]][_0x4347('0x1f')]=!![];queues[_0x216c6b['uniqueid']]['queuecallerabandonAt']=utils['now']();queues[_0x216c6b[_0x4347('0x3')]][_0x4347('0x1d')]=_0x4347('0x21');}};exports[_0x4347('0x22')]=function(_0x5b88b7){if(!_[_0x4347('0x16')](queues[_0x5b88b7['uniqueid']])){queues[_0x5b88b7['uniqueid']][_0x4347('0x22')]=!![];queues[_0x5b88b7[_0x4347('0x3')]][_0x4347('0x23')]=utils[_0x4347('0x12')]();queues[_0x5b88b7[_0x4347('0x3')]][_0x4347('0x24')]=utils[_0x4347('0x25')](queues[_0x5b88b7['uniqueid']][_0x4347('0x23')],queues[_0x5b88b7[_0x4347('0x3')]][_0x4347('0x26')]);queues[_0x5b88b7['uniqueid']][_0x4347('0x27')]=_0x5b88b7['position'];queues[_0x5b88b7[_0x4347('0x3')]][_0x4347('0x28')]=_0x5b88b7['count'];queues[_0x5b88b7[_0x4347('0x3')]]['connectedlinenum']=_0x5b88b7['connectedlinenum'];queues[_0x5b88b7['uniqueid']][_0x4347('0x29')]=_0x5b88b7[_0x4347('0x29')];}};exports[_0x4347('0x2a')]=function(_0x57e961){if(!_[_0x4347('0x16')](queues[_0x57e961['uniqueid']])){queues[_0x57e961[_0x4347('0x3')]]['queuecallerabandon']=![];queues[_0x57e961[_0x4347('0x3')]][_0x4347('0x1f')]=![];queues[_0x57e961[_0x4347('0x3')]][_0x4347('0x1b')]=null;queues[_0x57e961[_0x4347('0x3')]][_0x4347('0x10')]=![];queues[_0x57e961['uniqueid']]['queuecallerexitreason']=null;queues[_0x57e961[_0x4347('0x3')]]['queuecallerexitAt']=null;queues[_0x57e961[_0x4347('0x3')]][_0x4347('0x2b')]=!![];queues[_0x57e961[_0x4347('0x3')]][_0x4347('0x7')]=_0x57e961[_0x4347('0x2c')];queues[_0x57e961[_0x4347('0x3')]][_0x4347('0x5')]=_0x57e961[_0x4347('0x2d')];}};exports[_0x4347('0x2e')]=function(_0x2dfcd5){if(!_['isNil'](queues[_0x2dfcd5[_0x4347('0x3')]])){if(queues[_0x2dfcd5[_0x4347('0x3')]]['queuecallerleaveAt']){queues[_0x2dfcd5[_0x4347('0x3')]][_0x4347('0x1f')]=![];queues[_0x2dfcd5[_0x4347('0x3')]][_0x4347('0x1f')]=![];queues[_0x2dfcd5[_0x4347('0x3')]][_0x4347('0x1b')]=null;queues[_0x2dfcd5[_0x4347('0x3')]][_0x4347('0x10')]=![];queues[_0x2dfcd5[_0x4347('0x3')]][_0x4347('0x1c')]=null;queues[_0x2dfcd5[_0x4347('0x3')]][_0x4347('0x2b')]=!![];queues[_0x2dfcd5[_0x4347('0x3')]][_0x4347('0x5')]=_0x2dfcd5[_0x4347('0x2d')];queues[_0x2dfcd5[_0x4347('0x3')]]['queuecallercomplete']=!![];queues[_0x2dfcd5[_0x4347('0x3')]]['queuecallercompleteAt']=utils[_0x4347('0x12')]();if(_0x2dfcd5[_0x4347('0x2f')]==_0x4347('0x30')){if(!queues[_0x2dfcd5[_0x4347('0x3')]]['transfer']){queues[_0x2dfcd5[_0x4347('0x3')]]['queuecallerexitreason']=_0x4347('0x31');}}else{queues[_0x2dfcd5['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x2dfcd5[_0x4347('0x2f')][_0x4347('0x19')]();}writeDB(queues[_0x2dfcd5[_0x4347('0x3')]]);}}};exports[_0x4347('0x32')]=function(_0x2b184f){if(!_[_0x4347('0x16')](queues[_0x2b184f[_0x4347('0x33')]])){queues[_0x2b184f['transfereeuniqueid']]['transfer']=!![];queues[_0x2b184f[_0x4347('0x33')]]['transfertype']=_0x4347('0x34');queues[_0x2b184f[_0x4347('0x33')]][_0x4347('0x35')]=_0x2b184f['extension'];queues[_0x2b184f[_0x4347('0x33')]][_0x4347('0x36')]=_0x2b184f[_0x4347('0x33')];queues[_0x2b184f['transfereeuniqueid']][_0x4347('0x1d')]=_0x4347('0x37');}};exports[_0x4347('0x38')]=function(_0x3d5bcd){try{if(_0x3d5bcd[_0x4347('0x39')]==_0x3d5bcd[_0x4347('0x3a')]){if(!_[_0x4347('0x16')](queues[_0x3d5bcd[_0x4347('0x3b')]])){queues[_0x3d5bcd['secondtransfererlinkedid']]['transfer']=!![];queues[_0x3d5bcd['secondtransfererlinkedid']][_0x4347('0x3c')]=_0x4347('0x3d');queues[_0x3d5bcd['secondtransfererlinkedid']][_0x4347('0x35')]=_0x3d5bcd[_0x4347('0x3e')];queues[_0x3d5bcd[_0x4347('0x3b')]][_0x4347('0x36')]=_0x3d5bcd[_0x4347('0x39')];queues[_0x3d5bcd[_0x4347('0x3b')]][_0x4347('0x1d')]=_0x4347('0x3f');}if(!_[_0x4347('0x16')](queues[_0x3d5bcd[_0x4347('0x3a')]])){if(_0x3d5bcd['transfereelinkedid']&&queues[_0x3d5bcd['transfereelinkedid']]){queues[_0x3d5bcd[_0x4347('0x40')]][_0x4347('0x14')]=0x1;queues[_0x3d5bcd[_0x4347('0x33')]]=_['clone'](queues[_0x3d5bcd['transfereelinkedid']]);queues[_0x3d5bcd[_0x4347('0x33')]][_0x4347('0x13')]=_0x3d5bcd[_0x4347('0x41')];queues[_0x3d5bcd[_0x4347('0x33')]]['queuecallerenterreason']=0x2;queues[_0x3d5bcd[_0x4347('0x33')]]['calleridnum']=queues[_0x3d5bcd[_0x4347('0x3b')]][_0x4347('0x6')];queues[_0x3d5bcd['transfereeuniqueid']][_0x4347('0x42')]=queues[_0x3d5bcd[_0x4347('0x3b')]][_0x4347('0x42')];queues[_0x3d5bcd[_0x4347('0x33')]][_0x4347('0x26')]=utils[_0x4347('0x12')]();queues[_0x3d5bcd[_0x4347('0x33')]]['queuecallerleaveAt']=utils['now']();queues[_0x3d5bcd[_0x4347('0x33')]][_0x4347('0x24')]=0x0;queues[_0x3d5bcd[_0x4347('0x33')]][_0x4347('0x43')]=0x0;}else{queues[_0x3d5bcd[_0x4347('0x3a')]][_0x4347('0x13')]=_0x3d5bcd['secondtransfererlinkedid'];}}}else if(_0x3d5bcd[_0x4347('0x44')]==_0x3d5bcd['secondtransfererlinkedid']){if(!_[_0x4347('0x16')](queues[_0x3d5bcd['origtransfererlinkedid']])){queues[_0x3d5bcd[_0x4347('0x3a')]][_0x4347('0x30')]=!![];queues[_0x3d5bcd[_0x4347('0x3a')]]['transfertype']=_0x4347('0x3d');queues[_0x3d5bcd[_0x4347('0x3a')]]['transferexten']=_0x3d5bcd['secondtransfererexten'];queues[_0x3d5bcd[_0x4347('0x3a')]]['transferuniqueid']=_0x3d5bcd[_0x4347('0x44')];queues[_0x3d5bcd['origtransfererlinkedid']][_0x4347('0x1d')]=_0x4347('0x3f');}if(!_[_0x4347('0x16')](queues[_0x3d5bcd[_0x4347('0x3b')]])){if(_0x3d5bcd[_0x4347('0x45')]&&queues[_0x3d5bcd['transfertargetlinkedid']]){queues[_0x3d5bcd[_0x4347('0x45')]][_0x4347('0x14')]=0x1;queues[_0x3d5bcd[_0x4347('0x41')]]=_['clone'](queues[_0x3d5bcd[_0x4347('0x45')]]);queues[_0x3d5bcd[_0x4347('0x41')]]['transfereduniqueid']=_0x3d5bcd[_0x4347('0x41')];queues[_0x3d5bcd[_0x4347('0x41')]]['queuecallerenterreason']=0x2;queues[_0x3d5bcd[_0x4347('0x41')]]['calleridnum']=queues[_0x3d5bcd[_0x4347('0x3a')]][_0x4347('0x6')];queues[_0x3d5bcd['transfertargetuniqueid']][_0x4347('0x42')]=queues[_0x3d5bcd[_0x4347('0x3a')]][_0x4347('0x42')];queues[_0x3d5bcd[_0x4347('0x41')]][_0x4347('0x26')]=utils[_0x4347('0x12')]();queues[_0x3d5bcd['transfertargetuniqueid']][_0x4347('0x23')]=utils[_0x4347('0x12')]();queues[_0x3d5bcd[_0x4347('0x41')]][_0x4347('0x24')]=0x0;queues[_0x3d5bcd['transfertargetuniqueid']][_0x4347('0x43')]=0x0;}else{queues[_0x3d5bcd[_0x4347('0x3b')]]['transfereduniqueid']=_0x3d5bcd['origtransfererlinkedid'];}}}}catch(_0x4f5ca0){utils['error'](_0x4f5ca0[_0x4347('0x46')]);}};exports[_0x4347('0x47')]=function(_0x4f4fea){if(!_[_0x4347('0x16')](queues[_0x4f4fea[_0x4347('0x3')]])){queues[_0x4f4fea[_0x4347('0x3')]][_0x4347('0x48')]=utils[_0x4347('0x12')]();}};exports['musiconholdstop']=function(_0x5cedfb){if(!_['isNil'](queues[_0x5cedfb['uniqueid']])){if(!_[_0x4347('0x16')](queues[_0x5cedfb[_0x4347('0x3')]][_0x4347('0x48')])){queues[_0x5cedfb[_0x4347('0x3')]][_0x4347('0x43')]+=utils[_0x4347('0x25')](utils[_0x4347('0x12')](),queues[_0x5cedfb[_0x4347('0x3')]][_0x4347('0x48')]);delete queues[_0x5cedfb['uniqueid']]['musiconholdstartAt'];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f9184db..8d38cac 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(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x34e8,0x12c));var _0x834e=function(_0x4f0a5f,_0x219452){_0x4f0a5f=_0x4f0a5f-0x0;var _0x23130a=_0x34e8[_0x4f0a5f];return _0x23130a;};'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 _0xcb91=['uniqueid','channelstate','transfer','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','exten','context','channel','stack','newstate','isNil'];(function(_0x29a515,_0x4bdb82){var _0x32aab8=function(_0x1aae20){while(--_0x1aae20){_0x29a515['push'](_0x29a515['shift']());}};_0x32aab8(++_0x4bdb82);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0xcb91[_0x5d07ff];return _0x5226ad;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x26fe42){utils[_0x1cb9('0x0')](_0x26fe42);if(_0x26fe42[_0x1cb9('0x1')]){utils[_0x1cb9('0x2')](_0x26fe42['accountcode'])[_0x1cb9('0x3')](function(_0x2c17b8){if(_0x2c17b8){_0x26fe42['membername']=_0x2c17b8[_0x1cb9('0x4')];_0x26fe42[_0x1cb9('0x5')]=_0x2c17b8['id'];}utils['request'](_0x1cb9('0x6'),_0x26fe42);});}else{utils[_0x1cb9('0x7')]('CreateVoiceRecording',_0x26fe42);}}exports[_0x1cb9('0x8')]=function(_0x12567c){try{if(_0x12567c['uniqueid']==_0x12567c[_0x1cb9('0x9')]){recordings[_0x12567c['uniqueid']]={'uniqueid':_0x12567c['uniqueid'],'accountcode':_0x12567c[_0x1cb9('0x1')],'exten':_0x12567c[_0x1cb9('0xa')],'context':_0x12567c[_0x1cb9('0xb')],'channel':_0x12567c[_0x1cb9('0xc')],'monitors':[]};}}catch(_0x2fc627){utils['error'](_0x2fc627[_0x1cb9('0xd')]);}};exports[_0x1cb9('0xe')]=function(_0x3af35f){try{if(!_[_0x1cb9('0xf')](recordings[_0x3af35f[_0x1cb9('0x10')]])&&_0x3af35f['channelstate']==0x6){}else if(!_['isNil'](recordings[_0x3af35f['linkedid']])&&_0x3af35f[_0x1cb9('0x11')]==0x6&&_0x3af35f[_0x1cb9('0xb')]!=_0x1cb9('0x12')){recordings[_0x3af35f[_0x1cb9('0x9')]]['accountcode']=_0x3af35f[_0x1cb9('0x1')];}}catch(_0x6ef389){utils[_0x1cb9('0x13')](_0x6ef389[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x14')]=function(_0x5806d8){try{if(!_['isNil'](_0x5806d8[_0x1cb9('0x15')])&&!_[_0x1cb9('0xf')](_0x5806d8[_0x1cb9('0x15')][_0x1cb9('0x16')])){if(_[_0x1cb9('0x17')](_0x5806d8[_0x1cb9('0x18')],_0x1cb9('0x19'))){_0x5806d8['value']=_0x5806d8['value'][_0x1cb9('0x1a')](_0x1cb9('0x19'),_0x1cb9('0x1b'));}if(recordings[_0x5806d8[_0x1cb9('0x9')]]){var _0x280a84=_[_0x1cb9('0x1c')](recordings[_0x5806d8[_0x1cb9('0x9')]]['monitors'],{'value':_0x5806d8['value']});if(_[_0x1cb9('0xf')](_0x280a84)){recordings[_0x5806d8['linkedid']][_0x1cb9('0x1d')][_0x1cb9('0x1e')]({'value':_0x5806d8['value']});}}}}catch(_0x599275){utils[_0x1cb9('0x13')](_0x599275[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x1f')]=function(_0x4601b8){try{if(!_[_0x1cb9('0xf')](recordings[_0x4601b8[_0x1cb9('0x10')]])){recordings[_0x4601b8['uniqueid']]['calleridnum']=_0x4601b8[_0x1cb9('0x20')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x21')]=_0x4601b8[_0x1cb9('0x21')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=_0x4601b8[_0x1cb9('0x22')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x23')]=_0x4601b8[_0x1cb9('0x23')];if(recordings[_0x4601b8['uniqueid']][_0x1cb9('0x24')]==_0x1cb9('0x25')&&recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')]){recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x23')]='';}recordings[_0x4601b8['uniqueid']][_0x1cb9('0x1d')]['forEach'](_0x110282=>{var _0x4efebc=_[_0x1cb9('0x26')](recordings[_0x4601b8[_0x1cb9('0x10')]]);_0x4efebc[_0x1cb9('0x18')]=_0x110282[_0x1cb9('0x18')];writeDB(_0x4efebc);});delete recordings[_0x4601b8['uniqueid']];}}catch(_0x1c701f){utils['error'](_0x1c701f[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x27')]=function(_0x4220d7){try{if(!_['isNil'](recordings[_0x4220d7[_0x1cb9('0x10')]])){if(_0x4220d7['application'][_0x1cb9('0x28')]()=='set'&&_[_0x1cb9('0x29')](_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x28')](),_0x1cb9('0x2b'))){var _0x56c3e0=_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x2c')]('=');var _0x3467d5=_0x56c3e0[0x0][_0x1cb9('0x2d')](_0x56c3e0[0x0][_0x1cb9('0x2e')]('(')+0x1,_0x56c3e0[0x0][_0x1cb9('0x2e')](')'));var _0xc6d5fd=_0x56c3e0[0x1];recordings[_0x4220d7[_0x1cb9('0x10')]][_0x3467d5]=_0xc6d5fd;}}}catch(_0x386e8b){utils[_0x1cb9('0x13')](_0x386e8b[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x2f')]=function(_0x29f149){try{if(!_['isNil'](recordings[_0x29f149['uniqueid']])){recordings[_0x29f149[_0x1cb9('0x10')]][_0x1cb9('0x30')]=_0x29f149[_0x1cb9('0x30')];}}catch(_0x29f451){utils[_0x1cb9('0x13')](_0x29f451[_0x1cb9('0xd')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b8089ad..32b2b6a 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 _0x28a0=['info','TRANSFER|%s','blindtransfer','type','blind','error','stack','attendedtransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils'];(function(_0x2de5b3,_0x43d19f){var _0x51f362=function(_0x5c2e72){while(--_0x5c2e72){_0x2de5b3['push'](_0x2de5b3['shift']());}};_0x51f362(++_0x43d19f);}(_0x28a0,0x8a));var _0x028a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x28a0[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x028a('0x0'));var util=require('util');var utils=require(_0x028a('0x1'));function writeDB(_0x270f2e){utils[_0x028a('0x2')](util['format'](_0x028a('0x3'),_0x270f2e['type']));utils['request']('CreateVoiceTransferReport',_0x270f2e);}exports[_0x028a('0x4')]=function(_0x532c5c){try{_0x532c5c[_0x028a('0x5')]=_0x028a('0x6');writeDB(_0x532c5c);}catch(_0x16436e){utils[_0x028a('0x7')](_0x16436e[_0x028a('0x8')]);}};exports[_0x028a('0x9')]=function(_0x1f48ec){try{_0x1f48ec=_['assign'](_0x1f48ec,{'transfererchannel':_0x1f48ec[_0x028a('0xa')],'transferercalleridnum':_0x1f48ec[_0x028a('0xb')],'transferercalleridname':_0x1f48ec[_0x028a('0xc')],'transfererconnectedlinenum':_0x1f48ec[_0x028a('0xd')],'transfererconnectedlinename':_0x1f48ec['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1f48ec[_0x028a('0xe')],'transferercontext':_0x1f48ec[_0x028a('0xf')],'transfererexten':_0x1f48ec[_0x028a('0x10')],'transfererlinkedid':_0x1f48ec[_0x028a('0x11')],'context':_0x1f48ec['origtransferercontext'],'extension':_0x1f48ec[_0x028a('0x12')],'type':_0x028a('0x13')});if(_[_0x028a('0x14')](_0x1f48ec[_0x028a('0x15')])){_0x1f48ec=_[_0x028a('0x16')](_0x1f48ec,{'transfereechannel':_0x1f48ec[_0x028a('0x17')],'transfereecalleridnum':_0x1f48ec['transfertargetcalleridnum'],'transfereecalleridname':_0x1f48ec[_0x028a('0x18')],'transfereeconnectedlinenum':_0x1f48ec['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1f48ec['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1f48ec[_0x028a('0x19')],'transfereecontext':_0x1f48ec[_0x028a('0x1a')],'transfereeexten':_0x1f48ec['transfertargetexten'],'transfereelinkedid':_0x1f48ec[_0x028a('0x1b')]});}writeDB(_0x1f48ec);}catch(_0xe713cc){utils[_0x028a('0x7')](_0xe713cc['stack']);}}; \ No newline at end of file +var _0x3e68=['blindtransfer','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','isNil','transfereechannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','format','TRANSFER|%s','type','request','CreateVoiceTransferReport'];(function(_0x4526bb,_0x141343){var _0x3e4238=function(_0x2f1917){while(--_0x2f1917){_0x4526bb['push'](_0x4526bb['shift']());}};_0x3e4238(++_0x141343);}(_0x3e68,0x190));var _0x83e6=function(_0x49523f,_0x4fd4f1){_0x49523f=_0x49523f-0x0;var _0x2ba445=_0x3e68[_0x49523f];return _0x2ba445;};'use strict';var _=require(_0x83e6('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0xe9d4eb){utils['info'](util[_0x83e6('0x1')](_0x83e6('0x2'),_0xe9d4eb[_0x83e6('0x3')]));utils[_0x83e6('0x4')](_0x83e6('0x5'),_0xe9d4eb);}exports[_0x83e6('0x6')]=function(_0x47ccdf){try{_0x47ccdf[_0x83e6('0x3')]=_0x83e6('0x7');writeDB(_0x47ccdf);}catch(_0x370166){utils[_0x83e6('0x8')](_0x370166[_0x83e6('0x9')]);}};exports[_0x83e6('0xa')]=function(_0x4c6b3d){try{_0x4c6b3d=_[_0x83e6('0xb')](_0x4c6b3d,{'transfererchannel':_0x4c6b3d[_0x83e6('0xc')],'transferercalleridnum':_0x4c6b3d[_0x83e6('0xd')],'transferercalleridname':_0x4c6b3d[_0x83e6('0xe')],'transfererconnectedlinenum':_0x4c6b3d[_0x83e6('0xf')],'transfererconnectedlinename':_0x4c6b3d[_0x83e6('0x10')],'transfereraccountcode':_0x4c6b3d[_0x83e6('0x11')],'transferercontext':_0x4c6b3d[_0x83e6('0x12')],'transfererexten':_0x4c6b3d[_0x83e6('0x13')],'transfererlinkedid':_0x4c6b3d[_0x83e6('0x14')],'context':_0x4c6b3d['origtransferercontext'],'extension':_0x4c6b3d['origtransfererexten'],'type':'attended'});if(_[_0x83e6('0x15')](_0x4c6b3d[_0x83e6('0x16')])){_0x4c6b3d=_[_0x83e6('0xb')](_0x4c6b3d,{'transfereechannel':_0x4c6b3d['transfertargetchannel'],'transfereecalleridnum':_0x4c6b3d[_0x83e6('0x17')],'transfereecalleridname':_0x4c6b3d[_0x83e6('0x18')],'transfereeconnectedlinenum':_0x4c6b3d[_0x83e6('0x19')],'transfereeconnectedlinename':_0x4c6b3d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4c6b3d[_0x83e6('0x1a')],'transfereecontext':_0x4c6b3d['transfertargetcontext'],'transfereeexten':_0x4c6b3d[_0x83e6('0x1b')],'transfereelinkedid':_0x4c6b3d[_0x83e6('0x1c')]});}writeDB(_0x4c6b3d);}catch(_0x13d664){utils[_0x83e6('0x8')](_0x13d664['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 02a5f6d..61c86b0 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 _0x2cff=['client','http','../../config/logger','info','debug','error','request','then','stack','name','interface','GETUSER|','result','length','NOTFOUND','catch','getVoiceQueueByName','acw','acwTimeout','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','sumTime','now','isAfter','isBefore','bluebird'];(function(_0x3ccdb0,_0x4adc30){var _0x58aa5b=function(_0x579c7a){while(--_0x579c7a){_0x3ccdb0['push'](_0x3ccdb0['shift']());}};_0x58aa5b(++_0x4adc30);}(_0x2cff,0x1ef));var _0xf2cf=function(_0x58d40f,_0x18f78d){_0x58d40f=_0x58d40f-0x0;var _0x56572c=_0x2cff[_0x58d40f];return _0x56572c;};'use strict';var jayson=require('jayson/promise');var moment=require('moment');var BPromise=require(_0xf2cf('0x0'));var client=jayson[_0xf2cf('0x1')][_0xf2cf('0x2')]({'port':0x2329});var logger=require(_0xf2cf('0x3'))('xdr');exports['info']=function(_0x16cbb7){logger[_0xf2cf('0x4')](_0x16cbb7);};exports[_0xf2cf('0x5')]=function(_0x4fc10f){logger[_0xf2cf('0x5')](JSON['stringify'](_0x4fc10f));};exports['error']=function(_0x1d4893){logger[_0xf2cf('0x6')](_0x1d4893['stack']);};exports[_0xf2cf('0x7')]=function(_0x1e0060,_0x171000){return client[_0xf2cf('0x7')](_0x1e0060,{'body':_0x171000})[_0xf2cf('0x8')](function(_0x522014){logger[_0xf2cf('0x5')](JSON['stringify'](_0x522014));})['catch'](function(_0x476004){logger[_0xf2cf('0x6')](_0x476004[_0xf2cf('0x9')]);});};function getUser(_0x2395fa){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xf2cf('0xa'),_0xf2cf('0xb')],'where':_0x2395fa,'limit':0x1}})[_0xf2cf('0x8')](function(_0x53a545){logger['info'](_0xf2cf('0xc')+JSON['stringify'](_0x2395fa)+'|'+(_0x53a545[_0xf2cf('0xd')][_0xf2cf('0xe')]?'FOUND':_0xf2cf('0xf')));return _0x53a545[_0xf2cf('0xd')][_0xf2cf('0xe')]?_0x53a545[_0xf2cf('0xd')][0x0]:null;});}exports['getUserByInternal']=function(_0x314e8a){return new BPromise(function(_0x55db7d,_0x1666b9){if(_0x314e8a){return getUser({'internal':_0x314e8a})[_0xf2cf('0x8')](function(_0x2bf4f6){return _0x55db7d(_0x2bf4f6);})['catch'](function(_0x4ac15f){logger[_0xf2cf('0x6')](_0x4ac15f[_0xf2cf('0x9')]);return _0x55db7d(null);});}else{return _0x55db7d(null);}});};exports['getUserByInterface']=function(_0x3f39e6){return new BPromise(function(_0x2c2963,_0x849183){if(_0x3f39e6){return getUser({'interface':_0x3f39e6})[_0xf2cf('0x8')](function(_0x5f4880){return _0x2c2963(_0x5f4880);})['catch'](function(_0x1c31b6){logger[_0xf2cf('0x6')](_0x1c31b6[_0xf2cf('0x9')]);return _0x2c2963(null);});}else{return _0x2c2963(null);}});};exports['getUserByName']=function(_0xdd083){return new BPromise(function(_0x189dd8,_0x20b177){if(_0xdd083){return getUser({'name':_0xdd083})[_0xf2cf('0x8')](function(_0x172106){return _0x189dd8(_0x172106);})[_0xf2cf('0x10')](function(_0x4539fd){logger[_0xf2cf('0x6')](_0x4539fd[_0xf2cf('0x9')]);return _0x189dd8(null);});}else{return _0x189dd8(null);}});};exports[_0xf2cf('0x11')]=function(_0x1088fd){return new BPromise(function(_0x55f69e,_0xaec7c7){if(_0x1088fd){return client[_0xf2cf('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xf2cf('0xa'),'type',_0xf2cf('0x12'),_0xf2cf('0x13')],'where':{'name':_0x1088fd},'limit':0x1}})['then'](function(_0x485882){logger[_0xf2cf('0x4')]('GETVOICEQUEUEBYNAME|'+_0x1088fd+'|'+(_0x485882[_0xf2cf('0xd')][_0xf2cf('0xe')]?'FOUND':_0xf2cf('0xf')));return _0x55f69e(_0x485882['result'][_0xf2cf('0xe')]?_0x485882[_0xf2cf('0xd')][0x0]:null);})[_0xf2cf('0x10')](function(_0x34ade7){logger[_0xf2cf('0x6')](_0x34ade7['stack']);return _0x55f69e(null);});}else{return _0x55f69e(null);}});};exports[_0xf2cf('0x14')]=function(_0xcb6251,_0x4908db){return moment(_0xcb6251)[_0xf2cf('0x15')](_0x4908db,_0xf2cf('0x16'))[_0xf2cf('0x17')](_0xf2cf('0x18'));};exports['subtractTime']=function(_0x85c206,_0x142780){return moment(_0x85c206)[_0xf2cf('0x19')](_0x142780,_0xf2cf('0x16'))['format'](_0xf2cf('0x18'));};exports['diffTime']=function(_0x19c009,_0x2a5dbc){return moment(_0x19c009)[_0xf2cf('0x1a')](moment(_0x2a5dbc),'seconds');};exports[_0xf2cf('0x1b')]=function(_0x1d09d5,_0x31e600){return parseInt(_0x1d09d5,0xa)+parseInt(_0x31e600,0xa);};exports[_0xf2cf('0x1c')]=function(){return moment()[_0xf2cf('0x17')](_0xf2cf('0x18'));};exports[_0xf2cf('0x1d')]=function(_0x477a9c,_0x45987a){if(_0x45987a){return moment(_0x477a9c)[_0xf2cf('0x1d')](_0x45987a);}else{return!![];}};exports[_0xf2cf('0x1e')]=function(_0x5f4c9b,_0x29ee83){if(_0x29ee83){return moment(_0x5f4c9b)[_0xf2cf('0x1e')](_0x29ee83);}else if(_0x5f4c9b){return!![];}else{return![];}}; \ No newline at end of file +var _0x8ad2=['name','interface','GETUSER|','length','FOUND','NOTFOUND','result','catch','getUserByName','type','acw','GETVOICEQUEUEBYNAME|','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','sumTime','now','isAfter','isBefore','jayson/promise','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','request','then','stack','GetUser','internal'];(function(_0x3eba01,_0x5c061a){var _0xa5e828=function(_0xc46c14){while(--_0xc46c14){_0x3eba01['push'](_0x3eba01['shift']());}};_0xa5e828(++_0x5c061a);}(_0x8ad2,0x13e));var _0x28ad=function(_0x29a3f5,_0x198073){_0x29a3f5=_0x29a3f5-0x0;var _0x69fea5=_0x8ad2[_0x29a3f5];return _0x69fea5;};'use strict';var jayson=require(_0x28ad('0x0'));var moment=require('moment');var BPromise=require(_0x28ad('0x1'));var client=jayson[_0x28ad('0x2')][_0x28ad('0x3')]({'port':0x2329});var logger=require(_0x28ad('0x4'))(_0x28ad('0x5'));exports[_0x28ad('0x6')]=function(_0x468945){logger[_0x28ad('0x6')](_0x468945);};exports[_0x28ad('0x7')]=function(_0x5f192d){logger['debug'](JSON[_0x28ad('0x8')](_0x5f192d));};exports[_0x28ad('0x9')]=function(_0x452053){logger[_0x28ad('0x9')](_0x452053['stack']);};exports[_0x28ad('0xa')]=function(_0x598a6f,_0x1e5099){return client[_0x28ad('0xa')](_0x598a6f,{'body':_0x1e5099})[_0x28ad('0xb')](function(_0x24e642){logger[_0x28ad('0x7')](JSON['stringify'](_0x24e642));})['catch'](function(_0x225d97){logger[_0x28ad('0x9')](_0x225d97[_0x28ad('0xc')]);});};function getUser(_0x1343ab){return client[_0x28ad('0xa')](_0x28ad('0xd'),{'options':{'raw':!![],'attributes':['id',_0x28ad('0xe'),_0x28ad('0xf'),_0x28ad('0x10')],'where':_0x1343ab,'limit':0x1}})['then'](function(_0x2ccee8){logger['info'](_0x28ad('0x11')+JSON['stringify'](_0x1343ab)+'|'+(_0x2ccee8['result'][_0x28ad('0x12')]?_0x28ad('0x13'):_0x28ad('0x14')));return _0x2ccee8[_0x28ad('0x15')][_0x28ad('0x12')]?_0x2ccee8[_0x28ad('0x15')][0x0]:null;});}exports['getUserByInternal']=function(_0x201763){return new BPromise(function(_0xa7d56c,_0x4f6413){if(_0x201763){return getUser({'internal':_0x201763})[_0x28ad('0xb')](function(_0x2eb474){return _0xa7d56c(_0x2eb474);})[_0x28ad('0x16')](function(_0x1949b6){logger['error'](_0x1949b6[_0x28ad('0xc')]);return _0xa7d56c(null);});}else{return _0xa7d56c(null);}});};exports['getUserByInterface']=function(_0x255390){return new BPromise(function(_0x27f032,_0x253570){if(_0x255390){return getUser({'interface':_0x255390})[_0x28ad('0xb')](function(_0x2f061e){return _0x27f032(_0x2f061e);})[_0x28ad('0x16')](function(_0x3023c3){logger[_0x28ad('0x9')](_0x3023c3[_0x28ad('0xc')]);return _0x27f032(null);});}else{return _0x27f032(null);}});};exports[_0x28ad('0x17')]=function(_0xd73463){return new BPromise(function(_0x39c6d2,_0x39784d){if(_0xd73463){return getUser({'name':_0xd73463})['then'](function(_0x23a780){return _0x39c6d2(_0x23a780);})['catch'](function(_0x176329){logger[_0x28ad('0x9')](_0x176329[_0x28ad('0xc')]);return _0x39c6d2(null);});}else{return _0x39c6d2(null);}});};exports['getVoiceQueueByName']=function(_0x535008){return new BPromise(function(_0xf4c667,_0x1bc311){if(_0x535008){return client[_0x28ad('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x28ad('0xf'),_0x28ad('0x18'),_0x28ad('0x19'),'acwTimeout'],'where':{'name':_0x535008},'limit':0x1}})[_0x28ad('0xb')](function(_0x7f1679){logger[_0x28ad('0x6')](_0x28ad('0x1a')+_0x535008+'|'+(_0x7f1679['result'][_0x28ad('0x12')]?_0x28ad('0x13'):_0x28ad('0x14')));return _0xf4c667(_0x7f1679['result']['length']?_0x7f1679['result'][0x0]:null);})[_0x28ad('0x16')](function(_0x124205){logger[_0x28ad('0x9')](_0x124205[_0x28ad('0xc')]);return _0xf4c667(null);});}else{return _0xf4c667(null);}});};exports[_0x28ad('0x1b')]=function(_0x43f9d6,_0x24fe8f){return moment(_0x43f9d6)['add'](_0x24fe8f,_0x28ad('0x1c'))[_0x28ad('0x1d')](_0x28ad('0x1e'));};exports[_0x28ad('0x1f')]=function(_0x587f0b,_0x484b5e){return moment(_0x587f0b)[_0x28ad('0x20')](_0x484b5e,_0x28ad('0x1c'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x5ae6e7,_0x2b2eb5){return moment(_0x5ae6e7)['diff'](moment(_0x2b2eb5),_0x28ad('0x1c'));};exports[_0x28ad('0x21')]=function(_0x3dbfb7,_0xdfdc9d){return parseInt(_0x3dbfb7,0xa)+parseInt(_0xdfdc9d,0xa);};exports[_0x28ad('0x22')]=function(){return moment()[_0x28ad('0x1d')](_0x28ad('0x1e'));};exports['isAfter']=function(_0x21db16,_0x2d828e){if(_0x2d828e){return moment(_0x21db16)[_0x28ad('0x23')](_0x2d828e);}else{return!![];}};exports[_0x28ad('0x24')]=function(_0x42f02e,_0x252b96){if(_0x252b96){return moment(_0x42f02e)[_0x28ad('0x24')](_0x252b96);}else if(_0x42f02e){return!![];}else{return![];}}; \ No newline at end of file